diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SampledNativeModel.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SampledNativeModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a4459bfd7d9dd31738ca836bb6d0da47cc1e91c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SampledNativeModel.lean @@ -0,0 +1,585 @@ +import Mathlib.Analysis.LocallyConvex.BalancedCoreHull +import Mathlib.Analysis.Normed.Module.Seminorm.Basic +import OAI.Combinatorics.Progressions.Fourier.WeightedTranslationTwistedCentralFrequency +import OAI.Combinatorics.Progressions.Lattices.NativeIntegerAffinePullbackHom +import OAI.Combinatorics.Progressions.Lattices.ResidueStrideRebase + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem detector_of_unit_detector {X : Type*} [Fintype X] + (μ : FiniteProbabilityWeights X) (S : Seminorm ℂ (X → ℂ)) (atoms : Set (X → ℂ)) + {R δ β : ℝ} (hR : 0 < R) + (hdetect : ∀ g : X → ℂ, (∀ x, ‖g x‖ ≤ 1) → δ / R ≤ S g → + ∃ Q ∈ atoms, β ≤ ‖μ.correlation g Q‖) + (f : X → ℂ) (hf : ∀ x, ‖f x‖ ≤ R) (hS : δ ≤ S f) : + ∃ Q ∈ atoms, R * β ≤ ‖μ.correlation f Q‖ := by + let g : X → ℂ := (R : ℂ)⁻¹ • f + have hg (x : X) : ‖g x‖ ≤ 1 := by + change ‖(R : ℂ)⁻¹ * f x‖ ≤ 1 + rw [norm_mul, norm_inv, Complex.norm_real, Real.norm_of_nonneg hR.le] + calc + R⁻¹ * ‖f x‖ ≤ R⁻¹ * R := mul_le_mul_of_nonneg_left (hf x) (inv_nonneg.mpr hR.le) + _ = 1 := inv_mul_cancel₀ hR.ne' + have hSg : δ / R ≤ S g := by + dsimp only [g] + rw [map_smul_eq_mul, norm_inv, Complex.norm_real, Real.norm_of_nonneg hR.le] + simpa only [div_eq_mul_inv, mul_comm] using + mul_le_mul_of_nonneg_left hS (inv_nonneg.mpr hR.le) + obtain ⟨Q, hQ, hcorr⟩ := hdetect g hg hSg + have heq : μ.correlation g Q = (R : ℂ)⁻¹ * μ.correlation f Q := by + simp only [FiniteProbabilityWeights.correlation, g, Pi.smul_apply, smul_eq_mul, + Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + ring + rw [heq, norm_mul, norm_inv, Complex.norm_real, Real.norm_of_nonneg hR.le] at hcorr + refine ⟨Q, hQ, ?_⟩ + have h := mul_le_mul_of_nonneg_left hcorr hR.le + simpa only [← mul_assoc, mul_inv_cancel₀ hR.ne', one_mul] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +structure NativeSampleCorrelation {σ X : Type*} (w : σ → ℕ) + (degree : ℕ) (p : ℝ) (S : Finset X) (sample : X → σ → ℤ) (f : X → ℂ) where + L : Type + [lie : LieRing L] + [algebra : LieAlgebra ℚ L] + dim : ℕ + [topology : TopologicalSpace (ℝ ⊗[ℚ] L)] + [topologicalAdd : IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [continuousSMul : ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] + [hausdorff : T2Space (ℝ ⊗[ℚ] L)] + model : RationalFilteredNilmanifold L degree dim + test : model.Niltest w + complexity : test.ComplexityLE p + correlation : Real.exp (-p) ≤ ‖𝔼 x ∈ S, f x * star (test.eval (sample x))‖ + +attribute [local instance] NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +namespace NativeSampleCorrelation + +variable {σ X : Type*} {w : σ → ℕ} {s : ℕ} {p q : ℝ} + {S : Finset X} {sample : X → σ → ℤ} {f : X → ℂ} + +noncomputable def mono (V : NativeSampleCorrelation w s p S sample f) (hpq : p ≤ q) : + NativeSampleCorrelation w s q S sample f := + { V with + complexity := V.complexity.mono hpq + correlation := (Real.exp_le_exp.mpr (neg_le_neg hpq)).trans V.correlation } + +theorem exists_of_expansion {eta : (σ → ℤ) → ℂ} + (E : NativeIntegerExpansion w s p eta) (hq : 0 ≤ q) + (hcorr : Real.exp (-q) ≤ ‖𝔼 x ∈ S, f x * star (eta (sample x))‖) : + Nonempty (NativeSampleCorrelation w s (q + p) S sample f) := by + obtain ⟨i, hi⟩ := E.select_sample_correlation S sample f hcorr + exact ⟨{ + L := E.L i + dim := E.dim i + model := E.model i + test := E.test i + complexity := (E.complexity i).mono (le_add_of_nonneg_left hq) + correlation := hi }⟩ + +end NativeSampleCorrelation + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct Pointwise BigOperators + +structure NativeSampleModel {σ X : Type*} (w : σ → ℕ) (degree : ℕ) (p : ℝ) + (sample : X → σ → ℤ) (f : X → ℂ) where + L : Type + [lie : LieRing L] + [algebra : LieAlgebra ℚ L] + dim : ℕ + [topology : TopologicalSpace (ℝ ⊗[ℚ] L)] + [topologicalAdd : IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [continuousSMul : ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] + [hausdorff : T2Space (ℝ ⊗[ℚ] L)] + model : RationalFilteredNilmanifold L degree dim + test : model.Niltest w + norm : test.normBound ≤ 1 + complexity : test.ComplexityLE p + eval : ∀ x, f x = test.eval (sample x) + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +variable {σ X : Type*} {w : σ → ℕ} {degree : ℕ} {p : ℝ} + {sample : X → σ → ℤ} {f : X → ℂ} + +noncomputable def NativeSampleModel.constOne (hp : 2 ≤ p) : + NativeSampleModel w degree p sample (fun _ => 1) where + L := RationalTorus.Algebra 0 + dim := 0 + model := RationalTorus.trivialNilmanifold degree + test := RationalFilteredNilmanifold.Niltest.const (RationalTorus.trivialNilmanifold degree) w 1 + norm := by simp [RationalFilteredNilmanifold.Niltest.const] + complexity := RationalTorus.trivialNilmanifold_const_one_complexity degree w hp + eval _ := rfl + +noncomputable def NativeSampleCorrelation.ofMean {S : Finset X} (hp : 2 ≤ p) + (hmean : Real.exp (-p) ≤ ‖𝔼 x ∈ S, f x‖) : + NativeSampleCorrelation w degree p S sample f where + L := RationalTorus.Algebra 0 + dim := 0 + model := RationalTorus.trivialNilmanifold degree + test := RationalFilteredNilmanifold.Niltest.const (RationalTorus.trivialNilmanifold degree) w 1 + complexity := RationalTorus.trivialNilmanifold_const_one_complexity degree w hp + correlation := by simpa only [RationalFilteredNilmanifold.Niltest.eval_const, star_one, mul_one] using hmean + +noncomputable def NativeSampleModel.smul (F : NativeSampleModel w degree p sample f) + (c : ℂ) (hc : ‖c‖ ≤ 1) : NativeSampleModel w degree p sample (c • f) where + L := F.L + dim := F.dim + model := F.model + test := F.test.scaleComplex c + norm := (F.test.scaleComplex_norm hc).trans F.norm + complexity := F.test.scaleComplex_complexity hc F.complexity + eval x := by change c * f x = c * F.test.eval (sample x); rw [F.eval] + +theorem NativeSampleModel.norm_le (F : NativeSampleModel w degree p sample f) (x : X) : + ‖f x‖ ≤ 1 := by + rw [F.eval] + exact (F.test.norm_eval_le _).trans F.norm + +noncomputable def NativeSampleCorrelation.toSampleModel {S : Finset X} + (V : NativeSampleCorrelation w degree p S sample f) (hV : V.test.normBound ≤ 1) : + NativeSampleModel w degree p sample (fun x => V.test.eval (sample x)) where + L := V.L + dim := V.dim + model := V.model + test := V.test + norm := hV + complexity := V.complexity + eval _ := rfl + +def twistedNativeSampleFunctions {I : Type*} (w : σ → ℕ) (degree : ℕ) (p : ℝ) + (sample : X → σ → ℤ) (twist : I → X → ℂ) : Set (X → ℂ) := + {f | f = 0 ∨ ∃ i g, Nonempty (NativeSampleModel w degree p sample g) ∧ + f = fun x => star (twist i x) * g x} + +theorem twistedNativeSampleFunctions_zero {I : Type*} (twist : I → X → ℂ) : + (0 : X → ℂ) ∈ twistedNativeSampleFunctions w degree p sample twist := Or.inl rfl + +theorem twistedNativeSampleFunctions_balanced {I : Type*} (twist : I → X → ℂ) : + Balanced ℂ (twistedNativeSampleFunctions w degree p sample twist) := by + rintro c hc _ ⟨f, hf, rfl⟩ + rcases hf with rfl | ⟨i, g, ⟨G⟩, rfl⟩ + · exact Or.inl (smul_zero c) + · refine Or.inr ⟨i, c • g, ⟨G.smul c hc⟩, ?_⟩ + funext x + simp only [Pi.smul_apply, smul_eq_mul] + ring + +theorem twistedNativeSampleFunctions_norm {I : Type*} (twist : I → X → ℂ) + (htwist : ∀ i x, ‖twist i x‖ ≤ 1) + (hf : f ∈ twistedNativeSampleFunctions w degree p sample twist) (x : X) : ‖f x‖ ≤ 1 := by + rcases hf with rfl | ⟨i, g, ⟨G⟩, rfl⟩ + · simp + · rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (htwist i x)).trans (G.norm_le x) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +attribute [local instance] NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +theorem nativeCorrelation_restrict_model {A σ : Type*} + (S : Finset A) (hS : S.Nonempty) + (w : σ → ℕ) (degree : ℕ) (p : ℝ) (sample : A → σ → ℤ) + (f twist : A → ℂ) + (V : NativeSampleCorrelation w degree p S sample + (fun x => f x * twist x)) + (hV : V.test.normBound ≤ 1) : + ∃ G : S → ℂ, Nonempty (NativeSampleModel w degree p (fun x => sample x.val) G) ∧ + Real.exp (-p) ≤ ‖(FiniteProbabilityWeights.uniformFinset S hS).correlation (fun x => f x.val) + (fun x => star (twist x.val) * G x)‖ := by + let G : S → ℂ := fun x => V.test.eval (sample x.val) + refine ⟨G, ⟨?_⟩, ?_⟩ + · exact { + L := V.L + dim := V.dim + model := V.model + test := V.test + norm := hV + complexity := V.complexity + eval := fun _ => rfl } + have hc := V.correlation + rw [← FiniteProbabilityWeights.uniformFinset_complexMean S hS + (fun x => (f x * twist x) * star (V.test.eval (sample x)))] at hc + simpa only [G, FiniteProbabilityWeights.correlation, FiniteProbabilityWeights.complexMean, + star_mul, star_star, mul_assoc, mul_left_comm, mul_comm] using hc + +theorem nativeCorrelation_finite_site_model {A σ : Type*} + (S : Finset A) (hS : S.Nonempty) [Nonempty S] + (w : σ → ℕ) (degree : ℕ) (p : ℝ) (sample : A → σ → ℤ) + (g : S → ℂ) (twist : A → ℂ) + (V : NativeSampleCorrelation w degree p S sample + (fun x => finiteSiteExtension Subtype.val g x * twist x)) + (hV : V.test.normBound ≤ 1) : + ∃ G : S → ℂ, Nonempty (NativeSampleModel w degree p (fun x => sample x.val) G) ∧ + Real.exp (-p) ≤ ‖(FiniteProbabilityWeights.uniformFinset S hS).correlation g + (fun x => star (twist x.val) * G x)‖ := by + obtain ⟨G, hG, hc⟩ := nativeCorrelation_restrict_model S hS w degree p sample + (finiteSiteExtension Subtype.val g) twist V hV + refine ⟨G, hG, ?_⟩ + simpa only [finiteSiteExtension_apply Subtype.val Subtype.val_injective] using hc + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct + +theorem commonStridePoint_index_of_mem {I : Type*} [Fintype I] [DecidableEq I] + (c : I → ℤ) (m : ℕ) (len : I → ℕ) {y : I → ℤ} + (hy : y ∈ commonStrideBox c m len) : + commonStridePoint c m (commonStrideIndex c m y) = y := by + rw [commonStrideBox_eq_image] at hy + obtain ⟨x, _, rfl⟩ := Finset.mem_image.mp hy + change commonStridePoint c m (commonStrideIndex c m (commonStridePoint c m x)) = + commonStridePoint c m x + by_cases hm : m = 0 + · subst m + funext i + change c i + (0 : ℤ) * _ = c i + (0 : ℤ) * x i + simp only [zero_mul, add_zero] + · rw [commonStrideIndex_point c (Nat.pos_of_ne_zero hm)] + +namespace RationalFilteredNilmanifold.Niltest + +variable {I L : Type*} [Fintype I] [DecidableEq I] [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] {degree dim : ℕ} + {D : RationalFilteredNilmanifold L degree dim} + +noncomputable def commonStridePullback (T : D.Niltest (fun _ : I => 1)) + (c : I → ℤ) (m : ℕ) : D.Niltest (fun _ : I => 1) := + T.affinePullback (residueStepMatrix (fun _ : I => m)) c + +@[simp] theorem commonStridePullback_observable (T : D.Niltest (fun _ : I => 1)) + (c : I → ℤ) (m : ℕ) : + (T.commonStridePullback c m).observable = T.observable := rfl + +@[simp] theorem commonStridePullback_normBound (T : D.Niltest (fun _ : I => 1)) + (c : I → ℤ) (m : ℕ) : + (T.commonStridePullback c m).normBound = T.normBound := rfl + +@[simp] theorem commonStridePullback_lipBound (T : D.Niltest (fun _ : I => 1)) + (c : I → ℤ) (m : ℕ) : + (T.commonStridePullback c m).lipBound = T.lipBound := rfl + +@[simp] theorem commonStridePullback_complexityLE (T : D.Niltest (fun _ : I => 1)) + (c : I → ℤ) (m : ℕ) (p : ℝ) : + (T.commonStridePullback c m).ComplexityLE p ↔ T.ComplexityLE p := Iff.rfl + +theorem commonStridePullback_eval (T : D.Niltest (fun _ : I => 1)) + (c : I → ℤ) (m : ℕ) (x : I → ℤ) : + (T.commonStridePullback c m).eval x = T.eval (commonStridePoint c m x) := by + rw [commonStridePullback, eval_affinePullback, integerAffineMap_residueStepMatrix] + rfl + +theorem commonStridePullback_eval_index_of_modEq (T : D.Niltest (fun _ : I => 1)) + (c : I → ℤ) (m : ℕ) (y : I → ℤ) + (hy : ∀ i, y i ≡ c i [ZMOD (m : ℤ)]) : + (T.commonStridePullback c m).eval (commonStrideIndex c m y) = T.eval y := by + rw [commonStridePullback_eval, commonStridePoint_index_of_modEq c m y hy] + +theorem commonStridePullback_eval_index_of_mem (T : D.Niltest (fun _ : I => 1)) + (c : I → ℤ) (m : ℕ) (len : I → ℕ) (y : I → ℤ) + (hy : y ∈ commonStrideBox c m len) : + (T.commonStridePullback c m).eval (commonStrideIndex c m y) = T.eval y := by + rw [commonStridePullback_eval, commonStridePoint_index_of_mem c m len hy] + +end RationalFilteredNilmanifold.Niltest + +namespace RationalFilteredNilmanifold.Niltest + +variable {I Ω : Type*} {L : Type} [Fintype I] [DecidableEq I] + [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] {degree dim : ℕ} + {D : RationalFilteredNilmanifold L degree dim} {p : ℝ} + +noncomputable def commonStrideSampleModelOfModEq (T : D.Niltest (fun _ : I => 1)) + (hnorm : T.normBound ≤ 1) (hcomplexity : T.ComplexityLE p) + (c : I → ℤ) (m : ℕ) (site : Ω → I → ℤ) + (hsite : ∀ x i, site x i ≡ c i [ZMOD (m : ℤ)]) : + NativeSampleModel (fun _ : I => 1) degree p + (fun x => commonStrideIndex c m (site x)) (fun x => T.eval (site x)) where + L := L + dim := dim + model := D + test := T.commonStridePullback c m + norm := hnorm + complexity := hcomplexity + eval x := (T.commonStridePullback_eval_index_of_modEq c m (site x) (hsite x)).symm + +noncomputable def commonStrideSampleModel (T : D.Niltest (fun _ : I => 1)) + (hnorm : T.normBound ≤ 1) (hcomplexity : T.ComplexityLE p) + (c : I → ℤ) (m : ℕ) (len : I → ℕ) : + NativeSampleModel (fun _ : I => 1) degree p + (fun y : commonStrideBox c m len => commonStrideIndex c m y.val) + (fun y => T.eval y.val) where + L := L + dim := dim + model := D + test := T.commonStridePullback c m + norm := hnorm + complexity := hcomplexity + eval y := (T.commonStridePullback_eval_index_of_mem c m len y.val y.property).symm + +noncomputable def residueSliceSampleModel (T : D.Niltest (fun _ : I => 1)) + (hnorm : T.normBound ≤ 1) (hcomplexity : T.ComplexityLE p) + {N : I → ℕ} {m : ℕ} (slice : ResidueBoxSlice N m) : + NativeSampleModel (fun _ : I => 1) degree p + (fun y : slice.integerPoints => + commonStrideIndex (fun i => (slice.start i : ℤ)) m y.val) + (fun y => T.eval y.val) where + L := L + dim := dim + model := D + test := T.commonStridePullback (fun i => (slice.start i : ℤ)) m + norm := hnorm + complexity := hcomplexity + eval y := by + apply (T.commonStridePullback_eval_index_of_mem + (fun i => (slice.start i : ℤ)) m slice.length y.val _).symm + rw [← slice.integerPoints_eq_commonStrideBox] + exact y.property + +end RationalFilteredNilmanifold.Niltest + +end Erdos3 + +end + +section + +namespace Erdos3.NativeSampleModel + +open CircleFourier +open scoped TensorProduct BigOperators + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +variable {σ X : Type*} {w : σ → ℕ} {degree : ℕ} {p : ℝ} + {sample : X → σ → ℤ} {f : X → ℂ} + +structure VerticalExpansion (native : NativeSampleModel w degree p sample f) + (q rho : ℝ) where + I : Type + [finite : Fintype I] + frequency : I → native.L →ₗ[ℚ] ℚ + component : I → native.model.Niltest w + card_le : (Fintype.card I : ℝ) ≤ Real.exp (verticalDecompositionBudget q) + height_le : ∀ i j, rationalLogHeight (frequency i (native.model.basis j)) ≤ + verticalDecompositionBudget q + orbit_eq : ∀ i, (component i).orbit = native.test.orbit + norm_eq : ∀ i, (component i).normBound = native.test.normBound + lip_eq : ∀ i, (component i).lipBound = native.test.lipBound + vertical : ∀ i (z : native.model.RealGroup), + z ∈ native.model.filtration.realification.subgroup degree → ∀ x, + (component i).observable (z • x) = + character ((realifyFunctional (frequency i) z.coord : ℝ) : CircleFourier.Circle) * + (component i).observable x + integral : ∀ i, (∃ x, (component i).observable x ≠ 0) → + ∀ z : native.model.RealGroup, + z ∈ native.model.filtration.realification.subgroup degree → + z ∈ native.model.realLattice → ∃ n : ℤ, realifyFunctional (frequency i) z.coord = n + preserves_character : ∀ (z : native.model.RealGroup) (c : ℂ), + (∀ x, native.test.observable (z • x) = c * native.test.observable x) → + ∀ i x, (component i).observable (z • x) = c * (component i).observable x + observable_error : ∀ x, + ‖(∑ i, (component i).observable x) - native.test.observable x‖ ≤ rho + +attribute [instance] VerticalExpansion.finite + +theorem exists_verticalExpansion (native : NativeSampleModel w degree p sample f) + {q rho : ℝ} (hq : 0 ≤ q) (hpq : p ≤ q) (hrho : 0 < rho) + (hrhoq : rho⁻¹ ≤ Real.exp q) : Nonempty (native.VerticalExpansion q rho) := by + obtain ⟨I, inst, frequency, component, hcard, hheight, hcert, + hvert, hint, hpres, herr, _⟩ := + native.test.exists_vertical_decomposition_preserving_bounds_and_characters hq + (native.complexity.mono hpq) hrho hrhoq + exact ⟨{ + I := I + finite := inst + frequency := frequency + component := component + card_le := hcard + height_le := hheight + orbit_eq := fun i => (hcert i).2.1 + norm_eq := fun i => (hcert i).2.2.1 + lip_eq := fun i => (hcert i).2.2.2 + vertical := hvert + integral := hint + preserves_character := hpres + observable_error := herr }⟩ + +theorem exists_verticalExpansion_exp_error (native : NativeSampleModel w degree p sample f) + {r : ℝ} (hp : 0 ≤ p) (hr : 0 ≤ r) : + Nonempty (native.VerticalExpansion (p + r) (Real.exp (-r))) := by + apply native.exists_verticalExpansion (add_nonneg hp hr) (le_add_of_nonneg_right hr) + (Real.exp_pos _) + rw [Real.exp_neg, inv_inv] + exact Real.exp_le_exp.mpr (le_add_of_nonneg_left hp) + +namespace VerticalExpansion + +variable {native : NativeSampleModel w degree p sample f} {q rho : ℝ} + (E : native.VerticalExpansion q rho) + +theorem complexity (i : E.I) : (E.component i).ComplexityLE p := by + refine ⟨native.complexity.1, ?_⟩ + rw [E.norm_eq, E.lip_eq] + exact native.complexity.2 + +theorem normBound_le (i : E.I) : (E.component i).normBound ≤ 1 := by + rw [E.norm_eq] + exact native.norm + +theorem eval_error (x : σ → ℤ) : + ‖(∑ i, (E.component i).eval x) - native.test.eval x‖ ≤ rho := by + simpa only [RationalFilteredNilmanifold.Niltest.eval, E.orbit_eq] using + E.observable_error (QuotientGroup.mk + (native.model.filtration.realification.polynomialOrbitEval w x native.test.orbit)) + +theorem evalReal_error (x : σ → ℝ) : + ‖(∑ i, (E.component i).evalReal x) - native.test.evalReal x‖ ≤ rho := by + simpa only [RationalFilteredNilmanifold.Niltest.evalReal, E.orbit_eq] using + E.observable_error (QuotientGroup.mk + (native.model.filtration.realification.polynomialOrbitRealEval w x native.test.orbit)) + +theorem sample_error (x : X) : + ‖(∑ i, (E.component i).eval (sample x)) - f x‖ ≤ rho := by + rw [native.eval] + exact E.eval_error (sample x) + +theorem norm_eval_le (i : E.I) (x : σ → ℤ) : ‖(E.component i).eval x‖ ≤ 1 := + ((E.component i).norm_eval_le x).trans (E.normBound_le i) + +theorem norm_evalReal_le (i : E.I) (x : σ → ℝ) : ‖(E.component i).evalReal x‖ ≤ 1 := + ((E.component i).norm_evalReal_le x).trans (E.normBound_le i) + +noncomputable def sampleModel (i : E.I) : + NativeSampleModel w degree p sample (fun x => (E.component i).eval (sample x)) where + L := native.L + dim := native.dim + model := native.model + test := E.component i + norm := E.normBound_le i + complexity := E.complexity i + eval _ := rfl + +theorem coefficient_mass : + (∑ _i : E.I, ‖(1 : ℂ)‖) ≤ Real.exp (verticalDecompositionBudget q) := by + simpa using E.card_le + +end VerticalExpansion +end Erdos3.NativeSampleModel + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_sampled_native_model {Ω T X σ I : Type*} + [Fintype Ω] [Fintype T] [Nonempty T] [Fintype X] + {J : Ω → Type*} [∀ z, Nonempty (J z)] + (μ : FiniteProbabilityWeights Ω) (F : Ω → T → X) + (slices : ∀ z, J z → Finset T) (tests : ∀ z, J z → T → ℂ) + (r : FiniteProbabilityWeights X) (hr : ∀ x, 0 < r.weight x) + (w : σ → ℕ) (degree : ℕ) (complexity : ℝ) (sample : X → σ → ℤ) + (twist : I → X → ℂ) (htwist : ∀ i x, ‖twist i x‖ ≤ 1) + {K C B beta tau ε : ℝ} (hK : 0 ≤ K) (hC : 0 ≤ C) + (hB : 0 < B) (hbeta : 0 < beta) (htau : 0 < tau) + (hsize : ∀ z j, (Fintype.card T : ℝ) / (slices z j).card ≤ K) + (htests : ∀ z j t, ‖tests z j t‖ ≤ 1) + (hdetect : ∀ g : X → ℂ, (∀ x, ‖g x‖ ≤ 1) → + (tau / B ^ 2) / max 1 (K * (2 * C) / tau) ≤ sampledSliceSeminorm μ F slices tests g → + ∃ (i : I) (G : X → ℂ), Nonempty (NativeSampleModel w degree complexity sample G) ∧ + beta ≤ ‖r.correlation g (fun x => star (twist i x) * G x)‖) + (hexcess : r.excessMass (μ.siteLaw F) C ≤ ε) + (b : X → ℂ) (hb : ∀ x, ‖b x‖ ≤ B) : + ∃ (n : ℕ) (_ : 0 < n) (Q : Fin n → (X → ℂ)) (c : Fin n → ℝ) (e : X → ℂ), + (∀ i, Q i ∈ twistedNativeSampleFunctions w degree complexity sample twist) ∧ + b = (∑ i, c i • Q i) + e ∧ + (∑ i, |c i|) ≤ 2 / beta ∧ + sampledSliceSeminorm μ F slices tests e ≤ 2 * tau + 2 * K * (B + 2 / beta) * ε ∧ + (n : ℝ) ≤ 1 + 4 * (K * (2 * C)) ^ 2 / (beta ^ 2 * tau ^ 2) := by + let atoms := twistedNativeSampleFunctions w degree complexity sample twist + let cap := max 1 (K * (2 * C) / tau) + have hcap : 1 ≤ cap := le_max_left _ _ + have hdetector (g : X → ℂ) (hg : ∀ x, ‖g x‖ ≤ K * (2 * C) / tau) + (hlarge : tau / B ^ 2 ≤ sampledSliceSeminorm μ F slices tests g) : + ∃ Q ∈ atoms, beta ≤ ‖r.correlation g Q‖ := by + have hunit (v : X → ℂ) (hv : ∀ x, ‖v x‖ ≤ 1) + (hX : (tau / B ^ 2) / cap ≤ sampledSliceSeminorm μ F slices tests v) : + ∃ Q ∈ atoms, beta ≤ ‖r.correlation v Q‖ := by + obtain ⟨i, G, hG, hcorr⟩ := hdetect v hv hX + exact ⟨_, Or.inr ⟨i, G, hG, rfl⟩, hcorr⟩ + obtain ⟨Q, hQ, hc⟩ := detector_of_unit_detector r + (sampledSliceSeminorm μ F slices tests) atoms (lt_of_lt_of_le zero_lt_one hcap) + hunit g (fun x => (hg x).trans (le_max_right _ _)) hlarge + have hscale : beta ≤ cap * beta := by + simpa only [one_mul] using mul_le_mul_of_nonneg_right hcap hbeta.le + exact ⟨Q, hQ, hscale.trans hc⟩ + exact exists_sampled_slice_model μ F slices tests r hr + (twistedNativeSampleFunctions_balanced twist) ⟨0, twistedNativeSampleFunctions_zero twist⟩ + (fun Q hQ x => twistedNativeSampleFunctions_norm twist htwist hQ x) + hK hC hB hbeta htau hsize htests hdetector hexcess b hb + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SampledSliceFixedModelPartners.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SampledSliceFixedModelPartners.lean new file mode 100644 index 0000000000000000000000000000000000000000..8034697e2555d8d45b929996916556ff6f8901f4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SampledSliceFixedModelPartners.lean @@ -0,0 +1,120 @@ +import OAI.Combinatorics.Progressions.Estimates.SampledNativeModel + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem exists_fixed_sampled_slice_model_partners + {Ω T X K : Type*} {J : Ω → Type*} {I : K → Type*} + [Fintype Ω] [Fintype T] [Nonempty T] [Fintype K] + [∀ k, Fintype (I k)] [∀ k, Nonempty (I k)] + (outer : FiniteProbabilityWeights Ω) (productive : Finset Ω) + (physical : Ω → T → X) (slices : ∀ z, J z → Finset T) + (weight : ∀ z, J z → T → ℂ) (selected : ∀ z, K → J z) + (hS : ∀ z j, (slices z j).Nonempty) {cap : ℝ} + (hsize : ∀ z j, (Fintype.card T : ℝ) / (slices z j).card ≤ cap) + (hweight : ∀ z j t, ‖weight z j t‖ ≤ 1) + (v e : K → X → ℂ) (Q : ∀ k, I k → X → ℂ) (c : ∀ k, I k → ℂ) + (hmodel : ∀ k, v k = (∑ i, c k i • Q k i) + e k) + {delta M kappa : ℝ} (hdelta : 0 < delta) (hM : 0 < M) + (hc : ∀ k, (∑ i, ‖c k i‖) ≤ M) + (hproductive : kappa ≤ outer.mass productive) + (herror : (∑ k, sampledSliceSeminorm outer physical slices weight (e k)) ≤ kappa * delta / 8) + (hscore : ∀ z ∈ productive, ∀ k, + delta ≤ ‖𝔼 t ∈ slices z (selected z k), v k (physical z t) * weight z (selected z k) t‖) : + ∃ (partner : ∀ k, I k) (retained : Finset Ω), + retained ⊆ productive ∧ + (3 * kappa / 4) / (∏ k, (Fintype.card (I k) : ℝ)) ≤ outer.mass retained ∧ + ∀ z ∈ retained, ∀ k, delta / (2 * M) ≤ + ‖𝔼 t ∈ slices z (selected z k), Q k (partner k) (physical z t) * weight z (selected z k) t‖ := by + let W := fun z j => normalizedSliceTest (slices z j) (weight z j) + let test := fun z k => sampledTestLinearMap (physical z) (W z (selected z k)) + let err := fun k z => (⨆ j, sampledSingleTestSeminorm (physical z) (W z j)) (e k) + have hW (z) (j) (t) : ‖W z j t‖ ≤ cap := + normalizedSliceTest_norm_le _ _ (hsize z j) (hweight z j) t + have htest (z) (_hz : z ∈ productive) (k) : ‖test z k (e k)‖ ≤ err k z := by + change sampledSingleTestSeminorm (physical z) (W z (selected z k)) (e k) ≤ _ + dsimp only [err] + have hb := sampledSingleTestSeminorm_bddAbove physical W hW z + rw [Seminorm.iSup_apply hb] + exact le_ciSup (Seminorm.bddAbove_range_iff.mp hb (e k)) (selected z k) + have hmean : (∑ k, outer.mean (err k)) ≤ kappa * (delta / 2) / 4 := by + change (∑ k, sampledSliceSeminorm outer physical slices weight (e k)) ≤ _ + convert herror using 1; ring + have heval (z) (k) (f : X → ℂ) : + test z k f = 𝔼 t ∈ slices z (selected z k), f (physical z t) * weight z (selected z k) t := + normalizedSliceTest_mean _ (hS z (selected z k)) _ _ + obtain ⟨partner, retained, hsub, hmass, hlocal⟩ := exists_fixed_linear_model_partners + outer productive v e Q c test err hmodel hdelta hM hc + (fun _ _ => apply_nonneg _ _) htest hproductive hmean + (by intro z hz k; rw [heval]; exact hscore z hz k) + refine ⟨partner, retained, hsub, hmass, ?_⟩ + intro z hz k + simpa only [heval] using hlocal z hz k + +theorem exists_fixed_sampled_slice_native_partners + {Ω T X K σ Θ : Type*} {J : Ω → Type*} {I : K → Type*} + [Fintype Ω] [Fintype T] [Nonempty T] [Fintype K] + [∀ k, Fintype (I k)] [∀ k, Nonempty (I k)] + (outer : FiniteProbabilityWeights Ω) (productive : Finset Ω) + (physical : Ω → T → X) (slices : ∀ z, J z → Finset T) + (weight : ∀ z, J z → T → ℂ) (selected : ∀ z, K → J z) + (hS : ∀ z j, (slices z j).Nonempty) {cap : ℝ} + (hsize : ∀ z j, (Fintype.card T : ℝ) / (slices z j).card ≤ cap) + (hweight : ∀ z j t, ‖weight z j t‖ ≤ 1) + (v e : K → X → ℂ) (Q : ∀ k, I k → X → ℂ) (c : ∀ k, I k → ℂ) + (hmodel : ∀ k, v k = (∑ i, c k i • Q k i) + e k) + {delta M kappa : ℝ} (hdelta : 0 < delta) (hM : 0 < M) + (hc : ∀ k, (∑ i, ‖c k i‖) ≤ M) + (hproductive : kappa ≤ outer.mass productive) + (herror : (∑ k, sampledSliceSeminorm outer physical slices weight (e k)) ≤ kappa * delta / 8) + (hkappa : 0 < kappa) + (w : σ → ℕ) (degree : ℕ) (budget : ℝ) (sample : X → σ → ℤ) (twist : Θ → X → ℂ) + (hQ : ∀ k i, Q k i ∈ twistedNativeSampleFunctions w degree budget sample twist) + (hscore : ∀ z ∈ productive, ∀ k, + delta ≤ ‖𝔼 t ∈ slices z (selected z k), v k (physical z t) * weight z (selected z k) t‖) : + ∃ (fixedTwist : K → Θ) (nativeValue : K → X → ℂ) + (_native : ∀ k, NativeSampleModel w degree budget sample (nativeValue k)) + (retained : Finset Ω), + retained ⊆ productive ∧ 0 < outer.mass retained ∧ + (3 * kappa / 4) / (∏ k, (Fintype.card (I k) : ℝ)) ≤ outer.mass retained ∧ + ∀ z ∈ retained, ∀ k, delta / (2 * M) ≤ + ‖𝔼 t ∈ slices z (selected z k), + (star (twist (fixedTwist k) (physical z t)) * nativeValue k (physical z t)) * + weight z (selected z k) t‖ := by + obtain ⟨partner, retained, hsub, hmass, hlocal⟩ := exists_fixed_sampled_slice_model_partners + outer productive physical slices weight selected hS hsize hweight v e Q c hmodel + hdelta hM hc hproductive herror hscore + have hmasspos : 0 < outer.mass retained := (div_pos + (by positivity : 0 < 3 * kappa / 4) + (Finset.prod_pos (fun k _ => Nat.cast_pos.mpr Fintype.card_pos))).trans_le hmass + have hne : retained.Nonempty := Finset.nonempty_iff_ne_empty.mpr (by + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty] at hmasspos + linarith) + obtain ⟨z₀, hz₀⟩ := hne + have hchosen (k) : ∃ (t : Θ) (g : X → ℂ), + Nonempty (NativeSampleModel w degree budget sample g) ∧ + Q k (partner k) = fun x => star (twist t x) * g x := by + rcases hQ k (partner k) with hzero | hnative + · have hn := hlocal z₀ hz₀ k + rw [hzero] at hn + simp only [Pi.zero_apply, zero_mul] at hn + have hpos : 0 < delta / (2 * M) := div_pos hdelta (by positivity) + simp at hn + linarith + · exact hnative + choose fixedTwist nativeValue hnative heq using hchosen + let native := fun k => Classical.choice (hnative k) + refine ⟨fixedTwist, nativeValue, native, retained, hsub, hmasspos, hmass, ?_⟩ + intro z hz k + simpa only [heq k] using hlocal z hz k + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SaturatedFlag.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SaturatedFlag.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc13082171cc32215fe63a317ff24624a769751d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SaturatedFlag.lean @@ -0,0 +1,599 @@ +import Mathlib.Algebra.EuclideanDomain.Int +import Mathlib.Basic.Real.Basic +import Mathlib.LinearAlgebra.Basis.Prod +import Mathlib.LinearAlgebra.FreeModule.PID +import Mathlib.LinearAlgebra.LinearIndependent.Lemmas +import Mathlib.LinearAlgebra.Projection + +namespace OAI + +section + +namespace Erdos3.IntegerBasisReduction.SaturatedFlag + +open scoped BigOperators +open Function Set Submodule +open Module + +variable {M : Type*} [AddCommGroup M] + +def IsSaturated (P : Submodule ℤ M) : Prop := + ∀ (a : ℤ) (x : M), a ≠ 0 → a • x ∈ P → x ∈ P + +def IsAdaptedTo {κ : Type*} (b : Basis κ ℤ M) + (P : Submodule ℤ M) : Prop := + ∃ s : Set κ, P = Submodule.span ℤ (b '' s) + +@[simp] theorem isSaturated_bot [Module.IsTorsionFree ℤ M] : + IsSaturated (⊥ : Submodule ℤ M) := by + intro a x ha hx + rw [Submodule.mem_bot] at hx ⊢ + exact (smul_eq_zero.mp hx).resolve_left ha + +@[simp] theorem isSaturated_top : IsSaturated (⊤ : Submodule ℤ M) := by + intro _ _ _ _ + exact Submodule.mem_top + +theorem IsSaturated.comap_subtype {P O : Submodule ℤ M} + (hP : IsSaturated P) (_hPO : P ≤ O) : + IsSaturated (P.comap O.subtype) := by + intro a x ha hx + change (a • (x : M)) ∈ P at hx + change (x : M) ∈ P + exact hP a x ha hx + +theorem IsSaturated.comap_subtype_of_le {P O : Submodule ℤ M} + (hP : IsSaturated P) (hPO : P ≤ O) : + IsSaturated (P.comap O.subtype) := + hP.comap_subtype hPO + +def rationalEmbed (d : ℕ) : (Fin d → ℤ) →ₗ[ℤ] (Fin d → ℚ) where + toFun x i := (x i : ℚ) + map_add' x y := by + ext i + simp + map_smul' a x := by + ext i + simp + +@[simp] theorem rationalEmbed_apply {d : ℕ} (x : Fin d → ℤ) (i : Fin d) : + rationalEmbed d x i = (x i : ℚ) := rfl + +theorem rationalEmbed_zsmul {d : ℕ} (a : ℤ) (x : Fin d → ℤ) : + rationalEmbed d (a • x) = (a : ℚ) • rationalEmbed d x := by + ext i + simp [rationalEmbed] + +def rationalSpanLattice {d : ℕ} (S : Set (Fin d → ℤ)) : + Submodule ℤ (Fin d → ℤ) := + ((Submodule.span ℚ (rationalEmbed d '' S)).restrictScalars ℤ).comap + (rationalEmbed d) + +@[simp] theorem mem_rationalSpanLattice {d : ℕ} {S : Set (Fin d → ℤ)} + {x : Fin d → ℤ} : + x ∈ rationalSpanLattice S ↔ + rationalEmbed d x ∈ Submodule.span ℚ (rationalEmbed d '' S) := + Iff.rfl + +theorem isSaturated_rationalSpanLattice {d : ℕ} + (S : Set (Fin d → ℤ)) : IsSaturated (rationalSpanLattice S) := by + intro a x ha hx + rw [mem_rationalSpanLattice] at hx ⊢ + have hax : (a : ℚ) • rationalEmbed d x ∈ + Submodule.span ℚ (rationalEmbed d '' S) := by + rw [← rationalEmbed_zsmul] + exact hx + have hinv := (Submodule.span ℚ (rationalEmbed d '' S)).smul_mem + (a : ℚ)⁻¹ hax + simpa [smul_smul, ha] using hinv + +theorem rationalSpanLattice_mono {d : ℕ} {S T : Set (Fin d → ℤ)} + (hST : S ⊆ T) : rationalSpanLattice S ≤ rationalSpanLattice T := by + intro x hx + rw [mem_rationalSpanLattice] at hx ⊢ + exact Submodule.span_mono (Set.image_mono hST) hx + +def realEmbed (d : ℕ) : (Fin d → ℤ) →ₗ[ℤ] (Fin d → ℝ) where + toFun x i := (x i : ℝ) + map_add' x y := by + ext i + simp + map_smul' a x := by + ext i + simp + +@[simp] theorem realEmbed_apply {d : ℕ} (x : Fin d → ℤ) (i : Fin d) : + realEmbed d x i = (x i : ℝ) := rfl + +theorem realEmbed_zsmul {d : ℕ} (a : ℤ) (x : Fin d → ℤ) : + realEmbed d (a • x) = (a : ℝ) • realEmbed d x := by + ext i + simp [realEmbed] + +def realPrefixLattice {d n : ℕ} (x : Fin n → (Fin d → ℤ)) (i : Fin n) : + Submodule ℤ (Fin d → ℤ) := + ((Submodule.span ℝ (realEmbed d '' (x '' Set.Iic i))).restrictScalars ℤ).comap + (realEmbed d) + +@[simp] theorem mem_realPrefixLattice {d n : ℕ} + {x : Fin n → (Fin d → ℤ)} {i : Fin n} {z : Fin d → ℤ} : + z ∈ realPrefixLattice x i ↔ + realEmbed d z ∈ + Submodule.span ℝ (realEmbed d '' (x '' Set.Iic i)) := + Iff.rfl + +theorem isSaturated_realPrefixLattice {d n : ℕ} + (x : Fin n → (Fin d → ℤ)) (i : Fin n) : + IsSaturated (realPrefixLattice x i) := by + intro a z ha hz + rw [mem_realPrefixLattice] at hz ⊢ + have haz : (a : ℝ) • realEmbed d z ∈ + Submodule.span ℝ (realEmbed d '' (x '' Set.Iic i)) := by + rw [← realEmbed_zsmul] + exact hz + have hinv := + (Submodule.span ℝ (realEmbed d '' (x '' Set.Iic i))).smul_mem + (a : ℝ)⁻¹ haz + simpa [smul_smul, ha] using hinv + +theorem monotone_realPrefixLattice {d n : ℕ} + (x : Fin n → (Fin d → ℤ)) : Monotone (realPrefixLattice x) := by + intro i j hij z hz + rw [mem_realPrefixLattice] at hz ⊢ + apply Submodule.span_mono (Set.image_mono (Set.image_mono ?_)) hz + intro k hk + exact hk.trans hij + +theorem self_mem_realPrefixLattice {d n : ℕ} + (x : Fin n → (Fin d → ℤ)) (i : Fin n) : + x i ∈ realPrefixLattice x i := by + rw [mem_realPrefixLattice] + apply Submodule.subset_span + exact ⟨x i, ⟨i, Set.mem_Iic.mpr le_rfl, rfl⟩, rfl⟩ + +section Smith + +variable {ι : Type*} [Finite ι] + +omit [Finite ι] in + +theorem smithVector_mem_of_isSaturated (_b : Basis ι ℤ M) + (P : Submodule ℤ M) (hP : IsSaturated P) {n : ℕ} + (snf : Basis.SmithNormalForm P ι n) (i : Fin n) : + snf.bM (snf.f i) ∈ P := by + classical + have hai : snf.a i ≠ 0 := by + intro hai + apply (snf.bN.ne_zero i) + apply Subtype.ext + simp [snf.snf i, hai] + exact hP (snf.a i) (snf.bM (snf.f i)) hai <| by + simpa [snf.snf i] using (snf.bN i).property + +theorem exists_isCompl_of_isSaturated (b : Basis ι ℤ M) + (P : Submodule ℤ M) (hP : IsSaturated P) : + ∃ Q : Submodule ℤ M, IsCompl P Q := by + classical + let snf := P.smithNormalForm b + let selected : Set ι := Set.range snf.2.f + let Q : Submodule ℤ M := + Submodule.span ℤ (snf.2.bM '' selectedᶜ) + have hselected : + P = Submodule.span ℤ (snf.2.bM '' selected) := by + apply le_antisymm + · intro x hx + let xp : P := ⟨x, hx⟩ + have hxp : xp ∈ Submodule.span ℤ (Set.range snf.2.bN) := by + rw [snf.2.bN.span_eq] + exact Submodule.mem_top + exact Submodule.span_induction (R := ℤ) (s := Set.range snf.2.bN) + (p := fun y _ ↦ (y : M) ∈ + Submodule.span ℤ (snf.2.bM '' selected)) + (fun y hy ↦ by + obtain ⟨i, rfl⟩ := hy + rw [snf.2.snf i] + apply Submodule.smul_mem + apply Submodule.subset_span + exact ⟨snf.2.f i, ⟨i, rfl⟩, rfl⟩) + (Submodule.zero_mem _) + (fun _ _ _ _ hy hz ↦ Submodule.add_mem _ hy hz) + (fun a _ _ hy ↦ Submodule.smul_mem _ a hy) + hxp + · refine Submodule.span_le.mpr ?_ + rintro _ ⟨j, ⟨i, rfl⟩, rfl⟩ + exact smithVector_mem_of_isSaturated b P hP snf.2 i + refine ⟨Q, ?_⟩ + rw [hselected] + exact snf.2.bM.linearIndependent.isCompl_span_image + snf.2.bM.span_eq (isCompl_compl) + +theorem exists_basis_extending_of_isSaturated (b : Basis ι ℤ M) + (P : Submodule ℤ M) (hP : IsSaturated P) + {κ : Type*} (bP : Basis κ ℤ P) : + ∃ (m : ℕ) (bM : Basis (κ ⊕ Fin m) ℤ M), + ∀ i, bM (Sum.inl i) = (bP i : M) := by + classical + obtain ⟨Q, hPQ⟩ := exists_isCompl_of_isSaturated b P hP + obtain ⟨m, bQ⟩ := Submodule.basisOfPid b Q + let e : (P × Q) ≃ₗ[ℤ] M := P.prodEquivOfIsCompl Q hPQ + let bM : Basis (κ ⊕ Fin m) ℤ M := (bP.prod bQ).map e + refine ⟨m, bM, ?_⟩ + intro i + simp [bM, e] + +theorem span_image_inl_eq_of_span_comap_eq + {P R : Submodule ℤ M} (hRP : R ≤ P) + {κ μ : Type*} (bP : Basis κ ℤ P) (bM : Basis (κ ⊕ μ) ℤ M) + (hext : ∀ i, bM (Sum.inl i) = (bP i : M)) (s : Set κ) + (hspan : R.comap P.subtype = Submodule.span ℤ (bP '' s)) : + R = Submodule.span ℤ (bM '' (Sum.inl '' s)) := by + have himage : P.subtype '' (bP '' s) = bM '' (Sum.inl '' s) := by + ext x + constructor + · rintro ⟨_, ⟨i, hi, rfl⟩, rfl⟩ + exact ⟨Sum.inl i, ⟨i, hi, rfl⟩, hext i⟩ + · rintro ⟨_, ⟨i, hi, rfl⟩, rfl⟩ + exact ⟨bP i, ⟨i, hi, rfl⟩, (hext i).symm⟩ + calc + R = (R.comap P.subtype).map P.subtype := + (Submodule.map_comap_eq_self (by + simpa [Submodule.range_subtype] using hRP)).symm + _ = (Submodule.span ℤ (bP '' s)).map P.subtype := by rw [hspan] + _ = Submodule.span ℤ (P.subtype '' (bP '' s)) := by + rw [Submodule.map_span] + _ = Submodule.span ℤ (bM '' (Sum.inl '' s)) := by rw [himage] + +theorem span_range_inl_prod_eq {P Q : Submodule ℤ M} (hPQ : IsCompl P Q) + {κ μ : Type*} + (bP : Basis κ ℤ P) (bQ : Basis μ ℤ Q) : + let bM := (bP.prod bQ).map (P.prodEquivOfIsCompl Q hPQ) + P = Submodule.span ℤ (bM '' Set.range Sum.inl) := by + classical + let bM := (bP.prod bQ).map (P.prodEquivOfIsCompl Q hPQ) + apply le_antisymm + · intro x hx + let xp : P := ⟨x, hx⟩ + have hxp : xp ∈ Submodule.span ℤ (Set.range bP) := by + rw [bP.span_eq] + exact Submodule.mem_top + exact Submodule.span_induction (R := ℤ) (s := Set.range bP) + (p := fun y _ ↦ (y : M) ∈ + Submodule.span ℤ (bM '' Set.range Sum.inl)) + (fun y hy ↦ by + obtain ⟨i, rfl⟩ := hy + apply Submodule.subset_span + refine ⟨Sum.inl i, ⟨i, rfl⟩, ?_⟩ + simp [bM]) + (Submodule.zero_mem _) + (fun _ _ _ _ hy hz ↦ Submodule.add_mem _ hy hz) + (fun a _ _ hy ↦ Submodule.smul_mem _ a hy) + hxp + · refine Submodule.span_le.mpr ?_ + rintro _ ⟨_, ⟨i, rfl⟩, rfl⟩ + simp + +theorem exists_basis_with_repr_eq_zero_iff (b : Basis ι ℤ M) + (P : Submodule ℤ M) (hP : IsSaturated P) : + ∃ (κ : Type) (_ : Fintype κ) (bM : Basis κ ℤ M) (s : Set κ), + ∀ x : M, x ∈ P ↔ ∀ j ∉ s, bM.repr x j = 0 := by + classical + obtain ⟨Q, hPQ⟩ := exists_isCompl_of_isSaturated b P hP + obtain ⟨n, bP⟩ := Submodule.basisOfPid b P + obtain ⟨m, bQ⟩ := Submodule.basisOfPid b Q + let e : (P × Q) ≃ₗ[ℤ] M := P.prodEquivOfIsCompl Q hPQ + let bM : Basis (Fin n ⊕ Fin m) ℤ M := (bP.prod bQ).map e + let s : Set (Fin n ⊕ Fin m) := Set.range Sum.inl + refine ⟨Fin n ⊕ Fin m, inferInstance, bM, s, ?_⟩ + intro x + constructor + · intro hxP j hj + have hx : ((P.prodEquivOfIsCompl Q hPQ).symm x).2 = 0 := + (P.prodEquivOfIsCompl_symm_apply_snd_eq_zero Q hPQ).mpr hxP + cases j with + | inl i => exact False.elim (hj ⟨i, rfl⟩) + | inr i => + change bQ.repr ((e.symm x).2) i = 0 + rw [hx] + simp + · intro hx + apply (P.prodEquivOfIsCompl_symm_apply_snd_eq_zero Q hPQ).mp + apply bQ.repr.injective + ext i + have hi := hx (Sum.inr i) (by simp [s]) + change bQ.repr ((e.symm x).2) i = 0 at hi + simpa [e] using hi + +end Smith + +universe u + +theorem exists_basis_with_nested_supports_of_saturated_flag (n : ℕ) : + ∀ {N : Type u} [AddCommGroup N] {ι : Type} [Finite ι], + (b₀ : Basis ι ℤ N) → + (P : Fin n → Submodule ℤ N) → + (∀ i, IsSaturated (P i)) → Antitone P → + ∃ (κ : Type) (_ : Fintype κ) (b : Basis κ ℤ N) + (s : Fin n → Set κ), Antitone s ∧ + ∀ i, P i = Submodule.span ℤ (b '' s i) := by + induction n with + | zero => + intro N _ ι _ b₀ P _ _ + classical + let := Fintype.ofFinite ι + let b : Basis (Fin (Fintype.card ι)) ℤ N := + b₀.reindex (Fintype.equivFin ι) + let s : Fin 0 → Set (Fin (Fintype.card ι)) := Fin.elim0 + exact ⟨Fin (Fintype.card ι), inferInstance, b, s, + fun i ↦ Fin.elim0 i, fun i ↦ Fin.elim0 i⟩ + | succ n ih => + intro N _ ι _ b₀ P hsat hanti + classical + let P₀ : Submodule ℤ N := P 0 + obtain ⟨p, bP₀⟩ := Submodule.basisOfPid b₀ P₀ + let tail : Fin n → Submodule ℤ P₀ := + fun i ↦ (P i.succ).comap P₀.subtype + have htail_sat : ∀ i, IsSaturated (tail i) := by + intro i + apply (hsat i.succ).comap_subtype + exact hanti (Fin.zero_le i.succ) + have htail_anti : Antitone tail := by + intro i j hij + apply Submodule.comap_mono + exact hanti (by simpa using hij) + obtain ⟨κ, instκ, bP, sP, hsPanti, hbP⟩ := + ih (N := P₀) (ι := Fin p) bP₀ tail htail_sat htail_anti + let : Fintype κ := instκ + obtain ⟨Q, hP₀Q⟩ := + exists_isCompl_of_isSaturated b₀ P₀ (hsat 0) + obtain ⟨m, bQ⟩ := Submodule.basisOfPid b₀ Q + let e : (P₀ × Q) ≃ₗ[ℤ] N := P₀.prodEquivOfIsCompl Q hP₀Q + let b : Basis (κ ⊕ Fin m) ℤ N := (bP.prod bQ).map e + let s : Fin (n + 1) → Set (κ ⊕ Fin m) := + fun i ↦ Fin.cases (Set.range Sum.inl) + (fun j ↦ Sum.inl '' sP j) i + refine ⟨κ ⊕ Fin m, inferInstance, b, s, ?_, ?_⟩ + · intro i j hij + obtain rfl | ⟨i', rfl⟩ := i.eq_zero_or_eq_succ + · obtain rfl | ⟨j', rfl⟩ := j.eq_zero_or_eq_succ + · exact fun _ hx ↦ hx + · rintro x ⟨k, hk, rfl⟩ + exact Set.mem_range.mpr ⟨k, rfl⟩ + · obtain rfl | ⟨j', rfl⟩ := j.eq_zero_or_eq_succ + · exact False.elim ((not_le_of_gt (Fin.succ_pos i')) hij) + · exact Set.image_mono (hsPanti (by simpa using hij)) + · intro i + refine Fin.cases ?_ (fun j ↦ ?_) i + · exact span_range_inl_prod_eq hP₀Q bP bQ + · apply span_image_inl_eq_of_span_comap_eq + (P := P₀) (R := P j.succ) (hanti (Fin.zero_le j.succ)) + bP b (fun k ↦ by simp [b, e]) (sP j) + simpa [tail, P₀] using hbP j + +theorem exists_basis_adapted_to_saturated_flag (n : ℕ) + {N : Type u} [AddCommGroup N] {ι : Type} [Finite ι] + (b₀ : Basis ι ℤ N) (P : Fin n → Submodule ℤ N) + (hsat : ∀ i, IsSaturated (P i)) (hanti : Antitone P) : + ∃ (κ : Type) (_ : Fintype κ) (b : Basis κ ℤ N), + ∀ i, IsAdaptedTo b (P i) := by + obtain ⟨κ, instκ, b, s, _hsanti, hs⟩ := + exists_basis_with_nested_supports_of_saturated_flag n b₀ P hsat hanti + exact ⟨κ, instκ, b, fun i ↦ ⟨s i, hs i⟩⟩ + +theorem exists_basis_with_nested_supports_of_monotone_saturated_flag + (n : ℕ) {N : Type u} [AddCommGroup N] {ι : Type} [Finite ι] + (b₀ : Basis ι ℤ N) (P : Fin n → Submodule ℤ N) + (hsat : ∀ i, IsSaturated (P i)) (hmono : Monotone P) : + ∃ (κ : Type) (_ : Fintype κ) (b : Basis κ ℤ N) + (s : Fin n → Set κ), Monotone s ∧ + ∀ i, P i = Submodule.span ℤ (b '' s i) := by + let Prev : Fin n → Submodule ℤ N := fun i ↦ P i.rev + have hPrev : Antitone Prev := by + intro i j hij + exact hmono (Fin.rev_anti hij) + obtain ⟨κ, instκ, b, t, htanti, ht⟩ := + exists_basis_with_nested_supports_of_saturated_flag n b₀ Prev + (fun i ↦ hsat i.rev) hPrev + let s : Fin n → Set κ := fun i ↦ t i.rev + refine ⟨κ, instκ, b, s, ?_, ?_⟩ + · intro i j hij + exact htanti (Fin.rev_anti hij) + · intro i + simpa [s, Prev] using ht i.rev + +theorem repr_eq_zero_of_mem_span_image {N : Type*} [AddCommGroup N] + {κ : Type*} (b : Basis κ ℤ N) (s : Set κ) {x : N} + (hx : x ∈ Submodule.span ℤ (b '' s)) {j : κ} (hj : j ∉ s) : + b.repr x j = 0 := by + have hsupp := b.repr_support_subset_of_mem_span s hx + by_contra hne + exact hj (hsupp (Finsupp.mem_support_iff.mpr hne)) + +theorem exists_basis_with_nested_supports_rationalSpanLattice + {d n : ℕ} (S : Fin n → Set (Fin d → ℤ)) (hS : Antitone S) : + ∃ (κ : Type) (_ : Fintype κ) (b : Basis κ ℤ (Fin d → ℤ)) + (s : Fin n → Set κ), Antitone s ∧ + ∀ i, rationalSpanLattice (S i) = + Submodule.span ℤ (b '' s i) := by + let P : Fin n → Submodule ℤ (Fin d → ℤ) := + fun i ↦ rationalSpanLattice (S i) + have hPanti : Antitone P := by + intro i j hij + exact rationalSpanLattice_mono (hS hij) + simpa [P] using + (exists_basis_with_nested_supports_of_saturated_flag n + (Pi.basisFun ℤ (Fin d)) P + (fun i ↦ isSaturated_rationalSpanLattice (S i)) hPanti) + +theorem exists_basis_with_nested_supports_realPrefixLattice + {d n : ℕ} (x : Fin n → (Fin d → ℤ)) : + ∃ (κ : Type) (_ : Fintype κ) (b : Basis κ ℤ (Fin d → ℤ)) + (s : Fin n → Set κ), Monotone s ∧ + ∀ i, realPrefixLattice x i = + Submodule.span ℤ (b '' s i) := by + exact exists_basis_with_nested_supports_of_monotone_saturated_flag n + (Pi.basisFun ℤ (Fin d)) (realPrefixLattice x) + (isSaturated_realPrefixLattice x) (monotone_realPrefixLattice x) + +theorem exists_fin_basis_with_nested_supports_realPrefixLattice + {n : ℕ} (x : Fin n → (Fin n → ℤ)) : + ∃ (b : Basis (Fin n) ℤ (Fin n → ℤ)) (s : Fin n → Set (Fin n)), + Monotone s ∧ + (∀ i, realPrefixLattice x i = + Submodule.span ℤ (b '' s i)) ∧ + ∀ i j, j ∉ s i → b.repr (x i) j = 0 := by + classical + obtain ⟨κ, instκ, bκ, sκ, hsmono, hs⟩ := + exists_basis_with_nested_supports_realPrefixLattice x + let : Fintype κ := instκ + let e : κ ≃ Fin n := bκ.indexEquiv (Pi.basisFun ℤ (Fin n)) + let b : Basis (Fin n) ℤ (Fin n → ℤ) := bκ.reindex e + let s : Fin n → Set (Fin n) := fun i ↦ e '' sκ i + have himage (i : Fin n) : b '' s i = bκ '' sκ i := by + ext y + constructor + · rintro ⟨_, ⟨k, hk, rfl⟩, rfl⟩ + exact ⟨k, hk, by simp [b, e]⟩ + · rintro ⟨k, hk, rfl⟩ + exact ⟨e k, ⟨k, hk, rfl⟩, by simp [b, e]⟩ + have hspan (i : Fin n) : realPrefixLattice x i = + Submodule.span ℤ (b '' s i) := by + rw [himage] + exact hs i + refine ⟨b, s, ?_, hspan, ?_⟩ + · intro i j hij + exact Set.image_mono (hsmono hij) + · intro i j hj + apply repr_eq_zero_of_mem_span_image b (s i) + · rw [← hspan i] + exact self_mem_realPrefixLattice x i + · exact hj + +theorem exists_prefix_adapted_basis_realPrefixLattice + {n : ℕ} (x : Fin n → (Fin n → ℤ)) + (hli : LinearIndependent ℝ (fun i ↦ realEmbed n (x i))) : + ∃ b : Basis (Fin n) ℤ (Fin n → ℤ), + (∀ i, realPrefixLattice x i = + Submodule.span ℤ (b '' Set.Iic i)) ∧ + (∀ i j, i < j → b.repr (x i) j = 0) ∧ + ∀ i, b.repr (x i) i ≠ 0 := by + classical + obtain ⟨b, s, hsmono, hspan, hzero⟩ := + exists_fin_basis_with_nested_supports_realPrefixLattice x + have hpivot : ∀ i : Fin n, ∃ j : Fin n, + j ∈ s i ∧ b.repr (x i) j ≠ 0 ∧ + ∀ hi : 0 < i.val, + j ∉ s (⟨i.val - 1, by omega⟩ : Fin n) := by + intro i + by_cases hi : 0 < i.val + · let ip : Fin n := ⟨i.val - 1, by omega⟩ + have hset : Set.Iic ip = Set.Iio i := by + ext k + simp only [Set.mem_Iic, Set.mem_Iio, Fin.le_iff_val_le_val, + Fin.lt_def, ip] + omega + have hnot : x i ∉ realPrefixLattice x ip := by + intro hmem + have him := (mem_realPrefixLattice.mp hmem) + apply hli.notMem_span_image (s := Set.Iio i) (lt_irrefl i) + simpa [Set.image_image, Function.comp_def, hset] using him + have hnotspan : x i ∉ Submodule.span ℤ (b '' s ip) := by + rw [← hspan ip] + exact hnot + have hnsub : ¬ ((b.repr (x i)).support : Set (Fin n)) ⊆ s ip := by + simpa [b.mem_span_image] using hnotspan + obtain ⟨j, hjmem, hjnot⟩ := Set.not_subset.mp hnsub + have hjne : b.repr (x i) j ≠ 0 := Finsupp.mem_support_iff.mp hjmem + have hjcur : j ∈ s i := by + by_contra hj + exact hjne (hzero i j hj) + refine ⟨j, hjcur, hjne, ?_⟩ + intro _hi + simpa [ip] using hjnot + · have hxne : x i ≠ 0 := by + intro hx + apply hli.ne_zero i + simp [hx] + have hrepr : b.repr (x i) ≠ 0 := by + intro hr + apply hxne + apply b.repr.injective + simpa using hr + obtain ⟨j, hjmem⟩ := Finsupp.support_nonempty_iff.mpr hrepr + have hjne : b.repr (x i) j ≠ 0 := Finsupp.mem_support_iff.mp hjmem + have hjcur : j ∈ s i := by + by_contra hj + exact hjne (hzero i j hj) + exact ⟨j, hjcur, hjne, fun h ↦ (hi h).elim⟩ + choose p hp_mem hp_ne hp_prev using hpivot + have hp_injective : Function.Injective p := by + intro i j hpij + by_contra hij + rcases lt_or_gt_of_ne hij with hijlt | hjilt + · have hjpos : 0 < j.val := lt_of_le_of_lt (Nat.zero_le _) hijlt + let jp : Fin n := ⟨j.val - 1, by omega⟩ + have hijp : i ≤ jp := by + apply Fin.le_iff_val_le_val.mpr + change i.val ≤ j.val - 1 + omega + have hpimem : p i ∈ s jp := hsmono hijp (hp_mem i) + have hpjnot : p j ∉ s jp := by + simpa [jp] using hp_prev j hjpos + exact hpjnot (hpij ▸ hpimem) + · have hipos : 0 < i.val := lt_of_le_of_lt (Nat.zero_le _) hjilt + let ip : Fin n := ⟨i.val - 1, by omega⟩ + have hjip : j ≤ ip := by + apply Fin.le_iff_val_le_val.mpr + change j.val ≤ i.val - 1 + omega + have hpjmem : p j ∈ s ip := hsmono hjip (hp_mem j) + have hpinot : p i ∉ s ip := by + simpa [ip] using hp_prev i hipos + exact hpinot (hpij.symm ▸ hpjmem) + have hp_bijective : Function.Bijective p := + (Fintype.bijective_iff_injective_and_card p).mpr + ⟨hp_injective, rfl⟩ + let ep : Fin n ≃ Fin n := Equiv.ofBijective p hp_bijective + have hs_eq (i : Fin n) : p '' Set.Iic i = s i := by + apply Set.Subset.antisymm + · rintro _ ⟨k, hk, rfl⟩ + exact hsmono (Set.mem_Iic.mp hk) (hp_mem k) + · intro q hq + obtain ⟨k, rfl⟩ := hp_bijective.2 q + refine ⟨k, ?_, rfl⟩ + apply Set.mem_Iic.mpr + by_contra hki + have hik : i < k := lt_of_not_ge hki + have hkpos : 0 < k.val := lt_of_le_of_lt (Nat.zero_le _) hik + let kp : Fin n := ⟨k.val - 1, by omega⟩ + have hikp : i ≤ kp := by + apply Fin.le_iff_val_le_val.mpr + change i.val ≤ k.val - 1 + omega + exact (hp_prev k hkpos) (hsmono hikp hq) + let b' : Basis (Fin n) ℤ (Fin n → ℤ) := b.reindex ep.symm + have hbimage (i : Fin n) : b' '' Set.Iic i = b '' s i := by + rw [← hs_eq i] + ext y + constructor + · rintro ⟨k, hk, rfl⟩ + exact ⟨p k, ⟨k, hk, rfl⟩, by simp [b', ep]⟩ + · rintro ⟨_, ⟨k, hk, rfl⟩, rfl⟩ + exact ⟨k, hk, by simp [b', ep]⟩ + have hspan' (i : Fin n) : realPrefixLattice x i = + Submodule.span ℤ (b' '' Set.Iic i) := by + rw [hbimage] + exact hspan i + refine ⟨b', hspan', ?_, ?_⟩ + · intro i j hij + apply repr_eq_zero_of_mem_span_image b' (Set.Iic i) + · rw [← hspan' i] + exact self_mem_realPrefixLattice x i + · exact fun hj ↦ (not_le_of_gt hij) (Set.mem_Iic.mp hj) + · intro i + simpa [b', ep] using hp_ne i + +end Erdos3.IntegerBasisReduction.SaturatedFlag + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarBadSublevelRamp.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarBadSublevelRamp.lean new file mode 100644 index 0000000000000000000000000000000000000000..af575c4b1de8d4a0cdf8c9be539ac3c7efa6291a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarBadSublevelRamp.lean @@ -0,0 +1,44 @@ +import Mathlib.Analysis.Normed.Group.Basic +import Mathlib.Tactic +import Mathlib.Topology.MetricSpace.Lipschitz + +namespace OAI + +section + +namespace Erdos3 +open scoped NNReal + +noncomputable def scalarBadSublevelRamp (κ t : ℝ) : ℝ := + max 0 (min 1 (2 - 2 * |t| / κ)) + +theorem scalarBadSublevelRamp_range (κ t : ℝ) : + scalarBadSublevelRamp κ t ∈ Set.Icc (0 : ℝ) 1 := by + exact ⟨le_max_left _ _, max_le zero_le_one (min_le_left _ _)⟩ + +theorem scalarBadSublevelRamp_eq_one {κ t : ℝ} (hκ : 0 < κ) (ht : |t| ≤ κ / 2) : + scalarBadSublevelRamp κ t = 1 := by + have hr : 2 * |t| / κ ≤ 1 := (div_le_one hκ).mpr (by linarith) + rw [scalarBadSublevelRamp, min_eq_left (by linarith), max_eq_right zero_le_one] + +theorem scalarBadSublevelRamp_eq_zero {κ t : ℝ} (hκ : 0 < κ) (ht : κ ≤ |t|) : + scalarBadSublevelRamp κ t = 0 := by + have hr : 2 ≤ 2 * |t| / κ := (le_div_iff₀ hκ).mpr (by linarith) + rw [scalarBadSublevelRamp, min_eq_right (by linarith), max_eq_left (by linarith)] + +theorem scalarBadSublevelRamp_lipschitz {κ : ℝ} (hκ : 0 < κ) : + LipschitzWith ⟨2 / κ, by positivity⟩ (scalarBadSublevelRamp κ) := by + have hraw : LipschitzWith ⟨2 / κ, by positivity⟩ (fun t : ℝ => 2 - 2 * |t| / κ) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Real.dist_eq, Real.dist_eq] + have he : (2 - 2 * |x| / κ) - (2 - 2 * |y| / κ) = -(2 / κ) * (|x| - |y|) := by ring + rw [he, abs_mul, abs_neg, abs_of_nonneg (by positivity : 0 ≤ 2 / κ)] + exact mul_le_mul_of_nonneg_left (abs_abs_sub_abs_le_abs_sub x y) (by positivity) + exact (hraw.const_min 1).const_max 0 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeBoundaryCost.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeBoundaryCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6e68c3c05aa4a530e08a09eb88749290a9ee6e7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeBoundaryCost.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Estimates.BooleanMinorDimension +import OAI.Combinatorics.Progressions.Probability.ScalarCubeDomainDensity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +noncomputable def scalarCubeLinearMap {α : Type*} [Fintype α] [DecidableEq α] (t : Finset α) : + (Option α → ℝ) →L[ℝ] ℝ := + ∑ r : Option α, (booleanFeature r t : ℝ) • ContinuousLinearMap.proj r + +theorem scalarCubeLinearMap_apply {α : Type*} [Fintype α] [DecidableEq α] + (t : Finset α) (a : Option α → ℝ) : scalarCubeLinearMap t a = scalarCubeValue a t := by + simp only [scalarCubeLinearMap, sum_apply, smul_apply, + ContinuousLinearMap.proj_apply, smul_eq_mul, scalarCubeValue] + +theorem scalarCubeLinearMap_single {α : Type*} [Fintype α] [DecidableEq α] + (t : Finset α) (r : Option α) : + scalarCubeLinearMap t (Pi.single r 1) = (booleanFeature r t : ℝ) := by + rw [scalarCubeLinearMap_apply] + simp [scalarCubeValue, Pi.single_apply, mul_ite] + +theorem scalarCubeLinearMap_norm_le {α : Type*} [Fintype α] [DecidableEq α] (t : Finset α) : + ‖scalarCubeLinearMap t‖ ≤ (Fintype.card α : ℝ) + 1 := by + have h := clm_norm_le_card_mul_of_basis (scalarCubeLinearMap t) zero_le_one (fun r => by + rw [scalarCubeLinearMap_single, Real.norm_eq_abs] + exact booleanFeature_abs_le_one r t) + simpa only [Fintype.card_option, Nat.cast_add, Nat.cast_one, mul_one] using h + +theorem scalarCubeValue_fderiv_norm_le {α : Type*} [Fintype α] [DecidableEq α] + (t : Finset α) (a : Option α → ℝ) : + ‖fderiv ℝ (fun x => scalarCubeValue x t) a‖ ≤ (Fintype.card α : ℝ) + 1 := by + have heq : (fun x => scalarCubeValue x t) = scalarCubeLinearMap t := + funext (fun x => (scalarCubeLinearMap_apply t x).symm) + rw [heq, ContinuousLinearMap.fderiv] + exact scalarCubeLinearMap_norm_le t + +theorem scalarCubeFace_fderiv_norm_le {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) (a : Option α → ℝ) : + ‖fderiv ℝ (scalarCubeFace i) a‖ ≤ (Fintype.card α : ℝ) + 1 := by + rcases i with ⟨b, t⟩ + cases b with + | false => exact scalarCubeValue_fderiv_norm_le t a + | true => + change ‖fderiv ℝ (fun x => 1 - scalarCubeValue x t) a‖ ≤ _ + rw [fderiv_const_sub, norm_neg] + exact scalarCubeValue_fderiv_norm_le t a + +theorem scalarCubeBoundaryCutoff_compact (α : Type*) [Fintype α] [DecidableEq α] + {r : ℝ} (hr : 0 < r) : + HasCompactSupport (inequalityBoundaryCutoff (fun _ : Bool × Finset α => r) scalarCubeFace) := by + apply inequalityBoundaryCutoff_compact _ (fun _ => hr) _ (fun i => (scalarCubeFace_contDiff i).continuous) + rw [positiveInequalityDomain_scalarCubeFace] + exact scalarCubeDomain_isBounded α + +theorem scalarCubeBoundaryCutoff_fderiv_norm_le {α : Type*} [Fintype α] [DecidableEq α] + (A : ℝ≥0) (hLip : LipschitzWith A Real.smoothTransition) {r : ℝ} (hr : 0 < r) + (a : Option α → ℝ) : + ‖fderiv ℝ (inequalityBoundaryCutoff (fun _ : Bool × Finset α => r) scalarCubeFace) a‖ ≤ + ((2 * 2 ^ Fintype.card α : ℕ) : ℝ) * ((A : ℝ) / r * ((Fintype.card α : ℝ) + 1)) := by + apply (inequalityBoundaryCutoff_fderiv_norm_le A hLip _ (fun _ => hr) + scalarCubeFace scalarCubeFace_contDiff a).trans + calc + _ ≤ ∑ _i : Bool × Finset α, (A : ℝ) / r * ((Fintype.card α : ℝ) + 1) := + Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (scalarCubeFace_fderiv_norm_le i a) + (div_nonneg A.coe_nonneg hr.le)) + _ = _ := by rw [Finset.sum_const, Finset.card_univ, scalarCubeFace_card, nsmul_eq_mul] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeBoundaryVolume.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeBoundaryVolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..39e3da3db0df967ddd369685d783f8e57dbd9a05 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeBoundaryVolume.lean @@ -0,0 +1,117 @@ +import Mathlib.MeasureTheory.Measure.Lebesgue.Basic +import OAI.Combinatorics.Progressions.Estimates.FiniteFiberVolumeBound +import OAI.Combinatorics.Progressions.Geometry.ScalarCubeCoordinates + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +def scalarCubeFaceStrip {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) (u : ℝ) : Set (Option α → ℝ) := + scalarCubeDomain α ∩ {a | scalarCubeFace i a < u} + +theorem scalarCubeFaceStrip_measurable {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) (u : ℝ) : MeasurableSet (scalarCubeFaceStrip i u) := + (scalarCubeDomain_isOpen α).measurableSet.inter + (measurableSet_lt (scalarCubeFace_contDiff i).continuous.measurable measurable_const) + +theorem scalarCubeFaceStrip_volume_lt_top {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) (u : ℝ) : volume (scalarCubeFaceStrip i u) < ⊤ := + (measure_mono Set.inter_subset_left).trans_lt (scalarCubeDomain_volume_lt_top α) + +theorem scalarCubeFaceStrip_fiber_interval {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) (u : ℝ) (b : α → ℝ) : + ∃ lo : ℝ, {y | scalarCubeJoin (b, y) ∈ scalarCubeFaceStrip i u} ⊆ Set.Ioo lo (lo + u) := by + rcases i with ⟨side, t⟩ + cases side with + | false => + refine ⟨-(∑ k ∈ t, b k), ?_⟩ + intro y hy + have hpos := (hy.1 t).1 + have hupper := hy.2 + change scalarCubeValue (scalarCubeJoin (b, y)) t < u at hupper + rw [scalarCubeJoin_value] at hpos hupper + exact ⟨by linarith, by linarith⟩ + | true => + refine ⟨1 - (∑ k ∈ t, b k) - u, ?_⟩ + intro y hy + have hpos := (hy.1 t).2 + have hlower := hy.2 + change 1 - scalarCubeValue (scalarCubeJoin (b, y)) t < u at hlower + rw [scalarCubeJoin_value] at hpos hlower + exact ⟨by linarith, by linarith⟩ + +theorem scalarCubeFaceStrip_fiber_volume_le {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) {u : ℝ} (hu : 0 ≤ u) (b : α → ℝ) : + volume.real {y | scalarCubeJoin (b, y) ∈ scalarCubeFaceStrip i u} ≤ u := by + obtain ⟨lo, hsub⟩ := scalarCubeFaceStrip_fiber_interval i u b + have hlen : volume.real (Set.Ioo lo (lo + u)) = u := by + rw [Real.volume_real_Ioo] + simpa only [add_sub_cancel_left] using max_eq_left hu + exact (measureReal_mono (μ := volume) hsub (by simp [Real.volume_Ioo])).trans_eq hlen + +theorem scalarCubeFaceStrip_base_bound {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) (u : ℝ) {z : (α → ℝ) × ℝ} + (hz : scalarCubeJoin z ∈ scalarCubeFaceStrip i u) : z.1 ∈ Metric.closedBall (0 : α → ℝ) 1 := by + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro k + have h := (scalarCubeDomain_coordinate_abs_lt_one hz.1 (some k)).le + simpa only [scalarCubeJoin_some, Real.norm_eq_abs] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory + +theorem scalarCubeFaceStrip_volume_le {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) {u : ℝ} (hu : 0 ≤ u) : + volume.real (scalarCubeFaceStrip i u) ≤ (2 : ℝ) ^ Fintype.card α * u := by + let s : Set ((α → ℝ) × ℝ) := scalarCubeJoin ⁻¹' scalarCubeFaceStrip i u + have hs : MeasurableSet s := (scalarCubeFaceStrip_measurable i u).preimage (scalarCubeJoin_measurable α) + have hpres := scalarCubeJoin_measurePreserving α + have hmass : volume s = volume (scalarCubeFaceStrip i u) := + hpres.measure_preimage (scalarCubeFaceStrip_measurable i u).nullMeasurableSet + have hreal : volume.real s = volume.real (scalarCubeFaceStrip i u) := + hpres.measureReal_preimage (scalarCubeFaceStrip_measurable i u).nullMeasurableSet + have hsfin : (volume : Measure ((α → ℝ) × ℝ)) s ≠ ⊤ := by + rw [hmass] + exact (scalarCubeFaceStrip_volume_lt_top i u).ne + have h := product_measureReal_le_of_fiber_bound + (volume : Measure (α → ℝ)) (volume : Measure ℝ) s hs hsfin + (Metric.closedBall (0 : α → ℝ) 1) measurableSet_closedBall + (isCompact_closedBall _ _).measure_ne_top + (fun z hz => scalarCubeFaceStrip_base_bound i u hz) + (scalarCubeFaceStrip_fiber_volume_le i hu) + change volume.real s ≤ _ at h + rw [hreal] at h + have hbase : volume.real (Metric.closedBall (0 : α → ℝ) 1) = (2 : ℝ) ^ Fintype.card α := by + rw [measureReal_def, Real.volume_pi_closedBall _ (by norm_num)] + simp + rw [hbase] at h + exact h + +theorem scalarCubeFaceStrip_weighted_volume_le {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) {u : ℝ} (hu : 0 ≤ u) : + (∫ _ in scalarCubeFaceStrip i u, scalarCubeDomainDensity α) ≤ + scalarCubeDomainDensity α * (2 : ℝ) ^ Fintype.card α * u := by + rw [setIntegral_const, smul_eq_mul] + have h := mul_le_mul_of_nonneg_left (scalarCubeFaceStrip_volume_le i hu) + (scalarCubeDomainDensity_pos α).le + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeCokernelCutoff.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeCokernelCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..b59484b15ef2112031cbc42b4229f9315a959278 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeCokernelCutoff.lean @@ -0,0 +1,132 @@ +import OAI.Combinatorics.Progressions.Lattices.CubeResidueSupport + +namespace OAI + + +namespace Erdos3 + +open scoped Matrix + +theorem integerMatrix_scaled_period {I J : Type*} [Fintype I] [Fintype J] + (A : Matrix I J ℤ) (m a : ℤ) + (hperiod : integerScalarLattice I a ≤ A.mulVecLin.range) : + integerScalarLattice I (m * a) ≤ (m • A).mulVecLin.range := by + rintro y ⟨z, rfl⟩ + change (m * a) • z ∈ (m • A).mulVecLin.range + obtain ⟨u, hu⟩ := hperiod ((integerScalarLattice_mem a _).mpr ⟨z, rfl⟩) + refine ⟨u, ?_⟩ + change (m • A) *ᵥ u = (m * a) • z + change A *ᵥ u = a • z at hu + rw [Matrix.smul_mulVec, hu, smul_smul] + +theorem integerCokernelExponent_scaled_le {I J : Type*} [Fintype I] [Fintype J] + (A : Matrix I J ℤ) (m : ℕ) (hm : 0 < m) + (hA : 0 < integerCokernelExponent A.mulVecLin.range) : + integerCokernelExponent ((m : ℤ) • A).mulVecLin.range ≤ + m * integerCokernelExponent A.mulVecLin.range := by + have hp := integerMatrix_scaled_period A (m : ℤ) (integerCokernelExponent A.mulVecLin.range : ℤ) + (integerCokernelExponent_period A.mulVecLin.range) + have hp' : integerScalarLattice I ((m * integerCokernelExponent A.mulVecLin.range : ℕ) : ℤ) ≤ + ((m : ℤ) • A).mulVecLin.range := by simpa only [Nat.cast_mul] using hp + exact Nat.le_of_dvd (Nat.mul_pos hm hA) + (integerCokernelExponent_dvd_period _ _ hp') + +theorem scaled_nonzeroMinor {I J : Type*} [Fintype I] [DecidableEq I] + (A : Matrix I J ℤ) (m : ℤ) (s : I → J) + (h : (((m • A).submatrix id s).det) ≠ 0) : + (A.submatrix id s).det ≠ 0 := by + intro hz + apply h + change (m • A.submatrix id s).det = 0 + rw [Matrix.det_smul, hz, mul_zero] + +theorem scaled_largeCokernel_implies {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix I J ℤ) (m B : ℕ) (hm : 0 < m) + (hminor : ∃ s : I → J, (((m : ℤ) • A).submatrix id s).det ≠ 0) + (hB : m * B < integerCokernelExponent ((m : ℤ) • A).mulVecLin.range) : + (∃ s : I → J, (A.submatrix id s).det ≠ 0) ∧ + B < integerCokernelExponent A.mulVecLin.range := by + obtain ⟨s, hs⟩ := hminor + have hs' := scaled_nonzeroMinor A (m : ℤ) s hs + have hpos := (integerCokernelExponent_le_det A.mulVecLin.range (A.submatrix id s) hs' + (integerColumnMinor_range_le A s)).1 + have hle := integerCokernelExponent_scaled_le A m hm hpos + exact ⟨⟨s, hs'⟩, (Nat.mul_lt_mul_left hm).mp (hB.trans_le hle)⟩ + +end Erdos3 + + +namespace Erdos3 + +def HasBoundedScalarPeriod {I : Type*} [Fintype I] (L : Submodule ℤ (I → ℤ)) (B : ℕ) : Prop := + ∃ a : ℕ, 0 < a ∧ a ≤ B ∧ integerScalarLattice I (a : ℤ) ≤ L + +theorem hasBoundedScalarPeriod_iff {I : Type*} [Fintype I] + (L : Submodule ℤ (I → ℤ)) (hL : 0 < integerCokernelExponent L) (B : ℕ) : + HasBoundedScalarPeriod L B ↔ integerCokernelExponent L ≤ B := by + constructor + · rintro ⟨a, ha, haB, hperiod⟩ + exact (Nat.le_of_dvd ha (integerCokernelExponent_dvd_period L a hperiod)).trans haB + · intro hB + exact ⟨integerCokernelExponent L, hL, hB, integerCokernelExponent_period L⟩ + +theorem scalarCube_no_bounded_period_iff {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] {L : ℕ} + (B : ℕ) (x : J → IntegerScalarCubeBox I L) : + ((∃ s : I → J, ((scalarCubeDifferenceMatrix x).submatrix id s).det ≠ 0) ∧ + ¬ HasBoundedScalarPeriod (scalarCubeDifferenceMatrix x).mulVecLin.range B) ↔ + scalarCubeLargeCokernelEvent B x := by + have hpos (h : ∃ s : I → J, ((scalarCubeDifferenceMatrix x).submatrix id s).det ≠ 0) : + 0 < integerCokernelExponent (scalarCubeDifferenceMatrix x).mulVecLin.range := by + obtain ⟨s, hs⟩ := h + exact (integerCokernelExponent_le_det _ _ hs (integerColumnMinor_range_le _ s)).1 + constructor + · rintro ⟨hminor, hperiod⟩ + exact ⟨hminor, Nat.lt_of_not_ge (hperiod ∘ (hasBoundedScalarPeriod_iff _ (hpos hminor) B).mpr)⟩ + · rintro ⟨hminor, hB⟩ + exact ⟨hminor, fun hp => (Nat.not_le_of_lt hB) ((hasBoundedScalarPeriod_iff _ (hpos hminor) B).mp hp)⟩ + + +def stridedScalarCubeLargeCokernelEvent {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] {L : ℕ} + (m B : ℕ) (x : J → IntegerScalarCubeBox I L) : Prop := + (∃ s : I → J, (((m : ℤ) • scalarCubeDifferenceMatrix x).submatrix id s).det ≠ 0) ∧ + B < integerCokernelExponent ((m : ℤ) • scalarCubeDifferenceMatrix x).mulVecLin.range + +theorem stridedScalarCube_largeCokernel_probability_le {I J : Type*} + [Fintype I] [DecidableEq I] [Nonempty I] [Fintype J] [DecidableEq J] + (L m B : ℕ) (hL : 0 < L) (hsize : Fintype.card I + 1 ≤ L) (hm : 0 < m) (hB : 0 < B) + (hJ : Fintype.card J = Fintype.card I * (Fintype.card I + 2)) : + (FiniteProbabilityWeights.pi (fun _ : J => integerScalarCubeWeights I L hL)).eventProbability + (stridedScalarCubeLargeCokernelEvent m (m * B)) ≤ + (integerScalarCubeDensityCap I * (1 + ((Fintype.card I).factorial : ℝ))) ^ + Fintype.card J / (B : ℝ) := by + apply (FiniteProbabilityWeights.eventProbability_mono _ _ (scalarCubeLargeCokernelEvent B) ?_).trans + (scalarCube_largeCokernel_probability_le L B hL hsize hB hJ) + intro x hx + exact scaled_largeCokernel_implies (scalarCubeDifferenceMatrix x) m B hm hx.1 hx.2 + + +theorem exists_scalarCube_cokernel_cutoff (I J : Type*) + [Fintype I] [DecidableEq I] [Nonempty I] [Fintype J] [DecidableEq J] + (hJ : Fintype.card J = Fintype.card I * (Fintype.card I + 2)) + (ε : ℝ) (hε : 0 < ε) : + ∃ B : ℕ, 0 < B ∧ ∀ (L m : ℕ) (hL : 0 < L), Fintype.card I + 1 ≤ L → 0 < m → + (FiniteProbabilityWeights.pi (fun _ : J => integerScalarCubeWeights I L hL)).eventProbability + (stridedScalarCubeLargeCokernelEvent m (m * B)) ≤ ε := by + let C := (integerScalarCubeDensityCap I * (1 + ((Fintype.card I).factorial : ℝ))) ^ Fintype.card J + obtain ⟨B, hB⟩ := exists_nat_gt (max 1 (C / ε)) + have hBpos : 0 < B := by + have h : (1 : ℝ) < B := (le_max_left _ _).trans_lt hB + exact_mod_cast (zero_lt_one.trans h) + have hbound : C / (B : ℝ) ≤ ε := by + apply (div_le_iff₀ (by exact_mod_cast hBpos)).mpr + have h := (div_lt_iff₀ hε).mp ((le_max_right _ _).trans_lt hB) + linarith + refine ⟨B, hBpos, fun L m hL hsize hm => ?_⟩ + exact (stridedScalarCube_largeCokernel_probability_le L m B hL hsize hm hBpos hJ).trans hbound + +end Erdos3 + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeDomain.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeDomain.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a560948cfa99e6a21b27224f720ad9914e0595a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeDomain.lean @@ -0,0 +1,233 @@ +import Mathlib.Analysis.Normed.Module.FiniteDimension +import Mathlib.Topology.MetricSpace.Bounded +import OAI.Combinatorics.Progressions.Dynamics.ProductCutoffBudget +import OAI.Combinatorics.Progressions.Estimates.SmoothHalfspaceCutoff +import OAI.Combinatorics.Progressions.Polynomial.PolynomialDeterminantDerivativeBound + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators ContDiff NNReal + +def positiveInequalityDomain {I E : Type*} (d : I → E → ℝ) : Set E := + {x | ∀ i, 0 < d i x} + +theorem positiveInequalityDomain_isOpen {I E : Type*} [Fintype I] [TopologicalSpace E] + (d : I → E → ℝ) (hd : ∀ i, Continuous (d i)) : IsOpen (positiveInequalityDomain d) := by + have heq : positiveInequalityDomain d = ⋂ i, {x | 0 < d i x} := by + ext x + simp [positiveInequalityDomain] + rw [heq] + exact isOpen_iInter_of_finite (fun i => isOpen_lt continuous_const (hd i)) + +noncomputable def inequalityBoundaryCutoff {I E : Type*} [Fintype I] + (r : I → ℝ) (d : I → E → ℝ) (x : E) : ℝ := + ∏ i, halfspaceCutoff (r i) (d i) x + +theorem inequalityBoundaryCutoff_range {I E : Type*} [Fintype I] + (r : I → ℝ) (d : I → E → ℝ) (x : E) : + inequalityBoundaryCutoff r d x ∈ Set.Icc (0 : ℝ) 1 := + product_cutoff_range _ (fun i => halfspaceCutoff_range (r i) (d i) x) + +theorem inequalityBoundaryCutoff_smooth {I E : Type*} [Fintype I] + [NormedAddCommGroup E] [NormedSpace ℝ E] (r : I → ℝ) (d : I → E → ℝ) + (hd : ∀ i, ContDiff ℝ ∞ (d i)) : ContDiff ℝ ∞ (inequalityBoundaryCutoff r d) := + contDiff_prod (fun i _ => contDiff_halfspaceCutoff (r i) (d i) (hd i)) + +theorem inequalityBoundaryCutoff_tsupport_subset {I E : Type*} [Fintype I] + [TopologicalSpace E] (r : I → ℝ) (hr : ∀ i, 0 < r i) + (d : I → E → ℝ) (hd : ∀ i, Continuous (d i)) : + tsupport (inequalityBoundaryCutoff r d) ⊆ {x | ∀ i, r i ≤ d i x} := by + intro x hx i + exact halfspaceCutoff_tsupport_subset (hr i) (d i) (hd i) + (product_cutoff_tsupport_subset (fun j => halfspaceCutoff (r j) (d j)) i hx) + +theorem inequalityBoundaryCutoff_tsupport_domain {I E : Type*} [Fintype I] + [TopologicalSpace E] (r : I → ℝ) (hr : ∀ i, 0 < r i) + (d : I → E → ℝ) (hd : ∀ i, Continuous (d i)) : + tsupport (inequalityBoundaryCutoff r d) ⊆ positiveInequalityDomain d := by + intro x hx i + exact (hr i).trans_le (inequalityBoundaryCutoff_tsupport_subset r hr d hd hx i) + +theorem inequalityBoundaryCutoff_compact {I E : Type*} [Fintype I] + [MetricSpace E] [ProperSpace E] (r : I → ℝ) (hr : ∀ i, 0 < r i) + (d : I → E → ℝ) (hd : ∀ i, Continuous (d i)) + (hbounded : Bornology.IsBounded (positiveInequalityDomain d)) : + HasCompactSupport (inequalityBoundaryCutoff r d) := by + apply Metric.isCompact_of_isClosed_isBounded (isClosed_tsupport _) + exact hbounded.subset (inequalityBoundaryCutoff_tsupport_domain r hr d hd) + +theorem inequalityBoundaryCutoff_eq_one {I E : Type*} [Fintype I] + (r : I → ℝ) (hr : ∀ i, 0 < r i) (d : I → E → ℝ) {x : E} + (hx : ∀ i, 2 * r i ≤ d i x) : inequalityBoundaryCutoff r d x = 1 := + Finset.prod_eq_one (fun i _ => halfspaceCutoff_eq_one (hr i) (d i) (hx i)) + +theorem inequalityBoundaryCutoff_fderiv_norm_le {I E : Type*} [Fintype I] + [NormedAddCommGroup E] [NormedSpace ℝ E] + (A : ℝ≥0) (hLip : LipschitzWith A Real.smoothTransition) + (r : I → ℝ) (hr : ∀ i, 0 < r i) (d : I → E → ℝ) (hd : ∀ i, ContDiff ℝ ∞ (d i)) (x : E) : + ‖fderiv ℝ (inequalityBoundaryCutoff r d) x‖ ≤ + ∑ i, ((A : ℝ) / r i) * ‖fderiv ℝ (d i) x‖ := by + apply (product_cutoff_fderiv_norm_le (fun i => halfspaceCutoff (r i) (d i)) x + (fun i => ((contDiff_halfspaceCutoff (r i) (d i) (hd i)).differentiable (by norm_num)).differentiableAt) + (fun i => halfspaceCutoff_range (r i) (d i) x)).trans + exact Finset.sum_le_sum (fun i _ => halfspaceCutoff_fderiv_norm_le A hLip (hr i) (d i) + (((hd i).differentiable (by norm_num)).differentiableAt)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem halfspaceCutoff_measurable {E : Type*} [MeasurableSpace E] + (r : ℝ) (d : E → ℝ) (hd : Measurable d) : Measurable (halfspaceCutoff r d) := + Real.smoothTransition.continuous.measurable.comp ((hd.div_const r).sub_const 1) + +theorem halfspaceCutoff_integral_loss_le {E : Type*} [MeasurableSpace E] + (μ : Measure E) [IsFiniteMeasure μ] {r : ℝ} (hr : 0 < r) + (d : E → ℝ) (hd : Measurable d) : + (∫ x, 1 - halfspaceCutoff r d x ∂μ) ≤ μ.real {x | d x < 2 * r} := by + let s := {x | d x < 2 * r} + have hs : MeasurableSet s := measurableSet_lt hd measurable_const + have hfi := cutoff_integrable μ _ (halfspaceCutoff_measurable r d hd) (halfspaceCutoff_range r d) + calc + _ ≤ ∫ x, s.indicator (fun _ => (1 : ℝ)) x ∂μ := by + apply integral_mono ((integrable_const (1 : ℝ)).sub hfi) + ((integrable_const (1 : ℝ)).indicator hs) + intro x + change 1 - halfspaceCutoff r d x ≤ s.indicator (fun _ => (1 : ℝ)) x + by_cases hx : x ∈ s + · rw [Set.indicator_of_mem hx] + linarith [(halfspaceCutoff_range r d x).1] + · rw [Set.indicator_of_notMem hx, halfspaceCutoff_eq_one hr d (le_of_not_gt hx)] + norm_num + _ = _ := integral_indicator_one hs + +theorem inequalityBoundaryCutoff_integral_loss_le {I E : Type*} [Fintype I] [MeasurableSpace E] + (μ : Measure E) [IsFiniteMeasure μ] (r : I → ℝ) (hr : ∀ i, 0 < r i) + (d : I → E → ℝ) (hd : ∀ i, Measurable (d i)) : + (∫ x, 1 - inequalityBoundaryCutoff r d x ∂μ) ≤ ∑ i, μ.real {x | d i x < 2 * r i} := by + apply (product_cutoff_integral_loss_le μ (fun i => halfspaceCutoff (r i) (d i)) + (fun i => halfspaceCutoff_measurable (r i) (d i) (hd i)) + (fun i => halfspaceCutoff_range (r i) (d i))).trans + exact Finset.sum_le_sum (fun i _ => halfspaceCutoff_integral_loss_le μ (hr i) (d i) (hd i)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators ContDiff + +noncomputable def scalarCubeValue {α : Type*} [Fintype α] [DecidableEq α] + (a : Option α → ℝ) (t : Finset α) : ℝ := + ∑ r : Option α, (booleanFeature r t : ℝ) * a r + +theorem scalarCubeValue_empty {α : Type*} [Fintype α] [DecidableEq α] + (a : Option α → ℝ) : scalarCubeValue a ∅ = a none := by + simp [scalarCubeValue, Fintype.sum_option, booleanFeature] + +theorem scalarCubeValue_singleton {α : Type*} [Fintype α] [DecidableEq α] + (a : Option α → ℝ) (i : α) : scalarCubeValue a {i} = a none + a (some i) := by + simp [scalarCubeValue, Fintype.sum_option, booleanFeature] + +theorem scalarCubeValue_contDiff {α : Type*} [Fintype α] [DecidableEq α] (t : Finset α) : + ContDiff ℝ ∞ (fun a : Option α → ℝ => scalarCubeValue a t) := by + unfold scalarCubeValue + apply ContDiff.sum + intro r _ + exact contDiff_const.mul (ContinuousLinearMap.proj r : (Option α → ℝ) →L[ℝ] ℝ).contDiff + +def scalarCubeDomain (α : Type*) [Fintype α] [DecidableEq α] : Set (Option α → ℝ) := + {a | ∀ t : Finset α, scalarCubeValue a t ∈ Set.Ioo (0 : ℝ) 1} + +noncomputable def scalarCubeFace {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) (a : Option α → ℝ) : ℝ := + if i.1 then 1 - scalarCubeValue a i.2 else scalarCubeValue a i.2 + +theorem scalarCubeFace_contDiff {α : Type*} [Fintype α] [DecidableEq α] (i : Bool × Finset α) : + ContDiff ℝ ∞ (scalarCubeFace i) := by + rcases i with ⟨b, t⟩ + cases b with + | false => exact scalarCubeValue_contDiff t + | true => exact contDiff_const.sub (scalarCubeValue_contDiff t) + +theorem positiveInequalityDomain_scalarCubeFace (α : Type*) [Fintype α] [DecidableEq α] : + positiveInequalityDomain (@scalarCubeFace α _ _) = scalarCubeDomain α := by + ext a + constructor + · intro ha t + have hlo : 0 < scalarCubeValue a t := ha (false, t) + have hhi : 0 < 1 - scalarCubeValue a t := ha (true, t) + exact ⟨hlo, by linarith⟩ + · intro ha i + rcases i with ⟨b, t⟩ + cases b with + | false => exact (ha t).1 + | true => exact sub_pos.mpr (ha t).2 + +theorem scalarCubeDomain_isOpen (α : Type*) [Fintype α] [DecidableEq α] : + IsOpen (scalarCubeDomain α) := by + rw [← positiveInequalityDomain_scalarCubeFace α] + exact positiveInequalityDomain_isOpen _ (fun i => (scalarCubeFace_contDiff i).continuous) + +theorem scalarCubeDomain_coordinate_abs_lt_one {α : Type*} [Fintype α] [DecidableEq α] + {a : Option α → ℝ} (ha : a ∈ scalarCubeDomain α) (r : Option α) : |a r| < 1 := by + have hzero := ha ∅ + rw [scalarCubeValue_empty] at hzero + cases r with + | none => exact abs_lt.mpr ⟨by linarith [hzero.1], hzero.2⟩ + | some i => + have hi := ha {i} + rw [scalarCubeValue_singleton] at hi + exact abs_lt.mpr ⟨by linarith [hzero.1, hzero.2, hi.1], by linarith [hzero.1, hi.2]⟩ + +theorem scalarCubeDomain_isBounded (α : Type*) [Fintype α] [DecidableEq α] : + Bornology.IsBounded (scalarCubeDomain α) := by + apply (Metric.isBounded_closedBall (x := (0 : Option α → ℝ)) (r := 1)).subset + intro a ha + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro r + simpa only [Real.norm_eq_abs] using (scalarCubeDomain_coordinate_abs_lt_one ha r).le + +noncomputable def scalarCubeCenter (α : Type*) : Option α → ℝ + | none => 1 / 2 + | some _ => 0 + +theorem scalarCubeValue_center {α : Type*} [Fintype α] [DecidableEq α] (t : Finset α) : + scalarCubeValue (scalarCubeCenter α) t = 1 / 2 := by + simp [scalarCubeValue, Fintype.sum_option, scalarCubeCenter, booleanFeature] + +theorem scalarCubeDomain_nonempty (α : Type*) [Fintype α] [DecidableEq α] : + (scalarCubeDomain α).Nonempty := by + refine ⟨scalarCubeCenter α, ?_⟩ + intro t + rw [scalarCubeValue_center] + norm_num + +theorem scalarCubeFace_card (α : Type*) [Fintype α] : + Fintype.card (Bool × Finset α) = 2 * 2 ^ Fintype.card α := by simp + +theorem booleanAffinePolynomial_eval_scalarCubeValue {B F α : Type*} + [Fintype α] [DecidableEq α] (a : BlockParameter B F α → ℝ) (b : B) (v : F) (t : Finset α) : + MvPolynomial.eval a (booleanAffinePolynomial b v t) = scalarCubeValue (fun r => a (b, v, r)) t := + booleanAffinePolynomial_eval a b v t + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeFaceSlab.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeFaceSlab.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab310a58714992ef2c484f3cec753395eb7c6935 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeFaceSlab.lean @@ -0,0 +1,363 @@ +import OAI.Combinatorics.Progressions.Geometry.NormalizedRestrictionTransport +import OAI.Combinatorics.Progressions.Probability.ScalarCubeBoundaryMass + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +def closedScalarCubeDomain (α : Type*) [Fintype α] [DecidableEq α] : Set (Option α → ℝ) := + {a | ∀ t : Finset α, scalarCubeValue a t ∈ Set.Icc (0 : ℝ) 1} + +theorem scalarCubeDomain_subset_closed (α : Type*) [Fintype α] [DecidableEq α] : + scalarCubeDomain α ⊆ closedScalarCubeDomain α := + fun _ ha t => ⟨(ha t).1.le, (ha t).2.le⟩ + +theorem closedScalarCubeDomain_isClosed (α : Type*) [Fintype α] [DecidableEq α] : + IsClosed (closedScalarCubeDomain α) := by + have heq : closedScalarCubeDomain α = ⋂ t : Finset α, {a | scalarCubeValue a t ∈ Set.Icc (0 : ℝ) 1} := by + ext a + simp [closedScalarCubeDomain] + rw [heq] + exact isClosed_iInter (fun t => isClosed_Icc.preimage (scalarCubeValue_contDiff t).continuous) + +theorem closedScalarCubeDomain_iff_faces {α : Type*} [Fintype α] [DecidableEq α] + (a : Option α → ℝ) : a ∈ closedScalarCubeDomain α ↔ ∀ i, 0 ≤ scalarCubeFace i a := by + constructor + · intro ha i + rcases i with ⟨side, t⟩ + cases side with + | false => exact (ha t).1 + | true => exact sub_nonneg.mpr (ha t).2 + · intro ha t + have hlo : 0 ≤ scalarCubeValue a t := ha (false, t) + have hhi : 0 ≤ 1 - scalarCubeValue a t := ha (true, t) + exact ⟨hlo, by linarith⟩ + +theorem closedScalarCubeDomain_coordinate_abs_le_one {α : Type*} [Fintype α] [DecidableEq α] + {a : Option α → ℝ} (ha : a ∈ closedScalarCubeDomain α) (r : Option α) : |a r| ≤ 1 := by + have hzero := ha ∅ + rw [scalarCubeValue_empty] at hzero + cases r with + | none => exact abs_le.mpr ⟨by linarith [hzero.1], hzero.2⟩ + | some i => + have hi := ha {i} + rw [scalarCubeValue_singleton] at hi + exact abs_le.mpr ⟨by linarith [hzero.2, hi.1], by linarith [hzero.1, hi.2]⟩ + +theorem closedScalarCubeDomain_compact (α : Type*) [Fintype α] [DecidableEq α] : + IsCompact (closedScalarCubeDomain α) := by + apply Metric.isCompact_of_isClosed_isBounded (closedScalarCubeDomain_isClosed α) + apply (Metric.isBounded_closedBall (x := (0 : Option α → ℝ)) (r := 1)).subset + intro a ha + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro r + simpa only [Real.norm_eq_abs] using closedScalarCubeDomain_coordinate_abs_le_one ha r + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem closedScalarCubeFace_zero_volume {α : Type*} [Fintype α] [DecidableEq α] + (i : Bool × Finset α) : + volume (closedScalarCubeDomain α ∩ {a | scalarCubeFace i a = 0}) = 0 := by + let Z := closedScalarCubeDomain α ∩ {a | scalarCubeFace i a = 0} + have hZm : MeasurableSet Z := (closedScalarCubeDomain_isClosed α).measurableSet.inter + (measurableSet_eq_fun (scalarCubeFace_contDiff i).continuous.measurable measurable_const) + have hZfin : volume Z ≠ ⊤ := ne_of_lt ((measure_mono Set.inter_subset_left).trans_lt + (closedScalarCubeDomain_compact α).measure_lt_top) + let s : Set ((α → ℝ) × ℝ) := scalarCubeJoin ⁻¹' Z + have hs : MeasurableSet s := hZm.preimage (scalarCubeJoin_measurable α) + have hm := (scalarCubeJoin_measurePreserving α).measure_preimage hZm.nullMeasurableSet + have hmr := (scalarCubeJoin_measurePreserving α).measureReal_preimage hZm.nullMeasurableSet + have hsfin : (volume : Measure ((α → ℝ) × ℝ)) s ≠ ⊤ := by + change volume (scalarCubeJoin ⁻¹' Z) ≠ ⊤ + rw [hm] + exact hZfin + have hbase : ∀ z ∈ s, z.1 ∈ Metric.closedBall (0 : α → ℝ) 1 := by + intro z hz + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro k + have h := closedScalarCubeDomain_coordinate_abs_le_one hz.1 (some k) + simpa only [Real.norm_eq_abs, scalarCubeJoin_some] using h + have hbound : ∀ b : α → ℝ, volume.real {y | (b, y) ∈ s} ≤ 0 := by + intro b + let c : ℝ := if i.1 then 1 - ∑ k ∈ i.2, b k else -(∑ k ∈ i.2, b k) + have hsub : {y | (b, y) ∈ s} ⊆ {c} := by + intro y hy + have heq : scalarCubeFace i (scalarCubeJoin (b, y)) = 0 := hy.2 + rw [scalarCubeJoin_face] at heq + apply Set.mem_singleton_iff.mpr + dsimp [c] + split_ifs at heq ⊢ <;> linarith + have h := measureReal_mono (μ := volume) hsub (by simp) + simpa [measureReal_def] using h + have h := product_measureReal_le_of_fiber_bound + (volume : Measure (α → ℝ)) (volume : Measure ℝ) s hs hsfin + (Metric.closedBall (0 : α → ℝ) 1) measurableSet_closedBall + (isCompact_closedBall _ _).measure_ne_top hbase hbound + change volume.real s ≤ _ at h + rw [hmr, mul_zero] at h + exact (measureReal_eq_zero_iff hZfin).mp (le_antisymm h measureReal_nonneg) + +theorem closedScalarCubeDomain_boundary_null (α : Type*) [Fintype α] [DecidableEq α] : + volume (closedScalarCubeDomain α \ scalarCubeDomain α) = 0 := by + have hsub : closedScalarCubeDomain α \ scalarCubeDomain α ⊆ + ⋃ i : Bool × Finset α, closedScalarCubeDomain α ∩ {a | scalarCubeFace i a = 0} := by + intro a ha + have hn : ¬ ∀ i, 0 < scalarCubeFace i a := by + intro hp + apply ha.2 + rw [← positiveInequalityDomain_scalarCubeFace α] + exact hp + obtain ⟨i, hi⟩ := not_forall.mp hn + have hz : scalarCubeFace i a = 0 := le_antisymm (le_of_not_gt hi) + ((closedScalarCubeDomain_iff_faces a).mp ha.1 i) + exact Set.mem_iUnion.mpr ⟨i, ha.1, hz⟩ + exact measure_mono_null hsub (measure_iUnion_null closedScalarCubeFace_zero_volume) + +theorem scalarCubeDomain_ae_closed (α : Type*) [Fintype α] [DecidableEq α] : + scalarCubeDomain α =ᵐ[volume] closedScalarCubeDomain α := by + apply ae_eq_set.mpr + constructor + · have he : scalarCubeDomain α \ closedScalarCubeDomain α = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro a ha + exact ha.2 (scalarCubeDomain_subset_closed α ha.1) + rw [he, measure_empty] + · exact closedScalarCubeDomain_boundary_null α + +noncomputable def closedScalarCubeMeasure (α : Type*) [Fintype α] [DecidableEq α] : + Measure (Option α → ℝ) := + (volume (closedScalarCubeDomain α))⁻¹ • volume.restrict (closedScalarCubeDomain α) + +theorem closedScalarCubeMeasure_eq (α : Type*) [Fintype α] [DecidableEq α] : + closedScalarCubeMeasure α = scalarCubeMeasure α := by + have hvol := measure_congr (scalarCubeDomain_ae_closed α) + have hrestrict := Measure.restrict_congr_set (scalarCubeDomain_ae_closed α) + simp only [closedScalarCubeMeasure, scalarCubeMeasure, ← hvol, ← hrestrict] + +instance closedScalarCubeMeasure_probability (α : Type*) [Fintype α] [DecidableEq α] : + IsProbabilityMeasure (closedScalarCubeMeasure α) := by + rw [closedScalarCubeMeasure_eq] + infer_instance + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped Classical + +def halfOpenScalarCubeDomain (I : Type*) [Fintype I] [DecidableEq I] : Set (Option I → ℝ) := + {x | ∀ t : Finset I, scalarCubeValue x t ∈ Set.Ico (0 : ℝ) 1} + +theorem halfOpenScalarCubeDomain_measurable (I : Type*) [Fintype I] [DecidableEq I] : + MeasurableSet (halfOpenScalarCubeDomain I) := by + have he : halfOpenScalarCubeDomain I = ⋂ t : Finset I, + (fun x => scalarCubeValue x t) ⁻¹' Set.Ico (0 : ℝ) 1 := by + ext x + simp only [halfOpenScalarCubeDomain, Set.mem_ofPred_eq, Set.mem_iInter, Set.mem_preimage] + rw [he] + exact MeasurableSet.iInter (fun (t : Finset I) => + measurableSet_Ico.preimage (scalarCubeValue_contDiff t).continuous.measurable) + +theorem scalarCubeDomain_subset_halfOpen (I : Type*) [Fintype I] [DecidableEq I] : + scalarCubeDomain I ⊆ halfOpenScalarCubeDomain I := + fun _ hx t => ⟨(hx t).1.le, (hx t).2⟩ + +theorem halfOpenScalarCubeDomain_subset_closed (I : Type*) [Fintype I] [DecidableEq I] : + halfOpenScalarCubeDomain I ⊆ closedScalarCubeDomain I := + fun _ hx t => ⟨(hx t).1, (hx t).2.le⟩ + +theorem halfOpenScalarCubeDomain_norm_le {I : Type*} [Fintype I] [DecidableEq I] + {x : Option I → ℝ} (hx : x ∈ halfOpenScalarCubeDomain I) : ‖x‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro i + exact closedScalarCubeDomain_coordinate_abs_le_one (halfOpenScalarCubeDomain_subset_closed I hx) i + +theorem halfOpenScalarCubeDomain_ae (I : Type*) [Fintype I] [DecidableEq I] : + halfOpenScalarCubeDomain I =ᵐ[volume] scalarCubeDomain I := by + filter_upwards [scalarCubeDomain_ae_closed I] with x hx + apply propext + have hx' : x ∈ scalarCubeDomain I ↔ x ∈ closedScalarCubeDomain I := iff_of_eq hx + constructor + · intro h + exact hx'.mpr (halfOpenScalarCubeDomain_subset_closed I h) + · exact fun h => scalarCubeDomain_subset_halfOpen I h + +noncomputable def scalarCubeIndicator (I : Type*) [Fintype I] [DecidableEq I] + (x : Option I → ℝ) : ℝ := if x ∈ halfOpenScalarCubeDomain I then 1 else 0 + +theorem scalarCubeIndicator_range (I : Type*) [Fintype I] [DecidableEq I] + (x : Option I → ℝ) : 0 ≤ scalarCubeIndicator I x ∧ scalarCubeIndicator I x ≤ 1 := by + unfold scalarCubeIndicator + split_ifs <;> norm_num + +theorem scalarCubeIndicator_zero_outside (I : Type*) [Fintype I] [DecidableEq I] + (x : Option I → ℝ) (hx : 1 < ‖x‖) : scalarCubeIndicator I x = 0 := by + apply ite_eq_right + exact fun h => (not_lt_of_ge (halfOpenScalarCubeDomain_norm_le h)) hx + +theorem scalarCubeIndicator_integrable (I : Type*) [Fintype I] [DecidableEq I] : + Integrable (scalarCubeIndicator I) := by + change Integrable ((halfOpenScalarCubeDomain I).indicator (fun _ => (1 : ℝ))) + exact (integrableOn_const ((measure_mono (halfOpenScalarCubeDomain_subset_closed I)).trans_lt + (closedScalarCubeDomain_compact I).measure_lt_top).ne).integrable_indicator + (halfOpenScalarCubeDomain_measurable I) + +theorem scalarCubeIndicator_integral (I : Type*) [Fintype I] [DecidableEq I] : + (∫ x, scalarCubeIndicator I x) = volume.real (scalarCubeDomain I) := by + have he : scalarCubeIndicator I =ᵐ[volume] (scalarCubeDomain I).indicator (fun _ => (1 : ℝ)) := by + filter_upwards [halfOpenScalarCubeDomain_ae I] with x hx + have hx' : (x ∈ halfOpenScalarCubeDomain I) = (x ∈ scalarCubeDomain I) := hx + change (if x ∈ halfOpenScalarCubeDomain I then 1 else 0) = + if x ∈ scalarCubeDomain I then 1 else 0 + rw [hx'] + rw [integral_congr_ae he] + exact integral_indicator_one (scalarCubeDomain_isOpen I).measurableSet + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem scalarCubeValue_smul {α : Type*} [Fintype α] [DecidableEq α] + (T : ℝ) (a : Option α → ℝ) (vertex : Finset α) : + scalarCubeValue (T • a) vertex = T * scalarCubeValue a vertex := by + simp only [scalarCubeValue, Pi.smul_apply, smul_eq_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro r _ + ring + +def scaledScalarCubeDomain (α : Type*) [Fintype α] [DecidableEq α] (T : ℝ) : + Set (Option α → ℝ) := + {a | ∀ vertex : Finset α, scalarCubeValue a vertex ∈ Set.Ioo (0 : ℝ) T} + +theorem scaledScalarCubeDomain_smul_iff {α : Type*} [Fintype α] [DecidableEq α] + {T : ℝ} (hT : 0 < T) (a : Option α → ℝ) : + T • a ∈ scaledScalarCubeDomain α T ↔ a ∈ scalarCubeDomain α := by + change (∀ vertex, 0 < scalarCubeValue (T • a) vertex ∧ scalarCubeValue (T • a) vertex < T) ↔ _ + simp only [scalarCubeValue_smul, mul_pos_iff_of_pos_left hT, + mul_lt_iff_lt_one_right hT] + rfl + +theorem scaledScalarCubeDomain_eq_image {α : Type*} [Fintype α] [DecidableEq α] + {T : ℝ} (hT : 0 < T) : + scaledScalarCubeDomain α T = (T • ·) '' scalarCubeDomain α := by + ext a + constructor + · intro ha + refine ⟨T⁻¹ • a, ?_, smul_inv_smul₀ hT.ne' a⟩ + apply (scaledScalarCubeDomain_smul_iff hT _).mp + simpa only [smul_inv_smul₀ hT.ne'] using ha + · rintro ⟨a, ha, rfl⟩ + exact (scaledScalarCubeDomain_smul_iff hT a).mpr ha + +theorem scaledScalarCubeDomain_isOpen (α : Type*) [Fintype α] [DecidableEq α] + (T : ℝ) : IsOpen (scaledScalarCubeDomain α T) := by + have he : scaledScalarCubeDomain α T = + ⋂ vertex : Finset α, (scalarCubeValue · vertex) ⁻¹' Set.Ioo (0 : ℝ) T := by + ext a + simp [scaledScalarCubeDomain] + rw [he] + exact isOpen_iInter_of_finite (fun vertex => + isOpen_Ioo.preimage (scalarCubeValue_contDiff vertex).continuous) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +def scalarCubeFaceSlab {I : Type*} [Fintype I] [DecidableEq I] + (i : Bool × Finset I) (u : ℝ) : Set (Option I → ℝ) := + Metric.closedBall 0 2 ∩ {x | |scalarCubeFace i x| ≤ u} + +theorem scalarCubeFaceSlab_measurable {I : Type*} [Fintype I] [DecidableEq I] + (i : Bool × Finset I) (u : ℝ) : MeasurableSet (scalarCubeFaceSlab i u) := + measurableSet_closedBall.inter (measurableSet_le + (scalarCubeFace_contDiff i).continuous.abs.measurable measurable_const) + +theorem scalarCubeFaceSlab_finite {I : Type*} [Fintype I] [DecidableEq I] + (i : Bool × Finset I) (u : ℝ) : volume (scalarCubeFaceSlab i u) ≠ ⊤ := + ne_of_lt ((measure_mono Set.inter_subset_left).trans_lt (isCompact_closedBall _ _).measure_lt_top) + +theorem scalarCubeFaceSlab_fiber_bound {I : Type*} [Fintype I] [DecidableEq I] + (i : Bool × Finset I) {u : ℝ} (hu : 0 ≤ u) (b : I → ℝ) : + volume.real {y | scalarCubeJoin (b, y) ∈ scalarCubeFaceSlab i u} ≤ 2*u := by + let c : ℝ := if i.1 then 1 - ∑ k ∈ i.2, b k else -(∑ k ∈ i.2, b k) + have hsub : {y | scalarCubeJoin (b, y) ∈ scalarCubeFaceSlab i u} ⊆ Set.Icc (c-u) (c+u) := by + intro y hy + have hraw : |scalarCubeFace i (scalarCubeJoin (b,y))| ≤ u := hy.2 + have h := abs_le.mp hraw + rw [scalarCubeJoin_face] at h + dsimp only [c] + split_ifs at h ⊢ <;> constructor <;> linarith + have hv : volume.real (Set.Icc (c-u) (c+u)) = 2*u := by + rw [Real.volume_real_Icc] + simp only [show c+u-(c-u) = 2*u by ring, max_eq_left (by positivity : 0 ≤ 2*u)] + exact (measureReal_mono (μ := volume) hsub (by simp [Real.volume_Icc])).trans_eq hv + +theorem scalarCubeFaceSlab_volume_le {I : Type*} [Fintype I] [DecidableEq I] + (i : Bool × Finset I) {u : ℝ} (hu : 0 ≤ u) : + volume.real (scalarCubeFaceSlab i u) ≤ (4 : ℝ)^Fintype.card I * (2*u) := by + let s := scalarCubeJoin ⁻¹' scalarCubeFaceSlab i u + have hs : MeasurableSet s := (scalarCubeFaceSlab_measurable i u).preimage (scalarCubeJoin_measurable I) + have hm := (scalarCubeJoin_measurePreserving I).measure_preimage (scalarCubeFaceSlab_measurable i u).nullMeasurableSet + have hmr := (scalarCubeJoin_measurePreserving I).measureReal_preimage (scalarCubeFaceSlab_measurable i u).nullMeasurableSet + have hfin : (volume : Measure ((I → ℝ) × ℝ)) s ≠ ⊤ := by + change volume (scalarCubeJoin ⁻¹' scalarCubeFaceSlab i u) ≠ ⊤ + rw [hm] + exact scalarCubeFaceSlab_finite i u + have hb : ∀ z ∈ s, z.1 ∈ Metric.closedBall (0 : I → ℝ) 2 := by + intro z hz + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg (by norm_num)).mpr + intro k + have hh : ‖scalarCubeJoin z‖ ≤ 2 := by + simpa only [Metric.mem_closedBall, dist_zero_right] using hz.1 + exact (norm_le_pi_norm (scalarCubeJoin z) (some k)).trans hh + have h := product_measureReal_le_of_fiber_bound + (volume : Measure (I → ℝ)) (volume : Measure ℝ) s hs hfin + (Metric.closedBall (0 : I → ℝ) 2) measurableSet_closedBall (isCompact_closedBall _ _).measure_ne_top + hb (scalarCubeFaceSlab_fiber_bound i hu) + change volume.real s ≤ _ at h + rw [hmr] at h + have hbase : volume.real (Metric.closedBall (0 : I → ℝ) 2) = (4 : ℝ)^Fintype.card I := by + rw [measureReal_def, Real.volume_pi_closedBall _ (by norm_num)] + norm_num + rwa [hbase] at h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeRootTranslation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeRootTranslation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c31c447822dd2b9f20af7a2b0c11a218c59e9c2a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeRootTranslation.lean @@ -0,0 +1,82 @@ +import OAI.Combinatorics.Progressions.Lattices.CubeResidueSupport + +namespace OAI + +section + +namespace Erdos3 + +def shiftScalarCube {I : Type*} (c : ℤ) (x : Option I → ℤ) : Option I → ℤ + | none => c + x none + | some i => x (some i) + +def shiftScalarCubeResidues {I : Type*} (c : ℤ) (m : Option I → ℕ) + (r : ∀ i, ZMod (m i)) : ∀ i, ZMod (m i) + | none => r none - (c : ZMod (m none)) + | some i => r (some i) + +theorem shiftScalarCube_value {I : Type*} [Fintype I] + (c : ℤ) (x : Option I → ℤ) (t : Finset I) : + integerScalarCubeValue (shiftScalarCube c x) t = c + integerScalarCubeValue x t := by + simp only [integerScalarCubeValue, shiftScalarCube, add_assoc] + +theorem shiftScalarCube_residues_iff {I : Type*} (c : ℤ) (m : Option I → ℕ) + (r : ∀ i, ZMod (m i)) (x : Option I → ℤ) : + (∀ i, ((shiftScalarCube c x i : ℤ) : ZMod (m i)) = r i) ↔ + ∀ i, ((x i : ℤ) : ZMod (m i)) = shiftScalarCubeResidues c m r i := by + constructor + · intro h i + cases i with + | none => simpa [shiftScalarCube, shiftScalarCubeResidues, eq_sub_iff_add_eq, add_comm] using h none + | some i => exact h (some i) + · intro h i + cases i with + | none => simpa [shiftScalarCube, shiftScalarCubeResidues, eq_sub_iff_add_eq, add_comm] using h none + | some i => exact h (some i) + +def supportedCubeCoordinates {q : ℕ} (p : (Fin q → ℤ) × ℤ) : Option (Fin q) → ℤ + | none => p.2 + | some i => p.1 i + +def supportedIntervalTranslateEquiv (q K : ℕ) (c : ℤ) : + SupportedCube q (Set.Ico (0 : ℤ) (K : ℤ)) ≃ + SupportedCube q (Set.Ico c (c + K)) where + toFun p := ⟨(p.val.1, c + p.val.2), fun ω => by + have h := p.property ω + change 0 ≤ p.val.2 + cubeShift p.val.1 ω ∧ p.val.2 + cubeShift p.val.1 ω < K at h + change c ≤ c + p.val.2 + cubeShift p.val.1 ω ∧ + c + p.val.2 + cubeShift p.val.1 ω < c + K + constructor <;> omega⟩ + invFun p := ⟨(p.val.1, p.val.2 - c), fun ω => by + have h := p.property ω + change c ≤ p.val.2 + cubeShift p.val.1 ω ∧ p.val.2 + cubeShift p.val.1 ω < c + K at h + change 0 ≤ p.val.2 - c + cubeShift p.val.1 ω ∧ + p.val.2 - c + cubeShift p.val.1 ω < K + constructor <;> omega⟩ + left_inv p := by + apply Subtype.ext + apply Prod.ext + · rfl + · simp + right_inv p := by + apply Subtype.ext + apply Prod.ext + · rfl + · simp + +noncomputable def shiftedScalarCubeEquiv (q K : ℕ) (c : ℤ) : + ↥(integerScalarCubeSet (Fin q) K) ≃ SupportedCube q (Set.Ico c (c + K)) := + (integerScalarCubeEquiv q K).trans (supportedIntervalTranslateEquiv q K c) + +theorem shiftedScalarCubeEquiv_coordinates (q K : ℕ) (c : ℤ) + (x : ↥(integerScalarCubeSet (Fin q) K)) : + supportedCubeCoordinates (shiftedScalarCubeEquiv q K c x).val = + shiftScalarCube c (fun i => (x.val i : ℤ)) := by + funext i + cases i <;> rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeWindowDomain.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeWindowDomain.lean new file mode 100644 index 0000000000000000000000000000000000000000..1184a54db463cdd860dc61ed8ee9e567fa2fa2a5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarCubeWindowDomain.lean @@ -0,0 +1,88 @@ +import OAI.Combinatorics.Progressions.Lattices.CubeResidueSupport + +namespace OAI + +section + +namespace Erdos3 + +theorem integerScalarCube_mono {I : Type*} [Fintype I] {K L : ℕ} + (hKL : K ≤ L) {x : Option I → ℤ} (hx : IntegerScalarCube K x) : IntegerScalarCube L x := by + intro t + exact ⟨(hx t).1, (hx t).2.trans_le (by exact_mod_cast hKL)⟩ + +def integerScalarCubeBoxEmbed (I : Type*) (K L : ℕ) (hKL : K ≤ L) + (x : IntegerScalarCubeBox I K) : IntegerScalarCubeBox I L := fun i => + ⟨(x i : ℤ), Finset.mem_Ico.mpr (by + have hi := Finset.mem_Ico.mp (x i).property + constructor <;> omega)⟩ + +noncomputable def scalarCubeWindowResidueSet (I : Type*) [Fintype I] + (L K : ℕ) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) : + Finset (IntegerScalarCubeBox I L) := by + classical + exact Finset.univ.filter (fun x => IntegerScalarCube K (fun i => (x i : ℤ)) ∧ + ∀ i, ((x i : ℤ) : ZMod (m i)) = r i) + +theorem mem_scalarCubeWindowResidueSet {I : Type*} [Fintype I] + (L K : ℕ) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) (x : IntegerScalarCubeBox I L) : + x ∈ scalarCubeWindowResidueSet I L K m r ↔ + IntegerScalarCube K (fun i => (x i : ℤ)) ∧ ∀ i, ((x i : ℤ) : ZMod (m i)) = r i := by + classical + simp only [scalarCubeWindowResidueSet, Finset.mem_filter, Finset.mem_univ, true_and] + +theorem scalarCubeWindowResidueSet_subset {I : Type*} [Fintype I] + (L K : ℕ) (hKL : K ≤ L) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) : + scalarCubeWindowResidueSet I L K m r ⊆ integerScalarCubeSet I L := by + intro x hx + exact (mem_integerScalarCubeSet L x).mpr + (integerScalarCube_mono hKL ((mem_scalarCubeWindowResidueSet L K m r x).mp hx).1) + +noncomputable def scalarCubeWindowResidueEquiv (I : Type*) [Fintype I] [DecidableEq I] + (L K : ℕ) (hKL : K ≤ L) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) : + ↥((integerScalarCubeSet I K) ∩ scalarCubeResidueSet I K m r) ≃ + ↥(scalarCubeWindowResidueSet I L K m r) where + toFun x := by + have hx := Finset.mem_inter.mp x.property + exact ⟨integerScalarCubeBoxEmbed I K L hKL x.val, + (mem_scalarCubeWindowResidueSet L K m r _).mpr + ⟨(mem_integerScalarCubeSet K x.val).mp hx.1, + (mem_scalarCubeResidueSet K m r x.val).mp hx.2⟩⟩ + invFun y := by + have hy := (mem_scalarCubeWindowResidueSet L K m r y.val).mp y.property + let x : IntegerScalarCubeBox I K := fun i => + ⟨(y.val i : ℤ), Finset.mem_Ico.mpr + ⟨(integerScalarCube_coordinates hy.1 i).1.le, (integerScalarCube_coordinates hy.1 i).2⟩⟩ + exact ⟨x, Finset.mem_inter.mpr ⟨(mem_integerScalarCubeSet K x).mpr hy.1, + (mem_scalarCubeResidueSet K m r x).mpr hy.2⟩⟩ + left_inv x := by + apply Subtype.ext + funext i + apply Subtype.ext + rfl + right_inv y := by + apply Subtype.ext + funext i + apply Subtype.ext + rfl + +theorem scalarCubeWindowResidueSet_card (I : Type*) [Fintype I] [DecidableEq I] + (L K : ℕ) (hKL : K ≤ L) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) : + (scalarCubeWindowResidueSet I L K m r).card = + ((integerScalarCubeSet I K) ∩ scalarCubeResidueSet I K m r).card := by + simpa only [Fintype.card_coe] using + (Fintype.card_congr (scalarCubeWindowResidueEquiv I L K hKL m r)).symm + +theorem scalarCubeWindowResidueSet_card_lower (I : Type*) [Fintype I] [DecidableEq I] + (L K M H : ℕ) (hKL : K ≤ L) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) + (hm : ∀ i, 0 < m i) (hmM : ∀ i, m i ≤ M) (hH : 0 < H) + (hbudget : (Fintype.card I + 1) * (M * H) ≤ K) : + H ^ (Fintype.card I + 1) ≤ (scalarCubeWindowResidueSet I L K m r).card := by + rw [scalarCubeWindowResidueSet_card I L K hKL m r] + exact scalarCubeResidueSet_card_lower I K M H m r hm hmM hH hbudget + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarDominatedSlack.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarDominatedSlack.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6e00c71cc13eb6a14d20a2366679f21ae18baae --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarDominatedSlack.lean @@ -0,0 +1,481 @@ +import Mathlib.Analysis.SpecialFunctions.Exp +import Mathlib.Data.Set.Card +import OAI.Combinatorics.Progressions.Geometry.ProductSectionSupport +import OAI.Combinatorics.Progressions.Probability.FiniteExcessMassCap +import OAI.Combinatorics.Progressions.Probability.IntervalDivisorProbability + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +namespace FiniteProbabilityWeights + +theorem mean_comm {X Y : Type*} [Fintype X] [Fintype Y] + (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) (F : X → Y → ℝ) : + p.mean (fun x => q.mean (F x)) = q.mean (fun y => p.mean (fun x => F x y)) := by + unfold mean + simp_rw [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y _ + apply Finset.sum_congr rfl + intro x _ + ring + +theorem mean_sum {X J : Type*} [Fintype X] (p : FiniteProbabilityWeights X) + (s : Finset J) (F : J → X → ℝ) : + p.mean (fun x => ∑ j ∈ s, F j x) = ∑ j ∈ s, p.mean (F j) := by + unfold mean + simp_rw [Finset.mul_sum] + exact Finset.sum_comm + +theorem mean_sub {X : Type*} [Fintype X] (p : FiniteProbabilityWeights X) (f g : X → ℝ) : + p.mean (fun x => f x - g x) = p.mean f - p.mean g := by + simp only [mean, mul_sub, Finset.sum_sub_distrib] + +theorem mean_mul_const {X : Type*} [Fintype X] (p : FiniteProbabilityWeights X) + (f : X → ℝ) (c : ℝ) : p.mean (fun x => f x * c) = p.mean f * c := by + simp only [mean, ← mul_assoc, Finset.sum_mul] + +end FiniteProbabilityWeights + +variable {I : Type*} [Fintype I] [DecidableEq I] {X : I → Type*} + [∀ i, Fintype (X i)] + +theorem productMean_coordinateSwap (μ : ∀ i, FiniteProbabilityWeights (X i)) + (S : Finset I) (F : (∀ i, X i) → (∀ i, X i) → ℝ) : + (FiniteProbabilityWeights.pi μ).mean (fun x => (FiniteProbabilityWeights.pi μ).mean + (fun y => F (productCoordinateMix S x y) (productCoordinateMix S y x))) = + (FiniteProbabilityWeights.pi μ).mean (fun x => (FiniteProbabilityWeights.pi μ).mean (F x)) := by + let p := FiniteProbabilityWeights.pi μ + have h : (∑ z : (∀ i, X i) × (∀ i, X i), p.weight z.1 * p.weight z.2 * + F (productCoordinateMix S z.1 z.2) (productCoordinateMix S z.2 z.1)) = + ∑ z : (∀ i, X i) × (∀ i, X i), p.weight z.1 * p.weight z.2 * F z.1 z.2 := by + apply Fintype.sum_equiv (productCoordinateSwap (X := X) S) + intro z + change _ = p.weight (productCoordinateMix S z.1 z.2) * + p.weight (productCoordinateMix S z.2 z.1) * _ + rw [productCoordinateMix_weight] + rfl + simpa only [FiniteProbabilityWeights.mean, Fintype.sum_prod_type, + Finset.mul_sum, mul_assoc] using h + +theorem productMean_coordinateMix (μ : ∀ i, FiniteProbabilityWeights (X i)) + (S : Finset I) (f : (∀ i, X i) → ℝ) : + (FiniteProbabilityWeights.pi μ).mean (fun x => (FiniteProbabilityWeights.pi μ).mean + (fun y => f (productCoordinateMix S x y))) = (FiniteProbabilityWeights.pi μ).mean f := by + have h := productMean_coordinateSwap μ S (fun x _ => f x) + simpa only [FiniteProbabilityWeights.mean_const] using h + +end Erdos3 + +end + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped BigOperators Classical + +theorem exists_code_fiber_mass {Ω I : Type*} [Fintype Ω] [Fintype I] [Nonempty I] + (p : FiniteProbabilityWeights Ω) (Q : Finset Ω) (code : Ω → I) : + ∃ i, p.mass Q / Fintype.card I ≤ p.mass (Q.filter (fun x => code x = i)) := by + have hsum : (∑ i, p.mass (Q.filter (fun x => code x = i))) = p.mass Q := by + simp only [mass, Finset.sum_filter] + rw [Finset.sum_comm] + simp + have hmean : (𝔼 i, p.mass (Q.filter (fun x => code x = i))) = p.mass Q / Fintype.card I := by + rw [Fintype.expect_eq_sum_div_card, hsum] + obtain ⟨i, _, hi⟩ := Finset.exists_le_of_le_expect Finset.univ_nonempty hmean.ge + exact ⟨i, hi⟩ + +end Erdos3.FiniteProbabilityWeights + +end + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped BigOperators Classical + +theorem retain_simultaneous_mean_error {Ω J : Type*} [Fintype Ω] [Fintype J] + (p : FiniteProbabilityWeights Ω) (productive : Finset Ω) (err : J → Ω → ℝ) + (herr : ∀ j a, 0 ≤ err j a) {tau : ℝ} (htau : 0 < tau) : + ∃ retained : Finset Ω, retained ⊆ productive ∧ + p.mass productive - (∑ j, p.mean (err j)) / tau ≤ p.mass retained ∧ + ∀ a ∈ retained, ∀ j, err j a ≤ tau := by + let retained := productive.filter (fun a => ∀ j, err j a ≤ tau) + have hpoint (a : Ω) : + tau * ((if a ∈ productive then (1 : ℝ) else 0) - + (if a ∈ retained then 1 else 0)) ≤ ∑ j, err j a := by + by_cases ha : a ∈ productive + · by_cases hg : ∀ j, err j a ≤ tau + · have hret : a ∈ retained := Finset.mem_filter.mpr ⟨ha, hg⟩ + simp only [ha, hret, ite_true, sub_self, mul_zero] + exact Finset.sum_nonneg (fun j _ => herr j a) + · have hret : a ∉ retained := by simpa only [retained, Finset.mem_filter, ha, true_and] using hg + simp only [ha, hret, ite_true, ite_false, sub_zero, mul_one] + push Not at hg + obtain ⟨j, hj⟩ := hg + exact hj.le.trans (Finset.single_le_sum (fun i _ => herr i a) (Finset.mem_univ j)) + · have hret : a ∉ retained := fun h => ha (Finset.mem_filter.mp h).1 + simp only [ha, hret, ite_false, sub_self, mul_zero] + exact Finset.sum_nonneg (fun j _ => herr j a) + have h := p.mean_mono hpoint + rw [p.mean_const_mul, p.mean_sub, p.mean_indicator, p.mean_indicator, p.mean_sum] at h + have hdiv : p.mass productive - p.mass retained ≤ (∑ j, p.mean (err j)) / tau := + (le_div_iff₀ htau).mpr (by simpa only [mul_comm] using h) + refine ⟨retained, Finset.filter_subset _ _, by linarith, ?_⟩ + intro a ha + exact (Finset.mem_filter.mp ha).2 + +theorem retain_simultaneous_small_mean_error {Ω J : Type*} [Fintype Ω] [Fintype J] + (p : FiniteProbabilityWeights Ω) (productive : Finset Ω) (err : J → Ω → ℝ) + (herr : ∀ j a, 0 ≤ err j a) {tau kappa : ℝ} (htau : 0 < tau) + (hproductive : kappa ≤ p.mass productive) + (hmean : (∑ j, p.mean (err j)) ≤ kappa * tau / 4) : + ∃ retained : Finset Ω, retained ⊆ productive ∧ + 3 * kappa / 4 ≤ p.mass retained ∧ ∀ a ∈ retained, ∀ j, err j a ≤ tau := by + obtain ⟨retained, hsub, hmass, hgood⟩ := p.retain_simultaneous_mean_error productive err herr htau + have hdiv : (∑ j, p.mean (err j)) / tau ≤ kappa / 4 := + (div_le_iff₀ htau).mpr (by nlinarith) + exact ⟨retained, hsub, by linarith, hgood⟩ + +end Erdos3.FiniteProbabilityWeights + +end + +section + +namespace Erdos3 + +theorem exists_weighted_exponential_constant_fiber {Ω β : Type*} [Fintype Ω] + (outer : FiniteProbabilityWeights Ω) (S : Finset Ω) (hS : 0 < outer.mass S) + (f : Ω → β) (A : Set β) (hA : A.Finite) (hf : ∀ x ∈ S, f x ∈ A) + {C : ℝ} (hcount : (A.ncard : ℝ) ≤ Real.exp C) : + ∃ y ∈ A, ∃ T : Finset Ω, T ⊆ S ∧ T.Nonempty ∧ (∀ x ∈ T, f x = y) ∧ + Real.exp (-C) * outer.mass S ≤ outer.mass T := by + classical + have hSne : S.Nonempty := by + apply Finset.nonempty_iff_ne_empty.mpr + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty, lt_self_iff_false] at hS + obtain ⟨x₀, hx₀⟩ := hSne + let : Fintype A := hA.fintype + let default : A := ⟨f x₀, hf x₀ hx₀⟩ + let : Nonempty A := ⟨default⟩ + let code : Ω → A := fun x => if hx : x ∈ S then ⟨f x, hf x hx⟩ else default + obtain ⟨y, hy⟩ := outer.exists_code_fiber_mass S code + let T := S.filter (fun x => code x = y) + have hcard : (Fintype.card A : ℝ) ≤ Real.exp C := by + simpa only [Set.fintypeCard_eq_ncard] using hcount + have hcardpos : (0 : ℝ) < Fintype.card A := by exact_mod_cast Fintype.card_pos + have hmass : Real.exp (-C) * outer.mass S ≤ outer.mass T := by + calc + _ = outer.mass S / Real.exp C := by + rw [Real.exp_neg, div_eq_mul_inv, mul_comm] + _ ≤ outer.mass S / Fintype.card A := + div_le_div_of_nonneg_left hS.le hcardpos hcard + _ ≤ outer.mass T := by + convert hy using 1 + apply congrArg outer.mass + ext x + simp only [T, Finset.mem_filter] + have hTpos : 0 < outer.mass T := (mul_pos (Real.exp_pos _) hS).trans_le hmass + have hTne : T.Nonempty := by + apply Finset.nonempty_iff_ne_empty.mpr + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty, lt_self_iff_false] at hTpos + refine ⟨y.val, y.property, T, Finset.filter_subset _ _, hTne, ?_, hmass⟩ + intro x hx + have hxS : x ∈ S := (Finset.mem_filter.mp hx).1 + have he := congrArg Subtype.val (Finset.mem_filter.mp hx).2 + simpa only [code, dite_eq_left hxS] using he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem exists_linear_model_partner {V I : Type*} + [AddCommGroup V] [Module ℂ V] [Fintype I] + (test : V →ₗ[ℂ] ℂ) (v e : V) (Q : I → V) (c : I → ℂ) + (hmodel : v = (∑ i, c i • Q i) + e) {delta M : ℝ} + (hdelta : 0 < delta) (hM : 0 < M) (hc : (∑ i, ‖c i‖) ≤ M) + (herr : ‖test e‖ ≤ delta / 2) (hscore : delta ≤ ‖test v‖) : + ∃ i, delta / (2 * M) ≤ ‖test (Q i)‖ := by + have hid : test v = (∑ i, c i * test (Q i)) + test e := by + rw [hmodel, map_add, map_sum] + simp only [map_smul, smul_eq_mul] + have hsum : delta / 2 ≤ ‖∑ i, c i * test (Q i)‖ := by + have ht := norm_add_le (∑ i, c i * test (Q i)) (test e) + rw [← hid] at ht + linarith + obtain ⟨i, hi⟩ := exists_large_weighted_term c (fun i => test (Q i)) + (by positivity : 0 < delta / 2) hM hc hsum + refine ⟨i, ?_⟩ + convert hi using 1; ring + +theorem exists_fixed_linear_model_partners {Ω K V : Type*} {I : K → Type*} + [Fintype Ω] [Fintype K] [∀ k, Fintype (I k)] [∀ k, Nonempty (I k)] + [AddCommGroup V] [Module ℂ V] + (outer : FiniteProbabilityWeights Ω) (productive : Finset Ω) + (v e : K → V) (Q : ∀ k, I k → V) (c : ∀ k, I k → ℂ) + (test : Ω → K → V →ₗ[ℂ] ℂ) (err : K → Ω → ℝ) + (hmodel : ∀ k, v k = (∑ i, c k i • Q k i) + e k) + {delta M kappa : ℝ} (hdelta : 0 < delta) (hM : 0 < M) + (hc : ∀ k, (∑ i, ‖c k i‖) ≤ M) + (herr : ∀ k a, 0 ≤ err k a) + (htest : ∀ a ∈ productive, ∀ k, ‖test a k (e k)‖ ≤ err k a) + (hproductive : kappa ≤ outer.mass productive) + (hmean : (∑ k, outer.mean (err k)) ≤ kappa * (delta / 2) / 4) + (hscore : ∀ a ∈ productive, ∀ k, delta ≤ ‖test a k (v k)‖) : + ∃ (partner : ∀ k, I k) (retained : Finset Ω), + retained ⊆ productive ∧ + (3 * kappa / 4) / (∏ k, (Fintype.card (I k) : ℝ)) ≤ outer.mass retained ∧ + ∀ a ∈ retained, ∀ k, delta / (2 * M) ≤ ‖test a k (Q k (partner k))‖ := by + obtain ⟨good, hgood, hmass, herrors⟩ := outer.retain_simultaneous_small_mean_error + productive err herr (by positivity : 0 < delta / 2) hproductive hmean + have hex (a : Ω) (ha : a ∈ good) (k : K) : + ∃ i, delta / (2 * M) ≤ ‖test a k (Q k i)‖ := + exists_linear_model_partner (test a k) (v k) (e k) (Q k) (c k) (hmodel k) + hdelta hM (hc k) ((htest a (hgood ha) k).trans (herrors a ha k)) (hscore a (hgood ha) k) + let choice : Ω → ∀ k, I k := fun a k => + if ha : a ∈ good then Classical.choose (hex a ha k) else Classical.choice inferInstance + have hchoice (a : Ω) (ha : a ∈ good) (k : K) : + delta / (2 * M) ≤ ‖test a k (Q k (choice a k))‖ := by + dsimp only [choice] + rw [dite_eq_left ha] + exact Classical.choose_spec (hex a ha k) + obtain ⟨partner, hpartner⟩ := outer.exists_code_fiber_mass good choice + let retained := good.filter (fun a => choice a = partner) + have hretained : retained ⊆ good := Finset.filter_subset _ _ + refine ⟨partner, retained, fun a ha => hgood (hretained ha), ?_, ?_⟩ + · have hcard : (Fintype.card (∀ k, I k) : ℝ) = ∏ k, (Fintype.card (I k) : ℝ) := by simp + rw [hcard] at hpartner + have h := (div_le_div_of_nonneg_right hmass (by positivity : 0 ≤ ∏ k, (Fintype.card (I k) : ℝ))).trans hpartner + convert h using 1; try rfl + congr 1 + ext a + simp only [retained, Finset.mem_filter] + · intro a ha k + have he := (Finset.mem_filter.mp ha).2 + rw [← he] + exact hchoice a (hretained ha) k + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped Classical + +theorem fixedParameter_observed_tail_of_tests + {X T A : Type*} [Fintype X] [Fintype T] + (source : FiniteProbabilityWeights X) (parameter : FiniteProbabilityWeights T) + (observe : X → A) (value : T → A → ℝ) {gap bound : ℝ} (hgap : 0 < gap) + (htest : ∀ w : A → ℝ, (∀ x, 0 ≤ w (observe x) ∧ w (observe x) ≤ 1) → + (parameter.prod source).mean (fun tx => w (observe tx.2) * value tx.1 (observe tx.2)) ≤ gap * bound) : + source.eventProbability (fun x => gap < parameter.mean (fun t => value t (observe x))) ≤ bound := by + let w : A → ℝ := fun z => if gap < parameter.mean (fun t => value t z) then 1 else 0 + have hw (x) : 0 ≤ w (observe x) ∧ w (observe x) ≤ 1 := by + dsimp only [w] + split_ifs <;> norm_num + have hup := htest w hw + rw [FiniteProbabilityWeights.mean_prod, FiniteProbabilityWeights.mean_comm] at hup + simp only [FiniteProbabilityWeights.mean_const_mul] at hup + have hlow : gap * source.eventProbability + (fun x => gap < parameter.mean (fun t => value t (observe x))) ≤ + source.mean (fun x => w (observe x) * parameter.mean (fun t => value t (observe x))) := by + rw [FiniteProbabilityWeights.eventProbability, ← source.mean_const_mul] + apply source.mean_mono + intro x + dsimp only [w] + split_ifs with hx + · simpa only [mul_one, one_mul] using hx.le + · simp only [mul_zero, zero_mul, le_refl] + exact (mul_le_mul_iff_right₀ hgap).mp (hlow.trans hup) + +theorem fixedParameter_observed_tail_exp + {X T A : Type*} [Fintype X] [Fintype T] + (source : FiniteProbabilityWeights X) (parameter : FiniteProbabilityWeights T) + (observe : X → A) (value : T → A → ℝ) (p dominationLog : ℝ) + (htest : ∀ w : A → ℝ, (∀ x, 0 ≤ w (observe x) ∧ w (observe x) ≤ 1) → + (parameter.prod source).mean (fun tx => w (observe tx.2) * value tx.1 (observe tx.2)) ≤ + Real.exp (-(2 * p + dominationLog)) / 2) : + source.eventProbability (fun x => Real.exp (-p) < parameter.mean (fun t => value t (observe x))) ≤ + Real.exp (-(p + dominationLog)) := by + apply fixedParameter_observed_tail_of_tests source parameter observe value (Real.exp_pos (-p)) + intro w hw + apply (htest w hw).trans + rw [← Real.exp_add] + have he : -p + -(p + dominationLog) = -(2 * p + dominationLog) := by ring + rw [he] + linarith [Real.exp_pos (-(2 * p + dominationLog))] + +theorem fixedParameter_observed_tail_dominated + {X T A : Type*} [Fintype X] [Fintype T] + (source outer : FiniteProbabilityWeights X) (parameter : FiniteProbabilityWeights T) + (observe : X → A) (value : T → A → ℝ) (p dominationLog : ℝ) + (hdom : ∀ x, outer.weight x ≤ Real.exp dominationLog * source.weight x) + (htest : ∀ w : A → ℝ, (∀ x, 0 ≤ w (observe x) ∧ w (observe x) ≤ 1) → + (parameter.prod source).mean (fun tx => w (observe tx.2) * value tx.1 (observe tx.2)) ≤ + Real.exp (-(2 * p + dominationLog)) / 2) : + outer.eventProbability (fun x => Real.exp (-p) < parameter.mean (fun t => value t (observe x))) ≤ + Real.exp (-p) := by + have ht := fixedParameter_observed_tail_exp source parameter observe value p dominationLog htest + calc + _ ≤ Real.exp dominationLog * source.eventProbability + (fun x => Real.exp (-p) < parameter.mean (fun t => value t (observe x))) := + outer.eventProbability_le_of_weight_le source _ hdom _ + _ ≤ Real.exp dominationLog * Real.exp (-(p + dominationLog)) := + mul_le_mul_of_nonneg_left ht (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped BigOperators Classical + +theorem uniform_injective_mean_le {B X : Type*} + [Fintype B] [Nonempty B] [Fintype X] [Nonempty X] + (F : B → X) (hF : Function.Injective F) (φ : X → ℝ) (hφ : ∀ x, 0 ≤ φ x) : + (uniform B).mean (fun b => φ (F b)) ≤ + ((Fintype.card X : ℝ) / Fintype.card B) * (uniform X).mean φ := by + have hsum : (∑ b, φ (F b)) ≤ ∑ x, φ x := + Finset.sum_le_sum_of_injOn F hF.injOn (Finset.subset_univ _) + (fun _ _ => le_rfl) (fun x _ _ => hφ x) + rw [uniform_mean, uniform_mean, Fintype.expect_eq_sum_div_card, + Fintype.expect_eq_sum_div_card] + have hX : (Fintype.card X : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + calc + _ ≤ (∑ x, φ x) / Fintype.card B := div_le_div_of_nonneg_right hsum (Nat.cast_nonneg _) + _ = _ := by field_simp + +theorem uniform_base_reweight_test_le {B Ω X : Type*} + [Fintype B] [Nonempty B] [Fintype Ω] [Fintype X] [Nonempty X] + (q : FiniteProbabilityWeights Ω) (D : B × Ω → ℝ) (hD : ∀ z, 0 ≤ D z) + (hZ : 0 < ((uniform B).prod q).mean D) + (F : B × Ω → X) (hF : ∀ z, Function.Injective (fun b => F (b, z))) + (φ : X → ℝ) (hφ : ∀ x, 0 ≤ φ x) + {M ε a : ℝ} (hM : 0 ≤ M) (ha : 0 < a) + (hlower : a ≤ ((uniform B).prod q).mean D) + (hlocal : ∀ b, q.mean (fun z => D (b, z) * φ (F (b, z))) ≤ + M * q.mean (fun z => φ (F (b, z))) + ε) : + (((uniform B).prod q).reweightPositive D hD hZ).mean (fun z => φ (F z)) ≤ + ((M * ((Fintype.card X : ℝ) / Fintype.card B)) * (uniform X).mean φ + ε) / a := by + have href : ((uniform B).prod q).mean (fun z => φ (F z)) ≤ + ((Fintype.card X : ℝ) / Fintype.card B) * (uniform X).mean φ := by + rw [mean_prod, mean_comm] + exact (q.mean_mono (fun z => uniform_injective_mean_le _ (hF z) φ hφ)).trans_eq + (q.mean_const _) + have hraw : ((uniform B).prod q).mean (fun z => D z * φ (F z)) ≤ + M * ((uniform B).prod q).mean (fun z => φ (F z)) + ε := by + rw [mean_prod, mean_prod] + exact ((uniform B).mean_mono hlocal).trans_eq (by rw [mean_add, mean_const_mul, mean_const]) + have hnorm := ((uniform B).prod q).reweightPositive_test_le D hD hZ + (fun z => φ (F z)) (fun z => hφ (F z)) ha hlower hraw + apply hnorm.trans + apply div_le_div_of_nonneg_right _ ha.le + calc + _ ≤ M * (((Fintype.card X : ℝ) / Fintype.card B) * (uniform X).mean φ) + ε := by + gcongr + _ = _ := by ring + +theorem siteLaw_excessMass_le_of_test_bound {Ω T X : Type*} + [Fintype Ω] [Fintype T] [Nonempty T] [Fintype X] + (p : FiniteProbabilityWeights Ω) (r : FiniteProbabilityWeights X) (F : Ω → T → X) + {C ε : ℝ} + (htest : ∀ (φ : X → ℝ), (∀ x, φ x ∈ Set.Icc (0 : ℝ) 1) → + ∀ t, p.mean (fun z => φ (F z t)) ≤ C * r.mean φ + ε) : + r.excessMass (p.siteLaw F) C ≤ ε := by + apply excessMass_le_of_mass_le + intro A + let φ : X → ℝ := fun x => if x ∈ A then 1 else 0 + have hφ : ∀ x, φ x ∈ Set.Icc (0 : ℝ) 1 := by intro x; dsimp only [φ]; split_ifs <;> norm_num + have hmean : (p.siteLaw F).mean φ ≤ C * r.mean φ + ε := by + rw [siteLaw_mean] + simp_rw [← uniform_mean] + rw [mean_comm] + exact ((uniform T).mean_mono (htest φ hφ)).trans_eq ((uniform T).mean_const _) + have hfilter : Finset.univ.filter (fun x => x ∈ A) = A := by ext x; simp + simpa only [mean, φ, mul_ite, mul_one, mul_zero, ← Finset.sum_filter, hfilter, + mass] using hmean + +end Erdos3.FiniteProbabilityWeights + +end + +section + +namespace Erdos3 + +theorem fixedParameter_scalar_tail_mono_slack {X T : Type*} [Fintype X] [Fintype T] + (outer : FiniteProbabilityWeights X) (parameter : FiniteProbabilityWeights T) + (h g : X → T → ℝ) {level small large gap bound : ℝ} + (hg : ∀ x t, 0 ≤ g x t) (hlevel : 0 ≤ level) (hslack : small ≤ large) + (hbound : outer.eventProbability (fun x => gap < parameter.mean + (fun t => h x t - (1 + small) * level * g x t)) ≤ bound) : + outer.eventProbability (fun x => gap < parameter.mean + (fun t => h x t - (1 + large) * level * g x t)) ≤ bound := by + apply (outer.eventProbability_mono _ _ ?_).trans hbound + intro x hx + apply hx.trans_le + apply parameter.mean_mono + intro t + have hs := mul_le_mul_of_nonneg_right hslack (mul_nonneg hlevel (hg x t)) + nlinarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem fixedParameter_scalar_tail_dominated_slack {X T : Type*} [Fintype X] [Fintype T] + (reference outer : FiniteProbabilityWeights X) (parameter : FiniteProbabilityWeights T) + (h g : X → T → ℝ) {p level small large : ℝ} (hp : 0 ≤ p) + (hdom : ∀ x, outer.weight x ≤ Real.exp p * reference.weight x) + (hg : ∀ x t, 0 ≤ g x t) (hlevel : 0 ≤ level) (hslack : small ≤ large) + (hbound : reference.eventProbability (fun x => Real.exp (-(2 * p)) < parameter.mean + (fun t => h x t - (1 + small) * level * g x t)) ≤ Real.exp (-(2 * p))) : + outer.eventProbability (fun x => Real.exp (-p) < parameter.mean + (fun t => h x t - (1 + large) * level * g x t)) ≤ Real.exp (-p) := by + have hlarge := fixedParameter_scalar_tail_mono_slack reference parameter h g hg hlevel hslack hbound + have hgap : Real.exp (-(2 * p)) ≤ Real.exp (-p) := Real.exp_le_exp.mpr (by linarith) + have hreference : reference.eventProbability (fun x => Real.exp (-p) < parameter.mean + (fun t => h x t - (1 + large) * level * g x t)) ≤ Real.exp (-(2 * p)) := + (reference.eventProbability_mono _ _ (fun _ hx => hgap.trans_lt hx)).trans hlarge + calc + _ ≤ Real.exp p * reference.eventProbability (fun x => Real.exp (-p) < parameter.mean + (fun t => h x t - (1 + large) * level * g x t)) := + outer.eventProbability_le_of_weight_le reference (Real.exp p) hdom _ + _ ≤ Real.exp p * Real.exp (-(2 * p)) := + mul_le_mul_of_nonneg_left hreference (Real.exp_pos p).le + _ = Real.exp (-p) := by rw [← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarExtensionSubstitution.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarExtensionSubstitution.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1715fbed5b5c1f80c49922fae851c97a24fe281 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarExtensionSubstitution.lean @@ -0,0 +1,32 @@ +import OAI.Combinatorics.Progressions.Polynomial.RealPolynomialEvaluationMass + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators Classical + +theorem aeval_polynomial_totalDegree_le {I J R S : Type*} [CommRing R] [CommRing S] + [Algebra R S] (P : MvPolynomial I R) (f : I → MvPolynomial J S) {d e : ℕ} + (hP : P.totalDegree ≤ d) (hf : ∀ i, (f i).totalDegree ≤ e) : + (aeval f P).totalDegree ≤ d * e := by + rw [aeval_def, eval₂_eq] + apply totalDegree_finsetSum_le + intro a ha + apply (totalDegree_mul _ _).trans + simp only [MvPolynomial.algebraMap_apply, totalDegree_C, zero_add] + calc + _ ≤ ∑ i ∈ a.support, (f i ^ a i).totalDegree := totalDegree_finsetProd _ _ + _ ≤ ∑ i ∈ a.support, a i * e := Finset.sum_le_sum (fun i _ => + (totalDegree_pow _ _).trans (Nat.mul_le_mul_left _ (hf i))) + _ = (a.sum fun _ n => n) * e := by rw [← Finset.sum_mul]; rfl + _ ≤ d * e := Nat.mul_le_mul_right _ ((le_totalDegree ha).trans hP) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarInitialThreshold.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarInitialThreshold.lean new file mode 100644 index 0000000000000000000000000000000000000000..f830919f6d26d442b21f762c846106851da4a49c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarInitialThreshold.lean @@ -0,0 +1,74 @@ +import OAI.Combinatorics.Progressions.Dynamics.OriginalParameterReferenceBudget +import OAI.Combinatorics.Progressions.Polynomial.ScalarInitialPolynomialBudget +import OAI.Combinatorics.Progressions.Polynomial.ScalarThresholdPolynomial + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def scalarInitialThreshold (E m n d : ℕ) (epsilon p P0 : ℝ) : ℝ := + let Z := replacementCommonInputLog m n d P0 + let G := 2 * physicalPairCoefficientLog n d Z + 2 + let U := scalarInitialReferenceInput m n d p P0 + let pref := affineReferenceInput epsilon U + let common := affineCommonReferenceBudget E epsilon U + let b := adaptiveAffineCutoff ⌈(pref + 2) ^ E⌉₊ m n epsilon p + (scalarTransferTail (3 * p)) Z (scalarTransferBaseAccuracy (3 * p)) Z + scalarCombinedLogThreshold n d b p P0 Z G ((pref + 2) ^ E) + (scalarTransferCellLog common b p Z U) + (scalarMeshLog G (P0 + 1) (scalarTransferAccuracyLog b p Z)) + +theorem exists_scalarInitialThreshold_power (E d A : ℕ) (hE : 2 ≤ E) + {epsilon : ℝ} (hepsilon : 0 < epsilon) (hepsilon1 : epsilon ≤ 1) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ (m n : ℕ) (p : ℝ), 2 ≤ p → + (m : ℝ) ≤ (d + 1 : ℝ) * p → (n : ℝ) ≤ p → + epsilon⁻¹ ≤ Real.exp ((A : ℝ) * (p + 1)) → + scalarInitialThreshold E m n d epsilon p ((A : ℝ) * (p + 1)) ≤ (p + 2) ^ C := by + obtain ⟨C0, _, hUbound⟩ := exists_scalarInitialReferenceInput_power_bound d A + obtain ⟨C1, hC1, hthreshold⟩ := exists_scalarCombinedLogThreshold_common_power + let q := ((C0 + 4) * (affineReferencePower epsilon + 1) + 1) * E + 1 + refine ⟨(q + 2) * C1, by nlinarith [Nat.zero_le q], ?_⟩ + intro m n p hp hm hn heps + let P0 := (A : ℝ) * (p + 1) + let Z := replacementCommonInputLog m n d P0 + let G := 2 * physicalPairCoefficientLog n d Z + 2 + let U := scalarInitialReferenceInput m n d p P0 + let pref := affineReferenceInput epsilon U + let common := affineCommonReferenceBudget E epsilon U + let b := adaptiveAffineCutoff ⌈(pref + 2) ^ E⌉₊ m n epsilon p + (scalarTransferTail (3 * p)) Z (scalarTransferBaseAccuracy (3 * p)) Z + have hp0 : 0 ≤ p := by linarith + have hP0 : 0 ≤ P0 := by dsimp only [P0]; positivity + have hZ : 0 ≤ Z := (replacementCommonInputLog_bounds m n d hP0).1 + obtain ⟨hU, hZU, hGU, hP0U, hmU, hnU, hdU, hTU, hpU⟩ := scalarInitialReferenceInput_bounds m n d hp0 hP0 + have hGU' : G ≤ U := by linarith + have hepsU : epsilon⁻¹ ≤ Real.exp U := heps.trans (Real.exp_le_exp.mpr hP0U) + have hbase : 0 < scalarTransferBaseAccuracy (3 * p) := Real.exp_pos _ + have hbaseInv : (scalarTransferBaseAccuracy (3 * p))⁻¹ ≤ Real.exp U := by + simp only [scalarTransferBaseAccuracy, Real.exp_neg, inv_inv] + apply Real.exp_le_exp.mpr + unfold scalarTransferTail at hTU + linarith + have hT : 0 ≤ scalarTransferTail (3 * p) := by unfold scalarTransferTail; positivity + have hb := (adaptiveAffineCutoff_reference_bounds hE hepsilon hepsilon1 hU hp0 hT hZ hZ + hpU hTU hZU hZU hmU hnU hepsU hbase hbaseInv).2 + have hc := affineCommonReferenceBudget_bounds hE epsilon hU + have hcost : (pref + 2) ^ E ≤ common := by + have hpref : 0 ≤ pref + 2 := by linarith [(affineReferenceInput_bounds epsilon hU).1] + change (pref + 2) ^ E ≤ 2 * (pref + 2) ^ E + nlinarith [pow_nonneg hpref E] + have hthresholdCommon := hthreshold n d b p P0 Z G U common ((pref + 2) ^ E) hc.1 hZ + (hpU.trans hc.2.1) (hP0U.trans hc.2.1) (hZU.trans hc.2.1) (hGU'.trans hc.2.1) hc.2.1 + (hnU.trans hc.2.1) (hdU.trans hc.2.1) hcost hb + have hUoriginal : U ≤ (p + 2) ^ C0 := hUbound m n p hp0 hm hn + have hcommonOriginal : common ≤ (p + 2) ^ q := + affineCommonReferenceBudget_le_original_power E epsilon hp hU hUoriginal + exact polynomial_budget_comp hp0 hc.1 q C1 hcommonOriginal hthresholdCommon + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarInputLogFactor.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarInputLogFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..b98daf46db0e58293903fac43e6821d43a052f63 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarInputLogFactor.lean @@ -0,0 +1,26 @@ +import OAI.Combinatorics.Progressions.Dynamics.InitialBudgetJointReplacement + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_scalarInputLogFactor (ell : ℕ) (epsilon : ℝ) : + ∃ A0 : ℕ, 10 ≤ A0 ∧ epsilon⁻¹ ≤ Real.exp (A0 : ℝ) ∧ + (ell : ℝ) ≤ Real.exp (A0 : ℝ) ∧ + (probabilityProfileLipschitz : ℝ) ≤ Real.exp (A0 : ℝ) := by + let B : ℝ := max 10 (max epsilon⁻¹ (max (ell : ℝ) (probabilityProfileLipschitz : ℝ))) + obtain ⟨A0, hA0⟩ := exists_nat_ge B + have h10 : (10 : ℝ) ≤ A0 := (le_max_left _ _).trans hA0 + have hexp : (A0 : ℝ) ≤ Real.exp (A0 : ℝ) := by linarith [Real.add_one_le_exp (A0 : ℝ)] + refine ⟨A0, by exact_mod_cast h10, ?_, ?_, ?_⟩ + · exact ((le_max_left _ _).trans ((le_max_right _ _).trans hA0)).trans hexp + · exact ((le_max_left _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hA0))).trans hexp + · exact ((le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans hA0))).trans hexp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScalarWindowPartitions.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarWindowPartitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3ae9f0210e4be988d97326dc2b1fa3e1007de29 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScalarWindowPartitions.lean @@ -0,0 +1,58 @@ +import Mathlib.Algebra.Order.Floor.Ring +import OAI.Combinatorics.Progressions.Geometry.PhysicalBoxPartition + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def scalarWindowLength (N : ℕ) (S : ℝ) : ℕ := + min N ⌊S / 4⌋₊ + +theorem scalarWindowLength_bounds {N : ℕ} {S K : ℝ} + (hN : 0 < N) (hS : 4 ≤ S) (hK : 0 ≤ K) (hratio : S ≤ K * N) : + 0 < scalarWindowLength N S ∧ scalarWindowLength N S ≤ N ∧ + 2 * (scalarWindowLength N S : ℝ) ≤ S / 2 ∧ + S ≤ (K + 8) * scalarWindowLength N S := by + have hfloor : 1 ≤ ⌊S / 4⌋₊ := (Nat.le_floor_iff (by positivity : 0 ≤ S / 4)).mpr (by norm_num; linarith) + have hfloorle : (⌊S / 4⌋₊ : ℝ) ≤ S / 4 := Nat.floor_le (by positivity) + have hgap : S / 4 < (⌊S / 4⌋₊ : ℝ) + 1 := Nat.lt_floor_add_one (S / 4) + have hpositive : 0 < scalarWindowLength N S := lt_min hN (by omega) + have hsmall : scalarWindowLength N S ≤ ⌊S / 4⌋₊ := min_le_right _ _ + have hsmallreal : (scalarWindowLength N S : ℝ) ≤ (⌊S / 4⌋₊ : ℝ) := by exact_mod_cast hsmall + refine ⟨hpositive, min_le_left _ _, by linarith, ?_⟩ + by_cases hNF : N ≤ ⌊S / 4⌋₊ + · rw [scalarWindowLength, min_eq_left hNF] + nlinarith [Nat.cast_nonneg (α := ℝ) N] + · rw [scalarWindowLength, min_eq_right (le_of_not_ge hNF)] + have hfloorreal : (1 : ℝ) ≤ ⌊S / 4⌋₊ := by exact_mod_cast hfloor + nlinarith [mul_nonneg hK (Nat.cast_nonneg (α := ℝ) ⌊S / 4⌋₊)] + +theorem exists_scalarWindowPartitions {I : Type*} (N : I → ℕ) (S : I → ℝ) (K : ℝ) + (hN : ∀ i, 0 < N i) (hS : ∀ i, 4 ≤ S i) (hK : 0 ≤ K) + (hratio : ∀ i, S i ≤ K * N i) : + ∃ P : ∀ i, FiniteProgressionPartition (N i), + (∀ i c, (P i).step c = 1) ∧ (∀ i c, 0 < (P i).length c) ∧ + (∀ i c, ((P i).length c : ℝ) ≤ S i / 2) ∧ + (∀ i c, S i ≤ (K + 8) * (P i).length c) := by + let H := fun i => scalarWindowLength (N i) (S i) + have hbounds i := scalarWindowLength_bounds (hN i) (hS i) hK (hratio i) + let P := comparableBoxPartitions N H (fun i => (hbounds i).1) (fun i => (hbounds i).2.1) + have hlength i c := comparableBoxPartitions_length N H (fun i => (hbounds i).1) + (fun i => (hbounds i).2.1) i c + refine ⟨P, comparableBoxPartitions_step _ _ _ _, ?_, ?_, ?_⟩ + · intro i c + exact (hbounds i).1.trans_le (hlength i c).1 + · intro i c + have hlen : ((P i).length c : ℝ) < 2 * H i := by exact_mod_cast (hlength i c).2 + exact hlen.le.trans (hbounds i).2.2.1 + · intro i c + exact (hbounds i).2.2.2.trans (mul_le_mul_of_nonneg_left + (by exact_mod_cast (hlength i c).1) (by linarith)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScaledConditionedComparison.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledConditionedComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..83927b323f946c2646a465baa8b3268f2703e1f0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledConditionedComparison.lean @@ -0,0 +1,605 @@ +import OAI.Combinatorics.Progressions.Dynamics.DependentShellBudget +import OAI.Combinatorics.Progressions.Estimates.ObservedUnitTruncation +import OAI.Combinatorics.Progressions.Linear.KernelCoreComparison +import OAI.Combinatorics.Progressions.Linear.ProductEmbeddingANOVA + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + +theorem productANOVA_sum (μ : ∀ i, FiniteProbabilityWeights (X i)) + {α : Type*} (s : Finset α) (f : α → (∀ i, X i) → ℝ) (S : Finset ι) (x : ∀ i, X i) : + productANOVA μ S (fun y => ∑ a ∈ s, f a y) x = ∑ a ∈ s, productANOVA μ S (f a) x := by + simp only [productANOVA, productConditionalMean, FiniteProbabilityWeights.mean_sum, Finset.mul_sum] + rw [Finset.sum_comm] + +theorem productANOVATruncation_sum (μ : ∀ i, FiniteProbabilityWeights (X i)) + {α : Type*} (s : Finset α) (f : α → (∀ i, X i) → ℝ) (D : Finset (Finset ι)) (x : ∀ i, X i) : + productANOVATruncation μ D (fun y => ∑ a ∈ s, f a y) x = + ∑ a ∈ s, productANOVATruncation μ D (f a) x := by + simp only [productANOVATruncation, productANOVA_sum] + rw [Finset.sum_comm] + +theorem productANOVATruncation_smul (μ : ∀ i, FiniteProbabilityWeights (X i)) + (D : Finset (Finset ι)) (a : ℝ) (f : (∀ i, X i) → ℝ) (x : ∀ i, X i) : + productANOVATruncation μ D (fun y => a * f y) x = a * productANOVATruncation μ D f x := by + simp only [productANOVATruncation, productANOVA_smul, Finset.mul_sum] + +variable {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +theorem productCouplingPairing_smul (a b : ℝ) (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : + productCouplingPairing c (fun x => a * w x) (fun y => b * f y) = a * b * productCouplingPairing c w f := by + unfold productCouplingPairing + rw [← FiniteProbabilityWeights.mean_const_mul] + congr 1 + funext z + ring + +theorem productCouplingPairing_truncation_smul (D : Finset (Finset ι)) (a b : ℝ) + (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : + productCouplingPairing c (productANOVATruncation μ D (fun x => a * w x)) + (productANOVATruncation ν D (fun y => b * f y)) = + a * b * productCouplingPairing c (productANOVATruncation μ D w) (productANOVATruncation ν D f) := by + simp only [show productANOVATruncation μ D (fun x => a * w x) = + (fun x => a * productANOVATruncation μ D w x) from funext (productANOVATruncation_smul μ D a w), + show productANOVATruncation ν D (fun y => b * f y) = + (fun y => b * productANOVATruncation ν D f y) from funext (productANOVATruncation_smul ν D b f), + productCouplingPairing_smul] + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem normalized_pairing_error_scale {P u v q m s E : ℝ} (hm : 0 < m) (hs : 0 < s) + (h : |m⁻¹ * s⁻¹ * P - q * ((m⁻¹ * u) * (s⁻¹ * v))| ≤ E) : + |P - q * (u * v)| ≤ m * s * E := by + calc + _ = |(m * s) * (m⁻¹ * s⁻¹ * P - q * ((m⁻¹ * u) * (s⁻¹ * v)))| := by + congr 1 + field_simp + _ = m * s * |m⁻¹ * s⁻¹ * P - q * ((m⁻¹ * u) * (s⁻¹ * v))| := by + rw [abs_mul, abs_of_nonneg (mul_nonneg hm.le hs.le)] + _ ≤ _ := mul_le_mul_of_nonneg_left h (mul_nonneg hm.le hs.le) + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +noncomputable def productAtomTruncatedPairing (D : Finset (Finset ι)) (I : Finset ι) + (x : ∀ i, X i) (y : ∀ i, Y i) (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : ℝ := + productCouplingPairing c (productANOVATruncation μ D (fun z => productFiberIndicator I x z * w z)) + (productANOVATruncation ν D (fun z => productFiberIndicator I y z * f z)) + +theorem productAtomTruncatedPairing_smul (D : Finset (Finset ι)) (I : Finset ι) + (x : ∀ i, X i) (y : ∀ i, Y i) (a b : ℝ) (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : + productAtomTruncatedPairing c D I x y (fun z => a * w z) (fun z => b * f z) = + a * b * productAtomTruncatedPairing c D I x y w f := by + have hw : (fun z => productFiberIndicator I x z * (a * w z)) = + (fun z => a * (productFiberIndicator I x z * w z)) := by funext z; ring + have hf : (fun z => productFiberIndicator I y z * (b * f z)) = + (fun z => b * (productFiberIndicator I y z * f z)) := by funext z; ring + unfold productAtomTruncatedPairing + rw [hw, hf, productCouplingPairing_truncation_smul] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + +theorem productANOVA_add (μ : ∀ i, FiniteProbabilityWeights (X i)) (S : Finset ι) + (f g : (∀ i, X i) → ℝ) (x : ∀ i, X i) : + productANOVA μ S (fun y => f y + g y) x = productANOVA μ S f x + productANOVA μ S g x := by + simp only [productANOVA, productConditionalMean, FiniteProbabilityWeights.mean_add, + mul_add, Finset.sum_add_distrib] + +theorem productANOVATruncation_add (μ : ∀ i, FiniteProbabilityWeights (X i)) (D : Finset (Finset ι)) + (f g : (∀ i, X i) → ℝ) (x : ∀ i, X i) : + productANOVATruncation μ D (fun y => f y + g y) x = + productANOVATruncation μ D f x + productANOVATruncation μ D g x := by + simp only [productANOVATruncation, productANOVA_add, Finset.sum_add_distrib] + +variable {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +noncomputable def productTruncatedPairing (D : Finset (Finset ι)) + (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : ℝ := + productCouplingPairing c (productANOVATruncation μ D w) (productANOVATruncation ν D f) + +theorem productTruncatedPairing_add_left (D : Finset (Finset ι)) + (u w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : + productTruncatedPairing c D (fun x => u x + w x) f = + productTruncatedPairing c D u f + productTruncatedPairing c D w f := by + simp only [productTruncatedPairing, productCouplingPairing, productANOVATruncation_add, + add_mul, FiniteProbabilityWeights.mean_add] + +theorem productTruncatedPairing_add_right (D : Finset (Finset ι)) + (w : (∀ i, X i) → ℝ) (f g : (∀ i, Y i) → ℝ) : + productTruncatedPairing c D w (fun x => f x + g x) = + productTruncatedPairing c D w f + productTruncatedPairing c D w g := by + simp only [productTruncatedPairing, productCouplingPairing, productANOVATruncation_add, + mul_add, FiniteProbabilityWeights.mean_add] + +theorem productTruncatedPairing_smul (D : Finset (Finset ι)) (a b : ℝ) + (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : + productTruncatedPairing c D (fun x => a * w x) (fun y => b * f y) = + a * b * productTruncatedPairing c D w f := productCouplingPairing_truncation_smul c D a b w f + +theorem productTruncatedPairing_sub_smul_right (D : Finset (Finset ι)) (a : ℝ) + (w : (∀ i, X i) → ℝ) (f g : (∀ i, Y i) → ℝ) : + productTruncatedPairing c D w (fun y => f y - a * g y) = + productTruncatedPairing c D w f - a * productTruncatedPairing c D w g := by + have he : (fun y => f y - a * g y) = (fun y => f y + (-a) * g y) := by funext y; ring + have hs := productTruncatedPairing_smul c D 1 (-a) w g + simp only [one_mul] at hs + rw [he, productTruncatedPairing_add_right, hs] + ring + +theorem productTruncatedPairing_sum_right {α : Type*} (s : Finset α) (D : Finset (Finset ι)) + (w : (∀ i, X i) → ℝ) (f : α → (∀ i, Y i) → ℝ) : + productTruncatedPairing c D w (fun y => ∑ a ∈ s, f a y) = + ∑ a ∈ s, productTruncatedPairing c D w (f a) := by + simp only [productTruncatedPairing, productCouplingPairing, productANOVATruncation_sum, + Finset.mul_sum, FiniteProbabilityWeights.mean_sum] + +theorem productAtomTruncatedPairing_sub_smul_right (D : Finset (Finset ι)) (I : Finset ι) + (x : ∀ i, X i) (y : ∀ i, Y i) (a : ℝ) (w : (∀ i, X i) → ℝ) (f g : (∀ i, Y i) → ℝ) : + productAtomTruncatedPairing c D I x y w (fun z => f z - a * g z) = + productAtomTruncatedPairing c D I x y w f - a * productAtomTruncatedPairing c D I x y w g := by + have he : (fun z => productFiberIndicator I y z * (f z - a * g z)) = + (fun z => productFiberIndicator I y z * f z - a * (productFiberIndicator I y z * g z)) := by + funext z + ring + change productTruncatedPairing c D (fun z => productFiberIndicator I x z * w z) _ = _ + rw [he, productTruncatedPairing_sub_smul_right] + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +theorem productTruncatedPairing_atom_sum_right (D : Finset (Finset ι)) (I : Finset ι) + (x : ∀ i, X i) (baseY : ∀ i, Y i) (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : + (∑ a : ∀ i : I, Y i, productAtomTruncatedPairing c D I x (productSubtypePoint I a baseY) w f) = + productTruncatedPairing c D (fun z => productFiberIndicator I x z * w z) f := by + change (∑ a : ∀ i : I, Y i, productTruncatedPairing c D + (fun z => productFiberIndicator I x z * w z) + (fun z => productFiberIndicator I (productSubtypePoint I a baseY) z * f z)) = _ + rw [← productTruncatedPairing_sum_right] + congr 1 + funext z + exact productFiberIndicator_partition I baseY f z + +variable {Ω : Type*} [Fintype Ω] [∀ i, DecidableEq (X i)] + +omit c in +theorem ProductCylinder.indicator_density_cut (d : ProductCylinder X) + (μ : ∀ i, FiniteProbabilityWeights (X i)) (base : ∀ i, X i) + (p : FiniteProbabilityWeights Ω) (F : Ω → ∀ i, X i) (w : Ω → ℝ) : + (fun z => productFiberIndicator d.1 (d.assignment base) z * observedProductDensity μ p F (d.cut F w) z) = + observedProductDensity μ p F (d.cut F w) := by + funext z + by_cases hz : d.Contains z + · have hi := (d.contains_iff base z).mp hz + have he : productFiberIndicator d.1 (d.assignment base) z = 1 := by + unfold productFiberIndicator + exact ite_eq_left hi + rw [he, one_mul] + · simp only [d.density_cut, ite_eq_right hz, mul_zero] + +theorem ProductCylinder.truncated_pairing_atoms (d : ProductCylinder X) + (D : Finset (Finset ι)) (base : ∀ i, X i) (baseY : ∀ i, Y i) + (p : FiniteProbabilityWeights Ω) (F : Ω → ∀ i, X i) (w : Ω → ℝ) (f : (∀ i, Y i) → ℝ) : + productTruncatedPairing c D (observedProductDensity μ p F (d.cut F w)) f = + ∑ a : ∀ i : d.1, Y i, productAtomTruncatedPairing c D d.1 (d.assignment base) + (productSubtypePoint d.1 a baseY) (observedProductDensity μ p F (d.cut F w)) f := by + rw [productTruncatedPairing_atom_sum_right, d.indicator_density_cut μ base p F w] + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {Ω ι : Type*} [Fintype Ω] [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +theorem observedProductDensity_residual_difference + (p : FiniteProbabilityWeights Ω) (F : Ω → ∀ i, X i) + (hμ : ∀ i x, 0 < (μ i).weight x) (base : ∀ i, X i) (v : Ω → ℝ) + {η τ H G a : ℝ} (ha : 0 ≤ a) (hv : ∀ z, 0 ≤ v z ∧ v z ≤ 1) (hη : 0 ≤ η) + (hmass : p.mean v ≤ τ) (D : Finset (Finset ι)) {b : ℕ} (hcard : ∀ S ∈ D, S.card ≤ b) + (hclose : ProductMarginalsClose μ (observedProductDensity μ p F (fun _ => 1)) η (2 * b)) + (herr : 2 * η * (D.card : ℝ) ^ 2 * (4 : ℝ) ^ b * (1 + η) ^ 2 ≤ τ) + (h g : (∀ i, Y i) → ℝ) + (hh : Real.sqrt (productANOVAEnergy ν D h) ≤ H) + (hg : Real.sqrt (productANOVAEnergy ν D g) ≤ G) : + |productTruncatedPairing c D (observedProductDensity μ p F v) (fun y => h y - a * g y)| ≤ + Real.sqrt (3 * τ) * (H + a * G) := by + have hH := observedProductDensity_small_mass_pairing c p F hμ base v hv hη hmass D hcard hclose herr h hh + have hG := observedProductDensity_small_mass_pairing c p F hμ base v hv hη hmass D hcard hclose herr g hg + rw [productTruncatedPairing_sub_smul_right, sub_eq_add_neg] + calc + _ ≤ |productTruncatedPairing c D (observedProductDensity μ p F v) h| + + |-(a * productTruncatedPairing c D (observedProductDensity μ p F v) g)| := abs_add_le _ _ + _ = |productTruncatedPairing c D (observedProductDensity μ p F v) h| + + a * |productTruncatedPairing c D (observedProductDensity μ p F v) g| := by + rw [abs_neg, abs_mul, abs_of_nonneg ha] + _ ≤ Real.sqrt (3 * τ) * H + a * (Real.sqrt (3 * τ) * G) := + add_le_add hH (mul_le_mul_of_nonneg_left hG ha) + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {Ω ι : Type*} [Fintype Ω] [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] [∀ i, DecidableEq (X i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +theorem CylinderRemovalChain.retained_pairing_sum_le + {base : ∀ i, X i} {p : FiniteProbabilityWeights Ω} {F : Ω → ∀ i, X i} + {K τ : ℝ} {j r : ℕ} {w v : Ω → ℝ} {cs : List (ProductCylinder X)} + (hchain : CylinderRemovalChain μ base p F K τ j r w v cs) + (hμ : ∀ i x, 0 < (μ i).weight x) (D : Finset (Finset ι)) (baseY : ∀ i, Y i) + (hw : ∀ z, w z ≤ 1) (hv : ∀ z, 0 ≤ v z) {C : ℝ} (hC : 0 ≤ C) + (E : (d : ProductCylinder X) → (Ω → ℝ) → (∀ i : d.1, Y i) → ℝ) + (f : (∀ i, Y i) → ℝ) + (hret : ∀ cf ∈ cs.zip (removedCylinderWeights F w cs), ∀ a : ∀ i : cf.1.1, Y i, + productAtomTruncatedPairing c D cf.1.1 (cf.1.assignment base) + (productSubtypePoint cf.1.1 a baseY) (observedProductDensity μ p F cf.2) f ≤ + C * (productCouplingAtomMass c cf.1.1 (cf.1.assignment base) (productSubtypePoint cf.1.1 a baseY) * + cf.1.mass μ base (observedProductDensity μ p F cf.2)) + E cf.1 cf.2 a) : + ((cs.zip (removedCylinderWeights F w cs)).map + (fun cf => ∑ a : ∀ i : cf.1.1, Y i, productAtomTruncatedPairing c D cf.1.1 (cf.1.assignment base) + (productSubtypePoint cf.1.1 a baseY) (observedProductDensity μ p F cf.2) f)).sum ≤ + C + ((cs.zip (removedCylinderWeights F w cs)).map + (fun cf => ∑ a : ∀ i : cf.1.1, Y i, E cf.1 cf.2 a)).sum := by + apply list_weighted_error_sum_le _ _ + (fun cf => ∑ a : ∀ i : cf.1.1, Y i, + productCouplingAtomMass c cf.1.1 (cf.1.assignment base) (productSubtypePoint cf.1.1 a baseY) * + cf.1.mass μ base (observedProductDensity μ p F cf.2)) _ hC + · exact CylinderRemovalChain.joint_mass_sum_le_one c hchain hμ baseY hw hv + · intro cf hcf + have hs := Finset.sum_le_sum (fun a (_ : a ∈ (Finset.univ : Finset (∀ i : cf.1.1, Y i))) => hret cf hcf a) + simpa only [Finset.sum_add_distrib, ← Finset.mul_sum] using hs + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {I J : Type*} [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] + {X Y : I → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) (e : J ↪ I) + (baseX : ∀ i, X i) (baseY : ∀ i, Y i) + +include baseX baseY + +theorem productCouplingPairing_embedding (f : (∀ j, X (e j)) → ℝ) (g : (∀ j, Y (e j)) → ℝ) : + productCouplingPairing c (fun x => f (fun j => x (e j))) (fun y => g (fun j => y (e j))) = + productCouplingPairing (fun j => c (e j)) f g := by + exact productMean_pullback (fun i => (c i).law) e e.injective (fun i => (baseX i, baseY i)) + (fun z => f (fun j => (z j).1) * g (fun j => (z j).2)) + +theorem productTruncatedPairing_embedding (D : Finset (Finset J)) + (f : (∀ j, X (e j)) → ℝ) (g : (∀ j, Y (e j)) → ℝ) : + productTruncatedPairing c (D.map (Finset.mapEmbedding e).toEmbedding) + (fun x => f (fun j => x (e j))) (fun y => g (fun j => y (e j))) = + productTruncatedPairing (fun j => c (e j)) D f g := by + have hleft : productANOVATruncation μ (D.map (Finset.mapEmbedding e).toEmbedding) + (fun x => f (fun j => x (e j))) = + (fun x => productANOVATruncation (fun j => μ (e j)) D f (fun j => x (e j))) := + funext (productANOVATruncation_embedding μ e baseX D f) + have hright : productANOVATruncation ν (D.map (Finset.mapEmbedding e).toEmbedding) + (fun y => g (fun j => y (e j))) = + (fun y => productANOVATruncation (fun j => ν (e j)) D g (fun j => y (e j))) := + funext (productANOVATruncation_embedding ν e baseY D g) + unfold productTruncatedPairing + rw [hleft, hright] + exact productCouplingPairing_embedding c e baseX baseY _ _ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {Ω ι : Type*} [Fintype Ω] [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] [∀ i, DecidableEq (X i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +theorem CylinderRemovalChain.truncated_pairing_decomposition + {base : ∀ i, X i} {p : FiniteProbabilityWeights Ω} {F : Ω → ∀ i, X i} + {K τ : ℝ} {j r : ℕ} {w v : Ω → ℝ} {cs : List (ProductCylinder X)} + (hchain : CylinderRemovalChain μ base p F K τ j r w v cs) + (D : Finset (Finset ι)) (baseY : ∀ i, Y i) (f : (∀ i, Y i) → ℝ) : + productTruncatedPairing c D (observedProductDensity μ p F w) f = + ((cs.zip (removedCylinderWeights F w cs)).map + (fun cf => ∑ a : ∀ i : cf.1.1, Y i, + productAtomTruncatedPairing c D cf.1.1 (cf.1.assignment base) + (productSubtypePoint cf.1.1 a baseY) (observedProductDensity μ p F cf.2) f)).sum + + productTruncatedPairing c D (observedProductDensity μ p F v) f := by + induction hchain with + | nil => simp only [removedCylinderWeights, List.zip_nil_left, List.map_nil, List.sum_nil, zero_add] + | @cons w v cs d hsize hmass hbounded rest ih => + have he : observedProductDensity μ p F w = + (fun z => observedProductDensity μ p F (d.cut F w) z + observedProductDensity μ p F (d.erase F w) z) := by + funext z + have h := observedProductDensity_add μ p F (d.cut F w) (d.erase F w) z + rw [show (fun z => d.cut F w z + d.erase F w z) = w from funext (d.cut_add_erase F w)] at h + exact h + rw [he, productTruncatedPairing_add_left, d.truncated_pairing_atoms c D base baseY p F w f, ih] + simp only [removedCylinderWeights, List.zip_cons_cons, List.map_cons, List.sum_cons, add_assoc] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {Ω ι : Type*} [Fintype Ω] [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] [∀ i, DecidableEq (X i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +theorem CylinderRemovalChain.total_pairing_le + {base : ∀ i, X i} {p : FiniteProbabilityWeights Ω} {F : Ω → ∀ i, X i} + {K τ : ℝ} {j r : ℕ} {w v : Ω → ℝ} {cs : List (ProductCylinder X)} + (hchain : CylinderRemovalChain μ base p F K τ j r w v cs) + (hμ : ∀ i x, 0 < (μ i).weight x) (D : Finset (Finset ι)) (baseY : ∀ i, Y i) + (hw : ∀ z, w z ≤ 1) (hv : ∀ z, 0 ≤ v z ∧ v z ≤ 1) (hmass : p.mean v ≤ τ) + {η C H G a : ℝ} (hη : 0 ≤ η) (hC : 0 ≤ C) (ha : 0 ≤ a) + {b : ℕ} (hcard : ∀ S ∈ D, S.card ≤ b) + (hclose : ProductMarginalsClose μ (observedProductDensity μ p F (fun _ => 1)) η (2 * b)) + (herr : 2 * η * (D.card : ℝ) ^ 2 * (4 : ℝ) ^ b * (1 + η) ^ 2 ≤ τ) + (h g : (∀ i, Y i) → ℝ) + (hh : Real.sqrt (productANOVAEnergy ν D h) ≤ H) + (hg : Real.sqrt (productANOVAEnergy ν D g) ≤ G) + (E : (d : ProductCylinder X) → (Ω → ℝ) → (∀ i : d.1, Y i) → ℝ) + (hret : ∀ cf ∈ cs.zip (removedCylinderWeights F w cs), ∀ z : ∀ i : cf.1.1, Y i, + productAtomTruncatedPairing c D cf.1.1 (cf.1.assignment base) + (productSubtypePoint cf.1.1 z baseY) (observedProductDensity μ p F cf.2) (fun y => h y - a * g y) ≤ + C * (productCouplingAtomMass c cf.1.1 (cf.1.assignment base) (productSubtypePoint cf.1.1 z baseY) * + cf.1.mass μ base (observedProductDensity μ p F cf.2)) + E cf.1 cf.2 z) : + productTruncatedPairing c D (observedProductDensity μ p F w) (fun y => h y - a * g y) ≤ + C + ((cs.zip (removedCylinderWeights F w cs)).map + (fun cf => ∑ z : ∀ i : cf.1.1, Y i, E cf.1 cf.2 z)).sum + + Real.sqrt (3 * τ) * (H + a * G) := by + have hretained := CylinderRemovalChain.retained_pairing_sum_le c hchain hμ D baseY hw + (fun z => (hv z).1) hC E (fun y => h y - a * g y) hret + have hresidual := observedProductDensity_residual_difference c p F hμ base v ha hv hη hmass + D hcard hclose herr h g hh hg + rw [CylinderRemovalChain.truncated_pairing_decomposition c hchain D baseY] + exact add_le_add hretained ((le_abs_self _).trans hresidual) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {Ω ι : Type*} [Fintype Ω] [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] [∀ i, DecidableEq (X i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) + +theorem CylinderRemovalChain.total_pairing_with_shell_budget + {base : ∀ i, X i} {p : FiniteProbabilityWeights Ω} {F : Ω → ∀ i, X i} + {K τ : ℝ} {j r : ℕ} {w v : Ω → ℝ} {cs : List (ProductCylinder X)} + (hchain : CylinderRemovalChain μ base p F K τ j r w v cs) + (hμ : ∀ i x, 0 < (μ i).weight x) (D : Finset (Finset ι)) (baseY : ∀ i, Y i) + (hw : ∀ z, w z ≤ 1) (hv : ∀ z, 0 ≤ v z ∧ v z ≤ 1) (hmass : p.mean v ≤ τ) + {η C H G a κ ε P : ℝ} (hη : 0 ≤ η) (hC : 0 ≤ C) (ha : 0 ≤ a) + (hκ0 : 0 ≤ κ) (hκhalf : κ ≤ 1 / 2) (hε : 0 < ε) + {b : ℕ} (hcard : ∀ S ∈ D, S.card ≤ b) + (hclose : ProductMarginalsClose μ (observedProductDensity μ p F (fun _ => 1)) η (2 * b)) + (herr : 2 * η * (D.card : ℝ) ^ 2 * (4 : ℝ) ^ b * (1 + η) ^ 2 ≤ τ) + (h g : (∀ i, Y i) → ℝ) + (hh : Real.sqrt (productANOVAEnergy ν D h) ≤ H) + (hg : Real.sqrt (productANOVAEnergy ν D g) ≤ G) + (B : (d : ProductCylinder X) → (Ω → ℝ) → (∀ i : d.1, Y i) → ℝ) + (hB : ∀ cf ∈ cs.zip (removedCylinderWeights F w cs), ∀ z, 0 ≤ B cf.1 cf.2 z) + (hbudget : ((cs.zip (removedCylinderWeights F w cs)).map + (fun cf => ∑ z : ∀ i : cf.1.1, Y i, B cf.1 cf.2 z)).sum ≤ Real.exp P) + (hb : j + CyclicCrootSisask.spectralIterations ε P ≤ b) + (hret : ∀ cf ∈ cs.zip (removedCylinderWeights F w cs), ∀ z : ∀ i : cf.1.1, Y i, + productAtomTruncatedPairing c D cf.1.1 (cf.1.assignment base) + (productSubtypePoint cf.1.1 z baseY) (observedProductDensity μ p F cf.2) (fun y => h y - a * g y) ≤ + C * (productCouplingAtomMass c cf.1.1 (cf.1.assignment base) (productSubtypePoint cf.1.1 z baseY) * + cf.1.mass μ base (observedProductDensity μ p F cf.2)) + + κ ^ (b - cf.1.1.card) * B cf.1 cf.2 z) : + productTruncatedPairing c D (observedProductDensity μ p F w) (fun y => h y - a * g y) ≤ + C + ε / 16 + Real.sqrt (3 * τ) * (H + a * G) := by + let E := fun (d : ProductCylinder X) (f : Ω → ℝ) (z : ∀ i : d.1, Y i) => + κ ^ (b - d.1.card) * B d f z + have ht := CylinderRemovalChain.total_pairing_le c hchain hμ D baseY hw hv hmass + hη hC ha hcard hclose herr h g hh hg E hret + have hs := list_dependent_shell_sum_after_cutoff (cs.zip (removedCylinderWeights F w cs)) + (fun cf => ∀ i : cf.1.1, Y i) (fun cf => cf.1.1.card) + (fun cf z => E cf.1 cf.2 z) (fun cf z => B cf.1 cf.2 z) + hε hκ0 hκhalf (fun cf hcf => (hchain.removed_size_mass cf hcf).1) + hB (fun _ _ _ => le_rfl) hbudget hb + linarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem weighted_pairing_error_compose {P Q R m E F : ℝ} (hm : 0 ≤ m) + (hP : |P - m * Q| ≤ E) (hQ : |Q - R| ≤ F) : |P - m * R| ≤ E + m * F := by + calc + _ = |(P - m * Q) + m * (Q - R)| := by congr 1; ring + _ ≤ |P - m * Q| + |m * (Q - R)| := abs_add_le _ _ + _ = |P - m * Q| + m * |Q - R| := by rw [abs_mul, abs_of_nonneg hm] + _ ≤ _ := add_le_add hP (mul_le_mul_of_nonneg_left hQ hm) + +theorem productKernel_conditioned_mean_comparison {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + (μ : ∀ i, FiniteProbabilityWeights (X i)) (ν : ∀ i, FiniteProbabilityWeights (Y i)) + (K : ∀ i, X i → FiniteProbabilityWeights (Y i)) (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i (f : Y i → ℝ), (ν i).mean f = 0 → + (μ i).mean (fun x => (K i x).mean f ^ 2) ≤ C i * (ν i).mean (fun y => f y ^ 2)) + (hK : ∀ i (f : Y i → ℝ), (μ i).mean (fun x => (K i x).mean f) = (ν i).mean f) + (I : Finset ι) {r b : ℕ} (hIb : I.card ≤ b) (hr : r ≤ b - I.card) + {κ A B M N : ℝ} (hκ0 : 0 ≤ κ) (hκ1 : κ ≤ 1) (hcap : ∀ i ∉ I, C i ≤ κ ^ 2) + (hsmall : κ * A ^ 2 * B ^ 2 ≤ 1 / 2) + (x : ∀ i, X i) (y : ∀ i, Y i) (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) + (hw : ∀ k, 1 ≤ k → k ≤ r → Real.sqrt (productANOVAEnergy μ (Finset.univ.powersetCard k) + (productSectionAverage μ I I x w)) ≤ A ^ (2 * k)) + (hf : ∀ k, 1 ≤ k → k ≤ r → Real.sqrt (productANOVAEnergy ν (Finset.univ.powersetCard k) + (productSectionAverage ν I I y f)) ≤ B ^ (2 * k)) + (hM : Real.sqrt (productANOVAEnergy μ (lowDegreeCoordinateSets ι b) (productSectionAverage μ I I x w)) ≤ M) + (hN : Real.sqrt (productANOVAEnergy ν (lowDegreeCoordinateSets ι b) (productSectionAverage ν I I y f)) ≤ N) : + let c := fun i => FiniteProbabilityCoupling.ofKernel (μ i) (ν i) (K i) (hK i) + |productCouplingPairing c + (productANOVATruncation μ (lowDegreeCoordinateSets ι b) (fun z => productFiberIndicator I x z * w z)) + (productANOVATruncation ν (lowDegreeCoordinateSets ι b) (fun z => productFiberIndicator I y z * f z)) - + productCouplingAtomMass c I x y * + ((FiniteProbabilityWeights.pi μ).mean (productSectionAverage μ I I x w) * + (FiniteProbabilityWeights.pi ν).mean (productSectionAverage ν I I y f))| ≤ + (2 : ℝ) ^ I.card * (κ ^ (b - I.card) * M * N) + + productCouplingAtomMass c I x y * (2 * (κ * A ^ 2 * B ^ 2) + κ ^ r * M * N) := by + dsimp only + let c := fun i => FiniteProbabilityCoupling.ofKernel (μ i) (ν i) (K i) (hK i) + have hsub : lowDegreeCoordinateSets ι (b - I.card) ⊆ lowDegreeCoordinateSets ι b := by + intro S hS + exact (mem_lowDegreeCoordinateSets ι b S).mpr + (((mem_lowDegreeCoordinateSets ι (b - I.card) S).mp hS).trans (Nat.sub_le b I.card)) + have hcore := productKernel_core_comparison μ ν K C hC hbound hK Iᶜ hr hκ0 hκ1 + (fun i hi => hcap i (Finset.mem_compl.mp hi)) hsmall + (productSectionAverage μ I I x w) (productSectionAverage ν I I y f) hw hf + ((Real.sqrt_le_sqrt (productANOVAEnergy_mono μ hsub _)).trans hM) + ((Real.sqrt_le_sqrt (productANOVAEnergy_mono ν hsub _)).trans hN) + have hshell := productKernel_conditioning_shell_of_truncated μ ν K C hC hbound hK I b hIb + hκ0 hκ1 hcap x y w f hM hN + exact weighted_pairing_error_compose (productCouplingAtomMass_nonneg c I x y) hshell hcore + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem productKernel_scaled_conditioned_mean_comparison {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + (μ : ∀ i, FiniteProbabilityWeights (X i)) (ν : ∀ i, FiniteProbabilityWeights (Y i)) + (K : ∀ i, X i → FiniteProbabilityWeights (Y i)) (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i (f : Y i → ℝ), (ν i).mean f = 0 → + (μ i).mean (fun x => (K i x).mean f ^ 2) ≤ C i * (ν i).mean (fun y => f y ^ 2)) + (hK : ∀ i (f : Y i → ℝ), (μ i).mean (fun x => (K i x).mean f) = (ν i).mean f) + (I : Finset ι) {r b : ℕ} (hIb : I.card ≤ b) (hr : r ≤ b - I.card) + {κ A B M N m s : ℝ} (hm : 0 < m) (hs : 0 < s) + (hκ0 : 0 ≤ κ) (hκ1 : κ ≤ 1) (hcap : ∀ i ∉ I, C i ≤ κ ^ 2) + (hsmall : κ * A ^ 2 * B ^ 2 ≤ 1 / 2) + (x : ∀ i, X i) (y : ∀ i, Y i) (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) + (hw : ∀ k, 1 ≤ k → k ≤ r → Real.sqrt (productANOVAEnergy μ (Finset.univ.powersetCard k) + (fun z => m⁻¹ * productSectionAverage μ I I x w z)) ≤ A ^ (2 * k)) + (hf : ∀ k, 1 ≤ k → k ≤ r → Real.sqrt (productANOVAEnergy ν (Finset.univ.powersetCard k) + (fun z => s⁻¹ * productSectionAverage ν I I y f z)) ≤ B ^ (2 * k)) + (hM : Real.sqrt (productANOVAEnergy μ (lowDegreeCoordinateSets ι b) + (fun z => m⁻¹ * productSectionAverage μ I I x w z)) ≤ M) + (hN : Real.sqrt (productANOVAEnergy ν (lowDegreeCoordinateSets ι b) + (fun z => s⁻¹ * productSectionAverage ν I I y f z)) ≤ N) : + let c := fun i => FiniteProbabilityCoupling.ofKernel (μ i) (ν i) (K i) (hK i) + |productAtomTruncatedPairing c (lowDegreeCoordinateSets ι b) I x y w f - + productCouplingAtomMass c I x y * + (productConditionalMean μ I w x * productConditionalMean ν I f y)| ≤ + m * s * ((2 : ℝ) ^ I.card * (κ ^ (b - I.card) * M * N) + + productCouplingAtomMass c I x y * (2 * (κ * A ^ 2 * B ^ 2) + κ ^ r * M * N)) := by + dsimp only + let c := fun i => FiniteProbabilityCoupling.ofKernel (μ i) (ν i) (K i) (hK i) + have hw_eq : productSectionAverage μ I I x (fun z => m⁻¹ * w z) = + (fun z => m⁻¹ * productSectionAverage μ I I x w z) := + funext (productSectionAverage_smul μ I I x m⁻¹ w) + have hf_eq : productSectionAverage ν I I y (fun z => s⁻¹ * f z) = + (fun z => s⁻¹ * productSectionAverage ν I I y f z) := + funext (productSectionAverage_smul ν I I y s⁻¹ f) + have h := productKernel_conditioned_mean_comparison μ ν K C hC hbound hK I hIb hr + hκ0 hκ1 hcap hsmall x y (fun z => m⁻¹ * w z) (fun z => s⁻¹ * f z) + (by simpa only [hw_eq] using hw) (by simpa only [hf_eq] using hf) + (by simpa only [hw_eq] using hM) (by simpa only [hf_eq] using hN) + change |productAtomTruncatedPairing c (lowDegreeCoordinateSets ι b) I x y + (fun z => m⁻¹ * w z) (fun z => s⁻¹ * f z) - productCouplingAtomMass c I x y * + ((FiniteProbabilityWeights.pi μ).mean (productSectionAverage μ I I x (fun z => m⁻¹ * w z)) * + (FiniteProbabilityWeights.pi ν).mean (productSectionAverage ν I I y (fun z => s⁻¹ * f z)))| ≤ _ at h + rw [productAtomTruncatedPairing_smul, productSectionAverage_self_mean, productSectionAverage_self_mean, + productConditionalMean_smul, productConditionalMean_smul] at h + exact normalized_pairing_error_scale hm hs h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScaledFloorPerturbation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledFloorPerturbation.lean new file mode 100644 index 0000000000000000000000000000000000000000..88195e2493c08a0703e9ec6e6a1f100e49688175 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledFloorPerturbation.lean @@ -0,0 +1,38 @@ +import Mathlib.Algebra.Order.Floor.Ring +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +theorem scaled_floor_perturbation {s a ε : ℝ} (hs : 0 < s) + (z : ℤ) (hz : |(z : ℝ)| ≤ ε * s) : + |((⌊s * a⌋ + z : ℤ) : ℝ) / s - a| ≤ ε + 1 / s := by + have hround : |(⌊s * a⌋ : ℝ) - s * a| ≤ 1 := by + apply abs_le.mpr + constructor <;> linarith [Int.floor_le (s * a), Int.lt_floor_add_one (s * a)] + have hsum : |((⌊s * a⌋ + z : ℤ) : ℝ) - s * a| ≤ 1 + ε * s := by + rw [Int.cast_add, show (⌊s * a⌋ : ℝ) + z - s * a = + ((⌊s * a⌋ : ℝ) - s * a) + z by ring] + exact (abs_add_le _ _).trans (add_le_add hround hz) + have heq : ((⌊s * a⌋ + z : ℤ) : ℝ) / s - a = + (((⌊s * a⌋ + z : ℤ) : ℝ) - s * a) / s := by + field_simp + rw [heq, abs_div, abs_of_pos hs] + calc + _ ≤ (1 + ε * s) / s := div_le_div_of_nonneg_right hsum hs.le + _ = ε + 1 / s := by field_simp; ring + +theorem scaled_floor_perturbation_le_twice {s a ε : ℝ} (hs : 0 < s) + (hscale : 1 / s ≤ ε) (z : ℤ) (hz : |(z : ℝ)| ≤ ε * s) : + |((⌊s * a⌋ + z : ℤ) : ℝ) / s - a| ≤ 2 * ε := by + have h := scaled_floor_perturbation (a := a) hs z hz + linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScaledJointFrozenSource.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledJointFrozenSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb0534452966ab02c323c028f2440180ec5ee96c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledJointFrozenSource.lean @@ -0,0 +1,161 @@ +import Mathlib.MeasureTheory.Measure.Prod +import OAI.Combinatorics.Progressions.Probability.SlicedRemainderDensityFamily +import OAI.Combinatorics.Progressions.Sampling.CanonicalRawSampler + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +def jointCubeScale {D α : Type*} {B : D → Type*} (h : D → ℕ) + (T : PrincipalTupleIndex B h → ℝ) (x : JointBlockParameter B h α → ℝ) + (j : JointBlockParameter B h α) : ℝ := + T ⟨j.1, j.2.1, j.2.2.1⟩ * x j + +theorem jointCubeScale_measurable {D α : Type*} {B : D → Type*} (h : D → ℕ) + (T : PrincipalTupleIndex B h → ℝ) : Measurable (jointCubeScale (α := α) h T) := + Measurable.of_eval (fun coordinate => measurable_const.mul (measurable_pi_apply coordinate)) + +noncomputable def jointCubeScaleHomeomorph {D α : Type*} {B : D → Type*} (h : D → ℕ) + (T : PrincipalTupleIndex B h → ℝ) (hT : ∀ i, T i ≠ 0) : + (JointBlockParameter B h α → ℝ) ≃ₜ (JointBlockParameter B h α → ℝ) := + Homeomorph.piCongrRight (fun j => + Homeomorph.smulOfNeZero (α := ℝ) (T ⟨j.1, j.2.1, j.2.2.1⟩) (hT _)) + +theorem jointCubeScaleHomeomorph_apply {D α : Type*} {B : D → Type*} (h : D → ℕ) + (T : PrincipalTupleIndex B h → ℝ) (hT : ∀ i, T i ≠ 0) + (x : JointBlockParameter B h α → ℝ) : + jointCubeScaleHomeomorph h T hT x = jointCubeScale h T x := rfl + +noncomputable def scaledJointCubeSource {D α : Type*} [Fintype D] [Fintype α] + [DecidableEq α] {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (T : PrincipalTupleIndex B h → ℝ) : Measure (JointBlockParameter B h α → ℝ) := + sigmaAxisMeasure (fun d => scaledBlockCubeMeasure (fun i : B d × Fin (h d) => T ⟨d, i⟩)) + +theorem scaledJointCubeSource_eq_map {D α : Type*} [Fintype D] [Fintype α] + [DecidableEq α] {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (T : PrincipalTupleIndex B h → ℝ) (hT : ∀ i, 0 < T i) : + scaledJointCubeSource (α := α) h T = + (jointBooleanSource h).map (jointCubeScale h T) := by + change _ = (jointBooleanSource h).map + (sigmaAxisSampler (fun d => blockCubeScale (α := α) (fun i : B d × Fin (h d) => T ⟨d, i⟩))) + rw [jointBooleanSource, sigmaAxisSampler_image_law _ _ + (fun d => blockCubeScale_measurable (fun i : B d × Fin (h d) => T ⟨d, i⟩))] + unfold scaledJointCubeSource + congr 1 + funext d + exact scaledBlockCubeMeasure_eq_map _ (fun i => hT ⟨d, i⟩) + +theorem scaledJointCubeSource_probability {D α : Type*} [Fintype D] [Fintype α] + [DecidableEq α] {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (T : PrincipalTupleIndex B h → ℝ) (hT : ∀ i, 0 < T i) : + IsProbabilityMeasure (scaledJointCubeSource (α := α) h T) := by + rw [scaledJointCubeSource_eq_map h T hT] + infer_instance + +theorem scaledJointCubeSource_integral {D α : Type*} [Fintype D] [Fintype α] + [DecidableEq α] {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (T : PrincipalTupleIndex B h → ℝ) (hT : ∀ i, 0 < T i) + (f : (JointBlockParameter B h α → ℝ) → ℝ) : + (∫ x, f x ∂scaledJointCubeSource h T) = + ∫ x, f (jointCubeScale h T x) ∂jointBooleanSource h := by + rw [scaledJointCubeSource_eq_map h T hT] + exact (jointCubeScaleHomeomorph h T (fun i => (hT i).ne')).toMeasurableEquiv.measurableEmbedding.integral_map f + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def rawCanonicalCubeTuple {D G Z α : Type*} [Fintype α] [DecidableEq α] + {B : D → Type*} {h : D → ℕ} (extra : G → Option α → Z) + (scale : SamplerTupleIndex G B h → ℝ) (z : Z → ℝ) + (x : JointBlockParameter B h α → ℝ) (vertex : Finset α) : SamplerTupleIndex G B h → ℝ + | .inl g => scale (.inl g) * ∑ r : Option α, (booleanFeature r vertex : ℝ) * z (extra g r) + | .inr ⟨d, b, v⟩ => scalarCubeValue (fun r => x ⟨d, b, v, r⟩) vertex + +theorem rawCanonicalCubeTuple_rescale {D G Z α : Type*} [Fintype α] [DecidableEq α] + {B : D → Type*} {h : D → ℕ} (extra : G → Option α → Z) + (scale : SamplerTupleIndex G B h → ℝ) (z : Z → ℝ) + (x : JointBlockParameter B h α → ℝ) (vertex : Finset α) (k : SamplerTupleIndex G B h) : + rawCanonicalCubeTuple extra scale z (jointCubeScale h (fun i => scale (.inr i)) x) vertex k = + scale k * normalizedCubeTuple (canonicalTupleInput extra) z x vertex k := by + cases k with + | inl g => rfl + | inr i => + rcases i with ⟨d, b, v⟩ + exact scalarCubeValue_smul (scale (.inr ⟨d, b, v⟩)) (fun r => x ⟨d, b, v, r⟩) vertex + +noncomputable def rawCanonicalJet {D G Z α : Type*} [Fintype α] [DecidableEq α] + {B O L : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) (c : ∀ d, B d → ℝ) + (sets : ∀ d, O d → Finset α) (terms : ∀ d, Finset (L d)) (weight : ∀ d, L d → ℝ) + (exponent : ∀ d, L d → SamplerTupleIndex G B h →₀ ℕ) + (coefficientIndex : ∀ d, L d → Z) (extra : G → Option α → Z) + (Q : D → ℝ) (scale : SamplerTupleIndex G B h → ℝ) (constant : D → ℝ) + (t : ℝ) (z : Z → ℝ) (x : JointBlockParameter B h α → ℝ) : (Σ d, O d) → ℝ := + rawProductArrayJet h sets terms exponent (fun d b v => .inr ⟨d, b, v⟩) + (scaledPrincipalCoefficient h Q scale (fun d b v => .inr ⟨d, b, v⟩) c) + (scaledTailCoefficient Q scale weight exponent coefficientIndex t z) + (fun d => Q d * constant d) Q (rawCanonicalCubeTuple extra scale z x) + +theorem rawCanonicalJet_rescale {D G Z α : Type*} [Fintype α] [DecidableEq α] + {B O L : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) (c : ∀ d, B d → ℝ) + (sets : ∀ d, O d → Finset α) (terms : ∀ d, Finset (L d)) (weight : ∀ d, L d → ℝ) + (exponent : ∀ d, L d → SamplerTupleIndex G B h →₀ ℕ) + (coefficientIndex : ∀ d, L d → Z) (extra : G → Option α → Z) + (Q : D → ℝ) (scale : SamplerTupleIndex G B h → ℝ) (constant : D → ℝ) + (t : ℝ) (z : Z → ℝ) (x : JointBlockParameter B h α → ℝ) : + rawCanonicalJet h c sets terms weight exponent coefficientIndex extra Q scale constant t z + (jointCubeScale h (fun i => scale (.inr i)) x) = + canonicalScaledProductArrayJet h c sets terms weight exponent coefficientIndex extra + Q scale constant t z x := by + unfold rawCanonicalJet canonicalScaledProductArrayJet scaledProductArrayJet + have he : rawCanonicalCubeTuple extra scale z (jointCubeScale h (fun i => scale (.inr i)) x) = + fun vertex k => scale k * normalizedCubeTuple (canonicalTupleInput extra) z x vertex k := by + funext vertex k + exact rawCanonicalCubeTuple_rescale extra scale z x vertex k + rw [he] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory + +theorem scaledJointCubeSource_prod {Ω D α : Type*} [MeasurableSpace Ω] + [Fintype D] [Fintype α] [DecidableEq α] {B : D → Type*} [∀ d, Fintype (B d)] + (h : D → ℕ) (T : PrincipalTupleIndex B h → ℝ) (hT : ∀ i, 0 < T i) + (μ : Measure Ω) [SFinite μ] : + μ.prod (scaledJointCubeSource (α := α) h T) = + (μ.prod (jointBooleanSource h)).map (Prod.map id (jointCubeScale h T)) := by + rw [scaledJointCubeSource_eq_map h T hT] + simpa only [Measure.map_id] using + Measure.map_prod_map μ (jointBooleanSource h) measurable_id (jointCubeScale_measurable h T) + +theorem scaledJointCubeSource_prod_integral {Ω D α : Type*} [MeasurableSpace Ω] + [Fintype D] [Fintype α] [DecidableEq α] {B : D → Type*} [∀ d, Fintype (B d)] + (h : D → ℕ) (T : PrincipalTupleIndex B h → ℝ) (hT : ∀ i, 0 < T i) + (μ : Measure Ω) [SFinite μ] (f : Ω × (JointBlockParameter B h α → ℝ) → ℝ) : + (∫ p, f p ∂μ.prod (scaledJointCubeSource h T)) = + ∫ p, f (p.1, jointCubeScale h T p.2) ∂μ.prod (jointBooleanSource h) := by + rw [scaledJointCubeSource_prod h T hT] + exact ((MeasurableEquiv.refl Ω).prodCongr + (jointCubeScaleHomeomorph h T (fun i => (hT i).ne')).toMeasurableEquiv).measurableEmbedding.integral_map f + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScaledLinearResidual.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledLinearResidual.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5d9a2df8427c322a676d0cc629da1582c7bc7f8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledLinearResidual.lean @@ -0,0 +1,48 @@ +import Mathlib.Algebra.Module.LinearMap.Basic +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +variable {V W : Type*} [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] + +noncomputable def scaledLinearResidual (E : V →ₗ[ℝ] W) (T : W →ₗ[ℝ] V) (q : ℝ) : + V →ₗ[ℝ] V := q • LinearMap.id - T.comp E + +theorem scaledLinearResidual_apply (E : V →ₗ[ℝ] W) (T : W →ₗ[ℝ] V) (q : ℝ) (x : V) : + scaledLinearResidual E T q x = q • x - T (E x) := rfl + +theorem scaledLinearResidual_evaluation (E : V →ₗ[ℝ] W) (T : W →ₗ[ℝ] V) (q : ℝ) + (hT : ∀ x, E (T (E x)) = q • E x) (x : V) : + E (scaledLinearResidual E T q x) = 0 := by + rw [scaledLinearResidual_apply, map_sub, map_smul, hT, sub_self] + +theorem scaledLinearResidual_on_kernel (E : V →ₗ[ℝ] W) (T : W →ₗ[ℝ] V) (q : ℝ) + (x : V) (hx : E x = 0) : scaledLinearResidual E T q x = q • x := by + rw [scaledLinearResidual_apply, hx, map_zero, sub_zero] + +theorem scaledLinearResidual_factor_iff (E : V →ₗ[ℝ] W) (T : W →ₗ[ℝ] V) + {q : ℝ} (hq : q ≠ 0) (hT : ∀ x, E (T (E x)) = q • E x) (L : V →ₗ[ℝ] ℝ) : + L.comp (scaledLinearResidual E T q) = 0 ↔ ∃ M : W →ₗ[ℝ] ℝ, L = M.comp E := by + constructor + · intro h + refine ⟨q⁻¹ • L.comp T, ?_⟩ + ext x + have hx := DFunLike.congr_fun h x + simp only [LinearMap.comp_apply, scaledLinearResidual_apply, map_sub, map_smul, + smul_eq_mul, LinearMap.zero_apply, sub_eq_zero] at hx + simp only [LinearMap.comp_apply, LinearMap.smul_apply, smul_eq_mul] + rw [← hx, ← mul_assoc, inv_mul_cancel₀ hq, one_mul] + · rintro ⟨M, rfl⟩ + ext x + simp only [LinearMap.comp_apply, scaledLinearResidual_evaluation E T q hT, + map_zero, LinearMap.zero_apply] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ScaledSectionGram.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledSectionGram.lean new file mode 100644 index 0000000000000000000000000000000000000000..80505cd10a87c01aa99e42ba075b058b4b83de22 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ScaledSectionGram.lean @@ -0,0 +1,73 @@ +import OAI.Combinatorics.Progressions.Lattices.EuclideanDerivativeLattice +import OAI.Combinatorics.Progressions.Linear.GramBasisChange + +namespace OAI + +section + +namespace Erdos3 + +open Module + +theorem gram_det_injective_map_basis + {ι V E : Type*} [Fintype ι] [DecidableEq ι] [AddCommGroup V] [Module ℝ V] + [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + (f : V →ₗ[ℝ] E) (hf : Function.Injective f) (b₀ b₁ : Basis ι ℝ V) : + (Matrix.gram ℝ (fun i => f (b₁ i))).det = + (b₀.det b₁) ^ 2 * (Matrix.gram ℝ (fun i => f (b₀ i))).det := by + let e := LinearEquiv.ofInjective f hf + have h := gram_det_basis_change (b₀.map e) (fun i => e (b₁ i)) + have hd : (b₀.map e).det (fun i => e (b₁ i)) = b₀.det b₁ := by + rw [Basis.det_map] + apply congrArg b₀.det + funext i + exact e.symm_apply_apply (b₁ i) + have h₀ : Matrix.gram ℝ (b₀.map e) = Matrix.gram ℝ (fun i => f (b₀ i)) := by + ext i j + simp only [Matrix.gram_apply, Basis.map_apply] + rfl + have h₁ : Matrix.gram ℝ (fun i => e (b₁ i)) = Matrix.gram ℝ (fun i => f (b₁ i)) := by + ext i j + rfl + rw [hd, h₀, h₁] at h + exact h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module + +theorem coordinateScaleEquiv_basis_det {ι : Type*} [Fintype ι] [DecidableEq ι] + (T : ι → ℝ) (hT : ∀ i, T i ≠ 0) : + (Pi.basisFun ℝ ι).det ((Pi.basisFun ℝ ι).map (coordinateScaleEquiv T hT)) = ∏ i, T i := by + rw [Pi.basisFun_det_apply] + have he : Matrix.of ((Pi.basisFun ℝ ι).map (coordinateScaleEquiv T hT)) = Matrix.diagonal T := by + ext i j + by_cases hij : i = j <;> + simp [Basis.map_apply, coordinateScaleEquiv_apply, Pi.basisFun_apply, hij] + rw [he, Matrix.det_diagonal] + +theorem scaled_section_gram_sqrt {ι E : Type*} [Fintype ι] [DecidableEq ι] + [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + (L : (ι → ℝ) →ₗ[ℝ] E) (hL : Function.Injective L) + (T : ι → ℝ) (hT : ∀ i, 0 < T i) : + Real.sqrt (Matrix.gram ℝ (fun i => L (coordinateScaleEquiv T (fun j => (hT j).ne') + (Pi.basisFun ℝ ι i)))).det = + (∏ i, T i) * Real.sqrt (Matrix.gram ℝ (fun i => L (Pi.basisFun ℝ ι i))).det := by + have h := gram_det_injective_map_basis L hL (Pi.basisFun ℝ ι) + ((Pi.basisFun ℝ ι).map (coordinateScaleEquiv T (fun j => (hT j).ne'))) + rw [coordinateScaleEquiv_basis_det] at h + have he := congrArg Real.sqrt h + rw [Real.sqrt_mul (sq_nonneg _), Real.sqrt_sq (Finset.prod_nonneg (fun i _ => (hT i).le))] at he + simpa only [Basis.map_apply] using he + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SecondDifferenceVectorEquivalence.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SecondDifferenceVectorEquivalence.lean new file mode 100644 index 0000000000000000000000000000000000000000..29f8bc57b637c925f6feba3f9804cb5a53411f79 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SecondDifferenceVectorEquivalence.lean @@ -0,0 +1,143 @@ +import OAI.Combinatorics.Progressions.Lattices.MultidegreeIntegerTranslation +import OAI.Combinatorics.Progressions.Lattices.NativeIntegerHalving + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def mixedSecondDifferenceInput (j : Fin 4) (x : Fin 4 → ℤ) : Fin 2 → ℤ := + correlationInput (x 0) (x 1 + ![0, x 2, x 3, x 2 + x 3] j) + +namespace NativeMultidegreeNilcharacter + +noncomputable def mixedSecondDifferenceWithShift {s : ℕ} {p : ℝ} + (M : NativeMultidegreeNilcharacter (mixedCorrelationDegree s) p) + (c : Fin 4 → ℤ) + (a : (Fin M.outputDim × Fin M.outputDim) × (Fin M.outputDim × Fin M.outputDim)) + (x : Fin 4 → ℤ) : ℂ := + (M.eval a.1.1 (mixedSecondDifferenceInput 0 x + ![0, c 0]) * + star (M.eval a.1.2 (mixedSecondDifferenceInput 1 x + ![0, c 1]))) * + star (M.eval a.2.1 (mixedSecondDifferenceInput 2 x + ![0, c 2]) * + star (M.eval a.2.2 (mixedSecondDifferenceInput 3 x + ![0, c 3]))) + +theorem mixedSecondDifferenceWithShift_unit {s : ℕ} {p : ℝ} + (M : NativeMultidegreeNilcharacter (mixedCorrelationDegree s) p) + (c : Fin 4 → ℤ) (x : Fin 4 → ℤ) : + ∑ a, ‖M.mixedSecondDifferenceWithShift c a x‖ ^ 2 = 1 := by + simp only [mixedSecondDifferenceWithShift, Fintype.sum_prod_type, norm_mul, norm_star, + mul_pow, ← Finset.mul_sum, M.unit_eval, mul_one] + +theorem exists_mixed_second_difference_translation (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (M : NativeMultidegreeNilcharacter (mixedCorrelationDegree s) p) (c : Fin 4 → ℤ), + NativeIntegerVectorEquivalence s ((p + C) ^ C) + (M.mixedSecondDifferenceWithShift c) (M.mixedSecondDifferenceWithShift 0) := by + obtain ⟨A, _, htranslate⟩ := exists_multidegree_integer_translation s + obtain ⟨B, _, htensor⟩ := NativeIntegerVectorEquivalence.exists_tensor_budget + let X : Polynomial ℕ := Polynomial.X + let U := (X + Polynomial.C A) ^ A + let V := (U + Polynomial.C B) ^ B + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((V + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p M c + have hp : 0 ≤ p := (Nat.cast_nonneg M.dim).trans M.complexity.1.1 + let u := (p + A) ^ A + let v := (u + B) ^ B + have hu : 0 ≤ u := by dsimp [u]; positivity + have hv : 0 ≤ v := by dsimp [v]; positivity + have hcost : (v + B) ^ B ≤ (p + C) ^ C := by + simpa [X, U, V, u, v, Polynomial.eval₂_pow] using hbudget p hp + have hdegree : (∑ i, mixedCorrelationDegree s i) = s + 1 := by + rw [Fin.sum_univ_two] + change 1 + s = s + 1 + omega + let F (j : Fin 4) : Fin 2 → ((Fin 4 → ℤ) →+ ℤ) := fun i => + { toFun := fun x => mixedSecondDifferenceInput j x i + map_zero' := by fin_cases j <;> fin_cases i <;> rfl + map_add' := by + intro x y + fin_cases i + · rfl + · change (x + y) 1 + ![0, (x + y) 2, (x + y) 3, (x + y) 2 + (x + y) 3] j = + (x 1 + ![0, x 2, x 3, x 2 + x 3] j) + + (y 1 + ![0, y 2, y 3, y 2 + y 3] j) + fin_cases j <;> dsimp <;> ring } + have hzero : (![0, 0] : Fin 2 → ℤ) = 0 := by ext i; fin_cases i <;> rfl + have E (j : Fin 4) : NativeIntegerVectorEquivalence s u + (fun i x => M.eval i (mixedSecondDifferenceInput j x + ![0, c j])) + (fun i x => M.eval i (mixedSecondDifferenceInput j x + ![0, 0])) := by + have T := (htranslate (mixedCorrelationDegree s) hdegree M ![0, c j] 0).linearPullbackHom (F j) + change NativeIntegerVectorEquivalence s u + (fun i x => M.eval i (mixedSecondDifferenceInput j x + ![0, c j])) + (fun i x => M.eval i (mixedSecondDifferenceInput j x + 0)) at T + simpa only [hzero] using T + have E₀ := htensor hu (E 0) (E 1).conjugate + have E₁ := htensor hu (E 2) (E 3).conjugate + exact (htensor hv E₀ E₁.conjugate).mono hcost + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3 + +def mixedSecondDifferenceHom (j : Fin 4) (i : Fin 2) : ((Fin 4 → ℤ) →+ ℤ) where + toFun x := mixedSecondDifferenceInput j x i + map_zero' := by fin_cases j <;> fin_cases i <;> rfl + map_add' x y := by + fin_cases i + · rfl + · change (x + y) 1 + ![0, (x + y) 2, (x + y) 3, (x + y) 2 + (x + y) 3] j = + (x 1 + ![0, x 2, x 3, x 2 + x 3] j) + (y 1 + ![0, y 2, y 3, y 2 + y 3] j) + fin_cases j <;> dsimp <;> ring + +noncomputable def mixedSecondDifferenceVector {I : Type*} (f : I → (Fin 2 → ℤ) → ℂ) + (a : (I × I) × (I × I)) (x : Fin 4 → ℤ) : ℂ := + (f a.1.1 (mixedSecondDifferenceInput 0 x) * star (f a.1.2 (mixedSecondDifferenceInput 1 x))) * + star (f a.2.1 (mixedSecondDifferenceInput 2 x) * star (f a.2.2 (mixedSecondDifferenceInput 3 x))) + +theorem NativeMultidegreeNilcharacter.mixedSecondDifferenceWithShift_zero {s : ℕ} {p : ℝ} + (M : NativeMultidegreeNilcharacter (mixedCorrelationDegree s) p) : + M.mixedSecondDifferenceWithShift 0 = mixedSecondDifferenceVector M.eval := by + have hzero : (![0, 0] : Fin 2 → ℤ) = 0 := by ext i; fin_cases i <;> rfl + funext a x + simp only [NativeMultidegreeNilcharacter.mixedSecondDifferenceWithShift, + mixedSecondDifferenceVector, Pi.zero_apply, hzero, add_zero] + +theorem NativeIntegerVectorEquivalence.exists_second_difference_budget : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {I J : Type*} [Fintype I] [Fintype J] {s : ℕ} {p : ℝ} + {f : I → (Fin 2 → ℤ) → ℂ} {g : J → (Fin 2 → ℤ) → ℂ}, + 0 ≤ p → NativeIntegerVectorEquivalence s p f g → + NativeIntegerVectorEquivalence s ((p + C) ^ C) + (mixedSecondDifferenceVector f) (mixedSecondDifferenceVector g) := by + obtain ⟨A, _, htensor⟩ := NativeIntegerVectorEquivalence.exists_tensor_budget + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (((X + Polynomial.C A) ^ A + Polynomial.C A) ^ A) + refine ⟨C, hC, ?_⟩ + intro I J _ _ s p f g hp E + let q := (p + A) ^ A + have hq : 0 ≤ q := by dsimp [q]; positivity + have H (j : Fin 4) : NativeIntegerVectorEquivalence s p + (fun i x => f i (mixedSecondDifferenceInput j x)) + (fun i x => g i (mixedSecondDifferenceInput j x)) := + E.linearPullbackHom (mixedSecondDifferenceHom j) + have H₀ := htensor hp (H 0) (H 1).conjugate + have H₁ := htensor hp (H 2) (H 3).conjugate + have hcost : (q + A) ^ A ≤ (p + C) ^ C := by + simpa [X, q, Polynomial.eval₂_pow] using hbudget p hp + exact (htensor hq H₀ H₁.conjugate).mono hcost + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SecondaryMeshGeometry.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SecondaryMeshGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..39074247c32bd7704b0cdc024ad68acdeacab610 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SecondaryMeshGeometry.lean @@ -0,0 +1,112 @@ +import OAI.Combinatorics.Progressions.Estimates.ResidualErrorAllocation + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def secondaryBoundaryMargin (boundary beta : ℝ) : ℝ := replacementAccuracy boundary beta + +noncomputable def secondaryMeshDelta (boundary movement beta : ℝ) : ℝ := + replacementAccuracy movement (secondaryBoundaryMargin boundary beta) + +theorem secondaryMeshAllocation_spec {boundary movement beta : ℝ} + (hboundary : 0 ≤ boundary) (hmovement : 0 ≤ movement) (hbeta : 0 < beta) : + 0 < secondaryBoundaryMargin boundary beta ∧ secondaryBoundaryMargin boundary beta ≤ 1 ∧ + boundary * secondaryBoundaryMargin boundary beta ≤ beta ∧ + 0 < secondaryMeshDelta boundary movement beta ∧ secondaryMeshDelta boundary movement beta ≤ 1 ∧ + secondaryMeshDelta boundary movement beta * movement ≤ secondaryBoundaryMargin boundary beta := by + have hm := replacementAccuracy_spec hboundary hbeta + have hd := replacementAccuracy_spec hmovement hm.1 + exact ⟨hm.1, hm.2.1, hm.2.2, hd.1, hd.2.1, (mul_comm _ _).trans_le hd.2.2⟩ + +theorem secondaryMeshAllocation_inverse_bounds {boundary movement beta P : ℝ} + (hboundary : 0 ≤ boundary) (hmovement : 0 ≤ movement) (hbeta : 0 < beta) (hP : 0 ≤ P) + (hboundaryP : boundary ≤ Real.exp P) (hmovementP : movement ≤ Real.exp P) + (hbetaP : beta⁻¹ ≤ Real.exp P) : + (secondaryBoundaryMargin boundary beta)⁻¹ ≤ Real.exp (2 * P + 2) ∧ + (secondaryMeshDelta boundary movement beta)⁻¹ ≤ Real.exp (4 * P + 6) := by + have hm := replacementAccuracy_inverse_le_exp hboundary hbeta hP hboundaryP hbetaP + refine ⟨hm, ?_⟩ + have hmargin := (replacementAccuracy_spec hboundary hbeta).1 + have hmovement' : movement ≤ Real.exp (2 * P + 2) := + hmovementP.trans (Real.exp_le_exp.mpr (by linarith)) + have hd := replacementAccuracy_inverse_le_exp hmovement hmargin (by linarith : 0 ≤ 2 * P + 2) + hmovement' hm + exact hd.trans_eq (by congr 1; ring) + +theorem secondaryMeshAllocation_size_bounds {boundary movement beta P H scale : ℝ} + (hboundary : 0 ≤ boundary) (hmovement : 0 ≤ movement) (hbeta : 0 < beta) (hP : 0 ≤ P) + (hboundaryP : boundary ≤ Real.exp P) (hmovementP : movement ≤ Real.exp P) + (hbetaP : beta⁻¹ ≤ Real.exp P) (hH : Real.exp (2 * P + 2) ≤ H) + (hscale : 4 * Real.exp (4 * P + 6) ≤ scale) : + 1 ≤ secondaryBoundaryMargin boundary beta * H ∧ + 4 ≤ secondaryMeshDelta boundary movement beta * scale := by + have hs := secondaryMeshAllocation_spec hboundary hmovement hbeta + have hi := secondaryMeshAllocation_inverse_bounds hboundary hmovement hbeta hP hboundaryP hmovementP hbetaP + constructor + · have h := mul_le_mul_of_nonneg_left (hi.1.trans hH) hs.1.le + simpa only [mul_inv_cancel₀ hs.1.ne'] using h + · have hdiv : 4 / secondaryMeshDelta boundary movement beta ≤ scale := by + calc + _ = 4 * (secondaryMeshDelta boundary movement beta)⁻¹ := div_eq_mul_inv _ _ + _ ≤ 4 * Real.exp (4 * P + 6) := mul_le_mul_of_nonneg_left hi.2 (by norm_num) + _ ≤ scale := hscale + simpa only [mul_comm] using (div_le_iff₀ hs.2.2.2.1).mp hdiv + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def secondaryMovementBudget (movement sourceRatio parameterRatio : ℝ) : ℝ := + movement + sourceRatio + parameterRatio + +theorem secondaryMesh_geometry {boundary movement sourceRatio parameterRatio beta : ℝ} + (hb : 0 ≤ boundary) (hm : 0 ≤ movement) (hs : 0 ≤ sourceRatio) (hp : 0 ≤ parameterRatio) + (hbeta : 0 < beta) : + let M := secondaryMovementBudget movement sourceRatio parameterRatio + let margin := secondaryBoundaryMargin boundary beta + let delta := secondaryMeshDelta boundary M beta + 0 < margin ∧ margin ≤ 1 ∧ boundary * margin ≤ beta ∧ + 0 < delta ∧ delta ≤ 1 ∧ delta * movement ≤ margin ∧ + delta * sourceRatio ≤ 1 ∧ delta * parameterRatio ≤ 1 := by + intro M margin delta + have hM : 0 ≤ M := by dsimp only [M, secondaryMovementBudget]; positivity + have h := secondaryMeshAllocation_spec hb hM hbeta + change 0 < margin ∧ margin ≤ 1 ∧ boundary * margin ≤ beta ∧ + 0 < delta ∧ delta ≤ 1 ∧ delta * M ≤ margin at h + have hmM : movement ≤ M := by dsimp only [M, secondaryMovementBudget]; linarith + have hsM : sourceRatio ≤ M := by dsimp only [M, secondaryMovementBudget]; linarith + have hpM : parameterRatio ≤ M := by dsimp only [M, secondaryMovementBudget]; linarith + exact ⟨h.1, h.2.1, h.2.2.1, h.2.2.2.1, h.2.2.2.2.1, + (mul_le_mul_of_nonneg_left hmM h.2.2.2.1.le).trans h.2.2.2.2.2, + ((mul_le_mul_of_nonneg_left hsM h.2.2.2.1.le).trans h.2.2.2.2.2).trans h.2.1, + ((mul_le_mul_of_nonneg_left hpM h.2.2.2.1.le).trans h.2.2.2.2.2).trans h.2.1⟩ + +theorem secondaryMovementBudget_le_exp {movement sourceRatio parameterRatio P : ℝ} + (hm : movement ≤ Real.exp P) (hs : sourceRatio ≤ Real.exp P) + (hp : parameterRatio ≤ Real.exp P) : + secondaryMovementBudget movement sourceRatio parameterRatio ≤ Real.exp (P + 3) := by + have hthree : (3 : ℝ) ≤ Real.exp 3 := by linarith [Real.add_one_le_exp (3 : ℝ)] + rw [Real.exp_add] + have h := mul_le_mul_of_nonneg_left hthree (Real.exp_nonneg P) + unfold secondaryMovementBudget + linarith + +theorem normalizedMesh_upper_of_ratio {delta scale ratio : ℝ} (N : ℕ) + (hdelta : 0 ≤ delta) (hbudget : delta * ratio ≤ 1) + (hscale : scale ≤ ratio * (N : ℝ)) : delta * scale ≤ 2 * (N : ℝ) := by + have h := mul_le_mul_of_nonneg_left hscale hdelta + have h' := mul_le_mul_of_nonneg_right hbudget (Nat.cast_nonneg N) + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedChildBound.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedChildBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..6601138bfd08d5a230293bf9bf4f7a83b2c4722d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedChildBound.lean @@ -0,0 +1,53 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteCellRefinement + +namespace OAI + +section + +namespace Erdos3.CellRefinement + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [DecidableEq G] + +theorem active_center_integral_le + (Z : Finset (G × G)) (L S : Finset G) (a f g : G → ℝ) (origin : G) + (shape : G × G → Finset G) (active : G × G → Bool) {T : ℝ} + (hf : ∀ r, 0 ≤ f r ∧ f r ≤ 1) (hg : ∀ r, 0 ≤ g r ∧ g r ≤ 1) + (hchild : ∀ z ∈ Z, active z = true → CellBilinearBound (shape z) a T) : + (𝔼 z ∈ Z, if active z = true then + centerChildIntegral L S (fun r => a (origin + r)) f g z (shape z) else 0) ≤ + T * (𝔼 z ∈ Z, if active z = true then centerChildPotential L S f g z (shape z) else 0) := by + calc + _ ≤ 𝔼 z ∈ Z, T * (if active z = true then centerChildPotential L S f g z (shape z) else 0) := by + apply Finset.expect_le_expect + intro z hz + by_cases ha : active z = true + · simpa only [ite_eq_left ha] using + centerChildIntegral_le_of_cellBilinearBound L S (shape z) a f g origin z (hchild z hz ha) hf hg + · simp only [ite_eq_right ha, mul_zero, le_refl] + _ = _ := (Finset.mul_expect _ _ T).symm + +theorem parent_bound_of_selected_children + (Z : Finset (G × G)) (L S : Finset G) (a f g : G → ℝ) (origin : G) + (shape : G × G → Finset G) (active : G × G → Bool) + {parent T rho Phi error : ℝ} (hT : 0 ≤ T) + (hf : ∀ r, 0 ≤ f r ∧ f r ≤ 1) (hg : ∀ r, 0 ≤ g r ∧ g r ≤ 1) + (hchild : ∀ z ∈ Z, active z = true → CellBilinearBound (shape z) a T) + (hpotential : (𝔼 z ∈ Z, if active z = true then centerChildPotential L S f g z (shape z) else 0) ≤ + rho * Phi) + (hparent : parent ≤ (𝔼 z ∈ Z, if active z = true then + centerChildIntegral L S (fun r => a (origin + r)) f g z (shape z) else 0) + error) : + parent ≤ T * rho * Phi + error := by + have hsum := active_center_integral_le Z L S a f g origin shape active hf hg hchild + calc + _ ≤ T * (𝔼 z ∈ Z, if active z = true then centerChildPotential L S f g z (shape z) else 0) + error := + hparent.trans (add_le_add hsum le_rfl) + _ ≤ T * (rho * Phi) + error := add_le_add (mul_le_mul_of_nonneg_left hpotential hT) le_rfl + _ = _ := by rw [mul_assoc] + +end Erdos3.CellRefinement + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedCoefficientEvaluation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedCoefficientEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3e0e2ef3ec4ae5e5715fc0a5a95134828891425 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedCoefficientEvaluation.lean @@ -0,0 +1,435 @@ +import Mathlib.Data.Matrix.ColumnRowPartitioned +import OAI.Combinatorics.Progressions.Estimates.SplitSmoothProductProfile +import OAI.Combinatorics.Progressions.Geometry.SpatialPivotNormalization +import OAI.Combinatorics.Progressions.Probability.PivotDensityCap + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +variable {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] + +noncomputable def splitFreeColumns (B : (J → ℝ) →L[ℝ] (I → ℝ)) + (C : (N → ℝ) →L[ℝ] (I → ℝ)) : (J ⊕ N → ℝ) →L[ℝ] (I → ℝ) := + B.comp (ContinuousLinearMap.pi fun j => ContinuousLinearMap.proj (.inl j)) + + C.comp (ContinuousLinearMap.pi fun n => ContinuousLinearMap.proj (.inr n)) + +omit [Fintype I] [Fintype J] [Fintype N] in +theorem splitFreeColumns_apply (B : (J → ℝ) →L[ℝ] (I → ℝ)) + (C : (N → ℝ) →L[ℝ] (I → ℝ)) (y : J ⊕ N → ℝ) : + splitFreeColumns B C y = B (fun j => y (.inl j)) + C (fun n => y (.inr n)) := rfl + +noncomputable def splitFreeProfile (f : (J → ℝ) × (I → ℝ) → ℝ) + (g : (N → ℝ) → ℝ) (p : (J ⊕ N → ℝ) × (I → ℝ)) : ℝ := + f ((fun j => p.1 (.inl j)), p.2) * g (fun n => p.1 (.inr n)) + +omit [Fintype I] [Fintype J] [Fintype N] in +theorem splitFreeProfile_continuous {f : (J → ℝ) × (I → ℝ) → ℝ} + {g : (N → ℝ) → ℝ} (hf : Continuous f) (hg : Continuous g) : + Continuous (splitFreeProfile f g) := by + unfold splitFreeProfile + fun_prop + +omit [Fintype I] [Fintype J] [Fintype N] in +theorem splitFreeProfile_nonneg {f : (J → ℝ) × (I → ℝ) → ℝ} + {g : (N → ℝ) → ℝ} (hf : ∀ p, 0 ≤ f p) (hg : ∀ n, 0 ≤ g n) (p) : + 0 ≤ splitFreeProfile f g p := mul_nonneg (hf _) (hg _) + +theorem splitFreeProfile_zero_outside {f : (J → ℝ) × (I → ℝ) → ℝ} + {g : (N → ℝ) → ℝ} {R S : ℝ} + (hf : ∀ p, R < ‖p‖ → f p = 0) (hg : ∀ n, S < ‖n‖ → g n = 0) + (p : (J ⊕ N → ℝ) × (I → ℝ)) (hp : max R S < ‖p‖) : + splitFreeProfile f g p = 0 := by + let y : J → ℝ := fun j => p.1 (.inl j) + let n : N → ℝ := fun n => p.1 (.inr n) + by_cases hy : R < ‖(y, p.2)‖ + · exact mul_eq_zero_of_left (hf _ hy) _ + · have hn : S < ‖n‖ := by + by_contra! hn + have hy' : ‖(y, p.2)‖ ≤ R := le_of_not_gt hy + have hnorm : ‖p‖ ≤ max R S := by + rw [Prod.norm_def] + apply max_le + · rw [← splitCoordinates_norm p.1, Prod.norm_def] + exact max_le ((norm_fst_le (y, p.2)).trans (hy'.trans (le_max_left _ _))) + (hn.trans (le_max_right _ _)) + · exact (norm_snd_le (y, p.2)).trans (hy'.trans (le_max_left _ _)) + exact (not_le_of_gt hp) hnorm + exact mul_eq_zero_of_right _ (hg _ hn) + +theorem splitFreeProfile_slice_integrable (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) (C : (N → ℝ) →L[ℝ] (I → ℝ)) + {f : (J → ℝ) × (I → ℝ) → ℝ} {g : (N → ℝ) → ℝ} + (hf : Continuous f) (hg : Continuous g) {R S : ℝ} + (hfs : ∀ p, R < ‖p‖ → f p = 0) (hgs : ∀ n, S < ‖n‖ → g n = 0) + (v : I → ℝ) : + Integrable (fun p : (J → ℝ) × (N → ℝ) => + f (p.1, A.symm (v - (B p.1 + C p.2))) * g p.2) := by + have hc : Continuous (fun p : (J → ℝ) × (N → ℝ) => + f (p.1, A.symm (v - (B p.1 + C p.2))) * g p.2) := by fun_prop + apply hc.integrable_of_hasCompactSupport + apply HasCompactSupport.of_support_subset_isCompact + (isCompact_closedBall (0 : (J → ℝ) × (N → ℝ)) (max R S)) + intro p hp + rw [Metric.mem_closedBall, dist_zero_right] + by_contra! h + apply hp + have heq : ‖Sum.elim p.1 p.2‖ = ‖p‖ := (splitCoordinates_norm (Sum.elim p.1 p.2)).symm + have hz := splitFreeProfile_zero_outside hfs hgs + (Sum.elim p.1 p.2, A.symm (v - (B p.1 + C p.2))) + (h.trans_le (heq ▸ norm_fst_le + (Sum.elim p.1 p.2, A.symm (v - (B p.1 + C p.2))))) + exact hz + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped Matrix + +variable {I J N : Type*} [Fintype I] [DecidableEq I] + [Fintype J] [DecidableEq J] [Fintype N] [DecidableEq N] + +theorem normalizedIntegerColumns_entry (B : Matrix I J ℤ) (T : J → ℝ) (P : I → ℝ) + (i : I) (j : J) : normalizedIntegerColumns B T P i j = (P i)⁻¹ * B i j * T j := by + simp [normalizedIntegerColumns, Matrix.diagonal_mul, Matrix.mul_diagonal] + +theorem normalizedIntegerColumns_fromCols (B : Matrix I J ℤ) (C : Matrix I N ℤ) + (T : J → ℝ) (Q : N → ℝ) (P : I → ℝ) : + normalizedIntegerColumns (Matrix.fromCols B C) (Sum.elim T Q) P = + Matrix.fromCols (normalizedIntegerColumns B T P) (normalizedIntegerColumns C Q P) := by + ext i k + cases k <;> simp [normalizedIntegerColumns_entry] + +omit [DecidableEq I] [DecidableEq J] [DecidableEq N] in +theorem matrixSupCLM_fromCols (B : Matrix I J ℝ) (C : Matrix I N ℝ) : + matrixSupCLM (Matrix.fromCols B C) = splitFreeColumns (matrixSupCLM B) (matrixSupCLM C) := by + apply ContinuousLinearMap.ext + intro y + rw [matrixSupCLM_apply, splitFreeColumns_apply, matrixSupCLM_apply, matrixSupCLM_apply] + exact Matrix.fromCols_mulVec B C y + +theorem normalizedIntegerColumns_split (B : Matrix I J ℤ) (C : Matrix I N ℤ) + (T : J → ℝ) (Q : N → ℝ) (P : I → ℝ) : + matrixSupCLM (normalizedIntegerColumns (Matrix.fromCols B C) (Sum.elim T Q) P) = + splitFreeColumns (matrixSupCLM (normalizedIntegerColumns B T P)) + (matrixSupCLM (normalizedIntegerColumns C Q P)) := by + rw [normalizedIntegerColumns_fromCols, matrixSupCLM_fromCols] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +variable {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] + +theorem splitFreeCoordinates_norm_le (p : (J ⊕ N → ℝ) × (I → ℝ)) : + ‖((fun j => p.1 (.inl j)), p.2)‖ ≤ ‖p‖ ∧ + ‖fun n => p.1 (.inr n)‖ ≤ ‖p‖ := by + have hleft : ‖fun j => p.1 (.inl j)‖ ≤ ‖p.1‖ := + (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr fun j => norm_le_pi_norm p.1 (.inl j) + have hright : ‖fun n => p.1 (.inr n)‖ ≤ ‖p.1‖ := + (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr fun n => norm_le_pi_norm p.1 (.inr n) + refine ⟨?_, hright.trans (norm_fst_le p)⟩ + rw [Prod.norm_def] + exact max_le (hleft.trans (norm_fst_le p)) (norm_snd_le p) + +theorem splitFreeProfile_lipschitz {f : (J → ℝ) × (I → ℝ) → ℝ} + {g : (N → ℝ) → ℝ} {Kf Kg Hf Hg : ℝ≥0} + (hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) + (hfcap : ∀ p, ‖f p‖ ≤ Hf) (hgcap : ∀ n, ‖g n‖ ≤ Hg) : + LipschitzWith (Hf * Kg + Hg * Kf) (splitFreeProfile f g) := by + let F := fun p : (J ⊕ N → ℝ) × (I → ℝ) => f ((fun j => p.1 (.inl j)), p.2) + let G := fun p : (J ⊕ N → ℝ) × (I → ℝ) => g (fun n => p.1 (.inr n)) + have hkernel : LipschitzWith 1 (fun p : (J ⊕ N → ℝ) × (I → ℝ) => + ((fun j => p.1 (.inl j)), p.2)) := by + apply LipschitzWith.of_dist_le_mul + intro p q + rw [NNReal.coe_one, one_mul, dist_eq_norm, dist_eq_norm] + exact (splitFreeCoordinates_norm_le (p - q)).1 + have hnonkernel : LipschitzWith 1 (fun p : (J ⊕ N → ℝ) × (I → ℝ) => + fun n => p.1 (.inr n)) := by + apply LipschitzWith.of_dist_le_mul + intro p q + rw [NNReal.coe_one, one_mul, dist_eq_norm, dist_eq_norm] + exact (splitFreeCoordinates_norm_le (p - q)).2 + have hF : LipschitzWith Kf F := by simpa only [mul_one, Function.comp_def] using hf.comp hkernel + have hG : LipschitzWith Kg G := by simpa only [mul_one, Function.comp_def] using hg.comp hnonkernel + apply LipschitzWith.of_dist_le_mul + intro p q + change dist (F p * G p) (F q * G q) ≤ _ + rw [dist_eq_norm] + have heq : F p * G p - F q * G q = F p * (G p - G q) + (F p - F q) * G q := by ring + rw [heq] + calc + _ ≤ ‖F p * (G p - G q)‖ + ‖(F p - F q) * G q‖ := norm_add_le _ _ + _ = ‖F p‖ * ‖G p - G q‖ + ‖F p - F q‖ * ‖G q‖ := by rw [norm_mul, norm_mul] + _ ≤ Hf * (Kg * dist p q) + (Kf * dist p q) * Hg := by + apply add_le_add + · exact mul_le_mul (hfcap _) (by simpa only [dist_eq_norm] using hG.dist_le_mul p q) + (norm_nonneg _) Hf.coe_nonneg + · exact mul_le_mul (by simpa only [dist_eq_norm] using hF.dist_le_mul p q) (hgcap _) + (norm_nonneg _) (mul_nonneg Kf.coe_nonneg dist_nonneg) + _ = _ := by push_cast; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem normalizedIntegerColumns_entry_div {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (A : Matrix I J ℤ) (T : J → ℝ) (P : I → ℝ) (i : I) (j : J) : + normalizedIntegerColumns A T P i j = (A i j : ℝ) * T j / P i := by + rw [normalizedIntegerColumns_entry] + simp only [div_eq_mul_inv] + ring + +theorem normalizedIntegerColumns_entry_bound {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (A : Matrix I J ℤ) (T : J → ℝ) {H C : ℝ} + (hH : 0 < H) (hT : ∀ j, 0 ≤ T j) (hA : ∀ i j, |(A i j : ℝ)| * T j ≤ C * H) : + ∀ i j, |normalizedIntegerColumns A T (fun _ => H) i j| ≤ C := by + intro i j + rw [normalizedIntegerColumns_entry_div, abs_div, abs_mul, abs_of_nonneg (hT j), abs_of_pos hH] + exact (div_le_iff₀ hH).mpr (hA i j) + +theorem normalizedIntegerColumns_norm_bound {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (A : Matrix I J ℤ) (T : J → ℝ) {H C : ℝ} + (hH : 0 < H) (hC : 0 ≤ C) (hT : ∀ j, 0 ≤ T j) + (hA : ∀ i j, |(A i j : ℝ)| * T j ≤ C * H) : + ‖matrixSupCLM (normalizedIntegerColumns A T (fun _ => H))‖ ≤ Fintype.card J * C := + matrixSupCLM_norm_le _ hC (normalizedIntegerColumns_entry_bound A T hH hT hA) + +theorem normalizedIntegerColumns_displacement {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (A : Matrix I J ℤ) (T : J → ℝ) {H C R : ℝ} + (hH : 0 < H) (hC : 0 ≤ C) (_hR : 0 ≤ R) (hT : ∀ j, 0 ≤ T j) + (hA : ∀ i j, |(A i j : ℝ)| * T j ≤ C * H) + (g : (J → ℝ) → ℝ) (hg : ∀ x, R < ‖x‖ → g x = 0) : + ∀ x, g x ≠ 0 → ‖matrixSupCLM (normalizedIntegerColumns A T (fun _ => H)) x‖ ≤ + Fintype.card J * C * R := by + intro x hx + have hnorm : ‖x‖ ≤ R := le_of_not_gt (fun h => hx (hg x h)) + exact (ContinuousLinearMap.le_opNorm _ x).trans + (mul_le_mul (normalizedIntegerColumns_norm_bound A T hH hC hT hA) hnorm + (norm_nonneg _) (mul_nonneg (Nat.cast_nonneg _) hC)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal ContDiff BigOperators + +noncomputable def smoothSplitProfile (J I : Type*) [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) : ℝ := + smoothProductProfile J p.1 * smoothProductProfile I p.2 + +theorem smoothSplitProfile_join (J I : Type*) [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) : + smoothSplitProfile J I p = smoothProductProfile (J ⊕ I) (Sum.elim p.1 p.2) := + (smoothProductProfile_sum J I p.1 p.2).symm + +theorem smoothSplitProfile_contDiff (J I : Type*) [Fintype J] [Fintype I] : + ContDiff ℝ ∞ (smoothSplitProfile J I) := + ((smoothProductProfile_contDiff J).comp contDiff_fst).mul + ((smoothProductProfile_contDiff I).comp contDiff_snd) + +theorem smoothSplitProfile_range (J I : Type*) [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) : + 0 ≤ smoothSplitProfile J I p ∧ smoothSplitProfile J I p ≤ 1 := by + rw [smoothSplitProfile_join] + exact smoothProductProfile_range _ _ + +theorem smoothSplitProfile_norm_le (J I : Type*) [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) : ‖smoothSplitProfile J I p‖ ≤ 1 := by + rw [smoothSplitProfile_join] + exact smoothProductProfile_norm_le _ _ + +theorem sumElim_norm {J I : Type*} [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) : ‖Sum.elim p.1 p.2‖ = ‖p‖ := + (splitCoordinates_norm (Sum.elim p.1 p.2)).symm + +theorem smoothSplitProfile_zero_outside (J I : Type*) [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) (hp : 1 < ‖p‖) : smoothSplitProfile J I p = 0 := by + rw [smoothSplitProfile_join] + exact smoothProductProfile_zero_outside _ _ (by rwa [sumElim_norm]) + +theorem smoothSplitProfile_integral (J I : Type*) [Fintype J] [Fintype I] : + (∫ p, smoothSplitProfile J I p) = 1 := by + change (∫ p : (J → ℝ) × (I → ℝ), smoothProductProfile J p.1 * smoothProductProfile I p.2 + ∂(volume.prod volume)) = 1 + rw [integral_prod_mul, smoothProductProfile_integral, smoothProductProfile_integral, one_mul] + +theorem smoothSplitProfile_lipschitz (J I : Type*) [Fintype J] [Fintype I] : + LipschitzWith ((Fintype.card J + Fintype.card I) * probabilityProfileLipschitz) + (smoothSplitProfile J I) := by + have hj : LipschitzWith 1 (fun p : (J → ℝ) × (I → ℝ) => Sum.elim p.1 p.2) := by + apply LipschitzWith.of_dist_le_mul + intro p q + rw [NNReal.coe_one, one_mul, dist_eq_norm, dist_eq_norm] + have he : Sum.elim p.1 p.2 - Sum.elim q.1 q.2 = Sum.elim (p-q).1 (p-q).2 := by + funext k + cases k <;> rfl + rw [he, sumElim_norm] + have h := (smoothProductProfile_lipschitz (J ⊕ I)).comp hj + simpa only [mul_one, Fintype.card_sum, Nat.cast_add, Function.comp_def, + ← smoothSplitProfile_join] using h + +theorem splitFreeProfile_smooth (J I N : Type*) [Fintype J] [Fintype I] [Fintype N] : + splitFreeProfile (smoothSplitProfile J I) (smoothProductProfile N) = + smoothSplitProfile (J ⊕ N) I := by + funext p + have h := smoothProductProfile_sum J N (fun j => p.1 (.inl j)) (fun n => p.1 (.inr n)) + have he : Sum.elim (fun j => p.1 (.inl j)) (fun n => p.1 (.inr n)) = p.1 := by + funext k + cases k <;> rfl + rw [he] at h + simp only [splitFreeProfile, smoothSplitProfile, h] + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +noncomputable def selectedFreeFirstEquiv {I J : Type*} [Fintype I] (s : I ↪ J) : + UnselectedColumn s ⊕ I ≃ J := + (Equiv.sumComm _ _).trans (selectedColumnEquiv s) + +noncomputable def selectedCoefficientEquiv {I J : Type*} [Fintype I] + (s : I ↪ J) (R : Type*) : (UnselectedColumn s → R) × (I → R) ≃ (J → R) := + (Equiv.sumPiEquivProdPi (fun _ : UnselectedColumn s ⊕ I => R)).symm.trans + (Equiv.arrowCongr (selectedFreeFirstEquiv s) (Equiv.refl R)) + +theorem selectedCoefficientEquiv_apply {I J R : Type*} [Fintype I] + (s : I ↪ J) (p : (UnselectedColumn s → R) × (I → R)) (j : J) : + selectedCoefficientEquiv s R p j = + Sum.elim p.1 p.2 ((selectedFreeFirstEquiv s).symm j) := rfl + +theorem selectedCoefficientEquiv_norm {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) (p : (UnselectedColumn s → ℝ) × (I → ℝ)) : + ‖selectedCoefficientEquiv s ℝ p‖ = ‖p‖ := by + change ‖(Sum.elim p.1 p.2) ∘ (selectedFreeFirstEquiv s).symm‖ = _ + exact ((selectedFreeFirstEquiv s).symm.surjective.pi_norm_comp (Sum.elim p.1 p.2)).trans + (sumElim_norm p) + +theorem selectedCoefficientEquiv_lipschitz {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) : LipschitzWith 1 (selectedCoefficientEquiv s ℝ) := by + apply LipschitzWith.of_dist_le_mul + intro p q + rw [NNReal.coe_one, one_mul, dist_eq_norm, dist_eq_norm] + have he : selectedCoefficientEquiv s ℝ p - selectedCoefficientEquiv s ℝ q = + selectedCoefficientEquiv s ℝ (p - q) := by + funext j + simp only [Pi.sub_apply, selectedCoefficientEquiv_apply] + cases (selectedFreeFirstEquiv s).symm j <;> rfl + rw [he, selectedCoefficientEquiv_norm] + +noncomputable def selectedCoefficientProfile {I J : Type*} [Fintype I] + (s : I ↪ J) (f : (J → ℝ) → ℝ) : (UnselectedColumn s → ℝ) × (I → ℝ) → ℝ := + f ∘ selectedCoefficientEquiv s ℝ + +theorem selectedCoefficientProfile_nonneg {I J : Type*} [Fintype I] + (s : I ↪ J) {f : (J → ℝ) → ℝ} (hf : ∀ x, 0 ≤ f x) : + ∀ p, 0 ≤ selectedCoefficientProfile s f p := fun p => hf (selectedCoefficientEquiv s ℝ p) + +theorem selectedCoefficientProfile_norm_le {I J : Type*} [Fintype I] + (s : I ↪ J) {f : (J → ℝ) → ℝ} {H : ℝ} (hf : ∀ x, ‖f x‖ ≤ H) : + ∀ p, ‖selectedCoefficientProfile s f p‖ ≤ H := fun p => hf (selectedCoefficientEquiv s ℝ p) + +theorem selectedCoefficientProfile_lipschitz {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) {f : (J → ℝ) → ℝ} {K : ℝ≥0} (hf : LipschitzWith K f) : + LipschitzWith K (selectedCoefficientProfile s f) := by + simpa only [mul_one, selectedCoefficientProfile] using hf.comp (selectedCoefficientEquiv_lipschitz s) + +theorem selectedCoefficientProfile_zero_outside {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) {f : (J → ℝ) → ℝ} {R : ℝ} + (hf : ∀ x, R < ‖x‖ → f x = 0) : + ∀ p, R < ‖p‖ → selectedCoefficientProfile s f p = 0 := by + intro p hp + exact hf _ (by rwa [selectedCoefficientEquiv_norm]) + +theorem selectedCoefficientProfile_integral {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) (f : (J → ℝ) → ℝ) : + (∫ p, selectedCoefficientProfile s f p) = ∫ x, f x := by + let e := selectedFreeFirstEquiv s + have hsum := (volume_measurePreserving_sumPiEquivProdPi_symm + (fun _ : UnselectedColumn s ⊕ I => ℝ)).integral_comp + (MeasurableEquiv.sumPiEquivProdPi (fun _ : UnselectedColumn s ⊕ I => ℝ)).symm.measurableEmbedding + (fun z => f (z ∘ e.symm)) + have hpi := (volume_measurePreserving_piCongrLeft (fun _ : J => ℝ) e).integral_comp + (MeasurableEquiv.piCongrLeft (fun _ : J => ℝ) e).measurableEmbedding f + apply hsum.trans + simpa only [MeasurableEquiv.coe_piCongrLeft, Equiv.piCongrLeft, Equiv.piCongrLeft', + Equiv.coe_fn_symm_mk, eq_rec_constant, Function.comp_def] using hpi + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {I J R : Type*} [Fintype I] (s : I ↪ J) + +theorem selectedCoefficientEquiv_on_selected + (p : (UnselectedColumn s → R) × (I → R)) (i : I) : + selectedCoefficientEquiv s R p (s i) = p.2 i := by + have h : selectedFreeFirstEquiv s (Sum.inr i) = s i := rfl + rw [← h, selectedCoefficientEquiv_apply, Equiv.symm_apply_apply] + rfl + +theorem selectedCoefficientEquiv_on_unselected + (p : (UnselectedColumn s → R) × (I → R)) (i : UnselectedColumn s) : + selectedCoefficientEquiv s R p i.val = p.1 i := by + have h : selectedFreeFirstEquiv s (Sum.inl i) = i.val := rfl + rw [← h, selectedCoefficientEquiv_apply, Equiv.symm_apply_apply] + rfl + +theorem selectedCoefficientEquiv_eq_of_coordinates + (f : J → R) (p : (UnselectedColumn s → R) × (I → R)) + (hfree : ∀ i : UnselectedColumn s, f i.val = p.1 i) + (hselected : ∀ i, f (s i) = p.2 i) : + f = selectedCoefficientEquiv s R p := by + classical + funext j + by_cases hj : j ∈ Set.range s + · obtain ⟨i, rfl⟩ := hj + exact (hselected i).trans (selectedCoefficientEquiv_on_selected s p i).symm + · exact (hfree ⟨j, hj⟩).trans (selectedCoefficientEquiv_on_unselected s p ⟨j, hj⟩).symm + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedImageCorrections.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedImageCorrections.lean new file mode 100644 index 0000000000000000000000000000000000000000..50901fbcac516a034ef554d3cad915e43dffec27 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedImageCorrections.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Linear.RationalTaggedSpanProjection + +namespace OAI + +section + +namespace Erdos3 + +open scoped Matrix NNReal + +theorem exists_selected_image_corrections + {η ι κ σ : Type*} [Fintype η] [Fintype ι] [Fintype κ] + (A : Matrix η κ ℚ) (ρ : ι → η) {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hA : ∀ i j, RationalHeightLE (A i j) H) + {p : ℝ} (hp : 0 ≤ p) (hη : (Fintype.card η : ℝ) ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) (hκ : (Fintype.card κ : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) : + ∃ (S : Matrix κ ι ℚ) (m : ℕ), 0 < m ∧ + (m : ℝ) ≤ Real.exp ((p + 2) ^ 3 + (p + 2) ^ 36) ∧ + ∀ (α : σ →₀ ℕ), α ≠ 0 → ∀ (a b : ι → ℝ) (x : η → ℝ), + x ∈ LinearMap.range (Matrix.mulVecLin (fun i j => (A i j : ℝ))) → + ‖a‖ ≤ Real.exp p / monomialScale T α → b ∈ realDenominatorGrid l → + (∀ i, x (ρ i) = a i + b i) → + let e := (fun i j => (A i j : ℝ)) *ᵥ ((fun i j => (S i j : ℝ)) *ᵥ a) + let q := (fun i j => (A i j : ℝ)) *ᵥ ((fun i j => (S i j : ℝ)) *ᵥ b) + e ∈ LinearMap.range (Matrix.mulVecLin (fun i j => (A i j : ℝ))) ∧ + q ∈ LinearMap.range (Matrix.mulVecLin (fun i j => (A i j : ℝ))) ∧ + (∀ i, e (ρ i) = a i) ∧ (∀ i, q (ρ i) = b i) ∧ + ‖e‖ ≤ Real.exp ((p + 2) ^ 3 + (p + 2) ^ 18 + p) / monomialScale T α ∧ + q ∈ realDenominatorGrid m ∧ + x - e - q ∈ LinearMap.range (Matrix.mulVecLin (fun i j => (A i j : ℝ))) ∧ + ∀ i, (x - e - q) (ρ i) = 0 := by + let C : Matrix ι κ ℚ := fun i j => A (ρ i) j + obtain ⟨S, m, hm, hmp, hsolve⟩ := exists_controlled_linear_splitting C hH hl + (fun i j => hA (ρ i) j) hp hι hκ hHp hlp T hT + have hHp' : (H : ℝ) ≤ Real.exp ((p + 2) ^ 1) := + hHp.trans (Real.exp_le_exp.mpr (by simp)) + have hden : (matrixDenominator A : ℝ) ≤ Real.exp ((p + 2) ^ 3) := + matrixDenominator_le_exp_power A hp 1 hη hκ + (fun i j => (Nat.cast_le.mpr (hA i j).2).trans hHp') + have hfac : ((Fintype.card κ : ℝ) + 1) * (H + 1) ≤ Real.exp ((p + 2) ^ 3) := by + apply le_trans _ (matrix_weighted_factor_le_exp_power (Fintype.card κ) hp hκ 1 (by decide)) + exact mul_le_mul_of_nonneg_left (add_le_add hHp' le_rfl) (by positivity) + have hnorm (y : κ → ℝ) : + ‖(fun i j => (A i j : ℝ)) *ᵥ y‖ ≤ Real.exp ((p + 2) ^ 3) * ‖y‖ := + (norm_matrix_mulVec_le _ (H : ℝ≥0) (fun i j => (hA i j).abs_real_le) y).trans + (mul_le_mul_of_nonneg_right hfac (norm_nonneg y)) + refine ⟨S, matrixDenominator A * m, Nat.mul_pos (matrixDenominator_pos A) hm, ?_, ?_⟩ + · rw [Nat.cast_mul] + exact (mul_le_mul hden hmp (Nat.cast_nonneg _) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + · intro α hα a b x hx ha hb hselect e q + obtain ⟨z, hz⟩ := hx + have hC : (fun i j => (C i j : ℝ)) *ᵥ z = a + b := by + funext i + exact (congrFun hz (ρ i)).trans (hselect i) + obtain ⟨hSa, hSb, hslow, hgrid, _⟩ := hsolve α hα a b z ha hb hC + have he : e ∈ LinearMap.range (Matrix.mulVecLin (fun i j => (A i j : ℝ))) := + ⟨(fun i j => (S i j : ℝ)) *ᵥ a, rfl⟩ + have hq : q ∈ LinearMap.range (Matrix.mulVecLin (fun i j => (A i j : ℝ))) := + ⟨(fun i j => (S i j : ℝ)) *ᵥ b, rfl⟩ + have heq (i : ι) : e (ρ i) = a i := congrFun hSa i + have hqq (i : ι) : q (ρ i) = b i := congrFun hSb i + refine ⟨he, hq, heq, hqq, ?_, real_matrix_denominator_grid A m _ hgrid, + Submodule.sub_mem _ (Submodule.sub_mem _ ⟨z, hz⟩ he) hq, ?_⟩ + · calc + ‖e‖ ≤ Real.exp ((p + 2) ^ 3) * ‖(fun i j => (S i j : ℝ)) *ᵥ a‖ := hnorm _ + _ ≤ Real.exp ((p + 2) ^ 3) * + (Real.exp ((p + 2) ^ 18 + p) / monomialScale T α) := + mul_le_mul_of_nonneg_left hslow (Real.exp_pos _).le + _ = _ := by + rw [← mul_div_assoc, ← Real.exp_add] + congr 2 + ring + · intro i + change x (ρ i) - e (ρ i) - q (ρ i) = 0 + rw [hselect i, heq i, hqq i] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointLifts.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointLifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..70de5f9e6e05f402eee9cff29a83784f90ce9558 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointLifts.lean @@ -0,0 +1,117 @@ +import OAI.Combinatorics.Progressions.Geometry.SelectedCenteredJointSupport +import OAI.Combinatorics.Progressions.Lattices.RoundedAffineLifts + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule + +variable {m : ℕ} {G V : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (R σ : Fin m → ℝ) (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (L₀ : ℕ) + +theorem translatedSelectedPhysicalDensity_lifts + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hsmall : ∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (p : ∀ j, VectorPolynomial V ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : V → ℕ) (j.val + 1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) + (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) (c : ∀ j, U j) + (hc : center = -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun s => c s.1)))) + (z : Option (LayerSamplerVariables G I n B) × V → ℤ) + (hz : translatedSelectedPhysicalDensity B U b hb o R σ hR hσ L₀ center p hm z ≠ 0) : + HasQuarterAffinePolynomialLifts p (fun j => (c j).val) (fun k v => (z (k,v) : ℝ)) + (layerSamplerBox B U b (selectedLayerSamplerScale B U b R σ hR hσ L₀)) := by + apply allocatedAffineDensity_quarter_lifts B U b hb o hR hσ + (selectedLayerSamplerScale B U b R σ hR hσ L₀) p hm c hσ1 C hC hchart hsmall hp + change selectedCoefficientDensity B U b hb o R σ hR hσ L₀ + (centeredAffineCoefficientTorus U p hm c (fun k v => (z (k,v) : ℝ))) ≠ 0 + rw [centeredAffineCoefficientTorus_eq_subtractive, ← hc] + exact hz + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (R σ : Fin m → ℝ) (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (L₀ : ℕ) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j d, coefficients (p j) d ∈ U j) + +noncomputable def jointSelectedPhysicalDensity + (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) (a : X → ℤ) : + (Option (LayerSamplerVariables G I n B) × X → ℤ) → ℝ := + translatedSelectedPhysicalDensity B U b hb o R σ hR hσ L₀ (coefficientConstantCenter U center) + (fun j => translate (fun i => (a i : ℝ)) (p j)) + (fun j => coefficients_translate_mem (U j) (fun i => (a i : ℝ)) (p j) (hm j)) + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + +omit [Fintype X] in +theorem jointSelectedPhysicalDensity_nonneg + (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) (a : X → ℤ) + (z : Option (LayerSamplerVariables G I n B) × X → ℤ) : + 0 ≤ jointSelectedPhysicalDensity B U b hb o R σ hR hσ L₀ p hm center a z := + translatedSelectedPhysicalDensity_nonneg B U b hb o R σ hR hσ L₀ _ _ _ _ + +theorem exists_selectedJointFiniteLaw_lifts + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hsmall : ∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (A : Finset (X → ℤ)) (hA : A.Nonempty) + (modulus : X → ℕ) (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X modulus)) + (W : Option (LayerSamplerVariables G I n B) × X → ℝ) (hW : ∀ z, 0 < W z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z) + (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) + (hD : 0 < selectedJointDensityMass A modulus T W + (jointSelectedPhysicalDensity B U b hb o R σ hR hσ L₀ p hm center)) : + ∃ c : ∀ j, U j, coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun s => c s.1))) ∧ + ∀ z : A × rectangularWeightIndices 0 W 1, + 0 < (selectedJointFiniteLaw A hA modulus T W hW hZ + (jointSelectedPhysicalDensity B U b hb o R σ hR hσ L₀ p hm center) + (jointSelectedPhysicalDensity_nonneg B U b hb o R σ hR hσ L₀ p hm center) hD).weight z → + HasQuarterAffinePolynomialLifts p (fun j => (c j).val) + (fun k i => (jointIntegerFrame (z.1.val,z.2.val) k i : ℝ)) + (layerSamplerBox B U b (selectedLayerSamplerScale B U b R σ hR hσ L₀)) := by + obtain ⟨c, hc⟩ := exists_subtractive_constant_center U center + refine ⟨c, hc, ?_⟩ + intro z hz + have hd := (selectedJointFiniteLaw_support A hA modulus T W hW hZ + (jointSelectedPhysicalDensity B U b hb o R σ hR hσ L₀ p hm center) + (jointSelectedPhysicalDensity_nonneg B U b hb o R σ hR hσ L₀ p hm center) hD z hz).2 + apply HasQuarterAffinePolynomialLifts.joint_frame z.1.val z.2.val + exact translatedSelectedPhysicalDensity_lifts B U b hb o R σ hR hσ L₀ hσ1 C hC hchart hsmall + (fun j => translate (fun i => (z.1.val i : ℝ)) (p j)) + (fun j => degreeLE_translate (1 : X → ℕ) (fun _ => by norm_num) _ (p j) (hp j)) + (fun j => coefficients_translate_mem (U j) (fun i => (z.1.val i : ℝ)) (p j) (hm j)) + (coefficientConstantCenter U center) c hc z.2.val hd.ne' + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointSiteDomination.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointSiteDomination.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cbf46e14288be868ce34897f4db89789f206e76 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointSiteDomination.lean @@ -0,0 +1,91 @@ +import OAI.Combinatorics.Progressions.Probability.PositiveDensityNormalization + +namespace OAI + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped BigOperators Classical + +theorem selectedJointFiniteLaw_site_excess + {K I X T : Type*} [Fintype K] [Fintype I] + [Fintype X] [Nonempty X] [Fintype T] [Nonempty T] + (A : Finset (I → ℤ)) (hA : A.Nonempty) + (modulus : I → ℕ) (cells : Finset (ColumnResiduePattern (Option K) I modulus)) + (W : Option K × I → ℝ) (hW : ∀ z, 0 < W z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus cells W z) + (D : (I → ℤ) → (Option K × I → ℤ) → ℝ) (hD : ∀ a z, 0 ≤ D a z) + (htotal : 0 < selectedJointDensityMass A modulus cells W D) + (hlower : 1 / 2 ≤ selectedJointDensityMass A modulus cells W D) + (e : X → I → ℝ) (he : Function.Injective e) + (root : T → K → ℤ) + (F : (A × rectangularWeightIndices 0 W 1) → T → X) + (hF : ∀ z t, e (F z t) = (fun i => (z.1.val i : ℝ)) + physicalAffineSite (root t) z.2.val) + (hcard : (Fintype.card X : ℝ) / A.card ≤ 2) + {M ε : ℝ} (hM : 0 ≤ M) + (hlocal : ∀ (a : I → ℤ) (t : T) (φ : (I → ℝ) → ℝ), + (∀ u, φ u ∈ Set.Icc (0 : ℝ) 1) → + (∑' z, (selectedResidueSmoothPMF modulus cells W hW hZ z).toReal * + (φ ((fun i => (a i : ℝ)) + physicalAffineSite (root t) z) * D a z)) ≤ + M * (∑' z, (selectedResidueSmoothPMF modulus cells W hW hZ z).toReal * + φ ((fun i => (a i : ℝ)) + physicalAffineSite (root t) z)) + ε) : + (FiniteProbabilityWeights.uniform X).excessMass + ((selectedJointFiniteLaw A hA modulus cells W hW hZ D hD htotal).siteLaw F) + (4 * M) ≤ 2 * ε := by + let : Nonempty A := hA.to_subtype + let q := selectedResidueFiniteLaw modulus cells W hW hZ + apply FiniteProbabilityWeights.siteLaw_excessMass_le_of_test_bound + intro φ hφ t + let ψ : (I → ℝ) → ℝ := fun u => φ (Function.invFun e u) + have hψ (u) : ψ u ∈ Set.Icc (0 : ℝ) 1 := hφ _ + have hvalue (z : A × rectangularWeightIndices 0 W 1) : + ψ ((fun i => (z.1.val i : ℝ)) + physicalAffineSite (root t) z.2.val) = φ (F z t) := by + rw [← hF z t] + exact congrArg φ (Function.leftInverse_invFun he (F z t)) + have hinj (z : rectangularWeightIndices 0 W 1) : + Function.Injective (fun a : A => F (a, z) t) := by + intro a b hab + have hc := congrArg e hab + rw [hF, hF] at hc + have hd := add_right_cancel hc + apply Subtype.ext + funext i + exact_mod_cast congrFun hd i + have hlocal' (a : A) : + q.mean (fun z => D a.val z.val * φ (F (a, z) t)) ≤ + M * q.mean (fun z => φ (F (a, z) t)) + ε := by + have h := hlocal a.val t ψ hψ + rw [← selectedResidueFiniteLaw_mean, ← selectedResidueFiniteLaw_mean] at h + have hv (z : rectangularWeightIndices 0 W 1) : + ψ ((fun i => (a.val i : ℝ)) + physicalAffineSite (root t) z.val) = φ (F (a, z) t) := + hvalue (a, z) + simpa only [hv, mul_comm] using h + have hz : 0 < ((FiniteProbabilityWeights.uniform A).prod q).mean + (fun z => D z.1.val z.2.val) := by + change 0 < (selectedJointReference A hA modulus cells W hW hZ).mean _ + rw [selectedJointReference_densityMass] + exact htotal + have hl : 1 / 2 ≤ ((FiniteProbabilityWeights.uniform A).prod q).mean + (fun z => D z.1.val z.2.val) := by + change 1 / 2 ≤ (selectedJointReference A hA modulus cells W hW hZ).mean _ + rw [selectedJointReference_densityMass] + exact hlower + have h := FiniteProbabilityWeights.uniform_base_reweight_test_le q + (fun z => D z.1.val z.2.val) (fun z => hD z.1.val z.2.val) hz + (fun z => F z t) hinj φ (fun x => (hφ x).1) hM (by norm_num : (0 : ℝ) < 1 / 2) + hl hlocal' + change (selectedJointFiniteLaw A hA modulus cells W hW hZ D hD htotal).mean + (fun z => φ (F z t)) ≤ _ at h + apply h.trans + have hn := (FiniteProbabilityWeights.uniform X).mean_nonneg (fun x => (hφ x).1) + have hr : (Fintype.card X : ℝ) / Fintype.card A ≤ 2 := by simpa using hcard + have hm := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hr hM) hn + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointWeightedReferenceComparison.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointWeightedReferenceComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..b33c94c9a3e6ed3bc3d3d32011c8e82568f203b1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedJointWeightedReferenceComparison.lean @@ -0,0 +1,91 @@ +import OAI.Combinatorics.Progressions.Probability.PositiveDensityNormalization + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem selectedJointFiniteLaw_weighted_reference_comparison + {B K I : Type*} [Fintype K] [Fintype I] + (A : Finset B) (hA : A.Nonempty) + (modulus : I → ℕ) (T : Finset (ColumnResiduePattern K I modulus)) + (V : K × I → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T V z) + (D : B → (K × I → ℤ) → ℝ) (hD0 : ∀ a z, 0 ≤ D a z) + (hD : 0 < selectedJointDensityMass A modulus T V D) + (f : B → (K × I → ℤ) → ℂ) (hf : ∀ a z, ‖f a z‖ ≤ 1) + {ε η : ℝ} + (hmass : ∀ a, |selectedResidueDensityMass modulus T V (D a) - 1| ≤ η) + (htest : ∀ a, + ‖(∑' z, ((selectedResidueSmoothPMF modulus T V hV hZ z).toReal : ℂ) * + (f a z * (D a z : ℂ))) - + ∑' z, ((selectedResidueSmoothPMF modulus T V hV hZ z).toReal : ℂ) * f a z‖ ≤ ε) : + ‖(selectedJointFiniteLaw A hA modulus T V hV hZ D hD0 hD).complexMean + (fun z => f z.1.val z.2.val) - + (selectedJointReference A hA modulus T V hV hZ).complexMean + (fun z => f z.1.val z.2.val)‖ ≤ η + ε := by + let p := FiniteProbabilityWeights.uniformFinset A hA + let q := selectedResidueFiniteLaw modulus T V hV hZ + let test (z : A × rectangularWeightIndices 0 V 1) := f z.1.val z.2.val + let density (z : A × rectangularWeightIndices 0 V 1) := D z.1.val z.2.val + have hraw := p.norm_complexMean_sub_le + (fun a => q.complexMean (fun z => (D a.val z.val : ℂ) * f a.val z.val)) + (fun a => q.complexMean (fun z => f a.val z.val)) (fun _ => ε) (by + intro a _ + change ‖(selectedResidueFiniteLaw modulus T V hV hZ).complexMean + (fun z => (D a.val z.val : ℂ) * f a.val z.val) - + (selectedResidueFiniteLaw modulus T V hV hZ).complexMean + (fun z => f a.val z.val)‖ ≤ ε + rw [selectedResidueFiniteLaw_complexMean modulus T V hV hZ + (fun z => (D a.val z : ℂ) * f a.val z), + selectedResidueFiniteLaw_complexMean modulus T V hV hZ (f a.val)] + simpa only [mul_comm (D a.val _ : ℂ)] using htest a.val) + rw [p.mean_const] at hraw + have hraw' : ‖(p.prod q).complexMean (fun z => (density z : ℂ) * test z) - + (p.prod q).complexMean test‖ ≤ ε := by + simpa only [FiniteProbabilityWeights.complexMean_prod, density, test] using hraw + have hglobal : 0 < (selectedJointReference A hA modulus T V hV hZ).mean density := by + rw [selectedJointReference_densityMass] + exact hD + have hnorm := (selectedJointReference A hA modulus T V hV hZ).normalizedDensityTest_remove_normalization + density (fun z => hD0 z.1.val z.2.val) hglobal test (fun z => hf z.1.val z.2.val) + rw [selectedJointReference_densityMass] at hnorm + have hnorm' := hnorm.trans (selectedJointDensityMass_close A hA modulus T V D hmass) + rw [selectedJointFiniteLaw_complexMean] + exact (norm_sub_le_norm_sub_add_norm_sub _ _ _).trans (add_le_add hnorm' hraw') + +theorem selectedJointFiniteLaw_weighted_reference_real_comparison + {B K I : Type*} [Fintype K] [Fintype I] + (A : Finset B) (hA : A.Nonempty) + (modulus : I → ℕ) (T : Finset (ColumnResiduePattern K I modulus)) + (V : K × I → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T V z) + (D : B → (K × I → ℤ) → ℝ) (hD0 : ∀ a z, 0 ≤ D a z) + (hD : 0 < selectedJointDensityMass A modulus T V D) + (f : B → (K × I → ℤ) → ℝ) (hf : ∀ a z, |f a z| ≤ 1) + {ε η : ℝ} + (hmass : ∀ a, |selectedResidueDensityMass modulus T V (D a) - 1| ≤ η) + (htest : ∀ a, + |(∑' z, (selectedResidueSmoothPMF modulus T V hV hZ z).toReal * (f a z * D a z)) - + ∑' z, (selectedResidueSmoothPMF modulus T V hV hZ z).toReal * f a z| ≤ ε) : + |(selectedJointFiniteLaw A hA modulus T V hV hZ D hD0 hD).mean + (fun z => f z.1.val z.2.val) - + (selectedJointReference A hA modulus T V hV hZ).mean + (fun z => f z.1.val z.2.val)| ≤ η + ε := by + have h := selectedJointFiniteLaw_weighted_reference_comparison A hA modulus T V hV hZ + D hD0 hD (fun a z => (f a z : ℂ)) + (fun a z => by simpa only [Complex.norm_real, Real.norm_eq_abs] using hf a z) + hmass (fun a => by + simpa only [← Complex.ofReal_mul, ← Complex.ofReal_tsum, ← Complex.ofReal_sub, + Complex.norm_real, Real.norm_eq_abs] using htest a) + simpa only [FiniteProbabilityWeights.complexMean_ofReal, ← Complex.ofReal_sub, + Complex.norm_real, Real.norm_eq_abs] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedOutputL1.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedOutputL1.lean new file mode 100644 index 0000000000000000000000000000000000000000..063425b6f1f9919035d52ff300afc2d4061f156d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedOutputL1.lean @@ -0,0 +1,107 @@ +import Mathlib.MeasureTheory.Integral.Prod +import OAI.Combinatorics.Progressions.Geometry.ContinuousOutputBox +import OAI.Combinatorics.Progressions.Probability.SelectedDensityNormalization + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +noncomputable def selectedOutputSlice {I J : Type*} [Fintype J] + (s : J ↪ I) (f : (I → ℝ) → ℝ) (x : UnselectedColumn s → ℝ) (y : J → ℝ) : ℝ := + f (selectedCoefficientEquiv s ℝ (x, y)) + +theorem selectedOutputSlice_lipschitz {I J : Type*} [Fintype I] [Fintype J] + (s : J ↪ I) {f : (I → ℝ) → ℝ} {K : ℝ≥0} (hf : LipschitzWith K f) + (x : UnselectedColumn s → ℝ) : LipschitzWith K (selectedOutputSlice s f x) := by + change LipschitzWith K (selectedCoefficientProfile s f ∘ Prod.mk x) + simpa only [mul_one] using + (selectedCoefficientProfile_lipschitz s hf).comp (LipschitzWith.prodMk_left x) + +theorem selectedOutputSlice_support_right {I J : Type*} [Fintype I] [Fintype J] + (s : J ↪ I) {f : (I → ℝ) → ℝ} {R : ℝ} (hf : ∀ v, R < ‖v‖ → f v = 0) + (x : UnselectedColumn s → ℝ) (y : J → ℝ) (hy : R < ‖y‖) : + selectedOutputSlice s f x y = 0 := by + apply hf + rw [selectedCoefficientEquiv_norm] + exact hy.trans_le (norm_snd_le (x, y)) + +theorem selectedOutputSlice_support_left {I J : Type*} [Fintype I] [Fintype J] + (s : J ↪ I) {f : (I → ℝ) → ℝ} {R : ℝ} (hf : ∀ v, R < ‖v‖ → f v = 0) + (x : UnselectedColumn s → ℝ) (y : J → ℝ) (hx : R < ‖x‖) : + selectedOutputSlice s f x y = 0 := by + apply hf + rw [selectedCoefficientEquiv_norm] + exact hx.trans_le (norm_fst_le (x, y)) + +noncomputable def retainedSelectedOutputEquiv {W I J : Type*} [MeasurableSpace W] + [Fintype I] [Fintype J] (s : J ↪ I) : + (W × (UnselectedColumn s → ℝ)) × (J → ℝ) ≃ᵐ W × (I → ℝ) := + MeasurableEquiv.prodAssoc.trans ((MeasurableEquiv.refl W).prodCongr (selectedCoefficientMeasurableEquiv s)) + +theorem retainedSelectedOutputEquiv_preserving {W I J : Type*} [MeasurableSpace W] + [Fintype I] [Fintype J] (s : J ↪ I) (μ : Measure W) [SFinite μ] : + MeasurePreserving (retainedSelectedOutputEquiv (W := W) s) + ((μ.prod volume).prod volume) (μ.prod volume) := + ((MeasurePreserving.id μ).prod (selectedCoefficientMeasurableEquiv_preserving s)).comp + (measurePreserving_prodAssoc μ volume volume) + +theorem retainedSelectedOutput_integrable {W I J : Type*} [MeasurableSpace W] + [Fintype I] [Fintype J] (s : J ↪ I) (μ : Measure W) [SFinite μ] + {f : W × (I → ℝ) → ℝ} (hf : Integrable f (μ.prod volume)) : + Integrable (fun p : (W × (UnselectedColumn s → ℝ)) × (J → ℝ) => + f (p.1.1, selectedCoefficientEquiv s ℝ (p.1.2, p.2))) ((μ.prod volume).prod volume) := + (retainedSelectedOutputEquiv_preserving s μ).integrable_comp_of_integrable hf + +theorem retainedSelectedOutput_integral {W I J : Type*} [MeasurableSpace W] + [Fintype I] [Fintype J] (s : J ↪ I) (μ : Measure W) [SFinite μ] (f : W × (I → ℝ) → ℝ) : + (∫ p : (W × (UnselectedColumn s → ℝ)) × (J → ℝ), + f (p.1.1, selectedCoefficientEquiv s ℝ (p.1.2, p.2)) ∂(μ.prod volume).prod volume) = + ∫ p, f p ∂μ.prod volume := + (retainedSelectedOutputEquiv_preserving s μ).integral_comp + (retainedSelectedOutputEquiv (W := W) s).measurableEmbedding f + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +theorem selectedOutput_restricted_l1 {W I J : Type*} [MeasurableSpace W] + [Fintype I] [Fintype J] (s : J ↪ I) (μ : Measure W) [SFinite μ] + (R : ℝ≥0) (f : W × (I → ℝ) → ℝ) (hf : Integrable f (μ.prod volume)) + {ε : ℝ} (he : (∫ p, |f p| ∂μ.prod volume) ≤ ε) : + let ν := μ.prod (continuousOutputBoxMeasure (UnselectedColumn s) R) + let F := fun p : (W × (UnselectedColumn s → ℝ)) × (J → ℝ) => + f (p.1.1, selectedCoefficientEquiv s ℝ (p.1.2, p.2)) + Integrable F (ν.prod volume) ∧ (∫ p, |F p| ∂ν.prod volume) ≤ ε := by + dsimp only + have hi := retainedSelectedOutput_integrable s μ hf + have hle : (μ.prod (continuousOutputBoxMeasure (UnselectedColumn s) R)).prod volume ≤ + (μ.prod (volume : Measure (UnselectedColumn s → ℝ))).prod (volume : Measure (J → ℝ)) := + Measure.prod_mono (Measure.prod_mono le_rfl (continuousOutputBoxMeasure_le _ R)) le_rfl + refine ⟨hi.mono_measure hle, ?_⟩ + have ha : Integrable (fun p : (W × (UnselectedColumn s → ℝ)) × (J → ℝ) => + |f (p.1.1, selectedCoefficientEquiv s ℝ (p.1.2, p.2))|) ((μ.prod volume).prod volume) := by + simpa only [Real.norm_eq_abs] using hi.norm + calc + _ ≤ ∫ p : (W × (UnselectedColumn s → ℝ)) × (J → ℝ), + |f (p.1.1, selectedCoefficientEquiv s ℝ (p.1.2, p.2))| ∂(μ.prod volume).prod volume := + integral_mono_measure hle (Filter.Eventually.of_forall (fun _ => abs_nonneg _)) ha + _ = ∫ p, |f p| ∂μ.prod volume := retainedSelectedOutput_integral s μ (fun p => |f p|) + _ ≤ ε := he + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedPhysicalReferenceCap.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedPhysicalReferenceCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b6d336d45852b1f7393773ec9353b8543a84786 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedPhysicalReferenceCap.lean @@ -0,0 +1,75 @@ +import OAI.Combinatorics.Progressions.Lattices.ResiduePhysicalCap + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators Classical + +variable {K I : Type*} [Fintype K] [Fintype I] +variable (root : K → ℤ) (modulus : I → ℕ) (hmodulus : ∀ i, 0 < modulus i) +variable (T : Finset (ColumnResiduePattern (Option K) I modulus)) (hT : T.Nonempty) +variable (W : Option K × I → ℝ) (hW : ∀ z, 0 < W z) +variable (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z) +variable (hc : ∀ r : T, 0 < shiftedSmoothProductMass + (residueProfileCenter (columnResidueRepresentative modulus r.val) modulus) (residueProfileWidth modulus W)) +variable (hbase : ∀ i, 8*(probabilityProfileLipschitz : ℝ) ≤ residueProfileWidth modulus W (none,i)) + +include hmodulus hT hc hbase in +theorem selectedResidueSmoothPMF_physical_cap (y : I → ℝ) : + ((selectedResidueSmoothPMF modulus T W hW hZ).map (physicalAffineSite root) y).toReal ≤ + ∏ i, 2*(modulus i : ℝ)/W (none,i) := by + obtain ⟨_, h⟩ := selectedResidueSmoothPMF_bound_of_cells (ε := ∏ i, 2*(modulus i : ℝ)/W (none,i)) + modulus hmodulus T hT W hW hc + (fun z => if physicalAffineSite root z = y then (1 : ℂ) else 0) + (by + intro r + exact (pmf_point_indicator_norm _ (physicalAffineSite root) y).trans_le + (residueSmoothPMF_physical_cap root (columnResidueRepresentative modulus r.val) + modulus hmodulus W hW (hc r) hbase y)) + exact (pmf_point_indicator_norm _ (physicalAffineSite root) y).symm.trans_le h + +include hmodulus hT hc hbase in +theorem selectedResidueSmoothPMF_physical_finite_event (E : Finset (I → ℝ)) : + (∑ y ∈ E, ((selectedResidueSmoothPMF modulus T W hW hZ).map (physicalAffineSite root) y).toReal) ≤ + (E.card : ℝ) * ∏ i, 2*(modulus i : ℝ)/W (none,i) := by + calc + _ ≤ ∑ _y ∈ E, ∏ i, 2*(modulus i : ℝ)/W (none,i) := + Finset.sum_le_sum (fun y _ => selectedResidueSmoothPMF_physical_cap + root modulus hmodulus T hT W hW hZ hc hbase y) + _ = _ := by simp + +end Erdos3.BooleanCubeKernel + +namespace Erdos3 + +open scoped BigOperators + +theorem spatialBaseCap_volume_bound {I : Type*} [Fintype I] + (modulus : I → ℕ) (W H : I → ℝ) (hW : ∀ i, 0 < W i) (hH : ∀ i, 0 ≤ H i) + {S ρ : ℝ} (hρ : 0 < ρ) (hS : 0 ≤ S) (hmodulus : ∀ i, (modulus i : ℝ) ≤ S) + (hwidth : ∀ i, ρ*H i ≤ W i) : + (∏ i, H i) * (∏ i, 2*(modulus i : ℝ)/W i) ≤ (2*S/ρ)^Fintype.card I := by + have hi (i : I) : H i * (2*(modulus i : ℝ)/W i) ≤ 2*S/ρ := by + have hr : H i / W i ≤ 1/ρ := + (div_le_div_iff₀ (hW i) hρ).mpr (by simpa only [one_mul, mul_one, mul_comm] using hwidth i) + calc + _ = 2*(modulus i : ℝ)*(H i/W i) := by ring + _ ≤ 2*S*(1/ρ) := + mul_le_mul (mul_le_mul_of_nonneg_left (hmodulus i) (by norm_num)) hr + (div_nonneg (hH i) (hW i).le) (mul_nonneg (by norm_num) hS) + _ = _ := by ring + rw [← Finset.prod_mul_distrib] + calc + _ ≤ ∏ _i : I, 2*S/ρ := Finset.prod_le_prod₀ + (fun i _ => mul_nonneg (hH i) + (div_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) (hW i).le)) (fun i _ => hi i) + _ = _ := by rw [Finset.prod_const, Finset.card_univ] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedProductEnvelope.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedProductEnvelope.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cd0eaa6c632b5a0294ebec4adf47400e0b25569 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedProductEnvelope.lean @@ -0,0 +1,34 @@ +import Mathlib.Algebra.BigOperators.Field +import Mathlib.Data.Fintype.Card +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem selected_nonnegative_product_le {A D : Type*} [Fintype A] [Fintype D] + (f : D → ℝ) (hf : ∀ d, 0 ≤ f d) (selected : A → D) + (hselected : Function.Injective selected) : + (∏ a, f (selected a)) ≤ (1 + ∑ d, f d) ^ Fintype.card D := by + let C := 1 + ∑ d, f d + have hs : 0 ≤ ∑ d, f d := Finset.sum_nonneg (fun d _ => hf d) + have hC : 1 ≤ C := by dsimp only [C]; linarith + have hbound (a : A) : f (selected a) ≤ C := by + have h := Finset.single_le_sum (fun d _ => hf d) (Finset.mem_univ (selected a)) + dsimp only [C] + linarith + calc + _ ≤ ∏ _a : A, C := Finset.prod_le_prod₀ (fun index _ => hf (selected index)) + (fun index _ => hbound index) + _ = C ^ Fintype.card A := by simp only [Finset.prod_const, Finset.card_univ] + _ ≤ C ^ Fintype.card D := pow_le_pow_right₀ hC (Fintype.card_le_of_injective selected hselected) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedProfileTranslationL1.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedProfileTranslationL1.lean new file mode 100644 index 0000000000000000000000000000000000000000..95dca0cecdb29800dfa48160e3e1f3bcb27d7105 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedProfileTranslationL1.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Lattices.AffineProfileTranslationL1 + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +theorem selectedCoefficientProfile_translation_l1 {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) (f : (J → ℝ) → ℝ) {D : ℝ} (hD : 0 ≤ D) + (hm : ∀ a b, (∫ x, |f (x + a) - f (x + b)|) ≤ D * dist a b) + (a b : (UnselectedColumn s → ℝ) × (I → ℝ)) : + (∫ p, |selectedCoefficientProfile s f (p + a) - selectedCoefficientProfile s f (p + b)|) ≤ + D * dist a b := by + have hadd (u v : (UnselectedColumn s → ℝ) × (I → ℝ)) : + selectedCoefficientEquiv s ℝ (u + v) = + selectedCoefficientEquiv s ℝ u + selectedCoefficientEquiv s ℝ v := by + funext j + simp only [selectedCoefficientEquiv_apply, Pi.add_apply] + cases (selectedFreeFirstEquiv s).symm j <;> rfl + have he : (fun p => |selectedCoefficientProfile s f (p + a) - + selectedCoefficientProfile s f (p + b)|) = selectedCoefficientProfile s + (fun x => |f (x + selectedCoefficientEquiv s ℝ a) - f (x + selectedCoefficientEquiv s ℝ b)|) := by + funext p + simp only [selectedCoefficientProfile, Function.comp_apply, hadd] + rw [he, selectedCoefficientProfile_integral] + apply (hm _ _).trans + apply mul_le_mul_of_nonneg_left _ hD + simpa only [NNReal.coe_one, one_mul] using (selectedCoefficientEquiv_lipschitz s).dist_le_mul a b + +theorem affineSelectedPivot_translation_l1 {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (UnselectedColumn s → ℝ) →L[ℝ] (I → ℝ)) + (c w : J → ℝ) {δ : ℝ} (hδ : 0 < δ) (hw : ∀ j, δ ≤ w j) (a b : I → ℝ) : + (∫ v, |pivotOutputDensity A B (selectedCoefficientProfile s (affineProductProfile c w)) (v + a) - + pivotOutputDensity A B (selectedCoefficientProfile s (affineProductProfile c w)) (v + b)|) ≤ + ((Fintype.card J * (4 * (probabilityProfileLipschitz : ℝ) / δ)) * + ‖A.symm.toContinuousLinearMap‖) * dist a b := by + have hi := selectedCoefficientProfile_integrable s + (affineProductProfile_integrable c w (fun j => hδ.trans_le (hw j))) + apply (pivotOutputDensity_translation_l1 A B _ hi a b).trans + have he := selectedCoefficientProfile_translation_l1 s (affineProductProfile c w) + (D := Fintype.card J * (4 * (probabilityProfileLipschitz : ℝ) / δ)) + (by positivity) (affineProductProfile_translation_l1 c w hδ hw) + (0, A.symm a) (0, A.symm b) + apply he.trans + have hd : dist (A.symm a) (A.symm b) ≤ ‖A.symm.toContinuousLinearMap‖ * dist a b := by + rw [dist_eq_norm, ← map_sub, dist_eq_norm] + exact A.symm.toContinuousLinearMap.le_opNorm _ + simp only [Prod.dist_eq, dist_self, max_eq_right dist_nonneg] + exact (mul_le_mul_of_nonneg_left hd (by positivity)).trans_eq (by ring) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedSingletonSmoothTestQuadrature.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedSingletonSmoothTestQuadrature.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a70117ffa2b7588361d9bfded1e27c93f692601 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedSingletonSmoothTestQuadrature.lean @@ -0,0 +1,235 @@ +import OAI.Combinatorics.Progressions.Probability.SelectedSingletonSmoothIndexLaw + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal + +theorem normalizedRealQuadrature_error {A M T E F : ℝ} + (hM : 1 / 2 ≤ M) (hA : |A - T| ≤ E) (hm : |M - 1| ≤ F) + (hT : |T| ≤ 1) : |A / M - T| ≤ 2 * (E + F) := by + have hMp : 0 < M := by linarith + have hF : 0 ≤ F := (abs_nonneg _).trans hm + have hE : 0 ≤ E := (abs_nonneg _).trans hA + have he : A / M - T = ((A - T) + T * (1 - M)) / M := by + field_simp + ring + rw [he, abs_div, abs_of_pos hMp] + apply (div_le_iff₀ hMp).mpr + calc + _ ≤ |A - T| + |T| * |1 - M| := by + simpa only [abs_mul] using abs_add_le (A - T) (T * (1 - M)) + _ ≤ E + F := by + rw [abs_sub_comm (1 : ℝ) M] + exact add_le_add hA ((mul_le_mul hT hm (abs_nonneg _) zero_le_one).trans_eq (one_mul F)) + _ ≤ 2 * (E + F) * M := by nlinarith + +theorem shiftedSmoothProductMass_pos_of_mesh {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) : + 0 < shiftedSmoothProductMass a S := + (div_pos (Finset.prod_pos (fun i _ => hS i)) (by norm_num)).trans_le + (shiftedSmoothProductMass_lower a S hS hδ hδ1 hmesh hsmall) + +theorem smoothProductProfile_test_lipschitz {I : Type*} [Fintype I] + (φ : (I → ℝ) → ℝ) {L : ℝ≥0} (hLip : LipschitzWith L φ) + (hφ : ∀ x, ‖φ x‖ ≤ 1) : + LipschitzWith (L + Fintype.card I * probabilityProfileLipschitz) + (fun x => smoothProductProfile I x * φ x) := by + simpa only [one_mul] using lipschitz_real_mul_of_bounds + (smoothProductProfile I) φ (Bf := 1) (Bg := 1) + (smoothProductProfile_lipschitz I) hLip + (fun x => smoothProductProfile_norm_le I x) hφ + +theorem smoothProductProfile_real_test_integral_norm_le {I : Type*} [Fintype I] + (φ : (I → ℝ) → ℝ) (hφ : ∀ x, ‖φ x‖ ≤ 1) : + ‖∫ x, smoothProductProfile I x * φ x‖ ≤ 1 := by + have hi : Integrable (smoothProductProfile I) := + (smoothProductProfile_contDiff I).continuous.integrable_of_hasCompactSupport + (smoothProductProfile_compact I) + rw [← smoothProductProfile_integral I] + apply norm_integral_le_of_norm_le hi + filter_upwards [] with x + rw [norm_mul, Real.norm_of_nonneg (smoothProductProfile_range I x).1] + exact mul_le_of_le_one_right (smoothProductProfile_range I x).1 (hφ x) + +theorem shiftedSmoothProductPMF_test_quadrature {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : (I → ℝ) → ℝ) {L : ℝ≥0} (hLip : LipschitzWith L φ) + (hφ : ∀ x, ‖φ x‖ ≤ 1) : + |(∑' k, (shiftedSmoothProductPMF a S hS hZ k).toReal * + φ (rectangularLatticePoint a S k)) - + ∫ x, smoothProductProfile I x * φ x| ≤ + 2 * (4 : ℝ) ^ Fintype.card I * + ((L : ℝ) + 2 * ((Fintype.card I : ℝ) * probabilityProfileLipschitz)) * δ := by + let f := fun x => smoothProductProfile I x * φ x + have hsupp (x : I → ℝ) (hx : 1 < ‖x‖) : f x = 0 := by + simp only [f, smoothProductProfile_zero_outside I x hx, zero_mul] + have he := rectangularLattice_quadrature f + (smoothProductProfile_test_lipschitz φ hLip hφ) a S hS + zero_le_one hδ hδ1 hmesh hsupp + have hm := rectangularLattice_quadrature (smoothProductProfile I) + (smoothProductProfile_lipschitz I) a S hS + zero_le_one hδ hδ1 hmesh (smoothProductProfile_zero_outside I) + simp only [NNReal.coe_add, NNReal.coe_mul, NNReal.coe_natCast, + show 2 * (1 : ℝ) + 2 = 4 by norm_num] at he hm + rw [smoothProductProfile_integral I] at hm + change |shiftedSmoothProductMass a S / (∏ i, S i) - 1| ≤ _ at hm + have hp : 0 < ∏ i, S i := Finset.prod_pos (fun i _ => hS i) + have hlo : 1 / 2 ≤ shiftedSmoothProductMass a S / (∏ i, S i) := by + apply (le_div_iff₀ hp).mpr + simpa only [div_eq_mul_inv, one_mul, mul_comm] using + shiftedSmoothProductMass_lower a S hS hδ hδ1 hmesh hsmall + have hn := normalizedRealQuadrature_error hlo he hm + (smoothProductProfile_real_test_integral_norm_le φ hφ) + have heq : (∑' k, (shiftedSmoothProductPMF a S hS hZ k).toReal * + φ (rectangularLatticePoint a S k)) = + ((∑' k, f (rectangularLatticePoint a S k)) / (∏ i, S i)) / + (shiftedSmoothProductMass a S / (∏ i, S i)) := by + simp only [shiftedSmoothProductPMF_toReal, rectangularWeight, div_mul_eq_mul_div, + ← tsum_div_const] + dsimp only [f] + field_simp + rw [heq] + exact hn.trans_eq (by ring) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal + +variable {I : Type*} [Fintype I] + +theorem smoothProductProfile_complex_test_integrable + (φ : (I → ℝ) → ℂ) (hφ : Continuous φ) : + Integrable (fun x => (smoothProductProfile I x : ℂ) * φ x) := by + apply ((Complex.continuous_ofReal.comp + (smoothProductProfile_contDiff I).continuous).mul hφ).integrable_of_hasCompactSupport + apply HasCompactSupport.of_support_subset_isCompact + (isCompact_closedBall (0 : I → ℝ) 1) + intro x hx + rw [Metric.mem_closedBall, dist_zero_right] + by_contra! hn + apply hx + change (smoothProductProfile I x : ℂ) * φ x = 0 + simp only [smoothProductProfile_zero_outside I x hn, Complex.ofReal_zero, zero_mul] + +theorem shiftedSmoothProductPMF_complex_test_quadrature + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : (I → ℝ) → ℂ) {L : ℝ≥0} (hLip : LipschitzWith L φ) + (hφ : ∀ x, ‖φ x‖ ≤ 1) : + ‖(∑' k, ((shiftedSmoothProductPMF a S hS hZ k).toReal : ℂ) * + φ (rectangularLatticePoint a S k)) - + ∫ x, (smoothProductProfile I x : ℂ) * φ x‖ ≤ + 4 * (4 : ℝ) ^ Fintype.card I * + ((L : ℝ) + 2 * ((Fintype.card I : ℝ) * probabilityProfileLipschitz)) * δ := by + have hreLip : LipschitzWith L (fun x => (φ x).re) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Real.dist_eq, ← Complex.sub_re] + exact (Complex.abs_re_le_norm _).trans + (by simpa only [dist_eq_norm] using hLip.dist_le_mul x y) + have himLip : LipschitzWith L (fun x => (φ x).im) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Real.dist_eq, ← Complex.sub_im] + exact (Complex.abs_im_le_norm _).trans + (by simpa only [dist_eq_norm] using hLip.dist_le_mul x y) + have hre := shiftedSmoothProductPMF_test_quadrature a S hS hZ hδ hδ1 hmesh hsmall + (fun x => (φ x).re) hreLip + (fun x => by simpa only [Real.norm_eq_abs] using + (Complex.abs_re_le_norm (φ x)).trans (hφ x)) + have him := shiftedSmoothProductPMF_test_quadrature a S hS hZ hδ hδ1 hmesh hsmall + (fun x => (φ x).im) himLip + (fun x => by simpa only [Real.norm_eq_abs] using + (Complex.abs_im_le_norm (φ x)).trans (hφ x)) + have hs : Summable (fun k => ((shiftedSmoothProductPMF a S hS hZ k).toReal : ℂ) * + φ (rectangularLatticePoint a S k)) := + finite_weighted_test_summable _ (rectangularWeightIndices a S 1) + (shiftedSmoothProductPMF_toReal_zero_off a S hS hZ) _ + have hi := smoothProductProfile_complex_test_integrable φ hLip.continuous + have hire : (∫ x, (smoothProductProfile I x : ℂ) * φ x).re = + ∫ x, smoothProductProfile I x * (φ x).re := by + simpa only [RCLike.re_eq_complex_re, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] using (integral_re hi).symm + have hiim : (∫ x, (smoothProductProfile I x : ℂ) * φ x).im = + ∫ x, smoothProductProfile I x * (φ x).im := by + simpa only [RCLike.im_eq_complex_im, Complex.mul_im, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, add_zero] using (integral_im hi).symm + let C := 2 * (4 : ℝ) ^ Fintype.card I * + ((L : ℝ) + 2 * ((Fintype.card I : ℝ) * probabilityProfileLipschitz)) * δ + calc + _ ≤ |((∑' k, ((shiftedSmoothProductPMF a S hS hZ k).toReal : ℂ) * + φ (rectangularLatticePoint a S k)) - + ∫ x, (smoothProductProfile I x : ℂ) * φ x).re| + + |((∑' k, ((shiftedSmoothProductPMF a S hS hZ k).toReal : ℂ) * + φ (rectangularLatticePoint a S k)) - + ∫ x, (smoothProductProfile I x : ℂ) * φ x).im| := + Complex.norm_le_abs_re_add_abs_im _ + _ ≤ C + C := by + apply add_le_add + · simpa only [Complex.sub_re, Complex.re_tsum hs, hire, Complex.mul_re, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] using hre + · simpa only [Complex.sub_im, Complex.im_tsum hs, hiim, Complex.mul_im, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, add_zero] using him + _ = _ := by dsimp only [C]; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal Classical + +variable {K X : Type*} [Fintype K] [Fintype X] + +theorem selectedResidueSmoothPMF_singleton_complex_quadrature + (modulus : X → ℕ) (hmodulus : ∀ x, 0 < modulus x) + (r : ColumnResiduePattern K X modulus) (V : K × X → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus {r} V z) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (hmesh : ∀ z, (modulus z.2 : ℝ) / V z ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card (K × X) * + ((Fintype.card (K × X) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : (K × X → ℝ) → ℂ) {A : ℝ≥0} (hLip : LipschitzWith A φ) + (hφ : ∀ x, ‖φ x‖ ≤ 1) : + ‖(∑' z, ((selectedResidueSmoothPMF modulus {r} V hV hZ z).toReal : ℂ) * + φ (fun k => (z k : ℝ) / V k)) - + ∫ x, (smoothProductProfile (K × X) x : ℂ) * φ x‖ ≤ + 4 * (4 : ℝ) ^ Fintype.card (K × X) * + ((A : ℝ) + 2 * ((Fintype.card (K × X) : ℝ) * probabilityProfileLipschitz)) * δ := by + rw [selectedResidueSmoothPMF_singleton_normalized_expectation modulus hmodulus r V hV hZ] + apply shiftedSmoothProductPMF_complex_test_quadrature _ _ + (residueProfileWidth_pos modulus V hmodulus hV) + (selectedResidueSmooth_singleton_indexMass_pos modulus hmodulus r V hV hZ) + hδ hδ1 _ hsmall φ hLip hφ + intro z + simpa only [residueProfileWidth, one_div_div] using hmesh z + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedSplitUnitSource.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedSplitUnitSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..99ccb8be5567b6fc8f201391e7bd9fef3617c231 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedSplitUnitSource.lean @@ -0,0 +1,76 @@ +import OAI.Combinatorics.Progressions.Lattices.JointAffineL1Parameter + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +noncomputable def selectedSplitMeasurableEquiv {I J N : Type*} + [Fintype I] [Fintype J] [Fintype N] (s : I ↪ J) : + ((UnselectedColumn s ⊕ N → ℝ) × (I → ℝ)) ≃ᵐ (J ⊕ N → ℝ) := + (splitFreeCoordinates I (UnselectedColumn s) N).trans + (((selectedCoefficientMeasurableEquiv s).prodCongr (MeasurableEquiv.refl (N → ℝ))).trans + (MeasurableEquiv.sumPiEquivProdPi (fun _ : J ⊕ N => ℝ)).symm) + +theorem selectedSplitMeasurableEquiv_apply {I J N : Type*} + [Fintype I] [Fintype J] [Fintype N] (s : I ↪ J) + (p : (UnselectedColumn s ⊕ N → ℝ) × (I → ℝ)) : + selectedSplitMeasurableEquiv s p = selectedSplitCoefficients s p := rfl + +theorem selectedSplitMeasurableEquiv_symm_apply {I J N : Type*} + [Fintype I] [Fintype J] [Fintype N] (s : I ↪ J) (r : J ⊕ N → ℝ) : + (selectedSplitMeasurableEquiv s).symm r = + (Sum.elim (fun j : UnselectedColumn s => r (.inl j.val)) (fun n => r (.inr n)), + fun i => r (.inl (s i))) := rfl + +theorem measurableEquiv_inverse_law {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] + (e : X ≃ᵐ Y) (μ : Measure X) (ν : Measure Y) (he : μ.map e = ν) : + ν.map e.symm = μ := by + rw [← he, Measure.map_map e.symm.measurable e.measurable] + simp only [Function.comp_def, MeasurableEquiv.symm_apply_apply, Measure.map_id'] + +theorem affineProductProfile_map_law {I Y : Type*} [Fintype I] [MeasurableSpace Y] + (c w : I → ℝ) (hw : ∀ i, 0 < w i) (F : (I → ℝ) → Y) (hF : Measurable F) : + (realDensityMeasure volume (smoothProductProfile I)).map + (fun r => F (fun i => c i+w i*r i)) = + (realDensityMeasure volume (affineProductProfile c w)).map F := by + have hm : Measurable (fun r : I → ℝ => fun i => c i+w i*r i) := by fun_prop + change Measure.map (F ∘ (fun (r : I → ℝ) i => c i+w i*r i)) _ = _ + rw [← Measure.map_map hF hm, affineProductProfile_law c w hw] + +theorem selectedSplit_affine_law {I J N : Type*} + [Fintype I] [Fintype J] [Fintype N] (s : I ↪ J) + (c w : J ⊕ N → ℝ) (hw : ∀ j, 0 < w j) : + (realDensityMeasure volume (affineSelectedJetProfile s c w)).map + (selectedSplitMeasurableEquiv s) = realDensityMeasure volume (affineProductProfile c w) := by + have hf := selectedSplitCoefficients_law s + (affineProductProfile (fun j => c (.inl j)) (fun j => w (.inl j))) + (affineProductProfile (fun n => c (.inr n)) (fun n => w (.inr n))) + (affineProductProfile_contDiff _ _).continuous.measurable + (affineProductProfile_contDiff _ _).continuous.measurable + (affineProductProfile_integrable _ _ (fun j => hw (.inl j))) + (affineProductProfile_integrable _ _ (fun n => hw (.inr n))) + (affineProductProfile_nonneg _ _ (fun j => hw (.inl j))) + (affineProductProfile_nonneg _ _ (fun n => hw (.inr n))) + change (realDensityMeasure volume (affineSelectedJetProfile s c w)).map + (selectedSplitMeasurableEquiv s) = _ at hf + rw [← affineProductProfile_joined] at hf + exact hf + +theorem selectedSplit_unit_law {I J N : Type*} + [Fintype I] [Fintype J] [Fintype N] (s : I ↪ J) + (c w : J ⊕ N → ℝ) (hw : ∀ j, 0 < w j) : + (realDensityMeasure volume (smoothProductProfile (J ⊕ N))).map + (fun r => (selectedSplitMeasurableEquiv s).symm (fun j => c j+w j*r j)) = + realDensityMeasure volume (affineSelectedJetProfile s c w) := by + exact (affineProductProfile_map_law c w hw _ (selectedSplitMeasurableEquiv s).symm.measurable).trans + (measurableEquiv_inverse_law (selectedSplitMeasurableEquiv s) _ _ (selectedSplit_affine_law s c w hw)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SelectedWindowIndicator.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedWindowIndicator.lean new file mode 100644 index 0000000000000000000000000000000000000000..b582439c67a0d07de35453e67bb93011b8187b65 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SelectedWindowIndicator.lean @@ -0,0 +1,224 @@ +import Mathlib.MeasureTheory.Constructions.Pi +import Mathlib.MeasureTheory.Integral.Bochner.Basic +import OAI.Combinatorics.Progressions.Probability.PMFPointMassMixture + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem normalized_complex_point_error (f g : ℂ) {N ε : ℝ} (hN : 0 < N) + (he : ‖(N : ℂ) * f - g‖ ≤ ε) : ‖f - g / (N : ℂ)‖ ≤ ε / N := by + have hn : (N : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hN.ne' + have hid : f - g / (N : ℂ) = ((N : ℂ) * f - g) / (N : ℂ) := by + field_simp + rw [hid, norm_div, Complex.norm_real, Real.norm_of_nonneg hN.le] + exact div_le_div_of_nonneg_right he hN.le + +theorem finite_window_normalized_l1_error {X : Type*} (W : Finset X) (f g : X → ℂ) + {N C ε : ℝ} (hN : 0 < N) (hε : 0 ≤ ε) (hcard : (W.card : ℝ) ≤ C * N) + (hzero : ∀ x ∉ W, f x = 0 ∧ g x = 0) + (he : ∀ x, ‖(N : ℂ) * f x - g x‖ ≤ ε) : + (∑' x, ‖f x - g x / (N : ℂ)‖) ≤ ε * C := by + have hz (x) (hx : x ∉ W) : ‖f x - g x / (N : ℂ)‖ = 0 := by + rw [(hzero x hx).1, (hzero x hx).2, zero_div, sub_self, norm_zero] + rw [(hasSum_sum_of_ne_finset_zero hz).tsum_eq] + calc + _ ≤ ∑ _x ∈ W, ε / N := Finset.sum_le_sum (fun x _ => normalized_complex_point_error _ _ hN (he x)) + _ = (W.card : ℝ) * (ε / N) := by simp + _ ≤ (C * N) * (ε / N) := mul_le_mul_of_nonneg_right hcard (div_nonneg hε hN.le) + _ = ε * C := by field_simp + +theorem finite_window_normalized_test_error {X : Type*} (W : Finset X) (f g test : X → ℂ) + {N C ε : ℝ} (hN : 0 < N) (hε : 0 ≤ ε) (hcard : (W.card : ℝ) ≤ C * N) + (hzero : ∀ x ∉ W, f x = 0 ∧ g x = 0) + (he : ∀ x, ‖(N : ℂ) * f x - g x‖ ≤ ε) (htest : ∀ x, ‖test x‖ ≤ 1) : + ‖∑' x, (f x - g x / (N : ℂ)) * test x‖ ≤ ε * C := by + have hz (x) (hx : x ∉ W) : (f x - g x / (N : ℂ)) * test x = 0 := by + rw [(hzero x hx).1, (hzero x hx).2, zero_div, sub_self, zero_mul] + have hzn (x) (hx : x ∉ W) : ‖f x - g x / (N : ℂ)‖ = 0 := by + rw [(hzero x hx).1, (hzero x hx).2, zero_div, sub_self, norm_zero] + rw [(hasSum_sum_of_ne_finset_zero hz).tsum_eq] + calc + _ ≤ ∑ x ∈ W, ‖(f x - g x / (N : ℂ)) * test x‖ := norm_sum_le _ _ + _ ≤ ∑ x ∈ W, ‖f x - g x / (N : ℂ)‖ := Finset.sum_le_sum (fun x _ => by + rw [norm_mul] + exact mul_le_of_le_one_right (norm_nonneg _) (htest x)) + _ = ∑' x, ‖f x - g x / (N : ℂ)‖ := (hasSum_sum_of_ne_finset_zero hzn).tsum_eq.symm + _ ≤ ε * C := finite_window_normalized_l1_error W f g hN hε hcard hzero he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators Classical + +variable {X Y : Type*} [Countable X] [DecidableEq X] [MeasurableSpace X] + [MeasurableSingletonClass X] [MeasurableSpace Y] + +theorem finite_window_weighted_integrable (W : Finset X) (f : X → ℂ) + (μ : Measure Y) (z : Y → X) (w : Y → ℂ) + (hz : Measurable z) (hw : Measurable w) + (hzero : ∀ x ∉ W, f x = 0) + (hweight : Integrable (fun y => if z y ∈ W then ‖w y‖ else 0) μ) : + Integrable (fun y => w y * f (z y)) μ := by + let C : ℝ := ∑ x ∈ W, ‖f x‖ + apply (hweight.mul_const C).mono' + (hw.mul ((measurable_of_countable f).comp hz)).aestronglyMeasurable + apply ae_of_all + intro y + change ‖w y * f (z y)‖ ≤ (if z y ∈ W then ‖w y‖ else 0) * C + by_cases hy : z y ∈ W + · simp only [ite_eq_left hy, norm_mul] + exact mul_le_mul_of_nonneg_left + (Finset.single_le_sum (fun x _ => norm_nonneg (f x)) hy) (norm_nonneg (w y)) + · simp only [ite_eq_right hy, hzero (z y) hy, mul_zero, norm_zero, zero_mul, le_refl] + +theorem finite_window_weighted_integral_error (W : Finset X) (f g : X → ℂ) + (μ : Measure Y) (z : Y → X) (w : Y → ℂ) + (hz : Measurable z) (hw : Measurable w) {N ε : ℝ} (hN : 0 < N) + (hzero : ∀ x ∉ W, f x = 0 ∧ g x = 0) + (he : ∀ x, ‖(N : ℂ) * f x - g x‖ ≤ ε) + (hweight : Integrable (fun y => if z y ∈ W then ‖w y‖ else 0) μ) : + ‖(∫ y, w y * f (z y) ∂μ) - (∫ y, w y * g (z y) ∂μ) / (N : ℂ)‖ ≤ + (ε / N) * ∫ y, if z y ∈ W then ‖w y‖ else 0 ∂μ := by + have hf := finite_window_weighted_integrable W f μ z w hz hw (fun x hx => (hzero x hx).1) hweight + have hg := finite_window_weighted_integrable W g μ z w hz hw (fun x hx => (hzero x hx).2) hweight + rw [← integral_div, ← integral_sub hf (hg.div_const (N : ℂ)), ← integral_const_mul] + apply norm_integral_le_of_norm_le (hweight.const_mul (ε / N)) + apply ae_of_all + intro y + by_cases hy : z y ∈ W + · simp only [ite_eq_left hy, mul_div_assoc, ← mul_sub, norm_mul] + exact (mul_le_mul_of_nonneg_left + (normalized_complex_point_error _ _ hN (he (z y))) (norm_nonneg (w y))).trans_eq + (mul_comm _ _) + · simp only [ite_eq_right hy, (hzero (z y) hy).1, (hzero (z y) hy).2, + mul_zero, zero_div, sub_self, norm_zero, le_refl] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators Classical + +variable {A : Type*} [Fintype A] {X : A → Type*} +variable (selected : A → Prop) [DecidablePred selected] + +noncomputable def selectedProductExtension (p : ∀ a, X a → ℝ) + (g : (∀ a : {a // selected a}, X a.val) → ℂ) (N : ℝ) (z : ∀ a, X a) : ℂ := + g (fun a => z a.val) / (N : ℂ) * ((∏ a : {a // ¬selected a}, p a.val (z a.val) : ℝ) : ℂ) + +theorem selectedProductExtension_error (p : ∀ a, X a → ℝ) + (hp : ∀ a z, 0 ≤ p a z) + (W : ∀ a, Finset (X a)) + (g : (∀ a : {a // selected a}, X a.val) → ℂ) + {N ε : ℝ} (hN : 0 < N) + (hzero : ∀ z, (∃ a, z a ∉ W a.val) → + (∏ a : {a // selected a}, p a.val (z a)) = 0 ∧ g z = 0) + (he : ∀ z, ‖(N : ℂ) * ((∏ a : {a // selected a}, p a.val (z a) : ℝ) : ℂ) - g z‖ ≤ ε) + (z : ∀ a, X a) : + ‖((∏ a, p a (z a) : ℝ) : ℂ) - selectedProductExtension selected p g N z‖ ≤ + (ε / N) * ∏ a, if selected a then (W a : Set (X a)).indicator (fun _ => (1 : ℝ)) (z a) + else p a (z a) := by + have hc : 0 ≤ ∏ a : {a // ¬selected a}, p a.val (z a.val) := + Finset.prod_nonneg (fun a _ => hp a.val _) + have hprod := Fintype.prod_subtype_mul_prod_subtype selected (fun a => p a (z a)) + have hweight := Fintype.prod_subtype_mul_prod_subtype selected + (fun a => if selected a then (W a : Set (X a)).indicator (fun _ => (1 : ℝ)) (z a) else p a (z a)) + simp only [Subtype.property, ite_true] at hweight + have hright (a : {a // ¬selected a}) : + (if selected a.val then (W a.val : Set (X a.val)).indicator (fun _ => (1 : ℝ)) (z a.val) + else p a.val (z a.val)) = p a.val (z a.val) := ite_eq_right a.property + simp only [hright] at hweight + rw [← hprod, Complex.ofReal_mul, selectedProductExtension, ← sub_mul, norm_mul, + Complex.norm_real, Real.norm_of_nonneg hc, ← hweight] + by_cases hz : ∀ a : {a // selected a}, z a.val ∈ W a.val + · have hi : (∏ a : {a // selected a}, (W a.val : Set (X a.val)).indicator (fun _ => (1 : ℝ)) (z a.val)) = 1 := by + apply Finset.prod_eq_one + intro a _ + exact Set.indicator_of_mem (hz a) _ + rw [hi, one_mul] + exact mul_le_mul_of_nonneg_right + (normalized_complex_point_error _ _ hN (he (fun a => z a.val))) hc + · obtain ⟨a, ha⟩ := not_forall.mp hz + obtain ⟨htrue, hg⟩ := hzero (fun a : {a // selected a} => z a.val) ⟨a, ha⟩ + have hi : (∏ a : {a // selected a}, (W a.val : Set (X a.val)).indicator (fun _ => (1 : ℝ)) (z a.val)) = 0 := + Finset.prod_eq_zero (Finset.mem_univ a) (Set.indicator_of_notMem ha _) + rw [htrue, hg, Complex.ofReal_zero, zero_div, sub_zero, norm_zero, zero_mul, hi, zero_mul, mul_zero] + +theorem selectedProductExtension_measurable [∀ a, MeasurableSpace (X a)] + (p : ∀ a, X a → ℝ) (hp : ∀ a, Measurable (p a)) + (g : (∀ a : {a // selected a}, X a.val) → ℂ) (hg : Measurable g) (N : ℝ) : + Measurable (selectedProductExtension selected p g N) := by + have hr : Measurable (fun z : ∀ a, X a => fun a : {a // selected a} => z a.val) := + Measurable.of_eval (fun coordinate => measurable_pi_apply coordinate.val) + have hc : Measurable (fun z : ∀ a, X a => ∏ a : {a // ¬selected a}, p a.val (z a.val)) := + Finset.measurable_prod _ (fun a _ => (hp a.val).comp (measurable_pi_apply a.val)) + exact ((hg.comp hr).div_const _).mul hc.complex_ofReal + +theorem selectedWindow_volume_cancel {N ε V M : ℝ} + (hN : 0 < N) (hε : 0 ≤ ε) (hM : 0 ≤ M) {C : ℝ} (hC : C ≤ V * N) : + (ε / N) * (C * M) ≤ (ε * V) * M := by + calc + _ ≤ (ε / N) * ((V * N) * M) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hC hM) (div_nonneg hε hN.le) + _ = _ := by field_simp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem selectedProductExtension_windowIndicator {A : Type*} [Fintype A] {X : A → Type*} + (selected : A → Prop) [DecidablePred selected] + (p : ∀ a, X a → ℝ) (W : ∀ a, Finset (X a)) (N : ℝ) (z : ∀ a, X a) : + selectedProductExtension selected p + (fun x => if ∀ a : {a // selected a}, x a ∈ W a.val then 1 else 0) N z = + ((∏ a, if selected a then (W a : Set (X a)).indicator (fun _ => (1 : ℝ)) (z a) + else p a (z a) : ℝ) : ℂ) / (N : ℂ) := by + have hweight := Fintype.prod_subtype_mul_prod_subtype selected + (fun a => if selected a then (W a : Set (X a)).indicator (fun _ => (1 : ℝ)) (z a) else p a (z a)) + simp only [Subtype.property, ite_true] at hweight + have hright (a : {a // ¬selected a}) : + (if selected a.val then (W a.val : Set (X a.val)).indicator (fun _ => (1 : ℝ)) (z a.val) + else p a.val (z a.val)) = p a.val (z a.val) := ite_eq_right a.property + simp only [hright] at hweight + rw [← hweight, Complex.ofReal_mul] + unfold selectedProductExtension + dsimp only + by_cases hz : ∀ a : {a // selected a}, z a.val ∈ W a.val + · have hi : (∏ a : {a // selected a}, (W a.val : Set (X a.val)).indicator (fun _ => (1 : ℝ)) (z a.val)) = 1 := by + apply Finset.prod_eq_one + intro a _ + exact Set.indicator_of_mem (hz a) _ + rw [ite_eq_left hz, hi, Complex.ofReal_one] + ring + · obtain ⟨a, ha⟩ := not_forall.mp hz + have hi : (∏ a : {a // selected a}, (W a.val : Set (X a.val)).indicator (fun _ => (1 : ℝ)) (z a.val)) = 0 := + Finset.prod_eq_zero (Finset.mem_univ a) (Set.indicator_of_notMem ha _) + simp only [ite_eq_right hz, hi, Complex.ofReal_zero, zero_div, zero_mul] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedCosetBalls.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedCosetBalls.lean new file mode 100644 index 0000000000000000000000000000000000000000..9239f07ef8fcb3f61ce65d136b4d2dc4f20b394c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedCosetBalls.lean @@ -0,0 +1,68 @@ +import Mathlib.Tactic +import OAI.Combinatorics.Progressions.Geometry.RightCosetMetricMap + +namespace OAI + +section + +namespace Erdos3 + +open scoped ENNReal NNReal + +variable {G : Type*} [Group G] [MetricSpace G] [IsIsometricSMul Gᵐᵒᵖ G] + +theorem dist_le_dist_mul_of_separated_ball (Γ : Subgroup G) (z : G) (R : ℝ) + (hsep : ∀ γ ∈ Γ, γ ≠ 1 → 4 * R ≤ dist z (z * γ)) + {x y : G} (hx : dist x z ≤ R) (hy : dist y z ≤ R) (γ : Γ) : + dist x y ≤ dist x (y * γ) := by + by_cases hγ : (γ : G) = 1 + · simp only [hγ, mul_one, le_refl] + · have hs := hsep γ γ.property hγ + have hchain : dist z (z * γ) ≤ dist z x + dist x (y * γ) + dist (y * γ) (z * γ) := + (dist_triangle z x (z * γ)).trans (by linarith [dist_triangle x (y * γ) (z * γ)]) + rw [dist_mul_right] at hchain + have hxy := dist_triangle x z y + rw [dist_comm z x] at hchain + rw [dist_comm z y] at hxy + linarith + +theorem rightCosetEDist_eq_edist_of_separated_ball (Γ : Subgroup G) (z : G) (R : ℝ) + (hsep : ∀ γ ∈ Γ, γ ≠ 1 → 4 * R ≤ dist z (z * γ)) + {x y : G} (hx : dist x z ≤ R) (hy : dist y z ≤ R) : + rightCosetEDist Γ x y = edist x y := by + apply le_antisymm (rightCosetEDist_le Γ x y) + apply le_iInf + intro γ + simp only [edist_dist] + exact ENNReal.ofReal_le_ofReal (dist_le_dist_mul_of_separated_ball Γ z R hsep hx hy γ) + +omit [IsIsometricSMul Gᵐᵒᵖ G] in +theorem separated_ball_of_lipschitz_left (Γ : Subgroup G) {δ R : ℝ} {C : ℝ≥0} + (hC : 0 < C) (hgap : ∀ γ ∈ Γ, γ ≠ 1 → δ ≤ dist 1 γ) + (hR : 4 * R * C ≤ δ) (z : G) (hleft : LipschitzWith C (fun x => z⁻¹ * x)) : + ∀ γ ∈ Γ, γ ≠ 1 → 4 * R ≤ dist z (z * γ) := by + intro γ hγ hne + have hLip : dist 1 γ ≤ (C : ℝ) * dist z (z * γ) := by + simpa only [inv_mul_cancel, inv_mul_cancel_left] using hleft.dist_le_mul z (z * γ) + have hC' : (0 : ℝ) < C := hC + have hg := hgap γ hγ hne + nlinarith + +variable [IsTopologicalGroup G] + +theorem quotient_dist_eq_of_separated_ball (Γ : Subgroup G) (hΓ : IsClosed (Γ : Set G)) + (z : G) (R : ℝ) (hsep : ∀ γ ∈ Γ, γ ≠ 1 → 4 * R ≤ dist z (z * γ)) : + letI := rightCosetMetricSpace Γ hΓ + ∀ {x y : G}, dist x z ≤ R → dist y z ≤ R → + dist (QuotientGroup.mk x : G ⧸ Γ) (QuotientGroup.mk y) = dist x y := by + let := rightCosetMetricSpace Γ hΓ + intro x y hx hy + have h : edist (QuotientGroup.mk x : G ⧸ Γ) (QuotientGroup.mk y) = edist x y := + rightCosetEDist_eq_edist_of_separated_ball Γ z R hsep hx hy + simpa only [edist_dist, ENNReal.toReal_ofReal dist_nonneg] using congrArg ENNReal.toReal h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedInterpolationBound.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedInterpolationBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..7310e4a5a2ca72a99cb36d69d5033678789b2508 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedInterpolationBound.lean @@ -0,0 +1,104 @@ +import Mathlib.LinearAlgebra.Lagrange +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open Polynomial +open scoped BigOperators + +theorem coeff_X_sub_C_mul_abs_le (p : ℝ[X]) {M y : ℝ} (hM : 0 ≤ M) + (hp : ∀ n, |p.coeff n| ≤ M) (hy : |y| ≤ 1) (n : ℕ) : + |((X - C y) * p).coeff n| ≤ 2 * M := by + cases n with + | zero => + simp only [mul_coeff_zero, coeff_sub, coeff_X_zero, coeff_C_zero, zero_sub, neg_mul, abs_neg, + abs_mul] + calc + |y| * |p.coeff 0| ≤ 1 * M := mul_le_mul hy (hp 0) (abs_nonneg _) zero_le_one + _ ≤ 2 * M := by linarith + | succ n => + rw [coeff_X_sub_C_mul] + calc + |p.coeff n - y * p.coeff (n + 1)| ≤ |p.coeff n| + |y * p.coeff (n + 1)| := abs_sub _ _ + _ = |p.coeff n| + |y| * |p.coeff (n + 1)| := by rw [abs_mul] + _ ≤ M + 1 * M := add_le_add (hp n) (mul_le_mul hy (hp (n + 1)) (abs_nonneg _) zero_le_one) + _ = 2 * M := by ring + +theorem coeff_prod_X_sub_C_abs_le {ι : Type*} (s : Finset ι) (v : ι → ℝ) + (hv : ∀ i ∈ s, |v i| ≤ 1) (n : ℕ) : + |(∏ i ∈ s, (X - C (v i))).coeff n| ≤ (2 : ℝ) ^ s.card := by + classical + induction s using Finset.induction_on generalizing n with + | empty => + simp only [Finset.prod_empty, Finset.card_empty, pow_zero, coeff_one] + split_ifs <;> norm_num + | @insert i s hi ih => + rw [Finset.prod_insert hi, Finset.card_insert_of_notMem hi, pow_succ] + have hp (k : ℕ) : |(∏ j ∈ s, (X - C (v j))).coeff k| ≤ (2 : ℝ) ^ s.card := by + exact ih (fun j hj => hv j (Finset.mem_insert_of_mem hj)) k + simpa only [mul_comm] using coeff_X_sub_C_mul_abs_le (∏ j ∈ s, (X - C (v j))) + (by positivity : 0 ≤ (2 : ℝ) ^ s.card) hp (hv i (Finset.mem_insert_self i s)) n + +theorem lagrange_basis_coeff_abs_le {ι : Type*} [DecidableEq ι] + (s : Finset ι) (v : ι → ℝ) (i : ι) {r : ℝ} (hr : 0 < r) + (hv : ∀ j ∈ s, |v j| ≤ 1) + (hsep : ∀ j ∈ s.erase i, r ≤ |v i - v j|) (n : ℕ) : + |(Lagrange.basis s v i).coeff n| ≤ (2 / r) ^ (s.erase i).card := by + have heq : Lagrange.basis s v i = + C (∏ j ∈ s.erase i, (v i - v j)⁻¹) * ∏ j ∈ s.erase i, (X - C (v j)) := by + simp only [Lagrange.basis, Lagrange.basisDivisor, Finset.prod_mul_distrib, map_prod] + have hprod : (∏ j ∈ s.erase i, |(v i - v j)⁻¹|) ≤ (r⁻¹) ^ (s.erase i).card := by + apply (Finset.prod_le_prod₀ (fun j _ => abs_nonneg _) (fun j hj => ?_)).trans_eq + (Finset.prod_const _) + rw [abs_inv] + simpa only [one_div] using one_div_le_one_div_of_le hr (hsep j hj) + rw [heq, coeff_C_mul, abs_mul, Finset.abs_prod] + calc + _ ≤ (r⁻¹) ^ (s.erase i).card * (2 : ℝ) ^ (s.erase i).card := + mul_le_mul hprod (coeff_prod_X_sub_C_abs_le (s.erase i) v + (fun j hj => hv j (Finset.mem_of_mem_erase hj)) n) (abs_nonneg _) (by positivity) + _ = _ := by rw [← mul_pow]; congr 1; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Polynomial +open scoped BigOperators + +theorem polynomial_coeff_le_of_separated_samples (p : ℝ[X]) (t : Finset ℝ) + {r u : ℝ} (hr : 0 < r) (hu : 0 ≤ u) (hdeg : p.degree < t.card) + (ht : ∀ x ∈ t, |x| ≤ 1) (hval : ∀ x ∈ t, |p.eval x| ≤ u) + (hsep : ∀ x ∈ t, ∀ y ∈ t, x ≠ y → r ≤ |x - y|) (n : ℕ) : + |p.coeff n| ≤ (t.card : ℝ) * u * (2 / r) ^ (t.card - 1) := by + classical + have heq : p = Lagrange.interpolate t id (fun x => p.eval x) := + Lagrange.eq_interpolate (fun _ _ _ _ h => h) hdeg + have hterm (x : ℝ) (hx : x ∈ t) : + |(C (p.eval x) * Lagrange.basis t id x).coeff n| ≤ u * (2 / r) ^ (t.card - 1) := by + rw [coeff_C_mul, abs_mul] + apply mul_le_mul (hval x hx) _ (abs_nonneg _) hu + have h := lagrange_basis_coeff_abs_le t id x hr ht + (fun y hy => hsep x hx y (Finset.mem_of_mem_erase hy) (Finset.ne_of_mem_erase hy).symm) n + simpa only [Finset.card_erase_of_mem hx] using h + calc + |p.coeff n| = |(∑ x ∈ t, C (p.eval x) * Lagrange.basis t id x).coeff n| := + congrArg (fun q : ℝ[X] => |q.coeff n|) heq + _ = |∑ x ∈ t, (C (p.eval x) * Lagrange.basis t id x).coeff n| := by rw [finsetSum_coeff] + _ ≤ ∑ x ∈ t, |(C (p.eval x) * Lagrange.basis t id x).coeff n| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _x ∈ t, u * (2 / r) ^ (t.card - 1) := Finset.sum_le_sum hterm + _ = _ := by simp only [Finset.sum_const, nsmul_eq_mul]; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedLabelExtension.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedLabelExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..d38dea523e5a9e736b67f5af46bfcf8ba02e96f5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedLabelExtension.lean @@ -0,0 +1,86 @@ +import OAI.Combinatorics.Progressions.Estimates.LipschitzExtensionAlongMap +import OAI.Combinatorics.Progressions.Lattices.CircleResiduePartition + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_bounded_extension_on_separated_labels + {A Y X : Type*} [PseudoMetricSpace Y] [PseudoMetricSpace X] + (embed : A → Y) (D L B : ℝ≥0) + (hsep : ∀ a b, a ≠ b → (1 : ℝ) ≤ D * dist (embed a) (embed b)) + (f : A → X → ℂ) (hf : ∀ a, LipschitzWith L (f a)) + (hb : ∀ a x, ‖f a x‖ ≤ B) : + ∃ g : Y × X → ℂ, LipschitzWith (2 * max L (2 * B * D)) g ∧ + (∀ a x, g (embed a, x) = f a x) ∧ ∀ z, ‖g z‖ ≤ 2 * B := by + classical + let S : Set (Y × X) := {z | z.1 ∈ Set.range embed} + let label (z : S) : A := Classical.choose z.property + have hlabel (z : S) : embed (label z) = z.val.1 := Classical.choose_spec z.property + let F : S → ℂ := fun z => f (label z) z.val.2 + let K : ℝ≥0 := max L (2 * B * D) + have hLK : (L : ℝ) ≤ K := by exact_mod_cast le_max_left L (2 * B * D) + have hDK : (2 * B * D : ℝ≥0) ≤ K := le_max_right _ _ + have hF : LipschitzWith K F := by + apply LipschitzWith.of_dist_le_mul + intro z w + have hY : dist z.val.1 w.val.1 ≤ dist z w := by + change dist z.val.1 w.val.1 ≤ max (dist z.val.1 w.val.1) (dist z.val.2 w.val.2) + exact le_max_left _ _ + have hX : dist z.val.2 w.val.2 ≤ dist z w := by + change dist z.val.2 w.val.2 ≤ max (dist z.val.1 w.val.1) (dist z.val.2 w.val.2) + exact le_max_right _ _ + by_cases h : label z = label w + · have he : dist (F z) (F w) ≤ (L : ℝ) * dist z.val.2 w.val.2 := by + simpa only [F, h] using (hf (label w)).dist_le_mul z.val.2 w.val.2 + exact he.trans ((mul_le_mul_of_nonneg_left hX L.coe_nonneg).trans + (mul_le_mul_of_nonneg_right hLK dist_nonneg)) + · have hs := hsep (label z) (label w) h + rw [hlabel z, hlabel w] at hs + have hs' : (1 : ℝ) ≤ D * dist z w := + hs.trans (mul_le_mul_of_nonneg_left hY D.coe_nonneg) + have hnorm : dist (F z) (F w) ≤ 2 * (B : ℝ) := by + rw [dist_eq_norm] + exact (norm_sub_le _ _).trans ((add_le_add (hb (label z) z.val.2) + (hb (label w) w.val.2)).trans_eq (two_mul (B : ℝ)).symm) + calc + _ ≤ 2 * (B : ℝ) := hnorm + _ ≤ (2 * (B : ℝ)) * (D * dist z w) := by + simpa only [mul_one] using mul_le_mul_of_nonneg_left hs' (by positivity : 0 ≤ 2 * (B : ℝ)) + _ = ((2 * B * D : ℝ≥0) : ℝ) * dist z w := by + simp only [NNReal.coe_mul, NNReal.coe_ofNat] + ring + _ ≤ (K : ℝ) * dist z w := mul_le_mul_of_nonneg_right (by exact_mod_cast hDK) dist_nonneg + obtain ⟨g, hg, heq, hgB⟩ := exists_complex_extension_from_subset S F K B hF + (fun z => hb (label z) z.val.2) + refine ⟨g, hg, ?_, hgB⟩ + intro a x + let z : S := ⟨(embed a, x), ⟨a, rfl⟩⟩ + have ha : label z = a := by + by_contra h + have hs := hsep (label z) a h + rw [hlabel z] at hs + change (1 : ℝ) ≤ D * dist (embed a) (embed a) at hs + simp only [dist_self, mul_zero] at hs + norm_num at hs + simpa only [F, ha, z] using heq z + +theorem exists_residue_real_extension {q : ℕ} [NeZero q] + (f : ZMod q → ℝ → ℂ) (L : ℝ≥0) + (hf : ∀ r, LipschitzWith L (f r)) (hb : ∀ r x, ‖f r x‖ ≤ 1) : + ∃ g : AddCircle (1 : ℝ) × ℝ → ℂ, + LipschitzWith (2 * max L (2 * (q : ℝ≥0))) g ∧ + (∀ r x, g (ZMod.toAddCircle r, x) = f r x) ∧ ∀ z, ‖g z‖ ≤ 2 := by + simpa using exists_bounded_extension_on_separated_labels + (fun r : ZMod q => ZMod.toAddCircle r) (q : ℝ≥0) L 1 + (fun r s hrs => by exact_mod_cast CircleFourier.one_le_mul_dist_toAddCircle hrs) f hf hb + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedPositiveSum.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedPositiveSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d994a1f7b8342af715444a1c49a8d9db5b054d0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedPositiveSum.lean @@ -0,0 +1,48 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem separated_tsum_lipschitz {ι X : Type*} [PseudoMetricSpace X] + (f : ι → X → ℝ) {K : ℝ≥0} (hf : ∀ i, LipschitzWith K (f i)) + (hpos : ∀ i x, 0 ≤ f i x) + (hsep : ∀ x i j, f i x ≠ 0 → f j x ≠ 0 → i = j) : + LipschitzWith K (fun x => ∑' i, f i x) := by + have hsingle (x : X) (i : ι) (hi : f i x ≠ 0) : (∑' j, f j x) = f i x := by + apply tsum_eq_single i + intro j hji + by_contra hj + exact hji (hsep x j i hj hi) + have hdom (x : X) (i : ι) : f i x ≤ ∑' j, f j x := by + by_cases hi : f i x = 0 + · rw [hi] + exact tsum_nonneg (fun j => hpos j x) + · rw [hsingle x i hi] + have hsub (x y : X) : (∑' i, f i x) - (∑' i, f i y) ≤ K * dist x y := by + by_cases hx : ∃ i, f i x ≠ 0 + · obtain ⟨i, hi⟩ := hx + rw [hsingle x i hi] + have h := (le_abs_self (f i x - f i y)).trans ((hf i).dist_le_mul x y) + linarith [hdom y i] + · have hz : ∀ i, f i x = 0 := fun i => not_ne_iff.mp (fun hi => hx ⟨i, hi⟩) + simp only [hz, tsum_zero, zero_sub] + exact le_trans (neg_nonpos.mpr (tsum_nonneg (fun i => hpos i y))) + (mul_nonneg K.coe_nonneg dist_nonneg) + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Real.dist_eq, abs_le] + have hxy := hsub x y + have hyx := hsub y x + rw [dist_comm y x] at hyx + constructor <;> linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedRealSamples.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedRealSamples.lean new file mode 100644 index 0000000000000000000000000000000000000000..f25d758c95edc36e3b301619a98cad5a0f95cd90 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SeparatedRealSamples.lean @@ -0,0 +1,77 @@ +import Mathlib.MeasureTheory.Measure.Lebesgue.Basic +import Mathlib.MeasureTheory.Measure.Real +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem real_interval_cover_measure_le (t : Finset ℝ) {r : ℝ} (hr : 0 ≤ r) : + volume.real (⋃ y ∈ t, Set.Ioo (y - r) (y + r)) ≤ 2 * (t.card : ℝ) * r := by + apply (measureReal_biUnion_finset_le t (fun y => Set.Ioo (y - r) (y + r))).trans + have hlen (y : ℝ) : volume.real (Set.Ioo (y - r) (y + r)) = 2 * r := by + rw [Real.volume_real_Ioo_of_le (by linarith)] + ring + simp only [hlen, Finset.sum_const, nsmul_eq_mul] + ring_nf + exact le_rfl + +theorem exists_separated_real_samples (s : Set ℝ) {r : ℝ} (hr : 0 < r) (n : ℕ) + (hlarge : 2 * (n : ℝ) * r < volume.real s) : + ∃ t : Finset ℝ, t.card = n ∧ (↑t : Set ℝ) ⊆ s ∧ + ∀ x ∈ t, ∀ y ∈ t, x ≠ y → r ≤ |x - y| := by + classical + induction n with + | zero => exact ⟨∅, rfl, by simp, by simp⟩ + | succ n ih => + have hsmall : 2 * (n : ℝ) * r < volume.real s := by + push_cast at hlarge + nlinarith + obtain ⟨t, hcard, hts, hsep⟩ := ih hsmall + let cover := ⋃ y ∈ t, Set.Ioo (y - r) (y + r) + have hfinite : volume cover ≠ ⊤ := by + apply measure_biUnion_ne_top t.finite_toSet + intro y _ + simp only [Real.volume_Ioo, ne_eq, ENNReal.ofReal_ne_top, not_false_eq_true] + have hnot : ¬s ⊆ cover := by + intro hsub + have h := (measureReal_mono hsub hfinite).trans (real_interval_cover_measure_le t hr.le) + rw [hcard] at h + linarith + obtain ⟨x, hxs, hxc⟩ := Set.not_subset.mp hnot + have hfar (y : ℝ) (hy : y ∈ t) : r ≤ |x - y| := by + by_contra! h + have hxy := abs_lt.mp h + apply hxc + exact Set.mem_iUnion.mpr ⟨y, Set.mem_iUnion.mpr ⟨hy, ⟨by linarith, by linarith⟩⟩⟩ + have hxt : x ∉ t := by + intro hx + have h := hfar x hx + simp only [sub_self, abs_zero] at h + linarith + refine ⟨insert x t, by rw [Finset.card_insert_of_notMem hxt, hcard], ?_, ?_⟩ + · intro y hy + rcases Finset.mem_insert.mp hy with rfl | hy + · exact hxs + · exact hts hy + · intro a ha b hb hab + rcases Finset.mem_insert.mp ha with hax | hat + · subst a + rcases Finset.mem_insert.mp hb with rfl | hbt + · exact False.elim (hab rfl) + · exact hfar b hbt + · rcases Finset.mem_insert.mp hb with hbx | hbt + · subst b + simpa only [abs_sub_comm] using hfar a hat + · exact hsep a hat b hbt hab + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/Separation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/Separation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d754b7ac944ee91b7d4f998f9347d5c6e65088f4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/Separation.lean @@ -0,0 +1,48 @@ +import OAI.Combinatorics.Progressions.Results.Basic + +namespace OAI + +section + +namespace Erdos3 + +theorem eq_zero_of_integer_mul_of_abs_lt {x D : ℝ} (hD : 0 < D) + (hgrid : ∃ z : ℤ, D * x = z) (hsmall : |x| < 1 / D) : x = 0 := by + obtain ⟨z, hz⟩ := hgrid + have hzsmall : |(z : ℝ)| < 1 := by + rw [← hz, abs_mul, abs_of_pos hD] + have h := (lt_div_iff₀ hD).mp hsmall + nlinarith + have hz0 : z = 0 := by + have h : |z| < (1 : ℤ) := by exact_mod_cast hzsmall + have hnonneg := abs_nonneg z + have habs : |z| = 0 := by omega + exact abs_eq_zero.mp habs + rw [hz0, Int.cast_zero] at hz + exact (mul_eq_zero.mp hz).resolve_left hD.ne' + +theorem separate_kernel {V ι : Type*} [AddCommGroup V] [Module ℝ V] + (Q : V →ₗ[ℝ] (ι → ℝ)) (a b : V) {D : ℝ} (hD : 0 < D) + (hsum : Q (a + b) = 0) + (hgrid : ∀ i, ∃ z : ℤ, D * Q b i = z) + (hsmall : ∀ i, |Q a i| < 1 / D) : Q a = 0 ∧ Q b = 0 := by + have hcoords : ∀ i, Q a i + Q b i = 0 := by + intro i + have h := congrFun hsum i + simpa only [map_add, Pi.add_apply, Pi.zero_apply] using h + have hb : Q b = 0 := by + funext i + apply eq_zero_of_integer_mul_of_abs_lt hD (hgrid i) + have hneg : Q b i = -(Q a i) := by linarith [hcoords i] + simpa only [hneg, abs_neg] using hsmall i + refine ⟨?_, hb⟩ + funext i + change Q a i = 0 + have hbi : Q b i = 0 := congrFun hb i + linarith [hcoords i] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonDescent.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonDescent.lean new file mode 100644 index 0000000000000000000000000000000000000000..25004cc0af72dd0e1bdd0fc1e8fb8d398fac2e51 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonDescent.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Linear.SharedFreeComparisonKernel + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def rankUnitDescentConstant (s : ℕ) : ℕ := + (RationalFilteredNilmanifold.UnitVerticalObservable.exists_lower_rank_family.{0, 0, 0} s).choose + +end Erdos3 + +namespace Erdos3.NativeRankRelation.CommonData + +open Module +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s (r + 1) N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure (r + 1)) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s (r + 1)) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +theorem CoefficientBases.comparison_lower_rank_family + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B.freeFrequency D) (pM : ℝ) (hpM : 0 ≤ pM) : + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + let hS := D.comparisonCoefficientSpace_le_layer E T hbQ hT V g hg D' hTfil + ∀ [TopologicalSpace (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1))] + [T2Space (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1))] + (J : ∀ j, Basis (Fin (finrank ℚ (S j))) ℚ (S j)) + (M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S (r + 1)) s + (finrank ℚ (SubspaceFreeLift.Algebra S (r + 1)))) (U : M.DegreeRankStructure (r + 1)), + U.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree → + U.ComplexityLE pM → + ∀ Z : M.UnitVerticalObservable (U.realSubgroup s (r + 1)) + (Fin W.family.outputDim × Fin W.family.outputDim) pM, + Z.frequency = (pairDifferenceFunctional V.frequency).comp + (SubspaceFreeLift.evaluation S J + (RationalFilteredNilmanifold.piRank (fun _ : Fin 2 => E) (fun _ => T)).filtration hS).toLinearMap → + ∀ u : M.filtration.realification.PolynomialOrbit (fun _ : Unit => 1), + RationalFilteredNilmanifold.HasLowerRankUnitFamily M U Z.observable u + ((pM + rankUnitDescentConstant s) ^ rankUnitDescentConstant s) := by + intro S hS _ _ _ _ J M U hU hUc Z hZ u + have hzero := B.native_comparison_frequency_zero D E T hbQ hT V g hg D' + hTfil hfreq J M U hU Z.frequency hZ + obtain ⟨n, hn, Q', U', hQF, _, _, hU'c, hK⟩ := + (RationalFilteredNilmanifold.UnitVerticalObservable.exists_lower_rank_family.{0, 0, 0} s).choose_spec.2 + M U Z u hpM hUc hzero + refine ⟨n, hn, Q', U', hU'c, ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] + (SubspaceFreeLift.Algebra S (r + 1) ⧸ U.filtration.layerIdeal s (r + 1))) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] + (SubspaceFreeLift.Algebra S (r + 1) ⧸ U.filtration.layerIdeal s (r + 1))) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 Q'.basis + obtain ⟨K, hKo, hKn, hKc, hKu, _, hKe⟩ := hK + exact ⟨U.rankQuotientOrbit Q' hQF u, K, hKo, hKn, hKc, hKu, hKe⟩ + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonLift.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e1790e92b98d9f3b189762683f04584d15ea984 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonLift.lean @@ -0,0 +1,879 @@ +import OAI.Combinatorics.Progressions.Estimates.SharedFreeComparisonOrbit +import OAI.Combinatorics.Progressions.Linear.SharedFreeComparisonBasis + +namespace OAI + +section + +namespace Erdos3 + +theorem four_projection_petal_add_invariant + {R I E : Type*} {V : I → Type*} [CommRing R] + [∀ i, AddCommGroup (V i)] [∀ i, Module R (V i)] [AddCommGroup E] + (f : (∀ i, V i) → E) (K : ∀ i, Submodule R (Fin 4 → V i)) + (hK : ∀ z : ∀ i, Fin 4 → V i, (∀ i, z i ∈ K i) → fourFunctionDifference f z = 0) + (x p : ∀ i, V i) (hx : ∀ i, x i ∈ (K i).map (LinearMap.proj 0)) + (hp : ∀ i, LinearMap.single R (fun _ : Fin 4 => V i) 0 (p i) ∈ K i) : + f (x + p) = f x := by + classical + have hlift (i : I) : ∃ z ∈ K i, z 0 = x i := hx i + choose z hz hz0 using hlift + let y (i : I) := z i + LinearMap.single R (fun _ : Fin 4 => V i) 0 (p i) + have hy (i : I) : y i ∈ K i := (K i).add_mem (hz i) (hp i) + have hy0 : (fun i => y i 0) = x + p := by + funext i + simp only [y, Pi.add_apply, LinearMap.single_apply, Pi.single_eq_same, hz0] + have hy1 : (fun i => y i 1) = fun i => z i 1 := by + funext i + simp [y, LinearMap.single_apply] + have hy2 : (fun i => y i 2) = fun i => z i 2 := by + funext i + simp [y, LinearMap.single_apply] + have hy3 : (fun i => y i 3) = fun i => z i 3 := by + funext i + simp [y, LinearMap.single_apply] + have h₀ := hK z hz + have h₁ := hK y hy + rw [fourFunctionDifference, hy0, hy1, hy2, hy3] at h₁ + rw [fourFunctionDifference, show (fun i => z i 0) = x from funext hz0] at h₀ + simp only [sub_eq_add_neg] at h₀ h₁ + exact add_right_cancel (add_right_cancel (add_right_cancel (h₁.trans h₀.symm))) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct Matrix NNReal + +theorem realifyCoordinateMap_eq_coordinates + {V ι : Type*} [AddCommGroup V] [Module ℚ V] [Fintype ι] + (φ : V →ₗ[ℚ] (ι → ℚ)) (x : ℝ ⊗[ℚ] V) : + realifyCoordinateMap φ x = realRationalCoordinateEquiv (φ.baseChange ℝ x) := by + induction x using TensorProduct.inductionOn with + | tmul a v => + funext i + rw [realifyCoordinateMap_tmul, LinearMap.baseChange_tmul, realRationalCoordinateEquiv_tmul] + | add x y hx hy => simp only [map_add, hx, hy] + +theorem exists_controlled_subspace_image_section + {μ ι κ V : Type*} [Fintype μ] [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℚ V] + (b : Basis μ ℚ V) (U : Submodule ℚ V) (v : κ → V) + (hv : Submodule.span ℚ (Set.range v) = U) (φ : V →ₗ[ℚ] (ι → ℚ)) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hvH : ∀ j i, RationalHeightLE (b.repr (v j) i) H) + (hφH : ∀ j i, RationalHeightLE (φ (v j) i) H) + {p : ℝ} (hp : 0 ≤ p) (hμ : (Fintype.card μ : ℝ) ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) (hκ : (Fintype.card κ : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) : + ∃ (σ : (ι → ℝ) →ₗ[ℝ] (ℝ ⊗[ℚ] V)) (m : ℕ), + 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + 2) ^ 3 + (p + 2) ^ 36) ∧ + (∀ y, σ y ∈ U.baseChange ℝ) ∧ + (∀ x ∈ U.baseChange ℝ, + realifyCoordinateMap φ (σ (realifyCoordinateMap φ x)) = realifyCoordinateMap φ x) ∧ + (∀ y, ‖(b.baseChange ℝ).equivFun (σ y)‖ ≤ + Real.exp ((p + 2) ^ 3 + (p + 2) ^ 18) * ‖y‖) ∧ + ∀ y ∈ realDenominatorGrid l, (b.baseChange ℝ).equivFun (σ y) ∈ realDenominatorGrid m := by + classical + let A : Matrix ι κ ℚ := fun i j => φ (v j) i + let B : Matrix μ κ ℚ := fun i j => b.repr (v j) i + obtain ⟨S, hS, hSH⟩ := exists_bounded_rational_image_section A hH (fun i j => hφH j i) + let σ := (b.baseChange ℝ).equivFun.symm.toLinearMap.comp + ((Matrix.mulVecLin (fun i j => (B i j : ℝ))).comp + (Matrix.mulVecLin (fun i j => (S i j : ℝ)))) + have hσ (y : ι → ℝ) : + σ y = realGeneratorCombination v ((fun i j => (S i j : ℝ)) *ᵥ y) := by + apply (b.baseChange ℝ).equivFun.injective + change (b.baseChange ℝ).equivFun ((b.baseChange ℝ).equivFun.symm + ((fun i j => (B i j : ℝ)) *ᵥ ((fun i j => (S i j : ℝ)) *ᵥ y))) = _ + rw [LinearEquiv.apply_symm_apply, realGeneratorCombination_coordinates] + have hcoord (y : ι → ℝ) : (b.baseChange ℝ).equivFun (σ y) = + (fun i j => (B i j : ℝ)) *ᵥ ((fun i j => (S i j : ℝ)) *ᵥ y) := by + rw [hσ, realGeneratorCombination_coordinates] + have hvU (j : κ) : v j ∈ U := hv ▸ Submodule.subset_span (Set.mem_range_self j) + have hvφ : Submodule.span ℚ (Set.range (fun j => φ (v j))) = U.map φ := by + rw [← hv, Submodule.map_span, ← Set.range_comp] + rfl + have hHp' : (H : ℝ) ≤ Real.exp ((p + 2) ^ 1) := + hHp.trans (Real.exp_le_exp.mpr (by simp)) + have hBden : (matrixDenominator B : ℝ) ≤ Real.exp ((p + 2) ^ 3) := + matrixDenominator_le_exp_power B hp 1 hμ hκ + (fun i j => (Nat.cast_le.mpr (hvH j i).2).trans hHp') + have hSden := real_image_section_denominator_bound S H l hSH hp hι hκ hHp hlp + have hfac : ((Fintype.card κ : ℝ) + 1) * (H + 1) ≤ Real.exp ((p + 2) ^ 3) := by + apply le_trans _ (matrix_weighted_factor_le_exp_power (Fintype.card κ) hp hκ 1 (by decide)) + exact mul_le_mul_of_nonneg_left (add_le_add hHp' le_rfl) (by positivity) + have hBnorm (y : κ → ℝ) : + ‖(fun i j => (B i j : ℝ)) *ᵥ y‖ ≤ Real.exp ((p + 2) ^ 3) * ‖y‖ := + (norm_matrix_mulVec_le _ (H : ℝ≥0) (fun i j => (hvH j i).abs_real_le) y).trans + (mul_le_mul_of_nonneg_right hfac (norm_nonneg y)) + refine ⟨σ, matrixDenominator B * (matrixDenominator S * l), + Nat.mul_pos (matrixDenominator_pos B) (Nat.mul_pos (matrixDenominator_pos S) hl), + ?_, ?_, ?_, ?_, ?_⟩ + · rw [Nat.cast_mul] + exact (mul_le_mul hBden hSden (Nat.cast_nonneg _) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + · intro y + rw [hσ] + exact realGeneratorCombination_mem U v hvU _ + · intro x hx + have himg : realifyCoordinateMap φ x ∈ + LinearMap.range (Matrix.mulVecLin (fun i j => (A i j : ℝ))) := by + rw [← realRationalCoordinateSpan_eq_image (U.map φ) (fun j => φ (v j)) hvφ, + realifyCoordinateMap_eq_coordinates] + refine ⟨φ.baseChange ℝ x, ?_, rfl⟩ + rw [realification_map] + exact ⟨x, hx, rfl⟩ + rw [hσ, realifyCoordinateMap_eq_coordinates, realGeneratorCombination_map_coordinates] + exact real_matrix_image_section_apply A S hS _ himg + · intro y + rw [hcoord] + calc + _ ≤ Real.exp ((p + 2) ^ 3) * ‖(fun i j => (S i j : ℝ)) *ᵥ y‖ := hBnorm _ + _ ≤ Real.exp ((p + 2) ^ 3) * (Real.exp ((p + 2) ^ 18) * ‖y‖) := + mul_le_mul_of_nonneg_left (real_image_section_norm_bound S H hSH hp hι hκ hHp y) + (Real.exp_pos _).le + _ = _ := by rw [← mul_assoc, ← Real.exp_add] + · intro y hy + rw [hcoord] + exact real_matrix_denominator_grid B _ _ (real_matrix_denominator_grid S l y hy) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +theorem realify_basis_coordinates + {V ι : Type*} [AddCommGroup V] [Module ℚ V] [Fintype ι] + (b : Basis ι ℚ V) (x : ℝ ⊗[ℚ] V) : + realifyCoordinateMap b.equivFun.toLinearMap x = (b.baseChange ℝ).equivFun x := by + induction x using TensorProduct.inductionOn with + | tmul a v => + funext i + rw [realifyCoordinateMap_tmul] + change a * (b.repr v i : ℝ) = (b.baseChange ℝ).repr (a ⊗ₜ[ℚ] v) i + rw [Basis.baseChange_repr_tmul] + simp only [Rat.smul_def, mul_comm] + | add x y hx hy => simp only [map_add, hx, hy] + +theorem exists_controlled_subspace_projector + {μ κ V : Type*} [Fintype μ] [Fintype κ] [AddCommGroup V] [Module ℚ V] + (b : Basis μ ℚ V) (U : Submodule ℚ V) (v : κ → V) + (hv : Submodule.span ℚ (Set.range v) = U) (l : ℕ) (hl : 0 < l) + {p : ℝ} (hp : 0 ≤ p) (hμ : (Fintype.card μ : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) + (hvH : ∀ j i, rationalLogHeight (b.repr (v j) i) ≤ p) + (hlp : (l : ℝ) ≤ Real.exp p) : + let q := p + 1 + ∃ (P : (ℝ ⊗[ℚ] V) →ₗ[ℝ] (ℝ ⊗[ℚ] V)) (m : ℕ), + 0 < m ∧ (m : ℝ) ≤ Real.exp ((q + 2) ^ 3 + (q + 2) ^ 36) ∧ + (∀ x, P x ∈ U.baseChange ℝ) ∧ (∀ x ∈ U.baseChange ℝ, P x = x) ∧ + (∀ x, ‖(b.baseChange ℝ).equivFun (P x)‖ ≤ + Real.exp ((q + 2) ^ 3 + (q + 2) ^ 18) * ‖(b.baseChange ℝ).equivFun x‖) ∧ + ∀ x, (b.baseChange ℝ).equivFun x ∈ realDenominatorGrid l → + (b.baseChange ℝ).equivFun (P x) ∈ realDenominatorGrid m := by + intro q + have hpq : p ≤ q := by dsimp [q]; linarith + obtain ⟨σ, m, hm, hmp, hσU, hσfix, hσnorm, hσgrid⟩ := + exists_controlled_subspace_image_section b U v hv b.equivFun.toLinearMap + (one_le_ceil_exp p) hl (fun j i => rationalHeightLE_ceil_exp (hvH j i)) + (fun j i => rationalHeightLE_ceil_exp (hvH j i)) + (hp.trans hpq) (hμ.trans hpq) (hμ.trans hpq) (hκ.trans hpq) + (ceil_exp_le_exp_add_one hp) (hlp.trans (Real.exp_le_exp.mpr hpq)) + let P := σ.comp (b.baseChange ℝ).equivFun.toLinearMap + refine ⟨P, m, hm, hmp, (fun x => hσU _), ?_, (fun x => hσnorm _), ?_⟩ + · intro x hx + apply (b.baseChange ℝ).equivFun.injective + change (b.baseChange ℝ).equivFun (σ ((b.baseChange ℝ).equivFun x)) = _ + simpa only [realify_basis_coordinates] using hσfix x hx + · intro x hx + exact hσgrid _ hx + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +theorem exists_logHeight_subspace_image_section + {μ ι κ V : Type*} [Fintype μ] [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℚ V] + (b : Basis μ ℚ V) (U : Submodule ℚ V) (v : κ → V) + (hv : Submodule.span ℚ (Set.range v) = U) (φ : V →ₗ[ℚ] (ι → ℚ)) + (l : ℕ) (hl : 0 < l) {p : ℝ} (hp : 0 ≤ p) + (hμ : (Fintype.card μ : ℝ) ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) + (hvH : ∀ j i, rationalLogHeight (b.repr (v j) i) ≤ p) + (hφH : ∀ i j, rationalLogHeight (φ (b i) j) ≤ p) + (hlp : (l : ℝ) ≤ Real.exp p) : + let t := (p + 2) ^ 4 + 1 + ∃ (σ : (ι → ℝ) →ₗ[ℝ] (ℝ ⊗[ℚ] V)) (m : ℕ), + 0 < m ∧ (m : ℝ) ≤ Real.exp ((t + 2) ^ 3 + (t + 2) ^ 36) ∧ + (∀ y, σ y ∈ U.baseChange ℝ) ∧ + (∀ x ∈ U.baseChange ℝ, + realifyCoordinateMap φ (σ (realifyCoordinateMap φ x)) = realifyCoordinateMap φ x) ∧ + (∀ y, ‖(b.baseChange ℝ).equivFun (σ y)‖ ≤ + Real.exp ((t + 2) ^ 3 + (t + 2) ^ 18) * ‖y‖) ∧ + ∀ y ∈ realDenominatorGrid l, (b.baseChange ℝ).equivFun (σ y) ∈ realDenominatorGrid m := by + intro t + have hp4 : p ≤ (p + 2) ^ 4 := le_power_budget hp (by decide) + have hpt : p ≤ t := hp4.trans (le_add_of_nonneg_right (by norm_num)) + have ht : 0 ≤ t := hp.trans hpt + apply exists_controlled_subspace_image_section b U v hv φ + (one_le_ceil_exp ((p + 2) ^ 4)) hl _ _ ht (hμ.trans hpt) (hι.trans hpt) (hκ.trans hpt) + (ceil_exp_le_exp_add_one (by positivity)) (hlp.trans (Real.exp_le_exp.mpr hpt)) + · intro j i + exact rationalHeightLE_ceil_exp ((hvH j i).trans hp4) + · intro j i + apply rationalHeightLE_ceil_exp + exact linearMap_coordinate_logHeight b (Pi.basisFun ℚ ι) φ hp hμ hφH (v j) (hvH j) i + +end Erdos3 + +end + +section + +namespace Erdos3.SubspaceFreeLift + +open Module NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +theorem exists_native_pair_model (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ (L I : Type*) [LieRing L] [LieAlgebra ℚ L] [Fintype I] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] (Fin 2 → L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 2 → L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 2 → L))] [T2Space (ℝ ⊗[ℚ] (Fin 2 → L))] + (r d : ℕ) (D : RationalFilteredNilmanifold L s d) (T : D.DegreeRankStructure r) + (S : Fin s → Submodule ℚ (Fin 2 → L)) + (B : ∀ j, Basis (Fin (finrank ℚ (S j))) ℚ (S j)) + (hS : ∀ j, S j ≤ (piRank (fun _ : Fin 2 => D) (fun _ => T)).filtration.layer (j.val + 1) 0) + (p : ℝ), 2 ≤ p → T.ComplexityLE p → + (∀ j a i, rationalLogHeight ((Pi.basis (fun _ : Fin 2 => D.basis)).repr + (B j a : Fin 2 → L) i) ≤ p) → + ∀ U : D.UnitVerticalObservable (T.realSubgroup s r) I p, + let φ := evaluation S B (piRank (fun _ : Fin 2 => D) (fun _ => T)).filtration hS + ∃ E : RationalFilteredNilmanifold (Algebra S r) s (finrank ℚ (Algebra S r)), + ∃ Q : E.DegreeRankStructure r, + Q.filtration = filtration S T.filtration.rank_le_degree ∧ + Q.ComplexityLE ((p + C) ^ C) ∧ IsCentralLieBasis E.basis ∧ + Nonempty (FreeCoordinateFrame E.basis ((p + C) ^ C)) ∧ + (∀ i j, rationalLogHeight ((pi (fun _ : Fin 2 => D)).basis.repr + (φ (E.basis j)) i) ≤ (p + C) ^ C) ∧ + E.lattice ≤ (pi (fun _ : Fin 2 => D)).lattice.comap (mapOfSteps + (hL := E.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => D)).filtration.lowerCentralSeries_eq_bot) φ) ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] Algebra S r) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] Algebra S r) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 E.basis + ∃ V : E.UnitVerticalObservable (Q.realSubgroup s r) (I × I) ((p + C) ^ C), + V.frequency = (pairDifferenceFunctional U.frequency).comp φ.toLinearMap ∧ + ∀ i x, V.observable i (QuotientGroup.mk x) = + U.pairedObservable T i (QuotientGroup.mk (realificationMap + (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => D)).filtration.lowerCentralSeries_eq_bot) φ x))) := by + obtain ⟨a, _, hfree⟩ := exists_native_model s + let K₀ : Polynomial ℕ := (Polynomial.X + 2) ^ 2 + + (Polynomial.X + (Polynomial.X ^ 2 + Polynomial.X + 3) ^ 2 + 2) + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((K₀ + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro L I _ _ _ _ _ _ _ _ _ _ _ r d D T S B hS p hp hT hB U φ + have hp₀ : 0 ≤ p := by linarith + let P := p + (p ^ 2 + p + 3) ^ 2 + 2 + let K := (p + 2) ^ 2 + P + have hP : 0 ≤ P := by dsimp only [P]; positivity + have hpP : p ≤ P := by dsimp only [P]; nlinarith [sq_nonneg (p ^ 2 + p + 3)] + have hPK : P ≤ K := le_add_of_nonneg_left (sq_nonneg (p + 2)) + have hGK : (p + 2) ^ 2 ≤ K := le_add_of_nonneg_right hP + have hK : 0 ≤ K := hP.trans hPK + have hbound : (K + a) ^ a ≤ (p + C) ^ C := by + simpa [K₀, K, P, Polynomial.eval₂_pow] using hbudget p hp₀ + let D₂ := pi (fun _ : Fin 2 => D) + let T₂ := piRank (fun _ : Fin 2 => D) (fun _ => T) + have hT₂ : T₂.ComplexityLE K := + (piRank_complexity (fun _ : Fin 2 => D) (fun _ => T) hp₀ + (by simpa using hp) (fun _ => hT)).mono T₂ hGK + have hB₂ (j : Fin s) (k : Fin (finrank ℚ (S j))) (i) : + rationalLogHeight (D₂.basis.repr (B j k : Fin 2 → L) i) ≤ K := by + change rationalLogHeight ((productFinBasis (fun _ : Fin 2 => D)).repr _ i) ≤ K + rw [productFinBasis, Basis.repr_reindex_apply] + exact (hB j k _).trans (hpP.trans hPK) + obtain ⟨E, Q, hQ, hQc, hcentral, ⟨frame⟩, hmatrix, hlattice, hV⟩ := + hfree (Fin 2 → L) (I × I) r _ D₂ T₂ S B hS K hK hT₂ hB₂ + ((U.paired T hp hT.1).mono hPK) + let := moduleTopology ℝ (ℝ ⊗[ℚ] Algebra S r) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] Algebra S r) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 E.basis + obtain ⟨V, hfreq, hobs⟩ := hV + exact ⟨E, Q, hQ, hQc.mono Q hbound, hcentral, ⟨frame.mono hbound⟩, + (fun i j => (hmatrix i j).trans hbound), hlattice, V.mono hbound, hfreq, hobs⟩ + +end Erdos3.SubspaceFreeLift + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + (e : Basis (Fin (finrank ℚ D.CoefficientFreeLieAlgebra)) ℚ D.CoefficientFreeLieAlgebra) + {Q : ℝ} (F : FreeCoordinateFrame e Q) + +include F + +theorem exists_coefficientFreeSpan_projector (hs : 1 ≤ s) (d : Fin s) + (l : ℕ) (hl : 0 < l) {A : ℝ} (hA : 0 ≤ A) (hQA : Q ≤ A) + (hdim : (finrank ℚ D.CoefficientFreeLieAlgebra : ℝ) ≤ A) + (hlA : (l : ℝ) ≤ Real.exp A) : + let t := A + 1 + ∃ (P : (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) →ₗ[ℝ] + (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)) (m : ℕ), + 0 < m ∧ (m : ℝ) ≤ Real.exp ((t + 2) ^ 3 + (t + 2) ^ 36) ∧ + (∀ x, P x ∈ (D.coefficientFreeSpan d).baseChange ℝ) ∧ + (∀ x ∈ (D.coefficientFreeSpan d).baseChange ℝ, P x = x) ∧ + (∀ x, ‖(e.baseChange ℝ).equivFun (P x)‖ ≤ + Real.exp ((t + 2) ^ 3 + (t + 2) ^ 18) * ‖(e.baseChange ℝ).equivFun x‖) ∧ + ∀ x, (e.baseChange ℝ).equivFun x ∈ realDenominatorGrid l → + (e.baseChange ℝ).equivFun (P x) ∈ realDenominatorGrid m := by + obtain ⟨c, hc⟩ := D.exists_coefficientFreeSpan_basis e F hs d + have hcspan : Submodule.span ℚ (Set.range (fun j => (c j : D.CoefficientFreeLieAlgebra))) = + D.coefficientFreeSpan d := by + change Submodule.span ℚ (Set.range ((D.coefficientFreeSpan d).subtype ∘ c)) = _ + rw [Set.range_comp, ← Submodule.map_span, c.span_eq, Submodule.map_top, Submodule.range_subtype] + apply exists_controlled_subspace_projector e (D.coefficientFreeSpan d) + (fun j => (c j : D.CoefficientFreeLieAlgebra)) hcspan l hl hA + · simpa only [Fintype.card_fin] using hdim + · have hd : (finrank ℚ (D.coefficientFreeSpan d) : ℝ) ≤ + finrank ℚ D.CoefficientFreeLieAlgebra := by + exact_mod_cast Submodule.finrank_le (D.coefficientFreeSpan d) + simpa only [Fintype.card_fin] using hd.trans hdim + · exact fun j i => (hc j i).trans hQA + · exact hlA + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3 + +noncomputable def sharedFreeCommonCorrectionBudget (s : ℕ) (q p : ℝ) : ℝ := + let Λ := (p + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s + let t := (q + p + Λ) + 1 + (t + 2) ^ 3 + (t + 2) ^ 36 + Λ + +theorem refined_firstProjection_le_common + {R V : Type*} [CommRing R] [AddCommGroup V] [Module R V] + (C D : Submodule R V) (hDC : D ≤ C) (K : Submodule R (Fin 4 → V)) : + (fourRefinedRelation C D K).map (LinearMap.proj 0) ≤ C := by + rintro v ⟨w, hw, rfl⟩ + exact ((mem_fourCommonModulo C D w).mp (fourRefinedRelation_le_common C D hDC K hw)).1 0 + +end Erdos3 + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial CyclicCrootSisask +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem exists_shared_free_filtered_common + (hs : 2 ≤ s) (hp' : 0 ≤ p') (hP' : 0 ≤ P') (hQP' : Q ≤ P') (hpp' : p' ≤ P') + (ξ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hsplit : ∀ h, g h = ξ * v h) + (hξ : ∀ d : Fin s, coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ + (D.commonFreeSpan d).baseChange ℝ) + (hv : ∀ h (d : Fin s), coefficients (v h).log (Finsupp.single () (d.val + 1)) ∈ + (D.dependentFreeSpan d).baseChange ℝ) + (hN : Real.exp ((P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s) ≤ (N : ℝ)) : + let L := sharedFreeCommonCorrectionBudget s Q P' + ∃ (m : Fin s → ℕ) (γ e q : Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra), + ∀ d, 0 < m d ∧ (m d : ℝ) ≤ Real.exp L ∧ + γ d ∈ ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ ∧ + γ d ∈ (D.coefficientFreeSpan d).baseChange ℝ ∧ + e d ∈ (D.coefficientFreeSpan d).baseChange ℝ ∧ + q d ∈ (D.coefficientFreeSpan d).baseChange ℝ ∧ + coefficients ξ.log (Finsupp.single () (d.val + 1)) = γ d + e d + q d ∧ + ‖(E.basis.baseChange ℝ).equivFun (e d)‖ ≤ Real.exp L / (N : ℝ) ^ (d.val + 1) ∧ + (E.basis.baseChange ℝ).equivFun (q d) ∈ realDenominatorGrid (m d) := by + intro L + classical + obtain ⟨l, γ, e, q, hdata⟩ := + D.exists_shared_free_common_projection E T hbQ hT F V g hg D' + hs hp' hP' hQP' hpp' ξ v hsplit hξ hv hN + let Λ := (P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s + let A := Q + P' + Λ + let t := A + 1 + let C := (t + 2) ^ 3 + (t + 2) ^ 18 + have hQ : 0 ≤ Q := (Nat.cast_nonneg _).trans hT.1.1 + have hΛ : 0 ≤ Λ := pow_nonneg (add_nonneg hP' (Nat.cast_nonneg _)) _ + have hA : 0 ≤ A := add_nonneg (add_nonneg hQ hP') hΛ + have hQA : Q ≤ A := (le_add_of_nonneg_right hP').trans (le_add_of_nonneg_right hΛ) + have hPA : P' ≤ A := (le_add_of_nonneg_left hQ).trans (le_add_of_nonneg_right hΛ) + have hΛA : Λ ≤ A := le_add_of_nonneg_left (add_nonneg hQ hP') + have hprojectors (d : Fin s) : + ∃ (P : (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) →ₗ[ℝ] + (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)) (m : ℕ), + 0 < m ∧ (m : ℝ) ≤ Real.exp ((t + 2) ^ 3 + (t + 2) ^ 36) ∧ + (∀ x, P x ∈ (D.coefficientFreeSpan d).baseChange ℝ) ∧ + (∀ x ∈ (D.coefficientFreeSpan d).baseChange ℝ, P x = x) ∧ + (∀ x, ‖(E.basis.baseChange ℝ).equivFun (P x)‖ ≤ + Real.exp C * ‖(E.basis.baseChange ℝ).equivFun x‖) ∧ + ∀ x, (E.basis.baseChange ℝ).equivFun x ∈ realDenominatorGrid (l d) → + (E.basis.baseChange ℝ).equivFun (P x) ∈ realDenominatorGrid m := by + exact D.exists_coefficientFreeSpan_projector E.basis F (by omega) d + (l d) (hdata d).1 hA hQA ((hT.1.1.trans hQP').trans hPA) + ((hdata d).2.1.trans (Real.exp_le_exp.mpr hΛA)) + choose P m hm hmb hPU hPfix hPnorm hPgrid using hprojectors + have ht : 0 ≤ t := add_nonneg hA zero_le_one + have h18 : (t + 2) ^ 18 ≤ (t + 2) ^ 36 := pow_le_pow_right₀ (by linarith only [ht]) (by decide) + have hL : L = (t + 2) ^ 3 + (t + 2) ^ 36 + Λ := rfl + have hCL : C + Λ ≤ L := add_le_add (add_le_add (le_refl ((t + 2) ^ 3)) h18) (le_refl Λ) + refine ⟨m, γ, (fun d => P d (e d)), (fun d => P d (q d)), ?_⟩ + intro d + obtain ⟨_hl, _hlb, hγ, heq, herr, hgrid⟩ := hdata d + have hγC : γ d ∈ (D.coefficientFreeSpan d).baseChange ℝ := + Submodule.baseChange_mono ℝ + (refined_firstProjection_le_common _ _ (D.dependentFreeSpan_le_coefficientFreeSpan d) _) hγ + have hξC : coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ + (D.coefficientFreeSpan d).baseChange ℝ := + Submodule.baseChange_mono ℝ (D.commonFreeSpan_le_coefficientFreeSpan d) (hξ d) + have hsum : e d + q d ∈ (D.coefficientFreeSpan d).baseChange ℝ := by + have hh : e d + q d = coefficients ξ.log (Finsupp.single () (d.val + 1)) - γ d := by + rw [heq] + abel + rw [hh] + exact ((D.coefficientFreeSpan d).baseChange ℝ).sub_mem hξC hγC + have hsumfix := hPfix d (e d + q d) hsum + rw [map_add] at hsumfix + refine ⟨hm d, (hmb d).trans (Real.exp_le_exp.mpr (le_add_of_nonneg_right hΛ)), + hγ, hγC, hPU d _, hPU d _, ?_, ?_, hPgrid d _ hgrid⟩ + · calc + _ = γ d + (e d + q d) := by rw [heq, add_assoc] + _ = γ d + (P d (e d) + P d (q d)) := by rw [hsumfix] + _ = _ := (add_assoc _ _ _).symm + · calc + _ ≤ Real.exp C * ‖(E.basis.baseChange ℝ).equivFun (e d)‖ := hPnorm d _ + _ ≤ Real.exp C * (Real.exp Λ / (N : ℝ) ^ (d.val + 1)) := + mul_le_mul_of_nonneg_left herr (Real.exp_pos _).le + _ = Real.exp (C + Λ) / (N : ℝ) ^ (d.val + 1) := by rw [← mul_div_assoc, ← Real.exp_add] + _ ≤ _ := div_le_div_of_nonneg_right (Real.exp_le_exp.mpr hCL) (pow_nonneg (Nat.cast_nonneg N) _) + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +theorem CoefficientBases.comparison_space_top_frequency + (hfreq : V.frequency = B.freeFrequency D) (n : ℕ) (d : Fin n → Fin s) + (a : FreeMagma (Fin n)) (hd : lieTreeWeight (fun i => (d i).val + 1) a = s) + (hr : a.length = r) (z : Fin n → Fin 2 → D.CoefficientFreeLieAlgebra) + (hz : ∀ i, z i ∈ petalComparisonSpace + ((fourRefinedRelation (D.coefficientFreeSpan (d i)) (D.dependentFreeSpan (d i)) + (D'.coefficientFourSpace ⟨(d i).val + 1, by omega⟩)).map (LinearMap.proj 0)) + (fourPetalSpace (D.dependentFreeSpan (d i)) + (fourRefinedRelation (D.coefficientFreeSpan (d i)) (D.dependentFreeSpan (d i)) + (D'.coefficientFourSpace ⟨(d i).val + 1, by omega⟩))) + (D.coefficientFreeFiltration.layer ((d i).val + 1) 2)) : + pairDifferenceFunctional (B.freeFrequency D) (lieTreeEval z a) = 0 := by + have hC (j : Fin s) : + (fourRefinedRelation (D.coefficientFreeSpan j) (D.dependentFreeSpan j) + (D'.coefficientFourSpace ⟨j.val + 1, by omega⟩)).map (LinearMap.proj 0) ≤ + D.coefficientFreeFiltration.layer (j.val + 1) 1 := + (refined_firstProjection_le_common _ _ (D.dependentFreeSpan_le_coefficientFreeSpan j) _).trans + (D.coefficientFreeSpan_le_layer j) + apply petalComparisonSpace_top_tree D.coefficientFreeFiltration (fun i => (d i).val + 1) + _ _ (fun i => hC (d i)) + (fun i => (fourPetalSpace_le_first _ _).trans (hC (d i))) (B.freeFrequency D) a hd hr _ z hz + intro c p hc hp + apply four_projection_petal_add_invariant + (fun x => B.freeFrequency D (lieTreeEval x a)) + (fun i => fourRefinedRelation (D.coefficientFreeSpan (d i)) (D.dependentFreeSpan (d i)) + (D'.coefficientFourSpace ⟨(d i).val + 1, by omega⟩)) + (B.correlation_refined_four_identity D E T hbQ hT V g hg D' hfreq n d a hd hr) c p hc + exact fun i => ((mem_fourPetalSpace _ _ _).mp (hp i)).2 + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +noncomputable def comparisonCoefficientSpace (d : Fin s) : + Submodule ℚ (Fin 2 → D.CoefficientFreeLieAlgebra) := + petalComparisonSpace + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)) + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))) + (D.coefficientFreeFiltration.layer (d.val + 1) 2) + +theorem comparisonCoefficientSpace_le_layer + (hTfil : T.filtration = D.coefficientFreeFiltration) (d : Fin s) : + D.comparisonCoefficientSpace E T hbQ hT V g hg D' d ≤ + (RationalFilteredNilmanifold.piRank (fun _ : Fin 2 => E) (fun _ => T)).filtration.layer + (d.val + 1) 0 := by + have hC : (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0) ≤ + D.coefficientFreeFiltration.layer (d.val + 1) 1 := + (refined_firstProjection_le_common _ _ (D.dependentFreeSpan_le_coefficientFreeSpan d) _).trans + (D.coefficientFreeSpan_le_layer d) + change petalComparisonSpace _ _ _ ≤ + Submodule.pi Set.univ (fun _ : Fin 2 => T.filtration.layer (d.val + 1) 0) + rw [hTfil, D.coefficientFreeFiltration.rank_zero_eq_one] + exact petalComparisonSpace_le_pi _ _ _ _ hC + ((fourPetalSpace_le_first _ _).trans hC) + (D.coefficientFreeFiltration.lex_antitone (Or.inr ⟨rfl, by omega⟩)) + +include F in +theorem exists_comparisonCoefficientBases + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') : + ∃ B : ∀ d : Fin s, Basis (Fin (finrank ℚ + (D.comparisonCoefficientSpace E T hbQ hT V g hg D' d))) ℚ + (D.comparisonCoefficientSpace E T hbQ hT V g hg D' d), + ∀ d a i, rationalLogHeight ((Pi.basis (fun _ : Fin 2 => E.basis)).repr + (B d a : Fin 2 → D.CoefficientFreeLieAlgebra) i) ≤ sharedFreeComparisonBasisBudget Q P' := by + classical + choose B hB using fun d => D.exists_sharedFreeComparisonSpace_basis E T hbQ hT F V g hg D' + hTfil hs hP' hQP' d + exact ⟨B, hB⟩ + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3 + +noncomputable def nativePairModelConstant (s : ℕ) : ℕ := + (SubspaceFreeLift.exists_native_pair_model.{0, 0} s).choose + +noncomputable def sharedFreeComparisonModelBudget (s : ℕ) (q p : ℝ) : ℝ := + (q + 2 + sharedFreeComparisonBasisBudget q p + nativePairModelConstant s) ^ nativePairModelConstant s + +theorem sharedFreeComparisonBasisBudget_nonneg {q p : ℝ} (hq : 0 ≤ q) (hp : 0 ≤ p) : + 0 ≤ sharedFreeComparisonBasisBudget q p := by + have hA := add_nonneg hq (fourRefinementBasisBudget_nonneg + (add_nonneg hq (coefficientFourHeightBudget_nonneg hp))) + exact add_nonneg hA (preimageBasisBudget_nonneg (mul_nonneg (by norm_num) hA)) + +theorem exists_sharedFreeComparisonModelBudget_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ q p : ℝ, 0 ≤ q → q ≤ p → 0 ≤ p → + sharedFreeComparisonModelBudget s q p ≤ (p + C) ^ C := by + obtain ⟨b, _, hb⟩ := exists_sharedFreeComparisonBasisBudget_bound + let a := nativePairModelConstant s + let K : Polynomial ℕ := Polynomial.X + 2 + (Polynomial.X + Polynomial.C b) ^ b + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((K + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro q p hq hqp hp + have hsmall : q + 2 + sharedFreeComparisonBasisBudget q p + a ≤ + p + 2 + (p + b) ^ b + a := by linarith [hb q p hq hqp hp] + have hzero : 0 ≤ q + 2 + sharedFreeComparisonBasisBudget q p + a := by + have := sharedFreeComparisonBasisBudget_nonneg hq hp + positivity + apply (pow_le_pow_left₀ hzero hsmall a).trans + simpa [K, Polynomial.eval₂_pow] using hbudget p hp + +end Erdos3 + +namespace Erdos3.NativeRankRelation.CommonData + +open Module NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem exists_native_comparison_model + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') : + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + let hS := D.comparisonCoefficientSpace_le_layer E T hbQ hT V g hg D' hTfil + ∃ B : ∀ j, Basis (Fin (finrank ℚ (S j))) ℚ (S j), + (∀ j a i, rationalLogHeight ((Pi.basis (fun _ : Fin 2 => E.basis)).repr + (B j a : Fin 2 → D.CoefficientFreeLieAlgebra) i) ≤ sharedFreeComparisonBasisBudget Q P') ∧ + let φ := SubspaceFreeLift.evaluation S B (piRank (fun _ : Fin 2 => E) (fun _ => T)).filtration hS + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S r) s + (finrank ℚ (SubspaceFreeLift.Algebra S r)), + ∃ U : M.DegreeRankStructure r, + U.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + U.ComplexityLE (sharedFreeComparisonModelBudget s Q P') ∧ IsCentralLieBasis M.basis ∧ + Nonempty (FreeCoordinateFrame M.basis (sharedFreeComparisonModelBudget s Q P')) ∧ + (∀ i j, rationalLogHeight ((pi (fun _ : Fin 2 => E)).basis.repr + (φ (M.basis j)) i) ≤ sharedFreeComparisonModelBudget s Q P') ∧ + M.lattice ≤ (pi (fun _ : Fin 2 => E)).lattice.comap (mapOfSteps + (hL := M.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => E)).filtration.lowerCentralSeries_eq_bot) φ) ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S r) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S r) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 M.basis + ∃ Z : M.UnitVerticalObservable (U.realSubgroup s r) + (Fin W.family.outputDim × Fin W.family.outputDim) (sharedFreeComparisonModelBudget s Q P'), + Z.frequency = (pairDifferenceFunctional V.frequency).comp φ.toLinearMap ∧ + ∀ i x, Z.observable i (QuotientGroup.mk x) = + V.pairedObservable T i (QuotientGroup.mk (realificationMap + (hnil := M.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => E)).filtration.lowerCentralSeries_eq_bot) φ x))) := by + intro S hS + have hQ : 0 ≤ Q := (Nat.cast_nonneg _).trans hT.1.1 + have hH := sharedFreeComparisonBasisBudget_nonneg hQ hP' + let K := Q + 2 + sharedFreeComparisonBasisBudget Q P' + have h2 : 2 ≤ K := by dsimp only [K]; linarith + have hQK : Q ≤ K := by dsimp only [K]; linarith + have hHK : sharedFreeComparisonBasisBudget Q P' ≤ K := by dsimp only [K]; linarith + obtain ⟨B, hB⟩ := D.exists_comparisonCoefficientBases E T hbQ hT F V g hg D' hTfil hs hP' hQP' + refine ⟨B, hB, ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] (Fin 2 → D.CoefficientFreeLieAlgebra)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 2 → D.CoefficientFreeLieAlgebra)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 (Pi.basis (fun _ : Fin 2 => E.basis)) + exact (SubspaceFreeLift.exists_native_pair_model s).choose_spec.2 + D.CoefficientFreeLieAlgebra (Fin W.family.outputDim) r _ E T S B hS K h2 + (hT.mono T hQK) (fun j a i => (hB j a i).trans hHK) (V.mono hQK) + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +theorem exists_native_factored_comparison_orbit + (hTfil : T.filtration = D.coefficientFreeFiltration) (hs : 1 ≤ s) + (A K U : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hA0 : E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 A = 1) + (hK0 : E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 K = 1) + (hU0 : E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 U = 1) + (hA : ∀ d : Fin s, coefficients A.log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + (hK : ∀ d : Fin s, coefficients K.log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ) + (hU : ∀ d : Fin s, coefficients U.log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) : + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + let hS := D.comparisonCoefficientSpace_le_layer E T hbQ hT V g hg D' hTfil + let a : Fin 2 → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1) := ![A * K * U, A] + ∀ (B : ∀ j, Basis (Fin (finrank ℚ (S j))) ℚ (S j)) + (M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S r) s + (finrank ℚ (SubspaceFreeLift.Algebra S r))) (Q' : M.DegreeRankStructure r), + Q'.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree → + let φ := SubspaceFreeLift.evaluation S B + (RationalFilteredNilmanifold.piRank (fun _ : Fin 2 => E) (fun _ => T)).filtration hS + ∃ u : M.filtration.realification.PolynomialOrbit (fun _ : Unit => 1), + M.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 u = 1 ∧ + (∀ j : Fin s, coefficients u.log (Finsupp.single () (j.val + 1)) ∈ + (SubspaceFreeLift.generatorSpan S r j).baseChange ℝ) ∧ + ∀ i x, RationalFilteredNilmanifold.productProjectionHom (fun _ : Fin 2 => E) i + (NilpotentLieBCHGroup.realificationMap (hnil := M.filtration.lowerCentralSeries_eq_bot) + (hM := (RationalFilteredNilmanifold.pi (fun _ : Fin 2 => E)).filtration.lowerCentralSeries_eq_bot) φ + (M.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x u)) = + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x (a i) := by + intro S hS a B M Q' hQ' φ + apply SubspaceFreeLift.exists_native_pair_orbit E T S B hS M Q' hQ' a + · intro i + fin_cases i + · change E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (A * K * U) = 1 + rw [map_mul, map_mul, hA0, hK0, hU0, mul_one, mul_one] + · exact hA0 + · intro j + have h := D.paired_affine_orbit_coefficient_mem_comparison E T hbQ hT V g hg D' + hTfil hs A K U hA hK hU j + have heq : (fun i => coefficients (a i).log (Finsupp.single () (j.val + 1))) = + ![coefficients (A * K * U).log (Finsupp.single () (j.val + 1)), + coefficients A.log (Finsupp.single () (j.val + 1))] := by + funext i + fin_cases i <;> rfl + rw [heq] + exact h + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonOrbit.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..911708c9debcb6fd841c1b76c76f57a1f8dae3b2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeComparisonOrbit.lean @@ -0,0 +1,109 @@ +import OAI.Combinatorics.Progressions.Fourier.SharedFreeFactorizationFrequency + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +theorem paired_affine_orbit_coefficient_mem_comparison + (hTfil : T.filtration = D.coefficientFreeFiltration) (hs : 1 ≤ s) + (A K U : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hA : ∀ d : Fin s, coefficients A.log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + (hK : ∀ d : Fin s, coefficients K.log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ) + (hU : ∀ d : Fin s, coefficients U.log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) + (d : Fin s) : + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 2 => D.CoefficientFreeLieAlgebra)).symm + ![coefficients (A * K * U).log (Finsupp.single () (d.val + 1)), + coefficients A.log (Finsupp.single () (d.val + 1))] ∈ + (petalComparisonSpace + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)) + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))) + (D.coefficientFreeFiltration.layer (d.val + 1) 2)).baseChange ℝ := by + have h₁ := T.polynomialOrbit_mul_coefficient_sub_mem_rank_two hs + (fun _ : Unit => 1) (Finsupp.single () (d.val + 1)) A K + have h₂ := T.polynomialOrbit_mul_coefficient_sub_mem_rank_two hs + (fun _ : Unit => 1) (Finsupp.single () (d.val + 1)) (A * K) U + simp only [Finsupp.weight_single, smul_eq_mul, mul_one] at h₁ h₂ + have herr : coefficients (A * K * U).log (Finsupp.single () (d.val + 1)) - + (coefficients A.log (Finsupp.single () (d.val + 1)) + + coefficients U.log (Finsupp.single () (d.val + 1))) ∈ + (D.coefficientFreeFiltration.layer (d.val + 1) 2).baseChange ℝ := by + rw [← hTfil] + convert ((T.filtration.layer (d.val + 1) 2).baseChange ℝ).add_mem + (((T.filtration.layer (d.val + 1) 2).baseChange ℝ).add_mem h₂ h₁) (hK d) using 1 + abel + have hp : ![coefficients (A * K * U).log (Finsupp.single () (d.val + 1)), + coefficients A.log (Finsupp.single () (d.val + 1))] ∈ + petalComparisonSpace + (((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + ((fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) + ((D.coefficientFreeFiltration.layer (d.val + 1) 2).baseChange ℝ) := by + apply (mem_petalComparisonSpace _ _ _ _).mpr + constructor + · exact Submodule.mem_sup_left (hA d) + · apply Submodule.mem_sup.mpr + refine ⟨_, hU d, _, herr, ?_⟩ + change coefficients U.log (Finsupp.single () (d.val + 1)) + + (coefficients (A * K * U).log (Finsupp.single () (d.val + 1)) - + (coefficients A.log (Finsupp.single () (d.val + 1)) + + coefficients U.log (Finsupp.single () (d.val + 1)))) = + coefficients (A * K * U).log (Finsupp.single () (d.val + 1)) - + coefficients A.log (Finsupp.single () (d.val + 1)) + abel + rw [← realification_petalComparisonSpace] at hp + obtain ⟨y, hy, heq⟩ := hp + have hy' : (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 2 => D.CoefficientFreeLieAlgebra)).symm + ![coefficients (A * K * U).log (Finsupp.single () (d.val + 1)), + coefficients A.log (Finsupp.single () (d.val + 1))] = y := by + rw [← heq] + exact LinearEquiv.symm_apply_apply _ _ + rw [hy'] + exact hy + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeCorrelatedFactorization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeCorrelatedFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..e55db29ef254ce4137e6cd91010e1f2bb6606737 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeCorrelatedFactorization.lean @@ -0,0 +1,220 @@ +import OAI.Combinatorics.Progressions.Dynamics.SharedFreeCorrelationBudget + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s (r + 1) N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B₀ : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure (r + 1)) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s (r + 1)) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem CoefficientBases.exists_correlated_lower_factorization + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B₀.freeFrequency D) + (hs : 2 ≤ s) (hp' : 0 ≤ p') (hP' : 0 ≤ P') (hQP' : Q ≤ P') (hpp' : p' ≤ P') + (hf : ∀ x, ‖f x‖ ≤ 1) + (Hsource : Finset (ZMod N)) (hsource : Hsource.Nonempty) + (hsourceDense : Real.exp (-Q) * Fintype.card (ZMod N) ≤ (Hsource.card : ℝ)) + (hHsource : H' ⊆ Hsource) + (hcorr : ∀ h ∈ Hsource, Nonempty (NativeVectorCorrelation (s - 1) N Q + (W.replacedRankResidual h (fun i x => V.observable i (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) (fun _ => (x.val : ℤ)) (g h))))))) + (ξ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hsplit : ∀ h, g h = ξ * v h) + (hξ : ∀ d : Fin s, coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ + (D.commonFreeSpan d).baseChange ℝ) + (hv : ∀ h (d : Fin s), coefficients (v h).log (Finsupp.single () (d.val + 1)) ∈ + (D.dependentFreeSpan d).baseChange ℝ) + (hN : Real.exp (sharedFreeCorrelationBudget s hs P') ≤ (N : ℝ)) : + let Λ := (P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s + let C := sharedFreeCorrelationBudget s hs P' + let Qc := C + sharedFreeComparisonBasisBudget Q P' + 2 + let Lv := sharedFreePetalLiftBudget s Q P' + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + ∃ J ⊆ H', J.Nonempty ∧ Real.exp (-(Λ + C)) * H'.card ≤ (J.card : ℝ) ∧ + ∃ (r₀ : ℕ) (R₀ : Fin r₀ → ℕ) (η : (Fin r₀ → ℤ) →+ ZMod N) (h₀ : ZMod N) + (Γ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (α : Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (β : Fin r₀ → Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra), + (r₀ : ℝ) ≤ Λ ∧ Set.InjOn η {x | ∀ j, |x j| ≤ (R₀ j : ℤ)} ∧ E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 Γ = 1 ∧ + (∀ d : Fin s, coefficients Γ.log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) ∧ + (∀ d, α d ∈ (D.dependentFreeSpan d).baseChange ℝ ∧ + ‖(E.basis.baseChange ℝ).equivFun (α d)‖ ≤ Real.exp Lv) ∧ + (∀ j d, β j d ∈ (D.dependentFreeSpan d).baseChange ℝ ∧ + ‖(E.basis.baseChange ℝ).equivFun (β j d)‖ ≤ Real.exp Lv) ∧ + ∃ (x : {h // h ∈ J} → Fin r₀ → ℤ) + (A K U : {h // h ∈ J} → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)), + (∀ h : {h // h ∈ J}, + (∀ j, |x h j| ≤ (R₀ j : ℤ)) ∧ h.val = h₀ + η (x h) ∧ + (A h).log = Γ.log + positiveUnivariate (fun d => α d + ∑ j, (x h j : ℝ) • β j d) ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (A h) = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (K h) = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (U h) = 1 ∧ + ∀ d : Fin s, + coefficients (K h).log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ ∧ + coefficients (U h).log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) ∧ + ∃ Δ : Subgroup E.filtration.Group, Δ ≤ E.lattice ∧ + (Δ.subgroupOf E.lattice).Characteristic ∧ (Δ.subgroupOf E.lattice).Normal ∧ + (Δ.subgroupOf E.lattice).FiniteIndex ∧ (Δ.relIndex E.lattice : ℝ) ≤ Real.exp C ∧ + ∃ (l : ℕ) (hl : 0 < l) + (hin : scaledIntegerGrid l ⊆ bchSubgroupCoordinates E.basis Δ) + (hout : bchSubgroupCoordinates E.basis Δ ⊆ denominatorGrid l), + (T.withLattice Δ l hl hin hout).ComplexityLE C ∧ + ∃ V₁ : (E.withLattice Δ l hl hin hout).UnitVerticalObservable + ((T.withLattice Δ l hl hin hout).realSubgroup s (r + 1)) (Fin W.family.outputDim) C, + V₁.frequency = V.frequency ∧ + (∀ h : {h // h ∈ J}, Nonempty (NativeVectorCorrelation (s - 1) N C + (W.replacedRankResidual h.val (fun i z => V₁.observable i (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) + (fun _ => (z.val : ℤ)) (A h * K h * U h))))))) ∧ + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S (r + 1)) s + (finrank ℚ (SubspaceFreeLift.Algebra S (r + 1))), + ∃ Tm : M.DegreeRankStructure (r + 1), + Tm.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + Tm.ComplexityLE ((Qc + nativePairModelConstant s) ^ nativePairModelConstant s) ∧ + M.HasLowerRankOrbitFamily Tm (fun _ : Unit => 1) + (fun h (i : Fin W.family.outputDim × Fin W.family.outputDim) z => + V₁.observable i.1 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) z (A h * K h * U h))) * + star (V₁.observable i.2 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) z (A h))))) + (nativeLowerPairModelBudget s Qc) := by + intro Λ C Qc Lv S + classical + let P₀ := sharedFreeCorrelationInput s P' + have hQ0 : 0 ≤ Q := (Nat.cast_nonneg _).trans hT.1.1 + obtain ⟨hP₀, hQP₀, hΛP₀, hdenP₀, hslowP₀, hperiodP₀⟩ := + sharedFreeCorrelationInput_bounds s hQ0 hQP' hP' + have hP₀C : P₀ ≤ C := sharedFreeCorrelationInput_le_budget s hs hP' + have hC0 : 0 ≤ C := (show 0 ≤ P₀ by linarith).trans hP₀C + obtain ⟨D₁, _, _, J, hJH, hJ, hcard, r₀, R₀, η, h₀, m, Γ, α, β, + hrank, hproper, hm, hmb, hΓ0, hΓ, hα, hβ, x, ε, A, K, U, ρ, hdata, hperiod, _⟩ := + B₀.exists_shared_free_lower_factorization D E T hbQ hT F V g hg D' + hTfil hfreq hs hp' hP' hQP' hpp' ξ v hsplit hξ hv + ((Real.exp_le_exp.mpr (hΛP₀.trans hP₀C)).trans hN) + obtain ⟨M₀, hM₀, hM₀b, hperiod, _⟩ := hperiod + let X := W.replaceRank E T hbQ hT V g hg Hsource hsource hsourceDense hcorr + let ε' (h : ZMod N) := if hh : h ∈ J then ε ⟨h, hh⟩ else 1 + let a' (h : ZMod N) := if hh : h ∈ J then A ⟨h, hh⟩ * K ⟨h, hh⟩ * U ⟨h, hh⟩ else 1 + let ρ' (h : ZMod N) := if hh : h ∈ J then ρ ⟨h, hh⟩ else 1 + have hprod' (h : ZMod N) (hh : h ∈ J) : ε' h * a' h * ρ' h = X.family.orbit h := by + rcases hdata ⟨h, hh⟩ with ⟨_, _, _, _, _, _, _, _, _, _, hprod, _⟩ + change ε' h * a' h * ρ' h = g h + simp only [ε', a', ρ', dite_eq_left hh] + simpa only [mul_assoc] using hprod + have hε' (h : ZMod N) (hh : h ∈ J) : + CoefficientBound (E.basis.baseChange ℝ) (fun _ : Unit => (N : ℝ)) + (Real.exp ((P₀ + 2) ^ 1)) (ε' h).log := by + rcases hdata ⟨h, hh⟩ with ⟨_, _, _, _, _, _, _, _, hε, _, _, _⟩ + simp only [ε', dite_eq_left hh] + exact CoefficientBound.mono _ _ (fun _ => Nat.cast_pos.mpr (NeZero.pos N)) hε hslowP₀ + have hρ' (h : ZMod N) (hh : h ∈ J) : CoefficientGrid (E.basis.baseChange ℝ) m (ρ' h).log := by + rcases hdata ⟨h, hh⟩ with ⟨_, _, _, _, _, _, _, _, _, hρ, _, _⟩ + simpa only [ρ', dite_eq_left hh] using hρ + have hperiod' (h : ZMod N) (hh : h ∈ J) (z z' : Unit → ℤ) + (hres : ∀ j, (M₀ : ℤ) ∣ z j - z' j) : + (QuotientGroup.mk (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) z (ρ' h)) : E.Space) = + QuotientGroup.mk (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) z' (ρ' h)) := by + simpa only [ρ', dite_eq_left hh] using (hperiod ⟨h, hh⟩ z z' hres).1 + obtain ⟨Δ, hΔ, hchar, hnormal, hfinite, hindex, l, hl, hin, hout, + hRank, J₂, hsub, hJ₂, hdense, V₁, hfreq₁, hcorr₁⟩ := + (exists_shared_factor_correlations s hs).choose_spec.2 X hf hP₀ hQP₀ m M₀ hm + (hmb.trans (Real.exp_le_exp.mpr hdenP₀)) hM₀ + (hM₀b.trans (Real.exp_le_exp.mpr hperiodP₀)) J + (fun h hh => hHsource (hJH hh)) hJ ε' a' ρ' hprod' hε' hρ' hperiod' hN + let lift (h : {h // h ∈ J₂}) : {h // h ∈ J} := ⟨h.val, hsub h.property⟩ + refine ⟨J₂, (fun h hh => hJH (hsub hh)), hJ₂, ?_, r₀, R₀, η, h₀, Γ, α, β, + hrank, hproper, hΓ0, hΓ, hα, hβ, (fun h => x (lift h)), (fun h => A (lift h)), + (fun h => K (lift h)), (fun h => U (lift h)), ?_, Δ, hΔ, hchar, hnormal, hfinite, + hindex, l, hl, hin, hout, hRank, V₁, hfreq₁, ?_, ?_⟩ + · calc + _ = Real.exp (-C) * (Real.exp (-Λ) * H'.card) := by + rw [← mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ Real.exp (-C) * J.card := mul_le_mul_of_nonneg_left hcard (Real.exp_pos _).le + _ ≤ _ := hdense + · intro h + rcases hdata (lift h) with ⟨hx, hs, hA, _, hA0, hK0, hU0, _, _, _, _, hKU⟩ + exact ⟨hx, hs, hA, hA0, hK0, hU0, hKU⟩ + · intro h + have hc := hcorr₁ h.val h.property + change Nonempty (NativeVectorCorrelation (s - 1) N C + (W.replacedRankResidual h.val (fun i z => V₁.observable i (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) (fun _ => (z.val : ℤ)) (a' h.val)))))) at hc + have ha : a' h.val = A (lift h) * K (lift h) * U (lift h) := by + simp only [a', dite_eq_left (hsub h.property), lift] + rw [ha] at hc + exact hc + · apply B₀.exists_covered_factored_family D E T hbQ hT F V g hg D' + hTfil hfreq hs hP' hQP' Δ l hl hin hout hC0 hRank V₁ hfreq₁ + (fun h => A (lift h)) (fun h => K (lift h)) (fun h => U (lift h)) + · intro h + rcases hdata (lift h) with ⟨_, _, _, _, hA0, _, _, _, _, _, _, _⟩ + exact hA0 + · intro h + rcases hdata (lift h) with ⟨_, _, _, _, _, hK0, _, _, _, _, _, _⟩ + exact hK0 + · intro h + rcases hdata (lift h) with ⟨_, _, _, _, _, _, hU0, _, _, _, _, _⟩ + exact hU0 + · intro h d + rcases hdata (lift h) with ⟨_, _, hA, _, _, _, _, _, _, _, _, _⟩ + rw [hA] + exact affine_refined_coefficient_mem D.coefficientFreeSpan D.dependentFreeSpan + (fun d : Fin s => D'.coefficientFourSpace ⟨d.val + 1, by omega⟩) + Γ.log α β (fun j => (x (lift h) j : ℝ)) hΓ (fun d => (hα d).1) (fun j d => (hβ j d).1) d + · intro h d + rcases hdata (lift h) with ⟨_, _, _, _, _, _, _, _, _, _, _, hKU⟩ + exact (hKU d).1 + · intro h d + rcases hdata (lift h) with ⟨_, _, _, _, _, _, _, _, _, _, _, hKU⟩ + exact (hKU d).2 + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeFrozenComparison.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeFrozenComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..86e6b21ce2c933aedd5e28fe809bd81b11e0b967 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeFrozenComparison.lean @@ -0,0 +1,423 @@ +import OAI.Combinatorics.Progressions.Dynamics.SharedFreeLowerComparisonBudget + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def nativeLowerPairModelBudget (s : ℕ) (p : ℝ) : ℝ := + ((p + nativePairModelConstant s) ^ nativePairModelConstant s + rankUnitDescentConstant s) ^ + rankUnitDescentConstant s + +theorem exists_nativeLowerPairModelBudget_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → + (p + nativePairModelConstant s) ^ nativePairModelConstant s ≤ (p + C) ^ C ∧ + nativeLowerPairModelBudget s p ≤ (p + C) ^ C := by + let a := nativePairModelConstant s + let b := rankUnitDescentConstant s + let A : Polynomial ℕ := (Polynomial.X + Polynomial.C a) ^ a + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (A + (A + Polynomial.C b) ^ b) + refine ⟨C, hC, ?_⟩ + intro p hp + have ha : 0 ≤ (p + a) ^ a := by positivity + have hb : 0 ≤ ((p + a) ^ a + b) ^ b := by positivity + have hsum : (p + a) ^ a + ((p + a) ^ a + b) ^ b ≤ (p + C) ^ C := by + simpa [A, Polynomial.eval₂_pow] using hbudget p hp + exact ⟨(le_add_of_nonneg_right hb).trans hsum, (le_add_of_nonneg_left ha).trans hsum⟩ + +end Erdos3 + +namespace Erdos3.SubspaceFreeLift + +open Module NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +theorem exists_uniform_lower_pair_model {L I : Type} [LieRing L] [LieAlgebra ℚ L] [Fintype I] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {s r d : ℕ} (D : RationalFilteredNilmanifold L s d) (T : D.DegreeRankStructure (r + 1)) + (S : Fin s → Submodule ℚ (Fin 2 → L)) + (B : ∀ j, Basis (Fin (finrank ℚ (S j))) ℚ (S j)) + (hS : ∀ j, S j ≤ (piRank (fun _ : Fin 2 => D) (fun _ => T)).filtration.layer (j.val + 1) 0) + {p : ℝ} (hp : 2 ≤ p) (hT : T.ComplexityLE p) + (hB : ∀ j a i, rationalLogHeight ((Pi.basis (fun _ : Fin 2 => D.basis)).repr + (B j a : Fin 2 → L) i) ≤ p) + (V : D.UnitVerticalObservable (T.realSubgroup s (r + 1)) I p) + (hzero : ∀ x ∈ (filtration S T.filtration.rank_le_degree).layer s (r + 1), + pairDifferenceFunctional V.frequency + (evaluation S B (piRank (fun _ : Fin 2 => D) (fun _ => T)).filtration hS x) = 0) : + let pM := (p + nativePairModelConstant s) ^ nativePairModelConstant s + let φ := evaluation S B (piRank (fun _ : Fin 2 => D) (fun _ => T)).filtration hS + ∃ M : RationalFilteredNilmanifold (Algebra S (r + 1)) s (finrank ℚ (Algebra S (r + 1))), + ∃ U : M.DegreeRankStructure (r + 1), + U.filtration = filtration S T.filtration.rank_le_degree ∧ U.ComplexityLE pM ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] Algebra S (r + 1)) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] Algebra S (r + 1)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 M.basis + ∃ Z : M.UnitVerticalObservable (U.realSubgroup s (r + 1)) (I × I) pM, + (∀ i x, Z.observable i (QuotientGroup.mk x) = + V.pairedObservable T i (QuotientGroup.mk (realificationMap + (hnil := M.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => D)).filtration.lowerCentralSeries_eq_bot) φ x))) ∧ + M.HasUniformLowerRankUnitFamily U Z.observable (fun _ : Unit => 1) + (nativeLowerPairModelBudget s p)) := by + intro pM φ + let := moduleTopology ℝ (ℝ ⊗[ℚ] (Fin 2 → L)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 2 → L)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 (Pi.basis (fun _ : Fin 2 => D.basis)) + obtain ⟨M, U, hU, hUc, _, _, _, _, hZ⟩ := + (exists_native_pair_model.{0, 0} s).choose_spec.2 L I (r + 1) d D T S B hS p hp hT hB V + refine ⟨M, U, hU, hUc, ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] Algebra S (r + 1)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] Algebra S (r + 1)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 M.basis + obtain ⟨Z, hfreq, hobs⟩ := hZ + refine ⟨Z, hobs, ?_⟩ + have hZzero : ∀ x ∈ U.filtration.layer s (r + 1), Z.frequency x = 0 := by + intro x hx + rw [hfreq] + exact hzero x (by simpa only [hU] using hx) + exact UnitVerticalObservable.hasUniformLowerRankUnitFamily M U Z (fun _ : Unit => 1) + ((Nat.cast_nonneg _).trans hUc.1.1) hUc hZzero + +end Erdos3.SubspaceFreeLift + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s (r + 1) N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B₀ : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure (r + 1)) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s (r + 1)) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem CoefficientBases.exists_covered_comparison + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B₀.freeFrequency D) + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') + (Λ : Subgroup E.filtration.Group) (m : ℕ) (hm : 0 < m) + (hin : scaledIntegerGrid m ⊆ bchSubgroupCoordinates E.basis Λ) + (hout : bchSubgroupCoordinates E.basis Λ ⊆ denominatorGrid m) + {p₁ : ℝ} (hp₁ : 0 ≤ p₁) (hT₁ : (T.withLattice Λ m hm hin hout).ComplexityLE p₁) + (V₁ : (E.withLattice Λ m hm hin hout).UnitVerticalObservable + ((T.withLattice Λ m hm hin hout).realSubgroup s (r + 1)) (Fin W.family.outputDim) p₁) + (hV₁ : V₁.frequency = V.frequency) : + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + let hS := D.comparisonCoefficientSpace_le_layer E T hbQ hT V g hg D' hTfil + let q₁ := p₁ + sharedFreeComparisonBasisBudget Q P' + 2 + let E₁ := E.withLattice Λ m hm hin hout + let T₁ := T.withLattice Λ m hm hin hout + let pM := (q₁ + nativePairModelConstant s) ^ nativePairModelConstant s + ∃ J : ∀ j, Basis (Fin (finrank ℚ (S j))) ℚ (S j), + (∀ j a i, rationalLogHeight ((Pi.basis (fun _ : Fin 2 => E.basis)).repr + (J j a : Fin 2 → D.CoefficientFreeLieAlgebra) i) ≤ sharedFreeComparisonBasisBudget Q P') ∧ + let φ := SubspaceFreeLift.evaluation S J (piRank (fun _ : Fin 2 => E₁) (fun _ => T₁)).filtration hS + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S (r + 1)) s + (finrank ℚ (SubspaceFreeLift.Algebra S (r + 1))), + ∃ U : M.DegreeRankStructure (r + 1), + U.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + U.ComplexityLE pM ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 M.basis + ∃ Z : M.UnitVerticalObservable (U.realSubgroup s (r + 1)) + (Fin W.family.outputDim × Fin W.family.outputDim) pM, + (∀ i x, Z.observable i (QuotientGroup.mk x) = + V₁.pairedObservable T₁ i (QuotientGroup.mk (realificationMap + (hnil := M.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => E₁)).filtration.lowerCentralSeries_eq_bot) φ x))) ∧ + M.HasUniformLowerRankUnitFamily U Z.observable (fun _ : Unit => 1) + (nativeLowerPairModelBudget s q₁)) := by + intro S hS q₁ E₁ T₁ pM + have hQ : 0 ≤ Q := (Nat.cast_nonneg _).trans hT.1.1 + have hB := sharedFreeComparisonBasisBudget_nonneg hQ hP' + have hq : 2 ≤ q₁ := by dsimp only [q₁]; linarith + have hpq : p₁ ≤ q₁ := by dsimp only [q₁]; linarith + have hBq : sharedFreeComparisonBasisBudget Q P' ≤ q₁ := by dsimp only [q₁]; linarith + obtain ⟨J, hJ⟩ := D.exists_comparisonCoefficientBases E T hbQ hT F V g hg D' + hTfil hs hP' hQP' + refine ⟨J, hJ, ?_⟩ + apply SubspaceFreeLift.exists_uniform_lower_pair_model E₁ T₁ S J hS hq + (hT₁.mono T₁ hpq) (fun j a i => (hJ j a i).trans hBq) (V₁.mono hpq) + intro x hx + change pairDifferenceFunctional V₁.frequency + (SubspaceFreeLift.evaluation S J (piRank (fun _ : Fin 2 => E) (fun _ => T)).filtration hS x) = 0 + rw [hV₁] + exact B₀.comparison_free_top_frequency D E T hbQ hT V g hg D' hTfil hfreq J x hx + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s (r + 1) N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B₀ : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure (r + 1)) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s (r + 1)) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem CoefficientBases.exists_covered_factored_family {τ : Type*} + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B₀.freeFrequency D) + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') + (Λ : Subgroup E.filtration.Group) (m : ℕ) (hm : 0 < m) + (hin : scaledIntegerGrid m ⊆ bchSubgroupCoordinates E.basis Λ) + (hout : bchSubgroupCoordinates E.basis Λ ⊆ denominatorGrid m) + {p₁ : ℝ} (hp₁ : 0 ≤ p₁) (hT₁ : (T.withLattice Λ m hm hin hout).ComplexityLE p₁) + (V₁ : (E.withLattice Λ m hm hin hout).UnitVerticalObservable + ((T.withLattice Λ m hm hin hout).realSubgroup s (r + 1)) (Fin W.family.outputDim) p₁) + (hV₁ : V₁.frequency = V.frequency) + (A K U : τ → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hA0 : ∀ t, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (A t) = 1) + (hK0 : ∀ t, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (K t) = 1) + (hU0 : ∀ t, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (U t) = 1) + (hA : ∀ t (d : Fin s), coefficients (A t).log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + (hK : ∀ t (d : Fin s), coefficients (K t).log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ) + (hU : ∀ t (d : Fin s), coefficients (U t).log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) : + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + let q₁ := p₁ + sharedFreeComparisonBasisBudget Q P' + 2 + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S (r + 1)) s + (finrank ℚ (SubspaceFreeLift.Algebra S (r + 1))), + ∃ Tm : M.DegreeRankStructure (r + 1), + Tm.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + Tm.ComplexityLE ((q₁ + nativePairModelConstant s) ^ nativePairModelConstant s) ∧ + M.HasLowerRankOrbitFamily Tm (fun _ : Unit => 1) + (fun t (i : Fin W.family.outputDim × Fin W.family.outputDim) x => + V₁.observable i.1 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x (A t * K t * U t))) * + star (V₁.observable i.2 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x (A t))))) + (nativeLowerPairModelBudget s q₁) := by + intro S q₁ + let E₁ := E.withLattice Λ m hm hin hout + let T₁ := T.withLattice Λ m hm hin hout + obtain ⟨J, _, M, Tm, hTm, hTmc, hZ⟩ := + B₀.exists_covered_comparison D E T hbQ hT F V g hg D' + hTfil hfreq hs hP' hQP' Λ m hm hin hout hp₁ hT₁ V₁ hV₁ + refine ⟨M, Tm, hTm, hTmc, ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 M.basis + obtain ⟨Z, hobs, huniform⟩ := hZ + apply huniform.realizeFamily + intro t + obtain ⟨u, hu0, _, hu⟩ := D.exists_native_factored_comparison_orbit E T hbQ hT V g hg D' + hTfil (by omega) (A t) (K t) (U t) (hA0 t) (hK0 t) (hU0 t) (hA t) (hK t) (hU t) + J M Tm hTm + refine ⟨u, hu0, ?_⟩ + intro i x + exact SubspaceFreeLift.native_pair_observable_eval E₁ T₁ S J + (D.comparisonCoefficientSpace_le_layer E T hbQ hT V g hg D' hTfil) + M Tm V₁ Z hobs ![A t * K t * U t, A t] u hu i x + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3 + +noncomputable def sharedFreeFrozenCoverBudget (s : ℕ) (p : ℝ) : ℝ := + (p + (RationalFilteredNilmanifold.exists_shared_frozen_unit_observable.{0, 0, 0} s 1).choose) ^ + (RationalFilteredNilmanifold.exists_shared_frozen_unit_observable.{0, 0, 0} s 1).choose + +end Erdos3 + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s (r + 1) N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B₀ : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure (r + 1)) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s (r + 1)) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem CoefficientBases.exists_frozen_comparison {τ : Type} + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B₀.freeFrequency D) + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') (hf : ∀ x, ‖f x‖ ≤ 1) + {pF ε : ℝ} (hpF : 0 ≤ pF) (hQF : Q ≤ pF) (hε : 0 < ε) (hεF : 1 / ε ≤ Real.exp pF) + (q₀ : ℕ) (hq₀ : 0 < q₀) (hqF : (q₀ : ℝ) ≤ Real.exp pF) + (J₀ : Finset τ) (hJ₀ : J₀.Nonempty) (a u : τ → E.RealGroup) + (ha : ∀ t ∈ J₀, ∀ i, |(E.basis.baseChange ℝ).repr (a t).coord i| ≤ Real.exp ((pF + 2) ^ 1)) + (hu : ∀ t ∈ J₀, ∀ i, |(E.basis.baseChange ℝ).repr (u t).coord i| ≤ Real.exp ((pF + 2) ^ 1)) + (hugrid : ∀ t ∈ J₀, (E.basis.baseChange ℝ).equivFun (u t).coord ∈ realDenominatorGrid q₀) + (A K U : τ → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hA0 : ∀ t ∈ J₀, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (A t) = 1) + (hK0 : ∀ t ∈ J₀, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (K t) = 1) + (hU0 : ∀ t ∈ J₀, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (U t) = 1) + (hA : ∀ t ∈ J₀, ∀ d : Fin s, coefficients (A t).log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + (hK : ∀ t ∈ J₀, ∀ d : Fin s, coefficients (K t).log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ) + (hU : ∀ t ∈ J₀, ∀ d : Fin s, coefficients (U t).log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) : + let p₁ := sharedFreeFrozenCoverBudget s pF + let q₁ := p₁ + sharedFreeComparisonBasisBudget Q P' + 2 + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + ∃ Λ : Subgroup E.filtration.Group, Λ ≤ E.lattice ∧ + (Λ.subgroupOf E.lattice).Characteristic ∧ (Λ.subgroupOf E.lattice).Normal ∧ + (Λ.subgroupOf E.lattice).FiniteIndex ∧ (Λ.relIndex E.lattice : ℝ) ≤ Real.exp p₁ ∧ + ∃ (m : ℕ) (hm : 0 < m) + (hin : scaledIntegerGrid m ⊆ bchSubgroupCoordinates E.basis Λ) + (hout : bchSubgroupCoordinates E.basis Λ ⊆ denominatorGrid m), + (T.withLattice Λ m hm hin hout).ComplexityLE p₁ ∧ + ∃ J : Finset τ, J ⊆ J₀ ∧ J.Nonempty ∧ Real.exp (-p₁) * J₀.card ≤ (J.card : ℝ) ∧ + ∃ V₁ : (E.withLattice Λ m hm hin hout).UnitVerticalObservable + ((T.withLattice Λ m hm hin hout).realSubgroup s (r + 1)) (Fin W.family.outputDim) p₁, + V₁.frequency = V.frequency ∧ + (∀ t ∈ J, ∀ i (b c : E.RealGroup), + ‖V.observable i (QuotientGroup.mk (a t * b * u t)) - + ∑ j, (V₁.observable i (QuotientGroup.mk b) * + star (V₁.observable j (QuotientGroup.mk c))) * + V₁.observable j (QuotientGroup.mk c)‖ ≤ (V.lipBound : ℝ) * ε) ∧ + (∀ t ∈ J, ∀ (h : ZMod N) (v : ZMod N → E.RealGroup) (pC : ℝ), + (V.lipBound : ℝ) * ε ≤ Real.exp (-(2 * pC)) / 2 → + Nonempty (NativeVectorCorrelation (s - 1) N pC + (W.replacedRankResidual h (fun i x => V.observable i + (QuotientGroup.mk (a t * v x * u t))))) → + Nonempty (NativeVectorCorrelation (s - 1) N (pC + 1) + (W.replacedRankResidual h (fun i x => V₁.observable i + (QuotientGroup.mk (v x)))))) ∧ + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S (r + 1)) s + (finrank ℚ (SubspaceFreeLift.Algebra S (r + 1))), + ∃ Tm : M.DegreeRankStructure (r + 1), + Tm.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + Tm.ComplexityLE ((q₁ + nativePairModelConstant s) ^ nativePairModelConstant s) ∧ + M.HasLowerRankOrbitFamily Tm (fun _ : Unit => 1) + (fun (t : {t // t ∈ J}) (i : Fin W.family.outputDim × Fin W.family.outputDim) x => + V₁.observable i.1 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x + (A t.val * K t.val * U t.val))) * + star (V₁.observable i.2 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x (A t.val))))) + (nativeLowerPairModelBudget s q₁) := by + intro p₁ q₁ S + obtain ⟨Λ, hΛ, hchar, hnormal, hfinite, hindex, m, hm, hin, hout, + hT₁, J, hsub, hJ, hdense, V₁, hV₁, happ⟩ := + (RationalFilteredNilmanifold.exists_shared_frozen_unit_observable.{0, 0, 0} s 1).choose_spec.2 + E T hpF (hT.mono T hQF) hε hεF q₀ hq₀ hqF (V.mono hQF) J₀ a u hJ₀ ha hu hugrid + refine ⟨Λ, hΛ, hchar, hnormal, hfinite, hindex, m, hm, hin, hout, + hT₁, J, hsub, hJ, hdense, V₁, hV₁, ?_, ?_, ?_⟩ + · intro t ht i b c + rw [← complex_unit_vector_resolution (fun j => V₁.observable j (QuotientGroup.mk c)) + (V₁.unit (QuotientGroup.mk c)) (V₁.observable i (QuotientGroup.mk b))] + exact happ t ht i b + · intro t ht h v pC hsmall hcorr + obtain ⟨C⟩ := hcorr + apply C.exists_of_uniform_approx + intro ij x + exact (W.replacedRankResidual_norm_sub_le hf h _ _ ij x).trans + ((happ t ht ij.2 (v x)).trans hsmall) + · exact B₀.exists_covered_factored_family D E T hbQ hT F V g hg D' + hTfil hfreq hs hP' hQP' Λ m hm hin hout ((Nat.cast_nonneg _).trans hT₁.1.1) hT₁ V₁ hV₁ + (fun t : {t // t ∈ J} => A t.val) (fun t : {t // t ∈ J} => K t.val) + (fun t : {t // t ∈ J} => U t.val) + (fun t => hA0 t.val (hsub t.property)) (fun t => hK0 t.val (hsub t.property)) + (fun t => hU0 t.val (hsub t.property)) (fun t => hA t.val (hsub t.property)) + (fun t => hK t.val (hsub t.property)) (fun t => hU t.val (hsub t.property)) + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeLowerFactorization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeLowerFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..92ac2768f24dc210854e09968fd6c0922f04b973 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeLowerFactorization.lean @@ -0,0 +1,686 @@ +import OAI.Combinatorics.Progressions.Dynamics.SharedFreeFullOrbitBudget +import OAI.Combinatorics.Progressions.Dynamics.SharedFreeLowerComparisonBudget +import OAI.Combinatorics.Progressions.Lattices.AffineRefinedCoefficients +import OAI.Combinatorics.Progressions.Polynomial.PolynomialOrbitLogSum +import OAI.Combinatorics.Progressions.Polynomial.SharedFreeCommonPolynomialCorrections + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial CyclicCrootSisask +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem exists_shared_free_full_orbit_factorization + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hs : 2 ≤ s) (hp' : 0 ≤ p') (hP' : 0 ≤ P') (hQP' : Q ≤ P') (hpp' : p' ≤ P') + (ξ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hsplit : ∀ h, g h = ξ * v h) + (hξ : ∀ d : Fin s, coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ + (D.commonFreeSpan d).baseChange ℝ) + (hv : ∀ h (d : Fin s), coefficients (v h).log (Finsupp.single () (d.val + 1)) ∈ + (D.dependentFreeSpan d).baseChange ℝ) + (hN : Real.exp ((P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s) ≤ (N : ℝ)) : + let B := (P' + 2) ^ 3 + 2 * P' + let Λ := (P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s + let Lc := sharedFreeCommonCorrectionBudget s Q P' + let Lv := sharedFreePetalLiftBudget s Q P' + ∃ D₁ : R'.CommonData B, D₁.quadruples ⊆ D'.quadruples ∧ D₁.spaces = D'.spaces ∧ + ∃ J ⊆ H', J.Nonempty ∧ Real.exp (-Λ) * H'.card ≤ (J.card : ℝ) ∧ + ∃ (r₀ : ℕ) (R₀ : Fin r₀ → ℕ) (η : (Fin r₀ → ℤ) →+ ZMod N) (h₀ : ZMod N) + (m : ℕ) (Γ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (α : Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (β : Fin r₀ → Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra), + (r₀ : ℝ) ≤ Λ ∧ Set.InjOn η {x | ∀ j, |x j| ≤ (R₀ j : ℤ)} ∧ 0 < m ∧ (m : ℝ) ≤ Real.exp ((s : ℝ) * (Lc + Lv)) ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 Γ = 1 ∧ + (∀ d : Fin s, coefficients Γ.log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) ∧ + (∀ d, α d ∈ (D.dependentFreeSpan d).baseChange ℝ ∧ + ‖(E.basis.baseChange ℝ).equivFun (α d)‖ ≤ Real.exp Lv) ∧ + (∀ j d, β j d ∈ (D.dependentFreeSpan d).baseChange ℝ ∧ + ‖(E.basis.baseChange ℝ).equivFun (β j d)‖ ≤ Real.exp Lv) ∧ + ∀ h ∈ J, ∃ x : Fin r₀ → ℤ, + (∀ j, |x j| ≤ (R₀ j : ℤ)) ∧ h = h₀ + η x ∧ + ∃ ε A K U ρ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1), + A.log = Γ.log + positiveUnivariate (fun d => α d + ∑ j, (x j : ℝ) • β j d) ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 ε = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 A = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 K = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 U = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 ρ = 1 ∧ + CoefficientBound (E.basis.baseChange ℝ) (fun _ : Unit => (N : ℝ)) + (Real.exp Lc + Real.exp Lv) ε.log ∧ + CoefficientGrid (E.basis.baseChange ℝ) m ρ.log ∧ + ε * A * K * U * ρ = g h ∧ + ∀ d : Fin s, + coefficients K.log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ ∧ + coefficients U.log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ := by + intro B Λ Lc Lv + classical + obtain ⟨mc, Γ, εc, ρc, hmc, hmcb, hΓ0, hεc0, hρc0, hεc, hρc, hcommon⟩ := + D.exists_shared_free_common_polynomial_corrections E T hbQ hT F V g hg D' + hTfil hs hp' hP' hQP' hpp' ξ v hsplit hξ hv hN + obtain ⟨D₁, hsub, hspaces, J, hJH, hJ, hcard, r₀, R₀, η, h₀, mv, α, β, + hrank, hproper, hmv, hmvb, hα, hβ, hfamily⟩ := + D.exists_shared_free_affine_orbit_family E T hbQ hT F V g hg D' + hTfil hs hp' hP' hQP' hpp' ξ v hsplit hξ hv hN + let m := mc * mv + have hm : 0 < m := Nat.mul_pos hmc hmv + have hmcdiv : mc ∣ m := ⟨mv, rfl⟩ + have hmvdiv : mv ∣ m := ⟨mc, Nat.mul_comm _ _⟩ + have hmb : (m : ℝ) ≤ Real.exp ((s : ℝ) * (Lc + Lv)) := by + change ((mc * mv : ℕ) : ℝ) ≤ _ + rw [Nat.cast_mul] + calc + _ ≤ Real.exp ((s : ℝ) * Lc) * Real.exp ((s : ℝ) * Lv) := + mul_le_mul hmcb hmvb (Nat.cast_nonneg _) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hρcM : CoefficientGrid (E.basis.baseChange ℝ) m ρc.log := + fun a => realDenominatorGrid_subset_of_dvd hmc hmcdiv (hρc a) + refine ⟨D₁, hsub, hspaces, J, hJH, hJ, hcard, r₀, R₀, η, h₀, m, Γ, α, β, + hrank, hproper, hm, hmb, hΓ0, (fun d => (hcommon d).1), hα, hβ, ?_⟩ + intro h hh + obtain ⟨x, hx, hspace, Av, εv, ρv, U, hAv, hAv0, hεv0, hρv0, hU0, + hεv, hρv, hdependent⟩ := hfamily h hh + let ε := εc.logSum εv + let ρ := ρc.logSum ρv + let A := Γ.logSum Av + have hε0 := εc.logSum_normalized εv hεc0 hεv0 + have hρ0 := ρc.logSum_normalized ρv hρc0 hρv0 + have hA0 := Γ.logSum_normalized Av hΓ0 hAv0 + have hρvM : CoefficientGrid (E.basis.baseChange ℝ) m ρv.log := + fun a => realDenominatorGrid_subset_of_dvd hmv hmvdiv (hρv a) + have hcoeff (d : Fin s) : coefficients (g h).log (Finsupp.single () (d.val + 1)) - + (coefficients ε.log (Finsupp.single () (d.val + 1)) + + coefficients A.log (Finsupp.single () (d.val + 1)) + + coefficients U.log (Finsupp.single () (d.val + 1)) + + coefficients ρ.log (Finsupp.single () (d.val + 1))) ∈ + (T.filtration.layer (Finsupp.weight (fun _ : Unit => 1) + (Finsupp.single () (d.val + 1))) 2).baseChange ℝ := by + have hp := T.polynomialOrbit_mul_coefficient_sub_mem_rank_two (by omega) + (fun _ : Unit => 1) (Finsupp.single () (d.val + 1)) ξ (v h) + rw [← hsplit h, (hcommon d).2, (hdependent d).2] at hp + convert hp using 1 + simp only [ε, ρ, A, NilpotentLieFiltration.PolynomialOrbit.logSum_log, + map_add, Finsupp.add_apply] + abel + obtain ⟨K, hK0, hprod, hK⟩ := T.exists_polynomialOrbit_factorization_rank_two (by omega) + (fun _ : Unit => 1) (fun d : Fin s => Finsupp.single () (d.val + 1)) + (g h) ε A U ρ (hg h) hε0 hA0 hU0 hρ0 hcoeff + refine ⟨x, hx, hspace, ε, A, K, U, ρ, ?_, hε0, hA0, hK0, hU0, hρ0, + CoefficientBound.add _ _ hεc hεv, CoefficientGrid.add _ _ hρcM hρvM, hprod, ?_⟩ + · exact congrArg (fun z => Γ.log + z) hAv + · intro d + exact ⟨by simpa only [Finsupp.weight_single, smul_eq_mul, mul_one] using hK d, + (hdependent d).1⟩ + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open VectorPolynomial +open scoped TensorProduct NNReal + +theorem exists_sharedFreeFactorFreezing (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L : Type*} [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} (D : RationalFilteredNilmanifold L s d) {q p : ℝ}, + 0 ≤ q → q ≤ p → 0 ≤ p → D.GeometryComplexityLE q → + ∀ m : ℕ, 0 < m → + (m : ℝ) ≤ Real.exp ((s : ℝ) * + (sharedFreeCommonCorrectionBudget s q p + sharedFreePetalLiftBudget s q p)) → + ∃ M : ℕ, 0 < M ∧ (M : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + (∀ ρ : D.filtration.realification.PolynomialOrbit (fun _ : Unit => 1), + CoefficientGrid (D.basis.baseChange ℝ) m ρ.log → + ∀ x y : Unit → ℤ, (∀ j, (M : ℤ) ∣ x j - y j) → + ((QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) x ρ) : D.Space) = + QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) y ρ)) ∧ + ((QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) x ρ)⁻¹ : D.Space) = + QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) y ρ)⁻¹)) ∧ + ∀ (Φ : D.Space → ℂ) (K : ℝ≥0), (∀ z, ‖Φ z‖ ≤ 1) → + (letI := D.metricSpace; LipschitzWith K Φ) → (K : ℝ) ≤ Real.exp q → + ∀ ε a ρ g : D.filtration.realification.PolynomialOrbit (fun _ : Unit => 1), + ε * a * ρ = g → ∀ T : ℝ, 0 < T → + CoefficientBound (D.basis.baseChange ℝ) (fun _ : Unit => T) + (Real.exp (sharedFreeCommonCorrectionBudget s q p) + + Real.exp (sharedFreePetalLiftBudget s q p)) ε.log → + CoefficientGrid (D.basis.baseChange ℝ) m ρ.log → + ∀ (x y : Unit → ℤ) (δ : ℝ), 0 ≤ δ → + (∀ j, |(x j : ℝ)| ≤ T) → (∀ j, |(y j : ℝ)| ≤ T) → + (∀ j, |(x j : ℝ) - y j| ≤ T * δ) → + (∀ j, (M : ℤ) ∣ x j - y j) → + ‖Φ (QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) x g)) - + Φ (QuotientGroup.mk + (D.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) y ε * + D.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x a * + D.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) y ρ))‖ ≤ + Real.exp ((p + C) ^ C) * δ := by + obtain ⟨a, _, hfull⟩ := exists_sharedFreeFullOrbitBudget_bound s + obtain ⟨b, _, hperiod⟩ := exists_native_orbit_rational_period s + obtain ⟨c, _, hfreeze⟩ := exists_orbit_factor_freezing s 1 + let B : Polynomial ℕ := (Polynomial.X + Polynomial.C a) ^ a + Polynomial.X + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((B + Polynomial.C b) ^ b + (B + Polynomial.C c) ^ c) + refine ⟨C, hC, ?_⟩ + intro L _ _ _ _ _ _ d D q p hq hqp hp hD m hm hmb + let t := (p + a) ^ a + p + 2 + have hpow : 0 ≤ (p + a) ^ a := by positivity + have ht : 0 ≤ t := by dsimp only [t]; positivity + have hqt : q ≤ t := by dsimp only [t]; linarith + have hbt : (p + a) ^ a ≤ t := by dsimp only [t]; linarith + have ht1 : (1 : ℝ) ≤ t := by dsimp only [t]; linarith + have hsum : (t + b) ^ b + (t + c) ^ c ≤ (p + C) ^ C := by + simpa [B, t, Polynomial.eval₂_pow] using hbudget p hp + have hbC : (t + b) ^ b ≤ (p + C) ^ C := by + linarith [show 0 ≤ (t + c) ^ c by positivity] + have hcC : (t + c) ^ c ≤ (p + C) ^ C := by + linarith [show 0 ≤ (t + b) ^ b by positivity] + obtain ⟨_, _, _, hden, hslow⟩ := hfull q p hq hqp hp + obtain ⟨M, hM, hMb, hsolve⟩ := hperiod D (fun _ : Unit => 1) + (fun _ => Nat.zero_lt_one) t ht (hD.mono D hqt) + (by simpa only [Fintype.card_unit, Nat.cast_one] using ht1) m hm + (hmb.trans (Real.exp_le_exp.mpr (hden.trans hbt))) + refine ⟨M, hM, hMb.trans (Real.exp_le_exp.mpr hbC), hsolve, ?_⟩ + intro Φ K hΦ hLip hK ε a₀ ρ g hprod T hT hε hρ x y δ hδ hx hy hxy hres + have hε' : CoefficientBound (D.basis.baseChange ℝ) (fun _ : Unit => T) + (Real.exp ((t + 2) ^ 1)) ε.log := + CoefficientBound.mono _ _ (fun _ => hT) hε + (hslow.trans (Real.exp_le_exp.mpr (by simpa only [pow_one] using + (hbt.trans (show t ≤ t + 2 by linarith))))) + exact (hfreeze D (fun _ : Unit => 1) (fun _ => Nat.zero_lt_one) t ht + (hD.mono D hqt) (by simpa only [Fintype.card_unit, Nat.cast_one] using ht1) + Φ K hΦ hLip (hK.trans (Real.exp_le_exp.mpr hqt)) ε a₀ ρ g hprod + (fun _ : Unit => T) (fun _ => hT) hε' x y δ hδ hx hy hxy + (hsolve ρ hρ x y hres).1).trans + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hcC) hδ) + +end Erdos3.RationalFilteredNilmanifold + +namespace Erdos3 + +noncomputable def sharedFreeFactorFreezingConstant (s : ℕ) : ℕ := + (RationalFilteredNilmanifold.exists_sharedFreeFactorFreezing.{0} s).choose + +end Erdos3 + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B₀ : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem CoefficientBases.exists_invariant_native_comparison_model + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B₀.freeFrequency D) + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') : + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + let hS := D.comparisonCoefficientSpace_le_layer E T hbQ hT V g hg D' hTfil + ∃ B : ∀ j, Basis (Fin (finrank ℚ (S j))) ℚ (S j), + (∀ j a i, rationalLogHeight ((Pi.basis (fun _ : Fin 2 => E.basis)).repr + (B j a : Fin 2 → D.CoefficientFreeLieAlgebra) i) ≤ sharedFreeComparisonBasisBudget Q P') ∧ + let φ := SubspaceFreeLift.evaluation S B (piRank (fun _ : Fin 2 => E) (fun _ => T)).filtration hS + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S r) s + (finrank ℚ (SubspaceFreeLift.Algebra S r)), + ∃ U : M.DegreeRankStructure r, + U.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + U.ComplexityLE (sharedFreeComparisonModelBudget s Q P') ∧ IsCentralLieBasis M.basis ∧ + Nonempty (FreeCoordinateFrame M.basis (sharedFreeComparisonModelBudget s Q P')) ∧ + (∀ i j, rationalLogHeight ((pi (fun _ : Fin 2 => E)).basis.repr + (φ (M.basis j)) i) ≤ sharedFreeComparisonModelBudget s Q P') ∧ + M.lattice ≤ (pi (fun _ : Fin 2 => E)).lattice.comap (mapOfSteps + (hL := M.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => E)).filtration.lowerCentralSeries_eq_bot) φ) ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S r) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S r) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 M.basis + ∃ Z : M.UnitVerticalObservable (U.realSubgroup s r) + (Fin W.family.outputDim × Fin W.family.outputDim) (sharedFreeComparisonModelBudget s Q P'), + Z.frequency = (pairDifferenceFunctional V.frequency).comp φ.toLinearMap ∧ + (∀ x ∈ U.filtration.layer s r, Z.frequency x = 0) ∧ + (∀ i z, z ∈ U.realSubgroup s r → ∀ x, Z.observable i (z • x) = Z.observable i x) ∧ + ∀ i x, Z.observable i (QuotientGroup.mk x) = + V.pairedObservable T i (QuotientGroup.mk (realificationMap + (hnil := M.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => E)).filtration.lowerCentralSeries_eq_bot) φ x))) := by + intro S hS + obtain ⟨J, hJ, M, U, hU, hUc, hcentral, hframe, hmatrix, hlattice, hZ⟩ := + D.exists_native_comparison_model E T hbQ hT F V g hg D' hTfil hs hP' hQP' + refine ⟨J, hJ, M, U, hU, hUc, hcentral, hframe, hmatrix, hlattice, ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S r) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S r) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 M.basis + obtain ⟨Z, hfreqZ, hobs⟩ := hZ + have hzero := B₀.native_comparison_frequency_zero D E T hbQ hT V g hg D' + hTfil hfreq J M U hU Z.frequency hfreqZ + exact ⟨Z, hfreqZ, hzero, + (fun i z hz x => Z.rank_invariant_of_frequency_zero U hzero z hz i x), hobs⟩ + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s (r + 1) N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B₀ : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure (r + 1)) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s (r + 1)) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem CoefficientBases.exists_uniform_lower_comparison_model + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B₀.freeFrequency D) + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') : + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + let hS := D.comparisonCoefficientSpace_le_layer E T hbQ hT V g hg D' hTfil + ∃ B : ∀ j, Basis (Fin (finrank ℚ (S j))) ℚ (S j), + (∀ j a i, rationalLogHeight ((Pi.basis (fun _ : Fin 2 => E.basis)).repr + (B j a : Fin 2 → D.CoefficientFreeLieAlgebra) i) ≤ sharedFreeComparisonBasisBudget Q P') ∧ + let φ := SubspaceFreeLift.evaluation S B (piRank (fun _ : Fin 2 => E) (fun _ => T)).filtration hS + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S (r + 1)) s + (finrank ℚ (SubspaceFreeLift.Algebra S (r + 1))), + ∃ U : M.DegreeRankStructure (r + 1), + U.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + U.ComplexityLE (sharedFreeComparisonModelBudget s Q P') ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 M.basis + ∃ Z : M.UnitVerticalObservable (U.realSubgroup s (r + 1)) + (Fin W.family.outputDim × Fin W.family.outputDim) (sharedFreeComparisonModelBudget s Q P'), + (∀ i x, Z.observable i (QuotientGroup.mk x) = + V.pairedObservable T i (QuotientGroup.mk (realificationMap + (hnil := M.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 2 => E)).filtration.lowerCentralSeries_eq_bot) φ x))) ∧ + M.HasUniformLowerRankUnitFamily U Z.observable (fun _ : Unit => 1) + (sharedFreeLowerComparisonBudget s Q P')) := by + intro S hS + obtain ⟨J, hJ, M, U, hU, hUc, _, _, _, _, hZ⟩ := + B₀.exists_invariant_native_comparison_model D E T hbQ hT F V g hg D' + hTfil hfreq hs hP' hQP' + refine ⟨J, hJ, M, U, hU, hUc, ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 M.basis + obtain ⟨Z, _, hzero, _, hobs⟩ := hZ + refine ⟨Z, hobs, ?_⟩ + have hpM : 0 ≤ sharedFreeComparisonModelBudget s Q P' := + (Nat.cast_nonneg _).trans hUc.1.1 + exact UnitVerticalObservable.hasUniformLowerRankUnitFamily M U Z + (fun _ : Unit => 1) hpM hUc hzero + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s (r + 1) N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B₀ : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure (r + 1)) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s (r + 1)) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem CoefficientBases.exists_lower_factored_family {τ : Type*} + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B₀.freeFrequency D) + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') + (A K U : τ → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hA0 : ∀ t, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (A t) = 1) + (hK0 : ∀ t, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (K t) = 1) + (hU0 : ∀ t, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (U t) = 1) + (hA : ∀ t (d : Fin s), coefficients (A t).log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + (hK : ∀ t (d : Fin s), coefficients (K t).log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ) + (hU : ∀ t (d : Fin s), coefficients (U t).log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) : + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S (r + 1)) s + (finrank ℚ (SubspaceFreeLift.Algebra S (r + 1))), + ∃ Tm : M.DegreeRankStructure (r + 1), + Tm.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + Tm.ComplexityLE (sharedFreeComparisonModelBudget s Q P') ∧ + M.HasLowerRankOrbitFamily Tm (fun _ : Unit => 1) + (fun t (i : Fin W.family.outputDim × Fin W.family.outputDim) x => + V.observable i.1 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x (A t * K t * U t))) * + star (V.observable i.2 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) x (A t))))) + (sharedFreeLowerComparisonBudget s Q P') := by + intro S + obtain ⟨J, _, M, Tm, hTm, hTmc, hZ⟩ := + B₀.exists_uniform_lower_comparison_model D E T hbQ hT F V g hg D' + hTfil hfreq hs hP' hQP' + refine ⟨M, Tm, hTm, hTmc, ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] SubspaceFreeLift.Algebra S (r + 1)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 M.basis + obtain ⟨Z, hobs, huniform⟩ := hZ + apply huniform.realizeFamily + intro t + obtain ⟨u, hu0, _, hu⟩ := D.exists_native_factored_comparison_orbit E T hbQ hT V g hg D' + hTfil (by omega) (A t) (K t) (U t) (hA0 t) (hK0 t) (hU0 t) (hA t) (hK t) (hU t) + J M Tm hTm + refine ⟨u, hu0, ?_⟩ + intro i x + exact SubspaceFreeLift.native_pair_observable_eval E T S J + (D.comparisonCoefficientSpace_le_layer E T hbQ hT V g hg D' hTfil) + M Tm V Z hobs ![A t * K t * U t, A t] u hu i x + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s (r + 1) N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B₀ : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure (r + 1)) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s (r + 1)) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem CoefficientBases.exists_shared_free_lower_factorization + (hTfil : T.filtration = D.coefficientFreeFiltration) + (hfreq : V.frequency = B₀.freeFrequency D) + (hs : 2 ≤ s) (hp' : 0 ≤ p') (hP' : 0 ≤ P') (hQP' : Q ≤ P') (hpp' : p' ≤ P') + (ξ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hsplit : ∀ h, g h = ξ * v h) + (hξ : ∀ d : Fin s, coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ + (D.commonFreeSpan d).baseChange ℝ) + (hv : ∀ h (d : Fin s), coefficients (v h).log (Finsupp.single () (d.val + 1)) ∈ + (D.dependentFreeSpan d).baseChange ℝ) + (hN : Real.exp ((P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s) ≤ (N : ℝ)) : + let B := (P' + 2) ^ 3 + 2 * P' + let Λ := (P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s + let Lc := sharedFreeCommonCorrectionBudget s Q P' + let Lv := sharedFreePetalLiftBudget s Q P' + ∃ D₁ : R'.CommonData B, D₁.quadruples ⊆ D'.quadruples ∧ D₁.spaces = D'.spaces ∧ + ∃ J ⊆ H', J.Nonempty ∧ Real.exp (-Λ) * H'.card ≤ (J.card : ℝ) ∧ + ∃ (r₀ : ℕ) (R₀ : Fin r₀ → ℕ) (η : (Fin r₀ → ℤ) →+ ZMod N) (h₀ : ZMod N) + (m : ℕ) (Γ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (α : Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (β : Fin r₀ → Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra), + (r₀ : ℝ) ≤ Λ ∧ Set.InjOn η {x | ∀ j, |x j| ≤ (R₀ j : ℤ)} ∧ 0 < m ∧ (m : ℝ) ≤ Real.exp ((s : ℝ) * (Lc + Lv)) ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 Γ = 1 ∧ + (∀ d : Fin s, coefficients Γ.log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) ∧ + (∀ d, α d ∈ (D.dependentFreeSpan d).baseChange ℝ ∧ + ‖(E.basis.baseChange ℝ).equivFun (α d)‖ ≤ Real.exp Lv) ∧ + (∀ j d, β j d ∈ (D.dependentFreeSpan d).baseChange ℝ ∧ + ‖(E.basis.baseChange ℝ).equivFun (β j d)‖ ≤ Real.exp Lv) ∧ + ∃ (x : {h // h ∈ J} → Fin r₀ → ℤ) + (ε A K U ρ : {h // h ∈ J} → + E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)), + (∀ h : {h // h ∈ J}, + (∀ j, |x h j| ≤ (R₀ j : ℤ)) ∧ h.val = h₀ + η (x h) ∧ + (A h).log = Γ.log + positiveUnivariate + (fun d => α d + ∑ j, (x h j : ℝ) • β j d) ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (ε h) = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (A h) = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (K h) = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (U h) = 1 ∧ + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (ρ h) = 1 ∧ + CoefficientBound (E.basis.baseChange ℝ) (fun _ : Unit => (N : ℝ)) + (Real.exp Lc + Real.exp Lv) (ε h).log ∧ + CoefficientGrid (E.basis.baseChange ℝ) m (ρ h).log ∧ + ε h * A h * K h * U h * ρ h = g h.val ∧ + ∀ d : Fin s, + coefficients (K h).log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ ∧ + coefficients (U h).log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) ∧ + (∃ M₀ : ℕ, 0 < M₀ ∧ + (M₀ : ℝ) ≤ Real.exp ((P' + sharedFreeFactorFreezingConstant s) ^ + sharedFreeFactorFreezingConstant s) ∧ + (∀ (h : {h // h ∈ J}) (y z : Unit → ℤ), + (∀ j, (M₀ : ℤ) ∣ y j - z j) → + ((QuotientGroup.mk (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) y (ρ h)) : E.Space) = + QuotientGroup.mk (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) z (ρ h))) ∧ + ((QuotientGroup.mk (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) y (ρ h))⁻¹ : E.Space) = + QuotientGroup.mk (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) z (ρ h))⁻¹)) ∧ + ∀ (h : {h // h ∈ J}) i (y z : Unit → ℤ) (δ : ℝ), 0 ≤ δ → + (∀ j, |(y j : ℝ)| ≤ N) → (∀ j, |(z j : ℝ)| ≤ N) → + (∀ j, |(y j : ℝ) - z j| ≤ (N : ℝ) * δ) → + (∀ j, (M₀ : ℤ) ∣ y j - z j) → + ‖V.observable i (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) y (g h.val))) - + V.observable i (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) z (ε h) * + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) y + (A h * K h * U h) * + E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) z (ρ h)))‖ ≤ + Real.exp ((P' + sharedFreeFactorFreezingConstant s) ^ + sharedFreeFactorFreezingConstant s) * δ) ∧ + let S := D.comparisonCoefficientSpace E T hbQ hT V g hg D' + ∃ M : RationalFilteredNilmanifold (SubspaceFreeLift.Algebra S (r + 1)) s + (finrank ℚ (SubspaceFreeLift.Algebra S (r + 1))), + ∃ Tm : M.DegreeRankStructure (r + 1), + Tm.filtration = SubspaceFreeLift.filtration S T.filtration.rank_le_degree ∧ + Tm.ComplexityLE (sharedFreeComparisonModelBudget s Q P') ∧ + M.HasLowerRankOrbitFamily Tm (fun _ : Unit => 1) + (fun h (i : Fin W.family.outputDim × Fin W.family.outputDim) y => + V.observable i.1 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) y (A h * K h * U h))) * + star (V.observable i.2 (QuotientGroup.mk + (E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) y (A h))))) + (sharedFreeLowerComparisonBudget s Q P') := by + intro B Λ Lc Lv + classical + obtain ⟨D₁, hsub, hspaces, J, hJH, hJ, hcard, r₀, R₀, η, h₀, m, Γ, α, β, + hrank, hproper, hm, hmb, hΓ0, hΓ, hα, hβ, hfamily⟩ := + D.exists_shared_free_full_orbit_factorization E T hbQ hT F V g hg D' + hTfil hs hp' hP' hQP' hpp' ξ v hsplit hξ hv hN + choose x hx hspace ε A K U ρ hAl hε0 hA0 hK0 hU0 hρ0 hε hρ hprod hKU using + (fun h : {h // h ∈ J} => hfamily h.val h.property) + have hAc : ∀ (h : {h // h ∈ J}) (d : Fin s), + coefficients (A h).log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ := by + intro h d + rw [hAl h] + exact affine_refined_coefficient_mem D.coefficientFreeSpan D.dependentFreeSpan + (fun d : Fin s => D'.coefficientFourSpace ⟨d.val + 1, by omega⟩) + Γ.log α β (fun j => (x h j : ℝ)) hΓ (fun d => (hα d).1) (fun j d => (hβ j d).1) d + refine ⟨D₁, hsub, hspaces, J, hJH, hJ, hcard, r₀, R₀, η, h₀, m, Γ, α, β, + hrank, hproper, hm, hmb, hΓ0, hΓ, hα, hβ, x, ε, A, K, U, ρ, ?_, ?_, ?_⟩ + · intro h + exact ⟨hx h, hspace h, hAl h, hε0 h, hA0 h, hK0 h, hU0 h, hρ0 h, + hε h, hρ h, hprod h, hKU h⟩ + · have hQ : 0 ≤ Q := (Nat.cast_nonneg _).trans hT.1.1 + obtain ⟨M₀, hM₀, hM₀b, hperiod, hfreeze⟩ := + (RationalFilteredNilmanifold.exists_sharedFreeFactorFreezing.{0} s).choose_spec.2 + E hQ hQP' hP' hT.1 m hm hmb + refine ⟨M₀, hM₀, hM₀b, (fun h y z hres => hperiod (ρ h) (hρ h) y z hres), ?_⟩ + intro h i y z δ hδ hy hz hyz hres + exact hfreeze (V.observable i) V.lipBound (V.norm i) (V.lipschitz i) V.lip_bound + (ε h) (A h * K h * U h) (ρ h) (g h.val) + (by simpa only [mul_assoc] using hprod h) (N : ℝ) + (by exact_mod_cast NeZero.pos N) (hε h) (hρ h) y z δ hδ hy hz hyz hres + · exact B₀.exists_lower_factored_family D E T hbQ hT F V g hg D' + hTfil hfreq hs hP' hQP' A K U hA0 hK0 hU0 hAc + (fun h d => (hKU h d).1) (fun h d => (hKU h d).2) + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeRoundingThreshold.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeRoundingThreshold.lean new file mode 100644 index 0000000000000000000000000000000000000000..223e2508b3744342d22b3c031f18668d02f31c08 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedFreeRoundingThreshold.lean @@ -0,0 +1,845 @@ +import OAI.Combinatorics.Progressions.Dynamics.SharedRefinementBudget +import OAI.Combinatorics.Progressions.Linear.RealFourBalancedDual + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module RationalFilteredNilmanifold VectorPolynomial +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {κ : Type*} {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + +theorem exists_native_full_coefficient_corrections (hs : 1 ≤ s) (hP : 0 ≤ P) + (c : Basis κ ℚ W.L) (τ : κ → ℕ) + (hG : ∀ j, W.rank.filtration.associatedDegree.layer j = + Submodule.span ℚ (c '' {i | j ≤ τ i})) + (t : ZMod N × ZMod N × ZMod N) (ht : t ∈ D.quadruples) : + let I := R.interval ⟨t, D.subset ht⟩ + let V : I.SunflowerWitness P := D.witness t ht + ∃ E Q : ∀ α : Unit →₀ ℕ, + (W.rank.filtration.fourHorizontalLayer (Finsupp.weight (fun _ : Unit => 1) α)).baseChange ℝ, + (∀ α j, |(W.fourRankBasis.baseChange ℝ).repr (E α).val j| ≤ + Real.exp ((P + 3) ^ 2) / monomialScale (fun _ : Unit => (I.length : ℝ)) α) ∧ + (∀ α, (W.fourRankBasis.baseChange ℝ).equivFun (Q α).val ∈ + realDenominatorGrid V.projectedDenominator) ∧ + ∀ (α : Unit →₀ ℕ) (hα : Finsupp.weight (fun _ : Unit => 1) α ≤ s), + (fun k => coefficients + (W.orbit (rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) k))).log α) - + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) (E α).val - + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) (Q α).val ∈ + D.realCoefficientFourSpace ⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hα⟩ := by + intro I V + obtain ⟨E, Q, hE, hQ, hres⟩ := D.exists_bounded_coefficient_corrections hs hP t ht + refine ⟨E, Q, hE, hQ, ?_⟩ + intro α hα + let d : Fin (s + 1) := ⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hα⟩ + let e4 := TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L) + let u := e4 (V.projectedOrbitCoefficient α).val + let β : Fin 4 → ℝ ⊗[ℚ] W.L := fun k => coefficients + (W.orbit (rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) k))).log α + let e := e4 (E α).val + let a := e4 (Q α).val + have hu : u - e - a ∈ D.realCoefficientFourSpace d := by + have h := (D.mem_real_coefficientFourSpace d (V.projectedOrbitCoefficient α - E α - Q α)).mpr + (hres α hα) + simpa only [Submodule.coe_sub, map_sub] using h + have hk (k : Fin 4) : (u - e - a) k - (β - e - a) k ∈ + (W.rank.filtration.layer d.val 2).baseChange ℝ := by + have heq : (u - e - a) k - (β - e - a) k = u k - β k := by + simp only [Pi.sub_apply] + abel + rw [heq] + exact V.projectedOrbitCoefficient_native_log_mod_kernel hs c τ hG α k + exact (D.realCoefficientFourSpace_congr_mod_kernel d _ _ hk).mp hu + +theorem native_full_scaled_correction (hs : 1 ≤ s) (hp : 0 ≤ p) (hP : 0 ≤ P) + (c : Basis κ ℚ W.L) (τ : κ → ℕ) + (hG : ∀ j, W.rank.filtration.associatedDegree.layer j = + Submodule.span ℚ (c '' {i | j ≤ τ i})) + (l : ℕ) (hdenom : ∀ t (ht : t ∈ D.quadruples), (D.witness t ht).projectedDenominator = l) + (α : Unit →₀ ℕ) (hα : Finsupp.weight (fun _ : Unit => 1) α ≤ s) + (t : ZMod N × ZMod N × ZMod N) (ht : t ∈ D.quadruples) : + ∃ E Q : ℝ ⊗[ℚ] (Fin 4 → W.L), + ‖(W.fourRankBasis.baseChange ℝ).equivFun E‖ ≤ + Real.exp ((P + 3) ^ 2 + (s : ℝ) * p) / monomialScale (fun _ : Unit => (N : ℝ)) α ∧ + (W.fourRankBasis.baseChange ℝ).equivFun Q ∈ realDenominatorGrid l ∧ + (fun k => coefficients + (W.orbit (rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) k))).log α) - + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) E - + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) Q ∈ + D.realCoefficientFourSpace ⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hα⟩ := by + obtain ⟨E, Q, hE, hQ, hres⟩ := D.exists_native_full_coefficient_corrections hs hP c τ hG t ht + let I := R.interval ⟨t, D.subset ht⟩ + have hlength : (0 : ℝ) < I.length := by exact_mod_cast I.length_pos + have hnorm : ‖(W.fourRankBasis.baseChange ℝ).equivFun (E α).val‖ ≤ + Real.exp ((P + 3) ^ 2) / monomialScale (fun _ : Unit => (I.length : ℝ)) α := by + apply (pi_norm_le_iff_of_nonneg (div_nonneg (Real.exp_pos _).le + (monomialScale_pos _ (fun _ => hlength) α).le)).mpr + exact fun j => hE α j + refine ⟨(E α).val, (Q α).val, ?_, ?_, hres α hα⟩ + · have h := I.norm_bound_on_modulus hp α hα (Real.exp_pos _).le + ((W.fourRankBasis.baseChange ℝ).equivFun (E α).val) hnorm + simpa only [Real.exp_add] using h + · simpa only [hdenom t ht] using hQ α + +theorem exists_uniform_native_full_scaled_corrections (hs : 1 ≤ s) (hp : 0 ≤ p) (hP : 0 ≤ P) + (c : Basis κ ℚ W.L) (τ : κ → ℕ) + (hG : ∀ j, W.rank.filtration.associatedDegree.layer j = + Submodule.span ℚ (c '' {i | j ≤ τ i})) : + let B := (P + 2) ^ 3 + 2 * P + ∃ (C : R.CommonData B) (l : ℕ), C.quadruples ⊆ D.quadruples ∧ C.spaces = D.spaces ∧ + 0 < l ∧ (l : ℝ) ≤ Real.exp ((P + 2) ^ 3 + P) ∧ + ∀ (α : Unit →₀ ℕ) (hα : Finsupp.weight (fun _ : Unit => 1) α ≤ s) + (t : ZMod N × ZMod N × ZMod N), t ∈ C.quadruples → + ∃ E Q : ℝ ⊗[ℚ] (Fin 4 → W.L), + ‖(W.fourRankBasis.baseChange ℝ).equivFun E‖ ≤ + Real.exp ((B + 3) ^ 2 + (s : ℝ) * p) / monomialScale (fun _ : Unit => (N : ℝ)) α ∧ + (W.fourRankBasis.baseChange ℝ).equivFun Q ∈ realDenominatorGrid l ∧ + (fun k => coefficients + (W.orbit (rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) k))).log α) - + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) E - + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) Q ∈ + C.realCoefficientFourSpace ⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hα⟩ := by + intro B + obtain ⟨C, l, hCD, hspaces, hl, hbound, hdenom⟩ := D.exists_common_projected_denominator hP + refine ⟨C, l, hCD, hspaces, hl, hbound, ?_⟩ + intro α hα t ht + exact C.native_full_scaled_correction hs hp (by positivity) + c τ hG l hdenom α hα t ht + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3 + +open Module VectorPolynomial +open scoped TensorProduct + +noncomputable def sharedLogCoefficientTuple + {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s N : ℕ} + (F : NilpotentLieFiltration L s) + (ξ : F.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → F.realification.PolynomialOrbit (fun _ : Unit => 1)) + (α : Unit →₀ ℕ) (t : ZMod N × ZMod N × ZMod N) : Fin 4 → ℝ ⊗[ℚ] L := + fun k => coefficients ξ.log α + coefficients + (v (rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) k))).log α + +theorem sharedLogCoefficientTuple_mem_common + {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s N : ℕ} + (F : NilpotentLieFiltration L s) (C D : Submodule ℚ L) (hDC : D ≤ C) + (ξ : F.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → F.realification.PolynomialOrbit (fun _ : Unit => 1)) + (α : Unit →₀ ℕ) (t : ZMod N × ZMod N × ZMod N) + (hξ : coefficients ξ.log α ∈ C.baseChange ℝ) + (hv : ∀ h, coefficients (v h).log α ∈ D.baseChange ℝ) : + sharedLogCoefficientTuple F ξ v α t ∈ fourCommonModulo (C.baseChange ℝ) (D.baseChange ℝ) := by + apply (mem_fourCommonModulo _ _ _).mpr + constructor + · intro k + exact (C.baseChange ℝ).add_mem hξ (Submodule.baseChange_mono ℝ hDC (hv _)) + · intro k + change (coefficients ξ.log α + coefficients (v _).log α) - + (coefficients ξ.log α + coefficients (v _).log α) ∈ D.baseChange ℝ + rw [add_sub_add_left_eq_sub] + exact (D.baseChange ℝ).sub_mem (hv _) (hv _) + +namespace NativeRankRelation.CommonData + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {κ : Type*} {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + +theorem native_shared_scaled_correction (hs : 1 ≤ s) (hp : 0 ≤ p) (hP : 0 ≤ P) + (c : Basis κ ℚ W.L) (τ : κ → ℕ) + (hG : ∀ j, W.rank.filtration.associatedDegree.layer j = + Submodule.span ℚ (c '' {i | j ≤ τ i})) + (ξ : W.model.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → W.model.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (horbit : ∀ h, W.orbit h = ξ * v h) + (l : ℕ) (hdenom : ∀ t (ht : t ∈ D.quadruples), (D.witness t ht).projectedDenominator = l) + (α : Unit →₀ ℕ) (hα : Finsupp.weight (fun _ : Unit => 1) α ≤ s) + (t : ZMod N × ZMod N × ZMod N) (ht : t ∈ D.quadruples) : + ∃ E Q : ℝ ⊗[ℚ] (Fin 4 → W.L), + ‖(W.fourRankBasis.baseChange ℝ).equivFun E‖ ≤ + Real.exp ((P + 3) ^ 2 + (s : ℝ) * p) / monomialScale (fun _ : Unit => (N : ℝ)) α ∧ + (W.fourRankBasis.baseChange ℝ).equivFun Q ∈ realDenominatorGrid l ∧ + sharedLogCoefficientTuple W.model.filtration ξ v α t - + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) E - + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) Q ∈ + D.realCoefficientFourSpace ⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hα⟩ := by + obtain ⟨E, Q, hE, hQ, hres⟩ := D.native_full_scaled_correction hs hp hP c τ hG + l hdenom α hα t ht + refine ⟨E, Q, hE, hQ, ?_⟩ + apply (D.realCoefficientFourSpace_congr_mod_kernel _ _ _ ?_).mp hres + intro k + let a := rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) k) + let e := (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) E k + let z := (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)) Q k + change (coefficients (W.orbit a).log α - e - z) - + (coefficients ξ.log α + coefficients (v a).log α - e - z) ∈ _ + rw [horbit a] + have heq : (coefficients (ξ * v a).log α - e - z) - + (coefficients ξ.log α + coefficients (v a).log α - e - z) = + coefficients (ξ * v a).log α - (coefficients ξ.log α + coefficients (v a).log α) := by abel + rw [heq] + exact W.rank.orbit_log_mul_mod_rank_two hs c τ hG (fun _ : Unit => 1) α ξ (v a) + +end NativeRankRelation.CommonData +end Erdos3 + +end + +section + +namespace Erdos3 + +open VectorPolynomial +open scoped TensorProduct + +theorem sharedLogCoefficientTuple_annihilator_decomposition + {L J : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype J] {s N : ℕ} + (F : NilpotentLieFiltration L s) (C D : Submodule ℚ L) (hDC : D ≤ C) + (ℓ : (Fin 4 → L) →ₗ[ℚ] (J → ℚ)) + (hℓ : fourBalancedDependent D ≤ LinearMap.ker ℓ) + (ξ : F.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → F.realification.PolynomialOrbit (fun _ : Unit => 1)) + (α : Unit →₀ ℕ) (t : ZMod N × ZMod N × ZMod N) + (hξ : coefficients ξ.log α ∈ C.baseChange ℝ) + (hv : ∀ h, coefficients (v h).log α ∈ D.baseChange ℝ) : + let φ := ℓ.comp (LinearMap.single ℚ (fun _ : Fin 4 => L) 0) + let a := fun h => realifyCoordinateMap φ (coefficients (v h).log α) + realFourCoordinateMap ℓ (sharedLogCoefficientTuple F ξ v α t) = + realifyCoordinateMap (ℓ.comp (fourDiagonalMap (R := ℚ))) (coefficients ξ.log α) + + (a (rankQuadrupleParameters t 1) + a (rankQuadrupleParameters t 2) - + a (rankQuadrupleParameters t 0) - a (rankQuadrupleParameters t 3)) := by + intro φ a + have h := realFourCoordinateMap_shared_decomposition C D hDC ℓ hℓ + (coefficients ξ.log α) hξ + (fun k => coefficients (v (rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) k))).log α) + (fun k => hv _) + change realFourCoordinateMap ℓ (sharedLogCoefficientTuple F ξ v α t) = + realifyCoordinateMap (ℓ.comp (fourDiagonalMap (R := ℚ))) (coefficients ξ.log α) + + realifyCoordinateMap φ + (coefficients (v (rankQuadrupleParameters t 1)).log α + + coefficients (v (rankQuadrupleParameters t 2)).log α - + coefficients (v (rankQuadrupleParameters t 0)).log α - + coefficients (v (rankQuadrupleParameters t 3)).log α) at h + simpa only [map_add, map_sub] using h + +end Erdos3 + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + +theorem exists_uniform_shared_refinement + (hs : 2 ≤ s) (hp : 0 ≤ p) (hP : 0 ≤ P) (hbP : b ≤ P) (hpP : p ≤ P) + (U V : Fin s → Submodule ℚ W.L) (hVU : ∀ d, V d ≤ U d) + (u : ∀ d, Basis (Fin (finrank ℚ (U d))) ℚ (U d)) + (v : ∀ d, Basis (Fin (finrank ℚ (V d))) ℚ (V d)) + (hu : ∀ d a i, rationalLogHeight (W.model.basis.repr (u d a : W.L) i) ≤ P) + (hv : ∀ d a i, rationalLogHeight (W.model.basis.repr (v d a : W.L) i) ≤ P) + (ξ : W.model.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (g : ZMod N → W.model.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (horbit : ∀ h, W.orbit h = ξ * g h) + (hξ : ∀ d : Fin s, coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ (U d).baseChange ℝ) + (hg : ∀ h (d : Fin s), coefficients (g h).log (Finsupp.single () (d.val + 1)) ∈ + (V d).baseChange ℝ) + (hN : Real.exp (separationBudget (8 * sharedRefinementInputBudget s P + 1)) ≤ (N : ℝ)) : + let B := (P + 2) ^ 3 + 2 * P + let z := 8 * sharedRefinementInputBudget s P + 1 + ∃ D₁ : R.CommonData B, D₁.quadruples ⊆ D.quadruples ∧ D₁.spaces = D.spaces ∧ + ∀ d : Fin s, ∃ m : ℕ, 0 < m ∧ + (m : ℝ) ≤ Real.exp (z + ((z + 2) ^ 3 + (z + 2) ^ 36)) ∧ + ∀ t ∈ D₁.quadruples, ∃ E Q : ℝ ⊗[ℚ] (Fin 4 → W.L), + ‖(W.fourRankBasis.baseChange ℝ).equivFun E‖ ≤ + (Real.exp z + Real.exp ((z + 2) ^ 3 + (z + 2) ^ 18 + z)) / + monomialScale (fun _ : Unit => (N : ℝ)) (Finsupp.single () (d.val + 1)) ∧ + (W.fourRankBasis.baseChange ℝ).equivFun Q ∈ realDenominatorGrid m ∧ + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L)).symm + (sharedLogCoefficientTuple W.model.filtration ξ g (Finsupp.single () (d.val + 1)) t) - + E - Q ∈ (fourRefinedRelation (U d) (V d) + (D.coefficientFourSpace ⟨d.val + 1, by omega⟩)).baseChange ℝ := by + intro B z + classical + let A := sharedRefinementInputBudget s P + obtain ⟨hB, hPB, hA, hPA, hHA, hEA, hLA⟩ := sharedRefinementInputBudget_bounds s hP + have hAz : A ≤ z := by dsimp only [z, A]; linarith + have hdim : (Fintype.card (Fin W.dim) : ℝ) ≤ A := by + simpa only [Fintype.card_fin] using W.complexity.1.1.trans (hbP.trans hPA) + let : FiniteDimensional ℚ W.L := W.model.basis.finiteDimensional_of_finite + obtain ⟨c, τ, _, _, hF⟩ := W.rank.filtration.associatedDegree.exists_sorted_adapted_basis + obtain ⟨D₁, l, hsub, hspaces, hl, hlbound, hdenom⟩ := D.exists_common_projected_denominator hP + refine ⟨D₁, hsub, hspaces, ?_⟩ + intro d + let δ : Fin (s + 1) := ⟨d.val + 1, by omega⟩ + let α : Unit →₀ ℕ := Finsupp.single () (d.val + 1) + have hα : Finsupp.weight (fun _ : Unit => 1) α = δ.val := by + simp only [α, δ, Finsupp.weight_single, smul_eq_mul, mul_one] + have hαs : Finsupp.weight (fun _ : Unit => 1) α ≤ s := by rw [hα]; exact Nat.le_of_lt_succ δ.isLt + have hα0 : α ≠ 0 := by simp [α] + obtain ⟨k, hk⟩ := D₁.exists_coefficientFour_basis hs hB (hbP.trans hPB) δ + have hlA : (l : ℝ) ≤ Real.exp A := hlbound.trans (Real.exp_le_exp.mpr hLA) + obtain ⟨m, hm, hmp, _, hsolve⟩ := exists_fourRefinedRelation_correction W.model.basis + (U d) (V d) (hVU d) (D₁.coefficientFourSpace δ) (u d) (v d) k hA hdim + (fun a i => (hu d a i).trans hPA) (fun a i => (hv d a i).trans hPA) + (fun a i => (hk a i).trans hHA) l hl hlA (fun _ : Unit => (N : ℝ)) (fun _ => hN) + refine ⟨m, hm, hmp, ?_⟩ + intro t ht + obtain ⟨E₀, Q₀, hE₀, hQ₀, hres⟩ := D₁.native_shared_scaled_correction (by omega) hp hB + c τ hF ξ g horbit l hdenom α hαs t ht + have hδ : (⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hαs⟩ : Fin (s + 1)) = δ := + Fin.ext hα + rw [hδ] at hres + let e4 := TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => W.L) + let β := sharedLogCoefficientTuple W.model.filtration ξ g α t + let x := e4.symm β + have hxK : x - E₀ - Q₀ ∈ (D₁.coefficientFourSpace δ).baseChange ℝ := by + change β - e4 E₀ - e4 Q₀ ∈ ((D₁.coefficientFourSpace δ).baseChange ℝ).map e4.toLinearMap at hres + have h := (Submodule.mem_map_equiv _).mp hres + change e4.symm (β - e4 E₀ - e4 Q₀) ∈ _ at h + rw [map_sub, map_sub, e4.symm_apply_apply, e4.symm_apply_apply] at h + exact h + have hxS : x ∈ (fourCommonModulo (U d) (V d)).baseChange ℝ := by + have h := sharedLogCoefficientTuple_mem_common W.model.filtration (U d) (V d) (hVU d) + ξ g α t (hξ d) (fun h => hg h d) + rw [← realification_fourCommonModulo] at h + exact (Submodule.mem_map_equiv _).mp h + have herror : (B + 3) ^ 2 + (s : ℝ) * p ≤ z := by + have hmul := mul_le_mul_of_nonneg_left hpP (Nat.cast_nonneg s : (0 : ℝ) ≤ s) + exact (add_le_add_right hmul _).trans (hEA.trans hAz) + have hEbound : ‖(W.fourRankBasis.baseChange ℝ).equivFun E₀‖ ≤ + Real.exp z / monomialScale (fun _ : Unit => (N : ℝ)) α := by + apply hE₀.trans + apply div_le_div_of_nonneg_right (Real.exp_le_exp.mpr herror) + exact (monomialScale_pos _ (fun _ => by exact_mod_cast NeZero.pos N) α).le + obtain ⟨E, Q, hE, hQ, hmem⟩ := hsolve α hα0 x E₀ Q₀ hxK hxS hEbound hQ₀ + have hK : D₁.coefficientFourSpace δ = D.coefficientFourSpace δ := by + rw [D₁.coefficientFourSpace_eq_sup, D.coefficientFourSpace_eq_sup, hspaces] + rw [hK] at hmem + exact ⟨E, Q, hE, hQ, hmem⟩ + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem exists_correlation_refined_basis (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') + (d : Fin s) : + ∃ a : Basis (Fin (finrank ℚ (fourRefinedRelation (D.coefficientFreeSpan d) + (D.dependentFreeSpan d) (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)))) ℚ + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)), + ∀ j i, rationalLogHeight ((Pi.basis (fun _ : Fin 4 => E.basis)).repr + (a j : Fin 4 → D.CoefficientFreeLieAlgebra) i) ≤ + fourRefinementBasisBudget (Q + coefficientFourHeightBudget P') := by + obtain ⟨c, hc⟩ := D.exists_coefficientFreeSpan_basis E.basis F (by omega) d + obtain ⟨b, hb⟩ := D.exists_dependentFreeSpan_basis E.basis F (by omega) d + obtain ⟨k, hk⟩ := D'.exists_coefficientFour_basis hs hP' hQP' ⟨d.val + 1, by omega⟩ + have hQ : 0 ≤ Q := (Nat.cast_nonneg _).trans hT.1.1 + have hB := coefficientFourHeightBudget_nonneg hP' + have hQA : Q ≤ Q + coefficientFourHeightBudget P' := le_add_of_nonneg_right hB + have hBA : coefficientFourHeightBudget P' ≤ Q + coefficientFourHeightBudget P' := + le_add_of_nonneg_left hQ + apply exists_fourRefinedRelation_basis_logHeight E.basis _ _ + (D.dependentFreeSpan_le_coefficientFreeSpan d) _ c b k (add_nonneg hQ hB) + (by simpa only [Fintype.card_fin] using hT.1.1.trans hQA) + (fun a i => (hc a i).trans hQA) (fun a i => (hb a i).trans hQA) + exact fun a i => (hk a i).trans hBA + +theorem exists_correlation_refined_annihilator (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') + (d : Fin s) : + ∃ m : ℕ, m ≤ 4 * finrank ℚ D.CoefficientFreeLieAlgebra ∧ + ∃ ℓ : (Fin 4 → D.CoefficientFreeLieAlgebra) →ₗ[ℚ] (Fin m → ℚ), + Function.Surjective ℓ ∧ LinearMap.ker ℓ = + fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩) ∧ + (∀ k i j, rationalLogHeight (ℓ (LinearMap.single ℚ + (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra) k (E.basis i)) j) ≤ + fourRefinementAnnihilatorBudget (Q + coefficientFourHeightBudget P')) ∧ + (∀ x ∈ D.dependentFreeSpan d, ℓ (fourDiagonalMap (R := ℚ) x) = 0) ∧ + (∀ z ∈ fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩), + ℓ (fourDiagonalMap (R := ℚ) (z 0)) + + ℓ (LinearMap.single ℚ (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra) 0 + (z 0 + z 1 - z 2 - z 3)) = 0) ∧ + fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)) = + D.dependentFreeSpan d ⊓ LinearMap.ker + (ℓ.comp (LinearMap.single ℚ (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra) 0)) := by + obtain ⟨c, hc⟩ := D.exists_coefficientFreeSpan_basis E.basis F (by omega) d + obtain ⟨b, hb⟩ := D.exists_dependentFreeSpan_basis E.basis F (by omega) d + obtain ⟨k, hk⟩ := D'.exists_coefficientFour_basis hs hP' hQP' ⟨d.val + 1, by omega⟩ + have hQ : 0 ≤ Q := (Nat.cast_nonneg _).trans hT.1.1 + have hB := coefficientFourHeightBudget_nonneg hP' + have hQA : Q ≤ Q + coefficientFourHeightBudget P' := le_add_of_nonneg_right hB + have hBA : coefficientFourHeightBudget P' ≤ Q + coefficientFourHeightBudget P' := + le_add_of_nonneg_left hQ + simpa only [Fintype.card_fin] using + exists_fourRefinedRelation_annihilator E.basis _ _ + (D.dependentFreeSpan_le_coefficientFreeSpan d) _ c b k (add_nonneg hQ hB) + (by simpa only [Fintype.card_fin] using hT.1.1.trans hQA) + (fun a i => (hc a i).trans hQA) (fun a i => (hb a i).trans hQA) + (fun a i => (hk a i).trans hBA) + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem exists_controlled_shared_free_refinement + (hs : 2 ≤ s) (hp' : 0 ≤ p') (hP' : 0 ≤ P') (hQP' : Q ≤ P') (hpp' : p' ≤ P') + (ξ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hsplit : ∀ h, g h = ξ * v h) + (hξ : ∀ d : Fin s, coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ + (D.commonFreeSpan d).baseChange ℝ) + (hv : ∀ h (d : Fin s), coefficients (v h).log (Finsupp.single () (d.val + 1)) ∈ + (D.dependentFreeSpan d).baseChange ℝ) + (hN : Real.exp (separationBudget (8 * sharedRefinementInputBudget s P' + 1)) ≤ (N : ℝ)) : + let B := (P' + 2) ^ 3 + 2 * P' + let z := 8 * sharedRefinementInputBudget s P' + 1 + ∃ D₁ : R'.CommonData B, D₁.quadruples ⊆ D'.quadruples ∧ D₁.spaces = D'.spaces ∧ + ∀ d : Fin s, ∃ m : ℕ, 0 < m ∧ + (m : ℝ) ≤ Real.exp (z + ((z + 2) ^ 3 + (z + 2) ^ 36)) ∧ + ∀ t ∈ D₁.quadruples, ∃ A S : ℝ ⊗[ℚ] (Fin 4 → D.CoefficientFreeLieAlgebra), + ‖((Pi.basis (fun _ : Fin 4 => E.basis)).baseChange ℝ).equivFun A‖ ≤ + (Real.exp z + Real.exp ((z + 2) ^ 3 + (z + 2) ^ 18 + z)) / + monomialScale (fun _ : Unit => (N : ℝ)) (Finsupp.single () (d.val + 1)) ∧ + ((Pi.basis (fun _ : Fin 4 => E.basis)).baseChange ℝ).equivFun S ∈ realDenominatorGrid m ∧ + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra)).symm + (sharedLogCoefficientTuple E.filtration ξ v (Finsupp.single () (d.val + 1)) t) - A - S ∈ + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).baseChange ℝ := by + have hC := fun d : Fin s => D.exists_coefficientFreeSpan_basis E.basis F (by omega) d + have hD := fun d : Fin s => D.exists_dependentFreeSpan_basis E.basis F (by omega) d + choose c hc using hC + choose a ha using hD + exact D'.exists_uniform_shared_refinement hs hp' hP' hQP' hpp' + D.coefficientFreeSpan D.dependentFreeSpan D.dependentFreeSpan_le_coefficientFreeSpan c a + (fun d j i => (hc d j i).trans hQP') (fun d j i => (ha d j i).trans hQP') ξ v hsplit + (fun d => Submodule.baseChange_mono ℝ (D.commonFreeSpan_le_coefficientFreeSpan d) (hξ d)) hv hN + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem exists_real_correlation_refined_equations + (hs : 2 ≤ s) (hP' : 0 ≤ P') (hQP' : Q ≤ P') (d : Fin s) : + ∃ m : ℕ, m ≤ 4 * finrank ℚ D.CoefficientFreeLieAlgebra ∧ + ∃ ℓ : (Fin 4 → D.CoefficientFreeLieAlgebra) →ₗ[ℚ] (Fin m → ℚ), + Function.Surjective ℓ ∧ LinearMap.ker ℓ = + fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩) ∧ + (∀ k i j, rationalLogHeight (ℓ (LinearMap.single ℚ + (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra) k (E.basis i)) j) ≤ + fourRefinementAnnihilatorBudget (Q + coefficientFourHeightBudget P')) ∧ + (∀ v : Fin 4 → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra, + v ∈ fourRefinedRelation ((D.coefficientFreeSpan d).baseChange ℝ) + ((D.dependentFreeSpan d).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨d.val + 1, by omega⟩) ↔ + ∀ j, realifyFunctional ((LinearMap.proj j).comp ℓ) + ((TensorProduct.piRight ℚ ℝ ℝ (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra)).symm v) = 0) ∧ + (∀ v : ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra, + v ∈ fourPetalSpace ((D.dependentFreeSpan d).baseChange ℝ) + (fourRefinedRelation ((D.coefficientFreeSpan d).baseChange ℝ) + ((D.dependentFreeSpan d).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨d.val + 1, by omega⟩)) ↔ + v ∈ (D.dependentFreeSpan d).baseChange ℝ ∧ ∀ j, realifyFunctional + (((LinearMap.proj j).comp ℓ).comp + (LinearMap.single ℚ (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra) 0)) v = 0) := by + obtain ⟨m, hm, ℓ, hsurj, hker, hheight, _, _, _⟩ := + D.exists_correlation_refined_annihilator E T hbQ hT F V g hg D' hs hP' hQP' d + have hspace := realification_fourRefinedRelation (D.coefficientFreeSpan d) + (D.dependentFreeSpan d) (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩) + change _ = fourRefinedRelation ((D.coefficientFreeSpan d).baseChange ℝ) + ((D.dependentFreeSpan d).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨d.val + 1, by omega⟩) at hspace + refine ⟨m, hm, ℓ, hsurj, hker, hheight, ?_, ?_⟩ + · intro v + rw [← hspace] + exact mem_real_four_annihilator_iff _ ℓ hker v + · intro v + have hpetal := realification_fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)) + rw [hspace] at hpetal + rw [← hpetal] + exact mem_real_petal_annihilator_iff _ _ ℓ hker v + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3 + +noncomputable def sharedFreeEquationInputBudget (s : ℕ) (q p : ℝ) : ℝ := + let z := 8 * sharedRefinementInputBudget s p + 1 + 4 * p + (fourRefinementAnnihilatorBudget (q + coefficientFourHeightBudget p) + 1) + + (z + ((z + 2) ^ 3 + (z + 2) ^ 36)) + +theorem sharedFreeEquationInputBudget_bounds (s : ℕ) {q p : ℝ} (hq : 0 ≤ q) (hp : 0 ≤ p) : + let z := 8 * sharedRefinementInputBudget s p + 1 + let a := fourRefinementAnnihilatorBudget (q + coefficientFourHeightBudget p) + let A := sharedFreeEquationInputBudget s q p + 0 ≤ A ∧ 4 * p ≤ A ∧ a + 1 ≤ A ∧ z + ((z + 2) ^ 3 + (z + 2) ^ 36) ≤ A := by + intro z a A + have hi := (sharedRefinementInputBudget_bounds s hp).2.2.1 + have hz : 0 ≤ z := by dsimp only [z]; linarith + have ha : 0 ≤ a := + fourRefinementAnnihilatorBudget_nonneg (add_nonneg hq (coefficientFourHeightBudget_nonneg hp)) + have hZ : 0 ≤ z + ((z + 2) ^ 3 + (z + 2) ^ 36) := by positivity + have hA : A = 4 * p + (a + 1) + (z + ((z + 2) ^ 3 + (z + 2) ^ 36)) := rfl + exact ⟨by linarith, by linarith, by linarith, by linarith⟩ + +namespace NativeRankRelation.CommonData + +open Module VectorPolynomial +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + (F : FreeCoordinateFrame E.basis Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +include F + +theorem exists_controlled_shared_free_equations + (hs : 2 ≤ s) (hp' : 0 ≤ p') (hP' : 0 ≤ P') (hQP' : Q ≤ P') (hpp' : p' ≤ P') + (ξ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hsplit : ∀ h, g h = ξ * v h) + (hξ : ∀ d : Fin s, coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ + (D.commonFreeSpan d).baseChange ℝ) + (hv : ∀ h (d : Fin s), coefficients (v h).log (Finsupp.single () (d.val + 1)) ∈ + (D.dependentFreeSpan d).baseChange ℝ) + (hN : Real.exp (separationBudget (8 * sharedRefinementInputBudget s P' + 1)) ≤ (N : ℝ)) : + let B := (P' + 2) ^ 3 + 2 * P' + let z := 8 * sharedRefinementInputBudget s P' + 1 + let A := sharedFreeEquationInputBudget s Q P' + ∃ D₁ : R'.CommonData B, D₁.quadruples ⊆ D'.quadruples ∧ D₁.spaces = D'.spaces ∧ + ∀ d : Fin s, ∃ n : ℕ, n ≤ 4 * finrank ℚ D.CoefficientFreeLieAlgebra ∧ + ∃ ℓ : (Fin 4 → D.CoefficientFreeLieAlgebra) →ₗ[ℚ] (Fin n → ℚ), + Function.Surjective ℓ ∧ LinearMap.ker ℓ = + fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩) ∧ + (∀ k i j, rationalLogHeight (ℓ (LinearMap.single ℚ + (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra) k (E.basis i)) j) ≤ + fourRefinementAnnihilatorBudget (Q + coefficientFourHeightBudget P')) ∧ + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((A + 2) ^ 4) ∧ + let α := Finsupp.single () (d.val + 1) + let φ := ℓ.comp (LinearMap.single ℚ (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra) 0) + let a := fun h => realifyCoordinateMap φ (coefficients (v h).log α) + let c := realifyCoordinateMap (ℓ.comp (fourDiagonalMap (R := ℚ))) (coefficients ξ.log α) + ∀ t ∈ D₁.quadruples, ∃ q ∈ realDenominatorGrid m, + ‖c + (a (rankQuadrupleParameters t 1) + a (rankQuadrupleParameters t 2) - + a (rankQuadrupleParameters t 0) - a (rankQuadrupleParameters t 3)) - q‖ ≤ + Real.exp ((A + 2) ^ 3) * + ((Real.exp z + Real.exp ((z + 2) ^ 3 + (z + 2) ^ 18 + z)) / + monomialScale (fun _ : Unit => (N : ℝ)) α) := by + intro B z A + classical + have hQ : 0 ≤ Q := (Nat.cast_nonneg _).trans hT.1.1 + obtain ⟨hA, hdimA, hheightA, hdenomA⟩ := sharedFreeEquationInputBudget_bounds s hQ hP' + obtain ⟨D₁, hsub, hspaces, hcorr⟩ := + D.exists_controlled_shared_free_refinement E T hbQ hT F V g hg D' + hs hp' hP' hQP' hpp' ξ v hsplit hξ hv hN + refine ⟨D₁, hsub, hspaces, ?_⟩ + intro d + obtain ⟨n, hn, ℓ, hsurj, hker, hheight, _, _, _⟩ := + D.exists_correlation_refined_annihilator E T hbQ hT F V g hg D' hs hP' hQP' d + obtain ⟨l, hl, hlp, hcorr⟩ := hcorr d + let e4 := Pi.basis (fun _ : Fin 4 => E.basis) + let H := ⌈Real.exp (fourRefinementAnnihilatorBudget (Q + coefficientFourHeightBudget P'))⌉₊ + have hheightH : ∀ j i, RationalHeightLE (ℓ (e4 i) j) H := by + intro j i + apply rationalHeightLE_ceil_exp + have he : e4 i = LinearMap.single ℚ + (fun _ : Fin 4 => D.CoefficientFreeLieAlgebra) i.1 (E.basis i.2) := by + simp only [e4, Pi.basis_apply, LinearMap.single_apply] + rw [he] + exact hheight i.1 i.2 j + have hdim : (4 : ℝ) * finrank ℚ D.CoefficientFreeLieAlgebra ≤ 4 * P' := + mul_le_mul_of_nonneg_left (hT.1.1.trans hQP') (by norm_num) + have hI : (Fintype.card (Σ _ : Fin 4, Fin (finrank ℚ D.CoefficientFreeLieAlgebra)) : ℝ) ≤ A := by + simpa only [Fintype.card_sigma, Fintype.card_fin, Finset.sum_const, Finset.card_univ, + smul_eq_mul, Nat.cast_mul, Nat.cast_ofNat] using hdim.trans hdimA + have hJ : (Fintype.card (Fin n) : ℝ) ≤ A := by + have hn' := (Nat.cast_le (α := ℝ)).mpr hn + simp only [Nat.cast_mul, Nat.cast_ofNat] at hn' + simpa only [Fintype.card_fin] using hn'.trans (hdim.trans hdimA) + have hH : (H : ℝ) ≤ Real.exp A := + (ceil_exp_le_exp_add_one (fourRefinementAnnihilatorBudget_nonneg + (add_nonneg hQ (coefficientFourHeightBudget_nonneg hP')))).trans + (Real.exp_le_exp.mpr hheightA) + have hlA : (l : ℝ) ≤ Real.exp A := hlp.trans (Real.exp_le_exp.mpr hdenomA) + obtain ⟨m, hm, hmA, _, hsolve⟩ := + exists_real_annihilator_correction e4 ℓ hheightH hA hI hJ hH hl hlA + refine ⟨n, hn, ℓ, hsurj, hker, hheight, m, hm, hmA, ?_⟩ + intro α φ a c t ht + obtain ⟨E₀, Q₀, hE₀, hQ₀, hmem⟩ := hcorr t ht + rw [← hker] at hmem + obtain ⟨q, hq, hbound⟩ := hsolve _ E₀ Q₀ _ hmem hE₀ hQ₀ + refine ⟨q, hq, ?_⟩ + have hbalanced : fourBalancedDependent (D.dependentFreeSpan d) ≤ LinearMap.ker ℓ := by + rw [hker] + exact fourBalancedDependent_le_refined _ _ _ + have hdecomp := sharedLogCoefficientTuple_annihilator_decomposition E.filtration + (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D.dependentFreeSpan_le_coefficientFreeSpan d) ℓ hbalanced ξ v α t + (Submodule.baseChange_mono ℝ (D.commonFreeSpan_le_coefficientFreeSpan d) (hξ d)) + (fun h => hv h d) + change realFourCoordinateMap ℓ (sharedLogCoefficientTuple E.filtration ξ v α t) = + c + (a (rankQuadrupleParameters t 1) + a (rankQuadrupleParameters t 2) - + a (rankQuadrupleParameters t 0) - a (rankQuadrupleParameters t 3)) at hdecomp + change ‖realFourCoordinateMap ℓ (sharedLogCoefficientTuple E.filtration ξ v α t) - q‖ ≤ _ at hbound + rw [hdecomp] at hbound + exact hbound + +end NativeRankRelation.CommonData +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem sharedFree_rounding_small {A z : ℝ} (hA : 0 ≤ A) (hz : 0 ≤ z) + (hbudget : z + ((z + 2) ^ 3 + (z + 2) ^ 36) ≤ A) + (N l d : ℕ) [NeZero N] (hd : 1 ≤ d) + (hl : (l : ℝ) ≤ Real.exp ((A + 2) ^ 4)) + (hN : Real.exp ((A + 2) ^ 5) ≤ (N : ℝ)) : + 2 * (l : ℝ) * (Real.exp ((A + 2) ^ 3) * + ((Real.exp z + Real.exp ((z + 2) ^ 3 + (z + 2) ^ 18 + z)) / (N : ℝ) ^ d)) ≤ 1 := by + have hzA : z ≤ A := by + have h3 : 0 ≤ (z + 2) ^ 3 := by positivity + have h36 : 0 ≤ (z + 2) ^ 36 := by positivity + linarith + have h18 : (z + 2) ^ 18 ≤ (z + 2) ^ 36 := + pow_le_pow_right₀ (by linarith) (by decide) + have hwA : (z + 2) ^ 3 + (z + 2) ^ 18 + z ≤ A := by linarith + have hsum : Real.exp z + Real.exp ((z + 2) ^ 3 + (z + 2) ^ 18 + z) ≤ + 2 * Real.exp A := by + linarith [Real.exp_le_exp.mpr hzA, Real.exp_le_exp.mpr hwA] + have hpoly : (A + 2) ^ 4 + (A + 2) ^ 3 + A + 4 ≤ (A + 2) ^ 5 := by + have hh : 0 ≤ A ^ 5 + 9 * A ^ 4 + 31 * A ^ 3 + 50 * A ^ 2 + 35 * A + 4 := by positivity + nlinarith + have hnum : 2 * (l : ℝ) * (Real.exp ((A + 2) ^ 3) * + (Real.exp z + Real.exp ((z + 2) ^ 3 + (z + 2) ^ 18 + z))) ≤ + Real.exp ((A + 2) ^ 5) := by + calc + _ ≤ 2 * Real.exp ((A + 2) ^ 4) * (Real.exp ((A + 2) ^ 3) * (2 * Real.exp A)) := by + gcongr + _ = 4 * Real.exp ((A + 2) ^ 4 + (A + 2) ^ 3 + A) := by + simp only [Real.exp_add] + ring + _ ≤ Real.exp 4 * Real.exp ((A + 2) ^ 4 + (A + 2) ^ 3 + A) := by + apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le + linarith [Real.add_one_le_exp (4 : ℝ)] + _ = Real.exp ((A + 2) ^ 4 + (A + 2) ^ 3 + A + 4) := by + rw [← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr hpoly + have hN1 : (1 : ℝ) ≤ N := by exact_mod_cast NeZero.pos N + have hpower : (N : ℝ) ≤ (N : ℝ) ^ d := by + simpa only [pow_one] using pow_le_pow_right₀ hN1 hd + have hdenpos : (0 : ℝ) < (N : ℝ) ^ d := by positivity + have hquot := (div_le_one hdenpos).mpr (hnum.trans (hN.trans hpower)) + simpa only [mul_div_assoc] using hquot + +noncomputable def sharedFreeRecoveryThreshold (s : ℕ) (q p : ℝ) : ℝ := + max (separationBudget (8 * sharedRefinementInputBudget s p + 1)) + ((sharedFreeEquationInputBudget s q p + 2) ^ 5) + +theorem sharedFreeRecoveryThreshold_spec (s : ℕ) {q p : ℝ} (hq : 0 ≤ q) (hp : 0 ≤ p) + (N : ℕ) [NeZero N] (hN : Real.exp (sharedFreeRecoveryThreshold s q p) ≤ (N : ℝ)) : + let z := 8 * sharedRefinementInputBudget s p + 1 + let A := sharedFreeEquationInputBudget s q p + Real.exp (separationBudget z) ≤ (N : ℝ) ∧ + ∀ (l d : ℕ), 1 ≤ d → (l : ℝ) ≤ Real.exp ((A + 2) ^ 4) → + 2 * (l : ℝ) * (Real.exp ((A + 2) ^ 3) * + ((Real.exp z + Real.exp ((z + 2) ^ 3 + (z + 2) ^ 18 + z)) / (N : ℝ) ^ d)) ≤ 1 := by + intro z A + constructor + · exact (Real.exp_le_exp.mpr (le_max_left _ _)).trans hN + · intro l d hd hl + have hb := sharedFreeEquationInputBudget_bounds s hq hp + have hz : 0 ≤ z := by + have h := (sharedRefinementInputBudget_bounds s hp).2.2.1 + dsimp only [z] + linarith + exact sharedFree_rounding_small hb.1 hz hb.2.2.2 N l d hd hl + ((Real.exp_le_exp.mpr (le_max_right _ _)).trans hN) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedChoice.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedChoice.lean new file mode 100644 index 0000000000000000000000000000000000000000..189edaf89ea84b538ecfe71ce51ffcf3a89d63e6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedChoice.lean @@ -0,0 +1,43 @@ +import OAI.Combinatorics.Progressions.Geometry.SpatialNumericEnvelopeFunctoriality + +namespace OAI + +section + +namespace Erdos3 + +theorem sharedWidthPreparedChoice {T : Type*} (width : T → ℝ) (Plate : ℝ) + (hpositive : ∀ t, 0 < width t) + (hreciprocal : ∀ t, (width t)⁻¹ ≤ Real.exp Plate) : + let ξ := Real.exp (-Plate) + 0 < ξ ∧ ξ⁻¹ = Real.exp Plate ∧ ∀ t, ξ ≤ width t := by + refine ⟨Real.exp_pos _, ?_, ?_⟩ + · simp only [Real.exp_neg, inv_inv] + · intro t + have h := (inv_le_inv₀ (Real.exp_pos Plate) (inv_pos.mpr (hpositive t))).2 + (hreciprocal t) + simpa only [Real.exp_neg, inv_inv] using h + +theorem sharedWidthPreparedChoice_le_one {Plate : ℝ} (hPlate : 0 ≤ Plate) : + Real.exp (-Plate) ≤ 1 := by + exact Real.exp_le_one_iff.mpr (neg_nonpos.mpr hPlate) + +theorem sharedWidthNormalizedTuplePreparedChoice {T G N X : Type*} + [Fintype G] [Fintype N] [Fintype X] + (q M : T → ℕ) (selection : ∀ t, Fin (q t) ↪ G) (p E : T → ℝ) (Plate : ℝ) + (hreciprocal : ∀ t, + (normalizedTupleNarrowWidth X N (selection t) (M t) (p t) (E t))⁻¹ ≤ + Real.exp Plate) : + let ξ := Real.exp (-Plate) + 0 < ξ ∧ ξ⁻¹ = Real.exp Plate ∧ ∀ t, + ξ ≤ normalizedTupleNarrowWidth X N (selection t) (M t) (p t) (E t) := by + exact sharedWidthPreparedChoice + (fun t => normalizedTupleNarrowWidth X N (selection t) (M t) (p t) (E t)) Plate + (fun t => normalizedTupleNarrowWidth_pos X N (selection t) (M t) (p t) (E t)) + hreciprocal + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedLateToleranceFreeTrimSource.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedLateToleranceFreeTrimSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b100e61cd21e3ec6c2a95216442e32f9432647b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedLateToleranceFreeTrimSource.lean @@ -0,0 +1,1274 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedLateToleranceCertifiedSource +import OAI.Combinatorics.Progressions.Estimates.SharedWidthPreparedModularGeneralDirectDetectionFreeTrim + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +section Consumer + +variable {m s : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +variable (α τ : ℝ) +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +def PreparedModularGeneralDirectDetectionFreeTrimPreparedSharedWidthInterface + (Pchart Qstride Pmaster Plate _pGain Pphysical coarseTarget : ℝ) : Prop := + ∀ (_hstride : ∀ i, 0 < stride i) (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (_hC : ∀ j, 0 ≤ C j) (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (_hForward : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pchart) + (_hVtail : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pchart) + (_hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (_hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pchart) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pchart), + ∀ (hτSpatial : 0 < τ), τ⁻¹ ≤ Real.exp Pphysical → + τ ≤ 1 / 2 → (nX : ℝ) * τ ≤ 1 / 2 → + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn), ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) + Pphysical coarseTarget → ξn⁻¹ ≤ Real.exp Plate → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + {Rrank : ℝ}, + (∀ i, Real.exp r.required ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp r.required ≤ Rrank → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let Z := selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem) + ∃ (hN : ∀ i, 0 < N i) (hbases : bases.Nonempty) (hbox : (integerBox N).Nonempty) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z) + (hnormalizer : |Z - 1| ≤ Real.exp (-r.E) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) + (_hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i), + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + hN hW hτSpatial hξn stride cells hmass bases hbases hnormalizer.2.2.1 + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + let budget := r.nativeBudget + ∀ (signal : (Fin nX → ℤ) → ℂ), + (∀ t, ‖signal t‖ ≤ 1) → (∀ t, t ∉ integerBox N → signal t = 0) → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun t : integerBox N => t.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation + (fun t => signal t.val) (fun t => star (twistData.eval N poly t.val) * Fnative t)‖ + +end Consumer + +theorem exists_preparedModularGeneralDirectDetectionLateFloorFreeTrim_sharedWidth (m s : ℕ) (Pdetect : Polynomial ℕ) : + let Cdetect := sampledSupportedSlicedDetectionConstant s Pdetect + let Cresource := Classical.choose (exists_preparedModularGeneral_uniform_resource_budget m) + let Aalloc := Classical.choose (exists_preparedModularCanonicalDetectorAllocationBudget m) + let Cgeom := Classical.choose (exists_detected_canonical_native_source_geometry.{0,0,0,0,0} m s Cdetect) + let Aearly := Classical.choose (exists_preparedModularGeneralCanonicalEarlyParameters m s Cdetect) + let Cphysical := Classical.choose (exists_detectedCanonicalPhysicalBudget m Aearly Cgeom) + ∃ C Cscale : ℕ, 2 ≤ C ∧ 2 ≤ Cscale ∧ + ∀ {X J₀ : Type} (L : RankPreparationFamily X J₀ m) {M nX : ℕ}, + (∀ j, Fintype.card (L j).Coord ≤ M) → + ∀ {P pSlice u Qstride : ℝ}, + 0 < m → ∀ hs : s ≤ m, 0 ≤ P → (M : ℝ) ≤ P → + pSlice ∈ Set.Icc 0 P → u ∈ Set.Icc 0 P → Qstride ∈ Set.Icc 0 P → (nX : ℝ) ≤ P → + let Jalloc := modularInitialBlockCount m (nX + m * M) + let pnum : ℝ := enlargedPreparedCommonSamplerDimension m M Jalloc + let Palloc := (P + Aalloc) ^ Aalloc + let G := EnlargedPreparedCommonKernel m Jalloc + let I := PreparedSamplerContinuous L + let n := preparedSamplerTransverse L + let B := EnlargedPreparedCommonSamplerBlock L Jalloc + let selection := enlargedPreparedCommonCanonicalSelection m Jalloc s hs + let A := Classical.choose (exists_allocatedCanonicalSlice_early_radius.{0,0,0,0} m) + let Pearly := Palloc + (2 * Palloc + A) ^ A + 2 + let rowSets := fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (j.val + 1) + let _T := allocatedIdealCoverSupport (G := G) B rowSets + let _siteRadius := allocatedProductIdealSiteRadius (G := G) B rowSets + let pModel := allocatedEarlyModelLog Pearly pSlice (Fintype.card (LayerSamplerVariables G I n B)) + let pDetect := allocatedModelTestLog u pModel + let aDetect := 2 * u + 4 * pModel + 7 + let D := allocatedComparisonDimension m pnum + let gainLog := slicedDetectionGainLog s Cdetect (Fintype.card (LayerSamplerVariables G I n B)) pDetect pDetect aDetect + let Pk := scalarKernelLogarithmicBudget (Fin (s + 1)) G (gainLog + pDetect + 4) + let Qearly := (Palloc + Aearly) ^ Aearly + let Pphysical := Qearly + Pk + Qstride + nX + (m + 1 : ℕ) + 8 + let coarseTarget := gainLog + 32 + let Eextra := coefficientErrorSpatialLog Pphysical + 8 + let target := gainLog + 32 + Eextra + let τ := Real.exp (-Pphysical) + let Rspatial := spatialPrimitiveEnvelope Pphysical coarseTarget 0 + let ξLog := 2 * (Rspatial + spatialTupleToleranceLog Rspatial) + 4 + let F := pDetect + 2 + let _Tmod := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let _δ := Real.exp (-(pDetect + 1)) + let E := target + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 5 + let _η := Real.exp (-E) + let Prho := 2 * affineProfileInputEnvelope D (canonicalSublevelCutoffLip : ℝ) + (canonicalTransitionLip : ℝ) E F + 2 + let Ptail := affineProfileToleranceEnvelope m D (D * (D + 1) + D * D + D + 1) + (canonicalSublevelCutoffLip : ℝ) (canonicalTransitionLip : ℝ) E F + let _K := Classical.choose (exists_allocatedAffineScaleLog_bound m) + let geometryBudget := (Palloc + Eextra + Cgeom) ^ Cgeom + let sourceBudget := (Palloc + Cphysical) ^ Cphysical + let totalBudget := (P + C) ^ C + P ≤ Palloc ∧ pnum ≤ Palloc ∧ geometryBudget ≤ sourceBudget ∧ sourceBudget ≤ totalBudget ∧ + Pphysical ∈ Set.Icc 0 sourceBudget ∧ coarseTarget ∈ Set.Icc 0 sourceBudget ∧ + ξLog ∈ Set.Icc 0 sourceBudget ∧ 0 ≤ Eextra ∧ + coarseTarget + coefficientErrorSpatialLog Pphysical + 8 = target ∧ + 0 < τ ∧ τ ≤ 1 / 2 ∧ (nX : ℝ) * τ ≤ 1 / 2 ∧ 1 / τ = Real.exp Pphysical ∧ + (s + 1) * (s + 3) ≤ Fintype.card G ∧ + (∀ h : ℕ, h ≤ m → h * Jalloc ≤ Fintype.card G) ∧ + (∀ a : LayerSamplerAxis I n, Jalloc ≤ Fintype.card (B a)) ∧ + (∀ a : LayerSamplerAxis I n, (rowSets a.1).card ≤ Fintype.card (B a)) ∧ + (∀ i, (selection i).val = i.val) ∧ + (∀ inactive : LayerSamplerAxis I n → Prop, + (∑ j : Fin m, Fintype.card (AllocatedCongruenceRankOutput (Fin nX) I inactive j)) ≤ + nX + m * M) ∧ + ⌈2 * ((modularInitialRankStrength m (nX + m * M) : ℝ) + (nX + m * M : ℕ) + 10) / + modularRankSmallBallExponent m⌉₊ ≤ Jalloc ∧ + ∃ (pRadius : ℝ) (R : Fin m → ℝ), + pRadius ∈ Set.Icc 0 Pearly ∧ pRadius ≤ geometryBudget ∧ + (∀ j, 0 < R j ∧ R j ≤ 1 ∧ (R j)⁻¹ ≤ Real.exp pRadius) ∧ + pModel ∈ Set.Icc 0 geometryBudget ∧ pDetect ∈ Set.Icc 0 geometryBudget ∧ + aDetect ∈ Set.Icc 0 geometryBudget ∧ target ∈ Set.Icc 0 geometryBudget ∧ + D ∈ Set.Icc 0 geometryBudget ∧ gainLog ∈ Set.Icc 0 geometryBudget ∧ + Pk ∈ Set.Icc 0 geometryBudget ∧ Prho ∈ Set.Icc 0 geometryBudget ∧ + Ptail ∈ Set.Icc 0 geometryBudget ∧ + (∀ Vtail : Fin m → ℝ≥0, (∀ j, (Vtail j : ℝ) ≤ Real.exp Palloc) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Palloc → + let Ctail := 4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j) + let α := allocatedModelUnitThreshold u pModel + (Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B))) Ctail + Ctail ≤ Real.exp pModel ∧ Real.exp (-aDetect) ≤ α) ∧ + ∃ t : ℝ, 0 < t ∧ t ≤ 1 ∧ + ∀ (Lmin : ℕ) {W Qw Pmin : ℝ}, 1 ≤ W → 0 ≤ Qw → W ≤ Real.exp Qw → + 0 ≤ Pmin → (Lmin : ℝ) ≤ Real.exp Pmin → + ∀ {J : Fin m → Type} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ), + let Pscale := pRadius + Ptail + ∃ S : LayerSamplerScale (G := G) B U basis R (fun _ => t), + Pscale ∈ Set.Icc 0 geometryBudget ∧ Pk ≤ Pscale ∧ Lmin ≤ S.value ∧ + (S.value : ℝ) ≤ Real.exp (allocatedWitnessScaleLog geometryBudget Qw + + (1 + geometryBudget ^ 2) * Pmin) ∧ + (S.value : ℝ) ≤ Real.exp ((P + Qw + Pmin + Cscale) ^ Cscale) ∧ + (∀ j i, S.value ^ (j.val + 1) < basisAxisScale (basis j) i → + 8 * (probabilityProfileLipschitz : ℝ) * W ≤ + (layerSamplerGapWidth (G := G) B R ⟨j, i⟩ / 2) * + ((basisAxisScale (basis j) i : ℝ) / (S.value : ℝ) ^ (j.val + 1))) ∧ + Nonempty (AllocatedEarlyNativeSourceGeometryGeneral (B := B) (U := U) + (basis := basis) (S := S) (s := s) (nX := nX) + Palloc Pscale D target Pk Prho Qstride pDetect (Real.toNNReal (Real.exp pRadius))) ∧ + (∀ lateTarget : ℝ, coarseTarget ≤ lateTarget → + let Plate := preparedModularGeneralDetectorLateMaster sourceBudget geometryBudget Qw Pphysical lateTarget + + (1 + geometryBudget ^ 2) * Pmin + let resources := preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m s) (s + 1) sourceBudget Plate + resources.nativeBudget ∈ Set.Icc 0 ((2 * sourceBudget + Cresource) ^ Cresource) ∧ + resources.required ∈ Set.Icc 0 ((sourceBudget + Plate + Cresource) ^ Cresource) ∧ + resources.nativeBudget = (preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m s) (s + 1) sourceBudget sourceBudget).nativeBudget ∧ + (∀ (hRpos : ∀ j, 0 < R j) (hσpos : ∀ _j : Fin m, 0 < t) + (stride N : Fin nX → ℕ) + (Q : Fin m → Type) [∀ j, Fintype (Q j)] + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (_bW : ∀ j, Module.Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] + [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] + [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] + (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) + [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] + [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + (Vtail : Fin m → ℝ≥0) (α τfree : ℝ), + Real.exp (-aDetect) ≤ α → α ≤ 1 → + PreparedModularGeneralDirectDetectionFreeTrimPreparedSharedWidthInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hRpos) (hσ := hσpos) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τfree) + (hb := hb) (o := o) Palloc Qstride sourceBudget Plate gainLog Pphysical lateTarget)) ∧ + ∀ α : ℝ, Real.exp (-aDetect) ≤ α → + Real.exp (-gainLog) ≤ + (Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (s + 1)) ∧ + (scalarKernelCutoff (Fin (s + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (s + 1))) / 2) : ℝ) ≤ Real.exp Pk ∧ + scalarKernelCutoff (Fin (s + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (s + 1))) / 2) ≤ S.value := by + intro Cdetect Cresource Aalloc Cgeom Aearly Cphysical + obtain ⟨C, hC, hsource⟩ := exists_preparedModularGeneralCanonicalLateFloorPhysicalSource m s Cdetect + obtain ⟨Cscale, hCscale, hScaleBudget⟩ := exists_preparedModularGeneralLateFloorScale_budget C + refine ⟨C, Cscale, hC, hCscale, ?_⟩ + intro X J₀ L M nX hCoord P pSlice u Qstride hm hs hP hM hpSlice hu hQstride hnX + Jalloc pnum Palloc G I n B selection A Pearly rowSets T siteRadius pModel pDetect aDetect D + gainLog Pk Qearly Pphysical coarseTarget Eextra target τ Rspatial ξLog F Tmod δ E η Prho Ptail K + geometryBudget sourceBudget totalBudget + obtain ⟨hPalloc, hnum, hGeometryBudget, hTotalBudget, hPhysicalMaster, hCoarseMaster, + hXiMaster, hExtra, hprecision, hτ, hτhalf, hτdim, hτinv, + hcapacity, hkernelAllocation, hblockAllocation, hblockRows, hselection, houtputCount, + hthreshold, pRadius, R, hpRadius, hpRadiusGeometry, hR, + hModelGeometry, hDetectGeometry, haGeometry, hTargetGeometry, hDGeometry, hGainGeometry, + hPkGeometry, hPrhoGeometry, hPtailGeometry, hTailCap, t, ht, htone, hsampler⟩ := + hsource L hCoord hm hs hP hM hpSlice hu hQstride hnX + refine ⟨hPalloc, hnum, hGeometryBudget, hTotalBudget, hPhysicalMaster, hCoarseMaster, + hXiMaster, hExtra, hprecision, hτ, hτhalf, hτdim, hτinv, + hcapacity, hkernelAllocation, hblockAllocation, hblockRows, hselection, houtputCount, + hthreshold, pRadius, R, hpRadius, hpRadiusGeometry, hR, + hModelGeometry, hDetectGeometry, haGeometry, hTargetGeometry, hDGeometry, hGainGeometry, + hPkGeometry, hPrhoGeometry, hPtailGeometry, hTailCap, t, ht, htone, ?_⟩ + intro Lmin Wscale Qw Pmin hWscale hQw hWQw hPmin hLmin J _ U basis Pscale + obtain ⟨S, hScaleGeometry, hPkScale, hFloor, hSWitness, hgap, ⟨geometry⟩, hgainKernel⟩ := + hsampler Lmin hWscale hQw hWQw hPmin hLmin U basis + have hGeometry0 : 0 ≤ geometryBudget := hModelGeometry.1.trans hModelGeometry.2 + have hScalePolynomial := hSWitness.trans (Real.exp_le_exp.mpr + (hScaleBudget hP hQw hPmin hGeometry0 (hGeometryBudget.trans hTotalBudget))) + refine ⟨S, hScaleGeometry, hPkScale, hFloor, hSWitness, hScalePolynomial, + hgap, ⟨geometry⟩, ?_, hgainKernel⟩ + intro lateTarget hCoarseLower Plate resources + have hAlloc0 : 0 ≤ Palloc := hP.trans hPalloc + have hMaster : 0 ≤ sourceBudget := hPhysicalMaster.1.trans hPhysicalMaster.2 + have hLateTarget0 : 0 ≤ lateTarget := hCoarseMaster.1.trans hCoarseLower + obtain ⟨_, hLateBase, hWitnessBase, hCoarseBase, hXiBase⟩ := + preparedModularGeneralDetectorLateMaster_bounds hMaster hGeometry0 hQw hPhysicalMaster.1 hLateTarget0 + have hFloorCost : 0 ≤ (1 + geometryBudget ^ 2) * Pmin := by positivity + have hBaseLate : preparedModularGeneralDetectorLateMaster sourceBudget geometryBudget Qw Pphysical lateTarget ≤ Plate := + le_add_of_nonneg_right hFloorCost + have hLate := hLateBase.trans hBaseLate + have hWitnessLate : allocatedWitnessScaleLog geometryBudget Qw + (1 + geometryBudget ^ 2) * Pmin ≤ Plate := + add_le_add hWitnessBase (le_refl ((1 + geometryBudget ^ 2) * Pmin)) + have hCoarseLate := hCoarseBase.trans hBaseLate + have hXiLate := hXiBase.trans hBaseLate + obtain ⟨hNativeResource, hRequiredResource⟩ := + (Classical.choose_spec (exists_preparedModularGeneral_uniform_resource_budget m)).2 + hMaster hLate ⟨s, Nat.lt_succ_of_le hs⟩ + refine ⟨hNativeResource, hRequiredResource, rfl, ?_⟩ + intro hRpos hσpos stride N Q _ hb o bW _ ν _ _ _ _ _ μ _ _ _ _ _ μrows _ _ _ _ Vtail α τfree hαlower hαone + hstride hstrideBound Cchart hCchart hCchartBound hchart Cforward hforward + hForward hVtail hVactual hprofile hcutoff hτfree hτfreeInv hτfreeHalf hτfreeDim + have hCphysical : 2 ≤ Cphysical := + (Classical.choose_spec (exists_detectedCanonicalPhysicalBudget m Aearly Cgeom)).1 + have hAllocMaster : Palloc ≤ sourceBudget := by + have hbase : 1 ≤ Palloc + Cphysical := by + have hcast : (2 : ℝ) ≤ Cphysical := Nat.cast_le.mpr hCphysical + linarith only [hAlloc0, hcast] + exact (le_add_of_nonneg_right (Nat.cast_nonneg Cphysical)).trans + (le_self_pow₀ hbase (by omega)) + have liftMaster {x : ℝ} (hx : x ∈ Set.Icc 0 geometryBudget) : x ∈ Set.Icc 0 sourceBudget := + ⟨hx.1, hx.2.trans hGeometryBudget⟩ + have hModelMaster := liftMaster hModelGeometry + have hDetectMaster := liftMaster hDetectGeometry + have hTargetMaster := liftMaster hTargetGeometry + have hDMaster := liftMaster hDGeometry + have hGainMaster := liftMaster hGainGeometry + have hPkMaster := liftMaster hPkGeometry + have hPrhoMaster := liftMaster hPrhoGeometry + have hScaleMaster := liftMaster hScaleGeometry + have hpRadiusMaster := hpRadiusGeometry.trans hGeometryBudget + have hSLate := hSWitness.trans (Real.exp_le_exp.mpr hWitnessLate) + have hPMaster : P ≤ sourceBudget := hPalloc.trans hAllocMaster + have hExpMaster : Real.exp Palloc ≤ Real.exp sourceBudget := Real.exp_le_exp.mpr hAllocMaster + obtain ⟨_, hSliceModel, _, _, _, _, _, hcountModel, _, _, _, _, _, _, _, _⟩ := + preparedModularCanonicalDetector_early_cap L Jalloc A hCoord hAlloc0 hnum hpSlice.1 hu.1 + R Vtail hRpos (fun j => (hR j).2.2) hpRadius.2 hVtail hprofile + have hMk := (hgainKernel α hαlower).2 + have hMkPk : (allocatedDetectedKernelCutoff s G + (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect pDetect + α : ℝ) + ≤ Real.exp Pk := hMk.1 + have hMkP := hMkPk.trans (Real.exp_le_exp.mpr hPkScale) + have hKMaster : (Real.toNNReal (Real.exp pRadius) : ℝ) ≤ Real.exp sourceBudget := by + rw [Real.coe_toNNReal (Real.exp pRadius) (Real.exp_pos _).le] + exact Real.exp_le_exp.mpr hpRadiusMaster + have hAearly : 2 ≤ Aearly := + (Classical.choose_spec (exists_preparedModularGeneralCanonicalEarlyParameters m s Cdetect)).1 + have hQearly0 : 0 ≤ Qearly := by dsimp only [Qearly]; positivity + have hAllocQ : Palloc ≤ Qearly := by + have hbase : 1 ≤ Palloc + Aearly := by + have hcast : (2 : ℝ) ≤ Aearly := Nat.cast_le.mpr hAearly + linarith only [hAlloc0, hcast] + exact (le_add_of_nonneg_right (Nat.cast_nonneg Aearly)).trans + (le_self_pow₀ hbase (by omega)) + have hQPhysical : Qearly ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hPkMaster.1, hQstride.1, Nat.cast_nonneg (α := ℝ) nX, + Nat.cast_nonneg (α := ℝ) (m + 1)] + have hmPhysical : ((m + 1 : ℕ) : ℝ) ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hPkMaster.1, hQstride.1, Nat.cast_nonneg (α := ℝ) nX] + have hDimPhysical : ((s + 2 : ℕ) : ℝ) ≤ Pphysical := by + have hsm : (s : ℝ) ≤ m := Nat.cast_le.mpr hs + dsimp only [Pphysical] + simp only [Nat.cast_add, Nat.cast_one, Nat.cast_ofNat] + linarith only [hQearly0, hPkMaster.1, hQstride.1, Nat.cast_nonneg (α := ℝ) nX, hsm] + have hXPhysical : (nX : ℝ) ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hPkMaster.1, hQstride.1, Nat.cast_nonneg (α := ℝ) (m + 1)] + have hPkPhysical : Pk ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hQstride.1, Nat.cast_nonneg (α := ℝ) nX, + Nat.cast_nonneg (α := ℝ) (m + 1)] + have hQstridePhysical : Qstride ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hPkMaster.1, Nat.cast_nonneg (α := ℝ) nX, + Nat.cast_nonneg (α := ℝ) (m + 1)] + have hvarsPhysical : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pphysical := + (Nat.cast_le.mpr (enlargedPreparedCommonSampler_dimensions L Jalloc hCoord).1).trans + (hnum.trans (hAllocQ.trans hQPhysical)) + intro r W ξn hξn hξle hξInvLate hW cells poly hp hmem Rrank hNlarge hrank hRankLarge V + hcells bases Z + have hτInvMaster : τfree⁻¹ ≤ Real.exp sourceBudget := + hτfreeInv.trans (Real.exp_le_exp.mpr hPhysicalMaster.2) + have hξone := hξle.trans (preparedModularCanonicalDetector_narrow_width_le_one (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) + Pdetect pDetect pDetect α) + Pphysical lateTarget) + obtain ⟨hNpos, hbases, hbox, hmass, hnormalizer, hmargin⟩ := + preparedModularGeneralDetector_late_positive_bounds B U basis S hb o μ ν hRpos hσpos + (fun _ => htone) Cforward Vtail hforward hVactual Cchart hCchart hchart + (geometry.hbudgets Cchart hCchart hCchartBound).1 hMaster hLate geometry.hdimensions + hDMaster.2 (hnX.trans hPMaster) + (fun j => (hR j).2.2.trans (Real.exp_le_exp.mpr hpRadiusMaster)) + (fun j => (geometry.hσi j).trans (Real.exp_le_exp.mpr (hScaleMaster.2.trans hLate))) hSLate + (fun j => (hForward j).trans hExpMaster) (fun j => (hVtail j).trans hExpMaster) + poly hp hmem stride hstride + (fun i => (hstrideBound i).trans (Real.exp_le_exp.mpr (hQstride.2.trans hPMaster))) + hτfree hτInvMaster hτfreeHalf hτfreeDim hξn hξone hξInvLate + N hrank cells hcells hNlarge hRankLarge + let : ∀ i, NeZero (N i) := fun i => ⟨(hNpos i).ne'⟩ + have consumer := preparedModularGeneralDirectDetectionFreeTrimSharedWidthInterface_of_geometry + (B := B) (U := U) (basis := basis) (hR := hRpos) (hσ := hσpos) (S := S) (P := Pscale) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τfree) + (Q := Q) (hb := hb) (o := o) (bW := bW) (μ := μ) (ν := ν) (μrows := μrows) + hs Palloc D target Pk Prho Qstride sourceBudget Plate gainLog Pphysical lateTarget + (Real.toNNReal (Real.exp pRadius)) geometry + have completed := consumer hLate hMaster hDMaster.2 hPkMaster + ⟨hQstride.1, hQstride.2.trans hPMaster⟩ hDetectMaster (hnX.trans hPMaster) + (fun j => (hR j).2.1) + (fun j => (hR j).2.2.trans (Real.exp_le_exp.mpr hpRadiusMaster)) + (fun j => (geometry.hσi j).trans (Real.exp_le_exp.mpr (hScaleMaster.2.trans hLate))) + hSLate hKMaster (hcutoff.trans hExpMaster) hMkP hMkPk hstride hstrideBound + Cchart hCchart hCchartBound hchart Cforward hforward + (fun j => (hForward j).trans hExpMaster) (fun j => (hVtail j).trans hExpMaster) hVactual + (fun j i => enlargedPreparedCommonSamplerBlock_positiveModerate L Jalloc s hs ⟨j, Sum.inr i⟩) + (fun j i => enlargedPreparedCommonSamplerBlock_uniform L Jalloc s hs ⟨j, Sum.inr i⟩) + ⟨hu.1, hu.2.trans hPMaster⟩ hModelMaster hSliceModel hcountModel hαlower hαone + hPrhoMaster hTargetMaster hGainMaster hCoarseMaster.2 hCoarseLower hCoarseLate hPhysicalMaster + hmPhysical hDimPhysical hvarsPhysical hXPhysical hPkPhysical hQstridePhysical + (le_refl _) hprecision.le hXiLate hτfree hτfreeInv hξn hξle hξInvLate + refine ⟨hNpos, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩ + intro Path pathLaw sides Sites e Tests _ Ldetect _ _ dims _ _ _ _ + Ddetect Vdetect slices cdetect stepdetect Hdetect hstep hboxDetect hdense hcount hcomplexity hnorm + budget' + exact completed cells poly hp hmem hNlarge hrank hRankLarge hcells hbases hmass + hnormalizer.2.2.1 Ddetect Vdetect slices cdetect stepdetect Hdetect hstep hboxDetect hdense hcount + hcomplexity hnorm hcapacity hMk.2 + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +section Consumer + +variable {m s : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +variable (α τ : ℝ) +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +def PreparedModularGeneralCenteredDetectionFreeTrimSharedWidthInterface + (Pchart Qstride Pmaster Plate _pGain Pphysical coarseTarget : ℝ) : Prop := + ∀ (_hstride : ∀ i, 0 < stride i) (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (_hC : ∀ j, 0 ≤ C j) (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (_hForward : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pchart) + (_hVtail : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pchart) + (_hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (_hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pchart) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pchart), + ∀ (hτSpatial : 0 < τ), τ⁻¹ ≤ Real.exp Pphysical → + τ ≤ 1 / 2 → (nX : ℝ) * τ ≤ 1 / 2 → + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn), + ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2)) + Pphysical coarseTarget → ξn⁻¹ ≤ Real.exp Plate → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + {Rrank : ℝ}, + (∀ i, Real.exp r.required ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp r.required ≤ Rrank → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let Z := selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem) + ∃ (hN : ∀ i, 0 < N i) (hbases : bases.Nonempty) (hbox : (integerBox N).Nonempty) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z) + (_hnormalizer : |Z - 1| ≤ Real.exp (-r.E) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) + (_hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i), + let Path := bases × rectangularWeightIndices 0 V 1 + ∃ hcenter : ∀ center : CoefficientTorus (K := LayerSamplerVariables G I n B) U, + 0 < selectedJointDensityMass bases stride cells V + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center), + let centeredLaw := fun center => selectedJointFiniteLaw bases hbases stride cells V + (narrowTrimmedSpatialWidths_pos hW hτSpatial hξn N hN) hmass + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S poly hmem center) (hcenter center) + ∃ hweight : ∀ z, Measurable (fun center => (centeredLaw center).weight z), + let pathLaw := centeredFiniteMarginal μ centeredLaw hweight + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + let budget := r.nativeBudget + ∀ (signal : (Fin nX → ℤ) → ℂ), + 0 < α → + (∀ t, ‖signal t‖ ≤ 1) → (∀ t, t ∉ integerBox N → signal t = 0) → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun t : integerBox N => t.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation + (fun t => signal t.val) (fun t => star (twistData.eval N poly t.val) * Fnative t)‖ + +include μ hR hσ hb o in + +theorem preparedModularGeneralCenteredDetectionFreeTrimSharedWidth_of_direct + (Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ) + (hDirect : PreparedModularGeneralDirectDetectionFreeTrimPreparedSharedWidthInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α / 2) (τ := τ) (hb := hb) (o := o) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget) : + PreparedModularGeneralCenteredDetectionFreeTrimSharedWidthInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α) (τ := τ) (hb := hb) (o := o) (μ := μ) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget := by + intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff hτSpatial hτInv hτHalf hτDim + r W ξn hξn hξn_le hξLate hW cells poly hp hmem Rrank hsize hrank hRank V hCells bases Z + have hprimitive := hDirect hstride hstrideBound C hC hCbound hchart Cforward hforward + hForward hVtail hVactual hprofile hcutoff hτSpatial hτInv hτHalf hτDim + hξn hξn_le hξLate + obtain ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, _⟩ := + hprimitive cells poly hp hmem hsize hrank hRank hCells + refine ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩ + intro Path + have hcenter (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) : + 0 < selectedJointDensityMass bases stride cells V + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) := by + obtain ⟨c, hc⟩ := exists_subtractive_constant_center U center + let pc := fun j => subtractConstant (c j).val (poly j) + let hmc := fun j => coefficients_subtractConstant_mem (U j) (c j) (poly j) (hmem j) + obtain ⟨_, _, _, _, hnormc, _, _⟩ := hprimitive cells pc + (preparedModularGeneralCentered_degree U poly hp c) hmc hsize + (preparedModularGeneralCentered_rank U poly (fun i => (N i : ℝ)) Rrank hrank c) + hRank hCells + have hdensity := allocatedJointBaseDensity_subtractConstant_centered + B U basis hb o hR hσ S poly hmem center c hc + have hpos := hnormc.2.2.1 + change 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) pc hmc) at hpos + rw [hdensity] at hpos + exact hpos + refine ⟨hcenter, ?_⟩ + intro centeredLaw + have hweight (z : Path) : Measurable (fun center => (centeredLaw center).weight z) := + selectedJointFiniteLaw_weight_measurable bases hbases stride cells V + (narrowTrimmedSpatialWidths_pos hW hτSpatial hξn N hN) hmass + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem) + (allocatedCenteredJointDensity_measurable_center B U basis hb o hR hσ S poly hmem) + (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S poly hmem) hcenter z + refine ⟨hweight, ?_⟩ + intro pathLaw sides Sites e Tests _ Ldetect _ _ dims _ _ _ _ Ddetect Vdetect slices + cdetect stepdetect Hdetect hstep hboxDetect hdense hdimension hcomplexity hcap budget + signal hα hsignal hzero hlarge + obtain ⟨center, hlargeCenter⟩ := exists_center_of_sampledSliceSeminorm μ centeredLaw hweight + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal hα hlarge + obtain ⟨c, hc⟩ := exists_subtractive_constant_center U center + let pc := fun j => subtractConstant (c j).val (poly j) + let hmc := fun j => coefficients_subtractConstant_mem (U j) (c j) (poly j) (hmem j) + obtain ⟨hNc, hbasesc, hboxc, hmassc, hnormc, hmargin, hdetector⟩ := + hprimitive cells pc (preparedModularGeneralCentered_degree U poly hp c) hmc hsize + (preparedModularGeneralCentered_rank U poly (fun i => (N i : ℝ)) Rrank hrank c) + hRank hCells + have hlaw := allocatedOriginalPathLaw_subtractConstant_eq_centered + B U basis hb o hR hσ S poly hmem N hN hW hτSpatial hξn stride cells hmass bases hbases + center c hc hnormc.2.2.1 (hcenter center) + change α / 2 ≤ sampledSliceSeminorm + (selectedJointFiniteLaw bases hbases stride cells V + (narrowTrimmedSpatialWidths_pos hW hτSpatial hξn N hN) hmass + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S poly hmem center) + (hcenter center)) + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal at hlargeCenter + rw [← hlaw] at hlargeCenter + obtain ⟨twistData, Fnative, hNative, hcorrelation⟩ := + hdetector Ddetect Vdetect slices cdetect stepdetect Hdetect hstep hboxDetect hdense + hdimension hcomplexity hcap signal hsignal hzero hlargeCenter + refine ⟨twistData.shiftConstant (fun j => (c j).val), Fnative, hNative, ?_⟩ + have heval (t : integerBox N) : + (twistData.shiftConstant (fun j => (c j).val)).eval N poly t.val = + twistData.eval N pc t.val := + NormalizedPolynomialTwist.eval_shiftConstant twistData (fun j => (c j).val) N poly t.val + simp_rw [heval] + exact hcorrelation + +end Consumer +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +def SharedWidthDetectedCanonicalLateToleranceFreeTrimPreparedStatement (m s : ℕ) + (Pdetect : Polynomial ℕ) : Prop := + let Cdetect := sampledSupportedSlicedDetectionConstant s Pdetect + let Aearly := Classical.choose (exists_preparedModularGeneralCanonicalEarlyParameters m s Cdetect) + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {G : Type} [Fintype G] [DecidableEq G] + {I : Fin m → Type} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type) [∀ b, Fintype (B b)] [∀ b, DecidableEq (B b)] + {Bstruct pnum pSlice Qstride : ℝ} {nX : ℕ}, + 0 < m → s ≤ m → 0 ≤ Bstruct → pnum ∈ Set.Icc 0 Bstruct → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ pnum → + (∀ j, (Fintype.card (I j) : ℝ) ≤ pnum) → (∀ j, (n j : ℝ) ≤ pnum) → + (∀ b : LayerSamplerAxis I n, + (boundedBooleanJetRows (Fin (s + 1)) (b.1.val + 1)).card ≤ Fintype.card (B b)) → + pSlice ∈ Set.Icc 0 Bstruct → Qstride ∈ Set.Icc 0 Bstruct → (nX : ℝ) ≤ Bstruct → + (∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) → + (∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) → + (s + 1) * (s + 3) ≤ Fintype.card G → + let A := Classical.choose (exists_allocatedCanonicalSlice_early_radius.{0,0,0,0} m) + let radiusBudget := Bstruct + (2 * Bstruct + A) ^ A + 2 + let rowSets := fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (j.val + 1) + let T := allocatedIdealCoverSupport (G := G) B rowSets + let siteRadius := allocatedProductIdealSiteRadius (G := G) B rowSets + let D := allocatedComparisonDimension m pnum + ∃ (pRadius : ℝ) (R : Fin m → ℝ), + pRadius ∈ Set.Icc 0 radiusBudget ∧ + (∀ j, 0 < R j ∧ R j ≤ 1 ∧ (R j)⁻¹ ≤ Real.exp pRadius) ∧ + 1 ≤ siteRadius ∧ (∀ j, 0 ≤ T j) ∧ + (∀ j, partitionedIdealRadius (Fin (s + 1)) m + 1 ≤ T j) ∧ + (∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (s + 1)) * + ((Fintype.card (Fin (s + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) ∧ + (∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) ∧ + (∀ j, T j ≤ Real.exp pRadius) ∧ 2 * (siteRadius : ℝ) ≤ Real.exp pRadius ∧ + (∀ Cchart : Fin m → ℝ, (∀ j, 0 ≤ Cchart j) → (∀ j, Cchart j ≤ Real.exp Bstruct) → + (∀ j, Cchart j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) ∧ + (∀ j, Cchart j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) ∧ + (∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (s + 1))) * + (Cchart j * (((Fintype.card (I j) : ℝ) + 1) * + (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4)) ∧ + AllocatedComparisonDimensions (G := G) B (Fin (s + 1)) (fun j => (rowSets j : Type)) D ∧ + ∀ {u P : ℝ}, 0 ≤ u → Bstruct + u ≤ P → + let Pearly := P + (2 * P + A) ^ A + 2 + let pModel := allocatedEarlyModelLog Pearly pSlice (Fintype.card (LayerSamplerVariables G I n B)) + let pDetect := allocatedModelTestLog u pModel + let aDetect := 2 * u + 4 * pModel + 7 + let gainLog := slicedDetectionGainLog s Cdetect (Fintype.card (LayerSamplerVariables G I n B)) pDetect pDetect aDetect + let Pk := scalarKernelLogarithmicBudget (Fin (s + 1)) G (gainLog + pDetect + 4) + let Qearly := (P + Aearly) ^ Aearly + let Pphysical := Qearly + Pk + Qstride + nX + (m + 1 : ℕ) + 8 + let Eextra := coefficientErrorSpatialLog Pphysical + 8 + let target := gainLog + 32 + Eextra + let F := pDetect + 2 + let Tmod := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let _δ := Real.exp (-(pDetect + 1)) + let E := target + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 5 + let _η := Real.exp (-E) + let Prho := 2 * affineProfileInputEnvelope D (canonicalSublevelCutoffLip : ℝ) + (canonicalTransitionLip : ℝ) E F + 2 + let Ptail := affineProfileToleranceEnvelope m D (D * (D + 1) + D * D + D + 1) + (canonicalSublevelCutoffLip : ℝ) (canonicalTransitionLip : ℝ) E F + let _K := Classical.choose (exists_allocatedAffineScaleLog_bound m) + let budget := (P + Eextra + C) ^ C + let master := budget + Pphysical + Pearly + gainLog + 32 + pRadius ≤ budget ∧ (∀ j, T j ≤ Real.exp budget) ∧ + 2 * (siteRadius : ℝ) ≤ Real.exp budget ∧ radiusBudget ≤ Pearly ∧ + P ≤ Pearly ∧ Pearly ≤ budget ∧ pModel ∈ Set.Icc 0 budget ∧ pDetect ∈ Set.Icc 0 budget ∧ + aDetect ∈ Set.Icc 0 budget ∧ target ∈ Set.Icc 0 budget ∧ D ∈ Set.Icc 0 budget ∧ gainLog ∈ Set.Icc 0 budget ∧ Pk ∈ Set.Icc 0 budget ∧ + Prho ∈ Set.Icc 0 budget ∧ Ptail ∈ Set.Icc 0 budget ∧ Tmod ∈ Set.Icc 0 budget ∧ + ∃ t : ℝ, 0 < t ∧ t ≤ 1 ∧ + t⁻¹ ≤ Real.exp Ptail ∧ t⁻¹ ≤ Real.exp budget ∧ + ∀ {Qσ : ℝ}, 0 ≤ Qσ → + let σ := min t (Real.exp (-Qσ)) + let Pscale := pRadius + Ptail + Qσ + let lengthLog := allocatedAffineLengthLog m D Pscale Prho Pk target F Tmod + let Pseed := allocatedScaleLog (D + Pscale + lengthLog + 1) + 0 < σ ∧ σ ≤ t ∧ σ ≤ Real.exp (-Qσ) ∧ + σ⁻¹ ≤ Real.exp Pscale ∧ Pscale ∈ Set.Icc 0 (2 * budget + Qσ) ∧ + ∀ (Lmin : ℕ) {W Qw Pmin : ℝ}, + 1 ≤ W → 0 ≤ Qw → W ≤ Real.exp Qw → + 0 ≤ Pmin → (Lmin : ℝ) ≤ Real.exp Pmin → + ∀ {J : Fin m → Type} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ), + ∃ S : LayerSamplerScale (G := G) B U basis R (fun _ => σ), + Pk ≤ Pscale ∧ Lmin ≤ S.value ∧ + (S.value : ℝ) ≤ Real.exp + (allocatedWitnessScaleLog Pseed Qw + (1 + Pseed ^ 2) * Pmin) ∧ + (∀ j i, S.value ^ (j.val + 1) < basisAxisScale (basis j) i → + 8 * (probabilityProfileLipschitz : ℝ) * W ≤ + (layerSamplerGapWidth (G := G) B R ⟨j, i⟩ / 2) * + ((basisAxisScale (basis j) i : ℝ) / (S.value : ℝ) ^ (j.val + 1))) ∧ + (∀ lateTarget : ℝ, gainLog + 32 ≤ lateTarget → + let Plate := preparedModularGeneralDetectorLateMaster master Pseed Qw Pphysical lateTarget + + (1 + Pseed ^ 2) * Pmin + Pscale + let resources := preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m s) (s + 1) master Plate + resources.nativeBudget = (preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m s) (s + 1) master master).nativeBudget ∧ + (∀ (selection : Fin (s + 1) ↪ G) (hRpos : ∀ j, 0 < R j) (hσpos : ∀ _j : Fin m, 0 < σ) + (stride N : Fin nX → ℕ) + (Q : Fin m → Type) [∀ j, Fintype (Q j)] + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (_bW : ∀ j, Module.Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] + [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] + [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] + (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) + [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] + [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + (Vtail : Fin m → ℝ≥0) (α τfree : ℝ), + Real.exp (-aDetect) ≤ α → α ≤ 1 → + PreparedModularGeneralDirectDetectionFreeTrimPreparedSharedWidthInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hRpos) (hσ := hσpos) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τfree) + (hb := hb) (o := o) Bstruct Qstride master Plate gainLog Pphysical lateTarget)) ∧ + ∀ α : ℝ, Real.exp (-aDetect) ≤ α → + Real.exp (-gainLog) ≤ + (Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (s + 1)) ∧ + (scalarKernelCutoff (Fin (s + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (s + 1))) / 2) : ℝ) ≤ Real.exp Pk ∧ + scalarKernelCutoff (Fin (s + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (s + 1))) / 2) ≤ S.value + +theorem exists_sharedWidth_detected_canonical_late_tolerance_free_trim_prepared (m s : ℕ) + (Pdetect : Polynomial ℕ) : + SharedWidthDetectedCanonicalLateToleranceFreeTrimPreparedStatement m s Pdetect := by + unfold SharedWidthDetectedCanonicalLateToleranceFreeTrimPreparedStatement + intro Cdetect Aearly + obtain ⟨C, hC, hearly⟩ := exists_detected_canonical_early_radius_late_tolerance_source m s Cdetect + refine ⟨C, hC, ?_⟩ + intro G _ _ I _ n B _ _ Bstruct pnum pSlice Qstride nX hm hs hB hnum + hvars hI hn hblocks hpSlice hQstride hnX hBa hBi hcapacity + A radiusBudget rowSets T siteRadius D + obtain ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, hsource⟩ := + hearly (G := G) B hm hs hB hnum hvars hI hn hblocks hpSlice hQstride hnX + refine ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, ?_⟩ + intro u P hu hmaster Pearly pModel pDetect aDetect gainLog Pk Qearly Pphysical Eextra target + F Tmod δ E η Prho Ptail K budget master + have hBP : Bstruct ≤ P := (le_add_of_nonneg_right hu).trans hmaster + have hP : 0 ≤ P := hB.trans hBP + have huP : u ≤ P := (le_add_of_nonneg_left hB).trans hmaster + obtain ⟨hPQ, hEarlyQ, _, _, _, _, hGainQ, hPkQ⟩ := + (Classical.choose_spec (exists_preparedModularGeneralCanonicalEarlyParameters m s Cdetect)).2 + (G := G) B hm hs hP ⟨hnum.1, hnum.2.trans hBP⟩ hvars hI hn hblocks + ⟨hpSlice.1, hpSlice.2.trans hBP⟩ ⟨hu, huP⟩ + ⟨hQstride.1, hQstride.2.trans hBP⟩ (hnX.trans hBP) + have hQearly0 : 0 ≤ Qearly := hP.trans hPQ + have hPhysical0 : 0 ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hPkQ.1, hQstride.1, + Nat.cast_nonneg (α := ℝ) nX, Nat.cast_nonneg (α := ℝ) (m + 1)] + have hExtra : 0 ≤ Eextra := by + have herror := coefficientErrorSpatialLog_nonneg hPhysical0 + dsimp only [Eextra] + linarith only [herror] + obtain ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, htolerances⟩ := hsource hu hmaster hExtra + refine ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, ?_⟩ + intro Qσ hQσ σ Pscale lengthLog Pseed + obtain ⟨hσ, hσt, hσexp, hσinv, hScaleBound, hsamplers⟩ := htolerances hQσ + refine ⟨hσ, hσt, hσexp, hσinv, hScaleBound, ?_⟩ + intro Lmin Wscale Qw Pmin hWscale hQw hWexp hPmin hLmin J _ U basis + obtain ⟨S, hPkScale, hFloor, hSWitness, hgap, ⟨geometry⟩, hgainKernel⟩ := + hsamplers Lmin hWscale hQw hWexp hPmin hLmin U basis + refine ⟨S, hPkScale, hFloor, hSWitness, hgap, ?_, hgainKernel⟩ + intro lateTarget hCoarseLower Plate resources + refine ⟨rfl, ?_⟩ + intro selection hRpos hσpos stride N Q _ hb o bW _ ν _ _ _ _ _ μ + _ _ _ _ _ μrows _ _ _ _ Vtail α τfree hαlower hαone + hstride hstrideBound Cchart hCchart hCchartBound hchart Cforward hforward + hForward hVtail hVactual hprofile hcutoff hτfree hτfreeInv hτfreeHalf hτfreeDim + have hGeometry0 : 0 ≤ budget := hModel.1.trans hModel.2 + have hEarly0 : 0 ≤ Pearly := hP.trans hPEarly + have hGeometryMaster : budget ≤ master := by + dsimp only [master] + linarith only [hPhysical0, hEarly0, hgain.1] + have hPhysicalMaster : Pphysical ∈ Set.Icc 0 master := by + refine ⟨hPhysical0, ?_⟩ + dsimp only [master] + linarith only [hGeometry0, hEarly0, hgain.1] + have hMaster : 0 ≤ master := hGeometry0.trans hGeometryMaster + have hCoarseMaster : gainLog + 32 ≤ master := by + dsimp only [master] + linarith only [hGeometry0, hPhysical0, hEarly0] + have hLateTarget0 : 0 ≤ lateTarget := by + linarith only [hgain.1, hCoarseLower] + have hF : 0 ≤ F := by + change 0 ≤ pDetect + 2 + linarith only [hDetect.1] + have hLength0 : 0 ≤ lengthLog := + (allocatedAffineLengthLog_bounds m hD.1 hScaleBound.1 hPrho.1 hPk.1 + htarget.1 hF hTmod.1).2.2.1 + have hSeedInput : 0 ≤ D + Pscale + lengthLog + 1 := by + linarith only [hD.1, hScaleBound.1, hLength0] + have hSeed0 : 0 ≤ Pseed := allocatedScaleLog_nonneg hSeedInput + obtain ⟨hBase0, hLateBase, hWitnessBase, hCoarseBase, hXiBase⟩ := + preparedModularGeneralDetectorLateMaster_bounds hMaster hSeed0 hQw hPhysical0 hLateTarget0 + have hFloorCost : 0 ≤ (1 + Pseed ^ 2) * Pmin := by positivity + have hBaseLate : preparedModularGeneralDetectorLateMaster master Pseed Qw Pphysical lateTarget ≤ Plate := by + dsimp only [Plate] + linarith only [hFloorCost, hScaleBound.1] + have hLate := hLateBase.trans hBaseLate + have hWitnessLate : allocatedWitnessScaleLog Pseed Qw + (1 + Pseed ^ 2) * Pmin ≤ Plate := by + dsimp only [Plate] + linarith only [hWitnessBase, hScaleBound.1] + have hCoarseLate := hCoarseBase.trans hBaseLate + have hXiLate := hXiBase.trans hBaseLate + have hScaleLate : Pscale ≤ Plate := by + dsimp only [Plate] + linarith only [hBase0, hFloorCost] + have liftMaster {x : ℝ} (hx : x ∈ Set.Icc 0 budget) : x ∈ Set.Icc 0 master := + ⟨hx.1, hx.2.trans hGeometryMaster⟩ + have hModelMaster := liftMaster hModel + have hDetectMaster := liftMaster hDetect + have hTargetMaster := liftMaster htarget + have hDMaster := liftMaster hD + have hGainMaster := liftMaster hgain + have hPkMaster := liftMaster hPk + have hPrhoMaster := liftMaster hPrho + have hpRadiusMaster := hpRadiusBudget.trans hGeometryMaster + have hSLate := hSWitness.trans (Real.exp_le_exp.mpr hWitnessLate) + have hPMaster : P ≤ master := hPEarly.trans (hEarlyBudget.trans hGeometryMaster) + have hBMaster := hBP.trans hPMaster + have hExpMaster : Real.exp Bstruct ≤ Real.exp master := Real.exp_le_exp.mpr hBMaster + obtain ⟨_, hSliceModel, _, hcountModel⟩ := detectedCanonicalEarlyRadiusModel_bounds + (Fintype.card (LayerSamplerVariables G I n B)) hEarly0 hpSlice.1 + (hvars.trans (hnum.2.trans (hBP.trans hPEarly))) + have hMk := (hgainKernel α hαlower).2 + have hMkPk : (allocatedDetectedKernelCutoff s G + (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect pDetect α : ℝ) ≤ Real.exp Pk := hMk.1 + have hMkP := hMkPk.trans (Real.exp_le_exp.mpr hPkScale) + have hKMaster : (Real.toNNReal (Real.exp pRadius) : ℝ) ≤ Real.exp master := by + rw [Real.coe_toNNReal (Real.exp pRadius) (Real.exp_pos _).le] + exact Real.exp_le_exp.mpr hpRadiusMaster + have hQPhysical : Qearly ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hPk.1, hQstride.1, Nat.cast_nonneg (α := ℝ) nX, + Nat.cast_nonneg (α := ℝ) (m + 1)] + have hmPhysical : ((m + 1 : ℕ) : ℝ) ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hPk.1, hQstride.1, Nat.cast_nonneg (α := ℝ) nX] + have hDimPhysical : ((s + 2 : ℕ) : ℝ) ≤ Pphysical := by + have hsm : (s : ℝ) ≤ m := Nat.cast_le.mpr hs + dsimp only [Pphysical] + simp only [Nat.cast_add, Nat.cast_one, Nat.cast_ofNat] + linarith only [hQearly0, hPk.1, hQstride.1, Nat.cast_nonneg (α := ℝ) nX, hsm] + have hXPhysical : (nX : ℝ) ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hPk.1, hQstride.1, Nat.cast_nonneg (α := ℝ) (m + 1)] + have hPkPhysical : Pk ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hQstride.1, Nat.cast_nonneg (α := ℝ) nX, + Nat.cast_nonneg (α := ℝ) (m + 1)] + have hQstridePhysical : Qstride ≤ Pphysical := by + dsimp only [Pphysical] + linarith only [hQearly0, hPk.1, Nat.cast_nonneg (α := ℝ) nX, + Nat.cast_nonneg (α := ℝ) (m + 1)] + have hvarsPhysical : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pphysical := + hvars.trans (hnum.2.trans (hBP.trans (hPQ.trans hQPhysical))) + have hprecision : gainLog + 32 + coefficientErrorSpatialLog Pphysical + 8 ≤ target := by + dsimp only [target, Eextra] + linarith only + intro r W ξn hξn hξle hξInvLate hW cells poly hp hmem Rrank hNlarge hrank hRankLarge V + hcells bases Z + have hτInvMaster : τfree⁻¹ ≤ Real.exp master := + hτfreeInv.trans (Real.exp_le_exp.mpr hPhysicalMaster.2) + have hξone : ξn ≤ 1 := hξle.trans (min_le_left _ _) + obtain ⟨hNpos, hbases, hbox, hmass, hnormalizer, hmargin⟩ := + preparedModularGeneralDetector_late_positive_bounds B U basis S hb o μ ν hRpos hσpos + (fun _ => hσt.trans htone) Cforward Vtail hforward hVactual Cchart hCchart hchart + (geometry.hbudgets Cchart hCchart hCchartBound).1 hMaster hLate geometry.hdimensions + hDMaster.2 (hnX.trans hBMaster) + (fun j => (hR j).2.2.trans (Real.exp_le_exp.mpr hpRadiusMaster)) + (fun j => (geometry.hσi j).trans (Real.exp_le_exp.mpr hScaleLate)) hSLate + (fun j => (hForward j).trans hExpMaster) (fun j => (hVtail j).trans hExpMaster) + poly hp hmem stride hstride + (fun i => (hstrideBound i).trans (Real.exp_le_exp.mpr (hQstride.2.trans hBMaster))) + hτfree hτInvMaster hτfreeHalf hτfreeDim hξn hξone hξInvLate + N hrank cells hcells hNlarge hRankLarge + let : ∀ i, NeZero (N i) := fun i => ⟨(hNpos i).ne'⟩ + have consumer := preparedModularGeneralDirectDetectionFreeTrimSharedWidthInterface_of_geometry + (B := B) (U := U) (basis := basis) (hR := hRpos) (hσ := hσpos) (S := S) (P := Pscale) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τfree) + (Q := Q) (hb := hb) (o := o) (bW := bW) (μ := μ) (ν := ν) (μrows := μrows) + hs Bstruct D target Pk Prho Qstride master Plate gainLog Pphysical lateTarget + (Real.toNNReal (Real.exp pRadius)) geometry + have completed := consumer hLate hMaster hDMaster.2 hPkMaster + ⟨hQstride.1, hQstride.2.trans hBMaster⟩ hDetectMaster (hnX.trans hBMaster) + (fun j => (hR j).2.1) + (fun j => (hR j).2.2.trans (Real.exp_le_exp.mpr hpRadiusMaster)) + (fun j => (geometry.hσi j).trans (Real.exp_le_exp.mpr hScaleLate)) + hSLate hKMaster (hcutoff.trans hExpMaster) hMkP hMkPk hstride hstrideBound + Cchart hCchart hCchartBound hchart Cforward hforward + (fun j => (hForward j).trans hExpMaster) (fun j => (hVtail j).trans hExpMaster) hVactual hBa hBi + ⟨hu, huP.trans hPMaster⟩ hModelMaster hSliceModel hcountModel hαlower hαone + hPrhoMaster hTargetMaster hGainMaster hCoarseMaster hCoarseLower hCoarseLate hPhysicalMaster + hmPhysical hDimPhysical hvarsPhysical hXPhysical hPkPhysical hQstridePhysical + (le_refl _) hprecision hXiLate hτfree hτfreeInv hξn hξle hξInvLate + refine ⟨hNpos, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩ + intro Path pathLaw sides Sites e Tests _ Ldetect _ _ dims _ _ _ _ + Ddetect Vdetect slices cdetect stepdetect Hdetect hstep hboxDetect hdense hcount hcomplexity hnorm budget' + exact completed cells poly hp hmem hNlarge hrank hRankLarge hcells hbases hmass + hnormalizer.2.2.1 Ddetect Vdetect slices cdetect stepdetect Hdetect hstep hboxDetect hdense hcount + hcomplexity hnorm hcapacity hMk.2 + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +def SharedWidthPreparedLateToleranceFreeTrimSourceStatement (m : ℕ) (Pdetect : Polynomial ℕ) : Prop := + let Cdetect := sampledSupportedSlicedDetectionConstant 0 Pdetect + let Aearly := Classical.choose (exists_preparedModularGeneralCanonicalEarlyParameters m 0 Cdetect) + let Aalloc := Classical.choose (exists_preparedModularCanonicalDetectorAllocationBudget m) + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {X J₀ : Type} (L : RankPreparationFamily X J₀ m) {M nX : ℕ}, + (∀ j, Fintype.card (L j).Coord ≤ M) → + ∀ {Pstruct pSlice Qstride : ℝ}, + 0 < m → 0 ≤ Pstruct → (M : ℝ) ≤ Pstruct → + pSlice ∈ Set.Icc 0 Pstruct → Qstride ∈ Set.Icc 0 Pstruct → (nX : ℝ) ≤ Pstruct → + let Jalloc := modularInitialBlockCount m (nX + m * M) + let pnum : ℝ := enlargedPreparedCommonSamplerDimension m M Jalloc + let Bstruct := (Pstruct + Aalloc) ^ Aalloc + let G := EnlargedPreparedCommonKernel m Jalloc + let I := PreparedSamplerContinuous L + let n := preparedSamplerTransverse L + let B := EnlargedPreparedCommonSamplerBlock L Jalloc + let selection := enlargedPreparedCommonCanonicalSelection m Jalloc 0 (Nat.zero_le m) + let A := Classical.choose (exists_allocatedCanonicalSlice_early_radius.{0,0,0,0} m) + let radiusBudget := Bstruct + (2 * Bstruct + A) ^ A + 2 + let rowSets := fun j : Fin m => boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1) + let T := allocatedIdealCoverSupport (G := G) B rowSets + let siteRadius := allocatedProductIdealSiteRadius (G := G) B rowSets + let D := allocatedComparisonDimension m pnum + ∃ (pRadius : ℝ) (R : Fin m → ℝ), + pRadius ∈ Set.Icc 0 radiusBudget ∧ + (∀ j, 0 < R j ∧ R j ≤ 1 ∧ (R j)⁻¹ ≤ Real.exp pRadius) ∧ + 1 ≤ siteRadius ∧ (∀ j, 0 ≤ T j) ∧ + (∀ j, partitionedIdealRadius (Fin (0 + 1)) m + 1 ≤ T j) ∧ + (∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (0 + 1)) * + ((Fintype.card (Fin (0 + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) ∧ + (∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) ∧ + (∀ j, T j ≤ Real.exp pRadius) ∧ 2 * (siteRadius : ℝ) ≤ Real.exp pRadius ∧ + (∀ Cchart : Fin m → ℝ, (∀ j, 0 ≤ Cchart j) → (∀ j, Cchart j ≤ Real.exp Bstruct) → + (∀ j, Cchart j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) ∧ + (∀ j, Cchart j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) ∧ + (∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (0 + 1))) * + (Cchart j * (((Fintype.card (I j) : ℝ) + 1) * + (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4)) ∧ + AllocatedComparisonDimensions (G := G) B (Fin (0 + 1)) (fun j => (rowSets j : Type)) D ∧ + ∀ {u P : ℝ}, 0 ≤ u → Bstruct + u ≤ P → + let Pearly := P + (2 * P + A) ^ A + 2 + let pModel := allocatedEarlyModelLog Pearly pSlice (Fintype.card (LayerSamplerVariables G I n B)) + let pDetect := allocatedModelTestLog u pModel + let aDetect := 2 * u + 4 * pModel + 7 + let gainLog := slicedDetectionGainLog 0 Cdetect (Fintype.card (LayerSamplerVariables G I n B)) pDetect pDetect aDetect + let Pk := scalarKernelLogarithmicBudget (Fin (0 + 1)) G (gainLog + pDetect + 4) + let Qearly := (P + Aearly) ^ Aearly + let Pphysical := Qearly + Pk + Qstride + nX + (m + 1 : ℕ) + 8 + let Eextra := coefficientErrorSpatialLog Pphysical + 8 + let target := gainLog + 32 + Eextra + let F := pDetect + 2 + let Tmod := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let _δ := Real.exp (-(pDetect + 1)) + let E := target + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 5 + let _η := Real.exp (-E) + let Prho := 2 * affineProfileInputEnvelope D (canonicalSublevelCutoffLip : ℝ) + (canonicalTransitionLip : ℝ) E F + 2 + let Ptail := affineProfileToleranceEnvelope m D (D * (D + 1) + D * D + D + 1) + (canonicalSublevelCutoffLip : ℝ) (canonicalTransitionLip : ℝ) E F + let _K := Classical.choose (exists_allocatedAffineScaleLog_bound m) + let budget := (P + Eextra + C) ^ C + let master := budget + Pphysical + Pearly + gainLog + 32 + pRadius ≤ budget ∧ (∀ j, T j ≤ Real.exp budget) ∧ + 2 * (siteRadius : ℝ) ≤ Real.exp budget ∧ radiusBudget ≤ Pearly ∧ + P ≤ Pearly ∧ Pearly ≤ budget ∧ pModel ∈ Set.Icc 0 budget ∧ pDetect ∈ Set.Icc 0 budget ∧ + aDetect ∈ Set.Icc 0 budget ∧ target ∈ Set.Icc 0 budget ∧ D ∈ Set.Icc 0 budget ∧ gainLog ∈ Set.Icc 0 budget ∧ Pk ∈ Set.Icc 0 budget ∧ + Prho ∈ Set.Icc 0 budget ∧ Ptail ∈ Set.Icc 0 budget ∧ Tmod ∈ Set.Icc 0 budget ∧ + ∃ t : ℝ, 0 < t ∧ t ≤ 1 ∧ + t⁻¹ ≤ Real.exp Ptail ∧ t⁻¹ ≤ Real.exp budget ∧ + ∀ {Qσ : ℝ}, 0 ≤ Qσ → + let σ := min t (Real.exp (-Qσ)) + let Pscale := pRadius + Ptail + Qσ + let lengthLog := allocatedAffineLengthLog m D Pscale Prho Pk target F Tmod + let Pseed := allocatedScaleLog (D + Pscale + lengthLog + 1) + 0 < σ ∧ σ ≤ t ∧ σ ≤ Real.exp (-Qσ) ∧ + σ⁻¹ ≤ Real.exp Pscale ∧ Pscale ∈ Set.Icc 0 (2 * budget + Qσ) ∧ + ∀ (Lmin : ℕ) {W Qw Pmin : ℝ}, + 1 ≤ W → 0 ≤ Qw → W ≤ Real.exp Qw → + 0 ≤ Pmin → (Lmin : ℝ) ≤ Real.exp Pmin → + ∀ {J : Fin m → Type} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ), + ∃ S : LayerSamplerScale (G := G) B U basis R (fun _ => σ), + Pk ≤ Pscale ∧ Lmin ≤ S.value ∧ + (S.value : ℝ) ≤ Real.exp + (allocatedWitnessScaleLog Pseed Qw + (1 + Pseed ^ 2) * Pmin) ∧ + (∀ j i, S.value ^ (j.val + 1) < basisAxisScale (basis j) i → + 8 * (probabilityProfileLipschitz : ℝ) * W ≤ + (layerSamplerGapWidth (G := G) B R ⟨j, i⟩ / 2) * + ((basisAxisScale (basis j) i : ℝ) / (S.value : ℝ) ^ (j.val + 1))) ∧ + (∀ lateTarget : ℝ, gainLog + 32 ≤ lateTarget → + let Plate := preparedModularGeneralDetectorLateMaster master Pseed Qw Pphysical lateTarget + + (1 + Pseed ^ 2) * Pmin + Pscale + let resources := preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m 0) (0 + 1) master Plate + resources.nativeBudget = (preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m 0) (0 + 1) master master).nativeBudget ∧ + (∀ (hRpos : ∀ j, 0 < R j) (hσpos : ∀ _j : Fin m, 0 < σ) + (stride N : Fin nX → ℕ) + (Q : Fin m → Type) [∀ j, Fintype (Q j)] + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (_bW : ∀ j, Module.Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + [CompactSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [MeasurableSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [BorelSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + (μrows : Measure (CoefficientTorus (K := Fin (0 + 1)) U)) + [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + [MeasurableSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + [BorelSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + (Vtail : Fin m → ℝ≥0) (α τfree : ℝ), + Real.exp (-aDetect) ≤ α → α ≤ 1 → + PreparedModularGeneralDirectDetectionFreeTrimPreparedSharedWidthInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hRpos) (hσ := hσpos) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τfree) + (hb := hb) (o := o) Bstruct Qstride master Plate gainLog Pphysical lateTarget)) ∧ + ∀ α : ℝ, Real.exp (-aDetect) ≤ α → + Real.exp (-gainLog) ≤ + (Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1)) ∧ + (scalarKernelCutoff (Fin (0 + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1))) / 2) : ℝ) ≤ Real.exp Pk ∧ + scalarKernelCutoff (Fin (0 + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1))) / 2) ≤ S.value + +theorem exists_sharedWidth_prepared_late_tolerance_free_trim_source (m : ℕ) (Pdetect : Polynomial ℕ) : + SharedWidthPreparedLateToleranceFreeTrimSourceStatement m Pdetect := by + unfold SharedWidthPreparedLateToleranceFreeTrimSourceStatement + intro Cdetect Aearly Aalloc + have hactual := exists_sharedWidth_detected_canonical_late_tolerance_free_trim_prepared m 0 Pdetect + unfold SharedWidthDetectedCanonicalLateToleranceFreeTrimPreparedStatement at hactual + obtain ⟨C, hC, hsource⟩ := hactual + refine ⟨C, hC, ?_⟩ + intro X J₀ L M nX hCoord Pstruct pSlice Qstride hm hPstruct hM hpSlice hQstride hnX + Jalloc pnum Bstruct G I n B selection A radiusBudget rowSets T siteRadius D + obtain ⟨hStruct, _, hnum, _⟩ := + (Classical.choose_spec (exists_preparedModularCanonicalDetectorAllocationBudget m)).2 + hPstruct hM hnX + obtain ⟨hvars, hI, hn⟩ := enlargedPreparedCommonSampler_dimensions L Jalloc hCoord + have hblocks (a : LayerSamplerAxis I n) : + (boundedBooleanJetRows (Fin (0 + 1)) (a.1.val + 1)).card ≤ Fintype.card (B a) := by + calc + _ = Fintype.card (BoundedBooleanJet (Fin (0 + 1)) (a.1.val + 1)) := + (Fintype.card_coe _).symm.trans (Fintype.card_congr (boundedBooleanJetRowsEquiv _ _)) + _ ≤ _ := enlargedPreparedCommonSamplerBlock_jets L Jalloc 0 (Nat.zero_le m) a + obtain ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, hlate⟩ := + hsource (G := G) B hm (Nat.zero_le m) (hPstruct.trans hStruct) hnum + (Nat.cast_le.mpr hvars) (fun j => Nat.cast_le.mpr (hI j)) + (fun j => Nat.cast_le.mpr (hn j)) hblocks + ⟨hpSlice.1, hpSlice.2.trans hStruct⟩ ⟨hQstride.1, hQstride.2.trans hStruct⟩ + (hnX.trans hStruct) + (fun j i => enlargedPreparedCommonSamplerBlock_positiveModerate L Jalloc 0 (Nat.zero_le m) ⟨j, Sum.inr i⟩) + (fun j i => enlargedPreparedCommonSamplerBlock_uniform L Jalloc 0 (Nat.zero_le m) ⟨j, Sum.inr i⟩) + (enlargedPreparedCommonKernel_analytic_capacity m Jalloc 0 (Nat.zero_le m)) + refine ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, ?_⟩ + intro u P hu hmaster Pearly pModel pDetect aDetect gainLog Pk Qearly Pphysical Eextra target + F Tmod δ E η Prho Ptail K budget master + obtain ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, htolerances⟩ := hlate hu hmaster + refine ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, ?_⟩ + intro Qσ hQσ σ Pscale lengthLog Pseed + obtain ⟨hσ, hσt, hσexp, hσinv, hScaleBound, hsamplers⟩ := htolerances hQσ + refine ⟨hσ, hσt, hσexp, hσinv, hScaleBound, ?_⟩ + intro Lmin Wscale Qw Pmin hWscale hQw hWexp hPmin hLmin J _ U basis + obtain ⟨S, hPkScale, hFloor, hSWitness, hgap, hdetector, hgainKernel⟩ := + hsamplers Lmin hWscale hQw hWexp hPmin hLmin U basis + refine ⟨S, hPkScale, hFloor, hSWitness, hgap, ?_, hgainKernel⟩ + intro lateTarget hCoarseLower Plate resources + obtain ⟨hnative, hprepared⟩ := hdetector lateTarget hCoarseLower + exact ⟨hnative, hprepared selection⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedModularGeneralDirectDetectionFreeTrim.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedModularGeneralDirectDetectionFreeTrim.lean new file mode 100644 index 0000000000000000000000000000000000000000..71636e069e127ae0c25fb7f865cd4d461d80da86 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedModularGeneralDirectDetectionFreeTrim.lean @@ -0,0 +1,1122 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedModularGeneralDirectDetectionLateFloor +import OAI.Combinatorics.Progressions.Geometry.PreparedModularGeneralDetectorFreeSpatialBounds + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +variable {m : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {s nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (Pdetect : Polynomial ℕ) (pDetect qDetect α : ℝ) +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +def AllocatedPreparedNativeInterfaceGeneralSharedWidth + (Pchart P _D target Pk Prho Qstride : ℝ) (K : ℝ≥0) : Prop := + ∀ (_hMkP : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp P) + (_hMkPk : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pk) + (_hQstride : 0 ≤ Qstride) + (_hstride : ∀ i, 0 < stride i) + (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) + (_hC : ∀ j, 0 ≤ C j) + (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + {Pbox Vlog Nlog Mlog baseAmbient : ℝ} + (_hPbox : 0 ≤ Pbox) + (_hVlog : 0 ≤ Vlog) + (_hNlog : 0 ≤ Nlog) + (_hMlog : 0 ≤ Mlog) + (_hbox : 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp Pbox) + (_hvolume : allocatedFullGridNaturalVolume B U basis S rowSets ≤ Real.exp Vlog) + (_hnormalizer : ‖((allocatedProductIdealNormalizer B U basis S rowSets : ℝ) : ℂ)⁻¹‖ ≤ Real.exp Nlog) + (_hmaskLog : (Fintype.card (LayerSamplerAxis I n) : ℝ) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * (((m + 1 : ℕ) : ℝ) * Pk)) ≤ Mlog) + (_hbaseAmbient : 0 ≤ baseAmbient) + (_hvbase : Vlog ≤ baseAmbient) + (_hnbase : Nlog ≤ baseAmbient) + (_hmbase : Mlog ≤ baseAmbient) + (_hsites : (Fintype.card (Finset (Fin (s + 1))) : ℝ) ≤ baseAmbient) + (_haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ baseAmbient) + (_hlabelLog : (∑ j, (n j : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk)) + + ∑ j, (Fintype.card (Q j) : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk) ≤ baseAmbient) + (_hKbase : (K : ℝ) ≤ Real.exp baseAmbient) + (_hcoords : ((∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp baseAmbient) + (_hperiodLog : ((m + 1 : ℕ) : ℝ) * Pk ≤ baseAmbient) + (_hrowsAmbient : ((∑ j : Fin m, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (_houtputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ baseAmbient) + (_hheight : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ Real.exp baseAmbient) + (Qgrid : ℝ≥0) + (_hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U basis S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U basis S a).1 (allocatedGridIntegerAxis B U basis S a).2) : ℝ) + 1) ≤ Qgrid) + (Ag : ℝ≥0) + (_hAg : LipschitzWith Ag Real.smoothTransition) + (_hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (_hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg : ℝ} + (_hDg : 0 ≤ Dg) + (_hvg : 0 ≤ vg) + (_hwg : 0 ≤ wg) + (_hcube : (Fintype.card (Fin (s + 1)) : ℝ) ≤ Dg) + (_hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (_hrowsD : ∀ j : Fin m, ((boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card : ℝ) ≤ Dg) + (_htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (_hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (_hRv : ∀ j, R j ≤ Real.exp vg) + (_hRiGrid : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (_hδw : pDetect + 1 ≤ wg) + (_hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (_haxesGrid : (Fintype.card {a // grid a} : ℝ) ≤ Dg) + (_hfullAxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ Dg) + (_hfullOutputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ Dg) + (_hambientCount : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ Dg) + (_hprofileBudget : (probabilityProfileLipschitz : ℝ) ≤ Dg) + {Banalytic : ℝ} + (_hBanalytic : 0 ≤ Banalytic) + (_hDanalytic : Dg ≤ Banalytic) + (_hcutoffAnalytic : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Banalytic) + (_hcoordAnalytic : ((K * ∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp Banalytic) + (_hgridAnalytic : (Qgrid : ℝ) ≤ Real.exp Banalytic) + {Pnum : ℝ} + (_hPnum : 0 ≤ Pnum) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) + (_hn : ∀ j, (n j : ℝ) ≤ Pnum) + (_hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (_hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (_hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Real.exp Pnum) + {Pproj coarseTarget Ecoarse pGain : ℝ}, + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (s + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn), ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + (signal : ((Fin nX) → ℤ) → ℂ), + (∀ u ∈ integerBox N, ‖signal u‖ ≤ 1) → + (∀ u, u ∉ integerBox N → signal u = 0) → + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (s + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,0,0} m (s + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (_hPhysicalNonneg : 0 ≤ Pphysical) → (_hMkPhysicalBound : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pphysical) → + (_hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (_hCoarseNonneg : 0 ≤ coarseTarget) → + (_hDimPhysicalBound : (((s + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (_hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (_hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (s + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (s + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (s + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let Cgrid := Classical.choose (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (s + 1) Ag) + let Qlog := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let tg := ((s + 1 : ℕ) : ℝ) + Qlog + (pDetect + 1) + 1 + let pg := (Cgrid : ℝ) + (((s + 1) + 1 : ℕ) : ℝ) * Qlog + (pDetect + 1) + 4 + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ (allocatedDetectedGain s (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2 → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj Vproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1)) + let coverLog := (Pproj + ((s + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (s + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vproj j) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (s + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,0,0,max 0 0 0} m (s + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vproj j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m) + Pproj) ≤ (N i : ℝ)) → + cells.Nonempty → ∀ (bases : Finset (Fin nX → ℤ)), (hbases : bases.Nonempty) → + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + (htotal : 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem)) → + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW hτSpatial hξn stride cells hmass bases hbases htotal + ∀ {Tdetect : Type} [Fintype Tdetect] [Nonempty Tdetect] + (e : Tdetect → LayerSamplerVariables G I n B → ℤ), Function.Injective e → + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Tdetect) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + 0 ≤ pDetect → 0 ≤ qDetect → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pDetect ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + 0 < α → α ≤ 1 → + Fintype.card (LayerSamplerVariables G I n B) * Real.exp (-pDetect) ≤ α / 8 → + Real.exp (-qDetect) ≤ α / 4 → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + (s + 1) * (s + 3) ≤ Fintype.card G → (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) ≤ S.value → + let C := Classical.choose (exists_canonicalSlicedNative_input_budget m (s + 1) Amass Aanalytic) + let Bbudget := (Pnative + C) ^ C + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{0,0,0,0,0,0} m (s + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun u : integerBox N => u.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) (integerBox_nonempty N)).correlation + (fun u => signal u.val) (fun u => star (twistData.eval N poly u.val) * Fnative u)‖ + +include hb o bW μ ν μrows hR hσ in + +theorem allocatedPreparedNativeInterfaceGeneral_of_geometry_sharedWidth + (hsm : s ≤ m) + (Pchart D target Pk Prho Qstride : ℝ) (K : ℝ≥0) + (geometry : AllocatedEarlyNativeSourceGeometryGeneral (s := s) (B := B) (U := U) (basis := basis) + (S := S) (nX := nX) Pchart P D target Pk Prho Qstride pDetect K) : + AllocatedPreparedNativeInterfaceGeneralSharedWidth (B := B) (U := U) (basis := basis) + (hR := hR) (hσ := hσ) (S := S) (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (pDetect := pDetect) (qDetect := qDetect) (α := α) + (Q := Q) (hb := hb) (o := o) Pchart P D target Pk Prho Qstride K := by + unfold AllocatedPreparedNativeInterfaceGeneralSharedWidth + intro hMkP hMkPk hQstride hstride hstrideBound C hC hCbound hchart Cforward hforward Pbox Vlog Nlog Mlog baseAmbient hPbox hVlog hNlog hMlog hbox hvolume hnormalizer hmaskLog hbaseAmbient hvbase hnbase hmbase hsites haxes hlabelLog hKbase hcoords hcutoff hperiodLog hrowsAmbient houtputs hheight Qgrid hQgrid Ag hAg hBa hBi Dg vg wg hDg hvg hwg hcube hdegree hrowsD htail hblocks hRv hRiGrid hδw hcoeff haxesGrid hfullAxes hfullOutputs hambientCount hprofileBudget Banalytic hBanalytic hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic Pnum hPnum hI hn hcoeffEarly hRiEarly hVEarly Pproj coarseTarget Ecoarse pGain + ambientQ ambientBudget τ Pphysical W ξn hξn hξnLe hW cells poly hp hmem signal hsignal hzero + lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel Cgrid Qlog tg pg p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual + obtain ⟨hsmall, hbudget, hsitebudget⟩ := geometry.hbudgets C hC hCbound + have hσ1 (j) : σ j ≤ 1 := (geometry.hσsmall j).trans geometry.htone + have hnative := exists_allocatedDetected_spatial_native_source_sharedWidth + (hsm := hsm) + (ξn := ξn) (τ := τ) (Pphysical := Pphysical) + (B := B) (U := U) (basis := basis) (hR := hR) (hσ := hσ) (S := S) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (pDetect := pDetect) (qDetect := qDetect) (α := α) + (hP := geometry.hP) (hMkP := hMkP) (hRP := geometry.hRP) + (hRi := geometry.hRi) (hσi := geometry.hσi) (hcount := geometry.hcount) + (Q := Q) (hb := hb) (o := o) (bW := bW) (ν := ν) (μ := μ) (μrows := μrows) + (D := D) (target := target) (Pk := Pk) (Prho := Prho) (Qstride := Qstride) + (Pproj := Pproj) (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + geometry.hdimensions geometry.hPk hMkPk geometry.hPrho geometry.htarget hQstride hstride hstrideBound + geometry.hlength geometry.ρ geometry.t geometry.htone geometry.hs (geometry.hρ _) (geometry.hρ1 _) geometry.hσsmall + geometry.T geometry.hT geometry.hsource C hC hchart hbudget (geometry.hρlog _) + geometry.hη0 geometry.hηsmall geometry.siteRadius geometry.hrone hsitebudget Cforward hforward K + geometry.hK geometry.hradius hPbox hVlog hNlog hMlog hbox hvolume + hnormalizer hmaskLog hbaseAmbient hvbase hnbase hmbase hsites haxes + hlabelLog hKbase hcoords hcutoff hperiodLog hrowsAmbient houtputs hheight + Qgrid hQgrid Ag hAg hBa hBi hDg hvg + hwg hcube hdegree hrowsD htail hblocks hRv hRiGrid + hδw hcoeff haxesGrid hfullAxes hfullOutputs hambientCount hprofileBudget hBanalytic + hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic hPnum hI hn hcoeffEarly + hRiEarly hVEarly + have hnative := hnative (Pnative := Pnative) hξn hξnLe cells poly hp hmem signal hsignal hzero + (lossTarget := lossTarget) (Psample := Psample) (Rrank := Rrank) + (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision + exact hnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj hcoverAmbient hcoverSample hmassSample hCactual hVactual hσ1 hsmall + +include hb o bW μ ν μrows hR hσ in + +theorem allocatedPreparedNativeInterfaceGeneral_of_nonempty_geometry_sharedWidth + (hsm : s ≤ m) + (Pchart D target Pk Prho Qstride : ℝ) (K : ℝ≥0) + (geometry : Nonempty (AllocatedEarlyNativeSourceGeometryGeneral (s := s) (B := B) (U := U) (basis := basis) + (S := S) (nX := nX) Pchart P D target Pk Prho Qstride pDetect K)) : + AllocatedPreparedNativeInterfaceGeneralSharedWidth (B := B) (U := U) (basis := basis) + (hR := hR) (hσ := hσ) (S := S) (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (pDetect := pDetect) (qDetect := qDetect) (α := α) + (Q := Q) (hb := hb) (o := o) Pchart P D target Pk Prho Qstride K := by + obtain ⟨geometry⟩ := geometry + exact allocatedPreparedNativeInterfaceGeneral_of_geometry_sharedWidth + (hsm := hsm) + (B := B) (U := U) (basis := basis) (hR := hR) (hσ := hσ) (S := S) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (pDetect := pDetect) (qDetect := qDetect) (α := α) + (Q := Q) (hb := hb) (o := o) (bW := bW) (ν := ν) (μ := μ) (μrows := μrows) + Pchart D target Pk Prho Qstride K geometry + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +variable {m s : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +variable (α : ℝ) +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +include hb o bW μ ν μrows hR hσ in + +theorem preparedModularGeneralDirectDetectionAmbient_sharedWidth (hsm : s ≤ m) + (Pchart D target Pk Prho Qstride : ℝ) (K : ℝ≥0) + (geometry : AllocatedEarlyNativeSourceGeometryGeneral (s := s) (B := B) (U := U) (basis := basis) + (S := S) (nX := nX) Pchart P D target Pk Prho Qstride pDetect K) + {Pmaster Plate : ℝ} (hLate : Pmaster ≤ Plate) (hMaster : 0 ≤ Pmaster) (hDMaster : D ≤ Pmaster) + (hPkMaster : Pk ∈ Set.Icc 0 Pmaster) (hQstrideMaster : Qstride ∈ Set.Icc 0 Pmaster) + (hDetectMaster : pDetect ∈ Set.Icc 0 Pmaster) (hnXMaster : (nX : ℝ) ≤ Pmaster) + (hRone : ∀ j, R j ≤ 1) + (hRiMaster : ∀ j, (R j)⁻¹ ≤ Real.exp Pmaster) + (hSLate : (S.value : ℝ) ≤ Real.exp Plate) + (hKMaster : (K : ℝ) ≤ Real.exp Pmaster) + (hcutoffMaster : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pmaster) + (hMkP : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp P) + (hMkPk : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pk) + (hstride : ∀ i, 0 < stride i) (hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) (hCbound : ∀ j, C j ≤ Real.exp Pchart) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (hForwardMaster : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pmaster) + (hVtailMaster : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pmaster) + (hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) : + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let Pbox := r.Pbox + let Vlog := r.Vlog + let Nlog := r.Nlog + let Mlog := r.Q + let baseAmbient := r.baseAmbient + let _Qgrid := Real.toNNReal (8 * (D + 1)) + let Ag := canonicalTransitionLip + let Dg := r.Dg + let vg := r.v + let wg := r.w + let Banalytic := r.Banalytic + let Pnum := Pmaster + ∀ {Pproj coarseTarget Ecoarse pGain : ℝ}, + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (s + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn), + ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) +, + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (s + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,0,0} m (s + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (_hPhysicalNonneg : 0 ≤ Pphysical) → (_hMkPhysicalBound : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pphysical) → + (_hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (_hCoarseNonneg : 0 ≤ coarseTarget) → + (_hDimPhysicalBound : (((s + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (_hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (_hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (s + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (s + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (s + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let Cgrid := Classical.choose (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (s + 1) Ag) + let Qlog := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let tg := ((s + 1 : ℕ) : ℝ) + Qlog + (pDetect + 1) + 1 + let pg := (Cgrid : ℝ) + (((s + 1) + 1 : ℕ) : ℝ) * Qlog + (pDetect + 1) + 4 + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ (allocatedDetectedGain s (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2 → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1)) + let coverLog := (Pproj + ((s + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (s + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (s + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,0,0,max 0 0 0} m (s + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vtail j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m) + Pproj) ≤ (N i : ℝ)) → + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + ∀ (hbases : bases.Nonempty), + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + (htotal : 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem)) → + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW hτSpatial hξn stride cells hmass bases hbases htotal + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + (s + 1) * (s + 3) ≤ Fintype.card G → (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) ≤ S.value → + let Cbudget := Classical.choose (exists_canonicalSlicedNative_input_budget m (s + 1) Amass Aanalytic) + let Bbudget := (Pnative + Cbudget) ^ Cbudget + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{0,0,0,0,0,0} m (s + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + 0 ≤ u → 0 ≤ pModel → pSlice ≤ pModel → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp pModel → + Real.exp (-(2 * u + 4 * pModel + 7)) ≤ α → α ≤ 1 → + ∀ (signal : (Fin nX → ℤ) → ℂ), + (∀ t, ‖signal t‖ ≤ 1) → (∀ t, t ∉ integerBox N → signal t = 0) → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun t : integerBox N => t.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) (integerBox_nonempty N)).correlation + (fun t => signal t.val) (fun t => star (twistData.eval N poly t.val) * Fnative t)‖ := by + intro r Pbox Vlog Nlog Mlog baseAmbient Qgrid Ag Dg vg wg Banalytic Pnum + have hd := geometry.hdimensions + have hJ := (allocatedProfile_dimensions U basis o B hd hb bW).1 + have late := preparedModularGeneralDetector_late_ambient_bounds B rowSets U basis S + Cforward K (preparedModularGeneralDetectorConstants m s) rfl hLate hd hDMaster + hR hRone hRiMaster hSLate (fun j => (hJ j).trans hDMaster) + (fun j => (hVactual j).2.trans (hVtailMaster j)) hForwardMaster hKMaster hcutoffMaster + have early := preparedModularGeneralDetector_early_analytic_bounds B rowSets U basis S + Vtail Cforward K (preparedModularGeneralDetectorConstants m s) rfl hd hDMaster + hRone hRiMaster (fun j => (hJ j).trans hDMaster) hVtailMaster + (fun j => (hVactual j).2) hForwardMaster hKMaster hcutoffMaster hDetectMaster.2 + obtain ⟨_, hperiod, _, hmask, hlabel, _⟩ := + preparedModularGeneralDetector_period_prefactor B U basis o hb bW hMaster hd hDMaster + hnXMaster hPkMaster hQstrideMaster hDetectMaster ⟨hMaster, le_rfl⟩ + have hQbase : r.Q ≤ r.baseAmbient := by + have hr := ((Classical.choose_spec (exists_preparedModularGeneralDetector_resource_budget + (preparedModularGeneralDetectorConstants m s) (s + 1))).2 hMaster hLate).1 + have hm : 0 ≤ ((layerTailDegree m + 1 : ℕ) : ℝ) * Plate := + mul_nonneg (Nat.cast_nonneg _) (hMaster.trans hLate) + change r.Q ≤ r.Pproj + r.coverLog + r.Vlog + r.Nlog + r.Q + + (layerTailDegree m + 1 : ℕ) * Plate + 3 * Pmaster + comparisonProfileBound + (2 ^ (s + 1) : ℕ) + 32 + linarith only [hr.Pproj.1, hr.coverLog.1, hr.Vlog.1, hr.Nlog.1, hm, hMaster, + Nat.cast_nonneg («α» := ℝ) comparisonProfileBound, Nat.cast_nonneg («α» := ℝ) (2 ^ (s + 1))] + have hNative := allocatedPreparedNativeInterfaceGeneral_of_geometry_sharedWidth + (B := B) (U := U) (basis := basis) (hR := hR) (hσ := hσ) (S := S) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) («pDetect» := pDetect) («qDetect» := qDetect) («α» := α) + (Q := Q) (hb := hb) (o := o) (bW := bW) (ν := ν) (μ := μ) (μrows := μrows) + hsm Pchart D target Pk Prho Qstride K geometry + intro Pproj coarseTarget Ecoarse pGain ambientQ ambientBudget τ Pphysical W ξn hξn hξn_le hW + have hnative := hNative (ξn := ξn) (τ := τ) (Pphysical := Pphysical) + (Pproj := Pproj) (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + hMkP hMkPk hQstrideMaster.1 hstride hstrideBound C hC hCbound hchart Cforward hforward + late.hPbox late.hVlog late.hNlog (hmask.1.trans hmask.2) late.hbox late.hvolume + late.hnormalizer hmask.2 late.hbaseAmbient late.hvbase late.hnbase hQbase + late.hsites late.haxes (hlabel.2.trans hQbase) late.hKbase late.hcoords + late.hcutoff (hperiod.2.trans hQbase) late.hrowsAmbient late.houtputs late.hheight + Qgrid early.hQgrid Ag canonicalTransitionLip_spec hBa hBi + early.hDg early.hvg early.hwg early.hcube early.hdegree early.hrowsD early.htail + (fun j i => early.hblocks ⟨j, Sum.inr i⟩) early.hRv early.hRiGrid early.hδw early.hcoeff + early.haxesGrid early.hfullAxes early.hfullOutputs early.hambientCount early.hprofileBudget + early.hBanalytic early.hDanalytic early.hcutoffAnalytic early.hcoordAnalytic early.hgridAnalytic + hMaster early.hI early.hn early.hcoeffEarly early.hRiEarly early.hVEarly + + intro cells poly hp hmem lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel Cgrid Qlog tg pg p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual hXmass hframeMass hstrideMass hτMass + AmassWindow hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj Aproj hSizeProj hRankProj + Pside hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hmass htotal Path pathLaw + sides Sites e Tests _ Ldetect _ _ dims _ _ _ _ Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hdenseSlice hdimensionDetect hcomplexity hcap hGdetect hkernel + Cbudget Bbudget Anorm Anative Abudget budget hu hpModel hpSliceModel hcountModel + hαlower hαone signal hsignal hzero hdetected + obtain ⟨hpDetect, hα, _, hmeshDetect, hthreshold⟩ := + preparedModularGeneralDirectDetectionThreshold_parameters + (Fintype.card (LayerSamplerVariables G I n B)) hu hpModel hcountModel hαlower hαone + have hpSliceDetect := preparedModularGeneralDirectDetectionThreshold_slice_le hu hpModel hpSliceModel + have hdenseDetect z j := (hdenseSlice z j).mono_parameter hpSliceDetect + have hsides (k : LayerSamplerVariables G I n B) : 0 < sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U basis S j + let : ∀ k, NeZero (sides k) := fun k => ⟨(hsides k).ne'⟩ + let : Nonempty Sites := (integerBox_nonempty sides).to_subtype + have hnative := hnative (Pnative := Pnative) hξn hξn_le cells poly hp hmem signal + (fun t _ => hsignal t) hzero + (lossTarget := lossTarget) (Psample := Psample) (Rrank := Rrank) + (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision + have hnative := hnative (Pside := Pside) + hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vtail hcoverAmbient hcoverSample hmassSample hCactual hVactual + hXmass hframeMass hstrideMass hτMass hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj + hProfileProj hCproj hVproj hXproj hFrameProj hStrideProj hτProj hξProj hSizeProj hRankProj + exact hnative hProjSide hCapSide hpSide htargetSide hside hCells _ hbases + hmass htotal e Subtype.val_injective Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hpDetect hpDetect hdenseDetect hdimensionDetect hcomplexity hcap + hα hαone hmeshDetect hthreshold hdetected hGdetect hkernel + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +theorem preparedModularGeneralDetector_required_sharedWidth_side + (K : PreparedModularCanonicalDetectorResourceConstants) (dim : ℕ) + (hAproj : 1 ≤ K.Aproj) {P L : ℝ} (hP : 0 ≤ P) (hPL : P ≤ L) : + let r := preparedModularGeneralDetectorResources K dim P L + (r.Pside + K.Aside) ^ K.Aside + r.Pproj ≤ r.required := by + intro r + have hL : 0 ≤ L := hP.trans hPL + have h := ((Classical.choose_spec + (exists_preparedModularGeneralDetector_resource_budget K dim)).2 hP hPL).1 + have hproj : 1 ≤ r.Pproj := by + change 1 ≤ 4 * (L + 8) ^ 2 + nlinarith [sq_nonneg L] + have hbase : 1 ≤ r.Pproj + K.Aproj := by + exact hproj.trans (le_add_of_nonneg_right (Nat.cast_nonneg _)) + have hprojTerm : r.Pproj ≤ (r.Pproj + K.Aproj) ^ K.Aproj := + (le_add_of_nonneg_right (Nat.cast_nonneg _)).trans + (le_self_pow₀ hbase (by omega)) + have hs := h.Psample.1 + have hm := h.Pmass.1 + have hf := h.full.1 + have he := h.E.1 + have h1 : 0 ≤ (r.Psample + K.Apert) ^ K.Apert := by positivity + have h2 : 0 ≤ (r.Pmass + K.AmassWindow) ^ K.AmassWindow := by positivity + have h5 : 0 ≤ (r.full + r.E + K.Amarginal) ^ K.Amarginal := by positivity + have hsum : r.required = (r.Psample + K.Apert) ^ K.Apert + + (r.Pmass + K.AmassWindow) ^ K.AmassWindow + (r.Pproj + K.Aproj) ^ K.Aproj + + (r.Pside + K.Aside) ^ K.Aside + (r.full + r.E + K.Amarginal) ^ K.Amarginal := rfl + linarith only [hsum, hprojTerm, h1, h2, h5] + +theorem preparedModularGeneralDetectorConstants_required_sharedWidth_side + (m s dim : ℕ) {P L : ℝ} (hP : 0 ≤ P) (hPL : P ≤ L) : + let K := preparedModularGeneralDetectorConstants m s + let r := preparedModularGeneralDetectorResources K dim P L + (r.Pside + K.Aside) ^ K.Aside + r.Pproj ≤ r.required := by + have hAproj : 2 ≤ (preparedModularGeneralDetectorConstants m s).Aproj := + (Classical.choose_spec (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1)))).2.1 + exact preparedModularGeneralDetector_required_sharedWidth_side + (preparedModularGeneralDetectorConstants m s) dim (by omega) hP hPL + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +variable {m s : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +variable (α τ : ℝ) +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +def PreparedModularGeneralDirectDetectionFreeTrimSharedWidthInterface + (Pchart P D target Pk Prho Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ) (K : ℝ≥0) : Prop := + ∀ (_hLate : Pmaster ≤ Plate) (_hMaster : 0 ≤ Pmaster) (_hDMaster : D ≤ Pmaster) + (_hPkMaster : Pk ∈ Set.Icc 0 Pmaster) (_hQstrideMaster : Qstride ∈ Set.Icc 0 Pmaster) + (_hDetectMaster : pDetect ∈ Set.Icc 0 Pmaster) (_hnXMaster : (nX : ℝ) ≤ Pmaster) + (_hRone : ∀ j, R j ≤ 1) + (_hRiMaster : ∀ j, (R j)⁻¹ ≤ Real.exp Pmaster) + (_hσiLate : ∀ j, (σ j)⁻¹ ≤ Real.exp Plate) + (_hSLate : (S.value : ℝ) ≤ Real.exp Plate) + (_hKMaster : (K : ℝ) ≤ Real.exp Pmaster) + (_hcutoffMaster : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pmaster) + (_hMkP : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp P) + (_hMkPk : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pk) + (_hstride : ∀ i, 0 < stride i) (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (_hC : ∀ j, 0 ≤ C j) (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (_hForwardMaster : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pmaster) + (_hVtailMaster : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pmaster) + (_hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (_hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (_hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (_huMaster : u ∈ Set.Icc 0 Pmaster) (_hModelMaster : pModel ∈ Set.Icc 0 Pmaster) + (_hSliceModel : pSlice ≤ pModel) + (_hcountModel : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp pModel) + (_hαlower : Real.exp (-(2 * u + 4 * pModel + 7)) ≤ α) (_hαone : α ≤ 1) + (_hPrhoMaster : Prho ∈ Set.Icc 0 Pmaster) (_htargetMaster : target ∈ Set.Icc 0 Pmaster) + (_hGainMaster : pGain ∈ Set.Icc 0 Pmaster) (_hCoarseMaster : pGain + 32 ≤ Pmaster) + (_hCoarseLower : pGain + 32 ≤ coarseTarget) (_hCoarseLate : coarseTarget ≤ Plate) + (_hPhysicalMaster : Pphysical ∈ Set.Icc 0 Pmaster) + (_hmPhysical : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) (_hDimPhysical : ((s + 2 : ℕ) : ℝ) ≤ Pphysical) + (_hvarsPhysical : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pphysical) + (_hXPhysical : (nX : ℝ) ≤ Pphysical) + (_hPkPhysical : Pk ≤ Pphysical) (_hQstridePhysical : Qstride ≤ Pphysical) + (_hGainLog : slicedDetectionGainLog s (sampledSupportedSlicedDetectionConstant s Pdetect) + (Fintype.card (LayerSamplerVariables G I n B)) pDetect pDetect (2 * u + 4 * pModel + 7) ≤ pGain) + (_hprecision : pGain + 32 + coefficientErrorSpatialLog Pphysical + 8 ≤ target) + (_hXiLog : 2 * (spatialPrimitiveEnvelope Pphysical coarseTarget 0 + + spatialTupleToleranceLog (spatialPrimitiveEnvelope Pphysical coarseTarget 0)) + 4 ≤ Plate), + ∀ (hτSpatial : 0 < τ), τ⁻¹ ≤ Real.exp Pphysical → + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn), + ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) + Pphysical coarseTarget → ξn⁻¹ ≤ Real.exp Plate → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + {Rrank : ℝ}, + (∀ i, Real.exp r.required ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp r.required ≤ Rrank → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + ∀ (hbases : bases.Nonempty), + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + (htotal : 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem)) → + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW hτSpatial hξn stride cells hmass bases hbases htotal + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + (s + 1) * (s + 3) ≤ Fintype.card G → (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) ≤ S.value → + let budget := r.nativeBudget + ∀ (signal : (Fin nX → ℤ) → ℂ), + (∀ t, ‖signal t‖ ≤ 1) → (∀ t, t ∉ integerBox N → signal t = 0) → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun t : integerBox N => t.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) (integerBox_nonempty N)).correlation + (fun t => signal t.val) (fun t => star (twistData.eval N poly t.val) * Fnative t)‖ + +include hb o bW μ ν μrows hR hσ in +theorem preparedModularGeneralDirectDetectionFreeTrimSharedWidthInterface_of_geometry (hsm : s ≤ m) + (Pchart D target Pk Prho Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ) (K : ℝ≥0) + (geometry : AllocatedEarlyNativeSourceGeometryGeneral (s := s) (B := B) (U := U) (basis := basis) + (S := S) (nX := nX) Pchart P D target Pk Prho Qstride pDetect K) : + PreparedModularGeneralDirectDetectionFreeTrimSharedWidthInterface + (B := B) (U := U) (basis := basis) (hR := hR) (hσ := hσ) (S := S) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τ) + (hb := hb) (o := o) + Pchart P D target Pk Prho Qstride Pmaster Plate pGain Pphysical coarseTarget K := by + intro hLate hMaster hDMaster hPkMaster hQstrideMaster hDetectMaster hnXMaster hRone + hRiMaster hσiLate hSLate hKMaster hcutoffMaster hMkP hMkPk hstride hstrideBound + C hC hCbound hchart Cforward hforward hForwardMaster hVtailMaster hVactual hBa hBi + huMaster hModelMaster hSliceModel hcountModel hαlower hαone + hPrhoMaster htargetMaster hGainMaster hCoarseMaster hCoarseLower hCoarseLate hPhysicalMaster hmPhysical hDimPhysical + hvarsPhysical hXPhysical hPkPhysical hQstridePhysical hGainLog hprecision _hXiLog + hτSpatial hτinv r W ξn hξn hξn_le hξLate hW cells poly hp hmem Rrank hNlarge hrank hRankLarge V + let constants := preparedModularGeneralDetectorConstants m s + have hd := geometry.hdimensions + have hmMaster : (m : ℝ) ≤ Pmaster := hd.degree.trans hDMaster + have hJ := (allocatedProfile_dimensions U basis o B hd hb bW).1 + have hJMaster (j : Fin m) : (Fintype.card (J j) : ℝ) ≤ Pmaster := (hJ j).trans hDMaster + have hvarsMaster : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pmaster := + hvarsPhysical.trans hPhysicalMaster.2 + have hAsample : 2 ≤ constants.Asample := + (Classical.choose_spec (exists_allocatedCanonicalProjection_composed_budget m (s + 1) + constants.Acover)).1 + have sampling := preparedModularGeneralDetector_sampling_bounds_of_geometry + (J := J) stride B rowSets selection constants rfl hMaster hLate hAsample hd hDMaster + hnXMaster (preparedModularGeneralDetector_ambient_count hJMaster) htargetMaster.2 + hPhysicalMaster.2 hQstrideMaster.2 hPkMaster.2 hstrideBound + have freeSpatial := preparedModularGeneralDetector_free_spatial_bounds constants (s + 1) + hMaster hLate hAsample hPhysicalMaster.2 hτSpatial hτinv + have bounds := ((Classical.choose_spec + (exists_preparedModularGeneralDetector_resource_budget constants (s + 1))).2 hMaster hLate).1 + obtain ⟨hDn, hgridn, hvn, hFn, hBn, hPnative, hprimitiveNative⟩ := + preparedModularGeneralDetector_native_inputs constants (s + 1) hMaster hLate + obtain ⟨_, _, hQlog, _, _, hFmodel⟩ := + preparedModularGeneralDetector_period_prefactor B U basis o hb bW hMaster hd hDMaster + hnXMaster hPkMaster hQstrideMaster hDetectMaster ⟨hMaster, le_rfl⟩ + have hgrid := preparedModularGeneralDetector_grid_resource_width_bound constants (s + 1) + hMaster hLate hDetectMaster hQlog + have hEarlyCoarse : pGain + 32 ∈ Set.Icc 0 Pmaster := + ⟨by linarith only [hGainMaster.1], hCoarseMaster⟩ + have hCoarse0 : 0 ≤ coarseTarget := hEarlyCoarse.1.trans hCoarseLower + have hAmbient := preparedModularGeneralDetector_ambient_bound constants (s + 1) hMaster + (hd.outputs.trans hDMaster) ⟨bounds.Pbox.1, le_rfl⟩ hPrhoMaster + ⟨bounds.Vlog.1, le_rfl⟩ ⟨bounds.Nlog.1, le_rfl⟩ ⟨bounds.Q.1, le_rfl⟩ htargetMaster + ⟨bounds.baseAmbient.1, le_rfl⟩ + have hMkPhysical := hMkPk.trans (Real.exp_le_exp.mpr hPkPhysical) + have hGPhysical : (Fintype.card G : ℝ) ≤ Pphysical := + (Nat.cast_le.mpr (allocatedKernelVariables_card_le_variables (G := G) B)).trans hvarsPhysical + have hXiProj : ξn⁻¹ ≤ Real.exp r.Pproj := + hξLate.trans (Real.exp_le_exp.mpr sampling.late_projection) + have hRoot := preparedModularDetector_physical_root_of_variables B U basis S (hMaster.trans hLate) + (hvarsMaster.trans hLate) hSLate + have hRootLog : 2 * Plate + 8 ≤ r.Pproj := by + change 2 * Plate + 8 ≤ 4 * (Plate + 8)^2 + nlinarith only [hMaster.trans hLate, sq_nonneg Plate] + have hWproj : W ≤ Real.exp r.Pproj := hRoot.trans (Real.exp_le_exp.mpr hRootLog) + have hExpProj : Real.exp Pmaster ≤ Real.exp r.Pproj := + Real.exp_le_exp.mpr sampling.primitive_projection + have hGain := allocatedDetectedGain_lower s + (Fintype.card (LayerSamplerVariables G I n B)) Pdetect hαlower hGainLog + obtain ⟨hReqSample, hReqMass, hReqProj, _hReqSide, _⟩ := + preparedModularGeneralDetector_required_bounds constants (s + 1) hMaster hLate + have hReqSideShared := preparedModularGeneralDetectorConstants_required_sharedWidth_side + m s (s + 1) hMaster hLate + have hSize (x : ℝ) (hx : x ≤ r.required) (i : Fin nX) : Real.exp x ≤ (N i : ℝ) := + (Real.exp_le_exp.mpr hx).trans (hNlarge i) + have hRank (x : ℝ) (hx : x ≤ r.required) : Real.exp x ≤ Rrank := + (Real.exp_le_exp.mpr hx).trans hRankLarge + have hNative := preparedModularGeneralDirectDetectionAmbient_sharedWidth (ξn := ξn) + (B := B) (U := U) (basis := basis) (hR := hR) (hσ := hσ) (S := S) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) + (Q := Q) (hb := hb) (o := o) (bW := bW) (ν := ν) (μ := μ) (μrows := μrows) + hsm Pchart D target Pk Prho Qstride K geometry hLate hMaster hDMaster hPkMaster hQstrideMaster + hDetectMaster hnXMaster hRone hRiMaster hSLate hKMaster hcutoffMaster + hMkP hMkPk hstride hstrideBound C hC hCbound hchart Cforward hforward + hForwardMaster hVtailMaster hVactual hBa hBi + (Pproj := r.Pproj) (coarseTarget := coarseTarget) (Ecoarse := pGain + 32) (pGain := pGain) + (τ := τ) (Pphysical := Pphysical) (Pnative := r.Pnative) (Pside := r.Pside) + hξn hξn_le cells poly hp hmem + (lossTarget := pGain + 32) (Psample := r.Psample) (Rrank := Rrank) + (Sstride := Real.exp Qstride) (εsample := Real.exp (-target)) (ηsample := Real.exp (-target)) + hstride (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hτSpatial sampling.sample_nonneg + sampling.X_sample sampling.frame_sample sampling.stride_scale_nonneg sampling.stride_scale_sample + sampling.precision_pos freeSpatial.tau_sample sampling.epsilon_sample hstrideBound + (hSize _ hReqSample) hrank (hRank _ hReqSample) sampling.precision_pos + sampling.ambient_dimension_sample (by simpa only [Fintype.card_fin] using (hAmbient.2.2.trans sampling.ambient_sample)) + sampling.jet_sample sampling.eta_sample hPhysicalMaster.1 hMkPhysical hmPhysical hCoarse0 + hDimPhysical hGPhysical (by simpa only [Fintype.card_fin] using hXPhysical) + hprecision le_rfl le_rfl + have hNative := hNative + (hMaster.trans hPnative) hDn + (by change 0 ≤ _ ∧ _ ≤ _ + have hCgrid : constants.Cgrid = Classical.choose + (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (s + 1) canonicalTransitionLip) := rfl + rw [← hCgrid] + simpa only [Nat.cast_add, Nat.cast_zero, Nat.cast_one, Nat.cast_ofNat, zero_add, one_add_one_eq_two] + using And.intro hgrid.1 (hgrid.2.trans hgridn.2)) hvn + (by change 0 ≤ _ ∧ _ ≤ _ + simpa only [add_assoc] using And.intro hFmodel.1 (hFmodel.2.trans hFn.2)) + (hprimitiveNative _ hPrhoMaster) (hprimitiveNative _ hPkMaster) + (hprimitiveNative _ htargetMaster) hBn (hprimitiveNative _ hPhysicalMaster) + (hprimitiveNative _ hEarlyCoarse) (hprimitiveNative _ hGainMaster) + (fun i => (hstrideBound i).trans (Real.exp_le_exp.mpr hQstridePhysical)) + (by simpa only [one_div] using hτinv) + hGain (by linarith only [hGainMaster.2, sampling.gain_projection]) hCoarseLower le_rfl le_rfl + Cforward sampling.cover_base sampling.cover_sample sampling.mass_sample hforward hVactual + sampling.X_mass sampling.frame_mass sampling.stride_mass freeSpatial.tau_mass + (hSize _ hReqMass) (hRank _ hReqMass) sampling.ambient_dimension_mass sampling.jet_mass + (hvarsPhysical.trans (by linarith only [Real.add_one_le_exp Pphysical])) + sampling.projection_one (hmMaster.trans sampling.primitive_projection) + ((hd.kernel_variables.trans hDMaster).trans sampling.primitive_projection) + (hSLate.trans (Real.exp_le_exp.mpr sampling.late_projection)) sampling.period_projection sampling.variables_projection hWproj + (fun j => (hRiMaster j).trans hExpProj) (fun j => (hσiLate j).trans (Real.exp_le_exp.mpr sampling.late_projection)) + (fun j => ((hd.coefficients j).trans hDMaster).trans sampling.primitive_projection) + (fun j => (((preparedModularGeneralDetector_layer_axes B rowSets hd).1 j).trans hDMaster).trans sampling.primitive_projection) + (fun j => (((preparedModularGeneralDetector_layer_axes B rowSets hd).2 j).trans hDMaster).trans sampling.primitive_projection) + (fun j => (hJMaster j).trans sampling.primitive_projection) sampling.profile_projection + (fun j => (hForwardMaster j).trans hExpProj) (fun j => (hVtailMaster j).trans hExpProj) + sampling.X_projection sampling.frame_projection sampling.stride_projection freeSpatial.tau_projection + hXiProj (hSize _ hReqProj) (hRank _ hReqProj) + have hNative := hNative sampling.projection_side sampling.mass_side + sampling.physical_side (hCoarseLate.trans sampling.late_side) (hSize _ hReqSideShared) + intro hCells bases hbases hmass htotal Path pathLaw sides Sites e + Tests _ Ldetect _ _ dims _ _ _ _ Ddetect Vdetect slices cdetect stepdetect Hdetect + hstep hslices hdense hdimensionDetect hcomplexity hcap hGdetect hkernel budget + signal hsignal hzero hdetected + exact hNative hCells hbases hmass htotal Ddetect Vdetect slices cdetect stepdetect Hdetect + hstep hslices hdense hdimensionDetect hcomplexity hcap hGdetect hkernel + huMaster.1 hModelMaster.1 hSliceModel hcountModel hαlower hαone signal hsignal hzero hdetected + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedPerturbativeCertifiedSource.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedPerturbativeCertifiedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..520ec7aba7377ec93987a8d75ff4fd64f6dfd7c2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SharedWidthPreparedPerturbativeCertifiedSource.lean @@ -0,0 +1,1231 @@ +import OAI.Combinatorics.Progressions.Dynamics.PreparedFinalToleranceBudgets +import OAI.Combinatorics.Progressions.Estimates.SharedWidthPreparedLateToleranceFreeTrimSource + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +section Consumer + +variable {m s : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +variable (α τ : ℝ) +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +def SharedWidthPreparedCenteredModelMarginalDataInterface + (Pchart Qstride Pmaster Plate _pGain Pphysical coarseTarget : ℝ) : Prop := + ∀ (_hstride : ∀ i, 0 < stride i) (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (_hC : ∀ j, 0 ≤ C j) (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (_hForward : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pchart) + (_hVtail : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pchart) + (_hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (_hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pchart) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pchart), + ∀ {Pmarginal E : ℝ}, + 0 ≤ Pmarginal → (m : ℝ) ≤ Pmarginal → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pmarginal → + (Fintype.card (Fin nX) : ℝ) ≤ Pmarginal → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pmarginal → + Pchart ≤ Pmarginal → Qstride ≤ Pmarginal → Pphysical ≤ Pmarginal → + (∀ j, (R j)⁻¹ ≤ Real.exp Pmarginal) → + (∀ j, (σ j)⁻¹ ≤ Real.exp Pmarginal) → + (∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pmarginal) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pmarginal) → + (∀ j, (n j : ℝ) ≤ Pmarginal) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pmarginal) → + (S.value : ℝ) ≤ Real.exp Pmarginal → + (∀ j, σ j ≤ 1) → + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + ∀ (hτSpatial : 0 < τ), τ⁻¹ ≤ Real.exp Pphysical → + τ ≤ 1 / 2 → (nX : ℝ) * τ ≤ 1 / 2 → + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn) (hξle : ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2)) + Pphysical coarseTarget), ξn⁻¹ ≤ Real.exp Plate → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + W ≤ Real.exp Pmarginal → + ∀ (hξone : ξn ≤ 1), ξn⁻¹ ≤ Real.exp Pmarginal → + let required := max r.required ((max Pmarginal E + preparedCenteredMarginalExponent m) ^ + preparedCenteredMarginalExponent m) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + {Rrank : ℝ}, + (∀ i, Real.exp required ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp required ≤ Rrank → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let Z := selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem) + ∃ (hN : ∀ i, 0 < N i) (hbases : bases.Nonempty) (hbox : (integerBox N).Nonempty) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z) + (_hnormalizer : |Z - 1| ≤ Real.exp (-r.E) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) + (_hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i), + let Path := bases × rectangularWeightIndices 0 V 1 + let Zcenter := fun center => selectedJointDensityMass bases stride cells V + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + ∃ hnormalizerCenter : ∀ center, + |Zcenter center - 1| ≤ Real.exp (-E) ∧ + Zcenter center ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ + 0 < Zcenter center ∧ (Zcenter center)⁻¹ ≤ 2, + let centeredLaw := fun center => selectedJointFiniteLaw bases hbases stride cells V + (narrowTrimmedSpatialWidths_pos hW hτSpatial hξn N hN) hmass + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S poly hmem center) (hnormalizerCenter center).2.2.1 + ∃ hweight : ∀ z, Measurable (fun center => (centeredLaw center).weight z), + let pathLaw := centeredFiniteMarginal μ centeredLaw hweight + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + letI : Nonempty Sites := by + have hpos (k : LayerSamplerVariables G I n B) : 0 < sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U basis S j + let : ∀ k, NeZero (sides k) := fun k => ⟨(hpos k).ne'⟩ + exact (integerBox_nonempty sides).to_subtype + let hrootSum := fun t : Sites => allocatedParameterBox_root_bound B U basis S t + let physical := narrowPhysicalSiteMap (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) hW hτSpatial hξone N hN + _hmargin e hrootSum + (FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).excessMass + (pathLaw.siteLaw physical) Ctail ≤ 6 * positiveProjectionAccuracy E ∧ + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + let budget := r.nativeBudget + ∀ (signal : (Fin nX → ℤ) → ℂ), + 0 < α → + (∀ t, ‖signal t‖ ≤ 1) → (∀ t, t ∉ integerBox N → signal t = 0) → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun t : integerBox N => t.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation + (fun t => signal t.val) (fun t => star (twistData.eval N poly t.val) * Fnative t)‖ + +include μ ν hR hσ hb o in + +theorem sharedWidthPreparedCenteredModelMarginalData_of_direct + (Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ) + (hDirect : PreparedModularGeneralDirectDetectionFreeTrimPreparedSharedWidthInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α / 2) (τ := τ) (hb := hb) (o := o) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget) : + SharedWidthPreparedCenteredModelMarginalDataInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α) (τ := τ) (hb := hb) (o := o) (μ := μ) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget := by + intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff Pmarginal E hPm hmSize hK hX hdim + hChartPm hStridePm hPhysicalPm hRP hσP hcount hI hn hJ hLP hσone hsmall + hτSpatial hτInv hτHalf hτDim r W ξn hξn hξle hξLate hW hWP hξone hξInv required + cells poly hp hmem Rrank hsize hrank hRank V hCells bases Z + have hsizeDirect (i) : Real.exp r.required ≤ (N i : ℝ) := + (Real.exp_le_exp.mpr (le_max_left _ _)).trans (hsize i) + have hRankDirect : Real.exp r.required ≤ Rrank := + (Real.exp_le_exp.mpr (le_max_left _ _)).trans hRank + have hsizeMarginal (i) : + Real.exp ((max Pmarginal E + preparedCenteredMarginalExponent m) ^ + preparedCenteredMarginalExponent m) ≤ (N i : ℝ) := + (Real.exp_le_exp.mpr (le_max_right _ _)).trans (hsize i) + have hRankMarginal : + Real.exp ((max Pmarginal E + preparedCenteredMarginalExponent m) ^ + preparedCenteredMarginalExponent m) ≤ Rrank := + (Real.exp_le_exp.mpr (le_max_right _ _)).trans hRank + have hCentered := preparedModularGeneralCenteredDetectionFreeTrimSharedWidth_of_direct + B U basis hR hσ S selection stride N Pdetect u pModel pSlice Vtail α τ hb o μ + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget hDirect + obtain ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, hcenter, hweight, hdetect⟩ := + hCentered hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff hτSpatial hτInv hτHalf hτDim + hξn hξle hξLate cells poly hp hmem hsizeDirect hrank hRankDirect hCells + have hchartExp := Real.exp_le_exp.mpr hChartPm + obtain ⟨_, _, _, _, _, hnormalizerCenter, hweightMarginal, hsite⟩ := + (preparedCenteredMarginalExponent_spec m).2 B U basis S hb o μ ν hR hσ hσone + Cforward Vtail hforward hVactual C hC hchart hsmall + hPm hmSize hK hX hdim hRP hσP hcount hI hn hJ + (hprofile.trans hchartExp) hLP (fun j => (hForward j).trans hchartExp) + (fun j => (hVtail j).trans hchartExp) poly hp hmem stride hstride + (fun i => (hstrideBound i).trans (Real.exp_le_exp.mpr hStridePm)) + hW hWP hτSpatial (hτInv.trans (Real.exp_le_exp.mpr hPhysicalPm)) hτHalf + (by simpa only [Fintype.card_fin] using hτDim) hξn hξone hξInv + N hsizeMarginal hrank hRankMarginal cells hCells + refine ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩ + intro Path Zcenter + refine ⟨hnormalizerCenter, ?_⟩ + intro centeredLaw + refine ⟨hweight, ?_⟩ + intro pathLaw sides Sites e hrootSum physical + let : Nonempty Sites := by + have hpos (k : LayerSamplerVariables G I n B) : 0 < sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U basis S j + let : ∀ k, NeZero (sides k) := fun k => ⟨(hpos k).ne'⟩ + exact (integerBox_nonempty sides).to_subtype + constructor + · exact hsite e (fun t k => (allocatedParameterBox_coordinate_bound B U basis S t k).trans hLP) + (fun t => allocatedParameterBox_root_bound B U basis S t) + · exact hdetect + +def SharedWidthPreparedCenteredModelMarginalProjectionInterface + (Pchart Qstride Pmaster Plate _pGain Pphysical coarseTarget : ℝ) : Prop := + ∀ (_hstride : ∀ i, 0 < stride i) (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (_hC : ∀ j, 0 ≤ C j) (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (_hForward : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pchart) + (_hVtail : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pchart) + (_hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (_hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pchart) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pchart), + ∀ {E : ℝ}, + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + ∀ (hτSpatial : 0 < τ), τ⁻¹ ≤ Real.exp Pphysical → + τ ≤ 1 / 2 → (nX : ℝ) * τ ≤ 1 / 2 → + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn) (hξle : ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2)) + Pphysical coarseTarget), ξn⁻¹ ≤ Real.exp Plate → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + let hξone : ξn ≤ 1 := hξle.trans (min_le_left _ _) + let Pmarginal := r.Pproj + let required := max r.required ((max Pmarginal E + preparedCenteredMarginalExponent m) ^ + preparedCenteredMarginalExponent m) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + {Rrank : ℝ}, + (∀ i, Real.exp required ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp required ≤ Rrank → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let Z := selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem) + ∃ (hN : ∀ i, 0 < N i) (hbases : bases.Nonempty) (hbox : (integerBox N).Nonempty) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z) + (_hnormalizer : |Z - 1| ≤ Real.exp (-r.E) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) + (_hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i), + let Path := bases × rectangularWeightIndices 0 V 1 + let Zcenter := fun center => selectedJointDensityMass bases stride cells V + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + ∃ hnormalizerCenter : ∀ center, + |Zcenter center - 1| ≤ Real.exp (-E) ∧ + Zcenter center ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ + 0 < Zcenter center ∧ (Zcenter center)⁻¹ ≤ 2, + let centeredLaw := fun center => selectedJointFiniteLaw bases hbases stride cells V + (narrowTrimmedSpatialWidths_pos hW hτSpatial hξn N hN) hmass + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S poly hmem center) (hnormalizerCenter center).2.2.1 + ∃ hweight : ∀ z, Measurable (fun center => (centeredLaw center).weight z), + let pathLaw := centeredFiniteMarginal μ centeredLaw hweight + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + letI : Nonempty Sites := by + have hpos (k : LayerSamplerVariables G I n B) : 0 < sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U basis S j + let : ∀ k, NeZero (sides k) := fun k => ⟨(hpos k).ne'⟩ + exact (integerBox_nonempty sides).to_subtype + let hrootSum := fun t : Sites => allocatedParameterBox_root_bound B U basis S t + let physical := narrowPhysicalSiteMap (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) hW hτSpatial hξone N hN + _hmargin e hrootSum + (FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).excessMass + (pathLaw.siteLaw physical) Ctail ≤ 6 * positiveProjectionAccuracy E ∧ + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + let budget := r.nativeBudget + ∀ (signal : (Fin nX → ℤ) → ℂ), + 0 < α → + (∀ t, ‖signal t‖ ≤ 1) → (∀ t, t ∉ integerBox N → signal t = 0) → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun t : integerBox N => t.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation + (fun t => signal t.val) (fun t => star (twistData.eval N poly t.val) * Fnative t)‖ + +include μ ν hR hσ hb o in + +theorem sharedWidthPreparedCenteredModelMarginalProjectionData_of_direct + (Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ) + (hDirect : PreparedModularGeneralDirectDetectionFreeTrimPreparedSharedWidthInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α / 2) (τ := τ) (hb := hb) (o := o) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget) + {D : ℝ} (hMaster : 0 ≤ Pmaster) (hLate : Pmaster ≤ Plate) + (hd : AllocatedComparisonDimensions (G := G) B (Fin (s + 1)) selectedRows D) + (hD : D ≤ Pmaster) (hnX : (nX : ℝ) ≤ Pmaster) + (hChartMaster : Pchart ≤ Pmaster) (hStrideMaster : Qstride ≤ Pmaster) + (hPhysicalMaster : Pphysical ≤ Pmaster) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp Pmaster) + (hσLate : ∀ j, (σ j)⁻¹ ≤ Real.exp Plate) + (hLLate : (S.value : ℝ) ≤ Real.exp Plate) (hσone : ∀ j, σ j ≤ 1) : + SharedWidthPreparedCenteredModelMarginalProjectionInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α) (τ := τ) (hb := hb) (o := o) (μ := μ) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget := by + intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff E hsmall hτSpatial hτInv hτHalf hτDim + r W ξn hξn hξle hξLate hW hξone Pmarginal required + have hbnd := preparedCenteredMarginalProjectionBounds B U basis S o hMaster hLate hd hD + hnX hRP hσLate hLLate + have h := sharedWidthPreparedCenteredModelMarginalData_of_direct + B U basis hR hσ S selection stride N Pdetect u pModel pSlice Vtail α τ hb o ν μ + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget hDirect + exact h hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff hbnd.Pproj_nonneg hbnd.m_projection + hbnd.variables_projection hbnd.X_projection hbnd.frame_projection + (hChartMaster.trans hbnd.master_projection) (hStrideMaster.trans hbnd.master_projection) + (hPhysicalMaster.trans hbnd.master_projection) hbnd.Rinv_projection hbnd.σinv_projection + hbnd.coefficient_projection hbnd.I_projection hbnd.n_projection hbnd.J_projection + hbnd.S_projection hσone hsmall hτSpatial hτInv hτHalf hτDim + hξn hξle hξLate hbnd.root_projection hξone (hξLate.trans (Real.exp_le_exp.mpr hbnd.late_projection)) + +def SharedWidthPreparedCenteredModelMarginalRadiusInterface + (Pchart Qstride Pmaster Plate _pGain Pphysical coarseTarget : ℝ) : Prop := + ∀ (_hstride : ∀ i, 0 < stride i) (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (_hC : ∀ j, 0 ≤ C j) (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (_hForward : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pchart) + (_hVtail : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pchart) + (_hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (_hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pchart) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pchart), + ∀ {E : ℝ}, + ∀ (hτSpatial : 0 < τ), τ⁻¹ ≤ Real.exp Pphysical → + τ ≤ 1 / 2 → (nX : ℝ) * τ ≤ 1 / 2 → + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn) (hξle : ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2)) + Pphysical coarseTarget), ξn⁻¹ ≤ Real.exp Plate → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + let hξone : ξn ≤ 1 := hξle.trans (min_le_left _ _) + let Pmarginal := r.Pproj + let required := max r.required ((max Pmarginal E + preparedCenteredMarginalExponent m) ^ + preparedCenteredMarginalExponent m) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + {Rrank : ℝ}, + (∀ i, Real.exp required ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp required ≤ Rrank → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let Z := selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem) + ∃ (hN : ∀ i, 0 < N i) (hbases : bases.Nonempty) (hbox : (integerBox N).Nonempty) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z) + (_hnormalizer : |Z - 1| ≤ Real.exp (-r.E) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) + (_hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i), + let Path := bases × rectangularWeightIndices 0 V 1 + let Zcenter := fun center => selectedJointDensityMass bases stride cells V + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + ∃ hnormalizerCenter : ∀ center, + |Zcenter center - 1| ≤ Real.exp (-E) ∧ + Zcenter center ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ + 0 < Zcenter center ∧ (Zcenter center)⁻¹ ≤ 2, + let centeredLaw := fun center => selectedJointFiniteLaw bases hbases stride cells V + (narrowTrimmedSpatialWidths_pos hW hτSpatial hξn N hN) hmass + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S poly hmem center) (hnormalizerCenter center).2.2.1 + ∃ hweight : ∀ z, Measurable (fun center => (centeredLaw center).weight z), + let pathLaw := centeredFiniteMarginal μ centeredLaw hweight + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + letI : Nonempty Sites := by + have hpos (k : LayerSamplerVariables G I n B) : 0 < sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U basis S j + let : ∀ k, NeZero (sides k) := fun k => ⟨(hpos k).ne'⟩ + exact (integerBox_nonempty sides).to_subtype + let hrootSum := fun t : Sites => allocatedParameterBox_root_bound B U basis S t + let physical := narrowPhysicalSiteMap (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) hW hτSpatial hξone N hN + _hmargin e hrootSum + (FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).excessMass + (pathLaw.siteLaw physical) Ctail ≤ 6 * positiveProjectionAccuracy E ∧ + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + let budget := r.nativeBudget + ∀ (signal : (Fin nX → ℤ) → ℂ), + 0 < α → + (∀ t, ‖signal t‖ ≤ 1) → (∀ t, t ∉ integerBox N → signal t = 0) → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun t : integerBox N => t.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation + (fun t => signal t.val) (fun t => star (twistData.eval N poly t.val) * Fnative t)‖ + +omit [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [μ.IsAddLeftInvariant] in + +theorem sharedWidthPreparedCenteredModelMarginalRadiusInterface_of_projection + (Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ) + (hProjection : SharedWidthPreparedCenteredModelMarginalProjectionInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α) (τ := τ) (hb := hb) (o := o) (μ := μ) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget) + (hsmall : ∀ C : Fin m → ℝ, (∀ j, 0 ≤ C j) → + (∀ j, C j ≤ Real.exp Pchart) → + ∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) : + SharedWidthPreparedCenteredModelMarginalRadiusInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α) (τ := τ) (hb := hb) (o := o) (μ := μ) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget := by + intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff E + exact hProjection hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff (E := E) (hsmall C hC hCbound) + +end Consumer +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +private theorem centeredSource_physical_bounds {Qearly Pk Qstride : ℝ} (nX m : ℕ) + (hQ : 0 ≤ Qearly) (hPk : 0 ≤ Pk) (hs : 0 ≤ Qstride) : + let physical := Qearly + Pk + Qstride + nX + (m + 1 : ℕ) + 8 + 0 ≤ physical ∧ Pk ≤ physical ∧ (nX : ℝ) ≤ physical ∧ + (2 : ℝ) ≤ physical ∧ Qearly ≤ physical := by + intro physical + dsimp only [physical] + have hn : (0 : ℝ) ≤ nX := Nat.cast_nonneg _ + have hm : (0 : ℝ) ≤ (m + 1 : ℕ) := Nat.cast_nonneg _ + exact ⟨by linarith, by linarith, by linarith, by linarith, by linarith⟩ + +private theorem centeredSource_master_bounds {budget physical early gain : ℝ} + (hb : 0 ≤ budget) (hp : 0 ≤ physical) (he : 0 ≤ early) (hg : 0 ≤ gain) : + let master := budget + physical + early + gain + 32 + budget ≤ master ∧ physical ≤ master ∧ 0 ≤ master := by + dsimp only + exact ⟨by linarith, by linarith, by linarith⟩ + +private theorem centeredSource_late_bounds {master seed Qw physical target Pmin scale : ℝ} + (hm : 0 ≤ master) (hs : 0 ≤ seed) (hw : 0 ≤ Qw) (hp : 0 ≤ physical) + (ht : 0 ≤ target) (hmin : 0 ≤ Pmin) (hscale : 0 ≤ scale) : + let base := preparedModularGeneralDetectorLateMaster master seed Qw physical target + let late := base + (1 + seed ^ 2) * Pmin + scale + master ≤ late ∧ + allocatedWitnessScaleLog seed Qw + (1 + seed ^ 2) * Pmin ≤ late ∧ + scale ≤ late ∧ + 2 * (spatialPrimitiveEnvelope physical target 0 + + spatialTupleToleranceLog (spatialPrimitiveEnvelope physical target 0)) + 4 ≤ late := by + intro base late + obtain ⟨hb, hm', hw', _, hξ⟩ := + preparedModularGeneralDetectorLateMaster_bounds hm hs hw hp ht + have hc : 0 ≤ (1 + seed ^ 2) * Pmin := mul_nonneg (by positivity) hmin + dsimp only [late] + exact ⟨by linarith only [hm', hc, hscale], + by linarith only [hw', hscale], by linarith only [hb, hc], + by linarith only [hξ, hc, hscale]⟩ + +def SharedWidthPreparedLateToleranceCenteredSourceStatement (m : ℕ) (Pdetect : Polynomial ℕ) : Prop := + let Cdetect := sampledSupportedSlicedDetectionConstant 0 Pdetect + let Aearly := Classical.choose (exists_preparedModularGeneralCanonicalEarlyParameters m 0 Cdetect) + let Aalloc := Classical.choose (exists_preparedModularCanonicalDetectorAllocationBudget m) + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {X J₀ : Type} (L : RankPreparationFamily X J₀ m) {M nX : ℕ}, + (∀ j, Fintype.card (L j).Coord ≤ M) → + ∀ {Pstruct pSlice Qstride : ℝ}, + 0 < m → 0 ≤ Pstruct → (M : ℝ) ≤ Pstruct → + pSlice ∈ Set.Icc 0 Pstruct → Qstride ∈ Set.Icc 0 Pstruct → (nX : ℝ) ≤ Pstruct → + let Jalloc := modularInitialBlockCount m (nX + m * M) + let pnum : ℝ := enlargedPreparedCommonSamplerDimension m M Jalloc + let Bstruct := (Pstruct + Aalloc) ^ Aalloc + let G := EnlargedPreparedCommonKernel m Jalloc + let I := PreparedSamplerContinuous L + let n := preparedSamplerTransverse L + let B := EnlargedPreparedCommonSamplerBlock L Jalloc + let selection := enlargedPreparedCommonCanonicalSelection m Jalloc 0 (Nat.zero_le m) + let A := Classical.choose (exists_allocatedCanonicalSlice_early_radius.{0,0,0,0} m) + let radiusBudget := Bstruct + (2 * Bstruct + A) ^ A + 2 + let rowSets := fun j : Fin m => boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1) + let T := allocatedIdealCoverSupport (G := G) B rowSets + let siteRadius := allocatedProductIdealSiteRadius (G := G) B rowSets + let D := allocatedComparisonDimension m pnum + ∃ (pRadius : ℝ) (R : Fin m → ℝ), + pRadius ∈ Set.Icc 0 radiusBudget ∧ + (∀ j, 0 < R j ∧ R j ≤ 1 ∧ (R j)⁻¹ ≤ Real.exp pRadius) ∧ + 1 ≤ siteRadius ∧ (∀ j, 0 ≤ T j) ∧ + (∀ j, partitionedIdealRadius (Fin (0 + 1)) m + 1 ≤ T j) ∧ + (∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (0 + 1)) * + ((Fintype.card (Fin (0 + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) ∧ + (∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) ∧ + (∀ j, T j ≤ Real.exp pRadius) ∧ 2 * (siteRadius : ℝ) ≤ Real.exp pRadius ∧ + (∀ Cchart : Fin m → ℝ, (∀ j, 0 ≤ Cchart j) → (∀ j, Cchart j ≤ Real.exp Bstruct) → + (∀ j, Cchart j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) ∧ + (∀ j, Cchart j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) ∧ + (∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (0 + 1))) * + (Cchart j * (((Fintype.card (I j) : ℝ) + 1) * + (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4)) ∧ + AllocatedComparisonDimensions (G := G) B (Fin (0 + 1)) (fun j => (rowSets j : Type)) D ∧ + ∀ {u P : ℝ}, 0 ≤ u → Bstruct + u ≤ P → + let Pearly := P + (2 * P + A) ^ A + 2 + let pModel := allocatedEarlyModelLog Pearly pSlice (Fintype.card (LayerSamplerVariables G I n B)) + let pDetect := allocatedModelTestLog u pModel + let aDetect := 2 * u + 4 * pModel + 7 + let gainLog := slicedDetectionGainLog 0 Cdetect (Fintype.card (LayerSamplerVariables G I n B)) pDetect pDetect aDetect + let Pk := scalarKernelLogarithmicBudget (Fin (0 + 1)) G (gainLog + pDetect + 4) + let Qearly := (P + Aearly) ^ Aearly + let Pphysical := Qearly + Pk + Qstride + nX + (m + 1 : ℕ) + 8 + let Eextra := coefficientErrorSpatialLog Pphysical + 8 + let target := gainLog + 32 + Eextra + let F := pDetect + 2 + let Tmod := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let _δ := Real.exp (-(pDetect + 1)) + let E := target + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 5 + let _η := Real.exp (-E) + let Prho := 2 * affineProfileInputEnvelope D (canonicalSublevelCutoffLip : ℝ) + (canonicalTransitionLip : ℝ) E F + 2 + let Ptail := affineProfileToleranceEnvelope m D (D * (D + 1) + D * D + D + 1) + (canonicalSublevelCutoffLip : ℝ) (canonicalTransitionLip : ℝ) E F + let _K := Classical.choose (exists_allocatedAffineScaleLog_bound m) + let budget := (P + Eextra + C) ^ C + let master := budget + Pphysical + Pearly + gainLog + 32 + pRadius ≤ budget ∧ (∀ j, T j ≤ Real.exp budget) ∧ + 2 * (siteRadius : ℝ) ≤ Real.exp budget ∧ radiusBudget ≤ Pearly ∧ + P ≤ Pearly ∧ Pearly ≤ budget ∧ pModel ∈ Set.Icc 0 budget ∧ pDetect ∈ Set.Icc 0 budget ∧ + aDetect ∈ Set.Icc 0 budget ∧ target ∈ Set.Icc 0 budget ∧ D ∈ Set.Icc 0 budget ∧ gainLog ∈ Set.Icc 0 budget ∧ Pk ∈ Set.Icc 0 budget ∧ + Prho ∈ Set.Icc 0 budget ∧ Ptail ∈ Set.Icc 0 budget ∧ Tmod ∈ Set.Icc 0 budget ∧ + ∃ t : ℝ, 0 < t ∧ t ≤ 1 ∧ + t⁻¹ ≤ Real.exp Ptail ∧ t⁻¹ ≤ Real.exp budget ∧ + ∀ {Qσ : ℝ}, 0 ≤ Qσ → + let σ := min t (Real.exp (-Qσ)) + let Pscale := pRadius + Ptail + Qσ + let lengthLog := allocatedAffineLengthLog m D Pscale Prho Pk target F Tmod + let Pseed := allocatedScaleLog (D + Pscale + lengthLog + 1) + 0 < σ ∧ σ ≤ t ∧ σ ≤ Real.exp (-Qσ) ∧ + σ⁻¹ ≤ Real.exp Pscale ∧ Pscale ∈ Set.Icc 0 (2 * budget + Qσ) ∧ + ∀ (Lmin : ℕ) {W Qw Pmin : ℝ}, + 1 ≤ W → 0 ≤ Qw → W ≤ Real.exp Qw → + 0 ≤ Pmin → (Lmin : ℝ) ≤ Real.exp Pmin → + ∀ {J : Fin m → Type} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ), + ∃ S : LayerSamplerScale (G := G) B U basis R (fun _ => σ), + Pk ≤ Pscale ∧ Lmin ≤ S.value ∧ + (S.value : ℝ) ≤ Real.exp + (allocatedWitnessScaleLog Pseed Qw + (1 + Pseed ^ 2) * Pmin) ∧ + (∀ j i, S.value ^ (j.val + 1) < basisAxisScale (basis j) i → + 8 * (probabilityProfileLipschitz : ℝ) * W ≤ + (layerSamplerGapWidth (G := G) B R ⟨j, i⟩ / 2) * + ((basisAxisScale (basis j) i : ℝ) / (S.value : ℝ) ^ (j.val + 1))) ∧ + (∀ lateTarget : ℝ, gainLog + 32 ≤ lateTarget → + let Plate := preparedModularGeneralDetectorLateMaster master Pseed Qw Pphysical lateTarget + + (1 + Pseed ^ 2) * Pmin + Pscale + let resources := preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m 0) (0 + 1) master Plate + resources.nativeBudget = (preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m 0) (0 + 1) master master).nativeBudget ∧ + (∀ (hRpos : ∀ j, 0 < R j) (hσpos : ∀ _j : Fin m, 0 < σ) + (stride N : Fin nX → ℕ) + (Q : Fin m → Type) [∀ j, Fintype (Q j)] + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (_bW : ∀ j, Module.Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + [CompactSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [MeasurableSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [BorelSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + (μrows : Measure (CoefficientTorus (K := Fin (0 + 1)) U)) + [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + [MeasurableSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + [BorelSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + (Vtail : Fin m → ℝ≥0) (α τfree : ℝ), + Real.exp (-aDetect) ≤ α / 2 → α ≤ 1 → + SharedWidthPreparedCenteredModelMarginalRadiusInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hRpos) (hσ := hσpos) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τfree) + (hb := hb) (o := o) (μ := μ) Bstruct Qstride master Plate gainLog Pphysical lateTarget)) ∧ + ∀ α : ℝ, Real.exp (-aDetect) ≤ α → + Real.exp (-gainLog) ≤ + (Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1)) ∧ + (scalarKernelCutoff (Fin (0 + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1))) / 2) : ℝ) ≤ Real.exp Pk ∧ + scalarKernelCutoff (Fin (0 + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1))) / 2) ≤ S.value + +theorem exists_sharedWidth_prepared_late_tolerance_centered_source (m : ℕ) (Pdetect : Polynomial ℕ) : + SharedWidthPreparedLateToleranceCenteredSourceStatement m Pdetect := by + unfold SharedWidthPreparedLateToleranceCenteredSourceStatement + intro Cdetect Aearly Aalloc + have hactual := exists_sharedWidth_prepared_late_tolerance_free_trim_source m Pdetect + unfold SharedWidthPreparedLateToleranceFreeTrimSourceStatement at hactual + obtain ⟨C, hC, hsource⟩ := hactual + refine ⟨C, hC, ?_⟩ + intro X J₀ L M nX hCoord Pstruct pSlice Qstride hm hPstruct hM hpSlice hQstride hnX + Jalloc pnum Bstruct G I n B selection A radiusBudget rowSets T siteRadius D + obtain ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, hlate⟩ := + hsource L hCoord hm hPstruct hM hpSlice hQstride hnX + refine ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, ?_⟩ + intro u P hu hmaster Pearly pModel pDetect aDetect gainLog Pk Qearly Pphysical Eextra target + F Tmod δ E η Prho Ptail K budget master + obtain ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, htolerances⟩ := hlate hu hmaster + refine ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, ?_⟩ + intro Qσ hQσ σ Pscale lengthLog Pseed + obtain ⟨hσ, hσt, hσexp, hσinv, hScaleBound, hsamplers⟩ := htolerances hQσ + refine ⟨hσ, hσt, hσexp, hσinv, hScaleBound, ?_⟩ + intro Lmin Wscale Qw Pmin hWscale hQw hWexp hPmin hLmin J _ U basis + obtain ⟨S, hPkScale, hFloor, hSWitness, hgap, hdetector, hgainKernel⟩ := + hsamplers Lmin hWscale hQw hWexp hPmin hLmin U basis + refine ⟨S, hPkScale, hFloor, hSWitness, hgap, ?_, hgainKernel⟩ + intro lateTarget hCoarseLower Plate resources + obtain ⟨hnative, hprepared⟩ := hdetector lateTarget hCoarseLower + refine ⟨hnative, ?_⟩ + intro hRpos hσpos stride N Q _ hb o bW _ ν _ _ _ _ _ μ + _ _ _ _ _ μrows _ _ _ _ Vtail α τfree hαlower hαone + have hDirect := hprepared hRpos hσpos stride N Q hb o bW ν μ μrows Vtail + (α / 2) τfree hαlower (by linarith only [hαone]) + obtain ⟨hStruct, _, _, _⟩ := + (Classical.choose_spec (exists_preparedModularCanonicalDetectorAllocationBudget m)).2 + hPstruct hM hnX + have hB : 0 ≤ Bstruct := hPstruct.trans hStruct + have hBP : Bstruct ≤ P := (le_add_of_nonneg_right hu).trans hmaster + have hP : 0 ≤ P := hB.trans hBP + have hQearly : 0 ≤ Qearly := by dsimp only [Qearly]; positivity + obtain ⟨hPhysical0, _, hXPhysical, _, _⟩ := + centeredSource_physical_bounds nX m hQearly hPk.1 hQstride.1 + have hGeometry0 : 0 ≤ budget := hModel.1.trans hModel.2 + have hEarly0 : 0 ≤ Pearly := hP.trans hPEarly + obtain ⟨hGeometryMaster, hPhysicalMaster, hMaster⟩ := + centeredSource_master_bounds hGeometry0 hPhysical0 hEarly0 hgain.1 + have hPMaster : P ≤ master := hPEarly.trans (hEarlyBudget.trans hGeometryMaster) + have hBMaster := hBP.trans hPMaster + have hLateTarget0 : 0 ≤ lateTarget := by linarith only [hgain.1, hCoarseLower] + have hF : 0 ≤ F := by change 0 ≤ pDetect + 2; linarith only [hDetect.1] + have hLength0 : 0 ≤ lengthLog := + (allocatedAffineLengthLog_bounds m hD.1 hScaleBound.1 hPrho.1 hPk.1 + htarget.1 hF hTmod.1).2.2.1 + have hSeedInput : 0 ≤ D + Pscale + lengthLog + 1 := by + linarith only [hD.1, hScaleBound.1, hLength0] + have hSeed0 : 0 ≤ Pseed := allocatedScaleLog_nonneg hSeedInput + obtain ⟨hLate, hWitnessLate, hScaleLate, _⟩ := + centeredSource_late_bounds hMaster hSeed0 hQw hPhysical0 hLateTarget0 hPmin hScaleBound.1 + have hSLate := hSWitness.trans (Real.exp_le_exp.mpr hWitnessLate) + apply sharedWidthPreparedCenteredModelMarginalRadiusInterface_of_projection + B U basis hRpos hσpos S selection stride N Pdetect u pModel pSlice Vtail α τfree hb o μ + Bstruct Qstride master Plate gainLog Pphysical lateTarget + · exact sharedWidthPreparedCenteredModelMarginalProjectionData_of_direct + B U basis hRpos hσpos S selection stride N Pdetect u pModel pSlice Vtail α τfree hb o ν μ + Bstruct Qstride master Plate gainLog Pphysical lateTarget hDirect hMaster hLate + hdimensions (hD.2.trans hGeometryMaster) (hXPhysical.trans hPhysicalMaster) + hBMaster (hQstride.2.trans (hStruct.trans hBMaster)) hPhysicalMaster + (fun j => (hR j).2.2.trans (Real.exp_le_exp.mpr (hpRadiusBudget.trans hGeometryMaster))) + (fun _ => hσinv.trans (Real.exp_le_exp.mpr hScaleLate)) hSLate + (fun _ => hσt.trans htone) + · intro Cchart hCchart hCchartBound + exact (hsmall Cchart hCchart hCchartBound).1 + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +def SharedWidthPreparedLateToleranceCertifiedSourceStatement (m : ℕ) (Pdetect : Polynomial ℕ) : Prop := + let Cdetect := sampledSupportedSlicedDetectionConstant 0 Pdetect + let Aearly := Classical.choose (exists_preparedModularGeneralCanonicalEarlyParameters m 0 Cdetect) + let Aalloc := Classical.choose (exists_preparedModularCanonicalDetectorAllocationBudget m) + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {X J₀ : Type} (L : RankPreparationFamily X J₀ m) {M nX : ℕ}, + (∀ j, Fintype.card (L j).Coord ≤ M) → + ∀ {Pstruct pSlice Qstride : ℝ}, + 0 < m → 0 ≤ Pstruct → (M : ℝ) ≤ Pstruct → + pSlice ∈ Set.Icc 0 Pstruct → Qstride ∈ Set.Icc 0 Pstruct → (nX : ℝ) ≤ Pstruct → + let Jalloc := modularInitialBlockCount m (nX + m * M) + let pnum : ℝ := enlargedPreparedCommonSamplerDimension m M Jalloc + let Bstruct := (Pstruct + Aalloc) ^ Aalloc + let G := EnlargedPreparedCommonKernel m Jalloc + let I := PreparedSamplerContinuous L + let n := preparedSamplerTransverse L + let B := EnlargedPreparedCommonSamplerBlock L Jalloc + let selection := enlargedPreparedCommonCanonicalSelection m Jalloc 0 (Nat.zero_le m) + let A := Classical.choose (exists_allocatedCanonicalSlice_early_radius.{0,0,0,0} m) + let radiusBudget := Bstruct + (2 * Bstruct + A) ^ A + 2 + let rowSets := fun j : Fin m => boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1) + let T := allocatedIdealCoverSupport (G := G) B rowSets + let siteRadius := allocatedProductIdealSiteRadius (G := G) B rowSets + let D := allocatedComparisonDimension m pnum + ∃ (pRadius : ℝ) (R : Fin m → ℝ), + pRadius ∈ Set.Icc 0 radiusBudget ∧ + (∀ j, 0 < R j ∧ R j ≤ 1 ∧ (R j)⁻¹ ≤ Real.exp pRadius) ∧ + 1 ≤ siteRadius ∧ (∀ j, 0 ≤ T j) ∧ + (∀ j, partitionedIdealRadius (Fin (0 + 1)) m + 1 ≤ T j) ∧ + (∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (0 + 1)) * + ((Fintype.card (Fin (0 + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) ∧ + (∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) ∧ + (∀ j, T j ≤ Real.exp pRadius) ∧ 2 * (siteRadius : ℝ) ≤ Real.exp pRadius ∧ + (∀ Cchart : Fin m → ℝ, (∀ j, 0 ≤ Cchart j) → (∀ j, Cchart j ≤ Real.exp Bstruct) → + (∀ j, Cchart j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) ∧ + (∀ j, Cchart j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) ∧ + (∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (0 + 1))) * + (Cchart j * (((Fintype.card (I j) : ℝ) + 1) * + (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4)) ∧ + AllocatedComparisonDimensions (G := G) B (Fin (0 + 1)) (fun j => (rowSets j : Type)) D ∧ + ∀ {u P : ℝ}, 0 ≤ u → Bstruct + u ≤ P → + let Pearly := P + (2 * P + A) ^ A + 2 + let pModel := allocatedEarlyModelLog Pearly pSlice (Fintype.card (LayerSamplerVariables G I n B)) + let pDetect := allocatedModelTestLog u pModel + let aDetect := 2 * u + 4 * pModel + 7 + let gainLog := slicedDetectionGainLog 0 Cdetect (Fintype.card (LayerSamplerVariables G I n B)) pDetect pDetect aDetect + let Pk := scalarKernelLogarithmicBudget (Fin (0 + 1)) G (gainLog + pDetect + 4) + let Qearly := (P + Aearly) ^ Aearly + let Pphysical := Qearly + Pk + Qstride + nX + (m + 1 : ℕ) + 8 + let Eextra := coefficientErrorSpatialLog Pphysical + 8 + let target := gainLog + 32 + Eextra + let F := pDetect + 2 + let Tmod := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let _δ := Real.exp (-(pDetect + 1)) + let E := target + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 5 + let _η := Real.exp (-E) + let Prho := 2 * affineProfileInputEnvelope D (canonicalSublevelCutoffLip : ℝ) + (canonicalTransitionLip : ℝ) E F + 2 + let Ptail := affineProfileToleranceEnvelope m D (D * (D + 1) + D * D + D + 1) + (canonicalSublevelCutoffLip : ℝ) (canonicalTransitionLip : ℝ) E F + let _K := Classical.choose (exists_allocatedAffineScaleLog_bound m) + let budget := (P + Eextra + C) ^ C + let master := budget + Pphysical + Pearly + gainLog + 32 + pRadius ≤ budget ∧ (∀ j, T j ≤ Real.exp budget) ∧ + 2 * (siteRadius : ℝ) ≤ Real.exp budget ∧ radiusBudget ≤ Pearly ∧ + P ≤ Pearly ∧ Pearly ≤ budget ∧ pModel ∈ Set.Icc 0 budget ∧ pDetect ∈ Set.Icc 0 budget ∧ + aDetect ∈ Set.Icc 0 budget ∧ target ∈ Set.Icc 0 budget ∧ D ∈ Set.Icc 0 budget ∧ gainLog ∈ Set.Icc 0 budget ∧ Pk ∈ Set.Icc 0 budget ∧ + Prho ∈ Set.Icc 0 budget ∧ Ptail ∈ Set.Icc 0 budget ∧ Tmod ∈ Set.Icc 0 budget ∧ + ∃ t : ℝ, 0 < t ∧ t ≤ 1 ∧ + t⁻¹ ≤ Real.exp Ptail ∧ t⁻¹ ≤ Real.exp budget ∧ + ∀ {Qσ : ℝ}, 0 ≤ Qσ → + let σ := min t (Real.exp (-Qσ)) + let Pscale := pRadius + Ptail + Qσ + let lengthLog := allocatedAffineLengthLog m D Pscale Prho Pk target F Tmod + let Pseed := allocatedScaleLog (D + Pscale + lengthLog + 1) + 0 < σ ∧ σ ≤ t ∧ σ ≤ Real.exp (-Qσ) ∧ + σ⁻¹ ≤ Real.exp Pscale ∧ Pscale ∈ Set.Icc 0 (2 * budget + Qσ) ∧ + ∀ (Lmin : ℕ) {Pmin Elog Vlog : ℝ} (Qbad : ℕ), + 0 ≤ Pmin → (Lmin : ℝ) ≤ Real.exp Pmin → + 0 ≤ Elog → 0 ≤ Vlog → 1 ≤ Qbad → (Qbad : ℝ) ≤ Real.exp Vlog → + let W := physicalBadProductGap (Jalloc * (nX + m * M)) Elog Vlog Qbad + let Qw := 2 * Bstruct + 2 * Vlog + 5 * Elog + 24 + let J := fun j : Fin m => (L j).Coord + let Pbase := Bstruct + Pscale + pRadius + let B0 := 1 + Pbase + Pseed + Qw + Pmin + Elog + Vlog + ∀ (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ), + ∃ S : LayerSamplerScale (G := G) B U basis R (fun _ => σ), + Pk ≤ Pscale ∧ Lmin ≤ S.value ∧ + (S.value : ℝ) ≤ Real.exp + (allocatedWitnessScaleLog Pseed Qw + (1 + Pseed ^ 2) * Pmin) ∧ + (∀ j i, S.value ^ (j.val + 1) < basisAxisScale (basis j) i → + 8 * (probabilityProfileLipschitz : ℝ) * W ≤ + (layerSamplerGapWidth (G := G) B R ⟨j, i⟩ / 2) * + ((basisAxisScale (basis j) i : ℝ) / (S.value : ℝ) ^ (j.val + 1))) ∧ + (∀ Bcert : ℝ, B0 ≤ Bcert → + PreparedCertifiedSameScaleBadProductInterface L U basis S Bcert Elog Vlog Qbad) ∧ + (∀ lateTarget : ℝ, gainLog + 32 ≤ lateTarget → + let Plate := preparedModularGeneralDetectorLateMaster master Pseed Qw Pphysical lateTarget + + (1 + Pseed ^ 2) * Pmin + Pscale + let resources := preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m 0) (0 + 1) master Plate + resources.nativeBudget = (preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m 0) (0 + 1) master master).nativeBudget ∧ + (∀ (hRpos : ∀ j, 0 < R j) (hσpos : ∀ _j : Fin m, 0 < σ) + (stride N : Fin nX → ℕ) + (Q : Fin m → Type) [∀ j, Fintype (Q j)] + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (_bW : ∀ j, Module.Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + [CompactSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [MeasurableSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [BorelSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + (μrows : Measure (CoefficientTorus (K := Fin (0 + 1)) U)) + [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + [MeasurableSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + [BorelSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + (Vtail : Fin m → ℝ≥0) (α τfree : ℝ), + Real.exp (-aDetect) ≤ α / 2 → α ≤ 1 → + SharedWidthPreparedCenteredModelMarginalRadiusInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hRpos) (hσ := hσpos) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τfree) + (hb := hb) (o := o) (μ := μ) Bstruct Qstride master Plate gainLog Pphysical lateTarget)) ∧ + ∀ α : ℝ, Real.exp (-aDetect) ≤ α → + Real.exp (-gainLog) ≤ + (Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1)) ∧ + (scalarKernelCutoff (Fin (0 + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1))) / 2) : ℝ) ≤ Real.exp Pk ∧ + scalarKernelCutoff (Fin (0 + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1))) / 2) ≤ S.value + +theorem exists_sharedWidth_prepared_late_tolerance_certified_source (m : ℕ) (Pdetect : Polynomial ℕ) : + SharedWidthPreparedLateToleranceCertifiedSourceStatement m Pdetect := by + classical + unfold SharedWidthPreparedLateToleranceCertifiedSourceStatement + intro Cdetect Aearly Aalloc + have hactual := exists_sharedWidth_prepared_late_tolerance_centered_source m Pdetect + unfold SharedWidthPreparedLateToleranceCenteredSourceStatement at hactual + obtain ⟨C, hC, hsource⟩ := hactual + refine ⟨C, hC, ?_⟩ + intro X J₀ L M nX hCoord Pstruct pSlice Qstride hm hPstruct hM hpSlice hQstride hnX + Jalloc pnum Bstruct G I n B selection A radiusBudget rowSets T siteRadius D + obtain ⟨hStruct, _, hnum, _⟩ := + (Classical.choose_spec (exists_preparedModularCanonicalDetectorAllocationBudget m)).2 + hPstruct hM hnX + have hBstruct : 0 ≤ Bstruct := hPstruct.trans hStruct + obtain ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, hlate⟩ := + hsource L hCoord hm hPstruct hM hpSlice hQstride hnX + refine ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, ?_⟩ + intro u P hu hmaster Pearly pModel pDetect aDetect gainLog Pk Qearly Pphysical Eextra target + F Tmod δ E η Prho Ptail K budget master + obtain ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, htolerances⟩ := hlate hu hmaster + refine ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, ?_⟩ + intro Qσ hQσ σ Pscale lengthLog Pseed + obtain ⟨hσ, hσt, hσexp, hσinv, hScaleBound, hsamplers⟩ := htolerances hQσ + refine ⟨hσ, hσt, hσexp, hσinv, hScaleBound, ?_⟩ + intro Lmin Pmin Elog Vlog Qbad hPmin hLmin hElog hVlog hQbad hQexp W Qw J Pbase B0 U basis + have hQw : 0 ≤ Qw := by dsimp only [Qw]; linarith only [hBstruct, hVlog, hElog] + obtain ⟨hW, hWexp⟩ := preparedBadProductWitnessGap_bounds m nX M hnum.2 + hElog hVlog Qbad hQbad hQexp + obtain ⟨S, hPkScale, hFloor, hSWitness, hgap, hdetector, hgainKernel⟩ := + hsamplers Lmin hW hQw hWexp hPmin hLmin U basis + refine ⟨S, hPkScale, hFloor, hSWitness, hgap, ?_, hdetector, hgainKernel⟩ + have hF : 0 ≤ F := by change 0 ≤ pDetect + 2; linarith only [hDetect.1] + have hLength : 0 ≤ lengthLog := + (allocatedAffineLengthLog_bounds m hD.1 hScaleBound.1 hPrho.1 hPk.1 + htarget.1 hF hTmod.1).2.2.1 + have hSeedInput : 0 ≤ D + Pscale + lengthLog + 1 := by + linarith only [hD.1, hScaleBound.1, hLength] + have hSeed : 0 ≤ Pseed := allocatedScaleLog_nonneg hSeedInput + have hcert := preparedCertifiedSameScaleBadProductInterface_of_lateTolerance_larger + (nX := nX) (M := M) (R := R) (σ := fun _ : Fin m => σ) L U basis S + (Bstruct := Bstruct) (pRadius := pRadius) (Pscale := Pscale) + (Elog := Elog) (Vlog := Vlog) (Pseed := Pseed) (Qw := Qw) (Pmin := Pmin) Qbad + hBstruct hpRadius.1 hScaleBound.1 (hM.trans hStruct) (hnX.trans hStruct) + (fun j => (hR j).2.2) (fun _ => hσinv) + hSeed hQw hPmin hElog hVlog hQbad hQexp hm hCoord hSWitness hgap + exact hcert + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +def SharedWidthPreparedPerturbativeCertifiedSourceStatement (m : ℕ) (Pdetect : Polynomial ℕ) : Prop := + let Cdetect := sampledSupportedSlicedDetectionConstant 0 Pdetect + let Aearly := Classical.choose (exists_preparedModularGeneralCanonicalEarlyParameters m 0 Cdetect) + let Aalloc := Classical.choose (exists_preparedModularCanonicalDetectorAllocationBudget m) + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {X J₀ : Type} (L : RankPreparationFamily X J₀ m) {M nX : ℕ}, + (∀ j, Fintype.card (L j).Coord ≤ M) → + ∀ {Pstruct pSlice Qstride : ℝ}, + 0 < m → 0 ≤ Pstruct → (M : ℝ) ≤ Pstruct → + pSlice ∈ Set.Icc 0 Pstruct → Qstride ∈ Set.Icc 0 Pstruct → (nX : ℝ) ≤ Pstruct → + let Jalloc := modularInitialBlockCount m (nX + m * M) + let pnum : ℝ := enlargedPreparedCommonSamplerDimension m M Jalloc + let Bstruct := (Pstruct + Aalloc) ^ Aalloc + let G := EnlargedPreparedCommonKernel m Jalloc + let I := PreparedSamplerContinuous L + let n := preparedSamplerTransverse L + let B := EnlargedPreparedCommonSamplerBlock L Jalloc + let selection := enlargedPreparedCommonCanonicalSelection m Jalloc 0 (Nat.zero_le m) + let A := Classical.choose (exists_allocatedCanonicalSlice_early_radius.{0,0,0,0} m) + let radiusBudget := Bstruct + (2 * Bstruct + A) ^ A + 2 + let rowSets := fun j : Fin m => boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1) + let T := allocatedIdealCoverSupport (G := G) B rowSets + let siteRadius := allocatedProductIdealSiteRadius (G := G) B rowSets + let D := allocatedComparisonDimension m pnum + ∃ (pRadius : ℝ) (R : Fin m → ℝ), + pRadius ∈ Set.Icc 0 radiusBudget ∧ + (∀ j, 0 < R j ∧ R j ≤ 1 ∧ (R j)⁻¹ ≤ Real.exp pRadius) ∧ + 1 ≤ siteRadius ∧ (∀ j, 0 ≤ T j) ∧ + (∀ j, partitionedIdealRadius (Fin (0 + 1)) m + 1 ≤ T j) ∧ + (∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (0 + 1)) * + ((Fintype.card (Fin (0 + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) ∧ + (∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) ∧ + (∀ j, T j ≤ Real.exp pRadius) ∧ 2 * (siteRadius : ℝ) ≤ Real.exp pRadius ∧ + (∀ Cchart : Fin m → ℝ, (∀ j, 0 ≤ Cchart j) → (∀ j, Cchart j ≤ Real.exp Bstruct) → + (∀ j, Cchart j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) ∧ + (∀ j, Cchart j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) ∧ + (∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (0 + 1))) * + (Cchart j * (((Fintype.card (I j) : ℝ) + 1) * + (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4)) ∧ + AllocatedComparisonDimensions (G := G) B (Fin (0 + 1)) (fun j => (rowSets j : Type)) D ∧ + ∀ {u P : ℝ}, 0 ≤ u → Bstruct + u ≤ P → + let Pearly := P + (2 * P + A) ^ A + 2 + let pModel := allocatedEarlyModelLog Pearly pSlice (Fintype.card (LayerSamplerVariables G I n B)) + let pDetect := allocatedModelTestLog u pModel + let aDetect := 2 * u + 4 * pModel + 7 + let gainLog := slicedDetectionGainLog 0 Cdetect (Fintype.card (LayerSamplerVariables G I n B)) pDetect pDetect aDetect + let Pk := scalarKernelLogarithmicBudget (Fin (0 + 1)) G (gainLog + pDetect + 4) + let Qearly := (P + Aearly) ^ Aearly + let Pphysical := Qearly + Pk + Qstride + nX + (m + 1 : ℕ) + 8 + let Eextra := coefficientErrorSpatialLog Pphysical + 8 + let target := gainLog + 32 + Eextra + let F := pDetect + 2 + let Tmod := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let _δ := Real.exp (-(pDetect + 1)) + let E := target + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 5 + let _η := Real.exp (-E) + let Prho := 2 * affineProfileInputEnvelope D (canonicalSublevelCutoffLip : ℝ) + (canonicalTransitionLip : ℝ) E F + 2 + let Ptail := affineProfileToleranceEnvelope m D (D * (D + 1) + D * D + D + 1) + (canonicalSublevelCutoffLip : ℝ) (canonicalTransitionLip : ℝ) E F + let _K := Classical.choose (exists_allocatedAffineScaleLog_bound m) + let budget := (P + Eextra + C) ^ C + let master := budget + Pphysical + Pearly + gainLog + 32 + pRadius ≤ budget ∧ (∀ j, T j ≤ Real.exp budget) ∧ + 2 * (siteRadius : ℝ) ≤ Real.exp budget ∧ radiusBudget ≤ Pearly ∧ + P ≤ Pearly ∧ Pearly ≤ budget ∧ pModel ∈ Set.Icc 0 budget ∧ pDetect ∈ Set.Icc 0 budget ∧ + aDetect ∈ Set.Icc 0 budget ∧ target ∈ Set.Icc 0 budget ∧ D ∈ Set.Icc 0 budget ∧ gainLog ∈ Set.Icc 0 budget ∧ Pk ∈ Set.Icc 0 budget ∧ + Prho ∈ Set.Icc 0 budget ∧ Ptail ∈ Set.Icc 0 budget ∧ Tmod ∈ Set.Icc 0 budget ∧ + ∃ t : ℝ, 0 < t ∧ t ≤ 1 ∧ + t⁻¹ ≤ Real.exp Ptail ∧ t⁻¹ ≤ Real.exp budget ∧ + ∀ {Ppert Epert : ℝ}, 0 ≤ Ppert → 0 ≤ Epert → + let Qσ := fixedPathPerturbationLog D (D + Ppert + 4) Epert m + let σ := min t (Real.exp (-Qσ)) + let Pscale := pRadius + Ptail + Qσ + let lengthLog := allocatedAffineLengthLog m D Pscale Prho Pk target F Tmod + let Pseed := allocatedScaleLog (D + Pscale + lengthLog + 1) + 0 < σ ∧ σ ≤ t ∧ σ ≤ Real.exp (-Qσ) ∧ + σ⁻¹ ≤ Real.exp Pscale ∧ Pscale ∈ Set.Icc 0 (2 * budget + Qσ) ∧ + ∀ (Lmin : ℕ) {Pmin Elog Vlog : ℝ} (Qbad : ℕ), + 0 ≤ Pmin → (Lmin : ℝ) ≤ Real.exp Pmin → + 0 ≤ Elog → 0 ≤ Vlog → 1 ≤ Qbad → (Qbad : ℝ) ≤ Real.exp Vlog → + let W := physicalBadProductGap (Jalloc * (nX + m * M)) Elog Vlog Qbad + let Qw := 2 * Bstruct + 2 * Vlog + 5 * Elog + 24 + let J := fun j : Fin m => (L j).Coord + let Pbase := Bstruct + Pscale + pRadius + let B0 := 1 + Pbase + Pseed + Qw + Pmin + Elog + Vlog + ∀ (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ), + ∃ S : LayerSamplerScale (G := G) B U basis R (fun _ => σ), + Pk ≤ Pscale ∧ Lmin ≤ S.value ∧ + (S.value : ℝ) ≤ Real.exp + (allocatedWitnessScaleLog Pseed Qw + (1 + Pseed ^ 2) * Pmin) ∧ + (∀ j i, S.value ^ (j.val + 1) < basisAxisScale (basis j) i → + 8 * (probabilityProfileLipschitz : ℝ) * W ≤ + (layerSamplerGapWidth (G := G) B R ⟨j, i⟩ / 2) * + ((basisAxisScale (basis j) i : ℝ) / (S.value : ℝ) ^ (j.val + 1))) ∧ + (∀ Bcert : ℝ, B0 ≤ Bcert → + PreparedCertifiedSameScaleBadProductInterface L U basis S Bcert Elog Vlog Qbad) ∧ + (∀ (Apert : ℝ≥0) {ηpert : ℝ}, 0 < ηpert → + (Apert : ℝ) ≤ Real.exp Ppert → ηpert⁻¹ ≤ Real.exp Epert → + let active := fun a => ¬allocatedShortAxis (I := I) U basis S.value a + let inputs := PrincipalTupleIndex (fun a : {a // active a} => B a.val) + (fun a => layerSamplerDegree I n a.val) + σ * polynomialMassC2Budget (Fintype.card inputs) m 1 ≤ + slicedPrincipalC2Tolerance (Fintype.card inputs) (Fintype.card {a // active a}) + m 1 (unitProfilePrincipalLowerBound B) (1 / 2) Apert ηpert) ∧ + (∀ lateTarget : ℝ, gainLog + 32 ≤ lateTarget → + let Plate := preparedModularGeneralDetectorLateMaster master Pseed Qw Pphysical lateTarget + + (1 + Pseed ^ 2) * Pmin + Pscale + let resources := preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m 0) (0 + 1) master Plate + resources.nativeBudget = (preparedModularGeneralDetectorResources + (preparedModularGeneralDetectorConstants m 0) (0 + 1) master master).nativeBudget ∧ + (∀ (hRpos : ∀ j, 0 < R j) (hσpos : ∀ _j : Fin m, 0 < σ) + (stride N : Fin nX → ℕ) + (Q : Fin m → Type) [∀ j, Fintype (Q j)] + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (_bW : ∀ j, Module.Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + [CompactSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [MeasurableSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [BorelSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + (μrows : Measure (CoefficientTorus (K := Fin (0 + 1)) U)) + [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + [MeasurableSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + [BorelSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + (Vtail : Fin m → ℝ≥0) (α τfree : ℝ), + Real.exp (-aDetect) ≤ α / 2 → α ≤ 1 → + SharedWidthPreparedCenteredModelMarginalRadiusInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hRpos) (hσ := hσpos) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) (α := α) (τ := τfree) + (hb := hb) (o := o) (μ := μ) Bstruct Qstride master Plate gainLog Pphysical lateTarget)) ∧ + ∀ α : ℝ, Real.exp (-aDetect) ≤ α → + Real.exp (-gainLog) ≤ + (Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1)) ∧ + (scalarKernelCutoff (Fin (0 + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1))) / 2) : ℝ) ≤ Real.exp Pk ∧ + scalarKernelCutoff (Fin (0 + 1)) G 1 ⌈Real.exp (pDetect + 1)⌉₊ + (((Real.exp (-((5 * pDetect + 20) * Fintype.card (LayerSamplerVariables G I n B) + pDetect + 2)) * (α / 2)) * + Real.exp (-((pDetect + Cdetect) ^ Cdetect)) ^ (2 ^ (0 + 1))) / 2) ≤ S.value + +theorem exists_sharedWidth_prepared_perturbative_certified_source (m : ℕ) (Pdetect : Polynomial ℕ) : + SharedWidthPreparedPerturbativeCertifiedSourceStatement m Pdetect := by + unfold SharedWidthPreparedPerturbativeCertifiedSourceStatement + intro Cdetect Aearly Aalloc + have hactual := exists_sharedWidth_prepared_late_tolerance_certified_source m Pdetect + unfold SharedWidthPreparedLateToleranceCertifiedSourceStatement at hactual + obtain ⟨C, hC, hsource⟩ := hactual + refine ⟨C, hC, ?_⟩ + intro X J₀ L M nX hCoord Pstruct pSlice Qstride hm hPstruct hM hpSlice hQstride hnX + Jalloc pnum Bstruct G I n B selection A radiusBudget rowSets T siteRadius D + obtain ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, hlate⟩ := + hsource L hCoord hm hPstruct hM hpSlice hQstride hnX + refine ⟨pRadius, R, hpRadius, hR, hrone, hT0, hTideal, hTsource, + hTradius, hTbound, hrbound, hsmall, hdimensions, ?_⟩ + intro u P hu hmaster Pearly pModel pDetect aDetect gainLog Pk Qearly Pphysical Eextra target + F Tmod δ E η Prho Ptail K budget master + obtain ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, htolerances⟩ := hlate hu hmaster + refine ⟨hpRadiusBudget, hTbudget, hrbudget, hRadiusEarly, hPEarly, hEarlyBudget, + hModel, hDetect, hAlog, htarget, hD, hgain, hPk, hPrho, hPtail, hTmod, + t, ht, htone, htPtail, htbudget, ?_⟩ + intro Ppert Epert hPpert hEpert Qσ σ Pscale lengthLog Pseed + have hQσ : 0 ≤ Qσ := fixedPathPerturbationLog_nonneg hD.1 + (by linarith only [hD.1, hPpert]) hEpert m + obtain ⟨hσ, hσt, hσexp, hσinv, hScaleBound, hsamplers⟩ := htolerances hQσ + refine ⟨hσ, hσt, hσexp, hσinv, hScaleBound, ?_⟩ + intro Lmin Pmin Elog Vlog Qbad hPmin hLmin hElog hVlog hQbad hQexp W Qw J Pbase B0 U basis + obtain ⟨S, hPkScale, hFloor, hSWitness, hgap, hcert, hdetector, hgainKernel⟩ := + hsamplers Lmin Qbad hPmin hLmin hElog hVlog hQbad hQexp U basis + refine ⟨S, hPkScale, hFloor, hSWitness, hgap, hcert, ?_, hdetector, hgainKernel⟩ + intro Apert ηpert hηpert hApert hηinv + exact allocatedPreparedFinalTolerance_chosen_tail (G := G) (D := D) + (P := Ppert) (E := Epert) (t := t) B hD.1 hPpert hEpert + hdimensions.tuples hdimensions.axes Apert hηpert hApert hηinv ht U basis S + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftDifferenceCount.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftDifferenceCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8badc1904f8835b5974eb14107b14969b4e5784 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftDifferenceCount.lean @@ -0,0 +1,348 @@ +import OAI.Combinatorics.Progressions.Estimates.CorrelationDerivative + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [DecidableEq G] + +theorem finite_support_shift_sum {V : Type*} [AddCommMonoid V] + (Q T : Finset G) (f : G → V) (s : G) + (hsupport : ∀ x, x ∉ Q → f x = 0) + (hcover : ∀ x ∈ Q, x + s ∈ T) : + (∑ x ∈ T, f (x - s)) = ∑ x ∈ Q, f x := by + have hsub : Q.image (fun x => x + s) ⊆ T := by + intro x hx + obtain ⟨y, hy, rfl⟩ := Finset.mem_image.mp hx + exact hcover y hy + calc + _ = ∑ x ∈ Q.image (fun x => x + s), f (x - s) := by + symm + apply Finset.sum_subset hsub + intro x _ hx + apply hsupport + intro hq + exact hx (Finset.mem_image.mpr ⟨x - s, hq, sub_add_cancel x s⟩) + _ = ∑ x ∈ Q, f x := by + rw [Finset.sum_image (fun _ _ _ _ h => add_right_cancel h)] + simp + +noncomputable def shiftCorrelation (Q : Finset G) (f : G → ℂ) (h : G) : ℂ := + ∑ x ∈ Q, f x * star (f (x + h)) + +theorem finite_support_shift_pair (Q T : Finset G) (f : G → ℂ) (s t : G) + (hsupport : ∀ x, x ∉ Q → f x = 0) + (hcover : ∀ x ∈ Q, x + s ∈ T) : + (∑ x ∈ T, f (x - s) * star (f (x - t))) = shiftCorrelation Q f (s - t) := by + have hid (x : G) : x - s + (s - t) = x - t := by abel + simpa only [shiftCorrelation, hid] using finite_support_shift_sum Q T + (fun x => f x * star (f (x + (s - t)))) s + (fun x hx => by rw [hsupport x hx, zero_mul]) hcover + +theorem norm_sum_sq_le_card_mul_sum_norm_sq {ι : Type*} (S : Finset ι) (f : ι → ℂ) : + ‖∑ x ∈ S, f x‖ ^ 2 ≤ (S.card : ℝ) * ∑ x ∈ S, ‖f x‖ ^ 2 := by + have hnorm := norm_sum_le S f + have hcs := Finset.sum_mul_sq_le_sq_mul_sq S (fun x => ‖f x‖) (fun _ => (1 : ℝ)) + simp only [mul_one, one_pow, Finset.sum_const, nsmul_eq_mul, mul_one] at hcs + exact (pow_le_pow_left₀ (norm_nonneg _) hnorm 2).trans (by simpa only [mul_comm] using hcs) + +theorem finite_shift_energy (Q T S : Finset G) (f : G → ℂ) + (hsupport : ∀ x, x ∉ Q → f x = 0) + (hcover : ∀ s ∈ S, ∀ x ∈ Q, x + s ∈ T) : + (∑ x ∈ T, ‖∑ s ∈ S, f (x - s)‖ ^ 2) = + ∑ s ∈ S, ∑ t ∈ S, (shiftCorrelation Q f (s - t)).re := by + have heq : (∑ x ∈ T, (∑ s ∈ S, f (x - s)) * star (∑ t ∈ S, f (x - t))) = + ∑ s ∈ S, ∑ t ∈ S, shiftCorrelation Q f (s - t) := by + conv_rhs => rw [Finset.sum_comm] + simp only [star_sum, Finset.sum_mul, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro s hs + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro t ht + exact finite_support_shift_pair Q T f t s hsupport (hcover t ht) + simpa only [Complex.re_sum, mul_star_re_eq_norm_sq] using congrArg Complex.re heq + +theorem finite_shift_cauchy (Q T S : Finset G) (f : G → ℂ) + (hsupport : ∀ x, x ∉ Q → f x = 0) + (hcover : ∀ s ∈ S, ∀ x ∈ Q, x + s ∈ T) : + (S.card : ℝ) ^ 2 * ‖∑ x ∈ Q, f x‖ ^ 2 ≤ + (T.card : ℝ) * ∑ s ∈ S, ∑ t ∈ S, (shiftCorrelation Q f (s - t)).re := by + have hsum : (∑ x ∈ T, ∑ s ∈ S, f (x - s)) = (S.card : ℂ) * ∑ x ∈ Q, f x := by + rw [Finset.sum_comm] + have hshift : ∀ s ∈ S, (∑ x ∈ T, f (x - s)) = ∑ x ∈ Q, f x := + fun s hs => finite_support_shift_sum Q T f s hsupport (hcover s hs) + rw [Finset.sum_congr rfl hshift] + simp + have hcs := norm_sum_sq_le_card_mul_sum_norm_sq T (fun x => ∑ s ∈ S, f (x - s)) + rw [hsum, norm_mul, Complex.norm_natCast, mul_pow, + finite_shift_energy Q T S f hsupport hcover] at hcs + exact hcs + +theorem finite_shift_cauchy_norm (Q T S : Finset G) (f : G → ℂ) + (hsupport : ∀ x, x ∉ Q → f x = 0) + (hcover : ∀ s ∈ S, ∀ x ∈ Q, x + s ∈ T) : + (S.card : ℝ) ^ 2 * ‖∑ x ∈ Q, f x‖ ^ 2 ≤ + (T.card : ℝ) * ∑ s ∈ S, ∑ t ∈ S, ‖shiftCorrelation Q f (s - t)‖ := by + apply (finite_shift_cauchy Q T S f hsupport hcover).trans + apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) + apply Finset.sum_le_sum + intro s _ + exact Finset.sum_le_sum (fun t _ => Complex.re_le_norm _) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [DecidableEq G] + +omit [DecidableEq G] in +theorem shiftCorrelation_zero_norm_le (Q : Finset G) (f : G → ℂ) + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) : ‖shiftCorrelation Q f 0‖ ≤ Q.card := by + unfold shiftCorrelation + calc + _ ≤ ∑ x ∈ Q, ‖f x * star (f (x + 0))‖ := norm_sum_le _ _ + _ ≤ ∑ _x ∈ Q, (1 : ℝ) := by + apply Finset.sum_le_sum + intro x hx + simp only [add_zero, norm_mul, norm_star] + exact (mul_le_mul (hf x hx) (hf x hx) (norm_nonneg _) zero_le_one).trans_eq (one_mul _) + _ = (Q.card : ℝ) := by simp + +theorem exists_large_shift_pair (Q T S : Finset G) (f : G → ℂ) + (hQ : Q.Nonempty) (hsupport : ∀ x, x ∉ Q → f x = 0) + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) + (hcover : ∀ s ∈ S, ∀ x ∈ Q, x + s ∈ T) + (hT : T.card ≤ 2 * Q.card) + {δ : ℝ} (hδ : 0 < δ) (hshift : 8 ≤ δ ^ 2 * S.card) + (hscore : δ * Q.card ≤ ‖∑ x ∈ Q, f x‖) : + ∃ s ∈ S, ∃ t ∈ S, s ≠ t ∧ + δ ^ 2 * Q.card / 4 ≤ ‖shiftCorrelation Q f (s - t)‖ := by + have hN : (0 : ℝ) < Q.card := by exact_mod_cast hQ.card_pos + have hS : S.Nonempty := by + by_contra hs + rw [Finset.not_nonempty_iff_eq_empty.mp hs] at hshift + norm_num at hshift + have hH : (0 : ℝ) < S.card := by exact_mod_cast hS.card_pos + have hTR : (T.card : ℝ) ≤ 2 * Q.card := by exact_mod_cast hT + by_contra hnone + push Not at hnone + have hterm (s : G) (hs : s ∈ S) (t : G) (ht : t ∈ S) : + ‖shiftCorrelation Q f (s - t)‖ ≤ δ ^ 2 * Q.card / 4 + + if s = t then (Q.card : ℝ) else 0 := by + by_cases heq : s = t + · subst t + simp only [sub_self, ite_true] + have hdiag := shiftCorrelation_zero_norm_le Q f hf + have hnonneg : 0 ≤ δ ^ 2 * Q.card / 4 := by positivity + linarith + · simp only [ite_eq_right heq, add_zero] + exact (hnone s hs t ht heq).le + have hsum : (∑ s ∈ S, ∑ t ∈ S, ‖shiftCorrelation Q f (s - t)‖) ≤ + (S.card : ℝ) ^ 2 * (δ ^ 2 * Q.card / 4) + S.card * Q.card := by + calc + _ ≤ ∑ s ∈ S, ∑ t ∈ S, + (δ ^ 2 * Q.card / 4 + if s = t then (Q.card : ℝ) else 0) := + Finset.sum_le_sum (fun s hs => Finset.sum_le_sum (fun t ht => hterm s hs t ht)) + _ = _ := by + simp only [Finset.sum_add_distrib, Finset.sum_const, nsmul_eq_mul] + simp only [Finset.sum_ite_eq] + rw [Finset.sum_congr rfl (fun s hs => by rw [ite_eq_left hs])] + simp only [Finset.sum_const, nsmul_eq_mul] + ring + have hupper := (finite_shift_cauchy_norm Q T S f hsupport hcover).trans + (mul_le_mul_of_nonneg_left hsum (Nat.cast_nonneg _)) + have hupper' := hupper.trans (mul_le_mul_of_nonneg_right hTR + (show 0 ≤ (S.card : ℝ) ^ 2 * (δ ^ 2 * Q.card / 4) + S.card * Q.card by positivity)) + have hlower := mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (mul_nonneg hδ.le hN.le) hscore 2) (sq_nonneg (S.card : ℝ)) + have hcombined := hlower.trans hupper' + have hshift' := mul_le_mul_of_nonneg_right hshift + (mul_nonneg hH.le (sq_nonneg (Q.card : ℝ))) + have hpos : 0 < (S.card : ℝ) * (Q.card : ℝ) ^ 2 := mul_pos hH (sq_pos_of_pos hN) + nlinarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [DecidableEq G] + +theorem shiftCorrelation_norm_le (Q : Finset G) (f : G → ℂ) + (hsupport : ∀ x, x ∉ Q → f x = 0) (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) (h : G) : + ‖shiftCorrelation Q f h‖ ≤ Q.card := by + have hall (x : G) : ‖f x‖ ≤ 1 := by + by_cases hx : x ∈ Q + · exact hf x hx + · simp only [hsupport x hx, norm_zero, zero_le_one] + unfold shiftCorrelation + calc + _ ≤ ∑ x ∈ Q, ‖f x * star (f (x + h))‖ := norm_sum_le _ _ + _ ≤ ∑ _x ∈ Q, (1 : ℝ) := by + apply Finset.sum_le_sum + intro x hx + rw [norm_mul, norm_star] + exact (mul_le_mul (hf x hx) (hall (x + h)) (norm_nonneg _) zero_le_one).trans_eq (one_mul _) + _ = (Q.card : ℝ) := by simp + +theorem many_large_shift_pairs (Q T S : Finset G) (f : G → ℂ) + (hQ : Q.Nonempty) (hsupport : ∀ x, x ∉ Q → f x = 0) + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) + (hcover : ∀ s ∈ S, ∀ x ∈ Q, x + s ∈ T) + (hT : T.card ≤ 2 * Q.card) + {δ : ℝ} (hδ : 0 < δ) (hshift : 8 ≤ δ ^ 2 * S.card) + (hscore : δ * Q.card ≤ ‖∑ x ∈ Q, f x‖) : + δ ^ 2 * (S.card : ℝ) ^ 2 / 8 ≤ + (((S ×ˢ S).filter (fun p => p.1 ≠ p.2 ∧ + δ ^ 2 * Q.card / 8 ≤ ‖shiftCorrelation Q f (p.1 - p.2)‖)).card : ℝ) := by + let good := (S ×ˢ S).filter (fun p => p.1 ≠ p.2 ∧ + δ ^ 2 * Q.card / 8 ≤ ‖shiftCorrelation Q f (p.1 - p.2)‖) + have hN : (0 : ℝ) < Q.card := by exact_mod_cast hQ.card_pos + have hS : S.Nonempty := by + by_contra hs + rw [Finset.not_nonempty_iff_eq_empty.mp hs] at hshift + norm_num at hshift + have hH : (0 : ℝ) < S.card := by exact_mod_cast hS.card_pos + have hTR : (T.card : ℝ) ≤ 2 * Q.card := by exact_mod_cast hT + have hterm (p : G × G) : ‖shiftCorrelation Q f (p.1 - p.2)‖ ≤ + δ ^ 2 * Q.card / 8 + + (if p.1 ≠ p.2 ∧ δ ^ 2 * Q.card / 8 ≤ ‖shiftCorrelation Q f (p.1 - p.2)‖ + then (Q.card : ℝ) else 0) + + (if p.1 = p.2 then (Q.card : ℝ) else 0) := by + have hbound := shiftCorrelation_norm_le Q f hsupport hf (p.1 - p.2) + have hnonneg : 0 ≤ δ ^ 2 * Q.card / 8 := by positivity + by_cases heq : p.1 = p.2 + · simp only [heq, ne_eq, not_true_eq_false, false_and, ite_false, ite_true] + rw [heq] at hbound + linarith + · by_cases hlarge : δ ^ 2 * Q.card / 8 ≤ ‖shiftCorrelation Q f (p.1 - p.2)‖ + · simp only [heq, ne_eq, not_false_eq_true, hlarge, and_self, ite_true, ite_false] + linarith + · simp only [heq, ne_eq, not_false_eq_true, hlarge, and_false, ite_false] + linarith + have hgood : (∑ p ∈ S ×ˢ S, + if p.1 ≠ p.2 ∧ δ ^ 2 * Q.card / 8 ≤ ‖shiftCorrelation Q f (p.1 - p.2)‖ + then (Q.card : ℝ) else 0) = good.card * (Q.card : ℝ) := by + rw [← Finset.sum_filter] + simp only [Finset.sum_const, nsmul_eq_mul, good] + have hdiag : (∑ p ∈ S ×ˢ S, if p.1 = p.2 then (Q.card : ℝ) else 0) = + (S.card : ℝ) * Q.card := by + rw [Finset.sum_product] + simp only [Finset.sum_ite_eq] + rw [Finset.sum_congr rfl (fun s hs => by rw [ite_eq_left hs])] + simp + have hsum : (∑ s ∈ S, ∑ t ∈ S, ‖shiftCorrelation Q f (s - t)‖) ≤ + (S.card : ℝ) ^ 2 * (δ ^ 2 * Q.card / 8) + good.card * (Q.card : ℝ) + S.card * Q.card := by + rw [← Finset.sum_product S S (fun p : G × G => ‖shiftCorrelation Q f (p.1 - p.2)‖)] + apply (Finset.sum_le_sum (fun p (_ : p ∈ S ×ˢ S) => hterm p)).trans_eq + rw [Finset.sum_add_distrib, Finset.sum_add_distrib, hgood, hdiag] + simp only [Finset.sum_const, Finset.card_product, Nat.cast_mul, nsmul_eq_mul] + ring + have hupper := (finite_shift_cauchy_norm Q T S f hsupport hcover).trans + (mul_le_mul_of_nonneg_left hsum (Nat.cast_nonneg _)) + have hupper' := hupper.trans (mul_le_mul_of_nonneg_right hTR + (show 0 ≤ (S.card : ℝ) ^ 2 * (δ ^ 2 * Q.card / 8) + good.card * (Q.card : ℝ) + + S.card * Q.card by positivity)) + have hlower := mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (mul_nonneg hδ.le hN.le) hscore 2) (sq_nonneg (S.card : ℝ)) + have hcombined := hlower.trans hupper' + have hshift' := mul_le_mul_of_nonneg_right hshift + (mul_nonneg hH.le (sq_nonneg (Q.card : ℝ))) + change δ ^ 2 * (S.card : ℝ) ^ 2 / 8 ≤ (good.card : ℝ) + by_contra hnone + have hsmall := mul_lt_mul_of_pos_right (lt_of_not_ge hnone) (sq_pos_of_pos hN) + have hpos : 0 < (S.card : ℝ) * (Q.card : ℝ) ^ 2 := mul_pos hH (sq_pos_of_pos hN) + nlinarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [DecidableEq G] + +theorem card_pairs_le_card_differences_mul (S : Finset G) (A : Finset (G × G)) + (hA : A ⊆ S ×ˢ S) : + A.card ≤ (A.image (fun p => p.1 - p.2)).card * S.card := by + let f (p : G × G) := (p.1 - p.2, p.2) + have hf : Function.Injective f := by + intro p q heq + have hdiff := congrArg Prod.fst heq + have hsecond := congrArg Prod.snd heq + change p.1 - p.2 = q.1 - q.2 at hdiff + change p.2 = q.2 at hsecond + apply Prod.ext + · rw [hsecond] at hdiff + have := congrArg (fun x : G => x + q.2) hdiff + simpa only [sub_add_cancel] using this + · exact hsecond + have hsub : A.image f ⊆ (A.image (fun p => p.1 - p.2)) ×ˢ S := by + intro p hp + obtain ⟨q, hq, rfl⟩ := Finset.mem_image.mp hp + exact Finset.mem_product.mpr + ⟨Finset.mem_image.mpr ⟨q, hq, rfl⟩, (Finset.mem_product.mp (hA hq)).2⟩ + calc + _ = (A.image f).card := (Finset.card_image_of_injective A hf).symm + _ ≤ ((A.image (fun p => p.1 - p.2)) ×ˢ S).card := Finset.card_le_card hsub + _ = _ := Finset.card_product _ _ + +theorem many_large_shift_differences (Q T S : Finset G) (f : G → ℂ) + (hQ : Q.Nonempty) (hsupport : ∀ x, x ∉ Q → f x = 0) + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) + (hcover : ∀ s ∈ S, ∀ x ∈ Q, x + s ∈ T) + (hT : T.card ≤ 2 * Q.card) + {δ : ℝ} (hδ : 0 < δ) (hshift : 8 ≤ δ ^ 2 * S.card) + (hscore : δ * Q.card ≤ ‖∑ x ∈ Q, f x‖) : + ∃ D : Finset G, δ ^ 2 * S.card / 8 ≤ (D.card : ℝ) ∧ + ∀ h ∈ D, h ≠ 0 ∧ (∃ s ∈ S, ∃ t ∈ S, h = s - t) ∧ + δ ^ 2 * Q.card / 8 ≤ ‖shiftCorrelation Q f h‖ := by + let good := (S ×ˢ S).filter (fun p => p.1 ≠ p.2 ∧ + δ ^ 2 * Q.card / 8 ≤ ‖shiftCorrelation Q f (p.1 - p.2)‖) + let D := good.image (fun p => p.1 - p.2) + have hS : S.Nonempty := by + by_contra hs + rw [Finset.not_nonempty_iff_eq_empty.mp hs] at hshift + norm_num at hshift + have hH : (0 : ℝ) < S.card := by exact_mod_cast hS.card_pos + have hpairs : δ ^ 2 * (S.card : ℝ) ^ 2 / 8 ≤ (good.card : ℝ) := + many_large_shift_pairs Q T S f hQ hsupport hf hcover hT hδ hshift hscore + have hcount : (good.card : ℝ) ≤ (D.card : ℝ) * S.card := by + exact_mod_cast card_pairs_le_card_differences_mul S good (Finset.filter_subset _ _) + refine ⟨D, ?_, ?_⟩ + · apply (mul_le_mul_iff_left₀ hH).mp + calc + _ = δ ^ 2 * (S.card : ℝ) ^ 2 / 8 := by ring + _ ≤ (D.card : ℝ) * S.card := hpairs.trans hcount + · intro h hh + obtain ⟨p, hp, rfl⟩ := Finset.mem_image.mp hh + obtain ⟨hpS, hpne, hpbound⟩ := Finset.mem_filter.mp hp + obtain ⟨hps, hpt⟩ := Finset.mem_product.mp hpS + exact ⟨sub_ne_zero.mpr hpne, ⟨p.1, hps, p.2, hpt, rfl⟩, hpbound⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftTestingGowers.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftTestingGowers.lean new file mode 100644 index 0000000000000000000000000000000000000000..fade95856541f3ecb6d15d7a4293822eabc875db --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftTestingGowers.lean @@ -0,0 +1,256 @@ +import OAI.Combinatorics.Progressions.Estimates.CorrelationDerivative +import OAI.Combinatorics.Progressions.Estimates.FixedPartnerPower +import OAI.Combinatorics.Progressions.Linear.BalancedDualBounds + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {H Ω : Type*} [Fintype H] [Fintype Ω] + +theorem square_norm_mean_eq_cross_re (v : H → ℂ) : + ‖𝔼 h, v h‖ ^ 2 = (𝔼 h, 𝔼 k, v h * star (v k)).re := by + rw [← Fintype.expect_mul_expect, expect_star, mul_star_re_eq_norm_sq] + +theorem mean_square_family_le_cross_norm (v : H → Ω → ℂ) : + (𝔼 x, ‖𝔼 h, v h x‖ ^ 2) ≤ 𝔼 h, 𝔼 k, ‖𝔼 x, v h x * star (v k x)‖ := by + simp_rw [square_norm_mean_eq_cross_re] + rw [← expect_re, Finset.expect_comm] + have hid (h : H) : + (𝔼 x, 𝔼 k, v h x * star (v k x)) = 𝔼 k, 𝔼 x, v h x * star (v k x) := + Finset.expect_comm _ _ _ + simp_rw [hid, expect_re] + apply Finset.expect_le_expect + intro h _ + apply Finset.expect_le_expect + intro k _ + rw [← expect_re] + exact Complex.re_le_norm _ + +theorem finite_family_cauchy_schwarz [Nonempty Ω] + (B : Ω → ℂ) (v : H → Ω → ℂ) {M : ℝ} (hB : ∀ x, ‖B x‖ ≤ M) : + ‖𝔼 x, B x * (𝔼 h, v h x)‖ ^ 2 ≤ + M ^ 2 * (𝔼 h, 𝔼 k, ‖𝔼 x, v h x * star (v k x)‖) := by + have hcs := norm_expect_mul_star_sq_le B (fun x => star (𝔼 h, v h x)) + simp only [star_star, norm_star] at hcs + have hBM : (𝔼 x, ‖B x‖ ^ 2) ≤ M ^ 2 := + (Finset.expect_le_expect (fun x _ => + pow_le_pow_left₀ (norm_nonneg _) (hB x) 2)).trans_eq (Fintype.expect_const _) + exact hcs.trans ((mul_le_mul_of_nonneg_right hBM + (Finset.expect_nonneg (fun x _ => sq_nonneg _))).trans + (mul_le_mul_of_nonneg_left (mean_square_family_le_cross_norm v) (sq_nonneg M))) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [Fintype G] + +theorem shift_phase_average (v B : G → ℂ) (L : G → G → ℂ) (a : G → ℂ) + (ha : ∀ h, a h * (𝔼 x, v x * (B (x + h) * L h x)) = + (‖𝔼 x, v x * (B (x + h) * L h x)‖ : ℂ)) : + (𝔼 y, B y * (𝔼 h, a h * v (y - h) * L h (y - h))) = + ((𝔼 h, ‖𝔼 x, v x * (B (x + h) * L h x)‖) : ℝ) := by + have hmove (h : G) : + a h * (𝔼 x, v x * (B (x + h) * L h x)) = + 𝔼 y, B y * (a h * v (y - h) * L h (y - h)) := by + rw [Finset.mul_expect] + apply Fintype.expect_equiv (Equiv.addRight h) + intro x + simp only [Equiv.coe_addRight, add_sub_cancel_right] + ring + calc + _ = 𝔼 h, 𝔼 y, B y * (a h * v (y - h) * L h (y - h)) := by + simp_rw [Finset.mul_expect] + rw [Finset.expect_comm] + _ = 𝔼 h, a h * (𝔼 x, v x * (B (x + h) * L h x)) := by simp_rw [← hmove] + _ = _ := by simp_rw [ha]; simp [Fintype.expect_eq_sum_div_card] + +theorem shift_phase_cross_norm (v : G → ℂ) (L : G → G → ℂ) (a : G → ℂ) + (ha : ∀ h, ‖a h‖ = 1) (h k : G) : + ‖𝔼 y, (a h * v (y - h) * L h (y - h)) * + star (a k * v (y - k) * L k (y - k))‖ = + ‖𝔼 x, v x * star (v (x + h - k)) * L h x * star (L k (x + h - k))‖ := by + have hid : (a h * star (a k)) * + (𝔼 x, v x * star (v (x + h - k)) * L h x * star (L k (x + h - k))) = + 𝔼 y, (a h * v (y - h) * L h (y - h)) * + star (a k * v (y - k) * L k (y - k)) := by + rw [Finset.mul_expect] + apply Fintype.expect_equiv (Equiv.addRight h) + intro x + simp only [Equiv.coe_addRight, add_sub_cancel_right, star_mul] + ring + rw [← hid, norm_mul, norm_mul, norm_star, ha, ha, one_mul, one_mul] + +theorem shifted_test_cauchy_schwarz (v B : G → ℂ) (L : G → G → ℂ) + {M : ℝ} (hB : ∀ x, ‖B x‖ ≤ M) : + (𝔼 h, ‖𝔼 x, v x * (B (x + h) * L h x)‖) ^ 2 ≤ + M ^ 2 * (𝔼 h, 𝔼 k, + ‖𝔼 x, v x * star (v (x + h - k)) * L h x * star (L k (x + h - k))‖) := by + have hex (h : G) := exists_complex_unit_phase (𝔼 x, v x * (B (x + h) * L h x)) + choose a ha hphase using hex + have hcs := finite_family_cauchy_schwarz B + (fun h y => a h * v (y - h) * L h (y - h)) hB + rw [shift_phase_average v B L a hphase, Complex.norm_real, + Real.norm_of_nonneg (Finset.expect_nonneg (fun h _ => norm_nonneg _))] at hcs + simpa only [shift_phase_cross_norm v L a ha] using hcs + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem finite_absolute_cauchy_schwarz {H Ω : Type*} [Fintype H] [Fintype Ω] + [Nonempty Ω] (B : Ω → ℂ) (v : H → Ω → ℂ) {M : ℝ} (hB : ∀ x, ‖B x‖ ≤ M) : + (𝔼 h, ‖𝔼 x, B x * v h x‖) ^ 2 ≤ + M ^ 2 * (𝔼 h, 𝔼 k, ‖𝔼 x, v h x * star (v k x)‖) := by + choose a ha hphase using fun h => exists_complex_unit_phase (𝔼 x, B x * v h x) + have havg : (𝔼 x, B x * (𝔼 h, a h * v h x)) = + ((𝔼 h, ‖𝔼 x, B x * v h x‖) : ℝ) := by + calc + _ = 𝔼 h, a h * (𝔼 x, B x * v h x) := by + simp_rw [Finset.mul_expect] + rw [Finset.expect_comm] + apply Finset.expect_congr rfl + intro h _ + apply Finset.expect_congr rfl + intro x _ + ring + _ = _ := by simp_rw [hphase]; simp [Fintype.expect_eq_sum_div_card] + have hcross (h k : H) : + ‖𝔼 x, (a h * v h x) * star (a k * v k x)‖ = + ‖𝔼 x, v h x * star (v k x)‖ := by + have hid : (𝔼 x, (a h * v h x) * star (a k * v k x)) = + (a h * star (a k)) * (𝔼 x, v h x * star (v k x)) := by + rw [Finset.mul_expect] + apply Finset.expect_congr rfl + intro x _ + simp only [star_mul] + ring + rw [hid, norm_mul, norm_mul, norm_star, ha, ha, one_mul, one_mul] + have hcs := finite_family_cauchy_schwarz B (fun h x => a h * v h x) hB + rw [havg, Complex.norm_real, + Real.norm_of_nonneg (Finset.expect_nonneg (fun h _ => norm_nonneg _))] at hcs + simpa only [hcross] using hcs + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G ι : Type*} [AddCommGroup G] [Fintype G] [Nonempty ι] + +theorem exists_shift_tests_of_lt_seminorm (v B : G → ℂ) (T : ι → G → ℂ) + {M a : ℝ} (hB : ∀ x, ‖B x‖ ≤ M) (hT : ∀ i x, ‖T i x‖ ≤ 1) + (ha : 0 ≤ a) (hlt : a < shiftTestingSeminorm B T v) : + ∃ t : G → ι, a ^ 2 ≤ M ^ 2 * (𝔼 h, 𝔼 k, + ‖𝔼 x, v x * star (v (x + h - k)) * T (t h) x * star (T (t k) (x + h - k))‖) := by + let eta := (shiftTestingSeminorm B T v - a) / 2 + have heta : 0 < eta := by dsimp only [eta]; linarith + obtain ⟨t, ht⟩ := exists_nearly_maximizing_shift_tests B T hB hT v heta + have havg : a ≤ 𝔼 h, ‖𝔼 x, v x * (B (x + h) * T (t h) x)‖ := by + dsimp only [eta] at ht + linarith + exact ⟨t, (pow_le_pow_left₀ ha havg 2).trans + (shifted_test_cauchy_schwarz v B (fun h => T (t h)) hB)⟩ + +theorem exists_shift_tests_of_seminorm_large (v B : G → ℂ) (T : ι → G → ℂ) + {M tau : ℝ} (hB : ∀ x, ‖B x‖ ≤ M) (hT : ∀ i x, ‖T i x‖ ≤ 1) + (htau : 0 < tau) (hlarge : tau ≤ shiftTestingSeminorm B T v) : + ∃ t : G → ι, tau ^ 2 / 4 ≤ M ^ 2 * (𝔼 h, 𝔼 k, + ‖𝔼 x, v x * star (v (x + h - k)) * T (t h) x * star (T (t k) (x + h - k))‖) := by + obtain ⟨t, ht⟩ := exists_shift_tests_of_lt_seminorm v B T hB hT + (a := tau / 2) (by positivity) (by linarith) + exact ⟨t, (by convert ht using 1; ring)⟩ + +theorem shiftTestingSeminorm_sq_le_of_cross_bound (v B : G → ℂ) (T : ι → G → ℂ) + {M D : ℝ} (hB : ∀ x, ‖B x‖ ≤ M) (hT : ∀ i x, ‖T i x‖ ≤ 1) (hD : 0 ≤ D) + (hcross : ∀ t : G → ι, (𝔼 h, 𝔼 k, + ‖𝔼 x, v x * star (v (x + h - k)) * T (t h) x * star (T (t k) (x + h - k))‖) ≤ D) : + (shiftTestingSeminorm B T v) ^ 2 ≤ M ^ 2 * D := by + have hroot := Real.sq_sqrt (mul_nonneg (sq_nonneg M) hD) + have hle : shiftTestingSeminorm B T v ≤ Real.sqrt (M ^ 2 * D) := by + by_contra h + have hlt := lt_of_not_ge h + let a := (shiftTestingSeminorm B T v + Real.sqrt (M ^ 2 * D)) / 2 + have ha : 0 ≤ a := by dsimp only [a]; positivity + have hasmall : a < shiftTestingSeminorm B T v := by dsimp only [a]; linarith + obtain ⟨t, ht⟩ := exists_shift_tests_of_lt_seminorm v B T hB hT ha hasmall + have hu := ht.trans (mul_le_mul_of_nonneg_left (hcross t) (sq_nonneg M)) + have hbig : Real.sqrt (M ^ 2 * D) < a := by dsimp only [a]; linarith + nlinarith [Real.sqrt_nonneg (M ^ 2 * D)] + exact (pow_le_pow_left₀ (apply_nonneg _ _) hle 2).trans_eq hroot + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G ι : Type*} [AddCommGroup G] [Fintype G] + +theorem shift_derivative_correlation_le_one (v : G → ℂ) (T : ι → G → ℂ) + (hv : ∀ x, ‖v x‖ ≤ 1) (hT : ∀ i x, ‖T i x‖ ≤ 1) (i j : ι) (h k : G) : + ‖𝔼 x, v x * star (v (x + h - k)) * T i x * star (T j (x + h - k))‖ ≤ 1 := by + apply (RCLike.norm_expect_le (K := ℂ)).trans + apply Finset.expect_le Finset.univ_nonempty + intro x _ + simp only [norm_mul, norm_star] + have hpair := (mul_le_of_le_one_left (norm_nonneg _) (hv x)).trans (hv (x + h - k)) + have htriple := (mul_le_of_le_one_left (norm_nonneg _) hpair).trans (hT i x) + exact (mul_le_of_le_one_left (norm_nonneg _) htriple).trans (hT j _) + +theorem shiftTestingSeminorm_gowers_lower [Nonempty ι] (s : ℕ) + (v B : G → ℂ) (T : ι → G → ℂ) {M tau delta gamma : ℝ} + (hM : 0 < M) (htau : 0 < tau) (hdelta : 0 ≤ delta) (hgamma : 0 ≤ gamma) + (hv : ∀ x, ‖v x‖ ≤ 1) (hB : ∀ x, ‖B x‖ ≤ M) (hT : ∀ i x, ‖T i x‖ ≤ 1) + (hlarge : tau ≤ shiftTestingSeminorm B T v) + (hdet : ∀ (i j : ι) (a : G) (f : G → ℂ), (∀ x, ‖f x‖ ≤ 1) → + delta ≤ ‖𝔼 x, f x * T i x * star (T j (x + a))‖ → gamma ≤ gowersNorm (s + 1) f) : + gamma ^ (2 ^ (s + 1)) * (tau ^ 2 / (4 * M ^ 2) - delta) ≤ + gowersNorm (s + 2) v ^ (2 ^ (s + 2)) := by + obtain ⟨t, ht⟩ := exists_shift_tests_of_seminorm_large v B T hB hT htau hlarge + let C : G → G → ℝ := fun h k => + ‖𝔼 x, v x * star (v (x + h - k)) * T (t h) x * star (T (t k) (x + h - k))‖ + have hmean : tau ^ 2 / (4 * M ^ 2) ≤ 𝔼 h, 𝔼 k, C h k := by + apply (div_le_iff₀ (show 0 < 4 * M ^ 2 by positivity)).mpr + change tau ^ 2 / 4 ≤ M ^ 2 * (𝔼 h, 𝔼 k, C h k) at ht + nlinarith only [ht] + apply gowersNorm_pow_lower_of_pair_detector s v C hdelta hgamma + (fun h k => shift_derivative_correlation_le_one v T hv hT (t h) (t k) h k) hmean + intro h k hc + apply hdet (t h) (t k) (h - k) (multiplicativeDerivative v (h - k)) + · intro x + simp only [multiplicativeDerivative, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hv x)).trans (hv _) + · simpa only [C, multiplicativeDerivative, ← add_sub_assoc] using hc + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedAdaptedIdeal.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedAdaptedIdeal.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fb5eb6935a84207e534ea00b501bc2bc176f178 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedAdaptedIdeal.lean @@ -0,0 +1,80 @@ +import OAI.Combinatorics.Progressions.Polynomial.AdaptedPolynomialSubstitution + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +noncomputable def shiftedAdaptedSubmodule (w : σ → ℕ) (k : ℕ) : + Submodule ℚ (VectorPolynomial σ ℚ L) where + carrier := {p | ∀ α, coefficients p α ∈ F.layer (Finsupp.weight w α + k)} + zero_mem' := by intro α; simp + add_mem' hp hq := by + intro α + simpa only [map_add, Finsupp.add_apply] using (F.layer _).add_mem (hp α) (hq α) + smul_mem' r p hp := by + intro α + simpa only [map_smul, Finsupp.smul_apply] using (F.layer _).smul_mem r (hp α) + +theorem monomial_mem_shiftedAdaptedSubmodule (w : σ → ℕ) (k : ℕ) + (α : σ →₀ ℕ) {a : L} (ha : a ∈ F.layer (Finsupp.weight w α + k)) : + monomial (R := ℚ) α a ∈ F.shiftedAdaptedSubmodule w k := by + classical + intro β + by_cases h : α = β + · subst β + simpa using ha + · simp [h] + +theorem lie_mem_shiftedAdaptedSubmodule (w : σ → ℕ) {i j : ℕ} + {p q : VectorPolynomial σ ℚ L} + (hp : p ∈ F.shiftedAdaptedSubmodule w i) (hq : q ∈ F.shiftedAdaptedSubmodule w j) : + ⁅p, q⁆ ∈ F.shiftedAdaptedSubmodule w (i + j) := by + classical + rw [← sum_monomial_coefficients p, ← sum_monomial_coefficients q] + simp only [Finsupp.sum] + rw [sum_lie_sum] + apply Submodule.sum_mem + intro α _ + apply Submodule.sum_mem + intro β _ + rw [lie_monomial] + apply F.monomial_mem_shiftedAdaptedSubmodule + simpa only [map_add, Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using F.lie_mem (hp α) (hq β) + +noncomputable def shiftedAdaptedIdeal (w : σ → ℕ) : LieIdeal ℚ (F.adaptedLieSubalgebra w) := + { (F.shiftedAdaptedSubmodule w 1).comap (F.adaptedLieSubalgebra w).incl.toLinearMap with + lie_mem := by + intro p q hq + have hp : (p : VectorPolynomial σ ℚ L) ∈ F.shiftedAdaptedSubmodule w 0 := by + intro α + simpa only [Nat.add_zero] using p.property α + exact F.lie_mem_shiftedAdaptedSubmodule w hp hq } + +theorem adapted_constant (w : σ → ℕ) (a : L) : F.Adapted w (monomial 0 a) := by + apply (F.mem_adaptedSubmodule w _).mp + apply F.monomial_mem_adaptedSubmodule + rw [map_zero] + apply F.antitone (Nat.zero_le 1) + rw [F.one_eq_top] + trivial + +noncomputable def adaptedConstant (w : σ → ℕ) (a : L) : F.adaptedLieSubalgebra w := + ⟨monomial 0 a, (F.mem_adaptedSubmodule w _).mpr (F.adapted_constant w a)⟩ + +theorem adaptedConstant_mem_shiftedIdeal (w : σ → ℕ) (a : L) : + F.adaptedConstant w a ∈ F.shiftedAdaptedIdeal w := by + apply F.monomial_mem_shiftedAdaptedSubmodule + simp only [map_zero, Nat.zero_add, F.one_eq_top, Submodule.mem_top] + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedGradedCalculus.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedGradedCalculus.lean new file mode 100644 index 0000000000000000000000000000000000000000..373bdc2e07df65f5fa462cd222c8567567d3845c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedGradedCalculus.lean @@ -0,0 +1,760 @@ +import OAI.Combinatorics.Progressions.Linear.DualLogarithmicDifferential +import OAI.Combinatorics.Progressions.Nilpotent.RealizedDualBCH +import OAI.Combinatorics.Progressions.Polynomial.ShiftedGradedPolynomial + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (w : σ → ℕ) + +abbrev FilteredFirstJet := F.adaptedLieSubalgebra w ⧸ F.shiftedPolynomialIdeal w 2 + +noncomputable def filteredFirstJetMap : F.adaptedLieSubalgebra w →ₗ⁅ℚ⁆ F.FilteredFirstJet w := + lieQuotientMap (F.shiftedPolynomialIdeal w 2) + +theorem filteredFirstJetMap_surjective : Function.Surjective (F.filteredFirstJetMap w) := + lieQuotientMap_surjective _ + +theorem filteredFirstJetMap_eq_zero_iff (p : F.adaptedLieSubalgebra w) : + F.filteredFirstJetMap w p = 0 ↔ ∀ α, coefficients p.val α ∈ F.layer (Finsupp.weight w α + 2) := + lieQuotientMap_eq_zero _ p + +theorem filteredFirstJetMap_eq_iff (p q : F.adaptedLieSubalgebra w) : + F.filteredFirstJetMap w p = F.filteredFirstJetMap w q ↔ + ∀ α, coefficients (p.val - q.val) α ∈ F.layer (Finsupp.weight w α + 2) := by + rw [← sub_eq_zero, ← map_sub, F.filteredFirstJetMap_eq_zero_iff] + rfl + +noncomputable def filteredFirstJetSymbol : F.FilteredFirstJet w →ₗ⁅ℚ⁆ F.PolynomialSymbol w := + { toLinearMap := (F.shiftedPolynomialIdeal w 2).toSubmodule.liftQ + (F.polynomialSymbolMap w).toLinearMap (by + intro p hp + apply (F.polynomialSymbolMap_eq_zero_iff w p).mpr + exact F.shiftedAdaptedSubmodule_antitone w (by decide : 1 ≤ 2) hp) + map_lie' {x y} := by + obtain ⟨p, rfl⟩ := F.filteredFirstJetMap_surjective w x + obtain ⟨q, rfl⟩ := F.filteredFirstJetMap_surjective w y + change F.polynomialSymbolMap w ⁅p, q⁆ = ⁅F.polynomialSymbolMap w p, F.polynomialSymbolMap w q⁆ + exact (F.polynomialSymbolMap w).map_lie p q } + +@[simp] theorem filteredFirstJetSymbol_map (p : F.adaptedLieSubalgebra w) : + F.filteredFirstJetSymbol w (F.filteredFirstJetMap w p) = F.polynomialSymbolMap w p := rfl + +theorem filteredFirstJetSymbol_surjective : Function.Surjective (F.filteredFirstJetSymbol w) := by + intro x + obtain ⟨p, rfl⟩ := F.polynomialSymbolMap_surjective w x + exact ⟨F.filteredFirstJetMap w p, rfl⟩ + +theorem filteredFirstJet_kernel_lie_eq_zero {x y : F.FilteredFirstJet w} + (hx : F.filteredFirstJetSymbol w x = 0) (hy : F.filteredFirstJetSymbol w y = 0) : ⁅x, y⁆ = 0 := by + obtain ⟨p, rfl⟩ := F.filteredFirstJetMap_surjective w x + obtain ⟨q, rfl⟩ := F.filteredFirstJetMap_surjective w y + change F.polynomialSymbolMap w p = 0 at hx + change F.polynomialSymbolMap w q = 0 at hy + have hp : p ∈ F.shiftedPolynomialIdeal w 1 := + (F.polynomialSymbolMap_eq_zero_iff w p).mp hx + have hq : q ∈ F.shiftedPolynomialIdeal w 1 := + (F.polynomialSymbolMap_eq_zero_iff w q).mp hy + have hpq : ⁅p, q⁆ ∈ F.shiftedPolynomialIdeal w 2 := + F.shiftedPolynomialIdeal_lie_mem w (i := 1) (j := 1) hp hq + exact ((F.filteredFirstJetMap w).map_lie p q).symm.trans + ((lieQuotientMap_eq_zero (F.shiftedPolynomialIdeal w 2) ⁅p, q⁆).mpr hpq) + +theorem filteredFirstJet_lowerCentralSeries_eq_bot : + LieModule.lowerCentralSeries ℚ (F.FilteredFirstJet w) (F.FilteredFirstJet w) s = ⊥ := + lie_quotient_lowerCentralSeries_eq_bot (F.adaptedPolynomialFiltration w).lowerCentralSeries_eq_bot _ + +abbrev FilteredFirstJetGroup := + NilpotentLieBCHGroup (F.FilteredFirstJet w) s (F.filteredFirstJet_lowerCentralSeries_eq_bot w) + +noncomputable def filteredFirstJetHom : (F.adaptedPolynomialFiltration w).Group →* F.FilteredFirstJetGroup w := + NilpotentLieBCHGroup.map (F.filteredFirstJetMap w) + +noncomputable def filteredFirstJetSymbolHom : F.FilteredFirstJetGroup w →* F.PolynomialSymbolGroup w := + NilpotentLieBCHGroup.map (F.filteredFirstJetSymbol w) + +theorem filteredFirstJet_kernel_mul (x y : F.FilteredFirstJetGroup w) + (hx : F.filteredFirstJetSymbolHom w x = 1) (hy : F.filteredFirstJetSymbolHom w y = 1) : + (x * y).coord = x.coord + y.coord := + lieBCH_eq_add_of_lie_eq_zero (F.filteredFirstJet_lowerCentralSeries_eq_bot w) + (F.filteredFirstJet_kernel_lie_eq_zero w (congrArg NilpotentLieBCHGroup.coord hx) + (congrArg NilpotentLieBCHGroup.coord hy)) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieBCHGroup + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + +theorem common_derivative_identity (A B D : NilpotentLieBCHGroup L s hnil) + (YA YB YD YX e m u Z v : L) + (hprod : YX = YA + dualAdjoint A YB + dualAdjoint (A * B) YD) + (hsquare : YX - e - dualAdjoint (A * B * D) m = + u + dualAdjoint A Z + dualAdjoint (A * B) v) : + YB = dualAdjoint A⁻¹ (e + u - YA) + + dualAdjoint B (v + dualAdjoint D m - YD) + Z := by + apply dualAdjoint_injective A + simp only [dualAdjoint_add, dualAdjoint_sub, ← dualAdjoint_mul, mul_inv_cancel, + dualAdjoint_one, ← mul_assoc] + calc + dualAdjoint A YB = + (YX - e - dualAdjoint (A * B * D) m) - YA - dualAdjoint (A * B) YD + + e + dualAdjoint (A * B * D) m := by rw [hprod]; abel + _ = (u + dualAdjoint A Z + dualAdjoint (A * B) v) - YA - + dualAdjoint (A * B) YD + e + dualAdjoint (A * B * D) m := by rw [hsquare] + _ = _ := by abel + +theorem common_derivative_mod_submodule (V : Submodule ℚ L) + (A B D : NilpotentLieBCHGroup L s hnil) (YA YB YD YX e m u Z v ZB : L) + (hprod : YX = YA + dualAdjoint A YB + dualAdjoint (A * B) YD) + (hsquare : YX - e - dualAdjoint (A * B * D) m = + u + dualAdjoint A Z + dualAdjoint (A * B) v) + (hZ : Z - ZB ∈ V) : + YB - (dualAdjoint A⁻¹ (e + u - YA) + + dualAdjoint B (v + dualAdjoint D m - YD) + ZB) ∈ V := by + rw [common_derivative_identity A B D YA YB YD YX e m u Z v hprod hsquare] + convert hZ using 1; abel + +theorem common_derivative_difference (V : Submodule ℚ L) + (B : NilpotentLieBCHGroup L s hnil) (Y Y₀ S S₀ R R₀ ZB : L) + (hY : Y - (S + dualAdjoint B R + ZB) ∈ V) + (hY₀ : Y₀ - (S₀ + dualAdjoint B R₀ + ZB) ∈ V) : + (Y - Y₀) - ((S - S₀) + dualAdjoint B (R - R₀)) ∈ V := by + have hd := V.sub_mem hY hY₀ + rw [dualAdjoint_sub] + convert hd using 1; abel + +end Erdos3.NilpotentLieBCHGroup + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +namespace VectorPolynomial + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] + +theorem coefficients_pderiv (i : σ) (p : VectorPolynomial σ ℚ L) (α : σ →₀ ℕ) : + coefficients ((MvPolynomial.pderiv i).toLinearMap.rTensor L p) α = + (α i + 1 : ℚ) • coefficients p (α + Finsupp.single i 1) := by + induction p using TensorProduct.inductionOn with + | tmul q x => + rw [LinearMap.rTensor_tmul] + rw [coefficients_tmul, coefficients_tmul] + change (MvPolynomial.pderiv i q).coeff α • x = + (α i + 1 : ℚ) • (q.coeff (α + Finsupp.single i 1) • x) + rw [MvPolynomial.coeff_pderiv, smul_smul] + congr 1 + ring + | add p q hp hq => simp only [map_add, Finsupp.add_apply, hp, hq, smul_add] + +theorem coefficients_directionalDerivative [Fintype σ] + (h : σ → ℚ) (p : VectorPolynomial σ ℚ L) (α : σ →₀ ℕ) : + coefficients (directionalDerivative h p) α = + ∑ i, h i • ((α i + 1 : ℚ) • coefficients p (α + Finsupp.single i 1)) := by + simp only [directionalDerivative, LinearMap.sum_apply, LinearMap.smul_apply, map_sum, + Finsupp.finsetSum_apply, map_smul, Finsupp.smul_apply, coefficients_pderiv] + +end VectorPolynomial + +namespace NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem directionalDerivative_mem_shifted [Fintype σ] (h : σ → ℚ) (k : ℕ) + {p : VectorPolynomial σ ℚ L} (hp : p ∈ F.shiftedAdaptedSubmodule (fun _ => 1) k) : + directionalDerivative h p ∈ F.shiftedAdaptedSubmodule (fun _ => 1) (k + 1) := by + intro α + rw [coefficients_directionalDerivative] + apply Submodule.sum_mem + intro i _ + apply Submodule.smul_mem + apply Submodule.smul_mem + have hi := hp (α + Finsupp.single i 1) + simpa only [map_add, Finsupp.weight_single, one_smul, Nat.add_right_comm, Nat.add_assoc] using hi + +theorem directionalDerivative_mem_next [Fintype σ] (h : σ → ℚ) + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + directionalDerivative h p.val ∈ F.shiftedAdaptedSubmodule (fun _ => 1) 1 := by + apply F.directionalDerivative_mem_shifted h 0 + intro α + simpa only [Nat.add_zero] using p.property α + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieBCHGroup + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + +theorem common_derivative_defect (A B D : NilpotentLieBCHGroup L s hnil) + (YA YB YD YX e m u Z v : L) + (hprod : YX = YA + dualAdjoint A YB + dualAdjoint (A * B) YD) : + YB - (dualAdjoint A⁻¹ (e + u - YA) + + dualAdjoint B (v + dualAdjoint D m - YD) + Z) = + dualAdjoint A⁻¹ (YX - e - dualAdjoint (A * B * D) m - + (u + dualAdjoint A Z + dualAdjoint (A * B) v)) := by + apply dualAdjoint_injective A + simp only [dualAdjoint_add, dualAdjoint_sub, ← dualAdjoint_mul, mul_inv_cancel, + dualAdjoint_one, ← mul_assoc, one_mul, hprod] + abel + +theorem common_derivative_mod_of_defect (V W : Submodule ℚ L) + (A B D : NilpotentLieBCHGroup L s hnil) (YA YB YD YX e m u Z v ZB : L) + (hprod : YX = YA + dualAdjoint A YB + dualAdjoint (A * B) YD) + (hdefect : YX - e - dualAdjoint (A * B * D) m - + (u + dualAdjoint A Z + dualAdjoint (A * B) v) ∈ W) + (htransport : ∀ x ∈ W, dualAdjoint A⁻¹ x ∈ V) (hZ : Z - ZB ∈ V) : + YB - (dualAdjoint A⁻¹ (e + u - YA) + + dualAdjoint B (v + dualAdjoint D m - YD) + ZB) ∈ V := by + have hd := htransport _ hdefect + rw [← common_derivative_defect A B D YA YB YD YX e m u Z v hprod] at hd + convert V.add_mem hd hZ using 1; abel + +end Erdos3.NilpotentLieBCHGroup + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +namespace VectorPolynomial + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + +noncomputable def taylorRemainder (h : σ → ℚ) : + VectorPolynomial σ ℚ L →ₗ[ℚ] VectorPolynomial σ ℚ L := + (scalarTaylorRemainder h).rTensor L + +theorem taylorRemainder_apply (h : σ → ℚ) (p : VectorPolynomial σ ℚ L) : + taylorRemainder h p = translate h p - p - directionalDerivative h p := by + induction p using TensorProduct.inductionOn with + | tmul q x => + change scalarTaylorRemainder h q ⊗ₜ[ℚ] x = _ + rw [scalarTaylorRemainder_apply, TensorProduct.sub_tmul, TensorProduct.sub_tmul, + translate_tmul, directionalDerivative_tmul, scalarDirectionalDerivative_apply, TensorProduct.sum_tmul] + simp only [TensorProduct.smul_tmul, TensorProduct.tmul_smul] + | add p q hp hq => + simp only [map_add, hp, hq] + abel + +theorem coefficients_taylorRemainder_monomial (h : σ → ℚ) (α β : σ →₀ ℕ) (x : L) : + coefficients (taylorRemainder h (monomial α x)) β = + (scalarTaylorRemainder h (MvPolynomial.monomial α 1)).coeff β • x := by + change coefficients (scalarTaylorRemainder h (MvPolynomial.monomial α 1) ⊗ₜ[ℚ] x) β = _ + exact coefficients_tmul _ _ _ + +theorem coefficients_taylorRemainder (h : σ → ℚ) (p : VectorPolynomial σ ℚ L) (α : σ →₀ ℕ) : + coefficients (taylorRemainder h p) α = ∑ β ∈ (coefficients p).support, + (scalarTaylorRemainder h (MvPolynomial.monomial β 1)).coeff α • coefficients p β := by + conv_lhs => rw [← sum_monomial_coefficients p] + simp only [Finsupp.sum, map_sum, Finsupp.finsetSum_apply, coefficients_taylorRemainder_monomial] + +end VectorPolynomial + +namespace NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem taylorRemainder_mem_shifted (h : σ → ℚ) (k : ℕ) {p : VectorPolynomial σ ℚ L} + (hp : p ∈ F.shiftedAdaptedSubmodule (fun _ => 1) k) : + translate h p - p - directionalDerivative h p ∈ F.shiftedAdaptedSubmodule (fun _ => 1) (k + 2) := by + rw [← taylorRemainder_apply] + intro α + rw [coefficients_taylorRemainder] + apply Submodule.sum_mem + intro β _ + by_cases hc : (scalarTaylorRemainder h (MvPolynomial.monomial β 1)).coeff α = 0 + · rw [hc, zero_smul] + exact Submodule.zero_mem _ + · apply Submodule.smul_mem + apply F.antitone _ (hp β) + have hd := scalarTaylorRemainder_monomial h β (MvPolynomial.mem_support_iff.mpr hc) + change Finsupp.weight (fun _ : σ => 1) α + 2 ≤ Finsupp.weight (fun _ : σ => 1) β at hd + omega + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (h : σ → ℚ) + +noncomputable def adaptedDirectionalDerivative : + F.adaptedLieSubalgebra (fun _ : σ => 1) →ₗ[ℚ] F.adaptedLieSubalgebra (fun _ : σ => 1) := + ((directionalDerivative h).comp (F.adaptedLieSubalgebra (fun _ => 1)).incl.toLinearMap).codRestrict + (F.adaptedLieSubalgebra (fun _ => 1)).toSubmodule (by + intro p α + exact F.antitone (Nat.le_succ _) (F.directionalDerivative_mem_next h p α)) + +@[simp] theorem adaptedDirectionalDerivative_coe (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + (F.adaptedDirectionalDerivative h p : VectorPolynomial σ ℚ L) = directionalDerivative h p.val := rfl + +theorem adaptedDirectionalDerivative_mem_shifted (k : ℕ) + {p : F.adaptedLieSubalgebra (fun _ : σ => 1)} + (hp : p ∈ F.shiftedPolynomialIdeal (fun _ => 1) k) : + F.adaptedDirectionalDerivative h p ∈ F.shiftedPolynomialIdeal (fun _ => 1) (k + 1) := + F.directionalDerivative_mem_shifted h k hp + +noncomputable def symbolFirstDerivative : + F.PolynomialSymbol (fun _ : σ => 1) →ₗ[ℚ] F.FilteredFirstJet (fun _ : σ => 1) := + (F.shiftedAdaptedIdeal (fun _ => 1)).toSubmodule.liftQ + ((F.filteredFirstJetMap (fun _ => 1)).toLinearMap.comp (F.adaptedDirectionalDerivative h)) (by + intro p hp + exact (F.filteredFirstJetMap_eq_zero_iff (fun _ => 1) _).mpr + (F.adaptedDirectionalDerivative_mem_shifted h 1 hp)) + +@[simp] theorem symbolFirstDerivative_map (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + F.symbolFirstDerivative h (F.polynomialSymbolMap (fun _ => 1) p) = + F.filteredFirstJetMap (fun _ => 1) (F.adaptedDirectionalDerivative h p) := rfl + +theorem symbolFirstDerivative_in_kernel (x : F.PolynomialSymbol (fun _ : σ => 1)) : + F.filteredFirstJetSymbol (fun _ => 1) (F.symbolFirstDerivative h x) = 0 := by + obtain ⟨p, rfl⟩ := F.polynomialSymbolMap_surjective (fun _ => 1) x + rw [F.symbolFirstDerivative_map, F.filteredFirstJetSymbol_map] + exact (F.polynomialSymbolMap_eq_zero_iff (fun _ => 1) _).mpr + (F.directionalDerivative_mem_next h p) + +theorem filteredFirstJet_translate (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + F.filteredFirstJetMap (fun _ => 1) + ⟨translate h p.val, (F.mem_adaptedSubmodule (fun _ => 1) _).mpr + (F.adapted_translate (fun _ => 1) (by simp) h + ((F.mem_adaptedSubmodule (fun _ => 1) _).mp p.property))⟩ = + F.filteredFirstJetMap (fun _ => 1) p + + F.symbolFirstDerivative h (F.polynomialSymbolMap (fun _ => 1) p) := by + rw [F.symbolFirstDerivative_map, ← map_add] + apply (F.filteredFirstJetMap_eq_iff (fun _ => 1) _ _).mpr + have hp : p.val ∈ F.shiftedAdaptedSubmodule (fun _ => 1) 0 := by + intro α + simpa only [Nat.add_zero] using p.property α + have hr := F.taylorRemainder_mem_shifted h 0 hp + change ∀ α, coefficients (translate h p.val - (p.val + directionalDerivative h p.val)) α ∈ _ + rw [show translate h p.val - (p.val + directionalDerivative h p.val) = + translate h p.val - p.val - directionalDerivative h p.val by abel] + exact hr + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem filteredFirstJet_constant_eq (w : σ → ℕ) {a b : L} (hab : a - b ∈ F.layer 2) : + F.filteredFirstJetMap w (F.adaptedConstant w a) = F.filteredFirstJetMap w (F.adaptedConstant w b) := by + change F.filteredFirstJetMap w (F.adaptedConstantLieHom w a) = + F.filteredFirstJetMap w (F.adaptedConstantLieHom w b) + rw [← sub_eq_zero, ← map_sub, ← map_sub] + apply (F.filteredFirstJetMap_eq_zero_iff w _).mpr + exact F.adaptedConstant_mem_shiftedPolynomialIdeal w 2 hab + +theorem filteredFirstJet_normalizedShift [Fintype σ] (h : σ → ℚ) (a b : L) + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + F.filteredFirstJetMap (fun _ => 1) + ⟨normalizedShiftLog s h a b p.val, + (F.mem_adaptedSubmodule (fun _ => 1) _).mpr + (F.normalizedShiftLog_adapted (fun _ => 1) (by simp) h a b + ((F.mem_adaptedSubmodule (fun _ => 1) _).mp p.property))⟩ = + lieBCH s (F.filteredFirstJetMap (fun _ => 1) (F.adaptedConstant (fun _ => 1) a)) + (lieBCH s (F.filteredFirstJetMap (fun _ => 1) p + + F.symbolFirstDerivative h (F.polynomialSymbolMap (fun _ => 1) p)) + (F.filteredFirstJetMap (fun _ => 1) (F.adaptedConstant (fun _ => 1) b))) := by + let q : F.adaptedLieSubalgebra (fun _ : σ => 1) := + ⟨translate h p.val, (F.mem_adaptedSubmodule (fun _ => 1) _).mpr + (F.adapted_translate (fun _ => 1) (by simp) h + ((F.mem_adaptedSubmodule (fun _ => 1) _).mp p.property))⟩ + have he : (⟨normalizedShiftLog s h a b p.val, + (F.mem_adaptedSubmodule (fun _ => 1) _).mpr + (F.normalizedShiftLog_adapted (fun _ => 1) (by simp) h a b + ((F.mem_adaptedSubmodule (fun _ => 1) _).mp p.property))⟩ : + F.adaptedLieSubalgebra (fun _ : σ => 1)) = + lieBCH s (F.adaptedConstant (fun _ => 1) a) + (lieBCH s q (F.adaptedConstant (fun _ => 1) b)) := by + apply Subtype.ext + change normalizedShiftLog s h a b p.val = + (F.adaptedLieSubalgebra (fun _ : σ => 1)).incl + (lieBCH s (F.adaptedConstant (fun _ => 1) a) (lieBCH s q (F.adaptedConstant (fun _ => 1) b))) + rw [map_lieBCH, map_lieBCH] + rfl + rw [he, map_lieBCH, map_lieBCH] + have ht : F.filteredFirstJetMap (fun _ => 1) q = F.filteredFirstJetMap (fun _ => 1) p + + F.symbolFirstDerivative h (F.polynomialSymbolMap (fun _ => 1) p) := F.filteredFirstJet_translate h p + rw [ht] + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial NilpotentLieBCHGroup + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (h : σ → ℚ) + +noncomputable def adaptedPolynomialJet (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + DualGroup (F.adaptedPolynomialFiltration (fun _ : σ => 1)).lowerCentralSeries_eq_bot := + ⟨dualConstantLie p + dualInfinitesimal (F.adaptedDirectionalDerivative h p)⟩ + +@[simp] theorem adaptedPolynomialJet_base (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + dualBaseLinear (F.adaptedPolynomialJet h p).coord = p := by + change dualBaseLinear (dualConstantLie p + dualInfinitesimal (F.adaptedDirectionalDerivative h p)) = p + rw [map_add, dualBaseLinear_constant, dualBaseLinear_infinitesimal, add_zero] + +@[simp] theorem adaptedPolynomialJet_tangent (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + dualTangentLinear (F.adaptedPolynomialJet h p).coord = F.adaptedDirectionalDerivative h p := by + change dualTangentLinear (dualConstantLie p + dualInfinitesimal (F.adaptedDirectionalDerivative h p)) = _ + rw [map_add, dualTangentLinear_constant, dualTangentLinear_infinitesimal, zero_add] + +@[simp] theorem adaptedPolynomialJet_baseHom (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + dualBaseHom (F.adaptedPolynomialJet h p) = + (⟨p⟩ : (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) := by + apply NilpotentLieBCHGroup.ext + exact F.adaptedPolynomialJet_base h p + +noncomputable def normalizedShiftAdapted (a b : L) + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : F.adaptedLieSubalgebra (fun _ : σ => 1) := + ⟨normalizedShiftLog s h a b p.val, (F.mem_adaptedSubmodule (fun _ => 1) _).mpr + (F.normalizedShiftLog_adapted (fun _ => 1) (by simp) h a b + ((F.mem_adaptedSubmodule (fun _ => 1) _).mp p.property))⟩ + +noncomputable def normalizedRelativeLog (e m : L) + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : F.adaptedLieSubalgebra (fun _ : σ => 1) := + lieBCH s (F.normalizedShiftAdapted h (-e) (-m) p) (-p) + +noncomputable def adaptedLogDerivative (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + F.adaptedLieSubalgebra (fun _ : σ => 1) := dualLogDerivative (F.adaptedPolynomialJet h p) + +theorem filteredFirstJet_normalizedRelativeLog (e m : L) + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + F.filteredFirstJetMap (fun _ => 1) (F.normalizedRelativeLog h e m p) = + F.filteredFirstJetMap (fun _ => 1) + (F.adaptedLogDerivative h p - F.adaptedConstant (fun _ => 1) e - + dualAdjoint (⟨p⟩ : (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) + (F.adaptedConstant (fun _ => 1) m)) := by + have hbracket : ∀ x ∈ F.shiftedPolynomialIdeal (fun _ : σ => 1) 1, + ∀ y ∈ F.shiftedPolynomialIdeal (fun _ : σ => 1) 1, + ⁅x, y⁆ ∈ F.shiftedPolynomialIdeal (fun _ : σ => 1) 2 := by + intro x hx y hy + exact F.shiftedPolynomialIdeal_lie_mem (fun _ => 1) (i := 1) (j := 1) hx hy + have hz : dualTangentLinear (F.adaptedPolynomialJet h p).coord ∈ + F.shiftedPolynomialIdeal (fun _ : σ => 1) 1 := by + rw [F.adaptedPolynomialJet_tangent] + exact F.directionalDerivative_mem_next h p + have hid := dualBCH_insertion_quotient + (F.shiftedPolynomialIdeal (fun _ : σ => 1) 1) (F.shiftedPolynomialIdeal (fun _ : σ => 1) 2) + hbracket (F.adaptedPolynomialJet h p) + (F.adaptedConstant (fun _ => 1) e) (F.adaptedConstant (fun _ => 1) m) hz + (F.adaptedConstant_mem_shiftedIdeal (fun _ => 1) e) + (F.adaptedConstant_mem_shiftedIdeal (fun _ => 1) m) + rw [F.adaptedPolynomialJet_base, F.adaptedPolynomialJet_tangent, + F.adaptedPolynomialJet_baseHom] at hid + change F.filteredFirstJetMap (fun _ => 1) + (lieBCH s (F.normalizedShiftAdapted h (-e) (-m) p) (-p)) = _ + rw [map_lieBCH, map_neg] + have hn := F.filteredFirstJet_normalizedShift h (-e) (-m) p + change F.filteredFirstJetMap (fun _ => 1) (F.normalizedShiftAdapted h (-e) (-m) p) = _ at hn + rw [hn, F.symbolFirstDerivative_map] + have hc (a : L) : F.adaptedConstant (fun _ : σ => 1) (-a) = + -F.adaptedConstant (fun _ : σ => 1) a := (F.adaptedConstantLieHom (fun _ => 1)).map_neg a + rw [hc e, hc m, map_neg, map_neg, + ← lieBCH_assoc (F.filteredFirstJet_lowerCentralSeries_eq_bot (fun _ : σ => 1))] + rw [map_add] at hid + exact hid + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial NilpotentLieBCHGroup + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (h : σ → ℚ) + +theorem adaptedDirectionalDerivative_lie (p q : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + F.adaptedDirectionalDerivative h ⁅p, q⁆ = + ⁅F.adaptedDirectionalDerivative h p, q⁆ + ⁅p, F.adaptedDirectionalDerivative h q⁆ := by + apply Subtype.ext + exact directionalDerivative_lie h p.val q.val + +noncomputable def adaptedPolynomialJetLie : + F.adaptedLieSubalgebra (fun _ : σ => 1) →ₗ⁅ℚ⁆ + DualLieAlgebra (F.adaptedLieSubalgebra (fun _ : σ => 1)) where + toLinearMap := dualConstantLie.toLinearMap + + dualInfinitesimal.comp (F.adaptedDirectionalDerivative h) + map_lie' {p q} := by + change dualConstantLie ⁅p, q⁆ + dualInfinitesimal (F.adaptedDirectionalDerivative h ⁅p, q⁆) = + ⁅dualConstantLie p + dualInfinitesimal (F.adaptedDirectionalDerivative h p), + dualConstantLie q + dualInfinitesimal (F.adaptedDirectionalDerivative h q)⁆ + apply dual_ext + · simp only [map_add, dualBaseLinear_constant, + dualBaseLinear_infinitesimal, add_zero, dualBaseLinear_lie] + · simp only [map_add, dualTangentLinear_constant, + dualTangentLinear_infinitesimal, zero_add, dualTangentLinear_lie, + dualBaseLinear_constant, dualBaseLinear_infinitesimal, add_zero] + rw [F.adaptedDirectionalDerivative_lie] + exact add_comm _ _ + +noncomputable def adaptedPolynomialJetHom : + (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group →* + DualGroup (F.adaptedPolynomialFiltration (fun _ : σ => 1)).lowerCentralSeries_eq_bot := + NilpotentLieBCHGroup.map (F.adaptedPolynomialJetLie h) + +@[simp] theorem adaptedPolynomialJetHom_apply + (P : (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) : + F.adaptedPolynomialJetHom h P = F.adaptedPolynomialJet h P.coord := rfl + +theorem adaptedLogDerivative_mul + (P Q : (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) : + F.adaptedLogDerivative h (P * Q).coord = + F.adaptedLogDerivative h P.coord + dualAdjoint P (F.adaptedLogDerivative h Q.coord) := by + change dualLogDerivative (F.adaptedPolynomialJetHom h (P * Q)) = _ + rw [map_mul, dualLogDerivative_mul, F.adaptedPolynomialJetHom_apply, + F.adaptedPolynomialJet_baseHom] + rfl + +theorem adaptedLogDerivative_triple + (A B D : (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) : + F.adaptedLogDerivative h (A * B * D).coord = + F.adaptedLogDerivative h A.coord + dualAdjoint A (F.adaptedLogDerivative h B.coord) + + dualAdjoint (A * B) (F.adaptedLogDerivative h D.coord) := by + rw [F.adaptedLogDerivative_mul, F.adaptedLogDerivative_mul] + +theorem adapted_common_derivative_identity + (A B D : (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) + (e m u Z v : F.adaptedLieSubalgebra (fun _ : σ => 1)) + (hsquare : F.adaptedLogDerivative h (A * B * D).coord - e - dualAdjoint (A * B * D) m = + u + dualAdjoint A Z + dualAdjoint (A * B) v) : + F.adaptedLogDerivative h B.coord = + dualAdjoint A⁻¹ (e + u - F.adaptedLogDerivative h A.coord) + + dualAdjoint B (v + dualAdjoint D m - F.adaptedLogDerivative h D.coord) + Z := + common_derivative_identity A B D _ _ _ _ e m u Z v + (F.adaptedLogDerivative_triple h A B D) hsquare + +theorem adapted_common_derivative_mod_submodule + (V : Submodule ℚ (F.adaptedLieSubalgebra (fun _ : σ => 1))) + (A B D : (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) + (e m u Z v ZB : F.adaptedLieSubalgebra (fun _ : σ => 1)) + (hsquare : F.adaptedLogDerivative h (A * B * D).coord - e - dualAdjoint (A * B * D) m = + u + dualAdjoint A Z + dualAdjoint (A * B) v) (hZ : Z - ZB ∈ V) : + F.adaptedLogDerivative h B.coord - + (dualAdjoint A⁻¹ (e + u - F.adaptedLogDerivative h A.coord) + + dualAdjoint B (v + dualAdjoint D m - F.adaptedLogDerivative h D.coord) + ZB) ∈ V := + common_derivative_mod_submodule V A B D _ _ _ _ e m u Z v ZB + (F.adaptedLogDerivative_triple h A B D) hsquare hZ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieBCHGroup + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + +theorem dualLogDerivative_tangent (x : L) : + dualLogDerivative (hnil := hnil) (dualTangentElement x) = x := by + simpa only [map_one, mul_one] using + dualLogDerivative_tangent_mul_constant x (1 : NilpotentLieBCHGroup L s hnil) + +end Erdos3.NilpotentLieBCHGroup + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial NilpotentLieBCHGroup + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem adaptedLogDerivative_constant (h : σ → ℚ) + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) + (hp : coefficients p.val 0 = 0) : + coefficients (F.adaptedLogDerivative h p).val 0 = + coefficients (directionalDerivative h p.val) 0 := by + let φ : F.adaptedLieSubalgebra (fun _ : σ => 1) →ₗ⁅ℚ⁆ L := + (evalLie (0 : σ → ℚ)).comp (F.adaptedLieSubalgebra (fun _ => 1)).incl + have hφ (q : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + φ q = coefficients q.val 0 := eval_zero_eq_coefficient q.val + have hjet : dualLinearLift φ φ.toLinearMap (F.adaptedPolynomialJet h p).coord = + (dualTangentElement (hnil := F.lowerCentralSeries_eq_bot) + (φ (F.adaptedDirectionalDerivative h p))).coord := by + rw [dualLinearLift_apply, F.adaptedPolynomialJet_base, F.adaptedPolynomialJet_tangent] + change dualConstantLie (φ p) + dualInfinitesimal (φ (F.adaptedDirectionalDerivative h p)) = _ + rw [hφ p, hp, map_zero, zero_add] + rfl + have he := dualLinearLift_logDerivative_eq F.lowerCentralSeries_eq_bot + (⊤ : LieIdeal ℚ (F.adaptedLieSubalgebra (fun _ : σ => 1))) φ φ.toLinearMap + (fun x y _ => φ.map_lie x y) (F.adaptedPolynomialJet h p) (by trivial) + (dualTangentElement (φ (F.adaptedDirectionalDerivative h p))) hjet + rw [dualLogDerivative_tangent] at he + change φ (F.adaptedLogDerivative h p) = φ (F.adaptedDirectionalDerivative h p) at he + simpa only [hφ, F.adaptedDirectionalDerivative_coe] using he + +theorem adaptedLogDerivative_constant_unit [DecidableEq σ] (i : σ) + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) + (hp : coefficients p.val 0 = 0) : + coefficients (F.adaptedLogDerivative (Pi.single i 1) p).val 0 = + coefficients p.val (Finsupp.single i 1) := by + classical + rw [F.adaptedLogDerivative_constant _ p hp, coefficients_directionalDerivative] + simp [Pi.single_apply] + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial NilpotentLieBCHGroup + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +noncomputable def adaptedDirectionalTangent + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + (σ → ℚ) →ₗ[ℚ] F.adaptedLieSubalgebra (fun _ : σ => 1) where + toFun h := F.adaptedDirectionalDerivative h p + map_add' h k := Subtype.ext (directionalDerivative_direction_add h k p.val) + map_smul' r h := Subtype.ext (directionalDerivative_direction_smul r h p.val) + +noncomputable def adaptedLogDerivativeLinear + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + (σ → ℚ) →ₗ[ℚ] F.adaptedLieSubalgebra (fun _ : σ => 1) := + (dualLogarithmicDifferential + (hnil := (F.adaptedPolynomialFiltration (fun _ : σ => 1)).lowerCentralSeries_eq_bot) p).comp + (F.adaptedDirectionalTangent p) + +@[simp] theorem adaptedLogDerivativeLinear_apply + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) (h : σ → ℚ) : + F.adaptedLogDerivativeLinear p h = F.adaptedLogDerivative h p := rfl + +theorem adaptedLogDerivative_direction_sub + (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) (h k : σ → ℚ) : + F.adaptedLogDerivative (h - k) p = F.adaptedLogDerivative h p - F.adaptedLogDerivative k p := + (F.adaptedLogDerivativeLinear p).map_sub h k + +theorem adapted_common_derivative_difference + (V : Submodule ℚ (F.adaptedLieSubalgebra (fun _ : σ => 1))) + (B : (F.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) + (h h₀ : σ → ℚ) (S S₀ R R₀ ZB : F.adaptedLieSubalgebra (fun _ : σ => 1)) + (hh : F.adaptedLogDerivative h B.coord - (S + dualAdjoint B R + ZB) ∈ V) + (hh₀ : F.adaptedLogDerivative h₀ B.coord - (S₀ + dualAdjoint B R₀ + ZB) ∈ V) : + F.adaptedLogDerivative (h - h₀) B.coord - + ((S - S₀) + dualAdjoint B (R - R₀)) ∈ V := by + rw [F.adaptedLogDerivative_direction_sub] + exact common_derivative_difference V B _ _ S S₀ R R₀ ZB hh hh₀ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem gradedPieceProjection_lie {i j : ℕ} {u v : L} + (hu : u ∈ F.layer i) (hv : v ∈ F.layer j) : + F.gradedPieceProjection b ω hlayers (i + j) ⁅u, v⁆ = + ⁅F.gradedPieceProjection b ω hlayers i u, F.gradedPieceProjection b ω hlayers j v⁆ := by + have hi := F.gradedPieceProjection_eq_pieceMap b ω hlayers i ⟨u, hu⟩ + have hj := F.gradedPieceProjection_eq_pieceMap b ω hlayers j ⟨v, hv⟩ + have hij := F.gradedPieceProjection_eq_pieceMap b ω hlayers (i + j) ⟨⁅u, v⁆, F.lie_mem hu hv⟩ + change F.gradedPieceProjection b ω hlayers i u = _ at hi + change F.gradedPieceProjection b ω hlayers j v = _ at hj + change F.gradedPieceProjection b ω hlayers (i + j) ⁅u, v⁆ = _ at hij + rw [hi, hj, hij, F.associatedGradedPieceMap_lie] + +theorem shiftedGradedPolynomial_lie (w : σ → ℕ) {i j : ℕ} {p q : VectorPolynomial σ ℚ L} + (hp : p ∈ F.shiftedAdaptedSubmodule w i) (hq : q ∈ F.shiftedAdaptedSubmodule w j) : + F.shiftedGradedPolynomial b ω hlayers w (i + j) ⁅p, q⁆ = + ⁅F.shiftedGradedPolynomial b ω hlayers w i p, F.shiftedGradedPolynomial b ω hlayers w j q⁆ := by + classical + rw [← sum_monomial_coefficients p, ← sum_monomial_coefficients q] + simp only [Finsupp.sum, sum_lie_sum, map_sum, lie_monomial, F.shiftedGradedPolynomial_monomial] + apply Finset.sum_congr rfl + intro α _ + apply Finset.sum_congr rfl + intro β _ + have hdeg : Finsupp.weight w (α + β) + (i + j) = + (Finsupp.weight w α + i) + (Finsupp.weight w β + j) := by + rw [map_add] + omega + rw [hdeg, F.gradedPieceProjection_lie b ω hlayers (hp α) (hq β)] + +theorem shiftedGradedPolynomial_directionalDerivative [Fintype σ] (h : σ → ℚ) + (k : ℕ) (p : VectorPolynomial σ ℚ L) : + F.shiftedGradedPolynomial b ω hlayers (fun _ : σ => 1) (k + 1) (directionalDerivative h p) = + directionalDerivative h (F.shiftedGradedPolynomial b ω hlayers (fun _ : σ => 1) k p) := by + apply coefficients.injective + apply Finsupp.ext + intro α + rw [F.shiftedGradedPolynomial_coefficient, coefficients_directionalDerivative, + coefficients_directionalDerivative, map_sum] + apply Finset.sum_congr rfl + intro i _ + rw [map_smul, map_smul, F.shiftedGradedPolynomial_coefficient] + simp only [map_add, Finsupp.weight_single, one_smul, Nat.add_right_comm, Nat.add_assoc] + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedProductTestError.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedProductTestError.lean new file mode 100644 index 0000000000000000000000000000000000000000..3acb27a7f1f4d29b5555ee4bbdbb1f5c0cbc4d87 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedProductTestError.lean @@ -0,0 +1,427 @@ +import Mathlib.Probability.ProbabilityMassFunction.Integrals +import OAI.Combinatorics.Progressions.Linear.FixedKernelDensityProjection +import OAI.Combinatorics.Progressions.Linear.ShiftedMatrixCountError + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem shiftedSmoothSamples_count_integral (a S : ℝ) (hS : 0 < S) : + (∫ k : ℤ, smoothProbabilityProfile (((k : ℝ) - a) / S) ∂Measure.count) = + shiftedSmoothSampleSum a S := by + have hi := count_integrable_of_zero_off_finset (sampledWeightIndices a S 1) + (fun k : ℤ => smoothProbabilityProfile (((k : ℝ) - a) / S)) + (sampledWeight_zero_off_indices smoothProbabilityProfile hS smoothProbabilityProfile_zero_outside) + simpa only [measureReal_def, Measure.count_singleton, ENNReal.toReal_one, one_smul, + shiftedSmoothSampleSum] using integral_countable hi + +theorem shiftedSmoothSamples_center_l1 (a b S : ℝ) (hS : 1 ≤ S) : + (∫ k : ℤ, |smoothProbabilityProfile (((k : ℝ) - a) / S) - + smoothProbabilityProfile (((k : ℝ) - b) / S)| ∂Measure.count) ≤ + 6 * S * ((probabilityProfileLipschitz : ℝ) * (|a - b| / S)) := by + classical + have hS0 : 0 < S := zero_lt_one.trans_le hS + let U := sampledWeightIndices a S 1 ∪ sampledWeightIndices b S 1 + have ha (k : ℤ) (hk : k ∉ U) : smoothProbabilityProfile (((k : ℝ) - a) / S) = 0 := + sampledWeight_zero_off_indices smoothProbabilityProfile hS0 smoothProbabilityProfile_zero_outside + k (fun h => hk (Finset.mem_union_left _ h)) + have hb (k : ℤ) (hk : k ∉ U) : smoothProbabilityProfile (((k : ℝ) - b) / S) = 0 := + sampledWeight_zero_off_indices smoothProbabilityProfile hS0 smoothProbabilityProfile_zero_outside + k (fun h => hk (Finset.mem_union_right _ h)) + have hc : (U.card : ℝ) ≤ 6 * S := by + have hu : (U.card : ℝ) ≤ (sampledWeightIndices a S 1).card + + ((sampledWeightIndices b S 1).card : ℝ) := by + exact_mod_cast Finset.card_union_le (sampledWeightIndices a S 1) (sampledWeightIndices b S 1) + have hca := sampledWeightIndices_card_le a S 1 hS0.le zero_le_one + have hcb := sampledWeightIndices_card_le b S 1 hS0.le zero_le_one + linarith + have he (k : ℤ) : |smoothProbabilityProfile (((k : ℝ) - a) / S) - + smoothProbabilityProfile (((k : ℝ) - b) / S)| ≤ + (probabilityProfileLipschitz : ℝ) * (|a - b| / S) := by + have h := smoothProbabilityProfile_lipschitz.norm_sub_le + (((k : ℝ) - a) / S) (((k : ℝ) - b) / S) + have hid : ((k : ℝ) - a) / S - ((k : ℝ) - b) / S = (b - a) / S := by ring + simpa only [Real.norm_eq_abs, hid, abs_div, abs_of_pos hS0, abs_sub_comm b a] using h + exact (count_density_l1_le_card U _ _ ha hb (fun k _ => he k)).trans + (mul_le_mul_of_nonneg_right hc (by positivity)) + +theorem shiftedSmoothCoefficientPMF_center_l1 (a b S : ℝ) (hS : 0 < S) + (hZa : 0 < shiftedSmoothSampleSum a S) (hZb : 0 < shiftedSmoothSampleSum b S) + (hlarge : 8 * (probabilityProfileLipschitz : ℝ) ≤ S) : + (∫ k : ℤ, |(shiftedSmoothCoefficientPMF a S hS hZa k).toReal - + (shiftedSmoothCoefficientPMF b S hS hZb k).toReal| ∂Measure.count) ≤ + 24 * (probabilityProfileLipschitz : ℝ) * |a - b| / S := by + have hS1 : 1 ≤ S := by linarith [probabilityProfileLipschitz_one_le] + have hi (c : ℝ) := count_integrable_of_zero_off_finset (sampledWeightIndices c S 1) + (fun k : ℤ => smoothProbabilityProfile (((k : ℝ) - c) / S)) + (sampledWeight_zero_off_indices smoothProbabilityProfile hS smoothProbabilityProfile_zero_outside) + have h := normalized_density_l1 Measure.count _ _ (hi a) (hi b) + (fun _ => (smoothProbabilityProfile_range _).1) + (by rw [shiftedSmoothSamples_count_integral a S hS]; exact hZa) + (by rw [shiftedSmoothSamples_count_integral b S hS]; exact hZb) + rw [shiftedSmoothSamples_count_integral a S hS, shiftedSmoothSamples_count_integral b S hS] at h + simp only [shiftedSmoothCoefficientPMF_apply] + apply h.trans + have hr : S / shiftedSmoothSampleSum a S ≤ 2 := + (div_le_iff₀ hZa).mpr (by linarith [(shiftedSmoothSampleSum_bounds a hlarge).1]) + calc + _ ≤ 2 * (6 * S * ((probabilityProfileLipschitz : ℝ) * (|a - b| / S))) / + shiftedSmoothSampleSum a S := + div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_left (shiftedSmoothSamples_center_l1 a b S hS1) (by norm_num)) hZa.le + _ = 12 * (S / shiftedSmoothSampleSum a S) * + ((probabilityProfileLipschitz : ℝ) * (|a - b| / S)) := by ring + _ ≤ 12 * 2 * ((probabilityProfileLipschitz : ℝ) * (|a - b| / S)) := by + gcongr + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory + +variable {X Y : Type*} [Countable X] [MeasurableSpace X] [MeasurableSingletonClass X] + [Countable Y] [MeasurableSpace Y] [MeasurableSingletonClass Y] + +theorem pmf_image_complex_sum_eq_count_integral (p : PMF X) (f : X → Y) + (φ : Y → ℂ) {B : ℝ} (hb : ∀ y, ‖φ y‖ ≤ B) : + (∑' x, ((p x).toReal : ℂ) * φ (f x)) = + ∫ y, (((p.map f) y).toReal : ℂ) * φ y ∂Measure.count := by + have hi : Integrable (fun x => φ (f x)) p.toMeasure := + Integrable.of_bound (measurable_of_countable _).aestronglyMeasurable B + (ae_of_all _ (fun x => hb (f x))) + calc + _ = ∫ x, φ (f x) ∂p.toMeasure := by + simpa only [Complex.real_smul] using (p.integral_eq_tsum (fun x => φ (f x)) hi).symm + _ = ∫ y, φ y ∂(p.map f).toMeasure := by + rw [← PMF.toMeasure_map f p (measurable_of_countable f)] + exact (integral_map (measurable_of_countable f).aemeasurable + (measurable_of_countable φ).aestronglyMeasurable).symm + _ = _ := by + rw [pmf_realDensity_count] + exact realDensityMeasure_integral_complex Measure.count _ (measurable_of_countable _) + (fun _ => ENNReal.toReal_nonneg) φ + +theorem pmf_image_count_test_error (p : PMF X) (f : X → Y) (g : Y → ℝ) + (hg : Integrable g Measure.count) {ε B : ℝ} (hB : 0 ≤ B) + (he : (∫ y, |((p.map f) y).toReal - g y| ∂Measure.count) ≤ ε) + (φ : Y → ℂ) (hb : ∀ y, ‖φ y‖ ≤ B) : + ‖(∑' x, ((p x).toReal : ℂ) * φ (f x)) - + ∫ y, (g y : ℂ) * φ y ∂Measure.count‖ ≤ B * ε := by + rw [pmf_image_complex_sum_eq_count_integral p f φ hb] + exact (density_bounded_complex_test_error Measure.count _ _ (pmf_real_integrable (p.map f)) hg + φ (measurable_of_countable φ) hb).trans (mul_le_mul_of_nonneg_left he hB) + +theorem pmf_projected_count_test_error (p : PMF X) (f : X → Y) (g : Y → ℝ) + (hg : Integrable g Measure.count) (F : X → ℂ) (φ : Y → ℂ) + {δ ε B Z : ℝ} (hB : 0 ≤ B) (hZ : 0 < Z) (hb : ∀ y, ‖φ y‖ ≤ B) + (hprojection : ‖(∑' x, ((p x).toReal : ℂ) * F x) - + ∑' x, ((p x).toReal : ℂ) * φ (f x)‖ ≤ δ) + (he : (∫ y, |((p.map f) y).toReal - g y| ∂Measure.count) ≤ ε) : + ‖(∑' x, ((p x).toReal : ℂ) * F x) / (Z : ℂ) - + (∫ y, (g y : ℂ) * φ y ∂Measure.count) / (Z : ℂ)‖ ≤ (δ + B * ε) / Z := by + have ht := pmf_image_count_test_error p f g hg hB he φ hb + have h := (norm_sub_le_norm_sub_add_norm_sub (∑' x, ((p x).toReal : ℂ) * F x) + (∑' x, ((p x).toReal : ℂ) * φ (f x)) + (∫ y, (g y : ℂ) * φ y ∂Measure.count)).trans (add_le_add hprojection ht) + rw [← sub_div, norm_div, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hZ] + exact div_le_div_of_nonneg_right h hZ.le + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem shiftedSmoothProductMass_pos_of_large {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) : + 0 < shiftedSmoothProductMass a S := by + rw [shiftedSmoothProductMass_eq_prod a S (fun i => smoothSamplingScale_pos (hS i))] + exact Finset.prod_pos (fun i _ => shiftedSmoothSampleSum_pos (a i) (hS i)) + +theorem shiftedSmoothProductPMF_zero {I : Type*} [Fintype I] + (S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass 0 S) : + shiftedSmoothProductPMF 0 S hS hZ = smoothProductPMF S hS := by + have hz (z : I → ℤ) : rectangularLatticePoint 0 S z = fun i => (z i : ℝ) / S i := by + funext i + change ((z i : ℝ) - 0) / S i = (z i : ℝ) / S i + rw [sub_zero] + ext z + apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp + simp only [shiftedSmoothProductPMF_toReal, smoothProductPMF, realWeightPMF_apply, + shiftedSmoothProductMass, rectangularWeight, hz] + +theorem shiftedSmoothProductPMF_center_l1 {I : Type*} [Fintype I] + (a b S : I → ℝ) (hS : ∀ i, 0 < S i) + (hZa : 0 < shiftedSmoothProductMass a S) (hZb : 0 < shiftedSmoothProductMass b S) + (hlarge : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) : + (∫ z, |(shiftedSmoothProductPMF a S hS hZa z).toReal - + (shiftedSmoothProductPMF b S hS hZb z).toReal| ∂Measure.count) ≤ + 24 * (probabilityProfileLipschitz : ℝ) * ∑ i, |a i - b i| / S i := by + classical + let pa := fun i => shiftedSmoothCoefficientPMF (a i) (S i) (hS i) + (shiftedSmoothProductMass_coordinate_pos a S hS hZa i) + let pb := fun i => shiftedSmoothCoefficientPMF (b i) (S i) (hS i) + (shiftedSmoothProductMass_coordinate_pos b S hS hZb i) + have h := tensor_density_l1_le_sum (fun _ : I => (Measure.count : Measure ℤ)) + (fun i k => (pa i k).toReal) (fun i k => (pb i k).toReal) + (fun i => pmf_real_integrable (pa i)) (fun i => pmf_real_integrable (pb i)) + (fun _ _ => ENNReal.toReal_nonneg) (fun _ _ => ENNReal.toReal_nonneg) + (fun i => pmf_real_integral_count (pa i)) (fun i => pmf_real_integral_count (pb i)) + rw [pi_count_measure] at h + simp only [shiftedSmoothProductPMF_eq_independent, independentProductPMF_toReal] + apply h.trans + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + simpa only [mul_div_assoc] using shiftedSmoothCoefficientPMF_center_l1 (a i) (b i) (S i) + (hS i) (shiftedSmoothProductMass_coordinate_pos a S hS hZa i) + (shiftedSmoothProductMass_coordinate_pos b S hS hZb i) (hlarge i) + +theorem shiftedSmoothProductPMF_center_test {I : Type*} [Fintype I] + (a b S : I → ℝ) (hS : ∀ i, 0 < S i) + (hZa : 0 < shiftedSmoothProductMass a S) (hZb : 0 < shiftedSmoothProductMass b S) + (hlarge : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) + (φ : (I → ℤ) → ℂ) {B : ℝ} (hB : 0 ≤ B) (hφ : ∀ z, ‖φ z‖ ≤ B) : + ‖(∑' z, ((shiftedSmoothProductPMF a S hS hZa z).toReal : ℂ) * φ z) - + ∑' z, ((shiftedSmoothProductPMF b S hS hZb z).toReal : ℂ) * φ z‖ ≤ + B * (24 * (probabilityProfileLipschitz : ℝ) * ∑ i, |a i - b i| / S i) := by + have h := pmf_image_count_test_error (shiftedSmoothProductPMF a S hS hZa) id + (fun z => (shiftedSmoothProductPMF b S hS hZb z).toReal) + (pmf_real_integrable _) hB + (by simpa only [PMF.map_id] using shiftedSmoothProductPMF_center_l1 a b S hS hZa hZb hlarge) φ hφ + have hq := pmf_image_complex_sum_eq_count_integral (shiftedSmoothProductPMF b S hS hZb) id φ hφ + simp only [id_eq, PMF.map_id] at h hq + rwa [← hq] at h + +theorem shiftedSmoothProductPMF_recenter_test {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZa : 0 < shiftedSmoothProductMass a S) + (hlarge : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) + (φ : (I → ℤ) → ℂ) {B : ℝ} (hB : 0 ≤ B) (hφ : ∀ z, ‖φ z‖ ≤ B) : + ‖(∑' z, ((shiftedSmoothProductPMF a S hS hZa z).toReal : ℂ) * φ z) - + ∑' z, ((smoothProductPMF S hS z).toReal : ℂ) * φ z‖ ≤ + B * (24 * (probabilityProfileLipschitz : ℝ) * ∑ i, |a i| / S i) := by + have hZb := shiftedSmoothProductMass_pos_of_large (0 : I → ℝ) S hlarge + have h := shiftedSmoothProductPMF_center_test a 0 S hS hZa hZb hlarge φ hB hφ + simpa only [shiftedSmoothProductPMF_zero, Pi.zero_apply, sub_zero] using h + +end Erdos3 + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open MeasureTheory VectorPolynomial +open scoped BigOperators + +theorem selectedResidue_covered_reconstruction_comparison + {I K F : Type*} [Fintype I] [Fintype K] [Fintype F] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (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) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (b : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ) (c : F → ℂ) + (test : Finset (Fin q) → (I → ℝ) → ℂ) (htest : ∀ s x, ‖test s x‖ ≤ 1) + (base : I → ℤ) (modulus : I → ℕ) + (T : Finset (ColumnResiduePattern (Option K) I modulus)) + (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T V z) + (density : (Option K × I → ℤ) → ℝ) + {Y : Type*} [Countable Y] [MeasurableSpace Y] [MeasurableSingletonClass Y] + (index : (Option K × I → ℤ) → Y) (reconstruct : Y → I → (Unit ⊕ Fin q) → ℤ) + (houtput : ∀ z, reconstruct (index z) = physicalCubeRootDifferences root (Matrix.of difference) base z) + (proxy : Y → ℝ) (hg : Integrable proxy Measure.count) + {η δ ε Z : ℝ} (hη : 0 ≤ η) (hZnorm : 0 < Z) + (happrox : ∀ z ∈ rectangularWeightIndices 0 V 1, + ‖(density z : ℂ) - affineCubeFourierSum frequency + (fun j => translate (fun i => (base i : ℝ)) (p j)) c (fun k i => (z (k, i) : ℝ))‖ ≤ η) + (hprojection : + ‖(∑' z, ((selectedResidueSmoothPMF modulus T V hV hZ z).toReal : ℂ) * + (layeredSiteWeight 0 (fun s => affineSite root difference s) + (fun s x => test s ((fun i => (base i : ℝ)) + x)) (fun k i => (z (k, i) : ℝ)) * + affineCubeFourierSum frequency (fun j => translate (fun i => (base i : ℝ)) (p j)) c + (fun k i => (z (k, i) : ℝ)))) - + (∑' z, ((selectedResidueSmoothPMF modulus T V hV hZ z).toReal : ℂ) * + (layeredSiteWeight 0 (fun s => affineSite root difference s) + (fun s x => test s ((fun i => (base i : ℝ)) + x)) (fun k i => (z (k, i) : ℝ)) * + retainedSiteFourierSum U root difference frequency b c + (affineCoveredSiteSample U root difference D + (fun j => translate (fun i => (base i : ℝ)) (p j)) + (fun j => coefficients_translate_mem (U j) (fun i => (base i : ℝ)) (p j) (hm j)) + (fun k i => (z (k, i) : ℝ)))))‖ ≤ δ) + (himage : (∫ v, |(((selectedResidueSmoothPMF modulus T V hV hZ).map index) v).toReal - proxy v| + ∂Measure.count) ≤ ε) : + ‖(∑' z, ((selectedResidueSmoothPMF modulus T V hV hZ z).toReal : ℂ) * + (layeredSiteWeight 0 (fun s => affineSite root difference s) + (fun s x => test s ((fun i => (base i : ℝ)) + x)) (fun k i => (z (k, i) : ℝ)) * + (density z : ℂ))) / (Z : ℂ) - + (∫ v, (proxy v : ℂ) * physicalCubeCoveredTest U root difference D p hm frequency b c test (reconstruct v) + ∂Measure.count) / (Z : ℂ)‖ ≤ (η + δ + (∑ a, ‖c a‖) * ε) / Z := by + let law := selectedResidueSmoothPMF modulus T V hV hZ + let w := fun z : Option K × I → ℤ => layeredSiteWeight 0 (fun s => affineSite root difference s) + (fun s x => test s ((fun i => (base i : ℝ)) + x)) (fun k i => (z (k, i) : ℝ)) + let φ := physicalCubeCoveredTest U root difference D p hm frequency b c test + let output := physicalCubeRootDifferences root (Matrix.of difference) base + have hprojected : ‖(∑' z, ((law z).toReal : ℂ) * (w z * (density z : ℂ))) - + ∑' z, ((law z).toReal : ℂ) * φ (output z)‖ ≤ η + δ := + selectedResidue_density_projection_error U root difference D p hm frequency b c test htest + base modulus T V hV hZ density hη happrox hprojection + have hindexed : ‖(∑' z, ((law z).toReal : ℂ) * (w z * (density z : ℂ))) - + ∑' z, ((law z).toReal : ℂ) * φ (reconstruct (index z))‖ ≤ η + δ := by + simpa only [houtput] using hprojected + exact pmf_projected_count_test_error law index proxy hg (fun z => w z * (density z : ℂ)) + (fun y => φ (reconstruct y)) + (Finset.sum_nonneg (fun a _ => norm_nonneg (c a))) hZnorm + (fun y => physicalCubeCoveredTest_norm_le U root difference D p hm frequency b c test htest (reconstruct y)) + hindexed himage + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators Matrix + +variable {K X : Type*} [Fintype K] [Fintype X] +variable {I : X → Type*} [∀ x, Fintype (I x)] + +theorem shiftedSmoothProductPMF_matrix_image (a S : K × X → ℝ) + (hS : ∀ z, 0 < S z) (hZ : 0 < shiftedSmoothProductMass a S) + (M : ∀ x, Matrix (I x) K ℤ) : + (shiftedSmoothProductPMF a S hS hZ).map (fun z x => M x *ᵥ (fun k => z (k, x))) = + dependentProductPMF (fun x => + (shiftedSmoothProductPMF (fun k => a (k, x)) (fun k => S (k, x)) + (fun k => hS (k, x)) (shiftedSmoothProductMass_slice_pos a S hS hZ x)).map + (fun z => M x *ᵥ z)) := by + have hm : (fun z x => M x *ᵥ (fun k => z (k, x))) = + (fun z x => M x *ᵥ z x) ∘ spatialCoordinateArrayEquiv K X := rfl + rw [hm, ← PMF.map_comp, shiftedSmoothProductPMF_grouped, + dependentProductPMF_map] + +variable [DecidableEq K] [∀ x, DecidableEq (I x)] + +theorem shiftedProductImage_count_error (M : ∀ x, Matrix (I x) K ℤ) (s : ∀ x, I x ↪ K) + (hM : ∀ x, ((M x).submatrix id (s x)).det ≠ 0) + (a S : K × X → ℝ) (P : ∀ x, I x → ℝ) + (hS : ∀ z, 0 < S z) (hP : ∀ x i, 0 < P x i) (hP1 : ∀ x i, 1 ≤ P x i) + (ha : ∀ z, |a z| ≤ S z) (hZ : 0 < shiftedSmoothProductMass a S) + (hentry : ∀ x i k, |normalizedIntegerColumns (M x) (fun k => S (k, x)) (P x) i k| ≤ 1) + (ε : X → ℝ) + (he : ∀ x v, |(∏ i, P x i) * + (((shiftedSmoothProductPMF (fun k => a (k, x)) (fun k => S (k, x)) + (fun k => hS (k, x)) (shiftedSmoothProductMass_slice_pos a S hS hZ x)).map + (fun z => M x *ᵥ z)) v).toReal - + coefficientImageMask (M x) (P x) + (selectedCoefficientDensity (M x) (s x) (hM x) (fun k => S (k, x)) (P x) + (fun k => hS (k, x)) (hP x) (shiftedUnitProfile (fun k => a (k, x)) (fun k => S (k, x)))) v| ≤ ε x) + (hsmall : (∑ x, shiftedMatrixCountFactor (I x) K * ε x) ≤ 1) : + (∫ v, |(((shiftedSmoothProductPMF a S hS hZ).map + (fun z x => M x *ᵥ (fun k => z (k, x)))) v).toReal - + ∏ x, coefficientGridProxy (M x) (s x) (hM x) (fun k => S (k, x)) (P x) + (fun k => hS (k, x)) (hP x) (shiftedUnitProfile (fun k => a (k, x)) (fun k => S (k, x))) (v x)| + ∂Measure.count) ≤ 2 * ∑ x, shiftedMatrixCountFactor (I x) K * ε x := by + let p := fun x => + (shiftedSmoothProductPMF (fun k => a (k, x)) (fun k => S (k, x)) + (fun k => hS (k, x)) (shiftedSmoothProductMass_slice_pos a S hS hZ x)).map (fun z => M x *ᵥ z) + let g := fun x => coefficientGridProxy (M x) (s x) (hM x) (fun k => S (k, x)) (P x) + (fun k => hS (k, x)) (hP x) (shiftedUnitProfile (fun k => a (k, x)) (fun k => S (k, x))) + have hg (x) : Integrable (g x) Measure.count := + shiftedMatrixGridProxy_integrable (M x) (s x) (hM x) _ _ (P x) + (fun k => hS (k, x)) (hP x) (fun k => ha (k, x)) (hentry x) + have hg0 (x) (v) : 0 ≤ g x v := coefficientGridProxy_nonneg (M x) (s x) (hM x) + _ _ (fun k => hS (k, x)) (hP x) _ (shiftedUnitProfile_nonneg _ _) v + have herr (x) : (∫ v, |(p x v).toReal - g x v| ∂Measure.count) ≤ shiftedMatrixCountFactor (I x) K * ε x := + shiftedMatrixImage_count_error (M x) (s x) (hM x) _ _ (P x) + (fun k => hS (k, x)) (hP x) (hP1 x) (fun k => ha (k, x)) + (shiftedSmoothProductMass_slice_pos a S hS hZ x) (hentry x) (he x) + have h := tensor_density_l1_le_twice_sum (fun x => (Measure.count : Measure (I x → ℤ))) + (fun x v => (p x v).toReal) g (fun x => pmf_real_integrable (p x)) hg + (fun _ _ => ENNReal.toReal_nonneg) hg0 (fun x => pmf_real_integral_count (p x)) + (fun x => shiftedMatrixCountFactor (I x) K * ε x) herr hsmall + rw [pi_count_measure] at h + simpa only [shiftedSmoothProductPMF_matrix_image, dependentProductPMF_apply, ENNReal.toReal_prod] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators Matrix + +variable {K X : Type*} [Fintype K] [DecidableEq K] [Fintype X] +variable {I : X → Type*} [∀ x, Fintype (I x)] [∀ x, DecidableEq (I x)] + +noncomputable def shiftedProductGridProxy (M : ∀ x, Matrix (I x) K ℤ) (s : ∀ x, I x ↪ K) + (hM : ∀ x, ((M x).submatrix id (s x)).det ≠ 0) + (a S : K × X → ℝ) (P : ∀ x, I x → ℝ) + (hS : ∀ z, 0 < S z) (hP : ∀ x i, 0 < P x i) (v : ∀ x, I x → ℤ) : ℝ := + ∏ x, coefficientGridProxy (M x) (s x) (hM x) (fun k => S (k, x)) (P x) + (fun k => hS (k, x)) (hP x) (shiftedUnitProfile (fun k => a (k, x)) (fun k => S (k, x))) (v x) + +theorem shiftedProductGridProxy_integrable (M : ∀ x, Matrix (I x) K ℤ) (s : ∀ x, I x ↪ K) + (hM : ∀ x, ((M x).submatrix id (s x)).det ≠ 0) + (a S : K × X → ℝ) (P : ∀ x, I x → ℝ) + (hS : ∀ z, 0 < S z) (hP : ∀ x i, 0 < P x i) + (ha : ∀ z, |a z| ≤ S z) + (hentry : ∀ x i k, |normalizedIntegerColumns (M x) (fun k => S (k, x)) (P x) i k| ≤ 1) : + Integrable (shiftedProductGridProxy M s hM a S P hS hP) Measure.count := by + rw [← pi_count_measure] + exact Integrable.fintype_prod_dep (fun x => shiftedMatrixGridProxy_integrable + (M x) (s x) (hM x) _ _ (P x) (fun k => hS (k, x)) (hP x) + (fun k => ha (k, x)) (hentry x)) + +theorem shiftedProduct_test_error (M : ∀ x, Matrix (I x) K ℤ) (s : ∀ x, I x ↪ K) + (hM : ∀ x, ((M x).submatrix id (s x)).det ≠ 0) + (a S : K × X → ℝ) (P : ∀ x, I x → ℝ) + (hS : ∀ z, 0 < S z) (hP : ∀ x i, 0 < P x i) (hP1 : ∀ x i, 1 ≤ P x i) + (ha : ∀ z, |a z| ≤ S z) (hZ : 0 < shiftedSmoothProductMass a S) + (hentry : ∀ x i k, |normalizedIntegerColumns (M x) (fun k => S (k, x)) (P x) i k| ≤ 1) + (ε : X → ℝ) + (he : ∀ x v, |(∏ i, P x i) * + (((shiftedSmoothProductPMF (fun k => a (k, x)) (fun k => S (k, x)) + (fun k => hS (k, x)) (shiftedSmoothProductMass_slice_pos a S hS hZ x)).map + (fun z => M x *ᵥ z)) v).toReal - + coefficientImageMask (M x) (P x) + (selectedCoefficientDensity (M x) (s x) (hM x) (fun k => S (k, x)) (P x) + (fun k => hS (k, x)) (hP x) (shiftedUnitProfile (fun k => a (k, x)) (fun k => S (k, x)))) v| ≤ ε x) + (hsmall : (∑ x, shiftedMatrixCountFactor (I x) K * ε x) ≤ 1) + (φ : (∀ x, I x → ℤ) → ℂ) {B : ℝ} (hB : 0 ≤ B) (hφ : ∀ v, ‖φ v‖ ≤ B) : + ‖(∑' z, ((shiftedSmoothProductPMF a S hS hZ z).toReal : ℂ) * + φ (fun x => M x *ᵥ (fun k => z (k, x)))) - + ∫ v, (shiftedProductGridProxy M s hM a S P hS hP v : ℂ) * φ v ∂Measure.count‖ ≤ + B * (2 * ∑ x, shiftedMatrixCountFactor (I x) K * ε x) := by + exact pmf_image_count_test_error (shiftedSmoothProductPMF a S hS hZ) + (fun z x => M x *ᵥ (fun k => z (k, x))) _ + (shiftedProductGridProxy_integrable M s hM a S P hS hP ha hentry) hB + (shiftedProductImage_count_error M s hM a S P hS hP hP1 ha hZ hentry ε he hsmall) φ hφ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSiteCoverTilt.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSiteCoverTilt.lean new file mode 100644 index 0000000000000000000000000000000000000000..b67879c6715a5d5b684a92649efe72ddd56766e5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSiteCoverTilt.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Dynamics.ExpandedCoverBudget +import OAI.Combinatorics.Progressions.Lattices.AffineSiteCoverTilt + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial MeasureTheory +open scoped BigOperators Classical + +theorem exists_shifted_site_cover_tilted_comparison (m r a : ℕ) : + ∃ 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 (expandedCoverBudget a 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 + a) ^ a)) + (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 ⟨B, _, hcomparison⟩ := exists_affine_site_cover_tilted_comparison m r + obtain ⟨A, hA, hbudget⟩ := exists_expandedCoverBudget_absorption a B + 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 + have hPP := le_expandedCoverBudget a hP + have hEP := Real.exp_le_exp.mpr hPP + have hbudget' := Real.exp_le_exp.mpr (hbudget P hP) + exact hcomparison (expandedCoverBudget_nonneg a hP) (hn.trans hPP) (hd.trans hPP) + U root difference μ hC hCP frequency hbound c hB (hBP.trans hEP) hcoefficients + p hp hm q hq (hqP.trans (Real.exp_le_exp.mpr (shiftedPower_le_expandedCoverBudget a hP))) + stride hs hS (hSP.trans hEP) hρ hε (hρP.trans hEP) (hεP.trans hEP) hstride + H (fun k => hbudget'.trans (hsize k)) hrank (hbudget'.trans hR) + G hG V hV hwidth D hD hDmass hD0 f hf hfbound hη happrox hsmall + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSmoothProductAmplitudeTransfer.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSmoothProductAmplitudeTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..795d119238044fbb74b23302ddc943db4b72edf9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSmoothProductAmplitudeTransfer.lean @@ -0,0 +1,112 @@ +import OAI.Combinatorics.Progressions.Geometry.NormalizedSpatialAmplitudeShift +import OAI.Combinatorics.Progressions.Probability.ShiftedSmoothProductLaw + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem shiftedSmoothProductPMF_translation_test_le {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hS1 : ∀ i, 1 ≤ S i) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : (I → ℤ) → ℂ) (hφ : ∀ x, ‖φ x‖ ≤ 1) (v : I → ℤ) : + ‖(∑' x, ((shiftedSmoothProductPMF a S hS hZ x).toReal : ℂ) * φ (x + v)) - + ∑' x, ((shiftedSmoothProductPMF a S hS hZ x).toReal : ℂ) * φ x‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card I * + (((Fintype.card I : ℝ) * probabilityProfileLipschitz) * ‖rectangularLatticePoint 0 S v‖) := by + have ht := normalized_rectangular_translation_test_le (smoothProductProfile I) + (smoothProductProfile_lipschitz I) a S hS1 zero_le_one + (smoothProductProfile_zero_outside I) + (shiftedSmoothProductMass_lower a S hS hδ hδ1 hmesh hsmall) φ hφ v + simpa only [shiftedSmoothProductPMF_toReal, NNReal.coe_mul, NNReal.coe_natCast, + show 2 * (1 : ℝ) + 1 = 3 by norm_num] using ht + +theorem shiftedSmoothProductPMF_shift_transfer {I X : Type*} + [Fintype I] [Fintype X] [Nonempty X] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hS1 : ∀ i, 1 ≤ S i) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (shift : X → I → ℤ) {r B : ℝ} + (hshift : ∀ u, ‖rectangularLatticePoint 0 S (shift u)‖ ≤ r) + (f : (I → ℤ) → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) + (hlocal : ∀ x, ‖𝔼 u, f (x + shift u)‖ ≤ B) : + ‖∑' x, ((shiftedSmoothProductPMF a S hS hZ x).toReal : ℂ) * f x‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card I * ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * r + B := by + apply finite_probability_shift_transfer (fun x => (shiftedSmoothProductPMF a S hS hZ x).toReal) + (rectangularWeightIndices a S 1) (shiftedSmoothProductPMF_toReal_zero_off a S hS hZ) + (fun _ => ENNReal.toReal_nonneg) (shiftedSmoothProductPMF_toReal_sum a S hS hZ) shift f _ hlocal + intro u + apply (shiftedSmoothProductPMF_translation_test_le a S hS hZ hS1 hδ hδ1 hmesh hsmall f hf (shift u)).trans + calc + _ ≤ 4 * (3 : ℝ) ^ Fintype.card I * + (((Fintype.card I : ℝ) * probabilityProfileLipschitz) * r) := by + gcongr + exact hshift u + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators NNReal + +theorem shiftedSmoothProductPMF_shift_transfer_amplitude {I X : Type*} + [Fintype I] [Fintype X] [Nonempty X] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hS1 : ∀ i, 1 ≤ S i) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (shift : X → I → ℤ) {r β : ℝ} + (hshift : ∀ u, ‖rectangularLatticePoint 0 S (shift u)‖ ≤ r) + (f : (I → ℤ) → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) + (hlocal : ∀ x, ‖𝔼 u, f (x + shift u)‖ ≤ β) + (F : (I → ℤ) → ℂ) (hF : ∀ x, ‖F x‖ ≤ 1) + {η : ℝ} (hvariation : ∀ x u, ‖F (x + shift u) - F x‖ ≤ η) : + ‖∑' x, ((shiftedSmoothProductPMF a S hS hZ x).toReal : ℂ) * (F x * f x)‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card I * ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * r + η + β := by + have hproduct (x) : ‖F x * f x‖ ≤ 1 := by + rw [norm_mul] + exact (mul_le_mul (hF x) (hf x) (norm_nonneg _) zero_le_one).trans_eq (one_mul 1) + have hlocalProduct (x) : ‖𝔼 u, F (x + shift u) * f (x + shift u)‖ ≤ η + β := + norm_local_average_amplitude_le (fun u => x + shift u) f F x hf (hF x) (hvariation x) (hlocal x) + simpa only [add_assoc] using shiftedSmoothProductPMF_shift_transfer a S hS hZ hS1 + hδ hδ1 hmesh hsmall shift hshift (fun x => F x * f x) hproduct hlocalProduct + +theorem shiftedSmoothProductPMF_shift_transfer_lipschitz_amplitude {I X : Type*} + [Fintype I] [Fintype X] [Nonempty X] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hS1 : ∀ i, 1 ≤ S i) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (shift : X → I → ℤ) {r β : ℝ} + (hshift : ∀ u, ‖rectangularLatticePoint 0 S (shift u)‖ ≤ r) + (f : (I → ℤ) → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) + (hlocal : ∀ x, ‖𝔼 u, f (x + shift u)‖ ≤ β) + (F : (I → ℝ) → ℂ) (hF : ∀ x, ‖F x‖ ≤ 1) + {Lip : ℝ≥0} (hLip : LipschitzWith Lip F) : + ‖∑' x, ((shiftedSmoothProductPMF a S hS hZ x).toReal : ℂ) * + (F (rectangularLatticePoint a S x) * f x)‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card I * ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * r + + (Lip : ℝ) * r + β := by + exact shiftedSmoothProductPMF_shift_transfer_amplitude a S hS hZ hS1 hδ hδ1 hmesh hsmall + shift hshift f hf hlocal (fun x => F (rectangularLatticePoint a S x)) (fun _ => hF _) + (fun x u => normalizedSpatialAmplitude_shift_le_of_norm_le F hLip a S x (shift u) (hshift u)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSmoothSelectedMarginal.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSmoothSelectedMarginal.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d4a416b3385395bf5b78eecf3841a0a954a038b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedSmoothSelectedMarginal.lean @@ -0,0 +1,435 @@ +import OAI.Combinatorics.Progressions.Estimates.PrincipalCoefficientMarginal +import OAI.Combinatorics.Progressions.Probability.ShiftedSmoothLawBounds +import OAI.Combinatorics.Progressions.Probability.ShiftedSmoothProductLaw +import OAI.Combinatorics.Progressions.Probability.UniformSelectedCoefficientProductLaw + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem pmf_map_finite_sum {X Y : Type*} [DecidableEq Y] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (y : Y) : + (p.map F y).toReal = ∑ x ∈ S, (p x).toReal * (if F x = y then 1 else 0) := by + rw [pmf_map_toReal_indicator] + exact (hasSum_sum_of_ne_finset_zero (fun x hx => by rw [hp x hx, zero_mul])).tsum_eq + +theorem pmf_image_finite_expectation {X Y : Type*} [DecidableEq Y] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (T : Finset Y) (hT : ∀ x ∈ S, F x ∈ T) (φ : Y → ℂ) : + (∑' x, ((p x).toReal : ℂ) * φ (F x)) = + ∑ y ∈ T, ((p.map F y).toReal : ℂ) * φ y := by + have hs : (∑' x, ((p x).toReal : ℂ) * φ (F x)) = + ∑ x ∈ S, ((p x).toReal : ℂ) * φ (F x) := + (hasSum_sum_of_ne_finset_zero (fun x hx => by + rw [hp x hx, Complex.ofReal_zero, zero_mul])).tsum_eq + rw [hs] + simp_rw [pmf_map_finite_sum p S hp F, Complex.ofReal_sum, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro x hx + rw [Finset.sum_eq_single (F x)] + · simp + · intro y _ hy + simp [Ne.symm hy] + · intro hn + exact (hn (hT x hx)).elim + +theorem pmf_image_finite_test_error {X Y : Type*} [DecidableEq Y] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (T : Finset Y) (hT : ∀ x ∈ S, F x ∈ T) + (ψ φ : Y → ℂ) {A E : ℝ} (hA : 0 < A) + (he : ∀ y ∈ T, ‖((A * (p.map F y).toReal : ℝ) : ℂ) - ψ y‖ ≤ E) : + ‖(∑' x, ((p x).toReal : ℂ) * φ (F x)) - + ∑ y ∈ T, (ψ y / (A : ℂ)) * φ y‖ ≤ + (E / A) * ∑ y ∈ T, ‖φ y‖ := by + rw [pmf_image_finite_expectation p S hp F T hT φ, ← Finset.sum_sub_distrib] + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ y ∈ T, (E / A) * ‖φ y‖ := by + apply Finset.sum_le_sum + intro y hy + have hid : ((p.map F y).toReal : ℂ) - ψ y / (A : ℂ) = + (((A * (p.map F y).toReal : ℝ) : ℂ) - ψ y) / (A : ℂ) := by + rw [Complex.ofReal_mul, sub_div, mul_div_cancel_left₀ _ (Complex.ofReal_ne_zero.mpr hA.ne')] + rw [← sub_mul, norm_mul, hid, norm_div, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hA] + exact mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right (he y hy) hA.le) (norm_nonneg _) + _ = _ := (Finset.mul_sum _ _ _).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem pmf_image_finite_real_mean {X Y : Type*} [DecidableEq Y] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (T : Finset Y) (hT : ∀ x ∈ S, F x ∈ T) (φ : Y → ℝ) : + (∑' x, (p x).toReal * φ (F x)) = ∑ y ∈ T, (p.map F y).toReal * φ y := by + have hs : (∑' x, (p x).toReal * φ (F x)) = ∑ x ∈ S, (p x).toReal * φ (F x) := + (hasSum_sum_of_ne_finset_zero (fun x hx => by rw [hp x hx, zero_mul])).tsum_eq + rw [hs] + simp_rw [pmf_map_finite_sum p S hp F, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro x hx + rw [Finset.sum_eq_single (F x)] + · simp + · intro y _ hy + simp [Ne.symm hy] + · intro hn + exact (hn (hT x hx)).elim + +theorem pmf_image_energy_of_point_cap {X Y : Type*} [DecidableEq Y] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (T : Finset Y) (e : Y → ℝ) (he : ∀ y ∉ T, e y = 0) + {C : ℝ} (hcap : ∀ y, (p.map F y).toReal ≤ C) : + (∑' x, (p x).toReal * e (F x) ^ 2) ≤ C * ∑ y ∈ T, e y ^ 2 := by + let U := T ∪ S.image F + have hU : ∀ x ∈ S, F x ∈ U := by + intro x hx + exact Finset.mem_union_right _ (Finset.mem_image.mpr ⟨x, hx, rfl⟩) + have hsum : (∑ y ∈ U, e y ^ 2) = ∑ y ∈ T, e y ^ 2 := by + symm + apply Finset.sum_subset Finset.subset_union_left + intro y _ hy + rw [he y hy, zero_pow (by norm_num : (2 : ℕ) ≠ 0)] + rw [pmf_image_finite_real_mean p S hp F U hU (fun y => e y ^ 2)] + calc + _ ≤ ∑ y ∈ U, C * e y ^ 2 := + Finset.sum_le_sum (fun y _ => mul_le_mul_of_nonneg_right (hcap y) (sq_nonneg _)) + _ = _ := by rw [← Finset.mul_sum, hsum] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem pmf_map_add_right {Y : Type*} [AddGroup Y] (p : PMF Y) (s y : Y) : + p.map (fun v => v + s) y = p (y - s) := by + have h := pmf_map_injective_at p (fun v => v + s) (fun _ _ h => add_right_cancel h) (y-s) + simpa only [sub_add_cancel] using h + +theorem pmf_map_image_add_right {X Y : Type*} [AddGroup Y] + (p : PMF X) (F : X → Y) (s y : Y) : + p.map (fun x => F x + s) y = p.map F (y-s) := by + rw [show (fun x => F x + s) = (fun v => v+s) ∘ F from rfl, ← PMF.map_comp] + exact pmf_map_add_right (p.map F) s y + +theorem pmf_image_shifted_finite_expectation {X Y : Type*} [AddGroup Y] [DecidableEq Y] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (s : Y) (T : Finset Y) (hT : ∀ x ∈ S, F x + s ∈ T) (φ : Y → ℂ) : + (∑' x, ((p x).toReal : ℂ) * φ (F x + s)) = + ∑ y ∈ T, ((p.map F (y-s)).toReal : ℂ) * φ y := by + simpa only [pmf_map_image_add_right] using + pmf_image_finite_expectation p S hp (fun x => F x+s) T hT φ + +theorem pmf_image_shifted_finite_test_error {X Y : Type*} [AddGroup Y] [DecidableEq Y] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (s : Y) (T : Finset Y) (hT : ∀ x ∈ S, F x + s ∈ T) + (ψ φ : Y → ℂ) {A E : ℝ} (hA : 0 < A) + (he : ∀ y ∈ T, ‖((A * (p.map F (y-s)).toReal : ℝ) : ℂ) - ψ y‖ ≤ E) : + ‖(∑' x, ((p x).toReal : ℂ) * φ (F x+s)) - + ∑ y ∈ T, (ψ y / (A : ℂ)) * φ y‖ ≤ (E/A) * ∑ y ∈ T, ‖φ y‖ := by + apply pmf_image_finite_test_error p S hp (fun x => F x+s) T hT ψ φ hA + simpa only [pmf_map_image_add_right] using he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem shiftedSmoothProductMass_coordinate_pos {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) (i : I) : + 0 < shiftedSmoothSampleSum (a i) (S i) := by + have hp : (∏ j, shiftedSmoothSampleSum (a j) (S j)) ≠ 0 := by + rw [← shiftedSmoothProductMass_eq_prod a S hS] + exact hZ.ne' + have hn := (Finset.prod_ne_zero_iff.mp hp) i (Finset.mem_univ i) + have h0 : 0 ≤ shiftedSmoothSampleSum (a i) (S i) := + tsum_nonneg (fun k => (smoothProbabilityProfile_range _).1) + exact lt_of_le_of_ne h0 hn.symm + +theorem shiftedSmoothProductPMF_eq_independent {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) : + shiftedSmoothProductPMF a S hS hZ = independentProductPMF + (fun i => shiftedSmoothCoefficientPMF (a i) (S i) (hS i) + (shiftedSmoothProductMass_coordinate_pos a S hS hZ i)) := by + ext x + apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp + rw [shiftedSmoothProductPMF_toReal, independentProductPMF_toReal] + simp_rw [shiftedSmoothCoefficientPMF_apply] + rw [Finset.prod_div_distrib, ← shiftedSmoothProductMass_eq_prod a S hS] + rfl + +theorem shiftedSmoothProductPMF_base_cap {K I Y : Type*} [Fintype K] [Fintype I] + (a S : Option K × I → ℝ) (hS : ∀ z, 0 < S z) (hZ : 0 < shiftedSmoothProductMass a S) + (f : (Option K × I → ℤ) → Y) + (hf : ∀ tail, Function.Injective (fun base => f (baseArrayJoin tail base))) + (hbase : ∀ i, 8*(probabilityProfileLipschitz : ℝ) ≤ S (none,i)) (y : Y) : + ((shiftedSmoothProductPMF a S hS hZ).map f y).toReal ≤ ∏ i, 2 / S (none,i) := by + rw [shiftedSmoothProductPMF_eq_independent] + apply independentProductPMF_base_cap _ f hf (fun i => 2 / S (none,i)) + (fun i => div_nonneg (by norm_num) (hS (none,i)).le) + intro i k + exact shiftedSmoothCoefficientPMF_le (a (none,i)) (hbase i) k + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem smoothProbabilityProfile_inner_lower (x : ℝ) (hx : |x| ≤ 1 / 2) : + (1 / 2 : ℝ) ≤ smoothProbabilityProfile x := by + have hx' : probabilityProfileBump x = 1 := probabilityProfileBump.one_of_mem_closedBall + (by simpa [probabilityProfileBump, Real.dist_eq] using hx) + have hi := probabilityProfileBump.integral_le_measure_closedBall volume + norm_num [probabilityProfileBump] at hi + change (∫ y, probabilityProfileBump y) ≤ 3 / 2 at hi + change (1 / 2 : ℝ) ≤ probabilityProfileBump x / ∫ y, probabilityProfileBump y + rw [hx'] + apply (le_div_iff₀ probabilityProfileBump.integral_pos).mpr + linarith + +theorem shiftedSmoothCoefficientPMF_inner_lower (a : ℝ) {S : ℝ} + (hscale : 8 * (probabilityProfileLipschitz : ℝ) ≤ S) + (hS : 0 < S) (hZ : 0 < shiftedSmoothSampleSum a S) (k : ℤ) + (hk : |(k : ℝ) - a| ≤ S / 2) : + 1 / (3 * S) ≤ (shiftedSmoothCoefficientPMF a S hS hZ k).toReal := by + have hk' : |((k : ℝ) - a) / S| ≤ 1 / 2 := by + rw [abs_div, abs_of_pos hS] + exact (div_le_iff₀ hS).mpr (by linarith) + rw [shiftedSmoothCoefficientPMF_apply] + have hp := smoothProbabilityProfile_inner_lower _ hk' + have hb := (shiftedSmoothSampleSum_bounds a hscale).2 + apply (div_le_div_iff₀ (by positivity : 0 < 3 * S) hZ).mpr + nlinarith + +theorem shiftedSmoothProductPMF_inner_lower {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hscale : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) + (z : I → ℤ) (hz : ∀ i, |(z i : ℝ) - a i| ≤ S i / 2) : + (∏ i, 1 / (3 * S i)) ≤ (shiftedSmoothProductPMF a S hS hZ z).toReal := by + rw [shiftedSmoothProductPMF_eq_independent, independentProductPMF_toReal] + apply Finset.prod_le_prod₀ + · intro i _ + exact div_nonneg zero_le_one (mul_nonneg (by norm_num) (hS i).le) + · intro i _ + exact shiftedSmoothCoefficientPMF_inner_lower (a i) (hscale i) (hS i) + (shiftedSmoothProductMass_coordinate_pos a S hS hZ i) (z i) (hz i) + +theorem shiftedSmoothProductPMF_inner_mass {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hscale : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) + (z : I → ℤ) (hz : ∀ i, |(z i : ℝ) - a i| ≤ S i / 2) : + 1 ≤ (∏ i, 3 * S i) * (shiftedSmoothProductPMF a S hS hZ z).toReal := by + have hprod : 0 < ∏ i, 3 * S i := + Finset.prod_pos (fun i _ => mul_pos (by norm_num) (hS i)) + have h := shiftedSmoothProductPMF_inner_lower a S hS hZ hscale z hz + rw [Finset.prod_div_distrib] at h + simp only [Finset.prod_const_one] at h + exact (div_le_iff₀ hprod).mp h |>.trans_eq (mul_comm _ _) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem smoothProductPMF_eq_independent {I : Type*} [Fintype I] + (S : I → ℝ) (hS : ∀ i, 0 < S i) : + smoothProductPMF S hS = independentProductPMF (fun i => smoothCoefficientPMF (S i) (hS i)) := by + ext z + apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp + rw [smoothProductPMF_apply, independentProductPMF_toReal] + +theorem smoothProductPMF_rows {J I : Type*} [Fintype J] [Fintype I] + (S : J × I → ℝ) (hS : ∀ i, 0 < S i) : + (smoothProductPMF S hS).map independentArrayRows = + independentProductPMF (fun i => smoothProductPMF (fun j => S (j, i)) (fun j => hS (j, i))) := by + simp only [smoothProductPMF_eq_independent] + exact independentProductPMF_rows _ + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem shiftedSmoothProductMass_restrict_pos {A J : Type*} [Fintype A] [Fintype J] + (e : A → J) (a S : J → ℝ) (hS : ∀ j, 0 < S j) + (hZ : 0 < shiftedSmoothProductMass a S) : + 0 < shiftedSmoothProductMass (fun i => a (e i)) (fun i => S (e i)) := by + rw [shiftedSmoothProductMass_eq_prod _ _ (fun i => hS (e i))] + exact Finset.prod_pos (fun i _ => shiftedSmoothProductMass_coordinate_pos a S hS hZ (e i)) + +theorem shiftedSmoothProductPMF_selected_factorization + {A J : Type*} [Fintype A] [Fintype J] + (e : A ↪ J) (a S : J → ℝ) (hS : ∀ j, 0 < S j) + (hZ : 0 < shiftedSmoothProductMass a S) : + shiftedSmoothProductPMF a S hS hZ = + (shiftedSmoothProductPMF + (fun k : SelectedCoefficientComplement e => a k.val) + (fun k : SelectedCoefficientComplement e => S k.val) + (fun k => hS k.val) + (shiftedSmoothProductMass_restrict_pos Subtype.val a S hS hZ)).bind + (fun tail => + (shiftedSmoothProductPMF (fun i => a (e i)) (fun i => S (e i)) + (fun i => hS (e i)) (shiftedSmoothProductMass_restrict_pos e a S hS hZ)).map + (selectedCoefficientJoin e (0 : ℤ) tail)) := by + simp only [shiftedSmoothProductPMF_eq_independent] + rw [Subsingleton.elim (unselectedColumnFintype e) + (Subtype.fintype (fun j => j ∉ Set.range e))] + exact independentProductPMF_selected_split e (0 : ℤ) + (fun j => shiftedSmoothCoefficientPMF (a j) (S j) (hS j) + (shiftedSmoothProductMass_coordinate_pos a S hS hZ j)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def smoothInputSplit {I J D X : Type*} (e : (I ⊕ J) ≃ D) (z : D → X) : + (I → X) × (J → X) := (fun i => z (e (.inl i)), fun j => z (e (.inr j))) + +def smoothInputJoin {I J D X : Type*} (e : (I ⊕ J) ≃ D) (p : (I → X) × (J → X)) : D → X := + fun d => Sum.elim p.1 p.2 (e.symm d) + +theorem smoothInputSplit_join {I J D X : Type*} (e : (I ⊕ J) ≃ D) (p : (I → X) × (J → X)) : + smoothInputSplit e (smoothInputJoin e p) = p := by + ext <;> simp [smoothInputSplit, smoothInputJoin] + +theorem smoothInputJoin_split {I J D X : Type*} (e : (I ⊕ J) ≃ D) (z : D → X) : + smoothInputJoin e (smoothInputSplit e z) = z := by + funext d + obtain ⟨c, rfl⟩ := e.surjective d + cases c <;> simp [smoothInputSplit, smoothInputJoin] + +theorem smoothInputSplit_injective {I J D X : Type*} (e : (I ⊕ J) ≃ D) : + Function.Injective (smoothInputSplit (X := X) e) := by + intro x y h + have h' := congrArg (smoothInputJoin e) h + simpa only [smoothInputJoin_split] using h' + +theorem smoothInputSplit_law {I J D : Type*} [Fintype I] [Fintype J] [Fintype D] + (e : (I ⊕ J) ≃ D) (S : D → ℝ) (hS : ∀ d, 0 < S d) + (hM : 0 < scaledInputMass (splitSmoothProductProfile J I) + (fun i => S (e (.inl i))) (fun j => S (e (.inr j)))) : + (smoothProductPMF S hS).map (smoothInputSplit e) = + scaledInputPMF (splitSmoothProductProfile J I) + (fun z => (splitSmoothProductProfile_range J I z).1) + (fun i => S (e (.inl i))) (fun j => S (e (.inr j))) + (fun i => hS (e (.inl i))) (fun j => hS (e (.inr j))) + (splitSmoothProductProfile_zero_outside J I) hM := by + ext p + apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp + nth_rw 1 [← smoothInputSplit_join e p] + rw [pmf_map_injective_at _ _ (smoothInputSplit_injective e), + scaledInputPMF_splitSmoothProductProfile, smoothProductPMF_apply, + smoothProductPMF_apply, smoothProductPMF_apply] + rw [← e.prod_comp] + simp only [Fintype.prod_sum_type, smoothInputJoin, Equiv.symm_apply_apply, Sum.elim_inl, + Sum.elim_inr] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem pmf_map_finite_expectation {X Y : Type*} + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (φ : Y → ℂ) : + (∑' y, ((p.map F y).toReal : ℂ) * φ y) = + ∑' x, ((p x).toReal : ℂ) * φ (F x) := by + rw [pmf_image_finite_expectation p S hp F (S.image F) + (fun x hx => Finset.mem_image.mpr ⟨x, hx, rfl⟩) φ] + apply (hasSum_sum_of_ne_finset_zero _).tsum_eq + intro y hy + have hz : (p.map F y).toReal = 0 := by + rw [pmf_map_finite_sum p S hp F] + apply Finset.sum_eq_zero + intro x hx + have hxy : F x ≠ y := fun he => hy (Finset.mem_image.mpr ⟨x, hx, he⟩) + simp only [hxy, ite_false, mul_zero] + rw [hz, Complex.ofReal_zero, zero_mul] + +theorem shiftedSmoothProductPMF_selected_marginal + {A J : Type*} [Fintype A] [Fintype J] + (e : A ↪ J) (a S : J → ℝ) (hS : ∀ j, 0 < S j) + (hZ : 0 < shiftedSmoothProductMass a S) : + (shiftedSmoothProductPMF a S hS hZ).map (fun z i => z (e i)) = + shiftedSmoothProductPMF (fun i => a (e i)) (fun i => S (e i)) + (fun i => hS (e i)) (shiftedSmoothProductMass_restrict_pos e a S hS hZ) := by + simp only [shiftedSmoothProductPMF_eq_independent] + exact independentProductPMF_marginal _ e e.injective + +theorem shiftedSmoothProductPMF_selected_map + {A J Y : Type*} [Fintype A] [Fintype J] + (e : A ↪ J) (a S : J → ℝ) (hS : ∀ j, 0 < S j) + (hZ : 0 < shiftedSmoothProductMass a S) (f : (A → ℤ) → Y) : + (shiftedSmoothProductPMF a S hS hZ).map (fun z => f (fun i => z (e i))) = + (shiftedSmoothProductPMF (fun i => a (e i)) (fun i => S (e i)) + (fun i => hS (e i)) (shiftedSmoothProductMass_restrict_pos e a S hS hZ)).map f := by + rw [← shiftedSmoothProductPMF_selected_marginal e a S hS hZ, PMF.map_comp] + rfl + +theorem shiftedSmoothProductPMF_selected_expectation + {A J : Type*} [Fintype A] [Fintype J] + (e : A ↪ J) (a S : J → ℝ) (hS : ∀ j, 0 < S j) + (hZ : 0 < shiftedSmoothProductMass a S) (φ : (A → ℤ) → ℂ) : + (∑' z, ((shiftedSmoothProductPMF a S hS hZ z).toReal : ℂ) * + φ (fun i => z (e i))) = + ∑' z, ((shiftedSmoothProductPMF (fun i => a (e i)) (fun i => S (e i)) + (fun i => hS (e i)) (shiftedSmoothProductMass_restrict_pos e a S hS hZ) z).toReal : ℂ) * + φ z := by + rw [← shiftedSmoothProductPMF_selected_marginal e a S hS hZ] + exact (pmf_map_finite_expectation (shiftedSmoothProductPMF a S hS hZ) + (rectangularWeightIndices a S 1) (shiftedSmoothProductPMF_toReal_zero_off a S hS hZ) + (fun z i => z (e i)) φ).symm + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedVerticalExpansion.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedVerticalExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..b14abbf1275271ffa08d783d8ba861771772d098 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShiftedVerticalExpansion.lean @@ -0,0 +1,256 @@ +import OAI.Combinatorics.Progressions.Nilpotent.BoxNiltestDetection +import OAI.Combinatorics.Progressions.Nilpotent.NativeSquareNiltest +import OAI.Combinatorics.Progressions.Nilpotent.PolarizedVerticalNiltest + +namespace OAI + +section + +namespace Erdos3 + +open Module NilpotentLieBCHGroup CircleFourier +open scoped TensorProduct NNReal + +theorem exists_controlled_normalized_square (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L (s + 1) d) + [TopologicalSpace (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [T2Space (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [TopologicalSpace (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [T2Space (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + (p : ℝ), 0 ≤ p → ∀ (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (T : D.Niltest w), T.ComplexityLE p → ∀ (χ : D.RealGroup → CircleFourier.Circle), + (∀ z ∈ D.filtration.realification.subgroup (s + 1), ∀ x, + T.observable (z • x) = character (χ z) * T.observable x) → + ∀ h : σ → ℤ, ∃ (n : ℕ) + (Q : RationalFilteredNilmanifold (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)) s n) + (S : Q.Niltest w), + S.normBound = T.normBound ^ 2 ∧ S.ComplexityLE ((p + C) ^ C) ∧ + ∀ x : σ → ℤ, S.eval x = T.eval (fun i => x i + h i) * star (T.eval x) := by + obtain ⟨a, _, hnorm⟩ := exists_bounded_realified_square_orbit (s + 1) + obtain ⟨b, _, hleft⟩ := exists_bounded_normalization_left_lipschitz (s + 1) a + obtain ⟨c, _, hrec⟩ := exists_rationalReconstructionLipschitzBound_exp s + obtain ⟨C, hC, hbudget⟩ := exists_normalizedSquareComplexityBudget_bound a b c + refine ⟨C, hC, ?_⟩ + intro σ L _ _ d _ _ _ _ D _ _ _ _ _ _ _ _ p hp w hw T hT χ hvert h + obtain ⟨ε, γ, hγ, hε, q, hq⟩ := hnorm D p hp hT.1 w hw h T.orbit + obtain ⟨A, _, hA, hALip⟩ := hleft D p hp hT.1 + obtain ⟨m, bs, v, hls, N, hN, hin, hout, S, hSB, hS, hSval⟩ := + D.exists_square_niltest_with_budget T hp hT a b c hrec ε q χ hvert A hA (hALip ε hε) + refine ⟨_, _, S, hSB, hS.mono (hbudget p hp), ?_⟩ + intro x + exact (hSval x).trans (D.filtration.realSquareObservable_recovers_product D.lattice ε γ + (D.filtration.realification.polynomialOrbitEval w (fun i => x i + h i) T.orbit) + (D.filtration.realification.polynomialOrbitEval w x T.orbit) hγ T.observable + (D.filtration.squareFiltration.realification.polynomialOrbitEval w x q) (hq x).1 (hq x).2) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module NilpotentLieBCHGroup CircleFourier +open scoped TensorProduct NNReal + +theorem exists_uniform_two_shift_square (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L (s + 1) d) + [TopologicalSpace (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [T2Space (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [TopologicalSpace (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [T2Space (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + (p : ℝ), 0 ≤ p → ∀ (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (T : D.Niltest w), T.ComplexityLE p → + ∃ (n : ℕ) (Q : RationalFilteredNilmanifold (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)) s n), + Q.GeometryComplexityLE (squareGeometryBudget p) ∧ + ∀ (χ : D.RealGroup → CircleFourier.Circle), + (∀ z ∈ D.filtration.realification.subgroup (s + 1), ∀ x, + T.observable (z • x) = character (χ z) * T.observable x) → + ∀ a b : σ → ℤ, ∃ S : Q.Niltest w, + S.normBound = T.normBound ^ 2 ∧ S.ComplexityLE ((p + C) ^ C) ∧ + ∀ x : σ → ℤ, S.eval x = T.eval (x + a) * star (T.eval (x + b)) := by + obtain ⟨a, _, hnorm⟩ := exists_bounded_realified_square_orbit (s + 1) + obtain ⟨b, _, hleft⟩ := exists_bounded_normalization_left_lipschitz (s + 1) a + obtain ⟨c, _, hrec⟩ := exists_rationalReconstructionLipschitzBound_exp s + obtain ⟨C, hC, hbudget⟩ := exists_normalizedSquareComplexityBudget_bound a b c + refine ⟨C, hC, ?_⟩ + intro σ L _ _ d _ _ _ _ D _ _ _ _ _ _ _ _ p hp w hw T hT + obtain ⟨e, ω, hF, N, hN, hin, hout, _, hgeom, hconstruct⟩ := + D.exists_uniform_square_niltest_with_budget T hp hT a b c hrec + refine ⟨_, _, hgeom, ?_⟩ + intro χ hvert h k + obtain ⟨ε, γ, hγ, hε, q, hq⟩ := hnorm D p hp hT.1 w hw (h - k) T.orbit + obtain ⟨A, _, hA, hALip⟩ := hleft D p hp hT.1 + obtain ⟨S, _, _, hSB, hS, hSval⟩ := hconstruct ε q χ hvert A hA (hALip ε hε) + have hval (x : σ → ℤ) : S.eval x = T.eval (x + (h - k)) * star (T.eval x) := by + exact (hSval x).trans (D.filtration.realSquareObservable_recovers_product D.lattice ε γ + (D.filtration.realification.polynomialOrbitEval w (fun i => x i + (h - k) i) T.orbit) + (D.filtration.realification.polynomialOrbitEval w x T.orbit) hγ T.observable + (D.filtration.squareFiltration.realification.polynomialOrbitEval w x q) (hq x).1 (hq x).2) + refine ⟨S.translate hw k, hSB, hS.mono (hbudget p hp), ?_⟩ + intro x + rw [RationalFilteredNilmanifold.Niltest.eval_translate, hval] + congr 2 + abel + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module CircleFourier +open scoped TensorProduct + +universe u v + +theorem exists_vertical_derivative_detection (s : ℕ) : + ∃ b : ℕ, 2 ≤ b ∧ ∀ c : ℕ, + BoxNiltestDetection.{u,v} s (fun q => (q + c) ^ c) → + ∀ {σ : Type v} [Fintype σ] [DecidableEq σ] {L : Type u} + [LieRing L] [LieAlgebra ℚ L] {d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L (s + 1) d) (p q : ℝ), + 0 ≤ p → 0 ≤ q → (Fintype.card σ : ℝ) ≤ q → (p + b) ^ b ≤ q → + ∀ (w : σ → ℕ), (∀ i, 0 < w i) → ∀ (T : D.Niltest w), T.ComplexityLE p → + ∀ (χ : D.RealGroup → CircleFourier.Circle), + (∀ z ∈ D.filtration.realification.subgroup (s + 1), ∀ x, + T.observable (z • x) = character (χ z) * T.observable x) → + ∀ (h a : σ → ℤ) (lengths : σ → ℕ) [∀ i, NeZero (lengths i)] (f : (σ → ℤ) → ℂ), + (∀ x ∈ translatedIntegerBox a lengths, ‖f x‖ ≤ 1) → + Real.exp (-q) ≤ ‖finiteCorrelation (translatedIntegerBox a lengths) f (multiplicativeDerivative T.eval h)‖ → + Real.exp (-((q + c) ^ c)) ≤ finiteSupportGowersNorm (s + 1) (translatedIntegerBox a lengths) f := by + obtain ⟨b, hb, hsq⟩ := exists_controlled_normalized_square s + refine ⟨b, hb, ?_⟩ + intro c hI σ _ _ L _ _ d _ _ _ _ D p q hp hq hσ hcost w hw T hT χ hvert h a lengths _ f hf hc + let K := D.filtration.squareLieSubalgebra + let M := K ⧸ D.filtration.squareFiltration.layerIdeal (s + 1) + let : FiniteDimensional ℚ L := D.basis.finiteDimensional_of_finite + let : FiniteDimensional ℚ K := inferInstance + let : FiniteDimensional ℚ M := inferInstance + let : TopologicalSpace (ℝ ⊗[ℚ] K) := moduleTopology ℝ (ℝ ⊗[ℚ] K) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] K) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] K) := inferInstance + let : T2Space (ℝ ⊗[ℚ] K) := realification_moduleTopology_t2 (Module.finBasis ℚ K) + let : TopologicalSpace (ℝ ⊗[ℚ] M) := moduleTopology ℝ (ℝ ⊗[ℚ] M) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] M) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] M) := inferInstance + let : T2Space (ℝ ⊗[ℚ] M) := realification_moduleTopology_t2 (Module.finBasis ℚ M) + obtain ⟨n, E, S, _, hS, hval⟩ := hsq D p hp w hw T hT χ hvert h + have heval : S.conjugate.eval = multiplicativeDerivative T.eval h := by + funext x + rw [RationalFilteredNilmanifold.Niltest.eval_conjugate, hval] + simp only [multiplicativeDerivative, star_mul, star_star] + rfl + have hc' : Real.exp (-q) ≤ ‖finiteCorrelation (translatedIntegerBox a lengths) f S.conjugate.eval‖ := by + rwa [heval] + exact hI E q hq hσ w hw S.conjugate (hS.mono hcost) a lengths f hf hc' + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +open scoped TensorProduct BigOperators + +theorem exists_shifted_product_expansion (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L I σ : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype I] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} (D : RationalFilteredNilmanifold L (s + 1) d) + [TopologicalSpace (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [T2Space (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [TopologicalSpace (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + [T2Space (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)))] + {p : ℝ} (V : D.UnitVerticalObservable (D.filtration.realification.subgroup (s + 1)) I p) + {w : σ → ℕ} (g : D.filtration.realification.PolynomialOrbit w), + 0 ≤ p → D.GeometryComplexityLE p → (∀ k, 0 < w k) → ∀ (i j : I) (a b : σ → ℤ), + ∃ (n : Fin 4 → ℕ) + (Q : ∀ k, RationalFilteredNilmanifold (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)) s (n k)) + (S : ∀ k, (Q k).Niltest w), + (∀ k, (S k).normBound = 4) ∧ (∀ k, (S k).ComplexityLE ((p + C) ^ C)) ∧ + ∀ x, V.observable i (QuotientGroup.mk + (D.filtration.realification.polynomialOrbitEval w (x + a) g)) * + star (V.observable j (QuotientGroup.mk + (D.filtration.realification.polynomialOrbitEval w (x + b) g))) = + ∑ k, polarizationWeight k * (S k).eval x := by + obtain ⟨A, _, hsquare⟩ := exists_uniform_two_shift_square s + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((X + 5 + Polynomial.C A) ^ A) + refine ⟨C, hC, ?_⟩ + intro L I σ _ _ _ _ _ _ _ d D _ _ _ _ _ _ _ _ p V w g hp hD hw i j a b + have hbound : (p + 5 + A) ^ A ≤ (p + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget p hp + let T : Fin 4 → D.Niltest w := fun k => + V.combinationNiltest g i j (polarizationPhase k) (polarizationPhase_norm k).le + have hparts : ∀ k, ∃ (n : ℕ) + (Q : RationalFilteredNilmanifold (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1)) s n) (S : Q.Niltest w), + S.normBound = 4 ∧ S.ComplexityLE ((p + C) ^ C) ∧ + ∀ x, S.eval x = (T k).eval (x + a) * star ((T k).eval (x + b)) := by + intro k + obtain ⟨n, Q, _, hconstruct⟩ := hsquare D (p + 5) (by linarith) w hw (T k) + (V.combinationNiltest_complexity g i j _ _ hp hD) + obtain ⟨S, hSn, hSc, hSe⟩ := hconstruct + (fun z => ((realifyFunctional V.frequency z.coord : ℝ) : CircleFourier.Circle)) + (fun z hz x => V.coordinateCombination_vertical i j (polarizationPhase k) z hz x) a b + refine ⟨n, Q, S, ?_, hSc.mono hbound, hSe⟩ + calc + S.normBound = (T k).normBound ^ 2 := hSn + _ = 4 := by norm_num [T, combinationNiltest] + choose n Q S hSn hSc hSe using hparts + refine ⟨n, Q, S, hSn, hSc, ?_⟩ + intro x + refine (complex_mixed_polarization _ + (V.observable j (QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval w (x + a) g))) + (V.observable i (QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval w (x + b) g))) _).trans ?_ + apply Finset.sum_congr rfl + intro k _ + rw [hSe k x] + rfl + +end Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ShortConditionedCubeAxis.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ShortConditionedCubeAxis.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed1d846ba3b70f1956aaeb29d57ed3e4ad152150 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ShortConditionedCubeAxis.lean @@ -0,0 +1,47 @@ +import OAI.Combinatorics.Progressions.Fourier.FourierLawTransport + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def conditionedCubeSliceFourierAxis {b g q K : ℕ} {C : Type} [Fintype C] [NeZero K] + (s : Fin b → Fin g → FiniteCubeSlice q) (w : CubeSliceBlockDomain s C → ℝ) + (hw : ∀ x, 0 ≤ w x) + (G : Finset (CubeSliceBlockDomain s C)) (hG : 0 < ∑ x ∈ G, w x) + (coeff : C → Fin b → ℤ) (H : Fin b → ℝ) + {O F : ℝ} (hO : 0 ≤ O) (hcoeff : ∀ c a, |(coeff c a : ℝ)| ≤ H a) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hvolume : ∀ a, H a * ∏ j, ((s a j).length : ℝ) ≤ F * K) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ g) + (Kmax : ℕ) (hKmax : K ≤ Kmax) : IntegerFourierAxis := by + let Q := ⌈blockJetScaleBound q g b ((O + 1) ^ g * F)⌉₊ + have hmass : 0 < ∑ x, w x := + hG.trans_le (Finset.sum_le_univ_sum_of_nonneg (s := G) hw) + refine boundedIntegerFourierAxis (FiniteProbabilityWeights.conditionPositiveWeights w hw hmass G hG) + (cubeSliceBlockSum s coeff J) K Q ((2 * Q + 1) * Kmax) (Nat.mul_le_mul_left _ hKmax) ?_ + intro center x _ S + exact (cubeSliceBlockSum_scale_bound s coeff H hO hcoeff hroot hvolume J hJ center x S).trans + (mul_le_mul_of_nonneg_right (Nat.le_ceil _) (Nat.cast_nonneg K)) + +noncomputable def boundedCoefficientCubeSliceAxis {b g q K : ℕ} [NeZero K] + (s : Fin b → Fin g → FiniteCubeSlice q) (c : Fin b → FiniteCoefficientSlice) + (w : CubeSliceBlockDomain s (∀ a, (c a).Domain) → ℝ) + (hw : ∀ x, 0 ≤ w x) (hmass : 0 < ∑ x, w x) + {O F : ℝ} (hO : 0 ≤ O) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hvolume : ∀ a, ((c a).radius : ℝ) * ∏ j, ((s a j).length : ℝ) ≤ F * K) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ g) + (Kmax : ℕ) (hKmax : K ≤ Kmax) : IntegerFourierAxis := + boundedCubeSliceFourierAxis s w hw hmass (fun x a => (c a).value (x a)) + (fun a => ((c a).radius : ℝ)) hO (fun x a => by exact_mod_cast (c a).value_abs_le (x a)) + hroot hvolume J hJ Kmax hKmax + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SigmaAxisOperator.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SigmaAxisOperator.lean new file mode 100644 index 0000000000000000000000000000000000000000..552bf386376bd4bc247dfd4949ad5bc9a0454c6c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SigmaAxisOperator.lean @@ -0,0 +1,87 @@ +import Mathlib.Topology.Algebra.Module.ContinuousLinearMap.Invertible +import OAI.Combinatorics.Progressions.Geometry.SigmaAxisCoordinates + +namespace OAI + +section + +namespace Erdos3 + +variable {D : Type*} [Fintype D] {I O P : D → Type*} + [∀ d, Fintype (I d)] [∀ d, Fintype (O d)] [∀ d, Fintype (P d)] + +noncomputable def sigmaAxisOperator (A : ∀ d, (I d → ℝ) →L[ℝ] (O d → ℝ)) : + ((Σ d, I d) → ℝ) →L[ℝ] ((Σ d, O d) → ℝ) := + ContinuousLinearMap.pi (fun s => (ContinuousLinearMap.proj s.2).comp + ((A s.1).comp (sigmaAxisProjection I s.1))) + +omit [Fintype D] [∀ d, Fintype (I d)] [∀ d, Fintype (O d)] in +theorem sigmaAxisOperator_apply (A : ∀ d, (I d → ℝ) →L[ℝ] (O d → ℝ)) + (x : (Σ d, I d) → ℝ) (s : Σ d, O d) : + sigmaAxisOperator A x s = A s.1 (sigmaAxisProjection I s.1 x) s.2 := rfl + +omit [Fintype D] [∀ d, Fintype (I d)] [∀ d, Fintype (O d)] in +theorem sigmaAxisProjection_operator (A : ∀ d, (I d → ℝ) →L[ℝ] (O d → ℝ)) + (x : (Σ d, I d) → ℝ) (d : D) : + sigmaAxisProjection O d (sigmaAxisOperator A x) = A d (sigmaAxisProjection I d x) := rfl + +omit [Fintype D] [∀ d, Fintype (I d)] [∀ d, Fintype (O d)] [∀ d, Fintype (P d)] in +theorem sigmaAxisOperator_comp (A : ∀ d, (I d → ℝ) →L[ℝ] (O d → ℝ)) + (B : ∀ d, (O d → ℝ) →L[ℝ] (P d → ℝ)) : + (sigmaAxisOperator B).comp (sigmaAxisOperator A) = + sigmaAxisOperator (fun d => (B d).comp (A d)) := by + ext x s + rfl + +omit [Fintype D] [∀ d, Fintype (I d)] in +theorem sigmaAxisOperator_id : + sigmaAxisOperator (fun d => ContinuousLinearMap.id ℝ (I d → ℝ)) = + ContinuousLinearMap.id ℝ ((Σ d, I d) → ℝ) := by + ext x s + rfl + +theorem sigmaAxisOperator_norm_le (A : ∀ d, (I d → ℝ) →L[ℝ] (O d → ℝ)) + {K : ℝ} (hK : 0 ≤ K) (hA : ∀ d, ‖A d‖ ≤ K) : ‖sigmaAxisOperator A‖ ≤ K := by + apply ContinuousLinearMap.opNorm_le_bound _ hK + intro x + apply (pi_norm_le_iff_of_nonneg (mul_nonneg hK (norm_nonneg x))).mpr + intro s + calc + ‖sigmaAxisOperator A x s‖ ≤ ‖A s.1 (sigmaAxisProjection I s.1 x)‖ := norm_le_pi_norm _ s.2 + _ ≤ ‖A s.1‖ * ‖sigmaAxisProjection I s.1 x‖ := (A s.1).le_opNorm _ + _ ≤ K * ‖x‖ := mul_le_mul (hA s.1) (sigmaAxisProjection_norm_apply_le I s.1 x) + (norm_nonneg _) hK + +omit [Fintype D] [∀ d, Fintype (I d)] in +theorem sigmaAxisOperator_inverse_spec (A : ∀ d, (I d → ℝ) →L[ℝ] (I d → ℝ)) + (hA : ∀ d, (A d).IsInvertible) : + (sigmaAxisOperator A).IsInvertible ∧ + (sigmaAxisOperator A).inverse = sigmaAxisOperator (fun d => (A d).inverse) := by + have hr : (sigmaAxisOperator A).comp (sigmaAxisOperator (fun d => (A d).inverse)) = + ContinuousLinearMap.id ℝ ((Σ d, I d) → ℝ) := by + ext x s + change A s.1 ((A s.1).inverse (sigmaAxisProjection I s.1 x)) s.2 = x s + rw [(hA s.1).self_apply_inverse] + rfl + have hl : (sigmaAxisOperator (fun d => (A d).inverse)).comp (sigmaAxisOperator A) = + ContinuousLinearMap.id ℝ ((Σ d, I d) → ℝ) := by + ext x s + change (A s.1).inverse (A s.1 (sigmaAxisProjection I s.1 x)) s.2 = x s + rw [(hA s.1).inverse_apply_self] + rfl + exact ⟨ContinuousLinearMap.IsInvertible.of_inverse hr hl, ContinuousLinearMap.inverse_eq hr hl⟩ + +theorem sigmaAxisOperator_inverse_norm_le (A : ∀ d, (I d → ℝ) →L[ℝ] (I d → ℝ)) + (hA : ∀ d, (A d).IsInvertible) {K : ℝ} (hK : 0 ≤ K) + (hbound : ∀ d, ‖(A d).inverse‖ ≤ K) : + (sigmaAxisOperator A).IsInvertible ∧ ‖(sigmaAxisOperator A).inverse‖ ≤ K := by + obtain ⟨hi, he⟩ := sigmaAxisOperator_inverse_spec A hA + refine ⟨hi, ?_⟩ + rw [he] + exact sigmaAxisOperator_norm_le _ hK hbound + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SigmaProductPeriodization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SigmaProductPeriodization.lean new file mode 100644 index 0000000000000000000000000000000000000000..d86fb88d1895e0a1dd450979c5eaf920a2eb2331 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SigmaProductPeriodization.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Fourier.CanonicalDensityFourier + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {A : Type*} [Fintype A] {D : A → Type*} + +noncomputable def sigmaProductKernel (H : ∀ a, (D a → ℝ) → ℝ) + (x : (Σ a, D a) → ℝ) : ℝ := + ∏ a, H a (fun i => x ⟨a, i⟩) + +theorem sigmaProductKernel_small_box (H : ∀ a, (D a → ℝ) → ℝ) + (hs : ∀ a x, H a x ≠ 0 → ∀ i, |x i| < 1 / 2) + (x : (Σ a, D a) → ℝ) (hx : sigmaProductKernel H x ≠ 0) : + ∀ i, |x i| < 1 / 2 := by + classical + intro ⟨a, i⟩ + apply hs a _ _ i + exact Finset.prod_ne_zero_iff.mp hx a (Finset.mem_univ a) + +theorem positiveIntegerPeriodization_eq_nonzero_shift {I : Type*} + (H : (I → ℝ) → ℝ) (hs : ∀ x, H x ≠ 0 → ∀ i, |x i| < 1 / 2) + (x : I → ℝ) (n : I → ℤ) (hn : H (fun i => x i + (n i : ℝ)) ≠ 0) : + positiveIntegerPeriodization H x = H (fun i => x i + (n i : ℝ)) := by + apply tsum_eq_single n + intro m hm + by_contra hnonzero + exact hm (integer_shifts_small_box_injective x m n (hs _ hnonzero) (hs _ hn)) + +theorem positiveIntegerPeriodization_sigmaProductKernel + (H : ∀ a, (D a → ℝ) → ℝ) + (hs : ∀ a x, H a x ≠ 0 → ∀ i, |x i| < 1 / 2) + (x : (Σ a, D a) → ℝ) : + positiveIntegerPeriodization (sigmaProductKernel H) x = + ∏ a, positiveIntegerPeriodization (H a) (fun i => x ⟨a, i⟩) := by + classical + by_cases hall : ∀ a, ∃ n : D a → ℤ, + H a (fun i => x ⟨a, i⟩ + (n i : ℝ)) ≠ 0 + · choose n hn using hall + let N : (Σ a, D a) → ℤ := fun i => n i.1 i.2 + have hN : sigmaProductKernel H (fun i => x i + (N i : ℝ)) ≠ 0 := by + exact Finset.prod_ne_zero_iff.mpr (fun a _ => hn a) + rw [positiveIntegerPeriodization_eq_nonzero_shift _ + (sigmaProductKernel_small_box H hs) x N hN] + unfold sigmaProductKernel + apply Finset.prod_congr rfl + intro a _ + exact (positiveIntegerPeriodization_eq_nonzero_shift (H a) (hs a) + (fun i => x ⟨a, i⟩) (n a) (hn a)).symm + · push Not at hall + obtain ⟨a, ha⟩ := hall + have hleft : positiveIntegerPeriodization (sigmaProductKernel H) x = 0 := by + have hz (n : (Σ a, D a) → ℤ) : + sigmaProductKernel H (fun i => x i + (n i : ℝ)) = 0 := by + unfold sigmaProductKernel + exact Finset.prod_eq_zero (Finset.mem_univ a) (ha (fun i => n ⟨a, i⟩)) + simp only [positiveIntegerPeriodization, hz, tsum_zero] + have hright : positiveIntegerPeriodization (H a) (fun i => x ⟨a, i⟩) = 0 := by + simp only [positiveIntegerPeriodization, ha, tsum_zero] + rw [hleft] + symm + exact Finset.prod_eq_zero (Finset.mem_univ a) hright + +theorem smallBoxTorusKernel_sigmaProductKernel + (H : ∀ a, (D a → ℝ) → ℝ) + (hs : ∀ a x, H a x ≠ 0 → ∀ i, |x i| < 1 / 2) + (z : (Σ a, D a) → UnitAddCircle) : + smallBoxTorusKernel (sigmaProductKernel H) z = + ∏ a, smallBoxTorusKernel (H a) (fun i => z ⟨a, i⟩) := by + have hcoe (x : (Σ a, D a) → ℝ) : + smallBoxTorusKernel (sigmaProductKernel H) (fun i => (x i : UnitAddCircle)) = + ∏ a, smallBoxTorusKernel (H a) (fun i => (x ⟨a, i⟩ : UnitAddCircle)) := by + simp only [smallBoxTorusKernel, + realPeriodicTorusLift_coe _ (positiveIntegerPeriodization_periodic _)] + exact positiveIntegerPeriodization_sigmaProductKernel H hs x + simpa only [coe_centeredCircleLift] using hcoe (fun i => centeredCircleLift (z i)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SigmaWeightDerivative.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SigmaWeightDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..951db3139ff4cbbaa84674b9be7f68633cf37c07 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SigmaWeightDerivative.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Estimates.SplitSmoothProductProfile + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +variable {D : Type*} [Fintype D] [DecidableEq D] {I : D → Type*} + [∀ d, Fintype (I d)] [∀ d, DecidableEq (I d)] + +omit [Fintype D] [∀ d, Fintype (I d)] in +theorem sigmaAxisCoordinates_single (d : D) (i : I d) : + sigmaAxisCoordinates I (Pi.single ⟨d, i⟩ (1 : ℝ)) = Pi.single d (Pi.single i 1) := by + ext e j + by_cases he : e = d + · subst e + simp [sigmaAxisCoordinates, Pi.single_apply] + · have hs : (⟨e, j⟩ : Σ d, I d) ≠ ⟨d, i⟩ := fun h => he (congrArg Sigma.fst h) + simp [sigmaAxisCoordinates, Pi.single_eq_of_ne he, Pi.single_eq_of_ne hs] + +theorem sigmaAxisWeight_coordinate_fderiv (w : ∀ d, (I d → ℝ) → ℝ) + (hw : ∀ d, ContDiff ℝ 1 (w d)) (x : (Σ d, I d) → ℝ) (d : D) (i : I d) : + fderiv ℝ (sigmaAxisWeight w) x (Pi.single ⟨d, i⟩ 1) = + fderiv ℝ (tensorCutoffWeight w) (sigmaAxisCoordinates I x) (Pi.single d (Pi.single i 1)) := by + have hd := ((tensorCutoffWeight_contDiff w hw).differentiable one_ne_zero + (sigmaAxisCoordinates I x)).hasFDerivAt.comp x (sigmaAxisCoordinates I).toContinuousLinearMap.hasFDerivAt + change fderiv ℝ (tensorCutoffWeight w ∘ sigmaAxisCoordinates I) x (Pi.single ⟨d, i⟩ 1) = _ + rw [hd.fderiv, ContinuousLinearMap.comp_apply] + exact congrArg (fderiv ℝ (tensorCutoffWeight w) (sigmaAxisCoordinates I x)) + (sigmaAxisCoordinates_single d i) + +theorem sigmaAxisWeight_coordinate_integral (w : ∀ d, (I d → ℝ) → ℝ) + (hw : ∀ d, ContDiff ℝ 1 (w d)) (d : D) (i : I d) : + (∫ x, |fderiv ℝ (sigmaAxisWeight w) x (Pi.single ⟨d, i⟩ 1)|) = + (∫ y, |fderiv ℝ (w d) y (Pi.single i 1)|) * ∏ e ∈ Finset.univ.erase d, ∫ y, |w e y| := by + simp_rw [sigmaAxisWeight_coordinate_fderiv w hw] + rw [(sigmaAxisCoordinates_measurePreserving I).integral_comp + (sigmaAxisCoordinates I).toHomeomorph.toMeasurableEquiv.measurableEmbedding + (fun y => |fderiv ℝ (tensorCutoffWeight w) y (Pi.single d (Pi.single i 1))|)] + exact tensorCutoffWeight_derivative_integral w hw d (Pi.single i 1) + +theorem sigmaAxisWeight_coordinate_integral_le (w : ∀ d, (I d → ℝ) → ℝ) + (hw : ∀ d, ContDiff ℝ 1 (w d)) (hm : ∀ d, (∫ y, |w d y|) ≤ 1) (d : D) (i : I d) : + (∫ x, |fderiv ℝ (sigmaAxisWeight w) x (Pi.single ⟨d, i⟩ 1)|) ≤ + ∫ y, |fderiv ℝ (w d) y (Pi.single i 1)| := by + rw [sigmaAxisWeight_coordinate_integral w hw] + exact mul_le_of_le_one_right (integral_nonneg (fun _ => abs_nonneg _)) + (Finset.prod_le_one₀ (fun e _ => integral_nonneg (fun _ => abs_nonneg _)) (fun e _ => hm e)) + +theorem sigmaAxisWeight_derivative_sum_le (w : ∀ d, (I d → ℝ) → ℝ) + (hw : ∀ d, ContDiff ℝ 1 (w d)) (hm : ∀ d, (∫ y, |w d y|) ≤ 1) : + (∑ s : Σ d, I d, ∫ x, |fderiv ℝ (sigmaAxisWeight w) x (Pi.single s 1)|) ≤ + ∑ d, ∑ i : I d, ∫ y, |fderiv ℝ (w d) y (Pi.single i 1)| := by + rw [Fintype.sum_sigma] + exact Finset.sum_le_sum (fun d _ => Finset.sum_le_sum (fun i _ => + sigmaAxisWeight_coordinate_integral_le w hw hm d i)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousAxisCompression.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousAxisCompression.lean new file mode 100644 index 0000000000000000000000000000000000000000..15c2b183d5c4d021583828e230c7ab334a6f9587 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousAxisCompression.lean @@ -0,0 +1,48 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialAxisCompression + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_simultaneous_axis_compression (s : ℕ) (hs : 1 ≤ s) + {epsilon : ℝ} (hepsilon : 0 < epsilon) (hepsilon1 : epsilon < 1) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {I : Type*} [Fintype I] {N n : ℕ} [NeZero N] {p L g : ℝ}, + 2 ≤ p → 2 ≤ L → (n : ℝ) ≤ p → 1 ≤ g → g ≤ Real.exp p → + Odd N → Real.exp ((p + L + 2) ^ C) ≤ N → + ∀ f : I → Fin n → ZMod N → ℝ, (∀ i j x, 0 ≤ f i j x ∧ f i j x ≤ Real.exp p) → + (∀ i j, CyclicNiltestUpperComparison.{0} s N ((p + L + 2) ^ C) + (Real.exp (-((p + L + 2) ^ C))) (f i j) (fun _ => g)) → + ∃ S : Finset (Fin n → ZMod N), + (S.card : ℝ) ≤ (Fintype.card I : ℝ) * Real.exp (-L) * (N : ℝ) ^ n ∧ + (∀ i t y, 0 ≤ normalizedAxisProduct (f i) t ((1 + epsilon) * g) y ∧ + normalizedAxisProduct (f i) t ((1 + epsilon) * g) y ≤ Real.exp (p ^ 2)) ∧ + ∀ t, t ∉ S → ∀ i, CyclicNiltestUpperComparison.{0} (s - 1) N L (Real.exp (-L)) + (normalizedAxisProduct (f i) t ((1 + epsilon) * g)) (fun _ => 1) := by + classical + obtain ⟨C, hC, hcompress⟩ := exists_polynomial_axis_compression s hs hepsilon hepsilon1 + refine ⟨C, hC, ?_⟩ + intro I _ N n _ p L g hp hL hn hg hgb hodd hN f hf hcompare + have hex (i : I) := hcompress hp hL hn hg hgb hodd hN (f i) (hf i) (hcompare i) + choose S hS hcap hgood using hex + let E := Finset.univ.biUnion S + have hsub (i : I) : S i ⊆ E := by + intro t ht + exact Finset.mem_biUnion.mpr ⟨i, Finset.mem_univ _, ht⟩ + refine ⟨E, ?_, hcap, ?_⟩ + · calc + (E.card : ℝ) ≤ ∑ i, ((S i).card : ℝ) := by + exact_mod_cast (Finset.card_biUnion_le : E.card ≤ ∑ i, (S i).card) + _ ≤ ∑ _i : I, Real.exp (-L) * (N : ℝ) ^ n := Finset.sum_le_sum (fun i _ => hS i) + _ = _ := by simp [mul_assoc] + · intro t ht i + exact hgood i t (fun hi => ht (hsub i hi)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousDirichlet.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousDirichlet.lean new file mode 100644 index 0000000000000000000000000000000000000000..c007bfcec1cf2c67ec8be0ca48a2bd2da75bdc27 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousDirichlet.lean @@ -0,0 +1,68 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def fractionalPartBin (Q : ℕ) (hQ : 0 < Q) (x : ℝ) : Fin Q := + ⟨⌊(Q : ℝ) * Int.fract x⌋₊, by + apply (Nat.floor_lt' hQ.ne').mpr + have hQR : (0 : ℝ) < Q := by exact_mod_cast hQ + simpa using mul_lt_mul_of_pos_left (Int.fract_lt_one x) hQR⟩ + +theorem fractionalPartBin_eq_error {Q : ℕ} (hQ : 0 < Q) {x y : ℝ} + (heq : fractionalPartBin Q hQ x = fractionalPartBin Q hQ y) : + |Int.fract x - Int.fract y| < 1 / (Q : ℝ) := by + have hfloor : ⌊(Q : ℝ) * Int.fract x⌋₊ = ⌊(Q : ℝ) * Int.fract y⌋₊ := + congrArg Fin.val heq + have hxlo := Nat.floor_le (mul_nonneg (Nat.cast_nonneg Q) (Int.fract_nonneg x)) + have hylo := Nat.floor_le (mul_nonneg (Nat.cast_nonneg Q) (Int.fract_nonneg y)) + have hxhi := Nat.lt_floor_add_one ((Q : ℝ) * Int.fract x) + have hyhi := Nat.lt_floor_add_one ((Q : ℝ) * Int.fract y) + rw [hfloor] at hxlo hxhi + have habs : |(Q : ℝ) * (Int.fract x - Int.fract y)| < 1 := by + rw [abs_lt] + constructor <;> nlinarith + have hQR : (0 : ℝ) < Q := by exact_mod_cast hQ + rw [abs_mul, abs_of_pos hQR] at habs + apply (lt_div_iff₀ hQR).mpr + simpa only [mul_comm] using habs + +theorem simultaneous_dirichlet {ι : Type*} [Fintype ι] + (alpha : ι → ℝ) (Q : ℕ) (hQ : 0 < Q) : + ∃ q : ℕ, 0 < q ∧ q ≤ Q ^ Fintype.card ι ∧ + ∃ m : ι → ℤ, ∀ i, |(q : ℝ) * alpha i - m i| ≤ 1 / (Q : ℝ) := by + classical + let code : Fin (Q ^ Fintype.card ι + 1) → (ι → Fin Q) := + fun n i => fractionalPartBin Q hQ ((n.val : ℝ) * alpha i) + have hcard : Fintype.card (ι → Fin Q) < Fintype.card (Fin (Q ^ Fintype.card ι + 1)) := by + simp + obtain ⟨x, y, hxy, hcode⟩ := Fintype.exists_ne_map_eq_of_card_lt code hcard + have hordered : ∃ x y : Fin (Q ^ Fintype.card ι + 1), x < y ∧ code x = code y := by + rcases lt_or_gt_of_ne hxy with h | h + · exact ⟨x, y, h, hcode⟩ + · exact ⟨y, x, h, hcode.symm⟩ + obtain ⟨x, y, hxy, hcode⟩ := hordered + let q := y.val - x.val + refine ⟨q, Nat.sub_pos_of_lt hxy, ?_, + (fun i => ⌊(y.val : ℝ) * alpha i⌋ - ⌊(x.val : ℝ) * alpha i⌋), ?_⟩ + · exact (Nat.sub_le _ _).trans (Nat.le_of_lt_succ y.isLt) + · intro i + have herr := fractionalPartBin_eq_error hQ (congrFun hcode i) + have hidentity : (q : ℝ) * alpha i - + ((⌊(y.val : ℝ) * alpha i⌋ - ⌊(x.val : ℝ) * alpha i⌋ : ℤ) : ℝ) = + Int.fract ((y.val : ℝ) * alpha i) - Int.fract ((x.val : ℝ) * alpha i) := by + dsimp [q] + rw [Nat.cast_sub hxy.le, Int.cast_sub] + simp only [Int.fract] + ring + rw [hidentity, abs_sub_comm] + exact herr.le + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousSymbolSplitting.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousSymbolSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9eb12f3098b4cc29573ebaeb41e92c5a34fb5ec --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SimultaneousSymbolSplitting.lean @@ -0,0 +1,401 @@ +import OAI.Combinatorics.Progressions.Dynamics.PointwiseSymbolBudget +import OAI.Combinatorics.Progressions.Dynamics.ResetFromCommonQuotient + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (w : σ → ℕ) + +theorem symbolSlowBound_one (T : σ → ℝ) (hT : ∀ i, 0 < T i) {M : ℝ} (hM : 0 ≤ M) : + F.SymbolSlowBound b ω hlayers w T M 1 := by + intro z + change |((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr 0 z| ≤ _ + simp only [map_zero, Finsupp.zero_apply, abs_zero] + exact div_nonneg hM (monomialScale_pos T hT z.val.1).le + +theorem symbolRationalGrid_one (l : ℕ) : F.SymbolRationalGrid b ω hlayers w l 1 := by + change (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr 0 z) ∈ realDenominatorGrid l + have hzero : (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr 0 z) = + (0 : SymbolBasisIndex w ω → ℝ) := by + funext z + simp only [map_zero, Finsupp.zero_apply, Pi.zero_apply] + rw [hzero] + exact realDenominatorGrid_zero l + +theorem realSymbolGradeQuotientHom_first (g : F.RealPolynomialSymbolGroup w) : + F.realSymbolGradeQuotientHom w 1 g = 1 := by + apply NilpotentLieBCHGroup.ext + apply (lieQuotientMap_eq_zero ((F.polynomialSymbolFiltration w).realification.layerIdeal 1) _).mpr + change g.coord ∈ (F.polynomialSymbolFiltration w).realification.layer 1 + rw [(F.polynomialSymbolFiltration w).realification.one_eq_top] + exact Submodule.mem_top + +theorem realSymbolGradeQuotient_mem_terminal_iff + (U : LieSubalgebra ℚ (F.PolynomialSymbol w)) (g : F.RealPolynomialSymbolGroup w) : + F.realSymbolGradeQuotientHom w (s + 1) g ∈ + (NilpotentLieBCHGroup.realificationSubgroup + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) U).map + (F.realSymbolGradeQuotientHom w (s + 1)) ↔ g.coord ∈ realificationLieSubalgebra U := by + rw [F.realSymbolGradeQuotient_mem_iff w U (s + 1) g, + (F.polynomialSymbolFiltration w).realification.terminal, sup_bot_eq] + rfl + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem exists_controlled_terminal_symbol_comparison (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (U : LieSubalgebra ℚ (F.PolynomialSymbol w)) (v : κ → F.PolynomialSymbol w), + Submodule.span ℚ (Set.range v) = U.toSubmodule → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (Fintype.card κ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + (∀ i z, RationalHeightLE ((F.polynomialSymbolBasis b ω hlayers w).repr (v i) z) H) → + ∀ T : σ → ℝ, (∀ i, Real.exp ((p + C) ^ C) ≤ T i) → + ∀ E P R E' P' R' : F.RealPolynomialSymbolGroup w, + P.coord ∈ realificationLieSubalgebra U → + P'.coord ∈ realificationLieSubalgebra U → + E * P * R = E' * P' * R' → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) E → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) E' → + F.SymbolRationalGrid b ω hlayers w l R → + F.SymbolRationalGrid b ω hlayers w l R' → + (E⁻¹ * E').coord ∈ realificationLieSubalgebra U ∧ + (R' * R⁻¹).coord ∈ realificationLieSubalgebra U := by + obtain ⟨C, hC, hcompare⟩ := exists_controlled_symbol_comparison_mod_layer s a + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F b ω hlayers w hw U v hspan H l p hH hl hp + hι hσ hκ hHp hlp hb hv T hT E P R E' P' R' hP hP' heq hE hE' hR hR' + have hresult := hcompare F b ω hlayers w hw U v hspan H l p hH hl hp + hι hσ hκ hHp hlp hb hv T hT (s + 1) le_rfl E P R E' P' R' + ((F.realSymbolGradeQuotient_mem_terminal_iff w U P).mpr hP) + ((F.realSymbolGradeQuotient_mem_terminal_iff w U P').mpr hP') + (congrArg (F.realSymbolGradeQuotientHom w (s + 1)) heq) hE hE' hR hR' + exact ⟨(F.realSymbolGradeQuotient_mem_terminal_iff w U (E⁻¹ * E')).mp hresult.1, + (F.realSymbolGradeQuotient_mem_terminal_iff w U (R' * R⁻¹)).mp hresult.2⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem exists_simultaneous_symbol_extension (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ η L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (U : η → LieSubalgebra ℚ (F.PolynomialSymbol w)) (v : η → κ → F.PolynomialSymbol w), + (∀ j, Submodule.span ℚ (Set.range (v j)) = (U j).toSubmodule) → + (∀ j, BasisBlockInvariant (F.polynomialSymbolBasis b ω hlayers w) + (fun z => z.val.1) (U j).toSubmodule) → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (Fintype.card κ : ℝ) ≤ p → (Fintype.card η : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + (∀ j i z, RationalHeightLE ((F.polynomialSymbolBasis b ω hlayers w).repr (v j i) z) H) → + ∀ T : σ → ℝ, (∀ i, Real.exp ((p + 2) ^ C) ≤ T i) → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + 2) ^ C) ∧ l ∣ m ∧ + ∀ k : ℕ, k ≤ s → ∀ (X E₀ R₀ : F.RealPolynomialSymbolGroup w) + (E P R : η → F.RealPolynomialSymbolGroup w), + (∀ j, E j * P j * R j = X) → + (∀ j, (P j).coord ∈ realificationLieSubalgebra (U j)) → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) E₀ → + (∀ j, F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) (E j)) → + F.SymbolRationalGrid b ω hlayers w l R₀ → + (∀ j, F.SymbolRationalGrid b ω hlayers w l (R j)) → + (∀ j, F.realSymbolGradeQuotientHom w k (E₀⁻¹ * X * R₀⁻¹) ∈ + (NilpotentLieBCHGroup.realificationSubgroup + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) (U j)).map + (F.realSymbolGradeQuotientHom w k)) → + ∃ E₁ R₁ : F.RealPolynomialSymbolGroup w, + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ C)) E₁ ∧ + F.SymbolRationalGrid b ω hlayers w m R₁ ∧ + F.realSymbolGradeQuotientHom w k E₁ = F.realSymbolGradeQuotientHom w k E₀ ∧ + F.realSymbolGradeQuotientHom w k R₁ = F.realSymbolGradeQuotientHom w k R₀ ∧ + ∀ j, F.realSymbolGradeQuotientHom w (k + 1) (E₁⁻¹ * X * R₁⁻¹) ∈ + (NilpotentLieBCHGroup.realificationSubgroup + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) (U j)).map + (F.realSymbolGradeQuotientHom w (k + 1)) := by + obtain ⟨c₀, _, hreset⟩ := exists_symbol_reset_from_common_quotient s a + obtain ⟨c₁, _, hslowprod⟩ := exists_symbol_slow_product_bound s 1 2 + obtain ⟨c₂, _, hratprod⟩ := exists_symbol_rational_product_bound s 2 + obtain ⟨c₃, _, hcommon⟩ := exists_common_symbol_grade_corrections s 1 + obtain ⟨c₄, _, hstep⟩ := exists_controlled_symbol_grade_step s 1 + obtain ⟨C, hC, hbudget⟩ := exists_symbol_extension_budget a c₀ c₁ c₂ c₃ c₄ + refine ⟨C, hC, ?_⟩ + intro σ ι κ η L _ _ _ _ _ _ F b ω hlayers w hw U v hspan hblock H l p hH hl hp + hι hσ hκ hη hHp hlp hb hv T hT + let q₁ : ℝ := (p + c₀) ^ c₀ + (p + 2) ^ a + p + 2 + let q₂ : ℝ := (q₁ + c₁) ^ c₁ + (q₁ + c₂) ^ c₂ + q₁ + 2 + let q₃ : ℝ := (q₂ + c₃) ^ c₃ + q₂ + 2 + have h₀ : 0 ≤ (p + c₀) ^ c₀ := by positivity + have ha : 0 ≤ (p + 2) ^ a := by positivity + have hq₁ : 0 ≤ q₁ := by dsimp [q₁]; positivity + have hp₁ : p ≤ q₁ := by dsimp [q₁]; linarith + have hreset₁ : (p + c₀) ^ c₀ ≤ q₁ := by dsimp [q₁]; linarith + have ha₁ : (p + 2) ^ a ≤ q₁ := by dsimp [q₁]; linarith + have hs₁ : 0 ≤ (q₁ + c₁) ^ c₁ := by positivity + have hr₁ : 0 ≤ (q₁ + c₂) ^ c₂ := by positivity + have hq₂ : 0 ≤ q₂ := by dsimp [q₂]; positivity + have h₁₂ : q₁ ≤ q₂ := by dsimp [q₂]; linarith + have hs₂ : (q₁ + c₁) ^ c₁ ≤ q₂ := by dsimp [q₂]; linarith + have hr₂ : (q₁ + c₂) ^ c₂ ≤ q₂ := by dsimp [q₂]; linarith + have hc₂ : 0 ≤ (q₂ + c₃) ^ c₃ := by positivity + have hq₃ : 0 ≤ q₃ := by dsimp [q₃]; positivity + have h₂₃ : q₂ ≤ q₃ := by dsimp [q₃]; linarith + have hc₃ : (q₂ + c₃) ^ c₃ ≤ q₃ := by dsimp [q₃]; linarith + have hp₂ : p ≤ q₂ := hp₁.trans h₁₂ + have hp₃ : p ≤ q₃ := hp₂.trans h₂₃ + have hf : 0 ≤ (q₃ + c₄) ^ c₄ := by positivity + have htotal : (p + c₀) ^ c₀ + (q₂ + c₃) ^ c₃ + (q₃ + c₄) ^ c₄ ≤ (p + 2) ^ C := hbudget p hp + have hcut₀ : (p + c₀) ^ c₀ ≤ (p + 2) ^ C := + (le_add_of_nonneg_right hc₂).trans ((le_add_of_nonneg_right hf).trans htotal) + have hcut₃ : (q₂ + c₃) ^ c₃ ≤ (p + 2) ^ C := + (le_add_of_nonneg_left h₀).trans ((le_add_of_nonneg_right hf).trans htotal) + have hfinal : (q₃ + c₄) ^ c₄ ≤ (p + 2) ^ C := + (le_add_of_nonneg_left (add_nonneg h₀ hc₂)).trans htotal + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + let : Fintype (SymbolBasisIndex w ω) := + symbolBasisIndexFintype w ω s hw (F.adaptedBasis_weight_le_step b ω hlayers) + have hgraded (j : η) : BasisGradedSubmodule (F.polynomialSymbolBasis b ω hlayers w) + (fun z => ω z.val.2) (U j).toSubmodule := by + have heq : (fun z : SymbolBasisIndex w ω => ω z.val.2) = (fun z => Finsupp.weight w z.val.1) := + funext (fun z => z.property.symm) + rw [heq] + exact (hblock j).graded _ _ _ (Finsupp.weight w) + obtain ⟨m₁, hm₁, hm₁p, hlm₁, hresetm⟩ := hreset F b ω hlayers w hw H l p hH hl hp hι hσ hκ hHp hlp hb + T (fun i => (Real.exp_le_exp.mpr hcut₀).trans (hT i)) + obtain ⟨m₂, hm₂, hm₂p, hm₁m₂, hproductsm⟩ := hratprod F b ω hlayers w hw H q₁ hH hq₁ + (hι.trans hp₁) (hσ.trans hp₁) (hHp.trans (Real.exp_le_exp.mpr hp₁)) hb m₁ hm₁ + (hm₁p.trans (Real.exp_le_exp.mpr hreset₁)) + obtain ⟨m₃, hm₃, hm₃p, hm₂m₃, hcommonm⟩ := hcommon F b ω hlayers w hw U v hspan hblock H m₂ q₂ + hH hm₂ hq₂ (hι.trans hp₂) (hσ.trans hp₂) (hκ.trans hp₂) (hη.trans hp₂) + (hHp.trans (Real.exp_le_exp.mpr hp₂)) (hm₂p.trans (Real.exp_le_exp.mpr hr₂)) hv + T (fun i => (Real.exp_le_exp.mpr hcut₃).trans (hT i)) + obtain ⟨m₄, hm₄, hm₄p, hm₃m₄, hstepm⟩ := hstep F b ω hlayers w hw H m₃ q₃ hH hm₃ hq₃ + (hι.trans hp₃) (hσ.trans hp₃) (hHp.trans (Real.exp_le_exp.mpr hp₃)) + (hm₃p.trans (Real.exp_le_exp.mpr hc₃)) hb T hTpos + have hlm₃ : l ∣ m₃ := hlm₁.trans (hm₁m₂.trans hm₂m₃) + refine ⟨m₄, hm₄, hm₄p.trans (Real.exp_le_exp.mpr hfinal), hlm₃.trans hm₃m₄, ?_⟩ + intro k hk X E₀ R₀ E P R hX hP hE₀ hE hR₀ hR hY + let Y := E₀⁻¹ * X * R₀⁻¹ + let A₀ := fun j => F.truncateRealSymbol b ω hlayers w k (E₀⁻¹ * E j) + let D₀ := fun j => F.truncateRealSymbol b ω hlayers w k (R j * R₀⁻¹) + let E' := fun j => E j * (A₀ j)⁻¹ + let P' := fun j => A₀ j * P j * D₀ j + let R' := fun j => (D₀ j)⁻¹ * R j + have hdata (j : η) : E' j * P' j * R' j = X ∧ + (P' j).coord ∈ realificationLieSubalgebra (U j) ∧ + F.realSymbolGradeQuotientHom w k (E' j) = F.realSymbolGradeQuotientHom w k E₀ ∧ + F.realSymbolGradeQuotientHom w k (R' j) = F.realSymbolGradeQuotientHom w k R₀ ∧ + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + c₀) ^ c₀)) (E' j) ∧ + F.SymbolRationalGrid b ω hlayers w m₁ (R' j) := by + have hprod : E₀ * Y * R₀ = E j * P j * R j := by + calc + E₀ * Y * R₀ = X := by dsimp [Y]; group + _ = E j * P j * R j := (hX j).symm + obtain ⟨hprod', hmid, hEq, hRq, hslow, hgrid⟩ := hresetm (U j) (v j) (hspan j) (hgraded j) (hv j) + k (by omega) (E j) (P j) (R j) E₀ Y R₀ (hP j) (hY j) + (congrArg (F.realSymbolGradeQuotientHom w k) hprod) (hE j) hE₀ (hR j) hR₀ + exact ⟨hprod'.trans (hX j), hmid, hEq, hRq, hslow, hgrid⟩ + let A := fun j => E₀⁻¹ * E' j + let D := fun j => R' j * R₀⁻¹ + have hAs (j : η) : F.SymbolSlowBound b ω hlayers w T (Real.exp ((q₁ + c₁) ^ c₁)) (A j) := by + have hi : ∀ g ∈ [E₀⁻¹, E' j], F.SymbolSlowBound b ω hlayers w T (Real.exp ((q₁ + 2) ^ 1)) g := by + intro g hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl + · apply (F.symbolSlowBound_inv_iff b ω hlayers w T _ _).mpr + exact F.symbolSlowBound_mono b ω hlayers w T hTpos + (Real.exp_le_exp.mpr (by simpa only [pow_one] using ha₁.trans (le_add_of_nonneg_right (by norm_num)))) _ hE₀ + · exact F.symbolSlowBound_mono b ω hlayers w T hTpos + (Real.exp_le_exp.mpr (by simpa only [pow_one] using hreset₁.trans (le_add_of_nonneg_right (by norm_num)))) _ + (hdata j).2.2.2.2.1 + simpa only [List.prod_cons, List.prod_nil, mul_one] using hslowprod F b ω hlayers w hw H q₁ hH hq₁ + (hι.trans hp₁) (hσ.trans hp₁) (hHp.trans (Real.exp_le_exp.mpr hp₁)) hb T hTpos [E₀⁻¹, E' j] (by simp) hi + have hDg (j : η) : F.SymbolRationalGrid b ω hlayers w m₂ (D j) := by + have hi : ∀ g ∈ [R' j, R₀⁻¹], F.SymbolRationalGrid b ω hlayers w m₁ g := by + intro g hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl + · exact (hdata j).2.2.2.2.2 + · exact F.symbolRationalGrid_inv b ω hlayers w m₁ (F.symbolRationalGrid_mono b ω hlayers w hl hlm₁ _ hR₀) + simpa only [List.prod_cons, List.prod_nil, mul_one] using hproductsm [R' j, R₀⁻¹] (by simp) hi + let π := basisGradeProjection ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ) (fun z => ω z.val.2) k + have hlin (j : η) : π Y.coord - π (A j).coord - π (D j).coord ∈ realificationLieSubalgebra (U j) := by + have h := F.symbol_current_grade_residual_mem b ω hlayers w (U j) (hgraded j) k + (E' j) (P' j) (R' j) E₀ R₀ (hdata j).2.1 (hdata j).2.2.1.symm (hdata j).2.2.2.1 + change π (E₀⁻¹ * (E' j * P' j * R' j) * R₀⁻¹).coord - π (A j).coord - π (D j).coord ∈ _ at h + rw [(hdata j).1] at h + exact h + obtain ⟨Ac, Dc, hAc, hDc, hAcs, hDcg, hres⟩ := hcommonm k Y.coord A D + (fun j => F.symbolSlowBound_mono b ω hlayers w T hTpos + (Real.exp_le_exp.mpr (by simpa only [pow_one] using hs₂.trans (le_add_of_nonneg_right (by norm_num)))) _ (hAs j)) + hDg hlin + obtain ⟨_, hEq, hRq, hnext, hslow, hgrid⟩ := hstepm U hgraded k X E₀ R₀ Ac Dc hY hAc hDc hres + (F.symbolSlowBound_mono b ω hlayers w T hTpos + (Real.exp_le_exp.mpr (by simpa only [pow_one] using + ((ha₁.trans (h₁₂.trans h₂₃)).trans (le_add_of_nonneg_right (by norm_num))))) _ hE₀) + (F.symbolSlowBound_mono b ω hlayers w T hTpos + (Real.exp_le_exp.mpr (by simpa only [pow_one] using hc₃.trans (le_add_of_nonneg_right (by norm_num)))) _ hAcs) + (F.symbolRationalGrid_mono b ω hlayers w hl hlm₃ _ hR₀) hDcg + refine ⟨E₀ * Ac, Dc * R₀, F.symbolSlowBound_mono b ω hlayers w T hTpos + (Real.exp_le_exp.mpr hfinal) _ hslow, hgrid, hEq, hRq, ?_⟩ + intro j + have hnorm : (E₀ * Ac)⁻¹ * X * (Dc * R₀)⁻¹ = Ac⁻¹ * (E₀⁻¹ * X * R₀⁻¹) * Dc⁻¹ := by group + rw [hnorm] + exact hnext j + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem exists_simultaneous_symbol_splitting (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ η L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (U : η → LieSubalgebra ℚ (F.PolynomialSymbol w)) (v : η → κ → F.PolynomialSymbol w), + (∀ j, Submodule.span ℚ (Set.range (v j)) = (U j).toSubmodule) → + (∀ j, BasisBlockInvariant (F.polynomialSymbolBasis b ω hlayers w) + (fun z => z.val.1) (U j).toSubmodule) → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (Fintype.card κ : ℝ) ≤ p → (Fintype.card η : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + (∀ j i z, RationalHeightLE ((F.polynomialSymbolBasis b ω hlayers w).repr (v j i) z) H) → + ∀ T : σ → ℝ, (∀ i, Real.exp ((p + 2) ^ C) ≤ T i) → + ∀ (X : F.RealPolynomialSymbolGroup w) (E P R : η → F.RealPolynomialSymbolGroup w), + (∀ j, E j * P j * R j = X) → + (∀ j, (P j).coord ∈ realificationLieSubalgebra (U j)) → + (∀ j, F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) (E j)) → + (∀ j, F.SymbolRationalGrid b ω hlayers w l (R j)) → + ∃ (m : ℕ) (E₀ P₀ R₀ : F.RealPolynomialSymbolGroup w), + 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + 2) ^ C) ∧ l ∣ m ∧ + E₀ * P₀ * R₀ = X ∧ + P₀.coord ∈ realificationLieSubalgebra (⨅ j, U j) ∧ + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ C)) E₀ ∧ + F.SymbolRationalGrid b ω hlayers w m R₀ := by + obtain ⟨K, hK, hextend⟩ := exists_simultaneous_symbol_extension s 1 + let C := max 2 ((a + 4) * budgetDepthExponent K s) + refine ⟨C, le_max_left _ _, ?_⟩ + intro σ ι κ η L _ _ _ _ _ _ F b ω hlayers w hw U v hspan hblock H l p hH hl hp + hι hσ hκ hη hHp hlp hb hv T hT X E P R hX hP hE hR + let q₀ : ℝ := (p + 2) ^ a + p + let Q := iteratedPowerBudget K q₀ + have hq₀ : 0 ≤ q₀ := by dsimp [q₀]; positivity + have hp₀ : p ≤ q₀ := le_add_of_nonneg_left (by positivity) + have ha₀ : (p + 2) ^ a ≤ q₀ := le_add_of_nonneg_right hp + have hK₁ : 1 ≤ K := by omega + have hQnonneg : ∀ n, 0 ≤ Q n := iteratedPowerBudget_nonneg K hq₀ + have hQmono : Monotone Q := iteratedPowerBudget_monotone hK₁ hq₀ + have hpQ (n : ℕ) : p ≤ Q n := hp₀.trans (iteratedPowerBudget_ge hK₁ hq₀ n) + have haQ (n : ℕ) : (p + 2) ^ a ≤ Q n := ha₀.trans (iteratedPowerBudget_ge hK₁ hq₀ n) + have hstart : q₀ ≤ (p + 2) ^ (a + 2) := by + have hbase : 1 ≤ p + 2 := by linarith + have hpow : (p + 2) ^ a ≤ (p + 2) ^ (a + 1) := pow_le_pow_right₀ hbase (by omega) + have hpp : p ≤ (p + 2) ^ (a + 1) := le_power_budget hp (by omega) + calc + q₀ ≤ (p + 2) ^ (a + 1) + (p + 2) ^ (a + 1) := add_le_add hpow hpp + _ = 2 * (p + 2) ^ (a + 1) := by ring + _ ≤ (p + 2) * (p + 2) ^ (a + 1) := mul_le_mul_of_nonneg_right (by linarith) (by positivity) + _ = (p + 2) ^ (a + 2) := (pow_succ' (p + 2) (a + 1)).symm + have hQfinal : Q s ≤ (p + 2) ^ C := by + have hbound := polynomial_budget_comp hp hq₀ (a + 2) (budgetDepthExponent K s) + hstart (iteratedPowerBudget_le_power K hq₀ s) + apply hbound.trans + apply pow_le_pow_right₀ (by linarith : 1 ≤ p + 2) + exact le_max_right _ _ + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hTstage (n : ℕ) (hn : n < s) : ∀ i, Real.exp ((Q n + 2) ^ K) ≤ T i := by + intro i + apply (Real.exp_le_exp.mpr ?_).trans (hT i) + change Q (n + 1) ≤ (p + 2) ^ C + exact (hQmono (by omega)).trans hQfinal + have hind : ∀ n : ℕ, n ≤ s → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp (Q n) ∧ l ∣ m ∧ + ∃ E₀ R₀ : F.RealPolynomialSymbolGroup w, + F.SymbolSlowBound b ω hlayers w T (Real.exp (Q n)) E₀ ∧ + F.SymbolRationalGrid b ω hlayers w m R₀ ∧ + ∀ j, F.realSymbolGradeQuotientHom w (n + 1) (E₀⁻¹ * X * R₀⁻¹) ∈ + (NilpotentLieBCHGroup.realificationSubgroup + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) (U j)).map + (F.realSymbolGradeQuotientHom w (n + 1)) := by + intro n + induction n with + | zero => + intro _ + refine ⟨l, hl, hlp.trans (Real.exp_le_exp.mpr (hpQ 0)), dvd_refl l, 1, 1, + F.symbolSlowBound_one b ω hlayers w T hTpos (Real.exp_nonneg _), + F.symbolRationalGrid_one b ω hlayers w l, ?_⟩ + intro j + rw [F.realSymbolGradeQuotientHom_first w] + exact Subgroup.one_mem _ + | succ n ih => + intro hn + obtain ⟨m, hm, hmp, hlm, E₀, R₀, hE₀, hR₀, hY⟩ := ih (by omega) + obtain ⟨m', hm', hmp', hmm', hstep⟩ := hextend F b ω hlayers w hw U v hspan hblock H m (Q n) + hH hm (hQnonneg n) (hι.trans (hpQ n)) (hσ.trans (hpQ n)) (hκ.trans (hpQ n)) (hη.trans (hpQ n)) + (hHp.trans (Real.exp_le_exp.mpr (hpQ n))) hmp hb hv T (hTstage n (by omega)) + have hEn : F.SymbolSlowBound b ω hlayers w T (Real.exp ((Q n + 2) ^ 1)) E₀ := + F.symbolSlowBound_mono b ω hlayers w T hTpos + (Real.exp_le_exp.mpr (by simpa only [pow_one] using + (le_add_of_nonneg_right (by norm_num : (0 : ℝ) ≤ 2) : Q n ≤ Q n + 2))) _ hE₀ + have hEi : ∀ j, F.SymbolSlowBound b ω hlayers w T (Real.exp ((Q n + 2) ^ 1)) (E j) := by + intro j + apply F.symbolSlowBound_mono b ω hlayers w T hTpos _ _ (hE j) + apply Real.exp_le_exp.mpr + simpa only [pow_one] using (haQ n).trans (le_add_of_nonneg_right (by norm_num)) + have hRi : ∀ j, F.SymbolRationalGrid b ω hlayers w m (R j) := + fun j => F.symbolRationalGrid_mono b ω hlayers w hl hlm _ (hR j) + obtain ⟨E₁, R₁, hE₁, hR₁, _, _, hY₁⟩ := hstep (n + 1) hn X E₀ R₀ E P R hX hP hEn hEi hR₀ hRi hY + exact ⟨m', hm', hmp', hlm.trans hmm', E₁, R₁, hE₁, hR₁, hY₁⟩ + obtain ⟨m, hm, hmp, hlm, E₀, R₀, hE₀, hR₀, hY⟩ := hind s le_rfl + refine ⟨m, E₀, E₀⁻¹ * X * R₀⁻¹, R₀, hm, hmp.trans (Real.exp_le_exp.mpr hQfinal), hlm, + by group, ?_, F.symbolSlowBound_mono b ω hlayers w T hTpos (Real.exp_le_exp.mpr hQfinal) _ hE₀, hR₀⟩ + rw [realificationLieSubalgebra_iInf, lieSubalgebra_mem_iInf] + intro j + exact (F.realSymbolGradeQuotient_mem_terminal_iff w (U j) _).mp (hY j) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SitePlateauCutoff.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SitePlateauCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..495c616428ed7bffc5664425fc5e8e4d2e102daf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SitePlateauCutoff.lean @@ -0,0 +1,82 @@ +import OAI.Combinatorics.Progressions.Estimates.BufferedSiteExpansion +import OAI.Combinatorics.Progressions.Geometry.NormalizedSupportPlateau + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def scalarSupportPlateau (H x : ℝ) : ℂ := + normalizedSupportPlateau H (fun _ : Unit => x) + +theorem scalarSupportPlateau_norm (H x : ℝ) : ‖scalarSupportPlateau H x‖ ≤ 1 := by + rw [scalarSupportPlateau, Complex.norm_real, + Real.norm_of_nonneg (normalizedSupportPlateau_range H _).1] + exact (normalizedSupportPlateau_range H _).2 + +theorem scalarSupportPlateau_one {H : ℝ} (hH : 0 ≤ H) {x : ℝ} (hx : |x| ≤ H) : + scalarSupportPlateau H x = 1 := by + simp only [scalarSupportPlateau, normalizedSupportPlateau_one hH _ (fun _ => hx), Complex.ofReal_one] + +theorem scalarSupportPlateau_support (H x : ℝ) (hx : scalarSupportPlateau H x ≠ 0) : + |x| < H + 1 / 4 := by + apply normalizedSupportPlateau_support (fun _ : Unit => x) _ () + intro hz + exact hx (by simp only [scalarSupportPlateau, hz, Complex.ofReal_zero]) + +theorem scalarSupportPlateau_zero {H x : ℝ} (hx : H + 1 / 4 ≤ |x|) : + scalarSupportPlateau H x = 0 := by + by_contra hn + exact (not_lt_of_ge hx) (scalarSupportPlateau_support H x hn) + +theorem scalarSupportPlateau_lipschitz (H : ℝ) : LipschitzWith 4 (scalarSupportPlateau H) := by + apply LipschitzWith.of_dist_le_mul + intro x y + have h := (normalizedSupportPlateau_lipschitz (J := Unit) H).dist_le_mul + (fun _ => x) (fun _ => y) + rw [dist_pi_const] at h + simpa only [scalarSupportPlateau, dist_eq_norm, + ← Complex.ofReal_sub, Complex.norm_real] using h + +theorem scalarSupportPlateau_mul_lipschitz (H : ℝ) (f : ℝ → ℂ) {L : ℝ≥0} + (hL : LipschitzWith L f) (hf : ∀ x, ‖f x‖ ≤ 1) : + LipschitzWith (L + 4) (fun x => scalarSupportPlateau H x * f x) := by + simpa only [one_mul] using lipschitz_mul_of_bounds (scalarSupportPlateau H) f + (scalarSupportPlateau_lipschitz H) hL (Bf := 1) (Bg := 1) + (scalarSupportPlateau_norm H) hf + +theorem finite_site_cutoff_error {T S : Type*} [Fintype T] [Fintype S] + (target : ℂ) (c : T → ℂ) (f : T → S → ℂ) (χ : S → ℂ) {ε : ℝ} + (hε : 0 ≤ ε) (hχ : ∀ s, ‖χ s‖ ≤ 1) + (hkeep : target ≠ 0 → ∀ s, χ s = 1) + (he : (∀ s, χ s ≠ 0) → ‖target - ∑ k, c k * ∏ s, f k s‖ ≤ ε) : + ‖target - ∑ k, c k * ∏ s, χ s * f k s‖ ≤ ε := by + have hid : (∑ k, c k * ∏ s, χ s * f k s) = + (∏ s, χ s) * ∑ k, c k * ∏ s, f k s := by + simp only [Finset.prod_mul_distrib, Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + ring + have ht : (∏ s, χ s) * target = target := by + by_cases hz : target = 0 + · simp only [hz, mul_zero] + · simp only [hkeep hz, Finset.prod_const_one, one_mul] + rw [hid, ← ht, ← mul_sub, norm_mul] + by_cases hz : ∃ s, χ s = 0 + · obtain ⟨s, hs⟩ := hz + rw [Finset.prod_eq_zero (Finset.mem_univ s) hs, norm_zero, zero_mul] + exact hε + · have hp : ‖∏ s, χ s‖ ≤ 1 := by + rw [norm_prod] + exact (Finset.prod_le_prod₀ (fun _ _ => norm_nonneg _) (fun s _ => hχ s)).trans_eq + (Finset.prod_const_one) + exact (mul_le_mul hp (he (fun s hs => hz ⟨s, hs⟩)) (norm_nonneg _) zero_le_one).trans_eq (one_mul ε) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SiteTwistCommonModulus.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SiteTwistCommonModulus.lean new file mode 100644 index 0000000000000000000000000000000000000000..6682ac6dedd00a1bd954a11d72f0986debb94351 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SiteTwistCommonModulus.lean @@ -0,0 +1,575 @@ +import OAI.Combinatorics.Progressions.Geometry.PhysicalNormalizedSpatialFactor +import OAI.Combinatorics.Progressions.Sampling.CeilGridScaleRatio + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +variable {A S : Type*} [Fintype A] [Fintype S] +variable {I : A → Type*} [∀ a, Fintype (I a)] + +theorem finite_site_product_expansion (c : ∀ a, I a → ℂ) + (f : ∀ a, I a → S → ℂ) : + (∏ a, ∑ k, c a k * ∏ s, f a k s) = + ∑ k : ∀ a, I a, (∏ a, c a (k a)) * ∏ s, ∏ a, f a (k a) s := by + rw [Fintype.prod_sum] + apply Finset.sum_congr rfl + intro k _ + rw [Finset.prod_mul_distrib, Finset.prod_comm] + +theorem finite_site_product_coefficient_norm (c : ∀ a, I a → ℂ) : + (∑ k : ∀ a, I a, ‖∏ a, c a (k a)‖) = ∏ a, ∑ k, ‖c a k‖ := by + simp only [norm_prod, Fintype.prod_sum] + +theorem finite_site_product_coefficient_norm_le (c : ∀ a, I a → ℂ) + (C : A → ℝ) (hc : ∀ a, (∑ k, ‖c a k‖) ≤ C a) : + (∑ k : ∀ a, I a, ‖∏ a, c a (k a)‖) ≤ ∏ a, C a := by + rw [finite_site_product_coefficient_norm] + exact Finset.prod_le_prod₀ (fun _ _ => Finset.sum_nonneg (fun _ _ => norm_nonneg _)) + (fun a _ => hc a) + +theorem finite_site_axis_product_lipschitz (f : A → ℝ → ℂ) (L : ℝ≥0) + (hf : ∀ a, LipschitzWith L (f a)) (hn : ∀ a x, ‖f a x‖ ≤ 1) : + (∀ x : A → ℝ, ‖∏ a, f a (x a)‖ ≤ 1) ∧ + LipschitzWith (Fintype.card A * L) (fun x : A → ℝ => ∏ a, f a (x a)) := by + have hl (a : A) : LipschitzWith L (fun x : A → ℝ => f a (x a)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + exact ((hf a).dist_le_mul _ _).trans + (mul_le_mul_of_nonneg_left (dist_le_pi_dist x y a) L.coe_nonneg) + simpa only [NNReal.coe_one, one_pow, mul_one] using + bounded_lipschitz_fintype_prod (fun a (x : A → ℝ) => f a (x a)) + (B := 1) le_rfl hl (fun a x => hn a (x a)) + +theorem finite_site_product_approximation (c : ∀ a, I a → ℂ) + (f : ∀ a, I a → S → ℂ) (g : A → ℂ) + (N : ℕ) (hcard : Fintype.card A ≤ N) {C δ : ℝ} (hC : 0 ≤ C) (hδ : 0 < δ) + (hg : ∀ a, ‖g a‖ ≤ C) + (he : ∀ a, ‖g a - ∑ k, c a k * ∏ s, f a k s‖ ≤ uniformProductAccuracy N C δ) : + ‖(∏ a, g a) - + ∑ k : ∀ a, I a, (∏ a, c a (k a)) * ∏ s, ∏ a, f a (k a) s‖ ≤ δ := by + rw [← finite_site_product_expansion] + have h := norm_prod_sub_prod_le_uniform_accuracy N hcard hC hδ + (fun a => ∑ k, c a k * ∏ s, f a k s) g hg + (fun a => by simpa only [norm_sub_rev] using he a) + simpa only [norm_sub_rev] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +universe u v + +structure ScalarSiteExpansion (S : Type u) where + Term : Type v + [termFinite : Fintype Term] + period : Term → ℕ + coefficient : Term → ℂ + factor : (i : Term) → S → ZMod (period i) → ℝ → ℂ + +attribute [local instance] ScalarSiteExpansion.termFinite + +namespace ScalarSiteExpansion + +variable {S : Type u} [Fintype S] + +structure Bounds (e : ScalarSiteExpansion.{u,v} S) (T D C : ℝ) (L : ℝ≥0) (H : ℝ) : Prop where + card_le : (Fintype.card e.Term : ℝ) ≤ T + period_pos : ∀ i, 0 < e.period i + period_le : ∀ i, (e.period i : ℝ) ≤ D + coefficient_le : (∑ i, ‖e.coefficient i‖) ≤ C + factor_bound : ∀ i s r x, ‖e.factor i s r x‖ ≤ 1 + lipschitz : ∀ i s r, LipschitzWith L (e.factor i s r) + support : ∀ i s r x, H ≤ |x| → e.factor i s r x = 0 + +noncomputable def eval (e : ScalarSiteExpansion.{u,v} S) (y : S → ℤ) (x : S → ℝ) : ℂ := + ∑ i, e.coefficient i * ∏ s, e.factor i s (y s : ZMod (e.period i)) (x s) + +noncomputable def integerEval (e : ScalarSiteExpansion.{u,v} S) (N : ℕ) (y : S → ℤ) : ℂ := + e.eval y (fun s => (y s : ℝ) / N) + +theorem eval_norm_le (e : ScalarSiteExpansion.{u,v} S) {T D C H : ℝ} {L : ℝ≥0} + (h : e.Bounds T D C L H) (y : S → ℤ) (x : S → ℝ) : ‖e.eval y x‖ ≤ C := by + apply (norm_sum_le _ _).trans + apply (Finset.sum_le_sum (fun i _ => ?_)).trans h.coefficient_le + rw [norm_mul] + apply mul_le_of_le_one_right (norm_nonneg _) + rw [norm_prod] + exact (Finset.prod_le_prod₀ (fun _ _ => norm_nonneg _) (fun s _ => h.factor_bound i s _ _)).trans_eq + Finset.prod_const_one + +end ScalarSiteExpansion +end Erdos3 + +end + +section + +namespace Erdos3.ScalarSiteExpansion + +open scoped NNReal + +universe u v + +variable {S : Type u} {e : ScalarSiteExpansion.{u,v} S} + +theorem Bounds.mono {T D C H T' D' C' H' : ℝ} {L L' : ℝ≥0} + (h : e.Bounds T D C L H) (hT : T ≤ T') (hD : D ≤ D') (hC : C ≤ C') + (hL : L ≤ L') (hH : H ≤ H') : e.Bounds T' D' C' L' H' := + ⟨h.card_le.trans hT, h.period_pos, fun i => (h.period_le i).trans hD, + h.coefficient_le.trans hC, h.factor_bound, fun i s r => (h.lipschitz i s r).weaken hL, + fun i s r x hx => h.support i s r x (hH.trans hx)⟩ + +end Erdos3.ScalarSiteExpansion + +end + +section + +namespace Erdos3.ScalarSiteExpansion +open scoped BigOperators NNReal Classical +universe u v +variable {S : Type u} [Fintype S] +attribute [local instance] ScalarSiteExpansion.termFinite + +noncomputable def rescale (e : ScalarSiteExpansion.{u,v} S) (c : ℂ) (r : ℝ) : ScalarSiteExpansion.{u,v} S where + Term := e.Term + period := e.period + coefficient i := c * e.coefficient i + factor i s k x := e.factor i s k (r * x) + +theorem rescale_eval (e : ScalarSiteExpansion.{u,v} S) (c : ℂ) (r : ℝ) (y : S → ℤ) (x : S → ℝ) : + (e.rescale c r).eval y x = c * e.eval y (fun s => r * x s) := by + simp only [eval, rescale, Finset.mul_sum, mul_assoc] + rfl + +omit [Fintype S] in +theorem rescale_bounds [Fintype S] (e : ScalarSiteExpansion.{u,v} S) {T D C H : ℝ} {L : ℝ≥0} + (h : e.Bounds T D C L H) (c : ℂ) {r : ℝ} (hr : 0 < r) : + (e.rescale c r).Bounds T D (‖c‖ * C) (L * ‖r‖₊) (H / r) := by + refine ⟨h.card_le, h.period_pos, h.period_le, ?_, ?_, ?_, ?_⟩ + · change (∑ i, ‖c * e.coefficient i‖) ≤ ‖c‖ * C + simp only [norm_mul, ← Finset.mul_sum] + exact mul_le_mul_of_nonneg_left h.coefficient_le (norm_nonneg c) + · intro i s k x + exact h.factor_bound i s k (r * x) + · intro i s k + have hmul : LipschitzWith ‖r‖₊ (fun x : ℝ => r * x) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simp only [Real.dist_eq, ← mul_sub, abs_mul, coe_nnnorm, Real.norm_eq_abs, le_refl] + exact (h.lipschitz i s k).comp hmul + · intro i s k x hx + apply h.support + rw [abs_mul, abs_of_pos hr] + exact (div_le_iff₀ hr).mp hx |>.trans_eq (mul_comm _ _) + +theorem rescale_integerEval (e : ScalarSiteExpansion.{u,v} S) (c : ℂ) (M N : ℕ) + (hN : 0 < N) (y : S → ℤ) : + (e.rescale c ((N : ℝ) / M)).integerEval N y = c * e.integerEval M y := by + rw [integerEval, rescale_eval, integerEval] + congr 2 + funext s + have hN0 : (N : ℝ) ≠ 0 := (Nat.cast_pos.mpr hN).ne' + simp only [div_eq_mul_inv] + calc + _ = ((N : ℝ) * (N : ℝ)⁻¹) * ((y s : ℝ) * (M : ℝ)⁻¹) := by ring + _ = _ := by rw [mul_inv_cancel₀ hN0, one_mul] + +theorem rescale_integer_error (e : ScalarSiteExpansion.{u,v} S) (M N d : ℕ) + (hM : 0 < M) (hN : 0 < N) (y : S → ℤ) (p ε : ℝ) + (he : ‖(((M : ℝ) ^ d * p : ℝ) : ℂ) - e.integerEval M y‖ ≤ ε) : + ‖(((N : ℝ) ^ d * p : ℝ) : ℂ) - + (e.rescale (((N : ℝ) / M) ^ d : ℂ) ((N : ℝ) / M)).integerEval N y‖ ≤ + ((N : ℝ) / M) ^ d * ε := by + rw [rescale_integerEval e _ M N hN] + have hM0 : (M : ℝ) ≠ 0 := (Nat.cast_pos.mpr hM).ne' + have hr : ((N : ℝ) / M) * M = N := div_mul_cancel₀ _ hM0 + have hv : ((N : ℝ) / M) ^ d * ((M : ℝ) ^ d * p) = (N : ℝ) ^ d * p := by + rw [← mul_assoc, ← mul_pow, hr] + have hvC : (((N : ℝ) ^ d * p : ℝ) : ℂ) = + (((N : ℝ) / M) ^ d : ℂ) * (((M : ℝ) ^ d * p : ℝ) : ℂ) := by + exact_mod_cast hv.symm + rw [hvC, ← mul_sub, norm_mul] + have hn : ‖(((N : ℝ) / M) ^ d : ℂ)‖ = ((N : ℝ) / M) ^ d := by + rw [norm_pow] + norm_cast + rw [hn] + exact mul_le_mul_of_nonneg_left he (by positivity) + +end Erdos3.ScalarSiteExpansion + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +attribute [local instance] ScalarSiteExpansion.termFinite + +universe u v w + +variable {A : Type u} {S : Type v} [Fintype A] [Fintype S] +variable (e : A → ScalarSiteExpansion.{v,w} S) + +noncomputable def siteFamilyCoefficient (k : ∀ a, (e a).Term) : ℂ := + ∏ a, (e a).coefficient (k a) + +noncomputable def siteFamilyFactor (k : ∀ a, (e a).Term) (s : S) + (r : ∀ a, ZMod ((e a).period (k a))) (x : A → ℝ) : ℂ := + ∏ a, (e a).factor (k a) s (r a) (x a) + +noncomputable def siteFamilyEval (y : S → A → ℤ) (x : S → A → ℝ) : ℂ := + ∑ k, siteFamilyCoefficient e k * ∏ s, + siteFamilyFactor e k s (fun a => (y s a : ZMod ((e a).period (k a)))) (x s) + +theorem siteFamilyEval_eq (y : S → A → ℤ) (x : S → A → ℝ) : + siteFamilyEval e y x = ∏ a, (e a).eval (fun s => y s a) (fun s => x s a) := by + symm + exact finite_site_product_expansion (fun a => (e a).coefficient) + (fun a k s => (e a).factor k s (y s a : ZMod ((e a).period k)) (x s a)) + +variable {T D C H : A → ℝ} {L : ℝ≥0} +variable (h : ∀ a, (e a).Bounds (T a) (D a) (C a) L (H a)) + +include h in +omit [Fintype S] in +theorem siteFamily_card_le : (Fintype.card (∀ a, (e a).Term) : ℝ) ≤ ∏ a, T a := by + rw [Fintype.card_pi, Nat.cast_prod] + exact Finset.prod_le_prod₀ (fun _ _ => Nat.cast_nonneg _) (fun a _ => (h a).card_le) + +include h in +omit [Fintype S] in +theorem siteFamily_coefficient_le : (∑ k, ‖siteFamilyCoefficient e k‖) ≤ ∏ a, C a := + finite_site_product_coefficient_norm_le (fun a => (e a).coefficient) C + (fun a => (h a).coefficient_le) + +include h in +omit [Fintype S] in +theorem siteFamilyFactor_bounds (k : ∀ a, (e a).Term) (s : S) + (r : ∀ a, ZMod ((e a).period (k a))) : + (∀ x, ‖siteFamilyFactor e k s r x‖ ≤ 1) ∧ + LipschitzWith (Fintype.card A * L) (siteFamilyFactor e k s r) := by + exact finite_site_axis_product_lipschitz (fun a => (e a).factor (k a) s (r a)) L + (fun a => (h a).lipschitz (k a) s (r a)) (fun a => (h a).factor_bound (k a) s (r a)) + +include h in +omit [Fintype S] in +theorem siteFamilyFactor_support (k : ∀ a, (e a).Term) (s : S) + (r : ∀ a, ZMod ((e a).period (k a))) (x : A → ℝ) + (hx : ∃ a, H a ≤ |x a|) : siteFamilyFactor e k s r x = 0 := by + obtain ⟨a, ha⟩ := hx + exact Finset.prod_eq_zero (Finset.mem_univ a) ((h a).support (k a) s (r a) (x a) ha) + +theorem siteFamily_approximation (y : S → A → ℤ) (x : S → A → ℝ) (g : A → ℂ) + (N : ℕ) (hcard : Fintype.card A ≤ N) {B δ : ℝ} (hB : 0 ≤ B) (hδ : 0 < δ) + (hg : ∀ a, ‖g a‖ ≤ B) + (he : ∀ a, ‖g a - (e a).eval (fun s => y s a) (fun s => x s a)‖ ≤ + uniformProductAccuracy N B δ) : + ‖(∏ a, g a) - siteFamilyEval e y x‖ ≤ δ := by + exact finite_site_product_approximation (fun a => (e a).coefficient) + (fun a k s => (e a).factor k s (y s a : ZMod ((e a).period k)) (x s a)) + g N hcard hB hδ hg he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +variable {A S : Type*} [Fintype A] (e : A → ScalarSiteExpansion S) + +noncomputable def commonSitePeriod (k : ∀ a, (e a).Term) : ℕ := ∏ a, (e a).period (k a) + +theorem commonSitePeriod_dvd (k : ∀ a, (e a).Term) (a : A) : + (e a).period (k a) ∣ commonSitePeriod e k := + Finset.dvd_prod_of_mem _ (Finset.mem_univ a) + +theorem commonSitePeriod_pos {T V C H : A → ℝ} {L : ℝ≥0} + (he : ∀ a, (e a).Bounds (T a) (V a) (C a) L (H a)) (k : ∀ a, (e a).Term) : + 0 < commonSitePeriod e k := + Finset.prod_pos (fun a _ => (he a).period_pos (k a)) + +theorem commonSitePeriod_le_pow {T V C H : A → ℝ} {L : ℝ≥0} + (he : ∀ a, (e a).Bounds (T a) (V a) (C a) L (H a)) + {D : ℝ} (hD : ∀ a, V a ≤ D) (k : ∀ a, (e a).Term) : + (commonSitePeriod e k : ℝ) ≤ D ^ Fintype.card A := by + rw [commonSitePeriod, Nat.cast_prod] + calc + _ ≤ ∏ _a : A, D := Finset.prod_le_prod₀ (fun a _ => Nat.cast_nonneg _) + (fun a _ => ((he a).period_le (k a)).trans (hD a)) + _ = _ := by simp only [Finset.prod_const, Finset.card_univ] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +attribute [local instance] ScalarSiteExpansion.termFinite + +variable {A D S : Type*} [Fintype A] [Fintype D] + +def scaledSiteCoordinates (selected : A → D) (scale : A → ℝ) (x : D → ℝ) : A → ℝ := + fun a => scale a * x (selected a) + +theorem scaledSiteCoordinates_lipschitz (selected : A → D) (scale : A → ℝ) + (Q : ℝ≥0) (hQ : ∀ a, |scale a| ≤ Q) : + LipschitzWith Q (scaledSiteCoordinates selected scale) := by + apply LipschitzWith.of_dist_le_mul + intro x y + apply (dist_pi_le_iff (by positivity)).mpr + intro a + change |scale a * x (selected a) - scale a * y (selected a)| ≤ _ + rw [← mul_sub, abs_mul] + exact (mul_le_mul_of_nonneg_left (dist_le_pi_dist x y (selected a)) (abs_nonneg _)).trans + (mul_le_mul_of_nonneg_right (hQ a) dist_nonneg) + +variable (e : A → ScalarSiteExpansion S) (selected : A → D) (scale : A → ℝ) + +noncomputable def scaledSiteFamilyFactor (k : ∀ a, (e a).Term) (s : S) + (r : ∀ a, ZMod ((e a).period (k a))) (x : D → ℝ) : ℂ := + siteFamilyFactor e k s r (scaledSiteCoordinates selected scale x) + +theorem scaledSiteFamilyFactor_bounds {T V C H : A → ℝ} {L : ℝ≥0} + (h : ∀ a, (e a).Bounds (T a) (V a) (C a) L (H a)) + (Q : ℝ≥0) (hQ : ∀ a, |scale a| ≤ Q) + (k : ∀ a, (e a).Term) (s : S) (r : ∀ a, ZMod ((e a).period (k a))) : + (∀ x, ‖scaledSiteFamilyFactor e selected scale k s r x‖ ≤ 1) ∧ + LipschitzWith ((Fintype.card A * L) * Q) (scaledSiteFamilyFactor e selected scale k s r) := by + have hf := siteFamilyFactor_bounds e h k s r + exact ⟨fun x => hf.1 _, hf.2.comp (scaledSiteCoordinates_lipschitz selected scale Q hQ)⟩ + +omit [Fintype D] in +theorem scaledSiteFamilyFactor_support {T V C H : A → ℝ} {L : ℝ≥0} + (h : ∀ a, (e a).Bounds (T a) (V a) (C a) L (H a)) + (hscale : ∀ a, 0 < scale a) (k : ∀ a, (e a).Term) (s : S) + (r : ∀ a, ZMod ((e a).period (k a))) (x : D → ℝ) + (hx : ∃ a, H a / scale a ≤ |x (selected a)|) : + scaledSiteFamilyFactor e selected scale k s r x = 0 := by + obtain ⟨a, ha⟩ := hx + apply siteFamilyFactor_support e h k s r _ + refine ⟨a, ?_⟩ + change H a ≤ |scale a * x (selected a)| + rw [abs_mul, abs_of_pos (hscale a)] + exact (div_le_iff₀' (hscale a)).mp ha + +omit [Fintype D] in +theorem scaledSiteFamilyFactor_eval [Fintype S] + (y : S → A → ℤ) (x : S → D → ℝ) : + (∑ k, siteFamilyCoefficient e k * ∏ s, scaledSiteFamilyFactor e selected scale k s + (fun a => (y s a : ZMod ((e a).period (k a)))) (x s)) = + siteFamilyEval e y (fun s => scaledSiteCoordinates selected scale (x s)) := rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +attribute [local instance] ScalarSiteExpansion.termFinite + +theorem ScalarSiteExpansion.eval_eq_zero_of_large {S : Type*} [Fintype S] + (e : ScalarSiteExpansion S) {H : ℝ} + (he : ∀ i s r x, H ≤ |x| → e.factor i s r x = 0) + (y : S → ℤ) (x : S → ℝ) (s : S) (hs : H ≤ |x s|) : e.eval y x = 0 := by + apply Finset.sum_eq_zero + intro i _ + rw [Finset.prod_eq_zero (Finset.mem_univ s) (he i s _ _ hs), mul_zero] + +variable {α : Type*} [Fintype α] [DecidableEq α] + +noncomputable def reconstructedSiteEval (rows : Finset (Finset α)) + (e : ScalarSiteExpansion (Finset α)) (N : ℕ) (z : rows → ℤ) : ℂ := + e.integerEval N (integerBooleanSitesFromRows rows z) + +theorem reconstructedSiteEval_zero_off_window (rows : Finset (Finset α)) + (e : ScalarSiteExpansion (Finset α)) {N d : ℕ} (hN : 0 < N) + (hrows : ∀ t ∈ rows, t.card ≤ d) {H K : ℝ} (hH : 0 ≤ H) + (hK : (2 : ℝ) ^ d * H ≤ K) + (he : ∀ i s r x, H ≤ |x| → e.factor i s r x = 0) + (z : rows → ℤ) (hz : z ∉ naturalScaleIntegerWindow rows K N) : + reconstructedSiteEval rows e N z = 0 := by + by_contra hg + apply hz + apply mem_naturalScaleIntegerWindow_of_bound + intro t + let y := integerBooleanSitesFromRows rows z + have hNr : (0 : ℝ) < N := Nat.cast_pos.mpr hN + have hy (s : Finset α) : |(y s : ℝ)| ≤ H * N := by + have hs : |(y s : ℝ) / N| < H := lt_of_not_ge (fun h => hg + (e.eval_eq_zero_of_large he y (fun s => (y s : ℝ) / N) s h)) + rw [abs_div, abs_of_pos hNr] at hs + exact (div_le_iff₀ hNr).mp hs.le + have hc := integer_boolean_coefficient_degree_bound y t.val + (hrows t.val t.property) hH hNr.le hy + rw [integerBooleanSitesFromRows_coefficient_mem] at hc + exact hc.trans ((mul_assoc (2 ^ d) H (N : ℝ)).symm.le.trans + (mul_le_mul_of_nonneg_right hK hNr.le)) + +end Erdos3 + +end + +section + +namespace Erdos3.ScalarSiteExpansion +open scoped BigOperators NNReal Classical +universe u v +variable {S : Type u} [Fintype S] + +noncomputable def atCeilScale (e : ScalarSiteExpansion.{u,v} S) (K d : ℕ) (γ : ℝ) : + ScalarSiteExpansion.{u,v} S := + e.rescale (((⌈γ * (K : ℝ)⌉₊ : ℝ) / K) ^ d : ℂ) ((⌈γ * (K : ℝ)⌉₊ : ℝ) / K) + +theorem atCeilScale_bounds (e : ScalarSiteExpansion.{u,v} S) (K d : ℕ) {γ T D C H : ℝ} {L : ℝ≥0} + (hK : 0 < K) (hγ : 0 < γ) (hC : 0 ≤ C) (hH : 0 ≤ H) (he : e.Bounds T D C L H) : + (e.atCeilScale K d γ).Bounds T D ((γ + 1) ^ d * C) + (L * Real.toNNReal (γ + 1)) (H * γ⁻¹) := by + obtain ⟨hN, hlo, hhi, hinv⟩ := ceilGridScale_ratio_bounds K hK hγ + let r : ℝ := (⌈γ * (K : ℝ)⌉₊ : ℝ) / K + have hr : 0 < r := div_pos (Nat.cast_pos.mpr hN) (Nat.cast_pos.mpr hK) + have hnorm : ‖(r ^ d : ℂ)‖ = r ^ d := by + rw [norm_pow, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hr] + have hLip : ‖r‖₊ ≤ Real.toNNReal (γ + 1) := by + apply NNReal.coe_le_coe.mp + simpa only [coe_nnnorm, Real.norm_eq_abs, abs_of_pos hr, + Real.coe_toNNReal (γ + 1) (by positivity : 0 ≤ γ + 1)] using hhi + have hsupport : H / r ≤ H * γ⁻¹ := by + have hi : r⁻¹ ≤ γ⁻¹ := by simpa only [r, inv_div] using hinv + rw [div_eq_mul_inv] + exact mul_le_mul_of_nonneg_left hi hH + have heq : e.atCeilScale K d γ = e.rescale (r ^ d : ℂ) r := by + simp only [atCeilScale, r, Complex.ofReal_div, Complex.ofReal_natCast] + rw [heq] + apply (rescale_bounds e he (r ^ d : ℂ) hr).mono le_rfl le_rfl _ _ hsupport + · rw [hnorm] + exact mul_le_mul_of_nonneg_right (pow_le_pow_left₀ hr.le hhi d) hC + · exact mul_le_mul_of_nonneg_left hLip (show 0 ≤ L from zero_le) + +theorem atCeilScale_integer_error (e : ScalarSiteExpansion.{u,v} S) (K d : ℕ) {γ : ℝ} + (hK : 0 < K) (hγ : 0 < γ) (y : S → ℤ) (p : ℝ) {ε : ℝ} (hε : 0 ≤ ε) + (he : ‖(((K : ℝ) ^ d * p : ℝ) : ℂ) - e.integerEval K y‖ ≤ ε) : + ‖(((⌈γ * (K : ℝ)⌉₊ : ℝ) ^ d * p : ℝ) : ℂ) - + (e.atCeilScale K d γ).integerEval ⌈γ * (K : ℝ)⌉₊ y‖ ≤ (γ + 1) ^ d * ε := by + obtain ⟨hN, _, hhi, _⟩ := ceilGridScale_ratio_bounds K hK hγ + exact (rescale_integer_error e K ⌈γ * (K : ℝ)⌉₊ d hK hN y p ε he).trans + (mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (by positivity) hhi d) hε) + +end Erdos3.ScalarSiteExpansion + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +variable {X A V : Type*} [Fintype X] [Fintype A] +variable (spatialPeriod : ℕ) (q : X → ℕ) (e : A → ScalarSiteExpansion V) +variable (k : ∀ a, (e a).Term) (idealPeriod : ℕ) + +noncomputable def siteTwistCommonModulus : ℕ := + residueRefinedPeriod spatialPeriod q * commonSitePeriod e k * idealPeriod + +theorem siteTwistCommonModulus_pos (hs : 0 < spatialPeriod) (hq : ∀ x, 0 < q x) + (hg : ∀ a, 0 < (e a).period (k a)) (hi : 0 < idealPeriod) : + 0 < siteTwistCommonModulus spatialPeriod q e k idealPeriod := + Nat.mul_pos (Nat.mul_pos (residueRefinedPeriod_pos hs q hq) + (Finset.prod_pos (fun a _ => hg a))) hi + +theorem siteTwistCommonModulus_spatial_dvd (x : X) : + q x * spatialPeriod ∣ siteTwistCommonModulus spatialPeriod q e k idealPeriod := + ((stride_mul_dvd_residueRefinedPeriod spatialPeriod q x).trans + (dvd_mul_right (residueRefinedPeriod spatialPeriod q) (commonSitePeriod e k))).trans + (dvd_mul_right _ idealPeriod) + +theorem siteTwistCommonModulus_grid_dvd (a : A) : + (e a).period (k a) ∣ siteTwistCommonModulus spatialPeriod q e k idealPeriod := + ((commonSitePeriod_dvd e k a).trans + (dvd_mul_left (commonSitePeriod e k) (residueRefinedPeriod spatialPeriod q))).trans + (dvd_mul_right _ idealPeriod) + +theorem siteTwistCommonModulus_ideal_dvd : + idealPeriod ∣ siteTwistCommonModulus spatialPeriod q e k idealPeriod := + dvd_mul_left idealPeriod _ + +theorem siteTwistCommonModulus_exp_bound {ES EQ EG EI : ℝ} + (hs : (spatialPeriod : ℝ) ≤ Real.exp ES) + (hq : ∀ x, (q x : ℝ) ≤ Real.exp EQ) + (hg : ∀ a, ((e a).period (k a) : ℝ) ≤ Real.exp EG) + (hi : (idealPeriod : ℝ) ≤ Real.exp EI) : + (siteTwistCommonModulus spatialPeriod q e k idealPeriod : ℝ) ≤ + Real.exp (ES + Fintype.card X * EQ + Fintype.card A * EG + EI) := by + have hgrid : (commonSitePeriod e k : ℝ) ≤ Real.exp (Fintype.card A * EG) := by + calc + _ = ∏ a, ((e a).period (k a) : ℝ) := by rw [commonSitePeriod, Nat.cast_prod] + _ ≤ ∏ _a : A, Real.exp EG := Finset.prod_le_prod₀ (fun _ _ => Nat.cast_nonneg _) (fun a _ => hg a) + _ = _ := by rw [Finset.prod_const, Finset.card_univ, Real.exp_nat_mul] + have hspatial := residueRefinedPeriod_exp_bound spatialPeriod q hs hq + have hprod := mul_le_mul (mul_le_mul hspatial hgrid (Nat.cast_nonneg _) (Real.exp_pos _).le) + hi (Nat.cast_nonneg _) (mul_nonneg (Real.exp_pos _).le (Real.exp_pos _).le) + simpa only [siteTwistCommonModulus, Nat.cast_mul, Real.exp_add] using hprod + +namespace BooleanCubeKernel + +variable {K α : Type*} [Fintype K] [Fintype α] +variable (root : K → ℤ) (D : Matrix α K ℤ) (base : X → ℤ) +variable (residue : Option K × X → ℤ) (q : X → ℕ) +variable (b : ℝ) (r : ℝ≥0) {spatialPeriod M : ℕ} +variable (hM : ∀ x, q x * spatialPeriod ∣ M) +variable (t : X → SpatialSiteLabel α spatialPeriod b r) (s : Finset α) + +noncomputable def physicalResidueSpatialMaskMod (u : X → ZMod M) : ℂ := + starVertexSiteFactor (fun i u => ∏ x, + if ZMod.castHom (hM x) (ZMod (q x * spatialPeriod)) (u x) = + ((physicalCubeVertexValue (physicalCubeRootDifferences root D base residue) + (spatialStarVertex i) x + (q x : ℤ) * (((t x).1 i).val : ℤ) : ℤ) : ZMod (q x * spatialPeriod)) + then (1 : ℂ) else 0) s u + +theorem physicalResidueSpatialMaskMod_eval (u : X → ℤ) : + physicalResidueSpatialMaskMod root D base residue q b r hM t s (fun x => (u x : ZMod M)) = + physicalResidueSpatialMask root D base residue q b r t s u := by + simp only [physicalResidueSpatialMaskMod, physicalResidueSpatialMask, starVertexSiteFactor, + residueSiteIndicator, map_intCast, apply_ite, Complex.ofReal_one, Complex.ofReal_zero] + +theorem physicalResidueSpatialMaskMod_norm (u : X → ZMod M) : + ‖physicalResidueSpatialMaskMod root D base residue q b r hM t s u‖ ≤ 1 := by + apply starVertexSiteFactor_bound + intro i v + rw [norm_prod] + apply Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) + intro x _ + split_ifs <;> simp + +end BooleanCubeKernel +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SlicedOneCubeSiteExpansion.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedOneCubeSiteExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..04d88a38561c101dc0ed5257a6c87578b97a705c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedOneCubeSiteExpansion.lean @@ -0,0 +1,98 @@ +import OAI.Combinatorics.Progressions.Dynamics.VectorSiteBudget + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal Classical + +theorem scalarPair_site_expansion (D : ℝ × ℝ → ℝ) (K : ℝ≥0) + (hD : ∀ z, D z ∈ Set.Icc (0 : ℝ) (K * K)) + (hLip : LipschitzWith (K * (K * (2 * K)) + K * (K * (2 * K))) D) + {q R ε : ℝ} (hq : 0 ≤ q) (hK : (K : ℝ) ≤ Real.exp q) + (hR : 0 < R) (hRq : R ≤ Real.exp q) (hε : 0 < ε) (hεq : ε⁻¹ ≤ Real.exp q) : + let P := 3 * q + 4 + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * P + 8) ∧ + ∃ (c : (Bool × Unit → Fin n) → ℂ) + (f : (Bool × Unit → Fin n) → Bool → (Unit → ℝ) → ℂ), + (∑ k, ‖c k‖) ≤ Real.exp (2 * (4 * P + 8) + P) ∧ + (∀ k s x, ‖f k s x‖ ≤ 1) ∧ + (∀ k s, LipschitzWith ⟨Real.exp (1 + 6 * P + 12), Real.exp_nonneg _⟩ (f k s)) ∧ + ∀ x : Bool → Unit → ℝ, (∀ s d, |x s d| ≤ R) → + ‖(D (x false (), x true ()) : ℂ) - ∑ k, c k * ∏ s, f k s (x s)‖ ≤ ε := by + let P := 3 * q + 4 + have hP : 0 ≤ P := by dsimp [P]; linarith + have hqP : q ≤ P := by dsimp [P]; linarith + have hcap : ((K * K : ℝ≥0) : ℝ) ≤ Real.exp P := by + change (K : ℝ) * K ≤ Real.exp P + calc + _ ≤ Real.exp q * Real.exp q := mul_le_mul hK hK K.coe_nonneg (Real.exp_pos _).le + _ = Real.exp (q + q) := (Real.exp_add _ _).symm + _ ≤ Real.exp P := Real.exp_le_exp.mpr (by dsimp [P]; linarith) + have hfour : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + have hLipCap : ((K * (K * (2 * K)) + K * (K * (2 * K)) : ℝ≥0) : ℝ) ≤ Real.exp P := by + push_cast + calc + _ = 4 * (K : ℝ) ^ 3 := by ring + _ ≤ Real.exp 4 * (Real.exp q) ^ 3 := + mul_le_mul hfour (pow_le_pow_left₀ K.coe_nonneg hK 3) + (pow_nonneg K.coe_nonneg _) (Real.exp_pos _).le + _ = Real.exp P := by rw [← Real.exp_nat_mul, ← Real.exp_add]; congr 1; dsimp [P]; ring + have he : LipschitzWith 1 + (fun x : Bool → Unit → ℝ => (x false (), x true ())) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simp only [NNReal.coe_one, one_mul, Prod.dist_eq] + exact max_le ((dist_le_pi_dist _ _ ()).trans (dist_le_pi_dist x y false)) + ((dist_le_pi_dist _ _ ()).trans (dist_le_pi_dist x y true)) + let F : (Bool → Unit → ℝ) → ℂ := fun x => D (x false (), x true ()) + have hFLip : LipschitzWith (K * (K * (2 * K)) + K * (K * (2 * K))) F := by + simpa only [mul_one, one_mul, Function.comp_def] using + Complex.isometry_ofReal.lipschitzWith.comp (hLip.comp he) + have hFA (x) : ‖F x‖ ≤ (K * K : ℝ≥0) := by + simpa only [F, Complex.norm_real, Real.norm_of_nonneg (hD _).1, NNReal.coe_mul] using + (hD _).2 + obtain ⟨n, hn, c, f, hc, hf, hLf, herr⟩ := + exists_grouped_site_approximation F (K * K) (K * (K * (2 * K)) + K * (K * (2 * K))) + hFA hFLip hR hε hP (hRq.trans (Real.exp_le_exp.mpr hqP)) hcap hLipCap + (hεq.trans (Real.exp_le_exp.mpr hqP)) + exact ⟨n, hn, c, f, by simpa using hc, hf, by simpa using hLf, herr⟩ + +end Erdos3 + +namespace Erdos3.SlicedProductBlock + +open MeasureTheory +open scoped BigOperators NNReal Classical + +theorem averagedTwoSiteDensity_site_expansion + {ι P : Type*} [Fintype ι] [MeasurableSpace P] + (μ : Measure P) [IsProbabilityMeasure μ] (B : P → Fin 4 → SlicedProductBlock ι) + (hBm : ∀ j, MeasurableFamily (fun p => B p j)) + (hB : ∀ p j, (B p j).Admissible) {c δ : ℝ} (hc : 0 < c) (hδ : 0 < δ) + (hcoeff : ∀ p j, c ≤ |(B p j).coefficient|) + (hlast : ∀ p j, δ ≤ (B p j).lastWidth) (hwidth : ∀ p j i, δ ≤ (B p j).width i) + {q R ε : ℝ} (hq : 0 ≤ q) + (hK : (uniformCap ι (c * δ ^ (Fintype.card ι + 1)) (mul_pos hc (pow_pos hδ _)) : ℝ) ≤ Real.exp q) + (hR : 0 < R) (hRq : R ≤ Real.exp q) (hε : 0 < ε) (hεq : ε⁻¹ ≤ Real.exp q) : + let Q := 3 * q + 4 + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + ∃ (a : (Bool × Unit → Fin n) → ℂ) + (f : (Bool × Unit → Fin n) → Bool → (Unit → ℝ) → ℂ), + (∑ k, ‖a k‖) ≤ Real.exp (2 * (4 * Q + 8) + Q) ∧ + (∀ k s x, ‖f k s x‖ ≤ 1) ∧ + (∀ k s, LipschitzWith ⟨Real.exp (1 + 6 * Q + 12), Real.exp_nonneg _⟩ (f k s)) ∧ + ∀ x : Bool → Unit → ℝ, (∀ s d, |x s d| ≤ R) → + ‖(densityMixture μ (fun p => twoSiteDensity (B p)) (x false (), x true ()) : ℂ) - + ∑ k, a k * ∏ s, f k s (x s)‖ ≤ ε := by + have h := averagedTwoSiteDensity_uniform_bound μ B hBm hB hc hδ hcoeff hlast hwidth + exact scalarPair_site_expansion _ _ h.1 h.2 hq hK hR hRq hε hεq + +end Erdos3.SlicedProductBlock + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SlicedPairAmplitude.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedPairAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8a3f739193e4aa8f9b580b92605fd126b8ad67a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedPairAmplitude.lean @@ -0,0 +1,182 @@ +import OAI.Combinatorics.Progressions.Geometry.UnitBoxAmplitude + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +structure SlicedProductBlock (ι : Type*) where + coefficient : ℝ + lower : ι → ℝ + width : ι → ℝ + lastLower : ℝ + lastWidth : ℝ + +namespace SlicedProductBlock + +variable {ι : Type*} [Fintype ι] + +structure Admissible (B : SlicedProductBlock ι) : Prop where + coefficient_ne_zero : B.coefficient ≠ 0 + lower_nonneg : ∀ i, 0 ≤ B.lower i + width_pos : ∀ i, 0 < B.width i + lastWidth_pos : 0 < B.lastWidth + +noncomputable def prefixProduct (B : SlicedProductBlock ι) (x : ι → ℝ) : ℝ := + ∏ i, (B.lower i + B.width i * x i) + +noncomputable def value (B : SlicedProductBlock ι) (x : ι → ℝ) (u : ℝ) : ℝ := + B.coefficient * B.prefixProduct x * (B.lastLower + B.lastWidth * u) + +noncomputable def slope (B : SlicedProductBlock ι) (x : ι → ℝ) : ℝ := + B.coefficient * B.lastWidth * B.prefixProduct x + +noncomputable def base (B : SlicedProductBlock ι) (x : ι → ℝ) : ℝ := + B.coefficient * B.lastLower * B.prefixProduct x + +noncomputable def volumeScale (B : SlicedProductBlock ι) : ℝ := + |B.coefficient| * B.lastWidth * ∏ i, B.width i + +theorem value_eq (B : SlicedProductBlock ι) (x : ι → ℝ) (u : ℝ) : + B.value x u = B.base x + B.slope x * u := by + unfold value base slope + ring + +theorem prefixProduct_continuous (B : SlicedProductBlock ι) : Continuous B.prefixProduct := by + unfold prefixProduct + fun_prop + +theorem slope_continuous (B : SlicedProductBlock ι) : Continuous B.slope := + continuous_const.mul B.prefixProduct_continuous + +theorem base_continuous (B : SlicedProductBlock ι) : Continuous B.base := + continuous_const.mul B.prefixProduct_continuous + +theorem volumeScale_pos {B : SlicedProductBlock ι} (hB : B.Admissible) : 0 < B.volumeScale := + mul_pos (mul_pos (abs_pos.mpr hB.coefficient_ne_zero) hB.lastWidth_pos) + (Finset.prod_pos (fun i _ => hB.width_pos i)) + +theorem prefixProduct_nonneg {B : SlicedProductBlock ι} (hB : B.Admissible) + {x : ι → ℝ} (hx : ∀ i, x i ∈ Set.Ioc (0 : ℝ) 1) : 0 ≤ B.prefixProduct x := + Finset.prod_nonneg (fun i _ => add_nonneg (hB.lower_nonneg i) + (mul_nonneg (hB.width_pos i).le (hx i).1.le)) + +theorem slope_lower {B : SlicedProductBlock ι} (hB : B.Admissible) + {x : ι → ℝ} (hx : ∀ i, x i ∈ Set.Ioc (0 : ℝ) 1) : + B.volumeScale * (∏ i, x i) ≤ |B.slope x| := by + have hp : (∏ i, B.width i) * (∏ i, x i) ≤ B.prefixProduct x := by + rw [← Finset.prod_mul_distrib] + exact Finset.prod_le_prod₀ + (fun i _ => mul_nonneg (hB.width_pos i).le (hx i).1.le) + (fun i _ => le_add_of_nonneg_left (hB.lower_nonneg i)) + have h := mul_le_mul_of_nonneg_left hp + (mul_nonneg (abs_nonneg B.coefficient) hB.lastWidth_pos.le) + simpa only [volumeScale, slope, abs_mul, abs_of_pos hB.lastWidth_pos, + abs_of_nonneg (prefixProduct_nonneg hB hx), mul_assoc] using h + +theorem volumeScale_lower {B : SlicedProductBlock ι} {c δ : ℝ} (_hc : 0 ≤ c) (hδ : 0 ≤ δ) + (hcoeff : c ≤ |B.coefficient|) (hlast : δ ≤ B.lastWidth) (hwidth : ∀ i, δ ≤ B.width i) : + c * δ ^ (Fintype.card ι + 1) ≤ B.volumeScale := by + have hp : δ ^ Fintype.card ι ≤ ∏ i, B.width i := by + have h := Finset.prod_le_prod₀ (s := Finset.univ) (fun _ _ => hδ) (fun i _ => hwidth i) + simpa only [Finset.prod_const, Finset.card_univ] using h + have h := mul_le_mul (mul_le_mul hcoeff hlast hδ (abs_nonneg _)) hp + (pow_nonneg hδ _) (mul_nonneg (abs_nonneg _) (hδ.trans hlast)) + simpa only [volumeScale, pow_succ, mul_assoc, mul_left_comm, mul_comm] using h + +end SlicedProductBlock + +end Erdos3 + +end + +section + +namespace Erdos3.SlicedProductBlock + +open MeasureTheory +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] + +noncomputable def pairScale (A B : SlicedProductBlock ι) : ℝ := min A.volumeScale B.volumeScale + +noncomputable def pairWidth (A B : SlicedProductBlock ι) (p : (ι → ℝ) × (ι → ℝ)) : ℝ := + max |A.slope p.1| |B.slope p.2| + +theorem pairScale_pos {A B : SlicedProductBlock ι} (hA : A.Admissible) (hB : B.Admissible) : + 0 < pairScale A B := lt_min (volumeScale_pos hA) (volumeScale_pos hB) + +theorem pairWidth_measurable (A B : SlicedProductBlock ι) : Measurable (pairWidth A B) := + ((A.slope_continuous.measurable.comp measurable_fst).abs).max + (B.slope_continuous.measurable.comp measurable_snd).abs + +theorem pairWidth_lower {A B : SlicedProductBlock ι} (hA : A.Admissible) (hB : B.Admissible) : + ∀ᵐ p ∂(unitBoxMeasure ι).prod (unitBoxMeasure ι), + pairScale A B * pairedAmplitude p ≤ pairWidth A B p := by + filter_upwards [Measure.quasiMeasurePreserving_fst.ae (unitBoxMeasure_ae (ι := ι)), + Measure.quasiMeasurePreserving_snd.ae (unitBoxMeasure_ae (ι := ι))] with p hp hq + have hleft : pairScale A B * (∏ i, p.1 i) ≤ |A.slope p.1| := + (mul_le_mul_of_nonneg_right (min_le_left _ _) (Finset.prod_nonneg (fun i _ => (hp i).1.le))).trans + (slope_lower hA hp) + have hright : pairScale A B * (∏ i, p.2 i) ≤ |B.slope p.2| := + (mul_le_mul_of_nonneg_right (min_le_right _ _) (Finset.prod_nonneg (fun i _ => (hq i).1.le))).trans + (slope_lower hB hq) + change pairScale A B * max (∏ i, p.1 i) (∏ i, p.2 i) ≤ _ + rw [mul_max_of_nonneg _ _ (pairScale_pos hA hB).le] + exact max_le_max hleft hright + +theorem pairWidth_pos {A B : SlicedProductBlock ι} (hA : A.Admissible) (hB : B.Admissible) : + ∀ᵐ p ∂(unitBoxMeasure ι).prod (unitBoxMeasure ι), 0 < pairWidth A B p := by + filter_upwards [pairWidth_lower hA hB, pairedAmplitude_pos_ae (ι := ι)] with p hp hpos + exact (mul_pos (pairScale_pos hA hB) hpos).trans_le hp + +theorem pairWidth_inverse_bound {A B : SlicedProductBlock ι} (hA : A.Admissible) (hB : B.Admissible) : + ∀ᵐ p ∂(unitBoxMeasure ι).prod (unitBoxMeasure ι), + (pairWidth A B p)⁻¹ ≤ (pairScale A B)⁻¹ * (pairedAmplitude p)⁻¹ := by + filter_upwards [pairWidth_lower hA hB, pairedAmplitude_pos_ae (ι := ι)] with p hp hpos + have hlow := mul_pos (pairScale_pos hA hB) hpos + rw [← mul_inv] + exact (inv_le_inv₀ (hlow.trans_le hp) hlow).mpr hp + +theorem pairWidth_inverse_integrable {A B : SlicedProductBlock ι} + (hA : A.Admissible) (hB : B.Admissible) : + Integrable (fun p => (pairWidth A B p)⁻¹) ((unitBoxMeasure ι).prod (unitBoxMeasure ι)) := by + apply (pairedAmplitude_inverse_integrable.const_mul (pairScale A B)⁻¹).mono' + (pairWidth_measurable A B).inv.aestronglyMeasurable + filter_upwards [pairWidth_inverse_bound hA hB, pairWidth_pos hA hB] with p hp hpos + change ‖(pairWidth A B p)⁻¹‖ ≤ _ + rw [Real.norm_of_nonneg (inv_nonneg.mpr hpos.le)] + exact hp + +noncomputable def pairCap (A B : SlicedProductBlock ι) : ℝ := + (pairScale A B)⁻¹ * 4 ^ Fintype.card ι + +theorem pairCap_pos {A B : SlicedProductBlock ι} (hA : A.Admissible) (hB : B.Admissible) : + 0 < pairCap A B := mul_pos (inv_pos.mpr (pairScale_pos hA hB)) (by positivity) + +theorem pairWidth_inverse_integral_le {A B : SlicedProductBlock ι} + (hA : A.Admissible) (hB : B.Admissible) : + (∫ p, (pairWidth A B p)⁻¹ ∂(unitBoxMeasure ι).prod (unitBoxMeasure ι)) ≤ pairCap A B := by + have h := integral_mono_ae (pairWidth_inverse_integrable hA hB) + (pairedAmplitude_inverse_integrable.const_mul (pairScale A B)⁻¹) (pairWidth_inverse_bound hA hB) + rw [integral_const_mul] at h + exact h.trans (mul_le_mul_of_nonneg_left pairedAmplitude_inverse_integral_le + (inv_nonneg.mpr (pairScale_pos hA hB).le)) + +theorem pairCap_le_of_scale_lower {A B : SlicedProductBlock ι} {r : ℝ} + (hr : 0 < r) (hA : r ≤ A.volumeScale) (hB : r ≤ B.volumeScale) : + pairCap A B ≤ r⁻¹ * 4 ^ Fintype.card ι := by + have hscale : r ≤ pairScale A B := le_min hA hB + exact mul_le_mul_of_nonneg_right + ((inv_le_inv₀ (hr.trans_le hscale) hr).mpr hscale) (by positivity) + +end Erdos3.SlicedProductBlock + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SlicedPrincipalInverse.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedPrincipalInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf9a825a463ca9aa2bd65fbc1fab3a7318a5c0e7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedPrincipalInverse.lean @@ -0,0 +1,208 @@ +import OAI.Combinatorics.Progressions.Probability.SlicedRemainderDensityFamily + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators ContDiff NNReal + +variable {B F : Type*} [Fintype B] [Fintype F] [DecidableEq B] [DecidableEq F] + +omit [DecidableEq B] [DecidableEq F] in +theorem principalSliceValue_contDiff (c : B → ℝ) (lower width : B × F → ℝ) : + ContDiff ℝ ∞ (principalSliceValue c lower width) := by + unfold principalSliceValue + fun_prop + +noncomputable def principalSliceSlope (c : B → ℝ) (lower width : B × F → ℝ) + (x : B × F → ℝ) (b : B) (i : F) : ℝ := + c b * width (b, i) * ∏ j ∈ Finset.univ.erase i, + (lower (b, j) + width (b, j) * x (b, j)) + +theorem principalSliceValue_fderiv_single (c : B → ℝ) (lower width : B × F → ℝ) + (x : B × F → ℝ) (b : B) (i : F) : + fderiv ℝ (principalSliceValue c lower width) x (Pi.single (b, i) 1) = + principalSliceSlope c lower width x b i := by + let g := fun b j (y : B × F → ℝ) => lower (b, j) + width (b, j) * y (b, j) + have hd (b : B) (j : F) : HasFDerivAt (g b j) + (width (b, j) • (ContinuousLinearMap.proj (b, j) : (B × F → ℝ) →L[ℝ] ℝ)) x := by + have he : HasFDerivAt (fun y : B × F → ℝ => y (b, j)) + (ContinuousLinearMap.proj (b, j) : (B × F → ℝ) →L[ℝ] ℝ) x := + hasFDerivAt_apply (b, j) x + simpa only [g] using (he.const_mul (width (b, j))).const_add (lower (b, j)) + have hp (b : B) := HasFDerivAt.finsetProd (u := Finset.univ) (fun j _ => hd b j) + have hs := HasFDerivAt.fun_sum (u := Finset.univ) (fun b _ => (hp b).const_mul (c b)) + change fderiv ℝ (fun y => ∑ b, c b * ∏ j, g b j y) x (Pi.single (b, i) 1) = _ + rw [hs.fderiv] + simp only [sum_apply, smul_apply, ContinuousLinearMap.proj_apply, smul_eq_mul] + rw [Finset.sum_eq_single b] + · rw [Finset.sum_eq_single i] + · simp only [Pi.single_eq_same, mul_one, principalSliceSlope, g] + ring + · intro j _ hji + simp [hji] + · simp + · intro b' _ hbb + simp [hbb] + · simp + +omit [Fintype B] [DecidableEq B] in +theorem principalSliceSlope_lower (c : B → ℝ) (lower width : B × F → ℝ) + (x : B × F → ℝ) (b : B) (i : F) {a δ r : ℝ} + (ha : 0 ≤ a) (hδ : 0 ≤ δ) (hr : 0 ≤ r) (hc : a ≤ |c b|) + (hw : ∀ j, δ ≤ width (b, j)) + (hlower : ∀ j ≠ i, 0 ≤ lower (b, j)) (hx : ∀ j ≠ i, r ≤ x (b, j)) : + a * δ * (δ * r) ^ (Fintype.card F - 1) ≤ |principalSliceSlope c lower width x b i| := by + have hfactor (j) (hj : j ∈ Finset.univ.erase i) : + δ * r ≤ lower (b, j) + width (b, j) * x (b, j) := by + have hji := Finset.ne_of_mem_erase hj + exact (mul_le_mul (hw j) (hx j hji) hr (hδ.trans (hw j))).trans + (le_add_of_nonneg_left (hlower j hji)) + have hprod : (δ * r) ^ (Fintype.card F - 1) ≤ + ∏ j ∈ Finset.univ.erase i, (lower (b, j) + width (b, j) * x (b, j)) := by + have h := Finset.prod_le_prod₀ (s := Finset.univ.erase i) + (fun _ _ => mul_nonneg hδ hr) hfactor + simpa only [Finset.prod_const, Finset.card_erase_of_mem (Finset.mem_univ i), + Finset.card_univ] using h + have hp0 := (pow_nonneg (mul_nonneg hδ hr) (Fintype.card F - 1)).trans hprod + rw [principalSliceSlope, abs_mul, abs_mul, abs_of_nonneg (hδ.trans (hw i)), + abs_of_nonneg hp0] + exact mul_le_mul (mul_le_mul hc (hw i) hδ (ha.trans hc)) hprod + (pow_nonneg (mul_nonneg hδ hr) _) (mul_nonneg (abs_nonneg _) (hδ.trans (hw i))) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal ContDiff BigOperators + +theorem scalar_identity_inverse_abs_bound {E : Type*} [NormedAddCommGroup E] + [NormedSpace ℝ E] {a : ℝ} (ha : a ≠ 0) : + (a • ContinuousLinearMap.id ℝ E).IsInvertible ∧ + ‖(a • ContinuousLinearMap.id ℝ E).inverse‖ ≤ |a|⁻¹ := by + let A := a • ContinuousLinearMap.id ℝ E + let B := a⁻¹ • ContinuousLinearMap.id ℝ E + have hAB : A.comp B = ContinuousLinearMap.id ℝ E := by + ext x + simp [A, B, smul_smul, ha] + have hBA : B.comp A = ContinuousLinearMap.id ℝ E := by + ext x + simp [A, B, smul_smul, ha] + refine ⟨ContinuousLinearMap.IsInvertible.of_inverse hAB hBA, ?_⟩ + change ‖A.inverse‖ ≤ _ + rw [ContinuousLinearMap.inverse_eq hAB hBA] + calc + ‖B‖ = |a|⁻¹ * ‖ContinuousLinearMap.id ℝ E‖ := by + simp only [B, norm_smul, Real.norm_eq_abs, abs_inv] + _ ≤ |a|⁻¹ := mul_le_of_le_one_right (inv_nonneg.mpr (abs_nonneg _)) + ContinuousLinearMap.norm_id_le + +variable {B F : Type*} [Fintype B] [Fintype F] [DecidableEq B] [DecidableEq F] + +noncomputable def principalSliceSingleton (c : B → ℝ) (lower width : B × F → ℝ) + (x : B × F → ℝ) : Unit → ℝ := fun _ => principalSliceValue c lower width x + +omit [DecidableEq B] [DecidableEq F] in +theorem principalSliceSingleton_contDiff (c : B → ℝ) (lower width : B × F → ℝ) : + ContDiff ℝ ∞ (principalSliceSingleton c lower width) := + contDiff_pi.mpr (fun _ => principalSliceValue_contDiff c lower width) + +theorem principalSliceSingleton_selectedDerivative (c : B → ℝ) (lower width : B × F → ℝ) + (x : B × F → ℝ) (b : B) (i : F) : + selectedDerivative (principalSliceSingleton c lower width) + (coordinateInjection (fun _ : Unit => (b, i))) x = + principalSliceSlope c lower width x b i • ContinuousLinearMap.id ℝ (Unit → ℝ) := by + have hd := (principalSliceSingleton_contDiff c lower width).differentiable (by norm_num) + have hh := principalSliceValue_fderiv_single c lower width x b i + change fderiv ℝ (fun y => principalSliceSingleton c lower width y ()) x + (Pi.single (b, i) 1) = _ at hh + rw [fderiv_apply (hd x) ()] at hh + change (fderiv ℝ (principalSliceSingleton c lower width) x (Pi.single (b, i) 1)) () = + principalSliceSlope c lower width x b i at hh + ext y u + cases u + have hJ : coordinateInjection (fun _ : Unit => (b, i)) y = + y () • (Pi.single (b, i) 1 : B × F → ℝ) := by + simp only [coordinateInjection_apply, Fintype.sum_unique, ← Pi.single_smul, smul_eq_mul, mul_one] + simp only [selectedDerivative, ContinuousLinearMap.comp_apply, hJ, map_smul, + smul_apply, Pi.smul_apply, smul_eq_mul, ContinuousLinearMap.id_apply, hh] + ring + +theorem principalSliceSingleton_inverse_bound (c : B → ℝ) (lower width : B × F → ℝ) + (x : B × F → ℝ) (b : B) (i : F) {κ : ℝ} (hκ : 0 < κ) + (hbound : κ ≤ |principalSliceSlope c lower width x b i|) : + (selectedDerivative (principalSliceSingleton c lower width) + (coordinateInjection (fun _ : Unit => (b, i))) x).IsInvertible ∧ + ‖(selectedDerivative (principalSliceSingleton c lower width) + (coordinateInjection (fun _ : Unit => (b, i))) x).inverse‖ ≤ κ⁻¹ := by + rw [principalSliceSingleton_selectedDerivative] + have h := scalar_identity_inverse_abs_bound + (E := Unit → ℝ) (abs_pos.mp (hκ.trans_le hbound)) + exact ⟨h.1, h.2.trans (inv_anti₀ hκ hbound)⟩ + +section Joint + +variable {D : Type*} [Fintype D] +variable {B F : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (F d)] +variable [∀ d, DecidableEq (B d)] [∀ d, DecidableEq (F d)] + +noncomputable def jointSlicedPrincipal (c : ∀ d, B d → ℝ) + (lower width : ∀ d, B d × F d → ℝ) := + sigmaAxisSampler (fun d => principalSliceSingleton (c d) (lower d) (width d)) + +noncomputable def jointSlicedInjection (b : ∀ d, B d) (i : ∀ d, F d) := + sigmaAxisOperator (fun d => coordinateInjection (fun _ : Unit => (b d, i d))) + +theorem jointSlicedInjection_norm_le (b : ∀ d, B d) (i : ∀ d, F d) : + ‖jointSlicedInjection b i‖ ≤ 1 := + sigmaAxisOperator_norm_le _ zero_le_one + (fun _ => coordinateInjection_norm_le _ (Function.injective_of_subsingleton _)) + +omit [∀ d, DecidableEq (B d)] [∀ d, DecidableEq (F d)] in +theorem jointSlicedPrincipal_contDiff (c : ∀ d, B d → ℝ) + (lower width : ∀ d, B d × F d → ℝ) : + ContDiff ℝ ∞ (jointSlicedPrincipal c lower width) := + sigmaAxisSampler_contDiff _ (fun d => principalSliceSingleton_contDiff (c d) (lower d) (width d)) + +theorem jointSlicedPrincipal_inverse_bound (c : ∀ d, B d → ℝ) + (lower width : ∀ d, B d × F d → ℝ) (b : ∀ d, B d) (i : ∀ d, F d) + (x : (Σ d, B d × F d) → ℝ) {κ : ℝ} (hκ : 0 < κ) + (hbound : ∀ d, κ ≤ |principalSliceSlope (c d) (lower d) (width d) + (sigmaAxisProjection (fun d => B d × F d) d x) (b d) (i d)|) : + (selectedDerivative (jointSlicedPrincipal c lower width) (jointSlicedInjection b i) x).IsInvertible ∧ + ‖(selectedDerivative (jointSlicedPrincipal c lower width) (jointSlicedInjection b i) x).inverse‖ ≤ κ⁻¹ := by + have hi (d) := principalSliceSingleton_inverse_bound (c d) (lower d) (width d) + (sigmaAxisProjection (fun d => B d × F d) d x) (b d) (i d) hκ (hbound d) + exact sigmaAxisSampler_inverse_bound _ _ x + (fun d => (principalSliceSingleton_contDiff (c d) (lower d) (width d)).differentiable + (by norm_num) _) (fun d => (hi d).1) (inv_nonneg.mpr hκ.le) (fun d => (hi d).2) + +theorem jointSlicedPrincipal_perturbed_inverse (c : ∀ d, B d → ℝ) + (lower width : ∀ d, B d × F d → ℝ) (b : ∀ d, B d) (i : ∀ d, F d) + (x : (Σ d, B d × F d) → ℝ) {κ : ℝ} (hκ : 0 < κ) + (hbound : ∀ d, κ ≤ |principalSliceSlope (c d) (lower d) (width d) + (sigmaAxisProjection (fun d => B d × F d) d x) (b d) (i d)|) + (V : ((Σ d, B d × F d) → ℝ) → ((Σ _d : D, Unit) → ℝ)) + (hsmall : κ⁻¹ * ‖fderiv ℝ V x - fderiv ℝ (jointSlicedPrincipal c lower width) x‖ ≤ 1 / 2) : + (selectedDerivative V (jointSlicedInjection b i) x).IsInvertible ∧ + ‖(selectedDerivative V (jointSlicedInjection b i) x).inverse‖ ≤ 2 * κ⁻¹ := by + have hi := jointSlicedPrincipal_inverse_bound c lower width b i x hκ hbound + apply selected_inverse_perturbation _ V (jointSlicedInjection b i) x hi.1 + ⟨κ⁻¹, inv_nonneg.mpr hκ.le⟩ hi.2 + exact (mul_le_mul_of_nonneg_left + (mul_le_of_le_one_right (norm_nonneg _) (jointSlicedInjection_norm_le b i)) + (inv_nonneg.mpr hκ.le)).trans hsmall + +end Joint + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SlicedSourceAccuracy.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedSourceAccuracy.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c088dea380a1091dd2dc83a2584e43a49f5daca --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedSourceAccuracy.lean @@ -0,0 +1,74 @@ +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +theorem exp_neg_le_exp_neg_div_eight {A B : ℝ} (hAB : B + 4 ≤ A) : + Real.exp (-A) ≤ Real.exp (-B) / 8 := by + have h2 : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have h8 : (8 : ℝ) ≤ Real.exp 4 := by + calc + 8 ≤ (2 : ℝ) ^ 4 := by norm_num + _ ≤ (Real.exp 1) ^ 4 := pow_le_pow_left₀ (by norm_num) h2 4 + _ = _ := by rw [← Real.exp_nat_mul]; norm_num + calc + _ ≤ Real.exp (-(B + 4)) := Real.exp_le_exp.mpr (by linarith) + _ = Real.exp (-B) / Real.exp 4 := by simp only [neg_add, Real.exp_add, Real.exp_neg, div_eq_mul_inv] + _ ≤ _ := div_le_div_of_nonneg_left (Real.exp_pos _).le (by norm_num) h8 + +theorem exp_neg_le_half_exp_neg {A B : ℝ} (hAB : B + 1 ≤ A) : + Real.exp (-A) ≤ (1 / 2) * Real.exp (-B) := by + have h2 : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + _ ≤ Real.exp (-(B + 1)) := Real.exp_le_exp.mpr (by linarith) + _ = Real.exp (-B) / Real.exp 1 := by simp only [neg_add, Real.exp_add, Real.exp_neg, div_eq_mul_inv] + _ ≤ Real.exp (-B) / 2 := div_le_div_of_nonneg_left (Real.exp_pos _).le (by norm_num) h2 + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem slicedSourceAccuracy_bounds {Q G E : ℝ} (hQ : 0 ≤ Q) (hG : 0 ≤ G) (hE : 0 ≤ E) : + let εgrid := Real.exp (-(Q + E + 1)) + let εlong := Real.exp (-(G + E + 1)) + 0 < εgrid ∧ εgrid ≤ 1 ∧ εgrid⁻¹ = Real.exp (Q + E + 1) ∧ + 0 < εlong ∧ εlong ≤ 1 ∧ εlong⁻¹ = Real.exp (G + E + 1) ∧ + ∀ C : ℝ, C ≤ Real.exp G → Real.exp Q * εgrid + εlong * C ≤ Real.exp (-E) := by + intro εgrid εlong + have hg : εgrid ≤ 1 := Real.exp_le_one_iff.mpr (by linarith only [hQ, hE]) + have hl : εlong ≤ 1 := Real.exp_le_one_iff.mpr (by linarith only [hG, hE]) + refine ⟨Real.exp_pos _, hg, ?_, Real.exp_pos _, hl, ?_, ?_⟩ + · simp only [εgrid, Real.exp_neg, inv_inv] + · simp only [εlong, Real.exp_neg, inv_inv] + · intro C hC + have hhalf := exp_neg_le_half_exp_neg (A := E + 1) (B := E) le_rfl + have hgrid : Real.exp Q * εgrid = Real.exp (-(E + 1)) := by + dsimp [εgrid] + rw [← Real.exp_add] + congr 1 + ring + have hlong : εlong * Real.exp G = Real.exp (-(E + 1)) := by + dsimp [εlong] + rw [← Real.exp_add] + congr 1 + ring + calc + _ ≤ Real.exp Q * εgrid + εlong * Real.exp G := + add_le_add le_rfl (mul_le_mul_of_nonneg_left hC (Real.exp_nonneg _)) + _ = 2 * Real.exp (-(E + 1)) := by rw [hgrid, hlong]; ring + _ ≤ Real.exp (-E) := by linarith only [hhalf] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SlicedSourceUniformAccuracy.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedSourceUniformAccuracy.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca227ab280d68dce8381ea224b56d61a418ef0e7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedSourceUniformAccuracy.lean @@ -0,0 +1,44 @@ +import OAI.Combinatorics.Progressions.Dynamics.SlicedSourceErrorBudget + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators + +theorem exists_slicedSourceUniformAccuracy (O m : ℕ) {Pcap E F a δ : ℝ} + (hPcap : 0 ≤ Pcap) (hE : 0 ≤ E) (hF : 0 ≤ F) + (ha : a⁻¹ ≤ Real.exp Pcap) (hδ : δ⁻¹ ≤ Real.exp Pcap) : + ∃ εgrid : ℝ, 0 < εgrid ∧ εgrid ≤ 1 ∧ + εgrid⁻¹ = Real.exp (VectorPolynomial.slicedJointDensityLogBudget O m Pcap + (E + F) + 1) ∧ + ∀ (ι : Type*) [Fintype ι] (Op : ℝ), + ∃ εlong P : ℝ, 0 < εlong ∧ εlong ≤ 1 ∧ εlong⁻¹ ≤ Real.exp P ∧ + 0 ≤ P ∧ a⁻¹ ≤ Real.exp P ∧ δ⁻¹ ≤ Real.exp P ∧ 4 ≤ Real.exp P ∧ + ∀ C : ℝ, 0 ≤ C → C ≤ Real.exp F → + C * (Real.exp (VectorPolynomial.slicedJointDensityLogBudget O m Pcap) * εgrid + + εlong * ∏ _i : ι, Real.exp Op) ≤ Real.exp (-E) := by + let Qcap := VectorPolynomial.slicedJointDensityLogBudget O m Pcap + let εgrid := Real.exp (-(Qcap + (E + F) + 1)) + have hg := slicedSourceErrorBudget (ι := Empty) O m (Op := 0) + hPcap hE hF (Real.exp_nonneg F) le_rfl ha hδ + refine ⟨εgrid, hg.1, hg.2.1, hg.2.2.1, ?_⟩ + intro ι hι Op + let G := (Fintype.card ι : ℝ) * max Op 0 + let εlong := Real.exp (-(G + (E + F) + 1)) + let P := max Pcap (G + (E + F) + 2) + obtain ⟨_, _, _, hl0, hl1, hli, hP, haP, hδP, h4, herr⟩ := + slicedSourceErrorBudget (ι := ι) O m (Op := Op) + hPcap hE hF (Real.exp_nonneg F) le_rfl ha hδ + refine ⟨εlong, P, hl0, hl1, hli, hP, haP, hδP, h4, ?_⟩ + intro C hC0 hC + have hb : 0 ≤ Real.exp Qcap * εgrid + εlong * ∏ _i : ι, Real.exp Op := by + exact add_nonneg (mul_nonneg (Real.exp_nonneg _) hg.1.le) + (mul_nonneg hl0.le (Finset.prod_nonneg (fun _ _ => Real.exp_nonneg _))) + exact (mul_le_mul_of_nonneg_right hC hb).trans herr + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SlicedToleranceMonotonicity.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedToleranceMonotonicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..d55394f3b4ce63309f9b978fa7711de9f9fb6e4e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedToleranceMonotonicity.lean @@ -0,0 +1,95 @@ +import OAI.Combinatorics.Progressions.Polynomial.SlicedPolynomialPerturbation + +namespace OAI + +section + +namespace Erdos3 + +theorem slicedPrincipalBoundaryRadius_antitone {N N' : ℕ} (hN : N ≤ N') + {η : ℝ} (hη : 0 ≤ η) : + slicedPrincipalBoundaryRadius N' η ≤ slicedPrincipalBoundaryRadius N η := by + unfold slicedPrincipalBoundaryRadius + apply min_le_min le_rfl + apply div_le_div_of_nonneg_left hη (by positivity) + gcongr + +theorem slicedPrincipalComparisonBudget_mono {N N' m : ℕ} (hN : N ≤ N') + {C A r r' κ κ' : ℝ} (hC : 0 ≤ C) (hA : 0 ≤ A) + (hr' : 0 < r') (hr : r' ≤ r) (hκ' : 0 < κ') (hκ : κ' ≤ κ) : + slicedPrincipalComparisonBudget N m C A r κ ≤ + slicedPrincipalComparisonBudget N' m C A r' κ' := by + have hri : 0 < r := hr'.trans_le hr + have hκi : 0 < κ := hκ'.trans_le hκ + have hi : κ⁻¹ ≤ κ'⁻¹ := inv_anti₀ hκ' hκ + unfold slicedPrincipalComparisonBudget + gcongr + +theorem polynomialPerturbationScale_antitone {K K' M Q Q' τ : ℝ} {O O' : ℕ} + (hK : 0 ≤ K) (hKK : K ≤ K') (hM : 0 ≤ M) (hQ : 0 ≤ Q) (hQQ : Q ≤ Q') + (hO : O ≤ O') : + polynomialPerturbationScale K' M Q' τ O' ≤ polynomialPerturbationScale K M Q τ O := by + unfold polynomialPerturbationScale + apply min_le_min le_rfl + apply min_le_min + · apply div_le_div_of_nonneg_left zero_le_one (by positivity) + gcongr + · apply div_le_div_of_nonneg_left (sq_nonneg _) (by positivity) + gcongr + +theorem slicedPrincipalC2Tolerance_antitone {N N' O O' m : ℕ} (hN : N ≤ N') (hO : O ≤ O') + {C a δ A η : ℝ} (hC : 0 ≤ C) (ha : 0 < a) (hδ : 0 < δ) (hA : 0 ≤ A) (hη : 0 < η) : + slicedPrincipalC2Tolerance N' O' m C a δ A η ≤ slicedPrincipalC2Tolerance N O m C a δ A η := by + let r := slicedPrincipalBoundaryRadius N η + let r' := slicedPrincipalBoundaryRadius N' η + have hr : 0 < r := (slicedPrincipalBoundaryRadius_spec N hη).1 + have hr' : 0 < r' := (slicedPrincipalBoundaryRadius_spec N' hη).1 + have hrr : r' ≤ r := slicedPrincipalBoundaryRadius_antitone hN hη.le + let κ := a * δ * (δ * r) ^ m + let κ' := a * δ * (δ * r') ^ m + have hκ : 0 < κ := mul_pos (mul_pos ha hδ) (pow_pos (mul_pos hδ hr) _) + have hκ' : 0 < κ' := mul_pos (mul_pos ha hδ) (pow_pos (mul_pos hδ hr') _) + have hκκ : κ' ≤ κ := by + dsimp only [κ, κ'] + gcongr + exact polynomialPerturbationScale_antitone (inv_nonneg.mpr hκ.le) (inv_anti₀ hκ' hκκ) + zero_le_one (slicedPrincipalComparisonBudget_nonneg N m hC hA hr hκ) + (slicedPrincipalComparisonBudget_mono hN hC hA hr' hrr hκ' hκκ) hO + +theorem slicedPrincipalC2Tolerance_pos_le_one (N O m : ℕ) + {C a δ A η : ℝ} (hC : 0 ≤ C) (ha : 0 < a) (hδ : 0 < δ) (hA : 0 ≤ A) (hη : 0 < η) : + 0 < slicedPrincipalC2Tolerance N O m C a δ A η ∧ + slicedPrincipalC2Tolerance N O m C a δ A η ≤ 1 := by + let r := slicedPrincipalBoundaryRadius N η + have hr : 0 < r := (slicedPrincipalBoundaryRadius_spec N hη).1 + have hκ : 0 < a * δ * (δ * r) ^ m := mul_pos (mul_pos ha hδ) (pow_pos (mul_pos hδ hr) _) + have ht := polynomialPerturbationScale_spec (inv_nonneg.mpr hκ.le) zero_le_one + (slicedPrincipalComparisonBudget_nonneg N m hC hA hr hκ) (half_pos hη) O + exact ⟨ht.1, ht.2.1⟩ + +theorem slicedEndpointUniformScale_spec (N O m : ℕ) + {a δ A η : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hA : 0 ≤ A) (hη : 0 < η) : + let t := slicedPolynomialScale N O N m m 1 1 a δ A η + 0 < t ∧ t ≤ 1 ∧ + ∀ (N' O' : ℕ), N' ≤ N → O' ≤ O → ∀ s : ℝ, |s| ≤ t → + |s| * polynomialMassC2Budget N' m 1 ≤ slicedPrincipalC2Tolerance N' O' m 1 a δ A η := by + let ε := slicedPrincipalC2Tolerance N O m 1 a δ A η + have hε := slicedPrincipalC2Tolerance_pos_le_one N O m zero_le_one ha hδ hA hη + have hM : 0 ≤ polynomialMassC2Budget N m 1 := polynomialMassC2Budget_nonneg N m zero_le_one + have ht : 0 < ε / (1 + polynomialMassC2Budget N m 1) := div_pos hε.1 (by positivity) + have htε : ε / (1 + polynomialMassC2Budget N m 1) ≤ ε := div_le_self hε.1.le (by linarith) + refine ⟨ht, htε.trans hε.2, ?_⟩ + intro N' O' hN hO s hs + have hMN : polynomialMassC2Budget N' m 1 ≤ polynomialMassC2Budget N m 1 := by + unfold polynomialMassC2Budget + gcongr + have hh := (le_div_iff₀ (by positivity : 0 < 1 + polynomialMassC2Budget N m 1)).mp hs + have hsmall : |s| * polynomialMassC2Budget N m 1 ≤ ε := by nlinarith [abs_nonneg s] + exact ((mul_le_mul_of_nonneg_left hMN (abs_nonneg s)).trans hsmall).trans + (slicedPrincipalC2Tolerance_antitone hN hO zero_le_one ha hδ hA hη) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SlicedUniformTailTolerance.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedUniformTailTolerance.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f5322bfc5c9f3c7b3bf61b52174d286f8c3b33a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SlicedUniformTailTolerance.lean @@ -0,0 +1,51 @@ +import OAI.Combinatorics.Progressions.Dynamics.PreparedPerturbativeSeedPowerBudget + +namespace OAI + +section + +namespace Erdos3 + +theorem slicedEndpointUniformScale_exp_lower (N O m : ℕ) + {a δ A η P : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hA : 0 ≤ A) (hη : 0 < η) (hP : 0 ≤ P) + (hN : (N : ℝ) + 1 ≤ Real.exp P) (hO : (O : ℝ) ≤ Real.exp P) (hm : (m : ℝ) ≤ Real.exp P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + (hAP : A ≤ Real.exp P) (hηP : η⁻¹ ≤ Real.exp P) : + Real.exp (-(48 * ((3 * P + 4) * m + 5 * P + 10) + 2 * P + 2 * m + 47)) ≤ + slicedPolynomialScale N O N m m 1 1 a δ A η := by + have hpos := (slicedEndpointUniformScale_spec N O m ha hδ hA hη).1 + have hinv := slicedEndpointUniformScale_inverse_le_exp N O m + ha hδ hA hη hP hN hO hm haP hδP hAP hηP + have h := one_div_le_one_div_of_le (inv_pos.mpr hpos) hinv + simpa only [one_div, inv_inv, ← Real.exp_neg] using h + +theorem slicedEndpointUniformScale_exp_lower_div (N O m : ℕ) + {a δ A η P : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hA : 0 ≤ A) (hη : 0 < η) (hP : 0 ≤ P) + (hN : (N : ℝ) + 1 ≤ Real.exp P) (hO : (O : ℝ) ≤ Real.exp P) (hm : (m : ℝ) ≤ Real.exp P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + (hAP : A ≤ Real.exp P) (hηP : η⁻¹ ≤ Real.exp P) : + Real.exp (-(48 * ((3 * P + 4) * m + 5 * P + 10) + 2 * P + 2 * m + 47)) ≤ + slicedPrincipalC2Tolerance N O m 1 a δ A η / (1 + polynomialMassC2Budget N m 1) := + slicedEndpointUniformScale_exp_lower N O m ha hδ hA hη hP hN hO hm haP hδP hAP hηP + +theorem slicedEndpointUniformScale_exp_tail_tolerance (N O m : ℕ) + {a δ A η P : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hA : 0 ≤ A) (hη : 0 < η) (hP : 0 ≤ P) + (hN : (N : ℝ) + 1 ≤ Real.exp P) (hO : (O : ℝ) ≤ Real.exp P) (hm : (m : ℝ) ≤ Real.exp P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + (hAP : A ≤ Real.exp P) (hηP : η⁻¹ ≤ Real.exp P) + (N' O' : ℕ) (hN' : N' ≤ N) (hO' : O' ≤ O) : + Real.exp (-(48 * ((3 * P + 4) * m + 5 * P + 10) + 2 * P + 2 * m + 47)) * + polynomialMassC2Budget N' m 1 ≤ + slicedPrincipalC2Tolerance N' O' m 1 a δ A η := by + have hs := slicedEndpointUniformScale_exp_lower N O m + ha hδ hA hη hP hN hO hm haP hδP hAP hηP + have h := (slicedEndpointUniformScale_spec N O m ha hδ hA hη).2.2 N' O' hN' hO' + (Real.exp (-(48 * ((3 * P + 4) * m + 5 * P + 10) + 2 * P + 2 * m + 47))) + (by simpa only [abs_of_pos (Real.exp_pos _)] using hs) + simpa only [abs_of_pos (Real.exp_pos _)] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SlowInverseControl.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SlowInverseControl.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3a19fb11d67ff8d811493b92ca551e5d27e34a6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SlowInverseControl.lean @@ -0,0 +1,73 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialGridValues + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_slow_inverse_control (s r : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} (D : RationalFilteredNilmanifold L s d) (w : σ → ℕ), + (∀ i, 0 < w i) → ∀ (p : ℝ), 0 ≤ p → D.GeometryComplexityLE p → + (Fintype.card σ : ℝ) ≤ p → ∀ (T : σ → ℝ), (∀ i, 0 < T i) → + ∀ g : (D.filtration.realification.adaptedPolynomialFiltration w).Group, + D.filtration.PolynomialSlowBound D.basis w T (Real.exp ((p + 2) ^ r)) g → + (∀ (v : σ → ℝ), (∀ i, |v i| ≤ T i) → ∀ i, + |(D.basis.baseChange ℝ).repr (D.filtration.adaptedPolynomialRealValueHom w v g)⁻¹.coord i| ≤ + Real.exp ((p + 2) ^ C)) ∧ + (∀ (v z : σ → ℝ) (δ : ℝ), 0 ≤ δ → + (∀ i, |v i| ≤ T i) → (∀ i, |z i| ≤ T i) → + (∀ i, |v i - z i| ≤ T i * δ) → + letI := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + dist (D.filtration.adaptedPolynomialRealValueHom w v g)⁻¹ + (D.filtration.adaptedPolynomialRealValueHom w z g)⁻¹ ≤ + Real.exp ((p + 2) ^ C) * δ) := by + obtain ⟨A, _, hmetric⟩ := exists_polynomialSlowBound_dist_exp s r + let X : Polynomial ℕ := Polynomial.X + let P := Polynomial.C s * (X + 1) + (X + 2) ^ r + (X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_fixed_power_budget P + refine ⟨C, hC, ?_⟩ + intro σ L _ _ _ _ _ _ _ d D w hw p hp hD hσ T hT g hg + have hinv := (D.filtration.polynomialSlowBound_inv_iff D.basis w T _ g).mpr hg + have hsum : (s : ℝ) * (p + 1) + (p + 2) ^ r + (p + A) ^ A ≤ (p + 2) ^ C := by + simpa [P, X, Polynomial.eval₂_pow] using hbudget p hp + have hcoord : (s : ℝ) * (p + 1) + (p + 2) ^ r ≤ (p + 2) ^ C := + (le_add_of_nonneg_right (pow_nonneg (by positivity) _)).trans hsum + have hdist : (p + A) ^ A ≤ (p + 2) ^ C := + (le_add_of_nonneg_left (by positivity)).trans hsum + constructor + · intro v hv i + have hvbound := D.filtration.polynomialSlowBound_value D.basis w hw T hT + (Real.exp_pos _).le g⁻¹ hinv v hv i + rw [map_inv] at hvbound + apply hvbound.trans + have hn1 : (Fintype.card σ : ℝ) + 1 ≤ Real.exp p := by + linarith [Real.add_one_le_exp p] + calc + _ ≤ Real.exp s * (Real.exp p) ^ s * Real.exp ((p + 2) ^ r) := + mul_le_mul_of_nonneg_right + (mul_le_mul (Real.add_one_le_exp (s : ℝ)) + (pow_le_pow_left₀ (by positivity) hn1 _) (by positivity) (Real.exp_pos _).le) + (Real.exp_pos _).le + _ = Real.exp ((s : ℝ) * (p + 1) + (p + 2) ^ r) := by + rw [← Real.exp_nat_mul, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr hcoord + · intro v z δ hδ hv hz hvz + have hm := hmetric D w hw p hp hD hσ T hT g⁻¹ hinv v z δ hδ hv hz hvz + simp only [map_inv] at hm + exact hm.trans (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hdist) hδ) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmallDifferenceGrowth.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmallDifferenceGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..c111e45f7f5ca500cf484272ad1dfcbb2b30e8ff --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmallDifferenceGrowth.lean @@ -0,0 +1,31 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +open scoped Pointwise + +theorem higher_difference_card_le {G : Type*} [AddCommGroup G] [DecidableEq G] + (A : Finset G) (hA : A.Nonempty) {K : ℝ} + (hsmall : ((A - A).card : ℝ) ≤ K * A.card) (m n : ℕ) : + ((m • A - n • A).card : ℝ) ≤ K ^ (m + n) * A.card := by + have h := Finset.pluennecke_ruzsa_inequality_nsmul_sub_nsmul_sub hA A m n + have hreal : ((m • A - n • A).card : ℝ) ≤ + (((A - A).card : ℝ) / A.card) ^ (m + n) * A.card := by + have hc := (NNRat.cast_le (K := ℝ)).mpr h + simpa only [NNRat.cast_natCast, NNRat.cast_mul, NNRat.cast_pow, + NNRat.cast_div] using hc + have hcard : (0 : ℝ) < A.card := by exact_mod_cast hA.card_pos + have hratio : ((A - A).card : ℝ) / A.card ≤ K := + (div_le_iff₀ hcard).mpr hsmall + exact hreal.trans (mul_le_mul_of_nonneg_right + (pow_le_pow_left₀ (by positivity) hratio _) hcard.le) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmallWeightedPhysicalReplacement.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmallWeightedPhysicalReplacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8ad593f180af0c6ea8b215827916b8cf750eebc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmallWeightedPhysicalReplacement.lean @@ -0,0 +1,578 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalPairAccuracyLogBounds +import OAI.Combinatorics.Progressions.Lattices.IntegerBoxCutoffLogBounds +import OAI.Combinatorics.Progressions.Lattices.IntegerWindowFactor + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def weightedReplacementTolerance (F E epsilon : ℝ) : ℝ := + replacementAccuracy (F ^ 2 * (1 + E)) (epsilon ^ 2) + +theorem weightedReplacementTolerance_pos {F E epsilon : ℝ} + (hE : 0 ≤ E) (heps : 0 < epsilon) : + 0 < weightedReplacementTolerance F E epsilon := + (replacementAccuracy_spec (mul_nonneg (sq_nonneg F) (by linarith)) (sq_pos_of_pos heps)).1 + +theorem weightedReplacementTolerance_bound {F E epsilon beta : ℝ} + (hF : 0 ≤ F) (hE : 0 ≤ E) (heps : 0 < epsilon) (hbeta : 0 ≤ beta) + (hsmall : beta ≤ weightedReplacementTolerance F E epsilon) : + F * Real.sqrt (E * beta + weightedReplacementTolerance F E epsilon) ≤ epsilon := by + have htol := weightedReplacementTolerance_pos (F := F) hE heps + have hcost := (replacementAccuracy_spec + (mul_nonneg (sq_nonneg F) (by linarith : 0 ≤ 1 + E)) (sq_pos_of_pos heps)).2.2 + change F ^ 2 * (1 + E) * weightedReplacementTolerance F E epsilon ≤ epsilon ^ 2 at hcost + have harg : 0 ≤ E * beta + weightedReplacementTolerance F E epsilon := by positivity + have hsquare : (F * Real.sqrt (E * beta + weightedReplacementTolerance F E epsilon)) ^ 2 ≤ + epsilon ^ 2 := by + calc + _ = F ^ 2 * (E * beta + weightedReplacementTolerance F E epsilon) := by + rw [mul_pow, Real.sq_sqrt harg] + _ ≤ F ^ 2 * (E * weightedReplacementTolerance F E epsilon + + weightedReplacementTolerance F E epsilon) := + mul_le_mul_of_nonneg_left (add_le_add (mul_le_mul_of_nonneg_left hsmall hE) le_rfl) (sq_nonneg F) + _ = F ^ 2 * (1 + E) * weightedReplacementTolerance F E epsilon := by ring + _ ≤ epsilon ^ 2 := hcost + exact (sq_le_sq₀ (mul_nonneg hF (Real.sqrt_nonneg _)) heps.le).mp hsquare + +theorem cutoff_weighted_replacement_bound (d R : ℕ) {F E epsilon C M : ℝ} + (hd : 2 ≤ d) (hF : 0 ≤ F) (hE : 0 ≤ E) (hC : 0 ≤ C) (heps : 0 < epsilon) + (hscale : integerBoxPairScale d C (weightedReplacementTolerance F E epsilon) ≤ M) + (hR : (R : ℝ) ≤ C * M) : + F * Real.sqrt (E * integerBoxBadPairBudget d + (integerBoxGcdCutoff d C (weightedReplacementTolerance F E epsilon)) R + ⌊integerBoxNearRatio d (weightedReplacementTolerance F E epsilon) * M⌋₊ M + + weightedReplacementTolerance F E epsilon) ≤ epsilon := by + have htol := weightedReplacementTolerance_pos (F := F) hE heps + have hM : 0 ≤ M := by + have h : (integerBoxGcdCutoff d C (weightedReplacementTolerance F E epsilon) : ℝ) ≤ M := + (le_max_left _ _).trans hscale + exact (Nat.cast_nonneg _).trans h + exact weightedReplacementTolerance_bound hF hE heps + (integerBoxBadPairBudget_nonneg _ _ _ _ hM) + (integerBoxBadPairBudget_of_cutoffs d R hd hC htol hscale hR) + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem weightedReplacementTolerance_inverse_le_exp {F E epsilon P : ℝ} + (hF0 : 0 ≤ F) (hE0 : 0 ≤ E) (heps0 : 0 < epsilon) (hP : 0 ≤ P) + (hF : F ≤ Real.exp P) (hE : E ≤ Real.exp P) (heps : epsilon⁻¹ ≤ Real.exp P) : + (weightedReplacementTolerance F E epsilon)⁻¹ ≤ Real.exp (6 * P + 6) := by + have hcoef : F ^ 2 * (1 + E) ≤ Real.exp (3 * P + 2) := by + calc + _ ≤ (Real.exp P) ^ 2 * Real.exp (P + 1) := + mul_le_mul (pow_le_pow_left₀ hF0 hF 2) (one_add_le_exp_succ hP hE) + (by linarith) (by positivity) + _ = Real.exp (3 * P + 1) := by rw [← Real.exp_nat_mul, ← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + have heps2 : (epsilon ^ 2)⁻¹ ≤ Real.exp (3 * P + 2) := by + calc + _ = (epsilon⁻¹) ^ 2 := by rw [inv_pow] + _ ≤ (Real.exp P) ^ 2 := pow_le_pow_left₀ (inv_nonneg.mpr heps0.le) heps 2 + _ = Real.exp (2 * P) := by rw [← Real.exp_nat_mul]; norm_num + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + calc + _ ≤ Real.exp (2 * (3 * P + 2) + 2) := + replacementAccuracy_inverse_le_exp (by positivity) (sq_pos_of_pos heps0) + (by linarith) hcoef heps2 + _ = _ := by congr 1; ring + +theorem replacementWindowFactor_le_exp (m : ℕ) {K P : ℝ} + (hK0 : 0 ≤ K) (hK : K ≤ Real.exp P) : + (3 * K) ^ m ≤ Real.exp ((m : ℝ) * (P + 3)) := by + have h3 : (3 : ℝ) ≤ Real.exp 3 := by linarith [Real.add_one_le_exp (3 : ℝ)] + have hbase : 3 * K ≤ Real.exp (P + 3) := by + calc + _ ≤ Real.exp 3 * Real.exp P := mul_le_mul h3 hK hK0 (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add, add_comm] + simpa only [Real.exp_nat_mul] using pow_le_pow_left₀ (by positivity : 0 ≤ 3 * K) hbase m + +theorem replacementSampledEnergy_le_exp (n : ℕ) {A P : ℝ} + (hA0 : 0 ≤ A) (hA : A ≤ Real.exp P) : + (2 : ℝ) ^ (n + 1) * A ^ n ≤ Real.exp ((n : ℝ) * P + 2 * (n + 1)) := by + have h2 : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + calc + _ ≤ (Real.exp 2) ^ (n + 1) * (Real.exp P) ^ n := + mul_le_mul (pow_le_pow_left₀ (by norm_num) h2 _) (pow_le_pow_left₀ hA0 hA _) + (by positivity) (by positivity) + _ = _ := by rw [← Real.exp_nat_mul, ← Real.exp_nat_mul, ← Real.exp_add]; push_cast; congr 1; ring + +noncomputable def physicalReplacementInputLog (m n : ℕ) (P : ℝ) : ℝ := + (m : ℝ) * (P + 3) + n * P + 2 * (n + 1) + P + 1 + +theorem physicalReplacementInputLog_nonneg (m n : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ physicalReplacementInputLog m n P := by + unfold physicalReplacementInputLog + positivity + +theorem physicalReplacementTolerance_inverse_le_exp (m n : ℕ) {K A epsilon P : ℝ} + (hK0 : 0 ≤ K) (hA0 : 0 ≤ A) (heps0 : 0 < epsilon) (hP : 0 ≤ P) + (hK : K ≤ Real.exp P) (hA : A ≤ Real.exp P) (heps : epsilon⁻¹ ≤ Real.exp P) : + (weightedReplacementTolerance ((3 * K) ^ m) ((2 : ℝ) ^ (n + 1) * A ^ n) epsilon)⁻¹ ≤ + Real.exp (6 * physicalReplacementInputLog m n P + 6) := by + apply weightedReplacementTolerance_inverse_le_exp (by positivity) (by positivity) heps0 + (physicalReplacementInputLog_nonneg m n hP) + · apply (replacementWindowFactor_le_exp m hK0 hK).trans + apply Real.exp_le_exp.mpr + unfold physicalReplacementInputLog + nlinarith [mul_nonneg (Nat.cast_nonneg n (α := ℝ)) hP] + · apply (replacementSampledEnergy_le_exp n hA0 hA).trans + apply Real.exp_le_exp.mpr + unfold physicalReplacementInputLog + nlinarith [mul_nonneg (Nat.cast_nonneg m (α := ℝ)) (by linarith : 0 ≤ P + 3)] + · apply heps.trans + apply Real.exp_le_exp.mpr + unfold physicalReplacementInputLog + nlinarith [mul_nonneg (Nat.cast_nonneg m (α := ℝ)) (by linarith : 0 ≤ P + 3), + mul_nonneg (Nat.cast_nonneg n (α := ℝ)) hP] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem normalized_physical_residual_sum_energy {I : Type*} [Fintype I] [DecidableEq I] + (lo : I → ℤ) (N : I → ℕ) (H : I → ℝ) (ρ : ℝ) + (hlarge : ∀ i, 4 ≤ ρ * H i) (hwhole : ∀ i, ρ * H i ≤ 2 * (N i : ℝ)) + (Q degree : ℕ) (f : (I → ℤ) → ℝ) (hf : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ f x ∧ f x ≤ 1) + (modLog dimLog accLog eta : ℝ) (hmodLog : 0 ≤ modLog) (heta : eta ≤ 1) + (hacc : Real.exp (-accLog) ≤ eta) (hQlog : (Q : ℝ) ≤ Real.exp modLog) + (hdim : (Fintype.card I : ℝ) ≤ Real.exp dimLog) + (hlength : ∀ i, Real.exp (modLog * (2 * degree : ℕ) + accLog + dimLog + 1) ≤ ρ * H i / 4) : + let P := normalizedBoxPartitions N H ρ hlarge hwhole + let hpos := normalizedBoxPartitions_positive N H ρ hlarge hwhole + (∑ x ∈ translatedIntegerBox lo N, physicalBoxResidual lo N P hpos (boundedPrimePower Q) degree f x ^ 2) ≤ + (1 + eta * residueTruncationCap (BoundedPrime Q) degree eta ^ 2) * (translatedIntegerBox lo N).card := by + let P := normalizedBoxPartitions N H ρ hlarge hwhole + let hpos := normalizedBoxPartitions_positive N H ρ hlarge hwhole + have hstep := normalizedBoxPartitions_step N H ρ hlarge hwhole + have hN (i : I) : 0 < N i := by + have h : (0 : ℝ) < N i := by linarith [hlarge i, hwhole i] + exact_mod_cast h + have hlo : lo ∈ translatedIntegerBox lo N := (mem_translatedIntegerBox lo N lo).mpr + (fun i => ⟨le_rfl, lt_add_of_pos_right _ (by exact_mod_cast hN i)⟩) + let : Nonempty (translatedIntegerBox lo N) := ⟨⟨lo, hlo⟩⟩ + have hc (c : ∀ i, (P i).Label) := physicalBoxResidual_control_of_lengths lo N P hstep hpos + (boundedPrimePower Q) (boundedPrimePower_pairwise Q) degree f hf modLog dimLog accLog eta hmodLog heta hacc + (fun j => (Nat.cast_le.mpr (boundedPrimePower_le Q j)).trans hQlog) hdim + (fun i c => (hlength i).trans (normalizedBoxPartitions_lengths N H ρ hlarge hwhole i c).1) c + have h := physicalBoxResidual_energy lo N P hstep hpos (boundedPrimePower Q) degree f eta hc + rw [FiniteProbabilityWeights.uniform_mean, Fintype.expect_eq_sum_div_card, Fintype.card_coe, + Finset.sum_coe_sort (translatedIntegerBox lo N) + (fun x => physicalBoxResidual lo N P hpos (boundedPrimePower Q) degree f x ^ 2)] at h + exact (div_le_iff₀ (Nat.cast_pos.mpr (Finset.card_pos.mpr ⟨lo, hlo⟩))).mp h + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def physicalMeanAccuracyLog {J : Type*} [Fintype J] [DecidableEq J] + (n : ℕ) (k : J) (Q : ℕ) (C κ A : ℝ) (degree : ℕ) (epsilon : ℝ) : ℝ := + -Real.log (physicalPairMeanAccuracy n k Q C κ A degree epsilon) + +theorem physicalMeanAccuracyLog_spec {J : Type*} [Fintype J] [DecidableEq J] + (n : ℕ) (k : J) (Q : ℕ) (C κ : ℝ) (degree : ℕ) {A epsilon : ℝ} + (hA : 0 ≤ A) (heps : 0 < epsilon) : + 0 ≤ physicalMeanAccuracyLog n k Q C κ A degree epsilon ∧ + Real.exp (-physicalMeanAccuracyLog n k Q C κ A degree epsilon) = + physicalPairMeanAccuracy n k Q C κ A degree epsilon := by + have h := physicalPairMeanAccuracy_spec n k Q C κ degree hA heps + constructor + · have hl := Real.log_le_log h.1 h.2.1 + rw [Real.log_one] at hl + exact neg_nonneg.mpr hl + · simp only [physicalMeanAccuracyLog, neg_neg, Real.exp_log h.1] + +noncomputable def physicalReplacementScaleThreshold {J : Type*} [Fintype J] [DecidableEq J] + (n : ℕ) (k : J) (Q : ℕ) (C κ A epsilon : ℝ) (degree : ℕ) (modLog dimLog : ℝ) : ℝ := + replacementScaleThreshold C (physicalPairPointAccuracy n k Q C κ A epsilon) + (physicalPairGridAccuracy n k C κ A epsilon) + (Real.exp (modLog * (2 * degree : ℕ) + physicalMeanAccuracyLog n k Q C κ A degree epsilon + dimLog + 1)) + Q 2 (8 * probabilityProfileLipschitz) + +theorem physicalReplacementScaleThreshold_conditions {J : Type*} [Fintype J] [DecidableEq J] + (n : ℕ) (k : J) (Q : ℕ) (C κ : ℝ) (degree : ℕ) (modLog dimLog : ℝ) + {A epsilon L H : ℝ} {N e : ℕ} (hC : 0 ≤ C) (hA : 0 ≤ A) (heps : 0 < epsilon) + (hL : 1 ≤ L) (he : 2 ≤ e) + (hscale : physicalReplacementScaleThreshold n k Q C κ A epsilon degree modLog dimLog * L ^ e ≤ H) + (hupper : H ≤ 2 * (N : ℝ)) : + let delta := physicalPairPointAccuracy n k Q C κ A epsilon + let rho := physicalPairGridAccuracy n k C κ A epsilon + let accLog := physicalMeanAccuracyLog n k Q C κ A degree epsilon + 0 < H ∧ 2 * C * L ^ 2 / H ≤ delta ∧ 4 ≤ rho * H ∧ + Real.exp (modLog * (2 * degree : ℕ) + accLog + dimLog + 1) ≤ rho * H / 4 ∧ + (Q : ℝ) ≤ N ∧ 8 * (probabilityProfileLipschitz : ℝ) ≤ H / L ∧ rho * H ≤ 2 * N := by + have hd := physicalPairPointAccuracy_spec n k Q C κ hA heps + have hr := physicalPairGridAccuracy_spec n k C κ hA heps + exact replacementScaleThreshold_conditions hC hd.1 hr.1 (Real.exp_nonneg _) (Nat.cast_nonneg Q) + (by norm_num) (by positivity) hL he hscale hupper (by nlinarith [hr.2.1]) + +theorem smoothPairCoefficientScale_large {I J : Type*} (H : I → ℝ) {L U : ℝ} + (hL : 1 ≤ L) (hU : 0 ≤ U) (hH : ∀ i, U ≤ H i / L) : + ∀ z : Option J × I, U ≤ smoothPairCoefficientScale (H z.2) L z.1 := by + rintro ⟨j, i⟩ + cases j with + | none => + exact (le_mul_of_one_le_right hU hL).trans ((le_div_iff₀ (zero_lt_one.trans_le hL)).mp (hH i)) + | some j => exact hH i + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem weighted_physical_replacement {J I : Type*} + [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] + (k0 : J) (D r : ℕ) (anchor parLo parHi : J → ℤ) + (hpar : ∀ j, parLo j < parHi j) + (H : I → ℝ) {L C κ δ : ℝ} (Q : ℕ) (hH : ∀ i, 0 < H i) + (hL : 1 ≤ L) (hC : 1 ≤ C) (hκ : 0 < κ) (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (hleft : ∀ j, |((anchor j + (D : ℤ) * parLo j : ℤ) : ℝ) / L| ≤ C) + (hright : ∀ j, |((anchor j + (D : ℤ) * parHi j : ℤ) : ℝ) / L| ≤ C) + (hgap : κ * L ≤ (D : ℝ) * (r + 1 : ℕ)) + (hmesh : ∀ i, 2 * C * L ^ 2 / H i ≤ δ) + (hsmall : (4 : ℝ) ^ (2 + Fintype.card {j : J // j ≠ k0}) * smoothPairRowLipschitz k0 * δ ≤ 1 / 2) + (origin : Option J × I → ℤ) + (hZ : 0 < shiftedSmoothProductMass (fun z => (origin z : ℝ)) + (fun z : Option J × I => smoothPairCoefficientScale (H z.2) L z.1)) + (lo : I → ℤ) (N : I → ℕ) (hside : ∀ i, (Q : ℝ) ≤ (N i : ℝ)) + (degree : ℕ) (f : (I → ℤ) → ℝ) + (hf : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ f x ∧ f x ≤ 1) + (eta ρ modLog dimLog accLog : ℝ) (hρ : 0 ≤ ρ) (heta : eta ≤ 1) + (hmodLog : 0 ≤ modLog) (hacc : Real.exp (-accLog) ≤ eta) + (hQlog : (Q : ℝ) ≤ Real.exp modLog) + (hdim : (Fintype.card I : ℝ) ≤ Real.exp dimLog) + (hlarge : ∀ i, 4 ≤ ρ * H i) (hwhole : ∀ i, ρ * H i ≤ 2 * (N i : ℝ)) + (hlength : ∀ i, Real.exp (modLog * (2 * degree : ℕ) + accLog + dimLog + 1) ≤ ρ * H i / 4) + (hQdegree : Q ≤ 2 ^ degree) + (B R : ℕ) (hBQ : D * B ≤ Q) (hB : 0 < B) (hparamDim : 2 ≤ Fintype.card J) + (parMin : ℝ) (hparMin : 0 < parMin) + (hparSide : ∀ j, parMin ≤ ((parHi j - parLo j : ℤ) : ℝ)) + (hparWidth : ∀ j, parHi j - parLo j ≤ (R : ℤ)) + (hscale : ∀ z : Option J × I, 8 * (probabilityProfileLipschitz : ℝ) ≤ + smoothPairCoefficientScale (H z.2) L z.1) + (W : Finset (Option J × I → ℤ)) + (hW : ∀ z ∈ W, ∀ i, |(z i : ℝ) - (origin i : ℝ)| ≤ smoothPairCoefficientScale (H i.2) L i.1 / 2) + (v : (Option J × I → ℤ) → ℝ) (hv : ∀ z, 0 ≤ v z ∧ v z ≤ 1) : + let P := normalizedBoxPartitions N H ρ hlarge hwhole + let hpos := normalizedBoxPartitions_positive N H ρ hlarge hwhole + |𝔼 z ∈ W, v z * (𝔼 t : (∀ j, Finset.Ico (parLo j) (parHi j)), + physicalBoxResidual lo N P hpos (boundedPrimePower Q) degree f + (smoothAffineSample (fun j => anchor j + (D : ℤ) * (t j).val) z))| ≤ + ((3 : ℝ) ^ Fintype.card (Option J × I) * + (∏ z : Option J × I, smoothPairCoefficientScale (H z.2) L z.1) / W.card) * + Real.sqrt (((∏ i, 2 / H i) * ((1 + eta * residueTruncationCap (BoundedPrime Q) degree eta ^ 2) * + (translatedIntegerBox lo N).card)) * integerBoxBadPairBudget (Fintype.card J) B R r parMin + + physicalResidualPairBudget lo N H k0 Q C κ δ degree eta ρ) := by + let P := normalizedBoxPartitions N H ρ hlarge hwhole + let hpos := normalizedBoxPartitions_positive N H ρ hlarge hwhole + let e : (I → ℤ) → ℝ := physicalBoxResidual lo N P hpos (boundedPrimePower Q) degree f + have heta0 : 0 ≤ eta := (Real.exp_pos _).le.trans hacc + have hepsilon := physicalResidualPairBudget_nonneg lo N H k0 Q C κ δ degree eta ρ hδ heta0 hρ + have henergy := normalized_physical_residual_sum_energy lo N H ρ hlarge hwhole Q degree f hf + modLog dimLog accLog eta hmodLog heta hacc hQlog hdim hlength + have hmass := affine_parameter_bad_pair_probability parLo parHi hpar D Q B R r anchor hBQ hB hparamDim + hparMin hparSide hparWidth + have hgood (tu : (∀ j, Finset.Ico (parLo j) (parHi j)) × (∀ j, Finset.Ico (parLo j) (parHi j))) + (htu : ¬ affineParameterBadPair D Q r anchor (fun j => (tu.1 j).val) (fun j => (tu.2 j).val)) := + retained_physical_residual_correlation k0 D r anchor parLo parHi tu.1 tu.2 H Q hH hL hC hκ hδ hδ1 + hleft hright hgap htu hmesh hsmall origin hZ lo N hside degree f f hf hf eta ρ modLog dimLog accLog + hρ heta hmodLog hacc hQlog hdim hlarge hwhole hlength hQdegree + have h := smooth_window_weighted_sampled_error (fun z => (origin z : ℝ)) + (fun z : Option J × I => smoothPairCoefficientScale (H z.2) L z.1) + (fun z => smoothPairCoefficientScale_pos (hH z.2) (zero_lt_one.trans_le hL) z.1) hZ hscale W hW + (integerBoxUniformWeights parLo parHi hpar) (fun t j => anchor j + (D : ℤ) * (t j).val) + (translatedIntegerBox lo N) e (physicalBoxResidual_zero_off lo N P hpos (boundedPrimePower Q) degree f) + (by positivity : 0 ≤ 1 + eta * residueTruncationCap (BoundedPrime Q) degree eta ^ 2) hepsilon henergy + (fun tu => affineParameterBadPair D Q r anchor (fun j => (tu.1 j).val) (fun j => (tu.2 j).val)) hmass hgood v hv + simpa only [integerBoxUniformWeights_mean, smoothPairCoefficientScale] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {J : Type*} [Fintype J] [DecidableEq J] + +theorem physicalMeanAccuracyLog_le (n degree : ℕ) (k : J) (Q : ℕ) + {C κ A epsilon P : ℝ} (hP : 0 ≤ P) (hC0 : 0 ≤ C) (hκ0 : 0 < κ) + (hA0 : 0 ≤ A) (heps0 : 0 < epsilon) (hQ : (Q : ℝ) ≤ Real.exp P) + (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) (hA : A ≤ Real.exp P) + (heps : epsilon⁻¹ ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) : + physicalMeanAccuracyLog n k Q C κ A degree epsilon ≤ 2 * physicalPairMeanLog n degree P + 2 := by + have hi := physicalPairMeanAccuracy_inverse_le_exp n degree k Q hP hC0 hκ0 hA0 heps0 hQ hC hκ hA heps hpow + have hp := (physicalPairMeanAccuracy_spec n k Q C κ degree hA0 heps0).1 + have hl := Real.log_le_log (inv_pos.mpr hp) hi + simpa only [physicalMeanAccuracyLog, Real.log_inv, Real.log_exp] using hl + +noncomputable def physicalReplacementThresholdLog (n d degree : ℕ) (P : ℝ) : ℝ := + 2 * physicalPairCoefficientLog n d P + 2 * physicalPairMeanLog n degree P + + (2 * degree + 2) * P + 20 + +theorem physicalReplacementThresholdLog_bounds (n d degree : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ physicalReplacementThresholdLog n d degree P ∧ + P + 8 ≤ physicalReplacementThresholdLog n d degree P ∧ + 2 * physicalPairCoefficientLog n d P + 2 ≤ physicalReplacementThresholdLog n d degree P ∧ + 2 * physicalPairMeanLog n degree P + 2 + (2 * degree + 1) * P + 1 ≤ + physicalReplacementThresholdLog n d degree P := by + have hc := (physicalPairCoefficientLog_bounds n d hP).1 + have hm := (physicalPairMeanLog_bounds n degree hP).1 + have hdegree : (0 : ℝ) ≤ degree := Nat.cast_nonneg _ + have hprod := mul_nonneg hdegree hP + unfold physicalReplacementThresholdLog + constructor + · positivity + constructor + · nlinarith + constructor <;> nlinarith + +theorem physicalReplacementScaleThreshold_le_exp (n degree : ℕ) (k : J) (Q : ℕ) + {C κ A epsilon P : ℝ} (hP : 0 ≤ P) (hC0 : 0 ≤ C) (hκ0 : 0 < κ) + (hA0 : 0 ≤ A) (heps0 : 0 < epsilon) + (hn : (n : ℝ) ≤ Real.exp P) (hQ : (Q : ℝ) ≤ Real.exp P) + (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) (hA : A ≤ Real.exp P) + (heps : epsilon⁻¹ ≤ Real.exp P) (hcard : (Fintype.card J : ℝ) ≤ Real.exp P) + (hrow : (smoothPairRowLipschitz k : ℝ) ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) + (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) : + physicalReplacementScaleThreshold n k Q C κ A epsilon degree P P ≤ + Real.exp (2 * physicalReplacementThresholdLog n (Fintype.card {j : J // j ≠ k}) degree P + 16) := by + let d := Fintype.card {j : J // j ≠ k} + have hb := physicalReplacementThresholdLog_bounds n d degree hP + have hPR : P ≤ physicalReplacementThresholdLog n d degree P := by linarith [hb.2.1] + have hexp := Real.exp_le_exp.mpr hPR + have hpointgrid := physicalPairPointGridAccuracy_inverse_le_exp n k Q hP hC0 hκ0 hA0 heps0 + hn hQ hC hκ hA heps hcard hrow hpow + have hmean := physicalMeanAccuracyLog_le n degree k Q hP hC0 hκ0 hA0 heps0 hQ hC hκ hA heps hpow + have hd := (physicalPairPointAccuracy_spec n k Q C κ hA0 heps0).1 + have hr := (physicalPairGridAccuracy_spec n k C κ hA0 heps0).1 + unfold physicalReplacementScaleThreshold + apply replacementScaleThreshold_le_exp hC0 hd hr (Nat.cast_nonneg Q) hb.1 + · exact hC.trans hexp + · exact hpointgrid.1.trans (Real.exp_le_exp.mpr hb.2.2.1) + · exact hpointgrid.2.trans (Real.exp_le_exp.mpr hb.2.2.1) + · apply Real.exp_le_exp.mpr + push_cast + have hlast := hb.2.2.2 + nlinarith + · exact hQ.trans hexp + · have h2 : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + exact h2.trans (Real.exp_le_exp.mpr (by linarith [hb.2.1])) + · have h8 : (8 : ℝ) ≤ Real.exp 8 := by linarith [Real.add_one_le_exp (8 : ℝ)] + calc + _ ≤ Real.exp 8 * Real.exp P := mul_le_mul h8 hprofile (by positivity) (Real.exp_nonneg _) + _ = Real.exp (P + 8) := by rw [← Real.exp_add, add_comm] + _ ≤ _ := Real.exp_le_exp.mpr hb.2.1 + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem allocated_weighted_physical_replacement {J I : Type*} + [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] + (k0 : J) (D r : ℕ) (anchor parLo parHi : J → ℤ) (hpar : ∀ j, parLo j < parHi j) + (H : I → ℝ) {L C κ A epsilon : ℝ} (Q : ℕ) + (hL : 1 ≤ L) (hC : 1 ≤ C) (hκ : 0 < κ) (hA : 0 ≤ A) (heps : 0 < epsilon) + (hleft : ∀ j, |((anchor j + (D : ℤ) * parLo j : ℤ) : ℝ) / L| ≤ C) + (hright : ∀ j, |((anchor j + (D : ℤ) * parHi j : ℤ) : ℝ) / L| ≤ C) + (hgap : κ * L ≤ (D : ℝ) * (r + 1 : ℕ)) + (origin : Option J × I → ℤ) (lo : I → ℤ) (N : I → ℕ) + (degree exponent : ℕ) (hexponent : 2 ≤ exponent) + (f : (I → ℤ) → ℝ) (hf : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ f x ∧ f x ≤ 1) + (modLog dimLog : ℝ) (hmodLog : 0 ≤ modLog) + (hQlog : (Q : ℝ) ≤ Real.exp modLog) (hdim : (Fintype.card I : ℝ) ≤ Real.exp dimLog) + (hupper : ∀ i, H i ≤ 2 * (N i : ℝ)) (hratio : ∀ i, (N i : ℝ) ≤ A * H i) + (hsize : ∀ i, physicalReplacementScaleThreshold (Fintype.card I) k0 Q C κ A epsilon degree modLog dimLog * + L ^ exponent ≤ H i) + (hQdegree : Q ≤ 2 ^ degree) + (B R : ℕ) (hBQ : D * B ≤ Q) (hB : 0 < B) (hparamDim : 2 ≤ Fintype.card J) + (parMin : ℝ) (hparMin : 0 < parMin) + (hparSide : ∀ j, parMin ≤ ((parHi j - parLo j : ℤ) : ℝ)) + (hparWidth : ∀ j, parHi j - parLo j ≤ (R : ℤ)) + (W : Finset (Option J × I → ℤ)) + (hW : ∀ z ∈ W, ∀ i, |(z i : ℝ) - (origin i : ℝ)| ≤ smoothPairCoefficientScale (H i.2) L i.1 / 2) + (v : (Option J × I → ℤ) → ℝ) (hv : ∀ z, 0 ≤ v z ∧ v z ≤ 1) : + let rho := physicalPairGridAccuracy (Fintype.card I) k0 C κ A epsilon + let sc := fun i => physicalReplacementScaleThreshold_conditions (Fintype.card I) k0 Q C κ degree modLog dimLog + (zero_le_one.trans hC) hA heps hL hexponent (hsize i) (hupper i) + let hlarge := fun i => (sc i).2.2.1 + let hwhole := fun i => (sc i).2.2.2.2.2.2 + let P := normalizedBoxPartitions N H rho hlarge hwhole + let hpos := normalizedBoxPartitions_positive N H rho hlarge hwhole + |𝔼 z ∈ W, v z * (𝔼 t : (∀ j, Finset.Ico (parLo j) (parHi j)), + physicalBoxResidual lo N P hpos (boundedPrimePower Q) degree f + (smoothAffineSample (fun j => anchor j + (D : ℤ) * (t j).val) z))| ≤ + ((3 : ℝ) ^ Fintype.card (Option J × I) * + (∏ z : Option J × I, smoothPairCoefficientScale (H z.2) L z.1) / W.card) * + Real.sqrt ((2 : ℝ) ^ (Fintype.card I + 1) * A ^ Fintype.card I * + integerBoxBadPairBudget (Fintype.card J) B R r parMin + epsilon) := by + let delta := physicalPairPointAccuracy (Fintype.card I) k0 Q C κ A epsilon + let rho := physicalPairGridAccuracy (Fintype.card I) k0 C κ A epsilon + let eta := physicalPairMeanAccuracy (Fintype.card I) k0 Q C κ A degree epsilon + let accLog := physicalMeanAccuracyLog (Fintype.card I) k0 Q C κ A degree epsilon + have sc (i : I) := physicalReplacementScaleThreshold_conditions (Fintype.card I) k0 Q C κ degree modLog dimLog + (zero_le_one.trans hC) hA heps hL hexponent (hsize i) (hupper i) + have hH (i : I) : 0 < H i := (sc i).1 + have hlarge (i : I) : 4 ≤ rho * H i := (sc i).2.2.1 + have hwhole (i : I) : rho * H i ≤ 2 * N i := (sc i).2.2.2.2.2.2 + let P := normalizedBoxPartitions N H rho hlarge hwhole + let hpos := normalizedBoxPartitions_positive N H rho hlarge hwhole + have hd := physicalPairPointAccuracy_spec (Fintype.card I) k0 Q C κ hA heps + have hr := physicalPairGridAccuracy_spec (Fintype.card I) k0 C κ hA heps + have he := physicalPairMeanAccuracy_spec (Fintype.card I) k0 Q C κ degree hA heps + have halog := physicalMeanAccuracyLog_spec (Fintype.card I) k0 Q C κ degree hA heps + have hscale := smoothPairCoefficientScale_large (J := J) H hL + (show 0 ≤ 8 * (probabilityProfileLipschitz : ℝ) by positivity) (fun i => (sc i).2.2.2.2.2.1) + have hZ := shiftedSmoothProductMass_pos_of_large_scales (fun z => (origin z : ℝ)) + (fun z : Option J × I => smoothPairCoefficientScale (H z.2) L z.1) hscale + have h := weighted_physical_replacement k0 D r anchor parLo parHi hpar H Q hH hL hC hκ hd.1.le hd.2.1 + hleft hright hgap (fun i => (sc i).2.1) hd.2.2.2 origin hZ lo N (fun i => (sc i).2.2.2.2.1) + degree f hf eta rho modLog dimLog accLog hr.1.le he.2.1 hmodLog halog.2.le hQlog hdim hlarge hwhole + (fun i => (sc i).2.2.2.1) hQdegree B R hBQ hB hparamDim parMin hparMin hparSide hparWidth hscale W hW v hv + have hp := physicalResidualPairBudget_of_accuracies lo N H hH k0 Q C κ degree hA heps hratio + have heta : 0 ≤ eta := he.1.le + have hcap0 := residueTruncationCap_nonneg (BoundedPrime Q) degree heta + have hcap := residueTruncationCap_le_envelope (BoundedPrime Q) degree he.2.1 + have hE : 1 + eta * residueTruncationCap (BoundedPrime Q) degree eta ^ 2 ≤ 2 := by + have hh := mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hcap0 hcap 2) heta + have henergy := he.2.2.1 + change eta * residualCapEnvelope (BoundedPrime Q) degree ^ 2 ≤ 1 at henergy + linarith + have hvol := translated_box_volume_ratio_le lo N H hH hratio + have henergy : (∏ i, 2 / H i) * ((1 + eta * residueTruncationCap (BoundedPrime Q) degree eta ^ 2) * + (translatedIntegerBox lo N).card) ≤ (2 : ℝ) ^ (Fintype.card I + 1) * A ^ Fintype.card I := by + calc + _ = ((2 : ℝ) ^ Fintype.card I * ((translatedIntegerBox lo N).card / ∏ i, H i)) * + (1 + eta * residueTruncationCap (BoundedPrime Q) degree eta ^ 2) := by + rw [Finset.prod_div_distrib, Finset.prod_const, Finset.card_univ] + ring + _ ≤ ((2 : ℝ) ^ Fintype.card I * A ^ Fintype.card I) * 2 := + mul_le_mul (mul_le_mul_of_nonneg_left hvol (by positivity)) hE (by positivity) (by positivity) + _ = _ := by rw [pow_succ]; ring + have hbad : 0 ≤ integerBoxBadPairBudget (Fintype.card J) B R r parMin := by + unfold integerBoxBadPairBudget + positivity + have hfactor : 0 ≤ (3 : ℝ) ^ Fintype.card (Option J × I) * + (∏ z : Option J × I, smoothPairCoefficientScale (H z.2) L z.1) / W.card := by + apply div_nonneg _ (Nat.cast_nonneg _) + apply mul_nonneg (by positivity) + exact Finset.prod_nonneg (fun z _ => (smoothPairCoefficientScale_pos (hH z.2) (zero_lt_one.trans_le hL) z.1).le) + apply h.trans + apply mul_le_mul_of_nonneg_left _ hfactor + apply Real.sqrt_le_sqrt + exact add_le_add (mul_le_mul_of_nonneg_right henergy hbad) hp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem small_weighted_physical_replacement {J I : Type*} + [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] + (k0 : J) (D : ℕ) (anchor parLo parHi : J → ℤ) (hpar : ∀ j, parLo j < parHi j) + (H : I → ℝ) {L C A epsilon K c Cwidth : ℝ} + (hL : 1 ≤ L) (hC : 1 ≤ C) (hA : 0 ≤ A) (heps : 0 < epsilon) + (hK : 0 ≤ K) (hc : 0 < c) (hCwidth : 0 ≤ Cwidth) (hD : 0 < D) + (hleft : ∀ j, |((anchor j + (D : ℤ) * parLo j : ℤ) : ℝ) / L| ≤ C) + (hright : ∀ j, |((anchor j + (D : ℤ) * parHi j : ℤ) : ℝ) / L| ≤ C) + (origin : Option J × I → ℤ) (lo : I → ℤ) (N : I → ℕ) + (degree exponent : ℕ) (hexponent : 2 ≤ exponent) + (f : (I → ℤ) → ℝ) (hf : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ f x ∧ f x ≤ 1) + (modLog dimLog : ℝ) (hmodLog : 0 ≤ modLog) + (hdim : (Fintype.card I : ℝ) ≤ Real.exp dimLog) + (hupper : ∀ i, H i ≤ 2 * (N i : ℝ)) (hratio : ∀ i, (N i : ℝ) ≤ A * H i) + (R : ℕ) (parMin : ℝ) (hparMin : 0 < parMin) (hparamDim : 2 ≤ Fintype.card J) + (hparSide : ∀ j, parMin ≤ ((parHi j - parLo j : ℤ) : ℝ)) + (hparWidth : ∀ j, parHi j - parLo j ≤ (R : ℤ)) + (hwidthRatio : (R : ℝ) ≤ Cwidth * parMin) (hrelative : c * L ≤ parMin) + (winLo winHi : Option J × I → ℤ) (hwin : ∀ i, winLo i < winHi i) + (hwinScale : ∀ i, smoothPairCoefficientScale (H i.2) L i.1 ≤ + K * ((winHi i - winLo i : ℤ) : ℝ)) + (v : (Option J × I → ℤ) → ℝ) (hv : ∀ z, 0 ≤ v z ∧ v z ≤ 1) : + let F := (3 * K) ^ Fintype.card (Option J × I) + let E := (2 : ℝ) ^ (Fintype.card I + 1) * A ^ Fintype.card I + let tol := weightedReplacementTolerance F E epsilon + let B := integerBoxGcdCutoff (Fintype.card J) Cwidth tol + let Q := D * B + let κ := integerBoxRetainedGap (Fintype.card J) D c tol + ∀ (hparamScale : integerBoxPairScale (Fintype.card J) Cwidth tol ≤ parMin) + (hQlog : (Q : ℝ) ≤ Real.exp modLog) + (hsize : ∀ i, physicalReplacementScaleThreshold (Fintype.card I) k0 Q C κ A tol degree modLog dimLog * + L ^ exponent ≤ H i) + (hQdegree : Q ≤ 2 ^ degree), + let W := Fintype.piFinset (fun i => Finset.Ico (winLo i) (winHi i)) + ∀ (hW : ∀ z ∈ W, ∀ i, |(z i : ℝ) - (origin i : ℝ)| ≤ smoothPairCoefficientScale (H i.2) L i.1 / 2), + let rho := physicalPairGridAccuracy (Fintype.card I) k0 C κ A tol + let sc := fun i => physicalReplacementScaleThreshold_conditions (Fintype.card I) k0 Q C κ degree modLog dimLog + (zero_le_one.trans hC) hA (weightedReplacementTolerance_pos (by positivity) heps) + hL hexponent (hsize i) (hupper i) + let hlarge := fun i => (sc i).2.2.1 + let hwhole := fun i => (sc i).2.2.2.2.2.2 + let P := normalizedBoxPartitions N H rho hlarge hwhole + let hpos := normalizedBoxPartitions_positive N H rho hlarge hwhole + |𝔼 z ∈ W, v z * (𝔼 t : (∀ j, Finset.Ico (parLo j) (parHi j)), + physicalBoxResidual lo N P hpos (boundedPrimePower Q) degree f + (smoothAffineSample (fun j => anchor j + (D : ℤ) * (t j).val) z))| ≤ epsilon := by + intro F E tol B Q κ hparamScale hQlog hsize hQdegree W hW + let r := ⌊integerBoxNearRatio (Fintype.card J) tol * parMin⌋₊ + have hF : 0 ≤ F := by positivity + have hE : 0 ≤ E := by positivity + have htol : 0 < tol := weightedReplacementTolerance_pos hE heps + have hgap := integerBoxRetainedGap_spec (Fintype.card J) D hD hc htol hrelative + have hB := (integerBoxGcdCutoff_spec (Fintype.card J) (C := Cwidth) htol).1 + have h := allocated_weighted_physical_replacement k0 D r anchor parLo parHi hpar H Q + hL hC hgap.1 hA htol hleft hright hgap.2 origin lo N degree exponent hexponent f hf + modLog dimLog hmodLog hQlog hdim hupper hratio hsize hQdegree B R le_rfl hB hparamDim + parMin hparMin hparSide hparWidth W hW v hv + have hH (i : I) : 0 < H i := + (physicalReplacementScaleThreshold_conditions (Fintype.card I) k0 Q C κ degree modLog dimLog + (zero_le_one.trans hC) hA htol hL hexponent (hsize i) (hupper i)).1 + have hfactor := integerIntervalBox_window_factor_le winLo winHi hwin + (fun i : Option J × I => smoothPairCoefficientScale (H i.2) L i.1) + (fun i => (smoothPairCoefficientScale_pos (hH i.2) (zero_lt_one.trans_le hL) i.1).le) hwinScale + have hfinal := cutoff_weighted_replacement_bound (Fintype.card J) R hparamDim hF hE hCwidth heps + hparamScale hwidthRatio + exact h.trans ((mul_le_mul_of_nonneg_right hfactor (Real.sqrt_nonneg _)).trans hfinal) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmoothCoefficientSlice.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothCoefficientSlice.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ef305c050af33a64e57b324c103ce106859e113 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothCoefficientSlice.lean @@ -0,0 +1,218 @@ +import OAI.Combinatorics.Progressions.Estimates.CoefficientSliceEmbedding + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +noncomputable def scalarCubeNormalizationThreshold (I : Type*) [Fintype I] [DecidableEq I] + (M : ℕ) (B T : ℝ≥0) : ℕ := + max 1 (max ((Fintype.card I + 1) * M) + (max ⌈2 * scalarCubeGridBoundaryConstant I * M / volume.real (scalarCubeDomain I)⌉₊ + ⌈2 * M * scalarCubeRiemannAllowance I B T⌉₊)) + +theorem scalarCubeNormalizationThreshold_spec (I : Type*) [Fintype I] [DecidableEq I] + {L M : ℕ} {B T : ℝ≥0} (h : scalarCubeNormalizationThreshold I M B T ≤ L) : + 0 < L ∧ (Fintype.card I + 1) * M ≤ L ∧ + 2 * scalarCubeGridBoundaryConstant I * M / volume.real (scalarCubeDomain I) ≤ L ∧ + 2 * M * scalarCubeRiemannAllowance I B T ≤ L := by + unfold scalarCubeNormalizationThreshold at h + rcases max_le_iff.mp h with ⟨hpos, h⟩ + rcases max_le_iff.mp h with ⟨hsize, h⟩ + rcases max_le_iff.mp h with ⟨hlarge, htest⟩ + refine ⟨hpos, hsize, ?_, ?_⟩ + · exact (Nat.le_ceil _).trans (by exact_mod_cast hlarge) + · exact (Nat.le_ceil _).trans (by exact_mod_cast htest) + +theorem scalarCube_weight_normalizer_of_threshold (I : Type*) [Fintype I] [DecidableEq I] + (L M : ℕ) (m : Option I → ℕ) (res : ∀ i, ZMod (m i)) + (hm : ∀ i, 0 < m i) (hmM : ∀ i, m i ≤ M) + (w : (Option I → ℝ) → ℝ) {B T : ℝ≥0} + (hw : ∀ x, 0 ≤ w x ∧ w x ≤ B) (hLip : LipschitzWith T w) + (hmass : ∫ x, w x ∂scalarCubeMeasure I = 1) + (h : scalarCubeNormalizationThreshold I M B T ≤ L) : + let hs := scalarCubeNormalizationThreshold_spec I h + 1 / 2 ≤ (scalarCubeResidueWeights I L M hs.1 m res hm hmM hs.2.1).mean + (fun z => w (fun i => (z i : ℝ) / L)) ∧ + (scalarCubeResidueWeights I L M hs.1 m res hm hmM hs.2.1).mean + (fun z => w (fun i => (z i : ℝ) / L)) ≤ 3 / 2 := by + exact scalarCube_weight_normalizer_bounds I L M + (scalarCubeNormalizationThreshold_spec I h).1 m res hm hmM + (scalarCubeNormalizationThreshold_spec I h).2.1 w hw hLip hmass + (scalarCubeNormalizationThreshold_spec I h).2.2.1 + (scalarCubeNormalizationThreshold_spec I h).2.2.2 + +noncomputable def normalizedScalarCubeSourceOfThreshold (I : Type*) [Fintype I] [DecidableEq I] + (L M : ℕ) (m : Option I → ℕ) (res : ∀ i, ZMod (m i)) + (hm : ∀ i, 0 < m i) (hmM : ∀ i, m i ≤ M) + (w : (Option I → ℝ) → ℝ) (B T : ℝ≥0) (hB : 0 < B) + (hw : ∀ x, 0 ≤ w x ∧ w x ≤ B) (hLip : LipschitzWith T w) + (hmass : ∫ x, w x ∂scalarCubeMeasure I = 1) + (h : scalarCubeNormalizationThreshold I M B T ≤ L) : NormalizedScalarCubeSource I := + normalizedScalarCubeSourceOfWeight I L M (scalarCubeNormalizationThreshold_spec I h).1 + m res hm hmM (scalarCubeNormalizationThreshold_spec I h).2.1 w B T hB hw hLip + (scalarCube_weight_normalizer_of_threshold I L M m res hm hmM w hw hLip hmass h).1 + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +theorem scalarCubeNormalizationThreshold_le (I : Type*) [Fintype I] [DecidableEq I] + {L M : ℕ} {B T : ℝ≥0} (hL : 0 < L) (hsize : (Fintype.card I + 1) * M ≤ L) + (hlarge : 2 * scalarCubeGridBoundaryConstant I * M / volume.real (scalarCubeDomain I) ≤ L) + (htest : 2 * M * scalarCubeRiemannAllowance I B T ≤ L) : + scalarCubeNormalizationThreshold I M B T ≤ L := by + unfold scalarCubeNormalizationThreshold + exact max_le hL (max_le hsize (max_le (Nat.ceil_le.mpr hlarge) (Nat.ceil_le.mpr htest))) + +theorem scalarCubeNormalizationThreshold_mul (I : Type*) [Fintype I] [DecidableEq I] + {M : ℕ} (hM : 0 < M) (B T : ℝ≥0) : + scalarCubeNormalizationThreshold I M B T ≤ M * scalarCubeNormalizationThreshold I 1 B T := by + let L := scalarCubeNormalizationThreshold I 1 B T + have hs := scalarCubeNormalizationThreshold_spec I (le_refl L) + apply scalarCubeNormalizationThreshold_le I (Nat.mul_pos hM hs.1) + · have hb : Fintype.card I + 1 ≤ L := by simpa only [Nat.mul_one] using hs.2.1 + simpa only [Nat.mul_comm] using Nat.mul_le_mul_left M hb + · calc + _ = (2 * scalarCubeGridBoundaryConstant I * (1 : ℕ) / volume.real (scalarCubeDomain I)) * M := by + push_cast + ring + _ ≤ (L : ℝ) * M := mul_le_mul_of_nonneg_right hs.2.2.1 (Nat.cast_nonneg M) + _ = (M * L : ℕ) := by push_cast; ring + · calc + _ = (2 * (1 : ℕ) * scalarCubeRiemannAllowance I B T) * M := by + push_cast + ring + _ ≤ (L : ℝ) * M := mul_le_mul_of_nonneg_right hs.2.2.2 (Nat.cast_nonneg M) + _ = (M * L : ℕ) := by push_cast; ring + +theorem scalarCubeNormalizationThreshold_power_budget (I : Type*) [Fintype I] [DecidableEq I] + {M : ℕ} (hM : 0 < M) (B T : ℝ≥0) (p : ℕ) {E : ℝ} (hE : 0 ≤ E) : + ⌈E * (scalarCubeNormalizationThreshold I M B T : ℝ) ^ p⌉₊ ≤ + ⌈(E * (scalarCubeNormalizationThreshold I 1 B T : ℝ) ^ p) * (M : ℝ) ^ p⌉₊ := by + apply Nat.ceil_mono + have hp : (scalarCubeNormalizationThreshold I M B T : ℝ) ^ p ≤ + ((M * scalarCubeNormalizationThreshold I 1 B T : ℕ) : ℝ) ^ p := by + exact_mod_cast Nat.pow_le_pow_left (scalarCubeNormalizationThreshold_mul I hM B T) p + apply (mul_le_mul_of_nonneg_left hp hE).trans_eq + push_cast + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal Classical + +structure SmoothCoefficientSlice (M : ℕ) (B T : ℝ≥0) where + length : ℕ + modulus : ℕ + residue : ZMod modulus + modulus_pos : 0 < modulus + modulus_le : modulus ≤ M + weight : (Option Empty → ℝ) → ℝ + weight_range : ∀ x, 0 ≤ weight x ∧ weight x ≤ B + weight_lipschitz : LipschitzWith T weight + weight_integral : ∫ x, weight x ∂scalarCubeMeasure Empty = 1 + +namespace SmoothCoefficientSlice + +variable {M : ℕ} {B T : ℝ≥0} (s : SmoothCoefficientSlice M B T) + +abbrev Domain := ↥(coefficientResidueSet s.length s.modulus s.residue) + +noncomputable def sliceWeight (x : s.Domain) : ℝ := s.weight (fun _ => (x.val : ℝ) / s.length) + +theorem sliceWeight_nonneg (x : s.Domain) : 0 ≤ s.sliceWeight x := (s.weight_range _).1 + +noncomputable def law (hmass : 0 < ∑ x, s.sliceWeight x) : FiniteProbabilityWeights s.Domain := + FiniteProbabilityWeights.ofPositiveWeights s.sliceWeight s.sliceWeight_nonneg hmass + +def finiteSlice (offset stride : ℤ) : FiniteCoefficientSlice where + length := s.length + offset := offset + stride := stride + modulus := s.modulus + residue := s.residue + +theorem affine_abs_le (offset : ℤ) (stride : ℕ) (x : s.Domain) : + |((offset + (stride : ℤ) * x.val : ℤ) : ℝ)| ≤ |(offset : ℝ)| + (stride : ℝ) * s.length := by + have hb := (s.finiteSlice offset stride).value_abs_le x + have hb' : |(((s.finiteSlice offset stride).value x : ℤ) : ℝ)| ≤ + ((s.finiteSlice offset stride).radius : ℝ) := by exact_mod_cast hb + simpa only [finiteSlice, FiniteCoefficientSlice.value, FiniteCoefficientSlice.radius, + Nat.cast_add, Nat.cast_mul, Nat.cast_natAbs, Int.cast_abs, Int.cast_natCast, + abs_of_nonneg (Nat.cast_nonneg stride : (0 : ℝ) ≤ _)] using hb' + +noncomputable def longNormalizer (h : scalarCubeNormalizationThreshold Empty M B T ≤ s.length) : ℝ := + (scalarCubeResidueWeights Empty s.length M (scalarCubeNormalizationThreshold_spec Empty h).1 + (fun _ => s.modulus) (fun _ => s.residue) (fun _ => s.modulus_pos) (fun _ => s.modulus_le) + (scalarCubeNormalizationThreshold_spec Empty h).2.1).mean + (fun z => s.weight (fun i => (z i : ℝ) / s.length)) + +theorem longNormalizer_bounds (h : scalarCubeNormalizationThreshold Empty M B T ≤ s.length) : + 1 / 2 ≤ s.longNormalizer h ∧ s.longNormalizer h ≤ 3 / 2 := + scalarCube_weight_normalizer_of_threshold Empty s.length M (fun _ => s.modulus) (fun _ => s.residue) + (fun _ => s.modulus_pos) (fun _ => s.modulus_le) s.weight s.weight_range + s.weight_lipschitz s.weight_integral h + +theorem longNormalizer_eq_expect (h : scalarCubeNormalizationThreshold Empty M B T ≤ s.length) : + s.longNormalizer h = 𝔼 x : s.Domain, s.sliceWeight x := by + unfold longNormalizer + rw [scalarCubeResidueWeights_mean] + apply Fintype.expect_equiv (emptyScalarCubeResidueEquiv s.length (fun _ => s.modulus) (fun _ => s.residue)) + intro x + unfold sliceWeight + congr 1 + funext i + cases i with + | none => rfl + | some a => exact a.elim + +theorem long_total_pos (h : scalarCubeNormalizationThreshold Empty M B T ≤ s.length) : + 0 < ∑ x, s.sliceWeight x := by + apply FiniteProbabilityWeights.sum_pos_of_expect_pos + rw [← s.longNormalizer_eq_expect h] + have hb := (s.longNormalizer_bounds h).1 + linarith + +noncomputable def normalized (hB : 0 < B) + (h : scalarCubeNormalizationThreshold Empty M B T ≤ s.length) : NormalizedScalarCubeSource Empty := + normalizedScalarCubeSourceOfThreshold Empty s.length M (fun _ => s.modulus) (fun _ => s.residue) + (fun _ => s.modulus_pos) (fun _ => s.modulus_le) s.weight B T hB s.weight_range + s.weight_lipschitz s.weight_integral h + +theorem normalized_coefficientDensity (hB : 0 < B) + (h : scalarCubeNormalizationThreshold Empty M B T ≤ s.length) (x : s.Domain) : + (s.normalized hB h).coefficientDensity x = s.sliceWeight x / s.longNormalizer h := rfl + +theorem normalized_coefficientWeights (hB : 0 < B) + (h : scalarCubeNormalizationThreshold Empty M B T ≤ s.length) + (hmass : 0 < ∑ x, s.sliceWeight x) : (s.normalized hB h).coefficientWeights = s.law hmass := by + have hZ : 0 < s.longNormalizer h := by have hb := (s.longNormalizer_bounds h).1; linarith + exact FiniteProbabilityWeights.ofDensity_div_eq_ofPositiveWeights s.sliceWeight s.sliceWeight_nonneg + hmass hZ (s.normalized hB h).coefficientDensity_mean_one + +end SmoothCoefficientSlice + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmoothHalfspaceCutoff.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothHalfspaceCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..cae513eb5ef84f138d62e9ea52270f68d32774e1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothHalfspaceCutoff.lean @@ -0,0 +1,87 @@ +import Mathlib.Analysis.Calculus.ContDiff.RCLike +import Mathlib.Analysis.Calculus.FDeriv.Mul +import Mathlib.Analysis.SpecialFunctions.SmoothTransition +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal ContDiff + +theorem exists_smoothTransition_lipschitz : + ∃ A : ℝ≥0, 1 ≤ A ∧ LipschitzWith A Real.smoothTransition := by + have hs : ContDiffOn ℝ 1 Real.smoothTransition (Set.Icc (0 : ℝ) 1) := + Real.smoothTransition.contDiff.contDiffOn + obtain ⟨K, hK⟩ := hs.exists_lipschitzOnWith one_ne_zero (convex_Icc _ _) isCompact_Icc + have hglobal : LipschitzWith K Real.smoothTransition := by + apply LipschitzWith.of_dist_le_mul + intro x y + have hx := (Set.projIcc (0 : ℝ) 1 zero_le_one x).property + have hy := (Set.projIcc (0 : ℝ) 1 zero_le_one y).property + have h := hK.dist_le_mul _ hx _ hy + simp only [Real.smoothTransition.projIcc] at h + have hp := (LipschitzWith.projIcc (a := (0 : ℝ)) (b := 1) zero_le_one).dist_le_mul x y + simp only [NNReal.coe_one, one_mul] at hp + exact h.trans (mul_le_mul_of_nonneg_left hp K.coe_nonneg) + exact ⟨K + 1, by simp, hglobal.weaken (by simp)⟩ + +noncomputable def halfspaceCutoff {E : Type*} (r : ℝ) (d : E → ℝ) (x : E) : ℝ := + Real.smoothTransition (d x / r - 1) + +theorem halfspaceCutoff_range {E : Type*} (r : ℝ) (d : E → ℝ) (x : E) : + halfspaceCutoff r d x ∈ Set.Icc (0 : ℝ) 1 := + ⟨Real.smoothTransition.nonneg _, Real.smoothTransition.le_one _⟩ + +theorem halfspaceCutoff_eq_zero {E : Type*} {r : ℝ} (hr : 0 < r) + (d : E → ℝ) {x : E} (hx : d x ≤ r) : halfspaceCutoff r d x = 0 := by + apply Real.smoothTransition.zero_of_nonpos + exact sub_nonpos.mpr ((div_le_one hr).mpr hx) + +theorem halfspaceCutoff_eq_one {E : Type*} {r : ℝ} (hr : 0 < r) + (d : E → ℝ) {x : E} (hx : 2 * r ≤ d x) : halfspaceCutoff r d x = 1 := by + apply Real.smoothTransition.one_of_one_le + have h := (le_div_iff₀ hr).mpr hx + linarith + +theorem halfspaceCutoff_tsupport_subset {E : Type*} [TopologicalSpace E] + {r : ℝ} (hr : 0 < r) (d : E → ℝ) (hd : Continuous d) : + tsupport (halfspaceCutoff r d) ⊆ {x | r ≤ d x} := by + apply closure_minimal _ (isClosed_le continuous_const hd) + intro x hx + change r ≤ d x + by_contra! h + exact hx (halfspaceCutoff_eq_zero hr d h.le) + +theorem contDiff_halfspaceCutoff {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (r : ℝ) (d : E → ℝ) (hd : ContDiff ℝ ∞ d) : ContDiff ℝ ∞ (halfspaceCutoff r d) := + Real.smoothTransition.contDiff.comp ((hd.div_const r).sub contDiff_const) + +theorem halfspaceCutoff_fderiv_norm_le {E : Type*} + [NormedAddCommGroup E] [NormedSpace ℝ E] + (A : ℝ≥0) (hLip : LipschitzWith A Real.smoothTransition) + {r : ℝ} (hr : 0 < r) (d : E → ℝ) {x : E} (hd : DifferentiableAt ℝ d x) : + ‖fderiv ℝ (halfspaceCutoff r d) x‖ ≤ (A : ℝ) / r * ‖fderiv ℝ d x‖ := by + have ht : DifferentiableAt ℝ Real.smoothTransition (r⁻¹ • d x - 1) := + ((Real.smoothTransition.contDiff : ContDiff ℝ 1 _).differentiable one_ne_zero).differentiableAt + have heq : halfspaceCutoff r d = Real.smoothTransition ∘ (fun y => r⁻¹ • d y - 1) := by + funext y + simp only [halfspaceCutoff, Function.comp_apply, smul_eq_mul, div_eq_mul_inv, mul_comm] + rw [heq] + change ‖fderiv ℝ (Real.smoothTransition ∘ (fun y => (r⁻¹ • d) y - 1)) x‖ ≤ _ + rw [fderiv_comp x ht ((hd.const_smul r⁻¹).sub_const 1), + fderiv_sub_const, fderiv_const_smul hd] + calc + _ ≤ ‖fderiv ℝ Real.smoothTransition (r⁻¹ • d x - 1)‖ * ‖r⁻¹ • fderiv ℝ d x‖ := + (fderiv ℝ Real.smoothTransition _).opNorm_comp_le _ + _ ≤ (A : ℝ) * ‖r⁻¹ • fderiv ℝ d x‖ := + mul_le_mul_of_nonneg_right (norm_fderiv_le_of_lipschitz ℝ hLip) (norm_nonneg _) + _ = _ := by rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_pos hr]; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmoothModerateBlockBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothModerateBlockBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce8b2d5943c3f4aabae60ce2ff07b73df10ba1f9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothModerateBlockBounds.lean @@ -0,0 +1,51 @@ +import OAI.Combinatorics.Progressions.Probability.SmoothModerateBlockLaw + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem smoothModerateBlockSum_support {b g q M K : ℕ} {B T : ℝ≥0} + (c : Fin b → SmoothCoefficientSlice M B T) (s : Fin b → Fin g → SmoothCubeSlice q M B T) + (offset : Fin b → ℤ) (stride : Fin b → ℕ) {O F : ℝ} (hO : 0 ≤ O) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (|(offset a : ℝ)| + (stride a : ℝ) * (c a).length) * + (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ g) + (center : J → ℤ) (x : SmoothModerateBlockDomain c s) (Z : J) : + |(smoothModerateBlockSum c s offset stride J center x Z : ℝ) - center Z| ≤ + (affineTorusRadius q g b (O + 1) F : ℝ) * K := by + let fs := fun a j => (s a j).finiteSlice + let coeff := fun (z : ∀ a, (c a).Domain) a => offset a + (stride a : ℤ) * (z a).val + let z := fun a => (x a).1 + let y := fun a j => (x a).2 j + let H := fun a => |(offset a : ℝ)| + (stride a : ℝ) * (c a).length + have hradius (a : Fin b) (j : Fin g) : + ((fs a j).radius : ℝ) ≤ (((q + 1 : ℕ) : ℝ) * (O + 1)) * (fs a j).length := by + apply ((s a j).finiteSlice.radius_relative (hroot a j)).trans + have hq : (1 : ℝ) ≤ (q + 1 : ℕ) := by exact_mod_cast (Nat.succ_le_succ (Nat.zero_le q)) + have h := mul_le_mul_of_nonneg_right hq + (show 0 ≤ (O + 1) * (fs a j).length by positivity) + simpa only [one_mul, mul_assoc] using h + have hbound := cubeSliceBlockSum_bound fs coeff J center (z, y) Z + have hscale := cubeSliceBlockBound_le_scale fs coeff z H + (show 0 ≤ ((q + 1 : ℕ) : ℝ) * (O + 1) by positivity) + (fun a => (c a).affine_abs_le (offset a) (stride a) (z a)) hradius + (fun a => by simpa only [H, fs, SmoothCubeSlice.finiteSlice] using hupper a) + Z (hJ Z Z.property) + have hraw : |(smoothModerateBlockSum c s offset stride J center x Z : ℝ) - center Z| ≤ + (cubeSliceBlockBound fs coeff z Z : ℝ) := by + exact_mod_cast (show |smoothModerateBlockSum c s offset stride J center x Z - center Z| ≤ + cubeSliceBlockBound fs coeff z Z from by + simpa only [cubeSliceBlockSum, coeff, smoothModerateBlockSum, fs, z, y] using hbound) + exact (hraw.trans hscale).trans + (mul_le_mul_of_nonneg_right (Nat.le_ceil _) (Nat.cast_nonneg K)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmoothPairErrorLogBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothPairErrorLogBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f31799ae303e16a2cee01a5a2bb14a4d3999be3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothPairErrorLogBounds.lean @@ -0,0 +1,510 @@ +import OAI.Combinatorics.Progressions.Dynamics.JointPivotProfileBudget +import OAI.Combinatorics.Progressions.Lattices.CellResidueCorrelation +import OAI.Combinatorics.Progressions.Sampling.SmoothPairPhysicalGrid + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem uniform_pair_sum {X Y : Type*} [Fintype X] [Fintype Y] [Nonempty X] [Nonempty Y] + (f : X → Y → ℝ) : + (Fintype.card X : ℝ) * Fintype.card Y * + (FiniteProbabilityWeights.uniform X).mean + (fun x => (FiniteProbabilityWeights.uniform Y).mean (f x)) = ∑ x, ∑ y, f x y := by + simp_rw [FiniteProbabilityWeights.uniform_mean, Fintype.expect_eq_sum_div_card, ← Finset.sum_div] + have hX : (Fintype.card X : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + have hY : (Fintype.card Y : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + field_simp [hX, hY] + +theorem uniform_joint_residual_bound {X Y A B R : Type*} + [Fintype X] [Fintype Y] [Nonempty X] [Nonempty Y] + [Fintype A] [Fintype B] [Fintype R] [Nonempty R] + [DecidableEq A] [DecidableEq B] [DecidableEq R] + (C : X → A) (D : Y → B) (F : X → R) (G : Y → R) + (e : X → ℝ) (d : Y → ℝ) (joint k : X → Y → ℝ) (cell : A → B → R → ℝ) + {V delta gamma L K epsilon zeta : ℝ} (hV : 0 < V) + (hdelta : 0 ≤ delta) (hL : 0 ≤ L) (hepsilon : 0 ≤ epsilon) (hzeta : 0 ≤ zeta) + (hp : ∀ r, (FiniteProbabilityWeights.uniform X).eventProbability (fun x => F x = r) ≤ + K / Fintype.card R) + (hq : ∀ r, (FiniteProbabilityWeights.uniform Y).eventProbability (fun y => G y = r) ≤ + K / Fintype.card R) + (he : ∀ a r, |finiteCellResidueMean (FiniteProbabilityWeights.uniform X) C F e a r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform X) C).weight a * delta / Fintype.card R) + (hd : ∀ b r, |finiteCellResidueMean (FiniteProbabilityWeights.uniform Y) D G d b r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform Y) D).weight b * gamma / Fintype.card R) + (hcell : ∀ a b r, |cell a b r| ≤ L) + (hoff : ∀ x y, F x ≠ G y → joint x y = 0) + (hpoint : ∀ x y, F x = G y → + |V * joint x y - (Fintype.card R : ℝ) * k x y| ≤ Fintype.card R * epsilon) + (hgrid : ∀ x y, F x = G y → |k x y - cell (C x) (D y) (F x)| ≤ zeta) : + |∑ x, ∑ y, joint x y * e x * d y| ≤ + ((Fintype.card X : ℝ) * Fintype.card Y / V) * + (L * delta * gamma + (epsilon + zeta) * (K / 2 * + ((FiniteProbabilityWeights.uniform X).mean (fun x => e x ^ 2) + + (FiniteProbabilityWeights.uniform Y).mean (fun y => d y ^ 2)))) := by + let p := FiniteProbabilityWeights.uniform X + let q := FiniteProbabilityWeights.uniform Y + let N : ℝ := Fintype.card R + let a : X → Y → ℝ := fun x y => V * joint x y / N + have hN : 0 < N := by dsimp only [N]; exact_mod_cast Fintype.card_pos + have hnear (x : X) (y : Y) (h : F x = G y) : |a x y - k x y| ≤ epsilon := by + have hid : a x y - k x y = (V * joint x y - N * k x y) / N := by + dsimp only [a] + field_simp [hN.ne'] + rw [hid, abs_div, abs_of_pos hN] + apply (div_le_iff₀ hN).mpr + exact (hpoint x y h).trans_eq (mul_comm _ _) + have happrox (x : X) (y : Y) (h : F x = G y) : + |a x y - cell (C x) (D y) (F x)| ≤ epsilon + zeta := + (abs_sub_le (a x y) (k x y) (cell (C x) (D y) (F x))).trans + (add_le_add (hnear x y h) (hgrid x y h)) + have hmain := finite_cell_kernel_correlation p q C D F G e d a cell + hdelta hL (add_nonneg hepsilon hzeta) hp hq he hd hcell happrox + have hpoint' (x : X) (y : Y) : + N * (if F x = G y then a x y * e x * d y else 0) = V * (joint x y * e x * d y) := by + by_cases h : F x = G y + · simp only [h, ite_true, a] + field_simp + · simp [h, hoff x y h] + have hscaled : N * p.mean (fun x => q.mean (fun y => if F x = G y then a x y * e x * d y else 0)) = + V * p.mean (fun x => q.mean (fun y => joint x y * e x * d y)) := by + calc + _ = p.mean (fun x => q.mean (fun y => N * + (if F x = G y then a x y * e x * d y else 0))) := by + simp only [q.mean_const_mul, p.mean_const_mul] + _ = _ := by simp only [hpoint', q.mean_const_mul, p.mean_const_mul] + have hsum := uniform_pair_sum (fun x y => joint x y * e x * d y) + have hid : (∑ x, ∑ y, joint x y * e x * d y) = + ((Fintype.card X : ℝ) * Fintype.card Y / V) * + (N * p.mean (fun x => q.mean (fun y => if F x = G y then a x y * e x * d y else 0))) := by + rw [hscaled] + change _ = _ * (V * (FiniteProbabilityWeights.uniform X).mean + (fun x => (FiniteProbabilityWeights.uniform Y).mean (fun y => joint x y * e x * d y))) + rw [← mul_assoc, div_mul_cancel₀ _ hV.ne'] + exact hsum.symm + rw [hid, abs_mul, abs_of_nonneg (by positivity : 0 ≤ (Fintype.card X : ℝ) * Fintype.card Y / V)] + exact mul_le_mul_of_nonneg_left hmain (by positivity) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem smoothSource_pair_kernel_reduction {J I A B R : Type*} + [Fintype J] [Fintype I] [Fintype A] [Fintype B] [Fintype R] [Nonempty R] + [DecidableEq A] [DecidableEq B] [DecidableEq R] + (a S : Option J × I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (t u : J → ℤ) (T U : Finset (I → ℤ)) [Nonempty T] [Nonempty U] + (e d : (I → ℤ) → ℝ) (heoff : ∀ x ∉ T, e x = 0) (hdoff : ∀ y ∉ U, d y = 0) + (C : T → A) (D : U → B) (F : T → R) (G : U → R) + (k : T → U → ℝ) (cell : A → B → R → ℝ) + {V delta gamma L K epsilon zeta : ℝ} (hV : 0 < V) + (hdelta : 0 ≤ delta) (hL : 0 ≤ L) (hepsilon : 0 ≤ epsilon) (hzeta : 0 ≤ zeta) + (hp : ∀ r, (FiniteProbabilityWeights.uniform T).eventProbability (fun x => F x = r) ≤ + K / Fintype.card R) + (hq : ∀ r, (FiniteProbabilityWeights.uniform U).eventProbability (fun y => G y = r) ≤ + K / Fintype.card R) + (he : ∀ c r, |finiteCellResidueMean (FiniteProbabilityWeights.uniform T) C F (fun x => e x.val) c r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform T) C).weight c * delta / Fintype.card R) + (hd : ∀ c r, |finiteCellResidueMean (FiniteProbabilityWeights.uniform U) D G (fun y => d y.val) c r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform U) D).weight c * gamma / Fintype.card R) + (hcell : ∀ c c' r, |cell c c' r| ≤ L) + (hoff : ∀ x : T, ∀ y : U, F x ≠ G y → + ((shiftedSmoothProductPMF a S hS hZ).map (smoothAffinePairRows t u) + (affinePairRowsOfLocations (x.val, y.val))).toReal = 0) + (hpoint : ∀ x : T, ∀ y : U, F x = G y → + |V * ((shiftedSmoothProductPMF a S hS hZ).map (smoothAffinePairRows t u) + (affinePairRowsOfLocations (x.val, y.val))).toReal - + (Fintype.card R : ℝ) * k x y| ≤ Fintype.card R * epsilon) + (hgrid : ∀ x y, F x = G y → |k x y - cell (C x) (D y) (F x)| ≤ zeta) : + |(smoothSourceFiniteWeights a S hS hZ).mean + (fun z => e (smoothAffineSample t z.val) * d (smoothAffineSample u z.val))| ≤ + ((T.card : ℝ) * U.card / V) * + (L * delta * gamma + (epsilon + zeta) * (K / 2 * + ((FiniteProbabilityWeights.uniform T).mean (fun x => e x.val ^ 2) + + (FiniteProbabilityWeights.uniform U).mean (fun y => d y.val ^ 2)))) := by + rw [smoothSource_pair_correlation a S hS hZ t u T U e d heoff hdoff] + have h := uniform_joint_residual_bound C D F G (fun x => e x.val) (fun y => d y.val) + (fun x y => ((shiftedSmoothProductPMF a S hS hZ).map (smoothAffinePairRows t u) + (affinePairRowsOfLocations (x.val, y.val))).toReal) k cell + hV hdelta hL hepsilon hzeta hp hq he hd hcell hoff hpoint hgrid + have hsum (f : (I → ℤ) → (I → ℤ) → ℝ) : + (∑ x : T, ∑ y : U, f x.val y.val) = ∑ x ∈ T, ∑ y ∈ U, f x y := by + have hi (x : I → ℤ) : (∑ y : U, f x y.val) = ∑ y ∈ U, f x y := + Finset.sum_coe_sort U (f x) + simp_rw [hi] + exact Finset.sum_coe_sort T (fun x => ∑ y ∈ U, f x y) + rw [hsum (fun x y => ((shiftedSmoothProductPMF a S hS hZ).map (smoothAffinePairRows t u) + (affinePairRowsOfLocations (x, y))).toReal * e x * d y)] at h + simpa only [Fintype.card_coe, mul_assoc] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem fullSmoothPairError_nonneg {J : Type*} [Fintype J] [DecidableEq J] + (n : ℕ) (k : J) (Q : ℕ) (C κ δ : ℝ) (hδ : 0 ≤ δ) : + 0 ≤ fullSmoothPairError n k Q C κ δ := by + have he := smoothPairProbabilityError_nonneg k Q C κ δ hδ + have hc : 0 ≤ smoothPairProbabilityCap k Q C κ := by + unfold smoothPairProbabilityCap + positivity + exact mul_nonneg (mul_nonneg (Nat.cast_nonneg _) he) + (pow_nonneg (add_nonneg hc he) _) + +theorem canonical_smooth_pair_correlation {J I A B : Type*} + [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] + [Fintype A] [DecidableEq A] [Fintype B] [DecidableEq B] + (t u : J → ℤ) (k : J) (hne : u k - t k ≠ 0) + (H : I → ℝ) {L C κ δ : ℝ} (Q : ℕ) (hH : ∀ i, 0 < H i) + (hL : 1 ≤ L) (hC : 1 ≤ C) (hκ : 0 < κ) (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (ht : ∀ j, |(t j : ℝ) / L| ≤ C) (hu : ∀ j, |(u j : ℝ) / L| ≤ C) + (hgap : κ ≤ |((u k - t k : ℤ) : ℝ) / L|) + (hQ : affinePairModulus t u ≤ Q) + (hmesh : ∀ i, ((u k - t k).natAbs : ℝ) * L / H i ≤ δ) + (hsmall : (4 : ℝ) ^ (2 + Fintype.card {j : J // j ≠ k}) * smoothPairRowLipschitz k * δ ≤ 1 / 2) + (b : Option J × I → ℤ) + (hZ : 0 < shiftedSmoothProductMass (fun z => (b z : ℝ)) + (fun z : Option J × I => smoothPairCoefficientScale (H z.2) L z.1)) + (T U : Finset (I → ℤ)) [Nonempty T] [Nonempty U] + (e d : (I → ℤ) → ℝ) (heoff : ∀ x ∉ T, e x = 0) (hdoff : ∀ y ∉ U, d y = 0) + (P : T → A) (R : U → B) (cell : A → B → (I → ZMod (affinePairModulus t u)) → ℝ) + {alpha beta cap mass zeta : ℝ} (halpha : 0 ≤ alpha) (hcap : 0 ≤ cap) (hzeta : 0 ≤ zeta) + (hp : ∀ r, (FiniteProbabilityWeights.uniform T).eventProbability + (fun x => integerVectorResidue (affinePairModulus t u) x.val = r) ≤ + mass / (affinePairModulus t u : ℝ) ^ Fintype.card I) + (hq : ∀ r, (FiniteProbabilityWeights.uniform U).eventProbability + (fun y => integerVectorResidue (affinePairModulus t u) y.val = r) ≤ + mass / (affinePairModulus t u : ℝ) ^ Fintype.card I) + (he : ∀ c r, |finiteCellResidueMean (FiniteProbabilityWeights.uniform T) P + (fun x => integerVectorResidue (affinePairModulus t u) x.val) (fun x => e x.val) c r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform T) P).weight c * alpha / + (affinePairModulus t u : ℝ) ^ Fintype.card I) + (hd : ∀ c r, |finiteCellResidueMean (FiniteProbabilityWeights.uniform U) R + (fun y => integerVectorResidue (affinePairModulus t u) y.val) (fun y => d y.val) c r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform U) R).weight c * beta / + (affinePairModulus t u : ℝ) ^ Fintype.card I) + (hcell : ∀ c c' r, |cell c c' r| ≤ cap) + (hgrid : ∀ x : T, ∀ y : U, + integerVectorResidue (affinePairModulus t u) x.val = integerVectorResidue (affinePairModulus t u) y.val → + |shiftedPairLocationKernel t u k hne H L hH (zero_lt_one.trans_le hL) b x.val y.val - + cell (P x) (R y) (integerVectorResidue (affinePairModulus t u) x.val)| ≤ zeta) : + |(smoothSourceFiniteWeights (fun z => (b z : ℝ)) + (fun z : Option J × I => smoothPairCoefficientScale (H z.2) L z.1) + (fun z => smoothPairCoefficientScale_pos (hH z.2) (zero_lt_one.trans_le hL) z.1) hZ).mean + (fun z => e (smoothAffineSample t z.val) * d (smoothAffineSample u z.val))| ≤ + ((T.card : ℝ) * U.card / ∏ i, H i ^ 2) * + (cap * alpha * beta + (fullSmoothPairError (Fintype.card I) k Q C κ δ + zeta) * (mass / 2 * + ((FiniteProbabilityWeights.uniform T).mean (fun x => e x.val ^ 2) + + (FiniteProbabilityWeights.uniform U).mean (fun y => d y.val ^ 2)))) := by + let : NeZero (affinePairModulus t u) := ⟨(affinePairModulus_pos t u k hne).ne'⟩ + have hV : (0 : ℝ) < ∏ i, H i ^ 2 := + Finset.prod_pos (fun i _ => pow_pos (hH i) _) + refine smoothSource_pair_kernel_reduction + (fun z => (b z : ℝ)) (fun z : Option J × I => smoothPairCoefficientScale (H z.2) L z.1) + (fun z => smoothPairCoefficientScale_pos (hH z.2) (zero_lt_one.trans_le hL) z.1) hZ + t u T U e d heoff hdoff P R + (fun x => integerVectorResidue (affinePairModulus t u) x.val) + (fun y => integerVectorResidue (affinePairModulus t u) y.val) + (fun x y => shiftedPairLocationKernel t u k hne H L hH (zero_lt_one.trans_le hL) b x.val y.val) + cell hV halpha hcap (fullSmoothPairError_nonneg _ k Q C κ δ hδ) hzeta + ?_ ?_ ?_ ?_ hcell ?_ ?_ hgrid + · simpa only [integerVectorResidue_card, Nat.cast_pow] using hp + · simpa only [integerVectorResidue_card, Nat.cast_pow] using hq + · simpa only [integerVectorResidue_card, Nat.cast_pow] using he + · simpa only [integerVectorResidue_card, Nat.cast_pow] using hd + · intro x y hxy + rw [affinePairPMF_zero_off_residue _ t u x.val y.val hxy, ENNReal.toReal_zero] + · intro x y hxy + simpa only [integerVectorResidue_card, Nat.cast_pow] using + canonical_pair_point_error t u k hne H Q hH hL hC hκ hδ hδ1 ht hu hgap hQ hmesh hsmall + b hZ x.val y.val hxy + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def smoothPairErrorCoefficient {J : Type*} [Fintype J] [DecidableEq J] + (n : ℕ) (k : J) (Q : ℕ) (C κ : ℝ) : ℝ := fullSmoothPairError n k Q C κ 1 + +theorem smoothPairErrorCoefficient_nonneg {J : Type*} [Fintype J] [DecidableEq J] + (n : ℕ) (k : J) (Q : ℕ) (C κ : ℝ) : 0 ≤ smoothPairErrorCoefficient n k Q C κ := + fullSmoothPairError_nonneg n k Q C κ 1 zero_le_one + +theorem smoothPairProbabilityError_mul {J : Type*} [Fintype J] [DecidableEq J] + (k : J) (Q : ℕ) (C κ δ : ℝ) : + smoothPairProbabilityError k Q C κ δ = smoothPairProbabilityError k Q C κ 1 * δ := by + simp only [smoothPairProbabilityError, mul_one] + +theorem fullSmoothPairError_le_linear {J : Type*} [Fintype J] [DecidableEq J] + (n : ℕ) (k : J) (Q : ℕ) (C κ : ℝ) {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) : + fullSmoothPairError n k Q C κ δ ≤ smoothPairErrorCoefficient n k Q C κ * δ := by + have hE := smoothPairProbabilityError_nonneg k Q C κ 1 zero_le_one + have hcap : 0 ≤ smoothPairProbabilityCap k Q C κ := by unfold smoothPairProbabilityCap; positivity + have hEd : 0 ≤ smoothPairProbabilityError k Q C κ 1 * δ := mul_nonneg hE hδ + have hle : smoothPairProbabilityError k Q C κ 1 * δ ≤ smoothPairProbabilityError k Q C κ 1 := by + nlinarith + unfold fullSmoothPairError smoothPairErrorCoefficient + rw [smoothPairProbabilityError_mul k Q C κ δ] + calc + _ ≤ n * (smoothPairProbabilityError k Q C κ 1 * δ) * + (smoothPairProbabilityCap k Q C κ + smoothPairProbabilityError k Q C κ 1) ^ n := + mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (add_nonneg hcap hEd) (add_le_add le_rfl hle) n) + (mul_nonneg (Nat.cast_nonneg _) hEd) + _ = _ := by unfold fullSmoothPairError; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {J : Type*} [Fintype J] [DecidableEq J] + +theorem smoothPairRowLipschitz_le_exp (k : J) {P : ℝ} (hP : 0 ≤ P) + (hcard : (Fintype.card J : ℝ) ≤ Real.exp P) + (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) : + (smoothPairRowLipschitz k : ℝ) ≤ Real.exp (2 * P + 3) := by + have hd : (Fintype.card {j : J // j ≠ k} : ℝ) ≤ Fintype.card J := by + exact_mod_cast Fintype.card_subtype_le (fun j : J => j ≠ k) + have h1 : 1 ≤ Real.exp P := Real.one_le_exp_iff.mpr hP + have h3 : (3 : ℝ) ≤ Real.exp 3 := by linarith [Real.add_one_le_exp (3 : ℝ)] + have hsum : (Fintype.card {j : J // j ≠ k} : ℝ) + 2 ≤ Real.exp (P + 3) := by + rw [Real.exp_add] + nlinarith + simp only [smoothPairRowLipschitz, NNReal.coe_mul, Nat.cast_add, Nat.cast_ofNat] + calc + _ ≤ Real.exp (P + 3) * Real.exp P := mul_le_mul hsum hprofile (by positivity) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem smoothPairScaleRatio_le_exp {C κ P : ℝ} + (hC0 : 0 ≤ C) (hκ0 : 0 < κ) (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) : + 4 * C / κ ≤ Real.exp (2 * P + 4) := by + have h4 : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + rw [div_eq_mul_inv] + calc + _ ≤ Real.exp 4 * Real.exp P * Real.exp P := by gcongr + _ = _ := by simp only [← Real.exp_add]; congr 1; ring + +theorem smoothPairQuadraticFactor_le_exp (k : J) {C κ P : ℝ} + (hC0 : 0 ≤ C) (hκ0 : 0 < κ) (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) : + 2 * (4 * C / κ) ^ 2 * 2 ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp (5 * P + 10) := by + have h2 : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have hU := smoothPairScaleRatio_le_exp hC0 hκ0 hC hκ + calc + _ ≤ Real.exp 2 * (Real.exp (2 * P + 4)) ^ 2 * Real.exp P := by gcongr + _ = _ := by rw [← Real.exp_nat_mul]; simp only [← Real.exp_add]; congr 1; ring + +theorem smoothPairProbabilityCap_le_exp (k : J) (Q : ℕ) {C κ P : ℝ} + (hP : 0 ≤ P) (hC0 : 0 ≤ C) (hκ0 : 0 < κ) + (hQ : (Q : ℝ) ≤ Real.exp P) (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) : + smoothPairProbabilityCap k Q C κ ≤ Real.exp (6 * P + 11) := by + have hfactor := smoothPairQuadraticFactor_le_exp k hC0 hκ0 hC hκ hpow + have hproduct : (Q : ℝ) * (2 * (4 * C / κ) ^ 2 * 2 ^ Fintype.card {j : J // j ≠ k}) ≤ + Real.exp (6 * P + 10) := by + calc + _ ≤ Real.exp P * Real.exp (5 * P + 10) := mul_le_mul hQ hfactor (by positivity) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + calc + _ ≤ Real.exp ((6 * P + 10) + 1) := one_add_le_exp_succ (by linarith) hproduct + _ = _ := by congr 1; ring + +theorem smoothPairKernelBaseCap_le_exp (k : J) {C κ P : ℝ} + (hP : 0 ≤ P) (hC0 : 0 ≤ C) (hκ0 : 0 < κ) (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) : + (smoothPairKernelBaseCap k C κ : ℝ) ≤ Real.exp (5 * P + 11) := by + apply coe_toNNReal_le_exp + calc + _ ≤ Real.exp ((5 * P + 10) + 1) := one_add_le_exp_succ (by linarith) + (smoothPairQuadraticFactor_le_exp k hC0 hκ0 hC hκ hpow) + _ = _ := by congr 1; ring + +theorem smoothPairKernelBaseLip_le_exp (k : J) {C κ P : ℝ} + (hC0 : 0 ≤ C) (hκ0 : 0 < κ) (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) + (hrow : (smoothPairRowLipschitz k : ℝ) ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) : + (smoothPairKernelBaseLip k C κ : ℝ) ≤ Real.exp (8 * P + 14) := by + have h2 : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have hU := smoothPairScaleRatio_le_exp hC0 hκ0 hC hκ + apply coe_toNNReal_le_exp + calc + _ ≤ Real.exp 2 * (Real.exp (2 * P + 4)) ^ 3 * Real.exp P * Real.exp P := by gcongr + _ = _ := by rw [← Real.exp_nat_mul]; simp only [← Real.exp_add]; congr 1; ring + +theorem smoothPairKernelCap_le_exp (n : ℕ) (k : J) {C κ P : ℝ} + (hP : 0 ≤ P) (hC0 : 0 ≤ C) (hκ0 : 0 < κ) (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) : + (smoothPairKernelCap n k C κ : ℝ) ≤ Real.exp ((n : ℝ) * (5 * P + 11)) := by + simpa only [smoothPairKernelCap, NNReal.coe_pow, Real.exp_nat_mul] using + pow_le_pow_left₀ (NNReal.coe_nonneg (smoothPairKernelBaseCap k C κ)) + (smoothPairKernelBaseCap_le_exp k hP hC0 hκ0 hC hκ hpow) n + +theorem smoothPairKernelLip_le_exp (n : ℕ) (k : J) {C κ P : ℝ} + (hP : 0 ≤ P) (hC0 : 0 ≤ C) (hκ0 : 0 < κ) + (hn : (n : ℝ) ≤ Real.exp P) (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) + (hrow : (smoothPairRowLipschitz k : ℝ) ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) : + (smoothPairKernelLip n k C κ : ℝ) ≤ Real.exp ((n : ℝ) * (5 * P + 11) + 9 * P + 14) := by + have hbase := smoothPairKernelBaseLip_le_exp k hC0 hκ0 hC hκ hrow hpow + have hcap := smoothPairKernelCap_le_exp n k hP hC0 hκ0 hC hκ hpow + simp only [smoothPairKernelLip, NNReal.coe_mul, NNReal.coe_natCast] + calc + _ ≤ Real.exp P * Real.exp (8 * P + 14) * Real.exp ((n : ℝ) * (5 * P + 11)) := by gcongr + _ = _ := by simp only [← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {J : Type*} [Fintype J] [DecidableEq J] + +theorem smoothPair_pivot_card (k : J) : Fintype.card {j : J // j ≠ k} = Fintype.card J - 1 := by + rw [Fintype.card_subtype_compl, Fintype.card_subtype_eq] + +theorem smoothPairRowLipschitz_pivot (k l : J) : smoothPairRowLipschitz k = smoothPairRowLipschitz l := by + simp only [smoothPairRowLipschitz, smoothPair_pivot_card] + +theorem smoothPairProbabilityError_pivot (k l : J) (Q : ℕ) (C κ δ : ℝ) : + smoothPairProbabilityError k Q C κ δ = smoothPairProbabilityError l Q C κ δ := by + simp only [smoothPairProbabilityError, smoothPair_pivot_card, smoothPairRowLipschitz_pivot k l] + +theorem smoothPairProbabilityCap_pivot (k l : J) (Q : ℕ) (C κ : ℝ) : + smoothPairProbabilityCap k Q C κ = smoothPairProbabilityCap l Q C κ := by + simp only [smoothPairProbabilityCap, smoothPair_pivot_card] + +theorem fullSmoothPairError_pivot (n : ℕ) (k l : J) (Q : ℕ) (C κ δ : ℝ) : + fullSmoothPairError n k Q C κ δ = fullSmoothPairError n l Q C κ δ := by + simp only [fullSmoothPairError, smoothPairProbabilityCap_pivot k l, smoothPairProbabilityError_pivot k l] + +theorem smoothPairKernelCap_pivot (n : ℕ) (k l : J) (C κ : ℝ) : + smoothPairKernelCap n k C κ = smoothPairKernelCap n l C κ := by + simp only [smoothPairKernelCap, smoothPairKernelBaseCap, smoothPair_pivot_card] + +theorem smoothPairKernelLip_pivot (n : ℕ) (k l : J) (C κ : ℝ) : + smoothPairKernelLip n k C κ = smoothPairKernelLip n l C κ := by + simp only [smoothPairKernelLip, smoothPairKernelCap_pivot n k l, smoothPairKernelBaseLip, + smoothPair_pivot_card, smoothPairRowLipschitz_pivot k l] + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {J : Type*} [Fintype J] [DecidableEq J] + +noncomputable def smoothPairRowErrorLog (d : ℕ) (P : ℝ) : ℝ := + (16 + 4 * d) * P + 16 * d + 48 + +theorem smoothPairRowErrorLog_nonneg (d : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ smoothPairRowErrorLog d P := by + unfold smoothPairRowErrorLog + positivity + +theorem smoothPairProbabilityError_one_le_exp (k : J) (Q : ℕ) {C κ P : ℝ} + (hP : 0 ≤ P) (hC0 : 0 ≤ C) (hκ0 : 0 < κ) + (hQ : (Q : ℝ) ≤ Real.exp P) (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) + (hcard : (Fintype.card J : ℝ) ≤ Real.exp P) + (hrow : (smoothPairRowLipschitz k : ℝ) ≤ Real.exp P) : + smoothPairProbabilityError k Q C κ 1 ≤ + Real.exp (smoothPairRowErrorLog (Fintype.card {j : J // j ≠ k}) P) := by + have hlift : Real.exp P ≤ Real.exp (2 * P + 4) := Real.exp_le_exp.mpr (by linarith) + have hV : (Fintype.card J : ℝ) * C ≤ Real.exp (2 * P + 4) := by + calc + _ ≤ Real.exp P * Real.exp P := mul_le_mul hcard hC hC0 (Real.exp_nonneg _) + _ = Real.exp (2 * P) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + have h1 : (1 : ℝ) ≤ Real.exp (2 * P + 4) := Real.one_le_exp_iff.mpr (by linarith) + have h := normalizedFiberErrorConstant_le_exp 2 (Fintype.card {j : J // j ≠ k}) + (smoothPairRowLipschitz k) (by linarith : 0 ≤ 2 * P + 4) + (Nat.cast_nonneg Q) (by positivity) (by positivity) (by norm_num) (by norm_num) + (hQ.trans hlift) (smoothPairScaleRatio_le_exp hC0 hκ0 hC hκ) hV h1 h1 (hrow.trans hlift) + simp only [smoothPairProbabilityError, mul_one] + apply h.trans_eq + congr 1 + unfold smoothPairRowErrorLog + ring + +noncomputable def smoothPairErrorLog (n d : ℕ) (P : ℝ) : ℝ := + P + smoothPairRowErrorLog d P + n * (smoothPairRowErrorLog d P + 6 * P + 12) + +theorem smoothPairErrorLog_nonneg (n d : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ smoothPairErrorLog n d P := by + have hr := smoothPairRowErrorLog_nonneg d hP + unfold smoothPairErrorLog + positivity + +theorem smoothPairErrorCoefficient_le_exp (n : ℕ) (k : J) (Q : ℕ) {C κ P : ℝ} + (hP : 0 ≤ P) (hC0 : 0 ≤ C) (hκ0 : 0 < κ) + (hn : (n : ℝ) ≤ Real.exp P) (hQ : (Q : ℝ) ≤ Real.exp P) + (hC : C ≤ Real.exp P) (hκ : κ⁻¹ ≤ Real.exp P) + (hcard : (Fintype.card J : ℝ) ≤ Real.exp P) + (hrow : (smoothPairRowLipschitz k : ℝ) ≤ Real.exp P) + (hpow : (2 : ℝ) ^ Fintype.card {j : J // j ≠ k} ≤ Real.exp P) : + smoothPairErrorCoefficient n k Q C κ ≤ + Real.exp (smoothPairErrorLog n (Fintype.card {j : J // j ≠ k}) P) := by + let d := Fintype.card {j : J // j ≠ k} + have hr := smoothPairProbabilityError_one_le_exp k Q hP hC0 hκ0 hQ hC hκ hcard hrow + have hc := smoothPairProbabilityCap_le_exp k Q hP hC0 hκ0 hQ hC hκ hpow + have hsum : smoothPairProbabilityCap k Q C κ + smoothPairProbabilityError k Q C κ 1 ≤ + Real.exp (smoothPairRowErrorLog d P + 6 * P + 12) := by + have hh := add_le_exp_add_one (by linarith : 0 ≤ 6 * P + 11) + (smoothPairRowErrorLog_nonneg d hP) hc hr + apply hh.trans_eq + congr 1 + ring + have hr0 := smoothPairProbabilityError_nonneg k Q C κ 1 zero_le_one + have hc0 : 0 ≤ smoothPairProbabilityCap k Q C κ := by unfold smoothPairProbabilityCap; positivity + unfold smoothPairErrorCoefficient fullSmoothPairError + calc + _ ≤ Real.exp P * Real.exp (smoothPairRowErrorLog d P) * + (Real.exp (smoothPairRowErrorLog d P + 6 * P + 12)) ^ n := by gcongr + _ = _ := by + rw [← Real.exp_nat_mul] + simp only [← Real.exp_add] + congr 1 + +theorem smoothPairMeshCoefficient_le_exp (k : J) {P : ℝ} + (hrow : (smoothPairRowLipschitz k : ℝ) ≤ Real.exp P) : + (4 : ℝ) ^ (2 + Fintype.card {j : J // j ≠ k}) * smoothPairRowLipschitz k ≤ + Real.exp (4 * (2 + (Fintype.card {j : J // j ≠ k} : ℝ)) + P) := by + have h4 : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + calc + _ ≤ (Real.exp 4) ^ (2 + Fintype.card {j : J // j ≠ k}) * Real.exp P := by gcongr + _ = _ := by rw [← Real.exp_nat_mul, ← Real.exp_add]; push_cast; congr 1; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmoothProfileReindexing.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothProfileReindexing.lean new file mode 100644 index 0000000000000000000000000000000000000000..c59713f8abcaf67889f44c271f205e867548ba49 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothProfileReindexing.lean @@ -0,0 +1,61 @@ +import OAI.Combinatorics.Progressions.Sampling.SmoothSplitSampling + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem pmf_map_equiv_apply {X Y : Type*} (p : PMF X) (e : X ≃ Y) (y : Y) : + (p.map e) y = p (e.symm y) := by + classical + rw [PMF.map_apply, tsum_eq_single (e.symm y)] + · simp + · intro z hz + have he : y ≠ e z := by + intro he + apply hz + apply e.injective + simpa only [e.apply_symm_apply] using he.symm + simp only [ite_eq_right_iff] + exact fun h => (he h).elim + +theorem smoothProductPMF_reindex_apply {I J : Type*} [Fintype I] [Fintype J] + (e : I ≃ J) (S : J → ℝ) (hS : ∀ j, 0 < S j) (z : J → ℤ) : + smoothProductPMF (S ∘ e) (fun i => hS (e i)) (z ∘ e) = smoothProductPMF S hS z := by + apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp + rw [smoothProductPMF_apply, smoothProductPMF_apply] + exact Equiv.prod_comp e (fun j => (smoothCoefficientPMF (S j) (hS j) (z j)).toReal) + +theorem smoothProductPMF_reindex {I J : Type*} [Fintype I] [Fintype J] + (e : I ≃ J) (S : J → ℝ) (hS : ∀ j, 0 < S j) : + (smoothProductPMF (S ∘ e) (fun i => hS (e i))).map + (fun z => z ∘ e.symm) = smoothProductPMF S hS := by + let E : (I → ℤ) ≃ (J → ℤ) := Equiv.arrowCongr e (Equiv.refl ℤ) + change (smoothProductPMF (S ∘ e) (fun i => hS (e i))).map E = _ + ext z + rw [pmf_map_equiv_apply] + exact smoothProductPMF_reindex_apply e S hS z + +theorem smoothSplit_inputPMF_join {I J : Type*} [Fintype I] [Fintype J] + (S : I → ℝ) (T : J → ℝ) (hS : ∀ i, 0 < S i) (hT : ∀ j, 0 < T j) : + (scaledInputPMF (smoothSplitProfile J I) (fun p => (smoothSplitProfile_range J I p).1) + S T hS hT (smoothSplitProfile_zero_outside J I) (smoothSplit_mass_pos S T hS hT)).map + (fun p => Sum.elim p.1 p.2) = + smoothProductPMF (Sum.elim S T) (fun k => Sum.rec hS hT k) := by + let E := (Equiv.sumPiEquivProdPi (fun _ : I ⊕ J => ℤ)).symm + change (scaledInputPMF _ _ _ _ _ _ _ _).map E = _ + ext z + rw [pmf_map_equiv_apply] + apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp + rw [smoothSplit_inputPMF_apply, smoothProductPMF_apply] + simp only [Fintype.prod_sum_type, Sum.elim_inl, Sum.elim_inr] + rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmoothSublevelCutoff.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothSublevelCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ba81e286d35dbf9b3465ae5541d160a124570bf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothSublevelCutoff.lean @@ -0,0 +1,123 @@ +import Mathlib.Analysis.Calculus.BumpFunction.InnerProduct +import Mathlib.Analysis.Calculus.ContDiff.RCLike +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open scoped ContDiff NNReal + +theorem exists_smooth_scalar_cutoff : + ∃ A : ℝ≥0, 1 ≤ A ∧ ∃ χ : ℝ → ℝ, + ContDiff ℝ ∞ χ ∧ (∀ x, 0 ≤ χ x ∧ χ x ≤ 1) ∧ + (∀ x, |x| ≤ 1 / 2 → χ x = 1) ∧ + (∀ x, 3 / 4 ≤ |x| → χ x = 0) ∧ LipschitzWith A χ := by + let f : ContDiffBump (0 : ℝ) := ⟨1 / 2, 3 / 4, by norm_num, by norm_num⟩ + have hsmooth : ContDiff ℝ 1 f := f.contDiff + obtain ⟨A, hA⟩ := ContDiff.lipschitzWith_of_hasCompactSupport f.hasCompactSupport hsmooth one_ne_zero + refine ⟨A + 1, by simp, f, f.contDiff, fun x => ⟨f.nonneg, f.le_one⟩, ?_, ?_, ?_⟩ + · intro x hx + apply f.one_of_mem_closedBall + simpa only [Metric.mem_closedBall, Real.dist_eq, sub_zero] using hx + · intro x hx + apply f.zero_of_le_dist + simpa only [Real.dist_eq, sub_zero] using hx + · exact hA.weaken (by simp) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal ContDiff + +theorem exists_smooth_sublevel_cutoff : + ∃ A : ℝ≥0, 1 ≤ A ∧ ∃ ψ : ℝ → ℝ, + ContDiff ℝ ∞ ψ ∧ (∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) ∧ + (∀ t, |t| ≤ 1 → ψ t = 0) ∧ + (∀ t, 2 ≤ |t| → ψ t = 1) ∧ LipschitzWith A ψ := by + obtain ⟨A, hA, χ, hs, hrange, hone, hzero, hLip⟩ := exists_smooth_scalar_cutoff + refine ⟨A, hA, fun t => 1 - χ (t / 2), ?_, ?_, ?_, ?_, ?_⟩ + · exact contDiff_const.sub (hs.comp (contDiff_id.div_const 2)) + · intro t + exact ⟨sub_nonneg.mpr (hrange _).2, by linarith [(hrange (t / 2)).1]⟩ + · intro t ht + have ht' : |t / 2| ≤ 1 / 2 := by rw [abs_div]; norm_num; linarith + simp only [hone (t / 2) ht', sub_self] + · intro t ht + have ht' : 3 / 4 ≤ |t / 2| := by rw [abs_div]; norm_num; linarith + simp only [hzero (t / 2) ht', sub_zero] + · apply LipschitzWith.of_dist_le_mul + intro x y + have h := hLip.dist_le_mul (x / 2) (y / 2) + rw [Real.dist_eq, Real.dist_eq, ← sub_div, abs_div, abs_of_pos (by norm_num : (0 : ℝ) < 2)] at h + rw [Real.dist_eq, Real.dist_eq] + have heq : (1 - χ (x / 2)) - (1 - χ (y / 2)) = -(χ (x / 2) - χ (y / 2)) := by ring + rw [heq, abs_neg] + exact h.trans (by nlinarith [A.coe_nonneg, abs_nonneg (x - y)]) + +noncomputable def sublevelCutoff {E : Type*} (ψ : ℝ → ℝ) (r : ℝ) (d : E → ℝ) (x : E) : ℝ := + ψ (d x / r) + +theorem sublevelCutoff_range {E : Type*} (ψ : ℝ → ℝ) + (hψ : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) (r : ℝ) (d : E → ℝ) (x : E) : + sublevelCutoff ψ r d x ∈ Set.Icc (0 : ℝ) 1 := hψ _ + +theorem sublevelCutoff_eq_zero {E : Type*} (ψ : ℝ → ℝ) + (hψ : ∀ t, |t| ≤ 1 → ψ t = 0) {r : ℝ} (hr : 0 < r) + (d : E → ℝ) {x : E} (hx : |d x| ≤ r) : sublevelCutoff ψ r d x = 0 := by + apply hψ + rw [abs_div, abs_of_pos hr] + exact (div_le_one hr).mpr hx + +theorem sublevelCutoff_eq_one {E : Type*} (ψ : ℝ → ℝ) + (hψ : ∀ t, 2 ≤ |t| → ψ t = 1) {r : ℝ} (hr : 0 < r) + (d : E → ℝ) {x : E} (hx : 2 * r ≤ |d x|) : sublevelCutoff ψ r d x = 1 := by + apply hψ + rw [abs_div, abs_of_pos hr] + exact (le_div_iff₀ hr).mpr hx + +theorem sublevelCutoff_tsupport_subset {E : Type*} [TopologicalSpace E] + (ψ : ℝ → ℝ) (hψ : ∀ t, |t| ≤ 1 → ψ t = 0) {r : ℝ} (hr : 0 < r) + (d : E → ℝ) (hd : Continuous d) : + tsupport (sublevelCutoff ψ r d) ⊆ {x | r ≤ |d x|} := by + apply closure_minimal _ (isClosed_le continuous_const hd.abs) + intro x hx + change r ≤ |d x| + by_contra! h + exact hx (sublevelCutoff_eq_zero ψ hψ hr d h.le) + +theorem contDiff_sublevelCutoff {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (r : ℝ) (d : E → ℝ) + (hd : ContDiff ℝ ∞ d) : ContDiff ℝ ∞ (sublevelCutoff ψ r d) := + hψ.comp (hd.div_const r) + +theorem sublevelCutoff_fderiv_norm_le {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (A : ℝ≥0) (hLip : LipschitzWith A ψ) + {r : ℝ} (hr : 0 < r) (d : E → ℝ) {x : E} (hd : DifferentiableAt ℝ d x) : + ‖fderiv ℝ (sublevelCutoff ψ r d) x‖ ≤ (A : ℝ) / r * ‖fderiv ℝ d x‖ := by + have hψd : DifferentiableAt ℝ ψ (r⁻¹ • d x) := hψ.differentiable (by norm_num) |>.differentiableAt + have heq : sublevelCutoff ψ r d = ψ ∘ (fun y => r⁻¹ • d y) := by + ext y + simp only [sublevelCutoff, Function.comp_apply, smul_eq_mul, div_eq_mul_inv, mul_comm] + rw [heq] + change ‖fderiv ℝ (ψ ∘ (r⁻¹ • d)) x‖ ≤ _ + rw [fderiv_comp x hψd (hd.const_smul r⁻¹), fderiv_const_smul hd] + calc + _ ≤ ‖fderiv ℝ ψ (r⁻¹ • d x)‖ * ‖r⁻¹ • fderiv ℝ d x‖ := + (fderiv ℝ ψ (r⁻¹ • d x)).opNorm_comp_le _ + _ ≤ (A : ℝ) * ‖r⁻¹ • fderiv ℝ d x‖ := + mul_le_mul_of_nonneg_right (norm_fderiv_le_of_lipschitz ℝ hLip) (norm_nonneg _) + _ = _ := by rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_pos hr]; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmoothWindowChange.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothWindowChange.lean new file mode 100644 index 0000000000000000000000000000000000000000..699c1b393b1cc12c207bf3e8cf6c80a9064157d6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothWindowChange.lean @@ -0,0 +1,179 @@ +import OAI.Combinatorics.Progressions.Lattices.SmoothIntegerTranslation +import OAI.Combinatorics.Progressions.Probability.ObservedProductDensity + +namespace OAI + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped BigOperators + +theorem exists_bounded_change_of_measure {Ω : Type*} [Fintype Ω] + (p q : FiniteProbabilityWeights Ω) {C : ℝ} (hC : 0 < C) + (hdom : ∀ x, q.weight x ≤ C * p.weight x) : + ∃ w : Ω → ℝ, (∀ x, 0 ≤ w x ∧ w x ≤ 1) ∧ + ∀ f : Ω → ℝ, q.mean f = C * p.mean (fun x => w x * f x) := by + let w : Ω → ℝ := fun x => q.weight x / (C * p.weight x) + have hw (x : Ω) : 0 ≤ w x ∧ w x ≤ 1 := by + refine ⟨div_nonneg (q.nonneg x) (mul_nonneg hC.le (p.nonneg x)), ?_⟩ + by_cases hp : p.weight x = 0 + · simp [w, hp] + · exact (div_le_one (mul_pos hC (lt_of_le_of_ne (p.nonneg x) (Ne.symm hp)))).mpr + (hdom x) + refine ⟨w, hw, fun f => ?_⟩ + unfold mean + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + by_cases hp : p.weight x = 0 + · have hq : q.weight x = 0 := le_antisymm (by simpa [hp] using hdom x) (q.nonneg x) + simp [hp, hq] + · dsimp only [w] + field_simp + +end Erdos3.FiniteProbabilityWeights + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem finite_window_change_of_measure {X : Type*} [DecidableEq X] + (S W : Finset X) (hWS : W ⊆ S) (p : FiniteProbabilityWeights S) + {D : ℝ} (hD : 0 < D) + (hlower : ∀ z : S, z.val ∈ W → 1 ≤ D * p.weight z) : + ∃ w : S → ℝ, (∀ z, 0 ≤ w z ∧ w z ≤ 1) ∧ + ∀ f : X → ℝ, (𝔼 z ∈ W, f z) = + (D / W.card) * p.mean (fun z => w z * f z.val) := by + let w : S → ℝ := fun z => if z.val ∈ W then 1 / (D * p.weight z) else 0 + have hw (z : S) : 0 ≤ w z ∧ w z ≤ 1 := by + dsimp only [w] + split_ifs with hz + · have hpos : 0 < D * p.weight z := lt_of_lt_of_le zero_lt_one (hlower z hz) + exact ⟨div_nonneg zero_le_one hpos.le, (div_le_one hpos).mpr (hlower z hz)⟩ + · exact ⟨le_rfl, zero_le_one⟩ + refine ⟨w, hw, fun f => ?_⟩ + have hpoint (z : S) : D * (p.weight z * (w z * f z.val)) = + if z.val ∈ W then f z.val else 0 := by + by_cases hz : z.val ∈ W + · have hp : p.weight z ≠ 0 := by + intro h + have hh := hlower z hz + norm_num [h] at hh + simp only [w, hz, ite_true] + field_simp + · simp [w, hz] + have hsum : D * p.mean (fun z => w z * f z.val) = ∑ z ∈ W, f z := by + unfold FiniteProbabilityWeights.mean + rw [Finset.mul_sum] + simp_rw [hpoint] + rw [Finset.sum_coe_sort S (fun z => if z ∈ W then f z else 0)] + calc + _ = ∑ z ∈ W, if z ∈ W then f z else 0 := + (Finset.sum_subset hWS (fun z _ hz => by simp [hz])).symm + _ = _ := Finset.sum_congr rfl (fun z hz => by simp [hz]) + rw [Finset.expect_eq_sum_div_card, ← hsum] + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def smoothSourceFiniteWeights {J : Type*} [Fintype J] + (a S : J → ℝ) (hS : ∀ j, 0 < S j) (hZ : 0 < shiftedSmoothProductMass a S) : + FiniteProbabilityWeights (rectangularWeightIndices a S 1) where + weight z := (shiftedSmoothProductPMF a S hS hZ z.val).toReal + nonneg _ := ENNReal.toReal_nonneg + total := by + rw [Finset.sum_coe_sort (rectangularWeightIndices a S 1) + (fun z => (shiftedSmoothProductPMF a S hS hZ z).toReal)] + have h : (∑' z, (shiftedSmoothProductPMF a S hS hZ z).toReal) = + ∑ z ∈ rectangularWeightIndices a S 1, (shiftedSmoothProductPMF a S hS hZ z).toReal := + (hasSum_sum_of_ne_finset_zero (shiftedSmoothProductPMF_toReal_zero_off a S hS hZ)).tsum_eq + rw [← h] + exact shiftedSmoothProductPMF_toReal_sum a S hS hZ + +theorem smoothSourceFiniteWeights_mean {J : Type*} [Fintype J] + (a S : J → ℝ) (hS : ∀ j, 0 < S j) (hZ : 0 < shiftedSmoothProductMass a S) + (f : (J → ℤ) → ℝ) : + (smoothSourceFiniteWeights a S hS hZ).mean (fun z => f z.val) = + ∑' z, (shiftedSmoothProductPMF a S hS hZ z).toReal * f z := by + unfold FiniteProbabilityWeights.mean + change (∑ z : rectangularWeightIndices a S 1, + (shiftedSmoothProductPMF a S hS hZ z.val).toReal * f z.val) = _ + rw [Finset.sum_coe_sort (rectangularWeightIndices a S 1) + (fun z => (shiftedSmoothProductPMF a S hS hZ z).toReal * f z)] + exact (hasSum_sum_of_ne_finset_zero (fun z hz => by + rw [shiftedSmoothProductPMF_toReal_zero_off a S hS hZ z hz, zero_mul])).tsum_eq.symm + +theorem smoothSourceFiniteWeights_energy {K I : Type*} [Fintype K] [Fintype I] + (a S : Option K × I → ℝ) (hS : ∀ z, 0 < S z) (hZ : 0 < shiftedSmoothProductMass a S) + (hbase : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S (none, i)) + (t : K → ℤ) (T : Finset (I → ℤ)) (e : (I → ℤ) → ℝ) (he : ∀ y ∉ T, e y = 0) + {E : ℝ} (henergy : (∑ y ∈ T, e y ^ 2) ≤ E * T.card) : + (smoothSourceFiniteWeights a S hS hZ).mean (fun z => e (smoothAffineSample t z.val) ^ 2) ≤ + (∏ i, 2 / S (none, i)) * (E * T.card) := by + rw [smoothSourceFiniteWeights_mean a S hS hZ (fun z => e (smoothAffineSample t z) ^ 2)] + exact smoothAffineSample_energy_of_sum_bound a S hS hZ hbase t T e he henergy + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem smooth_inner_mem_indices {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hscale : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) + (z : I → ℤ) (hz : ∀ i, |(z i : ℝ) - a i| ≤ S i / 2) : + z ∈ rectangularWeightIndices a S 1 := by + classical + by_contra hn + have h := shiftedSmoothProductPMF_inner_mass a S hS hZ hscale z hz + rw [shiftedSmoothProductPMF_toReal_zero_off a S hS hZ z hn, mul_zero] at h + norm_num at h + +theorem smooth_window_change_of_measure {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hscale : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) + (W : Finset (I → ℤ)) (hW : ∀ z ∈ W, ∀ i, |(z i : ℝ) - a i| ≤ S i / 2) : + ∃ w : rectangularWeightIndices a S 1 → ℝ, + (∀ z, 0 ≤ w z ∧ w z ≤ 1) ∧ + ∀ f : (I → ℤ) → ℝ, (𝔼 z ∈ W, f z) = + ((3 : ℝ) ^ Fintype.card I * (∏ i, S i) / W.card) * + (smoothSourceFiniteWeights a S hS hZ).mean (fun z => w z * f z.val) := by + classical + have hsub : W ⊆ rectangularWeightIndices a S 1 := + fun z hz => smooth_inner_mem_indices a S hS hZ hscale z (hW z hz) + have hD : 0 < ∏ i, 3 * S i := + Finset.prod_pos (fun i _ => mul_pos (by norm_num) (hS i)) + have h := finite_window_change_of_measure (rectangularWeightIndices a S 1) W hsub + (smoothSourceFiniteWeights a S hS hZ) hD + (fun z hz => shiftedSmoothProductPMF_inner_mass a S hS hZ hscale z.val (hW z.val hz)) + simpa only [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ] using h + +theorem shiftedSmoothProductMass_pos_of_large_scales {I : Type*} [Fintype I] + (a S : I → ℝ) (hscale : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) : + 0 < shiftedSmoothProductMass a S := by + rw [shiftedSmoothProductMass_eq_prod a S (fun i => smoothSamplingScale_pos (hscale i))] + exact Finset.prod_pos (fun i _ => shiftedSmoothSampleSum_pos (a i) (hscale i)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SmoothedImageTest.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothedImageTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f855d2dc0f836bb1e7ab201ef48d646efcae25e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SmoothedImageTest.lean @@ -0,0 +1,138 @@ +import OAI.Combinatorics.Progressions.Geometry.BoxTestSmoothing + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +noncomputable def mappedTest {Ω X : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) (U : Ω → X) (φ : X → ℝ) : ℝ := ∫ a, φ (U a) ∂μ + +theorem mappedTest_integrable {Ω X : Type*} [MeasurableSpace Ω] [MeasurableSpace X] + (μ : Measure Ω) [IsFiniteMeasure μ] (U : Ω → X) (hU : Measurable U) + (φ : X → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + Integrable (fun a => φ (U a)) μ := + (integrable_const (1 : ℝ)).mono' (hφ.comp hU).aestronglyMeasurable + (Filter.Eventually.of_forall (fun a => hbound (U a))) + +theorem mappedTest_norm_le {Ω X : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [IsFiniteMeasure μ] (U : Ω → X) (φ : X → ℝ) + (hbound : ∀ x, ‖φ x‖ ≤ 1) : ‖mappedTest μ U φ‖ ≤ μ.real Set.univ := by + have h := norm_integral_le_of_norm_le (integrable_const (1 : ℝ) (μ := μ)) + (Filter.Eventually.of_forall (fun a => hbound (U a))) + simp only [integral_const, smul_eq_mul, mul_one] at h + exact h + +theorem mappedTest_shift_measurable {Ω ι : Type*} [MeasurableSpace Ω] [Fintype ι] + (μ : Measure Ω) [SFinite μ] (U : Ω → (ι → ℝ)) (hU : Measurable U) + (φ : (ι → ℝ) → ℝ) (hφ : Measurable φ) : + Measurable (fun z => mappedTest μ U (fun x => φ (x + z))) := by + have hm : Measurable (fun p : Ω × (ι → ℝ) => φ (U p.1 + p.2)) := + hφ.comp ((hU.comp measurable_fst).add measurable_snd) + exact hm.stronglyMeasurable.integral_prod_left'.measurable + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +theorem coupled_mappedTest_difference {Ω X : Type*} [MeasurableSpace Ω] + [PseudoMetricSpace X] [MeasurableSpace X] + (μ : Measure Ω) [IsFiniteMeasure μ] (hmass : μ.real Set.univ ≤ 1) + (U V : Ω → X) (hU : Measurable U) (hV : Measurable V) + {ε : ℝ} (hε : 0 ≤ ε) (hclose : ∀ᵐ a ∂μ, dist (U a) (V a) ≤ ε) + (φ : X → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) + (L : ℝ≥0) (hL : LipschitzWith L φ) : + |mappedTest μ U φ - mappedTest μ V φ| ≤ L * ε := by + have hiU := mappedTest_integrable μ U hU φ hφ hbound + have hiV := mappedTest_integrable μ V hV φ hφ hbound + have hp : ∀ᵐ a ∂μ, ‖φ (U a) - φ (V a)‖ ≤ (L : ℝ) * ε := by + filter_upwards [hclose] with a ha + have h := (hL.dist_le_mul (U a) (V a)).trans (mul_le_mul_of_nonneg_left ha L.coe_nonneg) + simpa only [Real.dist_eq, Real.norm_eq_abs] using h + have h := norm_integral_le_of_norm_le (integrable_const ((L : ℝ) * ε) (μ := μ)) hp + rw [integral_sub hiU hiV, Real.norm_eq_abs, integral_const, smul_eq_mul] at h + exact h.trans (by nlinarith [mul_nonneg L.coe_nonneg hε]) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +variable {Ω ι : Type*} [MeasurableSpace Ω] [Fintype ι] + +theorem mappedTest_box_average (μ : Measure Ω) [IsFiniteMeasure μ] + (U : Ω → (ι → ℝ)) (hU : Measurable U) (δ : ℝ) + (φ : (ι → ℝ) → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + mappedTest μ U (boxTestAverage δ φ) = + ∫ u, boxProbabilityWindow (fun _ => δ) 0 u * mappedTest μ U (fun x => φ (x + u)) := by + have hi : Integrable (Function.uncurry + (fun a u => boxProbabilityWindow (fun _ => δ) 0 u * φ (U a + u))) (μ.prod volume) := + ((boxProbabilityWindow_integrable (fun _ => δ) 0).comp_snd μ).mul_bdd + (hφ.comp ((hU.comp measurable_fst).add measurable_snd)).aestronglyMeasurable + (Filter.Eventually.of_forall (fun p => hbound (U p.1 + p.2))) + calc + mappedTest μ U (boxTestAverage δ φ) = + ∫ a, ∫ u, boxProbabilityWindow (fun _ => δ) 0 u * φ (U a + u) ∂volume ∂μ := by + apply integral_congr_ae + filter_upwards [] with a + exact boxTestAverage_translate δ φ (U a) + _ = ∫ u, ∫ a, boxProbabilityWindow (fun _ => δ) 0 u * φ (U a + u) ∂μ := + integral_integral_swap hi + _ = ∫ u, boxProbabilityWindow (fun _ => δ) 0 u * mappedTest μ U (fun x => φ (x + u)) := by + apply integral_congr_ae + filter_upwards [] with u + exact integral_const_mul _ _ + +theorem mappedTest_box_error (μ : Measure Ω) [IsFiniteMeasure μ] + (U : Ω → (ι → ℝ)) (hU : Measurable U) (δ : ℝ) (hδ : 0 < δ) (H : ℝ≥0) + (φ : (ι → ℝ) → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) + (hmove : ∀ z, |mappedTest μ U (fun x => φ (x + z)) - mappedTest μ U φ| ≤ H * dist z 0) : + |mappedTest μ U (boxTestAverage δ φ) - mappedTest μ U φ| ≤ H * δ := by + let k := boxProbabilityWindow (fun _ : ι => δ) 0 + let A := fun z => mappedTest μ U (fun x => φ (x + z)) + let I := mappedTest μ U φ + have hk : Integrable k := boxProbabilityWindow_integrable _ _ + have ha : Integrable (fun u => k u * A u) := hk.mul_bdd + (mappedTest_shift_measurable μ U hU φ hφ).aestronglyMeasurable + (Filter.Eventually.of_forall (fun z => mappedTest_norm_le μ U (fun x => φ (x + z)) + (fun x => hbound (x + z)))) + have hconst : (∫ u, k u * I) = I := by + rw [integral_mul_const, boxProbabilityWindow_mass _ (fun _ => hδ), one_mul] + have heq : mappedTest μ U (boxTestAverage δ φ) - I = ∫ u, k u * A u - k u * I := by + rw [integral_sub ha (hk.mul_const I), hconst] + rw [mappedTest_box_average μ U hU δ φ hφ hbound] + have hpoint (u : ι → ℝ) : ‖k u * A u - k u * I‖ ≤ k u * ((H : ℝ) * δ) := by + by_cases hzero : k u = 0 + · simp only [hzero, zero_mul, sub_self, norm_zero, le_refl] + · have hdist := boxProbabilityWindow_support_dist δ hδ u hzero + rw [← mul_sub, norm_mul, Real.norm_of_nonneg (boxProbabilityWindow_nonneg _ (fun _ => hδ) _ _), + Real.norm_eq_abs] + exact mul_le_mul_of_nonneg_left + ((hmove u).trans (mul_le_mul_of_nonneg_left hdist H.coe_nonneg)) + (boxProbabilityWindow_nonneg _ (fun _ => hδ) _ _) + have h := norm_integral_le_of_norm_le (hk.mul_const ((H : ℝ) * δ)) (Filter.Eventually.of_forall hpoint) + rw [integral_mul_const, boxProbabilityWindow_mass _ (fun _ => hδ), one_mul, Real.norm_eq_abs] at h + rw [heq] + exact h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SortedPositiveWeights.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SortedPositiveWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..441d8ecf92eba21332cce1cde22f629714b938c6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SortedPositiveWeights.lean @@ -0,0 +1,28 @@ +import Mathlib.Data.Fin.Tuple.Sort +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_sorted_positive_weights {d : ℕ} (w : Fin d → ℕ) (hw : ∀ i, 1 ≤ w i) : + ∃ (e : Equiv.Perm (Fin d)) (a : ℕ), a ≤ d ∧ Monotone (w ∘ e) ∧ + ∀ i, i.val < a ↔ w (e i) = 1 := by + classical + let e := Tuple.sort w + let a := (Finset.univ.filter (fun i => w (e i) ≤ 1)).card + have hm : Monotone (w ∘ e) := Tuple.monotone_sort w + refine ⟨e, a, ?_, hm, ?_⟩ + · exact (Finset.card_filter_le _ _).trans_eq (Finset.card_fin d) + · intro i + have hi : i.val < a ↔ w (e i) ≤ 1 := + Tuple.lt_card_le_iff_apply_le_of_monotone hm + exact hi.trans ⟨fun h => Nat.le_antisymm h (hw (e i)), fun h => h.le⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SourceDetectionError.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SourceDetectionError.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b1dd3a5d0ce9ccbec26582a7296cbecf19a12dc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SourceDetectionError.lean @@ -0,0 +1,42 @@ +import Mathlib.Analysis.SpecialFunctions.ExpDeriv +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +theorem sourceDetection_error_share {A E η : ℝ} + (hE : A + 5 ≤ E) (hη : η ≤ Real.exp (-(A + 5))) : + Real.exp (-(A + 1)) + (2 * Real.exp (-E) + η) ≤ Real.exp (-A) := by + have h1 : Real.exp (-1) ≤ (1 / 2 : ℝ) := by + have hp : Real.exp (-1) * Real.exp 1 = 1 := by + rw [← Real.exp_add] + norm_num + have h := mul_le_mul_of_nonneg_left (Real.add_one_le_exp (1 : ℝ)) + (Real.exp_nonneg (-1)) + nlinarith + have h5 : Real.exp (-5) ≤ (1 / 6 : ℝ) := by + have hp : Real.exp (-5) * Real.exp 5 = 1 := by + rw [← Real.exp_add] + norm_num + have h := mul_le_mul_of_nonneg_left (Real.add_one_le_exp (5 : ℝ)) + (Real.exp_nonneg (-5)) + nlinarith + have hE' := Real.exp_le_exp.mpr (neg_le_neg hE) + have hadd (c : ℝ) : Real.exp (-(A + c)) = Real.exp (-A) * Real.exp (-c) := by + rw [← Real.exp_add] + congr 1 + ring + rw [hadd 5] at hE' hη + rw [hadd 1] + have hc1 := mul_le_mul_of_nonneg_left h1 (Real.exp_nonneg (-A)) + have hc5 := mul_le_mul_of_nonneg_left h5 (Real.exp_nonneg (-A)) + linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SourceUnitCover.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SourceUnitCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d35f422bfc6bdf164bfa7bddb680b69477750f7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SourceUnitCover.lean @@ -0,0 +1,553 @@ +import OAI.Combinatorics.Progressions.Dynamics.SymmetricUnitBudget +import OAI.Combinatorics.Progressions.Fourier.BoundedFrequencyKernel +import OAI.Combinatorics.Progressions.Fourier.NaturalFrequencyMultiples +import OAI.Combinatorics.Progressions.Linear.SplitCoverProjection +import OAI.Combinatorics.Progressions.Polynomial.RaisedDegreeRank + +namespace OAI + +section + +namespace Erdos3.RationalTorus + +open scoped BigOperators + +variable {σ : Type*} [Fintype σ] + +def trivialMultidegreeFiltration (s : ℕ) (bound : σ → ℕ) : + MultidegreeLieFiltration σ (Algebra 0) s bound where + ordinary := trivialFiltration s + layer _ := ⊤ + antitone _ _ _ := le_rfl + zero_eq_top := rfl + lie_mem _ _ := Submodule.mem_top + terminal _ _ := by + ext x + rw [Subsingleton.elim x 0] + simp only [Submodule.zero_mem] + degree_eq _ := by + ext x + rw [Subsingleton.elim x 0] + simp only [Submodule.zero_mem] + +noncomputable def trivialMultidegreeStructure (s : ℕ) (bound : σ → ℕ) : + (trivialNilmanifold s).MultidegreeStructure bound := by + letI := (basis 0).finiteDimensional_of_finite + exact { + filtration := trivialMultidegreeFiltration s bound + ordinary := rfl + basis := fun _ => Module.finBasis ℚ _ + } + +theorem trivialMultidegreeStructure_complexity (s : ℕ) (bound : σ → ℕ) {p : ℝ} + (hp : 0 ≤ p) : (trivialMultidegreeStructure s bound).ComplexityLE p := by + refine ⟨trivialNilmanifold_geometry s hp, ?_⟩ + intro a j k + exact Fin.elim0 k + +end Erdos3.RationalTorus + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open scoped TensorProduct BigOperators NNReal + +variable {L I : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype I] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + +structure UnitVerticalObservable (D : RationalFilteredNilmanifold L s d) + (T : Subgroup D.RealGroup) (I : Type*) [Fintype I] (p : ℝ) where + observable : I → D.Space → ℂ + unit : ∀ x, ∑ i, ‖observable i x‖ ^ 2 = 1 + norm : ∀ i x, ‖observable i x‖ ≤ 1 + lipBound : ℝ≥0 + lip_bound : (lipBound : ℝ) ≤ Real.exp p + lipschitz : letI := D.metricSpace; ∀ i, LipschitzWith lipBound (observable i) + frequency : L →ₗ[ℚ] ℚ + height : ∀ i, rationalLogHeight (frequency (D.basis i)) ≤ p + vertical : ∀ i z, z ∈ T → ∀ x, observable i (z • x) = + CircleFourier.character ((realifyFunctional frequency z.coord : ℝ) : CircleFourier.Circle) * + observable i x + integral : ∀ z : D.RealGroup, z ∈ T → z ∈ D.realLattice → + ∃ n : ℤ, realifyFunctional frequency z.coord = n + +namespace UnitVerticalObservable + +variable {D : RationalFilteredNilmanifold L s d} {T : Subgroup D.RealGroup} {p q : ℝ} + +noncomputable def mono (V : D.UnitVerticalObservable T I p) (hpq : p ≤ q) : + D.UnitVerticalObservable T I q := + { V with + lip_bound := V.lip_bound.trans (Real.exp_le_exp.mpr hpq) + height := fun i => (V.height i).trans hpq } + +noncomputable def constOne (D : RationalFilteredNilmanifold L s d) (T : Subgroup D.RealGroup) + (hp : 0 ≤ p) : D.UnitVerticalObservable T (Fin 1) p where + observable _ _ := 1 + unit _ := by simp + norm _ _ := by simp + lipBound := 0 + lip_bound := (Real.exp_pos p).le + lipschitz := by + let := D.metricSpace + exact fun _ => LipschitzWith.const 1 + frequency := 0 + height _ := by simpa [rationalLogHeight] using hp + vertical _ _ _ _ := by simp only [realifyFunctional_zero, AddCircle.coe_zero, + CircleFourier.character_zero, one_mul] + integral _ _ _ := ⟨0, by simp only [realifyFunctional_zero, Int.cast_zero]⟩ + +end UnitVerticalObservable + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators NNReal + +theorem frozen_quotient_map_smul {G : Type*} [Group G] + (Γ Λ : Subgroup G) (a r : G) (f : G ⧸ Γ → G ⧸ Λ) + (hf : ∀ x : G, f (QuotientGroup.mk x) = QuotientGroup.mk (a * x * r)) + (z : G) (hz : Commute z a) (x : G ⧸ Γ) : f (z • x) = z • f x := by + induction x using Quotient.inductionOn with + | h x => + change f (QuotientGroup.mk (z * x)) = z • f (QuotientGroup.mk x) + rw [hf, hf] + change (QuotientGroup.mk (a * (z * x) * r) : G ⧸ Λ) = QuotientGroup.mk (z * (a * x * r)) + congr 1 + calc + _ = (a * z) * x * r := by group + _ = (z * a) * x * r := by rw [hz.eq] + _ = _ := by group + +namespace RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d r : ℕ} + {D : RationalFilteredNilmanifold L s d} + +namespace DegreeRankStructure + +noncomputable def withLattice (R : D.DegreeRankStructure r) + (Λ : Subgroup D.filtration.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates D.basis Λ) + (hout : bchSubgroupCoordinates D.basis Λ ⊆ denominatorGrid N) : + (D.withLattice Λ N hN hin hout).DegreeRankStructure r where + filtration := R.filtration + associated := R.associated + basis := R.basis + +theorem withLattice_complexity (R : D.DegreeRankStructure r) + (Λ : Subgroup D.filtration.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates D.basis Λ) + (hout : bchSubgroupCoordinates D.basis Λ ⊆ denominatorGrid N) + {p P : ℝ} (hR : R.ComplexityLE p) (hpP : p ≤ P) + (hQ : (D.withLattice Λ N hN hin hout).GeometryComplexityLE P) : + (R.withLattice Λ N hN hin hout).ComplexityLE P := + ⟨hQ, fun i j a k => (hR.2 i j a k).trans hpP⟩ + +theorem top_realSubgroup_commute (R : D.DegreeRankStructure r) + {z : D.RealGroup} (hz : z ∈ R.realSubgroup s r) (x : D.RealGroup) : Commute z x := by + apply commute_of_lie_eq_zero + exact D.filtration.realification.top_layer_central (R.realSubgroup_le_degree s r hz) x.coord + +end DegreeRankStructure + +variable {I : Type*} [Fintype I] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + +namespace UnitVerticalObservable + +noncomputable def frozenCover (R : D.DegreeRankStructure r) {p P : ℝ} + (V : D.UnitVerticalObservable (R.realSubgroup s r) I p) + (Λ : Subgroup D.filtration.Group) (hΛ : Λ ≤ D.lattice) + (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates D.basis Λ) + (hout : bchSubgroupCoordinates D.basis Λ ⊆ denominatorGrid N) + (a u : D.RealGroup) (f : (D.withLattice Λ N hN hin hout).Space → D.Space) + (hf : ∀ x : D.RealGroup, f (QuotientGroup.mk x) = QuotientGroup.mk (a * x * u)) + (K : ℝ≥0) + (hLip : letI := (D.withLattice Λ N hN hin hout).metricSpace; + letI := D.metricSpace; LipschitzWith K f) + (hpP : p ≤ P) (hK : (V.lipBound * K : ℝ≥0) ≤ Real.exp P) : + (D.withLattice Λ N hN hin hout).UnitVerticalObservable + ((R.withLattice Λ N hN hin hout).realSubgroup s r) I P where + observable i x := V.observable i (f x) + unit x := V.unit (f x) + norm i x := V.norm i (f x) + lipBound := V.lipBound * K + lip_bound := hK + lipschitz := by + let := (D.withLattice Λ N hN hin hout).metricSpace + let := D.metricSpace + exact fun i => (V.lipschitz i).comp hLip + frequency := V.frequency + height i := (V.height i).trans hpP + vertical i z hz x := by + rw [frozen_quotient_map_smul _ _ a u f hf z (R.top_realSubgroup_commute hz a)] + exact V.vertical i z hz (f x) + integral z hz hlat := by + have hsub : (D.withLattice Λ N hN hin hout).realLattice ≤ D.realLattice := Subgroup.map_mono hΛ + exact V.integral z hz (hsub hlat) + +end UnitVerticalObservable +end RationalFilteredNilmanifold +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped BigOperators NNReal TensorProduct + +noncomputable def invariantVerticalBudget (m : ℕ) (p : ℝ) : ℝ := + symmetricUnitBudget m (2 * p) + p + m + 1 + +namespace RationalFilteredNilmanifold.UnitVerticalObservable + +variable {Γ I L : Type*} [Group Γ] [Fintype Γ] [Fintype I] + [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} {T : Subgroup D.RealGroup} {p : ℝ} + [MulAction Γ D.Space] + +theorem exists_invariant (V : D.UnitVerticalObservable T I p) (hp : 0 ≤ p) + (hI : (Fintype.card I : ℝ) ≤ Real.exp p) (A : ℝ≥0) (hA : (A : ℝ) ≤ Real.exp p) + (hact : letI := D.metricSpace; ∀ a : Γ, LipschitzWith A (fun x : D.Space => a • x)) + (hcomm : ∀ (a : Γ) (z : D.RealGroup), z ∈ T → ∀ x : D.Space, + a • (z • x) = z • (a • x)) : + ∃ W : D.UnitVerticalObservable T (SymmetricEvaluationIndex (Fintype.card Γ) I) + (invariantVerticalBudget (Fintype.card Γ) p), + W.frequency = Fintype.card Γ • V.frequency ∧ + (∀ (a : Γ) k x, W.observable k (a • x) = W.observable k x) ∧ + (Fintype.card (SymmetricEvaluationIndex (Fintype.card Γ) I) : ℝ) ≤ + Real.exp (invariantVerticalBudget (Fintype.card Γ) p) := by + let := D.metricSpace + let m := Fintype.card Γ + have hp2 : 0 ≤ 2 * p := by positivity + have hbudget : 0 ≤ symmetricUnitBudget m (2 * p) := by + unfold symmetricUnitBudget + positivity + have hbase : symmetricUnitBudget m (2 * p) ≤ invariantVerticalBudget m p := by + unfold invariantVerticalBudget + have hm : 0 ≤ (m : ℝ) := Nat.cast_nonneg m + linarith + have hfreq : p + m + 1 ≤ invariantVerticalBudget m p := by + unfold invariantVerticalBudget + linarith + have hIA : (Fintype.card I : ℝ) ≤ Real.exp (2 * p) := + hI.trans (Real.exp_le_exp.mpr (by linarith)) + have hKA : ((V.lipBound * A : ℝ≥0) : ℝ) ≤ Real.exp (2 * p) := by + simpa only [NNReal.coe_mul, ← Real.exp_add, two_mul] using + mul_le_mul V.lip_bound hA A.coe_nonneg (Real.exp_pos _).le + obtain ⟨hcard, hLip⟩ := symmetricUnitBudget_bounds m (Fintype.card I) (V.lipBound * A) hp2 hIA hKA + obtain ⟨g, hgunit, hgnorm, hglip, hginv, hgphase⟩ := + exists_invariant_unit_family (Γ := Γ) V.observable V.lipschitz V.unit hact + refine ⟨{ + observable := g + unit := hgunit + norm := hgnorm + lipBound := symmetricUnitFamilyLip m (Fintype.card I) (V.lipBound * A) + lip_bound := hLip.trans (Real.exp_le_exp.mpr hbase) + lipschitz := hglip + frequency := m • V.frequency + height := ?_ + vertical := ?_ + integral := ?_ + }, rfl, hginv, ?_⟩ + · intro i + exact (show rationalLogHeight ((m • V.frequency) (D.basis i)) ≤ p + m + 1 by + simpa only [LinearMap.smul_apply, nsmul_eq_mul] using + rationalLogHeight_nat_mul m (V.height i)).trans hfreq + · intro k z hz x + have h := hgphase (z • x) x + (character ((realifyFunctional V.frequency z.coord : ℝ) : CircleFourier.Circle)) + (norm_character _) (fun a j => by rw [hcomm a z hz, V.vertical j z hz]) k + simpa only [realifyFunctional_nsmul, AddCircle.coe_nsmul, character_nsmul] using h + · intro z hz hL + obtain ⟨n, hn⟩ := V.integral z hz hL + refine ⟨(m : ℤ) * n, ?_⟩ + rw [realifyFunctional_nsmul, hn] + simp only [nsmul_eq_mul, Int.cast_mul, Int.cast_natCast] + · rw [symmetricEvaluationIndex_card] + exact hcard.trans (Real.exp_le_exp.mpr hbase) + +end RationalFilteredNilmanifold.UnitVerticalObservable + +theorem exists_invariantVertical_cost (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → invariantVerticalBudget m p ≤ (p + C) ^ C := by + let X : Polynomial ℕ := Polynomial.X + let P := Polynomial.C (2 * m + 2) * (2 * X + 1) + Polynomial.C (symmetricUnitConstant m) + + X + Polynomial.C m + 1 + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro p hp + simpa [X, P, invariantVerticalBudget, symmetricUnitBudget] using hbound p hp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +structure NativeMultidegreeNilcharacter {σ : Type*} [Fintype σ] (bound : σ → ℕ) (p : ℝ) where + L : Type + [lie : LieRing L] + [algebra : LieAlgebra ℚ L] + dim : ℕ + [topology : TopologicalSpace (ℝ ⊗[ℚ] L)] + [topologicalAdd : IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [continuousSMul : ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] + [hausdorff : T2Space (ℝ ⊗[ℚ] L)] + model : RationalFilteredNilmanifold L (∑ i, bound i) dim + multi : model.MultidegreeStructure bound + complexity : multi.ComplexityLE p + orbit : multi.filtration.realification.PolynomialOrbit + outputDim : ℕ + output_pos : 0 < outputDim + output_bound : (outputDim : ℝ) ≤ Real.exp p + vertical : model.UnitVerticalObservable (multi.realSubgroup bound) (Fin outputDim) p + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +namespace NativeMultidegreeNilcharacter + +variable {σ : Type*} [Fintype σ] {bound : σ → ℕ} {p q : ℝ} + (W : NativeMultidegreeNilcharacter bound p) + +noncomputable def eval (i : Fin W.outputDim) (x : σ → ℤ) : ℂ := + W.vertical.observable i (QuotientGroup.mk + (W.multi.filtration.realification.polynomialOrbitEval x W.orbit)) + +noncomputable def evalCyclic (N : ℕ) [NeZero N] (i : Fin W.outputDim) (x : σ → ZMod N) : ℂ := + W.eval i (fun j => ((x j).val : ℤ)) + +theorem unit_eval (x : σ → ℤ) : ∑ i, ‖W.eval i x‖ ^ 2 = 1 := W.vertical.unit _ + +theorem norm_eval (i : Fin W.outputDim) (x : σ → ℤ) : ‖W.eval i x‖ ≤ 1 := W.vertical.norm i _ + +noncomputable def mono (hpq : p ≤ q) : NativeMultidegreeNilcharacter bound q := + { W with + complexity := W.complexity.mono W.multi hpq + output_bound := W.output_bound.trans (Real.exp_le_exp.mpr hpq) + vertical := W.vertical.mono hpq } + +theorem mono_eval (hpq : p ≤ q) (i : Fin W.outputDim) (x : σ → ℤ) : + (W.mono hpq).eval i x = W.eval i x := rfl + +noncomputable def constOne (bound : σ → ℕ) (hp : 0 ≤ p) : + NativeMultidegreeNilcharacter bound p where + L := RationalTorus.Algebra 0 + dim := 0 + model := RationalTorus.trivialNilmanifold (∑ i, bound i) + multi := RationalTorus.trivialMultidegreeStructure (∑ i, bound i) bound + complexity := RationalTorus.trivialMultidegreeStructure_complexity _ _ hp + orbit := 1 + outputDim := 1 + output_pos := by omega + output_bound := by simpa only [Nat.cast_one] using Real.one_le_exp hp + vertical := RationalFilteredNilmanifold.UnitVerticalObservable.constOne _ _ hp + +@[simp] theorem constOne_eval (bound : σ → ℕ) (hp : 0 ≤ p) (i : Fin 1) (x : σ → ℤ) : + (constOne bound hp).eval i x = 1 := rfl + +@[simp] theorem constOne_evalCyclic (bound : σ → ℕ) (hp : 0 ≤ p) (N : ℕ) [NeZero N] + (i : Fin 1) (x : σ → ZMod N) : (constOne bound hp).evalCyclic N i x = 1 := rfl + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +variable {L M I : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [Fintype I] {s t d e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + {D : RationalFilteredNilmanifold L s d} {E : RationalFilteredNilmanifold M t e} + {T : Subgroup E.RealGroup} {p q : ℝ} (V : E.UnitVerticalObservable T I p) + (φ : L →ₗ⁅ℚ⁆ M) + (hφ : D.lattice ≤ E.lattice.comap (mapOfSteps + (hL := D.filtration.lowerCentralSeries_eq_bot) (hM := E.filtration.lowerCentralSeries_eq_bot) φ)) + (S : Subgroup D.RealGroup) + (hS : S ≤ T.comap (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ)) + (K : ℝ≥0) + (hLip : letI := D.metricSpace; letI := E.metricSpace; + LipschitzWith K (D.nativeSpaceMap E φ hφ)) + (hK : ((V.lipBound * K : ℝ≥0) : ℝ) ≤ Real.exp q) + (hfreq : ∀ i, rationalLogHeight (V.frequency (φ (D.basis i))) ≤ q) + +noncomputable def pullback : D.UnitVerticalObservable S I q where + observable i x := V.observable i (D.nativeSpaceMap E φ hφ x) + unit x := V.unit (D.nativeSpaceMap E φ hφ x) + norm i x := V.norm i (D.nativeSpaceMap E φ hφ x) + lipBound := V.lipBound * K + lip_bound := hK + lipschitz := by + let := D.metricSpace + let := E.metricSpace + exact fun i => (V.lipschitz i).comp hLip + frequency := V.frequency.comp φ.toLinearMap + height := hfreq + vertical i z hz x := by + rw [D.nativeSpaceMap_smul E φ hφ z x, realifyFunctional_comp] + exact V.vertical i + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ z) (hS hz) _ + integral z hz hlat := by + obtain ⟨n, hn⟩ := V.integral + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ z) + (hS hz) ((realificationMap_subgroup φ D.lattice E.lattice hφ) hlat) + refine ⟨n, ?_⟩ + rw [realifyFunctional_comp] + exact hn + +theorem pullback_frequency : + (V.pullback φ hφ S hS K hLip hK hfreq).frequency = V.frequency.comp φ.toLinearMap := rfl + +theorem pullback_observable_mk (i : I) (x : D.RealGroup) : + (V.pullback φ hφ S hS K hLip hK hfreq).observable i (QuotientGroup.mk x) = + V.observable i (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ x)) := rfl + +end Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +open scoped TensorProduct + +variable {L I : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype I] {s r d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} (R : D.DegreeRankStructure r) {p : ℝ} + (V : D.UnitVerticalObservable (R.realSubgroup s r) I p) + (Λ : Subgroup D.filtration.Group) (hΛ : Λ ≤ D.lattice) + (m : ℕ) (hm : 0 < m) + (hin : scaledIntegerGrid m ⊆ bchSubgroupCoordinates D.basis Λ) + (hout : bchSubgroupCoordinates D.basis Λ ⊆ denominatorGrid m) + +noncomputable def onSublattice : + (D.withLattice Λ m hm hin hout).UnitVerticalObservable + ((R.withLattice Λ m hm hin hout).realSubgroup s r) I p where + observable i := V.observable i ∘ sublatticeProjection D (D.withLattice Λ m hm hin hout) hΛ + unit x := V.unit _ + norm i x := V.norm i _ + lipBound := V.lipBound + lip_bound := V.lip_bound + lipschitz := fun i => sublattice_pullback_lipschitz D (D.withLattice Λ m hm hin hout) + hΛ rfl (V.observable i) (V.lipschitz i) + frequency := V.frequency + height := V.height + vertical i z hz x := by + induction x using Quotient.inductionOn with + | h x => exact V.vertical i z hz (QuotientGroup.mk x) + integral z hz hlat := V.integral z hz (Subgroup.map_mono hΛ hlat) + +theorem onSublattice_frequency : + (V.onSublattice R Λ hΛ m hm hin hout).frequency = V.frequency := rfl + +theorem onSublattice_lipBound : + (V.onSublattice R Λ hΛ m hm hin hout).lipBound = V.lipBound := rfl + +theorem onSublattice_observable_mk (i : I) (x : D.RealGroup) : + (V.onSublattice R Λ hΛ m hm hin hout).observable i (QuotientGroup.mk x) = + V.observable i (QuotientGroup.mk x) := rfl + +theorem onSublattice_orbit_eval {σ : Type*} (w : σ → ℕ) + (g : D.filtration.realification.PolynomialOrbit w) (i : I) (x : σ → ℤ) : + (V.onSublattice R Λ hΛ m hm hin hout).observable i (QuotientGroup.mk + ((D.withLattice Λ m hm hin hout).filtration.realification.polynomialOrbitEval w x g)) = + V.observable i (QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval w x g)) := rfl + +end Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_native_source_unit_cover : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L M I : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] [Fintype I] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] {s t d e r : ℕ} + (D : RationalFilteredNilmanifold L s d) (R : D.DegreeRankStructure r) + (E : RationalFilteredNilmanifold M t e) (φ : L →ₗ⁅ℚ⁆ M) {p : ℝ}, + 0 ≤ p → R.ComplexityLE p → E.GeometryComplexityLE p → + (∀ i j, rationalLogHeight (E.basis.repr (φ (D.basis j)) i) ≤ p) → + ∃ Λ : Subgroup D.filtration.Group, + Λ ≤ D.lattice ∧ (Λ.subgroupOf D.lattice).Characteristic ∧ + (Λ.subgroupOf D.lattice).Normal ∧ (Λ.subgroupOf D.lattice).FiniteIndex ∧ + (Λ.relIndex D.lattice : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates D.basis Λ) + (hout : bchSubgroupCoordinates D.basis Λ ⊆ denominatorGrid N), + (R.withLattice Λ N hN hin hout).ComplexityLE ((p + C) ^ C) ∧ + Λ ≤ E.lattice.comap (mapOfSteps (hL := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ) ∧ + ∀ V : D.UnitVerticalObservable (R.realSubgroup s r) I p, + ∃ U : (D.withLattice Λ N hN hin hout).UnitVerticalObservable + ((R.withLattice Λ N hN hin hout).realSubgroup s r) I ((p + C) ^ C), + U.frequency = V.frequency ∧ U.lipBound = V.lipBound ∧ + ∀ i x, U.observable i (QuotientGroup.mk x) = V.observable i (QuotientGroup.mk x) := by + obtain ⟨C, hC, hcover⟩ := exists_native_source_cover + refine ⟨C, hC, ?_⟩ + intro L M I _ _ _ _ _ _ _ _ _ s t d e r D R E φ p hp hR hE hentries + have hC1 : (1 : ℝ) ≤ C := by exact_mod_cast (show 1 ≤ C by omega) + have hpC : p ≤ (p + C) ^ C := by + calc + p ≤ p + C := le_add_of_nonneg_right (Nat.cast_nonneg _) + _ = (p + C) ^ 1 := (pow_one _).symm + _ ≤ _ := pow_le_pow_right₀ (by linarith) (by omega : 1 ≤ C) + obtain ⟨Λ, hΛ, hchar, hnormal, hfinite, hindex, N, hN, hin, hout, hgeometry, hmap⟩ := + hcover D E φ hp hR.1 hE hentries + refine ⟨Λ, hΛ, hchar, hnormal, hfinite, hindex, N, hN, hin, hout, + R.withLattice_complexity Λ N hN hin hout hR hpC hgeometry, hmap, ?_⟩ + intro V + exact ⟨(V.onSublattice R Λ hΛ N hN hin hout).mono hpC, rfl, rfl, fun _ _ => rfl⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SpecifiedSquareObservable.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SpecifiedSquareObservable.lean new file mode 100644 index 0000000000000000000000000000000000000000..19230f8021b6b1553e2b7035af4d0f86d5d44aef --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SpecifiedSquareObservable.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Dynamics.ComparisonEquivalenceBudget +import OAI.Combinatorics.Progressions.Geometry.RealifiedSquareMetric +import OAI.Combinatorics.Progressions.Linear.NativeRankQuotientOrbit + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +theorem exists_specified_square_observable_lipschitz (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {d m : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L (s + 1) d) + [TopologicalSpace (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + [T2Space (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra)] + (b : Basis (Fin m) ℚ L) (v : Fin m → ℕ) + (h2 : D.filtration.layer 2 = Submodule.span ℚ (b '' {i | 2 ≤ v i})) + (N : ℕ) (hN : 0 < N) + (hout : bchSubgroupCoordinates (D.filtration.squareFinBasis b v h2) + (D.filtration.squareLattice D.lattice) ⊆ denominatorGrid N) + {ω : σ → ℕ} (T : D.Niltest ω) {p : ℝ}, + 0 ≤ p → T.ComplexityLE p → + (Fintype.card (Fin m ⊕ {i // 2 ≤ v i}) : ℝ) ≤ p → + (∀ i j, rationalLogHeight (D.basis.repr (b i) j) ≤ p) → + ∀ η : D.RealGroup, + (∀ i, |(D.basis.baseChange ℝ).repr η.coord i| ≤ Real.exp p) → + ∃ ℓ : ℝ≥0, (ℓ : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + letI := realificationQuotientMetricSpace (D.filtration.squareFinBasis b v h2) + (D.filtration.squareLattice D.lattice) N hN hout + LipschitzWith ℓ (D.filtration.realSquareObservable D.lattice η T.observable) := by + obtain ⟨B, _, hleft⟩ := exists_bounded_normalization_left_lipschitz (s + 1) 1 + let X : Polynomial ℕ := Polynomial.X + let P := 2 * X + (X + 3) ^ 2 + (X + 3 + Polynomial.C B) ^ B + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ L _ _ d m _ _ _ _ D _ _ _ _ b v h2 N hN hout ω T p hp hT hdim hb η hη + obtain ⟨A, _, hA, hALip⟩ := hleft D p hp hT.1 + have hηLip := hALip η (fun i => (hη i).trans (Real.exp_le_exp.mpr (by norm_num; linarith))) + let H := ⌈Real.exp p⌉₊ + let n := Fintype.card (Fin m ⊕ {i // 2 ≤ v i}) + let J := coordinateLipschitzBound (Fintype.card (Fin d)) (Fintype.card (Fin n)) H + have hJ : (J : ℝ) ≤ Real.exp ((p + 3) ^ 2) := by + change (coordinateLipschitzBound (Fintype.card (Fin d)) (Fintype.card (Fin n)) H : ℝ) ≤ _ + have h := coordinateLipschitzBound_le_exp (Fintype.card (Fin d)) (Fintype.card (Fin n)) H + (show 0 ≤ p + 1 by linarith) + (by simpa only [Fintype.card_fin] using hT.1.1.trans (by linarith : p ≤ p + 1)) + (by simpa only [Fintype.card_fin] using hdim.trans (by linarith : p ≤ p + 1)) + (ceil_exp_le_exp_add_one hp) + simpa only [show p + 1 + 2 = p + 3 by ring] using h + have hproj := D.filtration.squareFinBasis_projection_height D.basis b v h2 + (one_le_ceil_exp p) (fun i j => rationalHeightLE_ceil_exp (hb j i)) + let ℓ := T.normBound * (T.lipBound * J) + T.normBound * (T.lipBound * (A * J)) + have hnorm : (T.normBound : ℝ) ≤ Real.exp p := by + have h := T.observable_budget hT + linarith [T.lipBound.coe_nonneg] + have hlip : (T.lipBound : ℝ) ≤ Real.exp p := by + have h := T.observable_budget hT + linarith [T.normBound.coe_nonneg] + have hℓ := squareObservableLipschitz_le_exp A T.normBound T.lipBound J + (normalizedSquareLeftBudget_nonneg 1 B hp) hA hnorm hlip hJ + have hcost : 2 * p + (p + 3) ^ 2 + normalizedSquareLeftBudget 1 B p + 1 ≤ (p + C) ^ C := by + have hleft : normalizedSquareLeftBudget 1 B p = (p + 3 + B) ^ B := by + unfold normalizedSquareLeftBudget + congr 1 + ring + rw [hleft] + simpa [P, X, Polynomial.eval₂_pow] using hbudget p hp + refine ⟨ℓ, hℓ.trans (Real.exp_le_exp.mpr hcost), ?_⟩ + exact D.filtration.realSquareObservable_lipschitz D.basis + (D.filtration.squareFinBasis b v h2) D.lattice D.grid N H D.grid_pos hN D.outer_grid hout + (fun k i => (hproj i k).1) (fun k i => (hproj i k).2) + η T.observable A T.lipBound T.normBound hηLip T.lipschitz T.norm_le + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SpectralCylinderDecomposition.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SpectralCylinderDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa67807ee62ace8c4f0a028d021bad35de80f404 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SpectralCylinderDecomposition.lean @@ -0,0 +1,47 @@ +import OAI.Combinatorics.Progressions.Polynomial.FiniteMarginalLowDegree + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_spectral_cylinder_decomposition {Ω ι : Type*} [Fintype Ω] [Fintype ι] [LinearOrder ι] + {X : ι → Type*} [∀ i, Fintype (X i)] [∀ i, DecidableEq (X i)] + (μ : ∀ i, FiniteProbabilityWeights (X i)) (hμ : ∀ i x, 0 < (μ i).weight x) + (base : ∀ i, X i) (p : FiniteProbabilityWeights Ω) (F : Ω → ∀ i, X i) + (K τ η P : ℝ) (j r q A : ℕ) (hK : 1 ≤ K) (hτ : 0 < τ) (hη0 : 0 ≤ η) (hη1 : η ≤ 1) + (hq : 2 ≤ q) (heven : Even q) (hrP : (r : ℝ) ≤ P) (hlog : Real.log (2 + τ⁻¹) ≤ P) + (hPq : P ≤ (q : ℝ)) (hqP : (q : ℝ) ≤ P + 2) + (hsmall : η ≤ (1 / 2) * (((2 : ℝ) ^ (r + 1) * (2 + (Fintype.card ι : ℝ)) ^ r * (2 + τ⁻¹)) ^ q)⁻¹) + (hA : 1 ≤ A) (hX : ∀ i, Fintype.card (X i) ≤ A) (hcut : 2 ≤ τ * K ^ (j + 1)) + (hbase : ProductMarginalsClose μ (observedProductDensity μ p F (fun _ => 1)) η (j + r * (q + 1))) + (w : Ω → ℝ) (hw0 : ∀ z, 0 ≤ w z) (hw1 : ∀ z, w z ≤ 1) : + ∃ (v : Ω → ℝ) (cs : List (ProductCylinder X)), + CylinderRemovalChain μ base p F K τ j r w v cs ∧ cs.Nodup ∧ + cs.length ≤ (∑ k ∈ Finset.range (j + r + 1), (Fintype.card ι).choose k) * A ^ (j + r) ∧ + (removedCylinderWeights F w cs).Pairwise (fun f g => ∀ z, f z = 0 ∨ g z = 0) ∧ + (∀ z, w z = ((removedCylinderWeights F w cs).map (fun f => f z)).sum + v z) ∧ + (∀ f ∈ removedCylinderWeights F w cs, ∀ z, 0 ≤ f z ∧ f z ≤ 1) ∧ + p.mean v ≤ τ ∧ (∀ z, 0 ≤ v z ∧ v z ≤ 1) ∧ + (∀ cf ∈ cs.zip (removedCylinderWeights F w cs), ∀ k : ℕ, k ≤ r → + Real.sqrt (productANOVAEnergy μ (Finset.univ.powersetCard k) + (ProductCylinder.normalizedSection μ base (observedProductDensity μ p F cf.2) cf.1)) ≤ + (8 * (1 + K) * (P + 2)) ^ (2 * k)) := by + have horder : j + r ≤ j + r * (q + 1) := by + rw [Nat.mul_add, Nat.mul_one] + omega + obtain ⟨v, cs, hchain, hno, hcount, hdis, hdec, hweights, hres, hv⟩ := + exists_regular_cylinder_decomposition μ hμ base p F K τ η j r A hK hτ.le hη1 hA hX hcut + (ProductMarginalsClose.mono μ hbase horder) w hw0 hw1 + exact ⟨v, cs, hchain, hno, hcount, hdis, hdec, hweights, hres, hv, + hchain.low_degree_bounds hμ hK hτ hη0 hq heven hrP hlog hPq hqP hsmall hbase + (fun z => ⟨hw0 z, hw1 z⟩)⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SplitGroupRelative.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SplitGroupRelative.lean new file mode 100644 index 0000000000000000000000000000000000000000..6051f76d0dc662cc842d0f9b1c23c2a6e539936a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SplitGroupRelative.lean @@ -0,0 +1,46 @@ +import Mathlib.Algebra.Group.Subgroup.Ker +import Mathlib.Tactic.Group + +namespace OAI + +section + +namespace Erdos3 + +variable {G H : Type*} [Group G] [Group H] (q : G →* H) (d : H →* G) + +def splitRelativePart (g : G) : G := g * (d (q g))⁻¹ + +theorem splitRelativePart_factorization (g : G) : splitRelativePart q d g * d (q g) = g := by + simp [splitRelativePart] + +theorem splitRelativePart_projection (hd : ∀ h, q (d h) = h) (g : G) : + q (splitRelativePart q d g) = 1 := by + simp only [splitRelativePart, map_mul, map_inv, hd, mul_inv_cancel] + +theorem splitRelativePart_mul (g h : G) : + splitRelativePart q d (g * h) = + splitRelativePart q d g * (d (q g) * splitRelativePart q d h * (d (q g))⁻¹) := by + simp only [splitRelativePart, map_mul] + group + +theorem splitRelativePart_same_projection {g h : G} (hproj : q g = q h) : + splitRelativePart q d g * (splitRelativePart q d h)⁻¹ = g * h⁻¹ := by + simp only [splitRelativePart, hproj] + group + +theorem splitRelativePart_pair_mem (hd : ∀ h, q (d h) = h) (U : Subgroup G) + {g h : G} (hg : g ∈ U) (hh : h ∈ U) (hproj : q g = q h) : + splitRelativePart q d g * (splitRelativePart q d h)⁻¹ ∈ U ⊓ q.ker := by + constructor + · rw [splitRelativePart_same_projection q d hproj] + exact U.mul_mem hg (U.inv_mem hh) + · change q (splitRelativePart q d g * (splitRelativePart q d h)⁻¹) = 1 + rw [map_mul, map_inv, splitRelativePart_projection q d hd, + splitRelativePart_projection q d hd, inv_one, mul_one] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SplitPivotParameter.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SplitPivotParameter.lean new file mode 100644 index 0000000000000000000000000000000000000000..c891531872bf5c44a3f8767a1922a572ee6d277e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SplitPivotParameter.lean @@ -0,0 +1,64 @@ +import OAI.Combinatorics.Progressions.Linear.PivotKernelAllowances +import OAI.Combinatorics.Progressions.Probability.PivotDensitySupport + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +theorem splitPivotDensity_norm_le_cap {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] + (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) (B : (J → ℝ) →L[ℝ] (I → ℝ)) + (C : (N → ℝ) →L[ℝ] (I → ℝ)) {f : (J → ℝ) × (I → ℝ) → ℝ} {g : (N → ℝ) → ℝ} + (R H S : ℝ≥0) (hf : Continuous f) (hg : Continuous g) + (hfs : ∀ p, (R : ℝ) < ‖p‖ → f p = 0) (hgs : ∀ n, (S : ℝ) < ‖n‖ → g n = 0) + (hfb : ∀ p, ‖f p‖ ≤ H) (hg0 : ∀ n, 0 ≤ g n) (hgmass : (∫ n, g n) = 1) + (v : I → ℝ) : + ‖pivotOutputDensity A (splitFreeColumns B C) (splitFreeProfile f g) v‖ ≤ pivotKernelCap J A R H := by + rw [Real.norm_eq_abs, splitPivotDensity_formula A B C hf hg hfs hgs v] + exact fixedKernelMixture_abs_le volume g _ (compactBox_integrable g hg S hgs) hg0 hgmass + (fun n _ => pivotOutputDensity_norm_le_cap A B f R H hfs hfb (v-C n)) + +theorem splitPivotDensity_parameter_lipschitzOn {X I J N : Type*} [PseudoMetricSpace X] + [Fintype I] [Fintype J] [Fintype N] + (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) (B : (J → ℝ) →L[ℝ] (I → ℝ)) + (C : X → (N → ℝ) →L[ℝ] (I → ℝ)) (T : Set X) (L R K S : ℝ≥0) + (hC : LipschitzOnWith L C T) {f : (J → ℝ) × (I → ℝ) → ℝ} {g : (N → ℝ) → ℝ} + (hf : LipschitzWith K f) (hg : Continuous g) + (hfs : ∀ p, (R : ℝ) < ‖p‖ → f p = 0) (hgs : ∀ n, (S : ℝ) < ‖n‖ → g n = 0) + (hg0 : ∀ n, 0 ≤ g n) (hgmass : (∫ n, g n) = 1) (v : I → ℝ) : + LipschitzOnWith (pivotKernelLip J A R K * L * S) + (fun x => pivotOutputDensity A (splitFreeColumns B (C x)) (splitFreeProfile f g) v) T := by + have hρ := pivotOutputDensity_lipschitz A B R K hf hfs + have he : (fun x => pivotOutputDensity A (splitFreeColumns B (C x)) (splitFreeProfile f g) v) = + (fun x => ∫ n, g n * pivotOutputDensity A B f (v-C x n)) := + funext (fun x => splitPivotDensity_formula A B (C x) hf.continuous hg hfs hgs v) + rw [he] + apply fixedKernelMixture_lipschitzOn volume g _ T _ (compactBox_integrable g hg S hgs) hg0 hgmass + · intro x _ + exact compactBox_integrable _ (hg.mul (hρ.continuous.comp (by fun_prop))) S + (fun n hn => by rw [hgs n hn, zero_mul]) + · intro n hn + have hnS : ‖n‖ ≤ S := le_of_not_gt (fun h => hn (hgs n h)) + apply LipschitzOnWith.of_dist_le_mul + intro x hx y hy + have hdiff : dist (C x n) (C y n) ≤ (L : ℝ)*dist x y*S := by + rw [dist_eq_norm] + have hop : ‖C x n-C y n‖ ≤ ‖C x-C y‖*‖n‖ := (C x-C y).le_opNorm n + have hxy : ‖C x-C y‖ ≤ (L : ℝ)*dist x y := by + simpa only [dist_eq_norm] using hC.dist_le_mul x hx y hy + exact hop.trans (mul_le_mul hxy hnS (norm_nonneg _) (by positivity)) + apply (hρ.dist_le_mul (v-C x n) (v-C y n)).trans + rw [dist_sub_left] + apply (mul_le_mul_of_nonneg_left hdiff (pivotKernelLip J A R K).coe_nonneg).trans_eq + simp only [NNReal.coe_mul] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SplitSmoothProductProfile.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SplitSmoothProductProfile.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cb6f177b1e0b52c0e0c266f804aa2c4fa686f0f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SplitSmoothProductProfile.lean @@ -0,0 +1,492 @@ +import Mathlib.MeasureTheory.Constructions.Pi +import Mathlib.MeasureTheory.Integral.Pi +import OAI.Combinatorics.Progressions.Dynamics.ProductCutoffBudget +import OAI.Combinatorics.Progressions.Geometry.BoxChartCutoff +import OAI.Combinatorics.Progressions.Geometry.SigmaAxisCoordinates +import OAI.Combinatorics.Progressions.Lattices.IntegerFiberUniformBound +import OAI.Combinatorics.Progressions.Probability.SmoothProbabilityProfile + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal BigOperators + +variable {I J : Type*} [Fintype I] [Fintype J] + +noncomputable def splitInputProfile (f : (J → ℝ) × (I → ℝ) → ℝ) (x : J ⊕ I → ℝ) : ℝ := + f ((fun j => x (.inl j)), (fun i => x (.inr i))) + +theorem splitCoordinates_norm (x : J ⊕ I → ℝ) : + ‖((fun j => x (.inl j)), (fun i => x (.inr i)))‖ = ‖x‖ := by + apply le_antisymm + · change max ‖fun j => x (.inl j)‖ ‖fun i => x (.inr i)‖ ≤ ‖x‖ + apply max_le + · exact (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr fun j => norm_le_pi_norm x (.inl j) + · exact (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr fun i => norm_le_pi_norm x (.inr i) + · apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr + intro k + cases k with + | inl j => + exact (norm_le_pi_norm (fun j => x (.inl j)) j).trans + (norm_fst_le ((fun j => x (.inl j)), (fun i => x (.inr i)))) + | inr i => + exact (norm_le_pi_norm (fun i => x (.inr i)) i).trans + (norm_snd_le ((fun j => x (.inl j)), (fun i => x (.inr i)))) + +theorem splitInputProfile_lipschitz {f : (J → ℝ) × (I → ℝ) → ℝ} {K : ℝ≥0} + (hf : LipschitzWith K f) : LipschitzWith K (splitInputProfile f) := by + have hs : LipschitzWith 1 (fun x : J ⊕ I → ℝ => + ((fun j => x (.inl j)), (fun i => x (.inr i)))) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [NNReal.coe_one, one_mul, dist_eq_norm, dist_eq_norm] + exact (splitCoordinates_norm (x - y)).le + unfold splitInputProfile + simpa only [mul_one, Function.comp_def] using hf.comp hs + +theorem splitInputProfile_zero_outside {f : (J → ℝ) × (I → ℝ) → ℝ} {R : ℝ} + (hf : ∀ p, R < ‖p‖ → f p = 0) (x : J ⊕ I → ℝ) (hx : R < ‖x‖) : + splitInputProfile f x = 0 := + hf _ (by rwa [splitCoordinates_norm]) + +theorem splitInputProfile_integral (f : (J → ℝ) × (I → ℝ) → ℝ) : + (∫ x, splitInputProfile f x) = ∫ p, f p := + (volume_measurePreserving_sumPiEquivProdPi (fun _ : J ⊕ I => ℝ)).integral_comp + (MeasurableEquiv.sumPiEquivProdPi (fun _ : J ⊕ I => ℝ)).measurableEmbedding f + +omit [Fintype I] [Fintype J] in +theorem splitInputProfile_sample_sum (f : (J → ℝ) × (I → ℝ) → ℝ) (S : I → ℝ) (T : J → ℝ) : + (∑' z : J ⊕ I → ℤ, splitInputProfile f (fun k => (z k : ℝ) / Sum.elim T S k)) = + ∑' p : (I → ℤ) × (J → ℤ), scaledIntegerWeight f S T p := by + let e : (J ⊕ I → ℤ) ≃ (I → ℤ) × (J → ℤ) := + (Equiv.sumPiEquivProdPi (fun _ : J ⊕ I => ℤ)).trans (Equiv.prodComm _ _) + exact e.tsum_eq (scaledIntegerWeight f S T) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +def tensorCutoffWeight {ι : Type*} {E : ι → Type*} [Fintype ι] (w : ∀ i, E i → ℝ) (x : ∀ i, E i) : ℝ := + ∏ i, w i (x i) + +theorem tensorCutoffWeight_nonneg {ι : Type*} {E : ι → Type*} [Fintype ι] + (w : ∀ i, E i → ℝ) (hw : ∀ i x, 0 ≤ w i x) (x : ∀ i, E i) : + 0 ≤ tensorCutoffWeight w x := Finset.prod_nonneg (fun i _ => hw i (x i)) + +theorem tensorCutoffWeight_tsupport {ι : Type*} {E : ι → Type*} [Fintype ι] [∀ i, TopologicalSpace (E i)] + (w : ∀ i, E i → ℝ) : + tsupport (tensorCutoffWeight w) ⊆ {x | ∀ i, x i ∈ tsupport (w i)} := by + have hc : IsClosed {x : ∀ i, E i | ∀ i, x i ∈ tsupport (w i)} := by + have he : {x : ∀ i, E i | ∀ i, x i ∈ tsupport (w i)} = + ⋂ i, (fun x : ∀ i, E i => x i) ⁻¹' tsupport (w i) := by ext; simp + rw [he] + exact isClosed_iInter (fun i => (isClosed_tsupport _).preimage (continuous_apply i)) + apply closure_minimal _ hc + intro x hx i + apply subset_closure + change w i (x i) ≠ 0 + intro hz + exact hx (Finset.prod_eq_zero (Finset.mem_univ i) hz) + +theorem tensorCutoffWeight_compact {ι : Type*} {E : ι → Type*} [Fintype ι] [∀ i, TopologicalSpace (E i)] + (w : ∀ i, E i → ℝ) (hw : ∀ i, HasCompactSupport (w i)) : + HasCompactSupport (tensorCutoffWeight w) := + (isCompact_pi_infinite hw).of_isClosed_subset (isClosed_tsupport _) + (tensorCutoffWeight_tsupport w) + +theorem tensorCutoffWeight_contDiff {ι : Type*} {E : ι → Type*} [Fintype ι] + [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)] + (w : ∀ i, E i → ℝ) (hw : ∀ i, ContDiff ℝ 1 (w i)) : + ContDiff ℝ 1 (tensorCutoffWeight w) := + contDiff_prod (fun i _ => (hw i).comp + (ContinuousLinearMap.proj i : (∀ j, E j) →L[ℝ] E i).contDiff) + +theorem tensorCutoffWeight_integral {ι : Type*} {E : ι → Type*} [Fintype ι] [∀ i, MeasureSpace (E i)] + [∀ i, SigmaFinite (volume : Measure (E i))] (w : ∀ i, E i → ℝ) : + (∫ x, tensorCutoffWeight w x) = ∏ i, ∫ y, w i y := + integral_fintype_prod_volume_eq_prod w + +theorem tensorCutoffWeight_abs_mass {ι : Type*} {E : ι → Type*} [Fintype ι] [∀ i, MeasureSpace (E i)] + [∀ i, SigmaFinite (volume : Measure (E i))] (w : ∀ i, E i → ℝ) : + (∫ x, |tensorCutoffWeight w x|) = ∏ i, ∫ y, |w i y| := by + simp only [tensorCutoffWeight, Finset.abs_prod] + exact integral_fintype_prod_volume_eq_prod (fun i y => |w i y|) + +theorem tensorCutoffWeight_abs_mass_le_one {ι : Type*} {E : ι → Type*} [Fintype ι] [∀ i, MeasureSpace (E i)] + [∀ i, SigmaFinite (volume : Measure (E i))] (w : ∀ i, E i → ℝ) + (hw : ∀ i, (∫ y, |w i y|) ≤ 1) : (∫ x, |tensorCutoffWeight w x|) ≤ 1 := by + rw [tensorCutoffWeight_abs_mass] + exact Finset.prod_le_one₀ (fun i _ => integral_nonneg (fun y => abs_nonneg _)) (fun i _ => hw i) + +theorem tensorCutoffWeight_mass_loss {ι : Type*} {E : ι → Type*} [Fintype ι] [∀ i, MeasureSpace (E i)] + [∀ i, SigmaFinite (volume : Measure (E i))] (w : ∀ i, E i → ℝ) + (hw : ∀ i x, 0 ≤ w i x) (hm : ∀ i, (∫ y, w i y) ≤ 1) + (e : ι → ℝ) (he : ∀ i, 1 - e i ≤ ∫ y, w i y) : + 1 - ∑ i, e i ≤ ∫ x, tensorCutoffWeight w x := by + rw [tensorCutoffWeight_integral] + have h := product_cutoff_loss_le (fun i => ∫ y, w i y) + (fun i => ⟨integral_nonneg (hw i), hm i⟩) + have hs : (∑ i, (1 - ∫ y, w i y)) ≤ ∑ i, e i := + Finset.sum_le_sum (fun i _ => by linarith [he i]) + linarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal BigOperators + +variable {I J : Type*} [Fintype I] [Fintype J] + +noncomputable def scaledInputWeightSum (f : (J → ℝ) × (I → ℝ) → ℝ) + (S : I → ℝ) (T : J → ℝ) : ℝ := ∑' p : (I → ℤ) × (J → ℤ), scaledIntegerWeight f S T p + +noncomputable def scaledInputMass (f : (J → ℝ) × (I → ℝ) → ℝ) + (S : I → ℝ) (T : J → ℝ) : ℝ := scaledInputWeightSum f S T / ((∏ i, S i) * (∏ j, T j)) + +theorem scaledIntegerWeight_summable (f : (J → ℝ) × (I → ℝ) → ℝ) (S : I → ℝ) (T : J → ℝ) + (hS : ∀ i, 0 < S i) (hT : ∀ j, 0 < T j) {R : ℝ} + (hsupport : ∀ p, R < ‖p‖ → f p = 0) : Summable (scaledIntegerWeight f S T) := by + let e : (J ⊕ I → ℤ) ≃ (I → ℤ) × (J → ℤ) := + (Equiv.sumPiEquivProdPi (fun _ : J ⊕ I => ℤ)).trans (Equiv.prodComm _ _) + have hscale : ∀ k, 0 < Sum.elim T S k := by intro k; cases k <;> simp [hS, hT] + have h := scaledRectangularWeight_summable (splitInputProfile f) (fun _ => 0) + (Sum.elim T S) (m := 1) zero_lt_one hscale (splitInputProfile_zero_outside hsupport) + have heq (z : J ⊕ I → ℤ) : scaledIntegerWeight f S T (e z) = + splitInputProfile f (fun k => (z k : ℝ) / Sum.elim T S k) := rfl + have hs : Summable (fun z => scaledIntegerWeight f S T (e z)) := by + simpa only [heq, zero_add, one_mul] using h + exact e.summable_iff.mp hs + +theorem scaledInputMass_error (f : (J → ℝ) × (I → ℝ) → ℝ) {K : ℝ≥0} + (hf : LipschitzWith K f) (S : I → ℝ) (T : J → ℝ) + (hS : ∀ i, 0 < S i) (hT : ∀ j, 0 < T j) {R δ : ℝ} + (hR : 0 ≤ R) (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (hmeshS : ∀ i, 1 / S i ≤ δ) (hmeshT : ∀ j, 1 / T j ≤ δ) + (hsupport : ∀ p, R < ‖p‖ → f p = 0) : + |scaledInputMass f S T - ∫ p, f p| ≤ (2 * R + 2) ^ (Fintype.card I + Fintype.card J) * K * δ := by + have hscale : ∀ k, 0 < Sum.elim T S k := by intro k; cases k <;> simp [hS, hT] + have hmesh : ∀ k, 1 / Sum.elim T S k ≤ δ := by + intro k + cases k with + | inl j => exact hmeshT j + | inr i => exact hmeshS i + have h := rectangularLattice_quadrature (splitInputProfile f) (splitInputProfile_lipschitz hf) + (fun _ => 0) (Sum.elim T S) hscale hR hδ hδ1 hmesh (splitInputProfile_zero_outside hsupport) + unfold rectangularLatticePoint at h + simp only [sub_zero, splitInputProfile_sample_sum, splitInputProfile_integral, + Fintype.prod_sum_type, Sum.elim_inl, Sum.elim_inr, Fintype.card_sum] at h + simpa only [scaledInputMass, scaledInputWeightSum, mul_comm (∏ j, T j) (∏ i, S i), + add_comm (Fintype.card J) (Fintype.card I)] using h + +theorem scaledInputMass_nonneg (f : (J → ℝ) × (I → ℝ) → ℝ) (hf : ∀ p, 0 ≤ f p) + (S : I → ℝ) (T : J → ℝ) (hS : ∀ i, 0 ≤ S i) (hT : ∀ j, 0 ≤ T j) : + 0 ≤ scaledInputMass f S T := + div_nonneg (tsum_nonneg (fun _ => hf _)) + (mul_nonneg (Finset.prod_nonneg fun i _ => hS i) (Finset.prod_nonneg fun j _ => hT j)) + +theorem scaledInputMass_bounds (f : (J → ℝ) × (I → ℝ) → ℝ) {K : ℝ≥0} + (hf : LipschitzWith K f) (S : I → ℝ) (T : J → ℝ) + (hS : ∀ i, 0 < S i) (hT : ∀ j, 0 < T j) {R δ : ℝ} + (hR : 0 ≤ R) (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (hmeshS : ∀ i, 1 / S i ≤ δ) (hmeshT : ∀ j, 1 / T j ≤ δ) + (hsupport : ∀ p, R < ‖p‖ → f p = 0) (hmass : (∫ p, f p) = 1) + (hsmall : (2 * R + 2) ^ (Fintype.card I + Fintype.card J) * K * δ ≤ 1 / 2) : + 1 / 2 ≤ scaledInputMass f S T ∧ scaledInputMass f S T ≤ 3 / 2 := by + have h := scaledInputMass_error f hf S T hS hT hR hδ hδ1 hmeshS hmeshT hsupport + rw [hmass, abs_le] at h + constructor <;> linarith [h.1, h.2] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +variable {D : Type*} [Fintype D] {I : D → Type*} [∀ d, Fintype (I d)] + +noncomputable def sigmaAxisWeight (w : ∀ d, (I d → ℝ) → ℝ) (x : (Σ d, I d) → ℝ) : ℝ := + tensorCutoffWeight w (sigmaAxisCoordinates I x) + +theorem sigmaAxisWeight_contDiff (w : ∀ d, (I d → ℝ) → ℝ) + (hw : ∀ d, ContDiff ℝ 1 (w d)) : ContDiff ℝ 1 (sigmaAxisWeight w) := + (tensorCutoffWeight_contDiff w hw).comp (sigmaAxisCoordinates I).contDiff + +omit [∀ d, Fintype (I d)] in +theorem sigmaAxisWeight_compact (w : ∀ d, (I d → ℝ) → ℝ) + (hw : ∀ d, HasCompactSupport (w d)) : HasCompactSupport (sigmaAxisWeight w) := + (tensorCutoffWeight_compact w hw).comp_homeomorph (sigmaAxisCoordinates I).toHomeomorph + +omit [∀ d, Fintype (I d)] in +theorem sigmaAxisWeight_tsupport (w : ∀ d, (I d → ℝ) → ℝ) + {x : (Σ d, I d) → ℝ} (hx : x ∈ tsupport (sigmaAxisWeight w)) (d : D) : + sigmaAxisProjection I d x ∈ tsupport (w d) := by + have he : tsupport (sigmaAxisWeight w) = + (sigmaAxisCoordinates I) ⁻¹' tsupport (tensorCutoffWeight w) := + tsupport_comp_eq_preimage _ (sigmaAxisCoordinates I).toHomeomorph + rw [he] at hx + exact tensorCutoffWeight_tsupport w hx d + +omit [∀ d, Fintype (I d)] in +theorem sigmaAxisWeight_nonneg (w : ∀ d, (I d → ℝ) → ℝ) + (hw : ∀ d y, 0 ≤ w d y) (x : (Σ d, I d) → ℝ) : 0 ≤ sigmaAxisWeight w x := + tensorCutoffWeight_nonneg w hw _ + +theorem sigmaAxisWeight_integral (w : ∀ d, (I d → ℝ) → ℝ) : + (∫ x, sigmaAxisWeight w x) = ∏ d, ∫ y, w d y := by + calc + _ = ∫ x, tensorCutoffWeight w x := + (sigmaAxisCoordinates_measurePreserving I).integral_comp + (sigmaAxisCoordinates I).toHomeomorph.toMeasurableEquiv.measurableEmbedding _ + _ = _ := tensorCutoffWeight_integral w + +theorem sigmaAxisWeight_abs_mass (w : ∀ d, (I d → ℝ) → ℝ) : + (∫ x, |sigmaAxisWeight w x|) = ∏ d, ∫ y, |w d y| := by + have he (x : (Σ d, I d) → ℝ) : |sigmaAxisWeight w x| = + sigmaAxisWeight (fun d y => |w d y|) x := by + simp only [sigmaAxisWeight, tensorCutoffWeight, Finset.abs_prod] + simp_rw [he] + exact sigmaAxisWeight_integral _ + +theorem sigmaAxisWeight_abs_mass_le_one (w : ∀ d, (I d → ℝ) → ℝ) + (hm : ∀ d, (∫ y, |w d y|) ≤ 1) : (∫ x, |sigmaAxisWeight w x|) ≤ 1 := by + rw [sigmaAxisWeight_abs_mass] + exact Finset.prod_le_one₀ (fun d _ => integral_nonneg (fun _ => abs_nonneg _)) (fun d _ => hm d) + +theorem sigmaAxisWeight_mass_loss (w : ∀ d, (I d → ℝ) → ℝ) + (hw : ∀ d y, 0 ≤ w d y) (hm : ∀ d, (∫ y, w d y) ≤ 1) + (e : D → ℝ) (he : ∀ d, 1 - e d ≤ ∫ y, w d y) : + 1 - ∑ d, e d ≤ ∫ x, sigmaAxisWeight w x := by + rw [sigmaAxisWeight_integral, ← tensorCutoffWeight_integral w] + exact tensorCutoffWeight_mass_loss w hw hm e he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal ContDiff BigOperators + +noncomputable def smoothProductProfile (I : Type*) [Fintype I] (x : I → ℝ) : ℝ := + ∏ i, smoothProbabilityProfile (x i) + +theorem smoothProductProfile_eq_cutoff (I : Type*) [Fintype I] : + smoothProductProfile I = coordinateBoxCutoff smoothProbabilityProfile 1 := by + funext x + simp [smoothProductProfile, coordinateBoxCutoff] + +theorem smoothProductProfile_contDiff (I : Type*) [Fintype I] : + ContDiff ℝ ∞ (smoothProductProfile I) := by + rw [smoothProductProfile_eq_cutoff] + exact contDiff_coordinateBoxCutoff _ smoothProbabilityProfile_contDiff 1 + +theorem smoothProductProfile_compact (I : Type*) [Fintype I] : + HasCompactSupport (smoothProductProfile I) := by + rw [smoothProductProfile_eq_cutoff] + exact hasCompactSupport_coordinateBoxCutoff _ smoothProbabilityProfile_zero zero_lt_one + +theorem smoothProductProfile_range (I : Type*) [Fintype I] (x : I → ℝ) : + 0 ≤ smoothProductProfile I x ∧ smoothProductProfile I x ≤ 1 := + ⟨Finset.prod_nonneg (fun i _ => (smoothProbabilityProfile_range (x i)).1), + Finset.prod_le_one₀ (fun i _ => (smoothProbabilityProfile_range (x i)).1) + (fun i _ => (smoothProbabilityProfile_range (x i)).2)⟩ + +theorem smoothProductProfile_norm_le (I : Type*) [Fintype I] (x : I → ℝ) : + ‖smoothProductProfile I x‖ ≤ 1 := by + rw [Real.norm_eq_abs, abs_of_nonneg (smoothProductProfile_range I x).1] + exact (smoothProductProfile_range I x).2 + +theorem smoothProductProfile_zero_outside (I : Type*) [Fintype I] + (x : I → ℝ) (hx : 1 < ‖x‖) : smoothProductProfile I x = 0 := by + classical + by_contra hn + apply (not_le_of_gt hx) + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro i + by_contra! hi + exact hn (Finset.prod_eq_zero (Finset.mem_univ i) + (smoothProbabilityProfile_zero_outside (x i) hi)) + +theorem smoothProductProfile_integral (I : Type*) [Fintype I] : + (∫ x, smoothProductProfile I x) = 1 := by + change (∫ x, tensorCutoffWeight (fun _ : I => smoothProbabilityProfile) x) = 1 + rw [tensorCutoffWeight_integral] + simp only [smoothProbabilityProfile_integral, Finset.prod_const_one] + +theorem smoothProductProfile_lipschitz (I : Type*) [Fintype I] : + LipschitzWith (Fintype.card I * probabilityProfileLipschitz) (smoothProductProfile I) := by + rw [smoothProductProfile_eq_cutoff] + simpa only [div_one, NNReal.coe_one] using + lipschitz_coordinateBoxCutoff smoothProbabilityProfile probabilityProfileLipschitz 1 + zero_lt_one smoothProbabilityProfile_range smoothProbabilityProfile_lipschitz + +theorem smoothProductProfile_equiv {I J : Type*} [Fintype I] [Fintype J] + (e : I ≃ J) (x : J → ℝ) : smoothProductProfile I (x ∘ e) = smoothProductProfile J x := by + exact Equiv.prod_comp e (fun j => smoothProbabilityProfile (x j)) + +theorem smoothProductProfile_sum (I J : Type*) [Fintype I] [Fintype J] + (x : I → ℝ) (y : J → ℝ) : + smoothProductProfile (I ⊕ J) (Sum.elim x y) = + smoothProductProfile I x * smoothProductProfile J y := by + simp [smoothProductProfile, Fintype.prod_sum_type] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem tensorCutoffWeight_update {ι : Type*} {E : ι → Type*} [Fintype ι] [DecidableEq ι] + (w : ∀ i, E i → ℝ) (i : ι) (g : E i → ℝ) (x : ∀ i, E i) : + tensorCutoffWeight (Function.update w i g) x = + g (x i) * ∏ j ∈ Finset.univ.erase i, w j (x j) := by + unfold tensorCutoffWeight + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ i), Function.update_self] + congr 1 + apply Finset.prod_congr rfl + intro j hj + rw [Function.update_of_ne (Finset.ne_of_mem_erase hj)] + +theorem tensorCutoffWeight_fderiv_single {ι : Type*} {E : ι → Type*} [Fintype ι] [DecidableEq ι] + [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)] + (w : ∀ i, E i → ℝ) (hw : ∀ j, ContDiff ℝ 1 (w j)) (x : ∀ i, E i) (i : ι) (v : E i) : + fderiv ℝ (tensorCutoffWeight w) x (Pi.single i v) = + (∏ j ∈ Finset.univ.erase i, w j (x j)) * fderiv ℝ (w i) (x i) v := by + have hd (j : ι) : HasFDerivAt (fun y : ∀ i, E i => w j (y j)) + ((fderiv ℝ (w j) (x j)).comp (ContinuousLinearMap.proj j)) x := + ((hw j).differentiable one_ne_zero (x j)).hasFDerivAt.comp x (hasFDerivAt_apply j x) + have h := HasFDerivAt.finsetProd (u := Finset.univ) (fun j _ => hd j) + change fderiv ℝ (fun y : ∀ i, E i => ∏ j, w j (y j)) x (Pi.single i v) = _ + rw [h.fderiv, sum_apply] + rw [Finset.sum_eq_single i] + · simp only [smul_apply, ContinuousLinearMap.comp_apply, ContinuousLinearMap.proj_apply, + Pi.single_eq_same, smul_eq_mul] + · intro j _ hji + simp [smul_apply, ContinuousLinearMap.comp_apply, hji] + · simp + +theorem tensorCutoffWeight_derivative_integral {ι : Type*} {E : ι → Type*} [Fintype ι] [DecidableEq ι] + [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)] [∀ i, MeasureSpace (E i)] + [∀ i, SigmaFinite (volume : Measure (E i))] + (w : ∀ i, E i → ℝ) (hw : ∀ j, ContDiff ℝ 1 (w j)) (i : ι) (v : E i) : + (∫ x, |fderiv ℝ (tensorCutoffWeight w) x (Pi.single i v)|) = + (∫ y, |fderiv ℝ (w i) y v|) * ∏ j ∈ Finset.univ.erase i, ∫ y, |w j y| := by + let a : ∀ i, E i → ℝ := fun j y => |w j y| + let g : E i → ℝ := fun y => |fderiv ℝ (w i) y v| + have he (x : ∀ i, E i) : + |fderiv ℝ (tensorCutoffWeight w) x (Pi.single i v)| = + tensorCutoffWeight (Function.update a i g) x := by + rw [tensorCutoffWeight_fderiv_single w hw, tensorCutoffWeight_update, + abs_mul, Finset.abs_prod] + exact mul_comm _ _ + simp_rw [he] + rw [tensorCutoffWeight_integral, ← Finset.mul_prod_erase _ _ (Finset.mem_univ i), + Function.update_self] + congr 1 + apply Finset.prod_congr rfl + intro j hj + rw [Function.update_of_ne (Finset.ne_of_mem_erase hj)] + +theorem tensorCutoffWeight_derivative_le {ι : Type*} {E : ι → Type*} [Fintype ι] [DecidableEq ι] + [∀ i, NormedAddCommGroup (E i)] [∀ i, NormedSpace ℝ (E i)] [∀ i, MeasureSpace (E i)] + [∀ i, SigmaFinite (volume : Measure (E i))] + (w : ∀ i, E i → ℝ) (hw : ∀ j, ContDiff ℝ 1 (w j)) + (hm : ∀ j, (∫ y, |w j y|) ≤ 1) (i : ι) (v : E i) : + (∫ x, |fderiv ℝ (tensorCutoffWeight w) x (Pi.single i v)|) ≤ + ∫ y, |fderiv ℝ (w i) y v| := by + rw [tensorCutoffWeight_derivative_integral w hw] + exact mul_le_of_le_one_right (integral_nonneg (fun _ => abs_nonneg _)) + (Finset.prod_le_one₀ (fun j _ => integral_nonneg (fun y => abs_nonneg _)) (fun j _ => hm j)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal + +noncomputable def splitSmoothProductProfile (J I : Type*) [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) : ℝ := + smoothProductProfile J p.1 * smoothProductProfile I p.2 + +theorem splitSmoothProductProfile_range (J I : Type*) [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) : + 0 ≤ splitSmoothProductProfile J I p ∧ splitSmoothProductProfile J I p ≤ 1 := by + have hJ := smoothProductProfile_range J p.1 + have hI := smoothProductProfile_range I p.2 + exact ⟨mul_nonneg hJ.1 hI.1, (mul_le_mul hJ.2 hI.2 hI.1 zero_le_one).trans_eq (one_mul 1)⟩ + +theorem splitSmoothProductProfile_integrable (J I : Type*) [Fintype J] [Fintype I] : + Integrable (splitSmoothProductProfile J I) := + binaryDensity_integrable + ((smoothProductProfile_contDiff J).continuous.integrable_of_hasCompactSupport (smoothProductProfile_compact J)) + ((smoothProductProfile_contDiff I).continuous.integrable_of_hasCompactSupport (smoothProductProfile_compact I)) + +theorem splitSmoothProductProfile_integral (J I : Type*) [Fintype J] [Fintype I] : + (∫ p, splitSmoothProductProfile J I p) = 1 := by + change (∫ p, binaryDensity (smoothProductProfile J) (smoothProductProfile I) p ∂volume.prod volume) = 1 + rw [binaryDensity_mass, smoothProductProfile_integral, smoothProductProfile_integral, one_mul] + +theorem splitSmoothProductProfile_lipschitz (J I : Type*) [Fintype J] [Fintype I] : + LipschitzWith (((Fintype.card J + Fintype.card I : ℕ) : ℝ≥0) * probabilityProfileLipschitz) + (splitSmoothProductProfile J I) := by + have h := binaryDensity_lipschitz (smoothProductProfile J) (smoothProductProfile I) 1 1 + (Fintype.card J * probabilityProfileLipschitz) (Fintype.card I * probabilityProfileLipschitz) + (smoothProductProfile_range J) (smoothProductProfile_range I) + (smoothProductProfile_lipschitz J) (smoothProductProfile_lipschitz I) + have he : binaryDensity (smoothProductProfile J) (smoothProductProfile I) = + splitSmoothProductProfile J I := by funext p; rfl + rw [← he] + simpa only [one_mul, Nat.cast_add, add_mul] using h + +theorem splitSmoothProductProfile_zero_outside (J I : Type*) [Fintype J] [Fintype I] + (p : (J → ℝ) × (I → ℝ)) (hp : 1 < ‖p‖) : splitSmoothProductProfile J I p = 0 := by + change 1 < max ‖p.1‖ ‖p.2‖ at hp + rcases lt_max_iff.mp hp with h | h + · exact mul_eq_zero_of_left (smoothProductProfile_zero_outside J p.1 h) _ + · exact mul_eq_zero_of_right _ (smoothProductProfile_zero_outside I p.2 h) + +theorem splitSmoothProductProfile_join (J I : Type*) [Fintype J] [Fintype I] : + splitInputProfile (splitSmoothProductProfile J I) = smoothProductProfile (J ⊕ I) := by + funext x + simp [splitInputProfile, splitSmoothProductProfile, smoothProductProfile, Fintype.prod_sum_type] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquareGradedRelative.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquareGradedRelative.lean new file mode 100644 index 0000000000000000000000000000000000000000..320e6cb0639aa42546f987712e4870fc608dc9ba --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquareGradedRelative.lean @@ -0,0 +1,463 @@ +import OAI.Combinatorics.Progressions.Polynomial.RankPolynomialFactorization + +namespace OAI + +section + +namespace Erdos3 + +open Module VectorPolynomial + +noncomputable def unitMonomial (n : ℕ) : Unit →₀ ℕ := Finsupp.single () n + +@[simp] theorem weight_unitMonomial (n : ℕ) : + Finsupp.weight (fun _ : Unit => 1) (unitMonomial n) = n := by + simp [unitMonomial, Finsupp.weight_single] + +@[simp] theorem unitMonomial_weight (α : Unit →₀ ℕ) : + unitMonomial (Finsupp.weight (fun _ : Unit => 1) α) = α := by + have h : α = Finsupp.single () (α ()) := by + apply Finsupp.ext + intro i + cases i + simp + rw [h] + simp [unitMonomial, Finsupp.weight_single] + +theorem unitMonomial_injective : Function.Injective unitMonomial := by + intro m n h + have hh := congrArg (Finsupp.weight (fun _ : Unit => 1)) h + simpa only [weight_unitMonomial] using hh + +@[simp] theorem unitMonomial_add (m n : ℕ) : + unitMonomial (m + n) = unitMonomial m + unitMonomial n := + Finsupp.single_add _ _ _ + +namespace NilpotentLieFiltration + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + +abbrev AssociatedGraded (F : NilpotentLieFiltration L s) := + F.PolynomialSymbol (fun _ : Unit => 1) + +noncomputable def associatedGradedIndexEquiv (ω : ι → ℕ) : + SymbolBasisIndex (fun _ : Unit => 1) ω ≃ ι where + toFun z := z.val.2 + invFun i := ⟨(unitMonomial (ω i), i), weight_unitMonomial (ω i)⟩ + left_inv z := by + apply Subtype.ext + apply Prod.ext + · exact (congrArg unitMonomial z.property.symm).trans (unitMonomial_weight z.val.1) + · rfl + right_inv _ := rfl + +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +noncomputable def associatedGradedBasis : Basis ι ℚ F.AssociatedGraded := + (F.polynomialSymbolBasis b ω hlayers (fun _ : Unit => 1)).reindex (associatedGradedIndexEquiv ω) + +@[simp] theorem associatedGradedBasis_apply (i : ι) : + F.associatedGradedBasis b ω hlayers i = + F.polynomialSymbolBasis b ω hlayers (fun _ : Unit => 1) + ⟨(unitMonomial (ω i), i), weight_unitMonomial (ω i)⟩ := by + rw [associatedGradedBasis, Basis.reindex_apply] + rfl + +theorem associatedGradedBasis_repr (x : F.AssociatedGraded) (i : ι) : + (F.associatedGradedBasis b ω hlayers).repr x i = + (F.polynomialSymbolBasis b ω hlayers (fun _ : Unit => 1)).repr x + ⟨(unitMonomial (ω i), i), weight_unitMonomial (ω i)⟩ := by + rw [associatedGradedBasis, Basis.repr_reindex_apply] + rfl + +theorem associatedGradedBasis_bracket (i j k : ι) : + (F.associatedGradedBasis b ω hlayers).repr + ⁅F.associatedGradedBasis b ω hlayers i, F.associatedGradedBasis b ω hlayers j⁆ k = + if ω i + ω j = ω k then b.repr ⁅b i, b j⁆ k else 0 := by + classical + rw [F.associatedGradedBasis_repr, F.associatedGradedBasis_apply, + F.associatedGradedBasis_apply, F.polynomialSymbolBasis_bracket] + simp only [← unitMonomial_add, unitMonomial_injective.eq_iff] + +noncomputable def associatedGradedFiltration : NilpotentLieFiltration F.AssociatedGraded s := + F.polynomialSymbolFiltration (fun _ : Unit => 1) + +theorem associatedGradedFiltration_layer (j : ℕ) : + F.associatedGradedFiltration.layer j = + Submodule.span ℚ (F.associatedGradedBasis b ω hlayers '' {i | j ≤ ω i}) := by + rw [associatedGradedFiltration, F.polynomialSymbolFiltration_layer b ω hlayers] + congr 1 + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + refine ⟨z.val.2, hz, ?_⟩ + rw [F.associatedGradedBasis_apply] + congr 1 + exact (associatedGradedIndexEquiv ω).left_inv z + · rintro ⟨i, hi, rfl⟩ + refine ⟨⟨(unitMonomial (ω i), i), weight_unitMonomial (ω i)⟩, hi, ?_⟩ + exact (F.associatedGradedBasis_apply b ω hlayers i).symm + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +noncomputable def gradedMonomialLinear (j : ℕ) : + F.layer j →ₗ[ℚ] F.adaptedLieSubalgebra (fun _ : Unit => 1) where + toFun v := ⟨monomial (unitMonomial j) (v : L), + F.monomial_mem_adaptedSubmodule (fun _ : Unit => 1) (unitMonomial j) + (by simpa only [weight_unitMonomial] using v.property)⟩ + map_add' x y := by + apply Subtype.ext + exact TensorProduct.tmul_add _ _ _ + map_smul' a x := by + apply Subtype.ext + exact TensorProduct.tmul_smul a _ _ + +@[simp] theorem gradedMonomialLinear_coe (j : ℕ) (v : F.layer j) : + (F.gradedMonomialLinear j v : VectorPolynomial Unit ℚ L) = monomial (unitMonomial j) (v : L) := rfl + +noncomputable def associatedGradedPieceMap (j : ℕ) : F.layer j →ₗ[ℚ] F.AssociatedGraded := + (F.polynomialSymbolMap (fun _ : Unit => 1)).toLinearMap.comp (F.gradedMonomialLinear j) + +@[simp] theorem associatedGradedPieceMap_apply (j : ℕ) (v : F.layer j) : + F.associatedGradedPieceMap j v = + F.polynomialSymbolMap (fun _ : Unit => 1) (F.gradedMonomialLinear j v) := rfl + +theorem associatedGradedPieceMap_eq_zero_iff (j : ℕ) (v : F.layer j) : + F.associatedGradedPieceMap j v = 0 ↔ (v : L) ∈ F.layer (j + 1) := by + rw [F.associatedGradedPieceMap_apply, F.polynomialSymbolMap_eq_zero_iff] + simp only [F.gradedMonomialLinear_coe, coefficients_monomial] + constructor + · intro h + simpa only [Finsupp.single_eq_same, weight_unitMonomial] using h (unitMonomial j) + · intro h α + by_cases hα : unitMonomial j = α + · subst α + simpa only [Finsupp.single_eq_same, weight_unitMonomial] using h + · rw [Finsupp.single_eq_of_ne (Ne.symm hα)] + exact Submodule.zero_mem _ + +theorem associatedGradedPieceMap_ker (j : ℕ) : + LinearMap.ker (F.associatedGradedPieceMap j) = + (F.layer (j + 1)).comap (F.layer j).subtype := by + ext v + exact F.associatedGradedPieceMap_eq_zero_iff j v + +theorem associatedGradedPieceMap_lie (i j : ℕ) (u : F.layer i) (v : F.layer j) : + ⁅F.associatedGradedPieceMap i u, F.associatedGradedPieceMap j v⁆ = + F.associatedGradedPieceMap (i + j) ⟨⁅(u : L), (v : L)⁆, F.lie_mem u.property v.property⟩ := by + simp only [F.associatedGradedPieceMap_apply] + rw [← LieHom.map_lie] + apply congrArg (F.polynomialSymbolMap (fun _ : Unit => 1)) + apply Subtype.ext + change ⁅monomial (unitMonomial i) (u : L), monomial (unitMonomial j) (v : L)⁆ = _ + rw [lie_monomial, ← unitMonomial_add] + rfl + +variable (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem associatedGradedPieceMap_coordinate (j : ℕ) (v : F.layer j) (i : ι) : + (F.associatedGradedBasis b ω hlayers).repr (F.associatedGradedPieceMap j v) i = + if j = ω i then b.repr (v : L) i else 0 := by + classical + rw [F.associatedGradedBasis_repr, F.associatedGradedPieceMap_apply, + F.polynomialSymbolBasis_repr_map] + simp only [F.gradedMonomialLinear_coe, coefficients_monomial] + by_cases h : j = ω i + · simp [h] + · have h' : unitMonomial j ≠ unitMonomial (ω i) := fun he => h (unitMonomial_injective he) + simp [h, h'] + +theorem associatedGradedPieceMap_basis (j : ℕ) (i : ι) (hi : j ≤ ω i) (he : j = ω i) : + F.associatedGradedPieceMap j + ⟨b i, by rw [hlayers]; exact Submodule.subset_span ⟨i, hi, rfl⟩⟩ = + F.associatedGradedBasis b ω hlayers i := by + classical + apply (F.associatedGradedBasis b ω hlayers).repr.injective + ext k + rw [F.associatedGradedPieceMap_coordinate] + simp only [Basis.repr_self, Finsupp.single_apply] + by_cases h : i = k + · subst k + simp only [he, ite_true] + · simp only [h, ite_false, ite_self] + +theorem associatedGradedPieceMap_range (j : ℕ) : + LinearMap.range (F.associatedGradedPieceMap j) = + Submodule.span ℚ (F.associatedGradedBasis b ω hlayers '' {i | ω i = j}) := by + apply le_antisymm + · rintro _ ⟨v, rfl⟩ + rw [basis_mem_span_image_iff] + intro i hi + rw [F.associatedGradedPieceMap_coordinate] + exact ite_eq_right (Ne.symm hi) + · apply Submodule.span_le.mpr + rintro _ ⟨i, hi, rfl⟩ + refine ⟨⟨b i, ?_⟩, ?_⟩ + · rw [hlayers] + exact Submodule.subset_span ⟨i, hi.symm.le, rfl⟩ + · exact F.associatedGradedPieceMap_basis b ω hlayers j i hi.symm.le hi.symm + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (U : LieSubalgebra ℚ F.AssociatedGraded) + +noncomputable def gradedRefiltrationLayer (j : ℕ) : Submodule ℚ L := + (U.toSubmodule.comap (F.associatedGradedPieceMap j)).map (F.layer j).subtype + +theorem mem_gradedRefiltrationLayer (j : ℕ) (v : L) : + v ∈ F.gradedRefiltrationLayer U j ↔ + ∃ hv : v ∈ F.layer j, F.associatedGradedPieceMap j ⟨v, hv⟩ ∈ U := by + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨x.property, hx⟩ + · rintro ⟨hv, hU⟩ + exact ⟨⟨v, hv⟩, hU, rfl⟩ + +theorem mem_gradedRefiltrationLayer_iff (j : ℕ) (v : F.layer j) : + (v : L) ∈ F.gradedRefiltrationLayer U j ↔ F.associatedGradedPieceMap j v ∈ U := by + rw [F.mem_gradedRefiltrationLayer] + exact ⟨fun ⟨_, h⟩ => h, fun h => ⟨v.property, h⟩⟩ + +theorem gradedRefiltrationLayer_le (j : ℕ) : F.gradedRefiltrationLayer U j ≤ F.layer j := by + intro v hv + exact ((F.mem_gradedRefiltrationLayer U j v).mp hv).choose + +theorem layer_succ_le_gradedRefiltrationLayer (j : ℕ) : + F.layer (j + 1) ≤ F.gradedRefiltrationLayer U j := by + intro v hv + rw [F.mem_gradedRefiltrationLayer] + refine ⟨F.antitone (Nat.le_succ j) hv, ?_⟩ + rw [(F.associatedGradedPieceMap_eq_zero_iff j _).mpr hv] + exact U.zero_mem + +theorem gradedRefiltrationLayer_antitone : Antitone (F.gradedRefiltrationLayer U) := by + intro i j hij + rcases lt_or_eq_of_le hij with hlt | rfl + · exact (F.gradedRefiltrationLayer_le U j).trans + ((F.antitone hlt).trans (F.layer_succ_le_gradedRefiltrationLayer U i)) + · exact le_rfl + +theorem gradedRefiltrationLayer_lie_mem {i j : ℕ} {v z : L} + (hv : v ∈ F.gradedRefiltrationLayer U i) (hz : z ∈ F.gradedRefiltrationLayer U j) : + ⁅v, z⁆ ∈ F.gradedRefiltrationLayer U (i + j) := by + obtain ⟨hv, hUv⟩ := (F.mem_gradedRefiltrationLayer U i v).mp hv + obtain ⟨hz, hUz⟩ := (F.mem_gradedRefiltrationLayer U j z).mp hz + rw [F.mem_gradedRefiltrationLayer] + refine ⟨F.lie_mem hv hz, ?_⟩ + rw [← F.associatedGradedPieceMap_lie i j ⟨v, hv⟩ ⟨z, hz⟩] + exact U.lie_mem hUv hUz + +theorem gradedRefiltrationLayer_terminal : F.gradedRefiltrationLayer U (s + 1) = ⊥ := + bot_unique ((F.gradedRefiltrationLayer_le U (s + 1)).trans F.terminal.le) + +noncomputable def gradedRefiltrationSubalgebra : LieSubalgebra ℚ L := + { F.gradedRefiltrationLayer U 1 with + lie_mem' := fun hv hz => F.gradedRefiltrationLayer_antitone U (by decide : 1 ≤ 1 + 1) + (F.gradedRefiltrationLayer_lie_mem U hv hz) } + +noncomputable def gradedRefiltration : + NilpotentLieFiltration (F.gradedRefiltrationSubalgebra U) s where + layer j := (F.gradedRefiltrationLayer U j).comap (F.gradedRefiltrationSubalgebra U).incl.toLinearMap + antitone := fun _ _ hij _ hv => F.gradedRefiltrationLayer_antitone U hij hv + one_eq_top := by + apply top_unique + intro v _ + exact v.property + lie_mem := fun hv hz => F.gradedRefiltrationLayer_lie_mem U hv hz + terminal := by + apply bot_unique + intro v hv + change v = 0 + apply Subtype.ext + exact (Submodule.mem_bot ℚ).mp ((F.gradedRefiltrationLayer_terminal U) ▸ hv) + +@[simp] theorem mem_gradedRefiltration_layer (j : ℕ) (v : F.gradedRefiltrationSubalgebra U) : + v ∈ (F.gradedRefiltration U).layer j ↔ (v : L) ∈ F.gradedRefiltrationLayer U j := Iff.rfl + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +def squareDiagonalLayer (j : ℕ) : F.layer j →ₗ[ℚ] F.squareFiltration.layer j where + toFun x := ⟨⟨(x, x), (F.mem_squareLieSubalgebra _).mpr (by simp)⟩, + x.property, x.property, by simp⟩ + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def squareRelativeLayer (j : ℕ) (hj : 1 ≤ j) : + F.layer (j + 1) →ₗ[ℚ] F.squareFiltration.layer j where + toFun x := ⟨⟨(x, 0), (F.mem_squareLieSubalgebra _).mpr (by + simpa only [sub_zero] using F.antitone (Nat.add_le_add_right hj 1) x.property)⟩, + F.antitone (Nat.le_succ j) x.property, (F.layer j).zero_mem, by + change (x : L) - 0 ∈ F.layer (j + 1) + simpa only [sub_zero] using x.property⟩ + map_add' _ _ := by apply Subtype.ext; apply Subtype.ext; simp + map_smul' _ _ := by apply Subtype.ext; apply Subtype.ext; simp + +noncomputable def squareGradedDiagonalPiece (j : ℕ) : + F.layer j →ₗ[ℚ] F.squareFiltration.AssociatedGraded := + (F.squareFiltration.associatedGradedPieceMap j).comp (F.squareDiagonalLayer j) + +noncomputable def squareGradedRelativePiece (j : ℕ) (hj : 1 ≤ j) : + F.layer (j + 1) →ₗ[ℚ] F.squareFiltration.AssociatedGraded := + (F.squareFiltration.associatedGradedPieceMap j).comp (F.squareRelativeLayer j hj) + +theorem squareGradedDiagonalPiece_eq_zero_iff (j : ℕ) (x : F.layer j) : + F.squareGradedDiagonalPiece j x = 0 ↔ (x : L) ∈ F.layer (j + 1) := by + change F.squareFiltration.associatedGradedPieceMap j (F.squareDiagonalLayer j x) = 0 ↔ _ + rw [F.squareFiltration.associatedGradedPieceMap_eq_zero_iff] + change ((x : L) ∈ F.layer (j + 1) ∧ (x : L) ∈ F.layer (j + 1) ∧ + (x : L) - x ∈ F.layer (j + 1 + 1)) ↔ _ + simp only [sub_self, Submodule.zero_mem, and_true, and_self] + +theorem squareGradedRelativePiece_eq_zero_iff (j : ℕ) (hj : 1 ≤ j) (x : F.layer (j + 1)) : + F.squareGradedRelativePiece j hj x = 0 ↔ (x : L) ∈ F.layer (j + 2) := by + change F.squareFiltration.associatedGradedPieceMap j (F.squareRelativeLayer j hj x) = 0 ↔ _ + rw [F.squareFiltration.associatedGradedPieceMap_eq_zero_iff] + change ((x : L) ∈ F.layer (j + 1) ∧ (0 : L) ∈ F.layer (j + 1) ∧ + (x : L) - 0 ∈ F.layer (j + 1 + 1)) ↔ _ + simp only [x.property, Submodule.zero_mem, sub_zero, true_and, Nat.add_assoc] + +theorem squareGradedDiagonalPiece_lie (i j : ℕ) (x : F.layer i) (y : F.layer j) : + ⁅F.squareGradedDiagonalPiece i x, F.squareGradedDiagonalPiece j y⁆ = + F.squareGradedDiagonalPiece (i + j) ⟨⁅(x : L), (y : L)⁆, F.lie_mem x.property y.property⟩ := by + change ⁅F.squareFiltration.associatedGradedPieceMap i _, + F.squareFiltration.associatedGradedPieceMap j _⁆ = _ + rw [F.squareFiltration.associatedGradedPieceMap_lie] + rfl + +theorem squareGradedDiagonal_relative_lie (i j : ℕ) (hj : 1 ≤ j) + (x : F.layer i) (y : F.layer (j + 1)) : + ⁅F.squareGradedDiagonalPiece i x, F.squareGradedRelativePiece j hj y⁆ = + F.squareGradedRelativePiece (i + j) (by omega) + ⟨⁅(x : L), (y : L)⁆, by simpa only [Nat.add_assoc] using F.lie_mem x.property y.property⟩ := by + change ⁅F.squareFiltration.associatedGradedPieceMap i _, + F.squareFiltration.associatedGradedPieceMap j _⁆ = _ + rw [F.squareFiltration.associatedGradedPieceMap_lie] + apply congrArg (F.squareFiltration.associatedGradedPieceMap (i + j)) + apply Subtype.ext + apply Subtype.ext + change (⁅(x : L), (y : L)⁆, ⁅(x : L), (0 : L)⁆) = (⁅(x : L), (y : L)⁆, 0) + rw [lie_zero] + +theorem squareGradedRelativePiece_lie_eq_zero (i j : ℕ) (hi : 1 ≤ i) (hj : 1 ≤ j) + (x : F.layer (i + 1)) (y : F.layer (j + 1)) : + ⁅F.squareGradedRelativePiece i hi x, F.squareGradedRelativePiece j hj y⁆ = 0 := by + change ⁅F.squareFiltration.associatedGradedPieceMap i _, + F.squareFiltration.associatedGradedPieceMap j _⁆ = 0 + rw [F.squareFiltration.associatedGradedPieceMap_lie, + F.squareFiltration.associatedGradedPieceMap_eq_zero_iff] + have hxy : ⁅(x : L), (y : L)⁆ ∈ F.layer (i + j + 2) := by + convert F.lie_mem x.property y.property using 1; congr 1; omega + change ⁅(x : L), (y : L)⁆ ∈ F.layer (i + j + 1) ∧ + ⁅(0 : L), (0 : L)⁆ ∈ F.layer (i + j + 1) ∧ + ⁅(x : L), (y : L)⁆ - ⁅(0 : L), (0 : L)⁆ ∈ F.layer (i + j + 1 + 1) + rw [lie_zero, sub_zero] + exact ⟨F.antitone (by omega) hxy, (F.layer _).zero_mem, hxy⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +def squareGradedRelativeGenerators : Set F.squareFiltration.AssociatedGraded := + {z | ∃ (j : ℕ) (hj : 1 ≤ j) (x : F.layer (j + 1)), z = F.squareGradedRelativePiece j hj x} + +noncomputable def squareGradedRelativeSubmodule : Submodule ℚ F.squareFiltration.AssociatedGraded := + Submodule.span ℚ F.squareGradedRelativeGenerators + +theorem squareGradedRelative_lie_eq_zero {x y : F.squareFiltration.AssociatedGraded} + (hx : x ∈ F.squareGradedRelativeSubmodule) (hy : y ∈ F.squareGradedRelativeSubmodule) : + ⁅x, y⁆ = 0 := by + induction hx, hy using Submodule.span_induction₂ with + | mem_mem x y hx hy => + obtain ⟨i, hi, a, rfl⟩ := hx + obtain ⟨j, hj, b, rfl⟩ := hy + exact F.squareGradedRelativePiece_lie_eq_zero i j hi hj a b + | zero_left y _ => exact zero_lie y + | zero_right x _ => exact lie_zero x + | add_left x y z _ _ _ hx hy => rw [add_lie, hx, hy, add_zero] + | add_right x y z _ _ _ hx hy => rw [lie_add, hx, hy, add_zero] + | smul_left r x y _ _ h => rw [smul_lie, h, smul_zero] + | smul_right r x y _ _ h => rw [lie_smul, h, smul_zero] + +noncomputable def squareGradedRelativeSubalgebra : LieSubalgebra ℚ F.squareFiltration.AssociatedGraded := + { F.squareGradedRelativeSubmodule with + lie_mem' := fun hx hy => by + rw [F.squareGradedRelative_lie_eq_zero hx hy] + exact F.squareGradedRelativeSubmodule.zero_mem } + +theorem squareGradedRelative_diagonal_lie_mem (i : ℕ) (x : F.layer i) + {y : F.squareFiltration.AssociatedGraded} (hy : y ∈ F.squareGradedRelativeSubmodule) : + ⁅F.squareGradedDiagonalPiece i x, y⁆ ∈ F.squareGradedRelativeSubmodule := by + induction hy using Submodule.span_induction with + | mem y hy => + obtain ⟨j, hj, b, rfl⟩ := hy + rw [F.squareGradedDiagonal_relative_lie] + exact Submodule.subset_span ⟨i + j, by omega, _, rfl⟩ + | zero => rw [lie_zero]; exact F.squareGradedRelativeSubmodule.zero_mem + | add y z _ _ hy hz => + rw [lie_add] + exact F.squareGradedRelativeSubmodule.add_mem hy hz + | smul r y _ hy => + rw [lie_smul] + exact F.squareGradedRelativeSubmodule.smul_mem r hy + +theorem squareGradedPiece_decomposition (j : ℕ) (hj : 1 ≤ j) + (x : F.squareFiltration.layer j) : + F.squareFiltration.associatedGradedPieceMap j x = + F.squareGradedDiagonalPiece j ⟨x.val.val.2, x.property.2.1⟩ + + F.squareGradedRelativePiece j hj ⟨x.val.val.1 - x.val.val.2, x.property.2.2⟩ := by + change F.squareFiltration.associatedGradedPieceMap j x = + F.squareFiltration.associatedGradedPieceMap j (F.squareDiagonalLayer j _) + + F.squareFiltration.associatedGradedPieceMap j (F.squareRelativeLayer j hj _) + rw [← map_add] + apply congrArg (F.squareFiltration.associatedGradedPieceMap j) + apply Subtype.ext + apply Subtype.ext + change x.val.val = (x.val.val.2, x.val.val.2) + (x.val.val.1 - x.val.val.2, 0) + apply Prod.ext + · change x.val.val.1 = x.val.val.2 + (x.val.val.1 - x.val.val.2) + abel + · exact (add_zero _).symm + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquareRationalModel.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquareRationalModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cdc9f343e4e2cc26585718a20e30e8999b66e9e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquareRationalModel.lean @@ -0,0 +1,68 @@ +import OAI.Combinatorics.Progressions.Linear.SquareBasisGeometry +import OAI.Combinatorics.Progressions.Nilpotent.AdaptedBasisNilmanifold + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {L ι : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype ι] {s : ℕ} + (F : NilpotentLieFiltration L s) + +noncomputable def squareFinBasis (b : Basis ι ℚ L) (w : ι → ℕ) + (h : F.layer 2 = Submodule.span ℚ (b '' {i | 2 ≤ w i})) : + Basis (Fin (Fintype.card (ι ⊕ {i // 2 ≤ w i}))) ℚ F.squareLieSubalgebra := + (F.adaptedSquareBasis b w h).reindex (Fintype.equivFin _) + +noncomputable def squareFinWeight (w : ι → ℕ) : + Fin (Fintype.card (ι ⊕ {i // 2 ≤ w i})) → ℕ := + fun i => squareBasisWeight w ((Fintype.equivFin _).symm i) + +theorem squareFinBasis_layers (b : Basis ι ℚ L) (w : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) (j : ℕ) : + F.squareFiltration.layer j = Submodule.span ℚ + (F.squareFinBasis b w (hlayers 2) '' {i | j ≤ squareFinWeight w i}) := by + rw [F.adaptedSquareBasis_layers b w hlayers j] + exact (basis_reindex_span_weights _ _ _ _).symm + +theorem exists_square_rational_model (b : Basis ι ℚ L) (w : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + (Γ : Subgroup F.Group) {l H : ℕ} (hl : 0 < l) (hH : 1 ≤ H) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants b i j k) H) + (hin : scaledIntegerGrid l ⊆ bchSubgroupCoordinates b Γ) + (hout : bchSubgroupCoordinates b Γ ⊆ denominatorGrid l) + {p : ℝ} (hp : 0 ≤ p) (hd : 2 * (Fintype.card ι : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) : + ∃ (N : ℕ) (hN : 0 < N) + (hinner : scaledIntegerGrid N ⊆ bchSubgroupCoordinates + (F.squareFinBasis b w (hlayers 2)) (F.squareLattice Γ)) + (houter : bchSubgroupCoordinates (F.squareFinBasis b w (hlayers 2)) + (F.squareLattice Γ) ⊆ denominatorGrid N), + (F.squareFiltration.ofAdaptedBasis (F.squareFinBasis b w (hlayers 2)) + (squareFinWeight w) (F.squareFinBasis_layers b w hlayers) + (F.squareLattice Γ) N hN hinner houter).GeometryComplexityLE ((p + 2) ^ 11) := by + obtain ⟨N, hN, hNp, hinner, houter⟩ := + F.exists_adaptedSquareBasis_grid b w (hlayers 2) Γ hl hin hout hp hd hlp + have hin' := bchSubgroup_inner_grid_reindex _ (Fintype.equivFin _) _ hinner + have hout' := bchSubgroup_outer_grid_reindex _ (Fintype.equivFin _) _ houter + refine ⟨N, hN, hin', hout', ?_⟩ + apply F.squareFiltration.ofAdaptedBasis_geometry _ _ _ _ _ _ hin' hout' (by positivity) + · exact ((Nat.cast_le.mpr (card_squareBasis_index_le w)).trans (by + simpa only [Nat.cast_mul, Nat.cast_ofNat] using hd)).trans + (le_power_budget hp (by decide : 1 ≤ 11)) + · exact hNp.trans (Real.exp_le_exp.mpr + (pow_le_pow_right₀ (by linarith : 1 ≤ p + 2) (by decide : 9 ≤ 11))) + · intro i j k + change rationalLogHeight + (lieStructureConstants (F.squareFinBasis b w (hlayers 2)) i j k) ≤ (p + 2) ^ 11 + rw [squareFinBasis, lieStructureConstants_reindex] + exact F.adaptedSquareBasis_structure_bound b w (hlayers 2) hH hc hp hd hHp _ _ _ + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquareStructureHeight.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquareStructureHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..85542cafcc34411f3981b86cefd6eb753517439f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquareStructureHeight.lean @@ -0,0 +1,74 @@ +import OAI.Combinatorics.Progressions.Linear.SquareBasisGeometry + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : F.layer 2 = Submodule.span ℚ (e '' {i | 2 ≤ ω i})) + +theorem adaptedSquareBasis_bracket_repr_inl (x y : F.squareLieSubalgebra) (k : ι) : + (F.adaptedSquareBasis e ω hF).repr ⁅x, y⁆ (Sum.inl k) = e.repr ⁅x.val.2, y.val.2⁆ k := by + change (F.squareBasis e _).repr ⁅x, y⁆ (Sum.inl k) = _ + rw [F.squareBasis_repr_inl] + rfl + +theorem adaptedSquareBasis_bracket_repr_inr (x y : F.squareLieSubalgebra) (k : {i // 2 ≤ ω i}) : + (F.adaptedSquareBasis e ω hF).repr ⁅x, y⁆ (Sum.inr k) = + e.repr (⁅x.val.1, y.val.1⁆ - ⁅x.val.2, y.val.2⁆) k.val := by + change (F.squareBasis e _).repr ⁅x, y⁆ (Sum.inr k) = _ + rw [F.squareBasis_repr_inr, supportedSubmoduleBasis_repr] + rfl + +theorem adaptedSquareBasis_structure_height {H : ℕ} (hH : 1 ≤ H) + (hc : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (a b k : ι ⊕ {i // 2 ≤ ω i}) : + RationalHeightLE ((F.adaptedSquareBasis e ω hF).repr + ⁅F.adaptedSquareBasis e ω hF a, F.adaptedSquareBasis e ω hF b⁆ k) H := by + rcases a with i | i <;> rcases b with j | j <;> rcases k with k | k + · rw [F.adaptedSquareBasis_bracket_repr_inl, F.adaptedSquareBasis_inl, F.adaptedSquareBasis_inl] + exact hc i j k + · rw [F.adaptedSquareBasis_bracket_repr_inr, F.adaptedSquareBasis_inl, F.adaptedSquareBasis_inl] + simpa only [sub_self, map_zero, Finsupp.zero_apply] using rationalHeightLE_zero hH + · rw [F.adaptedSquareBasis_bracket_repr_inl, F.adaptedSquareBasis_inl, F.adaptedSquareBasis_inr] + simpa only [lie_zero, map_zero, Finsupp.zero_apply] using rationalHeightLE_zero hH + · rw [F.adaptedSquareBasis_bracket_repr_inr, F.adaptedSquareBasis_inl, F.adaptedSquareBasis_inr] + simpa only [lie_zero, sub_zero] using hc i j.val k.val + · rw [F.adaptedSquareBasis_bracket_repr_inl, F.adaptedSquareBasis_inr, F.adaptedSquareBasis_inl] + simpa only [zero_lie, map_zero, Finsupp.zero_apply] using rationalHeightLE_zero hH + · rw [F.adaptedSquareBasis_bracket_repr_inr, F.adaptedSquareBasis_inr, F.adaptedSquareBasis_inl] + simpa only [zero_lie, sub_zero] using hc i.val j k.val + · rw [F.adaptedSquareBasis_bracket_repr_inl, F.adaptedSquareBasis_inr, F.adaptedSquareBasis_inr] + simpa only [lie_zero, map_zero, Finsupp.zero_apply] using rationalHeightLE_zero hH + · rw [F.adaptedSquareBasis_bracket_repr_inr, F.adaptedSquareBasis_inr, F.adaptedSquareBasis_inr] + simpa only [lie_zero, sub_zero] using hc i.val j.val k.val + +variable (F : NilpotentLieFiltration L (s + 1)) + +theorem reducedSquareBasis_structure_height + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + {H : ℕ} (hH : 1 ≤ H) (hc : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (a b k : ReducedSquareBasisIndex s ω) : + RationalHeightLE ((F.reducedSquareBasis e ω hF).repr + ⁅F.reducedSquareBasis e ω hF a, F.reducedSquareBasis e ω hF b⁆ k) H := by + change RationalHeightLE (lieStructureConstants (F.reducedSquareBasis e ω hF) a b k) H + have hspan : (F.squareFiltration.layerIdeal (s + 1)).toSubmodule = Submodule.span ℚ + (F.adaptedSquareBasis e ω (hF 2) '' {i | s + 1 ≤ squareBasisWeight ω i}) := + F.adaptedSquareBasis_layers e ω hF (s + 1) + have he : lieStructureConstants (F.reducedSquareBasis e ω hF) a b k = + lieStructureConstants (F.adaptedSquareBasis e ω (hF 2)) a.val b.val k.val := + supportedQuotientBasis_lieStructure (F.adaptedSquareBasis e ω (hF 2)) + (F.squareFiltration.layerIdeal (s + 1)) {i | s + 1 ≤ squareBasisWeight ω i} hspan a b k + rw [he] + exact F.adaptedSquareBasis_structure_height e ω (hF 2) hH hc a.val b.val k.val + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquareSymbolRelative.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquareSymbolRelative.lean new file mode 100644 index 0000000000000000000000000000000000000000..aba7a3daf464d07dd316e9e693422cd5e206f034 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquareSymbolRelative.lean @@ -0,0 +1,157 @@ +import OAI.Combinatorics.Progressions.Estimates.SplitGroupRelative +import OAI.Combinatorics.Progressions.Polynomial.SquarePolynomialCoordinates + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (w : σ → ℕ) (hw : ∀ i, 0 < w i) + +theorem relativeSquareSymbol_lie_eq_zero (p q : F.normalizedRelativeSubmodule w) : + ⁅F.relativeSquareSymbolMap w hw p, F.relativeSquareSymbolMap w hw q⁆ = 0 := by + have hpq : ⁅p.val, q.val⁆ ∈ F.shiftedPolynomialIdeal w 2 := + F.shiftedPolynomialIdeal_lie_mem w (i := 1) (j := 1) p.property.1 q.property.1 + have hpq0 : coefficients ⁅p.val, q.val⁆.val 0 ∈ F.layer 2 := by + have hh := hpq 0 + change coefficients ⁅p.val, q.val⁆.val 0 ∈ F.layer (Finsupp.weight w 0 + 2) at hh + rw [map_zero, Nat.zero_add] at hh + exact hh + let r : F.normalizedRelativeSubmodule w := + ⟨⁅p.val, q.val⁆, F.shiftedPolynomialIdeal_antitone w (by decide : 1 ≤ 2) hpq, hpq0⟩ + have he : ⁅F.relativeSquareLift w hw p, F.relativeSquareLift w hw q⁆ = + F.relativeSquareLift w hw r := by + apply F.square_polynomial_ext w + · rw [LieHom.map_lie, F.squareFstPolynomialMap_relative, F.squareFstPolynomialMap_relative, + F.squareFstPolynomialMap_relative] + · rw [LieHom.map_lie, F.squareSndPolynomialMap_relative, F.squareSndPolynomialMap_relative, + F.squareSndPolynomialMap_relative, lie_zero] + change ⁅F.squareFiltration.polynomialSymbolMap w (F.relativeSquareLift w hw p), + F.squareFiltration.polynomialSymbolMap w (F.relativeSquareLift w hw q)⁆ = 0 + rw [← LieHom.map_lie, he] + exact (F.relativeSquareSymbolMap_eq_zero_iff w hw r).mpr hpq + +include hw in +theorem squareSndSymbolKernel_lie_eq_zero {x y : F.squareFiltration.PolynomialSymbol w} + (hx : F.squareSndSymbolMap w x = 0) (hy : F.squareSndSymbolMap w y = 0) : ⁅x, y⁆ = 0 := by + have hx' : x ∈ LinearMap.range (F.relativeSquareSymbolMap w hw) := by + rw [F.relativeSquareSymbolMap_range w hw] + exact hx + have hy' : y ∈ LinearMap.range (F.relativeSquareSymbolMap w hw) := by + rw [F.relativeSquareSymbolMap_range w hw] + exact hy + obtain ⟨p, rfl⟩ := hx' + obtain ⟨q, rfl⟩ := hy' + exact F.relativeSquareSymbol_lie_eq_zero w hw p q + +include hw in +theorem squareSndSymbolKernel_bch {x y : F.squareFiltration.PolynomialSymbol w} + (hx : F.squareSndSymbolMap w x = 0) (hy : F.squareSndSymbolMap w y = 0) : + lieBCH s x y = x + y := + lieBCH_eq_add_of_lie_eq_zero (F.squareFiltration.polynomialSymbol_lowerCentralSeries_eq_bot w) + (F.squareSndSymbolKernel_lie_eq_zero w hw hx hy) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open NilpotentLieBCHGroup + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (w : σ → ℕ) + +@[simp] theorem squareSndSymbolMap_symbol (r : F.squareFiltration.adaptedLieSubalgebra w) : + F.squareSndSymbolMap w (F.squareFiltration.polynomialSymbolMap w r) = + F.polynomialSymbolMap w (F.squareSndPolynomialMap w r) := rfl + +@[simp] theorem squareSndSymbolMap_diagonal (x : F.PolynomialSymbol w) : + F.squareSndSymbolMap w (F.squareDiagonalSymbolMap w x) = x := by + obtain ⟨p, rfl⟩ := F.polynomialSymbolMap_surjective w x + rw [F.squareDiagonalSymbolMap_symbol, F.squareSndSymbolMap_symbol, F.squareSndPolynomialMap_diagonal] + +noncomputable def squareSndSymbolHom : F.squareFiltration.PolynomialSymbolGroup w →* F.PolynomialSymbolGroup w := + NilpotentLieBCHGroup.map (F.squareSndSymbolMap w) + +noncomputable def squareDiagonalSymbolHom : F.PolynomialSymbolGroup w →* F.squareFiltration.PolynomialSymbolGroup w := + NilpotentLieBCHGroup.map (F.squareDiagonalSymbolMap w) + +@[simp] theorem squareSndSymbolHom_diagonal (g : F.PolynomialSymbolGroup w) : + F.squareSndSymbolHom w (F.squareDiagonalSymbolHom w g) = g := by + apply NilpotentLieBCHGroup.ext + exact F.squareSndSymbolMap_diagonal w g.coord + +noncomputable def squareRelativeGroupPart (g : F.squareFiltration.PolynomialSymbolGroup w) : + F.squareFiltration.PolynomialSymbolGroup w := + splitRelativePart (F.squareSndSymbolHom w) (F.squareDiagonalSymbolHom w) g + +@[simp] theorem squareRelativeGroupPart_projection (g : F.squareFiltration.PolynomialSymbolGroup w) : + F.squareSndSymbolHom w (F.squareRelativeGroupPart w g) = 1 := + splitRelativePart_projection _ _ (F.squareSndSymbolHom_diagonal w) g + +theorem squareRelativeGroupPart_coord_kernel (g : F.squareFiltration.PolynomialSymbolGroup w) : + F.squareSndSymbolMap w (F.squareRelativeGroupPart w g).coord = 0 := + congrArg NilpotentLieBCHGroup.coord (F.squareRelativeGroupPart_projection w g) + +theorem squareRelativeGroupPart_factorization (g : F.squareFiltration.PolynomialSymbolGroup w) : + F.squareRelativeGroupPart w g * F.squareDiagonalSymbolHom w (F.squareSndSymbolHom w g) = g := + splitRelativePart_factorization _ _ g + +theorem squareRelativeGroupPart_mul (g h : F.squareFiltration.PolynomialSymbolGroup w) : + F.squareRelativeGroupPart w (g * h) = F.squareRelativeGroupPart w g * + (F.squareDiagonalSymbolHom w (F.squareSndSymbolHom w g) * F.squareRelativeGroupPart w h * + (F.squareDiagonalSymbolHom w (F.squareSndSymbolHom w g))⁻¹) := + splitRelativePart_mul _ _ g h + +variable (hw : ∀ i, 0 < w i) + +include hw in +theorem squareRelativeGroupPart_mul_coord (g h : F.squareFiltration.PolynomialSymbolGroup w) : + (F.squareRelativeGroupPart w (g * h)).coord = (F.squareRelativeGroupPart w g).coord + + (F.squareDiagonalSymbolHom w (F.squareSndSymbolHom w g) * F.squareRelativeGroupPart w h * + (F.squareDiagonalSymbolHom w (F.squareSndSymbolHom w g))⁻¹).coord := by + have hk : F.squareSndSymbolHom w + (F.squareDiagonalSymbolHom w (F.squareSndSymbolHom w g) * F.squareRelativeGroupPart w h * + (F.squareDiagonalSymbolHom w (F.squareSndSymbolHom w g))⁻¹) = 1 := by + simp only [map_mul, map_inv, F.squareSndSymbolHom_diagonal, F.squareRelativeGroupPart_projection, + mul_one, mul_inv_cancel] + rw [F.squareRelativeGroupPart_mul, coord_mul] + exact F.squareSndSymbolKernel_bch w hw (F.squareRelativeGroupPart_coord_kernel w g) + (congrArg NilpotentLieBCHGroup.coord hk) + +include hw in +theorem squareRelative_same_diagonal_mod_kernel + (U : LieSubalgebra ℚ (F.squareFiltration.PolynomialSymbol w)) + {g h : F.squareFiltration.PolynomialSymbolGroup w} + (hg : g.coord ∈ U) (hh : h.coord ∈ U) + (hproj : F.squareSndSymbolHom w g = F.squareSndSymbolHom w h) : + (F.squareRelativeGroupPart w g).coord - (F.squareRelativeGroupPart w h).coord ∈ + U.toSubmodule ⊓ (F.squareSndSymbolMap w).ker.toSubmodule := by + have hpair := splitRelativePart_pair_mem (F.squareSndSymbolHom w) (F.squareDiagonalSymbolHom w) + (F.squareSndSymbolHom_diagonal w) (NilpotentLieBCHGroup.subgroup U) hg hh hproj + have hneg : F.squareSndSymbolMap w (-(F.squareRelativeGroupPart w h).coord) = 0 := by + rw [map_neg, F.squareRelativeGroupPart_coord_kernel, neg_zero] + have he : (F.squareRelativeGroupPart w g * (F.squareRelativeGroupPart w h)⁻¹).coord = + (F.squareRelativeGroupPart w g).coord - (F.squareRelativeGroupPart w h).coord := by + rw [coord_mul, coord_inv, F.squareSndSymbolKernel_bch w hw + (F.squareRelativeGroupPart_coord_kernel w g) hneg] + rw [sub_eq_add_neg] + constructor + · have hm : (F.squareRelativeGroupPart w g * (F.squareRelativeGroupPart w h)⁻¹).coord ∈ U := hpair.1 + rwa [he] at hm + · change F.squareSndSymbolMap w + ((F.squareRelativeGroupPart w g).coord - (F.squareRelativeGroupPart w h).coord) = 0 + rw [map_sub, F.squareRelativeGroupPart_coord_kernel, F.squareRelativeGroupPart_coord_kernel, sub_self] + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeAdaptedLieAlgebra.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeAdaptedLieAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..6468141cac2779bc254edbeafb78469b7b36dd75 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeAdaptedLieAlgebra.lean @@ -0,0 +1,56 @@ +import OAI.Combinatorics.Progressions.Estimates.MultidegreeDilationPair + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem squarefreeAdapted_lie_mem (x y : SquarefreePolynomial ι L) + (hx : x ∈ F.squarefreeAdaptedModule π) (hy : y ∈ F.squarefreeAdaptedModule π) : + ⁅x, y⁆ ∈ F.squarefreeAdaptedModule π := by + classical + rw [← sum_squarefreeMonomial x, ← sum_squarefreeMonomial y, sum_lie_sum] + apply Submodule.sum_mem + intro a _ + apply Submodule.sum_mem + intro b _ + by_cases ha : a.val = 0 + · rw [(hx a).2 ha, map_zero, zero_lie] + exact (F.squarefreeAdaptedModule π).zero_mem + by_cases hb : b.val = 0 + · rw [(hy b).2 hb, map_zero, lie_zero] + exact (F.squarefreeAdaptedModule π).zero_mem + by_cases hab : Disjoint a.val.support b.val.support + · rw [squarefreeMonomial_lie_disjoint a b hab] + apply F.squarefreeMonomial_mem_adapted π + · change a.val + b.val ≠ 0 + intro he + apply ha + ext i + have hi := congrArg (fun c : ι →₀ ℕ => c i) he + simp only [Finsupp.add_apply, Finsupp.zero_apply] at hi ⊢ + omega + · change ⁅squarefreePolynomialEquiv x a, squarefreePolynomialEquiv y b⁆ ∈ + F.layer (blockDegree π (a.val + b.val)) + rw [blockDegree_add] + exact F.lie_mem (hx a).1 (hy b).1 + · rw [squarefreeMonomial_lie_overlap a b hab] + exact (F.squarefreeAdaptedModule π).zero_mem + +noncomputable def squarefreeAdaptedSubalgebra : LieSubalgebra ℚ (SquarefreePolynomial ι L) := + { F.squarefreeAdaptedModule π with + lie_mem' := fun hx hy => F.squarefreeAdapted_lie_mem π _ _ hx hy } + +abbrev SquarefreeAlgebra := ↥(F.squarefreeAdaptedSubalgebra π) + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeCoefficients.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..73f34c46f187b953824e09624b736e3747af7a00 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeCoefficients.lean @@ -0,0 +1,61 @@ +import OAI.Combinatorics.Progressions.Estimates.SquarefreeExponents +import OAI.Combinatorics.Progressions.Polynomial.VectorPolynomialReconstruction + +namespace OAI + +section + +namespace Erdos3 + +open VectorPolynomial +open scoped BigOperators + +variable {ι L : Type*} [AddCommGroup L] [Module ℚ L] + +noncomputable def squarefreeCoefficients : VectorPolynomial ι ℚ L →ₗ[ℚ] (SquarefreeIndex ι → L) where + toFun p a := coefficients p a.val + map_add' p q := by ext a; simp only [map_add, Finsupp.add_apply, Pi.add_apply] + map_smul' r p := by ext a; simp only [map_smul, Finsupp.smul_apply, Pi.smul_apply, RingHom.id_apply] + +@[simp] theorem squarefreeCoefficients_apply (p : VectorPolynomial ι ℚ L) (a : SquarefreeIndex ι) : + squarefreeCoefficients p a = coefficients p a.val := rfl + +theorem squarefreeCoefficients_monomial_self (a : SquarefreeIndex ι) (v : L) : + squarefreeCoefficients (monomial a.val v) a = v := by + classical + simp only [squarefreeCoefficients_apply, coefficients_monomial, Finsupp.single_eq_same] + +theorem squarefreeCoefficients_monomial_ne (a b : SquarefreeIndex ι) (h : a ≠ b) (v : L) : + squarefreeCoefficients (monomial a.val v) b = 0 := by + classical + simp only [squarefreeCoefficients_apply, coefficients_monomial] + exact Finsupp.single_eq_of_ne (fun he => h (Subtype.ext he.symm)) + +theorem squarefreeCoefficients_surjective [Fintype ι] : + Function.Surjective (squarefreeCoefficients (ι := ι) (L := L)) := by + classical + intro f + refine ⟨∑ a : SquarefreeIndex ι, monomial a.val (f a), ?_⟩ + ext b + simp only [map_sum, Finset.sum_apply] + rw [Finset.sum_eq_single b] + · exact squarefreeCoefficients_monomial_self b (f b) + · intro a _ h + exact squarefreeCoefficients_monomial_ne a b h (f a) + · simp + +theorem monomial_mem_squarefreeKernel (a : ι →₀ ℕ) (ha : ¬SquarefreeExponent a) (v : L) : + monomial a v ∈ LinearMap.ker (squarefreeCoefficients (ι := ι) (L := L)) := by + classical + change squarefreeCoefficients (monomial a v) = 0 + ext b + simp only [squarefreeCoefficients_apply, coefficients_monomial, Pi.zero_apply] + apply Finsupp.single_eq_of_ne + intro he + exact ha (he.symm ▸ b.property) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeExponents.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeExponents.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6eb22523b2050ee3b88c3758307eada0cdb3ae2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeExponents.lean @@ -0,0 +1,66 @@ +import Mathlib.Data.Finset.Disjoint +import Mathlib.Data.Finsupp.Fintype +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +def SquarefreeExponent {ι : Type*} (a : ι →₀ ℕ) : Prop := ∀ i, a i ≤ 1 + +abbrev SquarefreeIndex (ι : Type*) := {a : ι →₀ ℕ // SquarefreeExponent a} + +theorem not_squarefreeExponent_add_right {ι : Type*} (a b : ι →₀ ℕ) + (hb : ¬SquarefreeExponent b) : ¬SquarefreeExponent (a + b) := by + intro h + apply hb + intro i + have hi : a i + b i ≤ 1 := h i + omega + +theorem squarefreeExponent_add_iff {ι : Type*} (a b : ι →₀ ℕ) + (ha : SquarefreeExponent a) (hb : SquarefreeExponent b) : + SquarefreeExponent (a + b) ↔ Disjoint a.support b.support := by + classical + rw [Finset.disjoint_left] + constructor + · intro h i hi hj + have hsum : a i + b i ≤ 1 := h i + have hai := Finsupp.mem_support_iff.mp hi + have hbi := Finsupp.mem_support_iff.mp hj + omega + · intro h i + have hai := ha i + have hbi := hb i + change a i + b i ≤ 1 + by_cases hzero : a i = 0 + · omega + · have hz : b i = 0 := by + by_contra hn + exact h (Finsupp.mem_support_iff.mpr hzero) (Finsupp.mem_support_iff.mpr hn) + omega + +noncomputable def squarefreeIndexEquiv (ι : Type*) [Fintype ι] : + SquarefreeIndex ι ≃ (ι → Fin 2) where + toFun a i := ⟨a.val i, Nat.lt_succ_of_le (a.property i)⟩ + invFun f := ⟨Finsupp.equivFunOnFinite.symm (fun i => (f i).val), + fun i => Nat.le_of_lt_succ (f i).isLt⟩ + left_inv _ := Subtype.ext (Finsupp.ext fun _ => rfl) + right_inv _ := funext fun _ => Fin.ext rfl + +noncomputable instance squarefreeIndexFintype (ι : Type*) [Fintype ι] : Fintype (SquarefreeIndex ι) := by + classical + exact Fintype.ofEquiv (ι → Fin 2) (squarefreeIndexEquiv ι).symm + +theorem card_squarefreeIndex (ι : Type*) [Fintype ι] : + Fintype.card (SquarefreeIndex ι) = 2 ^ Fintype.card ι := by + classical + rw [Fintype.card_congr (squarefreeIndexEquiv ι), Fintype.card_fun, Fintype.card_fin] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeLayerBases.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeLayerBases.lean new file mode 100644 index 0000000000000000000000000000000000000000..2501d02d2ae025045b730c7c58066581721d54c2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeLayerBases.lean @@ -0,0 +1,52 @@ +import OAI.Combinatorics.Progressions.Linear.RankQuotientHeightBudget + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open Module +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + {κ : SquarefreeIndex ι → Type*} [∀ a, Fintype (κ a)] + (b : ∀ a, Basis (κ a) ℚ (F.squarefreeCoefficientLayer π a)) + +noncomputable def squarefreeSupportedFinBasis (P : SquarefreeIndex ι → Prop) : + Basis (Fin (finrank ℚ + ((squarefreeSupportModule P).comap (F.squarefreeAdaptedSubalgebra π).incl.toLinearMap))) ℚ + ((squarefreeSupportModule P).comap (F.squarefreeAdaptedSubalgebra π).incl.toLinearMap) := by + classical + exact (F.squarefreeSupportedBasis π b P).reindex + (Fintype.equivFinOfCardEq (finrank_eq_card_basis (F.squarefreeSupportedBasis π b P)).symm) + +theorem squarefreeSupportedFinBasis_height (P : SquarefreeIndex ι → Prop) (j k) : + RationalHeightLE ((F.squarefreeBasis π b).repr (F.squarefreeSupportedFinBasis π b P j).val k) 1 := by + classical + unfold squarefreeSupportedFinBasis + rw [Basis.reindex_apply, F.squarefreeSupportedBasis_coe] + exact basis_repr_height_one _ _ _ + +noncomputable def squarefreeMultidegreeBasis (c : ι → ℕ) : + Basis (Fin (finrank ℚ (F.squarefreeMultidegreeLayer π c))) ℚ (F.squarefreeMultidegreeLayer π c) := + F.squarefreeSupportedFinBasis π b (fun a => c ≤ fun i => a.val i) + +theorem squarefreeMultidegreeBasis_height (c : ι → ℕ) (j k) : + RationalHeightLE ((F.squarefreeBasis π b).repr (F.squarefreeMultidegreeBasis π b c j).val k) 1 := + F.squarefreeSupportedFinBasis_height π b _ j k + +noncomputable def squarefreeDegreeBasis (n : ℕ) : + Basis (Fin (finrank ℚ (F.squarefreeDegreeLayer π n))) ℚ (F.squarefreeDegreeLayer π n) := + F.squarefreeSupportedFinBasis π b (fun a => n ≤ ∑ i, a.val i) + +theorem squarefreeDegreeBasis_height (n : ℕ) (j k) : + RationalHeightLE ((F.squarefreeBasis π b).repr (F.squarefreeDegreeBasis π b n j).val k) 1 := + F.squarefreeSupportedFinBasis_height π b _ j k + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreePermutationFiltration.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreePermutationFiltration.lean new file mode 100644 index 0000000000000000000000000000000000000000..568b5951a0cfb7f0692b9b9e2884dfffb89c95f4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreePermutationFiltration.lean @@ -0,0 +1,647 @@ +import Mathlib.Algebra.Lie.Prod +import OAI.Combinatorics.Progressions.Geometry.SquarefreeAlgebraCoordinates +import OAI.Combinatorics.Progressions.Nilpotent.BCHConjugationLinear +import OAI.Combinatorics.Progressions.Nilpotent.SquarefreeSupportBracket +import OAI.Combinatorics.Progressions.Polynomial.AdaptedBinomialFactorization +import OAI.Combinatorics.Progressions.Polynomial.DegreeRankSunflower +import OAI.Combinatorics.Progressions.Polynomial.RealBlockPolynomialEval +import OAI.Combinatorics.Progressions.Polynomial.SquarefreeTotalDegree + +namespace OAI + +section + +namespace Erdos3 + +variable {ι κ L : Type*} [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] + +theorem squarefreePermute_monomial_lie (e : ι ≃ κ) (a b : SquarefreeIndex ι) (v w : L) : + squarefreePermute e ⁅squarefreeMonomial a v, squarefreeMonomial b w⁆ = + ⁅squarefreePermute e (squarefreeMonomial a v), + squarefreePermute e (squarefreeMonomial b w)⁆ := by + by_cases hab : Disjoint a.val.support b.val.support + · rw [squarefreeMonomial_lie_disjoint a b hab] + simp only [squarefreePermute_monomial] + rw [squarefreeMonomial_lie_disjoint _ _ ((SquarefreeIndex.permute_disjoint e a b).mpr hab), + SquarefreeIndex.permute_disjointAdd] + · rw [squarefreeMonomial_lie_overlap a b hab, map_zero] + simp only [squarefreePermute_monomial] + rw [squarefreeMonomial_lie_overlap _ _ + (fun h => hab ((SquarefreeIndex.permute_disjoint e a b).mp h))] + +theorem squarefreePermute_lie (e : ι ≃ κ) (x y : SquarefreePolynomial ι L) : + squarefreePermute e ⁅x, y⁆ = ⁅squarefreePermute e x, squarefreePermute e y⁆ := by + classical + conv_lhs => + rw [← sum_squarefreeMonomial x, ← sum_squarefreeMonomial y, sum_lie_sum] + simp only [map_sum] + conv_rhs => + rw [← sum_squarefreeMonomial x, ← sum_squarefreeMonomial y] + simp only [map_sum] + rw [sum_lie_sum] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + exact squarefreePermute_monomial_lie e a b _ _ + +noncomputable def squarefreePermuteLie (e : ι ≃ κ) : + SquarefreePolynomial ι L ≃ₗ⁅ℚ⁆ SquarefreePolynomial κ L := + { squarefreePermute e with map_lie' := squarefreePermute_lie e _ _ } + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s t : ℕ} + +theorem layer_eq_bot_above_step (F : NilpotentLieFiltration L s) {i : ℕ} + (hi : s < i) : F.layer i = ⊥ := by + apply bot_unique + rw [← F.terminal] + exact F.antitone (by omega) + +def raiseStep (F : NilpotentLieFiltration L s) (hst : s ≤ t) : NilpotentLieFiltration L t where + layer := F.layer + antitone := F.antitone + one_eq_top := F.one_eq_top + lie_mem := F.lie_mem + terminal := F.layer_eq_bot_above_step (by omega) + +theorem raiseStep_layer (F : NilpotentLieFiltration L s) (hst : s ≤ t) (i : ℕ) : + (F.raiseStep hst).layer i = F.layer i := rfl + +theorem raiseStep_realification_layer (F : NilpotentLieFiltration L s) (hst : s ≤ t) (i : ℕ) : + (F.raiseStep hst).realification.layer i = F.realification.layer i := rfl + +noncomputable def raiseStepOrbit (F : NilpotentLieFiltration L s) (hst : s ≤ t) + {σ : Type*} {w : σ → ℕ} (g : F.PolynomialOrbit w) : (F.raiseStep hst).PolynomialOrbit w := + polynomialOrbitOfLog g.log g.adapted + +theorem raiseStepOrbit_log (F : NilpotentLieFiltration L s) (hst : s ≤ t) + {σ : Type*} {w : σ → ℕ} (g : F.PolynomialOrbit w) : + (F.raiseStepOrbit hst g).log = g.log := rfl + +end Erdos3.NilpotentLieFiltration + +namespace Erdos3 + +open Module + +theorem bchSubgroupCoordinates_changeStep + {L ι : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype ι] {s t : ℕ} + (hs : LieModule.lowerCentralSeries ℚ L L s = ⊥) + (ht : LieModule.lowerCentralSeries ℚ L L t = ⊥) + (e : Basis ι ℚ L) (Γ : Subgroup (NilpotentLieBCHGroup L s hs)) : + bchSubgroupCoordinates e (Γ.map (NilpotentLieBCHGroup.changeStep hs ht).toMonoidHom) = + bchSubgroupCoordinates e Γ := by + ext x + constructor + · intro hx + obtain ⟨g, hg, heq⟩ := Subgroup.mem_map.mp hx + have hcoord := congrArg NilpotentLieBCHGroup.coord heq + have hg' : g = ⟨e.equivFun.symm x⟩ := NilpotentLieBCHGroup.ext hcoord + change (⟨e.equivFun.symm x⟩ : NilpotentLieBCHGroup L s hs) ∈ Γ + rwa [← hg'] + · intro hx + exact Subgroup.mem_map.mpr ⟨⟨e.equivFun.symm x⟩, hx, rfl⟩ + +end Erdos3 + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +noncomputable def squarefreeComponent (a : SquarefreeIndex ι) : + F.SquarefreeAlgebra π →ₗ[ℚ] F.SquarefreeAlgebra π where + toFun x := ⟨squarefreeMonomial a (squarefreePolynomialEquiv x.val a), + F.squarefreeMonomial_component_mem π x.val x.property a⟩ + map_add' x y := by + apply Subtype.ext + change squarefreeMonomial a (squarefreePolynomialEquiv (x.val + y.val) a) = _ + simp only [map_add, Pi.add_apply] + rfl + map_smul' r x := by + apply Subtype.ext + change squarefreeMonomial a (squarefreePolynomialEquiv (r • x.val) a) = _ + simp only [map_smul, Pi.smul_apply] + rfl + +theorem squarefreeComponent_apply (a : SquarefreeIndex ι) (x : F.SquarefreeAlgebra π) : + (F.squarefreeComponent π a x).val = + squarefreeMonomial a (squarefreePolynomialEquiv x.val a) := rfl + +theorem sum_squarefreeComponent (x : F.SquarefreeAlgebra π) : + ∑ a : SquarefreeIndex ι, F.squarefreeComponent π a x = x := by + classical + apply Subtype.ext + change (F.squarefreeAdaptedSubalgebra π).incl (∑ a, F.squarefreeComponent π a x) = x.val + rw [map_sum] + exact sum_squarefreeMonomial x.val + +theorem squarefreeAlgebra_lowerCentralSeries_eq_bot : + LieModule.lowerCentralSeries ℚ (F.SquarefreeAlgebra π) (F.SquarefreeAlgebra π) s = ⊥ := + lie_subalgebra_lowerCentralSeries_eq_bot + (squarefreePolynomial_lowerCentralSeries_eq_bot F.ordinary.lowerCentralSeries_eq_bot) + (F.squarefreeAdaptedSubalgebra π) + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (hF : F.layer (s + 1) = ⊥) + +def dropTop : NilpotentLieFiltration L s where + layer := F.layer + antitone := F.antitone + one_eq_top := F.one_eq_top + lie_mem := F.lie_mem + terminal := hF + +@[simp] theorem dropTop_layer (i : ℕ) : (F.dropTop hF).layer i = F.layer i := rfl + +@[simp] theorem dropTop_realification_layer (i : ℕ) : + (F.dropTop hF).realification.layer i = F.realification.layer i := rfl + +end Erdos3.NilpotentLieFiltration + +namespace Erdos3.DegreeRankLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + +theorem rank_zero_top_eq_bot (F : DegreeRankLieFiltration L s 0) : + F.associatedDegree.layer s = ⊥ := by + change F.layer s 0 = ⊥ + rw [F.rank_zero_eq_one] + exact F.terminal + +end Erdos3.DegreeRankLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +noncomputable def squarefreeMultidegreeLayer (c : ι → ℕ) : Submodule ℚ (F.SquarefreeAlgebra π) := + (squarefreeSupportModule (fun a : SquarefreeIndex ι => c ≤ fun i => a.val i)).comap + (F.squarefreeAdaptedSubalgebra π).incl.toLinearMap + +noncomputable def squarefreeDegreeLayer (n : ℕ) : Submodule ℚ (F.SquarefreeAlgebra π) := + (squarefreeSupportModule (fun a : SquarefreeIndex ι => n ≤ ∑ i, a.val i)).comap + (F.squarefreeAdaptedSubalgebra π).incl.toLinearMap + +theorem mem_squarefreeMultidegreeLayer (c : ι → ℕ) (x : F.SquarefreeAlgebra π) : + x ∈ F.squarefreeMultidegreeLayer π c ↔ + ∀ a : SquarefreeIndex ι, ¬c ≤ (fun i => a.val i) → squarefreePolynomialEquiv x.val a = 0 := + Iff.rfl + +theorem mem_squarefreeDegreeLayer (n : ℕ) (x : F.SquarefreeAlgebra π) : + x ∈ F.squarefreeDegreeLayer π n ↔ + ∀ a : SquarefreeIndex ι, ¬n ≤ ∑ i, a.val i → squarefreePolynomialEquiv x.val a = 0 := + Iff.rfl + +theorem squarefreeMultidegreeLayer_antitone : Antitone (F.squarefreeMultidegreeLayer π) := by + intro c d h x hx a ha + exact hx a (fun hd => ha (h.trans hd)) + +theorem squarefreeDegreeLayer_antitone : Antitone (F.squarefreeDegreeLayer π) := by + intro n m h x hx a ha + exact hx a (fun hm => ha (h.trans hm)) + +theorem squarefreeMultidegreeLayer_lie_mem {c d : ι → ℕ} {x y : F.SquarefreeAlgebra π} + (hx : x ∈ F.squarefreeMultidegreeLayer π c) (hy : y ∈ F.squarefreeMultidegreeLayer π d) : + ⁅x, y⁆ ∈ F.squarefreeMultidegreeLayer π (c + d) := by + apply squarefreeSupportModule_lie_mem (x := x.val) (y := y.val) ?_ hx hy + intro a b hab ha hb i + exact Nat.add_le_add (ha i) (hb i) + +theorem squarefreeDegreeLayer_lie_mem {n m : ℕ} {x y : F.SquarefreeAlgebra π} + (hx : x ∈ F.squarefreeDegreeLayer π n) (hy : y ∈ F.squarefreeDegreeLayer π m) : + ⁅x, y⁆ ∈ F.squarefreeDegreeLayer π (n + m) := by + apply squarefreeSupportModule_lie_mem (x := x.val) (y := y.val) ?_ hx hy + intro a b hab ha hb + rw [squarefreeDisjointAdd_total] + exact Nat.add_le_add ha hb + +theorem squarefreeMultidegreeLayer_le_degree (c : ι → ℕ) (n : ℕ) (h : n ≤ ∑ i, c i) : + F.squarefreeMultidegreeLayer π c ≤ F.squarefreeDegreeLayer π n := by + intro x hx a ha + apply hx a + intro hca + exact ha (h.trans (Finset.sum_le_sum fun i _ => hca i)) + +theorem squarefreeComponent_mem_multidegree (a : SquarefreeIndex ι) (x : F.SquarefreeAlgebra π) : + F.squarefreeComponent π a x ∈ F.squarefreeMultidegreeLayer π (fun i => a.val i) := by + exact squarefreeMonomial_mem_support a (fun _ => le_rfl) _ + +theorem squarefreeComponent_eq_zero_of_degree {n : ℕ} {x : F.SquarefreeAlgebra π} + (hx : x ∈ F.squarefreeDegreeLayer π n) (a : SquarefreeIndex ι) (ha : ¬n ≤ ∑ i, a.val i) : + F.squarefreeComponent π a x = 0 := by + apply Subtype.ext + change squarefreeMonomial a (squarefreePolynomialEquiv x.val a) = 0 + have hz : squarefreePolynomialEquiv x.val a = 0 := hx a ha + rw [hz, map_zero] + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem squarefreeDegreeLayer_one : F.squarefreeDegreeLayer π 1 = ⊤ := by + apply top_unique + intro x _ a ha + have hzero : a.val = 0 := (exponent_total_eq_zero_iff a.val).mp (by omega) + exact (x.property a).2 hzero + +theorem squarefreeDegreeLayer_terminal : F.squarefreeDegreeLayer π (Fintype.card ι + 1) = ⊥ := by + apply bot_unique + intro x hx + change x = 0 + apply Subtype.ext + apply squarefreePolynomialEquiv.injective + ext a + apply hx a + have h := squarefreeExponent_total_le a + omega + +noncomputable def squarefreeOrdinaryFiltration : + NilpotentLieFiltration (F.SquarefreeAlgebra π) (Fintype.card ι) where + layer := F.squarefreeDegreeLayer π + antitone := F.squarefreeDegreeLayer_antitone π + one_eq_top := F.squarefreeDegreeLayer_one π + lie_mem := F.squarefreeDegreeLayer_lie_mem π + terminal := F.squarefreeDegreeLayer_terminal π + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +noncomputable def comparisonProductLayer (n : ℕ) : Submodule ℚ (L × F.SquarefreeAlgebra π) := + (F.ordinary.layer n).prod (F.squarefreeDegreeLayer π n) + +theorem comparisonProductLayer_antitone : Antitone (F.comparisonProductLayer π) := + fun _ _ h _ hx => ⟨F.ordinary.antitone h hx.1, F.squarefreeDegreeLayer_antitone π h hx.2⟩ + +theorem comparisonProductLayer_lie_mem {i j : ℕ} {x y : L × F.SquarefreeAlgebra π} + (hx : x ∈ F.comparisonProductLayer π i) (hy : y ∈ F.comparisonProductLayer π j) : + ⁅x, y⁆ ∈ F.comparisonProductLayer π (i + j) := + ⟨F.ordinary.lie_mem hx.1 hy.1, F.squarefreeDegreeLayer_lie_mem π hx.2 hy.2⟩ + +theorem comparisonProductLayer_one : F.comparisonProductLayer π 1 = ⊤ := by + unfold comparisonProductLayer + rw [F.ordinary.one_eq_top, F.squarefreeDegreeLayer_one] + ext x + simp only [Submodule.mem_prod, Submodule.mem_top, and_self] + +theorem comparisonProductLayer_terminal : + F.comparisonProductLayer π (max s (Fintype.card ι) + 1) = ⊥ := by + change (F.ordinary.layer _).prod ((F.squarefreeOrdinaryFiltration π).layer _) = ⊥ + rw [F.ordinary.layer_eq_bot_above_step (by omega), + (F.squarefreeOrdinaryFiltration π).layer_eq_bot_above_step (by omega)] + ext x + simp only [Submodule.mem_prod, Submodule.mem_bot, Prod.ext_iff, Prod.fst_zero, Prod.snd_zero] + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem squarefreeMultidegreeLayer_zero : F.squarefreeMultidegreeLayer π 0 = ⊤ := by + apply top_unique + intro x _ a ha + exact False.elim (ha (fun _ => Nat.zero_le _)) + +theorem squarefreeMultidegreeLayer_terminal (c : ι → ℕ) (hc : ¬c ≤ (fun _ => 1)) : + F.squarefreeMultidegreeLayer π c = ⊥ := by + apply bot_unique + intro x hx + change x = 0 + apply Subtype.ext + apply squarefreePolynomialEquiv.injective + ext a + exact hx a (fun hca => hc (fun i => (hca i).trans (a.property i))) + +theorem squarefree_degree_eq (n : ℕ) : + F.squarefreeDegreeLayer π n = + ⨆ (c : ι → ℕ) (_hc : n ≤ ∑ i, c i), F.squarefreeMultidegreeLayer π c := by + classical + apply le_antisymm + · intro x hx + rw [← F.sum_squarefreeComponent π x] + apply Submodule.sum_mem + intro a _ + by_cases ha : n ≤ ∑ i, a.val i + · have hle : F.squarefreeMultidegreeLayer π (fun i => a.val i) ≤ + ⨆ (c : ι → ℕ) (_hc : n ≤ ∑ i, c i), F.squarefreeMultidegreeLayer π c := + le_iSup_of_le (fun i => a.val i) (le_iSup_of_le ha le_rfl) + exact hle (F.squarefreeComponent_mem_multidegree π a x) + · rw [F.squarefreeComponent_eq_zero_of_degree π hx a ha] + exact Submodule.zero_mem _ + · apply iSup_le + intro c + apply iSup_le + intro hc + exact F.squarefreeMultidegreeLayer_le_degree π c n hc + +noncomputable def squarefreeMultidegreeFiltration : + MultidegreeLieFiltration ι (F.SquarefreeAlgebra π) (Fintype.card ι) (fun _ => 1) where + ordinary := F.squarefreeOrdinaryFiltration π + layer := F.squarefreeMultidegreeLayer π + antitone := F.squarefreeMultidegreeLayer_antitone π + zero_eq_top := F.squarefreeMultidegreeLayer_zero π + lie_mem := F.squarefreeMultidegreeLayer_lie_mem π + terminal := F.squarefreeMultidegreeLayer_terminal π + degree_eq := F.squarefree_degree_eq π + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +omit [Fintype ι] [Fintype σ] in +theorem blockPermutation_symm (e : ι ≃ ι) (he : ∀ i, π (e i) = π i) : + ∀ i, π (e.symm i) = π i := by + intro i + simpa only [Equiv.apply_symm_apply] using (he (e.symm i)).symm + +theorem squarefreePermute_mem_adapted (e : ι ≃ ι) (he : ∀ i, π (e i) = π i) + (x : SquarefreePolynomial ι L) (hx : x ∈ F.squarefreeAdaptedModule π) : + squarefreePermute e x ∈ F.squarefreeAdaptedModule π := by + intro a + rw [squarefreePermute_coefficient] + have hd : blockDegree π ((SquarefreeIndex.permute e).symm a).val = blockDegree π a.val := + SquarefreeIndex.permute_blockDegree π e.symm (blockPermutation_symm π e he) a + refine ⟨?_, ?_⟩ + · rw [← hd] + exact (hx _).1 + · intro ha + exact (hx _).2 ((SquarefreeIndex.permute_zero_iff e.symm a).mpr ha) + +noncomputable def squarefreeBlockPermute (e : ι ≃ ι) (he : ∀ i, π (e i) = π i) : + F.SquarefreeAlgebra π ≃ₗ⁅ℚ⁆ F.SquarefreeAlgebra π where + toFun x := ⟨squarefreePermute e x.val, F.squarefreePermute_mem_adapted π e he _ x.property⟩ + invFun x := ⟨squarefreePermute e.symm x.val, + F.squarefreePermute_mem_adapted π e.symm (blockPermutation_symm π e he) _ x.property⟩ + left_inv x := Subtype.ext (squarefreePermute_symm_apply e x.val) + right_inv x := Subtype.ext (squarefreePermute_symm_apply e.symm x.val) + map_add' x y := Subtype.ext (map_add (squarefreePermute e) x.val y.val) + map_smul' r x := Subtype.ext (map_smul (squarefreePermute e) r x.val) + map_lie' {x y} := Subtype.ext (squarefreePermute_lie e x.val y.val) + +theorem squarefreeBlockPermute_apply (e : ι ≃ ι) (he : ∀ i, π (e i) = π i) + (x : F.SquarefreeAlgebra π) : + (F.squarefreeBlockPermute π e he x).val = squarefreePermute e x.val := rfl + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +noncomputable def squarefreeLayerMap (a : SquarefreeIndex ι) : + F.layer (blockDegree π a.val) →ₗ[ℚ] F.SquarefreeAlgebra π := by + classical + exact if ha : a.val = 0 then 0 else + { toFun := fun v => ⟨squarefreeMonomial a v.val, F.squarefreeMonomial_mem_adapted π a ha v.val v.property⟩ + map_add' := fun v w => Subtype.ext (map_add (squarefreeMonomial a) v.val w.val) + map_smul' := fun r v => Subtype.ext (map_smul (squarefreeMonomial a) r v.val) } + +theorem squarefreeLayerMap_zero (a : SquarefreeIndex ι) (ha : a.val = 0) + (v : F.layer (blockDegree π a.val)) : F.squarefreeLayerMap π a v = 0 := by + simp only [squarefreeLayerMap, dite_eq_left ha, LinearMap.zero_apply] + +theorem squarefreeLayerMap_coe (a : SquarefreeIndex ι) (ha : a.val ≠ 0) + (v : F.layer (blockDegree π a.val)) : + (F.squarefreeLayerMap π a v).val = squarefreeMonomial a v.val := by + simp only [squarefreeLayerMap, dite_eq_right ha, LinearMap.coe_mk, AddHom.coe_mk] + +theorem squarefreeLayerMap_mem (a : SquarefreeIndex ι) (v : F.layer (blockDegree π a.val)) : + F.squarefreeLayerMap π a v ∈ F.squarefreeMultidegreeLayer π (fun i => a.val i) := by + by_cases ha : a.val = 0 + · rw [F.squarefreeLayerMap_zero π a ha] + exact Submodule.zero_mem _ + · change (F.squarefreeLayerMap π a v).val ∈ squarefreeSupportModule _ + rw [F.squarefreeLayerMap_coe π a ha] + exact squarefreeMonomial_mem_support a (fun _ => le_rfl) v.val + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem factorialBlockMonomial_mem_adapted (a : σ → ℕ) (ha : a ≠ 0) + (x : L) (hx : x ∈ F.layer a) : + factorialBlockMonomial π a x ∈ F.squarefreeAdaptedModule π := by + classical + intro c + rw [factorialBlockMonomial_coefficient] + by_cases hca : blockDegree π c.val = a + · rw [ite_eq_left hca] + refine ⟨?_, ?_⟩ + · rw [hca] + exact (F.layer a).smul_mem _ hx + · intro hc + apply False.elim + apply ha + rw [hc, blockDegree_zero] at hca + exact hca.symm + · rw [ite_eq_right hca] + exact ⟨(F.layer _).zero_mem, fun _ => rfl⟩ + +noncomputable def blockLayerMap (a : σ → ℕ) (ha : a ≠ 0) : + F.layer a →ₗ[ℚ] F.SquarefreeAlgebra π where + toFun x := ⟨factorialBlockMonomial π a x.val, + F.factorialBlockMonomial_mem_adapted π a ha x.val x.property⟩ + map_add' x y := Subtype.ext (map_add (factorialBlockMonomial π a) x.val y.val) + map_smul' r x := Subtype.ext (map_smul (factorialBlockMonomial π a) r x.val) + +theorem blockLayerMap_coe (a : σ → ℕ) (ha : a ≠ 0) (x : F.layer a) : + (F.blockLayerMap π a ha x).val = factorialBlockMonomial π a x.val := rfl + +theorem blockLayerMap_mem_degree (a : σ → ℕ) (ha : a ≠ 0) (x : F.layer a) : + F.blockLayerMap π a ha x ∈ F.squarefreeDegreeLayer π (∑ i, a i) := by + classical + intro c hc + change squarefreePolynomialEquiv (factorialBlockMonomial π a x.val) c = 0 + rw [factorialBlockMonomial_coefficient] + apply ite_eq_right + intro hca + apply hc + have ht : (∑ i, a i) = ∑ j, c.val j := by + rw [← hca] + exact blockDegree_total π c.val + exact ht.le + +theorem blockLayerMap_permute (a : σ → ℕ) (ha : a ≠ 0) (x : F.layer a) + (e : Equiv.Perm ι) (he : ∀ i, π (e i) = π i) : + F.squarefreeBlockPermute π e he (F.blockLayerMap π a ha x) = F.blockLayerMap π a ha x := by + apply Subtype.ext + rw [F.squarefreeBlockPermute_apply, F.blockLayerMap_coe] + apply squarefreePolynomialEquiv.injective + ext c + classical + simp only [squarefreePermute_coefficient, factorialBlockMonomial_coefficient, + SquarefreeIndex.permute_symm, + SquarefreeIndex.permute_blockDegree π e.symm (blockPermutation_symm π e he)] + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3 + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + +omit [Fintype ι] in +theorem SquarefreeIndex.permute_one (a : SquarefreeIndex ι) : permute (1 : Equiv.Perm ι) a = a := by + apply Subtype.ext + ext i + rfl + +omit [Fintype ι] in +theorem SquarefreeIndex.permute_mul (e f : Equiv.Perm ι) (a : SquarefreeIndex ι) : + permute (e * f) a = permute e (permute f a) := by + apply Subtype.ext + ext i + rfl + +theorem squarefreePermute_one (x : SquarefreePolynomial ι L) : + squarefreePermute (1 : Equiv.Perm ι) x = x := by + apply squarefreePolynomialEquiv.injective + ext a + rw [squarefreePermute_coefficient] + apply congrArg (squarefreePolynomialEquiv x) + exact SquarefreeIndex.permute_one a + +theorem squarefreePermute_mul (e f : Equiv.Perm ι) (x : SquarefreePolynomial ι L) : + squarefreePermute (e * f) x = squarefreePermute e (squarefreePermute f x) := by + apply squarefreePolynomialEquiv.injective + ext a + rw [squarefreePermute_coefficient, squarefreePermute_coefficient, squarefreePermute_coefficient] + apply congrArg (squarefreePolynomialEquiv x) + apply Subtype.ext + ext i + rfl + +namespace MultidegreeLieFiltration + +variable {σ : Type*} [Fintype σ] {s : ℕ} {bound : σ → ℕ} + (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem squarefreeBlockPermute_one (x : F.SquarefreeAlgebra π) : + F.squarefreeBlockPermute π 1 (fun _ => rfl) x = x := + Subtype.ext (squarefreePermute_one x.val) + +theorem squarefreeBlockPermute_mul (e f : Equiv.Perm ι) + (he : ∀ i, π (e i) = π i) (hf : ∀ i, π (f i) = π i) + (x : F.SquarefreeAlgebra π) : + F.squarefreeBlockPermute π (e * f) (fun i => (he (f i)).trans (hf i)) x = + F.squarefreeBlockPermute π e he (F.squarefreeBlockPermute π f hf x) := + Subtype.ext (squarefreePermute_mul e f x.val) + +end MultidegreeLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem squarefreeBlockPermute_mem_degree (e : ι ≃ ι) (he : ∀ i, π (e i) = π i) + (n : ℕ) (x : F.SquarefreeAlgebra π) : + F.squarefreeBlockPermute π e he x ∈ F.squarefreeDegreeLayer π n ↔ + x ∈ F.squarefreeDegreeLayer π n := by + apply squarefreePermute_mem_support_iff + intro a + rw [SquarefreeIndex.permute_total] + +theorem squarefreeBlockPermute_mem_multidegree (e : ι ≃ ι) (he : ∀ i, π (e i) = π i) + (c : ι → ℕ) (x : F.SquarefreeAlgebra π) : + F.squarefreeBlockPermute π e he x ∈ F.squarefreeMultidegreeLayer π (fun i => c (e.symm i)) ↔ + x ∈ F.squarefreeMultidegreeLayer π c := by + exact squarefreePermute_mem_support_iff e _ _ + (fun a => SquarefreeIndex.permutedBound_le_iff e c a) x.val + +theorem squarefreeBlockPermute_mem_topDegree (e : ι ≃ ι) (he : ∀ i, π (e i) = π i) + (x : F.SquarefreeAlgebra π) : + F.squarefreeBlockPermute π e he x ∈ F.squarefreeMultidegreeLayer π (fun _ => 1) ↔ + x ∈ F.squarefreeMultidegreeLayer π (fun _ => 1) := + F.squarefreeBlockPermute_mem_multidegree π e he (fun _ => 1) x + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeQuotientAction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeQuotientAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1fc25061c9d3710cce1a59fe1bdbee267a1c206 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeQuotientAction.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Estimates.SquarefreeRealAction + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open NilpotentLieBCHGroup + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) (p : ℝ) (B : ℕ) (hB : 0 < B) + (hstable : M.SquarefreeGridStable p B) + +noncomputable def squarefreeSpacePermute (e : ReplicatedPermutation bound) : + (M.squarefreeModel p B hB hstable).Space → (M.squarefreeModel p B hB hstable).Space := + cosetMap _ _ (M.squarefreeRealPermute p B hB hstable e) + (M.squarefreeRealPermute_lattice p B hB hstable e) + +theorem squarefreeSpacePermute_mk (e : ReplicatedPermutation bound) + (g : (M.squarefreeModel p B hB hstable).RealGroup) : + M.squarefreeSpacePermute p B hB hstable e (QuotientGroup.mk g) = + QuotientGroup.mk (M.squarefreeRealPermute p B hB hstable e g) := rfl + +theorem squarefreeSpacePermute_one (x : (M.squarefreeModel p B hB hstable).Space) : + M.squarefreeSpacePermute p B hB hstable 1 x = x := by + induction x using Quotient.inductionOn with + | h g => rw [M.squarefreeSpacePermute_mk, M.squarefreeRealPermute_one] + +theorem squarefreeSpacePermute_mul (e f : ReplicatedPermutation bound) + (x : (M.squarefreeModel p B hB hstable).Space) : + M.squarefreeSpacePermute p B hB hstable (e * f) x = + M.squarefreeSpacePermute p B hB hstable e (M.squarefreeSpacePermute p B hB hstable f x) := by + induction x using Quotient.inductionOn with + | h g => + rw [M.squarefreeSpacePermute_mk, M.squarefreeSpacePermute_mk, + M.squarefreeSpacePermute_mk, M.squarefreeRealPermute_mul] + +@[instance_reducible] +noncomputable def squarefreeSpaceAction : + MulAction (ReplicatedPermutation bound) (M.squarefreeModel p B hB hstable).Space where + smul := M.squarefreeSpacePermute p B hB hstable + one_smul := M.squarefreeSpacePermute_one p B hB hstable + mul_smul := M.squarefreeSpacePermute_mul p B hB hstable + +theorem squarefreeSpacePermute_smul (e : ReplicatedPermutation bound) + (g : (M.squarefreeModel p B hB hstable).RealGroup) + (x : (M.squarefreeModel p B hB hstable).Space) : + M.squarefreeSpacePermute p B hB hstable e (g • x) = + M.squarefreeRealPermute p B hB hstable e g • M.squarefreeSpacePermute p B hB hstable e x := + cosetMap_smul _ _ _ _ _ _ + +theorem squarefreeSpacePermute_commutes_top (e : ReplicatedPermutation bound) + (g : (M.squarefreeModel p B hB hstable).RealGroup) + (hg : g ∈ (M.squarefreeModel p B hB hstable).filtration.realification.subgroup + (Fintype.card (ReplicatedIndex bound))) (x : (M.squarefreeModel p B hB hstable).Space) : + M.squarefreeSpacePermute p B hB hstable e (g • x) = + g • M.squarefreeSpacePermute p B hB hstable e x := by + rw [M.squarefreeSpacePermute_smul, M.squarefreeRealPermute_top p B hB hstable e g hg] + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeRealAction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeRealAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..9073f21b1522afd12fedbbf9277faae7fed7cf3c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeRealAction.lean @@ -0,0 +1,545 @@ +import Mathlib.Algebra.Lie.Prod +import Mathlib.LinearAlgebra.Basis.Prod +import OAI.Combinatorics.Progressions.Dynamics.SquarefreeModelBudget +import OAI.Combinatorics.Progressions.Estimates.RealificationFixedSubmodule +import OAI.Combinatorics.Progressions.Lattices.NativeSquarefreeLattice +import OAI.Combinatorics.Progressions.Linear.ComparisonBasisBudget +import OAI.Combinatorics.Progressions.Nilpotent.BlockLayerBracket + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +noncomputable def comparisonGraph (a : σ → ℕ) (ha : a ≠ 0) : + F.layer a →ₗ[ℚ] (L × F.SquarefreeAlgebra π) := + (F.layer a).subtype.prod (F.blockLayerMap π a ha) + +theorem comparisonGraph_apply (a : σ → ℕ) (ha : a ≠ 0) (x : F.layer a) : + F.comparisonGraph π a ha x = (x.val, F.blockLayerMap π a ha x) := rfl + +theorem comparisonGraph_mem_degree (a : σ → ℕ) (ha : a ≠ 0) (x : F.layer a) + (n : ℕ) (hn : n ≤ ∑ i, a i) : + F.comparisonGraph π a ha x ∈ (F.ordinary.layer n).prod (F.squarefreeDegreeLayer π n) := + ⟨F.ordinary.antitone hn (F.layer_le_ordinary a x.property), + F.squarefreeDegreeLayer_antitone π hn (F.blockLayerMap_mem_degree π a ha x)⟩ + +theorem comparisonGraph_lie (a b : σ → ℕ) (ha : a ≠ 0) (hb : b ≠ 0) (hab : a + b ≠ 0) + (x : F.layer a) (y : F.layer b) : + ⁅F.comparisonGraph π a ha x, F.comparisonGraph π b hb y⁆ = + F.comparisonGraph π (a + b) hab ⟨⁅x.val, y.val⁆, F.lie_mem x.property y.property⟩ := + Prod.ext rfl (F.blockLayerMap_lie π a b ha hb hab x y) + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +noncomputable def comparisonGraphLayer (n : ℕ) : Submodule ℚ (L × F.SquarefreeAlgebra π) := by + classical + exact ⨆ a : {a : σ → ℕ // a ≠ 0}, + if n ≤ ∑ i, a.val i then LinearMap.range (F.comparisonGraph π a.val a.property) else ⊥ + +theorem comparisonGraph_mem_graphLayer (n : ℕ) (a : σ → ℕ) (ha : a ≠ 0) + (hn : n ≤ ∑ i, a i) (x : F.layer a) : + F.comparisonGraph π a ha x ∈ F.comparisonGraphLayer π n := by + classical + have hle : LinearMap.range (F.comparisonGraph π a ha) ≤ F.comparisonGraphLayer π n := by + unfold comparisonGraphLayer + apply le_iSup_of_le (⟨a, ha⟩ : {a : σ → ℕ // a ≠ 0}) + rw [ite_eq_left hn] + exact hle ⟨x, rfl⟩ + +theorem comparisonGraphLayer_induction (n : ℕ) {P : L × F.SquarefreeAlgebra π → Prop} + {x : L × F.SquarefreeAlgebra π} (hx : x ∈ F.comparisonGraphLayer π n) + (hgraph : ∀ (a : σ → ℕ) (ha : a ≠ 0), n ≤ ∑ i, a i → + ∀ y : F.layer a, P (F.comparisonGraph π a ha y)) + (hzero : P 0) (hadd : ∀ x y, P x → P y → P (x + y)) : P x := by + classical + refine Submodule.iSup_induction (motive := P) _ hx ?_ hzero hadd + intro a y hy + by_cases hn : n ≤ ∑ i, a.val i + · rw [ite_eq_left hn] at hy + obtain ⟨z, rfl⟩ := hy + exact hgraph a.val a.property hn z + · rw [ite_eq_right hn, Submodule.mem_bot] at hy + simpa only [hy] using hzero + +theorem comparisonGraphLayer_antitone : Antitone (F.comparisonGraphLayer π) := by + intro n m hnm x hx + apply F.comparisonGraphLayer_induction π m hx + · intro a ha hm y + exact F.comparisonGraph_mem_graphLayer π n a ha (hnm.trans hm) y + · exact Submodule.zero_mem _ + · intro x y hx hy + exact Submodule.add_mem _ hx hy + +theorem comparisonGraphLayer_le_degree (n : ℕ) : + F.comparisonGraphLayer π n ≤ (F.ordinary.layer n).prod (F.squarefreeDegreeLayer π n) := by + intro x hx + apply F.comparisonGraphLayer_induction π n hx + · intro a ha hn y + exact F.comparisonGraph_mem_degree π a ha y n hn + · exact Submodule.zero_mem _ + · intro x y hx hy + exact Submodule.add_mem _ hx hy + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +noncomputable def comparisonLayer (n : ℕ) : Submodule ℚ (L × F.SquarefreeAlgebra π) := + F.comparisonProductLayer π (n + 1) ⊔ F.comparisonGraphLayer π n + +theorem comparisonLayer_antitone : Antitone (F.comparisonLayer π) := by + intro n m h + exact sup_le_sup (F.comparisonProductLayer_antitone π (Nat.add_le_add_right h 1)) + (F.comparisonGraphLayer_antitone π h) + +theorem comparisonLayer_le_product (n : ℕ) : + F.comparisonLayer π n ≤ F.comparisonProductLayer π n := + sup_le (F.comparisonProductLayer_antitone π (Nat.le_succ n)) (F.comparisonGraphLayer_le_degree π n) + +theorem comparisonLayer_zero : F.comparisonLayer π 0 = ⊤ := by + rw [comparisonLayer, zero_add, F.comparisonProductLayer_one, top_sup_eq] + +theorem comparisonLayer_terminal : F.comparisonLayer π (max s (Fintype.card ι) + 1) = ⊥ := by + apply bot_unique + exact (F.comparisonLayer_le_product π _).trans (F.comparisonProductLayer_terminal π).le + +theorem comparisonGraph_mem_layer (n : ℕ) (a : σ → ℕ) (ha : a ≠ 0) + (hn : n ≤ ∑ i, a i) (x : F.layer a) : + F.comparisonGraph π a ha x ∈ F.comparisonLayer π n := + (le_sup_right : F.comparisonGraphLayer π n ≤ F.comparisonLayer π n) + (F.comparisonGraph_mem_graphLayer π n a ha hn x) + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3 + +open Module +open scoped BigOperators + +theorem map_mem_submodule_of_basis {κ V W : Type*} [Fintype κ] + [AddCommGroup V] [Module ℚ V] [AddCommGroup W] [Module ℚ W] + (b : Basis κ ℚ V) (f : V →ₗ[ℚ] W) (P : Submodule ℚ W) + (h : ∀ i, f (b i) ∈ P) (x : V) : f x ∈ P := by + rw [← b.sum_repr x, map_sum] + apply Submodule.sum_mem + intro i _ + rw [map_smul] + exact P.smul_mem _ (h i) + +namespace MultidegreeLieFiltration + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem comparisonLayer_le_of_generators (n : ℕ) (P : Submodule ℚ (L × F.SquarefreeAlgebra π)) + (hfirst : ∀ x ∈ F.ordinary.layer (n + 1), (x, 0) ∈ P) + (hsecond : ∀ y ∈ F.squarefreeDegreeLayer π (n + 1), (0, y) ∈ P) + (hgraph : ∀ (a : σ → ℕ) (ha : a ≠ 0), a ≤ bound → n ≤ ∑ i, a i → + ∀ x : F.layer a, F.comparisonGraph π a ha x ∈ P) : + F.comparisonLayer π n ≤ P := by + intro z hz + obtain ⟨u, hu, v, hv, rfl⟩ := Submodule.mem_sup.mp hz + apply P.add_mem + · simpa only [Prod.mk_add_mk, add_zero, zero_add] using + P.add_mem (hfirst u.1 hu.1) (hsecond u.2 hu.2) + · refine F.comparisonGraphLayer_induction π n (P := fun v => v ∈ P) hv ?_ P.zero_mem ?_ + · intro a ha hn x + by_cases hab : a ≤ bound + · exact hgraph a ha hab hn x + · have hx : x = 0 := by + apply Subtype.ext + exact (Submodule.mem_bot ℚ).mp (F.terminal a hab ▸ x.property) + rw [hx, map_zero] + exact P.zero_mem + · exact fun x y hx hy => P.add_mem hx hy + +end MultidegreeLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +noncomputable def squarefreeFinBasis (p : ℝ) : Basis (Fin (Fintype.card M.SquarefreeBasisIndex)) ℚ + (M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1)) := + (M.squarefreeBasis p).reindex (Fintype.equivFin M.SquarefreeBasisIndex) + +theorem squarefreeFinBasis_structure_height {p : ℝ} (hM : M.ComplexityLE p) (i j k) : + RationalHeightLE (lieStructureConstants (M.squarefreeFinBasis p) i j k) + (squarefreeStructureHeight d ⌈Real.exp p⌉₊) := by + rw [squarefreeFinBasis, lieStructureConstants_reindex] + exact M.squarefreeBasis_structure_height hM _ _ _ + +theorem squarefreeFinBasis_multidegree_height (p : ℝ) (c : ReplicatedIndex bound → ℕ) (j k) : + RationalHeightLE ((M.squarefreeFinBasis p).repr + (M.filtration.squarefreeMultidegreeBasis (fun j : ReplicatedIndex bound => j.1) + (M.squarefreeCoefficientBasis p) c j).val k) 1 := by + rw [squarefreeFinBasis, Basis.repr_reindex_apply] + exact M.filtration.squarefreeMultidegreeBasis_height _ (M.squarefreeCoefficientBasis p) c j _ + +theorem squarefreeFinBasis_degree_height (p : ℝ) (n : ℕ) (j k) : + RationalHeightLE ((M.squarefreeFinBasis p).repr + (M.filtration.squarefreeDegreeBasis (fun j : ReplicatedIndex bound => j.1) + (M.squarefreeCoefficientBasis p) n j).val k) 1 := by + rw [squarefreeFinBasis, Basis.repr_reindex_apply] + exact M.filtration.squarefreeDegreeBasis_height _ (M.squarefreeCoefficientBasis p) n j _ + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +theorem blockLayerMap_chosen_height (p : ℝ) (a : σ → ℕ) (ha : a ≠ 0) + (j : Fin (finrank ℚ (M.filtration.layer a))) (k : M.SquarefreeBasisIndex) : + RationalHeightLE ((M.squarefreeBasis p).repr + (M.filtration.blockLayerMap (fun i : ReplicatedIndex bound => i.1) a ha + (M.comparisonLayerBasis p a j)) k) (multidegreeFactorial a) := by + classical + let : FiniteDimensional ℚ L := D.basis.finiteDimensional_of_finite + let π := fun i : ReplicatedIndex bound => i.1 + let v := M.filtration.squarefreeAlgebraEquiv π + (M.filtration.blockLayerMap π a ha (M.comparisonLayerBasis p a j)) k.1 + change RationalHeightLE + ((chosenBoundedSubmoduleBasis D.basis ⌈Real.exp p⌉₊ + (M.filtration.squarefreeCoefficientLayer π k.1)).repr v k.2) _ + by_cases hka : blockDegree π k.1.val = a + · have hk : k.1.val ≠ 0 := by + intro h + apply ha + rw [h, blockDegree_zero] at hka + exact hka.symm + have hUV : M.filtration.layer a = M.filtration.squarefreeCoefficientLayer π k.1 := by + simp only [MultidegreeLieFiltration.squarefreeCoefficientLayer, ite_eq_right hk, hka] + have hq : RationalHeightLE (multidegreeFactorial a : ℚ) (multidegreeFactorial a) := by + constructor + · simp + · simpa using Nat.succ_le_of_lt (multidegreeFactorial_pos a) + apply chosenBasis_smul_coordinate_height D.basis ⌈Real.exp p⌉₊ + (M.filtration.layer a) (M.filtration.squarefreeCoefficientLayer π k.1) + hUV j v (multidegreeFactorial a) hq + change squarefreePolynomialEquiv + (M.filtration.blockLayerMap π a ha (M.comparisonLayerBasis p a j)).val k.1 = _ + rw [M.filtration.blockLayerMap_coe, factorialBlockMonomial_coefficient, ite_eq_left hka] + rfl + · have hv : v = 0 := by + apply Subtype.ext + change squarefreePolynomialEquiv + (M.filtration.blockLayerMap π a ha (M.comparisonLayerBasis p a j)).val k.1 = 0 + rw [M.filtration.blockLayerMap_coe, factorialBlockMonomial_coefficient, ite_eq_right hka] + rw [hv, map_zero, Finsupp.zero_apply] + exact rationalHeightLE_zero (multidegreeFactorial_pos a) + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +theorem comparisonGraph_chosen_height {p : ℝ} (hM : M.ComplexityLE p) + (a : σ → ℕ) (ha : a ≠ 0) (hab : a ≤ bound) + (j : Fin (finrank ℚ (M.filtration.layer a))) + (k : Fin d ⊕ Fin (Fintype.card M.SquarefreeBasisIndex)) : + RationalHeightLE ((D.basis.prod (M.squarefreeFinBasis p)).repr + (M.filtration.comparisonGraph (fun i : ReplicatedIndex bound => i.1) a ha + (M.comparisonLayerBasis p a j)) k) (comparisonBasisHeight bound p) := by + cases k with + | inl k => + exact (M.comparisonLayerBasis_height hM a hab j k).mono + (comparisonBasisHeight_ge_ceil bound p) + | inr k => + change RationalHeightLE ((M.squarefreeFinBasis p).repr + (M.filtration.blockLayerMap (fun i : ReplicatedIndex bound => i.1) a ha + (M.comparisonLayerBasis p a j)) k) _ + rw [squarefreeFinBasis, Basis.repr_reindex_apply] + exact (M.blockLayerMap_chosen_height p a ha j _).mono + ((multidegreeFactorial_mono hab).trans (comparisonBasisHeight_ge_factorial bound p)) + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +noncomputable def squarefreeModel (p : ℝ) (B : ℕ) (hB : 0 < B) (hstable : M.SquarefreeGridStable p B) : + RationalFilteredNilmanifold (M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1)) + (Fintype.card (ReplicatedIndex bound)) (Fintype.card M.SquarefreeBasisIndex) where + filtration := M.filtration.squarefreeOrdinaryFiltration (fun j : ReplicatedIndex bound => j.1) + basis := M.squarefreeFinBasis p + layerBasis i := M.filtration.squarefreeDegreeBasis (fun j : ReplicatedIndex bound => j.1) + (M.squarefreeCoefficientBasis p) (i.val + 1) + lattice := M.squarefreeLattice p B hstable + grid := B + grid_pos := hB + inner_grid := by + apply bchSubgroup_inner_grid_reindex + rw [M.squarefreeLattice_coordinates] + outer_grid := by + apply bchSubgroup_outer_grid_reindex + rw [M.squarefreeLattice_coordinates] + exact fun _ hx => scaledIntegerGrid_mem_denominatorGrid B B hx + +noncomputable def squarefreeModelMultidegree (p : ℝ) (B : ℕ) (hB : 0 < B) + (hstable : M.SquarefreeGridStable p B) : + (M.squarefreeModel p B hB hstable).MultidegreeStructure (fun _ : ReplicatedIndex bound => 1) where + filtration := M.filtration.squarefreeMultidegreeFiltration (fun j : ReplicatedIndex bound => j.1) + ordinary := rfl + basis a := M.filtration.squarefreeMultidegreeBasis (fun j : ReplicatedIndex bound => j.1) + (M.squarefreeCoefficientBasis p) (fun j => (a j).val) + +theorem squarefreeModel_complexity {p q : ℝ} (hM : M.ComplexityLE p) (B : ℕ) (hB : 0 < B) + (hstable : M.SquarefreeGridStable p B) (hq : 0 ≤ q) + (hd : (Fintype.card M.SquarefreeBasisIndex : ℝ) ≤ q) (hBq : (B : ℝ) ≤ Real.exp q) + (hHq : (squarefreeStructureHeight d ⌈Real.exp p⌉₊ : ℝ) ≤ Real.exp q) : + (M.squarefreeModelMultidegree p B hB hstable).ComplexityLE q := by + have hone : ((1 : ℕ) : ℝ) ≤ Real.exp q := by + rw [Nat.cast_one] + exact Real.one_le_exp_iff.mpr hq + refine ⟨⟨hd, hBq, ?_, ?_⟩, ?_⟩ + · intro i j k + exact rationalLogHeight_le_of_height (M.squarefreeFinBasis_structure_height hM i j k) hHq + · intro i j k + exact rationalLogHeight_le_of_height (M.squarefreeFinBasis_degree_height p (i.val + 1) j k) hone + · intro a j k + exact rationalLogHeight_le_of_height + (M.squarefreeFinBasis_multidegree_height p (fun i => (a i).val) j k) hone + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +theorem exists_comparison_layer_basis_height {p : ℝ} (hM : M.ComplexityLE p) (n : ℕ) : + ∃ b : Basis (Fin (finrank ℚ + (M.filtration.comparisonLayer (fun i : ReplicatedIndex bound => i.1) n))) ℚ + (M.filtration.comparisonLayer (fun i : ReplicatedIndex bound => i.1) n), + ∀ j k, RationalHeightLE + ((D.basis.prod (M.squarefreeFinBasis p)).repr (b j).val k) + (comparisonBasisHeight bound p) := by + classical + let π := fun i : ReplicatedIndex bound => i.1 + let A := M.filtration.SquarefreeAlgebra π + let e := D.basis.prod (M.squarefreeFinBasis p) + let U := M.filtration.comparisonLayer π n + let S : Set (L × A) := {z | z ∈ U ∧ ∀ k, + RationalHeightLE (e.repr z k) (comparisonBasisHeight bound p)} + have hpos := comparisonBasisHeight_pos bound p + have hspan : Submodule.span ℚ S = U := by + apply le_antisymm + · exact Submodule.span_le.mpr (fun z hz => hz.1) + · apply M.filtration.comparisonLayer_le_of_generators π n + · intro x hx + obtain ⟨b, hb⟩ : ∃ b : Basis + (Fin (finrank ℚ (M.filtration.ordinary.layer (n + 1)))) ℚ + (M.filtration.ordinary.layer (n + 1)), + ∀ j k, rationalLogHeight (D.basis.repr (b j).val k) ≤ p := by + rw [M.ordinary] + exact D.exists_positive_layer_basis (n + 1) (by omega) hM.1 + let f := (LinearMap.inl ℚ L A).comp (M.filtration.ordinary.layer (n + 1)).subtype + apply map_mem_submodule_of_basis b f (Submodule.span ℚ S) _ ⟨x, hx⟩ + intro j + apply Submodule.subset_span + refine ⟨?_, ?_⟩ + · exact (le_sup_left : M.filtration.comparisonProductLayer π (n + 1) ≤ U) + ⟨(b j).property, Submodule.zero_mem _⟩ + · intro k + cases k with + | inl k => + exact (rationalHeightLE_ceil_exp (hb j k)).mono + (comparisonBasisHeight_ge_ceil bound p) + | inr k => + change RationalHeightLE ((M.squarefreeFinBasis p).repr 0 k) _ + simpa only [map_zero, Finsupp.zero_apply] using rationalHeightLE_zero hpos + · intro y hy + let b := M.filtration.squarefreeDegreeBasis π (M.squarefreeCoefficientBasis p) (n + 1) + let f := (LinearMap.inr ℚ L A).comp (M.filtration.squarefreeDegreeLayer π (n + 1)).subtype + apply map_mem_submodule_of_basis b f (Submodule.span ℚ S) _ ⟨y, hy⟩ + intro j + apply Submodule.subset_span + refine ⟨?_, ?_⟩ + · exact (le_sup_left : M.filtration.comparisonProductLayer π (n + 1) ≤ U) + ⟨Submodule.zero_mem _, (b j).property⟩ + · intro k + cases k with + | inl k => + change RationalHeightLE (D.basis.repr 0 k) _ + simpa only [map_zero, Finsupp.zero_apply] using rationalHeightLE_zero hpos + | inr k => + exact (M.squarefreeFinBasis_degree_height p (n + 1) j k).mono hpos + · intro a ha hab hn x + apply map_mem_submodule_of_basis (M.comparisonLayerBasis p a) + (M.filtration.comparisonGraph π a ha) (Submodule.span ℚ S) _ x + intro j + exact Submodule.subset_span + ⟨M.filtration.comparisonGraph_mem_layer π n a ha hn _, + M.comparisonGraph_chosen_height hM a ha hab j⟩ + have hrange : Set.range (Subtype.val : S → L × A) = S := by + ext z + simp only [Subtype.range_coe_subtype, Set.mem_ofPred_eq] + exact exists_bounded_submodule_basis_from_spanning e U + (Subtype.val : S → L × A) (by rw [hrange]; exact hspan) (fun z => z.property.2) + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open scoped BigOperators + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +theorem exists_controlled_squarefree_model {p : ℝ} (hM : M.ComplexityLE p) + (l : ℕ) (hl : 0 < l) (hlp : (l : ℝ) ≤ Real.exp p) : + ∃ (B : ℕ) (hB : 0 < B) (hstable : M.SquarefreeGridStable p B), l ∣ B ∧ + (M.squarefreeModelMultidegree p B hB hstable).ComplexityLE + (squarefreeModelBudget (∑ i, bound i) p) := by + have hp : 0 ≤ p := (Nat.cast_nonneg d).trans hM.1.1 + obtain ⟨B, hB, hdiv, hraw, hstable⟩ := M.exists_squarefree_stable_grid hM l hl + rw [replicatedIndex_card] at hraw + refine ⟨B, hB, hstable, hdiv, ?_⟩ + have hq := squarefreeInputBudget_nonneg (∑ i, bound i) hp + have hqq := squarefreeInputBudget_le_model (∑ i, bound i) hp + have hdq : (Fintype.card M.SquarefreeBasisIndex : ℝ) ≤ squarefreeInputBudget (∑ i, bound i) p := by + calc + _ ≤ (2 : ℝ) ^ (∑ i, bound i) * d := by exact_mod_cast M.squarefreeBasisIndex_card_le p + _ ≤ (2 : ℝ) ^ (∑ i, bound i) * p := mul_le_mul_of_nonneg_left hM.1.1 (by positivity) + _ ≤ _ := le_add_of_nonneg_right (by positivity) + apply M.squarefreeModel_complexity hM B hB hstable (hq.trans hqq) (hdq.trans hqq) + · exact squarefree_grid_budget _ _ d l B hp hM.1.1 (M.squarefreeBasisIndex_card_le p) hlp hraw + · exact (squarefreeStructureHeight_ceil_exp d hp hM.1.1).trans + (Real.exp_le_exp.mpr ((le_add_of_nonneg_left (mul_nonneg (by positivity) hp)).trans hqq)) + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open NilpotentLieBCHGroup +open scoped TensorProduct + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) (p : ℝ) (B : ℕ) (hB : 0 < B) + (hstable : M.SquarefreeGridStable p B) + +noncomputable def squarefreeRealPermute (e : ReplicatedPermutation bound) : + (M.squarefreeModel p B hB hstable).RealGroup →* + (M.squarefreeModel p B hB hstable).RealGroup := + realificationMap + (hnil := (M.squarefreeModel p B hB hstable).filtration.lowerCentralSeries_eq_bot) + (hM := (M.squarefreeModel p B hB hstable).filtration.lowerCentralSeries_eq_bot) + (M.filtration.replicatedLiePermute e).toLieHom + +theorem squarefreeRealPermute_one (g : (M.squarefreeModel p B hB hstable).RealGroup) : + M.squarefreeRealPermute p B hB hstable 1 g = g := by + apply NilpotentLieBCHGroup.ext + exact realificationLieHom_eq_self _ M.filtration.replicatedLiePermute_one g.coord + +theorem squarefreeRealPermute_mul (e f : ReplicatedPermutation bound) + (g : (M.squarefreeModel p B hB hstable).RealGroup) : + M.squarefreeRealPermute p B hB hstable (e * f) g = + M.squarefreeRealPermute p B hB hstable e (M.squarefreeRealPermute p B hB hstable f g) := by + apply NilpotentLieBCHGroup.ext + exact realificationLieHom_comp_apply _ _ _ (M.filtration.replicatedLiePermute_mul e f) g.coord + +theorem squarefreeRealPermute_lattice (e : ReplicatedPermutation bound) : + (M.squarefreeModel p B hB hstable).realLattice ≤ + (M.squarefreeModel p B hB hstable).realLattice.comap + (M.squarefreeRealPermute p B hB hstable e) := by + apply realificationMap_subgroup + intro g hg + exact (M.squarefreeLattice_permute p B hstable (replicatedPermutation bound e) + (replicatedPermutation_block bound e) g).mpr hg + +theorem squarefreeRealPermute_top (e : ReplicatedPermutation bound) + (g : (M.squarefreeModel p B hB hstable).RealGroup) + (hg : g ∈ (M.squarefreeModel p B hB hstable).filtration.realification.subgroup + (Fintype.card (ReplicatedIndex bound))) : + M.squarefreeRealPermute p B hB hstable e g = g := by + apply NilpotentLieBCHGroup.ext + exact realificationLieHom_eq_self_on _ _ + (M.filtration.replicatedLiePermute_ordinary_top e) g.coord hg + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeSplitCount.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeSplitCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9535f0aba6c6a997efa4c220774f1a4609889ab --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeSplitCount.lean @@ -0,0 +1,343 @@ +import Mathlib.Algebra.MvPolynomial.Degrees +import Mathlib.Data.Nat.Choose.Basic +import Mathlib.Tactic +import OAI.Combinatorics.Progressions.Estimates.BlockSubsetCount +import OAI.Combinatorics.Progressions.Nilpotent.SquarefreeBracketCoefficients +import OAI.Combinatorics.Progressions.Polynomial.SquarefreeBlockDegree + +namespace OAI + +section + +namespace Erdos3 + +variable {ι σ : Type*} [Fintype ι] + +noncomputable def SquarefreeIndex.ofFinset (S : Finset ι) : SquarefreeIndex ι := by + classical + exact ⟨Finsupp.equivFunOnFinite.symm (fun i => if i ∈ S then 1 else 0), + fun i => by + change (if i ∈ S then 1 else 0) ≤ 1 + split_ifs <;> omega⟩ + +theorem SquarefreeIndex.ofFinset_apply [DecidableEq ι] (S : Finset ι) (i : ι) : + (ofFinset S).val i = if i ∈ S then 1 else 0 := by + classical + simp [ofFinset] + +theorem SquarefreeIndex.support_ofFinset (S : Finset ι) : (ofFinset S).val.support = S := by + classical + ext i + simp only [Finsupp.mem_support_iff, ofFinset_apply] + split_ifs <;> simp_all + +theorem SquarefreeIndex.ofFinset_support (a : SquarefreeIndex ι) : ofFinset a.val.support = a := by + classical + apply Subtype.ext + ext i + rw [ofFinset_apply] + have hi := a.property i + split_ifs with h + · have := Finsupp.mem_support_iff.mp h + omega + · exact (Finsupp.notMem_support_iff.mp h).symm + +theorem SquarefreeIndex.ofFinset_add_complement [DecidableEq ι] (S T : Finset ι) (hST : S ⊆ T) : + (ofFinset S).val + (ofFinset (T \ S)).val = (ofFinset T).val := by + classical + ext i + simp only [Finsupp.add_apply, ofFinset_apply, Finset.mem_sdiff] + by_cases hi : i ∈ S + · simp only [hi, hST hi, not_true_eq_false, and_false, ite_true, ite_false, add_zero] + · by_cases hj : i ∈ T <;> simp [hi, hj] + +theorem SquarefreeIndex.blockDegree_ofFinset [DecidableEq σ] (π : ι → σ) + (S : Finset ι) (i : σ) : + blockDegree π (ofFinset S).val i = (S.filter fun j => π j = i).card := by + classical + rw [blockDegree_apply] + simp only [ofFinset_apply] + have h : (fun j => if π j = i then (if j ∈ S then 1 else 0) else 0) = + (fun j => if j ∈ S ∧ π j = i then 1 else 0) := by + funext j + split_ifs <;> simp_all + rw [h] + have hs : (Finset.univ.filter fun j => j ∈ S ∧ π j = i) = + S.filter (fun j => π j = i) := by ext j; simp + simpa only [Finset.sum_boole, Nat.cast_id] using congrArg Finset.card hs + +theorem SquarefreeIndex.blockDegree_support [DecidableEq σ] (π : ι → σ) + (a : SquarefreeIndex ι) (i : σ) : + blockDegree π a.val i = (a.val.support.filter fun j => π j = i).card := by + rw [← blockDegree_ofFinset π a.val.support i, ofFinset_support] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def fullShiftExponent (n : ℕ) : Fin n →₀ ℕ := + (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin n))).val + +theorem fullShiftExponent_apply (n : ℕ) (i : Fin n) : fullShiftExponent n i = 1 := by + simp only [fullShiftExponent, SquarefreeIndex.ofFinset_apply, Finset.mem_univ, ite_true] + +theorem fullShiftExponent_sum (n : ℕ) : (fullShiftExponent n).sum (fun _ e => e) = n := by + rw [Finsupp.sum_fintype _ _ (fun _ => rfl)] + simp only [fullShiftExponent_apply, Finset.sum_const, Finset.card_univ, Fintype.card_fin, + smul_eq_mul, mul_one] + +theorem exponent_eq_full_or_missing {n : ℕ} (d : Fin n →₀ ℕ) + (hd : d.sum (fun _ e => e) ≤ n) : d = fullShiftExponent n ∨ ∃ i, d i = 0 := by + by_cases hz : ∃ i, d i = 0 + · exact Or.inr hz + left + have hpos (i : Fin n) : 1 ≤ d i := by + have hn : d i ≠ 0 := fun hi => hz ⟨i, hi⟩ + omega + have hsum : (∑ i, d i) ≤ n := by + rwa [Finsupp.sum_fintype _ _ (fun _ => rfl)] at hd + ext i + rw [fullShiftExponent_apply] + by_contra hi + have hstrict : (1 : ℕ) < d i := by have := hpos i; omega + have hlt := Finset.sum_lt_sum (s := Finset.univ) (fun j _ => hpos j) + ⟨i, Finset.mem_univ i, hstrict⟩ + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul, mul_one] at hlt + omega + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {ι σ : Type*} [Fintype ι] + +omit [Fintype ι] in +theorem SquarefreeIndex.support_subset_of_add (a b c : SquarefreeIndex ι) + (h : a.val + b.val = c.val) : a.val.support ⊆ c.val.support := by + intro i hi + apply Finsupp.mem_support_iff.mpr + have ha := Finsupp.mem_support_iff.mp hi + have hs := congrArg (fun u : ι →₀ ℕ => u i) h + simp only [Finsupp.add_apply] at hs + omega + +abbrev SquarefreeSplit (π : ι → σ) (c : SquarefreeIndex ι) (a b : σ → ℕ) := + {p : SquarefreeIndex ι × SquarefreeIndex ι // + p.1.val + p.2.val = c.val ∧ blockDegree π p.1.val = a ∧ blockDegree π p.2.val = b} + +theorem squarefreeSplit_ext (π : ι → σ) (c : SquarefreeIndex ι) (a b : σ → ℕ) + (p q : SquarefreeSplit π c a b) (h : p.val.1 = q.val.1) : p = q := by + apply Subtype.ext + apply Prod.ext h + apply Subtype.ext + have hs := p.property.1.trans q.property.1.symm + rw [h] at hs + exact add_left_cancel hs + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι κ σ : Type*} + +def SquarefreeIndex.permute (e : ι ≃ κ) : SquarefreeIndex ι ≃ SquarefreeIndex κ where + toFun a := ⟨Finsupp.equivMapDomain e a.val, fun j => a.property (e.symm j)⟩ + invFun b := ⟨Finsupp.equivMapDomain e.symm b.val, fun i => b.property (e i)⟩ + left_inv a := Subtype.ext ((Finsupp.equivCongrLeft e).left_inv a.val) + right_inv b := Subtype.ext ((Finsupp.equivCongrLeft e).right_inv b.val) + +@[simp] theorem SquarefreeIndex.permute_apply (e : ι ≃ κ) (a : SquarefreeIndex ι) (j : κ) : + (permute e a).val j = a.val (e.symm j) := rfl + +theorem SquarefreeIndex.permute_symm (e : ι ≃ κ) : (permute e).symm = permute e.symm := rfl + +theorem SquarefreeIndex.permute_disjoint (e : ι ≃ κ) (a b : SquarefreeIndex ι) : + Disjoint (permute e a).val.support (permute e b).val.support ↔ + Disjoint a.val.support b.val.support := Finset.disjoint_map e.toEmbedding + +theorem SquarefreeIndex.permute_disjointAdd (e : ι ≃ κ) (a b : SquarefreeIndex ι) + (hab : Disjoint a.val.support b.val.support) : + permute e (a.disjointAdd b hab) = + (permute e a).disjointAdd (permute e b) ((permute_disjoint e a b).mpr hab) := by + apply Subtype.ext + ext j + rfl + +theorem SquarefreeIndex.permute_zero_iff (e : ι ≃ κ) (a : SquarefreeIndex ι) : + (permute e a).val = 0 ↔ a.val = 0 := by + constructor + · intro h + ext i + have hi := congrArg (fun c : κ →₀ ℕ => c (e i)) h + simpa only [permute_apply, Equiv.symm_apply_apply, Finsupp.zero_apply] using hi + · intro h + ext j + simp only [permute_apply, h, Finsupp.zero_apply] + +theorem SquarefreeIndex.permute_total [Fintype ι] [Fintype κ] + (e : ι ≃ κ) (a : SquarefreeIndex ι) : + (∑ j, (permute e a).val j) = ∑ i, a.val i := + Equiv.sum_comp e.symm (fun i => a.val i) + +theorem SquarefreeIndex.permute_blockDegree [Fintype ι] (π : ι → σ) + (e : ι ≃ ι) (he : ∀ i, π (e i) = π i) (a : SquarefreeIndex ι) : + blockDegree π (permute e a).val = blockDegree π a.val := by + classical + ext i + simp only [blockDegree_apply, permute_apply] + calc + (∑ j, if π j = i then a.val (e.symm j) else 0) = + ∑ j, if π (e j) = i then a.val j else 0 := by + simpa only [Equiv.symm_apply_apply] using + (Equiv.sum_comp e (fun j => if π j = i then a.val (e.symm j) else 0)).symm + _ = _ := by simp only [he] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι σ : Type*} [Fintype ι] [Fintype σ] + +noncomputable def blockExponent (π : ι → σ) (a : ι →₀ ℕ) : σ →₀ ℕ := + Finsupp.equivFunOnFinite.symm (blockDegree π a) + +@[simp] theorem blockExponent_apply (π : ι → σ) (a : ι →₀ ℕ) (i : σ) : + blockExponent π a i = blockDegree π a i := rfl + +@[simp] theorem blockExponent_zero (π : ι → σ) : blockExponent π 0 = 0 := by + ext i + simp only [blockExponent_apply, blockDegree_zero, Pi.zero_apply, Finsupp.zero_apply] + +theorem blockExponent_permute (π : ι → σ) (e : Equiv.Perm ι) + (he : ∀ i, π (e i) = π i) (a : SquarefreeIndex ι) : + blockExponent π (SquarefreeIndex.permute e a).val = blockExponent π a.val := by + ext i + simp only [blockExponent_apply, SquarefreeIndex.permute_blockDegree π e he a] + +def multidegreeFactorial (a : σ → ℕ) : ℕ := ∏ i, (a i).factorial + +theorem multidegreeFactorial_pos (a : σ → ℕ) : 0 < multidegreeFactorial a := + Finset.prod_pos fun i _ => Nat.factorial_pos (a i) + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem SquarefreeIndex.permute_weight {ι κ : Type*} (e : ι ≃ κ) + (a : SquarefreeIndex ι) (x : ι → ℚ) : + ((permute e a).val.prod fun j n => x (e.symm j) ^ n) = + a.val.prod (fun i n => x i ^ n) := by + change (Finsupp.equivMapDomain e a.val).prod _ = _ + rw [Finsupp.prod_equivMapDomain] + simp only [Equiv.symm_apply_apply] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {σ : Type*} [Fintype σ] + +def blockSplitMultiplicity (a b : σ → ℕ) : ℕ := ∏ i, (a i + b i).choose (a i) + +theorem multidegreeFactorial_split (a b : σ → ℕ) : + multidegreeFactorial a * multidegreeFactorial b * blockSplitMultiplicity a b = + multidegreeFactorial (a + b) := by + simp only [multidegreeFactorial, blockSplitMultiplicity, ← Finset.prod_mul_distrib, Pi.add_apply] + apply Finset.prod_congr rfl + intro i _ + have h := Nat.add_choose_mul_factorial_mul_factorial (b i) (a i) + rw [Nat.add_comm (b i) (a i)] at h + calc + (a i).factorial * (b i).factorial * (a i + b i).choose (a i) = + (a i + b i).choose (a i) * (b i).factorial * (a i).factorial := by ac_rfl + _ = _ := h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι σ : Type*} [Fintype ι] [Fintype σ] [DecidableEq ι] [DecidableEq σ] + +noncomputable def squarefreeSplitSubsetEquiv (π : ι → σ) (c : SquarefreeIndex ι) + (a b : σ → ℕ) (hc : blockDegree π c.val = a + b) : + SquarefreeSplit π c a b ≃ + {T : Finset ι // T ⊆ c.val.support ∧ ∀ i, (T.filter fun j => π j = i).card = a i} where + toFun p := ⟨p.val.1.val.support, by + refine ⟨SquarefreeIndex.support_subset_of_add _ _ _ p.property.1, ?_⟩ + intro i + rw [← SquarefreeIndex.blockDegree_support π p.val.1 i, p.property.2.1]⟩ + invFun T := by + let u := SquarefreeIndex.ofFinset T.val + let v := SquarefreeIndex.ofFinset (c.val.support \ T.val) + have huv : u.val + v.val = c.val := by + have h := SquarefreeIndex.ofFinset_add_complement T.val c.val.support T.property.1 + simpa only [SquarefreeIndex.ofFinset_support] using h + have hu : blockDegree π u.val = a := by + ext i + exact (SquarefreeIndex.blockDegree_ofFinset π T.val i).trans (T.property.2 i) + have hv : blockDegree π v.val = b := by + have h := congrArg (blockDegree π) huv + rw [blockDegree_add, hu, hc] at h + exact add_left_cancel h + exact ⟨(u, v), huv, hu, hv⟩ + left_inv p := squarefreeSplit_ext π c a b _ _ (SquarefreeIndex.ofFinset_support p.val.1) + right_inv T := Subtype.ext (SquarefreeIndex.support_ofFinset T.val) + +theorem card_squarefreeSplit (π : ι → σ) (c : SquarefreeIndex ι) (a b : σ → ℕ) + (hc : blockDegree π c.val = a + b) : + Fintype.card (SquarefreeSplit π c a b) = blockSplitMultiplicity a b := by + classical + rw [Fintype.card_congr (squarefreeSplitSubsetEquiv π c a b hc), card_blockSubsets] + unfold blockSplitMultiplicity + apply Finset.prod_congr rfl + intro i _ + rw [← SquarefreeIndex.blockDegree_support π c i, hc, Pi.add_apply] + +omit [Fintype σ] [DecidableEq ι] [DecidableEq σ] in +theorem squarefreeSplit_degree (π : ι → σ) (c : SquarefreeIndex ι) (a b : σ → ℕ) + (p : SquarefreeSplit π c a b) : blockDegree π c.val = a + b := by + rw [← p.property.1, blockDegree_add, p.property.2.1, p.property.2.2] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeStructureHeight.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeStructureHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb284552c786423532db84bb02f7869020c95d03 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SquarefreeStructureHeight.lean @@ -0,0 +1,48 @@ +import OAI.Combinatorics.Progressions.Geometry.SubmoduleCoordinateHeight +import OAI.Combinatorics.Progressions.Nilpotent.SquarefreeBracketHeight + +namespace OAI + +section + +namespace Erdos3 + +open Module + +def squarefreeStructureHeight (n H : ℕ) : ℕ := + (n + 1) * (rationalSolveHeight n H * squarefreeBracketHeight n H) ^ n + +namespace MultidegreeLieFiltration + +variable {ι σ ν L : Type*} [Fintype ι] [Fintype σ] [Fintype ν] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + {κ : SquarefreeIndex ι → Type*} [∀ a, Fintype (κ a)] + (b : ∀ a, Basis (κ a) ℚ (F.squarefreeCoefficientLayer π a)) + (e : Basis ν ℚ L) {H : ℕ} (hH : 1 ≤ H) + (hb : ∀ a j k, RationalHeightLE (e.repr (b a j).val k) H) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants e i j k) H) + +include hH hb hc + +theorem squarefreeBasis_structure_height + (hκ : ∀ a, Fintype.card (κ a) ≤ Fintype.card ν) (x y z : Σ a, κ a) : + RationalHeightLE (lieStructureConstants (F.squarefreeBasis π b) x y z) + (squarefreeStructureHeight (Fintype.card ν) H) := by + change RationalHeightLE ((F.squarefreeBasis π b).repr + ⁅F.squarefreeBasis π b x, F.squarefreeBasis π b y⁆ z) _ + rw [F.squarefreeBasis_repr] + have h := submodule_basis_coordinate_height (F.squarefreeCoefficientLayer π z.1) (b z.1) e hH + (fun i j => hb z.1 j i) + (F.squarefreeAlgebraEquiv π ⁅F.squarefreeBasis π b x, F.squarefreeBasis π b y⁆ z.1) + (fun k => F.squarefreeBasis_bracket_coefficient_height π b e hH hb hc x y z.1 k) z.2 + apply h.mono + exact Nat.mul_le_mul_left _ (Nat.pow_le_pow_left + (Nat.mul_le_mul_right _ (rationalSolveHeight_mono hH (hκ z.1))) _) + +end MultidegreeLieFiltration + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/StableReferenceMean.lean b/lean/OAI/Combinatorics/Progressions/Estimates/StableReferenceMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab8dc3b3b3b99124c40cebfa1add3b93fae6a42f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/StableReferenceMean.lean @@ -0,0 +1,186 @@ +import OAI.Combinatorics.Progressions.Lattices.StablePrimeUpperComparison + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem residuePrimeCoordinateCell_lcm_nonempty {ι σ : Type*} [DecidableEq ι] + [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (a : σ → ℤ) + (q : ι → ℕ) (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (K : Finset ι) (base : ∀ i, σ → ZMod (q i)) + (u : ResiduePrimeCoordinateCell lo N M a q K base) : + Nonempty (IntegerResidueBox lo (fun j => lo j + N j) + (fun _ => (M.lcm (∏ i ∈ K, q i) : ℤ)) (fun j => (u.val j).val)) := + ⟨residuePrimeCoordinateCell_lcmEquiv lo N M a q hpair K base u u⟩ + +theorem selectedCombined_coprime_outside {ι : Type*} [DecidableEq ι] + (q : ι → ℕ) (hpair : Pairwise (fun i j => (q i).Coprime (q j))) (M : ℕ) (K : Finset ι) + (hcop : ∀ i ∉ K, M.Coprime (q i)) (j : ι) (hj : j ∉ K) : + (M.lcm (∏ i ∈ K, q i)).Coprime (q j) := by + have hK : (∏ i ∈ K, q i).Coprime (q j) := by + apply Nat.coprime_prod_left_iff.mpr + intro i hi + exact hpair (fun heq => hj (heq ▸ hi)) + exact Nat.Coprime.of_dvd_left (Nat.lcm_dvd_mul M _) + (Nat.coprime_mul_iff_left.mpr ⟨hcop j hj, hK⟩) + +theorem PrimeRefinementUpperBound.outside {ι σ : Type*} [DecidableEq ι] + [Fintype σ] [DecidableEq σ] {h g : (σ → ℤ) → ℂ} {lo a : σ → ℤ} {N : σ → ℕ} + {M : ℕ} {q : ι → ℕ} {r : ℕ} {level ε δ : ℝ} {K : Finset ι} + {base : ∀ i, σ → ZMod (q i)} + (hupper : PrimeRefinementUpperBound h g lo N M a q r level ε δ K base) + (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (u : ResiduePrimeCoordinateCell lo N M a q K base) + (S : Finset {i // i ∉ K}) (hS : S.card ≤ r) + (x : ∀ i : {i // i ∉ K}, σ → ZMod (q i.val)) + (hne : Nonempty (ResiduePrimeCoordinateCell lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (fun i : {i // i ∉ K} => q i.val) S x)) : + (residuePrimeCoordinateMean h lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (fun i : {i // i ∉ K} => q i.val) S x).re ≤ + level * (residuePrimeCoordinateMean g lo N M a q K base).re + ε + level * δ := by + classical + let y := CoordinateDecisionTree.outsideAssignment K base x + have hy : ∀ i ∈ K, y i = base i := by + intro i hi + simp only [y, CoordinateDecisionTree.outsideAssignment, hi, dite_true] + have hout : (fun i : {i // i ∉ K} => y i.val) = x := by + funext i + simp only [y, CoordinateDecisionTree.outsideAssignment, i.property, dite_false] + have hdis : Disjoint K (S.image Subtype.val) := by + apply Finset.disjoint_left.mpr + intro i hi hj + obtain ⟨j, _, heq⟩ := Finset.mem_image.mp hj + exact j.property (heq ▸ hi) + have hcard : (S.image Subtype.val).card ≤ r := Finset.card_image_le.trans hS + have hne' : Nonempty (ResiduePrimeCoordinateCell lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (fun i : {i // i ∉ K} => q i.val) S (fun i => y i.val)) := by + rw [hout] + exact hne + obtain ⟨v⟩ := hne' + have hneOriginal : Nonempty (ResiduePrimeCoordinateCell lo N M a q (K ∪ S.image Subtype.val) y) := + ⟨(residuePrimeCoordinateOutsideEquiv lo N M a q hpair K base u S y hy).symm v⟩ + have hu := hupper (S.image Subtype.val) hdis hcard y hy hneOriginal + rw [residuePrimeCoordinateMean_outside h lo N M a q hpair K base u S y hy, hout] at hu + exact hu + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem ResiduePrimeCoordinateStable.outside_mean_close {ι σ : Type*} [DecidableEq ι] + [Fintype σ] [DecidableEq σ] {g : (σ → ℤ) → ℂ} {lo a : σ → ℤ} {N : σ → ℕ} + {M : ℕ} {q : ι → ℕ} {r : ℕ} {δ : ℝ} {K : Finset ι} + {base : ∀ i, σ → ZMod (q i)} + (hstable : ResiduePrimeCoordinateStable g lo N M a q r δ K base) + (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (u : ResiduePrimeCoordinateCell lo N M a q K base) + (S : Finset {i // i ∉ K}) (hS : S.card ≤ r) + (x : ∀ i : {i // i ∉ K}, σ → ZMod (q i.val)) + (hne : Nonempty (ResiduePrimeCoordinateCell lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (fun i : {i // i ∉ K} => q i.val) S x)) : + ‖residuePrimeCoordinateMean g lo N M a q K base - + residuePrimeCoordinateMean g lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (fun i : {i // i ∉ K} => q i.val) S x‖ ≤ δ := by + classical + let y := CoordinateDecisionTree.outsideAssignment K base x + have hy : ∀ i ∈ K, y i = base i := by + intro i hi + simp only [y, CoordinateDecisionTree.outsideAssignment, hi, dite_true] + have hout : (fun i : {i // i ∉ K} => y i.val) = x := by + funext i + simp only [y, CoordinateDecisionTree.outsideAssignment, i.property, dite_false] + have hdis : Disjoint K (S.image Subtype.val) := by + apply Finset.disjoint_left.mpr + intro i hi hj + obtain ⟨j, _, heq⟩ := Finset.mem_image.mp hj + exact j.property (heq ▸ hi) + have hcard : (S.image Subtype.val).card ≤ r := Finset.card_image_le.trans hS + have hne' : Nonempty (ResiduePrimeCoordinateCell lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (fun i : {i // i ∉ K} => q i.val) S (fun i => y i.val)) := by + rw [hout] + exact hne + obtain ⟨v⟩ := hne' + have hneOriginal : Nonempty (ResiduePrimeCoordinateCell lo N M a q (K ∪ S.image Subtype.val) y) := + ⟨(residuePrimeCoordinateOutsideEquiv lo N M a q hpair K base u S y hy).symm v⟩ + have hs := hstable (S.image Subtype.val) hdis hcard y hy hneOriginal + rw [residuePrimeCoordinateMean_outside g lo N M a q hpair K base u S y hy, hout] at hs + exact hs + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem ResiduePrimeCoordinateStable.reference_density_close {ι σ : Type*} + [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] + {g : (σ → ℤ) → ℂ} {lo a : σ → ℤ} {N : σ → ℕ} {M : ℕ} {q : ι → ℕ} + [∀ i, NeZero (q i)] {r : ℕ} {δ : ℝ} {K : Finset ι} + {base : ∀ i, σ → ZMod (q i)} + (hstable : ResiduePrimeCoordinateStable g lo N M a q r δ K base) + (hM : 0 < M) (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (hcop : ∀ i ∉ K, M.Coprime (q i)) + (u : ResiduePrimeCoordinateCell lo N M a q K base) + (C : ℝ) (hC : 0 ≤ C) (hg : ∀ z ∈ translatedIntegerBox lo N, |(g z).re| ≤ C) + (S : Finset {i // i ∉ K}) (hS : S.card ≤ r) + (x : ∀ i : {i // i ∉ K}, σ → ZMod (q i.val)) + (hsmall : (∑ j, ((∏ i ∈ S, q i.val : ℕ) : ℝ) / + residueIndexLength (lo j) (lo j + N j) (M.lcm (∏ i ∈ K, q i)) ((u.val j).val)) < 1 / 2) : + |productConditionalMean (primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val)) S + (residuePrimeCoordinateDensity lo N (M.lcm (∏ i ∈ K, q i)) (fun j => (u.val j).val) + (residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u) + (fun i : {i // i ∉ K} => q i.val) (fun z => (g z).re)) x - + (residuePrimeCoordinateMean g lo N M a q K base).re| ≤ + δ + (2 * ∑ j, ((∏ i ∈ S, q i.val : ℕ) : ℝ) / + residueIndexLength (lo j) (lo j + N j) (M.lcm (∏ i ∈ K, q i)) ((u.val j).val)) * C := by + have hQ : 0 < M.lcm (∏ i ∈ K, q i) := + Nat.pos_of_ne_zero (Nat.lcm_ne_zero hM.ne' + (Finset.prod_pos (fun i _ => Nat.pos_of_ne_zero (NeZero.ne (q i)))).ne') + have hQcop : ∀ i : {i // i ∉ K}, (M.lcm (∏ k ∈ K, q k)).Coprime (q i.val) := + fun i => selectedCombined_coprime_outside q hpair M K hcop i.val i.property + have hpair' : Pairwise (fun i j : {i // i ∉ K} => (q i.val).Coprime (q j.val)) := + fun i j hij => hpair (fun heq => hij (Subtype.ext heq)) + have hbase := residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u + have hne := residuePrimeCoordinateCell_nonempty_of_small lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) hbase (fun i : {i // i ∉ K} => q i.val) hQ hQcop hpair' S x hsmall + have hs := hstable.outside_mean_close hpair u S hS x hne + have hsre := (Complex.abs_re_le_norm _).trans hs + rw [Complex.sub_re, abs_sub_comm] at hsre + have he := residuePrimeCoordinateDensity_conditional_error lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) hbase (fun i : {i // i ∉ K} => q i.val) hQ hQcop hpair' + (fun z => (g z).re) C hC hg S x hsmall.le + rw [← residuePrimeCoordinateMean_re] at he + let v := (residuePrimeCoordinateMean g lo N M a q K base).re + let G := (residuePrimeCoordinateMean g lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (fun i : {i // i ∉ K} => q i.val) S x).re + let R := productConditionalMean + (primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val)) S + (residuePrimeCoordinateDensity lo N (M.lcm (∏ i ∈ K, q i)) (fun j => (u.val j).val) + hbase (fun i : {i // i ∉ K} => q i.val) (fun z => (g z).re)) x + change |G - v| ≤ δ at hsre + change |R - G| ≤ _ at he + change |R - v| ≤ _ + calc + |R - v| = |(R - G) + (G - v)| := by congr 1; ring + _ ≤ |R - G| + |G - v| := abs_add_le _ _ + _ ≤ _ := by linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/StableRetainedAtom.lean b/lean/OAI/Combinatorics/Progressions/Estimates/StableRetainedAtom.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8d85a9dc268b066003da1d6109116cb630d8663 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/StableRetainedAtom.lean @@ -0,0 +1,140 @@ +import OAI.Combinatorics.Progressions.Dynamics.ReferenceMeanBudget +import OAI.Combinatorics.Progressions.Estimates.RetainedShellComparison +import OAI.Combinatorics.Progressions.Lattices.ResidueCellNormLengths + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem residuePrimeCoordinateMean_re_nonneg {ι σ : Type*} [Fintype ι] [DecidableEq ι] + [Fintype σ] [DecidableEq σ] (g : (σ → ℤ) → ℂ) (lo : σ → ℤ) (N : σ → ℕ) + (M : ℕ) (a : σ → ℤ) (q : ι → ℕ) (K : Finset ι) (base : ∀ i, σ → ZMod (q i)) + (hg : ∀ z ∈ translatedIntegerBox lo N, 0 ≤ (g z).re) : + 0 ≤ (residuePrimeCoordinateMean g lo N M a q K base).re := by + rw [residuePrimeCoordinateMean_re, Fintype.expect_eq_sum_div_card] + apply div_nonneg _ (Nat.cast_nonneg _) + apply Finset.sum_nonneg + intro z _ + apply hg + apply (mem_translatedIntegerBox lo N _).mpr + intro j + exact Finset.mem_Ico.mp ((Finset.mem_filter.mp (z.val j).property).1) + +theorem ResiduePrimeCoordinateStable.self_upper {ι σ : Type*} [DecidableEq ι] + [Fintype σ] [DecidableEq σ] {g : (σ → ℤ) → ℂ} {lo a : σ → ℤ} {N : σ → ℕ} + {M : ℕ} {q : ι → ℕ} {r : ℕ} {δ : ℝ} {K : Finset ι} {base : ∀ i, σ → ZMod (q i)} + (hstable : ResiduePrimeCoordinateStable g lo N M a q r δ K base) : + PrimeRefinementUpperBound g g lo N M a q r 1 0 δ K base := by + intro J hKJ hJ y hy hne + exact hstable.refinement_upper_bound zero_le_one J hKJ hJ y hy hne (by simp) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem stable_site_reference_mean_bounds {ι σ : Type*} + [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] + {h g : (σ → ℤ) → ℂ} {lo a : σ → ℤ} {N : σ → ℕ} {M : ℕ} {q : ι → ℕ} + [∀ i, NeZero (q i)] {r : ℕ} {level ε δ η τ : ℝ} {K : Finset ι} + {base : ∀ i, σ → ZMod (q i)} + (hstable : ResiduePrimeCoordinateStable g lo N M a q r δ K base) + (hupper : PrimeRefinementUpperBound h g lo N M a q r level ε δ K base) + (hM : 0 < M) (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (hcop : ∀ i ∉ K, M.Coprime (q i)) (u : ResiduePrimeCoordinateCell lo N M a q K base) + (hg : ∀ z ∈ translatedIntegerBox lo N, |(g z).re| ≤ 1) + (hh : ∀ z ∈ translatedIntegerBox lo N, |(h z).re| ≤ 1) + (hlevel : 0 ≤ level) (hτ : 0 ≤ τ) (hδ : δ ≤ τ / 8) (hε : ε ≤ level * τ / 8) + (hη : η < 1) (hητ : η ≤ τ / 8) (hηlevel : η ≤ level * τ / 8) + (herror : ∀ S : Finset {i // i ∉ K}, S.card ≤ r → + 2 * (∑ j, ((∏ i ∈ S, q i.val : ℕ) : ℝ) / + residueIndexLength (lo j) (lo j + N j) (M.lcm (∏ i ∈ K, q i)) ((u.val j).val)) ≤ η) : + let v := (residuePrimeCoordinateMean g lo N M a q K base).re + let density := fun f => residuePrimeCoordinateDensity lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u) + (fun i : {i // i ∉ K} => q i.val) f + let μ := primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val) + ∀ (S : Finset {i // i ∉ K}), S.card ≤ r → ∀ x, + productConditionalMean μ S (density (fun z => (h z).re)) x ≤ + level * productConditionalMean μ S (density (fun z => (g z).re)) x + level * τ ∧ + v - τ ≤ productConditionalMean μ S (density (fun z => (g z).re)) x := by + dsimp only + intro S hS x + have he := herror S hS + have hs : (∑ j, ((∏ i ∈ S, q i.val : ℕ) : ℝ) / + residueIndexLength (lo j) (lo j + N j) (M.lcm (∏ i ∈ K, q i)) ((u.val j).val)) < 1 / 2 := by + linarith + have hgclose := hstable.reference_density_close hM hpair hcop u 1 zero_le_one hg S hS x hs + have hhupper := hupper.reference_density_upper hM hpair hcop u 1 zero_le_one hh S hS x hs + simp only [mul_one] at hgclose hhupper + apply reference_mean_comparison_of_budget hlevel hτ hδ hε hητ hηlevel + · exact hgclose.trans (add_le_add le_rfl he) + · exact hhupper.trans (add_le_add le_rfl he) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem stable_site_retained_atom {ι σ : Type*} + [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] + {h g : (σ → ℤ) → ℂ} {lo a : σ → ℤ} {N : σ → ℕ} {M : ℕ} {q : ι → ℕ} + [∀ i, NeZero (q i)] {r : ℕ} {level inc δ η τ ε ξ : ℝ} {K : Finset ι} + {base : ∀ i, σ → ZMod (q i)} + (hstable : ResiduePrimeCoordinateStable g lo N M a q r δ K base) + (hupper : PrimeRefinementUpperBound h g lo N M a q r level inc δ K base) + (hM : 0 < M) (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (hcop : ∀ i ∉ K, M.Coprime (q i)) (u : ResiduePrimeCoordinateCell lo N M a q K base) + (hg : ∀ z ∈ translatedIntegerBox lo N, 0 ≤ (g z).re ∧ (g z).re ≤ 1) + (hh : ∀ z ∈ translatedIntegerBox lo N, |(h z).re| ≤ 1) + (hlevel : 0 ≤ level) (hτ : 0 ≤ τ) (hδ : δ ≤ τ / 8) (hinc : inc ≤ level * τ / 8) + (hη : η < 1) (hητ : η ≤ τ / 8) (hηlevel : η ≤ level * τ / 8) + (hε : 0 ≤ ε) (hsmall : ξ * (2 + ε) ≤ ε) + (herror : ∀ S : Finset {i // i ∉ K}, S.card ≤ r → + 2 * (∑ j, ((∏ i ∈ S, q i.val : ℕ) : ℝ) / + residueIndexLength (lo j) (lo j + N j) (M.lcm (∏ i ∈ K, q i)) ((u.val j).val)) ≤ η) : + let v := (residuePrimeCoordinateMean g lo N M a q K base).re + let density := fun f => residuePrimeCoordinateDensity lo N (M.lcm (∏ i ∈ K, q i)) + (fun j => (u.val j).val) (residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u) + (fun i : {i // i ∉ K} => q i.val) f + let μ := primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val) + ∀ (S : Finset {i // i ∉ K}), S.card ≤ r → ∀ x PH PG mass m EH EG UH UG, + 0 ≤ mass → 0 ≤ m → + |PH - (mass * m) * productConditionalMean μ S (density (fun z => (h z).re)) x| ≤ + EH + mass * m * (4 * level * (v + τ)) * UH → + |PG - (mass * m) * productConditionalMean μ S (density (fun z => (g z).re)) x| ≤ + EG + mass * m * (2 * (v + τ)) * UG → + 4 * UH ≤ ξ → 2 * UG ≤ ξ → + PH - (1 + ε) * level * PG ≤ + (mass * m) * level * (1 + 2 * ε) * τ + EH + (1 + ε) * level * EG := by + dsimp only + intro S hS x PH PG mass m EH EG UH UG hmass hm hPH hPG hUH hUG + have hga : ∀ z ∈ translatedIntegerBox lo N, |(g z).re| ≤ 1 := by + intro z hz + rw [abs_of_nonneg (hg z hz).1] + exact (hg z hz).2 + have hmeans := stable_site_reference_mean_bounds hstable hupper hM hpair hcop u hga hh + hlevel hτ hδ hinc hη hητ hηlevel herror S hS x + have hv := residuePrimeCoordinateMean_re_nonneg g lo N M a q K base (fun z hz => (hg z hz).1) + exact retained_atom_from_normalized_errors hmass hm hlevel hv hτ hε hPH hPG hUH hUG + hmeans.1 hmeans.2 hsmall + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/StableSiteSectionLengths.lean b/lean/OAI/Combinatorics/Progressions/Estimates/StableSiteSectionLengths.lean new file mode 100644 index 0000000000000000000000000000000000000000..d604ef01c7aec0adf87a255395efd62e9e8cc0a0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/StableSiteSectionLengths.lean @@ -0,0 +1,194 @@ +import OAI.Combinatorics.Progressions.Polynomial.StableSiteLowDegree + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem stable_site_uniform_sections {ι σ : Type*} + [Fintype ι] [LinearOrder ι] [Fintype σ] [DecidableEq σ] + {h g : (σ → ℤ) → ℂ} {lo a : σ → ℤ} {N : σ → ℕ} {M : ℕ} {q : ι → ℕ} + [∀ i, NeZero (q i)] {j r b moment : ℕ} {level inc δ η τ L T P : ℝ} {K : Finset ι} + {base : ∀ i, σ → ZMod (q i)} + (hstable : ResiduePrimeCoordinateStable g lo N M a q (j + r) δ K base) + (hupper : PrimeRefinementUpperBound h g lo N M a q (j + r) level inc δ K base) + (hM : 0 < M) (hpair : Pairwise (fun i k => (q i).Coprime (q k))) + (hcop : ∀ i ∉ K, M.Coprime (q i)) (u : ResiduePrimeCoordinateCell lo N M a q K base) + (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) + (hlevel : 0 < level) (hτ : 0 < τ) (hδ : δ ≤ τ / 8) (hinc : inc ≤ level * τ / 8) + (hη0 : 0 ≤ η) (hη : η < 1) (hητ : η ≤ τ / 8) (hηlevel : η ≤ level * τ / 8) + (hL : 0 ≤ L) (hT : 0 ≤ T) (hlower : Real.exp (-L) ≤ level) (hτinv : τ⁻¹ ≤ Real.exp T) + (hlog : L + T + 2 ≤ P) (hrP : ((j + r : ℕ) : ℝ) ≤ P) + (hmoment : 2 ≤ moment) (heven : Even moment) (hPq : P ≤ (moment : ℝ)) (hqP : (moment : ℝ) ≤ P + 2) + (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) + (hηsmall : η ≤ (1 / 2) * Real.exp (-((P + 3) ^ 3))) + (herror : ∀ S : Finset {i // i ∉ K}, S.card ≤ j + r → + 2 * (∑ k, ((∏ i ∈ S, q i.val : ℕ) : ℝ) / + residueIndexLength (lo k) (lo k + N k) (M.lcm (∏ i ∈ K, q i)) ((u.val k).val)) ≤ η) + (hclose : ProductMarginalsClose (primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val)) + (residuePrimeCoordinateDensity lo N (M.lcm (∏ i ∈ K, q i)) (fun k => (u.val k).val) + (residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u) + (fun i : {i // i ∉ K} => q i.val) (fun _ => 1)) η + (max ((j + r) * (moment + 1)) (2 * b + j))) + (hgram : 2 * η * ((lowDegreeCoordinateSets {i // i ∉ K} b).card : ℝ) ^ 2 * + (4 : ℝ) ^ b * (1 + η) ^ 2 ≤ 1) : + let v := (residuePrimeCoordinateMean g lo N M a q K base).re + let density := fun f => residuePrimeCoordinateDensity lo N (M.lcm (∏ i ∈ K, q i)) + (fun k => (u.val k).val) (residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u) + (fun i : {i // i ∉ K} => q i.val) f + let ν := primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val) + ∀ S : Finset {i // i ∉ K}, S.card ≤ j → ∀ x, + productConditionalMean ν S (density (fun z => (h z).re)) x ≤ + level * productConditionalMean ν S (density (fun z => (g z).re)) x + level * τ ∧ + v - τ ≤ productConditionalMean ν S (density (fun z => (g z).re)) x ∧ + (∀ k, k ≤ r → Real.sqrt (productANOVAEnergy ν (Finset.univ.powersetCard k) + (fun y => (4 * level * (v + τ))⁻¹ * productSectionAverage ν S S x (density (fun z => (h z).re)) y)) ≤ + (16 * (P + 2)) ^ (2 * k)) ∧ + (∀ k, k ≤ r → Real.sqrt (productANOVAEnergy ν (Finset.univ.powersetCard k) + (fun y => (2 * (v + τ))⁻¹ * productSectionAverage ν S S x (density (fun z => (g z).re)) y)) ≤ + (16 * (P + 2)) ^ (2 * k)) ∧ + Real.sqrt (productANOVAEnergy ν (lowDegreeCoordinateSets {i // i ∉ K} b) + (fun y => (4 * level * (v + τ))⁻¹ * productSectionAverage ν S S x (density (fun z => (h z).re)) y)) ≤ + 3 * Real.exp (L + T) ∧ + Real.sqrt (productANOVAEnergy ν (lowDegreeCoordinateSets {i // i ∉ K} b) + (fun y => (2 * (v + τ))⁻¹ * productSectionAverage ν S S x (density (fun z => (g z).re)) y)) ≤ + 3 * Real.exp (L + T) := by + dsimp only + have hga : ∀ z ∈ translatedIntegerBox lo N, |(g z).re| ≤ 1 := by + intro z hz + rw [abs_of_nonneg (hg z hz).1] + exact (hg z hz).2 + have hha : ∀ z ∈ translatedIntegerBox lo N, |(h z).re| ≤ 1 := by + intro z hz + rw [abs_of_nonneg (hh z hz).1] + exact (hh z hz).2 + have hmeans := stable_site_reference_mean_bounds hstable hupper hM hpair hcop u hga hha + hlevel.le hτ.le hδ hinc hη hητ hηlevel herror + obtain ⟨hgb, hhb⟩ := stable_site_normalized_marginals hstable hupper hM hpair hcop u hg hha + hlevel hτ (by linarith) (by nlinarith) hη (by linarith) (by nlinarith) herror + have hv := residuePrimeCoordinateMean_re_nonneg g lo N M a q K base (fun z hz => (hg z hz).1) + obtain ⟨hgs, hhs, hgcap, hhcap, hlogcap⟩ := site_normalization_caps hv hτ hlevel hL hT hlower hτinv + have hP : 0 ≤ P := (Nat.cast_nonneg (j + r)).trans hrP + have hcapP : Real.exp (L + T) ≤ Real.exp P := Real.exp_le_exp.mpr (by linarith) + have houtside : (Fintype.card {i // i ∉ K} : ℝ) ≤ Real.exp P := + (Nat.cast_le.mpr (Fintype.card_subtype_le _)).trans hcount + have hbudget := approxMoment_small_of_exponential (Fintype.card {i // i ∉ K}) (j + r) moment + (Real.exp (L + T)) P hP (Real.exp_pos _).le houtside hcapP hrP hqP hηsmall + have hclow := ProductMarginalsClose.mono _ hclose (le_max_left _ _) + have hne := residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u + intro S hS x + have hSj : S.card ≤ j + r := by omega + have hm := hmeans S hSj x + refine ⟨hm.1, hm.2, ?_, ?_, ?_, ?_⟩ + · intro k hk + exact residuePrimeDensity_scaled_section_low_degree lo N (M.lcm (∏ i ∈ K, q i)) + (fun k => (u.val k).val) hne (fun i : {i // i ∉ K} => q i.val) (fun z => (h z).re) hh + hhs (Real.exp_pos _).le hhcap hmoment heven S hSj (by omega) x hη0 hrP (hlogcap.trans hlog) + hPq hqP hbudget hclow hhb + · intro k hk + exact residuePrimeDensity_scaled_section_low_degree lo N (M.lcm (∏ i ∈ K, q i)) + (fun k => (u.val k).val) hne (fun i : {i // i ∉ K} => q i.val) (fun z => (g z).re) hg + hgs (Real.exp_pos _).le hgcap hmoment heven S hSj (by omega) x hη0 hrP (hlogcap.trans hlog) + hPq hqP hbudget hclow hgb + · exact residuePrimeDensity_scaled_section_norm lo N (M.lcm (∏ i ∈ K, q i)) + (fun k => (u.val k).val) hne (fun i : {i // i ∉ K} => q i.val) (fun z => (h z).re) hh + hhs hhcap S x hη0 hη.le _ (fun A hA => (mem_lowDegreeCoordinateSets _ b A).mp hA) + (ProductMarginalsClose.mono _ hclose (by omega)) hgram + · exact residuePrimeDensity_scaled_section_norm lo N (M.lcm (∏ i ∈ K, q i)) + (fun k => (u.val k).val) hne (fun i : {i // i ∉ K} => q i.val) (fun z => (g z).re) hg + hgs hgcap S x hη0 hη.le _ (fun A hA => (mem_lowDegreeCoordinateSets _ b A).mp hA) + (ProductMarginalsClose.mono _ hclose (by omega)) hgram + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem stable_site_uniform_sections_of_lengths {ι σ : Type*} + [Fintype ι] [LinearOrder ι] [Fintype σ] [DecidableEq σ] + {h g : (σ → ℤ) → ℂ} {lo a : σ → ℤ} {N : σ → ℕ} {M : ℕ} {q : ι → ℕ} + [∀ i, NeZero (q i)] {j r b moment : ℕ} {level inc δ η τ L T P : ℝ} {K : Finset ι} + {base : ∀ i, σ → ZMod (q i)} + (hstable : ResiduePrimeCoordinateStable g lo N M a q (j + r) δ K base) + (hupper : PrimeRefinementUpperBound h g lo N M a q (j + r) level inc δ K base) + (hM : 0 < M) (hpair : Pairwise (fun i k => (q i).Coprime (q k))) + (hcop : ∀ i ∉ K, M.Coprime (q i)) (u : ResiduePrimeCoordinateCell lo N M a q K base) + (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) + (hlevel : 0 < level) (hτ : 0 < τ) (hδ : δ ≤ τ / 8) (hinc : inc ≤ level * τ / 8) + (hη0 : 0 ≤ η) (hη : η < 1) (hητ : η ≤ τ / 8) (hηlevel : η ≤ level * τ / 8) + (hL : 0 ≤ L) (hT : 0 ≤ T) (hlower : Real.exp (-L) ≤ level) (hτinv : τ⁻¹ ≤ Real.exp T) + (hlog : L + T + 2 ≤ P) (hrP : ((j + r : ℕ) : ℝ) ≤ P) + (hmoment : 2 ≤ moment) (heven : Even moment) (hPq : P ≤ (moment : ℝ)) (hqP : (moment : ℝ) ≤ P + 2) + (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) + (hηsmall : η ≤ (1 / 2) * Real.exp (-((P + 3) ^ 3))) + (modLog dimLog errorLog : ℝ) (hmodLog : 0 ≤ modLog) (herror : Real.exp (-errorLog) ≤ η) + (hmoduli : ∀ i ∉ K, (q i : ℝ) ≤ Real.exp modLog) (hdim : (Fintype.card σ : ℝ) ≤ Real.exp dimLog) + (hlength : ∀ k, Real.exp (modLog * (max ((j + r) * (moment + 1)) (2 * b + j) : ℕ) + + errorLog + dimLog + 1) ≤ + (residueIndexLength (lo k) (lo k + N k) (M.lcm (∏ i ∈ K, q i)) ((u.val k).val) : ℝ)) + (hgram : 2 * η * ((lowDegreeCoordinateSets {i // i ∉ K} b).card : ℝ) ^ 2 * + (4 : ℝ) ^ b * (1 + η) ^ 2 ≤ 1) : + let v := (residuePrimeCoordinateMean g lo N M a q K base).re + let density := fun f => residuePrimeCoordinateDensity lo N (M.lcm (∏ i ∈ K, q i)) + (fun k => (u.val k).val) (residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u) + (fun i : {i // i ∉ K} => q i.val) f + let ν := primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val) + ∀ S : Finset {i // i ∉ K}, S.card ≤ j → ∀ x, + productConditionalMean ν S (density (fun z => (h z).re)) x ≤ + level * productConditionalMean ν S (density (fun z => (g z).re)) x + level * τ ∧ + v - τ ≤ productConditionalMean ν S (density (fun z => (g z).re)) x ∧ + (∀ k, k ≤ r → Real.sqrt (productANOVAEnergy ν (Finset.univ.powersetCard k) + (fun y => (4 * level * (v + τ))⁻¹ * productSectionAverage ν S S x (density (fun z => (h z).re)) y)) ≤ + (16 * (P + 2)) ^ (2 * k)) ∧ + (∀ k, k ≤ r → Real.sqrt (productANOVAEnergy ν (Finset.univ.powersetCard k) + (fun y => (2 * (v + τ))⁻¹ * productSectionAverage ν S S x (density (fun z => (g z).re)) y)) ≤ + (16 * (P + 2)) ^ (2 * k)) ∧ + Real.sqrt (productANOVAEnergy ν (lowDegreeCoordinateSets {i // i ∉ K} b) + (fun y => (4 * level * (v + τ))⁻¹ * productSectionAverage ν S S x (density (fun z => (h z).re)) y)) ≤ + 3 * Real.exp (L + T) ∧ + Real.sqrt (productANOVAEnergy ν (lowDegreeCoordinateSets {i // i ∉ K} b) + (fun y => (2 * (v + τ))⁻¹ * productSectionAverage ν S S x (density (fun z => (g z).re)) y)) ≤ + 3 * Real.exp (L + T) := by + have hQ : 0 < M.lcm (∏ i ∈ K, q i) := + Nat.pos_of_ne_zero (Nat.lcm_ne_zero hM.ne' + (Finset.prod_pos (fun i _ => Nat.pos_of_ne_zero (NeZero.ne (q i)))).ne') + have hQcop : ∀ i : {i // i ∉ K}, (M.lcm (∏ k ∈ K, q k)).Coprime (q i.val) := + fun i => selectedCombined_coprime_outside q hpair M K hcop i.val i.property + have hpair' : Pairwise (fun i k : {i // i ∉ K} => (q i.val).Coprime (q k.val)) := + fun i k hik => hpair (fun heq => hik (Subtype.ext heq)) + have hne := residuePrimeCoordinateCell_lcm_nonempty lo N M a q hpair K base u + have hmods := fun i : {i // i ∉ K} => hmoduli i.val i.property + have hbase := residuePrimeDensity_close_of_lengths lo N (M.lcm (∏ i ∈ K, q i)) + (fun k => (u.val k).val) hne (fun i : {i // i ∉ K} => q i.val) hQ hQcop hpair' + (max ((j + r) * (moment + 1)) (2 * b + j)) modLog dimLog errorLog η + hmodLog hη.le herror hmods hdim hlength + have hrank : j + r ≤ max ((j + r) * (moment + 1)) (2 * b + j) := by + have hmul : j + r ≤ (j + r) * (moment + 1) := by + calc + j + r = (j + r) * 1 := (Nat.mul_one _).symm + _ ≤ (j + r) * (moment + 1) := Nat.mul_le_mul_left _ (by omega) + exact hmul.trans (le_max_left _ _) + have herr (S : Finset {i // i ∉ K}) (hS : S.card ≤ j + r) := + (primeCoordinate_error_le_exp (fun i : {i // i ∉ K} => q i.val) + (fun k => residueIndexLength (lo k) (lo k + N k) (M.lcm (∏ i ∈ K, q i)) ((u.val k).val)) + (max ((j + r) * (moment + 1)) (2 * b + j)) modLog dimLog errorLog hmodLog hmods hdim hlength + S (hS.trans hrank)).trans herror + exact stable_site_uniform_sections hstable hupper hM hpair hcop u hg hh hlevel hτ hδ hinc + hη0 hη hητ hηlevel hL hT hlower hτinv hlog hrP hmoment heven hPq hqP hcount hηsmall + herr hbase hgram + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/StepDropTerminalContainment.lean b/lean/OAI/Combinatorics/Progressions/Estimates/StepDropTerminalContainment.lean new file mode 100644 index 0000000000000000000000000000000000000000..864408fb31b4886648bfea662ed735cb3f08a52c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/StepDropTerminalContainment.lean @@ -0,0 +1,444 @@ +import OAI.Combinatorics.Progressions.Estimates.FormalInductionTerminal +import OAI.Combinatorics.Progressions.Linear.BasisProjectionRealification + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {R L ι : Type*} [Field R] [LieRing L] [LieAlgebra R L] + +def stepDropBracketKernel (K V : Submodule R L) : Submodule R L where + carrier := {x | ∀ k ∈ K, ⁅x, k⁆ ∈ V} + zero_mem' := by intro k _; rw [zero_lie]; exact V.zero_mem + add_mem' := by + intro x y hx hy k hk + rw [add_lie] + exact V.add_mem (hx k hk) (hy k hk) + smul_mem' := by + intro a x hx k hk + rw [smul_lie] + exact V.smul_mem a (hx k hk) + +noncomputable def stepDropSubmodule (b : Basis ι R L) (w : ι → ℕ) + (U : LieSubalgebra R L) (V K : Submodule R L) : Submodule R L := + U.toSubmodule ⊓ (K.comap (basisGradeProjection b w 1) ⊓ + ((stepDropBracketKernel K V).comap (basisGradeProjection b w 1) ⊓ + V.comap (LinearMap.id - basisGradeProjection b w 1))) + +theorem mem_stepDropSubmodule (b : Basis ι R L) (w : ι → ℕ) + (U : LieSubalgebra R L) (V K : Submodule R L) (x : L) : + x ∈ stepDropSubmodule b w U V K ↔ + x ∈ U ∧ basisGradeProjection b w 1 x ∈ K ∧ + (∀ k ∈ K, ⁅basisGradeProjection b w 1 x, k⁆ ∈ V) ∧ + x - basisGradeProjection b w 1 x ∈ V := Iff.rfl + +theorem basisGradeProjection_one_lie_eq_zero [Fintype ι] + (b : Basis ι R L) (w : ι → ℕ) (hw : ∀ i, 0 < w i) + (hgraded : BasisHomogeneousBrackets b w) (x y : L) : + basisGradeProjection b w 1 ⁅x, y⁆ = 0 := by + classical + have hb (i j : ι) : basisGradeProjection b w 1 ⁅b i, b j⁆ = 0 := by + apply b.repr.injective + ext k + simp only [basisGradeProjection_repr, map_zero, Finsupp.zero_apply] + split_ifs with hk + · exact hgraded i j k (by have := hw i; have := hw j; omega) + · rfl + rw [← b.sum_repr x, ← b.sum_repr y] + simp only [sum_lie_sum, smul_lie, lie_smul, map_sum, map_smul, hb, smul_zero, + Finset.sum_const_zero] + +theorem stepDropSubmodule_lie_mem [Fintype ι] + (b : Basis ι R L) (w : ι → ℕ) (hw : ∀ i, 0 < w i) + (hgraded : BasisHomogeneousBrackets b w) (U : LieSubalgebra R L) (V K : Submodule R L) + (hU : BasisGradedSubmodule b w U.toSubmodule) + (hUV : ∀ u ∈ U, ∀ v ∈ V, ⁅u, v⁆ ∈ V) + {x y : L} (hx : x ∈ stepDropSubmodule b w U V K) (hy : y ∈ stepDropSubmodule b w U V K) : + ⁅x, y⁆ ∈ stepDropSubmodule b w U V K := by + obtain ⟨hxU, _, hxbr, hxV⟩ := (mem_stepDropSubmodule b w U V K x).mp hx + obtain ⟨hyU, hyK, _, hyV⟩ := (mem_stepDropSubmodule b w U V K y).mp hy + have hbr : ⁅x, y⁆ ∈ V := by + have h₁ := hxbr (basisGradeProjection b w 1 y) hyK + have h₂ := hUV _ (hU 1 x hxU) _ hyV + have h₃ : ⁅x - basisGradeProjection b w 1 x, y⁆ ∈ V := by + rw [← lie_skew] + exact V.neg_mem (hUV y hyU _ hxV) + have he : ⁅x, y⁆ = + ⁅basisGradeProjection b w 1 x, basisGradeProjection b w 1 y⁆ + + ⁅basisGradeProjection b w 1 x, y - basisGradeProjection b w 1 y⁆ + + ⁅x - basisGradeProjection b w 1 x, y⁆ := by + rw [lie_sub, sub_lie] + abel + rw [he] + exact V.add_mem (V.add_mem h₁ h₂) h₃ + have hz := basisGradeProjection_one_lie_eq_zero b w hw hgraded x y + apply (mem_stepDropSubmodule b w U V K _).mpr + refine ⟨U.lie_mem hxU hyU, ?_, ?_, ?_⟩ + · rw [hz] + exact K.zero_mem + · intro k _ + rw [hz, zero_lie] + exact V.zero_mem + · rwa [hz, sub_zero] + +noncomputable def stepDropSubalgebra [Fintype ι] + (b : Basis ι R L) (w : ι → ℕ) (hw : ∀ i, 0 < w i) + (hgraded : BasisHomogeneousBrackets b w) (U : LieSubalgebra R L) (V K : Submodule R L) + (hU : BasisGradedSubmodule b w U.toSubmodule) + (hUV : ∀ u ∈ U, ∀ v ∈ V, ⁅u, v⁆ ∈ V) : LieSubalgebra R L := + { stepDropSubmodule b w U V K with + lie_mem' := stepDropSubmodule_lie_mem b w hw hgraded U V K hU hUV } + +theorem stepDropSubmodule_graded (b : Basis ι R L) (w : ι → ℕ) + (U : LieSubalgebra R L) (V K : Submodule R L) + (hU : BasisGradedSubmodule b w U.toSubmodule) (hV : BasisGradedSubmodule b w V) : + BasisGradedSubmodule b w (stepDropSubmodule b w U V K) := by + intro j x hx + obtain ⟨hxU, hxK, hxbr, hxV⟩ := (mem_stepDropSubmodule b w U V K x).mp hx + apply (mem_stepDropSubmodule b w U V K _).mpr + by_cases hj : j = 1 + · subst j + have hi := basisCoordinateProjection_idempotent b {i | w i = 1} x + refine ⟨hU 1 x hxU, ?_, ?_, ?_⟩ + · simpa only [basisGradeProjection, hi] using hxK + · intro k hk + simpa only [basisGradeProjection, hi] using hxbr k hk + · rw [show basisGradeProjection b w 1 (basisGradeProjection b w 1 x) = + basisGradeProjection b w 1 x from hi, sub_self] + exact V.zero_mem + · have hz := basisGradeProjection_other b w (Ne.symm hj) x + have hback := basisGradeProjection_other b w hj x + have hv := hV j _ hxV + rw [map_sub, hback, sub_zero] at hv + refine ⟨hU j x hxU, ?_, ?_, ?_⟩ + · rw [hz] + exact K.zero_mem + · intro k _ + rw [hz, zero_lie] + exact V.zero_mem + · rwa [hz, sub_zero] + +theorem stepDropSubmodule_mem_higher_grade (b : Basis ι R L) (w : ι → ℕ) + (U : LieSubalgebra R L) (V K : Submodule R L) {j : ℕ} (hj : j ≠ 1) + {x : L} (hx : basisGradeProjection b w j x = x) : + x ∈ stepDropSubmodule b w U V K ↔ x ∈ U ∧ x ∈ V := by + have hz : basisGradeProjection b w 1 x = 0 := by + rw [← hx] + exact basisGradeProjection_other b w (Ne.symm hj) x + rw [mem_stepDropSubmodule] + constructor + · rintro ⟨hU, _, _, hV⟩ + exact ⟨hU, by simpa only [hz, sub_zero] using hV⟩ + · rintro ⟨hU, hV⟩ + refine ⟨hU, ?_, ?_, ?_⟩ + · rw [hz] + exact K.zero_mem + · intro k _ + rw [hz, zero_lie] + exact V.zero_mem + · rwa [hz, sub_zero] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +def rightLieLinear {R L : Type*} [Field R] [LieRing L] [LieAlgebra R L] (k : L) : L →ₗ[R] L where + toFun x := ⁅x, k⁆ + map_add' x y := add_lie x y k + map_smul' a x := smul_lie a x k + +@[simp] theorem rightLieLinear_apply {R L : Type*} [Field R] [LieRing L] [LieAlgebra R L] + (k x : L) : rightLieLinear (R := R) k x = ⁅x, k⁆ := rfl + +theorem stepDropBracketKernel_eq_iInf {R L κ : Type*} [Field R] [LieRing L] [LieAlgebra R L] + [Fintype κ] (K V : Submodule R L) (e : Basis κ R K) : + stepDropBracketKernel K V = ⨅ z, V.comap (rightLieLinear (e z : L)) := by + classical + ext x + change (∀ k ∈ K, ⁅x, k⁆ ∈ V) ↔ _ + simp only [Submodule.mem_iInf, Submodule.mem_comap, rightLieLinear_apply] + constructor + · intro h z + exact h (e z) (e z).property + · intro h k hk + have he : (∑ z, e.repr ⟨k, hk⟩ z • (e z : L)) = k := by + simpa only [map_sum, map_smul, Submodule.subtype_apply] using + congrArg K.subtype (e.sum_repr ⟨k, hk⟩) + rw [← he, lie_sum] + apply V.sum_mem + intro z _ + rw [lie_smul] + exact V.smul_mem _ (h z) + +variable {L ι κ : Type*} [LieRing L] [LieAlgebra ℚ L] + +theorem rightLieLinear_baseChange (k : L) : + (rightLieLinear (R := ℚ) k).baseChange ℝ = rightLieLinear (R := ℝ) ((1 : ℝ) ⊗ₜ[ℚ] k) := by + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul r x => + simp only [LinearMap.baseChange_tmul, rightLieLinear_apply, + LieAlgebra.ExtendScalars.bracket_tmul, mul_one] + +theorem stepDropBracketKernel_baseChange [Fintype κ] + (K V : Submodule ℚ L) (e : Basis κ ℚ K) : + (stepDropBracketKernel K V).baseChange ℝ = stepDropBracketKernel (K.baseChange ℝ) (V.baseChange ℝ) := by + apply le_antisymm + · intro x hx k hk + exact lie_mem_real_baseChange (stepDropBracketKernel K V) K V + (fun _ ha _ hb => ha _ hb) hx hk + · intro x hx + rw [stepDropBracketKernel_eq_iInf K V e, real_baseChange_iInf] + rw [Submodule.mem_iInf] + intro z + rw [realification_comap] + change (rightLieLinear (R := ℚ) (e z : L)).baseChange ℝ x ∈ V.baseChange ℝ + rw [rightLieLinear_baseChange, rightLieLinear_apply] + exact hx _ (Submodule.tmul_mem_baseChange_of_mem 1 (e z).property) + +theorem stepDropSubmodule_baseChange [Fintype κ] + (b : Basis ι ℚ L) (w : ι → ℕ) (U : LieSubalgebra ℚ L) + (V K : Submodule ℚ L) (e : Basis κ ℚ K) : + (stepDropSubmodule b w U V K).baseChange ℝ = + stepDropSubmodule (b.baseChange ℝ) w (realificationLieSubalgebra U) (V.baseChange ℝ) (K.baseChange ℝ) := by + simp only [stepDropSubmodule, realification_inf, realification_comap, + stepDropBracketKernel_baseChange K V e, basisGradeProjection, + basisCoordinateProjection_baseChange, LinearMap.baseChange_sub, LinearMap.baseChange_id, + realificationLieSubalgebra_toSubmodule] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +variable {R L μ : Type*} [Field R] [AddCommGroup L] [Module R L] + +noncomputable def homogeneousIntersection (b : Basis μ R L) (w : μ → ℕ) (j : ℕ) + (U V : Submodule R L) : Submodule R L := + U ⊓ (V ⊓ LinearMap.ker (basisGradeProjection b w j - LinearMap.id)) + +theorem mem_homogeneousIntersection (b : Basis μ R L) (w : μ → ℕ) (j : ℕ) + (U V : Submodule R L) (x : L) : + x ∈ homogeneousIntersection b w j U V ↔ + x ∈ U ∧ x ∈ V ∧ basisGradeProjection b w j x = x := by + simp only [homogeneousIntersection, Submodule.mem_inf, LinearMap.mem_ker, + LinearMap.sub_apply, LinearMap.id_apply, sub_eq_zero] + +theorem homogeneousIntersection_finrank_le [Fintype μ] + (b : Basis μ R L) (w : μ → ℕ) (j : ℕ) (U V : Submodule R L) : + Module.finrank R (homogeneousIntersection b w j U V) ≤ Fintype.card μ := by + let : FiniteDimensional R L := b.finiteDimensional_of_finite + have h := LinearMap.finrank_le_finrank_of_injective + (f := (homogeneousIntersection b w j U V).subtype) (fun _ _ h => Subtype.ext h) + simpa only [Module.finrank_eq_card_basis b] using h + +theorem homogeneousIntersection_baseChange {L μ : Type*} [AddCommGroup L] [Module ℚ L] + (b : Basis μ ℚ L) (w : μ → ℕ) (j : ℕ) (U V : Submodule ℚ L) : + (homogeneousIntersection b w j U V).baseChange ℝ = + homogeneousIntersection (b.baseChange ℝ) w j (U.baseChange ℝ) (V.baseChange ℝ) := by + simp only [homogeneousIntersection, realification_inf, realification_ker, + LinearMap.baseChange_sub, LinearMap.baseChange_id, basisGradeProjection, + basisCoordinateProjection_baseChange] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped Matrix + +abbrev StepDropRow (υ χ κ ν : Type*) := υ ⊕ χ ⊕ (κ × ν) ⊕ ν + +variable {L μ υ χ κ ν : Type*} [LieRing L] [LieAlgebra ℚ L] + +noncomputable def stepDropSystem (b : Basis μ ℚ L) (w : μ → ℕ) + (U : LieSubalgebra ℚ L) (V K : Submodule ℚ L) + (fU : Basis υ ℚ (L ⧸ U.toSubmodule)) (fK : Basis χ ℚ (L ⧸ K)) + (fV : Basis ν ℚ (L ⧸ V)) (eK : Basis κ ℚ K) : + L →ₗ[ℚ] (StepDropRow υ χ κ ν → ℚ) := + LinearMap.pi fun + | .inl i => (fU.coord i).comp U.toSubmodule.mkQ + | .inr (.inl i) => (fK.coord i).comp (K.mkQ.comp (basisGradeProjection b w 1)) + | .inr (.inr (.inl z)) => (fV.coord z.2).comp + (V.mkQ.comp ((rightLieLinear (eK z.1 : L)).comp (basisGradeProjection b w 1))) + | .inr (.inr (.inr i)) => (fV.coord i).comp + (V.mkQ.comp (LinearMap.id - basisGradeProjection b w 1)) + +theorem stepDrop_quotient_mem_iff {ρ : Type*} (V : Submodule ℚ L) + (f : Basis ρ ℚ (L ⧸ V)) (x : L) : + x ∈ V ↔ ∀ i, f.repr (V.mkQ x) i = 0 := by + simp only [Submodule.mkQ_apply] + constructor + · intro hx i + rw [(Submodule.Quotient.mk_eq_zero V).mpr hx, map_zero] + rfl + · intro h + apply (Submodule.Quotient.mk_eq_zero V).mp + apply f.repr.injective + ext i + simpa only [map_zero, Finsupp.zero_apply] using h i + +theorem stepDropSystem_ker [Fintype κ] (b : Basis μ ℚ L) (w : μ → ℕ) + (U : LieSubalgebra ℚ L) (V K : Submodule ℚ L) + (fU : Basis υ ℚ (L ⧸ U.toSubmodule)) (fK : Basis χ ℚ (L ⧸ K)) + (fV : Basis ν ℚ (L ⧸ V)) (eK : Basis κ ℚ K) : + LinearMap.ker (stepDropSystem b w U V K fU fK fV eK) = stepDropSubmodule b w U V K := by + ext x + rw [LinearMap.mem_ker, mem_stepDropSubmodule] + constructor + · intro hx + have hU := (stepDrop_quotient_mem_iff U.toSubmodule fU x).mpr + (fun i => congrFun hx (.inl i)) + have hK := (stepDrop_quotient_mem_iff K fK (basisGradeProjection b w 1 x)).mpr + (fun i => congrFun hx (.inr (.inl i))) + have hbr : basisGradeProjection b w 1 x ∈ stepDropBracketKernel K V := by + rw [stepDropBracketKernel_eq_iInf K V eK, Submodule.mem_iInf] + intro z + exact (stepDrop_quotient_mem_iff V fV _).mpr + (fun i => congrFun hx (.inr (.inr (.inl (z, i))))) + have hV := (stepDrop_quotient_mem_iff V fV (x - basisGradeProjection b w 1 x)).mpr + (fun i => congrFun hx (.inr (.inr (.inr i)))) + exact ⟨hU, hK, hbr, hV⟩ + · rintro ⟨hU, hK, hbr, hV⟩ + funext i + rcases i with i | i | ⟨z, i⟩ | i + · exact (stepDrop_quotient_mem_iff U.toSubmodule fU x).mp hU i + · exact (stepDrop_quotient_mem_iff K fK _).mp hK i + · exact (stepDrop_quotient_mem_iff V fV _).mp (hbr (eK z) (eK z).property) i + · exact (stepDrop_quotient_mem_iff V fV _).mp hV i + +theorem stepDropSystem_basis_height (b : Basis μ ℚ L) (w : μ → ℕ) + (U : LieSubalgebra ℚ L) (V K : Submodule ℚ L) + (fU : Basis υ ℚ (L ⧸ U.toSubmodule)) (fK : Basis χ ℚ (L ⧸ K)) + (fV : Basis ν ℚ (L ⧸ V)) (eK : Basis κ ℚ K) {H B : ℕ} (hH : 1 ≤ H) + (hU : ∀ i j, RationalHeightLE (fU.repr (U.toSubmodule.mkQ (b j)) i) H) + (hK : ∀ i j, RationalHeightLE (fK.repr (K.mkQ (b j)) i) H) + (hV : ∀ i j, RationalHeightLE (fV.repr (V.mkQ (b j)) i) H) + (hbr : ∀ i j z, RationalHeightLE (fV.repr (V.mkQ ⁅b j, (eK z : L)⁆) i) B) + (i : StepDropRow υ χ κ ν) (j : μ) : + RationalHeightLE (stepDropSystem b w U V K fU fK fV eK (b j) i) (max H B) := by + classical + have hp : basisGradeProjection b w 1 (b j) = if w j = 1 then b j else 0 := + basisCoordinateProjection_basis b {i | w i = 1} j + have hzero := rationalHeightLE_zero (hH.trans (Nat.le_max_left H B)) + rcases i with i | i | ⟨z, i⟩ | i + · exact (hU i j).mono (Nat.le_max_left H B) + · change RationalHeightLE (fK.repr (K.mkQ (basisGradeProjection b w 1 (b j))) i) _ + rw [hp] + split_ifs + · exact (hK i j).mono (Nat.le_max_left H B) + · simpa only [map_zero, Finsupp.zero_apply] using hzero + · change RationalHeightLE (fV.repr (V.mkQ ⁅basisGradeProjection b w 1 (b j), (eK z : L)⁆) i) _ + rw [hp] + split_ifs + · exact (hbr i j z).mono (Nat.le_max_right H B) + · simpa only [zero_lie, map_zero, Finsupp.zero_apply] using hzero + · change RationalHeightLE (fV.repr (V.mkQ (b j - basisGradeProjection b w 1 (b j))) i) _ + rw [hp] + split_ifs + · simpa only [sub_self, map_zero, Finsupp.zero_apply] using hzero + · simpa only [sub_zero] using (hV i j).mono (Nat.le_max_left H B) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem stepDropSubmodule_top_frequency + {R L ι : Type*} [Field R] [LieRing L] [LieAlgebra R L] + (b : Basis ι R L) (w : ι → ℕ) (U : LieSubalgebra R L) (V K : Submodule R L) + (hU : BasisGradedSubmodule b w U.toSubmodule) (hV : BasisGradedSubmodule b w V) + (η : L →ₗ[R] R) {s : ℕ} (hs : 2 ≤ s) + (hη : ∀ x ∈ V, basisGradeProjection b w s x = x → η x = 0) + {x : L} (hx : x ∈ stepDropSubmodule b w U V K) : + η (basisGradeProjection b w s x) = 0 := by + have hmem := stepDropSubmodule_graded b w U V K hU hV s x hx + have hpure : basisGradeProjection b w s (basisGradeProjection b w s x) = + basisGradeProjection b w s x := basisCoordinateProjection_idempotent b {i | w i = s} x + exact hη _ ((stepDropSubmodule_mem_higher_grade b w U V K (by omega) hpure).mp hmem).2 hpure + +namespace NilpotentLieFiltration + +variable {L μ κ σ : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype κ] {s : ℕ} + {F : NilpotentLieFiltration L s} {b : Basis μ ℚ L} {w : μ → ℕ} + {U : LieSubalgebra ℝ (ℝ ⊗[ℚ] L)} {V K : Submodule ℚ L} + {eK : Basis κ ℚ K} {T : σ → ℝ} {q : ℝ} + {original : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot} + +theorem FormalInductionRun.terminal_coefficients_mem_stepDropSubmodule + (W : F.FormalInductionRun b w U V K eK T original (s - 1) q) + (hs : 2 ≤ s) (hF : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + (α : σ →₀ ℕ) : + coefficients W.state.P.coord α ∈ + stepDropSubmodule (b.baseChange ℝ) w U (V.baseChange ℝ) (K.baseChange ℝ) := by + apply (mem_stepDropSubmodule _ _ _ _ _ _).mpr + refine ⟨W.state.mem_U α, W.state.horizontal α, ?_, ?_⟩ + · rintro k ⟨x, rfl⟩ + apply real_bracket_mem_of_basis (eK.baseChange ℝ) (K.subtype.baseChange ℝ) (V.baseChange ℝ) + (basisGradeProjection (b.baseChange ℝ) w 1 (coefficients W.state.P.coord α)) _ x + intro z + simpa only [Basis.baseChange_apply, LinearMap.baseChange_tmul, Submodule.subtype_apply] using + W.terminal_lower_bracket hs 1 (by omega) z α + · have h := F.real_sub_horizontal_mem_of_lower_grades b w hF (V.baseChange ℝ) + (j := s + 1) (by omega) (coefficients W.state.P.coord α) + (fun d hd hds => W.terminal_lower_log hs α d hd (by omega)) + rw [F.realLayer_terminal] at h + simpa only [LieSubmodule.bot_toSubmodule, sup_bot_eq] using h + +theorem FormalInductionRun.terminal_coefficients_mem_rational_stepDrop + {U₀ : LieSubalgebra ℚ L} + (W : F.FormalInductionRun b w (realificationLieSubalgebra U₀) V K eK T original (s - 1) q) + (hs : 2 ≤ s) (hF : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + (α : σ →₀ ℕ) : + coefficients W.state.P.coord α ∈ (stepDropSubmodule b w U₀ V K).baseChange ℝ := by + rw [stepDropSubmodule_baseChange b w U₀ V K eK] + exact W.terminal_coefficients_mem_stepDropSubmodule hs hF α + +theorem FormalInductionRun.terminal_log_mem_stepDropSubalgebra [Fintype μ] + {U₀ : LieSubalgebra ℚ L} + (W : F.FormalInductionRun b w (realificationLieSubalgebra U₀) V K eK T original (s - 1) q) + (hs : 2 ≤ s) (hF : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + (hgraded : BasisHomogeneousBrackets b w) + (hU : BasisGradedSubmodule b w U₀.toSubmodule) + (hUV : ∀ u ∈ U₀, ∀ v ∈ V, ⁅u, v⁆ ∈ V) (t : σ → ℝ) : + eval₂ t W.state.P.coord ∈ realificationLieSubalgebra + (stepDropSubalgebra b w (F.adaptedBasis_weight_pos b w hF) hgraded U₀ V K hU hUV) := by + apply (eval₂_mem_iff_coefficients _ W.state.P.coord).mpr _ t + intro α + exact W.terminal_coefficients_mem_rational_stepDrop hs hF α + +end NilpotentLieFiltration +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/StepOneSymbolLinearPart.lean b/lean/OAI/Combinatorics/Progressions/Estimates/StepOneSymbolLinearPart.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6b25fc5d8c5af13e4b79ce1e4ceff5874c6ad9e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/StepOneSymbolLinearPart.lean @@ -0,0 +1,171 @@ +import OAI.Combinatorics.Progressions.Fourier.BoundedFrequencyKernel + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial CircleFourier +open scoped TensorProduct BigOperators + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] + +noncomputable def stepOneFrequencyKernel (F : NilpotentLieFiltration L 1) (η : L →ₗ[ℚ] ℚ) : + LieSubalgebra ℚ L := + { LinearMap.ker η with + lie_mem' := fun {a b} _ _ => by + change η ⁅a, b⁆ = 0 + rw [F.stepOne_lie_eq_zero, map_zero] } + +theorem mem_real_stepOneFrequencyKernel (F : NilpotentLieFiltration L 1) (η : L →ₗ[ℚ] ℚ) + (x : ℝ ⊗[ℚ] L) : + x ∈ realificationLieSubalgebra (F.stepOneFrequencyKernel η) ↔ realifyFunctional η x = 0 := + mem_realified_frequency_kernel_iff η x + +theorem exists_stepOne_linear_splitting {σ ι : Type*} [Fintype σ] [DecidableEq σ] + (F : NilpotentLieFiltration L 1) (b : Basis ι ℚ L) + (η : L →ₗ[ℚ] ℚ) {H : ℕ} (hH : 1 ≤ H) + (hheight : ∀ i, RationalHeightLE (η (b i)) H) + (T : σ → ℕ) (hT : ∀ i, 0 < T i) (a : σ → ℝ ⊗[ℚ] L) + {δ : ℝ} (hδ : 0 < δ) + (hbias : δ ≤ ‖linearPhaseMean T (fun i => (realifyFunctional η (a i) : CircleFourier.Circle))‖) : + ∃ (m : ℕ) (E P R : (F.realification.adaptedPolynomialFiltration (fun _ : σ => 1)).Group), + 0 < m ∧ m ≤ H ∧ E * P * R = F.realification.linearPolynomialGroup a ∧ + F.PolynomialSlowBound b (fun _ => 1) (fun i => (T i : ℝ)) ((H : ℝ) / (2 * δ)) E ∧ + F.PolynomialRationalGrid b (fun _ => 1) m R ∧ + (∀ t : σ → ℝ, eval₂ t (P.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) ∈ + realificationLieSubalgebra (F.stepOneFrequencyKernel η)) ∧ + coefficients (P.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) 0 = 0 := by + obtain ⟨m, e, p, r, hm, hmH, hsum, hp, he, hr⟩ := + exists_linear_frequency_splitting b η hH hheight T hT a hδ hbias + let E := F.realification.linearPolynomialGroup e + let P := F.realification.linearPolynomialGroup p + let R := F.realification.linearPolynomialGroup r + refine ⟨m, E, P, R, hm, hmH, ?_, ?_, F.polynomialRationalGrid_linear b m r hr, ?_, ?_⟩ + · apply NilpotentLieBCHGroup.ext + rw [(F.realification.adaptedPolynomialFiltration (fun _ : σ => 1)).stepOne_coord_mul, + (F.realification.adaptedPolynomialFiltration (fun _ : σ => 1)).stepOne_coord_mul] + apply Subtype.ext + change linearPolynomial e + linearPolynomial p + linearPolynomial r = linearPolynomial a + rw [← map_add, ← map_add] + congr 1 + funext i + exact hsum i + · apply F.polynomialSlowBound_linear b (fun i => (T i : ℝ)) (fun i => Nat.cast_pos.mpr (hT i)) + (div_nonneg (Nat.cast_nonneg H) (by positivity)) + intro i j + apply (he i j).trans_eq + field_simp + · intro t + rw [F.mem_real_stepOneFrequencyKernel] + change realifyFunctional η (eval₂ t (linearPolynomial p)) = 0 + simp only [eval₂_linearPolynomial, map_sum, map_smul, hp, smul_zero, Finset.sum_const_zero] + · exact coefficients_linearPolynomial_zero p + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L 1) (b : Basis ι ℚ L) + +theorem stepOne_basis_layers (j : ℕ) : + F.layer j = Submodule.span ℚ (b '' {i | j ≤ (fun _ : ι => 1) i}) := by + by_cases hj : j ≤ 1 + · have htop : F.layer j = ⊤ := top_unique (F.one_eq_top ▸ F.antitone hj) + simpa only [hj, Set.ofPred_true, Set.image_univ, b.span_eq] using htop + · have hbot : F.layer j = ⊥ := bot_unique ((F.antitone (by omega : 2 ≤ j)).trans F.terminal.le) + simpa only [hj, Set.ofPred_false, Set.image_empty, Submodule.span_empty] using hbot + +variable (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +include F b hlayers in +theorem stepOne_basis_weight (i : ι) : ω i = 1 := by + have hpos := F.adaptedBasis_weight_pos b ω hlayers i + have hle := F.adaptedBasis_weight_le_step b ω hlayers i + omega + +noncomputable def stepOneGradedEquiv : L ≃ₗ⁅ℚ⁆ F.AssociatedGraded := + { b.repr.trans (F.associatedGradedBasis b ω hlayers).repr.symm with + map_lie' {x y} := by + rw [F.stepOne_lie_eq_zero, F.associatedGradedFiltration.stepOne_lie_eq_zero] + exact map_zero (b.repr.trans (F.associatedGradedBasis b ω hlayers).repr.symm) } + +@[simp] theorem stepOneGradedEquiv_coordinate (x : L) (i : ι) : + (F.associatedGradedBasis b ω hlayers).repr (F.stepOneGradedEquiv b ω hlayers x) i = + b.repr x i := by + change (F.associatedGradedBasis b ω hlayers).repr + ((F.associatedGradedBasis b ω hlayers).repr.symm (b.repr x)) i = _ + rw [LinearEquiv.apply_symm_apply] + +theorem stepOne_gradedPieceProjection (j : ℕ) (x : L) : + F.gradedPieceProjection b ω hlayers j x = + if j = 1 then F.stepOneGradedEquiv b ω hlayers x else 0 := by + classical + apply (F.associatedGradedBasis b ω hlayers).repr.injective + ext i + rw [F.gradedPieceProjection_coordinate, F.stepOne_basis_weight b ω hlayers i] + by_cases hj : j = 1 + · simp only [hj, ite_true, F.stepOneGradedEquiv_coordinate] + · simp only [hj, Ne.symm hj, ite_false, map_zero, Finsupp.zero_apply] + +theorem stepOne_graded_submodule (U : Submodule ℚ F.AssociatedGraded) : + BasisGradedSubmodule (F.associatedGradedBasis b ω hlayers) ω U := by + intro j x hx + have he : basisGradeProjection (F.associatedGradedBasis b ω hlayers) ω j x = + if j = 1 then x else 0 := by + classical + apply (F.associatedGradedBasis b ω hlayers).repr.injective + ext i + rw [basisGradeProjection_repr, F.stepOne_basis_weight b ω hlayers i] + by_cases hj : j = 1 + · simp only [hj, ite_true] + · simp only [hj, Ne.symm hj, ite_false, map_zero, Finsupp.zero_apply] + rw [he] + split_ifs + · exact hx + · exact U.zero_mem + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L 1) + +theorem stepOne_symbol_linearPart (p : F.adaptedLieSubalgebra (fun _ : σ => 1)) : + F.polynomialSymbolMap (fun _ => 1) + (F.linearPolynomialGroup (fun i => coefficients p.val (Finsupp.single i 1))).coord = + F.polynomialSymbolMap (fun _ => 1) p := by + have hp : DegreeLE (fun _ : σ => 1) 1 p.val := + F.adapted_degreeLE _ ((F.mem_adaptedSubmodule _ _).mp p.property) + have he : F.adaptedConstant (fun _ : σ => 1) (coefficients p.val 0) + + (F.linearPolynomialGroup (fun i => coefficients p.val (Finsupp.single i 1))).coord = p := by + apply Subtype.ext + exact (eq_affine_of_degreeLE_one p.val hp).symm + calc + _ = F.polynomialSymbolMap (fun _ : σ => 1) + (F.adaptedConstant (fun _ : σ => 1) (coefficients p.val 0) + + (F.linearPolynomialGroup (fun i => coefficients p.val (Finsupp.single i 1))).coord) := by + rw [map_add, F.polynomialSymbolMap_constant, zero_add] + _ = _ := congrArg (F.polynomialSymbolMap (fun _ : σ => 1)) he + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/StrideProductBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/StrideProductBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..83e73a900768431a71ee80376d8f8b83c229d1b8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/StrideProductBounds.lean @@ -0,0 +1,473 @@ +import OAI.Combinatorics.Progressions.Polynomial.MultiaffinePolynomialBias + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem additiveBoxDifference_const_mul {R Z : Type*} [CommRing R] + (n : ℕ) {X : Fin n → Type*} (a : R) (F : (∀ i, X i) → Z → R) + (u v : ∀ i, X i) (z : Z) : + additiveBoxDifference n (fun x t => a*F x t) u v z = + a*additiveBoxDifference n F u v z := by + induction n with + | zero => rfl + | succ n ih => + simp only [additiveBoxDifference, ← mul_sub] + exact ih _ (Fin.tail u) (Fin.tail v) + +theorem additiveBoxDifference_booleanCoefficient {R Z α : Type*} [CommRing R] + [DecidableEq α] (n : ℕ) {X : Fin n → Type*} + (F : Finset α → (∀ i, X i) → Z → R) (s : Finset α) + (u v : ∀ i, X i) (z : Z) : + additiveBoxDifference n (fun x t => booleanCoefficient (fun r => F r x t) s) u v z = + booleanCoefficient (fun r => additiveBoxDifference n (F r) u v z) s := by + unfold booleanCoefficient + rw [additiveBoxDifference_sum] + simp_rw [additiveBoxDifference_const_mul] + +theorem full_coefficient_eq_mixed_difference {n : ℕ} (P : MvPolynomial (Fin n) ℝ) + (hP : ∀ i, P.degreeOf i ≤ 1) : + P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin n))).val = + additiveBoxDifference n (fun x (_ : Unit) => MvPolynomial.eval x P) + (fun _ => 1) (fun _ => 0) () := by + have he : (fun x (_ : Unit) => MvPolynomial.eval x P) = + (fun x (_ : Unit) => multiaffineExpansion + (fun S => P.coeff (SquarefreeIndex.ofFinset S).val) x) := by + funext x t + exact multiaffinePolynomial_eval P hP x + rw [he] + have h := multiaffineExpansion_box_difference n (X := fun _ => ℝ) + (fun S (_ : Unit) => P.coeff (SquarefreeIndex.ofFinset S).val) + (fun _ (x : ℝ) => x) (fun _ => 1) (fun _ => 0) () + simpa using h.symm + +theorem affine_product_full_difference (n : ℕ) (a b : Fin n → ℝ) : + additiveBoxDifference n (fun x (_ : Unit) => ∏ i, (a i*x i+b i)) + (fun _ => 1) (fun _ => 0) () = ∏ i, a i := by + have h := additiveBoxDifference_product n (X := fun _ => ℝ) (fun _ : Unit => (1 : ℝ)) + (fun i (x : ℝ) => a i*x+b i) (fun _ => 1) (fun _ => 0) () + simpa using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem frozenBooleanBlock_full_difference {α : Type*} [Fintype α] [DecidableEq α] + (n : ℕ) (label : Fin n → Option α) (c : Fin n → Option α → ℝ) (t : Finset α) : + additiveBoxDifference n + (fun x (_ : Unit) => booleanBlockValue (resampleGroupCoordinates label c x) t) + (fun _ => 1) (fun _ => 0) () = ∏ i, (booleanFeature (label i) t : ℝ) := by + simp_rw [booleanBlockValue_resample] + exact affine_product_full_difference n _ _ + +theorem frozenBooleanJet_full_difference {α : Type*} [Fintype α] [DecidableEq α] + (n : ℕ) (label : Fin n → Option α) (c : Fin n → Option α → ℝ) + (S s : Finset α) (hlabel : ∀ a, (∃ i, label i = some a) ↔ a ∈ S) : + additiveBoxDifference n + (fun x (_ : Unit) => booleanCoefficient + (fun t => booleanBlockValue (resampleGroupCoordinates label c x) t) s) + (fun _ => 1) (fun _ => 0) () = if s=S then 1 else 0 := by + rw [additiveBoxDifference_booleanCoefficient] + simp_rw [frozenBooleanBlock_full_difference, booleanFeature_product label S hlabel] + exact booleanCoefficient_monomial S s + +theorem frozenBooleanPhase_full_difference {α : Type*} [Fintype α] [DecidableEq α] + (n : ℕ) (label : Fin n → Option α) (c : Fin n → Option α → ℝ) + (ξ : Finset α → ℝ) (S : Finset α) + (hlabel : ∀ a, (∃ i, label i = some a) ↔ a ∈ S) : + additiveBoxDifference n + (fun x (_ : Unit) => booleanBlockPhase ξ (resampleGroupCoordinates label c x)) + (fun _ => 1) (fun _ => 0) () = ξ S := by + unfold booleanBlockPhase + rw [additiveBoxDifference_sum] + simp_rw [additiveBoxDifference_const_mul, + frozenBooleanJet_full_difference n label c S _ hlabel] + simp + +theorem frozenBooleanPhasePolynomial_coefficient {α : Type*} [Fintype α] [DecidableEq α] + (n : ℕ) (label : Fin n → Option α) (c : Fin n → Option α → ℝ) + (ξ : Finset α → ℝ) (S : Finset α) + (hlabel : ∀ a, (∃ i, label i = some a) ↔ a ∈ S) : + (frozenBooleanPhasePolynomial label c ξ).coeff + (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin n))).val = ξ S := by + rw [full_coefficient_eq_mixed_difference _ (frozenBooleanPhasePolynomial_degree label c ξ)] + have he : (fun x (_ : Unit) => MvPolynomial.eval x (frozenBooleanPhasePolynomial label c ξ)) = + (fun x (_ : Unit) => booleanBlockPhase ξ (resampleGroupCoordinates label c x)) := by + funext x t + exact frozenBooleanPhasePolynomial_eval label c ξ x + rw [he] + exact frozenBooleanPhase_full_difference n label c ξ S hlabel + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators Classical + +theorem full_mixed_difference_of_totalDegree {R : Type*} [CommRing R] {n : ℕ} + (P : MvPolynomial (Fin n) R) (hP : P.totalDegree ≤ n) (u v : Fin n → R) : + additiveBoxDifference n (fun x (_ : Unit) => eval x P) u v () = + P.coeff (fullShiftExponent n) * ∏ i, (u i - v i) := by + have he : (fun x (_ : Unit) => eval x P) = + (fun x (_ : Unit) => ∑ d ∈ P.support, P.coeff d * ∏ i, x i ^ d i) := by + funext x _ + conv_lhs => rw [P.as_sum] + simp only [map_sum, eval_monomial, Finsupp.prod_pow] + rw [he, additiveBoxDifference_sum] + have hm (d : Fin n →₀ ℕ) : + additiveBoxDifference n (fun x (_ : Unit) => P.coeff d * ∏ i, x i ^ d i) u v () = + P.coeff d * ∏ i, (u i ^ d i - v i ^ d i) := + additiveBoxDifference_product n (fun _ : Unit => P.coeff d) (fun i x => x ^ d i) u v () + simp_rw [hm] + rw [Finset.sum_eq_single (fullShiftExponent n)] + · simp only [fullShiftExponent_apply, pow_one] + · intro d hd hne + obtain ⟨i, hi⟩ := (exponent_eq_full_or_missing d ((le_totalDegree hd).trans hP)).resolve_left hne + rw [Finset.prod_eq_zero (Finset.mem_univ i) (by simp only [hi, pow_zero, sub_self]), mul_zero] + · intro hnot + rw [notMem_support_iff.mp hnot, zero_mul] + +theorem full_coefficient_eq_mixed_difference_of_totalDegree {R : Type*} [CommRing R] {n : ℕ} + (P : MvPolynomial (Fin n) R) (hP : P.totalDegree ≤ n) : + P.coeff (fullShiftExponent n) = + additiveBoxDifference n (fun x (_ : Unit) => eval x P) (fun _ => 1) (fun _ => 0) () := by + rw [full_mixed_difference_of_totalDegree P hP] + simp + +theorem mixed_difference_eq_zero_of_totalDegree_lt {R : Type*} [CommRing R] {n : ℕ} + (P : MvPolynomial (Fin n) R) (hP : P.totalDegree < n) (u v : Fin n → R) : + additiveBoxDifference n (fun x (_ : Unit) => eval x P) u v () = 0 := by + have hz : P.coeff (fullShiftExponent n) = 0 := by + apply coeff_eq_zero_of_totalDegree_lt + change P.totalDegree < (fullShiftExponent n).sum (fun _ e => e) + rwa [fullShiftExponent_sum] + rw [full_mixed_difference_of_totalDegree P hP.le, hz, zero_mul] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def diagonalMultiaffineScaling {n : ℕ} (P : MvPolynomial (Fin n) ℝ) + (s : Fin n → ℝ) : MvPolynomial (Fin n) ℝ := + subsetPolynomial (fun S => P.coeff (SquarefreeIndex.ofFinset S).val * ∏ i ∈ S, s i) + +theorem diagonalMultiaffineScaling_degree {n : ℕ} (P : MvPolynomial (Fin n) ℝ) + (s : Fin n → ℝ) (i : Fin n) : (diagonalMultiaffineScaling P s).degreeOf i ≤ 1 := + subsetPolynomial_degree _ _ + +theorem diagonalMultiaffineScaling_top {n : ℕ} (P : MvPolynomial (Fin n) ℝ) + (s : Fin n → ℝ) : + (diagonalMultiaffineScaling P s).coeff + (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin n))).val = + P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin n))).val * ∏ i, s i := by + exact subsetPolynomial_coefficient _ _ + +theorem diagonalMultiaffineScaling_eval {n : ℕ} (P : MvPolynomial (Fin n) ℝ) + (hP : ∀ i, P.degreeOf i ≤ 1) (s x : Fin n → ℝ) : + MvPolynomial.eval x (diagonalMultiaffineScaling P s) = + MvPolynomial.eval (fun i => s i*x i) P := by + rw [diagonalMultiaffineScaling, subsetPolynomial_eval, multiaffinePolynomial_eval P hP] + unfold multiaffineExpansion + simp only [Finset.prod_ite_mem_eq] + apply Finset.sum_congr rfl + intro S _ + rw [Finset.prod_mul_distrib] + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem fullSquarefreeExponent_map_equiv {ι κ : Type*} [Fintype ι] [Fintype κ] + (e : ι ≃ κ) : + (SquarefreeIndex.ofFinset (Finset.univ : Finset ι)).val.mapDomain e = + (SquarefreeIndex.ofFinset (Finset.univ : Finset κ)).val := by + ext j + obtain ⟨i,rfl⟩ := e.surjective j + rw [Finsupp.mapDomain_apply_of_injective e.injective] + simp [SquarefreeIndex.ofFinset_apply] + +theorem fin_multiaffine_polynomial_bias {n : ℕ} (P : MvPolynomial (Fin (n+1)) ℝ) + (hP : ∀ i, P.degreeOf i ≤ 1) (N : Fin (n+1) → ℕ) (u : Fin (n+1) → ℝ) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ i, multiaffineBiasBudget n ζ ≤ N i) + (hbias : ζ ≤ ‖𝔼 x : ∀ i, Fin (N i), + character ((MvPolynomial.eval (fun i => u i+((x i).val : ℝ)) P : ℝ) : CircleFourier.Circle)‖) : + ∃ q : ℕ, 0 < q ∧ (q : ℝ) ≤ multiaffineBiasBudget n ζ ∧ + ∃ m : ℤ, |P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin (n+1)))).val- + (m : ℝ)/q| ≤ multiaffineBiasBudget n ζ / ∏ i, (N i : ℝ) := by + let e := _root_.finSuccEquiv n + let Q := MvPolynomial.rename e P + have hQ : ∀ j, Q.degreeOf j ≤ 1 := by + intro j + obtain ⟨i,rfl⟩ := e.surjective j + rw [MvPolynomial.degreeOf_rename_of_injective e.injective] + exact hP i + have heval (x : ∀ i : Fin n, Fin (N i.succ)) (t : Fin (N 0)) : + MvPolynomial.eval + (fun j => Option.elim j (u 0+(t.val : ℝ)) (fun i => u i.succ+((x i).val : ℝ))) Q = + MvPolynomial.eval + (fun i => u i+(((Fin.cons t x : ∀ j : Fin (n+1), Fin (N j)) i).val : ℝ)) P := by + rw [MvPolynomial.eval_rename] + apply congrArg (fun z : Fin (n+1) → ℝ => MvPolynomial.eval z P) + funext i + refine Fin.cases ?_ (fun j => ?_) i + · simp [e] + · simp [e] + rw [expect_dependent_fin_cons, Finset.expect_comm] at hbias + simp_rw [← heval] at hbias + have h := multiaffine_polynomial_bias Q hQ (fun i => N i.succ) (N 0) + (fun i => u i.succ) (u 0) hζ (fun i => hN i.succ) (hN 0) hbias + have hcoeff : Q.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Option (Fin n)))).val = + P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin (n+1)))).val := by + rw [← fullSquarefreeExponent_map_equiv e, MvPolynomial.coeff_rename_mapDomain e e.injective] + simpa only [hcoeff, Fin.prod_univ_succ] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem booleanBlockPhase_selected_entry {n : ℕ} {α : Type*} [Fintype α] [DecidableEq α] + (N : Fin (n+1) → Option α → ℕ) (u : Fin (n+1) → Option α → ℝ) + (ξ : Finset α → ℝ) (label : Fin (n+1) → Option α) (S : Finset α) + (hlabel : ∀ a, (∃ i, label i = some a) ↔ a ∈ S) + (hNpos : ∀ g r, 0 < N g r) {ζ : ℝ} (hζ : 0 < ζ) + (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g (label g)) + (hbias : ζ ≤ ‖𝔼 x : ∀ g r, Fin (N g r), + character ((booleanBlockPhase ξ (fun g r => u g r+((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ q : ℕ, 0 < q ∧ (q : ℝ) ≤ multiaffineBiasBudget n ζ ∧ + ∃ m : ℤ, |ξ S-(m : ℝ)/q| ≤ + multiaffineBiasBudget n ζ / ∏ g, (N g (label g) : ℝ) := by + let : ∀ g r, Nonempty (Fin (N g r)) := fun g r => ⟨⟨0,hNpos g r⟩⟩ + let F := fun x : ∀ g r, Fin (N g r) => + character ((booleanBlockPhase ξ (fun g r => u g r+((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle) + obtain ⟨c,hc⟩ := exists_frozen_group_bias label F hbias + let b := fun g r => u g r+((c g r).val : ℝ) + let P := frozenBooleanPhasePolynomial label b ξ + have hphase (t : ∀ g, Fin (N g (label g))) : + F (resampleGroupCoordinates label c t) = + character ((MvPolynomial.eval (fun g => u g (label g)+((t g).val : ℝ)) P : ℝ) : + CircleFourier.Circle) := by + dsimp only [F,P] + rw [frozenBooleanPhasePolynomial_eval] + dsimp only [b] + rw [intervalCoordinates_resample] + simp_rw [hphase] at hc + have h := fin_multiaffine_polynomial_bias P (frozenBooleanPhasePolynomial_degree label b ξ) + (fun g => N g (label g)) (fun g => u g (label g)) hζ hN hc + simpa only [P, frozenBooleanPhasePolynomial_coefficient (n+1) label b ξ S hlabel] using h + +theorem booleanBlockPhase_entry_approximation {n : ℕ} {α : Type*} [Fintype α] [DecidableEq α] + (N : Fin (n+1) → ℕ) (u : Fin (n+1) → Option α → ℝ) (ξ : Finset α → ℝ) + (S : Finset α) (hS : S.card ≤ n+1) {ζ : ℝ} (hζ : 0 < ζ) + (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g) + (hbias : ζ ≤ ‖𝔼 x : ∀ g, Option α → Fin (N g), + character ((booleanBlockPhase ξ (fun g r => u g r+((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ q : ℕ, 0 < q ∧ (q : ℝ) ≤ multiaffineBiasBudget n ζ ∧ + ∃ m : ℤ, |ξ S-(m : ℝ)/q| ≤ multiaffineBiasBudget n ζ / ∏ g, (N g : ℝ) := by + obtain ⟨label,hlabel⟩ := exists_padded_boolean_labels S (n+1) hS + have hNp : ∀ g, 0 < N g := fun g => by + exact_mod_cast (multiaffineBiasBudget_pos n hζ).trans_le (hN g) + exact booleanBlockPhase_selected_entry (fun g _ => N g) u ξ label S hlabel + (fun g _ => hNp g) hζ hN hbias + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem fin_multiaffine_strided_bias {n : ℕ} (P : MvPolynomial (Fin (n+1)) ℝ) + (hP : ∀ i, P.degreeOf i ≤ 1) (N s : Fin (n+1) → ℕ) (hs : ∀ i, 0 < s i) + (u : Fin (n+1) → ℝ) {ζ : ℝ} (hζ : 0 < ζ) + (hN : ∀ i, multiaffineBiasBudget n ζ ≤ N i) + (hbias : ζ ≤ ‖𝔼 x : ∀ i, Fin (N i), + character ((MvPolynomial.eval (fun i => u i+(s i : ℝ)*((x i).val : ℝ)) P : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * ∏ i, (s i : ℝ) ∧ + ∃ m : ℤ, |P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin (n+1)))).val- + (m : ℝ)/D| ≤ multiaffineBiasBudget n ζ / ∏ i, ((s i : ℝ)*(N i : ℝ)) := by + let A := diagonalMultiaffineScaling P (fun i => (s i : ℝ)) + have hsr : ∀ i, (0 : ℝ) < s i := fun i => by exact_mod_cast hs i + have heval (x : ∀ i, Fin (N i)) : + MvPolynomial.eval (fun i => u i/(s i : ℝ)+((x i).val : ℝ)) A = + MvPolynomial.eval (fun i => u i+(s i : ℝ)*((x i).val : ℝ)) P := by + rw [diagonalMultiaffineScaling_eval P hP] + apply congrArg (fun z : Fin (n+1) → ℝ => MvPolynomial.eval z P) + funext i + rw [mul_add, mul_div_cancel₀ _ (hsr i).ne'] + obtain ⟨q,hq,hqQ,m,hm⟩ := fin_multiaffine_polynomial_bias A + (diagonalMultiaffineScaling_degree P _) N (fun i => u i/(s i : ℝ)) hζ hN + (by simpa only [heval] using hbias) + let S := ∏ i, s i + have hSp : 0 < S := Finset.prod_pos (fun i _ => hs i) + have hSr : (0 : ℝ) < S := by exact_mod_cast hSp + have hqr : (0 : ℝ) < q := by exact_mod_cast hq + have happrox : |P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin (n+1)))).val* + (S : ℝ)-(m : ℝ)/q| ≤ multiaffineBiasBudget n ζ / ∏ i, (N i : ℝ) := by + simpa only [A, diagonalMultiaffineScaling_top, S, Nat.cast_prod] using hm + refine ⟨q*S,Nat.mul_pos hq hSp,?_,m,?_⟩ + · simpa only [Nat.cast_mul, S, Nat.cast_prod] using mul_le_mul_of_nonneg_right hqQ hSr.le + · have he : P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin (n+1)))).val- + (m : ℝ)/(q*S : ℕ) = + (P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin (n+1)))).val* + (S : ℝ)-(m : ℝ)/q)/S := by + push_cast + field_simp + rw [he, abs_div, abs_of_pos hSr] + apply (div_le_div_of_nonneg_right happrox hSr.le).trans_eq + rw [div_div, Finset.prod_mul_distrib] + simp only [S, Nat.cast_prod] + congr 1 + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped BigOperators Classical + +theorem multilinear_slice_bias_approximation {M : Type*} [AddCommGroup M] [Module ℝ M] + {n : ℕ} (F : MultilinearMap ℝ (fun _ : Fin (n + 1) => M) ℝ) + (b w : Fin (n + 1) → M) (N s : Fin (n + 1) → ℕ) + (hs : ∀ i, 0 < s i) (u : Fin (n + 1) → ℝ) {ζ : ℝ} (hζ : 0 < ζ) + (hN : ∀ i, multiaffineBiasBudget n ζ ≤ N i) + (hbias : ζ ≤ ‖𝔼 x : ∀ i, Fin (N i), + character ((F (fun i => b i + (u i + (s i : ℝ) * ((x i).val : ℝ)) • w i) : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * ∏ i, (s i : ℝ) ∧ + ∃ m : ℤ, |F w - (m : ℝ) / D| ≤ + multiaffineBiasBudget n ζ / ∏ i, ((s i : ℝ) * (N i : ℝ)) := by + have hb : ζ ≤ ‖𝔼 x : ∀ i, Fin (N i), + character ((MvPolynomial.eval (fun i => u i + (s i : ℝ) * ((x i).val : ℝ)) + (multilinearSlicePolynomial F b w) : ℝ) : CircleFourier.Circle)‖ := by + simpa only [multilinearSlicePolynomial_eval] using hbias + have h := fin_multiaffine_strided_bias (multilinearSlicePolynomial F b w) + (multilinearSlicePolynomial_degree F b w) N s hs u hζ hN hb + simpa only [multilinearSlicePolynomial_top] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem booleanBlockPhase_strided_selected_entry {n : ℕ} {α : Type*} + [Fintype α] [DecidableEq α] + (N s : Fin (n+1) → Option α → ℕ) (u : Fin (n+1) → Option α → ℝ) + (ξ : Finset α → ℝ) (label : Fin (n+1) → Option α) (S : Finset α) + (hlabel : ∀ a, (∃ i, label i = some a) ↔ a ∈ S) + (hNpos : ∀ g r, 0 < N g r) (hs : ∀ g, 0 < s g (label g)) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g (label g)) + (hbias : ζ ≤ ‖𝔼 x : ∀ g r, Fin (N g r), + character ((booleanBlockPhase ξ (fun g r => u g r+(s g r : ℝ)*((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * ∏ g, (s g (label g) : ℝ) ∧ + ∃ m : ℤ, |ξ S-(m : ℝ)/D| ≤ multiaffineBiasBudget n ζ / + ∏ g, ((s g (label g) : ℝ)*(N g (label g) : ℝ)) := by + let : ∀ g r, Nonempty (Fin (N g r)) := fun g r => ⟨⟨0,hNpos g r⟩⟩ + let F := fun x : ∀ g r, Fin (N g r) => + character ((booleanBlockPhase ξ (fun g r => u g r+(s g r : ℝ)*((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle) + obtain ⟨c,hc⟩ := exists_frozen_group_bias label F hbias + let b := fun g r => u g r+(s g r : ℝ)*((c g r).val : ℝ) + let P := frozenBooleanPhasePolynomial label b ξ + have hphase (t : ∀ g, Fin (N g (label g))) : + F (resampleGroupCoordinates label c t) = + character ((MvPolynomial.eval + (fun g => u g (label g)+(s g (label g) : ℝ)*((t g).val : ℝ)) P : ℝ) : + CircleFourier.Circle) := by + dsimp only [F,P] + rw [frozenBooleanPhasePolynomial_eval] + dsimp only [b] + rw [progressionCoordinates_resample] + simp_rw [hphase] at hc + have h := fin_multiaffine_strided_bias P (frozenBooleanPhasePolynomial_degree label b ξ) + (fun g => N g (label g)) (fun g => s g (label g)) hs (fun g => u g (label g)) hζ hN hc + simpa only [P, frozenBooleanPhasePolynomial_coefficient (n+1) label b ξ S hlabel] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem stride_product_le {I : Type*} [Fintype I] (s : I → ℕ) {R : ℝ} + (hs : ∀ i, (s i : ℝ) ≤ R) : (∏ i, (s i : ℝ)) ≤ R^Fintype.card I := by + calc + _ ≤ ∏ _i : I, R := Finset.prod_le_prod₀ (fun i _ => Nat.cast_nonneg _) (fun i _ => hs i) + _ = _ := by simp + +theorem stride_product_error_le {I : Type*} [Fintype I] (N s : I → ℕ) + (hN : ∀ i, 0 < N i) (hs : ∀ i, 0 < s i) {C A : ℝ} (hC : 0 < C) (hA : 0 ≤ A) : + A/(C*∏ i, ((s i : ℝ)*(N i : ℝ))) ≤ A/(C*∏ i, (N i : ℝ)) := by + have hp : (0 : ℝ) < ∏ i, (N i : ℝ) := + Finset.prod_pos (fun i _ => by exact_mod_cast hN i) + apply div_le_div_of_nonneg_left hA (mul_pos hC hp) + apply mul_le_mul_of_nonneg_left _ hC.le + apply Finset.prod_le_prod₀ (fun i _ => Nat.cast_nonneg _) + intro i _ + have hsi : (1 : ℝ) ≤ s i := by exact_mod_cast hs i + exact le_mul_of_one_le_left (Nat.cast_nonneg _) hsi + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/StrongRefiltrationReconstruction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/StrongRefiltrationReconstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..eab53b3c186b34bc994b8f14c2ec5584108b051f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/StrongRefiltrationReconstruction.lean @@ -0,0 +1,646 @@ +import OAI.Combinatorics.Progressions.Estimates.OptionMarkedSurjective +import OAI.Combinatorics.Progressions.Estimates.RealifiedTopQuotient + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s t : ℕ} + (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M t) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (f : Basis κ ℚ M) (ν : κ → ℕ) + (hG : ∀ j, G.layer j = Submodule.span ℚ (f '' {i | j ≤ ν i})) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) (w : σ → ℕ) + +theorem symbolPointwiseSubalgebra_mono {U V : LieSubalgebra ℚ F.AssociatedGraded} (hUV : U ≤ V) : + F.symbolPointwiseSubalgebra e ω hF w U ≤ F.symbolPointwiseSubalgebra e ω hF w V := by + intro x hx + exact fun α => hUV ((F.mem_symbolPointwiseSubalgebra_iff e ω hF w U x).mp hx α) + +theorem symbolPointwiseSubalgebra_map_le (U : LieSubalgebra ℚ F.AssociatedGraded) : + (F.symbolPointwiseSubalgebra e ω hF w U).map (F.filteredPolynomialSymbolMap G φ hφ w) ≤ + G.symbolPointwiseSubalgebra f ν hG w (U.map (F.associatedGradedMap G φ hφ)) := by + rintro _ ⟨x, hx, rfl⟩ + apply (G.mem_symbolPointwiseSubalgebra_iff f ν hG w _ _).mpr + intro α + simp only [LieHom.coe_toLinearMap] + have hm : F.associatedGradedMap G φ hφ (coefficients (F.gradedSymbolPolynomial e ω hF w x) α) ∈ + U.map (F.associatedGradedMap G φ hφ) := + ⟨_, (F.mem_symbolPointwiseSubalgebra_iff e ω hF w U x).mp hx α, rfl⟩ + rw [F.gradedSymbolPolynomial_filteredMap_coefficient G e ω hF f ν hG φ hφ w x α] + exact hm + +theorem symbolPointwiseSubalgebra_comap (U : LieSubalgebra ℚ G.AssociatedGraded) : + (G.symbolPointwiseSubalgebra f ν hG w U).comap (F.filteredPolynomialSymbolMap G φ hφ w) = + F.symbolPointwiseSubalgebra e ω hF w (U.comap (F.associatedGradedMap G φ hφ)) := by + ext x + constructor + · intro hx + simp only [LieSubalgebra.mem_comap] at hx + apply (F.mem_symbolPointwiseSubalgebra_iff e ω hF w _ x).mpr + intro α + have hm := (G.mem_symbolPointwiseSubalgebra_iff f ν hG w U + (F.filteredPolynomialSymbolMap G φ hφ w x)).mp hx α + rw [F.gradedSymbolPolynomial_filteredMap_coefficient G e ω hF f ν hG φ hφ w x α] at hm + exact hm + · intro hx + simp only [LieSubalgebra.mem_comap] + apply (G.mem_symbolPointwiseSubalgebra_iff f ν hG w U _).mpr + intro α + have hm : F.associatedGradedMap G φ hφ (coefficients (F.gradedSymbolPolynomial e ω hF w x) α) ∈ U := + (F.mem_symbolPointwiseSubalgebra_iff e ω hF w _ x).mp hx α + rw [F.gradedSymbolPolynomial_filteredMap_coefficient G e ω hF f ν hG φ hφ w x α] + exact hm + +theorem symbolPointwiseSubalgebra_map [Fintype (SymbolBasisIndex w ν)] + (U : LieSubalgebra ℚ F.AssociatedGraded) + (hU : BasisGradedSubmodule (F.associatedGradedBasis e ω hF) ω U.toSubmodule) : + (F.symbolPointwiseSubalgebra e ω hF w U).map (F.filteredPolynomialSymbolMap G φ hφ w) = + G.symbolPointwiseSubalgebra f ν hG w (U.map (F.associatedGradedMap G φ hφ)) := by + classical + apply le_antisymm (F.symbolPointwiseSubalgebra_map_le G e ω hF f ν hG φ hφ w U) + intro x hx + change x ∈ ((F.symbolPointwiseSubalgebra e ω hF w U).map + (F.filteredPolynomialSymbolMap G φ hφ w)).toSubmodule + rw [← sum_basisBlockProjection (G.polynomialSymbolBasis f ν hG w) (fun z => z.val.1) x] + apply Submodule.sum_mem + intro α _ + obtain ⟨v, hv, he⟩ := (G.mem_symbolPointwiseSubalgebra_iff f ν hG w _ x).mp hx α + refine ⟨F.homogeneousSymbolLift e ω hF w α v, + F.homogeneousSymbolLift_mem_pointwise e ω hF w U hU α v hv, ?_⟩ + change F.filteredPolynomialSymbolMap G φ hφ w (F.homogeneousSymbolLift e ω hF w α v) = _ + change F.associatedGradedMap G φ hφ v = _ at he + rw [F.homogeneousSymbolLift_filteredMap G e ω hF f ν hG φ hφ w, he, + G.homogeneousSymbolLift_coefficient] + +theorem associatedGradedMap_image_graded (U : LieSubalgebra ℚ F.AssociatedGraded) + (hU : BasisGradedSubmodule (F.associatedGradedBasis e ω hF) ω U.toSubmodule) : + BasisGradedSubmodule (G.associatedGradedBasis f ν hG) ν + (U.map (F.associatedGradedMap G φ hφ)).toSubmodule := by + rintro j _ ⟨x, hx, rfl⟩ + exact ⟨basisGradeProjection (F.associatedGradedBasis e ω hF) ω j x, hU j x hx, + F.associatedGradedMap_gradeProjection G e ω hF f ν hG φ hφ j x⟩ + +theorem associatedGradedMap_comap_graded (U : LieSubalgebra ℚ G.AssociatedGraded) + (hU : BasisGradedSubmodule (G.associatedGradedBasis f ν hG) ν U.toSubmodule) : + BasisGradedSubmodule (F.associatedGradedBasis e ω hF) ω + (U.comap (F.associatedGradedMap G φ hφ)).toSubmodule := by + intro j x hx + change F.associatedGradedMap G φ hφ + (basisGradeProjection (F.associatedGradedBasis e ω hF) ω j x) ∈ U + rw [F.associatedGradedMap_gradeProjection G e ω hF f ν hG φ hφ] + exact hU j _ hx + +end Erdos3.NilpotentLieFiltration + +end + +section + +universe u v + +namespace Erdos3.RationalFilteredNilmanifold + +variable {ι : Type v} {H : Type u} {L : ι → Type u} + [LieRing H] [LieAlgebra ℚ H] [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] + +theorem quotient_markedDiagram_injective {s : ℕ} + (E : NilpotentLieFiltration H (s + 1)) (ψ : ∀ i, H →ₗ⁅ℚ⁆ L i) + (hker : ∀ x : H, x ∈ E.layer (s + 1) → (∀ i, ψ i x = 0) → x = 0) : + Function.Injective (optionProductMap (lieQuotientMap (E.layerIdeal (s + 1))) ψ) := by + intro x y hxy + apply sub_eq_zero.mp + apply hker (x - y) + · have hq : lieQuotientMap (E.layerIdeal (s + 1)) x = + lieQuotientMap (E.layerIdeal (s + 1)) y := congrFun hxy none + apply (E.mem_layerIdeal (s + 1) (x - y)).mp + apply (lieQuotientMap_eq_zero (E.layerIdeal (s + 1)) (x - y)).mp + rw [map_sub, hq, sub_self] + · intro i + have hi : ψ i x = ψ i y := congrFun hxy (some i) + rw [map_sub, hi, sub_self] + +theorem refiltered_markedDiagram_injective + {A : Type u} [LieRing A] [LieAlgebra ℚ A] {s d e : ℕ} + (D : RationalFilteredNilmanifold A (s + 1) d) + (W : LieSubalgebra ℚ D.filtration.AssociatedGraded) + (E : RationalFilteredNilmanifold (D.filtration.gradedRefiltrationSubalgebra W) + (s + 1) e) + (hEF : E.filtration = D.filtration.gradedRefiltration W) + (χ : ∀ i, A →ₗ⁅ℚ⁆ L i) + (hker : ∀ x : A, x ∈ D.filtration.gradedRefiltrationLayer W (s + 1) → + (∀ i, χ i x = 0) → x = 0) : + Function.Injective (optionProductMap + (lieQuotientMap (E.filtration.layerIdeal (s + 1))) + (fun i => (χ i).comp (D.filtration.gradedRefiltrationSubalgebra W).incl)) := by + apply quotient_markedDiagram_injective + intro x hx hχ + apply Subtype.ext + apply hker (x : A) + · rw [hEF] at hx + exact (D.filtration.mem_gradedRefiltration_layer W (s + 1) x).mp hx + · exact hχ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module +open scoped TensorProduct + +variable {σ ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s t : ℕ} + (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M t) + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (c : Basis κ ℚ M) (ν : κ → ℕ) + (hG : ∀ j, G.layer j = Submodule.span ℚ (c '' {i | j ≤ ν i})) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) (w : σ → ℕ) + + theorem real_symbolPointwiseSubalgebra_map_mem + (U : LieSubalgebra ℚ F.AssociatedGraded) (x : F.RealPolynomialSymbol w) + (hx : x ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w U)) : + realificationLieHom (F.filteredPolynomialSymbolMap G φ hφ w) x ∈ + realificationLieSubalgebra + (G.symbolPointwiseSubalgebra c ν hG w (U.map (F.associatedGradedMap G φ hφ))) := by + have hmap : realificationLieHom (F.filteredPolynomialSymbolMap G φ hφ w) x ∈ + realificationLieSubalgebra ((F.symbolPointwiseSubalgebra b ω hF w U).map + (F.filteredPolynomialSymbolMap G φ hφ w)) := by + rw [realificationLieSubalgebra_map] + exact ⟨x, hx, rfl⟩ + exact Submodule.baseChange_mono ℝ + (F.symbolPointwiseSubalgebra_map_le G b ω hF c ν hG φ hφ w U) hmap + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s t : ℕ} + (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M t) + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (c : Basis κ ℚ M) (ν : κ → ℕ) + (hG : ∀ j, G.layer j = Submodule.span ℚ (c '' {i | j ≤ ν i})) + (hc : BasisHomogeneousBrackets c ν) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) + (w : σ → ℕ) + +theorem homogeneousGradedProjection_image_eq + (W : LieSubalgebra ℚ F.AssociatedGraded) : + (W.map (F.associatedGradedMap G φ hφ)).map + (G.homogeneousAssociatedGradedEquiv c ν hG hc).toLieHom = + W.map (F.homogeneousGradedProjection G c ν hG hc φ hφ) := by + ext y + constructor + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨x, hx, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + +theorem projected_realSymbolRepresentative_mem_homogeneous_image + (W : LieSubalgebra ℚ F.AssociatedGraded) (x : F.RealPolynomialSymbol w) + (hx : x ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w W)) + (u : σ → ℝ) : + eval₂ u (G.realSymbolRepresentative c ν hG w + (realificationLieHom (F.filteredPolynomialSymbolMap G φ hφ w) x)) ∈ + realificationLieSubalgebra (W.map (F.homogeneousGradedProjection G c ν hG hc φ hφ)) := by + have hmap := F.real_symbolPointwiseSubalgebra_map_mem G b ω hF c ν hG φ hφ w W x hx + have hvalue := (G.mem_real_symbolPointwiseSubalgebra_iff_values c ν hG w + (W.map (F.associatedGradedMap G φ hφ)) + (realificationLieHom (F.filteredPolynomialSymbolMap G φ hφ w) x)).mp hmap u + rw [G.realSymbolRepresentative_eval₂, + ← F.homogeneousGradedProjection_image_eq G c ν hG hc φ hφ W, + realificationLieSubalgebra_map] + exact ⟨_, hvalue, rfl⟩ + +theorem projected_realSymbolRepresentative_coefficients_mem_homogeneous_image + (W : LieSubalgebra ℚ F.AssociatedGraded) (x : F.RealPolynomialSymbol w) + (hx : x ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w W)) + (α : σ →₀ ℕ) : + coefficients (G.realSymbolRepresentative c ν hG w + (realificationLieHom (F.filteredPolynomialSymbolMap G φ hφ w) x)) α ∈ + realificationLieSubalgebra (W.map (F.homogeneousGradedProjection G c ν hG hc φ hφ)) := by + have hmap := F.real_symbolPointwiseSubalgebra_map_mem G b ω hF c ν hG φ hφ w W x hx + have hcoeff := (G.mem_real_symbolPointwiseSubalgebra_iff_coefficients c ν hG w + (W.map (F.associatedGradedMap G φ hφ)) + (realificationLieHom (F.filteredPolynomialSymbolMap G φ hφ w) x)).mp hmap α + rw [G.realSymbolRepresentative_coefficient_splitting, + ← F.homogeneousGradedProjection_image_eq G c ν hG hc φ hφ W, + realificationLieSubalgebra_map] + exact ⟨_, hcoeff, rfl⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s t : ℕ} + (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M t) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (b : Basis κ ℚ M) (ν : κ → ℕ) + (hG : ∀ j, G.layer j = Submodule.span ℚ (b '' {i | j ≤ ν i})) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) + +include b ν hG in + +theorem gradedRefiltrationLayer_map (U : LieSubalgebra ℚ F.AssociatedGraded) + (hU : BasisGradedSubmodule (F.associatedGradedBasis e ω hF) ω U.toSubmodule) + (hsurj : ∀ j, ∀ y ∈ G.layer j, ∃ x ∈ F.layer j, φ x = y) (j : ℕ) : + (F.gradedRefiltrationLayer U j).map φ.toLinearMap = + G.gradedRefiltrationLayer (U.map (F.associatedGradedMap G φ hφ)) j := by + classical + apply le_antisymm + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨hxF, hxU⟩ := (F.mem_gradedRefiltrationLayer U j x).mp hx + apply (G.mem_gradedRefiltrationLayer _ j (φ x)).mpr + refine ⟨hφ j x hxF, F.associatedGradedPieceMap j ⟨x, hxF⟩, hxU, ?_⟩ + exact F.associatedGradedMap_piece G φ hφ j ⟨x, hxF⟩ + · intro y hy + obtain ⟨hyG, hyU⟩ := (G.mem_gradedRefiltrationLayer _ j y).mp hy + obtain ⟨a, ha, haeq⟩ := hyU + change F.associatedGradedMap G φ hφ a = G.associatedGradedPieceMap j ⟨y, hyG⟩ at haeq + let a' := basisGradeProjection (F.associatedGradedBasis e ω hF) ω j a + have ha'U : a' ∈ U := hU j a ha + have ha'pure : basisGradeProjection (F.associatedGradedBasis e ω hF) ω j a' = a' := by + apply (F.associatedGradedBasis e ω hF).repr.injective + ext i + simp only [a', basisGradeProjection_repr] + split_ifs <;> rfl + obtain ⟨x, hx⟩ := F.exists_associatedGradedPieceMap_of_pure e ω hF j a' ha'pure + have hgraded : F.associatedGradedMap G φ hφ (F.associatedGradedPieceMap j x) = + G.associatedGradedPieceMap j ⟨y, hyG⟩ := by + rw [hx] + change F.associatedGradedMap G φ hφ + (basisGradeProjection (F.associatedGradedBasis e ω hF) ω j a) = _ + rw [F.associatedGradedMap_gradeProjection G e ω hF b ν hG φ hφ, haeq] + exact G.associatedGradedPieceMap_grade_fixed b ν hG j ⟨y, hyG⟩ + have hδ : y - φ x ∈ G.layer (j + 1) := by + apply (G.associatedGradedPieceMap_eq_zero_iff j + ⟨y - φ x, (G.layer j).sub_mem hyG (hφ j x x.property)⟩).mp + change G.associatedGradedPieceMap j + (⟨y, hyG⟩ - ⟨φ x, hφ j x x.property⟩) = 0 + rw [map_sub, ← F.associatedGradedMap_piece G φ hφ j x, hgraded, sub_self] + obtain ⟨z, hz, hzeq⟩ := hsurj (j + 1) (y - φ x) hδ + refine ⟨(x : L) + z, (F.gradedRefiltrationLayer U j).add_mem ?_ + (F.layer_succ_le_gradedRefiltrationLayer U j hz), ?_⟩ + · exact (F.mem_gradedRefiltrationLayer U j x).mpr ⟨x.property, hx.symm ▸ ha'U⟩ + · change φ ((x : L) + z) = y + rw [map_add, hzeq] + abel + +theorem gradedRefiltrationLayer_top_kernel_eq_zero + (U : LieSubalgebra ℚ F.AssociatedGraded) + (htop : ∀ a ∈ U, + basisGradeProjection (F.associatedGradedBasis e ω hF) ω s a = a → + F.associatedGradedMap G φ hφ a = 0 → a = 0) + (x : L) (hx : x ∈ F.gradedRefiltrationLayer U s) (hzero : φ x = 0) : x = 0 := by + obtain ⟨hxF, hxU⟩ := (F.mem_gradedRefiltrationLayer U s x).mp hx + have hpiece : F.associatedGradedPieceMap s ⟨x, hxF⟩ = 0 := by + apply htop _ hxU (F.associatedGradedPieceMap_grade_fixed e ω hF s ⟨x, hxF⟩) + rw [F.associatedGradedMap_piece] + have he : (⟨φ x, hφ s x hxF⟩ : G.layer s) = 0 := Subtype.ext hzero + rw [he, map_zero] + have hmem := (F.associatedGradedPieceMap_eq_zero_iff s ⟨x, hxF⟩).mp hpiece + rw [F.terminal] at hmem + exact hmem + +theorem gradedRefiltrationLayer_map_mem (U : LieSubalgebra ℚ F.AssociatedGraded) + (j : ℕ) (x : L) (hx : x ∈ F.gradedRefiltrationLayer U j) : + φ x ∈ G.gradedRefiltrationLayer (U.map (F.associatedGradedMap G φ hφ)) j := by + obtain ⟨hxF, hxU⟩ := (F.mem_gradedRefiltrationLayer U j x).mp hx + apply (G.mem_gradedRefiltrationLayer _ j (φ x)).mpr + exact ⟨hφ j x hxF, F.associatedGradedPieceMap j ⟨x, hxF⟩, hxU, + F.associatedGradedMap_piece G φ hφ j ⟨x, hxF⟩⟩ + +noncomputable def gradedRefiltrationMap (U : LieSubalgebra ℚ F.AssociatedGraded) : + F.gradedRefiltrationSubalgebra U →ₗ⁅ℚ⁆ + G.gradedRefiltrationSubalgebra (U.map (F.associatedGradedMap G φ hφ)) where + toLinearMap := + { toFun x := ⟨φ x, F.gradedRefiltrationLayer_map_mem G φ hφ U 1 x x.property⟩ + map_add' x y := Subtype.ext (map_add φ (x : L) (y : L)) + map_smul' a x := Subtype.ext (map_smul φ a (x : L)) } + map_lie' {x y} := Subtype.ext (LieHom.map_lie φ x y) + +@[simp] theorem gradedRefiltrationMap_apply (U : LieSubalgebra ℚ F.AssociatedGraded) + (x : F.gradedRefiltrationSubalgebra U) : + (F.gradedRefiltrationMap G φ hφ U x : M) = φ x := rfl + +theorem gradedRefiltrationMap_mem_layer (U : LieSubalgebra ℚ F.AssociatedGraded) + (j : ℕ) (x : F.gradedRefiltrationSubalgebra U) + (hx : x ∈ (F.gradedRefiltration U).layer j) : + F.gradedRefiltrationMap G φ hφ U x ∈ + (G.gradedRefiltration (U.map (F.associatedGradedMap G φ hφ))).layer j := + F.gradedRefiltrationLayer_map_mem G φ hφ U j x hx + +include e ω hF b ν hG in + +theorem gradedRefiltrationMap_layer_surjective (U : LieSubalgebra ℚ F.AssociatedGraded) + (hU : BasisGradedSubmodule (F.associatedGradedBasis e ω hF) ω U.toSubmodule) + (hsurj : ∀ j, ∀ y ∈ G.layer j, ∃ x ∈ F.layer j, φ x = y) + (j : ℕ) (y : G.gradedRefiltrationSubalgebra (U.map (F.associatedGradedMap G φ hφ))) + (hy : y ∈ (G.gradedRefiltration (U.map (F.associatedGradedMap G φ hφ))).layer j) : + ∃ x ∈ (F.gradedRefiltration U).layer j, F.gradedRefiltrationMap G φ hφ U x = y := by + have lift (i : ℕ) (hi : 1 ≤ i) + (hy' : (y : M) ∈ G.gradedRefiltrationLayer (U.map (F.associatedGradedMap G φ hφ)) i) : + ∃ x ∈ (F.gradedRefiltration U).layer i, F.gradedRefiltrationMap G φ hφ U x = y := by + rw [← F.gradedRefiltrationLayer_map G e ω hF b ν hG φ hφ U hU hsurj] at hy' + obtain ⟨x, hx, hxy⟩ := hy' + let x' : F.gradedRefiltrationSubalgebra U := + ⟨x, F.gradedRefiltrationLayer_antitone U hi hx⟩ + exact ⟨x', hx, Subtype.ext hxy⟩ + by_cases hj : 1 ≤ j + · exact lift j hj hy + · have hj0 : j = 0 := by omega + subst j + obtain ⟨x, hx, hxy⟩ := lift 1 le_rfl y.property + exact ⟨x, (F.gradedRefiltration U).antitone (by omega : 0 ≤ 1) hx, hxy⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module + +universe u + +variable {L M : Type u} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s d f nD : ℕ} + (D : RationalFilteredNilmanifold L (s + 1) d) + (Fmark : RationalFilteredNilmanifold M (s + 1) f) + (φ : L →ₗ⁅ℚ⁆ M) + (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ Fmark.filtration.layer j) + (W : LieSubalgebra ℚ D.filtration.AssociatedGraded) + (Dref : RationalFilteredNilmanifold + (D.filtration.gradedRefiltrationSubalgebra W) (s + 1) nD) + +theorem allocatedMarkedDiagram_injective_of_top_kernel + (hDref : Dref.filtration = D.filtration.gradedRefiltration W) + (hker : ∀ x : L, x ∈ D.filtration.gradedRefiltrationLayer W (s + 1) → + φ x = 0 → x = 0) : + Function.Injective (optionProductMap + (lieQuotientMap (Dref.filtration.layerIdeal (s + 1))) + (fun _ : Unit => D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W)) := by + apply quotient_markedDiagram_injective + intro x hx hzero + apply Subtype.ext + apply hker (x : L) + · rw [hDref] at hx + exact (D.filtration.mem_gradedRefiltration_layer W (s + 1) x).mp hx + · exact congrArg Subtype.val (hzero ()) + +theorem allocatedMarkedDiagram_injective_of_graded_top + (hDref : Dref.filtration = D.filtration.gradedRefiltration W) + {ι : Type*} (b : Basis ι ℚ L) (ω : ι → ℕ) + (hD : ∀ j, D.filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (htop : ∀ a ∈ W, + basisGradeProjection (D.filtration.associatedGradedBasis b ω hD) ω (s + 1) a = a → + D.filtration.associatedGradedMap Fmark.filtration φ hφ a = 0 → a = 0) : + Function.Injective (optionProductMap + (lieQuotientMap (Dref.filtration.layerIdeal (s + 1))) + (fun _ : Unit => D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W)) := + D.allocatedMarkedDiagram_injective_of_top_kernel Fmark φ hφ W Dref hDref + (D.filtration.gradedRefiltrationLayer_top_kernel_eq_zero + Fmark.filtration b ω hD φ hφ W htop) + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +universe u v + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieFiltration + +variable {J : Type v} [Fintype J] {L : Type u} {M : J → Type u} {Y : Type*} + [LieRing L] [LieAlgebra ℚ L] [∀ j, LieRing (M j)] [∀ j, LieAlgebra ℚ (M j)] + [LieRing Y] [LieAlgebra ℚ Y] {s d₀ dQ : ℕ} {d : J → ℕ} + (D : RationalFilteredNilmanifold L s d₀) + (E : ∀ j, RationalFilteredNilmanifold (M j) s (d j)) + (π : L →ₗ⁅ℚ⁆ Y) (eta : J → L →ₗ[ℚ] ℚ) (js : List J) + (Q : RationalFilteredNilmanifold + (L ⧸ D.filtration.pivotAnnihilatorIdeal π eta js) s dQ) + (hQ : Q.filtration = D.filtration.quotientLie + (D.filtration.pivotAnnihilatorIdeal π eta js) + (by rw [D.filtration.terminal]; exact bot_le)) + +include hQ + +theorem optionNativePivotQuotientMap_mem_layer (k : ℕ) + (x : ∀ i : Option J, optionLieSpace L M i) + (hx : x ∈ (optionProduct D E).filtration.layer k) : + optionMarkedLieMap (L := M) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal π eta js)) x ∈ + (optionProduct Q E).filtration.layer k := by + have hcoord := (mem_pi_layer (fun i => (optionFactors D E i).filtration) k x).mp hx + apply (mem_pi_layer (fun i => (optionFactors Q E i).filtration) k _).mpr + intro i + cases i with + | none => + change lieQuotientMap (D.filtration.pivotAnnihilatorIdeal π eta js) (x none) ∈ + Q.filtration.layer k + rw [hQ] + exact ⟨x none, hcoord none, rfl⟩ + | some j => exact hcoord (some j) + +theorem optionNativePivotQuotientMap_layer_surjective (k : ℕ) + (y : ∀ i : Option J, + optionLieSpace (L ⧸ D.filtration.pivotAnnihilatorIdeal π eta js) M i) + (hy : y ∈ (optionProduct Q E).filtration.layer k) : + ∃ x ∈ (optionProduct D E).filtration.layer k, + optionMarkedLieMap (L := M) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal π eta js)) x = y := by + have hcoord := (mem_pi_layer (fun i => (optionFactors Q E i).filtration) k y).mp hy + have hy₀ : y none ∈ Q.filtration.layer k := hcoord none + rw [hQ] at hy₀ + obtain ⟨x₀, hx₀, hxy₀⟩ := hy₀ + let x : ∀ i : Option J, optionLieSpace L M i + | none => x₀ + | some j => y (some j) + refine ⟨x, ?_, ?_⟩ + · apply (mem_pi_layer (fun i => (optionFactors D E i).filtration) k x).mpr + intro i + cases i with + | none => exact hx₀ + | some j => exact hcoord (some j) + · funext i + cases i with + | none => exact hxy₀ + | some j => rfl + +variable (U : LieSubalgebra ℚ (optionProduct D E).filtration.AssociatedGraded) + +noncomputable def optionNativeCommonPivotQuotientFast : + LieSubalgebra ℚ (optionProduct Q E).filtration.AssociatedGraded := + U.map ((optionProduct D E).filtration.associatedGradedMap + (optionProduct Q E).filtration + (optionMarkedLieMap (L := M) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal π eta js))) + (optionNativePivotQuotientMap_mem_layer D E π eta js Q hQ)) + +variable {κ κQ : Type*} + (e : Basis κ ℚ (∀ i : Option J, optionLieSpace L M i)) (μ : κ → ℕ) + (hSource : ∀ k, (optionProduct D E).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ μ i})) + (c : Basis κQ ℚ (∀ i : Option J, + optionLieSpace (L ⧸ D.filtration.pivotAnnihilatorIdeal π eta js) M i)) + (ν : κQ → ℕ) + (hTarget : ∀ k, (optionProduct Q E).filtration.layer k = + Submodule.span ℚ (c '' {i | k ≤ ν i})) + (hU : BasisGradedSubmodule + ((optionProduct D E).filtration.associatedGradedBasis e μ hSource) μ U.toSubmodule) + +include e μ hSource c ν hTarget hU in + +theorem optionNativeCommonPivotQuotientFast_layer_eq (k : ℕ) : + (optionProduct Q E).filtration.gradedRefiltrationLayer + (optionNativeCommonPivotQuotientFast D E π eta js Q hQ U) k = + ((optionProduct D E).filtration.gradedRefiltrationLayer U k).map + (optionMarkedLieMap (L := M) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal π eta js))).toLinearMap := by + symm + exact (optionProduct D E).filtration.gradedRefiltrationLayer_map + (optionProduct Q E).filtration e μ hSource c ν hTarget + (optionMarkedLieMap (L := M) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal π eta js))) + (optionNativePivotQuotientMap_mem_layer D E π eta js Q hQ) U hU + (optionNativePivotQuotientMap_layer_surjective D E π eta js Q hQ) k + +include e μ hSource c ν hTarget hU in + +theorem optionNativeCommonPivotQuotientFast_graded : + BasisGradedSubmodule + ((optionProduct Q E).filtration.associatedGradedBasis c ν hTarget) ν + (optionNativeCommonPivotQuotientFast D E π eta js Q hQ U).toSubmodule := + (optionProduct D E).filtration.associatedGradedMap_image_graded + (optionProduct Q E).filtration e μ hSource c ν hTarget + (optionMarkedLieMap (L := M) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal π eta js))) + (optionNativePivotQuotientMap_mem_layer D E π eta js Q hQ) U hU + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s : ℕ} + (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M s) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) + (U : LieSubalgebra ℚ F.AssociatedGraded) + +noncomputable abbrev refilteredProjectionFiberProduct := + lieQuotientFiberProduct ((F.gradedRefiltration U).layerIdeal s) + ((G.gradedRefiltration (U.map (F.associatedGradedMap G φ hφ))).layerIdeal s) + (F.gradedRefiltrationMap G φ hφ U) + (F.gradedRefiltrationMap_mem_layer G φ hφ U s) + +variable (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (b : Basis κ ℚ M) (ν : κ → ℕ) + (hG : ∀ j, G.layer j = Submodule.span ℚ (b '' {i | j ≤ ν i})) + (hU : BasisGradedSubmodule (F.associatedGradedBasis e ω hF) ω U.toSubmodule) + (hsurj : ∀ j, ∀ y ∈ G.layer j, ∃ x ∈ F.layer j, φ x = y) + (htop : ∀ a ∈ U, + basisGradeProjection (F.associatedGradedBasis e ω hF) ω s a = a → + F.associatedGradedMap G φ hφ a = 0 → a = 0) + +noncomputable def refilteredProjectionFiberEquiv : + F.gradedRefiltrationSubalgebra U ≃ₗ⁅ℚ⁆ F.refilteredProjectionFiberProduct G φ hφ U := + (F.gradedRefiltration U).quotientFiberEquiv + (G.gradedRefiltration (U.map (F.associatedGradedMap G φ hφ))) + (F.gradedRefiltrationMap G φ hφ U) + (F.gradedRefiltrationMap_mem_layer G φ hφ U) + (fun x hx hz => Subtype.ext + (F.gradedRefiltrationLayer_top_kernel_eq_zero G e ω hF φ hφ U htop x hx + (congrArg Subtype.val hz))) + (F.gradedRefiltrationMap_layer_surjective G e ω hF b ν hG φ hφ U hU hsurj s) + +@[simp] theorem refilteredProjectionFiberEquiv_apply + (x : F.gradedRefiltrationSubalgebra U) : + (F.refilteredProjectionFiberEquiv G φ hφ U e ω hF b ν hG hU hsurj htop x).val = + (lieQuotientMap ((F.gradedRefiltration U).layerIdeal s) x, + F.gradedRefiltrationMap G φ hφ U x) := rfl + +theorem refilteredProjectionFiberEquiv_symm_components + (z : F.refilteredProjectionFiberProduct G φ hφ U) : + let x := (F.refilteredProjectionFiberEquiv G φ hφ U e ω hF b ν hG hU hsurj htop).symm z + lieQuotientMap ((F.gradedRefiltration U).layerIdeal s) x = z.val.1 ∧ + F.gradedRefiltrationMap G φ hφ U x = z.val.2 := by + intro x + have hz := congrArg Subtype.val + ((F.refilteredProjectionFiberEquiv G φ hφ U e ω hF b ν hG hU hsurj htop).apply_symm_apply z) + exact ⟨congrArg Prod.fst hz, congrArg Prod.snd hz⟩ + +theorem refilteredProjectionFiberEquiv_layer_surjective + (j : ℕ) (z : F.refilteredProjectionFiberProduct G φ hφ U) + (hq : z.val.1 ∈ ((F.gradedRefiltration U).layer j).map + (lieQuotientMap ((F.gradedRefiltration U).layerIdeal s)).toLinearMap) + (hp : z.val.2 ∈ + (G.gradedRefiltration (U.map (F.associatedGradedMap G φ hφ))).layer j) : + ∃ x ∈ (F.gradedRefiltration U).layer j, + F.refilteredProjectionFiberEquiv G φ hφ U e ω hF b ν hG hU hsurj htop x = z := by + exact (F.gradedRefiltration U).quotientFiberEquiv_layer_surjective + (G.gradedRefiltration (U.map (F.associatedGradedMap G φ hφ))) + (F.gradedRefiltrationMap G φ hφ U) + (F.gradedRefiltrationMap_mem_layer G φ hφ U) + (fun x hx hz => Subtype.ext + (F.gradedRefiltrationLayer_top_kernel_eq_zero G e ω hF φ hφ U htop x hx + (congrArg Subtype.val hz))) + (F.gradedRefiltrationMap_layer_surjective G e ω hF b ν hG φ hφ U hU hsurj s) j z hq hp + +theorem refilteredProjectionFiberEquiv_mem_layer_iff + (j : ℕ) (x : F.gradedRefiltrationSubalgebra U) : + x ∈ (F.gradedRefiltration U).layer j ↔ + (F.refilteredProjectionFiberEquiv G φ hφ U e ω hF b ν hG hU hsurj htop x).val.1 ∈ + ((F.gradedRefiltration U).layer j).map + (lieQuotientMap ((F.gradedRefiltration U).layerIdeal s)).toLinearMap ∧ + (F.refilteredProjectionFiberEquiv G φ hφ U e ω hF b ν hG hU hsurj htop x).val.2 ∈ + (G.gradedRefiltration (U.map (F.associatedGradedMap G φ hφ))).layer j := by + exact (F.gradedRefiltration U).mem_layer_iff_quotient_and_projection + (G.gradedRefiltration (U.map (F.associatedGradedMap G φ hφ))) + (F.gradedRefiltrationMap G φ hφ U) + (F.gradedRefiltrationMap_mem_layer G φ hφ U) + (fun y hy hz => Subtype.ext + (F.gradedRefiltrationLayer_top_kernel_eq_zero G e ω hF φ hφ U htop y hy + (congrArg Subtype.val hz))) j x + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SublevelThresholdBalance.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SublevelThresholdBalance.lean new file mode 100644 index 0000000000000000000000000000000000000000..86a2d46fe872d032043cd72c006670d9ad56fe71 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SublevelThresholdBalance.lean @@ -0,0 +1,46 @@ +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +theorem sublevel_threshold_balance (n d : ℕ) (hn : 0 < n) (hd : 0 < d) + {u c : ℝ} (hu : 0 < u) (hc : 0 < c) : + ∃ τ : ℝ, 0 < τ ∧ + (τ / c) ^ (((n * d : ℕ) : ℝ)⁻¹) = + (u / c) ^ ((((n + 1) * d : ℕ) : ℝ)⁻¹) ∧ + (u / τ) ^ ((d : ℝ)⁻¹) = + (u / c) ^ ((((n + 1) * d : ℕ) : ℝ)⁻¹) := by + have hn' : (0 : ℝ) < n := by exact_mod_cast hn + have hd' : (0 : ℝ) < d := by exact_mod_cast hd + let x : ℝ := u / c + let a : ℝ := (n : ℝ) / (n + 1) + have hx : 0 < x := div_pos hu hc + let τ : ℝ := c * x ^ a + have hτ : 0 < τ := mul_pos hc (Real.rpow_pos_of_pos hx _) + have hratio : τ / c = x ^ a := by dsimp [τ]; field_simp + have hexp : a * (((n * d : ℕ) : ℝ)⁻¹) = ((((n + 1) * d : ℕ) : ℝ)⁻¹) := by + dsimp [a] + push_cast + field_simp + have hexp' : (1 - a) * (d : ℝ)⁻¹ = ((((n + 1) * d : ℕ) : ℝ)⁻¹) := by + dsimp [a] + push_cast + field_simp + ring + have hquot : u / τ = x ^ (1 - a) := by + rw [Real.rpow_sub hx, Real.rpow_one] + dsimp [τ, x] + field_simp + refine ⟨τ, hτ, ?_, ?_⟩ + · rw [hratio, ← Real.rpow_mul hx.le, hexp] + · rw [hquot, ← Real.rpow_mul hx.le, hexp'] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SubmoduleSupRestriction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SubmoduleSupRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..cdd9b2a904c8cefaaae4658e1181dadce50bde71 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SubmoduleSupRestriction.lean @@ -0,0 +1,22 @@ +import Mathlib.LinearAlgebra.Span.Basic + +namespace OAI + +section + +namespace Erdos3 + +theorem submodule_comap_iSup_of_le_range {R M N : Type*} [Ring R] + [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] + {I : Sort*} (f : M →ₗ[R] N) (hf : Function.Injective f) + (P : I → Submodule R N) (hP : ∀ i, P i ≤ LinearMap.range f) : + (⨆ i, P i).comap f = ⨆ i, (P i).comap f := by + apply Submodule.map_injective_of_injective hf + rw [Submodule.map_comap_eq_of_le (iSup_le hP), Submodule.map_iSup] + exact iSup_congr (fun i => (Submodule.map_comap_eq_of_le (hP i)).symm) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SubsetAlternatingInversion.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SubsetAlternatingInversion.lean new file mode 100644 index 0000000000000000000000000000000000000000..b191e020b48b1aeb0275f7df0879d4e5380cc3f9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SubsetAlternatingInversion.lean @@ -0,0 +1,56 @@ +import OAI.Combinatorics.Progressions.Results.Basic + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι : Type*} [DecidableEq ι] + +noncomputable def subsetAlternatingTransform (F : Finset ι → ℝ) (S : Finset ι) : ℝ := + ∑ U ∈ S.powerset, (-1 : ℝ) ^ U.card * F (S \ U) + +theorem subsetAlternatingTransform_insert (F : Finset ι → ℝ) (S : Finset ι) + {i : ι} (hi : i ∉ S) : + subsetAlternatingTransform F (insert i S) = + subsetAlternatingTransform (fun T => F (insert i T)) S - subsetAlternatingTransform F S := by + unfold subsetAlternatingTransform + rw [Finset.sum_powerset_insert hi] + have he₁ (U : Finset ι) (hU : U ∈ S.powerset) : (insert i S) \ U = insert i (S \ U) := by + have hn : i ∉ U := fun h => hi (Finset.mem_powerset.mp hU h) + ext j + by_cases hj : j = i <;> simp [hj, hn] + have he₂ (U : Finset ι) (hU : U ∈ S.powerset) : + (-1 : ℝ) ^ (insert i U).card * F ((insert i S) \ insert i U) = + -((-1 : ℝ) ^ U.card * F (S \ U)) := by + have hn : i ∉ U := fun h => hi (Finset.mem_powerset.mp hU h) + have hs : (insert i S) \ insert i U = S \ U := by + ext j + by_cases hj : j = i <;> simp [hj, hi] + rw [hs, Finset.card_insert_of_notMem hn, pow_succ] + ring + rw [Finset.sum_congr rfl (fun U hU => congrArg (fun z => (-1 : ℝ) ^ U.card * F z) (he₁ U hU)), + Finset.sum_congr rfl he₂, Finset.sum_neg_distrib] + rfl + +theorem subsetAlternatingTransform_sum (S : Finset ι) (F : Finset ι → ℝ) : + (∑ T ∈ S.powerset, subsetAlternatingTransform F T) = F S := by + induction S using Finset.induction_on generalizing F with + | empty => simp [subsetAlternatingTransform] + | @insert i S hi ih => + rw [Finset.sum_powerset_insert hi] + have he (T : Finset ι) (hT : T ∈ S.powerset) : + subsetAlternatingTransform F (insert i T) = + subsetAlternatingTransform (fun U => F (insert i U)) T - subsetAlternatingTransform F T := + subsetAlternatingTransform_insert F T (fun h => hi (Finset.mem_powerset.mp hT h)) + rw [Finset.sum_congr rfl he, Finset.sum_sub_distrib, ih F, ih (fun U => F (insert i U))] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SubspaceLayeredModeSmoothRemoval.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SubspaceLayeredModeSmoothRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe5e207e86968ae5f7159654c0eea1026b98fdb8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SubspaceLayeredModeSmoothRemoval.lean @@ -0,0 +1,674 @@ +import OAI.Combinatorics.Progressions.Lattices.SelectedResidueApproximation +import OAI.Combinatorics.Progressions.Linear.CoefficientModeRankContradiction + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal + +theorem smoothProductPMF_translation_test_le {I : Type*} [Fintype I] + (S : I → ℝ) (hS : ∀ i, 0 < S i) (hS1 : ∀ i, 1 ≤ S i) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : (I → ℤ) → ℂ) (hφ : ∀ x, ‖φ x‖ ≤ 1) (v : I → ℤ) : + ‖(∑' x, ((smoothProductPMF S hS x).toReal : ℂ) * φ (x + v)) - + ∑' x, ((smoothProductPMF S hS x).toReal : ℂ) * φ x‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card I * + (((Fintype.card I : ℝ) * probabilityProfileLipschitz) * ‖rectangularLatticePoint 0 S v‖) := by + have hsmall' : (2 * (1 : ℝ) + 2) ^ Fintype.card I * + ((Fintype.card I * probabilityProfileLipschitz : ℝ≥0) : ℝ) * δ ≤ 1 / 2 := by + simpa only [NNReal.coe_mul, NNReal.coe_natCast, show 2 * (1 : ℝ) + 2 = 4 by norm_num] using hsmall + have hm := rectangular_profile_mass_lower (smoothProductProfile I) (smoothProductProfile_lipschitz I) + 0 S hS zero_le_one hδ hδ1 hmesh (smoothProductProfile_zero_outside I) + (smoothProductProfile_integral I) hsmall' + have ht := normalized_rectangular_translation_test_le (smoothProductProfile I) + (smoothProductProfile_lipschitz I) 0 S hS1 zero_le_one + (smoothProductProfile_zero_outside I) hm φ hφ v + simpa only [smoothProductPMF, realWeightPMF_apply, rectangularWeight, + rectangularLatticePoint_zero_origin, NNReal.coe_mul, NNReal.coe_natCast, + show 2 * (1 : ℝ) + 1 = 3 by norm_num] using ht + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem smoothProductPMF_toReal_sum {I : Type*} [Fintype I] + (S : I → ℝ) (hS : ∀ i, 0 < S i) : + (∑' x, (smoothProductPMF S hS x).toReal) = 1 := by + simp only [smoothProductPMF, realWeightPMF_apply, tsum_div_const] + exact div_self (smoothProductSamples_sum_pos S hS).ne' + +theorem smoothProductPMF_toReal_zero_off {I : Type*} [Fintype I] + (S : I → ℝ) (hS : ∀ i, 0 < S i) (x : I → ℤ) + (hx : x ∉ rectangularWeightIndices 0 S 1) : (smoothProductPMF S hS x).toReal = 0 := by + have hz := rectangularWeight_zero_off_indices (smoothProductProfile I) 0 S hS + (smoothProductProfile_zero_outside I) x hx + simp only [rectangularWeight, rectangularLatticePoint_zero_origin] at hz + simp only [smoothProductPMF, realWeightPMF_apply, hz, zero_div] + +theorem smoothProductPMF_shift_transfer {I X : Type*} [Fintype I] [Fintype X] [Nonempty X] + (S : I → ℝ) (hS : ∀ i, 0 < S i) (hS1 : ∀ i, 1 ≤ S i) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ i, 1 / S i ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card I * + ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (shift : X → I → ℤ) {r B : ℝ} + (hshift : ∀ u, ‖rectangularLatticePoint 0 S (shift u)‖ ≤ r) + (f : (I → ℤ) → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) + (hlocal : ∀ x, ‖𝔼 u, f (x + shift u)‖ ≤ B) : + ‖∑' x, ((smoothProductPMF S hS x).toReal : ℂ) * f x‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card I * ((Fintype.card I : ℝ) * probabilityProfileLipschitz) * r + B := by + apply finite_probability_shift_transfer (fun x => (smoothProductPMF S hS x).toReal) + (rectangularWeightIndices 0 S 1) (smoothProductPMF_toReal_zero_off S hS) + (fun _ => ENNReal.toReal_nonneg) (smoothProductPMF_toReal_sum S hS) shift f _ hlocal + intro u + apply (smoothProductPMF_translation_test_le S hS hS1 hδ hδ1 hmesh hsmall f hf (shift u)).trans + calc + 4 * (3 : ℝ) ^ Fintype.card I * + (((Fintype.card I : ℝ) * probabilityProfileLipschitz) * + ‖rectangularLatticePoint 0 S (shift u)‖) ≤ + 4 * (3 : ℝ) ^ Fintype.card I * + (((Fintype.card I : ℝ) * probabilityProfileLipschitz) * r) := by + gcongr + exact hshift u + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem smooth_row_shift_transfer {K I : Type*} [Fintype K] [Fintype I] [DecidableEq I] + {h : ℕ} (N s : I → ℕ) (hN : ∀ i, 0 < N i) (rows : Fin h → K → ℤ) + (S : K × I → ℝ) (hS : ∀ z, 0 < S z) (hS1 : ∀ z, 1 ≤ S z) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ z, 1 / S z ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + {C r B : ℝ} (hC : 0 ≤ C) (hrows : ∀ i k, |(rows i k : ℝ)| ≤ C) (hr : 0 ≤ r) + (hscale : ∀ z, (h : ℝ) * C * ((s z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * S z) + (Φ : (K → I → ℝ) → ℂ) (hΦ : ∀ b, ‖Φ b‖ ≤ 1) + (hlocal : ∀ b : K → I → ℝ, + ‖𝔼 x : Fin h → ∀ j, Fin (N j), + Φ (rowShiftedTuple b rows + (fun (y : ∀ j, Fin (N j)) j => (s j : ℝ) * ((y j).val : ℝ)) x)‖ ≤ B) : + ‖∑' z : K × I → ℤ, + ((smoothProductPMF S hS z).toReal : ℂ) * Φ (fun k j => (z (k, j) : ℝ))‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * r + B := by + let : ∀ j, Nonempty (Fin (N j)) := fun j => ⟨⟨0, hN j⟩⟩ + apply smoothProductPMF_shift_transfer S hS hS1 hδ hδ1 hmesh hsmall + (integerRowShift (N := N) rows s) + (fun x => integerRowShift_normalized_bound rows s x S hS hC hrows hr hscale) + (fun z => Φ (fun k j => (z (k, j) : ℝ))) (fun z => hΦ _) + intro z + simpa only [integerRowShift_real] using hlocal (fun k j => (z (k, j) : ℝ)) + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators Classical + +theorem coefficient_mode_finite_removal {I K J S : Type*} + [Fintype I] [DecidableEq I] [Fintype K] [Fintype J] [Fintype S] {n : ℕ} + (frequency : (K →₀ ℕ) → J → ℤ) (a : Fin (n + 1) → K → ℤ) + (p : VectorPolynomial I ℝ (J → ℝ)) (hp : Homogeneous (n + 1) p) + (W : Submodule ℝ (J → ℝ)) (N s : I → ℕ) (hs : ∀ k, 0 < s k) + {ζ R B : ℝ} (hζ : 0 < ζ) (hN : ∀ k, multiaffineBiasBudget n ζ ≤ N k) + (H : I → ℝ) (hH : ∀ k, 0 < H k) {A : ℝ} (hA : 0 ≤ A) + (hscale : ∀ k, H k ≤ A * ((s k : ℝ) * (N k : ℝ))) + (hrank : HasLayerSamplingRank (n + 1) H R W p) + (hrow : ∀ j, |(integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ)| ≤ B) + (hrowBudget : ((n + 1).factorial : ℝ) * B ≤ R) + (hnonzero : ∃ w : W, + (∑ j, (integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ) * w.val j) ≠ 0) + (hdenom : (∏ j : Fin (n + 1) → I, + (multiaffineBiasBudget n ζ * ∏ i, (s (j i) : ℝ))) ≤ R) + (hcoeff : (Fintype.card I : ℝ) ^ (n + 1) * (A ^ (n + 1) * multiaffineBiasBudget n ζ) ≤ R) + (site : S → K → ℤ) (hzero : ∀ t, ∃ i, (∑ k, a i k * site t k) = 0) + (base : K → I → ℝ) (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < n + 1) + (test : S → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) : + let shift : (∀ k, Fin (N k)) → I → ℝ := fun x k => (s k : ℝ) * ((x k).val : ℝ) + let L := coefficientFunctional (fun d j => (frequency d j : ℝ)) + ‖𝔼 x : Fin (n + 1) → ∀ k, Fin (N k), + character ((L (substitute (fun j => rowPolynomial + (fun k => rowShiftedTuple base a shift x k j)) p) + + MvPolynomial.eval (fun z => rowShiftedTuple base a shift x z.1 z.2) Q : ℝ) : + CircleFourier.Circle) * + ∏ t, test t (integerSiteValue (site t) (rowShiftedTuple base a shift x))‖ ^ (2 ^ (n + 1)) < ζ := by + have hNp (k : I) : 0 < N k := by + exact_mod_cast (multiaffineBiasBudget_pos n hζ).trans_le (hN k) + let : ∀ k, Nonempty (Fin (N k)) := fun k => ⟨⟨0, hNp k⟩⟩ + have hcs := coefficient_mode_with_lower_site_cauchySchwarz (Nat.succ_pos n) site a hzero base + (fun (x : ∀ k, Fin (N k)) k => (s k : ℝ) * ((x k).val : ℝ)) + (coefficientFunctional (fun d j => (frequency d j : ℝ))) p hp Q hQ test htest + exact hcs.trans_lt (coefficientMode_paired_bias_lt_of_rank frequency a p hp W N s hs hζ hN + H hH hA hscale hrank hrow hrowBudget hnonzero hdenom hcoeff) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators NNReal Classical + +noncomputable def coefficientModeTestedPhase {I K W S : Type*} [Fintype K] [Fintype S] + [AddCommGroup W] [Module ℝ W] + (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (p : VectorPolynomial I ℝ W) + (Q : MvPolynomial (K × I) ℝ) (site : S → K → ℤ) + (test : S → (I → ℝ) → ℂ) (b : K → I → ℝ) : ℂ := + character ((L (substitute (fun j => rowPolynomial (fun k => b k j)) p) + + MvPolynomial.eval (fun z => b z.1 z.2) Q : ℝ) : CircleFourier.Circle) * + ∏ t, test t (integerSiteValue (site t) b) + +theorem coefficientModeTestedPhase_norm_le {I K W S : Type*} [Fintype K] [Fintype S] + [AddCommGroup W] [Module ℝ W] + (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (p : VectorPolynomial I ℝ W) + (Q : MvPolynomial (K × I) ℝ) (site : S → K → ℤ) + (test : S → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) (b : K → I → ℝ) : + ‖coefficientModeTestedPhase L p Q site test b‖ ≤ 1 := by + rw [coefficientModeTestedPhase, norm_mul, norm_character, one_mul, norm_prod] + exact Finset.prod_le_one₀ (fun t _ => norm_nonneg _) (fun t _ => htest t _) + +theorem coefficient_mode_smooth_removal {I K J T : Type*} + [Fintype I] [DecidableEq I] [Fintype K] [Fintype J] [Fintype T] {n : ℕ} + (frequency : (K →₀ ℕ) → J → ℤ) (a : Fin (n + 1) → K → ℤ) + (p : VectorPolynomial I ℝ (J → ℝ)) (hp : Homogeneous (n + 1) p) + (W : Submodule ℝ (J → ℝ)) (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) + {ζ R B : ℝ} (hζ : 0 < ζ) (hN : ∀ k, multiaffineBiasBudget n ζ ≤ N k) + (H : I → ℝ) (hH : ∀ k, 0 < H k) {A : ℝ} (hA : 0 ≤ A) + (hscale : ∀ k, H k ≤ A * ((stride k : ℝ) * (N k : ℝ))) + (hrank : HasLayerSamplingRank (n + 1) H R W p) + (hrow : ∀ j, |(integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ)| ≤ B) + (hrowBudget : ((n + 1).factorial : ℝ) * B ≤ R) + (hnonzero : ∃ w : W, + (∑ j, (integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ) * w.val j) ≠ 0) + (hdenom : (∏ j : Fin (n + 1) → I, + (multiaffineBiasBudget n ζ * ∏ i, (stride (j i) : ℝ))) ≤ R) + (hcoeff : (Fintype.card I : ℝ) ^ (n + 1) * (A ^ (n + 1) * multiaffineBiasBudget n ζ) ≤ R) + (site : T → K → ℤ) (hzero : ∀ t, ∃ i, (∑ k, a i k * site t k) = 0) + (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < n + 1) + (test : T → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) + (V : 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 (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + {C r β : ℝ} (hC : 0 ≤ C) (ha : ∀ i k, |(a i k : ℝ)| ≤ C) (hr : 0 ≤ r) + (hmove : ∀ z, ((n + 1 : ℕ) : ℝ) * C * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z) + (hβ : 0 ≤ β) (hpower : ζ ≤ β ^ (2 ^ (n + 1))) : + ‖∑' z : K × I → ℤ, ((smoothProductPMF V hV z).toReal : ℂ) * + coefficientModeTestedPhase (coefficientFunctional (fun d j => (frequency d j : ℝ))) + p Q site test (fun k j => (z (k, j) : ℝ))‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * r + β := by + have hNp (k : I) : 0 < N k := by + exact_mod_cast (multiaffineBiasBudget_pos n hζ).trans_le (hN k) + apply smooth_row_shift_transfer N stride hNp a V hV hV1 hδ hδ1 hmesh hsmall hC ha hr hmove + (coefficientModeTestedPhase (coefficientFunctional (fun d j => (frequency d j : ℝ))) p Q site test) + (coefficientModeTestedPhase_norm_le _ p Q site test htest) + intro b + apply le_of_pow_le_pow_left₀ (pow_ne_zero _ (by norm_num : (2 : ℕ) ≠ 0)) hβ + have h := coefficient_mode_finite_removal frequency a p hp W N stride hs hζ hN H hH hA hscale + hrank hrow hrowBudget hnonzero hdenom hcoeff site hzero b Q hQ test htest + exact (show _ < ζ from h).le.trans hpower + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +noncomputable def lowerModePolynomial {I K W : Type*} [Fintype K] + [AddCommGroup W] [Module ℝ W] (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) + (h : ℕ) (p : VectorPolynomial I ℝ W) (Q : MvPolynomial (K × I) ℝ) : + MvPolynomial (K × I) ℝ := coefficientModePolynomial L (p - homogeneousPart h p) + Q + +theorem lowerModePolynomial_degree {I K W : Type*} [Fintype K] + [AddCommGroup W] [Module ℝ W] (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) + {n : ℕ} (p : VectorPolynomial I ℝ W) (hp : DegreeLE (1 : I → ℕ) (n + 1) p) + (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < n + 1) : + (lowerModePolynomial L (n + 1) p Q).totalDegree < n + 1 := by + apply lt_of_le_of_lt (MvPolynomial.totalDegree_add _ _) + apply max_lt + · exact (coefficientModePolynomial_degreeLE L _ (sub_homogeneousPart_degreeLE hp)).trans_lt + (Nat.lt_succ_self n) + · exact hQ + +theorem lowerModePolynomial_eval {I K W : Type*} [Fintype K] + [AddCommGroup W] [Module ℝ W] (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) + (h : ℕ) (p : VectorPolynomial I ℝ W) (Q : MvPolynomial (K × I) ℝ) (b : K → I → ℝ) : + L (substitute (fun j => rowPolynomial (fun k => b k j)) (homogeneousPart h p)) + + MvPolynomial.eval (fun z => b z.1 z.2) (lowerModePolynomial L h p Q) = + L (substitute (fun j => rowPolynomial (fun k => b k j)) p) + + MvPolynomial.eval (fun z => b z.1 z.2) Q := by + rw [lowerModePolynomial, map_add, coefficientModePolynomial_eval, map_sub, map_sub] + ring + +theorem coefficientModeTestedPhase_top {I K W S : Type*} [Fintype K] [Fintype S] + [AddCommGroup W] [Module ℝ W] + (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (h : ℕ) + (p : VectorPolynomial I ℝ W) (Q : MvPolynomial (K × I) ℝ) + (site : S → K → ℤ) (test : S → (I → ℝ) → ℂ) (b : K → I → ℝ) : + coefficientModeTestedPhase L p Q site test b = + coefficientModeTestedPhase L (homogeneousPart h p) (lowerModePolynomial L h p Q) site test b := by + unfold coefficientModeTestedPhase + rw [lowerModePolynomial_eval] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +theorem inhomogeneous_coefficient_mode_local_removal {I K J T : Type*} + [Fintype I] [DecidableEq I] [Fintype K] [Fintype J] [Fintype T] {n : ℕ} + (frequency : (K →₀ ℕ) → J → ℤ) (a : Fin (n + 1) → K → ℤ) + (p : VectorPolynomial I ℝ (J → ℝ)) (hp : DegreeLE (1 : I → ℕ) (n + 1) p) + (W : Submodule ℝ (J → ℝ)) (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) + {ζ R B : ℝ} (hζ : 0 < ζ) (hN : ∀ k, multiaffineBiasBudget n ζ ≤ N k) + (H : I → ℝ) (hH : ∀ k, 0 < H k) {A : ℝ} (hA : 0 ≤ A) + (hscale : ∀ k, H k ≤ A * ((stride k : ℝ) * (N k : ℝ))) + (hrank : HasLayerSamplingRank (n + 1) H R W p) + (hrow : ∀ j, |(integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ)| ≤ B) + (hrowBudget : ((n + 1).factorial : ℝ) * B ≤ R) + (hnonzero : ∃ w : W, + (∑ j, (integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ) * w.val j) ≠ 0) + (hdenom : (∏ j : Fin (n + 1) → I, + (multiaffineBiasBudget n ζ * ∏ i, (stride (j i) : ℝ))) ≤ R) + (hcoeff : (Fintype.card I : ℝ) ^ (n + 1) * (A ^ (n + 1) * multiaffineBiasBudget n ζ) ≤ R) + (site : T → K → ℤ) (hzero : ∀ t, ∃ i, (∑ k, a i k * site t k) = 0) + (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < n + 1) + (test : T → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) + {β : ℝ} (hβ : 0 ≤ β) (hpower : ζ ≤ β ^ (2 ^ (n + 1))) + (base : K → I → ℝ) : + ‖𝔼 x : Fin (n + 1) → ∀ j, Fin (N j), + coefficientModeTestedPhase (coefficientFunctional (fun d j => (frequency d j : ℝ))) + p Q site test (rowShiftedTuple base a + (fun (y : ∀ j, Fin (N j)) j => (stride j : ℝ) * ((y j).val : ℝ)) x)‖ ≤ β := by + have he (b : K → I → ℝ) := coefficientModeTestedPhase_top + (coefficientFunctional (fun d j => (frequency d j : ℝ))) (n + 1) p Q site test b + simp_rw [he] + apply le_of_pow_le_pow_left₀ (pow_ne_zero _ (by norm_num : (2 : ℕ) ≠ 0)) hβ + exact (coefficient_mode_finite_removal frequency a (homogeneousPart (n + 1) p) + (homogeneousPart_homogeneous _ _) W N stride hs hζ hN H hH hA hscale + ((hasLayerSamplingRank_homogeneousPart_iff _ _ _ _ _).mpr hrank) + hrow hrowBudget hnonzero hdenom hcoeff site hzero base + (lowerModePolynomial _ (n + 1) p Q) (lowerModePolynomial_degree _ p hp Q hQ) + test htest).le.trans hpower + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators NNReal Classical + +theorem inhomogeneous_coefficient_mode_smooth_removal {I K J T : Type*} + [Fintype I] [DecidableEq I] [Fintype K] [Fintype J] [Fintype T] {n : ℕ} + (frequency : (K →₀ ℕ) → J → ℤ) (a : Fin (n + 1) → K → ℤ) + (p : VectorPolynomial I ℝ (J → ℝ)) (hp : DegreeLE (1 : I → ℕ) (n + 1) p) + (W : Submodule ℝ (J → ℝ)) (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) + {ζ R B : ℝ} (hζ : 0 < ζ) (hN : ∀ k, multiaffineBiasBudget n ζ ≤ N k) + (H : I → ℝ) (hH : ∀ k, 0 < H k) {A : ℝ} (hA : 0 ≤ A) + (hscale : ∀ k, H k ≤ A * ((stride k : ℝ) * (N k : ℝ))) + (hrank : HasLayerSamplingRank (n + 1) H R W p) + (hrow : ∀ j, |(integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ)| ≤ B) + (hrowBudget : ((n + 1).factorial : ℝ) * B ≤ R) + (hnonzero : ∃ w : W, + (∑ j, (integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ) * w.val j) ≠ 0) + (hdenom : (∏ j : Fin (n + 1) → I, + (multiaffineBiasBudget n ζ * ∏ i, (stride (j i) : ℝ))) ≤ R) + (hcoeff : (Fintype.card I : ℝ) ^ (n + 1) * (A ^ (n + 1) * multiaffineBiasBudget n ζ) ≤ R) + (site : T → K → ℤ) (hzero : ∀ t, ∃ i, (∑ k, a i k * site t k) = 0) + (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < n + 1) + (test : T → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) + (V : 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 (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + {C r β : ℝ} (hC : 0 ≤ C) (ha : ∀ i k, |(a i k : ℝ)| ≤ C) (hr : 0 ≤ r) + (hmove : ∀ z, ((n + 1 : ℕ) : ℝ) * C * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z) + (hβ : 0 ≤ β) (hpower : ζ ≤ β ^ (2 ^ (n + 1))) : + ‖∑' z : K × I → ℤ, ((smoothProductPMF V hV z).toReal : ℂ) * + coefficientModeTestedPhase (coefficientFunctional (fun d j => (frequency d j : ℝ))) + p Q site test (fun k j => (z (k, j) : ℝ))‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * r + β := by + have he (b : K → I → ℝ) := coefficientModeTestedPhase_top + (coefficientFunctional (fun d j => (frequency d j : ℝ))) (n + 1) p Q site test b + simp_rw [he] + exact coefficient_mode_smooth_removal frequency a (homogeneousPart (n + 1) p) + (homogeneousPart_homogeneous _ _) W N stride hs hζ hN H hH hA hscale + ((hasLayerSamplingRank_homogeneousPart_iff _ _ _ _ _).mpr hrank) + hrow hrowBudget hnonzero hdenom hcoeff site hzero + (lowerModePolynomial _ (n + 1) p Q) (lowerModePolynomial_degree _ p hp Q hQ) + test htest V hV hV1 hδ hδ1 hmesh hsmall hC ha hr hmove hβ hpower + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators + +noncomputable def lowerLayerPolynomial {I K : Type*} [Fintype K] {m : ℕ} + {W : Fin m → Type*} [∀ j, AddCommGroup (W j)] [∀ j, Module ℝ (W j)] + (i : Fin m) (L : ∀ j, VectorPolynomial K ℝ (W j) →ₗ[ℝ] ℝ) + (p : ∀ j, VectorPolynomial I ℝ (W j)) : MvPolynomial (K × I) ℝ := + ∑ j, if j < i then coefficientModePolynomial (L j) (p j) else 0 + +theorem lowerLayerPolynomial_degree {I K : Type*} [Fintype K] {m : ℕ} + {W : Fin m → Type*} [∀ j, AddCommGroup (W j)] [∀ j, Module ℝ (W j)] + (i : Fin m) (L : ∀ j, VectorPolynomial K ℝ (W j) →ₗ[ℝ] ℝ) + (p : ∀ j, VectorPolynomial I ℝ (W j)) + (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) : + (lowerLayerPolynomial i L p).totalDegree < i.val + 1 := by + apply lt_of_le_of_lt (b := i.val) _ (Nat.lt_succ_self _) + apply MvPolynomial.totalDegree_finsetSum_le + intro j _ + by_cases hji : j < i + · rw [ite_eq_left hji] + exact (coefficientModePolynomial_degreeLE (L j) (p j) (hp j)).trans + (Nat.succ_le_of_lt hji) + · simp [hji] + +theorem lowerLayerPolynomial_eval {I K : Type*} [Fintype K] {m : ℕ} + {W : Fin m → Type*} [∀ j, AddCommGroup (W j)] [∀ j, Module ℝ (W j)] + (i : Fin m) (L : ∀ j, VectorPolynomial K ℝ (W j) →ₗ[ℝ] ℝ) + (p : ∀ j, VectorPolynomial I ℝ (W j)) (b : K → I → ℝ) : + MvPolynomial.eval (fun z => b z.1 z.2) (lowerLayerPolynomial i L p) = + ∑ j, if j < i then L j (substitute (fun u => rowPolynomial (fun k => b k u)) (p j)) else 0 := by + rw [lowerLayerPolynomial, map_sum] + apply Finset.sum_congr rfl + intro j _ + by_cases hji : j < i <;> simp [hji, coefficientModePolynomial_eval] + +noncomputable def layeredModeTestedPhase {I K S : Type*} [Fintype K] [Fintype S] {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)) (Q : MvPolynomial (K × I) ℝ) + (site : S → K → ℤ) (test : S → (I → ℝ) → ℂ) (b : K → I → ℝ) : ℂ := + character (((∑ j, L j (substitute (fun u => rowPolynomial (fun k => b k u)) (p j))) + + MvPolynomial.eval (fun z => b z.1 z.2) Q : ℝ) : CircleFourier.Circle) * + ∏ s, test s (integerSiteValue (site s) b) + +theorem exists_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)] (i : Fin m) + (L : ∀ j, VectorPolynomial K ℝ (W j) →ₗ[ℝ] ℝ) + (p : ∀ j, VectorPolynomial I ℝ (W j)) + (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) + (site : S → K → ℤ) + (hfactor : ∀ j, i < j → ∃ M : (S → W j) →ₗ[ℝ] ℝ, + ∀ q, DegreeLE (1 : K → ℕ) (j.val + 1) q → + L j q = M (siteEvaluation (fun s k => (site s k : ℝ)) q)) + (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < i.val + 1) + (test : S → (I → ℝ) → ℂ) (htest : ∀ s x, ‖test s x‖ ≤ 1) : + ∃ Q' : MvPolynomial (K × I) ℝ, Q'.totalDegree < i.val + 1 ∧ + ∃ test' : S → (I → ℝ) → ℂ, (∀ s x, ‖test' s x‖ ≤ 1) ∧ ∀ b, + layeredModeTestedPhase L p Q site test b = + coefficientModeTestedPhase (L i) (p i) Q' site test' b := by + classical + let Q' := lowerLayerPolynomial i L p + Q + have hQ' : Q'.totalDegree < i.val + 1 := + lt_of_le_of_lt (MvPolynomial.totalDegree_add _ _) + (max_lt (lowerLayerPolynomial_degree i L p hp) hQ) + let low (b : K → I → ℝ) := + L i (substitute (fun u => rowPolynomial (fun k => b k u)) (p i)) + + MvPolynomial.eval (fun z => b z.1 z.2) Q' + obtain ⟨test', ht, he⟩ := exists_absorbed_integer_site_tests + (fun j : {j : Fin m // i < j} => j.val.val + 1) site + (fun j => L j.val) (fun j => hfactor j.val j.property) + (fun j => p j.val) (fun j => hp j.val) low test htest + refine ⟨Q', hQ', test', ht, ?_⟩ + intro b + have hsplit : (∑ j, L j (substitute (fun u => rowPolynomial (fun k => b k u)) (p j))) + + MvPolynomial.eval (fun z => b z.1 z.2) Q = low b + + ∑ j : {j : Fin m // i < j}, + L j.val (substitute (fun u => rowPolynomial (fun k => b k u)) (p j.val)) := by + rw [sum_split_at_layer i] + dsimp [low, Q'] + rw [map_add, lowerLayerPolynomial_eval] + ring + unfold layeredModeTestedPhase + rw [hsplit] + exact he b + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators + +theorem layeredModeTestedPhase_norm_le {I K S : Type*} [Fintype K] [Fintype S] {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)) (Q : MvPolynomial (K × I) ℝ) + (site : S → K → ℤ) (test : S → (I → ℝ) → ℂ) + (htest : ∀ s x, ‖test s x‖ ≤ 1) (b : K → I → ℝ) : + ‖layeredModeTestedPhase L p Q site test b‖ ≤ 1 := by + rw [layeredModeTestedPhase, norm_mul, norm_character, one_mul, norm_prod] + exact Finset.prod_le_one₀ (fun s _ => norm_nonneg _) (fun s _ => htest s _) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators NNReal Classical + +theorem layered_mode_smooth_removal {I K T : Type*} + [Fintype I] [DecidableEq I] [Fintype K] [Fintype T] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (i : Fin m) + (frequency : (K →₀ ℕ) → J i → ℤ) (a : Fin (i.val + 1) → K → ℤ) + (L : ∀ j, VectorPolynomial K ℝ (J j → ℝ) →ₗ[ℝ] ℝ) + (hL : L i = coefficientFunctional (fun d j => (frequency d j : ℝ))) + (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) + (W : Submodule ℝ (J i → ℝ)) (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) + {ζ R B : ℝ} (hζ : 0 < ζ) (hN : ∀ 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 : HasLayerSamplingRank (i.val + 1) H R W (p i)) + (hrow : ∀ j, |(integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ)| ≤ B) + (hrowBudget : ((i.val + 1).factorial : ℝ) * B ≤ R) + (hnonzero : ∃ w : W, + (∑ j, (integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ) * w.val j) ≠ 0) + (hdenom : (∏ j : Fin (i.val + 1) → I, + (multiaffineBiasBudget i.val ζ * ∏ i, (stride (j i) : ℝ))) ≤ R) + (hcoeff : (Fintype.card I : ℝ) ^ (i.val + 1) * (A ^ (i.val + 1) * multiaffineBiasBudget i.val ζ) ≤ R) + (site : T → K → ℤ) + (hfactor : ∀ j, i < j → ∃ M : (T → J j → ℝ) →ₗ[ℝ] ℝ, + ∀ q, DegreeLE (1 : K → ℕ) (j.val + 1) q → + L j q = M (siteEvaluation (fun t k => (site t k : ℝ)) q)) + (hzero : ∀ t, ∃ i, (∑ k, a i k * site t k) = 0) + (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < i.val + 1) + (test : T → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) + (V : 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 (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + {C r β : ℝ} (hC : 0 ≤ C) (ha : ∀ i k, |(a i k : ℝ)| ≤ C) (hr : 0 ≤ r) + (hmove : ∀ z, ((i.val + 1 : ℕ) : ℝ) * C * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z) + (hβ : 0 ≤ β) (hpower : ζ ≤ β ^ (2 ^ (i.val + 1))) : + ‖∑' z : K × I → ℤ, ((smoothProductPMF V hV z).toReal : ℂ) * + layeredModeTestedPhase L p Q site test (fun k j => (z (k, j) : ℝ))‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * r + β := by + classical + obtain ⟨Q', hQ', test', ht, he⟩ := exists_layered_mode_reduction i L p hp site hfactor Q hQ test htest + simp_rw [he, hL] + exact inhomogeneous_coefficient_mode_smooth_removal frequency a (p i) (hp i) + W N stride hs hζ hN H hH hA hscale hrank hrow hrowBudget hnonzero hdenom hcoeff + site hzero Q' hQ' test' ht V hV hV1 hδ hδ1 hmesh hsmall hC ha hr hmove hβ hpower + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +theorem degreeLE_restrictCoefficients {I V : Type*} [AddCommGroup V] [Module ℝ V] + (U : Submodule ℝ V) (p : VectorPolynomial I ℝ V) (hm : ∀ d, coefficients p d ∈ U) + {w : I → ℕ} {h : ℕ} (hp : DegreeLE w h p) : DegreeLE w h (restrictCoefficients U p hm) := by + apply (degreeLE_map_iff w h U.subtype Subtype.val_injective _).mp + simpa only [map_restrictCoefficients] using hp + +theorem coefficientModeTestedPhase_map {I K S V W : Type*} [Fintype K] [Fintype S] + [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] + (f : V →ₗ[ℝ] W) (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) + (p : VectorPolynomial I ℝ V) (Q : MvPolynomial (K × I) ℝ) + (site : S → K → ℤ) (test : S → (I → ℝ) → ℂ) (b : K → I → ℝ) : + coefficientModeTestedPhase (L.comp (map f)) p Q site test b = + coefficientModeTestedPhase L (map f p) Q site test b := by + simp only [coefficientModeTestedPhase, LinearMap.comp_apply, map_substitute] + +theorem layeredModeTestedPhase_map {I K S : Type*} [Fintype K] [Fintype S] {m : ℕ} + {V W : Fin m → Type*} + [∀ j, AddCommGroup (V j)] [∀ j, Module ℝ (V j)] + [∀ j, AddCommGroup (W j)] [∀ j, Module ℝ (W j)] + (f : ∀ j, V j →ₗ[ℝ] W j) (L : ∀ j, VectorPolynomial K ℝ (W j) →ₗ[ℝ] ℝ) + (p : ∀ j, VectorPolynomial I ℝ (V j)) (Q : MvPolynomial (K × I) ℝ) + (site : S → K → ℤ) (test : S → (I → ℝ) → ℂ) (b : K → I → ℝ) : + layeredModeTestedPhase (fun j => (L j).comp (map (f j))) p Q site test b = + layeredModeTestedPhase L (fun j => map (f j) (p j)) Q site test b := by + simp only [layeredModeTestedPhase, LinearMap.comp_apply, map_substitute] + +theorem exists_subspace_layered_mode_reduction {I K S : Type*} + [Fintype K] [Fintype S] [DecidableEq S] {m : ℕ} + {V : Fin m → Type*} [∀ j, AddCommGroup (V j)] [∀ j, Module ℝ (V j)] (i : Fin m) + (U : ∀ j, Submodule ℝ (V j)) (L : ∀ j, VectorPolynomial K ℝ (V j) →ₗ[ℝ] ℝ) + (p : ∀ j, VectorPolynomial I ℝ (V j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) + (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) + (site : S → K → ℤ) + (hfactor : ∀ j, i < j → ∃ M : (S → U j) →ₗ[ℝ] ℝ, + ∀ q, DegreeLE (1 : K → ℕ) (j.val + 1) q → + L j (map (U j).subtype q) = M (siteEvaluation (fun s k => (site s k : ℝ)) q)) + (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < i.val + 1) + (test : S → (I → ℝ) → ℂ) (htest : ∀ s x, ‖test s x‖ ≤ 1) : + ∃ Q' : MvPolynomial (K × I) ℝ, Q'.totalDegree < i.val + 1 ∧ + ∃ test' : S → (I → ℝ) → ℂ, (∀ s x, ‖test' s x‖ ≤ 1) ∧ ∀ b, + layeredModeTestedPhase L p Q site test b = + coefficientModeTestedPhase (L i) (p i) Q' site test' b := by + let p' := fun j => restrictCoefficients (U j) (p j) (hm j) + have hp' j : DegreeLE (1 : I → ℕ) (j.val + 1) (p' j) := + degreeLE_restrictCoefficients (U j) (p j) (hm j) (hp j) + obtain ⟨Q', hQ', test', ht, he⟩ := exists_layered_mode_reduction i + (fun j => (L j).comp (map (U j).subtype)) p' hp' site hfactor Q hQ test htest + refine ⟨Q', hQ', test', ht, ?_⟩ + intro b + simpa only [layeredModeTestedPhase_map, coefficientModeTestedPhase_map, p', + map_restrictCoefficients] using he b + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators NNReal Classical + +theorem subspace_layered_mode_smooth_removal {I K T : Type*} + [Fintype I] [DecidableEq I] [Fintype K] [Fintype T] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (i : Fin m) + (frequency : (K →₀ ℕ) → J i → ℤ) (a : Fin (i.val + 1) → K → ℤ) + (L : ∀ j, VectorPolynomial K ℝ (J j → ℝ) →ₗ[ℝ] ℝ) + (hL : L i = coefficientFunctional (fun d j => (frequency d j : ℝ))) + (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (hm : ∀ j d, coefficients (p j) d ∈ U j) + (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) + {ζ R B : ℝ} (hζ : 0 < ζ) (hN : ∀ 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 : HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) + (hrow : ∀ j, |(integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ)| ≤ B) + (hrowBudget : ((i.val + 1).factorial : ℝ) * B ≤ R) + (hnonzero : ∃ w : U i, + (∑ j, (integerContractedRow frequency (∏ i, rowPolynomial (a i)) j : ℝ) * w.val j) ≠ 0) + (hdenom : (∏ j : Fin (i.val + 1) → I, + (multiaffineBiasBudget i.val ζ * ∏ i, (stride (j i) : ℝ))) ≤ R) + (hcoeff : (Fintype.card I : ℝ) ^ (i.val + 1) * (A ^ (i.val + 1) * multiaffineBiasBudget i.val ζ) ≤ R) + (site : T → K → ℤ) + (hfactor : ∀ j, i < j → ∃ M : (T → U j) →ₗ[ℝ] ℝ, + ∀ q, DegreeLE (1 : K → ℕ) (j.val + 1) q → + L j (map (U j).subtype q) = M (siteEvaluation (fun t k => (site t k : ℝ)) q)) + (hzero : ∀ t, ∃ i, (∑ k, a i k * site t k) = 0) + (Q : MvPolynomial (K × I) ℝ) (hQ : Q.totalDegree < i.val + 1) + (test : T → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) + (V : 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 (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + {C r β : ℝ} (hC : 0 ≤ C) (ha : ∀ i k, |(a i k : ℝ)| ≤ C) (hr : 0 ≤ r) + (hmove : ∀ z, ((i.val + 1 : ℕ) : ℝ) * C * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z) + (hβ : 0 ≤ β) (hpower : ζ ≤ β ^ (2 ^ (i.val + 1))) : + ‖∑' z : K × I → ℤ, ((smoothProductPMF V hV z).toReal : ℂ) * + layeredModeTestedPhase L p Q site test (fun k j => (z (k, j) : ℝ))‖ ≤ + 4 * (3 : ℝ) ^ Fintype.card (K × I) * + ((Fintype.card (K × I) : ℝ) * probabilityProfileLipschitz) * r + β := by + classical + obtain ⟨Q', hQ', test', ht, he⟩ := exists_subspace_layered_mode_reduction i U L p hm hp site hfactor Q hQ test htest + simp_rw [he, hL] + exact inhomogeneous_coefficient_mode_smooth_removal frequency a (p i) (hp i) + (U i) N stride hs hζ hN H hH hA hscale hrank hrow hrowBudget hnonzero hdenom hcoeff + site hzero Q' hQ' test' ht V hV hV1 hδ hδ1 hmesh hsmall hC ha hr hmove hβ hpower + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymbolAbsorptionBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymbolAbsorptionBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c75c6751357af7705b111e96d355e7a1de3df9a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymbolAbsorptionBounds.lean @@ -0,0 +1,666 @@ +import OAI.Combinatorics.Progressions.Linear.CoordinateProjectionBounds +import OAI.Combinatorics.Progressions.Linear.RescaledLieBasis +import OAI.Combinatorics.Progressions.Nilpotent.RationalBCHProducts +import OAI.Combinatorics.Progressions.Polynomial.RankPolynomialFactorization + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem exists_symbol_rational_closure (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → + (∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) → + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + (∀ a b' : F.PolynomialSymbolGroup w, + (fun z => (F.polynomialSymbolBasis b ω hlayers w).repr a.coord z) ∈ denominatorGrid l → + (fun z => (F.polynomialSymbolBasis b ω hlayers w).repr b'.coord z) ∈ denominatorGrid l → + (fun z => (F.polynomialSymbolBasis b ω hlayers w).repr (a * b').coord z) ∈ denominatorGrid m) ∧ + (∀ a : F.PolynomialSymbolGroup w, + (fun z => (F.polynomialSymbolBasis b ω hlayers w).repr a.coord z) ∈ denominatorGrid l → + (fun z => (F.polynomialSymbolBasis b ω hlayers w).repr (a⁻¹).coord z) ∈ denominatorGrid m) := by + obtain ⟨K, _, hK⟩ := exists_bch_rational_closure s + let R : Polynomial ℕ := ((Polynomial.X + Polynomial.C (s + 2)) ^ (s + 2) + Polynomial.C K) ^ K + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget R + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F b ω hlayers w hw H p hH hp hι hσ hHp hb l hl hlp + let : Fintype (SymbolBasisIndex w ω) := + symbolBasisIndexFintype w ω s hw (F.adaptedBasis_weight_le_step b ω hlayers) + let B := F.polynomialSymbolBasis b ω hlayers w + let q : ℝ := (p + (s + 2)) ^ (s + 2) + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by + apply (show p ≤ p + (s + 2 : ℝ) from le_add_of_nonneg_right (by positivity)).trans + simpa only [pow_one] using pow_le_pow_right₀ + (show (1 : ℝ) ≤ p + (s + 2) by have := Nat.cast_nonneg (α := ℝ) s; linarith) + (show 1 ≤ s + 2 by omega) + have hdim : (Fintype.card (SymbolBasisIndex w ω) : ℝ) ≤ q := + (Nat.cast_le.mpr (symbolBasisIndex_card_le w ω s hw + (F.adaptedBasis_weight_le_step b ω hlayers))).trans + (symbol_dimension_bound_le_power s (Fintype.card ι) (Fintype.card σ) hp hι hσ) + have hstruct : ∀ i j k, RationalHeightLE (lieStructureConstants B i j k) H := + F.polynomialSymbolBasis_bracket_height b ω hlayers w hH hb + obtain ⟨m, hm, hmp, hlm, hmul⟩ := hK B H q hq hdim + (hHp.trans (Real.exp_le_exp.mpr hpq)) hstruct l hl (hlp.trans (Real.exp_le_exp.mpr hpq)) + have hpoly : (q + K) ^ K ≤ (p + C) ^ C := by + simpa [R, q, Polynomial.eval₂_pow] using hbound p hp + refine ⟨m, hm, hmp.trans (Real.exp_le_exp.mpr hpoly), hlm, ?_, ?_⟩ + · intro a b' ha hb' + exact hmul a.coord b'.coord ha hb' + · intro a ha + have hneg := denominatorGrid_subset_of_dvd hlm (denominatorGrid_neg l ha) + change B.equivFun (-a.coord) ∈ denominatorGrid m + rw [map_neg] + exact hneg + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct + +abbrev RealPolynomialSymbol {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (w : σ → ℕ) := + ℝ ⊗[ℚ] F.PolynomialSymbol w + +abbrev RealPolynomialSymbolGroup {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (w : σ → ℕ) := + NilpotentLieBCHGroup (F.RealPolynomialSymbol w) s + (realification_lowerCentralSeries_eq_bot (F.polynomialSymbol_lowerCentralSeries_eq_bot w)) + +theorem exists_real_symbol_rational_closure (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → + (∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) → + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + (∀ a b' : F.RealPolynomialSymbolGroup w, + (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr a.coord z) + ∈ realDenominatorGrid l → + (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr b'.coord z) + ∈ realDenominatorGrid l → + (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr (a * b').coord z) + ∈ realDenominatorGrid m) ∧ + (∀ a : F.RealPolynomialSymbolGroup w, + (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr a.coord z) + ∈ realDenominatorGrid l → + (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr (a⁻¹).coord z) + ∈ realDenominatorGrid m) := by + obtain ⟨C, hC, hbound⟩ := exists_symbol_rational_closure s + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F b ω hlayers w hw H p hH hp hι hσ hHp hb l hl hlp + let : Fintype (SymbolBasisIndex w ω) := + symbolBasisIndexFintype w ω s hw (F.adaptedBasis_weight_le_step b ω hlayers) + obtain ⟨m, hm, hmp, hlm, hmul, hinv⟩ := + hbound F b ω hlayers w hw H p hH hp hι hσ hHp hb l hl hlp + refine ⟨m, hm, hmp, hlm, ?_, ?_⟩ + · exact NilpotentLieBCHGroup.realification_grid_mul + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) + (F.polynomialSymbolBasis b ω hlayers w) l m hl hmul + · exact NilpotentLieBCHGroup.realification_grid_inv + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) + (F.polynomialSymbolBasis b ω hlayers w) l m hl hinv + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) + +theorem realPolynomialSymbolBasis_bracket_support (u v z : SymbolBasisIndex w ω) + (h : ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr + ⁅(F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ u, + (F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ v⁆ z ≠ 0) : + u.val.1 + v.val.1 = z.val.1 := by + classical + by_contra hn + apply h + rw [realLieBasis_structure] + change (((F.polynomialSymbolBasis b ω hlayers w).repr + ⁅F.polynomialSymbolBasis b ω hlayers w u, + F.polynomialSymbolBasis b ω hlayers w v⁆ z : ℚ) : ℝ) = 0 + simp only [F.polynomialSymbolBasis_bracket, hn, ↓reduceIte, Rat.cast_zero] + +noncomputable def scaledRealPolynomialSymbolBasis (T : σ → ℝ) (hT : ∀ i, 0 < T i) : + Basis (SymbolBasisIndex w ω) ℝ (F.RealPolynomialSymbol w) := + inverseScaledBasis ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ) + (fun z => monomialScale T z.val.1) (fun z => monomialScale_pos T hT z.val.1) + +theorem scaledRealPolynomialSymbolBasis_repr (T : σ → ℝ) (hT : ∀ i, 0 < T i) + (x : F.RealPolynomialSymbol w) (z : SymbolBasisIndex w ω) : + (F.scaledRealPolynomialSymbolBasis b ω hlayers w T hT).repr x z = + monomialScale T z.val.1 * + ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr x z := + inverseScaledBasis_repr _ _ _ _ _ + +theorem scaledRealPolynomialSymbolBasis_structure (T : σ → ℝ) (hT : ∀ i, 0 < T i) + (u v z : SymbolBasisIndex w ω) : + (F.scaledRealPolynomialSymbolBasis b ω hlayers w T hT).repr + ⁅F.scaledRealPolynomialSymbolBasis b ω hlayers w T hT u, + F.scaledRealPolynomialSymbolBasis b ω hlayers w T hT v⁆ z = + (lieStructureConstants (F.polynomialSymbolBasis b ω hlayers w) u v z : ℝ) := by + apply Eq.trans (inverseScaledBasis_bracket _ _ _ ?_ u v z) + · exact realLieBasis_structure _ u v z + · intro i j k h + have hijk := F.realPolynomialSymbolBasis_bracket_support b ω hlayers w i j k h + rw [← hijk, monomialScale_add] + +theorem scaledRealPolynomialSymbolBasis_bound_iff (T : σ → ℝ) (hT : ∀ i, 0 < T i) + (x : F.RealPolynomialSymbol w) (z : SymbolBasisIndex w ω) (M : ℝ) : + |(F.scaledRealPolynomialSymbolBasis b ω hlayers w T hT).repr x z| ≤ M ↔ + |((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr x z| ≤ + M / monomialScale T z.val.1 := by + rw [F.scaledRealPolynomialSymbolBasis_repr, abs_mul, + abs_of_pos (monomialScale_pos T hT z.val.1), le_div_iff₀ (monomialScale_pos T hT z.val.1)] + rw [mul_comm] + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +theorem realDenominatorGrid_neg {ι : Type*} (l : ℕ) {x : ι → ℝ} + (hx : x ∈ realDenominatorGrid l) : -x ∈ realDenominatorGrid l := by + obtain ⟨z, hz⟩ := hx + refine ⟨-z, ?_⟩ + funext i + have hi := congrFun hz i + change (z i : ℝ) = (l : ℝ) * x i at hi + change ((-z i : ℤ) : ℝ) = (l : ℝ) * (-x i) + rw [Int.cast_neg, hi, mul_neg] + +namespace NilpotentLieFiltration + +open Module + +def SymbolRationalGrid {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (l : ℕ) (g : F.RealPolynomialSymbolGroup w) : Prop := + (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr g.coord z) + ∈ realDenominatorGrid l + +theorem symbolRationalGrid_inv {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (l : ℕ) {g : F.RealPolynomialSymbolGroup w} + (hg : F.SymbolRationalGrid b ω hlayers w l g) : + F.SymbolRationalGrid b ω hlayers w l g⁻¹ := by + change (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr (-g.coord) z) + ∈ realDenominatorGrid l + have heq : (fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr (-g.coord) z) = + -(fun z => ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr g.coord z) := by + funext z + simp only [map_neg, Finsupp.neg_apply, Pi.neg_apply] + rw [heq] + exact realDenominatorGrid_neg l hg + +theorem exists_symbol_rational_product_bound (s k : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + ∀ rs : List (F.RealPolynomialSymbolGroup w), rs.length ≤ k → + (∀ r ∈ rs, F.SymbolRationalGrid b ω hlayers w l r) → + F.SymbolRationalGrid b ω hlayers w m rs.prod := by + obtain ⟨K, _, hK⟩ := exists_real_bch_rational_product_bound s k + let R : Polynomial ℕ := ((Polynomial.X + Polynomial.C (s + 2)) ^ (s + 2) + Polynomial.C K) ^ K + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget R + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F b ω hlayers w hw H p hH hp hι hσ hHp hb l hl hlp + let : Fintype (SymbolBasisIndex w ω) := + symbolBasisIndexFintype w ω s hw (F.adaptedBasis_weight_le_step b ω hlayers) + let B := F.polynomialSymbolBasis b ω hlayers w + let q : ℝ := (p + (s + 2)) ^ (s + 2) + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by + apply (show p ≤ p + (s + 2 : ℝ) from le_add_of_nonneg_right (by positivity)).trans + simpa only [pow_one] using pow_le_pow_right₀ + (show (1 : ℝ) ≤ p + (s + 2) by have := Nat.cast_nonneg (α := ℝ) s; linarith) + (show 1 ≤ s + 2 by omega) + have hdim : (Fintype.card (SymbolBasisIndex w ω) : ℝ) ≤ q := + (Nat.cast_le.mpr (symbolBasisIndex_card_le w ω s hw + (F.adaptedBasis_weight_le_step b ω hlayers))).trans + (symbol_dimension_bound_le_power s (Fintype.card ι) (Fintype.card σ) hp hι hσ) + have hstruct : ∀ i j z, RationalHeightLE (lieStructureConstants B i j z) H := + F.polynomialSymbolBasis_bracket_height b ω hlayers w hH hb + obtain ⟨m, hm, hmp, hlm, hprod⟩ := hK B H q + (F.polynomialSymbol_lowerCentralSeries_eq_bot w) hq hdim + (hHp.trans (Real.exp_le_exp.mpr hpq)) hstruct l hl (hlp.trans (Real.exp_le_exp.mpr hpq)) + have hpoly : (q + K) ^ K ≤ (p + C) ^ C := by + simpa [R, q, Polynomial.eval₂_pow] using hbound p hp + exact ⟨m, hm, hmp.trans (Real.exp_le_exp.mpr hpoly), hlm, hprod⟩ + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +def SymbolSlowBound {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (T : σ → ℝ) (M : ℝ) (g : F.RealPolynomialSymbolGroup w) : Prop := + ∀ z : SymbolBasisIndex w ω, + |((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr g.coord z| ≤ + M / monomialScale T z.val.1 + +@[simp] theorem symbolSlowBound_inv_iff {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (T : σ → ℝ) (M : ℝ) (g : F.RealPolynomialSymbolGroup w) : + F.SymbolSlowBound b ω hlayers w T M g⁻¹ ↔ F.SymbolSlowBound b ω hlayers w T M g := by + simp only [SymbolSlowBound, NilpotentLieBCHGroup.coord_inv, map_neg, Finsupp.neg_apply, abs_neg] + +theorem exists_symbol_slow_product_bound (s a k : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + ∀ (T : σ → ℝ), (∀ i, 0 < T i) → + ∀ rs : List (F.RealPolynomialSymbolGroup w), rs.length ≤ k → + (∀ r ∈ rs, F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) r) → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + C) ^ C)) rs.prod := by + obtain ⟨K, _, hK⟩ := exists_bch_fixed_product_exp_bound s a k + let R : Polynomial ℕ := ((Polynomial.X + Polynomial.C (s + 2)) ^ (s + 2) + Polynomial.C K) ^ K + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget R + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F b ω hlayers w hw H p hH hp hι hσ hHp hb T hT rs hlen hrs + let : Fintype (SymbolBasisIndex w ω) := + symbolBasisIndexFintype w ω s hw (F.adaptedBasis_weight_le_step b ω hlayers) + let B := F.polynomialSymbolBasis b ω hlayers w + let E := F.scaledRealPolynomialSymbolBasis b ω hlayers w T hT + let q : ℝ := (p + (s + 2)) ^ (s + 2) + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by + apply (show p ≤ p + (s + 2 : ℝ) from le_add_of_nonneg_right (by positivity)).trans + simpa only [pow_one] using pow_le_pow_right₀ + (show (1 : ℝ) ≤ p + (s + 2) by have := Nat.cast_nonneg (α := ℝ) s; linarith) + (show 1 ≤ s + 2 by omega) + have hdim : (Fintype.card (SymbolBasisIndex w ω) : ℝ) ≤ q := + (Nat.cast_le.mpr (symbolBasisIndex_card_le w ω s hw + (F.adaptedBasis_weight_le_step b ω hlayers))).trans + (symbol_dimension_bound_le_power s (Fintype.card ι) (Fintype.card σ) hp hι hσ) + have hstruct : ∀ i j z, algebraMap ℚ ℝ (lieStructureConstants B i j z) = E.repr ⁅E i, E j⁆ z := + fun i j z => (F.scaledRealPolynomialSymbolBasis_structure b ω hlayers w T hT i j z).symm + have hheight : ∀ i j z, RationalHeightLE (lieStructureConstants B i j z) H := + F.polynomialSymbolBasis_bracket_height b ω hlayers w hH hb + have hinput : ∀ r ∈ rs, ∀ z, |E.repr r.coord z| ≤ Real.exp ((q + 2) ^ a) := by + intro r hr z + have hscaled := (F.scaledRealPolynomialSymbolBasis_bound_iff b ω hlayers w T hT + r.coord z (Real.exp ((p + 2) ^ a))).mpr (hrs r hr z) + exact hscaled.trans (Real.exp_le_exp.mpr (pow_le_pow_left₀ (by positivity) (by linarith) a)) + have hpoly : (q + K) ^ K ≤ (p + C) ^ C := by + simpa [R, q, Polynomial.eval₂_pow] using hbound p hp + intro z + apply (F.scaledRealPolynomialSymbolBasis_bound_iff b ω hlayers w T hT + rs.prod.coord z (Real.exp ((p + C) ^ C))).mp + exact (hK E (lieStructureConstants B) H q + (realification_lowerCentralSeries_eq_bot (F.polynomialSymbol_lowerCentralSeries_eq_bot w)) + rs hstruct hq hdim hlen (hHp.trans (Real.exp_le_exp.mpr hpq)) hheight hinput z).trans + (Real.exp_le_exp.mpr hpoly) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) + +include hlayers + +theorem symbolBasisIndex_monomial_ne_zero (z : SymbolBasisIndex w ω) : z.val.1 ≠ 0 := by + intro hz + have hd := z.property + rw [hz, map_zero] at hd + have hp := F.adaptedBasis_weight_pos b ω hlayers z.val.2 + omega + +theorem symbolSlowBound_log_norm [Fintype (SymbolBasisIndex w ω)] + (T : σ → ℝ) {R M : ℝ} (hR : 1 ≤ R) (hT : ∀ i, R ≤ T i) (hM : 0 ≤ M) + (g : F.RealPolynomialSymbolGroup w) (hg : F.SymbolSlowBound b ω hlayers w T M g) : + ‖((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).equivFun g.coord‖ ≤ M / R := by + apply (pi_norm_le_iff_of_nonneg (div_nonneg hM (zero_le_one.trans hR))).mpr + intro z + change |((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr g.coord z| ≤ M / R + have hscale := le_monomialScale_of_ne_zero T hR hT + (F.symbolBasisIndex_monomial_ne_zero b ω hlayers w z) + exact (hg z).trans (div_le_div_of_nonneg_left hM (zero_lt_one.trans_le hR) hscale) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (w : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + +include hlayers in +theorem sub_realGradeTruncation_mem (j : ℕ) (x : ℝ ⊗[ℚ] L) : + x - basisBelowProjection (b.baseChange ℝ) w j x ∈ F.realification.layer j := by + change x - basisBelowProjection (b.baseChange ℝ) w j x ∈ (F.realLayer j).toSubmodule + rw [F.realLayer_eq_span_basis b j {i | j ≤ w i} (hlayers j)] + exact sub_basisBelowProjection_mem (b.baseChange ℝ) w j x + +include hlayers in +theorem realGradeTruncation_eq_iff (j : ℕ) (x y : ℝ ⊗[ℚ] L) : + basisBelowProjection (b.baseChange ℝ) w j x = basisBelowProjection (b.baseChange ℝ) w j y ↔ + x - y ∈ F.realification.layer j := by + change _ ↔ x - y ∈ (F.realLayer j).toSubmodule + rw [F.realLayer_eq_span_basis b j {i | j ≤ w i} (hlayers j)] + exact basisBelowProjection_eq_iff (b.baseChange ℝ) w j x y + +include hlayers in +theorem realGradeTruncation_quotient (j : ℕ) (x : ℝ ⊗[ℚ] L) : + lieQuotientMap (F.realification.layerIdeal j) (basisBelowProjection (b.baseChange ℝ) w j x) = + lieQuotientMap (F.realification.layerIdeal j) x := by + have h := (lieQuotientMap_eq_zero (F.realification.layerIdeal j) _).mpr + (F.sub_realGradeTruncation_mem b w hlayers j x) + rw [map_sub, sub_eq_zero] at h + exact h.symm + +noncomputable def truncateRealGrades (j : ℕ) (g : F.realification.Group) : F.realification.Group := + ⟨basisBelowProjection (b.baseChange ℝ) w j g.coord⟩ + +@[simp] theorem truncateRealGrades_coord (j : ℕ) (g : F.realification.Group) : + (F.truncateRealGrades b w j g).coord = basisBelowProjection (b.baseChange ℝ) w j g.coord := rfl + +include hlayers in +theorem truncateRealGrades_quotient (j : ℕ) (g : F.realification.Group) : + NilpotentLieBCHGroup.quotientHom (hnil := F.realification.lowerCentralSeries_eq_bot) (F.realification.layerIdeal j) (F.truncateRealGrades b w j g) = + NilpotentLieBCHGroup.quotientHom (hnil := F.realification.lowerCentralSeries_eq_bot) (F.realification.layerIdeal j) g := by + apply NilpotentLieBCHGroup.ext + exact F.realGradeTruncation_quotient b w hlayers j g.coord + +include hlayers in + +theorem truncateRealGrades_mem_of_quotient_mem (U : LieSubalgebra ℝ (ℝ ⊗[ℚ] L)) + (hU : BasisGradedSubmodule (b.baseChange ℝ) w U.toSubmodule) + (j : ℕ) (g : F.realification.Group) + (hg : NilpotentLieBCHGroup.quotientHom (hnil := F.realification.lowerCentralSeries_eq_bot) (F.realification.layerIdeal j) g ∈ + (NilpotentLieBCHGroup.realLieSubgroup (hnil := F.realification.lowerCentralSeries_eq_bot) U).map + (NilpotentLieBCHGroup.quotientHom (hnil := F.realification.lowerCentralSeries_eq_bot) (F.realification.layerIdeal j))) : + (F.truncateRealGrades b w j g).coord ∈ U := by + obtain ⟨u, hu, heq⟩ := Subgroup.mem_map.mp hg + have hdiff : g.coord - u.coord ∈ F.realification.layer j := by + apply (lieQuotientMap_eq_zero (F.realification.layerIdeal j) _).mp + rw [map_sub] + exact sub_eq_zero.mpr (congrArg NilpotentLieBCHGroup.coord heq).symm + have ht := (F.realGradeTruncation_eq_iff b w hlayers j g.coord u.coord).mpr hdiff + change basisBelowProjection (b.baseChange ℝ) w j g.coord ∈ U + rw [ht] + exact hU.below_mem (b.baseChange ℝ) w U.toSubmodule j u.coord hu + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (w : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) (v : σ → ℕ) + +theorem symbolSlowBound_mono (T : σ → ℝ) (hT : ∀ i, 0 < T i) {M N : ℝ} (hMN : M ≤ N) + (g : F.RealPolynomialSymbolGroup v) (hg : F.SymbolSlowBound b w hlayers v T M g) : + F.SymbolSlowBound b w hlayers v T N g := by + intro z + exact (hg z).trans (div_le_div_of_nonneg_right hMN (le_of_lt (monomialScale_pos T hT z.val.1))) + +theorem symbolRationalGrid_mono {l m : ℕ} (hl : 0 < l) (hlm : l ∣ m) + (g : F.RealPolynomialSymbolGroup v) (hg : F.SymbolRationalGrid b w hlayers v l g) : + F.SymbolRationalGrid b w hlayers v m g := + realDenominatorGrid_subset_of_dvd hl hlm hg + +noncomputable def truncateRealSymbol (j : ℕ) (g : F.RealPolynomialSymbolGroup v) : + F.RealPolynomialSymbolGroup v := + (F.polynomialSymbolFiltration v).truncateRealGrades + (F.polynomialSymbolBasis b w hlayers v) (fun z => w z.val.2) j g + +@[simp] theorem truncateRealSymbol_coord (j : ℕ) (g : F.RealPolynomialSymbolGroup v) : + (F.truncateRealSymbol b w hlayers v j g).coord = + basisBelowProjection ((F.polynomialSymbolBasis b w hlayers v).baseChange ℝ) + (fun z => w z.val.2) j g.coord := rfl + +theorem truncateRealSymbol_slow (j : ℕ) (g : F.RealPolynomialSymbolGroup v) + (T : σ → ℝ) (M : ℝ) (hg : F.SymbolSlowBound b w hlayers v T M g) : + F.SymbolSlowBound b w hlayers v T M (F.truncateRealSymbol b w hlayers v j g) := by + intro z + exact (basisCoordinateProjection_abs_repr_le + ((F.polynomialSymbolBasis b w hlayers v).baseChange ℝ) {z | w z.val.2 < j} g.coord z).trans (hg z) + +theorem truncateRealSymbol_rational (j : ℕ) (g : F.RealPolynomialSymbolGroup v) + (l : ℕ) (hg : F.SymbolRationalGrid b w hlayers v l g) : + F.SymbolRationalGrid b w hlayers v l (F.truncateRealSymbol b w hlayers v j g) := + basisCoordinateProjection_real_grid ((F.polynomialSymbolBasis b w hlayers v).baseChange ℝ) + {z | w z.val.2 < j} l g.coord hg + +theorem truncateRealSymbol_quotient (j : ℕ) (g : F.RealPolynomialSymbolGroup v) : + NilpotentLieBCHGroup.quotientHom + ((F.polynomialSymbolFiltration v).realification.layerIdeal j) + (F.truncateRealSymbol b w hlayers v j g) = + NilpotentLieBCHGroup.quotientHom ((F.polynomialSymbolFiltration v).realification.layerIdeal j) g := + (F.polynomialSymbolFiltration v).truncateRealGrades_quotient + (F.polynomialSymbolBasis b w hlayers v) (fun z => w z.val.2) + (F.polynomialSymbolFiltration_layer b w hlayers v) j g + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +variable {σ ι κ : Type*} + +def reindexSymbolBasisIndex (w : σ → ℕ) (ω : ι → ℕ) (e : ι ≃ κ) : + SymbolBasisIndex w ω ≃ SymbolBasisIndex w (fun k => ω (e.symm k)) where + toFun z := ⟨(z.val.1, e z.val.2), by simpa only [Equiv.symm_apply_apply] using z.property⟩ + invFun z := ⟨(z.val.1, e.symm z.val.2), z.property⟩ + left_inv z := by apply Subtype.ext; simp only [Equiv.symm_apply_apply] + right_inv z := by apply Subtype.ext; simp only [Equiv.apply_symm_apply] + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (e : ι ≃ κ) + (hF' : ∀ j, F.layer j = Submodule.span ℚ ((b.reindex e) '' {k | j ≤ ω (e.symm k)})) + (w : σ → ℕ) + +theorem polynomialSymbolBasis_repr_reindex (x : F.PolynomialSymbol w) + (z : SymbolBasisIndex w (fun k => ω (e.symm k))) : + (F.polynomialSymbolBasis (b.reindex e) (fun k => ω (e.symm k)) hF' w).repr x z = + (F.polynomialSymbolBasis b ω hF w).repr x ((reindexSymbolBasisIndex w ω e).symm z) := by + obtain ⟨p, rfl⟩ := F.polynomialSymbolMap_surjective w x + rw [F.polynomialSymbolBasis_repr_map, F.polynomialSymbolBasis_repr_map, + Basis.repr_reindex_apply] + rfl + +theorem realPolynomialSymbolBasis_repr_reindex (x : F.RealPolynomialSymbol w) + (z : SymbolBasisIndex w (fun k => ω (e.symm k))) : + ((F.polynomialSymbolBasis (b.reindex e) (fun k => ω (e.symm k)) hF' w).baseChange ℝ).repr x z = + ((F.polynomialSymbolBasis b ω hF w).baseChange ℝ).repr x + ((reindexSymbolBasisIndex w ω e).symm z) := by + induction x using TensorProduct.inductionOn with + | tmul a x => + rw [Basis.baseChange_repr_tmul, Basis.baseChange_repr_tmul, + F.polynomialSymbolBasis_repr_reindex b ω hF e hF' w] + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy] + +theorem symbolSlowBound_reindex_iff (T : σ → ℝ) (M : ℝ) (g : F.RealPolynomialSymbolGroup w) : + F.SymbolSlowBound (b.reindex e) (fun k => ω (e.symm k)) hF' w T M g ↔ + F.SymbolSlowBound b ω hF w T M g := by + constructor + · intro hg z + have hz := hg (reindexSymbolBasisIndex w ω e z) + rw [F.realPolynomialSymbolBasis_repr_reindex b ω hF e hF' w, + Equiv.symm_apply_apply] at hz + exact hz + · intro hg z + rw [F.realPolynomialSymbolBasis_repr_reindex b ω hF e hF' w] + exact hg ((reindexSymbolBasisIndex w ω e).symm z) + +theorem symbolRationalGrid_reindex_iff (l : ℕ) (g : F.RealPolynomialSymbolGroup w) : + F.SymbolRationalGrid (b.reindex e) (fun k => ω (e.symm k)) hF' w l g ↔ + F.SymbolRationalGrid b ω hF w l g := by + constructor + · rintro ⟨a, ha⟩ + refine ⟨fun z => a (reindexSymbolBasisIndex w ω e z), ?_⟩ + funext z + have hz := congrFun ha (reindexSymbolBasisIndex w ω e z) + change (a (reindexSymbolBasisIndex w ω e z) : ℝ) = (l : ℝ) * + ((F.polynomialSymbolBasis (b.reindex e) (fun k => ω (e.symm k)) hF' w).baseChange ℝ).repr + g.coord (reindexSymbolBasisIndex w ω e z) at hz + rw [F.realPolynomialSymbolBasis_repr_reindex b ω hF e hF' w, + Equiv.symm_apply_apply] at hz + exact hz + · rintro ⟨a, ha⟩ + refine ⟨fun z => a ((reindexSymbolBasisIndex w ω e).symm z), ?_⟩ + funext z + change (a ((reindexSymbolBasisIndex w ω e).symm z) : ℝ) = (l : ℝ) * + ((F.polynomialSymbolBasis (b.reindex e) (fun k => ω (e.symm k)) hF' w).baseChange ℝ).repr + g.coord z + rw [F.realPolynomialSymbolBasis_repr_reindex b ω hF e hF' w] + exact congrFun ha ((reindexSymbolBasisIndex w ω e).symm z) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem exists_symbol_slow_mul_inv_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → + (∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) → + ∀ (T : σ → ℝ), (∀ i, 0 < T i) → ∀ E A : F.RealPolynomialSymbolGroup w, + F.SymbolSlowBound b ω hF w T (Real.exp (p + 2)) E → + F.SymbolSlowBound b ω hF w T (Real.exp (p + 2)) A → + F.SymbolSlowBound b ω hF w T (Real.exp ((p + C) ^ C)) (E * A⁻¹) := by + obtain ⟨C, hC, hprod⟩ := exists_symbol_slow_product_bound s 1 2 + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F b ω hF w hw H p hH hp hι hσ hHp hc T hT E A hE hA + have hinputs : ∀ x ∈ [E, A⁻¹], F.SymbolSlowBound b ω hF w T (Real.exp ((p + 2) ^ 1)) x := by + intro x hx + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl + · simpa only [pow_one] using hE + · simpa only [pow_one] using (F.symbolSlowBound_inv_iff b ω hF w T _ A).mpr hA + simpa only [List.prod_cons, List.prod_nil, mul_one] using + hprod F b ω hF w hw H p hH hp hι hσ hHp hc T hT [E, A⁻¹] (by simp) hinputs + +theorem exists_symbol_rational_inv_mul_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → + (∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) → + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + ∀ D R : F.RealPolynomialSymbolGroup w, + F.SymbolRationalGrid b ω hF w l D → F.SymbolRationalGrid b ω hF w l R → + F.SymbolRationalGrid b ω hF w m (D⁻¹ * R) := by + obtain ⟨C, hC, hprod⟩ := exists_symbol_rational_product_bound s 2 + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F b ω hF w hw H p hH hp hι hσ hHp hc l hl hlp + obtain ⟨m, hm, hmp, hlm, hproducts⟩ := hprod F b ω hF w hw H p hH hp hι hσ hHp hc l hl hlp + refine ⟨m, hm, hmp, hlm, ?_⟩ + intro D R hD hR + have hinputs : ∀ x ∈ [D⁻¹, R], F.SymbolRationalGrid b ω hF w l x := by + intro x hx + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl + · exact F.symbolRationalGrid_inv b ω hF w l hD + · exact hR + simpa only [List.prod_cons, List.prod_nil, mul_one] using hproducts [D⁻¹, R] (by simp) hinputs + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymbolCommonCorrections.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymbolCommonCorrections.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9944943a999e1fc18da8b2b50eae4b4a9d6216f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymbolCommonCorrections.lean @@ -0,0 +1,871 @@ +import OAI.Combinatorics.Progressions.Dynamics.CommonCorrectionBudget +import OAI.Combinatorics.Progressions.Dynamics.RestrictedGradePathMembership +import OAI.Combinatorics.Progressions.Estimates.ControlledLinearSubspaceLift +import OAI.Combinatorics.Progressions.Estimates.FastCoefficientBlocks +import OAI.Combinatorics.Progressions.Geometry.FilteredSubalgebraCoordinates +import OAI.Combinatorics.Progressions.Nilpotent.BCHSubmoduleRemainder + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem bracket_mem_subalgebra_sup_layer_succ (U : LieSubalgebra ℚ L) + {j : ℕ} (hj : 1 ≤ j) {a b : L} + (ha : a ∈ U.toSubmodule ⊔ F.layer j) (hb : b ∈ U.toSubmodule ⊔ F.layer j) : + ⁅a, b⁆ ∈ U.toSubmodule ⊔ F.layer (j + 1) := by + obtain ⟨u, hu, x, hx, rfl⟩ := Submodule.mem_sup.mp ha + obtain ⟨v, hv, y, hy, rfl⟩ := Submodule.mem_sup.mp hb + have hu1 : u ∈ F.layer 1 := by rw [F.one_eq_top]; trivial + have hv1 : v ∈ F.layer 1 := by rw [F.one_eq_top]; trivial + have huv : ⁅u, v⁆ ∈ U.toSubmodule ⊔ F.layer (j + 1) := + (le_sup_left : U.toSubmodule ≤ U.toSubmodule ⊔ F.layer (j + 1)) (U.lie_mem hu hv) + have huy : ⁅u, y⁆ ∈ U.toSubmodule ⊔ F.layer (j + 1) := by + apply (le_sup_right : F.layer (j + 1) ≤ U.toSubmodule ⊔ F.layer (j + 1)) + simpa only [Nat.add_comm 1 j] using F.lie_mem hu1 hy + have hxv : ⁅x, v⁆ ∈ U.toSubmodule ⊔ F.layer (j + 1) := + (le_sup_right : F.layer (j + 1) ≤ U.toSubmodule ⊔ F.layer (j + 1)) (F.lie_mem hx hv1) + have hxy : ⁅x, y⁆ ∈ U.toSubmodule ⊔ F.layer (j + 1) := + (le_sup_right : F.layer (j + 1) ≤ U.toSubmodule ⊔ F.layer (j + 1)) + (F.antitone (by omega : j + 1 ≤ j + j) (F.lie_mem hx hy)) + rw [add_lie, lie_add, lie_add] + exact Submodule.add_mem _ (Submodule.add_mem _ huv huy) (Submodule.add_mem _ hxv hxy) + +theorem bch_triple_remainder_mem_subalgebra_sup_layer (hs : 1 ≤ s) + (U : LieSubalgebra ℚ L) {j : ℕ} (hj : 1 ≤ j) (a b c : L) + (ha : a ∈ U.toSubmodule ⊔ F.layer j) + (hb : b ∈ U.toSubmodule ⊔ F.layer j) + (hc : c ∈ U.toSubmodule ⊔ F.layer j) : + lieBCH s (lieBCH s a b) c - (a + b + c) ∈ U.toSubmodule ⊔ F.layer (j + 1) := + lieBCH_triple_sub_sum_mem_submodule hs _ _ + (sup_le_sup_left (F.antitone (Nat.le_succ j)) _) + (fun _ hx _ hy => F.bracket_mem_subalgebra_sup_layer_succ U hj hx hy) a b c ha hb hc + +theorem outer_sum_mem_subalgebra_sup_layer (hs : 1 ≤ s) + (U : LieSubalgebra ℚ L) {j : ℕ} (hj : 1 ≤ j) (a d p p' : L) + (ha : a ∈ U.toSubmodule ⊔ F.layer j) + (hd : d ∈ U.toSubmodule ⊔ F.layer j) + (hp : p ∈ U) (hp' : p' ∈ U) + (heq : p = lieBCH s (lieBCH s a p') d) : + a + d ∈ U.toSubmodule ⊔ F.layer (j + 1) := by + have hrem := F.bch_triple_remainder_mem_subalgebra_sup_layer hs U hj a p' d ha + ((le_sup_left : U.toSubmodule ≤ U.toSubmodule ⊔ F.layer j) hp') hd + rw [← heq] at hrem + have hpW : p ∈ U.toSubmodule ⊔ F.layer (j + 1) := + (le_sup_left : U.toSubmodule ≤ U.toSubmodule ⊔ F.layer (j + 1)) hp + have hp'W : p' ∈ U.toSubmodule ⊔ F.layer (j + 1) := + (le_sup_left : U.toSubmodule ≤ U.toSubmodule ⊔ F.layer (j + 1)) hp' + convert Submodule.sub_mem _ (Submodule.sub_mem _ hpW hp'W) hrem using 1 + abel + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem outer_factors_mem_of_separation (U : LieSubalgebra ℚ L) + (A D P P' : F.Group) (hP : P.coord ∈ U) (hP' : P'.coord ∈ U) + (hidentity : P = A * P' * D) + (hseparate : ∀ j : ℕ, 1 ≤ j → j ≤ s → + A.coord + D.coord ∈ U.toSubmodule ⊔ F.layer (j + 1) → + A.coord ∈ U.toSubmodule ⊔ F.layer (j + 1) ∧ + D.coord ∈ U.toSubmodule ⊔ F.layer (j + 1)) : + A.coord ∈ U ∧ D.coord ∈ U := by + have hind : ∀ n : ℕ, n ≤ s → + A.coord ∈ U.toSubmodule ⊔ F.layer (n + 1) ∧ + D.coord ∈ U.toSubmodule ⊔ F.layer (n + 1) := by + intro n + induction n with + | zero => + intro _ + rw [Nat.zero_add, F.one_eq_top, sup_top_eq] + exact ⟨Submodule.mem_top, Submodule.mem_top⟩ + | succ n ih => + intro hn + obtain ⟨ha, hd⟩ := ih (by omega) + apply hseparate (n + 1) (by omega) hn + apply F.outer_sum_mem_subalgebra_sup_layer (by omega) U (by omega) + A.coord D.coord P.coord P'.coord ha hd hP hP' + exact congrArg NilpotentLieBCHGroup.coord hidentity + change A.coord ∈ U.toSubmodule ∧ D.coord ∈ U.toSubmodule + simpa only [F.terminal, sup_bot_eq] using hind s le_rfl + +theorem comparison_middle_identity (E P R E' P' R' : F.Group) + (h : E * P * R = E' * P' * R') : + P = (E⁻¹ * E') * P' * (R' * R⁻¹) := by + have heq := congrArg (fun x : F.Group => E⁻¹ * x * R⁻¹) h + simpa only [mul_assoc, inv_mul_cancel_left, mul_inv_cancel, mul_one] using heq + +theorem compatible_factors_mem_of_separation (U : LieSubalgebra ℚ L) + (E P R E' P' R' : F.Group) (hP : P.coord ∈ U) (hP' : P'.coord ∈ U) + (h : E * P * R = E' * P' * R') + (hseparate : ∀ j : ℕ, 1 ≤ j → j ≤ s → + (E⁻¹ * E').coord + (R' * R⁻¹).coord ∈ U.toSubmodule ⊔ F.layer (j + 1) → + (E⁻¹ * E').coord ∈ U.toSubmodule ⊔ F.layer (j + 1) ∧ + (R' * R⁻¹).coord ∈ U.toSubmodule ⊔ F.layer (j + 1)) : + (E⁻¹ * E').coord ∈ U ∧ (R' * R⁻¹).coord ∈ U := + F.outer_factors_mem_of_separation U (E⁻¹ * E') (R' * R⁻¹) P P' hP hP' + (F.comparison_middle_identity E P R E' P' R' h) hseparate + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem outer_sum_mem_of_identity_mod_layer (hs : 1 ≤ s) + (U : LieSubalgebra ℚ L) {j k : ℕ} (hj : 1 ≤ j) (hjk : j + 1 ≤ k) + (a d p p' : L) (ha : a ∈ U.toSubmodule ⊔ F.layer j) (hd : d ∈ U.toSubmodule ⊔ F.layer j) + (hp : p ∈ U.toSubmodule ⊔ F.layer k) (hp' : p' ∈ U.toSubmodule ⊔ F.layer k) + (heq : p - lieBCH s (lieBCH s a p') d ∈ F.layer k) : + a + d ∈ U.toSubmodule ⊔ F.layer (j + 1) := by + have hkw : U.toSubmodule ⊔ F.layer k ≤ U.toSubmodule ⊔ F.layer (j + 1) := + sup_le_sup_left (F.antitone hjk) _ + have hwj : U.toSubmodule ⊔ F.layer (j + 1) ≤ U.toSubmodule ⊔ F.layer j := + sup_le_sup_left (F.antitone (Nat.le_succ j)) _ + have hrem := F.bch_triple_remainder_mem_subalgebra_sup_layer hs U hj a p' d ha (hwj (hkw hp')) hd + have herr : p - lieBCH s (lieBCH s a p') d ∈ U.toSubmodule ⊔ F.layer (j + 1) := + Submodule.mem_sup_right (F.antitone hjk heq) + convert Submodule.sub_mem _ (Submodule.sub_mem _ (Submodule.sub_mem _ (hkw hp) (hkw hp')) herr) hrem using 1 + abel + +theorem outer_factors_mem_mod_layer_of_separation (U : LieSubalgebra ℚ L) + (k : ℕ) (hk : k ≤ s + 1) (A D P P' : F.Group) + (hP : P.coord ∈ U.toSubmodule ⊔ F.layer k) (hP' : P'.coord ∈ U.toSubmodule ⊔ F.layer k) + (hidentity : NilpotentLieBCHGroup.quotientHom (F.layerIdeal k) P = + NilpotentLieBCHGroup.quotientHom (F.layerIdeal k) (A * P' * D)) + (hseparate : ∀ j : ℕ, 1 ≤ j → j < k → + A.coord + D.coord ∈ U.toSubmodule ⊔ F.layer (j + 1) → + A.coord ∈ U.toSubmodule ⊔ F.layer (j + 1) ∧ D.coord ∈ U.toSubmodule ⊔ F.layer (j + 1)) : + A.coord ∈ U.toSubmodule ⊔ F.layer k ∧ D.coord ∈ U.toSubmodule ⊔ F.layer k := by + cases k with + | zero => + have hall (x : L) : x ∈ F.layer 0 := F.antitone (Nat.zero_le 1) (by rw [F.one_eq_top]; trivial) + exact ⟨Submodule.mem_sup_right (hall _), Submodule.mem_sup_right (hall _)⟩ + | succ k => + have herr : P.coord - lieBCH s (lieBCH s A.coord P'.coord) D.coord ∈ F.layer (k + 1) := by + apply (lieQuotientMap_eq_zero (F.layerIdeal (k + 1)) _).mp + rw [map_sub] + exact sub_eq_zero.mpr (congrArg NilpotentLieBCHGroup.coord hidentity) + have hind : ∀ n : ℕ, n ≤ k → + A.coord ∈ U.toSubmodule ⊔ F.layer (n + 1) ∧ D.coord ∈ U.toSubmodule ⊔ F.layer (n + 1) := by + intro n + induction n with + | zero => + intro _ + rw [Nat.zero_add, F.one_eq_top, sup_top_eq] + exact ⟨Submodule.mem_top, Submodule.mem_top⟩ + | succ n ih => + intro hn + obtain ⟨ha, hd⟩ := ih (by omega) + apply hseparate (n + 1) (by omega) (by omega) + exact F.outer_sum_mem_of_identity_mod_layer (by omega) U (by omega) (by omega) + A.coord D.coord P.coord P'.coord ha hd hP hP' herr + exact hind k le_rfl + +theorem compatible_factors_mem_mod_layer_of_separation (U : LieSubalgebra ℚ L) + (k : ℕ) (hk : k ≤ s + 1) (E P R E' P' R' : F.Group) + (hP : P.coord ∈ U.toSubmodule ⊔ F.layer k) (hP' : P'.coord ∈ U.toSubmodule ⊔ F.layer k) + (hidentity : NilpotentLieBCHGroup.quotientHom (F.layerIdeal k) (E * P * R) = + NilpotentLieBCHGroup.quotientHom (F.layerIdeal k) (E' * P' * R')) + (hseparate : ∀ j : ℕ, 1 ≤ j → j < k → + (E⁻¹ * E').coord + (R' * R⁻¹).coord ∈ U.toSubmodule ⊔ F.layer (j + 1) → + (E⁻¹ * E').coord ∈ U.toSubmodule ⊔ F.layer (j + 1) ∧ + (R' * R⁻¹).coord ∈ U.toSubmodule ⊔ F.layer (j + 1)) : + (E⁻¹ * E').coord ∈ U.toSubmodule ⊔ F.layer k ∧ (R' * R⁻¹).coord ∈ U.toSubmodule ⊔ F.layer k := by + let q := NilpotentLieBCHGroup.quotientHom (hnil := F.lowerCentralSeries_eq_bot) (F.layerIdeal k) + change q (E * P * R) = q (E' * P' * R') at hidentity + have hmiddle : q P = q ((E⁻¹ * E') * P' * (R' * R⁻¹)) := by + have h := congrArg (fun x => (q E)⁻¹ * x * (q R)⁻¹) hidentity + simpa only [map_mul, map_inv, mul_assoc, inv_mul_cancel_left, mul_inv_cancel, mul_one] using h + exact F.outer_factors_mem_mod_layer_of_separation U k hk (E⁻¹ * E') (R' * R⁻¹) P P' hP hP' hmiddle hseparate + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι κ L : Type*} [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + +theorem controlled_outer_factors_mem (F : NilpotentLieFiltration L s) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ L) (v : κ → L) + (hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hv : ∀ z i, RationalHeightLE (e.repr (v z) i) H) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) (hHp : (H : ℝ) ≤ Real.exp p) + (hlp : (l : ℝ) ≤ Real.exp p) + (A D P P' : F.realification.Group) + (hP : P.coord ∈ realificationLieSubalgebra U) + (hP' : P'.coord ∈ realificationLieSubalgebra U) + (hidentity : P = A * P' * D) + (ha : ‖(e.baseChange ℝ).equivFun A.coord‖ ≤ Real.exp (2 * p) / Real.exp (separationBudget (2 * p))) + (hd : (e.baseChange ℝ).equivFun D.coord ∈ realDenominatorGrid l) : + A.coord ∈ realificationLieSubalgebra U ∧ D.coord ∈ realificationLieSubalgebra U := by + let W := realLieSubalgebraOverRat (realificationLieSubalgebra U) + change A.coord ∈ W ∧ D.coord ∈ W + apply F.realification.outer_factors_mem_of_separation W A D P P' hP hP' hidentity + intro j _ _ hsum + let M : Matrix ι (κ ⊕ ι) ℚ := fun i z => e.repr (subalgebraLayerFamily e v ω (j + 1) z) i + have hM : ∀ i z, RationalHeightLE (M i z) H := + fun i z => subalgebraLayerFamily_height e v ω (j + 1) hH hv z i + have hcols : (Fintype.card (κ ⊕ ι) : ℝ) ≤ 2 * p := by + simp only [Fintype.card_sum, Nat.cast_add] + linarith + have hsum' : (e.baseChange ℝ).equivFun A.coord + (e.baseChange ℝ).equivFun D.coord ∈ + Submodule.span ℝ (Set.range (fun z i => (M i z : ℝ))) := by + rw [← map_add] + exact (F.real_subalgebra_layer_mem_iff_coordinates e ω hlayers U v hspan (j + 1) _).mp hsum + obtain ⟨ha', hd'⟩ := controlled_small_vector_separation M hH hl hM (by linarith) + (hι.trans (by linarith)) hcols + (hHp.trans (Real.exp_le_exp.mpr (by linarith))) + (hlp.trans (Real.exp_le_exp.mpr (by linarith))) _ _ ha hd hsum' + exact ⟨(F.real_subalgebra_layer_mem_iff_coordinates e ω hlayers U v hspan (j + 1) _).mpr ha', + (F.real_subalgebra_layer_mem_iff_coordinates e ω hlayers U v hspan (j + 1) _).mpr hd'⟩ + +theorem controlled_compatible_factors_mem (F : NilpotentLieFiltration L s) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ L) (v : κ → L) + (hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hv : ∀ z i, RationalHeightLE (e.repr (v z) i) H) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) (hHp : (H : ℝ) ≤ Real.exp p) + (hlp : (l : ℝ) ≤ Real.exp p) + (E P R E' P' R' : F.realification.Group) + (hP : P.coord ∈ realificationLieSubalgebra U) + (hP' : P'.coord ∈ realificationLieSubalgebra U) + (hidentity : E * P * R = E' * P' * R') + (ha : ‖(e.baseChange ℝ).equivFun (E⁻¹ * E').coord‖ ≤ + Real.exp (2 * p) / Real.exp (separationBudget (2 * p))) + (hd : (e.baseChange ℝ).equivFun (R' * R⁻¹).coord ∈ realDenominatorGrid l) : + (E⁻¹ * E').coord ∈ realificationLieSubalgebra U ∧ + (R' * R⁻¹).coord ∈ realificationLieSubalgebra U := + F.controlled_outer_factors_mem e ω hlayers U v hspan hH hl hv hp hι hκ hHp hlp + (E⁻¹ * E') (R' * R⁻¹) P P' hP hP' + (F.realification.comparison_middle_identity E P R E' P' R' hidentity) ha hd + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct + +variable {ι κ L : Type*} [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + +theorem controlled_separation_at_layer (F : NilpotentLieFiltration L s) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ L) (v : κ → L) + (hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hv : ∀ z i, RationalHeightLE (e.repr (v z) i) H) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) (hHp : (H : ℝ) ≤ Real.exp p) + (hlp : (l : ℝ) ≤ Real.exp p) (j : ℕ) (x y : ℝ ⊗[ℚ] L) + (hx : ‖(e.baseChange ℝ).equivFun x‖ ≤ Real.exp (2 * p) / Real.exp (separationBudget (2 * p))) + (hy : (e.baseChange ℝ).equivFun y ∈ realDenominatorGrid l) + (hsum : x + y ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ F.realification.layer j) : + x ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ F.realification.layer j ∧ + y ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ F.realification.layer j := by + let M : Matrix ι (κ ⊕ ι) ℚ := fun i z => e.repr (subalgebraLayerFamily e v ω j z) i + have hM : ∀ i z, RationalHeightLE (M i z) H := + fun i z => subalgebraLayerFamily_height e v ω j hH hv z i + have hcols : (Fintype.card (κ ⊕ ι) : ℝ) ≤ 2 * p := by + simp only [Fintype.card_sum, Nat.cast_add] + linarith + have hsum' : (e.baseChange ℝ).equivFun x + (e.baseChange ℝ).equivFun y ∈ + Submodule.span ℝ (Set.range (fun z i => (M i z : ℝ))) := by + rw [← map_add] + exact (F.real_subalgebra_layer_mem_iff_coordinates e ω hlayers U v hspan j _).mp hsum + obtain ⟨hx', hy'⟩ := controlled_small_vector_separation M hH hl hM (by linarith) + (hι.trans (by linarith)) hcols (hHp.trans (Real.exp_le_exp.mpr (by linarith))) + (hlp.trans (Real.exp_le_exp.mpr (by linarith))) _ _ hx hy hsum' + exact ⟨(F.real_subalgebra_layer_mem_iff_coordinates e ω hlayers U v hspan j _).mpr hx', + (F.real_subalgebra_layer_mem_iff_coordinates e ω hlayers U v hspan j _).mpr hy'⟩ + +theorem controlled_compatible_factors_mod_layer (F : NilpotentLieFiltration L s) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ L) (v : κ → L) + (hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hv : ∀ z i, RationalHeightLE (e.repr (v z) i) H) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) (hHp : (H : ℝ) ≤ Real.exp p) + (hlp : (l : ℝ) ≤ Real.exp p) (k : ℕ) (hk : k ≤ s + 1) + (E P R E' P' R' : F.realification.Group) + (hP : P.coord ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ F.realification.layer k) + (hP' : P'.coord ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ F.realification.layer k) + (hidentity : NilpotentLieBCHGroup.quotientHom (F.realification.layerIdeal k) (E * P * R) = + NilpotentLieBCHGroup.quotientHom (F.realification.layerIdeal k) (E' * P' * R')) + (ha : ‖(e.baseChange ℝ).equivFun (E⁻¹ * E').coord‖ ≤ + Real.exp (2 * p) / Real.exp (separationBudget (2 * p))) + (hd : (e.baseChange ℝ).equivFun (R' * R⁻¹).coord ∈ realDenominatorGrid l) : + (E⁻¹ * E').coord ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ F.realification.layer k ∧ + (R' * R⁻¹).coord ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ F.realification.layer k := by + apply F.realification.compatible_factors_mem_mod_layer_of_separation + (realLieSubalgebraOverRat (realificationLieSubalgebra U)) k hk E P R E' P' R' hP hP' hidentity + intro j _ _ hsum + exact F.controlled_separation_at_layer e ω hlayers U v hspan hH hl hv hp hι hκ hHp hlp (j + 1) + (E⁻¹ * E').coord (R' * R⁻¹).coord ha hd hsum + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem exists_controlled_symbol_comparison (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (U : LieSubalgebra ℚ (F.PolynomialSymbol w)) (v : κ → F.PolynomialSymbol w), + Submodule.span ℚ (Set.range v) = U.toSubmodule → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (Fintype.card κ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + (∀ i z, RationalHeightLE ((F.polynomialSymbolBasis b ω hlayers w).repr (v i) z) H) → + ∀ T : σ → ℝ, (∀ i, Real.exp ((p + C) ^ C) ≤ T i) → + ∀ E P R E' P' R' : F.RealPolynomialSymbolGroup w, + P.coord ∈ realificationLieSubalgebra U → P'.coord ∈ realificationLieSubalgebra U → + E * P * R = E' * P' * R' → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) E → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) E' → + F.SymbolRationalGrid b ω hlayers w l R → F.SymbolRationalGrid b ω hlayers w l R' → + (E⁻¹ * E').coord ∈ realificationLieSubalgebra U ∧ + (R' * R⁻¹).coord ∈ realificationLieSubalgebra U := by + obtain ⟨cs, _, hslow⟩ := exists_symbol_slow_product_bound s a 2 + obtain ⟨cr, _, hrat⟩ := exists_symbol_rational_product_bound s 2 + let Q : Polynomial ℕ := (Polynomial.X + Polynomial.C (s + 2)) ^ (s + 2) + + (Polynomial.X + Polynomial.C cs) ^ cs + (Polynomial.X + Polynomial.C cr) ^ cr + Polynomial.X + 2 + let B : Polynomial ℕ := (2 * Q + 2) ^ 48 + (2 * Q + 2) ^ 24 + 2 * Q + 1 + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget B + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F b ω hlayers w hw U v hspan H l p hH hl hp hι hσ hκ hHp hlp hb hv + T hT E P R E' P' R' hP hP' heq hE hE' hR hR' + let : Fintype (SymbolBasisIndex w ω) := + symbolBasisIndexFintype w ω s hw (F.adaptedBasis_weight_le_step b ω hlayers) + let q : ℝ := (p + (s + 2)) ^ (s + 2) + (p + cs) ^ cs + (p + cr) ^ cr + p + 2 + have hd0 : 0 ≤ (p + (s + 2)) ^ (s + 2) := by positivity + have hs0 : 0 ≤ (p + cs) ^ cs := by positivity + have hr0 : 0 ≤ (p + cr) ^ cr := by positivity + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by dsimp [q]; linarith + have hsq : (p + cs) ^ cs ≤ q := by dsimp [q]; linarith + have hrq : (p + cr) ^ cr ≤ q := by dsimp [q]; linarith + have hdim : (Fintype.card (SymbolBasisIndex w ω) : ℝ) ≤ q := + ((Nat.cast_le.mpr (symbolBasisIndex_card_le w ω s hw + (F.adaptedBasis_weight_le_step b ω hlayers))).trans + (symbol_dimension_bound_le_power s (Fintype.card ι) (Fintype.card σ) hp hι hσ)).trans + (by dsimp [q]; linarith) + have hcutoff : separationBudget (2 * q) ≤ (p + C) ^ C := by + simpa [B, Q, q, separationBudget, Polynomial.eval₂_pow] using hbound p hp + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hAslow : F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + cs) ^ cs)) (E⁻¹ * E') := by + have hinputs : ∀ g ∈ [E⁻¹, E'], F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) g := by + intro g hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl + · exact (F.symbolSlowBound_inv_iff b ω hlayers w T _ E).mpr hE + · exact hE' + simpa only [List.prod_cons, List.prod_nil, mul_one] using + hslow F b ω hlayers w hw H p hH hp hι hσ hHp hb T hTpos [E⁻¹, E'] (by simp) hinputs + obtain ⟨m, hm, hmp, _, hproducts⟩ := hrat F b ω hlayers w hw H p hH hp hι hσ hHp hb l hl hlp + have hDgrid : F.SymbolRationalGrid b ω hlayers w m (R' * R⁻¹) := by + have hinputs : ∀ g ∈ [R', R⁻¹], F.SymbolRationalGrid b ω hlayers w l g := by + intro g hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl + · exact hR' + · exact F.symbolRationalGrid_inv b ω hlayers w l hR + simpa only [List.prod_cons, List.prod_nil, mul_one] using hproducts [R', R⁻¹] (by simp) hinputs + have hAnorm : ‖((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).equivFun (E⁻¹ * E').coord‖ ≤ + Real.exp (2 * q) / Real.exp (separationBudget (2 * q)) := by + have hnorm := F.symbolSlowBound_log_norm b ω hlayers w T + (Real.one_le_exp (separationBudget_nonneg (by positivity : 0 ≤ 2 * q))) + (fun i => (Real.exp_le_exp.mpr hcutoff).trans (hT i)) (Real.exp_nonneg _) (E⁻¹ * E') hAslow + exact hnorm.trans (div_le_div_of_nonneg_right + (Real.exp_le_exp.mpr (hsq.trans (by linarith))) (Real.exp_nonneg _)) + exact (F.polynomialSymbolFiltration w).controlled_compatible_factors_mem + (F.polynomialSymbolBasis b ω hlayers w) (fun z => ω z.val.2) + (F.polynomialSymbolFiltration_layer b ω hlayers w) U v hspan hH hm hv hq hdim (hκ.trans hpq) + (hHp.trans (Real.exp_le_exp.mpr hpq)) (hmp.trans (Real.exp_le_exp.mpr hrq)) + E P R E' P' R' hP hP' heq hAnorm hDgrid + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem realSymbolGradeQuotient_mem_iff {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (w : σ → ℕ) + (U : LieSubalgebra ℚ (F.PolynomialSymbol w)) (k : ℕ) (g : F.RealPolynomialSymbolGroup w) : + F.realSymbolGradeQuotientHom w k g ∈ + (NilpotentLieBCHGroup.realificationSubgroup + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) U).map (F.realSymbolGradeQuotientHom w k) ↔ + g.coord ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ + (F.polynomialSymbolFiltration w).realification.layer k := + NilpotentLieBCHGroup.quotient_mem_map_subgroup_iff + ((F.polynomialSymbolFiltration w).realification.layerIdeal k) + (realLieSubalgebraOverRat (realificationLieSubalgebra U)) g + +theorem exists_controlled_symbol_comparison_mod_layer (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (U : LieSubalgebra ℚ (F.PolynomialSymbol w)) (v : κ → F.PolynomialSymbol w), + Submodule.span ℚ (Set.range v) = U.toSubmodule → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (Fintype.card κ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + (∀ i z, RationalHeightLE ((F.polynomialSymbolBasis b ω hlayers w).repr (v i) z) H) → + ∀ T : σ → ℝ, (∀ i, Real.exp ((p + C) ^ C) ≤ T i) → + ∀ k : ℕ, k ≤ s + 1 → ∀ E P R E' P' R' : F.RealPolynomialSymbolGroup w, + F.realSymbolGradeQuotientHom w k P ∈ + (NilpotentLieBCHGroup.realificationSubgroup (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) U).map + (F.realSymbolGradeQuotientHom w k) → + F.realSymbolGradeQuotientHom w k P' ∈ + (NilpotentLieBCHGroup.realificationSubgroup (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) U).map + (F.realSymbolGradeQuotientHom w k) → + F.realSymbolGradeQuotientHom w k (E * P * R) = F.realSymbolGradeQuotientHom w k (E' * P' * R') → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) E → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) E' → + F.SymbolRationalGrid b ω hlayers w l R → F.SymbolRationalGrid b ω hlayers w l R' → + F.realSymbolGradeQuotientHom w k (E⁻¹ * E') ∈ + (NilpotentLieBCHGroup.realificationSubgroup (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) U).map + (F.realSymbolGradeQuotientHom w k) ∧ + F.realSymbolGradeQuotientHom w k (R' * R⁻¹) ∈ + (NilpotentLieBCHGroup.realificationSubgroup (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) U).map + (F.realSymbolGradeQuotientHom w k) := by + obtain ⟨cs, _, hslow⟩ := exists_symbol_slow_product_bound s a 2 + obtain ⟨cr, _, hrat⟩ := exists_symbol_rational_product_bound s 2 + let Q : Polynomial ℕ := (Polynomial.X + Polynomial.C (s + 2)) ^ (s + 2) + + (Polynomial.X + Polynomial.C cs) ^ cs + (Polynomial.X + Polynomial.C cr) ^ cr + Polynomial.X + 2 + let B : Polynomial ℕ := (2 * Q + 2) ^ 48 + (2 * Q + 2) ^ 24 + 2 * Q + 1 + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget B + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F b ω hlayers w hw U v hspan H l p hH hl hp hι hσ hκ hHp hlp hb hv + T hT k hk E P R E' P' R' hP hP' heq hE hE' hR hR' + let : Fintype (SymbolBasisIndex w ω) := + symbolBasisIndexFintype w ω s hw (F.adaptedBasis_weight_le_step b ω hlayers) + let q : ℝ := (p + (s + 2)) ^ (s + 2) + (p + cs) ^ cs + (p + cr) ^ cr + p + 2 + have hd0 : 0 ≤ (p + (s + 2)) ^ (s + 2) := by positivity + have hs0 : 0 ≤ (p + cs) ^ cs := by positivity + have hr0 : 0 ≤ (p + cr) ^ cr := by positivity + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by dsimp [q]; linarith + have hsq : (p + cs) ^ cs ≤ q := by dsimp [q]; linarith + have hrq : (p + cr) ^ cr ≤ q := by dsimp [q]; linarith + have hdim : (Fintype.card (SymbolBasisIndex w ω) : ℝ) ≤ q := + ((Nat.cast_le.mpr (symbolBasisIndex_card_le w ω s hw + (F.adaptedBasis_weight_le_step b ω hlayers))).trans + (symbol_dimension_bound_le_power s (Fintype.card ι) (Fintype.card σ) hp hι hσ)).trans + (by dsimp [q]; linarith) + have hcutoff : separationBudget (2 * q) ≤ (p + C) ^ C := by + simpa [B, Q, q, separationBudget, Polynomial.eval₂_pow] using hbound p hp + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hAslow : F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + cs) ^ cs)) (E⁻¹ * E') := by + have hinputs : ∀ g ∈ [E⁻¹, E'], F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) g := by + intro g hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl + · exact (F.symbolSlowBound_inv_iff b ω hlayers w T _ E).mpr hE + · exact hE' + simpa only [List.prod_cons, List.prod_nil, mul_one] using + hslow F b ω hlayers w hw H p hH hp hι hσ hHp hb T hTpos [E⁻¹, E'] (by simp) hinputs + obtain ⟨m, hm, hmp, _, hproducts⟩ := hrat F b ω hlayers w hw H p hH hp hι hσ hHp hb l hl hlp + have hDgrid : F.SymbolRationalGrid b ω hlayers w m (R' * R⁻¹) := by + have hinputs : ∀ g ∈ [R', R⁻¹], F.SymbolRationalGrid b ω hlayers w l g := by + intro g hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl + · exact hR' + · exact F.symbolRationalGrid_inv b ω hlayers w l hR + simpa only [List.prod_cons, List.prod_nil, mul_one] using hproducts [R', R⁻¹] (by simp) hinputs + have hAnorm : ‖((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).equivFun (E⁻¹ * E').coord‖ ≤ + Real.exp (2 * q) / Real.exp (separationBudget (2 * q)) := by + have hnorm := F.symbolSlowBound_log_norm b ω hlayers w T + (Real.one_le_exp (separationBudget_nonneg (by positivity : 0 ≤ 2 * q))) + (fun i => (Real.exp_le_exp.mpr hcutoff).trans (hT i)) (Real.exp_nonneg _) (E⁻¹ * E') hAslow + exact hnorm.trans (div_le_div_of_nonneg_right + (Real.exp_le_exp.mpr (hsq.trans (by linarith))) (Real.exp_nonneg _)) + have hresult := (F.polynomialSymbolFiltration w).controlled_compatible_factors_mod_layer + (F.polynomialSymbolBasis b ω hlayers w) (fun z => ω z.val.2) + (F.polynomialSymbolFiltration_layer b ω hlayers w) U v hspan hH hm hv hq hdim (hκ.trans hpq) + (hHp.trans (Real.exp_le_exp.mpr hpq)) (hmp.trans (Real.exp_le_exp.mpr hrq)) k hk + E P R E' P' R' ((F.realSymbolGradeQuotient_mem_iff w U k P).mp hP) + ((F.realSymbolGradeQuotient_mem_iff w U k P').mp hP') heq hAnorm hDgrid + exact ⟨(F.realSymbolGradeQuotient_mem_iff w U k _).mpr hresult.1, + (F.realSymbolGradeQuotient_mem_iff w U k _).mpr hresult.2⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem exists_bounded_symbol_comparison (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (U : LieSubalgebra ℚ (F.PolynomialSymbol w)) (v : κ → F.PolynomialSymbol w), + Submodule.span ℚ (Set.range v) = U.toSubmodule → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (Fintype.card κ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) → + (∀ i z, RationalHeightLE ((F.polynomialSymbolBasis b ω hF w).repr (v i) z) H) → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + ∀ T : σ → ℝ, (∀ i, Real.exp ((p + C) ^ C) ≤ T i) → + ∀ E₀ P₀ R₀ E P R : F.RealPolynomialSymbolGroup w, + P₀.coord ∈ realificationLieSubalgebra U → P.coord ∈ realificationLieSubalgebra U → + E₀ * P₀ * R₀ = E * P * R → + F.SymbolSlowBound b ω hF w T (Real.exp ((p + 2) ^ a)) E₀ → + F.SymbolSlowBound b ω hF w T (Real.exp ((p + 2) ^ a)) E → + F.SymbolRationalGrid b ω hF w l R₀ → F.SymbolRationalGrid b ω hF w l R → + (E₀⁻¹ * E).coord ∈ realificationLieSubalgebra U ∧ + (R * R₀⁻¹).coord ∈ realificationLieSubalgebra U ∧ + F.SymbolSlowBound b ω hF w T (Real.exp ((p + C) ^ C)) (E₀⁻¹ * E) ∧ + F.SymbolRationalGrid b ω hF w m (R * R₀⁻¹) := by + have hcompExists := exists_controlled_symbol_comparison s a + obtain ⟨cc, _, hcomp⟩ := hcompExists + have hslowExists := exists_symbol_slow_product_bound s a 2 + obtain ⟨cs, _, hslow⟩ := hslowExists + have hratExists := exists_symbol_rational_product_bound s 2 + obtain ⟨cr, _, hrat⟩ := hratExists + let B : Polynomial ℕ := (Polynomial.X + Polynomial.C cc) ^ cc + + (Polynomial.X + Polynomial.C cs) ^ cs + (Polynomial.X + Polynomial.C cr) ^ cr + have hboundExists := exists_natPolynomial_eval_budget B + obtain ⟨C, hC, hbound⟩ := hboundExists + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F b ω hF w hw U v hspan H l p hH hl hp hι hσ hκ hHp hlp hb hv + have hsum : (p + cc) ^ cc + (p + cs) ^ cs + (p + cr) ^ cr ≤ (p + C) ^ C := by + simpa [B, Polynomial.eval₂_pow] using hbound p hp + have hc0 : 0 ≤ (p + cc) ^ cc := by positivity + have hs0 : 0 ≤ (p + cs) ^ cs := by positivity + have hr0 : 0 ≤ (p + cr) ^ cr := by positivity + have hcb : (p + cc) ^ cc ≤ (p + C) ^ C := by linarith + have hsb : (p + cs) ^ cs ≤ (p + C) ^ C := by linarith + have hrb : (p + cr) ^ cr ≤ (p + C) ^ C := by linarith + have hproductsExists := hrat F b ω hF w hw H p hH hp hι hσ hHp hb l hl hlp + obtain ⟨m, hm, hmp, hlm, hproducts⟩ := hproductsExists + refine ⟨m, hm, hmp.trans (Real.exp_le_exp.mpr hrb), hlm, ?_⟩ + intro T hT E₀ P₀ R₀ E P R hP₀ hP heq hE₀ hE hR₀ hR + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hmem := hcomp F b ω hF w hw U v hspan H l p hH hl hp hι hσ hκ hHp hlp hb hv + T (fun i => (Real.exp_le_exp.mpr hcb).trans (hT i)) E₀ P₀ R₀ E P R + hP₀ hP heq hE₀ hE hR₀ hR + refine ⟨hmem.1, hmem.2, ?_, ?_⟩ + · have hinputs : ∀ x ∈ [E₀⁻¹, E], F.SymbolSlowBound b ω hF w T (Real.exp ((p + 2) ^ a)) x := by + intro x hx + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl + · exact (F.symbolSlowBound_inv_iff b ω hF w T _ E₀).mpr hE₀ + · exact hE + have hpair : F.SymbolSlowBound b ω hF w T (Real.exp ((p + cs) ^ cs)) (E₀⁻¹ * E) := by + simpa only [List.prod_cons, List.prod_nil, mul_one] using + hslow F b ω hF w hw H p hH hp hι hσ hHp hb T hTpos [E₀⁻¹, E] (by simp) hinputs + exact F.symbolSlowBound_mono b ω hF w T hTpos (Real.exp_le_exp.mpr hsb) _ hpair + · have hinputs : ∀ x ∈ [R, R₀⁻¹], F.SymbolRationalGrid b ω hF w l x := by + intro x hx + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl + · exact hR + · exact F.symbolRationalGrid_inv b ω hF w l hR₀ + simpa only [List.prod_cons, List.prod_nil, mul_one] using + hproducts [R, R₀⁻¹] (by simp) hinputs + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem symbol_current_grade_residual_mem + {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (U : LieSubalgebra ℚ (F.PolynomialSymbol w)) + (hU : BasisGradedSubmodule (F.polynomialSymbolBasis b ω hlayers w) + (fun z => ω z.val.2) U.toSubmodule) + (k : ℕ) (E P R E₀ R₀ : F.RealPolynomialSymbolGroup w) + (hP : P.coord ∈ realificationLieSubalgebra U) + (hE : F.realSymbolGradeQuotientHom w k E₀ = F.realSymbolGradeQuotientHom w k E) + (hR : F.realSymbolGradeQuotientHom w k R = F.realSymbolGradeQuotientHom w k R₀) : + let π := basisGradeProjection ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ) + (fun z => ω z.val.2) k + π (E₀⁻¹ * (E * P * R) * R₀⁻¹).coord - π (E₀⁻¹ * E).coord - π (R * R₀⁻¹).coord ∈ + realificationLieSubalgebra U := by + exact (F.polynomialSymbolFiltration w).realGradeProjection_normalized_residual_mem + (F.polynomialSymbolBasis b ω hlayers w) (fun z => ω z.val.2) + (F.polynomialSymbolFiltration_layer b ω hlayers w) + (realificationLieSubalgebra U).toSubmodule + (hU.baseChange (F.polynomialSymbolBasis b ω hlayers w) (fun z => ω z.val.2) U.toSubmodule) + k E P R E₀ R₀ hP hE hR + +theorem exists_controlled_symbol_grade_step (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + ∀ T : σ → ℝ, (∀ i, 0 < T i) → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + ∀ {η : Type*} (U : η → LieSubalgebra ℚ (F.PolynomialSymbol w)), + (∀ i, BasisGradedSubmodule (F.polynomialSymbolBasis b ω hlayers w) + (fun z => ω z.val.2) (U i).toSubmodule) → + ∀ (k : ℕ) (X E R A D : F.RealPolynomialSymbolGroup w), + (∀ i, F.realSymbolGradeQuotientHom w k (E⁻¹ * X * R⁻¹) ∈ + (NilpotentLieBCHGroup.realificationSubgroup + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) (U i)).map + (F.realSymbolGradeQuotientHom w k)) → + A.coord ∈ (F.polynomialSymbolFiltration w).realification.layer k → + D.coord ∈ (F.polynomialSymbolFiltration w).realification.layer k → + (let π := basisGradeProjection ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ) + (fun z => ω z.val.2) k + ∀ i, π (E⁻¹ * X * R⁻¹).coord - π A.coord - π D.coord ∈ realificationLieSubalgebra (U i)) → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) E → + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) A → + F.SymbolRationalGrid b ω hlayers w l R → F.SymbolRationalGrid b ω hlayers w l D → + (E * A) * (A⁻¹ * (E⁻¹ * X * R⁻¹) * D⁻¹) * (D * R) = X ∧ + F.realSymbolGradeQuotientHom w k (E * A) = F.realSymbolGradeQuotientHom w k E ∧ + F.realSymbolGradeQuotientHom w k (D * R) = F.realSymbolGradeQuotientHom w k R ∧ + (∀ i, F.realSymbolGradeQuotientHom w (k + 1) (A⁻¹ * (E⁻¹ * X * R⁻¹) * D⁻¹) ∈ + (NilpotentLieBCHGroup.realificationSubgroup + (hnil := F.polynomialSymbol_lowerCentralSeries_eq_bot w) (U i)).map + (F.realSymbolGradeQuotientHom w (k + 1))) ∧ + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + C) ^ C)) (E * A) ∧ + F.SymbolRationalGrid b ω hlayers w m (D * R) := by + obtain ⟨cs, hcs, hslow⟩ := exists_symbol_slow_product_bound s a 2 + obtain ⟨cr, hcr, hrat⟩ := exists_symbol_rational_product_bound s 2 + refine ⟨max cs cr, hcs.trans (le_max_left _ _), ?_⟩ + intro σ ι L _ _ _ _ F b ω hlayers w hw H l p hH hl hp hι hσ hHp hlp hb T hT + have hs : (p + cs) ^ cs ≤ (p + (max cs cr : ℕ)) ^ max cs cr := + shifted_power_self_mono hp (by omega) (le_max_left _ _) + have hr : (p + cr) ^ cr ≤ (p + (max cs cr : ℕ)) ^ max cs cr := + shifted_power_self_mono hp (by omega) (le_max_right _ _) + obtain ⟨m, hm, hmp, hlm, hproducts⟩ := hrat F b ω hlayers w hw H p hH hp hι hσ hHp hb l hl hlp + refine ⟨m, hm, hmp.trans (Real.exp_le_exp.mpr hr), hlm, ?_⟩ + intro η U hU k X E R A D hY hA hD hgrade hEslow hAslow hRgrid hDgrid + let G := F.polynomialSymbolFiltration w + let B := F.polynomialSymbolBasis b ω hlayers w + have hUr : ∀ i, BasisGradedSubmodule (B.baseChange ℝ) (fun z => ω z.val.2) + (realificationLieSubalgebra (U i)).toSubmodule := + fun i => (hU i).baseChange B (fun z => ω z.val.2) (U i).toSubmodule + have hYr : ∀ i, (E⁻¹ * X * R⁻¹).coord ∈ + (realificationLieSubalgebra (U i)).toSubmodule ⊔ (G.realLayer k).toSubmodule := + fun i => (G.real_quotient_mem_subgroup_iff (realificationLieSubalgebra (U i)) k _).mp (hY i) + obtain ⟨hprod, hEq, hRq, hnext⟩ := G.simultaneous_real_grade_correction B (fun z => ω z.val.2) + (F.polynomialSymbolFiltration_layer b ω hlayers w) (fun i => realificationLieSubalgebra (U i)) + hUr k X E R A D hYr hA hD hgrade + refine ⟨hprod, hEq, hRq, ?_, ?_, ?_⟩ + · intro i + exact (G.real_quotient_mem_subgroup_iff (realificationLieSubalgebra (U i)) (k + 1) _).mpr (hnext i) + · have hi : ∀ g ∈ [E, A], F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) g := by + intro g hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl + · exact hEslow + · exact hAslow + have h := hslow F b ω hlayers w hw H p hH hp hι hσ hHp hb T hT [E, A] (by simp) hi + simp only [List.prod_cons, List.prod_nil, mul_one] at h + exact F.symbolSlowBound_mono b ω hlayers w T hT (Real.exp_le_exp.mpr hs) _ h + · have hi : ∀ g ∈ [D, R], F.SymbolRationalGrid b ω hlayers w l g := by + intro g hg + simp only [List.mem_cons, List.not_mem_nil, or_false] at hg + rcases hg with rfl | rfl + · exact hDgrid + · exact hRgrid + simpa only [List.prod_cons, List.prod_nil, mul_one] using hproducts [D, R] (by simp) hi + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem exists_common_symbol_grade_corrections (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ η L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (U : η → LieSubalgebra ℚ (F.PolynomialSymbol w)) (v : η → κ → F.PolynomialSymbol w), + (∀ j, Submodule.span ℚ (Set.range (v j)) = (U j).toSubmodule) → + (∀ j, BasisBlockInvariant (F.polynomialSymbolBasis b ω hlayers w) + (fun z => z.val.1) (U j).toSubmodule) → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (Fintype.card κ : ℝ) ≤ p → (Fintype.card η : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ j i z, RationalHeightLE ((F.polynomialSymbolBasis b ω hlayers w).repr (v j i) z) H) → + ∀ T : σ → ℝ, (∀ i, Real.exp ((p + C) ^ C) ≤ T i) → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + ∀ (k : ℕ) (x : F.RealPolynomialSymbol w) (E R : η → F.RealPolynomialSymbolGroup w), + let π := basisGradeProjection ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ) + (fun z => ω z.val.2) k + (∀ j, F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + 2) ^ a)) (E j)) → + (∀ j, F.SymbolRationalGrid b ω hlayers w l (R j)) → + (∀ j, π x - π (E j).coord - π (R j).coord ∈ realificationLieSubalgebra (U j)) → + ∃ A D : F.RealPolynomialSymbolGroup w, + A.coord ∈ (F.polynomialSymbolFiltration w).realification.layer k ∧ + D.coord ∈ (F.polynomialSymbolFiltration w).realification.layer k ∧ + F.SymbolSlowBound b ω hlayers w T (Real.exp ((p + C) ^ C)) A ∧ + F.SymbolRationalGrid b ω hlayers w m D ∧ + ∀ j, π x - π A.coord - π D.coord ∈ realificationLieSubalgebra (U j) := by + obtain ⟨C, hC, hbound⟩ := exists_common_correction_budget s a + refine ⟨C, hC, ?_⟩ + intro σ ι κ η L _ _ _ _ _ _ F b ω hlayers w hw U v hspan hblock H l p hH hl hp + hι hσ hκ hη hHp hlp hv T hT + let : Fintype (SymbolBasisIndex w ω) := + symbolBasisIndexFintype w ω s hw (F.adaptedBasis_weight_le_step b ω hlayers) + let N : ℝ := (p + (s + 2)) ^ (s + 2) + let q : ℝ := N * (p + 1) + (p + 2) ^ a + p + 2 + let t : ℝ := ((q + 2) ^ 10 + 2) ^ 4 + have hN : 0 ≤ N := by dsimp [N]; positivity + have ha : 0 ≤ (p + 2) ^ a := by positivity + have hq : 0 ≤ q := by dsimp [q]; positivity + have hNp : 0 ≤ N * (p + 1) := mul_nonneg hN (by positivity) + have hpq : p ≤ q := by dsimp [q]; linarith + have hNterm : N ≤ N * (p + 1) := by + simpa only [mul_one] using mul_le_mul_of_nonneg_left (show 1 ≤ p + 1 by linarith) hN + have hNq : N ≤ q := hNterm.trans (by dsimp [q]; linarith) + have hNpq : N * p ≤ q := + (mul_le_mul_of_nonneg_left (show p ≤ p + 1 by linarith) hN).trans (by dsimp [q]; linarith) + have haq : (p + 2) ^ a ≤ q := by dsimp [q]; linarith + have hdim : (Fintype.card (SymbolBasisIndex w ω) : ℝ) ≤ N := + (Nat.cast_le.mpr (symbolBasisIndex_card_le w ω s hw + (F.adaptedBasis_weight_le_step b ω hlayers))).trans + (symbol_dimension_bound_le_power s (Fintype.card ι) (Fintype.card σ) hp hι hσ) + have hcols : ((Fintype.card (SymbolBasisIndex w ω) * Fintype.card κ : ℕ) : ℝ) ≤ q := by + rw [Nat.cast_mul] + exact (mul_le_mul hdim hκ (Nat.cast_nonneg _) hN).trans hNpq + have hrows : (Fintype.card (Σ _ : η, SymbolBasisIndex w ω) : ℝ) ≤ q := by + simp only [Fintype.card_sigma, Finset.sum_const, Finset.card_univ, smul_eq_mul, Nat.cast_mul] + exact (mul_le_mul hη hdim (Nat.cast_nonneg _) hp).trans (by simpa only [mul_comm] using hNpq) + have hall : separationBudget t + (t + 2) ^ 36 + ((t + 2) ^ 18 + t) ≤ (p + C) ^ C := by + exact hbound p hp + have ht : 0 ≤ t := by dsimp [t]; positivity + have hs : 0 ≤ separationBudget t := separationBudget_nonneg ht + have hden0 : 0 ≤ (t + 2) ^ 36 := by positivity + have hslow0 : 0 ≤ (t + 2) ^ 18 + t := by positivity + have hcut : separationBudget t ≤ (p + C) ^ C := + (le_add_of_nonneg_right hden0).trans ((le_add_of_nonneg_right hslow0).trans hall) + have hden : (t + 2) ^ 36 ≤ (p + C) ^ C := + (le_add_of_nonneg_left hs).trans ((le_add_of_nonneg_right hslow0).trans hall) + have hslow : (t + 2) ^ 18 + t ≤ (p + C) ^ C := + (le_add_of_nonneg_left (add_nonneg hs hden0)).trans hall + let e := F.polynomialSymbolBasis b ω hlayers w + obtain ⟨m, hm, hmp, hlm, hsolve⟩ := exists_block_subspace_corrections e (fun z => z.val.1) + (fun j => (U j).toSubmodule) v hspan hblock hH hl hv hq (hdim.trans hNq) hcols hrows + (hHp.trans (Real.exp_le_exp.mpr hpq)) (hlp.trans (Real.exp_le_exp.mpr hpq)) + refine ⟨m, hm, hmp.trans (Real.exp_le_exp.mpr hden), hlm, ?_⟩ + intro k x E R + dsimp only + intro hE hR hres + let π := basisGradeProjection (e.baseChange ℝ) (fun z => ω z.val.2) k + have hπ (z : F.RealPolynomialSymbol w) : π (π z) = π z := + basisCoordinateProjection_idempotent (e.baseChange ℝ) {z | ω z.val.2 = k} z + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hW : ∀ α, 0 < monomialScale T α := monomialScale_pos T hTpos + have hWmin : ∀ z : SymbolBasisIndex w ω, Real.exp (separationBudget t) ≤ monomialScale T z.val.1 := + fun z => le_monomialScale_of_ne_zero T (Real.one_le_exp hs) + (fun i => (Real.exp_le_exp.mpr hcut).trans (hT i)) + (F.symbolBasisIndex_monomial_ne_zero b ω hlayers w z) + have he : ∀ j z, |(e.baseChange ℝ).equivFun (π (E j).coord) z| ≤ Real.exp q / monomialScale T z.val.1 := by + intro j z + exact ((basisCoordinateProjection_abs_repr_le (e.baseChange ℝ) {z | ω z.val.2 = k} (E j).coord z).trans + (hE j z)).trans (div_le_div_of_nonneg_right (Real.exp_le_exp.mpr haq) (hW _).le) + have hr : ∀ j, (e.baseChange ℝ).equivFun (π (R j).coord) ∈ realDenominatorGrid l := + fun j => basisCoordinateProjection_real_grid (e.baseChange ℝ) {z | ω z.val.2 = k} l (R j).coord (hR j) + obtain ⟨u, d, hu, hd, hcommon⟩ := hsolve (monomialScale T) hW hWmin + (fun j => π (E j).coord) (fun j => π (R j).coord) (π x) he hr hres + refine ⟨⟨π u⟩, ⟨π d⟩, ?_, ?_, ?_, ?_, ?_⟩ + · exact (F.polynomialSymbolFiltration w).realGradeProjection_mem_layer e (fun z => ω z.val.2) + (F.polynomialSymbolFiltration_layer b ω hlayers w) k u + · exact (F.polynomialSymbolFiltration w).realGradeProjection_mem_layer e (fun z => ω z.val.2) + (F.polynomialSymbolFiltration_layer b ω hlayers w) k d + · intro z + exact ((basisCoordinateProjection_abs_repr_le (e.baseChange ℝ) {z | ω z.val.2 = k} u z).trans + (hu z)).trans (div_le_div_of_nonneg_right (Real.exp_le_exp.mpr hslow) (hW _).le) + · exact basisCoordinateProjection_real_grid (e.baseChange ℝ) {z | ω z.val.2 = k} m d hd + · intro j + have hgraded : BasisGradedSubmodule e (fun z => ω z.val.2) (U j).toSubmodule := by + have heq : (fun z : SymbolBasisIndex w ω => ω z.val.2) = (fun z => Finsupp.weight w z.val.1) := + funext (fun z => z.property.symm) + rw [heq] + exact (hblock j).graded e (fun z => z.val.1) (U j).toSubmodule (Finsupp.weight w) + have h := hgraded.baseChange e (fun z => ω z.val.2) (U j).toSubmodule k + (π x - u - d) (hcommon j) + change π (π x - u - d) ∈ (U j).toSubmodule.baseChange ℝ at h + change π x - π (π u) - π (π d) ∈ (U j).toSubmodule.baseChange ℝ + simpa only [map_sub, hπ] using h + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymbolFastMembership.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymbolFastMembership.lean new file mode 100644 index 0000000000000000000000000000000000000000..6578705efa2b0323016980cf117ac79449ae9fe8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymbolFastMembership.lean @@ -0,0 +1,443 @@ +import OAI.Combinatorics.Progressions.Fourier.HomogeneousGradedProjectionFrequency +import OAI.Combinatorics.Progressions.Sampling.RationalPowerGrid + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +@[simp] theorem adaptedWeightedDilation_coe (w : σ → ℕ) (r : ℚ) + (p : F.adaptedLieSubalgebra w) : + (F.adaptedWeightedDilation w r p : VectorPolynomial σ ℚ L) = + weightedDilation w r (p : VectorPolynomial σ ℚ L) := rfl + +theorem polynomialSymbolDilation_repr (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (r : ℚ) (x : F.PolynomialSymbol w) (z : SymbolBasisIndex w ω) : + (F.polynomialSymbolBasis b ω hF w).repr (F.polynomialSymbolDilation w r x) z = + r ^ Finsupp.weight w z.val.1 * (F.polynomialSymbolBasis b ω hF w).repr x z := by + obtain ⟨p, rfl⟩ := F.polynomialSymbolMap_surjective w x + rw [F.polynomialSymbolDilation_map, F.polynomialSymbolBasis_repr_map, + F.polynomialSymbolBasis_repr_map] + change b.repr (coefficients (weightedDilation w r (p : VectorPolynomial σ ℚ L)) z.val.1) z.val.2 = _ + rw [coefficients_weightedDilation, map_smul, Finsupp.smul_apply, smul_eq_mul] + +noncomputable def realPolynomialSymbolDilation (w : σ → ℕ) (r : ℚ) : + F.RealPolynomialSymbol w →ₗ⁅ℚ⁆ F.RealPolynomialSymbol w := + LieAlgebra.ExtendScalars.map (AlgHom.id ℚ ℝ) (F.polynomialSymbolDilation w r) + +@[simp] theorem realPolynomialSymbolDilation_tmul (w : σ → ℕ) (r : ℚ) + (a : ℝ) (x : F.PolynomialSymbol w) : + F.realPolynomialSymbolDilation w r (a ⊗ₜ[ℚ] x) = + a ⊗ₜ[ℚ] F.polynomialSymbolDilation w r x := by + simp only [realPolynomialSymbolDilation, LieAlgebra.ExtendScalars.map_apply_tmul, AlgHom.id_apply] + +theorem realPolynomialSymbolDilation_repr (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (r : ℚ) (x : F.RealPolynomialSymbol w) (z : SymbolBasisIndex w ω) : + ((F.polynomialSymbolBasis b ω hF w).baseChange ℝ).repr (F.realPolynomialSymbolDilation w r x) z = + (r : ℝ) ^ Finsupp.weight w z.val.1 * ((F.polynomialSymbolBasis b ω hF w).baseChange ℝ).repr x z := by + induction x using TensorProduct.inductionOn with + | tmul a x => + rw [F.realPolynomialSymbolDilation_tmul, Basis.baseChange_repr_tmul, + Basis.baseChange_repr_tmul, F.polynomialSymbolDilation_repr] + simp only [Rat.smul_def, Rat.cast_mul, Rat.cast_pow] + ring + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy, mul_add] + +@[simp] theorem realPolynomialSymbolDilation_one (w : σ → ℕ) (x : F.RealPolynomialSymbol w) : + F.realPolynomialSymbolDilation w 1 x = x := by + induction x using TensorProduct.inductionOn with + | tmul a x => simp only [F.realPolynomialSymbolDilation_tmul, F.polynomialSymbolDilation_one] + | add x y hx hy => simp only [map_add, hx, hy] + +theorem realPolynomialSymbolDilation_mul (w : σ → ℕ) (a b : ℚ) (x : F.RealPolynomialSymbol w) : + F.realPolynomialSymbolDilation w (a * b) x = + F.realPolynomialSymbolDilation w a (F.realPolynomialSymbolDilation w b x) := by + induction x using TensorProduct.inductionOn with + | tmul c x => simp only [F.realPolynomialSymbolDilation_tmul, F.polynomialSymbolDilation_mul] + | add x y hx hy => simp only [map_add, hx, hy] + +noncomputable def realPolynomialSymbolDilationHom (w : σ → ℕ) (r : ℚ) : + F.RealPolynomialSymbolGroup w →* F.RealPolynomialSymbolGroup w := + NilpotentLieBCHGroup.map (F.realPolynomialSymbolDilation w r) + +@[simp] theorem realPolynomialSymbolDilationHom_coord (w : σ → ℕ) (r : ℚ) + (g : F.RealPolynomialSymbolGroup w) : + (F.realPolynomialSymbolDilationHom w r g).coord = F.realPolynomialSymbolDilation w r g.coord := rfl + +theorem realSymbolOfPolynomial_dilation (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (r : ℚ) (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) : + F.realSymbolOfPolynomial b ω hF w (weightedDilation w r p) = + F.realPolynomialSymbolDilation w r (F.realSymbolOfPolynomial b ω hF w p) := by + apply ((F.polynomialSymbolBasis b ω hF w).baseChange ℝ).repr.injective + ext z + rw [F.realPolynomialSymbolDilation_repr, F.realSymbolOfPolynomial_coordinate, + F.realSymbolOfPolynomial_coordinate] + simp only [coefficients_weightedDilation, map_rat_smul, Finsupp.smul_apply, + Rat.smul_def, Rat.cast_pow] + +theorem realPolynomialSymbolHom_dilation (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (r : ℚ) (g : (F.realification.adaptedPolynomialFiltration w).Group) : + F.realPolynomialSymbolHom b ω hF w + (NilpotentLieBCHGroup.map (F.realification.adaptedWeightedDilation w r) g) = + F.realPolynomialSymbolDilationHom w r (F.realPolynomialSymbolHom b ω hF w g) := by + have hmap : (NilpotentLieBCHGroup.map (F.realification.adaptedWeightedDilation w r) g : + (F.realification.adaptedPolynomialFiltration w).Group).coord = + F.realification.adaptedWeightedDilation w r g.coord := rfl + apply NilpotentLieBCHGroup.ext + rw [F.realPolynomialSymbolHom_coord, F.realPolynomialSymbolDilationHom_coord, + F.realPolynomialSymbolHom_coord, hmap] + simp only [F.realPolynomialSymbolMap_apply, F.realification.adaptedWeightedDilation_coe] + apply realSymbolOfPolynomial_dilation + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +def ControlledSymbolFactorization (η : L →ₗ[ℚ] ℚ) (T : σ → ℝ) + (X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)) (p : ℝ) : Prop := + ∃ (m : ℕ) (E P R : F.RealPolynomialSymbolGroup (fun _ : σ => 1)) + (W : LieSubalgebra ℚ F.AssociatedGraded) (v : ι → F.AssociatedGraded), + 0 < m ∧ (m : ℝ) ≤ Real.exp p ∧ E * P * R = X ∧ + F.SymbolSlowBound b ω hF (fun _ => 1) T (Real.exp p) E ∧ + F.SymbolRationalGrid b ω hF (fun _ => 1) m R ∧ + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule ∧ + (∀ i j, rationalLogHeight ((F.associatedGradedBasis b ω hF).repr (v i) j) ≤ p) ∧ + (∀ x ∈ W, basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x → + F.gradedFrequency b ω hF η x = 0) ∧ + P.coord ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF (fun _ => 1) W) + +theorem ControlledSymbolFactorization.mono {η : L →ₗ[ℚ] ℚ} {T : σ → ℝ} + {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} {p q : ℝ} + (h : F.ControlledSymbolFactorization b ω hF η T X p) (hpq : p ≤ q) + (hT : ∀ i, 0 < T i) : F.ControlledSymbolFactorization b ω hF η T X q := by + obtain ⟨m, E, P, R, W, v, hm, hmp, hprod, hE, hR, hv, hW, hh, hη, hP⟩ := h + exact ⟨m, E, P, R, W, v, hm, hmp.trans (Real.exp_le_exp.mpr hpq), hprod, + F.symbolSlowBound_mono b ω hF (fun _ => 1) T hT (Real.exp_le_exp.mpr hpq) E hE, + hR, hv, hW, (fun i j => (hh i j).trans hpq), hη, hP⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +def ControlledSymbolCompositionSpec (s C : ℕ) : Prop := + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p) + (_hc : ∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) + (T : σ → ℝ) (_hT : ∀ i, 0 < T i) (η : L →ₗ[ℚ] ℚ) + (l : ℕ) (_hl : 0 < l) (_hlp : (l : ℝ) ≤ Real.exp p) + (A X R : F.RealPolynomialSymbolGroup (fun _ : σ => 1)) + (_hA : F.SymbolSlowBound b ω hF (fun _ => 1) T (Real.exp p) A) + (_hR : F.SymbolRationalGrid b ω hF (fun _ => 1) l R) + (_hX : F.ControlledSymbolFactorization b ω hF η T X p), + F.ControlledSymbolFactorization b ω hF η T (A * X * R) ((p + C) ^ C) + +theorem exists_controlled_symbol_composition (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ControlledSymbolCompositionSpec s C := by + obtain ⟨a, _, hslow⟩ := exists_symbol_slow_product_bound s 1 2 + obtain ⟨b, _, hgrid⟩ := exists_symbol_rational_product_bound s 2 + let P : Polynomial ℕ := Polynomial.X + (2 * Polynomial.X + Polynomial.C a) ^ a + + (2 * Polynomial.X + Polynomial.C b) ^ b + obtain ⟨C, hC, hfinal⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F e ω hF H p hH hp hι hσ hHp hc T hT η l hl hlp A X R hA hR hX + have hpa : 0 ≤ (2 * p + a) ^ a := by positivity + have hpb : 0 ≤ (2 * p + b) ^ b := by positivity + have hbound : p + (2 * p + a) ^ a + (2 * p + b) ^ b ≤ (p + C) ^ C := by + simpa [P, Polynomial.eval₂_pow] using hfinal p hp + have hpC : p ≤ (p + C) ^ C := by linarith + have haC : (2 * p + a) ^ a ≤ (p + C) ^ C := by linarith + have hbC : (2 * p + b) ^ b ≤ (p + C) ^ C := by linarith + have h2p : 0 ≤ 2 * p := by positivity + have hp2 : p ≤ 2 * p := by linarith + have he2 := Real.exp_le_exp.mpr hp2 + have he : Real.exp p ≤ Real.exp ((2 * p + 2) ^ 1) := Real.exp_le_exp.mpr (by rw [pow_one]; linarith) + obtain ⟨m, E, Q, B, Z, v, hm, hmp, hprod, hE, hB, hv, hZ, hh, hη, hQ⟩ := hX + have hleft := hslow F e ω hF (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) + H (2 * p) hH h2p (hι.trans hp2) (hσ.trans hp2) (hHp.trans he2) hc T hT [A, E] (by simp) (by + intro x hx + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl + · exact F.symbolSlowBound_mono e ω hF (fun _ => 1) T hT he _ hA + · exact F.symbolSlowBound_mono e ω hF (fun _ => 1) T hT he _ hE) + have hleft' : F.SymbolSlowBound e ω hF (fun _ => 1) T (Real.exp ((2 * p + a) ^ a)) (A * E) := by + simpa only [List.prod_cons, List.prod_nil, mul_one] using hleft + have hdenom : ((l * m : ℕ) : ℝ) ≤ Real.exp (2 * p) := by + rw [Nat.cast_mul] + calc + _ ≤ Real.exp p * Real.exp p := mul_le_mul hlp hmp (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + obtain ⟨n, hn, hnp, _, hproducts⟩ := hgrid F e ω hF (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) + H (2 * p) hH h2p (hι.trans hp2) (hσ.trans hp2) (hHp.trans he2) hc (l * m) (Nat.mul_pos hl hm) hdenom + have hright := hproducts [B, R] (by simp) (by + intro x hx + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl + · exact F.symbolRationalGrid_mono e ω hF (fun _ => 1) hm (dvd_mul_left m l) _ hB + · exact F.symbolRationalGrid_mono e ω hF (fun _ => 1) hl (dvd_mul_right l m) _ hR) + have hright' : F.SymbolRationalGrid e ω hF (fun _ => 1) n (B * R) := by + simpa only [List.prod_cons, List.prod_nil, mul_one] using hright + refine ⟨n, A * E, Q, B * R, Z, v, hn, hnp.trans (Real.exp_le_exp.mpr hbC), ?_, + F.symbolSlowBound_mono e ω hF (fun _ => 1) T hT (Real.exp_le_exp.mpr haC) (A * E) hleft', + hright', hv, hZ, (fun i j => (hh i j).trans hpC), hη, hQ⟩ + calc + (A * E) * Q * (B * R) = A * (E * Q * B) * R := by group + _ = A * X * R := by rw [hprod] + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +open Module +open scoped BigOperators + +theorem monomialScale_const_mul {σ : Type*} (S : σ → ℝ) (c : ℝ) (α : σ →₀ ℕ) : + monomialScale (fun i => c * S i) α = + c ^ Finsupp.weight (fun _ => 1) α * monomialScale S α := by + classical + simp only [monomialScale, Finsupp.prod, mul_pow, Finset.prod_mul_distrib, + Finset.prod_pow_eq_pow_sum, Finsupp.weight_apply, Finsupp.sum, smul_eq_mul, mul_one] + +theorem monomialScale_le_exp_mul {σ : Type*} (S T : σ → ℝ) + (hS : ∀ i, 0 < S i) (hT : ∀ i, 0 < T i) {q : ℝ} (hq : 0 ≤ q) + (hST : ∀ i, T i ≤ Real.exp q * S i) (α : σ →₀ ℕ) {s : ℕ} + (hα : Finsupp.weight (fun _ => 1) α ≤ s) : + monomialScale T α ≤ Real.exp ((s : ℝ) * q) * monomialScale S α := by + classical + calc + monomialScale T α ≤ monomialScale (fun i => Real.exp q * S i) α := by + apply Finset.prod_le_prod₀ + · intro i _ + exact pow_nonneg (hT i).le _ + · intro i _ + exact pow_le_pow_left₀ (hT i).le (hST i) _ + _ = Real.exp q ^ Finsupp.weight (fun _ => 1) α * monomialScale S α := + monomialScale_const_mul S (Real.exp q) α + _ ≤ Real.exp q ^ s * monomialScale S α := + mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (Real.one_le_exp hq) hα) + (monomialScale_pos S hS α).le + _ = Real.exp ((s : ℝ) * q) * monomialScale S α := by rw [Real.exp_nat_mul] + +namespace NilpotentLieFiltration + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem symbolSlowBound_rescale (S T : σ → ℝ) (hS : ∀ i, 0 < S i) (hT : ∀ i, 0 < T i) + {p q : ℝ} (hq : 0 ≤ q) (hST : ∀ i, Real.exp (-q) * T i ≤ S i) + (E : F.RealPolynomialSymbolGroup (fun _ : σ => 1)) + (hE : F.SymbolSlowBound b ω hF (fun _ => 1) S (Real.exp p) E) : + F.SymbolSlowBound b ω hF (fun _ => 1) T (Real.exp (p + (s : ℝ) * q)) E := by + have hratio (i : σ) : T i ≤ Real.exp q * S i := by + calc + T i = Real.exp q * (Real.exp (-q) * T i) := by + rw [← mul_assoc, ← Real.exp_add, add_neg_cancel, Real.exp_zero, one_mul] + _ ≤ Real.exp q * S i := mul_le_mul_of_nonneg_left (hST i) (Real.exp_pos _).le + intro z + apply (hE z).trans + apply (div_le_div_iff₀ (monomialScale_pos S hS z.val.1) + (monomialScale_pos T hT z.val.1)).mpr + have hscale := monomialScale_le_exp_mul S T hS hT hq hratio z.val.1 + (z.property.le.trans (F.adaptedBasis_weight_le_step b ω hF z.val.2)) + calc + Real.exp p * monomialScale T z.val.1 ≤ + Real.exp p * (Real.exp ((s : ℝ) * q) * monomialScale S z.val.1) := + mul_le_mul_of_nonneg_left hscale (Real.exp_pos _).le + _ = Real.exp (p + (s : ℝ) * q) * monomialScale S z.val.1 := by + rw [Real.exp_add, mul_assoc] + +theorem ControlledSymbolFactorization.rescale {η : L →ₗ[ℚ] ℚ} {S T : σ → ℝ} + {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} {p q : ℝ} + (h : F.ControlledSymbolFactorization b ω hF η S X p) + (hS : ∀ i, 0 < S i) (hT : ∀ i, 0 < T i) + (hq : 0 ≤ q) (hST : ∀ i, Real.exp (-q) * T i ≤ S i) : + F.ControlledSymbolFactorization b ω hF η T X (p + (s : ℝ) * q) := by + obtain ⟨m, E, P, R, W, v, hm, hmp, hprod, hE, hR, hv, hW, hh, hη, hP⟩ := h + have hpq : p ≤ p + (s : ℝ) * q := le_add_of_nonneg_right (mul_nonneg (Nat.cast_nonneg s) hq) + exact ⟨m, E, P, R, W, v, hm, hmp.trans (Real.exp_le_exp.mpr hpq), hprod, + F.symbolSlowBound_rescale b ω hF S T hS hT hq hST E hE, + hR, hv, hW, (fun i j => (hh i j).trans hpq), hη, hP⟩ + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +def SymbolFactorizationIn (T : σ → ℝ) + (X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)) (p : ℝ) (l : ℕ) + (W : LieSubalgebra ℚ F.AssociatedGraded) : Prop := + ∃ E P R : F.RealPolynomialSymbolGroup (fun _ : σ => 1), + E * P * R = X ∧ F.SymbolSlowBound b ω hF (fun _ => 1) T (Real.exp p) E ∧ + F.SymbolRationalGrid b ω hF (fun _ => 1) l R ∧ + P.coord ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF (fun _ => 1) W) + +theorem ControlledSymbolFactorization.exists_in {η : L →ₗ[ℚ] ℚ} {T : σ → ℝ} + {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} {p : ℝ} + (h : F.ControlledSymbolFactorization b ω hF η T X p) : + ∃ (l : ℕ) (W : LieSubalgebra ℚ F.AssociatedGraded) (u : ι → F.AssociatedGraded), + 0 < l ∧ (l : ℝ) ≤ Real.exp p ∧ Submodule.span ℚ (Set.range u) = W.toSubmodule ∧ + BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule ∧ + (∀ i j, rationalLogHeight ((F.associatedGradedBasis b ω hF).repr (u i) j) ≤ p) ∧ + (∀ x ∈ W, basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x → + F.gradedFrequency b ω hF η x = 0) ∧ + F.SymbolFactorizationIn b ω hF T X p l W := by + obtain ⟨l, E, P, R, W, u, hl, hlp, hprod, hE, hR, hu, hW, hh, hη, hP⟩ := h + exact ⟨l, W, u, hl, hlp, hu, hW, hh, hη, E, P, R, hprod, hE, hR, hP⟩ + +theorem SymbolFactorizationIn.mono {T : σ → ℝ} + {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} {p q : ℝ} {l : ℕ} + {W : LieSubalgebra ℚ F.AssociatedGraded} + (h : F.SymbolFactorizationIn b ω hF T X p l W) (hpq : p ≤ q) (hT : ∀ i, 0 < T i) : + F.SymbolFactorizationIn b ω hF T X q l W := by + obtain ⟨E, P, R, hprod, hE, hR, hP⟩ := h + exact ⟨E, P, R, hprod, + F.symbolSlowBound_mono b ω hF (fun _ => 1) T hT (Real.exp_le_exp.mpr hpq) E hE, hR, hP⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +open Module + +theorem monomialScale_div_const {σ : Type*} (S : σ → ℝ) (c : ℝ) (α : σ →₀ ℕ) : + monomialScale (fun i => S i / c) α = + monomialScale S α / c ^ Finsupp.weight (fun _ => 1) α := by + calc + _ = monomialScale (fun i => c⁻¹ * S i) α := by + congr 1 + funext i + simp only [div_eq_mul_inv, mul_comm] + _ = c⁻¹ ^ Finsupp.weight (fun _ => 1) α * monomialScale S α := monomialScale_const_mul S c⁻¹ α + _ = _ := by rw [inv_pow, div_eq_mul_inv, mul_comm] + +namespace NilpotentLieFiltration + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem symbolRationalGrid_dilation_ratio (w : σ → ℕ) (D d : ℕ) (a : ℤ) (hd : 0 < d) + (g : F.RealPolynomialSymbolGroup w) (hg : F.SymbolRationalGrid b ω hF w D g) : + F.SymbolRationalGrid b ω hF w (D * d ^ s) + (F.realPolynomialSymbolDilationHom w ((a : ℚ) / d) g) := by + change (fun z => ((F.polynomialSymbolBasis b ω hF w).baseChange ℝ).repr + (F.realPolynomialSymbolDilationHom w ((a : ℚ) / d) g).coord z) ∈ _ + simp_rw [F.realPolynomialSymbolDilationHom_coord, F.realPolynomialSymbolDilation_repr, + Rat.cast_div, Rat.cast_intCast, Rat.cast_natCast] + exact realDenominatorGrid_rational_power_scale (fun z : SymbolBasisIndex w ω => Finsupp.weight w z.val.1) + D d s a hd (fun z => z.property.le.trans (F.adaptedBasis_weight_le_step b ω hF z.val.2)) _ hg + +theorem symbolSlowBound_dilation_inverse_scale (S : σ → ℝ) (hS : ∀ i, 0 < S i) + (p : ℝ) (r : ℚ) (hr : r ≠ 0) (E : F.RealPolynomialSymbolGroup (fun _ : σ => 1)) + (hE : F.SymbolSlowBound b ω hF (fun _ => 1) S (Real.exp p) E) : + F.SymbolSlowBound b ω hF (fun _ => 1) (fun i => S i / |(r : ℝ)|) (Real.exp p) + (F.realPolynomialSymbolDilationHom (fun _ => 1) r E) := by + have hrR : (r : ℝ) ≠ 0 := by exact_mod_cast hr + have habs : 0 < |(r : ℝ)| := abs_pos.mpr hrR + intro z + rw [F.realPolynomialSymbolDilationHom_coord, F.realPolynomialSymbolDilation_repr, abs_mul, abs_pow] + apply (mul_le_mul_of_nonneg_left (hE z) (pow_nonneg habs.le _)).trans_eq + rw [monomialScale_div_const] + field_simp [(monomialScale_pos S hS z.val.1).ne', habs.ne'] + +theorem symbolSlowBound_dilation_physical (S T : σ → ℝ) + (hS : ∀ i, 0 < S i) (hT : ∀ i, 0 < T i) (p q : ℝ) (hq : 0 ≤ q) + (r : ℚ) (hr : r ≠ 0) + (hphysical : ∀ i, Real.exp (-q) * (|(r : ℝ)| * T i) ≤ S i) + (E : F.RealPolynomialSymbolGroup (fun _ : σ => 1)) + (hE : F.SymbolSlowBound b ω hF (fun _ => 1) S (Real.exp p) E) : + F.SymbolSlowBound b ω hF (fun _ => 1) T (Real.exp (p + (s : ℝ) * q)) + (F.realPolynomialSymbolDilationHom (fun _ => 1) r E) := by + have hrR : (r : ℝ) ≠ 0 := by exact_mod_cast hr + have habs : 0 < |(r : ℝ)| := abs_pos.mpr hrR + have hscaled := F.symbolSlowBound_dilation_inverse_scale b ω hF S hS p r hr E hE + apply F.symbolSlowBound_rescale b ω hF (fun i => S i / |(r : ℝ)|) T + (fun i => div_pos (hS i) habs) hT hq _ _ hscaled + intro i + apply (le_div_iff₀ habs).mpr + calc + Real.exp (-q) * T i * |(r : ℝ)| = Real.exp (-q) * (|(r : ℝ)| * T i) := by ring + _ ≤ S i := hphysical i + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +def SymbolFastIn {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (w : σ → ℕ) + (U : LieSubalgebra ℚ (F.PolynomialSymbol w)) (g : F.RealPolynomialSymbolGroup w) : Prop := + g.coord ∈ realificationLieSubalgebra U + +theorem SymbolFactorizationIn.exists_fast_factors {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + {T : σ → ℝ} {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} {p : ℝ} {l : ℕ} + {W : LieSubalgebra ℚ F.AssociatedGraded} + (h : F.SymbolFactorizationIn b ω hF T X p l W) : + ∃ E P R : F.RealPolynomialSymbolGroup (fun _ : σ => 1), + E * P * R = X ∧ F.SymbolSlowBound b ω hF (fun _ => 1) T (Real.exp p) E ∧ + F.SymbolRationalGrid b ω hF (fun _ => 1) l R ∧ + F.SymbolFastIn (fun _ => 1) (F.symbolPointwiseSubalgebra b ω hF (fun _ => 1) W) P := h + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricCubeSublevel.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricCubeSublevel.lean new file mode 100644 index 0000000000000000000000000000000000000000..a15e8fa2a806e687ba62852140340c8334c82855 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricCubeSublevel.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Estimates.SublevelThresholdBalance +import OAI.Combinatorics.Progressions.Probability.SymmetricCubeMeasure + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +theorem symmetricCubeMeasure_sublevel_one + (p : MvPolynomial (Fin 1) ℝ) {d : ℕ} (hd : 0 < d) (hp : p.degreeOf 0 ≤ d) + {u c : ℝ} (hu : 0 ≤ u) (hc : 0 < c) (m : Fin 1 →₀ ℕ) + (hm : c ≤ |p.coeff m|) : + (symmetricCubeMeasure 1).real {x | |MvPolynomial.eval x p| ≤ u} ≤ + univariateSublevelConstant d * (u / c) ^ ((d : ℝ)⁻¹) := by + have htail : m.tail = 0 := Subsingleton.elim _ _ + have hcoeff : (polynomialCoordinateSlice p (0 : Fin 0 → ℝ)).coeff (m 0) = + p.coeff m := by + rw [polynomialCoordinateSlice_coeff, MvPolynomial.eval_zero] + have h := polynomialCoordinateSlice_selected_coefficient p m + rw [htail] at h + exact h + have hs : MeasurableSet {z : (Fin 0 → ℝ) × ℝ | |(polynomialCoordinateSlice p z.1).eval z.2| ≤ u} := + measurableSet_le (continuous_abs.measurable.comp (polynomialCoordinateSlice_measurable_eval p)) + measurable_const + rw [symmetricCubeMeasure_sublevel_succ, product_measureReal_eq_integral_fiber _ _ _ hs, + symmetricCubeMeasure_zero, integral_dirac] + exact symmetricScalarMeasure_sublevel_bound _ hd (polynomialCoordinateSlice_degree_le p hp 0) + hu hc (m 0) (by simpa only [hcoeff] using hm) + +theorem symmetricCube_polynomial_sublevel_bound (d : ℕ) (hd : 0 < d) : + ∀ (n : ℕ) (p : MvPolynomial (Fin (n + 1)) ℝ), + (∀ j, p.degreeOf j ≤ d) → ∀ {u c : ℝ}, 0 < u → 0 < c → + ∀ m : Fin (n + 1) →₀ ℕ, c ≤ |p.coeff m| → + (symmetricCubeMeasure (n + 1)).real {x | |MvPolynomial.eval x p| ≤ u} ≤ + ((n + 1 : ℝ) * univariateSublevelConstant d) * + (u / c) ^ ((((n + 1) * d : ℕ) : ℝ)⁻¹) := by + intro n + induction n with + | zero => + intro p hp u c hu hc m hm + simpa only [Nat.zero_add, Nat.one_mul, Nat.cast_zero, zero_add, one_mul] using + symmetricCubeMeasure_sublevel_one p hd (hp 0) hu.le hc m hm + | succ n ih => + intro p hp u c hu hc m hm + obtain ⟨τ, hτ, hfirst, hsecond⟩ := sublevel_threshold_balance (n + 1) d (by omega) hd hu hc + let q := (MvPolynomial.finSuccEquiv ℝ (n + 1) p).coeff (m 0) + have hq : ∀ j, q.degreeOf j ≤ d := polynomialCoordinateSlice_coefficient_degrees p hp (m 0) + have hqc : c ≤ |q.coeff m.tail| := by + simpa only [q, polynomialCoordinateSlice_selected_coefficient] using hm + have hbase := ih q hq hτ hc m.tail hqc + have hstep := symmetricCubeMeasure_sublevel_step p hd (hp 0) (m 0) hu.le hτ + apply hstep.trans + calc + _ ≤ ((n + 1 : ℝ) * univariateSublevelConstant d) * + (τ / c) ^ ((((n + 1) * d : ℕ) : ℝ)⁻¹) + + univariateSublevelConstant d * (u / τ) ^ ((d : ℝ)⁻¹) := + add_le_add hbase le_rfl + _ = _ := by rw [hfirst, hsecond]; push_cast; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricCubeVolume.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricCubeVolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..24b669c502db14e59ff2dd20b7f6875f25e716bd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricCubeVolume.lean @@ -0,0 +1,44 @@ +import OAI.Combinatorics.Progressions.Probability.SymmetricCubeMeasure + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ENNReal BigOperators + +def symmetricUnitBox (n : ℕ) : Set (Fin n → ℝ) := + Set.pi Set.univ (fun _ => Set.Icc (-1 : ℝ) 1) + +theorem symmetricUnitBox_mem (n : ℕ) (x : Fin n → ℝ) : + x ∈ symmetricUnitBox n ↔ ∀ i, |x i| ≤ 1 := by + simp only [symmetricUnitBox, Set.mem_pi, Set.mem_univ, forall_true_left, Set.mem_Icc, abs_le] + +theorem symmetricCubeMeasure_eq_smul_restrict (n : ℕ) : + symmetricCubeMeasure n = (1 / 2 : ℝ≥0∞) ^ n • volume.restrict (symmetricUnitBox n) := by + unfold symmetricCubeMeasure + apply Measure.pi_eq + intro s hs + rw [Measure.smul_apply, Measure.restrict_apply (MeasurableSet.univ_pi hs)] + change (1 / 2 : ℝ≥0∞) ^ n * volume ((Set.pi Set.univ s) ∩ + (Set.pi Set.univ fun _ : Fin n => Set.Icc (-1 : ℝ) 1)) = _ + rw [← Set.pi_inter_distrib, volume_pi_pi] + simp only [symmetricScalarMeasure, Measure.smul_apply, Measure.restrict_apply (hs _), + smul_eq_mul, Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ, Fintype.card_fin] + +theorem symmetricUnitBox_volume_inter (n : ℕ) (s : Set (Fin n → ℝ)) (hs : MeasurableSet s) : + volume.real (symmetricUnitBox n ∩ s) = (2 : ℝ) ^ n * (symmetricCubeMeasure n).real s := by + rw [symmetricCubeMeasure_eq_smul_restrict, measureReal_ennreal_smul_apply, + measureReal_restrict_apply hs, ENNReal.toReal_pow] + norm_num only [ENNReal.toReal_div, ENNReal.toReal_one, ENNReal.toReal_ofNat] + rw [← mul_assoc, ← mul_pow] + norm_num only [div_self (by norm_num : (2 : ℝ) ≠ 0), one_pow, one_mul] + rw [Set.inter_comm] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricEvaluationLowerBound.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricEvaluationLowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..77ed9622d2e984b7f6868c781fb7f6e27a4d64e6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricEvaluationLowerBound.lean @@ -0,0 +1,166 @@ +import Mathlib.Analysis.Normed.Module.FiniteDimension +import Mathlib.Topology.Order.Compact +import OAI.Combinatorics.Progressions.Geometry.FiniteUnitCoordinate +import OAI.Combinatorics.Progressions.Polynomial.FiniteMomentPolynomial + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem continuous_momentProduct (m : ℕ) : + Continuous (fun v : Fin m → Fin m → ℂ => momentProduct v) := by + unfold momentProduct + fun_prop + +theorem exists_momentProduct_unit_lower (m : ℕ) : + ∃ c : ℝ, 0 < c ∧ ∀ v : Fin m → Fin m → ℂ, + (∀ i, ‖v i‖ = 1) → c ≤ ‖momentProduct v‖ := by + have hcompact : IsCompact {v : Fin m → Fin m → ℂ | ∀ i, ‖v i‖ = 1} := by + simpa only [Metric.mem_sphere, dist_zero_right] using + isCompact_pi_infinite (fun _i : Fin m => isCompact_sphere (0 : Fin m → ℂ) 1) + apply hcompact.exists_forall_le' ((continuous_momentProduct m).norm.continuousOn) + intro v hv + apply norm_pos_iff.mpr + obtain ⟨z, hz⟩ := momentProduct_ne_zero_some v (fun i hi => by + have h := hv i + simp only [hi, norm_zero, zero_ne_one] at h) + intro h + exact hz (congrFun h z) + +theorem momentProduct_smul {m : ℕ} (v : Fin m → Fin m → ℂ) (c : Fin m → ℂ) : + momentProduct (fun i => c i • v i) = (∏ i, c i) • momentProduct v := by + funext z + simp only [momentProduct, Pi.smul_apply, smul_eq_mul, mul_assoc, + ← Finset.mul_sum, Finset.prod_mul_distrib] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_momentProduct_lower (m : ℕ) : + ∃ c : ℝ, 0 < c ∧ ∀ v : Fin m → Fin m → ℂ, + (∀ i, v i ≠ 0) → ∃ z, c * ∏ i, ‖v i‖ ≤ ‖momentProduct v z‖ := by + obtain ⟨c, hc, hbound⟩ := exists_momentProduct_unit_lower m + refine ⟨c, hc, ?_⟩ + intro v hv + let w : Fin m → Fin m → ℂ := fun i => (‖v i‖ : ℂ)⁻¹ • v i + have hn (i) : ‖v i‖ ≠ 0 := norm_ne_zero_iff.mpr (hv i) + have hnc (i) : (‖v i‖ : ℂ) ≠ 0 := by exact_mod_cast hn i + have hw (i) : ‖w i‖ = 1 := by + simp only [w, norm_smul, norm_inv, Complex.norm_real, norm_norm] + exact inv_mul_cancel₀ (hn i) + have hreconstruct : (fun i => (‖v i‖ : ℂ) • w i) = v := by + funext i + simp only [w, smul_smul, mul_inv_cancel₀ (hnc i), one_smul] + have hex : ∃ z, c ≤ ‖momentProduct w z‖ := by + by_contra h + push Not at h + exact not_lt_of_ge (hbound w hw) ((pi_norm_lt_iff hc).mpr h) + obtain ⟨z, hz⟩ := hex + refine ⟨z, ?_⟩ + have heq : ‖momentProduct v z‖ = (∏ i, ‖v i‖) * ‖momentProduct w z‖ := by + have h := congrFun (momentProduct_smul w (fun i => (‖v i‖ : ℂ))) z + rw [hreconstruct] at h + rw [h, Pi.smul_apply, norm_smul, norm_prod] + simp only [Complex.norm_real, norm_norm] + rw [heq, mul_comm c] + exact mul_le_mul_of_nonneg_left hz (Finset.prod_nonneg (fun i _ => norm_nonneg (v i))) + +noncomputable def momentLowerConstant (m : ℕ) : ℝ := + Classical.choose (exists_momentProduct_lower m) + +theorem momentLowerConstant_pos (m : ℕ) : 0 < momentLowerConstant m := + (Classical.choose_spec (exists_momentProduct_lower m)).1 + +theorem momentLowerConstant_bound {m : ℕ} (v : Fin m → Fin m → ℂ) + (hv : ∀ i, v i ≠ 0) : + ∃ z, momentLowerConstant m * ∏ i, ‖v i‖ ≤ ‖momentProduct v z‖ := + (Classical.choose_spec (exists_momentProduct_lower m)).2 v hv + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +abbrev SymmetricEvaluationIndex (m : ℕ) (I : Type*) := (Fin m → I) × Fin (m * m + 1) + +noncomputable def symmetricEvaluation {m : ℕ} {I : Type*} + (v : Fin m → I → ℂ) (k : SymmetricEvaluationIndex m I) : ℂ := + momentProduct (fun i j => v i (k.1 j)) k.2 + +theorem symmetricEvaluation_permute {m : ℕ} {I : Type*} + (v : Fin m → I → ℂ) (e : Equiv.Perm (Fin m)) : + symmetricEvaluation (fun i => v (e i)) = symmetricEvaluation v := by + funext k + exact Equiv.prod_comp e (fun i => ∑ j, v i (k.1 j) * (k.2.val : ℂ) ^ j.val) + +theorem symmetricEvaluation_smul {m : ℕ} {I : Type*} + (v : Fin m → I → ℂ) (c : Fin m → ℂ) : + symmetricEvaluation (fun i => c i • v i) = (∏ i, c i) • symmetricEvaluation v := by + funext k + exact congrFun (momentProduct_smul (fun i j => v i (k.1 j)) c) k.2 + +theorem symmetricEvaluation_const_mul {m : ℕ} {I : Type*} + (v : Fin m → I → ℂ) (c : ℂ) (k : SymmetricEvaluationIndex m I) : + symmetricEvaluation (fun i j => c * v i j) k = c ^ m * symmetricEvaluation v k := by + have h := congrFun (symmetricEvaluation_smul v (fun _ => c)) k + change symmetricEvaluation (fun i => c • v i) k = _ + simpa only [Pi.smul_apply, smul_eq_mul, Finset.prod_const, Finset.card_univ, Fintype.card_fin] using h + +theorem symmetricEvaluationIndex_card (m : ℕ) (I : Type*) [Fintype I] : + Fintype.card (SymmetricEvaluationIndex m I) = Fintype.card I ^ m * (m * m + 1) := by + simp only [SymmetricEvaluationIndex, Fintype.card_prod, Fintype.card_fun, Fintype.card_fin] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem symmetricEvaluation_lower {m : ℕ} {I : Type*} [Fintype I] + (v : Fin m → I → ℂ) (hv : ∀ i, ∑ j, ‖v i j‖ ^ 2 = 1) : + ∃ k, momentLowerConstant m / (Fintype.card I + 1 : ℝ) ^ m ≤ + ‖symmetricEvaluation v k‖ := by + classical + choose a ha using fun i => exists_large_unit_coordinate (v i) (hv i) + let w : Fin m → Fin m → ℂ := fun i j => v i (a j) + let δ : ℝ := 1 / (Fintype.card I + 1 : ℝ) + have hδ : 0 < δ := by dsimp [δ]; positivity + have hw (i) : δ ≤ ‖w i‖ := (ha i).trans (norm_le_pi_norm (w i) i) + have hw0 (i) : w i ≠ 0 := norm_pos_iff.mp (hδ.trans_le (hw i)) + obtain ⟨z, hz⟩ := momentLowerConstant_bound w hw0 + refine ⟨(a, z), ?_⟩ + have hprod : δ ^ m ≤ ∏ i, ‖w i‖ := by + have h := Finset.prod_le_prod₀ (s := Finset.univ) + (fun _ _ => hδ.le) (fun i _ => hw i) + simpa only [Finset.prod_const, Finset.card_univ, Fintype.card_fin] using h + calc + _ = momentLowerConstant m * δ ^ m := by simp [δ, div_eq_mul_inv, inv_pow] + _ ≤ momentLowerConstant m * ∏ i, ‖w i‖ := + mul_le_mul_of_nonneg_left hprod (momentLowerConstant_pos m).le + _ ≤ ‖symmetricEvaluation v (a, z)‖ := hz + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricIntervalDilation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricIntervalDilation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c7e230b726de1bc9159d0bd418fad173504f4a8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricIntervalDilation.lean @@ -0,0 +1,37 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +theorem symmetricInterval_card (N : ℕ) : + (Finset.Icc (-(N : ℤ)) (N : ℤ)).card = 2 * N + 1 := by + rw [Int.card_Icc] + omega + +theorem symmetricInterval_sum_dilation (f : ℤ → ℝ) (hf : ∀ n, 0 ≤ f n) + (a : ℤ) (ha : a ≠ 0) (H N : ℕ) (hsize : |(a : ℝ)| * H ≤ N) : + (∑ n ∈ Finset.Icc (-(H : ℤ)) (H : ℤ), f (a * n)) ≤ + ∑ n ∈ Finset.Icc (-(N : ℤ)) (N : ℤ), f n := by + classical + have hsizeZ : |a| * (H : ℤ) ≤ (N : ℤ) := by exact_mod_cast hsize + have hinj : Function.Injective (fun n : ℤ => a * n) := fun _ _ h => mul_left_cancel₀ ha h + have hsub : (Finset.Icc (-(H : ℤ)) (H : ℤ)).image (fun n => a * n) ⊆ + Finset.Icc (-(N : ℤ)) (N : ℤ) := by + intro n hn + obtain ⟨m, hm, rfl⟩ := Finset.mem_image.mp hn + have hmabs : |m| ≤ (H : ℤ) := abs_le.mpr (Finset.mem_Icc.mp hm) + apply Finset.mem_Icc.mpr + apply abs_le.mp + rw [abs_mul] + exact (mul_le_mul_of_nonneg_left hmabs (abs_nonneg a)).trans hsizeZ + rw [← Finset.sum_image (fun _ _ _ _ h => hinj h)] + exact Finset.sum_le_sum_of_subset_of_nonneg hsub (fun n _ _ => hf n) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricScalarSublevel.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricScalarSublevel.lean new file mode 100644 index 0000000000000000000000000000000000000000..5834e1e912c99dc51308839458298bdf0f6d69fd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricScalarSublevel.lean @@ -0,0 +1,63 @@ +import Mathlib.MeasureTheory.Constructions.BorelSpace.Order +import OAI.Combinatorics.Progressions.Estimates.FiniteFiberVolumeBound +import OAI.Combinatorics.Progressions.Polynomial.UnivariatePolynomialSublevel + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory Polynomial +open scoped ENNReal + +noncomputable def symmetricScalarMeasure : Measure ℝ := + (1 / 2 : ℝ≥0∞) • volume.restrict (Set.Icc (-1 : ℝ) 1) + +instance symmetricScalarMeasure_probability : IsProbabilityMeasure symmetricScalarMeasure := by + constructor + norm_num [symmetricScalarMeasure, Measure.smul_apply, ENNReal.smul_def, Real.volume_Icc] + exact ENNReal.inv_mul_cancel (by norm_num) (by norm_num) + +theorem symmetricScalarMeasure_sublevel (p : ℝ[X]) (u : ℝ) : + symmetricScalarMeasure.real {x | |p.eval x| ≤ u} = + (1 / 2 : ℝ) * volume.real (unitPolynomialSublevel p u) := by + have hs : MeasurableSet {x | |p.eval x| ≤ u} := (isClosed_le p.continuous.abs continuous_const).measurableSet + have heq : {x | |p.eval x| ≤ u} ∩ Set.Icc (-1 : ℝ) 1 = unitPolynomialSublevel p u := by + ext x + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_Icc, unitPolynomialSublevel, abs_le] + tauto + rw [symmetricScalarMeasure, measureReal_ennreal_smul_apply, measureReal_restrict_apply hs, heq] + norm_num + +theorem symmetricScalarMeasure_sublevel_bound (p : ℝ[X]) {d : ℕ} (hd : 0 < d) + (hdeg : p.natDegree ≤ d) {u c : ℝ} (hu : 0 ≤ u) (hc : 0 < c) + (k : ℕ) (hk : c ≤ |p.coeff k|) : + symmetricScalarMeasure.real {x | |p.eval x| ≤ u} ≤ + univariateSublevelConstant d * (u / c) ^ ((d : ℝ)⁻¹) := by + rw [symmetricScalarMeasure_sublevel] + apply le_trans _ (unitPolynomialSublevel_rpow_bound p hd hdeg hu hc k hk) + nlinarith [measureReal_nonneg (μ := volume) (s := unitPolynomialSublevel p u)] + +theorem polynomial_family_sublevel_step {T : Type*} [MeasurableSpace T] + (μ : Measure T) [IsProbabilityMeasure μ] (p : T → ℝ[X]) {d : ℕ} (hd : 0 < d) + (hdeg : ∀ x, (p x).natDegree ≤ d) + (hval : Measurable (fun z : T × ℝ => (p z.1).eval z.2)) + (k : ℕ) (hcoeff : Measurable (fun x => (p x).coeff k)) + {u τ : ℝ} (hu : 0 ≤ u) (hτ : 0 < τ) : + (μ.prod symmetricScalarMeasure).real {z | |(p z.1).eval z.2| ≤ u} ≤ + μ.real {x | |(p x).coeff k| ≤ τ} + + univariateSublevelConstant d * (u / τ) ^ ((d : ℝ)⁻¹) := by + apply product_probability_le_bad_set_add μ symmetricScalarMeasure _ + (measurableSet_le (continuous_abs.measurable.comp hval) measurable_const) _ + (measurableSet_le (continuous_abs.measurable.comp hcoeff) measurable_const) + (mul_nonneg (univariateSublevelConstant_pos d).le (Real.rpow_nonneg (div_nonneg hu hτ.le) _)) + intro x hx + have hk : τ ≤ |(p x).coeff k| := (lt_of_not_ge hx).le + exact symmetricScalarMeasure_sublevel_bound (p x) hd (hdeg x) hu hτ k hk + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricSquarefreeMonotonicity.lean b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricSquarefreeMonotonicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e2a7f17f5cb2ca318a8d7d2c84434cea36526cb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/SymmetricSquarefreeMonotonicity.lean @@ -0,0 +1,478 @@ +import Mathlib.Logic.Equiv.Fin.Basic +import OAI.Combinatorics.Progressions.Estimates.NativeDilationObservable +import OAI.Combinatorics.Progressions.Estimates.NormalizedComparisonOrbit +import OAI.Combinatorics.Progressions.Estimates.PrescribedInvariantUnit + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +open CircleFourier +open scoped TensorProduct BigOperators NNReal + +variable {L I : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype I] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} {T : Subgroup D.RealGroup} {p : ℝ} + +noncomputable def tensorPower (V : D.UnitVerticalObservable T I p) (n : ℕ) : + D.UnitVerticalObservable T (Fin n → I) (p + n + 1) where + observable a x := ∏ j, V.observable (a j) x + unit x := by + simp only [norm_prod, ← Finset.prod_pow] + calc + _ = ∏ _j : Fin n, ∑ a : I, ‖V.observable a x‖ ^ 2 := (Fintype.prod_sum _).symm + _ = 1 := by simp only [V.unit, Finset.prod_const_one] + norm a x := by + rw [norm_prod] + exact Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) (fun j _ => V.norm (a j) x) + lipBound := n * V.lipBound + lip_bound := by + change (n : ℝ) * V.lipBound ≤ Real.exp (p + n + 1) + calc + _ ≤ Real.exp ((n : ℝ) + 1) * Real.exp p := + mul_le_mul (by linarith [Real.add_one_le_exp ((n : ℝ) + 1)]) V.lip_bound + V.lipBound.coe_nonneg (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + lipschitz := by + let := D.metricSpace + intro a + have h := bounded_lipschitz_fintype_prod (fun j x => V.observable (a j) x) + (B := 1) le_rfl (fun j => V.lipschitz (a j)) (fun j x => V.norm (a j) x) + simpa only [Fintype.card_fin, one_pow, mul_one] using h.2 + frequency := n • V.frequency + height i := by + simpa only [LinearMap.smul_apply, nsmul_eq_mul] using rationalLogHeight_nat_mul n (V.height i) + vertical a z hz x := by + simp only [V.vertical _ z hz x, Finset.prod_mul_distrib, Finset.prod_const, + Finset.card_univ, Fintype.card_fin, realifyFunctional_nsmul, AddCircle.coe_nsmul, character_nsmul] + integral z hz hL := by + obtain ⟨m, hm⟩ := V.integral z hz hL + refine ⟨(n : ℤ) * m, ?_⟩ + rw [realifyFunctional_nsmul, hm] + simp only [nsmul_eq_mul, Int.cast_mul, Int.cast_natCast] + +noncomputable def reindex {J : Type*} [Fintype J] + (V : D.UnitVerticalObservable T I p) (e : I ≃ J) : D.UnitVerticalObservable T J p where + observable j := V.observable (e.symm j) + unit x := (e.symm.sum_comp (fun i => ‖V.observable i x‖ ^ 2)).trans (V.unit x) + norm j := V.norm (e.symm j) + lipBound := V.lipBound + lip_bound := V.lip_bound + lipschitz := fun j => V.lipschitz (e.symm j) + frequency := V.frequency + height := V.height + vertical j := V.vertical (e.symm j) + integral := V.integral + +end Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped TensorProduct BigOperators + +theorem exists_of_unit_data {σ I : Type*} {L : Type} + [Fintype σ] [Fintype I] [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {t d : ℕ} {bound : σ → ℕ} (D : RationalFilteredNilmanifold L t d) + (M : D.MultidegreeStructure bound) (hstep : t = ∑ i, bound i) + {p : ℝ} (hM : M.ComplexityLE p) + (g : M.filtration.realification.PolynomialOrbit) + (V : D.UnitVerticalObservable (D.filtration.realification.subgroup t) I p) + (hI : (Fintype.card I : ℝ) ≤ Real.exp p) : + ∃ W : NativeMultidegreeNilcharacter bound p, ∃ e : I ≃ Fin W.outputDim, + W.dim = d ∧ ∀ i x, W.eval (e i) x = V.observable i + (QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval x g)) := by + classical + subst hstep + let V' : D.UnitVerticalObservable (M.realSubgroup bound) I p := + { V with + vertical := fun i z hz x => V.vertical i z (M.realSubgroup_top ▸ hz) x + integral := fun z hz hL => V.integral z (M.realSubgroup_top ▸ hz) hL } + obtain ⟨i, _⟩ := exists_large_unit_coordinate + (fun i => V.observable i (QuotientGroup.mk 1)) (V.unit _) + let W : NativeMultidegreeNilcharacter bound p := + { L := L + dim := d + model := D + multi := M + complexity := hM + orbit := g + outputDim := Fintype.card I + output_pos := Fintype.card_pos_iff.mpr ⟨i⟩ + output_bound := hI + vertical := V'.reindex (Fintype.equivFin I) } + refine ⟨W, Fintype.equivFin I, rfl, ?_⟩ + intro i x + change V.observable ((Fintype.equivFin I).symm ((Fintype.equivFin I) i)) _ = _ + rw [Equiv.symm_apply_apply] + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +noncomputable def tensorIndexEquiv (d n : ℕ) : (Fin n → Fin d) ≃ Fin (d ^ n) := + Fintype.equivFinOfCardEq (by simp only [Fintype.card_fun, Fintype.card_fin]) + +noncomputable def tensorPowerBudget (n : ℕ) (p : ℝ) : ℝ := (n + 1) * (p + 1) + +theorem tensorPowerBudget_bounds (n : ℕ) {p : ℝ} (hp : 0 ≤ p) : + p ≤ tensorPowerBudget n p ∧ p + n + 1 ≤ tensorPowerBudget n p ∧ + (n : ℝ) * p ≤ tensorPowerBudget n p := by + have hn : 0 ≤ (n : ℝ) := Nat.cast_nonneg _ + unfold tensorPowerBudget + constructor + · nlinarith [mul_nonneg hn hp] + constructor <;> nlinarith [mul_nonneg hn hp] + +namespace NativeMultidegreeNilcharacter + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {σ : Type*} [Fintype σ] {bound : σ → ℕ} {p : ℝ} + (W : NativeMultidegreeNilcharacter bound p) + +noncomputable def tensorPower (n : ℕ) : NativeMultidegreeNilcharacter bound (tensorPowerBudget n p) := by + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + have hb := tensorPowerBudget_bounds n hp + exact { + L := W.L + dim := W.dim + model := W.model + multi := W.multi + complexity := W.complexity.mono W.multi hb.1 + orbit := W.orbit + outputDim := W.outputDim ^ n + output_pos := pow_pos W.output_pos n + output_bound := by + simpa only [Nat.cast_pow] using + (pow_le_pow_left₀ (Nat.cast_nonneg W.outputDim) W.output_bound n).trans + (by rw [← Real.exp_nat_mul]; exact Real.exp_le_exp.mpr hb.2.2) + vertical := ((W.vertical.tensorPower n).reindex (tensorIndexEquiv W.outputDim n)).mono hb.2.1 } + +theorem tensorPower_eval (n : ℕ) (a : Fin (W.outputDim ^ n)) (x : σ → ℤ) : + (W.tensorPower n).eval a x = ∏ j, W.eval ((tensorIndexEquiv W.outputDim n).symm a j) x := rfl + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def tensorVector {σ I : Type*} (f : I → (σ → ℤ) → ℂ) + (n : ℕ) (a : Fin n → I) (x : σ → ℤ) : ℂ := ∏ j, f (a j) x + +theorem product_flatten {q n N : ℕ} (e : (Fin q × Fin n) ≃ Fin N) + (f : Fin q → Fin n → ℂ) : + (∏ i, ∏ j, f i j) = ∏ k, f (e.symm k).1 (e.symm k).2 := by + calc + _ = ∏ a : Fin q × Fin n, f a.1 a.2 := (Fintype.prod_prod_type (fun a => f a.1 a.2)).symm + _ = _ := (e.symm.prod_comp (fun a => f a.1 a.2)).symm + +noncomputable def rootTensorEquiv (q t : ℕ) (ht : 1 ≤ t) : + (Fin q × Fin (q ^ (t - 1))) ≃ Fin (((q : ℤ) ^ t).natAbs) := + finProdFinEquiv.trans (finCongr (by + have h : q * q ^ (t - 1) = q ^ t := by rw [← pow_succ', Nat.sub_add_cancel ht] + simpa only [Int.natAbs_pow, Int.natAbs_natCast] using h)) + +noncomputable def rootTensorIndex (d q t : ℕ) (ht : 1 ≤ t) + (a : Fin q → Fin (d ^ (q ^ (t - 1)))) : Fin (((q : ℤ) ^ t).natAbs) → Fin d := + fun k => (tensorIndexEquiv d (q ^ (t - 1))).symm + (a ((rootTensorEquiv q t ht).symm k).1) ((rootTensorEquiv q t ht).symm k).2 + +theorem NativeMultidegreeNilcharacter.tensorPower_tensor_eval + {σ : Type*} [Fintype σ] {bound : σ → ℕ} {p : ℝ} + (W : NativeMultidegreeNilcharacter bound p) (q t : ℕ) (ht : 1 ≤ t) + (a : Fin q → Fin (W.outputDim ^ (q ^ (t - 1)))) (x : σ → ℤ) : + tensorVector (W.tensorPower (q ^ (t - 1))).eval q a x = + signedTensorVector W.eval ((q : ℤ) ^ t) (rootTensorIndex W.outputDim q t ht a) x := by + unfold tensorVector + simp_rw [W.tensorPower_eval] + have hnonneg : 0 ≤ (q : ℤ) ^ t := pow_nonneg (Int.natCast_nonneg q) _ + simp only [signedTensorVector, signedTensorProduct, ite_eq_right (not_lt.mpr hnonneg)] + exact product_flatten (rootTensorEquiv q t ht) _ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem tensorVector_unit {σ I : Type*} [Fintype I] (f : I → (σ → ℤ) → ℂ) + (hunit : ∀ x, ∑ i, ‖f i x‖ ^ 2 = 1) (n : ℕ) (x : σ → ℤ) : + ∑ a : Fin n → I, ‖tensorVector f n a x‖ ^ 2 = 1 := by + simp only [tensorVector, norm_prod, ← Finset.prod_pow] + calc + _ = ∏ _j : Fin n, ∑ i : I, ‖f i x‖ ^ 2 := (Fintype.prod_sum _).symm + _ = 1 := by simp only [hunit, Finset.prod_const_one] + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open scoped TensorProduct + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [T2Space (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + +structure SymmetricSquarefreeUnitData (p : ℝ) (η : L →ₗ[ℚ] ℚ) (q : ℝ) where + grid : ℕ + grid_pos : 0 < grid + stable : M.SquarefreeGridStable p grid + complexity : (M.squarefreeModelMultidegree p grid grid_pos stable).ComplexityLE q + coordinateCount : ℕ + coordinateCount_pos : 0 < coordinateCount + observable : (M.squarefreeModel p grid grid_pos stable).UnitVerticalObservable + ((M.squarefreeModel p grid grid_pos stable).filtration.realification.subgroup + (Fintype.card (ReplicatedIndex bound))) + (SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) (Fin coordinateCount)) q + frequency : observable.frequency = M.filtration.replicatedFrequency η + invariant : ∀ (e : ReplicatedPermutation bound) k x, + observable.observable k (M.squarefreeSpacePermute p grid grid_pos stable e x) = + observable.observable k x + dimension : + (Fintype.card (SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) + (Fin coordinateCount)) : ℝ) ≤ Real.exp q + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open scoped TensorProduct BigOperators NNReal + +variable {σ : Type} {L I : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] [Fintype I] + {s d r : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (M : D.MultidegreeStructure bound) {p q v : ℝ} + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [T2Space (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + (V : D.UnitVerticalObservable (D.filtration.realification.subgroup s) I v) + (U : M.SymmetricSquarefreeUnitData p V.frequency q) + (E : RationalFilteredNilmanifold + (M.filtration.comparisonSubalgebra (fun j : ReplicatedIndex bound => j.1)) + (max s (Fintype.card (ReplicatedIndex bound))) r) + (hEL : E.lattice = M.comparisonLattice p U.grid U.grid_pos U.stable) + +noncomputable def comparisonVerticalProduct (ε : D.RealGroup) + (a : Fin (multidegreeFactorial bound) → I) + (k : SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) (Fin U.coordinateCount)) + (x : E.Space) : ℂ := + (V.tensorPower (multidegreeFactorial bound)).observable a + (ε • M.comparisonFirstSpace p U.grid U.grid_pos U.stable E hEL x) * + star (U.observable.observable k (M.comparisonSecondSpace p U.grid U.grid_pos U.stable E hEL x)) + +theorem comparisonVerticalProduct_norm (ε : D.RealGroup) + (a : Fin (multidegreeFactorial bound) → I) + (k : SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) (Fin U.coordinateCount)) + (x : E.Space) : ‖M.comparisonVerticalProduct V U E hEL ε a k x‖ ≤ 1 := by + unfold comparisonVerticalProduct + rw [norm_mul, norm_star] + simpa only [mul_one] using mul_le_mul + ((V.tensorPower (multidegreeFactorial bound)).norm a _) (U.observable.norm k _) + (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open scoped TensorProduct BigOperators + +theorem exists_controlled_symmetric_squarefree_unit (t : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} (D : RationalFilteredNilmanifold L s d) {bound : σ → ℕ} + (M : D.MultidegreeStructure bound), (∑ i, bound i) = t → + ∀ [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [T2Space (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + {p : ℝ}, M.ComplexityLE p → ∀ η : L →ₗ[ℚ] ℚ, + (∀ i, rationalLogHeight (η (D.basis i)) ≤ p) → + Nonempty (M.SymmetricSquarefreeUnitData (p + t.factorial + 1) η ((p + C) ^ C)) := by + obtain ⟨a, _, hinvariant⟩ := exists_prescribed_invariant_unit t t.factorial + obtain ⟨b, _, hfrequency⟩ := exists_squarefreeFrequency_cost t + let X : Polynomial ℕ := Polynomial.X + let Q := X + Polynomial.C t.factorial + 1 + let R := (Q + Polynomial.C b) ^ b + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (Q + R + (R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro σ L _ _ _ s d D bound M ht _ _ _ _ p hM η hη + have hp : 0 ≤ p := (Nat.cast_nonneg d).trans hM.1.1 + let q := p + t.factorial + 1 + let m := Fintype.card (ReplicatedPermutation bound) + have hm : 0 < m := Fintype.card_pos_iff.mpr ⟨1⟩ + have hmle : m ≤ t.factorial := by + simpa only [ht] using replicatedPermutation_card_le bound + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by dsimp [q]; linarith [Nat.cast_nonneg (α := ℝ) t.factorial] + have hηdiv (i) : rationalLogHeight (dividedFrequency m η (D.basis i)) ≤ q := by + apply (dividedFrequency_height m hm η (D.basis i) (hη i)).trans + have hmr : (m : ℝ) ≤ t.factorial := by exact_mod_cast hmle + dsimp [q] + linarith + obtain ⟨B, hB, hstable, hE, hηE, hint⟩ := + M.exists_controlled_replicated_frequency (hM.mono M hpq) (dividedFrequency m η) hηdiv + rw [ht] at hE hηE + let r := (q + b) ^ b + have hr : 0 ≤ r := by dsimp [r]; positivity + have hqr : squarefreeFrequencyModelBudget t q ≤ r := hfrequency q hq + have hEr := hE.mono (M.squarefreeModelMultidegree q B hB hstable) hqr + let E := M.squarefreeModel q B hB hstable + let := M.squarefreeSpaceAction q B hB hstable + have hstep : Fintype.card (ReplicatedIndex bound) = t := (replicatedIndex_card bound).trans ht + rw [← hstep] at hinvariant + obtain ⟨n, hn, hdim, W, hW, hWinv⟩ := hinvariant (Γ := ReplicatedPermutation bound) E + (by simpa only [hstep] using hmle) hr hEr.1 + (fun e => M.squarefreeSpacePermute_lipschitz q B hB hstable hr hEr.1 e) + (fun e z hz x => M.squarefreeSpacePermute_commutes_top q B hB hstable e z hz x) + (M.filtration.replicatedFrequency (dividedFrequency m η)) (fun i => (hηE i).trans hqr) hint + have htotal : q + r + (r + a) ^ a ≤ (p + C) ^ C := by + simpa [Q, R, X, q, r, Polynomial.eval₂_pow] using hbudget p hp + have hra : 0 ≤ (r + a) ^ a := by positivity + have hrC : r ≤ (p + C) ^ C := by linarith + have hWC : (r + a) ^ a ≤ (p + C) ^ C := by linarith + refine ⟨{ + grid := B + grid_pos := hB + stable := hstable + complexity := hEr.mono (M.squarefreeModelMultidegree q B hB hstable) hrC + coordinateCount := n + coordinateCount_pos := hn + observable := W.mono hWC + frequency := ?_ + invariant := hWinv + dimension := hdim.trans (Real.exp_le_exp.mpr hWC) }⟩ + change W.frequency = M.filtration.replicatedFrequency η + rw [hW] + ext x + simp only [LinearMap.smul_apply, nsmul_eq_mul, MultidegreeLieFiltration.replicatedFrequency_apply, + dividedFrequency, smul_eq_mul] + change (m : ℚ) * ((m : ℚ)⁻¹ * η _) = _ + rw [← mul_assoc, mul_inv_cancel₀ (by exact_mod_cast hm.ne' : (m : ℚ) ≠ 0), one_mul] + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure.SymmetricSquarefreeUnitData + +open scoped TensorProduct BigOperators + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + {M : D.MultidegreeStructure bound} {p q : ℝ} {η : L →ₗ[ℚ] ℚ} + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [T2Space (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + (U : M.SymmetricSquarefreeUnitData p η q) + +noncomputable def eval (g : M.filtration.realification.PolynomialOrbit) + (k : SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) (Fin U.coordinateCount)) + (x : ReplicatedIndex bound → ℤ) : ℂ := + U.observable.observable k (QuotientGroup.mk + ((M.filtration.squarefreeMultidegreeFiltration (fun j : ReplicatedIndex bound => j.1)).realification.polynomialOrbitEval + x (M.filtration.polarizeRealOrbit (fun j : ReplicatedIndex bound => j.1) g))) + +theorem eval_permute (g : M.filtration.realification.PolynomialOrbit) + (e : ReplicatedPermutation bound) + (k : SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) (Fin U.coordinateCount)) + (x : ReplicatedIndex bound → ℤ) : + U.eval g k (fun j => x ((replicatedPermutation bound e).symm j)) = U.eval g k x := by + unfold eval + rw [← M.filtration.polarizeRealOrbit_permute (fun j : ReplicatedIndex bound => j.1) + g (replicatedPermutation bound e) (replicatedPermutation_block bound e) x] + change U.observable.observable k (QuotientGroup.mk + (M.squarefreeRealPermute p U.grid U.grid_pos U.stable e _)) = _ + rw [← M.squarefreeSpacePermute_mk] + exact U.invariant e k _ + +theorem unit_eval (g : M.filtration.realification.PolynomialOrbit) + (x : ReplicatedIndex bound → ℤ) : ∑ k, ‖U.eval g k x‖ ^ 2 = 1 := + U.observable.unit _ + +theorem norm_eval (g : M.filtration.realification.PolynomialOrbit) + (k : SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) (Fin U.coordinateCount)) + (x : ReplicatedIndex bound → ℤ) : ‖U.eval g k x‖ ≤ 1 := U.observable.norm k _ + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure.SymmetricSquarefreeUnitData + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure.SymmetricSquarefreeUnitData + +open scoped TensorProduct + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + {M : D.MultidegreeStructure bound} {p q r : ℝ} {η : L →ₗ[ℚ] ℚ} + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [T2Space (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + +noncomputable def mono (U : M.SymmetricSquarefreeUnitData p η q) (hqr : q ≤ r) : + M.SymmetricSquarefreeUnitData p η r := { + U with + complexity := U.complexity.mono _ hqr + observable := U.observable.mono hqr + dimension := U.dimension.trans (Real.exp_le_exp.mpr hqr) } + +theorem mono_eval (U : M.SymmetricSquarefreeUnitData p η q) (hqr : q ≤ r) + (g : M.filtration.realification.PolynomialOrbit) + (k : SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) (Fin U.coordinateCount)) + (x : ReplicatedIndex bound → ℤ) : (U.mono hqr).eval g k x = U.eval g k x := rfl + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure.SymmetricSquarefreeUnitData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TaggedZModOrderBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TaggedZModOrderBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf68bb676f358845df606a68b4bd198d9000ff4f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TaggedZModOrderBounds.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Fourier.FiniteCharacterOrderTail + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def taggedIntegerResidue {Tag : Type*} (J : Tag → Type*) (N : ℕ) : + ((Sigma J) → ℤ) →+ (∀ h : Tag, J h → ZMod N) where + toFun x h j := (x ⟨h, j⟩ : ZMod N) + map_zero' := by ext h j; simp + map_add' := by intro x y; ext h j; simp + +theorem taggedIntegerResidue_surjective {Tag : Type*} (J : Tag → Type*) (N : ℕ) : + Function.Surjective (taggedIntegerResidue J N) := by + intro y + choose x hx using fun s : Sigma J => ZMod.intCast_surjective (y s.1 s.2) + exact ⟨x, funext fun h => funext fun j => hx ⟨h, j⟩⟩ + +variable {Tag X : Type*} [Fintype Tag] [Fintype X] + (J : Tag → Type*) [∀ h, Fintype (J h)] (N : ℕ) [NeZero N] + +theorem taggedZMod_boundedOrder_card_le (T : ℕ) : + (Finset.univ.filter + (fun χ : AddChar (∀ h : Tag, J h → ZMod N) ℂ => orderOf χ ≤ T)).card ≤ + T ^ (Fintype.card (Sigma J) + 1) := + finiteCharacter_boundedOrder_card_le (taggedIntegerResidue J N) + (taggedIntegerResidue_surjective J N) T + +theorem taggedZModImage_boundedOrder_coefficient_mass (p : FiniteProbabilityWeights X) + (Y : X → ∀ h : Tag, J h → ZMod N) (T : ℕ) : + (∑ χ ∈ Finset.univ.filter + (fun χ : AddChar (∀ h : Tag, J h → ZMod N) ℂ => orderOf χ ≤ T), + ‖finiteImageCharacteristic p Y χ‖) ≤ (T : ℝ) ^ (Fintype.card (Sigma J) + 1) := + finiteImage_boundedOrder_coefficient_mass (taggedIntegerResidue J N) + (taggedIntegerResidue_surjective J N) p Y T + +theorem taggedZModImage_order_bounds (p : FiniteProbabilityWeights X) + (Y : X → ∀ h : Tag, J h → ZMod N) + {C P : ℝ} (hC : 0 ≤ C) (hP : ((Fintype.card (Sigma J) + 2 : ℕ) : ℝ) ≤ P) + (hdecay : ∀ χ : AddChar (∀ h : Tag, J h → ZMod N) ℂ, + ‖finiteImageCharacteristic p Y χ‖ ≤ C * (orderOf χ : ℝ) ^ (-P)) + (T : ℕ) (hT : 0 < T) : + let S := Finset.univ.filter + (fun χ : AddChar (∀ h : Tag, J h → ZMod N) ℂ => orderOf χ ≤ T) + (∀ z, (Fintype.card (∀ h : Tag, J h → ZMod N) : ℝ) * finiteImageMass p Y z ≤ 1 + C) ∧ + S.card ≤ T ^ (Fintype.card (Sigma J) + 1) ∧ + (∑ χ ∈ S, ‖finiteImageCharacteristic p Y χ‖) ≤ + (T : ℝ) ^ (Fintype.card (Sigma J) + 1) ∧ + ∀ z, ‖(Fintype.card (∀ h : Tag, J h → ZMod N) : ℂ) * finiteImageMass p Y z - + ∑ χ ∈ S, finiteImageCharacteristic p Y χ * star (χ z)‖ ≤ C / T := by + have hd := finiteCharacter_integer_decay_of_rpow (I := Sigma J) hC hP _ hdecay + let π := taggedIntegerResidue J N + have hπ : Function.Surjective π := taggedIntegerResidue_surjective J N + exact ⟨fun z => finiteImage_density_bound_of_order_decay π hπ p Y hC hd z, + finiteCharacter_boundedOrder_card_le π hπ T, + finiteImage_boundedOrder_coefficient_mass π hπ p Y T, + fun z => finiteImage_density_order_truncation π hπ p Y hC hd T hT z⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TailReflectionInduction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TailReflectionInduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..23855f0777479f7d0b620c9263bb99a1c7397457 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TailReflectionInduction.lean @@ -0,0 +1,559 @@ +import OAI.Combinatorics.Progressions.Geometry.BoxCornerMean + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_family_reflected_correlation + {T G : Type*} [Fintype T] [Nonempty T] [AddCommGroup G] [Fintype G] + (F : T → G → G → ℂ) (b₁ b₂ b₃ : T → G → ℂ) + (hb₁ : ∀ t x, ‖b₁ t x‖ ≤ 1) (hb₂ : ∀ t y, ‖b₂ t y‖ ≤ 1) + (hb₃ : ∀ t z, ‖b₃ t z‖ ≤ 1) : + ∃ (z : G) (b : T → G → ℂ), (∀ t y, ‖b t y‖ ≤ 1) ∧ + ‖𝔼 t, 𝔼 x, 𝔼 y, F t y x * b₁ t x * b₂ t y * b₃ t (x + y)‖ ^ 2 ≤ + (𝔼 t, 𝔼 y, 𝔼 y', F t y (z - y - y') * star (F t y' (z - y - y')) * + b t y * star (b t y')).re := by + let B (z : G) (t : T) (y : G) := b₂ t y * star (b₃ t (z - y)) + let v (y : G) (u : T × G) := F u.1 y u.2 * b₂ u.1 y * b₃ u.1 (u.2 + y) + have hleft : (𝔼 u : T × G, b₁ u.1 u.2 * (𝔼 y, v y u)) = + 𝔼 t, 𝔼 x, 𝔼 y, F t y x * b₁ t x * b₂ t y * b₃ t (x + y) := by + simp_rw [expect_prod_split, Finset.mul_expect] + apply Finset.expect_congr rfl + intro t _ + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro y _ + dsimp only [v] + ring + have hchange (t : T) : (𝔼 y, 𝔼 y', 𝔼 x, + v y (t, x) * star (v y' (t, x))) = + 𝔼 z, 𝔼 y, 𝔼 y', F t y (z - y - y') * star (F t y' (z - y - y')) * + B z t y * star (B z t y') := by + calc + _ = 𝔼 y, 𝔼 y', 𝔼 z, F t y (z - y - y') * star (F t y' (z - y - y')) * + B z t y * star (B z t y') := by + apply Finset.expect_congr rfl + intro y _ + apply Finset.expect_congr rfl + intro y' _ + apply Fintype.expect_equiv (Equiv.addRight (y + y')) + intro x + have h₁ : x + (y + y') - y = x + y' := by abel + have h₂ : x + (y + y') - y' = x + y := by abel + simp only [Equiv.coe_addRight, v, B, h₁, h₂, add_sub_cancel_right, + star_mul, star_star] + ring + _ = 𝔼 y, 𝔼 z, 𝔼 y', F t y (z - y - y') * star (F t y' (z - y - y')) * + B z t y * star (B z t y') := by + apply Finset.expect_congr rfl + intro y _ + exact Finset.expect_comm _ _ _ + _ = _ := Finset.expect_comm _ _ _ + have hright : (𝔼 y, 𝔼 y', 𝔼 u : T × G, v y u * star (v y' u)) = + 𝔼 z, 𝔼 t, 𝔼 y, 𝔼 y', F t y (z - y - y') * star (F t y' (z - y - y')) * + B z t y * star (B z t y') := by + simp_rw [expect_prod_split] + calc + _ = 𝔼 y, 𝔼 t, 𝔼 y', 𝔼 x, v y (t, x) * star (v y' (t, x)) := by + apply Finset.expect_congr rfl + intro y _ + exact Finset.expect_comm _ _ _ + _ = 𝔼 t, 𝔼 y, 𝔼 y', 𝔼 x, v y (t, x) * star (v y' (t, x)) := + Finset.expect_comm _ _ _ + _ = _ := by simp_rw [hchange]; exact Finset.expect_comm _ _ _ + have hcs := finite_family_cauchy_schwarz_re (fun u : T × G => b₁ u.1 u.2) + v (fun u => hb₁ u.1 u.2) + simp only [one_pow, one_mul, hleft, hright] at hcs + rw [expect_re, Fintype.expect_eq_sum_div_card (fun z : G => + (𝔼 t, 𝔼 y, 𝔼 y', F t y (z - y - y') * star (F t y' (z - y - y')) * + B z t y * star (B z t y')).re)] at hcs + have hcard : (0 : ℝ) < Fintype.card G := by exact_mod_cast Fintype.card_pos + have hsum : (∑ _z : G, + ‖𝔼 t, 𝔼 x, 𝔼 y, F t y x * b₁ t x * b₂ t y * b₃ t (x + y)‖ ^ 2) ≤ + ∑ z : G, (𝔼 t, 𝔼 y, 𝔼 y', F t y (z - y - y') * star (F t y' (z - y - y')) * + B z t y * star (B z t y')).re := by + simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_comm] using + (le_div_iff₀ hcard).mp hcs + obtain ⟨z, _, hz⟩ := Finset.exists_le_of_sum_le Finset.univ_nonempty hsum + refine ⟨z, B z, ?_, hz⟩ + intro t y + simp only [B, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hb₂ t y)).trans (hb₃ t _) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_cubic_reflected_correlation {G : Type*} [AddCommGroup G] [Fintype G] + (K : G → G → G → ℂ) (f : G → ℂ) (A B D : G → G → ℂ) + (hf : ∀ x, ‖f x‖ ≤ 1) (hA : ∀ h n, ‖A h n‖ ≤ 1) + (hB : ∀ n k, ‖B n k‖ ≤ 1) (hD : ∀ h k, ‖D h k‖ ≤ 1) : + ∃ (z : G) (b : (G × G) → G → ℂ), (∀ t h, ‖b t h‖ ≤ 1) ∧ + ‖𝔼 k, 𝔼 h, 𝔼 n, f (n + h + k) * K h n k * A h n * B n k * D h k‖ ^ 4 ≤ + (𝔼 t : G × G, 𝔼 h, 𝔼 h', + (K h (z - h - h') t.1 * star (K h (z - h - h') t.2)) * + star (K h' (z - h - h') t.1 * star (K h' (z - h - h') t.2)) * + b t h * star (b t h')).re := by + let v (k : G) (u : G × G) := + f (u.2 + u.1 + k) * K u.1 u.2 k * B u.2 k * D u.1 k + let F (t : G × G) (h n : G) := K h n t.1 * star (K h n t.2) + let b₁ (t : G × G) (n : G) := B n t.1 * star (B n t.2) + let b₂ (t : G × G) (h : G) := D h t.1 * star (D h t.2) + let b₃ (t : G × G) (w : G) := f (w + t.1) * star (f (w + t.2)) + let m := 𝔼 t, 𝔼 n, 𝔼 h, F t h n * b₁ t n * b₂ t h * b₃ t (n + h) + have hleft : (𝔼 u : G × G, A u.1 u.2 * (𝔼 k, v k u)) = + 𝔼 k, 𝔼 h, 𝔼 n, f (n + h + k) * K h n k * A h n * B n k * D h k := by + simp_rw [Finset.mul_expect] + rw [Finset.expect_comm] + simp_rw [expect_prod_split] + apply Finset.expect_congr rfl + intro k _ + apply Finset.expect_congr rfl + intro h _ + apply Finset.expect_congr rfl + intro n _ + dsimp only [v] + ring + have hright : (𝔼 k, 𝔼 k', 𝔼 u : G × G, v k u * star (v k' u)) = m := by + dsimp only [m] + simp_rw [expect_prod_split] + apply Finset.expect_congr rfl + intro k _ + apply Finset.expect_congr rfl + intro k' _ + rw [Finset.expect_comm] + apply Finset.expect_congr rfl + intro n _ + apply Finset.expect_congr rfl + intro h _ + simp only [v, F, b₁, b₂, b₃, star_mul] + ring + have hfirst := finite_family_cauchy_schwarz_re (fun u : G × G => A u.1 u.2) + v (fun u => hA u.1 u.2) + simp only [hleft, hright, one_pow, one_mul] at hfirst + obtain ⟨z, b, hb, hsecond⟩ := exists_family_reflected_correlation F b₁ b₂ b₃ + (fun t n => by + simp only [b₁, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hB n _)).trans (hB n _)) + (fun t h => by + simp only [b₂, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hD h _)).trans (hD h _)) + (fun t w => by + simp only [b₃, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hf _)).trans (hf _)) + refine ⟨z, b, hb, ?_⟩ + calc + _ = (‖𝔼 k, 𝔼 h, 𝔼 n, + f (n + h + k) * K h n k * A h n * B n k * D h k‖ ^ 2) ^ 2 := by ring + _ ≤ ‖m‖ ^ 2 := pow_le_pow_left₀ (sq_nonneg _) (hfirst.trans (Complex.re_le_norm m)) 2 + _ ≤ _ := hsecond + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_family_cubic_reflected_correlation + {T G : Type*} [Fintype T] [Nonempty T] [AddCommGroup G] [Fintype G] + (K : T → G → G → G → ℂ) (f : T → G → ℂ) (A B D : T → G → G → ℂ) + (hf : ∀ t x, ‖f t x‖ ≤ 1) (hA : ∀ t h n, ‖A t h n‖ ≤ 1) + (hB : ∀ t n k, ‖B t n k‖ ≤ 1) (hD : ∀ t h k, ‖D t h k‖ ≤ 1) : + ∃ (z : G) (b : (T × (G × G)) → G → ℂ), (∀ t h, ‖b t h‖ ≤ 1) ∧ + ‖𝔼 t, 𝔼 k, 𝔼 h, 𝔼 n, + f t (n + h + k) * K t h n k * A t h n * B t n k * D t h k‖ ^ 4 ≤ + (𝔼 t : T × (G × G), 𝔼 h, 𝔼 h', + (K t.1 h (z - h - h') t.2.1 * star (K t.1 h (z - h - h') t.2.2)) * + star (K t.1 h' (z - h - h') t.2.1 * star (K t.1 h' (z - h - h') t.2.2)) * + b t h * star (b t h')).re := by + let v (k : G) (u : T × (G × G)) := + f u.1 (u.2.2 + u.2.1 + k) * K u.1 u.2.1 u.2.2 k * B u.1 u.2.2 k * D u.1 u.2.1 k + let F (t : T × (G × G)) (h n : G) := K t.1 h n t.2.1 * star (K t.1 h n t.2.2) + let b₁ (t : T × (G × G)) (n : G) := B t.1 n t.2.1 * star (B t.1 n t.2.2) + let b₂ (t : T × (G × G)) (h : G) := D t.1 h t.2.1 * star (D t.1 h t.2.2) + let b₃ (t : T × (G × G)) (w : G) := f t.1 (w + t.2.1) * star (f t.1 (w + t.2.2)) + let m := 𝔼 t, 𝔼 n, 𝔼 h, F t h n * b₁ t n * b₂ t h * b₃ t (n + h) + have hleft : (𝔼 u : T × (G × G), A u.1 u.2.1 u.2.2 * (𝔼 k, v k u)) = + 𝔼 t, 𝔼 k, 𝔼 h, 𝔼 n, + f t (n + h + k) * K t h n k * A t h n * B t n k * D t h k := by + simp_rw [Finset.mul_expect, expect_prod_split] + apply Finset.expect_congr rfl + intro t _ + calc + _ = 𝔼 h, 𝔼 k, 𝔼 n, A t h n * v k (t, h, n) := by + apply Finset.expect_congr rfl + intro h _ + exact Finset.expect_comm _ _ _ + _ = 𝔼 k, 𝔼 h, 𝔼 n, A t h n * v k (t, h, n) := Finset.expect_comm _ _ _ + _ = _ := by + apply Finset.expect_congr rfl + intro k _ + apply Finset.expect_congr rfl + intro h _ + apply Finset.expect_congr rfl + intro n _ + dsimp only [v] + ring + have hright : (𝔼 k, 𝔼 k', 𝔼 u : T × (G × G), v k u * star (v k' u)) = m := by + dsimp only [m] + simp_rw [expect_prod_split] + calc + _ = 𝔼 k, 𝔼 t, 𝔼 k', 𝔼 h, 𝔼 n, v k (t, h, n) * star (v k' (t, h, n)) := by + apply Finset.expect_congr rfl + intro k _ + exact Finset.expect_comm _ _ _ + _ = 𝔼 t, 𝔼 k, 𝔼 k', 𝔼 h, 𝔼 n, v k (t, h, n) * star (v k' (t, h, n)) := + Finset.expect_comm _ _ _ + _ = _ := by + apply Finset.expect_congr rfl + intro t _ + apply Finset.expect_congr rfl + intro k _ + apply Finset.expect_congr rfl + intro k' _ + rw [Finset.expect_comm] + apply Finset.expect_congr rfl + intro n _ + apply Finset.expect_congr rfl + intro h _ + simp only [v, F, b₁, b₂, b₃, star_mul] + ring + have hfirst := finite_family_cauchy_schwarz_re + (fun u : T × (G × G) => A u.1 u.2.1 u.2.2) v (fun u => hA u.1 u.2.1 u.2.2) + simp only [hleft, hright, one_pow, one_mul] at hfirst + obtain ⟨z, b, hb, hsecond⟩ := exists_family_reflected_correlation F b₁ b₂ b₃ + (fun t n => by + simp only [b₁, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hB _ _ _)).trans (hB _ _ _)) + (fun t h => by + simp only [b₂, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hD _ _ _)).trans (hD _ _ _)) + (fun t w => by + simp only [b₃, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hf _ _)).trans (hf _ _)) + refine ⟨z, b, hb, ?_⟩ + calc + _ = (‖𝔼 t, 𝔼 k, 𝔼 h, 𝔼 n, + f t (n + h + k) * K t h n k * A t h n * B t n k * D t h k‖ ^ 2) ^ 2 := by ring + _ ≤ ‖m‖ ^ 2 := pow_le_pow_left₀ (sq_nonneg _) (hfirst.trans (Complex.re_le_norm m)) 2 + _ ≤ _ := hsecond + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def quarticReflectionKernel {G : Type*} (K : G → G → G → G → ℂ) + (t : (G × G) × (G × G)) (h n : G) : ℂ := + (K h n t.2.1 t.1.1 * star (K h n t.2.1 t.1.2)) * + star (K h n t.2.2 t.1.1 * star (K h n t.2.2 t.1.2)) + +theorem exists_quartic_reflected_correlation {G : Type*} [AddCommGroup G] [Fintype G] + (K : G → G → G → G → ℂ) (f : G → ℂ) (A₀ A₁ A₂ A₃ : G → G → G → ℂ) + (hf : ∀ x, ‖f x‖ ≤ 1) (hA₀ : ∀ n k l, ‖A₀ n k l‖ ≤ 1) + (hA₁ : ∀ h k l, ‖A₁ h k l‖ ≤ 1) (hA₂ : ∀ h n l, ‖A₂ h n l‖ ≤ 1) + (hA₃ : ∀ h n k, ‖A₃ h n k‖ ≤ 1) : + ∃ (z : G) (b : ((G × G) × (G × G)) → G → ℂ), (∀ t h, ‖b t h‖ ≤ 1) ∧ + ‖𝔼 l, 𝔼 k, 𝔼 h, 𝔼 n, + f (n + h + k + l) * K h n k l * A₀ n k l * A₁ h k l * A₂ h n l * A₃ h n k‖ ^ 8 ≤ + (𝔼 t : (G × G) × (G × G), 𝔼 h, 𝔼 h', + quarticReflectionKernel K t h (z - h - h') * + star (quarticReflectionKernel K t h' (z - h - h')) * b t h * star (b t h')).re := by + let v (l : G) (u : G × (G × G)) := + f (u.2.2 + u.2.1 + u.1 + l) * K u.2.1 u.2.2 u.1 l * + A₀ u.2.2 u.1 l * A₁ u.2.1 u.1 l * A₂ u.2.1 u.2.2 l + let K' (t : G × G) (h n k : G) := K h n k t.1 * star (K h n k t.2) + let f' (t : G × G) (w : G) := f (w + t.1) * star (f (w + t.2)) + let A (t : G × G) (h n : G) := A₂ h n t.1 * star (A₂ h n t.2) + let B (t : G × G) (n k : G) := A₀ n k t.1 * star (A₀ n k t.2) + let D (t : G × G) (h k : G) := A₁ h k t.1 * star (A₁ h k t.2) + let m := 𝔼 t, 𝔼 k, 𝔼 h, 𝔼 n, + f' t (n + h + k) * K' t h n k * A t h n * B t n k * D t h k + have hleft : (𝔼 u : G × (G × G), A₃ u.2.1 u.2.2 u.1 * (𝔼 l, v l u)) = + 𝔼 l, 𝔼 k, 𝔼 h, 𝔼 n, + f (n + h + k + l) * K h n k l * A₀ n k l * A₁ h k l * A₂ h n l * A₃ h n k := by + simp_rw [Finset.mul_expect] + rw [Finset.expect_comm] + simp_rw [expect_prod_split] + apply Finset.expect_congr rfl + intro l _ + apply Finset.expect_congr rfl + intro k _ + apply Finset.expect_congr rfl + intro h _ + apply Finset.expect_congr rfl + intro n _ + dsimp only [v] + ring + have hright : (𝔼 l, 𝔼 l', 𝔼 u : G × (G × G), v l u * star (v l' u)) = m := by + dsimp only [m] + simp_rw [expect_prod_split] + apply Finset.expect_congr rfl + intro l _ + apply Finset.expect_congr rfl + intro l' _ + apply Finset.expect_congr rfl + intro k _ + apply Finset.expect_congr rfl + intro h _ + apply Finset.expect_congr rfl + intro n _ + simp only [v, K', f', A, B, D, star_mul] + ring + have hfirst := finite_family_cauchy_schwarz_re + (fun u : G × (G × G) => A₃ u.2.1 u.2.2 u.1) v (fun u => hA₃ u.2.1 u.2.2 u.1) + simp only [hleft, hright, one_pow, one_mul] at hfirst + obtain ⟨z, b, hb, hsecond⟩ := exists_family_cubic_reflected_correlation K' f' A B D + (fun t w => by + simp only [f', norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hf _)).trans (hf _)) + (fun t h n => by + simp only [A, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hA₂ _ _ _)).trans (hA₂ _ _ _)) + (fun t n k => by + simp only [B, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hA₀ _ _ _)).trans (hA₀ _ _ _)) + (fun t h k => by + simp only [D, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hA₁ _ _ _)).trans (hA₁ _ _ _)) + refine ⟨z, b, hb, ?_⟩ + calc + _ = (‖𝔼 l, 𝔼 k, 𝔼 h, 𝔼 n, + f (n + h + k + l) * K h n k l * A₀ n k l * A₁ h k l * A₂ h n l * A₃ h n k‖ ^ 2) ^ 4 := by ring + _ ≤ ‖m‖ ^ 4 := pow_le_pow_left₀ (sq_nonneg _) (hfirst.trans (Complex.re_le_norm m)) 4 + _ ≤ _ := hsecond + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +structure TailReflectionData (n : ℕ) (T G : Type*) where + kernel : T → G → G → (Fin n → G) → ℂ + signal : T → G → ℂ + leftWeight : T → G → (Fin n → G) → ℂ + rightWeight : T → G → (Fin n → G) → ℂ + tailWeight : T → Fin n → G → G → (Fin n → G) → ℂ + signal_norm : ∀ t x, ‖signal t x‖ ≤ 1 + left_norm : ∀ t x v, ‖leftWeight t x v‖ ≤ 1 + right_norm : ∀ t x v, ‖rightWeight t x v‖ ≤ 1 + tail_norm : ∀ t i h m v, ‖tailWeight t i h m v‖ ≤ 1 + tail_misses : ∀ t i h m, MissesBoxCoordinate (tailWeight t i h m) i + +namespace TailReflectionData + +noncomputable def correlation {n : ℕ} {T G : Type*} [Fintype T] + [AddCommGroup G] [Fintype G] (D : TailReflectionData n T G) : ℂ := + 𝔼 t, 𝔼 v : Fin n → G, 𝔼 m, 𝔼 h, + D.signal t (m + h + ∑ i, v i) * D.kernel t h m v * + D.leftWeight t m v * D.rightWeight t h v * ∏ i, D.tailWeight t i h m v + +noncomputable def pair {n : ℕ} {T G : Type*} [AddCommGroup G] + (D : TailReflectionData (n + 1) T G) : TailReflectionData n (T × (G × G)) G where + kernel t h m v := D.kernel t.1 h m (Fin.cons t.2.1 v) * + star (D.kernel t.1 h m (Fin.cons t.2.2 v)) + signal t w := D.signal t.1 (w + t.2.1) * star (D.signal t.1 (w + t.2.2)) + leftWeight t m v := D.leftWeight t.1 m (Fin.cons t.2.1 v) * + star (D.leftWeight t.1 m (Fin.cons t.2.2 v)) + rightWeight t h v := D.rightWeight t.1 h (Fin.cons t.2.1 v) * + star (D.rightWeight t.1 h (Fin.cons t.2.2 v)) + tailWeight t i h m v := boxTailTests (fun j => D.tailWeight t.1 j h m) t.2.1 t.2.2 i v + signal_norm t w := by + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (D.signal_norm _ _)).trans (D.signal_norm _ _) + left_norm t m v := by + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (D.left_norm _ _ _)).trans (D.left_norm _ _ _) + right_norm t h v := by + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (D.right_norm _ _ _)).trans (D.right_norm _ _ _) + tail_norm t i h m v := boxTailTests_norm (fun j => D.tailWeight t.1 j h m) + (fun j x => D.tail_norm t.1 j h m x) t.2.1 t.2.2 i v + tail_misses t i h m := boxTailTests_misses (fun j => D.tailWeight t.1 j h m) + (fun j => D.tail_misses t.1 j h m) t.2.1 t.2.2 i + +noncomputable def reflectedKernel {n : ℕ} {T G : Type*} (D : TailReflectionData n T G) + (t : T) (u v : Fin n → G) (h m : G) : ℂ := + iteratedBoxDifference n (fun x (a : G × G) => D.kernel t a.1 a.2 x) u v (h, m) + +theorem reflectedKernel_cons {n : ℕ} {T G : Type*} [AddCommGroup G] + (D : TailReflectionData (n + 1) T G) (t : T) (a b : G) + (u v : Fin n → G) (h m : G) : + D.reflectedKernel t (Fin.cons a u) (Fin.cons b v) h m = + D.pair.reflectedKernel (t, (a, b)) u v h m := by + simp only [reflectedKernel, iteratedBoxDifference, Fin.cons_zero, Fin.tail_cons, pair] + +end TailReflectionData + +end Erdos3 + +end + +section + +namespace Erdos3.TailReflectionData + +open scoped BigOperators Classical + +theorem correlation_square_le_pair {n : ℕ} {T G : Type*} [Fintype T] [Nonempty T] + [AddCommGroup G] [Fintype G] (D : TailReflectionData (n + 1) T G) : + ‖D.correlation‖ ^ 2 ≤ D.pair.correlation.re := by + let C (q : T × ((Fin n → G) × (G × G))) : ℂ := + D.tailWeight q.1 0 q.2.2.2 q.2.2.1 (Fin.cons 0 q.2.1) + let V (a : G) (q : T × ((Fin n → G) × (G × G))) : ℂ := + D.signal q.1 (q.2.2.1 + q.2.2.2 + ∑ i, (Fin.cons a q.2.1) i) * + D.kernel q.1 q.2.2.2 q.2.2.1 (Fin.cons a q.2.1) * + D.leftWeight q.1 q.2.2.1 (Fin.cons a q.2.1) * + D.rightWeight q.1 q.2.2.2 (Fin.cons a q.2.1) * + ∏ i : Fin n, D.tailWeight q.1 i.succ q.2.2.2 q.2.2.1 (Fin.cons a q.2.1) + have hleft : (𝔼 q, C q * (𝔼 a, V a q)) = D.correlation := by + unfold correlation + simp_rw [expect_dependent_fin_cons, Finset.mul_expect] + rw [Finset.expect_comm] + simp_rw [expect_prod_split] + rw [Finset.expect_comm] + apply Finset.expect_congr rfl + intro t _ + apply Finset.expect_congr rfl + intro a _ + apply Finset.expect_congr rfl + intro v _ + apply Finset.expect_congr rfl + intro m _ + apply Finset.expect_congr rfl + intro h _ + dsimp only [C, V] + rw [Fin.prod_univ_succ, + missesBoxCoordinate_head (D.tail_misses t 0 h m) a 0 v] + ring + have hright : (𝔼 a, 𝔼 b, 𝔼 q, V a q * star (V b q)) = D.pair.correlation := by + unfold correlation + simp_rw [expect_prod_split] + calc + _ = 𝔼 a, 𝔼 t, 𝔼 b, 𝔼 v : Fin n → G, 𝔼 m, 𝔼 h, + V a (t, (v, (m, h))) * star (V b (t, (v, (m, h)))) := by + apply Finset.expect_congr rfl + intro a _ + exact Finset.expect_comm _ _ _ + _ = 𝔼 t, 𝔼 a, 𝔼 b, 𝔼 v : Fin n → G, 𝔼 m, 𝔼 h, + V a (t, (v, (m, h))) * star (V b (t, (v, (m, h)))) := + Finset.expect_comm _ _ _ + _ = _ := by + apply Finset.expect_congr rfl + intro t _ + apply Finset.expect_congr rfl + intro a _ + apply Finset.expect_congr rfl + intro b _ + apply Finset.expect_congr rfl + intro v _ + apply Finset.expect_congr rfl + intro m _ + apply Finset.expect_congr rfl + intro h _ + dsimp only [V, pair] + simp only [Fin.sum_univ_succ, Fin.cons_zero, Fin.cons_succ, boxTailTests, + star_mul, star_prod, Finset.prod_mul_distrib] + have ha : m + h + (a + ∑ i, v i) = (m + h + ∑ i, v i) + a := by abel + have hb : m + h + (b + ∑ i, v i) = (m + h + ∑ i, v i) + b := by abel + rw [ha, hb] + ring + have hcs := finite_family_cauchy_schwarz_re C V + (fun q => D.tail_norm q.1 0 q.2.2.2 q.2.2.1 (Fin.cons 0 q.2.1)) + simpa only [hleft, hright, one_pow, one_mul] using hcs + +end Erdos3.TailReflectionData + +end + +section + +namespace Erdos3.TailReflectionData + +open scoped BigOperators Classical + +universe u + +theorem exists_reflected_correlation (n : ℕ) : + ∀ {T G : Type u} [Fintype T] [Nonempty T] [AddCommGroup G] [Fintype G] + (D : TailReflectionData n T G), + ∃ (z : G) (b : T → (Fin n → G) → (Fin n → G) → G → ℂ), + (∀ t u v h, ‖b t u v h‖ ≤ 1) ∧ + ‖D.correlation‖ ^ (2 ^ (n + 1)) ≤ + (𝔼 t, 𝔼 u : Fin n → G, 𝔼 v : Fin n → G, 𝔼 h, 𝔼 h', + D.reflectedKernel t u v h (z - h - h') * + star (D.reflectedKernel t u v h' (z - h - h')) * + b t u v h * star (b t u v h')).re := by + induction n with + | zero => + intro T G _ _ _ _ D + let e : Fin 0 → G := fun i => Fin.elim0 i + obtain ⟨z, b, hb, hcorr⟩ := exists_family_reflected_correlation + (fun t h m => D.kernel t h m e) + (fun t m => D.leftWeight t m e) (fun t h => D.rightWeight t h e) D.signal + (fun t m => D.left_norm t m e) (fun t h => D.right_norm t h e) D.signal_norm + refine ⟨z, (fun t _ _ h => b t h), (fun t _ _ h => hb t h), ?_⟩ + simpa only [correlation, reflectedKernel, iteratedBoxDifference, expect_empty_tuple, + Fin.sum_univ_zero, Fin.prod_univ_zero, add_zero, mul_one, one_mul, Nat.zero_add, pow_one, + e, mul_comm, mul_left_comm, mul_assoc] using hcorr + | succ n ih => + intro T G _ _ _ _ D + obtain ⟨z, b, hb, hcorr⟩ := ih D.pair + let B (t : T) (u v : Fin (n + 1) → G) (h : G) := + b (t, (u 0, v 0)) (Fin.tail u) (Fin.tail v) h + refine ⟨z, B, (fun t u v h => hb _ _ _ _), ?_⟩ + have hmean : + (𝔼 t, 𝔼 u : Fin (n + 1) → G, 𝔼 v : Fin (n + 1) → G, 𝔼 h, 𝔼 h', + D.reflectedKernel t u v h (z - h - h') * + star (D.reflectedKernel t u v h' (z - h - h')) * + B t u v h * star (B t u v h')) = + 𝔼 t : T × (G × G), 𝔼 u : Fin n → G, 𝔼 v : Fin n → G, 𝔼 h, 𝔼 h', + D.pair.reflectedKernel t u v h (z - h - h') * + star (D.pair.reflectedKernel t u v h' (z - h - h')) * + b t u v h * star (b t u v h') := by + simp_rw [expect_prod_split] + apply Finset.expect_congr rfl + intro t _ + rw [expect_two_dependent_fin_cons] + simp only [B, Fin.cons_zero, Fin.tail_cons, reflectedKernel_cons] + rw [hmean] + calc + _ = (‖D.correlation‖ ^ 2) ^ (2 ^ (n + 1)) := by + rw [← pow_mul, pow_succ] + congr 1 + omega + _ ≤ ‖D.pair.correlation‖ ^ (2 ^ (n + 1)) := + pow_le_pow_left₀ (sq_nonneg _) + (D.correlation_square_le_pair.trans (Complex.re_le_norm _)) _ + _ ≤ _ := hcorr + +end Erdos3.TailReflectionData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TangentModelVector.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TangentModelVector.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7a4e2a435d31a321279b85c8d68f129a1476035 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TangentModelVector.lean @@ -0,0 +1,19 @@ +import Mathlib.Geometry.Manifold.MFDeriv.FDeriv + +namespace OAI + +section + +namespace Erdos3 + +open scoped Manifold + +def tangentModelVector {E H M : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [TopologicalSpace H] {I : ModelWithCorners ℝ E H} + [TopologicalSpace M] [ChartedSpace H M] {x : M} (v : TangentSpace I x) : E := v + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TemperaturePrimitiveNormal.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TemperaturePrimitiveNormal.lean new file mode 100644 index 0000000000000000000000000000000000000000..86d0a21d3899d885c119e4bc9b8e9be85e589696 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TemperaturePrimitiveNormal.lean @@ -0,0 +1,65 @@ +import OAI.Combinatorics.Progressions.Fourier.LatticeGaussianMeanFourier + +namespace OAI + +section + +namespace Erdos3 + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +theorem dualLattice_sqrt_temperature_le (Λ : Submodule ℤ E) [DiscreteTopology Λ] + [IsZLattice ℝ Λ] (ζ : E) (hζ : ζ ≠ 0) (hζdual : ζ ∈ euclideanDualLattice Λ) + {t : ℝ} (ht : 0 < t) : + Real.sqrt t ≤ ‖ζ‖ * (Real.exp Real.pi * normalizedLatticeGaussian Λ t 0) := by + have h := latticeGaussianMass_mul_scaled_norm_ge (euclideanDualLattice Λ) + ζ hζdual hζ (inv_pos.mpr ht) + rw [← normalizedLatticeGaussian_zero_eq_dual Λ ht, Real.sqrt_inv] at h + have hs : 0 < Real.sqrt t := Real.sqrt_pos.mpr ht + have hmul := mul_le_mul_of_nonneg_left h hs.le + have hid : Real.sqrt t * + (Real.sqrt t⁻¹ * ‖ζ‖ * normalizedLatticeGaussian Λ t 0) = + ‖ζ‖ * normalizedLatticeGaussian Λ t 0 := by + rw [Real.sqrt_inv] + field_simp + rw [Real.sqrt_inv] at hid + rw [hid] at hmul + have hh := mul_le_mul_of_nonneg_left hmul (Real.exp_pos Real.pi).le + have he : Real.exp Real.pi * Real.exp (-Real.pi) = 1 := by + rw [← Real.exp_add, add_neg_cancel, Real.exp_zero] + calc + _ = Real.exp Real.pi * (Real.sqrt t * Real.exp (-Real.pi)) := by rw [mul_left_comm, he, mul_one] + _ ≤ Real.exp Real.pi * (‖ζ‖ * normalizedLatticeGaussian Λ t 0) := hh + _ = _ := by ring + +theorem exists_temperature_bounded_primitive_normal + (Λ : Submodule ℤ E) [DiscreteTopology Λ] [IsZLattice ℝ Λ] + (ξ : E) (hξ : ξ ≠ 0) (hξdual : ξ ∈ euclideanDualLattice Λ) + {t L : ℝ} (ht : 0 < t) (hL : 0 ≤ L) (hnorm : ‖ξ‖ ≤ Real.sqrt t * L) : + ∃ (m : ℤ) (ζ w : E), m ≠ 0 ∧ ξ = (m : ℝ) • ζ ∧ ζ ≠ 0 ∧ + ‖ζ‖ ≤ Real.sqrt t * L ∧ ζ ∈ euclideanDualLattice Λ ∧ + w ∈ Λ ∧ inner ℝ ζ w = 1 ∧ + Real.sqrt t ≤ ‖ζ‖ * (Real.exp Real.pi * normalizedLatticeGaussian Λ t 0) ∧ + |(m : ℝ)| ≤ L * (Real.exp Real.pi * normalizedLatticeGaussian Λ t 0) := by + obtain ⟨m, ζ, w, hm, hsplit, hζ, hζnorm, hint, hwΛ, hw⟩ := + exists_primitive_lattice_normal Λ (IsZLattice.span_top (K := ℝ)) ξ hξ + ((mem_euclideanDualLattice Λ ξ).mp hξdual) + have hζdual := (mem_euclideanDualLattice Λ ζ).mpr hint + have hs := dualLattice_sqrt_temperature_le Λ ζ hζ hζdual ht + refine ⟨m, ζ, w, hm, hsplit, hζ, hζnorm.trans hnorm, hζdual, hwΛ, hw, hs, ?_⟩ + have hbound : |(m : ℝ)| * ‖ζ‖ ≤ + (L * (Real.exp Real.pi * normalizedLatticeGaussian Λ t 0)) * ‖ζ‖ := by + calc + |(m : ℝ)| * ‖ζ‖ = ‖ξ‖ := by rw [hsplit, norm_smul, Real.norm_eq_abs] + _ ≤ Real.sqrt t * L := hnorm + _ ≤ (‖ζ‖ * (Real.exp Real.pi * normalizedLatticeGaussian Λ t 0)) * L := + mul_le_mul_of_nonneg_right hs hL + _ = _ := by ring + nlinarith [norm_pos_iff.mpr hζ] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TensorContraction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TensorContraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fc3ab98dcaee6ddc5797065d7d977e9c7bbeed6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TensorContraction.lean @@ -0,0 +1,47 @@ +import Mathlib.Algebra.Algebra.Bilinear +import Mathlib.RingTheory.TensorProduct.Basic + +namespace OAI + +section + +namespace Erdos3 +open TensorProduct +variable {A : Type*} [Ring A] [Algebra ℚ A] + +noncomputable def tensorContract (S T : A →ₗ[ℚ] A) : A ⊗[ℚ] A →ₗ[ℚ] A := + (LinearMap.mul' ℚ A).comp (TensorProduct.map S T) + +@[simp] theorem tensorContract_tmul (S T : A →ₗ[ℚ] A) (a b : A) : + tensorContract S T (a ⊗ₜ[ℚ] b) = S a * T b := by + simp [tensorContract] + +theorem tensorContract_mul_left (S T : A →ₗ[ℚ] A) + (hS : ∀ a b, S (a * b) = S b * S a) (t : A ⊗[ℚ] A) (a : A) : + tensorContract S T (t * (a ⊗ₜ[ℚ] 1)) = S a * tensorContract S T t := by + induction t using TensorProduct.inductionOn with + | tmul p q => simp [Algebra.TensorProduct.tmul_mul_tmul, hS, mul_assoc] + | add p q hp hq => simp only [add_mul, map_add, hp, hq, mul_add] + +theorem tensorContract_id_mul_right (S : A →ₗ[ℚ] A) (t : A ⊗[ℚ] A) (a : A) : + tensorContract S LinearMap.id (t * (1 ⊗ₜ[ℚ] a)) = + tensorContract S LinearMap.id t * a := by + induction t using TensorProduct.inductionOn with + | tmul p q => simp [Algebra.TensorProduct.tmul_mul_tmul, mul_assoc] + | add p q hp hq => simp only [add_mul, map_add, hp, hq] + +theorem tensorContract_derivation_mul_right (S T : A →ₗ[ℚ] A) + (hT : ∀ a b, T (a * b) = T a * b + a * T b) (t : A ⊗[ℚ] A) (a : A) : + tensorContract S T (t * (1 ⊗ₜ[ℚ] a)) = + tensorContract S T t * a + tensorContract S LinearMap.id t * T a := by + induction t using TensorProduct.inductionOn with + | tmul p q => simp [Algebra.TensorProduct.tmul_mul_tmul, hT, mul_add, mul_assoc] + | add p q hp hq => + simp only [add_mul, map_add, hp, hq] + abel + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TensorSquarePairComparison.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TensorSquarePairComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc95ad27db7e212d4ca801feaba78e2f01b891a4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TensorSquarePairComparison.lean @@ -0,0 +1,512 @@ +import OAI.Combinatorics.Progressions.Estimates.UnitVerticalMeanRowCorrelation +import OAI.Combinatorics.Progressions.Geometry.MixedCoordinateTransfer +import OAI.Combinatorics.Progressions.Lattices.MultidegreeIntegerTranslation + +namespace OAI + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped TensorProduct + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {σ : Type*} [Fintype σ] {bound : σ → ℕ} {p : ℝ} + (W : NativeMultidegreeNilcharacter bound p) + +noncomputable def rationalDilation (r : ℚ) : NativeMultidegreeNilcharacter bound p := + { W with orbit := W.multi.filtration.realification.rationalDilationOrbit r W.orbit } + +theorem rationalDilation_eval_rescaled (r : ℚ) (q : ℤ) (hr : r * (q : ℚ) = 1) + (a : Fin W.outputDim) (x : σ → ℤ) : + (W.rationalDilation r).eval a (fun i => q * x i) = W.eval a x := by + unfold eval rationalDilation + rw [W.multi.filtration.realification.rationalDilationOrbit_rescaled r q hr] + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_quadratic_integer_translation_equivalence : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) (a b : Fin 2 → ℤ), + NativeIntegerVectorEquivalence 1 ((p + C) ^ C) + (fun i x => W.eval i (x + a)) (fun i x => W.eval i (x + b)) := by + obtain ⟨C, hC, htranslate⟩ := + UnitVerticalObservable.exists_integer_translation_equivalence_budget 1 + refine ⟨C, hC, ?_⟩ + intro p W a b + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + have htop : W.multi.realSubgroup (mixedCorrelationDegree 1) = + W.model.filtration.realification.subgroup 2 := by + have hsum : (∑ i, mixedCorrelationDegree 1 i) = 2 := by decide + simpa only [hsum] using W.multi.realSubgroup_top + let V : W.model.UnitVerticalObservable (W.model.filtration.realification.subgroup 2) + (Fin W.outputDim) p := + { W.vertical with + vertical := fun i z hz x => W.vertical.vertical i z (htop.symm ▸ hz) x + integral := fun z hz hL => W.vertical.integral z (htop.symm ▸ hz) hL } + have hdim : (Fintype.card (Fin W.outputDim) : ℝ) ≤ Real.exp p := by + simpa only [Fintype.card_fin] using W.output_bound + have E := htranslate W.model V (W.multi.orbitToOrdinary W.orbit) hp W.complexity.1 hdim a b + refine ⟨E.left_dimension, E.right_dimension, ?_⟩ + intro i j + obtain ⟨F⟩ := E.expansion i j + have heq (k : Fin W.outputDim) (x : Fin 2 → ℤ) : + V.observable k (QuotientGroup.mk (W.model.filtration.realification.polynomialOrbitEval + (fun _ : Fin 2 => 1) x (W.multi.orbitToOrdinary W.orbit))) = W.eval k x := by + rw [W.multi.orbitToOrdinary_eval] + rfl + have hf : (fun x => V.observable i (QuotientGroup.mk + (W.model.filtration.realification.polynomialOrbitEval (fun _ : Fin 2 => 1) + (x + a) (W.multi.orbitToOrdinary W.orbit))) * + star (V.observable j (QuotientGroup.mk + (W.model.filtration.realification.polynomialOrbitEval (fun _ : Fin 2 => 1) + (x + b) (W.multi.orbitToOrdinary W.orbit))))) = + (fun x => W.eval i (x + a) * star (W.eval j (x + b))) := by + funext x + rw [heq, heq] + exact ⟨hf ▸ F⟩ + +theorem half_dilation_integer_representative {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (x : Fin 2 → ℤ) (j : Fin W.outputDim) : + (W.rationalDilation (1 / 2)).eval j (fun i => x i - ((x i : ZMod 2).val : ℤ)) = + W.eval j (fun i => x i / 2) := by + have hx : (fun i => x i - ((x i : ZMod 2).val : ℤ)) = (fun i => 2 * (x i / 2)) := by + funext i + rw [ZMod.val_intCast] + omega + rw [hx] + exact W.rationalDilation_eval_rescaled (1 / 2) 2 (by norm_num) j _ + +theorem exists_half_dilation_equivalence : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p), + NativeIntegerVectorEquivalence 1 ((p + C) ^ C) + (W.rationalDilation (1 / 2)).eval (fun j x => W.eval j (fun i => x i / 2)) := by + obtain ⟨A, _, hshift⟩ := exists_quadratic_integer_translation_equivalence + obtain ⟨B, _, hparity⟩ := exists_pairParityIndicator_expansion + obtain ⟨D, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let T := (X + Polynomial.C A) ^ A + Polynomial.C B + X + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((T + Polynomial.C D) ^ D + T + 2) + refine ⟨C, hC, ?_⟩ + intro p W + classical + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let V := W.rationalDilation (1 / 2) + let t : ℝ := (p + A) ^ A + B + p + 2 + have ha : 0 ≤ (p + A) ^ A := by positivity + have hb : (0 : ℝ) ≤ B := Nat.cast_nonneg _ + have ht : 0 ≤ t := by dsimp [t]; positivity + have hpt : p ≤ t := by dsimp [t]; linarith + have hat : (p + A) ^ A ≤ t := by dsimp [t]; linarith + have hbt : (B : ℝ) ≤ t := by dsimp [t]; linarith + have hbound : (t + D) ^ D + t + 2 ≤ (p + C) ^ C := by + simpa [T, t, X, Polynomial.eval₂_pow] using hbudget p hp + have hpow : 0 ≤ (t + D) ^ D := by positivity + have hpc : p ≤ (p + C) ^ C := by linarith + have hdim : (Fintype.card (Fin W.outputDim) : ℝ) ≤ Real.exp ((p + C) ^ C) := by + simpa only [Fintype.card_fin] using W.output_bound.trans (Real.exp_le_exp.mpr hpc) + refine ⟨hdim, hdim, ?_⟩ + intro i j + let F (r : Fin 2 → ZMod 2) (x : Fin 2 → ℤ) := + V.eval i x * star (V.eval j (fun k => x k - ((r k).val : ℤ))) + have hF (r : Fin 2 → ZMod 2) : + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 t (F r)) := by + obtain ⟨E⟩ := (hshift V 0 (fun k => -((r k).val : ℤ))).expansion i j + have heq : (fun x => V.eval i (x + 0) * star (V.eval j (x + fun k => -((r k).val : ℤ)))) = F r := by + funext x + simp only [F, add_zero, sub_eq_add_neg] + rfl + rw [heq] at E + exact ⟨E.mono hat⟩ + have hterm (r : Fin 2 → ZMod 2) : Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 + ((t + D) ^ D) (fun x => pairParityIndicator r x * F r x)) := + hmul ht ((Classical.choice (hparity r)).mono hbt) (Classical.choice (hF r)) + have hc : (Fintype.card (Fin 2 → ZMod 2) : ℝ) ≤ Real.exp 2 := by + norm_num only [Fintype.card_fun, ZMod.card, Fintype.card_fin] + have hh := Real.add_one_le_exp (1 : ℝ) + rw [show (2 : ℝ) = 1 + 1 by norm_num, Real.exp_add] + nlinarith + have hcost : (∑ _ : Fin 2 → ZMod 2, ‖(1 : ℂ)‖) ≤ Real.exp 2 := by simpa using hc + let S := NativeIntegerExpansion.weightedSum (fun r => Classical.choice (hterm r)) (fun _ => 1) + (by norm_num : (0 : ℝ) ≤ 2) hc hcost + have heq : (fun x => ∑ r : Fin 2 → ZMod 2, (1 : ℂ) * (pairParityIndicator r x * F r x)) = + (fun x => V.eval i x * star (W.eval j (fun k => x k / 2))) := by + funext x + let r : Fin 2 → ZMod 2 := fun k => (x k : ZMod 2) + rw [Finset.sum_eq_single r] + · simp only [pairParityIndicator, r, ite_true, one_mul, F] + rw [show V.eval j (fun k => x k - ((x k : ZMod 2).val : ℤ)) = + W.eval j (fun k => x k / 2) from W.half_dilation_integer_representative x j] + · intro a _ ha + have hne : (fun k => (x k : ZMod 2)) ≠ a := fun h => ha h.symm + simp only [pairParityIndicator, hne, ite_false, zero_mul, mul_zero] + · simp + rw [heq] at S + exact ⟨S.mono (by linarith)⟩ + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem norm_unit_pair_replacement_error {I J : Type*} [Fintype I] [Fintype J] + (u : I → ℂ) (v : J → ℂ) (hu : ∑ i, ‖u i‖ ^ 2 = 1) (hv : ∑ j, ‖v j‖ ^ 2 = 1) + (huc : ∀ i, ‖u i‖ ≤ 1) (hvc : ∀ j, ‖v j‖ ≤ 1) + (a b : ℂ) (ha : ‖a‖ ≤ 1) (hb : ‖b‖ ≤ 1) (G : I → J → ℂ) : + ‖star a * b - ∑ ij : I × J, + (star (a * star (u ij.1)) * (b * star (v ij.2))) * G ij.1 ij.2‖ ≤ + ∑ ij : I × J, ‖star (u ij.1) * v ij.2 - G ij.1 ij.2‖ := by + have hleft := congrArg star (complex_unit_vector_resolution u hu a) + simp only [star_sum, star_mul] at hleft + have hright := complex_unit_vector_resolution v hv b + have hrepr : star a * b = ∑ ij : I × J, + (star (a * star (u ij.1)) * (b * star (v ij.2))) * (star (u ij.1) * v ij.2) := by + conv_lhs => rw [hleft, hright] + rw [Finset.sum_mul_sum, Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + simp only [star_mul] + ring + rw [hrepr, ← Finset.sum_sub_distrib] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro ij _ + rw [← mul_sub, norm_mul] + have hcap : ‖star (a * star (u ij.1)) * (b * star (v ij.2))‖ ≤ 1 := by + rw [norm_mul, norm_star] + refine (mul_le_of_le_one_left (norm_nonneg _) ?_).trans ?_ + · rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) ha).trans (huc _) + · rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) hb).trans (hvc _) + exact mul_le_of_le_one_left (norm_nonneg _) hcap + +namespace NativeMultidegreeNilcharacter + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + +noncomputable def halfDilationExchangeCorrection + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) + (a b : Fin W.outputDim) (x : Fin 2 → ℤ) : ℂ := + ∑ ij : Fin W.outputDim × Fin W.outputDim, + (star ((W.rationalDilation (1 / 2)).eval a x * star (W.eval ij.1 (fun k => x k / 2))) * + ((W.rationalDilation (1 / 2)).eval b (fun k => x k.rev) * + star (W.eval ij.2 (fun k => x k.rev / 2)))) * G ij.1 ij.2 (fun k => x k / 2) + +theorem halfDilationExchangeCorrection_pointwise_error + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) + (a b : Fin W.outputDim) (x : Fin 2 → ℤ) : + ‖(W.rationalDilation (1 / 2)).antisymmetricKernel a b (x 0) (x 1) - + W.halfDilationExchangeCorrection G a b x‖ ≤ + ∑ ij : Fin W.outputDim × Fin W.outputDim, + ‖W.antisymmetricKernel ij.1 ij.2 (x 0 / 2) (x 1 / 2) - + G ij.1 ij.2 (fun k => x k / 2)‖ := by + have hinput (z : Fin 2 → ℤ) : correlationInput (z 0) (z 1) = z := by + funext k + fin_cases k <;> rfl + have hswap (z : Fin 2 → ℤ) : correlationInput (z 1) (z 0) = (fun k => z k.rev) := by + funext k + fin_cases k <;> rfl + simp only [antisymmetricKernel, hinput x, hswap x, + hinput (fun k => x k / 2), hswap (fun k => x k / 2), halfDilationExchangeCorrection] + exact norm_unit_pair_replacement_error + (fun i => W.eval i (fun k => x k / 2)) (fun j => W.eval j (fun k => x k.rev / 2)) + (W.unit_eval _) (W.unit_eval _) (fun i => W.norm_eval i _) (fun j => W.norm_eval j _) + ((W.rationalDilation (1 / 2)).eval a x) ((W.rationalDilation (1 / 2)).eval b (fun k => x k.rev)) + ((W.rationalDilation (1 / 2)).norm_eval a _) ((W.rationalDilation (1 / 2)).norm_eval b _) + (fun i j => G i j (fun k => x k / 2)) + +theorem halfDilationExchangeCorrection_mean_error {N : ℕ} [NeZero N] + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) {ε : ℝ} + (herr : ∀ i j, (𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel i j ((x 0).val : ℤ) ((x 1).val : ℤ) - + G i j (fun k => ((x k).val : ℤ))‖) ≤ ε) + (a b : Fin W.outputDim) : + (𝔼 x : Fin 2 → ZMod N, + ‖(W.rationalDilation (1 / 2)).antisymmetricKernel a b ((x 0).val : ℤ) ((x 1).val : ℤ) - + W.halfDilationExchangeCorrection G a b (fun k => ((x k).val : ℤ))‖) ≤ + 4 * (W.outputDim : ℝ) ^ 2 * ε := by + have hmean := Finset.expect_le_expect (s := Finset.univ) + (fun (x : Fin 2 → ZMod N) _ => W.halfDilationExchangeCorrection_pointwise_error G a b (fun k => ((x k).val : ℤ))) + rw [Finset.expect_sum_comm] at hmean + have he (ij : Fin W.outputDim × Fin W.outputDim) : + (𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel ij.1 ij.2 (((x 0).val : ℤ) / 2) (((x 1).val : ℤ) / 2) - + G ij.1 ij.2 (fun k => ((x k).val : ℤ) / 2)‖) ≤ 4 * ε := by + have h := expect_pair_cyclicHalf_le (fun x : Fin 2 → ZMod N => + ‖W.antisymmetricKernel ij.1 ij.2 ((x 0).val : ℤ) ((x 1).val : ℤ) - + G ij.1 ij.2 (fun k => ((x k).val : ℤ))‖) (fun _ => norm_nonneg _) + simp only [cyclicHalf_val, Int.natCast_ediv, Nat.cast_ofNat] at h + exact h.trans (mul_le_mul_of_nonneg_left (herr ij.1 ij.2) (by norm_num)) + apply hmean.trans + calc + _ ≤ ∑ _ : Fin W.outputDim × Fin W.outputDim, 4 * ε := + Finset.sum_le_sum (fun ij _ => he ij) + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_prod, Fintype.card_fin, + nsmul_eq_mul, Nat.cast_mul] + ring + +theorem halfDilationExchangeCorrection_norm {N : ℕ} [NeZero N] + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) {B : ℝ} + (hG : ∀ i j (x : Fin 2 → ZMod N), ‖G i j (fun k => ((x k).val : ℤ))‖ ≤ B) + (a b : Fin W.outputDim) (x : Fin 2 → ZMod N) : + ‖W.halfDilationExchangeCorrection G a b (fun k => ((x k).val : ℤ))‖ ≤ + (W.outputDim : ℝ) ^ 2 * B := by + unfold halfDilationExchangeCorrection + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ _ : Fin W.outputDim × Fin W.outputDim, B := by + apply Finset.sum_le_sum + intro ij _ + rw [norm_mul] + have hc : ‖star ((W.rationalDilation (1 / 2)).eval a (fun k => ((x k).val : ℤ)) * + star (W.eval ij.1 (fun k => ((x k).val : ℤ) / 2))) * + ((W.rationalDilation (1 / 2)).eval b (fun k => ((x k.rev).val : ℤ)) * + star (W.eval ij.2 (fun k => ((x k.rev).val : ℤ) / 2)))‖ ≤ 1 := by + rw [norm_mul, norm_star] + refine (mul_le_of_le_one_left (norm_nonneg _) ?_).trans ?_ + · rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + ((W.rationalDilation (1 / 2)).norm_eval a _)).trans (W.norm_eval _ _) + · rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + ((W.rationalDilation (1 / 2)).norm_eval b _)).trans (W.norm_eval _ _) + apply (mul_le_of_le_one_left (norm_nonneg _) hc).trans + have h := hG ij.1 ij.2 (fun k => cyclicHalf (x k)) + simpa only [cyclicHalf_val, Int.natCast_ediv, Nat.cast_ofNat] using h + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_prod, Fintype.card_fin, + nsmul_eq_mul, Nat.cast_mul, pow_two] + +theorem exists_halfDilationExchangeCorrection_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p), 0 ≤ q → + ∀ G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ, + (∀ i j, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 q (G i j))) → + ∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + q + C) ^ C) + (W.halfDilationExchangeCorrection G a b)) := by + obtain ⟨A, _, hcompare⟩ := exists_half_dilation_equivalence + obtain ⟨B, _, hhalf⟩ := NativeIntegerExpansion.exists_halving_expansion + obtain ⟨D, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let T := (X + Polynomial.C A) ^ A + (X + Polynomial.C B) ^ B + X + 2 + let U := (T + Polynomial.C D) ^ D + T + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((U + Polynomial.C D) ^ D + 2 * T + 2) + refine ⟨C, hC, ?_⟩ + intro p q W hq G hG a b + classical + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let v := p + q + let t := (v + A) ^ A + (v + B) ^ B + v + 2 + let u := (t + D) ^ D + t + have hv : 0 ≤ v := by dsimp [v]; positivity + have ht : 0 ≤ t := by dsimp [t]; positivity + have hu : 0 ≤ u := by dsimp [u]; positivity + have hpt : p ≤ t := by + have hA : 0 ≤ (v + A) ^ A := by positivity + have hB : 0 ≤ (v + B) ^ B := by positivity + dsimp [t, v] + dsimp [v] at hA hB + linarith + have hAt : (p + A) ^ A ≤ t := by + apply (pow_le_pow_left₀ (by positivity) (show p + A ≤ v + A by dsimp [v]; linarith) A).trans + dsimp [t] + have hB : 0 ≤ (v + B) ^ B := by positivity + linarith + have hBt : (q + B) ^ B ≤ t := by + apply (pow_le_pow_left₀ (by positivity) (show q + B ≤ v + B by dsimp [v]; linarith) B).trans + dsimp [t] + have hA : 0 ≤ (v + A) ^ A := by positivity + linarith + have htu : t ≤ u := by + have hh : 0 ≤ (t + D) ^ D := by positivity + dsimp [u] + linarith + have hprod : (t + D) ^ D ≤ u := by dsimp [u]; linarith + have hbound : (u + D) ^ D + (2 * t + 2) ≤ (p + q + C) ^ C := by + simpa [T, U, X, t, u, v, Polynomial.eval₂_pow, add_assoc] using hbudget v hv + let V := W.rationalDilation (1 / 2) + let Amap : Fin 2 → ((Fin 2 → ℤ) →+ ℤ) := + fun k => { toFun := fun x => x k.rev, map_zero' := rfl, map_add' := fun _ _ => rfl } + have hterm (ij : Fin W.outputDim × Fin W.outputDim) : + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((u + D) ^ D) + (fun x => (star (V.eval a x * star (W.eval ij.1 (fun k => x k / 2))) * + (V.eval b (fun k => x k.rev) * star (W.eval ij.2 (fun k => x k.rev / 2)))) * + G ij.1 ij.2 (fun k => x k / 2))) := by + obtain ⟨E⟩ := (hcompare W).expansion a ij.1 + obtain ⟨F⟩ := (hcompare W).expansion b ij.2 + obtain ⟨H⟩ := hhalf hq (Classical.choice (hG ij.1 ij.2)) + obtain ⟨K⟩ := hmul ht (E.conjugate.mono hAt) ((F.linearPullbackHom Amap).mono hAt) + exact hmul hu (K.mono hprod) (H.mono (hBt.trans htu)) + have hc : (Fintype.card (Fin W.outputDim × Fin W.outputDim) : ℝ) ≤ Real.exp (2 * t + 2) := by + simp only [Fintype.card_prod, Fintype.card_fin, Nat.cast_mul] + calc + _ ≤ Real.exp p * Real.exp p := mul_le_mul W.output_bound W.output_bound (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = Real.exp (2 * p) := by rw [← Real.exp_add, two_mul] + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + have hcost : (∑ _ : Fin W.outputDim × Fin W.outputDim, ‖(1 : ℂ)‖) ≤ Real.exp (2 * t + 2) := by + simpa using hc + let S := NativeIntegerExpansion.weightedSum (fun ij => Classical.choice (hterm ij)) (fun _ => 1) + (by linarith : 0 ≤ 2 * t + 2) hc hcost + refine ⟨?_⟩ + change NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + q + C) ^ C) + (fun x => W.halfDilationExchangeCorrection G a b x) + simpa only [one_mul, halfDilationExchangeCorrection, V] using S.mono hbound + +end NativeMultidegreeNilcharacter +end Erdos3 + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + +noncomputable def tensorSquareExchangeCorrection + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) + (a b : Fin (W.outputDim ^ 2)) (x : Fin 2 → ℤ) : ℂ := + G ((tensorIndexEquiv W.outputDim 2).symm a 0) ((tensorIndexEquiv W.outputDim 2).symm b 0) x * + G ((tensorIndexEquiv W.outputDim 2).symm a 1) ((tensorIndexEquiv W.outputDim 2).symm b 1) x + +theorem tensorSquare_antisymmetricKernel (a b : Fin (W.outputDim ^ 2)) (h n : ℤ) : + (W.tensorPower 2).antisymmetricKernel a b h n = + W.antisymmetricKernel ((tensorIndexEquiv W.outputDim 2).symm a 0) + ((tensorIndexEquiv W.outputDim 2).symm b 0) h n * + W.antisymmetricKernel ((tensorIndexEquiv W.outputDim 2).symm a 1) + ((tensorIndexEquiv W.outputDim 2).symm b 1) h n := by + simp only [antisymmetricKernel, tensorPower_eval, Fin.prod_univ_two, star_mul] + ring + +theorem tensorSquareExchangeCorrection_norm {N : ℕ} [NeZero N] + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) {B : ℝ} + (hB : 0 ≤ B) + (hcap : ∀ i j (x : Fin 2 → ZMod N), ‖G i j (fun k => ((x k).val : ℤ))‖ ≤ B) + (a b : Fin (W.outputDim ^ 2)) (x : Fin 2 → ZMod N) : + ‖W.tensorSquareExchangeCorrection G a b (fun k => ((x k).val : ℤ))‖ ≤ B ^ 2 := by + rw [tensorSquareExchangeCorrection, norm_mul, pow_two B] + exact mul_le_mul (hcap _ _ x) (hcap _ _ x) (norm_nonneg _) hB + +theorem tensorSquareExchangeCorrection_mean_error {N : ℕ} [NeZero N] + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) {B ε : ℝ} + (hB : 0 ≤ B) + (hcap : ∀ i j (x : Fin 2 → ZMod N), ‖G i j (fun k => ((x k).val : ℤ))‖ ≤ B) + (herr : ∀ i j, (𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel i j ((x 0).val : ℤ) ((x 1).val : ℤ) - + G i j (fun k => ((x k).val : ℤ))‖) ≤ ε) + (a b : Fin (W.outputDim ^ 2)) : + (𝔼 x : Fin 2 → ZMod N, + ‖(W.tensorPower 2).antisymmetricKernel a b ((x 0).val : ℤ) ((x 1).val : ℤ) - + W.tensorSquareExchangeCorrection G a b (fun k => ((x k).val : ℤ))‖) ≤ (1 + B) * ε := by + let i := (tensorIndexEquiv W.outputDim 2).symm a + let j := (tensorIndexEquiv W.outputDim 2).symm b + let K (r : Fin 2) (x : Fin 2 → ZMod N) := + W.antisymmetricKernel (i r) (j r) ((x 0).val : ℤ) ((x 1).val : ℤ) + let F (r : Fin 2) (x : Fin 2 → ZMod N) := G (i r) (j r) (fun k => ((x k).val : ℤ)) + have hpoint (x : Fin 2 → ZMod N) : + ‖K 0 x * K 1 x - F 0 x * F 1 x‖ ≤ + ‖K 1 x - F 1 x‖ + B * ‖K 0 x - F 0 x‖ := by + have heq : K 0 x * K 1 x - F 0 x * F 1 x = + K 0 x * (K 1 x - F 1 x) + (K 0 x - F 0 x) * F 1 x := by ring + rw [heq] + apply (norm_add_le _ _).trans + rw [norm_mul, norm_mul] + apply add_le_add + · exact mul_le_of_le_one_left (norm_nonneg _) (W.antisymmetricKernel_norm _ _ _ _) + · simpa only [mul_comm] using mul_le_mul_of_nonneg_left (hcap _ _ x) (norm_nonneg (K 0 x - F 0 x)) + have hm := Finset.expect_le_expect (s := Finset.univ) (fun x _ => hpoint x) + rw [Finset.expect_add_distrib, ← Finset.mul_expect] at hm + have h0 : (𝔼 x, ‖K 0 x - F 0 x‖) ≤ ε := herr _ _ + have h1 : (𝔼 x, ‖K 1 x - F 1 x‖) ≤ ε := herr _ _ + have hbnd := hm.trans (add_le_add h1 (mul_le_mul_of_nonneg_left h0 hB)) + have hfinal : (𝔼 x, ‖K 0 x * K 1 x - F 0 x * F 1 x‖) ≤ (1 + B) * ε := + hbnd.trans_eq (by ring) + simpa only [K, F, i, j, tensorSquare_antisymmetricKernel, tensorSquareExchangeCorrection] using hfinal + +theorem exists_tensorSquareExchangeCorrection_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p), 0 ≤ q → + ∀ G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ, + (∀ i j, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 q (G i j))) → + ∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((q + C) ^ C) + (W.tensorSquareExchangeCorrection G a b)) := by + obtain ⟨C, hC, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + refine ⟨C, hC, ?_⟩ + intro p q W hq G hG a b + exact hmul hq (Classical.choice (hG _ _)) (Classical.choice (hG _ _)) + +theorem explicit_half_root_exchange_mean_error {N : ℕ} [NeZero N] + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) {ε : ℝ} + (hcap : ∀ i j (x : Fin 2 → ZMod N), ‖G i j (fun k => ((x k).val : ℤ))‖ ≤ 1) + (herr : ∀ i j, (𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel i j ((x 0).val : ℤ) ((x 1).val : ℤ) - + G i j (fun k => ((x k).val : ℤ))‖) ≤ ε) + (a b : Fin (W.outputDim ^ 2)) : + (𝔼 x : Fin 2 → ZMod N, + ‖((W.rationalDilation (1 / 2)).tensorPower 2).antisymmetricKernel a b + ((x 0).val : ℤ) ((x 1).val : ℤ) - + (W.rationalDilation (1 / 2)).tensorSquareExchangeCorrection + (W.halfDilationExchangeCorrection G) a b (fun k => ((x k).val : ℤ))‖) ≤ + (1 + (W.outputDim : ℝ) ^ 2) * (4 * (W.outputDim : ℝ) ^ 2 * ε) := by + apply tensorSquareExchangeCorrection_mean_error (W.rationalDilation (1 / 2)) + (W.halfDilationExchangeCorrection G) (by positivity) + · intro i j x + simpa only [mul_one] using W.halfDilationExchangeCorrection_norm G hcap i j x + · exact W.halfDilationExchangeCorrection_mean_error G herr + +theorem exists_explicit_half_root_exchange_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p), 0 ≤ q → + ∀ G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ, + (∀ i j, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 q (G i j))) → + ∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + q + C) ^ C) + ((W.rationalDilation (1 / 2)).tensorSquareExchangeCorrection + (W.halfDilationExchangeCorrection G) a b)) := by + obtain ⟨A, _, hhalf⟩ := exists_halfDilationExchangeCorrection_expansion + obtain ⟨B, _, hsquare⟩ := exists_tensorSquareExchangeCorrection_expansion + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (((X + Polynomial.C A) ^ A + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p q W hq G hG a b + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + obtain ⟨E⟩ := hsquare (W.rationalDilation (1 / 2)) (by positivity : 0 ≤ (p + q + A) ^ A) + (W.halfDilationExchangeCorrection G) (hhalf W hq G hG) a b + have hbound : ((p + q + A) ^ A + B) ^ B ≤ (p + q + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget (p + q) (add_nonneg hp hq) + exact ⟨E.mono hbound⟩ + +end Erdos3.NativeMultidegreeNilcharacter + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TerminalControlledFactorization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TerminalControlledFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..008c986319752c4a0d18085f1c3a074e348dacde --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TerminalControlledFactorization.lean @@ -0,0 +1,685 @@ +import OAI.Combinatorics.Progressions.Dynamics.FastTerminalBudget +import OAI.Combinatorics.Progressions.Dynamics.FormalGeometryBudget +import OAI.Combinatorics.Progressions.Dynamics.UniformFormalInductionIteration +import OAI.Combinatorics.Progressions.Linear.BoundedSpanningPadding +import OAI.Combinatorics.Progressions.Linear.FullFastRelativeSpanning +import OAI.Combinatorics.Progressions.Linear.StepDropBasisBudget + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι κ L : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype ι] [Fintype κ] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + +local notation "ωW" => (fun a : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val a)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) + +theorem exists_full_fast_quotient_bases + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + (v : κ → F.squareFiltration.quotientTop.AssociatedGraded) + (hspan : Submodule.span ℚ (Set.range v) = W.toSubmodule) + {H : ℕ} (hH : 1 ≤ H) (hv : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + {p : ℝ} (hp : 0 ≤ p) + (hdim : 2 * (Fintype.card ι : ℝ) + (Fintype.card κ : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) : + ∃ H' : ℕ, H ≤ H' ∧ 1 ≤ H' ∧ (H' : ℝ) ≤ Real.exp ((p + 2) ^ 294) ∧ + ∃ dU : ℕ, dU ≤ Fintype.card ι ∧ + ∃ fU : Basis (Fin dU) ℚ (F.AssociatedGraded ⧸ (F.fullFastGradedDiagonal W).toSubmodule), + ∃ dV : ℕ, dV ≤ Fintype.card ι ∧ + ∃ fV : Basis (Fin dV) ℚ (F.AssociatedGraded ⧸ F.fullFastGradedRelative e ω hF W), + (∀ i j, RationalHeightLE (fU.repr ((F.fullFastGradedDiagonal W).toSubmodule.mkQ + (F.associatedGradedBasis e ω hF j)) i) H') ∧ + (∀ i j, RationalHeightLE (fV.repr ((F.fullFastGradedRelative e ω hF W).mkQ + (F.associatedGradedBasis e ω hF j)) i) H') := by + have hn0 : 0 ≤ (Fintype.card ι : ℝ) := Nat.cast_nonneg _ + have hm0 : 0 ≤ (Fintype.card κ : ℝ) := Nat.cast_nonneg _ + have hm : (Fintype.card κ : ℝ) ≤ p := by linarith + have hUcard : (Fintype.card (κ ⊕ TopGradedBasisIndex s ω) : ℝ) ≤ p := by + have h := Nat.cast_le (α := ℝ).mpr (fullFastDiagonalGenerators_card (κ := κ) (s := s) ω) + push_cast at h + linarith + obtain ⟨HU, hHU, hHUp, dU, hdU, fU, hfU⟩ := exists_submodule_quotient_basis_exp + (F.associatedGradedBasis e ω hF) (F.fullFastGradedDiagonal W).toSubmodule + (F.fullFastDiagonalGenerators e ω hF v) (F.fullFastDiagonalGenerators_span e ω hF W v hspan) + hH (F.fullFastDiagonalGenerators_height e ω hF v hH hv) hp hUcard hHp + have hn : (Fintype.card (ReducedSquareBasisIndex s ω) : ℝ) ≤ p := by + have hcard : Fintype.card (ReducedSquareBasisIndex s ω) ≤ 2 * Fintype.card ι := + (Fintype.card_subtype_le _).trans (card_squareBasis_index_le ω) + have h := Nat.cast_le (α := ℝ).mpr hcard + push_cast at h + linarith + have hq : (Fintype.card (QuotientTopBasisIndex s ω) : ℝ) ≤ p := by + have h := Nat.cast_le (α := ℝ).mpr + (Fintype.card_subtype_le (fun i : ι => ¬ s + 1 ≤ ω i)) + linarith + obtain ⟨Hz, hHz, hHzp, z, hz, hzh⟩ := + F.exists_full_fast_relative_generators_exp e ω hF W v hspan hH hv hp hn hm hq hHp + obtain ⟨HV, hHV, hHVp, dV, hdV, fV, hfV⟩ := exists_submodule_quotient_basis_exp + (F.associatedGradedBasis e ω hF) (F.fullFastGradedRelative e ω hF W) z hz hHz hzh + (by positivity : 0 ≤ (p + 2) ^ 40) + (hm.trans (le_power_budget hp (by decide : 1 ≤ 40))) hHzp + have hVbudget : (HV : ℝ) ≤ Real.exp ((p + 2) ^ 294) := + exponential_budget_comp hp (by positivity) 40 7 le_rfl hHVp + have hUbudget : (HU : ℝ) ≤ Real.exp ((p + 2) ^ 294) := hHUp.trans + (Real.exp_le_exp.mpr (pow_le_pow_right₀ (by linarith : (1 : ℝ) ≤ p + 2) (by decide : 7 ≤ 294))) + have hbudget : (H : ℝ) ≤ Real.exp ((p + 2) ^ 294) := + hHp.trans (Real.exp_le_exp.mpr (le_power_budget hp (by decide : 1 ≤ 294))) + refine ⟨max H (max HU HV), Nat.le_max_left _ _, hH.trans (Nat.le_max_left _ _), ?_, + dU, hdU, fU, dV, hdV, fV, ?_, ?_⟩ + · rw [Nat.cast_max, Nat.cast_max] + exact max_le hbudget (max_le hUbudget hVbudget) + · intro i j + exact (hfU i j).mono ((Nat.le_max_left HU HV).trans (Nat.le_max_right _ _)) + · intro i j + exact (hfV i j).mono ((Nat.le_max_right HU HV).trans (Nat.le_max_right _ _)) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_uniform_formal_induction_factorization (s : ℕ) : + ∃ E : ℕ, 2 ≤ E ∧ + ∀ {L μ ι κ σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [Fintype μ] [Fintype ι] [Fintype κ] [Fintype σ] + (F : NilpotentLieFiltration L s) (b : Basis μ ℚ L) (w : μ → ℕ) + (_hF : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + (_hgraded : BasisHomogeneousBrackets b w) (_hs : 2 ≤ s) + (U : LieSubalgebra ℝ (ℝ ⊗[ℚ] L)) (V K : Submodule ℚ L) + (_hUV : ∀ u ∈ U, ∀ v ∈ V.baseChange ℝ, ⁅u, v⁆ ∈ V.baseChange ℝ) + (_hU : BasisGradedSubmodule (b.baseChange ℝ) w U.toSubmodule) + (_hV : BasisGradedSubmodule (b.baseChange ℝ) w (V.baseChange ℝ)) + (eK : Basis κ ℚ K) (f : Basis ι ℚ (L ⧸ V)) + (_hK : ∀ x ∈ K.baseChange ℝ, basisGradeProjection (b.baseChange ℝ) w 1 x = x) + {H : ℕ} (_hH : 1 ≤ H) + (G : ∀ j, 2 ≤ j → j ≤ s → FormalStageGeometry b w U V K eK f j H) + (_hKernelBasis : ∀ i z, RationalHeightLE (b.repr (eK z : L) i) H) + (_hQuotient : ∀ i z, RationalHeightLE (f.repr (V.mkQ (b z)) i) H) + (_hStructure : ∀ i z r, RationalHeightLE (b.repr ⁅b i, b z⁆ r) H) + {p : ℝ} (_hp : 0 ≤ p) + (_hμ : (Fintype.card μ : ℝ) ≤ p) (_hι : (Fintype.card ι : ℝ) ≤ p) + (_hκ : (Fintype.card κ : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hRanks : ∀ j hj hjs, ((G j hj hjs).bracketRank : ℝ) ≤ p ∧ + ((G j hj hjs).currentRank : ℝ) ≤ p) + (_hsp : (s : ℝ) ≤ p) (_hHp : (H : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + E) ^ E) ≤ T i) + (X : F.FormalInductionState b w U V K eK T 2 p), + ∃ q : ℝ, p ≤ q ∧ 0 ≤ q ∧ q ≤ (p + E) ^ E ∧ + ∃ W : F.FormalInductionRun b w U V K eK T X.P (s - 1) q, + (W.denominator : ℝ) ≤ Real.exp ((p + E) ^ E) ∧ + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + E) ^ E) ∧ W.denominator ∣ m ∧ + CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + E) ^ E)) W.left.prod.coord ∧ + CoefficientGrid (b.baseChange ℝ) m W.right.prod.coord ∧ + F.FormalCorrectionProperty b w U W.left.prod ∧ + F.FormalCorrectionProperty b w U W.right.prod := by + obtain ⟨D, _, hiteration⟩ := exists_uniform_formal_induction_iteration s + obtain ⟨C, _, hproducts⟩ := exists_formal_induction_run_product_controls s + let Q : Polynomial ℕ := (Polynomial.X + Polynomial.C D) ^ D + obtain ⟨E, hE, hbudget⟩ := exists_natPolynomial_eval_budget (Q + (Q + Polynomial.C C) ^ C) + refine ⟨E, hE, ?_⟩ + intro L μ ι κ σ _ _ _ _ _ _ F b w hF hgraded hs U V K hUV hU hV eK f hK H hH G + hKernelBasis hQuotient hStructure p hp hμ hι hκ hσ hRanks hsp hHp T hT X + let t := (p + D) ^ D + let z := (t + C) ^ C + have ht : 0 ≤ t := by dsimp [t]; positivity + have hz : 0 ≤ z := by dsimp [z]; positivity + have htotal : t + z ≤ (p + E) ^ E := by + simpa [Q, t, z, Polynomial.eval₂_pow] using hbudget p hp + have htcap : t ≤ (p + E) ^ E := by linarith + have hzcap : z ≤ (p + E) ^ E := by linarith + have hT' : ∀ i, Real.exp ((p + D) ^ D) ≤ T i := + fun i => (Real.exp_le_exp.mpr htcap).trans (hT i) + obtain ⟨q, hpq, hq, hqt, W, hWden⟩ := + hiteration F b w hF hgraded hs U V K hUV hU hV eK f hK hH G + hKernelBasis hQuotient hStructure hp hμ hι hκ hσ hRanks hsp hHp T hT' X + have hpt : p ≤ t := hpq.trans hqt + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + obtain ⟨m, hm, hmp, hdm, hleft, hright, hleftGood, hrightGood⟩ := + hproducts F b w hF hgraded hTpos (Nat.sub_le s 1) W hH hStructure ht hqt + (hμ.trans hpt) (hσ.trans hpt) (hHp.trans (Real.exp_le_exp.mpr hpt)) hWden + exact ⟨q, hpq, hq, hqt.trans htcap, W, + hWden.trans (Real.exp_le_exp.mpr htcap), m, hm, + hmp.trans (Real.exp_le_exp.mpr hzcap), hdm, + hleft.mono _ T hTpos (Real.exp_le_exp.mpr hzcap), hright, hleftGood, hrightGood⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_formal_stepDrop_subalgebra_factorization (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {L μ υ χ ι κ σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [Fintype μ] [Fintype υ] [Fintype χ] [Fintype ι] [Fintype κ] [Fintype σ] + (F : NilpotentLieFiltration L s) (b : Basis μ ℚ L) (w : μ → ℕ) + (_hF : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + (_hgraded : BasisHomogeneousBrackets b w) (_hs : 2 ≤ s) + (U : LieSubalgebra ℚ L) (V K : Submodule ℚ L) + (_hUV : ∀ u ∈ U, ∀ v ∈ V, ⁅u, v⁆ ∈ V) + (_hU : BasisGradedSubmodule b w U.toSubmodule) (_hV : BasisGradedSubmodule b w V) + (η : L →ₗ[ℚ] ℚ) (_hη : ∀ x ∈ V, basisGradeProjection b w s x = x → η x = 0) + (eK : Basis κ ℚ K) (f : Basis ι ℚ (L ⧸ V)) + (fU : Basis υ ℚ (L ⧸ U.toSubmodule)) (fK : Basis χ ℚ (L ⧸ K)) + (_hK : ∀ x ∈ K.baseChange ℝ, basisGradeProjection (b.baseChange ℝ) w 1 x = x) + {H : ℕ} (_hH : 1 ≤ H) + (G : ∀ j, 2 ≤ j → j ≤ s → + FormalStageGeometry b w (realificationLieSubalgebra U) V K eK f j H) + (_hKernelBasis : ∀ i z, RationalHeightLE (b.repr (eK z : L) i) H) + (_hQuotient : ∀ i z, RationalHeightLE (f.repr (V.mkQ (b z)) i) H) + (_hQuotientU : ∀ i z, RationalHeightLE (fU.repr (U.toSubmodule.mkQ (b z)) i) H) + (_hQuotientK : ∀ i z, RationalHeightLE (fK.repr (K.mkQ (b z)) i) H) + (_hStructure : ∀ i z r, RationalHeightLE (b.repr ⁅b i, b z⁆ r) H) + {p : ℝ} (_hp : 0 ≤ p) + (_hμ : (Fintype.card μ : ℝ) ≤ p) (_hυ : (Fintype.card υ : ℝ) ≤ p) + (_hχ : (Fintype.card χ : ℝ) ≤ p) (_hι : (Fintype.card ι : ℝ) ≤ p) + (_hκ : (Fintype.card κ : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hRanks : ∀ j hj hjs, ((G j hj hjs).bracketRank : ℝ) ≤ p ∧ + ((G j hj hjs).currentRank : ℝ) ≤ p) + (_hsp : (s : ℝ) ≤ p) (_hHp : (H : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (X : F.FormalInductionState b w (realificationLieSubalgebra U) V K eK T 2 p), + ∃ Z : LieSubalgebra ℚ L, BasisGradedSubmodule b w Z.toSubmodule ∧ + (∀ x ∈ Z, η (basisGradeProjection b w s x) = 0) ∧ + ∃ e : Basis (Fin (Module.finrank ℚ Z)) ℚ Z, + (∀ i j, ((b.repr (e i : L) j).num.natAbs : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ((b.repr (e i : L) j).den : ℝ) ≤ Real.exp ((p + C) ^ C)) ∧ + ∃ A P B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot, + A * P * B = X.P ∧ + F.FormalCorrectionProperty b w (realificationLieSubalgebra U) A ∧ + F.FormalCorrectionProperty b w (realificationLieSubalgebra U) B ∧ + coefficients P.coord 0 = 0 ∧ + P.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) ∧ + (∀ α, coefficients P.coord α ∈ realificationLieSubalgebra Z) ∧ + CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + C) ^ C)) A.coord ∧ + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + CoefficientGrid (b.baseChange ℝ) m B.coord := by + obtain ⟨E, hE, hfactor⟩ := exists_uniform_formal_induction_factorization s + obtain ⟨D, hD, hbasis⟩ := exists_stepDrop_basis_uniform_budget + let C := max E D + refine ⟨C, hE.trans (Nat.le_max_left E D), ?_⟩ + intro L μ υ χ ι κ σ _ _ _ _ _ _ _ _ F b w hF hgraded hs U V K hUV hU hV η hη eK f + fU fK hK H hH G hKernelBasis hQuotient hQuotientU hQuotientK hStructure + p hp hμ hυ hχ hι hκ hσ hRanks hsp hHp T hT X + have hEC : (p + E) ^ E ≤ (p + C) ^ C := + shifted_power_self_mono hp (by omega) (Nat.le_max_left E D) + have hDC : (p + D) ^ D ≤ (p + C) ^ C := + shifted_power_self_mono hp (by omega) (Nat.le_max_right E D) + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hRU : BasisGradedSubmodule (b.baseChange ℝ) w (realificationLieSubalgebra U).toSubmodule := + hU.baseChange b w U.toSubmodule + have hRV := hV.baseChange b w V + have hRUV : ∀ u ∈ realificationLieSubalgebra U, ∀ v ∈ V.baseChange ℝ, ⁅u, v⁆ ∈ V.baseChange ℝ := + fun _ hu _ hv => lie_mem_real_baseChange U.toSubmodule V V hUV hu hv + obtain ⟨q, _, _, _, W, _, m, hm, hmbound, _, hleft, hright, hleftGood, hrightGood⟩ := + hfactor F b w hF hgraded hs (realificationLieSubalgebra U) V K hRUV hRU hRV eK f hK hH G + hKernelBasis hQuotient hStructure hp hμ hι hκ hσ hRanks hsp hHp T + (fun i => (Real.exp_le_exp.mpr hEC).trans (hT i)) X + obtain ⟨e, he⟩ := hbasis b w U V K fU fK f eK hH hQuotientU hQuotientK hQuotient + hKernelBasis hStructure hp hμ hυ hχ hκ hι hHp + let Z := stepDropSubalgebra b w (F.adaptedBasis_weight_pos b w hF) hgraded U V K hU hUV + have hcoeff : ∀ α, coefficients W.state.P.coord α ∈ realificationLieSubalgebra Z := by + intro α + exact W.terminal_coefficients_mem_rational_stepDrop hs hF α + refine ⟨Z, stepDropSubmodule_graded b w U V K hU hV, + (fun _ hx => stepDropSubmodule_top_frequency b w U V K hU hV η hs hη hx), e, ?_, + W.left.prod, W.state.P, W.right.prod, W.factorization, hleftGood, hrightGood, + W.state.constant_zero, W.state.graded, hcoeff, + hleft.mono _ T hTpos (Real.exp_le_exp.mpr hEC), m, hm, + hmbound.trans (Real.exp_le_exp.mpr hEC), hright⟩ + intro i j + exact ⟨(he i j).1.trans (Real.exp_le_exp.mpr hDC), (he i j).2.trans (Real.exp_le_exp.mpr hDC)⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_stepDrop_from_formal_state (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {L μ υ χ ι κ σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [Fintype μ] [Fintype υ] [Fintype χ] [Fintype ι] [Fintype κ] [Fintype σ] + (F : NilpotentLieFiltration L s) (b : Basis μ ℚ L) (w : μ → ℕ) + (_hF : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + (_hgraded : BasisHomogeneousBrackets b w) (_hs : 2 ≤ s) + (U : LieSubalgebra ℚ L) (V K : Submodule ℚ L) + (_hUV : ∀ u ∈ U, ∀ v ∈ V, ⁅u, v⁆ ∈ V) + (_hU : BasisGradedSubmodule b w U.toSubmodule) (_hV : BasisGradedSubmodule b w V) + (η : L →ₗ[ℚ] ℚ) (_hη : ∀ x ∈ V, basisGradeProjection b w s x = x → η x = 0) + (eK : Basis κ ℚ K) (f : Basis ι ℚ (L ⧸ V)) + (fU : Basis υ ℚ (L ⧸ U.toSubmodule)) (fK : Basis χ ℚ (L ⧸ K)) + (_hK : ∀ x ∈ K.baseChange ℝ, basisGradeProjection (b.baseChange ℝ) w 1 x = x) + {H : ℕ} (_hH : 1 ≤ H) + (_hKernelBasis : ∀ i z, RationalHeightLE (b.repr (eK z : L) i) H) + (_hQuotient : ∀ i z, RationalHeightLE (f.repr (V.mkQ (b z)) i) H) + (_hQuotientU : ∀ i z, RationalHeightLE (fU.repr (U.toSubmodule.mkQ (b z)) i) H) + (_hQuotientK : ∀ i z, RationalHeightLE (fK.repr (K.mkQ (b z)) i) H) + (_hStructure : ∀ i z r, RationalHeightLE (b.repr ⁅b i, b z⁆ r) H) + {p : ℝ} (_hp : 0 ≤ p) + (_hμ : (Fintype.card μ : ℝ) ≤ p) (_hυ : (Fintype.card υ : ℝ) ≤ p) + (_hχ : (Fintype.card χ : ℝ) ≤ p) (_hι : (Fintype.card ι : ℝ) ≤ p) + (_hκ : (Fintype.card κ : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hsp : (s : ℝ) ≤ p) (_hHp : (H : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (X : F.FormalInductionState b w (realificationLieSubalgebra U) V K eK T 2 p), + ∃ Z : LieSubalgebra ℚ L, BasisGradedSubmodule b w Z.toSubmodule ∧ + (∀ x ∈ Z, η (basisGradeProjection b w s x) = 0) ∧ + ∃ e : Basis (Fin (Module.finrank ℚ Z)) ℚ Z, + (∀ i j, ((b.repr (e i : L) j).num.natAbs : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ((b.repr (e i : L) j).den : ℝ) ≤ Real.exp ((p + C) ^ C)) ∧ + ∃ A P B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot, + A * P * B = X.P ∧ + F.FormalCorrectionProperty b w (realificationLieSubalgebra U) A ∧ + F.FormalCorrectionProperty b w (realificationLieSubalgebra U) B ∧ + coefficients P.coord 0 = 0 ∧ + P.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) ∧ + (∀ α, coefficients P.coord α ∈ realificationLieSubalgebra Z) ∧ + CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + C) ^ C)) A.coord ∧ + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + CoefficientGrid (b.baseChange ℝ) m B.coord := by + classical + obtain ⟨E, _, hfinal⟩ := exists_formal_stepDrop_subalgebra_factorization s + obtain ⟨D, hD, hgeometryBudget⟩ := exists_formal_geometry_uniform_budget + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (((Polynomial.X + Polynomial.C D) ^ D + Polynomial.C E) ^ E) + refine ⟨C, hC, ?_⟩ + intro L μ υ χ ι κ σ _ _ _ _ _ _ _ _ F b w hF hgraded hs U V K hUV hU hV η hη eK f + fU fK hK H hH hKernelBasis hQuotient hQuotientU hQuotientK hStructure + p hp hμ hυ hχ hι hκ hσ hsp hHp T hT X + let u := (p + D) ^ D + let r := 2 * Fintype.card υ + Fintype.card χ + Fintype.card ι + Fintype.card μ + let J := formalGeometryHeight (Fintype.card μ) r H + have hu : 0 ≤ u := by dsimp [u]; positivity + have hpu : p ≤ u := by + calc + p ≤ p + D := le_add_of_nonneg_right (Nat.cast_nonneg D) + _ ≤ (p + D) ^ D := by + have hDr : (2 : ℝ) ≤ D := Nat.cast_le.mpr hD + simpa only [pow_one] using pow_le_pow_right₀ (by linarith : (1 : ℝ) ≤ p + D) + (show 1 ≤ D by omega) + have hr : (r : ℝ) ≤ 5 * p := by + dsimp [r] + push_cast + linarith + have hHJ : H ≤ J := formalGeometryHeight_ge_input _ _ _ + have hJ : 1 ≤ J := hH.trans hHJ + have hJu : (J : ℝ) ≤ Real.exp u := hgeometryBudget _ _ _ p hp hμ hr hHp + have hcap : (u + E) ^ E ≤ (p + C) ^ C := by + simpa [u, Polynomial.eval₂_pow] using hbudget p hp + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hgeometry (j : ℕ) (hj : 2 ≤ j) : + ∃ G : FormalStageGeometry b w (realificationLieSubalgebra U) V K eK f j J, + G.bracketRank ≤ Fintype.card μ ∧ G.currentRank ≤ Fintype.card μ := by + apply exists_rational_formal_stage_geometry b w U V K hU fU fK f eK hH + · dsimp [r]; omega + · dsimp [r]; omega + · dsimp [r]; omega + · exact hQuotientU + · exact hQuotientK + · exact hQuotient + · exact hKernelBasis + · exact hStructure + · exact hj + choose G hG using hgeometry + obtain ⟨Z, hZ, hZη, e, he, A, P, B, hfactor, hA, hB, hzero, hdegree, hcoeff, + hbound, m, hm, hmbound, hgrid⟩ := + hfinal F b w hF hgraded hs U V K hUV hU hV η hη eK f fU fK hK hJ + (fun j hj _ => G j hj) + (fun i z => (hKernelBasis i z).mono hHJ) + (fun i z => (hQuotient i z).mono hHJ) + (fun i z => (hQuotientU i z).mono hHJ) + (fun i z => (hQuotientK i z).mono hHJ) + (fun i z k => (hStructure i z k).mono hHJ) + hu (hμ.trans hpu) (hυ.trans hpu) (hχ.trans hpu) (hι.trans hpu) (hκ.trans hpu) (hσ.trans hpu) + (fun j hj _ => ⟨(Nat.cast_le.mpr (hG j hj).1).trans (hμ.trans hpu), + (Nat.cast_le.mpr (hG j hj).2).trans (hμ.trans hpu)⟩) + (hsp.trans hpu) hJu T (fun i => (Real.exp_le_exp.mpr hcap).trans (hT i)) + (X.enlarge hpu hTpos) + refine ⟨Z, hZ, hZη, e, ?_, A, P, B, hfactor, hA, hB, hzero, hdegree, hcoeff, + hbound.mono _ T hTpos (Real.exp_le_exp.mpr hcap), m, hm, + hmbound.trans (Real.exp_le_exp.mpr hcap), hgrid⟩ + intro i j + exact ⟨(he i j).1.trans (Real.exp_le_exp.mpr hcap), (he i j).2.trans (Real.exp_le_exp.mpr hcap)⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +universe uσ uι uτ uL + +variable {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "bG" => F.associatedGradedBasis e ω hF +local notation "FG" => F.associatedGradedFiltration +local notation "U" => F.fullFastGradedDiagonal W +local notation "V" => F.fullFastGradedRelative e ω hF W +local notation "PG" => PolynomialGroup σ F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot + +def FastTerminalFactorization (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (T : σ → ℝ) (original : PG) (p : ℝ) : Prop := + ∃ Z : LieSubalgebra ℚ F.AssociatedGraded, BasisGradedSubmodule bG ω Z.toSubmodule ∧ + (∀ x ∈ Z, η (basisGradeProjection bG ω (s + 1) x) = 0) ∧ + ∃ bZ : Basis (Fin (Module.finrank ℚ Z)) ℚ Z, + (∀ i j, (((bG).repr (bZ i : F.AssociatedGraded) j).num.natAbs : ℝ) ≤ Real.exp p ∧ + (((bG).repr (bZ i : F.AssociatedGraded) j).den : ℝ) ≤ Real.exp p) ∧ + ∃ A P B : PG, A * P * B = original ∧ + (FG).FormalCorrectionProperty bG ω (realificationLieSubalgebra U) A ∧ + (FG).FormalCorrectionProperty bG ω (realificationLieSubalgebra U) B ∧ + coefficients P.coord 0 = 0 ∧ + P.coord ∈ gradedPolynomialSubmodule ((bG).baseChange ℝ) ω (fun _ : σ => 1) ∧ + (∀ α, coefficients P.coord α ∈ realificationLieSubalgebra Z) ∧ + CoefficientBound ((bG).baseChange ℝ) T (Real.exp p) A.coord ∧ + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp p ∧ CoefficientGrid ((bG).baseChange ℝ) m B.coord + +omit [Fintype σ] [Fintype ι] in +theorem FastTerminalFactorization.mono + {η : F.AssociatedGraded →ₗ[ℚ] ℚ} {T : σ → ℝ} {original : PG} {p q : ℝ} + (h : F.FastTerminalFactorization e ω hF W η T original p) + (hpq : p ≤ q) (hT : ∀ i, 0 < T i) : + F.FastTerminalFactorization e ω hF W η T original q := by + obtain ⟨Z, hZ, hη, bZ, hbZ, A, P, B, hfactor, hA, hB, hzero, hdegree, hcoeff, + hbound, m, hm, hmp, hgrid⟩ := h + have hepq := Real.exp_le_exp.mpr hpq + exact ⟨Z, hZ, hη, bZ, fun i j => ⟨(hbZ i j).1.trans hepq, (hbZ i j).2.trans hepq⟩, + A, P, B, hfactor, hA, hB, hzero, hdegree, hcoeff, hbound.mono _ T hT hepq, + m, hm, hmp.trans hepq, hgrid⟩ + +def FastTerminalStateSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) (_hs : 1 ≤ s) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hτ : (Fintype.card τ : ℝ) ≤ p) (_hsp : (s + 1 : ℕ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (v : τ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hheight : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + (k : ℕ) (_hk : (k : ℝ) ≤ p) (K : Submodule ℚ (L ⧸ F.layer 2)) (bK : Basis (Fin k) ℚ K) + (_hKb : ∀ i j, RationalHeightLE ((F.layerOneBasis e ω hF).repr (bK j).val i) H) + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (_hη : ∀ x ∈ V, basisGradeProjection bG ω (s + 1) x = x → η x = 0) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (X : (FG).FormalInductionState bG ω (realificationLieSubalgebra U) V + (F.gradedHorizontalKernel e ω hF K) (F.gradedHorizontalKernelBasis e ω hF K bK) T 2 p), + F.FastTerminalFactorization e ω hF W η T X.P ((p + C) ^ C) + +theorem exists_fast_terminalState_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded), + F.FastTerminalStateSpec (σ := σ) (τ := τ) e ω hF W C := by + have h := exists_stepDrop_from_formal_state.{uL, uι, 0, 0, 0, 0, uσ} (s + 1) + obtain ⟨c, _, hformal⟩ := h + obtain ⟨C, hC, hbudget⟩ := exists_fastTerminalParameter_budget c + refine ⟨C, hC, ?_⟩ + intro σ ι τ L _ _ _ _ _ F e ω hF W H p hH hp hs hι hσ hτ hsp hHp hstructure + hW v hv hheight k hk K bK hKb η hη T hT X + have hTpos (i : σ) : 0 < T i := (Real.exp_pos _).trans_le (hT i) + have hthree : 0 ≤ 3 * p := by positivity + have hp3 : p ≤ 3 * p := by linarith + have hsize : 2 * (Fintype.card ι : ℝ) + (Fintype.card τ : ℝ) ≤ 3 * p := by linarith + have hUV := F.exists_full_fast_quotient_bases e ω hF W v hv hH hheight hthree hsize + (hHp.trans (Real.exp_le_exp.mpr hp3)) + obtain ⟨Huv, hHHuv, hHuv, hHuvp, dU, hdU, fU, dV, hdV, fV, hfU, hfV⟩ := hUV + have hkcard : (Fintype.card (Fin k) : ℝ) ≤ p := by simpa only [Fintype.card_fin] using hk + have hK := F.exists_gradedHorizontalKernel_quotient_basis e ω hF K bK hH + (fun j i => hKb i j) hp hkcard hHp + obtain ⟨Hk, _, hHkp, dK, hdK, fK, hfK⟩ := hK + let q := fastTerminalParameter p + have hcontrol := fastTerminalParameter_controls hp + have hpq : p ≤ q := hcontrol.1 + have hq : 0 ≤ q := hp.trans hpq + have hHH : H ≤ max Huv Hk := hHHuv.trans (le_max_left _ _) + have hcommon : ((max Huv Hk : ℕ) : ℝ) ≤ Real.exp q := by + rw [Nat.cast_max] + exact max_le (hHuvp.trans (Real.exp_le_exp.mpr hcontrol.2.1)) + (hHkp.trans (Real.exp_le_exp.mpr hcontrol.2.2)) + have hdim (d : ℕ) (hd : d ≤ Fintype.card ι) : (Fintype.card (Fin d) : ℝ) ≤ q := by + rw [Fintype.card_fin] + exact (Nat.cast_le.mpr hd).trans (hι.trans hpq) + have hstructureG (i j r : ι) : + RationalHeightLE ((F.associatedGradedBasis e ω hF).repr + ⁅F.associatedGradedBasis e ω hF i, F.associatedGradedBasis e ω hF j⁆ r) (max Huv Hk) := by + rw [F.associatedGradedBasis_bracket e ω hF] + split_ifs + · exact (hstructure i j r).mono hHH + · exact rationalHeightLE_zero (hH.trans hHH) + have hout : F.FastTerminalFactorization e ω hF W η T X.P ((q + c) ^ c) := + hformal F.associatedGradedFiltration (F.associatedGradedBasis e ω hF) ω + (F.associatedGradedFiltration_layer e ω hF) (F.associatedGradedBasis_homogeneous_brackets e ω hF) + (by omega) (F.fullFastGradedDiagonal W) (F.fullFastGradedRelative e ω hF W) + (F.gradedHorizontalKernel e ω hF K) + (fun _ hu _ hv => F.fullFastGradedRelative_lie_mem e ω hF W hu hv) + (F.fullFastGradedDiagonal_graded e ω hF W hW) (F.fullFastGradedRelative_graded e ω hF W hW) + η hη (F.gradedHorizontalKernelBasis e ω hF K bK) fV fU fK + (F.gradedHorizontalKernel_real_pure e ω hF K) (hHuv.trans (le_max_left _ _)) + (fun i j => (F.gradedHorizontalKernelBasis_height e ω hF K bK hH (fun z r => hKb r z) j i).mono hHH) + (fun i j => (hfV i j).mono (le_max_left _ _)) + (fun i j => (hfU i j).mono (le_max_left _ _)) + (fun i j => (hfK i j).mono (le_max_right _ _)) hstructureG hq + (hι.trans hpq) (hdim dU hdU) (hdim dK hdK) (hdim dV hdV) (hkcard.trans hpq) + (hσ.trans hpq) (hsp.trans hpq) hcommon T + (fun i => (Real.exp_le_exp.mpr (hbudget p hp)).trans (hT i)) (X.enlarge hpq hTpos) + exact hout.mono F e ω hF W (hbudget p hp) hTpos + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "bG" => F.associatedGradedBasis e ω hF +local notation "SG" => F.RealPolynomialSymbolGroup (fun _ : σ => 1) +local notation "φ" => F.realGradedSymbolPolynomialHom e ω hF (fun _ : σ => 1) + +def SymbolTerminalFactorization (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (T : σ → ℝ) (original : SG) (p : ℝ) : Prop := + ∃ Z : LieSubalgebra ℚ F.AssociatedGraded, BasisGradedSubmodule bG ω Z.toSubmodule ∧ + (∀ x ∈ Z, η (basisGradeProjection bG ω (s + 1) x) = 0) ∧ + ∃ bZ : Basis (Fin (Module.finrank ℚ Z)) ℚ Z, + (∀ i j, (((bG).repr (bZ i : F.AssociatedGraded) j).num.natAbs : ℝ) ≤ Real.exp p ∧ + (((bG).repr (bZ i : F.AssociatedGraded) j).den : ℝ) ≤ Real.exp p) ∧ + ∃ A P B : SG, A * P * B = original ∧ + A.coord ∈ realificationLieSubalgebra + (F.symbolPointwiseSubalgebra e ω hF (fun _ : σ => 1) (F.fullFastGradedDiagonal W)) ∧ + B.coord ∈ realificationLieSubalgebra + (F.symbolPointwiseSubalgebra e ω hF (fun _ : σ => 1) (F.fullFastGradedDiagonal W)) ∧ + P.coord ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra e ω hF (fun _ : σ => 1) Z) ∧ + F.SymbolSlowBound e ω hF (fun _ : σ => 1) T (Real.exp p) A ∧ + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp p ∧ F.SymbolRationalGrid e ω hF (fun _ : σ => 1) m B + +theorem symbolTerminalFactorization_of_graded + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) (T : σ → ℝ) (original : SG) (p : ℝ) + (h : F.FastTerminalFactorization e ω hF W η T (φ original) p) : + F.SymbolTerminalFactorization e ω hF W η T original p := by + obtain ⟨Z, hZ, hZη, bZ, hbZ, A, P, B, hfactor, hA, hB, _, hdegree, hcoeff, + hbound, m, hm, hmp, hgrid⟩ := h + obtain ⟨a, ha⟩ := F.exists_symbol_of_gradedPolynomial e ω hF (fun _ : σ => 1) A hA.2.1 + obtain ⟨c, hc⟩ := F.exists_symbol_of_gradedPolynomial e ω hF (fun _ : σ => 1) P hdegree + obtain ⟨b, hb⟩ := F.exists_symbol_of_gradedPolynomial e ω hF (fun _ : σ => 1) B hB.2.1 + refine ⟨Z, hZ, hZη, bZ, hbZ, a, c, b, ?_, ?_, ?_, ?_, ?_, m, hm, hmp, ?_⟩ + · apply F.realGradedSymbolPolynomialHom_injective e ω hF (fun _ : σ => 1) + rw [map_mul, map_mul, ha, hc, hb] + exact hfactor + · apply (F.mem_real_symbolPointwiseSubalgebra_iff_coefficients e ω hF (fun _ : σ => 1) + (F.fullFastGradedDiagonal W) a.coord).mpr + intro α + change coefficients (φ a).coord α ∈ _ + rw [ha] + exact hA.1 α + · apply (F.mem_real_symbolPointwiseSubalgebra_iff_coefficients e ω hF (fun _ : σ => 1) + (F.fullFastGradedDiagonal W) b.coord).mpr + intro α + change coefficients (φ b).coord α ∈ _ + rw [hb] + exact hB.1 α + · apply (F.mem_real_symbolPointwiseSubalgebra_iff_coefficients e ω hF (fun _ : σ => 1) Z c.coord).mpr + intro α + change coefficients (φ c).coord α ∈ _ + rw [hc] + exact hcoeff α + · apply F.symbolSlowBound_of_gradedPolynomial e ω hF (fun _ : σ => 1) T (Real.exp p) a + rw [ha] + exact hbound + · apply F.symbolRationalGrid_of_gradedPolynomial e ω hF (fun _ : σ => 1) m b + rw [hb] + exact hgrid + +theorem symbolTerminalFactorization_of_native + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) (T : σ → ℝ) + (g : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) (p : ℝ) + (h : F.FastTerminalFactorization e ω hF W η T + (F.realAdaptedGradedPolynomialHom e ω hF (fun _ : σ => 1) g) p) : + F.SymbolTerminalFactorization e ω hF W η T + (F.realPolynomialSymbolHom e ω hF (fun _ : σ => 1) (F.realAdaptedPolynomialGroupHom (fun _ => 1) g)) p := by + apply F.symbolTerminalFactorization_of_graded e ω hF W η T _ p + rw [F.realGradedSymbolPolynomialHom_native] + exact h + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem SymbolTerminalFactorization.mono + {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + {η : F.AssociatedGraded →ₗ[ℚ] ℚ} {T : σ → ℝ} + {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} {p q : ℝ} + (h : F.SymbolTerminalFactorization b ω hF W η T X p) (hpq : p ≤ q) + (hT : ∀ i, 0 < T i) : F.SymbolTerminalFactorization b ω hF W η T X q := by + obtain ⟨Z, hZ, hη, bZ, hbZ, A, P, B, hprod, hA, hB, hP, hslow, m, hm, hmp, hgrid⟩ := h + have he := Real.exp_le_exp.mpr hpq + exact ⟨Z, hZ, hη, bZ, (fun i j => ⟨(hbZ i j).1.trans he, (hbZ i j).2.trans he⟩), + A, P, B, hprod, hA, hB, hP, + F.symbolSlowBound_mono b ω hF (fun _ => 1) T hT he A hslow, m, hm, hmp.trans he, hgrid⟩ + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (w : σ → ℕ) + +theorem native_symbol_slow (T : σ → ℝ) (hT : ∀ i, 0 < T i) {M : ℝ} (hM : 0 ≤ M) + (g : F.RealAdaptedPolynomialGroup w) (hg : F.RealAdaptedCoefficientBound b ω hF w T M g.coord) : + F.SymbolSlowBound b ω hF w T M + (F.realPolynomialSymbolHom b ω hF w (F.realAdaptedPolynomialGroupHom w g)) := + F.polynomialSlowBound_symbol b ω hF w T M (F.realAdaptedPolynomialGroupHom w g) + ((F.realAdaptedCoefficientBound_polynomial_iff b ω hF w T hT hM g).mp hg) + +theorem native_symbol_grid (l : ℕ) (g : F.RealAdaptedPolynomialGroup w) + (hg : F.RealAdaptedCoefficientGrid b ω hF w l g.coord) : + F.SymbolRationalGrid b ω hF w l + (F.realPolynomialSymbolHom b ω hF w (F.realAdaptedPolynomialGroupHom w g)) := + F.polynomialRationalGrid_symbol b ω hF w l (F.realAdaptedPolynomialGroupHom w g) + ((F.realAdaptedCoefficientGrid_polynomial_iff b ω hF w l g).mp hg) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem SymbolTerminalFactorization.controlled + {σ ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + {η : L →ₗ[ℚ] ℚ} {T : σ → ℝ} {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} {p : ℝ} + (hp : 0 ≤ p) (hT : ∀ i, 0 < T i) + (h : F.SymbolTerminalFactorization b ω hF W (F.gradedFrequency b ω hF η) T X p) : + F.ControlledSymbolFactorization b ω hF η T X (p + 1) := by + classical + obtain ⟨Z, hZ, hη, bZ, hbZ, A, P, B, hprod, _, _, hP, hslow, m, hm, hmp, hgrid⟩ := h + let H := ⌈Real.exp p⌉₊ + have hH : 1 ≤ H := one_le_ceil_exp p + have hb : ∀ i j, RationalHeightLE + ((F.associatedGradedBasis b ω hF).repr (bZ i : F.AssociatedGraded) j) H := by + intro i j + exact rationalHeightLE_ceil_exp ((rationalLogHeight_le_iff _ p).mpr (hbZ i j)) + obtain ⟨w, hw, hheight⟩ := exists_bounded_ambient_spanning + (F.associatedGradedBasis b ω hF) Z bZ bZ.span_eq hH hb + let v : ι → F.AssociatedGraded := fun i => w (Fintype.equivFin ι i) + have hrange : Set.range v = Set.range w := by + ext x + constructor + · rintro ⟨i, rfl⟩ + exact ⟨Fintype.equivFin ι i, rfl⟩ + · rintro ⟨i, rfl⟩ + exact ⟨(Fintype.equivFin ι).symm i, congrArg w ((Fintype.equivFin ι).apply_symm_apply i)⟩ + have he : Real.exp p ≤ Real.exp (p + 1) := Real.exp_le_exp.mpr (by linarith) + refine ⟨m, A, P, B, Z, v, hm, hmp.trans he, hprod, + F.symbolSlowBound_mono b ω hF (fun _ => 1) T hT he A hslow, hgrid, ?_, hZ, ?_, ?_, hP⟩ + · rw [hrange] + exact hw + · intro i j + exact rationalLogHeight_le_of_height (hheight (Fintype.equivFin ι i) j) (ceil_exp_le_exp_add_one hp) + · intro x hx hproj + have hz := hη x hx + rw [hproj] at hz + exact hz + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedCyclicDetection.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedCyclicDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..75f8183ffba52bc1a8a2b8ffe4a65baf5237c7da --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedCyclicDetection.lean @@ -0,0 +1,46 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialCyclicDetection + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +universe u + +theorem finiteCorrelation_translate_right {H : Type*} [AddCommGroup H] [Fintype H] + (f u : H → ℂ) (a : H) : + finiteCorrelation Finset.univ f (fun x => u (a + x)) = + finiteCorrelation Finset.univ (fun x => f (-a + x)) u := by + simpa only [finiteCorrelation, add_neg_cancel_left] using + (expect_translate (fun x => f x * star (u (a + x))) (-a)).symm + +theorem exists_polynomial_translated_cyclic_detection (s : ℕ) (P : Polynomial ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {L : Type u} [LieRing L] [LieAlgebra ℚ L] {d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L s d) (p : ℝ), 0 ≤ p → + ∀ (w : Fin 1 → ℕ), (∀ i, 0 < w i) → + ∀ (T : D.Niltest w), T.ComplexityLE (P.eval₂ (Nat.castRingHom ℝ) p) → + ∀ (N : ℕ) [NeZero N] (a : ZMod N) (f : ZMod N → ℂ), + (∀ x, ‖f x‖ ≤ 1) → + Real.exp (-p) ≤ ‖finiteCorrelation Finset.univ f + (fun x => T.eval (fun _ => ((a + x).val : ℤ)))‖ → + Real.exp (-((p + C) ^ C)) ≤ gowersNorm (s + 1) f := by + obtain ⟨C, hC, hdet⟩ := exists_polynomial_cyclic_detection.{u} s P + refine ⟨C, hC, ?_⟩ + intro L _ _ d _ _ _ _ D p hp w hw T hT N _ a f hf hc + have hc' : Real.exp (-p) ≤ ‖finiteCorrelation Finset.univ (fun x => f (-a + x)) + (fun x => T.eval (fun _ => (x.val : ℤ)))‖ := by + rwa [finiteCorrelation_translate_right f (fun x => T.eval (fun _ => (x.val : ℤ))) a] at hc + have hh := hdet D p hp w hw T hT N (fun x => f (-a + x)) (fun x => hf _) hc' + simpa only [gowersNorm_translate] using hh + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedLocalAverage.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedLocalAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0e245d5ba88b57ff79e2dea55f02482f81b2418 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedLocalAverage.lean @@ -0,0 +1,47 @@ +import OAI.Combinatorics.Progressions.Estimates.LocalMomentScale + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [Fintype G] [DecidableEq G] [AddCommGroup G] + +theorem exists_translated_local_average + (S T : Finset G) (hS : S.Nonempty) (hT : T.Nonempty) (f : G → ℝ) + {M eta : ℝ} (hM : 0 ≤ M) (hf : ∀ x, |f x| ≤ M) + (hTV : ∀ t ∈ T, (∑ x, |realUniformMass S (x - t) - realUniformMass S x|) ≤ eta) : + ∃ b ∈ S, (𝔼 a ∈ S, 𝔼 x ∈ S, f (a - x)) - M * eta ≤ + 𝔼 a ∈ S, 𝔼 t ∈ T, f (a - (b + t)) := by + have hsingle (a t : G) (ht : t ∈ T) : + (𝔼 b ∈ S, f (a - b)) - M * eta ≤ 𝔼 b ∈ S, f (a - (b + t)) := by + have h := (abs_expect_add_sub_le S (fun b => f (a - b)) t + (fun b => hf (a - b))).trans (mul_le_mul_of_nonneg_left (hTV t ht) hM) + have hlower := (abs_le.mp h).1 + linarith + have hlocal (t : G) (ht : t ∈ T) : + (𝔼 a ∈ S, 𝔼 b ∈ S, f (a - b)) - M * eta ≤ + 𝔼 a ∈ S, 𝔼 b ∈ S, f (a - (b + t)) := by + have h := Finset.expect_le_expect (fun a (_ : a ∈ S) => hsingle a t ht) + simpa only [Finset.expect_sub_distrib, Finset.expect_const hS] using h + have hglobal := Finset.expect_le_expect hlocal + rw [Finset.expect_const hT] at hglobal + have hreorder : (𝔼 t ∈ T, 𝔼 a ∈ S, 𝔼 b ∈ S, f (a - (b + t))) = + 𝔼 b ∈ S, 𝔼 a ∈ S, 𝔼 t ∈ T, f (a - (b + t)) := by + calc + _ = 𝔼 a ∈ S, 𝔼 b ∈ S, 𝔼 t ∈ T, f (a - (b + t)) := by + rw [Finset.expect_comm T S] + apply Finset.expect_congr rfl + intro a _ + exact Finset.expect_comm T S _ + _ = _ := Finset.expect_comm S S _ + exact Finset.exists_le_of_le_expect hS (hglobal.trans_eq hreorder) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedSelectedNormalization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedSelectedNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..301598d710e610b69066a061b419c6ea4294a377 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedSelectedNormalization.lean @@ -0,0 +1,106 @@ +import OAI.Combinatorics.Progressions.Sampling.ExplicitSpatialSampler + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule MeasureTheory +open scoped BigOperators NNReal + +theorem exists_translated_selected_sampler_normalization (m : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {X G : Type*} [Fintype X] [DecidableEq X] [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (R σ : Fin m → ℝ) (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (_hσ1 : ∀ j, σ j ≤ 1) + (C V : Fin m → ℝ≥0) + (_hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ)+1) * R j ≤ 1/4) + (L₀ : ℕ) {P δ : ℝ} (_hP : 0 ≤ P) (_hδ : 0 < δ) (_hδsmall : δ ≤ 1/6) + (_hδP : δ⁻¹ ≤ Real.exp P) (_hX : (Fintype.card X : ℝ) ≤ P) + (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) (_hL₀P : (L₀ : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val+1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) + (stride : X → ℕ) (_hs : ∀ k, 0 < stride k) + {Rrank S ρ : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) + (_hρ : 0 < ρ) (_hρP : 1/ρ ≤ Real.exp P) + (H : X → ℝ) (_hsize : ∀ k, Real.exp ((P+A)^A) ≤ H k) + (_hrank : ∀ j, HasLayerSamplingRank (j.val+1) H Rrank (U j) (p j)) + (_hRrank : Real.exp ((P+A)^A) ≤ Rrank) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty) + (W : Option (LayerSamplerVariables G I n B) × X → ℝ) (hW : ∀ z, 0 < W z) + (_hwidth : ∀ z, ρ * H z.2 ≤ W z), + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride T W z, + ∀ center : CoefficientTorus (K := LayerSamplerVariables G I n B) U, + let D := translatedSelectedPhysicalDensity (G := G) B U b hb o R σ hR hσ L₀ center p hm + let Z := selectedResidueDensityMass stride T W D + 0 < Z ∧ |Z-1| ≤ 3*δ ∧ 1/2 ≤ Z ∧ Z ≤ 3/2 ∧ + ∃ q : PMF (Option (LayerSamplerVariables G I n B) × X → ℤ), + ∀ z, (q z).toReal = (selectedResidueSmoothPMF stride T W hW hZ z).toReal * D z / Z := by + obtain ⟨A, hA, hmass⟩ := exists_polynomial_coefficient_density_mass m (selectedFourierExponent m) + refine ⟨A, hA, ?_⟩ + intro X G _ _ _ I _ n B _ J _ U b hb o _ _ _ _ μ _ _ ν _ _ + R σ hR hσ hσ1 C V hC hV Cinv hCinv hchart hsmall L₀ P δ hP hδ hδsmall hδP + hX hK hI hn hJ hAP hL₀P hCP hVP hRP hσP p hp hm stride hs Rrank S ρ + hS hSP hstride hρ hρP H hsize hrank hRrank T hT W hW hwidth + let scale := selectedLayerSamplerScale (G := G) B U b R σ hR hσ L₀ + let D₀ := selectedCoefficientDensity (G := G) B U b hb o R σ hR hσ L₀ + have hspec := allocatedCoefficientDensity_spec B U b hb o hR hσ scale + hσ1 Cinv hCinv hchart hsmall μ ν + obtain ⟨F, inst, frequency, c, _, hfreq, hcoeff, happrox⟩ := + exists_selected_coefficient_uniform_fourier (G := G) B U b hb o C V hC hV R σ hR hσ hσ1 + Cinv hCinv hchart hsmall L₀ hP hK hRP hσP hI hn hJ hAP hL₀P hCP hVP hδ hδP + let _ := inst + have hcenter (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) := + hmass hP hX hK U μ frequency hfreq + (fun a => c a * coefficientTorusCharacter U (frequency a) center) + (by rw [coefficientFourier_translate_norm]; exact hcoeff) + p hp hm stride hs hS hSP hρ hδ hρP (by simpa only [one_div] using hδP) + hstride H hsize hrank hRrank T hT W hW hwidth (fun x => D₀ (center+x)) + (hspec.2.2.1.comp_add_left center) + ((integral_add_left_eq_self (μ := μ) D₀ center).trans hspec.2.2.2.1) + hδ.le (coefficientFourier_translate_approx U D₀ frequency c happrox center) + obtain ⟨hZ, _⟩ := hcenter 0 + refine ⟨hZ, ?_⟩ + intro center + obtain ⟨_, hclose⟩ := hcenter center + let D := translatedSelectedPhysicalDensity (G := G) B U b hb o R σ hR hσ L₀ center p hm + let Z := selectedResidueDensityMass stride T W D + change |Z-1| ≤ 2*δ+δ at hclose + have hclose' : |Z-1| ≤ 3*δ := by linarith + have hlower : 1/2 ≤ Z := by have h := (abs_le.mp hclose').1; linarith + have hupper : Z ≤ 3/2 := by have h := (abs_le.mp hclose').2; linarith + have hpos : 0 < Z := by linarith + have hD0 := translatedSelectedPhysicalDensity_nonneg (G := G) B U b hb o R σ hR hσ L₀ center p hm + refine ⟨hpos, hclose', hlower, hupper, selectedResidueDensityPMF stride T W hW hZ D hD0 hpos, ?_⟩ + exact selectedResidueDensityPMF_toReal stride T W hW hZ D hD0 hpos + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedSelectedOneSite.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedSelectedOneSite.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3dda1251646265619e7eb505ef92c62f06732f6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedSelectedOneSite.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Sampling.ExplicitSpatialSampler + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule MeasureTheory VectorPolynomial +open scoped BigOperators NNReal + +theorem exists_translated_selected_sampler_oneSite_comparison (m : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {X G : Type*} [Fintype X] [DecidableEq X] [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (R σ : Fin m → ℝ) (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (_hσ1 : ∀ j, σ j ≤ 1) + (C V : Fin m → ℝ≥0) + (_hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ)+1) * R j ≤ 1/4) + (L₀ : ℕ) {P δ : ℝ} (_hP : 0 ≤ P) (_hδ : 0 < δ) (_hδP : δ⁻¹ ≤ Real.exp P) + (_hX : (Fintype.card X : ℝ) ≤ P) (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) (_hL₀P : (L₀ : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (root : LayerSamplerVariables G I n B → ℤ) (_hroot : ∀ k, |(root k : ℝ)| ≤ Real.exp P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val+1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) + (stride : X → ℕ) (_hs : ∀ k, 0 < stride k) + {Rrank S ρ : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) + (_hρ : 0 < ρ) (_hρP : 1/ρ ≤ Real.exp P) + (H : X → ℝ) (_hsize : ∀ k, Real.exp ((P+A)^A) ≤ H k) + (_hrank : ∀ j, HasLayerSamplingRank (j.val+1) H Rrank (U j) (p j)) + (_hRrank : Real.exp ((P+A)^A) ≤ Rrank) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty) + (W : Option (LayerSamplerVariables G I n B) × X → ℝ) (hW : ∀ z, 0 < W z) + (_hwidth : ∀ z, ρ * H z.2 ≤ W z) + (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) + (φ : (X → ℝ) → ℂ) (_hφ : ∀ v, ‖φ v‖ ≤ 1), + let D := fun x => VectorPolynomial.selectedCoefficientDensity (G := G) B U b hb o R σ hR hσ L₀ (center+x) + let sample := fun z : Option (LayerSamplerVariables G I n B) × X → ℤ => + affineSampleCoefficientTorus U p hm (fun k j => (z (k,j) : ℝ)) + let fiber := fun z => coefficientFiberAverage U μ root D (coefficientEvaluationTorus U root (sample z)) + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride T W z, + ‖(∑' z, ((selectedResidueSmoothPMF stride T W hW hZ z).toReal : ℂ) * + (φ (physicalAffineSite root z) * (D (sample z) : ℂ))) - + (∑' z, ((selectedResidueSmoothPMF stride T W hW hZ z).toReal : ℂ) * + (φ (physicalAffineSite root z) * (fiber z : ℂ)))‖ ≤ 3*δ := by + obtain ⟨A, hA, hcomparison⟩ := exists_polynomial_oneSite_comparison m (selectedFourierExponent m) + refine ⟨A, hA, ?_⟩ + intro X G _ _ _ I _ n B _ J _ U b hb o _ _ μ _ _ + R σ hR hσ hσ1 C V hC hV Cinv hCinv hchart hsmall L₀ P δ hP hδ hδP + hX hK hI hn hJ hAP hL₀P hCP hVP hRP hσP root hroot p hp hm stride hs Rrank S ρ + hS hSP hstride hρ hρP H hsize hrank hRrank T hT W hW hwidth center φ hφ + obtain ⟨F, inst, frequency, c, _, hfreq, hcoeff, happrox⟩ := + exists_selected_coefficient_uniform_fourier (G := G) B U b hb o C V hC hV R σ hR hσ hσ1 + Cinv hCinv hchart hsmall L₀ hP hK hRP hσP hI hn hJ hAP hL₀P hCP hVP hδ hδP + let _ := inst + let D₀ := VectorPolynomial.selectedCoefficientDensity (G := G) B U b hb o R σ hR hσ L₀ + have hfiber := selectedCoefficientDensity_translate_fiber_integrable (G := G) B U b hb o R σ hR hσ L₀ + C V hC hV hσ1 Cinv hCinv hchart hsmall μ center root + obtain ⟨hZ, he⟩ := hcomparison hP hX hK U μ root hroot frequency hfreq + (fun a => c a * coefficientTorusCharacter U (frequency a) center) + (by rw [coefficientFourier_translate_norm]; exact hcoeff) + p hp hm stride hs hS hSP hρ hδ hρP (by simpa only [one_div] using hδP) + hstride H hsize hrank hRrank T hT W hW hwidth (fun x => D₀ (center+x)) + hfiber hδ.le (coefficientFourier_translate_approx U D₀ frequency c happrox center) φ hφ + exact ⟨hZ, he.trans_eq (by ring)⟩ + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedShiftTesting.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedShiftTesting.lean new file mode 100644 index 0000000000000000000000000000000000000000..6620cf8e37959cf985bd13c488c2aeb2218cd179 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedShiftTesting.lean @@ -0,0 +1,427 @@ +import OAI.Combinatorics.Progressions.Geometry.NativeIntervalCoordinate +import OAI.Combinatorics.Progressions.Nilpotent.NativeNiltestPartition +import OAI.Combinatorics.Progressions.Nilpotent.NiltestComplement + +namespace OAI + +universe u + +section + +namespace Erdos3 + +theorem exists_cyclic_partition_offsets {I : Type*} {N : ℕ} [NeZero N] + (A : I → ZMod N → ℝ) (h : ZMod N) {ρ : ℝ} (hρ : 0 < ρ) + (hdiam : ∀ i x y, 0 < A i x → 0 < A i y → + dist (ZMod.toAddCircle x) (ZMod.toAddCircle y) ≤ ρ) : + ∃ b : I → ℤ, ∀ i x, x ∉ cyclicWrapExceptional h ρ → 0 < A i x → + ((h + x).val : ℤ) = (x.val : ℤ) + b i := by + classical + have hlocal (i : I) : ∃ b : ℤ, ∀ x, x ∉ cyclicWrapExceptional h ρ → 0 < A i x → + ((h + x).val : ℤ) = (x.val : ℤ) + b := by + by_cases hex : ∃ y, y ∉ cyclicWrapExceptional h ρ ∧ 0 < A i y + · obtain ⟨y, hy, hAy⟩ := hex + refine ⟨((h + y).val : ℤ) - (y.val : ℤ), ?_⟩ + intro x hx hAx + have he := cyclic_representative_difference_of_good_circle h x y hρ hx hy + (hdiam i x y hAx hAy) + linarith + · exact ⟨0, fun x hx hAx => False.elim (hex ⟨x, hx, hAx⟩)⟩ + choose b hb using hlocal + exact ⟨b, hb⟩ + +end Erdos3 + +end + +section + +namespace Erdos3.PositiveCyclicNiltest + +open scoped TensorProduct BigOperators + +theorem mul {degree N : ℕ} [NeZero N] {p : ℝ} {f g : ZMod N → ℝ} + (hf : PositiveCyclicNiltest.{u} degree N p f) + (hg : PositiveCyclicNiltest.{u} degree N p g) (hp : 0 ≤ p) : + PositiveCyclicNiltest.{u} degree N (productNiltestBudget (raisedNiltestBudget p)) + (fun x => f x * g x) := by + rcases hf with @⟨L₁, lie₁, alg₁, s₁, dim₁, top₁, add₁, smul₁, t2₁, D₁, hs₁, A, hA, hAc, hevalA⟩ + rcases hg with @⟨L₂, lie₂, alg₂, s₂, dim₂, top₂, add₂, smul₂, t2₂, D₂, hs₂, B, hB, hBc, hevalB⟩ + let K : Bool → Type u := BoolLieFamily L₁ L₂ + let dims : Bool → ℕ := fun b => Bool.rec dim₂ dim₁ b + let D : ∀ b, RationalFilteredNilmanifold (K b) degree (dims b) := fun b => by + cases b + · exact D₂.raiseStep hs₂ + · exact D₁.raiseStep hs₁ + let U : ∀ b, (D b).Niltest (fun _ : Unit => 1) := fun b => by + cases b + · exact B.raiseStep hs₂ + · exact A.raiseStep hs₁ + have hUc : ∀ b, (U b).ComplexityLE (raisedNiltestBudget p) := by + intro b + cases b + · exact B.raiseStep_complexity hs₂ hp hBc + · exact A.raiseStep_complexity hs₁ hp hAc + have hU : ∀ b, (U b).UnitIntervalValued := by + intro b + cases b + · exact B.raiseStep_unit_interval hs₂ hB + · exact A.raiseStep_unit_interval hs₁ hA + have hp' : 0 ≤ raisedNiltestBudget p := hp.trans (le_raisedNiltestBudget p) + have hcard : (Fintype.card Bool : ℝ) ≤ raisedNiltestBudget p := by + norm_num only [Fintype.card_bool, Nat.cast_ofNat] + unfold raisedNiltestBudget + nlinarith [sq_nonneg (p + 2)] + let : FiniteDimensional ℚ (∀ b, K b) := + (RationalFilteredNilmanifold.productFinBasis D).finiteDimensional_of_finite + let := moduleTopology ℝ (ℝ ⊗[ℚ] (∀ b, K b)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (∀ b, K b)) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] (∀ b, K b)) := + realification_moduleTopology_t2 (RationalFilteredNilmanifold.productFinBasis D) + let S := RationalFilteredNilmanifold.piNiltest D U hp' hcard hUc + have hSc := RationalFilteredNilmanifold.piNiltest_complexity D U hp' hcard hUc + have hSu := RationalFilteredNilmanifold.piNiltest_unit_interval D U hp' hcard hUc hU + have heval (x : ZMod N) : S.evalCyclic N (fun _ : Unit => x) = + A.evalCyclic N (fun _ : Unit => x) * B.evalCyclic N (fun _ : Unit => x) := by + change (RationalFilteredNilmanifold.piNiltest D U hp' hcard hUc).eval + (fun _ : Unit => (x.val : ℤ)) = _ + rw [RationalFilteredNilmanifold.piNiltest_eval, Fintype.prod_bool] + change (A.raiseStep hs₁).eval (fun _ : Unit => (x.val : ℤ)) * + (B.raiseStep hs₂).eval (fun _ : Unit => (x.val : ℤ)) = _ + rw [RationalFilteredNilmanifold.Niltest.raiseStep_eval, + RationalFilteredNilmanifold.Niltest.raiseStep_eval] + rfl + refine .of_test (RationalFilteredNilmanifold.pi D) le_rfl S hSu hSc ?_ + intro x + rw [heval, Complex.mul_re, (A.unit_interval_evalCyclic hA N (fun _ => x)).1, + (B.unit_interval_evalCyclic hB N (fun _ => x)).1, zero_mul, sub_zero, hevalA x, hevalB x] + +end Erdos3.PositiveCyclicNiltest + +end + +section + +namespace Erdos3 + +open scoped TensorProduct + +theorem exists_interval_circle_partition (a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ (N : ℕ) [NeZero N] {p ρ : ℝ}, + 0 ≤ p → 0 < ρ → 1 / ρ ≤ Real.exp ((p + 2) ^ a) → + ∃ n : ℕ, 0 < n ∧ (n : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ A : Fin n → ZMod N → ℝ, + (∀ j, PositiveCyclicNiltest.{0} 1 N ((p + C) ^ C) (A j)) ∧ + (∀ x, ∑ j, A j x = 1) ∧ + ∀ j x y, 0 < A j x → 0 < A j y → + dist (ZMod.toAddCircle x) (ZMod.toAddCircle y) ≤ ρ := by + obtain ⟨B, _, hpartition⟩ := RationalFilteredNilmanifold.exists_native_niltest_partition 1 a + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((Polynomial.X + 1 + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro N _ p ρ hp hρ hρinv + let D := RationalTorus.nilmanifold 1 + let G := RationalTorus.intervalOrbit N + have hD : D.GeometryComplexityLE (p + 1) := + RationalTorus.nilmanifold_geometry 1 (by linarith) (by norm_num; linarith) + have hρinv' : 1 / ρ ≤ Real.exp (((p + 1) + 2) ^ a) := + hρinv.trans (Real.exp_le_exp.mpr (pow_le_pow_left₀ (by linarith) (by linarith) _)) + obtain ⟨n, hn, hnb, tests, horbit, hunit, hcomplexity, hsum, hdiam⟩ := + hpartition D (fun _ : Unit => 1) (by linarith) hD hρ hρinv' G + have hcost : (p + 1 + B) ^ B ≤ (p + C) ^ C := by + simpa [Polynomial.eval₂_pow] using hbudget p hp + let A : Fin n → ZMod N → ℝ := fun j x => ((tests j).evalCyclic N (fun _ : Unit => x)).re + have heval (j : Fin n) (x : ZMod N) : + A j x = ((tests j).observable (D.cyclicOrbitPoint G N (fun _ : Unit => x))).re := by + change ((tests j).observable (QuotientGroup.mk + (D.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) + (fun _ => (x.val : ℤ)) (tests j).orbit))).re = _ + rw [horbit j] + rfl + refine ⟨n, hn, hnb.trans (Real.exp_le_exp.mpr hcost), A, ?_, ?_, ?_⟩ + · intro j + exact .of_test D le_rfl (tests j) (hunit j) ((hcomplexity j).mono hcost) (fun _ => rfl) + · intro x + simpa only [heval] using hsum (D.cyclicOrbitPoint G N (fun _ : Unit => x)) + · let := D.metricSpace + intro j x y hx hy + have hd := hdiam j _ _ ((heval j x) ▸ hx) ((heval j y) ▸ hy) + have hp := RationalTorus.intervalCoordinate_lipschitz.dist_le_mul + (D.cyclicOrbitPoint G N (fun _ : Unit => x)) (D.cyclicOrbitPoint G N (fun _ : Unit => y)) + change dist (RationalTorus.phaseProjection 1 (D.cyclicOrbitPoint G N (fun _ : Unit => x)) 0) + (RationalTorus.phaseProjection 1 (D.cyclicOrbitPoint G N (fun _ : Unit => y)) 0) ≤ + (1 : ℝ) * dist (D.cyclicOrbitPoint G N (fun _ : Unit => x)) + (D.cyclicOrbitPoint G N (fun _ : Unit => y)) at hp + rw [RationalTorus.intervalOrbit_phase, RationalTorus.intervalOrbit_phase, one_mul] at hp + exact hp.trans hd + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +theorem exists_positive_translation_partition {I : Type*} [Fintype I] + {degree N : ℕ} [NeZero N] {p ρ : ℝ} (hp : 0 ≤ p) (hρ : 0 < ρ) + (f : ZMod N → ℝ) (hf : PositiveCyclicNiltest.{0} degree N p f) + (A : I → ZMod N → ℝ) (hA : ∀ i, PositiveCyclicNiltest.{0} degree N p (A i)) + (hsum : ∀ x, ∑ i, A i x = 1) + (hdiam : ∀ i x y, 0 < A i x → 0 < A i y → + dist (ZMod.toAddCircle x) (ZMod.toAddCircle y) ≤ ρ) (h : ZMod N) : + ∃ U : I → ZMod N → ℝ, + (∀ i, PositiveCyclicNiltest.{0} degree N + (productNiltestBudget (raisedNiltestBudget p)) (U i)) ∧ + (∀ x, 0 ≤ ∑ i, U i x ∧ ∑ i, U i x ≤ 1) ∧ + (∀ x, x ∉ cyclicWrapExceptional h ρ → f (h + x) = ∑ i, U i x) ∧ + (𝔼 x, |f (h + x) - ∑ i, U i x|) ≤ 6 * ρ + 3 / N := by + classical + have hfunit (x) := hf.unit_interval x + obtain ⟨b, hb⟩ := exists_cyclic_partition_offsets A h hρ hdiam + rcases hf with @⟨L, lie, alg, s, dim, top, add, smul, t2, D, hs, T, hT, hTc, heval⟩ + let g : I → ZMod N → ℝ := fun i x => (T.eval (fun _ => (x.val : ℤ) + b i)).re + have hg (i) : PositiveCyclicNiltest.{0} degree N p (g i) := by + refine .of_test D hs (T.translate (fun _ => Nat.zero_lt_one) (fun _ => b i)) hT hTc ?_ + intro x + simp only [g, RationalFilteredNilmanifold.Niltest.evalCyclic, + RationalFilteredNilmanifold.Niltest.eval_translate] + rfl + let U : I → ZMod N → ℝ := fun i x => A i x * g i x + have hgood (x) (hx : x ∉ cyclicWrapExceptional h ρ) : f (h + x) = ∑ i, U i x := by + have heach (i) : A i x * g i x = A i x * f (h + x) := by + by_cases hzero : A i x = 0 + · simp only [hzero, zero_mul] + · have hpos : 0 < A i x := lt_of_le_of_ne ((hA i).unit_interval x).1 (Ne.symm hzero) + have he : g i x = f (h + x) := by + rw [heval] + change (T.eval (fun _ => (x.val : ℤ) + b i)).re = + (T.eval (fun _ => ((h + x).val : ℤ))).re + rw [hb i x hx hpos] + rw [he] + simp only [U, heach, ← Finset.sum_mul, hsum, one_mul] + refine ⟨U, fun i => (hA i).mul (hg i) hp, ?_, hgood, ?_⟩ + · intro x + exact positive_partition_sum_unit_interval (fun i => A i x) (fun i => g i x) + (fun i => ((hA i).unit_interval x).1) (hsum x) (fun i => (hg i).unit_interval x) + · have hm := positive_partition_approximation_mean_error (cyclicWrapExceptional h ρ) + A g (fun x => f (h + x)) (by norm_num : (0 : ℝ) ≤ 0) + (fun i x => ((hA i).unit_interval x).1) hsum + (fun i x => (hg i).unit_interval x) (fun x => hfunit (h + x)) + (fun x hx => by + change |f (h + x) - ∑ i, U i x| ≤ 0 + simp only [← hgood x hx, sub_self, abs_zero, le_refl]) + have hm' : (𝔼 x, |f (h + x) - ∑ i, U i x|) ≤ + ((cyclicWrapExceptional h ρ).card : ℝ) / N := by + simpa only [U, zero_add, ZMod.card] using hm + exact hm'.trans (cyclicWrapExceptional_density_le h hρ.le) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_interval_refined_partition (a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {I : Type*} [Fintype I] {s N : ℕ} [NeZero N] + (A : I → ZMod N → ℝ) {p ρ : ℝ}, + 1 ≤ s → 0 ≤ p → (Fintype.card I : ℝ) ≤ Real.exp p → + (∀ i, PositiveCyclicNiltest.{0} s N p (A i)) → (∀ x, ∑ i, A i x = 1) → + 0 < ρ → 1 / ρ ≤ Real.exp ((p + 2) ^ a) → + ∃ n : ℕ, 0 < n ∧ (Fintype.card (I × Fin n) : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ U : (I × Fin n) → ZMod N → ℝ, + (∀ j, PositiveCyclicNiltest.{0} s N ((p + C) ^ C) (U j)) ∧ + (∀ x, ∑ j, U j x = 1) ∧ + (∀ j x, 0 < U j x → 0 < A j.1 x) ∧ + (∀ j x y, 0 < U j x → 0 < U j y → + dist (ZMod.toAddCircle x) (ZMod.toAddCircle y) ≤ ρ) ∧ + (∀ h : ZMod N, ((cyclicWrapExceptional h ρ).card : ℝ) / N ≤ 6 * ρ + 3 / N) ∧ + ∀ h j x y, x ∉ cyclicWrapExceptional h ρ → y ∉ cyclicWrapExceptional h ρ → + 0 < U j x → 0 < U j y → + |(x.val : ℝ) / N - (y.val : ℝ) / N| ≤ ρ ∧ + (N - h.val ≤ x.val ↔ N - h.val ≤ y.val) ∧ + ((h + x).val : ℤ) - ((h + y).val : ℤ) = (x.val : ℤ) - (y.val : ℤ) := by + obtain ⟨B, _, hinterval⟩ := exists_interval_circle_partition a + let X : Polynomial ℕ := Polynomial.X + let T := X + (X + Polynomial.C B) ^ B + let R := T + (T + 2) ^ 2 + 3 + let Q := (R + 2) ^ 2 + R + (R + (R ^ 2 + R + 3) ^ 2) + R ^ 2 + 4 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (2 * T + Q) + refine ⟨C, hC, ?_⟩ + intro I _ s N _ A p ρ hs hp hcard hA hsum hρ hρinv + obtain ⟨n, hn, hnb, V, hV, hVsum, hdiam⟩ := hinterval N hp hρ hρinv + let t := p + (p + B) ^ B + have hpt : p ≤ t := le_add_of_nonneg_right (pow_nonneg (by positivity) _) + have ht : 0 ≤ t := hp.trans hpt + have hBt : (p + B) ^ B ≤ t := le_add_of_nonneg_left hp + have hcost : 2 * t + productNiltestBudget (raisedNiltestBudget t) ≤ (p + C) ^ C := by + simpa [T, X, R, Q, t, Polynomial.eval₂_pow, productNiltestBudget, + productObservableLipBudget, raisedNiltestBudget] using hbudget p hp + have hQ0 : 0 ≤ productNiltestBudget (raisedNiltestBudget t) := by + unfold productNiltestBudget productObservableLipBudget raisedNiltestBudget + positivity + have hproduct : productNiltestBudget (raisedNiltestBudget t) ≤ (p + C) ^ C := by linarith + have htC : t ≤ (p + C) ^ C := by linarith + let U : (I × Fin n) → ZMod N → ℝ := fun j x => A j.1 x * V j.2 x + have hpositive (j : I × Fin n) (x : ZMod N) (hx : 0 < U j x) : + 0 < A j.1 x ∧ 0 < V j.2 x := by + change 0 < A j.1 x * V j.2 x at hx + rcases mul_pos_iff.mp hx with h | h + · exact h + · linarith [((hA j.1).unit_interval x).1] + refine ⟨n, hn, ?_, U, ?_, ?_, fun j x hx => (hpositive j x hx).1, + fun j x y hx hy => hdiam j.2 x y (hpositive j x hx).2 (hpositive j y hy).2, + fun h => cyclicWrapExceptional_density_le h hρ.le, ?_⟩ + · calc + _ = (Fintype.card I : ℝ) * n := by rw [Fintype.card_prod, Fintype.card_fin, Nat.cast_mul] + _ ≤ Real.exp p * Real.exp ((p + B) ^ B) := + mul_le_mul hcard hnb (Nat.cast_nonneg _) (Real.exp_pos _).le + _ = Real.exp t := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr htC + · intro j + exact (((hA j.1).mono le_rfl hpt).mul ((hV j.2).mono hs hBt) ht).mono le_rfl hproduct + · intro x + simp only [U, Fintype.sum_prod_type] + simp_rw [← Finset.mul_sum, hVsum, mul_one] + exact hsum x + · intro h j x y hx hy hUx hUy + have hxy := hdiam j.2 x y (hpositive j x hUx).2 (hpositive j y hUy).2 + exact ⟨good_circle_observations_control_representatives h x y hρ hx hy hxy, + cyclic_wrap_branch_eq_of_good_circle h x y hρ hx hy hxy, + cyclic_representative_difference_of_good_circle h x y hρ hx hy hxy⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem PositiveCyclicNiltest.eq_of_degree_zero {N : ℕ} [NeZero N] {p : ℝ} + {f : ZMod N → ℝ} (hf : PositiveCyclicNiltest.{u} 0 N p f) (x y : ZMod N) : + f x = f y := by + rcases hf with ⟨D, hs, T, _, _, heval⟩ + have hz : _ = 0 := Nat.eq_zero_of_le_zero hs + subst hz + rw [heval x, heval y] + exact congrArg Complex.re ((RationalFilteredNilmanifold.Niltest.eval_step_zero D T _).trans + (RationalFilteredNilmanifold.Niltest.eval_step_zero D T _).symm) + +theorem exists_positive_cyclic_translation_approximation (a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {s N : ℕ} [NeZero N] {p ρ : ℝ}, + 0 ≤ p → 0 < ρ → 1 / ρ ≤ Real.exp ((p + 2) ^ a) → + ∀ f : ZMod N → ℝ, PositiveCyclicNiltest.{0} s N p f → ∀ h : ZMod N, + ∃ n : ℕ, 0 < n ∧ (n : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ U : Fin n → ZMod N → ℝ, + (∀ i, PositiveCyclicNiltest.{0} s N ((p + C) ^ C) (U i)) ∧ + (∀ x, 0 ≤ ∑ i, U i x ∧ ∑ i, U i x ≤ 1) ∧ + (∀ x, x ∉ cyclicWrapExceptional h ρ → f (h + x) = ∑ i, U i x) ∧ + (𝔼 x, |f (h + x) - ∑ i, U i x|) ≤ 6 * ρ + 3 / N := by + obtain ⟨B, _, hinterval⟩ := exists_interval_circle_partition a + let X : Polynomial ℕ := Polynomial.X + let T := X + (X + Polynomial.C B) ^ B + let R := T + (T + 2) ^ 2 + 3 + let Q := (R + 2) ^ 2 + R + (R + (R ^ 2 + R + 3) ^ 2) + R ^ 2 + 4 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (2 * T + Q) + refine ⟨C, hC, ?_⟩ + intro s N _ p ρ hp hρ hρinv f hf h + let t := p + (p + B) ^ B + have hpt : p ≤ t := le_add_of_nonneg_right (pow_nonneg (by positivity) _) + have ht : 0 ≤ t := hp.trans hpt + have hBt : (p + B) ^ B ≤ t := le_add_of_nonneg_left hp + have hcost : 2 * t + productNiltestBudget (raisedNiltestBudget t) ≤ (p + C) ^ C := by + simpa [T, X, R, Q, t, Polynomial.eval₂_pow, productNiltestBudget, + productObservableLipBudget, raisedNiltestBudget] using hbudget p hp + have hQ0 : 0 ≤ productNiltestBudget (raisedNiltestBudget t) := by + unfold productNiltestBudget productObservableLipBudget raisedNiltestBudget + positivity + have hproduct : productNiltestBudget (raisedNiltestBudget t) ≤ (p + C) ^ C := by linarith + have htC : t ≤ (p + C) ^ C := by linarith + cases s with + | zero => + refine ⟨1, by norm_num, ?_, fun _ => f, ?_, ?_, ?_, ?_⟩ + · simpa only [Nat.cast_one] using Real.one_le_exp_iff.mpr (ht.trans htC) + · intro i + exact hf.mono le_rfl (hpt.trans htC) + · intro x + simpa using hf.unit_interval x + · intro x _ + simpa using hf.eq_of_degree_zero (h + x) x + · have he (x) : f (h + x) = f x := hf.eq_of_degree_zero _ _ + simpa [he] using (show (0 : ℝ) ≤ 6 * ρ + 3 / N by positivity) + | succ s => + obtain ⟨n, hn, hnb, A, hA, hsum, hdiam⟩ := hinterval N hp hρ hρinv + obtain ⟨U, hU, hrange, hgood, hmean⟩ := exists_positive_translation_partition ht hρ f + (hf.mono le_rfl hpt) A (fun i => (hA i).mono (by omega) hBt) hsum hdiam h + exact ⟨n, hn, hnb.trans (Real.exp_le_exp.mpr (hBt.trans htC)), U, + fun i => (hU i).mono le_rfl hproduct, hrange, hgood, hmean⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem expect_weighted_sum_approximation_le {X I : Type*} [Fintype X] [Fintype I] + (w f : X → ℝ) (U : I → X → ℝ) {M delta error : ℝ} (hM : 0 ≤ M) + (hw : ∀ x, |w x| ≤ M) (happrox : (𝔼 x, |f x - ∑ i, U i x|) ≤ delta) + (hpiece : ∀ i, (𝔼 x, w x * U i x) ≤ error) : + (𝔼 x, w x * f x) ≤ (Fintype.card I : ℝ) * error + M * delta := by + have hpoint (x) : w x * f x ≤ (∑ i, w x * U i x) + M * |f x - ∑ i, U i x| := by + have he : w x * (f x - ∑ i, U i x) ≤ M * |f x - ∑ i, U i x| := by + apply (le_abs_self _).trans + rw [abs_mul] + exact mul_le_mul_of_nonneg_right (hw x) (abs_nonneg _) + rw [← Finset.mul_sum] + nlinarith + calc + _ ≤ (𝔼 x, ((∑ i, w x * U i x) + M * |f x - ∑ i, U i x|)) := + Finset.expect_le_expect (fun x _ => hpoint x) + _ = (∑ i, 𝔼 x, w x * U i x) + M * (𝔼 x, |f x - ∑ i, U i x|) := by + rw [Finset.expect_add_distrib, Finset.expect_sum_comm, ← Finset.mul_expect] + _ ≤ (Fintype.card I : ℝ) * error + M * delta := by + apply add_le_add + · calc + _ ≤ ∑ _i : I, error := Finset.sum_le_sum (fun i _ => hpiece i) + _ = _ := by simp + · exact mul_le_mul_of_nonneg_left happrox hM + +theorem exists_translated_shift_testing_bound (a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {s N : ℕ} [NeZero N] {p rho R error M : ℝ}, + 0 ≤ p → 0 < rho → 1 / rho ≤ Real.exp ((p + 2) ^ a) → + (p + C) ^ C ≤ R → 0 ≤ error → 0 ≤ M → + ∀ (v J : ZMod N → ℝ) (E : Finset (ZMod N)), + CyclicNiltestShiftBound.{0} s N R error v J E → + ∀ h ∉ E, (∀ x, |v x * J (x + h)| ≤ M) → + ∀ f : ZMod N → ℝ, PositiveCyclicNiltest.{0} s N p f → ∀ b : ZMod N, + (𝔼 x, v x * J (x + h) * f (b + x)) ≤ + Real.exp ((p + C) ^ C) * error + M * (6 * rho + 3 / N) := by + obtain ⟨C, hC, htranslation⟩ := exists_positive_cyclic_translation_approximation a + refine ⟨C, hC, ?_⟩ + intro s N _ p rho R error M hp hrho hrhoinv hR herror hM v J E hbound h hh hw f hf b + obtain ⟨n, _, hn, U, hU, _, _, hmean⟩ := htranslation hp hrho hrhoinv f hf b + have hpiece (i) : (𝔼 x, (v x * J (x + h)) * U i x) ≤ error := + ((hU i).mono le_rfl hR).apply_shiftBound hbound hh + apply (expect_weighted_sum_approximation_le (fun x => v x * J (x + h)) + (fun x => f (b + x)) U hM hw hmean hpiece).trans + simpa only [Fintype.card_fin] using add_le_add + (mul_le_mul_of_nonneg_right hn herror) (le_refl (M * (6 * rho + 3 / N))) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedStabilityStep.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedStabilityStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1a9c47c4b0b46c93590e9412d05ff2bfabbfc1e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslatedStabilityStep.lean @@ -0,0 +1,164 @@ +import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas +import OAI.Combinatorics.Progressions.Estimates.UnconditionalStepDrop + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {σ ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem gradedFast_finrank_inf_lt (V U : LieSubalgebra ℚ F.AssociatedGraded) + (eta : L →ₗ[ℚ] ℚ) + (hU : ∀ x ∈ U, basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x → + F.gradedFrequency b ω hF eta x = 0) + (hV : ∃ x ∈ V, basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x ∧ + F.gradedFrequency b ω hF eta x ≠ 0) : + finrank ℚ ↥(V ⊓ U) < finrank ℚ V := by + let : FiniteDimensional ℚ F.AssociatedGraded := + (F.associatedGradedBasis b ω hF).finiteDimensional_of_finite + change finrank ℚ ↥(V.toSubmodule ⊓ U.toSubmodule) < finrank ℚ V.toSubmodule + apply Submodule.finrank_lt_finrank_of_lt + refine lt_of_le_of_ne inf_le_left ?_ + intro heq + obtain ⟨x, hx, hgrade, hnonzero⟩ := hV + have hxinf : x ∈ V.toSubmodule ⊓ U.toSubmodule := heq.symm ▸ hx + exact hnonzero (hU x hxinf.2 hgrade) + +omit [Fintype ι] in +theorem exists_graded_top_frequency_ne_zero (V : LieSubalgebra ℚ F.AssociatedGraded) + (eta : L →ₗ[ℚ] ℚ) (hV : ∃ x ∈ F.gradedRefiltrationLayer V s, eta x ≠ 0) : + ∃ x ∈ V, basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x ∧ + F.gradedFrequency b ω hF eta x ≠ 0 := by + obtain ⟨v, hv, hne⟩ := hV + obtain ⟨hvs, hvV⟩ := (F.mem_gradedRefiltrationLayer V s v).mp hv + refine ⟨F.associatedGradedPieceMap s ⟨v, hvs⟩, hvV, + F.associatedGradedPieceMap_grade_fixed b ω hF s ⟨v, hvs⟩, ?_⟩ + simpa only [F.gradedFrequency_top_piece b ω hF eta] using hne + +theorem ControlledSymbolFactorization.exists_dimension_drop + {eta : L →ₗ[ℚ] ℚ} {T : σ → ℝ} + {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} {p : ℝ} + (h : F.ControlledSymbolFactorization b ω hF eta T X p) + (V : LieSubalgebra ℚ F.AssociatedGraded) + (hV : ∃ x ∈ F.gradedRefiltrationLayer V s, eta x ≠ 0) : + ∃ (l : ℕ) (U : LieSubalgebra ℚ F.AssociatedGraded) (u : ι → F.AssociatedGraded), + 0 < l ∧ (l : ℝ) ≤ Real.exp p ∧ Submodule.span ℚ (Set.range u) = U.toSubmodule ∧ + BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω U.toSubmodule ∧ + (∀ i j, rationalLogHeight ((F.associatedGradedBasis b ω hF).repr (u i) j) ≤ p) ∧ + (∀ x ∈ U, basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x → + F.gradedFrequency b ω hF eta x = 0) ∧ + finrank ℚ ↥(V ⊓ U) < finrank ℚ V ∧ F.SymbolFactorizationIn b ω hF T X p l U := by + obtain ⟨l, U, u, hl, hlp, hspan, hgraded, hheight, hkill, hfactor⟩ := + ControlledSymbolFactorization.exists_in F b ω hF h + exact ⟨l, U, u, hl, hlp, hspan, hgraded, hheight, hkill, + F.gradedFast_finrank_inf_lt b ω hF V U eta hkill + (F.exists_graded_top_frequency_ne_zero b ω hF V eta hV), hfactor⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +open Module CircleFourier NilpotentLieFiltration +open scoped TensorProduct BigOperators + +theorem exists_translated_stability_step (s : ℕ) (hs : 1 ≤ s) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ L : Type*} [Fintype σ] [DecidableEq σ] + [LieRing L] [LieAlgebra ℚ L] {d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L s d) (ω : Fin d → ℕ) + (hF : ∀ j, D.filtration.layer j = Submodule.span ℚ (D.basis '' {i | j ≤ ω i})) + (p q rho : ℝ), 0 ≤ p → p ≤ q → (Fintype.card σ : ℝ) ≤ q → + verticalDecompositionBudget p ≤ q → 0 < rho → rho⁻¹ ≤ Real.exp p → + ∀ (T : D.Niltest (fun _ : σ => 1)), T.UnitIntervalValued → T.ComplexityLE p → + ∀ (V : LieSubalgebra ℚ D.filtration.AssociatedGraded) + {β : Type*} (origin : β → σ → ℤ) (lengths : β → σ → ℕ), + (∀ a i, 0 < lengths a i) → + (∀ a i, Real.exp ((q + C) ^ C) ≤ (lengths a i : ℝ)) → + (∃ (a : β) (l : ℕ) (U : LieSubalgebra ℚ D.filtration.AssociatedGraded) + (u : Fin d → D.filtration.AssociatedGraded), + 0 < l ∧ (l : ℝ) ≤ Real.exp ((q + C) ^ C) ∧ + Submodule.span ℚ (Set.range u) = U.toSubmodule ∧ + BasisGradedSubmodule (D.filtration.associatedGradedBasis D.basis ω hF) ω U.toSubmodule ∧ + (∀ i j, rationalLogHeight ((D.filtration.associatedGradedBasis D.basis ω hF).repr (u i) j) ≤ + (q + C) ^ C) ∧ + finrank ℚ ↥(V ⊓ U) < finrank ℚ V ∧ + D.filtration.SymbolFactorizationIn D.basis ω hF (fun i => (lengths a i : ℝ)) + (T.symbol D.basis ω hF) ((q + C) ^ C) l U) ∨ + (∃ S : D.Niltest (fun _ : σ => 1), + S.UnitIntervalValued ∧ S.ComplexityLE p ∧ S.orbit = T.orbit ∧ + (∀ z : D.RealGroup, z.coord ∈ (D.filtration.gradedRefiltrationLayer V s).baseChange ℝ → + ∀ x, S.observable (z • x) = S.observable x) ∧ + ∀ a, ‖(𝔼 x ∈ translatedIntegerBox (origin a) (lengths a), T.eval x) - + (𝔼 x ∈ translatedIntegerBox (origin a) (lengths a), S.eval x)‖ ≤ + 2 * rho + Real.exp (verticalDecompositionBudget p - q)) := by + classical + obtain ⟨C, hC, hstep⟩ := exists_translated_step_drop s hs + refine ⟨C, hC, ?_⟩ + intro σ L _ _ _ _ d _ _ _ _ D ω hF p q rho hp hpq hσ hfreq hrho hrhop + T hunit hTc V β origin lengths hlength hlarge + obtain ⟨J, inst, eta, U, hcard, hheight, hU, hvertical, _, _, happrox, _⟩ := + T.exists_controlled_vertical_decomposition hp hTc rho hrho hrhop + let := inst + let K := D.filtration.gradedRefiltrationLayer V s + by_cases hevent : ∃ (j : J) (a : β), + Real.exp (-q) < ‖𝔼 x ∈ translatedIntegerBox (origin a) (lengths a), (U j).eval x‖ ∧ + ∃ v ∈ K, eta j v ≠ 0 + · left + obtain ⟨j, a, hbias, hnonzero⟩ := hevent + have hfactor := hstep D ω hF q (hp.trans hpq) hσ (U j) ((hU j).1.mono hpq) + (eta j) (fun i => (hheight j i).trans hfreq) (hvertical j) + (origin a) (lengths a) (hlength a) (hlarge a) hbias.le + have hsymbol : (U j).symbol D.basis ω hF = T.symbol D.basis ω hF := by + unfold RationalFilteredNilmanifold.Niltest.symbol + apply congrArg (D.filtration.realPolynomialSymbolHom D.basis ω hF (fun _ => 1)) + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + exact congrArg (fun o : D.filtration.realification.PolynomialOrbit (fun _ : σ => 1) => o.log) + (hU j).2 + rw [hsymbol] at hfactor + obtain ⟨l, W, u, hl, hlp, hspan, hgraded, hheightW, _hkill, hdim, hfixed⟩ := + ControlledSymbolFactorization.exists_dimension_drop D.filtration D.basis ω hF hfactor V hnonzero + exact ⟨a, l, W, u, hl, hlp, hspan, hgraded, hheightW, hdim, hfixed⟩ + · right + have hkill : ∀ j, (∃ a, Real.exp (-q) < + ‖𝔼 x ∈ translatedIntegerBox (origin a) (lengths a), (U j).eval x‖) → + ∀ v ∈ K, eta j v = 0 := by + intro j ⟨a, ha⟩ v hv + by_contra hne + exact hevent ⟨j, a, ha, v, hv, hne⟩ + have hboxes (a : β) : (translatedIntegerBox (origin a) (lengths a)).Nonempty := by + refine ⟨origin a, (mem_translatedIntegerBox (origin a) (lengths a) (origin a)).mpr ?_⟩ + intro i + have hi := hlength a i + exact ⟨le_rfl, by omega⟩ + obtain ⟨S, hS, hSc, hSo, hinv, herr⟩ := T.exists_finset_kernel_projection_family + hunit hTc K (D.filtration.gradedRefiltrationLayer_le V s) eta U (fun j => (hU j).2) + hvertical (fun a => translatedIntegerBox (origin a) (lengths a)) hboxes + (fun _ => Real.exp (-q)) hrho.le (fun _ => (Real.exp_pos _).le) + (fun x => by simpa only [norm_sub_rev] using happrox x) hkill + refine ⟨S, hS, hSc, hSo, hinv, ?_⟩ + intro a + apply (herr a).trans + apply add_le_add le_rfl + calc + (Fintype.card J : ℝ) * Real.exp (-q) ≤ + Real.exp (verticalDecompositionBudget p) * Real.exp (-q) := + mul_le_mul_of_nonneg_right hcard (Real.exp_pos _).le + _ = Real.exp (verticalDecompositionBudget p - q) := by rw [← Real.exp_add, sub_eq_add_neg] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslationLogSlowNormalization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationLogSlowNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..127eae03016a07ae1fbaab388cde61a754258b52 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationLogSlowNormalization.lean @@ -0,0 +1,96 @@ +import OAI.Combinatorics.Progressions.Geometry.DetectedTranslationLogCoordinates + +namespace OAI + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {U : Type*} + +theorem scaleMvPolynomialAxes_eq_eval₂Hom (T : U → ℝ) (P : MvPolynomial U ℝ) : + scaleMvPolynomialAxes T P = eval₂Hom C (fun i => C (T i) * X i) P := by + apply MvPolynomial.funext + intro u + rw [scaleMvPolynomialAxes_eval] + have he : (eval u).comp (eval₂Hom C (fun i => C (T i) * X i)) = + eval (fun i => T i * u i) := by + ext <;> simp + exact (RingHom.congr_fun he P).symm + +theorem scaleMvPolynomialAxes_eval_div (T u : U → ℝ) + (hT : ∀ i, 0 < T i) (P : MvPolynomial U ℝ) : + eval (fun i => u i / T i) (scaleMvPolynomialAxes T P) = eval u P := by + rw [scaleMvPolynomialAxes_eval] + apply congrArg (fun v => eval v P) + funext i + exact mul_div_cancel₀ (u i) (hT i).ne' + +theorem realPolynomialMass_scaleMvPolynomialAxes [Fintype U] + (T : U → ℝ) (hT : ∀ i, 0 < T i) (P : MvPolynomial U ℝ) {d : ℕ} + (hdegree : P.totalDegree ≤ d) {M : ℝ} (hM : 0 ≤ M) + (hP : ∀ α, |P.coeff α| * monomialScale T α ≤ M) : + realPolynomialMass (scaleMvPolynomialAxes T P) ≤ + M * ((Fintype.card U : ℝ) + 1) ^ d := by + have hcard : (P.support.card : ℝ) ≤ ((Fintype.card U : ℝ) + 1) ^ d := by + exact_mod_cast mvPolynomial_support_card_le_totalDegree P hdegree + calc + _ ≤ P.support.card * M := scaleMvPolynomialAxes_mass_le T hT P (fun α => + (le_div_iff₀ (monomialScale_pos T hT α)).mpr (hP α)) + _ ≤ ((Fintype.card U : ℝ) + 1) ^ d * M := mul_le_mul_of_nonneg_right hcard hM + _ = _ := mul_comm _ _ + +theorem realPolynomialMass_scaleMvPolynomialAxes_of_div [Fintype U] + (T : U → ℝ) (hT : ∀ i, 0 < T i) (P : MvPolynomial U ℝ) {d : ℕ} + (hdegree : P.totalDegree ≤ d) {M : ℝ} (hM : 0 ≤ M) + (hP : ∀ α, |P.coeff α| ≤ M / monomialScale T α) : + realPolynomialMass (scaleMvPolynomialAxes T P) ≤ + M * ((Fintype.card U : ℝ) + 1) ^ d := by + apply realPolynomialMass_scaleMvPolynomialAxes T hT P hdegree hM + intro α + exact (le_div_iff₀ (monomialScale_pos T hT α)).mp (hP α) + +namespace NilpotentLieFiltration + +open Module + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : U → ℕ) + +theorem realSymbolCoordinate_totalDegree_le (hw : ∀ i, 0 < w i) + (x : F.RealPolynomialSymbol w) (i : ι) {d : ℕ} (hi : ω i ≤ d) : + (F.realSymbolCoordinate b ω hlayers w x i).totalDegree ≤ d := by + classical + apply Finset.sup_le + intro α hα + have hwα := F.realSymbolCoordinate_isWeightedHomogeneous b ω hlayers w x i + (MvPolynomial.mem_support_iff.mp hα) + calc + _ ≤ Finsupp.weight w α := by + simp only [Finsupp.weight_apply, Finsupp.sum, smul_eq_mul] + exact Finset.sum_le_sum (fun j _ => Nat.le_mul_of_pos_right _ (hw j)) + _ = ω i := hwα + _ ≤ d := hi + +theorem realSymbolCoordinate_slow_normalized_mass [Fintype U] + (hw : ∀ i, 0 < w i) (T : U → ℝ) (hT : ∀ i, 0 < T i) + {M : ℝ} (hM : 0 ≤ M) (g : F.RealPolynomialSymbolGroup w) + (hg : F.SymbolSlowBound b ω hlayers w T M g) (i : ι) {d : ℕ} (hi : ω i ≤ d) : + realPolynomialMass (scaleMvPolynomialAxes T + (F.realSymbolCoordinate b ω hlayers w g.coord i)) ≤ + M * ((Fintype.card U : ℝ) + 1) ^ d := by + exact realPolynomialMass_scaleMvPolynomialAxes_of_div T hT _ + (F.realSymbolCoordinate_totalDegree_le b ω hlayers w hw g.coord i hi) hM + (fun α => F.realSymbolCoordinate_slow_coefficients b ω hlayers w T hT hM g hg α i) + +end NilpotentLieFiltration +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorCorrelationDecomposition.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorCorrelationDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..32cd72f5e751c79f784259af77fc45123c7dacb0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorCorrelationDecomposition.lean @@ -0,0 +1,624 @@ +import OAI.Combinatorics.Progressions.Dynamics.TranslationMajorDecompositionBudget +import OAI.Combinatorics.Progressions.Geometry.DetectedTranslationUniformCoordinateBounds +import OAI.Combinatorics.Progressions.Lattices.AlgebraicMajorIntegerRestoration +import OAI.Combinatorics.Progressions.Polynomial.AlgebraicMajorWeightedDegree +import OAI.Combinatorics.Progressions.Polynomial.RationalPolynomialFromRealGrid + +namespace OAI + +section + +namespace Erdos3 +open _root_.MvPolynomial _root_.OAI.MvPolynomial + +theorem realPolynomialMass_weightedHomogeneousComponent_le + {σ : Type*} (P : MvPolynomial σ ℝ) (w : σ → ℕ) (d : ℕ) : + realPolynomialMass (weightedHomogeneousComponent w d P) ≤ realPolynomialMass P := by + classical + have hs : (weightedHomogeneousComponent w d P).support ⊆ P.support := by + rw [support_weightedHomogeneousComponent] + exact Finset.filter_subset _ _ + rw [realPolynomialMass_eq_sum_of_support_subset _ P.support hs] + apply Finset.sum_le_sum + intro α _ + rw [coeff_weightedHomogeneousComponent] + split_ifs + · exact le_rfl + · simpa only [abs_zero] using abs_nonneg (P.coeff α) + +theorem realPolynomialMass_specializeMajorParameters_zero_le + {U B : Type*} (P : MvPolynomial (U ⊕ B) ℝ) : + realPolynomialMass (specializeMajorParameters (RingHom.id ℝ) P 0) ≤ realPolynomialMass P := by + have h := realPolynomialMass_substitution_le P + (Sum.elim (fun _ : U => (0 : MvPolynomial B ℝ)) X) + (M := 1) le_rfl (fun i => by + cases i with + | inl i => simpa only [Sum.elim_inl, realPolynomialMass_zero] using (zero_le_one : (0 : ℝ) ≤ 1) + | inr i => exact (realPolynomialMass_X i).le) (d := P.totalDegree) le_rfl + simpa only [specializeMajorParameters, RingHomCompTriple.comp_eq, RingHom.coe_comp, + Function.comp_apply, RingHom.id_apply, Pi.zero_apply, map_zero, one_pow, mul_one] using h + +theorem reducedMajorZeroSlice_mass_le + {U B : Type*} [Fintype U] [Fintype B] + (w : B → ℕ) (hw : ∀ i, 0 < w i) (d : ℕ) + (F : MvPolynomial (U ⊕ B) ℝ) + (hF : F ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) : + realPolynomialMass (specializeMajorParameters (RingHom.id ℝ) + (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d + (fractionalCoefficientPolynomial F)) 0) ≤ + ((Fintype.card U : ℝ) + (Fintype.card B : ℝ) + 1)^d := by + apply (realPolynomialMass_specializeMajorParameters_zero_le _).trans + apply (realPolynomialMass_weightedHomogeneousComponent_le _ _ _).trans + have h := fractionalCoefficientPolynomial_mass_le_of_weightedSupportLE F + (Sum.elim (fun _ : U => 1) w) (fun i => by cases i <;> simp_all) d hF + simpa only [Fintype.card_sum, Nat.cast_add] using h + +theorem positiveWeightedSupport_totalDegree_le + {σ : Type*} {R : Type*} [CommRing R] + (P : MvPolynomial σ R) (w : σ → ℕ) (hw : ∀ i, 0 < w i) {d : ℕ} + (hP : P ∈ weightedSupportLE w d) : P.totalDegree ≤ d := by + unfold totalDegree + apply Finset.sup_le + intro α hα + exact (exponentSum_le_positive_weight w hw α).trans (hP hα) + +theorem specializeMajorParameters_zero_totalDegree_le + {U B : Type*} (P : MvPolynomial (U ⊕ B) ℝ) : + (specializeMajorParameters (RingHom.id ℝ) P 0).totalDegree ≤ P.totalDegree := by + have h := polynomial_substitution_totalDegree_le_ring P + (Sum.elim (fun _ : U => (0 : MvPolynomial B ℝ)) X) + (k := 1) (fun i => by cases i <;> simp) le_rfl + simpa only [specializeMajorParameters, RingHomCompTriple.comp_eq, RingHom.coe_comp, + Function.comp_apply, RingHom.id_apply, Pi.zero_apply, map_zero, Nat.mul_one] using h + +theorem reducedMajorZeroSlice_totalDegree_le + {U B : Type*} (w : B → ℕ) (hw : ∀ i, 0 < w i) (d : ℕ) + (F : MvPolynomial (U ⊕ B) ℝ) : + (specializeMajorParameters (RingHom.id ℝ) + (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d + (fractionalCoefficientPolynomial F)) 0).totalDegree ≤ d := by + apply (specializeMajorParameters_zero_totalDegree_le _).trans + apply positiveWeightedSupport_totalDegree_le _ (Sum.elim (fun _ : U => 1) w) + (fun i => by cases i <;> simp_all) + intro α hα + exact ((weightedHomogeneousComponent_isWeightedHomogeneous _ _) + (mem_support_iff.mp hα)).le + +end Erdos3 + +end + +section + +namespace Erdos3.PolynomialTranslationLie +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module RationalFilteredNilmanifold + +variable {B L : Type} {U : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + +noncomputable def detectedTranslationNormalizedBase + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (H : U → ℝ) (i : B) : MvPolynomial U ℝ := + scaleMvPolynomialAxes H (detectedTranslationBaseCoordinatePolynomial w d hw hwd M hM D E i) + +noncomputable def detectedTranslationNormalizedPhase + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (H : U → ℝ) : MvPolynomial (U ⊕ B) ℝ := + scaleMvPolynomialAxes (Sum.elim H (fun _ : B => 1)) + (detectedTranslationPhasePolynomial w d hw hwd M hM D E) + +theorem detectedTranslationNormalizedBase_eval + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (H : U → ℝ) (hH : ∀ i, H i ≠ 0) (u : U → ℝ) (i : B) : + eval (fun j => u j / H j) (detectedTranslationNormalizedBase w d hw hwd M hM D E H i) = + (detectedTranslationGroupEval w d hw hwd M hM D u E).base i := by + rw [detectedTranslationNormalizedBase, scaleMvPolynomialAxes_eval] + have hc : (fun j => H j * (u j / H j)) = u := by + funext j + exact mul_div_cancel₀ (u j) (hH j) + rw [hc, detectedTranslationBaseCoordinatePolynomial_eval] + +theorem detectedTranslationNormalizedPhase_eval + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (H : U → ℝ) (hH : ∀ i, H i ≠ 0) (u : U → ℝ) (z : B → ℝ) : + eval (Sum.elim (fun j => u j / H j) z) + (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) = + eval z (detectedTranslationGroupEval w d hw hwd M hM D u E).polynomial := by + rw [detectedTranslationNormalizedPhase, scaleMvPolynomialAxes_eval] + have hc : (fun j => Sum.elim H (fun _ : B => 1) j * + Sum.elim (fun i => u i / H i) z j) = Sum.elim u z := by + funext j + cases j with + | inl i => exact mul_div_cancel₀ (u i) (hH i) + | inr i => exact one_mul _ + rw [hc, detectedTranslationPhasePolynomial_eval] + +theorem detectedTranslationGroupEval_normalized_left + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (H : U → ℝ) (hH : ∀ i, H i ≠ 0) (u : U → ℝ) : + normalizedMajorLeft + (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + (detectedTranslationNormalizedBase w d hw hwd M hM D E H) H u = + detectedTranslationGroupEval w d hw hwd M hM D u E := by + apply PolynomialTranslationGroupOver.ext + · funext i + exact detectedTranslationNormalizedBase_eval w d hw hwd M hM D E H hH u i + · apply MvPolynomial.funext + intro z + change eval z (specializeMajorParameters (RingHom.id ℝ) _ _) = _ + rw [specializeMajorParameters_eval, eval₂_id] + exact detectedTranslationNormalizedPhase_eval w d hw hwd M hM D E H hH u z + +theorem exists_detectedTranslation_rational_right + (Q : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (q : ℕ) (hq : 0 < q) + (hphase : realPolynomialCoefficientGrid q + (detectedTranslationPhasePolynomial w d hw hwd M hM D Q)) + (hbase : ∀ i, realPolynomialCoefficientGrid q + (detectedTranslationBaseCoordinatePolynomial w d hw hwd M hM D Q i)) : + ∃ (Qrat : MvPolynomial (U ⊕ B) ℚ) (a : B → MvPolynomial U ℚ), + map (algebraMap ℚ ℝ) Qrat = detectedTranslationPhasePolynomial w d hw hwd M hM D Q ∧ + (∀ i, map (algebraMap ℚ ℝ) (a i) = + detectedTranslationBaseCoordinatePolynomial w d hw hwd M hM D Q i) ∧ + (fun α => Qrat.coeff α) ∈ denominatorGrid q ∧ + (∀ i, (fun α => (a i).coeff α) ∈ denominatorGrid q) ∧ + Qrat.totalDegree = (detectedTranslationPhasePolynomial w d hw hwd M hM D Q).totalDegree ∧ + ∀ u, rationalMajorRight Qrat a u = detectedTranslationGroupEval w d hw hwd M hM D u Q := by + obtain ⟨Qrat, hQrat, hQgrid, hQdegree⟩ := + exists_rationalPolynomial_of_realCoefficientGrid _ hq hphase + choose a ha hagrid _hadegree using fun i => + exists_rationalPolynomial_of_realCoefficientGrid _ hq (hbase i) + refine ⟨Qrat, a, hQrat, ha, hQgrid, hagrid, hQdegree, ?_⟩ + intro u + apply PolynomialTranslationGroupOver.ext + · funext i + change eval₂ (algebraMap ℚ ℝ) u (a i) = _ + rw [← eval_map, ha i] + exact detectedTranslationBaseCoordinatePolynomial_eval w d hw hwd M hM D Q u i + · apply MvPolynomial.funext + intro z + change eval z (specializeMajorParameters (algebraMap ℚ ℝ) Qrat u) = _ + rw [specializeMajorParameters_eval, ← eval_map, hQrat] + exact detectedTranslationPhasePolynomial_eval w d hw hwd M hM D Q u z + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module RationalFilteredNilmanifold + +variable {B L : Type} {U ι : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem exists_detectedTranslation_normalized_decomposition + (hd : 0 < d) + (F : MvPolynomial (U ⊕ B) ℝ) + (hF : F ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) + (A : B → MvPolynomial U ℝ) (hA : ∀ i, (A i).totalDegree ≤ w i) + (partner : D.filtration.realification.PolynomialOrbit (fun _ : U => 1)) + (E P Q : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hprod : E * P * Q = pairOrbitSymbol + (weightedTranslationResidueNilmanifold w d hw hwd M hM) D + (majorTranslationPolynomialOrbit w d hw hwd F hF A hA) partner b ω hN) + (W : LieSubalgebra ℚ (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded) + (hP : P.coord ∈ realificationLieSubalgebra + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.symbolPointwiseSubalgebra b ω hN (fun _ : U => 1) W)) + (V : MvPolynomial B ℚ) (H : U → ℝ) (hH : ∀ i, H i ≠ 0) + (q r : ℕ) (hq : 0 < q) (Cbase : ℝ) (hCbase : 0 ≤ Cbase) + (hphaseGrid : realPolynomialCoefficientGrid q + (detectedTranslationPhasePolynomial w d hw hwd M hM D Q)) + (hbaseGrid : ∀ i, realPolynomialCoefficientGrid q + (detectedTranslationBaseCoordinatePolynomial w d hw hwd M hM D Q i)) + (hVgrid : (fun α => V.coeff α) ∈ denominatorGrid q) + (hEdegree : (detectedTranslationNormalizedPhase w d hw hwd M hM D E H).totalDegree ≤ r) + (hVdegree : V.totalDegree ≤ r) + (heMass : ∀ i, realPolynomialMass + (detectedTranslationNormalizedBase w d hw hwd M hM D E H i) ≤ Cbase) : + let fast := W.map (weightedTranslationGradedProjection + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration + w d hw hwd (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)) + let K := (fast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) + let Ftop := weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d F + let F₀ := specializeMajorParameters (RingHom.id ℝ) Ftop 0 + (∀ x ∈ fast, ∀ z ∈ fast.toSubmodule.map + (baseLinear.comp (weightedSubalgebra w d).subtype), + eval z (scalarDirectionalDerivative x.val.base V) = eval z x.val.polynomial) → + (∀ u, (detectedTranslationGroupEval w d hw hwd M hM D u Q).base ∈ K) → + ∃ (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ), + (∀ u z, z ∈ K → eval (Sum.elim u z) Ftop = + eval (Sum.elim (fun i => u i / H i) + (fun j => z j - eval u (majorTranslationTopCoordinates w A j))) S + + eval₂ (algebraMap ℚ ℝ) (Sum.elim u z) R) ∧ + realPolynomialMass S ≤ realPolynomialMass F₀ + + (realPolynomialMass (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + + realPolynomialMass (map (algebraMap ℚ ℝ) V)) * (1 + Cbase)^r ∧ + (fun α => R.coeff α) ∈ denominatorGrid (q^(r+1)) := by + intro fast K Ftop F₀ hderiv hright + obtain ⟨Qrat, a, _, _, hQgrid, hagrid, _, hQeval⟩ := + exists_detectedTranslation_rational_right w d hw hwd M hM D Q q hq hphaseGrid hbaseGrid + have hfactor (u : U → ℝ) : algebraicMajorSymbol Ftop F₀ + (majorTranslationTopCoordinates w A) u = + normalizedMajorLeft (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + (detectedTranslationNormalizedBase w d hw hwd M hM D E H) H u * + detectedTranslationGroupEval w d hw hwd M hM D u P * rationalMajorRight Qrat a u := by + rw [detectedTranslationGroupEval_normalized_left w d hw hwd M hM D E H hH, + hQeval] + exact detectedTranslationGroupEval_major_factorization w d hw hwd M hM D b ω hN + F hF A hA partner E P Q hprod u + apply algebraic_major_normalized_decomposition_on_subspace K Ftop F₀ + (majorTranslationTopCoordinates w A) + (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + (detectedTranslationNormalizedBase w d hw hwd M hM D E H) Qrat a V H + (fun u => detectedTranslationGroupEval w d hw hwd M hM D u P) hfactor + · exact detectedTranslationGroupEval_fast_potential w d hw hwd M hM D b ω hN + hd W P hP V hderiv + · intro u + have heq := congrArg PolynomialTranslationGroupOver.base (hQeval u) + change (fun i => eval₂ (algebraMap ℚ ℝ) u (a i)) = _ at heq + rw [heq] + exact hright u + · exact hCbase + · exact heMass + · exact hEdegree + · exact hVdegree + · exact hQgrid + · exact hVgrid + · exact hagrid + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module RationalFilteredNilmanifold + +variable {B L : Type} {U ι : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem exists_detectedTranslation_normalized_weighted_decomposition + (hd : 0 < d) + (F : MvPolynomial (U ⊕ B) ℝ) + (hF : F ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) + (A : B → MvPolynomial U ℝ) (hA : ∀ i, (A i).totalDegree ≤ w i) + (partner : D.filtration.realification.PolynomialOrbit (fun _ : U => 1)) + (E P Q : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hprod : E * P * Q = pairOrbitSymbol + (weightedTranslationResidueNilmanifold w d hw hwd M hM) D + (majorTranslationPolynomialOrbit w d hw hwd F hF A hA) partner b ω hN) + (W : LieSubalgebra ℚ (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded) + (hP : P.coord ∈ realificationLieSubalgebra + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.symbolPointwiseSubalgebra b ω hN (fun _ : U => 1) W)) + (V : MvPolynomial B ℚ) (H : U → ℝ) (hH : ∀ i, H i ≠ 0) + (q : ℕ) (hq : 0 < q) (Cbase : ℝ) (hCbase : 0 ≤ Cbase) + (hphaseGrid : realPolynomialCoefficientGrid q + (detectedTranslationPhasePolynomial w d hw hwd M hM D Q)) + (hbaseGrid : ∀ i, realPolynomialCoefficientGrid q + (detectedTranslationBaseCoordinatePolynomial w d hw hwd M hM D Q i)) + (hVgrid : (fun α => V.coeff α) ∈ denominatorGrid q) + (hVweight : V ∈ weightedSupportLE w d) + (heMass : ∀ i, realPolynomialMass + (detectedTranslationNormalizedBase w d hw hwd M hM D E H i) ≤ Cbase) : + let fast := W.map (weightedTranslationGradedProjection + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration + w d hw hwd (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)) + let K := (fast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) + let Ftop := weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d F + let F₀ := specializeMajorParameters (RingHom.id ℝ) Ftop 0 + (∀ x ∈ fast, ∀ z ∈ fast.toSubmodule.map + (baseLinear.comp (weightedSubalgebra w d).subtype), + eval z (scalarDirectionalDerivative x.val.base V) = eval z x.val.polynomial) → + (∀ u, (detectedTranslationGroupEval w d hw hwd M hM D u Q).base ∈ K) → + ∃ (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ), + (∀ u z, z ∈ K → eval (Sum.elim u z) Ftop = + eval (Sum.elim (fun i => u i / H i) + (fun j => z j - eval u (majorTranslationTopCoordinates w A j))) S + + eval₂ (algebraMap ℚ ℝ) (Sum.elim u z) R) ∧ + realPolynomialMass S ≤ realPolynomialMass F₀ + + (realPolynomialMass (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + + realPolynomialMass (map (algebraMap ℚ ℝ) V)) * (1 + Cbase)^d ∧ + (fun α => R.coeff α) ∈ denominatorGrid (q^(d+1)) ∧ + S ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d ∧ + R ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d ∧ + S.totalDegree ≤ d ∧ R.totalDegree ≤ d := by + intro fast K Ftop F₀ hderiv hright + obtain ⟨Qrat, a, hQmap, hamap, hQgrid, hagrid, _hQratDegree, hQeval⟩ := + exists_detectedTranslation_rational_right w d hw hwd M hM D Q q hq hphaseGrid hbaseGrid + have hfactor (u : U → ℝ) : algebraicMajorSymbol Ftop F₀ + (majorTranslationTopCoordinates w A) u = + normalizedMajorLeft (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + (detectedTranslationNormalizedBase w d hw hwd M hM D E H) H u * + detectedTranslationGroupEval w d hw hwd M hM D u P * rationalMajorRight Qrat a u := by + rw [detectedTranslationGroupEval_normalized_left w d hw hwd M hM D E H hH, + hQeval] + exact detectedTranslationGroupEval_major_factorization w d hw hwd M hM D b ω hN + F hF A hA partner E P Q hprod u + have hpotential := detectedTranslationGroupEval_fast_potential w d hw hwd M hM D b ω hN + hd W P hP V hderiv + have haright (u : U → ℝ) : (fun j => eval₂ (algebraMap ℚ ℝ) u (a j)) ∈ K := by + have heq := congrArg PolynomialTranslationGroupOver.base (hQeval u) + change (fun i => eval₂ (algebraMap ℚ ℝ) u (a i)) = _ at heq + rw [heq] + exact hright u + have hFtopweight : Ftop ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d := by + intro α hα + exact ((weightedHomogeneousComponent_isWeightedHomogeneous _ _) + (mem_support_iff.mp hα)).le + have hF₀weight : F₀ ∈ weightedSupportLE w d := + specializeMajorParameters_zero_weightedSupportLE w hFtopweight + have hEweight : detectedTranslationNormalizedPhase w d hw hwd M hM D E H ∈ + weightedSupportLE (Sum.elim (fun _ : U => 1) w) d := + detectedTranslationPhasePolynomial_scaled_weightedSupportLE w d hw hwd M hM D E H + have heweight (i : B) : detectedTranslationNormalizedBase w d hw hwd M hM D E H i ∈ + weightedSupportLE (fun _ : U => 1) (w i) := + (mem_weightedSupportLE_one_iff _ _).mpr + (detectedTranslationBaseCoordinatePolynomial_scaled_totalDegree w d hw hwd M hM D E H i) + have hQweight : Qrat ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d := by + apply weightedSupportLE_of_map_injective (algebraMap ℚ ℝ) (algebraMap ℚ ℝ).injective + rw [hQmap] + exact detectedTranslationPhasePolynomial_weightedSupportLE w d hw hwd M hM D Q + have haweight (i : B) : a i ∈ weightedSupportLE (fun _ : U => 1) (w i) := by + apply weightedSupportLE_of_map_injective (algebraMap ℚ ℝ) (algebraMap ℚ ℝ).injective + rw [hamap i] + exact (mem_weightedSupportLE_one_iff _ _).mpr + (detectedTranslationBaseCoordinatePolynomial_totalDegree w d hw hwd M hM D Q i) + have hVrealweight : map (algebraMap ℚ ℝ) V ∈ weightedSupportLE w d := by + intro α hα + exact hVweight (support_map_subset (algebraMap ℚ ℝ) V hα) + have hVdegree : V.totalDegree ≤ d := weightedSupportLE_totalDegree_le_of_pos hw hVweight + have hVrealDegree : (map (algebraMap ℚ ℝ) V).totalDegree ≤ d := + weightedSupportLE_totalDegree_le_of_pos hw hVrealweight + have hEdegree : (detectedTranslationNormalizedPhase w d hw hwd M hM D E H).totalDegree ≤ d := + detectedTranslationPhasePolynomial_scaled_totalDegree w d hw hwd M hM D E H + have hSweight := majorSlowPolynomial_weightedSupportLE (fun _ : U => 1) w F₀ + (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + (map (algebraMap ℚ ℝ) V) + (detectedTranslationNormalizedBase w d hw hwd M hM D E H) + hF₀weight hEweight hVrealweight heweight + have hRweight := majorRationalPolynomial_weightedSupportLE (fun _ : U => 1) w + Qrat V a hQweight hVweight haweight + have hpos (i : U ⊕ B) : 0 < Sum.elim (fun _ : U => 1) w i := by + cases i with + | inl i => exact Nat.zero_lt_one + | inr i => exact hw i + refine ⟨majorSlowPolynomial F₀ + (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + (map (algebraMap ℚ ℝ) V) + (detectedTranslationNormalizedBase w d hw hwd M hM D E H), + majorRationalPolynomial Qrat V a, ?_, ?_, ?_, hSweight, hRweight, + weightedSupportLE_totalDegree_le_of_pos hpos hSweight, + weightedSupportLE_totalDegree_le_of_pos hpos hRweight⟩ + · exact algebraic_major_normalized_identity_on_subspace K Ftop F₀ + (majorTranslationTopCoordinates w A) + (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) + (detectedTranslationNormalizedBase w d hw hwd M hM D E H) Qrat a V H + (fun u => detectedTranslationGroupEval w d hw hwd M hM D u P) + hfactor hpotential haright + · exact algebraic_major_normalized_slow_mass F₀ + (detectedTranslationNormalizedPhase w d hw hwd M hM D E H) V + (detectedTranslationNormalizedBase w d hw hwd M hM D E H) + hCbase heMass hEdegree hVrealDegree + · exact majorRationalPolynomial_denominatorGrid Qrat V a q d hVdegree hQgrid hVgrid hagrid + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators NNReal + +theorem exists_reduced_majorPolynomial_degree_twisted_correlation_decomposition + (d : ℕ) (hd : 0 < d) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {U L : Type} [Fintype U] [DecidableEq U] + [LieRing L] [LieAlgebra ℚ L] {m t e : ℕ} + (w : Fin m → ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (M : ℕ) (hM : 0 < M) + (D : RationalFilteredNilmanifold L t e) (_htd : t < d) + (Ψ : PatchKernel m) (F : MvPolynomial (U ⊕ Fin m) ℝ) + (_hF : F ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) + (A : Fin m → MvPolynomial U ℝ) (_hA : ∀ i, (A i).totalDegree ≤ w i) + (K : ℝ≥0) (T : (Fin m → ℝ) → (Fin m → ZMod M) → ℂ) + (_hT : ∀ x r, ‖T x r‖ ≤ 1) (_hLip : ∀ r, LipschitzWith K (fun x => T x r)) + (R : D.Niltest (fun _ : U => 1)) (p : ℝ), 0 ≤ p → + (weightedTranslationResidueNilmanifold w d hw hwd M hM).GeometryComplexityLE p → + Real.log (3 + (2 * twistedBufferedTranslationTermLip w d Ψ + (((Fintype.card U + m + 1 : ℕ) : ℝ≥0) ^ d) K : ℝ≥0)) ≤ p → + R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + ∀ (origin : U → ℤ) (lengths : U → ℕ), (∀ i, 0 < lengths i) → + (Fintype.card U : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + ∀ (β : (U → ℤ) → Fin m → ℤ), + (∀ x ∈ translatedIntegerBox origin lengths, ∀ i, + |eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)| ≤ 1 / 2) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, + T (fun i => eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)) + (fun i => (β x i : ZMod M)) * + (Ψ.value (fun i => eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)) : ℂ) * + (Real.fourierChar (eval (fun j => ((Sum.elim x (β x) j : ℤ) : ℝ)) F) : ℂ) * + R.eval x‖ → + ∀ (retained : Fin d → Submodule ℝ (Fin m → ℝ)), + (∀ h, HasLayerSamplingRank (h.val + 1) (fun i => (lengths i : ℝ)) + (Real.exp ((p + C)^C)) (retained h) + (ofCoordinates (R := ℝ) (Pi.basisFun ℝ (Fin m)) + (fun i => weightedHomogeneousComponent (fun _ : U => 1) (w i) (A i)))) → + (∀ α, coefficients (ofCoordinates (R := ℝ) (Pi.basisFun ℝ (Fin m)) + (fun i => weightedHomogeneousComponent (fun _ : U => 1) (w i) (A i))) α ∈ + ⨆ h, retained h) → + ∃ (fast : LieSubalgebra ℚ (weightedSubalgebra w d)) + (g : Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L)) → weightedSubalgebra w d) + (Slow : MvPolynomial (U ⊕ Fin m) ℝ) + (RatPart : MvPolynomial (U ⊕ Fin m) ℚ) (qOut : ℕ), + (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L) : ℝ) ≤ (p+C)^C ∧ + Submodule.span ℚ (Set.range g) = fast.toSubmodule ∧ + BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) fast.toSubmodule ∧ + (∀ j i, rationalLogHeight ((weightedBasis w d hw).repr (g j) i) ≤ (p+C)^C) ∧ + BasisGradedSubmodule (Pi.basisFun ℝ (Fin m)) w + ((fast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype))) ∧ + (∀ h, retained h ≤ (fast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype))) ∧ + realPolynomialMass Slow ≤ Real.exp ((p+C)^C) ∧ + (∀ α, |Slow.coeff α| ≤ Real.exp ((p+C)^C)) ∧ + 0 < qOut ∧ (qOut : ℝ) ≤ Real.exp ((p+C)^C) ∧ + (fun α => RatPart.coeff α) ∈ denominatorGrid qOut ∧ + (∀ α, (RatPart.coeff α).den ≤ qOut) ∧ + Slow ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d ∧ + RatPart ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d ∧ + ∀ (u : U → ℝ) (z : Fin m → ℝ), + z ∈ (fast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) → + eval (Sum.elim u z) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d F) = + eval (Sum.elim (fun i => u i / (lengths i : ℝ)) + (fun j => z j - eval u (majorTranslationTopCoordinates w A j))) Slow + + eval₂ (algebraMap ℚ ℝ) (Sum.elim u z) RatPart := by + obtain ⟨a, ha, hdata⟩ := exists_reduced_majorPolynomial_degree_twisted_correlation_separated_data d hd + let c := detectedTranslationCoordinateConstant d + obtain ⟨C, hC, hbudget⟩ := exists_translationMajorDecomposition_budget d a c + refine ⟨C, hC, ?_⟩ + intro U L _ _ _ _ m t e w hw hwd _ _ _ _ _ _ _ _ _ M hM D htd Ψ F hF A hA + K T hT hLip R p hp hgeometry hbound hR hRcap origin lengths hlengths hU hlarge β hβ hcorr + retained hrank hAret + let p₁ : ℝ := (p+a)^a + let B : ℝ := p₁ + (p₁+c)^c + (2*p+2)^d + 1 + have hp₁ : 0 ≤ p₁ := (translationMajor_initial_budget_bounds a ha p hp).1 + have hpp₁ : p ≤ p₁ := (translationMajor_initial_budget_bounds a ha p hp).2.1 + obtain ⟨hb₁, hb₂, hbmass, hbden⟩ := hbudget p hp + have hTpos (i : U) : 0 < (lengths i : ℝ) := by exact_mod_cast hlengths i + have hlarge₁ (i : U) : Real.exp ((p+a)^a) ≤ (lengths i : ℝ) := + (Real.exp_le_exp.mpr hb₁).trans (hlarge i) + have hrank₁ h := (hrank h).mono (Real.exp_le_exp.mpr hb₁) hTpos + obtain ⟨b, ω, hLayers, hb, l, E, P, Q, W, v, fast, V, qV, + hl, hlp, hprod, hE, hQ, hfast, hfastdef, hv, hW, hh, hP, hV, + hderiv, hqV, hqVp, hVgrid, hVmass, hVcoeff, hret, hgroup⟩ := + hdata w hw hwd M hM D htd Ψ F hF A hA K T hT hLip R p hp hgeometry hbound hR hRcap + origin lengths hlengths hU hlarge₁ β hβ hcorr retained hrank₁ hAret + let N := pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le)) + let partner := D.raiseStepRealOrbit htd.le R.orbit + have hdim : (Fintype.card (Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L))) : ℝ) ≤ p₁ := by + simpa only [Fintype.card_fin] using + (weightedTranslationResidueNilmanifold w d hw hwd M hM).geometry_pair_finrank_le_budget + (D.raiseStep htd.le) hgeometry (D.raiseStep_geometry htd.le hR.1) ha + have hbase₀ : (Fintype.card (Fin m) : ℝ) ≤ p := + weightedTranslationResidueNilmanifold_base_card_le w d hw hwd M hM hgeometry + have hbase := hbase₀.trans hpp₁ + obtain ⟨qNat, hqNat, hqNatp, hEmass, hebase, hphaseGrid, hbaseGrid⟩ := + detectedTranslationGroupCoordinates_uniform_bounds w d hw hwd M hM (D.raiseStep htd.le) + b ω hLayers hp₁ (hU.trans hpp₁) hbase hdim hb (fun i => (lengths i : ℝ)) hTpos E Q hE l hl hlp hQ + have hcpow : 0 ≤ (p₁+c)^c := by positivity + have hdpow : 0 ≤ (2*p+2)^d := by positivity + have hpB : p₁ ≤ B := by dsimp only [B]; linarith only [hcpow, hdpow] + have hcB : (p₁+c)^c ≤ B := by dsimp only [B]; linarith only [hp₁, hdpow] + have hB : 0 ≤ B := hp₁.trans hpB + let F₀ := specializeMajorParameters (RingHom.id ℝ) + (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d (fractionalCoefficientPolynomial F)) 0 + have hF₀mass : realPolynomialMass F₀ ≤ Real.exp B := by + apply (reducedMajorZeroSlice_mass_le w hw d F hF).trans + apply (pow_le_pow_left₀ (by positivity) + (show (Fintype.card U : ℝ) + (Fintype.card (Fin m) : ℝ) + 1 ≤ 2*p+2 by linarith) d).trans + have hb : (2*p+2)^d ≤ B := by dsimp only [B]; linarith only [hp₁, hcpow] + exact hb.trans (by linarith only [Real.add_one_le_exp B]) + have hVm : realPolynomialMass (MvPolynomial.map (algebraMap ℚ ℝ) V) ≤ Real.exp B := + hVmass.trans (Real.exp_le_exp.mpr hpB) + have hEm : realPolynomialMass + (detectedTranslationNormalizedPhase w d hw hwd M hM (D.raiseStep htd.le) E (fun i => (lengths i : ℝ))) ≤ Real.exp B := + hEmass.trans (Real.exp_le_exp.mpr hcB) + have heb (i : Fin m) : realPolynomialMass + (detectedTranslationNormalizedBase w d hw hwd M hM (D.raiseStep htd.le) E (fun i => (lengths i : ℝ)) i) ≤ Real.exp B := + (hebase i).trans (Real.exp_le_exp.mpr hcB) + have hqVm : (qV : ℝ) ≤ Real.exp B := hqVp.trans (Real.exp_le_exp.mpr hpB) + have hqNm : (qNat : ℝ) ≤ Real.exp B := hqNatp.trans (Real.exp_le_exp.mpr hcB) + have hphaseGrid' := realPolynomialCoefficientGrid_mono (dvd_mul_left qNat qV) hphaseGrid + have hbaseGrid' i := realPolynomialCoefficientGrid_mono (dvd_mul_left qNat qV) (hbaseGrid i) + have hVgrid' := denominatorGrid_subset_of_dvd (dvd_mul_right qV qNat) hVgrid + let φ : PairAlgebra (weightedSubalgebra w d) L →ₗ⁅ℚ⁆ weightedSubalgebra w d := liePiEval true + let hφ := pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le) + let g := detectedTranslationProjectedGenerators N.filtration w d hw hwd φ hφ v + have hgspan : Submodule.span ℚ (Set.range g) = fast.toSubmodule := by + rw [hfastdef] + exact detectedTranslationProjectedGenerators_span N.filtration w d hw hwd φ hφ W v hv + have hgdata := residuePairProjectedGenerators_data w d hw hwd M hM (D.raiseStep htd.le) + b ω hLayers W v hv hp₁ hdim hb hh + have hgheight : ∀ j i, rationalLogHeight ((weightedBasis w d hw).repr (g j) i) ≤ (p+C)^C := + fun j i => (hgdata.2.2.1 j i).trans hb₂ + have hgraded : BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) fast.toSubmodule := by + rw [hfastdef] + exact weightedTranslationGradedProjection_image_graded N.filtration w d hw hwd φ hφ b ω hLayers W hW + have hVweight : V ∈ weightedSupportLE w d := + fun _ hα => (hV (mem_support_iff.mp hα)).le + have hnormal := exists_detectedTranslation_normalized_weighted_decomposition w d hw hwd M hM + (D.raiseStep htd.le) b ω hLayers hd (fractionalCoefficientPolynomial F) + (fractionalCoefficientPolynomial_mem_weightedSupportLE F (Sum.elim (fun _ : U => 1) w) d hF) + A hA partner E P Q hprod W hP V (fun i => (lengths i : ℝ)) (fun i => (hTpos i).ne') + (qV*qNat) (Nat.mul_pos hqV hqNat) (Real.exp B) (Real.exp_pos B).le + hphaseGrid' hbaseGrid' hVgrid' hVweight heb + dsimp only at hnormal + rw [← hfastdef] at hnormal + obtain ⟨Slow, RatPart, hidentity, hSlowMass, hRatGrid, hSlowW, hRatW, _, _⟩ := + hnormal hderiv (fun u => (hgroup u).2) + let qOut := (qV*qNat)^(d+1) + have hqOut : 0 < qOut := pow_pos (Nat.mul_pos hqV hqNat) _ + have hdsq : (d : ℝ) ≤ ((d+1 : ℕ) : ℝ)^2 := by + push_cast + nlinarith [sq_nonneg (d : ℝ), Nat.cast_nonneg (α := ℝ) d] + have hmassBudget : ((d : ℝ)+3)*(B+2) ≤ (p+C)^C := + (mul_le_mul_of_nonneg_right (by linarith : (d : ℝ)+3 ≤ ((d+1 : ℕ) : ℝ)^2+3) + (by positivity : 0 ≤ B+2)).trans hbmass + have hdenBudget : 2*((d : ℝ)+1)*B ≤ (p+C)^C := + (mul_le_mul_of_nonneg_right (by linarith : 2*((d : ℝ)+1) ≤ 2*(((d+1 : ℕ) : ℝ)^2+1)) hB).trans hbden + have hSlowFinal : realPolynomialMass Slow ≤ Real.exp ((p+C)^C) := by + apply hSlowMass.trans + apply (algebraicMajor_mass_le_exp d hB (realPolynomialMass_nonneg _) + (realPolynomialMass_nonneg _) (realPolynomialMass_nonneg _) (Real.exp_pos B).le + hF₀mass hEm hVm le_rfl).trans + exact Real.exp_le_exp.mpr hmassBudget + have hqFinal : (qOut : ℝ) ≤ Real.exp ((p+C)^C) := + (algebraicMajor_denominator_le_exp d qV qNat hqVm hqNm).trans (Real.exp_le_exp.mpr hdenBudget) + obtain ⟨hrestGrid, hrestW, hrestIdentity⟩ := algebraic_major_restore_integer_coefficients + F (Sum.elim (fun _ : U => 1) w) d + ((fast.toSubmodule.baseChange ℝ).map (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype))) + (majorTranslationTopCoordinates w A) (fun i => (lengths i : ℝ)) Slow RatPart qOut hRatGrid hRatW hidentity + refine ⟨fast, g, Slow, restoredMajorRemainder F (Sum.elim (fun _ : U => 1) w) d RatPart, + qOut, ?_, hgspan, hgraded, hgheight, + weightedTranslationBase_real_image_graded w d hw fast.toSubmodule hgraded g hgspan, + hret, hSlowFinal, ?_, hqOut, hqFinal, + hrestGrid, (fun α => den_le_of_mem_denominatorGrid hqOut hrestGrid α), hSlowW, hrestW, hrestIdentity⟩ + · simpa only [Fintype.card_fin] using hdim.trans hb₁ + · intro α + exact (realPolynomialMass_coeff_le Slow α).trans hSlowFinal + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorCorrelationIdentity.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorCorrelationIdentity.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d37bf5a28ca3656f8e426236e4518a227575f55 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorCorrelationIdentity.lean @@ -0,0 +1,890 @@ +import Mathlib.RingTheory.MvPolynomial.Homogeneous +import OAI.Combinatorics.Progressions.Dynamics.DetectedTranslationSeparationBudget +import OAI.Combinatorics.Progressions.Dynamics.RealProjectedPotentialGroupIdentity +import OAI.Combinatorics.Progressions.Dynamics.TranslationMajorSeparatedBudget +import OAI.Combinatorics.Progressions.Polynomial.HomogeneousScalarSymbolPolynomial +import OAI.Combinatorics.Progressions.Polynomial.TranslationMajorTwistedCorrelationStepDropPolynomial +import OAI.Combinatorics.Progressions.Polynomial.TranslationPolynomialSymbolLiftHom +import OAI.Combinatorics.Progressions.Polynomial.VectorPolynomialSubspaceSeparation +import OAI.Combinatorics.Progressions.Sampling.DetectedTranslationMajorSamplingContainment + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct + +variable {σ L : Type} {U ι : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) {e : ℕ} + (D : RationalFilteredNilmanifold L d e) + +noncomputable def detectedTranslationSymbolProjection : + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1) →* + (weightedFiltration w d hwd).RealPolynomialSymbolGroup (fun _ : U => 1) := + NilpotentLieBCHGroup.realificationMap + (hnil := (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.polynomialSymbol_lowerCentralSeries_eq_bot (fun _ : U => 1)) + (hM := (weightedFiltration w d hwd).polynomialSymbol_lowerCentralSeries_eq_bot (fun _ : U => 1)) + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.filteredPolynomialSymbolMap (weightedFiltration w d hwd) (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) (fun _ : U => 1)) + +@[simp] theorem detectedTranslationSymbolProjection_coord + (P : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) : + (detectedTranslationSymbolProjection w d hw hwd M hM D P).coord = + realificationLieHom + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.filteredPolynomialSymbolMap (weightedFiltration w d hwd) (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) (fun _ : U => 1)) P.coord := rfl + +noncomputable def detectedTranslationSymbolLift : + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1) →* + (weightedFiltration w d hwd).realification.PolynomialOrbit (fun _ : U => 1) := + (translationPolynomialSymbolLiftHom w d hw hwd).comp + (detectedTranslationSymbolProjection w d hw hwd M hM D) + +@[simp] theorem detectedTranslationSymbolLift_apply + (P : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) : + detectedTranslationSymbolLift w d hw hwd M hM D P = + translationPolynomialSymbolLift w d hw hwd + (detectedTranslationSymbolProjection w d hw hwd M hM D P) := by + simp only [detectedTranslationSymbolLift, MonoidHom.comp_apply, + translationPolynomialSymbolLiftHom_apply] + +@[simp] theorem detectedTranslationSymbolLift_log + (P : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) : + (detectedTranslationSymbolLift w d hw hwd M hM D P).log = + (weightedFiltration w d hwd).realSymbolRepresentative (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) (fun _ : U => 1) + (realificationLieHom + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.filteredPolynomialSymbolMap (weightedFiltration w d hwd) (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) (fun _ : U => 1)) P.coord) := by + rw [detectedTranslationSymbolLift_apply, translationPolynomialSymbolLift_log, + detectedTranslationSymbolProjection_coord] + +theorem detectedTranslationSymbolLift_mul + (P Q : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) : + detectedTranslationSymbolLift w d hw hwd M hM D (P * Q) = + detectedTranslationSymbolLift w d hw hwd M hM D P * + detectedTranslationSymbolLift w d hw hwd M hM D Q := + (detectedTranslationSymbolLift w d hw hwd M hM D).map_mul P Q + +variable (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem detectedTranslationSymbolProjection_pairOrbitSymbol + (p : (weightedFiltration w d hwd).realification.PolynomialOrbit (fun _ : U => 1)) + (q : D.filtration.realification.PolynomialOrbit (fun _ : U => 1)) : + detectedTranslationSymbolProjection w d hw hwd M hM D + (pairOrbitSymbol (weightedTranslationResidueNilmanifold w d hw hwd M hM) D p q b ω hN) = translationPolynomialSymbolHom w d hw hwd p := by + apply NilpotentLieBCHGroup.ext + rw [detectedTranslationSymbolProjection_coord, translationPolynomialSymbolHom_coord] + exact pairOrbitSymbol_first_projection (weightedTranslationResidueNilmanifold w d hw hwd M hM) D (fun _ : U => 1) b ω hN + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) p q + +theorem detectedTranslationSymbolLift_pairOrbitSymbol + (p : (weightedFiltration w d hwd).realification.PolynomialOrbit (fun _ : U => 1)) + (q : D.filtration.realification.PolynomialOrbit (fun _ : U => 1)) : + detectedTranslationSymbolLift w d hw hwd M hM D (pairOrbitSymbol (weightedTranslationResidueNilmanifold w d hw hwd M hM) D p q b ω hN) = + translationPolynomialSymbolLift w d hw hwd (translationPolynomialSymbolHom w d hw hwd p) := by + rw [detectedTranslationSymbolLift_apply, + detectedTranslationSymbolProjection_pairOrbitSymbol w d hw hwd M hM D b ω hN] + +theorem detectedTranslationSymbolLift_value_mem_fast + (W : LieSubalgebra ℚ (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded) + (P : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hP : P.coord ∈ realificationLieSubalgebra + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.symbolPointwiseSubalgebra b ω hN (fun _ : U => 1) W)) (t : U → ℝ) : + ((weightedFiltration w d hwd).realification.polynomialOrbitRealEval (fun _ : U => 1) t + (detectedTranslationSymbolLift w d hw hwd M hM D P)).coord ∈ + realificationLieSubalgebra + (W.map (weightedTranslationGradedProjection (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration w d hw hwd + (liePiEval (R := ℚ) true) (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D))) := by + change eval₂ t (detectedTranslationSymbolLift w d hw hwd M hM D P).log ∈ _ + rw [detectedTranslationSymbolLift_log] + unfold weightedTranslationGradedProjection + have h := (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.projected_realSymbolRepresentative_mem_homogeneous_image (weightedFiltration w d hwd) b ω hN + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) (weightedBasis_homogeneous_brackets w d hw) + (liePiEval (R := ℚ) true) (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) (fun _ : U => 1) W P.coord hP t + convert h using 1 + +theorem detectedTranslationSymbolLift_coefficients_mem_fast + (W : LieSubalgebra ℚ (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded) + (P : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hP : P.coord ∈ realificationLieSubalgebra + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.symbolPointwiseSubalgebra b ω hN (fun _ : U => 1) W)) (α : U →₀ ℕ) : + coefficients (detectedTranslationSymbolLift w d hw hwd M hM D P).log α ∈ + realificationLieSubalgebra + (W.map (weightedTranslationGradedProjection (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration w d hw hwd + (liePiEval (R := ℚ) true) (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D))) := by + rw [detectedTranslationSymbolLift_log] + unfold weightedTranslationGradedProjection + have h := (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.projected_realSymbolRepresentative_coefficients_mem_homogeneous_image (weightedFiltration w d hwd) b ω hN + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) (weightedBasis_homogeneous_brackets w d hw) + (liePiEval (R := ℚ) true) (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) (fun _ : U => 1) W P.coord hP α + convert h using 1 + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (v : σ → ℕ) + +theorem realGradedSymbolPolynomial_constant (x : F.RealPolynomialSymbol v) : + coefficients (F.realGradedSymbolPolynomial b ω hF v x) 0 = 0 := by + apply ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr.injective + ext i + change ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (coefficients (F.realGradedSymbolPolynomial b ω hF v x) 0) i = 0 + apply F.realGradedSymbolPolynomial_coordinate_of_ne + rw [map_zero] + exact (F.adaptedBasis_weight_pos b ω hF i).ne + +theorem scalarSymbolPolynomial_constant (θ : F.AssociatedGraded →ₗ[ℚ] ℚ) + (g : F.RealPolynomialSymbolGroup v) : + (F.scalarSymbolPolynomial b ω hF v θ g).coeff 0 = 0 := by + rw [F.coeff_scalarSymbolPolynomial, F.realGradedSymbolPolynomial_constant, map_zero] + +end Erdos3.NilpotentLieFiltration + +namespace Erdos3.PolynomialTranslationLie + +open Module RationalFilteredNilmanifold VectorPolynomial + +variable {B L : Type} {σ ι : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = + Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem detectedTranslationBasePolynomial_constant + (g : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup + (fun _ : σ => 1)) : + coefficients (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN g) 0 = 0 := by + rw [detectedTranslationBasePolynomial_coefficients, + NilpotentLieFiltration.realGradedSymbolPolynomial_constant, map_zero] + +theorem detectedTranslationBaseFunctional_basis_eq_zero_of_ne + (i : B) (j : ι) (hj : ω j ≠ w i) : + detectedTranslationBaseFunctional w d hw hwd M hM D i + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.associatedGradedBasis + b ω hN j) = 0 := by + rw [detectedTranslationBaseFunctional_basis_apply, ite_eq_right hj] + +theorem detectedTranslationBaseScalar_isHomogeneous + (g : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup + (fun _ : σ => 1)) (i : B) : + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.scalarSymbolPolynomial + b ω hN (fun _ : σ => 1) (detectedTranslationBaseFunctional w d hw hwd M hM D i) g).IsHomogeneous (w i) := by + exact NilpotentLieFiltration.scalarSymbolPolynomial_isWeightedHomogeneous + _ b ω hN (fun _ : σ => 1) _ (w i) + (fun j hj => detectedTranslationBaseFunctional_basis_eq_zero_of_ne + w d hw hwd M hM D b ω hN i j hj) g + +theorem detectedTranslationBasePolynomial_coordinate_isHomogeneous + (g : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup + (fun _ : σ => 1)) (i : B) : + (coordinate (LinearMap.proj i : (B → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN g)).IsHomogeneous (w i) := by + rw [detectedTranslationBasePolynomial_coordinate] + exact detectedTranslationBaseScalar_isHomogeneous w d hw hwd M hM D b ω hN g i + +theorem detectedTranslationBasePolynomial_coefficients_apply_of_degree_ne + (g : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup + (fun _ : σ => 1)) (α : σ →₀ ℕ) (i : B) (hα : α.degree ≠ w i) : + coefficients (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN g) α i = 0 := by + rw [detectedTranslationBasePolynomial_coefficients_apply] + exact (detectedTranslationBaseScalar_isHomogeneous w d hw hwd M hM D b ω hN g i).coeff_eq_zero hα + +theorem detectedTranslationBasePolynomial_coordinate_totalDegree_le + (g : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup + (fun _ : σ => 1)) (i : B) : + (coordinate (LinearMap.proj i : (B → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN g)).totalDegree ≤ w i := + (detectedTranslationBasePolynomial_coordinate_isHomogeneous w d hw hwd M hM D b ω hN g i).totalDegree_le + +theorem detectedTranslationBasePolynomial_coordinate_homogeneousComponent + (g : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup + (fun _ : σ => 1)) (i : B) : + MvPolynomial.homogeneousComponent (w i) + (coordinate (LinearMap.proj i : (B → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN g)) = + coordinate (LinearMap.proj i : (B → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN g) := + MvPolynomial.weightedHomogeneousComponent_eq_self + (detectedTranslationBasePolynomial_coordinate_isHomogeneous w d hw hwd M hM D b ω hN g i) + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module RationalFilteredNilmanifold + +variable {B L : Type} {U ι : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + +noncomputable def detectedTranslationGroupEval (u : U → ℝ) : + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1) →* + PolynomialTranslationGroupOver ℝ B := + (bchRealTranslationHom w d hwd).comp + (((weightedFiltration w d hwd).realification.polynomialOrbitRealEval + (fun _ : U => 1) u).comp (detectedTranslationSymbolLift w d hw hwd M hM D)) + +variable (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem detectedTranslationGroupEval_major_factorization + (F : MvPolynomial (U ⊕ B) ℝ) + (hF : F ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) + (A : B → MvPolynomial U ℝ) (hA : ∀ i, (A i).totalDegree ≤ w i) + (partner : D.filtration.realification.PolynomialOrbit (fun _ : U => 1)) + (E P Q : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hprod : E * P * Q = pairOrbitSymbol + (weightedTranslationResidueNilmanifold w d hw hwd M hM) D + (majorTranslationPolynomialOrbit w d hw hwd F hF A hA) partner b ω hN) + (u : U → ℝ) : + algebraicMajorSymbol + (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d F) + (specializeMajorParameters (RingHom.id ℝ) + (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d F) 0) + (majorTranslationTopCoordinates w A) u = + detectedTranslationGroupEval w d hw hwd M hM D u E * + detectedTranslationGroupEval w d hw hwd M hM D u P * + detectedTranslationGroupEval w d hw hwd M hM D u Q := by + rw [← majorTranslationPolynomialOrbit_degree_symbolLift_realEval w d hw hwd F hF A hA u, + ← detectedTranslationSymbolLift_pairOrbitSymbol w d hw hwd M hM D b ω hN + (majorTranslationPolynomialOrbit w d hw hwd F hF A hA) partner, + ← hprod] + exact (detectedTranslationGroupEval w d hw hwd M hM D u).map_mul (E * P) Q |>.trans + (congrArg (· * detectedTranslationGroupEval w d hw hwd M hM D u Q) + ((detectedTranslationGroupEval w d hw hwd M hM D u).map_mul E P)) + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct + +variable {B L : Type} {U ι : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = + Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem detectedTranslationSymbolLift_base_coordinate + (P : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) (i : B) : + coordinate (((weightedBasis w d hw).baseChange ℝ).coord (Sum.inl i)).toAddMonoidHom + (detectedTranslationSymbolLift w d hw hwd M hM D P).log = + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.scalarSymbolPolynomial + b ω hN (fun _ : U => 1) (detectedTranslationBaseFunctional w d hw hwd M hM D i) P := by + rw [detectedTranslationSymbolLift_log] + let N := pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) + let η := (LinearMap.proj i).comp (baseLinear.comp (weightedSubalgebra w d).subtype) + have h := N.filtration.homogeneousProjected_scalar_coordinate + (weightedFiltration w d hwd) b ω hN + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) + (weightedBasis_homogeneous_brackets w d hw) + (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) + (fun _ : U => 1) η P.coord + change N.filtration.scalarSymbolPolynomial b ω hN (fun _ : U => 1) + (detectedTranslationBaseFunctional w d hw hwd M hM D i) P = _ at h + dsimp only [η] at h + rw [realifyTranslationBaseFunctional_eq_coord w d hw] at h + convert h.symm using 1 + +theorem detectedTranslationGroupEval_base + (u : U → ℝ) + (P : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) : + (detectedTranslationGroupEval w d hw hwd M hM D u P).base = + eval₂ u (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN P) := by + funext i + change (bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).realification.polynomialOrbitRealEval (fun _ : U => 1) u + (detectedTranslationSymbolLift w d hw hwd M hM D P))).base i = _ + rw [bchRealTranslationHom_base_coordinate w d hw hwd] + change ((weightedBasis w d hw).baseChange ℝ).coord (Sum.inl i) + (eval₂ u (detectedTranslationSymbolLift w d hw hwd M hM D P).log) = + (LinearMap.proj i : (B → ℝ) →ₗ[ℝ] ℝ) + (eval₂ u (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN P)) + rw [coordinate_eval₂, coordinate_eval₂, + detectedTranslationSymbolLift_base_coordinate w d hw hwd M hM D b ω hN, + detectedTranslationBasePolynomial_coordinate w d hw hwd M hM D b ω hN] + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module RationalFilteredNilmanifold + +variable {B L : Type} {U ι : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem detectedTranslationGroupEval_fast_potential + (hd : 0 < d) + (W : LieSubalgebra ℚ (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded) + (P : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hP : P.coord ∈ realificationLieSubalgebra + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.symbolPointwiseSubalgebra b ω hN (fun _ : U => 1) W)) + (V : MvPolynomial B ℚ) : + let fast := W.map (weightedTranslationGradedProjection + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration + w d hw hwd (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)) + (∀ x ∈ fast, ∀ z ∈ fast.toSubmodule.map + (baseLinear.comp (weightedSubalgebra w d).subtype), + eval z (scalarDirectionalDerivative x.val.base V) = eval z x.val.polynomial) → + ∀ u z, z ∈ (fast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) → + eval z (detectedTranslationGroupEval w d hw hwd M hM D u P).polynomial = + eval₂ (algebraMap ℚ ℝ) z V - + eval₂ (algebraMap ℚ ℝ) (z - (detectedTranslationGroupEval w d hw hwd M hM D u P).base) V := by + intro fast hderiv u z hz + have hg := detectedTranslationSymbolLift_value_mem_fast w d hw hwd M hM D b ω hN W P hP u + have h := bchRealTranslationHom_eval_potential w d hw hd hwd fast V hderiv + ((weightedFiltration w d hwd).realification.polynomialOrbitRealEval + (fun _ : U => 1) u (detectedTranslationSymbolLift w d hw hwd M hM D P)) hg z hz + simpa only [detectedTranslationGroupEval, MonoidHom.comp_apply, eval_map] using h + +theorem detectedTranslationGroupEval_major_identity + (hd : 0 < d) + (F : MvPolynomial (U ⊕ B) ℝ) + (hF : F ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) + (A : B → MvPolynomial U ℝ) (hA : ∀ i, (A i).totalDegree ≤ w i) + (partner : D.filtration.realification.PolynomialOrbit (fun _ : U => 1)) + (E P Q : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hprod : E * P * Q = pairOrbitSymbol + (weightedTranslationResidueNilmanifold w d hw hwd M hM) D + (majorTranslationPolynomialOrbit w d hw hwd F hF A hA) partner b ω hN) + (W : LieSubalgebra ℚ (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded) + (hP : P.coord ∈ realificationLieSubalgebra + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.symbolPointwiseSubalgebra b ω hN (fun _ : U => 1) W)) + (V : MvPolynomial B ℚ) : + let fast := W.map (weightedTranslationGradedProjection + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration + w d hw hwd (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)) + let K := (fast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) + let Ftop := weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d F + let F₀ := specializeMajorParameters (RingHom.id ℝ) Ftop 0 + (∀ x ∈ fast, ∀ z ∈ fast.toSubmodule.map + (baseLinear.comp (weightedSubalgebra w d).subtype), + eval z (scalarDirectionalDerivative x.val.base V) = eval z x.val.polynomial) → + (∀ u, (detectedTranslationGroupEval w d hw hwd M hM D u Q).base ∈ K) → + ∀ u z, z ∈ K → + let shift := z - fun j => eval u (majorTranslationTopCoordinates w A j) + let left := detectedTranslationGroupEval w d hw hwd M hM D u E + let right := detectedTranslationGroupEval w d hw hwd M hM D u Q + eval (Sum.elim u z) Ftop = eval shift F₀ + eval (shift + left.base) left.polynomial - + eval₂ (algebraMap ℚ ℝ) (shift + left.base) V + eval z right.polynomial + + eval₂ (algebraMap ℚ ℝ) (z - right.base) V := by + intro fast K Ftop F₀ hderiv hright u z hz shift left right + have hfactor := detectedTranslationGroupEval_major_factorization w d hw hwd M hM D b ω hN + F hF A hA partner E P Q hprod u + have hpotential := detectedTranslationGroupEval_fast_potential w d hw hwd M hM D b ω hN + hd W P hP V hderiv u + have hid := PolynomialTranslationGroupOver.algebraic_major_eval_on_subspace K + (specializeMajorParameters (RingHom.id ℝ) Ftop u) F₀ (map (algebraMap ℚ ℝ) V) + (fun j => eval u (majorTranslationTopCoordinates w A j)) left + (detectedTranslationGroupEval w d hw hwd M hM D u P) right hfactor + (by simpa only [eval_map] using hpotential) (hright u) z hz + simpa only [specializeMajorParameters_eval, eval₂_id, eval_map] using hid + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open Module RationalFilteredNilmanifold VectorPolynomial +open scoped Matrix + +universe u v z + +theorem exists_detectedTranslation_separated_base : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {B L : Type} {σ : Type u} {ι : Type v} {J : Type z} + [Fintype B] [Fintype ι] [Fintype J] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = + Submodule.span ℚ (b '' {i | j ≤ ω i})) + (_hd : 1 ≤ d) {p : ℝ} (_hp : 0 ≤ p) + (_hB : (Fintype.card B : ℝ) ≤ p) (_hι : (Fintype.card ι : ℝ) ≤ p) + (_hJ : (Fintype.card J : ℝ) ≤ p) + (_hb : ∀ i j, rationalLogHeight + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).basis.repr (b i) j) ≤ p) + (W : LieSubalgebra ℚ + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded) + (v : J → (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hvheight : ∀ j i, rationalLogHeight + (((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.associatedGradedBasis b ω hN).repr (v j) i) ≤ p) + (E P Q X : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : σ => 1)) + (_hprod : E * P * Q = X) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C)^C) ≤ T i) + (_hE : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolSlowBound + b ω hN (fun _ : σ => 1) T (Real.exp p) E) + (_hP : P.coord ∈ realificationLieSubalgebra + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.symbolPointwiseSubalgebra + b ω hN (fun _ : σ => 1) W)) + (m : ℕ) (_hm : 0 < m) (_hmp : (m : ℝ) ≤ Real.exp p) + (_hQ : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolRationalGrid + b ω hN (fun _ : σ => 1) m Q) + (retained : Submodule ℝ (B → ℝ)) + (_hX : ∀ α, coefficients + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN X) α ∈ retained) + (_hretained : retained ≤ Submodule.span ℝ (Set.range (fun j i => + (detectedTranslationBaseMap w d hw hwd M hM D (v j) i : ℝ)))), + (∀ α, coefficients (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN E) α ∈ + Submodule.span ℝ (Set.range (fun j i => + (detectedTranslationBaseMap w d hw hwd M hM D (v j) i : ℝ)))) ∧ + (∀ α, coefficients (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN Q) α ∈ + Submodule.span ℝ (Set.range (fun j i => + (detectedTranslationBaseMap w d hw hwd M hM D (v j) i : ℝ)))) ∧ + ∀ u : σ → ℝ, + (detectedTranslationGroupEval w d hw hwd M hM D u E).base ∈ + Submodule.span ℝ (Set.range (fun j i => + (detectedTranslationBaseMap w d hw hwd M hM D (v j) i : ℝ))) ∧ + (detectedTranslationGroupEval w d hw hwd M hM D u Q).base ∈ + Submodule.span ℝ (Set.range (fun j i => + (detectedTranslationBaseMap w d hw hwd M hM D (v j) i : ℝ))) := by + let budget : Polynomial ℕ := (Polynomial.X + 3)^5 + obtain ⟨C, hC, hsep⟩ := exists_vectorPolynomial_subspace_separation budget + refine ⟨C, hC, ?_⟩ + intro B L σ ι J _ _ _ _ _ w d hw hwd _ M hM e D b ω hN hd p hp hB hι hJ + hb W v hv hvheight E P Q X hprod T hT hE hP m hm hmp hQ retained hX hretained + have hbudget : budget.eval₂ (Nat.castRingHom ℝ) p = (p + 3)^5 := by + simp [budget, Polynomial.eval₂_pow] + obtain ⟨hpbudget, hsmall, hceil⟩ := detectedTranslationSeparation_budget hp + have hTpos (i : σ) : 0 < T i := (Real.exp_pos _).trans_le (hT i) + let H : ℕ := ⌈Real.exp ((p + 2)^4)⌉₊ + let A : Matrix B J ℚ := fun i j => detectedTranslationBaseMap w d hw hwd M hM D (v j) i + have hA : ∀ i j, RationalHeightLE (A i j) H := by + intro i j + exact rationalHeightLE_ceil_exp + (detectedTranslationBaseFunctional_value_logHeight w d hw hwd M hM D + b ω hN hp hι hb (v j) (hvheight j) i) + obtain ⟨q, hq, hqbound, hgrid⟩ := + detectedTranslationBasePolynomial_exists_coefficient_grid w d hw hwd M hM D + b ω hN hp hι hb hB m hm hmp Q hQ + have hslow := detectedTranslationBasePolynomial_slow_coefficients w d hw hwd M hM D + b ω hN hp hι hb T hTpos E hE + have hqbudget : (q : ℝ) ≤ Real.exp (budget.eval₂ (Nat.castRingHom ℝ) p) := by + rw [hbudget] + exact hqbound.trans (Real.exp_le_exp.mpr hsmall) + obtain ⟨hEco, hQco, hEeval, hQeval⟩ := + hsep A H q (one_le_ceil_exp _) hq hA p hp + (by rw [hbudget]; exact hB.trans hpbudget) + (by rw [hbudget]; exact hJ.trans hpbudget) + (by rw [hbudget]; exact hceil) hqbudget T hT + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN X) + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN E) + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN P) + (detectedTranslationBasePolynomial w d hw hwd M hM D b ω hN Q) + (detectedTranslationBasePolynomial_factorization w d hw hwd M hM D b ω hN hd E P Q X hprod) + (fun α => hretained (hX α)) + (detectedTranslationBasePolynomial_fast_coefficients_mem_span w d hw hwd M hM D b ω hN W v hv P hP) + (detectedTranslationBasePolynomial_constant w d hw hwd M hM D b ω hN E) + (detectedTranslationBasePolynomial_constant w d hw hwd M hM D b ω hN Q) + (fun α i => (hslow α i).trans (by + rw [hbudget] + exact div_le_div_of_nonneg_right (Real.exp_le_exp.mpr hsmall) + (monomialScale_pos T hTpos α).le)) hgrid + refine ⟨hEco, hQco, fun u => ?_⟩ + rw [detectedTranslationGroupEval_base w d hw hwd M hM D b ω hN, + detectedTranslationGroupEval_base w d hw hwd M hM D b ω hN] + have heval (Y : VectorPolynomial σ ℝ (B → ℝ)) : eval₂ u Y = eval u Y := by + simpa using (eval₂_algebraMap (S := ℝ) u Y) + rw [heval, heval] + exact ⟨hEeval u, hQeval u⟩ + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators NNReal + +theorem exists_reduced_majorPolynomial_degree_twisted_correlation_separated_data + (d : ℕ) (hd : 0 < d) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {U L : Type} [Fintype U] [DecidableEq U] + [LieRing L] [LieAlgebra ℚ L] {m t e : ℕ} + (w : Fin m → ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (M : ℕ) (hM : 0 < M) + (D : RationalFilteredNilmanifold L t e) (htd : t < d) + (Ψ : PatchKernel m) (F : MvPolynomial (U ⊕ Fin m) ℝ) + (hF : F ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) + (A : Fin m → MvPolynomial U ℝ) (hA : ∀ i, (A i).totalDegree ≤ w i) + (K : ℝ≥0) (T : (Fin m → ℝ) → (Fin m → ZMod M) → ℂ) + (_hT : ∀ x r, ‖T x r‖ ≤ 1) (_hLip : ∀ r, LipschitzWith K (fun x => T x r)) + (R : D.Niltest (fun _ : U => 1)) (p : ℝ), 0 ≤ p → + (weightedTranslationResidueNilmanifold w d hw hwd M hM).GeometryComplexityLE p → + Real.log (3 + (2 * twistedBufferedTranslationTermLip w d Ψ + (((Fintype.card U + m + 1 : ℕ) : ℝ≥0) ^ d) K : ℝ≥0)) ≤ p → + R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + ∀ (origin : U → ℤ) (lengths : U → ℕ), (∀ i, 0 < lengths i) → + (Fintype.card U : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + ∀ (β : (U → ℤ) → Fin m → ℤ), + (∀ x ∈ translatedIntegerBox origin lengths, ∀ i, + |eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)| ≤ 1 / 2) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, + T (fun i => eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)) + (fun i => (β x i : ZMod M)) * + (Ψ.value (fun i => eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)) : ℂ) * + (Real.fourierChar (eval (fun j => ((Sum.elim x (β x) j : ℤ) : ℝ)) F) : ℂ) * + R.eval x‖ → + ∀ (retained : Fin d → Submodule ℝ (Fin m → ℝ)), + (∀ h, HasLayerSamplingRank (h.val + 1) (fun i => (lengths i : ℝ)) + (Real.exp ((p + C)^C)) (retained h) + (ofCoordinates (R := ℝ) (Pi.basisFun ℝ (Fin m)) + (fun i => weightedHomogeneousComponent (fun _ : U => 1) (w i) (A i)))) → + (∀ α, coefficients (ofCoordinates (R := ℝ) (Pi.basisFun ℝ (Fin m)) + (fun i => weightedHomogeneousComponent (fun _ : U => 1) (w i) (A i))) α ∈ + ⨆ h, retained h) → + let N := pi (pairModels + (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le)) + let orbit := majorTranslationPolynomialOrbit w d hw hwd (fractionalCoefficientPolynomial F) + (fractionalCoefficientPolynomial_mem_weightedSupportLE F + (Sum.elim (fun _ : U => 1) w) d hF) A hA + let partner := D.raiseStepRealOrbit htd.le R.orbit + ∃ (b : Basis (Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L))) + ℚ (PairAlgebra (weightedSubalgebra w d) L)) + (ω : Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L)) → ℕ) + (hLayers : ∀ j, N.filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})), + (∀ i j, rationalLogHeight (N.basis.repr (b i) j) ≤ (p + C)^C) ∧ + ∃ (l : ℕ) (E P S : N.filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (W : LieSubalgebra ℚ N.filtration.AssociatedGraded) + (v : Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L)) → N.filtration.AssociatedGraded) + (Vfast : LieSubalgebra ℚ (weightedSubalgebra w d)) (V : MvPolynomial (Fin m) ℚ) (q : ℕ), + 0 < l ∧ (l : ℝ) ≤ Real.exp ((p + C)^C) ∧ + E * P * S = pairOrbitSymbol (weightedTranslationResidueNilmanifold w d hw hwd M hM) + (D.raiseStep htd.le) orbit partner b ω hLayers ∧ + N.filtration.SymbolSlowBound b ω hLayers (fun _ => 1) + (fun i => (lengths i : ℝ)) (Real.exp ((p + C)^C)) E ∧ + N.filtration.SymbolRationalGrid b ω hLayers (fun _ => 1) l S ∧ + (∀ t : U → ℝ, + eval₂ t ((weightedFiltration w d hwd).realSymbolRepresentative + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) (fun _ : U => 1) + (realificationLieHom (N.filtration.filteredPolynomialSymbolMap + (weightedFiltration w d hwd) (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered + (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le)) + (fun _ : U => 1)) P.coord)) ∈ realificationLieSubalgebra Vfast) ∧ + Vfast = W.map (weightedTranslationGradedProjection N.filtration w d hw hwd + (liePiEval (R := ℚ) true) (pairFirstProjection_filtered + (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le))) ∧ + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule (N.filtration.associatedGradedBasis b ω hLayers) ω W.toSubmodule ∧ + (∀ i j, rationalLogHeight ((N.filtration.associatedGradedBasis b ω hLayers).repr (v i) j) ≤ (p+C)^C) ∧ + P.coord ∈ realificationLieSubalgebra + (N.filtration.symbolPointwiseSubalgebra b ω hLayers (fun _ : U => 1) W) ∧ + V.IsWeightedHomogeneous w d ∧ + (∀ x ∈ Vfast, ∀ z ∈ Vfast.toSubmodule.map + (baseLinear.comp (weightedSubalgebra w d).subtype), + eval z (scalarDirectionalDerivative x.val.base V) = eval z x.val.polynomial) ∧ + 0 < q ∧ (q : ℝ) ≤ Real.exp ((p + C)^C) ∧ + (fun α => V.coeff α) ∈ denominatorGrid q ∧ + realPolynomialMass (MvPolynomial.map (algebraMap ℚ ℝ) V) ≤ Real.exp ((p + C)^C) ∧ + (∀ α, ((V.coeff α).num.natAbs : ℝ) ≤ Real.exp ((p + C)^C) ∧ + ((V.coeff α).den : ℝ) ≤ Real.exp ((p + C)^C)) ∧ + (∀ h, retained h ≤ (Vfast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype))) ∧ + ∀ u : U → ℝ, + (detectedTranslationGroupEval w d hw hwd M hM (D.raiseStep htd.le) u E).base ∈ + (Vfast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) ∧ + (detectedTranslationGroupEval w d hw hwd M hM (D.raiseStep htd.le) u S).base ∈ + (Vfast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) := by + obtain ⟨a, ha, hdata⟩ := exists_reduced_majorPolynomial_degree_twisted_correlation_potential_data d hd + obtain ⟨c, hc, hcontain⟩ := exists_majorTranslation_samplingRank_le_real_base_image + obtain ⟨s, hs, hsep⟩ := exists_detectedTranslation_separated_base + obtain ⟨C, hC, hbudget⟩ := exists_translationMajorSeparated_budget a c s + refine ⟨C, hC, ?_⟩ + intro U L _ _ _ _ m t e w hw hwd _ _ _ _ _ _ _ _ _ M hM D htd Ψ F hF A hA + K T hT hLip R p hp hgeometry hbound hR hRcap origin lengths hlengths hU hlarge β hβ hcorr + retained hrank hAret N orbit partner + let p₁ : ℝ := (p + a)^a + have hp₁ : 0 ≤ p₁ := (translationMajor_initial_budget_bounds a ha p hp).1 + have hpp₁ : p ≤ p₁ := (translationMajor_initial_budget_bounds a ha p hp).2.1 + obtain ⟨hb₁, hb₂, hb₃⟩ := hbudget p hp + have hlarge₁ (i : U) : Real.exp ((p + a)^a) ≤ (lengths i : ℝ) := + (Real.exp_le_exp.mpr hb₁).trans (hlarge i) + obtain ⟨b, ω, hLayers, hb, l, E, P, S, W, v, Vfast, V, q, + hl, hlp, hprod, hE, hS, hfast, hVfast, hv, hW, hh, hP, hV, + hderiv, hq, hqp, hgrid, hmass, hcoeff⟩ := + hdata w hw hwd M hM D htd Ψ F hF A hA K T hT hLip R p hp hgeometry hbound hR hRcap + origin lengths hlengths hU hlarge₁ β hβ hcorr + have hdim : (Fintype.card (Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L))) : ℝ) ≤ p₁ := by + simpa only [Fintype.card_fin] using + (weightedTranslationResidueNilmanifold w d hw hwd M hM).geometry_pair_finrank_le_budget + (D.raiseStep htd.le) hgeometry (D.raiseStep_geometry htd.le hR.1) ha + have hbase : (Fintype.card (Fin m) : ℝ) ≤ p₁ := + (weightedTranslationResidueNilmanifold_base_card_le w d hw hwd M hM hgeometry).trans hpp₁ + let Kfast := (Vfast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) + have hspan : Submodule.span ℝ (Set.range (fun j i => + (detectedTranslationBaseMap w d hw hwd M hM (D.raiseStep htd.le) (v j) i : ℝ))) = Kfast := by + dsimp only [Kfast] + rw [hVfast] + exact detectedTranslationBase_span_eq_real_image w d hw hwd M hM (D.raiseStep htd.le) W v hv + have hTpos (i : U) : 0 < (lengths i : ℝ) := by exact_mod_cast hlengths i + have hret : ∀ h, retained h ≤ Kfast := by + intro h + dsimp only [Kfast] + rw [hVfast] + apply hcontain w d hw hwd M hM (D.raiseStep htd.le) b ω hLayers hd hp₁ hbase hdim hdim + hb W v hv hh (fractionalCoefficientPolynomial F) + (fractionalCoefficientPolynomial_mem_weightedSupportLE F (Sum.elim (fun _ : U => 1) w) d hF) + A hA partner E P S hprod (fun i => (lengths i : ℝ)) hTpos hE hP l hl hlp hS + (h.val + 1) (Real.exp ((p + C)^C)) (retained h) (hrank h) + exact Real.exp_le_exp.mpr hb₂ + let X := pairOrbitSymbol (weightedTranslationResidueNilmanifold w d hw hwd M hM) + (D.raiseStep htd.le) orbit partner b ω hLayers + have hX : ∀ α, coefficients + (detectedTranslationBasePolynomial w d hw hwd M hM (D.raiseStep htd.le) b ω hLayers X) α ∈ + ⨆ h, retained h := by + intro α + rw [detectedTranslationBasePolynomial_majorOrbitSymbol w d hw hwd M hM (D.raiseStep htd.le) + b ω hLayers (fractionalCoefficientPolynomial F) + (fractionalCoefficientPolynomial_mem_weightedSupportLE F (Sum.elim (fun _ : U => 1) w) d hF) + A hA partner] + exact hAret α + have hjoin : (⨆ h, retained h) ≤ Submodule.span ℝ (Set.range (fun j i => + (detectedTranslationBaseMap w d hw hwd M hM (D.raiseStep htd.le) (v j) i : ℝ))) := by + rw [hspan] + exact iSup_le hret + obtain ⟨_, _, hgroup⟩ := hsep w d hw hwd M hM (D.raiseStep htd.le) b ω hLayers + hd hp₁ hbase hdim hdim hb W v hv hh E P S X hprod (fun i => (lengths i : ℝ)) + (fun i => (Real.exp_le_exp.mpr hb₃).trans (hlarge i)) hE hP l hl hlp hS + (⨆ h, retained h) hX hjoin + have hexp := Real.exp_le_exp.mpr hb₁ + refine ⟨b, ω, hLayers, fun i j => (hb i j).trans hb₁, ?_⟩ + refine ⟨l, E, P, S, W, v, Vfast, V, q, hl, hlp.trans hexp, hprod, ?_⟩ + refine ⟨?_, hS, ?_⟩ + · exact N.filtration.symbolSlowBound_mono b ω hLayers (fun _ : U => 1) + (fun i => (lengths i : ℝ)) hTpos hexp E hE + refine ⟨?_, hVfast, hv, ?_⟩ + · convert hfast using 1 + refine ⟨hW, ?_, ?_, hV, hderiv, ?_⟩ + · exact fun i j => (hh i j).trans hb₁ + · convert hP using 1 + refine ⟨hq, hqp.trans hexp, hgrid, hmass.trans hexp, ?_, hret, ?_⟩ + · intro α + exact ⟨(hcoeff α).1.trans hexp, (hcoeff α).2.trans hexp⟩ + · intro u + have hu := hgroup u + rw [hspan] at hu + exact hu + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators NNReal + +theorem exists_reduced_majorPolynomial_degree_twisted_correlation_identity + (d : ℕ) (hd : 0 < d) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {U L : Type} [Fintype U] [DecidableEq U] + [LieRing L] [LieAlgebra ℚ L] {m t e : ℕ} + (w : Fin m → ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (M : ℕ) (hM : 0 < M) + (D : RationalFilteredNilmanifold L t e) (htd : t < d) + (Ψ : PatchKernel m) (F : MvPolynomial (U ⊕ Fin m) ℝ) + (hF : F ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) + (A : Fin m → MvPolynomial U ℝ) (hA : ∀ i, (A i).totalDegree ≤ w i) + (K : ℝ≥0) (T : (Fin m → ℝ) → (Fin m → ZMod M) → ℂ) + (_hT : ∀ x r, ‖T x r‖ ≤ 1) (_hLip : ∀ r, LipschitzWith K (fun x => T x r)) + (R : D.Niltest (fun _ : U => 1)) (p : ℝ), 0 ≤ p → + (weightedTranslationResidueNilmanifold w d hw hwd M hM).GeometryComplexityLE p → + Real.log (3 + (2 * twistedBufferedTranslationTermLip w d Ψ + (((Fintype.card U + m + 1 : ℕ) : ℝ≥0) ^ d) K : ℝ≥0)) ≤ p → + R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + ∀ (origin : U → ℤ) (lengths : U → ℕ), (∀ i, 0 < lengths i) → + (Fintype.card U : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + ∀ (β : (U → ℤ) → Fin m → ℤ), + (∀ x ∈ translatedIntegerBox origin lengths, ∀ i, + |eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)| ≤ 1 / 2) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, + T (fun i => eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)) + (fun i => (β x i : ZMod M)) * + (Ψ.value (fun i => eval (fun j => (x j : ℝ)) (A i) - (β x i : ℝ)) : ℂ) * + (Real.fourierChar (eval (fun j => ((Sum.elim x (β x) j : ℤ) : ℝ)) F) : ℂ) * + R.eval x‖ → + ∀ (retained : Fin d → Submodule ℝ (Fin m → ℝ)), + (∀ h, HasLayerSamplingRank (h.val + 1) (fun i => (lengths i : ℝ)) + (Real.exp ((p + C)^C)) (retained h) + (ofCoordinates (R := ℝ) (Pi.basisFun ℝ (Fin m)) + (fun i => weightedHomogeneousComponent (fun _ : U => 1) (w i) (A i)))) → + (∀ α, coefficients (ofCoordinates (R := ℝ) (Pi.basisFun ℝ (Fin m)) + (fun i => weightedHomogeneousComponent (fun _ : U => 1) (w i) (A i))) α ∈ + ⨆ h, retained h) → + let N := pi (pairModels + (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le)) + let orbit := majorTranslationPolynomialOrbit w d hw hwd (fractionalCoefficientPolynomial F) + (fractionalCoefficientPolynomial_mem_weightedSupportLE F + (Sum.elim (fun _ : U => 1) w) d hF) A hA + let partner := D.raiseStepRealOrbit htd.le R.orbit + ∃ (b : Basis (Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L))) + ℚ (PairAlgebra (weightedSubalgebra w d) L)) + (ω : Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L)) → ℕ) + (hLayers : ∀ j, N.filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})), + (∀ i j, rationalLogHeight (N.basis.repr (b i) j) ≤ (p + C)^C) ∧ + ∃ (l : ℕ) (E P S : N.filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (W : LieSubalgebra ℚ N.filtration.AssociatedGraded) + (v : Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L)) → N.filtration.AssociatedGraded) + (Vfast : LieSubalgebra ℚ (weightedSubalgebra w d)) (V : MvPolynomial (Fin m) ℚ) (q : ℕ), + 0 < l ∧ (l : ℝ) ≤ Real.exp ((p + C)^C) ∧ + E * P * S = pairOrbitSymbol (weightedTranslationResidueNilmanifold w d hw hwd M hM) + (D.raiseStep htd.le) orbit partner b ω hLayers ∧ + N.filtration.SymbolSlowBound b ω hLayers (fun _ => 1) + (fun i => (lengths i : ℝ)) (Real.exp ((p + C)^C)) E ∧ + N.filtration.SymbolRationalGrid b ω hLayers (fun _ => 1) l S ∧ + (∀ t : U → ℝ, + eval₂ t ((weightedFiltration w d hwd).realSymbolRepresentative + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) (fun _ : U => 1) + (realificationLieHom (N.filtration.filteredPolynomialSymbolMap + (weightedFiltration w d hwd) (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered + (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le)) + (fun _ : U => 1)) P.coord)) ∈ realificationLieSubalgebra Vfast) ∧ + Vfast = W.map (weightedTranslationGradedProjection N.filtration w d hw hwd + (liePiEval (R := ℚ) true) (pairFirstProjection_filtered + (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le))) ∧ + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule (N.filtration.associatedGradedBasis b ω hLayers) ω W.toSubmodule ∧ + (∀ i j, rationalLogHeight ((N.filtration.associatedGradedBasis b ω hLayers).repr (v i) j) ≤ (p+C)^C) ∧ + P.coord ∈ realificationLieSubalgebra + (N.filtration.symbolPointwiseSubalgebra b ω hLayers (fun _ : U => 1) W) ∧ + V.IsWeightedHomogeneous w d ∧ + (∀ x ∈ Vfast, ∀ z ∈ Vfast.toSubmodule.map + (baseLinear.comp (weightedSubalgebra w d).subtype), + eval z (scalarDirectionalDerivative x.val.base V) = eval z x.val.polynomial) ∧ + 0 < q ∧ (q : ℝ) ≤ Real.exp ((p + C)^C) ∧ + (fun α => V.coeff α) ∈ denominatorGrid q ∧ + realPolynomialMass (MvPolynomial.map (algebraMap ℚ ℝ) V) ≤ Real.exp ((p + C)^C) ∧ + (∀ α, ((V.coeff α).num.natAbs : ℝ) ≤ Real.exp ((p + C)^C) ∧ + ((V.coeff α).den : ℝ) ≤ Real.exp ((p + C)^C)) ∧ + (∀ h, retained h ≤ (Vfast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype))) ∧ + (∀ u : U → ℝ, + (detectedTranslationGroupEval w d hw hwd M hM (D.raiseStep htd.le) u E).base ∈ + (Vfast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) ∧ + (detectedTranslationGroupEval w d hw hwd M hM (D.raiseStep htd.le) u S).base ∈ + (Vfast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype))) ∧ + ∀ (u : U → ℝ) (z : Fin m → ℝ), + z ∈ (Vfast.toSubmodule.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype)) → + let Ftop := weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d + (fractionalCoefficientPolynomial F) + let F₀ := specializeMajorParameters (RingHom.id ℝ) Ftop 0 + let shift := z - fun j => eval u (majorTranslationTopCoordinates w A j) + let left := detectedTranslationGroupEval w d hw hwd M hM (D.raiseStep htd.le) u E + let right := detectedTranslationGroupEval w d hw hwd M hM (D.raiseStep htd.le) u S + eval (Sum.elim u z) Ftop = + eval shift F₀ + eval (shift + left.base) left.polynomial - + eval₂ (algebraMap ℚ ℝ) (shift + left.base) V + eval z right.polynomial + + eval₂ (algebraMap ℚ ℝ) (z - right.base) V := by + obtain ⟨C, hC, hdata⟩ := exists_reduced_majorPolynomial_degree_twisted_correlation_separated_data d hd + refine ⟨C, hC, ?_⟩ + intro U L _ _ _ _ m t e w hw hwd _ _ _ _ _ _ _ _ _ M hM D htd Ψ F hF A hA + K T hT hLip R p hp hgeometry hbound hR hRcap origin lengths hlengths hU hlarge β hβ hcorr + retained hrank hAret N orbit partner + obtain ⟨b, ω, hLayers, hb, l, E, P, S, W, v, Vfast, V, q, + hl, hlp, hprod, hE, hS, hfast, hVfast, hv, hW, hh, hP, hV, + hderiv, hq, hqp, hgrid, hmass, hcoeff, hret, hgroup⟩ := + hdata w hw hwd M hM D htd Ψ F hF A hA K T hT hLip R p hp hgeometry hbound hR hRcap + origin lengths hlengths hU hlarge β hβ hcorr retained hrank hAret + refine ⟨b, ω, hLayers, hb, ?_⟩ + refine ⟨l, E, P, S, W, v, Vfast, V, q, hl, hlp, hprod, hE, hS, ?_⟩ + refine ⟨?_, hVfast, hv, hW, hh, ?_⟩ + · convert hfast using 1 + refine ⟨?_, hV, hderiv, hq, hqp, hgrid, hmass, hcoeff, hret, hgroup, ?_⟩ + · convert hP using 1 + intro u z hz + have hid := detectedTranslationGroupEval_major_identity w d hw hwd M hM (D.raiseStep htd.le) + b ω hLayers hd (fractionalCoefficientPolynomial F) + (fractionalCoefficientPolynomial_mem_weightedSupportLE F (Sum.elim (fun _ : U => 1) w) d hF) + A hA partner E P S hprod W hP V + dsimp only at hid + rw [← hVfast] at hid + exact hid hderiv (fun x => (hgroup x).2) u z hz + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorTwistedCorrelationStepDrop.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorTwistedCorrelationStepDrop.lean new file mode 100644 index 0000000000000000000000000000000000000000..2739fb2bff52ac6042699af43f034d8c7848c5b4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationMajorTwistedCorrelationStepDrop.lean @@ -0,0 +1,681 @@ +import OAI.Combinatorics.Progressions.Dynamics.TranslationMajorCorrelationBudget +import OAI.Combinatorics.Progressions.Estimates.QuadraticPairStepDrop +import OAI.Combinatorics.Progressions.Estimates.ReducedTranslationMajorTwistedVerticalSelection + +namespace OAI + +universe u + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial CircleFourier +open scoped TensorProduct BigOperators NNReal + +theorem exists_translation_major_vertical_selection : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X U L : Type*} [LieRing L] [LieAlgebra ℚ L] + {m d t e : ℕ} (w : Fin m → ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L t e) (htd : t < d) (ω : U → ℕ) + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) (M : ℝ≥0) + (_hdegree : D₀.totalDegree ≤ d) (_hD : realPolynomialMass D₀ ≤ M) + (orbit : (weightedFiltration w d hwd).realification.PolynomialOrbit ω) + (R : D.Niltest ω) (p : ℝ), 0 ≤ p → + (weightedTranslationNilmanifold w d hw hwd).GeometryComplexityLE p → + Real.log (3 + (2 * bufferedTranslationTermLip w d Ψ M : ℝ≥0)) ≤ p → + R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + ∀ (B : Finset X), B.Nonempty → ∀ (sample : X → U → ℤ) (multiplier : X → ℂ), + (∀ x ∈ B, ‖multiplier x‖ ≤ 1) → + Real.exp (-p) ≤ ‖𝔼 x ∈ B, multiplier x * + bufferedTranslationPhase Ψ D₀ (bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).realification.polynomialOrbitEval ω (sample x) orbit)) * + R.eval (sample x)‖ → + ∃ (η : weightedSubalgebra w d →ₗ[ℚ] ℚ) + (V : (weightedTranslationNilmanifold w d hw hwd).Niltest ω) + (W : (D.raiseStep htd.le).Niltest ω), + V.ComplexityLE ((raisedNiltestBudget p + C) ^ C) ∧ + V.orbit = orbit ∧ V.normBound = 1 ∧ + W.ComplexityLE ((raisedNiltestBudget p + C) ^ C) ∧ + W.orbit = D.raiseStepRealOrbit htd.le R.orbit ∧ W.normBound = R.normBound ∧ + (∀ i, rationalLogHeight (η ((weightedTranslationNilmanifold w d hw hwd).basis i)) ≤ + (raisedNiltestBudget p + C) ^ C) ∧ + η (centralRationalElement w d hd 1) = 1 ∧ + (∀ z, z ∈ (weightedFiltration w d hwd).realification.subgroup d → ∀ x, + V.observable (z • x) = + character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * V.observable x) ∧ + (∀ z, z ∈ (D.raiseStep htd.le).filtration.realification.subgroup d → ∀ x, + W.observable (z • x) = + character ((realifyFunctional (0 : L →ₗ[ℚ] ℚ) z.coord : ℝ) : CircleFourier.Circle) * + W.observable x) ∧ + (∃ x, V.observable x ≠ 0) ∧ (∃ x, W.observable x ≠ 0) ∧ + Real.exp (-((raisedNiltestBudget p + C) ^ C)) ≤ + ‖𝔼 x ∈ B, multiplier x * V.eval (sample x) * W.eval (sample x)‖ := by + obtain ⟨C, hC, hselect⟩ := exists_native_vertical_pair_preserving_characters_power + refine ⟨C, hC, ?_⟩ + intro X U L _ _ m d t e w hw hd hwd _ _ _ _ _ _ _ _ _ D htd ω Ψ D₀ M hdegree hD + orbit R p hp hgeometry hbound hR hRcap B hB sample multiplier hmultiplier hcorr + let Q := weightedTranslationBufferedNiltest w d hw hwd ω hd Ψ D₀ M hdegree hD orbit + have hQ : Q.ComplexityLE p := + weightedTranslationBufferedNiltest_complexity w d hw hwd ω hd Ψ D₀ M hdegree hD orbit + hgeometry hbound + have hraise := le_raisedNiltestBudget p + have hraisedcorr : Real.exp (-(raisedNiltestBudget p)) ≤ + ‖𝔼 x ∈ B, multiplier x * Q.eval (sample x) * (R.raiseStep htd.le).eval (sample x)‖ := by + apply (Real.exp_le_exp.mpr (neg_le_neg hraise)).trans + simpa only [Q, weightedTranslationBufferedNiltest_eval, + RationalFilteredNilmanifold.Niltest.raiseStep_eval] using hcorr + obtain ⟨η, η', V, W, hVc, hVo, hVn, hWc, hWo, hWn, hVheight, _, hvertV, _, + hpresV, _, hVne, hWne, hbias⟩ := + hselect (weightedTranslationNilmanifold w d hw hwd) (D.raiseStep htd.le) + Q (R.raiseStep htd.le) (raisedNiltestBudget p) (hp.trans hraise) + (hQ.mono hraise) (R.raiseStep_complexity htd.le hp hR) + (by change (1 : ℝ) ≤ 1; exact le_rfl) hRcap + B hB sample multiplier hmultiplier hraisedcorr + have hη : η (centralRationalElement w d hd 1) = 1 := + weightedTranslation_selected_frequency_one w d hw hd hwd Ψ D₀ η V.observable + hvertV hVne hpresV + exact ⟨η, V, W, hVc, hVo, hVn, hWc, hWo, hWn, hVheight, hη, hvertV, + D.raiseStep_observable_top_vertical htd W.observable, hVne, hWne, hbias⟩ + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct BigOperators + +namespace RationalFilteredNilmanifold + +variable {L M : Type u} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s d e : ℕ} + +abbrev PairAlgebra (L M : Type u) := ∀ i : Bool, BoolLieFamily L M i + +def pairModels (D : RationalFilteredNilmanifold L s d) + (E : RationalFilteredNilmanifold M s e) : + ∀ i : Bool, RationalFilteredNilmanifold (BoolLieFamily L M i) s (Bool.rec e d i) + | false => E + | true => D + +def pairFrequencies (η : L →ₗ[ℚ] ℚ) (θ : M →ₗ[ℚ] ℚ) : + ∀ i : Bool, BoolLieFamily L M i →ₗ[ℚ] ℚ + | false => θ + | true => η + +noncomputable def pairFrequency (η : L →ₗ[ℚ] ℚ) (θ : M →ₗ[ℚ] ℚ) : + PairAlgebra L M →ₗ[ℚ] ℚ := piFrequency (pairFrequencies η θ) + +@[simp] theorem pairFrequency_apply (η : L →ₗ[ℚ] ℚ) (θ : M →ₗ[ℚ] ℚ) + (x : PairAlgebra L M) : pairFrequency η θ x = η (x true) + θ (x false) := by + rw [pairFrequency, piFrequency_apply, Fintype.sum_bool] + rfl + +variable (D : RationalFilteredNilmanifold L s d) (E : RationalFilteredNilmanifold M s e) + {σ ι : Type*} {w : σ → ℕ} + +noncomputable def pairOrbit (p : D.filtration.realification.PolynomialOrbit w) + (q : E.filtration.realification.PolynomialOrbit w) : + (pi (pairModels D E)).filtration.realification.PolynomialOrbit w := + NilpotentLieFiltration.piRealOrbit (fun i => (pairModels D E i).filtration) + (fun i => by cases i; exact q; exact p) + +noncomputable def pairOrbitSymbol (p : D.filtration.realification.PolynomialOrbit w) + (q : E.filtration.realification.PolynomialOrbit w) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) : + (pi (pairModels D E)).filtration.RealPolynomialSymbolGroup w := + (pi (pairModels D E)).filtration.realPolynomialSymbolHom b ω hF w + ⟨⟨(pairOrbit D E p q).log, (pairOrbit D E p q).property⟩⟩ + +variable [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + +noncomputable def pairTests (V : D.Niltest w) (W : E.Niltest w) : + ∀ i : Bool, (pairModels D E i).Niltest w + | false => W + | true => V + +theorem pairTests_complexity (V : D.Niltest w) (W : E.Niltest w) {p : ℝ} + (hV : V.ComplexityLE p) (hW : W.ComplexityLE p) : + ∀ i, (pairTests D E V W i).ComplexityLE p := by + intro i + cases i + · exact hW + · exact hV + +section ProductTopology + +variable [TopologicalSpace (ℝ ⊗[ℚ] PairAlgebra L M)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] PairAlgebra L M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] PairAlgebra L M)] + [T2Space (ℝ ⊗[ℚ] PairAlgebra L M)] + +noncomputable def pairNiltest (V : D.Niltest w) (W : E.Niltest w) {p : ℝ} + (hp : 2 ≤ p) (hV : V.ComplexityLE p) (hW : W.ComplexityLE p) : + (pi (pairModels D E)).Niltest w := + piNiltest (pairModels D E) (pairTests D E V W) (by linarith) + (by simpa only [Fintype.card_bool, Nat.cast_ofNat] using hp) + (pairTests_complexity D E V W hV hW) + +theorem pairNiltest_eval (V : D.Niltest w) (W : E.Niltest w) {p : ℝ} + (hp : 2 ≤ p) (hV : V.ComplexityLE p) (hW : W.ComplexityLE p) (x : σ → ℤ) : + (pairNiltest D E V W hp hV hW).eval x = V.eval x * W.eval x := by + rw [pairNiltest, piNiltest_eval, Fintype.prod_bool] + rfl + +theorem pairNiltest_complexity (V : D.Niltest w) (W : E.Niltest w) {p : ℝ} + (hp : 2 ≤ p) (hV : V.ComplexityLE p) (hW : W.ComplexityLE p) : + (pairNiltest D E V W hp hV hW).ComplexityLE (productNiltestBudget p) := + piNiltest_complexity (pairModels D E) (pairTests D E V W) (by linarith) + (by simpa only [Fintype.card_bool, Nat.cast_ofNat] using hp) + (pairTests_complexity D E V W hV hW) + +@[simp] theorem pairNiltest_orbit (V : D.Niltest w) (W : E.Niltest w) {p : ℝ} + (hp : 2 ≤ p) (hV : V.ComplexityLE p) (hW : W.ComplexityLE p) : + (pairNiltest D E V W hp hV hW).orbit = pairOrbit D E V.orbit W.orbit := rfl + +@[simp] theorem pairNiltest_symbol (V : D.Niltest w) (W : E.Niltest w) {p : ℝ} + (hp : 2 ≤ p) (hV : V.ComplexityLE p) (hW : W.ComplexityLE p) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) : + (pairNiltest D E V W hp hV hW).symbol b ω hF = + pairOrbitSymbol D E V.orbit W.orbit b ω hF := rfl + +theorem pairNiltest_orbit_eq (V V' : D.Niltest w) (W W' : E.Niltest w) + {p q : ℝ} (hp : 2 ≤ p) (hq : 2 ≤ q) + (hV : V.ComplexityLE p) (hW : W.ComplexityLE p) + (hV' : V'.ComplexityLE q) (hW' : W'.ComplexityLE q) + (hVo : V.orbit = V'.orbit) (hWo : W.orbit = W'.orbit) : + (pairNiltest D E V W hp hV hW).orbit = + (pairNiltest D E V' W' hq hV' hW').orbit := by + rw [pairNiltest_orbit, pairNiltest_orbit, hVo, hWo] + +theorem pairNiltest_symbol_eq_of_orbit_eq (V V' : D.Niltest w) (W W' : E.Niltest w) + {p q : ℝ} (hp : 2 ≤ p) (hq : 2 ≤ q) + (hV : V.ComplexityLE p) (hW : W.ComplexityLE p) + (hV' : V'.ComplexityLE q) (hW' : W'.ComplexityLE q) + (hVo : V.orbit = V'.orbit) (hWo : W.orbit = W'.orbit) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) : + (pairNiltest D E V W hp hV hW).symbol b ω hF = + (pairNiltest D E V' W' hq hV' hW').symbol b ω hF := by + rw [pairNiltest_symbol, pairNiltest_symbol, hVo, hWo] + +end ProductTopology +end RationalFilteredNilmanifold + +open RationalFilteredNilmanifold + +theorem exists_native_pair_vertical_step_drop (s : ℕ) (hs : 2 ≤ s) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ : Type*} [Fintype σ] [DecidableEq σ] + {L M : Type u} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {d e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (D : RationalFilteredNilmanifold L s d) (E : RationalFilteredNilmanifold M s e) + (V : D.Niltest (fun _ : σ => 1)) (W : E.Niltest (fun _ : σ => 1)) + {p : ℝ} (_hp : 2 ≤ p) (_hV : V.ComplexityLE p) (_hW : W.ComplexityLE p), + ∃ (b : Basis (Fin (finrank ℚ (PairAlgebra L M))) ℚ (PairAlgebra L M)) + (ω : Fin (finrank ℚ (PairAlgebra L M)) → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})), + (∀ i j, rationalLogHeight ((pi (pairModels D E)).basis.repr (b i) j) ≤ (p + C) ^ C) ∧ + ∀ (η : L →ₗ[ℚ] ℚ) (θ : M →ₗ[ℚ] ℚ), + (∀ z, z ∈ D.filtration.realification.subgroup s → ∀ x, + V.observable (z • x) = CircleFourier.character + ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * V.observable x) → + (∀ z, z ∈ E.filtration.realification.subgroup s → ∀ x, + W.observable (z • x) = CircleFourier.character + ((realifyFunctional θ z.coord : ℝ) : CircleFourier.Circle) * W.observable x) → + ∀ (origin : σ → ℤ) (lengths : σ → ℕ), (∀ i, 0 < lengths i) → + (Fintype.card σ : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, V.eval x * W.eval x‖ → + (pi (pairModels D E)).filtration.ControlledSymbolFactorization b ω hF + (pairFrequency η θ) (fun i => (lengths i : ℝ)) + (pairOrbitSymbol D E V.orbit W.orbit b ω hF) ((p + C) ^ C) := by + obtain ⟨C, hC, hstep⟩ := exists_finite_product_vertical_step_drop s hs + refine ⟨C, hC, ?_⟩ + intro σ _ _ L M _ _ _ _ d e _ _ _ _ _ _ _ _ D E V W p hp hV hW + let models := pairModels D E + let tests := pairTests D E V W + let : FiniteDimensional ℚ (PairAlgebra L M) := + (productFinBasis models).finiteDimensional_of_finite + let := moduleTopology ℝ (ℝ ⊗[ℚ] PairAlgebra L M) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] PairAlgebra L M) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] PairAlgebra L M) := + realification_moduleTopology_t2 (productFinBasis models) + have hp0 : 0 ≤ p := by linarith + have hcard : (Fintype.card Bool : ℝ) ≤ p := by + simpa only [Fintype.card_bool, Nat.cast_ofNat] using hp + have htests : ∀ i, (tests i).ComplexityLE p := pairTests_complexity D E V W hV hW + obtain ⟨b, ω, hF, hb, hconstruct⟩ := hstep models tests hp0 hcard htests + refine ⟨b, ω, hF, hb, ?_⟩ + intro η θ hη hθ origin lengths hlengths hσ hlarge hbias + have hvert : ∀ i z, z ∈ (models i).filtration.realification.subgroup s → ∀ x, + (tests i).observable (z • x) = CircleFourier.character + ((realifyFunctional (pairFrequencies η θ i) z.coord : ℝ) : CircleFourier.Circle) * + (tests i).observable x := by + intro i + cases i + · exact hθ + · exact hη + have hbias' : Real.exp (-p) ≤ + ‖𝔼 x ∈ translatedIntegerBox origin lengths, ∏ i, (tests i).eval x‖ := by + have heval (x : σ → ℤ) : (∏ i, (tests i).eval x) = V.eval x * W.eval x := by + rw [Fintype.prod_bool] + rfl + simp_rw [heval] + exact hbias + exact hconstruct (pairFrequencies η θ) hvert origin lengths hlengths hσ hlarge hbias' + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +theorem pairFrequency_logHeight + {L M : Type u} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s d e : ℕ} (D : RationalFilteredNilmanifold L s d) + (E : RationalFilteredNilmanifold M s e) + (η : L →ₗ[ℚ] ℚ) (θ : M →ₗ[ℚ] ℚ) {p : ℝ} + (hη : ∀ i, rationalLogHeight (η (D.basis i)) ≤ p) + (hθ : ∀ i, rationalLogHeight (θ (E.basis i)) ≤ p) + (k : Fin (Fintype.card (Σ i : Bool, Fin (Bool.rec e d i)))) : + rationalLogHeight (pairFrequency η θ ((pi (pairModels D E)).basis k)) ≤ p := by + apply piFrequency_logHeight (pairModels D E) (pairFrequencies η θ) + intro i + cases i + · exact hθ + · exact hη + +theorem exists_native_pair_positive_step_drop (s : ℕ) (hs : 1 ≤ s) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ : Type*} [Fintype σ] [DecidableEq σ] + {L M : Type u} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {d e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (D : RationalFilteredNilmanifold L s d) (E : RationalFilteredNilmanifold M s e) + (V : D.Niltest (fun _ : σ => 1)) (W : E.Niltest (fun _ : σ => 1)) + {p : ℝ} (_hp : 2 ≤ p) (_hV : V.ComplexityLE p) (_hW : W.ComplexityLE p), + ∃ (b : Basis (Fin (finrank ℚ (PairAlgebra L M))) ℚ (PairAlgebra L M)) + (ω : Fin (finrank ℚ (PairAlgebra L M)) → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})), + (∀ i j, rationalLogHeight ((pi (pairModels D E)).basis.repr (b i) j) ≤ (p + C) ^ C) ∧ + ∀ (η : L →ₗ[ℚ] ℚ) (θ : M →ₗ[ℚ] ℚ), + (∀ i, rationalLogHeight (η (D.basis i)) ≤ p) → + (∀ i, rationalLogHeight (θ (E.basis i)) ≤ p) → + (∀ z, z ∈ D.filtration.realification.subgroup s → ∀ x, + V.observable (z • x) = CircleFourier.character + ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * V.observable x) → + (∀ z, z ∈ E.filtration.realification.subgroup s → ∀ x, + W.observable (z • x) = CircleFourier.character + ((realifyFunctional θ z.coord : ℝ) : CircleFourier.Circle) * W.observable x) → + ∀ (origin : σ → ℤ) (lengths : σ → ℕ), (∀ i, 0 < lengths i) → + (Fintype.card σ : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, V.eval x * W.eval x‖ → + (pi (pairModels D E)).filtration.ControlledSymbolFactorization b ω hF + (pairFrequency η θ) (fun i => (lengths i : ℝ)) + (pairOrbitSymbol D E V.orbit W.orbit b ω hF) ((p + C) ^ C) := by + by_cases hs2 : 2 ≤ s + · obtain ⟨C, hC, hstep⟩ := exists_native_pair_vertical_step_drop s hs2 + refine ⟨C, hC, ?_⟩ + intro σ _ _ L M _ _ _ _ d e _ _ _ _ _ _ _ _ D E V W p hp hV hW + obtain ⟨b, ω, hF, hb, hconstruct⟩ := hstep D E V W hp hV hW + exact ⟨b, ω, hF, hb, fun η θ _ _ => hconstruct η θ⟩ + · have hs1 : s = 1 := by omega + subst s + let X : Polynomial ℕ := Polynomial.X + let Q := (X + 2) ^ 2 + X + (X + (X ^ 2 + X + 3) ^ 2) + X ^ 2 + 4 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((Q + 2) ^ 4) + refine ⟨C, hC, ?_⟩ + intro σ _ _ L M _ _ _ _ d e _ _ _ _ _ _ _ _ D E V W p hp hV hW + let models := pairModels D E + let N := pi models + let : FiniteDimensional ℚ (PairAlgebra L M) := + (productFinBasis models).finiteDimensional_of_finite + let := moduleTopology ℝ (ℝ ⊗[ℚ] PairAlgebra L M) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] PairAlgebra L M) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] PairAlgebra L M) := + realification_moduleTopology_t2 (productFinBasis models) + have hp0 : 0 ≤ p := by linarith + have hpq : p ≤ productNiltestBudget p := by + have hr := productObservableLipBudget_nonneg hp0 + unfold productNiltestBudget + nlinarith [sq_nonneg (p + 2), sq_nonneg p] + have hq : 0 ≤ productNiltestBudget p := hp0.trans hpq + have hcost : (productNiltestBudget p + 2) ^ 4 ≤ (p + C) ^ C := by + simpa [X, Q, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget p hp0 + have hnonneg : 0 ≤ (p + C) ^ C := by positivity + have hdim : finrank ℚ (PairAlgebra L M) = + Fintype.card (Σ i : Bool, Fin (Bool.rec e d i)) := by + simpa only [Fintype.card_fin] using Module.finrank_eq_card_basis N.basis + rw [hdim] + let ω : Fin (Fintype.card (Σ i : Bool, Fin (Bool.rec e d i))) → ℕ := fun _ => 1 + have hF : ∀ k, N.filtration.layer k = + Submodule.span ℚ (N.basis '' {i | k ≤ ω i}) := + N.filtration.stepOne_basis_layers N.basis + refine ⟨N.basis, ω, hF, ?_, ?_⟩ + · intro i j + rw [Basis.repr_self, Finsupp.single_apply] + split_ifs <;> simpa [rationalLogHeight] using hnonneg + · intro η θ hηheight hθheight hη hθ origin lengths hlengths _hσ _hlarge hbias + let T := pairNiltest D E V W hp hV hW + have hT : T.ComplexityLE (productNiltestBudget p) := + pairNiltest_complexity D E V W hp hV hW + have hfreq : ∀ i, rationalLogHeight (pairFrequency η θ (N.basis i)) ≤ + productNiltestBudget p := + fun i => (pairFrequency_logHeight D E η θ hηheight hθheight i).trans hpq + have hvert : ∀ z, z ∈ N.filtration.realification.subgroup 1 → ∀ x, + T.observable (z • x) = CircleFourier.character + ((realifyFunctional (pairFrequency η θ) z.coord : ℝ) : CircleFourier.Circle) * + T.observable x := by + apply piNiltest_vertical (pairModels D E) (pairTests D E V W) + (pairFrequencies η θ) + intro i + cases i + · exact hθ + · exact hη + have hbias' : Real.exp (-productNiltestBudget p) ≤ + ‖𝔼 x ∈ translatedIntegerBox origin lengths, T.eval x‖ := by + simp_rw [show ∀ x, T.eval x = V.eval x * W.eval x from + pairNiltest_eval D E V W hp hV hW] + exact (Real.exp_le_exp.mpr (neg_le_neg hpq)).trans hbias + have hf := N.stepOne_controlled_symbol_factorization ω hF T (pairFrequency η θ) + hq hT hfreq hvert origin lengths hlengths hbias' + have hf' := NilpotentLieFiltration.ControlledSymbolFactorization.mono + N.filtration N.basis ω hF hf hcost (fun i => by exact_mod_cast hlengths i) + exact hf' + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module VectorPolynomial NilpotentLieFiltration +open scoped TensorProduct BigOperators + +theorem pairOrbitSymbol_eq_of_right_symbol_eq + {L M : Type u} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s d e : ℕ} {σ ι κ : Type*} {w : σ → ℕ} + (D : RationalFilteredNilmanifold L s d) (E : RationalFilteredNilmanifold M s e) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ j, (pi (pairModels D E)).filtration.layer j = + Submodule.span ℚ (b '' {i | j ≤ ω i})) + (c : Basis κ ℚ M) (ν : κ → ℕ) + (hE : ∀ j, E.filtration.layer j = Submodule.span ℚ (c '' {i | j ≤ ν i})) + (p : D.filtration.realification.PolynomialOrbit w) + (q q' : E.filtration.realification.PolynomialOrbit w) + (hq : E.filtration.realPolynomialSymbolHom c ν hE w + (E.filtration.realification.polynomialOrbitCoordinates w q) = + E.filtration.realPolynomialSymbolHom c ν hE w + (E.filtration.realification.polynomialOrbitCoordinates w q')) : + pairOrbitSymbol D E p q b ω hF = pairOrbitSymbol D E p q' b ω hF := by + classical + have hq' : E.filtration.realSymbolOfPolynomial c ν hE w q.log = + E.filtration.realSymbolOfPolynomial c ν hE w q'.log := + congrArg NilpotentLieBCHGroup.coord hq + have hcoeff := (E.filtration.realification.polynomialSymbolMap_eq_iff w + ⟨q.log, q.property⟩ ⟨q'.log, q'.property⟩).mp + ((E.filtration.realSymbolOfPolynomial_eq_iff_symbolMap_eq c ν hE w + ⟨q.log, q.property⟩ ⟨q'.log, q'.property⟩).mp hq') + have hlog : (pairOrbit D E p q).log - (pairOrbit D E p q').log = + VectorPolynomial.map + ((realProductSingle (L := BoolLieFamily L M) false).restrictScalars ℚ) + (q.log - q'.log) := by + simp only [pairOrbit, piRealOrbit, Fintype.sum_bool] + let f := VectorPolynomial.map (σ := σ) + ((realProductSingle (L := BoolLieFamily L M) false).restrictScalars ℚ) + let f₀ := VectorPolynomial.map (σ := σ) + ((realProductSingle (L := BoolLieFamily L M) true).restrictScalars ℚ) + change f₀ p.log + f q.log - (f₀ p.log + f q'.log) = f (q.log - q'.log) + calc + _ = f q.log - f q'.log := by abel + _ = _ := (map_sub f q.log q'.log).symm + apply NilpotentLieBCHGroup.ext + change (pi (pairModels D E)).filtration.realSymbolOfPolynomial b ω hF w + (pairOrbit D E p q).log = + (pi (pairModels D E)).filtration.realSymbolOfPolynomial b ω hF w + (pairOrbit D E p q').log + apply ((pi (pairModels D E)).filtration.realSymbolOfPolynomial_eq_iff_symbolMap_eq + b ω hF w + ⟨(pairOrbit D E p q).log, (pairOrbit D E p q).property⟩ + ⟨(pairOrbit D E p q').log, (pairOrbit D E p q').property⟩).mpr + apply ((pi (pairModels D E)).filtration.realification.polynomialSymbolMap_eq_iff w + ⟨(pairOrbit D E p q).log, (pairOrbit D E p q).property⟩ + ⟨(pairOrbit D E p q').log, (pairOrbit D E p q').property⟩).mpr + intro α + change coefficients ((pairOrbit D E p q).log - (pairOrbit D E p q').log) α ∈ _ + rw [hlog] + have hmap := VectorPolynomial.coefficients_map + ((realProductSingle (L := BoolLieFamily L M) false).restrictScalars ℚ) + (q.log - q'.log) α + rw [hmap] + exact realProductSingle_mem_layer (fun i => (pairModels D E i).filtration) + false _ (hcoeff α) + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators NNReal + +theorem exists_translation_major_correlation_step_drop (d : ℕ) (hd : 1 ≤ d) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {U L : Type} [Fintype U] [DecidableEq U] + [LieRing L] [LieAlgebra ℚ L] {m t e : ℕ} + (w : Fin m → ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L t e) (htd : t < d) + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) (M : ℝ≥0) + (_hdegree : D₀.totalDegree ≤ d) (_hD : realPolynomialMass D₀ ≤ M) + (orbit : (weightedFiltration w d hwd).realification.PolynomialOrbit (fun _ : U => 1)) + (R : D.Niltest (fun _ : U => 1)) (p : ℝ), 0 ≤ p → + (weightedTranslationNilmanifold w d hw hwd).GeometryComplexityLE p → + Real.log (3 + (2 * bufferedTranslationTermLip w d Ψ M : ℝ≥0)) ≤ p → + R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + ∀ (origin : U → ℤ) (lengths : U → ℕ), (∀ i, 0 < lengths i) → + (Fintype.card U : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, + bufferedTranslationPhase Ψ D₀ (bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).realification.polynomialOrbitEval + (fun _ : U => 1) x orbit)) * R.eval x‖ → + let N := pi (pairModels (weightedTranslationNilmanifold w d hw hwd) (D.raiseStep htd.le)) + ∃ (η : weightedSubalgebra w d →ₗ[ℚ] ℚ) + (b : Basis (Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L))) + ℚ (PairAlgebra (weightedSubalgebra w d) L)) + (ω : Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L)) → ℕ) + (hF : ∀ j, N.filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})), + η (centralRationalElement w d (by omega) 1) = 1 ∧ + (∀ i, rationalLogHeight (η ((weightedTranslationNilmanifold w d hw hwd).basis i)) ≤ + (p + C) ^ C) ∧ + (∀ i j, rationalLogHeight (N.basis.repr (b i) j) ≤ (p + C) ^ C) ∧ + N.filtration.ControlledSymbolFactorization b ω hF + (pairFrequency η (0 : L →ₗ[ℚ] ℚ)) (fun i => (lengths i : ℝ)) + (pairOrbitSymbol (weightedTranslationNilmanifold w d hw hwd) (D.raiseStep htd.le) + orbit (D.raiseStepRealOrbit htd.le R.orbit) b ω hF) ((p + C) ^ C) := by + obtain ⟨a, ha, hselect⟩ := exists_translation_major_vertical_selection + obtain ⟨c, _hc, hstep⟩ := exists_native_pair_positive_step_drop d hd + obtain ⟨C, hC, hbudget⟩ := exists_translationMajorCorrelationBudget a c + refine ⟨C, hC, ?_⟩ + intro U L _ _ _ _ m t e w hw hwd _ _ _ _ _ _ _ _ _ D htd Ψ D₀ M hdegree hD + orbit R p hp hgeometry hbound hR hRcap origin lengths hlengths hU hlarge hcorr + dsimp only + have hbox : (translatedIntegerBox origin lengths).Nonempty := by + refine ⟨origin, (mem_translatedIntegerBox origin lengths origin).mpr ?_⟩ + intro i + exact ⟨le_rfl, by have hi := hlengths i; omega⟩ + obtain ⟨η, V, W, hVc, hVo, _hVn, hWc, hWo, _hWn, hheight, hη, hvertV, hvertW, + _hVne, _hWne, hbias⟩ := + hselect w hw (by omega) hwd D htd (fun _ : U => 1) Ψ D₀ M hdegree hD + orbit R p hp hgeometry hbound hR hRcap (translatedIntegerBox origin lengths) hbox + (fun x => x) (fun _ => 1) (fun _ _ => by simp) + (by simpa only [one_mul] using hcorr) + let r := translationMajorPairBudget a p + have hcontrols := translationMajorPairBudget_controls a hp ha + have hpr : p ≤ r := hcontrols.1.trans hcontrols.2.1 + have hr : 2 ≤ r := hcontrols.2.2 + have hcost := hbudget p hp + obtain ⟨b, ω, hF, hb, hconstruct⟩ := + hstep (weightedTranslationNilmanifold w d hw hwd) (D.raiseStep htd.le) V W hr hVc hWc + have hzeroheight : ∀ i, rationalLogHeight ((0 : L →ₗ[ℚ] ℚ) + ((D.raiseStep htd.le).basis i)) ≤ r := by + intro i + simpa [rationalLogHeight] using (show 0 ≤ r by linarith) + have hfactor := hconstruct η (0 : L →ₗ[ℚ] ℚ) hheight hzeroheight hvertV hvertW origin lengths hlengths + (hU.trans hpr) (fun i => (Real.exp_le_exp.mpr hcost.2).trans (hlarge i)) + (by simpa only [one_mul, r, translationMajorPairBudget] using hbias) + rw [hVo, hWo] at hfactor + refine ⟨η, b, ω, hF, hη, fun i => (hheight i).trans hcost.1, + fun i j => (hb i j).trans hcost.2, ?_⟩ + exact NilpotentLieFiltration.ControlledSymbolFactorization.mono _ b ω hF hfactor hcost.2 + (fun i => by exact_mod_cast hlengths i) + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators NNReal + +theorem exists_translation_major_twisted_correlation_step_drop (d : ℕ) (hd : 0 < d) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {U L : Type} [Fintype U] [DecidableEq U] + [LieRing L] [LieAlgebra ℚ L] {m t e : ℕ} + (w : Fin m → ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (M : ℕ) (hM : 0 < M) + (D : RationalFilteredNilmanifold L t e) (htd : t < d) + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) (B K : ℝ≥0) + (_hdegree : D₀.totalDegree ≤ d) (_hD : realPolynomialMass D₀ ≤ B) + (T : (Fin m → ℝ) → (Fin m → ZMod M) → ℂ) + (_hT : ∀ x r, ‖T x r‖ ≤ 1) (_hLip : ∀ r, LipschitzWith K (fun x => T x r)) + (orbit : (weightedFiltration w d hwd).realification.PolynomialOrbit (fun _ : U => 1)) + (R : D.Niltest (fun _ : U => 1)) (p : ℝ), 0 ≤ p → + (weightedTranslationResidueNilmanifold w d hw hwd M hM).GeometryComplexityLE p → + Real.log (3 + (2 * twistedBufferedTranslationTermLip w d Ψ B K : ℝ≥0)) ≤ p → + R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + ∀ (origin : U → ℤ) (lengths : U → ℕ), (∀ i, 0 < lengths i) → + (Fintype.card U : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, + twistedBufferedTranslationPhase M Ψ D₀ T (bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).realification.polynomialOrbitEval + (fun _ : U => 1) x orbit)) * R.eval x‖ → + let N := pi (pairModels + (weightedTranslationResidueNilmanifold w d hw hwd M hM) (D.raiseStep htd.le)) + ∃ (η : weightedSubalgebra w d →ₗ[ℚ] ℚ) + (b : Basis (Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L))) + ℚ (PairAlgebra (weightedSubalgebra w d) L)) + (ω : Fin (finrank ℚ (PairAlgebra (weightedSubalgebra w d) L)) → ℕ) + (hF : ∀ j, N.filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})), + η (centralRationalElement w d hd 1) = 1 ∧ + (∀ i, rationalLogHeight + (η ((weightedTranslationResidueNilmanifold w d hw hwd M hM).basis i)) ≤ + (p + C) ^ C) ∧ + (∀ i j, rationalLogHeight (N.basis.repr (b i) j) ≤ (p + C) ^ C) ∧ + N.filtration.ControlledSymbolFactorization b ω hF + (pairFrequency η (0 : L →ₗ[ℚ] ℚ)) (fun i => (lengths i : ℝ)) + (pairOrbitSymbol (weightedTranslationResidueNilmanifold w d hw hwd M hM) + (D.raiseStep htd.le) orbit (D.raiseStepRealOrbit htd.le R.orbit) b ω hF) + ((p + C) ^ C) := by + obtain ⟨a, ha, hselect⟩ := exists_translation_major_twisted_vertical_selection + obtain ⟨c, _hc, hstep⟩ := exists_native_pair_positive_step_drop d hd + obtain ⟨C, hC, hbudget⟩ := exists_translationMajorCorrelationBudget a c + refine ⟨C, hC, ?_⟩ + intro U L _ _ _ _ m t e w hw hwd _ _ _ _ _ _ _ _ _ M hM D htd Ψ D₀ B K hdegree hD + T hT hLip orbit R p hp hgeometry hbound hR hRcap origin lengths hlengths hU hlarge hcorr + dsimp only + have hbox : (translatedIntegerBox origin lengths).Nonempty := by + refine ⟨origin, (mem_translatedIntegerBox origin lengths origin).mpr ?_⟩ + intro i + exact ⟨le_rfl, by have hi := hlengths i; omega⟩ + obtain ⟨η, V, W, hVc, hVo, _hVn, hWc, hWo, _hWn, hheight, hη, hvertV, hvertW, + _hVne, _hWne, hbias⟩ := + hselect w hw hd hwd M hM D htd (fun _ : U => 1) Ψ D₀ B K hdegree hD + T hT hLip orbit R p hp hgeometry hbound hR hRcap + (translatedIntegerBox origin lengths) hbox + (fun x => x) (fun _ => 1) (fun _ _ => by simp) + (by simpa only [one_mul] using hcorr) + let r := translationMajorPairBudget a p + have hcontrols := translationMajorPairBudget_controls a hp ha + have hpr : p ≤ r := hcontrols.1.trans hcontrols.2.1 + have hr : 2 ≤ r := hcontrols.2.2 + have hcost := hbudget p hp + obtain ⟨b, ω, hF, hb, hconstruct⟩ := + hstep (weightedTranslationResidueNilmanifold w d hw hwd M hM) + (D.raiseStep htd.le) V W hr hVc hWc + have hzero : ∀ i, rationalLogHeight + ((0 : L →ₗ[ℚ] ℚ) ((D.raiseStep htd.le).basis i)) ≤ r := by + intro i + simpa [rationalLogHeight] using (show (0 : ℝ) ≤ r by linarith) + have hfactor := hconstruct η (0 : L →ₗ[ℚ] ℚ) hheight hzero + hvertV hvertW origin lengths hlengths (hU.trans hpr) + (fun i => (Real.exp_le_exp.mpr hcost.2).trans (hlarge i)) + (by simpa only [one_mul, r, translationMajorPairBudget] using hbias) + rw [hVo, hWo] at hfactor + refine ⟨η, b, ω, hF, hη, fun i => (hheight i).trans hcost.1, + fun i j => (hb i j).trans hcost.2, ?_⟩ + exact NilpotentLieFiltration.ControlledSymbolFactorization.mono _ b ω hF hfactor hcost.2 + (fun i => by exact_mod_cast hlengths i) + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TranslationShearExponentialOver.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationShearExponentialOver.lean new file mode 100644 index 0000000000000000000000000000000000000000..01b40160f330ca54235e3660e797bf747fb46a13 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TranslationShearExponentialOver.lean @@ -0,0 +1,80 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialShearAffineExponential + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +variable {R σ : Type*} [CommRing R] [Algebra ℚ R] + {w : σ ⊕ Unit → ℕ} + +omit [Algebra ℚ R] in +theorem translationShear_derivation_rename + (D : PolynomialShearLieAlgebra w R) (b : σ → R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) (P : MvPolynomial σ R) : + ∃ Q : MvPolynomial σ R, D.val (rename Sum.inl P) = rename Sum.inl Q := by + induction P using MvPolynomial.induction_on with + | C c => exact ⟨0, by simp⟩ + | add P Q hP hQ => + obtain ⟨P', hP'⟩ := hP + obtain ⟨Q', hQ'⟩ := hQ + exact ⟨P' + Q', by simp only [map_add, hP', hQ']⟩ + | mul_X P i hP => + obtain ⟨P', hP'⟩ := hP + refine ⟨P * C (b i) + X i * P', ?_⟩ + simp only [map_mul, rename_X, D.val.leibniz, hb, hP', smul_eq_mul, + map_add, rename_C] + +theorem translationShear_exp_extra_coordinate + (D : PolynomialShearLieAlgebra w R) (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + ∃ Q : MvPolynomial σ R, + polynomialShearExp D (X (Sum.inr ())) = X (Sum.inr ()) + rename Sum.inl Q := by + classical + let S : Submodule R (MvPolynomial (σ ⊕ Unit) R) := + LinearMap.range (rename (R := R) (Sum.inl : σ → σ ⊕ Unit)).toLinearMap + have hpow (k : ℕ) : (D.val.toLinearMap ^ (k + 1)) (X (Sum.inr ())) ∈ S := by + induction k with + | zero => exact ⟨P, by simpa using hP.symm⟩ + | succ k ih => + obtain ⟨Q, hQ⟩ := ih + obtain ⟨Q', hQ'⟩ := translationShear_derivation_rename D b hb Q + refine ⟨Q', ?_⟩ + rw [pow_succ', Module.End.mul_apply, ← hQ] + exact hQ'.symm + have hmem : polynomialShearExp D (X (Sum.inr ())) - X (Sum.inr ()) ∈ S := by + rw [polynomialShearExp_eq_sum D (weightedSupportLE_X w (Sum.inr ())), + Finset.sum_range_succ'] + simp only [Nat.factorial_zero, Nat.cast_one, inv_one, pow_zero, Module.End.one_apply, + one_smul, add_sub_cancel_right] + apply (S.restrictScalars ℚ).sum_mem + intro k hk + exact (S.restrictScalars ℚ).smul_mem _ (hpow k) + obtain ⟨Q, hQ⟩ := hmem + refine ⟨Q, ?_⟩ + change rename Sum.inl Q = polynomialShearExp D (X (Sum.inr ())) - X (Sum.inr ()) at hQ + rw [hQ] + abel + +theorem existsUnique_translation_of_shear_exp + (D : PolynomialShearLieAlgebra w R) (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + ∃! g : PolynomialTranslationGroupOver R σ, + PolynomialTranslationGroupOver.actionMonoidHom g = (polynomialShearExpAut D).val := by + obtain ⟨Q, hQ⟩ := translationShear_exp_extra_coordinate D b P hb hP + apply PolynomialTranslationGroupOver.existsUnique_action_of_shape + (polynomialShearExpAut D).val b Q + · intro i + exact polynomialShearExp_X_of_derivation_eq_C D (Sum.inl i) (b i) (hb i) + · exact hQ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TriangularCorrectionRows.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TriangularCorrectionRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3131b2af69522f16873152b8c6d00fdc3e50b0a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TriangularCorrectionRows.lean @@ -0,0 +1,115 @@ +import Mathlib.Algebra.BigOperators.Fin +import Mathlib.Data.Matrix.Basic +import Mathlib.Basic.Real.Basic +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def triangularCorrectionSolutions {n : ℕ} + (A : Matrix (Fin n) (Fin n) ℝ) (c : Fin n → ℝ) (B : ℝ) (q : ℕ) : + Set ((Fin n → ℝ) × (Fin n → ℚ)) := + {sr | (∀ i, |sr.1 i| ≤ B) ∧ + (∀ i, ∃ z : ℤ, sr.2 i = (z : ℚ) / q) ∧ + ∀ i, c i = ∑ j, A i j * sr.1 j + (sr.2 i : ℝ)} + +theorem triangularCorrectionSolutions_prefix {n : ℕ} + {A : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ} + {c : Fin (n + 1) → ℝ} {B : ℝ} {q : ℕ} + {sr : (Fin (n + 1) → ℝ) × (Fin (n + 1) → ℚ)} + (htri : ∀ i j, i < j → A i j = 0) + (hsr : sr ∈ triangularCorrectionSolutions A c B q) : + ((fun i : Fin n => sr.1 i.castSucc), (fun i : Fin n => sr.2 i.castSucc)) ∈ + triangularCorrectionSolutions (fun i j => A i.castSucc j.castSucc) + (fun i => c i.castSucc) B q := by + refine ⟨fun i => hsr.1 i.castSucc, fun i => hsr.2.1 i.castSucc, ?_⟩ + intro i + have hi := hsr.2.2 i.castSucc + rw [Fin.sum_univ_castSucc] at hi + simpa only [htri i.castSucc (Fin.last n) i.castSucc_lt_last, zero_mul, add_zero] + using hi + +theorem triangularCorrectionSolutions_last_eq {n : ℕ} + {A : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ} + {c : Fin (n + 1) → ℝ} {B : ℝ} {q : ℕ} + {sr : (Fin (n + 1) → ℝ) × (Fin (n + 1) → ℚ)} + (hsr : sr ∈ triangularCorrectionSolutions A c B q) + (hdiag : A (Fin.last n) (Fin.last n) ≠ 0) : + sr.1 (Fin.last n) = + (c (Fin.last n) - ∑ j : Fin n, A (Fin.last n) j.castSucc * sr.1 j.castSucc - + (sr.2 (Fin.last n) : ℝ)) / A (Fin.last n) (Fin.last n) := by + apply (eq_div_iff hdiag).2 + have hi := hsr.2.2 (Fin.last n) + rw [Fin.sum_univ_castSucc] at hi + linarith + +theorem triangularCorrectionSolutions_last_window {n : ℕ} + {A : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ} + {c : Fin (n + 1) → ℝ} {B : ℝ} {q : ℕ} + {sr : (Fin (n + 1) → ℝ) × (Fin (n + 1) → ℚ)} + (hsr : sr ∈ triangularCorrectionSolutions A c B q) + (_hB : 0 ≤ B) (hdiag : |A (Fin.last n) (Fin.last n)| ≤ 1) : + |(sr.2 (Fin.last n) : ℝ) - + (c (Fin.last n) - ∑ j : Fin n, A (Fin.last n) j.castSucc * sr.1 j.castSucc)| ≤ B := by + have hi := hsr.2.2 (Fin.last n) + rw [Fin.sum_univ_castSucc] at hi + have heq : (sr.2 (Fin.last n) : ℝ) - + (c (Fin.last n) - ∑ j : Fin n, A (Fin.last n) j.castSucc * sr.1 j.castSucc) = + -(A (Fin.last n) (Fin.last n) * sr.1 (Fin.last n)) := by linarith + rw [heq, abs_neg, abs_mul] + calc + _ ≤ 1 * |sr.1 (Fin.last n)| := + mul_le_mul_of_nonneg_right hdiag (abs_nonneg _) + _ ≤ B := by simpa only [one_mul] using hsr.1 (Fin.last n) + +theorem triangularCorrectionSolutions_slow_unique {n : ℕ} + {A : Matrix (Fin n) (Fin n) ℝ} {c : Fin n → ℝ} {B : ℝ} {q : ℕ} + {sr tr : (Fin n → ℝ) × (Fin n → ℚ)} + (htri : ∀ i j, i < j → A i j = 0) + (hdiag : ∀ i, A i i ≠ 0) + (hsr : sr ∈ triangularCorrectionSolutions A c B q) + (htr : tr ∈ triangularCorrectionSolutions A c B q) + (hr : sr.2 = tr.2) : sr.1 = tr.1 := by + induction n with + | zero => + funext i + exact Fin.elim0 i + | succ n ih => + have hp : (fun i : Fin n => sr.1 i.castSucc) = + (fun i : Fin n => tr.1 i.castSucc) := by + apply ih (fun i j hij => htri i.castSucc j.castSucc hij) + (fun i => hdiag i.castSucc) + (triangularCorrectionSolutions_prefix htri hsr) + (triangularCorrectionSolutions_prefix htri htr) + exact congrArg (fun r => fun i : Fin n => r i.castSucc) hr + funext i + refine Fin.lastCases ?_ (fun j => congrFun hp j) i + rw [triangularCorrectionSolutions_last_eq hsr (hdiag (Fin.last n)), + triangularCorrectionSolutions_last_eq htr (hdiag (Fin.last n)), hr] + have hsum : (∑ j : Fin n, A (Fin.last n) j.castSucc * sr.1 j.castSucc) = + ∑ j : Fin n, A (Fin.last n) j.castSucc * tr.1 j.castSucc := by + apply Finset.sum_congr rfl + intro j _ + rw [congrFun hp j] + rw [hsum] + +theorem triangularCorrectionSolutions_eq_of_rational_eq {n : ℕ} + {A : Matrix (Fin n) (Fin n) ℝ} {c : Fin n → ℝ} {B : ℝ} {q : ℕ} + {sr tr : (Fin n → ℝ) × (Fin n → ℚ)} + (htri : ∀ i j, i < j → A i j = 0) + (hdiag : ∀ i, A i i ≠ 0) + (hsr : sr ∈ triangularCorrectionSolutions A c B q) + (htr : tr ∈ triangularCorrectionSolutions A c B q) + (hr : sr.2 = tr.2) : sr = tr := + Prod.ext (triangularCorrectionSolutions_slow_unique htri hdiag hsr htr hr) hr + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TruncatedSeries.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TruncatedSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..5cc6954ee225a2bde6027cd45212455c550dcd78 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TruncatedSeries.lean @@ -0,0 +1,147 @@ +import Mathlib.Algebra.Algebra.NonUnitalSubalgebra +import Mathlib.RingTheory.Congruence.Hom +import Mathlib.RingTheory.PowerSeries.Order +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 +variable {A B : Type*} [Ring A] [Algebra ℚ A] [Ring B] [Algebra ℚ B] + +def truncatedSeriesCon (A : Type*) [Ring A] (s : ℕ) : RingCon (PowerSeries A) where + r f g := ∀ n, n ≤ s → PowerSeries.coeff n f = PowerSeries.coeff n g + iseqv := ⟨fun _ _ _ => rfl, fun h n hn => (h n hn).symm, + fun h₁ h₂ n hn => (h₁ n hn).trans (h₂ n hn)⟩ + add' hf hg n hn := by rw [map_add, map_add, hf n hn, hg n hn] + mul' hf hg n hn := by + rw [PowerSeries.coeff_mul, PowerSeries.coeff_mul] + apply Finset.sum_congr rfl + intro ij hij + have he := Finset.mem_antidiagonal.mp hij + rw [hf ij.1 (by omega), hg ij.2 (by omega)] + +abbrev TruncatedSeries (A : Type*) [Ring A] (s : ℕ) := (truncatedSeriesCon A s).Quotient + +noncomputable def truncatedSeriesMk (s : ℕ) : PowerSeries A →ₐ[ℚ] TruncatedSeries A s := + (truncatedSeriesCon A s).mkₐ ℚ + +theorem truncatedSeriesMk_surjective (s : ℕ) : + Function.Surjective (truncatedSeriesMk (A := A) s) := + (truncatedSeriesCon A s).mkₐ_surjective + +theorem truncatedSeriesMk_eq_iff (s : ℕ) (f g : PowerSeries A) : + truncatedSeriesMk s f = truncatedSeriesMk s g ↔ + ∀ n, n ≤ s → PowerSeries.coeff n f = PowerSeries.coeff n g := + (truncatedSeriesCon A s).eq + +noncomputable def truncatedSeriesCoeff (s n : ℕ) (hn : n ≤ s) : + TruncatedSeries A s →ₗ[ℚ] A where + toFun := Quotient.lift (PowerSeries.coeff n) (fun _ _ h => h n hn) + map_add' p q := by + obtain ⟨f, rfl⟩ := truncatedSeriesMk_surjective s p + obtain ⟨g, rfl⟩ := truncatedSeriesMk_surjective s q + exact map_add (PowerSeries.coeff n) f g + map_smul' r p := by + obtain ⟨f, rfl⟩ := truncatedSeriesMk_surjective s p + exact PowerSeries.coeff_smul n f r + +@[simp] theorem truncatedSeriesCoeff_mk (s n : ℕ) (hn : n ≤ s) (f : PowerSeries A) : + truncatedSeriesCoeff s n hn (truncatedSeriesMk s f) = PowerSeries.coeff n f := rfl + +theorem truncatedSeries_ext {s : ℕ} {p q : TruncatedSeries A s} + (h : ∀ n (hn : n ≤ s), truncatedSeriesCoeff s n hn p = truncatedSeriesCoeff s n hn q) : + p = q := by + obtain ⟨f, rfl⟩ := truncatedSeriesMk_surjective s p + obtain ⟨g, rfl⟩ := truncatedSeriesMk_surjective s q + exact (truncatedSeriesMk_eq_iff s f g).mpr h + +noncomputable def seriesConstantCoeff : PowerSeries A →ₐ[ℚ] A := + { PowerSeries.constantCoeff with + commutes' r := by + change PowerSeries.constantCoeff (PowerSeries.C (algebraMap ℚ A r)) = _ + exact PowerSeries.constantCoeff_C _ } + +noncomputable def truncatedSeriesConstantCoeff (s : ℕ) : TruncatedSeries A s →ₐ[ℚ] A := + (truncatedSeriesCon A s).liftₐ seriesConstantCoeff (by + intro f g h + change PowerSeries.constantCoeff f = PowerSeries.constantCoeff g + simpa only [PowerSeries.coeff_zero_eq_constantCoeff] using h 0 (Nat.zero_le s)) + +@[simp] theorem truncatedSeriesConstantCoeff_mk (s : ℕ) (f : PowerSeries A) : + truncatedSeriesConstantCoeff s (truncatedSeriesMk s f) = PowerSeries.constantCoeff f := rfl + +noncomputable def truncatedSeriesMap (s : ℕ) (φ : A →ₐ[ℚ] B) : + TruncatedSeries A s →ₐ[ℚ] TruncatedSeries B s := + (truncatedSeriesCon A s).liftₐ ((truncatedSeriesMk s).comp (PowerSeries.mapAlgHom φ)) (by + intro f g h + apply (truncatedSeriesMk_eq_iff s _ _).mpr + intro n hn + change φ (PowerSeries.coeff n f) = φ (PowerSeries.coeff n g) + rw [h n hn]) + +@[simp] theorem truncatedSeriesMap_mk (s : ℕ) (φ : A →ₐ[ℚ] B) (f : PowerSeries A) : + truncatedSeriesMap s φ (truncatedSeriesMk s f) = + truncatedSeriesMk s (PowerSeries.mapAlgHom φ f) := rfl + +@[simp] theorem truncatedSeriesCoeff_map (s n : ℕ) (hn : n ≤ s) (φ : A →ₐ[ℚ] B) + (p : TruncatedSeries A s) : + truncatedSeriesCoeff s n hn (truncatedSeriesMap s φ p) = + φ (truncatedSeriesCoeff s n hn p) := by + obtain ⟨f, rfl⟩ := truncatedSeriesMk_surjective s p + simp [PowerSeries.mapAlgHom_apply] + +@[simp] theorem truncatedSeriesConstantCoeff_map (s : ℕ) (φ : A →ₐ[ℚ] B) + (p : TruncatedSeries A s) : + truncatedSeriesConstantCoeff s (truncatedSeriesMap s φ p) = + φ (truncatedSeriesConstantCoeff s p) := by + obtain ⟨f, rfl⟩ := truncatedSeriesMk_surjective s p + change PowerSeries.constantCoeff (PowerSeries.map φ.toRingHom f) = _ + rw [← PowerSeries.coeff_zero_eq_constantCoeff, PowerSeries.coeff_map, + PowerSeries.coeff_zero_eq_constantCoeff] + rfl + +noncomputable def truncatedSeriesPositive (s : ℕ) : NonUnitalSubalgebra ℚ (TruncatedSeries A s) where + carrier := {p | truncatedSeriesConstantCoeff s p = 0} + zero_mem' := map_zero _ + add_mem' hp hq := by + change truncatedSeriesConstantCoeff s _ = 0 at hp hq ⊢ + rw [map_add, hp, hq, zero_add] + smul_mem' r p hp := by + change truncatedSeriesConstantCoeff s _ = 0 at hp ⊢ + rw [map_smul, hp, smul_zero] + mul_mem' hp hq := by + change truncatedSeriesConstantCoeff s _ = 0 at hp hq ⊢ + rw [map_mul, hp, hq, zero_mul] + +@[simp] theorem mem_truncatedSeriesPositive {s : ℕ} {p : TruncatedSeries A s} : + p ∈ truncatedSeriesPositive s ↔ truncatedSeriesConstantCoeff s p = 0 := Iff.rfl + +theorem truncatedSeriesPositive_pow {s : ℕ} {p : TruncatedSeries A s} + (hp : p ∈ truncatedSeriesPositive s) : p ^ (s + 1) = 0 := by + obtain ⟨f, rfl⟩ := truncatedSeriesMk_surjective s p + change PowerSeries.constantCoeff f = 0 at hp + rw [← map_pow, ← map_zero (truncatedSeriesMk s)] + apply (truncatedSeriesMk_eq_iff s _ _).mpr + intro n hn + rw [map_zero] + apply PowerSeries.coeff_of_lt_order + exact lt_of_lt_of_le (by exact_mod_cast (Nat.lt_succ_of_le hn)) + (PowerSeries.le_order_pow_of_constantCoeff_eq_zero (s + 1) hp) + +theorem truncatedSeriesPositive_nilpotent {s : ℕ} {p : TruncatedSeries A s} + (hp : p ∈ truncatedSeriesPositive s) : IsNilpotent p := + ⟨s + 1, truncatedSeriesPositive_pow hp⟩ + +theorem truncatedSeriesMap_positive (s : ℕ) (φ : A →ₐ[ℚ] B) + {p : TruncatedSeries A s} (hp : p ∈ truncatedSeriesPositive s) : + truncatedSeriesMap s φ p ∈ truncatedSeriesPositive s := by + rw [mem_truncatedSeriesPositive, truncatedSeriesConstantCoeff_map, + mem_truncatedSeriesPositive.mp hp, map_zero] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TruncatedSeriesFiltration.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TruncatedSeriesFiltration.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2485da0cbb808607c22dab5237eba5fb4de60b8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TruncatedSeriesFiltration.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Nilpotent.LieBCHContinuity + +namespace OAI + +section + +namespace Erdos3 +variable {A : Type*} [Ring A] [Algebra ℚ A] + +noncomputable def truncatedSeriesLayer (s i : ℕ) : Submodule ℚ (TruncatedSeries A s) where + carrier := {p | ∀ n (hn : n ≤ s), n < i → truncatedSeriesCoeff s n hn p = 0} + zero_mem' n hn _ := map_zero _ + add_mem' hp hq n hn hi := by rw [map_add, hp n hn hi, hq n hn hi, zero_add] + smul_mem' r p hp n hn hi := by rw [map_smul, hp n hn hi, smul_zero] + +theorem truncatedSeriesLayer_mul {s i j : ℕ} {p q : TruncatedSeries A s} + (hp : p ∈ truncatedSeriesLayer s i) (hq : q ∈ truncatedSeriesLayer s j) : + p * q ∈ truncatedSeriesLayer s (i + j) := by + obtain ⟨f, rfl⟩ := truncatedSeriesMk_surjective s p + obtain ⟨g, rfl⟩ := truncatedSeriesMk_surjective s q + intro n hn hij + change PowerSeries.coeff n (f * g) = 0 + rw [PowerSeries.coeff_mul] + apply Finset.sum_eq_zero + intro ab hab + have he := Finset.mem_antidiagonal.mp hab + by_cases ha : ab.1 < i + · change ∀ n (hn : n ≤ s), n < i → PowerSeries.coeff n f = 0 at hp + rw [hp ab.1 (by omega) ha, zero_mul] + · change ∀ n (hn : n ≤ s), n < j → PowerSeries.coeff n g = 0 at hq + rw [hq ab.2 (by omega) (by omega), mul_zero] + +noncomputable def truncatedSeriesFiltration (s : ℕ) : NilpotentAlgebraFiltration (TruncatedSeries A s) s where + layer := truncatedSeriesLayer s + antitone _ _ hij _ hp n hn hi := hp n hn (lt_of_lt_of_le hi hij) + zero_eq_top := by ext p; simp [truncatedSeriesLayer] + mul_mem := truncatedSeriesLayer_mul + terminal := by + apply le_antisymm + · intro p hp + rw [Submodule.mem_bot] + apply truncatedSeries_ext + intro n hn + rw [map_zero] + exact hp n hn (Nat.lt_succ_of_le hn) + · exact bot_le + +theorem truncatedSeriesLayer_one {s : ℕ} {p : TruncatedSeries A s} : + p ∈ truncatedSeriesLayer s 1 ↔ p ∈ truncatedSeriesPositive s := by + obtain ⟨f, rfl⟩ := truncatedSeriesMk_surjective s p + constructor + · intro h + change PowerSeries.constantCoeff f = 0 + simpa only [truncatedSeriesCoeff_mk, PowerSeries.coeff_zero_eq_constantCoeff] using h 0 (Nat.zero_le s) (by decide) + · intro h n hn hi + have hn0 : n = 0 := Nat.lt_one_iff.mp hi + subst n + change PowerSeries.coeff 0 f = 0 + rw [PowerSeries.coeff_zero_eq_constantCoeff] + exact h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/TwoDownsetPrecision.lean b/lean/OAI/Combinatorics/Progressions/Estimates/TwoDownsetPrecision.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d1f0a4d320ed13661c13bb2a7f62df68340610a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/TwoDownsetPrecision.lean @@ -0,0 +1,526 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeTwoVariableSplitFreezing +import OAI.Combinatorics.Progressions.Polynomial.CanonicalPositivePolynomialSplitting + +namespace OAI + + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module NilpotentLieBCHGroup VectorPolynomial +open scoped BigOperators TensorProduct NNReal + +def DownsetSplittingStatement (s t a C : ℕ) : Prop := + ∀ {I α σ L : Type*} [Fintype I] [Fintype α] [DecidableEq α] + [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + {d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) (J : α → Set (σ →₀ ℕ)) + [∀ i, DecidablePred (· ∈ J i)] (hJ : ∀ i, IsLowerSet (J i)) + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (p : ℝ), (∑ i, bound i) = t → M.ComplexityLE p → + (Fintype.card α : ℝ) ≤ p + 2 → + (∀ c, c ≠ 0 → (∀ i, c ∉ J i) → M.filtration.layer (fun j => c j) = ⊥) → + ∀ g : M.filtration.realification.PolynomialOrbit, + ∀ epsilon : ℝ, 0 < epsilon → 1 / epsilon ≤ Real.exp ((p + 2) ^ a) → + (Fintype.card I : ℝ) ≤ Real.exp p → + letI : ∀ i, TopologicalSpace (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => moduleTopology ℝ _ + letI : ∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => IsModuleTopology.isTopologicalAddGroup ℝ _ + letI : ∀ i, T2Space (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun i => realification_moduleTopology_t2 (M.positivePolynomialDownsetFinBasis (J i) (hJ i) p) + ∃ r : ℝ, p ≤ r ∧ r ≤ (p + C) ^ C ∧ + ∃ (B : ℕ) (hB : 0 < B) (hstable : M.PositivePolynomialGridStable r B), + (∀ i, (M.positivePolynomialDownsetModelMultidegree (J i) (hJ i) r B hB hstable).ComplexityLE ((p + C) ^ C)) ∧ + (∀ i, Fintype.card (M.PositivePolynomialDownsetIndex (J i)) ≤ 2 ^ t * d) ∧ + ∃ h : M.filtration.positivePolynomialMultidegree.realification.PolynomialOrbit, + M.filtration.positivePolynomialMultidegree.realification.polynomialOrbitEval 0 h = 1 ∧ + ∃ n : α → ℕ, (∀ i, 0 < n i) ∧ + (∀ i, (n i : ℝ) ≤ Real.exp ((p + C) ^ C)) ∧ + (Fintype.card (∀ i, Fin (n i)) : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ T : ∀ i, Fin (n i) → (M.positivePolynomialDownsetModel (J i) (hJ i) r B hB hstable).Niltest (fun _ : σ => 1), + (∀ i j, (T i j).normBound = 1) ∧ (∀ i j, (T i j).UnitIntervalValued) ∧ + (∀ i j, (T i j).ComplexityLE ((p + C) ^ C)) ∧ + (∀ i j, (T i j).orbit = + (M.positivePolynomialDownsetModelMultidegree (J i) (hJ i) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J i) (hJ i) h)) ∧ + ∀ (u : I → D.Space → ℂ) (ell : ℝ≥0), (ell : ℝ) ≤ Real.exp p → + (letI := D.metricSpace; ∀ k, LipschitzWith ell (u k)) → + (∀ k x, ‖u k x‖ ≤ 1) → + ∃ c : (∀ i, Fin (n i)) → EuclideanSpace ℂ I, + (∀ j k, ‖c j k‖ ≤ 2) ∧ (∀ j, ‖c j‖ ≤ Real.exp ((p + C) ^ C)) ∧ + ∀ x, ‖(WithLp.toLp 2 (fun k => u k + (QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval x g))) : EuclideanSpace ℂ I) - + ∑ j, (∏ i, (T i (j i)).eval x) • c j‖ ≤ epsilon + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module NilpotentLieBCHGroup VectorPolynomial +open scoped BigOperators TensorProduct NNReal + +theorem exists_multidegree_downset_splitting (s t a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ DownsetSplittingStatement s t a C := by + obtain ⟨b, _, hnormalize⟩ := exists_controlled_multidegree_basepoint_normalization s + obtain ⟨c, _, hsplit⟩ := exists_canonical_positivePolynomial_splitting t a + let Q : Polynomial ℕ := Polynomial.X + (Polynomial.X + Polynomial.C b) ^ b + 2 + let P : Polynomial ℕ := Q + (Q + Polynomial.C c) ^ c + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro I α σ L _ _ _ _ _ _ _ d D bound M J _ hJ _ _ _ _ + p ht hM hα hcover g epsilon hepsilon hscale hI + let : ∀ i, TopologicalSpace (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => moduleTopology ℝ _ + let : ∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => IsModuleTopology.isTopologicalAddGroup ℝ _ + let : ∀ i, T2Space (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun i => realification_moduleTopology_t2 (M.positivePolynomialDownsetFinBasis (J i) (hJ i) p) + have hp : 0 ≤ p := (Nat.cast_nonneg d).trans hM.1.1 + let r := p + (p + b) ^ b + 2 + have hnormal_nonneg : 0 ≤ (p + b) ^ b := by positivity + have hpr : p ≤ r := by dsimp [r]; linarith only [hnormal_nonneg] + have hr : 0 ≤ r := hp.trans hpr + have hcost : r + (r + c) ^ c + 2 ≤ (p + C) ^ C := by + simpa [P, Q, r, Polynomial.eval₂_pow] using hbudget p hp + have hpow : 0 ≤ (r + c) ^ c := by positivity + have hr_cost : r ≤ (p + C) ^ C := by linarith only [hcost, hpow] + have hpower_cost : (r + c) ^ c ≤ (p + C) ^ C := by linarith only [hcost, hr] + obtain ⟨ε, A, hA, hLip, g', hg', heval⟩ := hnormalize M hp hM.1 g + have hshift : p + 2 ≤ r + 2 := by linarith only [hpr] + have hscale_r : 1 / epsilon ≤ Real.exp ((r + 2) ^ a) := + hscale.trans (Real.exp_le_exp.mpr (pow_le_pow_left₀ (by positivity) hshift a)) + obtain ⟨B, hB, hstable, hresult⟩ := + hsplit (I := I) (α := α) (σ := σ) (L := L) M J hJ r ht (hM.mono M hpr) (hα.trans hshift) hcover g' hg' + epsilon hepsilon hscale_r (hI.trans (Real.exp_le_exp.mpr hpr)) + obtain ⟨hE, h, hh, hresult⟩ := hresult + obtain ⟨n, hn, hnb, hcount, T, hresult⟩ := hresult + obtain ⟨hTnorm, hTunit, hT, hTorbit, happrox⟩ := hresult + have hdim (i) : Fintype.card (M.PositivePolynomialDownsetIndex (J i)) ≤ 2 ^ t * d := by + apply (M.positivePolynomialDownsetIndex_card_le (J i)).trans + simpa only [ht] using M.positivePolynomialBasisIndex_card_le r + refine ⟨r, hpr, hr_cost, B, hB, hstable, fun i => (hE i).mono _ hpower_cost, + hdim, h, hh, n, hn, fun i => (hnb i).trans (Real.exp_le_exp.mpr hpower_cost), + hcount.trans (Real.exp_le_exp.mpr hpower_cost), T, hTnorm, hTunit, + fun i j => (hT i j).mono hpower_cost, hTorbit, ?_⟩ + let := D.metricSpace + have htranslated_bound : Real.exp p * (A : ℝ) ≤ Real.exp r := by + calc + _ ≤ Real.exp p * Real.exp ((p + b) ^ b) := + mul_le_mul_of_nonneg_left hA (Real.exp_nonneg _) + _ = Real.exp (p + (p + b) ^ b) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (by dsimp [r]; exact le_add_of_nonneg_right (by norm_num)) + exact vector_approximation_precompose (I := I) (J := ∀ i, Fin (n i)) + (S := σ → ℤ) (X := D.Space) (A := A) (p := p) (q := r) + (B := Real.exp ((r + c) ^ c)) (B' := Real.exp ((p + C) ^ C)) + (epsilon := epsilon) (fun y : D.Space => ε • y) + (fun x => QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval x g')) + (fun x => QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval x g)) + (fun j x => ∏ i, (T i (j i)).eval x) hLip heval htranslated_bound + (Real.exp_le_exp.mpr hpower_cost) happrox + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module VectorPolynomial +open scoped BigOperators TensorProduct NNReal + +def TwoDownsetSplittingStatement (s t a C : ℕ) : Prop := + ∀ {σ L : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + {d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) (J : Bool → Set (σ →₀ ℕ)) + [∀ b, DecidablePred (· ∈ J b)] (hJ : ∀ b, IsLowerSet (J b)) + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (p : ℝ), (∑ i, bound i) = t → M.ComplexityLE p → + (∀ c, c ≠ 0 → c ∉ J false ∪ J true → M.filtration.layer (fun i => c i) = ⊥) → + ∀ g : M.filtration.realification.PolynomialOrbit, + ∀ epsilon : ℝ, 0 < epsilon → 1 / epsilon ≤ Real.exp ((p + 2) ^ a) → + letI : ∀ b, TopologicalSpace (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun _ => moduleTopology ℝ _ + letI : ∀ b, IsTopologicalAddGroup (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun _ => IsModuleTopology.isTopologicalAddGroup ℝ _ + letI : ∀ b, T2Space (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun b => realification_moduleTopology_t2 (M.positivePolynomialDownsetFinBasis (J b) (hJ b) p) + ∃ r : ℝ, p ≤ r ∧ r ≤ (p + C) ^ C ∧ + ∃ (B : ℕ) (hB : 0 < B) (hstable : M.PositivePolynomialGridStable r B), + let E := fun b => M.positivePolynomialDownsetModel (J b) (hJ b) r B hB hstable + (∀ b, (M.positivePolynomialDownsetModelMultidegree (J b) (hJ b) r B hB hstable).ComplexityLE ((p + C) ^ C)) ∧ + (∀ b, Fintype.card (M.PositivePolynomialDownsetIndex (J b)) ≤ 2 ^ t * d) ∧ + (∀ b c, c ∉ J b → + (M.positivePolynomialDownsetModelMultidegree (J b) (hJ b) r B hB hstable).filtration.layer (fun i => c i) = ⊥) ∧ + ∃ h : M.filtration.positivePolynomialMultidegree.realification.PolynomialOrbit, + M.filtration.positivePolynomialMultidegree.realification.polynomialOrbitEval 0 h = 1 ∧ + ∀ (u : D.Space → ℂ) (ell : ℝ≥0), (ell : ℝ) ≤ Real.exp p → + (letI := D.metricSpace; LipschitzWith ell u) → (∀ x, ‖u x‖ ≤ 1) → + ∃ N : ℕ, 0 < N ∧ (N : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ (A : Fin N → (E false).Niltest (fun _ : σ => 1)) + (B' : Fin N → (E true).Niltest (fun _ : σ => 1)), + (∀ j, (A j).normBound ≤ 1) ∧ (∀ j, (B' j).normBound ≤ 1) ∧ + (∀ j, (A j).ComplexityLE ((p + C) ^ C)) ∧ + (∀ j, (B' j).ComplexityLE ((p + C) ^ C)) ∧ + (∀ j, (A j).orbit = + (M.positivePolynomialDownsetModelMultidegree (J false) (hJ false) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J false) (hJ false) h)) ∧ + (∀ j, (B' j).orbit = + (M.positivePolynomialDownsetModelMultidegree (J true) (hJ true) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J true) (hJ true) h)) ∧ + ∀ x, ‖u (QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval x g)) - + ∑ j, (A j).eval x * (B' j).eval x‖ ≤ epsilon + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module VectorPolynomial +open scoped BigOperators TensorProduct NNReal + +def TwoDownsetCorrelationStatement (s t C : ℕ) : Prop := + ∀ {σ Ω L : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + {d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) (J : Bool → Set (σ →₀ ℕ)) + [∀ b, DecidablePred (· ∈ J b)] (hJ : ∀ b, IsLowerSet (J b)) + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (p : ℝ), (∑ i, bound i) = t → M.ComplexityLE p → + (∀ c, c ≠ 0 → c ∉ J false ∪ J true → M.filtration.layer (fun i => c i) = ⊥) → + ∀ (g : M.filtration.realification.PolynomialOrbit) (u : D.Space → ℂ) (ell : ℝ≥0), + (ell : ℝ) ≤ Real.exp p → (letI := D.metricSpace; LipschitzWith ell u) → + (∀ x, ‖u x‖ ≤ 1) → + ∀ (Q : Finset Ω) (x : Ω → σ → ℤ) (f : Ω → ℂ), Q.Nonempty → + (∀ z ∈ Q, ‖f z‖ ≤ 1) → + Real.exp (-p) ≤ ‖finiteCorrelation Q f + (fun z => u (QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval (x z) g)))‖ → + letI : ∀ b, TopologicalSpace (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun _ => moduleTopology ℝ _ + letI : ∀ b, IsTopologicalAddGroup (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun _ => IsModuleTopology.isTopologicalAddGroup ℝ _ + letI : ∀ b, T2Space (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun b => realification_moduleTopology_t2 (M.positivePolynomialDownsetFinBasis (J b) (hJ b) p) + ∃ r : ℝ, p ≤ r ∧ r ≤ (p + C) ^ C ∧ + ∃ (B : ℕ) (hB : 0 < B) (hstable : M.PositivePolynomialGridStable r B), + let E := fun b => M.positivePolynomialDownsetModel (J b) (hJ b) r B hB hstable + (∀ b, (M.positivePolynomialDownsetModelMultidegree (J b) (hJ b) r B hB hstable).ComplexityLE ((p + C) ^ C)) ∧ + (∀ b, Fintype.card (M.PositivePolynomialDownsetIndex (J b)) ≤ 2 ^ t * d) ∧ + (∀ b c, c ∉ J b → + (M.positivePolynomialDownsetModelMultidegree (J b) (hJ b) r B hB hstable).filtration.layer (fun i => c i) = ⊥) ∧ + ∃ h : M.filtration.positivePolynomialMultidegree.realification.PolynomialOrbit, + M.filtration.positivePolynomialMultidegree.realification.polynomialOrbitEval 0 h = 1 ∧ + ∃ (A : (E false).Niltest (fun _ : σ => 1)) (B' : (E true).Niltest (fun _ : σ => 1)), + A.normBound ≤ 1 ∧ B'.normBound ≤ 1 ∧ + A.ComplexityLE ((p + C) ^ C) ∧ B'.ComplexityLE ((p + C) ^ C) ∧ + A.orbit = (M.positivePolynomialDownsetModelMultidegree (J false) (hJ false) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J false) (hJ false) h) ∧ + B'.orbit = (M.positivePolynomialDownsetModelMultidegree (J true) (hJ true) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J true) (hJ true) h) ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖finiteCorrelation Q f (fun z => A.eval (x z) * B'.eval (x z))‖ + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module VectorPolynomial +open scoped BigOperators TensorProduct NNReal + +def TwoDownsetPrecisionStatement (s t C : ℕ) : Prop := + ∀ {σ L : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + {d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) (J : Bool → Set (σ →₀ ℕ)) + [∀ b, DecidablePred (· ∈ J b)] (hJ : ∀ b, IsLowerSet (J b)) + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (p : ℝ), (∑ i, bound i) = t → M.ComplexityLE p → + (∀ c, c ≠ 0 → c ∉ J false ∪ J true → M.filtration.layer (fun i => c i) = ⊥) → + ∀ g : M.filtration.realification.PolynomialOrbit, + ∀ epsilon : ℝ, 0 < epsilon → + let q := p + |Real.log epsilon| + letI : ∀ b, TopologicalSpace (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun _ => moduleTopology ℝ _ + letI : ∀ b, IsTopologicalAddGroup (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun _ => IsModuleTopology.isTopologicalAddGroup ℝ _ + letI : ∀ b, T2Space (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J b) (hJ b))) := + fun b => realification_moduleTopology_t2 (M.positivePolynomialDownsetFinBasis (J b) (hJ b) p) + ∃ r : ℝ, p ≤ r ∧ r ≤ (q + C) ^ C ∧ + ∃ (B : ℕ) (hB : 0 < B) (hstable : M.PositivePolynomialGridStable r B), + let E := fun b => M.positivePolynomialDownsetModel (J b) (hJ b) r B hB hstable + (∀ b, (M.positivePolynomialDownsetModelMultidegree (J b) (hJ b) r B hB hstable).ComplexityLE ((q + C) ^ C)) ∧ + (∀ b, Fintype.card (M.PositivePolynomialDownsetIndex (J b)) ≤ 2 ^ t * d) ∧ + (∀ b c, c ∉ J b → + (M.positivePolynomialDownsetModelMultidegree (J b) (hJ b) r B hB hstable).filtration.layer (fun i => c i) = ⊥) ∧ + ∃ h : M.filtration.positivePolynomialMultidegree.realification.PolynomialOrbit, + M.filtration.positivePolynomialMultidegree.realification.polynomialOrbitEval 0 h = 1 ∧ + ∀ (u : D.Space → ℂ) (ell : ℝ≥0), (ell : ℝ) ≤ Real.exp p → + (letI := D.metricSpace; LipschitzWith ell u) → (∀ x, ‖u x‖ ≤ 1) → + ∃ N : ℕ, 0 < N ∧ (N : ℝ) ≤ Real.exp ((q + C) ^ C) ∧ + ∃ (A : Fin N → (E false).Niltest (fun _ : σ => 1)) + (B' : Fin N → (E true).Niltest (fun _ : σ => 1)), + (∀ j, (A j).normBound ≤ 1) ∧ (∀ j, (B' j).normBound ≤ 1) ∧ + (∀ j, (A j).ComplexityLE ((q + C) ^ C)) ∧ + (∀ j, (B' j).ComplexityLE ((q + C) ^ C)) ∧ + (∀ j, (A j).orbit = + (M.positivePolynomialDownsetModelMultidegree (J false) (hJ false) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J false) (hJ false) h)) ∧ + (∀ j, (B' j).orbit = + (M.positivePolynomialDownsetModelMultidegree (J true) (hJ true) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J true) (hJ true) h)) ∧ + ∀ x, ‖u (QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval x g)) - + ∑ j, (A j).eval x * (B' j).eval x‖ ≤ epsilon + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module VectorPolynomial +open scoped BigOperators TensorProduct + +theorem exists_two_downset_splitting (s t a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ TwoDownsetSplittingStatement s t a C := by + obtain ⟨b, _, hsplit⟩ := exists_multidegree_downset_splitting s t a + let P : Polynomial ℕ := (Polynomial.X + Polynomial.C b) ^ b + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ L _ _ _ _ d D bound M J _ hJ _ _ _ _ p ht hM hcover g epsilon hepsilon hscale + classical + let : ∀ i, TopologicalSpace (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => moduleTopology ℝ _ + let : ∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => IsModuleTopology.isTopologicalAddGroup ℝ _ + let : ∀ i, T2Space (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun i => realification_moduleTopology_t2 (M.positivePolynomialDownsetFinBasis (J i) (hJ i) p) + have hp : 0 ≤ p := (Nat.cast_nonneg d).trans hM.1.1 + have hcost : (p + b) ^ b + 1 ≤ (p + C) ^ C := by + simpa [P, Polynomial.eval₂_pow] using hbudget p hp + have hcost' : (p + b) ^ b ≤ (p + C) ^ C := by linarith only [hcost] + have hfamily : (Fintype.card Bool : ℝ) ≤ p + 2 := by + simp only [Fintype.card_bool, Nat.cast_ofNat] + linarith only [hp] + have hsupport : ∀ c, c ≠ 0 → (∀ i, c ∉ J i) → M.filtration.layer (fun j => c j) = ⊥ := by + intro c hc hout + apply hcover c hc + rintro (hl | hr) + · exact hout false hl + · exact hout true hr + obtain ⟨r, hpr, hr, B, hB, hstable, hresult⟩ := + hsplit (I := Unit) (α := Bool) (σ := σ) (L := L) M J hJ p ht hM hfamily hsupport + g epsilon hepsilon hscale (by simpa using Real.one_le_exp hp) + obtain ⟨hE, hdim, h, hh, hresult⟩ := hresult + obtain ⟨n, hn, hnb, hcount, T, hresult⟩ := hresult + obtain ⟨hTnorm, hTunit, hT, hTorbit, happrox⟩ := hresult + let E := fun i => M.positivePolynomialDownsetModel (J i) (hJ i) r B hB hstable + have hterminal : ∀ i c, c ∉ J i → + (M.positivePolynomialDownsetModelMultidegree (J i) (hJ i) r B hB hstable).filtration.layer + (fun j => c j) = ⊥ := by + intro i c hc + exact M.filtration.positivePolynomialDownsetQuotient_terminal (J i) (hJ i) c hc + refine ⟨r, hpr, hr.trans hcost', B, hB, hstable, + fun i => (hE i).mono _ hcost', hdim, hterminal, h, hh, ?_⟩ + intro u ell hell hu hub + let coefficients := happrox (fun _ : Unit => u) ell hell (fun _ => hu) (fun _ => hub) + let coeff := coefficients.choose + have hcoeff := coefficients.choose_spec.1 + have herr := coefficients.choose_spec.2.2 + have hscalar := scalar_error_le_of_vector_error (I := Unit) (J := ∀ i, Fin (n i)) + (S := σ → ℤ) (epsilon := epsilon) + (fun _ : Unit => fun x => u (QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval x g))) + (fun j x => ∏ i, (T i (j i)).eval x) coeff herr () + let : Nonempty (∀ i, Fin (n i)) := ⟨fun i => ⟨0, hn i⟩⟩ + let pairSum := exists_bounded_niltest_pair_sum (J := ∀ i, Fin (n i)) (σ := σ) + (p := (p + b) ^ b) (E false) (E true) (fun _ : σ => 1) + ((M.positivePolynomialDownsetModelMultidegree (J false) (hJ false) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J false) (hJ false) h)) + ((M.positivePolynomialDownsetModelMultidegree (J true) (hJ true) r B hB hstable).orbitToOrdinary + (M.filtration.positivePolynomialDownsetOrbit (J true) (hJ true) h)) + (fun j => T false (j false)) (fun j => T true (j true)) (fun j => coeff j ()) + (fun j => (hTnorm false (j false)).le) (fun j => (hTnorm true (j true)).le) + (fun j => hT false (j false)) (fun j => hT true (j true)) + (fun j => hTorbit false (j false)) (fun j => hTorbit true (j true)) (fun j => hcoeff j ()) + let N := pairSum.choose + have hNpos := pairSum.choose_spec.1 + have hN : N = 2 * Fintype.card (∀ i, Fin (n i)) := pairSum.choose_spec.2.1 + let leftTests := pairSum.choose_spec.2.2 + let A := leftTests.choose + let rightTests := leftTests.choose_spec + let B' := rightTests.choose + have hdata := rightTests.choose_spec + have hAnorm := hdata.1 + have hBnorm := hdata.2.1 + have hA := hdata.2.2.1 + have hB' := hdata.2.2.2.1 + have hAg := hdata.2.2.2.2.1 + have hBg := hdata.2.2.2.2.2.1 + have heval := hdata.2.2.2.2.2.2 + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith only [Real.add_one_le_exp (1 : ℝ)] + have hNbound : (N : ℝ) ≤ Real.exp ((p + C) ^ C) := by + rw [hN, Nat.cast_mul, Nat.cast_ofNat] + calc + _ ≤ 2 * Real.exp ((p + b) ^ b) := mul_le_mul_of_nonneg_left hcount (by norm_num) + _ = Real.exp ((p + b) ^ b) * 2 := mul_comm _ _ + _ ≤ Real.exp ((p + b) ^ b) * Real.exp 1 := + mul_le_mul_of_nonneg_left htwo (Real.exp_nonneg _) + _ = Real.exp ((p + b) ^ b + 1) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr hcost + refine ⟨N, hNpos, hNbound, A, B', hAnorm, hBnorm, + fun j => (hA j).mono hcost', fun j => (hB' j).mono hcost', hAg, hBg, ?_⟩ + intro x + rw [heval x] + convert hscalar x using 1 + congr 2 + apply Finset.sum_congr rfl + intro j _ + rw [Fintype.prod_bool, mul_comm ((T true (j true)).eval x) ((T false (j false)).eval x)] + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module VectorPolynomial +open scoped BigOperators TensorProduct NNReal + +theorem exists_two_downset_correlation (s t : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ TwoDownsetCorrelationStatement s t C := by + obtain ⟨b, _, hsplit⟩ := exists_two_downset_splitting s t 1 + let P : Polynomial ℕ := Polynomial.X + (Polynomial.X + Polynomial.C b) ^ b + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ Ω L _ _ _ _ d D bound M J _ hJ _ _ _ _ p ht hM hcover g u ell hell hu hub + Q x f hQ hf hcorr + let : ∀ i, TopologicalSpace (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => moduleTopology ℝ _ + let : ∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => IsModuleTopology.isTopologicalAddGroup ℝ _ + let : ∀ i, T2Space (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun i => realification_moduleTopology_t2 (M.positivePolynomialDownsetFinBasis (J i) (hJ i) p) + have hp : 0 ≤ p := (Nat.cast_nonneg d).trans hM.1.1 + have hcost : p + (p + b) ^ b + 1 ≤ (p + C) ^ C := by + simpa [P, Polynomial.eval₂_pow] using hbudget p hp + have hcost' : (p + b) ^ b ≤ (p + C) ^ C := by linarith only [hcost, hp] + have hscale : 1 / Real.exp (-p - 1) ≤ Real.exp ((p + 2) ^ 1) := by + rw [one_div, ← Real.exp_neg, pow_one] + exact Real.exp_le_exp.mpr (by linarith only) + obtain ⟨r, hpr, hr, B, hB, hstable, hresult⟩ := + hsplit (σ := σ) (L := L) M J hJ p ht hM hcover g (Real.exp (-p - 1)) + (Real.exp_pos _) hscale + obtain ⟨hE, hdim, hterminal, h, hh, happrox⟩ := hresult + classical + let approximation := happrox u ell hell hu hub + let N := approximation.choose + have hNbound := approximation.choose_spec.2.1 + let leftTests := approximation.choose_spec.2.2 + let A := leftTests.choose + let rightTests := leftTests.choose_spec + let B' := rightTests.choose + have props := rightTests.choose_spec + have hAnorm := props.1 + have hBnorm := props.2.1 + have hA := props.2.2.1 + have hB' := props.2.2.2.1 + have hAg := props.2.2.2.2.1 + have hBg := props.2.2.2.2.2.1 + have herr := props.2.2.2.2.2.2 + have herror : ∀ z ∈ Q, ‖(∑ j, (A j).eval (x z) * (B' j).eval (x z)) - + u (QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval (x z) g))‖ ≤ Real.exp (-p) / 2 := by + intro z _ + rw [norm_sub_rev] + exact (herr (x z)).trans (exp_sub_one_le_half_exp (-p)) + let summand := exists_correlating_summand (J := Fin N) hQ f + (fun z => u (QuotientGroup.mk (M.filtration.realification.polynomialOrbitEval (x z) g))) + (fun j z => (A j).eval (x z) * (B' j).eval (x z)) + (Real.exp_pos (-p)) (Real.exp_pos ((p + b) ^ b)) + (by simpa only [Fintype.card_fin] using hNbound) hf herror hcorr + let j := summand.choose + have hj := summand.choose_spec + have hcorrbound : Real.exp (-((p + C) ^ C)) ≤ Real.exp (-p) / (2 * Real.exp ((p + b) ^ b)) := by + calc + _ ≤ Real.exp (-(p + (p + b) ^ b) - 1) := + Real.exp_le_exp.mpr (by linarith only [hcost]) + _ ≤ Real.exp (-(p + (p + b) ^ b)) / 2 := exp_sub_one_le_half_exp _ + _ = _ := by + rw [show -(p + (p + b) ^ b) = -p - (p + b) ^ b by ring, Real.exp_sub] + ring + exact ⟨r, hpr, hr.trans hcost', B, hB, hstable, fun i => (hE i).mono _ hcost', + hdim, hterminal, h, hh, A j, B' j, hAnorm j, hBnorm j, + (hA j).mono hcost', (hB' j).mono hcost', hAg j, hBg j, hcorrbound.trans hj⟩ + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module VectorPolynomial +open scoped BigOperators TensorProduct NNReal + +theorem exists_two_downset_precision (s t : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ TwoDownsetPrecisionStatement s t C := by + obtain ⟨b, _, hsplit⟩ := exists_two_downset_splitting s t 1 + let P : Polynomial ℕ := (Polynomial.X + 2 + Polynomial.C b) ^ b + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ L _ _ _ _ d D bound M J _ hJ _ _ _ _ p ht hM hcover g epsilon hepsilon + let q := p + |Real.log epsilon| + let R := q + 2 + let : ∀ i, TopologicalSpace (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => moduleTopology ℝ _ + let : ∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun _ => IsModuleTopology.isTopologicalAddGroup ℝ _ + let : ∀ i, T2Space (ℝ ⊗[ℚ] (M.filtration.positivePolynomialAlgebra ⧸ + restrictedOutsideDownsetIdeal M.filtration.positivePolynomialAlgebra (J i) (hJ i))) := + fun i => realification_moduleTopology_t2 (M.positivePolynomialDownsetFinBasis (J i) (hJ i) p) + have hp : 0 ≤ p := (Nat.cast_nonneg d).trans hM.1.1 + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpR : p ≤ R := by dsimp [R, q]; linarith only [abs_nonneg (Real.log epsilon)] + have hcost : (R + b) ^ b ≤ (q + C) ^ C := by + simpa [P, R, Polynomial.eval₂_pow] using hbudget q hq + have hscale : 1 / epsilon ≤ Real.exp ((R + 2) ^ 1) := by + rw [pow_one] + calc + 1 / epsilon = Real.exp (-Real.log epsilon) := by + rw [Real.exp_neg, Real.exp_log hepsilon] + exact one_div epsilon + _ ≤ Real.exp (R + 2) := by + apply Real.exp_le_exp.mpr + dsimp [R, q] + linarith only [hp, neg_le_abs (Real.log epsilon)] + obtain ⟨r, hRr, hr, B, hB, hstable, hresult⟩ := + hsplit (σ := σ) (L := L) M J hJ R ht (hM.mono M hpR) hcover g epsilon hepsilon hscale + obtain ⟨hE, hdim, hterminal, h, hh, happrox⟩ := hresult + refine ⟨r, hpR.trans hRr, hr.trans hcost, B, hB, hstable, + fun i => (hE i).mono _ hcost, hdim, hterminal, h, hh, ?_⟩ + intro u ell hell hu hub + obtain ⟨N, hNpos, hNbound, A, B', hAnorm, hBnorm, hA, hB', hAg, hBg, herr⟩ := + happrox u ell (hell.trans (Real.exp_le_exp.mpr hpR)) hu hub + exact ⟨N, hNpos, hNbound.trans (Real.exp_le_exp.mpr hcost), A, B', hAnorm, hBnorm, + fun j => (hA j).mono hcost, fun j => (hB' j).mono hcost, hAg, hBg, herr⟩ + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionalStepDrop.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionalStepDrop.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ed2ec8fe6a3fc0b1ca8e79d7116a522a99b0622 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionalStepDrop.lean @@ -0,0 +1,597 @@ +import OAI.Combinatorics.Progressions.Estimates.AdaptedDiagramNativeExternalNet +import OAI.Combinatorics.Progressions.Geometry.AntisymmetricBoxPrecision +import OAI.Combinatorics.Progressions.Linear.BiasedChosenBasisStepDrop + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d e : ℕ} + (D : RationalFilteredNilmanifold L s d) + (U : LieSubalgebra ℚ D.filtration.AssociatedGraded) + (E : RationalFilteredNilmanifold (D.filtration.gradedRefiltrationSubalgebra U) s e) + (hEF : E.filtration = D.filtration.gradedRefiltration U) + (u : D.Space → ℂ) + (hu : ∀ z : D.RealGroup, + z.coord ∈ D.filtration.realGradedRefiltrationLayer U s → ∀ x, u (z • x) = u x) + +include hEF hu in +theorem frozen_refiltered_top_invariant (a r : D.RealGroup) + (z : E.RealGroup) (hz : z ∈ E.filtration.realification.subgroup s) (x : E.RealGroup) : + u (QuotientGroup.mk (a * realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := D.filtration.lowerCentralSeries_eq_bot) + (D.filtration.gradedRefiltrationSubalgebra U).incl (z * x) * r)) = + u (QuotientGroup.mk (a * realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := D.filtration.lowerCentralSeries_eq_bot) + (D.filtration.gradedRefiltrationSubalgebra U).incl x * r)) := by + let φ := realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := D.filtration.lowerCentralSeries_eq_bot) + (D.filtration.gradedRefiltrationSubalgebra U).incl + have hz' : (φ z).coord ∈ D.filtration.realGradedRefiltrationLayer U s := by + apply (D.filtration.mem_native_refiltration_layer U s z.coord).mp + have h : z.coord ∈ E.filtration.realification.layer s := hz + simpa only [hEF] using h + have hcomm := D.filtration.realification.top_commutes (φ z) + (D.filtration.realGradedRefiltrationLayer_le U s hz') a + have heq : a * φ (z * x) * r = φ z * (a * φ x * r) := by + calc + a * φ (z * x) * r = (a * φ z) * φ x * r := by simp only [map_mul, mul_assoc] + _ = (φ z * a) * φ x * r := by rw [← hcomm.eq] + _ = φ z * (a * φ x * r) := by simp only [mul_assoc] + change u (QuotientGroup.mk (a * φ (z * x) * r)) = _ + rw [heq] + exact hu (φ z) hz' (QuotientGroup.mk (a * φ x * r)) + +include hEF hu in +theorem frozen_refiltered_coset_invariant (a r : D.RealGroup) + (h : ∀ γ ∈ E.realLattice, + r⁻¹ * realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := D.filtration.lowerCentralSeries_eq_bot) + (D.filtration.gradedRefiltrationSubalgebra U).incl γ * r ∈ D.realLattice) + (z : E.RealGroup) (hz : z ∈ E.filtration.realification.subgroup s) (x : E.Space) : + (u ∘ frozenCosetMap E.realLattice D.realLattice + (realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := D.filtration.lowerCentralSeries_eq_bot) + (D.filtration.gradedRefiltrationSubalgebra U).incl) a r h) (z • x) = + (u ∘ frozenCosetMap E.realLattice D.realLattice + (realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := D.filtration.lowerCentralSeries_eq_bot) + (D.filtration.gradedRefiltrationSubalgebra U).incl) a r h) x := by + induction x using Quotient.inductionOn with + | h x => exact D.frozen_refiltered_top_invariant U E hEF u hu a r z hz x + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3 + +open Module VectorPolynomial +open scoped TensorProduct + +theorem exists_real_module_topology {ι V : Type*} [Fintype ι] + [AddCommGroup V] [Module ℚ V] (b : Basis ι ℚ V) : + ∃ τ : TopologicalSpace (ℝ ⊗[ℚ] V), + letI := τ + IsTopologicalAddGroup (ℝ ⊗[ℚ] V) ∧ ContinuousSMul ℝ (ℝ ⊗[ℚ] V) ∧ T2Space (ℝ ⊗[ℚ] V) := by + let τ := moduleTopology ℝ (ℝ ⊗[ℚ] V) + let : TopologicalSpace (ℝ ⊗[ℚ] V) := τ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] V) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : FiniteDimensional ℝ (ℝ ⊗[ℚ] V) := (b.baseChange ℝ).finiteDimensional_of_finite + have hc : Continuous (b.baseChange ℝ).equivFun := + IsModuleTopology.continuous_of_linearMap (b.baseChange ℝ).equivFun.toLinearMap + let : T2Space (ℝ ⊗[ℚ] V) := T2Space.of_injective_continuous (b.baseChange ℝ).equivFun.injective hc + exact ⟨τ, inferInstance, inferInstance, inferInstance⟩ + +namespace RationalFilteredNilmanifold.Niltest + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} {w : σ → ℕ} + +theorem symbol_of_native (T : D.Niltest w) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, D.filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (g : D.filtration.RealAdaptedPolynomialGroup w) (hg : D.filtration.nativePolynomialOrbit w g = T.orbit) : + T.symbol b ω hF = D.filtration.realPolynomialSymbolHom b ω hF w + (D.filtration.realAdaptedPolynomialGroupHom w g) := by + have he := congrArg (fun a : D.filtration.realification.PolynomialOrbit w => + D.filtration.realPolynomialSymbolHom b ω hF w ⟨⟨a.log, a.property⟩⟩) hg + exact he.symm + +end RationalFilteredNilmanifold.Niltest +end Erdos3 + +end + +section + +namespace Erdos3.NativeAntisymmetricOrbitFactors + +open RationalFilteredNilmanifold NilpotentLieBCHGroup +open scoped TensorProduct + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {p q : ℝ} {N e : ℕ} + {W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p} + (V : NativeAntisymmetricOrbitFactors W N q) + [TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → W.L))] [T2Space (ℝ ⊗[ℚ] (Fin 8 → W.L))] + +theorem frozen_coset_top_invariant + (E : RationalFilteredNilmanifold + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra) + (∑ k, mixedCorrelationDegree 1 k) e) + (hEF : E.filtration = (pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltration V.subalgebra) + (hp : 0 ≤ p) (a r : (pi (fun _ : Fin 8 => W.model)).RealGroup) + (h : ∀ γ ∈ E.realLattice, + r⁻¹ * realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 8 => W.model)).filtration.lowerCentralSeries_eq_bot) + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra).incl + γ * r ∈ (pi (fun _ : Fin 8 => W.model)).realLattice) + (z : E.RealGroup) (hz : z ∈ E.filtration.realification.subgroup (∑ k, mixedCorrelationDegree 1 k)) + (x : E.Space) : + ((W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex).observable ∘ + frozenCosetMap E.realLattice (pi (fun _ : Fin 8 => W.model)).realLattice + (realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 8 => W.model)).filtration.lowerCentralSeries_eq_bot) + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra).incl) + a r h) (z • x) = + ((W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex).observable ∘ + frozenCosetMap E.realLattice (pi (fun _ : Fin 8 => W.model)).realLattice + (realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 8 => W.model)).filtration.lowerCentralSeries_eq_bot) + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra).incl) + a r h) x := by + exact (pi (fun _ : Fin 8 => W.model)).frozen_refiltered_coset_invariant V.subalgebra E hEF + (W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex).observable + (fun z hz x => V.top_layer_invariant hp z hz x) a r h z hz x + +end Erdos3.NativeAntisymmetricOrbitFactors + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold +open scoped TensorProduct + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem NativeAntisymmetricOrbitFactors.frozen_group_invariant {p : ℝ} + {W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p} {N e : ℕ} + (V : NativeAntisymmetricOrbitFactors W N p) + [TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → W.L))] [T2Space (ℝ ⊗[ℚ] (Fin 8 → W.L))] + (E : RationalFilteredNilmanifold + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra) 2 e) + (hEF : E.filtration = (pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltration V.subalgebra) + (hp : 0 ≤ p) (a r : (pi (fun _ : Fin 8 => W.model)).RealGroup) + (z : E.RealGroup) (hz : z ∈ E.filtration.realification.subgroup 2) (x : E.RealGroup) : + (W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex).observable (QuotientGroup.mk + (a * NilpotentLieBCHGroup.realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 8 => W.model)).filtration.lowerCentralSeries_eq_bot) + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra).incl + (z * x) * r)) = + (W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex).observable (QuotientGroup.mk + (a * NilpotentLieBCHGroup.realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 8 => W.model)).filtration.lowerCentralSeries_eq_bot) + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra).incl + x * r)) := by + exact (pi (fun _ : Fin 8 => W.model)).frozen_refiltered_top_invariant V.subalgebra E hEF + (W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex).observable + (fun z hz x => V.top_layer_invariant hp z hz x) a r z hz x + +theorem exists_prepared_antisymmetric_descent : + ∃ K : ℕ, 2 ≤ K ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + {N : ℕ} (V : NativeAntisymmetricOrbitFactors W N p) + [TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → W.L))] [T2Space (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [TopologicalSpace (ℝ ⊗[ℚ] + (pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] + (pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] + (pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra)] + [T2Space (ℝ ⊗[ℚ] + (pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra)] + {e : ℕ} (E : RationalFilteredNilmanifold + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra) 2 e) + (g : E.filtration.realification.PolynomialOrbit (fun _ : Fin 4 => 1)), + E.filtration = (pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltration V.subalgebra → + (∀ x : Fin 4 → ℤ, + NilpotentLieBCHGroup.realificationMap (hnil := E.filtration.lowerCentralSeries_eq_bot) + (hM := (pi (fun _ : Fin 8 => W.model)).filtration.lowerCentralSeries_eq_bot) + ((pi (fun _ : Fin 8 => W.model)).filtration.gradedRefiltrationSubalgebra V.subalgebra).incl + (E.filtration.realification.polynomialOrbitEval (fun _ => 1) x g) = + (pi (fun _ : Fin 8 => W.model)).filtration.adaptedPolynomialRealValueHom + (fun _ : Fin 4 => 1) (fun i => (x i : ℝ)) V.middle) → + ∀ (hp : 0 ≤ p) {t : ℝ}, 0 ≤ t → E.GeometryComplexityLE t → + (W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex).ComplexityLE t → + (∀ i j, rationalLogHeight ((pi (fun _ : Fin 8 => W.model)).basis.repr + (E.basis j : Fin 8 → W.L) i) ≤ t) → + ∀ m : ℕ, 0 < m → (m : ℝ) ≤ Real.exp t → + (∀ x : Fin 4 → ℤ, ((pi (fun _ : Fin 8 => W.model)).basis.baseChange ℝ).equivFun + ((pi (fun _ : Fin 8 => W.model)).filtration.adaptedPolynomialRealValueHom + (fun _ : Fin 4 => 1) (fun i => (x i : ℝ)) V.rational).coord ∈ realDenominatorGrid m) → + (∀ x : Fin 4 → ℤ, (∀ i, |(x i : ℝ)| ≤ (N : ℝ)) → ∀ i, + |((pi (fun _ : Fin 8 => W.model)).basis.baseChange ℝ).repr + ((pi (fun _ : Fin 8 => W.model)).filtration.adaptedPolynomialRealValueHom + (fun _ : Fin 4 => 1) (fun j => (x j : ℝ)) V.slow).coord i| ≤ Real.exp t) → + Nonempty (NativeAntisymmetricFrozenDescent V ((t + K) ^ K)) := by + obtain ⟨K, hK, hdesc⟩ := exists_uniform_frozen_descent 1 1 + refine ⟨K, hK, ?_⟩ + intro p W N V _ _ _ _ _ _ _ _ e E g hEF hg hp t ht hE hT hinc m hm hmb hrat hslow + let D := pi (fun _ : Fin 8 => W.model) + let T := W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex + have htK : t ≤ (t + K) ^ K := by + have hK' : (2 : ℝ) ≤ K := by exact_mod_cast hK + apply (le_add_of_nonneg_right (Nat.cast_nonneg K) : t ≤ t + K).trans + simpa only [pow_one] using pow_le_pow_right₀ (by linarith : 1 ≤ t + K) + (show 1 ≤ K by omega) + obtain ⟨_Λ, _hΛ, _hchar, _hnormal, _hfinite, _hindex, n, _hn, Q, hQF, _hQL, hQ, hfamily⟩ := + hdesc E D (D.filtration.gradedRefiltrationSubalgebra V.subalgebra).incl T g ht hE hT hinc m hm hmb + let : TopologicalSpace (ℝ ⊗[ℚ] + (D.filtration.gradedRefiltrationSubalgebra V.subalgebra ⧸ E.filtration.layerIdeal 2)) := + moduleTopology ℝ _ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] + (D.filtration.gradedRefiltrationSubalgebra V.subalgebra ⧸ E.filtration.layerIdeal 2)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 Q.basis + refine ⟨{ + nonnegative := hp + productTopology := inferInstance + productTopologicalAdd := inferInstance + productContinuousSMul := inferInstance + productHausdorff := inferInstance + outerBudget := t + outer_nonnegative := ht + outer_bound := htK + denominator := m + denominator_pos := hm + denominator_bound := hmb + rational_values := hrat + slow_values := hslow + L := D.filtration.gradedRefiltrationSubalgebra V.subalgebra ⧸ E.filtration.layerIdeal 2 + lie := inferInstance + algebra := inferInstance + dim := n + topology := moduleTopology ℝ _ + topologicalAdd := IsModuleTopology.isTopologicalAddGroup ℝ _ + continuousSMul := inferInstance + hausdorff := realification_moduleTopology_t2 Q.basis + model := Q + model_complexity := hQ + orbit := E.topQuotientOrbit Q hQF g + descend := ?_ }⟩ + intro a r ha hr + have ha' : ∀ i, |(D.basis.baseChange ℝ).repr a.coord i| ≤ Real.exp ((t + 2) ^ 1) := + fun i => (ha i).trans (Real.exp_le_exp.mpr (by simp only [pow_one]; linarith)) + have hinv := V.frozen_group_invariant E hEF hp a r + have hS := hfamily a r ha' hr hinv + obtain ⟨S, hSo, hSn, hSc, hSe⟩ := hS + refine ⟨S, hSo, hSn, hSc, ?_⟩ + intro x + exact (hSe x).trans (congrArg + (fun z : D.RealGroup => T.observable (QuotientGroup.mk (a * z * r))) (hg x)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_antisymmetric_frozen_descent : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + {N : ℕ} [NeZero N] (V : NativeAntisymmetricOrbitFactors W N p), 0 ≤ p → + Nonempty (NativeAntisymmetricFrozenDescent V ((p + C) ^ C)) := by + obtain ⟨A, _, hmodel⟩ := exists_antisymmetric_middle_model + obtain ⟨B, _, houter⟩ := exists_antisymmetric_outer_bounds + obtain ⟨K, _, hprepare⟩ := exists_prepared_antisymmetric_descent + let X : Polynomial ℕ := Polynomial.X + let Y := X + 8 + let P := (Y + 2) ^ 2 + Y + (Y + (Y ^ 2 + Y + 3) ^ 2) + Y ^ 2 + 4 + let T := (X + Polynomial.C A) ^ A + (X + Polynomial.C B) ^ B + P + X + 4 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (T + (T + Polynomial.C K) ^ K) + refine ⟨C, hC, ?_⟩ + intro p W N _ V hp + let D := pi (fun _ : Fin 8 => W.model) + obtain ⟨E, hEF, _hEL, hE, hinc, g, hg⟩ := hmodel W V hp + obtain ⟨m, hm, hmb, hrat, hslow⟩ := houter W V hp + obtain ⟨τ, htA, htM, htT⟩ := exists_real_module_topology D.basis + let : TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → W.L)) := τ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → W.L)) := htA + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → W.L)) := htM + let : T2Space (ℝ ⊗[ℚ] (Fin 8 → W.L)) := htT + obtain ⟨σ, hsA, hsM, hsT⟩ := exists_real_module_topology E.basis + let : TopologicalSpace + (ℝ ⊗[ℚ] D.filtration.gradedRefiltrationSubalgebra V.subalgebra) := σ + let : IsTopologicalAddGroup + (ℝ ⊗[ℚ] D.filtration.gradedRefiltrationSubalgebra V.subalgebra) := hsA + let : ContinuousSMul ℝ + (ℝ ⊗[ℚ] D.filtration.gradedRefiltrationSubalgebra V.subalgebra) := hsM + let : T2Space + (ℝ ⊗[ℚ] D.filtration.gradedRefiltrationSubalgebra V.subalgebra) := hsT + let T₀ := W.antisymmetricBoxNiltest hp V.leftIndex V.rightIndex + let t := (p + A) ^ A + (p + B) ^ B + productNiltestBudget (p + 8) + p + 4 + have hprod : 0 ≤ productNiltestBudget (p + 8) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hA : 0 ≤ (p + A) ^ A := by positivity + have hB : 0 ≤ (p + B) ^ B := by positivity + have ht : 0 ≤ t := by dsimp [t]; positivity + have hAt : (p + A) ^ A ≤ t := by dsimp [t]; linarith + have hBt : (p + B) ^ B ≤ t := by dsimp [t]; linarith + have hPt : productNiltestBudget (p + 8) ≤ t := by dsimp [t]; linarith + have hT₀ : T₀.ComplexityLE t := + (W.antisymmetricBoxNiltest_complexity hp V.leftIndex V.rightIndex).mono hPt + have hsum : t + (t + K) ^ K ≤ (p + C) ^ C := by + simpa [T, P, Y, X, t, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget p hp + have hcost : (t + K) ^ K ≤ (p + C) ^ C := (le_add_of_nonneg_left ht).trans hsum + obtain ⟨R⟩ := hprepare W V E g hEF hg hp ht (hE.mono E hAt) hT₀ + (fun i j => (hinc j i).trans hAt) m hm (hmb.trans (Real.exp_le_exp.mpr hBt)) + hrat (fun x hx i => (hslow x hx i).trans (Real.exp_le_exp.mpr hBt)) + exact ⟨R.mono hcost⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold NilpotentLieBCHGroup +open scoped TensorProduct + +namespace NativePolynomialOrbitFactors + +variable {L σ : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + {D : RationalFilteredNilmanifold L s d} + {g : (D.filtration.realification.adaptedPolynomialFiltration (fun _ : σ => 1)).Group} + {eta : L →ₗ[ℚ] ℚ} {A : σ → ℝ} {p : ℝ} + +noncomputable def frozenMiddleValue (R : NativePolynomialOrbitFactors D g eta A p) + (a r : D.RealGroup) (x : σ → ℤ) : D.RealGroup := + a * D.filtration.adaptedPolynomialRealValueHom + (fun _ : σ => 1) (fun i => (x i : ℝ)) R.middle * r + +end NativePolynomialOrbitFactors + +theorem exists_native_frozen_middle_expansion (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L : Type} {σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} (D : RationalFilteredNilmanifold L (s + 1) d) + {g : (D.filtration.realification.adaptedPolynomialFiltration + (fun _ : σ => 1)).Group} + {eta : L →ₗ[ℚ] ℚ} {A : σ → ℝ} {p : ℝ} + (R : NativePolynomialOrbitFactors D g eta A p) + (T : D.Niltest (fun _ : σ => 1)), 0 ≤ p → T.ComplexityLE p → + (∀ z : D.RealGroup, + z.coord ∈ D.filtration.realGradedRefiltrationLayer R.subalgebra (s + 1) → + ∀ x, T.observable (z • x) = T.observable x) → + ∀ m : ℕ, 0 < m → (m : ℝ) ≤ Real.exp p → ∀ a r : D.RealGroup, + (∀ i, |(D.basis.baseChange ℝ).repr a.coord i| ≤ Real.exp p) → + (D.basis.baseChange ℝ).equivFun r.coord ∈ realDenominatorGrid m → + Nonempty (NativeIntegerExpansion (fun _ : σ => 1) s ((p + C) ^ C) + (fun x => T.observable (QuotientGroup.mk (R.frozenMiddleValue a r x)))) := by + obtain ⟨B, _, hmodel⟩ := exists_native_middle_model + obtain ⟨K, _, hdesc⟩ := exists_uniform_frozen_descent s 1 + let X : Polynomial ℕ := Polynomial.X + let P := X + (X + Polynomial.C B) ^ B + 4 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((P + Polynomial.C K) ^ K) + refine ⟨C, hC, ?_⟩ + intro L σ _ _ _ _ _ _ d D g eta A p R T hp hT hinv m hm hmb a r ha hr + obtain ⟨E, hEF, _hEL, hE, hinc, h, hh⟩ := hmodel D R hp hT.1 + let : TopologicalSpace (ℝ ⊗[ℚ] + D.filtration.gradedRefiltrationSubalgebra R.subalgebra) := moduleTopology ℝ _ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] + D.filtration.gradedRefiltrationSubalgebra R.subalgebra) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 E.basis + let t := p + (p + B) ^ B + 4 + have ht : 0 ≤ t := by dsimp [t]; positivity + have hpt : p ≤ t := by dsimp [t]; linarith [pow_nonneg (by positivity : 0 ≤ p + B) B] + have hEt : (p + B) ^ B ≤ t := by dsimp [t]; linarith + obtain ⟨_Λ, _hΛ, _hchar, _hnormal, _hfinite, _hindex, + n, _hn, Q, hQF, _hQL, _hQ, hfamily⟩ := + hdesc E D (D.filtration.gradedRefiltrationSubalgebra R.subalgebra).incl T h ht + (hE.mono E hEt) (hT.mono hpt) (fun i j => (hinc j i).trans hEt) + m hm (hmb.trans (Real.exp_le_exp.mpr hpt)) + let : TopologicalSpace (ℝ ⊗[ℚ] + (D.filtration.gradedRefiltrationSubalgebra R.subalgebra ⧸ + E.filtration.layerIdeal (s + 1))) := moduleTopology ℝ _ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] + (D.filtration.gradedRefiltrationSubalgebra R.subalgebra ⧸ + E.filtration.layerIdeal (s + 1))) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 Q.basis + have ha' : ∀ i, |(D.basis.baseChange ℝ).repr a.coord i| ≤ Real.exp ((t + 2) ^ 1) := + fun i => (ha i).trans (Real.exp_le_exp.mpr (by simp only [pow_one]; linarith)) + obtain ⟨S, _hSo, _hSn, hSc, hSe⟩ := hfamily a r ha' hr + (D.frozen_refiltered_top_invariant R.subalgebra E hEF T.observable hinv a r) + have hcost : (t + K) ^ K ≤ (p + C) ^ C := by + simpa [P, X, t, Polynomial.eval₂_pow] using hbudget p hp + refine ⟨NativeIntegerExpansion.ofTest S (hSc.mono hcost) ?_⟩ + intro x + exact ((hSe x).trans (congrArg + (fun z : D.RealGroup => T.observable (QuotientGroup.mk (a * z * r))) (hh x))).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_antisymmetric_orbit_approximation : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p r : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (V : NativeAntisymmetricOrbitFactors W N p), + 0 ≤ p → 0 ≤ r → Real.exp ((p + r + C) ^ C) ≤ (N : ℝ) → + ∃ F : (Fin 4 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 4 => 1) 1 ((p + r + C) ^ C) F) ∧ + (𝔼 x : Fin 4 → ZMod N, + ‖W.antisymmetricBoxValue V.leftIndex V.rightIndex (fun i => ((x i).val : ℤ)) - + F (fun i => ((x i).val : ℤ))‖) ≤ Real.exp (-r) := by + obtain ⟨A, _, hdescent⟩ := exists_antisymmetric_frozen_descent + obtain ⟨B, _, hlocal⟩ := exists_antisymmetric_local_models + obtain ⟨C, _, hprecise⟩ := exists_antisymmetric_box_approximation + let X : Polynomial ℕ := Polynomial.X + let T := (X + Polynomial.C A) ^ A + (X + Polynomial.C B) ^ B + obtain ⟨D, hD, hbudget⟩ := exists_natPolynomial_eval_budget + ((T + X + Polynomial.C C) ^ C) + refine ⟨D, hD, ?_⟩ + intro N _ p r W V hp hr hN + let t := (p + A) ^ A + (p + B) ^ B + have ht : 0 ≤ t := by dsimp [t]; positivity + have hpr : p ≤ p + r := le_add_of_nonneg_right hr + have htbound : t ≤ (p + r + A) ^ A + (p + r + B) ^ B := by + dsimp [t] + gcongr + have hbig : ((p + r + A) ^ A + (p + r + B) ^ B + (p + r) + C) ^ C ≤ + (p + r + D) ^ D := by + simpa [T, X, Polynomial.eval₂_pow] using hbudget (p + r) (add_nonneg hp hr) + have hcost : (t + r + C) ^ C ≤ (p + r + D) ^ D := + (pow_le_pow_left₀ (by positivity) (by linarith) C).trans hbig + obtain ⟨R⟩ := hdescent W V hp + obtain ⟨P, hP, hPb, hmodels⟩ := hlocal R + let L : NativeAntisymmetricLocalModels R ((p + B) ^ B) := { + period := P + period_pos := hP + period_bound := hPb + local_model := hmodels } + have hqt : (p + A) ^ A ≤ t := le_add_of_nonneg_right (by positivity) + have hbt : (p + B) ^ B ≤ t := le_add_of_nonneg_left (by positivity) + obtain ⟨F, ⟨E⟩, herr⟩ := hprecise R L ht hr hqt hbt + ((Real.exp_le_exp.mpr hcost).trans hN) + exact ⟨F, ⟨E.mono hcost⟩, herr⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module NilpotentLieFiltration +open scoped TensorProduct + +universe uσ uL + +theorem exists_translated_step_drop_succ (s c : ℕ) (hs : 1 ≤ s) + (hI : TranslatedStepDropSpec.{uσ, uL} s c) : + ∃ C : ℕ, 2 ≤ C ∧ TranslatedStepDropSpec.{uσ, uL} (s + 1) C := by + obtain ⟨a, _, hchosen⟩ := exists_biased_chosen_basis_step_drop s c hI + obtain ⟨b, _, hchange⟩ := exists_controlled_symbol_basis_change (s + 1) + let B : Polynomial ℕ := (Polynomial.X + Polynomial.C a) ^ a + let U : Polynomial ℕ := B + Polynomial.X + 3 + let P : Polynomial ℕ := B + U + (U + Polynomial.C b) ^ b + obtain ⟨C, hC, hfinal⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ L _ _ _ _ d _ _ _ _ D ν hD p hp hσ T hT η _hη hvertical origin lengths hlengths hlarge hbias + let k : ℝ := (p + a) ^ a + let u : ℝ := k + p + 3 + have hk : 0 ≤ k := by dsimp [k]; positivity + have hu : 0 ≤ u := by dsimp [u]; positivity + have hku : k ≤ u := by dsimp [u]; linarith + have hpu : p ≤ u := by dsimp [u]; linarith + have hp2u : p + 2 ≤ u := by dsimp [u]; linarith + have hlast : 0 ≤ (u + b) ^ b := by positivity + have hbound : k + u + (u + b) ^ b ≤ (p + C) ^ C := by + simpa [P, U, B, k, u, Polynomial.eval₂_pow] using hfinal p hp + have hkC : k ≤ (p + C) ^ C := by linarith + have hbC : (u + b) ^ b ≤ (p + C) ^ C := by linarith + obtain ⟨τS, hSA, hSM, hST⟩ := exists_real_module_topology + (D.filtration.squareFinBasis D.basis ν (hD 2)) + let : TopologicalSpace (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra) := τS + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra) := hSA + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra) := hSM + let : T2Space (ℝ ⊗[ℚ] D.filtration.squareLieSubalgebra) := hST + obtain ⟨τQ, hQA, hQM, hQT⟩ := exists_real_module_topology + (D.filtration.reducedSquareBasis D.basis ν hD) + let : TopologicalSpace (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1))) := τQ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1))) := hQA + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1))) := hQM + let : T2Space (ℝ ⊗[ℚ] (D.filtration.squareLieSubalgebra ⧸ + D.filtration.squareFiltration.layerIdeal (s + 1))) := hQT + obtain ⟨e, ω, hF, _N, _hN, _hin, _hout, he, _hgeometry, hconstruct⟩ := hchosen hs D p hp T hT + obtain ⟨g, hg⟩ := D.filtration.nativePolynomialOrbit_surjective (fun _ : σ => 1) D.basis ν hD T.orbit + have hTpos : ∀ i, 0 < (lengths i : ℝ) := fun i => by exact_mod_cast hlengths i + have hfactor := hconstruct g hg η hvertical origin lengths hlengths hσ + (fun i => (Real.exp_le_exp.mpr hkC).trans (hlarge i)) hbias + let H := ⌈Real.exp (p + 1)⌉₊ + have hH : 1 ≤ H := one_le_ceil_exp (p + 1) + have hHp : (H : ℝ) ≤ Real.exp u := by + have he := ceil_exp_le_exp_add_one (show 0 ≤ p + 1 by linarith) + exact he.trans (Real.exp_le_exp.mpr (by linarith)) + have hdim : (Fintype.card (Fin (finrank ℚ L)) : ℝ) ≤ u := by + rw [Fintype.card_fin, finrank_eq_card_basis D.basis, Fintype.card_fin] + exact hT.1.1.trans hpu + have hd : (Fintype.card (Fin d) : ℝ) ≤ u := by + simpa only [Fintype.card_fin] using hT.1.1.trans hpu + have hentries : ∀ i j, RationalHeightLE (D.basis.repr (e i) j) H := + fun i j => rationalHeightLE_ceil_exp (he i j) + have hfactor' := ControlledSymbolFactorization.mono D.filtration e ω hF hfactor hku hTpos + have hdeclared := hchange D.filtration e ω hF D.basis ν hD H u hH hu hdim hd (hσ.trans hpu) + hHp hentries (fun i => (lengths i : ℝ)) hTpos η _ hfactor' + have hsym : D.filtration.realPolynomialSymbolHom e ω hF (fun _ => 1) + (D.filtration.realAdaptedPolynomialGroupHom (fun _ => 1) g) = T.symbol D.basis ν hD := by + exact (D.filtration.native_symbol_basis_independent e ω hF D.basis ν hD (fun _ => 1) g).symm.trans + (T.symbol_of_native D.basis ν hD g hg).symm + rw [hsym] at hdeclared + exact ControlledSymbolFactorization.mono D.filtration D.basis ν hD hdeclared hbC hTpos + +theorem exists_translated_step_drop (s : ℕ) (hs : 1 ≤ s) : + ∃ C : ℕ, 2 ≤ C ∧ TranslatedStepDropSpec.{uσ, uL} s C := by + have h : ∀ n : ℕ, ∃ C : ℕ, 2 ≤ C ∧ TranslatedStepDropSpec.{uσ, uL} (n + 1) C := by + intro n + induction n with + | zero => exact ⟨4, by decide, translatedStepDropSpec_one⟩ + | succ n ih => + obtain ⟨C, _hC, hI⟩ := ih + exact exists_translated_step_drop_succ (n + 1) C (by omega) hI + cases s with + | zero => omega + | succ n => exact h n + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedAbsolutePatchFamily.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedAbsolutePatchFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..b85065f0cb25912e643ea85e31601fda86f73ba3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedAbsolutePatchFamily.lean @@ -0,0 +1,79 @@ +import OAI.Combinatorics.Progressions.Estimates.CanonicalEmptyLayerGeometry + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem exists_unconditioned_absolute_patch_family (n₀ : ℕ) [NeZero n₀] + (k : ℕ) (hk : 3 ≤ k) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ {X : Type*} [Fintype X] [DecidableEq X] (i : X) + {p a σ L : ℝ}, 2 ≤ p → Real.exp (-p) ≤ a → 0 < σ → 0 < L → + ∀ (P : Fin n₀ → ℕ) [∀ j, NeZero (P j)] [NeZero (∏ j, P j)], + (∀ j, (P j).Prime) → Function.Injective P → + (∀ j, Real.exp ((p + 2)^C) ≤ P j) → + ∀ (N R : X → ℕ) (hR : ∀ i, 2 * R i < N i) + (W : Option (Fin n₀) × X → ℝ) (hW : ∀ z, 0 < W z), + (∀ z, 8 * (probabilityProfileLipschitz : ℝ) ≤ + residueProfileWidth (fun _ : X => 1) W z) → + (∀ j, L ≤ W (some j,i)) → + (∀ u j, BooleanCubeKernel.physicalSiteWidth (residueBoxIntegerPoint P u) W j ≤ (R j : ℝ)) → + 2 * (∑ j, 2 * (R j : ℝ) / N j) ≤ σ / 8 → + (Fintype.card (∀ j, ZMod (P j)) : ℝ)^2 * (2 / L) ≤ σ / 16 → + ∀ (f : (X → ℤ) → ℝ), (∀ x, f x ∈ Set.Icc (0 : ℝ) 1) → + IntegerVectorAPFree (Function.support f) k → + a + σ ≤ (𝔼 x ∈ integerBox N, f x) → + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} W z, + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + ∃ productive : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1), + σ / 4 ≤ law.mass productive ∧ + (∀ z ∈ productive, Function.Injective (fun u => + BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) (z.1.val,z.2.val))) ∧ + (1 + xi) * a < 1 ∧ + ∃ (d : (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) → ℕ) + (patch : ∀ z, PolynomialPatch (Fin n₀) (k - 2) (d z)), + (∀ z, (d z : ℝ) ≤ (p + 2)^C ∧ ((patch z).kernel.lip : ℝ) + 1 ≤ Real.exp ((p+2)^C)) ∧ + (∀ z ∈ productive, Real.exp (-((p+2)^C)) ≤ + 𝔼 u, (f (BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) + (z.1.val,z.2.val)) - (1+xi)*a) * + (patch z).value (fun j => ((u j).val : ℝ))) ∧ + ∀ z : trimmedIntegerBox N R × rectangularWeightIndices 0 W 1, ∀ u, + BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) + (z.1.val,z.2.val) ∈ integerBox N := by + obtain ⟨C, hC, xi, hxi, habsolute⟩ := + exists_productive_absolute_crt_patches (J := Fin n₀) k hk + refine ⟨C, hC, xi, hxi, ?_⟩ + intro X _ _ i p a σ L hp ha hσ hL P _ _ hprime hinj hsize N R hR W hW + hscale hwidth hfit hboundary hcollision f hf hfree hmean + have hsite : Function.Injective (residueBoxIntegerPoint P) := by + intro u v he + funext j + apply ZMod.val_injective + have hj := congrFun he j + change ((u j).val : ℤ) = (v j).val at hj + exact_mod_cast hj + obtain ⟨hZ, productive, hmass, hinjective, hlocal, hinside⟩ := + BooleanCubeKernel.exists_unconditioned_productive_family N R hR + (residueBoxIntegerPoint P) hsite i (fun _ : X => 1) (fun _ => by decide) + {0} (Finset.singleton_nonempty _) W hW hscale hL hwidth hfit + ((Real.exp_pos _).le.trans ha) hσ hboundary + (by simpa only [Nat.cast_one, mul_one] using hcollision) f hf hmean + have hne : productive.Nonempty := Finset.nonempty_iff_ne_empty.mpr (by + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty] at hmass + linarith) + obtain ⟨hcap, d, patch, hcost, hscore⟩ := habsolute productive hne hp ha P hprime hinj hsize f + (fun z => (z.1.val,z.2.val)) hf hfree hinjective + (fun z hz => (by linarith : a ≤ a + σ / 2).trans (hlocal z hz)) + exact ⟨hZ, productive, hmass, hinjective, hcap, d, patch, hcost, hscore, hinside⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedArbitraryFixedPatchFamily.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedArbitraryFixedPatchFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e623593487ca40902ee616ce5873bc9ad0364bc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedArbitraryFixedPatchFamily.lean @@ -0,0 +1,699 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedRelativeFinalPower +import OAI.Combinatorics.Progressions.Estimates.RelativePatchPositivePowerInduction +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateRefilteredSupportedStep +import OAI.Combinatorics.Progressions.Sampling.FixedPatchShearFiberCandidateScore + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +theorem exists_relative_finite_returned_slice_normalization (s : ℕ) : + ∃ E : ℕ, 2 ≤ E ∧ ∀ {Ω J : Type*} + [Fintype Ω] [Nonempty Ω] [Fintype J] [DecidableEq J] + (outer : FiniteProbabilityWeights Ω) (productive : Finset Ω), + 0 < outer.mass productive → + ∀ (P : J → ℕ), (∀ i, 0 < P i) → + ∀ (p : ℝ), 0 ≤ p → ∀ (Λ : ℝ), Λ ∈ Set.Icc (0 : ℝ) 1 → + ∀ (d₀ : ℕ) (f : Ω → (J → ℤ) → ℝ), + (∀ h x, x ∈ integerBox P → f h x ∈ Set.Icc (0 : ℝ) 1) → + (∀ h ∈ productive, RelativePatchSliceConclusion s P (f h) Λ d₀ p) → + let q := p + (Fintype.card J : ℝ) + 2 + let D := min d₀ ⌊p⌋₊ + ∃ (localLaw : Ω → FiniteProbabilityWeights (integerBox P)) + (d : ℕ) (w : Fin d → ℕ) (hw : Monotone w) (Ψ : PatchKernel d) + (B : PolynomialSlots J d w) (localForm : Ω → PolynomialSlots J d w) + (retained : Finset Ω), + d ≤ D ∧ d ≤ d₀ ∧ (∀ i, 1 ≤ w i) ∧ (∀ i, w i ≤ s) ∧ + (Ψ.lip : ℝ) ≤ Real.exp ((q + 2) ^ E) ∧ + (∀ i, realPolynomialMass (B.center i) ≤ (q + 2) ^ E) ∧ + retained ⊆ productive ∧ + (outer.mass productive / ((D + 1) * (s + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ outer.mass retained ∧ + (∀ h ∈ retained, ∃ r, 0 < r ∧ ∃ (S : ResidueBoxSlice P r) + (hlen : ∀ i, 0 < S.length i), + (∀ i, Real.exp (-p) * (P i : ℝ) ≤ (S.length i : ℝ)) ∧ + localLaw h = S.fullSliceLaw hlen) ∧ + ∀ h ∈ retained, Real.exp (-((q + 2) ^ E)) ≤ (localLaw h).mean + (fun x => (f h x.val - Λ) * (B.shearTransformedSlots hw + ((localForm h).loweringAt (fun i => (x.val i : ℝ)))).patchValue Ψ) := by + obtain ⟨E, hE, hfixed⟩ := exists_varying_rank_fixed_patch_function s + refine ⟨E, hE, ?_⟩ + intro Ω J _ _ _ _ outer productive hmass P hP p hp Λ hΛ d₀ f hf hreturn + let q := p + (Fintype.card J : ℝ) + 2 + let D := min d₀ ⌊p⌋₊ + have hne : productive.Nonempty := Finset.nonempty_iff_ne_empty.mpr (by + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty] at hmass + linarith) + obtain ⟨h₀, hh₀⟩ := hne + obtain ⟨ddefault, Qdefault, lawdefault, hddefault, _, hlipdefault, _, _⟩ := + (hreturn h₀ hh₀).tighten_rank.exists_full_law hP + have hall (h : Ω) : ∃ (d : ℕ) (Q : PolynomialPatch J s d) + (localLaw : FiniteProbabilityWeights (integerBox P)), + d ≤ D ∧ (Q.kernel.lip : ℝ) ≤ Real.exp p ∧ + (h ∈ productive → Real.exp (-p) ≤ localLaw.mean + (fun x => (f h x.val - Λ) * Q.value (fun i => (x.val i : ℝ)))) ∧ + (h ∈ productive → ∃ r, 0 < r ∧ ∃ (S : ResidueBoxSlice P r) + (hlen : ∀ i, 0 < S.length i), + (∀ i, Real.exp (-p) * (P i : ℝ) ≤ (S.length i : ℝ)) ∧ + localLaw = S.fullSliceLaw hlen) := by + by_cases hh : h ∈ productive + · obtain ⟨d, Q, localLaw, hd, _, hlip, hscore, hslice⟩ := + (hreturn h hh).tighten_rank.exists_full_law hP + exact ⟨d, Q, localLaw, hd, hlip, fun _ => hscore, fun _ => hslice⟩ + · exact ⟨ddefault, Qdefault, lawdefault, hddefault, hlipdefault, + fun hmem => (hh hmem).elim, fun hmem => (hh hmem).elim⟩ + choose d patch localLaw hd hlip hpositive hslice using hall + have hpq : p ≤ q := by + dsimp only [q] + linarith [Nat.cast_nonneg (α := ℝ) (Fintype.card J)] + have hq : 0 ≤ q := hp.trans hpq + have hD : (D : ℝ) ≤ q := + (Nat.cast_le.mpr (Nat.min_le_right d₀ ⌊p⌋₊)).trans ((Nat.floor_le hp).trans hpq) + have hJ : (Fintype.card J : ℝ) ≤ q := by dsimp only [q]; linarith + have hLip (h) : ((patch h).kernel.lip : ℝ) ≤ Real.exp q := + (hlip h).trans (Real.exp_le_exp.mpr hpq) + let point := fun (_ : Ω) (x : integerBox P) => x.val + let score := fun h (x : integerBox P) => f h x.val - Λ + have hscore (h) (x : integerBox P) : |score h x| ≤ 1 := by + dsimp only [score] + obtain ⟨hf0, hf1⟩ := hf h x.val x.property + exact abs_le.mpr ⟨by linarith [hΛ.2], by linarith [hΛ.1]⟩ + have hpositive' (h) (hh : h ∈ productive) : Real.exp (-q) ≤ (localLaw h).mean + (fun x => score h x * (patch h).value (fun i => (point h x i : ℝ))) := + (Real.exp_le_exp.mpr (neg_le_neg hpq)).trans (hpositive h hh) + obtain ⟨d', w, hw, Ψ, B, localForm, retained, hd', hpos, hws, hΨ, hB, + hsub, hmass', hlocal⟩ := + hfixed outer productive d patch D q hd hmass hq hD hJ hLip + localLaw point score hscore hpositive' + exact ⟨localLaw, d', w, hw, Ψ, B, localForm, retained, hd', + hd'.trans (Nat.min_le_left _ _), hpos, hws, hΨ, hB, hsub, hmass', + fun h hh => hslice h (hsub hh), hlocal⟩ + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +structure AllocatedReturnedPatchSource (keep : LayerSamplerVariables G I n B → Prop) + (centerLift : ∀ j, U j) (z : A.Path) where + supported : 0 < A.law.weight z + sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n + read : AllocatedActualCoefficientIndex G X I E n B → ℤ + recovered : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm + centerLift z.1.val z.2.val sample read + fixed : {i // ¬keep i} → ℤ + fixed_in_box : ∀ i, 0 ≤ fixed i ∧ fixed i < A.sides i.val + +namespace AllocatedReturnedPatchSource + +variable {keep : LayerSamplerVariables G I n B → Prop} {centerLift : ∀ j, U j} + {z : A.Path} (source : AllocatedReturnedPatchSource (E := E) (A := A) keep centerLift z) + +noncomputable def physical (u : {i // keep i} → ℤ) : X → ℤ := + jointIntegerPhysicalSite (finiteSplitPoint keep u source.fixed) (z.1.val, z.2.val) + +noncomputable def chart {cost : ℝ} + (hcenter : coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun a => centerLift a.1)))) + {q : ℕ} (slice : ResidueBoxSlice (fun i : {i // keep i} => A.sides i.val) q) + (hq : 0 < q) (hlen : ∀ i, 0 < slice.length i) + (hlength : ∀ i, Real.exp (-cost) * (A.sides i.val : ℝ) ≤ slice.length i) : + AllocatedExternalLocalChart (E := E) A cost where + path := z + path_supported := source.supported + centerLift := centerLift + center_eq := hcenter + sample := source.sample + read := source.read + recovered := source.recovered + keep := keep + fixed := source.fixed + fixed_in_box := source.fixed_in_box + step := q + step_pos := hq + slice := slice + dense := ⟨_, _, _, hq, hlen, slice.progression_inside, hlength, + slice.integerPoints_eq_commonStrideBox⟩ + +@[simp] theorem chart_physical {cost : ℝ} + (hcenter : coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun a => centerLift a.1)))) + {q : ℕ} (slice : ResidueBoxSlice (fun i : {i // keep i} => A.sides i.val) q) + (hq : 0 < q) (hlen : ∀ i, 0 < slice.length i) + (hlength : ∀ i, Real.exp (-cost) * (A.sides i.val : ℝ) ≤ slice.length i) + (u : {i // keep i} → ℤ) : + (source.chart hcenter slice hq hlen hlength).physical u = source.physical u := rfl + +end AllocatedReturnedPatchSource + +noncomputable def allocatedNormalizedShearProblem + {Y : Type*} {s d : ℕ} (keep : LayerSamplerVariables G I n B → Prop) + (centerLift : ∀ j, U j) + (hcenter : coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun a => centerLift a.1)))) + (productive : Finset A.Path) {massThreshold cost scoreThreshold : ℝ} + (hmass : massThreshold ≤ A.law.mass productive) + (source : ∀ z : productive, + AllocatedReturnedPatchSource (E := E) (A := A) keep centerLift z.val) + (hshort : ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (patch : PolynomialPatch Y s d) + [Fintype (PolynomialShearIndex patch.weight)] + (localForm : productive → PolynomialSlots {i // keep i} d patch.weight) + (q : productive → ℕ) (hq : ∀ z, 0 < q z) + (slice : ∀ z, ResidueBoxSlice (fun i : {i // keep i} => A.sides i.val) (q z)) + (hlen : ∀ z i, 0 < (slice z).length i) + (hlength : ∀ z i, Real.exp (-cost) * (A.sides i.val : ℝ) ≤ (slice z).length i) + (f : (X → ℤ) → ℝ) (lam : ℝ) + (hscore : ∀ z, scoreThreshold ≤ ((slice z).fullSliceLaw (hlen z)).mean + (fun u => (f ((source z).physical u.val) - lam) * + (patch.form.shearTransformedSlots patch.weight_mono + ((localForm z).loweringAt (fun i => (u.val i : ℝ)))).patchValue patch.kernel)) : + AllocatedExternalCandidateProblem (E := E) A + (polynomialShearNilmanifold patch.weight s patch.weight_le) + (RationalTorus.trivialFiltration s) 0 1 + (fun _ y => (patch.shearObservable y : ℂ)) + (fun x => ((f x - lam : ℝ) : ℂ)) cost massThreshold scoreThreshold where + productive := productive + mass := hmass + chart z := (source z).chart hcenter (slice z) (hq z) (hlen z) (hlength z) + chart_path _ := rfl + centerLift := centerLift + chart_centerLift _ := rfl + frozen_side _ := hshort + candidate z := { + orbit := (localForm z).shearPolynomialOrbit s patch.weight_le + mark_on_slice := by + intro u hu + apply NilpotentLieBCHGroup.ext + exact Subsingleton.elim _ _ } + score z := by + have hs := hscore z + rw [patch.fullSliceLaw_shearObservable_score (localForm z) (slice z) + (hq z) (hlen z) (fun u => f ((source z).physical u)) lam] at hs + exact hs + +theorem exists_allocatedNormalizedShearProblem_of_returned_laws + {Y : Type*} {s d : ℕ} (keep : LayerSamplerVariables G I n B → Prop) + (centerLift : ∀ j, U j) + (hcenter : coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun a => centerLift a.1)))) + (productive : Finset A.Path) {massThreshold cost scoreThreshold : ℝ} + (hmass : massThreshold ≤ A.law.mass productive) + (source : ∀ z : productive, + AllocatedReturnedPatchSource (E := E) (A := A) keep centerLift z.val) + (hshort : ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (patch : PolynomialPatch Y s d) + [Fintype (PolynomialShearIndex patch.weight)] + (localForm : productive → PolynomialSlots {i // keep i} d patch.weight) + (law : ∀ _ : productive, + FiniteProbabilityWeights (integerBox (fun i : {i // keep i} => A.sides i.val))) + (hslice : ∀ z, ∃ q, 0 < q ∧ + ∃ slice : ResidueBoxSlice (fun i : {i // keep i} => A.sides i.val) q, + ∃ hlen : ∀ i, 0 < slice.length i, + (∀ i, Real.exp (-cost) * (A.sides i.val : ℝ) ≤ slice.length i) ∧ + law z = slice.fullSliceLaw hlen) + (f : (X → ℤ) → ℝ) (lam : ℝ) + (hscore : ∀ z, scoreThreshold ≤ (law z).mean + (fun u => (f ((source z).physical u.val) - lam) * + (patch.form.shearTransformedSlots patch.weight_mono + ((localForm z).loweringAt (fun i => (u.val i : ℝ)))).patchValue patch.kernel)) : + Nonempty (AllocatedExternalCandidateProblem (E := E) A + (polynomialShearNilmanifold patch.weight s patch.weight_le) + (RationalTorus.trivialFiltration s) 0 1 + (fun _ y => (patch.shearObservable y : ℂ)) + (fun x => ((f x - lam : ℝ) : ℂ)) cost massThreshold scoreThreshold) := by + choose q hq slice hlen hlength hlaw using hslice + refine ⟨allocatedNormalizedShearProblem keep centerLift hcenter productive hmass + source hshort patch localForm q hq slice hlen hlength f lam ?_⟩ + intro z + simpa only [← hlaw z] using hscore z + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +theorem exists_allocatedNormalizedShearProblem_of_returned_fiber_laws + {V : Type*} {s d : ℕ} (keep : LayerSamplerVariables G I n B → Prop) + (centerLift : ∀ j, U j) + (hcenter : coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun a => centerLift a.1)))) + (productive : Finset A.Path) {massThreshold cost scoreThreshold : ℝ} + (hmass : massThreshold ≤ A.law.mass productive) + (hsupported : ∀ z : productive, 0 < A.law.weight z.val) + (sample : productive → CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : productive → AllocatedActualCoefficientIndex G X I E n B → ℤ) + (hread : ∀ z : productive, + AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm + centerLift z.val.1.val z.val.2.val (sample z) (read z)) + (hshort : ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (patch : PolynomialPatch V s d) + [Fintype (PolynomialShearIndex patch.weight)] + (localForm : productive → PolynomialSlots (LayerSamplerVariables G I n B) d patch.weight) + (law : productive → FiniteProbabilityWeights A.Site) + (hslice : ∀ z, RelativeReturnedFiberLaw keep A.sides cost (law z)) + (f : (X → ℤ) → ℝ) (lam : ℝ) + (hscore : ∀ z, scoreThreshold ≤ (law z).mean + (fun u => (f (A.physical z.val u) - lam) * + (patch.form.shearTransformedSlots patch.weight_mono + ((localForm z).loweringAt (fun i => (u.val i : ℝ)))).patchValue patch.kernel)) : + ∃ P : AllocatedExternalCandidateProblem (E := E) A + (polynomialShearNilmanifold patch.weight s patch.weight_le) + (RationalTorus.trivialFiltration s) 0 1 + (fun _ y => (patch.shearObservable y : ℂ)) + (fun x => ((f x - lam : ℝ) : ℂ)) cost massThreshold scoreThreshold, + P.productive = productive ∧ P.centerLift = centerLift ∧ + ∀ z, (P.chart z).keep = keep := by + have hcert := hslice + unfold RelativeReturnedFiberLaw at hcert + choose fixed hfixed q hq slice hlen hlength hlaw using hcert + let source : ∀ z : productive, + AllocatedReturnedPatchSource (E := E) (A := A) keep centerLift z.val := fun z => + ⟨hsupported z, sample z, read z, hread z, fixed z, hfixed z⟩ + let keptForm := fun z => (localForm z).coordinateFiberForm keep (fixed z) + have hkeptScore (z : productive) : scoreThreshold ≤ + ((slice z).fullSliceLaw (hlen z)).mean (fun u => + (f ((source z).physical u.val) - lam) * + (patch.form.shearTransformedSlots patch.weight_mono + ((keptForm z).loweringAt (fun i => (u.val i : ℝ)))).patchValue patch.kernel) := by + have hs := hscore z + rw [hlaw z] at hs + dsimp only [AllocatedExternalCandidateSampler.physical] at hs + rw [patch.fiberSliceLaw_shear_score_eq_fullSliceLaw (localForm z) keep + (slice z) (hlen z) (fixed z) (hfixed z) + (fun u => f (jointIntegerPhysicalSite u (z.val.1.val, z.val.2.val))) lam] at hs + have hdec : + (fun a b : {i // keep i} => Classical.propDecidable (a = b)) = + (fun a b => @Subtype.instDecidableEq _ keep + (inferInstance : DecidableEq (LayerSamplerVariables G I n B)) a b) := + Subsingleton.elim _ _ + rw [← hdec] at hs + simpa only [keptForm, AllocatedReturnedPatchSource.physical, source] using hs + let P := allocatedNormalizedShearProblem keep centerLift hcenter productive hmass + source hshort patch keptForm q hq slice hlen hlength f lam hkeptScore + exact ⟨P, rfl, rfl, fun _ => rfl⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct + +variable {m : ℕ} {G X : Type} [Fintype G] [Fintype X] + {I E J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +theorem exists_allocatedFixedCenterNormalizedShearProblem + (s : ℕ) (keep : LayerSamplerVariables G I n B → Prop) + (centerLift : ∀ j, U j) + (hcenter : coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun a => centerLift a.1)))) + (productive : Finset A.Path) (hmass : 0 < A.law.mass productive) + (hsupported : ∀ z : productive, 0 < A.law.weight z.val) + (sample : productive → CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : productive → AllocatedActualCoefficientIndex G X I E n B → ℤ) + (hread : ∀ z : productive, + AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm + centerLift z.val.1.val z.val.2.val (sample z) (read z)) + (p cost : ℝ) (hp : 0 ≤ p) (hpcost : p ≤ cost) + (hshort : ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (rankBound : ℕ) (f : (X → ℤ) → ℝ) (target : ℝ) + (htarget : target ∈ Set.Icc (0 : ℝ) 1) + (hf : ∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) (hξ1 : ξ ≤ 1) + (hreturned : ∀ z ∈ productive, ∃ (fixed : {i // ¬keep i} → ℤ), + (∀ i, 0 ≤ fixed i ∧ fixed i < (A.sides i.val : ℤ)) ∧ + RelativePatchSliceConclusion s (fun i : {i // keep i} => A.sides i.val) + (fun u => f (jointIntegerPhysicalSite (finiteSplitPoint keep u fixed) + (z.1.val, z.2.val))) target rankBound p) : + let normalizationPower := (exists_relative_finite_returned_fiber_normalization.{0,0} s).choose + let q := p + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) + 2 + let D := min rankBound ⌊p⌋₊ + let normalizedBudget := (q + 2) ^ normalizationPower + let retainedMass := (A.law.mass productive / ((D + 1) * (s + 1) ^ D : ℕ)) * + Real.exp (-normalizedBudget) + ∃ (d : ℕ) (patch : PolynomialPatch (LayerSamplerVariables G I n B) s d), + d ≤ D ∧ d ≤ rankBound ∧ + (patch.kernel.lip : ℝ) ≤ Real.exp normalizedBudget ∧ + (∀ i, realPolynomialMass (patch.form.center i) ≤ normalizedBudget) ∧ + let := polynomialShearIndexFintype patch.weight (fun i => patch.weight_pos i) + ∃ P : AllocatedExternalCandidateProblem (E := E) A + (polynomialShearNilmanifold patch.weight s patch.weight_le) + (RationalTorus.trivialFiltration s) 0 1 + (fun _ y => (patch.shearObservable y : ℂ)) + (fun x => ((f x - target : ℝ) : ℂ)) cost retainedMass (Real.exp (-normalizedBudget)), + P.productive ⊆ productive ∧ P.centerLift = centerLift ∧ + ∀ z, (P.chart z).keep = keep := by + intro normalizationPower q D normalizedBudget retainedMass + have hne : productive.Nonempty := Finset.nonempty_iff_ne_empty.mpr (by + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty] at hmass + linarith) + let : Nonempty A.Path := hne.to_subtype.map Subtype.val + let pathInput := fun (z : A.Path) (u : LayerSamplerVariables G I n B → ℤ) => + f (jointIntegerPhysicalSite u (z.1.val, z.2.val)) + have hinput : ∀ z u, u ∈ integerBox A.sides → pathInput z u ∈ Set.Icc (0 : ℝ) 1 := by + intro z u hu + exact hf _ (A.physical_mem_integerBox hξ1 z ⟨u, hu⟩) + obtain ⟨localLaw, d, w, hw, Ψ, slots, localForm, retained, + hd, hdrank, hwpos, hwle, hLip, hslots, hsub, hretained, hslice, hscore⟩ := + (exists_relative_finite_returned_fiber_normalization.{0,0} s).choose_spec.2 + A.law productive hmass A.sides keep A.sides_pos p hp target htarget rankBound + pathInput hinput hreturned + let patch : PolynomialPatch (LayerSamplerVariables G I n B) s d := + ⟨w, hwpos, hwle, hw, slots, Ψ⟩ + let := polynomialShearIndexFintype patch.weight (fun i => patch.weight_pos i) + obtain ⟨P, hP, hcenterP, hkeep⟩ := + exists_allocatedNormalizedShearProblem_of_returned_fiber_laws + (E := E) (A := A) keep centerLift hcenter retained hretained + (fun z => hsupported ⟨z.val, hsub z.property⟩) + (fun z => sample ⟨z.val, hsub z.property⟩) + (fun z => read ⟨z.val, hsub z.property⟩) + (fun z => hread ⟨z.val, hsub z.property⟩) + hshort patch (fun z => localForm z.val) (fun z => localLaw z.val) + (fun z => (hslice z.val z.property).mono hpcost) f target + (fun z => hscore z.val z.property) + exact ⟨d, patch, hd, hdrank, hLip, hslots, P, hP ▸ hsub, hcenterP, hkeep⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct + +variable {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin 0 → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin 0 → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin 0 → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +theorem exists_allocatedZeroLayerNormalizedShearProblem + {V : Type*} {s d : ℕ} (keep : LayerSamplerVariables G I n B → Prop) + (productive : Finset A.Path) {massThreshold cost scoreThreshold : ℝ} + (hmass : massThreshold ≤ A.law.mass productive) + (hshort : ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (patch : PolynomialPatch V s d) + [Fintype (PolynomialShearIndex patch.weight)] + (localForm : A.Path → PolynomialSlots (LayerSamplerVariables G I n B) d patch.weight) + (law : A.Path → FiniteProbabilityWeights A.Site) + (hslice : ∀ z ∈ productive, RelativeReturnedFiberLaw keep A.sides cost (law z)) + (f : (X → ℤ) → ℝ) (lam : ℝ) + (hscore : ∀ z ∈ productive, scoreThreshold ≤ (law z).mean + (fun u => (f (A.physical z u) - lam) * + (patch.form.shearTransformedSlots patch.weight_mono + ((localForm z).loweringAt (fun i => (u.val i : ℝ)))).patchValue patch.kernel)) : + ∃ P : AllocatedExternalCandidateProblem (E := E) A + (polynomialShearNilmanifold patch.weight s patch.weight_le) + (RationalTorus.trivialFiltration s) 0 1 + (fun _ y => (patch.shearObservable y : ℂ)) + (fun x => ((f x - lam : ℝ) : ℂ)) cost massThreshold scoreThreshold, + P.productive ⊆ productive ∧ A.law.mass P.productive = A.law.mass productive ∧ + P.centerLift = allocatedZeroLayerCenterLift U ∧ + ∀ z, (P.chart z).keep = keep := by + let supported := productive.filter (fun z => 0 < A.law.weight z) + have hsub : supported ⊆ productive := Finset.filter_subset _ _ + have hsame : A.law.mass supported = A.law.mass productive := by + unfold FiniteProbabilityWeights.mass + dsimp only [supported] + rw [Finset.sum_filter] + apply Finset.sum_congr rfl + intro z _ + by_cases hz : 0 < A.law.weight z + · rw [ite_eq_left hz] + · rw [ite_eq_right hz] + exact (le_antisymm (le_of_not_gt hz) (A.law.nonneg z)).symm + obtain ⟨P, hP, hcenter, hkeep⟩ := + exists_allocatedNormalizedShearProblem_of_returned_fiber_laws + (E := E) (A := A) keep (allocatedZeroLayerCenterLift U) + (allocatedZeroLayerCenterLift_spec B U center) supported + (hmass.trans_eq hsame.symm) + (fun z => (Finset.mem_filter.mp z.property).2) + (fun _ => allocatedZeroLayerSample B) + (fun z => allocatedZeroLayerFramedRead (E := E) B z.val.1.val z.val.2.val) + (fun z => allocatedZeroLayer_recovered B U b hb o S hR hσ poly hm + z.val.1.val z.val.2.val) + hshort patch (fun z => localForm z.val) (fun z => law z.val) + (fun z => hslice z.val (hsub z.property)) f lam + (fun z => hscore z.val (hsub z.property)) + exact ⟨P, hP ▸ hsub, hP ▸ hsame, hcenter, hkeep⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct + +variable {m : ℕ} {G X : Type} [Fintype G] [Fintype X] + {I E J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +def AllocatedNormalizedCandidateConclusion + (s : ℕ) (keep : LayerSamplerVariables G I n B → Prop) + (centerLift : ∀ j, U j) (productive : Finset A.Path) + (childCost cost : ℝ) (rankBound : ℕ) (f : (X → ℤ) → ℝ) (target : ℝ) : Prop := + let normalizationPower := (exists_relative_finite_returned_fiber_normalization.{0,0} s).choose + let q := childCost + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) + 2 + let D := min rankBound ⌊childCost⌋₊ + let normalizedBudget := (q + 2) ^ normalizationPower + let retainedMass := (A.law.mass productive / ((D + 1) * (s + 1) ^ D : ℕ)) * + Real.exp (-normalizedBudget) + ∃ (d : ℕ) (patch : PolynomialPatch (LayerSamplerVariables G I n B) s d), + d ≤ D ∧ d ≤ rankBound ∧ + (patch.kernel.lip : ℝ) ≤ Real.exp normalizedBudget ∧ + (∀ i, realPolynomialMass (patch.form.center i) ≤ normalizedBudget) ∧ + let := polynomialShearIndexFintype patch.weight (fun i => patch.weight_pos i) + ∃ P : AllocatedExternalCandidateProblem (E := E) A + (polynomialShearNilmanifold patch.weight s patch.weight_le) + (RationalTorus.trivialFiltration s) 0 1 + (fun _ y => (patch.shearObservable y : ℂ)) + (fun x => ((f x - target : ℝ) : ℂ)) cost retainedMass (Real.exp (-normalizedBudget)), + P.productive ⊆ productive ∧ P.centerLift = centerLift ∧ + ∀ z, (P.chart z).keep = keep + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +namespace BooleanCubeKernel + +theorem exists_unconditioned_arbitrary_fixed_patch_family (s : ℕ) : + ∃ E : ℕ, 2 ≤ E ∧ ∀ (n₀ : ℕ) {X : Type*} [Fintype X] [DecidableEq X] + (P : Fin n₀ → ℕ) [∀ k, NeZero (P k)] (_i : X) + {p a Λ σ : ℝ}, 0 ≤ p → 0 ≤ a → Λ ∈ Set.Icc (0 : ℝ) 1 → 0 < σ → σ ≤ 1 → + ∀ (d₀ : ℕ), RelativePatchAbsoluteRule s n₀ p a Λ d₀ → + (∀ k, (P k).Prime) → Function.Injective P → + (∀ k j, P k ≤ 2 ^ (n₀ + 1) * P j) → + (∀ k, Real.exp p ≤ (P k : ℝ)) → + ∀ (N : X → ℕ), + (∀ j, unconditionedSpatialWidthCutoff (unconditionedResidueSiteBound P) + (unconditionedSpatialTrimFraction (Fintype.card X) σ) + (unconditionedCollisionWidth P σ) ≤ (N j : ℝ)) → + ∀ (f : (X → ℤ) → ℝ), (∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) → + IntegerVectorAPFree {x | x ∈ integerBox N ∧ f x ≠ 0} (s + 2) → + a + σ ≤ (𝔼 x ∈ integerBox N, f x) → + let τ := unconditionedSpatialTrimFraction (Fintype.card X) σ + let W := trimmedSpatialWidths (K := Fin n₀) (unconditionedResidueSiteBound P) τ N + let R := spatialTrimMargin τ N + let q := p + (n₀ : ℝ) + 2 + let D := min d₀ ⌊p⌋₊ + ∃ (hW : ∀ z, 0 < W z) (hR : ∀ j, 2 * R j < N j) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} W z), + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + ∃ (productive : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1)), + σ / 4 ≤ law.mass productive ∧ + (∀ z ∈ productive, Function.Injective (fun u : ∀ k, ZMod (P k) => + jointIntegerPhysicalSite (residueBoxIntegerPoint P u) (z.1.val,z.2.val))) ∧ + (∀ z : trimmedIntegerBox N R × rectangularWeightIndices 0 W 1, ∀ u : ∀ k, ZMod (P k), + jointIntegerPhysicalSite (residueBoxIntegerPoint P u) (z.1.val,z.2.val) ∈ integerBox N) ∧ + ∃ (d : ℕ) (w : Fin d → ℕ) (hw : Monotone w) (Ψ : PatchKernel d) + (B : PolynomialSlots (Fin n₀) d w) + (localForm : (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) → + PolynomialSlots (Fin n₀) d w) + (localLaw : (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) → + FiniteProbabilityWeights (integerBox P)) + (retained : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1)), + d ≤ d₀ ∧ d ≤ D ∧ (∀ j, 1 ≤ w j) ∧ (∀ j, w j ≤ s) ∧ + (Ψ.lip : ℝ) ≤ Real.exp ((q + 2) ^ E) ∧ + (∀ j, realPolynomialMass (B.center j) ≤ (q + 2) ^ E) ∧ + retained ⊆ productive ∧ + (law.mass productive / ((D + 1) * (s + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + ((σ / 4) / ((D + 1) * (s + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + (∀ z ∈ retained, ∃ m, 0 < m ∧ ∃ (S : ResidueBoxSlice P m) + (hlen : ∀ j, 0 < S.length j), + (∀ j, Real.exp (-p) * (P j : ℝ) ≤ (S.length j : ℝ)) ∧ + localLaw z = S.fullSliceLaw hlen) ∧ + ∀ z ∈ retained, Real.exp (-((q + 2) ^ E)) ≤ (localLaw z).mean + (fun x => (f (jointIntegerPhysicalSite x.val (z.1.val,z.2.val)) - Λ) * + (B.shearTransformedSlots hw + ((localForm z).loweringAt (fun j => (x.val j : ℝ)))).patchValue Ψ) := by + obtain ⟨E, hE, hfixed⟩ := exists_relative_finite_returned_slice_normalization s + refine ⟨E, hE, ?_⟩ + intro n₀ X _ _ P _ i p a Λ σ hp ha hΛ hσ hσ1 d₀ habsolute hprime hdistinct + hcomparable hcutoff N hN f hf hfree hmean + let τ := unconditionedSpatialTrimFraction (Fintype.card X) σ + let W := trimmedSpatialWidths (K := Fin n₀) (unconditionedResidueSiteBound P) τ N + let R := spatialTrimMargin τ N + let q := p + (n₀ : ℝ) + 2 + let D := min d₀ ⌊p⌋₊ + obtain ⟨hW, hR, hZ, productive, hmass, hinj, hreturn, hinside⟩ := + exists_unconditioned_arbitrary_absolute_family s n₀ P i ha hσ hσ1 d₀ habsolute + hprime hdistinct hcomparable hcutoff N hN f hf hfree hmean + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + have hprod : 0 < law.mass productive := (div_pos hσ (by norm_num)).trans_le hmass + have hnonempty : productive.Nonempty := by + apply Finset.nonempty_iff_ne_empty.mpr + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty, lt_self_iff_false] at hprod + obtain ⟨z₀, _⟩ := hnonempty + let : Nonempty (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) := ⟨z₀⟩ + have hbound (z : trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) + (x : Fin n₀ → ℤ) (hx : x ∈ integerBox P) : + f (jointIntegerPhysicalSite x (z.1.val,z.2.val)) ∈ Set.Icc (0 : ℝ) 1 := by + have hrep : residueBoxIntegerPoint P (fun j => (x j : ZMod (P j))) = x := by + funext j + have hxj := (mem_integerBox P x).mp hx j + dsimp only [residueBoxIntegerPoint] + rw [ZMod.val_intCast, Int.emod_eq_of_lt hxj.1 hxj.2] + have hi := hinside z (fun j => (x j : ZMod (P j))) + rw [hrep] at hi + exact hf _ hi + obtain ⟨localLaw, d, w, hw, Ψ, B, localForm, retained, hd, hd₀, hpos, hws, hΨ, hB, + hsub, hretained, hcertificate, hlocal⟩ := + hfixed law productive hprod P (fun j => (hprime j).pos) p hp Λ hΛ d₀ + (fun z x => f (jointIntegerPhysicalSite x (z.1.val,z.2.val))) hbound hreturn + refine ⟨hW, hR, hZ, productive, hmass, hinj, hinside, d, w, hw, Ψ, B, + localForm, localLaw, retained, hd₀, hd, hpos, hws, + ?_, ?_, hsub, ?_, ?_, hcertificate, ?_⟩ + · simpa only [Fintype.card_fin] using hΨ + · simpa only [Fintype.card_fin] using hB + · simpa only [Fintype.card_fin] using hretained + · have hle := mul_le_mul_of_nonneg_right + (div_le_div_of_nonneg_right hmass (by positivity : (0 : ℝ) ≤ ((D + 1) * (s + 1) ^ D : ℕ))) + (Real.exp_nonneg (-((q + 2) ^ E))) + exact hle.trans (by simpa only [Fintype.card_fin] using hretained) + · simpa only [Fintype.card_fin] using hlocal + +end BooleanCubeKernel +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedArbitraryNormalizedBase.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedArbitraryNormalizedBase.lean new file mode 100644 index 0000000000000000000000000000000000000000..48f3bb17883e21a0d9d62f2d2858a0ef27745b5d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedArbitraryNormalizedBase.lean @@ -0,0 +1,98 @@ +import OAI.Combinatorics.Progressions.Estimates.UnconditionedArbitraryFixedPatchFamily +import OAI.Combinatorics.Progressions.Lattices.UnconditionedLatePrimeBudget + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +namespace BooleanCubeKernel + +theorem exists_unconditioned_arbitrary_normalized_base (s n₀ : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ E : ℕ, 2 ≤ E ∧ + ∀ {X : Type*} [Fintype X] [DecidableEq X] [Nonempty X] + {p a Λ : ℝ}, 2 ≤ p → Real.exp (-p) ≤ a → a ≤ Λ → Λ ≤ 1 → + ∀ (d₀ : ℕ), RelativePatchAbsoluteRule s n₀ p a Λ d₀ → + (Fintype.card X : ℝ) ≤ p → ∀ (N : X → ℕ), + (∀ j, Real.exp ((p + 2) ^ C) ≤ (N j : ℝ)) → + ∀ (f : (X → ℤ) → ℝ), (∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) → + IntegerVectorAPFree {x | x ∈ integerBox N ∧ f x ≠ 0} (s + 2) → + ∀ (A : PolynomialPatch X s 0), Real.exp (-p) ≤ relativePatchBoxScore N f a A → + ∃ (P : Fin n₀ → ℕ) (hprime : ∀ k, (P k).Prime), + Function.Injective P ∧ (∀ k j, P k ≤ 2 ^ (n₀ + 1) * P j) ∧ + (∀ k, Real.exp p ≤ (P k : ℝ) ∧ (P k : ℝ) ≤ Real.exp (p + (n₀ : ℝ) + 2)) ∧ + let : ∀ k, NeZero (P k) := fun k => ⟨(hprime k).ne_zero⟩ + let σ := Real.exp (-p) + let τ := unconditionedSpatialTrimFraction (Fintype.card X) σ + let W := trimmedSpatialWidths (K := Fin n₀) (unconditionedResidueSiteBound P) τ N + let R := spatialTrimMargin τ N + let q := p + (n₀ : ℝ) + 2 + let D := min d₀ ⌊p⌋₊ + ∃ (hW : ∀ z, 0 < W z) (hR : ∀ j, 2 * R j < N j) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} W z), + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + ∃ (productive : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1)), + σ / 4 ≤ law.mass productive ∧ + (∀ z ∈ productive, Function.Injective (fun u : ∀ k, ZMod (P k) => + jointIntegerPhysicalSite (residueBoxIntegerPoint P u) (z.1.val,z.2.val))) ∧ + (∀ z : trimmedIntegerBox N R × rectangularWeightIndices 0 W 1, ∀ u : ∀ k, ZMod (P k), + jointIntegerPhysicalSite (residueBoxIntegerPoint P u) (z.1.val,z.2.val) ∈ integerBox N) ∧ + ∃ (d : ℕ) (w : Fin d → ℕ) (hw : Monotone w) (Ψ : PatchKernel d) + (B : PolynomialSlots (Fin n₀) d w) + (localForm : (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) → + PolynomialSlots (Fin n₀) d w) + (localLaw : (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) → + FiniteProbabilityWeights (integerBox P)) + (retained : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1)), + d ≤ d₀ ∧ d ≤ D ∧ (∀ j, 1 ≤ w j) ∧ (∀ j, w j ≤ s) ∧ + (Ψ.lip : ℝ) ≤ Real.exp ((q + 2) ^ E) ∧ + (∀ j, realPolynomialMass (B.center j) ≤ (q + 2) ^ E) ∧ + retained ⊆ productive ∧ + (law.mass productive / ((D + 1) * (s + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + ((σ / 4) / ((D + 1) * (s + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + (∀ z ∈ retained, ∃ m, 0 < m ∧ ∃ (S : ResidueBoxSlice P m) + (hlen : ∀ j, 0 < S.length j), + (∀ j, Real.exp (-p) * (P j : ℝ) ≤ (S.length j : ℝ)) ∧ + localLaw z = S.fullSliceLaw hlen) ∧ + ∀ z ∈ retained, Real.exp (-((q + 2) ^ E)) ≤ (localLaw z).mean + (fun x => (f (jointIntegerPhysicalSite x.val (z.1.val,z.2.val)) - Λ) * + (B.shearTransformedSlots hw + ((localForm z).loweringAt (fun j => (x.val j : ℝ)))).patchValue Ψ) := by + obtain ⟨C, hC, hprimes⟩ := exists_unconditioned_prime_side_budget n₀ + obtain ⟨E, hE, hfamily⟩ := exists_unconditioned_arbitrary_fixed_patch_family s + refine ⟨C, hC, E, hE, ?_⟩ + intro X _ _ _ p a Λ hp ha haΛ hΛ d₀ habsolute hX N hN f hf hfree A hscore + obtain ⟨P, hprime, hinj, hcompare, hrange, hwidth⟩ := hprimes p hp + let : ∀ k, NeZero (P k) := fun k => ⟨(hprime k).ne_zero⟩ + have hNpos (i : X) : 0 < N i := by + exact_mod_cast (Real.exp_pos ((p + 2) ^ C)).trans_le (hN i) + have hbox : (integerBox N).Nonempty := by + refine ⟨fun _ => 0, (mem_integerBox N _).mpr ?_⟩ + intro i + exact ⟨le_refl _, by exact_mod_cast hNpos i⟩ + have hmean : a + Real.exp (-p) ≤ 𝔼 x ∈ integerBox N, f x := + zero_slot_score_mean_lower_bound A N hbox f (Real.exp_pos _) hscore + have ha0 : 0 ≤ a := (Real.exp_pos (-p)).le.trans ha + have hΛ0 : 0 ≤ Λ := ha0.trans haΛ + have hσ1 : Real.exp (-p) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith) + have hspatial : ∀ j, unconditionedSpatialWidthCutoff (unconditionedResidueSiteBound P) + (unconditionedSpatialTrimFraction (Fintype.card X) (Real.exp (-p))) + (unconditionedCollisionWidth P (Real.exp (-p))) ≤ (N j : ℝ) := + fun j => (hwidth (Fintype.card X) hX).trans (hN j) + refine ⟨P, hprime, hinj, hcompare, hrange, ?_⟩ + exact hfamily n₀ P (Classical.choice inferInstance) (by linarith) ha0 ⟨hΛ0, hΛ⟩ + (Real.exp_pos _) hσ1 d₀ habsolute hprime hinj hcompare (fun k => (hrange k).1) + N hspatial f hf hfree hmean + +end BooleanCubeKernel +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedCommonSideScalarRatioBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedCommonSideScalarRatioBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4b0e097ac491001509b75d60cb892b15e827062 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedCommonSideScalarRatioBounds.lean @@ -0,0 +1,19 @@ +import OAI.Combinatorics.Progressions.Dynamics.CanonicalZeroLayerBudgetedInitialization + +namespace OAI + +section + +namespace Erdos3 + +theorem unconditionedCommonSideScalarRatio_two_le {n : ℕ} (hn : 1 ≤ n) : + 2 ≤ unconditionedCommonSideScalarRatio n := by + have hmul := Nat.mul_le_mul hn (unconditionedScalarPrimeRatio_two_le n) + unfold unconditionedCommonSideScalarRatio + omega + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedFixedPatchFamily.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedFixedPatchFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..233d5c084b8e0855536a907e3916cffe36b8cac7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedFixedPatchFamily.lean @@ -0,0 +1,341 @@ +import OAI.Combinatorics.Progressions.Estimates.CanonicalEmptyLayerGeometry + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical NNReal + +theorem exists_productive_absolute_fixed_patch_function + {J : Type*} [Fintype J] [DecidableEq J] [Nonempty J] (k : ℕ) (hk : 3 ≤ k) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ E : ℕ, 2 ≤ E ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ {H X : Type*} [Fintype H] (outer : FiniteProbabilityWeights H) (productive : Finset H), 0 < outer.mass productive → + ∀ {p a : ℝ}, 2 ≤ p → Real.exp (-p) ≤ a → + ∀ (N : J → ℕ) [∀ j, NeZero (N j)] [NeZero (∏ j, N j)], + (∀ j, (N j).Prime) → Function.Injective N → + (∀ j, Real.exp ((p + 2) ^ C) ≤ N j) → + ∀ (f : (X → ℤ) → ℝ) (z : H → (X → ℤ) × (Option J × X → ℤ)), + (∀ x, f x ∈ Set.Icc (0 : ℝ) 1) → + IntegerVectorAPFree (Function.support f) k → + (∀ h ∈ productive, Function.Injective + (fun u => BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint N u) (z h))) → + (∀ h ∈ productive, a ≤ 𝔼 u, + f (BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint N u) (z h))) → + let q := (p + 2) ^ C + (Fintype.card J : ℝ) + 2 + let D := ⌊(p + 2) ^ C⌋₊ + (1 + xi) * a < 1 ∧ + ∃ (d : ℕ) (w : Fin d → ℕ) (hw : Monotone w) (Ψ : PatchKernel d) + (B : PolynomialSlots J d w) (localForm : H → PolynomialSlots J d w) + (retained : Finset H), + d ≤ D ∧ (∀ i, 1 ≤ w i) ∧ (∀ i, w i ≤ k - 2) ∧ + (Ψ.lip : ℝ) ≤ Real.exp ((q + 2) ^ E) ∧ + (∀ i, realPolynomialMass (B.center i) ≤ (q + 2) ^ E) ∧ + retained ⊆ productive ∧ + (outer.mass productive / ((D + 1) * (k - 2 + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ outer.mass retained ∧ + ∀ h ∈ retained, Real.exp (-((q + 2) ^ E)) ≤ + 𝔼 u, (f (BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint N u) (z h)) - + (1 + xi) * a) * + (B.shearTransformedSlots hw + ((localForm h).loweringAt (fun j => ((u j).val : ℝ)))).patchValue Ψ := by + obtain ⟨C, hC, xi, hxi, habsolute⟩ := exists_productive_absolute_crt_patches (J := J) k hk + obtain ⟨E, hE, hfixed⟩ := exists_varying_rank_fixed_patch_function (k - 2) + refine ⟨C, hC, E, hE, xi, hxi, ?_⟩ + intro H X _ outer productive hmass p a hp ha N _ _ hprime hinj hsize f z hf hfree hzinj hmean + let q := (p + 2) ^ C + (Fintype.card J : ℝ) + 2 + let D := ⌊(p + 2) ^ C⌋₊ + have hne : productive.Nonempty := Finset.nonempty_iff_ne_empty.mpr (by + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty] at hmass + linarith) + obtain ⟨h0, hh0⟩ := hne + let : Nonempty H := ⟨h0⟩ + obtain ⟨hcap, d, patch, hcost, hscore⟩ := + habsolute productive ⟨h0,hh0⟩ hp ha N hprime hinj hsize f z hf hfree hzinj hmean + have hpower : 0 ≤ (p + 2) ^ C := pow_nonneg (by linarith) _ + have hpq : (p + 2) ^ C ≤ q := by dsimp only [q]; linarith [Nat.cast_nonneg (α := ℝ) (Fintype.card J)] + have hq : 0 ≤ q := hpower.trans hpq + have hD : (D : ℝ) ≤ q := (Nat.floor_le hpower).trans hpq + have hJ : (Fintype.card J : ℝ) ≤ q := by dsimp only [q]; linarith + have hd (h) : d h ≤ D := Nat.le_floor (hcost h).1 + have hLip (h) : ((patch h).kernel.lip : ℝ) ≤ Real.exp q := + (by linarith [(hcost h).2] : ((patch h).kernel.lip : ℝ) ≤ Real.exp ((p + 2) ^ C)).trans + (Real.exp_le_exp.mpr hpq) + let localLaw := fun _ : H => FiniteProbabilityWeights.uniform (∀ j, ZMod (N j)) + let point := fun (_ : H) (u : ∀ j, ZMod (N j)) => residueBoxIntegerPoint N u + let score := fun h u => f (BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint N u) (z h)) - + (1 + xi) * a + have htarget : 0 ≤ (1 + xi) * a := + mul_nonneg (by linarith) ((Real.exp_pos (-p)).le.trans ha) + have hscorebound (h) (u : ∀ j, ZMod (N j)) : |score h u| ≤ 1 := by + dsimp only [score] + exact abs_le.mpr ⟨by linarith [(hf (BooleanCubeKernel.jointIntegerPhysicalSite + (residueBoxIntegerPoint N u) (z h))).1], by linarith [(hf (BooleanCubeKernel.jointIntegerPhysicalSite + (residueBoxIntegerPoint N u) (z h))).2]⟩ + have hpositive (h) (hh : h ∈ productive) : Real.exp (-q) ≤ (localLaw h).mean + (fun u => score h u * (patch h).value (fun j => (point h u j : ℝ))) := by + simp only [localLaw, FiniteProbabilityWeights.uniform_mean, point, score, residueBoxIntegerPoint] + exact (Real.exp_le_exp.mpr (neg_le_neg hpq)).trans (hscore h hh) + obtain ⟨d₀, w, hw, Ψ, B, localForm, retained, hd₀, hpos, hws, hΨ, hB, hsub, hretained, hlocal⟩ := + hfixed outer productive d patch D q hd hmass hq hD hJ hLip localLaw point score hscorebound hpositive + refine ⟨hcap, d₀, w, hw, Ψ, B, localForm, retained, hd₀, hpos, hws, hΨ, hB, hsub, hretained, ?_⟩ + intro h hh + simpa only [localLaw, FiniteProbabilityWeights.uniform_mean, point, score, residueBoxIntegerPoint, Int.cast_natCast, q] using hlocal h hh + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem exists_concrete_unconditioned_fixed_patch_family (n₀ : ℕ) [NeZero n₀] + (k : ℕ) (hk : 3 ≤ k) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ E : ℕ, 2 ≤ E ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ {X : Type*} [Fintype X] [DecidableEq X] (_i : X) + {p a σ : ℝ}, 2 ≤ p → Real.exp (-p) ≤ a → 0 < σ → σ ≤ 1 → + ∀ (P : Fin n₀ → ℕ) [∀ j, NeZero (P j)] [NeZero (∏ j, P j)], + (∀ j, (P j).Prime) → Function.Injective P → + (∀ j, Real.exp ((p + 2)^C) ≤ P j) → + ∀ (N : X → ℕ), + (∀ j, unconditionedSpatialWidthCutoff (unconditionedResidueSiteBound P) + (unconditionedSpatialTrimFraction (Fintype.card X) σ) + (unconditionedCollisionWidth P σ) ≤ (N j : ℝ)) → + ∀ (f : (X → ℤ) → ℝ), (∀ x, f x ∈ Set.Icc (0 : ℝ) 1) → + IntegerVectorAPFree (Function.support f) k → + a + σ ≤ (𝔼 x ∈ integerBox N, f x) → + let τ := unconditionedSpatialTrimFraction (Fintype.card X) σ + let W := trimmedSpatialWidths (K := Fin n₀) (unconditionedResidueSiteBound P) τ N + let R := spatialTrimMargin τ N + ∃ (hW : ∀ z, 0 < W z) (hR : ∀ j, 2 * R j < N j) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} W z), + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + ∃ productive : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1), + σ / 4 ≤ law.mass productive ∧ + (∀ z ∈ productive, Function.Injective (fun u => + BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) (z.1.val,z.2.val))) ∧ + (1 + xi) * a < 1 ∧ + let q := (p + 2) ^ C + (n₀ : ℝ) + 2 + let D := ⌊(p + 2) ^ C⌋₊ + ∃ (d : ℕ) (w : Fin d → ℕ) (hw : Monotone w) (Ψ : PatchKernel d) + (B : PolynomialSlots (Fin n₀) d w) + (localForm : (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) → + PolynomialSlots (Fin n₀) d w) + (retained : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1)), + d ≤ D ∧ (∀ j, 1 ≤ w j) ∧ (∀ j, w j ≤ k - 2) ∧ + (Ψ.lip : ℝ) ≤ Real.exp ((q + 2) ^ E) ∧ + (∀ j, realPolynomialMass (B.center j) ≤ (q + 2) ^ E) ∧ + retained ⊆ productive ∧ + (law.mass productive / ((D + 1) * (k - 2 + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + ((σ / 4) / ((D + 1) * (k - 2 + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + (∀ z ∈ retained, Real.exp (-((q + 2) ^ E)) ≤ + 𝔼 u, (f (BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) + (z.1.val,z.2.val)) - (1+xi)*a) * + (B.shearTransformedSlots hw + ((localForm z).loweringAt (fun j => ((u j).val : ℝ)))).patchValue Ψ) ∧ + ∀ z : trimmedIntegerBox N R × rectangularWeightIndices 0 W 1, ∀ u, + BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) + (z.1.val,z.2.val) ∈ integerBox N := by + obtain ⟨C, hC, E, hE, xi, hxi, hfixed⟩ := + exists_productive_absolute_fixed_patch_function (J := Fin n₀) k hk + refine ⟨C, hC, E, hE, xi, hxi, ?_⟩ + intro X _ _ i p a σ hp ha hσ hσ1 P _ _ hprime hinj hsize N hN f hf hfree hmean + let τ := unconditionedSpatialTrimFraction (Fintype.card X) σ + let W := trimmedSpatialWidths (K := Fin n₀) (unconditionedResidueSiteBound P) τ N + let R := spatialTrimMargin τ N + obtain ⟨hW, hR, hZ, productive, hmass, hinjective, hlocal, hinside⟩ := + BooleanCubeKernel.exists_concrete_unconditioned_productive_family P i + ((Real.exp_pos _).le.trans ha) hσ hσ1 N hN f hf hmean + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + have hmasspos : 0 < law.mass productive := (by positivity : 0 < σ / 4).trans_le hmass + obtain ⟨hcap, d, w, hw, Ψ, B, localForm, retained, + hd, hwpos, hwmax, hΨ, hB, hsub, hretained, hscore⟩ := + hfixed law productive hmasspos hp ha P hprime hinj hsize f + (fun z => (z.1.val,z.2.val)) hf hfree hinjective + (fun z hz => (by linarith : a ≤ a + σ / 2).trans (hlocal z hz)) + refine ⟨hW, hR, hZ, productive, hmass, hinjective, hcap, d, w, hw, Ψ, B, localForm, retained, + hd, hwpos, hwmax, ?_, ?_, hsub, ?_, ?_, ?_, hinside⟩ + · simpa only [Fintype.card_fin] using hΨ + · simpa only [Fintype.card_fin] using hB + · simpa only [Fintype.card_fin] using hretained + · have hm := mul_le_mul_of_nonneg_right + (div_le_div_of_nonneg_right hmass (Nat.cast_nonneg + ((⌊(p + 2) ^ C⌋₊ + 1) * (k - 2 + 1) ^ ⌊(p + 2) ^ C⌋₊))) + (Real.exp_pos (-(((p + 2) ^ C + (n₀ : ℝ) + 2 + 2) ^ E))).le + exact hm.trans (by simpa only [Fintype.card_fin] using hretained) + · simpa only [Fintype.card_fin] using hscore + +theorem exists_concrete_unconditioned_fixed_patch_family_of_zero_score (n₀ : ℕ) [NeZero n₀] + (k : ℕ) (hk : 3 ≤ k) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ E : ℕ, 2 ≤ E ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ {X : Type*} [Fintype X] [DecidableEq X] (_i : X) + {p a σ : ℝ}, 2 ≤ p → Real.exp (-p) ≤ a → 0 < σ → σ ≤ 1 → + ∀ (P : Fin n₀ → ℕ) [∀ j, NeZero (P j)] [NeZero (∏ j, P j)], + (∀ j, (P j).Prime) → Function.Injective P → + (∀ j, Real.exp ((p + 2)^C) ≤ P j) → + ∀ (N : X → ℕ), + (∀ j, unconditionedSpatialWidthCutoff (unconditionedResidueSiteBound P) + (unconditionedSpatialTrimFraction (Fintype.card X) σ) + (unconditionedCollisionWidth P σ) ≤ (N j : ℝ)) → + ∀ (f : (X → ℤ) → ℝ), (∀ x, f x ∈ Set.Icc (0 : ℝ) 1) → + IntegerVectorAPFree (Function.support f) k → + ∀ oldPatch : PolynomialPatch X (k - 2) 0, + σ ≤ (𝔼 x ∈ integerBox N, (f x - a) * oldPatch.value (fun j => (x j : ℝ))) → + let τ := unconditionedSpatialTrimFraction (Fintype.card X) σ + let W := trimmedSpatialWidths (K := Fin n₀) (unconditionedResidueSiteBound P) τ N + let R := spatialTrimMargin τ N + ∃ (hW : ∀ z, 0 < W z) (hR : ∀ j, 2 * R j < N j) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} W z), + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + ∃ productive : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1), + σ / 4 ≤ law.mass productive ∧ + (∀ z ∈ productive, Function.Injective (fun u => + BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) (z.1.val,z.2.val))) ∧ + (1 + xi) * a < 1 ∧ + let q := (p + 2) ^ C + (n₀ : ℝ) + 2 + let D := ⌊(p + 2) ^ C⌋₊ + ∃ (d : ℕ) (w : Fin d → ℕ) (hw : Monotone w) (Ψ : PatchKernel d) + (B : PolynomialSlots (Fin n₀) d w) + (localForm : (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) → + PolynomialSlots (Fin n₀) d w) + (retained : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1)), + d ≤ D ∧ (∀ j, 1 ≤ w j) ∧ (∀ j, w j ≤ k - 2) ∧ + (Ψ.lip : ℝ) ≤ Real.exp ((q + 2) ^ E) ∧ + (∀ j, realPolynomialMass (B.center j) ≤ (q + 2) ^ E) ∧ + retained ⊆ productive ∧ + (law.mass productive / ((D + 1) * (k - 2 + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + ((σ / 4) / ((D + 1) * (k - 2 + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + (∀ z ∈ retained, Real.exp (-((q + 2) ^ E)) ≤ + 𝔼 u, (f (BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) + (z.1.val,z.2.val)) - (1+xi)*a) * + (B.shearTransformedSlots hw + ((localForm z).loweringAt (fun j => ((u j).val : ℝ)))).patchValue Ψ) ∧ + ∀ z : trimmedIntegerBox N R × rectangularWeightIndices 0 W 1, ∀ u, + BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) + (z.1.val,z.2.val) ∈ integerBox N := by + obtain ⟨C, hC, E, hE, xi, hxi, hmain⟩ := + exists_concrete_unconditioned_fixed_patch_family n₀ k hk + refine ⟨C, hC, E, hE, xi, hxi, ?_⟩ + intro X _ _ i p a σ hp ha hσ hσ1 P _ _ hprime hinj hsize N hN f hf hfree oldPatch hscore + have hbox : (integerBox N).Nonempty := by + by_contra he + have hempty : integerBox N = ∅ := Finset.not_nonempty_iff_eq_empty.mp he + simp only [hempty, Finset.expect_empty] at hscore + linarith + have hmean := zero_slot_score_mean_lower_bound oldPatch N hbox f hσ hscore + exact hmain i hp ha hσ hσ1 P hprime hinj hsize N hN f hf hfree hmean + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem exists_unconditioned_fixed_patch_family (n₀ : ℕ) [NeZero n₀] + (k : ℕ) (hk : 3 ≤ k) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ E : ℕ, 2 ≤ E ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ {X : Type*} [Fintype X] [DecidableEq X] (i : X) + {p a σ L : ℝ}, 2 ≤ p → Real.exp (-p) ≤ a → 0 < σ → 0 < L → + ∀ (P : Fin n₀ → ℕ) [∀ j, NeZero (P j)] [NeZero (∏ j, P j)], + (∀ j, (P j).Prime) → Function.Injective P → + (∀ j, Real.exp ((p + 2)^C) ≤ P j) → + ∀ (N R : X → ℕ) (hR : ∀ i, 2 * R i < N i) + (W : Option (Fin n₀) × X → ℝ) (hW : ∀ z, 0 < W z), + (∀ z, 8 * (probabilityProfileLipschitz : ℝ) ≤ + residueProfileWidth (fun _ : X => 1) W z) → + (∀ j, L ≤ W (some j,i)) → + (∀ u j, BooleanCubeKernel.physicalSiteWidth (residueBoxIntegerPoint P u) W j ≤ (R j : ℝ)) → + 2 * (∑ j, 2 * (R j : ℝ) / N j) ≤ σ / 8 → + (Fintype.card (∀ j, ZMod (P j)) : ℝ)^2 * (2 / L) ≤ σ / 16 → + ∀ (f : (X → ℤ) → ℝ), (∀ x, f x ∈ Set.Icc (0 : ℝ) 1) → + IntegerVectorAPFree (Function.support f) k → + a + σ ≤ (𝔼 x ∈ integerBox N, f x) → + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} W z, + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + ∃ productive : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1), + σ / 4 ≤ law.mass productive ∧ + (∀ z ∈ productive, Function.Injective (fun u => + BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) (z.1.val,z.2.val))) ∧ + (1 + xi) * a < 1 ∧ + let q := (p + 2) ^ C + (n₀ : ℝ) + 2 + let D := ⌊(p + 2) ^ C⌋₊ + ∃ (d : ℕ) (w : Fin d → ℕ) (hw : Monotone w) (Ψ : PatchKernel d) + (B : PolynomialSlots (Fin n₀) d w) + (localForm : (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1) → + PolynomialSlots (Fin n₀) d w) + (retained : Finset (trimmedIntegerBox N R × rectangularWeightIndices 0 W 1)), + d ≤ D ∧ (∀ j, 1 ≤ w j) ∧ (∀ j, w j ≤ k - 2) ∧ + (Ψ.lip : ℝ) ≤ Real.exp ((q + 2) ^ E) ∧ + (∀ j, realPolynomialMass (B.center j) ≤ (q + 2) ^ E) ∧ + retained ⊆ productive ∧ + (law.mass productive / ((D + 1) * (k - 2 + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + ((σ / 4) / ((D + 1) * (k - 2 + 1) ^ D : ℕ)) * + Real.exp (-((q + 2) ^ E)) ≤ law.mass retained ∧ + (∀ z ∈ retained, Real.exp (-((q + 2) ^ E)) ≤ + 𝔼 u, (f (BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) + (z.1.val,z.2.val)) - (1+xi)*a) * + (B.shearTransformedSlots hw + ((localForm z).loweringAt (fun j => ((u j).val : ℝ)))).patchValue Ψ) ∧ + ∀ z : trimmedIntegerBox N R × rectangularWeightIndices 0 W 1, ∀ u, + BooleanCubeKernel.jointIntegerPhysicalSite (residueBoxIntegerPoint P u) + (z.1.val,z.2.val) ∈ integerBox N := by + obtain ⟨C, hC, E, hE, xi, hxi, hfixed⟩ := + exists_productive_absolute_fixed_patch_function (J := Fin n₀) k hk + refine ⟨C, hC, E, hE, xi, hxi, ?_⟩ + intro X _ _ i p a σ L hp ha hσ hL P _ _ hprime hinj hsize N R hR W hW + hscale hwidth hfit hboundary hcollision f hf hfree hmean + have hsite : Function.Injective (residueBoxIntegerPoint P) := by + intro u v he + funext j + apply ZMod.val_injective + have hj := congrFun he j + change ((u j).val : ℤ) = ((v j).val : ℤ) at hj + exact_mod_cast hj + obtain ⟨hZ, productive, hmass, hinjective, hlocal, hinside⟩ := + BooleanCubeKernel.exists_unconditioned_productive_family N R hR + (residueBoxIntegerPoint P) hsite i (fun _ : X => 1) (fun _ => by decide) + {0} (Finset.singleton_nonempty _) W hW hscale hL hwidth hfit + ((Real.exp_pos _).le.trans ha) hσ hboundary + (by simpa only [Nat.cast_one, mul_one] using hcollision) f hf hmean + let law := selectedJointReference (trimmedIntegerBox N R) + (trimmedIntegerBox_nonempty N R hR) (fun _ : X => 1) {0} W hW hZ + have hmasspos : 0 < law.mass productive := (by positivity : 0 < σ / 4).trans_le hmass + obtain ⟨hcap, d, w, hw, Ψ, B, localForm, retained, + hd, hwpos, hwmax, hΨ, hB, hsub, hretained, hscore⟩ := + hfixed law productive hmasspos hp ha P hprime hinj hsize f + (fun z => (z.1.val,z.2.val)) hf hfree hinjective + (fun z hz => (by linarith : a ≤ a + σ / 2).trans (hlocal z hz)) + refine ⟨hZ, productive, hmass, hinjective, hcap, d, w, hw, Ψ, B, localForm, retained, + hd, hwpos, hwmax, ?_, ?_, hsub, ?_, ?_, ?_, hinside⟩ + · simpa only [Fintype.card_fin] using hΨ + · simpa only [Fintype.card_fin] using hB + · simpa only [Fintype.card_fin] using hretained + · have hm := mul_le_mul_of_nonneg_right + (div_le_div_of_nonneg_right hmass (Nat.cast_nonneg + ((⌊(p + 2) ^ C⌋₊ + 1) * (k - 2 + 1) ^ ⌊(p + 2) ^ C⌋₊))) + (Real.exp_pos (-(((p + 2) ^ C + (n₀ : ℝ) + 2 + 2) ^ E))).le + exact hm.trans (by simpa only [Fintype.card_fin] using hretained) + · simpa only [Fintype.card_fin] using hscore + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedSmoothSlopeCap.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedSmoothSlopeCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..e68049655502563c4d17a6a6de7c1dd7c6e51a8e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedSmoothSlopeCap.lean @@ -0,0 +1,88 @@ +import OAI.Combinatorics.Progressions.Lattices.SmoothResidueWindowMass + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem selectedResidueSmoothWeight_one {K I : Type*} [Fintype K] [Fintype I] + (W : K × I → ℝ) (z : K × I → ℤ) : + selectedResidueSmoothWeight (fun _ => 1) {0} W z = + rectangularWeight (smoothProductProfile (K × I)) 0 W z := by + have hp : columnResiduePattern (fun _ : I => 1) z = 0 := Subsingleton.elim _ _ + simp only [selectedResidueSmoothWeight, hp, Finset.mem_singleton, ite_true, + rectangularWeight, rectangularLatticePoint_zero_origin] + +theorem selectedResidueSmoothMass_one {K I : Type*} [Fintype K] [Fintype I] + (W : K × I → ℝ) : + (∑' z, selectedResidueSmoothWeight (fun _ => 1) {0} W z) = + shiftedSmoothProductMass 0 W := by + simp only [selectedResidueSmoothWeight_one, shiftedSmoothProductMass] + +theorem selectedResidueSmoothPMF_one {K I : Type*} [Fintype K] [Fintype I] + (W : K × I → ℝ) (hW : ∀ t, 0 < W t) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ => 1) {0} W z) : + selectedResidueSmoothPMF (fun _ => 1) {0} W hW hZ = + shiftedSmoothProductPMF 0 W hW ((selectedResidueSmoothMass_one W) ▸ hZ) := by + ext z + apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp + rw [selectedResidueSmoothPMF_toReal, shiftedSmoothProductPMF_toReal, + selectedResidueSmoothWeight_one, selectedResidueSmoothMass_one] + +theorem independentProductPMF_slopes {K I X : Type*} [Fintype K] [Fintype I] + [Countable X] [MeasurableSpace X] [MeasurableSingletonClass X] + (p : Option K × I → PMF X) : + (independentProductPMF p).map (fun z => fun t : K × I => z (some t.1,t.2)) = + independentProductPMF (fun t : K × I => p (some t.1,t.2)) := by + rw [independentProductPMF_base_split, PMF.map_bind] + simp only [PMF.map_comp] + have hconst (tail : K × I → X) : + (independentProductPMF (fun i => p (none,i))).map + ((fun z => fun t : K × I => z (some t.1,t.2)) ∘ baseArrayJoin tail) = + PMF.pure tail := by + have he : ((fun z => fun t : K × I => z (some t.1,t.2)) ∘ baseArrayJoin tail) = + Function.const (I → X) tail := by + funext z t + rcases t with ⟨k,i⟩ + rfl + rw [he, PMF.map_const] + simp only [hconst, PMF.bind_pure] + +theorem shiftedSmoothProductPMF_slopes_cap {K I : Type*} [Fintype K] [Fintype I] + (a W : Option K × I → ℝ) (hW : ∀ t, 0 < W t) + (hZ : 0 < shiftedSmoothProductMass a W) + (hlarge : ∀ t : K × I, 8 * (probabilityProfileLipschitz : ℝ) ≤ W (some t.1,t.2)) + (y : K × I → ℤ) : + (((shiftedSmoothProductPMF a W hW hZ).map + (fun z => fun t : K × I => z (some t.1,t.2))) y).toReal ≤ + ∏ t : K × I, 2 / W (some t.1,t.2) := by + rw [shiftedSmoothProductPMF_eq_independent, independentProductPMF_slopes, + independentProductPMF_toReal] + exact Finset.prod_le_prod₀ (fun _ _ => ENNReal.toReal_nonneg) + (fun t _ => shiftedSmoothCoefficientPMF_le (a (some t.1,t.2)) (hlarge t) (y t)) + +theorem selectedResidueFiniteLaw_one_slopes_cap {K I : Type*} [Fintype K] [Fintype I] + (W : Option K × I → ℝ) (hW : ∀ t, 0 < W t) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ => 1) {0} W z) + (hlarge : ∀ t : K × I, 8 * (probabilityProfileLipschitz : ℝ) ≤ W (some t.1,t.2)) + (y : K → I → ℤ) : + (selectedResidueFiniteLaw (fun _ => 1) {0} W hW hZ).mean + (fun z => if (fun k i => z.val (some k,i)) = y then 1 else 0) ≤ + ∏ t : K × I, 2 / W (some t.1,t.2) := by + have he (z : Option K × I → ℤ) : + ((fun k i => z (some k,i)) = y) ↔ + ((fun t : K × I => z (some t.1,t.2)) = fun t => y t.1 t.2) := by + simp only [funext_iff, Prod.forall] + simp_rw [he] + rw [selectedResidueFiniteLaw_mean (fun _ => 1) {0} W hW hZ + (fun z => if (fun t : K × I => z (some t.1,t.2)) = (fun t => y t.1 t.2) then 1 else 0), + ← pmf_map_toReal_indicator, selectedResidueSmoothPMF_one] + exact shiftedSmoothProductPMF_slopes_cap 0 W hW _ hlarge (fun t => y t.1 t.2) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedTrimmedSliceFamily.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedTrimmedSliceFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..f38a82c2aa2108736f838bdcf7c0a5f2c4081c81 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnconditionedTrimmedSliceFamily.lean @@ -0,0 +1,274 @@ +import OAI.Combinatorics.Progressions.Estimates.CanonicalUnconditionedScalarTransfer +import OAI.Combinatorics.Progressions.Probability.CanonicalScalarFamilyMass + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical + +noncomputable def rectangularScalarDiscrepancy {I J : Type*} + [Fintype I] [Fintype J] (parent : I → ℤ) (H : I → ℕ) + (h g : (I → ℤ) → ℂ) (epsilon level : ℝ) (D : ℕ) + (anchor parLo parHi : J → ℤ) (hpar : ∀ j, parLo j < parHi j) + (z : Option J × I → ℤ) : ℝ := + (integerBoxUniformWeights parLo parHi hpar).mean (fun t => + realZeroExtendFinset (translatedIntegerBox parent H) (fun x => (h x).re) + (smoothAffineSample (fun j => anchor j + (D : ℤ) * (t j).val) z) - + (1 + epsilon) * level * + realZeroExtendFinset (translatedIntegerBox parent H) (fun x => (g x).re) + (smoothAffineSample (fun j => anchor j + (D : ℤ) * (t j).val) z)) + +theorem exists_residue_slice_of_rectangular_scalar_family + {C Ω I J : Type*} [Fintype C] [Fintype Ω] [Fintype I] [Fintype J] + (outer : FiniteProbabilityWeights Ω) (source : Ω → Option J × I → ℤ) + (parent : I → ℤ) (H : I → ℕ) + (h g : C → (I → ℤ) → ℂ) (epsilon level budget : C → ℝ) + (D : C → ℕ) (anchor parLo parHi : C → J → ℤ) + (hpar : ∀ c j, parLo c j < parHi c j) (p : ℝ) + (htransfer : ∀ c, + ResidueSliceUpperComparison (h c) (g c) parent H (budget c) (level c) + (Real.exp (-budget c)) → + outer.eventProbability (fun z => Real.exp (-p) < + rectangularScalarDiscrepancy parent H (h c) (g c) (epsilon c) (level c) + (D c) (anchor c) (parLo c) (parHi c) (hpar c) (source z)) ≤ Real.exp (-p)) + (productive : Ω → Prop) + (hmass : (Fintype.card C : ℝ) * Real.exp (-p) < outer.eventProbability productive) + (hproductive : ∀ z, productive z → ∃ c, Real.exp (-p) < + rectangularScalarDiscrepancy parent H (h c) (g c) (epsilon c) (level c) + (D c) (anchor c) (parLo c) (parHi c) (hpar c) (source z)) : + ∃ (c : C) (lo : I → ℤ) (N : I → ℕ) (M : ℕ) (u : I → ℤ), + 0 < M ∧ PhysicalSubbox parent H lo N ∧ + ResidueSliceLogCostLE H lo N M u (budget c) ∧ + Nonempty (IntegerResidueBox lo (fun i => lo i + N i) (fun _ => (M : ℤ)) u) ∧ + (∀ i, 0 < residueIndexLength (lo i) (lo i + N i) M (u i)) ∧ + Real.exp (-budget c) < (physicalResidueMean (h c) lo N M u).re - + level c * (physicalResidueMean (g c) lo N M u).re := by + have hfailure : ∃ c, ¬ ResidueSliceUpperComparison (h c) (g c) parent H + (budget c) (level c) (Real.exp (-budget c)) := by + by_contra! hn + have hu := outer.eventProbability_union_bound productive + (fun c z => Real.exp (-p) < + rectangularScalarDiscrepancy parent H (h c) (g c) (epsilon c) (level c) + (D c) (anchor c) (parLo c) (parHi c) (hpar c) (source z)) hproductive + have hb : outer.eventProbability productive ≤ (Fintype.card C : ℝ) * Real.exp (-p) := by + apply hu.trans + calc + _ ≤ ∑ _c : C, Real.exp (-p) := Finset.sum_le_sum (fun c _ => htransfer c (hn c)) + _ = _ := by simp + exact (not_lt_of_ge hb) hmass + obtain ⟨c, hc⟩ := hfailure + obtain ⟨lo, N, M, u, hM, hbox, hcost, hne, hlength, hscore⟩ := + exists_nonempty_residue_slice_of_not_upper (Real.exp_nonneg _) hc + exact ⟨c, lo, N, M, u, hM, hbox, hcost, hne, hlength, hscore⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem exists_residue_slice_of_canonical_scalar_family + {C Ω I J : Type*} [Fintype C] [Fintype Ω] [Fintype I] [Fintype J] + (outer : FiniteProbabilityWeights Ω) (source : Ω → Option J × I → ℤ) + (parent : I → ℤ) (H : I → ℕ) + (h g : C → (I → ℤ) → ℂ) (epsilon level budget : C → ℝ) + (D : C → ℕ) (anchor parLo parHi : C → J → ℤ) + (hpar : ∀ c j, parLo c j < parHi c j) (d : ℕ) {p : ℝ} + (hp : 0 ≤ p) (hcard : (Fintype.card C : ℝ) ≤ Real.exp p) + (htransfer : ∀ c, + ResidueSliceUpperComparison (h c) (g c) parent H (budget c) (level c) + (Real.exp (-budget c)) → + outer.eventProbability (fun z => Real.exp (-(8 * ((d : ℝ) + 1) * (p + 1))) < + rectangularScalarDiscrepancy parent H (h c) (g c) (epsilon c) (level c) + (D c) (anchor c) (parLo c) (parHi c) (hpar c) (source z)) ≤ Real.exp (-(8 * ((d : ℝ) + 1) * (p + 1)))) + (productive : Ω → Prop) + (hmass : Real.exp (-p) ≤ outer.eventProbability productive) + (hproductive : ∀ z, productive z → ∃ c, Real.exp (-(8 * ((d : ℝ) + 1) * (p + 1))) < + rectangularScalarDiscrepancy parent H (h c) (g c) (epsilon c) (level c) + (D c) (anchor c) (parLo c) (parHi c) (hpar c) (source z)) : + ∃ (c : C) (lo : I → ℤ) (N : I → ℕ) (M : ℕ) (u : I → ℤ), + 0 < M ∧ PhysicalSubbox parent H lo N ∧ + ResidueSliceLogCostLE H lo N M u (budget c) ∧ + Nonempty (IntegerResidueBox lo (fun i => lo i + N i) (fun _ => (M : ℤ)) u) ∧ + (∀ i, 0 < residueIndexLength (lo i) (lo i + N i) M (u i)) ∧ + Real.exp (-budget c) < (physicalResidueMean (h c) lo N M u).re - + level c * (physicalResidueMean (g c) lo N M u).re := by + exact exists_residue_slice_of_rectangular_scalar_family outer source parent H h g + epsilon level budget D anchor parLo parHi hpar (8 * ((d : ℝ) + 1) * (p + 1)) + htransfer productive (canonicalScalarFamilyMass d (Fintype.card C) hp hcard hmass) hproductive + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators Classical + +namespace ResidueBoxSlice +variable {J : Type*} [Fintype J] [decJ : DecidableEq J] {N : J → ℕ} {q : ℕ} + +noncomputable def scalarParameterEquiv (S : ResidueBoxSlice N q) : + (∀ j, Finset.Ico (0 : ℤ) (S.length j : ℤ)) ≃ (∀ j, Fin (S.length j)) where + toFun x j := ⟨(x j).val.toNat, by + have := Finset.mem_Ico.mp (x j).property + omega⟩ + invFun t j := ⟨((t j).val : ℤ), by + exact Finset.mem_Ico.mpr ⟨Int.natCast_nonneg _, by exact_mod_cast (t j).isLt⟩⟩ + left_inv x := by + funext j + apply Subtype.ext + have := (Finset.mem_Ico.mp (x j).property).1 + exact Int.toNat_of_nonneg this + right_inv t := by + funext j + apply Fin.ext + simp + +theorem scalarParameterEquiv_point (S : ResidueBoxSlice N q) + (x : ∀ j, Finset.Ico (0 : ℤ) (S.length j : ℤ)) : + (S.fullSlicePointInIntegerBox (S.scalarParameterEquiv x)).val = + fun j => (S.start j : ℤ) + (q : ℤ) * (x j).val := by + funext j + have hj := (Finset.mem_Ico.mp (x j).property).1 + simp only [fullSlicePointInIntegerBox, point, scalarParameterEquiv, + Equiv.coe_fn_mk, Nat.cast_add, Nat.cast_mul, Int.toNat_of_nonneg hj] + +theorem rectangularScalarDiscrepancy_eq_fullSliceLaw + {X : Type*} [Fintype X] (S : ResidueBoxSlice N q) (hlen : ∀ j, 0 < S.length j) + (parent : X → ℤ) (H : X → ℕ) (h g : (X → ℤ) → ℂ) + (epsilon level : ℝ) (frame : Option J × X → ℤ) + (hinside : ∀ u : integerBox N, + smoothAffineSample u.val frame ∈ translatedIntegerBox parent H) : + rectangularScalarDiscrepancy parent H h g epsilon level q + (fun j => (S.start j : ℤ)) 0 (fun j => (S.length j : ℤ)) + (fun j => by change (0 : ℤ) < (S.length j : ℤ); exact_mod_cast hlen j) frame = + (S.fullSliceLaw hlen).mean (fun u => + (h (smoothAffineSample u.val frame)).re - + (1 + epsilon) * level * (g (smoothAffineSample u.val frame)).re) := by + have hdec : decJ = Classical.decEq J := Subsingleton.elim _ _ + subst decJ + rw [rectangularScalarDiscrepancy, integerBoxUniformWeights_mean, S.fullSliceLaw_mean] + apply Fintype.expect_equiv S.scalarParameterEquiv + intro x + rw [S.scalarParameterEquiv_point] + have hi := hinside (S.fullSlicePointInIntegerBox (S.scalarParameterEquiv x)) + rw [S.scalarParameterEquiv_point] at hi + rw [realZeroExtendFinset_on _ _ hi, realZeroExtendFinset_on _ _ hi] + +end ResidueBoxSlice +end Erdos3 + +end + +section + +namespace Erdos3 +open BooleanCubeKernel +open scoped TensorProduct BigOperators Classical +universe u v + +theorem exists_unconditioned_trimmed_slice_family (s : ℕ) : + ∃ E : ℕ, 2 ≤ E ∧ ∀ {I : Type u} {V : Type v} {J : Type*} + [Fintype I] [Fintype J] [LieRing V] [LieAlgebra ℚ V] + [TopologicalSpace (ℝ ⊗[ℚ] V)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] V)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] V)] [T2Space (ℝ ⊗[ℚ] V)] + {d0 : ℕ} (nilmanifold : RationalFilteredNilmanifold V s d0) + (p epsilon P0 level budget : ℝ), + 2 ≤ p → 0 < epsilon → epsilon ≤ 1 → 0 ≤ P0 → 3 * p + 10 ≤ P0 → + epsilon⁻¹ ≤ Real.exp P0 → Real.exp (-p) ≤ level → level ≤ 2 → + (Fintype.card I : ℝ) ≤ p → 2 ≤ Fintype.card J → + (Fintype.card J : ℝ) ≤ Real.exp P0 → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp P0 → + ∀ g : nilmanifold.Niltest (fun _ : I => 1), g.ComplexityLE p → + ∀ {κ : Type*} [Fintype κ] (_k0 : J) (D : κ → ℕ) + (anchor parLo parHi : κ → J → ℤ) (hpar : ∀ r j, parLo r j < parHi r j), + (∀ r, 0 < D r) → (∀ r, (D r : ℝ) ≤ Real.exp P0) → + ∀ (L C B A K c Cwidth : ℝ), 1 ≤ C → 0 ≤ B → 0 ≤ A → 0 ≤ K → 0 < c → 0 ≤ Cwidth → + C ≤ Real.exp P0 → B ≤ Real.exp P0 → A ≤ Real.exp P0 → K ≤ Real.exp P0 → + c⁻¹ ≤ Real.exp P0 → Cwidth ≤ Real.exp P0 → + ∀ (lo : I → ℤ) (N : I → ℕ) (H : I → ℝ), + (∀ i, H i ≤ 2 * (N i : ℝ)) → (∀ i, (N i : ℝ) ≤ A * H i) → + (∀ z ∈ translatedIntegerBox lo N, (g.eval z).im = 0 ∧ 0 ≤ (g.eval z).re ∧ (g.eval z).re ≤ 1) → + ∀ h : (I → ℤ) → ℂ, + (∀ z ∈ translatedIntegerBox lo N, 0 ≤ (h z).re ∧ (h z).re ≤ 1) → + ∀ (R : κ → ℕ) (parMin : κ → ℝ), (∀ r, 0 < parMin r) → + (∀ r j, parMin r ≤ ((parHi r j - parLo r j : ℤ) : ℝ)) → + (∀ r j, parHi r j - parLo r j ≤ (R r : ℤ)) → + (∀ r, (R r : ℝ) ≤ Cwidth * parMin r) → (∀ r, c * L ≤ parMin r) → + (∀ r j, |((anchor r j + (D r : ℤ) * parLo r j : ℤ) : ℝ) / L| ≤ C) → + (∀ r j, |((anchor r j + (D r : ℤ) * parHi r j : ℤ) : ℝ) / L| ≤ C) → + ∀ (width : Option J × I → ℝ) (hwidth : ∀ z, 0 < width z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : I => 1) {0} width z) + (margin : I → ℕ) (hmargin : ∀ i, 2 * margin i < N i), + (∑ i, 2 * (margin i : ℝ) / N i) ≤ 1 / 2 → + (∀ i, width (none,i) ≤ (margin i : ℝ)) → + (∀ z : J × I, 8 * (probabilityProfileLipschitz : ℝ) ≤ width (some z.1,z.2)) → + 4 * ((Fintype.card (J × I) : ℝ) + 1) ≤ p → + let sourceLo := jointFrameSourceLo width + let sourceHi := jointFrameSourceHi N width + ∀ (origin : Option J × I → ℤ), + (∀ z : Option J × I, smoothPairCoefficientScale (H z.2) L z.1 ≤ + K * ((sourceHi z - sourceLo z : ℤ) : ℝ)) → + (∀ z ∈ Fintype.piFinset (fun i => Finset.Ico (sourceLo i) (sourceHi i)), ∀ i, + |(z i : ℝ) - (origin i : ℝ)| ≤ smoothPairCoefficientScale (H i.2) L i.1 / 2) → + (∀ j i, |(sourceLo (some j,i) : ℝ)| ≤ B * H i / L) → + (∀ j i, |(sourceHi (some j,i) : ℝ)| ≤ B * H i / L) → + scalarInitialThreshold E (Fintype.card (Option J × I)) (Fintype.card I) + (Fintype.card J) epsilon p P0 ≤ budget → + Real.exp budget ≤ L → (∀ i, Real.exp budget * L ^ (Fintype.card J + 1) ≤ H i) → + let outer := selectedJointReference (trimmedIntegerBox N margin) + (trimmedIntegerBox_nonempty N margin hmargin) (fun _ : I => 1) {0} width hwidth hZ + ∀ productive : (trimmedIntegerBox N margin × rectangularWeightIndices 0 width 1) → Prop, + (Fintype.card κ : ℝ) * Real.exp (-p) < outer.eventProbability productive → + (∀ z, productive z → ∃ r, Real.exp (-p) < + rectangularScalarDiscrepancy lo N h g.eval epsilon level + (D r) (anchor r) (parLo r) (parHi r) (hpar r) + (fun i => jointIntegerFrame (z.1.val,z.2.val) i.1 i.2)) → + ∃ (cellLo : I → ℤ) (cellN : I → ℕ) (M : ℕ) (a : I → ℤ), + 0 < M ∧ PhysicalSubbox lo N cellLo cellN ∧ + ResidueSliceLogCostLE N cellLo cellN M a budget ∧ + Nonempty (IntegerResidueBox cellLo (fun i => cellLo i + cellN i) (fun _ => (M : ℤ)) a) ∧ + (∀ i, 0 < residueIndexLength (cellLo i) (cellLo i + cellN i) M (a i)) ∧ + Real.exp (-budget) < (physicalResidueMean h cellLo cellN M a).re - + level * (physicalResidueMean g.eval cellLo cellN M a).re := by + obtain ⟨E, hE, htransfer⟩ := exists_unconditioned_trimmed_threshold_transfer.{u,v} s + refine ⟨E, hE, ?_⟩ + intro I V J _ _ _ _ _ _ _ _ d0 nilmanifold p epsilon P0 level budget + hp hepsilon hepsilon1 hP0 htarget hepsInv hlower hlevel hnP hJ hJlog hprofile g hcomplexity + κ _ k0 D anchor parLo parHi hpar hD hDlog + L C B A K c Cwidth hC hB hA hK hc hCwidth + hClog hBlog hAlog hKlog hcinv hWidthlog lo N H hupper hratio hunit h hh + R parMin hparMin hparSide hparWidth hwidthRatio hrelative hleft hright + width hwidth hZ margin hmargin hloss hroot hscale hpDim sourceLo sourceHi origin + hwinScale hW hsourceLo hsourceHi hbudget hLexp hHexp + outer productive hmass hproductive + obtain ⟨r, cellLo, cellN, M, a, hM, hcell, hcost, hne, hlen, hscore⟩ := + exists_residue_slice_of_rectangular_scalar_family outer + (fun z i => jointIntegerFrame (z.1.val,z.2.val) i.1 i.2) lo N + (fun _ : κ => h) (fun _ : κ => g.eval) + (fun _ => epsilon) (fun _ => level) (fun _ => budget) + D anchor parLo parHi hpar p (fun r hnoincrement => by + exact htransfer nilmanifold p epsilon P0 level budget + hp hepsilon hepsilon1 hP0 htarget hepsInv hlower hlevel hnP hJ hJlog hprofile + g hcomplexity k0 (D r) (anchor r) (parLo r) (parHi r) (hpar r) (hD r) (hDlog r) + L C B A K c Cwidth hC hB hA hK hc hCwidth + hClog hBlog hAlog hKlog hcinv hWidthlog lo N H hupper hratio hunit h hh hnoincrement + (R r) (parMin r) (hparMin r) (hparSide r) (hparWidth r) (hwidthRatio r) + (hrelative r) (hleft r) (hright r) + width hwidth hZ margin hmargin hloss hroot hscale hpDim + origin hwinScale hW hsourceLo hsourceHi hbudget hLexp hHexp) + productive hmass hproductive + exact ⟨cellLo, cellN, M, a, hM, hcell, hcost, hne, hlen, hscore⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformCommutingCircleDecomposition.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformCommutingCircleDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..98b6b9e2c3981290bcf58dffd13030ded4f89e93 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformCommutingCircleDecomposition.lean @@ -0,0 +1,604 @@ +import OAI.Combinatorics.Progressions.Fourier.TorusCircleActions + +namespace OAI + +section + +namespace Erdos3.CircleFourier + +open scoped NNReal + +variable {X α : Type*} [PseudoMetricSpace X] + +noncomputable def iteratedCircleSmooth (N : ℕ) (A : α → IsometricCircleAction X) : + List α → (X → ℂ) → X → ℂ + | [], f => f + | i :: is, f => (A i).smooth N (iteratedCircleSmooth N A is f) + +theorem iteratedCircleSmooth_lipschitz {N : ℕ} (hN : 0 < N) + (A : α → IsometricCircleAction X) (is : List α) {f : X → ℂ} {L : ℝ≥0} + (hf : LipschitzWith L f) : LipschitzWith L (iteratedCircleSmooth N A is f) := by + induction is with + | nil => exact hf + | cons i is ih => exact (A i).smooth_lipschitz hN ih + +theorem iteratedCircleSmooth_norm_le {N : ℕ} (hN : 0 < N) + (A : α → IsometricCircleAction X) (is : List α) {f : X → ℂ} {L : ℝ≥0} {B : ℝ} + (hf : LipschitzWith L f) (hb : ∀ x, ‖f x‖ ≤ B) : + ∀ x, ‖iteratedCircleSmooth N A is f x‖ ≤ B := by + induction is with + | nil => exact hb + | cons i is ih => exact (A i).smooth_norm_le hN (iteratedCircleSmooth_lipschitz hN A is hf).continuous ih + +theorem iteratedCircleSmooth_error {N : ℕ} (hN : 0 < N) + (A : α → IsometricCircleAction X) (is : List α) {f : X → ℂ} {L : ℝ≥0} {ε : ℝ} + (hf : LipschitzWith L f) + (hstep : ∀ i ∈ is, ∀ g : X → ℂ, LipschitzWith L g → ∀ x, + ‖(A i).smooth N g x - g x‖ ≤ ε) (x : X) : + ‖iteratedCircleSmooth N A is f x - f x‖ ≤ is.length * ε := by + induction is with + | nil => simp [iteratedCircleSmooth] + | cons i is ih => + have ht := ih (fun j hj => hstep j (List.mem_cons_of_mem i hj)) + have hs := hstep i (List.mem_cons_self) (iteratedCircleSmooth N A is f) + (iteratedCircleSmooth_lipschitz hN A is hf) x + change ‖(A i).smooth N (iteratedCircleSmooth N A is f) x - f x‖ ≤ _ + calc + _ ≤ ‖(A i).smooth N (iteratedCircleSmooth N A is f) x - iteratedCircleSmooth N A is f x‖ + + ‖iteratedCircleSmooth N A is f x - f x‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ ε + is.length * ε := add_le_add hs ht + _ = (i :: is).length * ε := by simp only [List.length_cons, Nat.cast_add, Nat.cast_one]; ring + +theorem iteratedCircleSmooth_orbit_error {N : ℕ} (hN : 0 < N) + (A : α → IsometricCircleAction X) (is : List α) {f : X → ℂ} {L D : ℝ≥0} + (hf : LipschitzWith L f) {η : ℝ} (hη : 0 < η) + (horbit : ∀ i ∈ is, ∀ (t : Circle) x, dist ((A i).act t x) x ≤ D * ‖t‖) (x : X) : + ‖iteratedCircleSmooth N A is f x - f x‖ ≤ + is.length * ((L : ℝ) * D * (η + 1 / (8 * N * η ^ 2))) := by + apply iteratedCircleSmooth_error hN A is hf + intro i hi g hg y + apply (A i).smooth_error hN hg.continuous (mul_nonneg L.coe_nonneg D.coe_nonneg) hη + intro t z + rw [← dist_eq_norm] + calc + dist (g ((A i).act t z)) (g z) ≤ L * dist ((A i).act t z) z := hg.dist_le_mul _ _ + _ ≤ L * (D * ‖t‖) := mul_le_mul_of_nonneg_left (horbit i hi t z) L.coe_nonneg + _ = (L : ℝ) * D * ‖t‖ := by ring + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier + +open scoped NNReal + +variable {X α : Type*} [PseudoMetricSpace X] + +noncomputable def iteratedCircleComponent (N : ℕ) (A : α → IsometricCircleAction X) : + (is : List α) → (Fin is.length → ℤ) → (X → ℂ) → X → ℂ + | [], _, f => f + | i :: is, k, f => (A i).component N (k 0) + (iteratedCircleComponent N A is (fun j => k j.succ) f) + +theorem iteratedCircleComponent_lipschitz {N : ℕ} (hN : 0 < N) + (A : α → IsometricCircleAction X) (is : List α) (k : Fin is.length → ℤ) + {f : X → ℂ} {L : ℝ≥0} (hf : LipschitzWith L f) : + LipschitzWith L (iteratedCircleComponent N A is k f) := by + induction is with + | nil => exact hf + | cons i is ih => exact (A i).component_lipschitz hN (k 0) (ih (fun j => k j.succ)) + +theorem iteratedCircleComponent_norm_le {N : ℕ} (hN : 0 < N) + (A : α → IsometricCircleAction X) (is : List α) (k : Fin is.length → ℤ) + {f : X → ℂ} {B : ℝ≥0} (hf : ∀ x, ‖f x‖ ≤ B) : + ∀ x, ‖iteratedCircleComponent N A is k f x‖ ≤ B := by + induction is with + | nil => exact hf + | cons i is ih => exact (A i).component_norm_le hN (k 0) (ih (fun j => k j.succ)) + +theorem iteratedCircleComponent_character (N : ℕ) + (A : α → IsometricCircleAction X) (is : List α) (k : Fin is.length → ℤ) + (hcomm : ∀ i ∈ is, ∀ j ∈ is, (A i).Commutes (A j)) (f : X → ℂ) + (j : Fin is.length) : ∀ (t : Circle) x, + iteratedCircleComponent N A is k f ((A (is.get j)).act t x) = + character ((-k j) • t) * iteratedCircleComponent N A is k f x := by + induction is with + | nil => exact Fin.elim0 j + | cons i is ih => + have ht : ∀ a ∈ is, ∀ b ∈ is, (A a).Commutes (A b) := + fun a ha b hb => hcomm a (List.mem_cons_of_mem i ha) b (List.mem_cons_of_mem i hb) + refine Fin.cases ?_ (fun q => ?_) j + · exact (A i).component_character N (k 0) (iteratedCircleComponent N A is (fun q => k q.succ) f) + · have hm : is.get q ∈ is := List.get_mem is q + exact (A i).component_preserves_character (A (is.get q)) + (hcomm i (List.mem_cons_self) (is.get q) (List.mem_cons_of_mem i hm)) + N (k 0) (-(k q.succ)) (ih (fun r => k r.succ) ht q) + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier + +open scoped BigOperators NNReal + +abbrev FejerChoice (N : ℕ) := ↥(fejerFrequencies N) + +theorem sum_fin_tuple_cons {β : Type*} [Fintype β] (n : ℕ) (f : (Fin (n + 1) → β) → ℂ) : + ∑ k, f k = ∑ b : β, ∑ k : Fin n → β, f (Fin.cons b k) := by + rw [← (Fin.consEquiv (fun _ : Fin (n + 1) => β)).sum_comp f] + exact Fintype.sum_prod_type _ + +variable {X α : Type*} [PseudoMetricSpace X] + +theorem iteratedCircleSmooth_eq_sum {N : ℕ} (hN : 0 < N) + (A : α → IsometricCircleAction X) (is : List α) {f : X → ℂ} {L : ℝ≥0} + (hf : LipschitzWith L f) (x : X) : + iteratedCircleSmooth N A is f x = + ∑ k : Fin is.length → FejerChoice N, + iteratedCircleComponent N A is (fun j => (k j : ℤ)) f x := by + classical + induction is generalizing x with + | nil => simp [iteratedCircleSmooth, iteratedCircleComponent] + | cons i is ih => + have ht : iteratedCircleSmooth N A is f = fun y => + ∑ k : Fin is.length → FejerChoice N, + iteratedCircleComponent N A is (fun j => (k j : ℤ)) f y := funext ih + change (A i).smooth N (iteratedCircleSmooth N A is f) x = _ + rw [ht, (A i).smooth_eq_sum] + apply Eq.trans ?_ (sum_fin_tuple_cons is.length (fun k : Fin (is.length + 1) → FejerChoice N => + iteratedCircleComponent N A (i :: is) (fun j => (k j : ℤ)) f x)).symm + rw [← Finset.sum_coe_sort] + apply Finset.sum_congr rfl + intro b _ + rw [(A i).component_sum N (b : ℤ) Finset.univ + (fun k : Fin is.length → FejerChoice N => + iteratedCircleComponent N A is (fun j => (k j : ℤ)) f) + (fun k _ => (iteratedCircleComponent_lipschitz hN A is (fun j => (k j : ℤ)) hf).continuous) x] + apply Finset.sum_congr rfl + intro k _ + rfl + +theorem card_fejerChoices (N d : ℕ) : + Fintype.card (Fin d → FejerChoice N) ≤ N ^ (2 * d) := by + rw [Fintype.card_fun, Fintype.card_fin, Fintype.card_coe] + apply (Nat.pow_le_pow_left (card_fejerFrequencies_le N) d).trans_eq + rw [pow_mul] + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier +open MeasureTheory +open scoped NNReal + +variable {X α : Type*} [PseudoMetricSpace X] + +namespace IsometricCircleAction + +theorem component_sub (A : IsometricCircleAction X) (N : ℕ) (h : ℤ) + {f g : X → ℂ} (hf : Continuous f) (hg : Continuous g) (x : X) : + A.component N h (fun y => f y - g y) x = + A.component N h f x - A.component N h g x := by + let := A.toAddAction + let := A.toContinuousVAdd + change (fejerCoefficient N h : ℂ) * + (∫ t : Circle, character ((-(-h)) • t) * (f (t +ᵥ x) - g (t +ᵥ x)) ∂circleHaar) = _ + simp_rw [mul_sub] + rw [integral_sub (integrable_circleFourierComponent (-h) hf x) + (integrable_circleFourierComponent (-h) hg x)] + exact mul_sub _ _ _ + +theorem component_norm_sub_le (A : IsometricCircleAction X) {N : ℕ} (hN : 0 < N) + (h : ℤ) {f g : X → ℂ} (hf : Continuous f) (hg : Continuous g) {ε : ℝ} + (hfg : ∀ x, ‖f x - g x‖ ≤ ε) (x : X) : + ‖A.component N h f x - A.component N h g x‖ ≤ ε := by + rw [← A.component_sub N h hf hg x] + let := A.toAddAction + change ‖(fejerCoefficient N h : ℂ) * + circleFourierComponent (-h) (fun y => f y - g y) x‖ ≤ ε + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (fejerCoefficient_nonneg N h)] + exact (mul_le_mul (fejerCoefficient_le_one hN h) + (norm_circleFourierComponent_le (-h) _ hfg x) (norm_nonneg _) zero_le_one).trans_eq + (one_mul _) + +end IsometricCircleAction + +theorem iteratedCircleComponent_norm_sub_le {N : ℕ} (hN : 0 < N) + (A : α → IsometricCircleAction X) (is : List α) (k : Fin is.length → ℤ) + {f g : X → ℂ} {K H : ℝ≥0} (hf : LipschitzWith K f) (hg : LipschitzWith H g) + {ε : ℝ} (hfg : ∀ x, ‖f x - g x‖ ≤ ε) (x : X) : + ‖iteratedCircleComponent N A is k f x - iteratedCircleComponent N A is k g x‖ ≤ ε := by + induction is generalizing x with + | nil => exact hfg x + | cons i is ih => + apply (A i).component_norm_sub_le hN (k 0) + (iteratedCircleComponent_lipschitz hN A is (fun j => k j.succ) hf).continuous + (iteratedCircleComponent_lipschitz hN A is (fun j => k j.succ) hg).continuous + intro y + exact ih (fun j => k j.succ) y + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier + +open scoped BigOperators NNReal + +variable {X α : Type*} [PseudoMetricSpace X] + +theorem iteratedCircleComponent_equivariant (N : ℕ) (A : α → IsometricCircleAction X) + (is : List α) (k : Fin is.length → ℤ) (g : X → X) (z : ℂ) + (hg : ∀ i ∈ is, ∀ t x, (A i).act t (g x) = g ((A i).act t x)) + {f : X → ℂ} (hf : ∀ x, f (g x) = z * f x) : + ∀ x, iteratedCircleComponent N A is k f (g x) = z * iteratedCircleComponent N A is k f x := by + induction is with + | nil => exact hf + | cons i is ih => + exact (A i).component_equivariant N (k 0) g z (hg i List.mem_cons_self) + (ih (fun j => k j.succ) (fun a ha => hg a (List.mem_cons_of_mem i ha))) + +theorem exists_controlled_finite_circle_decomposition + (A : α → IsometricCircleAction X) (is : List α) + (hcomm : ∀ i ∈ is, ∀ j ∈ is, (A i).Commutes (A j)) + (f : X → ℂ) (L B D : ℝ≥0) (hf : LipschitzWith L f) (hb : ∀ x, ‖f x‖ ≤ B) + (horbit : ∀ i ∈ is, ∀ (t : Circle) x, dist ((A i).act t x) x ≤ D * ‖t‖) + (δ p : ℝ) (hδ : 0 < δ) (hp : 0 ≤ p) (hd : (is.length : ℝ) ≤ p) + (hLp : (L : ℝ) ≤ Real.exp p) (hDp : (D : ℝ) ≤ Real.exp p) (hδp : δ⁻¹ ≤ Real.exp p) : + ∃ N : ℕ, 0 < N ∧ (N : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4) ∧ + (Fintype.card (Fin is.length → FejerChoice N) : ℝ) ≤ Real.exp (2 * p * (2 * p + 2) ^ 4) ∧ + (∀ k : Fin is.length → FejerChoice N, + (∀ j, (|(k j : ℤ)| : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4)) ∧ + LipschitzWith L (iteratedCircleComponent N A is (fun j => (k j : ℤ)) f) ∧ + (∀ x, ‖iteratedCircleComponent N A is (fun j => (k j : ℤ)) f x‖ ≤ B) ∧ + ∀ (j : Fin is.length) (t : Circle) x, + iteratedCircleComponent N A is (fun r => (k r : ℤ)) f ((A (is.get j)).act t x) = + character ((-(k j : ℤ)) • t) * + iteratedCircleComponent N A is (fun r => (k r : ℤ)) f x) ∧ + ∀ x, ‖(∑ k : Fin is.length → FejerChoice N, + iteratedCircleComponent N A is (fun j => (k j : ℤ)) f x) - f x‖ ≤ δ := by + let O : ℝ := (L : ℝ) * D + have hO : 0 ≤ O := mul_nonneg L.coe_nonneg D.coe_nonneg + let ε := δ / (is.length + 1) + have hε : 0 < ε := by dsimp [ε]; positivity + have hOp : O ≤ Real.exp (2 * p) := by + calc + O ≤ Real.exp p * Real.exp p := mul_le_mul hLp hDp D.coe_nonneg (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hεp : ε⁻¹ ≤ Real.exp (2 * p) := by + have hlen : (is.length : ℝ) + 1 ≤ Real.exp p := + (by linarith : (is.length : ℝ) + 1 ≤ p + 1).trans (Real.add_one_le_exp p) + calc + ε⁻¹ = ((is.length : ℝ) + 1) * δ⁻¹ := by dsimp [ε]; rw [inv_div, div_eq_mul_inv] + _ ≤ Real.exp p * Real.exp p := mul_le_mul hlen hδp (inv_nonneg.mpr hδ.le) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + obtain ⟨N, hN, hcut, hNb⟩ := exists_fejer_cutoff hO hε + have hNe : (N : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4) := + hNb.trans (fejer_cutoff_bound (by linarith : 0 ≤ 2 * p) hO hε hOp hεp) + refine ⟨N, hN, hNe, ?_, ?_, ?_⟩ + · apply (Nat.cast_le.mpr (card_fejerChoices N is.length)).trans + rw [Nat.cast_pow] + apply (pow_le_pow_left₀ (Nat.cast_nonneg N) hNe _).trans + rw [← Real.exp_nat_mul, Nat.cast_mul, Nat.cast_ofNat] + exact Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hd (by norm_num)) (by positivity)) + · intro k + refine ⟨?_, iteratedCircleComponent_lipschitz hN A is _ hf, + iteratedCircleComponent_norm_le hN A is _ hb, ?_⟩ + · intro j + have hk : (|(k j : ℤ)| : ℝ) < N := by + exact_mod_cast abs_lt_of_mem_fejerFrequencies (k j).property + exact hk.le.trans hNe + · exact fun j => iteratedCircleComponent_character N A is _ hcomm f j + · intro x + rw [← iteratedCircleSmooth_eq_sum hN A is hf x] + have hstep : ∀ i ∈ is, ∀ g : X → ℂ, LipschitzWith L g → ∀ y, + ‖(A i).smooth N g y - g y‖ ≤ ε := by + intro i hi g hg y + have hη : 0 < ε / (2 * (O + 1)) := by positivity + apply ((A i).smooth_error hN hg.continuous hO hη ?_ y).trans + (fejer_error_le_of_cutoff hO hε hN hcut) + intro t z + rw [← dist_eq_norm] + exact (hg.dist_le_mul _ _).trans ((mul_le_mul_of_nonneg_left (horbit i hi t z) L.coe_nonneg).trans_eq + (by dsimp [O]; ring)) + apply (iteratedCircleSmooth_error hN A is hf hstep x).trans + change (is.length : ℝ) * (δ / (is.length + 1)) ≤ δ + rw [← mul_div_assoc, div_le_iff₀ (by positivity)] + nlinarith + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier + +open scoped BigOperators NNReal + +variable {X ι : Type*} [PseudoMetricSpace X] [Fintype ι] + +theorem exists_controlled_commuting_circle_decomposition + (A : ι → IsometricCircleAction X) (hcomm : ∀ i j, (A i).Commutes (A j)) + (f : X → ℂ) (L B D : ℝ≥0) (hf : LipschitzWith L f) (hb : ∀ x, ‖f x‖ ≤ B) + (horbit : ∀ i (t : Circle) x, dist ((A i).act t x) x ≤ D * ‖t‖) + (δ p : ℝ) (hδ : 0 < δ) (hp : 0 ≤ p) (hd : (Fintype.card ι : ℝ) ≤ p) + (hLp : (L : ℝ) ≤ Real.exp p) (hDp : (D : ℝ) ≤ Real.exp p) (hδp : δ⁻¹ ≤ Real.exp p) : + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (ν : J → ι → ℤ) (v : J → X → ℂ), + (Fintype.card J : ℝ) ≤ Real.exp (2 * p * (2 * p + 2) ^ 4) ∧ + (∀ j i, (|ν j i| : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4)) ∧ + (∀ j, LipschitzWith L (v j) ∧ (∀ x, ‖v j x‖ ≤ B)) ∧ + (∀ j i (t : Circle) x, v j ((A i).act t x) = character (ν j i • t) * v j x) ∧ + (∀ (g : X → X) (z : ℂ), + (∀ i t x, (A i).act t (g x) = g ((A i).act t x)) → + (∀ x, f (g x) = z * f x) → ∀ j x, v j (g x) = z * v j x) ∧ + ∀ x, ‖(∑ j, v j x) - f x‖ ≤ δ := by + classical + let is := (Finset.univ : Finset ι).toList + have hd' : (is.length : ℝ) ≤ p := by simpa [is] using hd + obtain ⟨N, _, _, hcard, hprops, herr⟩ := exists_controlled_finite_circle_decomposition A is + (fun i _ j _ => hcomm i j) f L B D hf hb (fun i _ => horbit i) + δ p hδ hp hd' hLp hDp hδp + have hcover : ∀ i : ι, ∃ r : Fin is.length, is.get r = i := by + intro i + apply List.mem_iff_get.mp + simp [is] + choose index hindex using hcover + let J := Fin is.length → FejerChoice N + let ν : J → ι → ℤ := fun k i => -(k (index i) : ℤ) + let v : J → X → ℂ := fun k => iteratedCircleComponent N A is (fun r => (k r : ℤ)) f + refine ⟨J, inferInstance, ν, v, hcard, ?_, ?_, ?_, ?_, herr⟩ + · intro k i + simpa only [ν, Int.cast_neg, abs_neg] using (hprops k).1 (index i) + · intro k + exact ⟨(hprops k).2.1, (hprops k).2.2.1⟩ + · intro k i t x + have hi := (hprops k).2.2.2 (index i) t x + rw [hindex i] at hi + exact hi + · intro g z hg hf k x + exact iteratedCircleComponent_equivariant N A is (fun r => (k r : ℤ)) + g z (fun i _ => hg i) hf x + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier + +open scoped BigOperators NNReal + +variable {X ι : Type*} [PseudoMetricSpace X] [Fintype ι] + +theorem exists_uniform_controlled_commuting_circle_operators + (A : ι → IsometricCircleAction X) (hcomm : ∀ i j, (A i).Commutes (A j)) + (D : ℝ≥0) + (horbit : ∀ i (t : Circle) x, dist ((A i).act t x) x ≤ D * ‖t‖) + (δ p : ℝ) (hδ : 0 < δ) (hp : 0 ≤ p) (hd : (Fintype.card ι : ℝ) ≤ p) + (hDp : (D : ℝ) ≤ Real.exp p) (hδp : δ⁻¹ ≤ Real.exp p) : + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (ν : J → ι → ℤ) (V : J → (X → ℂ) → X → ℂ), + (Fintype.card J : ℝ) ≤ Real.exp (2 * p * (2 * p + 2) ^ 4) ∧ + (∀ j i, (|ν j i| : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4)) ∧ + (∀ j (f g : X → ℂ) (K H : ℝ≥0), LipschitzWith K f → LipschitzWith H g → + ∀ ε : ℝ, (∀ x, ‖f x - g x‖ ≤ ε) → ∀ x, ‖V j f x - V j g x‖ ≤ ε) ∧ + ∀ (f : X → ℂ) (L B : ℝ≥0), LipschitzWith L f → (∀ x, ‖f x‖ ≤ B) → + (L : ℝ) ≤ Real.exp p → + (∀ j, LipschitzWith L (V j f) ∧ (∀ x, ‖V j f x‖ ≤ B)) ∧ + (∀ j i (t : Circle) x, V j f ((A i).act t x) = character (ν j i • t) * V j f x) ∧ + (∀ (g : X → X) (z : ℂ), + (∀ i t x, (A i).act t (g x) = g ((A i).act t x)) → + (∀ x, f (g x) = z * f x) → ∀ j x, V j f (g x) = z * V j f x) ∧ + ∀ x, ‖(∑ j, V j f x) - f x‖ ≤ δ := by + classical + let is := (Finset.univ : Finset ι).toList + have hd' : (is.length : ℝ) ≤ p := by simpa [is] using hd + let O : ℝ := Real.exp p * D + have hO : 0 ≤ O := mul_nonneg (Real.exp_nonneg _) D.coe_nonneg + let ε := δ / (is.length + 1) + have hε : 0 < ε := by dsimp [ε]; positivity + have hOp : O ≤ Real.exp (2 * p) := by + calc + O ≤ Real.exp p * Real.exp p := mul_le_mul_of_nonneg_left hDp (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hεp : ε⁻¹ ≤ Real.exp (2 * p) := by + have hlen : (is.length : ℝ) + 1 ≤ Real.exp p := + (by linarith : (is.length : ℝ) + 1 ≤ p + 1).trans (Real.add_one_le_exp p) + calc + ε⁻¹ = ((is.length : ℝ) + 1) * δ⁻¹ := by dsimp [ε]; rw [inv_div, div_eq_mul_inv] + _ ≤ Real.exp p * Real.exp p := + mul_le_mul hlen hδp (inv_nonneg.mpr hδ.le) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + obtain ⟨N, hN, hcut, hNb⟩ := exists_fejer_cutoff hO hε + have hNe : (N : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4) := + hNb.trans (fejer_cutoff_bound (by linarith : 0 ≤ 2 * p) hO hε hOp hεp) + have hcard : (Fintype.card (Fin is.length → FejerChoice N) : ℝ) ≤ + Real.exp (2 * p * (2 * p + 2) ^ 4) := by + apply (Nat.cast_le.mpr (card_fejerChoices N is.length)).trans + rw [Nat.cast_pow] + apply (pow_le_pow_left₀ (Nat.cast_nonneg N) hNe _).trans + rw [← Real.exp_nat_mul, Nat.cast_mul, Nat.cast_ofNat] + exact Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hd' (by norm_num)) (by positivity)) + have hcover : ∀ i : ι, ∃ r : Fin is.length, is.get r = i := by + intro i + apply List.mem_iff_get.mp + simp [is] + choose index hindex using hcover + let J := Fin is.length → FejerChoice N + let ν : J → ι → ℤ := fun k i => -(k (index i) : ℤ) + let V : J → (X → ℂ) → X → ℂ := fun k f => + iteratedCircleComponent N A is (fun r => (k r : ℤ)) f + refine ⟨J, inferInstance, ν, V, hcard, ?_, ?_, ?_⟩ + · intro k i + have hk : (|(k (index i) : ℤ)| : ℝ) < N := by + exact_mod_cast abs_lt_of_mem_fejerFrequencies (k (index i)).property + simpa only [ν, Int.cast_neg, abs_neg] using hk.le.trans hNe + · intro k f g K H hf hg ε hfg x + exact iteratedCircleComponent_norm_sub_le hN A is (fun r => (k r : ℤ)) hf hg hfg x + · intro f L B hf hb hLp + refine ⟨?_, ?_, ?_, ?_⟩ + · intro k + exact ⟨iteratedCircleComponent_lipschitz hN A is _ hf, + iteratedCircleComponent_norm_le hN A is _ hb⟩ + · intro k i t x + have hi := iteratedCircleComponent_character N A is (fun r => (k r : ℤ)) + (fun a _ b _ => hcomm a b) f (index i) t x + rw [hindex i] at hi + exact hi + · intro g z hg hfz k x + exact iteratedCircleComponent_equivariant N A is (fun r => (k r : ℤ)) + g z (fun i _ => hg i) hfz x + · intro x + change ‖(∑ k : Fin is.length → FejerChoice N, + iteratedCircleComponent N A is (fun r => (k r : ℤ)) f x) - f x‖ ≤ δ + rw [← iteratedCircleSmooth_eq_sum hN A is hf x] + have hstep : ∀ i ∈ is, ∀ g : X → ℂ, LipschitzWith L g → ∀ y, + ‖(A i).smooth N g y - g y‖ ≤ ε := by + intro i _ g hg y + have hη : 0 < ε / (2 * (O + 1)) := by positivity + apply ((A i).smooth_error hN hg.continuous hO hη ?_ y).trans + (fejer_error_le_of_cutoff hO hε hN hcut) + intro t z + rw [← dist_eq_norm] + calc + dist (g ((A i).act t z)) (g z) ≤ L * dist ((A i).act t z) z := hg.dist_le_mul _ _ + _ ≤ L * (D * ‖t‖) := mul_le_mul_of_nonneg_left (horbit i t z) L.coe_nonneg + _ ≤ Real.exp p * (D * ‖t‖) := + mul_le_mul_of_nonneg_right hLp (mul_nonneg D.coe_nonneg (norm_nonneg _)) + _ = O * ‖t‖ := by dsimp [O]; ring + apply (iteratedCircleSmooth_error hN A is hf hstep x).trans + change (is.length : ℝ) * (δ / (is.length + 1)) ≤ δ + rw [← mul_div_assoc, div_le_iff₀ (by positivity)] + nlinarith + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier + +open scoped BigOperators NNReal + +variable {X ι : Type*} [PseudoMetricSpace X] [Fintype ι] + +theorem exists_uniform_controlled_commuting_circle_decomposition + (A : ι → IsometricCircleAction X) (hcomm : ∀ i j, (A i).Commutes (A j)) + (D : ℝ≥0) + (horbit : ∀ i (t : Circle) x, dist ((A i).act t x) x ≤ D * ‖t‖) + (δ p : ℝ) (hδ : 0 < δ) (hp : 0 ≤ p) (hd : (Fintype.card ι : ℝ) ≤ p) + (hDp : (D : ℝ) ≤ Real.exp p) (hδp : δ⁻¹ ≤ Real.exp p) : + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ ν : J → ι → ℤ, + (Fintype.card J : ℝ) ≤ Real.exp (2 * p * (2 * p + 2) ^ 4) ∧ + (∀ j i, (|ν j i| : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4)) ∧ + ∀ (f : X → ℂ) (L B : ℝ≥0), LipschitzWith L f → (∀ x, ‖f x‖ ≤ B) → + (L : ℝ) ≤ Real.exp p → ∃ v : J → X → ℂ, + (∀ j, LipschitzWith L (v j) ∧ (∀ x, ‖v j x‖ ≤ B)) ∧ + (∀ j i (t : Circle) x, v j ((A i).act t x) = character (ν j i • t) * v j x) ∧ + (∀ (g : X → X) (z : ℂ), + (∀ i t x, (A i).act t (g x) = g ((A i).act t x)) → + (∀ x, f (g x) = z * f x) → ∀ j x, v j (g x) = z * v j x) ∧ + ∀ x, ‖(∑ j, v j x) - f x‖ ≤ δ := by + classical + let is := (Finset.univ : Finset ι).toList + have hd' : (is.length : ℝ) ≤ p := by simpa [is] using hd + let O : ℝ := Real.exp p * D + have hO : 0 ≤ O := mul_nonneg (Real.exp_nonneg _) D.coe_nonneg + let ε := δ / (is.length + 1) + have hε : 0 < ε := by dsimp [ε]; positivity + have hOp : O ≤ Real.exp (2 * p) := by + calc + O ≤ Real.exp p * Real.exp p := mul_le_mul_of_nonneg_left hDp (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hεp : ε⁻¹ ≤ Real.exp (2 * p) := by + have hlen : (is.length : ℝ) + 1 ≤ Real.exp p := + (by linarith : (is.length : ℝ) + 1 ≤ p + 1).trans (Real.add_one_le_exp p) + calc + ε⁻¹ = ((is.length : ℝ) + 1) * δ⁻¹ := by dsimp [ε]; rw [inv_div, div_eq_mul_inv] + _ ≤ Real.exp p * Real.exp p := + mul_le_mul hlen hδp (inv_nonneg.mpr hδ.le) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + obtain ⟨N, hN, hcut, hNb⟩ := exists_fejer_cutoff hO hε + have hNe : (N : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4) := + hNb.trans (fejer_cutoff_bound (by linarith : 0 ≤ 2 * p) hO hε hOp hεp) + have hcard : (Fintype.card (Fin is.length → FejerChoice N) : ℝ) ≤ + Real.exp (2 * p * (2 * p + 2) ^ 4) := by + apply (Nat.cast_le.mpr (card_fejerChoices N is.length)).trans + rw [Nat.cast_pow] + apply (pow_le_pow_left₀ (Nat.cast_nonneg N) hNe _).trans + rw [← Real.exp_nat_mul, Nat.cast_mul, Nat.cast_ofNat] + exact Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hd' (by norm_num)) (by positivity)) + have hcover : ∀ i : ι, ∃ r : Fin is.length, is.get r = i := by + intro i + apply List.mem_iff_get.mp + simp [is] + choose index hindex using hcover + let J := Fin is.length → FejerChoice N + let ν : J → ι → ℤ := fun k i => -(k (index i) : ℤ) + refine ⟨J, inferInstance, ν, hcard, ?_, ?_⟩ + · intro k i + have hk : (|(k (index i) : ℤ)| : ℝ) < N := by + exact_mod_cast abs_lt_of_mem_fejerFrequencies (k (index i)).property + simpa only [ν, Int.cast_neg, abs_neg] using hk.le.trans hNe + · intro f L B hf hb hLp + let v : J → X → ℂ := fun k => iteratedCircleComponent N A is (fun r => (k r : ℤ)) f + refine ⟨v, ?_, ?_, ?_, ?_⟩ + · intro k + exact ⟨iteratedCircleComponent_lipschitz hN A is _ hf, + iteratedCircleComponent_norm_le hN A is _ hb⟩ + · intro k i t x + have hi := iteratedCircleComponent_character N A is (fun r => (k r : ℤ)) + (fun a _ b _ => hcomm a b) f (index i) t x + rw [hindex i] at hi + exact hi + · intro g z hg hfz k x + exact iteratedCircleComponent_equivariant N A is (fun r => (k r : ℤ)) + g z (fun i _ => hg i) hfz x + · intro x + change ‖(∑ k : Fin is.length → FejerChoice N, + iteratedCircleComponent N A is (fun r => (k r : ℤ)) f x) - f x‖ ≤ δ + rw [← iteratedCircleSmooth_eq_sum hN A is hf x] + have hstep : ∀ i ∈ is, ∀ g : X → ℂ, LipschitzWith L g → ∀ y, + ‖(A i).smooth N g y - g y‖ ≤ ε := by + intro i _ g hg y + have hη : 0 < ε / (2 * (O + 1)) := by positivity + apply ((A i).smooth_error hN hg.continuous hO hη ?_ y).trans + (fejer_error_le_of_cutoff hO hε hN hcut) + intro t z + rw [← dist_eq_norm] + calc + dist (g ((A i).act t z)) (g z) ≤ L * dist ((A i).act t z) z := hg.dist_le_mul _ _ + _ ≤ L * (D * ‖t‖) := mul_le_mul_of_nonneg_left (horbit i t z) L.coe_nonneg + _ ≤ Real.exp p * (D * ‖t‖) := + mul_le_mul_of_nonneg_right hLp (mul_nonneg D.coe_nonneg (norm_nonneg _)) + _ = O * ‖t‖ := by dsimp [O]; ring + apply (iteratedCircleSmooth_error hN A is hf hstep x).trans + change (is.length : ℝ) * (δ / (is.length + 1)) ≤ δ + rw [← mul_div_assoc, div_le_iff₀ (by positivity)] + nlinarith + +end Erdos3.CircleFourier + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformControlledCurrentStage.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformControlledCurrentStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..29c7ad36d96509228e04bc1d9a2387353f345bac --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformControlledCurrentStage.lean @@ -0,0 +1,370 @@ +import OAI.Combinatorics.Progressions.Estimates.UniformFormalCurrentLayerStep +import OAI.Combinatorics.Progressions.Polynomial.FormalPolynomialOperationBounds + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_formal_derivative_removal_control (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (_hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})), + BasisHomogeneousBrackets b ω → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → + (∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) → + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + ∀ (T : σ → ℝ), (∀ i, 0 < T i) → + ∀ A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot, + A.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) → + B.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) → + CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + 2) ^ a)) A.coord → + CoefficientGrid (b.baseChange ℝ) l B.coord → + ∀ {κ : Type*} (S R : κ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (small rational : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)), + (∀ k, S k ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) 1) → + (∀ k, R k ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) 1) → + (∀ i, small i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) 1) → + (∀ i, rational i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) 1) → + (∀ k, CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + 2) ^ a)) (S k)) → + (∀ k, CoefficientGrid (b.baseChange ℝ) l (R k)) → + (∀ i, CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + 2) ^ a) / T i) (small i)) → + (∀ i, CoefficientGrid (b.baseChange ℝ) l (rational i)) → + (∀ k, CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + C) ^ C)) (dualAdjoint A⁻¹ (S k)) ∧ + CoefficientGrid (b.baseChange ℝ) m (dualAdjoint B (R k))) ∧ + (∀ i, CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + C) ^ C) / T i) + (dualAdjoint A⁻¹ (small i - formalLogDerivative i A)) ∧ + CoefficientGrid (b.baseChange ℝ) m (dualAdjoint B (rational i) - formalLogDerivative i B)) ∧ + (∀ k, dualAdjoint A⁻¹ (S k) ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) 1 ∧ + dualAdjoint B (R k) ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) 1) ∧ + ∀ i, dualAdjoint A⁻¹ (small i - formalLogDerivative i A) ∈ + shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) 1 ∧ + dualAdjoint B (rational i) - formalLogDerivative i B ∈ + shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ => 1) 1 := by + obtain ⟨D, _, hbound⟩ := exists_formal_polynomial_operation_bound s a + obtain ⟨E, _, hgrid⟩ := exists_formal_polynomial_operation_grid s + let P : Polynomial ℕ := 2 * (Polynomial.X + Polynomial.C D) ^ D + + (Polynomial.X + 2) ^ a + (Polynomial.X + Polynomial.C E) ^ E + Polynomial.C (s + 2) + obtain ⟨C, hC, hCbound⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F b ω hF hgraded H p hH hp hι hσ hHp hc l hl hlp + have hbig : 2 * (p + D) ^ D + (p + 2) ^ a + (p + E) ^ E + (s + 2 : ℝ) ≤ (p + C) ^ C := by + simpa [P, Polynomial.eval₂_pow] using hCbound p hp + let d := (p + D) ^ D + let n := (p + 2) ^ a + have hd : 0 ≤ d := by dsimp [d]; positivity + have hn : 0 ≤ n := by dsimp [n]; positivity + have he : 0 ≤ (p + E) ^ E := by positivity + have hgridCap : (p + E) ^ E ≤ (p + C) ^ C := by + have hs : 0 ≤ (s : ℝ) := Nat.cast_nonneg _ + change 2 * d + n + (p + E) ^ E + (s + 2 : ℝ) ≤ _ at hbig + linarith + have hliftCap : d + n ≤ (p + C) ^ C := by + have hs : 0 ≤ (s : ℝ) := Nat.cast_nonneg _ + change 2 * d + n + (p + E) ^ E + (s + 2 : ℝ) ≤ _ at hbig + linarith + have hremCap : 2 * d + n + (s + 1 : ℝ) ≤ (p + C) ^ C := by + change 2 * d + n + (p + E) ^ E + (s + 2 : ℝ) ≤ _ at hbig + linarith + have hslowCap : Real.exp d * (Real.exp n + Real.exp d * ((s : ℝ) * Real.exp n)) ≤ + Real.exp ((p + C) ^ C) := by + have h1 : 1 ≤ Real.exp d := Real.one_le_exp hd + calc + _ = Real.exp d * Real.exp n * (1 + Real.exp d * s) := by ring + _ ≤ Real.exp d * Real.exp n * (Real.exp d * (1 + s)) := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + nlinarith + _ = (Real.exp d * Real.exp d * Real.exp n) * (s + 1) := by ring + _ ≤ (Real.exp d * Real.exp d * Real.exp n) * Real.exp (s + 1) := + mul_le_mul_of_nonneg_left (by linarith [Real.add_one_le_exp (s + 1 : ℝ)]) (by positivity) + _ = Real.exp (2 * d + n + (s + 1 : ℝ)) := by + rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr hremCap + obtain ⟨m, hm, hmp, hlm, hlogGrid, hadGrid⟩ := hgrid F b ω hF H p hH hp hι hσ hHp hc l hl hlp + refine ⟨m, hm, hmp.trans (Real.exp_le_exp.mpr hgridCap), hlm, ?_⟩ + intro T hT A B hA hB hAbound hBgrid κ S R small rational hS hR hsmall hrational hSbound hRgrid hsmallBound hrationalGrid + have hg := hgraded.baseChange b ω + have hAi : A⁻¹.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ : σ => 1) := + (gradedPolynomialSubmodule (b.baseChange ℝ) ω _).neg_mem hA + have hAa := F.gradedPolynomial_mem_adapted b ω hF (fun _ : σ => 1) A.coord hA + have hAia := F.gradedPolynomial_mem_adapted b ω hF (fun _ : σ => 1) A⁻¹.coord hAi + have hBa := F.gradedPolynomial_mem_adapted b ω hF (fun _ : σ => 1) B.coord hB + have hAib : CoefficientBound (b.baseChange ℝ) T (Real.exp n) A⁻¹.coord := + CoefficientBound.neg _ _ hAbound + have hoperations := hbound F b ω hF H p hH hp hι hσ hHp hc T hT + have hYA (i : σ) := formalLogDerivative_mem_shiftedGradedPolynomialSubmodule + (b.baseChange ℝ) ω hg i A hA + refine ⟨?_, ?_, ?_, ?_⟩ + · intro k + have hslow := hoperations.1 A⁻¹ hAia hAib (Real.exp n) (Real.exp_nonneg _) (S k) + (F.shiftedGradedPolynomial_mem_adapted b ω hF _ 1 _ (hS k)) (hSbound k) + have hfactor : Real.exp d * Real.exp n ≤ Real.exp ((p + C) ^ C) := by + rw [← Real.exp_add] + exact Real.exp_le_exp.mpr hliftCap + exact ⟨CoefficientBound.mono _ T hT hslow hfactor, + hadGrid B (R k) hBa (F.shiftedGradedPolynomial_mem_adapted b ω hF _ 1 _ (hR k)) hBgrid (hRgrid k)⟩ + · intro i + have hyBound := hoperations.2 A hAa hAbound i + have hdiff := CoefficientBound.sub (b.baseChange ℝ) T (hsmallBound i) hyBound + have hdiffGrade := (shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω (fun _ : σ => 1) 1).sub_mem + (hsmall i) (hYA i) + have hslow := hoperations.1 A⁻¹ hAia hAib + (Real.exp n / T i + Real.exp d * ((s : ℝ) * Real.exp n / T i)) (by have hTi := hT i; positivity) + (small i - formalLogDerivative i A) + (F.shiftedGradedPolynomial_mem_adapted b ω hF _ 1 _ hdiffGrade) hdiff + have hfactor : Real.exp d * (Real.exp n / T i + Real.exp d * ((s : ℝ) * Real.exp n / T i)) ≤ + Real.exp ((p + C) ^ C) / T i := by + calc + _ = (Real.exp d * (Real.exp n + Real.exp d * ((s : ℝ) * Real.exp n))) / T i := by ring + _ ≤ _ := div_le_div_of_nonneg_right hslowCap (hT i).le + exact ⟨CoefficientBound.mono _ T hT hslow hfactor, + CoefficientGrid.sub _ m + (hadGrid B (rational i) hBa (F.shiftedGradedPolynomial_mem_adapted b ω hF _ 1 _ (hrational i)) + hBgrid (hrationalGrid i)) (hlogGrid B hBa hBgrid i)⟩ + · intro k + exact ⟨dualAdjoint_mem_shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω hg _ 1 A⁻¹ (S k) hAi (hS k), + dualAdjoint_mem_shiftedGradedPolynomialSubmodule (b.baseChange ℝ) ω hg _ 1 B (R k) hB (hR k)⟩ + · intro i + exact polynomial_derivative_removal_preserves_shifted_grading (b.baseChange ℝ) ω hg i A B + (small i) (rational i) hA hB (hsmall i) (hrational i) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_uniform_controlled_current_stage (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {L μ ι ν σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [Fintype μ] [Fintype ι] [Fintype ν] [Fintype σ] + (F : NilpotentLieFiltration L s) (b : Basis μ ℚ L) (w : μ → ℕ) + (_hlayers : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + {E V : Submodule ℚ L} + (_hgraded : BasisHomogeneousBrackets b w) (_hs : 2 ≤ s) + (U : LieSubalgebra ℝ (ℝ ⊗[ℚ] L)) (K : Submodule ℝ (ℝ ⊗[ℚ] L)) + (_hUV : ∀ u ∈ U, ∀ v ∈ V.baseChange ℝ, ⁅u, v⁆ ∈ V.baseChange ℝ) + (_hV : BasisGradedSubmodule (b.baseChange ℝ) w (V.baseChange ℝ)) + (e : Basis ν ℚ E) (f : Basis ι ℚ (L ⧸ V)) + {j H J Q l : ℕ} (_hj : 2 ≤ j) + (_hE : ∀ x ∈ E.baseChange ℝ, basisGradeProjection (b.baseChange ℝ) w j x = x) + (_hEU : ∀ x ∈ E.baseChange ℝ, x ∈ U) + (_hH : 1 ≤ H) (_hl : 0 < l) + (_hA : ∀ i n, RationalHeightLE (subspaceQuotientMatrix e f i n) H) + (_he : ∀ i n, RationalHeightLE (b.repr (e n : L) i) J) + (_hf : ∀ i n, RationalHeightLE (f.repr (V.mkQ (b n)) i) Q) + (_hstructure : ∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) + {p M : ℝ} (_hp : 0 ≤ p) (_hM : 0 ≤ M) + (_hambient : (Fintype.card μ : ℝ) ≤ p) (_hrows : (Fintype.card ι : ℝ) ≤ p) + (_hcols : (Fintype.card ν : ℝ) ≤ p) (_hvariables : (Fintype.card σ : ℝ) ≤ p) + (_hjp : (j : ℝ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p) (_hJp : (J : ℝ) ≤ Real.exp p) (_hQp : (Q : ℝ) ≤ Real.exp p) + (_hlp : (l : ℝ) ≤ Real.exp p) (_hMp : M ≤ Real.exp p) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (P : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (_hPU : ∀ α, coefficients P.coord α ∈ U) + (_hPgraded : P.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1)) + (_hPE : ∀ α, basisGradeProjection (b.baseChange ℝ) w j (coefficients P.coord α) ∈ E.baseChange ℝ) + (_hK : ∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P.coord α) ∈ K) + (_hlower : ∀ α d, 2 ≤ d → d < j → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P.coord α) ∈ V.baseChange ℝ) + (_hbracket : ∀ α k, k ∈ K → + ⁅coefficients P.coord α, k⁆ ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) + (small rational extra : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (_hsmall : ∀ i α, coefficients (small i) α ∈ V.baseChange ℝ ⊔ (F.realLayer j).toSubmodule) + (_hrational : ∀ i α, coefficients (rational i) α ∈ V.baseChange ℝ ⊔ (F.realLayer j).toSubmodule) + (_hextra : ∀ i α, coefficients (extra i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P.coord)) α ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) + (_hsystem : PolynomialDerivativeSystemMod ((V.baseChange ℝ).restrictScalars ℚ) P small rational extra) + (_hSgraded : ∀ i, small i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) + (_hRgraded : ∀ i, rational i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) + (_hslow : ∀ i α, ‖realQuotientCoordinateMap f (coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (small i)) α)‖ ≤ + M / (T i * monomialScale T α)) + (_hgrid : ∀ i α, realQuotientCoordinateMap f (coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (rational i)) α) ∈ + realDenominatorGrid l) + {κ : Type*} (S R : κ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) (k : κ → ℝ ⊗[ℚ] L) + (_hS : ∀ t, S t ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ => 1) 1) + (_hR : ∀ t, R t ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ => 1) 1) + (_hSR : PolynomialLiftSystemMod ((V.baseChange ℝ).restrictScalars ℚ) P S R) + (_hSres : ∀ t α, coefficients (S t - monomial 0 (k t)) α ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) + (_hRres : ∀ t α, coefficients (R t - monomial 0 (k t)) α ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) + (_hSbound : ∀ t, CoefficientBound (b.baseChange ℝ) T (Real.exp p) (S t)) + (_hRgrid : ∀ t, CoefficientGrid (b.baseChange ℝ) l (R t)) + (_hsmallBound : ∀ i, CoefficientBound (b.baseChange ℝ) T (Real.exp p / T i) (small i)) + (_hrationalGrid : ∀ i, CoefficientGrid (b.baseChange ℝ) l (rational i)), + ∃ (n : ℕ) (A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot), + 0 < n ∧ (n : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + (∀ α, coefficients A.coord α ∈ E.baseChange ℝ ∧ coefficients B.coord α ∈ E.baseChange ℝ) ∧ + (∀ α, Finsupp.weight (fun _ : σ => (1 : ℕ)) α ≠ j → coefficients A.coord α = 0) ∧ + (∀ α, Finsupp.weight (fun _ : σ => (1 : ℕ)) α ≠ j → coefficients B.coord α = 0) ∧ + (∀ α, ‖(b.baseChange ℝ).equivFun (coefficients A.coord α)‖ ≤ + Real.exp ((p + C) ^ C) / monomialScale T α) ∧ + (∀ α, (b.baseChange ℝ).equivFun (coefficients B.coord α) ∈ + realDenominatorGrid n) ∧ + let P' := A⁻¹ * P * B⁻¹ + let small' := fun i => dualAdjoint A⁻¹ (small i - formalLogDerivative i A) + let rational' := fun i => dualAdjoint B (rational i) - formalLogDerivative i B + let extra' := fun i => dualAdjoint A⁻¹ (extra i) + A * P' * B = P ∧ coefficients P'.coord 0 = coefficients P.coord 0 ∧ + P'.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) ∧ + (∀ α, coefficients P'.coord α ∈ U) ∧ + (∀ α, coefficients (VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) P'.coord) α ∈ (E ⊓ V).baseChange ℝ) ∧ + (∀ d < j, VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w d).restrictScalars ℚ) P'.coord = + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w d).restrictScalars ℚ) P.coord) ∧ + PolynomialDerivativeSystemMod ((V.baseChange ℝ).restrictScalars ℚ) P' small' rational' extra' ∧ + (∀ i, small' i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1 ∧ + rational' i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) ∧ + (∀ i α, coefficients (small' i) α ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule ∧ + coefficients (rational' i) α ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) ∧ + (∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P'.coord α) ∈ K) ∧ + (∀ α d, 2 ≤ d → d < j + 1 → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P'.coord α) ∈ V.baseChange ℝ) ∧ + (∀ α k, k ∈ K → ⁅coefficients P'.coord α, k⁆ ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) ∧ + (∀ i α, coefficients (extra' i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P'.coord)) α ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) ∧ + PolynomialLiftSystemMod ((V.baseChange ℝ).restrictScalars ℚ) P' + (fun t => dualAdjoint A⁻¹ (S t)) (fun t => dualAdjoint B (R t)) ∧ + (∀ t α, coefficients (dualAdjoint A⁻¹ (S t) - monomial 0 (k t)) α ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule ∧ + coefficients (dualAdjoint B (R t) - monomial 0 (k t)) α ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) ∧ + (∀ t, CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + C) ^ C)) (dualAdjoint A⁻¹ (S t)) ∧ + CoefficientGrid (b.baseChange ℝ) n (dualAdjoint B (R t)) ∧ + dualAdjoint A⁻¹ (S t) ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ => 1) 1 ∧ + dualAdjoint B (R t) ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ => 1) 1) ∧ + ∀ i, CoefficientBound (b.baseChange ℝ) T (Real.exp ((p + C) ^ C) / T i) (small' i) ∧ + CoefficientGrid (b.baseChange ℝ) n (rational' i) := by + obtain ⟨D, _, hstage⟩ := exists_uniform_formal_current_layer_step + obtain ⟨E, _, hremove⟩ := exists_formal_derivative_removal_control s 1 + let Q : Polynomial ℕ := Polynomial.X + (Polynomial.X + Polynomial.C D) ^ D + let B : Polynomial ℕ := (Polynomial.X + Polynomial.C D) ^ D + (Q + Polynomial.C E) ^ E + 1 + obtain ⟨C, hC, hCbound⟩ := exists_natPolynomial_eval_budget B + refine ⟨C, hC, ?_⟩ + intro L μ ι ν σ _ _ _ _ _ _ F b w hF Vsource V hgraded hs U K hUV hV e f j H J Qheight l + hj hE hEU hH hl hA he hf hstructure p M hp hM hambient hrows hcols hvariables hjp + hHp hJp hQp hlp hMp T hT P hPU hPgraded hPE hK hlower hbracket small rational extra + hsmall hrational hextra hsystem hSgraded hRgraded hslow hgrid κ S R k hS hR hSR hSres hRres + hSbound hRgrid hsmallBound hrationalGrid + let d := (p + D) ^ D + let q := p + d + have hd : 0 ≤ d := by dsimp [d]; positivity + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by dsimp [q]; linarith + have hqE : 0 ≤ (q + E) ^ E := by positivity + have htotal : d + (q + E) ^ E + 1 ≤ (p + C) ^ C := by + simpa [B, Q, q, d, Polynomial.eval₂_pow] using hCbound p hp + have hdCap : d ≤ (p + C) ^ C := by linarith + have hremCap : (q + E) ^ E ≤ (p + C) ^ C := by linarith + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hTD : ∀ i, Real.exp ((p + D) ^ D) ≤ T i := + fun i => (Real.exp_le_exp.mpr hdCap).trans (hT i) + obtain ⟨n₀, A, Bcorr, hn₀, hn₀bound, hAB, hAhom, hBhom, hAnorm, hBgrid, + hprod, hconstant, hnewgraded, hnewU, hnewV, hbelow, hnewsystem, hnewshift, + hnewderivative, hnewK, hnewlower, hnewbracket, hnewextra⟩ := + hstage F b w hF hgraded hs U K hUV hV e f hj hE hEU hH hl hA he hf hp hM + hambient hrows hcols hvariables hjp hHp hJp hQp hlp hMp T hTD + P hPU hPgraded hPE hK hlower hbracket small rational extra hsmall hrational hextra + hsystem hSgraded hRgraded hslow hgrid + let Lden := l * n₀ + have hLden : 0 < Lden := Nat.mul_pos hl hn₀ + have hLbound : (Lden : ℝ) ≤ Real.exp q := by + calc + _ = (l : ℝ) * (n₀ : ℝ) := Nat.cast_mul _ _ + _ ≤ Real.exp p * Real.exp d := mul_le_mul hlp hn₀bound (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = Real.exp q := (Real.exp_add _ _).symm + obtain ⟨m, hm, hmbound, hLm, hcontrol⟩ := hremove F b w hF hgraded H q hH hq + (hambient.trans hpq) (hvariables.trans hpq) (hHp.trans (Real.exp_le_exp.mpr hpq)) + hstructure Lden hLden hLbound + have hlL : l ∣ Lden := dvd_mul_right l n₀ + have hnL : n₀ ∣ Lden := dvd_mul_left n₀ l + have hAg := homogeneous_mem_gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) + j A.coord hAhom (fun α => hE _ (hAB α).1) + have hBg := homogeneous_mem_gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) + j Bcorr.coord hBhom (fun α => hE _ (hAB α).2) + have hAraw : CoefficientBound (b.baseChange ℝ) T (Real.exp d) A.coord := + (coefficientBound_iff_norm _ T hTpos (Real.exp_nonneg _) A.coord).mpr hAnorm + have hAinput : CoefficientBound (b.baseChange ℝ) T (Real.exp ((q + 2) ^ 1)) A.coord := by + apply CoefficientBound.mono _ T hTpos hAraw + apply Real.exp_le_exp.mpr + simp only [pow_one] + dsimp [q] + linarith + have hBinput : CoefficientGrid (b.baseChange ℝ) Lden Bcorr.coord := + fun α => realDenominatorGrid_subset_of_dvd hn₀ hnL (hBgrid α) + have hinputCap : Real.exp p ≤ Real.exp ((q + 2) ^ 1) := by + apply Real.exp_le_exp.mpr + simp only [pow_one] + linarith + obtain ⟨hboundLifts, hboundDerivative, hshiftLifts, _⟩ := hcontrol T hTpos A Bcorr hAg hBg hAinput hBinput + S R small rational hS hR hSgraded hRgraded + (fun t => CoefficientBound.mono _ T hTpos (hSbound t) hinputCap) + (fun t α => realDenominatorGrid_subset_of_dvd hl hlL (hRgrid t α)) + (fun i => CoefficientBound.mono _ T hTpos (hsmallBound i) + (div_le_div_of_nonneg_right hinputCap (hTpos i).le)) + (fun i α => realDenominatorGrid_subset_of_dvd hl hlL (hrationalGrid i α)) + let Uq : LieSubalgebra ℚ (ℝ ⊗[ℚ] L) := + { U.toSubmodule.restrictScalars ℚ with lie_mem' := fun hx hy => U.lie_mem hx hy } + have hAlayer : ∀ α, coefficients A.coord α ∈ F.realification.layer j := by + intro α + rw [← hE _ (hAB α).1] + exact F.realGradeProjection_mem_layer b w hF j _ + have hBlayer : ∀ α, coefficients Bcorr.coord α ∈ F.realification.layer j := by + intro α + rw [← hE _ (hAB α).2] + exact F.realGradeProjection_mem_layer b w hF j _ + have hWiff (x : ℝ ⊗[ℚ] L) : + x ∈ (V.baseChange ℝ).restrictScalars ℚ ⊔ F.realification.layer (j + 1) ↔ + x ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule := by + change x ∈ (V.baseChange ℝ).restrictScalars ℚ ⊔ + (F.realLayer (j + 1)).toSubmodule.restrictScalars ℚ ↔ _ + rw [← Submodule.restrictScalars_sup] + rfl + have hkeep := F.formal_current_layer_correction_preserves_lifts_mod hs Uq + ((V.baseChange ℝ).restrictScalars ℚ) hUV j P A Bcorr + (fun α => hEU _ (hAB α).1) hAlayer hBlayer S R k hSR + (fun t α => (hWiff _).mpr (hSres t α)) (fun t α => (hWiff _).mpr (hRres t α)) + have hfinalCap : Real.exp ((q + E) ^ E) ≤ Real.exp ((p + C) ^ C) := Real.exp_le_exp.mpr hremCap + refine ⟨m, A, Bcorr, hm, hmbound.trans hfinalCap, hAB, hAhom, hBhom, ?_, ?_, + hprod, hconstant, hnewgraded, hnewU, hnewV, hbelow, hnewsystem, hnewshift, + hnewderivative, hnewK, hnewlower, hnewbracket, hnewextra, hkeep.1, ?_, ?_, ?_⟩ + · intro α + exact (hAnorm α).trans (div_le_div_of_nonneg_right (Real.exp_le_exp.mpr hdCap) + (monomialScale_pos T hTpos α).le) + · intro α + exact realDenominatorGrid_subset_of_dvd hn₀ (dvd_trans hnL hLm) (hBgrid α) + · intro t α + exact ⟨(hWiff _).mp (hkeep.2 t α).1, (hWiff _).mp (hkeep.2 t α).2⟩ + · intro t + exact ⟨CoefficientBound.mono _ T hTpos (hboundLifts t).1 hfinalCap, + (hboundLifts t).2, (hshiftLifts t).1, (hshiftLifts t).2⟩ + · intro i + exact ⟨CoefficientBound.mono _ T hTpos (hboundDerivative i).1 + (div_le_div_of_nonneg_right hfinalCap (hTpos i).le), (hboundDerivative i).2⟩ + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformControlledNativeExternalNetsOfRecovery.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformControlledNativeExternalNetsOfRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2765e4d06b1a5d21579856223444f4be1601f1e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformControlledNativeExternalNetsOfRecovery.lean @@ -0,0 +1,713 @@ +import OAI.Combinatorics.Progressions.Dynamics.UniformExternalNetScalarBudget +import OAI.Combinatorics.Progressions.Estimates.FixedObservableCorrelation +import OAI.Combinatorics.Progressions.Estimates.McShaneEnvelope +import OAI.Combinatorics.Progressions.Estimates.PositiveReconstruction +import OAI.Combinatorics.Progressions.Nilpotent.LocalMajorDenseSliceNiltest + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +variable {X Y : Type*} [Nonempty X] [PseudoMetricSpace Y] + (φ : X → Y) (L : ℝ≥0) + +noncomputable def positiveImageExtension (f : X → ℂ) (y : Y) : ℂ := + positiveClip (mcShaneEnvelope φ L (fun x => (f x).re) y) + +omit [Nonempty X] in +theorem positiveImageExtension_unit_interval (f : X → ℂ) (y : Y) : + (positiveImageExtension φ L f y).im = 0 ∧ + 0 ≤ (positiveImageExtension φ L f y).re ∧ (positiveImageExtension φ L f y).re ≤ 1 := + positiveClip_unit_interval _ + +omit [Nonempty X] in +theorem positiveImageExtension_norm_le_one (f : X → ℂ) (y : Y) : + ‖positiveImageExtension φ L f y‖ ≤ 1 := norm_positiveClip_le_one _ + +theorem positiveImageExtension_lipschitz (f : X → ℂ) (hf : ∀ x, 0 ≤ (f x).re) : + LipschitzWith L (positiveImageExtension φ L f) := by + unfold positiveImageExtension + have h := positiveClip_lipschitz.comp + (Complex.isometry_ofReal.lipschitzWith.comp (mcShaneEnvelope_lipschitz φ L _ hf)) + simpa only [Function.comp_def, one_mul] using h + +theorem positiveImageExtension_eq (f : X → ℂ) + (hf : ∀ x, (f x).im = 0 ∧ 0 ≤ (f x).re ∧ (f x).re ≤ 1) + (hLip : ∀ x z, ‖f x - f z‖ ≤ L * dist (φ x) (φ z)) (x : X) : + positiveImageExtension φ L f (φ x) = f x := by + have hreal : ∀ x z, |(f x).re - (f z).re| ≤ L * dist (φ x) (φ z) := + fun x z => (Complex.abs_re_le_norm (f x - f z)).trans (hLip x z) + have heq : ((f x).re : ℂ) = f x := Complex.ext rfl (hf x).1.symm + unfold positiveImageExtension + rw [mcShaneEnvelope_eq φ L _ (fun x => (hf x).2.1) hreal, heq, + positiveClip_eq_self _ (hf x)] + +theorem positiveImageExtension_nonexpansive (f g : X → ℂ) + (hf : ∀ x, 0 ≤ (f x).re) (hg : ∀ x, 0 ≤ (g x).re) + {δ : ℝ} (hfg : ∀ x, ‖f x - g x‖ ≤ δ) (y : Y) : + ‖positiveImageExtension φ L f y - positiveImageExtension φ L g y‖ ≤ δ := by + have henv := mcShaneEnvelope_abs_sub_le φ L (fun x => (f x).re) (fun x => (g x).re) + hf hg (fun x => (Complex.abs_re_le_norm (f x - g x)).trans (hfg x)) y + have hclip := positiveClip_lipschitz.dist_le_mul + (mcShaneEnvelope φ L (fun x => (f x).re) y : ℂ) + (mcShaneEnvelope φ L (fun x => (g x).re) y : ℂ) + have hbound : ‖positiveImageExtension φ L f y - positiveImageExtension φ L g y‖ ≤ + |mcShaneEnvelope φ L (fun x => (f x).re) y - mcShaneEnvelope φ L (fun x => (g x).re) y| := by + simpa only [positiveImageExtension, NNReal.coe_one, one_mul, dist_eq_norm, + ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using hclip + exact hbound.trans henv + +theorem positiveImageExtension_bound_of_reconstruction (f : X → ℂ) (v : Y → ℂ) + (hv : LipschitzWith L v) (heval : ∀ x, v (φ x) = f x) + (hf : ∀ x, (f x).im = 0 ∧ 0 ≤ (f x).re ∧ (f x).re ≤ 1) : + LipschitzWith L (positiveImageExtension φ L f) ∧ + (∀ y, (positiveImageExtension φ L f y).im = 0 ∧ + 0 ≤ (positiveImageExtension φ L f y).re ∧ (positiveImageExtension φ L f y).re ≤ 1) ∧ + (∀ y, ‖positiveImageExtension φ L f y‖ ≤ 1) ∧ + ∀ x, positiveImageExtension φ L f (φ x) = f x := by + refine ⟨positiveImageExtension_lipschitz φ L f (fun x => (hf x).2.1), + positiveImageExtension_unit_interval φ L f, positiveImageExtension_norm_le_one φ L f, ?_⟩ + apply positiveImageExtension_eq φ L f hf + intro x z + simpa only [dist_eq_norm, heval] using hv.dist_le_mul (φ x) (φ z) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +variable {X Y Z : Type*} [Nonempty X] [PseudoMetricSpace Y] [PseudoMetricSpace Z] + (φ : X → Y × Z) (L : ℝ≥0) + +noncomputable def positiveImageSlice (f : X → ℂ) (z : Z) (y : Y) : ℂ := + positiveImageExtension φ L f (y, z) + +theorem positiveImageSlice_lipschitz (f : X → ℂ) (hf : ∀ x, 0 ≤ (f x).re) (z : Z) : + LipschitzWith L (positiveImageSlice φ L f z) := by + apply LipschitzWith.of_dist_le_mul + intro y y' + have h := (positiveImageExtension_lipschitz φ L f hf).dist_le_mul (y, z) (y', z) + simpa only [positiveImageSlice, Prod.dist_eq, dist_self, max_eq_left dist_nonneg] using h + +theorem positiveImageSlice_eq (f : X → ℂ) + (hf : ∀ x, (f x).im = 0 ∧ 0 ≤ (f x).re ∧ (f x).re ≤ 1) + (hLip : ∀ x z, ‖f x - f z‖ ≤ L * dist (φ x) (φ z)) (x : X) : + positiveImageSlice φ L f (φ x).2 (φ x).1 = f x := + positiveImageExtension_eq φ L f hf hLip x + +theorem positiveImageSlice_parameter_bound (f g : X → ℂ) + (hf : ∀ x, 0 ≤ (f x).re) (hg : ∀ x, 0 ≤ (g x).re) + {δ : ℝ} (hfg : ∀ x, ‖f x - g x‖ ≤ δ) (z z' : Z) (y : Y) : + ‖positiveImageSlice φ L f z y - positiveImageSlice φ L g z' y‖ ≤ + δ + L * dist z z' := by + have hleft := positiveImageExtension_nonexpansive φ L f g hf hg hfg (y, z) + have hright : ‖positiveImageSlice φ L g z y - positiveImageSlice φ L g z' y‖ ≤ + L * dist z z' := by + have h := (positiveImageExtension_lipschitz φ L g hg).dist_le_mul (y, z) (y, z') + simpa only [positiveImageSlice, Prod.dist_eq, dist_self, max_eq_right dist_nonneg, + dist_eq_norm] using h + exact (norm_sub_le_norm_sub_add_norm_sub (positiveImageSlice φ L f z y) (positiveImageSlice φ L g z y) + (positiveImageSlice φ L g z' y)).trans (add_le_add hleft hright) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_stable_positive_reconstruction {Θ X Y : Type*} + [Nonempty X] [PseudoMetricSpace Y] (φ : X → Y) (f : Θ → X → ℂ) (L : ℝ≥0) + (hf : ∀ θ x, (f θ x).im = 0 ∧ 0 ≤ (f θ x).re ∧ (f θ x).re ≤ 1) + (hrec : ∀ θ, ∃ (v : Y → ℂ) (K : ℝ≥0), K ≤ L ∧ LipschitzWith K v ∧ + ∀ x, v (φ x) = f θ x) : + ∃ V : Θ → Y → ℂ, + (∀ θ, LipschitzWith L (V θ)) ∧ + (∀ θ y, (V θ y).im = 0 ∧ 0 ≤ (V θ y).re ∧ (V θ y).re ≤ 1) ∧ + (∀ θ y, ‖V θ y‖ ≤ 1) ∧ (∀ θ x, V θ (φ x) = f θ x) ∧ + ∀ θ θ' δ, (∀ x, ‖f θ x - f θ' x‖ ≤ δ) → ∀ y, ‖V θ y - V θ' y‖ ≤ δ := by + refine ⟨fun θ => positiveImageExtension φ L (f θ), + fun θ => positiveImageExtension_lipschitz φ L (f θ) (fun x => (hf θ x).2.1), + fun θ => positiveImageExtension_unit_interval φ L (f θ), + fun θ => positiveImageExtension_norm_le_one φ L (f θ), ?_, ?_⟩ + · intro θ + obtain ⟨v, K, hK, hv, heval⟩ := hrec θ + exact (positiveImageExtension_bound_of_reconstruction φ L (f θ) v + (hv.weaken hK) heval (hf θ)).2.2.2 + · intro θ θ' δ hdiff y + exact positiveImageExtension_nonexpansive φ L (f θ) (f θ') + (fun x => (hf θ x).2.1) (fun x => (hf θ' x).2.1) hdiff y + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +variable {X Y Z : Type*} [Nonempty X] [PseudoMetricSpace Y] [PseudoMetricSpace Z] + (φ : X → Y × Z) (K : ℝ≥0) (f : X → ℂ) + (hf : ∀ x, 0 ≤ (f x).re) + (hrecovery : ∀ x, positiveImageSlice φ K f (φ x).2 (φ x).1 = f x) + +include hf hrecovery + +theorem positiveImageExtension_reconstructs_of_positiveImageSlice_eq : + LipschitzWith K (positiveImageExtension φ K f) ∧ + ∀ x, positiveImageExtension φ K f (φ x) = f x := by + refine ⟨positiveImageExtension_lipschitz φ K f hf, ?_⟩ + intro x + simpa only [positiveImageSlice, Prod.mk.eta] using hrecovery x + +theorem exists_lipschitz_reconstruction_of_positiveImageSlice_eq : + ∃ (v : Y × Z → ℂ) (K' : ℝ≥0), K' ≤ K ∧ LipschitzWith K' v ∧ + ∀ x, v (φ x) = f x := by + exact ⟨positiveImageExtension φ K f, K, le_rfl, + positiveImageExtension_reconstructs_of_positiveImageSlice_eq φ K f hf hrecovery⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_external_test_net {O A R X Y Z IO IA IZ : Type*} + [Nonempty X] [PseudoMetricSpace A] [PseudoMetricSpace Y] [PseudoMetricSpace Z] + [Fintype IO] [Fintype IA] [Fintype R] [Fintype IZ] + (φ : X → Y × Z) (F : O → A → R → X → ℂ) (L M : ℝ≥0) + (hpositive : ∀ o a r x, (F o a r x).im = 0 ∧ 0 ≤ (F o a r x).re ∧ (F o a r x).re ≤ 1) + (hreconstruct : ∀ o a r, ∃ (v : Y × Z → ℂ) (K : ℝ≥0), K ≤ L ∧ LipschitzWith K v ∧ + ∀ x, v (φ x) = F o a r x) + (hvariation : ∀ o a a' r x, ‖F o a r x - F o a' r x‖ ≤ M * dist a a') + (oc : IO → O) (ac : IA → A) (zc : IZ → Z) {δO δA δZ : ℝ} + (hO : ∀ o, ∃ i, ∀ a r x, ‖F o a r x - F (oc i) a r x‖ ≤ δO) + (hA : ∀ a, ∃ i, dist a (ac i) ≤ δA) (hZ : ∀ z, ∃ i, dist z (zc i) ≤ δZ) : + let n := Fintype.card IO * Fintype.card IA * Fintype.card R * Fintype.card IZ + ∃ centers : Fin n → Y → ℂ, + (∀ i, LipschitzWith L (centers i)) ∧ + (∀ i y, (centers i y).im = 0 ∧ 0 ≤ (centers i y).re ∧ (centers i y).re ≤ 1) ∧ + (∀ i y, ‖centers i y‖ ≤ 1) ∧ + (∀ o a r x, positiveImageSlice φ L (F o a r) (φ x).2 (φ x).1 = F o a r x) ∧ + ∀ o a r z, ∃ i, ∀ y, + ‖positiveImageSlice φ L (F o a r) z y - centers i y‖ ≤ δO + M * δA + L * δZ := by + classical + let I := IO × IA × R × IZ + let n := Fintype.card IO * Fintype.card IA * Fintype.card R * Fintype.card IZ + have hcard : Fintype.card I = n := by simp only [I, n, Fintype.card_prod, Nat.mul_assoc] + let e : I ≃ Fin n := Fintype.equivFinOfCardEq hcard + let centers : Fin n → Y → ℂ := fun i => + positiveImageSlice φ L (F (oc (e.symm i).1) (ac (e.symm i).2.1) (e.symm i).2.2.1) + (zc (e.symm i).2.2.2) + refine ⟨centers, ?_, ?_, ?_, ?_, ?_⟩ + · intro i + exact positiveImageSlice_lipschitz φ L _ (fun x => (hpositive _ _ _ x).2.1) _ + · intro i y + exact positiveImageExtension_unit_interval φ L _ _ + · intro i y + exact positiveImageExtension_norm_le_one φ L _ _ + · intro o a r x + obtain ⟨v, K, hK, hv, heval⟩ := hreconstruct o a r + exact (positiveImageExtension_bound_of_reconstruction φ L (F o a r) v + (hv.weaken hK) heval (hpositive o a r)).2.2.2 x + · intro o a r z + obtain ⟨io, hio⟩ := hO o + obtain ⟨ia, hia⟩ := hA a + obtain ⟨iz, hiz⟩ := hZ z + refine ⟨e (io, ia, r, iz), ?_⟩ + intro y + have hsource : ∀ x, ‖F o a r x - F (oc io) (ac ia) r x‖ ≤ δO + M * δA := by + intro x + exact (norm_sub_le_norm_sub_add_norm_sub (F o a r x) (F (oc io) a r x) + (F (oc io) (ac ia) r x)).trans (add_le_add (hio a r x) + ((hvariation (oc io) a (ac ia) r x).trans (mul_le_mul_of_nonneg_left hia M.coe_nonneg))) + have h := (positiveImageSlice_parameter_bound φ L (F o a r) (F (oc io) (ac ia) r) + (fun x => (hpositive _ _ _ x).2.1) (fun x => (hpositive _ _ _ x).2.1) hsource z (zc iz) y).trans + (add_le_add le_rfl (mul_le_mul_of_nonneg_left hiz L.coe_nonneg)) + simpa only [centers, Equiv.symm_apply_apply] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open VectorPolynomial +open scoped TensorProduct + +namespace NilpotentLieFiltration + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (w : σ → ℕ) + +noncomputable def adaptedPolynomialRealValueHom (t : σ → ℝ) : + (F.realification.adaptedPolynomialFiltration w).Group →* F.realification.Group := + (F.realification.polynomialOrbitRealEval w t).comp (F.realification.adaptedBCHToOrbit w) + +theorem adaptedPolynomialRealValueHom_coord (t : σ → ℝ) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + (F.adaptedPolynomialRealValueHom w t g).coord = + eval₂ t (g.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) := rfl + +theorem adaptedPolynomialRealValueHom_constant (t : σ → ℝ) (κ : F.realification.Group) : + F.adaptedPolynomialRealValueHom w t (F.realification.adaptedConstantGroupHom w κ) = κ := by + apply NilpotentLieBCHGroup.ext + rw [adaptedPolynomialRealValueHom_coord, F.realification.adaptedConstantGroupHom_log, + eval₂_monomial, Finsupp.prod_zero_index, one_smul] + +end NilpotentLieFiltration + +namespace RationalFilteredNilmanifold + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (D : RationalFilteredNilmanifold L s d) (w : σ → ℕ) + +theorem lattice_factorization_quotient + (g E b R : (D.filtration.realification.adaptedPolynomialFiltration w).Group) + (κ : D.RealGroup) (hκ : κ ∈ D.realLattice) + (hprod : E * b * R * D.filtration.realification.adaptedConstantGroupHom w κ = g) + (t : σ → ℝ) : + (QuotientGroup.mk (D.filtration.adaptedPolynomialRealValueHom w t g) : D.Space) = + QuotientGroup.mk (D.filtration.adaptedPolynomialRealValueHom w t E * + D.filtration.adaptedPolynomialRealValueHom w t b * + D.filtration.adaptedPolynomialRealValueHom w t R) := by + have h := congrArg (D.filtration.adaptedPolynomialRealValueHom w t) hprod + simp only [map_mul, NilpotentLieFiltration.adaptedPolynomialRealValueHom_constant] at h + rw [← h] + exact QuotientGroup.mk_mul_of_mem _ hκ + +namespace Niltest + +variable [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + +theorem evalReal_of_lattice_factorization (T : D.Niltest w) + (E b R : (D.filtration.realification.adaptedPolynomialFiltration w).Group) + (κ : D.RealGroup) (hκ : κ ∈ D.realLattice) + (hprod : E * b * R * D.filtration.realification.adaptedConstantGroupHom w κ = + ⟨⟨T.orbit.log, T.orbit.property⟩⟩) (t : σ → ℝ) : + T.evalReal t = T.observable (QuotientGroup.mk + (D.filtration.adaptedPolynomialRealValueHom w t E * + D.filtration.adaptedPolynomialRealValueHom w t b * + D.filtration.adaptedPolynomialRealValueHom w t R)) := by + exact congrArg T.observable (lattice_factorization_quotient D w _ E b R κ hκ hprod t) + +theorem eval_of_lattice_factorization (T : D.Niltest w) + (E b R : (D.filtration.realification.adaptedPolynomialFiltration w).Group) + (κ : D.RealGroup) (hκ : κ ∈ D.realLattice) + (hprod : E * b * R * D.filtration.realification.adaptedConstantGroupHom w κ = + ⟨⟨T.orbit.log, T.orbit.property⟩⟩) (x : σ → ℤ) : + T.eval x = T.observable (QuotientGroup.mk + (D.filtration.adaptedPolynomialRealValueHom w (fun i => (x i : ℝ)) E * + D.filtration.adaptedPolynomialRealValueHom w (fun i => (x i : ℝ)) b * + D.filtration.adaptedPolynomialRealValueHom w (fun i => (x i : ℝ)) R)) := by + rw [← T.evalReal_integer] + exact evalReal_of_lattice_factorization D w T E b R κ hκ hprod _ + +end Niltest +end RationalFilteredNilmanifold +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.Niltest + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} {w : σ → ℕ} + +theorem observable_change_left (T : D.Niltest w) (a a₀ : D.RealGroup) (x : D.Space) : + letI := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) (D.basis.baseChange ℝ) + ‖T.observable (a • x) - T.observable (a₀ • x)‖ ≤ (T.lipBound : ℝ) * dist a a₀ := by + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) (D.basis.baseChange ℝ) + let := D.metricSpace + have hpoint : dist (a • x) (a₀ • x) ≤ dist a a₀ := by + have hLip : LipschitzWith 1 (fun a : D.RealGroup => a • x) := + quotientMetricSpace_lipschitz_orbit (D.basis.baseChange ℝ) D.realLattice + D.realLattice_closed_discrete.1 x + simpa only [NNReal.coe_one, one_mul] using hLip.dist_le_mul a a₀ + calc + _ ≤ (T.lipBound : ℝ) * dist (a • x) (a₀ • x) := by + simpa only [dist_eq_norm] using T.lipschitz.dist_le_mul (a • x) (a₀ • x) + _ ≤ _ := mul_le_mul_of_nonneg_left hpoint T.lipBound.coe_nonneg + +theorem observable_freeze_factors (T : D.Niltest w) (a a₀ b r r₀ : D.RealGroup) + (hr : (QuotientGroup.mk r : D.Space) = QuotientGroup.mk r₀) : + letI := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) (D.basis.baseChange ℝ) + ‖T.observable (QuotientGroup.mk (a * b * r)) - + T.observable (QuotientGroup.mk (a₀ * b * r₀))‖ ≤ (T.lipBound : ℝ) * dist a a₀ := by + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) (D.basis.baseChange ℝ) + have heq : T.observable (QuotientGroup.mk (a * b * r)) = + T.observable (QuotientGroup.mk (a * b * r₀)) := + congrArg (fun x : D.Space => T.observable ((a * b) • x)) hr + rw [heq, mul_assoc a b r₀, mul_assoc a₀ b r₀] + exact T.observable_change_left a a₀ (QuotientGroup.mk (b * r₀)) + +theorem eval_freeze_of_lattice_factorization (T : D.Niltest w) + (E b R : (D.filtration.realification.adaptedPolynomialFiltration w).Group) + (κ : D.RealGroup) (hκ : κ ∈ D.realLattice) + (hprod : E * b * R * D.filtration.realification.adaptedConstantGroupHom w κ = + ⟨⟨T.orbit.log, T.orbit.property⟩⟩) (x : σ → ℤ) (a₀ r₀ : D.RealGroup) + {p δ : ℝ} (hT : T.ComplexityLE p) + (hr : (QuotientGroup.mk (D.filtration.adaptedPolynomialRealValueHom w (fun i => (x i : ℝ)) R) : D.Space) = + QuotientGroup.mk r₀) + (hE : letI := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) (D.basis.baseChange ℝ) + dist (D.filtration.adaptedPolynomialRealValueHom w (fun i => (x i : ℝ)) E) a₀ ≤ δ) : + ‖T.eval x - T.observable (QuotientGroup.mk + (a₀ * D.filtration.adaptedPolynomialRealValueHom w (fun i => (x i : ℝ)) b * r₀))‖ ≤ + Real.exp p * δ := by + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) (D.basis.baseChange ℝ) + have hLip : (T.lipBound : ℝ) ≤ Real.exp p := by + have hb := T.observable_budget hT + linarith [T.normBound.coe_nonneg] + rw [eval_of_lattice_factorization D w T E b R κ hκ hprod x] + exact (T.observable_freeze_factors _ a₀ _ _ r₀ hr).trans + ((mul_le_mul_of_nonneg_right hLip dist_nonneg).trans + (mul_le_mul_of_nonneg_left hE (Real.exp_pos p).le)) + +end Erdos3.RationalFilteredNilmanifold.Niltest + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L s d) + +theorem frozen_observable_change_left (S : D.Space → ℂ) {ℓ : ℝ≥0} + (hS : letI := D.metricSpace; LipschitzWith ℓ S) (a a' b r : D.RealGroup) : + letI := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + ‖S (QuotientGroup.mk (a * b * r)) - S (QuotientGroup.mk (a' * b * r))‖ ≤ + (ℓ : ℝ) * dist a a' := by + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + let := D.metricSpace + let x : D.Space := QuotientGroup.mk (b * r) + have hLip : LipschitzWith 1 (fun a : D.RealGroup => a • x) := + quotientMetricSpace_lipschitz_orbit (D.basis.baseChange ℝ) D.realLattice + D.realLattice_closed_discrete.1 x + have hpoint : dist (a • x) (a' • x) ≤ dist a a' := by + simpa only [NNReal.coe_one, one_mul] using hLip.dist_le_mul a a' + have h := (hS.dist_le_mul (a • x) (a' • x)).trans + (mul_le_mul_of_nonneg_left hpoint ℓ.coe_nonneg) + simpa only [x, MulAction.Quotient.smul_mk, smul_eq_mul, mul_assoc, dist_eq_norm] using h + +theorem frozen_observable_variation (S S' : D.Space → ℂ) {ℓ : ℝ≥0} + (hS' : letI := D.metricSpace; LipschitzWith ℓ S') {δ : ℝ} + (hSS' : ∀ x, ‖S x - S' x‖ ≤ δ) (a a' b r : D.RealGroup) : + letI := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + ‖S (QuotientGroup.mk (a * b * r)) - S' (QuotientGroup.mk (a' * b * r))‖ ≤ + δ + (ℓ : ℝ) * dist a a' := by + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + exact (norm_sub_le_norm_sub_add_norm_sub (S (QuotientGroup.mk (a * b * r))) (S' (QuotientGroup.mk (a * b * r))) + (S' (QuotientGroup.mk (a' * b * r)))).trans + (add_le_add (hSS' _) (D.frozen_observable_change_left S' hS' a a' b r)) + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +theorem exists_frozen_external_test_net {L O R X Y Z IO IA IZ : Type*} + [LieRing L] [LieAlgebra ℚ L] [Nonempty X] [PseudoMetricSpace Y] [PseudoMetricSpace Z] + [Fintype IO] [Fintype IA] [Fintype R] [Fintype IZ] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] {s d : ℕ} + (D : RationalFilteredNilmanifold L s d) (φ : X → Y × Z) + (b : X → D.RealGroup) (S : O → D.Space → ℂ) (A : Set D.RealGroup) (r : R → D.RealGroup) + (K ℓ : ℝ≥0) (hS : ∀ o, letI := D.metricSpace; LipschitzWith ℓ (S o)) + (hpositive : ∀ o x, (S o x).im = 0 ∧ 0 ≤ (S o x).re ∧ (S o x).re ≤ 1) + (hreconstruct : ∀ o (a : A) j, ∃ (v : Y × Z → ℂ) (C : ℝ≥0), + C ≤ K ∧ LipschitzWith C v ∧ ∀ x, v (φ x) = S o (QuotientGroup.mk (a.val * b x * r j))) + (oc : IO → O) (ac : IA → A) (zc : IZ → Z) {δO δA δZ : ℝ} + (hO : ∀ o, ∃ i, ∀ x, ‖S o x - S (oc i) x‖ ≤ δO) + (hA : + letI := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + ∀ a : A, ∃ i, dist a (ac i) ≤ δA) + (hZ : ∀ z, ∃ i, dist z (zc i) ≤ δZ) : + let F := fun o (a : A) j x => S o (QuotientGroup.mk (a.val * b x * r j)) + let n := Fintype.card IO * Fintype.card IA * Fintype.card R * Fintype.card IZ + ∃ centers : Fin n → Y → ℂ, + (∀ i, LipschitzWith K (centers i)) ∧ + (∀ i y, (centers i y).im = 0 ∧ 0 ≤ (centers i y).re ∧ (centers i y).re ≤ 1) ∧ + (∀ i y, ‖centers i y‖ ≤ 1) ∧ + (∀ o a j x, positiveImageSlice φ K (F o a j) (φ x).2 (φ x).1 = + S o (QuotientGroup.mk (a.val * b x * r j))) ∧ + ∀ o a j z, ∃ i, ∀ y, + ‖positiveImageSlice φ K (F o a j) z y - centers i y‖ ≤ δO + ℓ * δA + K * δZ := by + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + let F := fun o (a : A) j x => S o (QuotientGroup.mk (a.val * b x * r j)) + have hvariation : ∀ o (a a' : A) j x, ‖F o a j x - F o a' j x‖ ≤ ℓ * dist a a' := by + intro o a a' j x + exact D.frozen_observable_change_left (S o) (hS o) a.val a'.val (b x) (r j) + exact exists_external_test_net φ F K ℓ (fun o a j x => hpositive o _) + hreconstruct hvariation oc ac zc + (fun o => by obtain ⟨i, hi⟩ := hO o; exact ⟨i, fun a j x => hi _⟩) hA hZ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +theorem exists_controlled_native_external_net (s t r : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L M O R IO X Y : Type*} + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + [Fintype IO] [Fintype R] [Nonempty X] [PseudoMetricSpace Y] {d e : ℕ} + (D : RationalFilteredNilmanifold L s d) (E : RationalFilteredNilmanifold M t e) + (B K ℓ : ℝ≥0) {p ε : ℝ}, + 0 ≤ p → D.GeometryComplexityLE p → E.GeometryComplexityLE p → + 1 ≤ B → (B : ℝ) ≤ Real.exp ((p + 2) ^ r) → + (K : ℝ) ≤ Real.exp p → (ℓ : ℝ) ≤ Real.exp p → + 0 < ε → 1 / ε ≤ Real.exp p → + (Fintype.card IO : ℝ) ≤ Real.exp p → (Fintype.card R : ℝ) ≤ Real.exp p → + ∀ (S : O → D.Space → ℂ) (b : X → D.RealGroup) (r₀ : R → D.RealGroup) + (φ : X → Y × E.Space) (oc : IO → O), + (∀ o, letI := D.metricSpace; LipschitzWith ℓ (S o)) → + (∀ o x, (S o x).im = 0 ∧ 0 ≤ (S o x).re ∧ (S o x).re ≤ 1) → + (∀ o, ∃ i, ∀ x, ‖S o x - S (oc i) x‖ ≤ ε / 3) → + (∀ o (a : coordinateBox (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) B) j, + ∃ (v : Y × E.Space → ℂ) (K' : ℝ≥0), K' ≤ K ∧ + (letI := E.metricSpace; LipschitzWith K' v) ∧ + ∀ x, v (φ x) = S o (QuotientGroup.mk (a.val * b x * r₀ j))) → + letI := E.metricSpace + let A := coordinateBox (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) B + let F := fun o (a : A) j x => S o (QuotientGroup.mk (a.val * b x * r₀ j)) + ∃ n : ℕ, (n : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ ∃ centers : Fin n → Y → ℂ, + (∀ i, LipschitzWith K (centers i)) ∧ + (∀ i y, (centers i y).im = 0 ∧ 0 ≤ (centers i y).re ∧ (centers i y).re ≤ 1) ∧ + (∀ i y, ‖centers i y‖ ≤ 1) ∧ + (∀ o a j x, positiveImageSlice φ K (F o a j) (φ x).2 (φ x).1 = F o a j x) ∧ + ∀ o a j z, ∃ i, ∀ y, ‖positiveImageSlice φ K (F o a j) z y - centers i y‖ ≤ ε := by + obtain ⟨cA, _, hgroup⟩ := exists_native_group_parameter_cover s r + obtain ⟨cZ, _, hquot⟩ := exists_native_quotient_parameter_cover t + let X : Polynomial ℕ := Polynomial.X + let T := 2 * X + 7 + let P := 2 * X + (T + Polynomial.C cA) ^ cA + (T + Polynomial.C cZ) ^ cZ + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro L M O R IO X₀ Y _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ d e D E B K ℓ p ε + hp hD hE hB hBp hK hℓ hε hεinv hIO hR S b r₀ φ oc hS hpositive hO hreconstruct + let q := 2 * p + 7 + have hpq : p ≤ q := by dsimp [q]; linarith + have hq : 0 ≤ q := hp.trans hpq + have hBq : (B : ℝ) ≤ Real.exp ((q + 2) ^ r) := hBp.trans + (Real.exp_le_exp.mpr (pow_le_pow_left₀ (by linarith) (by linarith) r)) + obtain ⟨nA, _, hnA, ac, hAcov⟩ := hgroup D B hq (hD.mono D hpq) hB hBq + (externalNetMesh_pos ℓ hε) (externalNetMesh_inverse_bound ℓ hε hp hℓ hεinv) + obtain ⟨nZ, _, hnZ, zc, hZcov⟩ := hquot E hq (hE.mono E hpq) + (externalNetMesh_pos K hε) (externalNetMesh_inverse_bound K hε hp hK hεinv) + let := E.metricSpace + have hnet := D.exists_frozen_external_test_net φ b S + (coordinateBox (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) (D.basis.baseChange ℝ) B) + r₀ K ℓ hS hpositive hreconstruct oc ac zc hO hAcov hZcov + dsimp only at hnet + obtain ⟨centers, hLip, hunit, hcap, heval, hcover⟩ := hnet + have hfinal : 2 * p + (q + cA) ^ cA + (q + cZ) ^ cZ ≤ (p + C) ^ C := by + simpa [P, T, X, q, Polynomial.eval₂_pow] using hbudget p hp + have hcount : ((Fintype.card IO * nA * Fintype.card R * nZ : ℕ) : ℝ) ≤ Real.exp ((p + C) ^ C) := by + push_cast + calc + _ ≤ Real.exp p * Real.exp ((q + cA) ^ cA) * Real.exp p * Real.exp ((q + cZ) ^ cZ) := by + gcongr + _ = Real.exp (2 * p + (q + cA) ^ cA + (q + cZ) ^ cZ) := by + rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr hfinal + refine ⟨_, ?_, centers, hLip, hunit, hcap, heval, ?_⟩ + · simpa only [Fintype.card_fin] using hcount + · intro o a j z + obtain ⟨i, hi⟩ := hcover o a j z + exact ⟨i, fun y => (hi y).trans (externalNetMesh_error K ℓ hε.le)⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +theorem exists_uniform_controlled_native_external_nets (s t r netExponent : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L M O R X Y : Type*} + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + [Fintype R] [Nonempty X] [PseudoMetricSpace Y] {d e : ℕ} + (D : RationalFilteredNilmanifold L s d) (E : RationalFilteredNilmanifold M t e) + (B K ℓ : ℝ≥0) {p : ℝ}, + 0 ≤ p → D.GeometryComplexityLE p → E.GeometryComplexityLE p → + 1 ≤ B → (B : ℝ) ≤ Real.exp ((p + 2) ^ r) → + (K : ℝ) ≤ Real.exp p → (ℓ : ℝ) ≤ Real.exp p → + (Fintype.card R : ℝ) ≤ Real.exp p → + ∀ (S : O → D.Space → ℂ) (b : X → D.RealGroup) (r₀ : R → D.RealGroup) + (φ : X → Y × E.Space), + (∀ o, letI := D.metricSpace; LipschitzWith ℓ (S o)) → + (∀ o x, (S o x).im = 0 ∧ 0 ≤ (S o x).re ∧ (S o x).re ≤ 1) → + (∀ η : ℝ, 0 < η → η ≤ 1 → ∃ n : ℕ, + (n : ℝ) ≤ Real.exp ((p + Real.log (1 / η) + netExponent) ^ netExponent) ∧ + ∃ oc : Fin n → O, ∀ o, ∃ i, ∀ x, ‖S o x - S (oc i) x‖ ≤ η) → + (∀ o (a : coordinateBox (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) B) j, + ∃ (v : Y × E.Space → ℂ) (K' : ℝ≥0), K' ≤ K ∧ + (letI := E.metricSpace; LipschitzWith K' v) ∧ + ∀ x, v (φ x) = S o (QuotientGroup.mk (a.val * b x * r₀ j))) → + letI := E.metricSpace + let A := coordinateBox (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) B + let F := fun o (a : A) j x => S o (QuotientGroup.mk (a.val * b x * r₀ j)) + ∀ ε : ℝ, 0 < ε → ε ≤ 1 → + ∃ n : ℕ, (n : ℝ) ≤ Real.exp ((p + Real.log (1 / ε) + C) ^ C) ∧ ∃ centers : Fin n → Y → ℂ, + (∀ i, LipschitzWith K (centers i)) ∧ + (∀ i y, (centers i y).im = 0 ∧ 0 ≤ (centers i y).re ∧ (centers i y).re ≤ 1) ∧ + (∀ i y, ‖centers i y‖ ≤ 1) ∧ + (∀ o a j x, positiveImageSlice φ K (F o a j) (φ x).2 (φ x).1 = F o a j x) ∧ + ∀ o a j z, ∃ i, ∀ y, ‖positiveImageSlice φ K (F o a j) z y - centers i y‖ ≤ ε := by + obtain ⟨localExponent, _, hnet⟩ := exists_controlled_native_external_net s t r + obtain ⟨C, hC, hscalar⟩ := exists_uniformExternalNetScalarBudget netExponent localExponent + refine ⟨C, hC, ?_⟩ + intro L M O R X Y _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ d e D E B K ℓ p + hp hD hE hB hBp hK hℓ hR S b r₀ φ hS hpositive hO hreconstruct + let := E.metricSpace + dsimp only + intro ε hε hε1 + obtain ⟨q, hq, hpq, hlogq, hmemberq, hqC⟩ := hscalar p ε hp hε hε1 + obtain ⟨nO, hnO, oc, hcoverO⟩ := hO (ε / 3) (by positivity) (by linarith) + have hexp := Real.exp_le_exp.mpr hpq + have hBq : (B : ℝ) ≤ Real.exp ((q + 2) ^ r) := + hBp.trans (Real.exp_le_exp.mpr (pow_le_pow_left₀ (by linarith) (by linarith) r)) + have hεinv : 1 / ε ≤ Real.exp q := by + calc + 1 / ε = Real.exp (Real.log (1 / ε)) := (Real.exp_log (by positivity)).symm + _ ≤ _ := Real.exp_le_exp.mpr hlogq + have hnOq : (Fintype.card (Fin nO) : ℝ) ≤ Real.exp q := by + simpa only [Fintype.card_fin] using hnO.trans (Real.exp_le_exp.mpr hmemberq) + obtain ⟨n, hn, centers, hLip, hunit, hcap, heval, hcover⟩ := + hnet D E B K ℓ hq (hD.mono D hpq) (hE.mono E hpq) + hB hBq (hK.trans hexp) (hℓ.trans hexp) hε hεinv hnOq (hR.trans hexp) + S b r₀ φ oc hS hpositive hcoverO hreconstruct + exact ⟨n, hn.trans (Real.exp_le_exp.mpr hqC), centers, hLip, hunit, hcap, heval, hcover⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +theorem exists_uniform_controlled_native_external_nets_of_recovery (s t r netExponent : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L M O R X Y : Type*} + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + [Fintype R] [Nonempty X] [PseudoMetricSpace Y] {d e : ℕ} + (D : RationalFilteredNilmanifold L s d) (E : RationalFilteredNilmanifold M t e) + (B K ℓ : ℝ≥0) {p : ℝ}, + 0 ≤ p → D.GeometryComplexityLE p → E.GeometryComplexityLE p → + 1 ≤ B → (B : ℝ) ≤ Real.exp ((p + 2) ^ r) → + (K : ℝ) ≤ Real.exp p → (ℓ : ℝ) ≤ Real.exp p → + (Fintype.card R : ℝ) ≤ Real.exp p → + ∀ (S : O → D.Space → ℂ) (b : X → D.RealGroup) (r₀ : R → D.RealGroup) + (φ : X → Y × E.Space), + (∀ o, letI := D.metricSpace; LipschitzWith ℓ (S o)) → + (∀ o x, (S o x).im = 0 ∧ 0 ≤ (S o x).re ∧ (S o x).re ≤ 1) → + (∀ η : ℝ, 0 < η → η ≤ 1 → ∃ n : ℕ, + (n : ℝ) ≤ Real.exp ((p + Real.log (1 / η) + netExponent) ^ netExponent) ∧ + ∃ oc : Fin n → O, ∀ o, ∃ i, ∀ x, ‖S o x - S (oc i) x‖ ≤ η) → + letI := E.metricSpace + let A := coordinateBox (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) B + let F := fun o (a : A) j x => S o (QuotientGroup.mk (a.val * b x * r₀ j)) + (∀ o a j x, positiveImageSlice φ K (F o a j) (φ x).2 (φ x).1 = F o a j x) → + ∀ ε : ℝ, 0 < ε → ε ≤ 1 → + ∃ n : ℕ, (n : ℝ) ≤ Real.exp ((p + Real.log (1 / ε) + C) ^ C) ∧ ∃ centers : Fin n → Y → ℂ, + (∀ i, LipschitzWith K (centers i)) ∧ + (∀ i y, (centers i y).im = 0 ∧ 0 ≤ (centers i y).re ∧ (centers i y).re ≤ 1) ∧ + (∀ i y, ‖centers i y‖ ≤ 1) ∧ + (∀ o a j x, positiveImageSlice φ K (F o a j) (φ x).2 (φ x).1 = F o a j x) ∧ + ∀ o a j z, ∃ i, ∀ y, ‖positiveImageSlice φ K (F o a j) z y - centers i y‖ ≤ ε := by + obtain ⟨C, hC, hnet⟩ := exists_uniform_controlled_native_external_nets s t r netExponent + refine ⟨C, hC, ?_⟩ + intro L M O R X Y _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ d e D E B K ℓ p + hp hD hE hB hBp hK hℓ hR S b r₀ φ hS hpositive hO + let := E.metricSpace + dsimp only + intro hrecovery + apply hnet D E B K ℓ hp hD hE hB hBp hK hℓ hR S b r₀ φ hS hpositive hO + intro o a j + exact exists_lipschitz_reconstruction_of_positiveImageSlice_eq φ K + (fun x => S o (QuotientGroup.mk (a.val * b x * r₀ j))) + (fun x => (hpositive o _).2.1) (hrecovery o a j) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformFamilyMemberNet.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFamilyMemberNet.lean new file mode 100644 index 0000000000000000000000000000000000000000..8871fb127ba50016de070e6481c2f8a0556ad495 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFamilyMemberNet.lean @@ -0,0 +1,140 @@ +import Mathlib.Analysis.Complex.Basic +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Topology.MetricSpace.Lipschitz + +namespace OAI + +section + +namespace Erdos3 +open scoped NNReal + +theorem exists_uniform_family_member_net {X Y I : Type*} [Nonempty X] + (F : X → Y → ℂ) (centers : I → Y → ℂ) {ε : ℝ} + (hnet : ∀ x, ∃ i, ∀ y, ‖F x y - centers i y‖ ≤ ε) : + ∃ rep : I → X, ∀ x, ∃ i, ∀ y, ‖F x y - F (rep i) y‖ ≤ 2 * ε := by + classical + let occupied (i : I) : Prop := ∃ x, ∀ y, ‖F x y - centers i y‖ ≤ ε + let rep (i : I) : X := if h : occupied i then h.choose else Classical.choice inferInstance + have hrep (i : I) (hi : occupied i) : ∀ y, ‖F (rep i) y - centers i y‖ ≤ ε := by + simp only [rep, dite_eq_left hi] + exact hi.choose_spec + refine ⟨rep, ?_⟩ + intro x + obtain ⟨i, hi⟩ := hnet x + refine ⟨i, fun y => ?_⟩ + calc + ‖F x y - F (rep i) y‖ ≤ ‖F x y - centers i y‖ + ‖centers i y - F (rep i) y‖ := + norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ ε + ε := add_le_add (hi y) (by + rw [norm_sub_rev] + exact hrep i ⟨x, hi⟩ y) + _ = 2 * ε := by ring + +theorem exists_uniform_family_member_net_half {X Y I : Type*} [Nonempty X] + (F : X → Y → ℂ) (centers : I → Y → ℂ) {ε : ℝ} + (hnet : ∀ x, ∃ i, ∀ y, ‖F x y - centers i y‖ ≤ ε / 2) : + ∃ rep : I → X, ∀ x, ∃ i, ∀ y, ‖F x y - F (rep i) y‖ ≤ ε := by + simpa only [mul_div_cancel₀ _ (show (2 : ℝ) ≠ 0 by norm_num)] using + exists_uniform_family_member_net F centers hnet + +theorem exists_uniform_family_member_net_with_bounds {X Y I : Type*} [Nonempty X] + [PseudoMetricSpace Y] (F : X → Y → ℂ) (centers : I → Y → ℂ) + (K : ℝ≥0) {p ε : ℝ} (hK : (K : ℝ) ≤ Real.exp p) + (hLip : ∀ x, LipschitzWith K (F x)) + (hunit : ∀ x y, (F x y).im = 0 ∧ 0 ≤ (F x y).re ∧ (F x y).re ≤ 1) + (hnet : ∀ x, ∃ i, ∀ y, ‖F x y - centers i y‖ ≤ ε) : + ∃ rep : I → X, + (K : ℝ) ≤ Real.exp p ∧ + (∀ i, LipschitzWith K (F (rep i))) ∧ + (∀ i y, (F (rep i) y).im = 0 ∧ 0 ≤ (F (rep i) y).re ∧ + (F (rep i) y).re ≤ 1) ∧ + ∀ x, ∃ i, ∀ y, ‖F x y - F (rep i) y‖ ≤ 2 * ε := by + obtain ⟨rep, hrep⟩ := exists_uniform_family_member_net F centers hnet + exact ⟨rep, hK, fun i => hLip (rep i), fun i => hunit (rep i), hrep⟩ + +theorem exists_finite_uniform_family_member_net {X Y : Type*} [Nonempty X] + (F : X → Y → ℂ) {ε cost : ℝ} + (hnet : ∃ n : ℕ, (n : ℝ) ≤ Real.exp cost ∧ + ∃ centers : Fin n → Y → ℂ, ∀ x, ∃ i, ∀ y, ‖F x y - centers i y‖ ≤ ε) : + ∃ n : ℕ, (n : ℝ) ≤ Real.exp cost ∧ + ∃ rep : Fin n → X, ∀ x, ∃ i, ∀ y, ‖F x y - F (rep i) y‖ ≤ 2 * ε := by + obtain ⟨n, hn, centers, hcenters⟩ := hnet + obtain ⟨rep, hrep⟩ := exists_uniform_family_member_net F centers hcenters + exact ⟨n, hn, rep, hrep⟩ + +theorem exists_uniform_family_member_nets_exp_log {X Y : Type*} [Nonempty X] + (F : X → Y → ℂ) (cost : ℝ → ℝ) + (hnet : ∀ δ : ℝ, 0 < δ → ∃ n : ℕ, + (n : ℝ) ≤ Real.exp (cost (Real.log (1 / δ))) ∧ + ∃ centers : Fin n → Y → ℂ, ∀ x, ∃ i, ∀ y, ‖F x y - centers i y‖ ≤ δ) : + ∀ ε : ℝ, 0 < ε → ∃ n : ℕ, + (n : ℝ) ≤ Real.exp (cost (Real.log (2 / ε))) ∧ + ∃ rep : Fin n → X, ∀ x, ∃ i, ∀ y, ‖F x y - F (rep i) y‖ ≤ ε := by + intro ε hε + obtain ⟨n, hn, centers, hcenters⟩ := hnet (ε / 2) (by positivity) + obtain ⟨rep, hrep⟩ := exists_uniform_family_member_net_half F centers hcenters + refine ⟨n, ?_, rep, hrep⟩ + have he : 1 / (ε / 2) = 2 / ε := by field_simp + simpa only [he] using hn + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem uniformFamilyMemberNet_half_log_budget (E : ℕ) {p ε : ℝ} + (hp : 0 ≤ p) (hε : 0 < ε) (hε1 : ε ≤ 1) : + (p + Real.log (1 / (ε / 2)) + E) ^ E ≤ + (p + Real.log (1 / ε) + (E + 2 : ℕ)) ^ (E + 2) := by + have hrecip : 1 ≤ 1 / ε := (le_div_iff₀ hε).mpr (by simpa using hε1) + have hlogε : 0 ≤ Real.log (1 / ε) := Real.log_nonneg hrecip + have hlog2 : 0 ≤ Real.log 2 := Real.log_nonneg (by norm_num) + have hlog2le : Real.log 2 ≤ 1 := by + have := Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 2) + linarith + have hratio : 1 / (ε / 2) = (1 / ε) * 2 := by field_simp + rw [hratio, Real.log_mul (by positivity) (by norm_num)] + have hbase : 1 ≤ p + Real.log (1 / ε) + (E + 2 : ℕ) := by + push_cast + linarith [Nat.cast_nonneg (α := ℝ) E] + apply (pow_le_pow_left₀ (by positivity) + (show p + (Real.log (1 / ε) + Real.log 2) + (E : ℝ) ≤ + p + Real.log (1 / ε) + (E + 2 : ℕ) by push_cast; linarith) E).trans + exact pow_le_pow_right₀ hbase (by omega) + +theorem exists_uniform_family_member_net_of_polynomial_log + {O Y : Type*} [Nonempty O] (F : O → Y → ℂ) {p : ℝ} (hp : 0 ≤ p) (E : ℕ) + (hnet : ∀ η : ℝ, 0 < η → η ≤ 1 → ∃ n : ℕ, + (n : ℝ) ≤ Real.exp ((p + Real.log (1 / η) + E) ^ E) ∧ + ∃ centers : Fin n → Y → ℂ, ∀ o, ∃ i, ∀ y, ‖F o y - centers i y‖ ≤ η) + (ε : ℝ) (hε : 0 < ε) (hε1 : ε ≤ 1) : + ∃ n : ℕ, (n : ℝ) ≤ Real.exp + ((p + Real.log (1 / ε) + (E + 2 : ℕ)) ^ (E + 2)) ∧ + ∃ rep : Fin n → O, ∀ o, ∃ i, ∀ y, ‖F o y - F (rep i) y‖ ≤ ε := by + obtain ⟨n, hn, centers, hcenters⟩ := hnet (ε / 2) (by positivity) (by linarith) + obtain ⟨rep, hrep⟩ := exists_uniform_family_member_net_half F centers hcenters + exact ⟨n, hn.trans (Real.exp_le_exp.mpr + (uniformFamilyMemberNet_half_log_budget E hp hε hε1)), rep, hrep⟩ + +theorem exists_uniform_family_member_nets_polynomial_log (E : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {O Y : Type*} [Nonempty O] {p : ℝ}, 0 ≤ p → + ∀ F : O → Y → ℂ, + (∀ η : ℝ, 0 < η → η ≤ 1 → ∃ n : ℕ, + (n : ℝ) ≤ Real.exp ((p + Real.log (1 / η) + E) ^ E) ∧ + ∃ centers : Fin n → Y → ℂ, ∀ o, ∃ i, ∀ y, ‖F o y - centers i y‖ ≤ η) → + ∀ ε : ℝ, 0 < ε → ε ≤ 1 → ∃ n : ℕ, + (n : ℝ) ≤ Real.exp ((p + Real.log (1 / ε) + C) ^ C) ∧ + ∃ rep : Fin n → O, ∀ o, ∃ i, ∀ y, ‖F o y - F (rep i) y‖ ≤ ε := by + refine ⟨E + 2, by omega, ?_⟩ + intro O Y inst p hp F hnet ε hε hε1 + exact exists_uniform_family_member_net_of_polynomial_log F hp E hnet ε hε hε1 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformFastCoefficientSpec.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFastCoefficientSpec.lean new file mode 100644 index 0000000000000000000000000000000000000000..685c9a76a191690f80811f060efc5ca450348d2d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFastCoefficientSpec.lean @@ -0,0 +1,81 @@ +import OAI.Combinatorics.Progressions.Geometry.FastCoefficientDerivativeCoordinates + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix + +def UniformFastCoefficientCoordinateSpec (s C : ℕ) : Prop := + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) (w : σ → ℕ) + (hw : ∀ i, 0 < w i) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol w)) + (_hU : BasisBlockInvariant (F.reducedSquareSymbolBasis e ω hF w) (fun i => i.val.1) U.toSubmodule) + (v : κ → F.squareFiltration.quotientTop.PolynomialSymbol w) + (_hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) {H : ℕ} (_hH : 1 ≤ H) + (_hv : ∀ i j, RationalHeightLE ((F.reducedSquareSymbolBasis e ω hF w).repr (v i) j) H) + {p : ℝ} (_hp : 0 ≤ p) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hκ : (Fintype.card κ : ℝ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p), + ∃ d : ℕ, d ≤ Fintype.card ι * (s + 2) * (Fintype.card σ + 1) ^ (s + 1) ∧ + ∃ rows : Fin d → FirstCoefficientIndex w ω, Function.Injective rows ∧ + ∃ b : Basis (Fin d) ℝ (F.RealFirstCoefficientModule w ⧸ + F.realFirstCoefficientFastSubmodule w hw (F.reducedSquareFastRelativeSubmodule w U)), + ∃ R : (Fin d → ℝ) →ₗ[ℝ] F.RealFirstCoefficientModule w, + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + (∀ l x, F.FirstCoefficientGrid e ω hF w l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ x) ∈ realDenominatorGrid (m * l)) ∧ + (∀ l (y : Fin d → ℝ), y ∈ realDenominatorGrid l → + F.FirstCoefficientGrid e ω hF w (m * l) (R y)) ∧ + (∀ y : Fin d → ℝ, (F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ (R y) = b.equivFun.symm y) ∧ + (∀ (T : σ → ℝ), (∀ i, 0 < T i) → ∀ M : ℝ, 0 ≤ M → + (∀ x, F.FirstCoefficientSlowBound e ω hF w T M x → ∀ i, + |b.equivFun ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ x) i| ≤ + Real.exp ((p + C) ^ C) * M / monomialScale T (rows i).val.1) ∧ + (∀ y : Fin d → ℝ, (∀ i, |y i| ≤ M / monomialScale T (rows i).val.1) → + F.FirstCoefficientSlowBound e ω hF w T (Real.exp ((p + C) ^ C) * M) (R y))) ∧ + (∀ i j, (rows j).val.1 ≠ i.val.1 → + b.repr ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ + (F.realFirstCoefficientBasis e ω hF w i)) j = 0) ∧ + ∀ (g : F.RealAdaptedPolynomialGroup w) + (hg : (F.adaptedReducedRealSymbolHom w g).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra w U)) + (a c : Fin d), ω (rows a).val.2 ≤ ω (rows c).val.2 → + LinearMap.toMatrix b b (F.realFastCoefficientAdjoint w hw U g hg).toLinearMap a c = + (1 : Matrix (Fin d) (Fin d) ℝ) a c + +theorem exists_uniform_fast_coefficient_coordinate_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ UniformFastCoefficientCoordinateSpec s C := by + obtain ⟨C, hC, hspec⟩ := exists_fast_coefficient_coordinate_bound s + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F e ω hF w hw U hU v hspan H hH hv p hp hι hσ hκ hHp + have hOne : ((1 : ℕ) : ℝ) ≤ Real.exp p := by simpa only [Nat.cast_one] using Real.one_le_exp hp + have hraw := hspec F e ω hF w hw U hU v hspan hH hv hp hι hσ hκ hHp 1 (by decide) hOne + obtain ⟨d, hdim, rows, hinj, b, R, m, hm, hmp, _, hproj, hlift, hright, hweighted, hblock, haction⟩ := hraw + classical + let : Fintype (FirstCoefficientIndex w ω) := + firstCoefficientIndexFintype w ω (s + 1) hw (F.adaptedBasis_weight_le_step e ω hF) + refine ⟨d, hdim, rows, hinj, b, R, m, hm, hmp, ?_, ?_, hright, hweighted, hblock, haction⟩ + · intro l x hx + exact linearMap_grid_of_integer (F.realFirstCoefficientBasis e ω hF w).equivFun.toLinearMap + (b.equivFun.toLinearMap.comp (F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ) m hproj l x hx + · intro l y hy + exact linearMap_grid_of_integer (LinearMap.id : (Fin d → ℝ) →ₗ[ℝ] (Fin d → ℝ)) + ((F.realFirstCoefficientBasis e ω hF w).equivFun.toLinearMap.comp R) m hlift l y hy + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformFiniteMarkedFactorParameters.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFiniteMarkedFactorParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..74ba208a87a6a9037db2f95c84c553b9a6145930 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFiniteMarkedFactorParameters.lean @@ -0,0 +1,508 @@ +import OAI.Combinatorics.Progressions.Dynamics.FilteredSectionSingleDenominatorBudget +import OAI.Combinatorics.Progressions.Lattices.RefilteredResidueExpansionSpec +import OAI.Combinatorics.Progressions.Linear.ActualMarkedSlowKernelCells +import OAI.Combinatorics.Progressions.Sampling.BoundedKernelGridEnumerationBudget +import OAI.Combinatorics.Progressions.Sampling.MarkedKernelRationalGrid + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +def MarkedRationalFactorFreezing + {σ κ L T : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing T] [LieAlgebra ℚ T] + {s d t : ℕ} (D : RationalFilteredNilmanifold L s d) + (F : NilpotentLieFiltration T t) (c : Basis κ ℚ T) (φ : L →ₗ⁅ℚ⁆ T) + (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j) + (w : σ → ℕ) (S : T →ₗ[ℚ] L) + (hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j) + (l : ℕ) (B : ℝ) : Prop := + ∃ M m : ℕ, 0 < M ∧ 0 < m ∧ (M : ℝ) ≤ B ∧ (m : ℝ) ≤ B ∧ + ∀ (R : (D.filtration.realification.adaptedPolynomialFiltration w).Group) + (RF : (F.realification.adaptedPolynomialFiltration w).Group), + D.filtration.PolynomialRationalGrid D.basis w l R → + F.PolynomialRationalGrid c w l RF → + D.filtration.realPolynomialGroupMap F φ hφ w R = RF → + ∃ r : (σ → ZMod M) → D.RealGroup, + (∀ a, realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := F.lowerCentralSeries_eq_bot) φ (r a) = 1 ∧ + (∀ i, |(D.basis.baseChange ℝ).repr (r a).coord i| ≤ B) ∧ + (D.basis.baseChange ℝ).equivFun (r a).coord ∈ realDenominatorGrid m) ∧ + ∀ x : σ → ℤ, ∃ γ ∈ D.realLattice, + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) + ((D.filtration.filteredRealPolynomialSection F w S hS RF)⁻¹ * R) = + r (fun j => (x j : ZMod M)) * γ ∧ + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) R = + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) + (D.filtration.filteredRealPolynomialSection F w S hS RF) * + r (fun j => (x j : ZMod M)) * γ + +theorem exists_native_marked_rational_factor_freezing_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ κ L T : Type*} [Fintype σ] [Fintype κ] + [LieRing L] [LieAlgebra ℚ L] [LieRing T] [LieAlgebra ℚ T] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d t : ℕ} (D : RationalFilteredNilmanifold L s d) + (F : NilpotentLieFiltration T t) (c : Basis κ ℚ T) + (ω : Fin d → ℕ) + (_hlayers : ∀ j, D.filtration.layer j = Submodule.span ℚ (D.basis '' {i | j ≤ ω i})) + (φ : L →ₗ⁅ℚ⁆ T) (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j) + (w : σ → ℕ), (∀ i, 0 < w i) → ∀ p : ℝ, + 0 ≤ p → D.GeometryComplexityLE p → (Fintype.card σ : ℝ) ≤ p → + (Fintype.card κ : ℝ) ≤ p → + (∀ i j, rationalLogHeight (c.repr (φ (D.basis j)) i) ≤ p) → + ∀ (S : T →ₗ[ℚ] L) (hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j), + Function.RightInverse S φ → + (∀ i j, RationalHeightLE (D.basis.repr (S (c j)) i) + (rationalKernelHeight (Fintype.card κ) ⌈Real.exp p⌉₊)) → + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + D.MarkedRationalFactorFreezing F c φ hφ w S hS l (Real.exp ((p + C) ^ C)) := by + obtain ⟨a, _, hgrid⟩ := NilpotentLieFiltration.exists_marked_kernel_rational_grid_bound s + obtain ⟨b, _, hreps⟩ := exists_native_marked_kernel_residue_representatives s + let U : Polynomial ℕ := (Polynomial.X + 3) ^ 11 + let V : Polynomial ℕ := (U + Polynomial.C a) ^ a + U + let P : Polynomial ℕ := (V + Polynomial.C b) ^ b + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ κ L T _ _ _ _ _ _ _ _ _ _ d t D F c ω hlayers φ hφ w hw p hp hD hσ hκ hφb + S hS hright hSb l hl hlp + classical + let p0 := p + 1 + let u := (p0 + 2) ^ 11 + let v := (u + a) ^ a + u + let H := ⌈Real.exp p⌉₊ + have hp0 : 0 ≤ p0 := by dsimp [p0]; positivity + have hu : 0 ≤ u := by dsimp [u]; positivity + have hpu : p ≤ u := (show p ≤ p0 by dsimp [p0]; linarith).trans + (le_power_budget hp0 (by decide : 1 ≤ 11)) + have huv : u ≤ v := le_add_of_nonneg_left (by positivity) + have hpv : p ≤ v := hpu.trans huv + have hv : 0 ≤ v := hu.trans huv + have hd0 : (Fintype.card (Fin d) : ℝ) ≤ p0 := by + simpa only [Fintype.card_fin] using hD.1.trans (show p ≤ p0 by dsimp [p0]; linarith) + have hκ0 : (Fintype.card κ : ℝ) ≤ p0 := hκ.trans (by dsimp [p0]; linarith) + have hH : (H : ℝ) ≤ Real.exp p0 := ceil_exp_le_exp_add_one hp + have hφH : ∀ i j, RationalHeightLE (c.repr (φ (D.basis j)) i) H := + fun i j => rationalHeightLE_ceil_exp (hφb i j) + have hden : ((matrixDenominator (LinearMap.toMatrix c D.basis S) * l : ℕ) : ℝ) ≤ + Real.exp u := by + apply filtered_section_single_denominator_le_exp + (LinearMap.toMatrix D.basis c φ.toLinearMap) (LinearMap.toMatrix c D.basis S) l + hp0 hd0 hκ0 hH + · intro i j + rw [LinearMap.toMatrix_apply] + exact hφH i j + · simpa only [LinearMap.toMatrix_apply] using hSb + · exact hlp.trans (Real.exp_le_exp.mpr (by dsimp [p0]; linarith)) + have hHpu : (H : ℝ) ≤ Real.exp u := hH.trans + (Real.exp_le_exp.mpr (le_power_budget hp0 (by decide : 1 ≤ 11))) + obtain ⟨q, hq, hqb, _, hqgrid⟩ := hgrid D.filtration F D.basis c ω hlayers w hw H u + (one_le_ceil_exp p) hu (by simpa only [Fintype.card_fin] using hD.1.trans hpu) + (hσ.trans hpu) hHpu (fun i j k => rationalHeightLE_ceil_exp (hD.2.2.1 i j k)) + S hS l hl hden + have hqv : (q : ℝ) ≤ Real.exp v := hqb.trans + (Real.exp_le_exp.mpr (le_add_of_nonneg_right hu)) + obtain ⟨M, m, hM, hm, hMb, hmb, hfreeze⟩ := hreps D F c φ w hw v hv + (GeometryComplexityLE.mono D hD hpv) (hσ.trans hpv) (hκ.trans hpv) + (fun i j => (hφb i j).trans hpv) q hq hqv + have hb : (v + b) ^ b ≤ (p + C) ^ C := by + simpa [P, V, U, v, u, p0, Polynomial.eval₂_pow, add_assoc, + show (1 : ℝ) + 2 = 3 by norm_num] using hbudget p hp + refine ⟨M, m, hM, hm, hMb.trans (Real.exp_le_exp.mpr hb), + hmb.trans (Real.exp_le_exp.mpr hb), ?_⟩ + intro R RF hR hRF hmark + let KR := (D.filtration.filteredRealPolynomialSection F w S hS RF)⁻¹ * R + have hKR : D.filtration.realPolynomialGroupMap F φ hφ w KR = 1 := by + dsimp only [KR] + rw [map_mul, map_inv, hmark, + D.filtration.realPolynomialGroupMap_filteredSection F w φ hφ S hS hright RF, + inv_mul_cancel] + have hpoint (x : σ → ℤ) : realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := F.lowerCentralSeries_eq_bot) φ + (D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) KR) = 1 := by + rw [← D.filtration.realPolynomialGroupMap_value F φ hφ w, hKR, map_one] + obtain ⟨r, hr, hfac⟩ := hfreeze KR (hqgrid R RF hR hRF) hpoint + refine ⟨r, fun z => ⟨(hr z).1, fun i => ((hr z).2.1 i).trans + (Real.exp_le_exp.mpr hb), (hr z).2.2⟩, ?_⟩ + intro x + obtain ⟨γ, hγ, heq⟩ := hfac x + refine ⟨γ, hγ, heq, ?_⟩ + have heq' := heq + dsimp only [KR] at heq' + rw [map_mul, map_inv] at heq' + calc + _ = D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) + (D.filtration.filteredRealPolynomialSection F w S hS RF) * + (r (fun j => (x j : ZMod M)) * γ) := by + rw [← heq'] + group + _ = _ := (mul_assoc _ _ _).symm + +theorem exists_native_marked_rational_factor_freezing (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ κ L T : Type*} [Fintype σ] [Fintype κ] + [LieRing L] [LieAlgebra ℚ L] [LieRing T] [LieAlgebra ℚ T] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d t : ℕ} (D : RationalFilteredNilmanifold L s d) + (F : NilpotentLieFiltration T t) (c : Basis κ ℚ T) + (ω : Fin d → ℕ) + (_hDlayers : ∀ j, D.filtration.layer j = Submodule.span ℚ (D.basis '' {i | j ≤ ω i})) + (τ : κ → ℕ) (_hFlayers : ∀ j, F.layer j = Submodule.span ℚ (c '' {i | j ≤ τ i})) + (φ : L →ₗ⁅ℚ⁆ T) (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j), + (∀ j, ∀ y ∈ F.layer j, ∃ x ∈ D.filtration.layer j, φ x = y) → + ∀ w : σ → ℕ, (∀ i, 0 < w i) → ∀ p : ℝ, + 0 ≤ p → D.GeometryComplexityLE p → (Fintype.card σ : ℝ) ≤ p → + (Fintype.card κ : ℝ) ≤ p → + (∀ i j, rationalLogHeight (c.repr (φ (D.basis j)) i) ≤ p) → + ∃ (S : T →ₗ[ℚ] L) (hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j), + Function.RightInverse S φ ∧ + (∀ i j, RationalHeightLE (D.basis.repr (S (c j)) i) + (rationalKernelHeight (Fintype.card κ) ⌈Real.exp p⌉₊)) ∧ + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + D.MarkedRationalFactorFreezing F c φ hφ w S hS l (Real.exp ((p + C) ^ C)) := by + obtain ⟨C, hC, hfreeze⟩ := exists_native_marked_rational_factor_freezing_bound s + refine ⟨C, hC, ?_⟩ + intro σ κ L T _ _ _ _ _ _ _ _ _ _ d t D F c ω hDlayers τ hFlayers φ hφ hsurj + w hw p hp hD hσ hκ hφb + obtain ⟨S, hright, hS, hSb⟩ := D.filtration.exists_bounded_filtered_section F D.basis ω + hDlayers c τ hFlayers φ.toLinearMap hsurj (one_le_ceil_exp p) + (fun i j => rationalHeightLE_ceil_exp (hφb i j)) + exact ⟨S, hS, hright, hSb, + hfreeze D F c ω hDlayers φ hφ w hw p hp hD hσ hκ hφb S hS hright hSb⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +theorem MarkedRationalFactorFreezing.finite_enumeration + {σ κ L T : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing T] [LieAlgebra ℚ T] + {s d t : ℕ} (D : RationalFilteredNilmanifold L s d) + (F : NilpotentLieFiltration T t) (c : Basis κ ℚ T) (φ : L →ₗ⁅ℚ⁆ T) + (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j) + (w : σ → ℕ) (S : T →ₗ[ℚ] L) + (hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j) + (l : ℕ) {B p : ℝ} (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) (hB : B ≤ Real.exp p) + (hfreeze : D.MarkedRationalFactorFreezing F c φ hφ w S hS l B) : + ∃ M m n : ℕ, 0 < M ∧ 0 < m ∧ 0 < n ∧ + (M : ℝ) ≤ B ∧ (m : ℝ) ≤ B ∧ (n : ℝ) ≤ Real.exp ((p + 2) ^ 3) ∧ + ∃ center : Fin n → D.RealGroup, + (∀ a, realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := F.lowerCentralSeries_eq_bot) φ (center a) = 1 ∧ + (∀ i, |(D.basis.baseChange ℝ).repr (center a).coord i| ≤ B) ∧ + (D.basis.baseChange ℝ).equivFun (center a).coord ∈ realDenominatorGrid m) ∧ + ∀ (R : (D.filtration.realification.adaptedPolynomialFiltration w).Group) + (RF : (F.realification.adaptedPolynomialFiltration w).Group), + D.filtration.PolynomialRationalGrid D.basis w l R → + F.PolynomialRationalGrid c w l RF → + D.filtration.realPolynomialGroupMap F φ hφ w R = RF → + ∃ label : (σ → ZMod M) → Fin n, + ∀ x : σ → ℤ, ∃ γ ∈ D.realLattice, + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) + ((D.filtration.filteredRealPolynomialSection F w S hS RF)⁻¹ * R) = + center (label (fun j => (x j : ZMod M))) * γ ∧ + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) R = + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) + (D.filtration.filteredRealPolynomialSection F w S hS RF) * + center (label (fun j => (x j : ZMod M))) * γ := by + classical + obtain ⟨M, m, hM, hm, hMb, hmb, hfactor⟩ := hfreeze + have hB0 : 0 ≤ B := (Nat.cast_nonneg m).trans hmb + obtain ⟨n, hn, hnb, center, hcenters, hcover⟩ := + exists_bounded_kernel_grid_enumeration_exp (D.basis.baseChange ℝ) + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := F.lowerCentralSeries_eq_bot) φ) m hm hp hB0 + (by simpa only [Fintype.card_fin] using hd) (hmb.trans hB) hB + refine ⟨M, m, n, hM, hm, hn, hMb, hmb, hnb, center, hcenters, ?_⟩ + intro R RF hR hRF hmark + obtain ⟨r, hr, hfac⟩ := hfactor R RF hR hRF hmark + choose label hlabel using fun a => hcover (r a) (hr a).1 (hr a).2.1 (hr a).2.2 + refine ⟨label, ?_⟩ + intro x + obtain ⟨γ, hγ, hKR, hRfac⟩ := hfac x + refine ⟨γ, hγ, ?_, ?_⟩ + · simpa only [hlabel] using hKR + · simpa only [hlabel] using hRfac + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold +open Module + +theorem MarkedRationalFactorFreezing.mono + {σ κ L T : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing T] [LieAlgebra ℚ T] + {s d t : ℕ} {D : RationalFilteredNilmanifold L s d} + {F : NilpotentLieFiltration T t} {c : Basis κ ℚ T} {φ : L →ₗ⁅ℚ⁆ T} + {hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j} + {w : σ → ℕ} {S : T →ₗ[ℚ] L} + {hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j} + {l : ℕ} {B B' : ℝ} + (h : D.MarkedRationalFactorFreezing F c φ hφ w S hS l B) (hBB' : B ≤ B') : + D.MarkedRationalFactorFreezing F c φ hφ w S hS l B' := by + obtain ⟨M, m, hM, hm, hMB, hmB, hfreeze⟩ := h + refine ⟨M, m, hM, hm, hMB.trans hBB', hmB.trans hBB', ?_⟩ + intro R RF hR hRF hmark + obtain ⟨r, hr, hfac⟩ := hfreeze R RF hR hRF hmark + exact ⟨r, fun a => ⟨(hr a).1, fun i => ((hr a).2.1 i).trans hBB', (hr a).2.2⟩, + hfac⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +def MarkedSlowFactorFreezing + {σ κ L T : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + [LieRing T] [LieAlgebra ℚ T] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {s d t : ℕ} (D : RationalFilteredNilmanifold L s d) + (F : NilpotentLieFiltration T t) (c : Basis κ ℚ T) (φ : L →ₗ⁅ℚ⁆ T) + (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j) + (w : σ → ℕ) (S : T →ₗ[ℚ] L) + (hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j) + (Tbox : σ → ℝ) (A ε B : ℝ) : Prop := + letI := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + ∃ N Q : ℕ, 0 < N ∧ 0 < Q ∧ + (Fintype.card (Fin d → Fin (N + 1)) : ℝ) ≤ B ∧ + (Fintype.card (σ → Fin (Q + 1)) : ℝ) ≤ B ∧ + ∃ center : (Fin d → Fin (N + 1)) → D.RealGroup, + (∀ j, realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := F.lowerCentralSeries_eq_bot) φ (center j) = 1) ∧ + (∀ j i, |(D.basis.baseChange ℝ).repr (center j).coord i| ≤ B) ∧ + ∀ (E : (D.filtration.realification.adaptedPolynomialFiltration w).Group) + (EF : (F.realification.adaptedPolynomialFiltration w).Group), + D.filtration.PolynomialSlowBound D.basis w Tbox A E → + F.PolynomialSlowBound c w Tbox A EF → + D.filtration.realPolynomialGroupMap F φ hφ w E = EF → + ∃ label : (σ → Fin (Q + 1)) → (Fin d → Fin (N + 1)), + ∀ j (v : σ → ℝ), (∀ i, |v i| ≤ Tbox i) → + (∀ i, |v i - normalizedRealBoxGrid Tbox Q j i| ≤ Tbox i * (2 / Q)) → + dist (D.filtration.adaptedPolynomialRealValueHom w v + (E * (D.filtration.filteredRealPolynomialSection F w S hS EF)⁻¹)) + (center (label j)) ≤ ε + +theorem exists_uniform_marked_factor_parameters (s a u : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ κ L T : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] + [LieRing L] [LieAlgebra ℚ L] [LieRing T] [LieAlgebra ℚ T] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d t : ℕ} (D : RationalFilteredNilmanifold L s d) + (F : NilpotentLieFiltration T t) (c : Basis κ ℚ T) + (ω : Fin d → ℕ) + (_hDlayers : ∀ j, D.filtration.layer j = Submodule.span ℚ (D.basis '' {i | j ≤ ω i})) + (τ : κ → ℕ) (_hFlayers : ∀ j, F.layer j = Submodule.span ℚ (c '' {i | j ≤ τ i})) + (φ : L →ₗ⁅ℚ⁆ T) (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j), + (∀ j, ∀ y ∈ F.layer j, ∃ x ∈ D.filtration.layer j, φ x = y) → + ∀ w : σ → ℕ, (∀ i, 0 < w i) → ∀ p : ℝ, + 0 ≤ p → D.GeometryComplexityLE p → (Fintype.card σ : ℝ) ≤ p → + (Fintype.card κ : ℝ) ≤ p → + (∀ i j, rationalLogHeight (c.repr (φ (D.basis j)) i) ≤ p) → + ∃ (S : T →ₗ[ℚ] L) (hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j), + Function.RightInverse S φ ∧ + (∀ i j, RationalHeightLE (D.basis.repr (S (c j)) i) + (rationalKernelHeight (Fintype.card κ) ⌈Real.exp p⌉₊)) ∧ + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + ∀ Tbox : σ → ℝ, (∀ i, 0 < Tbox i) → + D.MarkedRationalFactorFreezing F c φ hφ w S hS l (Real.exp ((p + C) ^ C)) ∧ + D.MarkedSlowFactorFreezing F c φ hφ w S hS Tbox + (Real.exp ((p + 2) ^ a)) (Real.exp (-((p + 2) ^ u))) + (Real.exp ((p + C) ^ C)) := by + obtain ⟨A, _, hrat⟩ := exists_native_marked_rational_factor_freezing s + obtain ⟨B, _, hslow⟩ := NilpotentLieFiltration.exists_actual_marked_slow_kernel_cells s (max a 7) u + let P : Polynomial ℕ := (Polynomial.X + Polynomial.C A) ^ A + + (Polynomial.X + 1 + Polynomial.C B) ^ B + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ κ L T _ _ _ _ _ _ _ _ _ _ _ d t D F c ω hDlayers τ hFlayers φ hφ hsurj + w hw p hp hD hσ hκ hφb + classical + obtain ⟨S, hS, hright, hSb, hratS⟩ := hrat D F c ω hDlayers τ hFlayers φ hφ hsurj + w hw p hp hD hσ hκ hφb + have hsum : (p + A) ^ A + (p + 1 + B) ^ B ≤ (p + C) ^ C := by + simpa [P, Polynomial.eval₂_pow] using hbudget p hp + have hA : (p + A) ^ A ≤ (p + C) ^ C := + (le_add_of_nonneg_right (by positivity : 0 ≤ (p + 1 + B) ^ B)).trans hsum + have hB : (p + 1 + B) ^ B ≤ (p + C) ^ C := + (le_add_of_nonneg_left (by positivity : 0 ≤ (p + A) ^ A)).trans hsum + refine ⟨S, hS, hright, hSb, ?_⟩ + intro l hl hlp Tbox hT + refine ⟨(hratS l hl hlp).mono (Real.exp_le_exp.mpr hA), ?_⟩ + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + let H := ⌈Real.exp p⌉₊ + have hp1 : 0 ≤ p + 1 := by positivity + have hp_le : p ≤ p + 1 := by linarith + have hH : (H : ℝ) ≤ Real.exp (p + 1) := ceil_exp_le_exp_add_one hp + have hK := rationalKernelHeight_le_budget (Fintype.card κ) H hp1 (hκ.trans hp_le) hH + have hentry : ∀ i j, |(D.basis.repr (S (c j)) i : ℝ)| ≤ + Real.exp (((p + 1) + 2) ^ max a 7) := by + intro i j + apply ((hSb i j).abs_real_le.trans hK).trans + apply Real.exp_le_exp.mpr + exact pow_le_pow_right₀ (by linarith : 1 ≤ (p + 1) + 2) (le_max_right _ _) + obtain ⟨N, Q, hN, hQ, hNcard, hQcard, center, hmark, hcap, hfreeze⟩ := + hslow D.filtration F D.basis c ω hDlayers w hw φ hφ S hS hright H (p + 1) + (one_le_ceil_exp p) hp1 (by simpa only [Fintype.card_fin] using hD.1.trans hp_le) + (hκ.trans hp_le) (hσ.trans hp_le) hH + (fun i j k => rationalHeightLE_ceil_exp (hD.2.2.1 i j k)) hentry Tbox hT + refine ⟨N, Q, hN, hQ, hNcard.trans (Real.exp_le_exp.mpr hB), + hQcard.trans (Real.exp_le_exp.mpr hB), center, hmark, + fun j i => (hcap j i).trans (Real.exp_le_exp.mpr hB), ?_⟩ + intro E EF hE hEF hproj + have hinput : Real.exp ((p + 2) ^ a) ≤ Real.exp (((p + 1) + 2) ^ max a 7) := by + apply Real.exp_le_exp.mpr + exact (pow_le_pow_left₀ (by linarith : 0 ≤ p + 2) + (by linarith : p + 2 ≤ (p + 1) + 2) a).trans + (pow_le_pow_right₀ (by linarith : 1 ≤ (p + 1) + 2) (le_max_left _ _)) + obtain ⟨label, hlabel⟩ := hfreeze E EF + (D.filtration.polynomialSlowBound_mono D.basis w Tbox hT hinput E hE) + (F.polynomialSlowBound_mono c w Tbox hT hinput EF hEF) hproj + refine ⟨label, ?_⟩ + intro j v hv hvj + apply (hlabel j v hv hvj).trans + apply Real.exp_le_exp.mpr + exact neg_le_neg (pow_le_pow_left₀ (by linarith : 0 ≤ p + 2) + (by linarith : p + 2 ≤ (p + 1) + 2) u) + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold +open Module NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +def FiniteMarkedRationalFactorFreezing + {σ κ L T : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing T] [LieAlgebra ℚ T] + {s d t : ℕ} (D : RationalFilteredNilmanifold L s d) + (F : NilpotentLieFiltration T t) (c : Basis κ ℚ T) (φ : L →ₗ⁅ℚ⁆ T) + (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j) + (w : σ → ℕ) (S : T →ₗ[ℚ] L) + (hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j) + (l : ℕ) (B : ℝ) : Prop := + ∃ M m n : ℕ, 0 < M ∧ 0 < m ∧ 0 < n ∧ + (M : ℝ) ≤ B ∧ (m : ℝ) ≤ B ∧ (n : ℝ) ≤ B ∧ + ∃ center : Fin n → D.RealGroup, + (∀ a, realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := F.lowerCentralSeries_eq_bot) φ (center a) = 1 ∧ + (∀ i, |(D.basis.baseChange ℝ).repr (center a).coord i| ≤ B) ∧ + (D.basis.baseChange ℝ).equivFun (center a).coord ∈ realDenominatorGrid m) ∧ + ∀ (R : (D.filtration.realification.adaptedPolynomialFiltration w).Group) + (RF : (F.realification.adaptedPolynomialFiltration w).Group), + D.filtration.PolynomialRationalGrid D.basis w l R → + F.PolynomialRationalGrid c w l RF → + D.filtration.realPolynomialGroupMap F φ hφ w R = RF → + ∃ label : (σ → ZMod M) → Fin n, + ∀ x : σ → ℤ, ∃ γ ∈ D.realLattice, + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) + ((D.filtration.filteredRealPolynomialSection F w S hS RF)⁻¹ * R) = + center (label (fun j => (x j : ZMod M))) * γ ∧ + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) R = + D.filtration.adaptedPolynomialRealValueHom w (fun j => (x j : ℝ)) + (D.filtration.filteredRealPolynomialSection F w S hS RF) * + center (label (fun j => (x j : ZMod M))) * γ + +theorem MarkedSlowFactorFreezing.mono_bound + {σ κ L T : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + [LieRing T] [LieAlgebra ℚ T] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {s d t : ℕ} {D : RationalFilteredNilmanifold L s d} + {F : NilpotentLieFiltration T t} {c : Basis κ ℚ T} {φ : L →ₗ⁅ℚ⁆ T} + {hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j} + {w : σ → ℕ} {S : T →ₗ[ℚ] L} + {hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j} + {Tbox : σ → ℝ} {A ε B B' : ℝ} + (h : D.MarkedSlowFactorFreezing F c φ hφ w S hS Tbox A ε B) (hBB' : B ≤ B') : + D.MarkedSlowFactorFreezing F c φ hφ w S hS Tbox A ε B' := by + obtain ⟨N, Q, hN, hQ, hNc, hQc, center, hmark, hcap, hfreeze⟩ := h + exact ⟨N, Q, hN, hQ, hNc.trans hBB', hQc.trans hBB', center, hmark, + fun j i => (hcap j i).trans hBB', hfreeze⟩ + +theorem exists_uniform_finite_marked_factor_parameters (s a u : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ κ L T : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] + [LieRing L] [LieAlgebra ℚ L] [LieRing T] [LieAlgebra ℚ T] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d t : ℕ} (D : RationalFilteredNilmanifold L s d) + (F : NilpotentLieFiltration T t) (c : Basis κ ℚ T) + (ω : Fin d → ℕ) + (_hDlayers : ∀ j, D.filtration.layer j = Submodule.span ℚ (D.basis '' {i | j ≤ ω i})) + (τ : κ → ℕ) (_hFlayers : ∀ j, F.layer j = Submodule.span ℚ (c '' {i | j ≤ τ i})) + (φ : L →ₗ⁅ℚ⁆ T) (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ F.layer j), + (∀ j, ∀ y ∈ F.layer j, ∃ x ∈ D.filtration.layer j, φ x = y) → + ∀ w : σ → ℕ, (∀ i, 0 < w i) → ∀ p : ℝ, + 0 ≤ p → D.GeometryComplexityLE p → (Fintype.card σ : ℝ) ≤ p → + (Fintype.card κ : ℝ) ≤ p → + (∀ i j, rationalLogHeight (c.repr (φ (D.basis j)) i) ≤ p) → + ∃ (S : T →ₗ[ℚ] L) (hS : ∀ j, ∀ y ∈ F.layer j, S y ∈ D.filtration.layer j), + Function.RightInverse S φ ∧ + (∀ i j, RationalHeightLE (D.basis.repr (S (c j)) i) + (rationalKernelHeight (Fintype.card κ) ⌈Real.exp p⌉₊)) ∧ + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + ∀ Tbox : σ → ℝ, (∀ i, 0 < Tbox i) → + D.FiniteMarkedRationalFactorFreezing F c φ hφ w S hS l (Real.exp ((p + C) ^ C)) ∧ + D.MarkedSlowFactorFreezing F c φ hφ w S hS Tbox + (Real.exp ((p + 2) ^ a)) (Real.exp (-((p + 2) ^ u))) + (Real.exp ((p + C) ^ C)) := by + obtain ⟨A, hA, hparams⟩ := exists_uniform_marked_factor_parameters s a u + let X : Polynomial ℕ := Polynomial.X + let U := (X + Polynomial.C A) ^ A + let P := U + (X + U + 2) ^ 3 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro σ κ L T _ _ _ _ _ _ _ _ _ _ _ d t D F c ω hDlayers τ hFlayers φ hφ hsurj + w hw p hp hD hσ hκ hφb + obtain ⟨S, hS, hright, hSb, hboth⟩ := hparams D F c ω hDlayers τ hFlayers φ hφ hsurj + w hw p hp hD hσ hκ hφb + refine ⟨S, hS, hright, hSb, ?_⟩ + intro l hl hlp Tbox hT + obtain ⟨hrat, hslow⟩ := hboth l hl hlp Tbox hT + let q := p + (p + A) ^ A + have hAp : 0 ≤ (p + A) ^ A := by positivity + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := le_add_of_nonneg_right hAp + have hAq : (p + A) ^ A ≤ q := le_add_of_nonneg_left hp + have hbud : (p + A) ^ A + (q + 2) ^ 3 ≤ (p + C) ^ C := by + simpa [P, U, X, q, Polynomial.eval₂_pow] using hbudget p hp + have hAcap : (p + A) ^ A ≤ (p + C) ^ C := by + have : 0 ≤ (q + 2) ^ 3 := by positivity + linarith + have hqcap : (q + 2) ^ 3 ≤ (p + C) ^ C := by linarith + have hBB : Real.exp ((p + A) ^ A) ≤ Real.exp ((p + C) ^ C) := Real.exp_le_exp.mpr hAcap + refine ⟨?_, hslow.mono_bound hBB⟩ + obtain ⟨M, m, n, hM, hm, hn, hMb, hmb, hnb, center, hcenter, hfac⟩ := + MarkedRationalFactorFreezing.finite_enumeration D F c φ hφ w S hS l hq + (hD.1.trans hpq) (Real.exp_le_exp.mpr hAq) hrat + exact ⟨M, m, n, hM, hm, hn, hMb.trans hBB, hmb.trans hBB, + hnb.trans (Real.exp_le_exp.mpr hqcap), center, + fun j => ⟨(hcenter j).1, fun i => ((hcenter j).2.1 i).trans hBB, (hcenter j).2.2⟩, hfac⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformFormalCurrentLayerStep.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFormalCurrentLayerStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..0bb481d03d3dd63d7a66bd79eb0396948a88deff --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFormalCurrentLayerStep.lean @@ -0,0 +1,870 @@ +import OAI.Combinatorics.Progressions.Dynamics.CurrentLayerBudget +import OAI.Combinatorics.Progressions.Estimates.FormalCurrentDerivativeAdvance +import OAI.Combinatorics.Progressions.Geometry.CoordinateDerivativeBounds +import OAI.Combinatorics.Progressions.Polynomial.ControlledCurrentLayerPolynomialStep + +namespace OAI + +section + +namespace Erdos3 + +open Module VectorPolynomial +open scoped TensorProduct + +theorem controlled_zero_sum_separation {ι : Type*} [Fintype ι] + {l : ℕ} (hl : 0 < l) {p : ℝ} (hp : 0 ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) (hlp : (l : ℝ) ≤ Real.exp p) + (a b : ι → ℝ) (ha : ‖a‖ ≤ Real.exp p / Real.exp (separationBudget p)) + (hb : b ∈ realDenominatorGrid l) (hsum : a + b = 0) : a = 0 ∧ b = 0 := by + have h := controlled_small_vector_separation (0 : Matrix ι Empty ℚ) + (H := 1) (by omega) hl (by intro i j; exact j.elim) hp hι + (by simpa using hp) (by simpa using Real.one_le_exp hp) hlp a b ha hb + (by rw [hsum]; exact Submodule.zero_mem _) + simpa only [Set.range_eq_empty, Submodule.span_empty, Submodule.mem_bot] using h + +theorem current_derivative_polynomials_separate + {L ι σ : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype ι] + (V : Submodule ℚ L) (f : Basis ι ℚ (L ⧸ V)) + {l : ℕ} (hl : 0 < l) {p : ℝ} (hp : 0 ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) (hlp : (l : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) + (S R : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (hsmall : ∀ i α, ‖realQuotientCoordinateMap f (coefficients (S i) α)‖ ≤ + Real.exp p / (T i * monomialScale T α)) + (hrational : ∀ i α, realQuotientCoordinateMap f (coefficients (R i) α) ∈ + realDenominatorGrid l) + (hsum : ∀ i α, coefficients (S i + R i) α ∈ V.baseChange ℝ) : + ∀ i α, coefficients (S i) α ∈ V.baseChange ℝ ∧ + coefficients (R i) α ∈ V.baseChange ℝ := by + have hTone (i : σ) : 1 ≤ T i := + (Real.one_le_exp (separationBudget_nonneg hp)).trans (hT i) + intro i α + have hscale : Real.exp (separationBudget p) ≤ T i * monomialScale T α := + (hT i).trans (le_mul_of_one_le_right (zero_le_one.trans (hTone i)) + (one_le_monomialScale T hTone α)) + have hnorm : ‖realQuotientCoordinateMap f (coefficients (S i) α)‖ ≤ + Real.exp p / Real.exp (separationBudget p) := + (hsmall i α).trans (div_le_div_of_nonneg_left (Real.exp_nonneg _) (Real.exp_pos _) hscale) + have hzero : realQuotientCoordinateMap f (coefficients (S i) α) + + realQuotientCoordinateMap f (coefficients (R i) α) = 0 := by + have h := (realQuotientCoordinateMap_eq_zero_iff f _).mpr (hsum i α) + simpa only [map_add, Finsupp.add_apply] using h + obtain ⟨hS, hR⟩ := controlled_zero_sum_separation hl hp hι hlp _ _ hnorm (hrational i α) hzero + exact ⟨(realQuotientCoordinateMap_eq_zero_iff f _).mp hS, + (realQuotientCoordinateMap_eq_zero_iff f _).mp hR⟩ + +theorem current_derivative_terms_vanish_of_invariant_polynomial + {L ι σ : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype ι] + (V : Submodule ℚ L) (f : Basis ι ℚ (L ⧸ V)) + {l : ℕ} (hl : 0 < l) {p : ℝ} (hp : 0 ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) (hlp : (l : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (hP : ∀ α, coefficients P α ∈ V.baseChange ℝ) + (S R : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (hsmall : ∀ i α, ‖realQuotientCoordinateMap f (coefficients (S i) α)‖ ≤ + Real.exp p / (T i * monomialScale T α)) + (hrational : ∀ i α, realQuotientCoordinateMap f (coefficients (R i) α) ∈ + realDenominatorGrid l) + (hsplit : ∀ i α, coefficients + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P - S i - R i) α ∈ V.baseChange ℝ) : + ∀ i α, coefficients (S i) α ∈ V.baseChange ℝ ∧ + coefficients (R i) α ∈ V.baseChange ℝ := by + apply current_derivative_polynomials_separate V f hl hp hι hlp T hT S R hsmall hrational + intro i α + have hD : coefficients ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P) α ∈ + V.baseChange ℝ := by + rw [coefficients_pderiv] + exact ((V.baseChange ℝ).restrictScalars ℚ).smul_mem _ (hP _) + have h := (V.baseChange ℝ).sub_mem hD (hsplit i α) + simp only [map_sub, Finsupp.sub_apply] at h + simp only [map_add, Finsupp.add_apply] + convert h using 1 + abel + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem eval₂_lie_mem_of_coefficients {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieAlgebra ℝ L] [IsScalarTower ℚ ℝ L] + (V : Submodule ℝ L) (P : VectorPolynomial σ ℚ L) (x : L) + (hP : ∀ α, ⁅coefficients P α, x⁆ ∈ V) (t : σ → ℝ) : ⁅eval₂ t P, x⁆ ∈ V := by + classical + rw [← sum_monomial_coefficients P] + simp only [Finsupp.sum, map_sum, eval₂_monomial, sum_lie, smul_lie] + exact V.sum_mem (fun α _ => V.smul_mem _ (hP α)) + +namespace NilpotentLieFiltration + +variable {ι L σ : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (w : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + +include hlayers in +theorem formal_current_layer_derivative_equation (hs : 2 ≤ s) + (U : LieSubalgebra ℝ (ℝ ⊗[ℚ] L)) (V K : Submodule ℝ (ℝ ⊗[ℚ] L)) + (hUV : ∀ u ∈ U, ∀ v ∈ V, ⁅u, v⁆ ∈ V) + (hV : BasisGradedSubmodule (b.baseChange ℝ) w V) {j : ℕ} (hj : 2 ≤ j) + (P : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hU : ∀ α, coefficients P.coord α ∈ U) + (hK : ∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P.coord α) ∈ K) + (hlower : ∀ α d, 2 ≤ d → d < j → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P.coord α) ∈ V) + (hbracket : ∀ α k, k ∈ K → + ⁅coefficients P.coord α, k⁆ ∈ V ⊔ (F.realLayer (j + 1)).toSubmodule) + (small rational extra : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (hrational : ∀ i α, coefficients (rational i) α ∈ V ⊔ (F.realLayer j).toSubmodule) + (hextra : ∀ i α, coefficients (extra i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P.coord)) α ∈ + V ⊔ (F.realLayer (j + 1)).toSubmodule) + (hsystem : PolynomialDerivativeSystem P small rational extra) : + ∀ i α, coefficients + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) P.coord) - + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (small i) - + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (rational i)) α ∈ V := by + let Uq : LieSubalgebra ℚ (ℝ ⊗[ℚ] L) := + { U.toSubmodule.restrictScalars ℚ with lie_mem' := fun hx hy => U.lie_mem hx hy } + have hUvalue (t : σ → ℝ) : eval₂ t P.coord ∈ Uq := + (eval₂_mem_iff_coefficients U.toSubmodule P.coord).mpr hU t + apply F.real_current_layer_polynomial_derivative_equation b w hlayers hs Uq V K hUV hV hj + P.coord hUvalue hK hlower + (fun t k hk => eval₂_lie_mem_of_coefficients _ P.coord k (fun α => hbracket α k hk) t) + small rational hrational (fun i t => eval₂ t (extra i)) + (fun i t => realPolynomialJet i t P) + (fun i t => realPolynomialJet_base i t P) (fun i t => realPolynomialJet_tangent i t P) + · intro i t + have h := (eval₂_mem_iff_coefficients _ _).mpr (hextra i) t + simpa only [map_sub, eval₂_map] using h + · intro i t + simpa only [realPolynomialJet_baseHom] using + PolynomialDerivativeSystem.real_evaluation P small rational extra hsystem i t + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +variable {ι L σ : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (w : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + +include hlayers in +theorem formal_current_layer_derivative_equation_mod (hs : 2 ≤ s) + (U : LieSubalgebra ℝ (ℝ ⊗[ℚ] L)) (V K : Submodule ℝ (ℝ ⊗[ℚ] L)) + (hUV : ∀ u ∈ U, ∀ v ∈ V, ⁅u, v⁆ ∈ V) + (hV : BasisGradedSubmodule (b.baseChange ℝ) w V) {j : ℕ} (hj : 2 ≤ j) + (P : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hU : ∀ α, coefficients P.coord α ∈ U) + (hK : ∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P.coord α) ∈ K) + (hlower : ∀ α d, 2 ≤ d → d < j → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P.coord α) ∈ V) + (hbracket : ∀ α k, k ∈ K → + ⁅coefficients P.coord α, k⁆ ∈ V ⊔ (F.realLayer (j + 1)).toSubmodule) + (small rational extra : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (hrational : ∀ i α, coefficients (rational i) α ∈ V ⊔ (F.realLayer j).toSubmodule) + (hextra : ∀ i α, coefficients (extra i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P.coord)) α ∈ + V ⊔ (F.realLayer (j + 1)).toSubmodule) + (hsystem : PolynomialDerivativeSystemMod (V.restrictScalars ℚ) P small rational extra) : + ∀ i α, coefficients + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) P.coord) - + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (small i) - + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (rational i)) α ∈ V := by + obtain ⟨error, herror, hexact⟩ := PolynomialDerivativeSystemMod.exact_system + (V.restrictScalars ℚ) P small rational extra hsystem + apply F.formal_current_layer_derivative_equation b w hlayers hs U V K hUV hV hj + P hU hK hlower hbracket small rational (fun i => extra i + error i) hrational _ hexact + intro i α + have heq : extra i + error i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P.coord) = + (extra i - VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P.coord)) + error i := by abel + rw [heq, map_add, Finsupp.add_apply] + exact Submodule.add_mem _ (hextra i α) (Submodule.mem_sup_left (herror i α)) + +theorem formal_current_layer_correction_preserves_lifts_mod {κ : Type*} (hs : 2 ≤ s) + (U : LieSubalgebra ℚ (ℝ ⊗[ℚ] L)) (V : Submodule ℚ (ℝ ⊗[ℚ] L)) + (hUV : ∀ u ∈ U, ∀ v ∈ V, ⁅u, v⁆ ∈ V) (j : ℕ) + (P A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hAU : ∀ α, coefficients A.coord α ∈ U) + (hA : ∀ α, coefficients A.coord α ∈ F.realification.layer j) + (hB : ∀ α, coefficients B.coord α ∈ F.realification.layer j) + (S R : κ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) (k : κ → ℝ ⊗[ℚ] L) + (hSR : PolynomialLiftSystemMod V P S R) + (hS : ∀ t α, coefficients (S t - monomial 0 (k t)) α ∈ V ⊔ F.realification.layer (j + 1)) + (hR : ∀ t α, coefficients (R t - monomial 0 (k t)) α ∈ V ⊔ F.realification.layer (j + 1)) : + PolynomialLiftSystemMod V (A⁻¹ * P * B⁻¹) + (fun t => dualAdjoint A⁻¹ (S t)) (fun t => dualAdjoint B (R t)) ∧ + ∀ t α, + coefficients (dualAdjoint A⁻¹ (S t) - monomial 0 (k t)) α ∈ V ⊔ F.realification.layer (j + 1) ∧ + coefficients (dualAdjoint B (R t) - monomial 0 (k t)) α ∈ V ⊔ F.realification.layer (j + 1) := by + refine ⟨PolynomialLiftSystemMod.remove U V hUV P A B hAU S R hSR, ?_⟩ + have hAi : ∀ α, coefficients (A⁻¹).coord α ∈ F.realification.layer j := + (coefficientSubmodule (F.realification.layer j)).neg_mem hA + intro t α + have hleft := F.realification.polynomialFiltration.adjoint_correction_sub_mem_layer hs j A⁻¹ hAi (S t) + have hright := F.realification.polynomialFiltration.adjoint_correction_sub_mem_layer hs j B hB (R t) + constructor + · have h := (V ⊔ F.realification.layer (j + 1)).add_mem (Submodule.mem_sup_right (hleft α)) (hS t α) + convert h using 1 + simp only [map_sub, Finsupp.sub_apply] + abel + · have h := (V ⊔ F.realification.layer (j + 1)).add_mem (Submodule.mem_sup_right (hright α)) (hR t α) + convert h using 1 + simp only [map_sub, Finsupp.sub_apply] + abel + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.VectorPolynomial + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] + +theorem homogeneous_pderiv_coordinate_bound [Fintype σ] [Fintype ι] + (q : L →ₗ[ℚ] (ι → ℝ)) (P : VectorPolynomial σ ℚ L) (j : ℕ) + (hP : ∀ α, Finsupp.weight (fun _ : σ => (1 : ℕ)) α ≠ j → coefficients P α = 0) + (T : σ → ℝ) (hT : ∀ i, 0 < T i) {M : ℝ} (hM : 0 ≤ M) + (hbound : ∀ α, ‖q (coefficients P α)‖ ≤ M / monomialScale T α) + (i : σ) (α : σ →₀ ℕ) : + ‖q (coefficients ((MvPolynomial.pderiv i).toLinearMap.rTensor L P) α)‖ ≤ + j * M / (T i * monomialScale T α) := by + classical + apply (pi_norm_le_iff_of_nonneg (div_nonneg (mul_nonneg (Nat.cast_nonneg j) hM) + (mul_pos (hT i) (monomialScale_pos T hT α)).le)).mpr + intro n + let f := (LinearMap.proj n).comp q + have hdegree : ∀ (β : σ →₀ ℕ) k, j < β k → f (coefficients P β) = 0 := by + intro β k hk + have hw := Finsupp.le_weight (fun _ : σ => (1 : ℕ)) (s := k) (by decide) β + have hne : Finsupp.weight (fun _ : σ => (1 : ℕ)) β ≠ j := by omega + rw [hP β hne, map_zero] + have hcoord (β : σ →₀ ℕ) : |f (coefficients P β)| ≤ M / monomialScale T β := by + exact (norm_le_pi_norm (q (coefficients P β)) n).trans (hbound β) + have h := directionalDerivative_single_scaled_bound f P j hdegree T hT M hM hcoord i α + rw [directionalDerivative_single] at h + change |f (coefficients ((MvPolynomial.pderiv i).toLinearMap.rTensor L P) α)| ≤ _ + convert h using 1 + ring + +theorem pderiv_coordinate_grid (q : L →ₗ[ℚ] (ι → ℝ)) (P : VectorPolynomial σ ℚ L) (l : ℕ) + (hP : ∀ α, q (coefficients P α) ∈ realDenominatorGrid l) (i : σ) (α : σ →₀ ℕ) : + q (coefficients ((MvPolynomial.pderiv i).toLinearMap.rTensor L P) α) ∈ realDenominatorGrid l := by + obtain ⟨z, hz⟩ := hP (α + Finsupp.single i 1) + rw [coefficients_pderiv, map_smul] + refine ⟨fun n => (α i + 1 : ℤ) * z n, ?_⟩ + funext n + have hzn : (z n : ℝ) = (l : ℝ) * q (coefficients P (α + Finsupp.single i 1)) n := congrFun hz n + change (((α i + 1 : ℤ) * z n : ℤ) : ℝ) = + (l : ℝ) * (((α i + 1 : ℚ) : ℝ) * q (coefficients P (α + Finsupp.single i 1)) n) + simp only [Int.cast_mul, Int.cast_add, Int.cast_natCast, Int.cast_one, + Rat.cast_add, Rat.cast_natCast, Rat.cast_one, hzn] + ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem formal_correction_sub_mem_layer (j : ℕ) + (P A B : PolynomialGroup σ F.lowerCentralSeries_eq_bot) + (hA : ∀ α, coefficients A.coord α ∈ F.layer j) + (hB : ∀ α, coefficients B.coord α ∈ F.layer j) : + ∀ α, coefficients ((A⁻¹ * P * B⁻¹).coord - P.coord) α ∈ F.layer j := by + have h := F.polynomialFiltration.correction_removal_preserves_lower_layers (j := j + 1) + A P B (by rw [Nat.add_sub_cancel]; exact hA) + (by rw [Nat.add_sub_cancel]; exact hB) (by omega) + rw [Nat.add_sub_cancel] at h + exact h + +theorem formal_correction_preserves_bracket_remainder (V : Submodule ℚ L) (j : ℕ) + (P A B : PolynomialGroup σ F.lowerCentralSeries_eq_bot) + (hA : ∀ α, coefficients A.coord α ∈ F.layer j) + (hB : ∀ α, coefficients B.coord α ∈ F.layer j) + (x : L) (hbracket : ∀ α, ⁅coefficients P.coord α, x⁆ ∈ V ⊔ F.layer (j + 1)) : + ∀ α, ⁅coefficients (A⁻¹ * P * B⁻¹).coord α, x⁆ ∈ V ⊔ F.layer (j + 1) := by + intro α + have hx : x ∈ F.layer 1 := by rw [F.one_eq_top]; trivial + have hdiff := F.formal_correction_sub_mem_layer j P A B hA hB α + have hlie := F.lie_mem hdiff hx + have h := (V ⊔ F.layer (j + 1)).add_mem (Submodule.mem_sup_right hlie) (hbracket α) + simp only [map_sub, Finsupp.sub_apply, sub_lie, sub_add_cancel] at h + exact h + +variable {μ : Type*} (b : Basis μ ℚ L) (w : μ → ℕ) + (hlayers : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + +include hlayers in +theorem formal_correction_preserves_projected_log {j : ℕ} + (P A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hA : ∀ α, coefficients A.coord α ∈ F.realification.layer j) + (hB : ∀ α, coefficients B.coord α ∈ F.realification.layer j) : + ∀ d < j, VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w d).restrictScalars ℚ) + (A⁻¹ * P * B⁻¹).coord = + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w d).restrictScalars ℚ) P.coord := by + intro d hd + apply F.polynomial_grade_eq_of_sub_mem_next b w hlayers d + intro α + exact F.realification.antitone (Nat.succ_le_of_lt hd) + (F.realification.formal_correction_sub_mem_layer j P A B hA hB α) + +include hlayers in +theorem formal_correction_advances_log_conditions {j : ℕ} (hj : 2 ≤ j) + (V K : Submodule ℝ (ℝ ⊗[ℚ] L)) + (P A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hA : ∀ α, coefficients A.coord α ∈ F.realification.layer j) + (hB : ∀ α, coefficients B.coord α ∈ F.realification.layer j) + (hK : ∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P.coord α) ∈ K) + (hlower : ∀ α d, 2 ≤ d → d < j → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P.coord α) ∈ V) + (hcurrent : ∀ α, coefficients (VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (A⁻¹ * P * B⁻¹).coord) α ∈ V) : + (∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients (A⁻¹ * P * B⁻¹).coord α) ∈ K) ∧ + ∀ α d, 2 ≤ d → d < j + 1 → + basisGradeProjection (b.baseChange ℝ) w d (coefficients (A⁻¹ * P * B⁻¹).coord α) ∈ V := by + have hbelow := F.formal_correction_preserves_projected_log b w hlayers P A B hA hB + have hcoef (d : ℕ) (hd : d < j) (α : σ →₀ ℕ) : + basisGradeProjection (b.baseChange ℝ) w d (coefficients (A⁻¹ * P * B⁻¹).coord α) = + basisGradeProjection (b.baseChange ℝ) w d (coefficients P.coord α) := by + have h := congrArg (fun X : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L) => coefficients X α) (hbelow d hd) + simp only [coefficients_map, LinearMap.restrictScalars_apply] at h + exact h + constructor + · intro α + rw [hcoef 1 (by omega)] + exact hK α + · intro α d hd hdj + rcases lt_or_eq_of_le (show d ≤ j by omega) with hlt | rfl + · rw [hcoef d hlt] + exact hlower α d hd hlt + · have h := hcurrent α + simp only [coefficients_map, LinearMap.restrictScalars_apply] at h + exact h + +include hlayers in +theorem formal_correction_preserves_horizontal_extra (hs : 2 ≤ s) {j : ℕ} (hj : 2 ≤ j) + (V : Submodule ℝ (ℝ ⊗[ℚ] L)) + (P A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hA : ∀ α, coefficients A.coord α ∈ F.realification.layer j) + (hB : ∀ α, coefficients B.coord α ∈ F.realification.layer j) + (extra : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (hextra : ∀ i α, coefficients (extra i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P.coord)) α ∈ + V ⊔ (F.realLayer (j + 1)).toSubmodule) : + ∀ i α, coefficients (dualAdjoint A⁻¹ (extra i) - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) (A⁻¹ * P * B⁻¹).coord)) α ∈ + V ⊔ (F.realLayer (j + 1)).toSubmodule := by + have hlow := F.formal_correction_preserves_projected_log b w hlayers P A B hA hB 1 (by omega) + have hAi : ∀ α, coefficients (A⁻¹).coord α ∈ F.realification.layer j := + (coefficientSubmodule (F.realification.layer j)).neg_mem hA + intro i α + rw [← pderiv_map, hlow, pderiv_map] + have hdiff := F.realification.polynomialFiltration.adjoint_correction_sub_mem_layer hs j A⁻¹ hAi (extra i) + have h := (V ⊔ (F.realLayer (j + 1)).toSubmodule).add_mem + (Submodule.mem_sup_right (hdiff α)) (hextra i α) + convert h using 1 + simp only [map_sub, Finsupp.sub_apply] + abel + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +variable {μ ι σ L : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype σ] [Fintype ι] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis μ ℚ L) (w : μ → ℕ) + (hlayers : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + +include hlayers in +theorem current_correction_derivative_terms_vanish (hs : 2 ≤ s) + (V : Submodule ℚ L) (f : Basis ι ℚ (L ⧸ V)) {j l m : ℕ} (hj : 0 < j) + (P A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hA : ∀ α, basisGradeProjection (b.baseChange ℝ) w j (coefficients A.coord α) = coefficients A.coord α) + (hB : ∀ α, basisGradeProjection (b.baseChange ℝ) w j (coefficients B.coord α) = coefficients B.coord α) + (hAhom : ∀ α, Finsupp.weight (fun _ : σ => (1 : ℕ)) α ≠ j → coefficients A.coord α = 0) + (small rational : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (hsplit : ∀ i α, coefficients + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) P.coord) - + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (small i) - + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (rational i)) α ∈ V.baseChange ℝ) + (hnew : ∀ α, coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) + (A⁻¹ * P * B⁻¹).coord) α ∈ V.baseChange ℝ) + {p M C : ℝ} (hp : 0 ≤ p) (hC : 0 ≤ C) + (hdim : (Fintype.card ι : ℝ) ≤ p) (hl : 0 < l) (hm : 0 < m) + (hden : ((l * m : ℕ) : ℝ) ≤ Real.exp p) (hsize : M + j * C ≤ Real.exp p) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) + (hsmall : ∀ i α, ‖realQuotientCoordinateMap f (coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (small i)) α)‖ ≤ + M / (T i * monomialScale T α)) + (hrational : ∀ i α, realQuotientCoordinateMap f (coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (rational i)) α) ∈ + realDenominatorGrid l) + (hAnorm : ∀ α, ‖realQuotientCoordinateMap f (coefficients A.coord α)‖ ≤ C / monomialScale T α) + (hBgrid : ∀ α, realQuotientCoordinateMap f (coefficients B.coord α) ∈ realDenominatorGrid m) : + ∀ i α, coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) + (dualAdjoint A⁻¹ (small i - formalLogDerivative i A))) α ∈ V.baseChange ℝ ∧ + coefficients (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) + (dualAdjoint B (rational i) - formalLogDerivative i B)) α ∈ V.baseChange ℝ := by + let π := VectorPolynomial.map (σ := σ) ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) + let q := (realQuotientCoordinateMap f).restrictScalars ℚ + let small' := fun i => π (dualAdjoint A⁻¹ (small i - formalLogDerivative i A)) + let rational' := fun i => π (dualAdjoint B (rational i) - formalLogDerivative i B) + have hTpos (i : σ) : 0 < T i := (Real.exp_pos _).trans_le (hT i) + have hparts (i : σ) := F.current_derivative_removal_projection b w hlayers hs hj i A B hA hB (small i) (rational i) + have hsmall' : ∀ i α, ‖realQuotientCoordinateMap f (coefficients (small' i) α)‖ ≤ + Real.exp p / (T i * monomialScale T α) := by + intro i α + have hD := homogeneous_pderiv_coordinate_bound q A.coord j hAhom T hTpos hC hAnorm i α + have he : small' i = π (small i) - (MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) A.coord := + (hparts i).1 + rw [he, map_sub, Finsupp.sub_apply, map_sub] + calc + _ ≤ ‖realQuotientCoordinateMap f (coefficients (π (small i)) α)‖ + + ‖realQuotientCoordinateMap f (coefficients + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) A.coord) α)‖ := norm_sub_le _ _ + _ ≤ M / (T i * monomialScale T α) + j * C / (T i * monomialScale T α) := add_le_add (hsmall i α) hD + _ = (M + j * C) / (T i * monomialScale T α) := by ring + _ ≤ Real.exp p / (T i * monomialScale T α) := + div_le_div_of_nonneg_right hsize (mul_pos (hTpos i) (monomialScale_pos T hTpos α)).le + have hrational' : ∀ i α, realQuotientCoordinateMap f (coefficients (rational' i) α) ∈ + realDenominatorGrid (l * m) := by + intro i α + have he : rational' i = π (rational i) - (MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) B.coord := + (hparts i).2 + rw [he, map_sub, Finsupp.sub_apply, map_sub] + exact realDenominatorGrid_sub_product l m _ _ (hrational i α) + (pderiv_coordinate_grid q B.coord m hBgrid i α) + apply current_derivative_terms_vanish_of_invariant_polynomial V f (Nat.mul_pos hl hm) hp hdim hden T hT + (π (A⁻¹ * P * B⁻¹).coord) hnew small' rational' hsmall' hrational' + intro i α + have he := F.current_derivative_defect_preserved b w hlayers hs hj i P A B hA hB (small i) (rational i) + change coefficients + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) (π (A⁻¹ * P * B⁻¹).coord) - small' i - rational' i) α ∈ _ + rw [he] + exact hsplit i α + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +variable {L μ ι ν σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [Fintype μ] [Fintype ι] [Fintype ν] [Fintype σ] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis μ ℚ L) (w : μ → ℕ) + (hlayers : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + {E V : Submodule ℚ L} + +include hlayers in +theorem exists_controlled_formal_current_layer_step + (hgraded : BasisHomogeneousBrackets b w) (hs : 2 ≤ s) + (U : LieSubalgebra ℝ (ℝ ⊗[ℚ] L)) (K : Submodule ℝ (ℝ ⊗[ℚ] L)) + (hUV : ∀ u ∈ U, ∀ v ∈ V.baseChange ℝ, ⁅u, v⁆ ∈ V.baseChange ℝ) + (hV : BasisGradedSubmodule (b.baseChange ℝ) w (V.baseChange ℝ)) + (e : Basis ν ℚ E) (f : Basis ι ℚ (L ⧸ V)) + {j H J Q l : ℕ} (hj : 2 ≤ j) + (hE : ∀ x ∈ E.baseChange ℝ, basisGradeProjection (b.baseChange ℝ) w j x = x) + (hEU : ∀ x ∈ E.baseChange ℝ, x ∈ U) + (hH : 1 ≤ H) (hl : 0 < l) + (hA : ∀ i n, RationalHeightLE (subspaceQuotientMatrix e f i n) H) + (he : ∀ i n, RationalHeightLE (b.repr (e n : L) i) J) + (hf : ∀ i n, RationalHeightLE (f.repr (V.mkQ (b n)) i) Q) + {p q M : ℝ} (hp : 0 ≤ p) (hq : 0 ≤ q) (hM : 0 ≤ M) + (hrows : (Fintype.card ι : ℝ) ≤ p) (hcols : (Fintype.card ν : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : ((l * j : ℕ) : ℝ) ≤ Real.exp p) + (hbudget : (Fintype.card σ : ℝ) / j * M ≤ Real.exp p) + (hrowsq : (Fintype.card ι : ℝ) ≤ q) + (hden : ((l * matrixDenominator (quotientCoordinateMatrix b f) * + matrixDenominator (bracketLiftMatrix b e) : ℕ) : ℝ) * Real.exp ((p + 2) ^ 36) ≤ Real.exp q) + (hsize : M + j * ((((Fintype.card μ : ℝ) + 1) * (Q + 1)) * + (((Fintype.card ν : ℝ) + 1) * (J + 1)) * Real.exp ((p + 2) ^ 18 + p)) ≤ Real.exp q) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) + (hTq : ∀ i, Real.exp (separationBudget q) ≤ T i) + (P : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hPU : ∀ α, coefficients P.coord α ∈ U) + (hPgraded : P.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1)) + (hPE : ∀ α, basisGradeProjection (b.baseChange ℝ) w j (coefficients P.coord α) ∈ E.baseChange ℝ) + (hK : ∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P.coord α) ∈ K) + (hlower : ∀ α d, 2 ≤ d → d < j → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P.coord α) ∈ V.baseChange ℝ) + (hbracket : ∀ α k, k ∈ K → + ⁅coefficients P.coord α, k⁆ ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) + (small rational extra : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (hsmall : ∀ i α, coefficients (small i) α ∈ V.baseChange ℝ ⊔ (F.realLayer j).toSubmodule) + (hrational : ∀ i α, coefficients (rational i) α ∈ V.baseChange ℝ ⊔ (F.realLayer j).toSubmodule) + (hextra : ∀ i α, coefficients (extra i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P.coord)) α ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) + (hsystem : PolynomialDerivativeSystemMod ((V.baseChange ℝ).restrictScalars ℚ) P small rational extra) + (hSgraded : ∀ i, small i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) + (hRgraded : ∀ i, rational i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) + (hslow : ∀ i α, ‖realQuotientCoordinateMap f (coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (small i)) α)‖ ≤ + M / (T i * monomialScale T α)) + (hgrid : ∀ i α, realQuotientCoordinateMap f (coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (rational i)) α) ∈ + realDenominatorGrid l) : + ∃ (m : ℕ) (A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot), + 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + 2) ^ 36) ∧ + (∀ α, coefficients A.coord α ∈ E.baseChange ℝ ∧ coefficients B.coord α ∈ E.baseChange ℝ) ∧ + (∀ α, Finsupp.weight (fun _ : σ => (1 : ℕ)) α ≠ j → coefficients A.coord α = 0) ∧ + (∀ α, Finsupp.weight (fun _ : σ => (1 : ℕ)) α ≠ j → coefficients B.coord α = 0) ∧ + (∀ α, ‖(b.baseChange ℝ).equivFun (coefficients A.coord α)‖ ≤ + (((Fintype.card ν : ℝ) + 1) * (J + 1)) * Real.exp ((p + 2) ^ 18 + p) / monomialScale T α) ∧ + (∀ α, (b.baseChange ℝ).equivFun (coefficients B.coord α) ∈ + realDenominatorGrid (matrixDenominator (bracketLiftMatrix b e) * m)) ∧ + let P' := A⁻¹ * P * B⁻¹ + let small' := fun i => dualAdjoint A⁻¹ (small i - formalLogDerivative i A) + let rational' := fun i => dualAdjoint B (rational i) - formalLogDerivative i B + let extra' := fun i => dualAdjoint A⁻¹ (extra i) + A * P' * B = P ∧ coefficients P'.coord 0 = coefficients P.coord 0 ∧ + P'.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) ∧ + (∀ α, coefficients P'.coord α ∈ U) ∧ + (∀ α, coefficients (VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) P'.coord) α ∈ (E ⊓ V).baseChange ℝ) ∧ + (∀ d < j, VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w d).restrictScalars ℚ) P'.coord = + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w d).restrictScalars ℚ) P.coord) ∧ + PolynomialDerivativeSystemMod ((V.baseChange ℝ).restrictScalars ℚ) P' small' rational' extra' ∧ + (∀ i, small' i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1 ∧ + rational' i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) ∧ + (∀ i α, coefficients (small' i) α ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule ∧ + coefficients (rational' i) α ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) ∧ + (∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P'.coord α) ∈ K) ∧ + (∀ α d, 2 ≤ d → d < j + 1 → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P'.coord α) ∈ V.baseChange ℝ) ∧ + (∀ α k, k ∈ K → ⁅coefficients P'.coord α, k⁆ ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) ∧ + ∀ i α, coefficients (extra' i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P'.coord)) α ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule := by + let Uq : LieSubalgebra ℚ (ℝ ⊗[ℚ] L) := + { U.toSubmodule.restrictScalars ℚ with lie_mem' := fun hx hy => U.lie_mem hx hy } + let π := VectorPolynomial.map (σ := σ) ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) + have hjpos : 0 < j := by omega + have hsplit := F.formal_current_layer_derivative_equation_mod b w hlayers hs U (V.baseChange ℝ) K + hUV hV hj P hPU hK hlower hbracket small rational extra hrational hextra hsystem + have h := F.exists_controlled_current_layer_polynomial_step b w hlayers Uq e f (hgraded.baseChange b w) + hjpos hE hEU hH hl hA he hp hrows hcols hHp hlp T hT P.coord (π P.coord) hPU hPgraded rfl + (fun α => by rw [coefficients_map]; exact hPE α) (fun i => π (small i)) (fun i => π (rational i)) + (fun i => shifted_one_projection_homogeneous (b.baseChange ℝ) w _ (hSgraded i) hjpos) + (fun i => shifted_one_projection_homogeneous (b.baseChange ℝ) w _ (hRgraded i) hjpos) + hsplit hM hbudget + (fun i α n => (norm_le_pi_norm (realQuotientCoordinateMap f (coefficients (π (small i)) α)) n).trans (hslow i α)) hgrid + obtain ⟨m, a, c, Pnew, hm, hmp, hac, hahom, hchom, hanorm, hcgrid, + hremove, _, hconstant, hnewgraded, hnewU, hnewV, hbelow⟩ := h + let A : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot := ⟨a⟩ + let B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot := ⟨c⟩ + let P' := A⁻¹ * P * B⁻¹ + have hcoord : P'.coord = Pnew := hremove.symm + have hApure : ∀ α, basisGradeProjection (b.baseChange ℝ) w j (coefficients A.coord α) = coefficients A.coord α := + fun α => hE _ (hac α).1 + have hBpure : ∀ α, basisGradeProjection (b.baseChange ℝ) w j (coefficients B.coord α) = coefficients B.coord α := + fun α => hE _ (hac α).2 + have hAU : ∀ α, coefficients A.coord α ∈ Uq := fun α => hEU _ (hac α).1 + have hBU : ∀ α, coefficients B.coord α ∈ Uq := fun α => hEU _ (hac α).2 + have hAlayer : ∀ α, coefficients A.coord α ∈ F.realification.layer j := by + intro α + rw [← hApure α] + exact F.realGradeProjection_mem_layer b w hlayers j _ + have hBlayer : ∀ α, coefficients B.coord α ∈ F.realification.layer j := by + intro α + rw [← hBpure α] + exact F.realGradeProjection_mem_layer b w hlayers j _ + let C : ℝ := (((Fintype.card μ : ℝ) + 1) * (Q + 1)) * + (((Fintype.card ν : ℝ) + 1) * (J + 1)) * Real.exp ((p + 2) ^ 18 + p) + have hC : 0 ≤ C := by dsimp [C]; positivity + have hAnorm : ∀ α, ‖realQuotientCoordinateMap f (coefficients A.coord α)‖ ≤ C / monomialScale T α := by + intro α + calc + _ ≤ (((Fintype.card μ : ℝ) + 1) * (Q + 1)) * ‖(b.baseChange ℝ).equivFun (coefficients a α)‖ := + realQuotientCoordinateMap_norm_bound b f hf _ + _ ≤ (((Fintype.card μ : ℝ) + 1) * (Q + 1)) * + ((((Fintype.card ν : ℝ) + 1) * (J + 1)) * Real.exp ((p + 2) ^ 18 + p) / monomialScale T α) := + mul_le_mul_of_nonneg_left (hanorm α) (by positivity) + _ = C / monomialScale T α := by dsimp [C]; ring + let n := matrixDenominator (quotientCoordinateMatrix b f) * (matrixDenominator (bracketLiftMatrix b e) * m) + have hn : 0 < n := Nat.mul_pos (matrixDenominator_pos _) (Nat.mul_pos (matrixDenominator_pos _) hm) + have hBgrid : ∀ α, realQuotientCoordinateMap f (coefficients B.coord α) ∈ realDenominatorGrid n := + fun α => realQuotientCoordinateMap_grid b f _ _ (hcgrid α) + have hden' : ((l * n : ℕ) : ℝ) ≤ Real.exp q := by + calc + _ = ((l * matrixDenominator (quotientCoordinateMatrix b f) * + matrixDenominator (bracketLiftMatrix b e) : ℕ) : ℝ) * (m : ℝ) := by + dsimp [n] + push_cast + ring + _ ≤ ((l * matrixDenominator (quotientCoordinateMatrix b f) * + matrixDenominator (bracketLiftMatrix b e) : ℕ) : ℝ) * Real.exp ((p + 2) ^ 36) := + mul_le_mul_of_nonneg_left hmp (by positivity) + _ ≤ Real.exp q := hden + have hnew : ∀ α, coefficients (π P'.coord) α ∈ V.baseChange ℝ := by + intro α + rw [hcoord] + exact Submodule.baseChange_mono ℝ inf_le_right (hnewV α) + have hvanish := F.current_correction_derivative_terms_vanish b w hlayers hs V f hjpos P A B + hApure hBpure hahom small rational hsplit hnew hq hC hrowsq hl hn hden' hsize T hTq hslow hgrid hAnorm hBgrid + have hadvance := F.formal_current_derivative_advance b w hlayers Uq (V.baseChange ℝ) hUV hV j A B + hAU hBU hAlayer hBlayer small rational hsmall hrational hvanish + have hAgraded := homogeneous_mem_gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) + j a hahom hApure + have hBgraded := homogeneous_mem_gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) + j c hchom hBpure + have hlog := F.formal_correction_advances_log_conditions b w hlayers hj (V.baseChange ℝ) K + P A B hAlayer hBlayer hK hlower hnew + have hWiff (x : ℝ ⊗[ℚ] L) : + x ∈ (V.baseChange ℝ).restrictScalars ℚ ⊔ F.realification.layer (j + 1) ↔ + x ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule := by + change x ∈ (V.baseChange ℝ).restrictScalars ℚ ⊔ + (F.realLayer (j + 1)).toSubmodule.restrictScalars ℚ ↔ _ + rw [← Submodule.restrictScalars_sup] + rfl + have hbracket' : ∀ α k, k ∈ K → ⁅coefficients P'.coord α, k⁆ ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule := by + intro α k hk + exact (hWiff _).mp (F.realification.formal_correction_preserves_bracket_remainder + ((V.baseChange ℝ).restrictScalars ℚ) j P A B hAlayer hBlayer k + (fun β => (hWiff _).mpr (hbracket β k hk)) α) + refine ⟨m, A, B, hm, hmp, hac, hahom, hchom, hanorm, hcgrid, ?_, ?_, ?_, ?_, ?_, ?_, + PolynomialDerivativeSystemMod.remove Uq ((V.baseChange ℝ).restrictScalars ℚ) hUV P A B hAU + small rational extra hsystem, ?_, hadvance, hlog.1, hlog.2, hbracket', + F.formal_correction_preserves_horizontal_extra b w hlayers hs hj (V.baseChange ℝ) + P A B hAlayer hBlayer extra hextra⟩ + · group + · change coefficients P'.coord 0 = _ + rw [hcoord] + exact hconstant + · change P'.coord ∈ _ + rw [hcoord] + exact hnewgraded + · intro α + change coefficients P'.coord α ∈ _ + rw [hcoord] + exact hnewU α + · intro α + change coefficients (π P'.coord) α ∈ _ + rw [hcoord] + exact hnewV α + · intro d hd + change VectorPolynomial.map _ P'.coord = _ + rw [hcoord] + exact hbelow d hd + · intro i + exact polynomial_derivative_removal_preserves_shifted_grading (b.baseChange ℝ) w (hgraded.baseChange b w) + i A B (small i) (rational i) hAgraded hBgraded (hSgraded i) (hRgraded i) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_uniform_formal_current_layer_step : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {L μ ι ν σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [Fintype μ] [Fintype ι] [Fintype ν] [Fintype σ] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis μ ℚ L) (w : μ → ℕ) + (_hlayers : ∀ d, F.layer d = Submodule.span ℚ (b '' {i | d ≤ w i})) + {E V : Submodule ℚ L} + (_hgraded : BasisHomogeneousBrackets b w) (_hs : 2 ≤ s) + (U : LieSubalgebra ℝ (ℝ ⊗[ℚ] L)) (K : Submodule ℝ (ℝ ⊗[ℚ] L)) + (_hUV : ∀ u ∈ U, ∀ v ∈ V.baseChange ℝ, ⁅u, v⁆ ∈ V.baseChange ℝ) + (_hV : BasisGradedSubmodule (b.baseChange ℝ) w (V.baseChange ℝ)) + (e : Basis ν ℚ E) (f : Basis ι ℚ (L ⧸ V)) + {j H J Q l : ℕ} (_hj : 2 ≤ j) + (_hE : ∀ x ∈ E.baseChange ℝ, basisGradeProjection (b.baseChange ℝ) w j x = x) + (_hEU : ∀ x ∈ E.baseChange ℝ, x ∈ U) + (_hH : 1 ≤ H) (_hl : 0 < l) + (_hA : ∀ i n, RationalHeightLE (subspaceQuotientMatrix e f i n) H) + (_he : ∀ i n, RationalHeightLE (b.repr (e n : L) i) J) + (_hf : ∀ i n, RationalHeightLE (f.repr (V.mkQ (b n)) i) Q) + {p M : ℝ} (_hp : 0 ≤ p) (_hM : 0 ≤ M) + (_hambient : (Fintype.card μ : ℝ) ≤ p) (_hrows : (Fintype.card ι : ℝ) ≤ p) + (_hcols : (Fintype.card ν : ℝ) ≤ p) (_hvariables : (Fintype.card σ : ℝ) ≤ p) + (_hjp : (j : ℝ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p) (_hJp : (J : ℝ) ≤ Real.exp p) (_hQp : (Q : ℝ) ≤ Real.exp p) + (_hlp : (l : ℝ) ≤ Real.exp p) (_hMp : M ≤ Real.exp p) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (P : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (_hPU : ∀ α, coefficients P.coord α ∈ U) + (_hPgraded : P.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1)) + (_hPE : ∀ α, basisGradeProjection (b.baseChange ℝ) w j (coefficients P.coord α) ∈ E.baseChange ℝ) + (_hK : ∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P.coord α) ∈ K) + (_hlower : ∀ α d, 2 ≤ d → d < j → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P.coord α) ∈ V.baseChange ℝ) + (_hbracket : ∀ α k, k ∈ K → + ⁅coefficients P.coord α, k⁆ ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) + (small rational extra : σ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (_hsmall : ∀ i α, coefficients (small i) α ∈ V.baseChange ℝ ⊔ (F.realLayer j).toSubmodule) + (_hrational : ∀ i α, coefficients (rational i) α ∈ V.baseChange ℝ ⊔ (F.realLayer j).toSubmodule) + (_hextra : ∀ i α, coefficients (extra i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P.coord)) α ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) + (_hsystem : PolynomialDerivativeSystemMod ((V.baseChange ℝ).restrictScalars ℚ) P small rational extra) + (_hSgraded : ∀ i, small i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) + (_hRgraded : ∀ i, rational i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) + (_hslow : ∀ i α, ‖realQuotientCoordinateMap f (coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (small i)) α)‖ ≤ + M / (T i * monomialScale T α)) + (_hgrid : ∀ i α, realQuotientCoordinateMap f (coefficients + (VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) (rational i)) α) ∈ + realDenominatorGrid l), + ∃ (n : ℕ) (A B : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot), + 0 < n ∧ (n : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + (∀ α, coefficients A.coord α ∈ E.baseChange ℝ ∧ coefficients B.coord α ∈ E.baseChange ℝ) ∧ + (∀ α, Finsupp.weight (fun _ : σ => (1 : ℕ)) α ≠ j → coefficients A.coord α = 0) ∧ + (∀ α, Finsupp.weight (fun _ : σ => (1 : ℕ)) α ≠ j → coefficients B.coord α = 0) ∧ + (∀ α, ‖(b.baseChange ℝ).equivFun (coefficients A.coord α)‖ ≤ + Real.exp ((p + C) ^ C) / monomialScale T α) ∧ + (∀ α, (b.baseChange ℝ).equivFun (coefficients B.coord α) ∈ + realDenominatorGrid n) ∧ + let P' := A⁻¹ * P * B⁻¹ + let small' := fun i => dualAdjoint A⁻¹ (small i - formalLogDerivative i A) + let rational' := fun i => dualAdjoint B (rational i) - formalLogDerivative i B + let extra' := fun i => dualAdjoint A⁻¹ (extra i) + A * P' * B = P ∧ coefficients P'.coord 0 = coefficients P.coord 0 ∧ + P'.coord ∈ gradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) ∧ + (∀ α, coefficients P'.coord α ∈ U) ∧ + (∀ α, coefficients (VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w j).restrictScalars ℚ) P'.coord) α ∈ (E ⊓ V).baseChange ℝ) ∧ + (∀ d < j, VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w d).restrictScalars ℚ) P'.coord = + VectorPolynomial.map ((basisGradeProjection (b.baseChange ℝ) w d).restrictScalars ℚ) P.coord) ∧ + PolynomialDerivativeSystemMod ((V.baseChange ℝ).restrictScalars ℚ) P' small' rational' extra' ∧ + (∀ i, small' i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1 ∧ + rational' i ∈ shiftedGradedPolynomialSubmodule (b.baseChange ℝ) w (fun _ : σ => 1) 1) ∧ + (∀ i α, coefficients (small' i) α ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule ∧ + coefficients (rational' i) α ∈ V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) ∧ + (∀ α, basisGradeProjection (b.baseChange ℝ) w 1 (coefficients P'.coord α) ∈ K) ∧ + (∀ α d, 2 ≤ d → d < j + 1 → + basisGradeProjection (b.baseChange ℝ) w d (coefficients P'.coord α) ∈ V.baseChange ℝ) ∧ + (∀ α k, k ∈ K → ⁅coefficients P'.coord α, k⁆ ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule) ∧ + ∀ i α, coefficients (extra' i - VectorPolynomial.map + ((basisGradeProjection (b.baseChange ℝ) w 1).restrictScalars ℚ) + ((MvPolynomial.pderiv i).toLinearMap.rTensor (ℝ ⊗[ℚ] L) P'.coord)) α ∈ + V.baseChange ℝ ⊔ (F.realLayer (j + 1)).toSubmodule := by + obtain ⟨C, hC, hCbound⟩ := exists_current_layer_uniform_budget + refine ⟨C, hC, ?_⟩ + intro L μ ι ν σ _ _ _ _ _ _ s F b w hlayers E V + hgraded hs U K hUV hV e f j H J Q l hj hE hEU hH hl hA he hf + p M hp hM hambient hrows hcols hvariables hjp hHp hJp hQp hlp hMp T hT + P hPU hPgraded hPE hK hlower hbracket small rational extra hsmall hrational hextra + hsystem hSgraded hRgraded hslow hgrid + let t := currentLayerConstructionBudget p + let q := currentLayerRemovalBudget p + have ht : 0 ≤ t := currentLayerConstructionBudget_nonneg hp + have hq : 0 ≤ q := currentLayerRemovalBudget_nonneg hp + have hpt : p ≤ t := le_currentLayerConstructionBudget hp + have hEt : Real.exp p ≤ Real.exp t := Real.exp_le_exp.mpr hpt + have hconstruction := current_layer_construction_budget_bounds hM (Fintype.card σ) j l + hvariables (by omega) hjp hlp hMp + have hpplus : Real.exp p ≤ Real.exp ((p + 2) ^ 1) := by + apply Real.exp_le_exp.mpr + simp only [pow_one] + linarith + have hD := matrixDenominator_le_exp_power (quotientCoordinateMatrix b f) hp 1 hrows hambient (fun i n => by + have hden : (((quotientCoordinateMatrix b f i n).den) : ℝ) ≤ Q := Nat.cast_le.mpr (hf i n).2 + exact (hden.trans hQp).trans hpplus) + have hEden := matrixDenominator_le_exp_power (bracketLiftMatrix b e) hp 1 hambient hcols (fun i n => by + have hden : (((bracketLiftMatrix b e i n).den) : ℝ) ≤ J := Nat.cast_le.mpr (he i n).2 + exact (hden.trans hJp).trans hpplus) + obtain ⟨hpq, hden, hsize, _, haCap, hbCap⟩ := current_layer_removal_budget_bounds hp + (Fintype.card μ) (Fintype.card ν) j J Q l + (matrixDenominator (quotientCoordinateMatrix b f)) (matrixDenominator (bracketLiftMatrix b e)) + hambient hcols hjp hJp hQp hlp hMp hD hEden + have hCval : separationBudget t + separationBudget q + q ≤ (p + C) ^ C := hCbound p hp + have hst := separationBudget_nonneg ht + have hsq := separationBudget_nonneg hq + have htCut : separationBudget t ≤ (p + C) ^ C := by linarith + have hqCut : separationBudget q ≤ (p + C) ^ C := by linarith + have hqBound : q ≤ (p + C) ^ C := by linarith + have hTt : ∀ i, Real.exp (separationBudget t) ≤ T i := + fun i => (Real.exp_le_exp.mpr htCut).trans (hT i) + have hTq : ∀ i, Real.exp (separationBudget q) ≤ T i := + fun i => (Real.exp_le_exp.mpr hqCut).trans (hT i) + have hTpos : ∀ i, 0 < T i := fun i => (Real.exp_pos _).trans_le (hT i) + have hstep := F.exists_controlled_formal_current_layer_step b w hlayers (p := t) (q := q) + hgraded hs U K hUV hV e f hj hE hEU hH hl hA he hf ht hq hM + (hrows.trans hpt) (hcols.trans hpt) (hHp.trans hEt) hconstruction.1 hconstruction.2 + (hrows.trans hpq) hden hsize T hTt hTq P hPU hPgraded hPE hK hlower hbracket + small rational extra hsmall hrational hextra hsystem hSgraded hRgraded hslow hgrid + obtain ⟨m, A, B, hm, hmp, hAB, hAhom, hBhom, hAnorm, hBgrid, + hprod, hconstant, hnewgraded, hnewU, hnewV, hbelow, hnewsystem, hnewshift, + hnewderivative, hnewK, hnewlower, hnewbracket, hnewextra⟩ := hstep + let n := matrixDenominator (bracketLiftMatrix b e) * m + have hn : 0 < n := Nat.mul_pos (matrixDenominator_pos _) hm + have hnbound : (n : ℝ) ≤ Real.exp ((p + C) ^ C) := by + calc + _ = (matrixDenominator (bracketLiftMatrix b e) : ℝ) * (m : ℝ) := by dsimp [n]; rw [Nat.cast_mul] + _ ≤ (matrixDenominator (bracketLiftMatrix b e) : ℝ) * Real.exp ((t + 2) ^ 36) := + mul_le_mul_of_nonneg_left hmp (Nat.cast_nonneg _) + _ ≤ Real.exp q := hbCap + _ ≤ _ := Real.exp_le_exp.mpr hqBound + refine ⟨n, A, B, hn, hnbound, hAB, hAhom, hBhom, ?_, hBgrid, + hprod, hconstant, hnewgraded, hnewU, hnewV, hbelow, hnewsystem, hnewshift, + hnewderivative, hnewK, hnewlower, hnewbracket, hnewextra⟩ + intro α + exact (hAnorm α).trans (div_le_div_of_nonneg_right + (haCap.trans (Real.exp_le_exp.mpr hqBound)) (monomialScale_pos T hTpos α).le) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformFrozenDescent.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFrozenDescent.lean new file mode 100644 index 0000000000000000000000000000000000000000..eedb5fd7f27a291837d4a78fa65d46182facfc6d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformFrozenDescent.lean @@ -0,0 +1,488 @@ +import OAI.Combinatorics.Progressions.Estimates.FixedObservableMarkedFiberGlobalLift +import OAI.Combinatorics.Progressions.Nilpotent.FrozenComplexNiltest + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (b : Basis (Fin d) ℚ L) (w : Fin d → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + +noncomputable def topQuotientModel (Γ : Subgroup F.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates b Γ) + (hout : bchSubgroupCoordinates b Γ ⊆ denominatorGrid N) : + RationalFilteredNilmanifold (L ⧸ F.layerIdeal (s + 1)) s + (Fintype.card {i : Fin d // ¬ s + 1 ≤ w i}) := + F.coordinateQuotientModel b w hlayers (F.layerIdeal (s + 1)) le_rfl + {i | s + 1 ≤ w i} (hlayers (s + 1)) Γ N hN hin hout + +theorem topQuotientModel_geometry (Γ : Subgroup F.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates b Γ) + (hout : bchSubgroupCoordinates b Γ ⊆ denominatorGrid N) + {p : ℝ} (hp : 0 ≤ p) + (hgeom : (F.ofAdaptedBasis b w hlayers Γ N hN hin hout).GeometryComplexityLE p) : + (F.topQuotientModel b w hlayers Γ N hN hin hout).GeometryComplexityLE p := by + apply F.coordinateQuotientModel_geometry b w hlayers (F.layerIdeal (s + 1)) le_rfl + {i | s + 1 ≤ w i} (hlayers (s + 1)) Γ N hN hin hout hp + · simpa only [Fintype.card_fin] using hgeom.1 + · exact hgeom.2.1 + · exact hgeom.2.2.1 + +@[simp] theorem topQuotientModel_filtration (Γ : Subgroup F.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates b Γ) + (hout : bchSubgroupCoordinates b Γ ⊆ denominatorGrid N) : + (F.topQuotientModel b w hlayers Γ N hN hin hout).filtration = F.quotientTop := rfl + +@[simp] theorem topQuotientModel_lattice (Γ : Subgroup F.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates b Γ) + (hout : bchSubgroupCoordinates b Γ ⊆ denominatorGrid N) : + (F.topQuotientModel b w hlayers Γ N hN hin hout).lattice = + Γ.map (F.quotientStepHom (F.layerIdeal (s + 1)) le_rfl) := rfl + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem quotientFinBasis_repr_mk {L ι : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype ι] + (b : Basis ι ℚ L) (I : LieIdeal ℚ L) (S : Set ι) [DecidablePred (· ∈ S)] + (hspan : I.toSubmodule = Submodule.span ℚ (b '' S)) + (x : L) (k : Fin (Fintype.card {i // i ∉ S})) : + (quotientFinBasis b I S hspan).repr (lieQuotientMap I x) k = + b.repr x ((Fintype.equivFin {i // i ∉ S}).symm k) := by + rw [quotientFinBasis, Basis.repr_reindex_apply] + exact supportedQuotientBasis_repr_mk b I.toSubmodule S hspan x _ + +end Erdos3.NilpotentLieFiltration + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieFiltration + +theorem exists_controlled_top_quotient {L : Type*} [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} (D : RationalFilteredNilmanifold L (s + 1) d) + {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) : + ∃ n : ℕ, n ≤ d ∧ + ∃ Q : RationalFilteredNilmanifold (L ⧸ D.filtration.layerIdeal (s + 1)) s n, + Q.filtration = D.filtration.quotientTop ∧ + Q.lattice = D.lattice.map + (D.filtration.quotientStepHom (D.filtration.layerIdeal (s + 1)) le_rfl) ∧ + Q.GeometryComplexityLE ((p + 3) ^ 11) ∧ + (∀ i k, rationalLogHeight (Q.basis.repr + (lieQuotientMap (D.filtration.layerIdeal (s + 1)) (D.basis i)) k) ≤ (p + 3) ^ 5) ∧ + ∃ w : Fin n → ℕ, ∀ j, Q.filtration.layer j = Submodule.span ℚ (Q.basis '' {i | j ≤ w i}) := by + classical + obtain ⟨b, w, N, _, _, hF, _, hinverse, hbracket, hN, hNp, hin, hout⟩ := + D.exists_controlled_adapted_basis hp hD + let Q := D.filtration.topQuotientModel b w hF D.lattice N hN hin hout + have hdim : finrank ℚ L = d := by simpa only [Fintype.card_fin] using finrank_eq_card_basis D.basis + have hn : Fintype.card {i : Fin (finrank ℚ L) // ¬ s + 1 ≤ w i} ≤ d := by + simpa only [Fintype.card_fin, hdim] using + Fintype.card_subtype_le (fun i : Fin (finrank ℚ L) => ¬ s + 1 ≤ w i) + have hp1 : 0 ≤ p + 1 := by linarith + have hpPow : p + 1 ≤ (p + 3) ^ 11 := by + simpa only [show p + 1 + 2 = p + 3 by ring] using + (le_power_budget hp1 (by decide : 1 ≤ 11)) + have hpr : p ≤ (p + 3) ^ 11 := (by linarith : p ≤ p + 1).trans hpPow + have hbase : 1 ≤ p + 3 := by linarith + have h9 : (p + 3) ^ 9 ≤ (p + 3) ^ 11 := pow_le_pow_right₀ hbase (by decide) + have hgeom : Q.GeometryComplexityLE ((p + 3) ^ 11) := by + apply D.filtration.topQuotientModel_geometry b w hF D.lattice N hN hin hout (by positivity) + apply D.filtration.ofAdaptedBasis_geometry b w hF D.lattice N hN hin hout (by positivity) + · exact (by simpa only [hdim] using hD.1 : (finrank ℚ L : ℝ) ≤ p).trans hpr + · exact hNp.trans (Real.exp_le_exp.mpr h9) + · exact hbracket + refine ⟨_, hn, Q, rfl, rfl, hgeom, ?_, quotientFinWeight w {i | s + 1 ≤ w i}, ?_⟩ + · intro i k + have hspan : (D.filtration.layerIdeal (s + 1)).toSubmodule = + Submodule.span ℚ (b '' {i | s + 1 ≤ w i}) := hF (s + 1) + have hcoord := quotientFinBasis_repr_mk b (D.filtration.layerIdeal (s + 1)) + {i | s + 1 ≤ w i} hspan (D.basis i) k + exact (congrArg rationalLogHeight hcoord).le.trans (hinverse i _) + · intro j + exact D.filtration.quotientFinBasis_layers b w hF (D.filtration.layerIdeal (s + 1)) le_rfl + {i | s + 1 ≤ w i} (hF (s + 1)) j + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieFiltration + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (D : RationalFilteredNilmanifold L (s + 1) d) + +theorem exists_controlled_reduced_square_geometry {p : ℝ} + (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) : + ∃ (b : Basis (Fin (finrank ℚ L)) ℚ L) (w : Fin (finrank ℚ L) → ℕ) + (hlayers : ∀ j, D.filtration.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates + (D.filtration.squareFinBasis b w (hlayers 2)) (D.filtration.squareLattice D.lattice)) + (hout : bchSubgroupCoordinates (D.filtration.squareFinBasis b w (hlayers 2)) + (D.filtration.squareLattice D.lattice) ⊆ denominatorGrid N), + (∀ i j, rationalLogHeight (D.basis.repr (b i) j) ≤ p + 1) ∧ + (D.filtration.squareFiltration.ofAdaptedBasis + (D.filtration.squareFinBasis b w (hlayers 2)) (squareFinWeight w) + (D.filtration.squareFinBasis_layers b w hlayers) + (D.filtration.squareLattice D.lattice) N hN hin hout).GeometryComplexityLE + (squareGeometryBudget p) ∧ + (D.filtration.squareFiltration.topQuotientModel + (D.filtration.squareFinBasis b w (hlayers 2)) (squareFinWeight w) + (D.filtration.squareFinBasis_layers b w hlayers) + (D.filtration.squareLattice D.lattice) N hN hin hout).GeometryComplexityLE + (squareGeometryBudget p) := by + obtain ⟨b, w, hlayers, N, hN, hin, hout, hb, hgeom⟩ := + D.exists_controlled_square_geometry hp hD + exact ⟨b, w, hlayers, N, hN, hin, hout, hb, hgeom, + D.filtration.squareFiltration.topQuotientModel_geometry _ _ _ _ _ _ _ _ + (squareGeometryBudget_nonneg hp) hgeom⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieFiltration + +theorem exists_controlled_top_subspace_quotient + {L κ : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (D : RationalFilteredNilmanifold L s d) (hs : 1 ≤ s) + (K : Submodule ℚ L) (hK : K ≤ D.filtration.layer s) + (vK : κ → K) (hspanK : Submodule.span ℚ (Set.range vK) = ⊤) + {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) + (hvK : ∀ j i, rationalLogHeight (D.basis.repr (vK j : L) i) ≤ p) : + let I := D.filtration.topSubspaceIdeal K hK + let hI : D.filtration.layer (s + 1) ≤ I.toSubmodule := by rw [D.filtration.terminal]; exact bot_le + ∃ n : ℕ, n ≤ d ∧ ∃ Q : RationalFilteredNilmanifold (L ⧸ I) s n, + Q.filtration = D.filtration.quotientLie I hI ∧ + Q.lattice = D.lattice.map (D.filtration.quotientStepHom I hI) ∧ + Q.GeometryComplexityLE ((p + 3) ^ 11) ∧ + ∀ i j, rationalLogHeight (Q.basis.repr (lieQuotientMap I (D.basis i)) j) ≤ (p + 3) ^ 5 := by + classical + intro I hI + let H := ⌈Real.exp p⌉₊ + have hH : 1 ≤ H := one_le_ceil_exp p + have hHp : (H : ℝ) ≤ Real.exp (p + 1) := ceil_exp_le_exp_add_one hp + obtain ⟨b, w, S, hw, hcentral, hb, hlayers, hKS⟩ := + D.filtration.exists_bounded_adapted_basis_with_top_subspace hs D.basis + (fun i => D.layerBasis i) (fun i => (D.layerBasis i).span_eq) K hK vK hspanK + (fun i j k => rationalHeightLE_ceil_exp (hD.2.2.2 i j k)) + (fun j i => rationalHeightLE_ceil_exp (hvK j i)) + have hdim : finrank ℚ L = d := by simpa only [Fintype.card_fin] using finrank_eq_card_basis D.basis + have hd : (Fintype.card (Fin d) : ℝ) ≤ p + 1 := by + simpa only [Fintype.card_fin] using hD.1.trans (show p ≤ p + 1 by linarith) + have hr : (Fintype.card (Fin (finrank ℚ L)) : ℝ) ≤ p + 1 := by simpa only [hdim] using hd + obtain ⟨N, hN, hNp, hin, hout⟩ := exists_basis_change_grid_exp_bound D.basis b D.lattice + hH D.grid_pos hb D.inner_grid D.outer_grid (by linarith : 0 ≤ p + 1) hd hr hHp + (hD.2.1.trans (Real.exp_le_exp.mpr (by linarith))) + have hbinv := inverse_basis_entries_height D.basis b hH hb + have hc := basis_change_structure_height D.basis b hH hb + (fun i j k => rationalHeightLE_ceil_exp (hD.2.2.1 i j k)) + have hcb := rationalLieStructureHeight_inverse_budget (Fintype.card (Fin d)) + (Fintype.card (Fin (finrank ℚ L))) H (by linarith : 0 ≤ p + 1) hd hr hHp + have hsolve := rationalSolveHeight_le_budget (Fintype.card (Fin (finrank ℚ L))) H + (by linarith : 0 ≤ p + 1) hr hHp + have hspanI : I.toSubmodule = Submodule.span ℚ (b '' S) := hKS + let Q := D.filtration.coordinateQuotientModel b w hlayers I hI S hspanI D.lattice N hN hin hout + have hbig : p + 1 ≤ (p + 3) ^ 11 := by + simpa only [show p + 1 + 2 = p + 3 by ring] using + le_power_budget (by linarith : 0 ≤ p + 1) (by decide : 1 ≤ 11) + have hgeometry : Q.GeometryComplexityLE ((p + 3) ^ 11) := by + apply D.filtration.coordinateQuotientModel_geometry b w hlayers I hI S hspanI + D.lattice N hN hin hout (by positivity) (hr.trans hbig) + · apply hNp.trans (Real.exp_le_exp.mpr ?_) + rw [show p + 1 + 2 = p + 3 by ring] + exact pow_le_pow_right₀ (by linarith : 1 ≤ p + 3) (by decide : 9 ≤ 11) + · intro i j k + apply rationalLogHeight_le_of_height (hc i j k) + simpa only [show p + 1 + 2 = p + 3 by ring] using hcb + refine ⟨_, ?_, Q, rfl, rfl, hgeometry, ?_⟩ + · simpa only [Fintype.card_fin, hdim] using Fintype.card_subtype_le (fun i => i ∉ S) + · intro i j + have hcoord := quotientFinBasis_repr_mk b I S hspanI (D.basis i) j + change rationalLogHeight ((quotientFinBasis b I S hspanI).repr (lieQuotientMap I (D.basis i)) j) ≤ _ + rw [hcoord] + apply rationalLogHeight_le_of_height (hbinv i _) + simpa only [show p + 1 + 2 = p + 3 by ring] using hsolve + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +universe u v + +namespace Erdos3.RationalFilteredNilmanifold + +open Module +open scoped TensorProduct + +theorem exists_topQuotientOtherTarget : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {ι : Type v} [Fintype ι] {H : Type u} {L : ι → Type u} + [LieRing H] [LieAlgebra ℚ H] [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] + {s d : ℕ} {e : ι → ℕ} (D : RationalFilteredNilmanifold H (s + 1) d) + (E : ∀ i, RationalFilteredNilmanifold (L i) (s + 1) (e i)) + (ψ : ∀ i, H →ₗ⁅ℚ⁆ L i) {p : ℝ}, + 0 ≤ p → D.GeometryComplexityLE p → (Fintype.card ι : ℝ) ≤ p → + (∀ i, (E i).GeometryComplexityLE p) → + (∀ a i j, rationalLogHeight ((E a).basis.repr (ψ a (D.basis j)) i) ≤ p) → + ∃ n : ℕ, n ≤ d ∧ + ∃ Q : RationalFilteredNilmanifold (H ⧸ D.filtration.layerIdeal (s + 1)) s n, + Q.filtration = D.filtration.quotientTop ∧ + Q.lattice = D.lattice.map + (D.filtration.quotientStepHom (D.filtration.layerIdeal (s + 1)) le_rfl) ∧ + Q.GeometryComplexityLE ((p + C) ^ C) ∧ + (optionProduct (Q.raiseStep (Nat.le_succ s)) E).GeometryComplexityLE ((p + C) ^ C) ∧ + ∀ i j, rationalLogHeight ((optionProduct (Q.raiseStep (Nat.le_succ s)) E).basis.repr + (optionProductMap (lieQuotientMap (D.filtration.layerIdeal (s + 1))) ψ (D.basis j)) i) ≤ + (p + C) ^ C := by + let X : Polynomial ℕ := Polynomial.X + let R := (X + 3) ^ 11 + let P := R + (R + 3) ^ 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, ?_⟩ + intro ι _ H L _ _ _ _ s d e D E ψ p hp hD hι hE hψ + obtain ⟨n, hn, Q, hQF, hQL, hQ, hproj, _⟩ := D.exists_controlled_top_quotient hp hD + let t := (p + 3) ^ 11 + have ht : 0 ≤ t := by dsimp [t]; positivity + have hpt : p ≤ t := by + apply (show p ≤ p + 3 by linarith).trans + simpa only [pow_one] using pow_le_pow_right₀ (by linarith : 1 ≤ p + 3) (show 1 ≤ 11 by omega) + have h5 : (p + 3) ^ 5 ≤ t := pow_le_pow_right₀ (by linarith) (by omega) + have hsum : t + (t + 3) ^ 2 ≤ (p + C) ^ C := by + simpa [P, R, X, t, Polynomial.eval₂_pow] using hbudget p hp + have htC : t ≤ (p + C) ^ C := (le_add_of_nonneg_right (sq_nonneg _)).trans hsum + have htargetC : (t + 3) ^ 2 ≤ (p + C) ^ C := (le_add_of_nonneg_left ht).trans hsum + have hgeom := optionProduct_geometry (Q.raiseStep (Nat.le_succ s)) E ht (hι.trans hpt) + (Q.raiseStep_geometry (Nat.le_succ s) hQ) (fun i => (hE i).mono (E i) hpt) + refine ⟨n, hn, Q, hQF, hQL, hQ.mono Q htC, hgeom.mono _ htargetC, ?_⟩ + intro i j + apply (optionProductMap_logHeight (Q.raiseStep (Nat.le_succ s)) E D.basis + (lieQuotientMap (D.filtration.layerIdeal (s + 1))) ψ + (fun i j => (hproj j i).trans h5) (fun a i j => (hψ a i j).trans hpt) i j).trans htC + +theorem topQuotientOtherMap_real_kernel {ι : Type v} [Fintype ι] + {H : Type u} {L : ι → Type u} [LieRing H] [LieAlgebra ℚ H] + [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] {s d n : ℕ} {e : ι → ℕ} + (D : RationalFilteredNilmanifold H (s + 1) d) + (Q : RationalFilteredNilmanifold (H ⧸ D.filtration.layerIdeal (s + 1)) s n) + (E : ∀ i, RationalFilteredNilmanifold (L i) (s + 1) (e i)) + (ψ : ∀ i, H →ₗ⁅ℚ⁆ L i) (x : ℝ ⊗[ℚ] H) : + realificationLieHom (optionProductMap (lieQuotientMap (D.filtration.layerIdeal (s + 1))) ψ) x = 0 ↔ + x ∈ D.filtration.realification.layer (s + 1) ∧ ∀ i, realificationLieHom (ψ i) x = 0 := by + rw [optionProductMap_real_kernel (Q.raiseStep (Nat.le_succ s)) E] + exact and_congr (realification_mkQ_eq_zero_iff (D.filtration.layerIdeal (s + 1)).toSubmodule x) Iff.rfl + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +theorem exists_constructed_fixedObservable_topInvariant_descent (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L σ τ Ω : Type*} [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} (D : RationalFilteredNilmanifold L (s + 1) d) + {v : σ → ℕ} {w : τ → ℕ} (T : D.Niltest v) + (localTests : Ω → D.Niltest w), + (∀ a, (localTests a).observable = T.observable) → T.UnitIntervalValued → + ∀ p : ℝ, 0 ≤ p → T.ComplexityLE p → + (∀ z ∈ D.filtration.realification.subgroup (s + 1), ∀ x, + T.observable (z • x) = T.observable x) → + ∃ n : ℕ, n ≤ d ∧ + ∃ Q : RationalFilteredNilmanifold (L ⧸ D.filtration.layerIdeal (s + 1)) s n, + ∃ hQF : Q.filtration = D.filtration.quotientTop, + Q.lattice = D.lattice.map + (D.filtration.quotientStepHom (D.filtration.layerIdeal (s + 1)) le_rfl) ∧ + letI := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + letI : T2Space (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) := + realification_moduleTopology_t2 Q.basis + ∃ (S : Q.Niltest v) (quotientTests : Ω → Q.Niltest w), + S.orbit = D.topQuotientOrbit Q hQF T.orbit ∧ + S.normBound = T.normBound ∧ + S.lipBound = rationalReconstructionLipschitzBound s d n + ⌈Real.exp ((p + 3) ^ 11)⌉₊ T.lipBound T.normBound ∧ + S.UnitIntervalValued ∧ S.ComplexityLE ((p + C) ^ C) ∧ + (∀ g : D.RealGroup, S.observable (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.layerIdeal (s + 1))) g)) = + T.observable (QuotientGroup.mk g)) ∧ + (∀ x, S.eval x = T.eval x) ∧ + ∀ a, (quotientTests a).observable = S.observable ∧ + (quotientTests a).orbit = D.topQuotientOrbit Q hQF (localTests a).orbit ∧ + (quotientTests a).normBound = S.normBound ∧ + (quotientTests a).lipBound = S.lipBound ∧ + (quotientTests a).UnitIntervalValued ∧ + (quotientTests a).ComplexityLE ((p + C) ^ C) ∧ + ∀ x, (quotientTests a).eval x = (localTests a).eval x := by + obtain ⟨a, _, hdescent⟩ := exists_fixedObservable_topInvariant_descent_budget s + let X : Polynomial ℕ := Polynomial.X + let R := (X + 3) ^ 11 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro L σ τ Ω _ _ _ _ _ _ d D v w T localTests hcommon hunit p hp hT hinv + let q := (p + 3) ^ 11 + have hq : 0 ≤ q := by dsimp only [q]; positivity + have hpq : p ≤ q := by + apply (show p ≤ p + 3 by linarith).trans + simpa only [pow_one] using pow_le_pow_right₀ + (by linarith : (1 : ℝ) ≤ p + 3) (by decide : 1 ≤ 11) + obtain ⟨n, hn, Q, hQF, hQL, hQ, he, _⟩ := D.exists_controlled_top_quotient hp hT.1 + have heq : ∀ i j, rationalLogHeight (Q.basis.repr + (lieQuotientMap (D.filtration.layerIdeal (s + 1)) (D.basis j)) i) ≤ q := by + intro i j + exact (he j i).trans (pow_le_pow_right₀ + (by linarith : (1 : ℝ) ≤ p + 3) (by decide : 5 ≤ 11)) + let _ := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) + let _ : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let _ : T2Space (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) := + realification_moduleTopology_t2 Q.basis + obtain ⟨S, quotientTests, hSo, hSn, hSl, hSu, hSc, hrec, hSe, hfamily⟩ := + hdescent D Q hQF hQL T localTests hcommon hunit q hq (hT.mono hpq) hQ heq hinv + have hfinal : (q + a) ^ a ≤ (p + C) ^ C := by + simpa [X, R, q, Polynomial.eval₂_pow] using hbudget p hp + refine ⟨n, hn, Q, hQF, hQL, S, quotientTests, hSo, hSn, hSl, hSu, + hSc.mono hfinal, hrec, hSe, ?_⟩ + intro k + obtain ⟨hobs, ho, hnorm, hlip, hu, hc, heval⟩ := hfamily k + exact ⟨hobs, ho, hnorm, hlip, hu, hc.mono hfinal, heval⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +theorem exists_uniform_frozen_descent (s k : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L M σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + {d e : ℕ} (D : RationalFilteredNilmanifold L (s + 1) d) + (E : RationalFilteredNilmanifold M (s + 1) e) (φ : L →ₗ⁅ℚ⁆ M) + {w : σ → ℕ} (T : E.Niltest w) + (g : D.filtration.realification.PolynomialOrbit w) {p : ℝ}, + 0 ≤ p → D.GeometryComplexityLE p → T.ComplexityLE p → + (∀ i j, rationalLogHeight (E.basis.repr (φ (D.basis j)) i) ≤ p) → + ∀ q : ℕ, 0 < q → (q : ℝ) ≤ Real.exp p → + ∃ Λ : Subgroup D.filtration.Group, Λ ≤ D.lattice ∧ + (Λ.subgroupOf D.lattice).Characteristic ∧ (Λ.subgroupOf D.lattice).Normal ∧ + (Λ.subgroupOf D.lattice).FiniteIndex ∧ + (Λ.relIndex D.lattice : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ n : ℕ, n ≤ d ∧ + ∃ Q : RationalFilteredNilmanifold (L ⧸ D.filtration.layerIdeal (s + 1)) s n, + ∃ hQF : Q.filtration = D.filtration.quotientTop, + Q.lattice = Λ.map + (D.filtration.quotientStepHom (D.filtration.layerIdeal (s + 1)) le_rfl) ∧ + Q.GeometryComplexityLE ((p + C) ^ C) ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 Q.basis + ∀ a r : E.RealGroup, + (∀ i, |(E.basis.baseChange ℝ).repr a.coord i| ≤ Real.exp ((p + 2) ^ k)) → + (E.basis.baseChange ℝ).equivFun r.coord ∈ realDenominatorGrid q → + (∀ z ∈ D.filtration.realification.subgroup (s + 1), ∀ x : D.RealGroup, + T.observable (QuotientGroup.mk + (a * realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ (z * x) * r)) = + T.observable (QuotientGroup.mk + (a * realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ x * r))) → + ∃ S : Q.Niltest w, S.orbit = D.topQuotientOrbit Q hQF g ∧ + S.normBound = T.normBound ∧ S.ComplexityLE ((p + C) ^ C) ∧ + ∀ x : σ → ℤ, S.eval x = T.observable (QuotientGroup.mk + (a * realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ + (D.filtration.realification.polynomialOrbitEval w x g) * r))) := by + obtain ⟨A, _, hmaps⟩ := exists_uniform_frozen_map (s + 1) k + obtain ⟨B, _, hdesc⟩ := exists_topInvariant_niltest_budget s + let X : Polynomial ℕ := Polynomial.X + let U := (X + Polynomial.C A) ^ A + let P := X + U + 4 + let R := P + (P + 3) ^ 11 + 4 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (R + (R + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro L M σ _ _ _ _ _ _ _ _ _ _ _ _ d e D E φ w T g p hp hD hT hφ q hq hqp + obtain ⟨Λ, hΛ, hchar, hnormal, hfinite, hindex, N, hN, hin, hout, hF, hmap⟩ := + hmaps D E φ p hp hD hT.1 hφ q hq hqp + let F := D.withLattice Λ N hN hin hout + let u := (p + A) ^ A + let t := p + u + 4 + let r := t + (t + 3) ^ 11 + 4 + have hu : 0 ≤ u := by dsimp [u]; positivity + have ht : 0 ≤ t := by dsimp [t]; positivity + have hut : u ≤ t := by dsimp [t]; linarith + have htr : t ≤ r := by dsimp [r]; linarith [pow_nonneg (by linarith : 0 ≤ t + 3) 11] + have hr : 0 ≤ r := ht.trans htr + have hQr : (t + 3) ^ 11 ≤ r := by dsimp [r]; linarith + have hsum : r + (r + B) ^ B ≤ (p + C) ^ C := by + simpa [R, P, U, X, r, t, u, Polynomial.eval₂_pow] using hbudget p hp + have hrC : r ≤ (p + C) ^ C := (le_add_of_nonneg_right (by positivity)).trans hsum + have hcost : (r + B) ^ B ≤ (p + C) ^ C := (le_add_of_nonneg_left hr).trans hsum + obtain ⟨n, hn, Q, hQF, hQL, hQ, hproj, _⟩ := + F.exists_controlled_top_quotient ht (hF.mono F hut) + refine ⟨Λ, hΛ, hchar, hnormal, hfinite, + hindex.trans (Real.exp_le_exp.mpr ((hut.trans htr).trans hrC)), + n, hn, Q, hQF, hQL, hQ.mono Q (hQr.trans hrC), ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ D.filtration.layerIdeal (s + 1))) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let : TopologicalSpace (ℝ ⊗[ℚ] (L ⧸ F.filtration.layerIdeal (s + 1))) := + moduleTopology ℝ _ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ F.filtration.layerIdeal (s + 1))) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 Q.basis + intro a b ha hb hinvariant + obtain ⟨hconj, K, hK, hKlip⟩ := hmap a b ha hb + let T' := F.frozenComplexNiltest E φ a b hconj T g K hKlip + have hT' : T'.ComplexityLE t := + F.frozenComplexNiltest_complexity E φ a b hconj T g K hKlip hp hu hF hT hK + have h5 : (t + 3) ^ 5 ≤ (t + 3) ^ 11 := pow_le_pow_right₀ (by linarith) (by decide) + obtain ⟨S, hSo, hSn, hSc, hSe⟩ := hdesc F Q hQF hQL T' r hr (hT'.mono htr) + (hQ.mono Q hQr) (fun i j => (hproj j i).trans (h5.trans hQr)) + (F.frozenComplexNiltest_top_invariant E φ a b hconj T g K hKlip hinvariant) + refine ⟨S, hSo, hSn, hSc.mono hcost, ?_⟩ + intro x + exact (hSe x).trans (F.frozenComplexNiltest_eval E φ a b hconj T g K hKlip x) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformHomFiberWeights.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformHomFiberWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a0d443fdb59d35701669bff25303579ff69c76b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformHomFiberWeights.lean @@ -0,0 +1,35 @@ +import OAI.Combinatorics.Progressions.Lattices.UniformResidueSmallPeriod + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem uniform_mean_surjective_hom_fiber {G H : Type*} + [AddCommGroup G] [AddCommGroup H] [Fintype G] [Fintype H] + (f : G →+ H) (hf : Function.Surjective f) (y : H) : + (FiniteProbabilityWeights.uniform G).mean (fun x => if f x = y then (1 : ℝ) else 0) = + (Fintype.card H : ℝ)⁻¹ := by + have h := uniformPMF_map_hom_index f y + have hr : f.range = ⊤ := by + ext z + simp only [AddMonoidHom.mem_range, AddSubgroup.mem_top, iff_true] + exact hf z + have hy : y ∈ f.range := hf y + rw [ite_eq_left hy, hr] at h + simp only [AddSubgroup.index_top, Nat.cast_one, one_div] at h + rw [uniformPMF_map_fiber] at h + calc + _ = ((Finset.univ.filter (fun x => f x = y)).card : ℝ) / Fintype.card G := by + rw [FiniteProbabilityWeights.uniform_mean, Fintype.expect_eq_sum_div_card] + simp + _ = _ := h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformIntegralSeries.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformIntegralSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d8246f5db19aecddf1808e5cd8d75e49e950ccf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformIntegralSeries.lean @@ -0,0 +1,29 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory Filter + +theorem integral_tsum_of_uniform_domination {ι X V : Type*} [Countable ι] + [MeasurableSpace X] [NormedAddCommGroup V] [NormedSpace ℝ V] [CompleteSpace V] + (μ : Measure X) [IsFiniteMeasure μ] (f : ι → X → V) (C : ι → ℝ) + (hf : ∀ i, AEStronglyMeasurable (f i) μ) (hC : Summable C) + (hbound : ∀ i, ∀ᵐ x ∂μ, ‖f i x‖ ≤ C i) : + (∫ x, ∑' i, f i x ∂μ) = ∑' i, ∫ x, f i x ∂μ := by + symm + apply HasSum.tsum_eq + apply hasSum_integral_of_dominated_convergence (fun i _ => C i) hf hbound + · exact Eventually.of_forall (fun _ => hC) + · exact integrable_const _ + · filter_upwards [ae_all_iff.mpr hbound] with x hx + exact (hC.of_norm_bounded hx).hasSum + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformParameterNet.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformParameterNet.lean new file mode 100644 index 0000000000000000000000000000000000000000..53f093e48659fb210df82f5e5301a0ffc82abeba --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformParameterNet.lean @@ -0,0 +1,38 @@ +import OAI.Combinatorics.Progressions.Sampling.NormalizedRealBoxHalfGrid + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_uniform_parameter_net {J Ω : Type*} [Fintype J] [Nonempty Ω] + (f : Ω → J → ℝ) {B : ℝ} (hB : 0 < B) (hf : ∀ x j, |f x j| ≤ B) + {N : ℕ} (hN : 0 < N) : + ∃ (code : Ω → J → Fin (N + 1)) (rep : (J → Fin (N + 1)) → Ω), + ∀ x, dist (f x) (f (rep (code x))) ≤ 4 * B / N := by + classical + choose code hcode using fun x => exists_uniformBoxGrid_approx hB hN (f x) (hf x) + let rep : (J → Fin (N + 1)) → Ω := fun i => + if h : ∃ x, code x = i then h.choose else Classical.choice inferInstance + have hrep (x : Ω) : code (rep (code x)) = code x := by + have h : ∃ y, code y = code x := ⟨x, rfl⟩ + simp only [rep, dite_eq_left h] + exact h.choose_spec + refine ⟨code, rep, fun x => ?_⟩ + calc + dist (f x) (f (rep (code x))) ≤ + dist (f x) (uniformBoxGrid B N (code x)) + + dist (uniformBoxGrid B N (code x)) (f (rep (code x))) := dist_triangle _ _ _ + _ ≤ 2 * B / N + 2 * B / N := by + apply add_le_add (hcode x) + have hr := hcode (rep (code x)) + rw [hrep x] at hr + exact (dist_comm _ _).trans_le hr + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformPhysicalStackConstruction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformPhysicalStackConstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..828a96f92e2fed1e97e80584bac0ef4d38ef9e76 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformPhysicalStackConstruction.lean @@ -0,0 +1,95 @@ +import OAI.Combinatorics.Progressions.Dynamics.ScheduledPhysicalEpochStack + +namespace OAI + +section + +namespace Erdos3 + +open Module PhysicalEpochStack + +universe u v + +theorem exists_uniform_physical_epoch_stack (A s : ℕ) (hA : 1 ≤ A) : + ∃ K : ℕ, 2 ≤ K ∧ ∀ {σ : Type u} [Fintype σ] [DecidableEq σ] {bound : ℕ} + (base : PhysicalEpochSource.{u, v} σ s bound) (state : PhysicalEpochRecords base) + (M : ℕ), 0 < M → ∀ anchor : σ → ℤ, + (∀ i, base.lower i ≤ anchor i ∧ anchor i < base.lower i + base.sides i) → + (∀ r ∈ state.records, r.modulus ∣ M) → + (∀ i, Real.exp ((base.recordBudget + 2) ^ K) ≤ (base.sides i : ℝ) / M) → + ∃ stack : PhysicalEpochStack base, + RootState state stack ∧ UniformAt A M anchor ((base.recordBudget + 2) ^ K) K stack := by + induction s with + | zero => + refine ⟨2, by omega, ?_⟩ + intro σ _ _ bound base state M hM anchor hanchor hdiv hlarge + have hp : 0 ≤ base.recordBudget := base.incoming_nonneg.trans base.incoming_le_record + have hbound : base.recordBudget ≤ (base.recordBudget + 2) ^ 2 := by nlinarith + exact ⟨.zero base, trivial, base.incoming_le_record.trans hbound, hbound⟩ + | succ s ih => + obtain ⟨Kt, hKt, htail⟩ := ih + obtain ⟨Kf, hKf, hframe⟩ := exists_physical_epoch_frame s + let F : Polynomial ℕ := (Polynomial.X + 2) ^ Kf + let G : Polynomial ℕ := (F + 2) ^ A + let P : Polynomial ℕ := F + G + (G + 2) ^ Kt + Polynomial.X + obtain ⟨K₀, hK₀, hbudget⟩ := exists_natPolynomial_fixed_power_budget P + let K := max K₀ (max Kf Kt) + refine ⟨K, hK₀.trans (le_max_left _ _), ?_⟩ + intro σ _ _ bound base state M hM anchor hanchor hdiv hlarge + let p := base.recordBudget + let f : ℝ := (p + 2) ^ Kf + let g : ℝ := (f + 2) ^ A + have hp : 0 ≤ p := base.incoming_nonneg.trans base.incoming_le_record + have hf : 0 ≤ f := by dsimp only [f]; positivity + have hg : 0 ≤ g := by dsimp only [g]; positivity + have ht : 0 ≤ (g + 2) ^ Kt := by positivity + have hK₀K : (p + 2) ^ K₀ ≤ (p + 2) ^ K := + pow_le_pow_right₀ (by linarith : 1 ≤ p + 2) (le_max_left _ _) + have hpoly : f + g + (g + 2) ^ Kt + p ≤ (p + 2) ^ K := by + have h := hbudget p hp + have h' : f + g + (g + 2) ^ Kt + p ≤ (p + 2) ^ K₀ := by + simpa [P, G, F, f, g, Polynomial.eval₂_pow] using h + exact h'.trans hK₀K + have hfBound : f ≤ (p + 2) ^ K := by linarith + have htBound : (g + 2) ^ Kt ≤ (p + 2) ^ K := by linarith + have hpBound : p ≤ (p + 2) ^ K := by linarith + have hinflate : ∀ x : ℝ, 0 ≤ x → x ≤ (x + 2) ^ A := by + intro x hx + calc + x ≤ x + 2 := by linarith + _ = (x + 2) ^ 1 := (pow_one _).symm + _ ≤ (x + 2) ^ A := pow_le_pow_right₀ (by linarith) hA + obtain ⟨frame, hstate, hmod, hanchorFrame, hwork, hchildIncoming, hchildRecord, hperiod, hfreeze, hevent⟩ := + hframe base state M hM anchor hanchor hdiv (fun x => (x + 2) ^ A) hinflate + (fun i => (Real.exp_le_exp.mpr hfBound).trans (hlarge i)) + have hchild0 := frame.child.incoming_nonneg + have hchildRecord0 := hchild0.trans frame.child.incoming_le_record + have hchildG : frame.child.recordBudget ≤ g := by + rw [hchildRecord] + dsimp only [g] + gcongr + have hchildPower : (frame.child.recordBudget + 2) ^ Kt ≤ (g + 2) ^ Kt := by gcongr + have hchildBound : (frame.child.recordBudget + 2) ^ Kt ≤ (p + 2) ^ K := hchildPower.trans htBound + have hanchorChild : ∀ i, frame.child.lower i ≤ anchor i ∧ + anchor i < frame.child.lower i + frame.child.sides i := by + intro i + simpa only [frame.child_lower, frame.child_sides] using hanchor i + have hlargeChild : ∀ i, Real.exp ((frame.child.recordBudget + 2) ^ Kt) ≤ + (frame.child.sides i : ℝ) / M := by + intro i + rw [frame.child_sides] + exact (Real.exp_le_exp.mpr hchildBound).trans (hlarge i) + obtain ⟨tail, _, htailUniform⟩ := htail frame.child (PhysicalEpochRecords.empty frame.child) + M hM anchor hanchorChild (by simp [PhysicalEpochRecords.empty]) hlargeChild + refine ⟨.succ frame tail, hstate, ?_⟩ + exact ⟨base.incoming_le_record.trans hpBound, hpBound, hmod, hanchorFrame, + hwork.trans hfBound, hperiod.trans (Real.exp_le_exp.mpr hfBound), + hfreeze.trans ((le_max_left Kf Kt).trans (le_max_right K₀ (max Kf Kt))), + hevent.trans ((le_max_left Kf Kt).trans (le_max_right K₀ (max Kf Kt))), hchildRecord, + htailUniform.mono hchildBound ((le_max_right Kf Kt).trans (le_max_right K₀ (max Kf Kt)))⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformPhysicalVisitBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformPhysicalVisitBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..80f976dc5e8fadd0f5bd344de5389127f7f93710 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformPhysicalVisitBounds.lean @@ -0,0 +1,452 @@ +import OAI.Combinatorics.Progressions.Linear.UniformPhysicalFrameConstruction + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_physical_record_inflation (Ke C Kf : ℕ) : + ∃ A : ℕ, 1 ≤ A ∧ ∀ x : ℝ, 0 ≤ x → + x + (x + 2) ^ C ≤ (x + 2) ^ A ∧ + x + (x + 2) ^ Kf + 8 ≤ (x + 2) ^ A ∧ + ∀ q : ℝ, 1 ≤ q → q ≤ (x + 2) ^ Ke → ∀ B : ℕ, B ≤ C → + (q + B) ^ B ≤ (x + 2) ^ A := by + let E : Polynomial ℕ := ((Polynomial.X + 2) ^ Ke + Polynomial.C C) ^ C + let P : Polynomial ℕ := E + Polynomial.X + (Polynomial.X + 2) ^ C + + Polynomial.X + (Polynomial.X + 2) ^ Kf + 8 + obtain ⟨A, hA, hbudget⟩ := exists_natPolynomial_fixed_power_budget P + refine ⟨A, by omega, ?_⟩ + intro x hx + have hsum : ((x + 2) ^ Ke + C) ^ C + x + (x + 2) ^ C + x + (x + 2) ^ Kf + 8 ≤ + (x + 2) ^ A := by simpa [P, E, Polynomial.eval₂_pow] using hbudget x hx + have hE : 0 ≤ ((x + 2) ^ Ke + C) ^ C := by positivity + have hC : 0 ≤ (x + 2) ^ C := by positivity + have hF : 0 ≤ (x + 2) ^ Kf := by positivity + refine ⟨by linarith, by linarith, ?_⟩ + intro q hq1 hq B hB + have hq0 : 0 ≤ q := by linarith + have hBC : (B : ℝ) ≤ C := by exact_mod_cast hB + have hbase : q + B ≤ (x + 2) ^ Ke + C := add_le_add hq hBC + have hlarge : 1 ≤ (x + 2) ^ Ke + C := by have := Nat.cast_nonneg (α := ℝ) C; linarith + calc + (q + B) ^ B ≤ ((x + 2) ^ Ke + C) ^ B := pow_le_pow_left₀ (by positivity) hbase B + _ ≤ ((x + 2) ^ Ke + C) ^ C := pow_le_pow_right₀ hlarge hB + _ ≤ (x + 2) ^ A := by linarith + +theorem inherited_relative_width {W oldWidth newWidth p x D R δ : ℝ} + (hp : p ≤ x) (hδ : 0 < δ) (hδbound : δ⁻¹ ≤ Real.exp D) + (hbudget : x + D + 8 ≤ R) (hnew0 : 0 ≤ newWidth) + (hold : 2 * Real.exp (-p) * W ≤ oldWidth) + (hnew : δ * oldWidth / 8 ≤ newWidth) : + 2 * Real.exp (-R) * W ≤ newWidth := by + have hexp : Real.exp p * Real.exp (-p) = 1 := by rw [← Real.exp_add]; simp + have hold' : 2 * W ≤ Real.exp p * oldWidth := by + calc + 2 * W = 2 * (Real.exp p * Real.exp (-p)) * W := by rw [hexp]; ring + _ = Real.exp p * (2 * Real.exp (-p) * W) := by ring + _ ≤ Real.exp p * oldWidth := mul_le_mul_of_nonneg_left hold (Real.exp_nonneg _) + have hnew' : oldWidth ≤ 8 * newWidth / δ := + (le_div_iff₀ hδ).mpr (by linarith) + have h8 : (8 : ℝ) ≤ Real.exp 8 := by linarith [Real.add_one_le_exp (8 : ℝ)] + have hcoeff : 8 * Real.exp p * δ⁻¹ ≤ Real.exp R := by + calc + 8 * Real.exp p * δ⁻¹ ≤ (Real.exp 8 * Real.exp x) * Real.exp D := + mul_le_mul (mul_le_mul h8 (Real.exp_le_exp.mpr hp) (Real.exp_nonneg _) (Real.exp_nonneg _)) + hδbound (inv_nonneg.mpr hδ.le) (by positivity) + _ = Real.exp (x + D + 8) := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + _ ≤ Real.exp R := Real.exp_le_exp.mpr hbudget + have htotal : 2 * W ≤ Real.exp R * newWidth := by + calc + 2 * W ≤ Real.exp p * oldWidth := hold' + _ ≤ Real.exp p * (8 * newWidth / δ) := mul_le_mul_of_nonneg_left hnew' (Real.exp_nonneg _) + _ = (8 * Real.exp p * δ⁻¹) * newWidth := by ring + _ ≤ Real.exp R * newWidth := mul_le_mul_of_nonneg_right hcoeff hnew0 + calc + 2 * Real.exp (-R) * W = Real.exp (-R) * (2 * W) := by ring + _ ≤ Real.exp (-R) * (Real.exp R * newWidth) := mul_le_mul_of_nonneg_left htotal (Real.exp_nonneg _) + _ = newWidth := by rw [← mul_assoc, ← Real.exp_add, neg_add_cancel, Real.exp_zero, one_mul] + +end Erdos3 + +end + +section + +namespace Erdos3 + +universe u v + +namespace PhysicalEpochComparison + +variable {σ : Type u} [Fintype σ] [DecidableEq σ] {s bound m a J : ℕ} {gap : ℝ} + {base : PhysicalEpochSource.{u, v} σ s bound} + +def Controlled (c : PhysicalEpochComparison base m a J gap) : Prop := + (a : ℝ) ≤ Real.exp base.recordBudget ∧ + ∀ i, 2 * Real.exp (-base.recordBudget) * (base.sides i : ℝ) ≤ (c.sides i : ℝ) + +end PhysicalEpochComparison + +theorem PhysicalEpochFrame.child_comparison_controlled + {σ : Type u} [Fintype σ] [DecidableEq σ] {s bound m a J C Kf : ℕ} {gap δ : ℝ} + {base : PhysicalEpochSource.{u, v} σ (s + 1) bound} + (frame : PhysicalEpochFrame base) (c : PhysicalEpochComparison base m a J gap) + (next : PhysicalEpochComparison frame.child m (a * frame.period) J (gap / 4)) + (hc : c.Controlled) (hC : frame.freezePower ≤ C) + (hperiodBudget : frame.child.incomingBudget + (frame.child.incomingBudget + 2) ^ C ≤ frame.child.recordBudget) + (hwidthBudget : frame.child.incomingBudget + (frame.child.incomingBudget + 2) ^ Kf + 8 ≤ frame.child.recordBudget) + (hδ : 0 < δ) (hδbound : δ⁻¹ ≤ Real.exp ((frame.work + 2) ^ Kf)) + (hside : ∀ i, δ * (c.sides i : ℝ) / 8 ≤ (next.sides i : ℝ)) : + next.Controlled := by + have hx := frame.child.incoming_nonneg + have hw : 0 ≤ frame.work := by linarith [base.incoming_nonneg, frame.incoming_le_work] + have hp : base.recordBudget ≤ frame.child.incomingBudget := by + linarith [frame.record_le_work, frame.work_le_child] + have hwx : frame.work + 2 ≤ frame.child.incomingBudget + 2 := by linarith [frame.work_le_child] + have hpow : (frame.work + 2) ^ frame.freezePower ≤ (frame.child.incomingBudget + 2) ^ C := + (pow_le_pow_left₀ (by linarith) hwx _).trans + (pow_le_pow_right₀ (by linarith) hC) + have hperiod : (frame.period : ℝ) ≤ Real.exp ((frame.child.incomingBudget + 2) ^ C) := + frame.period_le.trans (Real.exp_le_exp.mpr hpow) + have hδchild : δ⁻¹ ≤ Real.exp ((frame.child.incomingBudget + 2) ^ Kf) := + hδbound.trans (Real.exp_le_exp.mpr + (pow_le_pow_left₀ (by linarith) hwx Kf)) + refine ⟨?_, ?_⟩ + · calc + ((a * frame.period : ℕ) : ℝ) = (a : ℝ) * (frame.period : ℝ) := by norm_cast + _ ≤ Real.exp frame.child.incomingBudget * Real.exp ((frame.child.incomingBudget + 2) ^ C) := + mul_le_mul (hc.1.trans (Real.exp_le_exp.mpr hp)) hperiod (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = Real.exp (frame.child.incomingBudget + (frame.child.incomingBudget + 2) ^ C) := (Real.exp_add _ _).symm + _ ≤ Real.exp frame.child.recordBudget := Real.exp_le_exp.mpr hperiodBudget + · intro i + rw [frame.child_sides] + exact inherited_relative_width hp hδ hδchild hwidthBudget (Nat.cast_nonneg _) (hc.2 i) (hside i) + +theorem PhysicalEpochFrame.extend_records_of_comparison + {σ : Type u} [Fintype σ] [DecidableEq σ] {s bound m a J : ℕ} {gap B : ℝ} + {base : PhysicalEpochSource.{u, v} σ (s + 1) bound} + (frame : PhysicalEpochFrame base) (c : PhysicalEpochComparison base m a J gap) + (hc : c.Controlled) (hdiv : ∀ r ∈ frame.state.records, r.modulus ∣ m) + (hB : B ≤ base.recordBudget) + (hwide : ∀ i, 2 * ((m * a * J : ℕ) : ℝ) ≤ (c.sides i : ℝ)) + (hevent : ResiduePairDimensionDrop base.model base.weights base.adapted c.test + (epochRecordIntersection frame.state.records) c.lower c.sides (m * a) c.anchor c.refined + (fun _ => J) B) : + ∃ state : PhysicalEpochRecords base, + (∃ r, state.records = r :: frame.state.records) ∧ + (∀ r ∈ state.records, r.modulus ∣ m * J) ∧ state.dimension < frame.state.dimension := by + obtain ⟨r, hhistory, hcontrolled, hmoduli, hdrop⟩ := + frame.state.history.extend_of_event base.model base.weights base.adapted base.fixedMap c.test + (fun i => (base.sides i : ℝ)) base.recordBudget B frame.state.records + frame.state.controlled c.lower c.sides m a J c.selected_pos c.auxiliary_pos c.pending_pos + hdiv hB hc.1 c.anchor c.refined c.orbit c.compatible hwide + (fun i => by simpa only [mul_assoc] using hc.2 i) hevent + exact ⟨⟨r :: frame.state.records, hhistory, hcontrolled⟩, ⟨r, rfl⟩, hmoduli, hdrop⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +noncomputable def physicalResidueMean {σ : Type*} [Fintype σ] [DecidableEq σ] + (f : (σ → ℤ) → ℂ) (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (u : σ → ℤ) : ℂ := + 𝔼 x : IntegerResidueBox lo (fun i => lo i + N i) (fun _ => (M : ℤ)) u, + f (fun i => (x i).val) + +namespace RationalFilteredNilmanifold.Niltest + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} + +theorem scalarAffinePullback_eval_stride (T : D.Niltest (fun _ : σ => 1)) + (M : ℕ) (u x : σ → ℤ) (hx : ∀ i, x i ≡ u i [ZMOD (M : ℤ)]) : + (T.scalarAffinePullback (M : ℚ) (fun i => (u i : ℚ))).eval (commonStrideIndex u M x) = T.eval x := by + have heq : (fun i => (M : ℤ) * commonStrideIndex u M x i + u i) = x := by + funext i + have h := congrFun (commonStridePoint_index_of_modEq u M x hx) i + change u i + (M : ℤ) * commonStrideIndex u M x i = x i at h + linarith + simpa only [Int.cast_natCast, heq] using T.scalarAffinePullback_eval_integer (M : ℤ) u (commonStrideIndex u M x) + +theorem scalarAffinePullback_pair_false [Fintype σ] [DecidableEq σ] + (T : D.Niltest (fun _ : σ => 1)) (lo : σ → ℤ) (N : σ → ℕ) (M J : ℕ) (u v : σ → ℤ) : + residuePairMean (T.scalarAffinePullback (M : ℚ) (fun i => (u i : ℚ))).eval lo N M u v (fun _ => J) false = + physicalResidueMean T.eval lo N M u := by + rw [residuePairMean_false] + apply Finset.expect_congr rfl + intro x _ + exact T.scalarAffinePullback_eval_stride M u (fun i => (x i).val) + (fun i => (Finset.mem_filter.mp (x i).property).2) + +theorem scalarAffinePullback_pair_true [Fintype σ] [DecidableEq σ] + (T : D.Niltest (fun _ : σ => 1)) (lo : σ → ℤ) (N : σ → ℕ) (M J : ℕ) (u v : σ → ℤ) + (hv : ∀ i, v i ≡ u i [ZMOD (M : ℤ)]) : + residuePairMean (T.scalarAffinePullback (M : ℚ) (fun i => (u i : ℚ))).eval lo N M u v (fun _ => J) true = + physicalResidueMean T.eval lo N (M * J) v := by + rw [residuePairMean_true] + apply Finset.expect_congr rfl + intro x _ + apply T.scalarAffinePullback_eval_stride + intro i + have hd : (M : ℤ) ∣ ((M * J : ℕ) : ℤ) := by exact_mod_cast Nat.dvd_mul_right M J + exact (Int.ModEq.of_dvd hd (Finset.mem_filter.mp (x i).property).2).trans (hv i) + +end RationalFilteredNilmanifold.Niltest + +universe u v + +theorem exists_initial_physical_comparison + {σ : Type u} [Fintype σ] [DecidableEq σ] {s bound m J : ℕ} {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) + (hm : 0 < m) (hJ : 0 < J) (anchor refined : σ → ℤ) + (hanchor : ∀ i, base.lower i ≤ anchor i ∧ anchor i < base.lower i + base.sides i) + (hrefined : ∀ i, base.lower i ≤ refined i ∧ refined i < base.lower i + base.sides i) + (hcompat : ∀ i, refined i ≡ anchor i [ZMOD (m : ℤ)]) + (hgap : 0 < gap) (hgap1 : gap ≤ 1) (hinverse : gap⁻¹ ≤ Real.exp base.incomingBudget) + (hrecord : 2 ≤ base.recordBudget) + (hdiscrepancy : gap ≤ ‖physicalResidueMean T.eval base.lower base.sides m anchor - + physicalResidueMean T.eval base.lower base.sides (m * J) refined‖) : + ∃ c : PhysicalEpochComparison base m 1 J gap, + c.Controlled ∧ c.anchor = anchor ∧ c.refined = refined ∧ c.lower = base.lower ∧ c.sides = base.sides := by + let S := T.scalarAffinePullback (m : ℚ) (fun i => (anchor i : ℚ)) + have hSorbit : S.orbit = (base.fixedMap.scalarAffinePullback (m : ℚ) (fun i => (anchor i : ℚ))).orbit := by + dsimp only [S, RationalFilteredNilmanifold.Niltest.scalarAffinePullback, + RationalFilteredNilmanifold.Niltest.substitute] + rw [horbit] + have hpair : gap ≤ ‖residuePairMean S.eval base.lower base.sides m anchor refined (fun _ => J) false - + residuePairMean S.eval base.lower base.sides m anchor refined (fun _ => J) true‖ := by + rw [T.scalarAffinePullback_pair_false, T.scalarAffinePullback_pair_true _ _ _ _ _ _ hcompat] + exact hdiscrepancy + let c : PhysicalEpochComparison base m 1 J gap := { + selected_pos := hm + auxiliary_pos := by omega + pending_pos := hJ + lower := base.lower + sides := base.sides + sides_pos := base.sides_pos + contained := fun _ => ⟨le_rfl, le_rfl⟩ + anchor := anchor + refined := refined + anchor_inside := hanchor + refined_inside := hrefined + compatible := by simpa only [Nat.mul_one] using hcompat + test := S + orbit := by simpa only [Nat.mul_one] using hSorbit + positive := hpositive + complexity := hcomplexity + gap_pos := hgap + gap_le_one := hgap1 + gap_inverse := hinverse + discrepancy := by simpa only [Nat.mul_one] using hpair } + refine ⟨c, ?_, rfl, rfl, rfl, rfl⟩ + have htwo : 2 ≤ Real.exp base.recordBudget := by linarith [Real.add_one_le_exp base.recordBudget] + have hcoef : 2 * Real.exp (-base.recordBudget) ≤ 1 := by + calc + 2 * Real.exp (-base.recordBudget) ≤ Real.exp base.recordBudget * Real.exp (-base.recordBudget) := + mul_le_mul_of_nonneg_right htwo (Real.exp_nonneg _) + _ = 1 := by rw [← Real.exp_add]; simp + exact ⟨by simp only [Nat.cast_one]; linarith, + fun i => by simpa only [one_mul] using mul_le_mul_of_nonneg_right hcoef (Nat.cast_nonneg (α := ℝ) (base.sides i))⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exp_neg_le_of_positive_inverse_bound {t F : ℝ} (ht : 0 < t) + (h : t⁻¹ ≤ Real.exp F) : Real.exp (-F) ≤ t := by + have hprod : 1 ≤ t * Real.exp F := by + calc + 1 = t * t⁻¹ := (mul_inv_cancel₀ ht.ne').symm + _ ≤ t * Real.exp F := mul_le_mul_of_nonneg_left h ht.le + calc + Real.exp (-F) = 1 * Real.exp (-F) := (one_mul _).symm + _ ≤ (t * Real.exp F) * Real.exp (-F) := mul_le_mul_of_nonneg_right hprod (Real.exp_nonneg _) + _ = t := by rw [mul_assoc, ← Real.exp_add, add_neg_cancel, Real.exp_zero, mul_one] + +theorem physical_visit_numerics {σ : Type*} [Fintype σ] + (N : σ → ℝ) {M Q U F B ε δ : ℝ} + (hM : 1 ≤ M) (hMQ : M ≤ Q) (hU : 0 ≤ U) (hF : 0 ≤ F) (hB : B ≤ U) + (hε : 0 < ε) (hδ : 0 < δ) + (hεinv : ε⁻¹ ≤ Real.exp F) (hδinv : δ⁻¹ ≤ Real.exp F) + (hlarge : ∀ i, 16 * ((Fintype.card σ : ℝ) + 1) * Q * Real.exp (U + 2 * F) ≤ N i) : + (∀ i, 2 * M ≤ N i) ∧ + (∀ i, M * (Real.exp B + 1) ≤ N i) ∧ + (∀ i, 8 ≤ δ * N i) ∧ + (∑ i, Q / N i) ≤ δ * ε / 8 := by + let k : ℝ := (Fintype.card σ : ℝ) + 1 + have hk : 1 ≤ k := by dsimp [k]; have := Nat.cast_nonneg (α := ℝ) (Fintype.card σ); linarith + have hQ : 1 ≤ Q := hM.trans hMQ + have hQ0 : 0 < Q := by linarith + have hk0 : 0 < k := by linarith + have hE : 1 ≤ Real.exp U := Real.one_le_exp hU + have hexpand : Real.exp U ≤ Real.exp (U + 2 * F) := Real.exp_le_exp.mpr (by linarith) + have hscale : 2 ≤ 16 * k := by linarith + have hwidth : ∀ i, 2 * Q * Real.exp U ≤ N i := by + intro i + calc + 2 * Q * Real.exp U ≤ 16 * k * Q * Real.exp (U + 2 * F) := by gcongr + _ ≤ N i := hlarge i + have h16 : ∀ i, 16 * Real.exp (U + 2 * F) ≤ N i := by + intro i + calc + 16 * Real.exp (U + 2 * F) ≤ 16 * k * Q * Real.exp (U + 2 * F) := by + have : 1 ≤ k * Q := one_le_mul_of_one_le_of_one_le hk hQ + nlinarith [Real.exp_pos (U + 2 * F)] + _ ≤ N i := hlarge i + have hδlower := exp_neg_le_of_positive_inverse_bound hδ hδinv + have hεlower := exp_neg_le_of_positive_inverse_bound hε hεinv + have hpair : Real.exp (-(2 * F)) ≤ δ * ε := by + calc + Real.exp (-(2 * F)) = Real.exp (-F) * Real.exp (-F) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ δ * ε := mul_le_mul hδlower hεlower (Real.exp_nonneg _) hδ.le + refine ⟨?_, ?_, ?_, ?_⟩ + · intro i + calc + 2 * M ≤ 2 * Q * Real.exp U := by nlinarith + _ ≤ N i := hwidth i + · intro i + have : Real.exp B + 1 ≤ 2 * Real.exp U := by linarith [Real.exp_le_exp.mpr hB] + calc + M * (Real.exp B + 1) ≤ Q * (2 * Real.exp U) := + mul_le_mul hMQ this (by positivity) (by linarith) + _ = 2 * Q * Real.exp U := by ring + _ ≤ N i := hwidth i + · intro i + have hside : 8 * Real.exp F ≤ N i := by + calc + 8 * Real.exp F ≤ 16 * Real.exp (U + 2 * F) := by + have := Real.exp_le_exp.mpr (show F ≤ U + 2 * F by linarith) + nlinarith [Real.exp_pos F] + _ ≤ N i := h16 i + calc + 8 = Real.exp (-F) * (8 * Real.exp F) := by + rw [show Real.exp (-F) * (8 * Real.exp F) = 8 * (Real.exp (-F) * Real.exp F) by ring, + ← Real.exp_add, neg_add_cancel, Real.exp_zero, mul_one] + _ ≤ δ * N i := mul_le_mul hδlower hside (by positivity) hδ.le + · have hterm : ∀ i, Q / N i ≤ (δ * ε) / (16 * k) := by + intro i + have hbase : 16 * k * Q * Real.exp (2 * F) ≤ N i := by + calc + 16 * k * Q * Real.exp (2 * F) ≤ 16 * k * Q * Real.exp (U + 2 * F) := by gcongr; linarith + _ ≤ N i := hlarge i + calc + Q / N i ≤ Q / (16 * k * Q * Real.exp (2 * F)) := + div_le_div_of_nonneg_left hQ0.le (by positivity) hbase + _ = Real.exp (-(2 * F)) / (16 * k) := by + rw [Real.exp_neg] + field_simp + _ ≤ (δ * ε) / (16 * k) := div_le_div_of_nonneg_right hpair (by positivity) + calc + (∑ i, Q / N i) ≤ ∑ _i : σ, (δ * ε) / (16 * k) := Finset.sum_le_sum (fun i _ => hterm i) + _ = (Fintype.card σ : ℝ) * ((δ * ε) / (16 * k)) := by simp + _ = ((Fintype.card σ : ℝ) / (16 * k)) * (δ * ε) := by ring + _ ≤ (1 / 8) * (δ * ε) := by + apply mul_le_mul_of_nonneg_right _ (mul_nonneg hδ.le hε.le) + apply (div_le_iff₀ (show 0 < 16 * k by positivity)).mpr + dsimp only [k] + have := Nat.cast_nonneg (α := ℝ) (Fintype.card σ) + linarith + _ = δ * ε / 8 := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +universe u v + +theorem PhysicalEpochFrame.uniform_visit_bounds + {σ : Type u} [Fintype σ] [DecidableEq σ] {s bound m a J : ℕ} {gap U F B ε δ : ℝ} + {base : PhysicalEpochSource.{u, v} σ (s + 1) bound} + (frame : PhysicalEpochFrame base) (c : PhysicalEpochComparison base m a J gap) + (hc : c.Controlled) (hrecord : base.recordBudget ≤ U) + (hperiod : (frame.period : ℝ) ≤ Real.exp U) (hF : 0 ≤ F) (hB : B ≤ U) + (hε : 0 < ε) (hδ : 0 < δ) (hεinv : ε⁻¹ ≤ Real.exp F) (hδinv : δ⁻¹ ≤ Real.exp F) + (hsource : ∀ i, ((m * J : ℕ) : ℝ) * Real.exp (5 * U + 2 * F + 16) ≤ (base.sides i : ℝ)) : + (∀ i, 2 * ((m * a * J : ℕ) : ℝ) ≤ (c.sides i : ℝ)) ∧ + (∀ i, ((m * a * J : ℕ) : ℝ) * (Real.exp B + 1) ≤ (c.sides i : ℝ)) ∧ + (∀ i, 8 ≤ δ * (c.sides i : ℝ)) ∧ + (∑ i, ((Nat.lcm (m * a) (m * a * frame.period) * J : ℕ) : ℝ) / (c.sides i : ℝ)) ≤ δ * ε / 8 := by + let k : ℝ := (Fintype.card σ : ℝ) + 1 + let T : ℝ := ((m * J : ℕ) : ℝ) + let Q : ℝ := ((m * a * frame.period * J : ℕ) : ℝ) + have hU : 0 ≤ U := base.incoming_nonneg.trans (base.incoming_le_record.trans hrecord) + have hT : 0 ≤ T := Nat.cast_nonneg _ + have hk : 0 ≤ k := by dsimp [k]; positivity + have haux : (a : ℝ) ≤ Real.exp U := hc.1.trans (Real.exp_le_exp.mpr hrecord) + have hQ : Q ≤ T * Real.exp (2 * U) := by + calc + Q = T * ((a : ℝ) * (frame.period : ℝ)) := by dsimp [Q, T]; push_cast; ring_nf + _ ≤ T * (Real.exp U * Real.exp U) := + mul_le_mul_of_nonneg_left (mul_le_mul haux hperiod (Nat.cast_nonneg _) (Real.exp_nonneg _)) hT + _ = T * Real.exp (2 * U) := by rw [← Real.exp_add]; congr 1; ring_nf + have hkexp : k ≤ Real.exp U := by + dsimp only [k] + linarith [base.coordinates_le, base.incoming_le_record, Real.add_one_le_exp U] + have h16 : (16 : ℝ) ≤ Real.exp 16 := by linarith [Real.add_one_le_exp (16 : ℝ)] + have hcoeff : 16 * k ≤ Real.exp (U + 16) := by + calc + 16 * k ≤ Real.exp 16 * Real.exp U := mul_le_mul h16 hkexp hk (Real.exp_nonneg _) + _ = Real.exp (U + 16) := by rw [← Real.exp_add]; congr 1; ring_nf + have hsmall : ∀ i, 16 * k * T * Real.exp (4 * U + 2 * F) ≤ (base.sides i : ℝ) := by + intro i + calc + 16 * k * T * Real.exp (4 * U + 2 * F) ≤ Real.exp (U + 16) * T * Real.exp (4 * U + 2 * F) := by gcongr + _ = T * (Real.exp (U + 16) * Real.exp (4 * U + 2 * F)) := by ring_nf + _ = T * Real.exp (5 * U + 2 * F + 16) := by rw [← Real.exp_add]; congr 1; ring_nf + _ ≤ (base.sides i : ℝ) := hsource i + have hlarge : ∀ i, 16 * k * Q * Real.exp (U + 2 * F) ≤ (c.sides i : ℝ) := by + intro i + have hexp : Real.exp (2 * U) * Real.exp (U + 2 * F) = + Real.exp (-U) * Real.exp (4 * U + 2 * F) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring_nf + calc + 16 * k * Q * Real.exp (U + 2 * F) ≤ 16 * k * (T * Real.exp (2 * U)) * Real.exp (U + 2 * F) := by gcongr + _ = 16 * k * T * (Real.exp (2 * U) * Real.exp (U + 2 * F)) := by ring_nf + _ = Real.exp (-U) * (16 * k * T * Real.exp (4 * U + 2 * F)) := by rw [hexp]; ring_nf + _ ≤ Real.exp (-U) * (base.sides i : ℝ) := mul_le_mul_of_nonneg_left (hsmall i) (Real.exp_nonneg _) + _ ≤ Real.exp (-base.recordBudget) * (base.sides i : ℝ) := by gcongr + _ ≤ 2 * Real.exp (-base.recordBudget) * (base.sides i : ℝ) := by + nlinarith [mul_nonneg (Real.exp_nonneg (-base.recordBudget)) (Nat.cast_nonneg (α := ℝ) (base.sides i))] + _ ≤ (c.sides i : ℝ) := hc.2 i + have hM : 1 ≤ ((m * a * J : ℕ) : ℝ) := by + exact_mod_cast Nat.one_le_iff_ne_zero.mpr (Nat.mul_ne_zero (Nat.mul_ne_zero c.selected_pos.ne' c.auxiliary_pos.ne') c.pending_pos.ne') + have hMQ : ((m * a * J : ℕ) : ℝ) ≤ Q := by + have hp : 1 ≤ frame.period := frame.period_pos + have h := Nat.mul_le_mul_right J (Nat.mul_le_mul_left (m * a) hp) + simpa only [Nat.mul_one, Q] using (Nat.cast_le (α := ℝ)).mpr h + obtain ⟨hwide, hstep, hround, hcount⟩ := physical_visit_numerics (fun i => (c.sides i : ℝ)) + hM hMQ hU hF hB hε hδ hεinv hδinv hlarge + refine ⟨hwide, hstep, hround, ?_⟩ + have hlcm : Nat.lcm (m * a) (m * a * frame.period) = m * a * frame.period := + Nat.lcm_eq_right_iff_dvd.mpr (Nat.dvd_mul_right (m * a) frame.period) + simpa only [hlcm] using hcount + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformProductAccuracy.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformProductAccuracy.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfeeaae73ee5297152a20ceea49ddc1b9a2cf2fc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformProductAccuracy.lean @@ -0,0 +1,201 @@ +import Mathlib.Algebra.Order.BigOperators.Ring.Finset +import Mathlib.Algebra.Order.Ring.Abs +import Mathlib.Analysis.Complex.Basic +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +theorem abs_finset_prod_sub_prod_le {ι : Type*} (S : Finset ι) (f g : ι → ℝ) + {B δ : ℝ} (hB : 1 ≤ B) (hδ : 0 ≤ δ) + (hf : ∀ i ∈ S, |f i| ≤ B) (hg : ∀ i ∈ S, |g i| ≤ B) + (hdiff : ∀ i ∈ S, |f i - g i| ≤ δ) : + |(∏ i ∈ S, f i) - ∏ i ∈ S, g i| ≤ S.card * δ * B ^ S.card := by + classical + revert hf hg hdiff + induction S using Finset.induction_on with + | empty => intro _ _ _; simp + | @insert a S ha ih => + intro hf hg hdiff + have hfS := fun i hi => hf i (Finset.mem_insert_of_mem hi) + have hgS := fun i hi => hg i (Finset.mem_insert_of_mem hi) + have hdS := fun i hi => hdiff i (Finset.mem_insert_of_mem hi) + have hrec := ih hfS hgS hdS + have hprod : |∏ i ∈ S, g i| ≤ B ^ S.card := by + rw [Finset.abs_prod] + calc + _ ≤ ∏ _i ∈ S, B := Finset.prod_le_prod₀ (fun _ _ => abs_nonneg _) hgS + _ = _ := by simp + rw [Finset.prod_insert ha, Finset.prod_insert ha, Finset.card_insert_of_notMem ha] + calc + _ = |f a * ((∏ i ∈ S, f i) - ∏ i ∈ S, g i) + (f a - g a) * ∏ i ∈ S, g i| := by + congr 1 + ring + _ ≤ |f a| * |(∏ i ∈ S, f i) - ∏ i ∈ S, g i| + |f a - g a| * |∏ i ∈ S, g i| := by + simpa only [abs_mul] using abs_add_le + (f a * ((∏ i ∈ S, f i) - ∏ i ∈ S, g i)) ((f a - g a) * ∏ i ∈ S, g i) + _ ≤ B * (S.card * δ * B ^ S.card) + δ * B ^ S.card := + add_le_add (mul_le_mul (hf a (Finset.mem_insert_self _ _)) hrec + (abs_nonneg _) (by linarith)) + (mul_le_mul (hdiff a (Finset.mem_insert_self _ _)) hprod (abs_nonneg _) hδ) + _ = (S.card : ℝ) * δ * B ^ (S.card + 1) + δ * B ^ S.card := by rw [pow_succ]; ring + _ ≤ (S.card : ℝ) * δ * B ^ (S.card + 1) + δ * B ^ (S.card + 1) := + add_le_add le_rfl (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hB (Nat.le_succ _)) hδ) + _ = _ := by push_cast; ring + +theorem abs_pow_sub_pow_box_bound {x y B δ : ℝ} {n s : ℕ} + (hB : 1 ≤ B) (hδ : 0 ≤ δ) (hx : |x| ≤ B) (hy : |y| ≤ B) + (hxy : |x - y| ≤ δ) (hn : n ≤ s) : + |x ^ n - y ^ n| ≤ δ * s * B ^ s := by + apply (abs_pow_sub_pow_le x y n).trans + apply mul_le_mul (mul_le_mul hxy (Nat.cast_le.mpr hn) (Nat.cast_nonneg _) hδ) + · exact (pow_le_pow_left₀ (le_max_of_le_left (abs_nonneg _)) (max_le hx hy) _).trans + (pow_le_pow_right₀ hB (by omega)) + · positivity + · positivity + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem norm_finset_prod_sub_prod_le {ι : Type*} (S : Finset ι) (f g : ι → ℂ) + {B δ : ℝ} (hB : 1 ≤ B) (hδ : 0 ≤ δ) + (hf : ∀ i ∈ S, ‖f i‖ ≤ B) (hg : ∀ i ∈ S, ‖g i‖ ≤ B) + (hdiff : ∀ i ∈ S, ‖f i - g i‖ ≤ δ) : + ‖(∏ i ∈ S, f i) - ∏ i ∈ S, g i‖ ≤ S.card * δ * B ^ S.card := by + classical + revert hf hg hdiff + induction S using Finset.induction_on with + | empty => intro _ _ _; simp + | @insert a S ha ih => + intro hf hg hdiff + have hrec := ih (fun i hi => hf i (Finset.mem_insert_of_mem hi)) + (fun i hi => hg i (Finset.mem_insert_of_mem hi)) + (fun i hi => hdiff i (Finset.mem_insert_of_mem hi)) + have hprod : ‖∏ i ∈ S, g i‖ ≤ B ^ S.card := by + rw [norm_prod] + calc + _ ≤ ∏ _i ∈ S, B := Finset.prod_le_prod₀ (fun _ _ => norm_nonneg _) + (fun i hi => hg i (Finset.mem_insert_of_mem hi)) + _ = _ := by simp + rw [Finset.prod_insert ha, Finset.prod_insert ha, Finset.card_insert_of_notMem ha] + calc + _ = ‖f a * ((∏ i ∈ S, f i) - ∏ i ∈ S, g i) + + (f a - g a) * ∏ i ∈ S, g i‖ := by congr 1; ring + _ ≤ ‖f a‖ * ‖(∏ i ∈ S, f i) - ∏ i ∈ S, g i‖ + + ‖f a - g a‖ * ‖∏ i ∈ S, g i‖ := by + simpa only [norm_mul] using norm_add_le + (f a * ((∏ i ∈ S, f i) - ∏ i ∈ S, g i)) ((f a - g a) * ∏ i ∈ S, g i) + _ ≤ B * (S.card * δ * B ^ S.card) + δ * B ^ S.card := + add_le_add (mul_le_mul (hf a (Finset.mem_insert_self _ _)) hrec + (norm_nonneg _) (zero_le_one.trans hB)) + (mul_le_mul (hdiff a (Finset.mem_insert_self _ _)) hprod (norm_nonneg _) hδ) + _ = (S.card : ℝ) * δ * B ^ (S.card + 1) + δ * B ^ S.card := by rw [pow_succ]; ring + _ ≤ (S.card : ℝ) * δ * B ^ (S.card + 1) + δ * B ^ (S.card + 1) := + add_le_add le_rfl (mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hB (Nat.le_succ _)) hδ) + _ = _ := by push_cast; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem abs_prod_sub_prod_le_envelope {I : Type*} (s : Finset I) (f g : I → ℝ) + (hf : ∀ i ∈ s, 0 ≤ f i) (hg : ∀ i ∈ s, 0 ≤ g i) : + |(∏ i ∈ s, f i) - ∏ i ∈ s, g i| ≤ + (∏ i ∈ s, (f i + |f i - g i|)) - ∏ i ∈ s, f i := by + classical + revert hf hg + induction s using Finset.induction_on with + | empty => intro _ _; simp + | @insert a s ha ih => + intro hf hg + have hf' := fun i hi => hf i (Finset.mem_insert_of_mem hi) + have hg' := fun i hi => hg i (Finset.mem_insert_of_mem hi) + have hrec := ih hf' hg' + have hga : 0 ≤ ∏ i ∈ s, g i := Finset.prod_nonneg hg' + have hprod : (∏ i ∈ s, g i) ≤ ∏ i ∈ s, (f i + |f i - g i|) := by + apply Finset.prod_le_prod₀ hg' + intro i hi + linarith [neg_abs_le (f i - g i)] + rw [Finset.prod_insert ha, Finset.prod_insert ha, Finset.prod_insert ha] + calc + _ = |f a * ((∏ i ∈ s, f i) - ∏ i ∈ s, g i) + + (f a - g a) * ∏ i ∈ s, g i| := by congr 1; ring + _ ≤ f a * |(∏ i ∈ s, f i) - ∏ i ∈ s, g i| + + |f a - g a| * ∏ i ∈ s, g i := by + simpa only [abs_mul, abs_of_nonneg (hf a (Finset.mem_insert_self _ _)), + abs_of_nonneg hga] using abs_add_le + (f a * ((∏ i ∈ s, f i) - ∏ i ∈ s, g i)) + ((f a - g a) * ∏ i ∈ s, g i) + _ ≤ f a * ((∏ i ∈ s, (f i + |f i - g i|)) - ∏ i ∈ s, f i) + + |f a - g a| * ∏ i ∈ s, (f i + |f i - g i|) := + add_le_add (mul_le_mul_of_nonneg_left hrec (hf a (Finset.mem_insert_self _ _))) + (mul_le_mul_of_nonneg_left hprod (abs_nonneg _)) + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def uniformProductAccuracy (N : ℕ) (C δ : ℝ) : ℝ := + min 1 (δ / (((N : ℝ) + 1) * (C + 2) ^ N)) + +theorem uniformProductAccuracy_spec (N : ℕ) {C δ : ℝ} (hC : 0 ≤ C) (hδ : 0 < δ) : + 0 < uniformProductAccuracy N C δ ∧ uniformProductAccuracy N C δ ≤ 1 ∧ + (N : ℝ) * uniformProductAccuracy N C δ * (C + 2) ^ N ≤ δ := by + have hD : 0 < ((N : ℝ) + 1) * (C + 2) ^ N := by positivity + have he : 0 < uniformProductAccuracy N C δ := lt_min zero_lt_one (div_pos hδ hD) + refine ⟨he, min_le_left _ _, ?_⟩ + have hbound : uniformProductAccuracy N C δ * (((N : ℝ) + 1) * (C + 2) ^ N) ≤ δ := + (le_div_iff₀ hD).mp (min_le_right _ _) + have hp : 0 ≤ uniformProductAccuracy N C δ * (C + 2) ^ N := by positivity + nlinarith + +theorem norm_prod_sub_prod_le_uniform_accuracy {A : Type*} [Fintype A] + (N : ℕ) (hcard : Fintype.card A ≤ N) {C δ : ℝ} (hC : 0 ≤ C) (hδ : 0 < δ) + (f g : A → ℂ) (hg : ∀ a, ‖g a‖ ≤ C) + (herr : ∀ a, ‖f a - g a‖ ≤ uniformProductAccuracy N C δ) : + ‖(∏ a, f a) - ∏ a, g a‖ ≤ δ := by + obtain ⟨he0, he1, heδ⟩ := uniformProductAccuracy_spec N hC hδ + have hB : 1 ≤ C + 2 := by linarith + have hf (a : A) : ‖f a‖ ≤ C + 2 := by + have hn : ‖f a‖ ≤ ‖f a - g a‖ + ‖g a‖ := by + simpa only [sub_add_cancel] using norm_add_le (f a - g a) (g a) + linarith [herr a, hg a] + have hprod := norm_finset_prod_sub_prod_le Finset.univ f g hB he0.le + (fun a _ => hf a) (fun a _ => (hg a).trans (by linarith)) (fun a _ => herr a) + have hc : (Fintype.card A : ℝ) ≤ N := by exact_mod_cast hcard + calc + _ ≤ (Fintype.card A : ℝ) * uniformProductAccuracy N C δ * (C + 2) ^ Fintype.card A := by + simpa only [Finset.card_univ] using hprod + _ ≤ (N : ℝ) * uniformProductAccuracy N C δ * (C + 2) ^ N := + mul_le_mul (mul_le_mul_of_nonneg_right hc he0.le) + (pow_le_pow_right₀ hB hcard) (pow_nonneg (by linarith) _) (by positivity) + _ ≤ δ := heδ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformProductAccuracyLogBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformProductAccuracyLogBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8bdc4be72d1c448bc42754ac8e2cdddd45ccb0e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformProductAccuracyLogBounds.lean @@ -0,0 +1,60 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedInactiveSupportBudget + +namespace OAI + +section + +namespace Erdos3 + +def uniformProductAccuracyLog {A : Type*} [Semiring A] (D T E : A) : A := + D + D * (T + 4) + E + +theorem uniformProductAccuracyLog_nonneg {D T E : ℝ} + (hD : 0 ≤ D) (hT : 0 ≤ T) (hE : 0 ≤ E) : + 0 ≤ uniformProductAccuracyLog D T E := by unfold uniformProductAccuracyLog; positivity + +theorem uniformProductAccuracy_inverse_exp_bound (N : ℕ) {C δ D T E : ℝ} + (hC : 0 ≤ C) (hδ : 0 < δ) (hD : 0 ≤ D) (hT : 0 ≤ T) (hE : 0 ≤ E) + (hN : (N : ℝ) ≤ D) (hCT : C ≤ Real.exp T) (hδE : δ⁻¹ ≤ Real.exp E) : + (uniformProductAccuracy N C δ)⁻¹ ≤ Real.exp (uniformProductAccuracyLog D T E) := by + have hNexp : (N : ℝ) + 1 ≤ Real.exp D := by linarith [Real.add_one_le_exp D] + have hCexp : C + 2 ≤ Real.exp (T + 4) := + (by linarith : C + 2 ≤ 2 * C + 3).trans (two_mul_add_three_exp_bound hT hCT) + have hpow := pow_le_exp_mul_of_le_exp (by positivity : 0 ≤ C + 2) + hCexp (by positivity) N hN + have hden : ((N : ℝ) + 1) * (C + 2) ^ N ≤ Real.exp (D + D * (T + 4)) := + (mul_le_mul hNexp hpow (by positivity) (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + unfold uniformProductAccuracy + apply inv_min_le_of_inv_le + · rw [inv_one] + exact Real.one_le_exp_iff.mpr (uniformProductAccuracyLog_nonneg hD hT hE) + · rw [inv_div, div_eq_mul_inv] + exact (mul_le_mul hden hδE (inv_nonneg.mpr hδ.le) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + +theorem uniformProductHalfAccuracy_inverse_exp_bound (N : ℕ) {C cap δ D T E : ℝ} + (hC : 0 ≤ C) (hcap : 0 ≤ cap) (hcapC : cap ≤ C) (hδ : 0 < δ) + (hD : 0 ≤ D) (hT : 0 ≤ T) (hE : 0 ≤ E) + (hN : (N : ℝ) ≤ D) (hCT : C ≤ Real.exp T) (hδE : δ⁻¹ ≤ Real.exp E) : + ((uniformProductAccuracy N C δ / 2) / (cap + 1))⁻¹ ≤ + Real.exp (uniformProductAccuracyLog D T E + T + 2) := by + have hu := uniformProductAccuracy_inverse_exp_bound N hC hδ hD hT hE hN hCT hδE + have hcapexp : cap + 1 ≤ Real.exp (T + 1) := by + calc + _ ≤ 1 + C := by linarith + _ ≤ _ := one_add_le_exp_succ hT hCT + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + _ = (uniformProductAccuracy N C δ)⁻¹ * (2 * (cap + 1)) := by + simp only [div_eq_mul_inv, mul_inv_rev, inv_inv] + ring + _ ≤ Real.exp (uniformProductAccuracyLog D T E) * (Real.exp 1 * Real.exp (T + 1)) := + mul_le_mul hu (mul_le_mul htwo hcapexp (by positivity) (Real.exp_pos _).le) + (by positivity) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformProfileRadiusLog.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformProfileRadiusLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..c02bb42423f3ea80f8ad51b80b9fe2e6446ddcae --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformProfileRadiusLog.lean @@ -0,0 +1,160 @@ +import OAI.Combinatorics.Progressions.Sampling.SamplerParameterLog + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +variable {D : Type*} [Fintype D] {B : D → Type*} [∀ d, Fintype (B d)] + +noncomputable def unitProfileCoefficientLog (A T : ℝ≥0) : ℝ := + (∑ d, (Fintype.card (B d) : ℝ)) + A + T + 7 + +theorem unitProfileCoefficientLog_nonneg (A T : ℝ≥0) : + 0 ≤ unitProfileCoefficientLog (B := B) A T := by + unfold unitProfileCoefficientLog + positivity + +theorem unitProfileCoefficientLog_bounds (A T : ℝ≥0) : + let P := unitProfileCoefficientLog (B := B) A T + (∀ d, (unitProfilePrincipalSize (B := B) d)⁻¹ ≤ Real.exp P) ∧ + (∀ d, 2 * unitProfilePrincipalSize (B := B) d ≤ Real.exp P) ∧ + (A : ℝ) ≤ Real.exp P ∧ (T : ℝ) ≤ Real.exp P := by + classical + let P := unitProfileCoefficientLog (B := B) A T + have hP : 0 ≤ P := unitProfileCoefficientLog_nonneg A T + have hsum : 0 ≤ ∑ d, (Fintype.card (B d) : ℝ) := by positivity + have hB (d : D) : (Fintype.card (B d) : ℝ) ≤ ∑ e, (Fintype.card (B e) : ℝ) := + Finset.single_le_sum (f := fun e => (Fintype.card (B e) : ℝ)) + (fun e _ => Nat.cast_nonneg _) (Finset.mem_univ d) + have hPE : P ≤ Real.exp P := by linarith [Real.add_one_le_exp P] + refine ⟨?_, ?_, ?_, ?_⟩ + · intro d + change (1 / (8 * ((Fintype.card (B d) : ℝ) + 1)))⁻¹ ≤ Real.exp P + rw [one_div, inv_inv] + calc + _ ≤ Real.exp 7 * Real.exp (Fintype.card (B d)) := by + gcongr + · linarith [Real.add_one_le_exp (7 : ℝ)] + · exact Real.add_one_le_exp _ + _ = Real.exp (7 + (Fintype.card (B d) : ℝ)) := (Real.exp_add _ _).symm + _ ≤ Real.exp P := by + apply Real.exp_le_exp.mpr + dsimp [P, unitProfileCoefficientLog] + linarith [hB d, A.coe_nonneg, T.coe_nonneg] + · intro d + apply le_trans (b := 1) _ (Real.one_le_exp hP) + change 2 * (1 / (8 * ((Fintype.card (B d) : ℝ) + 1))) ≤ 1 + rw [← mul_div_assoc, mul_one] + apply (div_le_one (by positivity)).mpr + nlinarith [Nat.cast_nonneg (α := ℝ) (Fintype.card (B d))] + · apply le_trans (b := P) _ hPE + dsimp [P, unitProfileCoefficientLog] + linarith [T.coe_nonneg] + · apply le_trans (b := P) _ hPE + dsimp [P, unitProfileCoefficientLog] + linarith [A.coe_nonneg] + +theorem uniformProfileScale_inverse_le_exp + (G Z α : Type*) [Fintype G] [Fintype Z] [Fintype α] [DecidableEq α] + {O : D → Type*} [∀ d, Fintype (O d)] [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) (A T : ℝ≥0) (degree : ℕ) + {ε E : ℝ} (hε : 0 < ε) (hE : 0 ≤ E) (hεE : ε⁻¹ ≤ Real.exp E) : + (booleanMassPerturbationScale (B := B) (O := O) (α := α) + (Z ⊕ (Σ d, SamplerCoefficientSlot G B h d)) h + (unitProfilePrincipalSize (B := B)) (fun d => 2 * unitProfilePrincipalSize (B := B) d) + A T degree 1 ε)⁻¹ ≤ + Real.exp (6 * booleanMassInputLog (B := B) (O := O) (α := α) h degree + (unitProfileCoefficientLog (B := B) A T) E (samplerParameterLog G Z α (B := B) h) + 8) := by + obtain ⟨hcP, hCP, hAP, hTP⟩ := unitProfileCoefficientLog_bounds (B := B) A T + have hP := unitProfileCoefficientLog_nonneg (B := B) A T + exact booleanMassPerturbationScale_input_le_exp _ h hh + (unitProfilePrincipalSize (B := B)) (fun d => 2 * unitProfilePrincipalSize (B := B) d) + (unitProfilePrincipalSize_pos (B := B)) + (fun d => mul_nonneg (by norm_num) (unitProfilePrincipalSize_pos (B := B) d).le) + A T degree zero_le_one hε hP hE (samplerParameterLog_nonneg G Z α h) + hcP hCP hAP hTP (Real.one_le_exp hP) hεE (samplerParameter_card_le_exp G Z α h) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +variable {D α : Type*} [Fintype D] [Fintype α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] + +noncomputable def booleanRegularizationInputLog (h : D → ℕ) (P E : ℝ) : ℝ := + jointBooleanTranslationLog (B := B) (O := O) (α := α) h P (E + Fintype.card D + 3) + E + 3 + +theorem booleanRegularizationInputLog_nonneg (h : D → ℕ) {P E : ℝ} + (hP : 0 ≤ P) (hE : 0 ≤ E) : + 0 ≤ booleanRegularizationInputLog (B := B) (O := O) (α := α) h P E := by + have hL := jointBooleanTranslationLog_nonneg (B := B) (O := O) (α := α) + h hP (show 0 ≤ E + Fintype.card D + 3 by positivity) + unfold booleanRegularizationInputLog + positivity + +theorem booleanRegularizationRadius_input_le_exp [DecidableEq α] [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) (c₀ C : D → ℝ) + (hc₀ : ∀ d, 0 < c₀ d) (hC : ∀ d, 0 ≤ C d) (A T : ℝ≥0) + {ε P E : ℝ} (hε : 0 < ε) (hP : 0 ≤ P) (hE : 0 ≤ E) + (hcP : ∀ d, (c₀ d)⁻¹ ≤ Real.exp P) (hCP : ∀ d, C d ≤ Real.exp P) + (hAP : (A : ℝ) ≤ Real.exp P) (hTP : (T : ℝ) ≤ Real.exp P) + (hεE : ε⁻¹ ≤ Real.exp E) : + (booleanRegularizationRadius (B := B) (O := O) (α := α) h c₀ C A T ε)⁻¹ ≤ + Real.exp (2 * booleanRegularizationInputLog (B := B) (O := O) (α := α) h P E + 2) := by + let E' := E + Fintype.card D + 3 + have hE' : 0 ≤ E' := by dsimp [E']; positivity + have hηE : (ε / (4 * ((Fintype.card D : ℝ) + 1)))⁻¹ ≤ Real.exp E' := by + rw [div_mul_eq_div_div, inv_div, div_div_eq_mul_div, div_eq_mul_inv] + calc + _ ≤ (Real.exp (Fintype.card D) * Real.exp 3) * Real.exp E := by + gcongr + · exact Real.add_one_le_exp _ + · linarith [Real.add_one_le_exp (3 : ℝ)] + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; dsimp [E']; ring + have hη : ∀ _d : D, 0 < ε / (4 * ((Fintype.card D : ℝ) + 1)) := by + intro d + positivity + have hL := jointBooleanRegularizationBudget_le_exp (B := B) (O := O) (α := α) + h hh c₀ C (fun _ => ε / (4 * ((Fintype.card D : ℝ) + 1))) hc₀ hC hη hP hE' + hcP hCP (fun _ => hηE) A T hAP hTP + have hL0 := jointBooleanTranslationLog_nonneg (B := B) (O := O) (α := α) h hP hE' + apply booleanRegularizationRadius_inverse_le_exp h c₀ C A T hε + (booleanRegularizationInputLog_nonneg h hP hE) + · apply hL.trans + apply Real.exp_le_exp.mpr + change _ ≤ jointBooleanTranslationLog (B := B) (O := O) (α := α) h P E' + E + 3 + linarith + · apply hεE.trans + apply Real.exp_le_exp.mpr + change _ ≤ jointBooleanTranslationLog (B := B) (O := O) (α := α) h P E' + E + 3 + linarith + +theorem uniformProfileRadius_inverse_le_exp [DecidableEq α] [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) (A T : ℝ≥0) + {ε E : ℝ} (hε : 0 < ε) (hE : 0 ≤ E) (hεE : ε⁻¹ ≤ Real.exp E) : + (booleanRegularizationRadius (B := B) (O := O) (α := α) h + (unitProfilePrincipalSize (B := B)) (fun d => 2 * unitProfilePrincipalSize (B := B) d) A T ε)⁻¹ ≤ + Real.exp (2 * booleanRegularizationInputLog (B := B) (O := O) (α := α) h + (unitProfileCoefficientLog (B := B) A T) E + 2) := by + obtain ⟨hcP, hCP, hAP, hTP⟩ := unitProfileCoefficientLog_bounds (B := B) A T + exact booleanRegularizationRadius_input_le_exp h hh + (unitProfilePrincipalSize (B := B)) (fun d => 2 * unitProfilePrincipalSize (B := B) d) + (unitProfilePrincipalSize_pos (B := B)) + (fun d => mul_nonneg (by norm_num) (unitProfilePrincipalSize_pos (B := B) d).le) + A T hε (unitProfileCoefficientLog_nonneg (B := B) A T) hE hcP hCP hAP hTP hεE + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformRegularizedProfileComparison.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformRegularizedProfileComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..4907435e3e76fb48c4c849526ac7629aff04faa3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformRegularizedProfileComparison.lean @@ -0,0 +1,523 @@ +import OAI.Combinatorics.Progressions.Dynamics.PartitionedRegularizationBudget + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal ContDiff + +theorem exists_retained_boolean_regularization_with_radius {Ω D α : Type*} [MeasurableSpace Ω] + [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] + [∀ d, Fintype (O d)] [∀ d, DecidableEq (O d)] [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) (sets : ∀ d, O d → Finset α) + (hsets : ∀ d, Function.Injective (sets d)) (hcard : ∀ d o, (sets d o).card ≤ h d) + (block : ∀ d, O d → B d) (hblock : ∀ d, Function.Injective (block d)) + (c₀ C : D → ℝ) (hc₀ : ∀ d, 0 < c₀ d) (hC : ∀ d, 0 ≤ C d) + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) + (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) + (A T : ℝ≥0) (hLip : LipschitzWith A ψ) (hTransition : LipschitzWith T Real.smoothTransition) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ≥0, 0 < δ ∧ δ ≤ 1 ∧ + (δ : ℝ) = booleanRegularizationRadius (B := B) (O := O) (α := α) h c₀ C A T ε ∧ + ∀ (c : Ω → ∀ d, B d → ℝ) (b : Ω → (Σ d, O d) → ℝ), + (∀ d j, Measurable (fun a => c a d j)) → Measurable b → + ∀ μ : Measure Ω, IsProbabilityMeasure μ → + (∀ᵐ a ∂μ, (∀ d o, c₀ d ≤ |c a d (block d o)|) ∧ (∀ d o, |c a d (block d o)| ≤ C d)) → + ∀ φ : Ω × ((Σ d, O d) → ℝ) → ℝ, Measurable φ → (∀ p, ‖φ p‖ ≤ 1) → + |(∫ p, regularizedImageDensity (jointBooleanSource h) + (fun x => b p.1+jointBooleanSampler h (c p.1) sets x) δ p.2*φ p ∂μ.prod volume) - + ∫ p, φ (p.1, b p.1+jointBooleanSampler h (c p.1) sets p.2) ∂μ.prod (jointBooleanSource h)| ≤ ε := by + obtain ⟨δ, hδ, hδ1, heq, herr⟩ := exists_uniform_boolean_regularization_with_radius h hh sets hsets hcard block hblock + c₀ C hc₀ hC ψ hψ hrange hzero hone A T hLip hTransition hε + refine ⟨δ, hδ, hδ1, heq, ?_⟩ + intro c b hc hb μ hμ hgood φ hφ hbound + let : IsProbabilityMeasure μ := hμ + have hU : Measurable (fun p : Ω × (JointBlockParameter B h α → ℝ) => + b p.1+jointBooleanSampler h (c p.1) sets p.2) := + (hb.comp measurable_fst).add (jointBooleanSampler_measurable_frozen h sets c hc) + apply conditionalRegularizedDensity_test_error μ (jointBooleanSource h) _ hU δ hδ _ φ hφ hbound + filter_upwards [hgood] with a ha + exact herr (c a) ha.1 ha.2 (b a) + +theorem exists_retained_boolean_regularization {Ω D α : Type*} [MeasurableSpace Ω] + [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] + [∀ d, Fintype (O d)] [∀ d, DecidableEq (O d)] [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) (sets : ∀ d, O d → Finset α) + (hsets : ∀ d, Function.Injective (sets d)) (hcard : ∀ d o, (sets d o).card ≤ h d) + (block : ∀ d, O d → B d) (hblock : ∀ d, Function.Injective (block d)) + (c₀ C : D → ℝ) (hc₀ : ∀ d, 0 < c₀ d) (hC : ∀ d, 0 ≤ C d) + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) + (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) + (A T : ℝ≥0) (hLip : LipschitzWith A ψ) (hTransition : LipschitzWith T Real.smoothTransition) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ≥0, 0 < δ ∧ δ ≤ 1 ∧ + ∀ (c : Ω → ∀ d, B d → ℝ) (b : Ω → (Σ d, O d) → ℝ), + (∀ d j, Measurable (fun a => c a d j)) → Measurable b → + ∀ μ : Measure Ω, IsProbabilityMeasure μ → + (∀ᵐ a ∂μ, (∀ d o, c₀ d ≤ |c a d (block d o)|) ∧ (∀ d o, |c a d (block d o)| ≤ C d)) → + ∀ φ : Ω × ((Σ d, O d) → ℝ) → ℝ, Measurable φ → (∀ p, ‖φ p‖ ≤ 1) → + |(∫ p, regularizedImageDensity (jointBooleanSource h) + (fun x => b p.1+jointBooleanSampler h (c p.1) sets x) δ p.2*φ p ∂μ.prod volume) - + ∫ p, φ (p.1, b p.1+jointBooleanSampler h (c p.1) sets p.2) ∂μ.prod (jointBooleanSource h)| ≤ ε := by + obtain ⟨δ, hpos, hone, _, herr⟩ := exists_retained_boolean_regularization_with_radius (Ω := Ω) h hh sets hsets hcard block hblock + c₀ C hc₀ hC ψ hψ hrange hzero hone A T hLip hTransition hε + exact ⟨δ, hpos, hone, herr⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ContDiff NNReal BigOperators + +theorem partitioned_coefficient_global_tolerance + {Ω D G K Z α Y : Type*} [MeasurableSpace Ω] [MeasurableSpace Y] + [Fintype D] [Fintype G] [Fintype Z] [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] + [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) (P : D → Prop) [DecidablePred P] + {L : {d // ¬P d} → Type*} + (c : Ω → ∀ d : {d // ¬P d}, B d.val → ℝ) + (hc : ∀ d b, Measurable (fun a => c a d b)) + (z : Ω → PartitionedProfileNoiseIndex G Z α B h P → ℝ) + (hz : ∀ j, Measurable (fun a => z a j)) + (sets : ∀ d : {d // ¬P d}, O d.val → Finset α) + (hsets : ∀ d, Function.Injective (sets d)) + (hcard : ∀ d o, (sets d o).card ≤ h d.val) + (block : ∀ d : {d // ¬P d}, O d.val → B d.val) + (hblock : ∀ d, Function.Injective (block d)) + (c₀ C : D → ℝ) (hc₀ : ∀ d, 0 < c₀ d) (hC : ∀ d, 0 ≤ C d) + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) + (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) + (A T : ℝ≥0) (hLip : LipschitzWith A ψ) (hTransition : LipschitzWith T Real.smoothTransition) + (terms : ∀ d, Finset (L d)) (weight : ∀ d, L d → ℝ) + (exponent : ∀ d, L d → K →₀ ℕ) + (coefficientIndex : ∀ d, L d → PartitionedProfileNoiseIndex G Z α B h P) + (inputIndex : K → Option α → PartitionedProfileNoiseIndex G Z α B h P ⊕ + PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d)) + {degree : ℕ} + (htaildegree : ∀ d n, n ∈ terms d → (exponent d n).sum (fun _ e => e) ≤ degree) + {Wsum : ℝ} (hWsum : 0 ≤ Wsum) + (hwsum : ∀ d, (∑ n ∈ terms d, |weight d n|) ≤ Wsum) + {ε : ℝ} (hε : 0 < ε) : + let t := booleanMassPerturbationScale (B := B) (O := O) (α := α) + (Z ⊕ (Σ d, SamplerCoefficientSlot G B h d)) h c₀ C A T degree Wsum ε + 0 < t ∧ t ≤ 1 ∧ ∀ s : ℝ, |s| ≤ t → + ∀ μ : Measure Ω, IsProbabilityMeasure μ → + (∀ᵐ a ∂μ, ∀ j, |z a j| ≤ 1) → + (∀ᵐ a ∂μ, ∀ d o, c₀ d.val ≤ |c a d (block d o)|) → + (∀ᵐ a ∂μ, ∀ d o, |c a d (block d o)| ≤ C d.val) → + ∀ F : Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) → Y, Measurable F → + ∀ φ : Y → ℝ, Measurable φ → (∀ y, ‖φ y‖ ≤ 1) → + |(∫ p, φ (F (p.1, jointBooleanSampler (fun d : {d // ¬P d} => h d.val) + (c p.1) sets p.2)) ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))) - + ∫ p, φ (F (p.1, coefficientArraySampler (fun d : {d // ¬P d} => h d.val) + (c p.1) sets terms weight exponent coefficientIndex inputIndex s (z p.1) p.2)) + ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))| ≤ ε := by + classical + let η : D → ℝ := fun _ => (ε / 4) / ((Fintype.card D : ℝ) + 1) + have hη (d : D) : 0 < η d := by dsimp [η]; positivity + have hsum : (∑ d, η d) ≤ ε / 4 := by + simp only [η, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + rw [← mul_div_assoc] + apply (div_le_iff₀ (by positivity)).mpr + nlinarith + have hsumP : (∑ d : {d // ¬P d}, η d.val) ≤ ∑ d, η d := + nonnegative_axis_sum_restrict_le (fun d => ¬P d) η (fun d => (hη d).le) + let κ := fun d => canonicalCubeMinorThreshold Unit (O d) α (h d) (c₀ d) (η d) + have hκ (d : D) : 0 < κ d := + canonicalCubeMinorThreshold_pos Unit (O d) α (hh d) (hc₀ d) (hη d) + let r := fun d (_ : B d × Fin (h d)) => + scalarCubeProductBoundaryRadius (B d × Fin (h d)) α (η d / 2) + have hr (d : D) (i : B d × Fin (h d)) : 0 < r d i := + scalarCubeProductBoundaryRadius_pos (B d × Fin (h d)) α (half_pos (hη d)) + let Kinv := jointBooleanInverseBudget (O := O) (α := α) h C κ + let Hderiv := jointBooleanDerivativeBudget (B := B) (O := O) (α := α) h C + let S := jointBooleanWeightBudget (O := O) (α := α) h C A T r κ + have hS : 0 ≤ S := jointBooleanWeightBudget_nonneg h C hC A T r + (fun d i => (hr d i).le) κ (fun d => (hκ d).le) + let SP := jointBooleanWeightBudget (B := fun d : {d // ¬P d} => B d.val) + (O := fun d : {d // ¬P d} => O d.val) (α := α) + (fun d => h d.val) (fun d => C d.val) A T (fun d => r d.val) (fun d => κ d.val) + have hSP : SP ≤ S := jointBooleanWeightBudget_restrict_le (fun d => ¬P d) + h C hC A T r (fun d i => (hr d i).le) κ (fun d => (hκ d).le) + let M := booleanMassToleranceC2 (B := B) (α := α) + (Z ⊕ (Σ d, SamplerCoefficientSlot G B h d)) h degree Wsum + have hM : 0 ≤ M := booleanMassToleranceC2_nonneg _ h degree hWsum + have hMP : polynomialMassC2Budget + (Fintype.card (PolynomialParameter (PartitionedProfileNoiseIndex G Z α B h P) + (PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d)))) + (degree + 1) (booleanJetMassBudget (Fintype.card α) degree Wsum) = M := + partitionedMassToleranceC2_eq h P degree Wsum + have hdim : (Fintype.card (PrincipalAxisParameter (B := B) (h := h) (α := α) + (fun d => ¬P d)) : ℝ) ≤ Fintype.card (JointBlockParameter B h α) := by + exact_mod_cast dependentAxis_card_restrict_le + (fun d => BlockParameter (B d) (Fin (h d)) α) (fun d => ¬P d) + have hout : (Fintype.card (Σ d : {d // ¬P d}, O d.val) : ℝ) ≤ Fintype.card (Σ d, O d) := by + exact_mod_cast dependentAxis_card_restrict_le O (fun d => ¬P d) + let Q := 1 + 2 * (Kinv : ℝ) * S + (Fintype.card (JointBlockParameter B h α) : ℝ) * + ((2 * (Kinv : ℝ)) ^ 2 * ((Hderiv : ℝ) + 1)) + let QP := 1 + 2 * (Kinv : ℝ) * SP + + (Fintype.card (PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d)) : ℝ) * + ((2 * (Kinv : ℝ)) ^ 2 * ((Hderiv : ℝ) + 1)) + have hQ : 0 ≤ Q := by dsimp only [Q]; positivity + have hQP : QP ≤ Q := by + dsimp only [QP, Q] + gcongr + let t := polynomialPerturbationScale Kinv M Q (ε / 2) (Fintype.card (Σ d, O d)) + have ht := polynomialPerturbationScale_spec Kinv.coe_nonneg hM hQ (half_pos hε) + (Fintype.card (Σ d, O d)) + have htpos : 0 < t := ht.1 + change 0 < t ∧ t ≤ 1 ∧ _ + refine ⟨ht.1, ht.2.1, ?_⟩ + intro s hs μ hμ hbox hclow hcup F hF φ hφ hbound + have hratio : |s / t| ≤ 1 := by + rw [abs_div, abs_of_pos ht.1] + exact (div_le_one ht.1).mpr hs + have hw : ∀ d, (∑ n ∈ terms d, |(s / t) * weight d n|) ≤ Wsum := + fun d => coefficientTailWeightSum_scale_le (terms d) (weight d) hratio (hwsum d) + have hcancel : t * (s / t) = s := by field_simp [ne_of_gt htpos] + have he := random_coefficient_array_mass_comparison c hc z hz sets hsets + (fun d : {d // ¬P d} => h d.val) (fun d => hh d.val) hcard block hblock + (fun d => c₀ d.val) (fun d => C d.val) (fun d => hc₀ d.val) (fun d => hC d.val) + ψ hψ hrange hzero hone A T hLip hTransition terms (fun d n => (s / t) * weight d n) + exponent coefficientIndex inputIndex htaildegree hWsum hw (fun d => η d.val) + (fun d => hη d.val) Kinv Hderiv + (fun d => jointBooleanInverseBudget_le h C κ d.val) + (fun d => jointBooleanDerivativeBudget_le h C d.val) + t ht.1 (by rw [hMP]; exact ht.2.2.1) (by rw [hMP]; exact ht.2.2.2.1) + μ hμ hbox hclow hcup F hF φ hφ hbound + have herr : 2 * (∑ d : {d // ¬P d}, η d.val) + + 4 * (Fintype.card (Σ d : {d // ¬P d}, O d.val) : ℝ) * Real.sqrt (QP * (t * (1 + M))) ≤ ε := by + calc + _ ≤ 2 * (∑ d, η d) + + 4 * (Fintype.card (Σ d, O d) : ℝ) * Real.sqrt (Q * (t * (1 + M))) := by + gcongr + _ ≤ ε / 2 + ε / 2 := add_le_add (by linarith) ht.2.2.2.2 + _ = ε := by ring + apply le_trans _ herr + simpa only [coefficientArraySampler_scale_weight, hcancel, hMP] using he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators ContDiff NNReal + +theorem uniform_partition_profile_comparison + {Ω D G Z α : Type*} [MeasurableSpace Ω] + [Fintype D] [Fintype G] [Fintype Z] [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] + [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) + (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) + (A T : ℝ≥0) (hLip : LipschitzWith A ψ) (hTransition : LipschitzWith T Real.smoothTransition) + {degree : ℕ} (hdegree : ∀ d, h d ≤ degree) {ε : ℝ} (hε : 0 < ε) : + let t := booleanMassPerturbationScale (B := B) (O := O) (α := α) + (Z ⊕ (Σ d, SamplerCoefficientSlot G B h d)) h + (unitProfilePrincipalSize (B := B)) (fun d => 2 * unitProfilePrincipalSize (B := B) d) + A T degree 1 ε + 0 < t ∧ t ≤ 1 ∧ + ∀ (P : D → Prop) [DecidablePred P], + ∀ (extra : G → Option α → Z) + (sets : ∀ d : {d // ¬P d}, O d.val → Finset α), + (∀ d, Function.Injective (sets d)) → (∀ d o, (sets d o).card ≤ h d.val) → + ∀ block : ∀ d : {d // ¬P d}, O d.val → B d.val, + (∀ d, Function.Injective (block d)) → + ∀ z : Ω → PartitionedProfileNoiseIndex G Z α B h P → ℝ, + (∀ j, Measurable (fun a => z a j)) → + ∀ s : ℝ, |s| ≤ t → + ∀ μ : Measure Ω, IsProbabilityMeasure μ → (∀ᵐ a ∂μ, ∀ j, |z a j| ≤ 1) → + ∀ R : D → ℝ, ∀ f : Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) → ℝ, + Measurable f → (∀ p, ‖f p‖ ≤ 1) → + |(∫ p, f (p.1, partitionedAllocatedProfileJet h P extra sets R 0 (z p.1) p.2) + ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))) - + ∫ p, f (p.1, partitionedAllocatedProfileJet h P extra sets R s (z p.1) p.2) + ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))| ≤ ε := by + classical + have hQ := booleanToleranceDivergence_nonneg (B := B) (O := O) (α := α) h hh + (unitProfilePrincipalSize (B := B)) (fun d => 2 * unitProfilePrincipalSize (B := B) d) + (unitProfilePrincipalSize_pos (B := B)) + (fun d => mul_nonneg (by norm_num) (unitProfilePrincipalSize_pos (B := B) d).le) A T hε + have hM := booleanMassToleranceC2_nonneg (B := B) (α := α) + (Z ⊕ (Σ d, SamplerCoefficientSlot G B h d)) h degree zero_le_one + have ht := polynomialPerturbationScale_spec + (jointBooleanInverseBudget (O := O) (α := α) h + (fun d => 2 * unitProfilePrincipalSize (B := B) d) + (booleanToleranceMinor (O := O) (α := α) h (unitProfilePrincipalSize (B := B)) ε)).coe_nonneg + hM hQ (half_pos hε) (Fintype.card (Σ d, O d)) + refine ⟨ht.1, ht.2.1, ?_⟩ + intro P instP extra sets hsets hcard block hblock z hz + let c := fun a => partitionedProfilePrincipal h P (unitProfilePrincipalSize (B := B)) (z a) + have hc (d : {d // ¬P d}) (b : B d.val) : Measurable (fun a => c a d b) := by + dsimp [c, partitionedProfilePrincipal] + exact measurable_const.add (measurable_const.mul (hz _)) + obtain ⟨_, _, hcomp⟩ := partitioned_coefficient_global_tolerance + (Y := Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ)) h hh P c hc z hz sets hsets + hcard block hblock + (unitProfilePrincipalSize (B := B)) + (fun d => 2 * unitProfilePrincipalSize (B := B) d) + (unitProfilePrincipalSize_pos (B := B)) + (fun d => mul_nonneg (by norm_num) (unitProfilePrincipalSize_pos (B := B) d).le) + ψ hψ hrange hzero hone A T hLip hTransition + (partitionedProfileTerms (G := G) (B := B) h P) + (fun d _ => unitProfileTailSize (G := G) (B := B) h d.val) + (fun _ e => e.val) (fun d e => .inr ⟨d.val, e⟩) (partitionedProfileInput P extra) + (fun d e _ => e.property.trans (hdegree d.val)) + (Wsum := 1) zero_le_one (partitionedProfileTail_unit_sum h P) hε + intro s hs μ hμ hbox R f hf hfb + have hclow : ∀ᵐ a ∂μ, ∀ d o, unitProfilePrincipalSize (B := B) d.val ≤ |c a d (block d o)| := by + filter_upwards [hbox] with a ha + intro d o + exact (partitionedProfilePrincipal_unit_bounds h P (z a) ha d (block d o)).1 + have hcup : ∀ᵐ a ∂μ, ∀ d o, |c a d (block d o)| ≤ 2 * unitProfilePrincipalSize (B := B) d.val := by + filter_upwards [hbox] with a ha + intro d o + exact (partitionedProfilePrincipal_unit_bounds h P (z a) ha d (block d o)).2 + let F : Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) → Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) := fun p => + (p.1, fun o => R o.1.val * + (booleanConstantJet sets (partitionedProfileConstant h P (fun _ => 1 / 4) (z p.1)) o + p.2 o)) + have hF : Measurable F := by + apply measurable_fst.prodMk + apply Measurable.of_eval + intro o + have hzj := (hz (.inr ⟨o.1.val, constantCoefficientSlot _ _⟩)).comp + (measurable_fst : Measurable (Prod.fst : Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) → Ω)) + dsimp [F, booleanConstantJet, partitionedProfileConstant] + split_ifs <;> fun_prop + have hFactual (s : ℝ) (a : Ω) + (x : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) : + F (a, coefficientArraySampler (fun d : {d // ¬P d} => h d.val) (c a) sets + (partitionedProfileTerms (G := G) (B := B) h P) + (fun d _ => unitProfileTailSize (G := G) (B := B) h d.val) + (fun _ e => e.val) (fun d e => .inr ⟨d.val, e⟩) (partitionedProfileInput P extra) s (z a) x) = + (a, partitionedAllocatedProfileJet h P extra sets R s (z a) x) := by + apply Prod.ext + · rfl + dsimp only [F] + rw [partitionedAllocatedProfileJet_scale] + unfold partitionedAllocatedProfileJet + rw [partitionedProfileJet_eq h P extra sets hh] + rfl + have hFzero (a : Ω) + (x : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) : + F (a, jointBooleanSampler (fun d : {d // ¬P d} => h d.val) (c a) sets x) = + (a, partitionedAllocatedProfileJet h P extra sets R 0 (z a) x) := by + simpa only [coefficientArraySampler_zero] using hFactual 0 a x + simpa only [hFzero, hFactual] using hcomp s hs μ hμ hbox hclow hcup F hF f hf hfb + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal ContDiff BigOperators + +theorem exists_uniform_partition_regularization {Ω D α : Type*} [MeasurableSpace Ω] + [Fintype D] [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) + (c₀ C : D → ℝ) (hc₀ : ∀ d, 0 < c₀ d) (hC : ∀ d, 0 ≤ C d) + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) + (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) + (A T : ℝ≥0) (hLip : LipschitzWith A ψ) (hTransition : LipschitzWith T Real.smoothTransition) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ≥0, 0 < δ ∧ δ ≤ 1 ∧ + (δ : ℝ) = booleanRegularizationRadius (B := B) (O := O) (α := α) h c₀ C A T ε ∧ + ∀ (P : D → Prop) [DecidablePred P], + ∀ sets : ∀ d : {d // ¬P d}, O d.val → Finset α, + (∀ d, Function.Injective (sets d)) → (∀ d o, (sets d o).card ≤ h d.val) → + ∀ block : ∀ d : {d // ¬P d}, O d.val → B d.val, + (∀ d, Function.Injective (block d)) → + ∀ (c : Ω → ∀ d : {d // ¬P d}, B d.val → ℝ) + (b : Ω → (Σ d : {d // ¬P d}, O d.val) → ℝ), + (∀ d j, Measurable (fun a => c a d j)) → Measurable b → + ∀ μ : Measure Ω, IsProbabilityMeasure μ → + (∀ᵐ a ∂μ, (∀ d o, c₀ d.val ≤ |c a d (block d o)|) ∧ + (∀ d o, |c a d (block d o)| ≤ C d.val)) → + ∀ φ : Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) → ℝ, + Measurable φ → (∀ p, ‖φ p‖ ≤ 1) → + |(∫ p, regularizedImageDensity (jointBooleanSource (fun d : {d // ¬P d} => h d.val)) + (fun x => b p.1 + jointBooleanSampler (fun d : {d // ¬P d} => h d.val) + (c p.1) sets x) δ p.2 * φ p ∂μ.prod volume) - + ∫ p, φ (p.1, b p.1 + jointBooleanSampler (fun d : {d // ¬P d} => h d.val) + (c p.1) sets p.2) ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))| ≤ ε := by + classical + let η : D → ℝ := fun _ => ε / (4 * ((Fintype.card D : ℝ) + 1)) + have hη (d : D) : 0 < η d := by dsimp [η]; positivity + have hsmall : 2 * (∑ d, η d) ≤ ε / 2 := by + have hn : (0 : ℝ) ≤ Fintype.card D := Nat.cast_nonneg _ + have hv : 0 ≤ ε / (4 * ((Fintype.card D : ℝ) + 1)) := by positivity + have he : ((Fintype.card D : ℝ) + 1) * + (ε / (4 * ((Fintype.card D : ℝ) + 1))) = ε / 4 := by field_simp + have hm := mul_le_mul_of_nonneg_right + (show (Fintype.card D : ℝ) ≤ (Fintype.card D : ℝ) + 1 by linarith) hv + rw [he] at hm + simpa only [η, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] using + (show 2 * ((Fintype.card D : ℝ) * (ε / (4 * ((Fintype.card D : ℝ) + 1)))) ≤ ε / 2 by linarith) + let L := jointBooleanRegularizationBudget (B := B) (O := O) (α := α) h c₀ C A T η + have hspec := regularizationRadius_spec L.coe_nonneg hε + let δ : ℝ≥0 := ⟨regularizationRadius L ε, hspec.1.le⟩ + have hδ : 0 < δ := hspec.1 + have hδ1 : δ ≤ 1 := hspec.2.1 + have hnoise : (L : ℝ) * δ ≤ ε / 2 := hspec.2.2 + refine ⟨δ, hδ, hδ1, rfl, ?_⟩ + intro P instP sets hsets hcard block hblock c b hc hb μ hμ hgood φ hφ hbound + let : IsProbabilityMeasure μ := hμ + have hLP : (jointBooleanRegularizationBudget (B := fun d : {d // ¬P d} => B d.val) + (O := fun d : {d // ¬P d} => O d.val) (α := α) + (fun d => h d.val) (fun d => c₀ d.val) (fun d => C d.val) A T (fun d => η d.val) : ℝ) ≤ L := by + exact_mod_cast jointBooleanRegularizationBudget_restrict_le (B := B) (O := O) (α := α) + (fun d => ¬P d) h hh c₀ C hc₀ hC A T η hη + have hsumP : (∑ d : {d // ¬P d}, η d.val) ≤ ∑ d, η d := + nonnegative_axis_sum_restrict_le (fun d => ¬P d) η (fun d => (hη d).le) + have hU : Measurable (fun p : Ω × + (PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) => + b p.1 + jointBooleanSampler (fun d : {d // ¬P d} => h d.val) (c p.1) sets p.2) := + (hb.comp measurable_fst).add + (jointBooleanSampler_measurable_frozen (fun d : {d // ¬P d} => h d.val) sets c hc) + apply conditionalRegularizedDensity_test_error μ + (jointBooleanSource (fun d : {d // ¬P d} => h d.val)) _ hU δ hδ _ φ hφ hbound + filter_upwards [hgood] with a ha + intro f hf hfb + apply regularizedImageDensity_translate_error + (jointBooleanSource (fun d : {d // ¬P d} => h d.val)) + (jointBooleanSampler (fun d : {d // ¬P d} => h d.val) (c a) sets) + (jointBooleanSampler_contDiff (fun d : {d // ¬P d} => h d.val) (c a) sets).continuous.measurable + δ hδ _ (b a) f hf hfb + intro g hg hgb + have he := jointBoolean_regularization_choice_error + (fun d : {d // ¬P d} => h d.val) (fun d => hh d.val) sets hsets hcard block hblock + (fun d => c₀ d.val) (fun d => C d.val) (fun d => hc₀ d.val) (fun d => hC d.val) + (c a) ha.1 ha.2 ψ hψ hrange hzero hone A T hLip hTransition + (fun d => η d.val) (fun d => hη d.val) δ hδ g hg hgb + apply he.trans + have hm := mul_le_mul_of_nonneg_right hLP δ.coe_nonneg + linarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ContDiff NNReal + +theorem exists_uniform_regularized_profile_comparison + {Ω D G Z α : Type*} [MeasurableSpace Ω] + [Fintype D] [Fintype G] [Fintype Z] [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] [∀ d, Nonempty (O d)] + (h : D → ℕ) (hh : ∀ d, 0 < h d) + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) + (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) + (A T : ℝ≥0) (hLip : LipschitzWith A ψ) (hTransition : LipschitzWith T Real.smoothTransition) + {degree : ℕ} (hdegree : ∀ d, h d ≤ degree) {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ≥0, 0 < δ ∧ δ ≤ 1 ∧ + (δ : ℝ) = booleanRegularizationRadius (B := B) (O := O) (α := α) h + (unitProfilePrincipalSize (B := B)) (fun d => 2 * unitProfilePrincipalSize (B := B) d) + A T (ε / 2) ∧ + let t := booleanMassPerturbationScale (B := B) (O := O) (α := α) + (Z ⊕ (Σ d, SamplerCoefficientSlot G B h d)) h + (unitProfilePrincipalSize (B := B)) (fun d => 2 * unitProfilePrincipalSize (B := B) d) + A T degree 1 (ε / 2) + 0 < t ∧ t ≤ 1 ∧ + ∀ (P : D → Prop) [DecidablePred P], + ∀ (extra : G → Option α → Z) (sets : ∀ d : {d // ¬P d}, O d.val → Finset α), + (∀ d, Function.Injective (sets d)) → (∀ d o, (sets d o).card ≤ h d.val) → + ∀ block : ∀ d : {d // ¬P d}, O d.val → B d.val, + (∀ d, Function.Injective (block d)) → + ∀ z : Ω → PartitionedProfileNoiseIndex G Z α B h P → ℝ, + (∀ j, Measurable (fun a => z a j)) → + ∀ s : ℝ, |s| ≤ t → ∀ μ : Measure Ω, IsProbabilityMeasure μ → + (∀ᵐ a ∂μ, ∀ j, |z a j| ≤ 1) → + ∀ R : D → ℝ, ∀ f : Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) → ℝ, + Measurable f → (∀ p, ‖f p‖ ≤ 1) → + |(∫ p, partitionedRegularizedIdeal h P sets δ (z p.1) p.2 * + f (p.1, fun o => R o.1.val * p.2 o) ∂μ.prod volume) - + ∫ p, f (p.1, partitionedAllocatedProfileJet h P extra sets R s (z p.1) p.2) + ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))| ≤ ε := by + classical + obtain ⟨δ, hδ, hδ1, hδeq, hreg⟩ := exists_uniform_partition_regularization (Ω := Ω) + (B := B) (O := O) (α := α) h hh (unitProfilePrincipalSize (B := B)) + (fun d => 2 * unitProfilePrincipalSize (B := B) d) + (unitProfilePrincipalSize_pos (B := B)) + (fun d => mul_nonneg (by norm_num) (unitProfilePrincipalSize_pos (B := B) d).le) + ψ hψ hrange hzero hone A T hLip hTransition (half_pos hε) + have ht := uniform_partition_profile_comparison (Ω := Ω) (G := G) (Z := Z) (B := B) (O := O) (α := α) + h hh ψ hψ hrange hzero hone A T hLip hTransition hdegree (half_pos hε) + refine ⟨δ, hδ, hδ1, hδeq, ht.1, ht.2.1, ?_⟩ + intro P instP extra sets hsets hcard block hblock z hz s hs μ hμ hbox R f hf hfb + let c := fun a => partitionedProfilePrincipal h P (unitProfilePrincipalSize (B := B)) (z a) + let b := fun a => booleanConstantJet sets (partitionedProfileConstant h P (fun _ => 1 / 4) (z a)) + have hc (d : {d // ¬P d}) (j : B d.val) : Measurable (fun a => c a d j) := by + dsimp [c, partitionedProfilePrincipal] + exact measurable_const.add (measurable_const.mul (hz _)) + have hb : Measurable b := by + apply booleanConstantJet_measurable_comp + intro d + dsimp [partitionedProfileConstant] + exact measurable_const.mul (hz _) + have hgood : ∀ᵐ a ∂μ, + (∀ d o, unitProfilePrincipalSize (B := B) d.val ≤ |c a d (block d o)|) ∧ + (∀ d o, |c a d (block d o)| ≤ 2 * unitProfilePrincipalSize (B := B) d.val) := by + filter_upwards [hbox] with a ha + exact ⟨fun d o => (partitionedProfilePrincipal_unit_bounds h P (z a) ha d (block d o)).1, + fun d o => (partitionedProfilePrincipal_unit_bounds h P (z a) ha d (block d o)).2⟩ + let scale : Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) → + Ω × ((Σ d : {d // ¬P d}, O d.val) → ℝ) := + fun p => (p.1, fun o => R o.1.val * p.2 o) + have hscale : Measurable scale := by + apply measurable_fst.prodMk + apply Measurable.of_eval + intro o + exact measurable_const.mul ((measurable_pi_apply o).comp measurable_snd) + have hreg' := hreg P sets hsets hcard block hblock c b hc hb μ hμ hgood + (fun p => f (scale p)) (hf.comp hscale) (fun p => hfb (scale p)) + have hzero' (a : Ω) + (x : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) : + scale (a, b a + jointBooleanSampler (fun d : {d // ¬P d} => h d.val) (c a) sets x) = + (a, partitionedAllocatedProfileJet h P extra sets R 0 (z a) x) := by + apply Prod.ext + · rfl + exact (partitionedAllocatedProfileJet_zero h P sets hh extra R (z a) x).symm + simp only [hzero'] at hreg' + have hraw := ht.2.2 P extra sets hsets hcard block hblock z hz s hs μ hμ hbox R f hf hfb + have htri := abs_sub_le + (∫ p, partitionedRegularizedIdeal h P sets δ (z p.1) p.2 * f (scale p) ∂μ.prod volume) + (∫ p, f (p.1, partitionedAllocatedProfileJet h P extra sets R 0 (z p.1) p.2) + ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))) + (∫ p, f (p.1, partitionedAllocatedProfileJet h P extra sets R s (z p.1) p.2) + ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))) + apply htri.trans + change |(∫ p, partitionedRegularizedIdeal h P sets δ (z p.1) p.2 * f (scale p) ∂μ.prod volume) - + ∫ p, f (p.1, partitionedAllocatedProfileJet h P extra sets R 0 (z p.1) p.2) + ∂μ.prod (jointBooleanSource (fun d : {d // ¬P d} => h d.val))| ≤ ε / 2 at hreg' + linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformRelativePatchSource.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformRelativePatchSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd3a2e4a24489c8e8c3f9b0c7f382189aac9fc84 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformRelativePatchSource.lean @@ -0,0 +1,561 @@ +import OAI.Combinatorics.Progressions.Dynamics.AmplificationSourceResourceBudget +import OAI.Combinatorics.Progressions.Dynamics.RelativePatchAmplificationIteration +import OAI.Combinatorics.Progressions.Lattices.IntervalIntegerVectorAPFree +import OAI.Combinatorics.Progressions.Linear.AmplificationSourceRankBudget +import OAI.Combinatorics.Progressions.Linear.RelativeRankZeroSource +import OAI.Combinatorics.Progressions.Probability.DensityBoundFromInvariant +import OAI.Combinatorics.Progressions.Sampling.ScoredPatchDensityStep + +namespace OAI + +section + +open Filter +open scoped Topology + +namespace Erdos3 + +theorem eventually_exp_loglog_rpow_le {c η : ℝ} (hc : 0 < c) (hη : 0 < η) + (B : ℝ) : + ∀ᶠ x : ℝ in atTop, + Real.exp (-c * (Real.log (Real.log x)) ^ (1 + η)) ≤ + ((Real.log x) ^ B)⁻¹ := by + have hloglog : Tendsto (fun x : ℝ ↦ Real.log (Real.log x)) atTop atTop := + Real.tendsto_log_atTop.comp Real.tendsto_log_atTop + have hpow := (tendsto_rpow_atTop hη).comp hloglog + filter_upwards [hpow.eventually (eventually_ge_atTop (B / c)), + hloglog.eventually (eventually_gt_atTop 0), eventually_gt_atTop (1 : ℝ)] with + x hlarge hz hx + have hBc : B ≤ c * (Real.log (Real.log x)) ^ η := by + exact (div_le_iff₀ hc).mp hlarge |>.trans_eq (mul_comm _ _) + have hmul := mul_le_mul_of_nonneg_left hBc hz.le + have hpower : (Real.log (Real.log x)) ^ (1 + η) = + Real.log (Real.log x) * (Real.log (Real.log x)) ^ η := by + rw [Real.rpow_add hz, Real.rpow_one] + rw [Real.rpow_def_of_pos (Real.log_pos hx), ← Real.exp_neg] + apply Real.exp_le_exp.mpr + rw [hpower] + nlinarith + +theorem QuantitativeDensityBound.eventually_logarithmic {k : ℕ} + (h : QuantitativeDensityBound k) (B : ℝ) : + ∃ C : ℝ, 0 < C ∧ ∀ᶠ N : ℕ in atTop, + (extremalNumber k N : ℝ) ≤ C * N / (Real.log N) ^ B := by + obtain ⟨C, c, η, hC, hc, hη, hbound⟩ := h + refine ⟨C, hC, ?_⟩ + have htail := tendsto_natCast_atTop_atTop.eventually + (eventually_exp_loglog_rpow_le hc hη B) + filter_upwards [htail, eventually_ge_atTop 3] with N hN hN3 + apply (hbound N hN3).trans + simpa only [div_eq_mul_inv] using + mul_le_mul_of_nonneg_left hN (show 0 ≤ C * (N : ℝ) by positivity) + +theorem QuantitativeDensityBound.logarithmic {k : ℕ} + (h : QuantitativeDensityBound k) {B : ℝ} (hB : 0 < B) : + ∃ C : ℝ, 0 < C ∧ ∀ N : ℕ, 3 ≤ N → + (extremalNumber k N : ℝ) ≤ C * N / (Real.log N) ^ B := by + obtain ⟨C, hC, htail⟩ := h.eventually_logarithmic B + obtain ⟨N₀, htail⟩ := eventually_atTop.mp htail + let M := max 3 N₀ + let C' := max C ((Real.log M) ^ B) + have hCC' : C ≤ C' := le_max_left _ _ + refine ⟨C', hC.trans_le hCC', fun N hN ↦ ?_⟩ + have hNreal : (1 : ℝ) < N := by exact_mod_cast (show 1 < N by omega) + have hlogN : 0 < Real.log N := Real.log_pos hNreal + have hden : 0 < (Real.log N) ^ B := Real.rpow_pos_of_pos hlogN B + by_cases hlarge : N₀ ≤ N + · apply (htail N hlarge).trans + apply div_le_div_of_nonneg_right _ hden.le + exact mul_le_mul_of_nonneg_right hCC' (by positivity) + · have hNM : N ≤ M := by dsimp [M]; omega + have hlogNM : Real.log N ≤ Real.log M := + Real.log_le_log (by positivity) (by exact_mod_cast hNM) + have hpNM := Real.rpow_le_rpow hlogN.le hlogNM hB.le + have hpow : (Real.log N) ^ B ≤ C' := hpNM.trans (le_max_right _ _) + have hcard : (extremalNumber k N : ℝ) ≤ N := + by exact_mod_cast extremalNumber_le k N + apply hcard.trans + apply (le_div_iff₀ hden).mpr + nlinarith [mul_le_mul_of_nonneg_left hpow (show (0 : ℝ) ≤ N by positivity)] + +theorem summable_dyadic_of_eventually_logarithmic {k : ℕ} {C B : ℝ} + (hB : 1 < B) + (hbound : ∀ᶠ N : ℕ in atTop, + (extremalNumber k N : ℝ) ≤ C * N / (Real.log N) ^ B) : + Summable (fun m : ℕ ↦ (extremalNumber k (2 ^ m) : ℝ) / 2 ^ m) := by + have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) + have hsum : Summable (fun m : ℕ ↦ (C / (Real.log 2) ^ B) * ((m : ℝ) ^ B)⁻¹) := + (Real.summable_nat_rpow_inv.mpr hB).mul_left _ + apply hsum.of_norm_bounded_eventually_nat + have hpow : Tendsto (fun m : ℕ ↦ (2 : ℕ) ^ m) atTop atTop := + tendsto_pow_atTop_atTop_of_one_lt (by norm_num) + filter_upwards [hpow.eventually hbound] with m hm + rw [Real.norm_eq_abs, abs_of_nonneg (by positivity)] + have hden : (0 : ℝ) < 2 ^ m := by positivity + have hcast : ((2 ^ m : ℕ) : ℝ) = (2 : ℝ) ^ m := by norm_cast + rw [hcast, Real.log_pow, Real.mul_rpow (by positivity) hlog2.le] at hm + calc + (extremalNumber k (2 ^ m) : ℝ) / 2 ^ m + ≤ (C * 2 ^ m / ((m : ℝ) ^ B * (Real.log 2) ^ B)) / 2 ^ m := + div_le_div_of_nonneg_right hm hden.le + _ = (C / (Real.log 2) ^ B) * ((m : ℝ) ^ B)⁻¹ := by + field_simp + +theorem QuantitativeDensityBound.summable_dyadic {k : ℕ} + (h : QuantitativeDensityBound k) : + Summable (fun m : ℕ ↦ (extremalNumber k (2 ^ m) : ℝ) / 2 ^ m) := by + obtain ⟨C, _hC, htail⟩ := h.eventually_logarithmic 2 + exact summable_dyadic_of_eventually_logarithmic (by norm_num) htail + +theorem hasAP_of_eventually_logarithmic_bound {k : ℕ} {C δ : ℝ} (hδ : 0 < δ) + (hbound : ∀ᶠ N : ℕ in atTop, + (extremalNumber k N : ℝ) ≤ C * N / (Real.log N) ^ (1 + δ)) + {A : Set ℕ} (hA : ¬ Summable (reciprocalTerm A)) : HasAP A k := + hasAP_of_not_summable_reciprocal + (summable_dyadic_of_eventually_logarithmic (by linarith) hbound) hA + +theorem QuantitativeDensityBound.hasAP {k : ℕ} (h : QuantitativeDensityBound k) + {A : Set ℕ} (hA : ¬ Summable (reciprocalTerm A)) : HasAP A k := + hasAP_of_not_summable_reciprocal h.summable_dyadic hA + +theorem reciprocalProgressionTheorem_of_quantitativeDensityTheorem + (h : QuantitativeDensityTheorem) : ReciprocalProgressionTheorem := by + intro A hA k + by_cases hk : 3 ≤ k + · exact (h k hk).hasAP hA + · exact ((h 3 le_rfl).hasAP hA).of_le (by omega) + +end Erdos3 + +end + +section + +namespace Erdos3 +open Filter + +theorem eventually_quarter_resource_paid {β A D : ℝ} + (hβ : (1 / 4 : ℝ) < β) (hA : 0 < A) (hD : 0 ≤ D) : + ∀ᶠ p : ℝ in atTop, D * p ^ (1 / 4 : ℝ) * Real.log (2 + p) ≤ A * p ^ β := by + rcases eq_or_lt_of_le hD with hD | hD + · have hD0 : D = 0 := hD.symm + filter_upwards [eventually_ge_atTop (0 : ℝ)] with p hp + rw [hD0, zero_mul, zero_mul] + exact mul_nonneg hA.le (Real.rpow_nonneg hp β) + · exact eventually_rpow_log_le hβ hA hD + +theorem source_scaled_exponential_room {U N L C factor : ℝ} + (hU : 0 < U) (hN : 1 < N) (hfactor : 0 < factor) + (hlogU : Real.log U ≤ L) (hroom : L + C ≤ Real.log (Real.log N)) + (hreserve : Real.log factor ≤ C) : + factor * U ≤ Real.log N ∧ Real.exp (factor * U) ≤ N := by + have hlogN : 0 < Real.log N := Real.log_pos hN + have hbound : factor * U ≤ Real.log N := by + apply (Real.log_le_log_iff (mul_pos hfactor hU) hlogN).mp + rw [Real.log_mul hfactor.ne' hU.ne'] + linarith + exact ⟨hbound, (Real.exp_le_exp.mpr hbound).trans_eq (Real.exp_log (by linarith))⟩ + +theorem source_exponential_room {U N L C : ℝ} + (hU : 0 < U) (hN : 1 < N) (hlogU : Real.log U ≤ L) + (hroom : L + C ≤ Real.log (Real.log N)) (hreserve : 0 ≤ C) : + U ≤ Real.log N ∧ Real.exp U ≤ N := by + simpa only [one_mul] using source_scaled_exponential_room hU hN zero_lt_one + hlogU hroom (by simpa only [Real.log_one] using hreserve) + +theorem source_half_log_room {U N L C : ℝ} + (hU : 0 < U) (hN : 1 < N) (hlogU : Real.log U ≤ L) + (hroom : L + C ≤ Real.log (Real.log N)) (hreserve : Real.log 2 ≤ C) : + 2 * U ≤ Real.log N ∧ Real.exp U ≤ N ∧ Real.log N / 2 ≤ Real.log N - U := by + obtain ⟨hbound, _hexp⟩ := source_scaled_exponential_room hU hN (by norm_num : (0 : ℝ) < 2) + hlogU hroom hreserve + refine ⟨hbound, ?_, by linarith⟩ + exact (Real.exp_le_exp.mpr (show U ≤ Real.log N by linarith)).trans_eq + (Real.exp_log (by linarith)) + +theorem eventually_source_exponential_room {β A D : ℝ} + (hβ : (1 / 4 : ℝ) < β) (hA : 0 < A) (hD : 0 ≤ D) : + ∀ᶠ p : ℝ in atTop, ∀ U N C : ℝ, + 0 < U → 1 < N → Real.log 2 ≤ C → + Real.log U ≤ D * p ^ (1 / 4 : ℝ) * Real.log (2 + p) → + A * p ^ β + C ≤ Real.log (Real.log N) → + 2 * U ≤ Real.log N ∧ Real.exp U ≤ N ∧ Real.log N / 2 ≤ Real.log N - U := by + filter_upwards [eventually_quarter_resource_paid hβ hA hD] with p hpaid + intro U N C hU hN hreserve hlogU hinvariant + exact source_half_log_room hU hN (hlogU.trans hpaid) hinvariant hreserve + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Filter +open scoped BigOperators + +theorem subquadratic_patch_descent (s : ℕ) {κ H₀ K q A₀ B D : ℝ} + (hκ : 0 < κ) (hH : 1 < κ * H₀) (hK : 2 ≤ K) (hq : 1 ≤ q) (hq2 : q < 2) + (hA : 0 < A₀) (hB : 0 < B) (hD : 0 < D) : + let μ := levelCoefficient K * Real.log q + let ν := gainExponent K + let β := 1 - (ν - μ) / 2 + ∃ c p₀ Cmin : ℝ, 0 < c ∧ 0 ≤ Cmin ∧ + ∀ C₀ : ℝ, Cmin ≤ C₀ → ∀ p : ℝ, p₀ ≤ p → ∀ (d N M a₀ q₀ : ℕ) (U : ℝ) + (A : PolynomialPatch Unit s d) (f : ℕ → ℝ), + 1 < N → 0 < q₀ → (∀ n < M, a₀ + q₀ * n < N) → + (∀ n < N, f n ∈ Set.Icc (0 : ℝ) 1) → 1 ≤ U → + Real.log N - U ≤ Real.log M → (A.kernel.lip : ℝ) + 1 ≤ Real.exp U → + Real.log ((d : ℝ) + 1) ≤ B * p ^ μ * Real.log (2 + p) → + Real.log U ≤ D * p ^ (1 / 4 : ℝ) * Real.log (2 + p) → + A₀ * p ^ β + C₀ ≤ Real.log (Real.log N) → + let α := 𝔼 n : Fin N, f n.val + let G := κ * amplificationGain κ H₀ ⌊levelCoefficient K * Real.log p⌋₊ / 2 + 0 < α → densityParameter α = p → + Real.exp (-U) ≤ (𝔼 n : Fin M, + (f (a₀ + q₀ * n.val) - G * α) * A.value (fun _ => (n.val : ℝ))) → + ∃ q' a len : ℕ, 0 < q' ∧ 1 < len ∧ (∀ n < len, a + q' * n < N) ∧ + 0 < (𝔼 n : Fin len, f (a + q' * n.val)) ∧ + let p' := densityParameter (𝔼 n : Fin len, f (a + q' * n.val)) + p' ≤ p - c * p ^ ν ∧ p' + 1 ≤ p ∧ + A₀ * p' ^ β + C₀ ≤ Real.log (Real.log len) := by + intro μ ν β + obtain ⟨C, P, hC, hP, hstep⟩ := scored_patch_density_step s + obtain ⟨c, hc, hdrop⟩ := exists_selected_density_drop hκ hH hK + let Cmin := max 0 (Real.log (4 * (P : ℝ) * (Real.log (2 * C) + 3))) + have hCmin : 0 ≤ Cmin := le_max_left _ _ + have hbase : Real.log (4 * (P : ℝ) * (Real.log (2 * C) + 3)) ≤ Cmin := le_max_right _ _ + have hP1 : (1 : ℝ) ≤ P := by exact_mod_cast hP + have hL : 0 ≤ Real.log (4 * (P : ℝ)) := Real.log_nonneg (by linarith) + have hbudgets := subquadratic_patch_iteration_budgets hK hq hq2 hA hc hB hD hL (2 * s * s) + have hν : 0 < ν := (gainExponent_pos_le_quarter hK).1 + have hlarge := (tendsto_rpow_atTop hν).eventually_ge_atTop (1 / c) + have hall : ∀ᶠ p : ℝ in atTop, 1 ≤ p ∧ + ((2 * s * s + 1 : ℕ) * B * p ^ μ * Real.log (2 + p) + + D * p ^ (1 / 4 : ℝ) * Real.log (2 + p) ≤ A₀ * p ^ β) ∧ + (Real.log (4 * (P : ℝ)) + (2 * s * s : ℕ) * B * p ^ μ * Real.log (2 + p) ≤ + A₀ * (β * c * p ^ (β + ν - 1))) ∧ + (c * p ^ ν ≤ Real.log (κ * amplificationGain κ H₀ ⌊levelCoefficient K * Real.log p⌋₊ / 2)) ∧ + 2 ≤ p - c * p ^ ν ∧ 1 ≤ c * p ^ ν := by + filter_upwards [hbudgets, hdrop, hlarge, eventually_ge_atTop (1 : ℝ)] with p hbud hd hu hp + refine ⟨hp, hbud.1, hbud.2, hd.1, hd.2, ?_⟩ + have h := (div_le_iff₀ hc).mp hu + simpa only [mul_comm] using h + obtain ⟨p₀, hp₀⟩ := eventually_atTop.mp hall + refine ⟨c, p₀, Cmin, hc, hCmin, ?_⟩ + intro C₀ hreserve p hp d N M a₀ q₀ U A f hN hq₀ hslice hf hU hM hLip hRank hResource hinvariant α G hα hpα hscore + obtain ⟨hp1, hfit, hpaid, hgain, hroom, hunit⟩ := hp₀ p hp + have hp0 : 0 < p := by linarith + let R := B * p ^ μ * Real.log (2 + p) + let V := D * p ^ (1 / 4 : ℝ) * Real.log (2 + p) + have hsize : Real.log (4 * (P : ℝ) * (Real.log (2 * C) + 3)) + + (2 * s * s + 1 : ℕ) * R + V ≤ Real.log (Real.log N) := by + have hfit' : (2 * s * s + 1 : ℕ) * R + V ≤ A₀ * p ^ β := by + simpa only [R, V, mul_assoc] using hfit + linarith + have hH0 : 0 < H₀ := by nlinarith + have hG : 0 < G := div_pos (mul_pos hκ (amplificationGain_pos hκ hH0 _)) (by norm_num) + have hpmean : densityParameter (𝔼 n : Fin N, f n.val) = p := hpα + obtain ⟨q', a, len, hq', hlen, hin, hloss, hdense, hparam⟩ := + hstep d N M a₀ q₀ U R V G (c * p ^ ν) A f hN hq₀ hslice hf hU hM hLip + hRank hResource hsize hα hG hgain (by simpa only [hpmean] using hroom) hscore + rw [hpmean] at hparam + refine ⟨q', a, len, hq', hlen, hin, (mul_pos hG hα).trans hdense, hparam, by linarith, ?_⟩ + obtain ⟨_, _, _, _, hβ, hβ1, _⟩ := subquadratic_rank_exponents hK hq hq2 + apply density_invariant_with_general_loss hp0 + ((by norm_num : (0 : ℝ) ≤ 2).trans (densityParameter_ge_two _)) + (by linarith) hβ1.le hA.le hinvariant hparam hloss + simpa only [R, mul_assoc] using hpaid + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def SubquadraticPatchSource (k s : ℕ) (κ H₀ K q A₀ B D pmin Csrc : ℝ) : Prop := + let μ := levelCoefficient K * Real.log q + let β := 1 - (gainExponent K - μ) / 2 + ∀ S : APFreeInterval k, pmin ≤ S.parameter → + A₀ * S.parameter ^ β + Csrc ≤ Real.log (Real.log S.length) → + ∃ (d M a q₀ : ℕ) (U : ℝ) (A : PolynomialPatch Unit s d), + 0 < q₀ ∧ (∀ n < M, a + q₀ * n < S.length) ∧ 1 ≤ U ∧ + Real.log S.length - U ≤ Real.log M ∧ (A.kernel.lip : ℝ) + 1 ≤ Real.exp U ∧ + Real.log ((d : ℝ) + 1) ≤ B * S.parameter ^ μ * Real.log (2 + S.parameter) ∧ + Real.log U ≤ D * S.parameter ^ (1 / 4 : ℝ) * Real.log (2 + S.parameter) ∧ + let G := κ * amplificationGain κ H₀ ⌊levelCoefficient K * Real.log S.parameter⌋₊ / 2 + Real.exp (-U) ≤ (𝔼 n : Fin M, + (intervalIndicator S.points (a + q₀ * n.val) - G * S.density) * + A.value (fun _ => (n.val : ℝ))) + +theorem quantitative_density_of_patch_source {k s : ℕ} (hk : 0 < k) + {κ H₀ K q A₀ B D pmin Csrc : ℝ} + (hκ : 0 < κ) (hH : 1 < κ * H₀) (hK : 2 ≤ K) (hq : 1 ≤ q) (hq2 : q < 2) + (hA : 0 < A₀) (hB : 0 < B) (hD : 0 < D) + (hsource : SubquadraticPatchSource k s κ H₀ K q A₀ B D pmin Csrc) : + QuantitativeDensityBound k := by + let μ := levelCoefficient K * Real.log q + let ν := gainExponent K + let β := 1 - (ν - μ) / 2 + obtain ⟨c, p₀, Cdesc, _, _, hdesc⟩ := subquadratic_patch_descent s hκ hH hK hq hq2 hA hB hD + let T := max pmin p₀ + obtain ⟨C₀, hC₀, _, hclosed⟩ := no_interval_invariant_of_descent k T (max Csrc Cdesc) + have hCsrc : Csrc ≤ C₀ := (le_max_left _ _).trans hC₀ + have hCdesc : Cdesc ≤ C₀ := (le_max_right _ _).trans hC₀ + obtain ⟨_, _, _, _, hβ, hβ1, _⟩ := subquadratic_rank_exponents hK hq hq2 + apply quantitative_density_of_no_invariant hk hA (by dsimp [β, ν, μ]; linarith : 0 < β) hβ1 + apply hclosed A₀ β hA.le + intro S hinvariant hlarge + have hpmin : pmin ≤ S.parameter := (le_max_left _ _).trans hlarge.le + have hp₀ : p₀ ≤ S.parameter := (le_max_right _ _).trans hlarge.le + have hsourceSize : A₀ * S.parameter ^ β + Csrc ≤ Real.log (Real.log S.length) := by linarith + obtain ⟨d, M, a, q₀, U, A, hq₀, hslice, hU, hM, hLip, hRank, hResource, hscore⟩ := + hsource S hpmin hsourceSize + have hmean : (𝔼 n : Fin S.length, intervalIndicator S.points n.val) = S.density := + mean_intervalIndicator S.subset + have hpositive : 0 < (𝔼 n : Fin S.length, intervalIndicator S.points n.val) := by + rw [hmean] + exact S.density_pos + have hpmean : densityParameter (𝔼 n : Fin S.length, intervalIndicator S.points n.val) = S.parameter := + congrArg densityParameter hmean + have hscore' : Real.exp (-U) ≤ (𝔼 n : Fin M, + (intervalIndicator S.points (a + q₀ * n.val) - + (κ * amplificationGain κ H₀ ⌊levelCoefficient K * Real.log S.parameter⌋₊ / 2) * + (𝔼 j : Fin S.length, intervalIndicator S.points j.val)) * A.value (fun _ => (n.val : ℝ))) := by + simpa only [hmean] using hscore + obtain ⟨q', a', len, hq', hlen, _, hnewpos, _, hunit, hnewinv⟩ := + hdesc C₀ hCdesc S.parameter hp₀ d S.length M a q₀ U A (intervalIndicator S.points) + S.length_gt_one hq₀ hslice (fun n _ => intervalIndicator_mem_Icc S.points n) + hU hM hLip hRank hResource hinvariant hpositive hpmean hscore' + have hnewmean := mean_progression_indicator S.points a' q' len + have hpos : 0 < intervalDensity len (progressionPreimage S.points a' q' len) := by + rw [← hnewmean] + exact hnewpos + let S' := S.reindex a' q' len hq' hlen hpos + refine ⟨S', ?_, ?_⟩ + · change A₀ * densityParameter (intervalDensity len (progressionPreimage S.points a' q' len)) ^ β + C₀ ≤ + Real.log (Real.log len) + rw [← hnewmean] + exact hnewinv + · change densityParameter (intervalDensity len (progressionPreimage S.points a' q' len)) + 1 ≤ S.parameter + rw [← hnewmean] + exact hunit + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem relativePatchSliceScore_interval {k s d q : ℕ} (S : APFreeInterval k) + (slice : ResidueBoxSlice (fun _ : Unit => S.length) q) + (A : PolynomialPatch Unit s d) (target : ℝ) : + relativePatchSliceScore slice S.integerIndicator target A = + 𝔼 n : Fin (slice.length ()), + (intervalIndicator S.points (slice.start () + q * n.val) - target) * + A.value (fun _ => (n.val : ℝ)) := by + unfold relativePatchSliceScore + let : DecidableEq Unit := Classical.decEq _ + apply Fintype.expect_equiv (Equiv.piUnique (fun i => Fin (slice.length i))) + intro u + simp only [APFreeInterval.integerIndicator, ResidueBoxSlice.point, Int.toNat_natCast] + congr 2 + +theorem APFreeInterval.patch_of_relative_absolute {s n₀ E d₀ : ℕ} {τ p Λ : ℝ} + (S : APFreeInterval (s + 2)) + (hrelative : RelativePatchPowerInductionRule s n₀ s τ E) + (hp : 2 ≤ p) (ha : Real.exp (-p) ≤ S.density / 2) + (haΛ : S.density / 2 ≤ Λ) (hΛ : Λ ≤ 1) + (habsolute : RelativePatchAbsoluteRule s n₀ p (S.density / 2) Λ d₀) + (hN : Real.exp ((p + 2) ^ E) ≤ (S.length : ℝ)) : + ∃ (d M a q : ℕ) (A : PolynomialPatch Unit s d), + 0 < q ∧ (∀ n < M, a + q * n < S.length) ∧ 0 < M ∧ d ≤ d₀ ∧ + Real.log S.length - (p + 2) ^ E ≤ Real.log M ∧ + (A.kernel.lip : ℝ) + 1 ≤ Real.exp ((p + 2) ^ E) ∧ + Real.exp (-((p + 2) ^ E)) ≤ + 𝔼 n : Fin M, + (intervalIndicator S.points (a + q * n.val) - (1 - τ) ^ (s + 1) * Λ) * + A.value (fun _ => (n.val : ℝ)) := by + have hmean : 2 * (S.density / 2) ≤ + 𝔼 x ∈ integerBox (fun _ : Unit => S.length), S.integerIndicator x := by + rw [S.integerIndicator_mean] + linarith + obtain ⟨q, hq, slice, d, A, hlength, hd, hcomplexity, hscore⟩ := + hrelative.of_mean_increment hp ha haΛ hΛ habsolute Unit + (by simpa using (by linarith : (1 : ℝ) ≤ p)) (fun _ => S.length) (fun _ => hN) + S.integerIndicator (fun x _ => S.integerIndicator_mem_Icc x) + (S.integerIndicator_apFree (by omega)) hmean + obtain ⟨hM, hlog⟩ := log_length_lower_of_exp_slice (N := S.length) (M := slice.length ()) + (by have := S.length_gt_one; omega) + (hlength ()) + refine ⟨d, slice.length (), slice.start (), q, A, hq, slice.inside (), hM, hd, hlog, + relativePatchComplexity_kernel_bound A hcomplexity, ?_⟩ + rwa [relativePatchSliceScore_interval] at hscore + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators Classical +open Filter + +theorem subquadratic_patch_source_of_relative_family + {s n₀ C E : ℕ} {τ H₀ : ℝ} + (hC : 1 ≤ C) (hE : 2 ≤ E) + (hrelative : RelativePatchPowerInductionRule s n₀ s τ E) + (hκ : 0 < (1 - τ) ^ (s + 1)) (hκ1 : (1 - τ) ^ (s + 1) < 1) + (hH : 1 < H₀) (hκH : 1 ≤ ((1 - τ) ^ (s + 1)) ^ 2 * H₀) + (hfamily : ∀ p : ℝ, 2 ≤ p → (n₀ : ℝ) ≤ p → ∀ j : ℕ, + LowDensityRelativeAbsoluteRule s n₀ p + (amplificationGain ((1 - τ) ^ (s + 1)) H₀ j) + ((s + 1) ^ j * ⌊(p + 2) ^ C⌋₊) + (amplificationResource p (C + 1) (E + 1) j)) : + ∃ pmin : ℝ, SubquadraticPatchSource (s + 2) s + ((1 - τ) ^ (s + 1)) H₀ (E + 1) 1 1 + (amplificationSourceRankLogConstant (s + 1) C (E + 1)) + (amplificationSourceLogCoefficient (C + 1) E) pmin (Real.log 2) := by + let κ := (1 - τ) ^ (s + 1) + let K : ℝ := E + 1 + let B := amplificationSourceRankLogConstant (s + 1) C K + let D := amplificationSourceLogCoefficient (C + 1) E + have hK : 2 ≤ K := by dsimp [K]; exact_mod_cast (show 2 ≤ E + 1 by omega) + have hD : 0 < D := amplificationSourceLogCoefficient_pos _ (by omega) + have hβ : (1 / 4 : ℝ) < potentialExponent K := (potentialExponent_bounds hK).1 + have hlow := eventually_low_density_at_selected_level hκ hκ1.le hH.le hK + have hroom := eventually_source_exponential_room hβ (by norm_num : (0 : ℝ) < 1) hD.le + have hev : ∀ᶠ p : ℝ in atTop, + LowDensityThreshold (amplificationGain κ H₀ ⌊levelCoefficient K * Real.log p⌋₊) + (Real.exp (-p)) ∧ 3 ≤ p ∧ (n₀ : ℝ) ≤ p ∧ + ∀ U N Csrc : ℝ, 0 < U → 1 < N → Real.log 2 ≤ Csrc → + Real.log U ≤ D * p ^ (1 / 4 : ℝ) * Real.log (2 + p) → + 1 * p ^ potentialExponent K + Csrc ≤ Real.log (Real.log N) → + 2 * U ≤ Real.log N ∧ Real.exp U ≤ N ∧ Real.log N / 2 ≤ Real.log N - U := by + filter_upwards [hlow, hroom, eventually_ge_atTop (3 : ℝ), + eventually_ge_atTop (n₀ : ℝ)] with p hl hr hp hn + exact ⟨hl, hp, hn, hr⟩ + obtain ⟨pmin, hpmin⟩ := eventually_atTop.mp hev + refine ⟨pmin, ?_⟩ + intro S hlarge hinvariant + let p := S.parameter + let j := ⌊levelCoefficient K * Real.log p⌋₊ + let Pj := amplificationResource p (C + 1) (E + 1) j + let U := (2 + Pj) ^ E + obtain ⟨hl, hp3, hn, hr⟩ := hpmin p hlarge + have hp : 2 ≤ p := by linarith + have hparam : p ≤ Pj := amplificationResource_parameter_le hp (by omega) (by omega) j + have hP : 2 ≤ Pj := hp.trans hparam + have hα : Real.exp (-p) = S.density / 2 := + S.exp_neg_parameter_eq_half (by dsimp only [p] at hp3; linarith) + have hU : 1 ≤ U ∧ Pj ≤ U ∧ 0 < U ∧ + Real.log U ≤ D * p ^ (1 / 4 : ℝ) * Real.log (2 + p) := + by + simpa only [Nat.cast_add, Nat.cast_one, U, Pj, j, K, D] using + amplificationSource_final_cost_spec (D := C + 1) (K := E + 1) (E := E) + hp (by omega) (by omega) (by omega) + have hinvariant' : 1 * p ^ potentialExponent K + Real.log 2 ≤ + Real.log (Real.log (S.length : ℝ)) := by + simpa only [Real.log_one, mul_zero, sub_zero, potentialExponent] using hinvariant + have hN : Real.exp U ≤ (S.length : ℝ) := + (hr U S.length (Real.log 2) hU.2.2.1 + (by exact_mod_cast S.length_gt_one) le_rfl hU.2.2.2 hinvariant').2.1 + have hgain := (amplificationGain_low_density_parameters hκ hκ1 hH hκH j).1 + have habsolute := hfamily p hp hn j (Real.exp (-p)) le_rfl hl + rw [hα] at habsolute + have hraw : amplificationGain κ H₀ j * (S.density / 2) ≤ 1 := by + simpa only [hα] using (hl.raw_target_lt_one hgain).le + have haΛ : S.density / 2 ≤ amplificationGain κ H₀ j * (S.density / 2) := by + nlinarith [S.density_pos] + obtain ⟨d, M, a, q, A, hq, hinside, _hM, hd, hlength, hLip, hscore⟩ := + S.patch_of_relative_absolute hrelative hP + ((Real.exp_le_exp.mpr (neg_le_neg hparam)).trans_eq hα) + haΛ hraw habsolute (by simpa only [add_comm Pj 2] using hN) + refine ⟨d, M, a, q, U, A, hq, hinside, hU.1, ?_, ?_, ?_, hU.2.2.2, ?_⟩ + · simpa only [U, add_comm Pj 2] using hlength + · simpa only [U, add_comm Pj 2] using hLip + · apply log_linear_amplification_rank_source (by omega : 1 ≤ s + 1) + (by linarith : 1 < K) hp + simpa only [j, add_comm p 2] using hd + · have htarget : κ * amplificationGain κ H₀ j * (S.density / 2) = + (κ * amplificationGain κ H₀ j / 2) * S.density := by ring + have hscore' : Real.exp (-U) ≤ 𝔼 n : Fin M, + (intervalIndicator S.points (a + q * n.val) - + κ * amplificationGain κ H₀ j * (S.density / 2)) * + A.value (fun _ => (n.val : ℝ)) := by + simpa only [U, add_comm Pj 2, mul_assoc] using hscore + rw [htarget] at hscore' + exact hscore' + +theorem exists_subquadratic_patch_source_of_uniform_relative_lifting + (s n₀ : ℕ) [NeZero n₀] (hs : 1 ≤ s) + (hlifting : ∀ τ : ℝ, 0 < τ → τ ≤ 1 / 2 → + ∃ E : ℕ, 2 ≤ E ∧ RelativePatchPowerInductionRule s n₀ s τ E) : + ∃ κ H₀ K B D pmin : ℝ, + 0 < κ ∧ 1 < κ * H₀ ∧ 2 ≤ K ∧ 0 < B ∧ 0 < D ∧ + SubquadraticPatchSource (s + 2) s κ H₀ K 1 1 B D pmin (Real.log 2) := by + obtain ⟨C, hC, xi, hxi, hinitial⟩ := + exists_initial_relative_absolute_rule n₀ (s + 2) (by omega) + have hH : 1 < 1 + xi := by linarith + obtain ⟨τ, hτ, hτhalf, hκ, hκ1, hκgain, hκH⟩ := + exists_relative_amplification_discount s hH + obtain ⟨E, hE, hrelative⟩ := hlifting τ hτ hτhalf + have hfamily : ∀ p : ℝ, 2 ≤ p → (n₀ : ℝ) ≤ p → ∀ j : ℕ, + LowDensityRelativeAbsoluteRule s n₀ p + (amplificationGain ((1 - τ) ^ (s + 1)) (1 + xi) j) + ((s + 1) ^ j * ⌊(p + 2) ^ C⌋₊) + (amplificationResource p (C + 1) (E + 1) j) := by + intro p hp hn j + apply LowDensityRelativeAbsoluteRule.iterate hrelative hp (by omega) + (hn.trans (amplificationResource_parameter_le_zero (K := E + 1) hp (by omega))) + hκ hκ1 hH hκH _ j + intro a ha _ + simpa only [Nat.add_sub_cancel, add_comm (2 : ℝ) p] using hinitial hp ha + obtain ⟨pmin, hsource⟩ := subquadratic_patch_source_of_relative_family + (by omega : 1 ≤ C) hE hrelative hκ hκ1 hH hκH hfamily + refine ⟨(1 - τ) ^ (s + 1), 1 + xi, (E + 1 : ℕ), + amplificationSourceRankLogConstant (s + 1) C (E + 1), + amplificationSourceLogCoefficient (C + 1) E, pmin, hκ, hκgain, + ?_, ?_, amplificationSourceLogCoefficient_pos _ (by omega), ?_⟩ + · exact_mod_cast (show 2 ≤ E + 1 by omega) + · exact amplificationSourceRankLogConstant_pos (by omega) (by exact_mod_cast (show 1 < E + 1 by omega)) + · simpa only [Nat.cast_add, Nat.cast_one] using hsource + +theorem quantitative_density_bound_of_uniform_relative_lifting + (k n₀ : ℕ) [NeZero n₀] (hk : 3 ≤ k) + (hlifting : ∀ τ : ℝ, 0 < τ → τ ≤ 1 / 2 → + ∃ E : ℕ, 2 ≤ E ∧ RelativePatchPowerInductionRule (k - 2) n₀ (k - 2) τ E) : + QuantitativeDensityBound k := by + obtain ⟨κ, H₀, K, B, D, pmin, hκ, hgain, hK, hB, hD, hsource⟩ := + exists_subquadratic_patch_source_of_uniform_relative_lifting (k - 2) n₀ (by omega) hlifting + have hresult := quantitative_density_of_patch_source (by omega : 0 < (k - 2) + 2) + hκ hgain hK (by norm_num : (1 : ℝ) ≤ 1) (by norm_num : (1 : ℝ) < 2) + (by norm_num : (0 : ℝ) < 1) hB hD hsource + simpa only [Nat.sub_add_cancel (by omega : 2 ≤ k)] using hresult + +theorem manuscript_targets_of_uniform_relative_lifting + (hlifting : ∀ k : ℕ, 3 ≤ k → ∃ n₀ : ℕ, 0 < n₀ ∧ + ∀ τ : ℝ, 0 < τ → τ ≤ 1 / 2 → + ∃ E : ℕ, 2 ≤ E ∧ RelativePatchPowerInductionRule (k - 2) n₀ (k - 2) τ E) : + QuantitativeDensityTheorem ∧ ReciprocalProgressionTheorem := by + have hquant : QuantitativeDensityTheorem := by + intro k hk + obtain ⟨n₀, hn₀, hrelative⟩ := hlifting k hk + let : NeZero n₀ := ⟨Nat.ne_of_gt hn₀⟩ + exact quantitative_density_bound_of_uniform_relative_lifting k n₀ hk hrelative + exact ⟨hquant, reciprocalProgressionTheorem_of_quantitativeDensityTheorem hquant⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformRestrictedMean.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformRestrictedMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..a346da83278cc6efa038b4eea9424543ac2a0458 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformRestrictedMean.lean @@ -0,0 +1,32 @@ +import OAI.Combinatorics.Progressions.Probability.IntervalDivisorProbability + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem uniformFinset_restricted_mean {Ω : Type*} (S : Finset Ω) (hS : S.Nonempty) + (P : Ω → Prop) [DecidablePred P] (f : Ω → ℝ) : + (FiniteProbabilityWeights.uniformFinset S hS).mean (fun z => if P z.val then f z.val else 0) = + ((S.filter P).card : ℝ) / S.card * (𝔼 z : S.filter P, f z.val) := by + classical + rw [FiniteProbabilityWeights.uniformFinset_mean S hS (fun z => if P z then f z else 0)] + rw [Finset.expect_eq_sum_div_card] + calc + (∑ z ∈ S, if P z then f z else 0) / (S.card : ℝ) = + (∑ z : S.filter P, f z.val) / (S.card : ℝ) := by + rw [Finset.sum_coe_sort, Finset.sum_filter] + _ = ((S.filter P).card : ℝ) / S.card * (𝔼 z : S.filter P, f z.val) := by + have h := Fintype.card_mul_expect (fun z : S.filter P => f z.val) + rw [Fintype.card_coe] at h + rw [← h] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformScaledRetainedLogBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformScaledRetainedLogBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..343930c3ad15d26f93b4943acc89bf1cf18764e7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformScaledRetainedLogBounds.lean @@ -0,0 +1,218 @@ +import OAI.Combinatorics.Progressions.Fourier.UniformSpectrumLogBounds + +namespace OAI + +section + +namespace Erdos3 + +def uniformRetainedBiasLog {A : Type*} [Semiring A] + (n j t : ℕ) (p v w E : A) : A := + uniformBlockAccuracyLog n j t p v w + E + +def uniformSpectrumCardLog {A : Type*} [Semiring A] + (n j t : ℕ) (p v w E : A) : A := + uniformSpectrumSizeLog n j t p v w + + (max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t) : ℕ) * E + +def uniformRetainedFrequencyLog {A : Type*} [Semiring A] + (n j t : ℕ) (p v w E : A) : A := + 1 + majorArcCoverLog n j p v + (majorArcCoverExponent n j : ℕ) * + uniformRetainedBiasLog n j t p v w E + +def uniformRetainedDenominatorLog {A : Type*} [Semiring A] + (n j t : ℕ) (p v w E : A) : A := + j * (3 + majorArcCoverLog n j p v) + (majorArcCoverExponent n j * j : ℕ) * + uniformRetainedBiasLog n j t p v w E + + (w + t * majorArcLengthLog n p + (majorArcLengthExponent n * t : ℕ) * + uniformRetainedBiasLog n j t p v w E) + 2 + +theorem uniformRetainedLogs_nonneg (n j t : ℕ) {p v w E : ℝ} + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) (hE : 0 ≤ E) : + 0 ≤ uniformRetainedBiasLog n j t p v w E ∧ + 0 ≤ uniformSpectrumCardLog n j t p v w E ∧ + 0 ≤ uniformRetainedFrequencyLog n j t p v w E ∧ + 0 ≤ uniformRetainedDenominatorLog n j t p v w E := by + obtain ⟨_, hA, hS⟩ := uniformSpectrumLogs_nonneg n j t hp hv hw + have hC := majorArcCoverLog_nonneg n j hp hv + have hL := (majorArcBaseLogs_nonneg n hp).2.2.1 + have hB : 0 ≤ uniformRetainedBiasLog n j t p v w E := by + unfold uniformRetainedBiasLog + positivity + refine ⟨hB, ?_, ?_, ?_⟩ + · unfold uniformSpectrumCardLog + positivity + · unfold uniformRetainedFrequencyLog + positivity + · unfold uniformRetainedDenominatorLog + positivity + +theorem uniformBlockRetainedBias_inverse_exp_bound (n j t : ℕ) {U V W ε p v w E : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) + (hεE : ε⁻¹ ≤ Real.exp E) : + (uniformBlockRetainedBias n j t U V W ε)⁻¹ ≤ + Real.exp (uniformRetainedBiasLog n j t p v w E) := by + have hA := uniformBlockSpectrumAccuracy_exp_bound n j t hU hV hp hv hw hUp hVv hWw + rw [uniformBlockRetainedBias_eq n j t hU hW hε1, inv_div, div_eq_mul_inv] + exact (mul_le_mul hA hεE (inv_nonneg.mpr hε.le) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + +theorem uniformSpectrumCardBound_exp_bound (n j t : ℕ) {U V W ε p v w E : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hε : 0 < ε) + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) (hE : 0 ≤ E) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) + (hεE : ε⁻¹ ≤ Real.exp E) : + uniformSpectrumSizeConstant n j t U V W / + ε ^ max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t) ≤ + Real.exp (uniformSpectrumCardLog n j t p v w E) := by + have hS := uniformSpectrumSizeConstant_exp_bound n j t hU hV hW hp hv hw hUp hVv hWw + have hpow := pow_le_exp_mul_of_le_exp (inv_nonneg.mpr hε.le) hεE hE + (max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t)) le_rfl + have hbound := (mul_le_mul hS hpow (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + simpa only [uniformSpectrumCardLog, div_eq_mul_inv, inv_pow] using hbound + +theorem uniformBlockSpectrumCardBudget_exp_bound (n j t : ℕ) {U V W ε p v w E : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) (hE : 0 ≤ E) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) + (hεE : ε⁻¹ ≤ Real.exp E) : + uniformBlockSpectrumCardBudget n j t U V W (uniformBlockRetainedBias n j t U V W ε) ≤ + Real.exp (uniformSpectrumCardLog n j t p v w E) := by + exact (uniformBlockSpectrumCardBudget_le_accuracy_power n j t hU hW hε hε1).trans + (uniformSpectrumCardBound_exp_bound n j t hU hV hW hε hp hv hw hE hUp hVv hWw hεE) + +theorem uniformRetainedFrequency_exp_bound (n j t : ℕ) {U V W ε p v w E : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) (hE : 0 ≤ E) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) + (hεE : ε⁻¹ ≤ Real.exp E) : + 2 * majorArcCoverConstant n j U V / + (uniformBlockRetainedBias n j t U V W ε) ^ majorArcCoverExponent n j ≤ + Real.exp (uniformRetainedFrequencyLog n j t p v w E) := by + have hζ : 0 ≤ uniformBlockRetainedBias n j t U V W ε := + (uniformBlockRetainedBias_spec n j t hU hW hε).1.le + have hB := uniformBlockRetainedBias_inverse_exp_bound n j t hU hV hW hε hε1 hp hv hw + hUp hVv hWw hεE + have hB0 := (uniformRetainedLogs_nonneg n j t hp hv hw hE).1 + have hC := majorArcCoverConstant_exp_bound n j (zero_le_one.trans hU) hp hv hUp hVv + have hC0 := zero_le_one.trans (majorArcCoverConstant_one_le n j hU hV) + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hbase := (mul_le_mul htwo hC hC0 (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + have hpow := pow_le_exp_mul_of_le_exp (inv_nonneg.mpr hζ) hB hB0 + (majorArcCoverExponent n j) le_rfl + have hbound := (mul_le_mul hbase hpow (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + simpa only [uniformRetainedFrequencyLog, div_eq_mul_inv, inv_pow] using hbound + +theorem uniformCharacterDenominatorBound_exp_bound (n j t : ℕ) {U V W ε p v w E : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) (hE : 0 ≤ E) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) + (hεE : ε⁻¹ ≤ Real.exp E) : + uniformCharacterDenominatorBound n j t U V W (uniformBlockRetainedBias n j t U V W ε) ≤ + Real.exp (uniformRetainedDenominatorLog n j t p v w E) := by + let ζ := uniformBlockRetainedBias n j t U V W ε + have hζ : 0 ≤ ζ := (uniformBlockRetainedBias_spec n j t hU hW hε).1.le + have hB := uniformBlockRetainedBias_inverse_exp_bound n j t hU hV hW hε hε1 hp hv hw + hUp hVv hWw hεE + have hB0 := (uniformRetainedLogs_nonneg n j t hp hv hw hE).1 + have hC := majorArcCoverConstant_exp_bound n j (zero_le_one.trans hU) hp hv hUp hVv + have hC0 := zero_le_one.trans (majorArcCoverConstant_one_le n j hU hV) + have hClog := majorArcCoverLog_nonneg n j hp hv + have hL := (majorArcConstants_exp_bounds n (zero_le_one.trans hU) hp hUp).2.2.1 + have hL0 := (majorArcLengthConstant_pos n hU).le + have hLlog := (majorArcBaseLogs_nonneg n hp).2.2.1 + have hthree : (3 : ℝ) ≤ Real.exp 3 := by linarith [Real.add_one_le_exp (3 : ℝ)] + have hbase := (mul_le_mul hthree hC hC0 (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + have hnum := pow_le_exp_mul_of_le_exp (by positivity) hbase (by positivity) j le_rfl + have hpowC := pow_le_exp_mul_of_le_exp (inv_nonneg.mpr hζ) hB hB0 + (majorArcCoverExponent n j * j) le_rfl + have hfirst := (mul_le_mul hnum hpowC (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + have hLt := pow_le_exp_mul_of_le_exp hL0 hL hLlog t le_rfl + have hpowL := pow_le_exp_mul_of_le_exp (inv_nonneg.mpr hζ) hB hB0 + (majorArcLengthExponent n * t) le_rfl + have hsecond := mul_le_mul + (mul_le_mul hWw hLt (pow_nonneg hL0 _) (Real.exp_pos _).le) hpowL (by positivity) (by positivity) + simp only [← Real.exp_add] at hsecond + have hsum := add_le_exp_add_one + (by positivity : 0 ≤ (j : ℝ) * (3 + majorArcCoverLog n j p v) + + ((majorArcCoverExponent n j * j : ℕ) : ℝ) * uniformRetainedBiasLog n j t p v w E) + (by positivity : 0 ≤ w + (t : ℝ) * majorArcLengthLog n p + + ((majorArcLengthExponent n * t : ℕ) : ℝ) * uniformRetainedBiasLog n j t p v w E) + hfirst hsecond + have hplus := one_add_le_exp_succ (by positivity) hsum + unfold uniformCharacterDenominatorBound + simp only [div_eq_mul_inv] + calc + _ = 1 + ((3 * majorArcCoverConstant n j U V) ^ j * ζ⁻¹ ^ (majorArcCoverExponent n j * j) + + W * majorArcLengthConstant n U ^ t * ζ⁻¹ ^ (majorArcLengthExponent n * t)) := by ring + _ ≤ _ := hplus + _ = _ := by unfold uniformRetainedDenominatorLog; congr 1; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem uniformScaledRetainedFrequencyBound_le (n d : ℕ) {U V ζ : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) : + uniformScaledRetainedFrequencyBound n d U V ζ ≤ + 2 * majorArcCoverConstant n d U V / ζ ^ majorArcCoverExponent n d := by + have hX := one_le_inverse_power (majorArcCoverConstant_one_le n d hU hV) hζ hζ1 + (majorArcCoverExponent n d) + have hc := Nat.ceil_lt_add_one (show 0 ≤ majorArcCoverConstant n d U V / + ζ ^ majorArcCoverExponent n d by linarith) + unfold uniformScaledRetainedFrequencyBound + rw [mul_div_assoc] + linarith + +theorem uniformScaledRetainedDenominatorBound_le (n d t : ℕ) {U V W ζ : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) : + uniformScaledRetainedDenominatorBound n d t U V W ζ ≤ + uniformCharacterDenominatorBound n d t U V W ζ := by + have hX := one_le_inverse_power (majorArcCoverConstant_one_le n d hU hV) hζ hζ1 + (majorArcCoverExponent n d) + have hf := uniformScaledRetainedFrequencyBound_le n d hU hV hζ hζ1 + rw [mul_div_assoc] at hf + have hnonneg := uniformScaledRetainedFrequencyBound_nonneg n d U V ζ + have hb : uniformScaledRetainedFrequencyBound n d U V ζ + 1 ≤ + 3 * (majorArcCoverConstant n d U V / ζ ^ majorArcCoverExponent n d) := by linarith + have hp := pow_le_pow_left₀ (by positivity : 0 ≤ uniformScaledRetainedFrequencyBound n d U V ζ + 1) hb d + have he : (3 * (majorArcCoverConstant n d U V / ζ ^ majorArcCoverExponent n d)) ^ d = + (3 * majorArcCoverConstant n d U V) ^ d / ζ ^ (majorArcCoverExponent n d * d) := by + rw [← mul_div_assoc, div_pow, pow_mul] + rw [he] at hp + have hl : 0 ≤ W * majorArcLengthConstant n U ^ t / ζ ^ (majorArcLengthExponent n * t) := + div_nonneg (mul_nonneg hW (pow_nonneg (majorArcLengthConstant_pos n hU).le _)) (pow_pos hζ _).le + have hn : 0 ≤ (3 * majorArcCoverConstant n d U V) ^ d / ζ ^ (majorArcCoverExponent n d * d) := by + have := (majorArcCoverConstant_one_le n d hU hV) + positivity + unfold uniformScaledRetainedDenominatorBound uniformCharacterDenominatorBound + exact max_le (by linarith) (by linarith) + +theorem uniformScaledRetained_exp_bounds (n d t : ℕ) {U V W ε p v w E : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) (hE : 0 ≤ E) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) + (hεE : ε⁻¹ ≤ Real.exp E) : + let ζ := uniformBlockRetainedBias n d t U V W ε + uniformScaledRetainedFrequencyBound n d U V ζ ≤ Real.exp (uniformRetainedFrequencyLog n d t p v w E) ∧ + uniformScaledRetainedDenominatorBound n d t U V W ζ ≤ Real.exp (uniformRetainedDenominatorLog n d t p v w E) := by + obtain ⟨hζ, hζ1, _⟩ := uniformBlockRetainedBias_spec n d t hU hW hε + exact ⟨(uniformScaledRetainedFrequencyBound_le n d hU hV hζ hζ1).trans + (uniformRetainedFrequency_exp_bound n d t hU hV hW hε hε1 hp hv hw hE hUp hVv hWw hεE), + (uniformScaledRetainedDenominatorBound_le n d t hU hV hW hζ hζ1).trans + (uniformCharacterDenominatorBound_exp_bound n d t hU hV hW hε hε1 hp hv hw hE hUp hVv hWw hεE)⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UniformStridedBlockEntry.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UniformStridedBlockEntry.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a4aa1f3e95acdcd46808fe6d106cceaff8f9b27 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UniformStridedBlockEntry.lean @@ -0,0 +1,179 @@ +import OAI.Combinatorics.Progressions.Polynomial.PrependPolynomialVariable + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem coefficient_multiaffine_strided_bias {n : ℕ} (P : MvPolynomial (Fin n) ℝ) + (hP : ∀ i, P.degreeOf i ≤ 1) (N s : Fin n → ℕ) (M k : ℕ) + (hs : ∀ i, 0 < s i) (hk : 0 < k) (u : Fin n → ℝ) (w : ℝ) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ i, multiaffineBiasBudget n ζ ≤ N i) + (hM : multiaffineBiasBudget n ζ ≤ M) + (hbias : ζ ≤ ‖𝔼 c : Fin M, 𝔼 x : ∀ i, Fin (N i), + character (((w+(k : ℝ)*(c.val : ℝ))* + MvPolynomial.eval (fun i => u i+(s i : ℝ)*((x i).val : ℝ)) P : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * ((k : ℝ)*∏ i, (s i : ℝ)) ∧ + ∃ m : ℤ, |P.coeff (SquarefreeIndex.ofFinset (Finset.univ : Finset (Fin n))).val- + (m : ℝ)/D| ≤ multiaffineBiasBudget n ζ / + (((k : ℝ)*M)*∏ i, ((s i : ℝ)*(N i : ℝ))) := by + let A := prependPolynomialVariable P + let L : Fin (n+1) → ℕ := Fin.cons M N + let t : Fin (n+1) → ℕ := Fin.cons k s + let v : Fin (n+1) → ℝ := Fin.cons w u + have ht : ∀ i, 0 < t i := by + intro i + exact Fin.cases hk hs i + have hL : ∀ i, multiaffineBiasBudget n ζ ≤ L i := by + intro i + exact Fin.cases hM hN i + have heval (c : Fin M) (x : ∀ i, Fin (N i)) : + MvPolynomial.eval (fun i => v i+(t i : ℝ)* + (((Fin.cons c x : ∀ i, Fin (L i)) i).val : ℝ)) A = + (w+(k : ℝ)*(c.val : ℝ))* + MvPolynomial.eval (fun i => u i+(s i : ℝ)*((x i).val : ℝ)) P := by + have he : (fun i => v i+(t i : ℝ)* + (((Fin.cons c x : ∀ i, Fin (L i)) i).val : ℝ)) = + Fin.cons (w+(k : ℝ)*(c.val : ℝ)) (fun i => u i+(s i : ℝ)*((x i).val : ℝ)) := by + funext i + exact Fin.cases rfl (fun _ => rfl) i + rw [he] + exact prependPolynomialVariable_eval P _ _ + have hb : ζ ≤ ‖𝔼 x : ∀ i, Fin (L i), + character ((MvPolynomial.eval (fun i => v i+(t i : ℝ)*((x i).val : ℝ)) A : ℝ) : + CircleFourier.Circle)‖ := by + rw [expect_dependent_fin_cons] + apply hbias.trans_eq + congr 1 + apply Finset.expect_congr rfl + intro c _ + apply Finset.expect_congr rfl + intro x _ + exact congrArg (fun r : ℝ => character (r : CircleFourier.Circle)) (heval c x).symm + have h := fin_multiaffine_strided_bias A (prependPolynomialVariable_degree P hP) + L t ht v hζ hL hb + simpa only [A, prependPolynomialVariable_top, L, t, Fin.prod_univ_succ, + Fin.cons_zero, Fin.cons_succ] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem moderateBooleanBlock_selected_entry {n : ℕ} {α : Type*} + [Fintype α] [DecidableEq α] + (N s : Fin n → Option α → ℕ) (M k : ℕ) (u : Fin n → Option α → ℝ) (w : ℝ) + (ξ : Finset α → ℝ) (label : Fin n → Option α) (S : Finset α) + (hlabel : ∀ a, (∃ i, label i = some a) ↔ a ∈ S) + (hNpos : ∀ g r, 0 < N g r) (hs : ∀ g, 0 < s g (label g)) (hk : 0 < k) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g (label g)) + (hM : multiaffineBiasBudget n ζ ≤ M) + (hbias : ζ ≤ ‖𝔼 c : Fin M, 𝔼 x : ∀ g r, Fin (N g r), + character (((w+(k : ℝ)*(c.val : ℝ))* + booleanBlockPhase ξ (fun g r => u g r+(s g r : ℝ)*((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * ((k : ℝ)*∏ g, (s g (label g) : ℝ)) ∧ + ∃ m : ℤ, |ξ S-(m : ℝ)/D| ≤ multiaffineBiasBudget n ζ / + (((k : ℝ)*M)*∏ g, ((s g (label g) : ℝ)*(N g (label g) : ℝ))) := by + let : ∀ g r, Nonempty (Fin (N g r)) := fun g r => ⟨⟨0,hNpos g r⟩⟩ + let F := fun x : ∀ g r, Fin (N g r) => 𝔼 c : Fin M, + character (((w+(k : ℝ)*(c.val : ℝ))* + booleanBlockPhase ξ (fun g r => u g r+(s g r : ℝ)*((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle) + have hbias' : ζ ≤ ‖𝔼 x, F x‖ := by + rw [Finset.expect_comm] at hbias + exact hbias + obtain ⟨b,hb⟩ := exists_frozen_group_bias label F hbias' + let a := fun g r => u g r+(s g r : ℝ)*((b g r).val : ℝ) + let P := frozenBooleanPhasePolynomial label a ξ + have hphase (t : ∀ g, Fin (N g (label g))) : F (resampleGroupCoordinates label b t) = + 𝔼 c : Fin M, character (((w+(k : ℝ)*(c.val : ℝ))* + MvPolynomial.eval (fun g => u g (label g)+(s g (label g) : ℝ)*((t g).val : ℝ)) P : ℝ) : + CircleFourier.Circle) := by + dsimp only [F,P] + simp only [frozenBooleanPhasePolynomial_eval, a, progressionCoordinates_resample] + simp_rw [hphase] at hb + rw [Finset.expect_comm] at hb + have h := coefficient_multiaffine_strided_bias P (frozenBooleanPhasePolynomial_degree label a ξ) + (fun g => N g (label g)) (fun g => s g (label g)) M k hs hk + (fun g => u g (label g)) w hζ hN hM hb + simpa only [P, frozenBooleanPhasePolynomial_coefficient n label a ξ S hlabel] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem booleanBlockPhase_bounded_stride_entry {n : ℕ} {α : Type*} [Fintype α] [DecidableEq α] + (N : Fin (n+1) → ℕ) (s : Fin (n+1) → Option α → ℕ) + (u : Fin (n+1) → Option α → ℝ) (ξ : Finset α → ℝ) (S : Finset α) + (hS : S.card ≤ n+1) (hs : ∀ g r, 0 < s g r) {R : ℝ} (hR : ∀ g r, (s g r : ℝ) ≤ R) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g) + (hbias : ζ ≤ ‖𝔼 x : ∀ g, Option α → Fin (N g), + character ((booleanBlockPhase ξ (fun g r => u g r+(s g r : ℝ)*((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * R^(n+1) ∧ + ∃ m : ℤ, |ξ S-(m : ℝ)/D| ≤ multiaffineBiasBudget n ζ / ∏ g, (N g : ℝ) := by + obtain ⟨label,hlabel⟩ := exists_padded_boolean_labels S (n+1) hS + have hQ := multiaffineBiasBudget_pos n hζ + have hNp : ∀ g, 0 < N g := fun g => by exact_mod_cast hQ.trans_le (hN g) + obtain ⟨D,hD,hDQ,m,hm⟩ := booleanBlockPhase_strided_selected_entry (fun g _ => N g) s u ξ + label S hlabel (fun g _ => hNp g) (fun g => hs g (label g)) hζ hN hbias + refine ⟨D,hD,hDQ.trans ?_,m,hm.trans ?_⟩ + · apply mul_le_mul_of_nonneg_left _ hQ.le + simpa only [Fintype.card_fin] using stride_product_le (fun g => s g (label g)) + (fun g => hR g (label g)) + · simpa only [one_mul] using stride_product_error_le N (fun g => s g (label g)) hNp + (fun g => hs g (label g)) (by norm_num : (0 : ℝ) < 1) hQ.le + +theorem moderateBooleanBlock_bounded_stride_entry {n : ℕ} {α : Type*} [Fintype α] [DecidableEq α] + (N : Fin n → ℕ) (s : Fin n → Option α → ℕ) (M k : ℕ) + (u : Fin n → Option α → ℝ) (w : ℝ) (ξ : Finset α → ℝ) (S : Finset α) + (hS : S.card ≤ n) (hs : ∀ g r, 0 < s g r) (hk : 0 < k) + {R : ℝ} (hR : ∀ g r, (s g r : ℝ) ≤ R) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g) + (hM : multiaffineBiasBudget n ζ ≤ M) + (hbias : ζ ≤ ‖𝔼 c : Fin M, 𝔼 x : ∀ g, Option α → Fin (N g), + character (((w+(k : ℝ)*(c.val : ℝ))* + booleanBlockPhase ξ (fun g r => u g r+(s g r : ℝ)*((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * ((k : ℝ)*R^n) ∧ + ∃ m : ℤ, |ξ S-(m : ℝ)/D| ≤ multiaffineBiasBudget n ζ / + (((k : ℝ)*M)*∏ g, (N g : ℝ)) := by + obtain ⟨label,hlabel⟩ := exists_padded_boolean_labels S n hS + have hQ := multiaffineBiasBudget_pos n hζ + have hNp : ∀ g, 0 < N g := fun g => by exact_mod_cast hQ.trans_le (hN g) + have hMp : (0 : ℝ) < M := hQ.trans_le hM + obtain ⟨D,hD,hDQ,m,hm⟩ := moderateBooleanBlock_selected_entry (fun g _ => N g) s M k u w ξ + label S hlabel (fun g _ => hNp g) (fun g => hs g (label g)) hk hζ hN hM hbias + refine ⟨D,hD,hDQ.trans ?_,m,hm.trans ?_⟩ + · apply mul_le_mul_of_nonneg_left _ hQ.le + apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg k) + simpa only [Fintype.card_fin] using stride_product_le (fun g => s g (label g)) + (fun g => hR g (label g)) + · apply stride_product_error_le N (fun g => s g (label g)) hNp + (fun g => hs g (label g)) _ hQ.le + exact mul_pos (by exact_mod_cast hk) hMp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitBoundProductDifference.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitBoundProductDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..71674b78cfde015fc488c277ca8574cea73a8fe8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitBoundProductDifference.lean @@ -0,0 +1,52 @@ +import Mathlib.Algebra.Order.BigOperators.GroupWithZero.Finset +import Mathlib.Analysis.Normed.Ring.Basic +import Mathlib.Tactic.Ring + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +theorem norm_finset_prod_sub_prod_le_sum {ι A : Type*} + [NormedCommRing A] [NormOneClass A] + (s : Finset ι) (f g : ι → A) + (hf : ∀ i ∈ s, ‖f i‖ ≤ 1) (hg : ∀ i ∈ s, ‖g i‖ ≤ 1) : + ‖(∏ i ∈ s, f i) - ∏ i ∈ s, g i‖ ≤ ∑ i ∈ s, ‖f i - g i‖ := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => + have hfs : ∀ i ∈ s, ‖f i‖ ≤ 1 := fun i hi => hf i (Finset.mem_insert_of_mem hi) + have hgs : ∀ i ∈ s, ‖g i‖ ≤ 1 := fun i hi => hg i (Finset.mem_insert_of_mem hi) + have hprod : ‖∏ i ∈ s, f i‖ ≤ 1 := + (s.norm_prod_le f).trans (Finset.prod_le_one₀ (fun i _ => norm_nonneg (f i)) hfs) + have hga : ‖g a‖ ≤ 1 := hg a (Finset.mem_insert_self a s) + rw [Finset.prod_insert ha, Finset.prod_insert ha, Finset.sum_insert ha] + calc + ‖f a * (∏ i ∈ s, f i) - g a * (∏ i ∈ s, g i)‖ = + ‖(f a - g a) * (∏ i ∈ s, f i) + + g a * ((∏ i ∈ s, f i) - ∏ i ∈ s, g i)‖ := by congr 1; ring + _ ≤ ‖(f a - g a) * (∏ i ∈ s, f i)‖ + + ‖g a * ((∏ i ∈ s, f i) - ∏ i ∈ s, g i)‖ := norm_add_le _ _ + _ ≤ ‖f a - g a‖ * ‖∏ i ∈ s, f i‖ + + ‖g a‖ * ‖(∏ i ∈ s, f i) - ∏ i ∈ s, g i‖ := + add_le_add (norm_mul_le _ _) (norm_mul_le _ _) + _ ≤ ‖f a - g a‖ * 1 + 1 * (∑ i ∈ s, ‖f i - g i‖) := + add_le_add (mul_le_mul_of_nonneg_left hprod (norm_nonneg _)) + (mul_le_mul hga (ih hfs hgs) (norm_nonneg _) (by norm_num)) + _ = ‖f a - g a‖ + ∑ i ∈ s, ‖f i - g i‖ := by simp + +theorem norm_prod_sub_prod_le_sum {ι A : Type*} [Fintype ι] + [NormedCommRing A] [NormOneClass A] + (f g : ι → A) (hf : ∀ i, ‖f i‖ ≤ 1) (hg : ∀ i, ‖g i‖ ≤ 1) : + ‖(∏ i, f i) - ∏ i, g i‖ ≤ ∑ i, ‖f i - g i‖ := + norm_finset_prod_sub_prod_le_sum Finset.univ f g (fun i _ => hf i) (fun i _ => hg i) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitCoefficientSourceMarginal.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitCoefficientSourceMarginal.lean new file mode 100644 index 0000000000000000000000000000000000000000..82a2ddd1c771e9f1c46e03af998c0db0094f22d9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitCoefficientSourceMarginal.lean @@ -0,0 +1,170 @@ +import Mathlib.Probability.Independence.Basic +import OAI.Combinatorics.Progressions.Lattices.IntegerMatrixRealDensity + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +noncomputable def unitCoefficientSource (I : Type*) [Fintype I] : Measure (I → ℝ) := + realDensityMeasure volume (smoothProductProfile I) + +instance unitCoefficientSource_probability (I : Type*) [Fintype I] : + IsProbabilityMeasure (unitCoefficientSource I) := + realDensityMeasure_probability volume _ + ((smoothProductProfile_contDiff I).continuous.integrable_of_hasCompactSupport (smoothProductProfile_compact I)) + (fun r => (smoothProductProfile_range I r).1) (smoothProductProfile_integral I) + +theorem unitCoefficientSource_norm_le (I : Type*) [Fintype I] : + ∀ᵐ r ∂unitCoefficientSource I, ‖r‖ ≤ 1 := by + have hi : Integrable (smoothProductProfile I) := (smoothProductProfile_contDiff I).continuous.integrable_of_hasCompactSupport + (smoothProductProfile_compact I) + have hnull : unitCoefficientSource I {r | 1 < ‖r‖} = 0 := by + rw [unitCoefficientSource, realDensityMeasure_apply volume _ hi + (fun r => (smoothProductProfile_range I r).1) (measurableSet_lt measurable_const measurable_norm)] + have hz : (∫ r in {r : I → ℝ | 1 < ‖r‖}, smoothProductProfile I r) = 0 := by + apply setIntegral_eq_zero_of_forall_eq_zero + exact fun r hr => smoothProductProfile_zero_outside I r hr + rw [hz, ENNReal.ofReal_zero] + exact (ae_iff.mpr (by simpa only [not_le] using hnull)) + +theorem unitCoefficientSource_affine_law {I : Type*} [Fintype I] + (c w : I → ℝ) (hw : ∀ i, 0 < w i) : + (unitCoefficientSource I).map (fun r i => c i+w i*r i) = + realDensityMeasure volume (affineProductProfile c w) := + affineProductProfile_law c w hw + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators Matrix + +theorem unitCoefficientSource_pi (I : Type*) [Fintype I] : + unitCoefficientSource I = Measure.pi (fun _ : I => realDensityMeasure volume smoothProbabilityProfile) := by + symm + exact realDensityMeasure_pi (fun _ => volume) (fun _ => smoothProbabilityProfile) + (fun _ => smoothProbabilityProfile_contDiff.continuous.integrable_of_hasCompactSupport + smoothProbabilityProfile_compact) (fun _ r => (smoothProbabilityProfile_range r).1) + +theorem unitCoefficientSource_reindex {I J : Type*} [Fintype I] [Fintype J] (e : I ≃ J) : + (unitCoefficientSource I).map (fun r => r ∘ e.symm) = unitCoefficientSource J := by + let : IsProbabilityMeasure (realDensityMeasure volume smoothProbabilityProfile) := + realDensityMeasure_probability volume _ + (smoothProbabilityProfile_contDiff.continuous.integrable_of_hasCompactSupport + smoothProbabilityProfile_compact) + (fun r => (smoothProbabilityProfile_range r).1) smoothProbabilityProfile_integral + rw [unitCoefficientSource_pi, unitCoefficientSource_pi] + have he : (MeasurableEquiv.piCongrLeft (fun _ : J => ℝ) e : (I → ℝ) → J → ℝ) = + fun r => r ∘ e.symm := by + funext r j + simp [MeasurableEquiv.coe_piCongrLeft, Equiv.piCongrLeft_apply] + rw [← he] + exact Measure.pi_map_piCongrLeft e (fun _ => realDensityMeasure volume smoothProbabilityProfile) + +theorem affineCoefficientProduct_unit_reindex {I J : Type*} [Fintype I] [Fintype J] + (e : I ≃ J) (c w : J → ℝ) (hw : ∀ j, 0 < w j) : + (unitCoefficientSource I).map (fun r j => c j+w j*r (e.symm j)) = + Measure.pi (fun j => affineCoefficientMeasure (c j) (w j)) := by + have hm : Measurable (fun r : J → ℝ => fun j => c j+w j*r j) := by fun_prop + have he : Measurable (fun r : I → ℝ => r ∘ e.symm) := by fun_prop + change (unitCoefficientSource I).map + ((fun r : J → ℝ => fun j => c j+w j*r j) ∘ (fun r => r ∘ e.symm)) = _ + rw [← Measure.map_map hm he, unitCoefficientSource_reindex, + unitCoefficientSource_affine_law c w hw, affineCoefficientProduct_density c w hw] + +theorem normalizedIntegerColumns_one_mulVec {O J : Type*} + [Fintype O] [DecidableEq O] [Fintype J] [DecidableEq J] + (A : Matrix O J ℤ) (S v : J → ℝ) : + A.map (Int.cast : ℤ → ℝ) *ᵥ (fun j => S j*v j) = + normalizedIntegerColumns A S (fun _ => 1) *ᵥ v := by + ext i + change (∑ j, (A i j : ℝ)*(S j*v j)) = ∑ j, normalizedIntegerColumns A S (fun _ => 1) i j*v j + simp only [normalizedIntegerColumns_entry_div, div_one] + apply Finset.sum_congr rfl + intro j _ + ring + +theorem affineCoefficientProduct_scaled_image {I J O : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [Fintype O] [DecidableEq O] + (e : I ≃ J) (A : Matrix O J ℤ) (c w S : J → ℝ) + (hw : ∀ j, 0 < w j) (hS : ∀ j, 0 < S j) : + (Measure.pi (fun j => affineCoefficientMeasure (S j*c j) (S j*w j))).map + (fun a => A.map (Int.cast : ℤ → ℝ) *ᵥ a) = + (unitCoefficientSource I).map (fun r => + normalizedIntegerColumns (A.submatrix id e) (S ∘ e) (fun _ => 1) *ᵥ + (fun i => c (e i)+w (e i)*r i)) := by + have hsample : Measurable (fun r : I → ℝ => fun j => S j*c j+S j*w j*r (e.symm j)) := by fun_prop + have hmatrix : Measurable (fun a => A.map (Int.cast : ℤ → ℝ) *ᵥ a) := + (matrixSupCLM _).continuous.measurable + rw [← affineCoefficientProduct_unit_reindex e _ _ (fun j => mul_pos (hS j) (hw j)), + Measure.map_map hmatrix hsample] + congr 1 + funext r + let v : I → ℝ := fun i => S (e i)*(c (e i)+w (e i)*r i) + have hv : (fun j => S j*c j+S j*w j*r (e.symm j)) = v ∘ e.symm := by + funext j + simp only [v, Function.comp_apply, e.apply_symm_apply] + ring + change A.map (Int.cast : ℤ → ℝ) *ᵥ (fun j => S j*c j+S j*w j*r (e.symm j)) = _ + have hr := Matrix.submatrix_mulVec_equiv (A.map (Int.cast : ℤ → ℝ)) v id e + simp only [Function.comp_id] at hr + rw [hv, ← hr] + exact normalizedIntegerColumns_one_mulVec (A.submatrix id e) (S ∘ e) _ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory ProbabilityTheory + +theorem unitCoefficientProjection_measurable {I J : Type*} (e : I → J) : + Measurable (fun r : J → ℝ => r ∘ e) := + Measurable.of_eval (fun index => measurable_pi_apply (e index)) + +theorem unitCoefficientSource_marginal {I J : Type*} [Fintype I] [Fintype J] + (e : I ↪ J) : + (unitCoefficientSource J).map (fun r => r ∘ e) = unitCoefficientSource I := by + let ν : Measure ℝ := realDensityMeasure volume smoothProbabilityProfile + have : IsProbabilityMeasure ν := + realDensityMeasure_probability volume _ + (smoothProbabilityProfile_contDiff.continuous.integrable_of_hasCompactSupport + smoothProbabilityProfile_compact) + (fun r => (smoothProbabilityProfile_range r).1) smoothProbabilityProfile_integral + rw [unitCoefficientSource_pi, unitCoefficientSource_pi] + change (Measure.pi (fun _ : J => ν)).map (fun r => r ∘ e) = + Measure.pi (fun _ : I => ν) + have hind : iIndepFun (fun j : J => fun r : J → ℝ => r j) + (Measure.pi (fun _ : J => ν)) := + iIndepFun_pi (X := fun _ => id) (fun _ => aemeasurable_id) + have he := hind.precomp e.injective + have hm := he.map_fun_eq_pi_map (fun i => (measurable_pi_apply (e i)).aemeasurable) + change (Measure.pi (fun _ : J => ν)).map (fun r => r ∘ e) = _ at hm + rw [hm] + congr 1 + funext i + exact (measurePreserving_eval (fun _ : J => ν) (e i)).map_eq + +theorem unitCoefficientSource_marginal_preserving {I J : Type*} [Fintype I] [Fintype J] + (e : I ↪ J) : + MeasurePreserving (fun r : J → ℝ => r ∘ e) + (unitCoefficientSource J) (unitCoefficientSource I) := + ⟨unitCoefficientProjection_measurable e, unitCoefficientSource_marginal e⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitExpansionCorrelation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitExpansionCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cd60ed789ddb3dcc138a843f978731fe95b6ede --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitExpansionCorrelation.lean @@ -0,0 +1,272 @@ +import OAI.Combinatorics.Progressions.Estimates.ComplexFiniteMeans + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_large_weighted_term {I : Type*} [Fintype I] (c z : I → ℂ) + {delta M : ℝ} (hdelta : 0 < delta) (hM : 0 < M) + (hc : (∑ i, ‖c i‖) ≤ M) (hsum : delta ≤ ‖∑ i, c i * z i‖) : + ∃ i, delta / M ≤ ‖z i‖ := by + classical + have hI : (Finset.univ : Finset I).Nonempty := by + by_contra h + rw [Finset.not_nonempty_iff_eq_empty.mp h, Finset.sum_empty, norm_zero] at hsum + linarith + obtain ⟨i, _, hi⟩ := Finset.exists_max_image Finset.univ (fun i => ‖z i‖) hI + refine ⟨i, (div_le_iff₀ hM).mpr ?_⟩ + calc + delta ≤ ‖∑ j, c j * z j‖ := hsum + _ ≤ ∑ j, ‖c j * z j‖ := norm_sum_le _ _ + _ ≤ ∑ j, ‖c j‖ * ‖z i‖ := by + apply Finset.sum_le_sum + intro j _ + rw [norm_mul] + exact mul_le_mul_of_nonneg_left (hi j (Finset.mem_univ _)) (norm_nonneg _) + _ = (∑ j, ‖c j‖) * ‖z i‖ := (Finset.sum_mul _ _ _).symm + _ ≤ M * ‖z i‖ := mul_le_mul_of_nonneg_right hc (norm_nonneg _) + _ = ‖z i‖ * M := mul_comm _ _ + +theorem sum_pair_coefficient_norms_le {I : Type*} {J : I → Type*} + [Fintype I] [∀ i, Fintype (J i)] (c : I → ℂ) (d : ∀ i, J i → ℂ) + {C D : ℝ} (hD : 0 ≤ D) (hc : (∑ i, ‖c i‖) ≤ C) + (hd : ∀ i, (∑ j, ‖d i j‖) ≤ D) : + (∑ p : Sigma J, ‖c p.1 * d p.1 p.2‖) ≤ C * D := by + rw [Fintype.sum_sigma] + simp_rw [norm_mul, ← Finset.mul_sum] + calc + _ ≤ ∑ i, ‖c i‖ * D := Finset.sum_le_sum (fun i _ => mul_le_mul_of_nonneg_left (hd i) (norm_nonneg _)) + _ = (∑ i, ‖c i‖) * D := (Finset.sum_mul _ _ _).symm + _ ≤ C * D := mul_le_mul_of_nonneg_right hc hD + +theorem exists_large_weighted_pair {I : Type*} {J : I → Type*} + [Fintype I] [∀ i, Fintype (J i)] (c : I → ℂ) (d z : ∀ i, J i → ℂ) + {delta C D : ℝ} (hdelta : 0 < delta) (hC : 0 < C) (hD : 0 < D) + (hc : (∑ i, ‖c i‖) ≤ C) (hd : ∀ i, (∑ j, ‖d i j‖) ≤ D) + (hsum : delta ≤ ‖∑ i, ∑ j, (c i * d i j) * z i j‖) : + ∃ i j, delta / (C * D) ≤ ‖z i j‖ := by + obtain ⟨p, hp⟩ := exists_large_weighted_term + (fun p : Sigma J => c p.1 * d p.1 p.2) (fun p => z p.1 p.2) + hdelta (mul_pos hC hD) (sum_pair_coefficient_norms_le c d hD.le hc hd) + (by simpa only [Fintype.sum_sigma] using hsum) + exact ⟨p.1, p.2, hp⟩ + +theorem exists_large_weighted_pair_nonzero {I : Type*} {J : I → Type*} + [Fintype I] [∀ i, Fintype (J i)] (c : I → ℂ) (d z : ∀ i, J i → ℂ) + {delta C D : ℝ} (hdelta : 0 < delta) (hC : 0 < C) (hD : 0 < D) + (hc : (∑ i, ‖c i‖) ≤ C) (hd : ∀ i, (∑ j, ‖d i j‖) ≤ D) + (hsum : delta ≤ ‖∑ i, ∑ j, (c i * d i j) * z i j‖) : + ∃ i j, c i ≠ 0 ∧ d i j ≠ 0 ∧ delta / (C * D) ≤ ‖z i j‖ := by + classical + let w := fun i j => if c i * d i j = 0 then 0 else z i j + have he : ∀ i j, (c i * d i j) * w i j = (c i * d i j) * z i j := by + intro i j + dsimp only [w] + split_ifs with h + · simp only [h, zero_mul] + · rfl + obtain ⟨i, j, hj⟩ := exists_large_weighted_pair c d w hdelta hC hD hc hd + (by simpa only [he] using hsum) + have hn : c i * d i j ≠ 0 := by + intro h + have hpos := div_pos hdelta (mul_pos hC hD) + simp only [w, h, ite_true, norm_zero] at hj + exact (not_le_of_gt hpos) hj + exact ⟨i, j, (mul_ne_zero_iff.mp hn).1, (mul_ne_zero_iff.mp hn).2, + by simpa only [w, hn, ite_false] using hj⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_correlating_components_on_finset {X I J : Type*} [Fintype I] [Fintype J] + (s : Finset X) (hs : s.Nonempty) (U Q R : X → ℂ) (V : I → X → ℂ) (W : J → X → ℂ) + {delta C D rho eta : ℝ} (hdelta : 0 < delta) (hC : 0 < C) (hD : 0 < D) + (hrho : 0 ≤ rho) (_heta : 0 ≤ eta) + (hI : (Fintype.card I : ℝ) ≤ C) (hJ : (Fintype.card J : ℝ) ≤ D) + (hU : ∀ x ∈ s, ‖U x‖ ≤ 1) (hR : ∀ x ∈ s, ‖R x‖ ≤ 1) + (hV : ∀ i x, x ∈ s → ‖V i x‖ ≤ 1) + (hQa : ∀ x ∈ s, ‖Q x - ∑ i, V i x‖ ≤ rho) + (hRa : ∀ x ∈ s, ‖R x - ∑ j, W j x‖ ≤ eta) + (hsmall : rho + C * eta ≤ delta / 2) + (hcorr : delta ≤ ‖𝔼 x ∈ s, U x * Q x * R x‖) : + ∃ i j, (delta / 2) / (C * D) ≤ ‖𝔼 x ∈ s, U x * V i x * W j x‖ := by + have hpoint (x : X) (hx : x ∈ s) : + ‖U x * Q x * R x - ∑ i, ∑ j, U x * V i x * W j x‖ ≤ rho + C * eta := by + have hsum : ‖∑ i, V i x‖ ≤ C := by + apply (norm_sum_le _ _).trans + exact (Finset.sum_le_sum (fun i _ => hV i x hx)).trans (by simpa using hI) + have hid : U x * Q x * R x - ∑ i, ∑ j, U x * V i x * W j x = + U x * (Q x - ∑ i, V i x) * R x + + U x * (∑ i, V i x) * (R x - ∑ j, W j x) := by + rw [← Finset.sum_mul_sum, ← Finset.mul_sum] + ring + rw [hid] + apply (norm_add_le _ _).trans + apply add_le_add + · simp only [norm_mul] + calc + _ ≤ 1 * rho * 1 := mul_le_mul + (mul_le_mul (hU x hx) (hQa x hx) (norm_nonneg _) (by norm_num)) + (hR x hx) (norm_nonneg _) (by positivity) + _ = rho := by ring + · simp only [norm_mul] + calc + _ ≤ 1 * C * eta := mul_le_mul + (mul_le_mul (hU x hx) hsum (norm_nonneg _) (by norm_num)) + (hRa x hx) (norm_nonneg _) (by positivity) + _ = C * eta := by ring + have hsum : (𝔼 x ∈ s, ∑ i, ∑ j, U x * V i x * W j x) = + ∑ i, ∑ j, 𝔼 x ∈ s, U x * V i x * W j x := by + simp_rw [Finset.expect_sum_comm] + have herr : ‖(𝔼 x ∈ s, U x * Q x * R x) - + (∑ i, ∑ j, 𝔼 x ∈ s, U x * V i x * W j x)‖ ≤ delta / 2 := by + rw [← hsum, ← Finset.expect_sub_distrib] + exact (RCLike.norm_expect_le (K := ℂ)).trans ((Finset.expect_le hs hpoint).trans hsmall) + apply exists_large_weighted_pair (fun _ : I => (1 : ℂ)) (fun (_ : I) (_ : J) => (1 : ℂ)) + (fun i j => 𝔼 x ∈ s, U x * V i x * W j x) (by positivity) hC hD + · simpa using hI + · intro _ + simpa using hJ + · simp only [one_mul] + have htri := norm_add_le + ((𝔼 x ∈ s, U x * Q x * R x) - (∑ i, ∑ j, 𝔼 x ∈ s, U x * V i x * W j x)) + (∑ i, ∑ j, 𝔼 x ∈ s, U x * V i x * W j x) + rw [sub_add_cancel] at htri + linarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem two_site_model_identity {G I : Type*} {J : I → Type*} + [AddCommGroup G] [Fintype G] [Fintype I] [∀ i, Fintype (J i)] + (a b ea U : G → ℂ) (Q : I → G → ℂ) (R : ∀ i, J i → G → ℂ) + (eb : I → G → ℂ) (c : I → ℂ) (d : ∀ i, J i → ℂ) + (ha : ∀ n, a n = (∑ i, c i * Q i n) + ea n) + (hb : ∀ i n, b n = (∑ j, d i j * R i j n) + eb i n) (h : G) : + (𝔼 n, U n * a n * b (n + h)) = + (∑ i, ∑ j, (c i * d i j) * (𝔼 n, U n * Q i n * R i j (n + h))) + + (𝔼 n, U n * ea n * b (n + h)) + + (∑ i, c i * (𝔼 n, U n * Q i n * eb i (n + h))) := by + have hpoint (n : G) : U n * a n * b (n + h) = + (∑ i, ∑ j, (c i * d i j) * (U n * Q i n * R i j (n + h))) + + U n * ea n * b (n + h) + (∑ i, c i * (U n * Q i n * eb i (n + h))) := by + rw [ha n] + calc + _ = (∑ i, c i * (U n * Q i n * b (n + h))) + U n * ea n * b (n + h) := by + simp only [mul_add, add_mul, Finset.mul_sum, Finset.sum_mul] + congr 1 + apply Finset.sum_congr rfl + intro i _ + ring + _ = (∑ i, ((∑ j, (c i * d i j) * (U n * Q i n * R i j (n + h))) + + c i * (U n * Q i n * eb i (n + h)))) + U n * ea n * b (n + h) := by + congr 1 + apply Finset.sum_congr rfl + intro i _ + rw [hb i (n + h)] + simp only [mul_add, Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro j _ + ring + _ = _ := by rw [Finset.sum_add_distrib]; ring + simp_rw [hpoint, Finset.expect_add_distrib, Finset.expect_sum_comm, ← Finset.mul_expect] + +theorem two_site_model_error_bound {G I : Type*} {J : I → Type*} + [AddCommGroup G] [Fintype G] [Fintype I] [∀ i, Fintype (J i)] + (a b ea U : G → ℂ) (Q : I → G → ℂ) (R : ∀ i, J i → G → ℂ) + (eb : I → G → ℂ) (c : I → ℂ) (d : ∀ i, J i → ℂ) + (ha : ∀ n, a n = (∑ i, c i * Q i n) + ea n) + (hb : ∀ i n, b n = (∑ j, d i j * R i j n) + eb i n) + (h : G) {A : ℝ} {B : I → ℝ} + (hfirst : ‖𝔼 n, U n * ea n * b (n + h)‖ ≤ A) + (hsecond : ∀ i, ‖𝔼 n, U n * Q i n * eb i (n + h)‖ ≤ B i) : + ‖(𝔼 n, U n * a n * b (n + h)) - + (∑ i, ∑ j, (c i * d i j) * (𝔼 n, U n * Q i n * R i j (n + h)))‖ ≤ + A + ∑ i, ‖c i‖ * B i := by + rw [two_site_model_identity a b ea U Q R eb c d ha hb h] + rw [show ∀ x y z : ℂ, x + y + z - x = y + z by intros; ring] + apply (norm_add_le _ _).trans + apply add_le_add hfirst + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro i _ + rw [norm_mul] + exact mul_le_mul_of_nonneg_left (hsecond i) (norm_nonneg _) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem complex_unit_vector_resolution {K : Type*} [Fintype K] (u : K → ℂ) + (hu : ∑ k, ‖u k‖ ^ 2 = 1) (z : ℂ) : z = ∑ k, (z * star (u k)) * u k := by + have hunit : (∑ k, star (u k) * u k) = (1 : ℂ) := by + calc + _ = ∑ k, ((‖u k‖ ^ 2 : ℝ) : ℂ) := by + apply Finset.sum_congr rfl + intro k _ + simp only [Complex.star_def, Complex.conj_mul', Complex.ofReal_pow] + _ = ((∑ k, ‖u k‖ ^ 2 : ℝ) : ℂ) := (Complex.ofReal_sum _ _).symm + _ = 1 := by rw [hu, Complex.ofReal_one] + rw [show (∑ k, (z * star (u k)) * u k) = z * ∑ k, star (u k) * u k by + rw [Finset.mul_sum]; simp only [mul_assoc], hunit, mul_one] + +theorem exists_unit_expansion_correlation {X K : Type*} {A : K → Type*} + [Fintype K] [∀ k, Fintype (A k)] (s : Finset X) + (f Q : X → ℂ) (P : K → X → ℂ) (c : ∀ k, A k → ℂ) (psi : ∀ k, A k → X → ℂ) + (hunit : ∀ x ∈ s, ∑ k, ‖P k x‖ ^ 2 = 1) + (hexp : ∀ k x, x ∈ s → Q x * star (P k x) = ∑ a, c k a * psi k a x) + {rho D M : ℝ} (hrho : 0 < rho) (hD : 0 < D) (hM : 0 < M) + (hcard : (Fintype.card K : ℝ) ≤ D) (hc : ∀ k, (∑ a, ‖c k a‖) ≤ M) + (hcorr : rho ≤ ‖𝔼 x ∈ s, f x * Q x‖) : + ∃ k a, rho / (D * M) ≤ ‖𝔼 x ∈ s, f x * P k x * psi k a x‖ := by + have hpoint (x : X) (hx : x ∈ s) : + f x * Q x = ∑ k, ∑ a, c k a * (f x * P k x * psi k a x) := by + rw [complex_unit_vector_resolution (fun k => P k x) (hunit x hx) (Q x), Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + rw [hexp k x hx, Finset.sum_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + ring + have hmean : (𝔼 x ∈ s, f x * Q x) = + ∑ k, ∑ a, c k a * (𝔼 x ∈ s, f x * P k x * psi k a x) := by + calc + _ = 𝔼 x ∈ s, ∑ k, ∑ a, c k a * (f x * P k x * psi k a x) := + Finset.expect_congr rfl hpoint + _ = _ := by simp_rw [Finset.expect_sum_comm, ← Finset.mul_expect] + apply exists_large_weighted_pair (fun _ : K => (1 : ℂ)) c + (fun k a => 𝔼 x ∈ s, f x * P k x * psi k a x) hrho hD hM + · simpa only [norm_one, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one] using hcard + · exact hc + · simpa only [one_mul, ← hmean] using hcorr + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitProductOrbitFamily.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitProductOrbitFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..db842bb3dee77338d5902d57b21823eeec6bbdbc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitProductOrbitFamily.lean @@ -0,0 +1,97 @@ +import Mathlib.Algebra.BigOperators.Ring.Finset +import OAI.Combinatorics.Progressions.Linear.RankIntervalFactorization + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open scoped TensorProduct BigOperators + +theorem piRealOrbit_normalized {ι σ : Type*} [Fintype ι] {L : ι → Type*} + [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] {s : ℕ} + (F : ∀ i, NilpotentLieFiltration (L i) s) {w : σ → ℕ} + (g : ∀ i, (F i).realification.PolynomialOrbit w) + (hg : ∀ i, (F i).realification.polynomialOrbitEval w 0 (g i) = 1) : + (pi F).realification.polynomialOrbitEval w 0 (piRealOrbit F g) = 1 := by + classical + apply (realBCHPiEquiv F).injective + funext i + change NilpotentLieBCHGroup.realificationMap + (hnil := (pi F).lowerCentralSeries_eq_bot) (hM := (F i).lowerCentralSeries_eq_bot) + (liePiEval i) ((pi F).realification.polynomialOrbitEval w 0 (piRealOrbit F g)) = _ + rw [piRealOrbit_eval, hg] + simp only [map_one, Pi.one_apply] + +end Erdos3.NilpotentLieFiltration + +namespace Erdos3.RationalFilteredNilmanifold + +open scoped TensorProduct BigOperators + +variable {ι σ τ : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] {L : ι → Type*} + [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] {s r : ℕ} {d : ι → ℕ} + [∀ i, TopologicalSpace (ℝ ⊗[ℚ] L i)] [∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] L i)] + [∀ i, ContinuousSMul ℝ (ℝ ⊗[ℚ] L i)] [∀ i, T2Space (ℝ ⊗[ℚ] L i)] + [TopologicalSpace (ℝ ⊗[ℚ] (∀ i, L i))] [IsTopologicalAddGroup (ℝ ⊗[ℚ] (∀ i, L i))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (∀ i, L i))] [T2Space (ℝ ⊗[ℚ] (∀ i, L i))] + (D : ∀ i, RationalFilteredNilmanifold (L i) s (d i)) + {I : ι → Type*} [∀ i, Fintype (I i)] {w : σ → ℕ} + (K : ∀ i, I i → (D i).Niltest w) + +omit [Nonempty ι] [TopologicalSpace (ℝ ⊗[ℚ] (∀ i, L i))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (∀ i, L i))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (∀ i, L i))] [T2Space (ℝ ⊗[ℚ] (∀ i, L i))] in +theorem productObservable_unit + (hunit : ∀ i x, ∑ j, ‖(K i j).observable x‖ ^ 2 = 1) (x : (pi D).Space) : + ∑ j : ∀ i, I i, ‖productObservable D (fun i => K i (j i)) x‖ ^ 2 = 1 := by + classical + simp only [productObservable, norm_prod, ← Finset.prod_pow] + calc + _ = ∏ i, ∑ j, ‖(K i j).observable (productProjection D i x)‖ ^ 2 := + (Fintype.prod_sum (fun i j => ‖(K i j).observable (productProjection D i x)‖ ^ 2)).symm + _ = ∏ _i : ι, (1 : ℝ) := Finset.prod_congr rfl (fun i _ => hunit i (productProjection D i x)) + _ = 1 := by simp only [Finset.prod_const_one] + +theorem exists_normalized_product_unit_family + (R : ∀ i, (D i).DegreeRankStructure r) {p : ℝ} + (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hR : ∀ i, (R i).ComplexityLE p) + (hKn : ∀ i j, (K i j).normBound ≤ 1) + (hKc : ∀ i j, (K i j).ComplexityLE p) + (hKu : ∀ i x, ∑ j, ‖(K i j).observable x‖ ^ 2 = 1) + (a : τ → ∀ i, (D i).filtration.realification.PolynomialOrbit w) + (ha0 : ∀ t i, (D i).filtration.realification.polynomialOrbitEval w 0 (a t i) = 1) : + (piRank D R).ComplexityLE (productNiltestBudget p) ∧ + ∃ U : (∀ i, I i) → (pi D).Niltest w, + (∀ j, (U j).normBound = 1) ∧ + (∀ j, (U j).ComplexityLE (productNiltestBudget p)) ∧ + (∀ x, ∑ j, ‖(U j).observable x‖ ^ 2 = 1) ∧ + (∀ t, (pi D).filtration.realification.polynomialOrbitEval w 0 + (NilpotentLieFiltration.piRealOrbit (fun i => (D i).filtration) (a t)) = 1) ∧ + ∀ t j x, ((U j).withOrbit + (NilpotentLieFiltration.piRealOrbit (fun i => (D i).filtration) (a t))).eval x = + ∏ i, ((K i (j i)).withOrbit (a t i)).eval x := by + classical + refine ⟨(piRank_complexity D R hp hι hR).mono _ (productNiltestBudget_geometry hp), + (fun j => unitBoundedPiNiltest D (fun i => K i (j i)) hp hι + (fun i => hKc i (j i)) (fun i => hKn i (j i))), + (fun _ => rfl), (fun j => unitBoundedPiNiltest_complexity D _ hp hι _ _), + (fun x => productObservable_unit D K hKu x), + (fun t => NilpotentLieFiltration.piRealOrbit_normalized _ _ (ha0 t)), ?_⟩ + intro t j x + change (∏ i, (K i (j i)).observable (productProjection D i + (QuotientGroup.mk ((pi D).filtration.realification.polynomialOrbitEval w x + (NilpotentLieFiltration.piRealOrbit (fun i => (D i).filtration) (a t)))))) = _ + apply Finset.prod_congr rfl + intro i _ + rw [productProjection_mk] + exact congrArg (fun g : (D i).RealGroup => (K i (j i)).observable (QuotientGroup.mk g)) + (NilpotentLieFiltration.piRealOrbit_eval (fun i => (D i).filtration) (a t) x i) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitRangeLocalLipschitz.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitRangeLocalLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..12abf2c634853df4387c8c4b9c3e6b2993e1578c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitRangeLocalLipschitz.lean @@ -0,0 +1,38 @@ +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Topology.MetricSpace.Lipschitz + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem lipschitzWith_of_unit_range_near_nonzero {X : Type*} [PseudoMetricSpace X] + (f : X → ℝ) (C L : ℝ≥0) (hzero : ∀ x, 0 ≤ f x) (hone : ∀ x, f x ≤ 1) + (hnear : ∀ x y, f x ≠ 0 → (C : ℝ) * dist x y < 1 → + |f x - f y| ≤ (L : ℝ) * dist x y) : + LipschitzWith (max C L) f := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Real.dist_eq] + by_cases hclose : (C : ℝ) * dist x y < 1 + · have hxy : |f x - f y| ≤ (L : ℝ) * dist x y := by + by_cases hx : f x = 0 + · by_cases hy : f y = 0 + · rw [hx, hy, sub_self, abs_zero] + positivity + · have h := hnear y x hy (by simpa only [dist_comm] using hclose) + simpa only [abs_sub_comm, dist_comm] using h + · exact hnear x y hx hclose + exact hxy.trans (mul_le_mul_of_nonneg_right (by exact_mod_cast le_max_right C L) dist_nonneg) + · have hxy : |f x - f y| ≤ 1 := abs_le.mpr ⟨by linarith [hzero x, hone y], by linarith [hone x, hzero y]⟩ + exact hxy.trans ((le_of_not_gt hclose).trans + (mul_le_mul_of_nonneg_right (by exact_mod_cast le_max_left C L) dist_nonneg)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitTestClipping.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitTestClipping.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2ad31967db9d7482ea5418f517efbd3614c4c2b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitTestClipping.lean @@ -0,0 +1,61 @@ +import Mathlib.MeasureTheory.Function.ContinuousMapDense +import Mathlib.MeasureTheory.Measure.Regular + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +def unitTestClip (x : ℝ) : ℝ := max (-1) (min 1 x) + +theorem unitTestClip_continuous : Continuous unitTestClip := + continuous_const.max (continuous_const.min continuous_id) + +theorem unitTestClip_mem (x : ℝ) : unitTestClip x ∈ Set.Icc (-1 : ℝ) 1 := by + exact ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩ + +theorem unitTestClip_zero : unitTestClip 0 = 0 := by norm_num [unitTestClip] + +theorem unitTestClip_error {x : ℝ} (hx : |x| ≤ 1) (y : ℝ) : + |x - unitTestClip y| ≤ |x - y| := by + have hx' := abs_le.mp hx + by_cases hy : y ≤ -1 + · have hmin : min 1 y = y := min_eq_right (by linarith) + rw [unitTestClip, hmin, max_eq_left hy, + abs_of_nonneg (by linarith : 0 ≤ x - -1), abs_of_nonneg (by linarith : 0 ≤ x - y)] + linarith + · by_cases hy' : 1 ≤ y + · rw [unitTestClip, min_eq_left hy', max_eq_right (by norm_num : (-1 : ℝ) ≤ 1), + abs_of_nonpos (by linarith : x - 1 ≤ 0), abs_of_nonpos (by linarith : x - y ≤ 0)] + linarith + · rw [unitTestClip, min_eq_right (le_of_not_ge hy'), max_eq_right (le_of_not_ge hy)] + +theorem exists_continuous_unit_test_l1 {X : Type*} [TopologicalSpace X] [NormalSpace X] + [MeasurableSpace X] [BorelSpace X] [R1Space X] [WeaklyLocallyCompactSpace X] + (μ : Measure X) [IsFiniteMeasure μ] [μ.Regular] (f : X → ℝ) + (hf : Measurable f) (hbound : ∀ x, ‖f x‖ ≤ 1) {ε : ℝ} (hε : 0 < ε) : + ∃ g : X → ℝ, Continuous g ∧ HasCompactSupport g ∧ (∀ x, ‖g x‖ ≤ 1) ∧ + Integrable g μ ∧ (∫ x, ‖f x - g x‖ ∂μ) ≤ ε := by + have hfi : Integrable f μ := (integrable_const (1 : ℝ)).mono' hf.aestronglyMeasurable + (Filter.Eventually.of_forall hbound) + obtain ⟨u, hus, herr, huc, hui⟩ := hfi.exists_hasCompactSupport_integral_sub_le hε + let g := fun x => unitTestClip (u x) + have hgc : Continuous g := unitTestClip_continuous.comp huc + have hgb : ∀ x, ‖g x‖ ≤ 1 := fun x => by + rw [Real.norm_eq_abs, abs_le] + exact unitTestClip_mem (u x) + have hgi : Integrable g μ := (integrable_const (1 : ℝ)).mono' hgc.aestronglyMeasurable + (Filter.Eventually.of_forall hgb) + refine ⟨g, hgc, hus.comp_left unitTestClip_zero, hgb, hgi, ?_⟩ + apply (integral_mono (hfi.sub hgi).norm (hfi.sub hui).norm ?_).trans herr + intro x + exact unitTestClip_error (by simpa only [Real.norm_eq_abs] using hbound x) (u x) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalCyclicDifference.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalCyclicDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7c4740129b33159fadad5452ef00d29ed259fff --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalCyclicDifference.lean @@ -0,0 +1,886 @@ +import OAI.Combinatorics.Progressions.Estimates.DiagonalWrapComparison +import OAI.Combinatorics.Progressions.Polynomial.BoundedRootDegreeEquivalence + +namespace OAI + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators + +theorem exists_explicit_quadratic_root_equivalence : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p), + NativeIntegerVectorEquivalence 1 ((p + C) ^ C) W.eval + (tensorVector ((W.rationalDilation (1 / 2)).tensorPower 2).eval 2) := by + have hsum : (∑ i, mixedCorrelationDegree 1 i) = 2 := by decide + have hpos : 1 ≤ ∑ i, mixedCorrelationDegree 1 i := by rw [hsum]; norm_num + obtain ⟨A, _, hdilation⟩ := exists_dilation_degree_equivalence (mixedCorrelationDegree 1) hpos 2 + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((X + Polynomial.C A) ^ A + 6 * (X + 1) + X + 2) + refine ⟨C, hC, ?_⟩ + intro p W + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + have hA : 0 ≤ (p + A) ^ A := by positivity + have hbound : (p + A) ^ A + 6 * (p + 1) + p + 2 ≤ (p + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget p hp + have hpr : p ≤ (p + C) ^ C := by linarith + have hAr : (p + A) ^ A ≤ (p + C) ^ C := by linarith + have hdimBound : 2 * tensorPowerBudget 2 p ≤ (p + C) ^ C := by + norm_num [tensorPowerBudget] + linarith + let V := W.rationalDilation (1 / 2) + let R := V.tensorPower 2 + have hleft (i : Fin W.outputDim) (x : Fin 2 → ℤ) : + W.eval i x = integerDilationVector V.eval 2 i x := + (W.rationalDilation_eval_rescaled (1 / 2) 2 (by norm_num) i x).symm + have hright (b : Fin 2 → Fin R.outputDim) (x : Fin 2 → ℤ) : + tensorVector R.eval 2 b x = + signedTensorVector V.eval ((2 : ℤ) ^ ∑ j, mixedCorrelationDegree 1 j) + (rootTensorIndex W.outputDim 2 (∑ j, mixedCorrelationDegree 1 j) hpos b) x := by + exact V.tensorPower_tensor_eval 2 (∑ j, mixedCorrelationDegree 1 j) hpos b x + have hdim : (Fintype.card (Fin 2 → Fin R.outputDim) : ℝ) ≤ Real.exp ((p + C) ^ C) := by + simp only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] + calc + _ ≤ Real.exp (tensorPowerBudget 2 p) ^ 2 := + pow_le_pow_left₀ (Nat.cast_nonneg _) R.output_bound _ + _ = Real.exp (2 * tensorPowerBudget 2 p) := by + simpa only [Nat.cast_ofNat] using (Real.exp_nat_mul (tensorPowerBudget 2 p) 2).symm + _ ≤ _ := Real.exp_le_exp.mpr hdimBound + have E := (hdilation V).of_coordinate_maps W.eval (tensorVector R.eval 2) id + (rootTensorIndex W.outputDim 2 (∑ j, mixedCorrelationDegree 1 j) hpos) hleft hright + (by simpa only [Fintype.card_fin] using W.output_bound.trans (Real.exp_le_exp.mpr hpr)) hdim hAr + simpa only [hsum, Nat.reduceSub] using E + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem norm_unit_vector_exchange_error {I : Type*} [Fintype I] + (v : I → ℂ) (hv : ∑ i, ‖v i‖ ^ 2 = 1) (hcap : ∀ i, ‖v i‖ ≤ 1) + (a : ℂ) (g : I → ℂ) : + ‖a - ∑ i, v i * star (g i)‖ ≤ ∑ i, ‖star a * v i - g i‖ := by + have hsum : (∑ i, v i * star (star a * v i)) = a := by + calc + _ = ∑ i, (a * star (v i)) * v i := by + apply Finset.sum_congr rfl + intro i _ + simp only [star_mul, star_star] + ring + _ = a := (complex_unit_vector_resolution v hv a).symm + have heq : a - ∑ i, v i * star (g i) = ∑ i, v i * star (star a * v i - g i) := by + simp only [star_sub, mul_sub, Finset.sum_sub_distrib, hsum] + rw [heq] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro i _ + rw [norm_mul, norm_star] + exact mul_le_of_le_one_left (norm_nonneg _) (hcap i) + +namespace NativeMultidegreeNilcharacter + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + +noncomputable def quadraticSquareTriple (a : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) + (x : Fin 2 → ℤ) : ℂ := + star ((W.eval a.1 (correlationInput (x 0) (x 1)) * + W.eval a.2.1 (correlationInput (x 0) (x 1))) * W.eval a.2.2 (fun _ => x 0)) + +noncomputable def diagonalSquareCorrection + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) + (a : Fin W.outputDim × Fin W.outputDim) + (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) (x : Fin 2 → ℤ) : ℂ := + ∑ j, (W.quadraticDiagonalDerivative a x * star (W.quadraticMixedTriple (j, b.2) x)) * + star (G b.1 j x) + +theorem diagonalSquareCorrection_norm {N : ℕ} [NeZero N] + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) + (hG : ∀ a b (x : Fin 2 → ZMod N), ‖G a b (fun z => ((x z).val : ℤ))‖ ≤ 1) + (a : Fin W.outputDim × Fin W.outputDim) + (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) (x : Fin 2 → ZMod N) : + ‖W.diagonalSquareCorrection G a b (fun z => ((x z).val : ℤ))‖ ≤ W.outputDim := by + unfold diagonalSquareCorrection + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ _j : Fin W.outputDim, (1 : ℝ) := by + apply Finset.sum_le_sum + intro j _ + simp only [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + ((mul_le_of_le_one_left (norm_nonneg _) (W.quadraticDiagonalDerivative_norm a _)).trans + (W.quadraticMixedTriple_norm _ _))).trans (hG b.1 j x) + _ = _ := by simp + +theorem diagonalSquareCorrection_mean_error {N : ℕ} [NeZero N] {ε : ℝ} + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) + (herr : ∀ a b, (𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel a b ((x 0).val : ℤ) ((x 1).val : ℤ) - + G a b (fun z => ((x z).val : ℤ))‖) ≤ ε) + (a : Fin W.outputDim × Fin W.outputDim) + (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) : + (𝔼 x : Fin 2 → ZMod N, + ‖W.quadraticDiagonalDerivative a (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + W.diagonalSquareCorrection G a b (fun z => ((x z).val : ℤ))‖) ≤ W.outputDim * ε := by + have hpoint (x : Fin 2 → ZMod N) : + ‖W.quadraticDiagonalDerivative a (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + W.diagonalSquareCorrection G a b (fun z => ((x z).val : ℤ))‖ ≤ + ∑ j, ‖W.antisymmetricKernel b.1 j ((x 0).val : ℤ) ((x 1).val : ℤ) - + G b.1 j (fun z => ((x z).val : ℤ))‖ := by + let z := fun i => ((x i).val : ℤ) + let c := (W.quadraticDiagonalDerivative a z * W.eval b.2.1 (correlationInput (z 0) (z 1))) * + W.eval b.2.2 (fun _ => z 0) + have hc : ‖c‖ ≤ 1 := by + simp only [c, norm_mul] + exact (mul_le_of_le_one_left (norm_nonneg _) + ((mul_le_of_le_one_left (norm_nonneg _) (W.quadraticDiagonalDerivative_norm a z)).trans + (W.norm_eval _ _))).trans (W.norm_eval _ _) + have htarget : W.quadraticDiagonalDerivative a z * star (W.quadraticSquareTriple b z) = + c * W.eval b.1 (correlationInput (z 0) (z 1)) := by + simp only [quadraticSquareTriple, star_star, c] + ring + have hsum : W.diagonalSquareCorrection G a b z = + c * ∑ j, W.eval j (correlationInput (z 1) (z 0)) * star (G b.1 j z) := by + unfold diagonalSquareCorrection + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + simp only [quadraticMixedTriple, star_star, c] + ring + change ‖W.quadraticDiagonalDerivative a z * star (W.quadraticSquareTriple b z) - + W.diagonalSquareCorrection G a b z‖ ≤ _ + rw [htarget, hsum, ← mul_sub, norm_mul] + apply (mul_le_of_le_one_left (norm_nonneg _) hc).trans + exact norm_unit_vector_exchange_error + (fun j => W.eval j (correlationInput (z 1) (z 0))) (W.unit_eval _) (fun j => W.norm_eval j _) + (W.eval b.1 (correlationInput (z 0) (z 1))) (fun j => G b.1 j z) + calc + _ ≤ 𝔼 x : Fin 2 → ZMod N, + ∑ j, ‖W.antisymmetricKernel b.1 j ((x 0).val : ℤ) ((x 1).val : ℤ) - + G b.1 j (fun z => ((x z).val : ℤ))‖ := Finset.expect_le_expect (fun x _ => hpoint x) + _ = ∑ j, 𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel b.1 j ((x 0).val : ℤ) ((x 1).val : ℤ) - + G b.1 j (fun z => ((x z).val : ℤ))‖ := Finset.expect_sum_comm _ _ _ + _ ≤ ∑ _j : Fin W.outputDim, ε := Finset.sum_le_sum (fun j _ => herr b.1 j) + _ = _ := by simp + +theorem exists_quadratic_diagonal_square_comparison : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q ε : ℝ} {N : ℕ} [NeZero N] + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ), + 0 ≤ q → + (∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 q (G a b))) → + (∀ a b (x : Fin 2 → ZMod N), ‖G a b (fun z => ((x z).val : ℤ))‖ ≤ 1) → + (∀ a b, (𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel a b ((x 0).val : ℤ) ((x 1).val : ℤ) - + G a b (fun z => ((x z).val : ℤ))‖) ≤ ε) → + ∃ F : (Fin W.outputDim × Fin W.outputDim) → + (Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) → (Fin 2 → ℤ) → ℂ, + (∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 + ((p + q + C) ^ C) (F a b))) ∧ + (∀ a b (x : Fin 2 → ZMod N), ‖F a b (fun z => ((x z).val : ℤ))‖ ≤ W.outputDim) ∧ + (∀ a b, (𝔼 x : Fin 2 → ZMod N, + ‖W.quadraticDiagonalDerivative a (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + F a b (fun z => ((x z).val : ℤ))‖) ≤ W.outputDim * ε) := by + obtain ⟨A, _, hdiag⟩ := exists_quadratic_diagonal_derivative_equivalence + obtain ⟨B, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let R := (X + Polynomial.C A) ^ A + X + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((R + Polynomial.C B) ^ B + X) + refine ⟨C, hC, ?_⟩ + intro p q ε N _ W G hq hG hcap herr + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let v := p + q + let r := (v + A) ^ A + v + 2 + have hv : 0 ≤ v := add_nonneg hp hq + have hr : 0 ≤ r := by dsimp [r]; positivity + have hqr : q ≤ r := by + have : 0 ≤ (v + A) ^ A := by positivity + dsimp [r, v] + linarith + have hAr : (p + A) ^ A ≤ r := by + calc + _ ≤ (v + A) ^ A := pow_le_pow_left₀ (by positivity) (by dsimp [v]; linarith) A + _ ≤ r := by dsimp [r]; linarith + have hcost : (r + B) ^ B + p ≤ (p + q + C) ^ C := by + have hh : (r + B) ^ B + v ≤ (p + q + C) ^ C := by + simpa [X, R, r, v, Polynomial.eval₂_pow] using hbudget v hv + dsimp [v] at hh + linarith + have hdim : (Fintype.card (Fin W.outputDim) : ℝ) ≤ Real.exp p := by + simpa only [Fintype.card_fin] using W.output_bound + have hcoeff : (∑ _j : Fin W.outputDim, ‖(1 : ℂ)‖) ≤ Real.exp p := by simpa using hdim + have hterm (a : Fin W.outputDim × Fin W.outputDim) + (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) (j : Fin W.outputDim) : + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((r + B) ^ B) + (fun x => (W.quadraticDiagonalDerivative a x * star (W.quadraticMixedTriple (j, b.2) x)) * + star (G b.1 j x))) := + hmul hr ((Classical.choice ((hdiag W).expansion a (j, b.2))).mono hAr) + ((Classical.choice (hG b.1 j)).conjugate.mono hqr) + refine ⟨W.diagonalSquareCorrection G, ?_, W.diagonalSquareCorrection_norm G hcap, + W.diagonalSquareCorrection_mean_error G herr⟩ + intro a b + have E := (NativeIntegerExpansion.weightedSum (fun j => Classical.choice (hterm a b j)) + (fun _ => (1 : ℂ)) hp hdim hcoeff).mono hcost + change Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + q + C) ^ C) + (fun x => ∑ j, (W.quadraticDiagonalDerivative a x * star (W.quadraticMixedTriple (j, b.2) x)) * + star (G b.1 j x))) + exact ⟨by simpa only [one_mul] using E⟩ + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem norm_smoothed_branch_error (c w : ℝ) (hw : 0 ≤ w ∧ w ≤ 1) + (a b u v : ℂ) (ha : ‖a‖ ≤ 1) (hb : ‖b‖ ≤ 1) : + ‖((1 - c : ℝ) : ℂ) * a + (c : ℂ) * b - + (((1 - w : ℝ) : ℂ) * u + (w : ℂ) * v)‖ ≤ + ‖a - u‖ + ‖b - v‖ + 2 * |c - w| := by + have heq : ((1 - c : ℝ) : ℂ) * a + (c : ℂ) * b - + (((1 - w : ℝ) : ℂ) * u + (w : ℂ) * v) = + (((1 - w : ℝ) : ℂ) * (a - u) + (w : ℂ) * (b - v)) + + ((c - w : ℝ) : ℂ) * (b - a) := by push_cast; ring + have hba : ‖b - a‖ ≤ 2 := (norm_sub_le _ _).trans (by linarith) + rw [heq] + calc + _ ≤ ‖((1 - w : ℝ) : ℂ) * (a - u)‖ + ‖(w : ℂ) * (b - v)‖ + + ‖((c - w : ℝ) : ℂ) * (b - a)‖ := + (norm_add_le _ _).trans (add_le_add (norm_add_le _ _) le_rfl) + _ = (1 - w) * ‖a - u‖ + w * ‖b - v‖ + |c - w| * ‖b - a‖ := by + simp only [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (by linarith : 0 ≤ 1 - w), abs_of_nonneg hw.1] + _ ≤ ‖a - u‖ + ‖b - v‖ + |c - w| * 2 := + add_le_add (add_le_add (mul_le_of_le_one_left (norm_nonneg _) (by linarith)) + (mul_le_of_le_one_left (norm_nonneg _) hw.2)) + (mul_le_mul_of_nonneg_left hba (abs_nonneg _)) + _ = _ := by ring + +namespace NativeMultidegreeNilcharacter + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + +theorem quadraticSquareTriple_norm (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) + (x : Fin 2 → ℤ) : ‖W.quadraticSquareTriple b x‖ ≤ 1 := by + simp only [quadraticSquareTriple, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + ((mul_le_of_le_one_left (norm_nonneg _) (W.norm_eval _ _)).trans + (W.norm_eval _ _))).trans (W.norm_eval _ _) + +noncomputable def wrappedDiagonalCorrection (N : ℕ) + (F : (Fin W.outputDim × Fin W.outputDim) → + (Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) → (Fin 2 → ℤ) → ℂ) + (a : Fin W.outputDim × Fin W.outputDim) + (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) (x : Fin 2 → ℤ) : ℂ := + ∑ k, W.diagonalWrapCoefficient N a.2 k x * F (a.1, k) b x + +noncomputable def cyclicDiagonalCorrection (N : ℕ) (δ : ℝ≥0) + (F : (Fin W.outputDim × Fin W.outputDim) → + (Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) → (Fin 2 → ℤ) → ℂ) + (a : Fin W.outputDim × Fin W.outputDim) + (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) (x : Fin 2 → ℤ) : ℂ := + (1 - (smoothCyclicCarry N δ x : ℂ)) * F a b x + + (smoothCyclicCarry N δ x : ℂ) * W.wrappedDiagonalCorrection N F a b x + +theorem wrappedDiagonalCorrection_mean_error {N : ℕ} [NeZero N] {ε : ℝ} + (F : (Fin W.outputDim × Fin W.outputDim) → + (Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) → (Fin 2 → ℤ) → ℂ) + (herr : ∀ a b, (𝔼 x : Fin 2 → ZMod N, + ‖W.quadraticDiagonalDerivative a (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + F a b (fun z => ((x z).val : ℤ))‖) ≤ ε) + (a : Fin W.outputDim × Fin W.outputDim) + (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) : + (𝔼 x : Fin 2 → ZMod N, + ‖W.wrappedDiagonalDerivative N a (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + W.wrappedDiagonalCorrection N F a b (fun z => ((x z).val : ℤ))‖) ≤ W.outputDim * ε := by + have hpoint (x : Fin 2 → ℤ) : + ‖W.wrappedDiagonalDerivative N a x * star (W.quadraticSquareTriple b x) - + W.wrappedDiagonalCorrection N F a b x‖ ≤ + ∑ k, ‖W.quadraticDiagonalDerivative (a.1, k) x * star (W.quadraticSquareTriple b x) - + F (a.1, k) b x‖ := by + have heq : W.wrappedDiagonalDerivative N a x * star (W.quadraticSquareTriple b x) - + W.wrappedDiagonalCorrection N F a b x = + ∑ k, W.diagonalWrapCoefficient N a.2 k x * + (W.quadraticDiagonalDerivative (a.1, k) x * star (W.quadraticSquareTriple b x) - + F (a.1, k) b x) := by + rw [W.wrappedDiagonalDerivative_resolution, Finset.sum_mul] + simp only [wrappedDiagonalCorrection, mul_sub, Finset.sum_sub_distrib, mul_assoc] + rw [heq] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro k _ + rw [norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (W.diagonalWrapCoefficient_norm N a.2 k x) + calc + _ ≤ 𝔼 x : Fin 2 → ZMod N, + ∑ k, ‖W.quadraticDiagonalDerivative (a.1, k) (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + F (a.1, k) b (fun z => ((x z).val : ℤ))‖ := + Finset.expect_le_expect (fun x _ => hpoint _) + _ = ∑ k, 𝔼 x : Fin 2 → ZMod N, + ‖W.quadraticDiagonalDerivative (a.1, k) (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + F (a.1, k) b (fun z => ((x z).val : ℤ))‖ := Finset.expect_sum_comm _ _ _ + _ ≤ ∑ _k : Fin W.outputDim, ε := Finset.sum_le_sum (fun k _ => herr (a.1, k) b) + _ = _ := by simp + +theorem cyclicDiagonalCorrection_mean_error {N : ℕ} [NeZero N] {ε : ℝ} + (δ : ℝ≥0) (hδ : 0 < δ) + (F : (Fin W.outputDim × Fin W.outputDim) → + (Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) → (Fin 2 → ℤ) → ℂ) + (herr : ∀ a b, (𝔼 x : Fin 2 → ZMod N, + ‖W.quadraticDiagonalDerivative a (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + F a b (fun z => ((x z).val : ℤ))‖) ≤ ε) + (a : Fin W.outputDim × Fin W.outputDim) + (b : Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) : + (𝔼 x : Fin 2 → ZMod N, + ‖W.cyclicDiagonalDerivative a x * star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ))) - + W.cyclicDiagonalCorrection N δ F a b (fun z => ((x z).val : ℤ))‖) ≤ + (W.outputDim + 1) * ε + 12 * (δ : ℝ) + 2 / N := by + have hpoint (x : Fin 2 → ZMod N) := norm_smoothed_branch_error + (cyclicCarry (x 0) (x 1)) (smoothCyclicCarry N δ (fun z => ((x z).val : ℤ))) + (circleCarryCutoff_range δ _) + (W.quadraticDiagonalDerivative a (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ)))) + (W.wrappedDiagonalDerivative N a (fun z => ((x z).val : ℤ)) * + star (W.quadraticSquareTriple b (fun z => ((x z).val : ℤ)))) + (F a b (fun z => ((x z).val : ℤ))) + (W.wrappedDiagonalCorrection N F a b (fun z => ((x z).val : ℤ))) + (by + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + (W.quadraticDiagonalDerivative_norm a _)).trans (W.quadraticSquareTriple_norm b _)) + (by + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + (W.wrappedDiagonalDerivative_norm N a _)).trans (W.quadraticSquareTriple_norm b _)) + have hm := Finset.expect_le_expect (s := Finset.univ) (fun x _ => hpoint x) + simp only [Complex.ofReal_sub, Complex.ofReal_one, ← mul_assoc, ← add_mul, + ← W.cyclicDiagonalDerivative_branches] at hm + simp only [Finset.expect_add_distrib, ← Finset.mul_expect] at hm + have hi := herr a b + have hw := W.wrappedDiagonalCorrection_mean_error F herr a b + have hc := smoothCyclicCarry_mean_error (N := N) δ hδ + dsimp only [cyclicDiagonalCorrection] + exact hm.trans ((add_le_add (add_le_add hi hw) + (mul_le_mul_of_nonneg_left hc (by norm_num : (0 : ℝ) ≤ 2))).trans_eq (by ring)) + +theorem exists_cyclicDiagonalCorrection_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q e : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) (N : ℕ) + (δ : ℝ≥0), 0 < δ → 0 ≤ q → 0 ≤ e → (δ : ℝ)⁻¹ ≤ Real.exp e → + ∀ F : (Fin W.outputDim × Fin W.outputDim) → + (Fin W.outputDim × Fin W.outputDim × Fin W.outputDim) → (Fin 2 → ℤ) → ℂ, + (∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 q (F a b))) → + ∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 + ((p + q + e + C) ^ C) (W.cyclicDiagonalCorrection N δ F a b)) := by + obtain ⟨A, _, hwrap⟩ := exists_diagonalWrapCoefficient_expansion + obtain ⟨B, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let R := (X + Polynomial.C A) ^ A + X + 6 + let T := (R + Polynomial.C B) ^ B + X + R + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((T + Polynomial.C B) ^ B + T + 2) + refine ⟨C, hC, ?_⟩ + intro p q e W N δ hδ hq he hinv F hF a b + classical + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let v := p + q + e + let r := (v + A) ^ A + v + 6 + let t := (r + B) ^ B + v + r + 2 + let d := (t + B) ^ B + t + have hv : 0 ≤ v := by dsimp [v]; positivity + have hr : 0 ≤ r := by dsimp [r]; positivity + have ht : 0 ≤ t := by dsimp [t]; positivity + have har : (p + A) ^ A ≤ r := by + calc + _ ≤ (v + A) ^ A := pow_le_pow_left₀ (by positivity) (by dsimp [v]; linarith) A + _ ≤ r := by dsimp [r]; linarith + have hqr : q ≤ r := by + have : 0 ≤ (v + A) ^ A := by positivity + dsimp [r, v] + linarith + have her : e + 4 ≤ r := by + have : 0 ≤ (v + A) ^ A := by positivity + dsimp [r, v] + linarith + have hrt : r ≤ t := by + have : 0 ≤ (r + B) ^ B := by positivity + dsimp [t] + linarith + have hwt : (r + B) ^ B + p ≤ t := by dsimp [t, v]; linarith + have htd : t ≤ d := le_add_of_nonneg_left (by positivity) + have hpd : (t + B) ^ B ≤ d := le_add_of_nonneg_right ht + have hcost : d + 2 ≤ (p + q + e + C) ^ C := by + simpa [X, R, T, r, t, d, v, Polynomial.eval₂_pow] using hbudget v hv + have hdim : (Fintype.card (Fin W.outputDim) : ℝ) ≤ Real.exp p := by + simpa only [Fintype.card_fin] using W.output_bound + have hcoeff : (∑ _k : Fin W.outputDim, ‖(1 : ℂ)‖) ≤ Real.exp p := by simpa using hdim + have hterms (k : Fin W.outputDim) := hmul hr + ((Classical.choice (hwrap W N a.2 k)).mono har) ((Classical.choice (hF (a.1, k) b)).mono hqr) + have EW : NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 t + (W.wrappedDiagonalCorrection N F a b) := by + have E := (NativeIntegerExpansion.weightedSum (fun k => Classical.choice (hterms k)) + (fun _ => (1 : ℂ)) hp hdim hcoeff).mono hwt + change NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 t + (fun x => ∑ k, W.diagonalWrapCoefficient N a.2 k x * F (a.1, k) b x) + simpa only [one_mul] using E + let w := fun x => (smoothCyclicCarry N δ x : ℂ) + have EC := (Classical.choice (exists_smoothCyclicCarry_expansion N δ hδ he hinv)).mono (her.trans hrt) + have E₀ := (Classical.choice (hF a b)).mono (hqr.trans (hrt.trans htd)) + have E₁ := (Classical.choice (hmul ht EC EW)).mono hpd + have E₂ := (Classical.choice (hmul ht EC ((Classical.choice (hF a b)).mono (hqr.trans hrt)))).mono hpd + let fs : Fin 3 → (Fin 2 → ℤ) → ℂ := ![F a b, + (fun x => w x * W.wrappedDiagonalCorrection N F a b x), (fun x => w x * F a b x)] + have Efs (j : Fin 3) : Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 d (fs j)) := by + fin_cases j + · exact ⟨E₀⟩ + · exact ⟨E₁⟩ + · exact ⟨E₂⟩ + let cs : Fin 3 → ℂ := ![1, 1, -1] + have hthree : (3 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have E := (NativeIntegerExpansion.weightedSum (fun j => Classical.choice (Efs j)) cs + (by norm_num : (0 : ℝ) ≤ 2) (by simpa using hthree) + (by convert hthree using 1; norm_num [cs, Fin.sum_univ_succ])).mono hcost + have heq : (fun x => ∑ j, cs j * fs j x) = W.cyclicDiagonalCorrection N δ F a b := by + funext x + simp [cs, fs, Fin.sum_univ_succ, w, cyclicDiagonalCorrection] + ring + exact ⟨heq ▸ E⟩ + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +noncomputable def integerSecondDifference (u v : (Fin 2 → ℤ) → ℂ) (k : ℤ) + (x : Fin 2 → ℤ) : ℂ := u x * star (v ![x 0, x 1 + k]) + +noncomputable def cyclicSecondDifference {N : ℕ} (u v : (Fin 2 → ℤ) → ℂ) + (k : ZMod N) (h : ℤ) (n : ZMod N) : ℂ := + u ![h, (n.val : ℤ)] * star (v ![h, ((n + k).val : ℤ)]) + +noncomputable def smoothedSecondDifference (N : ℕ) (δ : ℝ≥0) + (u v : (Fin 2 → ℤ) → ℂ) (k : ℤ) (x : Fin 2 → ℤ) : ℂ := + (1 - (smoothCyclicCarry N δ ![k, x 1] : ℂ)) * integerSecondDifference u v k x + + (smoothCyclicCarry N δ ![k, x 1] : ℂ) * integerSecondDifference u v (k - N) x + +theorem integerSecondDifference_norm (u v : (Fin 2 → ℤ) → ℂ) + (hu : ∀ x, ‖u x‖ ≤ 1) (hv : ∀ x, ‖v x‖ ≤ 1) (k : ℤ) (x : Fin 2 → ℤ) : + ‖integerSecondDifference u v k x‖ ≤ 1 := by + rw [integerSecondDifference, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hu _)).trans (hv _) + +theorem cyclicSecondDifference_branches {N : ℕ} [NeZero N] + (u v : (Fin 2 → ℤ) → ℂ) (k : ZMod N) (h : ℤ) (n : ZMod N) : + cyclicSecondDifference u v k h n = + (1 - (cyclicCarry k n : ℂ)) * integerSecondDifference u v k.val ![h, (n.val : ℤ)] + + (cyclicCarry k n : ℂ) * integerSecondDifference u v ((k.val : ℤ) - N) ![h, (n.val : ℤ)] := by + have hval : ((n + k).val : ℤ) = (n.val : ℤ) + k.val - + if N - k.val ≤ n.val then (N : ℤ) else 0 := by + simpa only [add_comm n k] using cyclic_representative_add k n + have hk := k.val_lt + by_cases hw : N ≤ k.val + n.val + · have hcut : N - k.val ≤ n.val := by omega + simp only [cyclicCarry, hw, ite_true, Complex.ofReal_one, sub_self, zero_mul, one_mul, zero_add, + cyclicSecondDifference, integerSecondDifference, Matrix.cons_val_zero, Matrix.cons_val_one, + hval, ite_eq_left hcut] + rw [add_sub_assoc] + · have hcut : ¬N - k.val ≤ n.val := by omega + simp only [cyclicCarry, hw, ite_false, Complex.ofReal_zero, sub_zero, zero_mul, one_mul, add_zero, + cyclicSecondDifference, integerSecondDifference, Matrix.cons_val_zero, Matrix.cons_val_one, + hval, ite_eq_right hcut] + +theorem smoothedSecondDifference_mean_error {N : ℕ} [NeZero N] + (δ : ℝ≥0) (hδ : 0 < δ) (u v : (Fin 2 → ℤ) → ℂ) + (hu : ∀ x, ‖u x‖ ≤ 1) (hv : ∀ x, ‖v x‖ ≤ 1) (k : ZMod N) (h : ℤ) : + (𝔼 n : ZMod N, ‖cyclicSecondDifference u v k h n - + smoothedSecondDifference N δ u v k.val ![h, (n.val : ℤ)]‖) ≤ + 12 * (δ : ℝ) + 2 / N := by + have hp (n : ZMod N) : ‖cyclicSecondDifference u v k h n - + smoothedSecondDifference N δ u v k.val ![h, (n.val : ℤ)]‖ ≤ + 2 * |cyclicCarry k n - smoothCyclicCarry N δ ![(k.val : ℤ), (n.val : ℤ)]| := by + have hh := norm_smoothed_branch_error (cyclicCarry k n) + (smoothCyclicCarry N δ ![(k.val : ℤ), (n.val : ℤ)]) (circleCarryCutoff_range δ _) + (integerSecondDifference u v k.val ![h, (n.val : ℤ)]) + (integerSecondDifference u v ((k.val : ℤ) - N) ![h, (n.val : ℤ)]) + (integerSecondDifference u v k.val ![h, (n.val : ℤ)]) + (integerSecondDifference u v ((k.val : ℤ) - N) ![h, (n.val : ℤ)]) + (integerSecondDifference_norm u v hu hv _ _) + (integerSecondDifference_norm u v hu hv _ _) + simpa only [Complex.ofReal_sub, Complex.ofReal_one, sub_self, norm_zero, zero_add, + ← cyclicSecondDifference_branches, smoothedSecondDifference, Matrix.cons_val_one, + Matrix.cons_val_zero] using hh + calc + _ ≤ 𝔼 n : ZMod N, + 2 * |cyclicCarry k n - smoothCyclicCarry N δ ![(k.val : ℤ), (n.val : ℤ)]| := + Finset.expect_le_expect (fun n _ => hp n) + _ = 2 * (𝔼 n : ZMod N, + |cyclicCarry k n - smoothCyclicCarry N δ ![(k.val : ℤ), (n.val : ℤ)]|) := + (Finset.mul_expect _ _ _).symm + _ ≤ 2 * (6 * (δ : ℝ) + 1 / N) := + mul_le_mul_of_nonneg_left (smoothCyclicCarry_fixed_shift_mean_error δ hδ k) (by norm_num) + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators NNReal + +theorem exists_diagonalSquareCorrection_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p), 0 ≤ q → + ∀ G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ, + (∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 q (G a b))) → + ∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 + ((p + q + C) ^ C) (W.diagonalSquareCorrection G a b)) := by + obtain ⟨A, _, hdiag⟩ := exists_quadratic_diagonal_derivative_equivalence + obtain ⟨B, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let R := (X + Polynomial.C A) ^ A + X + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((R + Polynomial.C B) ^ B + X) + refine ⟨C, hC, ?_⟩ + intro p q W hq G hG a b + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let v := p + q + let r := (v + A) ^ A + v + 2 + have hv : 0 ≤ v := add_nonneg hp hq + have hr : 0 ≤ r := by dsimp [r]; positivity + have hqr : q ≤ r := by + have : 0 ≤ (v + A) ^ A := by positivity + dsimp [r, v] + linarith + have hAr : (p + A) ^ A ≤ r := by + calc + _ ≤ (v + A) ^ A := pow_le_pow_left₀ (by positivity) (by dsimp [v]; linarith) A + _ ≤ r := by dsimp [r]; linarith + have hcost : (r + B) ^ B + p ≤ (p + q + C) ^ C := by + have hh : (r + B) ^ B + v ≤ (p + q + C) ^ C := by + simpa [X, R, r, v, Polynomial.eval₂_pow] using hbudget v hv + dsimp [v] at hh + linarith + have hdim : (Fintype.card (Fin W.outputDim) : ℝ) ≤ Real.exp p := by + simpa only [Fintype.card_fin] using W.output_bound + have hcoeff : (∑ _j : Fin W.outputDim, ‖(1 : ℂ)‖) ≤ Real.exp p := by simpa using hdim + have hterm (j : Fin W.outputDim) : + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((r + B) ^ B) + (fun x => (W.quadraticDiagonalDerivative a x * star (W.quadraticMixedTriple (j, b.2) x)) * + star (G b.1 j x))) := + hmul hr ((Classical.choice ((hdiag W).expansion a (j, b.2))).mono hAr) + ((Classical.choice (hG b.1 j)).conjugate.mono hqr) + have E := (NativeIntegerExpansion.weightedSum (fun j => Classical.choice (hterm j)) + (fun _ => (1 : ℂ)) hp hdim hcoeff).mono hcost + change Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + q + C) ^ C) + (fun x => ∑ j, (W.quadraticDiagonalDerivative a x * star (W.quadraticMixedTriple (j, b.2) x)) * + star (G b.1 j x))) + exact ⟨by simpa only [one_mul] using E⟩ + +theorem exists_cyclicExchangeCorrection_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q e : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) (N : ℕ) + (δ : ℝ≥0), 0 < δ → 0 ≤ q → 0 ≤ e → (δ : ℝ)⁻¹ ≤ Real.exp e → + ∀ G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ, + (∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 q (G a b))) → + ∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + q + e + C) ^ C) + (W.cyclicDiagonalCorrection N δ (W.diagonalSquareCorrection G) a b)) := by + obtain ⟨A, _, hdiag⟩ := exists_diagonalSquareCorrection_expansion + obtain ⟨B, _, hcyclic⟩ := exists_cyclicDiagonalCorrection_expansion + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((X + (X + Polynomial.C A) ^ A + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p q e W N δ hδ hq he hinv G hG a b + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + have hA : (p + q + A) ^ A ≤ (p + q + e + A) ^ A := + pow_le_pow_left₀ (by positivity) (by linarith) A + have hb : (p + (p + q + A) ^ A + e + B) ^ B ≤ (p + q + e + C) ^ C := by + have hh : (p + q + e + (p + q + e + A) ^ A + B) ^ B ≤ (p + q + e + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget (p + q + e) (by positivity) + apply le_trans _ hh + apply pow_le_pow_left₀ (by positivity) + linarith + obtain ⟨E⟩ := hcyclic W N δ hδ (by positivity : 0 ≤ (p + q + A) ^ A) he hinv + (W.diagonalSquareCorrection G) (hdiag W hq G hG) a b + exact ⟨E.mono hb⟩ + +theorem cyclicExchangeCorrection_mean_error {p ε : ℝ} {N : ℕ} [NeZero N] + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) (δ : ℝ≥0) (hδ : 0 < δ) + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) + (herr : ∀ a b, (𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel a b ((x 0).val : ℤ) ((x 1).val : ℤ) - + G a b (fun k => ((x k).val : ℤ))‖) ≤ ε) (a b) : + (𝔼 x : Fin 2 → ZMod N, + ‖W.cyclicDiagonalDerivative a x * star (W.quadraticSquareTriple b (fun k => ((x k).val : ℤ))) - + W.cyclicDiagonalCorrection N δ (W.diagonalSquareCorrection G) a b + (fun k => ((x k).val : ℤ))‖) ≤ + (W.outputDim + 1) * (W.outputDim * ε) + 12 * (δ : ℝ) + 2 / N := + W.cyclicDiagonalCorrection_mean_error δ hδ (W.diagonalSquareCorrection G) + (W.diagonalSquareCorrection_mean_error G herr) a b + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem exists_smoothedSecondDifference_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p e : ℝ}, 0 ≤ p → 0 ≤ e → + ∀ (N : ℕ) (δ : ℝ≥0), 0 < δ → (δ : ℝ)⁻¹ ≤ Real.exp e → + ∀ (u v : (Fin 2 → ℤ) → ℂ) (k : ℤ), + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 p (integerSecondDifference u v k)) → + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 p (integerSecondDifference u v (k - N))) → + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + e + C) ^ C) + (smoothedSecondDifference N δ u v k)) := by + obtain ⟨A, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let R := X + 4 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((R + Polynomial.C A) ^ A + R + 2) + refine ⟨C, hC, ?_⟩ + intro p e hp he N δ hδ hinv u v k ⟨E0⟩ ⟨E1⟩ + let r := p + e + 4 + let t := (r + A) ^ A + r + have hr : 0 ≤ r := by dsimp [r]; linarith + have hpr : p ≤ r := by dsimp [r]; linarith + have her : e + 4 ≤ r := by dsimp [r]; linarith + have hrt : r ≤ t := le_add_of_nonneg_left (by positivity) + have hmt : (r + A) ^ A ≤ t := le_add_of_nonneg_right hr + have htC : t + 2 ≤ (p + e + C) ^ C := by + simpa [X, R, r, t, Polynomial.eval₂_pow] using hbudget (p + e) (by linarith) + obtain ⟨EC⟩ := exists_fixed_shift_smoothCyclicCarry_expansion N δ hδ he hinv k + obtain ⟨EM0⟩ := hmul hr (EC.mono her) (E0.mono hpr) + obtain ⟨EM1⟩ := hmul hr (EC.mono her) (E1.mono hpr) + let w (x : Fin 2 → ℤ) := (smoothCyclicCarry N δ ![k, x 1] : ℂ) + let fs : Fin 3 → (Fin 2 → ℤ) → ℂ := ![integerSecondDifference u v k, + (fun x => w x * integerSecondDifference u v (k - N) x), + (fun x => w x * integerSecondDifference u v k x)] + have Efs (j : Fin 3) : Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 t (fs j)) := by + fin_cases j + · exact ⟨E0.mono (hpr.trans hrt)⟩ + · exact ⟨EM1.mono hmt⟩ + · exact ⟨EM0.mono hmt⟩ + let cs : Fin 3 → ℂ := ![1, 1, -1] + have hthree : (3 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have E := (NativeIntegerExpansion.weightedSum (fun j => Classical.choice (Efs j)) cs + (by norm_num : (0 : ℝ) ≤ 2) (by simpa using hthree) + (by convert hthree using 1; norm_num [cs, Fin.sum_univ_succ])).mono htC + have heq : (fun x => ∑ j, cs j * fs j x) = smoothedSecondDifference N δ u v k := by + funext x + simp [cs, fs, w, Fin.sum_univ_succ, smoothedSecondDifference] + ring + exact ⟨heq ▸ E⟩ + +theorem exists_cyclicSecondDifference_approximation : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p e : ℝ}, 0 ≤ p → 0 ≤ e → + ∀ {N : ℕ} [NeZero N], Real.exp (e + 16) ≤ (N : ℝ) → + ∀ (u v : (Fin 2 → ℤ) → ℂ), (∀ x, ‖u x‖ ≤ 1) → (∀ x, ‖v x‖ ≤ 1) → + (∀ k : ℤ, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 p + (integerSecondDifference u v k))) → + ∀ k : ZMod N, ∃ K : (Fin 2 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + e + C) ^ C) K) ∧ + ∀ h : ℤ, (𝔼 n : ZMod N, + ‖cyclicSecondDifference u v k h n - K ![h, (n.val : ℤ)]‖) ≤ Real.exp (-e) := by + obtain ⟨A, _, hexpand⟩ := exists_smoothedSecondDifference_expansion + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((X + 16 + Polynomial.C A) ^ A) + refine ⟨C, hC, ?_⟩ + intro p e hp he N _ hN u v hu hv hmodel k + let δ : ℝ≥0 := ⟨Real.exp (-(e + 16)), (Real.exp_pos _).le⟩ + have hδ : 0 < δ := Real.exp_pos _ + have hinv : (δ : ℝ)⁻¹ ≤ Real.exp (e + 16) := by + change (Real.exp (-(e + 16)))⁻¹ ≤ Real.exp (e + 16) + rw [← Real.exp_neg, neg_neg] + have hbudget' : (p + (e + 16) + A) ^ A ≤ (p + e + C) ^ C := by + have hb := hbudget (p + e) (by linarith) + simpa [X, Polynomial.eval₂_pow, add_assoc] using hb + obtain ⟨E⟩ := hexpand hp (by linarith : 0 ≤ e + 16) N δ hδ hinv u v k.val + (hmodel k.val) (hmodel ((k.val : ℤ) - N)) + refine ⟨smoothedSecondDifference N δ u v k.val, ⟨E.mono hbudget'⟩, ?_⟩ + intro h + apply (smoothedSecondDifference_mean_error δ hδ u v hu hv k h).trans + have hNinv : 1 / (N : ℝ) ≤ Real.exp (-(e + 16)) := by + have hh := one_div_le_one_div_of_le (Real.exp_pos (e + 16)) hN + simpa only [one_div, ← Real.exp_neg] using hh + have htwo : 2 / (N : ℝ) ≤ 2 * Real.exp (-(e + 16)) := by + calc + _ = 2 * (1 / (N : ℝ)) := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left hNinv (by norm_num) + calc + 12 * (δ : ℝ) + 2 / N ≤ 14 * Real.exp (-(e + 16)) := by + change 12 * Real.exp (-(e + 16)) + 2 / (N : ℝ) ≤ 14 * Real.exp (-(e + 16)) + linarith only [htwo] + _ ≤ Real.exp 16 * Real.exp (-(e + 16)) := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (16 : ℝ)]) (Real.exp_nonneg _) + _ = Real.exp (-e) := by rw [← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators NNReal + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + +noncomputable def quadraticRoot : + NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) (tensorPowerBudget 2 p) := + (W.rationalDilation (1 / 2)).tensorPower 2 + +noncomputable def rootExchangeCorrection + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) := + (W.rationalDilation (1 / 2)).tensorSquareExchangeCorrection (W.halfDilationExchangeCorrection G) + +noncomputable def rootCyclicCorrection (N : ℕ) (δ : ℝ≥0) + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) := + W.quadraticRoot.cyclicDiagonalCorrection N δ + (W.quadraticRoot.diagonalSquareCorrection (W.rootExchangeCorrection G)) + +theorem rootCyclicCorrection_mean_error {N : ℕ} [NeZero N] (δ : ℝ≥0) (hδ : 0 < δ) + (G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ) {ε : ℝ} + (hcap : ∀ i j (x : Fin 2 → ZMod N), ‖G i j (fun k => ((x k).val : ℤ))‖ ≤ 1) + (herr : ∀ i j, (𝔼 x : Fin 2 → ZMod N, + ‖W.antisymmetricKernel i j ((x 0).val : ℤ) ((x 1).val : ℤ) - + G i j (fun k => ((x k).val : ℤ))‖) ≤ ε) (a b) : + (𝔼 x : Fin 2 → ZMod N, + ‖W.quadraticRoot.cyclicDiagonalDerivative a x * + star (W.quadraticRoot.quadraticSquareTriple b (fun k => ((x k).val : ℤ))) - + W.rootCyclicCorrection N δ G a b (fun k => ((x k).val : ℤ))‖) ≤ + (W.quadraticRoot.outputDim + 1) * + (W.quadraticRoot.outputDim * ((1 + (W.outputDim : ℝ) ^ 2) * (4 * (W.outputDim : ℝ) ^ 2 * ε))) + + 12 * (δ : ℝ) + 2 / N := by + exact W.quadraticRoot.cyclicExchangeCorrection_mean_error δ hδ (W.rootExchangeCorrection G) + (W.explicit_half_root_exchange_mean_error G hcap herr) a b + +theorem exists_rootCyclicCorrection_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q e : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) (N : ℕ) (δ : ℝ≥0), + 0 < δ → 0 ≤ q → 0 ≤ e → (δ : ℝ)⁻¹ ≤ Real.exp e → + ∀ G : Fin W.outputDim → Fin W.outputDim → (Fin 2 → ℤ) → ℂ, + (∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 q (G a b))) → + ∀ a b, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + q + e + C) ^ C) + (W.rootCyclicCorrection N δ G a b)) := by + obtain ⟨A, _, hroot⟩ := exists_explicit_half_root_exchange_expansion + obtain ⟨B, _, hcyclic⟩ := exists_cyclicExchangeCorrection_expansion + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((3 * (X + 1) + (X + Polynomial.C A) ^ A + X + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p q e W N δ hδ hq he hinv G hG a b + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let v := p + q + e + have hv : 0 ≤ v := by dsimp [v]; positivity + have hA : (p + q + A) ^ A ≤ (v + A) ^ A := + pow_le_pow_left₀ (by positivity) (by dsimp [v]; linarith) A + have hbound : (tensorPowerBudget 2 p + (p + q + A) ^ A + e + B) ^ B ≤ + (p + q + e + C) ^ C := by + have hh : (3 * (v + 1) + (v + A) ^ A + v + B) ^ B ≤ (v + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget v hv + apply le_trans _ hh + apply pow_le_pow_left₀ (by unfold tensorPowerBudget; positivity) + norm_num only [tensorPowerBudget, Nat.cast_ofNat] at * + dsimp [v] at * + linarith + obtain ⟨E⟩ := hcyclic W.quadraticRoot N δ hδ (by positivity : 0 ≤ (p + q + A) ^ A) he hinv + (W.rootExchangeCorrection G) (hroot W hq G hG) a b + exact ⟨E.mono hbound⟩ + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +open scoped TensorProduct BigOperators + +theorem exists_cyclic_second_difference_models : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L : Type} {I : Type*} [Fintype I] + [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} (D : RationalFilteredNilmanifold L 2 d) {p e : ℝ} + (V : D.UnitVerticalObservable (D.filtration.realification.subgroup 2) I p) + (g : D.filtration.realification.PolynomialOrbit (fun _ : Fin 2 => 1)), + 0 ≤ p → D.GeometryComplexityLE p → (Fintype.card I : ℝ) ≤ Real.exp p → 0 ≤ e → + ∀ {N : ℕ} [NeZero N], Real.exp (e + 16) ≤ (N : ℝ) → + ∀ (i j : I) (k : ZMod N), ∃ K : (Fin 2 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + e + C) ^ C) K) ∧ + ∀ h : ℤ, (𝔼 n : ZMod N, + ‖cyclicSecondDifference (V.test g i).eval (V.test g j).eval k h n - + K ![h, (n.val : ℤ)]‖) ≤ Real.exp (-e) := by + obtain ⟨A, _, htranslate⟩ := exists_integer_translation_equivalence_budget 1 + obtain ⟨B, _, happrox⟩ := exists_cyclicSecondDifference_approximation + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (((X + Polynomial.C A) ^ A + X + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro L I _ _ _ _ _ _ _ d D p e V g hp hD hI he N _ hN i j k + let r := (p + A) ^ A + have hr : 0 ≤ r := by dsimp [r]; positivity + have hmodels (t : ℤ) : Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 r + (integerSecondDifference (V.test g i).eval (V.test g j).eval t)) := by + have E := (htranslate D V g hp hD hI 0 ![0, t]).expansion i j + change Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 r + (fun x => (V.test g i).eval (x + 0) * star ((V.test g j).eval (x + ![0, t])))) at E + have hshift (x : Fin 2 → ℤ) : x + ![0, t] = ![x 0, x 1 + t] := by + funext a + fin_cases a <;> simp + change Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 r + (fun x => (V.test g i).eval x * star ((V.test g j).eval ![x 0, x 1 + t]))) + simpa only [add_zero, hshift] using E + have hcost : (r + e + B) ^ B ≤ (p + e + C) ^ C := by + have hbase : r ≤ (p + e + A) ^ A := by + apply pow_le_pow_left₀ (by positivity) + linarith + have hb : ((p + e + A) ^ A + (p + e) + B) ^ B ≤ (p + e + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget (p + e) (by linarith) + exact (pow_le_pow_left₀ (by positivity) (by linarith) B).trans hb + obtain ⟨K, ⟨E⟩, herr⟩ := happrox hr he hN (V.test g i).eval (V.test g j).eval + (fun x => (V.test g i).norm_eval_le x) (fun x => (V.test g j).norm_eval_le x) hmodels k + exact ⟨K, ⟨E.mono hcost⟩, herr⟩ + +end Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalDifference.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..e626958540f3dd319ca9c6902b4612e55bbe74e3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalDifference.lean @@ -0,0 +1,97 @@ +import OAI.Combinatorics.Progressions.Linear.BinaryLowerRankFamily + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +open scoped TensorProduct BigOperators NNReal + +variable {L I J : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype I] [Fintype J] + {s d : ℕ} [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} {T : Subgroup D.RealGroup} {p : ℝ} + (V : D.UnitVerticalObservable T I p) (U : D.UnitVerticalObservable T J p) + +noncomputable def differenceObservable (a : I × J) (x : D.Space) : ℂ := + V.observable a.1 x * star (U.observable a.2 x) + +theorem differenceObservable_unit (x : D.Space) : + ∑ a, ‖V.differenceObservable U a x‖ ^ 2 = 1 := by + simp only [differenceObservable, norm_mul, norm_star, mul_pow, Fintype.sum_prod_type] + simp only [← Finset.mul_sum, U.unit, mul_one, V.unit] + +theorem differenceObservable_norm (a : I × J) (x : D.Space) : + ‖V.differenceObservable U a x‖ ≤ 1 := by + simpa only [differenceObservable, norm_mul, norm_star, mul_one] using + mul_le_mul (V.norm a.1 x) (U.norm a.2 x) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) + +theorem differenceObservable_lipschitz (a : I × J) : + letI := D.metricSpace + LipschitzWith (V.lipBound + U.lipBound) (V.differenceObservable U a) := by + let := D.metricSpace + exact (lipschitz_mul_star_of_bounds (V.observable a.1) (U.observable a.2) + (Bf := 1) (Bg := 1) (V.lipschitz a.1) (U.lipschitz a.2) + (V.norm a.1) (U.norm a.2)).weaken (by simp only [one_mul]; exact le_of_eq (add_comm _ _)) + +theorem differenceObservable_reconstruct (i : I) (x : D.Space) : + ∑ j, V.differenceObservable U (i, j) x * U.observable j x = V.observable i x := by + exact (complex_unit_vector_resolution (fun j => U.observable j x) (U.unit x) + (V.observable i x)).symm + +variable {r : ℕ} (R : D.DegreeRankStructure r) + (V : D.UnitVerticalObservable (R.realSubgroup s r) I p) + (U : D.UnitVerticalObservable (R.realSubgroup s r) J p) + (hfreq : ∀ x ∈ R.filtration.layer s r, V.frequency x = U.frequency x) + +include hfreq in +theorem differenceObservable_rank_invariant (a : I × J) (z : D.RealGroup) + (hz : z ∈ R.realSubgroup s r) (x : D.Space) : + V.differenceObservable U a (z • x) = V.differenceObservable U a x := by + have heq := realifyFunctional_eq_on_submodule (R.filtration.layer s r) + V.frequency U.frequency hfreq z.coord hz + let c := CircleFourier.character + ((realifyFunctional U.frequency z.coord : ℝ) : CircleFourier.Circle) + have hc : c * star c = 1 := by + dsimp only [c] + rw [← CircleFourier.character_neg, ← CircleFourier.character_add, + add_neg_cancel, CircleFourier.character_zero] + unfold differenceObservable + rw [V.vertical a.1 z hz, U.vertical a.2 z hz, heq, star_mul] + change (c * V.observable a.1 x) * (star (U.observable a.2 x) * star c) = _ + calc + _ = (c * star c) * (V.observable a.1 x * star (U.observable a.2 x)) := by ring + _ = _ := by rw [hc, one_mul] + +noncomputable def rankDifference : + D.UnitVerticalObservable (R.realSubgroup s r) (I × J) (p + 2) where + observable := V.differenceObservable U + unit := V.differenceObservable_unit U + norm := V.differenceObservable_norm U + lipBound := V.lipBound + U.lipBound + lip_bound := by + change (V.lipBound : ℝ) + U.lipBound ≤ Real.exp (p + 2) + calc + _ ≤ 2 * Real.exp p := by linarith [V.lip_bound, U.lip_bound] + _ ≤ Real.exp 2 * Real.exp p := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (2 : ℝ)]) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add, add_comm] + lipschitz := V.differenceObservable_lipschitz U + frequency := 0 + height i := by + have hp := (rationalLogHeight_nonneg (V.frequency (D.basis i))).trans (V.height i) + simpa [rationalLogHeight] using (show (0 : ℝ) ≤ p + 2 by linarith) + vertical a z hz x := by + simpa only [realifyFunctional_zero, AddCircle.coe_zero, + CircleFourier.character_zero, one_mul] using + differenceObservable_rank_invariant R V U hfreq a z hz x + integral _ _ _ := ⟨0, by simp only [realifyFunctional_zero, Int.cast_zero]⟩ + +theorem rankDifference_frequency : (rankDifference R V U hfreq).frequency = 0 := rfl + +end Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalMeanRowCorrelation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalMeanRowCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..67e420e679762f14e3c701fcb1c7be0870ef4b3f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalMeanRowCorrelation.lean @@ -0,0 +1,551 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeMeanRowCorrelation +import OAI.Combinatorics.Progressions.Estimates.PrescribedInvariantUnit + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem expect_fin_two {G M : Type*} [Fintype G] [AddCommMonoid M] [Module ℚ≥0 M] + (F : (Fin 2 → G) → M) : (𝔼 x, F x) = 𝔼 h : G, 𝔼 n : G, F ![h, n] := by + rw [expect_fin_cons] + apply Finset.expect_congr rfl + intro h _ + rw [expect_fin_cons] + apply Finset.expect_congr rfl + intro n _ + have hc (y : Fin 0 → G) : F (Fin.cons h (Fin.cons n y)) = F ![h, n] := by + congr 1 + funext k + fin_cases k <;> rfl + simp only [hc, Fintype.expect_const] + +theorem norm_correlation_partition_bound {X I : Type*} [Fintype X] [Fintype I] + (f u : X → ℂ) (v : I → X → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : + ‖𝔼 x, f x * star (u x)‖ ≤ + (∑ i, ‖𝔼 x, f x * star (v i x)‖) + 𝔼 x, ‖u x - ∑ i, v i x‖ := by + have he := norm_correlation_sub_le_mean f u (fun x => ∑ i, v i x) hf + have ht := norm_le_norm_add_norm_sub + (𝔼 x, f x * star (∑ i, v i x)) (𝔼 x, f x * star (u x)) + have hm : (𝔼 x, f x * star (∑ i, v i x)) = ∑ i, 𝔼 x, f x * star (v i x) := by + simp only [star_sum, Finset.mul_sum, Finset.expect_sum_comm] + rw [norm_sub_rev] at ht + have hsum := norm_sum_le (s := Finset.univ) (f := fun i => 𝔼 x, f x * star (v i x)) + rw [hm] at ht he + linarith + +theorem exists_dense_row_partition_correlation {H X I : Type*} + [Fintype H] [Nonempty H] [DecidableEq H] [Fintype X] [Nonempty X] [Fintype I] + (S : Finset H) (f u : H → X → ℂ) (v : I → H → X → ℂ) + {η M : ℝ} (hη : 0 < η) (hM : 0 < M) (hcard : (Fintype.card I : ℝ) ≤ M) + (hf : ∀ h x, ‖f h x‖ ≤ 1) (hv : ∀ i h x, ‖v i h x‖ ≤ 1) + (hmass : η ≤ 𝔼 h, if h ∈ S then ‖𝔼 x, f h x * star (u h x)‖ else 0) + (herr : (𝔼 h, 𝔼 x, ‖u h x - ∑ i, v i h x‖) ≤ η / 2) : + ∃ i : I, ∃ T : Finset H, T ⊆ S ∧ T.Nonempty ∧ + η / (4 * M) * Fintype.card H ≤ (T.card : ℝ) ∧ + ∀ h ∈ T, η / (4 * M) ≤ ‖𝔼 x, f h x * star (v i h x)‖ := by + classical + let value := fun (i : I) (h : H) => if h ∈ S then ‖𝔼 x, f h x * star (v i h x)‖ else 0 + have hnonneg (i : I) (h : H) : 0 ≤ value i h := by dsimp [value]; split_ifs <;> positivity + have hpoint (h : H) : (if h ∈ S then ‖𝔼 x, f h x * star (u h x)‖ else 0) ≤ + (∑ i, value i h) + 𝔼 x, ‖u h x - ∑ i, v i h x‖ := by + by_cases hh : h ∈ S + · simpa only [value, hh, ite_true] using + norm_correlation_partition_bound (f h) (u h) (fun i => v i h) (hf h) + · simp only [value, hh, ite_false, Finset.sum_const_zero, zero_add] + positivity + have havg : η / 2 ≤ ∑ i, 𝔼 h, value i h := by + have h := hmass.trans (Finset.expect_le_expect (fun h _ => hpoint h)) + rw [Finset.expect_add_distrib, Finset.expect_sum_comm] at h + linarith + have hI : (Finset.univ : Finset I).Nonempty := by + by_contra hn + rw [Finset.not_nonempty_iff_eq_empty.mp hn, Finset.sum_empty] at havg + linarith + obtain ⟨i, _hi, hmax⟩ := Finset.exists_max_image Finset.univ (fun i => 𝔼 h, value i h) hI + have hmax0 : 0 ≤ 𝔼 h, value i h := Finset.expect_nonneg (fun h _ => hnonneg i h) + have hlarge : η / (2 * M) ≤ 𝔼 h, value i h := by + have hsum : (∑ j, 𝔼 h, value j h) ≤ M * (𝔼 h, value i h) := by + calc + _ ≤ ∑ _j : I, 𝔼 h, value i h := + Finset.sum_le_sum (fun j _ => hmax j (Finset.mem_univ j)) + _ = (Fintype.card I : ℝ) * (𝔼 h, value i h) := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right hcard hmax0 + have h := (div_le_iff₀ hM).mpr (by simpa only [mul_comm] using havg.trans hsum) + simpa only [div_div] using h + have hunit (h : H) : value i h ≤ 1 := by + dsimp [value] + split_ifs + · calc + _ ≤ 𝔼 x, ‖f h x * star (v i h x)‖ := RCLike.norm_expect_le (K := ℂ) + _ ≤ 𝔼 _x : X, (1 : ℝ) := by + apply Finset.expect_le_expect + intro x _ + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hf h x)).trans (hv i h x) + _ = 1 := Fintype.expect_const _ + · norm_num + obtain ⟨T, hTsize, hT⟩ := exists_dense_level_set (value i) (by positivity) hunit hlarge + have hthreshold : η / (2 * M) / 2 = η / (4 * M) := by ring + rw [hthreshold] at hTsize hT + have hsub : T ⊆ S := by + intro h hh + by_contra hn + have h := hT h hh + simp only [value, hn, ite_false] at h + have : 0 < η / (4 * M) := by positivity + linarith + have hTne : T.Nonempty := by + apply Finset.card_pos.mp + exact_mod_cast lt_of_lt_of_le (by positivity : 0 < η / (4 * M) * (Fintype.card H : ℝ)) hTsize + exact ⟨i, T, hsub, hTne, hTsize, fun h hh => by + simpa only [value, hsub hh, ite_true] using hT h hh⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def cyclicDivision (d : ℕ) {N : ℕ} (x : ZMod N) : ZMod N := (x.val / d : ℕ) + +theorem cyclicDivision_val (d : ℕ) {N : ℕ} [NeZero N] (x : ZMod N) : + (cyclicDivision d x).val = x.val / d := + ZMod.val_natCast_of_lt ((Nat.div_le_self _ _).trans_lt x.val_lt) + +theorem cyclicDivision_with_residue_injective (d : ℕ) [NeZero d] {N : ℕ} [NeZero N] : + Function.Injective (fun x : ZMod N => (cyclicDivision d x, (x.val : ZMod d))) := by + intro x y h + have hq := congrArg (fun z : ZMod N × ZMod d => z.1.val) h + have hr := congrArg (fun z : ZMod N × ZMod d => z.2.val) h + simp only [cyclicDivision_val] at hq + simp only [ZMod.val_natCast] at hr + apply ZMod.val_injective + have hx := Nat.mod_add_div x.val d + have hy := Nat.mod_add_div y.val d + rw [hq, hr] at hx + exact hx.symm.trans hy + +theorem expect_cyclicDivision_le (d : ℕ) [NeZero d] {N : ℕ} [NeZero N] (f : ZMod N → ℝ) + (hf : ∀ x, 0 ≤ f x) : + (𝔼 x : ZMod N, f (cyclicDivision d x)) ≤ d * (𝔼 x : ZMod N, f x) := by + classical + have hs : (∑ x : ZMod N, f (cyclicDivision d x)) ≤ ∑ z : ZMod N × ZMod d, f z.1 := by + apply Finset.sum_le_sum_of_injOn (fun x : ZMod N => (cyclicDivision d x, (x.val : ZMod d))) + (cyclicDivision_with_residue_injective d).injOn + · exact Finset.subset_univ _ + · intro x _ + exact le_rfl + · intro a _ _ + exact hf a.1 + have ht : (∑ z : ZMod N × ZMod d, f z.1) = d * ∑ x : ZMod N, f x := by + simp only [Fintype.sum_prod_type, Finset.sum_const, Finset.card_univ, ZMod.card, + nsmul_eq_mul, ← Finset.mul_sum] + rw [ht] at hs + simp only [Fintype.expect_eq_sum_div_card, ZMod.card] + calc + _ ≤ (d * ∑ x : ZMod N, f x) / N := div_le_div_of_nonneg_right hs (Nat.cast_nonneg _) + _ = _ := by ring + +theorem expect_pair_cyclicDivision_le (d : ℕ) [NeZero d] {N : ℕ} [NeZero N] + (f : (Fin 2 → ZMod N) → ℝ) (hf : ∀ x, 0 ≤ f x) : + (𝔼 x : Fin 2 → ZMod N, f (fun i => cyclicDivision d (x i))) ≤ + (d : ℝ) ^ 2 * (𝔼 x : Fin 2 → ZMod N, f x) := by + rw [expect_fin_two, expect_fin_two] + have heq (h n : ZMod N) : (fun i => cyclicDivision d (![h, n] i)) = + ![cyclicDivision d h, cyclicDivision d n] := by + funext i + fin_cases i <;> rfl + simp only [heq] + calc + _ ≤ 𝔼 h : ZMod N, d * (𝔼 n : ZMod N, f ![cyclicDivision d h, n]) := by + apply Finset.expect_le_expect + intro h _ + exact expect_cyclicDivision_le d (fun n => f ![cyclicDivision d h, n]) (fun n => hf _) + _ = d * (𝔼 h : ZMod N, 𝔼 n : ZMod N, f ![cyclicDivision d h, n]) := by + rw [← Finset.mul_expect] + _ ≤ d * (d * (𝔼 h : ZMod N, 𝔼 n : ZMod N, f ![h, n])) := by + apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg d) + exact expect_cyclicDivision_le d (fun h => 𝔼 n : ZMod N, f ![h, n]) + (fun h => Finset.expect_nonneg (fun n _ => hf _)) + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def cyclicHalf {N : ℕ} (x : ZMod N) : ZMod N := (x.val / 2 : ℕ) + +theorem cyclicHalf_val {N : ℕ} [NeZero N] (x : ZMod N) : + (cyclicHalf x).val = x.val / 2 := by + exact ZMod.val_natCast_of_lt ((Nat.div_le_self _ _).trans_lt x.val_lt) + +theorem cyclicHalf_with_parity_injective {N : ℕ} [NeZero N] : + Function.Injective (fun x : ZMod N => (cyclicHalf x, (x.val : ZMod 2))) := by + intro x y h + have hq := congrArg (fun z : ZMod N × ZMod 2 => z.1.val) h + have hr := congrArg (fun z : ZMod N × ZMod 2 => z.2.val) h + simp only [cyclicHalf_val] at hq + simp only [ZMod.val_natCast] at hr + apply ZMod.val_injective + omega + +theorem expect_cyclicHalf_le {N : ℕ} [NeZero N] (f : ZMod N → ℝ) + (hf : ∀ x, 0 ≤ f x) : + (𝔼 x : ZMod N, f (cyclicHalf x)) ≤ 2 * (𝔼 x : ZMod N, f x) := by + classical + have hs : (∑ x : ZMod N, f (cyclicHalf x)) ≤ ∑ z : ZMod N × ZMod 2, f z.1 := by + apply Finset.sum_le_sum_of_injOn (fun x : ZMod N => (cyclicHalf x, (x.val : ZMod 2))) + cyclicHalf_with_parity_injective.injOn + · exact Finset.subset_univ _ + · intro x _ + exact le_rfl + · intro a _ _ + exact hf a.1 + have ht : (∑ z : ZMod N × ZMod 2, f z.1) = 2 * ∑ x : ZMod N, f x := by + simp only [Fintype.sum_prod_type, Finset.sum_const, Finset.card_univ, ZMod.card, + nsmul_eq_mul, Nat.cast_ofNat, ← Finset.mul_sum] + rw [ht] at hs + simp only [Fintype.expect_eq_sum_div_card, ZMod.card] + calc + _ ≤ (2 * ∑ x : ZMod N, f x) / N := div_le_div_of_nonneg_right hs (Nat.cast_nonneg _) + _ = _ := by ring + +theorem expect_pair_cyclicHalf_le {N : ℕ} [NeZero N] (f : (Fin 2 → ZMod N) → ℝ) + (hf : ∀ x, 0 ≤ f x) : + (𝔼 x : Fin 2 → ZMod N, f (fun i => cyclicHalf (x i))) ≤ + 4 * (𝔼 x : Fin 2 → ZMod N, f x) := by + rw [expect_fin_two, expect_fin_two] + have heq (h n : ZMod N) : (fun i => cyclicHalf (![h, n] i)) = ![cyclicHalf h, cyclicHalf n] := by + funext i + fin_cases i <;> rfl + simp only [heq] + calc + _ ≤ 𝔼 h : ZMod N, 2 * (𝔼 n : ZMod N, f ![cyclicHalf h, n]) := by + apply Finset.expect_le_expect + intro h _ + exact expect_cyclicHalf_le (fun n => f ![cyclicHalf h, n]) (fun n => hf _) + _ = 2 * (𝔼 h : ZMod N, 𝔼 n : ZMod N, f ![cyclicHalf h, n]) := by + rw [← Finset.mul_expect] + _ ≤ 2 * (2 * (𝔼 h : ZMod N, 𝔼 n : ZMod N, f ![h, n])) := by + apply mul_le_mul_of_nonneg_left _ (by norm_num) + exact expect_cyclicHalf_le (fun h => 𝔼 n : ZMod N, f ![h, n]) + (fun h => Finset.expect_nonneg (fun n _ => hf _)) + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def cyclicThird {N : ℕ} (x : ZMod N) : ZMod N := (x.val / 3 : ℕ) + +theorem cyclicThird_val {N : ℕ} [NeZero N] (x : ZMod N) : + (cyclicThird x).val = x.val / 3 := by + exact ZMod.val_natCast_of_lt ((Nat.div_le_self _ _).trans_lt x.val_lt) + +theorem cyclicThird_with_residue_injective {N : ℕ} [NeZero N] : + Function.Injective (fun x : ZMod N => (cyclicThird x, (x.val : ZMod 3))) := by + intro x y h + have hq := congrArg (fun z : ZMod N × ZMod 3 => z.1.val) h + have hr := congrArg (fun z : ZMod N × ZMod 3 => z.2.val) h + simp only [cyclicThird_val] at hq + simp only [ZMod.val_natCast] at hr + apply ZMod.val_injective + omega + +theorem expect_cyclicThird_le {N : ℕ} [NeZero N] (f : ZMod N → ℝ) + (hf : ∀ x, 0 ≤ f x) : + (𝔼 x : ZMod N, f (cyclicThird x)) ≤ 3 * (𝔼 x : ZMod N, f x) := by + classical + have hs : (∑ x : ZMod N, f (cyclicThird x)) ≤ ∑ z : ZMod N × ZMod 3, f z.1 := by + apply Finset.sum_le_sum_of_injOn (fun x : ZMod N => (cyclicThird x, (x.val : ZMod 3))) + cyclicThird_with_residue_injective.injOn + · exact Finset.subset_univ _ + · intro x _ + exact le_rfl + · intro a _ _ + exact hf a.1 + have ht : (∑ z : ZMod N × ZMod 3, f z.1) = 3 * ∑ x : ZMod N, f x := by + simp only [Fintype.sum_prod_type, Finset.sum_const, Finset.card_univ, ZMod.card, + nsmul_eq_mul, Nat.cast_ofNat, ← Finset.mul_sum] + rw [ht] at hs + simp only [Fintype.expect_eq_sum_div_card, ZMod.card] + calc + _ ≤ (3 * ∑ x : ZMod N, f x) / N := div_le_div_of_nonneg_right hs (Nat.cast_nonneg _) + _ = _ := by ring + +theorem expect_pair_cyclicThird_le {N : ℕ} [NeZero N] (f : (Fin 2 → ZMod N) → ℝ) + (hf : ∀ x, 0 ≤ f x) : + (𝔼 x : Fin 2 → ZMod N, f (fun i => cyclicThird (x i))) ≤ + 9 * (𝔼 x : Fin 2 → ZMod N, f x) := by + rw [expect_fin_two, expect_fin_two] + have heq (h n : ZMod N) : (fun i => cyclicThird (![h, n] i)) = ![cyclicThird h, cyclicThird n] := by + funext i + fin_cases i <;> rfl + simp only [heq] + calc + _ ≤ 𝔼 h : ZMod N, 3 * (𝔼 n : ZMod N, f ![cyclicThird h, n]) := by + apply Finset.expect_le_expect + intro h _ + exact expect_cyclicThird_le (fun n => f ![cyclicThird h, n]) (fun n => hf _) + _ = 3 * (𝔼 h : ZMod N, 𝔼 n : ZMod N, f ![cyclicThird h, n]) := by + rw [← Finset.mul_expect] + _ ≤ 3 * (3 * (𝔼 h : ZMod N, 𝔼 n : ZMod N, f ![h, n])) := by + apply mul_le_mul_of_nonneg_left _ (by norm_num) + exact expect_cyclicThird_le (fun h => 𝔼 n : ZMod N, f ![h, n]) + (fun h => Finset.expect_nonneg (fun n _ => hf _)) + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.Niltest + +open CircleFourier +open scoped TensorProduct BigOperators + +theorem exists_unit_bounded_vertical_mean_row : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ H X L : Type*} + [Fintype H] [Nonempty H] [Fintype X] [Nonempty X] + [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {s d : ℕ} (D : RationalFilteredNilmanifold L s d) {w : σ → ℕ} + (T : D.Niltest w) {p : ℝ}, 0 ≤ p → T.ComplexityLE p → + ∀ (sample : H → X → σ → ℤ) (f : H → X → ℂ), (∀ h x, ‖f h x‖ ≤ 1) → + Real.exp (-p) ≤ (𝔼 h, ‖𝔼 x, f h x * star (T.eval (sample h x))‖) → + ∃ (η : L →ₗ[ℚ] ℚ) (U : D.Niltest w), + U.ComplexityLE ((p + C) ^ C) ∧ U.normBound ≤ 1 ∧ U.orbit = T.orbit ∧ + (∀ i, rationalLogHeight (η (D.basis i)) ≤ (p + C) ^ C) ∧ + (∀ z, z ∈ D.filtration.realification.subgroup s → ∀ x, + U.observable (z • x) = + character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * U.observable x) ∧ + (∀ z : D.RealGroup, z ∈ D.filtration.realification.subgroup s → z ∈ D.realLattice → + ∃ n : ℤ, realifyFunctional η z.coord = n) ∧ + Real.exp (-((p + C) ^ C)) ≤ + (𝔼 h, ‖𝔼 x, f h x * star (U.eval (sample h x))‖) := by + obtain ⟨A, _, hvertical⟩ := exists_verticalDecompositionBudget_bound + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (X + (2 * X + 2 + Polynomial.C A) ^ A + (2 * X + 2) + 2) + refine ⟨C, hC, ?_⟩ + intro σ H Y L _ _ _ _ _ _ _ _ _ _ s d D w T p hp hT sample f hf hcorr + let r := 2 * p + 2 + let δ := Real.exp (-(p + 2)) + have hr : 0 ≤ r := by dsimp [r]; linarith + have hpr : p ≤ r := by dsimp [r]; linarith + have hδ : 0 < δ := Real.exp_pos _ + have hδr : δ⁻¹ ≤ Real.exp r := by + dsimp [δ] + rw [← Real.exp_neg, neg_neg] + exact Real.exp_le_exp.mpr (by dsimp [r]; linarith) + obtain ⟨J, inst, η, U, hcard, hheight, hU, hchar, hint, _, _, herr⟩ := + T.exists_controlled_vertical_decomposition hr (hT.mono hpr) δ hδ hδr + let := inst + have hrow (h : H) : ‖𝔼 x, f h x * star (T.eval (sample h x))‖ ≤ + (∑ j : J, ‖𝔼 x, f h x * star ((U j).eval (sample h x))‖) + δ := by + apply (norm_correlation_partition_bound (f h) + (fun x => T.eval (sample h x)) (fun j x => (U j).eval (sample h x)) (hf h)).trans + apply add_le_add le_rfl + apply Finset.expect_le Finset.univ_nonempty + intro x _ + simpa only [norm_sub_rev] using herr (sample h x) + have hm := Finset.expect_le_expect (s := Finset.univ) (fun h _ => hrow h) + simp only [Finset.expect_add_distrib, Finset.expect_sum_comm, Fintype.expect_const] at hm + have htwo : 2 * δ ≤ Real.exp (-p) := by + calc + _ ≤ Real.exp 2 * δ := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (2 : ℝ)]) hδ.le + _ = _ := by dsimp [δ]; rw [← Real.exp_add]; congr 1; ring + have hs : δ ≤ ∑ j : J, (𝔼 h, ‖𝔼 x, f h x * star ((U j).eval (sample h x))‖) := by + linarith + obtain ⟨j, hj⟩ := exists_large_nonnegative_weighted_term (fun _ : J => (1 : ℝ)) + (fun j => 𝔼 h, ‖𝔼 x, f h x * star ((U j).eval (sample h x))‖) + (fun _ => by norm_num) (fun _ => Finset.expect_nonneg (fun _ _ => norm_nonneg _)) + hδ (Real.exp_pos _) (by simpa using hcard) (by simpa only [one_mul] using hs) + have hne : ∃ x, (U j).observable x ≠ 0 := by + by_contra! hzero + have heval : ∀ x, (U j).eval x = 0 := fun x => hzero _ + simp only [heval, star_zero, mul_zero, Finset.expect_const_zero, norm_zero] at hj + exact (not_le_of_gt (div_pos hδ (Real.exp_pos _))) hj + let q := p + verticalDecompositionBudget r + r + 2 + have hq : q ≤ (p + C) ^ C := by + have hb : p + (r + A) ^ A + r + 2 ≤ (p + C) ^ C := by + simpa [X, r, Polynomial.eval₂_pow] using hbudget p hp + dsimp [q] + linarith [hvertical r hr] + have hrq : r ≤ (p + C) ^ C := by + have hv := verticalDecompositionBudget_nonneg hr + dsimp [q] at hq + linarith + have hvq : verticalDecompositionBudget r ≤ (p + C) ^ C := by + dsimp [q] at hq + linarith + have hnormcorr : Real.exp (-q) ≤ + (𝔼 h, ‖𝔼 x, f h x * star (((U j).expNormalize r).eval (sample h x))‖) := by + simp only [expNormalize_eval] + rw [mean_row_correlation_scale f (fun h x => (U j).eval (sample h x)) (Real.exp_nonneg _)] + have heq : Real.exp (-r) * (δ / Real.exp (verticalDecompositionBudget r)) = + Real.exp (-q) := by + dsimp [δ, q] + rw [← Real.exp_sub, ← Real.exp_add] + congr 1 + ring + rw [← heq] + exact mul_le_mul_of_nonneg_left hj (Real.exp_nonneg _) + refine ⟨η j, (U j).expNormalize r, + ((U j).expNormalize_complexity (hU j).1).mono hrq, + (U j).expNormalize_norm (hU j).1, (hU j).2, + fun i => (hheight j i).trans hvq, ?_, hint j hne, + (Real.exp_le_exp.mpr (neg_le_neg hq)).trans hnormcorr⟩ + intro z hz x + change (Real.exp (-r) : ℂ) * (U j).observable (z • x) = + _ * ((Real.exp (-r) : ℂ) * (U j).observable x) + rw [hchar j z hz] + ring + +end Erdos3.RationalFilteredNilmanifold.Niltest + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +open scoped TensorProduct NNReal + +variable {σ L I : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype I] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} {S : Subgroup D.RealGroup} {p : ℝ} {w : σ → ℕ} + +noncomputable def test (V : D.UnitVerticalObservable S I p) + (g : D.filtration.realification.PolynomialOrbit w) (i : I) : D.Niltest w where + orbit := g + observable := V.observable i + normBound := 1 + lipBound := V.lipBound + norm_le := V.norm i + lipschitz := V.lipschitz i + +theorem test_eval (V : D.UnitVerticalObservable S I p) + (g : D.filtration.realification.PolynomialOrbit w) (i : I) (x : σ → ℤ) : + (V.test g i).eval x = V.observable i + (QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval w x g)) := rfl + +theorem test_complexity (V : D.UnitVerticalObservable S I p) + (g : D.filtration.realification.PolynomialOrbit w) (hp : 0 ≤ p) + (hD : D.GeometryComplexityLE p) (i : I) : (V.test g i).ComplexityLE (p + 4) := by + refine ⟨hD.mono D (by linarith), ?_⟩ + have ht := niltest_log_bound_of_exp (1 : ℝ≥0) V.lipBound (a := 0) (b := p) + (by norm_num) hp (by simp) V.lip_bound + simpa only [test, zero_add] using ht + +end Erdos3.RationalFilteredNilmanifold.UnitVerticalObservable + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open scoped TensorProduct BigOperators + +theorem exists_unit_vertical_mean_row_model (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {σ H X L : Type*} + [Fintype H] [Nonempty H] [Fintype X] [Nonempty X] + [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} (D : RationalFilteredNilmanifold L s d) {w : σ → ℕ} + (T : D.Niltest w) {p : ℝ}, 0 ≤ p → T.ComplexityLE p → + ∀ (sample : H → X → σ → ℤ) (f : H → X → ℂ), (∀ h x, ‖f h x‖ ≤ 1) → + Real.exp (-p) ≤ (𝔼 h, ‖𝔼 x, f h x * star (T.eval (sample h x))‖) → + ∃ n : ℕ, 0 < n ∧ (n + 1 : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ V : D.UnitVerticalObservable (D.filtration.realification.subgroup s) + (Fin (n + 1)) ((p + C) ^ C), + D.GeometryComplexityLE ((p + C) ^ C) ∧ + Real.exp (-((p + C) ^ C)) ≤ + (𝔼 h, ‖𝔼 x, f h x * star ((V.test T.orbit 0).eval (sample h x))‖) := by + obtain ⟨A, _, hmode⟩ := Niltest.exists_unit_bounded_vertical_mean_row + obtain ⟨B, _, hcomplete⟩ := exists_native_unit_vertical_completion s + let X : Polynomial ℕ := Polynomial.X + let Q := (X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (Q + (Q + Polynomial.C B) ^ B + 1) + refine ⟨C, hC, ?_⟩ + intro σ H Y L _ _ _ _ _ _ _ _ _ _ d D w T p hp hT sample f hf hcorr + let q := (p + A) ^ A + let r := (q + B) ^ B + have hq : 0 ≤ q := by dsimp [q]; positivity + have hr : 0 ≤ r := by dsimp [r]; positivity + have htotal : q + r + 1 ≤ (p + C) ^ C := by + simpa [X, Q, q, r, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := by linarith + have hrC : r ≤ (p + C) ^ C := by linarith + obtain ⟨η, U, hU, hUnorm, horbit, hheight, hchar, hint, hcorrU⟩ := + hmode D T hp hT sample f hf hcorr + obtain ⟨h, x, hx⟩ := exists_large_value_of_mean_row_correlation f + (fun h x => U.eval (sample h x)) hf hcorrU + let y : D.Space := QuotientGroup.mk + (D.filtration.realification.polynomialOrbitEval w (sample h x) U.orbit) + obtain ⟨n, hn, hncard, K, hK, v, hv0, hvunit, hvnorm, hvLip, hvchar⟩ := + hcomplete D U hq hU hUnorm η hchar y hx + let V : D.UnitVerticalObservable (D.filtration.realification.subgroup s) + (Fin (n + 1)) ((p + C) ^ C) := + { observable := v + unit := hvunit + norm := hvnorm + lipBound := K + lip_bound := hK.trans (Real.exp_le_exp.mpr hrC) + lipschitz := hvLip + frequency := η + height := fun i => (hheight i).trans hqC + vertical := hvchar + integral := hint } + have hscalar (z : σ → ℤ) : (V.test T.orbit 0).eval z = U.eval z / 2 := by + rw [UnitVerticalObservable.test_eval] + change v 0 _ = U.eval z / 2 + rw [hv0] + unfold Niltest.eval + rw [horbit] + have hmean : (𝔼 h, ‖𝔼 x, f h x * star ((V.test T.orbit 0).eval (sample h x))‖) = + (𝔼 h, ‖𝔼 x, f h x * star (U.eval (sample h x))‖) / 2 := by + simp only [hscalar, star_div₀, star_ofNat, ← mul_div_assoc, ← Finset.expect_div, + norm_div] + norm_num + refine ⟨n, hn, hncard.trans (Real.exp_le_exp.mpr hrC), V, + hU.1.mono D hqC, ?_⟩ + rw [hmean] + have hhalf : Real.exp (-(q + 1)) ≤ Real.exp (-q) / 2 := by + simpa only [neg_add, sub_eq_add_neg] using exp_sub_one_le_half_exp (-q) + exact (Real.exp_le_exp.mpr (by linarith)).trans + (hhalf.trans (div_le_div_of_nonneg_right hcorrU (by norm_num))) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalNativeInverseModels.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalNativeInverseModels.lean new file mode 100644 index 0000000000000000000000000000000000000000..a240e7e30b5fe2adbe58851f299ab1d6e286d345 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnitVerticalNativeInverseModels.lean @@ -0,0 +1,508 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeProductVerticalization + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_native_derivative_correlators {s C N : ℕ} [NeZero N] + (hI : CyclicNativeInverse s C) (f : ZMod N → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) + {p : ℝ} (hp : 0 ≤ p) (hG : Real.exp (-p) ≤ gowersNorm (s + 2) f) : + ∃ H : Finset (ZMod N), H.Nonempty ∧ + Real.exp (-derivativeInverseBudget s p) * Fintype.card (ZMod N) ≤ (H.card : ℝ) ∧ + ∃ (g : {h // h ∈ H} → ZMod N → ℂ) + (_F : ∀ h, NativeCyclicModel s N ((derivativeInverseBudget s p + C) ^ C) (g h)), + ∀ h, Real.exp (-((derivativeInverseBudget s p + C) ^ C)) ≤ + ‖𝔼 x, multiplicativeDerivative f h.val x * star (g h x)‖ := by + classical + obtain ⟨H, hH, hdense, hlarge⟩ := exists_many_large_gowers_derivatives s f hf hp hG + have hchoose (h : {h // h ∈ H}) : + ∃ g ∈ nativeCyclicFunctions s N ((derivativeInverseBudget s p + C) ^ C), + Real.exp (-((derivativeInverseBudget s p + C) ^ C)) ≤ + ‖𝔼 x, multiplicativeDerivative f h.val x * star (g x)‖ := + hI (derivativeInverseBudget_ge_two s hp) (multiplicativeDerivative f h.val) + (multiplicativeDerivative_norm_le_one f hf h.val) (hlarge h.val h.property) + choose g hg hcorr using hchoose + exact ⟨H, hH, hdense, g, (fun h => Classical.choice (hg h)), hcorr⟩ + +theorem exists_native_degree_one_derivative_correlators {N : ℕ} [NeZero N] + (f : ZMod N → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) {p : ℝ} (hp : 0 ≤ p) + (hG : Real.exp (-p) ≤ gowersNorm 3 f) : + ∃ H : Finset (ZMod N), H.Nonempty ∧ + Real.exp (-(8 * p + 2)) * Fintype.card (ZMod N) ≤ (H.card : ℝ) ∧ + ∃ (g : {h // h ∈ H} → ZMod N → ℂ) + (_F : ∀ h, NativeCyclicModel 1 N ((8 * p + 4) ^ 2) (g h)), + ∀ h, Real.exp (-((8 * p + 4) ^ 2)) ≤ + ‖𝔼 x, multiplicativeDerivative f h.val x * star (g h x)‖ := by + have hbudget : (derivativeInverseBudget 1 p + (2 : ℕ)) ^ 2 = (8 * p + 4) ^ 2 := by + norm_num [derivativeInverseBudget] + ring + obtain ⟨H, hH, hdense, g, F, hcorr⟩ := + exists_native_derivative_correlators cyclicNativeInverse_one f hf hp hG + refine ⟨H, hH, ?_, g, ?_, ?_⟩ + · simpa only [derivativeInverseBudget, Nat.reduceAdd, Nat.reducePow, Nat.cast_ofNat] using hdense + · intro h + rw [← hbudget] + exact F h + · intro h + simpa only [hbudget] using hcorr h + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open scoped TensorProduct BigOperators + +theorem exists_common_observable_correlators (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {G : Type*} {L : G → Type*} + [∀ h, LieRing (L h)] [∀ h, LieAlgebra ℚ (L h)] + [∀ h, TopologicalSpace (ℝ ⊗[ℚ] L h)] [∀ h, IsTopologicalAddGroup (ℝ ⊗[ℚ] L h)] + [∀ h, ContinuousSMul ℝ (ℝ ⊗[ℚ] L h)] [∀ h, T2Space (ℝ ⊗[ℚ] L h)] {d : G → ℕ} + (D : ∀ h, RationalFilteredNilmanifold (L h) s (d h)) + (T : ∀ h, (D h).Niltest (fun _ : Unit => 1)) (H : Finset G), H.Nonempty → + ∀ {p : ℝ}, 0 ≤ p → (∀ h, (T h).ComplexityLE p) → + (∀ h ∈ H, (T h).normBound ≤ 1) → ∀ {N : ℕ} [NeZero N] + (weight : G → ZMod N → ℂ), (∀ h ∈ H, ∀ x, ‖weight h x‖ ≤ 1) → + (∀ h ∈ H, Real.exp (-p) ≤ + ‖𝔼 x, weight h x * star ((T h).evalCyclic N (fun _ => x))‖) → + ∃ h₀ ∈ H, ∃ E : RationalFilteredNilmanifold (L h₀) s (d h₀), + E.GeometryComplexityLE ((p + C) ^ C) ∧ + ∃ (H' : Finset G) (S : G → E.Niltest (fun _ : Unit => 1)), + H' ⊆ H ∧ H'.Nonempty ∧ Real.exp (-((p + C) ^ C)) * H.card ≤ (H'.card : ℝ) ∧ + (∀ h, (S h).normBound ≤ 1 ∧ (S h).UnitIntervalValued ∧ + (S h).ComplexityLE ((p + C) ^ C)) ∧ + (∀ h k, (S h).observable = (S k).observable) ∧ + ∀ h ∈ H', Real.exp (-((p + C) ^ C)) ≤ + ‖𝔼 x, weight h x * star ((S h).evalCyclic N (fun _ => x))‖ := by + obtain ⟨c, _, hmodels⟩ := exists_common_variable_dimension_niltest_model s + obtain ⟨k, _, hfixed⟩ := exists_fixed_observable_correlators s + let X : Polynomial ℕ := Polynomial.X + let Q := X + (X + Polynomial.C c) ^ c + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (Q + (Q + Polynomial.C k) ^ k + (X + Polynomial.C c) ^ c) + refine ⟨C, hC, ?_⟩ + intro G L _ _ _ _ _ _ d D T H hH p hp hT hcap N _ weight hweight hcorr + let q := p + (p + c) ^ c + 2 + have hpow : 0 ≤ (p + c) ^ c := by positivity + have hpq : p ≤ q := by dsimp [q]; linarith + have hmodelq : (p + c) ^ c ≤ q := by dsimp [q]; linarith + have hq : 0 ≤ q := hp.trans hpq + have hfixed0 : 0 ≤ (q + k) ^ k := by positivity + have hcost : q + (q + k) ^ k + (p + c) ^ c ≤ (p + C) ^ C := by + simpa [Q, X, q, Polynomial.eval₂_pow] using hbudget p hp + have hfixedC : (q + k) ^ k ≤ (p + C) ^ C := by linarith + have hmodelC : (p + c) ^ c ≤ (p + C) ^ C := by linarith + obtain ⟨h₀, hh₀, E, hE, H₁, P, hsub₁, hh₀', hlarge₁, hP⟩ := + hmodels D T H hH hp hT + have hPeval (h : G) (hh : h ∈ H₁) (x : ZMod N) : + (P h).evalCyclic N (fun _ => x) = (T h).evalCyclic N (fun _ => x) := + (hP h hh).2.2.1 _ + obtain ⟨H₂, S, hsub₂, hH₂, hlarge₂, hS, hsame, hcorrS⟩ := + hfixed E P H₁ ⟨h₀, hh₀'⟩ hq (hE.mono E hmodelq) + (fun h hh => (hP h hh).1.mono hmodelq) + (fun h hh => by rw [(hP h hh).2.1]; exact hcap h (hsub₁ hh)) weight + (fun h hh x => hweight h (hsub₁ hh) x) + (fun h hh => by + simp_rw [hPeval h hh] + exact (Real.exp_le_exp.mpr (neg_le_neg hpq)).trans (hcorr h (hsub₁ hh))) + refine ⟨h₀, hh₀, E, hE.mono E hmodelC, H₂, S, hsub₂.trans hsub₁, hH₂, ?_, + fun h => ⟨(hS h).2.1, (hS h).2.2.1, (hS h).2.2.2.mono hfixedC⟩, hsame, ?_⟩ + · calc + Real.exp (-((p + C) ^ C)) * H.card ≤ + Real.exp (-((q + k) ^ k + (p + c) ^ c)) * H.card := + mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg (by linarith))) + (Nat.cast_nonneg _) + _ = Real.exp (-((q + k) ^ k)) * (Real.exp (-((p + c) ^ c)) * H.card) := by + rw [← mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ Real.exp (-((q + k) ^ k)) * H₁.card := + mul_le_mul_of_nonneg_left hlarge₁ (Real.exp_nonneg _) + _ ≤ _ := hlarge₂ + · intro h hh + exact (Real.exp_le_exp.mpr (neg_le_neg hfixedC)).trans (hcorrS h hh) + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators NNReal + +attribute [local instance] NativeCommonDerivativeModels.lie NativeCommonDerivativeModels.algebra + NativeCommonDerivativeModels.topology NativeCommonDerivativeModels.topologicalAdd + NativeCommonDerivativeModels.continuousSMul NativeCommonDerivativeModels.hausdorff + +structure NativeUnitVerticalData {s N : ℕ} [NeZero N] {p : ℝ} {f : ZMod N → ℂ} + (B : NativeCommonDerivativeModels s N p f) (V : NativeVerticalDerivativeData B) (q : ℝ) where + tailDim : ℕ + dimension : (tailDim + 1 : ℝ) ≤ Real.exp q + observable : Fin (tailDim + 1) → B.model.Space → ℂ + lipBound : ℝ≥0 + lip_bound : (lipBound : ℝ) ≤ Real.exp q + unit : ∀ x, ∑ i, ‖observable i x‖ ^ 2 = 1 + norm : ∀ i x, ‖observable i x‖ ≤ 1 + lipschitz : letI := B.model.metricSpace; ∀ i, LipschitzWith lipBound (observable i) + scalar : ∀ h x, observable 0 x = (B.test h).observable x / 2 + vertical : ∀ i z, z ∈ B.model.filtration.realification.subgroup s → ∀ x, + observable i (z • x) = + CircleFourier.character ((realifyFunctional V.frequency z.coord : ℝ) : CircleFourier.Circle) * + observable i x + +namespace NativeUnitVerticalData + +variable {s N : ℕ} [NeZero N] {p q : ℝ} {f : ZMod N → ℂ} + {B : NativeCommonDerivativeModels s N p f} {V : NativeVerticalDerivativeData B} + (U : NativeUnitVerticalData B V q) + +noncomputable def mono {p' q' : ℝ} (hp : p ≤ p') (hq : q ≤ q') : + NativeUnitVerticalData (B.mono hp) (V.mono hp) q' where + tailDim := U.tailDim + dimension := U.dimension.trans (Real.exp_le_exp.mpr hq) + observable := U.observable + lipBound := U.lipBound + lip_bound := U.lip_bound.trans (Real.exp_le_exp.mpr hq) + unit := U.unit + norm := U.norm + lipschitz := U.lipschitz + scalar := U.scalar + vertical := U.vertical + +noncomputable def test (i : Fin (U.tailDim + 1)) (h : ZMod N) : + B.model.Niltest (fun _ : Unit => 1) where + orbit := (B.test h).orbit + observable := U.observable i + normBound := 1 + lipBound := U.lipBound + norm_le := U.norm i + lipschitz := U.lipschitz i + +theorem test_zero_evalCyclic (h x : ZMod N) : + (U.test 0 h).evalCyclic N (fun _ => x) = (B.test h).evalCyclic N (fun _ => x) / 2 := + U.scalar h _ + +theorem test_normalized (i : Fin (U.tailDim + 1)) (h : ZMod N) : + B.model.filtration.realification.polynomialOrbitEval (fun _ => 1) 0 (U.test i h).orbit = 1 := + V.normalized h + +theorem test_complexity (hpq : p ≤ q) (hq : 0 ≤ q) + (i : Fin (U.tailDim + 1)) (h : ZMod N) : (U.test i h).ComplexityLE (q + 4) := by + refine ⟨B.geometry.mono B.model (by linarith), ?_⟩ + have ht := niltest_log_bound_of_exp (1 : ℝ≥0) U.lipBound (a := 0) (b := q) + (by norm_num) hq (by simp) U.lip_bound + simpa only [test, zero_add] using ht + +theorem test_zero_correlation (h : ZMod N) (hh : h ∈ B.shifts) : + Real.exp (-(p + 1)) ≤ + ‖𝔼 x, multiplicativeDerivative f h x * star ((U.test 0 h).evalCyclic N (fun _ => x))‖ := by + have heq : + (𝔼 x, multiplicativeDerivative f h x * star ((U.test 0 h).evalCyclic N (fun _ => x))) = + (𝔼 x, multiplicativeDerivative f h x * star ((B.test h).evalCyclic N (fun _ => x))) / 2 := by + simp only [U.test_zero_evalCyclic, star_div₀, star_ofNat, ← mul_div_assoc, ← Finset.expect_div] + rw [heq, norm_div] + have htwo : ‖(2 : ℂ)‖ = (2 : ℝ) := by norm_num + rw [htwo] + have hsmall : Real.exp (-(p + 1)) ≤ Real.exp (-p) / 2 := by + simpa only [neg_add, sub_eq_add_neg] using exp_sub_one_le_half_exp (-p) + exact hsmall.trans (div_le_div_of_nonneg_right (B.correlation h hh) (by norm_num)) + +end NativeUnitVerticalData + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_native_inverse_quadruples {s C N : ℕ} [NeZero N] + (hI : CyclicNativeInverse s C) (f : ZMod N → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) + {p : ℝ} (hp : 0 ≤ p) (hG : Real.exp (-p) ≤ gowersNorm (s + 2) f) : + let q := derivativeInverseBudget s p + let r := (q + C) ^ C + let rho := (Real.exp (-q) * Real.exp (-r)) ^ 4 / 2 + ∃ (H : Finset (ZMod N)) (g : ZMod N → ZMod N → ℂ), H.Nonempty ∧ + Real.exp (-q) * Fintype.card (ZMod N) ≤ (H.card : ℝ) ∧ + (∀ h ∈ H, g h ∈ nativeCyclicFunctions s N r) ∧ + (∀ h x, ‖g h x‖ ≤ 1) ∧ + (∀ h, h ∉ H → ∀ x, g h x = 0) ∧ + (∀ h ∈ H, Real.exp (-r) ≤ + ‖𝔼 x, multiplicativeDerivative f h x * star (g h x)‖) ∧ + ∃ Q : Finset (ZMod N × ZMod N × ZMod N), Q.Nonempty ∧ + rho * (Fintype.card (ZMod N) : ℝ) ^ 3 ≤ (Q.card : ℝ) ∧ + ∀ t ∈ Q, t.2.1 ∈ H ∧ t.2.1 - t.1 ∈ H ∧ t.2.2 ∈ H ∧ t.2.2 - t.1 ∈ H ∧ + rho ≤ additiveQuadrupleCorrelation g t.1 t.2.1 t.2.2 := by + classical + dsimp only + obtain ⟨H, hH, hdense, g₀, F, hcorr⟩ := exists_native_derivative_correlators hI f hf hp hG + let g : ZMod N → ZMod N → ℂ := fun h => if hh : h ∈ H then g₀ ⟨h, hh⟩ else 0 + have hnative (h : ZMod N) (hh : h ∈ H) : + g h ∈ nativeCyclicFunctions s N ((derivativeInverseBudget s p + C) ^ C) := by + simp only [g, dite_eq_left hh] + exact ⟨F ⟨h, hh⟩⟩ + have hzero (h : ZMod N) (hh : h ∉ H) (x : ZMod N) : g h x = 0 := by + simp only [g, dite_eq_right hh, Pi.zero_apply] + have hunit (h x : ZMod N) : ‖g h x‖ ≤ 1 := by + by_cases hh : h ∈ H + · exact nativeCyclicFunctions_norm (hnative h hh) x + · rw [hzero h hh x, norm_zero] + norm_num + have hlarge (h : ZMod N) (hh : h ∈ H) : + Real.exp (-((derivativeInverseBudget s p + C) ^ C)) ≤ + ‖𝔼 x, multiplicativeDerivative f h x * star (g h x)‖ := by + simpa only [g, dite_eq_left hh] using hcorr ⟨h, hh⟩ + obtain ⟨Q, hQ, hQdense, hQcorr⟩ := exists_many_correlated_additive_quadruples + f g H hf hunit hzero (Real.exp_pos _) (Real.exp_pos _) hdense hlarge + exact ⟨H, g, hH, hdense, hnative, hunit, hzero, hlarge, Q, hQ, hQdense, hQcorr⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeCyclicModel.lie NativeCyclicModel.algebra + NativeCyclicModel.topology NativeCyclicModel.topologicalAdd + NativeCyclicModel.continuousSMul NativeCyclicModel.hausdorff + +theorem exists_native_common_derivative_models {s C : ℕ} (hI : CyclicNativeInverse s C) : + ∃ D : ℕ, 2 ≤ D ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → + Real.exp (-p) ≤ gowersNorm (s + 2) f → + Nonempty (NativeCommonDerivativeModels s N ((p + D) ^ D) f) := by + classical + obtain ⟨a, _, hcommon⟩ := RationalFilteredNilmanifold.exists_common_observable_correlators s + let X : Polynomial ℕ := Polynomial.X + let Q := Polynomial.C (2 ^ (s + 2)) * X + 2 + let R := (Q + Polynomial.C C) ^ C + obtain ⟨D, hD, hbudget⟩ := exists_natPolynomial_eval_budget + (Q + (R + Polynomial.C a) ^ a + 2) + refine ⟨D, hD, ?_⟩ + intro N _ p hp f hf hG + let q := derivativeInverseBudget s p + let r := (q + C) ^ C + have hq : 0 ≤ q := by dsimp [q, derivativeInverseBudget]; positivity + have hr : 0 ≤ r := by dsimp [r]; positivity + have hshared : 0 ≤ (r + a) ^ a := by positivity + have hcost : q + (r + a) ^ a + 2 ≤ (p + D) ^ D := by + simpa [Q, R, X, q, r, derivativeInverseBudget, Polynomial.eval₂_pow] using hbudget p hp + have hsharedD : (r + a) ^ a ≤ (p + D) ^ D := by linarith + obtain ⟨H, hH, hdense, g, F, hcorr⟩ := exists_native_derivative_correlators hI f hf hp hG + let J := {h // h ∈ H} + have hJ : (Finset.univ : Finset J).Nonempty := by + obtain ⟨h, hh⟩ := hH + exact ⟨⟨h, hh⟩, Finset.mem_univ _⟩ + obtain ⟨h₀, _, E, hE, H₁, S, _, hH₁, hdense₁, hS, hsame, hcS⟩ := + hcommon (fun h : J => (F h).model) (fun h => (F h).test) Finset.univ hJ hr + (fun h => (F h).complexity) (fun h _ => (F h).norm) + (fun h x => multiplicativeDerivative f h.val x) + (fun h _ x => multiplicativeDerivative_norm_le_one f hf h.val x) + (fun h _ => by simpa only [← (F h).eval] using hcorr h) + let H' := H₁.image Subtype.val + let selected (h : ZMod N) : J := if hh : h ∈ H then ⟨h, hh⟩ else h₀ + have hcard : H'.card = H₁.card := Finset.card_image_of_injective _ Subtype.val_injective + have huniv : (Finset.univ : Finset J).card = H.card := by simp [J] + have hfinaldensity : Real.exp (-((p + D) ^ D)) * Fintype.card (ZMod N) ≤ (H'.card : ℝ) := by + calc + _ ≤ Real.exp (-(q + (r + a) ^ a)) * Fintype.card (ZMod N) := + mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg (by linarith))) + (Nat.cast_nonneg _) + _ = Real.exp (-((r + a) ^ a)) * (Real.exp (-q) * Fintype.card (ZMod N)) := by + rw [← mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ Real.exp (-((r + a) ^ a)) * H.card := + mul_le_mul_of_nonneg_left hdense (Real.exp_nonneg _) + _ ≤ _ := by simpa only [hcard, huniv] using hdense₁ + refine ⟨{ + L := (F h₀).L + dim := (F h₀).dim + model := E + geometry := hE.mono E hsharedD + shifts := H' + nonempty := hH₁.image _ + density := hfinaldensity + test := fun h => S (selected h) + norm := fun h => (hS (selected h)).1 + complexity := fun h => (hS (selected h)).2.2.mono hsharedD + common_observable := fun h k => hsame (selected h) (selected k) + correlation := ?_ }⟩ + intro h hh + obtain ⟨j, hj, rfl⟩ := Finset.mem_image.mp hh + have hselect : selected j.val = j := by simp only [selected, dite_eq_left j.property] + rw [hselect] + exact (Real.exp_le_exp.mpr (neg_le_neg hsharedD)).trans (hcS j hj) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeCommonDerivativeModels.lie NativeCommonDerivativeModels.algebra + NativeCommonDerivativeModels.topology NativeCommonDerivativeModels.topologicalAdd + NativeCommonDerivativeModels.continuousSMul NativeCommonDerivativeModels.hausdorff + +theorem NativeCommonDerivativeModels.exists_large_common_observable {s N : ℕ} [NeZero N] + {p : ℝ} {f : ZMod N → ℂ} (B : NativeCommonDerivativeModels s N p f) + (hf : ∀ x, ‖f x‖ ≤ 1) : + ∃ y : B.model.Space, Real.exp (-p) ≤ ‖(B.test 0).observable y‖ := by + obtain ⟨h, hh⟩ := B.nonempty + have hmean : Real.exp (-p) ≤ 𝔼 x, ‖(B.test h).evalCyclic N (fun _ => x)‖ := by + apply (B.correlation h hh).trans + apply (RCLike.norm_expect_le (K := ℂ)).trans + apply Finset.expect_le_expect + intro x _ + rw [norm_mul, norm_star] + exact mul_le_of_le_one_left (norm_nonneg _) (multiplicativeDerivative_norm_le_one f hf h x) + obtain ⟨x, _, hx⟩ := Finset.exists_le_of_le_expect Finset.univ_nonempty hmean + refine ⟨QuotientGroup.mk (B.model.filtration.realification.polynomialOrbitEval + (fun _ : Unit => 1) (fun _ => (x.val : ℤ)) (B.test h).orbit), ?_⟩ + rw [B.common_observable 0 h] + exact hx + +theorem exists_native_unit_vertical_data (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ} {f : ZMod N → ℂ} + (B : NativeCommonDerivativeModels s N p f) (V : NativeVerticalDerivativeData B), + 0 ≤ p → (∀ x, ‖f x‖ ≤ 1) → + Nonempty (NativeUnitVerticalData B V ((p + C) ^ C)) := by + obtain ⟨C, hC, hcomplete⟩ := RationalFilteredNilmanifold.exists_native_unit_vertical_completion s + refine ⟨C, hC, ?_⟩ + intro N _ p f B V hp hf + obtain ⟨y, hy⟩ := B.exists_large_common_observable hf + obtain ⟨n, _, hn, K, hK, v, hv0, hvunit, hvnorm, hvLip, hvvertical⟩ := + hcomplete B.model (B.test 0) hp (B.complexity 0) (B.norm 0) V.frequency + (V.vertical 0) y hy + refine ⟨{ + tailDim := n + dimension := hn + observable := v + lipBound := K + lip_bound := hK + unit := hvunit + norm := hvnorm + lipschitz := hvLip + scalar := ?_ + vertical := hvvertical + }⟩ + intro h x + rw [hv0, B.common_observable 0 h] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct + +attribute [local instance] NativeCommonDerivativeModels.lie NativeCommonDerivativeModels.algebra + NativeCommonDerivativeModels.topology NativeCommonDerivativeModels.topologicalAdd + NativeCommonDerivativeModels.continuousSMul NativeCommonDerivativeModels.hausdorff + +theorem exists_normalized_native_inverse_models {s C : ℕ} (hI : CyclicNativeInverse s C) : + ∃ D : ℕ, 2 ≤ D ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm (s + 2) f → + ∃ R : NativeCommonDerivativeModels s N ((p + D) ^ D) f, + ∀ h, R.model.filtration.realification.polynomialOrbitEval (fun _ => 1) 0 + (R.test h).orbit = 1 := by + obtain ⟨a, _, hmodels⟩ := exists_native_common_derivative_models hI + obtain ⟨b, _, hnormalize⟩ := exists_normalized_native_common_models s + let X : Polynomial ℕ := Polynomial.X + obtain ⟨D, hD, hbudget⟩ := exists_natPolynomial_eval_budget + (((X + Polynomial.C a) ^ a + Polynomial.C b) ^ b) + refine ⟨D, hD, ?_⟩ + intro N _ p hp f hf hG + have hq : 0 ≤ (p + a) ^ a := by positivity + have hcost : ((p + a) ^ a + b) ^ b ≤ (p + D) ^ D := by + simpa [X, Polynomial.eval₂_pow] using hbudget p hp + obtain ⟨B⟩ := hmodels hp f hf hG + obtain ⟨R, hR⟩ := hnormalize hq hf B + exact ⟨R.mono hcost, hR⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem exists_vertical_native_inverse_models {s C : ℕ} (hI : CyclicNativeInverse s C) : + ∃ D : ℕ, 2 ≤ D ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm (s + 2) f → + ∃ R : NativeCommonDerivativeModels s N ((p + D) ^ D) f, + Nonempty (NativeVerticalDerivativeData R) := by + obtain ⟨a, _, hmodels⟩ := exists_normalized_native_inverse_models hI + obtain ⟨b, _, hvertical⟩ := exists_native_vertical_derivative_models + let X : Polynomial ℕ := Polynomial.X + obtain ⟨D, hD, hbudget⟩ := exists_natPolynomial_eval_budget + (((X + Polynomial.C a) ^ a + Polynomial.C b) ^ b) + refine ⟨D, hD, ?_⟩ + intro N _ p hp f hf hG + have hq : 0 ≤ (p + a) ^ a := by positivity + have hcost : ((p + a) ^ a + b) ^ b ≤ (p + D) ^ D := by + simpa [X, Polynomial.eval₂_pow] using hbudget p hp + obtain ⟨B, hB⟩ := hmodels hp f hf hG + obtain ⟨R, ⟨V⟩⟩ := hvertical hq hf B hB + exact ⟨R.mono hcost, ⟨V.mono hcost⟩⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem exists_unit_vertical_native_inverse_models {s C : ℕ} (hI : CyclicNativeInverse s C) : + ∃ D : ℕ, 2 ≤ D ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm (s + 2) f → + ∃ R : NativeCommonDerivativeModels s N ((p + D) ^ D) f, + ∃ V : NativeVerticalDerivativeData R, + Nonempty (NativeUnitVerticalData R V ((p + D) ^ D)) := by + obtain ⟨a, _, hmodels⟩ := exists_vertical_native_inverse_models hI + obtain ⟨b, _, hunit⟩ := exists_native_unit_vertical_data s + let X : Polynomial ℕ := Polynomial.X + let P := (X + Polynomial.C a) ^ a + obtain ⟨D, hD, hbudget⟩ := exists_natPolynomial_eval_budget (P + (P + Polynomial.C b) ^ b) + refine ⟨D, hD, ?_⟩ + intro N _ p hp f hf hG + have hp0 : 0 ≤ (p + a) ^ a := by positivity + have hp1 : 0 ≤ ((p + a) ^ a + b) ^ b := by positivity + have htotal : (p + a) ^ a + ((p + a) ^ a + b) ^ b ≤ (p + D) ^ D := by + simpa [P, X, Polynomial.eval₂_pow] using hbudget p hp + have h0 : (p + a) ^ a ≤ (p + D) ^ D := by linarith + have h1 : ((p + a) ^ a + b) ^ b ≤ (p + D) ^ D := by linarith + obtain ⟨B, ⟨V⟩⟩ := hmodels hp f hf hG + obtain ⟨U⟩ := hunit B V hp0 hf + exact ⟨B.mono h0, V.mono h0, ⟨U.mono h0 h1⟩⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnnormalizedCommonSymbolFactorization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnnormalizedCommonSymbolFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..d055d8d9f46b8dcaa1d77b5ef750878882dd09ba --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnnormalizedCommonSymbolFactorization.lean @@ -0,0 +1,1290 @@ +import OAI.Combinatorics.Progressions.Dynamics.CommonInitialBudget +import OAI.Combinatorics.Progressions.Dynamics.CommonTerminalBudget +import OAI.Combinatorics.Progressions.Dynamics.TerminalCompositionBudget +import OAI.Combinatorics.Progressions.Estimates.TerminalControlledFactorization +import OAI.Combinatorics.Progressions.Geometry.FullFastCoefficientCoordinates + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_derivative_difference_inputs + {σ κ : Type*} [Fintype σ] [Fintype κ] + (T : σ → ℝ) (scale : κ → ℝ) (Y : (σ → ℝ) →ₗ[ℝ] (κ → ℝ)) + (A : Matrix κ κ ℝ) (l : ℕ) (H : Finset (σ → ℤ)) (h₀ : σ → ℤ) (R : ℝ) + (hinputs : ∀ h ∈ H, ∃ r : κ → ℝ, r ∈ realDenominatorGrid l ∧ + ‖derivativeGridPoint T scale Y A (h - h₀) r‖ ≤ R) : + ∃ D : Finset (σ → ℤ), D.card = H.card ∧ + ∃ q : (σ → ℤ) → κ → ℝ, ∀ h ∈ D, + q h ∈ realDenominatorGrid l ∧ ‖derivativeGridPoint T scale Y A h (q h)‖ ≤ R := by + classical + let D := H.image (fun h => h - h₀) + let q : (σ → ℤ) → κ → ℝ := fun h => + if hh : h + h₀ ∈ H then (hinputs (h + h₀) hh).choose else 0 + refine ⟨D, ?_, q, ?_⟩ + · apply Finset.card_image_iff.mpr + intro h _ k _ he + simpa only [sub_add_cancel] using congrArg (fun x => x + h₀) he + · intro h hh + have hh' : h + h₀ ∈ H := by + obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hh + simpa only [sub_add_cancel] using hk + simpa only [q, dite_eq_left hh', add_sub_cancel_right] using + (hinputs (h + h₀) hh').choose_spec + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (w : σ → ℕ) + +theorem realPolynomialSymbolHom_groupHom_coord (g : F.RealAdaptedPolynomialGroup w) : + (F.realPolynomialSymbolHom b ω hF w (F.realAdaptedPolynomialGroupHom w g)).coord = + F.realExtendedSymbolMap w g.coord := + F.realSymbolOfPolynomial_realAdaptedPolynomialMap b ω hF w g.coord + +noncomputable def nativeSymbolNormalize (g : F.RealAdaptedPolynomialGroup w) : + F.RealAdaptedPolynomialGroup w := + F.realAdaptedPolynomialGroupLift w b ω hF + (F.realPolynomialSymbolLift b ω hF w + (F.realPolynomialSymbolHom b ω hF w (F.realAdaptedPolynomialGroupHom w g))) + +theorem nativeSymbolNormalize_symbol (g : F.RealAdaptedPolynomialGroup w) : + F.realExtendedSymbolMap w (F.nativeSymbolNormalize b ω hF w g).coord = + F.realExtendedSymbolMap w g.coord := by + have he : F.realPolynomialSymbolHom b ω hF w + (F.realAdaptedPolynomialGroupHom w (F.nativeSymbolNormalize b ω hF w g)) = + F.realPolynomialSymbolHom b ω hF w (F.realAdaptedPolynomialGroupHom w g) := by + unfold nativeSymbolNormalize + rw [F.realAdaptedPolynomialGroupHom_lift, F.realPolynomialSymbolHom_lift] + have hc := congrArg NilpotentLieBCHGroup.coord he + simpa only [F.realPolynomialSymbolHom_groupHom_coord] using hc + +theorem nativeSymbolNormalize_constant (g : F.RealAdaptedPolynomialGroup w) : + coefficients (F.realAdaptedPolynomialMap w (F.nativeSymbolNormalize b ω hF w g).coord) 0 = 0 := by + let X : F.RealPolynomialSymbolGroup w := + F.realPolynomialSymbolHom b ω hF w (F.realAdaptedPolynomialGroupHom w g) + have hX : coefficients (F.realSymbolRepresentative b ω hF w X.coord) 0 = 0 := + F.realSymbolRepresentative_constant b ω hF w X.coord + change coefficients (F.realAdaptedPolynomialGroupHom w + (F.realAdaptedPolynomialGroupLift w b ω hF (F.realPolynomialSymbolLift b ω hF w X))).coord.val 0 = 0 + rw [F.realAdaptedPolynomialGroupHom_lift, F.realPolynomialSymbolLift_log, hX] + +theorem realAdaptedGradedPolynomialHom_eq_of_symbol_eq + (g h : F.RealAdaptedPolynomialGroup w) + (he : F.realExtendedSymbolMap w g.coord = F.realExtendedSymbolMap w h.coord) : + F.realAdaptedGradedPolynomialHom b ω hF w g = F.realAdaptedGradedPolynomialHom b ω hF w h := by + apply NilpotentLieBCHGroup.ext + change F.realAdaptedGradedPolynomialLie b ω hF w g.coord = + F.realAdaptedGradedPolynomialLie b ω hF w h.coord + rw [F.realAdaptedGradedPolynomialLie_symbol, F.realAdaptedGradedPolynomialLie_symbol] + change F.realGradedSymbolPolynomial b ω hF w (F.realExtendedSymbolMap w g.coord) = + F.realGradedSymbolPolynomial b ω hF w (F.realExtendedSymbolMap w h.coord) + rw [he] + +include b ω hF in +theorem realFirstCoefficientDirectionMap_eq_of_symbol_eq [Fintype σ] + (g h : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) + (he : F.realExtendedSymbolMap (fun _ => 1) g.coord = F.realExtendedSymbolMap (fun _ => 1) h.coord) : + F.realFirstCoefficientDirectionMap g.coord = F.realFirstCoefficientDirectionMap h.coord := by + classical + apply (Pi.basisFun ℝ σ).ext + intro i + apply F.realFirstCoefficientGradedPolynomial_injective b ω hF (fun _ => 1) + change F.realFirstCoefficientGradedPolynomial b ω hF (fun _ => 1) + (F.realFirstCoefficientDirectionMap g.coord (Pi.single i 1)) = + F.realFirstCoefficientGradedPolynomial b ω hF (fun _ => 1) + (F.realFirstCoefficientDirectionMap h.coord (Pi.single i 1)) + rw [F.realFirstCoefficientGradedPolynomial_direction, F.realFirstCoefficientGradedPolynomial_direction, + F.realAdaptedGradedPolynomialHom_eq_of_symbol_eq b ω hF (fun _ => 1) g h he] + +include b ω hF in +theorem realFirstCoefficientAdjoint_eq_of_symbol_eq + (g h : F.RealAdaptedPolynomialGroup w) + (he : F.realExtendedSymbolMap w g.coord = F.realExtendedSymbolMap w h.coord) + (x : F.RealFirstCoefficientModule w) : + F.realFirstCoefficientAdjoint w g x = F.realFirstCoefficientAdjoint w h x := by + apply F.realFirstCoefficientGradedPolynomial_injective b ω hF w + rw [F.realFirstCoefficientGradedPolynomial_adjoint, F.realFirstCoefficientGradedPolynomial_adjoint, + F.realAdaptedGradedPolynomialHom_eq_of_symbol_eq b ω hF w g h he] + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix + +theorem bounded_coefficient_derivative_point + {σ ι κ L : Type*} [Fintype σ] [Fintype κ] [DecidableEq κ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol (fun _ : σ => 1))) + (b : Basis κ ℝ (F.RealFirstCoefficientModule (fun _ : σ => 1) ⧸ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U))) + (rows : κ → FirstCoefficientIndex (fun _ : σ => 1) ω) + (B : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) + (hB : (F.adaptedReducedRealSymbolHom (fun _ => 1) B).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra (fun _ => 1) U)) + (T : σ → ℝ) (hT : ∀ i, 0 < T i) (C M N : ℝ) + (hC : 0 ≤ C) (hM : 0 ≤ M) (hN : 0 ≤ N) (l m : ℕ) + (hslow : ∀ x, F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T (M + N) x → ∀ i, + |b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) i| ≤ + C * (M + N) / monomialScale T (rows i).val.1) + (hgrid : ∀ x, F.FirstCoefficientGrid e ω hF (fun _ => 1) l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) ∈ realDenominatorGrid m) + (h h₀ : σ → ℤ) (hhbox : ∀ i, |(h i : ℝ)| ≤ T i) (hh₀box : ∀ i, |(h₀ i : ℝ)| ≤ T i) + (S S₀ R R₀ Z : F.RealFirstCoefficientModule (fun _ : σ => 1)) + (hh : F.realFirstCoefficientDirectionMap B.coord (fun i => (h i : ℝ)) - + (S + F.realFirstCoefficientAdjoint (fun _ => 1) B R + Z) ∈ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)) + (hh₀ : F.realFirstCoefficientDirectionMap B.coord (fun i => (h₀ i : ℝ)) - + (S₀ + F.realFirstCoefficientAdjoint (fun _ => 1) B R₀ + Z) ∈ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)) + (hS : F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T M S) + (hS₀ : F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T N S₀) + (hR : F.FirstCoefficientGrid e ω hF (fun _ => 1) l R) + (hR₀ : F.FirstCoefficientGrid e ω hF (fun _ => 1) l R₀) : + let Y := F.fastCoefficientDirectionCoordinates U b B + let A := LinearMap.toMatrix b b (F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB).toLinearMap + let scale := fun i => monomialScale T (rows i).val.1 + ∃ r : κ → ℝ, r ∈ realDenominatorGrid m ∧ + derivativeGridPoint T scale Y A (h - h₀) r ∈ derivativeGridPoints T scale Y A m ∧ + ‖derivativeGridPoint T scale Y A (h - h₀) r‖ ≤ max 2 (C * (M + N)) := by + dsimp only + let V := F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U) + let r := b.equivFun (V.mkQ (R - R₀)) + let a := b.equivFun (V.mkQ (S - S₀)) + have hdiff := F.coefficient_common_derivative_difference V B + (fun i => (h i : ℝ)) (fun i => (h₀ i : ℝ)) S S₀ R R₀ Z hh hh₀ + have hdiff' : F.realFirstCoefficientDirectionMap B.coord (fun i => ((h - h₀) i : ℝ)) - + ((S - S₀) + F.realFirstCoefficientAdjoint (fun _ => 1) B (R - R₀)) ∈ V := by + have hcast : (fun i => ((h - h₀) i : ℝ)) = + (fun i => (h i : ℝ)) - (fun i => (h₀ i : ℝ)) := by + funext i + simp only [Pi.sub_apply, Int.cast_sub] + rw [hcast] + exact hdiff + have heq := F.fastCoefficientDerivative_coordinates U b B hB + (fun i => ((h - h₀) i : ℝ)) (S - S₀) (R - R₀) hdiff' + have hr : r ∈ realDenominatorGrid m := hgrid (R - R₀) + (F.firstCoefficientGrid_sub e ω hF (fun _ => 1) l R R₀ hR hR₀) + have ha : ∀ i, |a i| ≤ C * (M + N) / monomialScale T (rows i).val.1 := + hslow (S - S₀) (F.firstCoefficientSlowBound_sub e ω hF (fun _ => 1) T M N S S₀ hS hS₀) + refine ⟨r, hr, derivativeGridPoint_mem _ _ _ _ m (h - h₀) r hr, ?_⟩ + apply derivativeGridPoint_bound T hT _ (fun i => monomialScale_pos T hT (rows i).val.1) + _ _ (h - h₀) r a 2 (C * (M + N)) (by norm_num) (mul_nonneg hC (add_nonneg hM hN)) ?_ heq ha + intro i + change |((h i - h₀ i : ℤ) : ℝ)| ≤ 2 * T i + rw [Int.cast_sub] + exact (abs_sub _ _).trans (by linarith [hhbox i, hh₀box i]) + +theorem bounded_coefficient_derivative_family + {σ ι κ L : Type*} [Fintype σ] [Fintype κ] [DecidableEq κ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol (fun _ : σ => 1))) + (b : Basis κ ℝ (F.RealFirstCoefficientModule (fun _ : σ => 1) ⧸ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U))) + (rows : κ → FirstCoefficientIndex (fun _ : σ => 1) ω) + (B : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) + (hB : (F.adaptedReducedRealSymbolHom (fun _ => 1) B).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra (fun _ => 1) U)) + (T : σ → ℝ) (hT : ∀ i, 0 < T i) (C M : ℝ) (hC : 0 ≤ C) (hM : 0 ≤ M) (l m : ℕ) + (hslow : ∀ x, F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T (M + M) x → ∀ i, + |b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) i| ≤ + C * (M + M) / monomialScale T (rows i).val.1) + (hgrid : ∀ x, F.FirstCoefficientGrid e ω hF (fun _ => 1) l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) ∈ realDenominatorGrid m) + (H : Finset (σ → ℤ)) (h₀ : σ → ℤ) (hh₀ : h₀ ∈ H) + (S R : (σ → ℤ) → F.RealFirstCoefficientModule (fun _ : σ => 1)) + (Z : F.RealFirstCoefficientModule (fun _ : σ => 1)) + (hbox : ∀ h ∈ H, ∀ i, |(h i : ℝ)| ≤ T i) + (hcommon : ∀ h ∈ H, F.realFirstCoefficientDirectionMap B.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ => 1) B (R h) + Z) ∈ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)) + (hS : ∀ h ∈ H, F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T M (S h)) + (hR : ∀ h ∈ H, F.FirstCoefficientGrid e ω hF (fun _ => 1) l (R h)) : + let Y := F.fastCoefficientDirectionCoordinates U b B + let A := LinearMap.toMatrix b b (F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB).toLinearMap + let scale := fun i => monomialScale T (rows i).val.1 + ∃ P : Finset ((σ → ℝ) × (κ → ℝ)), P.card = H.card ∧ + ∀ v ∈ P, v ∈ derivativeGridPoints T scale Y A m ∧ ‖v‖ ≤ max 2 (C * (M + M)) := by + dsimp only + apply exists_bounded_derivativeGridPoint_family T (fun i => (hT i).ne') _ _ _ m H h₀ + (max 2 (C * (M + M))) + intro h hh + have hp := F.bounded_coefficient_derivative_point e ω hF U b rows B hB T hT C M M hC hM hM l m + hslow hgrid h h₀ (hbox h hh) (hbox h₀ hh₀) (S h) (S h₀) (R h) (R h₀) Z + (hcommon h hh) (hcommon h₀ hh₀) (hS h hh) (hS h₀ hh₀) (hR h hh) (hR h₀ hh₀) + obtain ⟨r, hr, _, hbound⟩ := hp + exact ⟨r, hr, hbound⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix + +theorem bounded_coefficient_difference_inputs + {σ ι κ L : Type*} [Fintype σ] [Fintype κ] [DecidableEq κ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol (fun _ : σ => 1))) + (b : Basis κ ℝ (F.RealFirstCoefficientModule (fun _ : σ => 1) ⧸ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U))) + (rows : κ → FirstCoefficientIndex (fun _ : σ => 1) ω) + (B : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) + (hB : (F.adaptedReducedRealSymbolHom (fun _ => 1) B).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra (fun _ => 1) U)) + (T : σ → ℝ) (hT : ∀ i, 0 < T i) (C M : ℝ) (hC : 0 ≤ C) (hM : 0 ≤ M) (l m : ℕ) + (hslow : ∀ x, F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T (M + M) x → ∀ i, + |b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) i| ≤ + C * (M + M) / monomialScale T (rows i).val.1) + (hgrid : ∀ x, F.FirstCoefficientGrid e ω hF (fun _ => 1) l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) ∈ realDenominatorGrid m) + (H : Finset (σ → ℤ)) (h₀ : σ → ℤ) (hh₀ : h₀ ∈ H) + (S R : (σ → ℤ) → F.RealFirstCoefficientModule (fun _ : σ => 1)) + (Z : F.RealFirstCoefficientModule (fun _ : σ => 1)) + (hbox : ∀ h ∈ H, ∀ i, |(h i : ℝ)| ≤ T i) + (hcommon : ∀ h ∈ H, F.realFirstCoefficientDirectionMap B.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ => 1) B (R h) + Z) ∈ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)) + (hS : ∀ h ∈ H, F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T M (S h)) + (hR : ∀ h ∈ H, F.FirstCoefficientGrid e ω hF (fun _ => 1) l (R h)) : + let Y := F.fastCoefficientDirectionCoordinates U b B + let A := LinearMap.toMatrix b b (F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB).toLinearMap + let scale := fun i => monomialScale T (rows i).val.1 + ∃ D : Finset (σ → ℤ), D.card = H.card ∧ + ∃ q : (σ → ℤ) → κ → ℝ, ∀ h ∈ D, + q h ∈ realDenominatorGrid m ∧ + ‖derivativeGridPoint T scale Y A h (q h)‖ ≤ max 2 (C * (M + M)) := by + dsimp only + apply exists_derivative_difference_inputs T _ _ _ m H h₀ (max 2 (C * (M + M))) + intro h hh + obtain ⟨r, hr, _, hnorm⟩ := F.bounded_coefficient_derivative_point + e ω hF U b rows B hB T hT C M M hC hM hM l m hslow hgrid + h h₀ (hbox h hh) (hbox h₀ hh₀) (S h) (S h₀) (R h) (R h₀) Z + (hcommon h hh) (hcommon h₀ hh₀) (hS h hh) (hS h₀ hh₀) (hR h hh) (hR h₀ hh₀) + exact ⟨r, hr, hnorm⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix TensorProduct + +theorem common_coefficient_derivative_system + {σ ι L : Type*} [Fintype σ] [DecidableEq σ] {d : ℕ} + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol (fun _ : σ => 1))) + (b : Basis (Fin d) ℝ (F.RealFirstCoefficientModule (fun _ : σ => 1) ⧸ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U))) + (rows : Fin d → FirstCoefficientIndex (fun _ : σ => 1) ω) + (hblock : ∀ i j, (rows j).val.1 ≠ i.val.1 → + b.repr ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ + (F.realFirstCoefficientBasis e ω hF (fun _ => 1) i)) j = 0) + (B : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) + (hB : (F.adaptedReducedRealSymbolHom (fun _ => 1) B).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra (fun _ => 1) U)) + (T : σ → ℝ) (hT : ∀ i, 1 ≤ T i) (C M : ℝ) (hC : 0 ≤ C) (hM : 0 ≤ M) (l m : ℕ) + (hslow : ∀ x, F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T (M + M) x → ∀ i, + |b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) i| ≤ + C * (M + M) / monomialScale T (rows i).val.1) + (hgrid : ∀ x, F.FirstCoefficientGrid e ω hF (fun _ => 1) l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) ∈ realDenominatorGrid m) + (H : Finset (σ → ℤ)) (h₀ : σ → ℤ) (hh₀ : h₀ ∈ H) + (S R : (σ → ℤ) → F.RealFirstCoefficientModule (fun _ : σ => 1)) + (Z : F.RealFirstCoefficientModule (fun _ : σ => 1)) + (hbox : ∀ h ∈ H, ∀ i, |(h i : ℝ)| ≤ T i) + (hcommon : ∀ h ∈ H, F.realFirstCoefficientDirectionMap B.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ => 1) B (R h) + Z) ∈ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)) + (hS : ∀ h ∈ H, F.FirstCoefficientSlowBound e ω hF (fun _ => 1) T M (S h)) + (hR : ∀ h ∈ H, F.FirstCoefficientGrid e ω hF (fun _ => 1) l (R h)) + (haction : ∀ i j, ω (rows i).val.2 ≤ ω (rows j).val.2 → + LinearMap.toMatrix b b + (F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB).toLinearMap i j = + (1 : Matrix (Fin d) (Fin d) ℝ) i j) + (hm : 0 < m) (δ p : ℝ) (hδ : 0 < δ) (hp : 0 ≤ p) + (hdense : δ * ∏ i, T i ≤ (H.card : ℝ)) + (hdim : ((Fintype.card σ + Fintype.card (Fin d) : ℕ) : ℝ) ≤ p) + (hmcap : (m : ℝ) ≤ Real.exp p) (hRcap : max 2 (C * (M + M)) ≤ Real.exp p) + (hδcap : δ⁻¹ ≤ Real.exp p) (Tmin : ℝ) + (hmin : Real.exp ((p + 2) ^ 3) < Tmin) (hside : ∀ i, Tmin ≤ T i) : + ∃ (perm : Equiv.Perm (Fin d)) (a : ℕ) (ha : a ≤ d), + (∀ i, i.val < a ↔ (rows (perm i)).val.1 = 0) ∧ + let b' := b.reindex perm.symm + let f := F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB + let A' := b'.equivFun.symm.trans (f.trans b'.equivFun) + ∃ η : (Fin a → ℝ) ≃ₗ[ℝ] (ℝ ⊗[ℚ] (L ⧸ F.layer 2)), + (∀ x, η (fun i => b'.equivFun x (Fin.castLE ha i)) = + F.realFastCoefficientHorizontal (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U) x) ∧ + Nonempty (CoordinateDerivativeSystem ha T (F.fastCoefficientDirectionCoordinates U b' B) A' + (fun i => monomialScale T (rows (perm i)).val.1) (Real.exp ((p + 2) ^ 3))) := by + have hTpos : ∀ i, 0 < T i := fun i => lt_of_lt_of_le zero_lt_one (hT i) + obtain ⟨D, hDcard, q, hq⟩ := F.bounded_coefficient_difference_inputs e ω hF U b rows + B hB T hTpos C M hC hM l m hslow hgrid H h₀ hh₀ S R Z hbox hcommon hS hR + let V := F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U) + let Y := V.mkQ.comp (F.realFirstCoefficientDirectionMap B.coord) + let f := F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB + have hDdense : δ * ∏ i, T i ≤ (D.card : ℝ) := by rw [hDcard]; exact hdense + obtain ⟨perm, a, ha, hzero, hsystem⟩ := + firstCoefficient_coordinate_system ω rows b Y f haction T hT m hm + (max 2 (C * (M + M))) δ + ((by norm_num : (1 : ℝ) ≤ 2).trans (le_max_left _ _)) hδ D q + (fun h hh => (hq h hh).1) (fun h hh => (hq h hh).2) hDdense + p hp hdim hmcap hRcap hδcap Tmin hmin hside + have hblock' : ∀ i j, (rows (perm j)).val.1 ≠ i.val.1 → + (b.reindex perm.symm).repr (V.mkQ + (F.realFirstCoefficientBasis e ω hF (fun _ => 1) i)) j = 0 := by + intro i j hij + simpa only [Basis.repr_reindex_apply, Equiv.symm_symm] using hblock i (perm j) hij + let η := F.realFastCoefficientHorizontalEquiv e ω hF (fun _ : σ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U) + (b.reindex perm.symm) (fun i => rows (perm i)) hblock' ha hzero + refine ⟨perm, a, ha, hzero, η, ?_, hsystem⟩ + exact F.realFastCoefficientHorizontalEquiv_projection e ω hF (fun _ : σ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U) + (b.reindex perm.symm) (fun i => rows (perm i)) hblock' ha hzero + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped Matrix TensorProduct + +universe uσ uι uτ uL + +variable {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] + [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "Wf" => F.fastPointwiseSquare e ω hF (fun _ : σ => 1) W +local notation "Uf" => F.reducedSquareFastRelativeSubmodule (fun _ : σ => 1) Wf +local notation "J" => F.realFirstCoefficientFastSubmodule (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf +local notation "E" => F.RealFirstCoefficientModule (fun _ : σ => 1) +local notation "Q" => (E ⧸ J) +local notation "G" => F.realFastDiagonalSubgroup (fun _ : σ => 1) Wf +local notation "ρ" => F.realFastCoefficientAction (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Wf + +def BoundedInitialStateFactorization (g₀ : G) (T : σ → ℝ) (rankBound : ℕ) (p : ℝ) : Prop := + ∃ k : ℕ, k ≤ rankBound ∧ + ∃ (K : Submodule ℚ (L ⧸ F.layer 2)) (bK : Basis (Fin k) ℚ K), + ∃ Hk : ℕ, 1 ≤ Hk ∧ (Hk : ℝ) ≤ Real.exp p ∧ + (∀ i j, RationalHeightLE ((F.layerOneBasis e ω hF).repr (bK j).val i) Hk) ∧ + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp p ∧ + ∃ x g z : G, x * g * z = g₀ ∧ + F.RealAdaptedCoefficientBound e ω hF (fun _ : σ => 1) T (Real.exp p) x.val.coord ∧ + F.RealAdaptedCoefficientGrid e ω hF (fun _ : σ => 1) m z.val.coord ∧ + ∃ X : F.associatedGradedFiltration.FormalInductionState (F.associatedGradedBasis e ω hF) ω + (realificationLieSubalgebra (F.fullFastGradedDiagonal W)) + (F.fullFastGradedRelative e ω hF W) (F.gradedHorizontalKernel e ω hF K) + (F.gradedHorizontalKernelBasis e ω hF K bK) T 2 p, + X.P = F.realAdaptedGradedPolynomialHom e ω hF (fun _ : σ => 1) g.val + +def CommonInitialStateSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hτ : (Fintype.card τ : ℝ) ≤ p) (_hd : (d : ℝ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (v : τ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hheight : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + (g₀ : G) (_hzero : coefficients (F.realAdaptedPolynomialMap (fun _ : σ => 1) g₀.val.coord) 0 = 0) + (b : Basis (Fin d) ℝ Q) (rows : Fin d → FirstCoefficientIndex (fun _ : σ => 1) ω) + (sectionMap : (Fin d → ℝ) →ₗ[ℝ] E) + (_hsection : ∀ y, (J).mkQ (sectionMap y) = b.equivFun.symm y) + (Cscale : ℝ) (_hC : 0 ≤ Cscale) (_hCp : Cscale ≤ Real.exp p) + (_hweighted : ∀ (T : σ → ℝ), (∀ i, 0 < T i) → ∀ M : ℝ, 0 ≤ M → + (∀ x, F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T M x → ∀ i, + |b.equivFun ((J).mkQ x) i| ≤ Cscale * M / monomialScale T (rows i).val.1) ∧ + (∀ y, (∀ i, |y i| ≤ M / monomialScale T (rows i).val.1) → + F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T (Cscale * M) (sectionMap y))) + (δ : ℕ) (_hδ : 0 < δ) (_hδp : (δ : ℝ) ≤ Real.exp p) + (_hprojectionGrid : ∀ m x, F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) m x → + b.equivFun ((J).mkQ x) ∈ realDenominatorGrid (δ * m)) + (_hsectionGrid : ∀ m (y : Fin d → ℝ), y ∈ realDenominatorGrid m → + F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) (δ * m) (sectionMap y)) + (_hblock : ∀ i j, (rows j).val.1 ≠ i.val.1 → + b.repr ((J).mkQ (F.realFirstCoefficientBasis e ω hF (fun _ : σ => 1) i)) j = 0) + (_haction : ∀ i j, ω (rows i).val.2 ≤ ω (rows j).val.2 → + LinearMap.toMatrix b b (ρ g₀).toLinearMap i j = (1 : Matrix (Fin d) (Fin d) ℝ) i j) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (M : ℝ) (_hM : 0 ≤ M) (_hMp : M ≤ Real.exp p) + (l : ℕ) (_hl : 0 < l) (_hlp : (l : ℝ) ≤ Real.exp p) + (Hshifts : Finset (σ → ℤ)) (h₀ : σ → ℤ) (_hh₀ : h₀ ∈ Hshifts) + (S R : (σ → ℤ) → E) (Z : E) + (_hbox : ∀ h ∈ Hshifts, ∀ i, |(h i : ℝ)| ≤ T i) + (_hcommon : ∀ h ∈ Hshifts, F.realFirstCoefficientDirectionMap g₀.val.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ : σ => 1) g₀.val (R h) + Z) ∈ J) + (_hS : ∀ h ∈ Hshifts, F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T M (S h)) + (_hR : ∀ h ∈ Hshifts, F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) l (R h)) + (density : ℝ) (_hdensity : 0 < density) (_hdensityp : density⁻¹ ≤ Real.exp p) + (_hdense : density * ∏ i, T i ≤ (Hshifts.card : ℝ)), + F.BoundedInitialStateFactorization e ω hF W g₀ T d ((p + C) ^ C) + +theorem exists_initialFormalState_from_common (C D : ℕ) + (hbudget : ∀ p : ℝ, 0 ≤ p → + commonInitialParameter p + 1 ≤ (p + D) ^ D ∧ + (commonInitialParameter p + 2) ^ 3 ≤ (p + D) ^ D ∧ + (commonInitialParameter p + C) ^ C ≤ (p + D) ^ D) + (hinit : ∀ a : ℕ, F.ExtractedInitialStateSpec (σ := σ) (τ := τ) (a := a) (d := d) e ω hF W C) : + F.CommonInitialStateSpec (σ := σ) (τ := τ) (d := d) e ω hF W D := by + intro H p hH hp hι hσ hτ hd hHp hstructure hW v hv hheight g₀ hzero + b rows sectionMap hsection Cscale hC hCp hweighted δ hδ hδp hprojectionGrid hsectionGrid + hblock haction T hT M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z hbox hcommon hS hR + density hdensity hdensityp hdense + let q := commonExtractionParameter p + let r := commonInitialParameter p + have hcontrol := commonExtractionParameter_controls hp + have hpq : p ≤ q := hcontrol.1 + have hqr : q ≤ r := hcontrol.2.2.2 + have hpr : p ≤ r := hpq.trans hqr + have hq : 0 ≤ q := hp.trans hpq + have hr : 0 ≤ r := hp.trans hpr + have hepq := Real.exp_le_exp.mpr hpq + have hepr := Real.exp_le_exp.mpr hpr + have hb := hbudget p hp + have hTpos (i : σ) : 0 < T i := (Real.exp_pos _).trans_le (hT i) + have hTlarge (i : σ) : Real.exp (r + 1) ≤ T i := + (Real.exp_le_exp.mpr hb.1).trans (hT i) + have hTone (i : σ) : 1 ≤ T i := (Real.one_le_exp (by linarith : 0 ≤ r + 1)).trans (hTlarge i) + have hproducts := commonExtractionParameter_products hp hC hCp hM hMp δ l hδp hlp + have hdim : ((Fintype.card σ + Fintype.card (Fin d) : ℕ) : ℝ) ≤ q := by + rw [Nat.cast_add, Fintype.card_fin] + calc + _ ≤ p + p := add_le_add hσ hd + _ ≤ q := by linarith [hcontrol.2.1] + have hmin : Real.exp ((q + 2) ^ 3) < Real.exp (r + 1) := + Real.exp_lt_exp.mpr (by change r < r + 1; linarith) + have hextract := F.common_coefficient_derivative_system e ω hF Wf b rows hblock + g₀.val g₀.property T hTone Cscale M hC hM l (δ * l) + ((hweighted T hTpos (M + M) (add_nonneg hM hM)).1) + (hprojectionGrid l) Hshifts h₀ hh₀ S R Z hbox hcommon hS hR haction + (Nat.mul_pos hδ hl) density q hdensity hq hdense hdim hproducts.2 hproducts.1 + (hdensityp.trans hepq) (Real.exp (r + 1)) hmin hTlarge + obtain ⟨perm, a, ha, _, η, hη, ⟨sys⟩⟩ := hextract + have hsection' := F.exists_reindexed_fast_coefficient_section e ω hF + (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf b rows sectionMap hsection δ Cscale + hprojectionGrid hsectionGrid hweighted perm + obtain ⟨sectionMap', hright', hproj', hgrid', hweighted'⟩ := hsection' + have har : (a : ℝ) ≤ r := (Nat.cast_le.mpr ha).trans (hd.trans hpr) + have hTr (i : σ) : Real.exp ((r + C) ^ C) ≤ T i := + (Real.exp_le_exp.mpr hb.2.2).trans (hT i) + have hout := hinit a H r hH hr (hι.trans hpr) (hσ.trans hpr) (hτ.trans hpr) har + (hHp.trans hepr) hstructure hW v hv hheight g₀ hzero (b.reindex perm.symm) + (fun i => rows (perm i)) ha η hη sectionMap' hright' Cscale hC (hCp.trans hepr) + hweighted' δ hδ (hδp.trans hepr) hproj' hgrid' T hTr + (Real.exp r) (Real.exp_nonneg _) le_rfl sys + obtain ⟨hk, K, bK, Hk, hHk, hHkp, hKheight, m, hm, hmp, x, g, z, hfactor, hx, hz, X, hX⟩ := hout + refine ⟨sys.k, hk.trans ha, K, bK, Hk, hHk, + hHkp.trans (Real.exp_le_exp.mpr hb.2.1), hKheight, m, hm, + hmp.trans (Real.exp_le_exp.mpr hb.2.2), x, g, z, hfactor, ?_, hz, + X.enlarge hb.2.2 hTpos, hX⟩ + exact F.realAdaptedCoefficientBound_mono e ω hF (fun _ => 1) T hTpos + (Real.exp_le_exp.mpr hb.2.2) x.val.coord hx + +theorem exists_common_initialState_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) (d : ℕ), + F.CommonInitialStateSpec (σ := σ) (τ := τ) (d := d) e ω hF W C := by + have h := exists_extracted_initialState_bound.{uσ, uι, uτ, uL} s + obtain ⟨C, _, hinit⟩ := h + obtain ⟨D, hD, hbudget⟩ := exists_commonInitialParameter_budget C + refine ⟨D, hD, ?_⟩ + intro σ ι τ L _ _ _ _ _ _ F e ω hF W d + exact F.exists_initialFormalState_from_common e ω hF W C D hbudget + (fun a => hinit F e ω hF W a d) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +universe uσ uι uτ uL + +variable {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "Wf" => F.fastPointwiseSquare e ω hF (fun _ : σ => 1) W +local notation "Uf" => F.reducedSquareFastRelativeSubmodule (fun _ : σ => 1) Wf +local notation "J" => F.realFirstCoefficientFastSubmodule (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf +local notation "E" => F.RealFirstCoefficientModule (fun _ : σ => 1) +local notation "G" => F.realFastDiagonalSubgroup (fun _ : σ => 1) Wf + +omit [Fintype σ] [DecidableEq σ] [Fintype ι] in +theorem BoundedInitialStateFactorization.mono + {g₀ : G} {T : σ → ℝ} {d d' : ℕ} {p q : ℝ} + (h : F.BoundedInitialStateFactorization e ω hF W g₀ T d p) + (hd : d ≤ d') (hpq : p ≤ q) (hT : ∀ i, 0 < T i) : + F.BoundedInitialStateFactorization e ω hF W g₀ T d' q := by + obtain ⟨k, hk, K, bK, Hk, hHk, hHkp, hKb, m, hm, hmp, x, g, z, hfactor, hx, hz, X, hX⟩ := h + have hepq := Real.exp_le_exp.mpr hpq + refine ⟨k, hk.trans hd, K, bK, Hk, hHk, hHkp.trans hepq, hKb, m, hm, hmp.trans hepq, + x, g, z, hfactor, ?_, hz, X.enlarge hpq hT, hX⟩ + exact F.realAdaptedCoefficientBound_mono e ω hF (fun _ => 1) T hT hepq x.val.coord hx + +def FullInitialStateSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hτ : (Fintype.card τ : ℝ) ≤ p) (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (v : τ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hheight : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + (g₀ : G) (_hzero : coefficients (F.realAdaptedPolynomialMap (fun _ : σ => 1) g₀.val.coord) 0 = 0) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (M : ℝ) (_hM : 0 ≤ M) (_hMp : M ≤ Real.exp p) + (l : ℕ) (_hl : 0 < l) (_hlp : (l : ℝ) ≤ Real.exp p) + (Hshifts : Finset (σ → ℤ)) (h₀ : σ → ℤ) (_hh₀ : h₀ ∈ Hshifts) + (S R : (σ → ℤ) → E) (Z : E) + (_hbox : ∀ h ∈ Hshifts, ∀ i, |(h i : ℝ)| ≤ T i) + (_hcommon : ∀ h ∈ Hshifts, F.realFirstCoefficientDirectionMap g₀.val.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ : σ => 1) g₀.val (R h) + Z) ∈ J) + (_hS : ∀ h ∈ Hshifts, F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T M (S h)) + (_hR : ∀ h ∈ Hshifts, F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) l (R h)) + (density : ℝ) (_hdensity : 0 < density) (_hdensityp : density⁻¹ ≤ Real.exp p) + (_hdense : density * ∏ i, T i ≤ (Hshifts.card : ℝ)), + F.BoundedInitialStateFactorization e ω hF W g₀ T + (Fintype.card ι * (s + 2) * (Fintype.card σ + 1) ^ (s + 1)) ((p + C) ^ C) + +omit [DecidableEq σ] in +theorem exists_initialFormalState_from_common_family (c C D : ℕ) + (hcoords : FullFastCoefficientCoordinateSpec.{uσ, uι, uτ, uL} s c) + (hcommonState : ∀ d : ℕ, + F.CommonInitialStateSpec (σ := σ) (τ := τ) (d := d) e ω hF W C) + (hbudget : ∀ p : ℝ, 0 ≤ p → (fullInitialParameter s c p + C) ^ C ≤ (p + D) ^ D) : + F.FullInitialStateSpec (σ := σ) (τ := τ) e ω hF W D := by + intro H p hH hp hι hσ hτ hHp hstructure hW v hv hheight g₀ hzero T hT + M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z hbox hcommon hS hR density hdensity hdensityp hdense + have hcoordinateData := hcoords F e ω hF (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) + W hW v hv hH hheight hp hι hσ hτ hHp + obtain ⟨d, hd, rows, _, b, sectionMap, δ, hδ, hδp, hproj, hgrid, hright, + hweighted, hblock, haction⟩ := hcoordinateData + let q := fullInitialParameter s c p + have hcontrol := fullInitialParameter_controls s c hp + have hpq : p ≤ q := hcontrol.1 + have hq : 0 ≤ q := hp.trans hpq + have hepq := Real.exp_le_exp.mpr hpq + have hcoordinateBound : Real.exp ((p + c) ^ c) ≤ Real.exp q := + Real.exp_le_exp.mpr hcontrol.2.2 + have hdim : (d : ℝ) ≤ q := by + have hd' : (d : ℝ) ≤ + (Fintype.card ι : ℝ) * (s + 2) * ((Fintype.card σ : ℝ) + 1) ^ (s + 1) := by + exact_mod_cast hd + apply hd'.trans + apply le_trans _ hcontrol.2.1 + gcongr + have hTpos (i : σ) : 0 < T i := (Real.exp_pos _).trans_le (hT i) + have hTq (i : σ) : Real.exp ((q + C) ^ C) ≤ T i := + (Real.exp_le_exp.mpr (hbudget p hp)).trans (hT i) + have hout := hcommonState d H q hH hq (hι.trans hpq) (hσ.trans hpq) (hτ.trans hpq) hdim + (hHp.trans hepq) hstructure hW v hv hheight g₀ hzero b rows sectionMap hright + (Real.exp ((p + c) ^ c)) (Real.exp_nonneg _) hcoordinateBound hweighted + δ hδ (hδp.trans hcoordinateBound) hproj hgrid hblock (haction g₀.val g₀.property) + T hTq M hM (hMp.trans hepq) l hl (hlp.trans hepq) Hshifts h₀ hh₀ S R Z + hbox hcommon hS hR density hdensity (hdensityp.trans hepq) hdense + exact hout.mono F e ω hF W hd (hbudget p hp) hTpos + +theorem exists_full_initialState_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded), + F.FullInitialStateSpec (σ := σ) (τ := τ) e ω hF W C := by + have h₁ := exists_fullFast_coefficient_coordinate_bound.{uσ, uι, uτ, uL} s + obtain ⟨c, _, hcoords⟩ := h₁ + have h₂ := exists_common_initialState_bound.{uσ, uι, uτ, uL} s + obtain ⟨C, _, hcommonState⟩ := h₂ + obtain ⟨D, hD, hbudget⟩ := exists_fullInitialParameter_budget s c C + refine ⟨D, hD, ?_⟩ + intro σ ι τ L _ _ _ _ _ _ F e ω hF W + exact F.exists_initialFormalState_from_common_family e ω hF W c C D hcoords + (hcommonState F e ω hF W) hbudget + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +universe uσ uι uτ uL + +variable {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "G" => F.realFastDiagonalSubgroup (fun _ : σ => 1) (F.fastPointwiseSquare e ω hF (fun _ => 1) W) + +def NormalizedTerminalFactorization (g₀ : G) (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (T : σ → ℝ) (p : ℝ) : Prop := + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp p ∧ + ∃ x g z : G, x * g * z = g₀ ∧ + F.RealAdaptedCoefficientBound e ω hF (fun _ : σ => 1) T (Real.exp p) x.val.coord ∧ + F.RealAdaptedCoefficientGrid e ω hF (fun _ : σ => 1) m z.val.coord ∧ + F.FastTerminalFactorization e ω hF W η T + (F.realAdaptedGradedPolynomialHom e ω hF (fun _ : σ => 1) g.val) p + +omit [Fintype σ] [Fintype ι] in +theorem NormalizedTerminalFactorization.mono + {g₀ : G} {η : F.AssociatedGraded →ₗ[ℚ] ℚ} {T : σ → ℝ} {p q : ℝ} + (h : F.NormalizedTerminalFactorization e ω hF W g₀ η T p) + (hpq : p ≤ q) (hT : ∀ i, 0 < T i) : + F.NormalizedTerminalFactorization e ω hF W g₀ η T q := by + obtain ⟨m, hm, hmp, x, g, z, hfactor, hx, hz, hterminal⟩ := h + refine ⟨m, hm, hmp.trans (Real.exp_le_exp.mpr hpq), x, g, z, hfactor, ?_, hz, + hterminal.mono F e ω hF W hpq hT⟩ + exact F.realAdaptedCoefficientBound_mono e ω hF (fun _ => 1) T hT + (Real.exp_le_exp.mpr hpq) x.val.coord hx + +def NormalizedTerminalStateSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) (_hs : 1 ≤ s) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hτ : (Fintype.card τ : ℝ) ≤ p) (_hsp : (s + 1 : ℕ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (v : τ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hheight : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (_hη : ∀ x ∈ F.fullFastGradedRelative e ω hF W, + basisGradeProjection (F.associatedGradedBasis e ω hF) ω (s + 1) x = x → η x = 0) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (g₀ : G) (d : ℕ) (_hd : (d : ℝ) ≤ p) + (_hinitial : F.BoundedInitialStateFactorization e ω hF W g₀ T d p), + F.NormalizedTerminalFactorization e ω hF W g₀ η T ((p + C) ^ C) + +theorem exists_normalized_terminalState_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded), + F.NormalizedTerminalStateSpec (σ := σ) (τ := τ) e ω hF W C := by + have h := exists_fast_terminalState_bound.{uσ, uι, uτ, uL} s + obtain ⟨C, hC, hterminal⟩ := h + refine ⟨C, hC, ?_⟩ + intro σ ι τ L _ _ _ _ _ F e ω hF W H p hH hp hs hι hσ hτ hsp hHp hstructure + hW v hv hheight η hη T hT g₀ d hd hinitial + obtain ⟨k, hk, K, bK, Hk, _, hHkp, hKb, m, hm, hmp, x, g, z, hfactor, hx, hz, X, hX⟩ := hinitial + have hcommon : ((max H Hk : ℕ) : ℝ) ≤ Real.exp p := by + rw [Nat.cast_max] + exact max_le hHp hHkp + have hkr : (k : ℝ) ≤ p := (Nat.cast_le.mpr hk).trans hd + have hout := hterminal F e ω hF W (max H Hk) p (hH.trans (le_max_left _ _)) hp hs + hι hσ hτ hsp hcommon (fun i j k => (hstructure i j k).mono (le_max_left _ _)) + hW v hv (fun j i => (hheight j i).mono (le_max_left _ _)) k hkr K bK + (fun i j => (hKb i j).mono (le_max_right _ _)) η hη T hT X + have hTpos (i : σ) : 0 < T i := (Real.exp_pos _).trans_le (hT i) + have hpC : p ≤ (p + C) ^ C := by + have hCr : (2 : ℝ) ≤ C := Nat.cast_le.mpr hC + calc + p ≤ p + C := le_add_of_nonneg_right (Nat.cast_nonneg C) + _ ≤ (p + C) ^ C := by + simpa only [pow_one] using pow_le_pow_right₀ (by linarith : (1 : ℝ) ≤ p + C) + (show 1 ≤ C by omega) + refine ⟨m, hm, hmp.trans (Real.exp_le_exp.mpr hpC), x, g, z, hfactor, ?_, hz, ?_⟩ + · exact F.realAdaptedCoefficientBound_mono e ω hF (fun _ => 1) T hTpos + (Real.exp_le_exp.mpr hpC) x.val.coord hx + · exact (congrArg (fun P => F.FastTerminalFactorization e ω hF W η T P ((p + C) ^ C)) hX).mp hout + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +universe uσ uι uτ uL + +variable {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "Wf" => F.fastPointwiseSquare e ω hF (fun _ : σ => 1) W +local notation "Uf" => F.reducedSquareFastRelativeSubmodule (fun _ : σ => 1) Wf +local notation "J" => F.realFirstCoefficientFastSubmodule (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf +local notation "E" => F.RealFirstCoefficientModule (fun _ : σ => 1) +local notation "G" => F.realFastDiagonalSubgroup (fun _ : σ => 1) Wf + +def CommonTerminalStateSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) (_hs : 1 ≤ s) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hτ : (Fintype.card τ : ℝ) ≤ p) (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (v : τ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hheight : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (_hη : ∀ x ∈ F.fullFastGradedRelative e ω hF W, + basisGradeProjection (F.associatedGradedBasis e ω hF) ω (s + 1) x = x → η x = 0) + (g₀ : G) (_hzero : coefficients (F.realAdaptedPolynomialMap (fun _ : σ => 1) g₀.val.coord) 0 = 0) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (M : ℝ) (_hM : 0 ≤ M) (_hMp : M ≤ Real.exp p) + (l : ℕ) (_hl : 0 < l) (_hlp : (l : ℝ) ≤ Real.exp p) + (Hshifts : Finset (σ → ℤ)) (h₀ : σ → ℤ) (_hh₀ : h₀ ∈ Hshifts) + (S R : (σ → ℤ) → E) (Z : E) + (_hbox : ∀ h ∈ Hshifts, ∀ i, |(h i : ℝ)| ≤ T i) + (_hcommon : ∀ h ∈ Hshifts, F.realFirstCoefficientDirectionMap g₀.val.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ : σ => 1) g₀.val (R h) + Z) ∈ J) + (_hS : ∀ h ∈ Hshifts, F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T M (S h)) + (_hR : ∀ h ∈ Hshifts, F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) l (R h)) + (density : ℝ) (_hdensity : 0 < density) (_hdensityp : density⁻¹ ≤ Real.exp p) + (_hdense : density * ∏ i, T i ≤ (Hshifts.card : ℝ)), + F.NormalizedTerminalFactorization e ω hF W g₀ η T ((p + C) ^ C) + +theorem exists_common_terminalState_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded), + F.CommonTerminalStateSpec (σ := σ) (τ := τ) e ω hF W C := by + have h₁ := exists_full_initialState_bound.{uσ, uι, uτ, uL} s + obtain ⟨c, _, hinit⟩ := h₁ + have h₂ := exists_normalized_terminalState_bound.{uσ, uι, uτ, uL} s + obtain ⟨C, _, hterminal⟩ := h₂ + obtain ⟨D, hD, hbudget⟩ := exists_commonTerminalParameter_budget s c C + refine ⟨D, hD, ?_⟩ + intro σ ι τ L _ _ _ _ _ _ F e ω hF W H p hH hp hs hι hσ hτ hHp hstructure + hW v hv hheight η hη g₀ hzero T hT + M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z hbox hcommon hS hR density hdensity hdensityp hdense + let q := commonTerminalParameter s c p + have hcontrol := commonTerminalParameter_controls s c hp + have hpq : p ≤ q := hcontrol.1 + have hq : 0 ≤ q := hp.trans hpq + have hp₀q : (p + c) ^ c ≤ q := hcontrol.2.2.1 + have hqfinal : q ≤ (p + D) ^ D := (hbudget p hp).1 + have hTpos (i : σ) : 0 < T i := (Real.exp_pos _).trans_le (hT i) + have hTinitial (i : σ) : Real.exp ((p + c) ^ c) ≤ T i := + (Real.exp_le_exp.mpr (hp₀q.trans hqfinal)).trans (hT i) + have hi := hinit F e ω hF W H p hH hp hι hσ hτ hHp hstructure hW v hv hheight g₀ hzero + T hTinitial M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z hbox hcommon hS hR density hdensity hdensityp hdense + have hiq := hi.mono F e ω hF W le_rfl hp₀q hTpos + have hd : ((Fintype.card ι * (s + 2) * (Fintype.card σ + 1) ^ (s + 1) : ℕ) : ℝ) ≤ q := by + rw [Nat.cast_mul, Nat.cast_mul, Nat.cast_add, Nat.cast_pow, Nat.cast_add, Nat.cast_one, Nat.cast_ofNat] + apply le_trans _ hcontrol.2.1 + gcongr + have hTterminal (i : σ) : Real.exp ((q + C) ^ C) ≤ T i := + (Real.exp_le_exp.mpr (hbudget p hp).2).trans (hT i) + have hout := hterminal F e ω hF W H q hH hq hs (hι.trans hpq) (hσ.trans hpq) (hτ.trans hpq) + hcontrol.2.2.2 (hHp.trans (Real.exp_le_exp.mpr hpq)) hstructure hW v hv hheight + η hη T hTterminal g₀ _ hd hiq + exact hout.mono F e ω hF W (hbudget p hp).2 hTpos + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup + +universe uσ uι uL + +variable {σ : Type uσ} {ι : Type uι} {L : Type uL} + [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "G" => F.realFastDiagonalSubgroup (fun _ : σ => 1) (F.fastPointwiseSquare e ω hF (fun _ => 1) W) + +def TerminalCompositionSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) (T : σ → ℝ) (_hT : ∀ i, 0 < T i) (g₀ : G), + F.NormalizedTerminalFactorization e ω hF W g₀ η T p → + F.FastTerminalFactorization e ω hF W η T + (F.realAdaptedGradedPolynomialHom e ω hF (fun _ : σ => 1) g₀.val) ((p + C) ^ C) + +theorem exists_terminalComposition_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {L : Type uL} + [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded), + F.TerminalCompositionSpec (σ := σ) e ω hF W C := by + have hs := exists_formal_polynomial_product_bound.{uσ, uι, uL} (s + 1) 1 2 + obtain ⟨a, _, hslow⟩ := hs + have hr := exists_formal_polynomial_product_grid.{uσ, uι, uL} (s + 1) 2 + obtain ⟨b, _, hgrid⟩ := hr + obtain ⟨C, hC, hbudget⟩ := exists_terminalComposition_budget a b + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F e ω hF W H p hH hp hι hσ hHp hstructure hW η T hT g₀ hn + obtain ⟨l, hl, hlp, x, g, z, hnative, hx, hz, hterminal⟩ := hn + obtain ⟨Z, hZ, hZη, bZ, hbZ, A, P, B, hformal, hA, hB, hzero, hdegree, hcoeff, + hAbound, m, hm, hmp, hBgrid⟩ := hterminal + let φ := F.realAdaptedGradedPolynomialHom e ω hF (fun _ : σ => 1) + let bG := F.associatedGradedBasis e ω hF + let FG := F.associatedGradedFiltration + have hgraded := F.associatedGradedBasis_homogeneous_brackets e ω hF + have hlayers := F.associatedGradedFiltration_layer e ω hF + have hstructureG (i j k : ι) : RationalHeightLE (bG.repr ⁅bG i, bG j⁆ k) H := by + rw [F.associatedGradedBasis_bracket e ω hF] + split_ifs + · exact hstructure i j k + · exact rationalHeightLE_zero hH + have h2p : 0 ≤ 2 * p := by positivity + have hp2 : p ≤ 2 * p := by linarith + have hι2 := hι.trans hp2 + have hσ2 := hσ.trans hp2 + have hH2 := hHp.trans (Real.exp_le_exp.mpr hp2) + have hxb := F.realAdaptedGradedPolynomialHom_bound e ω hF (fun _ : σ => 1) T hT + (Real.exp_nonneg p) x.val hx + have hzg := F.realAdaptedGradedPolynomialHom_grid e ω hF (fun _ : σ => 1) l z.val hz + have hxc := F.realAdaptedGradedPolynomialHom_correction e ω hF W hW x + have hzc := F.realAdaptedGradedPolynomialHom_correction e ω hF W hW z + have hinput : Real.exp p ≤ Real.exp ((2 * p + 2) ^ 1) := + Real.exp_le_exp.mpr (by rw [pow_one]; linarith) + have hleft := hslow FG bG ω hlayers H (2 * p) hH h2p hι2 hσ2 hH2 hstructureG T hT + [φ x.val, A] (by simp) (by + intro r hr + simp only [List.mem_cons, List.not_mem_nil, or_false] at hr + rcases hr with rfl | rfl + · exact FG.gradedPolynomial_mem_adapted bG ω hlayers (fun _ => 1) _ hxc.2.1 + · exact FG.gradedPolynomial_mem_adapted bG ω hlayers (fun _ => 1) _ hA.2.1) (by + intro r hr + simp only [List.mem_cons, List.not_mem_nil, or_false] at hr + rcases hr with rfl | rfl + · exact hxb.mono _ T hT hinput + · exact hAbound.mono _ T hT hinput) + have hleftBound : CoefficientBound (bG.baseChange ℝ) T (Real.exp ((2 * p + a) ^ a)) + (φ x.val * A).coord := by + simpa only [List.prod_cons, List.prod_nil, mul_one] using hleft + have hdenom : ((l * m : ℕ) : ℝ) ≤ Real.exp (2 * p) := by + rw [Nat.cast_mul] + calc + _ ≤ Real.exp p * Real.exp p := mul_le_mul hlp hmp (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = Real.exp (2 * p) := by rw [← Real.exp_add]; congr 1; ring + have hcommonB : CoefficientGrid (bG.baseChange ℝ) (l * m) B.coord := + fun α => realDenominatorGrid_subset_of_dvd hm (dvd_mul_left m l) (hBgrid α) + have hcommonz : CoefficientGrid (bG.baseChange ℝ) (l * m) (φ z.val).coord := + fun α => realDenominatorGrid_subset_of_dvd hl (dvd_mul_right l m) (hzg α) + have hg := hgrid FG bG ω hlayers H (2 * p) hH h2p hι2 hσ2 hH2 hstructureG + (l * m) (Nat.mul_pos hl hm) hdenom + obtain ⟨n, hn, hnp, _, hproducts⟩ := hg + have hright := hproducts [B, φ z.val] (by simp) (by + intro r hr + simp only [List.mem_cons, List.not_mem_nil, or_false] at hr + rcases hr with rfl | rfl + · exact FG.gradedPolynomial_mem_adapted bG ω hlayers (fun _ => 1) _ hB.2.1 + · exact FG.gradedPolynomial_mem_adapted bG ω hlayers (fun _ => 1) _ hzc.2.1) (by + intro r hr + simp only [List.mem_cons, List.not_mem_nil, or_false] at hr + rcases hr with rfl | rfl + · exact hcommonB + · exact hcommonz) + have hrightGrid : CoefficientGrid (bG.baseChange ℝ) n (B * φ z.val).coord := by + simpa only [List.prod_cons, List.prod_nil, mul_one] using hright + have hnative' : φ x.val * φ g.val * φ z.val = φ g₀.val := by + calc + _ = φ (x.val * g.val * z.val) := by simp only [map_mul] + _ = φ g₀.val := congrArg φ (congrArg Subtype.val hnative) + have hfactor : (φ x.val * A) * P * (B * φ z.val) = φ g₀.val := by + calc + _ = φ x.val * (A * P * B) * φ z.val := by group + _ = φ x.val * φ g.val * φ z.val := congrArg (fun t => φ x.val * t * φ z.val) hformal + _ = _ := hnative' + have hb := hbudget p hp + have hep := Real.exp_le_exp.mpr hb.1 + exact ⟨Z, hZ, hZη, bZ, fun i j => ⟨(hbZ i j).1.trans hep, (hbZ i j).2.trans hep⟩, + φ x.val * A, P, B * φ z.val, hfactor, hxc.mul hgraded hA, hB.mul hgraded hzc, + hzero, hdegree, hcoeff, hleftBound.mono _ T hT (Real.exp_le_exp.mpr hb.2.1), + n, hn, hnp.trans (Real.exp_le_exp.mpr hb.2.2), hrightGrid⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +universe uσ uι uτ uL + +variable {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "Wf" => F.fastPointwiseSquare e ω hF (fun _ : σ => 1) W +local notation "Uf" => F.reducedSquareFastRelativeSubmodule (fun _ : σ => 1) Wf +local notation "J" => F.realFirstCoefficientFastSubmodule (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf +local notation "E" => F.RealFirstCoefficientModule (fun _ : σ => 1) +local notation "G" => F.realFastDiagonalSubgroup (fun _ : σ => 1) Wf + +def CommonFactorizationSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) (_hs : 1 ≤ s) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hτ : (Fintype.card τ : ℝ) ≤ p) (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (v : τ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hheight : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (_hη : ∀ x ∈ F.fullFastGradedRelative e ω hF W, + basisGradeProjection (F.associatedGradedBasis e ω hF) ω (s + 1) x = x → η x = 0) + (g₀ : G) (_hzero : coefficients (F.realAdaptedPolynomialMap (fun _ : σ => 1) g₀.val.coord) 0 = 0) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (M : ℝ) (_hM : 0 ≤ M) (_hMp : M ≤ Real.exp p) + (l : ℕ) (_hl : 0 < l) (_hlp : (l : ℝ) ≤ Real.exp p) + (Hshifts : Finset (σ → ℤ)) (h₀ : σ → ℤ) (_hh₀ : h₀ ∈ Hshifts) + (S R : (σ → ℤ) → E) (Z : E) + (_hbox : ∀ h ∈ Hshifts, ∀ i, |(h i : ℝ)| ≤ T i) + (_hcommon : ∀ h ∈ Hshifts, F.realFirstCoefficientDirectionMap g₀.val.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ : σ => 1) g₀.val (R h) + Z) ∈ J) + (_hS : ∀ h ∈ Hshifts, F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T M (S h)) + (_hR : ∀ h ∈ Hshifts, F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) l (R h)) + (density : ℝ) (_hdensity : 0 < density) (_hdensityp : density⁻¹ ≤ Real.exp p) + (_hdense : density * ∏ i, T i ≤ (Hshifts.card : ℝ)), + F.FastTerminalFactorization e ω hF W η T + (F.realAdaptedGradedPolynomialHom e ω hF (fun _ : σ => 1) g₀.val) ((p + C) ^ C) + +theorem exists_commonFactorization_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded), + F.CommonFactorizationSpec (σ := σ) (τ := τ) e ω hF W C := by + have h₁ := exists_common_terminalState_bound.{uσ, uι, uτ, uL} s + obtain ⟨c, _, hcommon⟩ := h₁ + have h₂ := exists_terminalComposition_bound.{uσ, uι, uL} s + obtain ⟨C, _, hcompose⟩ := h₂ + obtain ⟨D, hD, hbudget⟩ := exists_commonTerminalParameter_budget s c C + refine ⟨D, hD, ?_⟩ + intro σ ι τ L _ _ _ _ _ _ F e ω hF W H p hH hp hs hι hσ hτ hHp hstructure + hW v hv hheight η hη g₀ hzero T hT M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z + hbox hcommonIdentity hS hR density hdensity hdensityp hdense + let q := commonTerminalParameter s c p + have hcontrol := commonTerminalParameter_controls s c hp + have hpq : p ≤ q := hcontrol.1 + have hq : 0 ≤ q := hp.trans hpq + have hp₀q : (p + c) ^ c ≤ q := hcontrol.2.2.1 + have hTpos (i : σ) : 0 < T i := (Real.exp_pos _).trans_le (hT i) + have hTcommon (i : σ) : Real.exp ((p + c) ^ c) ≤ T i := + (Real.exp_le_exp.mpr (hp₀q.trans (hbudget p hp).1)).trans (hT i) + have hn := hcommon F e ω hF W H p hH hp hs hι hσ hτ hHp hstructure hW v hv hheight + η hη g₀ hzero T hTcommon M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z hbox hcommonIdentity + hS hR density hdensity hdensityp hdense + have hnq := hn.mono F e ω hF W hp₀q hTpos + have hout := hcompose F e ω hF W H q hH hq (hι.trans hpq) (hσ.trans hpq) + (hHp.trans (Real.exp_le_exp.mpr hpq)) hstructure hW η T hTpos g₀ hnq + exact hout.mono F e ω hF W (hbudget p hp).2 hTpos + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +universe uσ uι uτ uL + +variable {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "Wf" => F.fastPointwiseSquare e ω hF (fun _ : σ => 1) W +local notation "Uf" => F.reducedSquareFastRelativeSubmodule (fun _ : σ => 1) Wf +local notation "J" => F.realFirstCoefficientFastSubmodule (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf +local notation "E" => F.RealFirstCoefficientModule (fun _ : σ => 1) +local notation "G" => F.realFastDiagonalSubgroup (fun _ : σ => 1) Wf + +def CommonSymbolFactorizationSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) (_hs : 1 ≤ s) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hτ : (Fintype.card τ : ℝ) ≤ p) (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (v : τ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hheight : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (_hη : ∀ x ∈ F.fullFastGradedRelative e ω hF W, + basisGradeProjection (F.associatedGradedBasis e ω hF) ω (s + 1) x = x → η x = 0) + (g₀ : G) (_hzero : coefficients (F.realAdaptedPolynomialMap (fun _ : σ => 1) g₀.val.coord) 0 = 0) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (M : ℝ) (_hM : 0 ≤ M) (_hMp : M ≤ Real.exp p) + (l : ℕ) (_hl : 0 < l) (_hlp : (l : ℝ) ≤ Real.exp p) + (Hshifts : Finset (σ → ℤ)) (h₀ : σ → ℤ) (_hh₀ : h₀ ∈ Hshifts) + (S R : (σ → ℤ) → E) (Z : E) + (_hbox : ∀ h ∈ Hshifts, ∀ i, |(h i : ℝ)| ≤ T i) + (_hcommon : ∀ h ∈ Hshifts, F.realFirstCoefficientDirectionMap g₀.val.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ : σ => 1) g₀.val (R h) + Z) ∈ J) + (_hS : ∀ h ∈ Hshifts, F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T M (S h)) + (_hR : ∀ h ∈ Hshifts, F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) l (R h)) + (density : ℝ) (_hdensity : 0 < density) (_hdensityp : density⁻¹ ≤ Real.exp p) + (_hdense : density * ∏ i, T i ≤ (Hshifts.card : ℝ)), + F.SymbolTerminalFactorization e ω hF W η T + (F.realPolynomialSymbolHom e ω hF (fun _ : σ => 1) + (F.realAdaptedPolynomialGroupHom (fun _ : σ => 1) g₀.val)) ((p + C) ^ C) + +theorem exists_common_symbolFactorization_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded), + F.CommonSymbolFactorizationSpec (σ := σ) (τ := τ) e ω hF W C := by + have h := exists_commonFactorization_bound.{uσ, uι, uτ, uL} s + obtain ⟨C, hC, hfactor⟩ := h + refine ⟨C, hC, ?_⟩ + intro σ ι τ L _ _ _ _ _ _ F e ω hF W H p hH hp hs hι hσ hτ hHp hstructure + hW v hv hheight η hη g₀ hzero T hT M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z + hbox hcommon hS hR density hdensity hdensityp hdense + apply F.symbolTerminalFactorization_of_native e ω hF W η T g₀.val ((p + C) ^ C) + exact hfactor F e ω hF W H p hH hp hs hι hσ hτ hHp hstructure hW v hv hheight η hη g₀ hzero + T hT M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z hbox hcommon hS hR density hdensity hdensityp hdense + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +universe uσ uι uτ uL + +variable {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "Wf" => F.fastPointwiseSquare e ω hF (fun _ : σ => 1) W +local notation "Uf" => F.reducedSquareFastRelativeSubmodule (fun _ : σ => 1) Wf +local notation "J" => F.realFirstCoefficientFastSubmodule (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf +local notation "E" => F.RealFirstCoefficientModule (fun _ : σ => 1) +local notation "G" => F.realFastDiagonalSubgroup (fun _ : σ => 1) Wf + +def UnnormalizedCommonSymbolFactorizationSpec (C : ℕ) : Prop := + ∀ (H : ℕ) (p : ℝ) (_hH : 1 ≤ H) (_hp : 0 ≤ p) (_hs : 1 ≤ s) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hτ : (Fintype.card τ : ℝ) ≤ p) (_hHp : (H : ℝ) ≤ Real.exp p) + (_hstructure : ∀ i j k, RationalHeightLE (e.repr ⁅e i, e j⁆ k) H) + (_hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (v : τ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hv : Submodule.span ℚ (Set.range v) = W.toSubmodule) + (_hheight : ∀ j i, RationalHeightLE ((bW).repr (v j) i) H) + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (_hη : ∀ x ∈ F.fullFastGradedRelative e ω hF W, + basisGradeProjection (F.associatedGradedBasis e ω hF) ω (s + 1) x = x → η x = 0) + (g₀ : G) + (T : σ → ℝ) (_hT : ∀ i, Real.exp ((p + C) ^ C) ≤ T i) + (M : ℝ) (_hM : 0 ≤ M) (_hMp : M ≤ Real.exp p) + (l : ℕ) (_hl : 0 < l) (_hlp : (l : ℝ) ≤ Real.exp p) + (Hshifts : Finset (σ → ℤ)) (h₀ : σ → ℤ) (_hh₀ : h₀ ∈ Hshifts) + (S R : (σ → ℤ) → E) (Z : E) + (_hbox : ∀ h ∈ Hshifts, ∀ i, |(h i : ℝ)| ≤ T i) + (_hcommon : ∀ h ∈ Hshifts, F.realFirstCoefficientDirectionMap g₀.val.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ : σ => 1) g₀.val (R h) + Z) ∈ J) + (_hS : ∀ h ∈ Hshifts, F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T M (S h)) + (_hR : ∀ h ∈ Hshifts, F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) l (R h)) + (density : ℝ) (_hdensity : 0 < density) (_hdensityp : density⁻¹ ≤ Real.exp p) + (_hdense : density * ∏ i, T i ≤ (Hshifts.card : ℝ)), + F.SymbolTerminalFactorization e ω hF W η T + (F.realPolynomialSymbolHom e ω hF (fun _ : σ => 1) + (F.realAdaptedPolynomialGroupHom (fun _ : σ => 1) g₀.val)) ((p + C) ^ C) + +theorem exists_unnormalized_common_symbolFactorization_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ : Type uσ} {ι : Type uι} {τ : Type uτ} {L : Type uL} + [Fintype σ] [DecidableEq σ] [Fintype ι] [Fintype τ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded), + F.UnnormalizedCommonSymbolFactorizationSpec (σ := σ) (τ := τ) e ω hF W C := by + obtain ⟨C, hC, hfactor⟩ := exists_common_symbolFactorization_bound.{uσ, uι, uτ, uL} s + refine ⟨C, hC, ?_⟩ + intro σ ι τ L _ _ _ _ _ _ F e ω hF W H p hH hp hs hι hσ hτ hHp hstructure + hW v hv hheight η hη g₀ T hT M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z + hbox hcommon hS hR density hdensity hdensityp hdense + let g := F.nativeSymbolNormalize e ω hF (fun _ : σ => 1) g₀.val + have hsymbol : F.realExtendedSymbolMap (fun _ => 1) g.coord = + F.realExtendedSymbolMap (fun _ => 1) g₀.val.coord := + F.nativeSymbolNormalize_symbol e ω hF (fun _ => 1) g₀.val + have hprojection : F.adaptedReducedRealSymbolHom (fun _ => 1) g = + F.adaptedReducedRealSymbolHom (fun _ => 1) g₀.val := by + apply NilpotentLieBCHGroup.ext + rw [F.adaptedReducedRealSymbolHom_coord, F.adaptedReducedRealSymbolHom_coord, hsymbol] + have hfast : g ∈ F.realFastDiagonalSubgroup (fun _ => 1) + (F.fastPointwiseSquare e ω hF (fun _ => 1) W) := by + rw [F.mem_realFastDiagonalSubgroup, hprojection] + exact g₀.property + let g' : F.realFastDiagonalSubgroup (fun _ : σ => 1) + (F.fastPointwiseSquare e ω hF (fun _ => 1) W) := ⟨g, hfast⟩ + have hzero : coefficients (F.realAdaptedPolynomialMap (fun _ => 1) g'.val.coord) 0 = 0 := + F.nativeSymbolNormalize_constant e ω hF (fun _ => 1) g₀.val + have hdir := F.realFirstCoefficientDirectionMap_eq_of_symbol_eq e ω hF g g₀.val hsymbol + have hadj := F.realFirstCoefficientAdjoint_eq_of_symbol_eq e ω hF (fun _ => 1) g g₀.val hsymbol + have hcommon' : ∀ h ∈ Hshifts, + F.realFirstCoefficientDirectionMap g'.val.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ => 1) g'.val (R h) + Z) ∈ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (fun _ => Nat.zero_lt_one) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) + (F.fastPointwiseSquare e ω hF (fun _ => 1) W)) := by + intro h hh + change F.realFirstCoefficientDirectionMap g.coord (fun i => (h i : ℝ)) - + (S h + F.realFirstCoefficientAdjoint (fun _ => 1) g (R h) + Z) ∈ _ + rw [hdir, hadj] + exact hcommon h hh + have hout := hfactor F e ω hF W H p hH hp hs hι hσ hτ hHp hstructure + hW v hv hheight η hη g' hzero T hT M hM hMp l hl hlp Hshifts h₀ hh₀ S R Z + hbox hcommon' hS hR density hdensity hdensityp hdense + have heq : F.realPolynomialSymbolHom e ω hF (fun _ => 1) + (F.realAdaptedPolynomialGroupHom (fun _ => 1) g'.val) = + F.realPolynomialSymbolHom e ω hF (fun _ => 1) + (F.realAdaptedPolynomialGroupHom (fun _ => 1) g₀.val) := by + apply NilpotentLieBCHGroup.ext + rw [F.realPolynomialSymbolHom_groupHom_coord, F.realPolynomialSymbolHom_groupHom_coord] + exact hsymbol + rw [heq] at hout + exact hout + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/UnnormalizedTensorL1.lean b/lean/OAI/Combinatorics/Progressions/Estimates/UnnormalizedTensorL1.lean new file mode 100644 index 0000000000000000000000000000000000000000..83ea83f84cb42b4b131e7f4dc35f83402a8ef441 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/UnnormalizedTensorL1.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Estimates.UniformProductAccuracy +import OAI.Combinatorics.Progressions.Probability.SampledWeightCellLaw + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem tensor_density_l1_le_prod_error {I : Type*} [Fintype I] + {X : I → Type*} [∀ i, MeasurableSpace (X i)] + (μ : ∀ i, Measure (X i)) [∀ i, SigmaFinite (μ i)] + (f g : ∀ i, X i → ℝ) (hf : ∀ i, Integrable (f i) (μ i)) + (hg : ∀ i, Integrable (g i) (μ i)) + (hf0 : ∀ i x, 0 ≤ f i x) (hg0 : ∀ i x, 0 ≤ g i x) + (hmass : ∀ i, (∫ x, f i x ∂μ i) = 1) + (ε : I → ℝ) (he : ∀ i, (∫ x, |f i x - g i x| ∂μ i) ≤ ε i) : + (∫ x, |(∏ i, f i (x i)) - ∏ i, g i (x i)| ∂Measure.pi μ) ≤ + (∏ i, (1 + ε i)) - 1 := by + let H := fun i x => f i x + |f i x - g i x| + have hH (i) : Integrable (H i) (μ i) := (hf i).add ((hf i).sub (hg i)).abs + have hF := Integrable.fintype_prod_dep hf + have hG := Integrable.fintype_prod_dep hg + have hHH := Integrable.fintype_prod_dep hH + have hbound := integral_mono (hF.sub hG).abs (hHH.sub hF) + (fun x => abs_prod_sub_prod_le_envelope Finset.univ (fun i => f i (x i)) + (fun i => g i (x i)) (fun i _ => hf0 i _) (fun i _ => hg0 i _)) + change (∫ x, |(∏ i, f i (x i)) - ∏ i, g i (x i)| ∂Measure.pi μ) ≤ + ∫ x, (∏ i, H i (x i)) - ∏ i, f i (x i) ∂Measure.pi μ at hbound + rw [integral_sub hHH hF, integral_fintype_prod_eq_prod, integral_fintype_prod_eq_prod] at hbound + simp only [hmass, Finset.prod_const_one] at hbound + refine hbound.trans (sub_le_sub_right ?_ 1) + apply Finset.prod_le_prod₀ + · intro i _ + exact integral_nonneg (fun x => add_nonneg (hf0 i x) (abs_nonneg _)) + · intro i _ + change (∫ x, f i x + |f i x - g i x| ∂μ i) ≤ 1 + ε i + have hd : Integrable (fun x => |f i x - g i x|) (μ i) := ((hf i).sub (hg i)).abs + rw [integral_add (hf i) hd, hmass] + linarith [he i] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/VectorAlgebraicMajorDecomposition.lean b/lean/OAI/Combinatorics/Progressions/Estimates/VectorAlgebraicMajorDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f27cb7468387546ef3dc2935730f34b18ad875a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/VectorAlgebraicMajorDecomposition.lean @@ -0,0 +1,517 @@ +import Mathlib.Algebra.MvPolynomial.Funext +import OAI.Combinatorics.Progressions.Polynomial.PolynomialCoefficientGridDenominator +import OAI.Combinatorics.Progressions.Polynomial.PolynomialTranslationSeries +import OAI.Combinatorics.Progressions.Polynomial.RealPolynomialChartSubstitution + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +variable {R B : Type*} [CommRing R] + +theorem polynomialTranslate_comp_ring (h k : B → R) (P : MvPolynomial B R) : + polynomialTranslate h (polynomialTranslate k P) = polynomialTranslate (h + k) P := by + induction P using MvPolynomial.induction_on with + | C c => simp + | add p q hp hq => simp only [map_add, hp, hq] + | mul_X p i hp => + simp only [map_mul, hp, polynomialTranslate_X, map_add, polynomialTranslate_C, Pi.add_apply] + rw [add_assoc] + +@[simp] theorem polynomialTranslate_zero_ring (P : MvPolynomial B R) : + polynomialTranslate (0 : B → R) P = P := by + induction P using MvPolynomial.induction_on with + | C c => simp + | add p q hp hq => simp only [map_add, hp, hq] + | mul_X p i hp => simp [hp] + +@[ext] structure PolynomialTranslationGroupOver (R B : Type*) [CommRing R] where + base : B → R + polynomial : MvPolynomial B R + +namespace PolynomialTranslationGroupOver + +noncomputable instance : Mul (PolynomialTranslationGroupOver R B) where + mul a b := ⟨a.base + b.base, polynomialTranslate (-b.base) a.polynomial + b.polynomial⟩ + +noncomputable instance : One (PolynomialTranslationGroupOver R B) where + one := ⟨0, 0⟩ + +noncomputable instance : Inv (PolynomialTranslationGroupOver R B) where + inv a := ⟨-a.base, -polynomialTranslate a.base a.polynomial⟩ + +@[simp] theorem base_mul (a b : PolynomialTranslationGroupOver R B) : + (a * b).base = a.base + b.base := rfl + +@[simp] theorem polynomial_mul (a b : PolynomialTranslationGroupOver R B) : + (a * b).polynomial = polynomialTranslate (-b.base) a.polynomial + b.polynomial := rfl + +@[simp] theorem base_one : (1 : PolynomialTranslationGroupOver R B).base = 0 := rfl +@[simp] theorem polynomial_one : (1 : PolynomialTranslationGroupOver R B).polynomial = 0 := rfl +@[simp] theorem base_inv (a : PolynomialTranslationGroupOver R B) : (a⁻¹).base = -a.base := rfl +@[simp] theorem polynomial_inv (a : PolynomialTranslationGroupOver R B) : + (a⁻¹).polynomial = -polynomialTranslate a.base a.polynomial := rfl + +noncomputable instance : Group (PolynomialTranslationGroupOver R B) := + Group.ofLeftAxioms + (by + intro a b c + apply PolynomialTranslationGroupOver.ext + · exact add_assoc _ _ _ + · simp only [polynomial_mul, base_mul, map_add, polynomialTranslate_comp_ring, + neg_add_rev, add_assoc]) + (by intro a; apply PolynomialTranslationGroupOver.ext <;> simp) + (by + intro a + apply PolynomialTranslationGroupOver.ext + · simp + · simp [polynomialTranslate_comp_ring]) + +theorem algebraic_major_identity (D D₀ V : MvPolynomial B R) (A : B → R) + (left middle right : PolynomialTranslationGroupOver R B) + (hfactor : (⟨A, D - polynomialTranslate (-A) D₀⟩ : PolynomialTranslationGroupOver R B) = + left * middle * right) + (hpotential : middle.polynomial = V - polynomialTranslate (-middle.base) V) : + A = left.base + middle.base + right.base ∧ + D = polynomialTranslate (-A) D₀ + + polynomialTranslate (-A + left.base) left.polynomial - + polynomialTranslate (-A + left.base) V + right.polynomial + + polynomialTranslate (-right.base) V := by + have hbase : A = left.base + middle.base + right.base := congrArg base hfactor + have hpoly := congrArg polynomial hfactor + change D - polynomialTranslate (-A) D₀ = + polynomialTranslate (-right.base) + (polynomialTranslate (-middle.base) left.polynomial + middle.polynomial) + + right.polynomial at hpoly + rw [hpotential, map_add, map_sub, polynomialTranslate_comp_ring, + polynomialTranslate_comp_ring] at hpoly + have hshift : -right.base + -middle.base = -A + left.base := by + rw [hbase] + abel + rw [hshift] at hpoly + refine ⟨hbase, ?_⟩ + calc + D = (D - polynomialTranslate (-A) D₀) + polynomialTranslate (-A) D₀ := by abel + _ = _ := by rw [hpoly]; abel + +theorem algebraic_major_decomposition (D D₀ V : MvPolynomial B R) (A : B → R) + (left middle right : PolynomialTranslationGroupOver R B) + (hfactor : (⟨A, D - polynomialTranslate (-A) D₀⟩ : PolynomialTranslationGroupOver R B) = + left * middle * right) + (hpotential : middle.polynomial = V - polynomialTranslate (-middle.base) V) : + D = polynomialTranslate (-A) + (D₀ + polynomialTranslate left.base left.polynomial - polynomialTranslate left.base V) + + (right.polynomial + polynomialTranslate (-right.base) V) := by + rw [(algebraic_major_identity D D₀ V A left middle right hfactor hpotential).2] + simp only [map_sub, map_add, polynomialTranslate_comp_ring] + abel + +end PolynomialTranslationGroupOver + +theorem PolynomialTranslationGroup.algebraic_major_identity + (D D₀ V : MvPolynomial B ℚ) (A : B → ℚ) + (left middle right : PolynomialTranslationGroup B) + (hfactor : (⟨A, D - polynomialTranslate (-A) D₀⟩ : PolynomialTranslationGroup B) = + left * middle * right) + (hpotential : middle ∈ PolynomialTranslationGroup.potentialSubgroup V) : + A = left.base + middle.base + right.base ∧ + D = polynomialTranslate (-A) D₀ + + polynomialTranslate (-A + left.base) left.polynomial - + polynomialTranslate (-A + left.base) V + right.polynomial + + polynomialTranslate (-right.base) V := by + let convert : PolynomialTranslationGroup B → PolynomialTranslationGroupOver ℚ B := + fun g => ⟨g.base, g.polynomial⟩ + exact PolynomialTranslationGroupOver.algebraic_major_identity D D₀ V A + (convert left) (convert middle) (convert right) (congrArg convert hfactor) + ((PolynomialTranslationGroup.mem_potentialSubgroup V middle).mp hpotential) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +variable {U B R T : Type*} [CommRing R] [CommRing T] + +noncomputable def specializeMajorParameters (φ : R →+* T) + (P : MvPolynomial (U ⊕ B) R) (u : U → T) : MvPolynomial B T := + eval₂Hom (C.comp φ) (Sum.elim (fun i => C (u i)) X) P + +theorem specializeMajorParameters_eval (φ : R →+* T) + (P : MvPolynomial (U ⊕ B) R) (u : U → T) (b : B → T) : + eval b (specializeMajorParameters φ P u) = eval₂ φ (Sum.elim u b) P := by + induction P using MvPolynomial.induction_on with + | C c => simp [specializeMajorParameters] + | add p q hp hq => simpa only [specializeMajorParameters, map_add, eval₂_add] using congrArg₂ (· + ·) hp hq + | mul_X p i hp => + simp only [specializeMajorParameters, coe_eval₂Hom] at hp + cases i <;> simp [specializeMajorParameters, hp] + +theorem polynomialTranslate_eval_ring (h : B → R) (P : MvPolynomial B R) (b : B → R) : + eval b (polynomialTranslate h P) = eval (fun i => b i + h i) P := by + induction P using MvPolynomial.induction_on with + | C c => simp + | add p q hp hq => simp only [map_add, hp, hq] + | mul_X p i hp => simp only [map_mul, hp, polynomialTranslate_X, map_add, eval_X, eval_C] + +noncomputable def normalizedMajorLeft (E : MvPolynomial (U ⊕ B) ℝ) + (e : B → MvPolynomial U ℝ) (H u : U → ℝ) : PolynomialTranslationGroupOver ℝ B := + ⟨fun j => eval (fun i => u i / H i) (e j), + specializeMajorParameters (RingHom.id ℝ) E (fun i => u i / H i)⟩ + +noncomputable def rationalMajorRight (Q : MvPolynomial (U ⊕ B) ℚ) + (a : B → MvPolynomial U ℚ) (u : U → ℝ) : PolynomialTranslationGroupOver ℝ B := + ⟨fun j => eval₂ (algebraMap ℚ ℝ) u (a j), + specializeMajorParameters (algebraMap ℚ ℝ) Q u⟩ + +noncomputable def algebraicMajorSymbol (D : MvPolynomial (U ⊕ B) ℝ) + (D₀ : MvPolynomial B ℝ) (A : B → MvPolynomial U ℝ) (u : U → ℝ) : + PolynomialTranslationGroupOver ℝ B := + ⟨fun j => eval u (A j), specializeMajorParameters (RingHom.id ℝ) D u - + polynomialTranslate (fun j => -eval u (A j)) D₀⟩ + +theorem algebraic_major_normalized_identity + (D : MvPolynomial (U ⊕ B) ℝ) (D₀ : MvPolynomial B ℝ) + (A : B → MvPolynomial U ℝ) (E : MvPolynomial (U ⊕ B) ℝ) + (e : B → MvPolynomial U ℝ) (Q : MvPolynomial (U ⊕ B) ℚ) + (a : B → MvPolynomial U ℚ) (V : MvPolynomial B ℚ) (H : U → ℝ) + (middle : (U → ℝ) → PolynomialTranslationGroupOver ℝ B) + (hfactor : ∀ u, algebraicMajorSymbol D D₀ A u = + normalizedMajorLeft E e H u * middle u * rationalMajorRight Q a u) + (hpotential : ∀ u, (middle u).polynomial = map (algebraMap ℚ ℝ) V - + polynomialTranslate (-(middle u).base) (map (algebraMap ℚ ℝ) V)) + (u : U → ℝ) (b : B → ℝ) : + eval (Sum.elim u b) D = + eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (A j))) + (majorSlowPolynomial D₀ E (map (algebraMap ℚ ℝ) V) e) + + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) (majorRationalPolynomial Q V a) := by + have hpoly := (PolynomialTranslationGroupOver.algebraic_major_identity + (specializeMajorParameters (RingHom.id ℝ) D u) D₀ (map (algebraMap ℚ ℝ) V) + (fun j => eval u (A j)) (normalizedMajorLeft E e H u) (middle u) (rationalMajorRight Q a u) + (hfactor u) (hpotential u)).2 + have h := congrArg (eval b) hpoly + simp only [map_add, map_sub, polynomialTranslate_eval_ring, + specializeMajorParameters_eval, eval₂_id, normalizedMajorLeft, rationalMajorRight, + eval_map, Pi.add_apply, Pi.neg_apply] at h + rw [majorSlowPolynomial_eval, majorRationalPolynomial_eval₂] + simp only [eval_map] + simpa only [sub_eq_add_neg, add_assoc] using h + +theorem algebraic_major_normalized_slow_mass + (D₀ : MvPolynomial B ℝ) (E : MvPolynomial (U ⊕ B) ℝ) + (V : MvPolynomial B ℚ) (e : B → MvPolynomial U ℝ) + {M : ℝ} (hM : 0 ≤ M) (he : ∀ j, realPolynomialMass (e j) ≤ M) {d : ℕ} + (hE : E.totalDegree ≤ d) (hV : (map (algebraMap ℚ ℝ) V).totalDegree ≤ d) : + realPolynomialMass (majorSlowPolynomial D₀ E (map (algebraMap ℚ ℝ) V) e) ≤ + realPolynomialMass D₀ + + (realPolynomialMass E + realPolynomialMass (map (algebraMap ℚ ℝ) V)) * (1 + M) ^ d := + majorSlowPolynomial_mass_le D₀ E (map (algebraMap ℚ ℝ) V) e hM he hE hV + +theorem algebraic_major_normalized_decomposition + (D : MvPolynomial (U ⊕ B) ℝ) (D₀ : MvPolynomial B ℝ) + (A : B → MvPolynomial U ℝ) (E : MvPolynomial (U ⊕ B) ℝ) + (e : B → MvPolynomial U ℝ) (Q : MvPolynomial (U ⊕ B) ℚ) + (a : B → MvPolynomial U ℚ) (V : MvPolynomial B ℚ) (H : U → ℝ) + (middle : (U → ℝ) → PolynomialTranslationGroupOver ℝ B) + (hfactor : ∀ u, algebraicMajorSymbol D D₀ A u = + normalizedMajorLeft E e H u * middle u * rationalMajorRight Q a u) + (hpotential : ∀ u, (middle u).polynomial = map (algebraMap ℚ ℝ) V - + polynomialTranslate (-(middle u).base) (map (algebraMap ℚ ℝ) V)) + (q d : ℕ) {M : ℝ} (hM : 0 ≤ M) + (he : ∀ j, realPolynomialMass (e j) ≤ M) + (hE : E.totalDegree ≤ d) (hV : V.totalDegree ≤ d) + (hQgrid : (fun m => Q.coeff m) ∈ denominatorGrid q) + (hVgrid : (fun m => V.coeff m) ∈ denominatorGrid q) + (hagrid : ∀ j, (fun m => (a j).coeff m) ∈ denominatorGrid q) : + ∃ S : MvPolynomial (U ⊕ B) ℝ, ∃ R : MvPolynomial (U ⊕ B) ℚ, + (∀ (u : U → ℝ) (b : B → ℝ), + 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 ≤ realPolynomialMass D₀ + + (realPolynomialMass E + realPolynomialMass (map (algebraMap ℚ ℝ) V)) * + (1 + M) ^ d ∧ + (fun m => R.coeff m) ∈ denominatorGrid (q ^ (d + 1)) := by + refine ⟨majorSlowPolynomial D₀ E (map (algebraMap ℚ ℝ) V) e, + majorRationalPolynomial Q V a, ?_, ?_, ?_⟩ + · exact algebraic_major_normalized_identity D D₀ A E e Q a V H middle + hfactor hpotential + · apply algebraic_major_normalized_slow_mass D₀ E V e hM he hE + apply le_trans (b := V.totalDegree) ?_ hV + unfold totalDegree + apply Finset.sup_le + intro m hm + exact le_totalDegree (support_map_subset (algebraMap ℚ ℝ) V hm) + · exact majorRationalPolynomial_denominatorGrid Q V a q d hV hQgrid hVgrid hagrid + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +private theorem majorFunctionAdd {B R : Type*} [Add R] (f g : B → R) : + f + g = fun i => f i + g i := rfl + +private theorem majorFunctionSub {B R : Type*} [Sub R] (f g : B → R) : + f - g = fun i => f i - g i := rfl + +private theorem majorFunctionNeg {B R : Type*} [Neg R] (f : B → R) : + -f = fun i => -f i := rfl + +namespace PolynomialTranslationGroupOver + +theorem algebraic_major_eval_on_subspace + {B R : Type*} [CommRing R] (K : Submodule R (B → R)) + (D D₀ V : MvPolynomial B R) (A : B → R) + (left middle right : PolynomialTranslationGroupOver R B) + (hfactor : (⟨A, D - polynomialTranslate (-A) D₀⟩ : PolynomialTranslationGroupOver R B) = + left * middle * right) + (hpotential : ∀ z ∈ K, eval z middle.polynomial = eval z V - eval (z - middle.base) V) + (hright : right.base ∈ K) (b : B → R) (hb : b ∈ K) : + eval b D = eval (b - A) D₀ + eval (b - A + left.base) left.polynomial - + eval (b - A + left.base) V + eval b right.polynomial + eval (b - right.base) V := by + have hbase : A = left.base + middle.base + right.base := congrArg base hfactor + have hpoly := congrArg (fun g : PolynomialTranslationGroupOver R B => eval b g.polynomial) hfactor + change eval b (D - polynomialTranslate (-A) D₀) = + eval b (polynomialTranslate (-right.base) + (polynomialTranslate (-middle.base) left.polynomial + middle.polynomial) + + right.polynomial) at hpoly + simp only [map_sub, map_add, polynomialTranslate_eval_ring] at hpoly + have hpot := hpotential (b - right.base) (K.sub_mem hb hright) + have hx' : b - right.base - middle.base = b - A + left.base := by rw [hbase]; abel + rw [hx'] at hpot + have hpoly' : eval b D - eval (b - A) D₀ = + eval (b - right.base - middle.base) left.polynomial + + eval (b - right.base) middle.polynomial + eval b right.polynomial := by + simpa only [majorFunctionSub, majorFunctionAdd, majorFunctionNeg, + sub_eq_add_neg, Pi.add_apply, Pi.neg_apply] using hpoly + rw [hx', hpot] at hpoly' + linear_combination hpoly' + +end PolynomialTranslationGroupOver + +theorem algebraic_major_normalized_identity_on_subspace + {U B : Type*} (K : Submodule ℝ (B → ℝ)) + (D : MvPolynomial (U ⊕ B) ℝ) (D₀ : MvPolynomial B ℝ) + (A : B → MvPolynomial U ℝ) (E : MvPolynomial (U ⊕ B) ℝ) + (e : B → MvPolynomial U ℝ) (Q : MvPolynomial (U ⊕ B) ℚ) + (a : B → MvPolynomial U ℚ) (V : MvPolynomial B ℚ) (H : U → ℝ) + (middle : (U → ℝ) → PolynomialTranslationGroupOver ℝ B) + (hfactor : ∀ u, algebraicMajorSymbol D D₀ A u = + normalizedMajorLeft E e H u * middle u * rationalMajorRight Q a u) + (hpotential : ∀ u, ∀ z ∈ K, + eval z (middle u).polynomial = eval₂ (algebraMap ℚ ℝ) z V - + eval₂ (algebraMap ℚ ℝ) (z - (middle u).base) V) + (hright : ∀ u, (fun j => eval₂ (algebraMap ℚ ℝ) u (a j)) ∈ K) + (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))) + (majorSlowPolynomial D₀ E (map (algebraMap ℚ ℝ) V) e) + + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) (majorRationalPolynomial Q V a) := by + have h := PolynomialTranslationGroupOver.algebraic_major_eval_on_subspace K + (specializeMajorParameters (RingHom.id ℝ) D u) D₀ (map (algebraMap ℚ ℝ) V) + (fun j => eval u (A j)) (normalizedMajorLeft E e H u) (middle u) + (rationalMajorRight Q a u) (hfactor u) + (by simpa only [eval_map] using hpotential u) (hright u) b hb + rw [majorSlowPolynomial_eval, majorRationalPolynomial_eval₂] + simp only [normalizedMajorLeft, rationalMajorRight, specializeMajorParameters_eval, + eval₂_id, eval_map] at h ⊢ + simpa only [majorFunctionSub, majorFunctionAdd, Pi.sub_apply, Pi.add_apply, add_assoc] using h + +theorem algebraic_major_normalized_decomposition_on_subspace + {U B : Type*} (K : Submodule ℝ (B → ℝ)) + (D : MvPolynomial (U ⊕ B) ℝ) (D₀ : MvPolynomial B ℝ) + (A : B → MvPolynomial U ℝ) (E : MvPolynomial (U ⊕ B) ℝ) + (e : B → MvPolynomial U ℝ) (Q : MvPolynomial (U ⊕ B) ℚ) + (a : B → MvPolynomial U ℚ) (V : MvPolynomial B ℚ) (H : U → ℝ) + (middle : (U → ℝ) → PolynomialTranslationGroupOver ℝ B) + (hfactor : ∀ u, algebraicMajorSymbol D D₀ A u = + normalizedMajorLeft E e H u * middle u * rationalMajorRight Q a u) + (hpotential : ∀ u, ∀ z ∈ K, + eval z (middle u).polynomial = eval₂ (algebraMap ℚ ℝ) z V - + eval₂ (algebraMap ℚ ℝ) (z - (middle u).base) V) + (hright : ∀ u, (fun j => eval₂ (algebraMap ℚ ℝ) u (a j)) ∈ K) + (q d : ℕ) {M : ℝ} (hM : 0 ≤ M) + (he : ∀ j, realPolynomialMass (e j) ≤ M) + (hE : E.totalDegree ≤ d) (hV : V.totalDegree ≤ d) + (hQgrid : (fun m => Q.coeff m) ∈ denominatorGrid q) + (hVgrid : (fun m => V.coeff m) ∈ denominatorGrid q) + (hagrid : ∀ j, (fun m => (a j).coeff m) ∈ denominatorGrid q) : + ∃ 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 ≤ realPolynomialMass D₀ + + (realPolynomialMass E + realPolynomialMass (map (algebraMap ℚ ℝ) V)) * + (1 + M) ^ d ∧ + (fun m => R.coeff m) ∈ denominatorGrid (q ^ (d + 1)) := by + refine ⟨majorSlowPolynomial D₀ E (map (algebraMap ℚ ℝ) V) e, + majorRationalPolynomial Q V a, ?_, ?_, ?_⟩ + · exact algebraic_major_normalized_identity_on_subspace K D D₀ A E e Q a V H middle + hfactor hpotential hright + · apply algebraic_major_normalized_slow_mass D₀ E V e hM he hE + apply le_trans (b := V.totalDegree) ?_ hV + unfold totalDegree + apply Finset.sup_le + intro m hm + exact le_totalDegree (support_map_subset (algebraMap ℚ ℝ) V hm) + · exact majorRationalPolynomial_denominatorGrid Q V a q d hV hQgrid hVgrid hagrid + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +theorem specializeMajorParameters_translatedSlice {U B : Type*} + (P0 : MvPolynomial B ℝ) (x : B → MvPolynomial U ℝ) (u : U → ℝ) : + specializeMajorParameters (RingHom.id ℝ) + (eval₂Hom C (fun j => X (Sum.inr j) - rename Sum.inl (x j)) P0) u = + polynomialTranslate (fun j => -eval u (x j)) P0 := by + apply MvPolynomial.funext + intro b + rw [specializeMajorParameters_eval, polynomialTranslate_eval_ring] + change eval₂ (RingHom.id ℝ) (Sum.elim u b) + (eval₂ C (fun j => X (Sum.inr j) - rename Sum.inl (x j)) P0) = _ + rw [← eval₂_assoc] + simp only [eval₂_id] + apply congrArg (fun f : B → ℝ => eval f P0) + funext j + rw [map_sub, eval_X, eval_rename] + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +variable {U B R : Type*} [CommRing R] + +theorem specializeMajorParameters_zero_weightedSupportLE (w : B → ℕ) + {v : U → ℕ} {d : ℕ} {P : MvPolynomial (U ⊕ B) R} + (hP : P ∈ weightedSupportLE (Sum.elim v w) d) : + specializeMajorParameters (RingHom.id R) P (fun _ => 0) ∈ + weightedSupportLE w d := by + change aeval (Sum.elim (fun _ : U => C (0 : R)) X) P ∈ weightedSupportLE w d + apply weightedSupportLE_aeval _ _ _ _ hP + intro i + cases i with + | inl i => exact weightedSupportLE_C w (v i) 0 + | inr i => exact weightedSupportLE_X w i + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped BigOperators Classical + +variable {X B J V : Type*} [Fintype J] + [AddCommGroup V] [Module ℚ V] [Module ℝ V] [IsScalarTower ℚ ℝ V] + +theorem exists_vector_algebraic_major_decomposition + (basis : Basis J ℝ V) (p : VectorPolynomial (X ⊕ B) ℚ V) + (K : J → Submodule ℝ (B → ℝ)) + (D₀ : J → MvPolynomial B ℝ) (A : B → MvPolynomial X ℝ) + (E : J → MvPolynomial (X ⊕ B) ℝ) (e : J → B → MvPolynomial X ℝ) + (Q : J → MvPolynomial (X ⊕ B) ℚ) (a : J → B → MvPolynomial X ℚ) + (potential : J → MvPolynomial B ℚ) (H : X → ℝ) + (middle : J → (X → ℝ) → PolynomialTranslationGroupOver ℝ B) + (hfactor : ∀ j u, + algebraicMajorSymbol (coordinate (basis.coord j).toAddMonoidHom p) (D₀ j) A u = + normalizedMajorLeft (E j) (e j) H u * middle j u * rationalMajorRight (Q j) (a j) u) + (hpotential : ∀ j u z, z ∈ K j → + MvPolynomial.eval z (middle j u).polynomial = + MvPolynomial.eval₂ (algebraMap ℚ ℝ) z (potential j) - + MvPolynomial.eval₂ (algebraMap ℚ ℝ) (z - (middle j u).base) (potential j)) + (hright : ∀ j u, (fun b => MvPolynomial.eval₂ (algebraMap ℚ ℝ) u (a j b)) ∈ K j) + (q d : ℕ) (M : ℝ) (hM : 0 ≤ M) + (he : ∀ j b, realPolynomialMass (e j b) ≤ M) + (hE : ∀ j, (E j).totalDegree ≤ d) (hV : ∀ j, (potential j).totalDegree ≤ d) + (hQgrid : ∀ j, (fun α => (Q j).coeff α) ∈ denominatorGrid q) + (hVgrid : ∀ j, (fun α => (potential j).coeff α) ∈ denominatorGrid q) + (hagrid : ∀ j b, (fun α => (a j b).coeff α) ∈ denominatorGrid q) : + ∃ slow rat : VectorPolynomial (X ⊕ B) ℚ V, + (∀ u z, (∀ j, z ∈ K j) → + eval₂ (Sum.elim u z) p = + eval₂ (Sum.elim u z) (realChartSubstitute (normalizedRealPolynomialChart H A) slow) + + eval₂ (Sum.elim u z) rat) ∧ + (∀ α j, |basis.repr (coefficients slow α) j| ≤ realPolynomialMass (D₀ j) + + (realPolynomialMass (E j) + + realPolynomialMass (MvPolynomial.map (algebraMap ℚ ℝ) (potential j))) * (1 + M)^d) ∧ + (∀ α, (fun j => basis.repr (coefficients rat α) j) ∈ realDenominatorGrid (q^(d+1))) := by + have hdecomp (j : J) := algebraic_major_normalized_decomposition_on_subspace + (K j) (coordinate (basis.coord j).toAddMonoidHom p) (D₀ j) A (E j) (e j) + (Q j) (a j) (potential j) H (middle j) (hfactor j) (hpotential j) (hright j) + q d hM (he j) (hE j) (hV j) (hQgrid j) (hVgrid j) (hagrid j) + choose S R hidentity hmass hgrid using hdecomp + let slow : VectorPolynomial (X ⊕ B) ℚ V := ofCoordinates basis S + let rat : VectorPolynomial (X ⊕ B) ℚ V := + ofCoordinates basis (fun j => MvPolynomial.map (algebraMap ℚ ℝ) (R j)) + have hslowcoeff (α : (X ⊕ B) →₀ ℕ) (j : J) : + basis.repr (coefficients slow α) j = (S j).coeff α := by + exact congrArg (fun polynomial : MvPolynomial (X ⊕ B) ℝ => polynomial.coeff α) + (coordinate_ofCoordinates basis S j) + have hratcoeff (α : (X ⊕ B) →₀ ℕ) (j : J) : + basis.repr (coefficients rat α) j = + (MvPolynomial.map (algebraMap ℚ ℝ) (R j)).coeff α := by + exact congrArg (fun polynomial : MvPolynomial (X ⊕ B) ℝ => polynomial.coeff α) + (coordinate_ofCoordinates basis (fun j => MvPolynomial.map (algebraMap ℚ ℝ) (R j)) j) + refine ⟨slow, rat, ?_, ?_, ?_⟩ + · intro u z hz + rw [eval₂_normalizedRealPolynomialChart] + apply basis.repr.injective + ext j + change basis.coord j (eval₂ _ p) = basis.coord j (eval₂ _ slow + eval₂ _ rat) + rw [map_add, coordinate_eval₂, coordinate_eval₂, coordinate_eval₂] + change MvPolynomial.eval _ (coordinate (basis.coord j).toAddMonoidHom p) = + MvPolynomial.eval _ (coordinate (basis.coord j).toAddMonoidHom (ofCoordinates basis S)) + + MvPolynomial.eval _ (coordinate (basis.coord j).toAddMonoidHom + (ofCoordinates basis (fun j => MvPolynomial.map (algebraMap ℚ ℝ) (R j)))) + rw [coordinate_ofCoordinates, coordinate_ofCoordinates, MvPolynomial.eval_map] + exact hidentity j u z (hz j) + · intro α j + rw [hslowcoeff] + exact (realPolynomialMass_coeff_le (S j) α).trans (hmass j) + · intro α + have hrealgrid (j : J) : realPolynomialCoefficientGrid (q^(d+1)) + (MvPolynomial.map (algebraMap ℚ ℝ) (R j)) := + (realPolynomialCoefficientGrid_ratCast_iff _ _).mpr (hgrid j) + choose z hz using hrealgrid + refine ⟨fun j => z j α, funext fun j => ?_⟩ + change (z j α : ℝ) = (q^(d+1) : ℕ) * basis.repr (coefficients rat α) j + rw [hratcoeff] + exact congrFun (hz j) α + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/VectorApproximationPrecomposition.lean b/lean/OAI/Combinatorics/Progressions/Estimates/VectorApproximationPrecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac64b434fc57ccb48a69a46ad7902dee1dfafe49 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/VectorApproximationPrecomposition.lean @@ -0,0 +1,125 @@ +import OAI.Combinatorics.Progressions.Linear.FiniteNormalizedFrame + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem vector_approximation_precision {I : Type*} [Fintype I] {q epsilon : ℝ} + (a : ℕ) (hq : 0 ≤ q) (hI : (Fintype.card I : ℝ) ≤ Real.exp q) + (hepsilon : 0 < epsilon) (hscale : 1 / epsilon ≤ Real.exp ((q + 2) ^ a)) : + 0 < epsilon / (Fintype.card I + 1 : ℝ) ∧ + 1 / (epsilon / (Fintype.card I + 1 : ℝ)) ≤ Real.exp ((q + 2) ^ (a + 1)) := by + have hcard : (0 : ℝ) < Fintype.card I + 1 := by positivity + refine ⟨div_pos hepsilon hcard, ?_⟩ + have hcount : (Fintype.card I + 1 : ℝ) ≤ Real.exp (q + 1) := by + rw [Real.exp_add] + nlinarith [Real.one_le_exp hq, Real.add_one_le_exp (1 : ℝ)] + have hpow : 1 ≤ (q + 2) ^ a := one_le_pow₀ (by linarith) + have hexponent : q + 1 + (q + 2) ^ a ≤ (q + 2) ^ (a + 1) := by + rw [pow_succ] + nlinarith + calc + _ = (Fintype.card I + 1 : ℝ) * (1 / epsilon) := by field_simp + _ ≤ Real.exp (q + 1) * Real.exp ((q + 2) ^ a) := + mul_le_mul hcount hscale (by positivity) (Real.exp_nonneg _) + _ = Real.exp (q + 1 + (q + 2) ^ a) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr hexponent + +theorem euclidean_coefficient_norm_le_exp {I : Type*} [Fintype I] {q : ℝ} + (hq : 0 ≤ q) (hI : (Fintype.card I : ℝ) ≤ Real.exp q) + (c : EuclideanSpace ℂ I) (hc : ∀ i, ‖c i‖ ≤ 2) : + ‖c‖ ≤ Real.exp (q + 2) := by + have h := euclidean_norm_le_card_add_one_mul c (by norm_num : (0 : ℝ) ≤ 2) hc + have hfour : (4 : ℝ) ≤ Real.exp 2 := by + rw [show (2 : ℝ) = 1 + 1 by norm_num, Real.exp_add] + nlinarith [Real.add_one_le_exp (1 : ℝ)] + rw [Real.exp_add] + nlinarith [Real.one_le_exp hq, + mul_le_mul_of_nonneg_left hfour (Real.exp_nonneg q)] + +theorem euclidean_error_le_of_coordinate_errors {I : Type*} [Fintype I] + (v : EuclideanSpace ℂ I) {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) + (hv : ∀ i, ‖v i‖ ≤ epsilon / (Fintype.card I + 1 : ℝ)) : + ‖v‖ ≤ epsilon := by + have h := euclidean_norm_le_card_add_one_mul v (div_nonneg hepsilon (by positivity)) hv + have hcard : (Fintype.card I + 1 : ℝ) ≠ 0 := by positivity + simpa only [mul_div_cancel₀ _ hcard] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem scalar_error_le_of_vector_error {I J S : Type*} [Fintype I] [Fintype J] + (u : I → S → ℂ) (w : J → S → ℂ) (c : J → EuclideanSpace ℂ I) + {epsilon : ℝ} + (herror : ∀ x, ‖(WithLp.toLp 2 (fun k => u k x) : EuclideanSpace ℂ I) - + ∑ j, w j x • c j‖ ≤ epsilon) (k : I) : + ∀ x, ‖u k x - ∑ j, w j x * c j k‖ ≤ epsilon := by + intro x + have h := (PiLp.norm_apply_le + ((WithLp.toLp 2 (fun k => u k x) : EuclideanSpace ℂ I) - ∑ j, w j x • c j) k).trans (herror x) + simpa only [PiLp.sub_apply, PiLp.toLp_apply, WithLp.ofLp_sum, Finset.sum_apply, + WithLp.ofLp_smul, Pi.smul_apply, smul_eq_mul] using h + +theorem norm_complex_half_le_one {c : ℂ} (hc : ‖c‖ ≤ 2) : ‖c / 2‖ ≤ 1 := by + have htwo : ‖(2 : ℂ)‖ = (2 : ℝ) := by norm_num + rw [norm_div, htwo] + linarith only [hc] + +theorem sum_double_half_products {J : Type*} [Fintype J] (a b c : J → ℂ) : + (∑ j : Bool × J, (c j.2 / 2 * a j.2) * b j.2) = ∑ j, (a j * b j) * c j := by + rw [Fintype.sum_prod_type] + simp only [Fintype.sum_bool] + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro j _ + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem vector_approximation_precompose {I J S X : Type*} [Fintype I] [Fintype J] + [PseudoMetricSpace X] (f : X → X) (y z : S → X) (w : J → S → ℂ) + {A : ℝ≥0} (hf : LipschitzWith A f) (heval : ∀ x, f (y x) = z x) + {p q B B' epsilon : ℝ} (hscale : Real.exp p * (A : ℝ) ≤ Real.exp q) (hB : B ≤ B') + (happrox : ∀ (u : I → X → ℂ) (ell : ℝ≥0), (ell : ℝ) ≤ Real.exp q → + (∀ k, LipschitzWith ell (u k)) → (∀ k x, ‖u k x‖ ≤ 1) → + ∃ c : J → EuclideanSpace ℂ I, (∀ j k, ‖c j k‖ ≤ 2) ∧ (∀ j, ‖c j‖ ≤ B) ∧ + ∀ x, ‖(WithLp.toLp 2 (fun k => u k (y x)) : EuclideanSpace ℂ I) - + ∑ j, w j x • c j‖ ≤ epsilon) : + ∀ (u : I → X → ℂ) (ell : ℝ≥0), (ell : ℝ) ≤ Real.exp p → + (∀ k, LipschitzWith ell (u k)) → (∀ k x, ‖u k x‖ ≤ 1) → + ∃ c : J → EuclideanSpace ℂ I, (∀ j k, ‖c j k‖ ≤ 2) ∧ (∀ j, ‖c j‖ ≤ B') ∧ + ∀ x, ‖(WithLp.toLp 2 (fun k => u k (z x)) : EuclideanSpace ℂ I) - + ∑ j, w j x • c j‖ ≤ epsilon := by + intro u ell hell hu hub + have hbound : ((ell * A : ℝ≥0) : ℝ) ≤ Real.exp q := + (mul_le_mul_of_nonneg_right hell A.coe_nonneg).trans hscale + obtain ⟨c, hc, hcB, herr⟩ := happrox (fun k x => u k (f x)) (ell * A) hbound + (fun k => (hu k).comp hf) (fun k x => hub k (f x)) + refine ⟨c, hc, fun j => (hcB j).trans hB, ?_⟩ + intro x + simpa only [heval x] using herr x + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/VectorCoefficientScaling.lean b/lean/OAI/Combinatorics/Progressions/Estimates/VectorCoefficientScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..9da497d9a87623f44357d3dc083eb7cc16d9352f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/VectorCoefficientScaling.lean @@ -0,0 +1,34 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialKernelValues + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +theorem DegreeLE.smul {I V : Type*} [AddCommGroup V] [Module ℝ V] + {w : I → ℕ} {d : ℕ} {p : VectorPolynomial I ℝ V} + (hp : DegreeLE w d p) (r : ℝ) : DegreeLE w d (r • p) := by + intro α hα + simp only [map_smul, Finsupp.smul_apply, hp α hα, smul_zero] + +theorem coefficients_smul_mem {I J : Type*} (U : Submodule ℝ (J → ℝ)) + (p : VectorPolynomial I ℝ (J → ℝ)) (hm : ∀ d, coefficients p d ∈ U) (r : ℝ) : + ∀ d, coefficients (r • p) d ∈ U := by + intro d + simpa only [map_smul, Finsupp.smul_apply] using U.smul_mem r (hm d) + +theorem integerRowPolynomial_smul {I J : Type*} [Fintype J] + (a : J → ℤ) (p : VectorPolynomial I ℝ (J → ℝ)) (r : ℝ) : + integerRowPolynomial a (r • p) = r • integerRowPolynomial a p := by + ext α + simp only [integerRowPolynomial_coeff, MvPolynomial.coeff_smul, map_smul, + Finsupp.smul_apply, Pi.smul_apply, smul_eq_mul, Finset.mul_sum, mul_left_comm] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/VectorHomogenization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/VectorHomogenization.lean new file mode 100644 index 0000000000000000000000000000000000000000..e614bba504ee3ae8cfe3c862e7ba56cf2232fba1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/VectorHomogenization.lean @@ -0,0 +1,89 @@ +import Mathlib.LinearAlgebra.Finsupp.LSum +import OAI.Combinatorics.Progressions.Polynomial.AdaptedPolynomialSubstitution +import OAI.Combinatorics.Progressions.Polynomial.HomogenizingMonomial + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators TensorProduct + +theorem homogeneous_finset_sum {I A R W : Type*} [CommRing R] [AddCommGroup W] [Module R W] + {h : ℕ} (s : Finset A) (p : A → VectorPolynomial I R W) + (hp : ∀ a ∈ s, Homogeneous h (p a)) : Homogeneous h (∑ a ∈ s, p a) := by + intro d hd + simp only [map_sum, Finsupp.finsetSum_apply] + exact Finset.sum_eq_zero (fun a ha => hp a ha d hd) + +theorem homogeneous_substitute_linear {I K R W : Type*} [CommRing R] + [AddCommGroup W] [Module R W] {h : ℕ} + (f : I → MvPolynomial K R) (hf : ∀ i, (f i).IsHomogeneous 1) + (p : VectorPolynomial I R W) (hp : Homogeneous h p) : + Homogeneous h (substitute f p) := by + classical + rw [← sum_monomial_coefficients p, Finsupp.sum, map_sum] + apply homogeneous_finset_sum + intro d hd + rw [monomial, substitute_tmul] + apply homogeneous_tmul + have hm := MvPolynomial.isHomogeneous_monomial (1 : R) (homogeneous_support_degree hp hd) + simpa only [MvPolynomial.aeval_def, MvPolynomial.algebraMap_eq, Nat.one_mul] using + hm.eval₂ MvPolynomial.C f (fun r => MvPolynomial.isHomogeneous_C K r) hf + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators TensorProduct + +noncomputable def homogenize {I R W : Type*} [CommRing R] [AddCommGroup W] [Module R W] + (h : ℕ) : VectorPolynomial I R W →ₗ[R] VectorPolynomial (Option I) R W := + (Finsupp.lsum R (fun d => TensorProduct.mk R (MvPolynomial (Option I) R) W + (homogenizingMonomial h d))).comp coefficients.toLinearMap + +theorem homogenize_apply {I R W : Type*} [CommRing R] [AddCommGroup W] [Module R W] + (h : ℕ) (p : VectorPolynomial I R W) : + homogenize h p = ∑ d ∈ (coefficients p).support, + homogenizingMonomial h d ⊗ₜ[R] coefficients p d := by + simp only [homogenize, LinearMap.comp_apply, LinearEquiv.coe_coe, Finsupp.lsum_apply, + Finsupp.sum, TensorProduct.mk_apply] + +theorem dehomogenize_homogenize {I R W : Type*} [CommRing R] [AddCommGroup W] [Module R W] + (h : ℕ) (p : VectorPolynomial I R W) : + substitute dehomogenizingSubstitution (homogenize h p) = p := by + rw [homogenize_apply, map_sum] + simp only [substitute_tmul, homogenizingMonomial_dehomogenize] + exact sum_monomial_coefficients p + +theorem homogenize_homogeneous {I R W : Type*} [CommRing R] [AddCommGroup W] [Module R W] + (h : ℕ) (p : VectorPolynomial I R W) (hp : DegreeLE (1 : I → ℕ) h p) : + Homogeneous h (homogenize h p) := by + rw [homogenize_apply] + apply homogeneous_finset_sum + intro d hd + have hb : d.degree ≤ h := by + simpa only [Finsupp.degree_eq_weight_one, Pi.one_def] using + (degreeLE_iff (1 : I → ℕ) h p).mp hp d hd + exact homogeneous_tmul (homogenizingMonomial_homogeneous h d hb) _ + +theorem eval_homogenize {I R W : Type*} [CommRing R] [AddCommGroup W] [Module R W] + (h : ℕ) (p : VectorPolynomial I R W) (x : I → R) : + eval (fun i : Option I => i.elim 1 x) (homogenize h p) = eval x p := by + have he := congrArg (eval x) (dehomogenize_homogenize h p) + rw [eval_substitute] at he + convert he using 1 + apply congrArg (fun y => eval y (homogenize h p)) + funext i + cases i <;> simp [dehomogenizingSubstitution] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/VectorRealSubstitutionBound.lean b/lean/OAI/Combinatorics/Progressions/Estimates/VectorRealSubstitutionBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..cff65adc810b0ecd0cb3eaa24249a33c2ae4a50e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/VectorRealSubstitutionBound.lean @@ -0,0 +1,97 @@ +import OAI.Combinatorics.Progressions.Polynomial.QuantitativeOuterPolynomialProducts + +namespace OAI + +section + +namespace Erdos3 +open MvPolynomial + +theorem scaleMvPolynomialAxes_substitution {I J : Type*} + (T : J → ℝ) (f : I → MvPolynomial J ℝ) (p : MvPolynomial I ℝ) : + scaleMvPolynomialAxes T (eval₂Hom C f p) = + eval₂Hom C (fun i => scaleMvPolynomialAxes T (f i)) p := by + apply MvPolynomial.funext + intro x + rw [scaleMvPolynomialAxes_eval] + simp only [coe_eval₂Hom, ← eval_assoc, Function.comp_def, scaleMvPolynomialAxes_eval] + +theorem scaled_substitution_coeff_bound {I J : Type*} + (T : J → ℝ) (hT : ∀ j, 0 < T j) + (f : I → MvPolynomial J ℝ) (p : MvPolynomial I ℝ) + {A B : ℝ} {s : ℕ} (hB : 1 ≤ B) + (hf : ∀ i, realPolynomialMass (scaleMvPolynomialAxes T (f i)) ≤ B) + (hp : ∀ α, |p.coeff α| ≤ A) (hdegree : p.totalDegree ≤ s) + (α : J →₀ ℕ) : + |(eval₂Hom C f p).coeff α| ≤ + ((p.support.card : ℝ) * A * B ^ s) / monomialScale T α := by + have hmass : realPolynomialMass p ≤ p.support.card * A := by + unfold realPolynomialMass + exact (Finset.sum_le_sum (fun β _ => hp β)).trans_eq (by simp) + have hsub : realPolynomialMass (scaleMvPolynomialAxes T (eval₂Hom C f p)) ≤ + p.support.card * A * B ^ s := by + rw [scaleMvPolynomialAxes_substitution] + exact (realPolynomialMass_substitution_le p _ hB hf hdegree).trans + (mul_le_mul_of_nonneg_right hmass (pow_nonneg (by linarith) _)) + have h := (realPolynomialMass_coeff_le + (scaleMvPolynomialAxes T (eval₂Hom C f p)) α).trans hsub + rw [scaleMvPolynomialAxes_coeff, abs_mul, + abs_of_pos (monomialScale_pos T hT α)] at h + exact (le_div_iff₀ (monomialScale_pos T hT α)).mpr h + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open Module + +variable {σ τ ι V : Type*} + +theorem coordinate_realChartSubstitute + [AddCommGroup V] [Module ℚ V] [Module ℝ V] [IsScalarTower ℚ ℝ V] + (l : V →ₗ[ℝ] ℝ) (f : σ → MvPolynomial τ ℝ) (P : VectorPolynomial σ ℚ V) : + coordinate l.toAddMonoidHom (Erdos3.VectorPolynomial.realChartSubstitute f P) = + MvPolynomial.eval₂Hom MvPolynomial.C f (coordinate l.toAddMonoidHom P) := by + apply MvPolynomial.funext + intro x + rw [← coordinate_eval₂ l x, eval₂_realChartSubstitute, coordinate_eval₂] + simp only [MvPolynomial.coe_eval₂Hom, ← MvPolynomial.eval_assoc, Function.comp_def] + +theorem CoefficientBound.realChartSubstitute [Fintype σ] + [LieRing V] [LieAlgebra ℚ V] [LieAlgebra ℝ V] [IsScalarTower ℚ ℝ V] + (b : Basis ι ℝ V) (T : τ → ℝ) (hT : ∀ i, 0 < T i) + (f : σ → MvPolynomial τ ℝ) {A B : ℝ} {s : ℕ} {P : VectorPolynomial σ ℚ V} + (hP : CoefficientBound b (fun _ => 1) A P) (hA : 0 ≤ A) (hB : 1 ≤ B) + (hdegree : DegreeLE (fun _ : σ => 1) s P) + (hf : ∀ i, realPolynomialMass (scaleMvPolynomialAxes T (f i)) ≤ B) : + CoefficientBound b T + (((s : ℝ) + 1) * ((Fintype.card σ : ℝ) + 1) ^ s * A * B ^ s) + (Erdos3.VectorPolynomial.realChartSubstitute f P) := by + intro α i + let Q := coordinate (b.coord i).toAddMonoidHom P + have hQdeg : Q.totalDegree ≤ s := (degreeLE_one_iff_basis_totalDegree b s P).mp hdegree i + have hQcoeff (β) : |Q.coeff β| ≤ A := by + change |b.repr (coefficients P β) i| ≤ A + simpa [monomialScale] using hP β i + have hcard : (Q.support.card : ℝ) ≤ ((s : ℝ) + 1) * ((Fintype.card σ : ℝ) + 1) ^ s := by + exact_mod_cast polynomial_support_card_le Q hQdeg + have hbound := scaled_substitution_coeff_bound T hT f Q hB hf hQcoeff hQdeg α + have heq := congrArg (fun q : MvPolynomial τ ℝ => q.coeff α) + (coordinate_realChartSubstitute (b.coord i) f P) + rw [coeff_coordinate] at heq + change (b.coord i) (coefficients (Erdos3.VectorPolynomial.realChartSubstitute f P) α) = _ at heq + change |(b.coord i) (coefficients (Erdos3.VectorPolynomial.realChartSubstitute f P) α)| ≤ _ + rw [heq] + apply hbound.trans + apply div_le_div_of_nonneg_right _ (monomialScale_pos T hT α).le + exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hcard hA) + (pow_nonneg (zero_le_one.trans hB) s) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/VectorSubspaceCorrectionRepresentatives.lean b/lean/OAI/Combinatorics/Progressions/Estimates/VectorSubspaceCorrectionRepresentatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef3ce50751a8ae87715a72102bd5f615bddc519c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/VectorSubspaceCorrectionRepresentatives.lean @@ -0,0 +1,419 @@ +import Mathlib.Data.Fintype.BigOperators +import OAI.Combinatorics.Progressions.Dynamics.FinitePrimitiveCorrectionBudget +import OAI.Combinatorics.Progressions.Estimates.FiniteFiberRepresentatives +import OAI.Combinatorics.Progressions.Polynomial.PolynomialTagRestrictionBudget +import OAI.Combinatorics.Progressions.Sampling.FiniteNormalizedRealGridCorrection + +namespace OAI + +section + +namespace Erdos3 + +private theorem boundedExponentWindow_finite (K : Type*) [Fintype K] (s : ℕ) : + ({m : K →₀ ℕ | m.sum (fun _ n => n) ≤ s} : Set (K →₀ ℕ)).Finite := by + classical + let S := {m : K →₀ ℕ // m.sum (fun _ n => n) ≤ s} + let f : S → List.Vector (Option K) s := fun m => paddedExponentWord m.val s m.property + have hf : Function.Injective f := by + intro m n hmn + apply Subtype.ext + apply Finsupp.ext + intro k + have hc := congrArg + (fun v : List.Vector (Option K) s => (v.val : Multiset (Option K)).count (some k)) hmn + simpa only [f, paddedExponentWord_count] using hc + let _ : Finite ↥({m : K →₀ ℕ | m.sum (fun _ n => n) ≤ s} : Set (K →₀ ℕ)) := + Finite.of_injective f hf + exact Set.toFinite _ + +noncomputable def boundedExponentWindow (K : Type*) [Fintype K] (s : ℕ) : + Finset (K →₀ ℕ) := + (boundedExponentWindow_finite K s).toFinset + +@[simp] theorem boundedExponentWindow_mem_iff {K : Type*} [Fintype K] + (s : ℕ) (m : K →₀ ℕ) : + m ∈ boundedExponentWindow K s ↔ m.sum (fun _ n => n) ≤ s := + (boundedExponentWindow_finite K s).mem_toFinset + +theorem boundedExponentWindow_card_le (K : Type*) [Fintype K] (s : ℕ) : + (boundedExponentWindow K s).card ≤ (Fintype.card K + 1) ^ s := + boundedExponentSet_card_le _ s (fun m hm => (boundedExponentWindow_mem_iff s m).mp hm) + +theorem support_subset_boundedExponentWindow {K R : Type*} [Fintype K] [CommSemiring R] + (p : MvPolynomial K R) {s : ℕ} (hp : p.totalDegree ≤ s) : + p.support ⊆ boundedExponentWindow K s := by + intro m hm + exact (boundedExponentWindow_mem_iff s m).mpr ((MvPolynomial.le_totalDegree hm).trans hp) + +end Erdos3 + +end + +section + +namespace Erdos3 +open Module _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {U B I : Type*} [Fintype B] [Fintype I] + +theorem exists_finite_subspace_normalized_correction_representatives + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (H : U → ℝ) (hH : ∀ i, 1 ≤ H i) (A : B → MvPolynomial U ℝ) + (hA : ∀ α, (fun b => (A b).coeff α) ∈ K) + (P : MvPolynomial (U ⊕ B) ℝ) + (S : Finset ((U ⊕ I) →₀ ℕ)) (bound : ℝ) (hbound : 0 ≤ bound) + (q : ℕ) (hq : 0 < q) + (admissible : (MvPolynomial (U ⊕ B) ℝ × MvPolynomial (U ⊕ B) ℝ) → Prop) + (hsupport : ∀ sr, admissible sr → + (polynomialSubspaceRestriction K e sr.1).support ⊆ S ∧ + (polynomialSubspaceRestriction K e sr.2).support ⊆ S) + (hslow : ∀ sr, admissible sr → ∀ α, + |(polynomialSubspaceRestriction K e sr.1).coeff α| ≤ bound) + (hrat : ∀ sr, admissible sr → ∀ α, + ∃ z : ℤ, (polynomialSubspaceRestriction K e sr.2).coeff α = (z : ℝ) / q) + (hidentity : ∀ sr, admissible sr → ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval (Sum.elim u b) P = + eval (Sum.elim (fun i => u i / H i) + (fun i => b i - eval u (A i))) sr.1 + eval (Sum.elim u b) sr.2) : + ∃ m : ℕ, m ≤ (2 * ⌈(q : ℝ) * bound⌉₊ + 3) ^ S.card ∧ + ∃ candidate : Fin m → + (MvPolynomial (U ⊕ B) ℝ × MvPolynomial (U ⊕ B) ℝ), + (∀ j, admissible (candidate j)) ∧ + ∀ sr, admissible sr → ∃ j, + polynomialSubspaceRestriction K e (candidate j).1 = + polynomialSubspaceRestriction K e sr.1 ∧ + polynomialSubspaceRestriction K e (candidate j).2 = + polynomialSubspaceRestriction K e sr.2 ∧ + ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval (Sum.elim u b) (candidate j).1 = eval (Sum.elim u b) sr.1 ∧ + eval (Sum.elim u b) (candidate j).2 = eval (Sum.elim u b) sr.2 := by + let restrict := fun sr : MvPolynomial (U ⊕ B) ℝ × MvPolynomial (U ⊕ B) ℝ => + (polynomialSubspaceRestriction K e sr.1, polynomialSubspaceRestriction K e sr.2) + obtain ⟨n, hn, restricted, _, hcover⟩ := + exists_finite_normalized_real_grid_corrections H hH + (normalizedChartSubspaceCoordinates K e A hA) S + (polynomialSubspaceRestriction K e P) bound hbound q hq + have hcoverage : ∀ sr, admissible sr → ∃ i, restricted i = restrict sr := by + intro sr hsr + apply hcover + refine ⟨(hsupport sr hsr).1, (hsupport sr hsr).2, hslow sr hsr, hrat sr hsr, ?_⟩ + exact normalizedChart_subspace_decomposition K e H A hA P sr.1 sr.2 + (hidentity sr hsr) + obtain ⟨m, hm, candidate, hvalid, hcomplete⟩ := + exists_finite_fiber_representatives restrict admissible restricted hcoverage + refine ⟨m, hm.trans hn, candidate, hvalid, ?_⟩ + intro sr hsr + obtain ⟨j, hj⟩ := hcomplete sr hsr + have hleft := congrArg Prod.fst hj + have hright := congrArg Prod.snd hj + refine ⟨j, hleft, hright, ?_⟩ + intro u b hb + exact ⟨polynomialSubspaceRestriction_eval_eq K e _ _ hleft u b hb, + polynomialSubspaceRestriction_eval_eq K e _ _ hright u b hb⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 +open Module _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {U B I η α : Type*} [Fintype B] [Fintype I] [Fintype η] + +theorem exists_finite_vector_subspace_normalized_correction_representatives + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (H : U → ℝ) (hH : ∀ i, 1 ≤ H i) (A : B → MvPolynomial U ℝ) + (hA : ∀ d, (fun b => (A b).coeff d) ∈ K) + (P : η → MvPolynomial (U ⊕ B) ℝ) + (S : Finset ((U ⊕ I) →₀ ℕ)) (bound : ℝ) (hbound : 0 ≤ bound) + (q : ℕ) (hq : 0 < q) + (slow rat : α → η → MvPolynomial (U ⊕ B) ℝ) (admissible : α → Prop) + (hsupport : ∀ a, admissible a → ∀ i, + (polynomialSubspaceRestriction K e (slow a i)).support ⊆ S ∧ + (polynomialSubspaceRestriction K e (rat a i)).support ⊆ S) + (hslow : ∀ a, admissible a → ∀ i d, + |(polynomialSubspaceRestriction K e (slow a i)).coeff d| ≤ bound) + (hrat : ∀ a, admissible a → ∀ i d, + ∃ z : ℤ, (polynomialSubspaceRestriction K e (rat a i)).coeff d = (z : ℝ) / q) + (hidentity : ∀ a, admissible a → ∀ i (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval (Sum.elim u b) (P i) = + eval (Sum.elim (fun j => u j / H j) + (fun j => b j - eval u (A j))) (slow a i) + eval (Sum.elim u b) (rat a i)) : + ∃ m : ℕ, m ≤ ((2 * ⌈(q : ℝ) * bound⌉₊ + 3) ^ S.card) ^ Fintype.card η ∧ + ∃ candidate : Fin m → α, + (∀ j, admissible (candidate j)) ∧ + ∀ a, admissible a → ∃ j, ∀ i, + polynomialSubspaceRestriction K e (slow (candidate j) i) = + polynomialSubspaceRestriction K e (slow a i) ∧ + polynomialSubspaceRestriction K e (rat (candidate j) i) = + polynomialSubspaceRestriction K e (rat a i) := by + classical + let restrict : α → η → + (MvPolynomial (U ⊕ I) ℝ × MvPolynomial (U ⊕ I) ℝ) := + fun a i => (polynomialSubspaceRestriction K e (slow a i), + polynomialSubspaceRestriction K e (rat a i)) + choose n hn c _hc hcover using fun i : η => + exists_finite_normalized_real_grid_corrections H hH + (normalizedChartSubspaceCoordinates K e A hA) S + (polynomialSubspaceRestriction K e (P i)) bound hbound q hq + let Index := ∀ i : η, Fin (n i) + let enum : Index ≃ Fin (Fintype.card Index) := Fintype.equivFin Index + let family : Fin (Fintype.card Index) → η → + (MvPolynomial (U ⊕ I) ℝ × MvPolynomial (U ⊕ I) ℝ) := + fun j i => c i (enum.symm j i) + have hcoverage : ∀ a, admissible a → ∃ j, family j = restrict a := by + intro a ha + have each (i : η) : ∃ j, c i j = restrict a i := by + apply hcover i + refine ⟨(hsupport a ha i).1, (hsupport a ha i).2, + hslow a ha i, hrat a ha i, ?_⟩ + exact normalizedChart_subspace_decomposition K e H A hA (P i) + (slow a i) (rat a i) (hidentity a ha i) + choose indices hi using each + refine ⟨enum indices, ?_⟩ + funext i + simpa only [family, Equiv.symm_apply_apply] using hi i + obtain ⟨m, hm, candidate, hvalid, hcomplete⟩ := + exists_finite_fiber_representatives restrict admissible family hcoverage + refine ⟨m, hm.trans ?_, candidate, hvalid, ?_⟩ + · change Fintype.card (∀ i : η, Fin (n i)) ≤ _ + rw [Fintype.card_pi] + simp only [Fintype.card_fin] + calc + _ ≤ ∏ _i : η, (2 * ⌈(q : ℝ) * bound⌉₊ + 3) ^ S.card := + Finset.prod_le_prod (fun i _ => hn i) + _ = _ := by simp + · intro a ha + obtain ⟨j, hj⟩ := hcomplete a ha + refine ⟨j, fun i => ?_⟩ + have hi := congrFun hj i + exact ⟨congrArg Prod.fst hi, congrArg Prod.snd hi⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 +open Module _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {U B I η α : Type*} [Fintype U] [Fintype B] [Fintype I] [Fintype η] + +theorem exists_finite_primitive_subspace_correction_representatives + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (H : U → ℝ) (hH : ∀ i, 1 ≤ H i) (A : B → MvPolynomial U ℝ) + (hA : ∀ d, (fun b => (A b).coeff d) ∈ K) + (P : η → MvPolynomial (U ⊕ B) ℝ) + (s q d : ℕ) (hq : 0 < q) (hd : 0 < d) + (L M : ℝ) (hM : 0 ≤ M) + (he : ∀ i b, |(e i : B → ℝ) b| ≤ L) + (hegrid : ∀ i b, ∃ z : ℤ, (z : ℝ) = (d : ℝ) * (e i : B → ℝ) b) + (slow rat : α → η → MvPolynomial (U ⊕ B) ℝ) (admissible : α → Prop) + (hdegree : ∀ a, admissible a → ∀ i, + (slow a i).totalDegree ≤ s ∧ (rat a i).totalDegree ≤ s) + (hcoeff : ∀ a, admissible a → ∀ i ex, |(slow a i).coeff ex| ≤ M) + (hgrid : ∀ a, admissible a → ∀ i, realPolynomialCoefficientGrid q (rat a i)) + (hidentity : ∀ a, admissible a → ∀ i (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval (Sum.elim u b) (P i) = + eval (Sum.elim (fun j => u j / H j) + (fun j => b j - eval u (A j))) (slow a i) + eval (Sum.elim u b) (rat a i)) : + let Rcap := (((Fintype.card (U ⊕ B) : ℝ) + 1) ^ s * M) * + (max 1 ((Fintype.card I : ℝ) * L)) ^ s + ∃ m : ℕ, + m ≤ ((2 * ⌈((q * d ^ s : ℕ) : ℝ) * Rcap⌉₊ + 3) ^ + ((Fintype.card (U ⊕ I) + 1) ^ s)) ^ Fintype.card η ∧ + ∃ candidate : Fin m → α, + (∀ j, admissible (candidate j)) ∧ + ∀ a, admissible a → ∃ j, ∀ i, + polynomialSubspaceRestriction K e (slow (candidate j) i) = + polynomialSubspaceRestriction K e (slow a i) ∧ + polynomialSubspaceRestriction K e (rat (candidate j) i) = + polynomialSubspaceRestriction K e (rat a i) := by + classical + dsimp only + let Rcap := (((Fintype.card (U ⊕ B) : ℝ) + 1) ^ s * M) * + (max 1 ((Fintype.card I : ℝ) * L)) ^ s + have hRcap : 0 ≤ Rcap := mul_nonneg + (mul_nonneg (pow_nonneg (by positivity) s) hM) + (pow_nonneg (le_trans zero_le_one (le_max_left _ _)) s) + obtain ⟨m, hm, candidate, hvalid, hcover⟩ := + exists_finite_vector_subspace_normalized_correction_representatives + K e H hH A hA P (boundedExponentWindow (U ⊕ I) s) + Rcap hRcap (q * d ^ s) (Nat.mul_pos hq (pow_pos hd s)) + slow rat admissible + (fun a ha i => ⟨support_subset_boundedExponentWindow _ + ((polynomialSubspaceRestriction_totalDegree_le K e _).trans (hdegree a ha i).1), + support_subset_boundedExponentWindow _ + ((polynomialSubspaceRestriction_totalDegree_le K e _).trans (hdegree a ha i).2)⟩) + (fun a ha i ex => polynomialSubspaceRestriction_coeff_le K e (slow a i) hM he + (hdegree a ha i).1 (hcoeff a ha i) ex) + (fun a ha i ex => polynomialSubspaceRestriction_coeff_div K e (rat a i) + q d s hq hd hegrid (hdegree a ha i).2 (hgrid a ha i) ex) + hidentity + refine ⟨m, hm.trans ?_, candidate, hvalid, hcover⟩ + apply Nat.pow_le_pow_left + exact Nat.pow_le_pow_right (by omega) + (boundedExponentWindow_card_le (U ⊕ I) s) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +theorem exists_uniform_finite_subspace_correction_representatives (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {U B I η α : Type*} [Fintype U] [Fintype B] [Fintype I] [Fintype η] + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (H : U → ℝ) (_hH : ∀ i, 1 ≤ H i) (A : B → MvPolynomial U ℝ), + (∀ d, (fun b => (A b).coeff d) ∈ K) → + ∀ (P : η → MvPolynomial (U ⊕ B) ℝ) (q d : ℕ) (p L M : ℝ), + 0 < q → 0 < d → 0 ≤ p → + (Fintype.card U : ℝ) ≤ p → (Fintype.card B : ℝ) ≤ p → + (Fintype.card I : ℝ) ≤ p → (Fintype.card η : ℝ) ≤ p → + (q : ℝ) ≤ Real.exp ((p + a) ^ a) → (d : ℝ) ≤ Real.exp ((p + a) ^ a) → + L ≤ Real.exp ((p + a) ^ a) → 0 ≤ M → M ≤ Real.exp ((p + a) ^ a) → + (∀ i b, |(e i : B → ℝ) b| ≤ L) → + (∀ i b, ∃ z : ℤ, (z : ℝ) = (d : ℝ) * (e i : B → ℝ) b) → + ∀ (slow rat : α → η → MvPolynomial (U ⊕ B) ℝ) (admissible : α → Prop), + (∀ x, admissible x → ∀ i, + (slow x i).totalDegree ≤ s ∧ (rat x i).totalDegree ≤ s) → + (∀ x, admissible x → ∀ i ex, |(slow x i).coeff ex| ≤ M) → + (∀ x, admissible x → ∀ i, realPolynomialCoefficientGrid q (rat x i)) → + (∀ x, admissible x → ∀ i (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval (Sum.elim u b) (P i) = + eval (Sum.elim (fun j => u j / H j) + (fun j => b j - eval u (A j))) (slow x i) + + eval (Sum.elim u b) (rat x i)) → + ∃ m : ℕ, (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + ∃ candidate : Fin m → α, + (∀ j, admissible (candidate j)) ∧ + ∀ x, admissible x → ∃ j, ∀ i, + polynomialSubspaceRestriction K e (slow (candidate j) i) = + polynomialSubspaceRestriction K e (slow x i) ∧ + polynomialSubspaceRestriction K e (rat (candidate j) i) = + polynomialSubspaceRestriction K e (rat x i) := by + obtain ⟨C, hC, hbudget⟩ := exists_finite_primitive_correction_budget s a + refine ⟨C, hC, ?_⟩ + intro U B I η α _ _ _ _ K e H hH A hA P q d p L M hq hd hp + hU hB hI hη hqCap hdCap hLCap hM hMCap he hegrid + slow rat admissible hdegree hcoeff hgrid hidentity + obtain ⟨m, hm, candidate, hvalid, hcover⟩ := + exists_finite_primitive_subspace_correction_representatives + K e H hH A hA P s q d hq hd L M hM he hegrid + slow rat admissible hdegree hcoeff hgrid hidentity + refine ⟨m, (Nat.cast_le.mpr hm).trans ?_, candidate, hvalid, hcover⟩ + simpa only [Fintype.card_sum] using + hbudget (Fintype.card U) (Fintype.card B) (Fintype.card I) (Fintype.card η) + q d p L M hp hU hB hI hη hqCap hdCap hLCap hM hMCap + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open Module +open scoped BigOperators + +variable {U B I η α V : Type*} [Fintype U] [Fintype B] [Fintype I] [Fintype η] + [AddCommGroup V] [Module ℚ V] [Module ℝ V] [IsScalarTower ℚ ℝ V] + +omit [Fintype U] [Fintype B] [Fintype η] [IsScalarTower ℚ ℝ V] in +private theorem coordinate_grid_of_vector_grid (basis : Basis η ℝ V) + (q : ℕ) (P : VectorPolynomial (U ⊕ B) ℚ V) + (h : ∀ ex, (fun i => basis.coord i (coefficients P ex)) ∈ realDenominatorGrid q) + (i : η) : realPolynomialCoefficientGrid q (coordinate (basis.coord i).toAddMonoidHom P) := by + classical + choose z hz using h + refine ⟨fun ex => z ex i, funext fun ex => ?_⟩ + simpa only [coeff_coordinate, LinearMap.toAddMonoidHom_coe, Pi.smul_apply, smul_eq_mul] + using congrFun (hz ex) i + +theorem exists_finite_vector_correction_representatives + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) (basis : Basis η ℝ V) + (H : U → ℝ) (hH : ∀ i, 1 ≤ H i) (A : B → MvPolynomial U ℝ) + (hA : ∀ ex, (fun b => (A b).coeff ex) ∈ K) + (P : VectorPolynomial (U ⊕ B) ℚ V) + (s q d : ℕ) (hq : 0 < q) (hd : 0 < d) + (L M : ℝ) (hM : 0 ≤ M) + (he : ∀ i b, |(e i : B → ℝ) b| ≤ L) + (hegrid : ∀ i b, ∃ z : ℤ, (z : ℝ) = (d : ℝ) * (e i : B → ℝ) b) + (slow rat : α → VectorPolynomial (U ⊕ B) ℚ V) (admissible : α → Prop) + (hdegree : ∀ a, admissible a → ∀ i, + (coordinate (basis.coord i).toAddMonoidHom (slow a)).totalDegree ≤ s ∧ + (coordinate (basis.coord i).toAddMonoidHom (rat a)).totalDegree ≤ s) + (hcoeff : ∀ a, admissible a → ∀ i ex, |basis.coord i (coefficients (slow a) ex)| ≤ M) + (hgrid : ∀ a, admissible a → ∀ ex, + (fun i => basis.coord i (coefficients (rat a) ex)) ∈ realDenominatorGrid q) + (hidentity : ∀ a, admissible a → ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval₂ (Sum.elim u b) P = + eval₂ (Sum.elim u b) (realChartSubstitute (normalizedRealPolynomialChart H A) (slow a)) + + eval₂ (Sum.elim u b) (rat a)) : + let Rcap := (((Fintype.card (U ⊕ B) : ℝ) + 1) ^ s * M) * + (max 1 ((Fintype.card I : ℝ) * L)) ^ s + ∃ m : ℕ, + m ≤ ((2 * ⌈((q * d ^ s : ℕ) : ℝ) * Rcap⌉₊ + 3) ^ + ((Fintype.card (U ⊕ I) + 1) ^ s)) ^ Fintype.card η ∧ + ∃ candidate : Fin m → α, + (∀ j, admissible (candidate j)) ∧ + ∀ a, admissible a → ∃ j, ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval₂ (Sum.elim u b) (slow (candidate j)) = eval₂ (Sum.elim u b) (slow a) ∧ + eval₂ (Sum.elim u b) (rat (candidate j)) = eval₂ (Sum.elim u b) (rat a) ∧ + eval₂ (Sum.elim u b) + (realChartSubstitute (normalizedRealPolynomialChart H A) (slow (candidate j))) = + eval₂ (Sum.elim u b) + (realChartSubstitute (normalizedRealPolynomialChart H A) (slow a)) := by + let scalar := fun (p : VectorPolynomial (U ⊕ B) ℚ V) i => + coordinate (basis.coord i).toAddMonoidHom p + obtain ⟨m, hm, candidate, hvalid, hcover⟩ := + exists_finite_primitive_subspace_correction_representatives K e H hH A hA + (scalar P) s q d hq hd L M hM he hegrid + (fun a => scalar (slow a)) (fun a => scalar (rat a)) admissible hdegree + (fun a ha i ex => by simpa only [scalar, coeff_coordinate, + LinearMap.toAddMonoidHom_coe] using hcoeff a ha i ex) + (fun a ha i => coordinate_grid_of_vector_grid basis q (rat a) (hgrid a ha) i) + (by + intro a ha i u b hb + have h := congrArg (basis.coord i) (hidentity a ha u b hb) + rw [eval₂_normalizedRealPolynomialChart] at h + simpa only [map_add, coordinate_eval₂] using h) + refine ⟨m, hm, candidate, hvalid, ?_⟩ + intro a ha + obtain ⟨j, hj⟩ := hcover a ha + have heval (t : α → VectorPolynomial (U ⊕ B) ℚ V) + (ht : ∀ i, polynomialSubspaceRestriction K e (scalar (t (candidate j)) i) = + polynomialSubspaceRestriction K e (scalar (t a) i)) + (u : U → ℝ) (b : B → ℝ) (hb : b ∈ K) : + eval₂ (Sum.elim u b) (t (candidate j)) = eval₂ (Sum.elim u b) (t a) := by + apply basis.repr.injective + ext i + change basis.coord i _ = basis.coord i _ + rw [coordinate_eval₂, coordinate_eval₂] + exact polynomialSubspaceRestriction_eval_eq K e _ _ (ht i) u b hb + refine ⟨j, ?_⟩ + intro u b hb + refine ⟨heval slow (fun i => (hj i).1) u b hb, + heval rat (fun i => (hj i).2) u b hb, ?_⟩ + rw [eval₂_normalizedRealPolynomialChart, eval₂_normalizedRealPolynomialChart] + exact heval slow (fun i => (hj i).1) _ _ + (K.sub_mem hb (normalizedChartSubspaceCoordinates_eval_mem K A hA u)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/VerticalTranslations.lean b/lean/OAI/Combinatorics/Progressions/Estimates/VerticalTranslations.lean new file mode 100644 index 0000000000000000000000000000000000000000..2da61cfd4fd8478b4b33faaabac79c9d9e07723e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/VerticalTranslations.lean @@ -0,0 +1,30 @@ +import OAI.Combinatorics.Progressions.Fourier.VerticalFrequencyIdentification + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup CircleFourier + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (D : RationalFilteredNilmanifold L s d) + +theorem vertical_left_translate (F : D.Space → ℂ) (eta : L →ₗ[ℚ] ℚ) + (hF : ∀ z, z ∈ D.filtration.realification.subgroup s → ∀ x, + F (z • x) = character ((realifyFunctional eta z.coord : ℝ) : CircleFourier.Circle) * F x) + (a : D.RealGroup) (z : D.RealGroup) (hz : z ∈ D.filtration.realification.subgroup s) + (x : D.Space) : + F (a • (z • x)) = + character ((realifyFunctional eta z.coord : ℝ) : CircleFourier.Circle) * F (a • x) := by + have hc : Commute z a := commute_of_lie_eq_zero z a + (D.filtration.realification.top_layer_central hz a.coord) + rw [← mul_smul, hc.eq.symm, mul_smul] + exact hF z hz (a • x) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedApproximationCaps.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedApproximationCaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8ec8e6ec3d98130f422498eb9b11a054f8052cb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedApproximationCaps.lean @@ -0,0 +1,57 @@ +import OAI.Combinatorics.Progressions.Sampling.WeightedUniformGridDensity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem weightedModerateGridApproximation_norm_le_sum + {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (rows : Finset (Finset I)) (offset : B → ℤ) + (shift z : rows → ℤ) (F : Finset (rows → Fin M)) : + ‖weightedModerateGridApproximation c s K M rows offset shift z F‖ ≤ + ((K : ℝ) / M) ^ rows.card * + ∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M rows k‖ := by + unfold weightedModerateGridApproximation + rw [norm_mul, norm_pow, norm_div, Complex.norm_natCast, Complex.norm_natCast] + apply mul_le_mul_of_nonneg_left _ (by positivity) + calc + _ ≤ ∑ k ∈ F, ‖(∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M rows k) * + (rectangularGridCharacter M k shift * star (rectangularGridCharacter M k z))‖ := norm_sum_le _ _ + _ = ∑ k ∈ F, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M rows k‖ := by + apply Finset.sum_congr rfl + intro k _ + simp only [norm_mul, norm_star, rectangularGridCharacter_norm, mul_one] + _ ≤ _ := Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ F) + (fun _ _ _ => norm_nonneg _) + +theorem weightedModerateGridApproximation_norm_le_cap + {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (rows : Finset (Finset I)) (offset : B → ℤ) + (shift z : rows → ℤ) (F : Finset (rows → Fin M)) {Q : ℝ} + (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) + (hQ : (∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M rows k‖) ≤ Q) : + ‖weightedModerateGridApproximation c s K M rows offset shift z F‖ ≤ Q := by + have hQ0 : 0 ≤ Q := (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hQ + exact (weightedModerateGridApproximation_norm_le_sum c s K M rows offset shift z F).trans + ((mul_le_mul_of_nonneg_left hQ (by positivity)).trans (mul_le_of_le_one_left hQ0 hscale)) + +theorem pmf_complex_average_norm_le {X : Type*} (p : PMF X) (f : X → ℂ) {Q : ℝ} + (hf : ∀ x, ‖f x‖ ≤ Q) : ‖∑' x, ((p x).toReal : ℂ) * f x‖ ≤ Q := by + have hw : HasSum (fun x => (p x).toReal * Q) Q := by + simpa only [one_mul] using (pmf_toReal_hasSum p).mul_right Q + apply tsum_of_norm_bounded hw + intro x + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg ENNReal.toReal_nonneg] + exact mul_le_mul_of_nonneg_left (hf x) ENNReal.toReal_nonneg + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedAxisScaling.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedAxisScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..bac2f98b73cd3c7e816bf3c71d7100ab76ce9f9c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedAxisScaling.lean @@ -0,0 +1,321 @@ +import Mathlib.Algebra.MvPolynomial.PDeriv +import Mathlib.Algebra.MvPolynomial.Rename +import OAI.Combinatorics.Progressions.Polynomial.JointPolynomialDilationGrid +import OAI.Combinatorics.Progressions.Polynomial.PolynomialCoefficientNormalization + +namespace OAI + + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +variable {U B : Type*} [Fintype B] + +noncomputable def translationDirectionalDerivative (b : B → MvPolynomial U ℝ) : + MvPolynomial (U ⊕ B) ℝ →ₗ[ℝ] MvPolynomial (U ⊕ B) ℝ := + ∑ i, (LinearMap.mulLeft ℝ (rename Sum.inl (b i))).comp (pderiv (Sum.inr i)).toLinearMap + +theorem translationDirectionalDerivative_apply (b : B → MvPolynomial U ℝ) + (P : MvPolynomial (U ⊕ B) ℝ) : + translationDirectionalDerivative b P = + ∑ i, rename Sum.inl (b i) * pderiv (Sum.inr i) P := by + simp [translationDirectionalDerivative] + +noncomputable def translationDirectionalSeries (d : ℕ) (b : B → MvPolynomial U ℝ) + (P : MvPolynomial (U ⊕ B) ℝ) : MvPolynomial (U ⊕ B) ℝ := + ∑ i ∈ Finset.range d, ((-1 : ℝ) ^ i / ((i + 1).factorial : ℝ)) • + ((translationDirectionalDerivative b) ^ i) P + +end Erdos3 + + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +variable {U B : Type*} [Fintype B] + +omit [Fintype B] in +theorem degreeOf_rename_inl_inr (P : MvPolynomial U ℝ) (i : B) : + (rename (Sum.inl : U → U ⊕ B) P).degreeOf (Sum.inr i) = 0 := by + classical + by_contra h + obtain ⟨j, _, hj⟩ := mem_vars_rename (Sum.inl : U → U ⊕ B) P + (mem_vars_iff_degreeOf_ne_zero.mpr h) + cases hj + +theorem translationDirectionalDerivative_degreeOf_le + (b : B → MvPolynomial U ℝ) (P : MvPolynomial (U ⊕ B) ℝ) + (d : ℕ) (hP : ∀ j, P.degreeOf (Sum.inr j) ≤ d) (j : B) : + (translationDirectionalDerivative b P).degreeOf (Sum.inr j) ≤ d := by + classical + rw [translationDirectionalDerivative_apply] + apply (degreeOf_sum_le _ _ _).trans + apply Finset.sup_le + intro i _ + apply (degreeOf_mul_le _ _ _).trans + rw [degreeOf_rename_inl_inr, zero_add] + exact mvPolynomial_pderiv_degreeOf_le P (Sum.inr i) (Sum.inr j) (hP j) + +theorem translationDirectionalDerivative_pow_degreeOf_le + (b : B → MvPolynomial U ℝ) (P : MvPolynomial (U ⊕ B) ℝ) + (d : ℕ) (hP : ∀ j, P.degreeOf (Sum.inr j) ≤ d) (k : ℕ) (j : B) : + (((translationDirectionalDerivative b) ^ k) P).degreeOf (Sum.inr j) ≤ d := by + induction k generalizing j with + | zero => simpa using hP j + | succ k ih => + rw [pow_succ', Module.End.mul_apply] + exact translationDirectionalDerivative_degreeOf_le b _ d ih j + +theorem realPolynomialMass_translationDirectionalDerivative + (b : B → MvPolynomial U ℝ) (P : MvPolynomial (U ⊕ B) ℝ) + (d : ℕ) (hP : ∀ j, P.degreeOf (Sum.inr j) ≤ d) + {M : ℝ} (hM : 0 ≤ M) (hb : ∀ i, realPolynomialMass (b i) ≤ M) : + realPolynomialMass (translationDirectionalDerivative b P) ≤ + ((Fintype.card B : ℝ) * d * M) * realPolynomialMass P := by + classical + rw [translationDirectionalDerivative_apply] + apply (realPolynomialMass_sum_le _ _).trans + calc + _ ≤ ∑ _i : B, M * ((d : ℝ) * realPolynomialMass P) := by + apply Finset.sum_le_sum + intro i _ + exact (realPolynomialMass_mul_le _ _).trans + (mul_le_mul ((realPolynomialMass_rename_le _ _).trans (hb i)) + (realPolynomialMass_pderiv_degreeOf P (Sum.inr i) (hP i)) + (realPolynomialMass_nonneg _) hM) + _ = _ := by simp; ring + +theorem realPolynomialMass_translationDirectionalDerivative_pow + (b : B → MvPolynomial U ℝ) (P : MvPolynomial (U ⊕ B) ℝ) + (d : ℕ) (hP : ∀ j, P.degreeOf (Sum.inr j) ≤ d) + {M : ℝ} (hM : 0 ≤ M) (hb : ∀ i, realPolynomialMass (b i) ≤ M) (k : ℕ) : + realPolynomialMass (((translationDirectionalDerivative b) ^ k) P) ≤ + ((Fintype.card B : ℝ) * d * M) ^ k * realPolynomialMass P := by + induction k with + | zero => simp + | succ k ih => + rw [pow_succ', Module.End.mul_apply] + apply (realPolynomialMass_translationDirectionalDerivative b _ d + (translationDirectionalDerivative_pow_degreeOf_le b P d hP k) hM hb).trans + calc + _ ≤ ((Fintype.card B : ℝ) * d * M) * + (((Fintype.card B : ℝ) * d * M) ^ k * realPolynomialMass P) := + mul_le_mul_of_nonneg_left ih (by positivity) + _ = _ := by rw [pow_succ']; ring + +theorem translationDirectionalSeries_coefficient_abs_le_one (i : ℕ) : + |(-1 : ℝ) ^ i / ((i + 1).factorial : ℝ)| ≤ 1 := by + rw [abs_div, abs_pow, abs_neg, abs_one, one_pow, + abs_of_nonneg (Nat.cast_nonneg _)] + apply (div_le_one (by positivity)).mpr + exact_mod_cast Nat.one_le_iff_ne_zero.mpr (Nat.factorial_ne_zero (i + 1)) + +theorem realPolynomialMass_translationDirectionalSeries + (d : ℕ) (b : B → MvPolynomial U ℝ) (P : MvPolynomial (U ⊕ B) ℝ) + (hP : ∀ j, P.degreeOf (Sum.inr j) ≤ d) + {M : ℝ} (hM : 0 ≤ M) (hb : ∀ i, realPolynomialMass (b i) ≤ M) + (hmass : realPolynomialMass P ≤ M) : + realPolynomialMass (translationDirectionalSeries d b P) ≤ + ((d : ℝ) + 1) * M * (1 + (Fintype.card B : ℝ) * d * M) ^ d := by + classical + let A : ℝ := (Fintype.card B : ℝ) * d * M + have hA : 0 ≤ A := by dsimp [A]; positivity + have hterm (i : ℕ) (hi : i ∈ Finset.range d) : + realPolynomialMass (((-1 : ℝ) ^ i / ((i + 1).factorial : ℝ)) • + ((translationDirectionalDerivative b) ^ i) P) ≤ M * (1 + A) ^ d := by + rw [realPolynomialMass_smul] + calc + _ ≤ 1 * (A ^ i * realPolynomialMass P) := + mul_le_mul (translationDirectionalSeries_coefficient_abs_le_one i) + (realPolynomialMass_translationDirectionalDerivative_pow b P d hP hM hb i) + (realPolynomialMass_nonneg _) (by norm_num) + _ ≤ A ^ i * M := by simpa using mul_le_mul_of_nonneg_left hmass (pow_nonneg hA i) + _ ≤ (1 + A) ^ d * M := by + apply mul_le_mul_of_nonneg_right _ hM + exact (pow_le_pow_left₀ hA (by linarith) i).trans + (pow_le_pow_right₀ (by linarith) (Finset.mem_range.mp hi).le) + _ = _ := mul_comm _ _ + unfold translationDirectionalSeries + apply (realPolynomialMass_sum_le _ _).trans + calc + _ ≤ ∑ _i ∈ Finset.range d, M * (1 + A) ^ d := Finset.sum_le_sum hterm + _ = (d : ℝ) * (M * (1 + A) ^ d) := by simp + _ ≤ ((d : ℝ) + 1) * (M * (1 + A) ^ d) := by + exact mul_le_mul_of_nonneg_right (by linarith) (by positivity) + _ = _ := by dsimp [A]; ring + +end Erdos3 + + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +variable {σ τ R : Type*} [CommRing R] + +theorem isWeightedHomogeneous_aeval_monomial (v : σ → ℕ) (w : τ → ℕ) + (f : σ → MvPolynomial τ R) + (hf : ∀ i, (f i).IsWeightedHomogeneous w (v i)) (a : σ →₀ ℕ) (r : R) : + (aeval f (monomial a r)).IsWeightedHomogeneous w (Finsupp.weight v a) := by + classical + rw [aeval_monomial] + have hprod := IsWeightedHomogeneous.prod a.support (fun i => f i ^ a i) + (fun i => a i * v i) (fun i _ => by simpa using (hf i).pow (a i)) + have hweight : (∑ i ∈ a.support, a i * v i) = Finsupp.weight v a := by + simp only [Finsupp.weight_apply, Finsupp.sum, nsmul_eq_mul, Nat.cast_id] + rw [hweight] at hprod + simpa only [MvPolynomial.algebraMap_eq, Finsupp.prod] using hprod.C_mul r + +theorem isWeightedHomogeneous_algHom (v : σ → ℕ) (w : τ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) + (hF : ∀ i, (F (X i)).IsWeightedHomogeneous w (v i)) + {p : MvPolynomial σ R} {n : ℕ} (hp : p.IsWeightedHomogeneous v n) : + (F p).IsWeightedHomogeneous w n := by + classical + rw [MvPolynomial.aeval_unique F] + rw [← p.support_sum_monomial_coeff, map_sum] + apply IsWeightedHomogeneous.sum + intro a ha + have hweight : Finsupp.weight v a = n := hp (mem_support_iff.mp ha) + rw [← hweight] + exact isWeightedHomogeneous_aeval_monomial v w (fun i => F (X i)) hF a _ + +theorem weightedHomogeneousComponent_eq_of_sub_lower (w : σ → ℕ) + {p q : MvPolynomial σ R} {n : ℕ} + (hpq : p - q ∈ weightedSupportLT w n) (hq : q.IsWeightedHomogeneous w n) : + weightedHomogeneousComponent w n p = q := by + have hzero : weightedHomogeneousComponent w n (p - q) = 0 := by + apply MvPolynomial.ext + intro a + rw [coeff_weightedHomogeneousComponent, AddMonoidAlgebra.coeff_zero] + split_ifs with ha + · by_contra hc + have hlt := hpq (mem_support_iff.mpr hc) + change Finsupp.weight w a < n at hlt + omega + · rfl + rw [map_sub, hq.weightedHomogeneousComponent_same, sub_eq_zero] at hzero + exact hzero + +theorem aeval_isWeightedHomogeneous (v : σ → ℕ) (w : τ → ℕ) + (f : σ → MvPolynomial τ R) + (hf : ∀ i, (f i).IsWeightedHomogeneous w (v i)) + {p : MvPolynomial σ R} {n : ℕ} (hp : p.IsWeightedHomogeneous v n) : + (aeval f p).IsWeightedHomogeneous w n := by + apply isWeightedHomogeneous_algHom v w (aeval f) _ hp + intro i + simpa only [aeval_X] using hf i + +theorem aeval_weightedHomogeneousComponent (v : σ → ℕ) (w : τ → ℕ) + (f : σ → MvPolynomial τ R) + (hf : ∀ i, (f i).IsWeightedHomogeneous w (v i)) + (n : ℕ) (p : MvPolynomial σ R) : + aeval f (weightedHomogeneousComponent v n p) = + weightedHomogeneousComponent w n (aeval f p) := by + classical + rw [← p.support_sum_monomial_coeff] + simp only [map_sum] + apply Finset.sum_congr rfl + intro α _ + have hm := isWeightedHomogeneous_monomial v α (p.coeff α) rfl + have hfα := isWeightedHomogeneous_aeval_monomial v w f hf α (p.coeff α) + by_cases h : n = Finsupp.weight v α + · rw [h, hm.weightedHomogeneousComponent_same, hfα.weightedHomogeneousComponent_same] + · rw [hm.weightedHomogeneousComponent_ne n h, map_zero, + hfα.weightedHomogeneousComponent_ne n h] + +end Erdos3 + + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +theorem isWeightedHomogeneous_mul_pderiv {σ R : Type*} [CommRing R] + (w : σ → ℕ) (i : σ) {Q P : MvPolynomial σ R} {d : ℕ} + (hQ : Q.IsWeightedHomogeneous w (w i)) (hP : P.IsWeightedHomogeneous w d) : + (Q * pderiv i P).IsWeightedHomogeneous w d := by + classical + rw [← P.support_sum_monomial_coeff, map_sum, Finset.mul_sum] + apply (weightedHomogeneousSubmodule R w d).sum_mem + intro a ha + change (Q * pderiv i (monomial a (P.coeff a))).IsWeightedHomogeneous w d + rw [pderiv_monomial] + by_cases hi : a i = 0 + · simp only [hi, Nat.cast_zero, mul_zero, monomial_zero] + exact (weightedHomogeneousSubmodule R w d).zero_mem + · have hweight := Finsupp.weight_sub_single_add (w := w) hi + rw [hP (MvPolynomial.mem_support_iff.mp ha)] at hweight + have hm := hQ.mul (isWeightedHomogeneous_monomial w + (a - Finsupp.single i 1) (P.coeff a * (a i : R)) rfl) + simpa only [Nat.add_comm (w i), hweight] using hm + +variable {U B : Type*} [Fintype B] + +theorem translationDirectionalDerivative_isWeightedHomogeneous + (v : U → ℕ) (w : B → ℕ) (b : B → MvPolynomial U ℝ) + (hb : ∀ i, (b i).IsWeightedHomogeneous v (w i)) + {P : MvPolynomial (U ⊕ B) ℝ} {d : ℕ} + (hP : P.IsWeightedHomogeneous (Sum.elim v w) d) : + (translationDirectionalDerivative b P).IsWeightedHomogeneous (Sum.elim v w) d := by + classical + rw [translationDirectionalDerivative_apply] + apply (weightedHomogeneousSubmodule ℝ (Sum.elim v w) d).sum_mem + intro i _ + apply isWeightedHomogeneous_mul_pderiv (Sum.elim v w) (Sum.inr i) _ hP + rw [rename_eq_aeval] + exact aeval_isWeightedHomogeneous v (Sum.elim v w) (X ∘ Sum.inl) + (fun j => isWeightedHomogeneous_X ℝ (Sum.elim v w) (Sum.inl j)) (hb i) + +theorem translationDirectionalDerivative_pow_isWeightedHomogeneous + (v : U → ℕ) (w : B → ℕ) (b : B → MvPolynomial U ℝ) + (hb : ∀ i, (b i).IsWeightedHomogeneous v (w i)) + {P : MvPolynomial (U ⊕ B) ℝ} {d : ℕ} + (hP : P.IsWeightedHomogeneous (Sum.elim v w) d) (n : ℕ) : + (((translationDirectionalDerivative b) ^ n) P).IsWeightedHomogeneous + (Sum.elim v w) d := by + induction n with + | zero => simpa using hP + | succ n ih => + rw [pow_succ', Module.End.mul_apply] + exact translationDirectionalDerivative_isWeightedHomogeneous v w b hb ih + +theorem translationDirectionalSeries_isWeightedHomogeneous + (v : U → ℕ) (w : B → ℕ) (N : ℕ) (b : B → MvPolynomial U ℝ) + (hb : ∀ i, (b i).IsWeightedHomogeneous v (w i)) + {P : MvPolynomial (U ⊕ B) ℝ} {d : ℕ} + (hP : P.IsWeightedHomogeneous (Sum.elim v w) d) : + (translationDirectionalSeries N b P).IsWeightedHomogeneous (Sum.elim v w) d := by + classical + apply (weightedHomogeneousSubmodule ℝ (Sum.elim v w) d).sum_mem + intro i _ + exact (weightedHomogeneousSubmodule ℝ (Sum.elim v w) d).smul_mem _ + (translationDirectionalDerivative_pow_isWeightedHomogeneous v w b hb hP i) + +end Erdos3 + + +namespace Erdos3 + +open MvPolynomial + +variable {σ : Type*} + +theorem scaleMvPolynomialAxes_weightedHomogeneousComponent + (w : σ → ℕ) (T : σ → ℝ) (d : ℕ) (P : MvPolynomial σ ℝ) : + weightedHomogeneousComponent w d (scaleMvPolynomialAxes T P) = + scaleMvPolynomialAxes T (weightedHomogeneousComponent w d P) := by + classical + ext α + simp only [coeff_weightedHomogeneousComponent, scaleMvPolynomialAxes_coeff] + split_ifs <;> simp + +end Erdos3 + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCenteredExpansion.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCenteredExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..28ba155d8e4cfe00a482b0eca88221f4e6393c56 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCenteredExpansion.lean @@ -0,0 +1,57 @@ +import OAI.Combinatorics.Progressions.Estimates.ComplexFiniteMeans + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem weighted_product_count_of_centered {I X : Type*} [DecidableEq I] [Fintype X] + (S : Finset I) (F : I → X → ℂ) (W : X → ℂ) {error : ℝ} (herror : 0 ≤ error) + (hcentered : ∀ U ⊆ S, U.Nonempty → + ‖𝔼 x, W x * (∏ i ∈ U, (F i x - 1))‖ ≤ error) : + ‖(𝔼 x, W x * (∏ i ∈ S, F i x)) - (𝔼 x, W x)‖ ≤ (2 : ℝ) ^ S.card * error := by + have hp (x : X) : (∏ i ∈ S, F i x) = + ∑ U ∈ S.powerset, ∏ i ∈ U, (F i x - 1) := by + simpa only [sub_add_cancel] using (Finset.prod_add_one (f := fun i => F i x - 1) S) + have he : (𝔼 x, W x * (∏ i ∈ S, F i x)) - (𝔼 x, W x) = + ∑ U ∈ S.powerset.erase ∅, 𝔼 x, W x * (∏ i ∈ U, (F i x - 1)) := by + simp only [hp, Finset.mul_sum, Finset.expect_sum_comm] + rw [← Finset.sum_erase_add _ _ (show ∅ ∈ S.powerset by simp)] + simp + rw [he] + calc + _ ≤ ∑ U ∈ S.powerset.erase ∅, ‖𝔼 x, W x * (∏ i ∈ U, (F i x - 1))‖ := norm_sum_le _ _ + _ ≤ ∑ _U ∈ S.powerset.erase ∅, error := by + apply Finset.sum_le_sum + intro U hU + exact hcentered U (Finset.mem_powerset.mp (Finset.mem_of_mem_erase hU)) + (Finset.nonempty_iff_ne_empty.mpr (Finset.ne_of_mem_erase hU)) + _ = ((S.powerset.erase ∅).card : ℝ) * error := by simp + _ ≤ (S.powerset.card : ℝ) * error := mul_le_mul_of_nonneg_right + (by exact_mod_cast Finset.card_le_card (Finset.erase_subset ∅ S.powerset)) herror + _ = _ := by simp + +theorem norm_expect_finite_weighted_sum_le {J X : Type*} [Fintype J] [Fintype X] + (c : J → ℂ) (H : J → X → ℂ) (f : X → ℂ) {error : ℝ} + (h : ∀ j, ‖𝔼 x, H j x * f x‖ ≤ error) : + ‖𝔼 x, (∑ j, c j * H j x) * f x‖ ≤ (∑ j, ‖c j‖) * error := by + have he : (𝔼 x, (∑ j, c j * H j x) * f x) = ∑ j, c j * (𝔼 x, H j x * f x) := by + simp only [Finset.sum_mul, Finset.expect_sum_comm, mul_assoc, ← Finset.mul_expect] + rw [he] + calc + _ ≤ ∑ j, ‖c j * (𝔼 x, H j x * f x)‖ := norm_sum_le _ _ + _ ≤ ∑ j, ‖c j‖ * error := by + apply Finset.sum_le_sum + intro j _ + rw [norm_mul] + exact mul_le_mul_of_nonneg_left (h j) (norm_nonneg _) + _ = _ := (Finset.sum_mul ..).symm + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCoefficientSplit.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCoefficientSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c6cf9126bff51304f020af98f580c2bb687c875 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCoefficientSplit.lean @@ -0,0 +1,46 @@ +import OAI.Combinatorics.Progressions.Geometry.CoordinateConstantDecomposition +import OAI.Combinatorics.Progressions.Probability.CoefficientProductLaw + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators + +theorem coefficientProductDensity_split_law {K : Type*} [Fintype K] {m : ℕ} + {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)] + [∀ j, MeasurableSpace (SubspaceArrayTorus Unit (U j))] + [∀ j, BorelSpace (SubspaceArrayTorus Unit (U j))] + (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ s : CoefficientSlot K m, Measure (SubspaceArrayTorus Unit (U s.1))) + [∀ s, (ν s).IsAddLeftInvariant] [∀ s, IsProbabilityMeasure (ν s)] + (f : ∀ s : CoefficientSlot K m, SubspaceArrayTorus Unit (U s.1) → ℝ) + (hf : ∀ s, Measurable (f s)) (hfi : ∀ s, Integrable (f s) (ν s)) + (hf0 : ∀ s x, 0 ≤ f s x) (hmass : ∀ s, (∫ x, f s x ∂ν s) = 1) : + (realDensityMeasure μ (coefficientProductDensity U f)).map + (coefficientCoordinateSplit U ∘ coefficientCoordinateTorus U) = + (Measure.pi (fun s : NonconstantCoefficientSlot K m => realDensityMeasure (ν s.val) (f s.val))).prod + (realDensityMeasure (Measure.pi (fun j => ν (constantCoefficientSlotEquiv K m j).val)) + (fun c => ∏ j, f (constantCoefficientSlotEquiv K m j).val (c j))) := by + let _ : ∀ s, IsProbabilityMeasure (realDensityMeasure (ν s) (f s)) := + fun s => realDensityMeasure_probability (ν s) (f s) (hfi s) (hf0 s) (hmass s) + have hs := coefficientCoordinateSplit_measurePreserving U + (fun s => realDensityMeasure (ν s) (f s)) + rw [← Measure.map_map hs.measurable (coefficientCoordinateTorus_continuous U).measurable, + coefficientProductDensity_coordinate_law U μ ν f hf hfi hf0, hs.map_eq] + exact congrArg (fun η => + (Measure.pi (fun s : NonconstantCoefficientSlot K m => realDensityMeasure (ν s.val) (f s.val))).prod η) + (realDensityMeasure_pi (fun j => ν (constantCoefficientSlotEquiv K m j).val) + (fun j => f (constantCoefficientSlotEquiv K m j).val) + (fun j => hfi _) (fun j => hf0 _)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCubeNativeDetection.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCubeNativeDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1fc914f87c59ed25fe082f52a967d092a62cb6d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCubeNativeDetection.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Polynomial.CubeMixtureAllDegrees + +namespace OAI + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped BigOperators Classical + +attribute [local instance] NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +theorem exists_native_partner_of_weighted_cube_mixture (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {n : ℕ} (N : Fin n → ℕ) [∀ i, NeZero (N i)] + {Ω : Type*} [Fintype Ω] {I : Ω → Type*} [∀ a, Fintype (I a)] + (μ : FiniteProbabilityWeights Ω) (p : ℝ), 0 ≤ p → (n : ℝ) ≤ p → + ∀ (f : (Fin n → ℤ) → ℂ) (c : ∀ a, I a → ℂ) + (twist : ∀ a, I a → Finset (Fin (s + 1)) → (Fin n → ℤ) → ℂ), + (∀ x ∈ integerBox N, ‖f x‖ ≤ 1) → + (∀ a i ω x, x ∈ integerBox N → ‖twist a i ω x‖ ≤ 1) → + μ.mean (fun a => ∑ i, ‖c a i‖) ≤ Real.exp p → + ∀ z : ℂ, Real.exp (-p) ≤ z.re → + ‖z - μ.complexMean (fun a => ∑ i, c a i * + (𝔼 cube : SupportedCube (s + 1) (integerBox N : Set ((Fin n) → ℤ)), + let u := (physicalCubeParametersEquiv (Fin n) (s + 1)).symm cube.val + ∏ ω, conjugationPower ω.card (f (physicalCubeVertexValue u ω)) * + twist a i ω (physicalCubeVertexValue u ω)))‖ ≤ Real.exp (-p) / 2 → + ∃ (a : Ω) (i : I a) + (V : NativeSampleCorrelation (fun _ : Fin n => 1) s ((p + 2) ^ C) + (integerBox N) id (fun x => f x * twist a i ∅ x)), + V.test.normBound ≤ 1 ∧ + Real.exp (-((p + 2) ^ C)) ≤ + ‖𝔼 x ∈ integerBox N, f x * star (star (twist a i ∅ x) * V.test.eval x)‖ := by + obtain ⟨C, hC, hdetect⟩ := exists_native_partner_of_physical_cube_mixture_all_degrees s + refine ⟨C, hC, ?_⟩ + intro n N _ Ω _ I _ μ p hp hn f c twist hf ht hc z hz herr + let c' : (Σ a, I a) → ℂ := fun i => (μ.weight i.1 : ℂ) * c i.1 i.2 + have hc' : (∑ i, ‖c' i‖) ≤ Real.exp p := by + simpa only [c', FiniteProbabilityWeights.mean, Fintype.sum_sigma, norm_mul, Complex.norm_real, + Real.norm_of_nonneg (μ.nonneg _), ← Finset.mul_sum] using hc + have herr' : ‖z - ∑ i : (Σ a, I a), c' i * + (𝔼 cube : SupportedCube (s + 1) (integerBox N : Set ((Fin n) → ℤ)), + let u := (physicalCubeParametersEquiv (Fin n) (s + 1)).symm cube.val + ∏ ω, conjugationPower ω.card (f (physicalCubeVertexValue u ω)) * + twist i.1 i.2 ω (physicalCubeVertexValue u ω))‖ ≤ Real.exp (-p) / 2 := by + simpa only [c', Fintype.sum_sigma, FiniteProbabilityWeights.complexMean, + Finset.mul_sum, mul_assoc] using herr + obtain ⟨i, V, hV, hcorr⟩ := hdetect N p hp hn f c' (fun i => twist i.1 i.2) + hf (fun i => ht i.1 i.2) hc' z hz herr' + exact ⟨i.1, i.2, V, hV, hcorr⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCubePlateau.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCubePlateau.lean new file mode 100644 index 0000000000000000000000000000000000000000..de3fdd01f164a3b6097d8851e9a058900885f905 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedCubePlateau.lean @@ -0,0 +1,219 @@ +import OAI.Combinatorics.Progressions.Probability.WeightedPlateauMixture + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +instance blockTorusFactor_neZero (q h b : ℕ) (A : ℝ) : NeZero (blockTorusFactor q h b A) := + ⟨(blockTorusFactor_pos q h b A).ne'⟩ + +theorem exists_scaled_grid_minimum {J : Type*} [Fintype J] [Nonempty J] + (length : J → ℕ) (hpos : ∀ j, 0 < length j) {K R : ℕ} {E : ℝ} (p d : ℕ) + (hpower : ∀ j, (K : ℝ) ≤ E * (length j : ℝ) ^ p) : + ∃ m : ℕ, 0 < m ∧ (∀ j, m ≤ length j) ∧ + ((R * K : ℕ) : ℝ) ^ d ≤ ((R : ℝ) * E) ^ d * (m : ℝ) ^ (p * d) := by + obtain ⟨m, hm, hmin, hKm⟩ := exists_minimum_side_power length hpos hpower + refine ⟨m, hm, hmin, ?_⟩ + exact grid_size_power_bound (Nat.cast_nonneg R) (Nat.cast_nonneg (R * K)) + (by simp only [Nat.cast_mul, le_refl]) hKm + +theorem weightedModerate_physical_volume_lower {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + {K D : ℝ} (hD : 0 ≤ D) (hlower : K ≤ D * ((c.length : ℝ) * ∏ j, ((s j).length : ℝ))) : + K ≤ D * (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) := by + have hm : (1 : ℝ) ≤ c.modulus none := by exact_mod_cast c.modulus_pos none + apply hlower.trans + apply mul_le_mul_of_nonneg_left _ hD + have hp : 0 ≤ (c.length : ℝ) * ∏ j, ((s j).length : ℝ) := by positivity + have hh := mul_le_mul_of_nonneg_right hm hp + simpa only [one_mul, mul_assoc] using hh + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem weightedCube_side_powers {B I : Type*} [Fintype I] [DecidableEq I] {n : ℕ} + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) {K D T : ℝ} (hD : 0 ≤ D) + (hlower : ∀ b, K ≤ D * ∏ j, ((s b j).length : ℝ)) + (hbalance : ∀ b i j, ((s b i).length : ℝ) ≤ T * (s b j).length) : + ∀ b j, K ≤ (D * T ^ (n + 1)) * ((s b j).length : ℝ) ^ (n + 1) := by + intro b j + simpa only [Fintype.card_fin] using balanced_product_side_power + (fun i => ((s b i).length : ℝ)) hD (fun i => Nat.cast_nonneg _) (hlower b) j + (fun i => hbalance b i j) + +theorem moderate_sliced_side_powers {A L K T x c : ℝ} {C D h : ℕ} + (hA : 1 ≤ A) (hL : 1 ≤ L) (hD : 0 < D) (hh : 0 < h) + (hscale : K ≤ L ^ C) (hrange : L ≤ A ^ D) (hcoefficient : A ^ h ≤ K / L ^ h) + (hx : L ≤ T * x) (hc : K / L ^ h ≤ T * c) : + K ≤ T ^ (D * C) * x ^ (D * C) ∧ K ≤ T ^ (D * C) * c ^ (D * C) := by + have hL0 : 0 ≤ L := le_trans (by norm_num) hL + have hA0 : 0 ≤ A := le_trans (by norm_num) hA + have hcoef0 : 0 ≤ K / L ^ h := (pow_nonneg hA0 h).trans hcoefficient + have hpower : C ≤ D * C := by nlinarith + have hvec : K ≤ L ^ (D * C) := hscale.trans (pow_le_pow_right₀ hL hpower) + have hcoef := moderate_coefficient_side_power hA hL0 hh hscale hrange hcoefficient + constructor + · simpa only [one_mul] using side_power_after_width_loss + (by norm_num : (0 : ℝ) ≤ 1) hL0 (by simpa only [one_mul] using hvec) hx + · simpa only [one_mul] using side_power_after_width_loss + (by norm_num : (0 : ℝ) ≤ 1) hcoef0 (by simpa only [one_mul] using hcoef) hc + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators Classical + +theorem blockJetScaleBound_buffer_le_double (q h b : ℕ) (hb : 0 < b) : + blockJetScaleBound q h b 1 + 1 / 4 ≤ blockJetScaleBound q h b 2 := by + have hn : 1 ≤ b * 2 ^ h * (q + 1) ^ h := Nat.succ_le_of_lt (by positivity) + have hr : (1 : ℝ) ≤ (b : ℝ) * 2 ^ h * ((q + 1 : ℕ) : ℝ) ^ h := by exact_mod_cast hn + unfold blockJetScaleBound + linarith only [hr] + +variable {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] +variable {n K M : ℕ} [NeZero M] +variable (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + +noncomputable def weightedCubePlateauApproximation (K : ℕ) (H : ℝ) + (rows : Finset (Finset I)) (shift z : rows → ℤ) (F : Finset (rows → Fin M)) : ℂ := + (normalizedSupportPlateau H (fun t => ((z t : ℝ) - shift t) / K) : ℂ) * + weightedCubeGridApproximation s K M rows shift z F + +omit [NeZero M] in +theorem weightedCubePMF_zero_off_scaled_support [DecidableEq B] + {V : ℝ} (hV : 0 ≤ V) + (hvol : ∀ b, (∏ v, ((s b v).length : ℝ)) ≤ V * K) + (rows : Finset (Finset I)) (hrows : ∀ t ∈ rows, t.card ≤ n + 1) + (shift z : rows → ℤ) (μ : PMF (rows → ℤ)) + (hμ : (weightedCubeIntegerSource s).toPMF.map (weightedCubeIntegerJetSum s rows shift) = μ) + (hz : ¬∀ t, |(z t : ℝ) - shift t| ≤ + blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) V * K) : μ z = 0 := by + rw [← hμ] + apply pmf_map_zero_off_range + rintro ⟨x, hx⟩ + apply hz + intro t + rw [← hx] + exact weightedCubeIntegerJetSum_scale_bound s hV (Nat.cast_nonneg K) + hvol rows hrows shift x t + +theorem weightedCubePlateauApproximation_error [DecidableEq B] + {V : ℝ} (hV : 0 ≤ V) (hK : 0 < K) + (hvol : ∀ b, (∏ v, ((s b v).length : ℝ)) ≤ V * K) + (rows : Finset (Finset I)) (hrows : ∀ t ∈ rows, t.card ≤ n + 1) + (shift z : rows → ℤ) (μ : PMF (rows → ℤ)) + (hμ : (weightedCubeIntegerSource s).toPMF.map (weightedCubeIntegerJetSum s rows shift) = μ) + (F : Finset (rows → Fin M)) {ε : ℝ} (hε : 0 ≤ ε) + (he : (∀ t, |(z t : ℝ) - shift t| ≤ + (blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) V + 1 / 4) * K) → + ‖(((K : ℝ) ^ rows.card * (μ z).toReal : ℝ) : ℂ) - + weightedCubeGridApproximation s K M rows shift z F‖ ≤ ε) : + ‖(((K : ℝ) ^ rows.card * (μ z).toReal : ℝ) : ℂ) - + weightedCubePlateauApproximation s K + (blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) V) rows shift z F‖ ≤ ε := by + let H := blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) V + let χ := normalizedSupportPlateau H (fun t => ((z t : ℝ) - shift t) / K) + let v : ℂ := ((K : ℝ) ^ rows.card * (μ z).toReal : ℝ) + have hχ := normalizedSupportPlateau_range H (fun t => ((z t : ℝ) - shift t) / K) + have hfix : (χ : ℂ) * v = v := by + by_cases hz : ∀ t, |(z t : ℝ) - shift t| ≤ H * K + · have hχ1 : χ = 1 := normalizedSupportPlateau_grid_one + (blockJetScaleBound_nonneg _ _ _ hV) hK shift z hz + simp only [hχ1, Complex.ofReal_one, one_mul] + · have hzero := weightedCubePMF_zero_off_scaled_support s hV hvol rows hrows shift z μ hμ hz + simp only [v, hzero, ENNReal.toReal_zero, mul_zero, Complex.ofReal_zero] + change ‖v - (χ : ℂ) * weightedCubeGridApproximation s K M rows shift z F‖ ≤ ε + by_cases hχ0 : χ = 0 + · have hv : v = 0 := by simpa only [hχ0, Complex.ofReal_zero, zero_mul] using hfix.symm + simpa only [hv, hχ0, Complex.ofReal_zero, zero_mul, sub_self, norm_zero] using hε + · have hv := he (normalizedSupportPlateau_grid_support hK shift z hχ0) + calc + _ = ‖(χ : ℂ) * (v - weightedCubeGridApproximation s K M rows shift z F)‖ := by + rw [mul_sub, hfix] + _ = χ * ‖v - weightedCubeGridApproximation s K M rows shift z F‖ := by + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg hχ.1] + _ ≤ 1 * ε := mul_le_mul hχ.2 hv (norm_nonneg _) zero_le_one + _ = ε := one_mul ε + +theorem weightedCubePlateauApproximation_norm_le (H : ℝ) + (rows : Finset (Finset I)) (shift z : rows → ℤ) (F : Finset (rows → Fin M)) {C : ℝ} + (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) + (hcap : (∑ k, ‖∏ b, weightedCubeGridCoefficient (s b) M rows k‖) ≤ C) : + ‖weightedCubePlateauApproximation s K H rows shift z F‖ ≤ C := by + have hC : 0 ≤ C := (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hcap + have hsum : ‖∑ k ∈ F, (∏ b, weightedCubeGridCoefficient (s b) M rows k) * + (rectangularGridCharacter M k shift * star (rectangularGridCharacter M k z))‖ ≤ C := by + apply (norm_sum_le _ _).trans + simp only [norm_mul, norm_star, rectangularGridCharacter_norm, mul_one] + exact (Finset.sum_le_univ_sum_of_nonneg (fun _ => norm_nonneg _)).trans hcap + have hχ := normalizedSupportPlateau_range H (fun t => ((z t : ℝ) - shift t) / K) + unfold weightedCubePlateauApproximation weightedCubeGridApproximation + rw [norm_mul, norm_mul, norm_pow, norm_div, Complex.norm_natCast, Complex.norm_natCast, + Complex.norm_real, Real.norm_of_nonneg hχ.1] + exact (mul_le_mul hχ.2 (mul_le_mul hscale hsum (norm_nonneg _) zero_le_one) + (by positivity) zero_le_one).trans_eq (by simp) + +theorem weightedCubePlateauApproximation_split + (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) : + weightedCubePlateauApproximation s K H rows shift z F = + ((K : ℂ) / M) ^ rows.card * ∑ k ∈ F, + (∏ b, weightedCubeGridCoefficient (s 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 weightedCubePlateauApproximation weightedCubeGridApproximation + 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 weightedCubePlateauMixture_expansion + {T : Type*} [Countable T] [MeasurableSpace T] [MeasurableSingletonClass T] + (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) : + (∫ v, weightedCubePlateauApproximation s K H rows (shift v) z F ∂p.toMeasure) = + ((K : ℂ) / M) ^ rows.card * ∑ k ∈ F, + (∏ b, weightedCubeGridCoefficient (s 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 [weightedCubePlateauApproximation_split s 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 v + rw [norm_mul, rationalGridPhase_norm, one_mul] + exact plateauFourierMode_norm _ _ _ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedDerivationDrop.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedDerivationDrop.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e40363dfe34a346751eb361211ccf9b6b826efd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedDerivationDrop.lean @@ -0,0 +1,129 @@ +import Mathlib.Algebra.MvPolynomial.Derivation +import Mathlib.RingTheory.Derivation.Lie +import OAI.Combinatorics.Progressions.Geometry.WeightedSupportDropRename + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] + +theorem weightedDerivation_mul (w : σ → ℕ) + (D : Derivation R (MvPolynomial σ R) (MvPolynomial σ R)) + (P Q : MvPolynomial σ R) (d e k : ℕ) + (hP : P ∈ weightedSupportLE w d) (hQ : Q ∈ weightedSupportLE w e) + (hDP : D P ∈ weightedSupportDrop w d k) (hDQ : D Q ∈ weightedSupportDrop w e k) : + D (P * Q) ∈ weightedSupportDrop w (d + e) k := by + rw [D.leibniz, smul_eq_mul, smul_eq_mul] + apply (weightedSupportDrop w (d + e) k).add_mem (weightedSupportLE_mul_drop hP hDQ) + simpa only [Nat.add_comm e d] using weightedSupportLE_mul_drop hQ hDP + +theorem weightedDerivation_monomial_one (w : σ → ℕ) + (D : Derivation R (MvPolynomial σ R) (MvPolynomial σ R)) (k : ℕ) + (hD : ∀ i, D (X i) ∈ weightedSupportDrop w (w i) k) (a : σ →₀ ℕ) : + D (monomial a 1) ∈ weightedSupportDrop w (Finsupp.weight w a) k := by + classical + have hsingle (i : σ) (n : ℕ) : + D (monomial (Finsupp.single i n) 1) ∈ weightedSupportDrop w (n * w i) k := by + induction n with + | zero => + simp only [Finsupp.single_zero, zero_mul] + change D 1 ∈ _ + rw [D.map_one_eq_zero] + exact Submodule.zero_mem _ + | succ n ih => + have hp := weightedSupportLE_monomial w (Finsupp.single i n) (1 : R) + simp only [Finsupp.weight_single, smul_eq_mul] at hp + have hh := weightedDerivation_mul w D (monomial (Finsupp.single i n) 1) + (X i) (n * w i) (w i) k hp (weightedSupportLE_X w i) ih (hD i) + simpa only [X, monomial_mul_monomial, one_mul, ← Finsupp.single_add, Nat.succ_mul] + using hh + induction a using Finsupp.induction with + | zero => + change D 1 ∈ weightedSupportDrop w 0 k + rw [D.map_one_eq_zero] + exact Submodule.zero_mem _ + | @single_add i n a hi hn ih => + have hp := weightedSupportLE_monomial w (Finsupp.single i n) (1 : R) + have hq := weightedSupportLE_monomial w a (1 : R) + have hh := weightedDerivation_mul w D (monomial (Finsupp.single i n) 1) + (monomial a 1) (Finsupp.weight w (Finsupp.single i n)) (Finsupp.weight w a) k hp hq + (by simpa only [Finsupp.weight_single, smul_eq_mul] using hsingle i n) ih + simpa only [monomial_mul_monomial, one_mul, map_add] using hh + +theorem weightedDerivation_monomial (w : σ → ℕ) + (D : Derivation R (MvPolynomial σ R) (MvPolynomial σ R)) (k : ℕ) + (hD : ∀ i, D (X i) ∈ weightedSupportDrop w (w i) k) (a : σ →₀ ℕ) (c : R) : + D (monomial a c) ∈ weightedSupportDrop w (Finsupp.weight w a) k := by + have hm : C c * monomial a (1 : R) = monomial a c := by + change monomial 0 c * monomial a 1 = monomial a c + rw [monomial_mul_monomial, zero_add, mul_one] + rw [← hm, D.leibniz, MvPolynomial.derivation_C, smul_zero, add_zero, smul_eq_mul] + simpa only [zero_add] using weightedSupportLE_mul_drop (weightedSupportLE_C w 0 c) + (weightedDerivation_monomial_one w D k hD a) + +theorem weightedDerivation_apply (w : σ → ℕ) + (D : Derivation R (MvPolynomial σ R) (MvPolynomial σ R)) (k : ℕ) + (hD : ∀ i, D (X i) ∈ weightedSupportDrop w (w i) k) + {n r : ℕ} {P : MvPolynomial σ R} (hP : P ∈ weightedSupportDrop w n r) : + D P ∈ weightedSupportDrop w n (r + k) := by + classical + rw [← P.support_sum_monomial_coeff, map_sum] + apply (weightedSupportDrop w n (r + k)).sum_mem + intro a ha + have hm := weightedDerivation_monomial w D k hD a (P.coeff a) + intro b hb + have h1 : Finsupp.weight w b + k ≤ Finsupp.weight w a := hm hb + have h2 : Finsupp.weight w a + r ≤ n := hP ha + change Finsupp.weight w b + (r + k) ≤ n + omega + +theorem weightedDerivation_apply_le (w : σ → ℕ) + (D : Derivation R (MvPolynomial σ R) (MvPolynomial σ R)) (k : ℕ) + (hD : ∀ i, D (X i) ∈ weightedSupportDrop w (w i) k) + {n : ℕ} {P : MvPolynomial σ R} (hP : P ∈ weightedSupportLE w n) : + D P ∈ weightedSupportDrop w n k := by + rw [← weightedSupportDrop_zero] at hP + simpa only [Nat.zero_add] using weightedDerivation_apply w D k hD hP + +theorem weightedDerivation_bracket (w : σ → ℕ) + (D E : Derivation R (MvPolynomial σ R) (MvPolynomial σ R)) (a b : ℕ) + (hD : ∀ i, D (X i) ∈ weightedSupportDrop w (w i) a) + (hE : ∀ i, E (X i) ∈ weightedSupportDrop w (w i) b) (i : σ) : + ⁅D, E⁆ (X i) ∈ weightedSupportDrop w (w i) (a + b) := by + rw [Derivation.commutator_apply] + apply (weightedSupportDrop w (w i) (a + b)).sub_mem + · simpa only [Nat.add_comm b a] using weightedDerivation_apply w D a hD (hE i) + · exact weightedDerivation_apply w E b hE (hD i) + +theorem weightedDerivation_pow (w : σ → ℕ) + (D : Derivation R (MvPolynomial σ R) (MvPolynomial σ R)) (k : ℕ) + (hD : ∀ i, D (X i) ∈ weightedSupportDrop w (w i) k) + {n r : ℕ} {P : MvPolynomial σ R} (hP : P ∈ weightedSupportDrop w n r) (m : ℕ) : + (D.toLinearMap ^ m) P ∈ weightedSupportDrop w n (r + m * k) := by + induction m with + | zero => simpa only [pow_zero, Module.End.one_apply, Nat.zero_mul, Nat.add_zero] using hP + | succ m ih => + rw [pow_succ', Module.End.mul_apply] + change D ((D.toLinearMap ^ m) P) ∈ weightedSupportDrop w n (r + (m + 1) * k) + simpa only [Nat.succ_mul, Nat.add_assoc] using weightedDerivation_apply w D k hD ih + +theorem weightedDerivation_pow_eq_zero (w : σ → ℕ) + (D : Derivation R (MvPolynomial σ R) (MvPolynomial σ R)) + (hD : ∀ i, D (X i) ∈ weightedSupportDrop w (w i) 1) + {n : ℕ} {P : MvPolynomial σ R} (hP : P ∈ weightedSupportLE w n) : + (D.toLinearMap ^ (n + 1)) P = 0 := by + rw [← weightedSupportDrop_zero] at hP + have h := weightedDerivation_pow w D 1 hD hP (n + 1) + simp only [Nat.mul_one, Nat.zero_add] at h + exact weightedSupportDrop_eq_zero (Nat.lt_succ_self n) h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedFundamentalApproximation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedFundamentalApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..240aca234daaa24c3311a91e9a79b6d5529d5b73 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedFundamentalApproximation.lean @@ -0,0 +1,89 @@ +import OAI.Combinatorics.Progressions.Probability.WeightedFundamentalMass +import OAI.Combinatorics.Progressions.Sampling.JointGridAccuracy +import OAI.Combinatorics.Progressions.Sampling.WeightedUniformGridDensity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedCube_uniform_fundamental_approximation {B I : Type*} + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] + {n K Q : ℕ} [NeZero K] (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L T ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) (hT : 0 ≤ T) (hε : 0 < ε) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) (hlen : ∀ b j, L ≤ (s b j).length) + (hvol : ∀ b, (∏ j, ((s b j).length : ℝ)) ≤ T * K) + (hQ : blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) T ≤ Q) + (t : ℕ) (J : Finset (Finset I)) (hJ : ∀ F ∈ J, F.card ≤ n + 1) + (hB : uniformSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (((2 * Q + 1) * K : ℕ) : ℝ) ^ J.card ≤ W * L ^ t) + (hscale : ∀ b, (((2 * Q + 1) * K : ℕ) : ℝ) / ∏ j, ((s b j).length : ℝ) ≤ V) : + let ζ := uniformBlockRetainedBias n J.card t U V W ε + let S := uniformBlockSpectrumCover J ((2 * Q + 1) * K) n U V L ζ + ∀ center z : J → ℤ, centeredFundamentalBox Q K center z → + ‖(((K : ℝ) ^ J.card * finiteImageMass (weightedCubeIntegerSource s) + (weightedCubeIntegerJetSum s J center) z : ℝ) : ℂ) - + weightedCubeGridApproximation s K ((2 * Q + 1) * K) J center z S‖ ≤ ε := by + dsimp only + have hK : 0 < K := Nat.pos_of_ne_zero (NeZero.ne K) + have hd := (weightedCube_uniform_grid_density s A hA hU hV hW hL hε h hlen K + ((2 * Q + 1) * K) t J hJ hB hsize hscale).2 + intro center z hz + have he : integerGridDensity (weightedCubeIntegerSource s) (weightedCubeIntegerJetSum s J center) + K ((2 * Q + 1) * K) z = (K : ℝ) ^ J.card * finiteImageMass (weightedCubeIntegerSource s) + (weightedCubeIntegerJetSum s J center) z := by + unfold integerGridDensity + rw [weightedCube_mass_on_fundamental_box s hT hK hvol hQ J hJ center z hz, Fintype.card_coe] + have ht := hd center z + rw [he] at ht + apply ht.trans + have hf := mul_le_mul_of_nonneg_right (grid_scale_factor_le_one (2 * Q + 1) K J.card (by omega) hK) hε.le + simpa only [Nat.cast_mul, one_mul] using hf + +theorem weightedModerate_uniform_fundamental_approximation {B I : Type*} + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] + {n K Q : ℕ} [NeZero K] (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin n → NormalizedScalarCubeSource I) (offset : B → ℤ) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L T ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) (hT : 0 ≤ T) (hε : 0 < ε) + (hc : ∀ b, ScalarCubePrimitiveBudget (c b) A U) (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hclen : ∀ b, L ≤ (c b).length) (hlen : ∀ b j, L ≤ (s b j).length) + (hvol : ∀ b, (|(offset b : ℝ)| + (c b).length) * (∏ j, ((s b j).length : ℝ)) ≤ T * K) + (hQ : blockJetScaleBound (Fintype.card I) n (Fintype.card B) T ≤ Q) + (t : ℕ) (J : Finset (Finset I)) (hJ : ∀ F ∈ J, F.card ≤ n) + (hB : uniformSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (((2 * Q + 1) * K : ℕ) : ℝ) ^ J.card ≤ W * L ^ t) + (hscale : ∀ b, (((2 * Q + 1) * K : ℕ) : ℝ) / + ((((c b).modulus none : ℝ) * (c b).length) * ∏ j, ((s b j).length : ℝ)) ≤ V) : + let ζ := uniformBlockRetainedBias n J.card t U V W ε + let S := uniformBlockSpectrumCover J ((2 * Q + 1) * K) n U V L ζ + ∀ center z : J → ℤ, centeredFundamentalBox Q K center z → + ‖(((K : ℝ) ^ J.card * finiteImageMass (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s J offset center) z : ℝ) : ℂ) - + weightedModerateGridApproximation c s K ((2 * Q + 1) * K) J offset center z S‖ ≤ ε := by + dsimp only + have hK : 0 < K := Nat.pos_of_ne_zero (NeZero.ne K) + have hd := (weightedModerate_uniform_grid_density c s offset A hA hU hV hW hL hε hc h hclen hlen K + ((2 * Q + 1) * K) t J hJ hB hsize hscale).2 + intro center z hz + have he : integerGridDensity (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s J offset center) K ((2 * Q + 1) * K) z = + (K : ℝ) ^ J.card * finiteImageMass (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s J offset center) z := by + unfold integerGridDensity + rw [weightedModerate_mass_on_fundamental_box c s offset hT hK hvol hQ J hJ center z hz, Fintype.card_coe] + have ht := hd center z + rw [he] at ht + apply ht.trans + have hf := mul_le_mul_of_nonneg_right (grid_scale_factor_le_one (2 * Q + 1) K J.card (by omega) hK) hε.le + simpa only [Nat.cast_mul, one_mul] using hf + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedImageDerivative.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedImageDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..1945739ce0eef91b891e8f63ed3eddd2b4e9364a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedImageDerivative.lean @@ -0,0 +1,216 @@ +import Mathlib.Analysis.Calculus.MeanValue +import Mathlib.Analysis.Calculus.ParametricIntegral +import OAI.Combinatorics.Progressions.Geometry.DivergenceSupport +import OAI.Combinatorics.Progressions.Probability.BoundedSmoothTestDensity +import OAI.Combinatorics.Progressions.Probability.DiagonalImageDensity + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ContDiff + +theorem integral_unit_test_integrable {X : Type*} [MeasurableSpace X] + (μ : Measure X) [IsFiniteMeasure μ] (f : X → ℝ) + (hf : Measurable f) (hbound : ∀ x, ‖f x‖ ≤ 1) : Integrable f μ := + (integrable_const (1 : ℝ)).mono' hf.aestronglyMeasurable (Filter.Eventually.of_forall hbound) + +theorem integral_test_difference_le_l1 {X : Type*} [MeasurableSpace X] + (μ : Measure X) (f g : X → ℝ) (hf : Integrable f μ) (hg : Integrable g μ) : + |(∫ x, f x ∂μ) - ∫ x, g x ∂μ| ≤ ∫ x, ‖f x - g x‖ ∂μ := by + rw [← integral_sub hf hg, ← Real.norm_eq_abs] + exact norm_integral_le_integral_norm _ + +theorem bounded_test_comparison_of_smooth {E : Type*} [NormedAddCommGroup E] + [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + (μ ν : Measure E) [IsFiniteMeasure μ] [IsFiniteMeasure ν] {C : ℝ} + (h : ∀ g : E → ℝ, ContDiff ℝ ∞ g → HasCompactSupport g → (∀ x, ‖g x‖ ≤ 1) → + |(∫ x, g x ∂μ) - ∫ x, g x ∂ν| ≤ C) + (f : E → ℝ) (hf : Measurable f) (hbound : ∀ x, ‖f x‖ ≤ 1) : + |(∫ x, f x ∂μ) - ∫ x, f x ∂ν| ≤ C := by + apply le_of_forall_pos_le_add + intro ε hε + obtain ⟨g, hgc, hgs, hgb, _, herr⟩ := exists_smooth_unit_test_l1 (μ + ν) f hf hbound hε + have hfμ := integral_unit_test_integrable μ f hf hbound + have hfν := integral_unit_test_integrable ν f hf hbound + have hgμ := integral_unit_test_integrable μ g hgc.continuous.measurable hgb + have hgν := integral_unit_test_integrable ν g hgc.continuous.measurable hgb + have hμ := integral_test_difference_le_l1 μ f g hfμ hgμ + have hν := integral_test_difference_le_l1 ν f g hfν hgν + have hdiffμ : Integrable (fun x => ‖f x - g x‖) μ := (hfμ.sub hgμ).norm + have hdiffν : Integrable (fun x => ‖f x - g x‖) ν := (hfν.sub hgν).norm + rw [integral_add_measure hdiffμ hdiffν] at herr + have hg := h g hgc hgs hgb + have htri := abs_sub_le (∫ x, f x ∂μ) (∫ x, g x ∂μ) (∫ x, f x ∂ν) + have htri' := abs_sub_le (∫ x, g x ∂μ) (∫ x, g x ∂ν) (∫ x, f x ∂ν) + rw [abs_sub_comm (∫ x, g x ∂ν) (∫ x, f x ∂ν)] at htri' + linarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ContDiff Topology + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [MeasurableSpace E] [BorelSpace E] + +theorem smooth_translated_integral_hasDerivAt (μ : Measure E) [IsFiniteMeasure μ] + (φ : E → ℝ) (hφ : ContDiff ℝ ∞ φ) (hs : HasCompactSupport φ) + (hbound : ∀ x, ‖φ x‖ ≤ 1) (z : E) (t : ℝ) : + HasDerivAt (fun t : ℝ => ∫ x, φ (x + t • z) ∂μ) + (∫ x, fderiv ℝ φ (x + t • z) z ∂μ) t := by + have hdc := hφ.continuous_fderiv (by simp) + obtain ⟨K, hK⟩ := (hs.fderiv ℝ).exists_bound_of_continuous hdc + have hline (x : E) (s : ℝ) : HasDerivAt (fun t : ℝ => φ (x + t • z)) + (fderiv ℝ φ (x + s • z) z) s := by + have hz : HasDerivAt (fun t : ℝ => x + t • z) z s := by + have h := ((hasDerivAt_id s).smul_const z).const_add x + simp only [one_smul, id_eq] at h + exact h + exact ((hφ.differentiable (by simp)) _).hasFDerivAt.comp_hasDerivAt s hz + have hmeas (s : ℝ) : Measurable (fun x : E => φ (x + s • z)) := + hφ.continuous.measurable.comp (measurable_id.add_const _) + have hderivMeas : AEStronglyMeasurable (fun x : E => fderiv ℝ φ (x + t • z) z) μ := + ((hdc.comp (continuous_id.add continuous_const)).clm_apply continuous_const).aestronglyMeasurable + exact (hasDerivAt_integral_of_dominated_loc_of_deriv_le + (μ := μ) (s := Set.univ) (bound := fun _ : E => K * ‖z‖) Filter.univ_mem + (Filter.Eventually.of_forall (fun s => (hmeas s).aestronglyMeasurable)) + (integral_unit_test_integrable μ _ (hmeas t) (fun x => hbound _)) hderivMeas + (Filter.Eventually.of_forall (fun x s _ => + ((fderiv ℝ φ (x + s • z)).le_opNorm z).trans + (mul_le_mul_of_nonneg_right (hK _) (norm_nonneg z)))) + (integrable_const _) (Filter.Eventually.of_forall (fun x s _ => hline x s))).2 + +theorem smooth_translation_bound_of_weak_derivative (μ : Measure E) [IsFiniteMeasure μ] + (z : E) (D : ℝ) + (hweak : ∀ ψ : E → ℝ, ContDiff ℝ ∞ ψ → HasCompactSupport ψ → (∀ x, ‖ψ x‖ ≤ 1) → + |∫ x, fderiv ℝ ψ x z ∂μ| ≤ D) + (φ : E → ℝ) (hφ : ContDiff ℝ ∞ φ) (hs : HasCompactSupport φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + |(∫ x, φ (x + z) ∂μ) - ∫ x, φ x ∂μ| ≤ D := by + have hd (t : ℝ) := smooth_translated_integral_hasDerivAt μ φ hφ hs hbound z t + have hb (t : ℝ) : ‖∫ x, fderiv ℝ φ (x + t • z) z ∂μ‖ ≤ D := by + have hc : ContDiff ℝ ∞ (fun x : E => φ (x + t • z)) := + hφ.comp (contDiff_id.add contDiff_const) + have hsupport : HasCompactSupport (fun x : E => φ (x + t • z)) := + hs.comp_homeomorph (Homeomorph.addRight (t • z)) + have h := hweak _ hc hsupport (fun x => hbound _) + simp only [fderiv_comp_add_right] at h + exact h + have h := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (s := Set.univ) (f := fun t : ℝ => ∫ x, φ (x + t • z) ∂μ) + (f' := fun t : ℝ => ∫ x, fderiv ℝ φ (x + t • z) z ∂μ) + (fun t _ => (hd t).hasDerivWithinAt) (fun t _ => hb t) convex_univ + (Set.mem_univ (0 : ℝ)) (Set.mem_univ (1 : ℝ)) + simpa only [one_smul, zero_smul, add_zero, sub_zero, norm_one, mul_one, Real.norm_eq_abs] using h + +theorem translation_bound_of_weak_derivative [FiniteDimensional ℝ E] (μ : Measure E) [IsFiniteMeasure μ] + (z : E) (D : ℝ) + (hweak : ∀ ψ : E → ℝ, ContDiff ℝ ∞ ψ → HasCompactSupport ψ → (∀ x, ‖ψ x‖ ≤ 1) → + |∫ x, fderiv ℝ ψ x z ∂μ| ≤ D) + (φ : E → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + |(∫ x, φ (x + z) ∂μ) - ∫ x, φ x ∂μ| ≤ D := by + have hm : Measurable (fun x : E => x + z) := measurable_id.add_const z + have h := bounded_test_comparison_of_smooth (Measure.map (fun x => x + z) μ) μ (C := D) + (fun ψ hc hs hb => by + rw [integral_map hm.aemeasurable hc.continuous.aestronglyMeasurable] + exact smooth_translation_bound_of_weak_derivative μ z D hweak ψ hc hs hb) φ hφ hbound + rw [integral_map hm.aemeasurable hφ.aestronglyMeasurable] at h + exact h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ContDiff NNReal + +theorem imageTranslationBound_of_smooth_derivative {Ω ι : Type*} + [MeasurableSpace Ω] [Fintype ι] (μ : Measure Ω) [IsFiniteMeasure μ] + (U : Ω → (ι → ℝ)) (hU : Measurable U) (H : ℝ≥0) + (hweak : ∀ (ψ : (ι → ℝ) → ℝ), ContDiff ℝ ∞ ψ → HasCompactSupport ψ → + (∀ x, ‖ψ x‖ ≤ 1) → ∀ z, + |∫ a, fderiv ℝ ψ (U a) z ∂μ| ≤ H * dist z 0) : ImageTranslationBound μ U H := by + intro φ hφ hbound z + have h := translation_bound_of_weak_derivative (Measure.map U μ) z ((H : ℝ) * dist z 0) + (fun ψ hc hs hb => by + have hm : Measurable (fun x => fderiv ℝ ψ x z) := + ((hc.continuous_fderiv (by simp)).clm_apply continuous_const).measurable + rw [integral_map hU.aemeasurable hm.aestronglyMeasurable] + exact hweak ψ hc hs hb z) φ hφ hbound + have hm : Measurable (fun x : ι → ℝ => φ (x + z)) := + hφ.comp (measurable_id.add_const z) + rw [integral_map hU.aemeasurable hm.aestronglyMeasurable, + integral_map hU.aemeasurable hφ.aestronglyMeasurable] at h + exact h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ContDiff + +variable {κ ι : Type*} [Fintype κ] [DecidableEq κ] [Fintype ι] + +theorem weighted_image_derivative_identity + (U : (κ → ℝ) → (ι → ℝ)) (hU : ContDiff ℝ 1 U) (w : (κ → ℝ) → ℝ) + (Q : κ → (κ → ℝ) → ℝ) (hQ : ∀ j, ContDiff ℝ 1 (Q j)) + (hs : ∀ j, HasCompactSupport (Q j)) (z : ι → ℝ) + (hcolumn : ∀ x, fderiv ℝ U x (fun j => Q j x) = w x • z) + (φ : (ι → ℝ) → ℝ) (hφ : ContDiff ℝ 1 φ) : + (∫ x, w x * fderiv ℝ φ (U x) z) = -∫ x, coordinateDivergence Q x * φ (U x) := by + have hpoint (x : κ → ℝ) : fderiv ℝ (fun x => φ (U x)) x (fun j => Q j x) = + w x * fderiv ℝ φ (U x) z := by + change fderiv ℝ (φ ∘ U) x (fun j => Q j x) = _ + rw [fderiv_comp x (hφ.differentiable (by norm_num) _) (hU.differentiable (by norm_num) _), + ContinuousLinearMap.comp_apply, hcolumn, map_smul, smul_eq_mul] + have h := coordinate_vectorField_integration_by_parts Q hQ hs (fun x => φ (U x)) (hφ.comp hU) + simpa only [hpoint] using h + +theorem weighted_image_derivative_bound + (U : (κ → ℝ) → (ι → ℝ)) (hU : ContDiff ℝ 1 U) + (w : (κ → ℝ) → ℝ) (hw : Measurable w) (hw0 : ∀ x, 0 ≤ w x) + (Q : κ → (κ → ℝ) → ℝ) (hQ : ∀ j, ContDiff ℝ 1 (Q j)) + (hs : ∀ j, HasCompactSupport (Q j)) (z : ι → ℝ) + (hcolumn : ∀ x, fderiv ℝ U x (fun j => Q j x) = w x • z) + {B : ℝ} (hdiv : (∫ x, |coordinateDivergence Q x|) ≤ B) + (φ : (ι → ℝ) → ℝ) (hφ : ContDiff ℝ 1 φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + |∫ x, fderiv ℝ φ (U x) z ∂realDensityMeasure volume w| ≤ B := by + rw [realDensityMeasure_integral volume w hw hw0, + weighted_image_derivative_identity U hU w Q hQ hs z hcolumn φ hφ, abs_neg] + have hi : Integrable (fun x => |coordinateDivergence Q x|) := by + have hint : Integrable (coordinateDivergence Q) volume := + (coordinateDivergence_continuous Q hQ).integrable_of_hasCompactSupport + (coordinateDivergence_hasCompactSupport Q hs) + have h := hint.norm + simp only [Real.norm_eq_abs] at h + exact h + have hp (x : κ → ℝ) : ‖coordinateDivergence Q x * φ (U x)‖ ≤ |coordinateDivergence Q x| := by + rw [norm_mul, Real.norm_eq_abs] + exact (mul_le_mul_of_nonneg_left (hbound _) (abs_nonneg _)).trans_eq (mul_one _) + have h := norm_integral_le_of_norm_le hi (Filter.Eventually.of_forall hp) + rw [Real.norm_eq_abs] at h + exact h.trans hdiv + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLinearBounds.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLinearBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..2477ed0b18c988286f218f987bd1c53e5737e642 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLinearBounds.lean @@ -0,0 +1,48 @@ +import Mathlib.Analysis.Normed.Module.Basic +import Mathlib.LinearAlgebra.Basis.Basic +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open Module + +theorem weighted_linear_bound_of_unit {E F ι κ : Type*} + [AddCommGroup E] [Module ℝ E] [AddCommGroup F] [Module ℝ F] + (e : Basis ι ℝ E) (f : Basis κ ℝ F) (W : ι → ℝ) (V : κ → ℝ) + (Φ : E →ₗ[ℝ] F) (C : ℝ) + (hΦ : ∀ x, (∀ i, |e.repr x i| ≤ 1 / W i) → ∀ j, |f.repr (Φ x) j| ≤ C / V j) + {M : ℝ} (hM : 0 ≤ M) (x : E) (hx : ∀ i, |e.repr x i| ≤ M / W i) : + ∀ j, |f.repr (Φ x) j| ≤ C * M / V j := by + by_cases hzero : M = 0 + · have hxi : x = 0 := by + apply e.repr.injective + ext i + have hi : |e.repr x i| ≤ 0 := by simpa only [hzero, zero_div] using hx i + simpa only [map_zero, Finsupp.zero_apply] using (abs_nonpos_iff.mp hi) + intro j + simp only [hxi, map_zero, Finsupp.zero_apply, abs_zero, hzero, mul_zero, zero_div, le_refl] + · have hpos : 0 < M := lt_of_le_of_ne hM (Ne.symm hzero) + let y : E := M⁻¹ • x + have hy : ∀ i, |e.repr y i| ≤ 1 / W i := by + intro i + change |e.repr (M⁻¹ • x) i| ≤ _ + rw [map_smul, Finsupp.smul_apply, smul_eq_mul, abs_mul, abs_of_pos (inv_pos.mpr hpos)] + calc + _ ≤ M⁻¹ * (M / W i) := mul_le_mul_of_nonneg_left (hx i) (inv_pos.mpr hpos).le + _ = _ := by field_simp + have hxy : x = M • y := by simp only [y, smul_smul, mul_inv_cancel₀ hzero, one_smul] + intro j + rw [hxy, map_smul, map_smul, Finsupp.smul_apply, smul_eq_mul, abs_mul, abs_of_pos hpos] + calc + _ ≤ M * (C / V j) := mul_le_mul_of_nonneg_left (hΦ y hy j) hM + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedListError.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedListError.lean new file mode 100644 index 0000000000000000000000000000000000000000..85a90f840fdace2ae29bda54313193f23e089c26 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedListError.lean @@ -0,0 +1,31 @@ +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +theorem list_weighted_error_sum {α : Type*} (xs : List α) (P m e : α → ℝ) (C : ℝ) + (h : ∀ x ∈ xs, P x ≤ C * m x + e x) : + (xs.map P).sum ≤ C * (xs.map m).sum + (xs.map e).sum := by + induction xs with + | nil => simp + | cons x xs ih => + have hx := h x (by simp) + have ht := ih (fun y hy => h y (by simp [hy])) + simp only [List.map_cons, List.sum_cons] + nlinarith + +theorem list_weighted_error_sum_le {α : Type*} (xs : List α) (P m e : α → ℝ) {C : ℝ} + (hC : 0 ≤ C) (hm : (xs.map m).sum ≤ 1) (h : ∀ x ∈ xs, P x ≤ C * m x + e x) : + (xs.map P).sum ≤ C + (xs.map e).sum := by + have hs := list_weighted_error_sum xs P m e C h + have hc := mul_le_mul_of_nonneg_left hm hC + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringAction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..902e12a40f9f3f1220ff96c8daca704ee3c0c1bb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringAction.lean @@ -0,0 +1,83 @@ +import Mathlib.RingTheory.Nilpotent.Basic +import OAI.Combinatorics.Progressions.Polynomial.TranslationPhaseQuotient + +namespace OAI + +section + +namespace Erdos3.WeightedLoweringAut + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] {w : σ → ℕ} + +noncomputable def degreeAction (e : WeightedLoweringAut w R) (n : ℕ) : + weightedSupportLE (R := R) w n ≃ₗ[R] weightedSupportLE (R := R) w n where + toFun p := ⟨e.val p, e.preserves_degree p.property⟩ + invFun p := ⟨e.val.symm p, (e⁻¹).preserves_degree p.property⟩ + left_inv p := Subtype.ext (e.val.symm_apply_apply p) + right_inv p := Subtype.ext (e.val.apply_symm_apply p) + map_add' p q := Subtype.ext (map_add e.val (p : MvPolynomial σ R) (q : MvPolynomial σ R)) + map_smul' c p := Subtype.ext (map_smul e.val c (p : MvPolynomial σ R)) + +theorem degreeAction_apply_coe (e : WeightedLoweringAut w R) (n : ℕ) + (p : weightedSupportLE (R := R) w n) : + (e.degreeAction n p : MvPolynomial σ R) = e.val p := rfl + +noncomputable def degreeActionHom (n : ℕ) : + WeightedLoweringAut w R →* + (weightedSupportLE (R := R) w n ≃ₗ[R] weightedSupportLE (R := R) w n) where + toFun e := e.degreeAction n + map_one' := by + apply LinearEquiv.ext + intro p + rfl + map_mul' e f := by + apply LinearEquiv.ext + intro p + rfl + +theorem degreeAction_difference_pow_coe (e : WeightedLoweringAut w R) (n k : ℕ) + (p : weightedSupportLE (R := R) w n) : + ((((e.degreeAction n).toLinearMap - 1) ^ k) p : MvPolynomial σ R) = + (polynomialHomDifference e.val.toAlgHom ^ k) (p : MvPolynomial σ R) := by + induction k generalizing p with + | zero => rfl + | succ k ih => + rw [pow_succ, Module.End.mul_apply, ih, pow_succ, Module.End.mul_apply] + rfl + +theorem degreeAction_difference_pow_zero (e : WeightedLoweringAut w R) (n : ℕ) : + ((e.degreeAction n).toLinearMap - 1) ^ (n + 1) = 0 := by + apply LinearMap.ext + intro p + apply Subtype.ext + change ((((e.degreeAction n).toLinearMap - 1) ^ (n + 1)) p : MvPolynomial σ R) = 0 + rw [degreeAction_difference_pow_coe] + exact polynomialHomDifference_pow_eq_zero w e.val.toAlgHom e.property p.property + +theorem degreeAction_difference_nilpotent (e : WeightedLoweringAut w R) (n : ℕ) : + IsNilpotent ((e.degreeAction n).toLinearMap - 1) := + ⟨n + 1, e.degreeAction_difference_pow_zero n⟩ + +theorem degreeActionHom_injective (n : ℕ) (hw : ∀ i, w i ≤ n) : + Function.Injective (degreeActionHom (w := w) (R := R) n) := by + intro e f h + have he : e.val.toAlgHom = f.val.toAlgHom := by + apply MvPolynomial.algHom_ext + intro i + have hi := congrArg (fun L : weightedSupportLE (R := R) w n ≃ₗ[R] + weightedSupportLE (R := R) w n => + (L ⟨X i, weightedSupportLE_mono (hw i) (weightedSupportLE_X w i)⟩ : + MvPolynomial σ R)) h + exact hi + apply Subtype.ext + apply DFunLike.ext + intro p + exact congrArg (fun F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R => F p) he + +end Erdos3.WeightedLoweringAut + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringGroup.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringGroup.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cf85a54ff37b9a430cf10a7eb2c36d24ae5dc8a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringGroup.lean @@ -0,0 +1,284 @@ +import Mathlib.Algebra.Algebra.Equiv +import Mathlib.Algebra.MvPolynomial.CommRing +import OAI.Combinatorics.Progressions.Polynomial.MixedWeightedPolynomialRename + +namespace OAI + + +namespace Erdos3 + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] + +theorem weightedSupportLT_mono {w : σ → ℕ} {d e : ℕ} {p : MvPolynomial σ R} + (hde : d ≤ e) (hp : p ∈ weightedSupportLT w d) : p ∈ weightedSupportLT w e := + fun _ ha => lt_of_lt_of_le (hp ha) hde + +theorem weightedSupportLT_le {w : σ → ℕ} {d : ℕ} {p : MvPolynomial σ R} + (hp : p ∈ weightedSupportLT w d) : p ∈ weightedSupportLE w d := + fun _ ha => le_of_lt (show _ < d from hp ha) + +theorem weightedSupportLT_succ_le {w : σ → ℕ} {d : ℕ} {p : MvPolynomial σ R} + (hp : p ∈ weightedSupportLT w (d + 1)) : p ∈ weightedSupportLE w d := + fun _ ha => Nat.lt_succ_iff.mp (hp ha) + +theorem weightedSupportLT_zero_eq {w : σ → ℕ} {p : MvPolynomial σ R} + (hp : p ∈ weightedSupportLT w 0) : p = 0 := by + apply MvPolynomial.eq_zero_iff.mpr + intro a + by_contra ha + exact Nat.not_lt_zero _ (hp (MvPolynomial.mem_support_iff.mpr ha)) + +theorem weightedLowering_preserves_degree (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) + {p : MvPolynomial σ R} {d : ℕ} (hp : p ∈ weightedSupportLE w d) : + F p ∈ weightedSupportLE w d := by + rw [MvPolynomial.aeval_unique F] + apply weightedSupportLE_aeval w w _ _ hp + intro i + simpa only [sub_add_cancel, Function.comp_apply] using (weightedSupportLE w (w i)).add_mem + (weightedSupportLT_le (hF i)) (weightedSupportLE_X w i) + +theorem weightedLowering_mul_bounds (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (p q : MvPolynomial σ R) (d e : ℕ) + (hp : p ∈ weightedSupportLE w d) + (hFp : F p ∈ weightedSupportLE w d) (hFq : F q ∈ weightedSupportLE w e) + (hdp : F p - p ∈ weightedSupportLT w d) + (hdq : F q - q ∈ weightedSupportLT w e) : + F (p * q) ∈ weightedSupportLE w (d + e) ∧ + F (p * q) - p * q ∈ weightedSupportLT w (d + e) := by + refine ⟨by rw [map_mul]; exact weightedSupportLE_mul hFp hFq, ?_⟩ + rw [map_mul, show F p * F q - p * q = (F p - p) * F q + p * (F q - q) by ring] + exact (weightedSupportLT w (d + e)).add_mem (weightedSupportLT_mul_LE hdp hFq) + (weightedSupportLE_mul_LT hp hdq) + +theorem weightedLowering_monomial_one (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) (a : σ →₀ ℕ) : + F (monomial a 1) - monomial a 1 ∈ weightedSupportLT w (Finsupp.weight w a) := by + classical + have hsingle (i : σ) (n : ℕ) : + F (monomial (Finsupp.single i n) 1) - monomial (Finsupp.single i n) 1 ∈ + weightedSupportLT w (n * w i) := by + induction n with + | zero => + simp only [Finsupp.single_zero, zero_mul] + change F 1 - 1 ∈ _ + rw [map_one, sub_self] + exact Submodule.zero_mem _ + | succ n ih => + have hp := weightedSupportLE_monomial w (Finsupp.single i n) (1 : R) + simp only [Finsupp.weight_single, smul_eq_mul] at hp + have hh := weightedLowering_mul_bounds w F (monomial (Finsupp.single i n) 1) + (X i) (n * w i) (w i) hp (weightedLowering_preserves_degree w F hF hp) + (weightedLowering_preserves_degree w F hF (weightedSupportLE_X w i)) ih (hF i) + simpa only [X, monomial_mul_monomial, one_mul, ← Finsupp.single_add, Nat.succ_mul] + using hh.2 + induction a using Finsupp.induction with + | zero => + change F 1 - 1 ∈ weightedSupportLT w 0 + rw [map_one, sub_self] + exact Submodule.zero_mem _ + | @single_add i n a hi hn ih => + have hp := weightedSupportLE_monomial w (Finsupp.single i n) (1 : R) + have hq := weightedSupportLE_monomial w a (1 : R) + have hh := weightedLowering_mul_bounds w F (monomial (Finsupp.single i n) 1) + (monomial a 1) (Finsupp.weight w (Finsupp.single i n)) (Finsupp.weight w a) + hp (weightedLowering_preserves_degree w F hF hp) + (weightedLowering_preserves_degree w F hF hq) + (by simpa only [Finsupp.weight_single, smul_eq_mul] using hsingle i n) ih + simpa only [monomial_mul_monomial, one_mul, map_add] using hh.2 + +theorem weightedLowering_monomial (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) (a : σ →₀ ℕ) (r : R) : + F (monomial a r) - monomial a r ∈ weightedSupportLT w (Finsupp.weight w a) := by + have hc : F (C r) = C r := F.commutes r + have hm : C r * monomial a (1 : R) = monomial a r := by + change monomial 0 r * monomial a 1 = monomial a r + rw [monomial_mul_monomial, zero_add, mul_one] + rw [← hm, map_mul, hc, ← mul_sub] + simpa only [zero_add] using weightedSupportLE_mul_LT (weightedSupportLE_C w 0 r) + (weightedLowering_monomial_one w F hF a) + +theorem weightedLowering_difference (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) + {p : MvPolynomial σ R} {d : ℕ} (hp : p ∈ weightedSupportLE w d) : + F p - p ∈ weightedSupportLT w d := by + classical + change (F.toLinearMap - (LinearMap.id : Module.End R (MvPolynomial σ R))) p ∈ + weightedSupportLT w d + rw [← p.support_sum_monomial_coeff, map_sum] + apply (weightedSupportLT w d).sum_mem + intro a ha + exact weightedSupportLT_mono (hp ha) (weightedLowering_monomial w F hF a (p.coeff a)) + +end Erdos3 + + +namespace Erdos3 + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] + +noncomputable def polynomialHomDifference + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) : Module.End R (MvPolynomial σ R) := + F.toLinearMap - LinearMap.id + +theorem polynomialHomDifference_pow_eq_zero (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) + {d : ℕ} {p : MvPolynomial σ R} (hp : p ∈ weightedSupportLE w d) : + (polynomialHomDifference F ^ (d + 1)) p = 0 := by + induction d generalizing p with + | zero => + rw [pow_one] + exact weightedSupportLT_zero_eq (weightedLowering_difference w F hF hp) + | succ d ih => + rw [pow_succ, Module.End.mul_apply] + exact ih (weightedSupportLT_succ_le (weightedLowering_difference w F hF hp)) + +theorem weightedLowering_eq_zero_of_degree (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) + {d : ℕ} {p : MvPolynomial σ R} (hp : p ∈ weightedSupportLE w d) (hz : F p = 0) : + p = 0 := by + induction d generalizing p with + | zero => + have h := weightedLowering_difference w F hF hp + rw [hz, zero_sub] at h + exact neg_eq_zero.mp (weightedSupportLT_zero_eq h) + | succ d ih => + have h := weightedLowering_difference w F hF hp + rw [hz, zero_sub] at h + have hlow : p ∈ weightedSupportLT w (d + 1) := by + simpa only [neg_neg] using (weightedSupportLT w (d + 1)).neg_mem h + exact ih (weightedSupportLT_succ_le hlow) hz + +theorem weightedLowering_injective (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) : Function.Injective F := by + intro p q hpq + apply sub_eq_zero.mp + apply weightedLowering_eq_zero_of_degree w F hF + ((mem_weightedSupportLE_iff w ((p - q).weightedTotalDegree w) (p - q)).mpr le_rfl) + rw [map_sub, hpq, sub_self] + +theorem weightedLowering_preimage_degree (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) + {d : ℕ} {p : MvPolynomial σ R} (hp : p ∈ weightedSupportLE w d) : + ∃ q, q ∈ weightedSupportLE w d ∧ F q = p := by + induction d generalizing p with + | zero => + exact ⟨p, hp, sub_eq_zero.mp (weightedSupportLT_zero_eq + (weightedLowering_difference w F hF hp))⟩ + | succ d ih => + have hdiff := weightedSupportLT_succ_le (weightedLowering_difference w F hF hp) + obtain ⟨q, hq, heq⟩ := ih hdiff + refine ⟨p - q, (weightedSupportLE w (d + 1)).sub_mem hp + (weightedSupportLE_mono (Nat.le_succ d) hq), ?_⟩ + rw [map_sub, heq] + abel + +theorem weightedLowering_bijective (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) : Function.Bijective F := by + refine ⟨weightedLowering_injective w F hF, ?_⟩ + intro p + obtain ⟨q, _, hq⟩ := weightedLowering_preimage_degree w F hF + ((mem_weightedSupportLE_iff w (p.weightedTotalDegree w) p).mpr le_rfl) + exact ⟨q, hq⟩ + +noncomputable def weightedLoweringEquiv (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) : + MvPolynomial σ R ≃ₐ[R] MvPolynomial σ R := + AlgEquiv.ofBijective F (weightedLowering_bijective w F hF) + +theorem weightedLoweringEquiv_apply (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) (p : MvPolynomial σ R) : + weightedLoweringEquiv w F hF p = F p := rfl + +theorem weightedLoweringEquiv_inverse_degree (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) + {d : ℕ} {p : MvPolynomial σ R} (hp : p ∈ weightedSupportLE w d) : + (weightedLoweringEquiv w F hF).symm p ∈ weightedSupportLE w d := by + obtain ⟨q, hq, heq⟩ := weightedLowering_preimage_degree w F hF hp + have he : weightedLoweringEquiv w F hF q = p := heq + rw [← he, AlgEquiv.symm_apply_apply] + exact hq + +end Erdos3 + + +namespace Erdos3 + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] + +def weightedLoweringSubgroup (w : σ → ℕ) : + Subgroup (MvPolynomial σ R ≃ₐ[R] MvPolynomial σ R) where + carrier := {e | ∀ i, e (X i) - X i ∈ weightedSupportLT w (w i)} + one_mem' := by + intro i + change X i - X i ∈ weightedSupportLT w (w i) + rw [sub_self] + exact Submodule.zero_mem _ + mul_mem' := by + intro e f he hf i + have hp := weightedLowering_preserves_degree w f.toAlgHom hf (weightedSupportLE_X w i) + have h := weightedLowering_difference w e.toAlgHom he hp + change e (f (X i)) - f (X i) ∈ weightedSupportLT w (w i) at h + change e (f (X i)) - X i ∈ weightedSupportLT w (w i) + simpa only [sub_add_sub_cancel] using (weightedSupportLT w (w i)).add_mem h (hf i) + inv_mem' := by + intro e he i + obtain ⟨q, hq, hqe⟩ := weightedLowering_preimage_degree w e.toAlgHom he + (weightedSupportLE_X w i) + change e q = X i at hqe + have heq : e.symm (X i) = q := by + apply e.injective + rw [e.apply_symm_apply] + exact hqe.symm + change e.symm (X i) - X i ∈ weightedSupportLT w (w i) + rw [heq] + have h := weightedLowering_difference w e.toAlgHom he hq + change e q - q ∈ weightedSupportLT w (w i) at h + rw [hqe] at h + simpa only [neg_sub] using (weightedSupportLT w (w i)).neg_mem h + +abbrev WeightedLoweringAut (w : σ → ℕ) (R : Type*) [CommRing R] := + ↥(weightedLoweringSubgroup (R := R) w) + +theorem weightedLoweringEquiv_mem (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) : + weightedLoweringEquiv w F hF ∈ weightedLoweringSubgroup w := hF + +noncomputable def WeightedLoweringAut.ofHom (w : σ → ℕ) + (F : MvPolynomial σ R →ₐ[R] MvPolynomial σ R) + (hF : ∀ i, F (X i) - X i ∈ weightedSupportLT w (w i)) : WeightedLoweringAut w R := + ⟨weightedLoweringEquiv w F hF, weightedLoweringEquiv_mem w F hF⟩ + +theorem WeightedLoweringAut.preserves_degree {w : σ → ℕ} (e : WeightedLoweringAut w R) + {d : ℕ} {p : MvPolynomial σ R} (hp : p ∈ weightedSupportLE w d) : + e.val p ∈ weightedSupportLE w d := + weightedLowering_preserves_degree w e.val.toAlgHom e.property hp + +theorem WeightedLoweringAut.difference_lower {w : σ → ℕ} (e : WeightedLoweringAut w R) + {d : ℕ} {p : MvPolynomial σ R} (hp : p ∈ weightedSupportLE w d) : + e.val p - p ∈ weightedSupportLT w d := + weightedLowering_difference w e.val.toAlgHom e.property hp + +end Erdos3 + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringTriangular.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringTriangular.lean new file mode 100644 index 0000000000000000000000000000000000000000..84ce796d22493d1a4ffdb20427d617962416a4bd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedLoweringTriangular.lean @@ -0,0 +1,52 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialPatchShearOrbit + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] + +theorem aeval_eq_of_weightedSupportLT {w : σ → ℕ} {n : ℕ} {P : MvPolynomial σ R} + (hP : P ∈ weightedSupportLT w n) (x y : σ → R) + (hxy : ∀ i, w i < n → x i = y i) : aeval x P = aeval y P := by + classical + rw [← P.support_sum_monomial_coeff] + simp only [map_sum, aeval_monomial] + apply Finset.sum_congr rfl + intro α hα + congr 1 + apply Finset.prod_congr rfl + intro i hi + exact congrArg (fun z => z ^ α i) + (hxy i ((Finsupp.le_weight_of_ne_zero' w (Finsupp.mem_support_iff.mp hi)).trans_lt (hP hα))) + +variable {d : ℕ} {w : Fin d → ℕ} + +theorem weightedLoweringSubstitution_difference (e : WeightedLoweringAut w R) (hw : Monotone w) + (i : Fin d) (x y : Fin d → R) (hxy : ∀ j, j < i → x j = y j) : + polynomialSubstitutionPoint e.val.toAlgHom x i - x i = + polynomialSubstitutionPoint e.val.toAlgHom y i - y i := by + have h := aeval_eq_of_weightedSupportLT (e.property i) x y (fun j hj => + hxy j (lt_of_not_ge (fun hij => (not_le_of_gt hj) (hw hij)))) + change aeval x (e.val (X i)) - x i = aeval y (e.val (X i)) - y i + simpa only [map_sub, aeval_X] using h + +theorem weightedLoweringSubstitution_prefix (e : WeightedLoweringAut w R) (hw : Monotone w) + (i : Fin d) (x y : Fin d → R) (hxy : ∀ j, j < i → x j = y j) + (j : Fin d) (hj : j < i) : + polynomialSubstitutionPoint e.val.toAlgHom x j = + polynomialSubstitutionPoint e.val.toAlgHom y j := by + have h := weightedLoweringSubstitution_difference e hw j x y + (fun k hk => hxy k (hk.trans hj)) + rw [hxy j hj] at h + simpa only [sub_add_cancel] using congrArg (fun z => z + y j) h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedOrbitNormalization.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedOrbitNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9fc07be37bb3c985bcc46aa39e854ba3318c70d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedOrbitNormalization.lean @@ -0,0 +1,237 @@ +import OAI.Combinatorics.Progressions.Polynomial.ShiftedPolynomialBasis + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +variable {σ R V : Type*} [CommRing R] [AddCommGroup V] [Module R V] + +theorem eval_zero_eq_coefficient (p : VectorPolynomial σ R V) : + eval (fun _ => 0) p = coefficients p 0 := by + induction p using TensorProduct.inductionOn with + | tmul q v => simp [MvPolynomial.aeval_zero', MvPolynomial.constantCoeff_eq] + | add p q hp hq => simp [hp, hq] + +end Erdos3.VectorPolynomial + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem horizontal_bch (a b : L) : + lieQuotientMap (F.layerIdeal 2) (lieBCH s a b) = + lieQuotientMap (F.layerIdeal 2) a + lieQuotientMap (F.layerIdeal 2) b := by + rw [map_lieBCH] + apply lieBCH_eq_add_of_lie_eq_zero + (lie_quotient_lowerCentralSeries_eq_bot F.lowerCentralSeries_eq_bot (F.layerIdeal 2)) + rw [← LieHom.map_lie] + apply (lieQuotientMap_eq_zero _ _).mpr + exact F.lie_mem (show a ∈ F.layer 1 by rw [F.one_eq_top]; trivial) + (show b ∈ F.layer 1 by rw [F.one_eq_top]; trivial) + +def horizontalLog (g : F.Group) : L ⧸ F.layerIdeal 2 := lieQuotientMap (F.layerIdeal 2) g.coord + +@[simp] theorem horizontalLog_mul (g h : F.Group) : + F.horizontalLog (g * h) = F.horizontalLog g + F.horizontalLog h := F.horizontal_bch _ _ + +@[simp] theorem horizontalLog_inv (g : F.Group) : F.horizontalLog g⁻¹ = -F.horizontalLog g := + map_neg (lieQuotientMap (F.layerIdeal 2)) g.coord + +theorem normalizedShift_horizontal_zero (h : σ → ℚ) (p : VectorPolynomial σ ℚ L) + (ε γ : F.Group) + (heq : (⟨eval h p⟩ : F.Group) * (⟨eval (fun _ => 0) p⟩ : F.Group)⁻¹ = ε * γ) : + coefficients (normalizedShiftLog s h (-ε.coord) (-γ.coord) p - p) 0 ∈ F.layer 2 := by + have hh := congrArg F.horizontalLog heq + simp only [horizontalLog_mul, horizontalLog_inv] at hh + rw [← sub_eq_add_neg] at hh + change lieQuotientMap (F.layerIdeal 2) (eval h p) - + lieQuotientMap (F.layerIdeal 2) (eval (fun _ => 0) p) = + lieQuotientMap (F.layerIdeal 2) ε.coord + lieQuotientMap (F.layerIdeal 2) γ.coord at hh + have hsolve := (sub_eq_iff_eq_add).mp hh + apply (lieQuotientMap_eq_zero (F.layerIdeal 2) _).mp + rw [← eval_zero_eq_coefficient] + simp only [map_sub, eval_normalizedShiftLog, F.horizontal_bch, map_neg, zero_add] + rw [hsolve] + abel + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial + +variable {τ L : Type*} [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} (F : NilpotentLieFiltration L s) + +theorem dilationPair_coefficients_mem (r : ℚ) (w : τ → ℕ) (hw : ∀ j, 0 < w j) + (q : VectorPolynomial τ ℚ (L × L)) + (hq : ∀ a, coefficients q a ∈ F.dilationPairLayer r (Finsupp.weight w a)) + (hq0 : coefficients q 0 = 0) (a : τ →₀ ℕ) : + coefficients q a ∈ F.dilationPairSubalgebra r := by + by_cases ha : a = 0 + · rw [ha, hq0] + exact (F.dilationPairSubalgebra r).zero_mem + · have hpos : 0 < Finsupp.weight w a := + NilpotentLieFiltration.positive_weight_of_ne_zero w hw ha + exact F.dilationPairLayer_antitone r (Nat.succ_le_of_lt hpos) (hq a) + +noncomputable def restrictDilationPairPolynomial (r : ℚ) (w : τ → ℕ) (hw : ∀ j, 0 < w j) + (q : VectorPolynomial τ ℚ (L × L)) + (hq : ∀ a, coefficients q a ∈ F.dilationPairLayer r (Finsupp.weight w a)) + (hq0 : coefficients q 0 = 0) : + VectorPolynomial τ ℚ (F.dilationPairSubalgebra r) := + restrictCoefficients (F.dilationPairSubalgebra r).toSubmodule q + (F.dilationPair_coefficients_mem r w hw q hq hq0) + +theorem restrictDilationPairPolynomial_adapted (r : ℚ) (w : τ → ℕ) (hw : ∀ j, 0 < w j) + (q : VectorPolynomial τ ℚ (L × L)) + (hq : ∀ a, coefficients q a ∈ F.dilationPairLayer r (Finsupp.weight w a)) + (hq0 : coefficients q 0 = 0) : + (F.dilationPairFiltration r).Adapted w + (F.restrictDilationPairPolynomial r w hw q hq hq0) := by + apply ((F.dilationPairFiltration r).adapted_iff_coefficients w _).mpr + intro a + change (coefficients (F.restrictDilationPairPolynomial r w hw q hq hq0) a : L × L) ∈ + F.dilationPairLayer r (Finsupp.weight w a) + rw [restrictDilationPairPolynomial, coefficients_restrictCoefficients] + exact hq a + +theorem restrictDilationPairPolynomial_eval (r : ℚ) (w : τ → ℕ) (hw : ∀ j, 0 < w j) + (q : VectorPolynomial τ ℚ (L × L)) + (hq : ∀ a, coefficients q a ∈ F.dilationPairLayer r (Finsupp.weight w a)) + (hq0 : coefficients q 0 = 0) (x : τ → ℚ) : + (eval (V := F.dilationPairSubalgebra r) x + (F.restrictDilationPairPolynomial r w hw q hq hq0) : L × L) = eval x q := + eval_restrictCoefficients (F.dilationPairSubalgebra r).toSubmodule q + (F.dilationPair_coefficients_mem r w hw q hq hq0) x + +noncomputable def restrictDilationPairOrbit (r : ℚ) (w : τ → ℕ) (hw : ∀ j, 0 < w j) + (q : VectorPolynomial τ ℚ (L × L)) + (hq : ∀ a, coefficients q a ∈ F.dilationPairLayer r (Finsupp.weight w a)) + (hq0 : coefficients q 0 = 0) : (F.dilationPairFiltration r).PolynomialOrbit w := + NilpotentLieFiltration.polynomialOrbitOfLog + (F.restrictDilationPairPolynomial r w hw q hq hq0) + (F.restrictDilationPairPolynomial_adapted r w hw q hq hq0) + +theorem restrictDilationPairOrbit_eval (r : ℚ) (w : τ → ℕ) (hw : ∀ j, 0 < w j) + (q : VectorPolynomial τ ℚ (L × L)) + (hq : ∀ a, coefficients q a ∈ F.dilationPairLayer r (Finsupp.weight w a)) + (hq0 : coefficients q 0 = 0) (x : τ → ℤ) : + (((F.dilationPairFiltration r).polynomialOrbitEval w x + (F.restrictDilationPairOrbit r w hw q hq hq0)).coord : L × L) = + eval (fun j => (x j : ℚ)) q := + F.restrictDilationPairPolynomial_eval r w hw q hq hq0 _ + +theorem restrictDilationPairOrbit_zero (r : ℚ) (w : τ → ℕ) (hw : ∀ j, 0 < w j) + (q : VectorPolynomial τ ℚ (L × L)) + (hq : ∀ a, coefficients q a ∈ F.dilationPairLayer r (Finsupp.weight w a)) + (hq0 : coefficients q 0 = 0) : + (F.dilationPairFiltration r).polynomialOrbitEval w 0 + (F.restrictDilationPairOrbit r w hw q hq hq0) = 1 := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + change (((F.dilationPairFiltration r).polynomialOrbitEval w 0 + (F.restrictDilationPairOrbit r w hw q hq hq0)).coord : L × L) = 0 + rw [F.restrictDilationPairOrbit_eval] + simpa only [Pi.zero_apply, Int.cast_zero, eval_zero_eq_coefficient] using hq0 + +theorem exists_dilationPairOrbit_of_coefficients (r : ℚ) (w : τ → ℕ) (hw : ∀ j, 0 < w j) + (q : VectorPolynomial τ ℚ (L × L)) + (hq : ∀ a, coefficients q a ∈ F.dilationPairLayer r (Finsupp.weight w a)) + (hq0 : coefficients q 0 = 0) : + ∃ g : (F.dilationPairFiltration r).PolynomialOrbit w, + (F.dilationPairFiltration r).polynomialOrbitEval w 0 g = 1 ∧ + ∀ x : τ → ℤ, + (((F.dilationPairFiltration r).polynomialOrbitEval w x g).coord : L × L) = + eval (fun j => (x j : ℚ)) q := + ⟨F.restrictDilationPairOrbit r w hw q hq hq0, + F.restrictDilationPairOrbit_zero r w hw q hq hq0, + F.restrictDilationPairOrbit_eval r w hw q hq hq0⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open VectorPolynomial + +variable {σ τ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + +noncomputable def weightedGroupInclusion (c : σ → ℕ) : + (F.weightedFiltration c).Group →* F.Group := + NilpotentLieBCHGroup.mapOfSteps (F.weightedSubalgebra c).incl + +theorem weightedGroupInclusion_injective (c : σ → ℕ) : + Function.Injective (F.weightedGroupInclusion c) := + NilpotentLieBCHGroup.mapOfSteps_injective _ (fun _ _ h => Subtype.ext h) + +noncomputable def weightedNormalizationLog (p : VectorPolynomial τ ℚ L) (a b : F.Group) : + VectorPolynomial τ ℚ L := + lieBCH s (lieBCH s (monomial 0 (-a.coord)) p) (monomial 0 (-b.coord)) + +theorem weightedNormalizationLog_adapted (c : σ → ℕ) (v : τ → ℕ) + {p : VectorPolynomial τ ℚ L} (hp : F.WeightedAdapted c v p) (a b : F.Group) : + F.WeightedAdapted c v (F.weightedNormalizationLog p a b) := + F.weightedAdapted_bch c v s + (F.weightedAdapted_bch c v s (F.weightedAdapted_constant c v _) hp) + (F.weightedAdapted_constant c v _) + +theorem weightedNormalizationLog_eval (p : VectorPolynomial τ ℚ L) (a b : F.Group) + (x : τ → ℚ) : + eval x (F.weightedNormalizationLog p a b) = + (a⁻¹ * (⟨eval x p⟩ : F.Group) * b⁻¹).coord := by + simp only [weightedNormalizationLog, eval_lieBCH, eval_monomial, + Finsupp.prod_zero_index, one_smul, NilpotentLieBCHGroup.coord_mul, + NilpotentLieBCHGroup.coord_inv] + +theorem weightedNormalizationLog_zero (p : VectorPolynomial τ ℚ L) (a b : F.Group) + (hzero : (⟨eval (fun _ => 0) p⟩ : F.Group) = a * b) : + coefficients (F.weightedNormalizationLog p a b) 0 = 0 := by + rw [← eval_zero_eq_coefficient, F.weightedNormalizationLog_eval, hzero] + simp + +noncomputable def normalizedWeightedOrbit (c : σ → ℕ) (v : τ → ℕ) (hv : ∀ i, 0 < v i) + (p : VectorPolynomial τ ℚ L) (hp : F.WeightedAdapted c v p) (a b : F.Group) + (hzero : (⟨eval (fun _ => 0) p⟩ : F.Group) = a * b) : + (F.weightedFiltration c).PolynomialOrbit v := + F.restrictWeightedOrbit c v hv (F.weightedNormalizationLog p a b) + (F.weightedNormalizationLog_adapted c v hp a b) (F.weightedNormalizationLog_zero p a b hzero) + +theorem normalizedWeightedOrbit_eval (c : σ → ℕ) (v : τ → ℕ) (hv : ∀ i, 0 < v i) + (p : VectorPolynomial τ ℚ L) (hp : F.WeightedAdapted c v p) (a b : F.Group) + (hzero : (⟨eval (fun _ => 0) p⟩ : F.Group) = a * b) (x : τ → ℤ) : + F.weightedGroupInclusion c ((F.weightedFiltration c).polynomialOrbitEval v x + (F.normalizedWeightedOrbit c v hv p hp a b hzero)) = + a⁻¹ * (⟨eval (fun i => (x i : ℚ)) p⟩ : F.Group) * b⁻¹ := by + apply NilpotentLieBCHGroup.ext + change (((F.weightedFiltration c).polynomialOrbitEval v x + (F.restrictWeightedOrbit c v hv _ _ _)).coord : L) = _ + rw [F.restrictWeightedOrbit_eval, F.weightedNormalizationLog_eval] + +theorem normalizedWeightedOrbit_zero (c : σ → ℕ) (v : τ → ℕ) (hv : ∀ i, 0 < v i) + (p : VectorPolynomial τ ℚ L) (hp : F.WeightedAdapted c v p) (a b : F.Group) + (hzero : (⟨eval (fun _ => 0) p⟩ : F.Group) = a * b) : + (F.weightedFiltration c).polynomialOrbitEval v 0 + (F.normalizedWeightedOrbit c v hv p hp a b hzero) = 1 := by + apply F.weightedGroupInclusion_injective c + rw [F.normalizedWeightedOrbit_eval, map_one] + simp only [Pi.zero_apply, Int.cast_zero, hzero, inv_mul_cancel_left, mul_inv_cancel] + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedOverlapCorrelation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedOverlapCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d75a95dc659c4e93c63ab10a2622f92249d22fe --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedOverlapCorrelation.lean @@ -0,0 +1,211 @@ +import OAI.Combinatorics.Progressions.Geometry.SupportedCubeEquivTransport + +namespace OAI + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A : Type*} [AddCommGroup A] [DecidableEq A] + +theorem sum_overlaps {M : Type*} [AddCommMonoid M] + (Q : Finset A) (F : A → A → M) : + (∑ h ∈ cubeDifferenceSupport Q, ∑ x ∈ derivativeSupport Q h, F x (x + h)) = + ∑ x ∈ Q, ∑ y ∈ Q, F x y := by + calc + _ = ∑ p ∈ (cubeDifferenceSupport Q ×ˢ Q).filter (fun p => p.2 + p.1 ∈ Q), + F p.2 (p.2 + p.1) := by + rw [Finset.sum_filter, Finset.sum_product] + apply Finset.sum_congr rfl + intro h _ + simp only [derivativeSupport, Finset.sum_filter] + _ = ∑ p ∈ Q ×ˢ Q, F p.1 p.2 := by + apply Finset.sum_bij (fun p _ => (p.2, p.2 + p.1)) + · intro p hp + obtain ⟨hp, hsum⟩ := Finset.mem_filter.mp hp + exact Finset.mem_product.mpr ⟨(Finset.mem_product.mp hp).2, hsum⟩ + · intro p hp q hq he + have hx := congrArg Prod.fst he + have hh := congrArg Prod.snd he + simp only at hx hh + apply Prod.ext + · apply add_left_cancel (a := p.2) + exact hh.trans (congrArg (fun x => x + q.1) hx).symm + · exact hx + · intro p hp + obtain ⟨hx, hy⟩ := Finset.mem_product.mp hp + refine ⟨(p.2 - p.1, p.1), ?_, ?_⟩ + · apply Finset.mem_filter.mpr + refine ⟨Finset.mem_product.mpr ⟨?_, hx⟩, ?_⟩ + · exact Finset.mem_image.mpr ⟨p, hp, rfl⟩ + · simpa only [add_sub_cancel] using hy + · simp only [add_sub_cancel, Prod.eta] + · intro p hp + rfl + _ = _ := Finset.sum_product Q Q (fun p => F p.1 p.2) + +theorem sum_overlap_card (Q : Finset A) : + (∑ h ∈ cubeDifferenceSupport Q, (derivativeSupport Q h).card) = Q.card ^ 2 := by + simpa only [Finset.sum_const, smul_eq_mul, mul_one, pow_two] using + sum_overlaps Q (fun _ _ => (1 : ℕ)) + +theorem sum_overlap_weights {Q : Finset A} (hQ : Q.Nonempty) : + (∑ h ∈ cubeDifferenceSupport Q, ((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) = 1 := by + rw [← Finset.sum_div, ← Nat.cast_sum, sum_overlap_card, Nat.cast_pow] + exact div_self (pow_ne_zero _ (by exact_mod_cast hQ.card_pos.ne')) + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A : Type*} [AddCommGroup A] [DecidableEq A] + +theorem correlation_sq_mul_card (Q : Finset A) (f u : A → ℂ) : + (Q.card : ℝ) ^ 2 * ‖finiteCorrelation Q f u‖ ^ 2 = + ∑ h ∈ cubeDifferenceSupport Q, ((derivativeSupport Q h).card : ℝ) * + (finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h)).re := by + let g := fun x => f x * star (u x) + have hp : (∑ h ∈ cubeDifferenceSupport Q, ∑ x ∈ derivativeSupport Q h, g x * star (g (x + h))) = + (∑ x ∈ Q, g x) * star (∑ x ∈ Q, g x) := by + rw [sum_overlaps Q (fun x y => g x * star (g y))] + simp only [Finset.sum_mul, Finset.mul_sum, star_sum] + rw [Finset.sum_comm] + have hinner (h : A) : (∑ x ∈ derivativeSupport Q h, g x * star (g (x + h))) = + ((derivativeSupport Q h).card : ℂ) * finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h) := by + rw [finiteCorrelation, Finset.card_mul_expect] + apply Finset.sum_congr rfl + intro x _ + simp only [g, multiplicativeDerivative, star_mul, star_star] + ring + have hnorm : ‖∑ x ∈ Q, g x‖ ^ 2 = (Q.card : ℝ) ^ 2 * ‖finiteCorrelation Q f u‖ ^ 2 := by + rw [← Finset.card_mul_expect Q g, norm_mul, Complex.norm_natCast, mul_pow] + rfl + have hreal := congrArg Complex.re hp + simp_rw [hinner] at hreal + rw [mul_star_re_eq_norm_sq, hnorm] at hreal + simpa only [Complex.re_sum, Complex.mul_re, Complex.natCast_re, Complex.natCast_im, + zero_mul, sub_zero] using hreal.symm + +theorem correlation_sq_eq_sum_overlap {Q : Finset A} (hQ : Q.Nonempty) (f u : A → ℂ) : + ‖finiteCorrelation Q f u‖ ^ 2 = + ∑ h ∈ cubeDifferenceSupport Q, (((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) * + (finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h)).re := by + have hcard : (Q.card : ℝ) ≠ 0 := by exact_mod_cast hQ.card_pos.ne' + calc + _ = ((Q.card : ℝ) ^ 2 * ‖finiteCorrelation Q f u‖ ^ 2) / (Q.card : ℝ) ^ 2 := by + field_simp + _ = _ := by + rw [correlation_sq_mul_card, Finset.sum_div] + simp only [div_mul_eq_mul_div] + +theorem correlation_sq_le_sum_overlap_norm {Q : Finset A} (hQ : Q.Nonempty) (f u : A → ℂ) : + ‖finiteCorrelation Q f u‖ ^ 2 ≤ + ∑ h ∈ cubeDifferenceSupport Q, (((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) * + ‖finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h)‖ := by + rw [correlation_sq_eq_sum_overlap hQ] + apply Finset.sum_le_sum + intro h _ + exact mul_le_mul_of_nonneg_left (Complex.re_le_norm _) (by positivity) + +theorem norm_overlapCorrelation_le {Q : Finset A} (f u : A → ℂ) {B : ℝ} + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) (hu : ∀ x ∈ Q, ‖u x‖ ≤ B) + {h : A} (hh : h ∈ cubeDifferenceSupport Q) : + ‖finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h)‖ ≤ B ^ 2 := by + apply norm_finiteCorrelation_le ((mem_cubeDifferenceSupport Q h).mp hh) + · intro x hx + obtain ⟨hx, hxh⟩ := Finset.mem_filter.mp hx + simpa only [multiplicativeDerivative, norm_mul, norm_star, one_mul] using + mul_le_mul (hf x hx) (hf (x + h) hxh) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) + · intro x hx + obtain ⟨hx, hxh⟩ := Finset.mem_filter.mp hx + have hB : 0 ≤ B := (norm_nonneg (u x)).trans (hu x hx) + simpa only [multiplicativeDerivative, norm_mul, norm_star, pow_two] using + mul_le_mul (hu x hx) (hu (x + h) hxh) (norm_nonneg _) hB + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +theorem weight_large_values_of_sum {ι : Type*} (I : Finset ι) (w a : ι → ℝ) + {r B : ℝ} (hr : 0 ≤ r) (hB : 0 < B) + (hw : ∀ i ∈ I, 0 ≤ w i) (hsum : ∑ i ∈ I, w i = 1) + (ha : ∀ i ∈ I, a i ≤ B) (hmean : r ≤ ∑ i ∈ I, w i * a i) : + r / (2 * B) ≤ ∑ i ∈ I, w i * (if r / 2 ≤ a i then (1 : ℝ) else 0) := by + classical + have hp (i : ι) (hi : i ∈ I) : a i ≤ r / 2 + B * (if r / 2 ≤ a i then (1 : ℝ) else 0) := by + split_ifs with h + · simp only [mul_one] + linarith [ha i hi] + · simp only [mul_zero, add_zero] + exact (lt_of_not_ge h).le + have hbound := Finset.sum_le_sum (fun i hi => mul_le_mul_of_nonneg_left (hp i hi) (hw i hi)) + have he : (∑ i ∈ I, w i * (r / 2 + B * (if r / 2 ≤ a i then (1 : ℝ) else 0))) = + r / 2 * (∑ i ∈ I, w i) + B * (∑ i ∈ I, w i * (if r / 2 ≤ a i then (1 : ℝ) else 0)) := by + rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + ring + rw [he, hsum, mul_one] at hbound + apply (div_le_iff₀ (by positivity : 0 < 2 * B)).mpr + nlinarith + +variable {A : Type*} [AddCommGroup A] [DecidableEq A] + +theorem weight_correlating_overlaps {Q : Finset A} (hQ : Q.Nonempty) + (f u : A → ℂ) {ρ B : ℝ} (hρ : 0 ≤ ρ) (hB : 0 < B) + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) (hu : ∀ x ∈ Q, ‖u x‖ ≤ B) + (hcorr : ρ ≤ ‖finiteCorrelation Q f u‖) : + ρ ^ 2 / (2 * B ^ 2) ≤ ∑ h ∈ cubeDifferenceSupport Q, + (((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) * + (if ρ ^ 2 / 2 ≤ ‖finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h)‖ then (1 : ℝ) else 0) := by + apply weight_large_values_of_sum _ _ _ (sq_nonneg ρ) (sq_pos_of_pos hB) + (fun _ _ => by positivity) (sum_overlap_weights hQ) + (fun _ hh => norm_overlapCorrelation_le f u hf hu hh) + exact (pow_le_pow_left₀ hρ hcorr 2).trans (correlation_sq_le_sum_overlap_norm hQ f u) + +theorem weight_small_overlaps {Q : Finset A} (hQ : Q.Nonempty) {δ : ℝ} (hδ : 0 ≤ δ) : + (∑ h ∈ (cubeDifferenceSupport Q).filter + (fun h => ((derivativeSupport Q h).card : ℝ) ≤ δ * Q.card), + ((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) ≤ + δ * (cubeDifferenceSupport Q).card / Q.card := by + classical + have hq : (0 : ℝ) < Q.card := by exact_mod_cast hQ.card_pos + let I := (cubeDifferenceSupport Q).filter + (fun h => ((derivativeSupport Q h).card : ℝ) ≤ δ * Q.card) + have hp (h : A) (hh : h ∈ I) : + ((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2 ≤ δ / Q.card := by + have hsmall := (Finset.mem_filter.mp hh).2 + apply (div_le_div_iff₀ (sq_pos_of_pos hq) hq).mpr + nlinarith + calc + _ ≤ ∑ _h ∈ I, δ / (Q.card : ℝ) := Finset.sum_le_sum hp + _ = (I.card : ℝ) * (δ / Q.card) := by simp only [Finset.sum_const, nsmul_eq_mul] + _ ≤ ((cubeDifferenceSupport Q).card : ℝ) * (δ / Q.card) := + mul_le_mul_of_nonneg_right (by exact_mod_cast Finset.card_filter_le _ _) (div_nonneg hδ hq.le) + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedPatchReparam.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedPatchReparam.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d101730d20e1330f62d0f7ea68d524c9aac4689 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedPatchReparam.lean @@ -0,0 +1,303 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialPatchProductBudget + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +theorem aeval_eq_of_weightedSupport {σ R : Type*} [CommRing R] + {w : σ → ℕ} {d : ℕ} {p : MvPolynomial σ R} + (hp : p ∈ weightedSupportLE w d) (x y : σ → R) + (hxy : ∀ i, w i ≤ d → x i = y i) : aeval x p = aeval y p := by + classical + rw [← p.support_sum_monomial_coeff] + simp only [map_sum, aeval_monomial] + apply Finset.sum_congr rfl + intro α hα + congr 1 + apply Finset.prod_congr rfl + intro i hi + exact congrArg (fun z => z ^ α i) + (hxy i ((Finsupp.le_weight_of_ne_zero' w (Finsupp.mem_support_iff.mp hi)).trans (hp hα))) + +def weightedPatchVariableWeight {σ : Type*} {d : ℕ} + (p : σ → ℕ) (w : Fin d → ℕ) (i : Fin d) : σ ⊕ Fin i.val → ℕ := + Sum.elim p (fun j => w (earlierSlot i j)) + +structure WeightedParameterSlots (σ : Type*) (p : σ → ℕ) (d : ℕ) (w : Fin d → ℕ) where + center : (i : Fin d) → MvPolynomial (σ ⊕ Fin i.val) ℝ + degree : ∀ i, center i ∈ weightedSupportLE (weightedPatchVariableWeight p w i) (w i) + +namespace WeightedParameterSlots + +variable {σ : Type*} {p : σ → ℕ} {d : ℕ} {w : Fin d → ℕ} + +noncomputable def slots (A : WeightedParameterSlots σ p d w) (t : σ → ℝ) : + TriangularSlots d where + center x i := aeval (Sum.elim t (fun j => x (earlierSlot i j))) (A.center i) + lower i x y hxy := by + apply congrArg (fun f : σ ⊕ Fin i.val → ℝ => aeval f (A.center i)) + funext v + cases v with + | inl a => rfl + | inr j => exact hxy (earlierSlot i j) j.isLt + +end WeightedParameterSlots + +structure WeightedParameterPatch (σ : Type*) (p : σ → ℕ) (s d : ℕ) where + weight : Fin d → ℕ + weight_pos : ∀ i, 1 ≤ weight i + weight_le : ∀ i, weight i ≤ s + weight_mono : Monotone weight + form : WeightedParameterSlots σ p d weight + kernel : PatchKernel d + +namespace WeightedParameterPatch + +variable {σ : Type*} {p : σ → ℕ} {s d : ℕ} + +noncomputable def value (A : WeightedParameterPatch σ p s d) (t : σ → ℝ) : ℝ := + (A.form.slots t).patchValue A.kernel + +theorem value_mem_Icc (A : WeightedParameterPatch σ p s d) (t : σ → ℝ) : + A.value t ∈ Set.Icc (0 : ℝ) 1 := (A.form.slots t).patchValue_mem_Icc A.kernel + +end WeightedParameterPatch + +namespace PolynomialPatch + +variable {σ : Type*} {s d : ℕ} + +def weightedParameters (A : PolynomialPatch σ s d) : + WeightedParameterPatch σ (fun _ => 1) s d where + weight := A.weight + weight_pos := A.weight_pos + weight_le := A.weight_le + weight_mono := A.weight_mono + form := { center := A.form.center, degree := A.form.degree } + kernel := A.kernel + +@[simp] theorem weightedParameters_value (A : PolynomialPatch σ s d) (t : σ → ℝ) : + A.weightedParameters.value t = A.value t := rfl + +end PolynomialPatch +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +namespace SlotInterleaving + +theorem sorted_left_lt_right {D E : ℕ} (w : Fin D → ℕ) (v : Fin E → ℕ) + (hw : Monotone w) (hv : Monotone v) (i : Fin D) (j : Fin E) (h : w i ≤ v j) : + (sorted w v hw hv).left i < (sorted w v hw hv).right j := by + apply stable_sort_symm_lt (Fin.append w v) + · simp only [Fin.lt_def, Fin.val_castAdd, Fin.val_natAdd] + omega + · simpa only [Fin.append_left, Fin.append_right] using h + +end SlotInterleaving + +namespace WeightedParameterSlots + +variable {σ : Type*} {D E : ℕ} {w : Fin D → ℕ} {v : Fin E → ℕ} + +noncomputable def insertSubstitution (I : SlotInterleaving D E) (k : Fin (D + E)) + (i : Fin E) : (σ ⊕ Fin D) ⊕ Fin i.val → MvPolynomial (σ ⊕ Fin k.val) ℝ := + Sum.elim + (Sum.elim (fun a => X (Sum.inl a)) + (fun j => if h : (I.left j).val < k.val then X (Sum.inr ⟨_, h⟩) else 0)) + (fun j => PolynomialSlots.placementSubstitution I.right k i (Sum.inr j)) + +theorem insertSubstitution_degree (I : SlotInterleaving D E) (k : Fin (D + E)) + (i : Fin E) (a : (σ ⊕ Fin D) ⊕ Fin i.val) : + insertSubstitution I k i a ∈ weightedSupportLE (patchVariableWeight (I.fill w v) k) + (weightedPatchVariableWeight (Sum.elim (fun _ : σ => 1) w) v i a) := by + rcases a with (a | j) | j + · exact weightedSupportLE_X _ (Sum.inl a) + · simp only [insertSubstitution, Sum.elim_inl, Sum.elim_inr] + split_ifs with h + · have hX := weightedSupportLE_X (R := ℝ) (patchVariableWeight (σ := σ) (I.fill w v) k) + (Sum.inr (⟨(I.left j).val, h⟩ : Fin k.val)) + change _ ∈ weightedSupportLE _ (I.fill w v (I.left j)) at hX + rw [I.fill_left] at hX + exact hX + · exact (weightedSupportLE _ _).zero_mem + · exact PolynomialSlots.placementSubstitution_degree I.right + (fun j => I.fill_right w v j) k i (Sum.inr j) + +noncomputable def insertCenter + (B : WeightedParameterSlots (σ ⊕ Fin D) (Sum.elim (fun _ => 1) w) E v) + (I : SlotInterleaving D E) (k : Fin (D + E)) (i : Fin E) : + MvPolynomial (σ ⊕ Fin k.val) ℝ := aeval (insertSubstitution I k i) (B.center i) + +theorem insertCenter_degree + (B : WeightedParameterSlots (σ ⊕ Fin D) (Sum.elim (fun _ => 1) w) E v) + (I : SlotInterleaving D E) (k : Fin (D + E)) (i : Fin E) : + B.insertCenter I k i ∈ weightedSupportLE (patchVariableWeight (I.fill w v) k) (v i) := + weightedSupportLE_aeval _ _ _ (insertSubstitution_degree I k i) (B.degree i) + +theorem insertCenter_eval + (B : WeightedParameterSlots (σ ⊕ Fin D) (Sum.elim (fun _ => 1) w) E v) + (I : SlotInterleaving D E) (hbefore : ∀ j i, w j ≤ v i → I.left j < I.right i) + (i : Fin E) (t : σ → ℝ) (x : Fin (D + E) → ℝ) : + aeval (Sum.elim t (fun j => x (earlierSlot (I.right i) j))) + (B.insertCenter I (I.right i) i) = + (B.slots (Sum.elim t (fun j => x (I.left j)))).center (fun j => x (I.right j)) i := by + simp only [insertCenter, MvPolynomial.comp_aeval_apply, slots] + apply aeval_eq_of_weightedSupport (B.degree i) + intro a ha + rcases a with (a | j) | j + · simp [insertSubstitution] + · have h : (I.left j).val < (I.right i).val := hbefore j i ha + simp only [insertSubstitution, Sum.elim_inl, Sum.elim_inr, dite_eq_left h, aeval_X] + rfl + · have h : (I.right (earlierSlot i j)).val < (I.right i).val := + I.right_strictMono j.isLt + simp only [insertSubstitution, Sum.elim_inr, PolynomialSlots.placementSubstitution, + dite_eq_left h, aeval_X] + rfl + +end WeightedParameterSlots + +namespace PolynomialSlots + +variable {σ : Type*} {D E : ℕ} {w : Fin D → ℕ} {v : Fin E → ℕ} + +noncomputable def insertLifts (A : PolynomialSlots σ D w) + (B : WeightedParameterSlots (σ ⊕ Fin D) (Sum.elim (fun _ => 1) w) E v) + (I : SlotInterleaving D E) : PolynomialSlots σ (D + E) (I.fill w v) where + center k := Fin.addCases (A.placeCenter I.left k) (B.insertCenter I k) (I.perm k) + degree k := by + change Fin.addCases (A.placeCenter I.left k) (B.insertCenter I k) (I.perm k) ∈ + weightedSupportLE (patchVariableWeight (I.fill w v) k) (Fin.append w v (I.perm k)) + generalize I.perm k = z + refine Fin.addCases (fun i => ?_) (fun i => ?_) z + · simpa only [Fin.addCases_left, Fin.append_left] using + A.placeCenter_degree I.left (fun j => I.fill_left w v j) k i + · simpa only [Fin.addCases_right, Fin.append_right] using B.insertCenter_degree I k i + +theorem insertLifts_center_left (A : PolynomialSlots σ D w) + (B : WeightedParameterSlots (σ ⊕ Fin D) (Sum.elim (fun _ => 1) w) E v) + (I : SlotInterleaving D E) (t : σ → ℝ) (x : Fin (D + E) → ℝ) (i : Fin D) : + ((A.insertLifts B I).slots t).center x (I.left i) = + (A.slots t).center (fun j => x (I.left j)) i := by + change aeval _ (Fin.addCases _ _ (I.perm (I.left i))) = _ + rw [show I.perm (I.left i) = i.castAdd E from I.perm.apply_symm_apply _, Fin.addCases_left] + exact A.placeCenter_eval I.left I.left_strictMono i t x + +theorem insertLifts_center_right (A : PolynomialSlots σ D w) + (B : WeightedParameterSlots (σ ⊕ Fin D) (Sum.elim (fun _ => 1) w) E v) + (I : SlotInterleaving D E) (hbefore : ∀ j i, w j ≤ v i → I.left j < I.right i) + (t : σ → ℝ) (x : Fin (D + E) → ℝ) (i : Fin E) : + ((A.insertLifts B I).slots t).center x (I.right i) = + (B.slots (Sum.elim t (fun j => x (I.left j)))).center (fun j => x (I.right j)) i := by + change aeval _ (Fin.addCases _ _ (I.perm (I.right i))) = _ + rw [show I.perm (I.right i) = i.natAdd D from I.perm.apply_symm_apply _, Fin.addCases_right] + exact B.insertCenter_eval I hbefore i t x + +theorem insertLifts_residual_left (A : PolynomialSlots σ D w) + (B : WeightedParameterSlots (σ ⊕ Fin D) (Sum.elim (fun _ => 1) w) E v) + (I : SlotInterleaving D E) (t : σ → ℝ) (z : Fin (D + E) → ℤ) (i : Fin D) : + ((A.insertLifts B I).slots t).residual z (I.left i) = + (A.slots t).residual (fun j => z (I.left j)) i := by + simp only [TriangularSlots.residual, insertLifts_center_left] + +theorem insertLifts_residual_right (A : PolynomialSlots σ D w) + (B : WeightedParameterSlots (σ ⊕ Fin D) (Sum.elim (fun _ => 1) w) E v) + (I : SlotInterleaving D E) (hbefore : ∀ j i, w j ≤ v i → I.left j < I.right i) + (t : σ → ℝ) (z : Fin (D + E) → ℤ) (i : Fin E) : + ((A.insertLifts B I).slots t).residual z (I.right i) = + (B.slots (Sum.elim t (fun j => (z (I.left j) : ℝ)))).residual + (fun j => z (I.right j)) i := by + simp only [TriangularSlots.residual, insertLifts_center_right A B I hbefore] + +end PolynomialSlots +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +namespace WeightedParameterSlots + +variable {σ τ : Type*} {p : σ → ℕ} {q : τ → ℕ} {d : ℕ} {w : Fin d → ℕ} + +noncomputable def parameterSubstitution (f : σ → MvPolynomial τ ℝ) (i : Fin d) : + σ ⊕ Fin i.val → MvPolynomial (τ ⊕ Fin i.val) ℝ := + Sum.elim (fun a => aeval (fun b => X (Sum.inl b)) (f a)) (fun j => X (Sum.inr j)) + +theorem parameterSubstitution_degree (f : σ → MvPolynomial τ ℝ) + (hf : ∀ a, f a ∈ weightedSupportLE q (p a)) (i : Fin d) (a : σ ⊕ Fin i.val) : + parameterSubstitution f i a ∈ weightedSupportLE (weightedPatchVariableWeight q w i) + (weightedPatchVariableWeight p w i a) := by + cases a with + | inl a => + apply weightedSupportLE_aeval q (weightedPatchVariableWeight q w i) + · intro b + exact weightedSupportLE_X _ (Sum.inl b) + · exact hf a + | inr j => exact weightedSupportLE_X _ (Sum.inr j) + +noncomputable def reparam (A : WeightedParameterSlots σ p d w) (f : σ → MvPolynomial τ ℝ) + (hf : ∀ a, f a ∈ weightedSupportLE q (p a)) : WeightedParameterSlots τ q d w where + center i := aeval (parameterSubstitution f i) (A.center i) + degree i := weightedSupportLE_aeval _ _ _ (parameterSubstitution_degree f hf i) (A.degree i) + +theorem reparam_slots (A : WeightedParameterSlots σ p d w) (f : σ → MvPolynomial τ ℝ) + (hf : ∀ a, f a ∈ weightedSupportLE q (p a)) (t : τ → ℝ) : + (A.reparam f hf).slots t = A.slots (fun a => aeval t (f a)) := by + apply TriangularSlots.ext + intro x i + simp only [slots, reparam, MvPolynomial.comp_aeval_apply] + apply congrArg (fun g : σ ⊕ Fin i.val → ℝ => aeval g (A.center i)) + funext a + cases a with + | inl a => + simp only [parameterSubstitution, Sum.elim_inl, MvPolynomial.comp_aeval_apply, aeval_X] + | inr j => simp [parameterSubstitution] + +end WeightedParameterSlots + +namespace WeightedParameterPatch + +variable {σ τ : Type*} {p : σ → ℕ} {q : τ → ℕ} {s d : ℕ} + +noncomputable def reparam (A : WeightedParameterPatch σ p s d) (f : σ → MvPolynomial τ ℝ) + (hf : ∀ a, f a ∈ weightedSupportLE q (p a)) : WeightedParameterPatch τ q s d where + weight := A.weight + weight_pos := A.weight_pos + weight_le := A.weight_le + weight_mono := A.weight_mono + form := A.form.reparam f hf + kernel := A.kernel + +@[simp] theorem reparam_lip (A : WeightedParameterPatch σ p s d) (f : σ → MvPolynomial τ ℝ) + (hf : ∀ a, f a ∈ weightedSupportLE q (p a)) : + (A.reparam f hf).kernel.lip = A.kernel.lip := rfl + +theorem reparam_value (A : WeightedParameterPatch σ p s d) (f : σ → MvPolynomial τ ℝ) + (hf : ∀ a, f a ∈ weightedSupportLE q (p a)) (t : τ → ℝ) : + (A.reparam f hf).value t = A.value (fun a => aeval t (f a)) := by + change ((A.form.reparam f hf).slots t).patchValue A.kernel = _ + rw [WeightedParameterSlots.reparam_slots] + rfl + +end WeightedParameterPatch +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedPlateauSiteApproximation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedPlateauSiteApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..342862c161deca9deced5ac8ea640faf3801f516 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedPlateauSiteApproximation.lean @@ -0,0 +1,675 @@ +import OAI.Combinatorics.Progressions.Lattices.AffineModeratePlateauModel + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {A : Type*} [Fintype A] {I : A → Type*} [∀ a, Fintype (I a)] + +theorem sigma_sum_coefficient_norm_le (w : A → ℂ) (c : ∀ a, I a → ℂ) + {C B : ℝ} (hB : 0 ≤ B) (hw : (∑ a, ‖w a‖) ≤ C) + (hc : ∀ a, (∑ i, ‖c a i‖) ≤ B) : + (∑ p : Σ a, I a, ‖w p.1 * c p.1 p.2‖) ≤ C * B := by + rw [Fintype.sum_sigma] + simp only [norm_mul, ← Finset.mul_sum] + calc + _ ≤ ∑ a, ‖w a‖ * B := + Finset.sum_le_sum (fun a _ => mul_le_mul_of_nonneg_left (hc a) (norm_nonneg _)) + _ = (∑ a, ‖w a‖) * B := (Finset.sum_mul _ _ _).symm + _ ≤ C * B := mul_le_mul_of_nonneg_right hw hB + +theorem sigma_sum_approximation_error (w g : A → ℂ) (c v : ∀ a, I a → ℂ) + {C ε : ℝ} (hε : 0 ≤ ε) (hw : (∑ a, ‖w a‖) ≤ C) + (he : ∀ a, ‖g a - ∑ i, c a i * v a i‖ ≤ ε) : + ‖(∑ a, w a * g a) - + ∑ p : Σ a, I a, (w p.1 * c p.1 p.2) * v p.1 p.2‖ ≤ C * ε := by + rw [Fintype.sum_sigma] + simp only [mul_assoc, ← Finset.mul_sum] + rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ a, ‖w a * g a - w a * ∑ i, c a i * v a i‖ := norm_sum_le _ _ + _ ≤ ∑ a, ‖w a‖ * ε := by + apply Finset.sum_le_sum + intro a _ + rw [← mul_sub, norm_mul] + exact mul_le_mul_of_nonneg_left (he a) (norm_nonneg _) + _ = (∑ a, ‖w a‖) * ε := (Finset.sum_mul _ _ _).symm + _ ≤ C * ε := mul_le_mul_of_nonneg_right hw hε + +theorem sigma_partition_card_le {S : Type*} [Fintype S] [DecidableEq S] + (n : A → ℕ) {B : ℝ} (hn : ∀ a, (n a : ℝ) ≤ B) : + (Fintype.card (Σ a, S → Fin (n a)) : ℝ) ≤ Fintype.card A * B ^ Fintype.card S := by + simp only [Fintype.card_sigma, Fintype.card_fun, Fintype.card_fin, Nat.cast_sum, Nat.cast_pow] + calc + _ ≤ ∑ _a : A, B ^ Fintype.card S := by + apply Finset.sum_le_sum + intro a _ + exact pow_le_pow_left₀ (Nat.cast_nonneg _) (hn a) _ + _ = _ := by simp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {T K L S U : Type*} [Fintype T] [Fintype K] [Fintype L] [Fintype S] +variable (c : T → ℂ) (a : K → L → ℂ) +variable (g : T → S → U → ℂ) (f : K → L → S → U → ℂ) (v : S → U) + +theorem finiteSitePrefactor_substitution_identity : + (∑ t, c t * ((∑ k, ∑ l, a k l * ∏ s, f k l s (v s)) * ∏ s, g t s (v s))) = + ∑ t, ∑ k, ∑ l, (c t * a k l) * ∏ s, g t s (v s) * f k l s (v s) := by + simp only [Finset.prod_mul_distrib, Finset.sum_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro l _ + ring + +theorem finiteSitePrefactor_substitution_error (P : ℂ) {ε : ℝ} + (hg : ∀ t s u, ‖g t s u‖ ≤ 1) + (he : ‖P - ∑ k, ∑ l, a k l * ∏ s, f k l s (v s)‖ ≤ ε) : + ‖(∑ t, c t * (P * ∏ s, g t s (v s))) - + ∑ t, ∑ k, ∑ l, (c t * a k l) * ∏ s, g t s (v s) * f k l s (v s)‖ ≤ + (∑ t, ‖c t‖) * ε := by + rw [← finiteSitePrefactor_substitution_identity c a g f v, ← Finset.sum_sub_distrib] + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ t, ‖c t‖ * ε := by + apply Finset.sum_le_sum + intro t _ + rw [← mul_sub, ← sub_mul, norm_mul, norm_mul] + have hp : ‖∏ s, g t s (v s)‖ ≤ 1 := by + rw [norm_prod] + exact Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) (fun s _ => hg t s (v s)) + exact mul_le_mul_of_nonneg_left + ((mul_le_mul_of_nonneg_left hp (norm_nonneg _)).trans (by simpa using he)) (norm_nonneg _) + _ = _ := (Finset.sum_mul _ _ _).symm + +theorem finiteSitePrefactor_coefficient_mass : + (∑ t, ∑ k, ∑ l, ‖c t * a k l‖) = (∑ t, ‖c t‖) * ∑ k, ∑ l, ‖a k l‖ := by + simp only [norm_mul, ← Finset.mul_sum, ← Finset.sum_mul] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open 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 (offset : B → ℤ) + +noncomputable def weightedPlateauModeCoefficient (K M : ℕ) (rows : Finset (Finset I)) + (k : rows → Fin M) : ℂ := + ((K : ℂ) / M) ^ rows.card * + ∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M rows k + +omit [NeZero M] in +theorem weightedPlateauModeCoefficient_sum_le (rows : Finset (Finset I)) + (F : Finset (rows → Fin M)) (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) {C : ℝ} + (hcap : (∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M rows k‖) ≤ C) : + (∑ k : F, ‖weightedPlateauModeCoefficient c s offset K M rows k‖) ≤ C := by + rw [← Finset.sum_subtype F (fun _ => Iff.rfl) + (fun k => ‖weightedPlateauModeCoefficient c s offset K M rows k‖)] + simp only [weightedPlateauModeCoefficient, 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 weightedPlateauModeModel (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 => weightedPlateauModeCoefficient c s offset K M rows k) + (fun k => plateauModeMixture p H (D k) K (a k) (ω k) shift) residue x + +omit [NeZero M] [Countable T] [MeasurableSingletonClass T] in +theorem weightedPlateauModeModel_norm (p : PMF T) (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 → ℝ) + (shift : T → rows → ℤ) (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) {C : ℝ} + (hcap : (∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M rows k‖) ≤ C) + (residue : ∀ k : F, rows → ZMod (D k)) (x : rows → ℝ) : + ‖weightedPlateauModeModel c s offset p H K rows F D a ω shift residue x‖ ≤ C := by + unfold weightedPlateauModeModel + exact finiteResidueModeModel_norm (fun k : F => D k) (fun k => a k) + (fun k => weightedPlateauModeCoefficient c s offset K M rows k) + (fun k => plateauModeMixture p H (D k) K (a k) (ω k) shift) + (weightedPlateauModeCoefficient_sum_le c s offset rows F hscale hcap) + (fun k y => plateauModeMixture_norm p H (D k) K (a k) (ω k) shift y) residue x + +omit [NeZero M] in +theorem weightedPlateauModeModel_lipschitz (p : PMF T) (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 → ℝ) + (shift : T → rows → ℤ) (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) (C W : ℝ≥0) + (hcap : (∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M rows k‖) ≤ C) + (hW : ∀ k ∈ F, ∀ t, |ω k t| ≤ W) (residue : ∀ k : F, rows → ZMod (D k)) : + LipschitzWith (C * (CircleFourier.characterLipConstant * (rows.card * W) + 4)) + (weightedPlateauModeModel c s offset p H K rows F D a ω shift residue) := by + unfold weightedPlateauModeModel + have h := finiteResidueModeModel_lipschitz (fun k : F => D k) (fun k => a k) + (fun k => weightedPlateauModeCoefficient c s offset K M rows k) + (fun k => plateauModeMixture p H (D k) K (a k) (ω k) shift) C + (CircleFourier.characterLipConstant * (Fintype.card rows * W) + 4) + (weightedPlateauModeCoefficient_sum_le c s offset rows F hscale hcap) + (fun k => plateauModeMixture_lipschitz p H (D k) K (a k) (ω k) shift W (hW k k.property)) residue + simpa only [Fintype.card_coe] using h + +theorem weightedPlateauModeModel_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 → ℤ) : + (∫ v, weightedModeratePlateauApproximation c s offset K H rows (shift v) z F ∂p.toMeasure) = + weightedPlateauModeModel c s offset p H K rows F D a ω shift + (fun k => integerGridResidue (D k) z) (fun t => (z t : ℝ) / K) := by + rw [weightedModeratePlateauMixture_expansion c s offset p hK H rows shift z F D a ω hfreq] + let term (k : rows → Fin M) := weightedPlateauModeCoefficient c s 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, weightedPlateauModeCoefficient, Finset.mul_sum, mul_assoc] + _ = ∑ k : F, term k := Finset.sum_subtype F (fun _ => Iff.rfl) term + _ = _ := rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +variable {α A T : Type*} [Fintype α] [DecidableEq α] [Fintype A] [DecidableEq A] + +noncomputable def selectedBooleanSiteRows (axis : A) (rows : Finset (Finset α)) + (x : Finset α → A → ℝ) : rows → ℝ := + fun t => booleanCoefficient (fun s => x s axis) t + +omit [DecidableEq A] in +theorem selectedBooleanSiteRows_lipschitz (axis : A) (rows : Finset (Finset α)) : + LipschitzWith ((2 : ℝ≥0) ^ Fintype.card α) (selectedBooleanSiteRows axis rows) := by + apply LipschitzWith.of_dist_le_mul + intro x y + apply (dist_pi_le_iff (by positivity)).mpr + intro t + change |booleanCoefficient (fun s => x s axis) t - booleanCoefficient (fun s => y s axis) t| ≤ _ + apply (booleanCoefficient_sub_bound _ _ _ (H := dist x y) ?_).trans + · simp only [NNReal.coe_pow, NNReal.coe_ofNat] + gcongr + · norm_num + · exact Finset.card_le_univ _ + · intro s _ + exact (show |x s axis - y s axis| ≤ dist (x s) (y s) from + dist_le_pi_dist (x s) (y s) axis).trans (dist_le_pi_dist x y s) + +omit [Fintype α] [Fintype A] [DecidableEq A] in +theorem selectedBooleanSiteRows_integer (axis : A) (rows : Finset (Finset α)) + (N : A → ℕ) (y : Finset α → A → ℤ) : + selectedBooleanSiteRows axis rows (fun s d => (y s d : ℝ) / N d) = + fun t : rows => ((booleanCoefficient (fun s => y s axis) t : ℤ) : ℝ) / N axis := by + funext t + rw [selectedBooleanSiteRows, booleanCoefficient_div] + congr 1 + exact (booleanCoefficient_map (Int.castRingHom ℝ) (fun s => y s axis) t).symm + +noncomputable def rationalBooleanSitePhase (D : ℕ) [NeZero D] + (rows : Finset (Finset α)) (a : rows → ℤ) (s : Finset α) (v : ZMod D) : ℂ := + rationalGridPhase D a (fun t => booleanCoefficient (Pi.single s v) t) + +omit [Fintype α] in +theorem rationalBooleanSitePhase_norm (D : ℕ) [NeZero D] + (rows : Finset (Finset α)) (a : rows → ℤ) (s : Finset α) (v : ZMod D) : + ‖rationalBooleanSitePhase D rows a s v‖ = 1 := rationalGridPhase_norm _ _ _ + +theorem rationalBooleanSitePhase_prod (D : ℕ) [NeZero D] + (rows : Finset (Finset α)) (a : rows → ℤ) (r : Finset α → ZMod D) : + rationalGridPhase D a (fun t => booleanCoefficient r t) = + ∏ s, rationalBooleanSitePhase D rows a s (r s) := by + have hsum (t : rows) : booleanCoefficient r t = + ∑ s : Finset α, booleanCoefficient (Pi.single s (r s)) t := by + rw [← booleanCoefficient_sum] + congr 1 + funext u + simp [Pi.single_apply] + unfold rationalBooleanSitePhase rationalGridPhase + simp_rw [hsum] + simp only [Finset.mul_sum] + rw [Finset.sum_comm, map_sum, CircleFourier.character_fintype_sum] + +variable [Countable T] [MeasurableSpace T] [MeasurableSingletonClass T] + +theorem exists_plateau_mode_site_approximation (p : PMF T) (H : ℝ) (D K : ℕ) [NeZero D] + (axis : A) (rows : Finset (Finset α)) (a : rows → ℤ) (ω : rows → ℝ) + (shift : T → rows → ℤ) (W : ℝ≥0) (hW : ∀ t, |ω t| ≤ W) + {R ε P : ℝ} (hR : 0 < R) (hε : 0 < ε) (hP : 0 ≤ P) + (hRP : R ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) + (hLP : ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * + (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp P) : + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * P + 8) ∧ + ∃ (c : (Finset α × A → Fin n) → ℂ) + (f : (Finset α × A → Fin n) → Finset α → (A → ℝ) → ℂ), + (∑ k, ‖c k‖) ≤ Real.exp ((Fintype.card (Finset α) * Fintype.card A : ℕ) * (4 * P + 8) + P) ∧ + (∀ k s x, ‖f k s x‖ ≤ 1) ∧ + (∀ k s, LipschitzWith ⟨Real.exp (Fintype.card A + 6 * P + 12), Real.exp_nonneg _⟩ (f k s)) ∧ + ∀ x : Finset α → A → ℝ, (∀ s d, |x s d| ≤ R) → + ‖plateauModeMixture p H D K a ω shift (selectedBooleanSiteRows axis rows x) - + ∑ k, c k * ∏ s, f k s (x s)‖ ≤ ε := by + apply exists_grouped_site_approximation _ 1 + ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * (2 : ℝ≥0) ^ Fintype.card α) + (fun x => plateauModeMixture_norm p H D K a ω shift _) _ hR hε hP hRP + (by simpa only [NNReal.coe_one] using Real.one_le_exp hP) hLP hεP + have h := (plateauModeMixture_lipschitz p H D K a ω shift W hW).comp + (selectedBooleanSiteRows_lipschitz axis rows) + simpa only [Fintype.card_coe, Function.comp_def] using h + +theorem exists_residue_plateau_site_approximation (p : PMF T) (H : ℝ) (D K : ℕ) [NeZero D] + (axis : A) (rows : Finset (Finset α)) (a : rows → ℤ) (ω : rows → ℝ) + (shift : T → rows → ℤ) (W : ℝ≥0) (hW : ∀ t, |ω t| ≤ W) + {R ε P : ℝ} (hR : 0 < R) (hε : 0 < ε) (hP : 0 ≤ P) + (hRP : R ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) + (hLP : ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * + (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp P) : + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * P + 8) ∧ + ∃ (c : (Finset α × A → Fin n) → ℂ) + (f : (Finset α × A → Fin n) → Finset α → ZMod D → (A → ℝ) → ℂ), + (∑ k, ‖c k‖) ≤ Real.exp ((Fintype.card (Finset α) * Fintype.card A : ℕ) * (4 * P + 8) + P) ∧ + (∀ k s r x, ‖f k s r x‖ ≤ 1) ∧ + (∀ k s r, LipschitzWith ⟨Real.exp (Fintype.card A + 6 * P + 12), Real.exp_nonneg _⟩ (f k s r)) ∧ + ∀ (r : Finset α → ZMod D) (x : Finset α → A → ℝ), (∀ s d, |x s d| ≤ R) → + ‖star (rationalGridPhase D a (fun t => booleanCoefficient r t)) * + plateauModeMixture p H D K a ω shift (selectedBooleanSiteRows axis rows x) - + ∑ k, c k * ∏ s, f k s (r s) (x s)‖ ≤ ε := by + obtain ⟨n, hn, c, f, hc, hf, hLf, he⟩ := + exists_plateau_mode_site_approximation p H D K axis rows a ω shift W hW hR hε hP hRP hεP hLP + refine ⟨n, hn, c, (fun k s r x => star (rationalBooleanSitePhase D rows a s r) * f k s x), + hc, ?_, ?_, ?_⟩ + · intro k s r x + rw [norm_mul, norm_star, rationalBooleanSitePhase_norm, one_mul] + exact hf k s x + · intro k s r + apply LipschitzWith.of_dist_le_mul + intro x y + rw [dist_eq_norm, ← mul_sub, norm_mul, norm_star, rationalBooleanSitePhase_norm, one_mul] + simpa only [dist_eq_norm] using (hLf k s).dist_le_mul x y + · intro r x hx + have hp : (∏ s, star (rationalBooleanSitePhase D rows a s (r s))) = + star (rationalGridPhase D a (fun t => booleanCoefficient r t)) := by + rw [← star_prod, ← rationalBooleanSitePhase_prod] + have hs : (∑ k, c k * ∏ s, star (rationalBooleanSitePhase D rows a s (r s)) * f k s (x s)) = + star (rationalGridPhase D a (fun t => booleanCoefficient r t)) * + ∑ k, c k * ∏ s, f k s (x s) := by + simp only [Finset.prod_mul_distrib, hp, Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + ring + rw [hs, ← mul_sub, norm_mul, norm_star, rationalGridPhase_norm, one_mul] + exact he x hx + +theorem exists_integer_plateau_site_approximation (p : PMF T) (H : ℝ) (D : ℕ) [NeZero D] + (axis : A) (N : A → ℕ) (rows : Finset (Finset α)) (a : rows → ℤ) (ω : rows → ℝ) + (shift : T → rows → ℤ) (W : ℝ≥0) (hW : ∀ t, |ω t| ≤ W) + {R ε P : ℝ} (hR : 0 < R) (hε : 0 < ε) (hP : 0 ≤ P) + (hRP : R ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) + (hLP : ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * + (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp P) : + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * P + 8) ∧ + ∃ (c : (Finset α × A → Fin n) → ℂ) + (f : (Finset α × A → Fin n) → Finset α → ZMod D → (A → ℝ) → ℂ), + (∑ k, ‖c k‖) ≤ Real.exp ((Fintype.card (Finset α) * Fintype.card A : ℕ) * (4 * P + 8) + P) ∧ + (∀ k s r x, ‖f k s r x‖ ≤ 1) ∧ + (∀ k s r, LipschitzWith ⟨Real.exp (Fintype.card A + 6 * P + 12), Real.exp_nonneg _⟩ (f k s r)) ∧ + ∀ y : Finset α → A → ℤ, (∀ s d, |(y s d : ℝ) / N d| ≤ R) → + ‖star (rationalGridPhase D a (integerGridResidue D + (fun t => booleanCoefficient (fun s => y s axis) t))) * + plateauModeMixture p H D (N axis) a ω shift + (fun t => ((booleanCoefficient (fun s => y s axis) t : ℤ) : ℝ) / N axis) - + ∑ k, c k * ∏ s, f k s (y s axis : ZMod D) (fun d => (y s d : ℝ) / N d)‖ ≤ ε := by + obtain ⟨n, hn, c, f, hc, hf, hLf, he⟩ := exists_residue_plateau_site_approximation + p H D (N axis) axis rows a ω shift W hW hR hε hP hRP hεP hLP + refine ⟨n, hn, c, f, hc, hf, hLf, ?_⟩ + intro y hy + have hb := he (fun s => (y s axis : ZMod D)) (fun s d => (y s d : ℝ) / N d) hy + rw [selectedBooleanSiteRows_integer] at hb + have hcast : (fun t : rows => booleanCoefficient (fun s => (y s axis : ZMod D)) t) = + integerGridResidue D (fun t : rows => booleanCoefficient (fun s => y s axis) t) := by + funext t + exact (booleanCoefficient_map (Int.castRingHom (ZMod D)) (fun s => y s axis) t).symm + rw [hcast] at hb + exact hb + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +variable {α T : Type*} [Fintype α] [DecidableEq α] +variable [Countable T] [MeasurableSpace T] [MeasurableSingletonClass T] + +theorem exists_scalar_residue_plateau_site_approximation + (p : PMF T) (H : ℝ) (D K : ℕ) [NeZero D] + (rows : Finset (Finset α)) (a : rows → ℤ) (ω : rows → ℝ) + (shift : T → rows → ℤ) (W : ℝ≥0) (hW : ∀ t, |ω t| ≤ W) + {R ε P : ℝ} (hR : 0 < R) (hε : 0 < ε) (hP : 0 ≤ P) + (hRP : R ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) + (hLP : ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * + (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp P) : + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * P + 8) ∧ + ∃ (c : (Finset α × Unit → Fin n) → ℂ) + (f : (Finset α × Unit → Fin n) → Finset α → ZMod D → ℝ → ℂ), + (∑ k, ‖c k‖) ≤ Real.exp (Fintype.card (Finset α) * (4 * P + 8) + P) ∧ + (∀ k s r x, ‖f k s r x‖ ≤ 1) ∧ + (∀ k s r, LipschitzWith ⟨Real.exp (1 + 6 * P + 12), Real.exp_nonneg _⟩ (f k s r)) ∧ + ∀ (r : Finset α → ZMod D) (x : Finset α → ℝ), (∀ s, |x s| ≤ R) → + ‖star (rationalGridPhase D a (fun t => booleanCoefficient r t)) * + plateauModeMixture p H D K a ω shift (fun t => booleanCoefficient x t) - + ∑ k, c k * ∏ s, f k s (r s) (x s)‖ ≤ ε := by + obtain ⟨n, hn, c, f, hc, hf, hLf, he⟩ := + exists_residue_plateau_site_approximation p H D K () rows a ω shift W hW hR hε hP hRP hεP hLP + refine ⟨n, hn, c, (fun k s r x => f k s r (fun _ => x)), ?_, ?_, ?_, ?_⟩ + · simpa only [Fintype.card_unit, mul_one] using hc + · intro k s r x + exact hf k s r _ + · intro k s r + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [Fintype.card_unit, Nat.cast_one, dist_pi_const] using + (hLf k s r).dist_le_mul (fun _ => x) (fun _ => y) + · intro r x hx + exact he r (fun s _ => x s) (fun s _ => hx s) + +theorem exists_scalar_integer_plateau_site_approximation + (p : PMF T) (H : ℝ) (D K : ℕ) [NeZero D] + (rows : Finset (Finset α)) (a : rows → ℤ) (ω : rows → ℝ) + (shift : T → rows → ℤ) (W : ℝ≥0) (hW : ∀ t, |ω t| ≤ W) + {R ε P : ℝ} (hR : 0 < R) (hε : 0 < ε) (hP : 0 ≤ P) + (hRP : R ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) + (hLP : ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * + (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp P) : + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * P + 8) ∧ + ∃ (c : (Finset α × Unit → Fin n) → ℂ) + (f : (Finset α × Unit → Fin n) → Finset α → ZMod D → ℝ → ℂ), + (∑ k, ‖c k‖) ≤ Real.exp (Fintype.card (Finset α) * (4 * P + 8) + P) ∧ + (∀ k s r x, ‖f k s r x‖ ≤ 1) ∧ + (∀ k s r, LipschitzWith ⟨Real.exp (1 + 6 * P + 12), Real.exp_nonneg _⟩ (f k s r)) ∧ + ∀ y : Finset α → ℤ, (∀ s, |(y s : ℝ) / K| ≤ R) → + ‖star (rationalGridPhase D a (integerGridResidue D + (fun t => booleanCoefficient y t))) * + plateauModeMixture p H D K a ω shift + (fun t => ((booleanCoefficient y t : ℤ) : ℝ) / K) - + ∑ k, c k * ∏ s, f k s (y s : ZMod D) ((y s : ℝ) / K)‖ ≤ ε := by + obtain ⟨n, hn, c, f, hc, hf, hLf, he⟩ := exists_scalar_residue_plateau_site_approximation + p H D K rows a ω shift W hW hR hε hP hRP hεP hLP + refine ⟨n, hn, c, f, hc, hf, hLf, ?_⟩ + intro y hy + have h := he (fun s => (y s : ZMod D)) (fun s => (y s : ℝ) / K) hy + have hr : (fun t : rows => booleanCoefficient (fun s => (y s : ZMod D)) t) = + integerGridResidue D (fun t : rows => booleanCoefficient y t) := by + funext t + exact (booleanCoefficient_map (Int.castRingHom (ZMod D)) y t).symm + have hx : (fun t : rows => booleanCoefficient (fun s => (y s : ℝ) / K) t) = + (fun t : rows => ((booleanCoefficient y t : ℤ) : ℝ) / K) := by + funext t + rw [booleanCoefficient_div] + congr 1 + exact (booleanCoefficient_map (Int.castRingHom ℝ) y t).symm + rwa [hr, hx] at h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +abbrev PlateauSiteIndex (α A : Type*) (n : A → ℕ) := + Σ a, (Finset α × Unit → Fin (n a)) + +variable {α A T : Type*} [Fintype α] [DecidableEq α] [Fintype A] + +theorem plateauSiteIndex_card_le (n : A → ℕ) {P : ℝ} + (hn : ∀ m, (n m : ℝ) ≤ Real.exp (4 * P + 8)) : + (Fintype.card (PlateauSiteIndex α A n) : ℝ) ≤ + Fintype.card A * Real.exp (Fintype.card (Finset α) * (4 * P + 8)) := by + have hb := sigma_partition_card_le (A := A) (S := Finset α × Unit) n hn + rw [Fintype.card_prod, Fintype.card_unit, mul_one, ← Real.exp_nat_mul] at hb + exact hb + +variable [Countable T] [MeasurableSpace T] [MeasurableSingletonClass T] + +theorem exists_integer_plateau_sum_site_approximation + (p : PMF T) (H : ℝ) (K : ℕ) (rows : Finset (Finset α)) + (D : A → ℕ) [∀ a, NeZero (D a)] + (a : A → rows → ℤ) (ω : A → rows → ℝ) (shift : T → rows → ℤ) + (coefficient : A → ℂ) {C : ℝ} (hcap : (∑ m, ‖coefficient m‖) ≤ C) + (W : ℝ≥0) (hW : ∀ m t, |ω m t| ≤ W) + {R ε P : ℝ} (hR : 0 < R) (hε : 0 < ε) (hP : 0 ≤ P) + (hRP : R ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) + (hLP : ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * + (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp P) : + ∃ n : A → ℕ, (∀ m, (n m : ℝ) ≤ Real.exp (4 * P + 8)) ∧ + (Fintype.card (PlateauSiteIndex α A n) : ℝ) ≤ + Fintype.card A * Real.exp (Fintype.card (Finset α) * (4 * P + 8)) ∧ + ∃ (c : PlateauSiteIndex α A n → ℂ) + (f : (k : PlateauSiteIndex α A n) → Finset α → ZMod (D k.1) → ℝ → ℂ), + (∑ k, ‖c k‖) ≤ C * Real.exp (Fintype.card (Finset α) * (4 * P + 8) + P) ∧ + (∀ k s r x, ‖f k s r x‖ ≤ 1) ∧ + (∀ k s r, LipschitzWith ⟨Real.exp (1 + 6 * P + 12), Real.exp_nonneg _⟩ (f k s r)) ∧ + ∀ y : Finset α → ℤ, (∀ s, |(y s : ℝ) / K| ≤ R) → + ‖finiteResidueModeModel D a coefficient + (fun m => plateauModeMixture p H (D m) K (a m) (ω m) shift) + (fun m => integerGridResidue (D m) (fun t => booleanCoefficient y t)) + (fun t => ((booleanCoefficient y t : ℤ) : ℝ) / K) - + ∑ k, c k * ∏ s, f k s (y s : ZMod (D k.1)) ((y s : ℝ) / K)‖ ≤ C * ε := by + have hex (m : A) := exists_scalar_integer_plateau_site_approximation + p H (D m) K rows (a m) (ω m) shift W (hW m) hR hε hP hRP hεP hLP + choose n hn c f hc hf hLf he using hex + refine ⟨n, hn, ?_, (fun k => coefficient k.1 * c k.1 k.2), (fun k => f k.1 k.2), + ?_, ?_, ?_, ?_⟩ + · exact plateauSiteIndex_card_le (α := α) n hn + · exact sigma_sum_coefficient_norm_le coefficient c (Real.exp_nonneg _) hcap hc + · intro k s r x + exact hf k.1 k.2 s r x + · intro k s r + exact hLf k.1 k.2 s r + · intro y hy + exact sigma_sum_approximation_error coefficient _ c + (fun m k => ∏ s, f m k s (y s : ZMod (D m)) ((y s : ℝ) / K)) + hε.le hcap (fun m => he m y hy) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators Classical NNReal + +variable {B α T : Type*} [Fintype B] [Fintype α] [DecidableEq α] +variable {n K M : ℕ} [NeZero M] +variable (s : B → Fin (n + 1) → NormalizedScalarCubeSource α) + +noncomputable def weightedCubePlateauCoefficient (K M : ℕ) (rows : Finset (Finset α)) + (k : rows → Fin M) : ℂ := + ((K : ℂ) / M) ^ rows.card * ∏ b, weightedCubeGridCoefficient (s b) M rows k + +omit [NeZero M] in +theorem weightedCubePlateauCoefficient_sum_le (rows : Finset (Finset α)) + (F : Finset (rows → Fin M)) (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) {C : ℝ} + (hcap : (∑ k, ‖∏ b, weightedCubeGridCoefficient (s b) M rows k‖) ≤ C) : + (∑ k : F, ‖weightedCubePlateauCoefficient s K M rows k‖) ≤ C := by + rw [← Finset.sum_subtype F (fun _ => Iff.rfl) + (fun k => ‖weightedCubePlateauCoefficient s K M rows k‖)] + simp only [weightedCubePlateauCoefficient, 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 weightedCubePlateauMixture_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 → ℤ) : + (∫ v, weightedCubePlateauApproximation s K H rows (shift v) z F ∂p.toMeasure) = + finiteResidueModeModel (fun k : F => D k) (fun k => a k) + (fun k => weightedCubePlateauCoefficient s 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 [weightedCubePlateauMixture_expansion s p hK H rows shift z F D a ω hfreq] + let term (k : rows → Fin M) := weightedCubePlateauCoefficient s 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, weightedCubePlateauCoefficient, Finset.mul_sum, mul_assoc] + _ = ∑ k : F, term k := Finset.sum_subtype F (fun _ => Iff.rfl) term + _ = _ := rfl + +theorem exists_weightedCube_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, weightedCubeGridCoefficient (s 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) → + ‖(∫ v, weightedCubePlateauApproximation s K H rows (shift v) + (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 => weightedCubePlateauCoefficient s K M rows k) + (weightedCubePlateauCoefficient_sum_le s 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 [weightedCubePlateauMixture_model s 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 + +section + +namespace Erdos3 + +open MeasureTheory +open 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_plateau_site_approximation + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin b → NormalizedScalarCubeSource α) + (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, ‖∏ u, weightedModerateGridCoefficient (c u) (s u) (offset u : ℝ) 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) → + ‖(∫ v, weightedModeratePlateauApproximation c s offset K H rows (shift v) + (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 => weightedPlateauModeCoefficient c s offset K M rows k) + (weightedPlateauModeCoefficient_sum_le c s 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 [weightedPlateauModeModel_grid_value c s 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 OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedRetainedCoefficients.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedRetainedCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..5dcf266ec61e22855bd7f0bc868ce0818f3ddc2e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedRetainedCoefficients.lean @@ -0,0 +1,167 @@ +import OAI.Combinatorics.Progressions.Sampling.WeightedUniformGridDensity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedCube_uniform_absolute_cap {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hlen : ∀ b j, L ≤ (s b j).length) + (M t : ℕ) (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : uniformSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (hscale : ∀ b, (M : ℝ) / ∏ j, ((s b j).length : ℝ) ≤ V) : + (∑ k, ‖∏ b, weightedCubeGridCoefficient (s b) M J k‖) ≤ uniformSpectrumAbsoluteCap n J.card t U V W := by + rw [← Fintype.card_coe] + apply uniformBlockSpectrum_absolute_cap M n t (fun b => weightedCubeGridCoefficient (s b) M J) hU hV hW hL + (by simpa only [Fintype.card_coe] using hB) (by simpa only [Fintype.card_coe] using hsize) + · exact fun b k => weightedCubeGridCoefficient_norm_le_one (s b) M J k + · intro δ hδ hδ1 hlength b k hk + exact weightedCubeGridCoefficient_minor_polynomial (s b) A hA (h b) hV hδ hδ1 + (fun j => hlength.trans (hlen b j)) hM (hscale b) J hJ k + (by simpa only [Fintype.card_coe] using hk) + +theorem weightedModerate_uniform_absolute_cap {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin n → NormalizedScalarCubeSource I) (offset : B → ℝ) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hc : ∀ b, ScalarCubePrimitiveBudget (c b) A U) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hclen : ∀ b, L ≤ (c b).length) (hlen : ∀ b j, L ≤ (s b j).length) + (M t : ℕ) (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hB : uniformSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (hscale : ∀ b, (M : ℝ) / ((((c b).modulus none : ℝ) * (c b).length) * + ∏ j, ((s b j).length : ℝ)) ≤ V) : + (∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b) M J k‖) ≤ + uniformSpectrumAbsoluteCap n J.card t U V W := by + rw [← Fintype.card_coe] + apply uniformBlockSpectrum_absolute_cap M n t + (fun b => weightedModerateGridCoefficient (c b) (s b) (offset b) M J) hU hV hW hL + (by simpa only [Fintype.card_coe] using hB) (by simpa only [Fintype.card_coe] using hsize) + · exact fun b k => weightedModerateGridCoefficient_norm_le_one (c b) (s b) (offset b) M J k + · intro δ hδ hδ1 hlength b k hk + exact weightedModerateGridCoefficient_minor_polynomial (c b) (s b) A hA (hc b) (h b) + hV hδ hδ1 (hlength.trans (hclen b)) (fun j => hlength.trans (hlen b j)) (offset b) + hM (hscale b) J hJ k (by simpa only [Fintype.card_coe] using hk) + +theorem weightedCube_grid_density_bound {B I : Type*} + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] {n : ℕ} + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) {C : ℝ} + (hcap : (∑ k, ‖∏ b, weightedCubeGridCoefficient (s b) M J k‖) ≤ C) + (shift z : J → ℤ) : + integerGridDensity (weightedCubeIntegerSource s) (weightedCubeIntegerJetSum s J shift) K M z ≤ + ((K : ℝ) / M) ^ J.card * C := by + have ht := integerGridDensity_absolute_cap (weightedCubeIntegerSource s) + (weightedCubeIntegerJetSum s J shift) K M z + simp only [Fintype.card_coe, weightedCubeIntegerJetSum_coefficient, norm_mul, + rectangularGridCharacter_norm, one_mul] at ht + exact ht.trans (mul_le_mul_of_nonneg_left hcap (by positivity)) + +theorem weightedModerate_grid_density_bound {B I : Type*} + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] {n : ℕ} + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) {C : ℝ} + (hcap : (∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M J k‖) ≤ C) + (shift z : J → ℤ) : + integerGridDensity (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s J offset shift) K M z ≤ ((K : ℝ) / M) ^ J.card * C := by + have ht := integerGridDensity_absolute_cap (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s J offset shift) K M z + simp only [Fintype.card_coe, weightedModerateIntegerJetSum_coefficient, norm_mul, + rectangularGridCharacter_norm, one_mul] at ht + exact ht.trans (mul_le_mul_of_nonneg_left hcap (by positivity)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def weightedCubeRetainedCoefficient {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (center : J → ℤ) (k : J → Fin M) : ℂ := + ((K : ℂ) / M) ^ J.card * (∏ b, weightedCubeGridCoefficient (s b) M J k) * rectangularGridCharacter M k center + +theorem weightedCubeGridApproximation_eq_sum {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (center z : J → ℤ) (S : Finset (J → Fin M)) : + weightedCubeGridApproximation s K M J center z S = + ∑ k ∈ S, weightedCubeRetainedCoefficient s K M J center k * star (rectangularGridCharacter M k z) := by + rw [weightedCubeGridApproximation, Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + unfold weightedCubeRetainedCoefficient + ring + +theorem weightedCubeRetainedCoefficient_norm {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (center : J → ℤ) (k : J → Fin M) : + ‖weightedCubeRetainedCoefficient s K M J center k‖ = + ((K : ℝ) / M) ^ J.card * ‖∏ b, weightedCubeGridCoefficient (s b) M J k‖ := by + simp only [weightedCubeRetainedCoefficient, norm_mul, norm_pow, norm_div, + Complex.norm_natCast, rectangularGridCharacter_norm, mul_one] + +theorem weightedCubeRetainedCoefficient_mass {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (center : J → ℤ) (S : Finset (J → Fin M)) + {C : ℝ} (hC : (∑ k, ‖∏ b, weightedCubeGridCoefficient (s b) M J k‖) ≤ C) : + (∑ k ∈ S, ‖weightedCubeRetainedCoefficient s K M J center k‖) ≤ ((K : ℝ) / M) ^ J.card * C := by + classical + simp only [weightedCubeRetainedCoefficient_norm, ← Finset.mul_sum] + exact mul_le_mul_of_nonneg_left (finite_product_retained_mass_le _ S hC) (by positivity) + +noncomputable def weightedModerateRetainedCoefficient {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (center : J → ℤ) (k : J → Fin M) : ℂ := + ((K : ℂ) / M) ^ J.card * (∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M J k) * + rectangularGridCharacter M k center + +theorem weightedModerateGridApproximation_eq_sum {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (center z : J → ℤ) (S : Finset (J → Fin M)) : + weightedModerateGridApproximation c s K M J offset center z S = + ∑ k ∈ S, weightedModerateRetainedCoefficient c s K M J offset center k * + star (rectangularGridCharacter M k z) := by + rw [weightedModerateGridApproximation, Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + unfold weightedModerateRetainedCoefficient + ring + +theorem weightedModerateRetainedCoefficient_norm {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (center : J → ℤ) (k : J → Fin M) : + ‖weightedModerateRetainedCoefficient c s K M J offset center k‖ = + ((K : ℝ) / M) ^ J.card * ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M J k‖ := by + simp only [weightedModerateRetainedCoefficient, norm_mul, norm_pow, norm_div, + Complex.norm_natCast, rectangularGridCharacter_norm, mul_one] + +theorem weightedModerateRetainedCoefficient_mass {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (center : J → ℤ) (S : Finset (J → Fin M)) + {C : ℝ} (hC : (∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) M J k‖) ≤ C) : + (∑ k ∈ S, ‖weightedModerateRetainedCoefficient c s K M J offset center k‖) ≤ + ((K : ℝ) / M) ^ J.card * C := by + classical + simp only [weightedModerateRetainedCoefficient_norm, ← Finset.mul_sum] + exact mul_le_mul_of_nonneg_left (finite_product_retained_mass_le _ S hC) (by positivity) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedRudin.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedRudin.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3e23a24cb5425dcad8add856ccf48b1aeef43c7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedRudin.lean @@ -0,0 +1,171 @@ +import OAI.Combinatorics.Progressions.Fourier.FiniteFourierSmoothing + +namespace OAI + +section + +noncomputable section + +open Finset Function Real +open scoped BigOperators ComplexConjugate NNReal + +namespace Erdos3.RelativeChangSanders + +variable {G : Type*} [Fintype G] [AddCommGroup G] + +theorem IsWeightedDissociated.mono_K {mu : G → ℝ} {K L : ℝ} + {Delta : Finset (AddChar G ℂ)} + (h : IsWeightedDissociated mu K Delta) (hKL : K ≤ L) : + IsWeightedDissociated mu L Delta := by + intro u hu + exact (h u hu).trans (Real.exp_le_exp.mpr hKL) + +theorem IsWeightedDissociated.mono_subset {mu : G → ℝ} {K : ℝ} + {Delta Gamma : Finset (AddChar G ℂ)} + (h : IsWeightedDissociated mu K Delta) (hsub : Gamma ⊆ Delta) : + IsWeightedDissociated mu K Gamma := by + intro u hu + let v : AddChar G ℂ → ℂ := fun psi ↦ if psi ∈ Gamma then u psi else 0 + have hv : ∀ psi ∈ Delta, ‖v psi‖ ≤ 1 := by + intro psi hpsi + by_cases hp : psi ∈ Gamma + · simpa [v, hp] using hu psi hp + · simp [v, hp] + have heq (x : G) : + ∏ psi ∈ Delta, (1 + (v psi * psi x).re) = + ∏ psi ∈ Gamma, (1 + (u psi * psi x).re) := by + rw [← Finset.prod_subset hsub] + · apply prod_congr rfl + intro psi hpsi + simp [v, hpsi] + · intro psi hpsiDelta hpsiGamma + simp [v, hpsiGamma] + simpa only [heq] using h v hv + +omit [AddCommGroup G] in + +theorem exp_weightedAverage_le_weightedAverage_exp + (w : G → ℝ) (hw : ∀ x, 0 ≤ w x) (hw_sum : ∑ x : G, w x = 1) + (f : G → ℝ) : + exp (∑ x : G, w x * f x) ≤ ∑ x : G, w x * exp (f x) := by + have h := convexOn_exp.map_sum_le (t := (Finset.univ : Finset G)) + (p := f) (fun x _ ↦ hw x) (by simpa using hw_sum) + (fun x _ ↦ Set.mem_univ (f x)) + simpa using h + +theorem weighted_rudin_exp_ineq + (mu : G → ℝ) (K : ℝ) (Delta : Finset (AddChar G ℂ)) + (hmu : ∀ x, 0 ≤ mu x) + (hDelta : IsWeightedDissociated mu K Delta) + (c : AddChar G ℂ → ℂ) : + ∑ x : G, mu x * exp ((∑ psi ∈ Delta, c psi * psi x).re) ≤ + exp (K + (∑ psi ∈ Delta, ‖c psi‖ ^ 2) / 2) := by + have hexp (z : ℂ) : + exp z.re ≤ cosh ‖z‖ + (z / ‖z‖).re * sinh ‖z‖ := by + calc + _ = exp ((z / ‖z‖).re * ‖z‖) := by + obtain rfl | hz := eq_or_ne z 0 <;> simp [*] + _ ≤ _ := exp_mul_le_cosh_add_mul_sinh + (by simpa using z.abs_re_div_norm_le_one) _ + choose u hu huc using fun psi ↦ Complex.exists_norm_mul_eq_self (c psi) + have hu0 (psi : AddChar G ℂ) : u psi ≠ 0 := fun h ↦ by + simpa [h] using hu psi + have hpoint (x : G) : + exp ((∑ psi ∈ Delta, c psi * psi x).re) ≤ + ∏ psi ∈ Delta, + (cosh ‖c psi‖ + (u psi * sinh ‖c psi‖ * psi x).re) := by + calc + exp ((∑ psi ∈ Delta, c psi * psi x).re) = + ∏ psi ∈ Delta, exp ((c psi * psi x).re) := by + simp_rw [← exp_sum, ← Complex.re_sum] + _ ≤ ∏ psi ∈ Delta, + (cosh ‖c psi * psi x‖ + + ((c psi * psi x) / ‖c psi * psi x‖).re * + sinh ‖c psi * psi x‖) := by + gcongr with psi hpsi + exact hexp _ + _ = ∏ psi ∈ Delta, + (cosh ‖c psi‖ + + (u psi * (c psi * psi x) / (u psi * ↑‖c psi‖)).re * + sinh ‖c psi‖) := by + apply prod_congr rfl + intro psi hpsi + rw [norm_mul, AddChar.norm_apply, mul_one, + mul_div_mul_left _ _ (hu0 psi)] + _ = ∏ psi ∈ Delta, + (cosh ‖c psi‖ + (u psi * sinh ‖c psi‖ * psi x).re) := by + apply prod_congr rfl + intro psi hpsi + obtain hc | hc := eq_or_ne (c psi) 0 + · simp [hc] + simp only [huc, mul_left_comm (u psi), mul_div_cancel_left₀ _ hc, + ← Complex.re_mul_ofReal, mul_right_comm] + let q : AddChar G ℂ → ℝ := fun psi ↦ sinh ‖c psi‖ / cosh ‖c psi‖ + let v : AddChar G ℂ → ℂ := fun psi ↦ (q psi : ℂ) * u psi + have hfactor (x : G) : + (∏ psi ∈ Delta, + (cosh ‖c psi‖ + (u psi * sinh ‖c psi‖ * psi x).re)) = + (∏ psi ∈ Delta, cosh ‖c psi‖) * + (∏ psi ∈ Delta, + (1 + (v psi * psi x).re)) := by + rw [← Finset.prod_mul_distrib] + apply prod_congr rfl + intro psi hpsi + have hcosh : cosh ‖c psi‖ ≠ 0 := ne_of_gt (cosh_pos _) + have hsinh_re : + (u psi * (sinh ‖c psi‖ : ℂ) * psi x).re = + sinh ‖c psi‖ * (u psi * psi x).re := by + rw [show u psi * (sinh ‖c psi‖ : ℂ) * psi x = + (sinh ‖c psi‖ : ℂ) * (u psi * psi x) by ring] + exact Complex.re_ofReal_mul _ _ + have hv_re : (v psi * psi x).re = q psi * (u psi * psi x).re := by + rw [show v psi * psi x = (q psi : ℂ) * (u psi * psi x) by + simp [v]; ring] + exact Complex.re_ofReal_mul _ _ + rw [hsinh_re, hv_re] + dsimp [q] + field_simp + calc + ∑ x : G, mu x * exp ((∑ psi ∈ Delta, c psi * psi x).re) ≤ + ∑ x : G, mu x * ∏ psi ∈ Delta, + (cosh ‖c psi‖ + (u psi * sinh ‖c psi‖ * psi x).re) := by + apply sum_le_sum + intro x hx + exact mul_le_mul_of_nonneg_left (hpoint x) (hmu x) + _ = (∏ psi ∈ Delta, cosh ‖c psi‖) * + (∑ x : G, mu x * + ∏ psi ∈ Delta, + (1 + (v psi * psi x).re)) := by + rw [Finset.mul_sum] + apply sum_congr rfl + intro x hx + rw [hfactor] + ring + _ ≤ (∏ psi ∈ Delta, cosh ‖c psi‖) * exp K := by + gcongr + apply hDelta v + intro psi hpsi + have hq : |q psi| ≤ 1 := by + simpa [q, Real.tanh_eq_sinh_div_cosh] using (Real.abs_tanh_lt_one ‖c psi‖).le + simpa [v, norm_mul, hu psi, Complex.norm_real, Real.norm_eq_abs] using hq + _ ≤ exp ((∑ psi ∈ Delta, ‖c psi‖ ^ 2) / 2) * exp K := by + apply mul_le_mul_of_nonneg_right _ (exp_pos _).le + calc + ∏ psi ∈ Delta, cosh ‖c psi‖ ≤ + ∏ psi ∈ Delta, exp (‖c psi‖ ^ 2 / 2) := by + gcongr with psi hpsi + exact cosh_le_exp_half_sq _ + _ = exp ((∑ psi ∈ Delta, ‖c psi‖ ^ 2) / 2) := by + simp_rw [← exp_sum, ← sum_div] + _ = exp (K + (∑ psi ∈ Delta, ‖c psi‖ ^ 2) / 2) := by + rw [← exp_add] + congr 1 + ring + +end Erdos3.RelativeChangSanders + +end + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedSmoothSampledError.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedSmoothSampledError.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d95fb52423fb6f7d4f586ec96e6e5ac5c579e89 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedSmoothSampledError.lean @@ -0,0 +1,218 @@ +import OAI.Combinatorics.Progressions.Geometry.CoordinateFiberPatch + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem finite_mean_square_as_pair {T : Type*} [Fintype T] + (q : FiniteProbabilityWeights T) (f : T → ℝ) : + (q.mean f) ^ 2 = (q.prod q).mean (fun t => f t.1 * f t.2) := by + rw [FiniteProbabilityWeights.mean_prod] + simp only [q.mean_const_mul, q.mean_mul_const, pow_two] + +theorem sampled_second_moment_identity {Ω T : Type*} [Fintype Ω] [Fintype T] + (p : FiniteProbabilityWeights Ω) (q : FiniteProbabilityWeights T) (e : Ω → T → ℝ) : + p.mean (fun x => (q.mean (e x)) ^ 2) = + (q.prod q).mean (fun t => p.mean (fun x => e x t.1 * e x t.2)) := by + simp_rw [finite_mean_square_as_pair q] + exact p.mean_comm (q.prod q) (fun x t => e x t.1 * e x t.2) + +theorem finite_mean_bad_event_bound {X : Type*} [Fintype X] + (p : FiniteProbabilityWeights X) (Bad : X → Prop) (f : X → ℝ) {C epsilon : ℝ} + (hepsilon : 0 ≤ epsilon) (hbad : ∀ x, Bad x → f x ≤ C) + (hgood : ∀ x, ¬ Bad x → f x ≤ epsilon) : + p.mean f ≤ C * p.eventProbability Bad + epsilon := by + have hpoint (x : X) : f x ≤ C * (if Bad x then (1 : ℝ) else 0) + epsilon := by + by_cases hx : Bad x + · simp only [hx, ite_true, mul_one] + linarith [hbad x hx] + · simpa only [hx, ite_false, mul_zero, zero_add] using hgood x hx + apply (p.mean_mono hpoint).trans_eq + rw [p.mean_add, p.mean_const_mul, p.mean_const] + rfl + +theorem sampled_second_moment_bad_pairs {Ω T : Type*} [Fintype Ω] [Fintype T] + (p : FiniteProbabilityWeights Ω) (q : FiniteProbabilityWeights T) (e : Ω → T → ℝ) + (Bad : T × T → Prop) {C epsilon beta : ℝ} (hC : 0 ≤ C) (hepsilon : 0 ≤ epsilon) + (hmass : (q.prod q).eventProbability Bad ≤ beta) + (hbad : ∀ t, Bad t → |p.mean (fun x => e x t.1 * e x t.2)| ≤ C) + (hgood : ∀ t, ¬ Bad t → |p.mean (fun x => e x t.1 * e x t.2)| ≤ epsilon) : + p.mean (fun x => (q.mean (e x)) ^ 2) ≤ C * beta + epsilon := by + rw [sampled_second_moment_identity] + have h := finite_mean_bad_event_bound (q.prod q) Bad + (fun t => p.mean (fun x => e x t.1 * e x t.2)) hepsilon + (fun t ht => (le_abs_self _).trans (hbad t ht)) + (fun t ht => (le_abs_self _).trans (hgood t ht)) + have hm := mul_le_mul_of_nonneg_left hmass hC + linarith + +theorem sampled_weighted_error_of_bad_pairs {Ω T : Type*} [Fintype Ω] [Fintype T] + (p : FiniteProbabilityWeights Ω) (q : FiniteProbabilityWeights T) (e : Ω → T → ℝ) + (Bad : T × T → Prop) {C epsilon beta : ℝ} (hC : 0 ≤ C) (hepsilon : 0 ≤ epsilon) + (hmass : (q.prod q).eventProbability Bad ≤ beta) + (hbad : ∀ t, Bad t → |p.mean (fun x => e x t.1 * e x t.2)| ≤ C) + (hgood : ∀ t, ¬ Bad t → |p.mean (fun x => e x t.1 * e x t.2)| ≤ epsilon) + (w : Ω → ℝ) (hw : ∀ x, 0 ≤ w x ∧ w x ≤ 1) : + |p.mean (fun x => w x * q.mean (e x))| ≤ Real.sqrt (C * beta + epsilon) := by + have he := sampled_second_moment_bad_pairs p q e Bad hC hepsilon hmass hbad hgood + have hw2 : p.mean (fun x => w x ^ 2) ≤ 1 := by + apply (p.mean_mono (g := fun _ => 1) ?_).trans_eq (p.mean_const 1) + intro x + have h := hw x + nlinarith + have he0 := p.mean_nonneg (fun x => sq_nonneg (q.mean (e x))) + have hc := p.mean_mul_sq_le w (fun x => q.mean (e x)) + have hm := mul_le_mul_of_nonneg_right hw2 he0 + apply Real.le_sqrt_of_sq_le + rw [sq_abs] + nlinarith only [hc, hm, he] + +theorem sampled_pair_correlation_cap {Ω T : Type*} [Fintype Ω] + (p : FiniteProbabilityWeights Ω) (e : Ω → T → ℝ) {C : ℝ} (hC : 0 ≤ C) + (henergy : ∀ t, p.mean (fun x => e x t ^ 2) ≤ C) (t u : T) : + |p.mean (fun x => e x t * e x u)| ≤ C := by + apply abs_le_of_sq_le_sq _ hC + calc + _ ≤ p.mean (fun x => e x t ^ 2) * p.mean (fun x => e x u ^ 2) := + p.mean_mul_sq_le (fun x => e x t) (fun x => e x u) + _ ≤ C * C := mul_le_mul (henergy t) (henergy u) (p.mean_nonneg (fun x => sq_nonneg _)) hC + _ = C ^ 2 := by ring + +theorem sampled_weighted_error_of_energy {Ω T : Type*} [Fintype Ω] [Fintype T] + (p : FiniteProbabilityWeights Ω) (q : FiniteProbabilityWeights T) (e : Ω → T → ℝ) + (Bad : T × T → Prop) {C epsilon beta : ℝ} (hC : 0 ≤ C) (hepsilon : 0 ≤ epsilon) + (henergy : ∀ t, p.mean (fun x => e x t ^ 2) ≤ C) + (hmass : (q.prod q).eventProbability Bad ≤ beta) + (hgood : ∀ t, ¬ Bad t → |p.mean (fun x => e x t.1 * e x t.2)| ≤ epsilon) + (w : Ω → ℝ) (hw : ∀ x, 0 ≤ w x ∧ w x ≤ 1) : + |p.mean (fun x => w x * q.mean (e x))| ≤ Real.sqrt (C * beta + epsilon) := + sampled_weighted_error_of_bad_pairs p q e Bad hC hepsilon hmass + (fun t _ => sampled_pair_correlation_cap p e hC henergy t.1 t.2) hgood w hw + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem sampled_error_of_dominated_source {Ω P : Type*} [Fintype Ω] [Fintype P] + (p q : FiniteProbabilityWeights Ω) (r : FiniteProbabilityWeights P) + (e : Ω → P → ℝ) (Bad : P × P → Prop) {D C epsilon beta : ℝ} + (hD : 0 < D) (hdom : ∀ x, q.weight x ≤ D * p.weight x) + (hC : 0 ≤ C) (hepsilon : 0 ≤ epsilon) + (henergy : ∀ t, p.mean (fun x => e x t ^ 2) ≤ C) + (hmass : (r.prod r).eventProbability Bad ≤ beta) + (hgood : ∀ t, ¬ Bad t → |p.mean (fun x => e x t.1 * e x t.2)| ≤ epsilon) : + |q.mean (fun x => r.mean (e x))| ≤ D * Real.sqrt (C * beta + epsilon) := by + obtain ⟨w, hw, he⟩ := p.exists_bounded_change_of_measure q hD hdom + rw [he (fun x => r.mean (e x)), abs_mul, abs_of_pos hD] + exact mul_le_mul_of_nonneg_left + (sampled_weighted_error_of_energy p r e Bad hC hepsilon henergy hmass hgood w hw) hD.le + +theorem smooth_window_sampled_error {K I P : Type*} + [Fintype K] [Fintype I] [Fintype P] + (a S : Option K × I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hscale : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) + (W : Finset (Option K × I → ℤ)) + (hW : ∀ z ∈ W, ∀ i, |(z i : ℝ) - a i| ≤ S i / 2) + (q : FiniteProbabilityWeights P) (t : P → K → ℤ) + (T : Finset (I → ℤ)) (e : (I → ℤ) → ℝ) (he : ∀ y ∉ T, e y = 0) + {E epsilon beta : ℝ} (hE : 0 ≤ E) (hepsilon : 0 ≤ epsilon) + (henergy : (∑ y ∈ T, e y ^ 2) ≤ E * T.card) + (Bad : P × P → Prop) (hmass : (q.prod q).eventProbability Bad ≤ beta) + (hgood : ∀ u, ¬ Bad u → + |(smoothSourceFiniteWeights a S hS hZ).mean (fun z => + e (smoothAffineSample (t u.1) z.val) * e (smoothAffineSample (t u.2) z.val))| ≤ epsilon) : + |𝔼 z ∈ W, q.mean (fun u => e (smoothAffineSample (t u) z))| ≤ + ((3 : ℝ) ^ Fintype.card (Option K × I) * (∏ i, S i) / W.card) * + Real.sqrt (((∏ i, 2 / S (none, i)) * (E * T.card)) * beta + epsilon) := by + obtain ⟨w, hw, hchange⟩ := smooth_window_change_of_measure a S hS hZ hscale W hW + have hC : 0 ≤ (∏ i, 2 / S (none, i)) * (E * T.card) := by + apply mul_nonneg + · exact Finset.prod_nonneg (fun i _ => div_nonneg (by norm_num) (hS (none, i)).le) + · exact mul_nonneg hE (Nat.cast_nonneg _) + have hsample := sampled_weighted_error_of_energy (smoothSourceFiniteWeights a S hS hZ) q + (fun z u => e (smoothAffineSample (t u) z.val)) Bad hC hepsilon + (fun u => smoothSourceFiniteWeights_energy a S hS hZ (fun i => hscale (none, i)) + (t u) T e he henergy) hmass hgood w hw + have hfactor : 0 ≤ (3 : ℝ) ^ Fintype.card (Option K × I) * (∏ i, S i) / W.card := by + exact div_nonneg (mul_nonneg (by positivity) (Finset.prod_nonneg (fun i _ => (hS i).le))) + (Nat.cast_nonneg _) + rw [hchange (fun z => q.mean (fun u => e (smoothAffineSample (t u) z))), abs_mul, + abs_of_nonneg hfactor] + exact mul_le_mul_of_nonneg_left hsample hfactor + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem sampled_weighted_error_of_dominated_source {Ω P : Type*} [Fintype Ω] [Fintype P] + (p q : FiniteProbabilityWeights Ω) (r : FiniteProbabilityWeights P) + (e : Ω → P → ℝ) (Bad : P × P → Prop) {D C epsilon beta : ℝ} + (hD : 0 < D) (hdom : ∀ x, q.weight x ≤ D * p.weight x) + (hC : 0 ≤ C) (hepsilon : 0 ≤ epsilon) + (henergy : ∀ t, p.mean (fun x => e x t ^ 2) ≤ C) + (hmass : (r.prod r).eventProbability Bad ≤ beta) + (hgood : ∀ t, ¬ Bad t → |p.mean (fun x => e x t.1 * e x t.2)| ≤ epsilon) + (v : Ω → ℝ) (hv : ∀ x, 0 ≤ v x ∧ v x ≤ 1) : + |q.mean (fun x => v x * r.mean (e x))| ≤ D * Real.sqrt (C * beta + epsilon) := by + obtain ⟨w, hw, he⟩ := p.exists_bounded_change_of_measure q hD hdom + have hprod (x : Ω) : 0 ≤ w x * v x ∧ w x * v x ≤ 1 := + ⟨mul_nonneg (hw x).1 (hv x).1, (mul_le_mul (hw x).2 (hv x).2 (hv x).1 zero_le_one).trans_eq (one_mul 1)⟩ + have h := sampled_weighted_error_of_energy p r e Bad hC hepsilon henergy hmass hgood + (fun x => w x * v x) hprod + rw [he (fun x => v x * r.mean (e x)), abs_mul, abs_of_pos hD] + exact mul_le_mul_of_nonneg_left (by simpa only [mul_assoc] using h) hD.le + +theorem smooth_window_weighted_sampled_error {K I P : Type*} + [Fintype K] [Fintype I] [Fintype P] + (a S : Option K × I → ℝ) (hS : ∀ i, 0 < S i) (hZ : 0 < shiftedSmoothProductMass a S) + (hscale : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ S i) + (W : Finset (Option K × I → ℤ)) + (hW : ∀ z ∈ W, ∀ i, |(z i : ℝ) - a i| ≤ S i / 2) + (q : FiniteProbabilityWeights P) (t : P → K → ℤ) + (T : Finset (I → ℤ)) (e : (I → ℤ) → ℝ) (he : ∀ y ∉ T, e y = 0) + {E epsilon beta : ℝ} (hE : 0 ≤ E) (hepsilon : 0 ≤ epsilon) + (henergy : (∑ y ∈ T, e y ^ 2) ≤ E * T.card) + (Bad : P × P → Prop) (hmass : (q.prod q).eventProbability Bad ≤ beta) + (hgood : ∀ u, ¬ Bad u → |(smoothSourceFiniteWeights a S hS hZ).mean + (fun z => e (smoothAffineSample (t u.1) z.val) * e (smoothAffineSample (t u.2) z.val))| ≤ epsilon) + (v : (Option K × I → ℤ) → ℝ) (hv : ∀ z, 0 ≤ v z ∧ v z ≤ 1) : + |𝔼 z ∈ W, v z * q.mean (fun u => e (smoothAffineSample (t u) z))| ≤ + ((3 : ℝ) ^ Fintype.card (Option K × I) * (∏ i, S i) / W.card) * + Real.sqrt (((∏ i, 2 / S (none, i)) * (E * T.card)) * beta + epsilon) := by + obtain ⟨w, hw, hchange⟩ := smooth_window_change_of_measure a S hS hZ hscale W hW + have hC : 0 ≤ (∏ i, 2 / S (none, i)) * (E * T.card) := by + exact mul_nonneg (Finset.prod_nonneg (fun i _ => div_nonneg (by norm_num) (hS (none, i)).le)) + (mul_nonneg hE (Nat.cast_nonneg _)) + have hprod (z : rectangularWeightIndices a S 1) : 0 ≤ w z * v z.val ∧ w z * v z.val ≤ 1 := + ⟨mul_nonneg (hw z).1 (hv z.val).1, + (mul_le_mul (hw z).2 (hv z.val).2 (hv z.val).1 zero_le_one).trans_eq (one_mul 1)⟩ + have hsample := sampled_weighted_error_of_energy (smoothSourceFiniteWeights a S hS hZ) q + (fun z u => e (smoothAffineSample (t u) z.val)) Bad hC hepsilon + (fun u => smoothSourceFiniteWeights_energy a S hS hZ (fun i => hscale (none, i)) (t u) T e he henergy) + hmass hgood (fun z => w z * v z.val) hprod + have hfactor : 0 ≤ (3 : ℝ) ^ Fintype.card (Option K × I) * (∏ i, S i) / W.card := by + exact div_nonneg (mul_nonneg (by positivity) (Finset.prod_nonneg (fun i _ => (hS i).le))) (Nat.cast_nonneg _) + rw [hchange (fun z => v z * q.mean (fun u => e (smoothAffineSample (t u) z))), abs_mul, abs_of_nonneg hfactor] + exact mul_le_mul_of_nonneg_left (by simpa only [mul_assoc] using hsample) hfactor + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedSummandCorrelation.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedSummandCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..137d9cc386970e35f130a5be29cab8dbd5d313c3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedSummandCorrelation.lean @@ -0,0 +1,139 @@ +import OAI.Combinatorics.Progressions.Estimates.ComplexFiniteMeans + +namespace OAI + +section + +open scoped BigOperators + +namespace Erdos3 + +noncomputable def finiteCorrelation {Ω : Type*} (Q : Finset Ω) (f u : Ω → ℂ) : ℂ := + 𝔼 x ∈ Q, f x * star (u x) + +theorem finiteCorrelation_sub_right {Ω : Type*} (Q : Finset Ω) (f u v : Ω → ℂ) : + finiteCorrelation Q f (fun x => u x - v x) = + finiteCorrelation Q f u - finiteCorrelation Q f v := by + simp only [finiteCorrelation, star_sub, mul_sub, Finset.expect_sub_distrib] + +theorem finiteCorrelation_sum_right {Ω J : Type*} [Fintype J] + (Q : Finset Ω) (f : Ω → ℂ) (u : J → Ω → ℂ) : + finiteCorrelation Q f (fun x => ∑ j, u j x) = ∑ j, finiteCorrelation Q f (u j) := by + simp only [finiteCorrelation, star_sum, Finset.mul_sum, Finset.expect_sum_comm] + +theorem norm_finiteCorrelation_le {Ω : Type*} {Q : Finset Ω} (hQ : Q.Nonempty) + (f u : Ω → ℂ) {B : ℝ} (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) (hu : ∀ x ∈ Q, ‖u x‖ ≤ B) : + ‖finiteCorrelation Q f u‖ ≤ B := by + apply (RCLike.norm_expect_le (K := ℂ)).trans + apply (Finset.expect_le_expect _).trans_eq (Finset.expect_const hQ B) + intro x hx + simpa only [norm_mul, norm_star, one_mul] using + mul_le_mul (hf x hx) (hu x hx) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) + +theorem norm_finiteCorrelation_sub_le {Ω : Type*} {Q : Finset Ω} (hQ : Q.Nonempty) + (f u v : Ω → ℂ) {δ : ℝ} (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) + (huv : ∀ x ∈ Q, ‖u x - v x‖ ≤ δ) : + ‖finiteCorrelation Q f u - finiteCorrelation Q f v‖ ≤ δ := by + rw [← finiteCorrelation_sub_right] + exact norm_finiteCorrelation_le hQ f _ hf huv + +theorem exists_correlating_summand {Ω J : Type*} [Fintype J] + {Q : Finset Ω} (hQ : Q.Nonempty) (f u : Ω → ℂ) (v : J → Ω → ℂ) + {ρ M : ℝ} (hρ : 0 < ρ) (hM : 0 < M) (hcard : (Fintype.card J : ℝ) ≤ M) + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) + (happrox : ∀ x ∈ Q, ‖(∑ j, v j x) - u x‖ ≤ ρ / 2) + (hcorr : ρ ≤ ‖finiteCorrelation Q f u‖) : + ∃ j, ρ / (2 * M) ≤ ‖finiteCorrelation Q f (v j)‖ := by + classical + have herr := norm_finiteCorrelation_sub_le hQ f (fun x => ∑ j, v j x) u hf happrox + rw [finiteCorrelation_sum_right] at herr + have htriangle := norm_le_norm_add_norm_sub + (∑ j, finiteCorrelation Q f (v j)) (finiteCorrelation Q f u) + have hsum : ρ / 2 ≤ ∑ j, ‖finiteCorrelation Q f (v j)‖ := by + have hn := norm_sum_le (Finset.univ : Finset J) (fun j => finiteCorrelation Q f (v j)) + linarith + have hJ : (Finset.univ : Finset J).Nonempty := by + by_contra he + rw [Finset.not_nonempty_iff_eq_empty.mp he, Finset.sum_empty] at hsum + linarith + have hthreshold : 0 ≤ ρ / (2 * M) := le_of_lt (div_pos hρ (by positivity)) + have hconstants : (∑ _j : J, ρ / (2 * M)) ≤ ρ / 2 := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + calc + _ ≤ M * (ρ / (2 * M)) := mul_le_mul_of_nonneg_right hcard hthreshold + _ = ρ / 2 := by field_simp + obtain ⟨j, _, hj⟩ := Finset.exists_le_of_sum_le hJ (hconstants.trans hsum) + exact ⟨j, hj⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def finiteSiteExtension {T X : Type*} [Nonempty T] + (e : T → X) (f : T → ℂ) : X → ℂ := fun x => f (Function.invFun e x) + +theorem finiteSiteExtension_apply {T X : Type*} [Nonempty T] + (e : T → X) (he : Function.Injective e) (f : T → ℂ) (t : T) : + finiteSiteExtension e f (e t) = f t := by + rw [finiteSiteExtension, Function.leftInverse_invFun he t] + +theorem finiteSiteExtension_norm_le {T X : Type*} [Nonempty T] + (e : T → X) (f : T → ℂ) {B : ℝ} (hf : ∀ t, ‖f t‖ ≤ B) (x : X) : + ‖finiteSiteExtension e f x‖ ≤ B := hf _ + +theorem finiteSiteExtension_test_mean {T X : Type*} [Nonempty T] [DecidableEq X] + (e : T → X) (he : Function.Injective e) (A : Finset T) + (f w : T → ℂ) (ψ : X → ℂ) (hw : ∀ t ∈ A, w t = star (ψ (e t))) : + (𝔼 t ∈ A, f t * w t) = finiteCorrelation (A.image e) (finiteSiteExtension e f) ψ := by + unfold finiteCorrelation + rw [Finset.expect_image he.injOn] + apply Finset.expect_congr rfl + intro t ht + rw [finiteSiteExtension_apply e he, hw t ht] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_correlating_weighted_summand {Ω J : Type*} [Fintype J] + {Q : Finset Ω} (hQ : Q.Nonempty) (f u : Ω → ℂ) (v : J → Ω → ℂ) (c : J → ℂ) + {ρ M B : ℝ} (hρ : 0 < ρ) (hM : 0 < M) (hB : 0 < B) + (hcard : (Fintype.card J : ℝ) ≤ M) (hc : ∀ j, ‖c j‖ ≤ B) + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) + (happrox : ∀ x ∈ Q, ‖(∑ j, c j * v j x) - u x‖ ≤ ρ / 2) + (hcorr : ρ ≤ ‖finiteCorrelation Q f u‖) : + ∃ j, ρ / (2 * M * B) ≤ ‖finiteCorrelation Q f (v j)‖ := by + obtain ⟨j, hj⟩ := exists_correlating_summand hQ f u (fun j x => c j * v j x) + hρ hM hcard hf happrox hcorr + have heq : finiteCorrelation Q f (fun x => c j * v j x) = + star (c j) * finiteCorrelation Q f (v j) := by + unfold finiteCorrelation + rw [Finset.mul_expect] + apply Finset.expect_congr rfl + intro x _ + simp only [star_mul] + ring + rw [heq, norm_mul, norm_star] at hj + refine ⟨j, ?_⟩ + rw [← div_div] + apply (div_le_iff₀ hB).mpr + simpa only [mul_comm] using hj.trans + (mul_le_mul_of_nonneg_right (hc j) (norm_nonneg _)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTestComparison.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTestComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0cf75b95dc21c1491e98a13663603ef37ad2482 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTestComparison.lean @@ -0,0 +1,39 @@ +import Mathlib.MeasureTheory.Integral.Bochner.Basic +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +theorem bounded_test_comparison_weighted {X X' Y : Type*} + [MeasurableSpace X] [MeasurableSpace X'] [MeasurableSpace Y] + (μ : Measure X) (ν : Measure X') (F : X → Y) (G : X' → Y) {ε : ℝ} + (hcompare : ∀ f : Y → ℝ, Measurable f → (∀ y, ‖f y‖ ≤ 1) → + |(∫ x, f (F x) ∂μ) - ∫ x, f (G x) ∂ν| ≤ ε) + (w : Y → ℝ) (hw : Measurable w) {B : ℝ} (hB : 0 ≤ B) (hcap : ∀ y, ‖w y‖ ≤ B) + (f : Y → ℝ) (hf : Measurable f) (hbound : ∀ y, ‖f y‖ ≤ 1) : + |(∫ x, w (F x) * f (F x) ∂μ) - ∫ x, w (G x) * f (G x) ∂ν| ≤ B * ε := by + by_cases hB0 : B = 0 + · have hw0 : w = 0 := by + funext y + exact norm_eq_zero.mp (le_antisymm (by simpa only [hB0] using hcap y) (norm_nonneg _)) + simp [hB0, hw0] + have hBpos : 0 < B := lt_of_le_of_ne hB (Ne.symm hB0) + have hnorm (y : Y) : ‖w y * f y / B‖ ≤ 1 := by + rw [norm_div, norm_mul, Real.norm_eq_abs B, abs_of_pos hBpos] + apply (div_le_one hBpos).mpr + simpa only [mul_one] using mul_le_mul (hcap y) (hbound y) (norm_nonneg _) hB + have he := hcompare (fun y => w y * f y / B) ((hw.mul hf).div_const B) hnorm + simp only [integral_div] at he + rw [← sub_div, abs_div, abs_of_pos hBpos] at he + simpa only [mul_comm] using (div_le_iff₀ hBpos).mp he + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationAssociatedGraded.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationAssociatedGraded.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c45b8f04f3cc00fa7efdafb1b82860d70c4e2f7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationAssociatedGraded.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Nilpotent.CurrentBracketInductionStep + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration +open Module + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +noncomputable def homogeneousAssociatedGradedEquiv + (hb : BasisHomogeneousBrackets b ω) : F.AssociatedGraded ≃ₗ⁅ℚ⁆ L := + { (F.associatedGradedBasis b ω hF).repr.trans b.repr.symm with + map_lie' {x y} := by + let f := (F.associatedGradedBasis b ω hF).repr.trans b.repr.symm + change f ⁅x, y⁆ = ⁅f x, f y⁆ + apply linear_map_lie_of_basis (F.associatedGradedBasis b ω hF) f.toLinearMap + intro i j + apply b.repr.injective + ext k + have hf (z : F.AssociatedGraded) : b.repr (f z) = + (F.associatedGradedBasis b ω hF).repr z := b.repr.apply_symm_apply _ + have hbi (a : ι) : f (F.associatedGradedBasis b ω hF a) = b a := by + apply b.repr.injective + rw [hf] + simp only [Basis.repr_self] + change b.repr (f ⁅F.associatedGradedBasis b ω hF i, F.associatedGradedBasis b ω hF j⁆) k = + b.repr ⁅f (F.associatedGradedBasis b ω hF i), f (F.associatedGradedBasis b ω hF j)⁆ k + rw [hf, hbi, hbi, F.associatedGradedBasis_bracket] + by_cases h : ω i + ω j = ω k + · simp only [h, ite_true] + · rw [ite_eq_right h, hb i j k (Ne.symm h)] } + +@[simp] theorem homogeneousAssociatedGradedEquiv_repr + (hb : BasisHomogeneousBrackets b ω) (x : F.AssociatedGraded) (i : ι) : + b.repr (F.homogeneousAssociatedGradedEquiv b ω hF hb x) i = + (F.associatedGradedBasis b ω hF).repr x i := by + exact congrArg (fun z : ι →₀ ℚ => z i) (b.repr.apply_symm_apply _) + +@[simp] theorem homogeneousAssociatedGradedEquiv_basis + (hb : BasisHomogeneousBrackets b ω) (i : ι) : + F.homogeneousAssociatedGradedEquiv b ω hF hb (F.associatedGradedBasis b ω hF i) = b i := by + apply b.repr.injective + ext k + rw [homogeneousAssociatedGradedEquiv_repr] + simp only [Basis.repr_self] + +end Erdos3.NilpotentLieFiltration + +namespace Erdos3.PolynomialTranslationLie +open Module +variable {σ : Type*} [Fintype σ] + +noncomputable def weightedAssociatedGradedEquiv (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) : + (weightedFiltration w d hwd).AssociatedGraded ≃ₗ⁅ℚ⁆ weightedSubalgebra w d := + (weightedFiltration w d hwd).homogeneousAssociatedGradedEquiv + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) + (weightedBasis_homogeneous_brackets w d hw) + +@[simp] theorem weightedAssociatedGradedEquiv_repr (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (x : (weightedFiltration w d hwd).AssociatedGraded) (i : WeightedBasisIndex w d) : + (weightedBasis w d hw).repr (weightedAssociatedGradedEquiv w d hw hwd x) i = + ((weightedFiltration w d hwd).associatedGradedBasis (weightedBasis w d hw) + (weightedBasisGrade w d) (weightedFiltration_layer_eq_span w d hw hwd)).repr x i := + (weightedFiltration w d hwd).homogeneousAssociatedGradedEquiv_repr _ _ _ _ x i + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationBaseGrading.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationBaseGrading.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6e7c4c10703e6ed023a553e581ae74a279bdc7c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationBaseGrading.lean @@ -0,0 +1,305 @@ +import OAI.Combinatorics.Progressions.Linear.RealCoordinateImageSpan + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial +variable {σ τ : Type*} [Fintype σ] [Fintype τ] + +noncomputable def baseLinear : PolynomialTranslationLie σ →ₗ[ℚ] (σ → ℚ) where + toFun x := x.base + map_add' _ _ := rfl + map_smul' _ _ := rfl + +noncomputable def baseRange (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) : + LieSubalgebra ℚ (PolynomialTranslationLie σ) := + { A.range.comap baseLinear with + lie_mem' := by + intro x y _ _ + change (0 : σ → ℚ) ∈ A.range + exact Submodule.zero_mem _ } + +omit [Fintype τ] in +@[simp] theorem mem_baseRange (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) + (x : PolynomialTranslationLie σ) : x ∈ baseRange A ↔ x.base ∈ A.range := Iff.rfl + +noncomputable def baseRangeBase (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) : + baseRange A →ₗ[ℚ] A.range where + toFun x := ⟨x.val.base, x.property⟩ + map_add' _ _ := rfl + map_smul' _ _ := rfl + +noncomputable def projectedBaseCoordinates (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) + (hA : Function.Injective A) : baseRange A →ₗ[ℚ] (τ → ℚ) := + (LinearEquiv.ofInjective A hA).symm.toLinearMap.comp (baseRangeBase A) + +omit [Fintype τ] in +@[simp] theorem apply_projectedBaseCoordinates (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) + (hA : Function.Injective A) (x : baseRange A) : + A (projectedBaseCoordinates A hA x) = x.val.base := by + exact congrArg Subtype.val ((LinearEquiv.ofInjective A hA).apply_symm_apply + ⟨x.val.base, x.property⟩) + +noncomputable def projectedRestriction (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) + (hA : Function.Injective A) : baseRange A →ₗ⁅ℚ⁆ PolynomialTranslationLie τ where + toFun x := ⟨projectedBaseCoordinates A hA x, polynomialLinearRestriction A x.val.polynomial⟩ + map_add' x y := by + apply PolynomialTranslationLie.ext + · exact map_add _ _ _ + · exact map_add _ _ _ + map_smul' r x := by + apply PolynomialTranslationLie.ext + · exact map_smul _ _ _ + · exact map_smul _ _ _ + map_lie' := by + intro x y + apply PolynomialTranslationLie.ext + · apply hA + rw [apply_projectedBaseCoordinates] + change (0 : σ → ℚ) = A 0 + exact (map_zero A).symm + · change polynomialLinearRestriction A (scalarDirectionalDerivative x.val.base y.val.polynomial - + scalarDirectionalDerivative y.val.base x.val.polynomial) = + scalarDirectionalDerivative (projectedBaseCoordinates A hA x) + (polynomialLinearRestriction A y.val.polynomial) - + scalarDirectionalDerivative (projectedBaseCoordinates A hA y) + (polynomialLinearRestriction A x.val.polynomial) + rw [map_sub, scalarDirectionalDerivative_linearRestriction, + scalarDirectionalDerivative_linearRestriction, + apply_projectedBaseCoordinates, apply_projectedBaseCoordinates] + +@[simp] theorem projectedRestriction_base (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) + (hA : Function.Injective A) (x : baseRange A) : + (projectedRestriction A hA x).base = projectedBaseCoordinates A hA x := rfl + +@[simp] theorem projectedRestriction_polynomial (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) + (hA : Function.Injective A) (x : baseRange A) : + (projectedRestriction A hA x).polynomial = polynomialLinearRestriction A x.val.polynomial := rfl + +theorem projectedRestriction_base_surjective + (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) (hA : Function.Injective A) + (U : LieSubalgebra ℚ (baseRange A)) + (hbase : ∀ z : τ → ℚ, ∃ x ∈ U, x.val.base = A z) : + ∀ z : τ → ℚ, ∃ x ∈ U.map (projectedRestriction A hA), x.base = z := by + intro z + obtain ⟨x,hx,hxz⟩ := hbase z + refine ⟨projectedRestriction A hA x, ⟨x,hx,rfl⟩, ?_⟩ + apply hA + rw [projectedRestriction_base, apply_projectedBaseCoordinates, hxz] + +theorem projectedRestriction_eq_zero_iff + (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) (hA : Function.Injective A) (x : baseRange A) : + projectedRestriction A hA x = 0 ↔ + x.val.base = 0 ∧ polynomialLinearRestriction A x.val.polynomial = 0 := by + constructor + · intro hx + have hb : projectedBaseCoordinates A hA x = 0 := congrArg PolynomialTranslationLie.base hx + refine ⟨?_, congrArg PolynomialTranslationLie.polynomial hx⟩ + rw [← apply_projectedBaseCoordinates A hA x, hb, map_zero] + · rintro ⟨hb,hp⟩ + apply PolynomialTranslationLie.ext + · apply hA + rw [projectedRestriction_base, apply_projectedBaseCoordinates, hb, base_zero, map_zero] + · exact hp + +theorem eval_projectedRestriction + (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) (hA : Function.Injective A) + (x : baseRange A) (z : τ → ℚ) : + eval z (projectedRestriction A hA x).polynomial = eval (A z) x.val.polynomial := + eval_polynomialLinearRestriction A z x.val.polynomial + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial + +variable {σ τ : Type*} [Fintype σ] [Fintype τ] [DecidableEq τ] + +theorem projectedRestriction_mem_weightedLayer + (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) (hA : Function.Injective A) + (v : τ → ℕ) (w : σ → ℕ) + (hweight : ∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0) + (d j : ℕ) (x : baseRange A) (hx : x.val ∈ weightedLayer w d j) : + projectedRestriction A hA x ∈ weightedLayer v d j := by + constructor + · apply linearMap_reflects_weighted_base_layer A v w hweight hA j + rw [projectedRestriction_base, apply_projectedBaseCoordinates] + exact hx.1 + · exact polynomialLinearRestriction_mem_weightedSupportDrop A v w hweight hx.2 + +theorem projectedRestriction_mem_weightedSubalgebra + (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) (hA : Function.Injective A) + (v : τ → ℕ) (w : σ → ℕ) + (hweight : ∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0) + (d : ℕ) (x : baseRange A) (hx : x.val ∈ weightedSubalgebra w d) : + projectedRestriction A hA x ∈ weightedSubalgebra v d := + projectedRestriction_mem_weightedLayer A hA v w hweight d 1 x hx + +theorem weightedBasis_projection_mem_baseRange + (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) (v : τ → ℕ) (w : σ → ℕ) + (hweight : ∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0) + (d j : ℕ) (hw : ∀ i, 0 < w i) (x : weightedSubalgebra w d) + (hx : x.val ∈ baseRange A) : + (basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j x).val ∈ + baseRange A := by + obtain ⟨z, hz⟩ := hx + refine ⟨fun k => if v k = j then z k else 0, ?_⟩ + rw [linearMap_coordinateGradeProjection A v w hweight, hz] + funext i + exact (weightedBasis_projection_base w d j hw x i).symm + +theorem projectedBaseCoordinates_basisGradeProjection + (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) (hA : Function.Injective A) + (v : τ → ℕ) (w : σ → ℕ) + (hweight : ∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0) + (d j : ℕ) (hw : ∀ i, 0 < w i) (x : weightedSubalgebra w d) + (hx : x.val ∈ baseRange A) : + projectedBaseCoordinates A hA + ⟨(basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j x).val, + weightedBasis_projection_mem_baseRange A v w hweight d j hw x hx⟩ = + fun k => if v k = j then projectedBaseCoordinates A hA ⟨x.val, hx⟩ k else 0 := by + apply hA + rw [apply_projectedBaseCoordinates, linearMap_coordinateGradeProjection A v w hweight, + apply_projectedBaseCoordinates] + funext i + exact weightedBasis_projection_base w d j hw x i + +theorem projectedRestriction_basisGradeProjection + (A : (τ → ℚ) →ₗ[ℚ] (σ → ℚ)) (hA : Function.Injective A) + (v : τ → ℕ) (w : σ → ℕ) + (hweight : ∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0) + (d j : ℕ) (hw : ∀ i, 0 < w i) (hv : ∀ i, 0 < v i) + (hwd : ∀ i, w i ≤ d) (hvd : ∀ i, v i ≤ d) + (x : weightedSubalgebra w d) (hx : x.val ∈ baseRange A) : + projectedRestriction A hA + ⟨(basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j x).val, + weightedBasis_projection_mem_baseRange A v w hweight d j hw x hx⟩ = + (basisGradeProjection (weightedBasis v d hv) (weightedBasisGrade v d) j + ⟨projectedRestriction A hA ⟨x.val, hx⟩, + projectedRestriction_mem_weightedSubalgebra A hA v w hweight d + ⟨x.val, hx⟩ x.property⟩).val := by + apply PolynomialTranslationLie.ext + · rw [projectedRestriction_base, + projectedBaseCoordinates_basisGradeProjection A hA v w hweight d j hw x hx] + funext i + symm + exact weightedBasis_projection_base v d j hv _ i + · rw [projectedRestriction_polynomial] + dsimp only + by_cases hj : j ≤ d + · rw [weightedBasis_projection_polynomial_eq_component w d j hw hj, + weightedBasis_projection_polynomial_eq_component v d j hv hj, + polynomialLinearRestriction_weightedHomogeneousComponent A v w hweight] + rfl + · rw [weightedBasis_projection_eq_zero_of_lt w d j hw hwd (by omega), + weightedBasis_projection_eq_zero_of_lt v d j hv hvd (by omega)] + exact map_zero _ + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open Module +open scoped TensorProduct + +variable {B : Type*} [Fintype B] + +theorem weightedTranslationBase_projection + (w : B → ℕ) (d j : ℕ) (hw : ∀ i, 0 < w i) + (x : weightedSubalgebra w d) : + (baseLinear.comp (weightedSubalgebra w d).subtype) + (basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j x) = + basisGradeProjection (Pi.basisFun ℚ B) w j x.val.base := by + funext i + have h := basisGradeProjection_repr (Pi.basisFun ℚ B) w j x.val.base i + simp only [Pi.basisFun_repr] at h + change (basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j x).val.base i = _ + rw [weightedBasis_projection_base] + exact h.symm + +theorem weightedTranslationBase_image_graded + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (U : Submodule ℚ (weightedSubalgebra w d)) + (hU : BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) U) : + BasisGradedSubmodule (Pi.basisFun ℚ B) w + (U.map (baseLinear.comp (weightedSubalgebra w d).subtype)) := by + intro j y hy + obtain ⟨x, hx, rfl⟩ := hy + refine ⟨basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j x, + hU j x hx, ?_⟩ + exact weightedTranslationBase_projection w d j hw x + +theorem weightedTranslationBase_mask_mem + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (U : Submodule ℚ (weightedSubalgebra w d)) + (hU : BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) U) + (j : ℕ) (x : B → ℚ) + (hx : x ∈ U.map (baseLinear.comp (weightedSubalgebra w d).subtype)) : + (fun i => if w i = j then x i else 0) ∈ + U.map (baseLinear.comp (weightedSubalgebra w d).subtype) := by + have h := weightedTranslationBase_image_graded w d hw U hU j x hx + have he : basisGradeProjection (Pi.basisFun ℚ B) w j x = + (fun i => if w i = j then x i else 0) := by + funext i + simpa only [Pi.basisFun_repr] using + basisGradeProjection_repr (Pi.basisFun ℚ B) w j x i + rwa [he] at h + +theorem weightedTranslationBase_real_image_graded + {J : Type*} (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (U : Submodule ℚ (weightedSubalgebra w d)) + (hU : BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) U) + (g : J → weightedSubalgebra w d) (hg : Submodule.span ℚ (Set.range g) = U) : + BasisGradedSubmodule (Pi.basisFun ℝ B) w + ((U.baseChange ℝ).map + (realifyCoordinateMap (baseLinear.comp (weightedSubalgebra w d).subtype))) := by + let ℓ := baseLinear.comp (weightedSubalgebra w d).subtype + rw [realifyCoordinateMap_image_eq_span U g hg ℓ] + intro j z hz + let K := Submodule.span ℝ (Set.range (fun a i => ((g a).val.base i : ℝ))) + change basisGradeProjection (Pi.basisFun ℝ B) w j z ∈ K + induction hz using Submodule.span_induction with + | mem z hz => + obtain ⟨a, rfl⟩ := hz + have hga : g a ∈ U := by rw [← hg]; exact Submodule.subset_span ⟨a, rfl⟩ + have hproj := hU j (g a) hga + have ht := Submodule.tmul_mem_baseChange_of_mem (1 : ℝ) hproj + have hm := realifyCoordinateMap_mem_span U g hg ℓ ht + change _ ∈ K at hm + convert hm using 1 + funext i + have hp := basisGradeProjection_repr (Pi.basisFun ℝ B) w j + (fun i => ((g a).val.base i : ℝ)) i + simp only [Pi.basisFun_repr] at hp + change (basisGradeProjection (Pi.basisFun ℝ B) w j + (fun i => ((g a).val.base i : ℝ))) i = _ + rw [hp, realifyCoordinateMap_tmul, one_mul] + change (if w i = j then ((g a).val.base i : ℝ) else 0) = + ((basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j (g a)).val.base i : ℝ) + rw [weightedBasis_projection_base] + split_ifs <;> simp + | zero => simpa only [map_zero] using K.zero_mem + | add x y hx hy hxp hyp => + rw [map_add] + exact K.add_mem hxp hyp + | smul c x hx hxp => + rw [map_smul] + exact K.smul_mem c hxp + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationCentralCircleAction.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationCentralCircleAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8d96e78e6e011687037bb75c9eeba84e7874660 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationCentralCircleAction.lean @@ -0,0 +1,56 @@ +import OAI.Combinatorics.Progressions.Lattices.WeightedTranslationCentralLattice + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +variable {σ : Type*} [Fintype σ] + (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hd : 0 < d) + (hwd : ∀ i, w i ≤ d) [Fintype (WeightedBasisIndex w d)] + +theorem centralRealLine_periodic + (x : (weightedTranslationNilmanifold w d hw hwd).Space) : + Function.Periodic (fun t => centralRealLine w d hw hd hwd t • x) 1 := by + intro t + simpa only [Int.cast_one] using centralRealLine_add_int_smul w d hw hd hwd t 1 x + +noncomputable def centralCircleAct (t : CircleFourier.Circle) + (x : (weightedTranslationNilmanifold w d hw hwd).Space) : + (weightedTranslationNilmanifold w d hw hwd).Space := + CircleFourier.periodicFlowAct (fun r x => centralRealLine w d hw hd hwd r • x) + (centralRealLine_periodic w d hw hd hwd) t x + +@[simp] theorem centralCircleAct_coe (t : ℝ) + (x : (weightedTranslationNilmanifold w d hw hwd).Space) : + centralCircleAct w d hw hd hwd (t : CircleFourier.Circle) x = + centralRealLine w d hw hd hwd t • x := + CircleFourier.periodicFlowAct_coe _ _ t x + +@[simp] theorem centralCircleAct_zero + (x : (weightedTranslationNilmanifold w d hw hwd).Space) : + centralCircleAct w d hw hd hwd 0 x = x := by + apply CircleFourier.periodicFlowAct_zero + intro y + rw [centralRealLine_zero, one_smul] + +theorem centralCircleAct_add (t u : CircleFourier.Circle) + (x : (weightedTranslationNilmanifold w d hw hwd).Space) : + centralCircleAct w d hw hd hwd (t + u) x = + centralCircleAct w d hw hd hwd t (centralCircleAct w d hw hd hwd u x) := by + apply CircleFourier.periodicFlowAct_add + intro r s y + rw [centralRealLine_add, mul_smul] + +@[instance_reducible] noncomputable def centralCircleAddAction : + AddAction CircleFourier.Circle (weightedTranslationNilmanifold w d hw hwd).Space where + vadd := centralCircleAct w d hw hd hwd + zero_vadd := centralCircleAct_zero w d hw hd hwd + add_vadd := centralCircleAct_add w d hw hd hwd + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationCentralTop.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationCentralTop.lean new file mode 100644 index 0000000000000000000000000000000000000000..262731e228d2bc895a6972b366d516adc0b66d88 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationCentralTop.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Lattices.WeightedTranslationCentralLattice + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie +open MvPolynomial Module +open scoped TensorProduct + +variable {σ : Type*} [Fintype σ] + +@[simp] theorem centralRealLine_coord (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) (t : ℝ) : + (centralRealLine w d hw hd hwd t).coord = + t ⊗ₜ[ℚ] centralRationalElement w d hd 1 := by + classical + apply ((weightedBasis w d hw).baseChange ℝ).repr.injective + ext a + change ((weightedBasis w d hw).baseChange ℝ).repr + (polynomialRealElement w d hw (centralConstantPolynomial w d hd t)) a = _ + rw [polynomialRealElement_repr, Basis.baseChange_repr_tmul] + cases a with + | inl i => simp [weightedBasis_repr_inl, centralRationalElement] + | inr a => + simp only [Sum.elim_inr, centralConstantPolynomial, weightedBasis_repr_inr, + centralRationalElement, coeff_C] + split_ifs <;> simp + + theorem centralRationalElement_mem_top (w : σ → ℕ) (d : ℕ) (hd : 0 < d) + (hwd : ∀ i, w i ≤ d) (q : ℚ) : + centralRationalElement w d hd q ∈ (weightedFiltration w d hwd).layer d := by + refine ⟨fun i hi => rfl, ?_⟩ + exact (monomial_mem_restrictSupport ℚ).mpr (Or.inl (by simp)) + + theorem centralRealLine_mem_top (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) (t : ℝ) : + centralRealLine w d hw hd hwd t ∈ + (weightedFiltration w d hwd).realification.subgroup d := by + change (centralRealLine w d hw hd hwd t).coord ∈ + (weightedFiltration w d hwd).realLayer d + rw [centralRealLine_coord] + exact LieSubmodule.tmul_mem_baseChange_of_mem t + (centralRationalElement_mem_top w d hd hwd 1) + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationRealPureFactors.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationRealPureFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..f687838d06deb666645bf2fcc673b36886bd1738 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationRealPureFactors.lean @@ -0,0 +1,148 @@ +import OAI.Combinatorics.Progressions.Geometry.WeightedTranslationBufferedCoordinates + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module +open scoped TensorProduct + +variable {σ : Type*} [Fintype σ] + +noncomputable def baseRealElement (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (b : σ → ℝ) : ℝ ⊗[ℚ] weightedSubalgebra w d := by + letI := weightedBasisIndex_finite w d hw + exact ((weightedBasis w d hw).baseChange ℝ).equivFun.symm (Sum.elim b (fun _ => 0)) + +noncomputable def polynomialRealElement (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (P : weightedSupportLT (R := ℝ) w d) : ℝ ⊗[ℚ] weightedSubalgebra w d := by + letI := weightedBasisIndex_finite w d hw + exact ((weightedBasis w d hw).baseChange ℝ).equivFun.symm + (Sum.elim (fun _ => 0) (fun a => P.val.coeff a.val)) + +@[simp] theorem baseRealElement_repr (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (b : σ → ℝ) (a : WeightedBasisIndex w d) : + ((weightedBasis w d hw).baseChange ℝ).repr (baseRealElement w d hw b) a = + Sum.elim b (fun _ => 0) a := by + let := weightedBasisIndex_finite w d hw + exact congrFun (((weightedBasis w d hw).baseChange ℝ).equivFun.apply_symm_apply _) a + +@[simp] theorem polynomialRealElement_repr (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (P : weightedSupportLT (R := ℝ) w d) (a : WeightedBasisIndex w d) : + ((weightedBasis w d hw).baseChange ℝ).repr (polynomialRealElement w d hw P) a = + Sum.elim (fun _ => 0) (fun a => P.val.coeff a.val) a := by + let := weightedBasisIndex_finite w d hw + exact congrFun (((weightedBasis w d hw).baseChange ℝ).equivFun.apply_symm_apply _) a + +theorem realShearEmbedding_base_coeff (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (x : ℝ ⊗[ℚ] weightedSubalgebra w d) (i : σ) : + ((realShearEmbedding w d x).val (X (Sum.inl i))).coeff 0 = + ((weightedBasis w d hw).baseChange ℝ).repr x (Sum.inl i) := by + let a : PolynomialShearIndex (shearWeight w d) := ⟨Sum.inl i, 0, by + change Finsupp.weight (shearWeight w d) 0 + 1 ≤ w i + simpa using Nat.succ_le_of_lt (hw i)⟩ + change (polynomialShearBasis (R := ℝ) (shearWeight w d)).repr (realShearEmbedding w d x) a = _ + rw [realShearEmbedding_repr] + apply realificationLieHom_repr_coordinate (weightedBasis w d hw) _ _ a (Sum.inl i) _ x + intro y + rw [polynomialShearBasis_repr, weightedBasis_repr_inl] + change (shearDerivation y.val (X (Sum.inl i))).coeff 0 = _ + rw [shearDerivation_X_inl] + simp + +theorem realShearEmbedding_extra_coeff (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (x : ℝ ⊗[ℚ] weightedSubalgebra w d) + (a : {a : σ →₀ ℕ | Finsupp.weight w a < d}) : + ((realShearEmbedding w d x).val (X (Sum.inr ()))).coeff (a.val.mapDomain Sum.inl) = + ((weightedBasis w d hw).baseChange ℝ).repr x (Sum.inr a) := by + have hweight : Finsupp.weight (shearWeight w d) (a.val.mapDomain Sum.inl) = + Finsupp.weight w a.val := by + change Finsupp.linearCombination ℕ (shearWeight w d) (a.val.mapDomain Sum.inl) = _ + rw [Finsupp.linearCombination_mapDomain] + rfl + let j : PolynomialShearIndex (shearWeight w d) := ⟨Sum.inr (), a.val.mapDomain Sum.inl, by + change Finsupp.weight (shearWeight w d) (a.val.mapDomain Sum.inl) + 1 ≤ d + rw [hweight] + exact a.property⟩ + change (polynomialShearBasis (R := ℝ) (shearWeight w d)).repr (realShearEmbedding w d x) j = _ + rw [realShearEmbedding_repr] + apply realificationLieHom_repr_coordinate (weightedBasis w d hw) _ _ j (Sum.inr a) _ x + intro y + rw [polynomialShearBasis_repr, weightedBasis_repr_inr] + change (shearDerivation y.val (X (Sum.inr ()))).coeff (a.val.mapDomain Sum.inl) = _ + rw [shearDerivation_X_inr, coeff_rename_mapDomain Sum.inl Sum.inl_injective] + +theorem realShearEmbedding_polynomial_mem (w : σ → ℕ) (d : ℕ) + (x : ℝ ⊗[ℚ] weightedSubalgebra w d) (P : MvPolynomial σ ℝ) + (hP : (realShearEmbedding w d x).val (X (Sum.inr ())) = rename Sum.inl P) : + P ∈ weightedSupportLT w d := by + intro a ha + have hcoeff : ((realShearEmbedding w d x).val (X (Sum.inr ()))).coeff + (a.mapDomain Sum.inl) ≠ 0 := by + rw [hP, coeff_rename_mapDomain Sum.inl Sum.inl_injective] + exact MvPolynomial.mem_support_iff.mp ha + have h := (realShearEmbedding w d x).property (Sum.inr ()) + (MvPolynomial.mem_support_iff.mpr hcoeff) + change Finsupp.weight (shearWeight w d) (a.mapDomain Sum.inl) + 1 ≤ d at h + change Finsupp.weight w a < d + change Finsupp.linearCombination ℕ (shearWeight w d) (a.mapDomain Sum.inl) + 1 ≤ d at h + rw [Finsupp.linearCombination_mapDomain] at h + exact h + +theorem realShearEmbedding_shape_of_coordinates (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (x : ℝ ⊗[ℚ] weightedSubalgebra w d) + (b : σ → ℝ) (P : weightedSupportLT (R := ℝ) w d) + (hb : ∀ i, ((weightedBasis w d hw).baseChange ℝ).repr x (Sum.inl i) = b i) + (hP : ∀ a, ((weightedBasis w d hw).baseChange ℝ).repr x (Sum.inr a) = P.val.coeff a.val) : + (∀ i, (realShearEmbedding w d x).val (X (Sum.inl i)) = C (b i)) ∧ + (realShearEmbedding w d x).val (X (Sum.inr ())) = rename Sum.inl P.val := by + classical + obtain ⟨b', P', hb', hP'⟩ := realShearEmbedding_shape w d x + have hbq (i : σ) : b' i = b i := by + have h := realShearEmbedding_base_coeff w d hw x i + rw [hb', hb] at h + simpa using h + have hPq : P' = P.val := by + have hmem := realShearEmbedding_polynomial_mem w d x P' hP' + apply MvPolynomial.ext + intro a + by_cases ha : Finsupp.weight w a < d + · have h := realShearEmbedding_extra_coeff w d hw x ⟨a, ha⟩ + rw [hP', coeff_rename_mapDomain Sum.inl Sum.inl_injective, hP] at h + exact h + · have hz (Q : MvPolynomial σ ℝ) (hQ : Q ∈ weightedSupportLT w d) : Q.coeff a = 0 := by + by_contra hc + exact ha (hQ (MvPolynomial.mem_support_iff.mpr hc)) + rw [hz P' hmem, hz P.val P.property] + exact ⟨fun i => (hb' i).trans (congrArg C (hbq i)), hP'.trans (congrArg (rename Sum.inl) hPq)⟩ + +theorem baseRealElement_shear_base (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (b : σ → ℝ) (i : σ) : + (realShearEmbedding w d (baseRealElement w d hw b)).val (X (Sum.inl i)) = C (b i) := + (realShearEmbedding_shape_of_coordinates w d hw _ b 0 (by simp) (by simp)).1 i + +theorem baseRealElement_shear_extra (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (b : σ → ℝ) : + (realShearEmbedding w d (baseRealElement w d hw b)).val (X (Sum.inr ())) = 0 := by + simpa using (realShearEmbedding_shape_of_coordinates w d hw + (baseRealElement w d hw b) b 0 (by simp) (by simp)).2 + +theorem polynomialRealElement_shear_base (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (P : weightedSupportLT (R := ℝ) w d) (i : σ) : + (realShearEmbedding w d (polynomialRealElement w d hw P)).val (X (Sum.inl i)) = 0 := by + simpa using (realShearEmbedding_shape_of_coordinates w d hw + (polynomialRealElement w d hw P) 0 P (by simp) (by simp)).1 i + +theorem polynomialRealElement_shear_extra (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (P : weightedSupportLT (R := ℝ) w d) : + (realShearEmbedding w d (polynomialRealElement w d hw P)).val (X (Sum.inr ())) = + rename Sum.inl P.val := + (realShearEmbedding_shape_of_coordinates w d hw _ 0 P (by simp) (by simp)).2 + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationShearExponential.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationShearExponential.lean new file mode 100644 index 0000000000000000000000000000000000000000..402db2f654d790bbafe5c41d9b07dfa0e5288aa9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationShearExponential.lean @@ -0,0 +1,555 @@ +import OAI.Combinatorics.Progressions.Nilpotent.BCHQuotientLocalIsometry +import OAI.Combinatorics.Progressions.Polynomial.PolynomialShearRealGroup + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +variable {σ : Type*} [Fintype σ] + +theorem scalarDirectionalDerivative_direction_add (x z : σ → ℚ) (P : MvPolynomial σ ℚ) : + scalarDirectionalDerivative (x + z) P = + scalarDirectionalDerivative x P + scalarDirectionalDerivative z P := by + simp only [scalarDirectionalDerivative_apply, Pi.add_apply, add_smul, Finset.sum_add_distrib] + +theorem scalarDirectionalDerivative_direction_smul (r : ℚ) (x : σ → ℚ) + (P : MvPolynomial σ ℚ) : + scalarDirectionalDerivative (r • x) P = r • scalarDirectionalDerivative x P := by + simp only [scalarDirectionalDerivative_apply, Pi.smul_apply, smul_eq_mul, smul_smul, Finset.smul_sum] + +theorem scalarDirectionalDerivative_direction_zero (P : MvPolynomial σ ℚ) : + scalarDirectionalDerivative (0 : σ → ℚ) P = 0 := by + simp [scalarDirectionalDerivative_apply] + +theorem scalarDirectionalDerivative_commute (x z : σ → ℚ) (P : MvPolynomial σ ℚ) : + scalarDirectionalDerivative x (scalarDirectionalDerivative z P) = + scalarDirectionalDerivative z (scalarDirectionalDerivative x P) := by + have h : ⁅scalarDirectionalDerivative x, scalarDirectionalDerivative z⁆ = 0 := by + apply MvPolynomial.derivation_ext + intro i + simp only [Derivation.commutator_apply, scalarDirectionalDerivative_X, + scalarDirectionalDerivative_C, sub_self, Derivation.zero_apply] + have hh := congrArg (fun D : Derivation ℚ (MvPolynomial σ ℚ) (MvPolynomial σ ℚ) => D P) h + exact sub_eq_zero.mp hh + +@[ext] structure PolynomialTranslationLie (σ : Type*) where + base : σ → ℚ + polynomial : MvPolynomial σ ℚ + +namespace PolynomialTranslationLie + +noncomputable def toProd : PolynomialTranslationLie σ ≃ (σ → ℚ) × MvPolynomial σ ℚ where + toFun x := (x.base, x.polynomial) + invFun x := ⟨x.1, x.2⟩ + left_inv _ := rfl + right_inv _ := rfl + +noncomputable instance : AddCommGroup (PolynomialTranslationLie σ) := toProd.addCommGroup +noncomputable instance : Module ℚ (PolynomialTranslationLie σ) := + { toProd with map_add' _ _ := rfl : PolynomialTranslationLie σ ≃+ (σ → ℚ) × MvPolynomial σ ℚ }.module ℚ + +noncomputable def toProdl : PolynomialTranslationLie σ ≃ₗ[ℚ] (σ → ℚ) × MvPolynomial σ ℚ := + { toProd with map_add' _ _ := rfl, map_smul' _ _ := rfl } + +omit [Fintype σ] in +@[simp] theorem base_zero : (0 : PolynomialTranslationLie σ).base = 0 := rfl +omit [Fintype σ] in +@[simp] theorem polynomial_zero : (0 : PolynomialTranslationLie σ).polynomial = 0 := rfl +omit [Fintype σ] in +@[simp] theorem base_add (x y : PolynomialTranslationLie σ) : (x+y).base = x.base+y.base := rfl +omit [Fintype σ] in +@[simp] theorem polynomial_add (x y : PolynomialTranslationLie σ) : (x+y).polynomial = x.polynomial+y.polynomial := rfl +omit [Fintype σ] in +@[simp] theorem base_smul (r : ℚ) (x : PolynomialTranslationLie σ) : (r • x).base = r • x.base := rfl +omit [Fintype σ] in +@[simp] theorem polynomial_smul (r : ℚ) (x : PolynomialTranslationLie σ) : (r • x).polynomial = r • x.polynomial := rfl + +noncomputable instance : Bracket (PolynomialTranslationLie σ) (PolynomialTranslationLie σ) where + bracket x y := ⟨0, scalarDirectionalDerivative x.base y.polynomial - + scalarDirectionalDerivative y.base x.polynomial⟩ + +@[simp] theorem base_lie (x y : PolynomialTranslationLie σ) : ⁅x,y⁆.base = 0 := rfl +@[simp] theorem polynomial_lie (x y : PolynomialTranslationLie σ) : ⁅x,y⁆.polynomial = + scalarDirectionalDerivative x.base y.polynomial - scalarDirectionalDerivative y.base x.polynomial := rfl + +noncomputable instance : LieRing (PolynomialTranslationLie σ) where + add_lie x y z := by + ext <;> simp [scalarDirectionalDerivative_direction_add]; abel + lie_add x y z := by + ext <;> simp [scalarDirectionalDerivative_direction_add]; abel + lie_self x := by ext <;> simp + leibniz_lie x y z := by + ext + · simp + · simp only [polynomial_lie, base_lie, polynomial_add, map_sub, + scalarDirectionalDerivative_direction_zero, sub_zero, zero_sub] + rw [scalarDirectionalDerivative_commute x.base y.base, + scalarDirectionalDerivative_commute x.base z.base, + scalarDirectionalDerivative_commute y.base z.base] + abel_nf + +noncomputable instance : LieAlgebra ℚ (PolynomialTranslationLie σ) where + lie_smul r x y := by + ext <;> simp [scalarDirectionalDerivative_direction_smul, smul_sub] + +end PolynomialTranslationLie +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +variable {σ : Type*} [Fintype σ] + +theorem scalarDirectionalDerivative_weight_drop (w : σ → ℕ) (x : σ → ℚ) (k : ℕ) + (hx : ∀ i, w i < k → x i = 0) {n r : ℕ} {P : MvPolynomial σ ℚ} + (hP : P ∈ weightedSupportDrop w n r) : + scalarDirectionalDerivative x P ∈ weightedSupportDrop w n (r + k) := by + apply weightedDerivation_apply w (scalarDirectionalDerivative x) k _ hP + intro i + rw [scalarDirectionalDerivative_X] + by_cases hi : k ≤ w i + · exact (monomial_mem_restrictSupport ℚ).mpr (Or.inl (by simpa using hi)) + · rw [hx i (by omega), map_zero] + exact Submodule.zero_mem _ + +namespace PolynomialTranslationLie + +noncomputable def weightedLayer (w : σ → ℕ) (d k : ℕ) : Submodule ℚ (PolynomialTranslationLie σ) where + carrier := {x | (∀ i, w i < k → x.base i = 0) ∧ + x.polynomial ∈ weightedSupportDrop w d k} + zero_mem' := ⟨by simp, Submodule.zero_mem _⟩ + add_mem' := by + intro x y hx hy + exact ⟨fun i hi => by simp [hx.1 i hi, hy.1 i hi], + Submodule.add_mem _ hx.2 hy.2⟩ + smul_mem' := by + intro r x hx + exact ⟨fun i hi => by simp [hx.1 i hi], Submodule.smul_mem _ r hx.2⟩ + +omit [Fintype σ] in +theorem mem_weightedLayer (w : σ → ℕ) (d k : ℕ) (x : PolynomialTranslationLie σ) : + x ∈ weightedLayer w d k ↔ (∀ i, w i < k → x.base i = 0) ∧ + x.polynomial ∈ weightedSupportDrop w d k := Iff.rfl + +omit [Fintype σ] in +theorem weightedLayer_antitone (w : σ → ℕ) (d : ℕ) : Antitone (weightedLayer w d) := by + intro i j hij x hx + exact ⟨fun a ha => hx.1 a (ha.trans_le hij), weightedSupportDrop_antitone hij hx.2⟩ + +theorem weightedLayer_lie_mem (w : σ → ℕ) (d : ℕ) {i j : ℕ} + {x y : PolynomialTranslationLie σ} (hx : x ∈ weightedLayer w d i) + (hy : y ∈ weightedLayer w d j) : ⁅x,y⁆ ∈ weightedLayer w d (i+j) := by + refine ⟨by simp, ?_⟩ + change scalarDirectionalDerivative x.base y.polynomial - + scalarDirectionalDerivative y.base x.polynomial ∈ _ + apply Submodule.sub_mem + · simpa only [Nat.add_comm j i] using scalarDirectionalDerivative_weight_drop w x.base i hx.1 hy.2 + · exact scalarDirectionalDerivative_weight_drop w y.base j hy.1 hx.2 + +omit [Fintype σ] in +theorem weightedLayer_terminal (w : σ → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) : + weightedLayer w d (d+1) = ⊥ := by + apply bot_unique + intro x hx + change x = 0 + apply PolynomialTranslationLie.ext + · funext i + exact hx.1 i (Nat.lt_succ_of_le (hw i)) + · exact weightedSupportDrop_eq_zero (Nat.lt_succ_self d) hx.2 + +noncomputable def weightedSubalgebra (w : σ → ℕ) (d : ℕ) : LieSubalgebra ℚ (PolynomialTranslationLie σ) := + { weightedLayer w d 1 with + lie_mem' := fun hx hy => weightedLayer_antitone w d (by omega : 1 ≤ 1+1) + (weightedLayer_lie_mem w d hx hy) } + +@[simp] theorem mem_weightedSubalgebra (w : σ → ℕ) (d : ℕ) (x : PolynomialTranslationLie σ) : + x ∈ weightedSubalgebra w d ↔ x ∈ weightedLayer w d 1 := Iff.rfl + +noncomputable def weightedFiltration (w : σ → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) : + NilpotentLieFiltration (weightedSubalgebra w d) d where + layer k := (weightedLayer w d k).comap (weightedSubalgebra w d).subtype + antitone := fun i j hij x hx => weightedLayer_antitone w d hij hx + one_eq_top := by + apply top_unique + intro x _ + exact x.property + lie_mem := fun hx hy => weightedLayer_lie_mem w d hx hy + terminal := by + rw [weightedLayer_terminal w d hw] + exact LinearMap.ker_eq_bot.mpr (weightedSubalgebra w d).subtype_injective + +noncomputable def weightedCoordinates (w : σ → ℕ) (d : ℕ) : + weightedSubalgebra w d →ₗ[ℚ] (σ → ℚ) × weightedSupportLE (R := ℚ) w d where + toFun x := (x.val.base, ⟨x.val.polynomial, weightedSupportDrop_le x.property.2⟩) + map_add' _ _ := rfl + map_smul' _ _ := rfl + +theorem weightedCoordinates_injective (w : σ → ℕ) (d : ℕ) : + Function.Injective (weightedCoordinates w d) := by + intro x y h + apply Subtype.ext + apply PolynomialTranslationLie.ext + · exact congrArg Prod.fst h + · exact congrArg (fun z => (z.2 : MvPolynomial σ ℚ)) h + +theorem weightedSubalgebra_finite (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) : + Module.Finite ℚ (weightedSubalgebra w d) := by + let := weightedSupportLE_moduleFinite (R := ℚ) w hw d + exact Module.Finite.of_injective (weightedCoordinates w d) (weightedCoordinates_injective w d) + +theorem weightedSubalgebra_finrank_le (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) : + Module.finrank ℚ (weightedSubalgebra w d) ≤ + Fintype.card σ + (Fintype.card σ + 1)^d := by + let := weightedSupportLE_moduleFinite (R := ℚ) w hw d + have h := LinearMap.finrank_le_finrank_of_injective (weightedCoordinates_injective w d) + calc + Module.finrank ℚ (weightedSubalgebra w d) ≤ + Module.finrank ℚ ((σ → ℚ) × weightedSupportLE (R := ℚ) w d) := h + _ = Fintype.card σ + Module.finrank ℚ (weightedSupportLE (R := ℚ) w d) := by + rw [Module.finrank_prod, Module.finrank_pi_fintype] + simp + _ ≤ _ := Nat.add_le_add_left (weightedSupportLE_finrank_le w hw d) _ + +theorem weightedSubalgebra_nilpotent (w : σ → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) : + LieRing.IsNilpotent (weightedSubalgebra w d) := + LieModule.IsNilpotent.mk (weightedSubalgebra w d) (weightedFiltration w d hw).lowerCentralSeries_eq_bot + +end PolynomialTranslationLie +end Erdos3 + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial + +variable {σ : Type*} [Fintype σ] + +def shearWeight (w : σ → ℕ) (d : ℕ) : σ ⊕ Unit → ℕ := Sum.elim w (fun _ => d) + +noncomputable def shearDerivation (x : PolynomialTranslationLie σ) : + Derivation ℚ (MvPolynomial (σ ⊕ Unit) ℚ) (MvPolynomial (σ ⊕ Unit) ℚ) := + mkDerivation ℚ (Sum.elim (fun i => C (x.base i)) (fun _ => rename Sum.inl x.polynomial)) + +omit [Fintype σ] in +@[simp] theorem shearDerivation_X_inl (x : PolynomialTranslationLie σ) (i : σ) : + shearDerivation x (X (Sum.inl i)) = C (x.base i) := mkDerivation_X _ _ _ + +omit [Fintype σ] in +@[simp] theorem shearDerivation_X_inr (x : PolynomialTranslationLie σ) (u : Unit) : + shearDerivation x (X (Sum.inr u)) = rename Sum.inl x.polynomial := mkDerivation_X _ _ _ + +theorem shearDerivation_rename (x : PolynomialTranslationLie σ) (P : MvPolynomial σ ℚ) : + shearDerivation x (rename Sum.inl P) = + rename Sum.inl (scalarDirectionalDerivative x.base P) := by + induction P using MvPolynomial.induction_on with + | C c => simp [MvPolynomial.derivation_C] + | add P Q hP hQ => simp only [map_add, hP, hQ] + | mul_X P i hP => + simp only [map_mul, rename_X, Derivation.leibniz, smul_eq_mul, + shearDerivation_X_inl, scalarDirectionalDerivative_X, map_add, rename_C, hP] + +noncomputable def shearDerivationHom : PolynomialTranslationLie σ →ₗ⁅ℚ⁆ + Derivation ℚ (MvPolynomial (σ ⊕ Unit) ℚ) (MvPolynomial (σ ⊕ Unit) ℚ) where + toFun := shearDerivation + map_add' x y := by + apply MvPolynomial.derivation_ext + intro i + cases i <;> simp [Pi.add_apply] + map_smul' r x := by + apply MvPolynomial.derivation_ext + intro i + cases i <;> simp [Derivation.smul_apply, Pi.smul_apply, Algebra.smul_def] + map_lie' := by + intro x y + apply MvPolynomial.derivation_ext + intro i + cases i <;> simp [Derivation.commutator_apply, MvPolynomial.derivation_C, + shearDerivation_rename] + +theorem shearDerivationHom_injective : Function.Injective (shearDerivationHom (σ := σ)) := by + intro x y h + apply PolynomialTranslationLie.ext + · funext i + have hh := congrArg (fun D : Derivation ℚ (MvPolynomial (σ ⊕ Unit) ℚ) + (MvPolynomial (σ ⊕ Unit) ℚ) => D (X (Sum.inl i))) h + simpa [shearDerivationHom] using hh + · apply MvPolynomial.rename_injective Sum.inl Sum.inl_injective + have hh := congrArg (fun D : Derivation ℚ (MvPolynomial (σ ⊕ Unit) ℚ) + (MvPolynomial (σ ⊕ Unit) ℚ) => D (X (Sum.inr ()))) h + simpa [shearDerivationHom] using hh + +omit [Fintype σ] in + +theorem shearDerivation_mem_drop (w : σ → ℕ) (d k : ℕ) + {x : PolynomialTranslationLie σ} (hx : x ∈ weightedLayer w d k) : + shearDerivation x ∈ polynomialDerivationDrop (shearWeight w d) k := by + intro i + cases i with + | inl i => + rw [shearDerivation_X_inl] + by_cases hi : k ≤ w i + · exact (monomial_mem_restrictSupport ℚ).mpr (Or.inl (by simpa [shearWeight] using hi)) + · rw [hx.1 i (by omega), map_zero] + exact Submodule.zero_mem _ + | inr u => + rw [shearDerivation_X_inr] + exact weightedSupportDrop_rename Sum.inl (fun _ => rfl) hx.2 + +noncomputable def weightedShearEmbedding (w : σ → ℕ) (d : ℕ) : + weightedSubalgebra w d →ₗ⁅ℚ⁆ PolynomialShearLieAlgebra (shearWeight w d) ℚ where + toFun x := ⟨shearDerivationHom x.val, shearDerivation_mem_drop w d 1 x.property⟩ + map_add' x y := Subtype.ext (shearDerivationHom.map_add x.val y.val) + map_smul' r x := Subtype.ext (shearDerivationHom.map_smul r x.val) + map_lie' := by + intro x y + exact Subtype.ext (shearDerivationHom.map_lie x.val y.val) + +theorem weightedShearEmbedding_injective (w : σ → ℕ) (d : ℕ) : + Function.Injective (weightedShearEmbedding w d) := by + intro x y h + apply Subtype.ext + exact shearDerivationHom_injective (congrArg Subtype.val h) + +theorem weightedShearEmbedding_filtered (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, w i ≤ d) (k : ℕ) {x : weightedSubalgebra w d} + (hx : x ∈ (weightedFiltration w d hw).layer k) : + weightedShearEmbedding w d x ∈ polynomialShearLayer (R := ℚ) (shearWeight w d) k := + shearDerivation_mem_drop w d k hx + +theorem weightedShearEmbedding_apply_drop (w : σ → ℕ) (d k : ℕ) + {x : weightedSubalgebra w d} (hx : x.val ∈ weightedLayer w d k) + {n r : ℕ} {P : MvPolynomial (σ ⊕ Unit) ℚ} + (hP : P ∈ weightedSupportDrop (shearWeight w d) n r) : + (weightedShearEmbedding w d x).val P ∈ weightedSupportDrop (shearWeight w d) n (r+k) := + weightedDerivation_apply _ _ k (shearDerivation_mem_drop w d k hx) hP + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial +open scoped TensorProduct + +variable {σ : Type*} [Fintype σ] + +omit [Fintype σ] in +theorem shearWeight_le (w : σ → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) : + ∀ i, shearWeight w d i ≤ d := by + intro i + cases i with + | inl i => exact hw i + | inr _ => exact le_rfl + +noncomputable def weightedShearGroupHom (w : σ → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) : + (weightedFiltration w d hw).Group →* WeightedLoweringAut (shearWeight w d) ℚ := + (polynomialShearBCHEquiv _ d (shearWeight_le w d hw)).toMonoidHom.comp + (NilpotentLieBCHGroup.map (weightedShearEmbedding w d)) + +@[simp] theorem weightedShearGroupHom_apply (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, w i ≤ d) (g : (weightedFiltration w d hw).Group) : + weightedShearGroupHom w d hw g = polynomialShearExpAut (weightedShearEmbedding w d g.coord) := rfl + +theorem weightedShearGroupHom_injective (w : σ → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) : + Function.Injective (weightedShearGroupHom w d hw) := by + intro g h heq + apply NilpotentLieBCHGroup.ext + apply weightedShearEmbedding_injective w d + have hh := (polynomialShearBCHEquiv _ d (shearWeight_le w d hw)).injective heq + exact congrArg NilpotentLieBCHGroup.coord hh + +noncomputable def weightedShearRealGroupHom (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, w i ≤ d) : + (weightedFiltration w d hw).realification.Group →* + WeightedLoweringAut (shearWeight w d) ℝ := + (polynomialShearRealAutEquiv _ d (shearWeight_le w d hw)).toMonoidHom.comp + (NilpotentLieBCHGroup.mapReal (realificationLieHom (weightedShearEmbedding w d))) + +@[simp] theorem weightedShearRealGroupHom_apply (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, w i ≤ d) (g : (weightedFiltration w d hw).realification.Group) : + weightedShearRealGroupHom w d hw g = polynomialShearExpAut + (polynomialShearRealificationEquiv (shearWeight w d) + (realificationLieHom (weightedShearEmbedding w d) g.coord)) := rfl + +theorem weightedShearRealEmbedding_injective (w : σ → ℕ) (d : ℕ) : + Function.Injective (realificationLieHom (weightedShearEmbedding w d)) := by + let : Module.Free ℚ ℝ := Module.Free.of_divisionRing ℚ ℝ + exact Module.Flat.lTensor_preserves_injective_linearMap (M := ℝ) + (weightedShearEmbedding w d).toLinearMap (weightedShearEmbedding_injective w d) + +theorem weightedShearRealGroupHom_injective (w : σ → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) : + Function.Injective (weightedShearRealGroupHom w d hw) := by + intro g h heq + apply NilpotentLieBCHGroup.ext + apply weightedShearRealEmbedding_injective w d + have hh := (polynomialShearRealAutEquiv _ d (shearWeight_le w d hw)).injective heq + exact congrArg NilpotentLieBCHGroup.coord hh + +theorem weightedShearRealGroupHom_rational (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, w i ≤ d) (g : (weightedFiltration w d hw).Group) + (P : MvPolynomial (σ ⊕ Unit) ℚ) : + (weightedShearRealGroupHom w d hw (NilpotentLieBCHGroup.realificationHom g)).val + (MvPolynomial.map (algebraMap ℚ ℝ) P) = + MvPolynomial.map (algebraMap ℚ ℝ) ((weightedShearGroupHom w d hw g).val P) := by + exact polynomialShearRealAutEquiv_rational (shearWeight w d) d + (shearWeight_le w d hw) (NilpotentLieBCHGroup.map (weightedShearEmbedding w d) g) P + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial +open scoped TensorProduct + +variable {σ : Type*} [Fintype σ] + +noncomputable def realShearEmbedding (w : σ → ℕ) (d : ℕ) : + (ℝ ⊗[ℚ] weightedSubalgebra w d) →ₗ⁅ℝ⁆ PolynomialShearLieAlgebra (shearWeight w d) ℝ := + (polynomialShearRealificationEquiv (shearWeight w d)).toLieHom.comp + (realificationLieHom (weightedShearEmbedding w d)) + +@[simp] theorem realShearEmbedding_tmul (w : σ → ℕ) (d : ℕ) + (r : ℝ) (x : weightedSubalgebra w d) : + realShearEmbedding w d (r ⊗ₜ[ℚ] x) = + r • polynomialShearMap (algebraMap ℚ ℝ) (weightedShearEmbedding w d x) := rfl + +theorem realShearEmbedding_shape (w : σ → ℕ) (d : ℕ) + (x : ℝ ⊗[ℚ] weightedSubalgebra w d) : + ∃ b : σ → ℝ, ∃ P : MvPolynomial σ ℝ, + (∀ i, (realShearEmbedding w d x).val (X (Sum.inl i)) = C (b i)) ∧ + (realShearEmbedding w d x).val (X (Sum.inr ())) = rename Sum.inl P := by + induction x using TensorProduct.inductionOn with + | tmul r x => + refine ⟨fun i => r * (x.val.base i : ℝ), + r • MvPolynomial.map (algebraMap ℚ ℝ) x.val.polynomial, ?_, ?_⟩ + · intro i + rw [realShearEmbedding_tmul] + change r • (polynomialShearMap (algebraMap ℚ ℝ) + (weightedShearEmbedding w d x)).val (X (Sum.inl i)) = _ + rw [polynomialShearMap_X] + change r • MvPolynomial.map (algebraMap ℚ ℝ) + (x.val.shearDerivation (X (Sum.inl i))) = _ + rw [shearDerivation_X_inl, map_C] + simp [Algebra.smul_def] + · rw [realShearEmbedding_tmul] + change r • (polynomialShearMap (algebraMap ℚ ℝ) + (weightedShearEmbedding w d x)).val (X (Sum.inr ())) = _ + rw [polynomialShearMap_X] + change r • MvPolynomial.map (algebraMap ℚ ℝ) + (x.val.shearDerivation (X (Sum.inr ()))) = _ + rw [shearDerivation_X_inr] + simp [MvPolynomial.map_rename] + | add x y hx hy => + obtain ⟨bx, Px, hbx, hPx⟩ := hx + obtain ⟨by', Py, hby, hPy⟩ := hy + refine ⟨bx + by', Px + Py, ?_, ?_⟩ + · intro i + rw [map_add] + change (realShearEmbedding w d x).val (X (Sum.inl i)) + + (realShearEmbedding w d y).val (X (Sum.inl i)) = _ + rw [hbx, hby] + simp + · rw [map_add] + change (realShearEmbedding w d x).val (X (Sum.inr ())) + + (realShearEmbedding w d y).val (X (Sum.inr ())) = _ + rw [hPx, hPy, map_add] + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial +open scoped BigOperators + +variable {σ : Type*} [Fintype σ] + +theorem shearDerivation_pow_X_inr (x : PolynomialTranslationLie σ) (n : ℕ) : + (x.shearDerivation.toLinearMap ^ (n+1)) (X (Sum.inr ())) = + rename Sum.inl ((scalarDirectionalDerivative x.base).toLinearMap ^ n $ x.polynomial) := by + induction n with + | zero => simp + | succ n ih => + rw [pow_succ', Module.End.mul_apply, ih] + change shearDerivation x (rename Sum.inl _) = _ + rw [shearDerivation_rename, pow_succ', Module.End.mul_apply] + rfl + +omit [Fintype σ] in +theorem shearDerivation_pow_X_inl (x : PolynomialTranslationLie σ) (n : ℕ) (i : σ) : + (x.shearDerivation.toLinearMap ^ (n+2)) (X (Sum.inl i)) = 0 := by + induction n with + | zero => + rw [show 0+2=1+1 by omega, pow_succ', Module.End.mul_apply] + simp [MvPolynomial.derivation_C] + | succ n ih => + rw [show n+1+2=(n+2)+1 by omega, pow_succ', Module.End.mul_apply, ih, map_zero] + +theorem weightedShearExp_X_inr (w : σ → ℕ) (d : ℕ) + (x : weightedSubalgebra w d) (N : ℕ) (hN : d ≤ N) : + (polynomialShearExpAut (weightedShearEmbedding w d x)).val (X (Sum.inr ())) = + X (Sum.inr ()) + rename Sum.inl + (∑ k ∈ Finset.range N, ((k+1).factorial : ℚ)⁻¹ • + ((scalarDirectionalDerivative x.val.base).toLinearMap ^ k) x.val.polynomial) := by + rw [polynomialShearExpAut_apply, + polynomialShearExp_eq_sum _ (weightedSupportLE_mono hN + (weightedSupportLE_X (shearWeight w d) (Sum.inr ()))), Finset.sum_range_succ'] + simp only [Nat.factorial_zero, Nat.cast_one, inv_one, pow_zero, + Module.End.one_apply, one_smul, map_sum, map_smul] + rw [add_comm] + congr 1 + apply Finset.sum_congr rfl + intro k hk + congr 1 + exact shearDerivation_pow_X_inr x.val k + +theorem weightedShearExp_X_inl (w : σ → ℕ) (d : ℕ) + (x : weightedSubalgebra w d) (i : σ) : + (polynomialShearExpAut (weightedShearEmbedding w d x)).val (X (Sum.inl i)) = + X (Sum.inl i) + C (x.val.base i) := by + rw [polynomialShearExpAut_apply, + polynomialShearExp_eq_sum _ (weightedSupportLE_mono (Nat.le_add_right (w i) 2) + (weightedSupportLE_X (shearWeight w d) (Sum.inl i))), + Finset.sum_range_succ', Finset.sum_range_succ'] + have hz : ∑ k ∈ Finset.range (w i + 1), + ((k+1+1).factorial : ℚ)⁻¹ • + ((weightedShearEmbedding w d x).val.toLinearMap ^ (k+1+1)) (X (Sum.inl i)) = 0 := by + apply Finset.sum_eq_zero + intro k hk + change ((k+1+1).factorial : ℚ)⁻¹ • + (x.val.shearDerivation.toLinearMap ^ (k+2)) (X (Sum.inl i)) = 0 + rw [shearDerivation_pow_X_inl, smul_zero] + rw [hz] + simp only [Nat.factorial_zero, Nat.factorial_one, Nat.cast_one, inv_one, pow_zero, + pow_one, Module.End.one_apply, one_smul, zero_add] + change x.val.shearDerivation (X (Sum.inl i)) + X (Sum.inl i) = _ + rw [shearDerivation_X_inl, add_comm] + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationStructureConstants.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationStructureConstants.lean new file mode 100644 index 0000000000000000000000000000000000000000..015fd5edee643b0b8dea3795609bec44eafd89ac --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTranslationStructureConstants.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Nilpotent.CurrentBracketInductionStep + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial + +variable {σ : Type*} + +noncomputable def weightedBasisBracketCoefficient (w : σ → ℕ) (d : ℕ) : + WeightedBasisIndex w d → WeightedBasisIndex w d → WeightedBasisIndex w d → ℤ := by + classical + exact fun a b c => match a, b, c with + | Sum.inl i, Sum.inr a, Sum.inr c => + if a.val - Finsupp.single i 1 = c.val then (a.val i : ℤ) else 0 + | Sum.inr a, Sum.inl i, Sum.inr c => + -(if a.val - Finsupp.single i 1 = c.val then (a.val i : ℤ) else 0) + | _, _, _ => 0 + +variable [Fintype σ] + +theorem weightedBasis_structureConstants (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (a b c : WeightedBasisIndex w d) : + lieStructureConstants (weightedBasis w d hw) a b c = + (weightedBasisBracketCoefficient w d a b c : ℚ) := by + classical + unfold lieStructureConstants + cases c with + | inl c => + rw [weightedBasis_repr_inl] + cases a <;> cases b <;> rfl + | inr c => + rw [weightedBasis_repr_inr] + change (scalarDirectionalDerivative (weightedBasis w d hw a).val.base + (weightedBasis w d hw b).val.polynomial - + scalarDirectionalDerivative (weightedBasis w d hw b).val.base + (weightedBasis w d hw a).val.polynomial).coeff c.val = _ + cases a with + | inl i => + cases b with + | inl j => simp [weightedBasisBracketCoefficient] + | inr a => + simp [weightedBasisBracketCoefficient, scalarDirectionalDerivative_apply, + Pi.single_apply, pderiv_monomial, coeff_monomial] + | inr a => + cases b with + | inl i => + simp [weightedBasisBracketCoefficient, scalarDirectionalDerivative_apply, + Pi.single_apply, pderiv_monomial, coeff_monomial] + | inr b => simp [weightedBasisBracketCoefficient] + +omit [Fintype σ] in +theorem weightedBasisBracketCoefficient_natAbs_le (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (a b c : WeightedBasisIndex w d) : + (weightedBasisBracketCoefficient w d a b c).natAbs ≤ d := by + classical + have hb : ∀ (i : σ) (a : {a : σ →₀ ℕ | Finsupp.weight w a < d}), a.val i ≤ d := by + intro i a + exact (Finsupp.le_weight w (hw i).ne' a.val).trans (Nat.le_of_lt a.property) + cases a <;> cases b <;> cases c <;> + simp only [weightedBasisBracketCoefficient, Int.natAbs_neg] <;> + (try split_ifs) <;> + simp only [Int.natAbs_zero, Int.natAbs_natCast, Nat.zero_le] <;> exact hb _ _ + +theorem weightedBasis_structure_height_succ (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (a b c : WeightedBasisIndex w d) : + RationalHeightLE (lieStructureConstants (weightedBasis w d hw) a b c) (d + 1) := by + rw [weightedBasis_structureConstants] + constructor + · simpa using (weightedBasisBracketCoefficient_natAbs_le w d hw a b c).trans (Nat.le_succ d) + · simp + +theorem weightedBasis_structure_height (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (a b c : WeightedBasisIndex w d) : + RationalHeightLE (lieStructureConstants (weightedBasis w d hw) a b c) (2 * d + 1) := + (weightedBasis_structure_height_succ w d hw a b c).mono (by omega) + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTwistedTranslationLipschitz.lean b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTwistedTranslationLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ddf08ec046503c5d04fabb426da1010e92b4f69 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/WeightedTwistedTranslationLipschitz.lean @@ -0,0 +1,232 @@ +import OAI.Combinatorics.Progressions.Estimates.ComplexUnitLocalLipschitz +import OAI.Combinatorics.Progressions.Geometry.WeightedTranslationBufferedCoordinates + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module NilpotentLieBCHGroup +open scoped NNReal TensorProduct + +variable {m : ℕ} (w : Fin m → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + +noncomputable def translationDisplacementNN : ℝ≥0 := + ⟨weightedTranslationDisplacementConstant d m (Fintype.card (WeightedBasisIndex w d)), + (weightedTranslationDisplacementConstant_pos _ _ _).le⟩ + +noncomputable def bufferedTranslationTermLip (Ψ : PatchKernel m) (M : ℝ≥0) : ℝ≥0 := + let C := translationDisplacementNN w d + max (8 * C) ((Ψ.lip + ⟨2 * Real.pi, by positivity⟩ * (1 + M * m * d)) * C) + +theorem bufferedTranslationTerm_lipschitz + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) (M : ℝ≥0) + (hdegree : D₀.totalDegree ≤ d) (hD : realPolynomialMass D₀ ≤ M) + (β : Fin m → ℤ) : + letI := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + LipschitzWith (bufferedTranslationTermLip w d Ψ M) + (fun g => bufferedTranslationTerm Ψ D₀ (bchRealTranslationHom w d hwd g) β) := by + let := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + let C := translationDisplacementNN w d + let L : ℝ≥0 := (Ψ.lip + ⟨2 * Real.pi, by positivity⟩ * (1 + M * m * d)) * C + have hC : 0 < (C : ℝ) := weightedTranslationDisplacementConstant_pos _ _ _ + have heq : bufferedTranslationTermLip w d Ψ M = max (2 * (4 * C)) L := by + dsimp [bufferedTranslationTermLip, L] + congr 1 + ring + rw [heq] + apply lipschitzWith_of_complex_unit_near _ (4 * C) L + · intro g + simp only [bufferedTranslationTerm, norm_mul, Circle.norm_coe, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (Ψ.nonneg _)] + exact Ψ.le_one _ + · intro x y hnear + let z := x * y⁻¹ + have hz : z * y = x := by dsimp [z]; group + have hdist : dist 1 z = dist x y := by + have hh := (rightMetricSpace_isometry_mul_right + ((weightedOrderedBasis w d hw).baseChange ℝ) y⁻¹).dist_eq y x + simpa only [z, mul_inv_cancel, dist_comm y x] using hh + have hsmall : (C : ℝ) * dist x y ≤ 1 / 4 := by + simp only [NNReal.coe_mul, NNReal.coe_ofNat] at hnear + linarith + have hnearz : dist 1 z ≤ 1 / (C : ℝ) := by + rw [hdist, le_div_iff₀ hC] + nlinarith + have hnearz' : dist 1 z ≤ 1 / weightedTranslationDisplacementConstant d m + (Fintype.card (WeightedBasisIndex w d)) := hnearz + have hb := bchRealTranslation_bounds_near_one w d hw hd hwd z + (by simpa only [Fintype.card_fin] using hnearz') + simp only [Fintype.card_fin] at hb + change (∀ i, |(bchRealTranslationHom w d hwd z).base i| ≤ (C : ℝ) * dist 1 z) ∧ + ∀ a : Fin m → ℝ, (∀ i, |a i| ≤ 1) → + |eval a (bchRealTranslationHom w d hwd z).polynomial| ≤ (C : ℝ) * dist 1 z at hb + rw [hdist] at hb + have h := bufferedTranslationTerm_increment_bound Ψ D₀ + (bchRealTranslationHom w d hwd z) (bchRealTranslationHom w d hwd y) β + (mul_nonneg hC.le dist_nonneg) hsmall hdegree hD hb.1 hb.2 + rw [← map_mul, hz] at h + change _ ≤ ((Ψ.lip : ℝ) + 2 * Real.pi * (1 + (M : ℝ) * m * d)) * + (C : ℝ) * dist x y + simpa only [mul_assoc] using h + +theorem bufferedTranslationPhase_lipschitz + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) (M : ℝ≥0) + (hdegree : D₀.totalDegree ≤ d) (hD : realPolynomialMass D₀ ≤ M) : + letI := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + LipschitzWith (2 * bufferedTranslationTermLip w d Ψ M) + (fun g => bufferedTranslationPhase Ψ D₀ (bchRealTranslationHom w d hwd g)) := by + let := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + exact separated_complex_tsum_lipschitz + (fun β g => bufferedTranslationTerm Ψ D₀ (bchRealTranslationHom w d hwd g) β) + (fun β => bufferedTranslationTerm_lipschitz w d hw hd hwd Ψ D₀ M hdegree hD β) + (fun g β γ => bufferedTranslationTerm_unique Ψ D₀ (bchRealTranslationHom w d hwd g) β γ) + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3 + +private theorem complex_mul_sub_mul_le_unit (a b c e : ℂ) + (hb : ‖b‖ ≤ 1) (hc : ‖c‖ ≤ 1) : + ‖a * b - c * e‖ ≤ ‖a - c‖ + ‖b - e‖ := by + rw [show a * b - c * e = (a - c) * b + c * (b - e) by ring] + apply (norm_add_le _ _).trans + rw [norm_mul, norm_mul] + exact add_le_add + (by simpa only [mul_one] using mul_le_mul_of_nonneg_left hb (norm_nonneg (a - c))) + (by simpa only [one_mul] using mul_le_mul_of_nonneg_right hc (norm_nonneg (b - e))) + +namespace PolynomialTranslationLie + +open MvPolynomial NilpotentLieBCHGroup +open scoped NNReal TensorProduct + +variable {m : ℕ} (w : Fin m → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + +noncomputable def twistedBufferedTranslationTermLip (Ψ : PatchKernel m) (A K : ℝ≥0) : ℝ≥0 := + max (2 * translationDisplacementNN w d) + (bufferedTranslationTermLip w d Ψ A + K * translationDisplacementNN w d) + +theorem twistedBufferedTranslationTerm_lipschitz (hd : 0 < d) (hwd : ∀ i, w i ≤ d) + (M : ℕ) (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) (A K : ℝ≥0) + (hdegree : D₀.totalDegree ≤ d) (hD : realPolynomialMass D₀ ≤ A) + (T : (Fin m → ℝ) → (Fin m → ZMod M) → ℂ) + (hT : ∀ x r, ‖T x r‖ ≤ 1) (hLip : ∀ r, LipschitzWith K (fun x => T x r)) + (β : Fin m → ℤ) : + letI := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + LipschitzWith (twistedBufferedTranslationTermLip w d Ψ A K) + (fun g => twistedBufferedTranslationTerm M Ψ D₀ T (bchRealTranslationHom w d hwd g) β) := by + let := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + let C := translationDisplacementNN w d + let B := bufferedTranslationTermLip w d Ψ A + let ρ := bchRealTranslationHom w d hwd + have hC : 0 < (C : ℝ) := weightedTranslationDisplacementConstant_pos _ _ _ + apply lipschitzWith_of_complex_unit_near _ C (B + K * C) + · intro g + exact twistedBufferedTranslationTerm_norm_le_one M Ψ D₀ T hT (ρ g) β + · intro x y hnear + let z := x * y⁻¹ + have hz : z * y = x := by dsimp [z]; group + have hdist : dist 1 z = dist x y := by + have hh := (rightMetricSpace_isometry_mul_right + ((weightedOrderedBasis w d hw).baseChange ℝ) y⁻¹).dist_eq y x + simpa only [z, mul_inv_cancel, dist_comm y x] using hh + have hnearz : dist 1 z ≤ 1 / (C : ℝ) := by + rw [hdist, le_div_iff₀ hC] + simpa only [mul_comm] using hnear.le + have hbounds := bchRealTranslation_bounds_near_one w d hw hd hwd z + simp only [Fintype.card_fin] at hbounds + have hb := (hbounds hnearz).1 + change ∀ i, |(ρ z).base i| ≤ (C : ℝ) * dist 1 z at hb + rw [hdist] at hb + let rx := fun i => (ρ x).base i - (β i : ℝ) + let ry := fun i => (ρ y).base i - (β i : ℝ) + have hres : dist rx ry ≤ (C : ℝ) * dist x y := by + apply (dist_pi_le_iff (mul_nonneg C.coe_nonneg dist_nonneg)).mpr + intro i + have hbase : (ρ x).base i = (ρ z).base i + (ρ y).base i := by + rw [← hz, map_mul] + rfl + dsimp [rx, ry] + rw [Real.dist_eq, hbase] + rw [show (ρ z).base i + (ρ y).base i - (β i : ℝ) - + ((ρ y).base i - (β i : ℝ)) = (ρ z).base i by ring] + exact hb i + have hmult : ‖T rx (fun i => (β i : ZMod M)) - T ry (fun i => (β i : ZMod M))‖ ≤ + (K : ℝ) * ((C : ℝ) * dist x y) := by + simpa only [dist_eq_norm] using + ((hLip (fun i => (β i : ZMod M))).dist_le_mul rx ry).trans + (mul_le_mul_of_nonneg_left hres K.coe_nonneg) + have hphase : ‖bufferedTranslationTerm Ψ D₀ (ρ x) β - + bufferedTranslationTerm Ψ D₀ (ρ y) β‖ ≤ (B : ℝ) * dist x y := by + simpa only [dist_eq_norm] using + (bufferedTranslationTerm_lipschitz w d hw hd hwd Ψ D₀ A hdegree hD β).dist_le_mul x y + have hbx : ‖bufferedTranslationTerm Ψ D₀ (ρ x) β‖ ≤ 1 := by + simp only [bufferedTranslationTerm, norm_mul, Circle.norm_coe, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (Ψ.nonneg _)] + exact Ψ.le_one _ + have hmul := complex_mul_sub_mul_le_unit + (T rx (fun i => (β i : ZMod M))) (bufferedTranslationTerm Ψ D₀ (ρ x) β) + (T ry (fun i => (β i : ZMod M))) (bufferedTranslationTerm Ψ D₀ (ρ y) β) + hbx (hT _ _) + apply hmul.trans + apply (add_le_add hmult hphase).trans_eq + simp only [NNReal.coe_add, NNReal.coe_mul] + ring + +theorem twistedBufferedTranslationPhase_lipschitz (hd : 0 < d) (hwd : ∀ i, w i ≤ d) + (M : ℕ) (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) (A K : ℝ≥0) + (hdegree : D₀.totalDegree ≤ d) (hD : realPolynomialMass D₀ ≤ A) + (T : (Fin m → ℝ) → (Fin m → ZMod M) → ℂ) + (hT : ∀ x r, ‖T x r‖ ≤ 1) (hLip : ∀ r, LipschitzWith K (fun x => T x r)) : + letI := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + LipschitzWith (2 * twistedBufferedTranslationTermLip w d Ψ A K) + (fun g => twistedBufferedTranslationPhase M Ψ D₀ T (bchRealTranslationHom w d hwd g)) := by + let := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + exact separated_complex_tsum_lipschitz + (fun β g => twistedBufferedTranslationTerm M Ψ D₀ T (bchRealTranslationHom w d hwd g) β) + (fun β => twistedBufferedTranslationTerm_lipschitz w d hw hd hwd M Ψ D₀ A K + hdegree hD T hT hLip β) + (fun g β γ => twistedBufferedTranslationTerm_unique M Ψ D₀ T + (bchRealTranslationHom w d hwd g) β γ) + +end PolynomialTranslationLie + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Estimates/ZeroBasedExtremalSet.lean b/lean/OAI/Combinatorics/Progressions/Estimates/ZeroBasedExtremalSet.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea6121a9cbdf2e5f5b5e686e8d591af6c47d8189 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Estimates/ZeroBasedExtremalSet.lean @@ -0,0 +1,39 @@ +import OAI.Combinatorics.Progressions.Probability.RelativeSourceDensityParameter + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_zero_based_extremalSet {k : ℕ} (hk : 0 < k) (N : ℕ) : + ∃ S : Finset ℕ, S ⊆ Finset.range N ∧ APFree (S : Set ℕ) k ∧ S.card = extremalNumber k N := by + classical + obtain ⟨S, hS, hfree, hcard⟩ := exists_extremalSet hk N + let T := S.image (fun n => n - 1) + have hT : T ⊆ Finset.range N := by + intro n hn + obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp hn + have hxs := Finset.mem_Icc.mp (hS hx) + exact Finset.mem_range.mpr (by omega) + have hTf : APFree (T : Set ℕ) k := by + apply (hfree.affine_preimage 1 1 (by omega)).mono + intro n hn + obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp hn + have hxs := Finset.mem_Icc.mp (hS hx) + have he : 1 + 1 * (x - 1) = x := by omega + simpa only [Set.mem_preimage, he, Finset.mem_coe] using hx + have hTc : T.card = S.card := by + apply Finset.card_image_of_injOn + intro x hx y hy he + have hx1 := (Finset.mem_Icc.mp (hS hx)).1 + have hy1 := (Finset.mem_Icc.mp (hS hy)).1 + change x - 1 = y - 1 at he + omega + exact ⟨T, hT, hTf, hTc.trans hcard⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/AdaptiveCoarseTargetRegularity.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/AdaptiveCoarseTargetRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..2205bbf747901499e26fa6b3b16b48c094d5020b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/AdaptiveCoarseTargetRegularity.lean @@ -0,0 +1,730 @@ +import OAI.Combinatorics.Progressions.FixedDensity.CoarseTargetRegularity + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +inductive AdaptiveCoarseTargetSchedule (k : ℕ) : ℕ → Type + | nil : AdaptiveCoarseTargetSchedule k 0 + | node {r : ℕ} + (tolerance : ℕ → ℝ) + (budget : ℕ → ℕ) + (length : ℕ) + (next : Fin length → AdaptiveCoarseTargetSchedule k r) : + AdaptiveCoarseTargetSchedule k (r + 1) + +namespace AdaptiveCoarseTargetSchedule + +def IsAdmissible {k r : ℕ} : + AdaptiveCoarseTargetSchedule k r → Prop + | .nil => True + | .node tolerance budget length next => + (∀ n, 0 ≤ tolerance n) ∧ + (∀ n, + (Fintype.card (OrderedFace k r) : ℝ) < + (budget n : ℝ) * (tolerance n) ^ 2) ∧ + 0 < length ∧ + ∀ i, (next i).IsAdmissible + +inductive Landing {k : ℕ} : + {r : ℕ} → AdaptiveCoarseTargetSchedule k r → Type + | nil : Landing (.nil : AdaptiveCoarseTargetSchedule k 0) + | node {r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (index : Fin length) + (lower : Landing (next index)) : + Landing (.node tolerance budget length next) + +namespace Landing + +def tolerance {k r : ℕ} + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) : + (j : Fin r) → ℕ → ℝ := + match P with + | .nil => fun j => Fin.elim0 j + | .node (tolerance := tolerance) _ lower => + fun j => Fin.lastCases tolerance lower.tolerance j + +def budget {k r : ℕ} + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) : + (j : Fin r) → ℕ → ℕ := + match P with + | .nil => fun j => Fin.elim0 j + | .node (budget := budget) _ lower => + fun j => Fin.lastCases budget lower.budget j + +def length {k r : ℕ} + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) : + Fin r → ℕ := + match P with + | .nil => fun j => Fin.elim0 j + | .node (length := length) _ lower => + fun j => Fin.lastCases length lower.length j + +def index {k r : ℕ} + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) : + Fin r → ℕ := + match P with + | .nil => fun j => Fin.elim0 j + | .node chosen lower => + fun j => Fin.lastCases chosen.1 lower.index j + +@[simp] +theorem tolerance_node_last + {k r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (chosen : Fin length) + (lower : (next chosen).Landing) : + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).tolerance (Fin.last r) = + tolerance := by + simp [Landing.tolerance] + +@[simp] +theorem tolerance_node_castSucc + {k r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (chosen : Fin length) + (lower : (next chosen).Landing) + (j : Fin r) : + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).tolerance j.castSucc = + lower.tolerance j := by + simp [Landing.tolerance] + +@[simp] +theorem budget_node_last + {k r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (chosen : Fin length) + (lower : (next chosen).Landing) : + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).budget (Fin.last r) = + budget := by + simp [Landing.budget] + +@[simp] +theorem budget_node_castSucc + {k r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (chosen : Fin length) + (lower : (next chosen).Landing) + (j : Fin r) : + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).budget j.castSucc = + lower.budget j := by + simp [Landing.budget] + +@[simp] +theorem length_node_last + {k r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (chosen : Fin length) + (lower : (next chosen).Landing) : + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).length (Fin.last r) = + length := by + simp [Landing.length] + +@[simp] +theorem length_node_castSucc + {k r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (chosen : Fin length) + (lower : (next chosen).Landing) + (j : Fin r) : + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).length j.castSucc = + lower.length j := by + simp [Landing.length] + +@[simp] +theorem index_node_last + {k r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (chosen : Fin length) + (lower : (next chosen).Landing) : + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).index (Fin.last r) = + chosen.1 := by + simp [Landing.index] + +@[simp] +theorem index_node_castSucc + {k r : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {length : ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (chosen : Fin length) + (lower : (next chosen).Landing) + (j : Fin r) : + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).index j.castSucc = + lower.index j := by + simp [Landing.index] + +theorem index_lt_length {k r : ℕ} + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) : + ∀ j, P.index j < P.length j := by + induction P with + | nil => + intro j + exact Fin.elim0 j + | node chosen lower ih => + intro j + cases j using Fin.lastCases with + | last => + simp [index, length] + | cast j => + simpa [index, length] using ih j + +theorem tolerance_nonneg {k r : ℕ} + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) (hS : S.IsAdmissible) : + ∀ j n, 0 ≤ P.tolerance j n := by + induction P with + | nil => + intro j + exact Fin.elim0 j + | @node r tolerance budget length next chosen lower ih => + rcases hS with ⟨htolerance, _hbudget, _hlength, hnext⟩ + intro j n + cases j using Fin.lastCases with + | last => + simpa using htolerance n + | cast j => + simpa using ih (hnext chosen) j n + +theorem budget_spec {k r : ℕ} + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) (hS : S.IsAdmissible) : + ∀ j n, + (Fintype.card (OrderedFace k (j.1 + 1)) : ℝ) < + (P.budget j n : ℝ) * (P.tolerance j n) ^ 2 := by + induction P with + | nil => + intro j + exact Fin.elim0 j + | @node r tolerance budget length next chosen lower ih => + rcases hS with ⟨_htolerance, hbudget, _hlength, hnext⟩ + intro j n + cases j using Fin.lastCases with + | last => + change + (Fintype.card (OrderedFace k (r + 1)) : ℝ) < + ((Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).budget (Fin.last r) n : ℕ) * + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).tolerance (Fin.last r) n ^ 2 + rw [budget_node_last, tolerance_node_last] + exact hbudget n + | cast j => + change + (Fintype.card (OrderedFace k (j.1 + 1)) : ℝ) < + ((Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).budget j.castSucc n : ℕ) * + (Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower).tolerance j.castSucc n ^ 2 + rw [budget_node_castSucc, tolerance_node_castSucc] + exact ih (hnext chosen) j n + +theorem length_pos {k r : ℕ} + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) (hS : S.IsAdmissible) : + ∀ j, 0 < P.length j := by + induction P with + | nil => + intro j + exact Fin.elim0 j + | @node r tolerance budget length next chosen lower ih => + rcases hS with ⟨_htolerance, _hbudget, hlength, hnext⟩ + intro j + cases j using Fin.lastCases with + | last => + simpa using hlength + | cast j => + simpa using ih (hnext chosen) j + +end Landing + +structure Realization + {G : Type*} [Fintype G] [DecidableEq G] + (k r : ℕ) + (initial : OrderedPartitionComplex G k r) + (S : AdaptiveCoarseTargetSchedule k r) where + landing : S.Landing + certificate : + CoarseTargetOrderedComplexRegularityCertificate + G k r initial + landing.tolerance landing.budget landing.length + index_eq : certificate.index = landing.index + +theorem Realization.nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (S : AdaptiveCoarseTargetSchedule k r) + (hS : S.IsAdmissible) : + Nonempty (Realization k r initial S) := by + induction r with + | zero => + cases S with + | nil => + let landing : + (AdaptiveCoarseTargetSchedule.nil : + AdaptiveCoarseTargetSchedule k 0).Landing := + Landing.nil + let certificate : + CoarseTargetOrderedComplexRegularityCertificate + G k 0 initial + landing.tolerance landing.budget landing.length := { + index := landing.index + coarse := initial + fine := initial + refines := + OrderedPartitionComplex.Refines.refl initial + coarse_refines_initial := + OrderedPartitionComplex.Refines.refl initial + coarse_topLayer_eq := rfl + fine_topLayer_eq := rfl + index_lt := fun j => Fin.elim0 j + mixedRegular := fun j => Fin.elim0 j + gap_nonneg := fun j => Fin.elim0 j + gap_le := fun j => Fin.elim0 j + coarse_complexity := fun j => Fin.elim0 j + fine_complexity := fun j => Fin.elim0 j } + exact ⟨{ + landing := landing + certificate := certificate + index_eq := rfl }⟩ + | succ r ih => + cases S with + | @node _ tolerance budget length next => + rcases hS with + ⟨htolerance, hbudget, hlength, hnext⟩ + let lowerInitial : + OrderedFacePartitionSystem G k r := + initial.dropTop.topLayer + let upper : + OrderedFacePartitionSystem G k (r + 1) := + initial.topLayer + let topChoice := + chosenFixedUpperLayerCoarseFine + lowerInitial upper tolerance budget + htolerance hbudget length hlength + let chosen : Fin length := + ⟨topChoice.index, topChoice.index_lt⟩ + let prepared : + OrderedPartitionComplex G k r := + initial.dropTop.withTopLayer topChoice.coarse + obtain ⟨lowerRealization⟩ := + ih prepared (next chosen) (hnext chosen) + let lowerLanding := lowerRealization.landing + let lowerCertificate := lowerRealization.certificate + have hindexLower : + lowerCertificate.index = lowerLanding.index := + lowerRealization.index_eq + let landing : + (AdaptiveCoarseTargetSchedule.node + tolerance budget length next).Landing := + Landing.node + (tolerance := tolerance) (budget := budget) + chosen lowerLanding + let coarsePrefix : + OrderedPartitionComplex G k r := + lowerCertificate.coarse + let finePrefix : + OrderedPartitionComplex G k r := + lowerCertificate.fine.withTopLayer topChoice.fine + let coarse : + OrderedPartitionComplex G k (r + 1) := + coarsePrefix.appendTop upper + let fine : + OrderedPartitionComplex G k (r + 1) := + finePrefix.appendTop upper + have hlowerFineTop : + lowerCertificate.fine.topLayer = + topChoice.coarse := by + calc + lowerCertificate.fine.topLayer = + prepared.topLayer := + lowerCertificate.fine_topLayer_eq + _ = topChoice.coarse := + OrderedPartitionComplex.topLayer_withTopLayer + initial.dropTop topChoice.coarse + have hlowerCoarseTop : + lowerCertificate.coarse.topLayer = + topChoice.coarse := by + calc + lowerCertificate.coarse.topLayer = + prepared.topLayer := + lowerCertificate.coarse_topLayer_eq + _ = topChoice.coarse := + OrderedPartitionComplex.topLayer_withTopLayer + initial.dropTop topChoice.coarse + let certificate : + CoarseTargetOrderedComplexRegularityCertificate + G k (r + 1) initial + landing.tolerance landing.budget landing.length := { + index := landing.index + coarse := coarse + fine := fine + refines := by + have hprefix : + finePrefix.Refines coarsePrefix := by + intro q e + cases q using Fin.lastCases with + | last => + simp only [finePrefix, coarsePrefix, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last] + change OrderedFace k r at e + have heq : + lowerCertificate.coarse.partition + (Fin.last r) e = + topChoice.coarse e := + congrFun hlowerCoarseTop e + rw [heq] + exact topChoice.refines e + | cast i => + simp only [finePrefix, coarsePrefix, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc] + exact lowerCertificate.refines + i.castSucc e + exact OrderedPartitionComplex.appendTop_refines + hprefix + (OrderedFacePartitionRefines.refl upper) + coarse_refines_initial := by + have hprepared : + prepared.Refines initial.dropTop := by + exact + OrderedPartitionComplex.withTopLayer_refines + initial.dropTop topChoice.coarse + (by + simpa only [lowerInitial] using + topChoice.coarse_refines_initial) + have hprefix : + coarsePrefix.Refines initial.dropTop := + OrderedPartitionComplex.Refines.trans + lowerCertificate.coarse_refines_initial + hprepared + have happend := + OrderedPartitionComplex.appendTop_refines + hprefix + (OrderedFacePartitionRefines.refl upper) + simpa [coarse, coarsePrefix, upper] using happend + coarse_topLayer_eq := by + simp [coarse, upper] + fine_topLayer_eq := by + simp [fine, upper] + index_lt := by + exact landing.index_lt_length + mixedRegular := by + intro q + cases q using Fin.lastCases with + | last => + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, Fin.succ_last] + change + IsPreliminaryOrderedRegular + topChoice.fine upper + (landing.tolerance (Fin.last r) + (landing.index (Fin.last r))) + simpa [landing, chosen] using + topChoice.fine_regular + | cast i => + have hregular := + lowerCertificate.mixedRegular i + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, Fin.succ_castSucc] + change + @IsPreliminaryOrderedRegular + G _ _ k i.1 + (lowerCertificate.fine.partition + i.castSucc) + (lowerCertificate.coarse.partition + i.succ) + (landing.tolerance i.castSucc + (landing.index i.castSucc)) + rw [show landing.tolerance i.castSucc = + lowerLanding.tolerance i by + simp [landing]] + rw [show landing.index i.castSucc = + lowerLanding.index i by + simp [landing]] + rw [← congrFun hindexLower i] + exact hregular + gap_nonneg := by + intro q + cases q using Fin.lastCases with + | last => + have hgap := topChoice.gap_nonneg + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, Fin.succ_last] + change + 0 ≤ + orderedLayerAtomEnergy + topChoice.fine upper - + orderedLayerAtomEnergy + lowerCertificate.coarse.topLayer + upper + rw [hlowerCoarseTop] + exact hgap + | cast i => + have hgap := + lowerCertificate.gap_nonneg i + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, Fin.succ_castSucc] + convert hgap using 1 + gap_le := by + intro q + cases q using Fin.lastCases with + | last => + have hgap := topChoice.gap_le + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, Fin.succ_last] + change + orderedLayerAtomEnergy + topChoice.fine upper - + orderedLayerAtomEnergy + lowerCertificate.coarse.topLayer + upper ≤ + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) / + (landing.length (Fin.last r) : ℝ) + rw [hlowerCoarseTop] + simpa [landing] using hgap + | cast i => + have hgap := + lowerCertificate.gap_le i + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, Fin.succ_castSucc] + change + orderedLayerAtomEnergy + (lowerCertificate.fine.partition + i.castSucc) + (lowerCertificate.coarse.partition + i.succ) - + orderedLayerAtomEnergy + (lowerCertificate.coarse.partition + i.castSucc) + (lowerCertificate.coarse.partition + i.succ) ≤ + (Fintype.card + (OrderedFace k (i.1 + 1)) : ℝ) / + (landing.length i.castSucc : ℝ) + rw [show landing.length i.castSucc = + lowerLanding.length i by + simp [landing]] + exact hgap + coarse_complexity := by + intro q + cases q using Fin.lastCases with + | last => + intro e + change OrderedFace k r at e + have hcomplexity := + topChoice.coarse_complexity e + simp only [coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc] + change + FacePartition.complexity + (lowerCertificate.coarse.partition + (Fin.last r) e) ≤ + fixedUpperLayerComplexityFactor + r (landing.budget (Fin.last r)) + (landing.index (Fin.last r)) * + FacePartition.complexity + (initial.partition + (Fin.last r).castSucc e) + have heq : + lowerCertificate.coarse.partition + (Fin.last r) e = + topChoice.coarse e := + congrFun hlowerCoarseTop e + rw [heq] + simp only [landing, chosen, + Landing.budget_node_last, + Landing.index_node_last] + convert hcomplexity using 1; rfl + | cast i => + intro e + change OrderedFace k i.1 at e + have hcomplexity := + lowerCertificate.coarse_complexity i e + simp only [coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc] + change + FacePartition.complexity + (lowerCertificate.coarse.partition + i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (landing.budget i.castSucc) + (landing.index i.castSucc) * + FacePartition.complexity + (initial.partition + i.castSucc.castSucc e) + rw [show landing.budget i.castSucc = + lowerLanding.budget i by + simp [landing]] + rw [show landing.index i.castSucc = + lowerLanding.index i by + simp [landing]] + rw [← congrFun hindexLower i] + simp only [prepared, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + OrderedPartitionComplex.dropTop] at hcomplexity + convert hcomplexity using 1 + fine_complexity := by + intro q + cases q using Fin.lastCases with + | last => + intro e + change OrderedFace k r at e + have hcomplexity := + topChoice.fine_complexity e + simp only [fine, finePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last] + change + FacePartition.complexity + (topChoice.fine e) ≤ + fixedUpperLayerComplexityFactor + r (landing.budget (Fin.last r)) + (landing.index (Fin.last r) + 1) * + FacePartition.complexity + (initial.partition + (Fin.last r).castSucc e) + simp only [landing, chosen, + Landing.budget_node_last, + Landing.index_node_last] + convert hcomplexity using 1 + rfl + | cast i => + intro e + change OrderedFace k i.1 at e + have hcomplexity := + lowerCertificate.fine_complexity i e + simp only [fine, finePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc] + change + FacePartition.complexity + (lowerCertificate.fine.partition + i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (landing.budget i.castSucc) + (landing.index i.castSucc + 1) * + FacePartition.complexity + (initial.partition + i.castSucc.castSucc e) + rw [show landing.budget i.castSucc = + lowerLanding.budget i by + simp [landing]] + rw [show landing.index i.castSucc = + lowerLanding.index i by + simp [landing]] + rw [← congrFun hindexLower i] + simp only [prepared, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + OrderedPartitionComplex.dropTop] at hcomplexity + convert hcomplexity using 1 } + exact ⟨{ + landing := landing + certificate := certificate + index_eq := rfl }⟩ + +theorem exists_landing_certificate + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (S : AdaptiveCoarseTargetSchedule k r) + (hS : S.IsAdmissible) : + ∃ P : S.Landing, + ∃ R : + CoarseTargetOrderedComplexRegularityCertificate + G k r initial P.tolerance P.budget P.length, + R.index = P.index := by + obtain ⟨realization⟩ := + Realization.nonempty initial S hS + exact + ⟨realization.landing, realization.certificate, + realization.index_eq⟩ + +end AdaptiveCoarseTargetSchedule + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/BooleanCutReduction.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/BooleanCutReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a2f4291e28c0223cf3694d80f22340003c2e0a2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/BooleanCutReduction.lean @@ -0,0 +1,1346 @@ +import Mathlib.Algebra.BigOperators.Fin +import Mathlib.Data.Fin.Tuple.Basic +import Mathlib.Data.Int.Lemmas +import Mathlib.Data.ZMod.Units +import Mathlib.RingTheory.Int.Basic +import OAI.Combinatorics.Progressions.FixedDensity.PolynomialApproximation +import OAI.Combinatorics.Progressions.FixedDensity.SimplexTelescoping + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def eraseCoordinate {G : Type*} {r : ℕ} + (i : Fin r) (x : Fin r → G) : Fin (r - 1) → G := by + cases r with + | zero => exact Fin.elim0 i + | succ n => exact fun j => x (i.succAbove j) + +@[simp] +theorem eraseCoordinate_apply {G : Type*} {n : ℕ} + (i : Fin (n + 1)) (x : Fin (n + 1) → G) (j : Fin n) : + eraseCoordinate i x j = x (i.succAbove j) := + rfl + +theorem eraseCoordinate_eq_removeNth + {G : Type*} {n : ℕ} + (i : Fin (n + 1)) (x : Fin (n + 1) → G) : + eraseCoordinate i x = Fin.removeNth i x := + rfl + +@[simp] +theorem eraseCoordinate_insertNth {G : Type*} {n : ℕ} + (i : Fin (n + 1)) (a : G) (x : Fin n → G) : + eraseCoordinate i (Fin.insertNth i a x) = x := by + funext j + simp only [eraseCoordinate_apply, Fin.insertNth_apply_succAbove] + +abbrev CutTestFamily (G : Type*) (r : ℕ) := + (i : Fin r) → (Fin (r - 1) → G) → ℝ + +def IsBoundedCutTest {G : Type*} {r : ℕ} + (u : CutTestFamily G r) : Prop := + (∀ i x, 0 ≤ u i x) ∧ (∀ i x, u i x ≤ 1) + +theorem IsBoundedCutTest.nonneg + {G : Type*} {r : ℕ} {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) : + ∀ i x, 0 ≤ u i x := + hu.1 + +theorem IsBoundedCutTest.le_one + {G : Type*} {r : ℕ} {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) : + ∀ i x, u i x ≤ 1 := + hu.2 + +theorem isBoundedCutTest_const + {G : Type*} {r : ℕ} {c : ℝ} + (hc0 : 0 ≤ c) (hc1 : c ≤ 1) : + IsBoundedCutTest (fun _ : Fin r => fun _ : Fin (r - 1) → G => c) := + ⟨fun _ _ => hc0, fun _ _ => hc1⟩ + +@[simp] +theorem isBoundedCutTest_zero + {G : Type*} {r : ℕ} : + IsBoundedCutTest + (fun _ : Fin r => fun _ : Fin (r - 1) → G => (0 : ℝ)) := + isBoundedCutTest_const (by positivity) (by norm_num) + +@[simp] +theorem isBoundedCutTest_one + {G : Type*} {r : ℕ} : + IsBoundedCutTest + (fun _ : Fin r => fun _ : Fin (r - 1) → G => (1 : ℝ)) := + isBoundedCutTest_const (by positivity) le_rfl + +theorem IsBoundedCutTest.mono + {G : Type*} {r : ℕ} {u v : CutTestFamily G r} + (hu : IsBoundedCutTest u) + (hv0 : ∀ i x, 0 ≤ v i x) + (hvu : ∀ i x, v i x ≤ u i x) : + IsBoundedCutTest v := + ⟨hv0, fun i x => (hvu i x).trans (hu.le_one i x)⟩ + +theorem IsBoundedCutTest.mul + {G : Type*} {r : ℕ} {u v : CutTestFamily G r} + (hu : IsBoundedCutTest u) (hv : IsBoundedCutTest v) : + IsBoundedCutTest (fun i x => u i x * v i x) := by + constructor + · exact fun i x => mul_nonneg (hu.nonneg i x) (hv.nonneg i x) + · exact fun coordinate point => + (mul_le_of_le_one_left (hv.nonneg coordinate point) + (hu.le_one coordinate point)).trans (hv.le_one coordinate point) + +noncomputable def cutCorrelation + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f g : G → ℝ) (u : CutTestFamily G r) : ℝ := + mean fun x : Fin r → G => + (f (∑ i, x i) - g (∑ i, x i)) * + ∏ i, u i (eraseCoordinate i x) + +def CutDiscrepancyLe + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f g : G → ℝ) (ε : ℝ) : Prop := + ∀ u : CutTestFamily G r, + (∀ i x, 0 ≤ u i x) → + (∀ i x, u i x ≤ 1) → + |cutCorrelation r f g u| ≤ ε + +theorem CutDiscrepancyLe.apply_bounded + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g : G → ℝ} {ε : ℝ} + (h : CutDiscrepancyLe r f g ε) + (u : CutTestFamily G r) (hu : IsBoundedCutTest u) : + |cutCorrelation r f g u| ≤ ε := + h u hu.nonneg hu.le_one + +@[simp] +theorem cutCorrelation_self + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f : G → ℝ) (u : CutTestFamily G r) : + cutCorrelation r f f u = 0 := by + simp [cutCorrelation] + +theorem cutCorrelation_swap + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f g : G → ℝ) (u : CutTestFamily G r) : + cutCorrelation r g f u = -cutCorrelation r f g u := by + calc + cutCorrelation r g f u = + mean (fun x : Fin r → G => + (-1 : ℝ) * + ((f (∑ i, x i) - g (∑ i, x i)) * + ∏ i, u i (eraseCoordinate i x))) := by + apply congrArg mean + funext x + ring + _ = (-1 : ℝ) * + mean (fun x : Fin r → G => + (f (∑ i, x i) - g (∑ i, x i)) * + ∏ i, u i (eraseCoordinate i x)) := + mean_smul _ _ + _ = -cutCorrelation r f g u := by + simp [cutCorrelation] + +theorem cutCorrelation_add_middle + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f g h : G → ℝ) (u : CutTestFamily G r) : + cutCorrelation r f h u = + cutCorrelation r f g u + cutCorrelation r g h u := by + rw [cutCorrelation, cutCorrelation, cutCorrelation, ← mean_add] + apply congrArg mean + funext x + ring + +theorem CutDiscrepancyLe.mono + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g : G → ℝ} {ε ε' : ℝ} + (h : CutDiscrepancyLe r f g ε) (hε : ε ≤ ε') : + CutDiscrepancyLe r f g ε' := by + intro u hu0 hu1 + exact (h u hu0 hu1).trans hε + +theorem CutDiscrepancyLe.refl + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f : G → ℝ) : + CutDiscrepancyLe r f f 0 := by + intro u _ _ + simp + +theorem CutDiscrepancyLe.refl_of_nonneg + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f : G → ℝ) {ε : ℝ} (hε : 0 ≤ ε) : + CutDiscrepancyLe r f f ε := + (CutDiscrepancyLe.refl r f).mono hε + +theorem CutDiscrepancyLe.of_eq + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g : G → ℝ} (hfg : f = g) : + CutDiscrepancyLe r f g 0 := by + subst g + exact CutDiscrepancyLe.refl r f + +theorem CutDiscrepancyLe.symm + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g : G → ℝ} {ε : ℝ} + (h : CutDiscrepancyLe r f g ε) : + CutDiscrepancyLe r g f ε := by + intro u hu0 hu1 + rw [cutCorrelation_swap, abs_neg] + exact h u hu0 hu1 + +theorem CutDiscrepancyLe.triangle + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g h : G → ℝ} {ε δ : ℝ} + (hfg : CutDiscrepancyLe r f g ε) + (hgh : CutDiscrepancyLe r g h δ) : + CutDiscrepancyLe r f h (ε + δ) := by + intro u hu0 hu1 + calc + |cutCorrelation r f h u| = + |cutCorrelation r f g u + cutCorrelation r g h u| := by + rw [cutCorrelation_add_middle] + _ ≤ |cutCorrelation r f g u| + |cutCorrelation r g h u| := + abs_add_le _ _ + _ ≤ ε + δ := + add_le_add (hfg u hu0 hu1) (hgh u hu0 hu1) + +theorem CutDiscrepancyLe.epsilon_nonneg + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g : G → ℝ} {ε : ℝ} + (h : CutDiscrepancyLe r f g ε) : + 0 ≤ ε := by + exact (abs_nonneg (cutCorrelation r f g + (fun _ : Fin r => fun _ : Fin (r - 1) → G => (1 : ℝ)))).trans + (h (fun _ : Fin r => fun _ : Fin (r - 1) → G => (1 : ℝ)) + (fun _ _ => by norm_num) (fun _ _ => le_rfl)) + +theorem mean_add_right + {G : Type*} [Fintype G] [AddCommGroup G] + (h : G → ℝ) (c : G) : + mean (fun x => h (x + c)) = mean h := by + unfold mean + exact Fintype.expect_equiv (Equiv.addRight c) + (fun x => h (x + c)) h (fun _ => rfl) + +theorem mean_sum_fin_succ + {G : Type*} [Fintype G] [AddCommGroup G] + (n : ℕ) (h : G → ℝ) : + mean (fun x : Fin (n + 1) → G => h (∑ i, x i)) = mean h := by + calc + mean (fun x : Fin (n + 1) → G => h (∑ i, x i)) = + mean (fun p : G × (Fin n → G) => + h (p.1 + ∑ i, p.2 i)) := by + unfold mean + apply Fintype.expect_equiv + (Fin.insertNthEquiv (fun _ : Fin (n + 1) => G) 0).symm + intro x + congr 1 + rw [Fin.sum_univ_succ] + rfl + _ = mean₂ (fun a : G => fun y : Fin n → G => + h (a + ∑ i, y i)) := by + simpa [mean, mean₂] using + (Finset.expect_product (Finset.univ : Finset G) + (Finset.univ : Finset (Fin n → G)) + (fun p : G × (Fin n → G) => h (p.1 + ∑ i, p.2 i))) + _ = mean₂ (fun y : Fin n → G => fun a : G => + h (a + ∑ i, y i)) := mean₂_comm _ + _ = mean (fun _ : Fin n → G => mean h) := by + apply congrArg mean + funext y + exact mean_add_right h (∑ i, y i) + _ = mean h := mean_const _ + +theorem mean_sum_fin_of_pos + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} (hr : 0 < r) (h : G → ℝ) : + mean (fun x : Fin r → G => h (∑ i, x i)) = mean h := by + cases r with + | zero => simp at hr + | succ n => exact mean_sum_fin_succ n h + +@[simp] +theorem cutCorrelation_one + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f g : G → ℝ) : + cutCorrelation r f g + (fun _ : Fin r => fun _ : Fin (r - 1) → G => (1 : ℝ)) = + mean (fun x : Fin r → G => + f (∑ i, x i) - g (∑ i, x i)) := by + simp [cutCorrelation] + +theorem cutCorrelation_one_eq_mean_sub + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} (hr : 0 < r) (f g : G → ℝ) : + cutCorrelation r f g + (fun _ : Fin r => fun _ : Fin (r - 1) → G => (1 : ℝ)) = + mean f - mean g := by + calc + cutCorrelation r f g + (fun _ : Fin r => fun _ : Fin (r - 1) → G => (1 : ℝ)) = + mean (fun x : Fin r → G => + f (∑ i, x i) - g (∑ i, x i)) := + cutCorrelation_one r f g + _ = mean (fun z : G => f z - g z) := + mean_sum_fin_of_pos hr (fun z => f z - g z) + _ = mean f - mean g := mean_sub f g + +theorem CutDiscrepancyLe.abs_mean_sub_le + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g : G → ℝ} {ε : ℝ} + (h : CutDiscrepancyLe r f g ε) (hr : 0 < r) : + |mean f - mean g| ≤ ε := by + have hone := h + (fun _ : Fin r => fun _ : Fin (r - 1) → G => (1 : ℝ)) + (fun _ _ => by norm_num) (fun _ _ => le_rfl) + simpa [cutCorrelation_one_eq_mean_sub hr f g] using hone + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def mulAddEquivOfIsUnit + {R : Type*} [CommRing R] (a : R) (ha : IsUnit a) : + R ≃+ R := + DistribMulAction.toAddEquiv R ha.unit + +@[simp] +theorem mulAddEquivOfIsUnit_apply + {R : Type*} [CommRing R] (a : R) (ha : IsUnit a) + (x : R) : + mulAddEquivOfIsUnit a ha x = a * x := by + change (ha.unit : R) * x = a * x + rw [IsUnit.unit_spec] + +def coordinatewiseAddEquiv + {ι G : Type*} [AddCommGroup G] (e : ι → G ≃+ G) : + (ι → G) ≃ (ι → G) where + toFun x i := e i (x i) + invFun x i := (e i).symm (x i) + left_inv x := by + funext i + exact (e i).symm_apply_apply (x i) + right_inv x := by + funext i + exact (e i).apply_symm_apply (x i) + +@[simp] +theorem coordinatewiseAddEquiv_apply + {ι G : Type*} [AddCommGroup G] (e : ι → G ≃+ G) + (x : ι → G) (i : ι) : + coordinatewiseAddEquiv e x i = e i (x i) := + rfl + +@[simp] +theorem coordinatewiseAddEquiv_symm_apply + {ι G : Type*} [AddCommGroup G] (e : ι → G ≃+ G) + (x : ι → G) (i : ι) : + (coordinatewiseAddEquiv e).symm x i = + (e i).symm (x i) := + rfl + +def pullCutTest + {G : Type*} [AddCommGroup G] {r : ℕ} + (e : Fin r → G ≃+ G) (u : CutTestFamily G r) : + CutTestFamily G r := by + cases r with + | zero => + exact fun i => Fin.elim0 i + | succ n => + exact fun i y => + u i (fun t => (e (i.succAbove t)).symm (y t)) + +theorem IsBoundedCutTest.pull + {G : Type*} [AddCommGroup G] {r : ℕ} + {e : Fin r → G ≃+ G} {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) : + IsBoundedCutTest (pullCutTest e u) := by + constructor + · intro i x + cases r with + | zero => exact Fin.elim0 i + | succ n => + exact hu.nonneg i + (fun t => (e (i.succAbove t)).symm (x t)) + · intro i x + cases r with + | zero => exact Fin.elim0 i + | succ n => + exact hu.le_one i + (fun t => (e (i.succAbove t)).symm (x t)) + +noncomputable def linearCutCorrelation + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (e : Fin r → G ≃+ G) + (f g : G → ℝ) (u : CutTestFamily G r) : ℝ := + mean fun x : Fin r → G => + (f (∑ i, e i (x i)) - + g (∑ i, e i (x i))) * + ∏ i, u i (eraseCoordinate i x) + +theorem linearCutCorrelation_eq_cutCorrelation + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (e : Fin r → G ≃+ G) + (f g : G → ℝ) (u : CutTestFamily G r) : + linearCutCorrelation r e f g u = + cutCorrelation r f g (pullCutTest e u) := by + cases r with + | zero => + simp [linearCutCorrelation, cutCorrelation, pullCutTest] + | succ n => + unfold linearCutCorrelation cutCorrelation mean + apply Fintype.expect_equiv (coordinatewiseAddEquiv e) + intro x + congr 1 + apply Finset.prod_congr rfl + intro i _ + change + u i (eraseCoordinate i x) = + u i (fun t => + (e (i.succAbove t)).symm + (eraseCoordinate i + (coordinatewiseAddEquiv e x) t)) + congr 1 + funext t + simp + +theorem CutDiscrepancyLe.abs_linearCutCorrelation_le + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g : G → ℝ} {ε : ℝ} + (h : CutDiscrepancyLe r f g ε) + (e : Fin r → G ≃+ G) + (u : CutTestFamily G r) (hu : IsBoundedCutTest u) : + |linearCutCorrelation r e f g u| ≤ ε := by + rw [linearCutCorrelation_eq_cutCorrelation] + exact h.apply_bounded (pullCutTest e u) hu.pull + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def sumFiberTuple {G : Type*} [AddCommGroup G] + (n : ℕ) (z : G) (y : Fin n → G) : Fin (n + 1) → G := + Fin.cons (z - ∑ i, y i) y + +@[simp] +theorem sumFiberTuple_zero {G : Type*} [AddCommGroup G] + (n : ℕ) (z : G) (y : Fin n → G) : + sumFiberTuple n z y 0 = z - ∑ i, y i := + rfl + +@[simp] +theorem sumFiberTuple_succ {G : Type*} [AddCommGroup G] + (n : ℕ) (z : G) (y : Fin n → G) (i : Fin n) : + sumFiberTuple n z y i.succ = y i := + rfl + +@[simp] +theorem sum_sumFiberTuple {G : Type*} [AddCommGroup G] + (n : ℕ) (z : G) (y : Fin n → G) : + ∑ i, sumFiberTuple n z y i = z := by + simp [sumFiberTuple, Fin.sum_univ_succ] + +def sumFiberEquiv (G : Type*) [AddCommGroup G] (n : ℕ) : + (Fin (n + 1) → G) ≃ G × (Fin n → G) where + toFun x := (∑ i, x i, Fin.tail x) + invFun p := sumFiberTuple n p.1 p.2 + left_inv x := by + funext i + refine Fin.cases ?_ (fun j => ?_) i + · change (∑ k, x k) - ∑ j, Fin.tail x j = x 0 + rw [Fin.sum_univ_succ] + change x 0 + (∑ j : Fin n, x j.succ) - + ∑ j : Fin n, x j.succ = x 0 + abel + · rfl + right_inv p := by + apply Prod.ext + · exact sum_sumFiberTuple n p.1 p.2 + · funext j + rfl + +noncomputable def zeroFiberDelta + {G : Type*} [Fintype G] [AddCommGroup G] (z : G) : ℝ := by + classical + exact if z = 0 then (Fintype.card G : ℝ) else 0 + +@[simp] +theorem zeroFiberDelta_zero + {G : Type*} [Fintype G] [AddCommGroup G] : + zeroFiberDelta (G := G) 0 = Fintype.card G := by + classical + simp [zeroFiberDelta] + +@[simp] +theorem zeroFiberDelta_of_ne + {G : Type*} [Fintype G] [AddCommGroup G] + {z : G} (hz : z ≠ 0) : + zeroFiberDelta z = 0 := by + classical + simp [zeroFiberDelta, hz] + +theorem zeroFiberDelta_nonneg + {G : Type*} [Fintype G] [AddCommGroup G] (z : G) : + 0 ≤ zeroFiberDelta z := by + classical + simp only [zeroFiberDelta] + split_ifs + · positivity + · exact le_rfl + +noncomputable def fiberConvolution + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (w : (Fin r → G) → ℝ) (z : G) : ℝ := by + cases r with + | zero => + exact zeroFiberDelta z * w (fun i => Fin.elim0 i) + | succ n => + exact mean fun y : Fin n → G => w (sumFiberTuple n z y) + +@[simp] +theorem fiberConvolution_arity_zero + {G : Type*} [Fintype G] [AddCommGroup G] + (w : (Fin 0 → G) → ℝ) (z : G) : + fiberConvolution 0 w z = + zeroFiberDelta z * w (fun i => Fin.elim0 i) := + rfl + +@[simp] +theorem fiberConvolution_succ + {G : Type*} [Fintype G] [AddCommGroup G] + (n : ℕ) (w : (Fin (n + 1) → G) → ℝ) (z : G) : + fiberConvolution (n + 1) w z = + mean fun y : Fin n → G => w (sumFiberTuple n z y) := + rfl + +def cutTestProduct {G : Type*} {r : ℕ} + (u : CutTestFamily G r) (x : Fin r → G) : ℝ := + ∏ i, u i (eraseCoordinate i x) + +@[simp] +theorem cutTestProduct_one {G : Type*} {r : ℕ} (x : Fin r → G) : + cutTestProduct + (fun _ : Fin r => fun _ : Fin (r - 1) → G => (1 : ℝ)) x = 1 := by + simp [cutTestProduct] + +theorem cutTestProduct_nonneg + {G : Type*} {r : ℕ} {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) (x : Fin r → G) : + 0 ≤ cutTestProduct u x := + Finset.prod_nonneg fun i _ => hu.nonneg i (eraseCoordinate i x) + +theorem cutTestProduct_le_one + {G : Type*} {r : ℕ} {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) (x : Fin r → G) : + cutTestProduct u x ≤ 1 := + Finset.prod_le_one₀ + (fun i _ => hu.nonneg i (eraseCoordinate i x)) + (fun i _ => hu.le_one i (eraseCoordinate i x)) + +theorem cutTestProduct_mem_Icc + {G : Type*} {r : ℕ} {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) (x : Fin r → G) : + cutTestProduct u x ∈ Set.Icc (0 : ℝ) 1 := + ⟨cutTestProduct_nonneg hu x, cutTestProduct_le_one hu x⟩ + +@[simp] +theorem cutTestProduct_mul + {G : Type*} {r : ℕ} (u v : CutTestFamily G r) + (x : Fin r → G) : + cutTestProduct (fun i y => u i y * v i y) x = + cutTestProduct u x * cutTestProduct v x := by + simp [cutTestProduct, Finset.prod_mul_distrib] + +noncomputable def generalizedConvolution + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (u : CutTestFamily G r) (z : G) : ℝ := + fiberConvolution r (cutTestProduct u) z + +@[simp] +theorem generalizedConvolution_arity_zero + {G : Type*} [Fintype G] [AddCommGroup G] + (u : CutTestFamily G 0) (z : G) : + generalizedConvolution 0 u z = zeroFiberDelta z := by + simp [generalizedConvolution, cutTestProduct] + +@[simp] +theorem generalizedConvolution_succ + {G : Type*} [Fintype G] [AddCommGroup G] + (n : ℕ) (u : CutTestFamily G (n + 1)) (z : G) : + generalizedConvolution (n + 1) u z = + mean fun y : Fin n → G => + cutTestProduct u (sumFiberTuple n z y) := + rfl + +theorem fiberConvolution_add + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (w v : (Fin r → G) → ℝ) (z : G) : + fiberConvolution r (w + v) z = + fiberConvolution r w z + fiberConvolution r v z := by + cases r with + | zero => + rw [fiberConvolution_arity_zero, fiberConvolution_arity_zero, + fiberConvolution_arity_zero] + simp [mul_add] + | succ n => + rw [fiberConvolution_succ, fiberConvolution_succ, + fiberConvolution_succ] + exact mean_add + (fun y : Fin n → G => w (sumFiberTuple n z y)) + (fun y : Fin n → G => v (sumFiberTuple n z y)) + +theorem fiberConvolution_smul + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (c : ℝ) (w : (Fin r → G) → ℝ) (z : G) : + fiberConvolution r (fun x => c * w x) z = + c * fiberConvolution r w z := by + cases r with + | zero => + rw [fiberConvolution_arity_zero, fiberConvolution_arity_zero] + ring + | succ n => + rw [fiberConvolution_succ, fiberConvolution_succ] + exact mean_smul c (fun y : Fin n → G => + w (sumFiberTuple n z y)) + +@[simp] +theorem fiberConvolution_zero_weight + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (z : G) : + fiberConvolution r (fun _ => (0 : ℝ)) z = 0 := by + simpa using fiberConvolution_smul r 0 (fun _ => (1 : ℝ)) z + +@[simp] +theorem fiberConvolution_const_succ + {G : Type*} [Fintype G] [AddCommGroup G] + (n : ℕ) (c : ℝ) (z : G) : + fiberConvolution (n + 1) (fun _ => c) z = c := by + rw [fiberConvolution_succ] + exact mean_const c + +theorem fiberConvolution_linearCombination + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (a b : ℝ) (w v : (Fin r → G) → ℝ) (z : G) : + fiberConvolution r (fun x => a * w x + b * v x) z = + a * fiberConvolution r w z + b * fiberConvolution r v z := by + change fiberConvolution r + ((fun x => a * w x) + (fun x => b * v x)) z = _ + rw [fiberConvolution_add, fiberConvolution_smul, + fiberConvolution_smul] + +theorem fiberConvolution_nonneg_succ + {G : Type*} [Fintype G] [AddCommGroup G] + {n : ℕ} {w : (Fin (n + 1) → G) → ℝ} + (hw : ∀ x, 0 ≤ w x) (z : G) : + 0 ≤ fiberConvolution (n + 1) w z := by + rw [fiberConvolution_succ] + exact mean_nonneg fun y => hw (sumFiberTuple n z y) + +theorem fiberConvolution_le_one_succ + {G : Type*} [Fintype G] [AddCommGroup G] + {n : ℕ} {w : (Fin (n + 1) → G) → ℝ} + (hw : ∀ x, w x ≤ 1) (z : G) : + fiberConvolution (n + 1) w z ≤ 1 := by + rw [fiberConvolution_succ] + exact mean_le_of_le_const fun y => hw (sumFiberTuple n z y) + +theorem fiberConvolution_mono_succ + {G : Type*} [Fintype G] [AddCommGroup G] + {n : ℕ} {w v : (Fin (n + 1) → G) → ℝ} + (hwv : ∀ x, w x ≤ v x) (z : G) : + fiberConvolution (n + 1) w z ≤ fiberConvolution (n + 1) v z := by + rw [fiberConvolution_succ, fiberConvolution_succ] + exact mean_mono fun y => hwv (sumFiberTuple n z y) + +theorem generalizedConvolution_nonneg_succ + {G : Type*} [Fintype G] [AddCommGroup G] + {n : ℕ} {u : CutTestFamily G (n + 1)} + (hu : IsBoundedCutTest u) (z : G) : + 0 ≤ generalizedConvolution (n + 1) u z := + fiberConvolution_nonneg_succ (cutTestProduct_nonneg hu) z + +theorem generalizedConvolution_le_one_succ + {G : Type*} [Fintype G] [AddCommGroup G] + {n : ℕ} {u : CutTestFamily G (n + 1)} + (hu : IsBoundedCutTest u) (z : G) : + generalizedConvolution (n + 1) u z ≤ 1 := + fiberConvolution_le_one_succ (cutTestProduct_le_one hu) z + +theorem generalizedConvolution_mem_Icc + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} (hr : 0 < r) {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) (z : G) : + generalizedConvolution r u z ∈ Set.Icc (0 : ℝ) 1 := by + cases r with + | zero => simp at hr + | succ n => + exact ⟨generalizedConvolution_nonneg_succ hu z, + generalizedConvolution_le_one_succ hu z⟩ + +theorem generalizedConvolution_nonneg + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} (hr : 0 < r) {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) (z : G) : + 0 ≤ generalizedConvolution r u z := + (generalizedConvolution_mem_Icc hr hu z).1 + +theorem generalizedConvolution_le_one + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} (hr : 0 < r) {u : CutTestFamily G r} + (hu : IsBoundedCutTest u) (z : G) : + generalizedConvolution r u z ≤ 1 := + (generalizedConvolution_mem_Icc hr hu z).2 + +@[simp] +theorem generalizedConvolution_one_succ + {G : Type*} [Fintype G] [AddCommGroup G] + (n : ℕ) (z : G) : + generalizedConvolution (n + 1) + (fun _ : Fin (n + 1) => fun _ : Fin n → G => (1 : ℝ)) z = 1 := by + rw [generalizedConvolution_succ] + calc + mean (fun y : Fin n → G => + cutTestProduct + (fun _ : Fin (n + 1) => fun _ : Fin n → G => (1 : ℝ)) + (sumFiberTuple n z y)) = + mean (fun _ : Fin n → G => (1 : ℝ)) := by + apply congrArg mean + funext y + exact cutTestProduct_one (sumFiberTuple n z y) + _ = 1 := mean_const 1 + +@[simp] +theorem generalizedConvolution_zero_succ + {G : Type*} [Fintype G] [AddCommGroup G] + (n : ℕ) (z : G) : + generalizedConvolution (n + 1) + (fun _ : Fin (n + 1) => fun _ : Fin n → G => (0 : ℝ)) z = 0 := by + rw [generalizedConvolution_succ] + simp [cutTestProduct] + +theorem fiberConvolution_pairing_zero + {G : Type*} [Fintype G] [AddCommGroup G] + (w : (Fin 0 → G) → ℝ) (h : G → ℝ) : + mean (fun x : Fin 0 → G => h (∑ i, x i) * w x) = + mean (fun z : G => h z * fiberConvolution 0 w z) := by + classical + let e : Fin 0 → G := fun i => Fin.elim0 i + calc + mean (fun x : Fin 0 → G => h (∑ i, x i) * w x) = + h 0 * w e := by + have heq : + (fun x : Fin 0 → G => h (∑ i, x i) * w x) = + (fun _ : Fin 0 → G => h 0 * w e) := by + funext x + have hx : x = e := Subsingleton.elim _ _ + subst x + simp [e] + rw [heq] + exact mean_const _ + _ = mean (fun z : G => h z * fiberConvolution 0 w z) := by + rw [mean, Fintype.expect_eq_sum_div_card] + simp [fiberConvolution_arity_zero, zeroFiberDelta, e] + field_simp + +theorem fiberConvolution_pairing_succ + {G : Type*} [Fintype G] [AddCommGroup G] + (n : ℕ) (w : (Fin (n + 1) → G) → ℝ) (h : G → ℝ) : + mean (fun x : Fin (n + 1) → G => h (∑ i, x i) * w x) = + mean (fun z : G => h z * fiberConvolution (n + 1) w z) := by + calc + mean (fun x : Fin (n + 1) → G => h (∑ i, x i) * w x) = + mean (fun p : G × (Fin n → G) => + h p.1 * w (sumFiberTuple n p.1 p.2)) := by + unfold mean + apply Fintype.expect_equiv (sumFiberEquiv G n) + intro x + change h (∑ i, x i) * w x = + h (∑ i, x i) * + w (sumFiberTuple n (∑ i, x i) (Fin.tail x)) + have hx : sumFiberTuple n (∑ i, x i) (Fin.tail x) = x := + (sumFiberEquiv G n).left_inv x + rw [hx] + _ = mean₂ (fun z : G => fun y : Fin n → G => + h z * w (sumFiberTuple n z y)) := by + simpa [mean, mean₂] using + (Finset.expect_product (Finset.univ : Finset G) + (Finset.univ : Finset (Fin n → G)) + (fun p : G × (Fin n → G) => + h p.1 * w (sumFiberTuple n p.1 p.2))) + _ = mean (fun z : G => + h z * mean (fun y : Fin n → G => + w (sumFiberTuple n z y))) := by + apply congrArg mean + funext z + exact mean_smul (h z) _ + _ = mean (fun z : G => + h z * fiberConvolution (n + 1) w z) := by + rfl + +theorem fiberConvolution_pairing + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (w : (Fin r → G) → ℝ) (h : G → ℝ) : + mean (fun x : Fin r → G => h (∑ i, x i) * w x) = + mean (fun z : G => h z * fiberConvolution r w z) := by + cases r with + | zero => exact fiberConvolution_pairing_zero w h + | succ n => exact fiberConvolution_pairing_succ n w h + +theorem mean_fiberConvolution + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (w : (Fin r → G) → ℝ) : + mean (fiberConvolution r w) = mean w := by + have hpair := fiberConvolution_pairing r w (fun _ : G => (1 : ℝ)) + simpa using hpair.symm + +theorem mean_generalizedConvolution + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (u : CutTestFamily G r) : + mean (generalizedConvolution r u) = mean (cutTestProduct u) := + mean_fiberConvolution r (cutTestProduct u) + +theorem cutCorrelation_eq_mean_mul_generalizedConvolution + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f g : G → ℝ) (u : CutTestFamily G r) : + cutCorrelation r f g u = + mean (fun z : G => + (f z - g z) * generalizedConvolution r u z) := by + exact fiberConvolution_pairing r (cutTestProduct u) + (fun z => f z - g z) + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem apCoefficient_isUnit_of_coprime_factorial + {k N : ℕ} + (hN : Nat.Coprime N (Nat.factorial (k - 1))) + (i j : Fin k) (hij : i ≠ j) : + IsUnit (((i : ℤ) - (j : ℤ) : ℤ) : ZMod N) := by + rw [ZMod.coe_int_isUnit_iff_isCoprime, + Int.isCoprime_iff_nat_coprime] + have hdiff : + (i : ℤ) - (j : ℤ) ≠ 0 := by + intro h + apply hij + apply Fin.ext + exact_mod_cast sub_eq_zero.mp h + have hpos : + 0 < Int.natAbs ((i : ℤ) - (j : ℤ)) := + Int.natAbs_pos.mpr hdiff + have hle : + Int.natAbs ((i : ℤ) - (j : ℤ)) ≤ k - 1 := by + have hi : (i : ℕ) ≤ k - 1 := by omega + have hj : (j : ℕ) ≤ k - 1 := by omega + exact Int.natAbs_coe_sub_coe_le_of_le hi hj + have hdvd : + Int.natAbs ((i : ℤ) - (j : ℤ)) ∣ + Nat.factorial (k - 1) := + Nat.dvd_factorial hpos hle + simpa using hN.coprime_dvd_right hdvd + +noncomputable def apCoefficientAddEquiv + {k N : ℕ} + (hN : Nat.Coprime N (Nat.factorial (k - 1))) + (i j : Fin k) (hij : i ≠ j) : + ZMod N ≃+ ZMod N := + mulAddEquivOfIsUnit + ((((i : ℤ) - (j : ℤ) : ℤ) : ZMod N)) + (apCoefficient_isUnit_of_coprime_factorial hN i j hij) + +@[simp] +theorem apCoefficientAddEquiv_apply + {k N : ℕ} + (hN : Nat.Coprime N (Nat.factorial (k - 1))) + (i j : Fin k) (hij : i ≠ j) (x : ZMod N) : + apCoefficientAddEquiv hN i j hij x = + (((i : ℤ) - (j : ℤ) : ℤ) : ZMod N) * x := by + simp [apCoefficientAddEquiv] + +noncomputable def finSuccAboveEquiv {n : ℕ} (j : Fin (n + 1)) : + Fin n ≃ {i : Fin (n + 1) // i ≠ j} := + Equiv.ofBijective + (fun t : Fin n => ⟨j.succAbove t, Fin.succAbove_ne j t⟩) + ⟨by + intro a b hab + apply Fin.succAbove_right_injective + exact congrArg Subtype.val hab, + by + intro i + obtain ⟨t, ht⟩ := Fin.exists_succAbove_eq i.2 + exact ⟨t, Subtype.ext ht⟩⟩ + +@[simp] +theorem finSuccAboveEquiv_apply_val + {n : ℕ} (j : Fin (n + 1)) (t : Fin n) : + (finSuccAboveEquiv j t).1 = j.succAbove t := + rfl + +noncomputable def finTupleToDeletedVector + {n : ℕ} {G : Type*} + (j : Fin (n + 1)) + (y : Fin n → G) : + DeletedVector (fun _ : Fin (n + 1) => G) j := + fun i => y ((finSuccAboveEquiv j).symm i) + +@[simp] +theorem finTupleToDeletedVector_succAbove + {n : ℕ} {G : Type*} + (j : Fin (n + 1)) + (y : Fin n → G) + (t : Fin n) : + finTupleToDeletedVector j y + (finSuccAboveEquiv j t) = + y t := by + simp [finTupleToDeletedVector] + +theorem apSimplexForm_finTupleToDeletedVector + (n N : ℕ) (j : Fin (n + 1)) + (y : Fin n → ZMod N) : + apSimplexForm (n + 1) N j + (finTupleToDeletedVector j y) = + ∑ t : Fin n, + ((((j.succAbove t : ℤ) - (j : ℤ) : ℤ) : + ZMod N) * y t) := by + rw [apSimplexForm] + symm + exact Fintype.sum_equiv (finSuccAboveEquiv j) + (fun t : Fin n => + ((((j.succAbove t : ℤ) - (j : ℤ) : ℤ) : + ZMod N) * y t)) + (fun i : {i : Fin (n + 1) // i ≠ j} => + ((((i.1 : ℤ) - (j : ℤ) : ℤ) : ZMod N) * + finTupleToDeletedVector j y i)) + (fun t => by simp) + +theorem deleteCoordinate_eq_finTupleToDeletedVector + {n : ℕ} {G : Type*} + (j : Fin (n + 1)) (x : Fin (n + 1) → G) : + deleteCoordinate x j = + finTupleToDeletedVector j + (fun t => x (j.succAbove t)) := by + funext i + change x i.1 = + x (j.succAbove ((finSuccAboveEquiv j).symm i)) + apply congrArg x + have hi := + congrArg Subtype.val + ((finSuccAboveEquiv j).apply_symm_apply i) + exact hi.symm + +theorem apSimplexForm_deleteCoordinate_eq_weightedSum + (n N : ℕ) (j : Fin (n + 1)) + (x : Fin (n + 1) → ZMod N) : + apSimplexForm (n + 1) N j (deleteCoordinate x j) = + ∑ t : Fin n, + ((((j.succAbove t : ℤ) - (j : ℤ) : ℤ) : + ZMod N) * x (j.succAbove t)) := by + rw [deleteCoordinate_eq_finTupleToDeletedVector, + apSimplexForm_finTupleToDeletedVector] + +noncomputable def apFaceScalingEquiv + {n N : ℕ} + (hN : Nat.Coprime N (Nat.factorial n)) + (j : Fin (n + 1)) (t : Fin n) : + ZMod N ≃+ ZMod N := + apCoefficientAddEquiv + (by simpa using hN) (j.succAbove t) j + (Fin.succAbove_ne j t) + +@[simp] +theorem apFaceScalingEquiv_apply + {n N : ℕ} + (hN : Nat.Coprime N (Nat.factorial n)) + (j : Fin (n + 1)) (t : Fin n) (x : ZMod N) : + apFaceScalingEquiv hN j t x = + ((((j.succAbove t : ℤ) - (j : ℤ) : ℤ) : + ZMod N) * x) := by + simp [apFaceScalingEquiv] + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators Polynomial + +def bernoulliAssignmentWeight + {κ : Type*} [Fintype κ] + (p : κ → ℝ) (b : κ → Bool) : ℝ := + ∏ i, if b i then p i else 1 - p i + +def booleanValue {κ : Type*} (b : κ → Bool) (i : κ) : ℝ := + if b i then 1 else 0 + +theorem bernoulliAssignmentWeight_nonneg + {κ : Type*} [Fintype κ] + {p : κ → ℝ} + (hp0 : ∀ i, 0 ≤ p i) (hp1 : ∀ i, p i ≤ 1) + (b : κ → Bool) : + 0 ≤ bernoulliAssignmentWeight p b := by + apply Finset.prod_nonneg + intro i _ + by_cases hi : b i + · simpa [hi] using hp0 i + · simp only [hi, Bool.false_eq_true, + ↓reduceIte] + linarith [hp1 i] + +theorem sum_bernoulliAssignmentWeight + {κ : Type*} [Fintype κ] [DecidableEq κ] + (p : κ → ℝ) : + ∑ b : κ → Bool, bernoulliAssignmentWeight p b = 1 := by + change + (∑ b : κ → Bool, + ∏ i, if b i then p i else 1 - p i) = 1 + calc + (∑ b : κ → Bool, + ∏ i, if b i then p i else 1 - p i) = + ∏ i, ∑ bit : Bool, + if bit then p i else 1 - p i := + (Fintype.prod_sum + (fun i : κ => fun bit : Bool => + if bit then p i else 1 - p i)).symm + _ = ∏ _i : κ, (1 : ℝ) := by + apply Fintype.prod_congr + intro i + simp + _ = 1 := by simp + +theorem sum_bernoulliAssignmentWeight_mul_selected + {κ : Type*} [Fintype κ] [DecidableEq κ] + (p : κ → ℝ) (s : Finset κ) : + ∑ b : κ → Bool, + bernoulliAssignmentWeight p b * + ∏ i ∈ s, booleanValue b i = + ∏ i ∈ s, p i := by + calc + (∑ b : κ → Bool, + bernoulliAssignmentWeight p b * + ∏ i ∈ s, booleanValue b i) = + ∑ b : κ → Bool, + ∏ i, + (if b i then p i else 1 - p i) * + (if i ∈ s then booleanValue b i else 1) := by + apply Fintype.sum_congr + intro b + have hselected : + (∏ i ∈ s, booleanValue b i) = + ∏ i, if i ∈ s then booleanValue b i else 1 := + (Fintype.prod_ite_mem s + (fun i => booleanValue b i)).symm + rw [bernoulliAssignmentWeight, hselected] + rw [← Finset.prod_mul_distrib] + _ = ∏ i, ∑ bit : Bool, + (if bit then p i else 1 - p i) * + (if i ∈ s then + (if bit then (1 : ℝ) else 0) else 1) := + (Fintype.prod_sum + (fun i : κ => fun bit : Bool => + (if bit then p i else 1 - p i) * + (if i ∈ s then + (if bit then (1 : ℝ) else 0) else 1))).symm + _ = ∏ i, if i ∈ s then p i else 1 := by + apply Fintype.prod_congr + intro i + by_cases hi : i ∈ s <;> simp [hi] + _ = ∏ i ∈ s, p i := by + exact Fintype.prod_ite_mem s p + +theorem sum_bernoulliAssignmentWeight_mul_embedding + {ι κ : Type*} [Fintype ι] [Fintype κ] + [DecidableEq κ] + (p : κ → ℝ) (e : ι ↪ κ) : + ∑ b : κ → Bool, + bernoulliAssignmentWeight p b * + ∏ i : ι, booleanValue b (e i) = + ∏ i : ι, p (e i) := by + simpa only [Finset.prod_map, Finset.mem_univ, true_and, + Finset.coe_univ, Function.Embedding.coeFn_mk] using + (sum_bernoulliAssignmentWeight_mul_selected p + (Finset.univ.map e)) + +abbrev CutTestCoordinate (G : Type*) (r : ℕ) := + Fin r × (Fin (r - 1) → G) + +abbrev BooleanCutAssignment (G : Type*) (r : ℕ) := + CutTestCoordinate G r → Bool + +def cutTestFamilyOfBooleanAssignment + {G : Type*} {r : ℕ} + (b : BooleanCutAssignment G r) : + CutTestFamily G r := + fun i y => booleanValue b ⟨i, y⟩ + +theorem cutTestFamilyOfBooleanAssignment_bounded + {G : Type*} {r : ℕ} + (b : BooleanCutAssignment G r) : + IsBoundedCutTest (cutTestFamilyOfBooleanAssignment b) := by + constructor <;> intro i y <;> + unfold cutTestFamilyOfBooleanAssignment booleanValue <;> + split <;> norm_num + +def cutTestCoordinateValue + {G : Type*} {r : ℕ} + (u : CutTestFamily G r) : + CutTestCoordinate G r → ℝ := + fun q => u q.1 q.2 + +def usedCutTestCoordinateEmbedding + {G : Type*} {r : ℕ} (x : Fin r → G) : + Fin r ↪ CutTestCoordinate G r where + toFun i := ⟨i, eraseCoordinate i x⟩ + inj' := by + intro i j h + exact congrArg Prod.fst h + +@[simp] +theorem usedCutTestCoordinateEmbedding_apply + {G : Type*} {r : ℕ} (x : Fin r → G) (i : Fin r) : + usedCutTestCoordinateEmbedding x i = + (i, eraseCoordinate i x) := + rfl + +theorem cutTestProduct_eq_sum_boolean + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (u : CutTestFamily G r) (x : Fin r → G) : + cutTestProduct u x = + ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + cutTestProduct + (cutTestFamilyOfBooleanAssignment b) x := by + classical + symm + simpa [cutTestProduct, cutTestCoordinateValue, + cutTestFamilyOfBooleanAssignment, + usedCutTestCoordinateEmbedding_apply] using + (sum_bernoulliAssignmentWeight_mul_embedding + (cutTestCoordinateValue u) + (usedCutTestCoordinateEmbedding x)) + +theorem cutCorrelation_eq_sum_boolean + {G : Type*} [Fintype G] [DecidableEq G] [AddCommGroup G] + (r : ℕ) (f g : G → ℝ) (u : CutTestFamily G r) : + cutCorrelation r f g u = + ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + cutCorrelation r f g + (cutTestFamilyOfBooleanAssignment b) := by + unfold cutCorrelation + calc + mean (fun x : Fin r → G => + (f (∑ i, x i) - g (∑ i, x i)) * + ∏ i, u i (eraseCoordinate i x)) = + mean (fun x : Fin r → G => + ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + ((f (∑ i, x i) - g (∑ i, x i)) * + cutTestProduct + (cutTestFamilyOfBooleanAssignment b) x)) := by + apply congrArg mean + funext x + change + (f (∑ i, x i) - g (∑ i, x i)) * + cutTestProduct u x = + _ + rw [cutTestProduct_eq_sum_boolean u x] + rw [Finset.mul_sum] + apply Fintype.sum_congr + intro b + ring + _ = ∑ b : BooleanCutAssignment G r, + mean (fun x : Fin r → G => + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + ((f (∑ i, x i) - g (∑ i, x i)) * + cutTestProduct + (cutTestFamilyOfBooleanAssignment b) x)) := by + unfold mean + exact Finset.expect_sum_comm Finset.univ Finset.univ _ + _ = ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + mean (fun x : Fin r → G => + (f (∑ i, x i) - g (∑ i, x i)) * + cutTestProduct + (cutTestFamilyOfBooleanAssignment b) x) := by + apply Fintype.sum_congr + intro b + exact mean_smul + (bernoulliAssignmentWeight + (cutTestCoordinateValue u) b) _ + _ = _ := by + rfl + +theorem abs_cutCorrelation_le_of_boolean + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} {f g : G → ℝ} {ε : ℝ} + (u : CutTestFamily G r) (hu : IsBoundedCutTest u) + (hboolean : + ∀ b : BooleanCutAssignment G r, + |cutCorrelation r f g + (cutTestFamilyOfBooleanAssignment b)| ≤ ε) : + |cutCorrelation r f g u| ≤ ε := by + classical + rw [cutCorrelation_eq_sum_boolean] + calc + |∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + cutCorrelation r f g + (cutTestFamilyOfBooleanAssignment b)| ≤ + ∑ b : BooleanCutAssignment G r, + |bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + cutCorrelation r f g + (cutTestFamilyOfBooleanAssignment b)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * ε := by + apply Finset.sum_le_sum + intro b _ + have hw : + 0 ≤ bernoulliAssignmentWeight + (cutTestCoordinateValue u) b := + bernoulliAssignmentWeight_nonneg + (p := cutTestCoordinateValue u) + (fun q => hu.nonneg q.1 q.2) + (fun q => hu.le_one q.1 q.2) b + rw [abs_mul, abs_of_nonneg hw] + exact mul_le_mul_of_nonneg_left (hboolean b) hw + _ = ε := by + rw [← Finset.sum_mul, + sum_bernoulliAssignmentWeight, one_mul] + +noncomputable def booleanCutConvolution + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (b : BooleanCutAssignment G r) : G → ℝ := + generalizedConvolution r + (cutTestFamilyOfBooleanAssignment b) + +theorem booleanCutConvolution_unitBounded + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} (hr : 0 < r) + (b : BooleanCutAssignment G r) : + IsUnitBounded (booleanCutConvolution r b) := by + constructor + · intro z + exact generalizedConvolution_nonneg hr + (cutTestFamilyOfBooleanAssignment_bounded b) z + · intro z + exact generalizedConvolution_le_one hr + (cutTestFamilyOfBooleanAssignment_bounded b) z + +theorem booleanCutConvolution_unitBoundedFamily + {G : Type*} [Fintype G] [AddCommGroup G] + {r : ℕ} (hr : 0 < r) : + IsUnitBoundedTestFamily + (booleanCutConvolution (G := G) r) := + fun b => booleanCutConvolution_unitBounded hr b + +theorem cutCorrelation_boolean_eq_pairing + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f g : G → ℝ) + (b : BooleanCutAssignment G r) : + cutCorrelation r f g + (cutTestFamilyOfBooleanAssignment b) = + finitePairing (f - g) (booleanCutConvolution r b) := by + rw [cutCorrelation_eq_mean_mul_generalizedConvolution] + rfl + +theorem exists_cutDiscrepancy_model_of_finiteBooleanModel + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (f : G → ℝ) {ε : ℝ} + (hmodel : + HasFiniteDenseModel + (booleanCutConvolution (G := G) r) f ε) : + ∃ g : G → ℝ, IsUnitBounded g ∧ + CutDiscrepancyLe r f g ε := by + obtain ⟨g, hg, hmatch⟩ := hmodel + refine ⟨g, hg, ?_⟩ + intro u hu0 hu1 + apply abs_cutCorrelation_le_of_boolean u ⟨hu0, hu1⟩ + intro b + rw [cutCorrelation_boolean_eq_pairing] + exact hmatch b + +theorem exists_cutDiscrepancy_model_of_positivePartCorrelationBound + {G : Type*} [Fintype G] [DecidableEq G] [AddCommGroup G] + (r : ℕ) {f ν : G → ℝ} {ε : ℝ} + (hε : 0 ≤ ε) + (hf0 : ∀ x, 0 ≤ f x) (hfν : ∀ x, f x ≤ ν x) + (hpseudo : + HasPositivePartCorrelationBound + (booleanCutConvolution (G := G) r) ν ε) : + ∃ g : G → ℝ, IsUnitBounded g ∧ + CutDiscrepancyLe r f g ε := by + apply exists_cutDiscrepancy_model_of_finiteBooleanModel r f + exact hasFiniteDenseModel_of_positivePartCorrelationBound + (booleanCutConvolution (G := G) r) + hε hf0 hfν hpseudo + +theorem exists_cutDiscrepancy_model_of_monomialCorrelationBound + {G : Type*} [Fintype G] [AddCommGroup G] + (r : ℕ) (hr : 0 < r) + {f ν : G → ℝ} + {p : ℝ[X]} {δ η M : ℝ} + (hδ : 0 ≤ δ) (hη : 0 ≤ η) (hM0 : 0 ≤ M) + (hf0 : ∀ x, 0 ≤ f x) (hfν : ∀ x, f x ≤ ν x) + (hp : ApproximatesPositivePartOnUnitInterval p δ) + (hM : centeredAbsoluteMean ν ≤ M) + (hmono : + HasMonomialCorrelationBound + (booleanCutConvolution (G := G) r) + ν p.natDegree η) : + ∃ g : G → ℝ, IsUnitBounded g ∧ + CutDiscrepancyLe r f g + (polynomialCoefficientL1 p * η + δ * M) := by + classical + apply + exists_cutDiscrepancy_model_of_positivePartCorrelationBound + r + · exact add_nonneg + (mul_nonneg (polynomialCoefficientL1_nonneg p) hη) + (mul_nonneg hδ hM0) + · exact hf0 + · exact hfν + · exact hasPositivePartCorrelationBound_of_polynomial + (booleanCutConvolution_unitBoundedFamily hr) + hδ hp hM hmono + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/BoundaryBernoulli.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/BoundaryBernoulli.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9f383ab3604fb1286556e70dc61fbd97e9f9384 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/BoundaryBernoulli.lean @@ -0,0 +1,1222 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedAtomEnergy + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +abbrev BoundaryBooleanCutAssignment + (G : Type*) (j : ℕ) := + (i : Fin (j + 1)) → (Fin j → G) → Bool + +noncomputable def boundaryBooleanComponentCut + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) + (i : Fin (j + 1)) : + BooleanCutTest (Fin j → G) := by + classical + exact Finset.univ.filter fun z => b i z = true + +@[simp] +theorem mem_boundaryBooleanComponentCut + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) + (i : Fin (j + 1)) (z : Fin j → G) : + z ∈ boundaryBooleanComponentCut b i ↔ + b i z = true := by + simp [boundaryBooleanComponentCut] + +noncomputable def boundaryBooleanCutSupport + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) : + BooleanCutTest (Fin (j + 1) → G) := by + classical + exact Finset.univ.filter fun x => + ∀ i, b i (eraseBoundaryCoordinate i x) = true + +@[simp] +theorem mem_boundaryBooleanCutSupport + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) + (x : Fin (j + 1) → G) : + x ∈ boundaryBooleanCutSupport b ↔ + ∀ i, b i (eraseBoundaryCoordinate i x) = true := by + simp [boundaryBooleanCutSupport] + +noncomputable def orderedBoundaryComponentCuts + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) + (g : OrderedFace k j) : + Finset (BooleanCutTest (Fin j → G)) := by + classical + exact + ((Finset.univ : Finset (Fin (j + 1))).filter + (fun i => eraseBoundaryFace e i = g)).image + (fun i => boundaryBooleanComponentCut b i) + +theorem boundaryBooleanComponentCut_mem_orderedBoundaryComponentCuts + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) + (i : Fin (j + 1)) : + boundaryBooleanComponentCut b i ∈ + orderedBoundaryComponentCuts e b + (eraseBoundaryFace e i) := by + classical + apply Finset.mem_image.mpr + refine ⟨i, ?_, rfl⟩ + simp + +noncomputable def refineOrderedFacePartitionsByBoundaryCut + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) : + OrderedFacePartitionSystem G k j := + fun g => + FacePartition.join (P g) + (FacePartition.generatedBy + (orderedBoundaryComponentCuts e b g)) + +theorem refineOrderedFacePartitionsByBoundaryCut_refines + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) : + OrderedFacePartitionRefines + (refineOrderedFacePartitionsByBoundaryCut P e b) P := by + intro g + exact FacePartition.join_le_left _ _ + +theorem refineOrderedFacePartitionsByBoundaryCut_le_component + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) + (i : Fin (j + 1)) : + refineOrderedFacePartitionsByBoundaryCut P e b + (eraseBoundaryFace e i) ≤ + FacePartition.generatedBy + ({boundaryBooleanComponentCut b i} : + Finset (Finset (Fin j → G))) := by + apply le_trans (FacePartition.join_le_right _ _) + apply FacePartition.generatedBy_antitone + intro A hA + have hAeq : A = boundaryBooleanComponentCut b i := by + simpa using hA + subst A + exact + boundaryBooleanComponentCut_mem_orderedBoundaryComponentCuts + e b i + +theorem boundaryComponentBit_eq_of_mem_refined_part + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) + (i : Fin (j + 1)) + (x y : Fin j → G) + (hy : + y ∈ + (refineOrderedFacePartitionsByBoundaryCut P e b + (eraseBoundaryFace e i)).part x) : + b i x = b i y := by + have hpart : + y ∈ + (FacePartition.generatedBy + ({boundaryBooleanComponentCut b i} : + Finset (Finset (Fin j → G)))).part x := + FacePartition.part_subset_of_le + (refineOrderedFacePartitionsByBoundaryCut_le_component + P e b i) x hy + have hsignature := + (FacePartition.mem_part_generatedBy_iff + ({boundaryBooleanComponentCut b i} : + Finset (Finset (Fin j → G))) x y).1 hpart + (boundaryBooleanComponentCut b i) (by simp) + cases hbx : b i x <;> cases hby : b i y <;> + simp [mem_boundaryBooleanComponentCut, hbx, hby] at hsignature ⊢ + +theorem orderedBoundaryPartition_refined_le_generatedSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) : + orderedBoundaryPartition + (refineOrderedFacePartitionsByBoundaryCut P e b) e ≤ + FacePartition.generatedBy + ({boundaryBooleanCutSupport b} : + Finset (Finset (Fin (j + 1) → G))) := by + rw [FacePartition.le_iff_part_subset] + intro x y hy + rw [FacePartition.mem_part_generatedBy_iff] + intro A hA + have hAeq : A = boundaryBooleanCutSupport b := by + simpa using hA + subst A + rw [mem_boundaryBooleanCutSupport, + mem_boundaryBooleanCutSupport] + have hboundary := + (mem_orderedBoundaryPartition_part_iff + (refineOrderedFacePartitionsByBoundaryCut P e b) + e x y).1 hy + constructor + · intro hx i + have hbit := + boundaryComponentBit_eq_of_mem_refined_part + P e b i + (eraseBoundaryCoordinate i x) + (eraseBoundaryCoordinate i y) + (hboundary i) + exact hbit ▸ hx i + · intro hy' i + have hbit := + boundaryComponentBit_eq_of_mem_refined_part + P e b i + (eraseBoundaryCoordinate i x) + (eraseBoundaryCoordinate i y) + (hboundary i) + exact hbit.symm ▸ hy' i + +theorem orderedBoundaryPartition_refined_le_refineBy + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) : + orderedBoundaryPartition + (refineOrderedFacePartitionsByBoundaryCut P e b) e ≤ + ((⟨orderedBoundaryPartition P e⟩ : + FaceRegularityState (Fin (j + 1) → G)).refineBy + (boundaryBooleanCutSupport b)).partition := by + apply FacePartition.le_join_iff.mpr + constructor + · exact orderedBoundaryPartition_mono + (refineOrderedFacePartitionsByBoundaryCut_refines P e b) e + · exact orderedBoundaryPartition_refined_le_generatedSupport + P e b + +noncomputable def orderedLayerAtomEnergy + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) : ℝ := + ∑ e : OrderedFace k (j + 1), + orderedAtomEnergy lower e (upper e) + +theorem orderedLayerAtomEnergy_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) : + 0 ≤ orderedLayerAtomEnergy lower upper := by + unfold orderedLayerAtomEnergy + exact Finset.sum_nonneg fun e _ => + orderedAtomEnergy_nonneg lower e (upper e) + +theorem orderedLayerAtomEnergy_le_card + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) : + orderedLayerAtomEnergy lower upper ≤ + (Fintype.card (OrderedFace k (j + 1)) : ℝ) := by + unfold orderedLayerAtomEnergy + calc + (∑ e : OrderedFace k (j + 1), + orderedAtomEnergy lower e (upper e)) ≤ + ∑ _e : OrderedFace k (j + 1), (1 : ℝ) := by + apply Finset.sum_le_sum + intro e _ + exact orderedAtomEnergy_le_one lower e (upper e) + _ = (Fintype.card (OrderedFace k (j + 1)) : ℝ) := by + simp + +theorem orderedLayerAtomEnergy_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (upper : OrderedFacePartitionSystem G k (j + 1)) : + orderedLayerAtomEnergy coarse upper ≤ + orderedLayerAtomEnergy fine upper := by + unfold orderedLayerAtomEnergy + apply Finset.sum_le_sum + intro e _ + exact orderedAtomEnergy_mono hfc e (upper e) + +theorem orderedLayerAtomEnergy_increment_of_boundaryCut + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (e : OrderedFace k (j + 1)) + (a : (upper e).parts) + (b : BoundaryBooleanCutAssignment G j) + {ε : ℝ} (hε : 0 ≤ ε) + (hcorrelation : + ε ≤ + |FaceRegularityState.booleanCutCorrelation + (⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)) + (partitionAtomIndicator (upper e) a) + (boundaryBooleanCutSupport b)|) : + orderedLayerAtomEnergy lower upper + ε ^ 2 ≤ + orderedLayerAtomEnergy + (refineOrderedFacePartitionsByBoundaryCut lower e b) + upper := by + classical + let fine := + refineOrderedFacePartitionsByBoundaryCut lower e b + let S : FaceRegularityState (Fin (j + 1) → G) := + ⟨orderedBoundaryPartition lower e⟩ + have hincrement : + S.energy (partitionAtomIndicator (upper e) a) + ε ^ 2 ≤ + (S.refineBy (boundaryBooleanCutSupport b)).energy + (partitionAtomIndicator (upper e) a) := + S.energy_increment_of_booleanCut + (partitionAtomIndicator (upper e) a) + (boundaryBooleanCutSupport b) hε hcorrelation + have hrefined : + orderedBoundaryPartition fine e ≤ + (S.refineBy (boundaryBooleanCutSupport b)).partition := by + exact orderedBoundaryPartition_refined_le_refineBy + lower e b + have hatom : + orderedAtomEnergy lower e (upper e) + ε ^ 2 ≤ + orderedAtomEnergy fine e (upper e) := by + unfold orderedAtomEnergy partitionAtomEnergy + let U : Finset (upper e).parts := Finset.univ + have haU : a ∈ U := by simp [U] + have hother : + ∑ c ∈ U.erase a, + partitionEnergy + (orderedBoundaryPartition lower e) + (partitionAtomIndicator (upper e) c) ≤ + ∑ c ∈ U.erase a, + partitionEnergy + (orderedBoundaryPartition fine e) + (partitionAtomIndicator (upper e) c) := by + apply Finset.sum_le_sum + intro c _ + exact partitionEnergy_mono + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition lower e) + (orderedBoundaryPartition_mono + (refineOrderedFacePartitionsByBoundaryCut_refines + lower e b) e) + (partitionAtomIndicator (upper e) c) + have hchosen : + partitionEnergy + (orderedBoundaryPartition lower e) + (partitionAtomIndicator (upper e) a) + + ε ^ 2 ≤ + partitionEnergy + (orderedBoundaryPartition fine e) + (partitionAtomIndicator (upper e) a) := by + exact le_trans hincrement + (partitionEnergy_mono + (orderedBoundaryPartition fine e) + (S.refineBy (boundaryBooleanCutSupport b)).partition + hrefined + (partitionAtomIndicator (upper e) a)) + change + (∑ c ∈ U, + partitionEnergy + (orderedBoundaryPartition lower e) + (partitionAtomIndicator (upper e) c)) + + ε ^ 2 ≤ + ∑ c ∈ U, + partitionEnergy + (orderedBoundaryPartition fine e) + (partitionAtomIndicator (upper e) c) + calc + (∑ c ∈ U, + partitionEnergy + (orderedBoundaryPartition lower e) + (partitionAtomIndicator (upper e) c)) + + ε ^ 2 = + (∑ c ∈ U.erase a, + partitionEnergy + (orderedBoundaryPartition lower e) + (partitionAtomIndicator (upper e) c)) + + (partitionEnergy + (orderedBoundaryPartition lower e) + (partitionAtomIndicator (upper e) a) + + ε ^ 2) := by + rw [← Finset.sum_erase_add U _ haU] + ring + _ ≤ + (∑ c ∈ U.erase a, + partitionEnergy + (orderedBoundaryPartition fine e) + (partitionAtomIndicator (upper e) c)) + + partitionEnergy + (orderedBoundaryPartition fine e) + (partitionAtomIndicator (upper e) a) := + add_le_add hother hchosen + _ = + ∑ c ∈ U, + partitionEnergy + (orderedBoundaryPartition fine e) + (partitionAtomIndicator (upper e) c) := + Finset.sum_erase_add U _ haU + unfold orderedLayerAtomEnergy + let E : Finset (OrderedFace k (j + 1)) := Finset.univ + have heE : e ∈ E := by simp [E] + have hotherFaces : + ∑ d ∈ E.erase e, + orderedAtomEnergy lower d (upper d) ≤ + ∑ d ∈ E.erase e, + orderedAtomEnergy fine d (upper d) := by + apply Finset.sum_le_sum + intro d _ + exact orderedAtomEnergy_mono + (refineOrderedFacePartitionsByBoundaryCut_refines + lower e b) + d (upper d) + change + (∑ d ∈ E, orderedAtomEnergy lower d (upper d)) + + ε ^ 2 ≤ + ∑ d ∈ E, orderedAtomEnergy fine d (upper d) + calc + (∑ d ∈ E, orderedAtomEnergy lower d (upper d)) + + ε ^ 2 = + (∑ d ∈ E.erase e, + orderedAtomEnergy lower d (upper d)) + + (orderedAtomEnergy lower e (upper e) + ε ^ 2) := by + rw [← Finset.sum_erase_add E _ heE] + ring + _ ≤ + (∑ d ∈ E.erase e, + orderedAtomEnergy fine d (upper d)) + + orderedAtomEnergy fine e (upper e) := + add_le_add hotherFaces hatom + _ = + ∑ d ∈ E, orderedAtomEnergy fine d (upper d) := + Finset.sum_erase_add E _ heE + +def IsPreliminaryOrderedRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) : Prop := + ∀ (e : OrderedFace k (j + 1)) + (a : (upper e).parts) + (b : BoundaryBooleanCutAssignment G j), + |FaceRegularityState.booleanCutCorrelation + (⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)) + (partitionAtomIndicator (upper e) a) + (boundaryBooleanCutSupport b)| ≤ ε + +theorem exists_boundaryCut_of_not_preliminaryRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + {ε : ℝ} + (h : ¬IsPreliminaryOrderedRegular lower upper ε) : + ∃ (e : OrderedFace k (j + 1)) + (a : (upper e).parts) + (b : BoundaryBooleanCutAssignment G j), + ε < + |FaceRegularityState.booleanCutCorrelation + (⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)) + (partitionAtomIndicator (upper e) a) + (boundaryBooleanCutSupport b)| := by + unfold IsPreliminaryOrderedRegular at h + obtain ⟨e, he⟩ := not_forall.mp h + obtain ⟨a, ha⟩ := not_forall.mp he + obtain ⟨b, hb⟩ := not_forall.mp ha + exact ⟨e, a, b, lt_of_not_ge hb⟩ + +structure PreliminaryIrregularWitness + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) where + face : OrderedFace k (j + 1) + atom : (upper face).parts + cut : BoundaryBooleanCutAssignment G j + correlation : + ε < + |FaceRegularityState.booleanCutCorrelation + (⟨orderedBoundaryPartition lower face⟩ : + FaceRegularityState (Fin (j + 1) → G)) + (partitionAtomIndicator (upper face) atom) + (boundaryBooleanCutSupport cut)| + +noncomputable def chosenPreliminaryIrregularWitness + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) + (h : ¬IsPreliminaryOrderedRegular lower upper ε) : + PreliminaryIrregularWitness lower upper ε := by + classical + let hex := + exists_boundaryCut_of_not_preliminaryRegular + lower upper h + let e := Classical.choose hex + let he := Classical.choose_spec hex + let a := Classical.choose he + let ha := Classical.choose_spec he + let b := Classical.choose ha + have hcorr := Classical.choose_spec ha + exact ⟨e, a, b, hcorr⟩ + +noncomputable def preliminaryOrderedRegularityStep + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) : + OrderedFacePartitionSystem G k j := by + classical + exact + if h : IsPreliminaryOrderedRegular lower upper ε then + lower + else + let W := + chosenPreliminaryIrregularWitness lower upper ε h + refineOrderedFacePartitionsByBoundaryCut + lower W.face W.cut + +theorem preliminaryOrderedRegularityStep_refines + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) : + OrderedFacePartitionRefines + (preliminaryOrderedRegularityStep lower upper ε) + lower := by + classical + by_cases h : + IsPreliminaryOrderedRegular lower upper ε + · simpa [preliminaryOrderedRegularityStep, h] using + OrderedFacePartitionRefines.refl lower + · simp only [preliminaryOrderedRegularityStep, dite_eq_right h] + let W := + chosenPreliminaryIrregularWitness lower upper ε h + exact refineOrderedFacePartitionsByBoundaryCut_refines + lower W.face W.cut + +theorem preliminaryOrderedRegularityStep_energy_increment + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + {ε : ℝ} (hε : 0 ≤ ε) + (h : ¬IsPreliminaryOrderedRegular lower upper ε) : + orderedLayerAtomEnergy lower upper + ε ^ 2 ≤ + orderedLayerAtomEnergy + (preliminaryOrderedRegularityStep lower upper ε) + upper := by + classical + simp only [preliminaryOrderedRegularityStep, dite_eq_right h] + let W := + chosenPreliminaryIrregularWitness lower upper ε h + exact orderedLayerAtomEnergy_increment_of_boundaryCut + lower upper W.face W.atom W.cut hε + (le_of_lt W.correlation) + +noncomputable def preliminaryOrderedRegularityRun + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) : + ℕ → OrderedFacePartitionSystem G k j + | 0 => lower + | n + 1 => + preliminaryOrderedRegularityStep + (preliminaryOrderedRegularityRun lower upper ε n) + upper ε + +@[simp] +theorem preliminaryOrderedRegularityRun_zero + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) : + preliminaryOrderedRegularityRun lower upper ε 0 = + lower := + rfl + +@[simp] +theorem preliminaryOrderedRegularityRun_succ + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) (n : ℕ) : + preliminaryOrderedRegularityRun lower upper ε (n + 1) = + preliminaryOrderedRegularityStep + (preliminaryOrderedRegularityRun lower upper ε n) + upper ε := + rfl + +theorem preliminaryOrderedRegularityRun_refines + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) (n : ℕ) : + OrderedFacePartitionRefines + (preliminaryOrderedRegularityRun lower upper ε n) + lower := by + induction n with + | zero => + exact OrderedFacePartitionRefines.refl lower + | succ n ih => + exact OrderedFacePartitionRefines.trans + (preliminaryOrderedRegularityStep_refines + (preliminaryOrderedRegularityRun lower upper ε n) + upper ε) + ih + +theorem exists_preliminaryOrderedRegularityRun_index_before + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + {ε : ℝ} {m : ℕ} + (hε : 0 ≤ ε) + (hlong : + (Fintype.card (OrderedFace k (j + 1)) : ℝ) < + (m : ℝ) * ε ^ 2) : + ∃ n : ℕ, n < m ∧ + IsPreliminaryOrderedRegular + (preliminaryOrderedRegularityRun + lower upper ε n) + upper ε := by + by_contra hregular + have hnotregular : + ∀ n, n < m → + ¬IsPreliminaryOrderedRegular + (preliminaryOrderedRegularityRun + lower upper ε n) + upper ε := by + intro n hn hreg + exact hregular ⟨n, hn, hreg⟩ + have hgain : + ∀ n, n < m → + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε n) + upper + + ε ^ 2 ≤ + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε (n + 1)) + upper := by + intro n hn + rw [preliminaryOrderedRegularityRun_succ] + exact preliminaryOrderedRegularityStep_energy_increment + (preliminaryOrderedRegularityRun + lower upper ε n) + upper hε (hnotregular n hn) + have growth : + ∀ n : ℕ, + (∀ i, i < n → + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε i) + upper + + ε ^ 2 ≤ + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε (i + 1)) + upper) → + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε 0) + upper + + (n : ℝ) * ε ^ 2 ≤ + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε n) + upper := by + intro n + induction n with + | zero => + intro _ + simp + | succ n ih => + intro hn + have hprevious := + ih (fun i hi => + hn i (Nat.lt_trans hi (Nat.lt_succ_self n))) + have hstep := hn n (Nat.lt_succ_self n) + calc + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε 0) + upper + + (↑(Nat.succ n) : ℝ) * ε ^ 2 = + (orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε 0) + upper + + (n : ℝ) * ε ^ 2) + + ε ^ 2 := by + push_cast + ring + _ ≤ + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε n) + upper + + ε ^ 2 := by + linarith + _ ≤ + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε (n + 1)) + upper := + hstep + have hgrowth := growth m hgain + have hnonneg : + 0 ≤ + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε 0) + upper := + orderedLayerAtomEnergy_nonneg _ _ + have hupper : + orderedLayerAtomEnergy + (preliminaryOrderedRegularityRun + lower upper ε m) + upper ≤ + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) := + orderedLayerAtomEnergy_le_card _ _ + linarith + +theorem exists_preliminaryOrderedRegular_refinement_before + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + {ε : ℝ} {m : ℕ} + (hε : 0 ≤ ε) + (hlong : + (Fintype.card (OrderedFace k (j + 1)) : ℝ) < + (m : ℝ) * ε ^ 2) : + ∃ n : ℕ, + ∃ fine : OrderedFacePartitionSystem G k j, + n < m ∧ + OrderedFacePartitionRefines fine lower ∧ + IsPreliminaryOrderedRegular fine upper ε := by + obtain ⟨n, hn, hregular⟩ := + exists_preliminaryOrderedRegularityRun_index_before + lower upper hε hlong + exact + ⟨n, + preliminaryOrderedRegularityRun lower upper ε n, + hn, + preliminaryOrderedRegularityRun_refines + lower upper ε n, + hregular⟩ + +theorem card_orderedBoundaryComponentCuts_le + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) + (g : OrderedFace k j) : + (orderedBoundaryComponentCuts e b g).card ≤ + j + 1 := by + classical + let I : Finset (Fin (j + 1)) := + (Finset.univ : Finset (Fin (j + 1))).filter + (fun i => eraseBoundaryFace e i = g) + calc + (orderedBoundaryComponentCuts e b g).card ≤ + I.card := by + exact Finset.card_image_le + _ ≤ (Finset.univ : Finset (Fin (j + 1))).card := by + exact Finset.card_le_card (Finset.filter_subset _ _) + _ = j + 1 := by simp + +theorem complexity_refineOrderedFacePartitionsByBoundaryCut_le + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : BoundaryBooleanCutAssignment G j) + (g : OrderedFace k j) : + FacePartition.complexity + (refineOrderedFacePartitionsByBoundaryCut P e b g) ≤ + 2 ^ (j + 1) * + FacePartition.complexity (P g) := by + have hgenerated : + FacePartition.complexity + (FacePartition.generatedBy + (orderedBoundaryComponentCuts e b g)) ≤ + 2 ^ (j + 1) := by + exact le_trans + (FacePartition.complexity_generatedBy_le + (orderedBoundaryComponentCuts e b g)) + (Nat.pow_le_pow_right (by decide) + (card_orderedBoundaryComponentCuts_le e b g)) + calc + FacePartition.complexity + (refineOrderedFacePartitionsByBoundaryCut P e b g) ≤ + FacePartition.complexity (P g) * + FacePartition.complexity + (FacePartition.generatedBy + (orderedBoundaryComponentCuts e b g)) := + FacePartition.complexity_join_le _ _ + _ ≤ + FacePartition.complexity (P g) * + 2 ^ (j + 1) := + Nat.mul_le_mul_left _ hgenerated + _ = + 2 ^ (j + 1) * + FacePartition.complexity (P g) := + Nat.mul_comm _ _ + +theorem complexity_preliminaryOrderedRegularityStep_le + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) (g : OrderedFace k j) : + FacePartition.complexity + (preliminaryOrderedRegularityStep + lower upper ε g) ≤ + 2 ^ (j + 1) * + FacePartition.complexity (lower g) := by + classical + by_cases h : + IsPreliminaryOrderedRegular lower upper ε + · simp only [preliminaryOrderedRegularityStep, dite_eq_left h] + exact Nat.le_mul_of_pos_left _ + (by positivity : 0 < 2 ^ (j + 1)) + · simp only [preliminaryOrderedRegularityStep, dite_eq_right h] + let W := + chosenPreliminaryIrregularWitness lower upper ε h + exact + complexity_refineOrderedFacePartitionsByBoundaryCut_le + lower W.face W.cut g + +theorem complexity_preliminaryOrderedRegularityRun_le + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) (n : ℕ) (g : OrderedFace k j) : + FacePartition.complexity + (preliminaryOrderedRegularityRun + lower upper ε n g) ≤ + (2 ^ (j + 1)) ^ n * + FacePartition.complexity (lower g) := by + induction n with + | zero => + simp + | succ n ih => + calc + FacePartition.complexity + (preliminaryOrderedRegularityRun + lower upper ε (n + 1) g) ≤ + 2 ^ (j + 1) * + FacePartition.complexity + (preliminaryOrderedRegularityRun + lower upper ε n g) := by + rw [preliminaryOrderedRegularityRun_succ] + exact complexity_preliminaryOrderedRegularityStep_le + (preliminaryOrderedRegularityRun + lower upper ε n) + upper ε g + _ ≤ + 2 ^ (j + 1) * + ((2 ^ (j + 1)) ^ n * + FacePartition.complexity (lower g)) := + Nat.mul_le_mul_left _ ih + _ = + (2 ^ (j + 1)) ^ (n + 1) * + FacePartition.complexity (lower g) := by + rw [pow_succ] + ring + +theorem exists_preliminaryOrderedRegular_refinement_with_complexity_before + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + {ε : ℝ} {m : ℕ} + (hε : 0 ≤ ε) + (hlong : + (Fintype.card (OrderedFace k (j + 1)) : ℝ) < + (m : ℝ) * ε ^ 2) : + ∃ n : ℕ, + ∃ fine : OrderedFacePartitionSystem G k j, + n < m ∧ + OrderedFacePartitionRefines fine lower ∧ + IsPreliminaryOrderedRegular fine upper ε ∧ + ∀ g, + FacePartition.complexity (fine g) ≤ + (2 ^ (j + 1)) ^ n * + FacePartition.complexity (lower g) := by + obtain ⟨n, hn, hregular⟩ := + exists_preliminaryOrderedRegularityRun_index_before + lower upper hε hlong + exact + ⟨n, + preliminaryOrderedRegularityRun lower upper ε n, + hn, + preliminaryOrderedRegularityRun_refines + lower upper ε n, + hregular, + complexity_preliminaryOrderedRegularityRun_le + lower upper ε n⟩ + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def boundaryBooleanAssignmentOfBoolean + {G : Type*} {j : ℕ} + (b : BooleanCutAssignment G (j + 1)) : + BoundaryBooleanCutAssignment G j := + fun i z => b ⟨i, z⟩ + +def booleanAssignmentOfBoundary + {G : Type*} {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) : + BooleanCutAssignment G (j + 1) := + fun q => b q.1 q.2 + +@[simp] +theorem booleanAssignmentOfBoundary_ofBoolean + {G : Type*} {j : ℕ} + (b : BooleanCutAssignment G (j + 1)) : + booleanAssignmentOfBoundary + (boundaryBooleanAssignmentOfBoolean b) = b := by + funext q + cases q + rfl + +@[simp] +theorem boundaryBooleanAssignmentOfBoolean_ofBoundary + {G : Type*} {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) : + boundaryBooleanAssignmentOfBoolean + (booleanAssignmentOfBoundary b) = b := by + funext i z + rfl + +def booleanBoundaryAssignmentEquiv + (G : Type*) (j : ℕ) : + BooleanCutAssignment G (j + 1) ≃ + BoundaryBooleanCutAssignment G j where + toFun := boundaryBooleanAssignmentOfBoolean + invFun := booleanAssignmentOfBoundary + left_inv := booleanAssignmentOfBoundary_ofBoolean + right_inv := boundaryBooleanAssignmentOfBoolean_ofBoundary + +@[simp] +theorem booleanAssignmentOfBoundary_equiv_apply + {G : Type*} {j : ℕ} + (b : BooleanCutAssignment G (j + 1)) : + booleanAssignmentOfBoundary + ((booleanBoundaryAssignmentEquiv G j) b) = b := + booleanAssignmentOfBoundary_ofBoolean b + +def boundaryBernoulliWeight + {G : Type*} [Fintype G] {j : ℕ} + (u : CutTestFamily G (j + 1)) + (b : BoundaryBooleanCutAssignment G j) : ℝ := + bernoulliAssignmentWeight + (cutTestCoordinateValue u) + (booleanAssignmentOfBoundary b) + +theorem sum_boundaryBernoulliWeight + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (u : CutTestFamily G (j + 1)) : + ∑ b : BoundaryBooleanCutAssignment G j, + boundaryBernoulliWeight u b = 1 := by + classical + calc + (∑ b : BoundaryBooleanCutAssignment G j, + boundaryBernoulliWeight u b) = + ∑ b : BooleanCutAssignment G (j + 1), + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b := by + symm + exact + Fintype.sum_equiv + (booleanBoundaryAssignmentEquiv G j) + (fun b : BooleanCutAssignment G (j + 1) => + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b) + (fun b : BoundaryBooleanCutAssignment G j => + boundaryBernoulliWeight u b) + (fun b => by simp [boundaryBernoulliWeight]) + _ = 1 := + sum_bernoulliAssignmentWeight + (cutTestCoordinateValue u) + +theorem boundaryBernoulliWeight_nonneg + {G : Type*} [Fintype G] + {j : ℕ} + (u : CutTestFamily G (j + 1)) + (hu : IsBoundedCutTest u) + (b : BoundaryBooleanCutAssignment G j) : + 0 ≤ boundaryBernoulliWeight u b := by + exact + bernoulliAssignmentWeight_nonneg + (p := cutTestCoordinateValue u) + (fun q => hu.nonneg q.1 q.2) + (fun q => hu.le_one q.1 q.2) + (booleanAssignmentOfBoundary b) + +theorem boundaryBooleanComponentCut_eval + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) + (i : Fin (j + 1)) (z : Fin j → G) : + (boundaryBooleanComponentCut b i).eval z = + booleanValue (booleanAssignmentOfBoundary b) ⟨i, z⟩ := by + classical + by_cases h : b i z = true + · have hz : z ∈ boundaryBooleanComponentCut b i := by + rw [mem_boundaryBooleanComponentCut] + exact h + rw [BooleanCutTest.eval_of_mem _ hz] + simp [booleanValue, booleanAssignmentOfBoundary, h] + · have hz : z ∉ boundaryBooleanComponentCut b i := by + rw [mem_boundaryBooleanComponentCut] + exact h + rw [BooleanCutTest.eval_of_not_mem _ hz] + simp [booleanValue, booleanAssignmentOfBoundary, h] + +theorem eraseBoundaryCoordinate_eq_eraseCoordinate + {G : Type*} {j : ℕ} + (i : Fin (j + 1)) (x : Fin (j + 1) → G) : + eraseBoundaryCoordinate i x = eraseCoordinate i x := + rfl + +theorem boundaryBooleanCutSupport_eq_booleanFaceCutSupport + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) : + boundaryBooleanCutSupport b = + booleanFaceCutSupport (booleanAssignmentOfBoundary b) := by + classical + ext x + rw [mem_boundaryBooleanCutSupport, + mem_booleanFaceCutSupport] + simp only [booleanAssignmentOfBoundary, + eraseBoundaryCoordinate_eq_eraseCoordinate] + +theorem boundaryBooleanCutSupport_eval + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (b : BoundaryBooleanCutAssignment G j) + (x : Fin (j + 1) → G) : + (boundaryBooleanCutSupport b).eval x = + cutTestProduct + (cutTestFamilyOfBooleanAssignment + (booleanAssignmentOfBoundary b)) x := by + rw [boundaryBooleanCutSupport_eq_booleanFaceCutSupport, + booleanFaceCutSupport_eval] + +theorem boundaryFactor_eq_sum_boolean + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (u : CutTestFamily G (j + 1)) + (i : Fin (j + 1)) (z : Fin j → G) : + u i z = + ∑ b : BoundaryBooleanCutAssignment G j, + boundaryBernoulliWeight u b * + (boundaryBooleanComponentCut b i).eval z := by + classical + have hmoment : + (∑ b : BooleanCutAssignment G (j + 1), + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + booleanValue b ⟨i, z⟩) = + u i z := by + simpa [cutTestCoordinateValue] using + (sum_bernoulliAssignmentWeight_mul_selected + (cutTestCoordinateValue u) + ({⟨i, z⟩} : + Finset (CutTestCoordinate G (j + 1)))) + rw [← hmoment] + exact + Fintype.sum_equiv + (booleanBoundaryAssignmentEquiv G j) + (fun b : BooleanCutAssignment G (j + 1) => + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + booleanValue b ⟨i, z⟩) + (fun b : BoundaryBooleanCutAssignment G j => + boundaryBernoulliWeight u b * + (boundaryBooleanComponentCut b i).eval z) + (fun b => by + simp [boundaryBernoulliWeight, + boundaryBooleanComponentCut_eval]) + +theorem boundaryCutProduct_eq_sum_boolean + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (u : CutTestFamily G (j + 1)) + (x : Fin (j + 1) → G) : + cutTestProduct u x = + ∑ b : BoundaryBooleanCutAssignment G j, + boundaryBernoulliWeight u b * + (boundaryBooleanCutSupport b).eval x := by + classical + rw [cutTestProduct_eq_sum_boolean] + exact + Fintype.sum_equiv + (booleanBoundaryAssignmentEquiv G j) + (fun b : BooleanCutAssignment G (j + 1) => + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + cutTestProduct + (cutTestFamilyOfBooleanAssignment b) x) + (fun b : BoundaryBooleanCutAssignment G j => + boundaryBernoulliWeight u b * + (boundaryBooleanCutSupport b).eval x) + (fun b => by + simp [boundaryBernoulliWeight, + boundaryBooleanCutSupport_eval]) + +namespace FaceRegularityState + +theorem faceCutCorrelation_eq_sum_boundaryBoolean + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (S : FaceRegularityState (Fin (j + 1) → G)) + (f : (Fin (j + 1) → G) → ℝ) + (u : CutTestFamily G (j + 1)) : + S.faceCutCorrelation f u = + ∑ b : BoundaryBooleanCutAssignment G j, + boundaryBernoulliWeight u b * + S.booleanCutCorrelation f + (boundaryBooleanCutSupport b) := by + classical + rw [S.faceCutCorrelation_eq_sum_boolean] + exact + Fintype.sum_equiv + (booleanBoundaryAssignmentEquiv G j) + (fun b : BooleanCutAssignment G (j + 1) => + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + S.faceCutCorrelation f + (cutTestFamilyOfBooleanAssignment b)) + (fun b : BoundaryBooleanCutAssignment G j => + boundaryBernoulliWeight u b * + S.booleanCutCorrelation f + (boundaryBooleanCutSupport b)) + (fun b => by + rw [S.faceCutCorrelation_boolean] + simp [boundaryBernoulliWeight, + boundaryBooleanCutSupport_eq_booleanFaceCutSupport]) + +theorem abs_faceCutCorrelation_le_of_boundaryBoolean + {G : Type*} [Fintype G] [DecidableEq G] + {j : ℕ} + (S : FaceRegularityState (Fin (j + 1) → G)) + (f : (Fin (j + 1) → G) → ℝ) + {ε : ℝ} + (u : CutTestFamily G (j + 1)) + (hu : IsBoundedCutTest u) + (hboolean : + ∀ b : BoundaryBooleanCutAssignment G j, + |S.booleanCutCorrelation f + (boundaryBooleanCutSupport b)| ≤ ε) : + |S.faceCutCorrelation f u| ≤ ε := by + rw [S.faceCutCorrelation_eq_sum_boundaryBoolean] + calc + |∑ b : BoundaryBooleanCutAssignment G j, + boundaryBernoulliWeight u b * + S.booleanCutCorrelation f + (boundaryBooleanCutSupport b)| ≤ + ∑ b : BoundaryBooleanCutAssignment G j, + |boundaryBernoulliWeight u b * + S.booleanCutCorrelation f + (boundaryBooleanCutSupport b)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ + ∑ b : BoundaryBooleanCutAssignment G j, + boundaryBernoulliWeight u b * ε := by + apply Finset.sum_le_sum + intro b _ + have hw : 0 ≤ boundaryBernoulliWeight u b := + boundaryBernoulliWeight_nonneg u hu b + rw [abs_mul, abs_of_nonneg hw] + exact mul_le_mul_of_nonneg_left (hboolean b) hw + _ = ε := by + rw [← Finset.sum_mul, + sum_boundaryBernoulliWeight, one_mul] + +end FaceRegularityState + +def IsPreliminaryOrderedBoundedRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) : Prop := + ∀ (e : OrderedFace k (j + 1)) + (a : (upper e).parts), + (⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)).IsFaceCutRegular + (partitionAtomIndicator (upper e) a) ε + +theorem IsPreliminaryOrderedRegular.toBounded + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {lower : OrderedFacePartitionSystem G k j} + {upper : OrderedFacePartitionSystem G k (j + 1)} + {ε : ℝ} + (hregular : + IsPreliminaryOrderedRegular lower upper ε) : + IsPreliminaryOrderedBoundedRegular + lower upper ε := by + intro e a u hu + exact + FaceRegularityState.abs_faceCutCorrelation_le_of_boundaryBoolean + (⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)) + (partitionAtomIndicator (upper e) a) + u hu (fun b => hregular e a b) + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/BundleCountingRecurrence.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/BundleCountingRecurrence.lean new file mode 100644 index 0000000000000000000000000000000000000000..474167cd52ab3c12a451eaf7437814e11cc9ba05 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/BundleCountingRecurrence.lean @@ -0,0 +1,1090 @@ +import OAI.Combinatorics.Progressions.FixedDensity.Energy + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +theorem mean_mul_sq_le_product + {Ω : Type*} [Fintype Ω] + (u v : Ω → ℝ) : + mean (fun x => u x * v x) ^ 2 ≤ + mean (fun x => u x ^ 2) * + mean (fun x => v x ^ 2) := by + simpa [mean] using + (Finset.expect_mul_sq_le_sq_mul_sq + (Finset.univ : Finset Ω) u v) + +theorem mean_sq_eq_mean_pair_mul + {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) : + mean f ^ 2 = + mean (fun p : Ω × Ω => f p.1 * f p.2) := by + calc + mean f ^ 2 = mean f * mean f := pow_two _ + _ = mean₂ (fun x y => f x * f y) := by + unfold mean₂ mean + exact + Finset.expect_mul_expect + Finset.univ Finset.univ f f + _ = mean (fun p : Ω × Ω => f p.1 * f p.2) := + (mean_prod_type fun x y => f x * f y).symm + +theorem mean_inner_sq_eq_mean₂_pair + {X Y : Type*} [Fintype X] [Fintype Y] + (F : X → Y → ℝ) : + mean (fun x => mean (F x) ^ 2) = + mean₂ (fun x => fun p : Y × Y => + F x p.1 * F x p.2) := by + unfold mean₂ + apply congrArg mean + funext x + exact mean_sq_eq_mean_pair_mul (F x) + +theorem mean_square_le_mean_square + {Ω : Type*} [Fintype Ω] [Nonempty Ω] + (f : Ω → ℝ) : + mean f ^ 2 ≤ mean (fun x => f x ^ 2) := by + have h := + Finset.expect_mul_sq_le_sq_mul_sq + Finset.univ f (fun _ : Ω => (1 : ℝ)) + simpa [mean] using h + +theorem mean_pow_two_le_mean_pow_two + {Ω : Type*} [Fintype Ω] [Nonempty Ω] + (f : Ω → ℝ) (hf : ∀ x, 0 ≤ f x) (n : ℕ) : + mean f ^ (2 ^ n) ≤ + mean (fun x => f x ^ (2 ^ n)) := by + induction n with + | zero => + simp + | succ n ih => + have hmean0 : 0 ≤ mean f := mean_nonneg hf + have hright0 : + 0 ≤ mean (fun x => f x ^ (2 ^ n)) := + mean_nonneg fun x => pow_nonneg (hf x) _ + have hsquare : + (mean f ^ (2 ^ n)) ^ 2 ≤ + mean (fun x => f x ^ (2 ^ n)) ^ 2 := by + simpa [pow_two] using + mul_self_le_mul_self + (pow_nonneg hmean0 _) ih + calc + mean f ^ (2 ^ (n + 1)) = + (mean f ^ (2 ^ n)) ^ 2 := by + rw [show 2 ^ (n + 1) = 2 ^ n * 2 by + rw [pow_succ], pow_mul] + _ ≤ mean (fun x => f x ^ (2 ^ n)) ^ 2 := + hsquare + _ ≤ mean (fun x => + (f x ^ (2 ^ n)) ^ 2) := + mean_square_le_mean_square _ + _ = mean (fun x => f x ^ (2 ^ (n + 1))) := by + apply congrArg mean + funext x + rw [show 2 ^ (n + 1) = 2 ^ n * 2 by + rw [pow_succ], pow_mul] + +theorem mean_pow_two_le_mean_pow_two_of_pos + {Ω : Type*} [Fintype Ω] [Nonempty Ω] + (f : Ω → ℝ) {n : ℕ} (hn : 0 < n) : + mean f ^ (2 ^ n) ≤ + mean (fun x => f x ^ (2 ^ n)) := by + have heven : Even (2 ^ n) := + even_two.pow_of_ne_zero (Nat.ne_of_gt hn) + have habs : + |mean f| ≤ mean (fun x => |f x|) := by + exact Finset.abs_expect_le Finset.univ f + calc + mean f ^ (2 ^ n) = |mean f| ^ (2 ^ n) := + (heven.pow_abs (mean f)).symm + _ ≤ mean (fun x => |f x|) ^ (2 ^ n) := + pow_le_pow_left₀ (abs_nonneg _) habs _ + _ ≤ mean (fun x => |f x| ^ (2 ^ n)) := + mean_pow_two_le_mean_pow_two + (fun x => |f x|) (fun x => abs_nonneg (f x)) n + _ = mean (fun x => f x ^ (2 ^ n)) := by + apply congrArg mean + funext x + exact heven.pow_abs (f x) + +theorem mean_pow_two_le_mean_pow_two' + {Ω : Type*} [Fintype Ω] [Nonempty Ω] + (f : Ω → ℝ) (n : ℕ) : + mean f ^ (2 ^ n) ≤ + mean (fun x => f x ^ (2 ^ n)) := by + cases n with + | zero => simp + | succ n => + exact mean_pow_two_le_mean_pow_two_of_pos f (Nat.succ_pos n) + +theorem cauchySchwarz_eliminate_outer_factor + {X Y : Type*} [Fintype X] [Nonempty X] [Fintype Y] + (u : X → ℝ) (F : X → Y → ℝ) + (hu : ∀ x, |u x| ≤ 1) : + mean₂ (fun x y => u x * F x y) ^ 2 ≤ + mean₂ (fun x => fun p : Y × Y => + F x p.1 * F x p.2) := by + have hrewrite : + mean₂ (fun x y => u x * F x y) = + mean (fun x => u x * mean (F x)) := by + unfold mean₂ + apply congrArg mean + funext x + exact mean_smul (u x) (F x) + rw [hrewrite] + calc + mean (fun x => u x * mean (F x)) ^ 2 ≤ + mean (fun x => u x ^ 2) * + mean (fun x => mean (F x) ^ 2) := + mean_mul_sq_le_product u (fun x => mean (F x)) + _ ≤ mean (fun x => mean (F x) ^ 2) := by + have huSq : mean (fun x => u x ^ 2) ≤ 1 := by + apply mean_le_of_le_const + intro x + have hx := abs_le.mp (hu x) + nlinarith [sq_nonneg (u x - 1), sq_nonneg (u x + 1)] + have hmeanSq : + 0 ≤ mean (fun x => mean (F x) ^ 2) := + mean_nonneg fun x => sq_nonneg _ + exact mul_le_of_le_one_left hmeanSq huSq + _ = mean₂ (fun x => fun p : Y × Y => + F x p.1 * F x p.2) := + mean_inner_sq_eq_mean₂_pair F + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +structure HypergraphBundle + (J K : Type*) [DecidableEq J] [DecidableEq K] + (H : Finset (Finset J)) where + edges : Finset (Finset K) + projection : K → J + projection_injective_on_edge : + ∀ g ∈ edges, Set.InjOn projection (g : Set K) + projection_mem_base : + ∀ g ∈ edges, g.image projection ∈ H + +namespace HypergraphBundle + +variable {J K G : Type*} + [DecidableEq J] [DecidableEq K] + {H : Finset (Finset J)} + +def IsClosedUnderInclusion + (B : HypergraphBundle J K H) : Prop := + ∀ ⦃g⦄, g ∈ B.edges → + ∀ ⦃f⦄, f ⊆ g → f ∈ B.edges + +def order (B : HypergraphBundle J K H) : ℕ := + B.edges.sup Finset.card + +def edgeCountAtRank + (B : HypergraphBundle J K H) (r : ℕ) : ℕ := + (B.edges.filter fun g => g.card = r).card + +theorem edge_card_le_order + (B : HypergraphBundle J K H) + {g : Finset K} (hg : g ∈ B.edges) : + g.card ≤ B.order := by + exact Finset.le_sup hg + +def eraseEdge + (B : HypergraphBundle J K H) (g₀ : Finset K) : + HypergraphBundle J K H where + edges := B.edges.erase g₀ + projection := B.projection + projection_injective_on_edge := by + intro g hg + exact B.projection_injective_on_edge g + (Finset.mem_of_mem_erase hg) + projection_mem_base := by + intro g hg + exact B.projection_mem_base g + (Finset.mem_of_mem_erase hg) + +@[simp] +theorem eraseEdge_edges + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.eraseEdge g₀).edges = B.edges.erase g₀ := + rfl + +theorem eraseEdge_order_le + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.eraseEdge g₀).order ≤ B.order := by + unfold order eraseEdge + apply Finset.sup_le + intro g hg + exact B.edge_card_le_order (Finset.mem_of_mem_erase hg) + +theorem edgeCountAtRank_eraseEdge + (B : HypergraphBundle J K H) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + {r : ℕ} (hr : g₀.card = r) : + (B.eraseEdge g₀).edgeCountAtRank r = + B.edgeCountAtRank r - 1 := by + unfold edgeCountAtRank eraseEdge + have hmem : + g₀ ∈ B.edges.filter fun g => g.card = r := + Finset.mem_filter.mpr ⟨hg₀, hr⟩ + have hfilter : + (B.edges.erase g₀).filter + (fun g => g.card = r) = + (B.edges.filter fun g => g.card = r).erase g₀ := by + ext g + simp only [Finset.mem_filter, Finset.mem_erase] + aesop + rw [hfilter, Finset.card_erase_of_mem hmem] + +theorem eraseEdge_closed_of_maximal + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) + {g₀ : Finset K} (_hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) : + (B.eraseEdge g₀).IsClosedUnderInclusion := by + intro g hg f hfg + have hgB : g ∈ B.edges := + Finset.mem_of_mem_erase hg + have hfB : f ∈ B.edges := + hclosed hgB hfg + apply Finset.mem_erase.mpr + refine ⟨?_, hfB⟩ + intro hfg₀ + subst f + have hcard₂ : g.card ≤ g₀.card := + hmax g hgB + have heq : g₀ = g := + Finset.eq_of_subset_of_card_le hfg hcard₂ + exact (Finset.mem_erase.mp hg).1 heq.symm + +def edgeTuple + (g : Finset K) (x : K → G) : + ({v : K // v ∈ g} → G) := + fun v => x v.1 + +noncomputable def projectionEquiv + (B : HypergraphBundle J K H) + {g : Finset K} (hg : g ∈ B.edges) : + {v : K // v ∈ g} ≃ + {j : J // j ∈ g.image B.projection} := by + classical + apply Equiv.ofBijective + (fun v : {v : K // v ∈ g} => + (⟨B.projection v.1, + Finset.mem_image.mpr ⟨v.1, v.2, rfl⟩⟩ : + {j : J // j ∈ g.image B.projection})) + constructor + · intro v w hvw + apply Subtype.ext + apply B.projection_injective_on_edge g hg v.2 w.2 + exact congrArg Subtype.val hvw + · intro j + obtain ⟨v, hv, hvj⟩ := + Finset.mem_image.mp j.2 + refine ⟨⟨v, hv⟩, ?_⟩ + apply Subtype.ext + exact hvj + +noncomputable def projectedEdgeTuple + (B : HypergraphBundle J K H) + {g : Finset K} (hg : g ∈ B.edges) + (y : {v : K // v ∈ g} → G) : + ({j : J // j ∈ g.image B.projection} → G) := + fun j => y ((B.projectionEquiv hg).symm j) + +abbrev BaseEdgeWeight + (J G : Type*) := + (e : Finset J) → ({j : J // j ∈ e} → G) → ℝ + +def BaseWeightsInUnitInterval + (H : Finset (Finset J)) + (A : BaseEdgeWeight J G) : Prop := + ∀ e ∈ H, ∀ y, 0 ≤ A e y ∧ A e y ≤ 1 + +noncomputable def pullbackBaseEdgeWeight + (B : HypergraphBundle J K H) + (A : BaseEdgeWeight J G) : + (g : Finset K) → ({v : K // v ∈ g} → G) → ℝ := by + classical + intro g y + by_cases hg : g ∈ B.edges + · exact A (g.image B.projection) + (B.projectedEdgeTuple hg y) + · exact 1 + +@[simp] +theorem pullbackBaseEdgeWeight_of_mem + (B : HypergraphBundle J K H) + (A : BaseEdgeWeight J G) + {g : Finset K} (hg : g ∈ B.edges) + (y : {v : K // v ∈ g} → G) : + B.pullbackBaseEdgeWeight A g y = + A (g.image B.projection) + (B.projectedEdgeTuple hg y) := by + classical + simp [pullbackBaseEdgeWeight, hg] + +theorem pullbackBaseEdgeWeight_unitInterval + (B : HypergraphBundle J K H) + (A : BaseEdgeWeight J G) + (hA : BaseWeightsInUnitInterval H A) + {g : Finset K} (hg : g ∈ B.edges) + (y : {v : K // v ∈ g} → G) : + 0 ≤ B.pullbackBaseEdgeWeight A g y ∧ + B.pullbackBaseEdgeWeight A g y ≤ 1 := by + rw [B.pullbackBaseEdgeWeight_of_mem A hg y] + exact hA _ (B.projection_mem_base g hg) _ + +def WeightsInUnitInterval + (B : HypergraphBundle J K H) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : Prop := + ∀ g ∈ B.edges, ∀ y, 0 ≤ A g y ∧ A g y ≤ 1 + +theorem pullbackBaseEdgeWeight_weightsInUnitInterval + (B : HypergraphBundle J K H) + (A : BaseEdgeWeight J G) + (hA : BaseWeightsInUnitInterval H A) : + B.WeightsInUnitInterval + (B.pullbackBaseEdgeWeight A) := by + intro g hg y + exact B.pullbackBaseEdgeWeight_unitInterval A hA hg y + +noncomputable def bundleProduct + (B : HypergraphBundle J K H) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (x : K → G) : ℝ := + ∏ g ∈ B.edges, A g (edgeTuple g x) + +noncomputable def bundleCount + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : ℝ := + mean (B.bundleProduct A) + +theorem bundleProduct_nonneg + (B : HypergraphBundle J K H) + {A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ} + (hA : B.WeightsInUnitInterval A) + (x : K → G) : + 0 ≤ B.bundleProduct A x := by + unfold bundleProduct + exact Finset.prod_nonneg fun g hg => + (hA g hg (edgeTuple g x)).1 + +theorem bundleProduct_le_one + (B : HypergraphBundle J K H) + {A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ} + (hA : B.WeightsInUnitInterval A) + (x : K → G) : + B.bundleProduct A x ≤ 1 := by + unfold bundleProduct + apply Finset.prod_le_one₀ + · intro g hg + exact (hA g hg (edgeTuple g x)).1 + · intro g hg + exact (hA g hg (edgeTuple g x)).2 + +theorem bundleCount_nonneg + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + {A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ} + (hA : B.WeightsInUnitInterval A) : + 0 ≤ B.bundleCount A := + mean_nonneg (B.bundleProduct_nonneg hA) + +theorem bundleCount_le_one + [Fintype K] [Fintype G] [Nonempty G] + (B : HypergraphBundle J K H) + {A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ} + (hA : B.WeightsInUnitInterval A) : + B.bundleCount A ≤ 1 := + mean_le_of_le_const (B.bundleProduct_le_one hA) + +theorem WeightsInUnitInterval.eraseEdge + (B : HypergraphBundle J K H) + {A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ} + (hA : B.WeightsInUnitInterval A) + (g₀ : Finset K) : + (B.eraseEdge g₀).WeightsInUnitInterval A := by + intro g hg y + exact hA g (Finset.mem_of_mem_erase hg) y + +noncomputable def edgeRemainder + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (x : K → G) : ℝ := + (B.eraseEdge g₀).bundleProduct A x + +noncomputable def edgeContribution + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (q : ({v : K // v ∈ g₀} → G) → ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : ℝ := + mean (fun x : K → G => + q (edgeTuple g₀ x) * B.edgeRemainder g₀ A x) + +theorem bundleCount_eq_edgeContribution + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) : + B.bundleCount A = + B.edgeContribution g₀ (A g₀) A := by + unfold bundleCount edgeContribution edgeRemainder + apply congrArg mean + funext x + exact + (Finset.mul_prod_erase B.edges + (fun g => A g (edgeTuple g x)) hg₀).symm + +theorem bundleCount_decompose_edge + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (p : ℝ) + (b c : ({v : K // v ∈ g₀} → G) → ℝ) + (hdecomp : ∀ y, A g₀ y = p + b y + c y) : + B.bundleCount A = + p * (B.eraseEdge g₀).bundleCount A + + B.edgeContribution g₀ b A + + B.edgeContribution g₀ c A := by + rw [B.bundleCount_eq_edgeContribution A hg₀] + unfold edgeContribution bundleCount + calc + mean (fun x : K → G => + A g₀ (edgeTuple g₀ x) * + B.edgeRemainder g₀ A x) = + mean (fun x : K → G => + p * B.edgeRemainder g₀ A x + + b (edgeTuple g₀ x) * + B.edgeRemainder g₀ A x + + c (edgeTuple g₀ x) * + B.edgeRemainder g₀ A x) := by + apply congrArg mean + funext x + rw [hdecomp] + ring + _ = + mean (fun x : K → G => + p * B.edgeRemainder g₀ A x) + + mean (fun x : K → G => + b (edgeTuple g₀ x) * + B.edgeRemainder g₀ A x) + + mean (fun x : K → G => + c (edgeTuple g₀ x) * + B.edgeRemainder g₀ A x) := by + rw [mean_add, mean_add] + _ = + p * (B.eraseEdge g₀).bundleCount A + + B.edgeContribution g₀ b A + + B.edgeContribution g₀ c A := by + rw [mean_smul] + rfl + +theorem edgeContribution_const + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (p : ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : + B.edgeContribution g₀ (fun _ => p) A = + p * (B.eraseEdge g₀).bundleCount A := by + unfold edgeContribution bundleCount + rw [← mean_smul] + rfl + +abbrev EdgeComplement (g : Finset K) := + {v : K // v ∉ g} + +noncomputable def edgeSumEquiv (g : Finset K) : + {v : K // v ∈ g} ⊕ EdgeComplement g ≃ K := + Equiv.sumCompl fun v : K => v ∈ g + +noncomputable def splitEdgeEquiv + (g : Finset K) : + (K → G) ≃ + (({v : K // v ∈ g} → G) × + (EdgeComplement g → G)) := + (Equiv.piCongrLeft (fun _ : K => G) + (edgeSumEquiv g)).symm.trans + (Equiv.sumPiEquivProdPi + (fun _ : {v : K // v ∈ g} ⊕ + EdgeComplement g => G)) + +@[simp] +theorem splitEdgeEquiv_fst + (g : Finset K) (x : K → G) : + (splitEdgeEquiv g x).1 = edgeTuple g x := by + funext v + simp [splitEdgeEquiv, edgeSumEquiv, edgeTuple] + +@[simp] +theorem edgeTuple_splitEdgeEquiv_symm + (g : Finset K) + (y : {v : K // v ∈ g} → G) + (z : EdgeComplement g → G) : + edgeTuple g ((splitEdgeEquiv g).symm (y, z)) = y := by + rw [← splitEdgeEquiv_fst] + simp + +theorem mean_splitEdge + [Fintype K] [Fintype G] + (g : Finset K) (f : (K → G) → ℝ) : + mean f = + mean₂ (fun y : {v : K // v ∈ g} → G => + fun z : EdgeComplement g → G => + f ((splitEdgeEquiv g).symm (y, z))) := by + calc + mean f = + mean (fun p : + ({v : K // v ∈ g} → G) × + (EdgeComplement g → G) => + f ((splitEdgeEquiv g).symm p)) := by + unfold mean + apply Fintype.expect_equiv (splitEdgeEquiv g) + intro x + simp + _ = _ := by + simpa only [Prod.eta] using + (mean_prod_type + (fun y : {v : K // v ∈ g} → G => + fun z : EdgeComplement g → G => + f ((splitEdgeEquiv g).symm (y, z)))) + +noncomputable def edgeRemainderFiber + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (y : {v : K // v ∈ g₀} → G) + (z : EdgeComplement g₀ → G) : ℝ := + B.edgeRemainder g₀ A + ((splitEdgeEquiv g₀).symm (y, z)) + +noncomputable def edgeRemainderAverage + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (y : {v : K // v ∈ g₀} → G) : ℝ := + mean (B.edgeRemainderFiber g₀ A y) + +theorem edgeContribution_eq_mean_mul_remainderAverage + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (q : ({v : K // v ∈ g₀} → G) → ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : + B.edgeContribution g₀ q A = + mean (fun y => + q y * B.edgeRemainderAverage g₀ A y) := by + unfold edgeContribution + rw [mean_splitEdge g₀] + unfold mean₂ edgeRemainderAverage edgeRemainderFiber + apply congrArg mean + funext y + simp only [edgeTuple_splitEdgeEquiv_symm] + rw [mean_smul] + +noncomputable def frozenEdgeCorrelation + [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (q : ({v : K // v ∈ g₀} → G) → ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (z : EdgeComplement g₀ → G) : ℝ := + mean (fun y => + q y * B.edgeRemainderFiber g₀ A y z) + +theorem edgeContribution_eq_mean_frozenEdgeCorrelation + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (q : ({v : K // v ∈ g₀} → G) → ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : + B.edgeContribution g₀ q A = + mean (B.frozenEdgeCorrelation g₀ q A) := by + unfold edgeContribution + rw [mean_splitEdge g₀, mean₂_comm] + unfold frozenEdgeCorrelation edgeRemainderFiber mean₂ + apply congrArg mean + funext z + apply congrArg mean + funext y + change + q (edgeTuple g₀ + ((splitEdgeEquiv g₀).symm (y, z))) * + B.edgeRemainder g₀ A + ((splitEdgeEquiv g₀).symm (y, z)) = + q y * + B.edgeRemainder g₀ A + ((splitEdgeEquiv g₀).symm (y, z)) + rw [edgeTuple_splitEdgeEquiv_symm] + +theorem abs_edgeContribution_le_of_frozen + [Fintype K] [Fintype G] [Nonempty G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (q : ({v : K // v ∈ g₀} → G) → ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + {ε : ℝ} + (hfrozen : + ∀ z, |B.frozenEdgeCorrelation g₀ q A z| ≤ ε) : + |B.edgeContribution g₀ q A| ≤ ε := by + rw [B.edgeContribution_eq_mean_frozenEdgeCorrelation] + calc + |mean (B.frozenEdgeCorrelation g₀ q A)| ≤ + mean (fun z => + |B.frozenEdgeCorrelation g₀ q A z|) := + Finset.abs_expect_le Finset.univ _ + _ ≤ mean (fun _z : EdgeComplement g₀ → G => ε) := + mean_mono hfrozen + _ = ε := mean_const _ + +noncomputable def doubledRemainderMoment + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : ℝ := + mean (fun y => + B.edgeRemainderAverage g₀ A y ^ 2) + +theorem doubledRemainderMoment_nonneg + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : + 0 ≤ B.doubledRemainderMoment g₀ A := + mean_nonneg fun _ => sq_nonneg _ + +theorem edgeRemainderAverage_unitInterval + [Fintype K] [Fintype G] [Nonempty G] + (B : HypergraphBundle J K H) + {A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ} + (hA : B.WeightsInUnitInterval A) + (g₀ : Finset K) + (y : {v : K // v ∈ g₀} → G) : + 0 ≤ B.edgeRemainderAverage g₀ A y ∧ + B.edgeRemainderAverage g₀ A y ≤ 1 := by + constructor + · apply mean_nonneg + intro z + exact + (B.eraseEdge g₀).bundleProduct_nonneg + (hA.eraseEdge B g₀) _ + · apply mean_le_of_le_const + intro z + exact + (B.eraseEdge g₀).bundleProduct_le_one + (hA.eraseEdge B g₀) _ + +theorem doubledRemainderMoment_le_one + [Fintype K] [Fintype G] [Nonempty G] + (B : HypergraphBundle J K H) + {A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ} + (hA : B.WeightsInUnitInterval A) + (g₀ : Finset K) : + B.doubledRemainderMoment g₀ A ≤ 1 := by + unfold doubledRemainderMoment + apply mean_le_of_le_const + intro y + have hy := + B.edgeRemainderAverage_unitInterval hA g₀ y + nlinarith + +theorem doubledRemainderMoment_eq_mean₂_pair + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : + B.doubledRemainderMoment g₀ A = + mean₂ (fun y : + {v : K // v ∈ g₀} → G => + fun z : + (EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G) => + B.edgeRemainderFiber g₀ A y z.1 * + B.edgeRemainderFiber g₀ A y z.2) := by + unfold doubledRemainderMoment edgeRemainderAverage + exact mean_inner_sq_eq_mean₂_pair + (B.edgeRemainderFiber g₀ A) + +theorem edgeContribution_sq_le_localSquare_mul_doubled + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (q : ({v : K // v ∈ g₀} → G) → ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : + B.edgeContribution g₀ q A ^ 2 ≤ + mean (fun y => q y ^ 2) * + B.doubledRemainderMoment g₀ A := by + rw [B.edgeContribution_eq_mean_mul_remainderAverage] + exact mean_mul_sq_le_product q + (B.edgeRemainderAverage g₀ A) + +theorem edgeContribution_sq_le_of_localized_defect + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (b base : ({v : K // v ∈ g₀} → G) → ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (β : ℝ) + (hlocalized : + mean (fun y => b y ^ 2) ≤ + β * mean base) : + B.edgeContribution g₀ b A ^ 2 ≤ + (β * mean base) * + B.doubledRemainderMoment g₀ A := by + calc + B.edgeContribution g₀ b A ^ 2 ≤ + mean (fun y => b y ^ 2) * + B.doubledRemainderMoment g₀ A := + B.edgeContribution_sq_le_localSquare_mul_doubled + g₀ b A + _ ≤ + (β * mean base) * + B.doubledRemainderMoment g₀ A := + mul_le_mul_of_nonneg_right hlocalized + (B.doubledRemainderMoment_nonneg g₀ A) + +theorem edgeContribution_sq_le_of_localized_defect_unitInterval + [Fintype K] [Fintype G] [Nonempty G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) + (b base : ({v : K // v ∈ g₀} → G) → ℝ) + {A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ} + (hA : B.WeightsInUnitInterval A) + {β : ℝ} (hβ : 0 ≤ β) + (hbase : ∀ y, 0 ≤ base y) + (hlocalized : + mean (fun y => b y ^ 2) ≤ + β * mean base) : + B.edgeContribution g₀ b A ^ 2 ≤ + β * mean base := by + calc + B.edgeContribution g₀ b A ^ 2 ≤ + (β * mean base) * + B.doubledRemainderMoment g₀ A := + B.edgeContribution_sq_le_of_localized_defect + g₀ b base A β hlocalized + _ ≤ β * mean base := by + apply mul_le_of_le_one_right + · exact mul_nonneg hβ (mean_nonneg hbase) + · exact B.doubledRemainderMoment_le_one hA g₀ + +end HypergraphBundle + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem abs_finiteCount_sub_prod_le_card_mul + {ι : Type*} [DecidableEq ι] + (count : Finset ι → ℝ) + (p : ι → ℝ) + {δ : ℝ} (hδ : 0 ≤ δ) + (hempty : count ∅ = 1) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hstep : + ∀ s : Finset ι, s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ δ) + (s : Finset ι) : + |count s - ∏ e ∈ s, p e| ≤ + (s.card : ℝ) * δ := by + refine Finset.strongInductionOn s ?_ + intro s ih + by_cases hs : s = ∅ + · subst s + simp [hempty] + · have hsne : s.Nonempty := + Finset.nonempty_iff_ne_empty.mpr hs + obtain ⟨e, he, hrec⟩ := hstep s hsne + have herase : s.erase e ⊂ s := + Finset.erase_ssubset he + have hind : + |count (s.erase e) - + ∏ f ∈ s.erase e, p f| ≤ + ((s.erase e).card : ℝ) * δ := + ih (s.erase e) herase + have hpe0 : 0 ≤ p e := (hp e).1 + have hpe1 : p e ≤ 1 := (hp e).2 + have hright0 : + 0 ≤ ((s.erase e).card : ℝ) * δ := + mul_nonneg (Nat.cast_nonneg _) hδ + have hprod : + (∏ f ∈ s, p f) = + p e * ∏ f ∈ s.erase e, p f := by + exact + (Finset.mul_prod_erase s p he).symm + calc + |count s - ∏ f ∈ s, p f| = + |(count s - p e * count (s.erase e)) + + p e * + (count (s.erase e) - + ∏ f ∈ s.erase e, p f)| := by + rw [hprod] + congr 1 + ring + _ ≤ + |count s - p e * count (s.erase e)| + + |p e * + (count (s.erase e) - + ∏ f ∈ s.erase e, p f)| := + abs_add_le _ _ + _ = + |count s - p e * count (s.erase e)| + + p e * + |count (s.erase e) - + ∏ f ∈ s.erase e, p f| := by + rw [abs_mul, abs_of_nonneg hpe0] + _ ≤ + δ + p e * + (((s.erase e).card : ℝ) * δ) := by + exact add_le_add hrec + (mul_le_mul_of_nonneg_left hind hpe0) + _ ≤ + δ + ((s.erase e).card : ℝ) * δ := by + exact add_le_add le_rfl + (mul_le_of_le_one_left hright0 hpe1) + _ = (s.card : ℝ) * δ := by + rw [Finset.card_erase_of_mem he] + have hcard : 1 ≤ s.card := + Finset.one_le_card.mpr hsne + rw [Nat.cast_sub hcard] + ring + +theorem finiteCount_prod_sub_card_mul_le + {ι : Type*} [DecidableEq ι] + (count : Finset ι → ℝ) + (p : ι → ℝ) + {δ : ℝ} (hδ : 0 ≤ δ) + (hempty : count ∅ = 1) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hstep : + ∀ s : Finset ι, s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ δ) + (s : Finset ι) : + (∏ e ∈ s, p e) - (s.card : ℝ) * δ ≤ + count s := by + have habs := + abs_finiteCount_sub_prod_le_card_mul + count p hδ hempty hp hstep s + exact + sub_le_iff_le_add.mpr + ((abs_le.mp habs).1 |> + fun h => by linarith) + +theorem pow_sub_card_mul_le_finiteCount + {ι : Type*} [DecidableEq ι] + (count : Finset ι → ℝ) + (p : ι → ℝ) + {α δ : ℝ} (hα : 0 ≤ α) (hδ : 0 ≤ δ) + (hempty : count ∅ = 1) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hpLower : ∀ i, α ≤ p i) + (hstep : + ∀ s : Finset ι, s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ δ) + (s : Finset ι) : + α ^ s.card - (s.card : ℝ) * δ ≤ count s := by + have hproduct : + α ^ s.card ≤ ∏ e ∈ s, p e := by + calc + α ^ s.card = + ∏ _e ∈ s, α := by simp + _ ≤ ∏ e ∈ s, p e := by + apply Finset.prod_le_prod₀ + · intro e he + exact hα + · intro e he + exact hpLower e + exact le_trans + (sub_le_sub_right hproduct _) + (finiteCount_prod_sub_card_mul_le + count p hδ hempty hp hstep s) + +theorem finiteCount_pos_of_card_mul_lt_pow + {ι : Type*} [DecidableEq ι] + (count : Finset ι → ℝ) + (p : ι → ℝ) + {α δ : ℝ} (hα : 0 ≤ α) (hδ : 0 ≤ δ) + (hempty : count ∅ = 1) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hpLower : ∀ i, α ≤ p i) + (hstep : + ∀ s : Finset ι, s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ δ) + (s : Finset ι) + (hsmall : (s.card : ℝ) * δ < α ^ s.card) : + 0 < count s := by + have hlower := + pow_sub_card_mul_le_finiteCount + count p hα hδ hempty hp hpLower hstep s + linarith + +theorem abs_finiteCount_sub_prod_le_sum_error + {ι : Type*} [DecidableEq ι] + (count : Finset ι → ℝ) + (p error : ι → ℝ) + (herror : ∀ i, 0 ≤ error i) + (hempty : count ∅ = 1) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hstep : + ∀ s : Finset ι, s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ error e) + (s : Finset ι) : + |count s - ∏ e ∈ s, p e| ≤ + ∑ e ∈ s, error e := by + refine Finset.strongInductionOn s ?_ + intro s ih + by_cases hs : s = ∅ + · subst s + simp [hempty] + · have hsne : s.Nonempty := + Finset.nonempty_iff_ne_empty.mpr hs + obtain ⟨e, he, hrec⟩ := hstep s hsne + have herase : s.erase e ⊂ s := + Finset.erase_ssubset he + have hind : + |count (s.erase e) - + ∏ f ∈ s.erase e, p f| ≤ + ∑ f ∈ s.erase e, error f := + ih (s.erase e) herase + have hpe0 : 0 ≤ p e := (hp e).1 + have hpe1 : p e ≤ 1 := (hp e).2 + have hsum0 : + 0 ≤ ∑ f ∈ s.erase e, error f := + Finset.sum_nonneg fun f _ => herror f + have hprod : + (∏ f ∈ s, p f) = + p e * ∏ f ∈ s.erase e, p f := by + exact + (Finset.mul_prod_erase s p he).symm + calc + |count s - ∏ f ∈ s, p f| = + |(count s - p e * count (s.erase e)) + + p e * + (count (s.erase e) - + ∏ f ∈ s.erase e, p f)| := by + rw [hprod] + congr 1 + ring + _ ≤ + |count s - p e * count (s.erase e)| + + |p e * + (count (s.erase e) - + ∏ f ∈ s.erase e, p f)| := + abs_add_le _ _ + _ = + |count s - p e * count (s.erase e)| + + p e * + |count (s.erase e) - + ∏ f ∈ s.erase e, p f| := by + rw [abs_mul, abs_of_nonneg hpe0] + _ ≤ + error e + + p e * (∑ f ∈ s.erase e, error f) := by + exact add_le_add hrec + (mul_le_mul_of_nonneg_left hind hpe0) + _ ≤ + error e + ∑ f ∈ s.erase e, error f := by + exact add_le_add le_rfl + (mul_le_of_le_one_left hsum0 hpe1) + _ = ∑ f ∈ s, error f := by + rw [← Finset.sum_erase_add s error he] + ring + +theorem finiteCount_prod_sub_sum_error_le + {ι : Type*} [DecidableEq ι] + (count : Finset ι → ℝ) + (p error : ι → ℝ) + (herror : ∀ i, 0 ≤ error i) + (hempty : count ∅ = 1) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hstep : + ∀ s : Finset ι, s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ error e) + (s : Finset ι) : + (∏ e ∈ s, p e) - (∑ e ∈ s, error e) ≤ + count s := by + have habs := + abs_finiteCount_sub_prod_le_sum_error + count p error herror hempty hp hstep s + exact + sub_le_iff_le_add.mpr + ((abs_le.mp habs).1 |> + fun h => by linarith) + +theorem finiteCount_pos_of_sum_error_lt_prod + {ι : Type*} [DecidableEq ι] + (count : Finset ι → ℝ) + (p error : ι → ℝ) + (herror : ∀ i, 0 ≤ error i) + (hempty : count ∅ = 1) + (hp : ∀ i, 0 ≤ p i ∧ p i ≤ 1) + (hstep : + ∀ s : Finset ι, s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ error e) + (s : Finset ι) + (hsmall : + (∑ e ∈ s, error e) < ∏ e ∈ s, p e) : + 0 < count s := by + have hlower := + finiteCount_prod_sub_sum_error_le + count p error herror hempty hp hstep s + linarith + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseAtomBridge.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseAtomBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..72c90aec4af69ab73d0e02a1a63287baeeb06faa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseAtomBridge.lean @@ -0,0 +1,742 @@ +import Mathlib.Algebra.Order.Chebyshev +import OAI.Combinatorics.Progressions.FixedDensity.OrderedPatternPartition + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def coarseAtomOfFineAtom + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fineUpper coarseUpper : FacePartition Ω) + (b : fineUpper.parts) : + coarseUpper.parts := + partitionAtomAt coarseUpper + (fineUpper.representative b) + +noncomputable def fineAtomsInCoarseAtom + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fineUpper coarseUpper : FacePartition Ω) + (a : coarseUpper.parts) : + Finset fineUpper.parts := by + classical + exact + (Finset.univ : Finset fineUpper.parts).filter fun b => + coarseAtomOfFineAtom fineUpper coarseUpper b = a + +@[simp] +theorem mem_fineAtomsInCoarseAtom + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fineUpper coarseUpper : FacePartition Ω) + (a : coarseUpper.parts) (b : fineUpper.parts) : + b ∈ fineAtomsInCoarseAtom fineUpper coarseUpper a ↔ + coarseAtomOfFineAtom fineUpper coarseUpper b = a := by + classical + simp [fineAtomsInCoarseAtom] + +theorem fineAtom_subset_coarseAtomOfFineAtom + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (b : fineUpper.parts) : + b.1 ⊆ + (coarseAtomOfFineAtom fineUpper coarseUpper b).1 := by + have hsubset := + FacePartition.part_subset_of_le hupper + (fineUpper.representative b) + rw [fineUpper.part_representative b] at hsubset + exact hsubset + +theorem coarseAtomOfFineAtom_partitionAtomAt + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (x : Ω) : + coarseAtomOfFineAtom fineUpper coarseUpper + (partitionAtomAt fineUpper x) = + partitionAtomAt coarseUpper x := by + apply Subtype.ext + have hrepresentative : + fineUpper.representative + (partitionAtomAt fineUpper x) ∈ + coarseUpper.part x := by + apply FacePartition.part_subset_of_le hupper x + exact fineUpper.representative_mem + (partitionAtomAt fineUpper x) + exact coarseUpper.part_eq_of_mem + (coarseUpper.part_mem.2 (Finset.mem_univ x)) + hrepresentative + +theorem partitionAtomUnion_fineAtomsInCoarseAtom + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (a : coarseUpper.parts) : + partitionAtomUnion fineUpper + (fineAtomsInCoarseAtom fineUpper coarseUpper a) = + a.1 := by + ext x + constructor + · intro hx + obtain ⟨b, hb, hxb⟩ := + (mem_partitionAtomUnion fineUpper + (fineAtomsInCoarseAtom fineUpper coarseUpper a) x).1 hx + have hba : + coarseAtomOfFineAtom fineUpper coarseUpper b = a := + (mem_fineAtomsInCoarseAtom + fineUpper coarseUpper a b).1 hb + rw [← hba] + exact fineAtom_subset_coarseAtomOfFineAtom + hupper b hxb + · intro hx + apply + (mem_partitionAtomUnion fineUpper + (fineAtomsInCoarseAtom fineUpper coarseUpper a) x).2 + refine ⟨partitionAtomAt fineUpper x, ?_, ?_⟩ + · apply + (mem_fineAtomsInCoarseAtom + fineUpper coarseUpper a + (partitionAtomAt fineUpper x)).2 + rw [coarseAtomOfFineAtom_partitionAtomAt + hupper x] + exact + (partitionAtomAt_eq_iff_mem + coarseUpper x a).2 hx + · exact fineUpper.mem_part (Finset.mem_univ x) + +theorem partitionAtomIndicator_eq_sum_fineAtomsInCoarseAtom + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (a : coarseUpper.parts) (x : Ω) : + partitionAtomIndicator coarseUpper a x = + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + partitionAtomIndicator fineUpper b x := by + rw [← finsetIndicator_partitionAtomUnion + fineUpper + (fineAtomsInCoarseAtom fineUpper coarseUpper a) x] + unfold partitionAtomIndicator + rw [partitionAtomUnion_fineAtomsInCoarseAtom + hupper a] + +theorem partitionAtomIndicator_eq_sum_fineAtomsInCoarseAtom_fun + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (a : coarseUpper.parts) : + partitionAtomIndicator coarseUpper a = + fun x => + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + partitionAtomIndicator fineUpper b x := by + funext x + exact partitionAtomIndicator_eq_sum_fineAtomsInCoarseAtom + hupper a x + +theorem card_fineAtomsInCoarseAtom_le_complexity + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fineUpper coarseUpper : FacePartition Ω) + (a : coarseUpper.parts) : + (fineAtomsInCoarseAtom fineUpper coarseUpper a).card ≤ + FacePartition.complexity fineUpper := by + classical + calc + (fineAtomsInCoarseAtom + fineUpper coarseUpper a).card ≤ + (Finset.univ : Finset fineUpper.parts).card := + Finset.card_le_card (Finset.subset_univ _) + _ = FacePartition.complexity fineUpper := by + simp [FacePartition.complexity] + +theorem conditionalMean_finset_sum + {Ω ι : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset ι) + (f : ι → Ω → ℝ) (x : Ω) : + conditionalMean P + (fun y => ∑ i ∈ s, f i y) x = + ∑ i ∈ s, conditionalMean P (f i) x := by + unfold conditionalMean + exact Finset.expect_sum_comm (P.part x) s + (fun y i => f i y) + +theorem FaceRegularityState.faceCutCorrelation_finset_sum + {G ι : Type*} [Fintype G] [DecidableEq G] + {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (s : Finset ι) + (f : ι → (Fin r → G) → ℝ) + (u : CutTestFamily G r) : + S.faceCutCorrelation + (fun x => ∑ i ∈ s, f i x) u = + ∑ i ∈ s, S.faceCutCorrelation (f i) u := by + unfold FaceRegularityState.faceCutCorrelation + calc + mean (fun x => + S.residual (fun y => ∑ i ∈ s, f i y) x * + cutTestProduct u x) = + mean (fun x => + ∑ i ∈ s, + S.residual (f i) x * + cutTestProduct u x) := by + apply congrArg mean + funext x + unfold FaceRegularityState.residual + FaceRegularityState.structured + rw [conditionalMean_finset_sum] + rw [← Finset.sum_sub_distrib, Finset.sum_mul] + _ = + ∑ i ∈ s, + mean (fun x => + S.residual (f i) x * + cutTestProduct u x) := + mean_finset_sum s + (fun i x => + S.residual (f i) x * + cutTestProduct u x) + _ = ∑ i ∈ s, S.faceCutCorrelation (f i) u := by + rfl + +theorem FaceRegularityState.booleanCutCorrelation_finset_sum + {Ω ι : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) + (s : Finset ι) (f : ι → Ω → ℝ) + (A : BooleanCutTest Ω) : + S.booleanCutCorrelation + (fun x => ∑ i ∈ s, f i x) A = + ∑ i ∈ s, S.booleanCutCorrelation (f i) A := by + unfold FaceRegularityState.booleanCutCorrelation + calc + mean (fun x => + S.residual (fun y => ∑ i ∈ s, f i y) x * + A.eval x) = + mean (fun x => + ∑ i ∈ s, + S.residual (f i) x * A.eval x) := by + apply congrArg mean + funext x + unfold FaceRegularityState.residual + FaceRegularityState.structured + rw [conditionalMean_finset_sum] + rw [← Finset.sum_sub_distrib, Finset.sum_mul] + _ = + ∑ i ∈ s, + mean (fun x => + S.residual (f i) x * A.eval x) := + mean_finset_sum s + (fun i x => S.residual (f i) x * A.eval x) + _ = + ∑ i ∈ s, + S.booleanCutCorrelation (f i) A := by + rfl + +theorem FaceRegularityState.abs_coarseAtom_faceCutCorrelation_le_card_mul + {G : Type*} [Fintype G] [DecidableEq G] + {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + {fineUpper coarseUpper : + FacePartition (Fin r → G)} + (hupper : fineUpper ≤ coarseUpper) + (a : coarseUpper.parts) + {ε : ℝ} + (hregular : + ∀ b : fineUpper.parts, + S.IsFaceCutRegular + (partitionAtomIndicator fineUpper b) ε) + (u : CutTestFamily G r) + (hu : IsBoundedCutTest u) : + |S.faceCutCorrelation + (partitionAtomIndicator coarseUpper a) u| ≤ + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * ε := by + rw [partitionAtomIndicator_eq_sum_fineAtomsInCoarseAtom_fun + hupper a, + S.faceCutCorrelation_finset_sum] + calc + |∑ b ∈ fineAtomsInCoarseAtom fineUpper coarseUpper a, + S.faceCutCorrelation + (partitionAtomIndicator fineUpper b) u| ≤ + ∑ b ∈ fineAtomsInCoarseAtom fineUpper coarseUpper a, + |S.faceCutCorrelation + (partitionAtomIndicator fineUpper b) u| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ + ∑ _b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, ε := by + apply Finset.sum_le_sum + intro b _ + exact hregular b u hu + _ = + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * ε := by + simp + +theorem FaceRegularityState.abs_coarseAtom_booleanCutCorrelation_le_card_mul + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (a : coarseUpper.parts) + (A : BooleanCutTest Ω) + {ε : ℝ} + (hregular : + ∀ b : fineUpper.parts, + |S.booleanCutCorrelation + (partitionAtomIndicator fineUpper b) A| ≤ ε) + : + |S.booleanCutCorrelation + (partitionAtomIndicator coarseUpper a) A| ≤ + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * ε := by + rw [partitionAtomIndicator_eq_sum_fineAtomsInCoarseAtom_fun + hupper a, + S.booleanCutCorrelation_finset_sum] + calc + |∑ b ∈ fineAtomsInCoarseAtom fineUpper coarseUpper a, + S.booleanCutCorrelation + (partitionAtomIndicator fineUpper b) A| ≤ + ∑ b ∈ fineAtomsInCoarseAtom fineUpper coarseUpper a, + |S.booleanCutCorrelation + (partitionAtomIndicator fineUpper b) A| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ + ∑ _b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, ε := by + apply Finset.sum_le_sum + intro b _ + exact hregular b + _ = + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * ε := by + simp + +theorem abs_orderedCoarseUpperAtom_faceCutCorrelation_le_card_mul + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (fineUpper coarseUpper : + OrderedFacePartitionSystem G k (j + 1)) + (hupper : + OrderedFacePartitionRefines fineUpper coarseUpper) + {ε : ℝ} + (hregular : + IsPreliminaryOrderedRegular lower fineUpper ε) + (e : OrderedFace k (j + 1)) + (a : (coarseUpper e).parts) + (u : CutTestFamily G (j + 1)) + (hu : IsBoundedCutTest u) : + |(⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)).faceCutCorrelation + (partitionAtomIndicator (coarseUpper e) a) u| ≤ + ((fineAtomsInCoarseAtom + (fineUpper e) (coarseUpper e) a).card : ℝ) * ε := by + apply + FaceRegularityState.abs_coarseAtom_faceCutCorrelation_le_card_mul + (⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)) + (hupper e) a + · intro b + exact (hregular.toBounded) e b + · exact hu + +theorem abs_orderedCoarseUpperAtom_faceCutCorrelation_le_complexity_mul + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (fineUpper coarseUpper : + OrderedFacePartitionSystem G k (j + 1)) + (hupper : + OrderedFacePartitionRefines fineUpper coarseUpper) + {ε : ℝ} (hε : 0 ≤ ε) + (hregular : + IsPreliminaryOrderedRegular lower fineUpper ε) + (e : OrderedFace k (j + 1)) + (a : (coarseUpper e).parts) + (u : CutTestFamily G (j + 1)) + (hu : IsBoundedCutTest u) : + |(⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)).faceCutCorrelation + (partitionAtomIndicator (coarseUpper e) a) u| ≤ + (FacePartition.complexity (fineUpper e) : ℝ) * ε := by + exact le_trans + (abs_orderedCoarseUpperAtom_faceCutCorrelation_le_card_mul + lower fineUpper coarseUpper hupper hregular e a u hu) + (mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr + (card_fineAtomsInCoarseAtom_le_complexity + (fineUpper e) (coarseUpper e) a)) + hε) + +theorem IsPreliminaryOrderedRegular.coarseUpper + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (fineUpper coarseUpper : + OrderedFacePartitionSystem G k (j + 1)) + (hupper : + OrderedFacePartitionRefines fineUpper coarseUpper) + {ε : ℝ} (hε : 0 ≤ ε) + (hregular : + IsPreliminaryOrderedRegular lower fineUpper ε) + (M : ℕ) + (hcomplexity : + ∀ e, FacePartition.complexity (fineUpper e) ≤ M) : + IsPreliminaryOrderedRegular + lower coarseUpper ((M : ℝ) * ε) := by + intro e a b + have hcard := + FaceRegularityState.abs_coarseAtom_booleanCutCorrelation_le_card_mul + (⟨orderedBoundaryPartition lower e⟩ : + FaceRegularityState (Fin (j + 1) → G)) + (hupper e) a + (boundaryBooleanCutSupport b) + (fun c => hregular e c b) + exact le_trans hcard + (mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr + ((card_fineAtomsInCoarseAtom_le_complexity + (fineUpper e) (coarseUpper e) a).trans + (hcomplexity e))) + hε) + +theorem atomBoundaryDefect_coarseAtom_eq_sum_fineAtoms + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fineBoundary coarseBoundary : + FacePartition Ω) + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (a : coarseUpper.parts) (x : Ω) : + atomBoundaryDefect + fineBoundary coarseBoundary coarseUpper a x = + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x := by + unfold atomBoundaryDefect + rw [partitionAtomIndicator_eq_sum_fineAtomsInCoarseAtom_fun + hupper a] + rw [conditionalMean_finset_sum, + conditionalMean_finset_sum, + ← Finset.sum_sub_distrib] + +theorem atomBoundaryDefect_coarseAtom_sq_le_card_mul_sum + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fineBoundary coarseBoundary : + FacePartition Ω) + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (a : coarseUpper.parts) (x : Ω) : + atomBoundaryDefect + fineBoundary coarseBoundary coarseUpper a x ^ 2 ≤ + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2 := by + rw [atomBoundaryDefect_coarseAtom_eq_sum_fineAtoms + fineBoundary coarseBoundary hupper a x] + simpa using + (sq_sum_le_card_mul_sum_sq + (s := fineAtomsInCoarseAtom + fineUpper coarseUpper a) + (f := fun b => + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x)) + +theorem mean_atomBoundaryDefect_coarseAtom_sq_le_card_mul_sum + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fineBoundary coarseBoundary : + FacePartition Ω) + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) + (a : coarseUpper.parts) : + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary coarseUpper a x ^ 2) ≤ + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2) := by + calc + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary coarseUpper a x ^ 2) ≤ + mean (fun x => + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2) := + mean_mono fun x => + atomBoundaryDefect_coarseAtom_sq_le_card_mul_sum + fineBoundary coarseBoundary hupper a x + _ = + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * + mean (fun x => + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2) := + mean_smul _ _ + _ = + ((fineAtomsInCoarseAtom + fineUpper coarseUpper a).card : ℝ) * + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2) := by + rw [mean_finset_sum] + +theorem sum_fineAtomsInCoarseAtom + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fineUpper coarseUpper : FacePartition Ω) + (F : fineUpper.parts → ℝ) : + ∑ a : coarseUpper.parts, + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, F b = + ∑ b : fineUpper.parts, F b := by + classical + simpa [fineAtomsInCoarseAtom] using + (Finset.sum_fiberwise + (Finset.univ : Finset fineUpper.parts) + (coarseAtomOfFineAtom fineUpper coarseUpper) F) + +theorem partitionAtomEnergy_sub_coarseUpper_le_complexity_mul_fineUpper + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fineBoundary coarseBoundary : + FacePartition Ω} + (hboundary : fineBoundary ≤ coarseBoundary) + {fineUpper coarseUpper : FacePartition Ω} + (hupper : fineUpper ≤ coarseUpper) : + partitionAtomEnergy fineBoundary coarseUpper - + partitionAtomEnergy coarseBoundary coarseUpper ≤ + (FacePartition.complexity fineUpper : ℝ) * + (partitionAtomEnergy fineBoundary fineUpper - + partitionAtomEnergy coarseBoundary fineUpper) := by + rw [partitionAtomEnergy_sub_eq_sum_mean_sq + hboundary coarseUpper, + partitionAtomEnergy_sub_eq_sum_mean_sq + hboundary fineUpper] + change + (∑ a : coarseUpper.parts, + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary coarseUpper a x ^ 2)) ≤ + (FacePartition.complexity fineUpper : ℝ) * + ∑ b : fineUpper.parts, + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2) + calc + (∑ a : coarseUpper.parts, + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary coarseUpper a x ^ 2)) ≤ + ∑ a : coarseUpper.parts, + (FacePartition.complexity fineUpper : ℝ) * + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2) := by + apply Finset.sum_le_sum + intro a _ + exact le_trans + (mean_atomBoundaryDefect_coarseAtom_sq_le_card_mul_sum + fineBoundary coarseBoundary hupper a) + (mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr + (card_fineAtomsInCoarseAtom_le_complexity + fineUpper coarseUpper a)) + (Finset.sum_nonneg fun b _ => + mean_nonneg fun x => sq_nonneg _)) + _ = + (FacePartition.complexity fineUpper : ℝ) * + ∑ a : coarseUpper.parts, + ∑ b ∈ fineAtomsInCoarseAtom + fineUpper coarseUpper a, + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2) := by + rw [Finset.mul_sum] + _ = + (FacePartition.complexity fineUpper : ℝ) * + ∑ b : fineUpper.parts, + mean (fun x => + atomBoundaryDefect + fineBoundary coarseBoundary fineUpper b x ^ 2) := by + rw [sum_fineAtomsInCoarseAtom] + +theorem orderedAtomEnergy_sub_coarseUpper_le_complexity_mul_fineUpper + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {fineLower coarseLower : + OrderedFacePartitionSystem G k j} + (hlower : + OrderedFacePartitionRefines fineLower coarseLower) + (e : OrderedFace k (j + 1)) + {fineUpper coarseUpper : + FacePartition (Fin (j + 1) → G)} + (hupper : fineUpper ≤ coarseUpper) : + orderedAtomEnergy fineLower e coarseUpper - + orderedAtomEnergy coarseLower e coarseUpper ≤ + (FacePartition.complexity fineUpper : ℝ) * + (orderedAtomEnergy fineLower e fineUpper - + orderedAtomEnergy coarseLower e fineUpper) := by + exact + partitionAtomEnergy_sub_coarseUpper_le_complexity_mul_fineUpper + (orderedBoundaryPartition_mono hlower e) hupper + +namespace OrderedCoarseFineComplex + +noncomputable def coarseUpperFaceAtomEnergyGap + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : ℝ := + orderedAtomEnergy + (P.fine.partition j.castSucc) e + (P.coarse.partition j.succ e) - + orderedAtomEnergy + (P.coarse.partition j.castSucc) e + (P.coarse.partition j.succ e) + +theorem coarseUpperFaceAtomEnergyGap_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : + 0 ≤ P.coarseUpperFaceAtomEnergyGap j e := by + apply sub_nonneg.mpr + exact orderedAtomEnergy_mono + (fun f => P.refines j.castSucc f) + e (P.coarse.partition j.succ e) + +theorem coarseUpperFaceAtomEnergyGap_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : + P.coarseUpperFaceAtomEnergyGap j e ≤ + (FacePartition.complexity + (P.fine.partition j.succ e) : ℝ) * + P.faceAtomEnergyGap j e := by + exact + orderedAtomEnergy_sub_coarseUpper_le_complexity_mul_fineUpper + (fun f => P.refines j.castSucc f) e + (P.refines j.succ e) + +noncomputable def coarseUpperLayerAtomEnergyGap + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) : ℝ := + orderedLayerAtomEnergy + (P.fine.partition j.castSucc) + (P.coarse.partition j.succ) - + orderedLayerAtomEnergy + (P.coarse.partition j.castSucc) + (P.coarse.partition j.succ) + +theorem coarseUpperLayerAtomEnergyGap_eq_sum_face + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) : + P.coarseUpperLayerAtomEnergyGap j = + ∑ e : OrderedFace k (j.1 + 1), + P.coarseUpperFaceAtomEnergyGap j e := by + unfold coarseUpperLayerAtomEnergyGap + coarseUpperFaceAtomEnergyGap + orderedLayerAtomEnergy + rw [Finset.sum_sub_distrib] + rfl + +theorem coarseUpperLayerAtomEnergyGap_le_sum_complexity_mul + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) : + P.coarseUpperLayerAtomEnergyGap j ≤ + ∑ e : OrderedFace k (j.1 + 1), + (FacePartition.complexity + (P.fine.partition j.succ e) : ℝ) * + P.faceAtomEnergyGap j e := by + rw [P.coarseUpperLayerAtomEnergyGap_eq_sum_face j] + exact Finset.sum_le_sum fun e _ => + P.coarseUpperFaceAtomEnergyGap_le j e + +theorem coarseUpperLayerAtomEnergyGap_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) (M : ℕ) + (hcomplexity : + ∀ e : OrderedFace k (j.1 + 1), + FacePartition.complexity + (P.fine.partition j.succ e) ≤ M) : + P.coarseUpperLayerAtomEnergyGap j ≤ + (M : ℝ) * P.layerAtomEnergyGap j := by + rw [P.layerAtomEnergyGap_eq_sum_face j] + calc + P.coarseUpperLayerAtomEnergyGap j ≤ + ∑ e : OrderedFace k (j.1 + 1), + (FacePartition.complexity + (P.fine.partition j.succ e) : ℝ) * + P.faceAtomEnergyGap j e := + P.coarseUpperLayerAtomEnergyGap_le_sum_complexity_mul j + _ ≤ + ∑ e : OrderedFace k (j.1 + 1), + (M : ℝ) * P.faceAtomEnergyGap j e := by + apply Finset.sum_le_sum + intro e _ + exact mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr (hcomplexity e)) + (P.faceAtomEnergyGap_nonneg j e) + _ = + (M : ℝ) * + ∑ e : OrderedFace k (j.1 + 1), + P.faceAtomEnergyGap j e := by + rw [Finset.mul_sum] + +theorem preliminaryRegular_coarseUpper + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + (j : Fin r) (M : ℕ) + (hε : 0 ≤ ε j) + (hcomplexity : + ∀ e : OrderedFace k (j.1 + 1), + FacePartition.complexity + (P.fine.partition j.succ e) ≤ M) : + IsPreliminaryOrderedRegular + (P.fine.partition j.castSucc) + (P.coarse.partition j.succ) + ((M : ℝ) * ε j) := by + exact (hregular j).coarseUpper + (P.fine.partition j.castSucc) + (P.fine.partition j.succ) + (P.coarse.partition j.succ) + (fun e => P.refines j.succ e) + hε M hcomplexity + +end OrderedCoarseFineComplex + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseOrderedRemoval.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseOrderedRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..a22e4d912b11a4a25da742589c651ae5d64e77f7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseOrderedRemoval.lean @@ -0,0 +1,1472 @@ +import Mathlib.Algebra.Order.Chebyshev +import OAI.Combinatorics.Progressions.FixedDensity.BundleCountingRecurrence +import OAI.Combinatorics.Progressions.FixedDensity.CoarseAtomBridge + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable local instance orderedEnergyFaceLinearOrder + (k r : ℕ) : LinearOrder (OrderedFace k r) := + (Fintype.equivFin (OrderedFace k r)).linearOrder + +namespace FaceRegularityState + +theorem energy_sub_eq_mean_sq_of_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (T S : FaceRegularityState Ω) + (hTS : T.partition ≤ S.partition) + (f : Ω → ℝ) : + T.energy f - S.energy f = + mean (fun x => + (T.structured f x - S.structured f x) ^ 2) := by + simpa [energy, structured] using + partitionEnergy_sub_eq_mean_sq + T.partition S.partition hTS f + +theorem energy_mono_of_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (T S : FaceRegularityState Ω) + (hTS : T.partition ≤ S.partition) + (f : Ω → ℝ) : + S.energy f ≤ T.energy f := by + simpa [energy] using + partitionEnergy_mono + T.partition S.partition hTS f + +end FaceRegularityState + +def OrderedRefines + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (T S : OrderedRegularitySystem G k r) : Prop := + ∀ e, (T e).partition ≤ (S e).partition + +theorem OrderedRefines.refl + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (S : OrderedRegularitySystem G k r) : + OrderedRefines S S := + fun _ => le_rfl + +theorem OrderedRefines.trans + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {U T S : OrderedRegularitySystem G k r} + (hUT : OrderedRefines U T) + (hTS : OrderedRefines T S) : + OrderedRefines U S := + fun e => (hUT e).trans (hTS e) + +noncomputable def orderedTotalEnergy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (S : OrderedRegularitySystem G k r) : ℝ := + ∑ e : OrderedFace k r, + (S e).energy (H.edgeWeight e) + +theorem orderedTotalEnergy_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (S : OrderedRegularitySystem G k r) : + 0 ≤ orderedTotalEnergy H S := by + unfold orderedTotalEnergy + apply Finset.sum_nonneg + intro e _he + exact partitionEnergy_nonneg + (S e).partition (H.edgeWeight e) + +theorem orderedTotalEnergy_le_card + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {H : WeightedOrderedPattern G k r} + (hH : H.EdgeWeightsInUnitInterval) + (S : OrderedRegularitySystem G k r) : + orderedTotalEnergy H S ≤ + Fintype.card (OrderedFace k r) := by + unfold orderedTotalEnergy + calc + (∑ e : OrderedFace k r, + (S e).energy (H.edgeWeight e)) ≤ + ∑ _e : OrderedFace k r, (1 : ℝ) := by + apply Finset.sum_le_sum + intro e _he + exact partitionEnergy_le_one + (S e).partition + (fun y => (hH e y).1) + (fun y => (hH e y).2) + _ = Fintype.card (OrderedFace k r) := by + simp + +theorem orderedTotalEnergy_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + {T S : OrderedRegularitySystem G k r} + (hTS : OrderedRefines T S) : + orderedTotalEnergy H S ≤ orderedTotalEnergy H T := by + unfold orderedTotalEnergy + apply Finset.sum_le_sum + intro e _he + exact (T e).energy_mono_of_le + (S e) (hTS e) (H.edgeWeight e) + +theorem orderedTotalEnergy_sub_eq_sum_mean_sq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + {T S : OrderedRegularitySystem G k r} + (hTS : OrderedRefines T S) : + orderedTotalEnergy H T - orderedTotalEnergy H S = + ∑ e : OrderedFace k r, + mean (fun y => + ((T e).structured (H.edgeWeight e) y - + (S e).structured (H.edgeWeight e) y) ^ 2) := by + unfold orderedTotalEnergy + rw [← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro e _he + exact + (T e).energy_sub_eq_mean_sq_of_le + (S e) (hTS e) (H.edgeWeight e) + +theorem orderedTotalEnergy_sub_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + {T S : OrderedRegularitySystem G k r} + (hTS : OrderedRefines T S) : + 0 ≤ orderedTotalEnergy H T - + orderedTotalEnergy H S := + sub_nonneg.mpr (orderedTotalEnergy_mono H hTS) + +theorem mean_comp_orderedFaceTuple + {G : Type*} [Fintype G] [Nonempty G] + {k r : ℕ} + (e : OrderedFace k r) + (f : (Fin r → G) → ℝ) : + mean (fun x : Fin k → G => + f (orderedFaceTuple e x)) = mean f := by + rw [mean_splitOrderedFace e] + unfold mean₂ + simp + +theorem mixedOrderedPatternTerm_sq_le_edgeDiff_sq + {G : Type*} + {k r : ℕ} + {H K : WeightedOrderedPattern G k r} + (hH : H.EdgeWeightsInUnitInterval) + (hK : K.EdgeWeightsInUnitInterval) + (e : OrderedFace k r) (x : Fin k → G) : + mixedOrderedPatternTerm H K e x ^ 2 ≤ + (H.edgeWeight e (orderedFaceTuple e x) - + K.edgeWeight e (orderedFaceTuple e x)) ^ 2 := by + let A : ℝ := + ∏ f ∈ (Finset.univ : Finset (OrderedFace k r)) + with f < e, + H.edgeWeight f (orderedFaceTuple f x) + let B : ℝ := + ∏ f ∈ (Finset.univ : Finset (OrderedFace k r)) + with e < f, + K.edgeWeight f (orderedFaceTuple f x) + have hA0 : 0 ≤ A := by + unfold A + apply Finset.prod_nonneg + intro f hf + exact (hH f (orderedFaceTuple f x)).1 + have hA1 : A ≤ 1 := by + unfold A + apply Finset.prod_le_one₀ + · intro f hf + exact (hH f (orderedFaceTuple f x)).1 + · intro f hf + exact (hH f (orderedFaceTuple f x)).2 + have hB0 : 0 ≤ B := by + unfold B + apply Finset.prod_nonneg + intro f hf + exact (hK f (orderedFaceTuple f x)).1 + have hB1 : B ≤ 1 := by + unfold B + apply Finset.prod_le_one₀ + · intro f hf + exact (hK f (orderedFaceTuple f x)).1 + · intro f hf + exact (hK f (orderedFaceTuple f x)).2 + have hAB0 : 0 ≤ A * B := + mul_nonneg hA0 hB0 + have hAB1 : A * B ≤ 1 := by + calc + A * B ≤ 1 * B := + mul_le_mul_of_nonneg_right hA1 hB0 + _ ≤ 1 * 1 := + mul_le_mul_of_nonneg_left hB1 zero_le_one + _ = 1 := one_mul 1 + have hABsq : (A * B) ^ 2 ≤ 1 := by + simpa using + (sq_le_sq₀ hAB0 zero_le_one).2 hAB1 + unfold mixedOrderedPatternTerm + change + ((H.edgeWeight e (orderedFaceTuple e x) - + K.edgeWeight e (orderedFaceTuple e x)) * + A * B) ^ 2 ≤ + (H.edgeWeight e (orderedFaceTuple e x) - + K.edgeWeight e (orderedFaceTuple e x)) ^ 2 + calc + ((H.edgeWeight e (orderedFaceTuple e x) - + K.edgeWeight e (orderedFaceTuple e x)) * + A * B) ^ 2 = + (H.edgeWeight e (orderedFaceTuple e x) - + K.edgeWeight e (orderedFaceTuple e x)) ^ 2 * + (A * B) ^ 2 := by ring + _ ≤ + (H.edgeWeight e (orderedFaceTuple e x) - + K.edgeWeight e (orderedFaceTuple e x)) ^ 2 * 1 := + mul_le_mul_of_nonneg_left hABsq (sq_nonneg _) + _ = _ := mul_one _ + +theorem mixedOrderedPatternCorrelation_sq_le_mean_edgeDiff_sq + {G : Type*} [Fintype G] [Nonempty G] + {k r : ℕ} + {H K : WeightedOrderedPattern G k r} + (hH : H.EdgeWeightsInUnitInterval) + (hK : K.EdgeWeightsInUnitInterval) + (e : OrderedFace k r) : + |mixedOrderedPatternCorrelation H K e| ^ 2 ≤ + mean (fun y => + (H.edgeWeight e y - K.edgeWeight e y) ^ 2) := by + calc + |mixedOrderedPatternCorrelation H K e| ^ 2 = + mixedOrderedPatternCorrelation H K e ^ 2 := by + rw [sq_abs] + _ ≤ + mean (fun x => + mixedOrderedPatternTerm H K e x ^ 2) := by + exact mean_square_le_mean_square _ + _ ≤ + mean (fun x => + (H.edgeWeight e (orderedFaceTuple e x) - + K.edgeWeight e (orderedFaceTuple e x)) ^ 2) := by + exact mean_mono fun x => + mixedOrderedPatternTerm_sq_le_edgeDiff_sq + hH hK e x + _ = + mean (fun y => + (H.edgeWeight e y - K.edgeWeight e y) ^ 2) := + mean_comp_orderedFaceTuple + (G := G) (k := k) (r := r) e + (fun y => + (H.edgeWeight e y - K.edgeWeight e y) ^ 2) + +theorem regularizedOrderedPattern_count_sub_sq_le_totalEnergyGap + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {H : WeightedOrderedPattern G k r} + (hH : H.EdgeWeightsInUnitInterval) + {fine coarse : OrderedRegularitySystem G k r} + (hrefines : OrderedRefines fine coarse) : + |(regularizedOrderedPattern H fine).patternCount - + (regularizedOrderedPattern H coarse).patternCount| ^ 2 ≤ + (Fintype.card (OrderedFace k r) : ℝ) * + (orderedTotalEnergy H fine - + orderedTotalEnergy H coarse) := by + let F := regularizedOrderedPattern H fine + let C := regularizedOrderedPattern H coarse + have hF : F.EdgeWeightsInUnitInterval := + regularizedOrderedPattern_unitInterval hH fine + have hC : C.EdgeWeightsInUnitInterval := + regularizedOrderedPattern_unitInterval hH coarse + have habs : + |F.patternCount - C.patternCount| ≤ + ∑ e : OrderedFace k r, + |mixedOrderedPatternCorrelation F C e| := + abs_patternCount_sub_le_sum_mixedOrderedPatternCorrelation F C + have hsum0 : + 0 ≤ ∑ e : OrderedFace k r, + |mixedOrderedPatternCorrelation F C e| := + Finset.sum_nonneg fun e _ => abs_nonneg _ + have hsquare : + |F.patternCount - C.patternCount| ^ 2 ≤ + (∑ e : OrderedFace k r, + |mixedOrderedPatternCorrelation F C e|) ^ 2 := + (sq_le_sq₀ (abs_nonneg _) hsum0).2 habs + calc + |F.patternCount - C.patternCount| ^ 2 ≤ + (∑ e : OrderedFace k r, + |mixedOrderedPatternCorrelation F C e|) ^ 2 := + hsquare + _ ≤ + (Fintype.card (OrderedFace k r) : ℝ) * + ∑ e : OrderedFace k r, + |mixedOrderedPatternCorrelation F C e| ^ 2 := by + simpa using + sq_sum_le_card_mul_sum_sq + (s := (Finset.univ : + Finset (OrderedFace k r))) + (f := fun e => + |mixedOrderedPatternCorrelation F C e|) + _ ≤ + (Fintype.card (OrderedFace k r) : ℝ) * + ∑ e : OrderedFace k r, + mean (fun y => + ((fine e).structured (H.edgeWeight e) y - + (coarse e).structured + (H.edgeWeight e) y) ^ 2) := by + apply mul_le_mul_of_nonneg_left + · apply Finset.sum_le_sum + intro e _he + exact + mixedOrderedPatternCorrelation_sq_le_mean_edgeDiff_sq + hF hC e + · positivity + _ = + (Fintype.card (OrderedFace k r) : ℝ) * + (orderedTotalEnergy H fine - + orderedTotalEnergy H coarse) := by + rw [orderedTotalEnergy_sub_eq_sum_mean_sq H hrefines] + +theorem regularizedOrderedPattern_count_abs_sub_lt_of_energyGap + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {H : WeightedOrderedPattern G k r} + (hH : H.EdgeWeightsInUnitInterval) + {fine coarse : OrderedRegularitySystem G k r} + (hrefines : OrderedRefines fine coarse) + {γ : ℝ} (hγ : 0 < γ) + (hgap : + (Fintype.card (OrderedFace k r) : ℝ) * + (orderedTotalEnergy H fine - + orderedTotalEnergy H coarse) < + γ ^ 2) : + |(regularizedOrderedPattern H fine).patternCount - + (regularizedOrderedPattern H coarse).patternCount| < + γ := by + have hsquare : + |(regularizedOrderedPattern H fine).patternCount - + (regularizedOrderedPattern H coarse).patternCount| ^ 2 < + γ ^ 2 := + (regularizedOrderedPattern_count_sub_sq_le_totalEnergyGap + hH hrefines).trans_lt hgap + exact + (sq_lt_sq₀ (abs_nonneg _) hγ.le).mp hsquare + +theorem exists_adjacent_sub_le_div + (E : ℕ → ℝ) {m : ℕ} (hm : 0 < m) + {B : ℝ} + (hE0 : 0 ≤ E 0) + (hEm : E m ≤ B) : + ∃ i : ℕ, i < m ∧ + E (i + 1) - E i ≤ B / m := by + have htel : + ∑ i ∈ Finset.range m, + (E (i + 1) - E i) = + E m - E 0 := by + exact Finset.sum_range_sub E m + have hsum : + ∑ i ∈ Finset.range m, + (E (i + 1) - E i) ≤ + ∑ _i ∈ Finset.range m, B / (m : ℝ) := by + rw [htel] + calc + E m - E 0 ≤ B := by linarith + _ = ∑ _i ∈ Finset.range m, + B / (m : ℝ) := by + simp only [Finset.sum_const, Finset.card_range, + nsmul_eq_mul] + field_simp + obtain ⟨i, hi, hsmall⟩ := + Finset.exists_le_of_sum_le + ⟨0, Finset.mem_range.mpr hm⟩ hsum + exact ⟨i, Finset.mem_range.mp hi, hsmall⟩ + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem finsetIndicator_biUnion_le_sum + {ι Ω : Type*} [DecidableEq Ω] + (s : Finset ι) (F : ι → Finset Ω) (x : Ω) : + finsetIndicator (s.biUnion F) x ≤ + ∑ i ∈ s, finsetIndicator (F i) x := by + by_cases hx : x ∈ s.biUnion F + · obtain ⟨i, hi, hxi⟩ := Finset.mem_biUnion.mp hx + rw [finsetIndicator_of_mem hx] + calc + 1 = finsetIndicator (F i) x := + (finsetIndicator_of_mem hxi).symm + _ ≤ ∑ j ∈ s, finsetIndicator (F j) x := by + apply Finset.single_le_sum + (s := s) + (f := fun j => finsetIndicator (F j) x) + · intro j hj + by_cases hxj : x ∈ F j <;> simp [hxj] + · exact hi + · rw [finsetIndicator_of_not_mem hx] + exact Finset.sum_nonneg fun i _ => by + by_cases hxi : x ∈ F i <;> simp [hxi] + +theorem mean_finsetIndicator_biUnion_le_sum + {ι Ω : Type*} [DecidableEq Ω] + [Fintype Ω] + (s : Finset ι) (F : ι → Finset Ω) : + mean (finsetIndicator (s.biUnion F)) ≤ + ∑ i ∈ s, mean (finsetIndicator (F i)) := by + calc + mean (finsetIndicator (s.biUnion F)) ≤ + mean (fun x => ∑ i ∈ s, + finsetIndicator (F i) x) := + mean_mono (finsetIndicator_biUnion_le_sum s F) + _ = ∑ i ∈ s, mean (finsetIndicator (F i)) := + mean_finset_sum s (fun i => finsetIndicator (F i)) + +noncomputable def ownAtomBadBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (α β : ℝ) : Finset Ω := by + classical + exact + (Finset.univ : Finset upper.parts).biUnion fun a => + a.1 ∩ atomBadBaseSupport fine coarse upper a α β + +@[simp] +theorem mem_ownAtomBadBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (α β : ℝ) (x : Ω) : + x ∈ ownAtomBadBaseSupport fine coarse upper α β ↔ + x ∈ atomBadBaseSupport fine coarse upper + (partitionAtomAt upper x) α β := by + classical + constructor + · intro hx + rw [ownAtomBadBaseSupport] at hx + obtain ⟨a, _ha, hxpart⟩ := + Finset.mem_biUnion.mp hx + have hxa : x ∈ a.1 := + (Finset.mem_inter.mp hxpart).1 + have hbad : + x ∈ atomBadBaseSupport + fine coarse upper a α β := + (Finset.mem_inter.mp hxpart).2 + have hcanonical : + partitionAtomAt upper x = a := + (partitionAtomAt_eq_iff_mem upper x a).2 hxa + simpa [hcanonical] using hbad + · intro hbad + rw [ownAtomBadBaseSupport] + apply Finset.mem_biUnion.mpr + refine + ⟨partitionAtomAt upper x, Finset.mem_univ _, ?_⟩ + apply Finset.mem_inter.mpr + exact + ⟨upper.mem_part (Finset.mem_univ x), hbad⟩ + +theorem mean_indicator_atom_inter_badBaseSupport_le_local + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] [Nonempty Ω] + (fine coarse upper : FacePartition Ω) + (a : upper.parts) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (a.1 ∩ atomBadBaseSupport + fine coarse upper a α β)) ≤ + α + mean + (atomBoundaryDefectSq fine coarse upper a) / β := by + calc + mean (finsetIndicator + (a.1 ∩ atomBadBaseSupport + fine coarse upper a α β)) ≤ + mean (finsetIndicator + (a.1 ∩ smallAverageBaseSupport coarse + (partitionAtomIndicator upper a) α)) + + mean (finsetIndicator + (largeDefectBaseSupport + fine coarse upper a β)) := by + exact + mean_indicator_inter_union_le_add + a.1 + (smallAverageBaseSupport coarse + (partitionAtomIndicator upper a) α) + (largeDefectBaseSupport fine coarse upper a β) + _ ≤ + α + mean + (atomBoundaryDefectSq fine coarse upper a) / β := + add_le_add + (mean_indicator_inter_smallAverageBaseSupport_le + coarse a.1 hα) + (mean_indicator_largeAverageBaseSupport_le + coarse + (atomBoundaryDefectSq fine coarse upper a) + (atomBoundaryDefectSq_nonneg + fine coarse upper a) hβ) + +theorem mean_indicator_ownAtomBadBaseSupport_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] [Nonempty Ω] + {fine coarse : FacePartition Ω} + (hfc : fine ≤ coarse) + (upper : FacePartition Ω) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (ownAtomBadBaseSupport fine coarse upper α β)) ≤ + (FacePartition.complexity upper : ℝ) * α + + (partitionAtomEnergy fine upper - + partitionAtomEnergy coarse upper) / β := by + calc + mean (finsetIndicator + (ownAtomBadBaseSupport fine coarse upper α β)) ≤ + ∑ a : upper.parts, + mean (finsetIndicator + (a.1 ∩ atomBadBaseSupport + fine coarse upper a α β)) := by + exact + mean_finsetIndicator_biUnion_le_sum + (Finset.univ : Finset upper.parts) + (fun a => + a.1 ∩ atomBadBaseSupport + fine coarse upper a α β) + _ ≤ + ∑ a : upper.parts, + (α + + mean (atomBoundaryDefectSq + fine coarse upper a) / β) := by + apply Finset.sum_le_sum + intro a _ha + exact + mean_indicator_atom_inter_badBaseSupport_le_local + fine coarse upper a hα hβ + _ = + (FacePartition.complexity upper : ℝ) * α + + (partitionAtomEnergy fine upper - + partitionAtomEnergy coarse upper) / β := by + rw [partitionAtomEnergy_sub_eq_sum_mean_sq hfc upper] + unfold atomBoundaryDefectSq atomBoundaryDefect + rw [Finset.sum_add_distrib] + simp only [Finset.sum_const, Finset.card_univ, + nsmul_eq_mul, Finset.sum_div] + rw [Fintype.card_coe] + rfl + +noncomputable def orderedOwnAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (α β : ℝ) : + Finset (Fin (j + 1) → G) := + ownAtomBadBaseSupport + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + upper α β + +@[simp] +theorem mem_orderedOwnAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (α β : ℝ) (x : Fin (j + 1) → G) : + x ∈ orderedOwnAtomBadBaseSupport + fine coarse e upper α β ↔ + x ∈ orderedAtomBadBaseSupport + fine coarse e upper + (partitionAtomAt upper x) α β := by + exact + mem_ownAtomBadBaseSupport + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + upper α β x + +theorem mean_indicator_orderedOwnAtomBadBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (orderedOwnAtomBadBaseSupport + fine coarse e upper α β)) ≤ + (FacePartition.complexity upper : ℝ) * α + + (orderedAtomEnergy fine e upper - + orderedAtomEnergy coarse e upper) / β := by + exact + mean_indicator_ownAtomBadBaseSupport_le + (orderedBoundaryPartition_mono hfc e) + upper hα hβ + +abbrev OrderedPositiveSubface (r : ℕ) := + (j : Fin r) ×' OrderedFace r (j.1 + 1) + +theorem exists_orderedFace_factor_through + {k s r : ℕ} (hsr : s ≤ r) (hrk : r ≤ k) + (f : OrderedFace k s) : + ∃ e : OrderedFace k r, ∃ d : OrderedFace r s, + d.trans e = f := by + classical + let sf : Finset (Fin k) := + Finset.univ.map f.toEmbedding + have hsf_card : sf.card = s := by + rw [show sf.card = + (Finset.univ : Finset (Fin s)).card by + exact Finset.card_map f.toEmbedding] + simp + have hsf_univ : sf ⊆ Finset.univ := + Finset.subset_univ sf + obtain ⟨t, hsf_t, _ht_univ, ht⟩ := + Finset.exists_subsuperset_card_eq + hsf_univ + (by simpa [hsf_card] using hsr) + (by simpa using hrk) + let e : OrderedFace k r := + t.orderEmbOfFin ht + have hf_mem (i : Fin s) : f i ∈ t := by + apply hsf_t + exact Finset.mem_map.mpr + ⟨i, Finset.mem_univ i, rfl⟩ + let ft : Fin s ↪o t := + OrderEmbedding.ofStrictMono + (fun i => ⟨f i, hf_mem i⟩) + (fun _ _ hij => f.strictMono hij) + let d : OrderedFace r s := + ft.trans (t.orderIsoOfFin ht).symm.toOrderEmbedding + refine ⟨e, d, ?_⟩ + apply RelEmbedding.ext + intro i + change + t.orderEmbOfFin ht + ((t.orderIsoOfFin ht).symm + ⟨f i, hf_mem i⟩) = + f i + rw [← Finset.coe_orderIsoOfFin_apply] + simp + +noncomputable def orderedFacePullbackFinset + {G : Type*} [Fintype G] [DecidableEq G] + {r j : ℕ} + (d : OrderedFace r j) + (S : Finset (Fin j → G)) : + Finset (Fin r → G) := by + classical + exact Finset.univ.filter fun y => + orderedFaceTuple d y ∈ S + +@[simp] +theorem mem_orderedFacePullbackFinset + {G : Type*} [Fintype G] [DecidableEq G] + {r j : ℕ} + (d : OrderedFace r j) + (S : Finset (Fin j → G)) + (y : Fin r → G) : + y ∈ orderedFacePullbackFinset d S ↔ + orderedFaceTuple d y ∈ S := by + simp [orderedFacePullbackFinset] + +theorem mean_indicator_orderedFacePullbackFinset + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {r j : ℕ} + (d : OrderedFace r j) + (S : Finset (Fin j → G)) : + mean (finsetIndicator + (orderedFacePullbackFinset d S)) = + mean (finsetIndicator S) := by + rw [show + finsetIndicator (orderedFacePullbackFinset d S) = + fun y => finsetIndicator S + (orderedFaceTuple d y) by + funext y + by_cases hy : orderedFaceTuple d y ∈ S + · rw [finsetIndicator_of_mem hy, + finsetIndicator_of_mem] + exact + (mem_orderedFacePullbackFinset d S y).2 hy + · rw [finsetIndicator_of_not_mem hy, + finsetIndicator_of_not_mem] + exact fun h => + hy ((mem_orderedFacePullbackFinset d S y).1 h)] + exact mean_comp_orderedFaceTuple d + (finsetIndicator S) + +noncomputable def orderedTopBadBaseDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) + (e : OrderedFace k r) + (α β : ℕ → ℝ) : + Finset (Fin r → G) := by + classical + exact + (Finset.univ : + Finset (OrderedPositiveSubface r)).biUnion fun q => + orderedFacePullbackFinset q.2 + (orderedOwnAtomBadBaseSupport + (fine.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (coarse.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e)) + (α (q.1.1 + 1)) + (β (q.1.1 + 1))) + +theorem mean_indicator_orderedTopBadBaseDeletion_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {fine coarse : OrderedPartitionComplex G k r} + (hfc : fine.Refines coarse) + (e : OrderedFace k r) + (α β : ℕ → ℝ) + (hα : ∀ j, 0 ≤ α (j + 1)) + (hβ : ∀ j, 0 < β (j + 1)) : + mean (finsetIndicator + (orderedTopBadBaseDeletion fine coarse e α β)) ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + (orderedAtomEnergy + (fine.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e)) - + orderedAtomEnergy + (coarse.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e))) / + β (q.1.1 + 1)) := by + calc + mean (finsetIndicator + (orderedTopBadBaseDeletion fine coarse e α β)) ≤ + ∑ q : OrderedPositiveSubface r, + mean (finsetIndicator + (orderedFacePullbackFinset q.2 + (orderedOwnAtomBadBaseSupport + (fine.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (coarse.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e)) + (α (q.1.1 + 1)) + (β (q.1.1 + 1))))) := by + exact + mean_finsetIndicator_biUnion_le_sum + (Finset.univ : + Finset (OrderedPositiveSubface r)) + (fun q => + orderedFacePullbackFinset q.2 + (orderedOwnAtomBadBaseSupport + (fine.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (coarse.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e)) + (α (q.1.1 + 1)) + (β (q.1.1 + 1)))) + _ ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + (orderedAtomEnergy + (fine.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e)) - + orderedAtomEnergy + (coarse.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e))) / + β (q.1.1 + 1)) := by + apply Finset.sum_le_sum + intro q _hq + rw [mean_indicator_orderedFacePullbackFinset] + have hlayer : + OrderedFacePartitionRefines + (fine.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (coarse.layer q.1.1 + (Nat.le_of_lt q.1.2)) := by + intro g + exact hfc + ⟨q.1.1, + Nat.lt_succ_iff.mpr + (Nat.le_of_lt q.1.2)⟩ g + exact + mean_indicator_orderedOwnAtomBadBaseSupport_le + hlayer + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e)) + (hα q.1.1) (hβ q.1.1) + +noncomputable def orderedBadBaseDeletionFamily + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) + (α β : ℕ → ℝ) : + OrderedPattern.DeletionFamily (G := G) k r := + fun e => orderedTopBadBaseDeletion fine coarse e α β + +theorem faceDeletionDensity_orderedBadBaseDeletionFamily_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {fine coarse : OrderedPartitionComplex G k r} + (hfc : fine.Refines coarse) + (α β : ℕ → ℝ) + (hα : ∀ j, 0 ≤ α (j + 1)) + (hβ : ∀ j, 0 < β (j + 1)) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + fine coarse α β) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + (orderedAtomEnergy + (fine.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e)) - + orderedAtomEnergy + (coarse.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (fine.partition q.1.succ + (q.2.trans e))) / + β (q.1.1 + 1)) := by + rw [show + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + fine coarse α β) e = + mean (finsetIndicator + (orderedTopBadBaseDeletion + fine coarse e α β)) by + unfold OrderedPattern.faceDeletionDensity + orderedBadBaseDeletionFamily + rw [mean_finsetIndicator]] + exact + mean_indicator_orderedTopBadBaseDeletion_le + hfc e α β hα hβ + +theorem faceDeletionDensity_orderedBadBaseDeletionFamily_constant_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r M : ℕ} + (P : OrderedCoarseFineComplex G k r) + (hcomplex : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (P.fine.partition j e) ≤ M) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + P.fine P.coarse (fun _ => α) (fun _ => β)) e ≤ + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + ((M : ℝ) * α + P.totalAtomEnergyGap / β) := by + calc + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + P.fine P.coarse (fun _ => α) (fun _ => β)) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * α + + (orderedAtomEnergy + (P.fine.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (P.fine.partition q.1.succ + (q.2.trans e)) - + orderedAtomEnergy + (P.coarse.layer q.1.1 + (Nat.le_of_lt q.1.2)) + (q.2.trans e) + (P.fine.partition q.1.succ + (q.2.trans e))) / β) := by + exact + faceDeletionDensity_orderedBadBaseDeletionFamily_le + P.refines (fun _ => α) (fun _ => β) + (fun _ => hα) (fun _ => hβ) e + _ ≤ + ∑ _q : OrderedPositiveSubface r, + ((M : ℝ) * α + + P.totalAtomEnergyGap / β) := by + apply Finset.sum_le_sum + intro q _hq + apply add_le_add + · apply mul_le_mul_of_nonneg_right _ hα + exact_mod_cast + hcomplex q.1.succ (q.2.trans e) + · apply div_le_div_of_nonneg_right _ hβ.le + have hfineLayer : + P.fine.layer q.1.1 + (Nat.le_of_lt q.1.2) = + P.fine.partition q.1.castSucc := by + rfl + have hcoarseLayer : + P.coarse.layer q.1.1 + (Nat.le_of_lt q.1.2) = + P.coarse.partition q.1.castSucc := by + rfl + rw [hfineLayer, hcoarseLayer] + change + P.faceAtomEnergyGap q.1 (q.2.trans e) ≤ + P.totalAtomEnergyGap + exact + P.faceAtomEnergyGap_le_total + q.1 (q.2.trans e) + _ = + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + ((M : ℝ) * α + + P.totalAtomEnergyGap / β) := by + simp only [Finset.sum_const, Finset.card_univ, + nsmul_eq_mul] + +theorem faceDeletionDensity_orderedBadBaseDeletionFamily_constant_le_of_bound + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r M : ℕ} + (P : OrderedCoarseFineComplex G k r) + (hcomplex : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (P.fine.partition j e) ≤ M) + {α β ε : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) + (hparameters : + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + ((M : ℝ) * α + P.totalAtomEnergyGap / β) ≤ + ε) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + P.fine P.coarse (fun _ => α) (fun _ => β)) e ≤ + ε := + (faceDeletionDensity_orderedBadBaseDeletionFamily_constant_le + P hcomplex hα hβ e).trans hparameters + +theorem ClosedOrderedAtomConfiguration.isGood_of_avoids_topBadBaseDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (hrk : r ≤ k) + (fine coarse : OrderedPartitionComplex G k r) + (x : Fin k → G) (α β : ℕ → ℝ) + (havoid : + ∀ e : OrderedFace k r, + orderedFaceTuple e x ∉ + orderedTopBadBaseDeletion + fine coarse e α β) : + (ClosedOrderedAtomConfiguration.ofTuple fine x).IsGood + fine coarse α β := by + apply + (ClosedOrderedAtomConfiguration.ofTuple fine x).isGood_of_avoids_badBases + fine coarse α β + intro j hj f hbad + obtain ⟨e, d, hde⟩ := + exists_orderedFace_factor_through + (Nat.succ_le_iff.mpr hj) hrk f + apply havoid e + rw [orderedTopBadBaseDeletion] + apply Finset.mem_biUnion.mpr + refine + ⟨⟨⟨j, hj⟩, d⟩, Finset.mem_univ _, ?_⟩ + rw [mem_orderedFacePullbackFinset] + have htuple : + orderedFaceTuple d (orderedFaceTuple e x) = + orderedFaceTuple f x := by + rw [show + orderedFaceTuple d (orderedFaceTuple e x) = + orderedFaceTuple (d.trans e) x by rfl, + hde] + rw [htuple, hde] + exact + (mem_orderedOwnAtomBadBaseSupport + (fine.layer j (Nat.le_of_lt hj)) + (coarse.layer j (Nat.le_of_lt hj)) + f + (fine.partition + ⟨j + 1, Nat.succ_lt_succ hj⟩ f) + (α (j + 1)) (β (j + 1)) + (orderedFaceTuple f x)).2 hbad + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace OrderedCoarseFineComplex + +noncomputable def orderedCoarseOwnAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) + (e : OrderedFace k (j.1 + 1)) + (α β : ℝ) : + Finset (Fin (j.1 + 1) → G) := + orderedOwnAtomBadBaseSupport + (P.fine.partition j.castSucc) + (P.coarse.partition j.castSucc) + e + (P.coarse.partition j.succ e) + α β + +@[simp] +theorem mem_orderedCoarseOwnAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) + (e : OrderedFace k (j.1 + 1)) + (α β : ℝ) (x : Fin (j.1 + 1) → G) : + x ∈ P.orderedCoarseOwnAtomBadBaseSupport j e α β ↔ + x ∈ orderedAtomBadBaseSupport + (P.fine.partition j.castSucc) + (P.coarse.partition j.castSucc) + e + (P.coarse.partition j.succ e) + (partitionAtomAt + (P.coarse.partition j.succ e) x) + α β := by + exact + mem_orderedOwnAtomBadBaseSupport + (P.fine.partition j.castSucc) + (P.coarse.partition j.castSucc) + e (P.coarse.partition j.succ e) α β x + +theorem mean_indicator_orderedCoarseOwnAtomBadBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) + (e : OrderedFace k (j.1 + 1)) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (P.orderedCoarseOwnAtomBadBaseSupport + j e α β)) ≤ + (FacePartition.complexity + (P.coarse.partition j.succ e) : ℝ) * α + + P.coarseUpperFaceAtomEnergyGap j e / β := by + unfold orderedCoarseOwnAtomBadBaseSupport + coarseUpperFaceAtomEnergyGap + apply + mean_indicator_orderedOwnAtomBadBaseSupport_le + (fun f => P.refines j.castSucc f) + e (P.coarse.partition j.succ e) hα hβ + +end OrderedCoarseFineComplex + +namespace ClosedOrderedAtomConfiguration + +def IsMixedGoodAt + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (j : ℕ) (hj : j < r) + (e : OrderedFace k (j + 1)) + (α β : ℝ) : Prop := + OrderedAtomIsGoodAtBoundary + (P.fine.partition + (⟨j, hj⟩ : Fin r).castSucc) + (P.coarse.partition + (⟨j, hj⟩ : Fin r).castSucc) + e + (P.coarse.partition + (⟨j, hj⟩ : Fin r).succ e) + (A.atom (⟨j, hj⟩ : Fin r).succ e) + (orderedFaceTuple e A.witness) + α β + +def IsMixedGood + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) : Prop := + ∀ (j : ℕ) (hj : j < r) (e : OrderedFace k (j + 1)), + A.IsMixedGoodAt P j hj e + (α (j + 1)) (β (j + 1)) + +theorem isMixedGoodAt_of_not_mem_coarseBadBase + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (j : ℕ) (hj : j < r) + (e : OrderedFace k (j + 1)) + (α β : ℝ) + (havoid : + orderedFaceTuple e A.witness ∉ + P.orderedCoarseOwnAtomBadBaseSupport + ⟨j, hj⟩ e α β) : + A.IsMixedGoodAt P j hj e α β := by + apply + orderedAtomIsGoodAtBoundary_of_not_mem_badBase + (P.fine.partition + (⟨j, hj⟩ : Fin r).castSucc) + (P.coarse.partition + (⟨j, hj⟩ : Fin r).castSucc) + e + (P.coarse.partition + (⟨j, hj⟩ : Fin r).succ e) + (A.atom (⟨j, hj⟩ : Fin r).succ e) + (orderedFaceTuple e A.witness) + α β + intro hbad + apply havoid + unfold + OrderedCoarseFineComplex.orderedCoarseOwnAtomBadBaseSupport + orderedOwnAtomBadBaseSupport + ownAtomBadBaseSupport + apply Finset.mem_biUnion.mpr + refine + ⟨A.atom (⟨j, hj⟩ : Fin r).succ e, + Finset.mem_univ _, ?_⟩ + exact Finset.mem_inter.mpr + ⟨A.mem_atom (⟨j, hj⟩ : Fin r).succ e, hbad⟩ + +theorem isMixedGood_of_avoids_coarseBadBases + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (havoid : + ∀ (j : ℕ) (hj : j < r) + (e : OrderedFace k (j + 1)), + orderedFaceTuple e A.witness ∉ + P.orderedCoarseOwnAtomBadBaseSupport + ⟨j, hj⟩ e + (α (j + 1)) (β (j + 1))) : + A.IsMixedGood P α β := by + intro j hj e + exact + A.isMixedGoodAt_of_not_mem_coarseBadBase + P j hj e (α (j + 1)) (β (j + 1)) + (havoid j hj e) + +end ClosedOrderedAtomConfiguration + +namespace OrderedCoarseFineComplex + +noncomputable def orderedCoarseTopBadBaseDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : OrderedFace k r) + (α β : ℕ → ℝ) : + Finset (Fin r → G) := by + classical + exact + (Finset.univ : + Finset (OrderedPositiveSubface r)).biUnion fun q => + orderedFacePullbackFinset q.2 + (P.orderedCoarseOwnAtomBadBaseSupport + q.1 (q.2.trans e) + (α (q.1.1 + 1)) + (β (q.1.1 + 1))) + +noncomputable def orderedCoarseBadBaseDeletionFamily + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (α β : ℕ → ℝ) : + OrderedPattern.DeletionFamily (G := G) k r := + fun e => P.orderedCoarseTopBadBaseDeletion e α β + +theorem mean_indicator_orderedCoarseTopBadBaseDeletion_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : OrderedFace k r) + (α β : ℕ → ℝ) + (hα : ∀ j, 0 ≤ α (j + 1)) + (hβ : ∀ j, 0 < β (j + 1)) : + mean (finsetIndicator + (P.orderedCoarseTopBadBaseDeletion e α β)) ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap + q.1 (q.2.trans e) / + β (q.1.1 + 1)) := by + calc + mean (finsetIndicator + (P.orderedCoarseTopBadBaseDeletion e α β)) ≤ + ∑ q : OrderedPositiveSubface r, + mean (finsetIndicator + (orderedFacePullbackFinset q.2 + (P.orderedCoarseOwnAtomBadBaseSupport + q.1 (q.2.trans e) + (α (q.1.1 + 1)) + (β (q.1.1 + 1))))) := by + exact + mean_finsetIndicator_biUnion_le_sum + (Finset.univ : + Finset (OrderedPositiveSubface r)) + (fun q => + orderedFacePullbackFinset q.2 + (P.orderedCoarseOwnAtomBadBaseSupport + q.1 (q.2.trans e) + (α (q.1.1 + 1)) + (β (q.1.1 + 1)))) + _ ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap + q.1 (q.2.trans e) / + β (q.1.1 + 1)) := by + apply Finset.sum_le_sum + intro q _hq + rw [mean_indicator_orderedFacePullbackFinset] + exact + mean_indicator_orderedCoarseOwnAtomBadBaseSupport_le + P q.1 (q.2.trans e) + (hα q.1.1) (hβ q.1.1) + +theorem faceDeletionDensity_orderedCoarseBadBaseDeletionFamily_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (α β : ℕ → ℝ) + (hα : ∀ j, 0 ≤ α (j + 1)) + (hβ : ∀ j, 0 < β (j + 1)) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (P.orderedCoarseBadBaseDeletionFamily α β) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap + q.1 (q.2.trans e) / + β (q.1.1 + 1)) := by + rw [show + OrderedPattern.faceDeletionDensity + (P.orderedCoarseBadBaseDeletionFamily α β) e = + mean (finsetIndicator + (P.orderedCoarseTopBadBaseDeletion e α β)) by + unfold OrderedPattern.faceDeletionDensity + orderedCoarseBadBaseDeletionFamily + rw [mean_finsetIndicator]] + exact + mean_indicator_orderedCoarseTopBadBaseDeletion_le + P e α β hα hβ + +theorem faceDeletionDensity_orderedCoarseBadBaseDeletionFamily_le_fineGap + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (α β : ℕ → ℝ) + (hα : ∀ j, 0 ≤ α (j + 1)) + (hβ : ∀ j, 0 < β (j + 1)) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (P.orderedCoarseBadBaseDeletionFamily α β) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + ((FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + P.faceAtomEnergyGap + q.1 (q.2.trans e)) / + β (q.1.1 + 1)) := by + calc + OrderedPattern.faceDeletionDensity + (P.orderedCoarseBadBaseDeletionFamily α β) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap + q.1 (q.2.trans e) / + β (q.1.1 + 1)) := + faceDeletionDensity_orderedCoarseBadBaseDeletionFamily_le + P α β hα hβ e + _ ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + ((FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + P.faceAtomEnergyGap + q.1 (q.2.trans e)) / + β (q.1.1 + 1)) := by + apply Finset.sum_le_sum + intro q _hq + exact add_le_add + (le_refl _) + (div_le_div_of_nonneg_right + (P.coarseUpperFaceAtomEnergyGap_le + q.1 (q.2.trans e)) + (hβ q.1.1).le) + +theorem faceDeletionDensity_orderedCoarseBadBaseDeletionFamily_constant_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r coarseBound fineBound : ℕ} + (P : OrderedCoarseFineComplex G k r) + (hcoarse : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (P.coarse.partition j e) ≤ coarseBound) + (hfine : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (P.fine.partition j e) ≤ fineBound) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (P.orderedCoarseBadBaseDeletionFamily + (fun _ => α) (fun _ => β)) e ≤ + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + ((coarseBound : ℝ) * α + + (fineBound : ℝ) * P.totalAtomEnergyGap / β) := by + calc + OrderedPattern.faceDeletionDensity + (P.orderedCoarseBadBaseDeletionFamily + (fun _ => α) (fun _ => β)) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * α + + ((FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + P.faceAtomEnergyGap + q.1 (q.2.trans e)) / β) := by + exact + faceDeletionDensity_orderedCoarseBadBaseDeletionFamily_le_fineGap + P (fun _ => α) (fun _ => β) + (fun _ => hα) (fun _ => hβ) e + _ ≤ + ∑ _q : OrderedPositiveSubface r, + ((coarseBound : ℝ) * α + + (fineBound : ℝ) * P.totalAtomEnergyGap / β) := by + apply Finset.sum_le_sum + intro q _hq + apply add_le_add + · exact mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr + (hcoarse q.1.succ (q.2.trans e))) + hα + · apply div_le_div_of_nonneg_right _ hβ.le + calc + (FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + P.faceAtomEnergyGap + q.1 (q.2.trans e) ≤ + (fineBound : ℝ) * + P.faceAtomEnergyGap + q.1 (q.2.trans e) := + mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr + (hfine q.1.succ (q.2.trans e))) + (P.faceAtomEnergyGap_nonneg + q.1 (q.2.trans e)) + _ ≤ + (fineBound : ℝ) * + P.totalAtomEnergyGap := + mul_le_mul_of_nonneg_left + (P.faceAtomEnergyGap_le_total + q.1 (q.2.trans e)) + (Nat.cast_nonneg fineBound) + _ = + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + ((coarseBound : ℝ) * α + + (fineBound : ℝ) * P.totalAtomEnergyGap / β) := by + simp only [Finset.sum_const, Finset.card_univ, + nsmul_eq_mul] + +end OrderedCoarseFineComplex + +namespace ClosedOrderedAtomConfiguration + +theorem isMixedGood_of_avoids_coarseTopBadBaseDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (hrk : r ≤ k) + (P : OrderedCoarseFineComplex G k r) + (x : Fin k → G) (α β : ℕ → ℝ) + (havoid : + ∀ e : OrderedFace k r, + orderedFaceTuple e x ∉ + P.orderedCoarseTopBadBaseDeletion e α β) : + (ClosedOrderedAtomConfiguration.ofTuple + P.coarse x).IsMixedGood P α β := by + apply + (ClosedOrderedAtomConfiguration.ofTuple + P.coarse x).isMixedGood_of_avoids_coarseBadBases + P α β + intro j hj f hbad + obtain ⟨e, d, hde⟩ := + exists_orderedFace_factor_through + (Nat.succ_le_iff.mpr hj) hrk f + apply havoid e + rw [ + OrderedCoarseFineComplex.orderedCoarseTopBadBaseDeletion] + apply Finset.mem_biUnion.mpr + refine + ⟨⟨⟨j, hj⟩, d⟩, Finset.mem_univ _, ?_⟩ + rw [mem_orderedFacePullbackFinset] + have htuple : + orderedFaceTuple d (orderedFaceTuple e x) = + orderedFaceTuple f x := by + rw [show + orderedFaceTuple d (orderedFaceTuple e x) = + orderedFaceTuple (d.trans e) x by rfl, + hde] + rw [htuple, hde] + exact hbad + +end ClosedOrderedAtomConfiguration + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseTargetRegularity.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseTargetRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..23e20eb113d2a02c60fe7d5a77f845c12dc0a48b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/CoarseTargetRegularity.lean @@ -0,0 +1,575 @@ +import OAI.Combinatorics.Progressions.FixedDensity.StrongOrderedComplexRegularity + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +structure CoarseTargetOrderedComplexRegularityCertificate + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) + (initial : OrderedPartitionComplex G k r) + (ε : (j : Fin r) → ℕ → ℝ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) where + index : Fin r → ℕ + coarse : OrderedPartitionComplex G k r + fine : OrderedPartitionComplex G k r + refines : fine.Refines coarse + coarse_refines_initial : coarse.Refines initial + coarse_topLayer_eq : + coarse.topLayer = initial.topLayer + fine_topLayer_eq : + fine.topLayer = initial.topLayer + index_lt : ∀ j, index j < length j + mixedRegular : + ∀ j : Fin r, + IsPreliminaryOrderedRegular + (fine.partition j.castSucc) + (coarse.partition j.succ) + (ε j (index j)) + gap_nonneg : + ∀ j : Fin r, + 0 ≤ + orderedLayerAtomEnergy + (fine.partition j.castSucc) + (coarse.partition j.succ) - + orderedLayerAtomEnergy + (coarse.partition j.castSucc) + (coarse.partition j.succ) + gap_le : + ∀ j : Fin r, + orderedLayerAtomEnergy + (fine.partition j.castSucc) + (coarse.partition j.succ) - + orderedLayerAtomEnergy + (coarse.partition j.castSucc) + (coarse.partition j.succ) ≤ + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ) + coarse_complexity : + ∀ (j : Fin r) (e : OrderedFace k j.1), + FacePartition.complexity + (coarse.partition j.castSucc e) ≤ + fixedUpperLayerComplexityFactor + j.1 (budget j) (index j) * + FacePartition.complexity + (initial.partition j.castSucc e) + fine_complexity : + ∀ (j : Fin r) (e : OrderedFace k j.1), + FacePartition.complexity + (fine.partition j.castSucc e) ≤ + fixedUpperLayerComplexityFactor + j.1 (budget j) (index j + 1) * + FacePartition.complexity + (initial.partition j.castSucc e) + +namespace CoarseTargetOrderedComplexRegularityCertificate + +def toCoarseFine + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : CoarseTargetOrderedComplexRegularityCertificate + G k r initial ε budget length) : + OrderedCoarseFineComplex G k r where + coarse := R.coarse + fine := R.fine + refines := R.refines + +theorem fine_refines_initial + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : CoarseTargetOrderedComplexRegularityCertificate + G k r initial ε budget length) : + R.fine.Refines initial := + OrderedPartitionComplex.Refines.trans + R.refines R.coarse_refines_initial + +end CoarseTargetOrderedComplexRegularityCertificate + +theorem CoarseTargetOrderedComplexRegularityCertificate.nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : (j : Fin r) → ℕ → ℝ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) + (hε : ∀ j n, 0 ≤ ε j n) + (hlong : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budget j n : ℝ) * (ε j n) ^ 2) + (hlength : ∀ j, 0 < length j) : + Nonempty + (CoarseTargetOrderedComplexRegularityCertificate + G k r initial ε budget length) := by + induction r with + | zero => + let index : Fin 0 → ℕ := fun j => Fin.elim0 j + refine ⟨{ + index := index + coarse := initial + fine := initial + refines := + OrderedPartitionComplex.Refines.refl initial + coarse_refines_initial := + OrderedPartitionComplex.Refines.refl initial + coarse_topLayer_eq := rfl + fine_topLayer_eq := rfl + index_lt := ?_ + mixedRegular := ?_ + gap_nonneg := ?_ + gap_le := ?_ + coarse_complexity := ?_ + fine_complexity := ?_ }⟩ + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + | succ r ih => + let lowerInitial : + OrderedFacePartitionSystem G k r := + initial.dropTop.topLayer + let upper : + OrderedFacePartitionSystem G k (r + 1) := + initial.topLayer + have hεtop : + ∀ n, 0 ≤ ε (Fin.last r) n := + fun n => hε (Fin.last r) n + have hlongTop : + ∀ n, + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) < + (budget (Fin.last r) n : ℝ) * + (ε (Fin.last r) n) ^ 2 := by + intro n + have h := hlong (Fin.last r) n + change + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) < + (budget (Fin.last r) n : ℝ) * + (ε (Fin.last r) n) ^ 2 at h + exact h + let topChoice := + chosenFixedUpperLayerCoarseFine + lowerInitial upper + (ε (Fin.last r)) + (budget (Fin.last r)) + hεtop hlongTop + (length (Fin.last r)) + (hlength (Fin.last r)) + let prepared : + OrderedPartitionComplex G k r := + initial.dropTop.withTopLayer topChoice.coarse + let εlower : (j : Fin r) → ℕ → ℝ := + fun j => ε j.castSucc + let budgetLower : (j : Fin r) → ℕ → ℕ := + fun j => budget j.castSucc + let lengthLower : Fin r → ℕ := + fun j => length j.castSucc + have hεlower : + ∀ j n, 0 ≤ εlower j n := + fun j n => hε j.castSucc n + have hlongLower : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budgetLower j n : ℝ) * + (εlower j n) ^ 2 := + fun j n => hlong j.castSucc n + have hlengthLower : + ∀ j, 0 < lengthLower j := + fun j => hlength j.castSucc + obtain ⟨lowerCertificate⟩ := + ih prepared εlower budgetLower lengthLower + hεlower hlongLower hlengthLower + let coarsePrefix : + OrderedPartitionComplex G k r := + lowerCertificate.coarse + let finePrefix : + OrderedPartitionComplex G k r := + lowerCertificate.fine.withTopLayer topChoice.fine + let coarse : + OrderedPartitionComplex G k (r + 1) := + coarsePrefix.appendTop upper + let fine : + OrderedPartitionComplex G k (r + 1) := + finePrefix.appendTop upper + let index : Fin (r + 1) → ℕ := + fun j => + Fin.lastCases topChoice.index + lowerCertificate.index j + have hlowerFineTop : + lowerCertificate.fine.topLayer = + topChoice.coarse := by + calc + lowerCertificate.fine.topLayer = + prepared.topLayer := + lowerCertificate.fine_topLayer_eq + _ = topChoice.coarse := + OrderedPartitionComplex.topLayer_withTopLayer + initial.dropTop topChoice.coarse + have hlowerCoarseTop : + lowerCertificate.coarse.topLayer = + topChoice.coarse := by + calc + lowerCertificate.coarse.topLayer = + prepared.topLayer := + lowerCertificate.coarse_topLayer_eq + _ = topChoice.coarse := + OrderedPartitionComplex.topLayer_withTopLayer + initial.dropTop topChoice.coarse + refine ⟨{ + index := index + coarse := coarse + fine := fine + refines := ?_ + coarse_refines_initial := ?_ + coarse_topLayer_eq := ?_ + fine_topLayer_eq := ?_ + index_lt := ?_ + mixedRegular := ?_ + gap_nonneg := ?_ + gap_le := ?_ + coarse_complexity := ?_ + fine_complexity := ?_ }⟩ + · have hprefix : + finePrefix.Refines coarsePrefix := by + intro q e + cases q using Fin.lastCases with + | last => + simp only [finePrefix, coarsePrefix, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last] + change OrderedFace k r at e + have heq : + lowerCertificate.coarse.partition + (Fin.last r) e = + topChoice.coarse e := + congrFun hlowerCoarseTop e + rw [heq] + exact topChoice.refines e + | cast i => + simp only [finePrefix, coarsePrefix, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc] + exact lowerCertificate.refines + i.castSucc e + exact OrderedPartitionComplex.appendTop_refines + hprefix + (OrderedFacePartitionRefines.refl upper) + · have hprepared : + prepared.Refines initial.dropTop := by + exact OrderedPartitionComplex.withTopLayer_refines + initial.dropTop topChoice.coarse + (by + simpa only [lowerInitial] using + topChoice.coarse_refines_initial) + have hprefix : + coarsePrefix.Refines initial.dropTop := + OrderedPartitionComplex.Refines.trans + lowerCertificate.coarse_refines_initial + hprepared + have happend := + OrderedPartitionComplex.appendTop_refines + hprefix + (OrderedFacePartitionRefines.refl upper) + simpa [coarse, coarsePrefix, upper] using happend + · simp [coarse, upper] + · simp [fine, upper] + · intro q + cases q using Fin.lastCases with + | last => + simpa [index] using topChoice.index_lt + | cast i => + simpa [index, lengthLower] using + lowerCertificate.index_lt i + · intro q + cases q using Fin.lastCases with + | last => + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, Fin.succ_last, + index, Fin.lastCases_last] + exact topChoice.fine_regular + | cast i => + have hregular := + lowerCertificate.mixedRegular i + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, Fin.succ_castSucc, + index, Fin.lastCases_castSucc] + change + @IsPreliminaryOrderedRegular + G _ _ k i.1 + (lowerCertificate.fine.partition + i.castSucc) + (lowerCertificate.coarse.partition + i.succ) + (ε i.castSucc + (lowerCertificate.index i)) + exact hregular + · intro q + cases q using Fin.lastCases with + | last => + have hgap := topChoice.gap_nonneg + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, Fin.succ_last] + change + 0 ≤ + orderedLayerAtomEnergy + topChoice.fine upper - + orderedLayerAtomEnergy + lowerCertificate.coarse.topLayer + upper + rw [hlowerCoarseTop] + exact hgap + | cast i => + have hgap := + lowerCertificate.gap_nonneg i + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, Fin.succ_castSucc] + convert hgap using 1 + · intro q + cases q using Fin.lastCases with + | last => + have hgap := topChoice.gap_le + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, Fin.succ_last] + change + orderedLayerAtomEnergy + topChoice.fine upper - + orderedLayerAtomEnergy + lowerCertificate.coarse.topLayer + upper ≤ + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) / + (length (Fin.last r) : ℝ) + rw [hlowerCoarseTop] + exact hgap + | cast i => + have hgap := + lowerCertificate.gap_le i + simp only [fine, finePrefix, coarse, + coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, Fin.succ_castSucc, + lengthLower] + convert hgap using 1; rfl + · intro q + cases q using Fin.lastCases with + | last => + intro e + change OrderedFace k r at e + have hcomplexity := + topChoice.coarse_complexity e + simp only [coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + index, Fin.lastCases_last] + change + FacePartition.complexity + (lowerCertificate.coarse.partition + (Fin.last r) e) ≤ + fixedUpperLayerComplexityFactor + r (budget (Fin.last r)) + topChoice.index * + FacePartition.complexity + (initial.partition + (Fin.last r).castSucc e) + have heq : + lowerCertificate.coarse.partition + (Fin.last r) e = + topChoice.coarse e := + congrFun hlowerCoarseTop e + rw [heq] + exact hcomplexity + | cast i => + intro e + change OrderedFace k i.1 at e + have hcomplexity := + lowerCertificate.coarse_complexity i e + simp only [coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + index, Fin.lastCases_castSucc] + change + FacePartition.complexity + (lowerCertificate.coarse.partition + i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (budget i.castSucc) + (lowerCertificate.index i) * + FacePartition.complexity + (initial.partition + i.castSucc.castSucc e) + simp only [budgetLower, prepared, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + OrderedPartitionComplex.dropTop] at hcomplexity + convert hcomplexity using 1 + · intro q + cases q using Fin.lastCases with + | last => + intro e + change OrderedFace k r at e + have hcomplexity := + topChoice.fine_complexity e + simp only [fine, finePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, + index, Fin.lastCases_last] + exact hcomplexity + | cast i => + intro e + change OrderedFace k i.1 at e + have hcomplexity := + lowerCertificate.fine_complexity i e + simp only [fine, finePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + index, Fin.lastCases_castSucc] + change + FacePartition.complexity + (lowerCertificate.fine.partition + i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (budget i.castSucc) + (lowerCertificate.index i + 1) * + FacePartition.complexity + (initial.partition + i.castSucc.castSucc e) + simp only [budgetLower, prepared, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + OrderedPartitionComplex.dropTop] at hcomplexity + convert hcomplexity using 1 + +namespace OrderedCoarseFineComplex + +noncomputable def totalCoarseUpperAtomEnergyGap + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : ℝ := + ∑ j : Fin r, P.coarseUpperLayerAtomEnergyGap j + +theorem totalCoarseUpperAtomEnergyGap_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : + 0 ≤ P.totalCoarseUpperAtomEnergyGap := by + unfold totalCoarseUpperAtomEnergyGap + exact Finset.sum_nonneg fun j _ => + sub_nonneg.mpr + (orderedLayerAtomEnergy_mono + (fun e => P.refines j.castSucc e) + (P.coarse.partition j.succ)) + +end OrderedCoarseFineComplex + +namespace CoarseTargetOrderedComplexRegularityCertificate + +theorem totalCoarseUpperAtomEnergyGap_le_sum_div + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : CoarseTargetOrderedComplexRegularityCertificate + G k r initial ε budget length) : + R.toCoarseFine.totalCoarseUpperAtomEnergyGap ≤ + ∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ) := by + unfold OrderedCoarseFineComplex.totalCoarseUpperAtomEnergyGap + OrderedCoarseFineComplex.coarseUpperLayerAtomEnergyGap + toCoarseFine + exact Finset.sum_le_sum fun j _ => R.gap_le j + +theorem totalCoarseUpperAtomEnergyGap_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : CoarseTargetOrderedComplexRegularityCertificate + G k r initial ε budget length) : + 0 ≤ R.toCoarseFine.totalCoarseUpperAtomEnergyGap := + R.toCoarseFine.totalCoarseUpperAtomEnergyGap_nonneg + +end CoarseTargetOrderedComplexRegularityCertificate + +theorem exists_coarseTargetOrderedComplexRegularity + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : (j : Fin r) → ℕ → ℝ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) + (hε : ∀ j n, 0 ≤ ε j n) + (hlong : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budget j n : ℝ) * (ε j n) ^ 2) + (hlength : ∀ j, 0 < length j) : + ∃ R : CoarseTargetOrderedComplexRegularityCertificate + G k r initial ε budget length, + R.toCoarseFine.totalCoarseUpperAtomEnergyGap ≤ + ∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ) := by + obtain ⟨R⟩ := + CoarseTargetOrderedComplexRegularityCertificate.nonempty + initial ε budget length hε hlong hlength + exact + ⟨R, + R.totalCoarseUpperAtomEnergyGap_le_sum_div⟩ + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/Conclusions.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/Conclusions.lean new file mode 100644 index 0000000000000000000000000000000000000000..10263d1ddf8933a0020f9e94cc0a7b938210a3f0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/Conclusions.lean @@ -0,0 +1,1304 @@ +import OAI.Combinatorics.Progressions.FixedDensity.HypergraphBundleSourceGoodnessBridge +import OAI.Combinatorics.Progressions.FixedDensity.SourceFullBundleRemovalParameters + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + +noncomputable def frozenProjectedEdgeOrderIso + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) ≃ + {j : Fin k // j ∈ g.image B.projection} := by + let t := g.image B.projection + let e := B.orderedConfigurationBundleFace hg hne + have hcard : t.card = e.lowerRank.1 + 1 := by + have hedge : + positiveOrderedFaceEdge e = t := by + dsimp [e, orderedConfigurationBundleFace, t] + exact positiveOrderedFaceEdge_ofEdge + (g.image B.projection) + (B.projectedEdge_nonempty hg hne) + (B.projectedEdge_card_le hg) + calc + t.card = (positiveOrderedFaceEdge e).card := + congrArg Finset.card hedge.symm + _ = e.rank := positiveOrderedFaceEdge_card e + _ = e.lowerRank.1 + 1 := rfl + exact (t.orderIsoOfFin hcard).toEquiv + +noncomputable def frozenOccurrenceOrderEquiv + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) ≃ + {v : K // v ∈ g} := + (B.frozenProjectedEdgeOrderIso hg hne).trans + (B.projectionEquiv hg).symm + +noncomputable def frozenBundleFaceTupleEquiv + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + ({v : K // v ∈ g} → G) ≃ + (Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) → + G) := + (Equiv.arrowCongr + (B.projectionEquiv hg) + (Equiv.refl G)).trans + (Equiv.arrowCongr + (B.frozenProjectedEdgeOrderIso hg hne).symm + (Equiv.refl G)) + +omit [Fintype G] [DecidableEq G] in +@[simp] +theorem frozenBundleFaceTupleEquiv_apply + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (y : {v : K // v ∈ g} → G) : + B.frozenBundleFaceTupleEquiv hg hne y = + B.orderedConfigurationBundleFaceTuple hg hne y := by + funext i + unfold frozenBundleFaceTupleEquiv frozenProjectedEdgeOrderIso + orderedConfigurationBundleFaceTuple + orderedConfigurationEdgeTuple + rfl + +omit [Fintype G] [DecidableEq G] in +@[simp] +theorem frozenBundleFaceTupleEquiv_symm_apply + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (x : + Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) → + G) + (v : {v : K // v ∈ g}) : + (B.frozenBundleFaceTupleEquiv hg hne).symm x v = + x ((B.frozenOccurrenceOrderEquiv hg hne).symm v) := by + rfl + +noncomputable def frozenBundleMissingVertex + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ : Finset K} + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (hne : g₀.Nonempty) + (g : Finset K) : {v : K // v ∈ g₀} := + if hg : g ∈ B.edges.erase g₀ then + ⟨Classical.choose + (B.exists_selectedVertex_not_mem_of_mem_erase hg hmax), + (Classical.choose_spec + (B.exists_selectedVertex_not_mem_of_mem_erase hg hmax)).1⟩ + else + ⟨Classical.choose hne, Classical.choose_spec hne⟩ + +theorem frozenBundleMissingVertex_not_mem + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ g : Finset K} + (hmax : ∀ f ∈ B.edges, f.card ≤ g₀.card) + (hne : g₀.Nonempty) + (hg : g ∈ B.edges.erase g₀) : + (B.frozenBundleMissingVertex hmax hne g).1 ∉ g := by + classical + simp only [frozenBundleMissingVertex, dite_eq_left hg] + exact + (Classical.choose_spec + (B.exists_selectedVertex_not_mem_of_mem_erase hg hmax)).2 + +noncomputable def frozenBundleMissingCoordinate + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (hne : g₀.Nonempty) + (g : Finset K) : + Fin ((B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 + 1) := + (B.frozenOccurrenceOrderEquiv hg₀ hne).symm + (B.frozenBundleMissingVertex hmax hne g) + +theorem frozenOccurrenceOrder_missingCoordinate_not_mem + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ g : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ f ∈ B.edges, f.card ≤ g₀.card) + (hne : g₀.Nonempty) + (hg : g ∈ B.edges.erase g₀) : + (B.frozenOccurrenceOrderEquiv hg₀ hne + (B.frozenBundleMissingCoordinate hg₀ hmax hne g)).1 ∉ g := by + unfold frozenBundleMissingCoordinate + rw [(B.frozenOccurrenceOrderEquiv hg₀ hne).apply_symm_apply] + exact B.frozenBundleMissingVertex_not_mem hmax hne hg + +noncomputable def frozenBundleInsertedSelectedTuple + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hne : g₀.Nonempty) + (i : + Fin ((B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 + 1)) + (a : G) + (y : + Fin (B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 → G) : + {v : K // v ∈ g₀} → G := + (B.frozenBundleFaceTupleEquiv hg₀ hne).symm + (Fin.insertNth i a y) + +noncomputable def frozenBundleInsertedAssignment + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hne : g₀.Nonempty) + (i : + Fin ((B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 + 1)) + (a : G) + (y : + Fin (B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 → G) + (z : EdgeComplement g₀ → G) : K → G := + (splitEdgeEquiv g₀).symm + (B.frozenBundleInsertedSelectedTuple hg₀ hne i a y, z) + +omit [Fintype G] [DecidableEq G] in +theorem splitEdgeEquiv_symm_apply_of_mem + {K : Type*} [DecidableEq K] + (g₀ : Finset K) + (y : {v : K // v ∈ g₀} → G) + (z : EdgeComplement g₀ → G) + {v : K} (hv : v ∈ g₀) : + (splitEdgeEquiv g₀).symm (y, z) v = y ⟨v, hv⟩ := by + have h := + congrFun (edgeTuple_splitEdgeEquiv_symm g₀ y z) ⟨v, hv⟩ + exact h + +omit [Fintype G] [DecidableEq G] in +theorem splitEdgeEquiv_symm_apply_of_not_mem + {K : Type*} [DecidableEq K] + (g₀ : Finset K) + (y : {v : K // v ∈ g₀} → G) + (z : EdgeComplement g₀ → G) + {v : K} (hv : v ∉ g₀) : + (splitEdgeEquiv g₀).symm (y, z) v = z ⟨v, hv⟩ := by + unfold splitEdgeEquiv + convert + Equiv.piCongrLeft_sumInr + (fun _ : K => G) (edgeSumEquiv g₀) + y z ⟨v, hv⟩ using 1 ; + simp [edgeSumEquiv] + +omit [Fintype G] [DecidableEq G] in + +theorem edgeTuple_frozenBundleInsertedAssignment + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ g : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ f ∈ B.edges, f.card ≤ g₀.card) + (hne : g₀.Nonempty) + (hg : g ∈ B.edges.erase g₀) + (a : G) + (x : + Fin ((B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 + 1) → + G) + (z : EdgeComplement g₀ → G) : + edgeTuple g + (B.frozenBundleInsertedAssignment hg₀ hne + (B.frozenBundleMissingCoordinate hg₀ hmax hne g) + a + (Fin.removeNth + (B.frozenBundleMissingCoordinate hg₀ hmax hne g) x) + z) = + edgeTuple g + ((splitEdgeEquiv g₀).symm + ((B.frozenBundleFaceTupleEquiv hg₀ hne).symm x, z)) := by + classical + funext w + unfold edgeTuple + let i := + B.frozenBundleMissingCoordinate hg₀ hmax hne g + by_cases hw₀ : w.1 ∈ g₀ + · unfold frozenBundleInsertedAssignment + rw [splitEdgeEquiv_symm_apply_of_mem g₀ _ _ hw₀] + rw [splitEdgeEquiv_symm_apply_of_mem g₀ _ _ hw₀] + unfold frozenBundleInsertedSelectedTuple + rw [B.frozenBundleFaceTupleEquiv_symm_apply] + rw [B.frozenBundleFaceTupleEquiv_symm_apply] + let q := + (B.frozenOccurrenceOrderEquiv hg₀ hne).symm + (⟨w.1, hw₀⟩ : {v : K // v ∈ g₀}) + have hqi : q ≠ i := by + intro h + have hsub : + (⟨w.1, hw₀⟩ : {v : K // v ∈ g₀}) = + B.frozenBundleMissingVertex hmax hne g := by + apply (B.frozenOccurrenceOrderEquiv hg₀ hne).symm.injective + simpa only [q, i, frozenBundleMissingCoordinate] using h + apply B.frozenBundleMissingVertex_not_mem hmax hne hg + have hwval : + w.1 = + (B.frozenBundleMissingVertex hmax hne g).1 := + congrArg Subtype.val hsub + rw [← hwval] + exact w.2 + change + Fin.insertNth i a (Fin.removeNth i x) q = x q + rw [Fin.insertNth_removeNth] + simp [hqi] + · unfold frozenBundleInsertedAssignment + rw [splitEdgeEquiv_symm_apply_of_not_mem g₀ _ _ hw₀] + rw [splitEdgeEquiv_symm_apply_of_not_mem g₀ _ _ hw₀] + +noncomputable def frozenBundleRemainderCutTest + {K : Type*} [Fintype K] [DecidableEq K] + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (hne : g₀.Nonempty) + (a : G) + (z : EdgeComplement g₀ → G) : + CutTestFamily G + ((B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 + 1) := + fun i y => + ∏ g ∈ B.edges.erase g₀, + if _hcoord : + B.frozenBundleMissingCoordinate hg₀ hmax hne g = i + then + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) g + (edgeTuple g + (B.frozenBundleInsertedAssignment hg₀ hne i a y z)) + else 1 + +theorem frozenBundleRemainderCutTest_bounded + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (hne : g₀.Nonempty) + (a : G) + (z : EdgeComplement g₀ → G) : + IsBoundedCutTest + (B.frozenBundleRemainderCutTest A hg₀ hmax hne a z) := by + constructor + · intro i y + unfold frozenBundleRemainderCutTest + apply Finset.prod_nonneg + intro g hg + split_ifs + · exact + (B.pullbackBaseEdgeWeight_unitInterval + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseWeight_unitInterval A) + (Finset.mem_of_mem_erase hg) _).1 + · positivity + · intro i y + unfold frozenBundleRemainderCutTest + apply Finset.prod_le_one₀ + · intro g hg + split_ifs + · exact + (B.pullbackBaseEdgeWeight_unitInterval + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseWeight_unitInterval A) + (Finset.mem_of_mem_erase hg) _).1 + · positivity + · intro g hg + split_ifs + · exact + (B.pullbackBaseEdgeWeight_unitInterval + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseWeight_unitInterval A) + (Finset.mem_of_mem_erase hg) _).2 + · exact le_rfl + +theorem cutTestProduct_frozenBundleRemainderCutTest + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (hne : g₀.Nonempty) + (a : G) + (z : EdgeComplement g₀ → G) + (x : + Fin ((B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 + 1) → + G) : + cutTestProduct + (B.frozenBundleRemainderCutTest A hg₀ hmax hne a z) x = + B.edgeRemainderFiber g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) + ((B.frozenBundleFaceTupleEquiv hg₀ hne).symm x) z := by + classical + unfold cutTestProduct frozenBundleRemainderCutTest + rw [Finset.prod_comm] + unfold edgeRemainderFiber edgeRemainder bundleProduct + apply Finset.prod_congr rfl + intro g hg + let i := + B.frozenBundleMissingCoordinate hg₀ hmax hne g + calc + (∏ q : + Fin ((B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 + 1), + if hcoord : + B.frozenBundleMissingCoordinate hg₀ hmax hne g = q + then + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) g + (edgeTuple g + (B.frozenBundleInsertedAssignment hg₀ hne q a + (Fin.removeNth q x) z)) + else 1) = + (if hcoord : + B.frozenBundleMissingCoordinate hg₀ hmax hne g = i + then + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) g + (edgeTuple g + (B.frozenBundleInsertedAssignment hg₀ hne i a + (Fin.removeNth i x) z)) + else 1) := by + apply Fintype.prod_eq_single i + intro q hqi + have hnecoord : + B.frozenBundleMissingCoordinate hg₀ hmax hne g ≠ q := by + intro h + exact hqi h.symm + simp [hnecoord] + _ = + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) g + (edgeTuple g + (B.frozenBundleInsertedAssignment hg₀ hne i a + (Fin.removeNth i x) z)) := by + simp [i] + _ = + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) g + (edgeTuple g + ((splitEdgeEquiv g₀).symm + ((B.frozenBundleFaceTupleEquiv hg₀ hne).symm x, z))) := by + rw [B.edgeTuple_frozenBundleInsertedAssignment + hg₀ hmax hne hg a x z] + +theorem hasOrderedConfigurationBundleFrozenCutRepresentation + [Nonempty G] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) : + HasOrderedConfigurationBundleFrozenCutRepresentation P A := by + intro K _instK _decK B _hclosed g₀ hg₀ hmax hne z + let a : G := Classical.choice inferInstance + let u := + B.frozenBundleRemainderCutTest A hg₀ hmax hne a z + refine ⟨u, ?_, ?_⟩ + · exact + B.frozenBundleRemainderCutTest_bounded + P A hg₀ hmax hne a z + · unfold frozenEdgeCorrelation + unfold FaceRegularityState.faceCutCorrelation + apply mean_equiv + (B.frozenBundleFaceTupleEquiv hg₀ hne) + intro y + rw [B.cutTestProduct_frozenBundleRemainderCutTest + P A hg₀ hmax hne a z] + simp only [Equiv.symm_apply_apply] + rw [B.frozenBundleFaceTupleEquiv_apply] + rfl + +end HypergraphBundle + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem orderedConfigurationBaseDensity_ge_of_sourceFullMixedGood + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + {a t : ℝ} (ha_one : a ≤ 1) + (hgood : + A.IsSourceFullMixedGood P (fun _ => a) (fun _ => t ^ 2)) : + ∀ e ∈ orderedConfigurationBaseEdges k r, + a ≤ orderedConfigurationBaseDensity P A e := by + intro e he + by_cases he0 : e = ∅ + · subst e + simpa using ha_one + · have hene : e.Nonempty := + Finset.nonempty_iff_ne_empty.mpr he0 + have her : e.card ≤ r := + (mem_orderedConfigurationBaseEdges_iff e).1 he + have hdensity := + (hgood (positiveOrderedFaceOfEdge e hene her)).1 + simpa [sourceFullMixedCoarseDensity, + orderedConfigurationBaseDensity, hene, her] using hdensity + +theorem hasTaoBundleCountingStep_orderedConfiguration_of_sourceFull + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + {a t : ℝ} + (hgood : + A.IsSourceFullMixedGood P (fun _ => a) (fun _ => t ^ 2)) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => t ^ 2)) : + HasTaoBundleCountingStep + (H := orderedConfigurationBaseEdges k r) + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseDensity P A) + (fun _ => t ^ 2) (t ^ 2) := by + apply HypergraphBundle.hasTaoBundleCountingStep_orderedConfiguration + P A (fun _ => t ^ 2) (t ^ 2) + · intro d + exact sq_nonneg t + · exact sq_nonneg t + · exact + HypergraphBundle.hasOrderedConfigurationBundleLocalizedDefect_of_sourceFullMixedGood + P A (fun _ => a) (fun _ => t ^ 2) hgood + · exact + HypergraphBundle.hasOrderedConfigurationBundleFrozenUniformity_of_fullyMixed + P A (t ^ 2) hregular + (HypergraphBundle.hasOrderedConfigurationBundleFrozenCutRepresentation + P A) + +theorem abs_bundleCount_orderedConfiguration_sub_main_le_sourceFullEnvelope + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + {a t : ℝ} (ha : 0 < a) (ha_one : a ≤ 1) + (hgood : + A.IsSourceFullMixedGood P (fun _ => a) (fun _ => t ^ 2)) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => t ^ 2)) + {K : Type} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + (hclosed : B.IsClosedUnderInclusion) : + |B.bundleCount + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) - + B.bundleMainProduct + (orderedConfigurationBaseDensity P A)| ≤ + bundleCommonEnvelopeError a t B.order B.edges.card * + B.bundleMainProduct + (orderedConfigurationBaseDensity P A) := by + have hstep : + HasTaoBundleCountingStep + (H := orderedConfigurationBaseEdges k r) + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseDensity P A) + (fun _ => t ^ 2) (t ^ 2) := + hasTaoBundleCountingStep_orderedConfiguration_of_sourceFull + P A hgood hregular + have henvelope : + IsBundleCountingEnvelope + (fun _ => a) (fun _ => t ^ 2) (fun _ => a) (t ^ 2) + (bundleCommonEnvelopeError a t) := + bundleCommonEnvelopeError_isEnvelope ha ha_one + exact + @abs_bundleCount_pullback_sub_bundleMainProduct_le_envelope + (Fin k) G inferInstance inferInstance + (orderedConfigurationBaseEdges k r) inferInstance + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseDensity P A) + (fun _ => a) (fun _ => t ^ 2) (fun _ => a) (t ^ 2) + (bundleCommonEnvelopeError a t) + (orderedConfigurationBaseWeight_unitInterval A) + (orderedConfigurationBaseWeight_idempotent A) + (orderedConfigurationBaseWeight_empty A) + (orderedConfigurationBaseDensity_empty P A) + (orderedConfigurationBaseDensity_ge_of_sourceFullMixedGood + P A ha_one hgood) + hstep henvelope K inferInstance inferInstance B hclosed + +theorem one_sub_sourceFullEnvelope_mul_densityProduct_le_fullConfigurationCount + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + {a t : ℝ} (ha : 0 < a) (ha_one : a ≤ 1) + (hgood : + A.IsSourceFullMixedGood P (fun _ => a) (fun _ => t ^ 2)) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => t ^ 2)) : + (1 - bundleCommonEnvelopeError a t + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card) * + (∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e) ≤ + fullConfigurationCount A := by + have hcount := + abs_bundleCount_orderedConfiguration_sub_main_le_sourceFullEnvelope + P A ha ha_one hgood hregular + (orderedConfigurationInitialBundle k r) + (orderedConfigurationInitialBundle_closed k r) + rw [orderedConfigurationInitialBundle_bundleCount A, + orderedConfigurationInitialBundle_bundleMainProduct P A] at hcount + have hlower : + - (bundleCommonEnvelopeError a t + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card * + (∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e)) ≤ + fullConfigurationCount A - + (∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e) := + neg_le_of_abs_le hcount + linarith + +theorem fullConfigurationCount_pos_of_sourceFullEnvelope_lt_half + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + {a t : ℝ} (ha : 0 < a) (ha_one : a ≤ 1) + (hgood : + A.IsSourceFullMixedGood P (fun _ => a) (fun _ => t ^ 2)) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => t ^ 2)) + (herror : + bundleCommonEnvelopeError a t + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card < 1 / 2) : + 0 < fullConfigurationCount A := by + have hlower := + one_sub_sourceFullEnvelope_mul_densityProduct_le_fullConfigurationCount + P A ha ha_one hgood hregular + have hdensity : + 0 < ∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e := by + apply Finset.prod_pos + intro e _he + exact ha.trans_le (by + simpa [sourceFullMixedCoarseDensity] using (hgood e).1) + have hone : + 0 < 1 - bundleCommonEnvelopeError a t + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card := by + linarith + exact (mul_pos hone hdensity).trans_le hlower + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem orderedConfigurationInitialBundle_order_le + (k r : ℕ) : + (orderedConfigurationInitialBundle k r).order ≤ r := by + unfold HypergraphBundle.order + rw [orderedConfigurationInitialBundle_edges] + apply Finset.sup_le + intro e he + exact (mem_orderedConfigurationBaseEdges_iff e).1 he + +theorem SourceFullCoarseTargetSchedule.Certificate.isFullyMixedPreliminaryOrderedRegular_common + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (R : SourceFullCoarseTargetSchedule.Certificate + k r initial initialBound F scaleFloor) : + IsFullyMixedPreliminaryOrderedRegular + R.regularity.toCoarseFine + (fun _ => sourceFullCommonTolerance F R.scale) := by + intro j e a b + exact + (R.regularity.mixedRegular j e a b).trans + (R.selected_tolerance_le_common j) + +theorem orderedConfigurationBaseDensity_ge_of_sourceFullMixedGood_rankwise + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hαzero : α 0 ≤ 1) + (hgood : A.IsSourceFullMixedGood P α β) : + ∀ e ∈ orderedConfigurationBaseEdges k r, + α e.card ≤ orderedConfigurationBaseDensity P A e := by + intro e he + by_cases he0 : e = ∅ + · subst e + simpa using hαzero + · have hene : e.Nonempty := + Finset.nonempty_iff_ne_empty.mpr he0 + have her : e.card ≤ r := + (mem_orderedConfigurationBaseEdges_iff e).1 he + have hdensity := + (hgood (positiveOrderedFaceOfEdge e hene her)).1 + have hrank : + (positiveOrderedFaceOfEdge e hene her).rank = e.card := by + rw [← positiveOrderedFaceEdge_card, + positiveOrderedFaceEdge_ofEdge] + rw [hrank] at hdensity + simpa [sourceFullMixedCoarseDensity, + orderedConfigurationBaseDensity, hene, her] using hdensity + +theorem hasTaoBundleCountingStep_orderedConfiguration_of_sourceFull_rankwise + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) (τ : ℝ) + (hβ : ∀ d, 0 ≤ β d) + (hτ : 0 ≤ τ) + (hgood : A.IsSourceFullMixedGood P α β) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => τ)) : + HasTaoBundleCountingStep + (H := orderedConfigurationBaseEdges k r) + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseDensity P A) + β τ := by + apply HypergraphBundle.hasTaoBundleCountingStep_orderedConfiguration + P A β τ hβ hτ + · exact + HypergraphBundle.hasOrderedConfigurationBundleLocalizedDefect_of_sourceFullMixedGood + P A α β hgood + · exact + HypergraphBundle.hasOrderedConfigurationBundleFrozenUniformity_of_fullyMixed + P A τ hregular + (HypergraphBundle.hasOrderedConfigurationBundleFrozenCutRepresentation + P A) + +theorem abs_bundleCount_orderedConfiguration_sub_main_le_rankwiseEnvelope + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β μ : ℕ → ℝ) (τ : ℝ) + (E : ℕ → ℕ → ℝ) + (hαzero : α 0 ≤ 1) + (hβ : ∀ d, 0 ≤ β d) + (hτ : 0 ≤ τ) + (hgood : A.IsSourceFullMixedGood P α β) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => τ)) + (henvelope : IsBundleCountingEnvelope α β μ τ E) + {K : Type} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + (hclosed : B.IsClosedUnderInclusion) : + |B.bundleCount + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) - + B.bundleMainProduct + (orderedConfigurationBaseDensity P A)| ≤ + E B.order B.edges.card * + B.bundleMainProduct + (orderedConfigurationBaseDensity P A) := by + exact + @abs_bundleCount_pullback_sub_bundleMainProduct_le_envelope + (Fin k) G inferInstance inferInstance + (orderedConfigurationBaseEdges k r) inferInstance + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseDensity P A) + α β μ τ E + (orderedConfigurationBaseWeight_unitInterval A) + (orderedConfigurationBaseWeight_idempotent A) + (orderedConfigurationBaseWeight_empty A) + (orderedConfigurationBaseDensity_empty P A) + (orderedConfigurationBaseDensity_ge_of_sourceFullMixedGood_rankwise + P A α β hαzero hgood) + (hasTaoBundleCountingStep_orderedConfiguration_of_sourceFull_rankwise + P A α β τ hβ hτ hgood hregular) + henvelope K inferInstance inferInstance B hclosed + +theorem one_sub_rankwiseEnvelope_mul_densityProduct_le_fullConfigurationCount + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β μ : ℕ → ℝ) (τ : ℝ) + (E : ℕ → ℕ → ℝ) + (hαzero : α 0 ≤ 1) + (hβ : ∀ d, 0 ≤ β d) + (hτ : 0 ≤ τ) + (hgood : A.IsSourceFullMixedGood P α β) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => τ)) + (henvelope : IsBundleCountingEnvelope α β μ τ E) : + (1 - E + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card) * + (∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e) ≤ + fullConfigurationCount A := by + have hcount := + abs_bundleCount_orderedConfiguration_sub_main_le_rankwiseEnvelope + P A α β μ τ E hαzero hβ hτ hgood hregular henvelope + (orderedConfigurationInitialBundle k r) + (orderedConfigurationInitialBundle_closed k r) + rw [orderedConfigurationInitialBundle_bundleCount A, + orderedConfigurationInitialBundle_bundleMainProduct P A] at hcount + have hlower : + - (E + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card * + (∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e)) ≤ + fullConfigurationCount A - + (∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e) := + neg_le_of_abs_le hcount + linarith + +theorem half_rankwiseDensityProduct_le_fullConfigurationCount + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β μ : ℕ → ℝ) (τ : ℝ) + (E : ℕ → ℕ → ℝ) + (hα : ∀ d, 0 < α d) + (hαone : ∀ d, α d ≤ 1) + (hβ : ∀ d, 0 ≤ β d) + (hτ : 0 ≤ τ) + (hgood : A.IsSourceFullMixedGood P α β) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => τ)) + (henvelope : IsBundleCountingEnvelope α β μ τ E) + (herror : + E + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card < + 1 / 2) : + (1 / 2 : ℝ) * + (∏ e : PositiveOrderedFace k r, α e.rank) ≤ + fullConfigurationCount A := by + have hlower := + one_sub_rankwiseEnvelope_mul_densityProduct_le_fullConfigurationCount + P A α β μ τ E (hαone 0) hβ hτ hgood hregular henvelope + have hfloorProduct_nonneg : + 0 ≤ ∏ e : PositiveOrderedFace k r, α e.rank := by + exact Finset.prod_nonneg fun e _ => (hα e.rank).le + have hdensityProduct : + (∏ e : PositiveOrderedFace k r, α e.rank) ≤ + ∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e := by + apply Finset.prod_le_prod₀ + · intro e _he + exact (hα e.rank).le + · intro e _he + simpa [sourceFullMixedCoarseDensity] using (hgood e).1 + have hone : + (1 / 2 : ℝ) ≤ + 1 - E + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card := by + linarith + have hone_nonneg : + 0 ≤ + 1 - E + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card := by + linarith + calc + (1 / 2 : ℝ) * + (∏ e : PositiveOrderedFace k r, α e.rank) ≤ + (1 - E + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card) * + (∏ e : PositiveOrderedFace k r, α e.rank) := + mul_le_mul_of_nonneg_right hone hfloorProduct_nonneg + _ ≤ + (1 - E + (orderedConfigurationInitialBundle k r).order + (orderedConfigurationInitialBundle k r).edges.card) * + (∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e) := by + exact mul_le_mul_of_nonneg_left hdensityProduct hone_nonneg + _ ≤ fullConfigurationCount A := + hlower + +theorem half_rankwiseDensityProduct_le_fullConfigurationCount_of_rankBound + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β μ : ℕ → ℝ) (τ : ℝ) + (E : ℕ → ℕ → ℝ) + (hα : ∀ d, 0 < α d) + (hαone : ∀ d, α d ≤ 1) + (hβ : ∀ d, 0 ≤ β d) + (hτ : 0 ≤ τ) + (hgood : A.IsSourceFullMixedGood P α β) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => τ)) + (henvelope : IsBundleCountingEnvelope α β μ τ E) + (herror : + E r (orderedConfigurationInitialBundle k r).edges.card < + 1 / 2) : + (1 / 2 : ℝ) * + (∏ e : PositiveOrderedFace k r, α e.rank) ≤ + fullConfigurationCount A := by + apply + half_rankwiseDensityProduct_le_fullConfigurationCount + P A α β μ τ E hα hαone hβ hτ hgood hregular henvelope + exact + (henvelope.error_mono_order + (orderedConfigurationInitialBundle_order_le k r)).trans_lt + herror + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def sourceBundleRemovalHorizon (k r : ℕ) : ℕ := + bundleReverseDoublingHorizon r + (orderedConfigurationInitialBundle k r).edges.card 0 + +noncomputable def sourceBundleRemovalDensityBudget + (ε : ℝ) (r : ℕ) : ℝ := + min ε 1 / + (4 * (Fintype.card (OrderedPositiveSubface r) + 1 : ℕ) : ℕ) + +noncomputable def sourceBundleRemovalStep (k r : ℕ) : ℝ := + 1 / + (4 * (r * sourceBundleRemovalHorizon k r + 1 : ℕ) : ℕ) + +noncomputable def sourceBundleRemovalKappa (k r : ℕ) : ℝ := + sourceBundleRemovalStep k r / 8 + +theorem sourceBundleRemovalDensityBudget_pos + {ε : ℝ} (hε : 0 < ε) (r : ℕ) : + 0 < sourceBundleRemovalDensityBudget ε r := by + unfold sourceBundleRemovalDensityBudget + positivity + +theorem sourceBundleRemovalDensityBudget_le_one + {ε : ℝ} (hε : 0 < ε) (r : ℕ) : + sourceBundleRemovalDensityBudget ε r ≤ 1 := by + unfold sourceBundleRemovalDensityBudget + have hmin : min ε 1 ≤ 1 := min_le_right _ _ + have hden : (1 : ℝ) ≤ + (4 * (Fintype.card (OrderedPositiveSubface r) + 1 : ℕ) : ℕ) := by + push_cast + have hcard : + (0 : ℝ) ≤ Fintype.card (OrderedPositiveSubface r) := by + positivity + nlinarith + exact (div_le_self (le_of_lt (lt_min hε zero_lt_one)) hden).trans hmin + +theorem card_mul_two_sourceBundleRemovalDensityBudget_le + {ε : ℝ} (hε : 0 < ε) (r : ℕ) : + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + (sourceBundleRemovalDensityBudget ε r + + sourceBundleRemovalDensityBudget ε r) ≤ ε := by + let s := Fintype.card (OrderedPositiveSubface r) + let x : ℝ := min ε 1 + have hx : 0 < x := lt_min hε zero_lt_one + have hden : (0 : ℝ) < (4 * (s + 1 : ℕ) : ℕ) := by + positivity + have hs : (0 : ℝ) ≤ s := by positivity + calc + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + (sourceBundleRemovalDensityBudget ε r + + sourceBundleRemovalDensityBudget ε r) = + ((2 * (s : ℝ)) * x) / (4 * (s + 1 : ℕ) : ℕ) := by + simp only [sourceBundleRemovalDensityBudget, s, x] + ring + _ ≤ x := by + apply (div_le_iff₀ hden).2 + push_cast + nlinarith + _ ≤ ε := min_le_left _ _ + +theorem sourceBundleRemovalStep_pos (k r : ℕ) : + 0 < sourceBundleRemovalStep k r := by + unfold sourceBundleRemovalStep + positivity + +theorem sourceBundleRemovalStep_le_one (k r : ℕ) : + sourceBundleRemovalStep k r ≤ 1 := by + unfold sourceBundleRemovalStep + apply (div_le_one (by positivity)).2 + push_cast + have hr : (0 : ℝ) ≤ r := by positivity + have hH : (0 : ℝ) ≤ sourceBundleRemovalHorizon k r := by + positivity + nlinarith [mul_nonneg hr hH] + +theorem sourceBundleRemovalKappa_pos (k r : ℕ) : + 0 < sourceBundleRemovalKappa k r := by + unfold sourceBundleRemovalKappa + exact div_pos (sourceBundleRemovalStep_pos k r) (by norm_num) + +theorem sourceBundleRemovalKappa_le_one (k r : ℕ) : + sourceBundleRemovalKappa k r ≤ 1 := by + unfold sourceBundleRemovalKappa + have hstep := sourceBundleRemovalStep_le_one k r + nlinarith [sourceBundleRemovalStep_pos k r] + +theorem four_mul_sourceBundleRemovalKappa_le_step (k r : ℕ) : + 4 * sourceBundleRemovalKappa k r ≤ + sourceBundleRemovalStep k r := by + unfold sourceBundleRemovalKappa + nlinarith [sourceBundleRemovalStep_pos k r] + +theorem sourceBundleRemovalKappa_sq_le_half_step (k r : ℕ) : + sourceBundleRemovalKappa k r ^ 2 ≤ + sourceBundleRemovalStep k r / 2 := by + unfold sourceBundleRemovalKappa + have hpos := sourceBundleRemovalStep_pos k r + have hone := sourceBundleRemovalStep_le_one k r + nlinarith [sq_nonneg (sourceBundleRemovalStep k r)] + +theorem sourceBundleRemovalStep_total_le_quarter (k r : ℕ) : + (r : ℝ) * (sourceBundleRemovalHorizon k r : ℝ) * + sourceBundleRemovalStep k r ≤ 1 / 4 := by + let p := r * sourceBundleRemovalHorizon k r + have hden : (0 : ℝ) < (4 * (p + 1 : ℕ) : ℕ) := by + positivity + rw [show + (r : ℝ) * (sourceBundleRemovalHorizon k r : ℝ) * + sourceBundleRemovalStep k r = + (p : ℝ) / (4 * (p + 1 : ℕ) : ℕ) by + simp only [sourceBundleRemovalStep, p] + push_cast + ring] + apply (div_le_iff₀ hden).2 + push_cast + have hp : (0 : ℝ) ≤ p := by positivity + nlinarith + +theorem sourceBundleRemovalStep_total_le_one (k r : ℕ) : + (r : ℝ) * (sourceBundleRemovalHorizon k r : ℝ) * + sourceBundleRemovalStep k r ≤ 1 := + (sourceBundleRemovalStep_total_le_quarter k r).trans (by norm_num) + +theorem sourceBundleRemovalStep_total_lt_half (k r : ℕ) : + (r : ℝ) * (sourceBundleRemovalHorizon k r : ℝ) * + sourceBundleRemovalStep k r < 1 / 2 := + (sourceBundleRemovalStep_total_le_quarter k r).trans_lt (by norm_num) + +noncomputable def sourceBundleRemovalCountThreshold + (k r ceiling : ℕ) (δ : ℝ) : ℝ := + (1 / 2 : ℝ) * + sourceBundleDensity δ ceiling ^ + Fintype.card (PositiveOrderedFace k r) + +theorem sourceBundleRemovalCountThreshold_pos + {δ : ℝ} (hδ : 0 < δ) (k r ceiling : ℕ) : + 0 < sourceBundleRemovalCountThreshold k r ceiling δ := by + unfold sourceBundleRemovalCountThreshold + exact mul_pos (by norm_num) + (pow_pos (sourceBundleDensity_pos hδ ceiling) _) + +theorem hasUniformOrderedPatternRemoval_sourceFull + (k n : ℕ) (hrank : n + 1 ≤ k) : + HasUniformOrderedPatternRemoval k (n + 1) := by + intro ε hε + let r : ℕ := n + 1 + let edgeBound : ℕ := + (orderedConfigurationInitialBundle k r).edges.card + let N : ℕ := sourceBundleRemovalHorizon k r + let δ : ℝ := sourceBundleRemovalDensityBudget ε r + let step : ℝ := sourceBundleRemovalStep k r + let κ : ℝ := sourceBundleRemovalKappa k r + have hδ : 0 < δ := by + exact sourceBundleRemovalDensityBudget_pos hε r + have hδ_one : δ ≤ 1 := by + exact sourceBundleRemovalDensityBudget_le_one hε r + have hstep : 0 < step := by + exact sourceBundleRemovalStep_pos k r + have hκ : 0 < κ := by + exact sourceBundleRemovalKappa_pos k r + have hκ_one : κ ≤ 1 := by + exact sourceBundleRemovalKappa_le_one k r + have hκ_step : 4 * κ ≤ step := by + exact four_mul_sourceBundleRemovalKappa_le_step k r + have hκ_sq : κ ^ 2 ≤ step / 2 := by + exact sourceBundleRemovalKappa_sq_le_half_step k r + obtain ⟨Q, hQ⟩ := + exists_sourceBundleRemovalGrowthCoefficient + hδ hδ_one hκ hκ_one N + let F : NatGrowthFunction := sourceBundleRemovalGrowth Q N + let initialBound : Fin (r + 1) → ℕ := fun _ => 2 + let S : SourceFullCoarseTargetSchedule.Bounded + k r initialBound F 0 := + Classical.choice + (SourceFullCoarseTargetSchedule.bounded_nonempty + k r initialBound F 0) + let c : ℝ := + sourceBundleRemovalCountThreshold k r S.ceiling δ + have hc : 0 < c := by + exact sourceBundleRemovalCountThreshold_pos hδ k r S.ceiling + refine ⟨c, hc, ?_⟩ + intro G _instFintype _instDecidableEq _instNonempty H hcount + let initial : OrderedPartitionComplex G k r := + orderedPatternInitialComplex H + obtain ⟨Cbounded⟩ := + S.certificate_nonempty initial (by + intro q e + exact complexity_orderedPatternInitialComplex_le_two H q e) + let C := Cbounded.toSourceFull + let P : OrderedCoarseFineComplex G k r := + C.regularity.toCoarseFine + let α : ℕ → ℝ := sourceBundleRankwiseDensity δ C.scale + let β : ℕ → ℝ := sourceBundleRankwiseDefect δ κ N C.scale + let μ : ℕ → ℝ := bundleRankwiseDensityFloor α + let τ : ℝ := sourceFullCommonTolerance F C.scale + let E : ℕ → ℕ → ℝ := + bundleRankwiseEnvelopeError α β μ τ + let D : OrderedPattern.DeletionFamily (G := G) k r := + P.sourceFullBadBaseDeletionFamily α β + have hα : ∀ d, 0 < α d := by + intro d + exact sourceBundleRankwiseDensity_pos hδ C.scale d + have hα_one : ∀ d, α d ≤ 1 := by + intro d + exact sourceBundleRankwiseDensity_le_one hδ.le hδ_one C.scale d + have hβ : ∀ d, 0 ≤ β d := by + intro d + exact sourceBundleRankwiseDefect_nonneg δ κ N C.scale d + have hβ_pos : ∀ d, 0 < β d := by + intro d + unfold β sourceBundleRankwiseDefect + exact sq_pos_of_pos + (sourceBundleDefectScale_pos hδ hκ N _) + have hτ : 0 ≤ τ := by + exact (sourceFullCommonTolerance_pos F C.scale).le + have hscale : Antitone C.scale := C.scale_antitone + have henvelopeRaw := + sourceBundleRankwiseEnvelope_and_error_lt_half + (r := r) (edgeBound := edgeBound) (Q := Q) + hδ hδ_one hκ hstep.le hκ_step hκ_sq + (by + simpa [step, N, edgeBound, sourceBundleRemovalHorizon] using + sourceBundleRemovalStep_total_le_one k r) + (by + simpa [step, N, edgeBound, sourceBundleRemovalHorizon] using + sourceBundleRemovalStep_total_lt_half k r) + (by simpa [N, edgeBound, sourceBundleRemovalHorizon] using hQ) + C.scale hscale + have henvelope : IsBundleCountingEnvelope α β μ τ E := by + simpa [α, β, μ, τ, E, F, N, edgeBound, + sourceBundleRemovalHorizon] using henvelopeRaw.1 + have herror : E r edgeBound < 1 / 2 := by + simpa [α, β, μ, τ, E, F, N, edgeBound, + sourceBundleRemovalHorizon] using henvelopeRaw.2 + have hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => τ) := by + simpa [P, τ] using + C.isFullyMixedPreliminaryOrderedRegular_common + have hthreshold : + c ≤ (1 / 2 : ℝ) * + (∏ e : PositiveOrderedFace k r, α e.rank) := by + have hfloor : 0 ≤ sourceBundleDensity δ S.ceiling := + (sourceBundleDensity_pos hδ S.ceiling).le + have hpoint : ∀ e : PositiveOrderedFace k r, + sourceBundleDensity δ S.ceiling ≤ α e.rank := by + intro e + unfold α sourceBundleRankwiseDensity + apply sourceBundleDensity_antitone hδ.le + exact + (hscale (Fin.zero_le _)).trans + Cbounded.scale_zero_le_ceiling + have hprod : + sourceBundleDensity δ S.ceiling ^ + Fintype.card (PositiveOrderedFace k r) ≤ + ∏ e : PositiveOrderedFace k r, α e.rank := by + calc + sourceBundleDensity δ S.ceiling ^ + Fintype.card (PositiveOrderedFace k r) = + ∏ _e : PositiveOrderedFace k r, + sourceBundleDensity δ S.ceiling := by simp + _ ≤ ∏ e : PositiveOrderedFace k r, α e.rank := by + apply Finset.prod_le_prod₀ + · intro e _he + exact hfloor + · intro e _he + exact hpoint e + simpa [c, sourceBundleRemovalCountThreshold] using + (mul_le_mul_of_nonneg_left hprod (by norm_num : (0 : ℝ) ≤ 1 / 2)) + have hgoodCount : + ∀ A : ClosedOrderedAtomConfiguration G k r P.coarse, + A.IsSourceFullMixedGood P α β → + c ≤ fullConfigurationCount A := by + intro A hgood + exact hthreshold.trans + (half_rankwiseDensityProduct_le_fullConfigurationCount_of_rankBound + P A α β μ τ E hα hα_one hβ hτ hgood hregular + henvelope (by simpa [edgeBound] using herror)) + have hinitial : + P.coarse.Refines (orderedPatternInitialComplex H) := by + simpa [P, initial, + CoarseTargetOrderedComplexRegularityCertificate.toCoarseFine] using + C.regularity.coarse_refines_initial + have hcover : H.IsCover D := by + exact + sourceFullBadBaseDeletionFamily_isCover_of_sourceFullMixedGood_count + (by simpa [r] using hrank) H P hinitial α β c hcount hgoodCount + refine ⟨D, hcover, ?_⟩ + intro e + have hbase := + P.faceDeletionDensity_sourceFullBadBaseDeletionFamily_le + α β (fun j => (hα (j + 1)).le) (fun j => hβ_pos (j + 1)) e + calc + OrderedPattern.faceDeletionDensity D e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap q.1 (q.2.trans e) / + β (q.1.1 + 1)) := by + simpa [D] using hbase + _ ≤ ∑ _q : OrderedPositiveSubface r, (δ + δ) := by + apply Finset.sum_le_sum + intro q _hq + have hd : q.1.1 + 1 ≤ r := by omega + have hselected : + sourceBundleSelectedScale C.scale (q.1.1 + 1) = + C.scale q.1.succ := by + calc + sourceBundleSelectedScale C.scale (q.1.1 + 1) = + C.scale + ⟨q.1.1 + 1, Nat.lt_succ_iff.mpr hd⟩ := + sourceBundleSelectedScale_of_le C.scale hd + _ = C.scale q.1.succ := by + apply congrArg C.scale + exact Fin.ext rfl + have hcomplexity : + FacePartition.complexity + (P.coarse.partition q.1.succ (q.2.trans e)) ≤ + C.scale q.1.succ := by + simpa [P, + CoarseTargetOrderedComplexRegularityCertificate.toCoarseFine] using + C.coarse_complexity q.1.succ (q.2.trans e) + have hlow : + (FacePartition.complexity + (P.coarse.partition q.1.succ (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) ≤ δ := by + calc + (FacePartition.complexity + (P.coarse.partition q.1.succ (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) ≤ + (C.scale q.1.succ : ℝ) * α (q.1.1 + 1) := + mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr hcomplexity) (hα _).le + _ = (C.scale q.1.succ : ℝ) * + sourceBundleDensity δ (C.scale q.1.succ) := by + simp [α, sourceBundleRankwiseDensity, hselected] + _ ≤ δ := mul_sourceBundleDensity_le hδ.le _ + have hfaceLayer : + P.coarseUpperFaceAtomEnergyGap q.1 (q.2.trans e) ≤ + P.coarseUpperLayerAtomEnergyGap q.1 := by + rw [P.coarseUpperLayerAtomEnergyGap_eq_sum_face q.1] + exact Finset.single_le_sum + (fun f _ => P.coarseUpperFaceAtomEnergyGap_nonneg q.1 f) + (Finset.mem_univ (q.2.trans e)) + have hlayer : + P.coarseUpperLayerAtomEnergyGap q.1 ≤ + sourceFullRankGap F C.scale q.1 := by + simpa [P] using C.rank_gap_le q.1 + have hdefect : + P.coarseUpperFaceAtomEnergyGap q.1 (q.2.trans e) / + β (q.1.1 + 1) ≤ δ := by + calc + P.coarseUpperFaceAtomEnergyGap q.1 (q.2.trans e) / + β (q.1.1 + 1) ≤ + sourceFullRankGap F C.scale q.1 / + β (q.1.1 + 1) := + div_le_div_of_nonneg_right + (hfaceLayer.trans hlayer) (hβ _) + _ = + (1 / + (sourceBundleRemovalGrowth Q N + (C.scale q.1.succ) : ℝ) ^ 2) / + sourceBundleDefectScale δ κ N + (C.scale q.1.succ) ^ 2 := by + simp [F, sourceFullRankGap, β, + sourceBundleRankwiseDefect, hselected] + _ ≤ δ := + sourceFullRankGap_div_sourceBundleDefectScale_sq_le + hδ hκ hQ (C.scale q.1.succ) + exact add_le_add hlow hdefect + _ = (Fintype.card (OrderedPositiveSubface r) : ℝ) * + (δ + δ) := by + simp [mul_add] + _ ≤ ε := by + simpa [δ, r] using + card_mul_two_sourceBundleRemovalDensityBudget_le hε (n + 1) + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +theorem szemeredi (k : ℕ) (hk : 2 ≤ k) {δ : ℝ} (hδ : 0 < δ) : + ∃ c : ℝ, 0 < c ∧ HasUniformDenseAPCount k δ c := by + refine + exists_uniformDenseAPCount_of_orderedRemoval_of_two_le + k hk ?_ hδ + have hrank : k - 1 = (k - 2) + 1 := by omega + rw [hrank] + exact hasUniformOrderedPatternRemoval_sourceFull + k (k - 2) (by omega) + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/ConfigurationWeightedDefect.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/ConfigurationWeightedDefect.lean new file mode 100644 index 0000000000000000000000000000000000000000..473ee520b87bb5e5b32d5e64494325f692171c7c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/ConfigurationWeightedDefect.lean @@ -0,0 +1,1353 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedConfigurationCounting + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def OrderedCoarseFineComplex.coarseDiagonal + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : + OrderedCoarseFineComplex G k r where + coarse := P.coarse + fine := P.coarse + refines := OrderedPartitionComplex.Refines.refl P.coarse + +noncomputable def mixedConfigurationCoarseDensity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) : ℝ := + orderedBoundaryStructured + (positiveFaceLowerLayer P.coarse e) + e.face + (partitionAtomIndicator + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + (orderedFaceTuple e.face A.witness) + +noncomputable def mixedConfigurationFineDensity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + orderedBoundaryStructured + (positiveFaceLowerLayer P.fine e) + e.face + (partitionAtomIndicator + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + y + +noncomputable def mixedConfigurationDefect + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + mixedConfigurationFineDensity P A e y - + mixedConfigurationCoarseDensity P A e + +noncomputable def mixedConfigurationUniform + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + configurationFaceWeight A e y - + mixedConfigurationFineDensity P A e y + +noncomputable def mixedConfigurationBoundaryIndicator + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + partitionAtomIndicator + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) e.face + (orderedFaceTuple e.face A.witness)) + y + +theorem mixedConfigurationCoarseDensity_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) : + 0 ≤ mixedConfigurationCoarseDensity P A e := by + exact conditionalMean_nonneg _ + (partitionAtomIndicator_nonneg _ _) _ + +theorem mixedConfigurationCoarseDensity_le_one + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) : + mixedConfigurationCoarseDensity P A e ≤ 1 := by + exact conditionalMean_le_one _ + (partitionAtomIndicator_le_one _ _) _ + +theorem mixedConfigurationBoundaryIndicator_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + 0 ≤ mixedConfigurationBoundaryIndicator P A e y := + partitionAtomIndicator_nonneg _ _ _ + +theorem mixedConfigurationBoundaryIndicator_le_one + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + mixedConfigurationBoundaryIndicator P A e y ≤ 1 := + partitionAtomIndicator_le_one _ _ _ + +theorem mixedConfigurationFaceWeight_decompose + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + configurationFaceWeight A e y = + mixedConfigurationCoarseDensity P A e + + mixedConfigurationDefect P A e y + + mixedConfigurationUniform P A e y := by + unfold mixedConfigurationDefect mixedConfigurationUniform + ring + +theorem coarse_boundary_mem_of_coarse_configuration_weight_ne_zero + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (hpos : 0 < e.lowerRank.1) + (i : Fin (e.lowerRank.1 + 1)) + (x : Fin k → G) + (hweight : + configurationFaceWeight A (e.boundary hpos i) + (orderedFaceTuple (e.boundary hpos i).face x) ≠ + 0) : + eraseBoundaryCoordinate i (orderedFaceTuple e.face x) ∈ + (positiveFaceLowerLayer P.coarse e + (eraseBoundaryFace e.face i)).part + (eraseBoundaryCoordinate i + (orderedFaceTuple e.face A.witness)) := by + exact + coarse_boundary_mem_of_boundary_weight_ne_zero + P.coarseDiagonal A e hpos i x hweight + +theorem mixedConfigurationBoundaryIndicator_mul_remainder + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (x : Fin k → G) : + mixedConfigurationBoundaryIndicator P A e + (orderedFaceTuple e.face x) * + partialConfigurationWeight A (s.erase e) x = + partialConfigurationWeight A (s.erase e) x := by + simpa [mixedConfigurationBoundaryIndicator, + configurationBoundaryIndicator, + OrderedCoarseFineComplex.coarseDiagonal] using + (configurationBoundaryIndicator_mul_remainder + P.coarseDiagonal A s hclosed e he x) + +theorem partialConfigurationCount_mixed_decompose + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) (he : e ∈ s) : + partialConfigurationCount A s = + mixedConfigurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e) + + configurationContribution A s e + (mixedConfigurationDefect P A e) + + configurationContribution A s e + (mixedConfigurationUniform P A e) := by + rw [partialConfigurationCount, partialConfigurationCount] + have hpoint : + partialConfigurationWeight A s = + fun x => + mixedConfigurationCoarseDensity P A e * + partialConfigurationWeight A (s.erase e) x + + mixedConfigurationDefect P A e + (orderedFaceTuple e.face x) * + partialConfigurationWeight A (s.erase e) x + + mixedConfigurationUniform P A e + (orderedFaceTuple e.face x) * + partialConfigurationWeight A (s.erase e) x := by + funext x + rw [partialConfigurationWeight_eq_face_mul_erase + A s e he x, + mixedConfigurationFaceWeight_decompose P A e] + ring + rw [hpoint, mean_add, mean_add, mean_smul] + rfl + +def IsFullyMixedPreliminaryOrderedRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (τ : OrderedRegularityTolerance r) : Prop := + ∀ j : Fin r, + IsPreliminaryOrderedRegular + (P.fine.partition j.castSucc) + (P.coarse.partition j.succ) + (τ j) + +theorem ClosedOrderedAtomConfiguration.IsMixedGood.atPositiveFace + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (e : PositiveOrderedFace k r) : + OrderedAtomIsGoodAtBoundary + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedFaceTuple e.face A.witness) + (α e.rank) (β e.rank) := by + rcases e with ⟨⟨j, hj⟩, e⟩ + exact hgood j hj e + +theorem mixedConfigurationFace_isFaceCutRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (τ : OrderedRegularityTolerance r) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P τ) + (e : PositiveOrderedFace k r) : + (⟨orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face⟩ : + FaceRegularityState + (Fin (e.lowerRank.1 + 1) → G)).IsFaceCutRegular + (partitionAtomIndicator + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + (τ e.lowerRank) := by + rw [positiveFaceLowerLayer] + exact + (hregular e.lowerRank).toBounded + e.face + (A.atom e.lowerRank.succ e.face) + +theorem mixedConfigurationContribution_uniform_eq_mean_faceCutCorrelation + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (a : G) : + configurationContribution A s e + (mixedConfigurationUniform P A e) = + mean fun z : OrderedFaceComplement e.face → G => + (⟨orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face⟩ : + FaceRegularityState + (Fin (e.lowerRank.1 + 1) → G)).faceCutCorrelation + (partitionAtomIndicator + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + (configurationRemainderCutTest + A s e hmax a z) := by + unfold configurationContribution + rw [mean_splitOrderedFace e.face, mean₂_comm] + unfold mean₂ + apply congrArg mean + funext z + unfold FaceRegularityState.faceCutCorrelation + apply congrArg mean + funext y + rw [cutTestProduct_configurationRemainderCutTest + A s e hmax a y z] + simp only [orderedFaceTuple_splitOrderedFaceEquiv_symm] + rfl + +theorem abs_mixedConfigurationContribution_uniform_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (τ : OrderedRegularityTolerance r) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P τ) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) : + |configurationContribution A s e + (mixedConfigurationUniform P A e)| ≤ + τ e.lowerRank := by + rw [ + mixedConfigurationContribution_uniform_eq_mean_faceCutCorrelation + P A s e hmax (Classical.choice inferInstance)] + let S : + FaceRegularityState + (Fin (e.lowerRank.1 + 1) → G) := + ⟨orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face⟩ + let f : + (Fin (e.lowerRank.1 + 1) → G) → ℝ := + partitionAtomIndicator + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + calc + |mean fun z : OrderedFaceComplement e.face → G => + S.faceCutCorrelation f + (configurationRemainderCutTest A s e hmax + (Classical.choice inferInstance) z)| ≤ + mean fun z : OrderedFaceComplement e.face → G => + |S.faceCutCorrelation f + (configurationRemainderCutTest A s e hmax + (Classical.choice inferInstance) z)| := + Finset.abs_expect_le Finset.univ _ + _ ≤ + mean fun _z : OrderedFaceComplement e.face → G => + τ e.lowerRank := by + apply mean_mono + intro z + exact + mixedConfigurationFace_isFaceCutRegular + P A τ hregular e + (configurationRemainderCutTest A s e hmax + (Classical.choice inferInstance) z) + (configurationRemainderCutTest_bounded + A s e hmax (Classical.choice inferInstance) z) + _ = τ e.lowerRank := mean_const _ + +theorem isFullyMixedPreliminaryOrderedRegular_of_fine + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + (M : Fin r → ℕ) + (hε : ∀ j, 0 ≤ ε j) + (hcomplexity : + ∀ (j : Fin r) (e : OrderedFace k (j.1 + 1)), + FacePartition.complexity + (P.fine.partition j.succ e) ≤ M j) : + IsFullyMixedPreliminaryOrderedRegular P + (fun j => (M j : ℝ) * ε j) := by + intro j + exact P.preliminaryRegular_coarseUpper + ε hregular j (M j) (hε j) (hcomplexity j) + +theorem abs_mixedConfigurationContribution_uniform_le_of_fine + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + (M : Fin r → ℕ) + (hε : ∀ j, 0 ≤ ε j) + (hcomplexity : + ∀ (j : Fin r) (e : OrderedFace k (j.1 + 1)), + FacePartition.complexity + (P.fine.partition j.succ e) ≤ M j) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) : + |configurationContribution A s e + (mixedConfigurationUniform P A e)| ≤ + (M e.lowerRank : ℝ) * ε e.lowerRank := by + exact + abs_mixedConfigurationContribution_uniform_le + P A (fun j => (M j : ℝ) * ε j) + (isFullyMixedPreliminaryOrderedRegular_of_fine + P ε hregular M hε hcomplexity) + s e hmax + +theorem mixedConfigurationDefect_mul_boundaryIndicator + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + mixedConfigurationDefect P A e y * + mixedConfigurationBoundaryIndicator P A e y = + orderedAtomBoundaryDefect + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) y * + mixedConfigurationBoundaryIndicator P A e y := by + let Q := + orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face + let b : Q.parts := + orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) e.face + (orderedFaceTuple e.face A.witness) + let f : + (Fin (e.lowerRank.1 + 1) → G) → ℝ := + partitionAtomIndicator + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + by_cases hy : y ∈ b.1 + · have hcoarse : + conditionalMean Q f y = + conditionalMean Q f + (orderedFaceTuple e.face A.witness) := by + exact conditionalMean_eq_of_mem_part Q f hy + rw [mixedConfigurationBoundaryIndicator, + partitionAtomIndicator_of_mem _ _ hy, + mul_one, mul_one] + change + conditionalMean + (orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face) + f y - + conditionalMean Q f + (orderedFaceTuple e.face A.witness) = + conditionalMean + (orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face) + f y - + conditionalMean Q f y + rw [hcoarse] + · rw [mixedConfigurationBoundaryIndicator, + partitionAtomIndicator_of_not_mem _ _ hy, + mul_zero, mul_zero] + +theorem mean_sq_mixedConfigurationDefect_mul_boundaryIndicator + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) : + mean (fun y => + (mixedConfigurationDefect P A e y * + mixedConfigurationBoundaryIndicator P A e y) ^ 2) = + orderedLocalizedAtomDefectSq + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) := by + unfold orderedLocalizedAtomDefectSq + apply congrArg mean + funext y + rw [mixedConfigurationDefect_mul_boundaryIndicator P A e y, + mul_pow] + rw [show + mixedConfigurationBoundaryIndicator P A e y ^ 2 = + mixedConfigurationBoundaryIndicator P A e y by + exact partitionAtomIndicator_sq _ _ _] + rfl + +theorem mixedConfigurationContribution_defect_eq_localized + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) : + configurationContribution A s e + (mixedConfigurationDefect P A e) = + mean fun x : Fin k → G => + (mixedConfigurationDefect P A e + (orderedFaceTuple e.face x) * + mixedConfigurationBoundaryIndicator P A e + (orderedFaceTuple e.face x)) * + partialConfigurationWeight A (s.erase e) x := by + unfold configurationContribution + apply congrArg mean + funext x + rw [mul_assoc, + mixedConfigurationBoundaryIndicator_mul_remainder + P A s hclosed e he x] + +theorem mixedConfigurationContribution_defect_sq_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hβ : 0 ≤ β e.rank) : + configurationContribution A s e + (mixedConfigurationDefect P A e) ^ 2 ≤ + β e.rank := by + let u : (Fin k → G) → ℝ := + fun x => + mixedConfigurationDefect P A e + (orderedFaceTuple e.face x) * + mixedConfigurationBoundaryIndicator P A e + (orderedFaceTuple e.face x) + let v : (Fin k → G) → ℝ := + partialConfigurationWeight A (s.erase e) + have hlocal : + mean (fun x : Fin k → G => u x ^ 2) ≤ + β e.rank := by + have hgoodLocal := + (hgood.atPositiveFace P A α β e).localized_defect + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedFaceTuple e.face A.witness) + (α e.rank) (β e.rank) + have hmass : + orderedBoundaryAtomMass + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) ≤ + 1 := + orderedBoundaryAtomMass_le_one _ _ _ + calc + mean (fun x : Fin k → G => u x ^ 2) = + mean (fun y => + (mixedConfigurationDefect P A e y * + mixedConfigurationBoundaryIndicator P A e y) ^ 2) := by + exact mean_comp_orderedFaceTuple e.face + (fun y => + (mixedConfigurationDefect P A e y * + mixedConfigurationBoundaryIndicator P A e y) ^ 2) + _ = + orderedLocalizedAtomDefectSq + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) := + mean_sq_mixedConfigurationDefect_mul_boundaryIndicator + P A e + _ ≤ + β e.rank * + orderedBoundaryAtomMass + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) := + hgoodLocal + _ ≤ β e.rank := by + exact mul_le_of_le_one_right hβ hmass + have hv0 : + 0 ≤ mean (fun x : Fin k → G => v x ^ 2) := + mean_nonneg fun x => sq_nonneg _ + have hv1 : + mean (fun x : Fin k → G => v x ^ 2) ≤ 1 := + mean_sq_partialConfigurationWeight_le_one + A (s.erase e) + calc + configurationContribution A s e + (mixedConfigurationDefect P A e) ^ 2 = + mean (fun x : Fin k → G => u x * v x) ^ 2 := by + rw [mixedConfigurationContribution_defect_eq_localized + P A s hclosed e he] + _ ≤ + mean (fun x : Fin k → G => u x ^ 2) * + mean (fun x : Fin k → G => v x ^ 2) := + mean_mul_sq_le_product u v + _ ≤ + β e.rank * + mean (fun x : Fin k → G => v x ^ 2) := + mul_le_mul_of_nonneg_right hlocal hv0 + _ ≤ β e.rank := + mul_le_of_le_one_right hβ hv1 + +theorem abs_mixedConfigurationContribution_defect_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + {δ : ℝ} (hδ : 0 ≤ δ) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hβ0 : 0 ≤ β e.rank) + (hβδ : β e.rank ≤ δ ^ 2) : + |configurationContribution A s e + (mixedConfigurationDefect P A e)| ≤ δ := by + have hsquare : + |configurationContribution A s e + (mixedConfigurationDefect P A e)| ^ 2 ≤ + δ ^ 2 := by + rw [sq_abs] + exact le_trans + (mixedConfigurationContribution_defect_sq_le + P A α β hgood s hclosed e he hβ0) + hβδ + exact + (sq_le_sq₀ + (abs_nonneg + (configurationContribution A s e + (mixedConfigurationDefect P A e))) + hδ).mp hsquare + +theorem abs_partialConfigurationCount_sub_mixedDensity_mul_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (τ : OrderedRegularityTolerance r) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P τ) + {δ : ℝ} (hδ : 0 ≤ δ) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (hβ0 : 0 ≤ β e.rank) + (hβδ : β e.rank ≤ δ ^ 2) : + |partialConfigurationCount A s - + mixedConfigurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e)| ≤ + δ + τ e.lowerRank := by + have hdefect : + |configurationContribution A s e + (mixedConfigurationDefect P A e)| ≤ δ := + abs_mixedConfigurationContribution_defect_le + P A α β hgood hδ s hclosed e he hβ0 hβδ + have huniform : + |configurationContribution A s e + (mixedConfigurationUniform P A e)| ≤ + τ e.lowerRank := + abs_mixedConfigurationContribution_uniform_le + P A τ hregular s e hmax + rw [partialConfigurationCount_mixed_decompose + P A s e he] + calc + |mixedConfigurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e) + + configurationContribution A s e + (mixedConfigurationDefect P A e) + + configurationContribution A s e + (mixedConfigurationUniform P A e) - + mixedConfigurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e)| = + |configurationContribution A s e + (mixedConfigurationDefect P A e) + + configurationContribution A s e + (mixedConfigurationUniform P A e)| := by + congr 1 + ring + _ ≤ + |configurationContribution A s e + (mixedConfigurationDefect P A e)| + + |configurationContribution A s e + (mixedConfigurationUniform P A e)| := + abs_add_le _ _ + _ ≤ δ + τ e.lowerRank := + add_le_add hdefect huniform + +theorem abs_partialConfigurationCount_sub_mixedDensity_mul_le_of_fine + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + (M : Fin r → ℕ) + (hε : ∀ j, 0 ≤ ε j) + (hcomplexity : + ∀ (j : Fin r) (e : OrderedFace k (j.1 + 1)), + FacePartition.complexity + (P.fine.partition j.succ e) ≤ M j) + {δ : ℝ} (hδ : 0 ≤ δ) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (hβ0 : 0 ≤ β e.rank) + (hβδ : β e.rank ≤ δ ^ 2) : + |partialConfigurationCount A s - + mixedConfigurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e)| ≤ + δ + (M e.lowerRank : ℝ) * ε e.lowerRank := by + exact + abs_partialConfigurationCount_sub_mixedDensity_mul_le + P A α β hgood + (fun j => (M j : ℝ) * ε j) + (isFullyMixedPreliminaryOrderedRegular_of_fine + P ε hregular M hε hcomplexity) + hδ s hclosed e he hmax hβ0 hβδ + +noncomputable def mixedExtendedConfigurationCount + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (s : Finset (PositiveOrderedFace k r)) : ℝ := by + classical + exact + if IsDownwardClosedPositiveFaces s then + partialConfigurationCount A s + else + ∏ e ∈ s, mixedConfigurationCoarseDensity P A e + +@[simp] +theorem mixedExtendedConfigurationCount_empty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) : + mixedExtendedConfigurationCount P A ∅ = 1 := by + rw [mixedExtendedConfigurationCount, + ite_eq_left downwardClosed_empty, + partialConfigurationCount_empty] + +theorem mixedExtendedConfigurationCount_univ + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) : + mixedExtendedConfigurationCount P A Finset.univ = + fullConfigurationCount A := by + rw [mixedExtendedConfigurationCount, + ite_eq_left downwardClosed_univ] + rfl + +theorem mixedConfigurationCoarseDensity_lower + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (e : PositiveOrderedFace k r) : + α e.rank ≤ mixedConfigurationCoarseDensity P A e := + (hgood.atPositiveFace P A α β e).1 + +theorem mixedExtendedConfigurationCount_step_rankwise + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (τ : OrderedRegularityTolerance r) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P τ) + (δ : ℕ → ℝ) + (hτ : ∀ j, 0 ≤ τ j) + (hδ : ∀ n, 0 ≤ δ n) + (hβ0 : ∀ n, 0 ≤ β n) + (hβδ : ∀ n, β n ≤ (δ n) ^ 2) + (s : Finset (PositiveOrderedFace k r)) + (hs : s.Nonempty) : + ∃ e ∈ s, + |mixedExtendedConfigurationCount P A s - + mixedConfigurationCoarseDensity P A e * + mixedExtendedConfigurationCount P A (s.erase e)| ≤ + δ e.rank + τ e.lowerRank := by + classical + by_cases hclosed : IsDownwardClosedPositiveFaces s + · obtain ⟨e, he, hmax⟩ := + exists_maxRank_mem s hs + have hclosedErase : + IsDownwardClosedPositiveFaces (s.erase e) := + hclosed.erase_maxRank he hmax + refine ⟨e, he, ?_⟩ + rw [mixedExtendedConfigurationCount, + ite_eq_left hclosed, + mixedExtendedConfigurationCount, + ite_eq_left hclosedErase] + exact + abs_partialConfigurationCount_sub_mixedDensity_mul_le + P A α β hgood τ hregular (hδ e.rank) + s hclosed e he + (fun f hf => hmax f (Finset.mem_of_mem_erase hf)) + (hβ0 e.rank) (hβδ e.rank) + · unfold IsDownwardClosedPositiveFaces at hclosed + push Not at hclosed + obtain ⟨f, hf, hpos, i, hboundary⟩ := hclosed + by_cases hrest : s.erase f = ∅ + · have hsEq : s = {f} := by + rcases (Finset.erase_eq_empty_iff s f).mp hrest with + hsEmpty | hsSingleton + · exact (hs.ne_empty hsEmpty).elim + · exact hsSingleton + refine ⟨f, hf, ?_⟩ + have hcountS : + mixedExtendedConfigurationCount P A s = + mixedConfigurationCoarseDensity P A f := by + rw [mixedExtendedConfigurationCount, ite_eq_right] + · simp [hsEq] + · intro h + exact hboundary (h f hf hpos i) + have hcountErase : + mixedExtendedConfigurationCount P A (s.erase f) = 1 := by + rw [hrest, mixedExtendedConfigurationCount_empty] + rw [hcountS, hcountErase, mul_one, sub_self, abs_zero] + exact add_nonneg (hδ f.rank) (hτ f.lowerRank) + · obtain ⟨e, heRest⟩ : + (s.erase f).Nonempty := + Finset.nonempty_iff_ne_empty.mpr hrest + have heS : e ∈ s := + Finset.mem_of_mem_erase heRest + have hef : e ≠ f := + (Finset.mem_erase.mp heRest).1 + have hfEraseE : f ∈ s.erase e := + Finset.mem_erase.mpr ⟨hef.symm, hf⟩ + have hclosedErase : + ¬IsDownwardClosedPositiveFaces (s.erase e) := by + intro h + have hb := h f hfEraseE hpos i + exact hboundary (Finset.mem_of_mem_erase hb) + refine ⟨e, heS, ?_⟩ + have hcountS : + mixedExtendedConfigurationCount P A s = + ∏ g ∈ s, + mixedConfigurationCoarseDensity P A g := by + rw [mixedExtendedConfigurationCount, ite_eq_right] + intro h + exact hboundary (h f hf hpos i) + have hcountErase : + mixedExtendedConfigurationCount P A (s.erase e) = + ∏ g ∈ s.erase e, + mixedConfigurationCoarseDensity P A g := by + rw [mixedExtendedConfigurationCount, + ite_eq_right hclosedErase] + rw [hcountS, hcountErase] + have hprod : + mixedConfigurationCoarseDensity P A e * + (∏ g ∈ s.erase e, + mixedConfigurationCoarseDensity P A g) = + ∏ g ∈ s, + mixedConfigurationCoarseDensity P A g := + Finset.mul_prod_erase s + (mixedConfigurationCoarseDensity P A) heS + rw [hprod, sub_self, abs_zero] + exact add_nonneg (hδ e.rank) (hτ e.lowerRank) + +theorem mixedFullConfigurationCount_lower_bound_rankwise + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (τ : OrderedRegularityTolerance r) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P τ) + (δ : ℕ → ℝ) + (hα : ∀ n, 0 ≤ α n) + (hτ : ∀ j, 0 ≤ τ j) + (hδ : ∀ n, 0 ≤ δ n) + (hβ0 : ∀ n, 0 ≤ β n) + (hβδ : ∀ n, β n ≤ (δ n) ^ 2) : + (∏ e : PositiveOrderedFace k r, α e.rank) - + (∑ e : PositiveOrderedFace k r, + (δ e.rank + τ e.lowerRank)) ≤ + fullConfigurationCount A := by + let count : + Finset (PositiveOrderedFace k r) → ℝ := + mixedExtendedConfigurationCount P A + let p : PositiveOrderedFace k r → ℝ := + mixedConfigurationCoarseDensity P A + let error : PositiveOrderedFace k r → ℝ := + fun e => δ e.rank + τ e.lowerRank + have hempty : count ∅ = 1 := + mixedExtendedConfigurationCount_empty P A + have hp : ∀ e, 0 ≤ p e ∧ p e ≤ 1 := by + intro e + exact + ⟨mixedConfigurationCoarseDensity_nonneg P A e, + mixedConfigurationCoarseDensity_le_one P A e⟩ + have hpLower : ∀ e, α e.rank ≤ p e := by + intro e + exact mixedConfigurationCoarseDensity_lower + P A α β hgood e + have herror : ∀ e, 0 ≤ error e := by + intro e + exact add_nonneg (hδ e.rank) (hτ e.lowerRank) + have hstep : + ∀ s : Finset (PositiveOrderedFace k r), s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ error e := by + intro s hs + exact + mixedExtendedConfigurationCount_step_rankwise + P A α β hgood τ hregular δ hτ hδ hβ0 hβδ s hs + have hbound := + finiteCount_prod_sub_sum_error_le + count p error herror hempty hp hstep + (Finset.univ : + Finset (PositiveOrderedFace k r)) + have hproduct : + (∏ e : PositiveOrderedFace k r, α e.rank) ≤ + ∏ e : PositiveOrderedFace k r, p e := by + apply Finset.prod_le_prod₀ + · intro e _he + exact hα e.rank + · intro e _he + exact hpLower e + have hcountUniv : + count + (Finset.univ : + Finset (PositiveOrderedFace k r)) = + fullConfigurationCount A := + mixedExtendedConfigurationCount_univ P A + rw [hcountUniv] at hbound + calc + (∏ e : PositiveOrderedFace k r, α e.rank) - + (∑ e : PositiveOrderedFace k r, + (δ e.rank + τ e.lowerRank)) ≤ + (∏ e : PositiveOrderedFace k r, p e) - + (∑ e : PositiveOrderedFace k r, error e) := by + exact sub_le_sub hproduct (le_refl _) + _ ≤ fullConfigurationCount A := by + simpa [p, error] using hbound + +theorem mixedFullConfigurationCount_pos_rankwise + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (τ : OrderedRegularityTolerance r) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P τ) + (δ : ℕ → ℝ) + (hα : ∀ n, 0 ≤ α n) + (hτ : ∀ j, 0 ≤ τ j) + (hδ : ∀ n, 0 ≤ δ n) + (hβ0 : ∀ n, 0 ≤ β n) + (hβδ : ∀ n, β n ≤ (δ n) ^ 2) + (hsmall : + (∑ e : PositiveOrderedFace k r, + (δ e.rank + τ e.lowerRank)) < + ∏ e : PositiveOrderedFace k r, α e.rank) : + 0 < fullConfigurationCount A := by + have hlower := + mixedFullConfigurationCount_lower_bound_rankwise + P A α β hgood τ hregular δ + hα hτ hδ hβ0 hβδ + linarith + +theorem mixedFullConfigurationCount_lower_bound_of_fine + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + (M : Fin r → ℕ) + (hcomplexity : + ∀ (j : Fin r) (e : OrderedFace k (j.1 + 1)), + FacePartition.complexity + (P.fine.partition j.succ e) ≤ M j) + (δ : ℕ → ℝ) + (hα : ∀ n, 0 ≤ α n) + (hε : ∀ j, 0 ≤ ε j) + (hδ : ∀ n, 0 ≤ δ n) + (hβ0 : ∀ n, 0 ≤ β n) + (hβδ : ∀ n, β n ≤ (δ n) ^ 2) : + (∏ e : PositiveOrderedFace k r, α e.rank) - + (∑ e : PositiveOrderedFace k r, + (δ e.rank + + (M e.lowerRank : ℝ) * ε e.lowerRank)) ≤ + fullConfigurationCount A := by + apply + mixedFullConfigurationCount_lower_bound_rankwise + P A α β hgood + (fun j => (M j : ℝ) * ε j) + (isFullyMixedPreliminaryOrderedRegular_of_fine + P ε hregular M hε hcomplexity) + δ hα + · intro j + exact mul_nonneg (Nat.cast_nonneg _) (hε j) + · exact hδ + · exact hβ0 + · exact hβδ + +theorem mixedFullConfigurationCount_pos_of_fine + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + (M : Fin r → ℕ) + (hcomplexity : + ∀ (j : Fin r) (e : OrderedFace k (j.1 + 1)), + FacePartition.complexity + (P.fine.partition j.succ e) ≤ M j) + (δ : ℕ → ℝ) + (hα : ∀ n, 0 ≤ α n) + (hε : ∀ j, 0 ≤ ε j) + (hδ : ∀ n, 0 ≤ δ n) + (hβ0 : ∀ n, 0 ≤ β n) + (hβδ : ∀ n, β n ≤ (δ n) ^ 2) + (hsmall : + (∑ e : PositiveOrderedFace k r, + (δ e.rank + + (M e.lowerRank : ℝ) * ε e.lowerRank)) < + ∏ e : PositiveOrderedFace k r, α e.rank) : + 0 < fullConfigurationCount A := by + have hlower := + mixedFullConfigurationCount_lower_bound_of_fine + P A α β hgood ε hregular M hcomplexity δ + hα hε hδ hβ0 hβδ + linarith + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +theorem configurationFaceWeight_sq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + configurationFaceWeight A e y ^ 2 = + configurationFaceWeight A e y := by + exact partitionAtomIndicator_sq _ _ _ + +theorem partialConfigurationWeight_sq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (x : Fin k → G) : + partialConfigurationWeight A s x ^ 2 = + partialConfigurationWeight A s x := by + classical + unfold partialConfigurationWeight + rw [← Finset.prod_pow] + apply Finset.prod_congr rfl + intro e he + exact configurationFaceWeight_sq A e _ + +theorem mean_sq_partialConfigurationWeight_eq_count + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) : + mean (fun x : Fin k → G => + partialConfigurationWeight A s x ^ 2) = + partialConfigurationCount A s := by + unfold partialConfigurationCount + apply congrArg mean + funext x + exact partialConfigurationWeight_sq A s x + +theorem partialConfigurationCount_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) : + 0 ≤ partialConfigurationCount A s := by + unfold partialConfigurationCount + exact mean_nonneg + (partialConfigurationWeight_nonneg A s) + +theorem mean_sq_mixedConfigurationDefect_localized_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (e : PositiveOrderedFace k r) + (hβ : 0 ≤ β e.rank) : + mean (fun x : Fin k → G => + (mixedConfigurationDefect P A e + (orderedFaceTuple e.face x) * + mixedConfigurationBoundaryIndicator P A e + (orderedFaceTuple e.face x)) ^ 2) ≤ + β e.rank := by + have hgoodLocal := + (hgood.atPositiveFace P A α β e).localized_defect + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedFaceTuple e.face A.witness) + (α e.rank) (β e.rank) + have hmass : + orderedBoundaryAtomMass + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) ≤ + 1 := + orderedBoundaryAtomMass_le_one _ _ _ + calc + mean (fun x : Fin k → G => + (mixedConfigurationDefect P A e + (orderedFaceTuple e.face x) * + mixedConfigurationBoundaryIndicator P A e + (orderedFaceTuple e.face x)) ^ 2) = + mean (fun y => + (mixedConfigurationDefect P A e y * + mixedConfigurationBoundaryIndicator P A e y) ^ 2) := by + exact mean_comp_orderedFaceTuple e.face + (fun y => + (mixedConfigurationDefect P A e y * + mixedConfigurationBoundaryIndicator P A e y) ^ 2) + _ = + orderedLocalizedAtomDefectSq + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) := + mean_sq_mixedConfigurationDefect_mul_boundaryIndicator P A e + _ ≤ + β e.rank * + orderedBoundaryAtomMass + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) := + hgoodLocal + _ ≤ β e.rank := + mul_le_of_le_one_right hβ hmass + +theorem mixedConfigurationContribution_defect_sq_le_mul_count + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hβ : 0 ≤ β e.rank) : + configurationContribution A s e + (mixedConfigurationDefect P A e) ^ 2 ≤ + β e.rank * + partialConfigurationCount A (s.erase e) := by + let u : (Fin k → G) → ℝ := + fun x => + mixedConfigurationDefect P A e + (orderedFaceTuple e.face x) * + mixedConfigurationBoundaryIndicator P A e + (orderedFaceTuple e.face x) + let v : (Fin k → G) → ℝ := + partialConfigurationWeight A (s.erase e) + have hu : + mean (fun x : Fin k → G => u x ^ 2) ≤ + β e.rank := + mean_sq_mixedConfigurationDefect_localized_le + P A α β hgood e hβ + have hv : + mean (fun x : Fin k → G => v x ^ 2) = + partialConfigurationCount A (s.erase e) := + mean_sq_partialConfigurationWeight_eq_count + A (s.erase e) + have hv0 : + 0 ≤ mean (fun x : Fin k → G => v x ^ 2) := + mean_nonneg fun x => sq_nonneg _ + calc + configurationContribution A s e + (mixedConfigurationDefect P A e) ^ 2 = + mean (fun x : Fin k → G => u x * v x) ^ 2 := by + rw [mixedConfigurationContribution_defect_eq_localized + P A s hclosed e he] + _ ≤ + mean (fun x : Fin k → G => u x ^ 2) * + mean (fun x : Fin k → G => v x ^ 2) := + mean_mul_sq_le_product u v + _ ≤ + β e.rank * + mean (fun x : Fin k → G => v x ^ 2) := + mul_le_mul_of_nonneg_right hu hv0 + _ = + β e.rank * + partialConfigurationCount A (s.erase e) := by + rw [hv] + +theorem abs_mixedConfigurationContribution_defect_le_sqrt_mul_count + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hβ : 0 ≤ β e.rank) : + |configurationContribution A s e + (mixedConfigurationDefect P A e)| ≤ + Real.sqrt + (β e.rank * + partialConfigurationCount A (s.erase e)) := by + have hcount : + 0 ≤ partialConfigurationCount A (s.erase e) := + partialConfigurationCount_nonneg A (s.erase e) + have hproduct : + 0 ≤ β e.rank * + partialConfigurationCount A (s.erase e) := + mul_nonneg hβ hcount + apply + (sq_le_sq₀ + (abs_nonneg + (configurationContribution A s e + (mixedConfigurationDefect P A e))) + (Real.sqrt_nonneg _)).mp + rw [sq_abs, Real.sq_sqrt hproduct] + exact + mixedConfigurationContribution_defect_sq_le_mul_count + P A α β hgood s hclosed e he hβ + +theorem abs_partialConfigurationCount_sub_mixedDensity_mul_le_sqrt + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsMixedGood P α β) + (τ : OrderedRegularityTolerance r) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P τ) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (hβ : 0 ≤ β e.rank) : + |partialConfigurationCount A s - + mixedConfigurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e)| ≤ + Real.sqrt + (β e.rank * + partialConfigurationCount A (s.erase e)) + + τ e.lowerRank := by + have hdefect : + |configurationContribution A s e + (mixedConfigurationDefect P A e)| ≤ + Real.sqrt + (β e.rank * + partialConfigurationCount A (s.erase e)) := + abs_mixedConfigurationContribution_defect_le_sqrt_mul_count + P A α β hgood s hclosed e he hβ + have huniform : + |configurationContribution A s e + (mixedConfigurationUniform P A e)| ≤ + τ e.lowerRank := + abs_mixedConfigurationContribution_uniform_le + P A τ hregular s e hmax + rw [partialConfigurationCount_mixed_decompose + P A s e he] + calc + |mixedConfigurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e) + + configurationContribution A s e + (mixedConfigurationDefect P A e) + + configurationContribution A s e + (mixedConfigurationUniform P A e) - + mixedConfigurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e)| = + |configurationContribution A s e + (mixedConfigurationDefect P A e) + + configurationContribution A s e + (mixedConfigurationUniform P A e)| := by + congr 1 + ring + _ ≤ + |configurationContribution A s e + (mixedConfigurationDefect P A e)| + + |configurationContribution A s e + (mixedConfigurationUniform P A e)| := + abs_add_le _ _ + _ ≤ + Real.sqrt + (β e.rank * + partialConfigurationCount A (s.erase e)) + + τ e.lowerRank := + add_le_add hdefect huniform + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/CountExtraction.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/CountExtraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..95d96b9329bd7911827231e523ab4d744c452dc8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/CountExtraction.lean @@ -0,0 +1,205 @@ +import OAI.Combinatorics.Progressions.FixedDensity.Energy + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def cyclicAPMass (k N : ℕ) [NeZero N] + (f : ZMod N → ℝ) : ℝ := + ∑ a : ZMod N, ∑ d : ZMod N, cyclicAPProduct k N f a d + +noncomputable def cyclicAPDiagonalMass (k N : ℕ) [NeZero N] + (f : ZMod N → ℝ) : ℝ := + ∑ a : ZMod N, cyclicAPProduct k N f a 0 + +noncomputable def cyclicAPOffDiagMass (k N : ℕ) [NeZero N] + (f : ZMod N → ℝ) : ℝ := + ∑ a : ZMod N, + ∑ d ∈ (Finset.univ.filter fun d : ZMod N => d ≠ 0), + cyclicAPProduct k N f a d + +@[simp] +theorem cyclicAPProduct_zero_difference + (k N : ℕ) (f : ZMod N → ℝ) (a : ZMod N) : + cyclicAPProduct k N f a 0 = f a ^ k := by + simp [cyclicAPProduct, cyclicAPTerm] + +theorem cyclicAPDiagonalMass_eq_sum_pow + (k N : ℕ) [NeZero N] (f : ZMod N → ℝ) : + cyclicAPDiagonalMass k N f = ∑ a : ZMod N, f a ^ k := by + simp [cyclicAPDiagonalMass] + +theorem pow_le_pow_pred_mul + {x B : ℝ} (hx0 : 0 ≤ x) (hxB : x ≤ B) + {k : ℕ} (hk : 1 ≤ k) : + x ^ k ≤ B ^ (k - 1) * x := by + obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hk + have hB0 : 0 ≤ B := hx0.trans hxB + have hpow : x ^ m ≤ B ^ m := + pow_le_pow_left₀ hx0 hxB m + simpa [Nat.add_comm, pow_succ', Nat.add_sub_cancel, mul_comm] using + (mul_le_mul_of_nonneg_right hpow hx0) + +theorem cyclicAPDiagonalMass_le + {k N : ℕ} [NeZero N] {f : ZMod N → ℝ} {B : ℝ} + (hk : 1 ≤ k) + (hf0 : ∀ x, 0 ≤ f x) + (hfB : ∀ x, f x ≤ B) : + cyclicAPDiagonalMass k N f ≤ + B ^ (k - 1) * (N : ℝ) * mean f := by + rw [cyclicAPDiagonalMass_eq_sum_pow] + calc + ∑ a : ZMod N, f a ^ k ≤ + ∑ a : ZMod N, B ^ (k - 1) * f a := by + exact Finset.sum_le_sum fun a _ => + pow_le_pow_pred_mul (hf0 a) (hfB a) hk + _ = B ^ (k - 1) * ∑ a : ZMod N, f a := by + rw [Finset.mul_sum] + _ = B ^ (k - 1) * ((N : ℝ) * mean f) := by + rw [← Fintype.card_mul_expect] + simp [mean, ZMod.card] + _ = B ^ (k - 1) * (N : ℝ) * mean f := by ring + +theorem cyclicAPMass_eq_diagonal_add_offDiagMass + (k N : ℕ) [NeZero N] (f : ZMod N → ℝ) : + cyclicAPMass k N f = + cyclicAPDiagonalMass k N f + cyclicAPOffDiagMass k N f := by + classical + rw [cyclicAPMass, cyclicAPDiagonalMass, cyclicAPOffDiagMass, + ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro a _ + have hdiagonal : + ∑ d ∈ (Finset.univ.filter fun d : ZMod N => d = 0), + cyclicAPProduct k N f a d = + cyclicAPProduct k N f a 0 := by + apply Finset.sum_eq_single 0 + · intro d hd hd0 + exact (hd0 (Finset.mem_filter.mp hd).2).elim + · simp + rw [← Finset.sum_filter_add_sum_filter_not + (s := Finset.univ) (p := fun d : ZMod N => d = 0) + (f := fun d => cyclicAPProduct k N f a d)] + rw [hdiagonal] + +theorem cyclicAPOffDiagMass_pos_of_diagonal_lt_mass + (k N : ℕ) [NeZero N] (f : ZMod N → ℝ) + (h : + cyclicAPDiagonalMass k N f < + cyclicAPMass k N f) : + 0 < cyclicAPOffDiagMass k N f := by + rw [cyclicAPMass_eq_diagonal_add_offDiagMass] at h + linarith + +theorem cyclicAPCount_eq_mass_div_div + (k N : ℕ) [NeZero N] (f : ZMod N → ℝ) : + cyclicAPCount k N f = + cyclicAPMass k N f / (N : ℝ) / (N : ℝ) := by + simp [cyclicAPCount, cyclicAPMass, mean₂, mean, + Fintype.expect_eq_sum_div_card, ZMod.card, Finset.sum_div] + +theorem cyclicAPMass_eq_mul_mul_count + (k N : ℕ) [NeZero N] (f : ZMod N → ℝ) : + cyclicAPMass k N f = + (N : ℝ) * (N : ℝ) * cyclicAPCount k N f := by + rw [cyclicAPCount_eq_mass_div_div] + have hN : (N : ℝ) ≠ 0 := by + exact_mod_cast (NeZero.ne N) + field_simp + +theorem cyclicAPCount_eq_diagonal_add_offDiagMass_div_div + (k N : ℕ) [NeZero N] (f : ZMod N → ℝ) : + cyclicAPCount k N f = + (cyclicAPDiagonalMass k N f + cyclicAPOffDiagMass k N f) / + (N : ℝ) / (N : ℝ) := by + rw [cyclicAPCount_eq_mass_div_div, + cyclicAPMass_eq_diagonal_add_offDiagMass] + +theorem cyclicAPOffDiagMass_nonneg + {k N : ℕ} [NeZero N] {f : ZMod N → ℝ} + (hf : ∀ x, 0 ≤ f x) : + 0 ≤ cyclicAPOffDiagMass k N f := by + classical + apply Finset.sum_nonneg + intro a _ + apply Finset.sum_nonneg + intro d _ + exact cyclicAPProduct_nonneg hf a d + +theorem cyclicAPOffDiagMass_pos_of_count + {k N : ℕ} [NeZero N] {f : ZMod N → ℝ} {B : ℝ} + (hk : 1 ≤ k) + (hf0 : ∀ x, 0 ≤ f x) + (hfB : ∀ x, f x ≤ B) + (hcount : + B ^ (k - 1) * mean f < + (N : ℝ) * cyclicAPCount k N f) : + 0 < cyclicAPOffDiagMass k N f := by + apply cyclicAPOffDiagMass_pos_of_diagonal_lt_mass + have hN : 0 < (N : ℝ) := by + exact_mod_cast NeZero.pos N + calc + cyclicAPDiagonalMass k N f ≤ + B ^ (k - 1) * (N : ℝ) * mean f := + cyclicAPDiagonalMass_le hk hf0 hfB + _ = (N : ℝ) * (B ^ (k - 1) * mean f) := by ring + _ < (N : ℝ) * + ((N : ℝ) * cyclicAPCount k N f) := + mul_lt_mul_of_pos_left hcount hN + _ = cyclicAPMass k N f := by + rw [cyclicAPMass_eq_mul_mul_count] + ring + +theorem cyclicAPProduct_pos_iff_of_nonneg + {k N : ℕ} {f : ZMod N → ℝ} + (hf : ∀ x, 0 ≤ f x) (a d : ZMod N) : + 0 < cyclicAPProduct k N f a d ↔ + ∀ j : Fin k, 0 < f (cyclicAPTerm a d j) := by + constructor + · intro hprod j + have hprod_ne : + (∏ i : Fin k, f (cyclicAPTerm a d i)) ≠ 0 := by + simpa only [cyclicAPProduct] using ne_of_gt hprod + have hfactor_ne : f (cyclicAPTerm a d j) ≠ 0 := + Finset.prod_ne_zero_iff.mp hprod_ne j (Finset.mem_univ j) + exact lt_of_le_of_ne (hf _) (Ne.symm hfactor_ne) + · intro hfactor + rw [cyclicAPProduct] + exact Finset.prod_pos fun j _ => hfactor j + +theorem exists_cyclicAP_of_offDiagMass_pos + {k N : ℕ} [NeZero N] {f : ZMod N → ℝ} + (hf : ∀ x, 0 ≤ f x) + (hmass : 0 < cyclicAPOffDiagMass k N f) : + ∃ a d : ZMod N, d ≠ 0 ∧ + ∀ j : Fin k, 0 < f (cyclicAPTerm a d j) := by + classical + rw [cyclicAPOffDiagMass] at hmass + have houter_nonneg : + ∀ a ∈ (Finset.univ : Finset (ZMod N)), + 0 ≤ + ∑ d ∈ (Finset.univ.filter fun d : ZMod N => d ≠ 0), + cyclicAPProduct k N f a d := by + intro a _ + exact Finset.sum_nonneg fun d _ => cyclicAPProduct_nonneg hf a d + obtain ⟨a, _, ha⟩ := + (Finset.sum_pos_iff_of_nonneg houter_nonneg).mp hmass + have hinner_nonneg : + ∀ d ∈ (Finset.univ.filter fun d : ZMod N => d ≠ 0), + 0 ≤ cyclicAPProduct k N f a d := by + intro d _ + exact cyclicAPProduct_nonneg hf a d + obtain ⟨d, hdmem, hdpos⟩ := + (Finset.sum_pos_iff_of_nonneg hinner_nonneg).mp ha + refine ⟨a, d, (Finset.mem_filter.mp hdmem).2, ?_⟩ + exact (cyclicAPProduct_pos_iff_of_nonneg hf a d).mp hdpos + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/Energy.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/Energy.lean new file mode 100644 index 0000000000000000000000000000000000000000..597c5090de634166893b9e469c03ac270de0fe42 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/Energy.lean @@ -0,0 +1,1239 @@ +import Mathlib.Algebra.BigOperators.Expect +import Mathlib.Algebra.Order.BigOperators.Expect +import Mathlib.Algebra.Order.BigOperators.GroupWithZero.Finset +import Mathlib.Data.Fintype.Card +import Mathlib.Data.ZMod.Basic +import Mathlib.Order.Partition.Finpartition +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def mean {α : Type*} [Fintype α] (f : α → ℝ) : ℝ := + 𝔼 x, f x + +def finsetIndicator {α : Type*} [DecidableEq α] + (A : Finset α) (x : α) : ℝ := + if x ∈ A then 1 else 0 + +@[simp] +theorem finsetIndicator_of_mem {α : Type*} [DecidableEq α] + {A : Finset α} {x : α} (hx : x ∈ A) : + finsetIndicator A x = 1 := by + simp [finsetIndicator, hx] + +@[simp] +theorem finsetIndicator_of_not_mem {α : Type*} [DecidableEq α] + {A : Finset α} {x : α} (hx : x ∉ A) : + finsetIndicator A x = 0 := by + simp [finsetIndicator, hx] + +theorem mean_finsetIndicator {α : Type*} + [Fintype α] [DecidableEq α] (A : Finset α) : + mean (finsetIndicator A) = + (A.card : ℝ) / Fintype.card α := by + rw [mean, Fintype.expect_eq_sum_div_card] + simp [finsetIndicator] + +@[simp] +theorem mean_empty {α : Type*} [Fintype α] [IsEmpty α] (f : α → ℝ) : + mean f = 0 := by + simp [mean] + +@[simp] +theorem mean_const {α : Type*} [Fintype α] [Nonempty α] (c : ℝ) : + mean (fun _ : α => c) = c := by + exact Fintype.expect_const c + +@[simp] +theorem mean_zero {α : Type*} [Fintype α] : + mean (fun _ : α => (0 : ℝ)) = 0 := by + simp [mean] + +theorem mean_add {α : Type*} [Fintype α] (f g : α → ℝ) : + mean (fun x => f x + g x) = mean f + mean g := by + exact Finset.expect_add_distrib Finset.univ f g + +theorem mean_sub {α : Type*} [Fintype α] (f g : α → ℝ) : + mean (fun x => f x - g x) = mean f - mean g := by + exact Finset.expect_sub_distrib Finset.univ f g + +theorem mean_smul {α : Type*} [Fintype α] (c : ℝ) (f : α → ℝ) : + mean (fun x => c * f x) = c * mean f := by + exact (Finset.mul_expect Finset.univ f c).symm + +theorem mean_nonneg {α : Type*} [Fintype α] {f : α → ℝ} + (hf : ∀ x, 0 ≤ f x) : 0 ≤ mean f := by + rw [mean, Fintype.expect_eq_sum_div_card] + exact div_nonneg (Finset.sum_nonneg fun x _ => hf x) (Nat.cast_nonneg _) + +theorem mean_mono {α : Type*} [Fintype α] {f g : α → ℝ} + (hfg : ∀ x, f x ≤ g x) : mean f ≤ mean g := by + rw [mean, mean, Fintype.expect_eq_sum_div_card, Fintype.expect_eq_sum_div_card] + exact div_le_div_of_nonneg_right + (Finset.sum_le_sum fun x _ => hfg x) (Nat.cast_nonneg _) + +theorem mean_le_of_le_const {α : Type*} [Fintype α] [Nonempty α] + {f : α → ℝ} {c : ℝ} (hf : ∀ x, f x ≤ c) : + mean f ≤ c := by + simpa using mean_mono (f := f) (g := fun _ => c) hf + +theorem const_le_mean {α : Type*} [Fintype α] [Nonempty α] + {f : α → ℝ} {c : ℝ} (hf : ∀ x, c ≤ f x) : + c ≤ mean f := by + simpa using mean_mono (f := fun _ => c) (g := f) hf + +noncomputable def mean₂ {α β : Type*} [Fintype α] [Fintype β] + (f : α → β → ℝ) : ℝ := + mean (fun x => mean (f x)) + +theorem mean₂_comm {α β : Type*} [Fintype α] [Fintype β] + (f : α → β → ℝ) : + mean₂ f = mean₂ (fun y x => f x y) := by + exact Finset.expect_comm Finset.univ Finset.univ f + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def cyclicAPTerm {k N : ℕ} (a d : ZMod N) (j : Fin k) : ZMod N := + a + (j : ZMod N) * d + +def cyclicAPProduct (k N : ℕ) (f : ZMod N → ℝ) + (a d : ZMod N) : ℝ := + ∏ j : Fin k, f (cyclicAPTerm a d j) + +noncomputable def cyclicAPCount (k N : ℕ) [NeZero N] + (f : ZMod N → ℝ) : ℝ := + mean₂ (fun a d => cyclicAPProduct k N f a d) + +theorem cyclicAPProduct_nonneg {k N : ℕ} {f : ZMod N → ℝ} + (hf : ∀ x, 0 ≤ f x) (a d : ZMod N) : + 0 ≤ cyclicAPProduct k N f a d := by + exact Finset.prod_nonneg fun j _ => hf (cyclicAPTerm a d j) + +theorem cyclicAPCount_nonneg {k N : ℕ} [NeZero N] + {f : ZMod N → ℝ} (hf : ∀ x, 0 ≤ f x) : + 0 ≤ cyclicAPCount k N f := by + apply mean_nonneg + intro a + apply mean_nonneg + intro d + exact cyclicAPProduct_nonneg hf a d + +@[simp] +theorem cyclicAPProduct_const (k N : ℕ) (c : ℝ) (a d : ZMod N) : + cyclicAPProduct k N (fun _ => c) a d = c ^ k := by + simp [cyclicAPProduct] + +theorem cyclicAPProduct_smul + (k N : ℕ) (c : ℝ) (f : ZMod N → ℝ) + (a d : ZMod N) : + cyclicAPProduct k N (fun x => c * f x) a d = + c ^ k * cyclicAPProduct k N f a d := by + simp [cyclicAPProduct, Finset.prod_mul_distrib] + +@[simp] +theorem cyclicAPCount_const (k N : ℕ) [NeZero N] (c : ℝ) : + cyclicAPCount k N (fun _ => c) = c ^ k := by + simp [cyclicAPCount, mean₂] + +theorem cyclicAPCount_smul + (k N : ℕ) [NeZero N] (c : ℝ) (f : ZMod N → ℝ) : + cyclicAPCount k N (fun x => c * f x) = + c ^ k * cyclicAPCount k N f := by + simp_rw [cyclicAPCount, mean₂, cyclicAPProduct_smul, mean_smul] + +theorem cyclicAPProduct_mono {k N : ℕ} {f g : ZMod N → ℝ} + (hf : ∀ x, 0 ≤ f x) (hfg : ∀ x, f x ≤ g x) + (a d : ZMod N) : + cyclicAPProduct k N f a d ≤ cyclicAPProduct k N g a d := by + exact Finset.prod_le_prod₀ + (fun j _ => hf (cyclicAPTerm a d j)) + (fun j _ => hfg (cyclicAPTerm a d j)) + +theorem cyclicAPCount_mono {k N : ℕ} [NeZero N] + {f g : ZMod N → ℝ} + (hf : ∀ x, 0 ≤ f x) (hfg : ∀ x, f x ≤ g x) : + cyclicAPCount k N f ≤ cyclicAPCount k N g := by + apply mean_mono + intro a + apply mean_mono + intro d + exact cyclicAPProduct_mono hf hfg a d + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem mean_finset_sum {α κ : Type*} + [Fintype α] + (s : Finset κ) (f : κ → α → ℝ) : + mean (fun x => ∑ q ∈ s, f q x) = + ∑ q ∈ s, mean (f q) := by + simpa [mean] using + (Finset.expect_sum_comm + (s := (Finset.univ : Finset α)) s + (fun x q => f q x)) + +theorem one_sub_sum_le_prod_one_sub + {κ : Type*} [Fintype κ] + (I : κ → ℝ) + (hI0 : ∀ q, 0 ≤ I q) + (hI01 : ∀ q, I q = 0 ∨ I q = 1) : + 1 - ∑ q, I q ≤ ∏ q, (1 - I q) := by + by_cases hone : ∃ q, I q = 1 + · obtain ⟨q, hq⟩ := hone + have hsum : 1 ≤ ∑ r, I r := by + simpa [hq] using + (Finset.single_le_sum + (s := (Finset.univ : Finset κ)) + (f := I) (fun r _ => hI0 r) + (Finset.mem_univ q)) + have hprod : (∏ r, (1 - I r)) = 0 := by + apply Finset.prod_eq_zero (Finset.mem_univ q) + rw [hq] + norm_num + rw [hprod] + linarith + · have hzero : ∀ q, I q = 0 := by + intro q + exact (hI01 q).resolve_right fun hq => + hone ⟨q, hq⟩ + simp [hzero] + +theorem prod_one_sub_le_orderedPair_bonferroni + {κ : Type*} [Fintype κ] [DecidableEq κ] + (I : κ → ℝ) + (hI0 : ∀ q, 0 ≤ I q) + (hI01 : ∀ q, I q = 0 ∨ I q = 1) : + (∏ q, (1 - I q)) ≤ + 1 - ∑ q, I q + + ∑ q, ∑ r ∈ (Finset.univ : Finset κ).erase q, + I q * I r := by + by_cases hone : ∃ q, I q = 1 + · obtain ⟨q, hq⟩ := hone + have hprod : (∏ r, (1 - I r)) = 0 := by + apply Finset.prod_eq_zero (Finset.mem_univ q) + rw [hq] + norm_num + have hsum : + (∑ r, I r) = + 1 + ∑ r ∈ (Finset.univ : Finset κ).erase q, I r := by + rw [← Finset.add_sum_erase + (Finset.univ : Finset κ) I (Finset.mem_univ q), hq] + have hrow : + (∑ r ∈ (Finset.univ : Finset κ).erase q, I r) ≤ + ∑ a, ∑ r ∈ (Finset.univ : Finset κ).erase a, + I a * I r := by + calc + (∑ r ∈ (Finset.univ : Finset κ).erase q, I r) = + ∑ r ∈ (Finset.univ : Finset κ).erase q, + I q * I r := by simp [hq] + _ ≤ ∑ a, ∑ r ∈ (Finset.univ : Finset κ).erase a, + I a * I r := by + apply Finset.single_le_sum + (s := (Finset.univ : Finset κ)) + (f := fun a => + ∑ r ∈ (Finset.univ : Finset κ).erase a, + I a * I r) + · intro a _ + exact Finset.sum_nonneg fun r _ => + mul_nonneg (hI0 a) (hI0 r) + · exact Finset.mem_univ q + rw [hprod, hsum] + linarith + · have hzero : ∀ q, I q = 0 := by + intro q + exact (hI01 q).resolve_right fun hq => + hone ⟨q, hq⟩ + simp [hzero] + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem mean_prod_type + {α β : Type*} [Fintype α] [Fintype β] + (F : α → β → ℝ) : + mean (fun p : α × β => F p.1 p.2) = mean₂ F := by + simpa [mean, mean₂] using + (Finset.expect_product' + (Finset.univ : Finset α) (Finset.univ : Finset β) F) + +theorem mean_fin_cons + {G : Type*} [Fintype G] {n : ℕ} + (F : (Fin (n + 1) → G) → ℝ) : + mean F = + mean₂ (fun a : G => fun y : Fin n → G => F (Fin.cons a y)) := by + calc + mean F = + mean (fun p : G × (Fin n → G) => + F (Fin.cons p.1 p.2)) := by + unfold mean + apply Fintype.expect_equiv + (Fin.consEquiv (fun _ : Fin (n + 1) => G)).symm + intro x + congr 1 + simp + _ = mean₂ (fun a : G => fun y : Fin n → G => + F (Fin.cons a y)) := + mean_prod_type + (fun a : G => fun y : Fin n → G => F (Fin.cons a y)) + +theorem prod_mean + {ι β : Type*} [Fintype ι] [DecidableEq ι] + [Fintype β] [Nonempty β] + (F : ι → β → ℝ) : + (∏ i, mean (F i)) = + mean (fun y : ι → β => ∏ i, F i (y i)) := by + classical + simp_rw [mean, Fintype.expect_eq_sum_div_card] + rw [Finset.prod_div_distrib, Fintype.prod_sum] + simp + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def conditionalMean {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) (x : Ω) : ℝ := + Finset.expect (P.part x) f + +theorem conditionalMean_eq_of_part_eq {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) {x y : Ω} + (hxy : P.part x = P.part y) : + conditionalMean P f x = conditionalMean P f y := by + rw [conditionalMean, conditionalMean, hxy] + +theorem conditionalMean_eq_of_mem_part {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) {x y : Ω} + (hy : y ∈ P.part x) : + conditionalMean P f y = conditionalMean P f x := by + apply conditionalMean_eq_of_part_eq + apply P.part_eq_of_mem + · simp + · exact hy + +theorem conditionalMean_nonneg {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + {f : Ω → ℝ} (hf : ∀ x, 0 ≤ f x) (x : Ω) : + 0 ≤ conditionalMean P f x := by + exact Finset.expect_nonneg fun y _ => hf y + +theorem conditionalMean_add {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f g : Ω → ℝ) (x : Ω) : + conditionalMean P (fun y => f y + g y) x = + conditionalMean P f x + conditionalMean P g x := by + exact Finset.expect_add_distrib (P.part x) f g + +theorem conditionalMean_sub {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f g : Ω → ℝ) (x : Ω) : + conditionalMean P (fun y => f y - g y) x = + conditionalMean P f x - conditionalMean P g x := by + exact Finset.expect_sub_distrib (P.part x) f g + +theorem conditionalMean_smul {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (c : ℝ) (f : Ω → ℝ) (x : Ω) : + conditionalMean P (fun y => c * f y) x = + c * conditionalMean P f x := by + exact (Finset.mul_expect (P.part x) f c).symm + +theorem conditionalMean_le_one {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + {f : Ω → ℝ} (hf : ∀ x, f x ≤ 1) (x : Ω) : + conditionalMean P f x ≤ 1 := by + apply Finset.expect_le + · simp + · exact fun y _ => hf y + +@[simp] +theorem conditionalMean_const {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (c : ℝ) (x : Ω) : + conditionalMean P (fun _ => c) x = c := by + rw [conditionalMean] + exact Finset.expect_const (by simp) c + +@[simp] +theorem conditionalMean_idem {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) (x : Ω) : + conditionalMean P (conditionalMean P f) x = + conditionalMean P f x := by + rw [conditionalMean] + calc + Finset.expect (P.part x) (conditionalMean P f) = + Finset.expect (P.part x) + (fun _ => conditionalMean P f x) := by + apply Finset.expect_congr rfl + intro y hy + exact conditionalMean_eq_of_mem_part P f hy + _ = conditionalMean P f x := + Finset.expect_const (by simp) _ + +theorem sum_conditionalMean_on_part {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) {s : Finset Ω} (hs : s ∈ P.parts) : + ∑ x ∈ s, conditionalMean P f x = ∑ x ∈ s, f x := by + calc + ∑ x ∈ s, conditionalMean P f x = + ∑ x ∈ s, Finset.expect s f := by + apply Finset.sum_congr rfl + intro x hx + rw [conditionalMean, P.part_eq_of_mem hs hx] + _ = (s.card : ℝ) * Finset.expect s f := by + simp + _ = ∑ x ∈ s, f x := Finset.card_mul_expect s f + +theorem sum_conditionalMean {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) : + ∑ x, conditionalMean P f x = ∑ x, f x := by + classical + have hparts : + P.parts.biUnion id = (Finset.univ : Finset Ω) := + P.biUnion_parts + calc + ∑ x, conditionalMean P f x = + ∑ x ∈ P.parts.biUnion id, conditionalMean P f x := by + exact Finset.sum_congr hparts.symm fun _ _ => rfl + _ = + ∑ s ∈ P.parts, ∑ x ∈ s, conditionalMean P f x := by + exact Finset.sum_biUnion P.disjoint + _ = ∑ s ∈ P.parts, ∑ x ∈ s, f x := by + apply Finset.sum_congr rfl + intro s hs + exact sum_conditionalMean_on_part P f hs + _ = ∑ x ∈ P.parts.biUnion id, f x := + (Finset.sum_biUnion P.disjoint).symm + _ = ∑ x, f x := by + exact Finset.sum_congr hparts fun _ _ => rfl + +theorem mean_conditionalMean {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) : + mean (conditionalMean P f) = mean f := by + change (𝔼 x, conditionalMean P f x) = 𝔼 x, f x + rw [Fintype.expect_eq_sum_div_card, + Fintype.expect_eq_sum_div_card, sum_conditionalMean P f] + +theorem conditionalMean_sq_le {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) (x : Ω) : + conditionalMean P f x ^ 2 ≤ + conditionalMean P (fun y => f y ^ 2) x := by + have h := + Finset.expect_mul_sq_le_sq_mul_sq + (P.part x) f (fun _ : Ω => (1 : ℝ)) + simpa [conditionalMean, + Finset.expect_const (s := P.part x) (by simp) (1 : ℝ)] using h + +noncomputable def partitionEnergy {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) : ℝ := + mean fun x => conditionalMean P f x ^ 2 + +theorem partitionEnergy_nonneg {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) : + 0 ≤ partitionEnergy P f := by + exact mean_nonneg fun x => sq_nonneg _ + +theorem partitionEnergy_le_mean_sq {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + (f : Ω → ℝ) : + partitionEnergy P f ≤ mean fun x => f x ^ 2 := by + calc + partitionEnergy P f ≤ + mean (conditionalMean P fun x => f x ^ 2) := + mean_mono fun x => conditionalMean_sq_le P f x + _ = mean (fun x => f x ^ 2) := + mean_conditionalMean P fun x => f x ^ 2 + +theorem partitionEnergy_le_one {Ω : Type*} + [Fintype Ω] [DecidableEq Ω] [Nonempty Ω] + (P : Finpartition (Finset.univ : Finset Ω)) + {f : Ω → ℝ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) : + partitionEnergy P f ≤ 1 := by + apply mean_le_of_le_const + intro x + have h0 := conditionalMean_nonneg P hf0 x + have h1 := conditionalMean_le_one P hf1 x + nlinarith [mul_nonneg h0 (sub_nonneg.mpr h1)] + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +abbrev FacePartition (Ω : Type*) [Fintype Ω] [DecidableEq Ω] := + Finpartition (Finset.univ : Finset Ω) + +namespace FacePartition + +variable {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + +theorem ext_of_part_eq {P Q : FacePartition Ω} + (h : ∀ x, P.part x = Q.part x) : P = Q := by + apply Finpartition.ext + ext s + constructor + · intro hs + obtain ⟨x, hx⟩ := P.nonempty_of_mem_parts hs + have hxs : Q.part x = s := + (h x).symm.trans (P.part_eq_of_mem hs hx) + rw [← hxs] + exact Q.part_mem.2 (Finset.mem_univ x) + · intro hs + obtain ⟨x, hx⟩ := Q.nonempty_of_mem_parts hs + have hxs : P.part x = s := + (h x).trans (Q.part_eq_of_mem hs hx) + rw [← hxs] + exact P.part_mem.2 (Finset.mem_univ x) + +theorem part_subset_of_le {P Q : FacePartition Ω} + (h : P ≤ Q) (x : Ω) : + P.part x ⊆ Q.part x := by + obtain ⟨s, hs, hsub⟩ := + h (P.part_mem.2 (Finset.mem_univ x)) + have hxs : x ∈ s := + hsub (P.mem_part (Finset.mem_univ x)) + rw [Q.part_eq_of_mem hs hxs] + exact hsub + +theorem le_iff_part_subset {P Q : FacePartition Ω} : + P ≤ Q ↔ ∀ x, P.part x ⊆ Q.part x := by + constructor + · exact fun h x => part_subset_of_le h x + · intro h s hs + obtain ⟨x, hx⟩ := P.nonempty_of_mem_parts hs + refine ⟨Q.part x, Q.part_mem.2 (Finset.mem_univ x), ?_⟩ + rw [← P.part_eq_of_mem hs hx] + exact h x + +def indiscrete : FacePartition Ω := + ⊤ + +def discrete : FacePartition Ω := + ⊥ + +@[simp] +theorem part_indiscrete (x : Ω) : + (indiscrete : FacePartition Ω).part x = Finset.univ := by + change (⊤ : FacePartition Ω).part x = Finset.univ + have hmem : + (⊤ : FacePartition Ω).part x ∈ + (⊤ : FacePartition Ω).parts := + (⊤ : FacePartition Ω).part_mem.2 (Finset.mem_univ x) + exact Finset.mem_singleton.mp + (Finpartition.parts_top_subset + (Finset.univ : Finset Ω) hmem) + +@[simp] +theorem part_discrete (x : Ω) : + (discrete : FacePartition Ω).part x = {x} := by + apply Finpartition.part_eq_of_mem + · rw [discrete, Finpartition.mem_bot_iff] + exact ⟨x, Finset.mem_univ x, rfl⟩ + · exact Finset.mem_singleton_self x + +def complexity (P : FacePartition Ω) : ℕ := + P.parts.card + +noncomputable def representative + (P : FacePartition Ω) (a : P.parts) : Ω := + Classical.choose (P.nonempty_of_mem_parts a.2) + +theorem representative_mem + (P : FacePartition Ω) (a : P.parts) : + P.representative a ∈ a.1 := + Classical.choose_spec (P.nonempty_of_mem_parts a.2) + +theorem part_representative + (P : FacePartition Ω) (a : P.parts) : + P.part (P.representative a) = a.1 := + P.part_eq_of_mem a.2 (P.representative_mem a) + +theorem complexity_antitone {P Q : FacePartition Ω} + (h : P ≤ Q) : + complexity Q ≤ complexity P := + Finpartition.card_mono h + +theorem complexity_le_card (P : FacePartition Ω) : + complexity P ≤ Fintype.card Ω := by + simpa [complexity] using P.card_parts_le_card + +@[simp] +theorem complexity_discrete : + complexity (discrete : FacePartition Ω) = Fintype.card Ω := by + simp [complexity, discrete] + +@[simp] +theorem complexity_indiscrete [Nonempty Ω] : + complexity (indiscrete : FacePartition Ω) = 1 := by + let x : Ω := Classical.choice inferInstance + have huniv : + (Finset.univ : Finset Ω) ∈ + (⊤ : FacePartition Ω).parts := by + have hx := + (⊤ : FacePartition Ω).part_mem.2 + (Finset.mem_univ x) + change + (indiscrete : FacePartition Ω).part x ∈ + (indiscrete : FacePartition Ω).parts at hx + rw [part_indiscrete] at hx + exact hx + have hparts : + (⊤ : FacePartition Ω).parts = + {(Finset.univ : Finset Ω)} := by + apply Finset.Subset.antisymm + · exact Finpartition.parts_top_subset _ + · intro s hs + rw [Finset.mem_singleton] at hs + simpa [hs] using huniv + simp [complexity, indiscrete, hparts] + +def join (P Q : FacePartition Ω) : FacePartition Ω := + P ⊓ Q + +theorem join_le_left (P Q : FacePartition Ω) : + join P Q ≤ P := + inf_le_left + +theorem join_le_right (P Q : FacePartition Ω) : + join P Q ≤ Q := + inf_le_right + +theorem le_join_iff {P Q R : FacePartition Ω} : + R ≤ join P Q ↔ R ≤ P ∧ R ≤ Q := + le_inf_iff + +@[simp] +theorem part_join (P Q : FacePartition Ω) (x : Ω) : + (join P Q).part x = P.part x ∩ Q.part x := by + apply Finpartition.part_eq_of_mem + · rw [join, Finpartition.parts_inf] + apply Finset.mem_erase.mpr + constructor + · exact Finset.nonempty_iff_ne_empty.mp ⟨x, by simp⟩ + · apply Finset.mem_image.mpr + refine ⟨(P.part x, Q.part x), ?_, rfl⟩ + simp + · simp + +theorem complexity_join_le (P Q : FacePartition Ω) : + complexity (join P Q) ≤ complexity P * complexity Q := by + change (P ⊓ Q).parts.card ≤ P.parts.card * Q.parts.card + calc + (P ⊓ Q).parts.card = + (((P.parts ×ˢ Q.parts).image + (fun st => st.1 ⊓ st.2)).erase ⊥).card := + congrArg Finset.card (Finpartition.parts_inf P Q) + _ ≤ + ((P.parts ×ˢ Q.parts).image + (fun st => st.1 ⊓ st.2)).card := + Finset.card_le_card (Finset.erase_subset _ _) + _ ≤ (P.parts ×ˢ Q.parts).card := + Finset.card_image_le + _ = P.parts.card * Q.parts.card := + Finset.card_product P.parts Q.parts + +def joinFinset {ι : Type*} [DecidableEq ι] + (s : Finset ι) (P : ι → FacePartition Ω) : + FacePartition Ω := + s.inf P + +@[simp] +theorem joinFinset_empty {ι : Type*} [DecidableEq ι] + (P : ι → FacePartition Ω) : + joinFinset ∅ P = indiscrete := + rfl + +@[simp] +theorem joinFinset_insert {ι : Type*} [DecidableEq ι] + (a : ι) (s : Finset ι) (P : ι → FacePartition Ω) : + joinFinset (insert a s) P = + join (P a) (joinFinset s P) := by + simp [joinFinset, join] + +theorem joinFinset_le_of_mem {ι : Type*} [DecidableEq ι] + {s : Finset ι} (P : ι → FacePartition Ω) + {i : ι} (hi : i ∈ s) : + joinFinset s P ≤ P i := + Finset.inf_le hi + +theorem le_joinFinset_iff {ι : Type*} [DecidableEq ι] + {s : Finset ι} {P : ι → FacePartition Ω} + {Q : FacePartition Ω} : + Q ≤ joinFinset s P ↔ ∀ i ∈ s, Q ≤ P i := + Finset.le_inf_iff + +theorem mem_part_joinFinset_iff {ι : Type*} [DecidableEq ι] + (s : Finset ι) (P : ι → FacePartition Ω) + (x y : Ω) : + y ∈ (joinFinset s P).part x ↔ + ∀ i ∈ s, y ∈ (P i).part x := by + classical + induction s using Finset.induction with + | empty => + rw [joinFinset_empty] + simp + | @insert a s ha ih => + simp only [joinFinset_insert, part_join, + Finset.mem_inter, Finset.mem_insert, forall_eq_or_imp, + ih] + +theorem complexity_joinFinset_le [Nonempty Ω] + {ι : Type*} [DecidableEq ι] + (s : Finset ι) (P : ι → FacePartition Ω) : + complexity (joinFinset s P) ≤ + ∏ i ∈ s, complexity (P i) := by + classical + induction s using Finset.induction with + | empty => + change complexity (indiscrete : FacePartition Ω) ≤ 1 + simp + | @insert a s ha ih => + calc + complexity (joinFinset (insert a s) P) ≤ + complexity (P a) * + complexity (joinFinset s P) := by + rw [joinFinset_insert] + exact complexity_join_le _ _ + _ ≤ + complexity (P a) * + (∏ i ∈ s, complexity (P i)) := + Nat.mul_le_mul_left _ ih + _ = ∏ i ∈ insert a s, complexity (P i) := by + simp [ha] + +def generatedBy (F : Finset (Finset Ω)) : FacePartition Ω := + Finpartition.atomise Finset.univ F + +@[simp] +theorem mem_part_generatedBy_iff (F : Finset (Finset Ω)) + (x y : Ω) : + y ∈ (generatedBy F).part x ↔ + ∀ s ∈ F, (x ∈ s ↔ y ∈ s) := by + classical + let P : FacePartition Ω := generatedBy F + have hp : P.part x ∈ P.parts := + P.part_mem.2 (Finset.mem_univ x) + have hpAtom : + P.part x ∈ + (Finpartition.atomise + (Finset.univ : Finset Ω) F).parts := by + change + (Finpartition.atomise + (Finset.univ : Finset Ω) F).part x ∈ + (Finpartition.atomise + (Finset.univ : Finset Ω) F).parts at hp + exact hp + obtain ⟨_, Q, hQ, hpart⟩ := + Finpartition.mem_atomise.mp hpAtom + have hmem := Finset.ext_iff.mp hpart + have hx : x ∈ P.part x := + P.mem_part (Finset.mem_univ x) + have hxAtom := (hmem x).2 hx + simp only [Finset.mem_filter] at hxAtom + constructor + · intro hy s hs + have hyAtom := (hmem y).2 hy + simp only [Finset.mem_filter] at hyAtom + exact (hxAtom.2 s hs).symm.trans (hyAtom.2 s hs) + · intro hsignature + apply (hmem y).1 + simp only [Finset.mem_filter] + refine ⟨Finset.mem_univ y, ?_⟩ + intro s hs + exact (hxAtom.2 s hs).trans (hsignature s hs) + +theorem generatedBy_antitone {F G : Finset (Finset Ω)} + (hFG : F ⊆ G) : + generatedBy G ≤ generatedBy F := by + rw [le_iff_part_subset] + intro x y hy + rw [mem_part_generatedBy_iff] at hy ⊢ + intro s hs + exact hy s (hFG hs) + +theorem complexity_generatedBy_le (F : Finset (Finset Ω)) : + complexity (generatedBy F) ≤ 2 ^ F.card := by + exact Finpartition.card_atomise_le + +@[simp] +theorem generatedBy_empty : + generatedBy (∅ : Finset (Finset Ω)) = + indiscrete := by + apply ext_of_part_eq + intro x + ext y + simp [mem_part_generatedBy_iff, part_indiscrete] + +theorem generatedBy_union + (F G : Finset (Finset Ω)) : + generatedBy (F ∪ G) = + join (generatedBy F) (generatedBy G) := by + apply ext_of_part_eq + intro x + ext y + simp only [part_join, Finset.mem_inter, + mem_part_generatedBy_iff] + simp only [Finset.mem_union] + constructor + · intro h + constructor + · intro s hs + exact h s (Or.inl hs) + · intro s hs + exact h s (Or.inr hs) + · rintro ⟨hF, hG⟩ s (hs | hs) + · exact hF s hs + · exact hG s hs + +theorem generatedBy_insert + (A : Finset Ω) (F : Finset (Finset Ω)) : + generatedBy (insert A F) = + join (generatedBy F) + (generatedBy ({A} : Finset (Finset Ω))) := by + rw [show insert A F = F ∪ {A} by + ext s + simp] + exact generatedBy_union F {A} + +abbrev atomSetoid (P : FacePartition Ω) : Setoid Ω := + Setoid.ker P.part + +@[simp] +theorem atomSetoid_rel (P : FacePartition Ω) (x y : Ω) : + atomSetoid P x y ↔ P.part x = P.part y := + Iff.rfl + +def pullbackSetoid {Λ : Type*} [Fintype Λ] [DecidableEq Λ] + (f : Ω → Λ) (Q : FacePartition Λ) : Setoid Ω where + r x y := Q.part (f x) = Q.part (f y) + iseqv := { + refl := fun _ => rfl + symm := fun h => h.symm + trans := fun h₁ h₂ => h₁.trans h₂ } + +instance instDecidableRelPullbackSetoid {Λ : Type*} + [Fintype Λ] [DecidableEq Λ] + (f : Ω → Λ) (Q : FacePartition Λ) : + DecidableRel (pullbackSetoid f Q) := by + intro x y + change Decidable (Q.part (f x) = Q.part (f y)) + infer_instance + +def pullback {Λ : Type*} [Fintype Λ] [DecidableEq Λ] + (f : Ω → Λ) (Q : FacePartition Λ) : FacePartition Ω := + Finpartition.ofSetoid (pullbackSetoid f Q) + +@[simp] +theorem mem_part_pullback_iff {Λ : Type*} + [Fintype Λ] [DecidableEq Λ] + (f : Ω → Λ) (Q : FacePartition Λ) (x y : Ω) : + y ∈ (pullback f Q).part x ↔ + Q.part (f x) = Q.part (f y) := by + change + y ∈ + (Finpartition.ofSetoid + (pullbackSetoid f Q)).part x ↔ + Q.part (f x) = Q.part (f y) + rw [Finpartition.mem_part_ofSetoid_iff_rel] + rfl + +theorem mem_part_pullback_iff_image_mem {Λ : Type*} + [Fintype Λ] [DecidableEq Λ] + (f : Ω → Λ) (Q : FacePartition Λ) (x y : Ω) : + y ∈ (pullback f Q).part x ↔ + f y ∈ Q.part (f x) := by + rw [mem_part_pullback_iff] + constructor + · intro h + exact + (Q.mem_part_iff_part_eq_part + (Finset.mem_univ (f y)) + (Finset.mem_univ (f x))).2 h.symm + · intro h + exact + ((Q.mem_part_iff_part_eq_part + (Finset.mem_univ (f y)) + (Finset.mem_univ (f x))).1 h).symm + +theorem part_pullback_eq_filter {Λ : Type*} + [Fintype Λ] [DecidableEq Λ] + (f : Ω → Λ) (Q : FacePartition Λ) (x : Ω) : + (pullback f Q).part x = + Finset.univ.filter (fun y => f y ∈ Q.part (f x)) := by + ext y + rw [Finset.mem_filter] + simp only [Finset.mem_univ, true_and] + exact mem_part_pullback_iff_image_mem f Q x y + +theorem pullback_mono {Λ : Type*} + [Fintype Λ] [DecidableEq Λ] + (f : Ω → Λ) {P Q : FacePartition Λ} + (h : P ≤ Q) : + pullback f P ≤ pullback f Q := by + rw [le_iff_part_subset] + intro x y hy + rw [mem_part_pullback_iff_image_mem] at hy ⊢ + exact part_subset_of_le h (f x) hy + +@[simp] +theorem pullback_id (P : FacePartition Ω) : + pullback id P = P := by + apply ext_of_part_eq + intro x + ext y + simp only [mem_part_pullback_iff_image_mem, id_eq] + +theorem pullback_comp {Λ Γ : Type*} + [Fintype Λ] [DecidableEq Λ] + [Fintype Γ] [DecidableEq Γ] + (f : Ω → Λ) (g : Γ → Ω) (Q : FacePartition Λ) : + pullback g (pullback f Q) = + pullback (f ∘ g) Q := by + apply ext_of_part_eq + intro x + ext y + simp only [mem_part_pullback_iff_image_mem, + Function.comp_apply] + +theorem complexity_pullback_le {Λ : Type*} + [Fintype Λ] [DecidableEq Λ] + (f : Ω → Λ) (Q : FacePartition Λ) : + complexity (pullback f Q) ≤ complexity Q := by + classical + let R : FacePartition Ω := pullback f Q + let representative : R.parts → Ω := fun s => + Classical.choose (R.nonempty_of_mem_parts s.2) + have representative_mem (s : R.parts) : + representative s ∈ s.1 := + Classical.choose_spec (R.nonempty_of_mem_parts s.2) + let atomMap : R.parts → Q.parts := fun s => + ⟨Q.part (f (representative s)), + Q.part_mem.2 (Finset.mem_univ _)⟩ + have atomMap_injective : Function.Injective atomMap := by + intro s t hst + apply Subtype.ext + have htarget := + congrArg (fun u : Q.parts => u.1) hst + change + Q.part (f (representative s)) = + Q.part (f (representative t)) at htarget + have htInPart : + representative t ∈ R.part (representative s) := by + change + representative t ∈ + (pullback f Q).part (representative s) + exact + (mem_part_pullback_iff f Q + (representative s) (representative t)).2 htarget + have htInS : representative t ∈ s.1 := by + rw [← R.part_eq_of_mem s.2 (representative_mem s)] + exact htInPart + exact + R.eq_of_mem_parts s.2 t.2 htInS + (representative_mem t) + have hcard := + Fintype.card_le_of_injective atomMap atomMap_injective + simpa only [complexity, R, Fintype.card_coe] using hcard + +end FacePartition + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +variable {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + +theorem sum_conditionalMean_on_coarser_part + (P Q : FacePartition Ω) (hPQ : P ≤ Q) + (f : Ω → ℝ) {s : Finset Ω} (hs : s ∈ Q.parts) : + ∑ x ∈ s, conditionalMean P f x = ∑ x ∈ s, f x := by + let fineParts : Finset (Finset Ω) := + P.parts.filter (fun t => t ⊆ s) + have hUnion : fineParts.biUnion id = s := by + ext x + constructor + · intro hx + obtain ⟨t, ht, hxt⟩ := Finset.mem_biUnion.mp hx + exact (Finset.mem_filter.mp ht).2 hxt + · intro hxs + obtain ⟨t, ht, hxt⟩ := + P.exists_mem (Finset.mem_univ x) + obtain ⟨u, hu, htu⟩ := hPQ ht + have hus : u = s := + Q.eq_of_mem_parts hu hs (htu hxt) hxs + have hts : t ⊆ s := by + simpa [hus] using htu + exact Finset.mem_biUnion.mpr + ⟨t, Finset.mem_filter.mpr ⟨ht, hts⟩, hxt⟩ + have hdisjoint : + (↑fineParts : Set (Finset Ω)).PairwiseDisjoint id := by + apply Set.Pairwise.mono ?_ P.disjoint + intro t ht + exact (Finset.mem_filter.mp ht).1 + calc + ∑ x ∈ s, conditionalMean P f x = + ∑ x ∈ fineParts.biUnion id, + conditionalMean P f x := by + exact Finset.sum_congr hUnion.symm fun _ _ => rfl + _ = + ∑ t ∈ fineParts, + ∑ x ∈ t, conditionalMean P f x := + Finset.sum_biUnion hdisjoint + _ = ∑ t ∈ fineParts, ∑ x ∈ t, f x := by + apply Finset.sum_congr rfl + intro t ht + exact sum_conditionalMean_on_part P f + (Finset.mem_filter.mp ht).1 + _ = ∑ x ∈ fineParts.biUnion id, f x := + (Finset.sum_biUnion hdisjoint).symm + _ = ∑ x ∈ s, f x := by + exact Finset.sum_congr hUnion fun _ _ => rfl + +@[simp] +theorem conditionalMean_tower_of_le + (P Q : FacePartition Ω) (hPQ : P ≤ Q) + (f : Ω → ℝ) (x : Ω) : + conditionalMean Q (conditionalMean P f) x = + conditionalMean Q f x := by + change + Finset.expect (Q.part x) (conditionalMean P f) = + Finset.expect (Q.part x) f + rw [Finset.expect_eq_sum_div_card, + Finset.expect_eq_sum_div_card, + sum_conditionalMean_on_coarser_part P Q hPQ f + (Q.part_mem.2 (Finset.mem_univ x))] + +@[simp] +theorem conditionalMean_reverse_tower_of_le + (P Q : FacePartition Ω) (hPQ : P ≤ Q) + (f : Ω → ℝ) (x : Ω) : + conditionalMean P (conditionalMean Q f) x = + conditionalMean Q f x := by + rw [conditionalMean] + calc + Finset.expect (P.part x) (conditionalMean Q f) = + Finset.expect (P.part x) + (fun _ => conditionalMean Q f x) := by + apply Finset.expect_congr rfl + intro y hy + exact conditionalMean_eq_of_mem_part Q f + (FacePartition.part_subset_of_le hPQ x hy) + _ = conditionalMean Q f x := + Finset.expect_const (by simp) _ + +theorem conditionalMean_mul_right_of_constant_on_part + (P : FacePartition Ω) (u v : Ω → ℝ) (x : Ω) + (hv : ∀ y ∈ P.part x, v y = v x) : + conditionalMean P (fun y => u y * v y) x = + conditionalMean P u x * v x := by + calc + conditionalMean P (fun y => u y * v y) x = + conditionalMean P (fun y => v x * u y) x := by + rw [conditionalMean, conditionalMean] + apply Finset.expect_congr rfl + intro y hy + rw [hv y hy] + ring + _ = v x * conditionalMean P u x := + conditionalMean_smul P (v x) u x + _ = conditionalMean P u x * v x := by + ring + +theorem conditionalMean_mul_conditionalMean_right + (P : FacePartition Ω) (u v : Ω → ℝ) (x : Ω) : + conditionalMean P + (fun y => u y * conditionalMean P v y) x = + conditionalMean P u x * conditionalMean P v x := by + apply conditionalMean_mul_right_of_constant_on_part + intro y hy + exact conditionalMean_eq_of_mem_part P v hy + +theorem mean_conditionalMean_mul_eq_sq_of_le + (P Q : FacePartition Ω) (hPQ : P ≤ Q) + (f : Ω → ℝ) : + mean (fun x => + conditionalMean P f x * conditionalMean Q f x) = + mean (fun x => conditionalMean Q f x ^ 2) := by + calc + mean (fun x => + conditionalMean P f x * conditionalMean Q f x) = + mean (conditionalMean Q (fun x => + conditionalMean P f x * conditionalMean Q f x)) := + (mean_conditionalMean Q _).symm + _ = + mean (fun x => + conditionalMean Q (conditionalMean P f) x * + conditionalMean Q f x) := by + apply congrArg mean + funext x + exact conditionalMean_mul_conditionalMean_right + Q (conditionalMean P f) f x + _ = + mean (fun x => + conditionalMean Q f x * conditionalMean Q f x) := by + apply congrArg mean + funext x + rw [conditionalMean_tower_of_le P Q hPQ] + _ = mean (fun x => conditionalMean Q f x ^ 2) := by + apply congrArg mean + funext x + rw [pow_two] + +theorem partitionEnergy_pythagorean + (P Q : FacePartition Ω) (hPQ : P ≤ Q) + (f : Ω → ℝ) : + partitionEnergy P f = + partitionEnergy Q f + + mean (fun x => + (conditionalMean P f x - + conditionalMean Q f x) ^ 2) := by + have hcross := + mean_conditionalMean_mul_eq_sq_of_le P Q hPQ f + have hdiff : + mean (fun x => + (conditionalMean P f x - + conditionalMean Q f x) ^ 2) = + mean (fun x => conditionalMean P f x ^ 2) - + 2 * mean (fun x => + conditionalMean P f x * conditionalMean Q f x) + + mean (fun x => conditionalMean Q f x ^ 2) := by + calc + mean (fun x => + (conditionalMean P f x - + conditionalMean Q f x) ^ 2) = + mean (fun x => + conditionalMean P f x ^ 2 - + 2 * (conditionalMean P f x * + conditionalMean Q f x) + + conditionalMean Q f x ^ 2) := by + apply congrArg mean + funext x + ring + _ = + mean (fun x => conditionalMean P f x ^ 2) - + 2 * mean (fun x => + conditionalMean P f x * conditionalMean Q f x) + + mean (fun x => conditionalMean Q f x ^ 2) := by + rw [mean_add, mean_sub, mean_smul] + change + mean (fun x => conditionalMean P f x ^ 2) = + mean (fun x => conditionalMean Q f x ^ 2) + + mean (fun x => + (conditionalMean P f x - + conditionalMean Q f x) ^ 2) + rw [hdiff, hcross] + ring + +theorem partitionEnergy_sub_eq_mean_sq + (P Q : FacePartition Ω) (hPQ : P ≤ Q) + (f : Ω → ℝ) : + partitionEnergy P f - partitionEnergy Q f = + mean (fun x => + (conditionalMean P f x - + conditionalMean Q f x) ^ 2) := by + rw [partitionEnergy_pythagorean P Q hPQ f] + ring + +theorem partitionEnergy_mono + (P Q : FacePartition Ω) (hPQ : P ≤ Q) + (f : Ω → ℝ) : + partitionEnergy Q f ≤ partitionEnergy P f := by + rw [partitionEnergy_pythagorean P Q hPQ f] + exact le_add_of_nonneg_right + (mean_nonneg fun x => sq_nonneg _) + +theorem partitionEnergy_mem_Icc [Nonempty Ω] + (P : FacePartition Ω) {f : Ω → ℝ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) : + partitionEnergy P f ∈ Set.Icc (0 : ℝ) 1 := + ⟨partitionEnergy_nonneg P f, + partitionEnergy_le_one P hf0 hf1⟩ + +theorem partitionEnergy_refinement_bounds [Nonempty Ω] + (P Q : FacePartition Ω) (hPQ : P ≤ Q) + {f : Ω → ℝ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) : + 0 ≤ partitionEnergy Q f ∧ + partitionEnergy Q f ≤ partitionEnergy P f ∧ + partitionEnergy P f ≤ 1 := + ⟨partitionEnergy_nonneg Q f, + partitionEnergy_mono P Q hPQ f, + partitionEnergy_le_one P hf0 hf1⟩ + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/GeneratorCells.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/GeneratorCells.lean new file mode 100644 index 0000000000000000000000000000000000000000..bcba60e483c3d99953d6936b0845278d44c9322d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/GeneratorCells.lean @@ -0,0 +1,1304 @@ +import OAI.Combinatorics.Progressions.FixedDensity.BooleanCutReduction + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +variable {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + +abbrev BooleanCutTest (Ω : Type*) [DecidableEq Ω] := + Finset Ω + +namespace BooleanCutTest + +def eval (A : BooleanCutTest Ω) : Ω → ℝ := + finsetIndicator A + +omit [Fintype Ω] in +@[simp] +theorem eval_of_mem (A : BooleanCutTest Ω) {x : Ω} (hx : x ∈ A) : + A.eval x = 1 := + finsetIndicator_of_mem hx + +omit [Fintype Ω] in +@[simp] +theorem eval_of_not_mem (A : BooleanCutTest Ω) {x : Ω} (hx : x ∉ A) : + A.eval x = 0 := + finsetIndicator_of_not_mem hx + +omit [Fintype Ω] in +theorem eval_sq (A : BooleanCutTest Ω) (x : Ω) : + A.eval x ^ 2 = A.eval x := by + by_cases hx : x ∈ A <;> simp [hx] + +omit [Fintype Ω] in +theorem eval_nonneg (A : BooleanCutTest Ω) (x : Ω) : + 0 ≤ A.eval x := by + by_cases hx : x ∈ A <;> simp [hx] + +omit [Fintype Ω] in +theorem eval_le_one (A : BooleanCutTest Ω) (x : Ω) : + A.eval x ≤ 1 := by + by_cases hx : x ∈ A <;> simp [hx] + +end BooleanCutTest + +def IsPartitionMeasurable (P : FacePartition Ω) (g : Ω → ℝ) : Prop := + ∀ x y, y ∈ P.part x → g y = g x + +namespace IsPartitionMeasurable + +theorem of_le {P Q : FacePartition Ω} {g : Ω → ℝ} + (hPQ : P ≤ Q) (hg : IsPartitionMeasurable Q g) : + IsPartitionMeasurable P g := by + intro x y hy + exact hg x y (FacePartition.part_subset_of_le hPQ x hy) + +theorem conditionalMean_eq {P : FacePartition Ω} {g : Ω → ℝ} + (hg : IsPartitionMeasurable P g) (x : Ω) : + conditionalMean P g x = g x := by + rw [conditionalMean] + calc + Finset.expect (P.part x) g = + Finset.expect (P.part x) (fun _ => g x) := by + apply Finset.expect_congr rfl + intro y hy + exact hg x y hy + _ = g x := Finset.expect_const (by simp) _ + +theorem conditionalMean (P : FacePartition Ω) (f : Ω → ℝ) : + IsPartitionMeasurable P (conditionalMean P f) := by + intro x y hy + exact conditionalMean_eq_of_mem_part P f hy + +end IsPartitionMeasurable + +theorem booleanCut_measurable_generatedBy (A : BooleanCutTest Ω) : + IsPartitionMeasurable + (FacePartition.generatedBy ({A} : Finset (Finset Ω))) A.eval := by + intro x y hy + have hxy : x ∈ A ↔ y ∈ A := by + have hsignature := + (FacePartition.mem_part_generatedBy_iff + ({A} : Finset (Finset Ω)) x y).1 hy + exact hsignature A (by simp) + by_cases hx : x ∈ A + · have hyA : y ∈ A := hxy.mp hx + simp [hx, hyA] + · have hyA : y ∉ A := by + intro hy + exact hx (hxy.mpr hy) + simp [hx, hyA] + +structure FaceRegularityState (Ω : Type*) [Fintype Ω] [DecidableEq Ω] where + partition : FacePartition Ω + +abbrev FaceRegularitySystem + (ι : Type*) (face : ι → Type*) + [∀ i, Fintype (face i)] [∀ i, DecidableEq (face i)] := + ∀ i, FaceRegularityState (face i) + +namespace FaceRegularityState + +noncomputable def structured (S : FaceRegularityState Ω) + (f : Ω → ℝ) : Ω → ℝ := + conditionalMean S.partition f + +noncomputable def residual (S : FaceRegularityState Ω) + (f : Ω → ℝ) : Ω → ℝ := + fun x => f x - S.structured f x + +noncomputable def energy (S : FaceRegularityState Ω) + (f : Ω → ℝ) : ℝ := + partitionEnergy S.partition f + +noncomputable def booleanCutCorrelation + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (A : BooleanCutTest Ω) : ℝ := + mean fun x => S.residual f x * A.eval x + +def refineBy (S : FaceRegularityState Ω) + (A : BooleanCutTest Ω) : FaceRegularityState Ω where + partition := + FacePartition.join S.partition + (FacePartition.generatedBy ({A} : Finset (Finset Ω))) + +@[simp] +theorem partition_refineBy (S : FaceRegularityState Ω) + (A : BooleanCutTest Ω) : + (S.refineBy A).partition = + FacePartition.join S.partition + (FacePartition.generatedBy ({A} : Finset (Finset Ω))) := + rfl + +theorem refineBy_le (S : FaceRegularityState Ω) + (A : BooleanCutTest Ω) : + (S.refineBy A).partition ≤ S.partition := + FacePartition.join_le_left _ _ + +theorem booleanCut_measurable_refineBy (S : FaceRegularityState Ω) + (A : BooleanCutTest Ω) : + IsPartitionMeasurable (S.refineBy A).partition A.eval := by + apply IsPartitionMeasurable.of_le + (FacePartition.join_le_right S.partition + (FacePartition.generatedBy ({A} : Finset (Finset Ω)))) + exact booleanCut_measurable_generatedBy A + +theorem complexity_refineBy_le (S : FaceRegularityState Ω) + (A : BooleanCutTest Ω) : + FacePartition.complexity (S.refineBy A).partition ≤ + 2 * FacePartition.complexity S.partition := by + have hgenerated : + FacePartition.complexity + (FacePartition.generatedBy ({A} : Finset (Finset Ω))) ≤ 2 := by + simpa using + FacePartition.complexity_generatedBy_le + ({A} : Finset (Finset Ω)) + calc + FacePartition.complexity (S.refineBy A).partition ≤ + FacePartition.complexity S.partition * + FacePartition.complexity + (FacePartition.generatedBy + ({A} : Finset (Finset Ω))) := + FacePartition.complexity_join_le _ _ + _ ≤ FacePartition.complexity S.partition * 2 := + Nat.mul_le_mul_left _ hgenerated + _ = 2 * FacePartition.complexity S.partition := by + omega + +theorem structured_nonneg (S : FaceRegularityState Ω) + {f : Ω → ℝ} (hf : ∀ x, 0 ≤ f x) (x : Ω) : + 0 ≤ S.structured f x := + conditionalMean_nonneg S.partition hf x + +theorem structured_le_one (S : FaceRegularityState Ω) + {f : Ω → ℝ} (hf : ∀ x, f x ≤ 1) (x : Ω) : + S.structured f x ≤ 1 := + conditionalMean_le_one S.partition hf x + +@[simp] +theorem conditionalMean_residual (S : FaceRegularityState Ω) + (f : Ω → ℝ) (x : Ω) : + conditionalMean S.partition (S.residual f) x = 0 := by + change + conditionalMean S.partition + (fun y => f y - conditionalMean S.partition f y) x = 0 + rw [conditionalMean_sub] + rw [conditionalMean_idem] + ring + +@[simp] +theorem mean_residual (S : FaceRegularityState Ω) (f : Ω → ℝ) : + mean (S.residual f) = 0 := by + change + mean (fun x => f x - conditionalMean S.partition f x) = 0 + rw [mean_sub] + rw [mean_conditionalMean] + ring + +theorem conditionalMean_residual_refineBy + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (A : BooleanCutTest Ω) (x : Ω) : + conditionalMean (S.refineBy A).partition (S.residual f) x = + (S.refineBy A).structured f x - S.structured f x := by + change + conditionalMean (S.refineBy A).partition + (fun y => f y - conditionalMean S.partition f y) x = + conditionalMean (S.refineBy A).partition f x - + conditionalMean S.partition f x + rw [conditionalMean_sub] + rw [conditionalMean_reverse_tower_of_le + (S.refineBy A).partition S.partition (S.refineBy_le A)] + +theorem mean_mul_eq_mean_conditionalMean_mul + (P : FacePartition Ω) (u v : Ω → ℝ) + (hv : IsPartitionMeasurable P v) : + mean (fun x => u x * v x) = + mean (fun x => conditionalMean P u x * v x) := by + calc + mean (fun x => u x * v x) = + mean (conditionalMean P (fun x => u x * v x)) := + (mean_conditionalMean P _).symm + _ = mean (fun x => conditionalMean P u x * v x) := by + apply congrArg mean + funext x + exact conditionalMean_mul_right_of_constant_on_part + P u v x (hv x) + +theorem booleanCutCorrelation_eq_projection + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (A : BooleanCutTest Ω) : + S.booleanCutCorrelation f A = + mean (fun x => + ((S.refineBy A).structured f x - S.structured f x) * + A.eval x) := by + rw [booleanCutCorrelation] + calc + mean (fun x => S.residual f x * A.eval x) = + mean (fun x => + conditionalMean (S.refineBy A).partition (S.residual f) x * + A.eval x) := + mean_mul_eq_mean_conditionalMean_mul + (S.refineBy A).partition (S.residual f) A.eval + (S.booleanCut_measurable_refineBy A) + _ = mean (fun x => + ((S.refineBy A).structured f x - S.structured f x) * + A.eval x) := by + apply congrArg mean + funext x + rw [S.conditionalMean_residual_refineBy f A x] + +omit [DecidableEq Ω] in + +theorem mean_mul_sq_le_sq_mul_sq (u v : Ω → ℝ) : + mean (fun x => u x * v x) ^ 2 ≤ + mean (fun x => u x ^ 2) * mean (fun x => v x ^ 2) := by + simpa [mean] using + (Finset.expect_mul_sq_le_sq_mul_sq + (Finset.univ : Finset Ω) u v) + +theorem mean_booleanCut_sq_le_one [Nonempty Ω] + (A : BooleanCutTest Ω) : + mean (fun x => A.eval x ^ 2) ≤ 1 := by + apply mean_le_of_le_const + intro x + rw [A.eval_sq x] + exact A.eval_le_one x + +theorem energy_refineBy_sub_eq_mean_sq + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (A : BooleanCutTest Ω) : + (S.refineBy A).energy f - S.energy f = + mean (fun x => + ((S.refineBy A).structured f x - S.structured f x) ^ 2) := by + simpa [energy, structured] using + partitionEnergy_sub_eq_mean_sq + (S.refineBy A).partition S.partition (S.refineBy_le A) f + +theorem booleanCutCorrelation_sq_le_energyIncrement [Nonempty Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (A : BooleanCutTest Ω) : + S.booleanCutCorrelation f A ^ 2 ≤ + (S.refineBy A).energy f - S.energy f := by + rw [S.booleanCutCorrelation_eq_projection f A] + let d : Ω → ℝ := + fun x => (S.refineBy A).structured f x - S.structured f x + have hcs : + mean (fun x => d x * A.eval x) ^ 2 ≤ + mean (fun x => d x ^ 2) * + mean (fun x => A.eval x ^ 2) := + mean_mul_sq_le_sq_mul_sq d A.eval + have hd : 0 ≤ mean (fun x => d x ^ 2) := + mean_nonneg fun x => sq_nonneg _ + have hA := mean_booleanCut_sq_le_one A + calc + mean (fun x => + ((S.refineBy A).structured f x - S.structured f x) * + A.eval x) ^ 2 = + mean (fun x => d x * A.eval x) ^ 2 := rfl + _ ≤ mean (fun x => d x ^ 2) * + mean (fun x => A.eval x ^ 2) := hcs + _ ≤ mean (fun x => d x ^ 2) := by + nlinarith + _ = (S.refineBy A).energy f - S.energy f := by + exact (S.energy_refineBy_sub_eq_mean_sq f A).symm + +theorem energy_increment_of_booleanCut [Nonempty Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (A : BooleanCutTest Ω) {ε : ℝ} + (hε : 0 ≤ ε) + (hcorrelation : ε ≤ |S.booleanCutCorrelation f A|) : + S.energy f + ε ^ 2 ≤ (S.refineBy A).energy f := by + have hsquare : + ε ^ 2 ≤ S.booleanCutCorrelation f A ^ 2 := by + rw [sq_le_sq] + simpa [abs_of_nonneg hε] using hcorrelation + have hincrement := + S.booleanCutCorrelation_sq_le_energyIncrement f A + linarith + +def IsRegularAgainst (S : FaceRegularityState Ω) + (f : Ω → ℝ) (cuts : Finset (BooleanCutTest Ω)) + (ε : ℝ) : Prop := + ∀ A ∈ cuts, |S.booleanCutCorrelation f A| ≤ ε + +theorem exists_booleanCut_of_not_regular + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) {ε : ℝ} + (h : ¬ S.IsRegularAgainst f cuts ε) : + ∃ A ∈ cuts, ε < |S.booleanCutCorrelation f A| := by + classical + by_contra hnone + apply h + intro A hA + by_contra hle + apply hnone + exact ⟨A, hA, lt_of_not_ge hle⟩ + +theorem energy_increment_budget [Nonempty Ω] + (states : ℕ → FaceRegularityState Ω) + (f : Ω → ℝ) {ε : ℝ} {m : ℕ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hgain : ∀ i, i < m → + (states i).energy f + ε ^ 2 ≤ (states (i + 1)).energy f) : + (m : ℝ) * ε ^ 2 ≤ 1 := by + have growth : + ∀ n : ℕ, + (∀ i, i < n → + (states i).energy f + ε ^ 2 ≤ + (states (i + 1)).energy f) → + (states 0).energy f + (n : ℝ) * ε ^ 2 ≤ + (states n).energy f := by + intro n + induction n with + | zero => + intro _ + simp + | succ n ih => + intro hn + have hprevious := ih (fun i hi => + hn i (Nat.lt_trans hi (Nat.lt_succ_self n))) + have hstep := hn n (Nat.lt_succ_self n) + calc + (states 0).energy f + (↑(Nat.succ n) : ℝ) * ε ^ 2 = + ((states 0).energy f + (n : ℝ) * ε ^ 2) + + ε ^ 2 := by + push_cast + ring + _ ≤ (states n).energy f + ε ^ 2 := + by linarith + _ ≤ (states (Nat.succ n)).energy f := by + simpa [Nat.succ_eq_add_one] using hstep + have hgrowth := growth m hgain + have hnonneg : + 0 ≤ (states 0).energy f := + partitionEnergy_nonneg (states 0).partition f + have hupper : + (states m).energy f ≤ 1 := + partitionEnergy_le_one (states m).partition hf0 hf1 + linarith + +theorem no_long_energy_increment_run [Nonempty Ω] + (states : ℕ → FaceRegularityState Ω) + (f : Ω → ℝ) {ε : ℝ} {m : ℕ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hlong : 1 < (m : ℝ) * ε ^ 2) + (hgain : ∀ i, i < m → + (states i).energy f + ε ^ 2 ≤ + (states (i + 1)).energy f) : + False := by + have hbudget := + energy_increment_budget states f hf0 hf1 hgain + linarith + +theorem exists_regular_state_in_refinement_run [Nonempty Ω] + (states : ℕ → FaceRegularityState Ω) + (witness : ℕ → BooleanCutTest Ω) + (f : Ω → ℝ) (cuts : Finset (BooleanCutTest Ω)) + {ε : ℝ} {m : ℕ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hε : 0 ≤ ε) + (hlong : 1 < (m : ℝ) * ε ^ 2) + (hrefine : ∀ i, i < m → + states (i + 1) = (states i).refineBy (witness i)) + (hchoose : ∀ i, i < m → + ¬(states i).IsRegularAgainst f cuts ε → + witness i ∈ cuts ∧ + ε ≤ |(states i).booleanCutCorrelation f (witness i)|) : + ∃ i, i < m ∧ (states i).IsRegularAgainst f cuts ε := by + by_contra hregular + have hnotregular : + ∀ i, i < m → + ¬(states i).IsRegularAgainst f cuts ε := by + intro i hi hisRegular + exact hregular ⟨i, hi, hisRegular⟩ + have hgain : + ∀ i, i < m → + (states i).energy f + ε ^ 2 ≤ + (states (i + 1)).energy f := by + intro i hi + have hcorrelation := + (hchoose i hi (hnotregular i hi)).2 + have hincrement := + (states i).energy_increment_of_booleanCut + f (witness i) hε hcorrelation + rw [hrefine i hi] + exact hincrement + exact no_long_energy_increment_run + states f hf0 hf1 hlong hgain + +noncomputable def chosenIrregularCut + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : + BooleanCutTest Ω := by + classical + exact + if h : S.IsRegularAgainst f cuts ε then ∅ + else + Classical.choose + (S.exists_booleanCut_of_not_regular f cuts h) + +theorem chosenIrregularCut_mem + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (h : ¬S.IsRegularAgainst f cuts ε) : + S.chosenIrregularCut f cuts ε ∈ cuts := by + simp only [chosenIrregularCut, dite_eq_right h] + exact + (Classical.choose_spec + (S.exists_booleanCut_of_not_regular f cuts h)).1 + +theorem chosenIrregularCut_correlation + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (h : ¬S.IsRegularAgainst f cuts ε) : + ε < + |S.booleanCutCorrelation f + (S.chosenIrregularCut f cuts ε)| := by + simp only [chosenIrregularCut, dite_eq_right h] + exact + (Classical.choose_spec + (S.exists_booleanCut_of_not_regular f cuts h)).2 + +noncomputable def regularityRun + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : + ℕ → FaceRegularityState Ω + | 0 => S + | n + 1 => + let T := regularityRun S f cuts ε n + T.refineBy (T.chosenIrregularCut f cuts ε) + +@[simp] +theorem regularityRun_zero + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : + S.regularityRun f cuts ε 0 = S := + rfl + +@[simp] +theorem regularityRun_succ + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (n : ℕ) : + S.regularityRun f cuts ε (n + 1) = + (S.regularityRun f cuts ε n).refineBy + ((S.regularityRun f cuts ε n).chosenIrregularCut + f cuts ε) := + rfl + +theorem regularityRun_partition_le + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (n : ℕ) : + (S.regularityRun f cuts ε n).partition ≤ S.partition := by + induction n with + | zero => + exact le_rfl + | succ n ih => + exact + le_trans + ((S.regularityRun f cuts ε n).refineBy_le + ((S.regularityRun f cuts ε n).chosenIrregularCut + f cuts ε)) + ih + +theorem regularityRun_complexity_le + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (n : ℕ) : + FacePartition.complexity + (S.regularityRun f cuts ε n).partition ≤ + 2 ^ n * FacePartition.complexity S.partition := by + induction n with + | zero => + simp + | succ n ih => + calc + FacePartition.complexity + (S.regularityRun f cuts ε (n + 1)).partition ≤ + 2 * FacePartition.complexity + (S.regularityRun f cuts ε n).partition := by + rw [regularityRun_succ] + exact + (S.regularityRun f cuts ε n).complexity_refineBy_le + ((S.regularityRun f cuts ε n).chosenIrregularCut + f cuts ε) + _ ≤ 2 * (2 ^ n * + FacePartition.complexity S.partition) := + Nat.mul_le_mul_left 2 ih + _ = 2 ^ (n + 1) * + FacePartition.complexity S.partition := by + rw [pow_succ] + ring + +noncomputable def regularityRunCuts + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (n : ℕ) : + Finset (BooleanCutTest Ω) := by + classical + exact (Finset.range n).image fun i => + (S.regularityRun f cuts ε i).chosenIrregularCut + f cuts ε + +@[simp] +theorem regularityRunCuts_zero + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : + S.regularityRunCuts f cuts ε 0 = ∅ := by + simp [regularityRunCuts] + +@[simp] +theorem regularityRunCuts_succ + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (n : ℕ) : + S.regularityRunCuts f cuts ε (n + 1) = + insert + ((S.regularityRun f cuts ε n).chosenIrregularCut + f cuts ε) + (S.regularityRunCuts f cuts ε n) := by + classical + simp [regularityRunCuts, Finset.range_add_one] + +theorem chosenIrregularCut_mem_of_empty_mem + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (hempty : (∅ : BooleanCutTest Ω) ∈ cuts) : + S.chosenIrregularCut f cuts ε ∈ cuts := by + by_cases hregular : S.IsRegularAgainst f cuts ε + · simpa [chosenIrregularCut, hregular] using hempty + · exact S.chosenIrregularCut_mem f cuts ε hregular + +theorem regularityRunCuts_subset + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (hempty : (∅ : BooleanCutTest Ω) ∈ cuts) + (n : ℕ) : + S.regularityRunCuts f cuts ε n ⊆ cuts := by + classical + intro A hA + obtain ⟨i, _hi, rfl⟩ := Finset.mem_image.mp hA + exact chosenIrregularCut_mem_of_empty_mem + (S.regularityRun f cuts ε i) f cuts ε hempty + +theorem regularityRun_partition_eq_join_generatedBy + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (n : ℕ) : + (S.regularityRun f cuts ε n).partition = + FacePartition.join S.partition + (FacePartition.generatedBy + (S.regularityRunCuts f cuts ε n)) := by + induction n with + | zero => + rw [regularityRun_zero, regularityRunCuts_zero, + FacePartition.generatedBy_empty] + change S.partition = S.partition ⊓ ⊤ + exact (inf_top_eq S.partition).symm + | succ n ih => + let A : BooleanCutTest Ω := + (S.regularityRun f cuts ε n).chosenIrregularCut + f cuts ε + calc + (S.regularityRun f cuts ε (n + 1)).partition = + FacePartition.join + (S.regularityRun f cuts ε n).partition + (FacePartition.generatedBy + ({A} : Finset (Finset Ω))) := by + rfl + _ = + FacePartition.join + (FacePartition.join S.partition + (FacePartition.generatedBy + (S.regularityRunCuts f cuts ε n))) + (FacePartition.generatedBy + ({A} : Finset (Finset Ω))) := by + rw [ih] + _ = + FacePartition.join S.partition + (FacePartition.join + (FacePartition.generatedBy + (S.regularityRunCuts f cuts ε n)) + (FacePartition.generatedBy + ({A} : Finset (Finset Ω)))) := by + exact inf_assoc _ _ _ + _ = + FacePartition.join S.partition + (FacePartition.generatedBy + (insert A + (S.regularityRunCuts f cuts ε n))) := by + rw [FacePartition.generatedBy_insert] + _ = + FacePartition.join S.partition + (FacePartition.generatedBy + (S.regularityRunCuts f cuts ε (n + 1))) := by + rw [regularityRunCuts_succ] + +theorem exists_regular_run_index_before [Nonempty Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) + {ε : ℝ} {m : ℕ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hε : 0 ≤ ε) + (hlong : 1 < (m : ℝ) * ε ^ 2) : + ∃ i : ℕ, i < m ∧ + (S.regularityRun f cuts ε i).IsRegularAgainst + f cuts ε := by + exact + exists_regular_state_in_refinement_run + (S.regularityRun f cuts ε) + (fun n => + (S.regularityRun f cuts ε n).chosenIrregularCut + f cuts ε) + f cuts hf0 hf1 hε hlong + (fun n _ => S.regularityRun_succ f cuts ε n) + (fun n _ hn => + ⟨(S.regularityRun f cuts ε n).chosenIrregularCut_mem + f cuts ε hn, + le_of_lt + (chosenIrregularCut_correlation + (S.regularityRun f cuts ε n) f cuts ε hn)⟩) + +theorem exists_regular_refinement_before [Nonempty Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) + {ε : ℝ} {m : ℕ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hε : 0 ≤ ε) + (hlong : 1 < (m : ℝ) * ε ^ 2) : + ∃ i : ℕ, ∃ T : FaceRegularityState Ω, + i < m ∧ + T.partition ≤ S.partition ∧ + T.IsRegularAgainst f cuts ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * FacePartition.complexity S.partition := by + obtain ⟨i, hi, hregular⟩ := + S.exists_regular_run_index_before f cuts + hf0 hf1 hε hlong + exact + ⟨i, S.regularityRun f cuts ε i, hi, + S.regularityRun_partition_le f cuts ε i, + hregular, + S.regularityRun_complexity_le f cuts ε i⟩ + +theorem exists_regular_refinement [Nonempty Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) + {ε : ℝ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hε : 0 < ε) : + ∃ m i : ℕ, ∃ T : FaceRegularityState Ω, + 1 < (m : ℝ) * ε ^ 2 ∧ + i < m ∧ + T.partition ≤ S.partition ∧ + T.IsRegularAgainst f cuts ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * FacePartition.complexity S.partition := by + have hεsq : 0 < ε ^ 2 := sq_pos_of_pos hε + obtain ⟨m, hm⟩ := exists_nat_gt (1 / ε ^ 2) + have hlong : 1 < (m : ℝ) * ε ^ 2 := by + calc + 1 = (1 / ε ^ 2) * ε ^ 2 := by + field_simp + _ < (m : ℝ) * ε ^ 2 := + mul_lt_mul_of_pos_right hm hεsq + obtain ⟨i, T, hi, hTS, hregular, hcomplexity⟩ := + S.exists_regular_refinement_before f cuts + hf0 hf1 hε.le hlong + exact + ⟨m, i, T, hlong, hi, hTS, hregular, hcomplexity⟩ + +theorem exists_regular_refinement_allCuts [Nonempty Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) + {ε : ℝ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hε : 0 < ε) : + ∃ m i : ℕ, ∃ T : FaceRegularityState Ω, + 1 < (m : ℝ) * ε ^ 2 ∧ + i < m ∧ + T.partition ≤ S.partition ∧ + (∀ A : BooleanCutTest Ω, + |T.booleanCutCorrelation f A| ≤ ε) ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * FacePartition.complexity S.partition := by + classical + obtain ⟨m, i, T, hlong, hi, hTS, hregular, hcomplexity⟩ := + S.exists_regular_refinement f + (Finset.univ : Finset (BooleanCutTest Ω)) + hf0 hf1 hε + refine ⟨m, i, T, hlong, hi, hTS, ?_, hcomplexity⟩ + intro A + exact hregular A (Finset.mem_univ A) + +end FaceRegularityState + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def booleanFaceCutSupport + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (b : BooleanCutAssignment G r) : + BooleanCutTest (Fin r → G) := by + classical + exact Finset.univ.filter fun x => + ∀ i, b ⟨i, eraseCoordinate i x⟩ = true + +@[simp] +theorem mem_booleanFaceCutSupport + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (b : BooleanCutAssignment G r) (x : Fin r → G) : + x ∈ booleanFaceCutSupport b ↔ + ∀ i, b ⟨i, eraseCoordinate i x⟩ = true := by + simp [booleanFaceCutSupport] + +theorem booleanFaceCutSupport_eval + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (b : BooleanCutAssignment G r) (x : Fin r → G) : + (booleanFaceCutSupport b).eval x = + cutTestProduct (cutTestFamilyOfBooleanAssignment b) x := by + classical + by_cases h : ∀ i, b ⟨i, eraseCoordinate i x⟩ = true + · have hx : x ∈ booleanFaceCutSupport b := by + simp [booleanFaceCutSupport, h] + rw [BooleanCutTest.eval_of_mem _ hx] + unfold cutTestProduct + symm + apply Finset.prod_eq_one + intro i _ + simp [cutTestFamilyOfBooleanAssignment, booleanValue, h i] + · have hx : x ∉ booleanFaceCutSupport b := by + simpa [booleanFaceCutSupport] using h + rw [BooleanCutTest.eval_of_not_mem _ hx] + obtain ⟨i, hi⟩ := not_forall.mp h + cases hb : b ⟨i, eraseCoordinate i x⟩ with + | false => + unfold cutTestProduct + symm + apply Finset.prod_eq_zero (Finset.mem_univ i) + simp [cutTestFamilyOfBooleanAssignment, + booleanValue, hb] + | true => + exact (hi hb).elim + +noncomputable def booleanFaceCutSupports + (G : Type*) [Fintype G] [DecidableEq G] (r : ℕ) : + Finset (BooleanCutTest (Fin r → G)) := by + classical + exact Finset.univ.image booleanFaceCutSupport + +theorem booleanFaceCutSupport_mem_supports + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (b : BooleanCutAssignment G r) : + booleanFaceCutSupport b ∈ booleanFaceCutSupports G r := by + classical + exact Finset.mem_image.mpr + ⟨b, Finset.mem_univ b, rfl⟩ + +theorem booleanFaceCutSupport_false + {G : Type*} [Fintype G] [DecidableEq G] + {r : ℕ} (hr : 0 < r) : + booleanFaceCutSupport + (fun _ : CutTestCoordinate G r => false) = + ∅ := by + classical + ext x + constructor + · intro hx + have hall := + (mem_booleanFaceCutSupport + (fun _ : CutTestCoordinate G r => false) x).1 hx + have hfalse := hall ⟨0, hr⟩ + simp at hfalse + · intro hx + simp at hx + +theorem empty_mem_booleanFaceCutSupports + {G : Type*} [Fintype G] [DecidableEq G] + {r : ℕ} (hr : 0 < r) : + (∅ : BooleanCutTest (Fin r → G)) ∈ + booleanFaceCutSupports G r := by + classical + apply Finset.mem_image.mpr + refine + ⟨(fun _ : CutTestCoordinate G r => false), + Finset.mem_univ _, ?_⟩ + exact booleanFaceCutSupport_false hr + +namespace FaceRegularityState + +noncomputable def faceCutCorrelation + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (f : (Fin r → G) → ℝ) (u : CutTestFamily G r) : ℝ := + mean fun x => S.residual f x * cutTestProduct u x + +theorem faceCutCorrelation_boolean + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (f : (Fin r → G) → ℝ) + (b : BooleanCutAssignment G r) : + S.faceCutCorrelation f + (cutTestFamilyOfBooleanAssignment b) = + S.booleanCutCorrelation f (booleanFaceCutSupport b) := by + unfold faceCutCorrelation booleanCutCorrelation + apply congrArg mean + funext x + rw [booleanFaceCutSupport_eval] + +theorem faceCutCorrelation_eq_sum_boolean + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (f : (Fin r → G) → ℝ) (u : CutTestFamily G r) : + S.faceCutCorrelation f u = + ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + S.faceCutCorrelation f + (cutTestFamilyOfBooleanAssignment b) := by + unfold faceCutCorrelation + calc + mean (fun x : Fin r → G => + S.residual f x * cutTestProduct u x) = + mean (fun x : Fin r → G => + ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + (S.residual f x * + cutTestProduct + (cutTestFamilyOfBooleanAssignment b) x)) := by + apply congrArg mean + funext x + rw [cutTestProduct_eq_sum_boolean u x, + Finset.mul_sum] + apply Fintype.sum_congr + intro b + ring + _ = + ∑ b : BooleanCutAssignment G r, + mean (fun x : Fin r → G => + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + (S.residual f x * + cutTestProduct + (cutTestFamilyOfBooleanAssignment b) x)) := by + unfold mean + exact Finset.expect_sum_comm Finset.univ Finset.univ _ + _ = + ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + mean (fun x : Fin r → G => + S.residual f x * + cutTestProduct + (cutTestFamilyOfBooleanAssignment b) x) := by + apply Fintype.sum_congr + intro b + exact mean_smul + (bernoulliAssignmentWeight + (cutTestCoordinateValue u) b) _ + _ = _ := by + rfl + +def IsFaceCutRegular + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (f : (Fin r → G) → ℝ) (ε : ℝ) : Prop := + ∀ u : CutTestFamily G r, + IsBoundedCutTest u → + |S.faceCutCorrelation f u| ≤ ε + +theorem isFaceCutRegular_of_regularAgainst_supports + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (f : (Fin r → G) → ℝ) {ε : ℝ} + (hregular : + S.IsRegularAgainst f (booleanFaceCutSupports G r) ε) : + S.IsFaceCutRegular f ε := by + intro u hu + rw [faceCutCorrelation_eq_sum_boolean] + calc + |∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + S.faceCutCorrelation f + (cutTestFamilyOfBooleanAssignment b)| ≤ + ∑ b : BooleanCutAssignment G r, + |bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * + S.faceCutCorrelation f + (cutTestFamilyOfBooleanAssignment b)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ + ∑ b : BooleanCutAssignment G r, + bernoulliAssignmentWeight + (cutTestCoordinateValue u) b * ε := by + apply Finset.sum_le_sum + intro b _ + have hw : + 0 ≤ bernoulliAssignmentWeight + (cutTestCoordinateValue u) b := + bernoulliAssignmentWeight_nonneg + (p := cutTestCoordinateValue u) + (fun q => hu.nonneg q.1 q.2) + (fun q => hu.le_one q.1 q.2) b + rw [abs_mul, abs_of_nonneg hw] + apply mul_le_mul_of_nonneg_left _ hw + rw [faceCutCorrelation_boolean] + exact hregular (booleanFaceCutSupport b) + (booleanFaceCutSupport_mem_supports b) + _ = ε := by + rw [← Finset.sum_mul, + sum_bernoulliAssignmentWeight, one_mul] + +theorem exists_faceCutRegular_refinement + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (f : (Fin r → G) → ℝ) + {ε : ℝ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hε : 0 < ε) : + ∃ m i : ℕ, ∃ T : FaceRegularityState (Fin r → G), + 1 < (m : ℝ) * ε ^ 2 ∧ + i < m ∧ + T.partition ≤ S.partition ∧ + T.IsFaceCutRegular f ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * FacePartition.complexity S.partition := by + obtain ⟨m, i, T, hlong, hi, hTS, hregular, hcomplexity⟩ := + S.exists_regular_refinement f + (booleanFaceCutSupports G r) hf0 hf1 hε + exact + ⟨m, i, T, hlong, hi, hTS, + T.isFaceCutRegular_of_regularAgainst_supports f hregular, + hcomplexity⟩ + +theorem exists_faceCutRegular_refinement_with_generators_before + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {r : ℕ} (hr : 0 < r) + (S : FaceRegularityState (Fin r → G)) + (f : (Fin r → G) → ℝ) + {ε : ℝ} {m : ℕ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hε : 0 ≤ ε) + (hlong : 1 < (m : ℝ) * ε ^ 2) : + ∃ i : ℕ, + ∃ T : FaceRegularityState (Fin r → G), + ∃ F : Finset (BooleanCutTest (Fin r → G)), + i < m ∧ + T.partition = + FacePartition.join S.partition + (FacePartition.generatedBy F) ∧ + F ⊆ booleanFaceCutSupports G r ∧ + F.card ≤ i ∧ + T.IsFaceCutRegular f ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * FacePartition.complexity S.partition := by + let cuts := booleanFaceCutSupports G r + obtain ⟨i, hi, hregular⟩ := + S.exists_regular_run_index_before f cuts + hf0 hf1 hε hlong + let T := S.regularityRun f cuts ε i + let F := S.regularityRunCuts f cuts ε i + have hpart : + T.partition = + FacePartition.join S.partition + (FacePartition.generatedBy F) := + S.regularityRun_partition_eq_join_generatedBy + f cuts ε i + have hsubset : + F ⊆ booleanFaceCutSupports G r := by + exact S.regularityRunCuts_subset f cuts ε + (by + dsimp [cuts] + exact empty_mem_booleanFaceCutSupports hr) + i + have hcard : F.card ≤ i := by + unfold F regularityRunCuts + exact Finset.card_image_le.trans_eq (Finset.card_range i) + have hface : T.IsFaceCutRegular f ε := + T.isFaceCutRegular_of_regularAgainst_supports + f hregular + have hcomplexity : + FacePartition.complexity T.partition ≤ + 2 ^ i * FacePartition.complexity S.partition := + S.regularityRun_complexity_le f cuts ε i + exact + ⟨i, T, F, hi, hpart, hsubset, + hcard, hface, hcomplexity⟩ + +theorem exists_faceCutRegular_refinement_with_generators + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {r : ℕ} (hr : 0 < r) + (S : FaceRegularityState (Fin r → G)) + (f : (Fin r → G) → ℝ) + {ε : ℝ} + (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (hε : 0 < ε) : + ∃ m i : ℕ, + ∃ T : FaceRegularityState (Fin r → G), + ∃ F : Finset (BooleanCutTest (Fin r → G)), + 1 < (m : ℝ) * ε ^ 2 ∧ + i < m ∧ + T.partition = + FacePartition.join S.partition + (FacePartition.generatedBy F) ∧ + F ⊆ booleanFaceCutSupports G r ∧ + F.card ≤ i ∧ + T.IsFaceCutRegular f ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * FacePartition.complexity S.partition := by + have hεsq : 0 < ε ^ 2 := sq_pos_of_pos hε + obtain ⟨m, hm⟩ := exists_nat_gt (1 / ε ^ 2) + have hlong : 1 < (m : ℝ) * ε ^ 2 := by + calc + 1 = (1 / ε ^ 2) * ε ^ 2 := by + field_simp + _ < (m : ℝ) * ε ^ 2 := + mul_lt_mul_of_pos_right hm hεsq + obtain ⟨i, T, F, hi, hpart, hsubset, hcard, + hface, hcomplexity⟩ := + S.exists_faceCutRegular_refinement_with_generators_before + hr f hf0 hf1 hε.le hlong + exact + ⟨m, i, T, F, hlong, hi, hpart, hsubset, + hcard, hface, hcomplexity⟩ + +end FaceRegularityState + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +noncomputable def representingBooleanFaceCutAssignment + (G : Type*) [Fintype G] [DecidableEq G] (r : ℕ) + (A : BooleanCutTest (Fin r → G)) : + BooleanCutAssignment G r := by + classical + exact + if hA : A ∈ booleanFaceCutSupports G r then + Classical.choose + (show ∃ b : BooleanCutAssignment G r, + booleanFaceCutSupport b = A by + obtain ⟨b, _hb, hsupport⟩ := + Finset.mem_image.mp hA + exact ⟨b, hsupport⟩) + else + fun _ => false + +theorem booleanFaceCutSupport_representing + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + {A : BooleanCutTest (Fin r → G)} + (hA : A ∈ booleanFaceCutSupports G r) : + booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A) = A := by + classical + simp only [representingBooleanFaceCutAssignment, dite_eq_left hA] + exact + Classical.choose_spec + (show ∃ b : BooleanCutAssignment G r, + booleanFaceCutSupport b = A by + obtain ⟨b, _hb, hsupport⟩ := + Finset.mem_image.mp hA + exact ⟨b, hsupport⟩) + +abbrev GeneratorBranch + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (F : Finset (BooleanCutTest (Fin r → G))) := + F → Fin r + +@[simp] +theorem card_generatorBranch + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (F : Finset (BooleanCutTest (Fin r → G))) : + Fintype.card (GeneratorBranch F) = r ^ F.card := by + simp [GeneratorBranch] + +noncomputable def lowerGeneratorCell + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (F : Finset (BooleanCutTest (Fin r → G))) + (y : Fin r → G) (w : GeneratorBranch F) (i : Fin r) : + BooleanCutTest (Fin (r - 1) → G) := by + classical + exact Finset.univ.filter fun z => + ∀ A : F, + (y ∈ A.1 → + representingBooleanFaceCutAssignment G r A.1 + ⟨i, z⟩ = true) ∧ + (y ∉ A.1 → w A = i → + representingBooleanFaceCutAssignment G r A.1 + ⟨i, z⟩ = false) + +@[simp] +theorem mem_lowerGeneratorCell + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (F : Finset (BooleanCutTest (Fin r → G))) + (y : Fin r → G) (w : GeneratorBranch F) (i : Fin r) + (z : Fin (r - 1) → G) : + z ∈ lowerGeneratorCell F y w i ↔ + ∀ A : F, + (y ∈ A.1 → + representingBooleanFaceCutAssignment G r A.1 + ⟨i, z⟩ = true) ∧ + (y ∉ A.1 → w A = i → + representingBooleanFaceCutAssignment G r A.1 + ⟨i, z⟩ = false) := by + simp [lowerGeneratorCell] + +theorem mem_generatedBy_part_iff_exists_lowerGeneratorCells + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (hr : 0 < r) + (F : Finset (BooleanCutTest (Fin r → G))) + (hF : F ⊆ booleanFaceCutSupports G r) + (y x : Fin r → G) : + x ∈ (FacePartition.generatedBy F).part y ↔ + ∃ w : GeneratorBranch F, + ∀ i, + eraseCoordinate i x ∈ + lowerGeneratorCell F y w i := by + classical + constructor + · intro hpart + have hsignature : + ∀ A ∈ F, (y ∈ A ↔ x ∈ A) := + (FacePartition.mem_part_generatedBy_iff F y x).1 hpart + have hwitness : + ∀ A : F, y ∉ A.1 → + ∃ i : Fin r, + representingBooleanFaceCutAssignment G r A.1 + ⟨i, eraseCoordinate i x⟩ = false := by + intro A hyA + have hxA : x ∉ A.1 := by + intro hx + exact hyA ((hsignature A.1 A.2).2 hx) + have hsupport : + booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A.1) = + A.1 := + booleanFaceCutSupport_representing (hF A.2) + have hnotall : + ¬∀ i, + representingBooleanFaceCutAssignment G r A.1 + ⟨i, eraseCoordinate i x⟩ = true := by + intro hall + apply hxA + rw [← hsupport] + exact + (mem_booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A.1) x).2 + hall + obtain ⟨i, hi⟩ := not_forall.mp hnotall + refine ⟨i, ?_⟩ + cases hb : + representingBooleanFaceCutAssignment G r A.1 + ⟨i, eraseCoordinate i x⟩ with + | false => rfl + | true => exact (hi hb).elim + let w : GeneratorBranch F := fun A => + if hyA : y ∉ A.1 then + Classical.choose (hwitness A hyA) + else + ⟨0, hr⟩ + refine ⟨w, ?_⟩ + intro i + rw [mem_lowerGeneratorCell] + intro A + constructor + · intro hyA + have hxA : x ∈ A.1 := + (hsignature A.1 A.2).1 hyA + have hsupport : + booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A.1) = + A.1 := + booleanFaceCutSupport_representing (hF A.2) + have hxSupport : + x ∈ booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A.1) := by + simpa only [hsupport] using hxA + exact + (mem_booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A.1) x).1 + hxSupport i + · intro hyA hwi + have hchosen := + Classical.choose_spec (hwitness A hyA) + have hw : + w A = Classical.choose (hwitness A hyA) := by + simp [w, hyA] + rw [hw] at hwi + simpa only [hwi] using hchosen + · rintro ⟨w, hcells⟩ + apply + (FacePartition.mem_part_generatedBy_iff F y x).2 + intro A hAF + let A' : F := ⟨A, hAF⟩ + have hsupport : + booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A) = + A := + booleanFaceCutSupport_representing (hF hAF) + constructor + · intro hyA + have hall : + ∀ i, + representingBooleanFaceCutAssignment G r A + ⟨i, eraseCoordinate i x⟩ = true := by + intro i + exact + ((mem_lowerGeneratorCell F y w i + (eraseCoordinate i x)).1 (hcells i) A').1 hyA + rw [← hsupport] + exact + (mem_booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A) x).2 + hall + · intro hxA + by_contra hyA + have hxSupport : + x ∈ booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A) := by + simpa only [hsupport] using hxA + have htrue := + (mem_booleanFaceCutSupport + (representingBooleanFaceCutAssignment G r A) x).1 + hxSupport (w A') + have hfalse := + ((mem_lowerGeneratorCell F y w (w A') + (eraseCoordinate (w A') x)).1 + (hcells (w A')) A').2 hyA rfl + rw [htrue] at hfalse + simp at hfalse + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleEnvelopeSelection.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleEnvelopeSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..b75d3c3420579b782ba0d69e0f5e5e475531cf77 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleEnvelopeSelection.lean @@ -0,0 +1,1452 @@ +import OAI.Combinatorics.Progressions.FixedDensity.HypergraphBundleFiltration + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {J K G : Type*} + [DecidableEq J] [DecidableEq K] + {H : Finset (Finset J)} + +def BaseWeightsIdempotent + (H : Finset (Finset J)) + (A : BaseEdgeWeight J G) : Prop := + ∀ e ∈ H, ∀ y, A e y * A e y = A e y + +def finsetMembershipEquivOfEq + {α : Type*} {s t : Finset α} (h : s = t) : + {a : α // a ∈ s} ≃ {a : α // a ∈ t} := + Equiv.cast + (congrArg (fun u : Finset α => {a : α // a ∈ u}) h) + +@[simp] +theorem finsetMembershipEquivOfEq_symm_val + {α : Type*} {s t : Finset α} (h : s = t) + (a : {a : α // a ∈ t}) : + ((finsetMembershipEquivOfEq h).symm a).1 = a.1 := by + subst t + rfl + +theorem cast_finsetPi_apply + {α G' : Type*} {s t : Finset α} (h : s = t) + (f : {a : α // a ∈ s} → G') + (a : {a : α // a ∈ t}) : + cast + (congrArg + (fun u : Finset α => + ({a : α // a ∈ u} → G')) + h) + f a = + f ((finsetMembershipEquivOfEq h).symm a) := by + subst t + rfl + +@[simp] +theorem projectionEquiv_apply_val + (B : HypergraphBundle J K H) + {g : Finset K} (hg : g ∈ B.edges) + (v : {v : K // v ∈ g}) : + ((B.projectionEquiv hg) v).1 = + B.projection v.1 := by + rfl + +theorem prod_comp_eq_prod_image_of_idempotent + {α β M : Type*} [DecidableEq β] + [CommMonoid M] + (s : Finset α) (f : α → β) (w : β → M) + (hw : ∀ b ∈ s.image f, w b * w b = w b) : + (∏ a ∈ s, w (f a)) = + ∏ b ∈ s.image f, w b := by + classical + induction s using Finset.induction_on with + | empty => + simp + | @insert a s ha ih => + have hw' : + ∀ b ∈ s.image f, w b * w b = w b := by + intro b hb + exact hw b (by + rw [Finset.image_insert] + exact Finset.mem_insert_of_mem hb) + rw [Finset.prod_insert ha, ih hw', + Finset.image_insert] + by_cases hfa : f a ∈ s.image f + · rw [Finset.insert_eq_of_mem hfa] + calc + w (f a) * ∏ b ∈ s.image f, w b = + w (f a) * + (w (f a) * + ∏ b ∈ (s.image f).erase (f a), w b) := by + rw [Finset.mul_prod_erase (s.image f) w hfa] + _ = + w (f a) * + ∏ b ∈ (s.image f).erase (f a), w b := by + rw [← mul_assoc, + hw (f a) (by + rw [Finset.image_insert] + exact Finset.mem_insert_self _ _)] + _ = ∏ b ∈ s.image f, w b := + Finset.mul_prod_erase (s.image f) w hfa + · rw [Finset.prod_insert hfa] + +theorem doubledEdgeOfSource_eq_iff + (B : HypergraphBundle J K H) (g₀ : Finset K) + (s t : B.DoubledEdgeSource g₀) : + B.doubledEdgeOfSource g₀ s = + B.doubledEdgeOfSource g₀ t ↔ + s.2.1 = t.2.1 ∧ + (s.1 = t.1 ∨ s.2.1 ⊆ g₀) := by + classical + constructor + · intro hst + have hgg : s.2.1 = t.2.1 := by + have himage := + congrArg + (Finset.image (doubledVertexForget g₀)) + hst + simpa [doubledEdgeOfSource] using himage + refine ⟨hgg, ?_⟩ + by_cases hcopy : s.1 = t.1 + · exact Or.inl hcopy + · right + have hedges : + doubledEdge g₀ s.1 s.2.1 = + doubledEdge g₀ t.1 s.2.1 := by + simpa [doubledEdgeOfSource, hgg] using hst + cases hs : s.1 <;> cases ht : t.1 + · exact False.elim (hcopy (by simp [hs, ht])) + · exact + (doubledEdge_false_eq_true_iff_subset + g₀ s.2.1).1 (by + simpa [hs, ht] using hedges) + · exact + (doubledEdge_false_eq_true_iff_subset + g₀ s.2.1).1 (by + simpa [hs, ht] using hedges.symm) + · exact False.elim (hcopy (by simp [hs, ht])) + · rintro ⟨hgg, hcopy⟩ + rcases hcopy with hcopy | hsubset + · simp [doubledEdgeOfSource, hgg, hcopy] + · simpa [doubledEdgeOfSource, hgg] using + doubledEdge_copy_independent_of_subset + g₀ hsubset s.1 t.1 + +theorem pullbackBaseEdgeWeight_duplicateOutside_doubledEdge + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : BaseEdgeWeight J G) + (copy : Bool) {g : Finset K} + (hg : g ∈ B.edges.erase g₀) + (x : DoubledOccurrenceVertex g₀ → G) : + (B.duplicateOutside g₀).pullbackBaseEdgeWeight A + (doubledEdge g₀ copy g) + (edgeTuple (doubledEdge g₀ copy g) x) = + B.pullbackBaseEdgeWeight A g + (fun v => x (doubledVertexLift g₀ copy v.1)) := by + classical + have hgB : g ∈ B.edges := + Finset.mem_of_mem_erase hg + have hd : + doubledEdge g₀ copy g ∈ + (B.duplicateOutside g₀).edges := by + exact + (B.mem_doubledEdges_iff g₀ + (doubledEdge g₀ copy g)).2 + ⟨copy, g, hg, rfl⟩ + rw [(B.duplicateOutside g₀).pullbackBaseEdgeWeight_of_mem + A hd, + B.pullbackBaseEdgeWeight_of_mem A hgB] + have himage : + (doubledEdge g₀ copy g).image + (B.duplicateOutside g₀).projection = + g.image B.projection := by + exact B.image_doubledProjection_doubledEdge g₀ copy g + let lhsInput : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) := + ⟨(doubledEdge g₀ copy g).image + (B.duplicateOutside g₀).projection, + (B.duplicateOutside g₀).projectedEdgeTuple hd + (edgeTuple (doubledEdge g₀ copy g) x)⟩ + let rhsInput : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) := + ⟨g.image B.projection, + B.projectedEdgeTuple hgB + (fun v => + x (doubledVertexLift g₀ copy v.1))⟩ + change + (fun p : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) => + A p.1 p.2) lhsInput = + (fun p : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) => + A p.1 p.2) rhsInput + apply congrArg + (fun p : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) => + A p.1 p.2) + apply Sigma.ext himage + apply heq_of_eqRec_eq + (congrArg + (fun e : Finset J => + ({j : J // j ∈ e} → G)) + himage) + funext j + change + cast + (congrArg + (fun e : Finset J => + ({j : J // j ∈ e} → G)) + himage) + lhsInput.2 j = + rhsInput.2 j + rw [cast_finsetPi_apply himage] + let jleft : + {j : J // + j ∈ (doubledEdge g₀ copy g).image + (B.duplicateOutside g₀).projection} := + (finsetMembershipEquivOfEq himage).symm j + let v : {v : K // v ∈ g} := + (B.projectionEquiv hgB).symm j + have hjv : + (⟨B.projection v.1, + Finset.mem_image.mpr ⟨v.1, v.2, rfl⟩⟩ : + {j : J // j ∈ g.image B.projection}) = j := by + exact + (B.projectionEquiv hgB).apply_symm_apply j + have hvlift : + doubledVertexLift g₀ copy v.1 ∈ + doubledEdge g₀ copy g := + mem_doubledEdge g₀ copy g v.1 v.2 + have hpreimage : + ((B.duplicateOutside g₀).projectionEquiv hd).symm jleft = + ⟨doubledVertexLift g₀ copy v.1, hvlift⟩ := by + apply ((B.duplicateOutside g₀).projectionEquiv hd).injective + rw [Equiv.apply_symm_apply] + apply Subtype.ext + calc + jleft.1 = j.1 := by + exact + finsetMembershipEquivOfEq_symm_val + himage j + _ = B.projection v.1 := + congrArg Subtype.val hjv.symm + _ = + (((B.duplicateOutside g₀).projectionEquiv hd) + ⟨doubledVertexLift g₀ copy v.1, + hvlift⟩).1 := by + rw [projectionEquiv_apply_val, + duplicateOutside_projection, + doubledProjection_lift] + unfold lhsInput rhsInput projectedEdgeTuple edgeTuple + change + x (((B.duplicateOutside g₀).projectionEquiv hd).symm + jleft).1 = + x (doubledVertexLift g₀ copy v.1) + rw [hpreimage] + +noncomputable def doubledBundleEdgeFactor + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : BaseEdgeWeight J G) + (x : DoubledOccurrenceVertex g₀ → G) + (d : Finset (DoubledOccurrenceVertex g₀)) : ℝ := + (B.duplicateOutside g₀).pullbackBaseEdgeWeight A d + (edgeTuple d x) + +theorem doubledBundleEdgeFactor_doubledEdgeOfSource + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : BaseEdgeWeight J G) + (x : DoubledOccurrenceVertex g₀ → G) + (s : B.DoubledEdgeSource g₀) : + B.doubledBundleEdgeFactor g₀ A x + (B.doubledEdgeOfSource g₀ s) = + B.pullbackBaseEdgeWeight A s.2.1 + (fun v => + x (doubledVertexLift g₀ s.1 v.1)) := by + exact + B.pullbackBaseEdgeWeight_duplicateOutside_doubledEdge + g₀ A s.1 s.2.2 x + +theorem doubledBundleEdgeFactor_idempotent + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : BaseEdgeWeight J G) + (hA : BaseWeightsIdempotent H A) + (x : DoubledOccurrenceVertex g₀ → G) + (d : Finset (DoubledOccurrenceVertex g₀)) + (hd : d ∈ B.doubledEdges g₀) : + B.doubledBundleEdgeFactor g₀ A x d * + B.doubledBundleEdgeFactor g₀ A x d = + B.doubledBundleEdgeFactor g₀ A x d := by + classical + unfold doubledBundleEdgeFactor + rw [(B.duplicateOutside g₀).pullbackBaseEdgeWeight_of_mem + A hd] + exact hA _ ((B.duplicateOutside g₀).projection_mem_base d hd) _ + +theorem doubledSourceProduct_pullback_eq_duplicateOutside_bundleProduct + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : BaseEdgeWeight J G) + (hA : BaseWeightsIdempotent H A) + (x : DoubledOccurrenceVertex g₀ → G) : + B.doubledSourceProduct g₀ + (B.pullbackBaseEdgeWeight A) x = + (B.duplicateOutside g₀).bundleProduct + ((B.duplicateOutside g₀).pullbackBaseEdgeWeight A) x := by + classical + unfold doubledSourceProduct + calc + (∏ s : B.DoubledEdgeSource g₀, + B.pullbackBaseEdgeWeight A s.2.1 + (fun v => + x (doubledVertexLift g₀ s.1 v.1))) = + ∏ s : B.DoubledEdgeSource g₀, + B.doubledBundleEdgeFactor g₀ A x + (B.doubledEdgeOfSource g₀ s) := by + apply Finset.prod_congr rfl + intro s _hs + exact + (B.doubledBundleEdgeFactor_doubledEdgeOfSource + g₀ A x s).symm + _ = + ∏ d ∈ + (Finset.univ : + Finset (B.DoubledEdgeSource g₀)).image + (B.doubledEdgeOfSource g₀), + B.doubledBundleEdgeFactor g₀ A x d := by + apply prod_comp_eq_prod_image_of_idempotent + intro d hd + apply B.doubledBundleEdgeFactor_idempotent + g₀ A hA x d + simpa [doubledEdges] using hd + _ = + (B.duplicateOutside g₀).bundleProduct + ((B.duplicateOutside g₀).pullbackBaseEdgeWeight A) x := by + rfl + +theorem doubledRemainderMoment_pullback_eq_duplicateOutside_bundleCount + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (A : BaseEdgeWeight J G) + (hA : BaseWeightsIdempotent H A) : + B.doubledRemainderMoment g₀ + (B.pullbackBaseEdgeWeight A) = + (B.duplicateOutside g₀).bundleCount + ((B.duplicateOutside g₀).pullbackBaseEdgeWeight A) := by + have _hduplicateClosed : + (B.duplicateOutside g₀).IsClosedUnderInclusion := + B.duplicateOutside_closed_of_maximal + hclosed hg₀ hmax + rw [B.doubledRemainderMoment_eq_mean_doubledSourceProduct] + unfold bundleCount + apply congrArg mean + funext x + exact + B.doubledSourceProduct_pullback_eq_duplicateOutside_bundleProduct + g₀ A hA x + +end HypergraphBundle + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {J K G : Type*} + [DecidableEq J] [DecidableEq K] + {H : Finset (Finset J)} + +def restrictEdgeTuple + {f g : Finset K} (hfg : f ⊆ g) + (y : {v : K // v ∈ g} → G) : + {v : K // v ∈ f} → G := + fun v => y ⟨v.1, hfg v.2⟩ + +omit [DecidableEq K] in +@[simp] +theorem restrictEdgeTuple_edgeTuple + {f g : Finset K} (hfg : f ⊆ g) + (x : K → G) : + restrictEdgeTuple hfg (edgeTuple g x) = + edgeTuple f x := by + rfl + +noncomputable def strictBoundaryLocalProduct + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (y : {v : K // v ∈ g₀} → G) : ℝ := + ∏ g : + {g : Finset K // + g ∈ (B.strictBoundary g₀).edges}, + A g.1 + (restrictEdgeTuple + (((B.mem_strictBoundary_edges g₀ g.1).1 + g.2).2.1) + y) + +theorem strictBoundaryLocalProduct_edgeTuple + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (x : K → G) : + B.strictBoundaryLocalProduct g₀ A + (edgeTuple g₀ x) = + (B.strictBoundary g₀).bundleProduct A x := by + classical + unfold strictBoundaryLocalProduct + calc + (∏ g : + {g : Finset K // + g ∈ (B.strictBoundary g₀).edges}, + A g.1 + (restrictEdgeTuple + (((B.mem_strictBoundary_edges g₀ g.1).1 + g.2).2.1) + (edgeTuple g₀ x))) = + ∏ g : + {g : Finset K // + g ∈ (B.strictBoundary g₀).edges}, + A g.1 (edgeTuple g.1 x) := by + apply Finset.prod_congr rfl + intro g _hg + apply congrArg (A g.1) + exact restrictEdgeTuple_edgeTuple _ x + _ = + ∏ g ∈ (B.strictBoundary g₀).edges, + A g (edgeTuple g x) := + Finset.prod_coe_sort + (B.strictBoundary g₀).edges + (fun g => A g (edgeTuple g x)) + _ = (B.strictBoundary g₀).bundleProduct A x := by + rfl + +theorem strictBoundary_edges_subset_erase + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.strictBoundary g₀).edges ⊆ + B.edges.erase g₀ := by + intro g hg + have hg' := + (B.mem_strictBoundary_edges g₀ g).1 hg + exact Finset.mem_erase.mpr + ⟨hg'.2.ne, hg'.1⟩ + +def WeightsIdempotent + (B : HypergraphBundle J K H) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : Prop := + ∀ g ∈ B.edges, ∀ y, + A g y * A g y = A g y + +theorem pullbackBaseEdgeWeight_weightsIdempotent + (B : HypergraphBundle J K H) + (A : BaseEdgeWeight J G) + (hA : BaseWeightsIdempotent H A) : + B.WeightsIdempotent + (B.pullbackBaseEdgeWeight A) := by + intro g hg y + rw [B.pullbackBaseEdgeWeight_of_mem A hg y] + exact hA _ (B.projection_mem_base g hg) _ + +theorem prod_mul_prod_eq_right_of_subset_of_idempotent + {ι : Type*} + (s t : Finset ι) (f : ι → ℝ) + (hst : s ⊆ t) + (hf : ∀ i ∈ s, f i * f i = f i) : + (∏ i ∈ s, f i) * (∏ i ∈ t, f i) = + ∏ i ∈ t, f i := by + classical + induction s using Finset.induction_on generalizing t with + | empty => + simp + | @insert a s ha ih => + have hat : a ∈ t := + hst (Finset.mem_insert_self a s) + have hst' : s ⊆ t.erase a := by + intro i hi + exact Finset.mem_erase.mpr + ⟨fun hia => ha (hia ▸ hi), + hst (Finset.mem_insert_of_mem hi)⟩ + have hf' : + ∀ i ∈ s, f i * f i = f i := by + intro i hi + exact hf i (Finset.mem_insert_of_mem hi) + rw [Finset.prod_insert ha] + rw [← Finset.mul_prod_erase t f hat] + calc + (f a * ∏ i ∈ s, f i) * + (f a * ∏ i ∈ t.erase a, f i) = + (f a * f a) * + ((∏ i ∈ s, f i) * + ∏ i ∈ t.erase a, f i) := by + ring + _ = + f a * + ((∏ i ∈ s, f i) * + ∏ i ∈ t.erase a, f i) := by + rw [hf a (Finset.mem_insert_self a s)] + _ = f a * ∏ i ∈ t.erase a, f i := by + rw [ih (t.erase a) hst' hf'] + +theorem strictBoundaryLocalProduct_mul_edgeRemainder + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (hA : B.WeightsIdempotent A) + (x : K → G) : + B.strictBoundaryLocalProduct g₀ A + (edgeTuple g₀ x) * + B.edgeRemainder g₀ A x = + B.edgeRemainder g₀ A x := by + rw [B.strictBoundaryLocalProduct_edgeTuple] + unfold edgeRemainder bundleProduct + apply prod_mul_prod_eq_right_of_subset_of_idempotent + (B.strictBoundary g₀).edges + (B.edges.erase g₀) + (fun g => A g (edgeTuple g x)) + (B.strictBoundary_edges_subset_erase g₀) + intro g hg + exact hA g + (Finset.mem_of_mem_erase + (B.strictBoundary_edges_subset_erase g₀ hg)) + (edgeTuple g x) + +theorem edgeContribution_mul_strictBoundaryLocalProduct + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) (g₀ : Finset K) + (q : ({v : K // v ∈ g₀} → G) → ℝ) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (hA : B.WeightsIdempotent A) : + B.edgeContribution g₀ q A = + B.edgeContribution g₀ + (fun y => + q y * + B.strictBoundaryLocalProduct g₀ A y) + A := by + unfold edgeContribution + apply congrArg mean + funext x + rw [mul_assoc, + B.strictBoundaryLocalProduct_mul_edgeRemainder + g₀ A hA x] + +noncomputable def lowerExteriorMainProduct + (B : HypergraphBundle J K H) (g₀ : Finset K) + (p : Finset J → ℝ) : ℝ := + ∏ g ∈ B.edges.filter + (fun g => + g.card < g₀.card ∧ ¬ g ⊆ g₀), + p (g.image B.projection) + +noncomputable def maximalRemainderMainProduct + (B : HypergraphBundle J K H) (g₀ : Finset K) + (p : Finset J → ℝ) : ℝ := + ∏ g ∈ (B.edges.erase g₀).filter + (fun g => ¬ g.card < g₀.card), + p (g.image B.projection) + +theorem card_image_projection + (B : HypergraphBundle J K H) + {g : Finset K} (hg : g ∈ B.edges) : + (g.image B.projection).card = g.card := by + have hcard := + Fintype.card_congr (B.projectionEquiv hg) + simpa using hcard.symm + +theorem pow_card_edges_le_bundleMainProduct + (B : HypergraphBundle J K H) + (p : Finset J → ℝ) {a : ℝ} + (ha : 0 ≤ a) + (hp : ∀ e ∈ H, a ≤ p e) : + a ^ B.edges.card ≤ B.bundleMainProduct p := by + classical + unfold bundleMainProduct + calc + a ^ B.edges.card = + ∏ _g ∈ B.edges, a := by + simp + _ ≤ + ∏ g ∈ B.edges, + p (g.image B.projection) := by + apply Finset.prod_le_prod₀ + · intro g hg + exact ha + · intro g hg + exact hp _ (B.projection_mem_base g hg) + +theorem bundleMainProduct_nonneg + (B : HypergraphBundle J K H) + (p : Finset J → ℝ) + (hp : ∀ e ∈ H, 0 ≤ p e) : + 0 ≤ B.bundleMainProduct p := by + unfold bundleMainProduct + exact Finset.prod_nonneg fun g hg => + hp _ (B.projection_mem_base g hg) + +theorem bundleMainProduct_lowerOrder_eq_boundary_mul_exterior + (B : HypergraphBundle J K H) (g₀ : Finset K) + (p : Finset J → ℝ) : + (B.lowerOrder g₀.card).bundleMainProduct p = + (B.strictBoundary g₀).bundleMainProduct p * + B.lowerExteriorMainProduct g₀ p := by + classical + let s := + B.edges.filter + (fun g => g.card < g₀.card) + have hboundary : + s.filter (fun g => g ⊆ g₀) = + B.edges.filter (fun g => g ⊂ g₀) := by + ext g + simp only [s, Finset.mem_filter] + constructor + · rintro ⟨⟨hgB, hgcard⟩, hgsub⟩ + exact ⟨hgB, + Finset.ssubset_iff_subset_ne.mpr + ⟨hgsub, fun hgeq => by + subst g + exact (Nat.lt_irrefl _ hgcard)⟩⟩ + · rintro ⟨hgB, hgstrict⟩ + exact ⟨⟨hgB, Finset.card_lt_card hgstrict⟩, + hgstrict.1⟩ + have hexterior : + s.filter (fun g => ¬ g ⊆ g₀) = + B.edges.filter + (fun g => + g.card < g₀.card ∧ ¬ g ⊆ g₀) := by + ext g + simp only [s, Finset.mem_filter] + tauto + have hsplit := + Finset.prod_filter_mul_prod_filter_not + s (fun g => g ⊆ g₀) + (fun g => p (g.image B.projection)) + unfold bundleMainProduct lowerExteriorMainProduct + simp only [lowerOrder_edges, strictBoundary_edges] + rw [← hboundary, ← hexterior] + exact hsplit.symm + +theorem boundary_mul_duplicateLower_main_eq_lowerOrder_sq + (B : HypergraphBundle J K H) (g₀ : Finset K) + (p : Finset J → ℝ) : + (B.strictBoundary g₀).bundleMainProduct p * + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleMainProduct p = + ((B.lowerOrder g₀.card).bundleMainProduct p) ^ 2 := by + rw [B.bundleMainProduct_duplicateOutside_lowerOrder + g₀ p] + rw [Finset.prod_pow] + rw [B.bundleMainProduct_lowerOrder_eq_boundary_mul_exterior + g₀ p] + unfold lowerExteriorMainProduct + ring + +theorem lowerOrder_mul_maximalRemainder_eq_erase_main + (B : HypergraphBundle J K H) (g₀ : Finset K) + (p : Finset J → ℝ) : + (B.lowerOrder g₀.card).bundleMainProduct p * + B.maximalRemainderMainProduct g₀ p = + (B.eraseEdge g₀).bundleMainProduct p := by + classical + have hlower : + (B.edges.erase g₀).filter + (fun g => g.card < g₀.card) = + B.edges.filter + (fun g => g.card < g₀.card) := by + ext g + simp only [Finset.mem_filter, Finset.mem_erase] + constructor + · rintro ⟨⟨_hne, hgB⟩, hgcard⟩ + exact ⟨hgB, hgcard⟩ + · rintro ⟨hgB, hgcard⟩ + exact ⟨⟨fun hgg₀ => by + subst g + exact Nat.lt_irrefl _ hgcard, hgB⟩, + hgcard⟩ + have hsplit := + Finset.prod_filter_mul_prod_filter_not + (B.edges.erase g₀) + (fun g => g.card < g₀.card) + (fun g => p (g.image B.projection)) + unfold bundleMainProduct maximalRemainderMainProduct + simp only [lowerOrder_edges, eraseEdge_edges] + rw [← hlower] + exact hsplit + +theorem card_eq_selected_of_mem_maximalRemainder + (B : HypergraphBundle J K H) + {g₀ g : Finset K} + (hmax : ∀ f ∈ B.edges, f.card ≤ g₀.card) + (hg : + g ∈ (B.edges.erase g₀).filter + (fun f => ¬ f.card < g₀.card)) : + g.card = g₀.card := by + have hg' := Finset.mem_filter.mp hg + exact Nat.le_antisymm + (hmax g (Finset.mem_of_mem_erase hg'.1)) + (Nat.le_of_not_gt hg'.2) + +theorem card_maximalRemainder_le_erase + (B : HypergraphBundle J K H) (g₀ : Finset K) : + ((B.edges.erase g₀).filter + (fun g => ¬ g.card < g₀.card)).card ≤ + (B.edges.erase g₀).card := + Finset.card_le_card (Finset.filter_subset _ _) + +theorem pow_card_maximalRemainder_le + (B : HypergraphBundle J K H) + {g₀ : Finset K} + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (p : Finset J → ℝ) {a : ℝ} + (ha : 0 ≤ a) + (hp : + ∀ e ∈ H, e.card = g₀.card → + a ≤ p e) : + a ^ + ((B.edges.erase g₀).filter + (fun g => ¬ g.card < g₀.card)).card ≤ + B.maximalRemainderMainProduct g₀ p := by + classical + unfold maximalRemainderMainProduct + calc + a ^ + ((B.edges.erase g₀).filter + (fun g => ¬ g.card < g₀.card)).card = + ∏ _g ∈ + (B.edges.erase g₀).filter + (fun g => ¬ g.card < g₀.card), + a := by + simp + _ ≤ + ∏ g ∈ + (B.edges.erase g₀).filter + (fun g => ¬ g.card < g₀.card), + p (g.image B.projection) := by + apply Finset.prod_le_prod₀ + · intro g hg + exact ha + · intro g hg + apply hp _ (B.projection_mem_base g + (Finset.mem_of_mem_erase + (Finset.mem_filter.mp hg).1)) + rw [B.card_image_projection + (Finset.mem_of_mem_erase + (Finset.mem_filter.mp hg).1)] + exact B.card_eq_selected_of_mem_maximalRemainder + hmax hg + +theorem pullbackBaseEdgeWeight_eq_of_projection_eq + (B C : HypergraphBundle J K H) + (A : BaseEdgeWeight J G) + (hprojection : B.projection = C.projection) + {g : Finset K} + (hgB : g ∈ B.edges) (hgC : g ∈ C.edges) + (y : {v : K // v ∈ g} → G) : + B.pullbackBaseEdgeWeight A g y = + C.pullbackBaseEdgeWeight A g y := by + classical + rw [B.pullbackBaseEdgeWeight_of_mem A hgB y, + C.pullbackBaseEdgeWeight_of_mem A hgC y] + have himage : + g.image B.projection = g.image C.projection := + congrArg (fun q : K → J => g.image q) hprojection + let lhsInput : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) := + ⟨g.image B.projection, + B.projectedEdgeTuple hgB y⟩ + let rhsInput : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) := + ⟨g.image C.projection, + C.projectedEdgeTuple hgC y⟩ + change + (fun p : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) => + A p.1 p.2) lhsInput = + (fun p : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) => + A p.1 p.2) rhsInput + apply congrArg + (fun p : + (Σ e : Finset J, + ({j : J // j ∈ e} → G)) => + A p.1 p.2) + apply Sigma.ext himage + apply heq_of_eqRec_eq + (congrArg + (fun e : Finset J => + ({j : J // j ∈ e} → G)) + himage) + funext j + change + cast + (congrArg + (fun e : Finset J => + ({j : J // j ∈ e} → G)) + himage) + lhsInput.2 j = + rhsInput.2 j + rw [cast_finsetPi_apply himage] + let jB : + {j : J // j ∈ g.image B.projection} := + (finsetMembershipEquivOfEq himage).symm j + let vB := (B.projectionEquiv hgB).symm jB + let vC := (C.projectionEquiv hgC).symm j + have hjB : jB.1 = j.1 := + finsetMembershipEquivOfEq_symm_val himage j + have hvB : + B.projection vB.1 = jB.1 := by + exact congrArg Subtype.val + ((B.projectionEquiv hgB).apply_symm_apply jB) + have hvC' : + C.projection vC.1 = j.1 := by + exact congrArg Subtype.val + ((C.projectionEquiv hgC).apply_symm_apply j) + have hvC : + B.projection vC.1 = j.1 := by + rw [hprojection] + exact hvC' + have hval : vB.1 = vC.1 := + B.projection_injective_on_edge g hgB + vB.2 vC.2 + ((hvB.trans hjB).trans hvC.symm) + unfold lhsInput rhsInput projectedEdgeTuple + change y vB = y vC + exact congrArg y (Subtype.ext hval) + +theorem doubledEdges_lowerOrder_subset + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.lowerOrder g₀.card).doubledEdges g₀ ⊆ + B.doubledEdges g₀ := by + intro d hd + obtain ⟨copy, g, hg, hgd⟩ := + ((B.lowerOrder g₀.card).mem_doubledEdges_iff + g₀ d).1 hd + apply (B.mem_doubledEdges_iff g₀ d).2 + refine ⟨copy, g, ?_, hgd⟩ + have hgLower : + g ∈ (B.lowerOrder g₀.card).edges := + Finset.mem_of_mem_erase hg + exact Finset.mem_erase.mpr + ⟨(Finset.mem_erase.mp hg).1, + ((B.mem_lowerOrder_edges g₀.card g).1 + hgLower).1⟩ + +theorem duplicateOutside_bundleProduct_le_lowerOrder + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : BaseEdgeWeight J G) + (hA : BaseWeightsInUnitInterval H A) + (x : DoubledOccurrenceVertex g₀ → G) : + (B.duplicateOutside g₀).bundleProduct + ((B.duplicateOutside g₀).pullbackBaseEdgeWeight A) x ≤ + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleProduct + (((B.lowerOrder g₀.card).duplicateOutside g₀).pullbackBaseEdgeWeight A) x := by + classical + let C := B.duplicateOutside g₀ + let D := (B.lowerOrder g₀.card).duplicateOutside g₀ + have hDC : D.edges ⊆ C.edges := by + simpa [C, D] using + B.doubledEdges_lowerOrder_subset g₀ + have hprojection : C.projection = D.projection := by + rfl + unfold bundleProduct + calc + (∏ d ∈ C.edges, + C.pullbackBaseEdgeWeight A + d (edgeTuple d x)) ≤ + ∏ d ∈ D.edges, + C.pullbackBaseEdgeWeight A + d (edgeTuple d x) := by + apply Finset.prod_le_prod_of_subset_of_le_one₀ + hDC + · intro d hd + exact + (C.pullbackBaseEdgeWeight_unitInterval + A hA hd (edgeTuple d x)).1 + · intro d hd _hdD + exact + (C.pullbackBaseEdgeWeight_unitInterval + A hA hd (edgeTuple d x)).2 + _ = + ∏ d ∈ D.edges, + D.pullbackBaseEdgeWeight A + d (edgeTuple d x) := by + apply Finset.prod_congr rfl + intro d hd + exact C.pullbackBaseEdgeWeight_eq_of_projection_eq + D A hprojection (hDC hd) hd (edgeTuple d x) + +theorem doubledRemainderMoment_pullback_le_lowerOrder + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (A : BaseEdgeWeight J G) + (hA01 : BaseWeightsInUnitInterval H A) + (hAidempotent : BaseWeightsIdempotent H A) : + B.doubledRemainderMoment g₀ + (B.pullbackBaseEdgeWeight A) ≤ + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleCount + (((B.lowerOrder g₀.card).duplicateOutside g₀).pullbackBaseEdgeWeight A) := by + rw [B.doubledRemainderMoment_pullback_eq_duplicateOutside_bundleCount + hclosed hg₀ hmax A hAidempotent] + unfold bundleCount + apply mean_mono + intro x + exact B.duplicateOutside_bundleProduct_le_lowerOrder + g₀ A hA01 x + +theorem abs_edgeContribution_pullback_le_sqrt_boundary_mul_lowerOrder + [Fintype K] [Fintype G] [Nonempty G] + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (A : BaseEdgeWeight J G) + (hA01 : BaseWeightsInUnitInterval H A) + (hAidempotent : BaseWeightsIdempotent H A) + (q : ({v : K // v ∈ g₀} → G) → ℝ) + {β : ℝ} (hβ : 0 ≤ β) + (hlocalized : + mean (fun y => q y ^ 2) ≤ + β * + (B.strictBoundary g₀).bundleCount + ((B.strictBoundary g₀).pullbackBaseEdgeWeight A)) : + |B.edgeContribution g₀ q + (B.pullbackBaseEdgeWeight A)| ≤ + Real.sqrt + ((β * + (B.strictBoundary g₀).bundleCount + ((B.strictBoundary g₀).pullbackBaseEdgeWeight A)) * + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleCount + (((B.lowerOrder g₀.card).duplicateOutside g₀).pullbackBaseEdgeWeight A)) := by + let boundaryCount := + (B.strictBoundary g₀).bundleCount + ((B.strictBoundary g₀).pullbackBaseEdgeWeight A) + let lowerDoubledCount := + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleCount + (((B.lowerOrder g₀.card).duplicateOutside g₀).pullbackBaseEdgeWeight A) + have hboundary0 : 0 ≤ boundaryCount := by + apply (B.strictBoundary g₀).bundleCount_nonneg + exact + (B.strictBoundary g₀).pullbackBaseEdgeWeight_weightsInUnitInterval + A hA01 + have hlower0 : 0 ≤ lowerDoubledCount := by + apply + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleCount_nonneg + exact + ((B.lowerOrder g₀.card).duplicateOutside g₀).pullbackBaseEdgeWeight_weightsInUnitInterval + A hA01 + have hmoment0 : + 0 ≤ B.doubledRemainderMoment g₀ + (B.pullbackBaseEdgeWeight A) := + B.doubledRemainderMoment_nonneg g₀ + (B.pullbackBaseEdgeWeight A) + have hmoment : + B.doubledRemainderMoment g₀ + (B.pullbackBaseEdgeWeight A) ≤ + lowerDoubledCount := + B.doubledRemainderMoment_pullback_le_lowerOrder + hclosed hg₀ hmax A hA01 hAidempotent + have hsq : + B.edgeContribution g₀ q + (B.pullbackBaseEdgeWeight A) ^ 2 ≤ + (β * boundaryCount) * lowerDoubledCount := by + calc + B.edgeContribution g₀ q + (B.pullbackBaseEdgeWeight A) ^ 2 ≤ + mean (fun y => q y ^ 2) * + B.doubledRemainderMoment g₀ + (B.pullbackBaseEdgeWeight A) := + B.edgeContribution_sq_le_localSquare_mul_doubled + g₀ q (B.pullbackBaseEdgeWeight A) + _ ≤ + (β * boundaryCount) * + B.doubledRemainderMoment g₀ + (B.pullbackBaseEdgeWeight A) := + mul_le_mul_of_nonneg_right hlocalized hmoment0 + _ ≤ (β * boundaryCount) * lowerDoubledCount := + mul_le_mul_of_nonneg_left hmoment + (mul_nonneg hβ hboundary0) + have hradicand : + 0 ≤ (β * boundaryCount) * lowerDoubledCount := + mul_nonneg (mul_nonneg hβ hboundary0) hlower0 + apply + (sq_le_sq₀ + (abs_nonneg + (B.edgeContribution g₀ q + (B.pullbackBaseEdgeWeight A))) + (Real.sqrt_nonneg _)).mp + rw [sq_abs, Real.sq_sqrt hradicand] + exact hsq + +end HypergraphBundle + +structure IsBundleCountingEnvelope + (α β μ : ℕ → ℝ) (τ : ℝ) + (E : ℕ → ℕ → ℝ) : Prop where + density_pos : ∀ d, 0 < α d + density_le_one : ∀ d, α d ≤ 1 + defect_nonneg : ∀ d, 0 ≤ β d + uniform_nonneg : 0 ≤ τ + floor_pos : ∀ d, 0 < μ d + rankFloor : + ∀ ⦃i d : ℕ⦄, i ≤ d → μ d ≤ α i + error_nonneg : + ∀ d n, 0 ≤ E d n + error_mono_order : + ∀ ⦃d d' n : ℕ⦄, d ≤ d' → + E d n ≤ E d' n + error_mono_card : + ∀ ⦃d n n' : ℕ⦄, n ≤ n' → + E d n ≤ E d n' + step : + ∀ d n, + E (d + 1) n + + Real.sqrt + (β (d + 1) * + (1 + E d (n + 1)) * + (1 + E d (2 * (n + 1)))) / + (α (d + 1)) ^ (n + 1) + + τ / (μ (d + 1)) ^ (n + 1) ≤ + E (d + 1) (n + 1) + +noncomputable def bundleCountingStepIncrement + (α β μ : ℕ → ℝ) (τ : ℝ) + (E : ℕ → ℕ → ℝ) + (d n : ℕ) : ℝ := + Real.sqrt + (β (d + 1) * + (1 + E d (n + 1)) * + (1 + E d (2 * (n + 1)))) / + (α (d + 1)) ^ (n + 1) + + τ / (μ (d + 1)) ^ (n + 1) + +theorem IsBundleCountingEnvelope.add_stepIncrement_le + {α β μ : ℕ → ℝ} {τ : ℝ} + {E : ℕ → ℕ → ℝ} + (hE : IsBundleCountingEnvelope α β μ τ E) + (d n : ℕ) : + E (d + 1) n + + bundleCountingStepIncrement α β μ τ E d n ≤ + E (d + 1) (n + 1) := by + simpa [bundleCountingStepIncrement, add_assoc] using hE.step d n + +theorem IsBundleCountingEnvelope.lower_correction_nonneg + {α β μ : ℕ → ℝ} {τ : ℝ} + {E : ℕ → ℕ → ℝ} + (hE : IsBundleCountingEnvelope α β μ τ E) + (d n : ℕ) : + 0 ≤ + (1 + E d (n + 1)) * + (1 + E d (2 * (n + 1))) := by + exact mul_nonneg + (by linarith [hE.error_nonneg d (n + 1)]) + (by linarith [hE.error_nonneg d (2 * (n + 1))]) + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open Filter Topology + +noncomputable def bundleCommonStepIncrement + (a t : ℝ) (lower : ℕ → ℝ) (n : ℕ) : ℝ := + Real.sqrt + (t ^ 2 * + (1 + lower (n + 1)) * + (1 + lower (2 * (n + 1)))) / + a ^ (n + 1) + + t ^ 2 / a ^ (n + 1) + +noncomputable def bundleCommonNextRow + (a t : ℝ) (lower : ℕ → ℝ) : ℕ → ℝ + | 0 => 0 + | n + 1 => + bundleCommonNextRow a t lower n + + bundleCommonStepIncrement a t lower n + +noncomputable def bundleCommonEnvelopeError + (a t : ℝ) : ℕ → ℕ → ℝ + | 0 => fun _ => 0 + | d + 1 => + bundleCommonNextRow a t + (bundleCommonEnvelopeError a t d) + +@[simp] +theorem bundleCommonNextRow_zero + (a t : ℝ) (lower : ℕ → ℝ) : + bundleCommonNextRow a t lower 0 = 0 := + rfl + +@[simp] +theorem bundleCommonNextRow_succ + (a t : ℝ) (lower : ℕ → ℝ) (n : ℕ) : + bundleCommonNextRow a t lower (n + 1) = + bundleCommonNextRow a t lower n + + bundleCommonStepIncrement a t lower n := + rfl + +@[simp] +theorem bundleCommonEnvelopeError_zero_order + (a t : ℝ) (n : ℕ) : + bundleCommonEnvelopeError a t 0 n = 0 := + rfl + +@[simp] +theorem bundleCommonEnvelopeError_succ_order + (a t : ℝ) (d n : ℕ) : + bundleCommonEnvelopeError a t (d + 1) n = + bundleCommonNextRow a t + (bundleCommonEnvelopeError a t d) n := + rfl + +theorem bundleCommonNextRow_nonneg + {a t : ℝ} (ha : 0 ≤ a) + (lower : ℕ → ℝ) : + ∀ n, 0 ≤ bundleCommonNextRow a t lower n := by + intro n + induction n with + | zero => + simp + | succ n ihn => + rw [bundleCommonNextRow_succ] + apply add_nonneg ihn + unfold bundleCommonStepIncrement + exact add_nonneg + (div_nonneg (Real.sqrt_nonneg _) + (pow_nonneg ha _)) + (div_nonneg (sq_nonneg t) + (pow_nonneg ha _)) + +theorem bundleCommonEnvelopeError_nonneg + {a t : ℝ} (ha : 0 ≤ a) : + ∀ d n, 0 ≤ bundleCommonEnvelopeError a t d n := by + intro d + induction d with + | zero => + intro n + simp + | succ d _ih => + intro n + rw [bundleCommonEnvelopeError_succ_order] + exact bundleCommonNextRow_nonneg ha _ n + +theorem bundleCommonStepIncrement_mono + {a t : ℝ} (ha : 0 ≤ a) + {lower₁ lower₂ : ℕ → ℝ} + (hlower₁ : ∀ n, 0 ≤ lower₁ n) + (hlower : ∀ n, lower₁ n ≤ lower₂ n) + (n : ℕ) : + bundleCommonStepIncrement a t lower₁ n ≤ + bundleCommonStepIncrement a t lower₂ n := by + have h₁nonneg : + 0 ≤ 1 + lower₁ (n + 1) := by + linarith [hlower₁ (n + 1)] + have h₂nonneg : + 0 ≤ 1 + lower₁ (2 * (n + 1)) := by + linarith [hlower₁ (2 * (n + 1))] + have hright₁nonneg : + 0 ≤ 1 + lower₂ (n + 1) := by + linarith [hlower₁ (n + 1), hlower (n + 1)] + have hproduct : + (1 + lower₁ (n + 1)) * + (1 + lower₁ (2 * (n + 1))) ≤ + (1 + lower₂ (n + 1)) * + (1 + lower₂ (2 * (n + 1))) := by + exact mul_le_mul + (by linarith [hlower (n + 1)]) + (by linarith [hlower (2 * (n + 1))]) + h₂nonneg hright₁nonneg + have hradicand : + t ^ 2 * + (1 + lower₁ (n + 1)) * + (1 + lower₁ (2 * (n + 1))) ≤ + t ^ 2 * + (1 + lower₂ (n + 1)) * + (1 + lower₂ (2 * (n + 1))) := by + simpa [mul_assoc] using + mul_le_mul_of_nonneg_left hproduct (sq_nonneg t) + unfold bundleCommonStepIncrement + apply add_le_add + · exact div_le_div_of_nonneg_right + (Real.sqrt_le_sqrt hradicand) + (pow_nonneg ha _) + · exact le_rfl + +theorem bundleCommonNextRow_mono + {a t : ℝ} (ha : 0 ≤ a) + {lower₁ lower₂ : ℕ → ℝ} + (hlower₁ : ∀ n, 0 ≤ lower₁ n) + (hlower : ∀ n, lower₁ n ≤ lower₂ n) : + ∀ n, + bundleCommonNextRow a t lower₁ n ≤ + bundleCommonNextRow a t lower₂ n := by + intro n + induction n with + | zero => + simp + | succ n ihn => + rw [bundleCommonNextRow_succ, + bundleCommonNextRow_succ] + exact add_le_add ihn + (bundleCommonStepIncrement_mono + ha hlower₁ hlower n) + +theorem bundleCommonEnvelopeError_monotone_card + {a t : ℝ} (ha : 0 ≤ a) (d : ℕ) : + Monotone (bundleCommonEnvelopeError a t d) := by + apply monotone_nat_of_le_succ + intro n + cases d with + | zero => + simp + | succ d => + rw [bundleCommonEnvelopeError_succ_order, + bundleCommonEnvelopeError_succ_order, + bundleCommonNextRow_succ] + exact le_add_of_nonneg_right + (by + unfold bundleCommonStepIncrement + exact add_nonneg + (div_nonneg (Real.sqrt_nonneg _) + (pow_nonneg ha _)) + (div_nonneg (sq_nonneg t) + (pow_nonneg ha _))) + +theorem bundleCommonEnvelopeError_monotone_order + {a t : ℝ} (ha : 0 ≤ a) : + ∀ n, Monotone (fun d => + bundleCommonEnvelopeError a t d n) := by + intro n + apply monotone_nat_of_le_succ + intro d + induction d generalizing n with + | zero => + simp only [bundleCommonEnvelopeError_zero_order] + exact bundleCommonEnvelopeError_nonneg ha 1 n + | succ d ihd => + rw [bundleCommonEnvelopeError_succ_order, + bundleCommonEnvelopeError_succ_order] + apply bundleCommonNextRow_mono ha + · exact bundleCommonEnvelopeError_nonneg ha d + · intro m + exact ihd m + +theorem bundleCommonEnvelopeError_isEnvelope + {a t : ℝ} (ha : 0 < a) (ha_one : a ≤ 1) : + IsBundleCountingEnvelope + (fun _ => a) (fun _ => t ^ 2) (fun _ => a) (t ^ 2) + (bundleCommonEnvelopeError a t) := by + refine + { density_pos := fun _ => ha + density_le_one := fun _ => ha_one + defect_nonneg := fun _ => sq_nonneg t + uniform_nonneg := sq_nonneg t + floor_pos := fun _ => ha + rankFloor := ?_ + error_nonneg := + bundleCommonEnvelopeError_nonneg ha.le + error_mono_order := ?_ + error_mono_card := ?_ + step := ?_ } + · intro i d hid + exact le_rfl + · intro d d' n hdd' + exact + (bundleCommonEnvelopeError_monotone_order + ha.le n) hdd' + · intro d n n' hnn' + exact + (bundleCommonEnvelopeError_monotone_card + ha.le d) hnn' + · intro d n + rw [bundleCommonEnvelopeError_succ_order, + bundleCommonEnvelopeError_succ_order, + bundleCommonNextRow_succ] + unfold bundleCommonStepIncrement + ring_nf + exact le_rfl + +@[simp] +theorem bundleCommonNextRow_zero_parameter + (a : ℝ) (lower : ℕ → ℝ) + (hlower : ∀ n, lower n = 0) : + ∀ n, bundleCommonNextRow a 0 lower n = 0 := by + intro n + induction n with + | zero => + simp + | succ n ihn => + rw [bundleCommonNextRow_succ, ihn] + simp [bundleCommonStepIncrement, hlower] + +@[simp] +theorem bundleCommonEnvelopeError_zero_parameter + (a : ℝ) : + ∀ d n, bundleCommonEnvelopeError a 0 d n = 0 := by + intro d + induction d with + | zero => + intro n + simp + | succ d ihd => + intro n + rw [bundleCommonEnvelopeError_succ_order] + exact bundleCommonNextRow_zero_parameter a + (bundleCommonEnvelopeError a 0 d) ihd n + +theorem continuous_bundleCommonNextRow + (a : ℝ) (lower : ℝ → ℕ → ℝ) + (hlower : ∀ n, Continuous (fun t => lower t n)) : + ∀ n, + Continuous + (fun t => + bundleCommonNextRow a t (lower t) n) := by + intro n + induction n with + | zero => + simp only [bundleCommonNextRow_zero] + fun_prop + | succ n ihn => + simp only [bundleCommonNextRow_succ, + bundleCommonStepIncrement] + have h₁ := hlower (n + 1) + have h₂ := hlower (2 * (n + 1)) + fun_prop + +theorem continuous_bundleCommonEnvelopeError_real + (a : ℝ) : + ∀ d n, + Continuous + (fun t : ℝ => + bundleCommonEnvelopeError a t d n) := by + intro d + induction d with + | zero => + intro n + simp only [bundleCommonEnvelopeError_zero_order] + fun_prop + | succ d ihd => + intro n + change + Continuous (fun t : ℝ => + bundleCommonNextRow a t + (bundleCommonEnvelopeError a t d) n) + exact continuous_bundleCommonNextRow + a + (fun t m => + bundleCommonEnvelopeError a t d m) + ihd n + +theorem tendsto_bundleCommonEnvelopeError_zero + (a : ℝ) (d n : ℕ) : + Tendsto + (fun t : ℝ => + bundleCommonEnvelopeError a t d n) + (𝓝 0) (𝓝 0) := by + simpa using + (continuous_bundleCommonEnvelopeError_real a d n).tendsto 0 + +theorem exists_bundleCommonEnvelopeError_lt + (a : ℝ) (rankBound edgeBound : ℕ) + {parameterReserve errorReserve : ℝ} + (hparameter : 0 < parameterReserve) + (herror : 0 < errorReserve) : + ∃ t : ℝ, + 0 < t ∧ t < parameterReserve ∧ t < 1 ∧ + bundleCommonEnvelopeError + a t rankBound edgeBound < + errorReserve := by + have heventually : + ∀ᶠ t : ℝ in 𝓝 0, + bundleCommonEnvelopeError + a t rankBound edgeBound < + errorReserve := + (tendsto_bundleCommonEnvelopeError_zero + a rankBound edgeBound).eventually_lt_const herror + obtain ⟨δ, hδ, hball⟩ := + Metric.eventually_nhds_iff_ball.mp heventually + let t : ℝ := min δ (min parameterReserve 1) / 2 + have hmin : + 0 < min δ (min parameterReserve 1) := by + exact lt_min hδ (lt_min hparameter zero_lt_one) + have ht : 0 < t := by + dsimp [t] + linarith + have htδ : t < δ := by + dsimp [t] + have hle : + min δ (min parameterReserve 1) ≤ δ := + min_le_left _ _ + linarith + have htparameter : t < parameterReserve := by + dsimp [t] + have hle : + min δ (min parameterReserve 1) ≤ + min parameterReserve 1 := + min_le_right _ _ + have hle' : min parameterReserve 1 ≤ parameterReserve := + min_le_left _ _ + linarith + have htone : t < 1 := by + dsimp [t] + have hle : + min δ (min parameterReserve 1) ≤ + min parameterReserve 1 := + min_le_right _ _ + have hle' : min parameterReserve 1 ≤ 1 := + min_le_right _ _ + linarith + refine ⟨t, ht, htparameter, htone, ?_⟩ + apply hball + simpa [Real.dist_eq, abs_of_pos ht] using htδ + +theorem exists_bundleCommonEnvelopeError_lt_half + {a : ℝ} (ha : 0 < a) (ha_one : a ≤ 1) + (rankBound edgeBound : ℕ) : + ∃ t : ℝ, + 0 < t ∧ t < 1 ∧ + IsBundleCountingEnvelope + (fun _ => a) (fun _ => t ^ 2) (fun _ => a) (t ^ 2) + (bundleCommonEnvelopeError a t) ∧ + bundleCommonEnvelopeError + a t rankBound edgeBound < 1 / 2 := by + obtain ⟨t, ht, htone, _htone', hfinal⟩ := + exists_bundleCommonEnvelopeError_lt + a rankBound edgeBound zero_lt_one + (by norm_num : (0 : ℝ) < 1 / 2) + exact ⟨t, ht, htone, + bundleCommonEnvelopeError_isEnvelope ha ha_one, + hfinal⟩ + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleFiltration.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleFiltration.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1ecb0cddfea497ff42346540652602a80f290fc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleFiltration.lean @@ -0,0 +1,1151 @@ +import OAI.Combinatorics.Progressions.FixedDensity.BundleCountingRecurrence + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {J K G : Type*} + [DecidableEq J] [DecidableEq K] + {H : Finset (Finset J)} + +abbrev DoubledOccurrenceVertex (g₀ : Finset K) := + {v : K // v ∈ g₀} ⊕ (Bool × EdgeComplement g₀) + +def doubledVertexForget + (g₀ : Finset K) : + DoubledOccurrenceVertex g₀ → K + | Sum.inl v => v.1 + | Sum.inr v => v.2.1 + +def doubledVertexLift + (g₀ : Finset K) (copy : Bool) (v : K) : + DoubledOccurrenceVertex g₀ := + if hv : v ∈ g₀ then + Sum.inl ⟨v, hv⟩ + else + Sum.inr ⟨copy, ⟨v, hv⟩⟩ + +@[simp] +theorem doubledVertexForget_lift + (g₀ : Finset K) (copy : Bool) (v : K) : + doubledVertexForget g₀ + (doubledVertexLift g₀ copy v) = v := by + by_cases hv : v ∈ g₀ <;> + simp [doubledVertexLift, doubledVertexForget, hv] + +theorem doubledVertexLift_injective + (g₀ : Finset K) (copy : Bool) : + Function.Injective (doubledVertexLift g₀ copy) := by + intro v w hvw + have h := + congrArg (doubledVertexForget g₀) hvw + simpa using h + +def doubledAssignment + (g₀ : Finset K) + (y : {v : K // v ∈ g₀} → G) + (z : (EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G)) : + DoubledOccurrenceVertex g₀ → G + | Sum.inl v => y v + | Sum.inr (false, v) => z.1 v + | Sum.inr (true, v) => z.2 v + +def splitDoubledAssignmentEquiv + (g₀ : Finset K) : + (DoubledOccurrenceVertex g₀ → G) ≃ + (({v : K // v ∈ g₀} → G) × + ((EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G))) where + toFun x := + (fun v => x (Sum.inl v), + (fun v => x (Sum.inr (false, v)), + fun v => x (Sum.inr (true, v)))) + invFun p := doubledAssignment g₀ p.1 p.2 + left_inv x := by + funext v + rcases v with v | ⟨copy, v⟩ + · rfl + · cases copy <;> rfl + right_inv p := by + rcases p with ⟨y, zfalse, ztrue⟩ + rfl + +omit [DecidableEq K] in +@[simp] +theorem splitDoubledAssignmentEquiv_symm_apply + (g₀ : Finset K) + (y : {v : K // v ∈ g₀} → G) + (z : (EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G)) : + (splitDoubledAssignmentEquiv g₀).symm (y, z) = + doubledAssignment g₀ y z := + rfl + +theorem mean_splitDoubledAssignment + [Fintype K] [Fintype G] + (g₀ : Finset K) + (f : (DoubledOccurrenceVertex g₀ → G) → ℝ) : + mean f = + mean₂ (fun y : {v : K // v ∈ g₀} → G => + fun z : + (EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G) => + f (doubledAssignment g₀ y z)) := by + calc + mean f = + mean (fun p : + ({v : K // v ∈ g₀} → G) × + ((EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G)) => + f ((splitDoubledAssignmentEquiv g₀).symm p)) := by + unfold mean + apply Fintype.expect_equiv + (splitDoubledAssignmentEquiv g₀) + intro x + simp + _ = _ := by + change + mean (fun p : + ({v : K // v ∈ g₀} → G) × + ((EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G)) => + f (doubledAssignment g₀ p.1 p.2)) = + _ + exact + mean_prod_type + (fun y : {v : K // v ∈ g₀} → G => + fun z : + (EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G) => + f (doubledAssignment g₀ y z)) + +@[simp] +theorem doubledAssignment_lift_false + (g₀ : Finset K) + (y : {v : K // v ∈ g₀} → G) + (z : (EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G)) + (v : K) : + doubledAssignment g₀ y z + (doubledVertexLift g₀ false v) = + (splitEdgeEquiv g₀).symm (y, z.1) v := by + classical + by_cases hv : v ∈ g₀ + · simp only [doubledVertexLift, dite_eq_left hv, + doubledAssignment] + unfold splitEdgeEquiv + convert + (Equiv.piCongrLeft_sumInl + (fun _ : K => G) (edgeSumEquiv g₀) + y z.1 ⟨v, hv⟩).symm using 1 ; + simp [edgeSumEquiv] + · simp only [doubledVertexLift, dite_eq_right hv, + doubledAssignment] + unfold splitEdgeEquiv + convert + (Equiv.piCongrLeft_sumInr + (fun _ : K => G) (edgeSumEquiv g₀) + y z.1 ⟨v, hv⟩).symm using 1 ; + simp [edgeSumEquiv] + +@[simp] +theorem doubledAssignment_lift_true + (g₀ : Finset K) + (y : {v : K // v ∈ g₀} → G) + (z : (EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G)) + (v : K) : + doubledAssignment g₀ y z + (doubledVertexLift g₀ true v) = + (splitEdgeEquiv g₀).symm (y, z.2) v := by + classical + by_cases hv : v ∈ g₀ + · simp only [doubledVertexLift, dite_eq_left hv, + doubledAssignment] + unfold splitEdgeEquiv + convert + (Equiv.piCongrLeft_sumInl + (fun _ : K => G) (edgeSumEquiv g₀) + y z.2 ⟨v, hv⟩).symm using 1 ; + simp [edgeSumEquiv] + · simp only [doubledVertexLift, dite_eq_right hv, + doubledAssignment] + unfold splitEdgeEquiv + convert + (Equiv.piCongrLeft_sumInr + (fun _ : K => G) (edgeSumEquiv g₀) + y z.2 ⟨v, hv⟩).symm using 1 ; + simp [edgeSumEquiv] + +def doubledEdge + (g₀ : Finset K) (copy : Bool) (g : Finset K) : + Finset (DoubledOccurrenceVertex g₀) := + g.image (doubledVertexLift g₀ copy) + +theorem mem_doubledEdge + (g₀ : Finset K) (copy : Bool) + (g : Finset K) (v : K) (hv : v ∈ g) : + doubledVertexLift g₀ copy v ∈ + doubledEdge g₀ copy g := + Finset.mem_image.mpr ⟨v, hv, rfl⟩ + +@[simp] +theorem image_forget_doubledEdge + (g₀ : Finset K) (copy : Bool) (g : Finset K) : + (doubledEdge g₀ copy g).image + (doubledVertexForget g₀) = g := by + classical + ext v + constructor + · intro hv + obtain ⟨w, hw, hwv⟩ := Finset.mem_image.mp hv + obtain ⟨u, hu, rfl⟩ := Finset.mem_image.mp hw + have huv : u = v := by + simpa using hwv + exact huv ▸ hu + · intro hv + exact + Finset.mem_image.mpr + ⟨doubledVertexLift g₀ copy v, + mem_doubledEdge g₀ copy g v hv, by simp⟩ + +@[simp] +theorem card_doubledEdge + (g₀ : Finset K) (copy : Bool) (g : Finset K) : + (doubledEdge g₀ copy g).card = g.card := by + rw [doubledEdge, + Finset.card_image_of_injective _ + (doubledVertexLift_injective g₀ copy)] + +theorem doubledEdge_copy_independent_of_subset + (g₀ : Finset K) {g : Finset K} + (hg : g ⊆ g₀) (copy copy' : Bool) : + doubledEdge g₀ copy g = + doubledEdge g₀ copy' g := by + unfold doubledEdge + apply Finset.image_congr + intro v hv + simp [doubledVertexLift, hg hv] + +theorem doubledEdge_false_ne_true_of_mem_complement + (g₀ : Finset K) {g : Finset K} + {v : K} (hvg : v ∈ g) (hvoutside : v ∉ g₀) : + doubledEdge g₀ false g ≠ + doubledEdge g₀ true g := by + intro hedges + have hv : + doubledVertexLift g₀ false v ∈ + doubledEdge g₀ true g := by + rw [← hedges] + exact mem_doubledEdge g₀ false g v hvg + obtain ⟨w, hwg, hwv⟩ := + Finset.mem_image.mp hv + have hwv' : w = v := by + have := congrArg + (doubledVertexForget g₀) hwv + simpa using this + subst w + simp [doubledVertexLift, hvoutside] at hwv + +theorem doubledEdge_false_eq_true_iff_subset + (g₀ : Finset K) (g : Finset K) : + doubledEdge g₀ false g = + doubledEdge g₀ true g ↔ + g ⊆ g₀ := by + constructor + · intro hedges v hvg + by_contra hvoutside + exact + doubledEdge_false_ne_true_of_mem_complement + g₀ hvg hvoutside hedges + · intro hg + exact doubledEdge_copy_independent_of_subset + g₀ hg false true + +abbrev DoubledEdgeSource + (B : HypergraphBundle J K H) (g₀ : Finset K) := + Bool × {g : Finset K // g ∈ (B.edges.erase g₀)} + +def doubledEdgeOfSource + (B : HypergraphBundle J K H) (g₀ : Finset K) + (s : B.DoubledEdgeSource g₀) : + Finset (DoubledOccurrenceVertex g₀) := + doubledEdge g₀ s.1 s.2.1 + +noncomputable def doubledSourceProduct + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (x : DoubledOccurrenceVertex g₀ → G) : ℝ := + ∏ s : B.DoubledEdgeSource g₀, + A s.2.1 (fun v => + x (doubledVertexLift g₀ s.1 v.1)) + +theorem doubledSourceProduct_doubledAssignment + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) + (y : {v : K // v ∈ g₀} → G) + (z : (EdgeComplement g₀ → G) × + (EdgeComplement g₀ → G)) : + B.doubledSourceProduct g₀ A + (doubledAssignment g₀ y z) = + B.edgeRemainderFiber g₀ A y z.1 * + B.edgeRemainderFiber g₀ A y z.2 := by + classical + unfold doubledSourceProduct + rw [Fintype.prod_prod_type, Fintype.prod_bool] + simp_rw [doubledAssignment_lift_true, + doubledAssignment_lift_false] + have hfalse : + (∏ g : {g : Finset K // + g ∈ B.edges.erase g₀}, + A g.1 (fun v => + (splitEdgeEquiv g₀).symm + (y, z.1) v.1)) = + ∏ g ∈ B.edges.erase g₀, + A g (edgeTuple g + ((splitEdgeEquiv g₀).symm + (y, z.1))) := by + calc + _ = ∏ g : {g : Finset K // + g ∈ B.edges.erase g₀}, + A g.1 (edgeTuple g.1 + ((splitEdgeEquiv g₀).symm + (y, z.1))) := by + apply Finset.prod_congr rfl + intro g _hg + apply congrArg (A g.1) + rfl + _ = _ := + Finset.prod_coe_sort + (B.edges.erase g₀) + (fun g => A g (edgeTuple g + ((splitEdgeEquiv g₀).symm + (y, z.1)))) + have htrue : + (∏ g : {g : Finset K // + g ∈ B.edges.erase g₀}, + A g.1 (fun v => + (splitEdgeEquiv g₀).symm + (y, z.2) v.1)) = + ∏ g ∈ B.edges.erase g₀, + A g (edgeTuple g + ((splitEdgeEquiv g₀).symm + (y, z.2))) := by + calc + _ = ∏ g : {g : Finset K // + g ∈ B.edges.erase g₀}, + A g.1 (edgeTuple g.1 + ((splitEdgeEquiv g₀).symm + (y, z.2))) := by + apply Finset.prod_congr rfl + intro g _hg + apply congrArg (A g.1) + rfl + _ = _ := + Finset.prod_coe_sort + (B.edges.erase g₀) + (fun g => A g (edgeTuple g + ((splitEdgeEquiv g₀).symm + (y, z.2)))) + rw [htrue, hfalse] + unfold edgeRemainderFiber edgeRemainder bundleProduct + rw [mul_comm] + rfl + +theorem doubledRemainderMoment_eq_mean_doubledSourceProduct + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) (g₀ : Finset K) + (A : (g : Finset K) → + ({v : K // v ∈ g} → G) → ℝ) : + B.doubledRemainderMoment g₀ A = + mean (B.doubledSourceProduct g₀ A) := by + rw [B.doubledRemainderMoment_eq_mean₂_pair] + rw [mean_splitDoubledAssignment] + simp_rw [B.doubledSourceProduct_doubledAssignment] + +def doubledEdges + (B : HypergraphBundle J K H) (g₀ : Finset K) : + Finset (Finset (DoubledOccurrenceVertex g₀)) := + Finset.univ.image (B.doubledEdgeOfSource g₀) + +theorem doubledEdgeOfSource_mem_doubledEdges + (B : HypergraphBundle J K H) (g₀ : Finset K) + (s : B.DoubledEdgeSource g₀) : + B.doubledEdgeOfSource g₀ s ∈ + B.doubledEdges g₀ := by + classical + exact Finset.mem_image.mpr + ⟨s, Finset.mem_univ s, rfl⟩ + +theorem mem_doubledEdges_iff + (B : HypergraphBundle J K H) (g₀ : Finset K) + (d : Finset (DoubledOccurrenceVertex g₀)) : + d ∈ B.doubledEdges g₀ ↔ + ∃ (copy : Bool) (g : Finset K), + g ∈ B.edges.erase g₀ ∧ + doubledEdge g₀ copy g = d := by + classical + constructor + · intro hd + obtain ⟨s, _hs, hsd⟩ := + Finset.mem_image.mp hd + exact ⟨s.1, s.2.1, s.2.2, hsd⟩ + · rintro ⟨copy, g, hg, rfl⟩ + exact + Finset.mem_image.mpr + ⟨(copy, ⟨g, hg⟩), Finset.mem_univ _, rfl⟩ + +def doubledProjection + (B : HypergraphBundle J K H) (g₀ : Finset K) : + DoubledOccurrenceVertex g₀ → J := + fun v => B.projection (doubledVertexForget g₀ v) + +@[simp] +theorem doubledProjection_lift + (B : HypergraphBundle J K H) (g₀ : Finset K) + (copy : Bool) (v : K) : + B.doubledProjection g₀ + (doubledVertexLift g₀ copy v) = + B.projection v := by + simp [doubledProjection] + +@[simp] +theorem image_doubledProjection_doubledEdge + (B : HypergraphBundle J K H) (g₀ : Finset K) + (copy : Bool) (g : Finset K) : + (doubledEdge g₀ copy g).image + (B.doubledProjection g₀) = + g.image B.projection := by + classical + ext j + constructor + · intro hj + obtain ⟨v, hv, hvj⟩ := Finset.mem_image.mp hj + obtain ⟨w, hw, rfl⟩ := Finset.mem_image.mp hv + exact Finset.mem_image.mpr + ⟨w, hw, by simpa using hvj⟩ + · intro hj + obtain ⟨v, hv, hvj⟩ := Finset.mem_image.mp hj + exact + Finset.mem_image.mpr + ⟨doubledVertexLift g₀ copy v, + mem_doubledEdge g₀ copy g v hv, + by simpa using hvj⟩ + +def duplicateOutside + (B : HypergraphBundle J K H) (g₀ : Finset K) : + HypergraphBundle J (DoubledOccurrenceVertex g₀) H where + edges := B.doubledEdges g₀ + projection := B.doubledProjection g₀ + projection_injective_on_edge := by + intro d hd v hv w hw hvw + obtain ⟨copy, g, hg, rfl⟩ := + (B.mem_doubledEdges_iff g₀ d).1 hd + obtain ⟨v₀, hv₀, rfl⟩ := + Finset.mem_image.mp hv + obtain ⟨w₀, hw₀, rfl⟩ := + Finset.mem_image.mp hw + apply congrArg (doubledVertexLift g₀ copy) + apply B.projection_injective_on_edge g + (Finset.mem_of_mem_erase hg) hv₀ hw₀ + simpa using hvw + projection_mem_base := by + intro d hd + obtain ⟨copy, g, hg, rfl⟩ := + (B.mem_doubledEdges_iff g₀ d).1 hd + rw [image_doubledProjection_doubledEdge] + exact B.projection_mem_base g + (Finset.mem_of_mem_erase hg) + +@[simp] +theorem duplicateOutside_edges + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.duplicateOutside g₀).edges = + B.doubledEdges g₀ := + rfl + +@[simp] +theorem duplicateOutside_projection + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.duplicateOutside g₀).projection = + B.doubledProjection g₀ := + rfl + +theorem duplicateOutside_edge_card + (B : HypergraphBundle J K H) (g₀ : Finset K) + {d : Finset (DoubledOccurrenceVertex g₀)} + (hd : d ∈ (B.duplicateOutside g₀).edges) : + ∃ g ∈ B.edges.erase g₀, d.card = g.card := by + obtain ⟨copy, g, hg, hgd⟩ := + (B.mem_doubledEdges_iff g₀ d).1 hd + subst d + exact ⟨g, hg, card_doubledEdge g₀ copy g⟩ + +theorem duplicateOutside_order_le_eraseEdge + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.duplicateOutside g₀).order ≤ + (B.eraseEdge g₀).order := by + unfold order + apply Finset.sup_le + intro d hd + obtain ⟨g, hg, hdg⟩ := + B.duplicateOutside_edge_card g₀ hd + rw [hdg] + exact (B.eraseEdge g₀).edge_card_le_order hg + +theorem duplicateOutside_order_le + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.duplicateOutside g₀).order ≤ B.order := + (B.duplicateOutside_order_le_eraseEdge g₀).trans + (B.eraseEdge_order_le g₀) + +theorem card_doubledEdges_le + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.doubledEdges g₀).card ≤ + 2 * (B.edges.erase g₀).card := by + unfold doubledEdges + calc + (Finset.univ.image + (B.doubledEdgeOfSource g₀)).card ≤ + (Finset.univ : + Finset (B.DoubledEdgeSource g₀)).card := + Finset.card_image_le + _ = 2 * (B.edges.erase g₀).card := by + simp [DoubledEdgeSource] + +def RemainingEdgesMeetComplement + (B : HypergraphBundle J K H) (g₀ : Finset K) : Prop := + ∀ g ∈ B.edges.erase g₀, + ∃ v ∈ g, v ∉ g₀ + +theorem doubledEdgeOfSource_injective + (B : HypergraphBundle J K H) (g₀ : Finset K) + (houtside : B.RemainingEdgesMeetComplement g₀) : + Function.Injective (B.doubledEdgeOfSource g₀) := by + rintro ⟨copy, ⟨g, hg⟩⟩ + ⟨copy', ⟨g', hg'⟩⟩ hedges + change + doubledEdge g₀ copy g = + doubledEdge g₀ copy' g' at hedges + have hgg' : g = g' := by + have himage := + congrArg + (Finset.image (doubledVertexForget g₀)) + hedges + simpa using himage + subst g' + have hcopy : copy = copy' := by + obtain ⟨v, hvg, hvoutside⟩ := + houtside g hg + have hv : + doubledVertexLift g₀ copy v ∈ + doubledEdge g₀ copy' g := by + rw [← hedges] + exact mem_doubledEdge g₀ copy g v hvg + obtain ⟨w, hwg, hwv⟩ := + Finset.mem_image.mp hv + have hwv' : w = v := by + have := congrArg + (doubledVertexForget g₀) hwv + simpa using this + subst w + simpa [doubledVertexLift, hvoutside] using + hwv.symm + subst copy' + rfl + +noncomputable def doubledEdgeSourceEquiv + (B : HypergraphBundle J K H) (g₀ : Finset K) + (houtside : B.RemainingEdgesMeetComplement g₀) : + B.DoubledEdgeSource g₀ ≃ + {d : Finset (DoubledOccurrenceVertex g₀) // + d ∈ B.doubledEdges g₀} := by + classical + apply Equiv.ofBijective + (fun s => + ⟨B.doubledEdgeOfSource g₀ s, + B.doubledEdgeOfSource_mem_doubledEdges + g₀ s⟩) + constructor + · intro s t hst + apply B.doubledEdgeOfSource_injective + g₀ houtside + exact congrArg Subtype.val hst + · rintro ⟨d, hd⟩ + obtain ⟨s, _hs, hsd⟩ := + Finset.mem_image.mp hd + refine ⟨s, ?_⟩ + apply Subtype.ext + exact hsd + +noncomputable def sourceOfDoubledEdge + (B : HypergraphBundle J K H) (g₀ : Finset K) + (houtside : B.RemainingEdgesMeetComplement g₀) + {d : Finset (DoubledOccurrenceVertex g₀)} + (hd : d ∈ B.doubledEdges g₀) : + B.DoubledEdgeSource g₀ := + (B.doubledEdgeSourceEquiv g₀ houtside).symm + ⟨d, hd⟩ + +theorem doubledEdgeOfSource_sourceOfDoubledEdge + (B : HypergraphBundle J K H) (g₀ : Finset K) + (houtside : B.RemainingEdgesMeetComplement g₀) + {d : Finset (DoubledOccurrenceVertex g₀)} + (hd : d ∈ B.doubledEdges g₀) : + B.doubledEdgeOfSource g₀ + (B.sourceOfDoubledEdge g₀ houtside hd) = d := by + exact congrArg Subtype.val + (Equiv.apply_symm_apply + (B.doubledEdgeSourceEquiv g₀ houtside) + ⟨d, hd⟩) + +theorem sourceOfDoubledEdge_doubledEdgeOfSource + (B : HypergraphBundle J K H) (g₀ : Finset K) + (houtside : B.RemainingEdgesMeetComplement g₀) + (s : B.DoubledEdgeSource g₀) : + B.sourceOfDoubledEdge g₀ houtside + (B.doubledEdgeOfSource_mem_doubledEdges + g₀ s) = s := by + exact + Equiv.symm_apply_apply + (B.doubledEdgeSourceEquiv g₀ houtside) s + +theorem card_doubledEdges_eq + (B : HypergraphBundle J K H) (g₀ : Finset K) + (houtside : B.RemainingEdgesMeetComplement g₀) : + (B.doubledEdges g₀).card = + 2 * (B.edges.erase g₀).card := by + unfold doubledEdges + rw [Finset.card_image_of_injective _ + (B.doubledEdgeOfSource_injective g₀ houtside)] + simp [DoubledEdgeSource] + +theorem doubledEdge_image_forget_of_subset + (g₀ : Finset K) (copy : Bool) + {g : Finset K} + {d : Finset (DoubledOccurrenceVertex g₀)} + (hd : d ⊆ doubledEdge g₀ copy g) : + doubledEdge g₀ copy + (d.image (doubledVertexForget g₀)) = d := by + classical + ext v + constructor + · intro hv + obtain ⟨w, hw, hwv⟩ := Finset.mem_image.mp hv + obtain ⟨u, hu, huw⟩ := Finset.mem_image.mp hw + have huLift : + doubledVertexLift g₀ copy + (doubledVertexForget g₀ u) = u := by + obtain ⟨t, ht, rfl⟩ := + Finset.mem_image.mp (hd hu) + simp + rw [← hwv, ← huw, huLift] + exact hu + · intro hv + have hvLift : + doubledVertexLift g₀ copy + (doubledVertexForget g₀ v) = v := by + obtain ⟨t, ht, rfl⟩ := + Finset.mem_image.mp (hd hv) + simp + exact Finset.mem_image.mpr + ⟨doubledVertexForget g₀ v, + Finset.mem_image.mpr ⟨v, hv, rfl⟩, + hvLift⟩ + +theorem duplicateOutside_closed + (B : HypergraphBundle J K H) (g₀ : Finset K) + (hclosed : + (B.eraseEdge g₀).IsClosedUnderInclusion) : + (B.duplicateOutside g₀).IsClosedUnderInclusion := by + intro d hd f hfd + obtain ⟨copy, g, hg, rfl⟩ := + (B.mem_doubledEdges_iff g₀ d).1 hd + let h : Finset K := + f.image (doubledVertexForget g₀) + have hhg : h ⊆ g := by + intro v hv + obtain ⟨w, hw, hwv⟩ := Finset.mem_image.mp hv + obtain ⟨u, hu, huw⟩ := + Finset.mem_image.mp (hfd hw) + rw [← hwv, ← huw] + simpa using hu + have hh : h ∈ B.edges.erase g₀ := + hclosed hg hhg + have hlift : + doubledEdge g₀ copy h = f := + doubledEdge_image_forget_of_subset + g₀ copy hfd + rw [← hlift] + exact + (B.mem_doubledEdges_iff g₀ + (doubledEdge g₀ copy h)).2 + ⟨copy, h, hh, rfl⟩ + +theorem duplicateOutside_closed_of_maximal + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) : + (B.duplicateOutside g₀).IsClosedUnderInclusion := + B.duplicateOutside_closed g₀ + (B.eraseEdge_closed_of_maximal + hclosed hg₀ hmax) + +end HypergraphBundle + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {J K : Type*} + [DecidableEq J] [DecidableEq K] + {H : Finset (Finset J)} + +def filterEdges + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] : + HypergraphBundle J K H where + edges := B.edges.filter P + projection := B.projection + projection_injective_on_edge := by + intro g hg + exact B.projection_injective_on_edge g + (Finset.mem_filter.mp hg).1 + projection_mem_base := by + intro g hg + exact B.projection_mem_base g + (Finset.mem_filter.mp hg).1 + +@[simp] +theorem filterEdges_edges + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] : + (B.filterEdges P).edges = B.edges.filter P := + rfl + +@[simp] +theorem mem_filterEdges_edges + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] + (g : Finset K) : + g ∈ (B.filterEdges P).edges ↔ + g ∈ B.edges ∧ P g := by + simp [filterEdges] + +@[simp] +theorem filterEdges_projection + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] : + (B.filterEdges P).projection = B.projection := + rfl + +theorem filterEdges_order_le + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] : + (B.filterEdges P).order ≤ B.order := by + unfold order + apply Finset.sup_le + intro g hg + exact B.edge_card_le_order + (Finset.mem_filter.mp hg).1 + +theorem card_filterEdges_edges_le + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] : + (B.filterEdges P).edges.card ≤ B.edges.card := by + exact Finset.card_le_card (Finset.filter_subset _ _) + +theorem filterEdges_closed + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] + (hclosed : B.IsClosedUnderInclusion) + (hP : ∀ ⦃g⦄, P g → + ∀ ⦃f⦄, f ⊆ g → P f) : + (B.filterEdges P).IsClosedUnderInclusion := by + intro g hg f hfg + have hg' := (B.mem_filterEdges_edges P g).1 hg + exact (B.mem_filterEdges_edges P f).2 + ⟨hclosed hg'.1 hfg, hP hg'.2 hfg⟩ + +def lowerOrder + (B : HypergraphBundle J K H) (d : ℕ) : + HypergraphBundle J K H := + B.filterEdges fun g => g.card < d + +@[simp] +theorem lowerOrder_edges + (B : HypergraphBundle J K H) (d : ℕ) : + (B.lowerOrder d).edges = + B.edges.filter fun g => g.card < d := + rfl + +@[simp] +theorem mem_lowerOrder_edges + (B : HypergraphBundle J K H) + (d : ℕ) (g : Finset K) : + g ∈ (B.lowerOrder d).edges ↔ + g ∈ B.edges ∧ g.card < d := by + simp [lowerOrder] + +theorem lowerOrder_order_lt + (B : HypergraphBundle J K H) + {d : ℕ} (hd : 0 < d) : + (B.lowerOrder d).order < d := by + unfold order + rw [Finset.sup_lt_iff hd] + intro g hg + exact (Finset.mem_filter.mp hg).2 + +theorem lowerOrder_order_le + (B : HypergraphBundle J K H) (d : ℕ) : + (B.lowerOrder d).order ≤ B.order := + B.filterEdges_order_le _ + +theorem card_lowerOrder_edges_le + (B : HypergraphBundle J K H) (d : ℕ) : + (B.lowerOrder d).edges.card ≤ B.edges.card := + B.card_filterEdges_edges_le _ + +theorem lowerOrder_closed + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) + (d : ℕ) : + (B.lowerOrder d).IsClosedUnderInclusion := by + apply B.filterEdges_closed _ hclosed + intro g hg f hfg + exact (Finset.card_le_card hfg).trans_lt hg + +def strictBoundary + (B : HypergraphBundle J K H) (g₀ : Finset K) : + HypergraphBundle J K H := + B.filterEdges fun g => g ⊂ g₀ + +@[simp] +theorem strictBoundary_edges + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.strictBoundary g₀).edges = + B.edges.filter fun g => g ⊂ g₀ := + rfl + +@[simp] +theorem mem_strictBoundary_edges + (B : HypergraphBundle J K H) + (g₀ g : Finset K) : + g ∈ (B.strictBoundary g₀).edges ↔ + g ∈ B.edges ∧ g ⊂ g₀ := by + simp [strictBoundary] + +theorem strictBoundary_order_le + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.strictBoundary g₀).order ≤ B.order := + B.filterEdges_order_le _ + +theorem strictBoundary_order_lt + (B : HypergraphBundle J K H) + {g₀ : Finset K} (hg₀ : g₀.Nonempty) : + (B.strictBoundary g₀).order < g₀.card := by + unfold order + rw [Finset.sup_lt_iff (Finset.card_pos.mpr hg₀)] + intro g hg + exact Finset.card_lt_card (Finset.mem_filter.mp hg).2 + +theorem card_strictBoundary_edges_le + (B : HypergraphBundle J K H) (g₀ : Finset K) : + (B.strictBoundary g₀).edges.card ≤ B.edges.card := + B.card_filterEdges_edges_le _ + +theorem strictBoundary_closed + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) + (g₀ : Finset K) : + (B.strictBoundary g₀).IsClosedUnderInclusion := by + apply B.filterEdges_closed _ hclosed + intro g hg f hfg + exact lt_of_le_of_lt hfg hg + +noncomputable def bundleMainProduct + (B : HypergraphBundle J K H) + (p : Finset J → ℝ) : ℝ := + ∏ g ∈ B.edges, p (g.image B.projection) + +@[simp] +theorem bundleMainProduct_filterEdges + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] + (p : Finset J → ℝ) : + (B.filterEdges P).bundleMainProduct p = + ∏ g ∈ B.edges.filter P, + p (g.image B.projection) := + rfl + +@[simp] +theorem bundleMainProduct_lowerOrder + (B : HypergraphBundle J K H) + (d : ℕ) (p : Finset J → ℝ) : + (B.lowerOrder d).bundleMainProduct p = + ∏ g ∈ B.edges.filter (fun g => g.card < d), + p (g.image B.projection) := + rfl + +@[simp] +theorem bundleMainProduct_strictBoundary + (B : HypergraphBundle J K H) + (g₀ : Finset K) (p : Finset J → ℝ) : + (B.strictBoundary g₀).bundleMainProduct p = + ∏ g ∈ B.edges.filter (fun g => g ⊂ g₀), + p (g.image B.projection) := + rfl + +theorem bundleMainProduct_filter_mul_filter_not + (B : HypergraphBundle J K H) + (P : Finset K → Prop) [DecidablePred P] + (p : Finset J → ℝ) : + (B.filterEdges P).bundleMainProduct p * + (B.filterEdges fun g => ¬ P g).bundleMainProduct p = + B.bundleMainProduct p := by + classical + exact Finset.prod_filter_mul_prod_filter_not + (s := B.edges) + (p := P) + (f := fun g => p (g.image B.projection)) + +theorem bundleMainProduct_eraseEdge_mul + (B : HypergraphBundle J K H) + (p : Finset J → ℝ) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) : + (B.eraseEdge g₀).bundleMainProduct p * + p (g₀.image B.projection) = + B.bundleMainProduct p := by + classical + unfold bundleMainProduct + simp only [eraseEdge] + rw [Finset.prod_erase_mul _ _ hg₀] + +theorem doubledEdge_injective + (g₀ : Finset K) (copy : Bool) : + Function.Injective (doubledEdge g₀ copy) := by + intro g h hgh + have himage := + congrArg + (Finset.image (doubledVertexForget g₀)) hgh + simpa using himage + +theorem doubledEdges_eq_image_union + (B : HypergraphBundle J K H) (g₀ : Finset K) : + B.doubledEdges g₀ = + (B.edges.erase g₀).image + (doubledEdge g₀ false) ∪ + (B.edges.erase g₀).image + (doubledEdge g₀ true) := by + classical + ext d + constructor + · intro hd + obtain ⟨copy, g, hg, rfl⟩ := + (B.mem_doubledEdges_iff g₀ d).1 hd + cases copy + · exact Finset.mem_union_left _ + (Finset.mem_image.mpr ⟨g, hg, rfl⟩) + · exact Finset.mem_union_right _ + (Finset.mem_image.mpr ⟨g, hg, rfl⟩) + · intro hd + rcases Finset.mem_union.mp hd with hd | hd + · obtain ⟨g, hg, rfl⟩ := Finset.mem_image.mp hd + exact (B.mem_doubledEdges_iff g₀ _).2 + ⟨false, g, hg, rfl⟩ + · obtain ⟨g, hg, rfl⟩ := Finset.mem_image.mp hd + exact (B.mem_doubledEdges_iff g₀ _).2 + ⟨true, g, hg, rfl⟩ + +theorem image_true_sdiff_image_false + (g₀ : Finset K) (s : Finset (Finset K)) : + s.image (doubledEdge g₀ true) \ + s.image (doubledEdge g₀ false) = + (s.filter fun g => ¬ g ⊆ g₀).image + (doubledEdge g₀ true) := by + classical + ext d + constructor + · intro hd + have hdtrue : + d ∈ s.image (doubledEdge g₀ true) := + (Finset.mem_sdiff.mp hd).1 + obtain ⟨g, hg, hgd⟩ := + Finset.mem_image.mp hdtrue + subst d + apply Finset.mem_image.mpr + refine ⟨g, Finset.mem_filter.mpr ⟨hg, ?_⟩, rfl⟩ + intro hgsub + apply (Finset.mem_sdiff.mp hd).2 + apply Finset.mem_image.mpr + refine ⟨g, hg, ?_⟩ + exact + (doubledEdge_copy_independent_of_subset + g₀ hgsub false true) + · intro hd + obtain ⟨g, hg, hgd⟩ := + Finset.mem_image.mp hd + subst d + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_image.mpr + ⟨g, (Finset.mem_filter.mp hg).1, rfl⟩, ?_⟩ + intro hfalse + obtain ⟨h, hh, hhg⟩ := + Finset.mem_image.mp hfalse + have hgh : h = g := by + have himage := + congrArg + (Finset.image (doubledVertexForget g₀)) hhg + simpa using himage + subst h + exact (Finset.mem_filter.mp hg).2 + ((doubledEdge_false_eq_true_iff_subset + g₀ g).1 hhg) + +theorem prod_image_doubledEdge_main + (B : HypergraphBundle J K H) + (g₀ : Finset K) (copy : Bool) + (s : Finset (Finset K)) + (p : Finset J → ℝ) : + (∏ d ∈ s.image (doubledEdge g₀ copy), + p (d.image (B.doubledProjection g₀))) = + ∏ g ∈ s, p (g.image B.projection) := by + classical + rw [Finset.prod_image + (doubledEdge_injective g₀ copy).injOn] + simp + +theorem bundleMainProduct_duplicateOutside + (B : HypergraphBundle J K H) + (g₀ : Finset K) (p : Finset J → ℝ) : + (B.duplicateOutside g₀).bundleMainProduct p = + (∏ g ∈ (B.edges.erase g₀).filter + (fun g => g ⊆ g₀), + p (g.image B.projection)) * + ∏ g ∈ (B.edges.erase g₀).filter + (fun g => ¬ g ⊆ g₀), + (p (g.image B.projection)) ^ 2 := by + classical + let s := B.edges.erase g₀ + let first := + s.image (doubledEdge g₀ false) + let second := + s.image (doubledEdge g₀ true) + have hsplit : + (∏ g ∈ s.filter (fun g => g ⊆ g₀), + p (g.image B.projection)) * + (∏ g ∈ s.filter (fun g => ¬ g ⊆ g₀), + p (g.image B.projection)) = + ∏ g ∈ s, p (g.image B.projection) := + Finset.prod_filter_mul_prod_filter_not + s (fun g => g ⊆ g₀) + (fun g => p (g.image B.projection)) + calc + (B.duplicateOutside g₀).bundleMainProduct p = + ∏ d ∈ first ∪ second, + p (d.image (B.doubledProjection g₀)) := by + unfold bundleMainProduct first second + simp only [duplicateOutside_edges, + duplicateOutside_projection] + rw [B.doubledEdges_eq_image_union g₀] + _ = ∏ d ∈ first ∪ (second \ first), + p (d.image (B.doubledProjection g₀)) := by + rw [Finset.union_sdiff_self_eq_union] + _ = + (∏ d ∈ first, + p (d.image (B.doubledProjection g₀))) * + ∏ d ∈ second \ first, + p (d.image (B.doubledProjection g₀)) := by + exact Finset.prod_union Finset.disjoint_sdiff + _ = + (∏ g ∈ s, p (g.image B.projection)) * + ∏ g ∈ s.filter (fun g => ¬ g ⊆ g₀), + p (g.image B.projection) := by + unfold first second + rw [image_true_sdiff_image_false] + rw [B.prod_image_doubledEdge_main g₀ false] + rw [B.prod_image_doubledEdge_main g₀ true] + _ = + ((∏ g ∈ s.filter (fun g => g ⊆ g₀), + p (g.image B.projection)) * + ∏ g ∈ s.filter (fun g => ¬ g ⊆ g₀), + p (g.image B.projection)) * + ∏ g ∈ s.filter (fun g => ¬ g ⊆ g₀), + p (g.image B.projection) := by + rw [hsplit] + _ = + (∏ g ∈ s.filter (fun g => g ⊆ g₀), + p (g.image B.projection)) * + ∏ g ∈ s.filter (fun g => ¬ g ⊆ g₀), + (p (g.image B.projection)) ^ 2 := by + rw [mul_assoc, ← Finset.prod_mul_distrib] + simp only [pow_two] + _ = _ := rfl + +theorem bundleMainProduct_duplicateOutside_lowerOrder + (B : HypergraphBundle J K H) + (g₀ : Finset K) (p : Finset J → ℝ) : + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleMainProduct p = + (B.strictBoundary g₀).bundleMainProduct p * + ∏ g ∈ B.edges.filter + (fun g => g.card < g₀.card ∧ ¬ g ⊆ g₀), + (p (g.image B.projection)) ^ 2 := by + classical + rw [(B.lowerOrder g₀.card).bundleMainProduct_duplicateOutside g₀ p] + have hg₀' : + g₀ ∉ B.edges.filter (fun g => g.card < g₀.card) := by + simp + have hboundary : + (B.edges.filter (fun g => g.card < g₀.card)).filter + (fun g => g ⊆ g₀) = + B.edges.filter (fun g => g ⊂ g₀) := by + ext g + simp only [Finset.mem_filter] + constructor + · rintro ⟨⟨hgB, hgcard⟩, hgsub⟩ + exact ⟨hgB, + Finset.ssubset_iff_subset_ne.mpr + ⟨hgsub, fun hgeq => by + subst g + exact (Nat.lt_irrefl _ hgcard)⟩⟩ + · rintro ⟨hgB, hgstrict⟩ + exact ⟨⟨hgB, + Finset.card_lt_card hgstrict⟩, hgstrict.1⟩ + have hexterior : + (B.edges.filter (fun g => g.card < g₀.card)).filter + (fun g => ¬ g ⊆ g₀) = + B.edges.filter + (fun g => g.card < g₀.card ∧ ¬ g ⊆ g₀) := by + ext g + simp only [Finset.mem_filter] + tauto + simp only [lowerOrder, strictBoundary, + filterEdges, bundleMainProduct] + rw [Finset.erase_eq_of_notMem hg₀', + hboundary, hexterior] + +end HypergraphBundle + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleFrozenUniformity.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleFrozenUniformity.lean new file mode 100644 index 0000000000000000000000000000000000000000..f488a53cf455bae295f6e8c8331a0b26cdf5ab6f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleFrozenUniformity.lean @@ -0,0 +1,1184 @@ +import Mathlib.Data.Fin.Tuple.Finset +import OAI.Combinatorics.Progressions.FixedDensity.ConfigurationWeightedDefect +import OAI.Combinatorics.Progressions.FixedDensity.HypergraphBundleRelativeCounting + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def positiveOrderedFaceEdge + {k r : ℕ} (e : PositiveOrderedFace k r) : + Finset (Fin k) := + Finset.univ.map e.face.toEmbedding + +@[simp] +theorem positiveOrderedFaceEdge_card + {k r : ℕ} (e : PositiveOrderedFace k r) : + (positiveOrderedFaceEdge e).card = e.rank := by + simp [positiveOrderedFaceEdge, PositiveOrderedFace.rank] + +theorem positiveOrderedFaceEdge_nonempty + {k r : ℕ} (e : PositiveOrderedFace k r) : + (positiveOrderedFaceEdge e).Nonempty := by + apply Finset.card_pos.mp + rw [positiveOrderedFaceEdge_card] + exact e.rank_pos + +theorem positiveOrderedFaceEdge_card_le + {k r : ℕ} (e : PositiveOrderedFace k r) : + (positiveOrderedFaceEdge e).card ≤ r := by + rw [positiveOrderedFaceEdge_card] + unfold PositiveOrderedFace.rank + omega + +@[simp] +theorem mem_positiveOrderedFaceEdge + {k r : ℕ} (e : PositiveOrderedFace k r) + (v : Fin k) : + v ∈ positiveOrderedFaceEdge e ↔ + v ∈ Set.range e.face := by + simp [positiveOrderedFaceEdge] + +noncomputable def positiveOrderedFaceOfEdge + {k r : ℕ} (t : Finset (Fin k)) + (ht : t.Nonempty) (htr : t.card ≤ r) : + PositiveOrderedFace k r := by + let j : Fin r := + ⟨t.card - 1, by + have htcard : 0 < t.card := + Finset.card_pos.mpr ht + omega⟩ + refine ⟨j, ?_⟩ + have hcard : t.card = j.1 + 1 := by + dsimp [j] + have htcard : 0 < t.card := + Finset.card_pos.mpr ht + omega + exact t.orderEmbOfFin hcard + +@[simp] +theorem positiveOrderedFaceEdge_ofEdge + {k r : ℕ} (t : Finset (Fin k)) + (ht : t.Nonempty) (htr : t.card ≤ r) : + positiveOrderedFaceEdge + (positiveOrderedFaceOfEdge t ht htr) = t := by + dsimp only [positiveOrderedFaceEdge, positiveOrderedFaceOfEdge] + exact Finset.map_orderEmbOfFin_univ t _ + +theorem positiveOrderedFaceEdge_injective + {k r : ℕ} : + Function.Injective + (positiveOrderedFaceEdge : + PositiveOrderedFace k r → Finset (Fin k)) := by + intro e f hef + have hrank : e.rank = f.rank := by + rw [← positiveOrderedFaceEdge_card e, + ← positiveOrderedFaceEdge_card f, hef] + rcases e with ⟨je, e⟩ + rcases f with ⟨jf, f⟩ + simp only [PositiveOrderedFace.rank] at hrank + have hj : je = jf := by + apply Fin.ext + omega + subst jf + have hrange : Set.range e = Set.range f := by + ext v + have hv := + congrArg + (fun s : Finset (Fin k) => v ∈ s) hef + simpa [positiveOrderedFaceEdge] using hv + have hef' : e = f := + (OrderEmbedding.range_inj_of_wellFoundedLT).mp hrange + subst f + rfl + +@[simp] +theorem positiveOrderedFaceOfEdge_edge + {k r : ℕ} (e : PositiveOrderedFace k r) : + positiveOrderedFaceOfEdge + (positiveOrderedFaceEdge e) + (positiveOrderedFaceEdge_nonempty e) + (positiveOrderedFaceEdge_card_le e) = e := by + apply positiveOrderedFaceEdge_injective + exact positiveOrderedFaceEdge_ofEdge + (positiveOrderedFaceEdge e) + (positiveOrderedFaceEdge_nonempty e) + (positiveOrderedFaceEdge_card_le e) + +abbrev PositiveOrderedBundleEdge (k r : ℕ) := + {t : Finset (Fin k) // t.Nonempty ∧ t.card ≤ r} + +noncomputable def positiveOrderedFaceEdgeEquiv + (k r : ℕ) : + PositiveOrderedFace k r ≃ + PositiveOrderedBundleEdge k r where + toFun e := + ⟨positiveOrderedFaceEdge e, + positiveOrderedFaceEdge_nonempty e, + positiveOrderedFaceEdge_card_le e⟩ + invFun t := + positiveOrderedFaceOfEdge t.1 t.2.1 t.2.2 + left_inv e := + positiveOrderedFaceOfEdge_edge e + right_inv t := by + apply Subtype.ext + exact positiveOrderedFaceEdge_ofEdge + t.1 t.2.1 t.2.2 + +noncomputable def orderedConfigurationBaseEdges + (k r : ℕ) : Finset (Finset (Fin k)) := + insert ∅ + (Finset.univ.image + (positiveOrderedFaceEdge : + PositiveOrderedFace k r → Finset (Fin k))) + +@[simp] +theorem empty_mem_orderedConfigurationBaseEdges + (k r : ℕ) : + ∅ ∈ orderedConfigurationBaseEdges k r := by + simp [orderedConfigurationBaseEdges] + +theorem empty_not_mem_positiveOrderedFaceEdge_image + (k r : ℕ) : + (∅ : Finset (Fin k)) ∉ + Finset.univ.image + (positiveOrderedFaceEdge : + PositiveOrderedFace k r → Finset (Fin k)) := by + intro h + obtain ⟨e, _he, hedge⟩ := + Finset.mem_image.mp h + exact (positiveOrderedFaceEdge_nonempty e).ne_empty + hedge + +@[simp] +theorem mem_orderedConfigurationBaseEdges_iff + {k r : ℕ} (t : Finset (Fin k)) : + t ∈ orderedConfigurationBaseEdges k r ↔ + t.card ≤ r := by + constructor + · intro ht + rw [orderedConfigurationBaseEdges, + Finset.mem_insert] at ht + rcases ht with rfl | ht + · simp + · obtain ⟨e, _he, rfl⟩ := + Finset.mem_image.mp ht + exact positiveOrderedFaceEdge_card_le e + · intro htr + by_cases ht0 : t = ∅ + · subst t + exact empty_mem_orderedConfigurationBaseEdges k r + · have ht : t.Nonempty := + Finset.nonempty_iff_ne_empty.mpr ht0 + rw [orderedConfigurationBaseEdges, + Finset.mem_insert] + right + apply Finset.mem_image.mpr + refine + ⟨positiveOrderedFaceOfEdge t ht htr, + Finset.mem_univ _, ?_⟩ + exact positiveOrderedFaceEdge_ofEdge t ht htr + +noncomputable def orderedConfigurationInitialBundle + (k r : ℕ) : + HypergraphBundle (Fin k) (Fin k) + (orderedConfigurationBaseEdges k r) where + edges := orderedConfigurationBaseEdges k r + projection := id + projection_injective_on_edge := by + intro g hg x hx y hy hxy + exact hxy + projection_mem_base := by + intro g hg + simpa using hg + +@[simp] +theorem orderedConfigurationInitialBundle_edges + (k r : ℕ) : + (orderedConfigurationInitialBundle k r).edges = + orderedConfigurationBaseEdges k r := + rfl + +@[simp] +theorem orderedConfigurationInitialBundle_projection + (k r : ℕ) : + (orderedConfigurationInitialBundle k r).projection = + id := + rfl + +theorem orderedConfigurationInitialBundle_closed + (k r : ℕ) : + (orderedConfigurationInitialBundle k r).IsClosedUnderInclusion := by + intro g hg f hfg + rw [orderedConfigurationInitialBundle_edges] at hg ⊢ + rw [mem_orderedConfigurationBaseEdges_iff] at hg ⊢ + exact (Finset.card_le_card hfg).trans hg + +noncomputable def orderedConfigurationEdgeTuple + {G : Type*} {k r : ℕ} + (t : Finset (Fin k)) + (ht : t.Nonempty) (htr : t.card ≤ r) + (y : {v : Fin k // v ∈ t} → G) : + Fin ((positiveOrderedFaceOfEdge t ht htr).lowerRank.1 + 1) → G := by + let e := positiveOrderedFaceOfEdge t ht htr + have hcard : t.card = e.lowerRank.1 + 1 := by + dsimp [e, positiveOrderedFaceOfEdge] + have htcard : 0 < t.card := + Finset.card_pos.mpr ht + omega + exact fun i => y (t.orderIsoOfFin hcard i) + +@[simp] +theorem positiveOrderedFaceEdge_orderIsoOfFin_val + {k r : ℕ} (e : PositiveOrderedFace k r) + (i : Fin (e.lowerRank.1 + 1)) : + ((positiveOrderedFaceEdge e).orderIsoOfFin + (by + simp [PositiveOrderedFace.rank]) i).1 = + e.face i := by + rw [Finset.coe_orderIsoOfFin_apply] + have hcanonical : + e.face = + (positiveOrderedFaceEdge e).orderEmbOfFin + (by + simp [PositiveOrderedFace.rank]) := by + apply Finset.orderEmbOfFin_unique' + intro q + simp [positiveOrderedFaceEdge] + exact congrArg (fun f => f i) hcanonical.symm + +noncomputable def orderedConfigurationBaseWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) : + HypergraphBundle.BaseEdgeWeight (Fin k) G := by + classical + intro t y + by_cases ht : t.Nonempty + · by_cases htr : t.card ≤ r + · exact configurationFaceWeight A + (positiveOrderedFaceOfEdge t ht htr) + (orderedConfigurationEdgeTuple t ht htr y) + · exact 1 + · exact 1 + +@[simp] +theorem orderedConfigurationBaseWeight_empty + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (y : {v : Fin k // v ∈ (∅ : Finset (Fin k))} → G) : + orderedConfigurationBaseWeight A ∅ y = 1 := by + simp [orderedConfigurationBaseWeight] + +@[simp] +theorem orderedConfigurationBaseWeight_positiveOrderedFaceEdge + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (e : PositiveOrderedFace k r) + (y : + {v : Fin k // v ∈ positiveOrderedFaceEdge e} → G) : + orderedConfigurationBaseWeight A + (positiveOrderedFaceEdge e) y = + configurationFaceWeight A e + (fun i => + y ⟨e.face i, + (mem_positiveOrderedFaceEdge e + (e.face i)).2 ⟨i, rfl⟩⟩) := by + classical + simp only [orderedConfigurationBaseWeight, + dite_eq_left (positiveOrderedFaceEdge_nonempty e), + dite_eq_left (positiveOrderedFaceEdge_card_le e)] + change + (fun p : + (Σ f : PositiveOrderedFace k r, + Fin (f.lowerRank.1 + 1) → G) => + configurationFaceWeight A p.1 p.2) + ⟨positiveOrderedFaceOfEdge + (positiveOrderedFaceEdge e) + (positiveOrderedFaceEdge_nonempty e) + (positiveOrderedFaceEdge_card_le e), + orderedConfigurationEdgeTuple + (positiveOrderedFaceEdge e) + (positiveOrderedFaceEdge_nonempty e) + (positiveOrderedFaceEdge_card_le e) y⟩ = + (fun p : + (Σ f : PositiveOrderedFace k r, + Fin (f.lowerRank.1 + 1) → G) => + configurationFaceWeight A p.1 p.2) + ⟨e, fun i => + y ⟨e.face i, + (mem_positiveOrderedFaceEdge e + (e.face i)).2 ⟨i, rfl⟩⟩⟩ + apply congrArg + (fun p : + (Σ f : PositiveOrderedFace k r, + Fin (f.lowerRank.1 + 1) → G) => + configurationFaceWeight A p.1 p.2) + have he : + positiveOrderedFaceOfEdge + (positiveOrderedFaceEdge e) + (positiveOrderedFaceEdge_nonempty e) + (positiveOrderedFaceEdge_card_le e) = e := + positiveOrderedFaceOfEdge_edge e + apply Sigma.ext he + simp only + apply Function.hfunext + (congrArg + (fun f : PositiveOrderedFace k r => + Fin (f.lowerRank.1 + 1)) he) + intro i i' hii + apply heq_of_eq + unfold orderedConfigurationEdgeTuple + apply congrArg y + apply Subtype.ext + have hn : + (positiveOrderedFaceOfEdge + (positiveOrderedFaceEdge e) + (positiveOrderedFaceEdge_nonempty e) + (positiveOrderedFaceEdge_card_le e)).lowerRank.1 + 1 = + e.lowerRank.1 + 1 := + congrArg (fun f : PositiveOrderedFace k r => + f.lowerRank.1 + 1) he + have hval : i.1 = i'.1 := by + have hcast : + cast (congrArg Fin hn) i = i' := by + exact eq_of_heq + ((cast_heq (congrArg Fin hn) i).trans hii) + calc + i.1 = (cast (congrArg Fin hn) i).1 := by + symm + have hcastVal : + ∀ {m n : ℕ} (h : m = n) (a : Fin m), + (cast (congrArg Fin h) a).1 = a.1 := by + intro m n h a + cases h + rfl + exact hcastVal hn i + _ = i'.1 := congrArg Fin.val hcast + rw [Finset.coe_orderIsoOfFin_apply] + calc + (positiveOrderedFaceEdge e).orderEmbOfFin _ i = + (positiveOrderedFaceEdge e).orderEmbOfFin _ i' := + Finset.orderEmbOfFin_eq_orderEmbOfFin_iff.mpr hval + _ = e.face i' := by + simpa only [Finset.coe_orderIsoOfFin_apply] using + positiveOrderedFaceEdge_orderIsoOfFin_val e i' + +theorem orderedConfigurationBaseWeight_unitInterval + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) : + HypergraphBundle.BaseWeightsInUnitInterval + (orderedConfigurationBaseEdges k r) + (orderedConfigurationBaseWeight A) := by + intro t ht y + unfold orderedConfigurationBaseWeight + by_cases ht0 : t.Nonempty + · simp only [dite_eq_left ht0] + by_cases htr : t.card ≤ r + · simp only [dite_eq_left htr] + exact + ⟨configurationFaceWeight_nonneg A _ _, + configurationFaceWeight_le_one A _ _⟩ + · simp [htr] + · simp [ht0] + +theorem orderedConfigurationBaseWeight_idempotent + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) : + HypergraphBundle.BaseWeightsIdempotent + (orderedConfigurationBaseEdges k r) + (orderedConfigurationBaseWeight A) := by + intro t ht y + unfold orderedConfigurationBaseWeight + by_cases ht0 : t.Nonempty + · simp only [dite_eq_left ht0] + by_cases htr : t.card ≤ r + · simp only [dite_eq_left htr] + simpa [configurationFaceWeight, pow_two] using + (partitionAtomIndicator_sq + (C.partition + (positiveOrderedFaceOfEdge t ht0 htr).lowerRank.succ + (positiveOrderedFaceOfEdge t ht0 htr).face) + (A.atom + (positiveOrderedFaceOfEdge t ht0 htr).lowerRank.succ + (positiveOrderedFaceOfEdge t ht0 htr).face) + (orderedConfigurationEdgeTuple t ht0 htr y)) + · simp [htr] + · simp [ht0] + +noncomputable def orderedConfigurationBaseDensity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) : + Finset (Fin k) → ℝ := by + classical + intro t + by_cases ht : t.Nonempty + · by_cases htr : t.card ≤ r + · exact mixedConfigurationCoarseDensity P A + (positiveOrderedFaceOfEdge t ht htr) + · exact 1 + · exact 1 + +@[simp] +theorem orderedConfigurationBaseDensity_empty + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) : + orderedConfigurationBaseDensity P A ∅ = 1 := by + simp [orderedConfigurationBaseDensity] + +@[simp] +theorem orderedConfigurationBaseDensity_positiveOrderedFaceEdge + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) : + orderedConfigurationBaseDensity P A + (positiveOrderedFaceEdge e) = + mixedConfigurationCoarseDensity P A e := by + classical + unfold orderedConfigurationBaseDensity + simp only [dite_eq_left (positiveOrderedFaceEdge_nonempty e)] + have hcard : + (positiveOrderedFaceEdge e).card ≤ r := by + simpa [positiveOrderedFaceEdge_card] using + positiveOrderedFaceEdge_card_le e + simp only [dite_eq_left hcard] + exact congrArg (mixedConfigurationCoarseDensity P A) + (positiveOrderedFaceOfEdge_edge e) + +theorem orderedConfigurationBaseDensity_unitInterval + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) : + ∀ t ∈ orderedConfigurationBaseEdges k r, + 0 ≤ orderedConfigurationBaseDensity P A t ∧ + orderedConfigurationBaseDensity P A t ≤ 1 := by + intro t ht + unfold orderedConfigurationBaseDensity + by_cases ht0 : t.Nonempty + · simp only [dite_eq_left ht0] + by_cases htr : t.card ≤ r + · simp only [dite_eq_left htr] + exact + ⟨mixedConfigurationCoarseDensity_nonneg P A _, + mixedConfigurationCoarseDensity_le_one P A _⟩ + · simp [htr] + · simp [ht0] + +theorem orderedConfigurationInitialBundle_projectedEdgeTuple + {G : Type*} {k r : ℕ} + {g : Finset (Fin k)} + (hg : + g ∈ (orderedConfigurationInitialBundle k r).edges) + (x : Fin k → G) : + (orderedConfigurationInitialBundle k r).projectedEdgeTuple hg + (HypergraphBundle.edgeTuple g x) = + fun j => x j.1 := by + funext j + have hj : + (((orderedConfigurationInitialBundle k r).projectionEquiv hg).symm j).1 = + j.1 := by + have happly := + congrArg Subtype.val + (((orderedConfigurationInitialBundle k r).projectionEquiv hg).apply_symm_apply j) + change + (orderedConfigurationInitialBundle k r).projection + (((orderedConfigurationInitialBundle k r).projectionEquiv hg).symm j).1 = + j.1 at happly + change + (((orderedConfigurationInitialBundle k r).projectionEquiv hg).symm j).1 = + j.1 at happly + exact happly + unfold HypergraphBundle.projectedEdgeTuple + HypergraphBundle.edgeTuple + exact congrArg x hj + +theorem orderedConfigurationInitialBundle_pullback_empty + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (x : Fin k → G) : + (orderedConfigurationInitialBundle k r).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) ∅ + (HypergraphBundle.edgeTuple ∅ x) = 1 := by + rw [(orderedConfigurationInitialBundle k r).pullbackBaseEdgeWeight_of_mem + (orderedConfigurationBaseWeight A) + (empty_mem_orderedConfigurationBaseEdges k r)] + exact orderedConfigurationBaseWeight_empty A _ + +theorem orderedConfigurationInitialBundle_pullback_positiveOrderedFaceEdge + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (e : PositiveOrderedFace k r) + (x : Fin k → G) : + (orderedConfigurationInitialBundle k r).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) + (positiveOrderedFaceEdge e) + (HypergraphBundle.edgeTuple + (positiveOrderedFaceEdge e) x) = + configurationFaceWeight A e + (orderedFaceTuple e.face x) := by + have hedge : + positiveOrderedFaceEdge e ∈ + (orderedConfigurationInitialBundle k r).edges := by + rw [orderedConfigurationInitialBundle_edges, + mem_orderedConfigurationBaseEdges_iff] + exact positiveOrderedFaceEdge_card_le e + rw [(orderedConfigurationInitialBundle k r).pullbackBaseEdgeWeight_of_mem + (orderedConfigurationBaseWeight A) hedge] + have himage : + (positiveOrderedFaceEdge e).image + (orderedConfigurationInitialBundle k r).projection = + positiveOrderedFaceEdge e := by + simpa only [orderedConfigurationInitialBundle_projection] using + (Finset.image_id : + (positiveOrderedFaceEdge e).image id = + positiveOrderedFaceEdge e) + have hpair : + (⟨(positiveOrderedFaceEdge e).image + (orderedConfigurationInitialBundle k r).projection, + (orderedConfigurationInitialBundle k r).projectedEdgeTuple + hedge + (HypergraphBundle.edgeTuple + (positiveOrderedFaceEdge e) x)⟩ : + Σ t : Finset (Fin k), ({j : Fin k // j ∈ t} → G)) = + ⟨positiveOrderedFaceEdge e, + HypergraphBundle.edgeTuple + (positiveOrderedFaceEdge e) x⟩ := by + apply Sigma.ext himage + simp only + apply Function.hfunext + (congrArg + (fun t : Finset (Fin k) => + {j : Fin k // j ∈ t}) himage) + intro j j' hjj + apply heq_of_eq + rw [congrFun + (orderedConfigurationInitialBundle_projectedEdgeTuple + hedge x) j] + apply congrArg x + exact + (Subtype.heq_iff_coe_eq + (fun v : Fin k => by + rw [himage])).1 hjj + have hweight := + congrArg + (fun p : + (Σ t : Finset (Fin k), + ({j : Fin k // j ∈ t} → G)) => + orderedConfigurationBaseWeight A p.1 p.2) + hpair + rw [hweight] + rw [orderedConfigurationBaseWeight_positiveOrderedFaceEdge] + apply congrArg (configurationFaceWeight A e) + funext i + rfl + +theorem orderedConfigurationInitialBundle_bundleProduct + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (x : Fin k → G) : + (orderedConfigurationInitialBundle k r).bundleProduct + ((orderedConfigurationInitialBundle k r).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) x = + partialConfigurationWeight A Finset.univ x := by + classical + change + (∏ g ∈ (orderedConfigurationInitialBundle k r).edges, + (orderedConfigurationInitialBundle k r).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) g + (HypergraphBundle.edgeTuple g x)) = + partialConfigurationWeight A Finset.univ x + rw [orderedConfigurationInitialBundle_edges] + change + (∏ g ∈ insert ∅ + (Finset.univ.image + (positiveOrderedFaceEdge : + PositiveOrderedFace k r → Finset (Fin k))), + (orderedConfigurationInitialBundle k r).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) g + (HypergraphBundle.edgeTuple g x)) = + partialConfigurationWeight A Finset.univ x + rw [ + Finset.prod_insert + (empty_not_mem_positiveOrderedFaceEdge_image k r)] + rw [orderedConfigurationInitialBundle_pullback_empty] + simp only [one_mul] + rw [Finset.prod_image + positiveOrderedFaceEdge_injective.injOn] + unfold partialConfigurationWeight + apply Finset.prod_congr rfl + intro e he + exact + orderedConfigurationInitialBundle_pullback_positiveOrderedFaceEdge + A e x + +theorem orderedConfigurationInitialBundle_bundleCount + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) : + (orderedConfigurationInitialBundle k r).bundleCount + ((orderedConfigurationInitialBundle k r).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) = + fullConfigurationCount A := by + unfold HypergraphBundle.bundleCount + fullConfigurationCount partialConfigurationCount + apply congrArg mean + funext x + exact orderedConfigurationInitialBundle_bundleProduct A x + +theorem orderedConfigurationInitialBundle_bundleMainProduct + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) : + (orderedConfigurationInitialBundle k r).bundleMainProduct + (orderedConfigurationBaseDensity P A) = + ∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e := by + classical + change + (∏ g ∈ (orderedConfigurationInitialBundle k r).edges, + orderedConfigurationBaseDensity P A + (g.image + (orderedConfigurationInitialBundle k r).projection)) = + ∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e + rw [orderedConfigurationInitialBundle_edges, + orderedConfigurationInitialBundle_projection] + simp only [Function.id_def, Finset.image_id'] + change + (∏ g ∈ insert ∅ + (Finset.univ.image + (positiveOrderedFaceEdge : + PositiveOrderedFace k r → Finset (Fin k))), + orderedConfigurationBaseDensity P A g) = + ∏ e : PositiveOrderedFace k r, + mixedConfigurationCoarseDensity P A e + rw [ + Finset.prod_insert + (empty_not_mem_positiveOrderedFaceEdge_image k r), + orderedConfigurationBaseDensity_empty, + one_mul] + rw [Finset.prod_image + positiveOrderedFaceEdge_injective.injOn] + simp + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + +theorem projectedEdge_nonempty + {K : Type*} [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (_hg : g ∈ B.edges) + (hne : g.Nonempty) : + (g.image B.projection).Nonempty := by + exact Finset.image_nonempty.mpr hne + +theorem projectedEdge_card_le + {K : Type*} [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) : + (g.image B.projection).card ≤ r := by + exact + (mem_orderedConfigurationBaseEdges_iff + (g.image B.projection)).1 + (B.projection_mem_base g hg) + +noncomputable def orderedConfigurationBundleFace + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + PositiveOrderedFace k r := + positiveOrderedFaceOfEdge + (g.image B.projection) + (B.projectedEdge_nonempty hg hne) + (B.projectedEdge_card_le hg) + +noncomputable def orderedConfigurationBundleFaceTuple + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (y : {v : K // v ∈ g} → G) : + Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) → G := + orderedConfigurationEdgeTuple + (g.image B.projection) + (B.projectedEdge_nonempty hg hne) + (B.projectedEdge_card_le hg) + (B.projectedEdgeTuple hg y) + +noncomputable def orderedConfigurationBundleDefect + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (y : {v : K // v ∈ g} → G) : ℝ := + mixedConfigurationDefect P A + (B.orderedConfigurationBundleFace hg hne) + (B.orderedConfigurationBundleFaceTuple hg hne y) + +noncomputable def orderedConfigurationBundleUniform + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (y : {v : K // v ∈ g} → G) : ℝ := + mixedConfigurationUniform P A + (B.orderedConfigurationBundleFace hg hne) + (B.orderedConfigurationBundleFaceTuple hg hne y) + +theorem orderedConfigurationBaseDensity_projectedEdge + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + orderedConfigurationBaseDensity P A + (g.image B.projection) = + mixedConfigurationCoarseDensity P A + (B.orderedConfigurationBundleFace hg hne) := by + unfold orderedConfigurationBaseDensity + simp only [ + dite_eq_left (B.projectedEdge_nonempty hg hne), + dite_eq_left (B.projectedEdge_card_le hg)] + rfl + +theorem pullback_orderedConfigurationBaseWeight_decompose + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (y : {v : K // v ∈ g} → G) : + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) g y = + orderedConfigurationBaseDensity P A + (g.image B.projection) + + B.orderedConfigurationBundleDefect P A hg hne y + + B.orderedConfigurationBundleUniform P A hg hne y := by + rw [B.pullbackBaseEdgeWeight_of_mem + (orderedConfigurationBaseWeight A) hg y] + rw [B.orderedConfigurationBaseDensity_projectedEdge + P A hg hne] + unfold orderedConfigurationBaseWeight + simp only [ + dite_eq_left (B.projectedEdge_nonempty hg hne), + dite_eq_left (B.projectedEdge_card_le hg)] + exact + mixedConfigurationFaceWeight_decompose P A + (B.orderedConfigurationBundleFace hg hne) + (B.orderedConfigurationBundleFaceTuple hg hne y) + +noncomputable def orderedConfigurationBundleLocalizedDefect + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (y : {v : K // v ∈ g} → G) : ℝ := + B.orderedConfigurationBundleDefect P A hg hne y * + B.strictBoundaryLocalProduct g + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) y + +def HasOrderedConfigurationBundleLocalizedDefect + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (β : ℕ → ℝ) : Prop := + ∀ (K : Type) [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)), + B.IsClosedUnderInclusion → + ∀ {g₀ : Finset K}, (hg₀ : g₀ ∈ B.edges) → + (∀ g ∈ B.edges, g.card ≤ g₀.card) → + (hne : g₀.Nonempty) → + mean (fun y => + B.orderedConfigurationBundleLocalizedDefect + P A hg₀ hne y ^ 2) ≤ + β g₀.card * + (B.strictBoundary g₀).bundleCount + ((B.strictBoundary g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) + +def HasOrderedConfigurationBundleFrozenUniformity + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (τ : ℝ) : Prop := + ∀ (K : Type) [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)), + B.IsClosedUnderInclusion → + ∀ {g₀ : Finset K}, (hg₀ : g₀ ∈ B.edges) → + (∀ g ∈ B.edges, g.card ≤ g₀.card) → + (hne : g₀.Nonempty) → + ∀ z : EdgeComplement g₀ → G, + |B.frozenEdgeCorrelation g₀ + (B.orderedConfigurationBundleUniform + P A hg₀ hne) + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) z| ≤ + τ + +theorem hasTaoBundleCountingStep_orderedConfiguration + [Nonempty G] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (β : ℕ → ℝ) (τ : ℝ) + (hβ : ∀ d, 0 ≤ β d) + (hτ : 0 ≤ τ) + (hlocalized : + HasOrderedConfigurationBundleLocalizedDefect P A β) + (hfrozen : + HasOrderedConfigurationBundleFrozenUniformity P A τ) : + HasTaoBundleCountingStep + (H := orderedConfigurationBaseEdges k r) + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseDensity P A) + β τ := by + intro K _instK _decK B hclosed g₀ hg₀ hmax + by_cases hne : g₀.Nonempty + · let W := + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) + let p := + orderedConfigurationBaseDensity P A + (g₀.image B.projection) + let b := + B.orderedConfigurationBundleDefect + P A hg₀ hne + let c := + B.orderedConfigurationBundleUniform + P A hg₀ hne + let bLocalized := + B.orderedConfigurationBundleLocalizedDefect + P A hg₀ hne + have hdecomp : + ∀ y, W g₀ y = p + b y + c y := by + intro y + simpa only [W, p, b, c] using + B.pullback_orderedConfigurationBaseWeight_decompose + P A hg₀ hne y + have hcount : + B.bundleCount W = + p * (B.eraseEdge g₀).bundleCount W + + B.edgeContribution g₀ b W + + B.edgeContribution g₀ c W := + B.bundleCount_decompose_edge + W hg₀ p b c hdecomp + have herase : + (B.eraseEdge g₀).bundleCount W = + (B.eraseEdge g₀).bundleCount + ((B.eraseEdge g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) := by + exact + B.eraseEdge_bundleCount_pullback g₀ + (orderedConfigurationBaseWeight A) + have hIdempotent : + B.WeightsIdempotent W := by + exact B.pullbackBaseEdgeWeight_weightsIdempotent + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseWeight_idempotent A) + have hlocalizeContribution : + B.edgeContribution g₀ b W = + B.edgeContribution g₀ bLocalized W := by + change B.edgeContribution g₀ b W = + B.edgeContribution g₀ + (fun y => + b y * B.strictBoundaryLocalProduct g₀ W y) W + exact B.edgeContribution_mul_strictBoundaryLocalProduct + g₀ b W hIdempotent + have hdefect : + |B.edgeContribution g₀ b W| ≤ + Real.sqrt + ((β g₀.card * + (B.strictBoundary g₀).bundleCount + ((B.strictBoundary g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A))) * + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleCount + (((B.lowerOrder g₀.card).duplicateOutside g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A))) := by + rw [hlocalizeContribution] + exact + B.abs_edgeContribution_pullback_le_sqrt_boundary_mul_lowerOrder + hclosed hg₀ hmax + (orderedConfigurationBaseWeight A) + (orderedConfigurationBaseWeight_unitInterval A) + (orderedConfigurationBaseWeight_idempotent A) + bLocalized (hβ g₀.card) + (hlocalized K B hclosed hg₀ hmax hne) + have huniform : + |B.edgeContribution g₀ c W| ≤ τ := by + exact B.abs_edgeContribution_le_of_frozen + g₀ c W + (hfrozen K B hclosed hg₀ hmax hne) + rw [hcount, herase] + calc + |p * + (B.eraseEdge g₀).bundleCount + ((B.eraseEdge g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) + + B.edgeContribution g₀ b W + + B.edgeContribution g₀ c W - + p * + (B.eraseEdge g₀).bundleCount + ((B.eraseEdge g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A))| = + |B.edgeContribution g₀ b W + + B.edgeContribution g₀ c W| := by + congr 1 + ring + _ ≤ + |B.edgeContribution g₀ b W| + + |B.edgeContribution g₀ c W| := + abs_add_le _ _ + _ ≤ + Real.sqrt + ((β g₀.card * + (B.strictBoundary g₀).bundleCount + ((B.strictBoundary g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A))) * + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleCount + (((B.lowerOrder g₀.card).duplicateOutside g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A))) + + τ := + add_le_add hdefect huniform + · have hg₀empty : g₀ = ∅ := + Finset.not_nonempty_iff_eq_empty.mp hne + subst g₀ + let W := + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) + have hweight : + ∀ y, W ∅ y = 1 := by + intro y + dsimp only [W] + rw [B.pullbackBaseEdgeWeight_of_mem + (orderedConfigurationBaseWeight A) hg₀ y] + simp only [Finset.image_empty] + exact orderedConfigurationBaseWeight_empty A + (B.projectedEdgeTuple hg₀ y) + have hcount : + B.bundleCount W = + (B.eraseEdge ∅).bundleCount + ((B.eraseEdge ∅).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) := by + calc + B.bundleCount W = + B.edgeContribution ∅ (W ∅) W := + B.bundleCount_eq_edgeContribution W hg₀ + _ = + B.edgeContribution ∅ (fun _ => 1) W := by + apply congrArg + (fun q => B.edgeContribution ∅ q W) + funext y + exact hweight y + _ = (B.eraseEdge ∅).bundleCount W := by + rw [B.edgeContribution_const] + simp + _ = + (B.eraseEdge ∅).bundleCount + ((B.eraseEdge ∅).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) := + B.eraseEdge_bundleCount_pullback ∅ + (orderedConfigurationBaseWeight A) + rw [hcount, Finset.image_empty, + orderedConfigurationBaseDensity_empty, + one_mul, sub_self, abs_zero] + exact add_nonneg (Real.sqrt_nonneg _) hτ + +end HypergraphBundle + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + +theorem exists_selectedVertex_not_mem_of_mem_erase + {J K : Type*} [DecidableEq J] [DecidableEq K] + {H : Finset (Finset J)} + (B : HypergraphBundle J K H) + {g₀ g : Finset K} + (hg : g ∈ B.edges.erase g₀) + (hmax : ∀ f ∈ B.edges, f.card ≤ g₀.card) : + ∃ v ∈ g₀, v ∉ g := by + classical + by_contra hmissing + have hsubset : g₀ ⊆ g := by + intro v hv + by_contra hvg + exact hmissing ⟨v, hv, hvg⟩ + have hgB : g ∈ B.edges := + Finset.mem_of_mem_erase hg + have heq : g₀ = g := + Finset.eq_of_subset_of_card_le hsubset (hmax g hgB) + exact (Finset.mem_erase.mp hg).1 heq.symm + +noncomputable def orderedConfigurationBundleFaceState + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + FaceRegularityState + (Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) → + G) := + ⟨orderedBoundaryPartition + (positiveFaceLowerLayer P.fine + (B.orderedConfigurationBundleFace hg hne)) + (B.orderedConfigurationBundleFace hg hne).face⟩ + +noncomputable def orderedConfigurationBundleFaceTarget + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + (Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) → + G) → ℝ := + partitionAtomIndicator + (P.coarse.partition + (B.orderedConfigurationBundleFace hg hne).lowerRank.succ + (B.orderedConfigurationBundleFace hg hne).face) + (A.atom + (B.orderedConfigurationBundleFace hg hne).lowerRank.succ + (B.orderedConfigurationBundleFace hg hne).face) + +def HasOrderedConfigurationBundleFrozenCutRepresentation + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) : Prop := + ∀ (K : Type) [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)), + B.IsClosedUnderInclusion → + ∀ {g₀ : Finset K}, (hg₀ : g₀ ∈ B.edges) → + (∀ g ∈ B.edges, g.card ≤ g₀.card) → + (hne : g₀.Nonempty) → + ∀ z : EdgeComplement g₀ → G, + ∃ u : + CutTestFamily G + ((B.orderedConfigurationBundleFace + hg₀ hne).lowerRank.1 + 1), + IsBoundedCutTest u ∧ + B.frozenEdgeCorrelation g₀ + (B.orderedConfigurationBundleUniform + P A hg₀ hne) + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) z = + (B.orderedConfigurationBundleFaceState + P hg₀ hne).faceCutCorrelation + (B.orderedConfigurationBundleFaceTarget + P A hg₀ hne) + u + +theorem hasOrderedConfigurationBundleFrozenUniformity_of_fullyMixed + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (τ : ℝ) + (hregular : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => τ)) + (hcut : + HasOrderedConfigurationBundleFrozenCutRepresentation P A) : + HasOrderedConfigurationBundleFrozenUniformity P A τ := by + intro K _instK _decK B hclosed g₀ hg₀ hmax hne z + obtain ⟨u, hu, hreindex⟩ := + hcut K B hclosed hg₀ hmax hne z + rw [hreindex] + exact + mixedConfigurationFace_isFaceCutRegular + P A (fun _ => τ) hregular + (B.orderedConfigurationBundleFace hg₀ hne) + u hu + +structure IsSourceFullBundlePreliminaryOrderedRegular + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (τ : ℝ) : Prop where + fullyMixed : + IsFullyMixedPreliminaryOrderedRegular P (fun _ => τ) + frozenCut : + HasOrderedConfigurationBundleFrozenCutRepresentation P A + +theorem IsSourceFullBundlePreliminaryOrderedRegular.frozenUniformity + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (τ : ℝ) + (h : IsSourceFullBundlePreliminaryOrderedRegular P A τ) : + HasOrderedConfigurationBundleFrozenUniformity P A τ := + hasOrderedConfigurationBundleFrozenUniformity_of_fullyMixed + P A τ h.fullyMixed h.frozenCut + +end HypergraphBundle + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleRelativeCounting.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleRelativeCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8e7a373d2881715252ac775785bbab34ee8c25d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleRelativeCounting.lean @@ -0,0 +1,935 @@ +import OAI.Combinatorics.Progressions.FixedDensity.HypergraphBundleEnvelopeSelection + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {J K G : Type*} + [DecidableEq J] [DecidableEq K] + {H : Finset (Finset J)} + +theorem bundleProduct_pullback_eq_of_subset_of_projection_eq + (B C : HypergraphBundle J K H) + (hCB : C.edges ⊆ B.edges) + (hprojection : B.projection = C.projection) + (A : BaseEdgeWeight J G) + (x : K → G) : + C.bundleProduct (B.pullbackBaseEdgeWeight A) x = + C.bundleProduct (C.pullbackBaseEdgeWeight A) x := by + unfold bundleProduct + apply Finset.prod_congr rfl + intro g hg + exact B.pullbackBaseEdgeWeight_eq_of_projection_eq + C A hprojection (hCB hg) hg (edgeTuple g x) + +theorem bundleCount_pullback_eq_of_subset_of_projection_eq + [Fintype K] [Fintype G] + (B C : HypergraphBundle J K H) + (hCB : C.edges ⊆ B.edges) + (hprojection : B.projection = C.projection) + (A : BaseEdgeWeight J G) : + C.bundleCount (B.pullbackBaseEdgeWeight A) = + C.bundleCount (C.pullbackBaseEdgeWeight A) := by + unfold bundleCount + apply congrArg mean + funext x + exact B.bundleProduct_pullback_eq_of_subset_of_projection_eq + C hCB hprojection A x + +theorem eraseEdge_bundleCount_pullback + [Fintype K] [Fintype G] + (B : HypergraphBundle J K H) + (g₀ : Finset K) (A : BaseEdgeWeight J G) : + (B.eraseEdge g₀).bundleCount + (B.pullbackBaseEdgeWeight A) = + (B.eraseEdge g₀).bundleCount + ((B.eraseEdge g₀).pullbackBaseEdgeWeight A) := by + apply B.bundleCount_pullback_eq_of_subset_of_projection_eq + (B.eraseEdge g₀) + · exact Finset.erase_subset _ _ + · rfl + +theorem duplicateOutside_lowerOrder_closed + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) + (g₀ : Finset K) : + ((B.lowerOrder g₀.card).duplicateOutside g₀).IsClosedUnderInclusion := by + apply (B.lowerOrder g₀.card).duplicateOutside_closed + g₀ + intro g hg f hfg + have hgLower : + g ∈ (B.lowerOrder g₀.card).edges := + Finset.mem_of_mem_erase hg + have hfLower : + f ∈ (B.lowerOrder g₀.card).edges := + B.lowerOrder_closed hclosed g₀.card + hgLower hfg + apply Finset.mem_erase.mpr + refine ⟨?_, hfLower⟩ + intro hfg₀ + subst f + have hgcard : + g.card < g₀.card := + ((B.mem_lowerOrder_edges g₀.card g).1 + hgLower).2 + have hcardle : g₀.card ≤ g.card := + Finset.card_le_card hfg + exact (Nat.not_le_of_gt hgcard) hcardle + +theorem duplicateOutside_lowerOrder_order_lt + (B : HypergraphBundle J K H) + {g₀ : Finset K} (hg₀ : g₀.Nonempty) : + ((B.lowerOrder g₀.card).duplicateOutside g₀).order < + g₀.card := by + exact + ((B.lowerOrder g₀.card).duplicateOutside_order_le + g₀).trans_lt + (B.lowerOrder_order_lt + (Finset.card_pos.mpr hg₀)) + +theorem card_duplicateOutside_lowerOrder_le + (B : HypergraphBundle J K H) + (g₀ : Finset K) : + ((B.lowerOrder g₀.card).duplicateOutside g₀).edges.card ≤ + 2 * B.edges.card := by + calc + ((B.lowerOrder g₀.card).duplicateOutside g₀).edges.card = + ((B.lowerOrder g₀.card).doubledEdges g₀).card := by + rfl + _ ≤ + 2 * + ((B.lowerOrder g₀.card).edges.erase g₀).card := + (B.lowerOrder g₀.card).card_doubledEdges_le g₀ + _ ≤ 2 * (B.lowerOrder g₀.card).edges.card := + Nat.mul_le_mul_left 2 + Finset.card_erase_le + _ ≤ 2 * B.edges.card := + Nat.mul_le_mul_left 2 + (B.card_lowerOrder_edges_le g₀.card) + +theorem exists_edge_card_eq_order + (B : HypergraphBundle J K H) + (horder : 0 < B.order) : + ∃ g₀ ∈ B.edges, + g₀.card = B.order ∧ + ∀ g ∈ B.edges, g.card ≤ g₀.card := by + have hedges : B.edges.Nonempty := by + by_contra hempty + have hbe : B.edges = ∅ := + Finset.not_nonempty_iff_eq_empty.mp hempty + simp [order, hbe] at horder + obtain ⟨g₀, hg₀, hsup⟩ := + Finset.exists_mem_eq_sup B.edges hedges Finset.card + refine ⟨g₀, hg₀, ?_, ?_⟩ + · simpa [order] using hsup.symm + · intro g hg + rw [← hsup] + exact Finset.le_sup hg + +theorem count_le_one_add_error_mul_main + {count main error : ℝ} + (herror : |count - main| ≤ error * main) : + count ≤ (1 + error) * main := by + have hleft : count - main ≤ |count - main| := + le_abs_self _ + calc + count ≤ main + |count - main| := by + linarith + _ ≤ main + error * main := + add_le_add_right herror main + _ = (1 + error) * main := by + ring + +theorem pow_card_edges_le_bundleMainProduct_of_edges + (B : HypergraphBundle J K H) + (p : Finset J → ℝ) {a : ℝ} + (ha : 0 ≤ a) + (hp : + ∀ g ∈ B.edges, + a ≤ p (g.image B.projection)) : + a ^ B.edges.card ≤ B.bundleMainProduct p := by + classical + unfold bundleMainProduct + calc + a ^ B.edges.card = + ∏ _g ∈ B.edges, a := by + simp + _ ≤ + ∏ g ∈ B.edges, + p (g.image B.projection) := by + apply Finset.prod_le_prod₀ + · intro g hg + exact ha + · intro g hg + exact hp g hg + +theorem pow_card_edges_le_selected_mul_maximalRemainder + (B : HypergraphBundle J K H) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hmax : ∀ g ∈ B.edges, g.card ≤ g₀.card) + (p : Finset J → ℝ) {a : ℝ} + (ha0 : 0 ≤ a) (ha1 : a ≤ 1) + (hp : + ∀ e ∈ H, e.card = g₀.card → + a ≤ p e) : + a ^ B.edges.card ≤ + p (g₀.image B.projection) * + B.maximalRemainderMainProduct g₀ p := by + let s := + (B.edges.erase g₀).filter + (fun g => ¬ g.card < g₀.card) + have hscard : + s.card ≤ (B.edges.erase g₀).card := + B.card_maximalRemainder_le_erase g₀ + have hpmax : + a ^ s.card ≤ + B.maximalRemainderMainProduct g₀ p := + B.pow_card_maximalRemainder_le + hmax p ha0 hp + have hpow : + a ^ (B.edges.erase g₀).card ≤ + a ^ s.card := + pow_le_pow_of_le_one ha0 ha1 hscard + have hremain : + a ^ (B.edges.erase g₀).card ≤ + B.maximalRemainderMainProduct g₀ p := + hpow.trans hpmax + have hselected : + a ≤ p (g₀.image B.projection) := by + apply hp _ (B.projection_mem_base g₀ hg₀) + exact B.card_image_projection hg₀ + have hselected0 : + 0 ≤ p (g₀.image B.projection) := + ha0.trans hselected + calc + a ^ B.edges.card = + a * a ^ (B.edges.erase g₀).card := by + rw [← Finset.card_erase_add_one hg₀, + pow_succ, mul_comm] + _ ≤ + p (g₀.image B.projection) * + a ^ (B.edges.erase g₀).card := + mul_le_mul_of_nonneg_right hselected + (pow_nonneg ha0 _) + _ ≤ + p (g₀.image B.projection) * + B.maximalRemainderMainProduct g₀ p := + mul_le_mul_of_nonneg_left hremain hselected0 + +theorem bundleCount_eq_bundleMainProduct_of_order_zero + [Fintype K] [Fintype G] [Nonempty G] + (B : HypergraphBundle J K H) + (A : BaseEdgeWeight J G) + (p : Finset J → ℝ) + (hAempty : + ∀ y : + {j : J // j ∈ (∅ : Finset J)} → G, + A ∅ y = 1) + (hpempty : p ∅ = 1) + (horder : B.order = 0) : + B.bundleCount (B.pullbackBaseEdgeWeight A) = + B.bundleMainProduct p := by + have hedgeEmpty : + ∀ g ∈ B.edges, g = ∅ := by + intro g hg + apply Finset.card_eq_zero.mp + exact Nat.le_zero.mp + (horder ▸ B.edge_card_le_order hg) + have hproduct : + ∀ x : K → G, + B.bundleProduct + (B.pullbackBaseEdgeWeight A) x = 1 := by + intro x + unfold bundleProduct + apply Finset.prod_eq_one + intro g hg + have hge : g = ∅ := + hedgeEmpty g hg + subst g + rw [B.pullbackBaseEdgeWeight_of_mem A hg] + exact hAempty _ + have hmain : + B.bundleMainProduct p = 1 := by + unfold bundleMainProduct + apply Finset.prod_eq_one + intro g hg + rw [hedgeEmpty g hg] + simp [hpempty] + rw [hmain] + unfold bundleCount + calc + mean + (B.bundleProduct + (B.pullbackBaseEdgeWeight A)) = + mean (fun _x : K → G => 1) := by + apply congrArg mean + funext x + exact hproduct x + _ = 1 := mean_const 1 + +end HypergraphBundle + +universe uJ uG + +variable {J : Type uJ} {G : Type uG} + [DecidableEq J] [Fintype G] [DecidableEq G] + {H : Finset (Finset J)} + +def HasTaoBundleCountingStep + (A : HypergraphBundle.BaseEdgeWeight J G) + (p : Finset J → ℝ) + (β : ℕ → ℝ) (τ : ℝ) : Prop := + ∀ (K : Type) [Fintype K] [DecidableEq K] + (B : HypergraphBundle J K H), + B.IsClosedUnderInclusion → + ∀ {g₀ : Finset K}, g₀ ∈ B.edges → + (∀ g ∈ B.edges, g.card ≤ g₀.card) → + |B.bundleCount (B.pullbackBaseEdgeWeight A) - + p (g₀.image B.projection) * + (B.eraseEdge g₀).bundleCount + ((B.eraseEdge g₀).pullbackBaseEdgeWeight A)| ≤ + Real.sqrt + (β g₀.card * + (B.strictBoundary g₀).bundleCount + ((B.strictBoundary g₀).pullbackBaseEdgeWeight A) * + ((B.lowerOrder g₀.card).duplicateOutside g₀).bundleCount + (((B.lowerOrder g₀.card).duplicateOutside g₀).pullbackBaseEdgeWeight + A)) + + τ + +omit [DecidableEq G] in + +theorem abs_bundleCount_pullback_sub_bundleMainProduct_le_envelope + [Nonempty G] + (A : HypergraphBundle.BaseEdgeWeight J G) + (p : Finset J → ℝ) + (α β μ : ℕ → ℝ) (τ : ℝ) + (E : ℕ → ℕ → ℝ) + (hA01 : + HypergraphBundle.BaseWeightsInUnitInterval H A) + (_hAidempotent : + HypergraphBundle.BaseWeightsIdempotent H A) + (hAempty : + ∀ y : + {j : J // j ∈ (∅ : Finset J)} → G, + A ∅ y = 1) + (hpempty : p ∅ = 1) + (hpLower : + ∀ e ∈ H, α e.card ≤ p e) + (hstep : + HasTaoBundleCountingStep + (H := H) A p β τ) + (hE : + IsBundleCountingEnvelope α β μ τ E) + {K : Type} [Fintype K] [DecidableEq K] + (B : HypergraphBundle J K H) + (hclosed : B.IsClosedUnderInclusion) : + |B.bundleCount (B.pullbackBaseEdgeWeight A) - + B.bundleMainProduct p| ≤ + E B.order B.edges.card * + B.bundleMainProduct p := by + let P : ℕ → ℕ → Prop := + fun d n => + ∀ (K' : Type) [Fintype K'] [DecidableEq K'] + (C : HypergraphBundle J K' H), + C.order ≤ d → + C.edges.card ≤ n → + C.IsClosedUnderInclusion → + |C.bundleCount (C.pullbackBaseEdgeWeight A) - + C.bundleMainProduct p| ≤ + E d n * C.bundleMainProduct p + have hp0 : + ∀ e ∈ H, 0 ≤ p e := by + intro e he + exact (hE.density_pos e.card).le.trans + (hpLower e he) + unfold HasTaoBundleCountingStep at hstep + have hP : ∀ d n, P d n := by + intro d + induction d using Nat.strong_induction_on with + | h d ihOrder => + intro n + induction n using Nat.strong_induction_on with + | h n ihCard => + dsimp [P] + intro K' _instK' _decK' C hCd hCn hclosedC + by_cases horderEq : C.order = d + · by_cases hcardEq : C.edges.card = n + · by_cases hd0 : d = 0 + · have hzero : C.order = 0 := + horderEq.trans hd0 + have hexact := + C.bundleCount_eq_bundleMainProduct_of_order_zero + A p hAempty hpempty hzero + rw [hexact, sub_self, abs_zero] + exact mul_nonneg + (hE.error_nonneg d n) + (C.bundleMainProduct_nonneg p hp0) + · have hdpos : 0 < d := + Nat.pos_of_ne_zero hd0 + obtain ⟨g₀, hg₀, hgcard, hmax⟩ := + C.exists_edge_card_eq_order + (horderEq.symm ▸ hdpos) + have hgcardD : g₀.card = d := + hgcard.trans horderEq + have hg₀ne : g₀.Nonempty := by + apply Finset.card_pos.mp + rw [hgcardD] + exact hdpos + obtain ⟨d₀, rfl⟩ := + Nat.exists_eq_succ_of_ne_zero hd0 + have hn0 : n ≠ 0 := by + intro hn + have hcardzero : C.edges.card = 0 := + hcardEq.trans hn + exact + (Finset.card_ne_zero.mpr + ⟨g₀, hg₀⟩) hcardzero + obtain ⟨n₀, rfl⟩ := + Nat.exists_eq_succ_of_ne_zero hn0 + let Cerase := C.eraseEdge g₀ + let Cboundary := C.strictBoundary g₀ + let Clower := + (C.lowerOrder g₀.card).duplicateOutside g₀ + have hCeraseClosed : + Cerase.IsClosedUnderInclusion := + C.eraseEdge_closed_of_maximal + hclosedC hg₀ hmax + have hCeraseOrder : + Cerase.order ≤ d₀ + 1 := by + exact + (C.eraseEdge_order_le g₀).trans_eq + horderEq + have hCeraseCard : + Cerase.edges.card ≤ n₀ := by + have hcard : + Cerase.edges.card = n₀ := by + simp [Cerase, + Finset.card_erase_of_mem hg₀, + hcardEq] + exact hcard.le + have hEraseIH := + (ihCard n₀ (Nat.lt_succ_self n₀)) + K' Cerase hCeraseOrder + hCeraseCard hCeraseClosed + have hCboundaryClosed : + Cboundary.IsClosedUnderInclusion := + C.strictBoundary_closed hclosedC g₀ + have hCboundaryOrder : + Cboundary.order ≤ d₀ := by + have hlt : + Cboundary.order < d₀ + 1 := by + simpa [Cboundary, hgcardD, + Nat.succ_eq_add_one] using + C.strictBoundary_order_lt hg₀ne + omega + have hCboundaryCard : + Cboundary.edges.card ≤ n₀ + 1 := by + exact + (C.card_strictBoundary_edges_le g₀).trans_eq + hcardEq + have hBoundaryIH := + (ihOrder d₀ (Nat.lt_succ_self d₀) + (n₀ + 1)) + K' Cboundary hCboundaryOrder + hCboundaryCard hCboundaryClosed + have hClowerClosed : + Clower.IsClosedUnderInclusion := by + dsimp [Clower] + exact C.duplicateOutside_lowerOrder_closed + hclosedC g₀ + have hClowerOrder : + Clower.order ≤ d₀ := by + have hlt : + Clower.order < d₀ + 1 := by + simpa [Clower, hgcardD, + Nat.succ_eq_add_one] using + C.duplicateOutside_lowerOrder_order_lt + hg₀ne + omega + have hClowerCard : + Clower.edges.card ≤ + 2 * (n₀ + 1) := by + dsimp [Clower] + exact + (C.card_duplicateOutside_lowerOrder_le + g₀).trans_eq + (congrArg (fun m => 2 * m) + hcardEq) + have hLowerIH := + (ihOrder d₀ (Nat.lt_succ_self d₀) + (2 * (n₀ + 1))) + (HypergraphBundle.DoubledOccurrenceVertex g₀) + Clower hClowerOrder + hClowerCard hClowerClosed + let mainErase := + Cerase.bundleMainProduct p + let mainBoundary := + Cboundary.bundleMainProduct p + let mainLower := + Clower.bundleMainProduct p + let mainLowerOrder := + (C.lowerOrder g₀.card).bundleMainProduct p + let mainMax := + C.maximalRemainderMainProduct g₀ p + let mainC := C.bundleMainProduct p + let countErase := + Cerase.bundleCount + (Cerase.pullbackBaseEdgeWeight A) + let countBoundary := + Cboundary.bundleCount + (Cboundary.pullbackBaseEdgeWeight A) + let countLower := + Clower.bundleCount + (Clower.pullbackBaseEdgeWeight A) + let p₀ := + p (g₀.image C.projection) + have hmainErase0 : 0 ≤ mainErase := by + dsimp [mainErase, Cerase] + exact + (C.eraseEdge g₀).bundleMainProduct_nonneg p hp0 + have hmainBoundary0 : + 0 ≤ mainBoundary := by + dsimp [mainBoundary, Cboundary] + exact + (C.strictBoundary g₀).bundleMainProduct_nonneg p hp0 + have hmainLower0 : + 0 ≤ mainLower := by + dsimp [mainLower, Clower] + exact + ((C.lowerOrder g₀.card).duplicateOutside g₀).bundleMainProduct_nonneg + p hp0 + have hmainLowerOrder0 : + 0 ≤ mainLowerOrder := by + dsimp [mainLowerOrder] + exact + (C.lowerOrder g₀.card).bundleMainProduct_nonneg p hp0 + have hmainC0 : 0 ≤ mainC := by + dsimp [mainC] + exact C.bundleMainProduct_nonneg p hp0 + have hcountBoundary0 : + 0 ≤ countBoundary := by + dsimp [countBoundary, Cboundary] + exact + (C.strictBoundary g₀).bundleCount_nonneg + ((C.strictBoundary g₀).pullbackBaseEdgeWeight_weightsInUnitInterval + A hA01) + have hcountLower0 : + 0 ≤ countLower := by + dsimp [countLower, Clower] + exact + ((C.lowerOrder g₀.card).duplicateOutside g₀).bundleCount_nonneg + (HypergraphBundle.pullbackBaseEdgeWeight_weightsInUnitInterval + ((C.lowerOrder g₀.card).duplicateOutside g₀) A hA01) + have hcountBoundary : + countBoundary ≤ + (1 + E d₀ (n₀ + 1)) * + mainBoundary := + HypergraphBundle.count_le_one_add_error_mul_main + hBoundaryIH + have hcountLower : + countLower ≤ + (1 + E d₀ + (2 * (n₀ + 1))) * + mainLower := + HypergraphBundle.count_le_one_add_error_mul_main + hLowerIH + have hcorrection0 : + 0 ≤ + (1 + E d₀ (n₀ + 1)) * + (1 + E d₀ + (2 * (n₀ + 1))) := + hE.lower_correction_nonneg d₀ n₀ + have hfirstCorrection0 : + 0 ≤ 1 + E d₀ (n₀ + 1) := by + linarith + [hE.error_nonneg d₀ (n₀ + 1)] + have hβ0 : + 0 ≤ β (d₀ + 1) := + hE.defect_nonneg _ + have hradicand : + β (d₀ + 1) * + countBoundary * countLower ≤ + β (d₀ + 1) * + ((1 + E d₀ (n₀ + 1)) * + mainBoundary) * + ((1 + E d₀ + (2 * (n₀ + 1))) * + mainLower) := by + calc + β (d₀ + 1) * + countBoundary * countLower ≤ + β (d₀ + 1) * + ((1 + E d₀ (n₀ + 1)) * + mainBoundary) * + countLower := + mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left + hcountBoundary hβ0) + hcountLower0 + _ ≤ + β (d₀ + 1) * + ((1 + E d₀ (n₀ + 1)) * + mainBoundary) * + ((1 + E d₀ + (2 * (n₀ + 1))) * + mainLower) := + mul_le_mul_of_nonneg_left + hcountLower + (mul_nonneg hβ0 + (mul_nonneg + hfirstCorrection0 + hmainBoundary0)) + let rootCorrection := + Real.sqrt + (β (d₀ + 1) * + (1 + E d₀ (n₀ + 1)) * + (1 + E d₀ + (2 * (n₀ + 1)))) + have hrootCorrection0 : + 0 ≤ rootCorrection := + Real.sqrt_nonneg _ + have hmainBoundaryLower : + mainBoundary * mainLower = + mainLowerOrder ^ 2 := by + dsimp [mainBoundary, mainLower, + mainLowerOrder, Cboundary, Clower] + exact + C.boundary_mul_duplicateLower_main_eq_lowerOrder_sq + g₀ p + have hcoefficient0 : + 0 ≤ + β (d₀ + 1) * + (1 + E d₀ (n₀ + 1)) * + (1 + E d₀ + (2 * (n₀ + 1))) := by + rw [mul_assoc] + exact mul_nonneg hβ0 hcorrection0 + have hsqrt : + Real.sqrt + (β (d₀ + 1) * + countBoundary * countLower) ≤ + rootCorrection * mainLowerOrder := by + calc + Real.sqrt + (β (d₀ + 1) * + countBoundary * countLower) ≤ + Real.sqrt + (β (d₀ + 1) * + ((1 + E d₀ (n₀ + 1)) * + mainBoundary) * + ((1 + E d₀ + (2 * (n₀ + 1))) * + mainLower)) := + Real.sqrt_le_sqrt hradicand + _ = + Real.sqrt + ((β (d₀ + 1) * + (1 + E d₀ (n₀ + 1)) * + (1 + E d₀ + (2 * (n₀ + 1)))) * + (mainBoundary * mainLower)) := by + congr 1 + ring + _ = + Real.sqrt + ((β (d₀ + 1) * + (1 + E d₀ (n₀ + 1)) * + (1 + E d₀ + (2 * (n₀ + 1)))) * + mainLowerOrder ^ 2) := by + congr 1 + rw [hmainBoundaryLower] + _ = rootCorrection * mainLowerOrder := by + dsimp [rootCorrection] + rw [Real.sqrt_mul hcoefficient0] + rw [Real.sqrt_sq hmainLowerOrder0] + have hαp : + α (d₀ + 1) ^ (n₀ + 1) ≤ + p₀ * mainMax := by + dsimp [p₀, mainMax] + have hpow := + C.pow_card_edges_le_selected_mul_maximalRemainder + hg₀ hmax p + (hE.density_pos g₀.card).le + (hE.density_le_one g₀.card) + (fun e he hcard => + hpLower e he |> + fun h => by + simpa [hcard] using h) + simpa [hgcardD, hcardEq, + Nat.succ_eq_add_one] using hpow + have hαpowpos : + 0 < α (d₀ + 1) ^ (n₀ + 1) := + pow_pos (hE.density_pos _) _ + have hmainFactor : + mainLowerOrder * (p₀ * mainMax) = + mainC := by + dsimp [mainLowerOrder, p₀, mainMax, + mainC, Cerase] + calc + (C.lowerOrder g₀.card).bundleMainProduct p * + (p (g₀.image C.projection) * + C.maximalRemainderMainProduct + g₀ p) = + ((C.lowerOrder g₀.card).bundleMainProduct p * + C.maximalRemainderMainProduct + g₀ p) * + p (g₀.image C.projection) := by + ring + _ = + (C.eraseEdge g₀).bundleMainProduct p * + p (g₀.image C.projection) := by + rw [ + C.lowerOrder_mul_maximalRemainder_eq_erase_main + g₀ p] + _ = C.bundleMainProduct p := + C.bundleMainProduct_eraseEdge_mul + p hg₀ + have hsqrtNormalized : + Real.sqrt + (β (d₀ + 1) * + countBoundary * countLower) ≤ + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1)) * + mainC := by + have hscaled : + rootCorrection ≤ + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1)) * + (p₀ * mainMax) := by + calc + rootCorrection = + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1)) * + α (d₀ + 1) ^ (n₀ + 1) := by + field_simp + _ ≤ + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1)) * + (p₀ * mainMax) := + mul_le_mul_of_nonneg_left hαp + (div_nonneg hrootCorrection0 + hαpowpos.le) + calc + Real.sqrt + (β (d₀ + 1) * + countBoundary * countLower) ≤ + rootCorrection * mainLowerOrder := + hsqrt + _ ≤ + ((rootCorrection / + α (d₀ + 1) ^ (n₀ + 1)) * + (p₀ * mainMax)) * + mainLowerOrder := + mul_le_mul_of_nonneg_right + hscaled hmainLowerOrder0 + _ = + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1)) * + mainC := by + rw [← hmainFactor] + ring + have hμmain : + μ (d₀ + 1) ^ (n₀ + 1) ≤ + mainC := by + dsimp [mainC] + have hpow := + C.pow_card_edges_le_bundleMainProduct_of_edges + p (hE.floor_pos (d₀ + 1)).le + (fun g hg => by + have hcard : + g.card ≤ d₀ + 1 := by + exact + (C.edge_card_le_order hg).trans_eq + (by + simpa [Nat.succ_eq_add_one] using + horderEq) + exact + (hE.rankFloor hcard).trans + (hpLower _ + (C.projection_mem_base g hg) |> + fun h => by + simpa [C.card_image_projection hg] + using h)) + simpa [hcardEq] using hpow + have hμpowpos : + 0 < μ (d₀ + 1) ^ (n₀ + 1) := + pow_pos (hE.floor_pos _) _ + have huniformNormalized : + τ ≤ + (τ / + μ (d₀ + 1) ^ (n₀ + 1)) * + mainC := by + calc + τ = + (τ / + μ (d₀ + 1) ^ (n₀ + 1)) * + μ (d₀ + 1) ^ (n₀ + 1) := by + field_simp + _ ≤ + (τ / + μ (d₀ + 1) ^ (n₀ + 1)) * + mainC := + mul_le_mul_of_nonneg_left hμmain + (div_nonneg hE.uniform_nonneg + hμpowpos.le) + have hstepRaw := + hstep K' C hclosedC hg₀ hmax + have hstepNormalized : + |C.bundleCount + (C.pullbackBaseEdgeWeight A) - + p₀ * countErase| ≤ + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1) + + τ / + μ (d₀ + 1) ^ (n₀ + 1)) * + mainC := by + calc + |C.bundleCount + (C.pullbackBaseEdgeWeight A) - + p₀ * countErase| ≤ + Real.sqrt + (β (d₀ + 1) * + countBoundary * countLower) + + τ := by + simpa [p₀, countErase, + countBoundary, countLower, + Cerase, Cboundary, Clower, + hgcardD] using hstepRaw + _ ≤ + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1)) * + mainC + + (τ / + μ (d₀ + 1) ^ (n₀ + 1)) * + mainC := + add_le_add hsqrtNormalized + huniformNormalized + _ = + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1) + + τ / + μ (d₀ + 1) ^ (n₀ + 1)) * + mainC := by + ring + have hp₀0 : 0 ≤ p₀ := by + dsimp [p₀] + exact hp0 _ + (C.projection_mem_base g₀ hg₀) + have hmainEraseFactor : + p₀ * mainErase = mainC := by + dsimp [p₀, mainErase, mainC, + Cerase] + rw [mul_comm] + exact + C.bundleMainProduct_eraseEdge_mul + p hg₀ + have hEraseNormalized : + p₀ * + |countErase - mainErase| ≤ + E (d₀ + 1) n₀ * mainC := by + calc + p₀ * + |countErase - mainErase| ≤ + p₀ * + (E (d₀ + 1) n₀ * + mainErase) := + mul_le_mul_of_nonneg_left + hEraseIH hp₀0 + _ = + E (d₀ + 1) n₀ * mainC := by + rw [← hmainEraseFactor] + ring + have hdecompose : + C.bundleCount + (C.pullbackBaseEdgeWeight A) - + mainC = + (C.bundleCount + (C.pullbackBaseEdgeWeight A) - + p₀ * countErase) + + p₀ * (countErase - mainErase) := by + rw [← hmainEraseFactor] + ring + rw [hdecompose] + calc + |(C.bundleCount + (C.pullbackBaseEdgeWeight A) - + p₀ * countErase) + + p₀ * (countErase - mainErase)| ≤ + |C.bundleCount + (C.pullbackBaseEdgeWeight A) - + p₀ * countErase| + + |p₀ * (countErase - mainErase)| := + abs_add_le _ _ + _ = + |C.bundleCount + (C.pullbackBaseEdgeWeight A) - + p₀ * countErase| + + p₀ * |countErase - mainErase| := by + rw [abs_mul, abs_of_nonneg hp₀0] + _ ≤ + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1) + + τ / + μ (d₀ + 1) ^ (n₀ + 1)) * + mainC + + E (d₀ + 1) n₀ * mainC := + add_le_add hstepNormalized + hEraseNormalized + _ = + (E (d₀ + 1) n₀ + + (rootCorrection / + α (d₀ + 1) ^ (n₀ + 1) + + τ / + μ (d₀ + 1) ^ (n₀ + 1))) * + mainC := by + ring + _ ≤ + E (d₀ + 1) (n₀ + 1) * + mainC := by + apply mul_le_mul_of_nonneg_right + · simpa [rootCorrection, + bundleCountingStepIncrement, + add_assoc] using + hE.add_stepIncrement_le d₀ n₀ + · exact hmainC0 + · have hcardLt : C.edges.card < n := + lt_of_le_of_ne hCn + hcardEq + have hsmall := + (ihCard C.edges.card hcardLt) + K' C hCd le_rfl hclosedC + have hmain0 : + 0 ≤ C.bundleMainProduct p := + C.bundleMainProduct_nonneg p hp0 + exact hsmall.trans + (mul_le_mul_of_nonneg_right + (hE.error_mono_card hCn) hmain0) + · have horderLt : C.order < d := + lt_of_le_of_ne hCd + horderEq + have hsmall := + (ihOrder C.order horderLt n) + K' C le_rfl hCn hclosedC + have hmain0 : + 0 ≤ C.bundleMainProduct p := + C.bundleMainProduct_nonneg p hp0 + exact hsmall.trans + (mul_le_mul_of_nonneg_right + (hE.error_mono_order hCd) hmain0) + exact + (hP B.order B.edges.card) + K B le_rfl le_rfl hclosed + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleSourceGoodnessBridge.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleSourceGoodnessBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..95415e8cd497f9a328a9eba365723e3b2e96f990 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/HypergraphBundleSourceGoodnessBridge.lean @@ -0,0 +1,829 @@ +import OAI.Combinatorics.Progressions.FixedDensity.HypergraphBundleFrozenUniformity +import OAI.Combinatorics.Progressions.FixedDensity.OrderedFullBoundary + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace HypergraphBundle + +variable {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + +noncomputable def projectedEdgeOrderIso + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) ≃ + {j : Fin k // j ∈ g.image B.projection} := by + let t := g.image B.projection + let e := B.orderedConfigurationBundleFace hg hne + have hcard : t.card = e.lowerRank.1 + 1 := by + have hedge : + positiveOrderedFaceEdge e = t := by + dsimp [e, orderedConfigurationBundleFace, t] + exact positiveOrderedFaceEdge_ofEdge + (g.image B.projection) + (B.projectedEdge_nonempty hg hne) + (B.projectedEdge_card_le hg) + calc + t.card = (positiveOrderedFaceEdge e).card := + congrArg Finset.card hedge.symm + _ = e.rank := positiveOrderedFaceEdge_card e + _ = e.lowerRank.1 + 1 := rfl + exact (t.orderIsoOfFin hcard).toEquiv + +@[simp] +theorem projectedEdgeOrderIso_apply_val + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (i : Fin ((B.orderedConfigurationBundleFace + hg hne).lowerRank.1 + 1)) : + ((B.projectedEdgeOrderIso hg hne) i).1 = + (B.orderedConfigurationBundleFace hg hne).face i := by + rfl + +noncomputable def orderedConfigurationBundleFaceTupleEquiv + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) : + ({v : K // v ∈ g} → G) ≃ + (Fin ((B.orderedConfigurationBundleFace hg hne).lowerRank.1 + 1) → G) := + (Equiv.arrowCongr + (B.projectionEquiv hg) + (Equiv.refl G)).trans + (Equiv.arrowCongr + (B.projectedEdgeOrderIso hg hne).symm + (Equiv.refl G)) + +omit [Fintype G] [DecidableEq G] in +@[simp] +theorem orderedConfigurationBundleFaceTupleEquiv_apply + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (y : {v : K // v ∈ g} → G) : + B.orderedConfigurationBundleFaceTupleEquiv hg hne y = + B.orderedConfigurationBundleFaceTuple hg hne y := by + funext i + unfold orderedConfigurationBundleFaceTupleEquiv + orderedConfigurationBundleFaceTuple + orderedConfigurationEdgeTuple projectedEdgeOrderIso + rfl + +def ambientPositiveFaceOfProperSubface + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + PositiveOrderedFace k r where + lowerRank := + ⟨d.lowerRank.1, + lt_trans d.lowerRank.2 e.lowerRank.2⟩ + face := orderedFullLowerAmbientFace e d + +@[simp] +theorem ambientPositiveFaceOfProperSubface_rank + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + (ambientPositiveFaceOfProperSubface e d).rank = d.rank := by + rfl + +theorem ambientPositiveFaceOfProperSubface_edge_ssubset + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + positiveOrderedFaceEdge + (ambientPositiveFaceOfProperSubface e d) ⊂ + positiveOrderedFaceEdge e := by + constructor + · intro v hv + rw [mem_positiveOrderedFaceEdge] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + exact ⟨d.face i, rfl⟩ + · intro h + have hcard := + Finset.card_le_card h + rw [positiveOrderedFaceEdge_card, + positiveOrderedFaceEdge_card] at hcard + exact + (Nat.not_le_of_gt + (properPositiveOrderedSubface_rank_lt_upper d)) hcard + +theorem exists_properPositiveOrderedSubface_of_edge_ssubset + (e f : PositiveOrderedFace k r) + (hfe : + positiveOrderedFaceEdge f ⊂ + positiveOrderedFaceEdge e) : + ∃ d : ProperPositiveOrderedSubface e.lowerRank.1, + ambientPositiveFaceOfProperSubface e d = f := by + have hrank : f.rank < e.rank := by + rw [← positiveOrderedFaceEdge_card, + ← positiveOrderedFaceEdge_card] + exact Finset.card_lt_card hfe + have hrange : + Set.range f.face ⊆ Set.range e.face := by + intro v hv + rw [← mem_positiveOrderedFaceEdge] at hv ⊢ + exact hfe.1 hv + choose q hq using fun i : Fin (f.lowerRank.1 + 1) => + hrange ⟨i, rfl⟩ + have hqmono : StrictMono q := by + intro i j hij + apply e.face.lt_iff_lt.mp + rw [hq i, hq j] + exact f.face.strictMono hij + let dface : OrderedFace + (e.lowerRank.1 + 1) (f.lowerRank.1 + 1) := + OrderEmbedding.ofStrictMono q hqmono + have hdlt : f.lowerRank.1 < e.lowerRank.1 := by + simpa [PositiveOrderedFace.rank] using hrank + let d : ProperPositiveOrderedSubface e.lowerRank.1 := + ⟨⟨f.lowerRank.1, hdlt⟩, dface⟩ + refine ⟨d, ?_⟩ + apply positiveOrderedFaceEdge_injective + apply Finset.Subset.antisymm + · intro v hv + rw [mem_positiveOrderedFaceEdge] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + exact ⟨i, (hq i).symm⟩ + · intro v hv + rw [mem_positiveOrderedFaceEdge] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + exact ⟨i, hq i⟩ + +noncomputable def orderedConfigurationStrictFaceFamily + (e : PositiveOrderedFace k r) : + Finset (PositiveOrderedFace k r) := + Finset.univ.filter fun f => + positiveOrderedFaceEdge f ⊂ positiveOrderedFaceEdge e + +@[simp] +theorem mem_orderedConfigurationStrictFaceFamily + (e f : PositiveOrderedFace k r) : + f ∈ orderedConfigurationStrictFaceFamily e ↔ + positiveOrderedFaceEdge f ⊂ positiveOrderedFaceEdge e := by + simp [orderedConfigurationStrictFaceFamily] + +theorem positiveOrderedFaceEdge_boundary_ssubset + (e : PositiveOrderedFace k r) + (hpos : 0 < e.lowerRank.1) + (i : Fin (e.lowerRank.1 + 1)) : + positiveOrderedFaceEdge (e.boundary hpos i) ⊂ + positiveOrderedFaceEdge e := by + rcases e with ⟨⟨j, hjr⟩, eface⟩ + cases j with + | zero => + simp at hpos + | succ n => + constructor + · intro v hv + rw [mem_positiveOrderedFaceEdge] at hv ⊢ + obtain ⟨q, rfl⟩ := hv + exact ⟨i.succAbove q, rfl⟩ + · intro h + have hc := Finset.card_le_card h + rw [positiveOrderedFaceEdge_card, + positiveOrderedFaceEdge_card] at hc + exact + (Nat.not_le_of_gt + ((⟨⟨n + 1, hjr⟩, eface⟩ : + PositiveOrderedFace k r).boundary_rank_lt + hpos i)) hc + +noncomputable def extendConfigurationFaceTuple + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + Fin k → G := + (splitOrderedFaceEquiv e.face).symm + (y, orderedFaceComplementTuple e.face A.witness) + +@[simp] +theorem orderedFaceTuple_extendConfigurationFaceTuple + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + orderedFaceTuple e.face + (extendConfigurationFaceTuple P A e y) = y := by + exact orderedFaceTuple_splitOrderedFaceEquiv_symm _ _ _ + +@[simp] +theorem extendConfigurationFaceTuple_projection + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g : Finset K} (hg : g ∈ B.edges) + (hne : g.Nonempty) + (y : {v : K // v ∈ g} → G) + (v : {v : K // v ∈ g}) : + extendConfigurationFaceTuple P A + (B.orderedConfigurationBundleFace hg hne) + (B.orderedConfigurationBundleFaceTuple hg hne y) + (B.projection v.1) = + y v := by + let j := B.projectionEquiv hg v + let i := + (B.projectedEdgeOrderIso hg hne).symm j + have hi : + B.projectedEdgeOrderIso hg hne i = j := + (B.projectedEdgeOrderIso hg hne).apply_symm_apply j + have hface : + (B.orderedConfigurationBundleFace hg hne).face i = + B.projection v.1 := by + calc + (B.orderedConfigurationBundleFace hg hne).face i = + ((B.projectedEdgeOrderIso hg hne) i).1 := by + rw [B.projectedEdgeOrderIso_apply_val] + _ = j.1 := congrArg Subtype.val hi + _ = B.projection v.1 := by + exact B.projectionEquiv_apply_val hg v + rw [← hface] + change + orderedFaceTuple + (B.orderedConfigurationBundleFace hg hne).face + (extendConfigurationFaceTuple P A + (B.orderedConfigurationBundleFace hg hne) + (B.orderedConfigurationBundleFaceTuple hg hne y)) i = + y v + rw [orderedFaceTuple_extendConfigurationFaceTuple] + change + B.projectedEdgeTuple hg y + ((B.projectedEdgeOrderIso hg hne) i) = + y v + rw [hi] + exact congrArg y + ((B.projectionEquiv hg).symm_apply_apply v) + +theorem sourceFullMixedBoundaryWeight_eq_strictFaceProduct + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + sourceFullMixedBoundaryWeight P A e y = + partialConfigurationWeight A + (orderedConfigurationStrictFaceFamily e) + (extendConfigurationFaceTuple P A e y) := by + classical + let x := extendConfigurationFaceTuple P A e y + have hxe : orderedFaceTuple e.face x = y := + orderedFaceTuple_extendConfigurationFaceTuple P A e y + by_cases hy : + y ∈ (orderedFullLowerBoundaryPartition P.coarse e).part + (orderedFaceTuple e.face A.witness) + · rw [show sourceFullMixedBoundaryWeight P A e y = 1 by + exact partitionAtomIndicator_of_mem _ _ hy] + unfold partialConfigurationWeight + symm + apply Finset.prod_eq_one + intro f hf + have hfe : + positiveOrderedFaceEdge f ⊂ + positiveOrderedFaceEdge e := + (mem_orderedConfigurationStrictFaceFamily e f).1 + hf + obtain ⟨d, rfl⟩ := + exists_properPositiveOrderedSubface_of_edge_ssubset e f hfe + unfold configurationFaceWeight + apply partitionAtomIndicator_of_mem + have hd := + (mem_orderedFullLowerBoundaryPartition_part_iff + P.coarse e + (orderedFaceTuple e.face A.witness) y).1 hy |>.2 d + change + orderedFaceTuple + (orderedFullLowerAmbientFace e d) x ∈ + (A.atom + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)).1 + rw [A.atom_eq_partitionAtomAt] + change + orderedFaceTuple d.face + (orderedFaceTuple e.face x) ∈ + (P.coarse.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)).part + (orderedFaceTuple d.face + (orderedFaceTuple e.face A.witness)) + rw [hxe] + exact hd + · rw [show sourceFullMixedBoundaryWeight P A e y = 0 by + exact partitionAtomIndicator_of_not_mem _ _ hy] + by_contra hprod + have hprod' : + partialConfigurationWeight A + (orderedConfigurationStrictFaceFamily e) x ≠ 0 := + fun hz => hprod hz.symm + have hall : + ∀ f ∈ orderedConfigurationStrictFaceFamily e, + configurationFaceWeight A f + (orderedFaceTuple f.face x) ≠ 0 := by + intro f hf + exact Finset.prod_ne_zero_iff.mp + (by simpa [partialConfigurationWeight] using hprod') f hf + exfalso + apply hy + apply + (mem_orderedFullLowerBoundaryPartition_part_iff + P.coarse e + (orderedFaceTuple e.face A.witness) y).2 + constructor + · rw [mem_orderedBoundaryPartition_part_iff] + intro i + by_cases he0 : e.lowerRank.1 = 0 + · have hsub : + eraseBoundaryCoordinate i y = + eraseBoundaryCoordinate i + (orderedFaceTuple e.face A.witness) := + by + funext q + have hq : q.1 < 0 := by + simpa [he0] using q.2 + omega + rw [hsub] + exact + (positiveFaceLowerLayer P.coarse e + (eraseBoundaryFace e.face i)).mem_part + (Finset.mem_univ _) + · have hepos : 0 < e.lowerRank.1 := + Nat.pos_of_ne_zero he0 + let f := e.boundary hepos i + have hfstrict : + positiveOrderedFaceEdge f ⊂ + positiveOrderedFaceEdge e := by + exact positiveOrderedFaceEdge_boundary_ssubset + e hepos i + have hfmem : + f ∈ orderedConfigurationStrictFaceFamily e := + (mem_orderedConfigurationStrictFaceFamily e f).2 hfstrict + have hfweight := hall f hfmem + rw [← hxe] + exact + coarse_boundary_mem_of_coarse_configuration_weight_ne_zero + P A e hepos i x hfweight + · intro d + let f := ambientPositiveFaceOfProperSubface e d + have hfmem : + f ∈ orderedConfigurationStrictFaceFamily e := + (mem_orderedConfigurationStrictFaceFamily e f).2 + (ambientPositiveFaceOfProperSubface_edge_ssubset e d) + have hfweight := hall f hfmem + unfold configurationFaceWeight at hfweight + have hfatom : + orderedFaceTuple f.face x ∈ + (A.atom f.lowerRank.succ f.face).1 := by + by_contra hnot + exact hfweight + (partitionAtomIndicator_of_not_mem _ _ hnot) + rw [A.atom_eq_partitionAtomAt] at hfatom + change + orderedFaceTuple + (orderedFullLowerAmbientFace e d) x ∈ + (P.coarse.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)).part + (orderedFaceTuple + (orderedFullLowerAmbientFace e d) A.witness) + at hfatom + simp only [orderedFaceTuple_orderedFullLowerAmbientFace] + at hfatom + simpa only [hxe] using hfatom + +def liftProjectedSubedge + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + (g₀ : Finset K) (t : Finset (Fin k)) : + Finset K := + g₀.filter fun v => B.projection v ∈ t + +theorem liftProjectedSubedge_subset + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + (g₀ : Finset K) (t : Finset (Fin k)) : + B.liftProjectedSubedge g₀ t ⊆ g₀ := by + exact Finset.filter_subset _ _ + +theorem image_liftProjectedSubedge + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + (g₀ : Finset K) {t : Finset (Fin k)} + (ht : t ⊆ g₀.image B.projection) : + (B.liftProjectedSubedge g₀ t).image B.projection = t := by + ext j + constructor + · intro hj + obtain ⟨v, hv, rfl⟩ := Finset.mem_image.mp hj + exact (Finset.mem_filter.mp hv).2 + · intro hj + obtain ⟨v, hvg, hvj⟩ := + Finset.mem_image.mp (ht hj) + apply Finset.mem_image.mpr + refine ⟨v, Finset.mem_filter.mpr ⟨hvg, ?_⟩, hvj⟩ + exact hvj ▸ hj + +theorem liftProjectedSubedge_image_eq + {K : Type*} [Fintype K] [DecidableEq K] + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + {g₀ g : Finset K} (hg₀ : g₀ ∈ B.edges) + (hgg₀ : g ⊆ g₀) : + B.liftProjectedSubedge g₀ + (g.image B.projection) = g := by + ext v + constructor + · intro hv + have hvg₀ := (Finset.mem_filter.mp hv).1 + obtain ⟨w, hwg, hwv⟩ := + Finset.mem_image.mp (Finset.mem_filter.mp hv).2 + have hwg₀ : w ∈ g₀ := hgg₀ hwg + have hwv' : w = v := + B.projection_injective_on_edge g₀ hg₀ hwg₀ hvg₀ hwv + exact hwv' ▸ hwg + · intro hv + exact Finset.mem_filter.mpr + ⟨hgg₀ hv, + Finset.mem_image.mpr ⟨v, hv, rfl⟩⟩ + +theorem strictBoundaryLocalProduct_orderedConfiguration_eq_sourceFull + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + (hclosed : B.IsClosedUnderInclusion) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hne : g₀.Nonempty) + (y : {v : K // v ∈ g₀} → G) : + B.strictBoundaryLocalProduct g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) y = + sourceFullMixedBoundaryWeight P A + (B.orderedConfigurationBundleFace hg₀ hne) + (B.orderedConfigurationBundleFaceTuple hg₀ hne y) := by + classical + let e := B.orderedConfigurationBundleFace hg₀ hne + let u := B.orderedConfigurationBundleFaceTuple hg₀ hne y + let x := extendConfigurationFaceTuple P A e u + have heedge : + positiveOrderedFaceEdge e = + g₀.image B.projection := by + dsimp [e, orderedConfigurationBundleFace] + exact positiveOrderedFaceEdge_ofEdge + (g₀.image B.projection) + (B.projectedEdge_nonempty hg₀ hne) + (B.projectedEdge_card_le hg₀) + let z : EdgeComplement g₀ → G := + fun v => A.witness (B.projection v.1) + let xK : K → G := + (splitEdgeEquiv g₀).symm (y, z) + have hxK : edgeTuple g₀ xK = y := by + exact edgeTuple_splitEdgeEquiv_symm g₀ y z + have hlocalProduct : + B.strictBoundaryLocalProduct g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) y = + (B.strictBoundary g₀).bundleProduct + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) xK := by + calc + B.strictBoundaryLocalProduct g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) y = + B.strictBoundaryLocalProduct g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) + (edgeTuple g₀ xK) := by + rw [hxK] + _ = + (B.strictBoundary g₀).bundleProduct + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) xK := + B.strictBoundaryLocalProduct_edgeTuple g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) xK + have hempty : ∅ ∈ (B.strictBoundary g₀).edges := by + apply (B.mem_strictBoundary_edges g₀ ∅).2 + refine ⟨hclosed hg₀ (Finset.empty_subset g₀), ?_⟩ + exact Finset.ssubset_iff_subset_ne.mpr + ⟨Finset.empty_subset _, hne.ne_empty.symm⟩ + have hemptyWeight : + B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A) ∅ + (edgeTuple ∅ xK) = 1 := by + rw [B.pullbackBaseEdgeWeight_of_mem + (orderedConfigurationBaseWeight A) + ((B.mem_strictBoundary_edges g₀ ∅).1 hempty).1] + exact orderedConfigurationBaseWeight_empty A _ + rw [hlocalProduct] + rw [sourceFullMixedBoundaryWeight_eq_strictFaceProduct P A e u] + unfold bundleProduct partialConfigurationWeight + rw [← Finset.prod_erase_mul _ _ hempty, + hemptyWeight, mul_one] + apply Finset.prod_bij + (fun g _hg => + positiveOrderedFaceOfEdge + (g.image B.projection) + (Finset.image_nonempty.mpr + (Finset.nonempty_iff_ne_empty.mpr + (Finset.mem_erase.mp _hg).1)) + (B.projectedEdge_card_le + (((B.mem_strictBoundary_edges g₀ g).1 + (Finset.mem_of_mem_erase _hg)).1))) + · intro g hg + simp only [Finset.mem_erase] at hg + rw [mem_orderedConfigurationStrictFaceFamily] + rw [positiveOrderedFaceEdge_ofEdge] + rw [heedge] + have hgstrict := + ((B.mem_strictBoundary_edges g₀ g).1 hg.2).2 + constructor + · intro j hj + obtain ⟨v, hvg, rfl⟩ := Finset.mem_image.mp hj + exact Finset.mem_image.mpr + ⟨v, hgstrict.1 hvg, rfl⟩ + · intro hreverse + apply hgstrict.2 + intro v hvg₀ + obtain ⟨w, hwg, hwv⟩ := + Finset.mem_image.mp + (hreverse + (Finset.mem_image.mpr + ⟨v, hvg₀, rfl⟩)) + have hwg₀ : w ∈ g₀ := hgstrict.1 hwg + have hwv' : w = v := + B.projection_injective_on_edge + g₀ hg₀ hwg₀ hvg₀ hwv + exact hwv' ▸ hwg + · intro g₁ hg₁ g₂ hg₂ heq + have himage : + g₁.image B.projection = + g₂.image B.projection := by + simpa only [positiveOrderedFaceEdge_ofEdge] using + congrArg positiveOrderedFaceEdge heq + have hg₁sub := + ((B.mem_strictBoundary_edges g₀ g₁).1 + (Finset.mem_of_mem_erase hg₁)).2.1 + have hg₂sub := + ((B.mem_strictBoundary_edges g₀ g₂).1 + (Finset.mem_of_mem_erase hg₂)).2.1 + rw [← B.liftProjectedSubedge_image_eq hg₀ hg₁sub, + ← B.liftProjectedSubedge_image_eq hg₀ hg₂sub, + himage] + · intro f hf + have hfe := + (mem_orderedConfigurationStrictFaceFamily e f).1 hf + let t := positiveOrderedFaceEdge f + let g := B.liftProjectedSubedge g₀ t + have ht : t ⊆ g₀.image B.projection := by + simpa [e, orderedConfigurationBundleFace, + positiveOrderedFaceEdge_ofEdge] using hfe.1 + have hgsub : g ⊆ g₀ := + B.liftProjectedSubedge_subset g₀ t + have hgmem : g ∈ B.edges := + hclosed hg₀ hgsub + have himage : g.image B.projection = t := + B.image_liftProjectedSubedge g₀ ht + have hgne : g ≠ ∅ := by + intro hzero + have : t = ∅ := by simpa [hzero] using himage.symm + have htne := positiveOrderedFaceEdge_nonempty f + change t.Nonempty at htne + rw [this] at htne + exact Finset.not_nonempty_empty htne + have hgproper : g ⊂ g₀ := by + refine ⟨hgsub, ?_⟩ + intro hgg + have hgeq : g = g₀ := + Finset.Subset.antisymm hgsub hgg + have : t = g₀.image B.projection := by + rw [← himage, hgeq] + apply hfe.2 + rw [heedge, ← this] + refine ⟨g, Finset.mem_erase.mpr + ⟨hgne, + (B.mem_strictBoundary_edges g₀ g).2 + ⟨hgmem, hgproper⟩⟩, ?_⟩ + apply positiveOrderedFaceEdge_injective + simpa only [positiveOrderedFaceEdge_ofEdge] using himage + · intro g hg + simp only [Finset.mem_erase] at hg + have hgB := + ((B.mem_strictBoundary_edges g₀ g).1 hg.2).1 + rw [B.pullbackBaseEdgeWeight_of_mem + (orderedConfigurationBaseWeight A) hgB] + unfold orderedConfigurationBaseWeight + simp only [dite_eq_left (Finset.image_nonempty.mpr + (Finset.nonempty_iff_ne_empty.mpr hg.1))] + simp only [dite_eq_left (B.projectedEdge_card_le hgB)] + congr 1 + have hgne : g.Nonempty := + Finset.nonempty_iff_ne_empty.mpr hg.1 + change + B.orderedConfigurationBundleFaceTuple + hgB hgne (edgeTuple g xK) = + orderedFaceTuple + (B.orderedConfigurationBundleFace hgB hgne).face x + funext i + let v : {v : K // v ∈ g} := + (B.projectionEquiv hgB).symm + (B.projectedEdgeOrderIso hgB hgne i) + have hgsub : + g ⊆ g₀ := + ((B.mem_strictBoundary_edges g₀ g).1 hg.2).2.1 + let v₀ : {v : K // v ∈ g₀} := + ⟨v.1, hgsub v.2⟩ + have hprojection : + (B.orderedConfigurationBundleFace hgB hgne).face i = + B.projection v₀.1 := by + calc + (B.orderedConfigurationBundleFace hgB hgne).face i = + (B.projectedEdgeOrderIso hgB hgne i).1 := by + rw [B.projectedEdgeOrderIso_apply_val] + _ = ((B.projectionEquiv hgB) v).1 := by + rw [Equiv.apply_symm_apply] + _ = B.projection v.1 := + B.projectionEquiv_apply_val hgB v + _ = B.projection v₀.1 := rfl + calc + B.orderedConfigurationBundleFaceTuple + hgB hgne (edgeTuple g xK) i = + xK v.1 := by + rfl + _ = y v₀ := by + have hv := congrFun hxK v₀ + exact hv + _ = x (B.projection v₀.1) := by + symm + exact + B.extendConfigurationFaceTuple_projection + P A hg₀ hne y v₀ + _ = + orderedFaceTuple + (B.orderedConfigurationBundleFace hgB hgne).face + x i := by + rw [orderedFaceTuple, hprojection] + +theorem strictBoundary_bundleCount_orderedConfiguration_eq_sourceFullMass + {K : Type*} [Fintype K] [DecidableEq K] + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (B : HypergraphBundle (Fin k) K + (orderedConfigurationBaseEdges k r)) + (hclosed : B.IsClosedUnderInclusion) + {g₀ : Finset K} (hg₀ : g₀ ∈ B.edges) + (hne : g₀.Nonempty) : + (B.strictBoundary g₀).bundleCount + ((B.strictBoundary g₀).pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) = + mean (sourceFullMixedBoundaryWeight P A + (B.orderedConfigurationBundleFace hg₀ hne)) := by + classical + rw [← B.bundleCount_pullback_eq_of_subset_of_projection_eq + (B.strictBoundary g₀) + (Finset.filter_subset _ _) + rfl + (orderedConfigurationBaseWeight A)] + cases isEmpty_or_nonempty G with + | inl hG => + let : IsEmpty G := hG + have : Nonempty K := ⟨hne.choose⟩ + have : + Nonempty + (Fin ((B.orderedConfigurationBundleFace hg₀ hne).lowerRank.1 + 1)) := + ⟨⟨0, Nat.succ_pos _⟩⟩ + simp only [bundleCount, mean_empty] + | inr hG => + let : Nonempty G := hG + unfold bundleCount + rw [mean_splitEdge g₀] + unfold mean₂ + have hfiber : + ∀ y : {v : K // v ∈ g₀} → G, + mean (fun z : EdgeComplement g₀ → G => + (B.strictBoundary g₀).bundleProduct + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) + ((splitEdgeEquiv g₀).symm (y, z))) = + sourceFullMixedBoundaryWeight P A + (B.orderedConfigurationBundleFace hg₀ hne) + (B.orderedConfigurationBundleFaceTupleEquiv + hg₀ hne y) := by + intro y + calc + mean (fun z : EdgeComplement g₀ → G => + (B.strictBoundary g₀).bundleProduct + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) + ((splitEdgeEquiv g₀).symm (y, z))) = + mean (fun _z : EdgeComplement g₀ → G => + B.strictBoundaryLocalProduct g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) y) := by + apply congrArg mean + funext z + rw [← B.strictBoundaryLocalProduct_edgeTuple g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) + ((splitEdgeEquiv g₀).symm (y, z))] + rw [edgeTuple_splitEdgeEquiv_symm] + _ = + B.strictBoundaryLocalProduct g₀ + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) y := by + exact mean_const _ + _ = + sourceFullMixedBoundaryWeight P A + (B.orderedConfigurationBundleFace hg₀ hne) + (B.orderedConfigurationBundleFaceTuple hg₀ hne y) := + B.strictBoundaryLocalProduct_orderedConfiguration_eq_sourceFull + P A hclosed hg₀ hne y + _ = + sourceFullMixedBoundaryWeight P A + (B.orderedConfigurationBundleFace hg₀ hne) + (B.orderedConfigurationBundleFaceTupleEquiv hg₀ hne y) := by + rw [orderedConfigurationBundleFaceTupleEquiv_apply] + rw [show + (fun y : {v : K // v ∈ g₀} → G => + mean (fun z : EdgeComplement g₀ → G => + (B.strictBoundary g₀).bundleProduct + (B.pullbackBaseEdgeWeight + (orderedConfigurationBaseWeight A)) + ((splitEdgeEquiv g₀).symm (y, z)))) = + fun y => + sourceFullMixedBoundaryWeight P A + (B.orderedConfigurationBundleFace hg₀ hne) + (B.orderedConfigurationBundleFaceTupleEquiv + hg₀ hne y) by + funext y + exact hfiber y] + exact mean_equiv + (B.orderedConfigurationBundleFaceTupleEquiv hg₀ hne) + (fun y => + sourceFullMixedBoundaryWeight P A + (B.orderedConfigurationBundleFace hg₀ hne) + (B.orderedConfigurationBundleFaceTupleEquiv hg₀ hne y)) + (sourceFullMixedBoundaryWeight P A + (B.orderedConfigurationBundleFace hg₀ hne)) + (fun _ => rfl) + +theorem hasOrderedConfigurationBundleLocalizedDefect_of_sourceFullMixedGood + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsSourceFullMixedGood P α β) : + HasOrderedConfigurationBundleLocalizedDefect P A β := by + intro K _ _ B hclosed g₀ hg₀ hmax hne + let e := B.orderedConfigurationBundleFace hg₀ hne + have hrank : e.rank = g₀.card := by + unfold e orderedConfigurationBundleFace + rw [← positiveOrderedFaceEdge_card] + rw [positiveOrderedFaceEdge_ofEdge] + exact B.card_image_projection hg₀ + have hlocal := hgood.localized_defect P A α β e + rw [← hrank] + rw [B.strictBoundary_bundleCount_orderedConfiguration_eq_sourceFullMass + P A hclosed hg₀ hne] + calc + mean (fun y => + B.orderedConfigurationBundleLocalizedDefect + P A hg₀ hne y ^ 2) = + sourceFullMixedLocalizedDefectSq P A e := by + apply mean_equiv + (B.orderedConfigurationBundleFaceTupleEquiv hg₀ hne) + intro y + unfold orderedConfigurationBundleLocalizedDefect + orderedConfigurationBundleDefect + sourceFullMixedDefect + rw [B.strictBoundaryLocalProduct_orderedConfiguration_eq_sourceFull + P A hclosed hg₀ hne y] + rw [mul_pow, sourceFullMixedBoundaryWeight_sq] + rw [orderedConfigurationBundleFaceTupleEquiv_apply] + _ ≤ + β e.rank * + mean (sourceFullMixedBoundaryWeight P A e) := + hlocal + +end HypergraphBundle + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedAtomEnergy.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedAtomEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..8793750f43e11b409e13d78ff9df4f22e4124036 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedAtomEnergy.lean @@ -0,0 +1,748 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedBoundaryPartition + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +variable {Ω ι : Type*} + [Fintype Ω] [DecidableEq Ω] + +namespace FaceRegularityState + +noncomputable def familyEnergy [Fintype ι] + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) : ℝ := + ∑ i, S.energy (f i) + +def IsFamilyRegularAgainst + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : Prop := + ∀ i, S.IsRegularAgainst (f i) cuts ε + +theorem familyEnergy_nonneg [Fintype ι] + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) : + 0 ≤ S.familyEnergy f := by + unfold familyEnergy + exact Finset.sum_nonneg fun i _ => + partitionEnergy_nonneg S.partition (f i) + +theorem familyEnergy_le_card [Fintype ι] [Nonempty Ω] + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (hf0 : ∀ i x, 0 ≤ f i x) + (hf1 : ∀ i x, f i x ≤ 1) : + S.familyEnergy f ≤ (Fintype.card ι : ℝ) := by + unfold familyEnergy + calc + (∑ i, S.energy (f i)) ≤ ∑ _i : ι, (1 : ℝ) := by + apply Finset.sum_le_sum + intro i _ + exact partitionEnergy_le_one S.partition + (hf0 i) (hf1 i) + _ = (Fintype.card ι : ℝ) := by simp + +theorem familyEnergy_mono [Fintype ι] + (S T : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (hTS : T.partition ≤ S.partition) : + S.familyEnergy f ≤ T.familyEnergy f := by + unfold familyEnergy + apply Finset.sum_le_sum + intro i _ + exact partitionEnergy_mono T.partition S.partition + hTS (f i) + +theorem familyEnergy_refineBy_increment [Fintype ι] + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (i : ι) (A : BooleanCutTest Ω) {ε : ℝ} + (hgain : + S.energy (f i) + ε ^ 2 ≤ + (S.refineBy A).energy (f i)) : + S.familyEnergy f + ε ^ 2 ≤ + (S.refineBy A).familyEnergy f := by + classical + let U : Finset ι := Finset.univ + have hiU : i ∈ U := by simp [U] + have hother : + ∑ j ∈ U.erase i, S.energy (f j) ≤ + ∑ j ∈ U.erase i, (S.refineBy A).energy (f j) := by + apply Finset.sum_le_sum + intro j _ + exact partitionEnergy_mono + (S.refineBy A).partition S.partition + (S.refineBy_le A) (f j) + unfold familyEnergy + change + (∑ j ∈ U, S.energy (f j)) + ε ^ 2 ≤ + ∑ j ∈ U, (S.refineBy A).energy (f j) + calc + (∑ j ∈ U, S.energy (f j)) + ε ^ 2 = + (∑ j ∈ U.erase i, S.energy (f j)) + + (S.energy (f i) + ε ^ 2) := by + rw [← Finset.sum_erase_add U + (fun j => S.energy (f j)) hiU] + ring + _ ≤ + (∑ j ∈ U.erase i, (S.refineBy A).energy (f j)) + + (S.refineBy A).energy (f i) := + add_le_add hother hgain + _ = ∑ j ∈ U, (S.refineBy A).energy (f j) := by + exact Finset.sum_erase_add U + (fun j => (S.refineBy A).energy (f j)) hiU + +theorem exists_index_booleanCut_of_not_familyRegular + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) {ε : ℝ} + (h : ¬S.IsFamilyRegularAgainst f cuts ε) : + ∃ i : ι, ∃ A ∈ cuts, + ε < |S.booleanCutCorrelation (f i) A| := by + classical + unfold IsFamilyRegularAgainst at h + obtain ⟨i, hi⟩ := not_forall.mp h + obtain ⟨A, hA, hcorr⟩ := + S.exists_booleanCut_of_not_regular (f i) cuts hi + exact ⟨i, A, hA, hcorr⟩ + +structure FamilyIrregularWitness + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) where + index : ι + cut : BooleanCutTest Ω + mem_cuts : cut ∈ cuts + correlation : + ε < |S.booleanCutCorrelation (f index) cut| + +noncomputable def chosenFamilyIrregularWitness + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (h : ¬S.IsFamilyRegularAgainst f cuts ε) : + S.FamilyIrregularWitness f cuts ε := by + classical + let hex := + S.exists_index_booleanCut_of_not_familyRegular f cuts h + let i : ι := Classical.choose hex + let hi := Classical.choose_spec hex + let A : BooleanCutTest Ω := Classical.choose hi + have hA := + (Classical.choose_spec hi).1 + have hcorr := + (Classical.choose_spec hi).2 + exact ⟨i, A, hA, hcorr⟩ + +noncomputable def chosenFamilyIrregularCut + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : + BooleanCutTest Ω := by + classical + exact + if h : S.IsFamilyRegularAgainst f cuts ε then ∅ + else (S.chosenFamilyIrregularWitness f cuts ε h).cut + +theorem chosenFamilyIrregularCut_mem + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (h : ¬S.IsFamilyRegularAgainst f cuts ε) : + S.chosenFamilyIrregularCut f cuts ε ∈ cuts := by + simp only [chosenFamilyIrregularCut, dite_eq_right h] + exact + (S.chosenFamilyIrregularWitness f cuts ε h).mem_cuts + +theorem exists_chosenFamilyIrregularCut_correlation + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (h : ¬S.IsFamilyRegularAgainst f cuts ε) : + ∃ i : ι, + ε < + |S.booleanCutCorrelation (f i) + (S.chosenFamilyIrregularCut f cuts ε)| := by + let W := S.chosenFamilyIrregularWitness f cuts ε h + refine ⟨W.index, ?_⟩ + simp only [chosenFamilyIrregularCut, dite_eq_right h] + exact W.correlation + +theorem familyEnergy_increment_chosenFamilyCut [Fintype ι] [Nonempty Ω] + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) {ε : ℝ} + (hε : 0 ≤ ε) + (h : ¬S.IsFamilyRegularAgainst f cuts ε) : + S.familyEnergy f + ε ^ 2 ≤ + (S.refineBy + (S.chosenFamilyIrregularCut f cuts ε)).familyEnergy f := by + obtain ⟨i, hcorr⟩ := + S.exists_chosenFamilyIrregularCut_correlation f cuts ε h + apply S.familyEnergy_refineBy_increment f i + exact S.energy_increment_of_booleanCut + (f i) (S.chosenFamilyIrregularCut f cuts ε) + hε (le_of_lt hcorr) + +noncomputable def familyRegularityRun + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : + ℕ → FaceRegularityState Ω + | 0 => S + | n + 1 => + let T := familyRegularityRun S f cuts ε n + T.refineBy (T.chosenFamilyIrregularCut f cuts ε) + +@[simp] +theorem familyRegularityRun_zero + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : + S.familyRegularityRun f cuts ε 0 = S := + rfl + +@[simp] +theorem familyRegularityRun_succ + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) (n : ℕ) : + S.familyRegularityRun f cuts ε (n + 1) = + (S.familyRegularityRun f cuts ε n).refineBy + ((S.familyRegularityRun f cuts ε n).chosenFamilyIrregularCut + f cuts ε) := + rfl + +theorem familyRegularityRun_partition_le + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) (n : ℕ) : + (S.familyRegularityRun f cuts ε n).partition ≤ + S.partition := by + induction n with + | zero => exact le_rfl + | succ n ih => + exact le_trans + ((S.familyRegularityRun f cuts ε n).refineBy_le + ((S.familyRegularityRun f cuts ε n).chosenFamilyIrregularCut + f cuts ε)) + ih + +theorem familyRegularityRun_complexity_le + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) (n : ℕ) : + FacePartition.complexity + (S.familyRegularityRun f cuts ε n).partition ≤ + 2 ^ n * FacePartition.complexity S.partition := by + induction n with + | zero => simp + | succ n ih => + calc + FacePartition.complexity + (S.familyRegularityRun f cuts ε (n + 1)).partition ≤ + 2 * FacePartition.complexity + (S.familyRegularityRun f cuts ε n).partition := by + rw [familyRegularityRun_succ] + exact + (S.familyRegularityRun f cuts ε n).complexity_refineBy_le + ((S.familyRegularityRun f cuts ε n).chosenFamilyIrregularCut + f cuts ε) + _ ≤ 2 * (2 ^ n * + FacePartition.complexity S.partition) := + Nat.mul_le_mul_left 2 ih + _ = 2 ^ (n + 1) * + FacePartition.complexity S.partition := by + rw [pow_succ] + ring + +noncomputable def familyRegularityRunCuts + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) (n : ℕ) : + Finset (BooleanCutTest Ω) := by + classical + exact (Finset.range n).image fun i => + (S.familyRegularityRun f cuts ε i).chosenFamilyIrregularCut + f cuts ε + +@[simp] +theorem familyRegularityRunCuts_zero + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) : + S.familyRegularityRunCuts f cuts ε 0 = ∅ := by + simp [familyRegularityRunCuts] + +@[simp] +theorem familyRegularityRunCuts_succ + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) (n : ℕ) : + S.familyRegularityRunCuts f cuts ε (n + 1) = + insert + ((S.familyRegularityRun f cuts ε n).chosenFamilyIrregularCut + f cuts ε) + (S.familyRegularityRunCuts f cuts ε n) := by + classical + simp [familyRegularityRunCuts, Finset.range_add_one] + +theorem chosenFamilyIrregularCut_mem_of_empty_mem + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (hempty : (∅ : BooleanCutTest Ω) ∈ cuts) : + S.chosenFamilyIrregularCut f cuts ε ∈ cuts := by + by_cases hregular : + S.IsFamilyRegularAgainst f cuts ε + · simpa [chosenFamilyIrregularCut, hregular] using hempty + · exact S.chosenFamilyIrregularCut_mem f cuts ε hregular + +theorem familyRegularityRunCuts_subset + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) + (hempty : (∅ : BooleanCutTest Ω) ∈ cuts) (n : ℕ) : + S.familyRegularityRunCuts f cuts ε n ⊆ cuts := by + classical + intro A hA + obtain ⟨i, _hi, rfl⟩ := Finset.mem_image.mp hA + exact chosenFamilyIrregularCut_mem_of_empty_mem + (S.familyRegularityRun f cuts ε i) f cuts ε hempty + +theorem familyRegularityRun_partition_eq_join_generatedBy + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) (ε : ℝ) (n : ℕ) : + (S.familyRegularityRun f cuts ε n).partition = + FacePartition.join S.partition + (FacePartition.generatedBy + (S.familyRegularityRunCuts f cuts ε n)) := by + induction n with + | zero => + rw [familyRegularityRun_zero, familyRegularityRunCuts_zero, + FacePartition.generatedBy_empty] + change S.partition = S.partition ⊓ ⊤ + exact (inf_top_eq S.partition).symm + | succ n ih => + let A : BooleanCutTest Ω := + (S.familyRegularityRun f cuts ε n).chosenFamilyIrregularCut + f cuts ε + calc + (S.familyRegularityRun f cuts ε (n + 1)).partition = + FacePartition.join + (S.familyRegularityRun f cuts ε n).partition + (FacePartition.generatedBy + ({A} : Finset (Finset Ω))) := by + rfl + _ = + FacePartition.join + (FacePartition.join S.partition + (FacePartition.generatedBy + (S.familyRegularityRunCuts f cuts ε n))) + (FacePartition.generatedBy + ({A} : Finset (Finset Ω))) := by + rw [ih] + _ = + FacePartition.join S.partition + (FacePartition.join + (FacePartition.generatedBy + (S.familyRegularityRunCuts f cuts ε n)) + (FacePartition.generatedBy + ({A} : Finset (Finset Ω)))) := by + exact inf_assoc _ _ _ + _ = + FacePartition.join S.partition + (FacePartition.generatedBy + (insert A + (S.familyRegularityRunCuts f cuts ε n))) := by + rw [FacePartition.generatedBy_insert] + _ = + FacePartition.join S.partition + (FacePartition.generatedBy + (S.familyRegularityRunCuts f cuts ε (n + 1))) := by + rw [familyRegularityRunCuts_succ] + +theorem exists_familyRegular_run_index_before [Fintype ι] [Nonempty Ω] + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) + {ε : ℝ} {m : ℕ} + (hf0 : ∀ i x, 0 ≤ f i x) + (hf1 : ∀ i x, f i x ≤ 1) + (hε : 0 ≤ ε) + (hlong : + (Fintype.card ι : ℝ) < (m : ℝ) * ε ^ 2) : + ∃ n : ℕ, n < m ∧ + (S.familyRegularityRun f cuts ε n).IsFamilyRegularAgainst + f cuts ε := by + by_contra hregular + have hnotregular : + ∀ n, n < m → + ¬(S.familyRegularityRun f cuts ε n).IsFamilyRegularAgainst + f cuts ε := by + intro n hn hreg + exact hregular ⟨n, hn, hreg⟩ + have hgain : + ∀ n, n < m → + (S.familyRegularityRun f cuts ε n).familyEnergy f + + ε ^ 2 ≤ + (S.familyRegularityRun f cuts ε (n + 1)).familyEnergy + f := by + intro n hn + rw [familyRegularityRun_succ] + exact + familyEnergy_increment_chosenFamilyCut + (S.familyRegularityRun f cuts ε n) + f cuts hε (hnotregular n hn) + have growth : + ∀ n : ℕ, + (∀ i, i < n → + (S.familyRegularityRun f cuts ε i).familyEnergy f + + ε ^ 2 ≤ + (S.familyRegularityRun f cuts ε (i + 1)).familyEnergy f) → + (S.familyRegularityRun f cuts ε 0).familyEnergy f + + (n : ℝ) * ε ^ 2 ≤ + (S.familyRegularityRun f cuts ε n).familyEnergy f := by + intro n + induction n with + | zero => + intro _ + simp + | succ n ih => + intro hn + have hprevious := + ih (fun i hi => + hn i (Nat.lt_trans hi (Nat.lt_succ_self n))) + have hstep := hn n (Nat.lt_succ_self n) + calc + (S.familyRegularityRun f cuts ε 0).familyEnergy f + + (↑(Nat.succ n) : ℝ) * ε ^ 2 = + ((S.familyRegularityRun f cuts ε 0).familyEnergy f + + (n : ℝ) * ε ^ 2) + ε ^ 2 := by + push_cast + ring + _ ≤ + (S.familyRegularityRun f cuts ε n).familyEnergy f + + ε ^ 2 := by linarith + _ ≤ + (S.familyRegularityRun f cuts ε (n + 1)).familyEnergy + f := hstep + have hgrowth := growth m hgain + have hnonneg : + 0 ≤ (S.familyRegularityRun f cuts ε 0).familyEnergy f := + (S.familyRegularityRun f cuts ε 0).familyEnergy_nonneg f + have hupper : + (S.familyRegularityRun f cuts ε m).familyEnergy f ≤ + (Fintype.card ι : ℝ) := + (S.familyRegularityRun f cuts ε m).familyEnergy_le_card + f hf0 hf1 + linarith + +theorem exists_familyRegular_refinement_with_generators_before [Fintype ι] [Nonempty Ω] + (S : FaceRegularityState Ω) (f : ι → Ω → ℝ) + (cuts : Finset (BooleanCutTest Ω)) + {ε : ℝ} {m : ℕ} + (hf0 : ∀ i x, 0 ≤ f i x) + (hf1 : ∀ i x, f i x ≤ 1) + (hε : 0 ≤ ε) + (hlong : + (Fintype.card ι : ℝ) < (m : ℝ) * ε ^ 2) + (hempty : (∅ : BooleanCutTest Ω) ∈ cuts) : + ∃ n : ℕ, ∃ T : FaceRegularityState Ω, + ∃ F : Finset (BooleanCutTest Ω), + n < m ∧ + T.partition = + FacePartition.join S.partition + (FacePartition.generatedBy F) ∧ + F ⊆ cuts ∧ + F.card ≤ n ∧ + T.IsFamilyRegularAgainst f cuts ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ n * FacePartition.complexity S.partition := by + obtain ⟨n, hn, hregular⟩ := + S.exists_familyRegular_run_index_before f cuts + hf0 hf1 hε hlong + let T := S.familyRegularityRun f cuts ε n + let F := S.familyRegularityRunCuts f cuts ε n + refine ⟨n, T, F, hn, ?_, ?_, ?_, hregular, ?_⟩ + · exact S.familyRegularityRun_partition_eq_join_generatedBy + f cuts ε n + · exact S.familyRegularityRunCuts_subset f cuts ε hempty n + · unfold F familyRegularityRunCuts + exact Finset.card_image_le.trans_eq (Finset.card_range n) + · exact S.familyRegularityRun_complexity_le f cuts ε n + +def IsFaceCutRegularFamily + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (f : ι → (Fin r → G) → ℝ) (ε : ℝ) : Prop := + ∀ i, S.IsFaceCutRegular (f i) ε + +theorem isFaceCutRegularFamily_of_familyRegularAgainst_supports + {G : Type*} [Fintype G] [DecidableEq G] {r : ℕ} + (S : FaceRegularityState (Fin r → G)) + (f : ι → (Fin r → G) → ℝ) {ε : ℝ} + (hregular : + S.IsFamilyRegularAgainst f + (booleanFaceCutSupports G r) ε) : + S.IsFaceCutRegularFamily f ε := by + intro i + exact S.isFaceCutRegular_of_regularAgainst_supports + (f i) (hregular i) + +theorem exists_faceCutRegularFamily_refinement_with_generators_before [Fintype ι] + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {r : ℕ} (hr : 0 < r) + (S : FaceRegularityState (Fin r → G)) + (f : ι → (Fin r → G) → ℝ) + {ε : ℝ} {m : ℕ} + (hf0 : ∀ i x, 0 ≤ f i x) + (hf1 : ∀ i x, f i x ≤ 1) + (hε : 0 ≤ ε) + (hlong : + (Fintype.card ι : ℝ) < (m : ℝ) * ε ^ 2) : + ∃ n : ℕ, + ∃ T : FaceRegularityState (Fin r → G), + ∃ F : Finset (BooleanCutTest (Fin r → G)), + n < m ∧ + T.partition = + FacePartition.join S.partition + (FacePartition.generatedBy F) ∧ + F ⊆ booleanFaceCutSupports G r ∧ + F.card ≤ n ∧ + T.IsFaceCutRegularFamily f ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ n * FacePartition.complexity S.partition := by + obtain ⟨n, T, F, hn, hpart, hsubset, hcard, + hregular, hcomplexity⟩ := + S.exists_familyRegular_refinement_with_generators_before + f (booleanFaceCutSupports G r) + hf0 hf1 hε hlong + (empty_mem_booleanFaceCutSupports hr) + exact + ⟨n, T, F, hn, hpart, hsubset, hcard, + T.isFaceCutRegularFamily_of_familyRegularAgainst_supports + f hregular, + hcomplexity⟩ + +end FaceRegularityState + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def partitionAtomIndicator + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (Q : FacePartition Ω) (a : Q.parts) : + Ω → ℝ := + finsetIndicator a.1 + +@[simp] +theorem partitionAtomIndicator_of_mem + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (Q : FacePartition Ω) (a : Q.parts) {x : Ω} + (hx : x ∈ a.1) : + partitionAtomIndicator Q a x = 1 := + finsetIndicator_of_mem hx + +@[simp] +theorem partitionAtomIndicator_of_not_mem + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (Q : FacePartition Ω) (a : Q.parts) {x : Ω} + (hx : x ∉ a.1) : + partitionAtomIndicator Q a x = 0 := + finsetIndicator_of_not_mem hx + +theorem partitionAtomIndicator_nonneg + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (Q : FacePartition Ω) (a : Q.parts) (x : Ω) : + 0 ≤ partitionAtomIndicator Q a x := by + by_cases hx : x ∈ a.1 <;> simp [hx] + +theorem partitionAtomIndicator_le_one + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (Q : FacePartition Ω) (a : Q.parts) (x : Ω) : + partitionAtomIndicator Q a x ≤ 1 := by + by_cases hx : x ∈ a.1 <;> simp [hx] + +theorem partitionAtomIndicator_sq + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (Q : FacePartition Ω) (a : Q.parts) (x : Ω) : + partitionAtomIndicator Q a x ^ 2 = + partitionAtomIndicator Q a x := by + by_cases hx : x ∈ a.1 <;> simp [hx] + +theorem sum_partitionAtomIndicator + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (Q : FacePartition Ω) (x : Ω) : + ∑ a : Q.parts, partitionAtomIndicator Q a x = 1 := by + classical + let ax : Q.parts := + ⟨Q.part x, Q.part_mem.2 (Finset.mem_univ x)⟩ + rw [Finset.sum_eq_single ax] + · exact partitionAtomIndicator_of_mem Q ax + (Q.mem_part (Finset.mem_univ x)) + · intro b _hb hba + apply partitionAtomIndicator_of_not_mem + intro hxb + have heq : + b = ax := by + apply Subtype.ext + exact Q.eq_of_mem_parts b.2 ax.2 hxb + (Q.mem_part (Finset.mem_univ x)) + exact hba heq + · intro hax + exact (hax (Finset.mem_univ ax)).elim + +theorem conditionalMean_fintype_sum + {Ω κ : Type*} + [Fintype Ω] [DecidableEq Ω] [Fintype κ] + (P : FacePartition Ω) (f : κ → Ω → ℝ) (x : Ω) : + conditionalMean P (fun y => ∑ i : κ, f i y) x = + ∑ i : κ, conditionalMean P (f i) x := by + unfold conditionalMean + exact Finset.expect_sum_comm + (P.part x) (Finset.univ : Finset κ) + (fun y i => f i y) + +theorem sum_conditionalMean_partitionAtomIndicator + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P Q : FacePartition Ω) (x : Ω) : + ∑ a : Q.parts, + conditionalMean P (partitionAtomIndicator Q a) x = + 1 := by + rw [← conditionalMean_fintype_sum] + convert conditionalMean_const P 1 x using 2 + funext y + exact sum_partitionAtomIndicator Q y + +noncomputable def partitionAtomEnergy + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P Q : FacePartition Ω) : ℝ := + ∑ a : Q.parts, + Erdos3.FixedDensity.partitionEnergy P + (partitionAtomIndicator Q a) + +theorem partitionAtomEnergy_nonneg + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P Q : FacePartition Ω) : + 0 ≤ partitionAtomEnergy P Q := by + unfold partitionAtomEnergy + exact Finset.sum_nonneg fun a _ => + Erdos3.FixedDensity.partitionEnergy_nonneg P + (partitionAtomIndicator Q a) + +theorem partitionAtomEnergy_le_one + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] [Nonempty Ω] + (P Q : FacePartition Ω) : + partitionAtomEnergy P Q ≤ 1 := by + unfold partitionAtomEnergy + calc + (∑ a : Q.parts, + Erdos3.FixedDensity.partitionEnergy P + (partitionAtomIndicator Q a)) ≤ + ∑ a : Q.parts, + mean (fun x => + partitionAtomIndicator Q a x ^ 2) := by + apply Finset.sum_le_sum + intro a _ + exact partitionEnergy_le_mean_sq P + (partitionAtomIndicator Q a) + _ = + ∑ a : Q.parts, + mean (partitionAtomIndicator Q a) := by + apply Finset.sum_congr rfl + intro a _ + apply congrArg mean + funext x + exact partitionAtomIndicator_sq Q a x + _ = + mean (fun x => + ∑ a : Q.parts, partitionAtomIndicator Q a x) := by + unfold mean + exact + (Finset.expect_sum_comm + (Finset.univ : Finset Ω) + (Finset.univ : Finset Q.parts) + (fun x a => partitionAtomIndicator Q a x)).symm + _ = mean (fun _x : Ω => (1 : ℝ)) := by + apply congrArg mean + funext x + exact sum_partitionAtomIndicator Q x + _ = 1 := mean_const 1 + +theorem partitionAtomEnergy_mono + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {P R : FacePartition Ω} (hPR : P ≤ R) + (Q : FacePartition Ω) : + partitionAtomEnergy R Q ≤ partitionAtomEnergy P Q := by + unfold partitionAtomEnergy + apply Finset.sum_le_sum + intro a _ + exact partitionEnergy_mono P R hPR + (partitionAtomIndicator Q a) + +theorem partitionAtomEnergy_sub_eq_sum_mean_sq + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {P R : FacePartition Ω} (hPR : P ≤ R) + (Q : FacePartition Ω) : + partitionAtomEnergy P Q - partitionAtomEnergy R Q = + ∑ a : Q.parts, + mean (fun x => + (conditionalMean P (partitionAtomIndicator Q a) x - + conditionalMean R (partitionAtomIndicator Q a) x) ^ 2) := by + unfold partitionAtomEnergy + rw [← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro a _ + exact partitionEnergy_sub_eq_mean_sq P R hPR + (partitionAtomIndicator Q a) + +noncomputable def orderedAtomEnergy + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) : ℝ := + partitionAtomEnergy (orderedBoundaryPartition lower e) upper + +theorem orderedAtomEnergy_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) : + 0 ≤ orderedAtomEnergy lower e upper := + partitionAtomEnergy_nonneg _ _ + +theorem orderedAtomEnergy_le_one + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) : + orderedAtomEnergy lower e upper ≤ 1 := + partitionAtomEnergy_le_one _ _ + +theorem orderedAtomEnergy_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) : + orderedAtomEnergy coarse e upper ≤ + orderedAtomEnergy fine e upper := by + exact partitionAtomEnergy_mono + (orderedBoundaryPartition_mono hfc e) upper + +theorem orderedAtomEnergy_sub_eq_sum_mean_sq + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) : + orderedAtomEnergy fine e upper - + orderedAtomEnergy coarse e upper = + ∑ a : upper.parts, + mean (fun x => + (orderedBoundaryStructured fine e + (partitionAtomIndicator upper a) x - + orderedBoundaryStructured coarse e + (partitionAtomIndicator upper a) x) ^ 2) := by + exact partitionAtomEnergy_sub_eq_sum_mean_sq + (orderedBoundaryPartition_mono hfc e) upper + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedBoundaryPartition.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedBoundaryPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..79387bd5bfbe391f54eb36a80c40c46d87833206 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedBoundaryPartition.lean @@ -0,0 +1,1457 @@ +import Mathlib.Data.Fin.Tuple.Finset +import OAI.Combinatorics.Progressions.FixedDensity.OrderedRegularizedCells +import OAI.Combinatorics.Progressions.FixedDensity.StructuredCleaning + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +def eraseOrderedFace + {k r : ℕ} (e : OrderedFace k r) (i : Fin r) : + OrderedFace k (r - 1) := by + cases r with + | zero => exact Fin.elim0 i + | succ n => + exact (Fin.succAboveOrderEmb i).trans e + +@[simp] +theorem orderedFaceTuple_eraseOrderedFace + {G : Type*} {k r : ℕ} + (e : OrderedFace k r) (i : Fin r) + (x : Fin k → G) : + orderedFaceTuple (eraseOrderedFace e i) x = + eraseCoordinate i (orderedFaceTuple e x) := by + cases r with + | zero => exact Fin.elim0 i + | succ n => + rfl + +theorem exists_orderedCoface + {k r : ℕ} (hr : 0 < r) (hrk : r ≤ k) + (g : OrderedFace k (r - 1)) : + ∃ e : OrderedFace k r, ∃ i : Fin r, + eraseOrderedFace e i = g := by + classical + cases r with + | zero => omega + | succ n => + let s : Finset (Fin k) := + Finset.univ.map g.toEmbedding + have hs : s.card = n := by + rw [show s.card = + (Finset.univ : + Finset (Fin (n + 1 - 1))).card by + exact Finset.card_map g.toEmbedding] + exact Fintype.card_fin n + have hnk : n < k := by + omega + have hs_ne_univ : s ≠ Finset.univ := by + intro h + have : n = k := by + calc + n = s.card := hs.symm + _ = Finset.univ.card := congrArg Finset.card h + _ = k := by simp + omega + obtain ⟨v, hv⟩ : + ∃ v : Fin k, v ∉ s := by + by_contra h + push Not at h + exact hs_ne_univ (Finset.eq_univ_of_forall h) + let t : Finset (Fin k) := insert v s + have ht : t.card = n + 1 := by + simp [t, hv, hs] + let e : OrderedFace k (n + 1) := + t.orderEmbOfFin ht + have hv_t : v ∈ t := by + simp [t] + let vInT : t := ⟨v, hv_t⟩ + let i : Fin (n + 1) := + (t.orderIsoOfFin ht).symm vInT + have hei : e i = v := by + change + t.orderEmbOfFin ht + ((t.orderIsoOfFin ht).symm vInT) = + v + rw [← Finset.coe_orderIsoOfFin_apply] + simp [vInT] + have herase_mem : + ∀ q, eraseOrderedFace e i q ∈ s := by + intro q + have htmem : + e (i.succAbove q) ∈ t := by + exact t.orderEmbOfFin_mem ht (i.succAbove q) + have hne : + e (i.succAbove q) ≠ v := by + intro h + have heq : + e (i.succAbove q) = e i := + h.trans hei.symm + exact + (i.succAbove_ne q) + (e.injective heq) + change e (i.succAbove q) ∈ s + have hor : e (i.succAbove q) = v ∨ + e (i.succAbove q) ∈ s := by + simpa [t] using htmem + exact hor.resolve_left hne + have herase : + eraseOrderedFace e i = + s.orderEmbOfFin hs := + Finset.orderEmbOfFin_unique' hs herase_mem + have hg : + g = s.orderEmbOfFin hs := by + apply Finset.orderEmbOfFin_unique' hs + intro q + exact Finset.mem_map.mpr + ⟨q, Finset.mem_univ _, rfl⟩ + exact ⟨e, i, herase.trans hg.symm⟩ + +namespace OrderedPattern + +noncomputable def deletionCylinder + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : DeletionFamily (G := G) k (r - 1)) + (e : OrderedFace k r) (i : Fin r) : + Finset (Fin r → G) := by + classical + exact Finset.univ.filter fun y => + eraseCoordinate i y ∈ D (eraseOrderedFace e i) + +@[simp] +theorem mem_deletionCylinder + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : DeletionFamily (G := G) k (r - 1)) + (e : OrderedFace k r) (i : Fin r) + (y : Fin r → G) : + y ∈ deletionCylinder D e i ↔ + eraseCoordinate i y ∈ + D (eraseOrderedFace e i) := by + simp [deletionCylinder] + +theorem card_deletionCylinder + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : DeletionFamily (G := G) k (r - 1)) + (e : OrderedFace k r) (i : Fin r) : + (deletionCylinder D e i).card = + Fintype.card G * + (D (eraseOrderedFace e i)).card := by + classical + cases r with + | zero => exact Fin.elim0 i + | succ n => + change DeletionFamily (G := G) k n at D + let S : (j : Fin (n + 1)) → Finset G := + fun _ => Finset.univ + have h := + Finset.card_insertNthEquiv_filter_piFinset + (S := S) (p := i) + (P := fun z => + z ∈ D (eraseOrderedFace e i)) + simp only [S, Fin.removeNth_fun_const, + Fintype.piFinset_univ] at h + simp only [Finset.filter_univ_mem] at h + have hcylinder : + deletionCylinder D e i = + Finset.univ.filter fun x : + Fin (n + 1) → G => + Fin.removeNth i x ∈ + D (eraseOrderedFace e i) := by + ext x + simp [eraseCoordinate_eq_removeNth] + rw [hcylinder] + exact h + +noncomputable def liftLowerDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : DeletionFamily (G := G) k (r - 1)) : + DeletionFamily (G := G) k r := by + classical + exact fun e => + Finset.univ.biUnion fun i => + deletionCylinder D e i + +@[simp] +theorem mem_liftLowerDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : DeletionFamily (G := G) k (r - 1)) + (e : OrderedFace k r) (y : Fin r → G) : + y ∈ liftLowerDeletion D e ↔ + ∃ i : Fin r, + eraseCoordinate i y ∈ + D (eraseOrderedFace e i) := by + classical + simp [liftLowerDeletion] + +theorem card_liftLowerDeletion_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : DeletionFamily (G := G) k (r - 1)) + (e : OrderedFace k r) : + (liftLowerDeletion D e).card ≤ + ∑ i : Fin r, + (deletionCylinder D e i).card := by + classical + exact Finset.card_biUnion_le + +theorem deletionCylinder_density_eq + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (D : DeletionFamily (G := G) k (r - 1)) + (e : OrderedFace k r) (i : Fin r) : + ((deletionCylinder D e i).card : ℝ) / + Fintype.card (Fin r → G) = + faceDeletionDensity D + (eraseOrderedFace e i) := by + cases r with + | zero => exact Fin.elim0 i + | succ n => + change DeletionFamily (G := G) k n at D + rw [card_deletionCylinder] + unfold faceDeletionDensity + simp only [Fintype.card_fun, Fintype.card_fin, + Nat.cast_mul, Nat.cast_pow] + have hG : (0 : ℝ) < + Fintype.card G := by + positivity + rw [pow_succ] + field_simp [ne_of_gt hG] + simp + +theorem faceDeletionDensity_liftLowerDeletion_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (D : DeletionFamily (G := G) k (r - 1)) + {δ : ℝ} + (hD : ∀ g, faceDeletionDensity D g ≤ δ) + (e : OrderedFace k r) : + faceDeletionDensity (liftLowerDeletion D) e ≤ + (r : ℝ) * δ := by + unfold faceDeletionDensity + have hdenom : + (0 : ℝ) < + Fintype.card (Fin r → G) := by + positivity + calc + ((liftLowerDeletion D e).card : ℝ) / + Fintype.card (Fin r → G) ≤ + (∑ i : Fin r, + (deletionCylinder D e i).card : ℕ) / + Fintype.card (Fin r → G) := by + apply div_le_div_of_nonneg_right + · exact_mod_cast card_liftLowerDeletion_le D e + · exact hdenom.le + _ = + ∑ i : Fin r, + ((deletionCylinder D e i).card : ℝ) / + Fintype.card (Fin r → G) := by + rw [Nat.cast_sum, Finset.sum_div] + _ = + ∑ i : Fin r, + faceDeletionDensity D + (eraseOrderedFace e i) := by + apply Finset.sum_congr rfl + intro i _hi + exact deletionCylinder_density_eq D e i + _ ≤ ∑ _i : Fin r, δ := by + apply Finset.sum_le_sum + intro i _hi + exact hD (eraseOrderedFace e i) + _ = (r : ℝ) * δ := by + simp + +noncomputable def unionDeletion + {ι G : Type*} [Fintype ι] + [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : ι → DeletionFamily (G := G) k r) : + DeletionFamily (G := G) k r := by + classical + exact fun e => + Finset.univ.biUnion fun t => D t e + +@[simp] +theorem mem_unionDeletion + {ι G : Type*} [Fintype ι] + [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : ι → DeletionFamily (G := G) k r) + (e : OrderedFace k r) (y : Fin r → G) : + y ∈ unionDeletion D e ↔ + ∃ t : ι, y ∈ D t e := by + classical + simp [unionDeletion] + +theorem faceDeletionDensity_unionDeletion_le + {ι G : Type*} [Fintype ι] + [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (D : ι → DeletionFamily (G := G) k r) + (e : OrderedFace k r) : + faceDeletionDensity (unionDeletion D) e ≤ + ∑ t : ι, faceDeletionDensity (D t) e := by + unfold faceDeletionDensity unionDeletion + have hdenom : + (0 : ℝ) < + Fintype.card (Fin r → G) := by + positivity + calc + (((Finset.univ.biUnion fun t => D t e).card : ℕ) : ℝ) / + Fintype.card (Fin r → G) ≤ + (∑ t : ι, (D t e).card : ℕ) / + Fintype.card (Fin r → G) := by + apply div_le_div_of_nonneg_right + · exact_mod_cast (Finset.card_biUnion_le : + (Finset.univ.biUnion fun t => D t e).card ≤ + ∑ t : ι, (D t e).card) + · exact hdenom.le + _ = + ∑ t : ι, + ((D t e).card : ℝ) / + Fintype.card (Fin r → G) := by + rw [Nat.cast_sum, Finset.sum_div] + +theorem toWeighted_edgeWeight_zeroOne + {G : Type*} {k r : ℕ} + (H : OrderedPattern G k r) + (e : OrderedFace k r) : + IsZeroOneValued (H.toWeighted.edgeWeight e) := by + intro y + classical + by_cases hy : H.edge e y + · right + simp [OrderedPattern.toWeighted, hy] + · left + simp [OrderedPattern.toWeighted, hy] + +noncomputable def lowStructuredDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : OrderedPattern G k r) + (S : OrderedRegularitySystem G k r) + (τ : ℝ) : + DeletionFamily (G := G) k r := + fun e => + (S e).lowStructuredOneFinset + (H.toWeighted.edgeWeight e) τ + +@[simp] +theorem mem_lowStructuredDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : OrderedPattern G k r) + (S : OrderedRegularitySystem G k r) + (τ : ℝ) (e : OrderedFace k r) + (y : Fin r → G) : + y ∈ lowStructuredDeletion H S τ e ↔ + H.toWeighted.edgeWeight e y = 1 ∧ + (S e).structured + (H.toWeighted.edgeWeight e) y < τ := by + exact + (S e).mem_lowStructuredOneFinset + (H.toWeighted.edgeWeight e) τ y + +theorem faceDeletionDensity_lowStructuredDeletion_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (H : OrderedPattern G k r) + (S : OrderedRegularitySystem G k r) + {τ : ℝ} (hτ : 0 ≤ τ) + (e : OrderedFace k r) : + faceDeletionDensity + (lowStructuredDeletion H S τ) e ≤ τ := by + have hmean := + (S e).mean_indicator_lowStructuredOneFinset_le + (H.toWeighted_edgeWeight_zeroOne e) hτ + rw [mean_finsetIndicator] at hmean + exact hmean + +theorem regularized_edgeWeight_ge_of_not_mem_lowDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : OrderedPattern G k r) + (S : OrderedRegularitySystem G k r) + (τ : ℝ) (e : OrderedFace k r) + (y : Fin r → G) + (hy : H.edge e y) + (hnot : y ∉ lowStructuredDeletion H S τ e) : + τ ≤ + (regularizedOrderedPattern H.toWeighted S).edgeWeight e y := by + have hone : + H.toWeighted.edgeWeight e y = 1 := by + classical + simp [OrderedPattern.toWeighted, hy] + have hnotlt : + ¬(S e).structured + (H.toWeighted.edgeWeight e) y < τ := by + intro hlt + exact hnot + ((mem_lowStructuredDeletion H S τ e y).2 + ⟨hone, hlt⟩) + exact not_lt.mp hnotlt + +theorem lowerCover_lifts + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (hr : 0 < r) (hrk : r ≤ k) + (L : OrderedPattern G k (r - 1)) + (D : DeletionFamily (G := G) k (r - 1)) + (hcover : L.IsCover D) + {x : Fin k → G} + (hx : L.IsOccurrence x) : + ∃ e : OrderedFace k r, + orderedFaceTuple e x ∈ + liftLowerDeletion D e := by + classical + have hxfinset : x ∈ L.occurrenceFinset := by + exact (L.mem_occurrenceFinset x).2 hx + obtain ⟨g, hg⟩ := hcover x hxfinset + obtain ⟨e, i, hei⟩ := + exists_orderedCoface hr hrk g + refine ⟨e, (mem_liftLowerDeletion D e _).2 + ⟨i, ?_⟩⟩ + rw [← hei] at hg + simpa using hg + +end OrderedPattern + +namespace GeneratedOrderedPatternRegularization + +def IsInAtomBranch + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (a : R.TopAtomChoice) + (w : R.BranchSystem) + (x : Fin k → G) : Prop := + ∀ e i, + eraseCoordinate i (orderedFaceTuple e x) ∈ + lowerGeneratorCell (R.generators e) + ((R.state e).partition.representative (a e)) + (w e) i + +noncomputable def lowerCellPattern + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (a : R.TopAtomChoice) + (w : R.BranchSystem) : + OrderedPattern G k (r - 1) where + edge g z := + ∀ (e : OrderedFace k r) (i : Fin r), + eraseOrderedFace e i = g → + z ∈ lowerGeneratorCell (R.generators e) + ((R.state e).partition.representative (a e)) + (w e) i + +theorem lowerCellPattern_isOccurrence_iff + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (a : R.TopAtomChoice) + (w : R.BranchSystem) + (x : Fin k → G) : + (R.lowerCellPattern a w).IsOccurrence x ↔ + R.IsInAtomBranch a w x := by + constructor + · intro hocc e i + have h := + hocc (eraseOrderedFace e i) e i rfl + simpa using h + · intro hcell g e i hsubface + rw [← hsubface] + simpa using hcell e i + +theorem mem_all_topAtoms_iff_exists_branchSystem + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hr : 0 < r) + (a : R.TopAtomChoice) + (x : Fin k → G) : + (∀ e, orderedFaceTuple e x ∈ (a e).1) ↔ + ∃ w : R.BranchSystem, + R.IsInAtomBranch a w x := by + classical + constructor + · intro hmem + have he (e : OrderedFace k r) : + ∃ w : GeneratorBranch (R.generators e), + ∀ i, + eraseCoordinate i + (orderedFaceTuple e x) ∈ + lowerGeneratorCell (R.generators e) + ((R.state e).partition.representative + (a e)) w i := by + apply + (R.mem_state_part_iff_exists_lowerGeneratorCells + hr e _ _).1 + rw [(R.state e).partition.part_representative] + exact hmem e + choose w hw using he + exact ⟨w, fun e i => hw e i⟩ + · rintro ⟨w, hcell⟩ + intro e + have h := + (R.mem_state_part_iff_exists_lowerGeneratorCells + hr e _ _).2 ⟨w e, hcell e⟩ + rw [(R.state e).partition.part_representative] at h + exact h + +noncomputable def atomEdgeWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (a : R.TopAtomChoice) + (e : OrderedFace k r) : ℝ := + (regularizedOrderedPattern H R.state).edgeWeight e + ((R.state e).partition.representative (a e)) + +theorem regularized_edgeWeight_eq_atomEdgeWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (a : R.TopAtomChoice) + (e : OrderedFace k r) + (x : Fin k → G) + (hmem : orderedFaceTuple e x ∈ (a e).1) : + (regularizedOrderedPattern H R.state).edgeWeight e + (orderedFaceTuple e x) = + R.atomEdgeWeight a e := by + unfold atomEdgeWeight + apply conditionalMean_eq_of_mem_part + rw [(R.state e).partition.part_representative] + exact hmem + +theorem regularized_patternWeight_eq_prod_atomEdgeWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (a : R.TopAtomChoice) + (x : Fin k → G) + (hmem : ∀ e, orderedFaceTuple e x ∈ (a e).1) : + (regularizedOrderedPattern H R.state).patternWeight x = + ∏ e : OrderedFace k r, + R.atomEdgeWeight a e := by + apply Finset.prod_congr rfl + intro e _he + exact R.regularized_edgeWeight_eq_atomEdgeWeight + a e x (hmem e) + +def IsHeavy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (τ : ℝ) (a : R.TopAtomChoice) : Prop := + ∀ e, τ ≤ R.atomEdgeWeight a e + +abbrev CellIndex + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) := + R.TopAtomChoice × R.BranchSystem + +@[simp] +theorem card_cellIndex + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) : + Fintype.card R.CellIndex = + Fintype.card R.TopAtomChoice * + Fintype.card R.BranchSystem := by + simp [CellIndex] + +theorem card_cellIndex_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hr : 0 < r) : + Fintype.card R.CellIndex ≤ + (∏ e : OrderedFace k r, + 2 ^ R.stepIndex e) * + ∏ e : OrderedFace k r, + r ^ R.stepIndex e := by + rw [R.card_cellIndex] + exact Nat.mul_le_mul + R.card_topAtomChoice_le + (R.card_branchSystem_le hr) + +theorem pow_le_regularized_patternWeight_of_lowerCellOccurrence + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε τ : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hr : 0 < r) (hτ : 0 ≤ τ) + (a : R.TopAtomChoice) (ha : R.IsHeavy τ a) + (w : R.BranchSystem) + {x : Fin k → G} + (hx : (R.lowerCellPattern a w).IsOccurrence x) : + τ ^ Fintype.card (OrderedFace k r) ≤ + (regularizedOrderedPattern H R.state).patternWeight x := by + have hcell : + R.IsInAtomBranch a w x := + (R.lowerCellPattern_isOccurrence_iff a w x).1 hx + have hmem : + ∀ e, orderedFaceTuple e x ∈ (a e).1 := + (R.mem_all_topAtoms_iff_exists_branchSystem + hr a x).2 ⟨w, hcell⟩ + rw [R.regularized_patternWeight_eq_prod_atomEdgeWeight + a x hmem] + have hprod : + (∏ _e : OrderedFace k r, τ) ≤ + ∏ e : OrderedFace k r, + R.atomEdgeWeight a e := by + apply Finset.prod_le_prod₀ + · intro e _he + exact hτ + · intro e _he + exact ha e + simpa using hprod + +theorem pow_mul_lowerCellPattern_weight_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε τ : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hH : H.EdgeWeightsInUnitInterval) + (hr : 0 < r) (hτ : 0 ≤ τ) + (a : R.TopAtomChoice) (ha : R.IsHeavy τ a) + (w : R.BranchSystem) + (x : Fin k → G) : + τ ^ Fintype.card (OrderedFace k r) * + (R.lowerCellPattern a w).toWeighted.patternWeight x ≤ + (regularizedOrderedPattern H R.state).patternWeight x := by + classical + by_cases hx : (R.lowerCellPattern a w).IsOccurrence x + · rw [(R.lowerCellPattern a w).toWeighted_patternWeight_of_occurrence + hx, mul_one] + exact + R.pow_le_regularized_patternWeight_of_lowerCellOccurrence + hr hτ a ha w hx + · rw [(R.lowerCellPattern a w).toWeighted_patternWeight_of_not_occurrence + hx, mul_zero] + exact + (regularizedOrderedPattern H R.state).patternWeight_nonneg + (fun e y => + ((regularizedOrderedPattern_unitInterval hH R.state) + e y).1) x + +theorem pow_mul_lowerCellPattern_count_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε τ : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hH : H.EdgeWeightsInUnitInterval) + (hr : 0 < r) (hτ : 0 ≤ τ) + (a : R.TopAtomChoice) (ha : R.IsHeavy τ a) + (w : R.BranchSystem) : + τ ^ Fintype.card (OrderedFace k r) * + (R.lowerCellPattern a w).toWeighted.patternCount ≤ + (regularizedOrderedPattern H R.state).patternCount := by + rw [WeightedOrderedPattern.patternCount, + WeightedOrderedPattern.patternCount, + ← mean_smul] + exact mean_mono fun x => + R.pow_mul_lowerCellPattern_weight_le + hH hr hτ a ha w x + +theorem lowerCellPattern_count_lt_of_regularized_count_lt + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε τ c : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hH : H.EdgeWeightsInUnitInterval) + (hr : 0 < r) (hτ : 0 < τ) + (a : R.TopAtomChoice) (ha : R.IsHeavy τ a) + (w : R.BranchSystem) + (hsmall : + (regularizedOrderedPattern H R.state).patternCount < + τ ^ Fintype.card (OrderedFace k r) * c) : + (R.lowerCellPattern a w).toWeighted.patternCount < c := by + have hscaled : + τ ^ Fintype.card (OrderedFace k r) * + (R.lowerCellPattern a w).toWeighted.patternCount < + τ ^ Fintype.card (OrderedFace k r) * c := + lt_of_le_of_lt + (R.pow_mul_lowerCellPattern_count_le + hH hr hτ.le a ha w) + hsmall + exact + lt_of_mul_lt_mul_left hscaled + (pow_pos hτ + (Fintype.card (OrderedFace k r))).le + +theorem exists_generatedCellCover_of_activeLowerCellCounts + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (H : OrderedPattern G k r) + {η τ δ ξ cLower : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H.toWeighted η) + (hr : 0 < r) (hrk : r ≤ k) + (hτ : 0 < τ) (hδ : 0 ≤ δ) + (active : R.CellIndex → Prop) + (exceptionalDeletion : + OrderedPattern.DeletionFamily (G := G) k r) + (hexceptionalDensity : + ∀ e, + OrderedPattern.faceDeletionDensity + exceptionalDeletion e ≤ ξ) + (hexceptionalCover : + ∀ (a : R.TopAtomChoice) (w : R.BranchSystem) + (x : Fin k → G), + R.IsHeavy τ a → + (R.lowerCellPattern a w).IsOccurrence x → + ¬ active (a, w) → + ∃ e, + orderedFaceTuple e x ∈ + exceptionalDeletion e) + (hcellSmall : + ∀ a : R.TopAtomChoice, + R.IsHeavy τ a → + ∀ w : R.BranchSystem, + active (a, w) → + (R.lowerCellPattern a w).toWeighted.patternCount < + cLower) + (hremove : + ∀ L : OrderedPattern G k (r - 1), + L.toWeighted.patternCount < cLower → + ∃ D : OrderedPattern.DeletionFamily + (G := G) k (r - 1), + L.IsCover D ∧ + ∀ g, + OrderedPattern.faceDeletionDensity D g ≤ δ) : + ∃ D : OrderedPattern.DeletionFamily + (G := G) k r, + H.IsCover D ∧ + ∀ e, + OrderedPattern.faceDeletionDensity D e ≤ + τ + + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ + + ξ := by + classical + have hchoice (p : R.CellIndex) : + ∃ D : OrderedPattern.DeletionFamily + (G := G) k (r - 1), + (R.IsHeavy τ p.1 → + active p → + (R.lowerCellPattern p.1 p.2).IsCover D) ∧ + ∀ g, + OrderedPattern.faceDeletionDensity D g ≤ δ := by + by_cases hp : R.IsHeavy τ p.1 + · by_cases hactive : active p + · have hcount : + (R.lowerCellPattern p.1 p.2).toWeighted.patternCount < + cLower := + hcellSmall p.1 hp p.2 hactive + obtain ⟨D, hcover, hdensity⟩ := + hremove (R.lowerCellPattern p.1 p.2) hcount + exact ⟨D, fun _ _ => hcover, hdensity⟩ + · refine + ⟨OrderedPattern.emptyDeletion k (r - 1), + fun _ h => (hactive h).elim, fun g => ?_⟩ + rw [OrderedPattern.faceDeletionDensity_empty] + exact hδ + · refine + ⟨OrderedPattern.emptyDeletion k (r - 1), + fun hheavy _ => (hp hheavy).elim, fun g => ?_⟩ + rw [OrderedPattern.faceDeletionDensity_empty] + exact hδ + choose lowerDeletion hlower using hchoice + let liftedCellDeletion : + R.CellIndex → + OrderedPattern.DeletionFamily (G := G) k r := + fun p => + OrderedPattern.liftLowerDeletion + (lowerDeletion p) + let cellDeletion : + OrderedPattern.DeletionFamily (G := G) k r := + OrderedPattern.unionDeletion liftedCellDeletion + let lowDeletion : + OrderedPattern.DeletionFamily (G := G) k r := + OrderedPattern.lowStructuredDeletion + H R.state τ + let baseComponents : + Bool → + OrderedPattern.DeletionFamily (G := G) k r := + fun b => if b then cellDeletion else lowDeletion + let baseDeletion : + OrderedPattern.DeletionFamily (G := G) k r := + OrderedPattern.unionDeletion baseComponents + let components : + Bool → + OrderedPattern.DeletionFamily (G := G) k r := + fun b => + if b then exceptionalDeletion else baseDeletion + let totalDeletion : + OrderedPattern.DeletionFamily (G := G) k r := + OrderedPattern.unionDeletion components + have hcellDensity (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + cellDeletion e ≤ + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ := by + calc + OrderedPattern.faceDeletionDensity + cellDeletion e ≤ + ∑ p : R.CellIndex, + OrderedPattern.faceDeletionDensity + (liftedCellDeletion p) e := by + exact + OrderedPattern.faceDeletionDensity_unionDeletion_le + liftedCellDeletion e + _ ≤ ∑ _p : R.CellIndex, (r : ℝ) * δ := by + apply Finset.sum_le_sum + intro p _hp + exact + OrderedPattern.faceDeletionDensity_liftLowerDeletion_le + (lowerDeletion p) (hlower p).2 e + _ = + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ := by + simp + ring + have hbaseDensity (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + baseDeletion e ≤ + τ + + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ := by + calc + OrderedPattern.faceDeletionDensity + baseDeletion e ≤ + ∑ b : Bool, + OrderedPattern.faceDeletionDensity + (baseComponents b) e := by + exact + OrderedPattern.faceDeletionDensity_unionDeletion_le + baseComponents e + _ = + OrderedPattern.faceDeletionDensity lowDeletion e + + OrderedPattern.faceDeletionDensity cellDeletion e := by + simp [baseComponents] + ring + _ ≤ + τ + + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ := + add_le_add + (OrderedPattern.faceDeletionDensity_lowStructuredDeletion_le + H R.state hτ.le e) + (hcellDensity e) + have htotalDensity (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + totalDeletion e ≤ + τ + + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ + + ξ := by + calc + OrderedPattern.faceDeletionDensity + totalDeletion e ≤ + ∑ b : Bool, + OrderedPattern.faceDeletionDensity + (components b) e := by + exact + OrderedPattern.faceDeletionDensity_unionDeletion_le + components e + _ = + OrderedPattern.faceDeletionDensity baseDeletion e + + OrderedPattern.faceDeletionDensity + exceptionalDeletion e := by + simp [components] + ring + _ ≤ + (τ + + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ) + + ξ := + add_le_add (hbaseDensity e) + (hexceptionalDensity e) + refine ⟨totalDeletion, ?_, htotalDensity⟩ + intro x hx + have hxocc : H.IsOccurrence x := + (H.mem_occurrenceFinset x).1 hx + by_cases hlow : + ∃ e : OrderedFace k r, + orderedFaceTuple e x ∈ lowDeletion e + · obtain ⟨e, he⟩ := hlow + have hbase : + orderedFaceTuple e x ∈ baseDeletion e := by + apply + (OrderedPattern.mem_unionDeletion + baseComponents e _).2 + refine ⟨false, ?_⟩ + simpa [baseComponents] using he + refine ⟨e, + (OrderedPattern.mem_unionDeletion + components e _).2 ⟨false, ?_⟩⟩ + simpa [components] using hbase + · push Not at hlow + let a : R.TopAtomChoice := + R.topAtomChoiceOf x + have ha : R.IsHeavy τ a := by + intro e + have hmem : + orderedFaceTuple e x ∈ (a e).1 := + R.mem_topAtomChoiceOf x e + rw [← R.regularized_edgeWeight_eq_atomEdgeWeight + a e x hmem] + exact + OrderedPattern.regularized_edgeWeight_ge_of_not_mem_lowDeletion + H R.state τ e (orderedFaceTuple e x) + (hxocc e) (hlow e) + have hbranch : + ∃ w : R.BranchSystem, + R.IsInAtomBranch a w x := + (R.mem_all_topAtoms_iff_exists_branchSystem + hr a x).1 + (fun e => R.mem_topAtomChoiceOf x e) + obtain ⟨w, hw⟩ := hbranch + have hlowerOccurrence : + (R.lowerCellPattern a w).IsOccurrence x := + (R.lowerCellPattern_isOccurrence_iff + a w x).2 hw + by_cases hactive : active (a, w) + · have hlowerCover : + (R.lowerCellPattern a w).IsCover + (lowerDeletion (a, w)) := + (hlower (a, w)).1 ha hactive + obtain ⟨e, he⟩ := + OrderedPattern.lowerCover_lifts + hr hrk (R.lowerCellPattern a w) + (lowerDeletion (a, w)) + hlowerCover hlowerOccurrence + have hcell : + orderedFaceTuple e x ∈ cellDeletion e := by + apply + (OrderedPattern.mem_unionDeletion + liftedCellDeletion e _).2 + exact ⟨(a, w), he⟩ + have hbase : + orderedFaceTuple e x ∈ baseDeletion e := by + apply + (OrderedPattern.mem_unionDeletion + baseComponents e _).2 + refine ⟨true, ?_⟩ + simpa [baseComponents] using hcell + refine ⟨e, + (OrderedPattern.mem_unionDeletion + components e _).2 ⟨false, ?_⟩⟩ + simpa [components] using hbase + · obtain ⟨e, he⟩ := + hexceptionalCover a w x ha + hlowerOccurrence hactive + refine ⟨e, + (OrderedPattern.mem_unionDeletion + components e _).2 ⟨true, ?_⟩⟩ + simpa [components] using he + +theorem exists_generatedCellCover_of_lowerCellCounts + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (H : OrderedPattern G k r) + {η τ δ cLower : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H.toWeighted η) + (hr : 0 < r) (hrk : r ≤ k) + (hτ : 0 < τ) (hδ : 0 ≤ δ) + (hcellSmall : + ∀ a : R.TopAtomChoice, + R.IsHeavy τ a → + ∀ w : R.BranchSystem, + (R.lowerCellPattern a w).toWeighted.patternCount < + cLower) + (hremove : + ∀ L : OrderedPattern G k (r - 1), + L.toWeighted.patternCount < cLower → + ∃ D : OrderedPattern.DeletionFamily + (G := G) k (r - 1), + L.IsCover D ∧ + ∀ g, + OrderedPattern.faceDeletionDensity D g ≤ δ) : + ∃ D : OrderedPattern.DeletionFamily + (G := G) k r, + H.IsCover D ∧ + ∀ e, + OrderedPattern.faceDeletionDensity D e ≤ + τ + + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ := by + simpa using + R.exists_generatedCellCover_of_activeLowerCellCounts + (ξ := 0) H hr hrk hτ hδ + (fun _ => True) + (OrderedPattern.emptyDeletion k r) + (fun e => by + rw [OrderedPattern.faceDeletionDensity_empty]) + (by + intro a w x ha hx hnot + exact (hnot trivial).elim) + (by + intro a ha w _hactive + exact hcellSmall a ha w) + hremove + +theorem exists_generatedCellCover + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (H : OrderedPattern G k r) + {η τ δ cLower : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H.toWeighted η) + (hr : 0 < r) (hrk : r ≤ k) + (hτ : 0 < τ) (hδ : 0 ≤ δ) + (hsmall : + (regularizedOrderedPattern + H.toWeighted R.state).patternCount < + τ ^ Fintype.card (OrderedFace k r) * + cLower) + (hremove : + ∀ L : OrderedPattern G k (r - 1), + L.toWeighted.patternCount < cLower → + ∃ D : OrderedPattern.DeletionFamily + (G := G) k (r - 1), + L.IsCover D ∧ + ∀ g, + OrderedPattern.faceDeletionDensity D g ≤ δ) : + ∃ D : OrderedPattern.DeletionFamily + (G := G) k r, + H.IsCover D ∧ + ∀ e, + OrderedPattern.faceDeletionDensity D e ≤ + τ + + (Fintype.card R.CellIndex : ℝ) * + (r : ℝ) * δ := by + apply R.exists_generatedCellCover_of_lowerCellCounts + H hr hrk hτ hδ + · intro a ha w + exact + R.lowerCellPattern_count_lt_of_regularized_count_lt + H.toWeighted_unitInterval hr hτ + a ha w hsmall + · exact hremove + +end GeneratedOrderedPatternRegularization + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def eraseBoundaryCoordinate + {G : Type*} {j : ℕ} + (i : Fin (j + 1)) (x : Fin (j + 1) → G) : + Fin j → G := + fun q => x (i.succAbove q) + +def eraseBoundaryFace + {k j : ℕ} + (e : OrderedFace k (j + 1)) (i : Fin (j + 1)) : + OrderedFace k j := + (Fin.succAboveOrderEmb i).trans e + +@[simp] +theorem orderedFaceTuple_eraseBoundaryFace + {G : Type*} {k j : ℕ} + (e : OrderedFace k (j + 1)) (i : Fin (j + 1)) + (x : Fin k → G) : + orderedFaceTuple (eraseBoundaryFace e i) x = + eraseBoundaryCoordinate i (orderedFaceTuple e x) := + rfl + +abbrev OrderedFacePartitionSystem + (G : Type*) [Fintype G] [DecidableEq G] + (k j : ℕ) := + (e : OrderedFace k j) → FacePartition (Fin j → G) + +def OrderedFacePartitionRefines + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) : Prop := + ∀ e, fine e ≤ coarse e + +namespace OrderedFacePartitionRefines + +theorem refl + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) : + OrderedFacePartitionRefines P P := + fun _ => le_rfl + +theorem trans + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {P Q R : OrderedFacePartitionSystem G k j} + (hPQ : OrderedFacePartitionRefines P Q) + (hQR : OrderedFacePartitionRefines Q R) : + OrderedFacePartitionRefines P R := + fun e => le_trans (hPQ e) (hQR e) + +end OrderedFacePartitionRefines + +def indiscreteOrderedFacePartitionSystem + (G : Type*) [Fintype G] [DecidableEq G] + (k j : ℕ) : + OrderedFacePartitionSystem G k j := + fun _ => FacePartition.indiscrete + +def orderedImmediateBoundaryPartition + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) (i : Fin (j + 1)) : + FacePartition (Fin (j + 1) → G) := + FacePartition.pullback (eraseBoundaryCoordinate i) + (P (eraseBoundaryFace e i)) + +def orderedBoundaryPartition + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) : + FacePartition (Fin (j + 1) → G) := + FacePartition.joinFinset + (Finset.univ : Finset (Fin (j + 1))) + (orderedImmediateBoundaryPartition P e) + +theorem orderedBoundaryPartition_le_immediate + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) (i : Fin (j + 1)) : + orderedBoundaryPartition P e ≤ + orderedImmediateBoundaryPartition P e i := by + exact FacePartition.joinFinset_le_of_mem + (orderedImmediateBoundaryPartition P e) + (Finset.mem_univ i) + +theorem orderedBoundaryPartition_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (e : OrderedFace k (j + 1)) : + orderedBoundaryPartition fine e ≤ + orderedBoundaryPartition coarse e := by + unfold orderedBoundaryPartition + apply FacePartition.le_joinFinset_iff.mpr + intro i _ + exact le_trans + (orderedBoundaryPartition_le_immediate fine e i) + (FacePartition.pullback_mono (eraseBoundaryCoordinate i) + (hfc (eraseBoundaryFace e i))) + +theorem mem_orderedBoundaryPartition_part_iff + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (x y : Fin (j + 1) → G) : + y ∈ (orderedBoundaryPartition P e).part x ↔ + ∀ i : Fin (j + 1), + eraseBoundaryCoordinate i y ∈ + (P (eraseBoundaryFace e i)).part + (eraseBoundaryCoordinate i x) := by + rw [orderedBoundaryPartition, + FacePartition.mem_part_joinFinset_iff] + simp only [Finset.mem_univ, forall_const, + orderedImmediateBoundaryPartition, + FacePartition.mem_part_pullback_iff_image_mem] + +theorem mem_orderedBoundaryPartition_part_iff_part_eq + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (x y : Fin (j + 1) → G) : + y ∈ (orderedBoundaryPartition P e).part x ↔ + ∀ i : Fin (j + 1), + (P (eraseBoundaryFace e i)).part + (eraseBoundaryCoordinate i y) = + (P (eraseBoundaryFace e i)).part + (eraseBoundaryCoordinate i x) := by + rw [mem_orderedBoundaryPartition_part_iff] + constructor + · intro h i + exact + ((P (eraseBoundaryFace e i)).mem_part_iff_part_eq_part + (Finset.mem_univ (eraseBoundaryCoordinate i y)) + (Finset.mem_univ (eraseBoundaryCoordinate i x))).1 + (h i) + · intro h i + exact + ((P (eraseBoundaryFace e i)).mem_part_iff_part_eq_part + (Finset.mem_univ (eraseBoundaryCoordinate i y)) + (Finset.mem_univ (eraseBoundaryCoordinate i x))).2 + (h i) + +theorem orderedFaceTuple_mem_boundary_part_iff + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (x y : Fin k → G) : + orderedFaceTuple e y ∈ + (orderedBoundaryPartition P e).part + (orderedFaceTuple e x) ↔ + ∀ i : Fin (j + 1), + orderedFaceTuple (eraseBoundaryFace e i) y ∈ + (P (eraseBoundaryFace e i)).part + (orderedFaceTuple (eraseBoundaryFace e i) x) := by + rw [mem_orderedBoundaryPartition_part_iff] + constructor + · intro h i + rw [orderedFaceTuple_eraseBoundaryFace e i y, + orderedFaceTuple_eraseBoundaryFace e i x] + exact h i + · intro h i + rw [← orderedFaceTuple_eraseBoundaryFace e i y, + ← orderedFaceTuple_eraseBoundaryFace e i x] + exact h i + +theorem complexity_orderedBoundaryPartition_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) : + FacePartition.complexity + (orderedBoundaryPartition P e) ≤ + ∏ i : Fin (j + 1), + FacePartition.complexity + (P (eraseBoundaryFace e i)) := by + calc + FacePartition.complexity + (orderedBoundaryPartition P e) ≤ + ∏ i : Fin (j + 1), + FacePartition.complexity + (orderedImmediateBoundaryPartition P e i) := by + exact FacePartition.complexity_joinFinset_le + (Finset.univ : Finset (Fin (j + 1))) + (orderedImmediateBoundaryPartition P e) + _ ≤ + ∏ i : Fin (j + 1), + FacePartition.complexity + (P (eraseBoundaryFace e i)) := by + apply Finset.prod_le_prod₀ + · intro i _ + exact Nat.zero_le _ + intro i _ + exact FacePartition.complexity_pullback_le + (eraseBoundaryCoordinate i) (P (eraseBoundaryFace e i)) + +theorem complexity_orderedBoundaryPartition_le_pow + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j M : ℕ} + (P : OrderedFacePartitionSystem G k j) + (hP : ∀ g, FacePartition.complexity (P g) ≤ M) + (e : OrderedFace k (j + 1)) : + FacePartition.complexity + (orderedBoundaryPartition P e) ≤ + M ^ (j + 1) := by + calc + FacePartition.complexity + (orderedBoundaryPartition P e) ≤ + ∏ i : Fin (j + 1), + FacePartition.complexity + (P (eraseBoundaryFace e i)) := + complexity_orderedBoundaryPartition_le P e + _ ≤ ∏ _i : Fin (j + 1), M := by + apply Finset.prod_le_prod₀ + · intro i _ + exact Nat.zero_le _ + intro i _ + exact hP (eraseBoundaryFace e i) + _ = M ^ (j + 1) := by simp + +noncomputable def orderedBoundaryAtomAt + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (x : Fin (j + 1) → G) : + (orderedBoundaryPartition P e).parts := + ⟨(orderedBoundaryPartition P e).part x, + (orderedBoundaryPartition P e).part_mem.2 + (Finset.mem_univ x)⟩ + +@[simp] +theorem orderedBoundaryAtomAt_val + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (x : Fin (j + 1) → G) : + (orderedBoundaryAtomAt P e x).1 = + (orderedBoundaryPartition P e).part x := + rfl + +theorem mem_orderedBoundaryAtomAt_iff + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (x y : Fin (j + 1) → G) : + y ∈ (orderedBoundaryAtomAt P e x).1 ↔ + ∀ i : Fin (j + 1), + eraseBoundaryCoordinate i y ∈ + (P (eraseBoundaryFace e i)).part + (eraseBoundaryCoordinate i x) := + mem_orderedBoundaryPartition_part_iff P e x y + +noncomputable def orderedBoundaryStructured + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (f : (Fin (j + 1) → G) → ℝ) : + (Fin (j + 1) → G) → ℝ := + conditionalMean (orderedBoundaryPartition P e) f + +noncomputable def orderedBoundaryEnergy + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (f : (Fin (j + 1) → G) → ℝ) : ℝ := + partitionEnergy (orderedBoundaryPartition P e) f + +theorem orderedBoundaryEnergy_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (e : OrderedFace k (j + 1)) + (f : (Fin (j + 1) → G) → ℝ) : + orderedBoundaryEnergy coarse e f ≤ + orderedBoundaryEnergy fine e f := + partitionEnergy_mono + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + (orderedBoundaryPartition_mono hfc e) f + +theorem orderedBoundaryEnergy_sub_eq_mean_sq + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (e : OrderedFace k (j + 1)) + (f : (Fin (j + 1) → G) → ℝ) : + orderedBoundaryEnergy fine e f - + orderedBoundaryEnergy coarse e f = + mean (fun x => + (orderedBoundaryStructured fine e f x - + orderedBoundaryStructured coarse e f x) ^ 2) := by + exact partitionEnergy_sub_eq_mean_sq + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + (orderedBoundaryPartition_mono hfc e) f + +structure OrderedPartitionComplex + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) where + partition : + (j : Fin (r + 1)) → + (e : OrderedFace k j.1) → + FacePartition (Fin j.1 → G) + +namespace OrderedPartitionComplex + +def layer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (j : ℕ) (hj : j ≤ r) : + OrderedFacePartitionSystem G k j := + C.partition ⟨j, Nat.lt_succ_iff.mpr hj⟩ + +def boundary + {G : Type*} [Fintype G] [DecidableEq G] + {k r j : ℕ} + (C : OrderedPartitionComplex G k r) + (hj : j < r) + (e : OrderedFace k (j + 1)) : + FacePartition (Fin (j + 1) → G) := + orderedBoundaryPartition (C.layer j (Nat.le_of_lt hj)) e + +def Refines + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) : Prop := + ∀ j e, fine.partition j e ≤ coarse.partition j e + +theorem Refines.refl + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) : + C.Refines C := + fun _ _ => le_rfl + +theorem Refines.trans + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C D E : OrderedPartitionComplex G k r} + (hCD : C.Refines D) (hDE : D.Refines E) : + C.Refines E := + fun j e => le_trans (hCD j e) (hDE j e) + +theorem boundary_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k r j : ℕ} + {fine coarse : OrderedPartitionComplex G k r} + (hfc : fine.Refines coarse) + (hj : j < r) + (e : OrderedFace k (j + 1)) : + fine.boundary hj e ≤ coarse.boundary hj e := by + apply orderedBoundaryPartition_mono + intro g + exact hfc + ⟨j, Nat.lt_succ_iff.mpr (Nat.le_of_lt hj)⟩ g + +end OrderedPartitionComplex + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedConfigurationCounting.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedConfigurationCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..eacf5ae33897a9b62514467142d673fac5ca03f6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedConfigurationCounting.lean @@ -0,0 +1,1624 @@ +import OAI.Combinatorics.Progressions.FixedDensity.CoarseOrderedRemoval + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +structure PositiveOrderedFace (k r : ℕ) where + lowerRank : Fin r + face : OrderedFace k (lowerRank.1 + 1) +deriving DecidableEq + +namespace PositiveOrderedFace + +def equivSigma (k r : ℕ) : + PositiveOrderedFace k r ≃ + Σ j : Fin r, OrderedFace k (j.1 + 1) where + toFun e := ⟨e.lowerRank, e.face⟩ + invFun e := ⟨e.1, e.2⟩ + left_inv e := by cases e; rfl + right_inv e := by cases e; rfl + +noncomputable instance instFintype (k r : ℕ) : + Fintype (PositiveOrderedFace k r) := + Fintype.ofEquiv + (Σ j : Fin r, OrderedFace k (j.1 + 1)) + (equivSigma k r).symm + +def rank {k r : ℕ} (e : PositiveOrderedFace k r) : ℕ := + e.lowerRank.1 + 1 + +@[simp] +theorem rank_pos {k r : ℕ} (e : PositiveOrderedFace k r) : + 0 < e.rank := by + simp [rank] + +noncomputable def boundary + {k r : ℕ} + (e : PositiveOrderedFace k r) + (hpos : 0 < e.lowerRank.1) + (i : Fin (e.lowerRank.1 + 1)) : + PositiveOrderedFace k r := by + let j : Fin r := + ⟨e.lowerRank.1 - 1, + lt_of_le_of_lt (Nat.sub_le _ _) e.lowerRank.2⟩ + refine ⟨j, ?_⟩ + have hj : j.1 + 1 = e.lowerRank.1 := by + simp only [j] + omega + exact hj ▸ eraseBoundaryFace e.face i + +@[simp] +theorem boundary_lowerRank + {k r : ℕ} + (e : PositiveOrderedFace k r) + (hpos : 0 < e.lowerRank.1) + (i : Fin (e.lowerRank.1 + 1)) : + (e.boundary hpos i).lowerRank.1 = + e.lowerRank.1 - 1 := by + rfl + +theorem boundary_rank_lt + {k r : ℕ} + (e : PositiveOrderedFace k r) + (hpos : 0 < e.lowerRank.1) + (i : Fin (e.lowerRank.1 + 1)) : + (e.boundary hpos i).rank < e.rank := by + simp only [rank, boundary_lowerRank] + omega + +theorem orderedFaceTuple_boundary + {G : Type*} {k r : ℕ} + (e : PositiveOrderedFace k r) + (hpos : 0 < e.lowerRank.1) + (i : Fin (e.lowerRank.1 + 1)) + (x : Fin k → G) : + orderedFaceTuple (e.boundary hpos i).face x = + (by + have hj : + (e.boundary hpos i).lowerRank.1 + 1 = + e.lowerRank.1 := by + simp only [boundary_lowerRank] + omega + exact hj ▸ + eraseBoundaryCoordinate i + (orderedFaceTuple e.face x)) := by + rcases e with ⟨⟨n, hn⟩, face⟩ + cases n with + | zero => simp at hpos + | succ n => + rfl + +end PositiveOrderedFace + +def IsDownwardClosedPositiveFaces + {k r : ℕ} + (s : Finset (PositiveOrderedFace k r)) : Prop := + ∀ (e : PositiveOrderedFace k r), e ∈ s → + ∀ (hpos : 0 < e.lowerRank.1) + (i : Fin (e.lowerRank.1 + 1)), + e.boundary hpos i ∈ s + +theorem downwardClosed_empty + {k r : ℕ} : + IsDownwardClosedPositiveFaces + (∅ : Finset (PositiveOrderedFace k r)) := by + intro e he + simp at he + +theorem downwardClosed_univ + {k r : ℕ} : + IsDownwardClosedPositiveFaces + (Finset.univ : Finset (PositiveOrderedFace k r)) := by + intro e _ hpos i + exact Finset.mem_univ _ + +theorem exists_maxRank_mem + {k r : ℕ} + (s : Finset (PositiveOrderedFace k r)) + (hs : s.Nonempty) : + ∃ e ∈ s, ∀ f ∈ s, f.rank ≤ e.rank := by + classical + induction s using Finset.induction with + | empty => + exact (Finset.not_nonempty_empty hs).elim + | @insert a s ha ih => + by_cases hs0 : s.Nonempty + · obtain ⟨e, he, hmax⟩ := ih hs0 + by_cases hae : a.rank ≤ e.rank + · refine ⟨e, Finset.mem_insert_of_mem he, ?_⟩ + intro f hf + rw [Finset.mem_insert] at hf + rcases hf with rfl | hf + · exact hae + · exact hmax f hf + · refine ⟨a, by simp, ?_⟩ + intro f hf + rw [Finset.mem_insert] at hf + rcases hf with rfl | hf + · exact le_rfl + · exact le_trans (hmax f hf) (Nat.le_of_not_ge hae) + · have hsEmpty : s = ∅ := + Finset.not_nonempty_iff_eq_empty.mp hs0 + subst s + refine ⟨a, by simp, ?_⟩ + intro f hf + have hfa : f = a := by simpa using hf + subst f + exact le_rfl + +theorem IsDownwardClosedPositiveFaces.erase_maxRank + {k r : ℕ} + {s : Finset (PositiveOrderedFace k r)} + (hclosed : IsDownwardClosedPositiveFaces s) + {e : PositiveOrderedFace k r} (he : e ∈ s) + (hmax : ∀ f ∈ s, f.rank ≤ e.rank) : + IsDownwardClosedPositiveFaces (s.erase e) := by + intro f hf hpos i + have hfS : f ∈ s := Finset.mem_of_mem_erase hf + have hbS := hclosed f hfS hpos i + apply Finset.mem_erase.mpr + refine ⟨?_, hbS⟩ + intro hbe + have hranklt := f.boundary_rank_lt hpos i + have hfle := hmax f hfS + subst e + omega + +theorem exists_positiveFace_coordinate_not_mem_range + {k r : ℕ} + (e f : PositiveOrderedFace k r) + (hle : f.rank ≤ e.rank) (hne : f ≠ e) : + ∃ i : Fin (e.lowerRank.1 + 1), + e.face i ∉ Set.range f.face := by + classical + rcases e with ⟨ej, ef⟩ + rcases f with ⟨fj, ff⟩ + by_contra hnone + push Not at hnone + have hsubset : + Finset.univ.map ef.toEmbedding ⊆ + Finset.univ.map ff.toEmbedding := by + intro v hv + obtain ⟨i, _hi, rfl⟩ := Finset.mem_map.mp hv + obtain ⟨j, hj⟩ := hnone i + exact Finset.mem_map.mpr + ⟨j, Finset.mem_univ _, hj⟩ + have hreverseRank : ej.1 + 1 ≤ fj.1 + 1 := by + have hc := + Finset.card_le_card hsubset + simpa [PositiveOrderedFace.rank] using hc + have hforwardRank : fj.1 + 1 ≤ ej.1 + 1 := by + simpa [PositiveOrderedFace.rank] using hle + have hlowerVal : ej.1 = fj.1 := by + omega + have hlower : ej = fj := Fin.ext hlowerVal + subst fj + have hsets : + Finset.univ.map ef.toEmbedding = + Finset.univ.map ff.toEmbedding := by + apply Finset.eq_of_subset_of_card_le hsubset + simp + have hrange : Set.range ef = Set.range ff := by + ext v + have hv := Finset.ext_iff.mp hsets v + simpa using hv + apply hne + congr + exact OrderEmbedding.range_inj_of_wellFoundedLT.mp hrange.symm + +noncomputable def positiveFaceMissingCoordinate + {k r : ℕ} + (e f : PositiveOrderedFace k r) + (hle : f.rank ≤ e.rank) (hne : f ≠ e) : + Fin (e.lowerRank.1 + 1) := + Classical.choose + (exists_positiveFace_coordinate_not_mem_range + e f hle hne) + +theorem positiveFaceMissingCoordinate_not_mem_range + {k r : ℕ} + (e f : PositiveOrderedFace k r) + (hle : f.rank ≤ e.rank) (hne : f ≠ e) : + e.face (positiveFaceMissingCoordinate e f hle hne) ∉ + Set.range f.face := + Classical.choose_spec + (exists_positiveFace_coordinate_not_mem_range + e f hle hne) + +theorem orderedFaceTuple_split_update_eq_of_missing + {G : Type*} {k n m : ℕ} + (e : OrderedFace k n) (f : OrderedFace k m) + (i : Fin n) + (hmissing : e i ∉ Set.range f) + (a : G) (y : Fin n → G) + (z : OrderedFaceComplement e → G) : + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm + (Function.update y i a, z)) = + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm (y, z)) := by + funext t + by_cases hfe : f t ∈ Set.range e + · obtain ⟨q, hq⟩ := hfe + have hqi : q ≠ i := by + intro h + apply hmissing + exact ⟨t, (h ▸ hq).symm⟩ + have hleft := + congrFun + (orderedFaceTuple_splitOrderedFaceEquiv_symm + e (Function.update y i a) z) q + have hright := + congrFun + (orderedFaceTuple_splitOrderedFaceEquiv_symm + e y z) q + change + ((splitOrderedFaceEquiv e).symm + (Function.update y i a, z)) (e q) = + Function.update y i a q at hleft + change + ((splitOrderedFaceEquiv e).symm (y, z)) (e q) = + y q at hright + change + ((splitOrderedFaceEquiv e).symm + (Function.update y i a, z)) (f t) = + ((splitOrderedFaceEquiv e).symm (y, z)) (f t) + rw [← hq, hleft, hright] + simp [hqi] + · let v : OrderedFaceComplement e := ⟨f t, hfe⟩ + have hleft := + congrFun + (orderedFaceComplementTuple_splitOrderedFaceEquiv_symm + e (Function.update y i a) z) v + have hright := + congrFun + (orderedFaceComplementTuple_splitOrderedFaceEquiv_symm + e y z) v + exact hleft.trans hright.symm + +theorem orderedFaceTuple_split_insertErased_eq_of_missing + {G : Type*} {k j m : ℕ} + (e : OrderedFace k (j + 1)) (f : OrderedFace k m) + (i : Fin (j + 1)) + (hmissing : e i ∉ Set.range f) + (a : G) (y : Fin (j + 1) → G) + (z : OrderedFaceComplement e → G) : + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm + (Fin.insertNth i a + (eraseBoundaryCoordinate i y), z)) = + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm (y, z)) := by + have hinsert : + Fin.insertNth i a (eraseBoundaryCoordinate i y) = + Function.update y i a := by + exact Fin.insertNth_removeNth i a y + rw [hinsert] + exact orderedFaceTuple_split_update_eq_of_missing + e f i hmissing a y z + +def configurationFaceWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + partitionAtomIndicator + (C.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) y + +theorem configurationFaceWeight_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + 0 ≤ configurationFaceWeight A e y := + partitionAtomIndicator_nonneg _ _ _ + +theorem configurationFaceWeight_le_one + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + configurationFaceWeight A e y ≤ 1 := + partitionAtomIndicator_le_one _ _ _ + +noncomputable def partialConfigurationWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (x : Fin k → G) : ℝ := + ∏ e ∈ s, + configurationFaceWeight A e + (orderedFaceTuple e.face x) + +noncomputable def partialConfigurationCount + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) : ℝ := + mean (partialConfigurationWeight A s) + +noncomputable def fullConfigurationCount + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) : ℝ := + partialConfigurationCount A Finset.univ + +@[simp] +theorem partialConfigurationWeight_empty + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (x : Fin k → G) : + partialConfigurationWeight A ∅ x = 1 := by + simp [partialConfigurationWeight] + +@[simp] +theorem partialConfigurationCount_empty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) : + partialConfigurationCount A ∅ = 1 := by + change mean (fun _x : Fin k → G => (1 : ℝ)) = 1 + exact mean_const 1 + +theorem partialConfigurationWeight_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (x : Fin k → G) : + 0 ≤ partialConfigurationWeight A s x := by + unfold partialConfigurationWeight + exact Finset.prod_nonneg fun e he => + configurationFaceWeight_nonneg A e _ + +theorem partialConfigurationWeight_le_one + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (x : Fin k → G) : + partialConfigurationWeight A s x ≤ 1 := by + unfold partialConfigurationWeight + apply Finset.prod_le_one₀ + · intro e he + exact configurationFaceWeight_nonneg A e _ + · intro e he + exact configurationFaceWeight_le_one A e _ + +theorem orderedFaceTuple_split_insertNth_erase_eq_of_missing + {G : Type*} {k j m : ℕ} + (e : OrderedFace k (j + 1)) (f : OrderedFace k m) + (i : Fin (j + 1)) + (hmissing : e i ∉ Set.range f) + (a : G) (y : Fin (j + 1) → G) + (z : OrderedFaceComplement e → G) : + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm + (Fin.insertNth i a (eraseCoordinate i y), z)) = + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm (y, z)) := by + rw [insertNth_eraseCoordinate_eq_update] + exact orderedFaceTuple_split_update_eq_of_missing + e f i hmissing a y z + +noncomputable def configurationMissingCoordinate + {k r : ℕ} + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (f : PositiveOrderedFace k r) : + Fin (e.lowerRank.1 + 1) := by + classical + by_cases hf : f ∈ s.erase e + · exact positiveFaceMissingCoordinate e f + (hmax f hf) (Finset.mem_erase.mp hf).1 + · exact 0 + +theorem configurationMissingCoordinate_not_mem_range + {k r : ℕ} + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : ∀ f ∈ s.erase e, f.rank ≤ e.rank) + {f : PositiveOrderedFace k r} + (hf : f ∈ s.erase e) : + e.face + (configurationMissingCoordinate s e hmax f) ∉ + Set.range f.face := by + rw [configurationMissingCoordinate] + simp only [dite_eq_left hf] + exact positiveFaceMissingCoordinate_not_mem_range + e f (hmax f hf) (Finset.mem_erase.mp hf).1 + +noncomputable def configurationRemainderCutTest + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (a : G) + (z : OrderedFaceComplement e.face → G) : + CutTestFamily G (e.lowerRank.1 + 1) := + fun i y => + ∏ f ∈ s.erase e, + if _hcoord : + configurationMissingCoordinate s e hmax f = i + then + configurationFaceWeight A f + (orderedFaceTuple f.face + ((splitOrderedFaceEquiv e.face).symm + (Fin.insertNth i a y, z))) + else 1 + +theorem configurationRemainderCutTest_bounded + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (a : G) + (z : OrderedFaceComplement e.face → G) : + IsBoundedCutTest + (configurationRemainderCutTest A s e hmax a z) := by + constructor + · intro i y + unfold configurationRemainderCutTest + apply Finset.prod_nonneg + intro f hf + split_ifs + · exact configurationFaceWeight_nonneg A f _ + · positivity + · intro i y + unfold configurationRemainderCutTest + apply Finset.prod_le_one₀ + · intro f hf + split_ifs + · exact configurationFaceWeight_nonneg A f _ + · positivity + · intro f hf + split_ifs + · exact configurationFaceWeight_le_one A f _ + · exact le_rfl + +theorem cutTestProduct_configurationRemainderCutTest + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (a : G) + (y : Fin (e.lowerRank.1 + 1) → G) + (z : OrderedFaceComplement e.face → G) : + cutTestProduct + (configurationRemainderCutTest A s e hmax a z) y = + partialConfigurationWeight A (s.erase e) + ((splitOrderedFaceEquiv e.face).symm (y, z)) := by + classical + unfold cutTestProduct configurationRemainderCutTest + rw [Finset.prod_comm] + unfold partialConfigurationWeight + apply Finset.prod_congr rfl + intro f hf + let i := + configurationMissingCoordinate s e hmax f + have hmissing : + e.face i ∉ Set.range f.face := + configurationMissingCoordinate_not_mem_range + s e hmax hf + calc + (∏ q : Fin (e.lowerRank.1 + 1), + if hcoord : + configurationMissingCoordinate s e hmax f = q + then + configurationFaceWeight A f + (orderedFaceTuple f.face + ((splitOrderedFaceEquiv e.face).symm + (Fin.insertNth q a + (eraseCoordinate q y), z))) + else 1) = + (if hcoord : + configurationMissingCoordinate s e hmax f = i + then + configurationFaceWeight A f + (orderedFaceTuple f.face + ((splitOrderedFaceEquiv e.face).symm + (Fin.insertNth i a + (eraseCoordinate i y), z))) + else 1) := by + apply Fintype.prod_eq_single i + intro q hqi + have hne : + configurationMissingCoordinate s e hmax f ≠ q := by + intro h + exact hqi h.symm + simp [hne] + _ = + configurationFaceWeight A f + (orderedFaceTuple f.face + ((splitOrderedFaceEquiv e.face).symm + (Fin.insertNth i a + (eraseCoordinate i y), z))) := by + simp [i] + _ = + configurationFaceWeight A f + (orderedFaceTuple f.face + ((splitOrderedFaceEquiv e.face).symm (y, z))) := by + rw [orderedFaceTuple_split_insertNth_erase_eq_of_missing + e.face f.face i hmissing a y z] + +def positiveFaceLowerLayer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) : + OrderedFacePartitionSystem G k e.lowerRank.1 := + C.partition e.lowerRank.castSucc + +noncomputable def configurationCoarseDensity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) : ℝ := + orderedBoundaryStructured + (positiveFaceLowerLayer P.coarse e) + e.face + (partitionAtomIndicator + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + (orderedFaceTuple e.face A.witness) + +noncomputable def configurationFineDensity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + orderedBoundaryStructured + (positiveFaceLowerLayer P.fine e) + e.face + (partitionAtomIndicator + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + y + +noncomputable def configurationDefect + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + configurationFineDensity P A e y - + configurationCoarseDensity P A e + +noncomputable def configurationUniform + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + configurationFaceWeight A e y - + configurationFineDensity P A e y + +noncomputable def configurationBoundaryIndicator + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + partitionAtomIndicator + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) e.face + (orderedFaceTuple e.face A.witness)) + y + +theorem configurationCoarseDensity_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) : + 0 ≤ configurationCoarseDensity P A e := by + exact conditionalMean_nonneg _ + (partitionAtomIndicator_nonneg _ _) _ + +theorem configurationCoarseDensity_le_one + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) : + configurationCoarseDensity P A e ≤ 1 := by + exact conditionalMean_le_one _ + (partitionAtomIndicator_le_one _ _) _ + +theorem configurationBoundaryIndicator_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + 0 ≤ configurationBoundaryIndicator P A e y := + partitionAtomIndicator_nonneg _ _ _ + +theorem configurationBoundaryIndicator_le_one + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + configurationBoundaryIndicator P A e y ≤ 1 := + partitionAtomIndicator_le_one _ _ _ + +theorem configurationFaceWeight_decompose + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + configurationFaceWeight A e y = + configurationCoarseDensity P A e + + configurationDefect P A e y + + configurationUniform P A e y := by + unfold configurationDefect configurationUniform + ring + +theorem coarse_boundary_mem_of_boundary_weight_ne_zero + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (hpos : 0 < e.lowerRank.1) + (i : Fin (e.lowerRank.1 + 1)) + (x : Fin k → G) + (hweight : + configurationFaceWeight A (e.boundary hpos i) + (orderedFaceTuple (e.boundary hpos i).face x) ≠ + 0) : + eraseBoundaryCoordinate i (orderedFaceTuple e.face x) ∈ + (positiveFaceLowerLayer P.coarse e + (eraseBoundaryFace e.face i)).part + (eraseBoundaryCoordinate i + (orderedFaceTuple e.face A.witness)) := by + rcases e with ⟨⟨n, hn⟩, eface⟩ + cases n with + | zero => + simp at hpos + | succ n => + let f := + (⟨⟨n, by omega⟩, + eraseBoundaryFace eface i⟩ : + PositiveOrderedFace k r) + have hfine : + orderedFaceTuple f.face x ∈ + (A.atom f.lowerRank.succ f.face).1 := by + by_contra hnot + exact hweight + (partitionAtomIndicator_of_not_mem + (P.fine.partition f.lowerRank.succ f.face) + (A.atom f.lowerRank.succ f.face) hnot) + have hcanonical : + (A.atom f.lowerRank.succ f.face).1 = + (P.fine.partition f.lowerRank.succ f.face).part + (orderedFaceTuple f.face A.witness) := by + exact congrArg Subtype.val + (A.atom_eq_partitionAtomAt + f.lowerRank.succ f.face) + rw [hcanonical] at hfine + have hcoarse : + orderedFaceTuple f.face x ∈ + (P.coarse.partition f.lowerRank.succ f.face).part + (orderedFaceTuple f.face A.witness) := + FacePartition.part_subset_of_le + (P.refines f.lowerRank.succ f.face) + (orderedFaceTuple f.face A.witness) hfine + let j : Fin (r + 1) := + ⟨n + 1, Nat.lt_succ_of_lt hn⟩ + have hfj : f.lowerRank.succ = j := by + apply Fin.ext + rfl + have hcoarse' : + orderedFaceTuple f.face x ∈ + (P.coarse.partition j f.face).part + (orderedFaceTuple f.face A.witness) := by + subst j + exact hcoarse + simpa [f, j, positiveFaceLowerLayer, + OrderedPartitionComplex.layer] using hcoarse' + +theorem configurationBoundaryIndicator_mul_remainder + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (x : Fin k → G) : + configurationBoundaryIndicator P A e + (orderedFaceTuple e.face x) * + partialConfigurationWeight A (s.erase e) x = + partialConfigurationWeight A (s.erase e) x := by + by_cases hrem : + partialConfigurationWeight A (s.erase e) x = 0 + · rw [hrem, mul_zero] + · have hbaseMem : + orderedFaceTuple e.face x ∈ + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)).1 := by + rw [mem_orderedBoundaryAtomAt_iff] + intro i + by_cases hzero : e.lowerRank.1 = 0 + · have heq : + eraseBoundaryCoordinate i + (orderedFaceTuple e.face x) = + eraseBoundaryCoordinate i + (orderedFaceTuple e.face A.witness) := by + funext q + have hq : q.1 < 0 := by + simpa [hzero] using q.2 + omega + rw [heq] + exact + (positiveFaceLowerLayer P.coarse e + (eraseBoundaryFace e.face i)).mem_part + (Finset.mem_univ _) + · have hpos : 0 < e.lowerRank.1 := + Nat.pos_of_ne_zero hzero + let f := e.boundary hpos i + have hfS : f ∈ s := + hclosed e he hpos i + have hfe : f ≠ e := by + intro h + have hlt := e.boundary_rank_lt hpos i + change e.boundary hpos i = e at h + rw [h] at hlt + exact (Nat.lt_irrefl _ hlt) + have hfErase : f ∈ s.erase e := + Finset.mem_erase.mpr ⟨hfe, hfS⟩ + have hfactor : + configurationFaceWeight A f + (orderedFaceTuple f.face x) ≠ 0 := by + have hprod : + (∏ g ∈ s.erase e, + configurationFaceWeight A g + (orderedFaceTuple g.face x)) ≠ 0 := by + simpa [partialConfigurationWeight] using hrem + exact Finset.prod_ne_zero_iff.mp hprod f hfErase + exact coarse_boundary_mem_of_boundary_weight_ne_zero + P A e hpos i x hfactor + rw [configurationBoundaryIndicator, + partitionAtomIndicator_of_mem _ _ hbaseMem, + one_mul] + +noncomputable def configurationContribution + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (q : (Fin (e.lowerRank.1 + 1) → G) → ℝ) : ℝ := + mean fun x : Fin k → G => + q (orderedFaceTuple e.face x) * + partialConfigurationWeight A (s.erase e) x + +theorem partialConfigurationWeight_eq_face_mul_erase + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (x : Fin k → G) : + partialConfigurationWeight A s x = + configurationFaceWeight A e + (orderedFaceTuple e.face x) * + partialConfigurationWeight A (s.erase e) x := by + unfold partialConfigurationWeight + exact + (Finset.mul_prod_erase s + (fun f => + configurationFaceWeight A f + (orderedFaceTuple f.face x)) he).symm + +theorem partialConfigurationCount_decompose + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) (he : e ∈ s) : + partialConfigurationCount A s = + configurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e) + + configurationContribution A s e + (configurationDefect P A e) + + configurationContribution A s e + (configurationUniform P A e) := by + rw [partialConfigurationCount, partialConfigurationCount] + have hpoint : + partialConfigurationWeight A s = + fun x => + configurationCoarseDensity P A e * + partialConfigurationWeight A (s.erase e) x + + configurationDefect P A e + (orderedFaceTuple e.face x) * + partialConfigurationWeight A (s.erase e) x + + configurationUniform P A e + (orderedFaceTuple e.face x) * + partialConfigurationWeight A (s.erase e) x := by + funext x + rw [partialConfigurationWeight_eq_face_mul_erase + A s e he x, + configurationFaceWeight_decompose P A e] + ring + rw [hpoint, mean_add, mean_add, mean_smul] + rfl + +theorem configurationFace_isFaceCutRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + (e : PositiveOrderedFace k r) : + (⟨orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face⟩ : + FaceRegularityState + (Fin (e.lowerRank.1 + 1) → G)).IsFaceCutRegular + (partitionAtomIndicator + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + (ε e.lowerRank) := by + rw [positiveFaceLowerLayer] + exact + (hregular e.lowerRank).toBounded + e.face + (A.atom e.lowerRank.succ e.face) + +theorem ClosedOrderedAtomConfiguration.IsGood.atPositiveFace + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (α β : ℕ → ℝ) + (hgood : A.IsGood P.fine P.coarse α β) + (e : PositiveOrderedFace k r) : + OrderedAtomIsGoodAtBoundary + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedFaceTuple e.face A.witness) + (α e.rank) (β e.rank) := by + rcases e with ⟨⟨j, hj⟩, e⟩ + exact hgood j hj e + +theorem configurationContribution_uniform_eq_mean_faceCutCorrelation + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (a : G) : + configurationContribution A s e + (configurationUniform P A e) = + mean fun z : OrderedFaceComplement e.face → G => + (⟨orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face⟩ : + FaceRegularityState + (Fin (e.lowerRank.1 + 1) → G)).faceCutCorrelation + (partitionAtomIndicator + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + (configurationRemainderCutTest + A s e hmax a z) := by + unfold configurationContribution + rw [mean_splitOrderedFace e.face, mean₂_comm] + unfold mean₂ + apply congrArg mean + funext z + unfold FaceRegularityState.faceCutCorrelation + apply congrArg mean + funext y + rw [cutTestProduct_configurationRemainderCutTest + A s e hmax a y z] + simp only [orderedFaceTuple_splitOrderedFaceEquiv_symm] + rfl + +theorem abs_configurationContribution_uniform_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + (s : Finset (PositiveOrderedFace k r)) + (e : PositiveOrderedFace k r) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) : + |configurationContribution A s e + (configurationUniform P A e)| ≤ + ε e.lowerRank := by + rw [configurationContribution_uniform_eq_mean_faceCutCorrelation + P A s e hmax (Classical.choice inferInstance)] + let S : + FaceRegularityState + (Fin (e.lowerRank.1 + 1) → G) := + ⟨orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face⟩ + let f : + (Fin (e.lowerRank.1 + 1) → G) → ℝ := + partitionAtomIndicator + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + calc + |mean fun z : OrderedFaceComplement e.face → G => + S.faceCutCorrelation f + (configurationRemainderCutTest A s e hmax + (Classical.choice inferInstance) z)| ≤ + mean fun z : OrderedFaceComplement e.face → G => + |S.faceCutCorrelation f + (configurationRemainderCutTest A s e hmax + (Classical.choice inferInstance) z)| := + Finset.abs_expect_le Finset.univ _ + _ ≤ + mean fun _z : OrderedFaceComplement e.face → G => + ε e.lowerRank := by + apply mean_mono + intro z + exact + configurationFace_isFaceCutRegular + P A ε hregular e + (configurationRemainderCutTest A s e hmax + (Classical.choice inferInstance) z) + (configurationRemainderCutTest_bounded + A s e hmax (Classical.choice inferInstance) z) + _ = ε e.lowerRank := mean_const _ + +theorem configurationDefect_mul_boundaryIndicator + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + configurationDefect P A e y * + configurationBoundaryIndicator P A e y = + orderedAtomBoundaryDefect + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) y * + configurationBoundaryIndicator P A e y := by + let Q := + orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face + let b : Q.parts := + orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) e.face + (orderedFaceTuple e.face A.witness) + let f : + (Fin (e.lowerRank.1 + 1) → G) → ℝ := + partitionAtomIndicator + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + by_cases hy : y ∈ b.1 + · have hcoarse : + conditionalMean Q f y = + conditionalMean Q f + (orderedFaceTuple e.face A.witness) := by + exact conditionalMean_eq_of_mem_part Q f hy + rw [configurationBoundaryIndicator, + partitionAtomIndicator_of_mem _ _ hy, + mul_one, mul_one] + change + conditionalMean + (orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face) + f y - + conditionalMean Q f + (orderedFaceTuple e.face A.witness) = + conditionalMean + (orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face) + f y - + conditionalMean Q f y + rw [hcoarse] + · rw [configurationBoundaryIndicator, + partitionAtomIndicator_of_not_mem _ _ hy, + mul_zero, mul_zero] + +theorem mean_sq_configurationDefect_mul_boundaryIndicator + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (e : PositiveOrderedFace k r) : + mean (fun y => + (configurationDefect P A e y * + configurationBoundaryIndicator P A e y) ^ 2) = + orderedLocalizedAtomDefectSq + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) := by + unfold orderedLocalizedAtomDefectSq + apply congrArg mean + funext y + rw [configurationDefect_mul_boundaryIndicator P A e y, + mul_pow] + rw [show + configurationBoundaryIndicator P A e y ^ 2 = + configurationBoundaryIndicator P A e y by + exact partitionAtomIndicator_sq _ _ _] + rfl + +theorem orderedBoundaryAtomMass_le_one + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : (orderedBoundaryPartition coarse e).parts) : + orderedBoundaryAtomMass coarse e b ≤ 1 := by + unfold orderedBoundaryAtomMass + exact mean_le_of_le_const fun y => + partitionAtomIndicator_le_one _ _ y + +theorem mean_sq_partialConfigurationWeight_le_one + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (s : Finset (PositiveOrderedFace k r)) : + mean (fun x : Fin k → G => + partialConfigurationWeight A s x ^ 2) ≤ 1 := by + apply mean_le_of_le_const + intro x + have h0 := partialConfigurationWeight_nonneg A s x + have h1 := partialConfigurationWeight_le_one A s x + nlinarith + +theorem configurationContribution_defect_eq_localized + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) : + configurationContribution A s e + (configurationDefect P A e) = + mean fun x : Fin k → G => + (configurationDefect P A e + (orderedFaceTuple e.face x) * + configurationBoundaryIndicator P A e + (orderedFaceTuple e.face x)) * + partialConfigurationWeight A (s.erase e) x := by + unfold configurationContribution + apply congrArg mean + funext x + rw [mul_assoc, + configurationBoundaryIndicator_mul_remainder + P A s hclosed e he x] + +theorem configurationContribution_defect_sq_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (α β : ℕ → ℝ) + (hgood : A.IsGood P.fine P.coarse α β) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hβ : 0 ≤ β e.rank) : + configurationContribution A s e + (configurationDefect P A e) ^ 2 ≤ + β e.rank := by + let u : (Fin k → G) → ℝ := + fun x => + configurationDefect P A e + (orderedFaceTuple e.face x) * + configurationBoundaryIndicator P A e + (orderedFaceTuple e.face x) + let v : (Fin k → G) → ℝ := + partialConfigurationWeight A (s.erase e) + have hlocal : + mean (fun x : Fin k → G => u x ^ 2) ≤ + β e.rank := by + have hgoodLocal := + (hgood.atPositiveFace P A α β e).localized_defect + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedFaceTuple e.face A.witness) + (α e.rank) (β e.rank) + have hmass : + orderedBoundaryAtomMass + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) ≤ + 1 := + orderedBoundaryAtomMass_le_one _ _ _ + calc + mean (fun x : Fin k → G => u x ^ 2) = + mean (fun y => + (configurationDefect P A e y * + configurationBoundaryIndicator P A e y) ^ 2) := by + exact mean_comp_orderedFaceTuple e.face + (fun y => + (configurationDefect P A e y * + configurationBoundaryIndicator P A e y) ^ 2) + _ = + orderedLocalizedAtomDefectSq + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.fine.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) := + mean_sq_configurationDefect_mul_boundaryIndicator + P A e + _ ≤ + β e.rank * + orderedBoundaryAtomMass + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedBoundaryAtomAt + (positiveFaceLowerLayer P.coarse e) + e.face + (orderedFaceTuple e.face A.witness)) := + hgoodLocal + _ ≤ β e.rank := by + exact mul_le_of_le_one_right hβ hmass + have hv0 : + 0 ≤ mean (fun x : Fin k → G => v x ^ 2) := + mean_nonneg fun x => sq_nonneg _ + have hv1 : + mean (fun x : Fin k → G => v x ^ 2) ≤ 1 := + mean_sq_partialConfigurationWeight_le_one + A (s.erase e) + calc + configurationContribution A s e + (configurationDefect P A e) ^ 2 = + mean (fun x : Fin k → G => u x * v x) ^ 2 := by + rw [configurationContribution_defect_eq_localized + P A s hclosed e he] + _ ≤ + mean (fun x : Fin k → G => u x ^ 2) * + mean (fun x : Fin k → G => v x ^ 2) := + mean_mul_sq_le_product u v + _ ≤ + β e.rank * + mean (fun x : Fin k → G => v x ^ 2) := + mul_le_mul_of_nonneg_right hlocal hv0 + _ ≤ β e.rank := + mul_le_of_le_one_right hβ hv1 + +theorem abs_configurationContribution_defect_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (α β : ℕ → ℝ) + (hgood : A.IsGood P.fine P.coarse α β) + {δ : ℝ} (hδ : 0 ≤ δ) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hβ0 : 0 ≤ β e.rank) + (hβδ : β e.rank ≤ δ ^ 2) : + |configurationContribution A s e + (configurationDefect P A e)| ≤ δ := by + have hsquare : + |configurationContribution A s e + (configurationDefect P A e)| ^ 2 ≤ + δ ^ 2 := by + rw [sq_abs] + exact le_trans + (configurationContribution_defect_sq_le + P A α β hgood s hclosed e he hβ0) + hβδ + exact + (sq_le_sq₀ + (abs_nonneg + (configurationContribution A s e + (configurationDefect P A e))) + hδ).mp hsquare + +theorem abs_partialConfigurationCount_sub_coarseDensity_mul_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (α β : ℕ → ℝ) + (hgood : A.IsGood P.fine P.coarse α β) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + {δ : ℝ} (hδ : 0 ≤ δ) + (s : Finset (PositiveOrderedFace k r)) + (hclosed : IsDownwardClosedPositiveFaces s) + (e : PositiveOrderedFace k r) (he : e ∈ s) + (hmax : + ∀ f ∈ s.erase e, f.rank ≤ e.rank) + (hβ0 : 0 ≤ β e.rank) + (hβδ : β e.rank ≤ δ ^ 2) : + |partialConfigurationCount A s - + configurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e)| ≤ + δ + ε e.lowerRank := by + have hdefect : + |configurationContribution A s e + (configurationDefect P A e)| ≤ δ := + abs_configurationContribution_defect_le + P A α β hgood hδ s hclosed e he hβ0 hβδ + have huniform : + |configurationContribution A s e + (configurationUniform P A e)| ≤ + ε e.lowerRank := + abs_configurationContribution_uniform_le + P A ε hregular s e hmax + rw [partialConfigurationCount_decompose + P A s e he] + calc + |configurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e) + + configurationContribution A s e + (configurationDefect P A e) + + configurationContribution A s e + (configurationUniform P A e) - + configurationCoarseDensity P A e * + partialConfigurationCount A (s.erase e)| = + |configurationContribution A s e + (configurationDefect P A e) + + configurationContribution A s e + (configurationUniform P A e)| := by + congr 1 + ring + _ ≤ + |configurationContribution A s e + (configurationDefect P A e)| + + |configurationContribution A s e + (configurationUniform P A e)| := + abs_add_le _ _ + _ ≤ δ + ε e.lowerRank := + add_le_add hdefect huniform + +noncomputable def extendedConfigurationCount + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (s : Finset (PositiveOrderedFace k r)) : ℝ := by + classical + exact + if IsDownwardClosedPositiveFaces s then + partialConfigurationCount A s + else + ∏ e ∈ s, configurationCoarseDensity P A e + +@[simp] +theorem extendedConfigurationCount_empty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) : + extendedConfigurationCount P A ∅ = 1 := by + rw [extendedConfigurationCount, + ite_eq_left downwardClosed_empty, + partialConfigurationCount_empty] + +theorem extendedConfigurationCount_univ + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) : + extendedConfigurationCount P A Finset.univ = + fullConfigurationCount A := by + rw [extendedConfigurationCount, + ite_eq_left downwardClosed_univ] + rfl + +theorem configurationCoarseDensity_lower + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (α β : ℕ → ℝ) + (hgood : A.IsGood P.fine P.coarse α β) + (e : PositiveOrderedFace k r) : + α e.rank ≤ configurationCoarseDensity P A e := + (hgood.atPositiveFace P A α β e).1 + +theorem extendedConfigurationCount_step + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (α β : ℕ → ℝ) + (hgood : A.IsGood P.fine P.coarse α β) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + {η δ : ℝ} (hη : 0 ≤ η) (hδ : 0 ≤ δ) + (hε : ∀ j, ε j ≤ η) + (hβ0 : ∀ n, 0 ≤ β n) + (hβδ : ∀ n, β n ≤ δ ^ 2) + (s : Finset (PositiveOrderedFace k r)) + (hs : s.Nonempty) : + ∃ e ∈ s, + |extendedConfigurationCount P A s - + configurationCoarseDensity P A e * + extendedConfigurationCount P A (s.erase e)| ≤ + η + δ := by + classical + by_cases hclosed : IsDownwardClosedPositiveFaces s + · obtain ⟨e, he, hmax⟩ := + exists_maxRank_mem s hs + have hclosedErase : + IsDownwardClosedPositiveFaces (s.erase e) := + hclosed.erase_maxRank he hmax + refine ⟨e, he, ?_⟩ + rw [extendedConfigurationCount, + ite_eq_left hclosed, + extendedConfigurationCount, + ite_eq_left hclosedErase] + have hrec := + abs_partialConfigurationCount_sub_coarseDensity_mul_le + P A α β hgood ε hregular hδ + s hclosed e he + (fun f hf => hmax f (Finset.mem_of_mem_erase hf)) + (hβ0 e.rank) (hβδ e.rank) + have heps := hε e.lowerRank + linarith + · unfold IsDownwardClosedPositiveFaces at hclosed + push Not at hclosed + obtain ⟨f, hf, hpos, i, hboundary⟩ := hclosed + by_cases hrest : s.erase f = ∅ + · have hsEq : s = {f} := by + rcases (Finset.erase_eq_empty_iff s f).mp hrest with + hsEmpty | hsSingleton + · exact (hs.ne_empty hsEmpty).elim + · exact hsSingleton + refine ⟨f, hf, ?_⟩ + have hcountS : + extendedConfigurationCount P A s = + configurationCoarseDensity P A f := by + rw [extendedConfigurationCount, ite_eq_right] + · simp [hsEq] + · intro h + exact hboundary (h f hf hpos i) + have hcountErase : + extendedConfigurationCount P A (s.erase f) = 1 := by + rw [hrest, extendedConfigurationCount_empty] + rw [hcountS, hcountErase, mul_one, sub_self, abs_zero] + exact add_nonneg hη hδ + · obtain ⟨e, heRest⟩ : + (s.erase f).Nonempty := + Finset.nonempty_iff_ne_empty.mpr hrest + have heS : e ∈ s := + Finset.mem_of_mem_erase heRest + have hef : e ≠ f := + (Finset.mem_erase.mp heRest).1 + have hfEraseE : f ∈ s.erase e := + Finset.mem_erase.mpr ⟨hef.symm, hf⟩ + have hclosedErase : + ¬IsDownwardClosedPositiveFaces (s.erase e) := by + intro h + have hb := h f hfEraseE hpos i + exact hboundary (Finset.mem_of_mem_erase hb) + refine ⟨e, heS, ?_⟩ + have hcountS : + extendedConfigurationCount P A s = + ∏ g ∈ s, + configurationCoarseDensity P A g := by + rw [extendedConfigurationCount, ite_eq_right] + intro h + exact hboundary (h f hf hpos i) + have hcountErase : + extendedConfigurationCount P A (s.erase e) = + ∏ g ∈ s.erase e, + configurationCoarseDensity P A g := by + rw [extendedConfigurationCount, + ite_eq_right hclosedErase] + rw [hcountS, hcountErase] + have hprod : + configurationCoarseDensity P A e * + (∏ g ∈ s.erase e, + configurationCoarseDensity P A g) = + ∏ g ∈ s, + configurationCoarseDensity P A g := + Finset.mul_prod_erase s + (configurationCoarseDensity P A) heS + rw [hprod, sub_self, abs_zero] + exact add_nonneg hη hδ + +theorem fullConfigurationCount_lower_bound + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (α β : ℕ → ℝ) + (hgood : A.IsGood P.fine P.coarse α β) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + {ρ η δ : ℝ} + (hρ : 0 ≤ ρ) (hη : 0 ≤ η) (hδ : 0 ≤ δ) + (hα : ∀ n, ρ ≤ α n) + (hε : ∀ j, ε j ≤ η) + (hβ0 : ∀ n, 0 ≤ β n) + (hβδ : ∀ n, β n ≤ δ ^ 2) : + ρ ^ Fintype.card (PositiveOrderedFace k r) - + (Fintype.card (PositiveOrderedFace k r) : ℝ) * + (η + δ) ≤ + fullConfigurationCount A := by + let count : + Finset (PositiveOrderedFace k r) → ℝ := + extendedConfigurationCount P A + let p : PositiveOrderedFace k r → ℝ := + configurationCoarseDensity P A + have hempty : count ∅ = 1 := + extendedConfigurationCount_empty P A + have hp : ∀ e, 0 ≤ p e ∧ p e ≤ 1 := by + intro e + exact + ⟨configurationCoarseDensity_nonneg P A e, + configurationCoarseDensity_le_one P A e⟩ + have hpLower : ∀ e, ρ ≤ p e := by + intro e + exact le_trans + (hα e.rank) + (configurationCoarseDensity_lower + P A α β hgood e) + have hstep : + ∀ s : Finset (PositiveOrderedFace k r), s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ + η + δ := by + intro s hs + exact extendedConfigurationCount_step + P A α β hgood ε hregular + hη hδ hε hβ0 hβδ s hs + have hbound := + pow_sub_card_mul_le_finiteCount + count p hρ (add_nonneg hη hδ) + hempty hp hpLower hstep + (Finset.univ : + Finset (PositiveOrderedFace k r)) + rw [show count + (Finset.univ : + Finset (PositiveOrderedFace k r)) = + fullConfigurationCount A by + exact extendedConfigurationCount_univ P A] at hbound + simpa using hbound + +theorem fullConfigurationCount_pos + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.fine) + (α β : ℕ → ℝ) + (hgood : A.IsGood P.fine P.coarse α β) + (ε : OrderedRegularityTolerance r) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + {ρ η δ : ℝ} + (hρ : 0 ≤ ρ) (hη : 0 ≤ η) (hδ : 0 ≤ δ) + (hα : ∀ n, ρ ≤ α n) + (hε : ∀ j, ε j ≤ η) + (hβ0 : ∀ n, 0 ≤ β n) + (hβδ : ∀ n, β n ≤ δ ^ 2) + (hsmall : + (Fintype.card (PositiveOrderedFace k r) : ℝ) * + (η + δ) < + ρ ^ Fintype.card (PositiveOrderedFace k r)) : + 0 < fullConfigurationCount A := by + let count : + Finset (PositiveOrderedFace k r) → ℝ := + extendedConfigurationCount P A + let p : PositiveOrderedFace k r → ℝ := + configurationCoarseDensity P A + have hempty : count ∅ = 1 := + extendedConfigurationCount_empty P A + have hp : ∀ e, 0 ≤ p e ∧ p e ≤ 1 := by + intro e + exact + ⟨configurationCoarseDensity_nonneg P A e, + configurationCoarseDensity_le_one P A e⟩ + have hpLower : ∀ e, ρ ≤ p e := by + intro e + exact le_trans + (hα e.rank) + (configurationCoarseDensity_lower + P A α β hgood e) + have hstep : + ∀ s : Finset (PositiveOrderedFace k r), s.Nonempty → + ∃ e ∈ s, + |count s - p e * count (s.erase e)| ≤ + η + δ := by + intro s hs + exact extendedConfigurationCount_step + P A α β hgood ε hregular + hη hδ hε hβ0 hβδ s hs + have hpositive := + finiteCount_pos_of_card_mul_lt_pow + count p hρ (add_nonneg hη hδ) + hempty hp hpLower hstep + (Finset.univ : + Finset (PositiveOrderedFace k r)) + (by simpa using hsmall) + rw [show count + (Finset.univ : + Finset (PositiveOrderedFace k r)) = + fullConfigurationCount A by + exact extendedConfigurationCount_univ P A] at hpositive + exact hpositive + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedCounting.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..090d32114b8c173f9c4db0a3e2a7114f69307ef5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedCounting.lean @@ -0,0 +1,1459 @@ +import Mathlib.Algebra.Order.BigOperators.Expect +import OAI.Combinatorics.Progressions.FixedDensity.GeneratorCells +import OAI.Combinatorics.Progressions.FixedDensity.OrderedPattern + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def EdgeWeightsInUnitInterval {k : ℕ} {V : Fin k → Type*} + (H : WeightedSimplexSystem V) : Prop := + ∀ j x, 0 ≤ H.edgeWeight j x ∧ H.edgeWeight j x ≤ 1 + +def EdgeSupDistanceLe {k : ℕ} {V : Fin k → Type*} + (H G : WeightedSimplexSystem V) (ε : ℝ) : Prop := + ∀ j x, |H.edgeWeight j x - G.edgeWeight j x| ≤ ε + +theorem abs_prod_sub_prod_le_card_mul + {ι : Type*} + (s : Finset ι) (f g : ι → ℝ) {ε : ℝ} + (hε : 0 ≤ ε) + (hf0 : ∀ i ∈ s, 0 ≤ f i) + (hf1 : ∀ i ∈ s, f i ≤ 1) + (hg0 : ∀ i ∈ s, 0 ≤ g i) + (hg1 : ∀ i ∈ s, g i ≤ 1) + (hfg : ∀ i ∈ s, |f i - g i| ≤ ε) : + |(∏ i ∈ s, f i) - ∏ i ∈ s, g i| ≤ + (s.card : ℝ) * ε := by + classical + induction s using Finset.induction_on with + | empty => + simp + | @insert a s ha ih => + have hfa0 : 0 ≤ f a := hf0 a (Finset.mem_insert_self a s) + have hfa1 : f a ≤ 1 := hf1 a (Finset.mem_insert_self a s) + have hga0 : 0 ≤ g a := hg0 a (Finset.mem_insert_self a s) + have hga1 : g a ≤ 1 := hg1 a (Finset.mem_insert_self a s) + have hdiffa : + |f a - g a| ≤ ε := + hfg a (Finset.mem_insert_self a s) + have hfprod0 : 0 ≤ ∏ i ∈ s, f i := + Finset.prod_nonneg fun i hi => hf0 i (Finset.mem_insert_of_mem hi) + have hfprod1 : (∏ i ∈ s, f i) ≤ 1 := + Finset.prod_le_one₀ + (fun i hi => hf0 i (Finset.mem_insert_of_mem hi)) + (fun i hi => hf1 i (Finset.mem_insert_of_mem hi)) + have hgprod0 : 0 ≤ ∏ i ∈ s, g i := + Finset.prod_nonneg fun i hi => hg0 i (Finset.mem_insert_of_mem hi) + have hgprod1 : (∏ i ∈ s, g i) ≤ 1 := + Finset.prod_le_one₀ + (fun i hi => hg0 i (Finset.mem_insert_of_mem hi)) + (fun i hi => hg1 i (Finset.mem_insert_of_mem hi)) + have ih' : + |(∏ i ∈ s, f i) - ∏ i ∈ s, g i| ≤ + (s.card : ℝ) * ε := + ih + (fun i hi => hf0 i (Finset.mem_insert_of_mem hi)) + (fun i hi => hf1 i (Finset.mem_insert_of_mem hi)) + (fun i hi => hg0 i (Finset.mem_insert_of_mem hi)) + (fun i hi => hg1 i (Finset.mem_insert_of_mem hi)) + (fun i hi => hfg i (Finset.mem_insert_of_mem hi)) + have hfirst : + |f a - g a| * |∏ i ∈ s, f i| ≤ ε := by + calc + |f a - g a| * |∏ i ∈ s, f i| ≤ + ε * |∏ i ∈ s, f i| := + mul_le_mul_of_nonneg_right hdiffa (abs_nonneg _) + _ ≤ ε * 1 := + mul_le_mul_of_nonneg_left + (by simpa [abs_of_nonneg hfprod0] using hfprod1) hε + _ = ε := mul_one ε + have hsecond : + |g a| * + |(∏ i ∈ s, f i) - ∏ i ∈ s, g i| ≤ + (s.card : ℝ) * ε := by + calc + |g a| * + |(∏ i ∈ s, f i) - ∏ i ∈ s, g i| ≤ + 1 * + |(∏ i ∈ s, f i) - ∏ i ∈ s, g i| := + mul_le_mul_of_nonneg_right + (by simpa [abs_of_nonneg hga0] using hga1) + (abs_nonneg _) + _ ≤ 1 * ((s.card : ℝ) * ε) := + mul_le_mul_of_nonneg_left ih' zero_le_one + _ = (s.card : ℝ) * ε := one_mul _ + rw [Finset.prod_insert ha, Finset.prod_insert ha, + Finset.card_insert_of_notMem ha] + calc + |f a * (∏ i ∈ s, f i) - + g a * ∏ i ∈ s, g i| = + |(f a - g a) * (∏ i ∈ s, f i) + + g a * ((∏ i ∈ s, f i) - ∏ i ∈ s, g i)| := by + congr 1 + ring + _ ≤ + |f a - g a| * |∏ i ∈ s, f i| + + |g a| * + |(∏ i ∈ s, f i) - ∏ i ∈ s, g i| := by + simpa [abs_mul] using + abs_add_le + ((f a - g a) * (∏ i ∈ s, f i)) + (g a * ((∏ i ∈ s, f i) - ∏ i ∈ s, g i)) + _ ≤ ε + (s.card : ℝ) * ε := + add_le_add hfirst hsecond + _ = ((s.card + 1 : ℕ) : ℝ) * ε := by + push_cast + ring + +theorem simplexWeight_abs_sub_le + {k : ℕ} {V : Fin k → Type*} + (H G : WeightedSimplexSystem V) {ε : ℝ} + (hε : 0 ≤ ε) + (hH : EdgeWeightsInUnitInterval H) + (hG : EdgeWeightsInUnitInterval G) + (hHG : EdgeSupDistanceLe H G ε) + (x : (i : Fin k) → V i) : + |H.simplexWeight x - G.simplexWeight x| ≤ (k : ℝ) * ε := by + change + |(∏ j : Fin k, H.edgeWeight j (deleteCoordinate x j)) - + ∏ j : Fin k, G.edgeWeight j (deleteCoordinate x j)| ≤ + (k : ℝ) * ε + simpa using + abs_prod_sub_prod_le_card_mul Finset.univ + (fun j => H.edgeWeight j (deleteCoordinate x j)) + (fun j => G.edgeWeight j (deleteCoordinate x j)) + hε + (fun j _ => (hH j (deleteCoordinate x j)).1) + (fun j _ => (hH j (deleteCoordinate x j)).2) + (fun j _ => (hG j (deleteCoordinate x j)).1) + (fun j _ => (hG j (deleteCoordinate x j)).2) + (fun j _ => hHG j (deleteCoordinate x j)) + +theorem simplexCount_abs_sub_le + {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] [∀ i, Nonempty (V i)] + (H G : WeightedSimplexSystem V) {ε : ℝ} + (hε : 0 ≤ ε) + (hH : EdgeWeightsInUnitInterval H) + (hG : EdgeWeightsInUnitInterval G) + (hHG : EdgeSupDistanceLe H G ε) : + |H.simplexCount - G.simplexCount| ≤ (k : ℝ) * ε := by + rw [WeightedSimplexSystem.simplexCount, + WeightedSimplexSystem.simplexCount, ← mean_sub] + calc + |mean (fun x => H.simplexWeight x - G.simplexWeight x)| ≤ + mean (fun x => |H.simplexWeight x - G.simplexWeight x|) := by + exact Finset.abs_expect_le Finset.univ _ + _ ≤ mean (fun _ => (k : ℝ) * ε) := + mean_mono fun x => simplexWeight_abs_sub_le H G hε hH hG hHG x + _ = (k : ℝ) * ε := mean_const _ + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def orderedAPEdgeFactor + (k N : ℕ) (f g : ZMod N → ℝ) + (j i : Fin k) (x : Fin k → ZMod N) : ℝ := + (if i < j then + f (apSimplexForm k N i (deleteCoordinate x i)) + else 1) * + (if j < i then + g (apSimplexForm k N i (deleteCoordinate x i)) + else 1) + +@[simp] +theorem orderedAPEdgeFactor_self + (k N : ℕ) (f g : ZMod N → ℝ) + (j : Fin k) (x : Fin k → ZMod N) : + orderedAPEdgeFactor k N f g j j x = 1 := by + simp [orderedAPEdgeFactor] + +@[simp] +theorem deleteCoordinate_update_same + {k : ℕ} {G : Type*} + (x : Fin k → G) (i : Fin k) (a : G) : + deleteCoordinate (Function.update x i a) i = + deleteCoordinate x i := by + funext q + simp [deleteCoordinate, q.2] + +theorem insertNth_eraseCoordinate_eq_update + {n : ℕ} {G : Type*} + (i : Fin (n + 1)) (a : G) (x : Fin (n + 1) → G) : + Fin.insertNth i a (eraseCoordinate i x) = + Function.update x i a := by + exact Fin.insertNth_removeNth i a x + +theorem insertNth_insertNth_eraseCoordinate + {n : ℕ} {G : Type*} + (j : Fin (n + 2)) (t : Fin (n + 1)) + (a b : G) (y : Fin (n + 1) → G) : + Fin.insertNth j a + (Fin.insertNth t b (eraseCoordinate t y)) = + (Function.update (Fin.insertNth j a y) + (j.succAbove t) b : Fin (n + 2) → G) := by + rw [insertNth_eraseCoordinate_eq_update, Fin.insertNth_update] + +def apMixedCutTest + (n N : ℕ) (f g : ZMod N → ℝ) + (j : Fin (n + 2)) (a : ZMod N) : + CutTestFamily (ZMod N) (n + 1) := + fun t z => + orderedAPEdgeFactor (n + 2) N f g j (j.succAbove t) + (Fin.insertNth j a (Fin.insertNth t 0 z)) + +theorem apMixedCutTest_eraseCoordinate + (n N : ℕ) (f g : ZMod N → ℝ) + (j : Fin (n + 2)) (a : ZMod N) + (t : Fin (n + 1)) (y : Fin (n + 1) → ZMod N) : + apMixedCutTest n N f g j a t (eraseCoordinate t y) = + orderedAPEdgeFactor (n + 2) N f g j (j.succAbove t) + (Fin.insertNth j a y) := by + rw [apMixedCutTest, insertNth_insertNth_eraseCoordinate] + unfold orderedAPEdgeFactor + simp only [deleteCoordinate_update_same] + +theorem apMixedCutTest_bounded + (n N : ℕ) (f g : ZMod N → ℝ) + (hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) + (hg0 : ∀ x, 0 ≤ g x) (hg1 : ∀ x, g x ≤ 1) + (j : Fin (n + 2)) (a : ZMod N) : + IsBoundedCutTest (apMixedCutTest n N f g j a) := by + constructor + · intro t z + unfold apMixedCutTest orderedAPEdgeFactor + by_cases htj : j.succAbove t < j + · have hjt : ¬j < j.succAbove t := + not_lt_of_ge (le_of_lt htj) + simp [htj, hjt, hf0] + · by_cases hjt : j < j.succAbove t + · simp [htj, hjt, hg0] + · exact (Fin.succAbove_ne j t + (le_antisymm (not_lt.mp hjt) (not_lt.mp htj))).elim + · intro t z + unfold apMixedCutTest orderedAPEdgeFactor + by_cases htj : j.succAbove t < j + · have hjt : ¬j < j.succAbove t := + not_lt_of_ge (le_of_lt htj) + simpa [htj, hjt] using + hf1 (apSimplexForm (n + 2) N (j.succAbove t) + (deleteCoordinate + (Fin.insertNth j a (Fin.insertNth t 0 z)) + (j.succAbove t))) + · by_cases hjt : j < j.succAbove t + · simpa [htj, hjt] using + hg1 (apSimplexForm (n + 2) N (j.succAbove t) + (deleteCoordinate + (Fin.insertNth j a (Fin.insertNth t 0 z)) + (j.succAbove t))) + · exact (Fin.succAbove_ne j t + (le_antisymm (not_lt.mp hjt) (not_lt.mp htj))).elim + +theorem prod_orderedAPEdgeFactor + (k N : ℕ) (f g : ZMod N → ℝ) + (j : Fin k) (x : Fin k → ZMod N) : + (∏ i : Fin k, orderedAPEdgeFactor k N f g j i x) = + (∏ i ∈ (Finset.univ : Finset (Fin k)) with i < j, + f (apSimplexForm k N i (deleteCoordinate x i))) * + ∏ i ∈ (Finset.univ : Finset (Fin k)) with j < i, + g (apSimplexForm k N i (deleteCoordinate x i)) := by + rw [Finset.prod_filter, Finset.prod_filter, + ← Finset.prod_mul_distrib] + rfl + +theorem prod_apMixedCutTest_eraseCoordinate + (n N : ℕ) (f g : ZMod N → ℝ) + (j : Fin (n + 2)) (a : ZMod N) + (y : Fin (n + 1) → ZMod N) : + (∏ t : Fin (n + 1), + apMixedCutTest n N f g j a t + (eraseCoordinate t y)) = + (∏ i ∈ (Finset.univ : Finset (Fin (n + 2))) with i < j, + f (apSimplexForm (n + 2) N i + (deleteCoordinate (Fin.insertNth j a y) i))) * + ∏ i ∈ (Finset.univ : Finset (Fin (n + 2))) with j < i, + g (apSimplexForm (n + 2) N i + (deleteCoordinate (Fin.insertNth j a y) i)) := by + simp_rw [apMixedCutTest_eraseCoordinate] + calc + (∏ t : Fin (n + 1), + orderedAPEdgeFactor (n + 2) N f g j + (j.succAbove t) (Fin.insertNth j a y)) = + ∏ i : Fin (n + 2), + orderedAPEdgeFactor (n + 2) N f g j i + (Fin.insertNth j a y) := by + symm + calc + (∏ i : Fin (n + 2), + orderedAPEdgeFactor (n + 2) N f g j i + (Fin.insertNth j a y)) = + orderedAPEdgeFactor (n + 2) N f g j j + (Fin.insertNth j a y) * + ∏ t : Fin (n + 1), + orderedAPEdgeFactor (n + 2) N f g j + (j.succAbove t) (Fin.insertNth j a y) := + Fin.prod_univ_succAbove _ j + _ = ∏ t : Fin (n + 1), + orderedAPEdgeFactor (n + 2) N f g j + (j.succAbove t) (Fin.insertNth j a y) := by + rw [orderedAPEdgeFactor_self, one_mul] + _ = _ := prod_orderedAPEdgeFactor + (n + 2) N f g j (Fin.insertNth j a y) + +theorem apSimplexForm_deleteCoordinate_insertNth + (n N : ℕ) (j : Fin (n + 2)) + (a : ZMod N) (y : Fin (n + 1) → ZMod N) : + apSimplexForm (n + 2) N j + (deleteCoordinate (Fin.insertNth j a y) j) = + ∑ t : Fin (n + 1), + ((((j.succAbove t : ℤ) - (j : ℤ) : ℤ) : + ZMod N) * y t) := by + rw [apSimplexForm_deleteCoordinate_eq_weightedSum] + simp + +theorem mean_insertNth + {G : Type*} [Fintype G] (n : ℕ) + (j : Fin (n + 1)) (F : (Fin (n + 1) → G) → ℝ) : + mean F = + mean₂ (fun a : G => fun y : Fin n → G => + F (Fin.insertNth j a y)) := by + calc + mean F = + mean (fun p : G × (Fin n → G) => + F (Fin.insertNth j p.1 p.2)) := by + unfold mean + apply Fintype.expect_equiv + (Fin.insertNthEquiv (fun _ : Fin (n + 1) => G) j).symm + intro x + congr 1 + simp + _ = mean₂ (fun a : G => fun y : Fin n → G => + F (Fin.insertNth j a y)) := by + simpa [mean, mean₂] using + (Finset.expect_product + (Finset.univ : Finset G) + (Finset.univ : Finset (Fin n → G)) + (fun p : G × (Fin n → G) => + F (Fin.insertNth j p.1 p.2))) + +theorem mixedSimplexTerm_ap_insertNth + (n N : ℕ) (f g : ZMod N → ℝ) + (j : Fin (n + 2)) (a : ZMod N) + (y : Fin (n + 1) → ZMod N) : + mixedSimplexTerm + (apSimplexSystem (n + 2) N f) + (apSimplexSystem (n + 2) N g) j + (Fin.insertNth j a y) = + (f (∑ t : Fin (n + 1), + ((((j.succAbove t : ℤ) - (j : ℤ) : ℤ) : + ZMod N) * y t)) - + g (∑ t : Fin (n + 1), + ((((j.succAbove t : ℤ) - (j : ℤ) : ℤ) : + ZMod N) * y t))) * + ∏ t : Fin (n + 1), + apMixedCutTest n N f g j a t + (eraseCoordinate t y) := by + unfold mixedSimplexTerm + change + (f (apSimplexForm (n + 2) N j + (deleteCoordinate (Fin.insertNth j a y) j)) - + g (apSimplexForm (n + 2) N j + (deleteCoordinate (Fin.insertNth j a y) j))) * + (∏ i ∈ (Finset.univ : Finset (Fin (n + 2))) with i < j, + f (apSimplexForm (n + 2) N i + (deleteCoordinate (Fin.insertNth j a y) i))) * + (∏ i ∈ (Finset.univ : Finset (Fin (n + 2))) with j < i, + g (apSimplexForm (n + 2) N i + (deleteCoordinate (Fin.insertNth j a y) i))) = _ + rw [apSimplexForm_deleteCoordinate_insertNth, + prod_apMixedCutTest_eraseCoordinate] + ring + +theorem mixedSimplexCorrelation_ap_eq_mean_linearCutCorrelation + (n N : ℕ) [NeZero N] + (hN : Nat.Coprime N (Nat.factorial (n + 1))) + (f g : ZMod N → ℝ) (j : Fin (n + 2)) : + mixedSimplexCorrelation + (apSimplexSystem (n + 2) N f) + (apSimplexSystem (n + 2) N g) j = + mean (fun a : ZMod N => + linearCutCorrelation (n + 1) + (apFaceScalingEquiv hN j) f g + (apMixedCutTest n N f g j a)) := by + unfold mixedSimplexCorrelation + rw [mean_insertNth (n + 1) j] + unfold mean₂ + apply congrArg mean + funext a + unfold linearCutCorrelation + apply congrArg mean + funext y + change + mixedSimplexTerm + (apSimplexSystem (n + 2) N f) + (apSimplexSystem (n + 2) N g) j + (Fin.insertNth j a y) = + (f (∑ i, apFaceScalingEquiv hN j i (y i)) - + g (∑ i, apFaceScalingEquiv hN j i (y i))) * + ∏ i, apMixedCutTest n N f g j a i + (eraseCoordinate i y) + rw [mixedSimplexTerm_ap_insertNth] + simp only [apFaceScalingEquiv_apply] + +theorem abs_mixedSimplexCorrelation_ap_le + (n N : ℕ) [NeZero N] + (hN : Nat.Coprime N (Nat.factorial (n + 1))) + (f g : ZMod N → ℝ) + (hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) + (hg0 : ∀ x, 0 ≤ g x) (hg1 : ∀ x, g x ≤ 1) + {ε : ℝ} (hcut : CutDiscrepancyLe (n + 1) f g ε) + (j : Fin (n + 2)) : + |mixedSimplexCorrelation + (apSimplexSystem (n + 2) N f) + (apSimplexSystem (n + 2) N g) j| ≤ ε := by + rw [mixedSimplexCorrelation_ap_eq_mean_linearCutCorrelation + n N hN f g j] + calc + |mean (fun a : ZMod N => + linearCutCorrelation (n + 1) + (apFaceScalingEquiv hN j) f g + (apMixedCutTest n N f g j a))| ≤ + mean (fun a : ZMod N => + |linearCutCorrelation (n + 1) + (apFaceScalingEquiv hN j) f g + (apMixedCutTest n N f g j a)|) := by + exact Finset.abs_expect_le Finset.univ _ + _ ≤ mean (fun _a : ZMod N => ε) := by + apply mean_mono + intro a + exact hcut.abs_linearCutCorrelation_le + (apFaceScalingEquiv hN j) + (apMixedCutTest n N f g j a) + (apMixedCutTest_bounded n N f g + hf0 hf1 hg0 hg1 j a) + _ = ε := mean_const _ + +theorem apSimplexSystem_mixedCorrelationLe + (n N : ℕ) [NeZero N] + (hN : Nat.Coprime N (Nat.factorial (n + 1))) + (f g : ZMod N → ℝ) + (hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) + (hg0 : ∀ x, 0 ≤ g x) (hg1 : ∀ x, g x ≤ 1) + {ε : ℝ} (hcut : CutDiscrepancyLe (n + 1) f g ε) : + MixedSimplexCorrelationLe + (apSimplexSystem (n + 2) N f) + (apSimplexSystem (n + 2) N g) ε := by + intro j + exact abs_mixedSimplexCorrelation_ap_le + n N hN f g hf0 hf1 hg0 hg1 hcut j + +theorem cyclicAPCount_abs_sub_le_of_cutDiscrepancy + (n N : ℕ) [NeZero N] + (hN : Nat.Coprime N (Nat.factorial (n + 1))) + (f g : ZMod N → ℝ) + (hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) + (hg0 : ∀ x, 0 ≤ g x) (hg1 : ∀ x, g x ≤ 1) + {ε : ℝ} (hcut : CutDiscrepancyLe (n + 1) f g ε) : + |cyclicAPCount (n + 2) N f - + cyclicAPCount (n + 2) N g| ≤ + ((n + 2 : ℕ) : ℝ) * ε := by + rw [← apSimplexSystem_simplexCount_eq_cyclicAPCount n N f, + ← apSimplexSystem_simplexCount_eq_cyclicAPCount n N g] + exact simplexCount_abs_sub_le_of_mixedCorrelation + (apSimplexSystem (n + 2) N f) + (apSimplexSystem (n + 2) N g) + (apSimplexSystem_mixedCorrelationLe + n N hN f g hf0 hf1 hg0 hg1 hcut) + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def deletedFaceTuple + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (x : DeletedVector (fun _ : Fin (n + 1) => G) j) : + Fin n → G := + fun t => x (finSuccAboveEquiv j t) + +@[simp] +theorem deletedFaceTuple_finTupleToDeletedVector + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (y : Fin n → G) : + deletedFaceTuple j (finTupleToDeletedVector j y) = y := by + funext t + simp [deletedFaceTuple] + +@[simp] +theorem finTupleToDeletedVector_deletedFaceTuple + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (x : DeletedVector (fun _ : Fin (n + 1) => G) j) : + finTupleToDeletedVector j (deletedFaceTuple j x) = x := by + funext i + change + x (finSuccAboveEquiv j + ((finSuccAboveEquiv j).symm i)) = x i + rw [(finSuccAboveEquiv j).apply_symm_apply] + +@[simp] +theorem deletedFaceTuple_deleteCoordinate + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (x : Fin (n + 1) → G) (t : Fin n) : + deletedFaceTuple j (deleteCoordinate x j) t = + x (j.succAbove t) := + rfl + +noncomputable def canonicalEdgeFunction + {G : Type*} {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (j : Fin (n + 1)) : + (Fin n → G) → ℝ := + fun y => H.edgeWeight j (finTupleToDeletedVector j y) + +abbrev SimplexRegularitySystem + (G : Type*) (n : ℕ) + [Fintype G] [DecidableEq G] := + (j : Fin (n + 1)) → + FaceRegularityState (Fin n → G) + +noncomputable def regularizedSimplexSystem + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) : + WeightedSimplexSystem (fun _ : Fin (n + 1) => G) where + edgeWeight j x := + (S j).structured (canonicalEdgeFunction H j) + (deletedFaceTuple j x) + +@[simp] +theorem regularizedSimplexSystem_edge_finTuple + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) + (j : Fin (n + 1)) (y : Fin n → G) : + (regularizedSimplexSystem H S).edgeWeight j + (finTupleToDeletedVector j y) = + (S j).structured (canonicalEdgeFunction H j) y := by + simp [regularizedSimplexSystem] + +theorem canonicalEdgeFunction_nonneg + {G : Type*} {n : ℕ} + {H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)} + (hH : EdgeWeightsInUnitInterval H) + (j : Fin (n + 1)) (y : Fin n → G) : + 0 ≤ canonicalEdgeFunction H j y := + (hH j (finTupleToDeletedVector j y)).1 + +theorem canonicalEdgeFunction_le_one + {G : Type*} {n : ℕ} + {H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)} + (hH : EdgeWeightsInUnitInterval H) + (j : Fin (n + 1)) (y : Fin n → G) : + canonicalEdgeFunction H j y ≤ 1 := + (hH j (finTupleToDeletedVector j y)).2 + +theorem regularizedSimplexSystem_unitInterval + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + {H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)} + (hH : EdgeWeightsInUnitInterval H) + (S : SimplexRegularitySystem G n) : + EdgeWeightsInUnitInterval (regularizedSimplexSystem H S) := by + intro j x + constructor + · exact + (S j).structured_nonneg + (canonicalEdgeFunction_nonneg hH j) + (deletedFaceTuple j x) + · exact + (S j).structured_le_one + (canonicalEdgeFunction_le_one hH j) + (deletedFaceTuple j x) + +def orderedSimplexEdgeFactor + {G : Type*} {k : ℕ} + (H K : WeightedSimplexSystem + (fun _ : Fin k => G)) + (j i : Fin k) (x : Fin k → G) : ℝ := + (if i < j then H.edgeWeight i (deleteCoordinate x i) else 1) * + (if j < i then K.edgeWeight i (deleteCoordinate x i) else 1) + +@[simp] +theorem orderedSimplexEdgeFactor_self + {G : Type*} {k : ℕ} + (H K : WeightedSimplexSystem + (fun _ : Fin k => G)) + (j : Fin k) (x : Fin k → G) : + orderedSimplexEdgeFactor H K j j x = 1 := by + simp [orderedSimplexEdgeFactor] + +def insertErasedCoordinate + {G : Type*} {n : ℕ} (t : Fin n) (a : G) + (z : Fin (n - 1) → G) : + Fin n → G := by + cases n with + | zero => exact Fin.elim0 t + | succ m => exact Fin.insertNth t a z + +@[simp] +theorem insertErasedCoordinate_eraseCoordinate + {G : Type*} {n : ℕ} + (t : Fin n) (a : G) (y : Fin n → G) : + insertErasedCoordinate t a (eraseCoordinate t y) = + Function.update y t a := by + cases n with + | zero => exact Fin.elim0 t + | succ m => + exact insertNth_eraseCoordinate_eq_update t a y + +def simplexMixedCutTest + {G : Type*} {n : ℕ} + (H K : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (j : Fin (n + 1)) (a : G) : + CutTestFamily G n := + fun t z => + orderedSimplexEdgeFactor H K j (j.succAbove t) + (Fin.insertNth j a (insertErasedCoordinate t a z)) + +theorem simplexMixedCutTest_eraseCoordinate + {G : Type*} {n : ℕ} + (H K : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (j : Fin (n + 1)) (a : G) + (t : Fin n) (y : Fin n → G) : + simplexMixedCutTest H K j a t (eraseCoordinate t y) = + orderedSimplexEdgeFactor H K j (j.succAbove t) + (Fin.insertNth j a y) := by + rw [simplexMixedCutTest, + insertErasedCoordinate_eraseCoordinate, + Fin.insertNth_update] + unfold orderedSimplexEdgeFactor + simp only [deleteCoordinate_update_same] + +theorem simplexMixedCutTest_bounded + {G : Type*} {n : ℕ} + (H K : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (hH : EdgeWeightsInUnitInterval H) + (hK : EdgeWeightsInUnitInterval K) + (j : Fin (n + 1)) (a : G) : + IsBoundedCutTest (simplexMixedCutTest H K j a) := by + constructor + · intro t z + unfold simplexMixedCutTest orderedSimplexEdgeFactor + by_cases htj : j.succAbove t < j + · have hjt : ¬j < j.succAbove t := + not_lt_of_ge (le_of_lt htj) + simp [htj, hjt, (hH _ _).1] + · by_cases hjt : j < j.succAbove t + · simp [htj, hjt, (hK _ _).1] + · exact + (Fin.succAbove_ne j t + (le_antisymm (not_lt.mp hjt) + (not_lt.mp htj))).elim + · intro t z + unfold simplexMixedCutTest orderedSimplexEdgeFactor + by_cases htj : j.succAbove t < j + · have hjt : ¬j < j.succAbove t := + not_lt_of_ge (le_of_lt htj) + simpa [htj, hjt] using + (hH (j.succAbove t) + (deleteCoordinate + (Fin.insertNth j a (insertErasedCoordinate t a z)) + (j.succAbove t))).2 + · by_cases hjt : j < j.succAbove t + · simpa [htj, hjt] using + (hK (j.succAbove t) + (deleteCoordinate + (Fin.insertNth j a (insertErasedCoordinate t a z)) + (j.succAbove t))).2 + · exact + (Fin.succAbove_ne j t + (le_antisymm (not_lt.mp hjt) + (not_lt.mp htj))).elim + +theorem prod_orderedSimplexEdgeFactor + {G : Type*} {k : ℕ} + (H K : WeightedSimplexSystem + (fun _ : Fin k => G)) + (j : Fin k) (x : Fin k → G) : + (∏ i : Fin k, orderedSimplexEdgeFactor H K j i x) = + (∏ i ∈ (Finset.univ : Finset (Fin k)) with i < j, + H.edgeWeight i (deleteCoordinate x i)) * + ∏ i ∈ (Finset.univ : Finset (Fin k)) with j < i, + K.edgeWeight i (deleteCoordinate x i) := by + rw [Finset.prod_filter, Finset.prod_filter, + ← Finset.prod_mul_distrib] + rfl + +theorem prod_simplexMixedCutTest_eraseCoordinate + {G : Type*} {n : ℕ} + (H K : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (j : Fin (n + 1)) (a : G) + (y : Fin n → G) : + (∏ t : Fin n, + simplexMixedCutTest H K j a t + (eraseCoordinate t y)) = + (∏ i ∈ (Finset.univ : Finset (Fin (n + 1))) with i < j, + H.edgeWeight i + (deleteCoordinate (Fin.insertNth j a y) i)) * + ∏ i ∈ (Finset.univ : Finset (Fin (n + 1))) with j < i, + K.edgeWeight i + (deleteCoordinate (Fin.insertNth j a y) i) := by + simp_rw [simplexMixedCutTest_eraseCoordinate] + calc + (∏ t : Fin n, + orderedSimplexEdgeFactor H K j (j.succAbove t) + (Fin.insertNth j a y)) = + ∏ i : Fin (n + 1), + orderedSimplexEdgeFactor H K j i + (Fin.insertNth j a y) := by + symm + calc + (∏ i : Fin (n + 1), + orderedSimplexEdgeFactor H K j i + (Fin.insertNth j a y)) = + orderedSimplexEdgeFactor H K j j + (Fin.insertNth j a y) * + ∏ t : Fin n, + orderedSimplexEdgeFactor H K j + (j.succAbove t) (Fin.insertNth j a y) := + Fin.prod_univ_succAbove _ j + _ = + ∏ t : Fin n, + orderedSimplexEdgeFactor H K j + (j.succAbove t) (Fin.insertNth j a y) := by + rw [orderedSimplexEdgeFactor_self, one_mul] + _ = _ := + prod_orderedSimplexEdgeFactor H K j + (Fin.insertNth j a y) + +theorem mixedSimplexTerm_regularized_insertNth + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) + (j : Fin (n + 1)) (a : G) (y : Fin n → G) : + mixedSimplexTerm H (regularizedSimplexSystem H S) j + (Fin.insertNth j a y) = + (S j).residual (canonicalEdgeFunction H j) y * + cutTestProduct + (simplexMixedCutTest H + (regularizedSimplexSystem H S) j a) y := by + have hHj : + H.edgeWeight j + (deleteCoordinate (Fin.insertNth j a y) j) = + canonicalEdgeFunction H j y := by + simp [canonicalEdgeFunction, + deleteCoordinate_eq_finTupleToDeletedVector] + have hKj : + (regularizedSimplexSystem H S).edgeWeight j + (deleteCoordinate (Fin.insertNth j a y) j) = + (S j).structured (canonicalEdgeFunction H j) y := by + simp [regularizedSimplexSystem, + deleteCoordinate_eq_finTupleToDeletedVector] + unfold mixedSimplexTerm FaceRegularityState.residual + rw [hHj, hKj] + rw [show + cutTestProduct + (simplexMixedCutTest H + (regularizedSimplexSystem H S) j a) y = + (∏ i ∈ (Finset.univ : Finset (Fin (n + 1))) with i < j, + H.edgeWeight i + (deleteCoordinate (Fin.insertNth j a y) i)) * + ∏ i ∈ (Finset.univ : Finset (Fin (n + 1))) with j < i, + (regularizedSimplexSystem H S).edgeWeight i + (deleteCoordinate (Fin.insertNth j a y) i) by + exact prod_simplexMixedCutTest_eraseCoordinate + H (regularizedSimplexSystem H S) j a y] + ring + +theorem mixedSimplexCorrelation_regularized_eq_mean + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) + (j : Fin (n + 1)) : + mixedSimplexCorrelation H (regularizedSimplexSystem H S) j = + mean (fun a : G => + (S j).faceCutCorrelation + (canonicalEdgeFunction H j) + (simplexMixedCutTest H + (regularizedSimplexSystem H S) j a)) := by + unfold mixedSimplexCorrelation + rw [mean_insertNth n j] + unfold mean₂ + apply congrArg mean + funext a + unfold FaceRegularityState.faceCutCorrelation + apply congrArg mean + funext y + exact mixedSimplexTerm_regularized_insertNth H S j a y + +theorem abs_mixedSimplexCorrelation_regularized_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (hH : EdgeWeightsInUnitInterval H) + (S : SimplexRegularitySystem G n) + {ε : ℝ} + (hregular : + ∀ j, (S j).IsFaceCutRegular + (canonicalEdgeFunction H j) ε) + (j : Fin (n + 1)) : + |mixedSimplexCorrelation H + (regularizedSimplexSystem H S) j| ≤ ε := by + rw [mixedSimplexCorrelation_regularized_eq_mean] + let K := regularizedSimplexSystem H S + have hK : EdgeWeightsInUnitInterval K := + regularizedSimplexSystem_unitInterval hH S + calc + |mean (fun a : G => + (S j).faceCutCorrelation + (canonicalEdgeFunction H j) + (simplexMixedCutTest H K j a))| ≤ + mean (fun a : G => + |(S j).faceCutCorrelation + (canonicalEdgeFunction H j) + (simplexMixedCutTest H K j a)|) := + Finset.abs_expect_le Finset.univ _ + _ ≤ mean (fun _a : G => ε) := by + apply mean_mono + intro a + exact hregular j + (simplexMixedCutTest H K j a) + (simplexMixedCutTest_bounded H K hH hK j a) + _ = ε := mean_const _ + +theorem regularizedSimplexSystem_mixedCorrelationLe + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (hH : EdgeWeightsInUnitInterval H) + (S : SimplexRegularitySystem G n) + {ε : ℝ} + (hregular : + ∀ j, (S j).IsFaceCutRegular + (canonicalEdgeFunction H j) ε) : + MixedSimplexCorrelationLe H + (regularizedSimplexSystem H S) ε := by + intro j + exact abs_mixedSimplexCorrelation_regularized_le + H hH S hregular j + +theorem simplexCount_abs_sub_regularized_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (hH : EdgeWeightsInUnitInterval H) + (S : SimplexRegularitySystem G n) + {ε : ℝ} + (hregular : + ∀ j, (S j).IsFaceCutRegular + (canonicalEdgeFunction H j) ε) : + |H.simplexCount - + (regularizedSimplexSystem H S).simplexCount| ≤ + ((n + 1 : ℕ) : ℝ) * ε := + simplexCount_abs_sub_le_of_mixedCorrelation + H (regularizedSimplexSystem H S) + (regularizedSimplexSystem_mixedCorrelationLe + H hH S hregular) + +theorem exists_regularizedSimplexSystem_count_close + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {n : ℕ} + (H : WeightedSimplexSystem + (fun _ : Fin (n + 1) => G)) + (hH : EdgeWeightsInUnitInterval H) + (S₀ : SimplexRegularitySystem G n) + {ε : ℝ} (hε : 0 < ε) : + ∃ S : SimplexRegularitySystem G n, + (∀ j, (S j).partition ≤ (S₀ j).partition) ∧ + (∀ j, (S j).IsFaceCutRegular + (canonicalEdgeFunction H j) ε) ∧ + |H.simplexCount - + (regularizedSimplexSystem H S).simplexCount| ≤ + ((n + 1 : ℕ) : ℝ) * ε ∧ + ∀ j, ∃ m i : ℕ, + 1 < (m : ℝ) * ε ^ 2 ∧ + i < m ∧ + FacePartition.complexity (S j).partition ≤ + 2 ^ i * + FacePartition.complexity (S₀ j).partition := by + classical + have hj (j : Fin (n + 1)) : + ∃ T : FaceRegularityState (Fin n → G), + T.partition ≤ (S₀ j).partition ∧ + T.IsFaceCutRegular (canonicalEdgeFunction H j) ε ∧ + ∃ m i : ℕ, + 1 < (m : ℝ) * ε ^ 2 ∧ + i < m ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * + FacePartition.complexity (S₀ j).partition := by + obtain ⟨m, i, T, hlong, hi, hTS, hregular, hcomplexity⟩ := + (S₀ j).exists_faceCutRegular_refinement + (canonicalEdgeFunction H j) + (canonicalEdgeFunction_nonneg hH j) + (canonicalEdgeFunction_le_one hH j) hε + exact + ⟨T, hTS, hregular, m, i, + hlong, hi, hcomplexity⟩ + choose S hS using hj + refine + ⟨S, fun j => (hS j).1, fun j => (hS j).2.1, + ?_, fun j => (hS j).2.2⟩ + exact simplexCount_abs_sub_regularized_le + H hH S (fun j => (hS j).2.1) + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable local instance orderedFaceLinearOrder + (k r : ℕ) : LinearOrder (OrderedFace k r) := by + classical + exact (Fintype.equivFin (OrderedFace k r)).linearOrder + +abbrev OrderedRegularitySystem + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) := + (e : OrderedFace k r) → + FaceRegularityState (Fin r → G) + +noncomputable def regularizedOrderedPattern + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (S : OrderedRegularitySystem G k r) : + WeightedOrderedPattern G k r where + edgeWeight e := + (S e).structured (H.edgeWeight e) + +@[simp] +theorem regularizedOrderedPattern_edgeWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (S : OrderedRegularitySystem G k r) + (e : OrderedFace k r) (y : Fin r → G) : + (regularizedOrderedPattern H S).edgeWeight e y = + (S e).structured (H.edgeWeight e) y := + rfl + +theorem regularizedOrderedPattern_unitInterval + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {H : WeightedOrderedPattern G k r} + (hH : H.EdgeWeightsInUnitInterval) + (S : OrderedRegularitySystem G k r) : + (regularizedOrderedPattern H S).EdgeWeightsInUnitInterval := by + intro e y + exact + ⟨(S e).structured_nonneg + (fun z => (hH e z).1) y, + (S e).structured_le_one + (fun z => (hH e z).2) y⟩ + +theorem orderedFaceTuple_split_update_eq + {G : Type*} {k r : ℕ} + (e f : OrderedFace k r) (i : Fin r) + (hmissing : e i ∉ Set.range f) + (a : G) (y : Fin r → G) + (z : OrderedFaceComplement e → G) : + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm + (Function.update y i a, z)) = + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm (y, z)) := by + funext t + by_cases hfe : f t ∈ Set.range e + · obtain ⟨q, hq⟩ := hfe + have hqi : q ≠ i := by + intro h + apply hmissing + exact ⟨t, (h ▸ hq).symm⟩ + have hleft := + congrFun + (orderedFaceTuple_splitOrderedFaceEquiv_symm + e (Function.update y i a) z) q + have hright := + congrFun + (orderedFaceTuple_splitOrderedFaceEquiv_symm + e y z) q + change + ((splitOrderedFaceEquiv e).symm + (Function.update y i a, z)) (e q) = + Function.update y i a q at hleft + change + ((splitOrderedFaceEquiv e).symm (y, z)) (e q) = + y q at hright + change + ((splitOrderedFaceEquiv e).symm + (Function.update y i a, z)) (f t) = + ((splitOrderedFaceEquiv e).symm (y, z)) (f t) + rw [← hq] + rw [hleft, hright] + simp [hqi] + · let v : OrderedFaceComplement e := ⟨f t, hfe⟩ + have hleft := + congrFun + (orderedFaceComplementTuple_splitOrderedFaceEquiv_symm + e (Function.update y i a) z) v + have hright := + congrFun + (orderedFaceComplementTuple_splitOrderedFaceEquiv_symm + e y z) v + exact hleft.trans hright.symm + +theorem orderedFaceTuple_split_insertErased_eq + {G : Type*} {k r : ℕ} + (e f : OrderedFace k r) (i : Fin r) + (hmissing : e i ∉ Set.range f) + (a : G) (y : Fin r → G) + (z : OrderedFaceComplement e → G) : + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm + (insertErasedCoordinate i a + (eraseCoordinate i y), z)) = + orderedFaceTuple f + ((splitOrderedFaceEquiv e).symm (y, z)) := by + rw [insertErasedCoordinate_eraseCoordinate] + exact orderedFaceTuple_split_update_eq + e f i hmissing a y z + +noncomputable def orderedPatternEdgeFactor + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (e f : OrderedFace k r) (x : Fin k → G) : ℝ := + (if f < e then + H.edgeWeight f (orderedFaceTuple f x) + else 1) * + (if e < f then + K.edgeWeight f (orderedFaceTuple f x) + else 1) + +@[simp] +theorem orderedPatternEdgeFactor_self + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (e : OrderedFace k r) (x : Fin k → G) : + orderedPatternEdgeFactor H K e e x = 1 := by + simp [orderedPatternEdgeFactor] + +theorem prod_orderedPatternEdgeFactor + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (e : OrderedFace k r) (x : Fin k → G) : + (∏ f : OrderedFace k r, + orderedPatternEdgeFactor H K e f x) = + (∏ f ∈ (Finset.univ : Finset (OrderedFace k r)) + with f < e, + H.edgeWeight f (orderedFaceTuple f x)) * + ∏ f ∈ (Finset.univ : Finset (OrderedFace k r)) + with e < f, + K.edgeWeight f (orderedFaceTuple f x) := by + rw [Finset.prod_filter, Finset.prod_filter, + ← Finset.prod_mul_distrib] + rfl + +theorem orderedPatternEdgeFactor_split_insertErased_eq + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (e f : OrderedFace k r) (i : Fin r) + (hmissing : e i ∉ Set.range f) + (a : G) (y : Fin r → G) + (z : OrderedFaceComplement e → G) : + orderedPatternEdgeFactor H K e f + ((splitOrderedFaceEquiv e).symm + (insertErasedCoordinate i a + (eraseCoordinate i y), z)) = + orderedPatternEdgeFactor H K e f + ((splitOrderedFaceEquiv e).symm (y, z)) := by + unfold orderedPatternEdgeFactor + rw [orderedFaceTuple_split_insertErased_eq + e f i hmissing a y z] + +theorem orderedPatternEdgeFactor_nonneg + {G : Type*} {k r : ℕ} + {H K : WeightedOrderedPattern G k r} + (hH : H.EdgeWeightsInUnitInterval) + (hK : K.EdgeWeightsInUnitInterval) + (e f : OrderedFace k r) (x : Fin k → G) : + 0 ≤ orderedPatternEdgeFactor H K e f x := by + by_cases hfe : f < e + · have hef : ¬e < f := + not_lt_of_ge (le_of_lt hfe) + simpa [orderedPatternEdgeFactor, hfe, hef] using + (hH f (orderedFaceTuple f x)).1 + · by_cases hef : e < f + · simpa [orderedPatternEdgeFactor, hfe, hef] using + (hK f (orderedFaceTuple f x)).1 + · simp [orderedPatternEdgeFactor, hfe, hef] + +theorem orderedPatternEdgeFactor_le_one + {G : Type*} {k r : ℕ} + {H K : WeightedOrderedPattern G k r} + (hH : H.EdgeWeightsInUnitInterval) + (hK : K.EdgeWeightsInUnitInterval) + (e f : OrderedFace k r) (x : Fin k → G) : + orderedPatternEdgeFactor H K e f x ≤ 1 := by + by_cases hfe : f < e + · have hef : ¬e < f := + not_lt_of_ge (le_of_lt hfe) + simpa [orderedPatternEdgeFactor, hfe, hef] using + (hH f (orderedFaceTuple f x)).2 + · by_cases hef : e < f + · simpa [orderedPatternEdgeFactor, hfe, hef] using + (hK f (orderedFaceTuple f x)).2 + · simp [orderedPatternEdgeFactor, hfe, hef] + +noncomputable def orderedPatternMixedCutTest + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (e : OrderedFace k r) (a : G) + (z : OrderedFaceComplement e → G) : + CutTestFamily G r := + fun i y => + ∏ f : OrderedFace k r, + if hfe : f = e then 1 + else if + orderedFaceMissingCoordinate e f + (Ne.symm hfe) = i + then + orderedPatternEdgeFactor H K e f + ((splitOrderedFaceEquiv e).symm + (insertErasedCoordinate i a y, z)) + else 1 + +theorem orderedPatternMixedCutTest_bounded + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (hH : H.EdgeWeightsInUnitInterval) + (hK : K.EdgeWeightsInUnitInterval) + (e : OrderedFace k r) (a : G) + (z : OrderedFaceComplement e → G) : + IsBoundedCutTest + (orderedPatternMixedCutTest H K e a z) := by + constructor + · intro i y + unfold orderedPatternMixedCutTest + apply Finset.prod_nonneg + intro f _hf + split_ifs + · positivity + · exact orderedPatternEdgeFactor_nonneg + hH hK e f _ + · positivity + · intro i y + unfold orderedPatternMixedCutTest + apply Finset.prod_le_one₀ + · intro f _hf + split_ifs + · positivity + · exact orderedPatternEdgeFactor_nonneg + hH hK e f _ + · positivity + · intro f _hf + split_ifs + · exact le_rfl + · exact orderedPatternEdgeFactor_le_one + hH hK e f _ + · exact le_rfl + +theorem cutTestProduct_orderedPatternMixedCutTest + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (e : OrderedFace k r) (a : G) + (y : Fin r → G) + (z : OrderedFaceComplement e → G) : + cutTestProduct + (orderedPatternMixedCutTest H K e a z) y = + ∏ f : OrderedFace k r, + orderedPatternEdgeFactor H K e f + ((splitOrderedFaceEquiv e).symm (y, z)) := by + classical + unfold cutTestProduct orderedPatternMixedCutTest + rw [Finset.prod_comm] + apply Fintype.prod_congr + intro f + by_cases hfe : f = e + · subst f + simp + · let i := + orderedFaceMissingCoordinate e f (Ne.symm hfe) + have hmissing : + e i ∉ Set.range f := by + exact orderedFaceMissingCoordinate_not_mem_range + e f (Ne.symm hfe) + calc + (∏ j : Fin r, + if hfe' : f = e then 1 + else if + orderedFaceMissingCoordinate e f + (Ne.symm hfe') = j + then + orderedPatternEdgeFactor H K e f + ((splitOrderedFaceEquiv e).symm + (insertErasedCoordinate j a + (eraseCoordinate j y), z)) + else 1) = + (if hfe' : f = e then 1 + else if + orderedFaceMissingCoordinate e f + (Ne.symm hfe') = i + then + orderedPatternEdgeFactor H K e f + ((splitOrderedFaceEquiv e).symm + (insertErasedCoordinate i a + (eraseCoordinate i y), z)) + else 1) := by + apply Fintype.prod_eq_single i + intro j hji + have hne : + orderedFaceMissingCoordinate e f + (Ne.symm hfe) ≠ j := by + intro h + exact hji h.symm + simp [hfe, hne] + _ = + orderedPatternEdgeFactor H K e f + ((splitOrderedFaceEquiv e).symm + (insertErasedCoordinate i a + (eraseCoordinate i y), z)) := by + simp [hfe, i] + _ = + orderedPatternEdgeFactor H K e f + ((splitOrderedFaceEquiv e).symm (y, z)) := + orderedPatternEdgeFactor_split_insertErased_eq + H K e f i hmissing a y z + +noncomputable def mixedOrderedPatternTerm + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (e : OrderedFace k r) (x : Fin k → G) : ℝ := + (H.edgeWeight e (orderedFaceTuple e x) - + K.edgeWeight e (orderedFaceTuple e x)) * + (∏ f ∈ (Finset.univ : Finset (OrderedFace k r)) + with f < e, + H.edgeWeight f (orderedFaceTuple f x)) * + ∏ f ∈ (Finset.univ : Finset (OrderedFace k r)) + with e < f, + K.edgeWeight f (orderedFaceTuple f x) + +theorem patternWeight_sub_eq_sum_mixedOrderedPatternTerm + {G : Type*} {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (x : Fin k → G) : + H.patternWeight x - K.patternWeight x = + ∑ e : OrderedFace k r, + mixedOrderedPatternTerm H K e x := by + unfold WeightedOrderedPattern.patternWeight + simpa [mixedOrderedPatternTerm] using + prod_sub_prod_eq_sum_ordered + (Finset.univ : Finset (OrderedFace k r)) + (fun e => H.edgeWeight e (orderedFaceTuple e x)) + (fun e => K.edgeWeight e (orderedFaceTuple e x)) + +noncomputable def mixedOrderedPatternCorrelation + {G : Type*} [Fintype G] {k r : ℕ} + (H K : WeightedOrderedPattern G k r) + (e : OrderedFace k r) : ℝ := + mean (mixedOrderedPatternTerm H K e) + +theorem patternCount_sub_eq_sum_mixedOrderedPatternCorrelation + {G : Type*} [Fintype G] {k r : ℕ} + (H K : WeightedOrderedPattern G k r) : + H.patternCount - K.patternCount = + ∑ e : OrderedFace k r, + mixedOrderedPatternCorrelation H K e := by + rw [WeightedOrderedPattern.patternCount, + WeightedOrderedPattern.patternCount, ← mean_sub] + calc + mean (fun x => H.patternWeight x - K.patternWeight x) = + mean (fun x => + ∑ e : OrderedFace k r, + mixedOrderedPatternTerm H K e x) := by + apply congrArg mean + funext x + exact + patternWeight_sub_eq_sum_mixedOrderedPatternTerm + H K x + _ = + ∑ e : OrderedFace k r, + mean (mixedOrderedPatternTerm H K e) := + mean_finset_sum Finset.univ + (fun e => mixedOrderedPatternTerm H K e) + _ = _ := by + rfl + +theorem abs_patternCount_sub_le_sum_mixedOrderedPatternCorrelation + {G : Type*} [Fintype G] {k r : ℕ} + (H K : WeightedOrderedPattern G k r) : + |H.patternCount - K.patternCount| ≤ + ∑ e : OrderedFace k r, + |mixedOrderedPatternCorrelation H K e| := by + rw [patternCount_sub_eq_sum_mixedOrderedPatternCorrelation] + exact Finset.abs_sum_le_sum_abs _ _ + +theorem mixedOrderedPatternTerm_regularized_split + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (S : OrderedRegularitySystem G k r) + (e : OrderedFace k r) (a : G) + (y : Fin r → G) + (z : OrderedFaceComplement e → G) : + mixedOrderedPatternTerm H + (regularizedOrderedPattern H S) e + ((splitOrderedFaceEquiv e).symm (y, z)) = + (S e).residual (H.edgeWeight e) y * + cutTestProduct + (orderedPatternMixedCutTest H + (regularizedOrderedPattern H S) e a z) y := by + have hprod := + prod_orderedPatternEdgeFactor + H (regularizedOrderedPattern H S) e + ((splitOrderedFaceEquiv e).symm (y, z)) + have hcut := + cutTestProduct_orderedPatternMixedCutTest + H (regularizedOrderedPattern H S) e a y z + simp only [regularizedOrderedPattern_edgeWeight] at hprod + unfold mixedOrderedPatternTerm FaceRegularityState.residual + simp only [ + orderedFaceTuple_splitOrderedFaceEquiv_symm, + regularizedOrderedPattern_edgeWeight] + rw [mul_assoc, ← hprod, ← hcut] + +theorem mixedOrderedPatternCorrelation_regularized_eq_mean + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (S : OrderedRegularitySystem G k r) + (e : OrderedFace k r) : + mixedOrderedPatternCorrelation H + (regularizedOrderedPattern H S) e = + mean (fun z : OrderedFaceComplement e → G => + (S e).faceCutCorrelation + (H.edgeWeight e) + (orderedPatternMixedCutTest H + (regularizedOrderedPattern H S) e + (Classical.choice inferInstance) z)) := by + unfold mixedOrderedPatternCorrelation + rw [mean_splitOrderedFace e] + rw [mean₂_comm] + unfold mean₂ + apply congrArg mean + funext z + unfold FaceRegularityState.faceCutCorrelation + apply congrArg mean + funext y + exact mixedOrderedPatternTerm_regularized_split + H S e (Classical.choice inferInstance) y z + +theorem abs_mixedOrderedPatternCorrelation_regularized_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (hH : H.EdgeWeightsInUnitInterval) + (S : OrderedRegularitySystem G k r) + {ε : ℝ} + (hregular : + ∀ e, (S e).IsFaceCutRegular + (H.edgeWeight e) ε) + (e : OrderedFace k r) : + |mixedOrderedPatternCorrelation H + (regularizedOrderedPattern H S) e| ≤ ε := by + rw [mixedOrderedPatternCorrelation_regularized_eq_mean] + let K := regularizedOrderedPattern H S + have hK : K.EdgeWeightsInUnitInterval := + regularizedOrderedPattern_unitInterval hH S + calc + |mean (fun z : OrderedFaceComplement e → G => + (S e).faceCutCorrelation + (H.edgeWeight e) + (orderedPatternMixedCutTest H K e + (Classical.choice inferInstance) z))| ≤ + mean (fun z : OrderedFaceComplement e → G => + |(S e).faceCutCorrelation + (H.edgeWeight e) + (orderedPatternMixedCutTest H K e + (Classical.choice inferInstance) z)|) := + Finset.abs_expect_le Finset.univ _ + _ ≤ mean + (fun _z : OrderedFaceComplement e → G => ε) := by + apply mean_mono + intro z + exact hregular e + (orderedPatternMixedCutTest H K e + (Classical.choice inferInstance) z) + (orderedPatternMixedCutTest_bounded + H K hH hK e (Classical.choice inferInstance) z) + _ = ε := mean_const _ + +theorem patternCount_abs_sub_regularizedOrderedPattern_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (hH : H.EdgeWeightsInUnitInterval) + (S : OrderedRegularitySystem G k r) + {ε : ℝ} + (hregular : + ∀ e, (S e).IsFaceCutRegular + (H.edgeWeight e) ε) : + |H.patternCount - + (regularizedOrderedPattern H S).patternCount| ≤ + (Fintype.card (OrderedFace k r) : ℝ) * ε := by + calc + |H.patternCount - + (regularizedOrderedPattern H S).patternCount| ≤ + ∑ e : OrderedFace k r, + |mixedOrderedPatternCorrelation H + (regularizedOrderedPattern H S) e| := + abs_patternCount_sub_le_sum_mixedOrderedPatternCorrelation + H (regularizedOrderedPattern H S) + _ ≤ ∑ _e : OrderedFace k r, ε := + Finset.sum_le_sum fun e _ => + abs_mixedOrderedPatternCorrelation_regularized_le + H hH S hregular e + _ = (Fintype.card (OrderedFace k r) : ℝ) * ε := by + simp + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedFullBoundary.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedFullBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..272f9a0b843089a4075e3c921b53e62bdf33a8f8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedFullBoundary.lean @@ -0,0 +1,567 @@ +import OAI.Combinatorics.Progressions.FixedDensity.ConfigurationWeightedDefect + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +abbrev ProperPositiveOrderedSubface (n : ℕ) := + PositiveOrderedFace (n + 1) n + +@[simp] +theorem properPositiveOrderedSubface_rank_lt_upper {n : ℕ} + (d : ProperPositiveOrderedSubface n) : + d.rank < n + 1 := by + simp only [PositiveOrderedFace.rank] + exact Nat.succ_lt_succ d.lowerRank.2 + +abbrev orderedFullLowerComplexRank + {k r : ℕ} + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + Fin (r + 1) := + ⟨d.lowerRank.1 + 1, by + have hd : d.rank < e.rank := by + exact properPositiveOrderedSubface_rank_lt_upper d + have he : e.rank ≤ r := by + simp only [PositiveOrderedFace.rank] + exact e.lowerRank.2 + omega⟩ + +@[simp] +theorem orderedFullLowerComplexRank_val + {k r : ℕ} + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + (orderedFullLowerComplexRank e d).1 = + d.lowerRank.1 + 1 := + rfl + +abbrev orderedFullLowerAmbientFace + {k r : ℕ} + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + OrderedFace k (d.lowerRank.1 + 1) := + d.face.trans e.face + +@[simp] +theorem orderedFaceTuple_orderedFullLowerAmbientFace + {G : Type*} {k r : ℕ} + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) + (x : Fin k → G) : + orderedFaceTuple (orderedFullLowerAmbientFace e d) x = + orderedFaceTuple d.face (orderedFaceTuple e.face x) := + rfl + +noncomputable def orderedFullLowerConstituentPartition + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + FacePartition (Fin (e.lowerRank.1 + 1) → G) := + FacePartition.pullback + (orderedFaceTuple d.face) + (C.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)) + +noncomputable def orderedFullLowerPositivePartition + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) : + FacePartition (Fin (e.lowerRank.1 + 1) → G) := + FacePartition.joinFinset + (Finset.univ : + Finset (ProperPositiveOrderedSubface e.lowerRank.1)) + (orderedFullLowerConstituentPartition C e) + +theorem orderedFullLowerPositivePartition_le_constituent + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + orderedFullLowerPositivePartition C e ≤ + orderedFullLowerConstituentPartition C e d := by + exact FacePartition.joinFinset_le_of_mem + (orderedFullLowerConstituentPartition C e) + (Finset.mem_univ d) + +theorem orderedFullLowerPositivePartition_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {fine coarse : OrderedPartitionComplex G k r} + (hfc : fine.Refines coarse) + (e : PositiveOrderedFace k r) : + orderedFullLowerPositivePartition fine e ≤ + orderedFullLowerPositivePartition coarse e := by + apply FacePartition.le_joinFinset_iff.mpr + intro d _hd + exact le_trans + (orderedFullLowerPositivePartition_le_constituent fine e d) + (FacePartition.pullback_mono + (orderedFaceTuple d.face) + (hfc + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d))) + +noncomputable def orderedFullLowerBoundaryPartition + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) : + FacePartition (Fin (e.lowerRank.1 + 1) → G) := + FacePartition.join + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face) + (orderedFullLowerPositivePartition C e) + +theorem orderedFullLowerBoundaryPartition_le_immediate + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) : + orderedFullLowerBoundaryPartition C e ≤ + orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face := by + exact FacePartition.join_le_left _ _ + +theorem orderedFullLowerBoundaryPartition_le_constituent + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (d : ProperPositiveOrderedSubface e.lowerRank.1) : + orderedFullLowerBoundaryPartition C e ≤ + orderedFullLowerConstituentPartition C e d := by + exact le_trans + (FacePartition.join_le_right _ _) + (orderedFullLowerPositivePartition_le_constituent C e d) + +theorem orderedFullLowerBoundaryPartition_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {fine coarse : OrderedPartitionComplex G k r} + (hfc : fine.Refines coarse) + (e : PositiveOrderedFace k r) : + orderedFullLowerBoundaryPartition fine e ≤ + orderedFullLowerBoundaryPartition coarse e := by + apply FacePartition.le_join_iff.mpr + constructor + · exact le_trans + (orderedFullLowerBoundaryPartition_le_immediate fine e) + (orderedBoundaryPartition_mono + (fun f => + hfc e.lowerRank.castSucc f) + e.face) + · exact le_trans + (FacePartition.join_le_right _ _) + (orderedFullLowerPositivePartition_mono hfc e) + +theorem mem_orderedFullLowerBoundaryPartition_part_iff + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin (e.lowerRank.1 + 1) → G) : + y ∈ (orderedFullLowerBoundaryPartition C e).part x ↔ + y ∈ + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face).part x ∧ + ∀ d : ProperPositiveOrderedSubface e.lowerRank.1, + orderedFaceTuple d.face y ∈ + (C.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)).part + (orderedFaceTuple d.face x) := by + rw [orderedFullLowerBoundaryPartition, FacePartition.part_join, + Finset.mem_inter, orderedFullLowerPositivePartition, + FacePartition.mem_part_joinFinset_iff] + simp only [Finset.mem_univ, forall_const, + orderedFullLowerConstituentPartition, + FacePartition.mem_part_pullback_iff_image_mem] + +theorem orderedFaceTuple_mem_orderedFullLowerBoundaryPartition_part_iff + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin k → G) : + orderedFaceTuple e.face y ∈ + (orderedFullLowerBoundaryPartition C e).part + (orderedFaceTuple e.face x) ↔ + orderedFaceTuple e.face y ∈ + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face).part + (orderedFaceTuple e.face x) ∧ + ∀ d : ProperPositiveOrderedSubface e.lowerRank.1, + orderedFaceTuple (orderedFullLowerAmbientFace e d) y ∈ + (C.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)).part + (orderedFaceTuple + (orderedFullLowerAmbientFace e d) x) := by + rw [mem_orderedFullLowerBoundaryPartition_part_iff] + constructor + · rintro ⟨hboundary, hsubfaces⟩ + refine ⟨hboundary, ?_⟩ + intro d + rw [orderedFaceTuple_orderedFullLowerAmbientFace e d y, + orderedFaceTuple_orderedFullLowerAmbientFace e d x] + exact hsubfaces d + · rintro ⟨hboundary, hsubfaces⟩ + refine ⟨hboundary, ?_⟩ + intro d + have hd := hsubfaces d + rw [orderedFaceTuple_orderedFullLowerAmbientFace e d y, + orderedFaceTuple_orderedFullLowerAmbientFace e d x] at hd + exact hd + +theorem complexity_orderedFullLowerBoundaryPartition_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) : + FacePartition.complexity + (orderedFullLowerBoundaryPartition C e) ≤ + FacePartition.complexity + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face) * + ∏ d : ProperPositiveOrderedSubface e.lowerRank.1, + FacePartition.complexity + (C.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)) := by + calc + FacePartition.complexity + (orderedFullLowerBoundaryPartition C e) ≤ + FacePartition.complexity + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face) * + FacePartition.complexity + (orderedFullLowerPositivePartition C e) := by + exact FacePartition.complexity_join_le _ _ + _ ≤ + FacePartition.complexity + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face) * + ∏ d : ProperPositiveOrderedSubface e.lowerRank.1, + FacePartition.complexity + (orderedFullLowerConstituentPartition C e d) := by + exact Nat.mul_le_mul_left _ + (FacePartition.complexity_joinFinset_le + (Finset.univ : + Finset (ProperPositiveOrderedSubface e.lowerRank.1)) + (orderedFullLowerConstituentPartition C e)) + _ ≤ + FacePartition.complexity + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face) * + ∏ d : ProperPositiveOrderedSubface e.lowerRank.1, + FacePartition.complexity + (C.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)) := by + apply Nat.mul_le_mul_left + apply Finset.prod_le_prod₀ + · intro d _hd + exact Nat.zero_le _ + · intro d _hd + exact FacePartition.complexity_pullback_le + (orderedFaceTuple d.face) + (C.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)) + +noncomputable def orderedFullLowerBoundaryAtomAt + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x : Fin (e.lowerRank.1 + 1) → G) : + (orderedFullLowerBoundaryPartition C e).parts := + partitionAtomAt (orderedFullLowerBoundaryPartition C e) x + +@[simp] +theorem orderedFullLowerBoundaryAtomAt_val + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x : Fin (e.lowerRank.1 + 1) → G) : + (orderedFullLowerBoundaryAtomAt C e x).1 = + (orderedFullLowerBoundaryPartition C e).part x := + rfl + +noncomputable def orderedFullLowerBoundaryWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + partitionAtomIndicator + (orderedFullLowerBoundaryPartition C e) + (orderedFullLowerBoundaryAtomAt C e x) + y + +theorem orderedFullLowerBoundaryWeight_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin (e.lowerRank.1 + 1) → G) : + 0 ≤ orderedFullLowerBoundaryWeight C e x y := + partitionAtomIndicator_nonneg _ _ _ + +theorem orderedFullLowerBoundaryWeight_le_one + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin (e.lowerRank.1 + 1) → G) : + orderedFullLowerBoundaryWeight C e x y ≤ 1 := + partitionAtomIndicator_le_one _ _ _ + +theorem orderedFullLowerBoundaryWeight_le_immediateWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin (e.lowerRank.1 + 1) → G) : + orderedFullLowerBoundaryWeight C e x y ≤ + partitionAtomIndicator + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face) + (orderedBoundaryAtomAt + (positiveFaceLowerLayer C e) e.face x) + y := by + by_cases hy : + y ∈ (orderedFullLowerBoundaryPartition C e).part x + · have himmediate : + y ∈ + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face).part x := + FacePartition.part_subset_of_le + (orderedFullLowerBoundaryPartition_le_immediate C e) + x hy + rw [show orderedFullLowerBoundaryWeight C e x y = 1 by + exact partitionAtomIndicator_of_mem _ _ hy, + partitionAtomIndicator_of_mem _ _ himmediate] + · rw [show orderedFullLowerBoundaryWeight C e x y = 0 by + exact partitionAtomIndicator_of_not_mem _ _ hy] + exact partitionAtomIndicator_nonneg _ _ _ + +@[simp] +theorem orderedFullLowerBoundaryWeight_sq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin (e.lowerRank.1 + 1) → G) : + orderedFullLowerBoundaryWeight C e x y ^ 2 = + orderedFullLowerBoundaryWeight C e x y := + partitionAtomIndicator_sq _ _ _ + +@[simp] +theorem orderedFullLowerBoundaryWeight_self + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x : Fin (e.lowerRank.1 + 1) → G) : + orderedFullLowerBoundaryWeight C e x x = 1 := by + apply partitionAtomIndicator_of_mem + exact + (orderedFullLowerBoundaryPartition C e).mem_part + (Finset.mem_univ x) + +theorem orderedFullLowerBoundaryWeight_eq_one_iff + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin (e.lowerRank.1 + 1) → G) : + orderedFullLowerBoundaryWeight C e x y = 1 ↔ + y ∈ (orderedFullLowerBoundaryPartition C e).part x := by + constructor + · intro h + by_contra hy + have hz : + orderedFullLowerBoundaryWeight C e x y = 0 := + partitionAtomIndicator_of_not_mem _ _ hy + linarith + · intro hy + exact partitionAtomIndicator_of_mem _ _ hy + +theorem orderedFullLowerBoundaryWeight_eq_one_iff_all_subfaces + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (x y : Fin (e.lowerRank.1 + 1) → G) : + orderedFullLowerBoundaryWeight C e x y = 1 ↔ + y ∈ + (orderedBoundaryPartition + (positiveFaceLowerLayer C e) e.face).part x ∧ + ∀ d : ProperPositiveOrderedSubface e.lowerRank.1, + orderedFaceTuple d.face y ∈ + (C.partition + (orderedFullLowerComplexRank e d) + (orderedFullLowerAmbientFace e d)).part + (orderedFaceTuple d.face x) := by + rw [orderedFullLowerBoundaryWeight_eq_one_iff, + mem_orderedFullLowerBoundaryPartition_part_iff] + +noncomputable def orderedFullLowerStructured + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (e : PositiveOrderedFace k r) + (f : (Fin (e.lowerRank.1 + 1) → G) → ℝ) : + (Fin (e.lowerRank.1 + 1) → G) → ℝ := + conditionalMean (orderedFullLowerBoundaryPartition C e) f + +noncomputable def sourceFullMixedCoarseDensity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) : ℝ := + mixedConfigurationCoarseDensity P A e + +noncomputable def sourceFullMixedDefect + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + mixedConfigurationDefect P A e y + +noncomputable def sourceFullMixedBoundaryWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : ℝ := + orderedFullLowerBoundaryWeight P.coarse e + (orderedFaceTuple e.face A.witness) y + +@[simp] +theorem sourceFullMixedBoundaryWeight_sq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + sourceFullMixedBoundaryWeight P A e y ^ 2 = + sourceFullMixedBoundaryWeight P A e y := + orderedFullLowerBoundaryWeight_sq _ _ _ _ + +theorem sourceFullMixedBoundaryWeight_le_mixedConfigurationBoundaryIndicator + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) : + sourceFullMixedBoundaryWeight P A e y ≤ + mixedConfigurationBoundaryIndicator P A e y := by + exact orderedFullLowerBoundaryWeight_le_immediateWeight + P.coarse e (orderedFaceTuple e.face A.witness) y + +def SourceFullMixedGoodAtFace + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (α β : ℝ) : Prop := + α ≤ sourceFullMixedCoarseDensity P A e ∧ + conditionalMean + (orderedFullLowerBoundaryPartition P.coarse e) + (fun y => sourceFullMixedDefect P A e y ^ 2) + (orderedFaceTuple e.face A.witness) ≤ + β + +def ClosedOrderedAtomConfiguration.IsSourceFullMixedGood + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) : Prop := + ∀ e : PositiveOrderedFace k r, + SourceFullMixedGoodAtFace P A e + (α e.rank) (β e.rank) + +noncomputable def sourceFullMixedLocalizedDefectSq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) : ℝ := + mean fun y => + sourceFullMixedDefect P A e y ^ 2 * + sourceFullMixedBoundaryWeight P A e y + +theorem SourceFullMixedGoodAtFace.localized_defect + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (α β : ℝ) + (hgood : SourceFullMixedGoodAtFace P A e α β) : + sourceFullMixedLocalizedDefectSq P A e ≤ + β * mean (sourceFullMixedBoundaryWeight P A e) := by + unfold sourceFullMixedLocalizedDefectSq + apply mean_mul_partitionAtomIndicator_le + (orderedFullLowerBoundaryPartition P.coarse e) + (fun y => sourceFullMixedDefect P A e y ^ 2) + (orderedFullLowerBoundaryAtomAt P.coarse e + (orderedFaceTuple e.face A.witness)) + have hrep : + (orderedFullLowerBoundaryPartition P.coarse e).representative + (orderedFullLowerBoundaryAtomAt P.coarse e + (orderedFaceTuple e.face A.witness)) ∈ + (orderedFullLowerBoundaryPartition P.coarse e).part + (orderedFaceTuple e.face A.witness) := by + exact + (orderedFullLowerBoundaryPartition P.coarse e).representative_mem + (orderedFullLowerBoundaryAtomAt P.coarse e + (orderedFaceTuple e.face A.witness)) + have heq := + conditionalMean_eq_of_mem_part + (orderedFullLowerBoundaryPartition P.coarse e) + (fun y => sourceFullMixedDefect P A e y ^ 2) + hrep + rw [heq] + exact hgood.2 + +theorem ClosedOrderedAtomConfiguration.IsSourceFullMixedGood.localized_defect + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (hgood : A.IsSourceFullMixedGood P α β) + (e : PositiveOrderedFace k r) : + sourceFullMixedLocalizedDefectSq P A e ≤ + β e.rank * + mean (sourceFullMixedBoundaryWeight P A e) := + (hgood e).localized_defect P A e + (α e.rank) (β e.rank) + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedGoodAtoms.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedGoodAtoms.lean new file mode 100644 index 0000000000000000000000000000000000000000..e09c8ba5e59fbca339250c49fce7dab8105417ec --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedGoodAtoms.lean @@ -0,0 +1,985 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedAtomEnergy + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def partitionAtomAt + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (x : Ω) : + P.parts := + ⟨P.part x, P.part_mem.2 (Finset.mem_univ x)⟩ + +@[simp] +theorem partitionAtomAt_val + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (x : Ω) : + (partitionAtomAt P x).1 = P.part x := + rfl + +@[simp] +theorem partitionAtomAt_eq_iff_mem + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (x : Ω) (a : P.parts) : + partitionAtomAt P x = a ↔ x ∈ a.1 := by + constructor + · intro h + rw [← h] + exact P.mem_part (Finset.mem_univ x) + · intro hx + apply Subtype.ext + exact P.part_eq_of_mem a.2 hx + +theorem partitionAtomAt_eq_iff_mem_part + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (x y : Ω) : + partitionAtomAt P y = partitionAtomAt P x ↔ + y ∈ P.part x := by + rw [partitionAtomAt_eq_iff_mem] + rfl + +theorem partitionAtomIndicator_measurable + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (a : P.parts) : + IsPartitionMeasurable P (partitionAtomIndicator P a) := by + intro x y hy + have hxy : + partitionAtomAt P y = partitionAtomAt P x := + (partitionAtomAt_eq_iff_mem_part P x y).2 hy + by_cases hx : x ∈ a.1 + · have hax : partitionAtomAt P x = a := + (partitionAtomAt_eq_iff_mem P x a).2 hx + have hay : partitionAtomAt P y = a := hxy.trans hax + have hy' : y ∈ a.1 := + (partitionAtomAt_eq_iff_mem P y a).1 hay + simp [partitionAtomIndicator_of_mem P a hx, + partitionAtomIndicator_of_mem P a hy'] + · have hy' : y ∉ a.1 := by + intro hya + have hay : partitionAtomAt P y = a := + (partitionAtomAt_eq_iff_mem P y a).2 hya + have hax : partitionAtomAt P x = a := + hxy.symm.trans hay + exact hx ((partitionAtomAt_eq_iff_mem P x a).1 hax) + simp [partitionAtomIndicator_of_not_mem P a hx, + partitionAtomIndicator_of_not_mem P a hy'] + +def partitionAtomUnion + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset P.parts) : + Finset Ω := + s.biUnion fun a => a.1 + +@[simp] +theorem mem_partitionAtomUnion + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset P.parts) (x : Ω) : + x ∈ partitionAtomUnion P s ↔ + ∃ a ∈ s, x ∈ a.1 := by + simp [partitionAtomUnion] + +theorem mem_partitionAtomUnion_iff_atomAt_mem + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset P.parts) (x : Ω) : + x ∈ partitionAtomUnion P s ↔ + partitionAtomAt P x ∈ s := by + constructor + · intro hx + obtain ⟨a, ha, hxa⟩ := + (mem_partitionAtomUnion P s x).1 hx + have hcanonical : + partitionAtomAt P x = a := + (partitionAtomAt_eq_iff_mem P x a).2 hxa + simpa [hcanonical] using ha + · intro hx + exact + (mem_partitionAtomUnion P s x).2 + ⟨partitionAtomAt P x, hx, + P.mem_part (Finset.mem_univ x)⟩ + +theorem selectedPartitionAtoms_pairwiseDisjoint + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset P.parts) : + (↑s : Set P.parts).PairwiseDisjoint + (fun a => a.1) := by + intro a _ha b _hb hab + exact + P.disjoint a.2 b.2 + (fun hv => hab (Subtype.ext hv)) + +theorem card_partitionAtomUnion + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset P.parts) : + (partitionAtomUnion P s).card = + ∑ a ∈ s, a.1.card := by + exact Finset.card_biUnion + (selectedPartitionAtoms_pairwiseDisjoint P s) + +theorem finsetIndicator_partitionAtomUnion + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset P.parts) (x : Ω) : + finsetIndicator (partitionAtomUnion P s) x = + ∑ a ∈ s, partitionAtomIndicator P a x := by + classical + by_cases hx : x ∈ partitionAtomUnion P s + · obtain ⟨a, ha, hxa⟩ := + (mem_partitionAtomUnion P s x).1 hx + rw [finsetIndicator_of_mem hx, + Finset.sum_eq_single a] + · exact (partitionAtomIndicator_of_mem P a hxa).symm + · intro b hb hba + apply partitionAtomIndicator_of_not_mem + intro hxb + have hab : b = a := by + apply Subtype.ext + exact P.eq_of_mem_parts b.2 a.2 hxb hxa + exact hba hab + · intro hnot + exact (hnot ha).elim + · rw [finsetIndicator_of_not_mem hx] + symm + apply Finset.sum_eq_zero + intro a ha + apply partitionAtomIndicator_of_not_mem + intro hxa + exact hx + ((mem_partitionAtomUnion P s x).2 ⟨a, ha, hxa⟩) + +theorem mean_finsetIndicator_partitionAtomUnion + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset P.parts) : + mean (finsetIndicator (partitionAtomUnion P s)) = + ∑ a ∈ s, mean (partitionAtomIndicator P a) := by + rw [show + finsetIndicator (partitionAtomUnion P s) = + fun x => ∑ a ∈ s, partitionAtomIndicator P a x by + funext x + exact finsetIndicator_partitionAtomUnion P s x] + unfold mean + exact + Finset.expect_sum_comm + (Finset.univ : Finset Ω) s + (fun x a => partitionAtomIndicator P a x) + +theorem partitionAtomUnion_indicator_measurable + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (s : Finset P.parts) : + IsPartitionMeasurable P + (finsetIndicator (partitionAtomUnion P s)) := by + intro x y hy + have hxy : + partitionAtomAt P y = partitionAtomAt P x := + (partitionAtomAt_eq_iff_mem_part P x y).2 hy + have hmem : + y ∈ partitionAtomUnion P s ↔ + x ∈ partitionAtomUnion P s := by + rw [mem_partitionAtomUnion_iff_atomAt_mem, + mem_partitionAtomUnion_iff_atomAt_mem, hxy] + by_cases hx : x ∈ partitionAtomUnion P s + · have hy' : y ∈ partitionAtomUnion P s := hmem.mpr hx + simp [finsetIndicator_of_mem hx, + finsetIndicator_of_mem hy'] + · have hy' : y ∉ partitionAtomUnion P s := + fun h => hx (hmem.mp h) + simp [finsetIndicator_of_not_mem hx, + finsetIndicator_of_not_mem hy'] + +theorem mean_mul_partitionAtomIndicator + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) (a : P.parts) : + mean (fun x => f x * partitionAtomIndicator P a x) = + conditionalMean P f (P.representative a) * + mean (partitionAtomIndicator P a) := by + rw [FaceRegularityState.mean_mul_eq_mean_conditionalMean_mul + P f (partitionAtomIndicator P a) + (partitionAtomIndicator_measurable P a)] + rw [← mean_smul] + apply congrArg mean + funext x + by_cases hx : x ∈ a.1 + · rw [partitionAtomIndicator_of_mem P a hx, + mul_one, mul_one] + have hrep : + P.representative a ∈ P.part x := by + rw [P.part_eq_of_mem a.2 hx] + exact P.representative_mem a + exact + (conditionalMean_eq_of_mem_part P f hrep).symm + · rw [partitionAtomIndicator_of_not_mem P a hx, + mul_zero, mul_zero] + +theorem mean_mul_partitionAtomIndicator_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) (a : P.parts) + {β : ℝ} + (hβ : conditionalMean P f (P.representative a) ≤ β) : + mean (fun x => f x * partitionAtomIndicator P a x) ≤ + β * mean (partitionAtomIndicator P a) := by + rw [mean_mul_partitionAtomIndicator P f a] + apply mul_le_mul_of_nonneg_right hβ + exact mean_nonneg fun x => + partitionAtomIndicator_nonneg P a x + +noncomputable def smallAverageBaseAtoms + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) (α : ℝ) : + Finset P.parts := by + classical + exact (Finset.univ : Finset P.parts).filter fun b => + conditionalMean P f (P.representative b) < α + +noncomputable def smallAverageBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) (α : ℝ) : + Finset Ω := + partitionAtomUnion P (smallAverageBaseAtoms P f α) + +@[simp] +theorem mem_smallAverageBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) (α : ℝ) + (x : Ω) : + x ∈ smallAverageBaseSupport P f α ↔ + conditionalMean P f x < α := by + rw [smallAverageBaseSupport, + mem_partitionAtomUnion_iff_atomAt_mem] + simp only [smallAverageBaseAtoms, Finset.mem_filter, + Finset.mem_univ, true_and] + have hrep : + P.representative (partitionAtomAt P x) ∈ + P.part x := by + exact P.representative_mem (partitionAtomAt P x) + have heq := + conditionalMean_eq_of_mem_part P f hrep + rw [heq] + +theorem mean_indicator_inter_smallAverageBaseSupport_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] [Nonempty Ω] + (P : FacePartition Ω) (A : Finset Ω) + {α : ℝ} (hα : 0 ≤ α) : + mean (finsetIndicator + (A ∩ smallAverageBaseSupport P (finsetIndicator A) α)) ≤ + α := by + rw [show + finsetIndicator + (A ∩ smallAverageBaseSupport P (finsetIndicator A) α) = + fun x => + finsetIndicator A x * + finsetIndicator + (smallAverageBaseSupport + P (finsetIndicator A) α) x by + funext x + by_cases hxA : x ∈ A <;> + by_cases hxB : + x ∈ smallAverageBaseSupport P (finsetIndicator A) α <;> + simp [hxA, hxB]] + rw [FaceRegularityState.mean_mul_eq_mean_conditionalMean_mul + P (finsetIndicator A) + (finsetIndicator + (smallAverageBaseSupport P (finsetIndicator A) α)) + (partitionAtomUnion_indicator_measurable P + (smallAverageBaseAtoms P (finsetIndicator A) α))] + calc + mean (fun x => + conditionalMean P (finsetIndicator A) x * + finsetIndicator + (smallAverageBaseSupport P + (finsetIndicator A) α) x) ≤ + mean (fun _x : Ω => α) := by + apply mean_mono + intro x + by_cases hx : + x ∈ smallAverageBaseSupport P (finsetIndicator A) α + · rw [finsetIndicator_of_mem hx, mul_one] + exact + (mem_smallAverageBaseSupport + P (finsetIndicator A) α x).1 hx |>.le + · rw [finsetIndicator_of_not_mem hx, mul_zero] + exact hα + _ = α := mean_const α + +noncomputable def largeAverageBaseAtoms + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) (β : ℝ) : + Finset P.parts := by + classical + exact (Finset.univ : Finset P.parts).filter fun b => + β < conditionalMean P f (P.representative b) + +noncomputable def largeAverageBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) (β : ℝ) : + Finset Ω := + partitionAtomUnion P (largeAverageBaseAtoms P f β) + +@[simp] +theorem mem_largeAverageBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) (β : ℝ) + (x : Ω) : + x ∈ largeAverageBaseSupport P f β ↔ + β < conditionalMean P f x := by + rw [largeAverageBaseSupport, + mem_partitionAtomUnion_iff_atomAt_mem] + simp only [largeAverageBaseAtoms, Finset.mem_filter, + Finset.mem_univ, true_and] + have hrep : + P.representative (partitionAtomAt P x) ∈ + P.part x := by + exact P.representative_mem (partitionAtomAt P x) + have heq := + conditionalMean_eq_of_mem_part P f hrep + rw [heq] + +theorem mul_mean_indicator_largeAverageBaseSupport_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) + (hf : ∀ x, 0 ≤ f x) + {β : ℝ} (_hβ : 0 ≤ β) : + β * mean (finsetIndicator + (largeAverageBaseSupport P f β)) ≤ + mean f := by + rw [← mean_smul] + calc + mean (fun x => + β * finsetIndicator + (largeAverageBaseSupport P f β) x) ≤ + mean (conditionalMean P f) := by + apply mean_mono + intro x + by_cases hx : x ∈ largeAverageBaseSupport P f β + · rw [finsetIndicator_of_mem hx, mul_one] + exact + (mem_largeAverageBaseSupport P f β x).1 hx |>.le + · rw [finsetIndicator_of_not_mem hx, mul_zero] + exact conditionalMean_nonneg P hf x + _ = mean f := mean_conditionalMean P f + +theorem mean_indicator_largeAverageBaseSupport_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (P : FacePartition Ω) (f : Ω → ℝ) + (hf : ∀ x, 0 ≤ f x) + {β : ℝ} (hβ : 0 < β) : + mean (finsetIndicator + (largeAverageBaseSupport P f β)) ≤ + mean f / β := by + apply (le_div_iff₀ hβ).2 + simpa [mul_comm] using + mul_mean_indicator_largeAverageBaseSupport_le + P f hf hβ.le + +noncomputable def atomBoundaryDefect + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (a : upper.parts) (x : Ω) : ℝ := + conditionalMean fine (partitionAtomIndicator upper a) x - + conditionalMean coarse (partitionAtomIndicator upper a) x + +noncomputable def atomBoundaryDefectSq + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (a : upper.parts) (x : Ω) : ℝ := + atomBoundaryDefect fine coarse upper a x ^ 2 + +theorem atomBoundaryDefectSq_nonneg + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (a : upper.parts) (x : Ω) : + 0 ≤ atomBoundaryDefectSq fine coarse upper a x := + sq_nonneg _ + +noncomputable def largeDefectBaseAtoms + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (a : upper.parts) (β : ℝ) : + Finset coarse.parts := + largeAverageBaseAtoms coarse + (atomBoundaryDefectSq fine coarse upper a) β + +noncomputable def largeDefectBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (a : upper.parts) (β : ℝ) : + Finset Ω := + partitionAtomUnion coarse + (largeDefectBaseAtoms fine coarse upper a β) + +@[simp] +theorem mem_largeDefectBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (a : upper.parts) (β : ℝ) (x : Ω) : + x ∈ largeDefectBaseSupport fine coarse upper a β ↔ + β < + conditionalMean coarse + (atomBoundaryDefectSq fine coarse upper a) x := by + exact + mem_largeAverageBaseSupport coarse + (atomBoundaryDefectSq fine coarse upper a) β x + +theorem mean_atomBoundaryDefectSq_le_atomEnergy_sub + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fine coarse : FacePartition Ω} + (hfc : fine ≤ coarse) + (upper : FacePartition Ω) (a : upper.parts) : + mean (atomBoundaryDefectSq fine coarse upper a) ≤ + partitionAtomEnergy fine upper - + partitionAtomEnergy coarse upper := by + rw [partitionAtomEnergy_sub_eq_sum_mean_sq hfc upper] + exact + Finset.single_le_sum + (s := (Finset.univ : Finset upper.parts)) + (f := fun b => + mean (fun x => + (conditionalMean fine + (partitionAtomIndicator upper b) x - + conditionalMean coarse + (partitionAtomIndicator upper b) x) ^ 2)) + (fun b _ => mean_nonneg fun x => sq_nonneg _) + (Finset.mem_univ a) + +theorem mul_mean_indicator_largeDefectBaseSupport_le_atomEnergy_sub + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fine coarse : FacePartition Ω} + (hfc : fine ≤ coarse) + (upper : FacePartition Ω) (a : upper.parts) + {β : ℝ} (hβ : 0 ≤ β) : + β * mean (finsetIndicator + (largeDefectBaseSupport fine coarse upper a β)) ≤ + partitionAtomEnergy fine upper - + partitionAtomEnergy coarse upper := by + exact + (mul_mean_indicator_largeAverageBaseSupport_le + coarse (atomBoundaryDefectSq fine coarse upper a) + (atomBoundaryDefectSq_nonneg fine coarse upper a) + hβ).trans + (mean_atomBoundaryDefectSq_le_atomEnergy_sub + hfc upper a) + +theorem mean_indicator_largeDefectBaseSupport_le_atomEnergy_sub_div + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {fine coarse : FacePartition Ω} + (hfc : fine ≤ coarse) + (upper : FacePartition Ω) (a : upper.parts) + {β : ℝ} (hβ : 0 < β) : + mean (finsetIndicator + (largeDefectBaseSupport fine coarse upper a β)) ≤ + (partitionAtomEnergy fine upper - + partitionAtomEnergy coarse upper) / β := by + apply (le_div_iff₀ hβ).2 + simpa [mul_comm] using + mul_mean_indicator_largeDefectBaseSupport_le_atomEnergy_sub + hfc upper a hβ.le + +noncomputable def atomBadBaseSupport + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (fine coarse upper : FacePartition Ω) + (a : upper.parts) (α β : ℝ) : + Finset Ω := + smallAverageBaseSupport coarse + (partitionAtomIndicator upper a) α ∪ + largeDefectBaseSupport fine coarse upper a β + +theorem mean_indicator_inter_union_le_add + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (A B C : Finset Ω) : + mean (finsetIndicator (A ∩ (B ∪ C))) ≤ + mean (finsetIndicator (A ∩ B)) + + mean (finsetIndicator C) := by + rw [← mean_add] + apply mean_mono + intro x + by_cases hx : x ∈ A ∩ (B ∪ C) + · rw [finsetIndicator_of_mem hx] + rcases Finset.mem_union.mp (Finset.mem_inter.mp hx).2 with hxB | hxC + · have hxAB : x ∈ A ∩ B := + Finset.mem_inter.mpr ⟨(Finset.mem_inter.mp hx).1, hxB⟩ + rw [finsetIndicator_of_mem hxAB] + exact le_add_of_nonneg_right + (by + by_cases hxc : x ∈ C <;> simp [hxc]) + · rw [finsetIndicator_of_mem hxC] + exact le_add_of_nonneg_left + (by + by_cases hxab : x ∈ A ∩ B <;> simp [hxab]) + · rw [finsetIndicator_of_not_mem hx] + exact add_nonneg + (by + by_cases hxab : x ∈ A ∩ B <;> simp [hxab]) + (by + by_cases hxc : x ∈ C <;> simp [hxc]) + +theorem mean_indicator_atom_inter_badBaseSupport_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] [Nonempty Ω] + {fine coarse : FacePartition Ω} + (hfc : fine ≤ coarse) + (upper : FacePartition Ω) (a : upper.parts) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (a.1 ∩ atomBadBaseSupport fine coarse upper a α β)) ≤ + α + + (partitionAtomEnergy fine upper - + partitionAtomEnergy coarse upper) / β := by + calc + mean (finsetIndicator + (a.1 ∩ atomBadBaseSupport fine coarse upper a α β)) ≤ + mean (finsetIndicator + (a.1 ∩ smallAverageBaseSupport coarse + (partitionAtomIndicator upper a) α)) + + mean (finsetIndicator + (largeDefectBaseSupport fine coarse upper a β)) := by + exact + mean_indicator_inter_union_le_add + a.1 + (smallAverageBaseSupport coarse + (partitionAtomIndicator upper a) α) + (largeDefectBaseSupport fine coarse upper a β) + _ ≤ + α + + (partitionAtomEnergy fine upper - + partitionAtomEnergy coarse upper) / β := + add_le_add + (mean_indicator_inter_smallAverageBaseSupport_le + coarse a.1 hα) + (mean_indicator_largeDefectBaseSupport_le_atomEnergy_sub_div + hfc upper a hβ) + +def orderedFaceAtomAt + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k j) (x : Fin j → G) : + (P e).parts := + partitionAtomAt (P e) x + +@[simp] +theorem orderedFaceAtomAt_val + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k j) (x : Fin j → G) : + (orderedFaceAtomAt P e x).1 = (P e).part x := + rfl + +theorem orderedBoundaryAtomAt_eq_iff + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (P : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (x y : Fin (j + 1) → G) : + orderedBoundaryAtomAt P e y = + orderedBoundaryAtomAt P e x ↔ + ∀ i : Fin (j + 1), + orderedFaceAtomAt P (eraseBoundaryFace e i) + (eraseBoundaryCoordinate i y) = + orderedFaceAtomAt P (eraseBoundaryFace e i) + (eraseBoundaryCoordinate i x) := by + rw [Subtype.ext_iff, + orderedBoundaryAtomAt_val, + orderedBoundaryAtomAt_val] + constructor + · intro h i + apply Subtype.ext + rw [orderedFaceAtomAt_val, orderedFaceAtomAt_val] + have hmem : + y ∈ (orderedBoundaryPartition P e).part x := by + rw [← h] + exact + (orderedBoundaryPartition P e).mem_part + (Finset.mem_univ y) + exact + (mem_orderedBoundaryPartition_part_iff_part_eq + P e x y).1 hmem i + · intro h + apply + (orderedBoundaryPartition P e).part_eq_of_mem + ((orderedBoundaryPartition P e).part_mem.2 + (Finset.mem_univ x)) + apply + (mem_orderedBoundaryPartition_part_iff_part_eq + P e x y).2 + intro i + exact congrArg Subtype.val (h i) + +noncomputable def orderedAtomBoundaryDefect + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) (x : Fin (j + 1) → G) : ℝ := + atomBoundaryDefect + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + upper a x + +noncomputable def orderedBoundaryAtomMass + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (b : (orderedBoundaryPartition coarse e).parts) : ℝ := + mean + (partitionAtomIndicator + (orderedBoundaryPartition coarse e) b) + +noncomputable def orderedLocalizedAtomDefectSq + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) + (b : (orderedBoundaryPartition coarse e).parts) : ℝ := + mean fun x => + orderedAtomBoundaryDefect fine coarse e upper a x ^ 2 * + partitionAtomIndicator + (orderedBoundaryPartition coarse e) b x + +theorem orderedLocalizedAtomDefectSq_eq + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) + (b : (orderedBoundaryPartition coarse e).parts) : + orderedLocalizedAtomDefectSq fine coarse e upper a b = + conditionalMean (orderedBoundaryPartition coarse e) + (fun x => + orderedAtomBoundaryDefect + fine coarse e upper a x ^ 2) + ((orderedBoundaryPartition coarse e).representative b) * + orderedBoundaryAtomMass coarse e b := by + exact + mean_mul_partitionAtomIndicator + (orderedBoundaryPartition coarse e) + (fun x => + orderedAtomBoundaryDefect fine coarse e upper a x ^ 2) + b + +theorem orderedLocalizedAtomDefectSq_le + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) + (b : (orderedBoundaryPartition coarse e).parts) + {β : ℝ} + (hβ : + conditionalMean (orderedBoundaryPartition coarse e) + (fun x => + orderedAtomBoundaryDefect + fine coarse e upper a x ^ 2) + ((orderedBoundaryPartition coarse e).representative b) ≤ + β) : + orderedLocalizedAtomDefectSq fine coarse e upper a b ≤ + β * orderedBoundaryAtomMass coarse e b := by + exact + mean_mul_partitionAtomIndicator_le + (orderedBoundaryPartition coarse e) + (fun x => + orderedAtomBoundaryDefect fine coarse e upper a x ^ 2) + b hβ + +noncomputable def orderedLargeDefectBaseAtoms + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) (β : ℝ) : + Finset (orderedBoundaryPartition coarse e).parts := + largeDefectBaseAtoms + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + upper a β + +noncomputable def orderedLargeDefectBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) (β : ℝ) : + Finset (Fin (j + 1) → G) := + largeDefectBaseSupport + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + upper a β + +noncomputable def orderedAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) (α β : ℝ) : + Finset (Fin (j + 1) → G) := + atomBadBaseSupport + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + upper a α β + +theorem mul_mean_indicator_orderedLargeDefectBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) + {β : ℝ} (hβ : 0 ≤ β) : + β * mean (finsetIndicator + (orderedLargeDefectBaseSupport + fine coarse e upper a β)) ≤ + orderedAtomEnergy fine e upper - + orderedAtomEnergy coarse e upper := by + exact + mul_mean_indicator_largeDefectBaseSupport_le_atomEnergy_sub + (orderedBoundaryPartition_mono hfc e) + upper a hβ + +theorem mean_indicator_orderedAtom_inter_badBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + {fine coarse : OrderedFacePartitionSystem G k j} + (hfc : OrderedFacePartitionRefines fine coarse) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (a.1 ∩ orderedAtomBadBaseSupport + fine coarse e upper a α β)) ≤ + α + + (orderedAtomEnergy fine e upper - + orderedAtomEnergy coarse e upper) / β := by + exact + mean_indicator_atom_inter_badBaseSupport_le + (orderedBoundaryPartition_mono hfc e) + upper a hα hβ + +def OrderedAtomIsGoodAtBoundary + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) (x : Fin (j + 1) → G) + (α β : ℝ) : Prop := + α ≤ + orderedBoundaryStructured coarse e + (partitionAtomIndicator upper a) x ∧ + conditionalMean (orderedBoundaryPartition coarse e) + (fun y => orderedAtomBoundaryDefect + fine coarse e upper a y ^ 2) x ≤ + β + +theorem orderedAtomIsGoodAtBoundary_of_not_mem_badBase + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) (x : Fin (j + 1) → G) + (α β : ℝ) + (hx : x ∉ orderedAtomBadBaseSupport + fine coarse e upper a α β) : + OrderedAtomIsGoodAtBoundary + fine coarse e upper a x α β := by + have hlow : + x ∉ smallAverageBaseSupport + (orderedBoundaryPartition coarse e) + (partitionAtomIndicator upper a) α := by + intro h + exact hx (Finset.mem_union_left _ h) + have hdefect : + x ∉ orderedLargeDefectBaseSupport + fine coarse e upper a β := by + intro h + exact hx (Finset.mem_union_right _ h) + constructor + · exact not_lt.mp + (fun h => + hlow + ((mem_smallAverageBaseSupport + (orderedBoundaryPartition coarse e) + (partitionAtomIndicator upper a) α x).2 h)) + · exact not_lt.mp + (fun h => + hdefect + ((mem_largeDefectBaseSupport + (orderedBoundaryPartition fine e) + (orderedBoundaryPartition coarse e) + upper a β x).2 h)) + +theorem OrderedAtomIsGoodAtBoundary.localized_defect + {G : Type*} [Fintype G] [DecidableEq G] + {k j : ℕ} + (fine coarse : OrderedFacePartitionSystem G k j) + (e : OrderedFace k (j + 1)) + (upper : FacePartition (Fin (j + 1) → G)) + (a : upper.parts) (x : Fin (j + 1) → G) + (α β : ℝ) + (hgood : + OrderedAtomIsGoodAtBoundary + fine coarse e upper a x α β) : + orderedLocalizedAtomDefectSq + fine coarse e upper a + (orderedBoundaryAtomAt coarse e x) ≤ + β * + orderedBoundaryAtomMass coarse e + (orderedBoundaryAtomAt coarse e x) := by + apply orderedLocalizedAtomDefectSq_le + have hrep : + (orderedBoundaryPartition coarse e).representative + (orderedBoundaryAtomAt coarse e x) ∈ + (orderedBoundaryPartition coarse e).part x := by + exact + (orderedBoundaryPartition coarse e).representative_mem + (orderedBoundaryAtomAt coarse e x) + have heq := + conditionalMean_eq_of_mem_part + (orderedBoundaryPartition coarse e) + (fun y => + orderedAtomBoundaryDefect + fine coarse e upper a y ^ 2) + hrep + rw [heq] + exact hgood.2 + +structure ClosedOrderedAtomConfiguration + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) (C : OrderedPartitionComplex G k r) where + witness : Fin k → G + atom : + (j : Fin (r + 1)) → + (e : OrderedFace k j.1) → + (C.partition j e).parts + mem_atom : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + orderedFaceTuple e witness ∈ (atom j e).1 + +namespace ClosedOrderedAtomConfiguration + +def ofTuple + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (C : OrderedPartitionComplex G k r) + (x : Fin k → G) : + ClosedOrderedAtomConfiguration G k r C where + witness := x + atom j e := + partitionAtomAt (C.partition j e) + (orderedFaceTuple e x) + mem_atom j e := + (C.partition j e).mem_part + (Finset.mem_univ (orderedFaceTuple e x)) + +theorem atom_eq_partitionAtomAt + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {C : OrderedPartitionComplex G k r} + (A : ClosedOrderedAtomConfiguration G k r C) + (j : Fin (r + 1)) (e : OrderedFace k j.1) : + A.atom j e = + partitionAtomAt (C.partition j e) + (orderedFaceTuple e A.witness) := by + apply Subtype.ext + exact + ((C.partition j e).part_eq_of_mem + (A.atom j e).2 (A.mem_atom j e)).symm + +def IsGoodAt + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r fine) + (j : ℕ) (hj : j < r) + (e : OrderedFace k (j + 1)) + (α β : ℝ) : Prop := + OrderedAtomIsGoodAtBoundary + (fine.layer j (Nat.le_of_lt hj)) + (coarse.layer j (Nat.le_of_lt hj)) + e + (fine.partition + ⟨j + 1, Nat.succ_lt_succ hj⟩ e) + (A.atom ⟨j + 1, Nat.succ_lt_succ hj⟩ e) + (orderedFaceTuple e A.witness) + α β + +def IsGood + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r fine) + (α β : ℕ → ℝ) : Prop := + ∀ (j : ℕ) (hj : j < r) (e : OrderedFace k (j + 1)), + A.IsGoodAt fine coarse j hj e (α (j + 1)) (β (j + 1)) + +theorem isGoodAt_of_not_mem_badBase + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r fine) + (j : ℕ) (hj : j < r) + (e : OrderedFace k (j + 1)) + (α β : ℝ) + (havoid : + orderedFaceTuple e A.witness ∉ + orderedAtomBadBaseSupport + (fine.layer j (Nat.le_of_lt hj)) + (coarse.layer j (Nat.le_of_lt hj)) + e + (fine.partition + ⟨j + 1, Nat.succ_lt_succ hj⟩ e) + (A.atom ⟨j + 1, Nat.succ_lt_succ hj⟩ e) + α β) : + A.IsGoodAt fine coarse j hj e α β := + orderedAtomIsGoodAtBoundary_of_not_mem_badBase + (fine.layer j (Nat.le_of_lt hj)) + (coarse.layer j (Nat.le_of_lt hj)) + e + (fine.partition + ⟨j + 1, Nat.succ_lt_succ hj⟩ e) + (A.atom ⟨j + 1, Nat.succ_lt_succ hj⟩ e) + (orderedFaceTuple e A.witness) + α β havoid + +theorem isGood_of_avoids_badBases + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r fine) + (α β : ℕ → ℝ) + (havoid : + ∀ (j : ℕ) (hj : j < r) + (e : OrderedFace k (j + 1)), + orderedFaceTuple e A.witness ∉ + orderedAtomBadBaseSupport + (fine.layer j (Nat.le_of_lt hj)) + (coarse.layer j (Nat.le_of_lt hj)) + e + (fine.partition + ⟨j + 1, Nat.succ_lt_succ hj⟩ e) + (A.atom ⟨j + 1, Nat.succ_lt_succ hj⟩ e) + (α (j + 1)) (β (j + 1))) : + A.IsGood fine coarse α β := by + intro j hj e + exact + A.isGoodAt_of_not_mem_badBase + fine coarse j hj e + (α (j + 1)) (β (j + 1)) + (havoid j hj e) + +end ClosedOrderedAtomConfiguration + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedPattern.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..685528a132586e34b67f63da9a3d081aa97fc6b9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedPattern.lean @@ -0,0 +1,397 @@ +import OAI.Combinatorics.Progressions.FixedDensity.Energy + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +abbrev OrderedFace (k r : ℕ) := + Fin r ↪o Fin k + +instance orderedFaceDecidableEq + (k r : ℕ) : DecidableEq (OrderedFace k r) := + Function.Injective.decidableEq + (f := fun e : OrderedFace k r => (e : Fin r → Fin k)) + DFunLike.coe_injective + +def orderedFaceTuple + {G : Type*} {k r : ℕ} + (e : OrderedFace k r) (x : Fin k → G) : + Fin r → G := + fun i => x (e i) + +abbrev OrderedFaceComplement + {k r : ℕ} (e : OrderedFace k r) := + {v : Fin k // v ∉ Set.range e} + +noncomputable def orderedFaceSumEquiv + {k r : ℕ} (e : OrderedFace k r) : + Fin r ⊕ OrderedFaceComplement e ≃ Fin k := + (Equiv.sumCongr e.toEmbedding.toEquivRange + (Equiv.refl (OrderedFaceComplement e))).trans + (Equiv.sumCompl + (fun v : Fin k => v ∈ Set.range e)) + +noncomputable def splitOrderedFaceEquiv + {G : Type*} {k r : ℕ} (e : OrderedFace k r) : + (Fin k → G) ≃ + ((Fin r → G) × (OrderedFaceComplement e → G)) := + (Equiv.piCongrLeft (fun _ : Fin k => G) + (orderedFaceSumEquiv e)).symm.trans + (Equiv.sumPiEquivProdPi + (fun _ : Fin r ⊕ OrderedFaceComplement e => G)) + +@[simp] +theorem splitOrderedFaceEquiv_fst + {G : Type*} {k r : ℕ} (e : OrderedFace k r) + (x : Fin k → G) : + (splitOrderedFaceEquiv e x).1 = + orderedFaceTuple e x := by + funext i + simp [splitOrderedFaceEquiv, orderedFaceSumEquiv, + orderedFaceTuple] + rfl + +def orderedFaceComplementTuple + {G : Type*} {k r : ℕ} + (e : OrderedFace k r) (x : Fin k → G) : + OrderedFaceComplement e → G := + fun v => x v.1 + +@[simp] +theorem splitOrderedFaceEquiv_snd + {G : Type*} {k r : ℕ} (e : OrderedFace k r) + (x : Fin k → G) : + (splitOrderedFaceEquiv e x).2 = + orderedFaceComplementTuple e x := by + funext v + simp [splitOrderedFaceEquiv, orderedFaceSumEquiv, + orderedFaceComplementTuple] + +@[simp] +theorem orderedFaceTuple_splitOrderedFaceEquiv_symm + {G : Type*} {k r : ℕ} (e : OrderedFace k r) + (y : Fin r → G) + (z : OrderedFaceComplement e → G) : + orderedFaceTuple e + ((splitOrderedFaceEquiv e).symm (y, z)) = y := by + rw [← splitOrderedFaceEquiv_fst] + simp + +@[simp] +theorem orderedFaceComplementTuple_splitOrderedFaceEquiv_symm + {G : Type*} {k r : ℕ} (e : OrderedFace k r) + (y : Fin r → G) + (z : OrderedFaceComplement e → G) : + orderedFaceComplementTuple e + ((splitOrderedFaceEquiv e).symm (y, z)) = z := by + rw [← splitOrderedFaceEquiv_snd] + simp + +theorem mean_splitOrderedFace + {G : Type*} [Fintype G] {k r : ℕ} + (e : OrderedFace k r) (f : (Fin k → G) → ℝ) : + mean f = + mean₂ (fun y : Fin r → G => + fun z : OrderedFaceComplement e → G => + f ((splitOrderedFaceEquiv e).symm (y, z))) := by + calc + mean f = + mean (fun p : + (Fin r → G) × (OrderedFaceComplement e → G) => + f ((splitOrderedFaceEquiv e).symm p)) := by + unfold mean + apply Fintype.expect_equiv + (splitOrderedFaceEquiv e) + intro x + simp + _ = _ := by + simpa only [Prod.eta] using + (mean_prod_type + (fun y : Fin r → G => + fun z : OrderedFaceComplement e → G => + f ((splitOrderedFaceEquiv e).symm (y, z)))) + +theorem exists_orderedFace_coordinate_not_mem_range + {k r : ℕ} {e f : OrderedFace k r} + (hef : e ≠ f) : + ∃ i : Fin r, e i ∉ Set.range f := by + classical + by_contra hnone + push Not at hnone + have hsubset : + Finset.univ.map e.toEmbedding ⊆ + Finset.univ.map f.toEmbedding := by + intro v hv + obtain ⟨i, _hi, rfl⟩ := Finset.mem_map.mp hv + obtain ⟨j, hj⟩ := hnone i + exact Finset.mem_map.mpr + ⟨j, Finset.mem_univ _, hj⟩ + have heq : + Finset.univ.map e.toEmbedding = + Finset.univ.map f.toEmbedding := by + apply Finset.eq_of_subset_of_card_le hsubset + simp + have hrange : Set.range e = Set.range f := by + ext v + have hv := Finset.ext_iff.mp heq v + simpa using hv + exact hef (OrderEmbedding.range_inj_of_wellFoundedLT.mp hrange) + +noncomputable def orderedFaceMissingCoordinate + {k r : ℕ} (e f : OrderedFace k r) (hef : e ≠ f) : + Fin r := + Classical.choose + (exists_orderedFace_coordinate_not_mem_range hef) + +theorem orderedFaceMissingCoordinate_not_mem_range + {k r : ℕ} (e f : OrderedFace k r) (hef : e ≠ f) : + e (orderedFaceMissingCoordinate e f hef) ∉ + Set.range f := + Classical.choose_spec + (exists_orderedFace_coordinate_not_mem_range hef) + +structure WeightedOrderedPattern + (G : Type*) (k r : ℕ) where + edgeWeight : OrderedFace k r → (Fin r → G) → ℝ + +namespace WeightedOrderedPattern + +noncomputable def patternWeight + {G : Type*} {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (x : Fin k → G) : ℝ := + ∏ e : OrderedFace k r, + H.edgeWeight e (orderedFaceTuple e x) + +noncomputable def patternCount + {G : Type*} [Fintype G] {k r : ℕ} + (H : WeightedOrderedPattern G k r) : ℝ := + mean H.patternWeight + +def EdgeWeightsInUnitInterval + {G : Type*} {k r : ℕ} + (H : WeightedOrderedPattern G k r) : Prop := + ∀ e y, 0 ≤ H.edgeWeight e y ∧ H.edgeWeight e y ≤ 1 + +theorem patternWeight_nonneg + {G : Type*} {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (hH : ∀ e y, 0 ≤ H.edgeWeight e y) + (x : Fin k → G) : + 0 ≤ H.patternWeight x := by + exact Finset.prod_nonneg fun e _ => hH e _ + +theorem patternCount_nonneg + {G : Type*} [Fintype G] {k r : ℕ} + (H : WeightedOrderedPattern G k r) + (hH : ∀ e y, 0 ≤ H.edgeWeight e y) : + 0 ≤ H.patternCount := + mean_nonneg (H.patternWeight_nonneg hH) + +end WeightedOrderedPattern + +structure OrderedPattern + (G : Type*) (k r : ℕ) where + edge : OrderedFace k r → (Fin r → G) → Prop + +namespace OrderedPattern + +def IsOccurrence + {G : Type*} {k r : ℕ} + (H : OrderedPattern G k r) + (x : Fin k → G) : Prop := + ∀ e, H.edge e (orderedFaceTuple e x) + +noncomputable def occurrenceFinset + {G : Type*} [Fintype G] [DecidableEq G] {k r : ℕ} + (H : OrderedPattern G k r) : + Finset (Fin k → G) := by + classical + exact Finset.univ.filter H.IsOccurrence + +@[simp] +theorem mem_occurrenceFinset + {G : Type*} [Fintype G] [DecidableEq G] {k r : ℕ} + (H : OrderedPattern G k r) + (x : Fin k → G) : + x ∈ H.occurrenceFinset ↔ H.IsOccurrence x := by + simp [occurrenceFinset] + +noncomputable def toWeighted + {G : Type*} {k r : ℕ} + (H : OrderedPattern G k r) : + WeightedOrderedPattern G k r := by + classical + exact + { edgeWeight := fun e y => + if H.edge e y then 1 else 0 } + +theorem toWeighted_edgeWeight_nonneg + {G : Type*} {k r : ℕ} + (H : OrderedPattern G k r) + (e : OrderedFace k r) (y : Fin r → G) : + 0 ≤ H.toWeighted.edgeWeight e y := by + classical + by_cases h : H.edge e y <;> + simp [toWeighted, h] + +theorem toWeighted_edgeWeight_le_one + {G : Type*} {k r : ℕ} + (H : OrderedPattern G k r) + (e : OrderedFace k r) (y : Fin r → G) : + H.toWeighted.edgeWeight e y ≤ 1 := by + classical + by_cases h : H.edge e y <;> + simp [toWeighted, h] + +theorem toWeighted_unitInterval + {G : Type*} {k r : ℕ} + (H : OrderedPattern G k r) : + H.toWeighted.EdgeWeightsInUnitInterval := + fun e y => + ⟨H.toWeighted_edgeWeight_nonneg e y, + H.toWeighted_edgeWeight_le_one e y⟩ + +theorem toWeighted_patternWeight_of_occurrence + {G : Type*} {k r : ℕ} + (H : OrderedPattern G k r) + {x : Fin k → G} (hx : H.IsOccurrence x) : + H.toWeighted.patternWeight x = 1 := by + classical + unfold WeightedOrderedPattern.patternWeight + apply Finset.prod_eq_one + intro e _he + simp [toWeighted, hx e] + +theorem toWeighted_patternWeight_of_not_occurrence + {G : Type*} {k r : ℕ} + (H : OrderedPattern G k r) + {x : Fin k → G} (hx : ¬H.IsOccurrence x) : + H.toWeighted.patternWeight x = 0 := by + classical + unfold WeightedOrderedPattern.patternWeight + obtain ⟨e, he⟩ := not_forall.mp hx + apply Finset.prod_eq_zero (Finset.mem_univ e) + simp [toWeighted, he] + +theorem toWeighted_patternCount_eq + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (H : OrderedPattern G k r) : + H.toWeighted.patternCount = + (H.occurrenceFinset.card : ℝ) / + Fintype.card (Fin k → G) := by + rw [WeightedOrderedPattern.patternCount] + have hfun : + H.toWeighted.patternWeight = + finsetIndicator H.occurrenceFinset := by + funext x + by_cases hx : H.IsOccurrence x + · rw [H.toWeighted_patternWeight_of_occurrence hx, + finsetIndicator_of_mem] + exact (H.mem_occurrenceFinset x).2 hx + · rw [H.toWeighted_patternWeight_of_not_occurrence hx, + finsetIndicator_of_not_mem] + exact fun hmem => + hx ((H.mem_occurrenceFinset x).1 hmem) + rw [hfun, mean_finsetIndicator] + +abbrev DeletionFamily + {G : Type*} [DecidableEq G] (k r : ℕ) := + (e : OrderedFace k r) → Finset (Fin r → G) + +def IsCover + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (H : OrderedPattern G k r) + (D : DeletionFamily (G := G) k r) : Prop := + ∀ x, x ∈ H.occurrenceFinset → + ∃ e, orderedFaceTuple e x ∈ D e + +noncomputable def faceDeletionDensity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (D : DeletionFamily (G := G) k r) + (e : OrderedFace k r) : ℝ := + (D e).card / Fintype.card (Fin r → G) + +def emptyDeletion + {G : Type*} [DecidableEq G] (k r : ℕ) : + DeletionFamily (G := G) k r := + fun _ => ∅ + +@[simp] +theorem faceDeletionDensity_empty + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (e : OrderedFace k r) : + faceDeletionDensity + (emptyDeletion (G := G) k r) e = 0 := by + simp [faceDeletionDensity, emptyDeletion] + +end OrderedPattern + +def HasUniformOrderedPatternRemoval (k r : ℕ) : Prop := + ∀ ε : ℝ, 0 < ε → + ∃ c : ℝ, 0 < c ∧ + ∀ (G : Type) [Fintype G] [DecidableEq G] [Nonempty G], + ∀ H : OrderedPattern G k r, + H.toWeighted.patternCount < c → + ∃ D : OrderedPattern.DeletionFamily + (G := G) k r, + H.IsCover D ∧ + ∀ e, OrderedPattern.faceDeletionDensity D e ≤ ε + +theorem OrderedPattern.isOccurrence_all_of_rank_zero + {G : Type*} {k : ℕ} + (H : OrderedPattern G k 0) + {x₀ : Fin k → G} (hx₀ : H.IsOccurrence x₀) + (x : Fin k → G) : + H.IsOccurrence x := by + intro e + have htuple : + orderedFaceTuple e x = + orderedFaceTuple e x₀ := by + funext i + exact Fin.elim0 i + rw [htuple] + exact hx₀ e + +theorem hasUniformOrderedPatternRemoval_zero (k : ℕ) : + HasUniformOrderedPatternRemoval k 0 := by + intro ε hε + refine ⟨1, by norm_num, ?_⟩ + intro G _instFintype _instDecidableEq _instNonempty H hcount + have hempty : H.occurrenceFinset = ∅ := by + by_contra hne + obtain ⟨x₀, hx₀⟩ := Finset.nonempty_iff_ne_empty.mpr hne + have hx₀' : H.IsOccurrence x₀ := + (H.mem_occurrenceFinset x₀).1 hx₀ + have hall : H.occurrenceFinset = Finset.univ := by + ext x + simp only [H.mem_occurrenceFinset, + Finset.mem_univ, iff_true] + exact H.isOccurrence_all_of_rank_zero hx₀' x + have hcount_one : + H.toWeighted.patternCount = 1 := by + rw [H.toWeighted_patternCount_eq, hall] + simp + rw [hcount_one] at hcount + exact (lt_irrefl 1) hcount + refine + ⟨OrderedPattern.emptyDeletion k 0, ?_, + fun e => ?_⟩ + · intro x hx + rw [hempty] at hx + simp at hx + · rw [OrderedPattern.faceDeletionDensity_empty] + exact hε.le + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedPatternPartition.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedPatternPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..adb8f95acd82b1f8091aaca9e3748d43d389cacc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedPatternPartition.lean @@ -0,0 +1,772 @@ +import OAI.Combinatorics.Progressions.FixedDensity.BoundaryBernoulli +import OAI.Combinatorics.Progressions.FixedDensity.OrderedGoodAtoms + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace OrderedPartitionComplex + +def topLayer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) : + OrderedFacePartitionSystem G k r := + C.partition (Fin.last r) + +def dropTop + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k (r + 1)) : + OrderedPartitionComplex G k r where + partition j := C.partition j.castSucc + +def appendTop + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k (r + 1)) : + OrderedPartitionComplex G k (r + 1) where + partition j := + Fin.lastCases top (fun i => C.partition i) j + +def withTopLayer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k r) : + OrderedPartitionComplex G k r where + partition j := + Fin.lastCases top (fun i => C.partition i.castSucc) j + +@[simp] +theorem topLayer_appendTop + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k (r + 1)) : + (appendTop C top).topLayer = top := by + simp [topLayer, appendTop] + +@[simp] +theorem dropTop_appendTop + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k (r + 1)) : + (appendTop C top).dropTop = C := by + cases C with + | mk partition => + simp [dropTop, appendTop] + +@[simp] +theorem topLayer_withTopLayer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k r) : + (withTopLayer C top).topLayer = top := by + simp [topLayer, withTopLayer] + +@[simp] +theorem withTopLayer_partition_castSucc + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k (r + 1)) + (top : OrderedFacePartitionSystem G k (r + 1)) + (j : Fin (r + 1)) : + (withTopLayer C top).partition j.castSucc = + C.partition j.castSucc := by + simp [withTopLayer] + +@[simp] +theorem appendTop_partition_castSucc + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k (r + 1)) + (j : Fin (r + 1)) : + (appendTop C top).partition j.castSucc = + C.partition j := by + simp [appendTop] + +@[simp] +theorem appendTop_partition_last + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k (r + 1)) : + (appendTop C top).partition (Fin.last (r + 1)) = + top := by + simp [appendTop] + +@[simp] +theorem withTopLayer_partition_castSucc_general + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k r) + (i : Fin r) : + (withTopLayer C top).partition i.castSucc = + C.partition i.castSucc := by + simp [withTopLayer] + +@[simp] +theorem appendTop_dropTop_topLayer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k (r + 1)) : + appendTop C.dropTop C.topLayer = C := by + cases C with + | mk partition => + simp only [dropTop, topLayer, appendTop] + congr 1 + funext j e + cases j using Fin.lastCases <;> + simp only [Fin.lastCases_last, + Fin.lastCases_castSucc] + +theorem dropTop_refines + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {fine coarse : OrderedPartitionComplex G k (r + 1)} + (hfc : fine.Refines coarse) : + fine.dropTop.Refines coarse.dropTop := by + intro j e + exact hfc j.castSucc e + +theorem appendTop_refines + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {fine coarse : OrderedPartitionComplex G k r} + {fineTop coarseTop : + OrderedFacePartitionSystem G k (r + 1)} + (hfc : fine.Refines coarse) + (htop : OrderedFacePartitionRefines fineTop coarseTop) : + (appendTop fine fineTop).Refines + (appendTop coarse coarseTop) := by + intro j e + cases j using Fin.lastCases with + | last => + simp only [appendTop, Fin.lastCases_last] + change OrderedFace k (r + 1) at e + change fineTop e ≤ coarseTop e + exact htop e + | cast i => + simp only [appendTop, Fin.lastCases_castSucc] + change OrderedFace k i.1 at e + change fine.partition i e ≤ coarse.partition i e + exact hfc i e + +theorem withTopLayer_refines + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (top : OrderedFacePartitionSystem G k r) + (htop : OrderedFacePartitionRefines top C.topLayer) : + (withTopLayer C top).Refines C := by + intro j e + cases j using Fin.lastCases with + | last => + simp only [withTopLayer, Fin.lastCases_last] + change OrderedFace k r at e + change top e ≤ C.partition (Fin.last r) e + exact htop e + | cast i => + simp only [withTopLayer, Fin.lastCases_castSucc] + exact le_rfl + +end OrderedPartitionComplex + +structure OrderedCoarseFineComplex + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) where + coarse : OrderedPartitionComplex G k r + fine : OrderedPartitionComplex G k r + refines : fine.Refines coarse + +namespace OrderedCoarseFineComplex + +theorem boundaryRefines + {G : Type*} [Fintype G] [DecidableEq G] + {k r j : ℕ} + (P : OrderedCoarseFineComplex G k r) + (hj : j < r) + (e : OrderedFace k (j + 1)) : + P.fine.boundary hj e ≤ P.coarse.boundary hj e := + OrderedPartitionComplex.boundary_mono P.refines hj e + +noncomputable def faceAtomEnergyGap + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : ℝ := + orderedAtomEnergy + (P.fine.partition j.castSucc) e + (P.fine.partition j.succ e) - + orderedAtomEnergy + (P.coarse.partition j.castSucc) e + (P.fine.partition j.succ e) + +theorem faceAtomEnergyGap_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : + 0 ≤ P.faceAtomEnergyGap j e := by + apply sub_nonneg.mpr + exact orderedAtomEnergy_mono + (fun f => P.refines j.castSucc f) + e (P.fine.partition j.succ e) + +noncomputable def layerAtomEnergyGap + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) : ℝ := + orderedLayerAtomEnergy + (P.fine.partition j.castSucc) + (P.fine.partition j.succ) - + orderedLayerAtomEnergy + (P.coarse.partition j.castSucc) + (P.fine.partition j.succ) + +theorem layerAtomEnergyGap_eq_sum_face + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) : + P.layerAtomEnergyGap j = + ∑ e : OrderedFace k (j.1 + 1), + P.faceAtomEnergyGap j e := by + unfold layerAtomEnergyGap faceAtomEnergyGap + orderedLayerAtomEnergy + rw [Finset.sum_sub_distrib] + rfl + +theorem layerAtomEnergyGap_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) : + 0 ≤ P.layerAtomEnergyGap j := by + apply sub_nonneg.mpr + exact orderedLayerAtomEnergy_mono + (fun e => P.refines j.castSucc e) + (P.fine.partition j.succ) + +theorem layerAtomEnergyGap_le_card + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) : + P.layerAtomEnergyGap j ≤ + (Fintype.card (OrderedFace k (j.1 + 1)) : ℝ) := by + have hfine := + orderedLayerAtomEnergy_le_card + (P.fine.partition j.castSucc) + (P.fine.partition j.succ) + have hcoarse := + orderedLayerAtomEnergy_nonneg + (P.coarse.partition j.castSucc) + (P.fine.partition j.succ) + have hfine' : + orderedLayerAtomEnergy + (P.fine.partition j.castSucc) + (P.fine.partition j.succ) ≤ + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) := by + convert hfine using 1 + rfl + unfold layerAtomEnergyGap + linarith + +noncomputable def totalAtomEnergyGap + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : ℝ := + ∑ j : Fin r, P.layerAtomEnergyGap j + +theorem totalAtomEnergyGap_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : + 0 ≤ P.totalAtomEnergyGap := by + exact Finset.sum_nonneg fun j _ => + P.layerAtomEnergyGap_nonneg j + +theorem faceAtomEnergyGap_le_layer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : + P.faceAtomEnergyGap j e ≤ + P.layerAtomEnergyGap j := by + rw [P.layerAtomEnergyGap_eq_sum_face j] + exact Finset.single_le_sum + (fun f _ => P.faceAtomEnergyGap_nonneg j f) + (Finset.mem_univ e) + +theorem layerAtomEnergyGap_le_total + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) : + P.layerAtomEnergyGap j ≤ + P.totalAtomEnergyGap := by + unfold totalAtomEnergyGap + exact Finset.single_le_sum + (fun i _ => P.layerAtomEnergyGap_nonneg i) + (Finset.mem_univ j) + +theorem faceAtomEnergyGap_le_total + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : + P.faceAtomEnergyGap j e ≤ + P.totalAtomEnergyGap := + (P.faceAtomEnergyGap_le_layer j e).trans + (P.layerAtomEnergyGap_le_total j) + +theorem totalAtomEnergyGap_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : + P.totalAtomEnergyGap ≤ + ∑ j : Fin r, + (Fintype.card (OrderedFace k (j.1 + 1)) : ℝ) := by + exact Finset.sum_le_sum fun j _ => + P.layerAtomEnergyGap_le_card j + +end OrderedCoarseFineComplex + +abbrev OrderedRegularityTolerance (r : ℕ) := Fin r → ℝ + +abbrev OrderedRegularityBudget (r : ℕ) := Fin r → ℕ + +abbrev OrderedRegularityStepSchedule (r : ℕ) := Fin r → ℕ + +def IsFullyPreliminaryOrderedRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (ε : OrderedRegularityTolerance r) : Prop := + ∀ j : Fin r, + IsPreliminaryOrderedRegular + (C.partition j.castSucc) + (C.partition j.succ) + (ε j) + +def IsOrderedRegularityBudget + (k r : ℕ) + (ε : OrderedRegularityTolerance r) + (m : OrderedRegularityBudget r) : Prop := + ∀ j : Fin r, + (Fintype.card (OrderedFace k (j.1 + 1)) : ℝ) < + (m j : ℝ) * (ε j) ^ 2 + +def HasOrderedRegularityComplexityBound + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) + (steps : OrderedRegularityStepSchedule r) : Prop := + ∀ (j : Fin r) (e : OrderedFace k j.1), + FacePartition.complexity + (fine.partition j.castSucc e) ≤ + (2 ^ (j.1 + 1)) ^ (steps j) * + FacePartition.complexity + (coarse.partition j.castSucc e) + +structure FullOrderedRegularityCertificate + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (coarse : OrderedPartitionComplex G k r) + (ε : OrderedRegularityTolerance r) + (m : OrderedRegularityBudget r) where + steps : OrderedRegularityStepSchedule r + fine : OrderedPartitionComplex G k r + refines : fine.Refines coarse + topLayer_eq : + fine.topLayer = coarse.topLayer + steps_lt : ∀ j, steps j < m j + regular : + IsFullyPreliminaryOrderedRegular fine ε + complexity : + HasOrderedRegularityComplexityBound + fine coarse steps + +theorem exists_fullOrderedRegularityCertificate + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (ε : OrderedRegularityTolerance r) + (m : OrderedRegularityBudget r) + (hε : ∀ j, 0 ≤ ε j) + (hbudget : IsOrderedRegularityBudget k r ε m) : + Nonempty (FullOrderedRegularityCertificate C ε m) := by + induction r with + | zero => + let steps : OrderedRegularityStepSchedule 0 := + fun j => Fin.elim0 j + refine ⟨{ + steps := steps + fine := C + refines := OrderedPartitionComplex.Refines.refl C + topLayer_eq := rfl + steps_lt := ?_ + regular := ?_ + complexity := ?_ }⟩ + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + | succ r ih => + let lowerComplex : OrderedPartitionComplex G k r := + C.dropTop + let upper : OrderedFacePartitionSystem G k (r + 1) := + C.topLayer + have hεtop : 0 ≤ ε (Fin.last r) := + hε (Fin.last r) + have hbudgetTop : + (Fintype.card (OrderedFace k (r + 1)) : ℝ) < + (m (Fin.last r) : ℝ) * + (ε (Fin.last r)) ^ 2 := by + have hb := hbudget (Fin.last r) + change + (Fintype.card (OrderedFace k (r + 1)) : ℝ) < + (m (Fin.last r) : ℝ) * + (ε (Fin.last r)) ^ 2 at hb + exact hb + obtain ⟨n, lower, hn, hlowerRefines, + hlowerRegular, hlowerComplexity⟩ := + exists_preliminaryOrderedRegular_refinement_with_complexity_before + lowerComplex.topLayer upper hεtop hbudgetTop + let prepared : OrderedPartitionComplex G k r := + lowerComplex.withTopLayer lower + have hpreparedRefines : + prepared.Refines lowerComplex := by + exact OrderedPartitionComplex.withTopLayer_refines + lowerComplex lower hlowerRefines + let εlower : OrderedRegularityTolerance r := + fun j => ε j.castSucc + let mlower : OrderedRegularityBudget r := + fun j => m j.castSucc + have hεlower : ∀ j, 0 ≤ εlower j := by + intro j + exact hε j.castSucc + have hbudgetLower : + IsOrderedRegularityBudget k r εlower mlower := by + intro j + exact hbudget j.castSucc + obtain ⟨lowerCertificate⟩ := + ih prepared εlower mlower hεlower hbudgetLower + let fine : OrderedPartitionComplex G k (r + 1) := + lowerCertificate.fine.appendTop upper + let steps : OrderedRegularityStepSchedule (r + 1) := + fun j => + Fin.lastCases n lowerCertificate.steps j + have hlowerCertificateTop : + lowerCertificate.fine.topLayer = lower := by + calc + lowerCertificate.fine.topLayer = + prepared.topLayer := + lowerCertificate.topLayer_eq + _ = lower := + OrderedPartitionComplex.topLayer_withTopLayer + lowerComplex lower + refine ⟨{ + steps := steps + fine := fine + refines := ?_ + topLayer_eq := ?_ + steps_lt := ?_ + regular := ?_ + complexity := ?_ }⟩ + · have hprefixFinal : + lowerCertificate.fine.Refines lowerComplex := + OrderedPartitionComplex.Refines.trans + lowerCertificate.refines hpreparedRefines + have happended : + fine.Refines + (lowerComplex.appendTop upper) := by + exact OrderedPartitionComplex.appendTop_refines + hprefixFinal + (OrderedFacePartitionRefines.refl upper) + simpa [fine, lowerComplex, upper] using happended + · simp [fine, upper] + · intro j + cases j using Fin.lastCases with + | last => + simpa [steps] using hn + | cast i => + simpa [steps] using + lowerCertificate.steps_lt i + · intro j + cases j using Fin.lastCases with + | last => + have htop : + IsPreliminaryOrderedRegular + lowerCertificate.fine.topLayer + upper (ε (Fin.last r)) := by + rw [hlowerCertificateTop] + exact hlowerRegular + simp only [fine, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + Fin.succ_last] + change + @IsPreliminaryOrderedRegular + G _ _ k r + (lowerCertificate.fine.partition + (Fin.last r)) + upper (ε (Fin.last r)) + exact htop + | cast i => + have hi := lowerCertificate.regular i + simp only [fine, εlower, + OrderedPartitionComplex.appendTop_partition_castSucc, + Fin.succ_castSucc] + change + @IsPreliminaryOrderedRegular + G _ _ k i.1 + (lowerCertificate.fine.partition i.castSucc) + (lowerCertificate.fine.partition i.succ) + (ε i.castSucc) + exact hi + · intro j + cases j using Fin.lastCases with + | last => + intro e + have htop : + FacePartition.complexity + (lowerCertificate.fine.topLayer e) ≤ + (2 ^ (r + 1)) ^ n * + FacePartition.complexity + (lowerComplex.topLayer e) := by + rw [hlowerCertificateTop] + exact hlowerComplexity e + simp only [fine, steps, + OrderedPartitionComplex.appendTop_partition_castSucc, + Fin.lastCases_last] + change OrderedFace k r at e + change + FacePartition.complexity + (lowerCertificate.fine.partition + (Fin.last r) e) ≤ + (2 ^ (r + 1)) ^ n * + FacePartition.complexity + (C.partition + (Fin.last r).castSucc e) + exact htop + | cast i => + intro e + change OrderedFace k i.1 at e + have hi := lowerCertificate.complexity i e + simp only [prepared, lowerComplex, + OrderedPartitionComplex.withTopLayer, + OrderedPartitionComplex.dropTop, + Fin.lastCases_castSucc] at hi + simp only [fine, steps, εlower, mlower, + OrderedPartitionComplex.appendTop_partition_castSucc, + Fin.lastCases_castSucc] + change + FacePartition.complexity + (lowerCertificate.fine.partition + i.castSucc e) ≤ + (2 ^ (i.1 + 1)) ^ + lowerCertificate.steps i * + FacePartition.complexity + (C.partition + i.castSucc.castSucc e) + exact hi + +theorem exists_fullyPreliminaryOrderedRegular_refinement + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (ε : OrderedRegularityTolerance r) + (m : OrderedRegularityBudget r) + (hε : ∀ j, 0 ≤ ε j) + (hbudget : IsOrderedRegularityBudget k r ε m) : + ∃ (steps : OrderedRegularityStepSchedule r) + (fine : OrderedPartitionComplex G k r), + fine.Refines C ∧ + fine.topLayer = C.topLayer ∧ + (∀ j, steps j < m j) ∧ + IsFullyPreliminaryOrderedRegular fine ε ∧ + HasOrderedRegularityComplexityBound + fine C steps := by + obtain ⟨certificate⟩ := + exists_fullOrderedRegularityCertificate + C ε m hε hbudget + exact ⟨certificate.steps, certificate.fine, + certificate.refines, certificate.topLayer_eq, + certificate.steps_lt, certificate.regular, + certificate.complexity⟩ + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +noncomputable def OrderedPattern.edgeFinset + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) + (e : OrderedFace k r) : Finset (Fin r → G) := by + classical + exact Finset.univ.filter (H.edge e) + +@[simp] +theorem OrderedPattern.mem_edgeFinset + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) + (e : OrderedFace k r) (y : Fin r → G) : + y ∈ H.edgeFinset e ↔ H.edge e y := by + simp [OrderedPattern.edgeFinset] + +noncomputable def orderedPatternTopPartition + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) : + OrderedFacePartitionSystem G k r := by + classical + exact fun e => + FacePartition.generatedBy ({H.edgeFinset e} : + Finset (Finset (Fin r → G))) + +theorem complexity_orderedPatternTopPartition_le_two + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) + (e : OrderedFace k r) : + FacePartition.complexity + (orderedPatternTopPartition H e) ≤ 2 := by + simpa [orderedPatternTopPartition] using + FacePartition.complexity_generatedBy_le + ({H.edgeFinset e} : + Finset (Finset (Fin r → G))) + +theorem mem_of_mem_part_of_le_generatedBy_singleton + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + {P : FacePartition Ω} {S : Finset Ω} + (hP : P ≤ FacePartition.generatedBy + ({S} : Finset (Finset Ω))) + {x y : Ω} (hx : x ∈ S) (hy : y ∈ P.part x) : + y ∈ S := by + have hyGenerated : + y ∈ + (FacePartition.generatedBy + ({S} : Finset (Finset Ω))).part x := + FacePartition.part_subset_of_le hP x hy + have hsignature := + (FacePartition.mem_part_generatedBy_iff + ({S} : Finset (Finset Ω)) x y).1 hyGenerated + exact (hsignature S (by simp)).1 hx + +theorem orderedPattern_edge_of_mem_refinedTopAtom + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) + {P : OrderedFacePartitionSystem G k r} + (hP : OrderedFacePartitionRefines P + (orderedPatternTopPartition H)) + (e : OrderedFace k r) {x y : Fin r → G} + (hx : H.edge e x) (hy : y ∈ (P e).part x) : + H.edge e y := by + rw [← H.mem_edgeFinset e y] + exact + mem_of_mem_part_of_le_generatedBy_singleton + (hP e) + ((H.mem_edgeFinset e x).2 hx) hy + +def indiscreteOrderedPartitionComplex + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) : OrderedPartitionComplex G k r where + partition _ _ := FacePartition.indiscrete + +noncomputable def orderedPatternInitialComplex + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) : + OrderedPartitionComplex G k r := + (indiscreteOrderedPartitionComplex G k r).withTopLayer + (orderedPatternTopPartition H) + +@[simp] +theorem orderedPatternInitialComplex_topLayer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) : + (orderedPatternInitialComplex H).topLayer = + orderedPatternTopPartition H := by + exact OrderedPartitionComplex.topLayer_withTopLayer _ _ + +theorem orderedPatternTopPartition_refines_of_complex_refines_initial + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) + {C : OrderedPartitionComplex G k r} + (hC : C.Refines (orderedPatternInitialComplex H)) : + OrderedFacePartitionRefines C.topLayer + (orderedPatternTopPartition H) := by + intro e + change + C.partition (Fin.last r) e ≤ + orderedPatternTopPartition H e + rw [← orderedPatternInitialComplex_topLayer H] + exact hC (Fin.last r) e + +theorem ClosedOrderedAtomConfiguration.edge_of_mem_topAtom + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) + {C : OrderedPartitionComplex G k r} + (hC : OrderedFacePartitionRefines C.topLayer + (orderedPatternTopPartition H)) + (A : ClosedOrderedAtomConfiguration G k r C) + (hA : H.IsOccurrence A.witness) + (e : OrderedFace k r) (y : Fin r → G) + (hy : y ∈ (A.atom (Fin.last r) e).1) : + H.edge e y := by + apply + orderedPattern_edge_of_mem_refinedTopAtom + H hC e (hA e) + have hw : + orderedFaceTuple e A.witness ∈ + (A.atom (Fin.last r) e).1 := + A.mem_atom (Fin.last r) e + have hpart : + (C.topLayer e).part + (orderedFaceTuple e A.witness) = + (A.atom (Fin.last r) e).1 := by + exact + (C.topLayer e).part_eq_of_mem + (A.atom (Fin.last r) e).2 hw + rwa [hpart] + +theorem ClosedOrderedAtomConfiguration.isOccurrence_of_mem_topAtoms + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (H : OrderedPattern G k r) + {C : OrderedPartitionComplex G k r} + (hC : OrderedFacePartitionRefines C.topLayer + (orderedPatternTopPartition H)) + (A : ClosedOrderedAtomConfiguration G k r C) + (hA : H.IsOccurrence A.witness) + (x : Fin k → G) + (hx : + ∀ e : OrderedFace k r, + orderedFaceTuple e x ∈ + (A.atom (Fin.last r) e).1) : + H.IsOccurrence x := by + intro e + exact A.edge_of_mem_topAtom H hC hA e + (orderedFaceTuple e x) (hx e) + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRegularizedCells.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRegularizedCells.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3e8279c14fb23c81cb9da309e0d9c453fefa9b9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRegularizedCells.lean @@ -0,0 +1,585 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedCounting + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +def indiscreteOrderedRegularitySystem + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) : + OrderedRegularitySystem G k r := + fun _ => ⟨FacePartition.indiscrete⟩ + +@[simp] +theorem indiscreteOrderedRegularitySystem_partition + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (e : OrderedFace k r) : + (indiscreteOrderedRegularitySystem G k r e).partition = + FacePartition.indiscrete := + rfl + +structure GeneratedOrderedPatternRegularization + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) + (H : WeightedOrderedPattern G k r) + (ε : ℝ) where + state : OrderedRegularitySystem G k r + generators : + (e : OrderedFace k r) → + Finset (BooleanCutTest (Fin r → G)) + budgetLength : OrderedFace k r → ℕ + stepIndex : OrderedFace k r → ℕ + budget_large : + ∀ e, 1 < (budgetLength e : ℝ) * ε ^ 2 + step_lt_budget : + ∀ e, stepIndex e < budgetLength e + partition_eq_generated : + ∀ e, (state e).partition = + FacePartition.generatedBy (generators e) + generators_supported : + ∀ e, generators e ⊆ booleanFaceCutSupports G r + generator_card_le : + ∀ e, (generators e).card ≤ stepIndex e + regular : + ∀ e, (state e).IsFaceCutRegular + (H.edgeWeight e) ε + count_close : + |H.patternCount - + (regularizedOrderedPattern H state).patternCount| ≤ + (Fintype.card (OrderedFace k r) : ℝ) * ε + complexity_le : + ∀ e, FacePartition.complexity (state e).partition ≤ + 2 ^ stepIndex e + +theorem exists_generatedOrderedPatternRegularization + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} (hr : 0 < r) + (H : WeightedOrderedPattern G k r) + (hH : H.EdgeWeightsInUnitInterval) + {ε : ℝ} (hε : 0 < ε) : + Nonempty + (GeneratedOrderedPatternRegularization + G k r H ε) := by + classical + let S₀ := + indiscreteOrderedRegularitySystem G k r + have he (e : OrderedFace k r) : + ∃ m i : ℕ, + ∃ T : FaceRegularityState (Fin r → G), + ∃ F : Finset (BooleanCutTest (Fin r → G)), + 1 < (m : ℝ) * ε ^ 2 ∧ + i < m ∧ + T.partition = + FacePartition.join (S₀ e).partition + (FacePartition.generatedBy F) ∧ + F ⊆ booleanFaceCutSupports G r ∧ + F.card ≤ i ∧ + T.IsFaceCutRegular (H.edgeWeight e) ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * + FacePartition.complexity + (S₀ e).partition := by + exact + (S₀ e).exists_faceCutRegular_refinement_with_generators + hr (H.edgeWeight e) + (fun y => (hH e y).1) + (fun y => (hH e y).2) hε + choose m i S F hdata using he + have hbudget : + ∀ e, 1 < (m e : ℝ) * ε ^ 2 := + fun e => (hdata e).1 + have hstep : + ∀ e, i e < m e := + fun e => (hdata e).2.1 + have hpartition : + ∀ e, (S e).partition = + FacePartition.generatedBy (F e) := by + intro e + have h := (hdata e).2.2.1 + simpa [S₀, indiscreteOrderedRegularitySystem, + FacePartition.join, FacePartition.indiscrete] using h + have hsupported : + ∀ e, F e ⊆ booleanFaceCutSupports G r := + fun e => (hdata e).2.2.2.1 + have hcard : + ∀ e, (F e).card ≤ i e := + fun e => (hdata e).2.2.2.2.1 + have hregular : + ∀ e, (S e).IsFaceCutRegular + (H.edgeWeight e) ε := + fun e => (hdata e).2.2.2.2.2.1 + have hcomplexity : + ∀ e, FacePartition.complexity (S e).partition ≤ + 2 ^ i e := by + intro e + have h := (hdata e).2.2.2.2.2.2 + simpa [S₀, indiscreteOrderedRegularitySystem] using h + exact + ⟨{ + state := S + generators := F + budgetLength := m + stepIndex := i + budget_large := hbudget + step_lt_budget := hstep + partition_eq_generated := hpartition + generators_supported := hsupported + generator_card_le := hcard + regular := hregular + count_close := + patternCount_abs_sub_regularizedOrderedPattern_le + H hH S hregular + complexity_le := hcomplexity + }⟩ + +theorem exists_generatedOrderedPatternRegularization_before + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} (hr : 0 < r) + (H : WeightedOrderedPattern G k r) + (hH : H.EdgeWeightsInUnitInterval) + {ε : ℝ} {m : ℕ} + (hε : 0 ≤ ε) + (hlong : 1 < (m : ℝ) * ε ^ 2) : + ∃ R : GeneratedOrderedPatternRegularization + G k r H ε, + ∀ e, R.stepIndex e < m := by + classical + let S₀ := + indiscreteOrderedRegularitySystem G k r + have he (e : OrderedFace k r) : + ∃ i : ℕ, + ∃ T : FaceRegularityState (Fin r → G), + ∃ F : Finset (BooleanCutTest (Fin r → G)), + i < m ∧ + T.partition = + FacePartition.join (S₀ e).partition + (FacePartition.generatedBy F) ∧ + F ⊆ booleanFaceCutSupports G r ∧ + F.card ≤ i ∧ + T.IsFaceCutRegular (H.edgeWeight e) ε ∧ + FacePartition.complexity T.partition ≤ + 2 ^ i * + FacePartition.complexity + (S₀ e).partition := by + exact + (S₀ e).exists_faceCutRegular_refinement_with_generators_before + hr (H.edgeWeight e) + (fun y => (hH e y).1) + (fun y => (hH e y).2) + hε hlong + choose i S F hdata using he + have hpartition : + ∀ e, (S e).partition = + FacePartition.generatedBy (F e) := by + intro e + have h := (hdata e).2.1 + simpa [S₀, indiscreteOrderedRegularitySystem, + FacePartition.join, FacePartition.indiscrete] using h + have hsupported : + ∀ e, F e ⊆ booleanFaceCutSupports G r := + fun e => (hdata e).2.2.1 + have hcard : + ∀ e, (F e).card ≤ i e := + fun e => (hdata e).2.2.2.1 + have hregular : + ∀ e, (S e).IsFaceCutRegular + (H.edgeWeight e) ε := + fun e => (hdata e).2.2.2.2.1 + have hcomplexity : + ∀ e, FacePartition.complexity (S e).partition ≤ + 2 ^ i e := by + intro e + have h := (hdata e).2.2.2.2.2 + simpa [S₀, indiscreteOrderedRegularitySystem] using h + let R : GeneratedOrderedPatternRegularization + G k r H ε := { + state := S + generators := F + budgetLength := fun _ => m + stepIndex := i + budget_large := fun _ => hlong + step_lt_budget := fun e => (hdata e).1 + partition_eq_generated := hpartition + generators_supported := hsupported + generator_card_le := hcard + regular := hregular + count_close := + patternCount_abs_sub_regularizedOrderedPattern_le + H hH S hregular + complexity_le := hcomplexity + } + exact ⟨R, fun e => (hdata e).1⟩ + +namespace GeneratedOrderedPatternRegularization + +theorem exists_refinement_before + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε η : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hr : 0 < r) + (hH : H.EdgeWeightsInUnitInterval) + {m : ℕ} (hη : 0 ≤ η) + (hlong : 1 < (m : ℝ) * η ^ 2) : + ∃ T : GeneratedOrderedPatternRegularization + G k r H η, + (∀ e, (T.state e).partition ≤ + (R.state e).partition) ∧ + (∀ e, R.generators e ⊆ T.generators e) ∧ + ∀ e, T.stepIndex e < R.stepIndex e + m := by + classical + have he (e : OrderedFace k r) : + ∃ i : ℕ, + ∃ S : FaceRegularityState (Fin r → G), + ∃ F : Finset (BooleanCutTest (Fin r → G)), + i < m ∧ + S.partition = + FacePartition.join (R.state e).partition + (FacePartition.generatedBy F) ∧ + F ⊆ booleanFaceCutSupports G r ∧ + F.card ≤ i ∧ + S.IsFaceCutRegular (H.edgeWeight e) η ∧ + FacePartition.complexity S.partition ≤ + 2 ^ i * + FacePartition.complexity + (R.state e).partition := by + exact + (R.state e).exists_faceCutRegular_refinement_with_generators_before + hr (H.edgeWeight e) + (fun y => (hH e y).1) + (fun y => (hH e y).2) + hη hlong + choose i S F hdata using he + let U : + (e : OrderedFace k r) → + Finset (BooleanCutTest (Fin r → G)) := + fun e => R.generators e ∪ F e + have hbudget : + ∀ e, + 1 < + ((R.stepIndex e + m : ℕ) : ℝ) * η ^ 2 := by + intro e + have hm : + (m : ℝ) ≤ ((R.stepIndex e + m : ℕ) : ℝ) := by + exact_mod_cast Nat.le_add_left m (R.stepIndex e) + exact hlong.trans_le + (mul_le_mul_of_nonneg_right hm (sq_nonneg η)) + have hstep : + ∀ e, + R.stepIndex e + i e < + R.stepIndex e + m := + fun e => Nat.add_lt_add_left (hdata e).1 _ + have hpartition : + ∀ e, (S e).partition = + FacePartition.generatedBy (U e) := by + intro e + calc + (S e).partition = + FacePartition.join (R.state e).partition + (FacePartition.generatedBy (F e)) := + (hdata e).2.1 + _ = + FacePartition.join + (FacePartition.generatedBy (R.generators e)) + (FacePartition.generatedBy (F e)) := by + rw [R.partition_eq_generated e] + _ = FacePartition.generatedBy (U e) := by + exact + (FacePartition.generatedBy_union + (R.generators e) (F e)).symm + have hsupported : + ∀ e, U e ⊆ booleanFaceCutSupports G r := by + intro e + exact Finset.union_subset + (R.generators_supported e) + (hdata e).2.2.1 + have hcard : + ∀ e, (U e).card ≤ R.stepIndex e + i e := by + intro e + calc + (U e).card ≤ + (R.generators e).card + (F e).card := + by + change + (R.generators e ∪ F e).card ≤ + (R.generators e).card + (F e).card + exact Finset.card_union_le + (R.generators e) (F e) + _ ≤ R.stepIndex e + i e := + Nat.add_le_add + (R.generator_card_le e) + (hdata e).2.2.2.1 + have hregular : + ∀ e, (S e).IsFaceCutRegular + (H.edgeWeight e) η := + fun e => (hdata e).2.2.2.2.1 + have hcomplexity : + ∀ e, FacePartition.complexity (S e).partition ≤ + 2 ^ (R.stepIndex e + i e) := by + intro e + calc + FacePartition.complexity (S e).partition ≤ + 2 ^ i e * + FacePartition.complexity + (R.state e).partition := + (hdata e).2.2.2.2.2 + _ ≤ 2 ^ i e * 2 ^ R.stepIndex e := + Nat.mul_le_mul_left _ (R.complexity_le e) + _ = 2 ^ (R.stepIndex e + i e) := by + simp [pow_add, Nat.mul_comm] + let T : GeneratedOrderedPatternRegularization + G k r H η := { + state := S + generators := U + budgetLength := fun e => R.stepIndex e + m + stepIndex := fun e => R.stepIndex e + i e + budget_large := hbudget + step_lt_budget := hstep + partition_eq_generated := hpartition + generators_supported := hsupported + generator_card_le := hcard + regular := hregular + count_close := + patternCount_abs_sub_regularizedOrderedPattern_le + H hH S hregular + complexity_le := hcomplexity + } + refine ⟨T, ?_, ?_, ?_⟩ + · intro e + change (S e).partition ≤ (R.state e).partition + rw [(hdata e).2.1] + exact FacePartition.join_le_left _ _ + · intro e + change R.generators e ⊆ U e + exact Finset.subset_union_left + · intro e + change R.stepIndex e + i e < + R.stepIndex e + m + exact hstep e + +abbrev BranchSystem + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) := + (e : OrderedFace k r) → + GeneratorBranch (R.generators e) + +@[simp] +theorem card_branchSystem + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) : + Fintype.card R.BranchSystem = + ∏ e : OrderedFace k r, + r ^ (R.generators e).card := by + simp [BranchSystem] + +theorem card_branchSystem_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hr : 0 < r) : + Fintype.card R.BranchSystem ≤ + ∏ e : OrderedFace k r, + r ^ R.stepIndex e := by + rw [R.card_branchSystem] + apply Finset.prod_le_prod₀ + · intro e _he + exact Nat.zero_le _ + · intro e _he + exact + Nat.pow_le_pow_right hr + (R.generator_card_le e) + +abbrev TopAtomChoice + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) := + (e : OrderedFace k r) → + (R.state e).partition.parts + +@[simp] +theorem card_topAtomChoice + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) : + Fintype.card R.TopAtomChoice = + ∏ e : OrderedFace k r, + FacePartition.complexity + (R.state e).partition := by + simp [TopAtomChoice, FacePartition.complexity] + +theorem card_topAtomChoice_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) : + Fintype.card R.TopAtomChoice ≤ + ∏ e : OrderedFace k r, + 2 ^ R.stepIndex e := by + rw [R.card_topAtomChoice] + apply Finset.prod_le_prod₀ + · intro e _he + exact Nat.zero_le _ + · intro e _he + exact R.complexity_le e + +noncomputable def topAtomChoiceOf + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (x : Fin k → G) : + R.TopAtomChoice := + fun e => + ⟨(R.state e).partition.part + (orderedFaceTuple e x), + (R.state e).partition.part_mem.2 + (Finset.mem_univ _)⟩ + +theorem mem_topAtomChoiceOf + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (x : Fin k → G) (e : OrderedFace k r) : + orderedFaceTuple e x ∈ + (R.topAtomChoiceOf x e).1 := + (R.state e).partition.mem_part + (Finset.mem_univ _) + +def IsInCell + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (reference : Fin k → G) + (w : R.BranchSystem) + (x : Fin k → G) : Prop := + ∀ e i, + eraseCoordinate i (orderedFaceTuple e x) ∈ + lowerGeneratorCell (R.generators e) + (orderedFaceTuple e reference) + (w e) i + +theorem mem_state_part_iff_exists_lowerGeneratorCells + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hr : 0 < r) (e : OrderedFace k r) + (y x : Fin r → G) : + x ∈ (R.state e).partition.part y ↔ + ∃ w : GeneratorBranch (R.generators e), + ∀ i, + eraseCoordinate i x ∈ + lowerGeneratorCell + (R.generators e) y w i := by + rw [R.partition_eq_generated e] + exact + mem_generatedBy_part_iff_exists_lowerGeneratorCells + hr (R.generators e) + (R.generators_supported e) y x + +theorem same_top_atoms_iff_exists_branchSystem + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hr : 0 < r) + (reference x : Fin k → G) : + (∀ e, + orderedFaceTuple e x ∈ + (R.state e).partition.part + (orderedFaceTuple e reference)) ↔ + ∃ w : R.BranchSystem, + R.IsInCell reference w x := by + classical + constructor + · intro hsame + have he (e : OrderedFace k r) : + ∃ w : GeneratorBranch (R.generators e), + ∀ i, + eraseCoordinate i + (orderedFaceTuple e x) ∈ + lowerGeneratorCell (R.generators e) + (orderedFaceTuple e reference) + w i := + (R.mem_state_part_iff_exists_lowerGeneratorCells + hr e _ _).1 (hsame e) + choose w hw using he + exact ⟨w, fun e i => hw e i⟩ + · rintro ⟨w, hcell⟩ + intro e + exact + (R.mem_state_part_iff_exists_lowerGeneratorCells + hr e _ _).2 ⟨w e, hcell e⟩ + +theorem regularized_edgeWeight_eq_of_mem_state_part + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (e : OrderedFace k r) + (reference x : Fin k → G) + (hmem : + orderedFaceTuple e x ∈ + (R.state e).partition.part + (orderedFaceTuple e reference)) : + (regularizedOrderedPattern H R.state).edgeWeight e + (orderedFaceTuple e x) = + (regularizedOrderedPattern H R.state).edgeWeight e + (orderedFaceTuple e reference) := by + exact + conditionalMean_eq_of_mem_part + (R.state e).partition (H.edgeWeight e) hmem + +theorem regularized_patternWeight_eq_of_isInCell + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} {H : WeightedOrderedPattern G k r} + {ε : ℝ} + (R : GeneratedOrderedPatternRegularization + G k r H ε) + (hr : 0 < r) + (reference x : Fin k → G) + (w : R.BranchSystem) + (hcell : R.IsInCell reference w x) : + (regularizedOrderedPattern H R.state).patternWeight x = + (regularizedOrderedPattern H R.state).patternWeight + reference := by + have hsame := + (R.same_top_atoms_iff_exists_branchSystem + hr reference x).2 ⟨w, hcell⟩ + apply Finset.prod_congr rfl + intro e _he + exact + R.regularized_edgeWeight_eq_of_mem_state_part + e reference x (hsame e) + +end GeneratedOrderedPatternRegularization + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRemoval.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1df18c4e7c994b636814f251354c6e146ebd91f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRemoval.lean @@ -0,0 +1,1454 @@ +import Mathlib.Data.Finset.Max +import Mathlib.Order.Hom.PowersetCard +import OAI.Combinatorics.Progressions.FixedDensity.BooleanCutReduction +import OAI.Combinatorics.Progressions.FixedDensity.OrderedPattern + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +def HasDenseAPCount (k N : ℕ) [NeZero N] + (δ c : ℝ) : Prop := + ∀ A : Finset (ZMod N), + δ ≤ mean (finsetIndicator A) → + c ≤ cyclicAPCount k N (finsetIndicator A) + +def HasWeightedAPCount (k N : ℕ) [NeZero N] + (δ c : ℝ) : Prop := + ∀ g : ZMod N → ℝ, + (∀ x, 0 ≤ g x) → + (∀ x, g x ≤ 1) → + δ ≤ mean g → + c ≤ cyclicAPCount k N g + +def HasUniformDenseAPCount (k : ℕ) (δ c : ℝ) : Prop := + ∀ (N : ℕ) [NeZero N], HasDenseAPCount k N δ c + +def HasUniformWeightedAPCount (k : ℕ) (δ c : ℝ) : Prop := + ∀ (N : ℕ) [NeZero N], HasWeightedAPCount k N δ c + +theorem weightedAPCount_of_denseAPCount + {k N : ℕ} [NeZero N] {δ c : ℝ} + (hδ0 : 0 ≤ δ) + (hdense : HasDenseAPCount k N (δ / 2) c) + {g : ZMod N → ℝ} + (hg0 : ∀ x, 0 ≤ g x) + (hg1 : ∀ x, g x ≤ 1) + (hmean : δ ≤ mean g) : + (δ / 2) ^ k * c ≤ cyclicAPCount k N g := by + let A : Finset (ZMod N) := + Finset.univ.filter fun x => δ / 2 ≤ g x + have hpoint : + ∀ x : ZMod N, + g x ≤ δ / 2 + finsetIndicator A x := by + intro x + by_cases hx : x ∈ A + · rw [finsetIndicator_of_mem hx] + linarith [hg1 x] + · rw [finsetIndicator_of_not_mem hx, add_zero] + have hnot : ¬δ / 2 ≤ g x := by + simpa [A] using hx + exact le_of_lt (lt_of_not_ge hnot) + have hmean_upper := + mean_mono (f := g) + (g := fun x => δ / 2 + finsetIndicator A x) hpoint + rw [mean_add, mean_const] at hmean_upper + have hAmean : δ / 2 ≤ mean (finsetIndicator A) := by + linarith + have hsetCount := hdense A hAmean + have hscaled_nonneg : + ∀ x : ZMod N, + 0 ≤ δ / 2 * finsetIndicator A x := by + intro x + exact mul_nonneg (div_nonneg hδ0 (by norm_num)) + (by + unfold finsetIndicator + split <;> norm_num) + have hscaled_le : + ∀ x : ZMod N, + δ / 2 * finsetIndicator A x ≤ g x := by + intro x + by_cases hx : x ∈ A + · rw [finsetIndicator_of_mem hx, mul_one] + simpa [A] using (Finset.mem_filter.mp hx).2 + · rw [finsetIndicator_of_not_mem hx, mul_zero] + exact hg0 x + have hcountMono : + cyclicAPCount k N + (fun x => δ / 2 * finsetIndicator A x) ≤ + cyclicAPCount k N g := + cyclicAPCount_mono (k := k) (N := N) + hscaled_nonneg hscaled_le + rw [cyclicAPCount_smul] at hcountMono + calc + (δ / 2) ^ k * c ≤ + (δ / 2) ^ k * + cyclicAPCount k N (finsetIndicator A) := + mul_le_mul_of_nonneg_left hsetCount + (pow_nonneg (div_nonneg hδ0 (by norm_num)) _) + _ ≤ cyclicAPCount k N g := hcountMono + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace SimplexHypergraph + +abbrev DeletionFamily {k : ℕ} (V : Fin k → Type*) := + (j : Fin k) → Finset (DeletedVector V j) + +noncomputable def deleteEdges {k : ℕ} {V : Fin k → Type*} + (H : SimplexHypergraph V) (deleted : DeletionFamily V) : + SimplexHypergraph V := by + classical + exact + { edge := fun j x => H.edge j x ∧ x ∉ deleted j } + +@[simp] +theorem deleteEdges_edge {k : ℕ} {V : Fin k → Type*} + (H : SimplexHypergraph V) (deleted : DeletionFamily V) + (j : Fin k) (x : DeletedVector V j) : + (H.deleteEdges deleted).edge j x ↔ + H.edge j x ∧ x ∉ deleted j := by + classical + simp [deleteEdges] + +@[simp] +theorem mem_deleteEdges_simplexFinset {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (deleted : DeletionFamily V) + (x : (i : Fin k) → V i) : + x ∈ (H.deleteEdges deleted).simplexFinset ↔ + x ∈ H.simplexFinset ∧ + ∀ j, deleteCoordinate x j ∉ deleted j := by + classical + simp only [mem_simplexFinset, deleteEdges_edge, forall_and] + +def IsSimplexFree {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] (H : SimplexHypergraph V) : Prop := + H.simplexFinset = ∅ + +theorem isSimplexFree_iff {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : + H.IsSimplexFree ↔ + ∀ x, ∃ j, ¬H.edge j (deleteCoordinate x j) := by + classical + rw [IsSimplexFree, Finset.eq_empty_iff_forall_notMem] + simp only [mem_simplexFinset] + push Not + rfl + +def emptyDeletion {k : ℕ} (V : Fin k → Type*) : + DeletionFamily V := + fun _ => ∅ + +@[simp] +theorem mem_emptyDeletion {k : ℕ} {V : Fin k → Type*} + (j : Fin k) (x : DeletedVector V j) : + x ∉ emptyDeletion V j := by + simp [emptyDeletion] + +@[simp] +theorem deleteEdges_empty_simplexFinset {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : + (H.deleteEdges (emptyDeletion V)).simplexFinset = + H.simplexFinset := by + classical + ext x + simp + +theorem deleteEdges_simplexFinset_antitone {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) + {deleted₁ deleted₂ : DeletionFamily V} + (hdel : ∀ j, deleted₁ j ⊆ deleted₂ j) : + (H.deleteEdges deleted₂).simplexFinset ⊆ + (H.deleteEdges deleted₁).simplexFinset := by + intro x hx + rw [mem_deleteEdges_simplexFinset] at hx ⊢ + exact ⟨hx.1, fun j hj => hx.2 j (hdel j hj)⟩ + +theorem IsSimplexCover.mono {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + {H : SimplexHypergraph V} + {deleted₁ deleted₂ : DeletionFamily V} + (hcover : H.IsSimplexCover deleted₁) + (hdel : ∀ j, deleted₁ j ⊆ deleted₂ j) : + H.IsSimplexCover deleted₂ := by + intro x hx + obtain ⟨j, hj⟩ := hcover x hx + exact ⟨j, hdel j hj⟩ + +def IsEdgeDeletion {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (deleted : DeletionFamily V) : Prop := + ∀ j, deleted j ⊆ H.edgeFinset j + +noncomputable def trimDeletion {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (deleted : DeletionFamily V) : + DeletionFamily V := by + classical + exact fun j => deleted j ∩ H.edgeFinset j + +theorem trimDeletion_isEdgeDeletion {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (deleted : DeletionFamily V) : + H.IsEdgeDeletion (H.trimDeletion deleted) := by + classical + intro j + exact Finset.inter_subset_right + +theorem trimDeletion_subset {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (deleted : DeletionFamily V) + (j : Fin k) : + H.trimDeletion deleted j ⊆ deleted j := by + classical + exact Finset.inter_subset_left + +theorem IsSimplexCover.trim {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + {H : SimplexHypergraph V} {deleted : DeletionFamily V} + (hcover : H.IsSimplexCover deleted) : + H.IsSimplexCover (H.trimDeletion deleted) := by + classical + intro x hx + obtain ⟨j, hj⟩ := hcover x hx + refine ⟨j, Finset.mem_inter.mpr ⟨hj, ?_⟩⟩ + exact H.mem_edgeFinset j (deleteCoordinate x j) |>.2 + ((H.mem_simplexFinset x).1 hx j) + +theorem trimDeletion_simplexFinset {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (deleted : DeletionFamily V) : + (H.deleteEdges (H.trimDeletion deleted)).simplexFinset = + (H.deleteEdges deleted).simplexFinset := by + classical + ext x + rw [mem_deleteEdges_simplexFinset, + mem_deleteEdges_simplexFinset] + constructor + · rintro ⟨hx, havoid⟩ + refine ⟨hx, fun j hj => ?_⟩ + apply havoid j + refine Finset.mem_inter.mpr ⟨hj, ?_⟩ + exact (H.mem_edgeFinset j (deleteCoordinate x j)).2 + ((H.mem_simplexFinset x).1 hx j) + · rintro ⟨hx, havoid⟩ + exact ⟨hx, fun j hj => havoid j (Finset.mem_inter.mp hj).1⟩ + +noncomputable def fullEdgeDeletion {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : DeletionFamily V := + H.edgeFinset + +theorem fullEdgeDeletion_isEdgeDeletion {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : + H.IsEdgeDeletion H.fullEdgeDeletion := + fun _ => Finset.Subset.rfl + +theorem fullEdgeDeletion_isSimplexCover {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + [Nonempty (Fin k)] (H : SimplexHypergraph V) : + H.IsSimplexCover H.fullEdgeDeletion := by + classical + intro x hx + let j : Fin k := Classical.choice inferInstance + refine ⟨j, ?_⟩ + exact (H.mem_edgeFinset j (deleteCoordinate x j)).2 + ((H.mem_simplexFinset x).1 hx j) + +noncomputable def projectedSimplexDeletion {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : DeletionFamily V := by + classical + exact fun j => + H.simplexFinset.image (fun x => deleteCoordinate x j) + +theorem projectedSimplexDeletion_isEdgeDeletion {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : + H.IsEdgeDeletion H.projectedSimplexDeletion := by + classical + intro j e he + obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp he + exact (H.mem_edgeFinset j (deleteCoordinate x j)).2 + ((H.mem_simplexFinset x).1 hx j) + +theorem projectedSimplexDeletion_isSimplexCover {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + [Nonempty (Fin k)] (H : SimplexHypergraph V) : + H.IsSimplexCover H.projectedSimplexDeletion := by + classical + intro x hx + let j : Fin k := Classical.choice inferInstance + refine ⟨j, ?_⟩ + exact Finset.mem_image.mpr ⟨x, hx, rfl⟩ + +theorem card_projectedSimplexDeletion_le {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (j : Fin k) : + (H.projectedSimplexDeletion j).card ≤ + H.simplexFinset.card := by + classical + exact Finset.card_image_le + +def deletionCount {k : ℕ} {V : Fin k → Type*} + (deleted : DeletionFamily V) : ℕ := + ∑ j, (deleted j).card + +@[simp] +theorem deletionCount_empty {k : ℕ} (V : Fin k → Type*) : + deletionCount (emptyDeletion V) = 0 := by + simp [deletionCount, emptyDeletion] + +theorem deletionCount_mono {k : ℕ} {V : Fin k → Type*} + {deleted₁ deleted₂ : DeletionFamily V} + (hdel : ∀ j, deleted₁ j ⊆ deleted₂ j) : + deletionCount deleted₁ ≤ deletionCount deleted₂ := by + apply Finset.sum_le_sum + intro j _ + exact Finset.card_le_card (hdel j) + +theorem deletionCount_le_of_card_le {k m : ℕ} + {V : Fin k → Type*} (deleted : DeletionFamily V) + (hcard : ∀ j, (deleted j).card ≤ m) : + deletionCount deleted ≤ k * m := by + calc + deletionCount deleted ≤ ∑ _j : Fin k, m := by + apply Finset.sum_le_sum + intro j _ + exact hcard j + _ = k * m := by + simp + +theorem deletionCount_trim_le {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (deleted : DeletionFamily V) : + deletionCount (H.trimDeletion deleted) ≤ + deletionCount deleted := + deletionCount_mono (H.trimDeletion_subset deleted) + +theorem deletionCount_projectedSimplexDeletion_le {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : + deletionCount H.projectedSimplexDeletion ≤ + k * H.simplexFinset.card := by + calc + deletionCount H.projectedSimplexDeletion ≤ + ∑ _j : Fin k, H.simplexFinset.card := by + apply Finset.sum_le_sum + intro j _ + exact H.card_projectedSimplexDeletion_le j + _ = k * H.simplexFinset.card := by + simp + +theorem exists_simplexCover_card_le_simplexFinset {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + [Nonempty (Fin k)] (H : SimplexHypergraph V) : + ∃ deleted : DeletionFamily V, + H.IsSimplexCover deleted ∧ + H.IsEdgeDeletion deleted ∧ + (∀ j, (deleted j).card ≤ H.simplexFinset.card) ∧ + deletionCount deleted ≤ k * H.simplexFinset.card := + ⟨H.projectedSimplexDeletion, + H.projectedSimplexDeletion_isSimplexCover, + H.projectedSimplexDeletion_isEdgeDeletion, + H.card_projectedSimplexDeletion_le, + H.deletionCount_projectedSimplexDeletion_le⟩ + +def deletionCapacity {k : ℕ} (V : Fin k → Type*) + [∀ i, Fintype (V i)] : ℕ := + ∑ j, Fintype.card (DeletedVector V j) + +@[simp] +theorem card_deletedVector_fin (k n : ℕ) (j : Fin k) : + Fintype.card + (DeletedVector (fun _ : Fin k => Fin n) j) = + n ^ (k - 1) := by + simp [DeletedVector, Fintype.card_pi] + +@[simp] +theorem deletionCapacity_fin (k n : ℕ) : + deletionCapacity (fun _ : Fin k => Fin n) = + k * n ^ (k - 1) := by + simp [deletionCapacity] + +theorem deletionCount_le_capacity {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (deleted : DeletionFamily V) : + deletionCount deleted ≤ deletionCapacity V := by + apply Finset.sum_le_sum + intro j _ + exact (deleted j).card_le_univ + +noncomputable def colorDeletionDensity {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (deleted : DeletionFamily V) (j : Fin k) : ℝ := + ((deleted j).card : ℝ) / + Fintype.card (DeletedVector V j) + +theorem colorDeletionDensity_nonneg {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (deleted : DeletionFamily V) (j : Fin k) : + 0 ≤ colorDeletionDensity deleted j := + div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + +theorem colorDeletionDensity_le_one {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (deleted : DeletionFamily V) (j : Fin k) : + colorDeletionDensity deleted j ≤ 1 := by + apply div_le_one_of_le₀ + · exact_mod_cast (deleted j).card_le_univ + · exact Nat.cast_nonneg _ + +@[simp] +theorem colorDeletionDensity_fin {k n : ℕ} + (deleted : + DeletionFamily (fun _ : Fin k => Fin n)) + (j : Fin k) : + colorDeletionDensity deleted j = + ((deleted j).card : ℝ) / (n ^ (k - 1) : ℕ) := by + simp [colorDeletionDensity] + +noncomputable def normalizedDeletionCost {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (deleted : DeletionFamily V) : ℝ := + (deletionCount deleted : ℝ) / (deletionCapacity V : ℝ) + +theorem normalizedDeletionCost_nonneg {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (deleted : DeletionFamily V) : + 0 ≤ normalizedDeletionCost deleted := by + exact div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) + +theorem normalizedDeletionCost_le_one {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (deleted : DeletionFamily V) : + normalizedDeletionCost deleted ≤ 1 := by + apply div_le_one_of_le₀ + · exact_mod_cast deletionCount_le_capacity deleted + · exact Nat.cast_nonneg _ + +theorem normalizedDeletionCost_mono {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + {deleted₁ deleted₂ : DeletionFamily V} + (hdel : ∀ j, deleted₁ j ⊆ deleted₂ j) : + normalizedDeletionCost deleted₁ ≤ + normalizedDeletionCost deleted₂ := by + apply div_le_div_of_nonneg_right + · exact_mod_cast deletionCount_mono hdel + · exact Nat.cast_nonneg _ + +theorem normalizedDeletionCost_trim_le {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (deleted : DeletionFamily V) : + normalizedDeletionCost (H.trimDeletion deleted) ≤ + normalizedDeletionCost deleted := + normalizedDeletionCost_mono (H.trimDeletion_subset deleted) + +@[simp] +theorem normalizedDeletionCost_empty {k : ℕ} + (V : Fin k → Type*) [∀ i, Fintype (V i)] : + normalizedDeletionCost (emptyDeletion V) = 0 := by + simp [normalizedDeletionCost] + +theorem exists_minimum_simplexCover {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + [Nonempty (Fin k)] (H : SimplexHypergraph V) : + ∃ deleted : DeletionFamily V, + H.IsSimplexCover deleted ∧ + H.IsEdgeDeletion deleted ∧ + ∀ other : DeletionFamily V, + H.IsSimplexCover other → + deletionCount deleted ≤ deletionCount other := by + classical + let covers : Finset (DeletionFamily V) := + Finset.univ.filter H.IsSimplexCover + have covers_nonempty : covers.Nonempty := by + refine ⟨H.fullEdgeDeletion, ?_⟩ + exact Finset.mem_filter.mpr + ⟨Finset.mem_univ _, H.fullEdgeDeletion_isSimplexCover⟩ + obtain ⟨deleted, hdeleted, hminimal⟩ := + Finset.exists_min_image covers deletionCount covers_nonempty + have hcover : H.IsSimplexCover deleted := + (Finset.mem_filter.mp hdeleted).2 + refine + ⟨H.trimDeletion deleted, hcover.trim, + H.trimDeletion_isEdgeDeletion deleted, ?_⟩ + intro other hother + calc + deletionCount (H.trimDeletion deleted) ≤ + deletionCount deleted := + H.deletionCount_trim_le deleted + _ ≤ deletionCount other := by + apply hminimal other + exact Finset.mem_filter.mpr + ⟨Finset.mem_univ _, hother⟩ + +theorem exists_minimum_normalized_simplexCover {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + [Nonempty (Fin k)] (H : SimplexHypergraph V) : + ∃ deleted : DeletionFamily V, + H.IsSimplexCover deleted ∧ + H.IsEdgeDeletion deleted ∧ + ∀ other : DeletionFamily V, + H.IsSimplexCover other → + normalizedDeletionCost deleted ≤ + normalizedDeletionCost other := by + obtain ⟨deleted, hcover, hedge, hminimal⟩ := + H.exists_minimum_simplexCover + refine ⟨deleted, hcover, hedge, ?_⟩ + intro other hother + apply div_le_div_of_nonneg_right + · exact_mod_cast hminimal other hother + · exact Nat.cast_nonneg _ + +end SimplexHypergraph + +def NoSimplexAfterDeleting {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) + (deleted : SimplexHypergraph.DeletionFamily V) : Prop := + (H.deleteEdges deleted).IsSimplexFree + +theorem isSimplexCover_iff_noSimplexAfterDeleting {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) + (deleted : SimplexHypergraph.DeletionFamily V) : + H.IsSimplexCover deleted ↔ + NoSimplexAfterDeleting H deleted := by + classical + constructor + · intro hcover + rw [NoSimplexAfterDeleting, + SimplexHypergraph.IsSimplexFree, + Finset.eq_empty_iff_forall_notMem] + intro x hx + rw [SimplexHypergraph.mem_deleteEdges_simplexFinset] at hx + obtain ⟨j, hj⟩ := hcover x hx.1 + exact hx.2 j hj + · intro hfree x hx + by_contra h + push Not at h + have hsurvives : + x ∈ (H.deleteEdges deleted).simplexFinset := + (H.mem_deleteEdges_simplexFinset deleted x).2 ⟨hx, h⟩ + rw [NoSimplexAfterDeleting, + SimplexHypergraph.IsSimplexFree] at hfree + rw [hfree] at hsurvives + simp at hsurvives + +theorem NoSimplexAfterDeleting.mono {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + {H : SimplexHypergraph V} + {deleted₁ deleted₂ : SimplexHypergraph.DeletionFamily V} + (hfree : NoSimplexAfterDeleting H deleted₁) + (hdel : ∀ j, deleted₁ j ⊆ deleted₂ j) : + NoSimplexAfterDeleting H deleted₂ := by + apply (isSimplexCover_iff_noSimplexAfterDeleting H deleted₂).1 + apply SimplexHypergraph.IsSimplexCover.mono + ((isSimplexCover_iff_noSimplexAfterDeleting + H deleted₁).2 hfree) + exact hdel + +theorem emptyDeletion_isSimplexCover_iff {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : + H.IsSimplexCover (SimplexHypergraph.emptyDeletion V) ↔ + H.IsSimplexFree := by + rw [isSimplexCover_iff_noSimplexAfterDeleting, + NoSimplexAfterDeleting, + SimplexHypergraph.IsSimplexFree, + SimplexHypergraph.deleteEdges_empty_simplexFinset] + rfl + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def apSetHypergraph (k N : ℕ) (A : Finset (ZMod N)) : + SimplexHypergraph (fun _ : Fin k => ZMod N) where + edge j x := apSimplexForm k N j x ∈ A + +@[simp] +theorem apSetHypergraph_edge + (k N : ℕ) (A : Finset (ZMod N)) + (j : Fin k) + (x : DeletedVector (fun _ : Fin k => ZMod N) j) : + (apSetHypergraph k N A).edge j x ↔ + apSimplexForm k N j x ∈ A := + Iff.rfl + +@[simp] +theorem apSetHypergraph_toWeighted_edgeWeight + (k N : ℕ) (A : Finset (ZMod N)) + (j : Fin k) + (x : DeletedVector (fun _ : Fin k => ZMod N) j) : + (apSetHypergraph k N A).toWeighted.edgeWeight j x = + finsetIndicator A (apSimplexForm k N j x) := by + classical + by_cases hx : apSimplexForm k N j x ∈ A + · rw [SimplexHypergraph.toWeighted_edgeWeight_of_edge] + · exact (finsetIndicator_of_mem hx).symm + · exact hx + · rw [SimplexHypergraph.toWeighted_edgeWeight_of_not_edge] + · exact (finsetIndicator_of_not_mem hx).symm + · exact hx + +theorem apSetHypergraph_simplexCount_eq_cyclicAPCount + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) : + (apSetHypergraph (r + 2) N A).toWeighted.simplexCount = + cyclicAPCount (r + 2) N (finsetIndicator A) := by + rw [← apSimplexSystem_simplexCount_eq_cyclicAPCount + r N (finsetIndicator A)] + simp only [WeightedSimplexSystem.simplexCount] + apply congrArg mean + funext x + apply Finset.prod_congr rfl + intro j _ + exact apSetHypergraph_toWeighted_edgeWeight + (r + 2) N A j (deleteCoordinate x j) + +abbrev DiagonalAPParameter + (r N : ℕ) (A : Finset (ZMod N)) := + ↥A × (Fin r → ZMod N) + +def diagonalAPSimplex + (r N : ℕ) (A : Finset (ZMod N)) + (p : DiagonalAPParameter r N A) : + Fin (r + 2) → ZMod N := + simplexCoordinatesOfAP r N p.1.1 0 p.2 + +@[simp] +theorem simplexCoordinateSum_diagonalAPSimplex + (r N : ℕ) (A : Finset (ZMod N)) + (p : DiagonalAPParameter r N A) : + simplexCoordinateSum (r + 2) N + (diagonalAPSimplex r N A p) = 0 := by + simp [diagonalAPSimplex] + +@[simp] +theorem simplexCoordinateMoment_diagonalAPSimplex + (r N : ℕ) (A : Finset (ZMod N)) + (p : DiagonalAPParameter r N A) : + simplexCoordinateMoment (r + 2) N + (diagonalAPSimplex r N A p) = p.1.1 := by + simp [diagonalAPSimplex] + +@[simp] +theorem apSimplexForm_diagonalAPSimplex + (r N : ℕ) (A : Finset (ZMod N)) + (p : DiagonalAPParameter r N A) + (j : Fin (r + 2)) : + apSimplexForm (r + 2) N j + (deleteCoordinate (diagonalAPSimplex r N A p) j) = + p.1.1 := by + rw [apSimplexForm_deleteCoordinate, + simplexCoordinateMoment_diagonalAPSimplex, + simplexCoordinateSum_diagonalAPSimplex] + simp + +theorem diagonalAPSimplex_mem_simplexFinset + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) + (p : DiagonalAPParameter r N A) : + diagonalAPSimplex r N A p ∈ + (apSetHypergraph (r + 2) N A).simplexFinset := by + let : ∀ _ : Fin (r + 2), Fintype (ZMod N) := + fun _ => inferInstance + rw [SimplexHypergraph.mem_simplexFinset] + intro j + rw [apSetHypergraph_edge, + apSimplexForm_diagonalAPSimplex] + exact p.1.2 + +theorem diagonalAPSimplex_injective + (r N : ℕ) (A : Finset (ZMod N)) : + Function.Injective (diagonalAPSimplex r N A) := by + intro p q hpq + apply Prod.ext + · apply Subtype.ext + have hmoment := + congrArg + (simplexCoordinateMoment (r + 2) N) hpq + simpa using hmoment + · funext i + exact congrFun hpq i.succ.succ + +noncomputable def deletedVectorToFinTuple + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (x : DeletedVector (fun _ : Fin (n + 1) => G) j) : + Fin n → G := + fun t => x (finSuccAboveEquiv j t) + +@[simp] +theorem deletedVectorToFinTuple_deleteCoordinate + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (x : Fin (n + 1) → G) (t : Fin n) : + deletedVectorToFinTuple j (deleteCoordinate x j) t = + x (j.succAbove t) := + rfl + +theorem eq_of_deletedVectorToFinTuple_eq_of_sum_eq + {G : Type*} [AddCommGroup G] {n : ℕ} + {x y : Fin (n + 1) → G} + {j l : Fin (n + 1)} + (hjl : j = l) + (hdeleted : + deletedVectorToFinTuple j (deleteCoordinate x j) = + deletedVectorToFinTuple l (deleteCoordinate y l)) + (hsum : (∑ i, x i) = ∑ i, y i) : + x = y := by + subst l + have hother : + ∑ i ∈ (Finset.univ : Finset (Fin (n + 1))).erase j, + x i = + ∑ i ∈ (Finset.univ : Finset (Fin (n + 1))).erase j, + y i := by + apply Finset.sum_congr rfl + intro i hi + have hij : i ≠ j := (Finset.mem_erase.mp hi).1 + obtain ⟨t, ht⟩ := Fin.exists_succAbove_eq hij + subst i + exact congrFun hdeleted t + have hj : x j = y j := by + apply add_left_cancel + (a := + ∑ i ∈ (Finset.univ : Finset (Fin (n + 1))).erase j, + x i) + calc + (∑ i ∈ (Finset.univ : Finset (Fin (n + 1))).erase j, + x i) + x j = + ∑ i, x i := + Finset.sum_erase_add _ _ (Finset.mem_univ j) + _ = ∑ i, y i := hsum + _ = + (∑ i ∈ + (Finset.univ : Finset (Fin (n + 1))).erase j, + y i) + y j := + (Finset.sum_erase_add _ _ (Finset.mem_univ j)).symm + _ = + (∑ i ∈ + (Finset.univ : Finset (Fin (n + 1))).erase j, + x i) + y j := by + rw [hother] + funext i + by_cases hij : i = j + · simpa [hij] using hj + · obtain ⟨t, ht⟩ := Fin.exists_succAbove_eq hij + subst i + exact congrFun hdeleted t + +namespace SimplexHypergraph + +noncomputable def deletionSlotFinset + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (deleted : + DeletionFamily (fun _ : Fin (n + 1) => G)) : + Finset (Fin (n + 1) × (Fin n → G)) := by + classical + exact Finset.univ.biUnion fun j => + (deleted j).image fun x => + (j, deletedVectorToFinTuple j x) + +theorem mem_deletionSlotFinset + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (deleted : + DeletionFamily (fun _ : Fin (n + 1) => G)) + (j : Fin (n + 1)) + (x : DeletedVector (fun _ : Fin (n + 1) => G) j) + (hx : x ∈ deleted j) : + (j, deletedVectorToFinTuple j x) ∈ + deletionSlotFinset deleted := by + classical + apply Finset.mem_biUnion.mpr + refine ⟨j, Finset.mem_univ j, ?_⟩ + exact Finset.mem_image.mpr ⟨x, hx, rfl⟩ + +theorem card_deletionSlotFinset_le_deletionCount + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (deleted : + DeletionFamily (fun _ : Fin (n + 1) => G)) : + (deletionSlotFinset deleted).card ≤ + deletionCount deleted := by + classical + calc + (deletionSlotFinset deleted).card ≤ + ∑ j : Fin (n + 1), + ((deleted j).image fun x => + (j, deletedVectorToFinTuple j x)).card := + Finset.card_biUnion_le + _ ≤ ∑ j : Fin (n + 1), (deleted j).card := by + apply Finset.sum_le_sum + intro j _ + exact Finset.card_image_le + _ = deletionCount deleted := rfl + +end SimplexHypergraph + +noncomputable def diagonalCoverColor + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) + (deleted : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (r + 2) => ZMod N)) + (hcover : + (apSetHypergraph (r + 2) N A).IsSimplexCover deleted) + (p : DiagonalAPParameter r N A) : + Fin (r + 2) := + Classical.choose + (hcover (diagonalAPSimplex r N A p) + (diagonalAPSimplex_mem_simplexFinset r N A p)) + +@[simp] +theorem diagonalCoverColor_mem + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) + (deleted : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (r + 2) => ZMod N)) + (hcover : + (apSetHypergraph (r + 2) N A).IsSimplexCover deleted) + (p : DiagonalAPParameter r N A) : + deleteCoordinate (diagonalAPSimplex r N A p) + (diagonalCoverColor r N A deleted hcover p) ∈ + deleted (diagonalCoverColor r N A deleted hcover p) := + Classical.choose_spec + (hcover (diagonalAPSimplex r N A p) + (diagonalAPSimplex_mem_simplexFinset r N A p)) + +noncomputable def diagonalCoveredSlot + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) + (deleted : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (r + 2) => ZMod N)) + (hcover : + (apSetHypergraph (r + 2) N A).IsSimplexCover deleted) + (p : DiagonalAPParameter r N A) : + Fin (r + 2) × (Fin (r + 1) → ZMod N) := + let j := diagonalCoverColor r N A deleted hcover p + (j, deletedVectorToFinTuple j + (deleteCoordinate (diagonalAPSimplex r N A p) j)) + +theorem diagonalCoveredSlot_mem_deletionSlotFinset + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) + (deleted : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (r + 2) => ZMod N)) + (hcover : + (apSetHypergraph (r + 2) N A).IsSimplexCover deleted) + (p : DiagonalAPParameter r N A) : + diagonalCoveredSlot r N A deleted hcover p ∈ + SimplexHypergraph.deletionSlotFinset deleted := by + classical + exact SimplexHypergraph.mem_deletionSlotFinset deleted + (diagonalCoverColor r N A deleted hcover p) + (deleteCoordinate (diagonalAPSimplex r N A p) + (diagonalCoverColor r N A deleted hcover p)) + (diagonalCoverColor_mem r N A deleted hcover p) + +theorem diagonalCoveredSlot_injective + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) + (deleted : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (r + 2) => ZMod N)) + (hcover : + (apSetHypergraph (r + 2) N A).IsSimplexCover deleted) : + Function.Injective + (diagonalCoveredSlot r N A deleted hcover) := by + intro p q hpq + apply diagonalAPSimplex_injective r N A + apply eq_of_deletedVectorToFinTuple_eq_of_sum_eq + · exact congrArg Prod.fst hpq + · exact congrArg Prod.snd hpq + · change + simplexCoordinateSum (r + 2) N + (diagonalAPSimplex r N A p) = + simplexCoordinateSum (r + 2) N + (diagonalAPSimplex r N A q) + simp + +@[simp] +theorem card_diagonalAPParameter + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) : + Fintype.card (DiagonalAPParameter r N A) = + A.card * N ^ r := by + simp [DiagonalAPParameter, ZMod.card] + +theorem card_diagonalAPParameter_le_deletionCount + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) + (deleted : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (r + 2) => ZMod N)) + (hcover : + (apSetHypergraph (r + 2) N A).IsSimplexCover deleted) : + Fintype.card (DiagonalAPParameter r N A) ≤ + SimplexHypergraph.deletionCount deleted := by + classical + let f := diagonalCoveredSlot r N A deleted hcover + calc + Fintype.card (DiagonalAPParameter r N A) = + (Finset.univ.image f).card := by + rw [Finset.card_image_of_injective _ + (diagonalCoveredSlot_injective r N A deleted hcover)] + simp + _ ≤ + (SimplexHypergraph.deletionSlotFinset deleted).card := by + apply Finset.card_le_card + intro y hy + obtain ⟨p, _hp, rfl⟩ := Finset.mem_image.mp hy + exact diagonalCoveredSlot_mem_deletionSlotFinset + r N A deleted hcover p + _ ≤ SimplexHypergraph.deletionCount deleted := + SimplexHypergraph.card_deletionSlotFinset_le_deletionCount + deleted + +@[simp] +theorem deletionCapacity_zmod + (r N : ℕ) [NeZero N] : + SimplexHypergraph.deletionCapacity + (fun _ : Fin (r + 2) => ZMod N) = + (r + 2) * N ^ (r + 1) := by + simp [SimplexHypergraph.deletionCapacity, DeletedVector, + Fintype.card_pi, ZMod.card] + +theorem mean_finsetIndicator_div_le_normalizedDeletionCost + (r N : ℕ) [NeZero N] (A : Finset (ZMod N)) + (deleted : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (r + 2) => ZMod N)) + (hcover : + (apSetHypergraph (r + 2) N A).IsSimplexCover deleted) : + mean (finsetIndicator A) / (r + 2 : ℝ) ≤ + SimplexHypergraph.normalizedDeletionCost deleted := by + have hcount : + A.card * N ^ r ≤ + SimplexHypergraph.deletionCount deleted := by + simpa using + card_diagonalAPParameter_le_deletionCount + r N A deleted hcover + have hN : (N : ℝ) ≠ 0 := by + exact_mod_cast (NeZero.ne N) + rw [mean_finsetIndicator, ZMod.card, + SimplexHypergraph.normalizedDeletionCost, + deletionCapacity_zmod] + calc + (A.card : ℝ) / (N : ℝ) / (r + 2 : ℝ) = + ((A.card * N ^ r : ℕ) : ℝ) / + (((r + 2) * N ^ (r + 1) : ℕ) : ℝ) := by + norm_num [Nat.cast_mul, Nat.cast_pow] + field_simp + ring + _ ≤ + (SimplexHypergraph.deletionCount deleted : ℝ) / + (((r + 2) * N ^ (r + 1) : ℕ) : ℝ) := by + apply div_le_div_of_nonneg_right + · exact_mod_cast hcount + · positivity + +def HasUniformCyclicPartiteSimplexRemoval (k : ℕ) : Prop := + ∀ ε : ℝ, 0 < ε → + ∃ c : ℝ, 0 < c ∧ + ∀ (N : ℕ) [NeZero N], + ∀ H : + SimplexHypergraph (fun _ : Fin k => ZMod N), + H.toWeighted.simplexCount < c → + ∃ deleted : + SimplexHypergraph.DeletionFamily + (fun _ : Fin k => ZMod N), + H.IsSimplexCover deleted ∧ + SimplexHypergraph.normalizedDeletionCost + deleted ≤ ε + +theorem exists_uniformDenseAPCount_of_simplexRemoval + (r : ℕ) + (hrem : + HasUniformCyclicPartiteSimplexRemoval (r + 2)) + {δ : ℝ} (hδ : 0 < δ) : + ∃ c : ℝ, 0 < c ∧ + HasUniformDenseAPCount (r + 2) δ c := by + let ε : ℝ := (δ / (r + 2 : ℝ)) / 2 + have hk : 0 < (r + 2 : ℝ) := by positivity + have hbase : 0 < δ / (r + 2 : ℝ) := + div_pos hδ hk + have hε : 0 < ε := by + exact div_pos hbase (by norm_num) + obtain ⟨c, hc, hremove⟩ := hrem ε hε + refine ⟨c, hc, ?_⟩ + intro N inst A hA + by_contra hcount + have hcount_lt : + cyclicAPCount (r + 2) N (finsetIndicator A) < c := + lt_of_not_ge hcount + have hsimplex_lt : + (apSetHypergraph (r + 2) N A).toWeighted.simplexCount < + c := by + simpa [apSetHypergraph_simplexCount_eq_cyclicAPCount] + using hcount_lt + obtain ⟨deleted, hcover, hcost⟩ := + hremove N (apSetHypergraph (r + 2) N A) hsimplex_lt + have hlower : + mean (finsetIndicator A) / (r + 2 : ℝ) ≤ + SimplexHypergraph.normalizedDeletionCost deleted := + mean_finsetIndicator_div_le_normalizedDeletionCost + r N A deleted hcover + have hdensity : + δ / (r + 2 : ℝ) ≤ + mean (finsetIndicator A) / (r + 2 : ℝ) := + div_le_div_of_nonneg_right hA hk.le + have hε_lt : ε < δ / (r + 2 : ℝ) := by + dsimp [ε] + linarith + linarith + +theorem exists_uniformWeightedAPCount_of_simplexRemoval + (r : ℕ) + (hrem : + HasUniformCyclicPartiteSimplexRemoval (r + 2)) + {δ : ℝ} (hδ : 0 < δ) : + ∃ c : ℝ, 0 < c ∧ + HasUniformWeightedAPCount (r + 2) δ c := by + obtain ⟨c₀, hc₀, hdense⟩ := + exists_uniformDenseAPCount_of_simplexRemoval + r hrem (half_pos hδ) + refine ⟨(δ / 2) ^ (r + 2) * c₀, ?_, ?_⟩ + · exact mul_pos (pow_pos (half_pos hδ) _) hc₀ + · intro N inst g hg0 hg1 hmean + exact weightedAPCount_of_denseAPCount + hδ.le (hdense N) hg0 hg1 hmean + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def orderedFacet {n : ℕ} (j : Fin (n + 1)) : + OrderedFace (n + 1) n := + Fin.succAboveOrderEmb j + +noncomputable def orderedFacetEquiv (n : ℕ) : + Fin (n + 1) ≃ OrderedFace (n + 1) n := + (Set.powersetCard.ofSingleton : + Fin (n + 1) ≃ Set.powersetCard (Fin (n + 1)) 1) |>.trans + ((Set.powersetCard.compl (m := n) (n := 1) (by simp) : + Set.powersetCard (Fin (n + 1)) 1 ≃ + Set.powersetCard (Fin (n + 1)) n) |>.trans + (Set.powersetCard.ofFinEmbEquiv : + OrderedFace (n + 1) n ≃ + Set.powersetCard (Fin (n + 1)) n).symm) + +@[simp] +theorem orderedFacetEquiv_apply + {n : ℕ} (j : Fin (n + 1)) : + orderedFacetEquiv n j = orderedFacet j := by + apply OrderEmbedding.range_inj_of_wellFoundedLT.mp + change + Set.range ((orderedFacetEquiv n) j) = + Set.range (Fin.succAboveOrderEmb j) + rw [Fin.range_succAboveOrderEmb] + ext i + simp only [orderedFacetEquiv, Equiv.trans_apply] + rw [ + Set.powersetCard.mem_range_ofFinEmbEquiv_symm_iff_mem] + rw [Set.powersetCard.mem_compl] + change + i ∉ ({j} : Finset (Fin (n + 1))) ↔ + i ∈ ({j} : Set (Fin (n + 1)))ᶜ + simp + +@[simp] +theorem deletedVectorToFinTuple_finTupleToDeletedVector + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (y : Fin n → G) : + deletedVectorToFinTuple j + (finTupleToDeletedVector j y) = y := by + funext t + simp [deletedVectorToFinTuple] + +@[simp] +theorem finTupleToDeletedVector_deletedVectorToFinTuple + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (x : DeletedVector (fun _ : Fin (n + 1) => G) j) : + finTupleToDeletedVector j + (deletedVectorToFinTuple j x) = x := by + funext i + change + x (finSuccAboveEquiv j + ((finSuccAboveEquiv j).symm i)) = x i + rw [(finSuccAboveEquiv j).apply_symm_apply] + +noncomputable def deletedVectorFinTupleEquiv + {G : Type*} {n : ℕ} (j : Fin (n + 1)) : + DeletedVector (fun _ : Fin (n + 1) => G) j ≃ + (Fin n → G) where + toFun := deletedVectorToFinTuple j + invFun := finTupleToDeletedVector j + left_inv := finTupleToDeletedVector_deletedVectorToFinTuple j + right_inv := deletedVectorToFinTuple_finTupleToDeletedVector j + +@[simp] +theorem deletedVectorToFinTuple_deleteCoordinate_eq_orderedFaceTuple + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (x : Fin (n + 1) → G) : + deletedVectorToFinTuple j (deleteCoordinate x j) = + orderedFaceTuple (orderedFacet j) x := by + rfl + +@[simp] +theorem finTupleToDeletedVector_orderedFaceTuple + {G : Type*} {n : ℕ} (j : Fin (n + 1)) + (x : Fin (n + 1) → G) : + finTupleToDeletedVector j + (orderedFaceTuple (orderedFacet j) x) = + deleteCoordinate x j := by + rw [← + finTupleToDeletedVector_deletedVectorToFinTuple j + (deleteCoordinate x j)] + congr + +noncomputable def SimplexHypergraph.toOrderedPattern + {G : Type*} {n : ℕ} + (H : SimplexHypergraph (fun _ : Fin (n + 1) => G)) : + OrderedPattern G (n + 1) n where + edge e y := + let j := (orderedFacetEquiv n).symm e + H.edge j (finTupleToDeletedVector j y) + +@[simp] +theorem SimplexHypergraph.toOrderedPattern_edge_orderedFacet + {G : Type*} {n : ℕ} + (H : SimplexHypergraph (fun _ : Fin (n + 1) => G)) + (j : Fin (n + 1)) (y : Fin n → G) : + H.toOrderedPattern.edge (orderedFacet j) y ↔ + H.edge j (finTupleToDeletedVector j y) := by + change + H.edge ((orderedFacetEquiv n).symm (orderedFacet j)) + (finTupleToDeletedVector + ((orderedFacetEquiv n).symm (orderedFacet j)) y) ↔ + H.edge j (finTupleToDeletedVector j y) + have hj : + (orderedFacetEquiv n).symm (orderedFacet j) = j := by + rw [← orderedFacetEquiv_apply] + exact (orderedFacetEquiv n).symm_apply_apply j + rw [hj] + +theorem SimplexHypergraph.toOrderedPattern_isOccurrence_iff + {G : Type*} {n : ℕ} + (H : SimplexHypergraph (fun _ : Fin (n + 1) => G)) + (x : Fin (n + 1) → G) : + H.toOrderedPattern.IsOccurrence x ↔ + ∀ j, H.edge j (deleteCoordinate x j) := by + constructor + · intro hx j + have hj := hx (orderedFacet j) + rw [H.toOrderedPattern_edge_orderedFacet] at hj + simpa using hj + · intro hx e + let j := (orderedFacetEquiv n).symm e + have he : orderedFacet j = e := by + rw [← orderedFacetEquiv_apply] + exact (orderedFacetEquiv n).apply_symm_apply e + rw [← he] + rw [H.toOrderedPattern_edge_orderedFacet] + simpa using hx j + +theorem SimplexHypergraph.toOrderedPattern_occurrenceFinset + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : SimplexHypergraph (fun _ : Fin (n + 1) => G)) : + H.toOrderedPattern.occurrenceFinset = + H.simplexFinset := by + ext x + rw [OrderedPattern.mem_occurrenceFinset, + SimplexHypergraph.mem_simplexFinset, + H.toOrderedPattern_isOccurrence_iff] + +theorem SimplexHypergraph.toOrderedPattern_patternCount + {G : Type*} [Fintype G] [Nonempty G] + {n : ℕ} + (H : SimplexHypergraph (fun _ : Fin (n + 1) => G)) : + H.toOrderedPattern.toWeighted.patternCount = + H.toWeighted.simplexCount := by + classical + rw [OrderedPattern.toWeighted_patternCount_eq, + SimplexHypergraph.toWeighted_simplexCount_eq_card_div, + H.toOrderedPattern_occurrenceFinset] + +noncomputable def orderedDeletionToSimplex + {G : Type*} [DecidableEq G] {n : ℕ} + (D : OrderedPattern.DeletionFamily + (G := G) (n + 1) n) : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (n + 1) => G) := by + classical + exact fun j => + (D (orderedFacet j)).image + (finTupleToDeletedVector j) + +@[simp] +theorem mem_orderedDeletionToSimplex_iff + {G : Type*} [DecidableEq G] {n : ℕ} + (D : OrderedPattern.DeletionFamily + (G := G) (n + 1) n) + (j : Fin (n + 1)) + (x : DeletedVector (fun _ : Fin (n + 1) => G) j) : + x ∈ orderedDeletionToSimplex D j ↔ + deletedVectorToFinTuple j x ∈ D (orderedFacet j) := by + classical + constructor + · intro hx + obtain ⟨y, hy, hyx⟩ := Finset.mem_image.mp hx + rw [← hyx] + simpa using hy + · intro hx + exact Finset.mem_image.mpr + ⟨deletedVectorToFinTuple j x, hx, + finTupleToDeletedVector_deletedVectorToFinTuple j x⟩ + +@[simp] +theorem card_orderedDeletionToSimplex + {G : Type*} [DecidableEq G] {n : ℕ} + (D : OrderedPattern.DeletionFamily + (G := G) (n + 1) n) + (j : Fin (n + 1)) : + (orderedDeletionToSimplex D j).card = + (D (orderedFacet j)).card := by + classical + rw [orderedDeletionToSimplex, + Finset.card_image_of_injective _] + intro y z hyz + have htuple := + congrArg (deletedVectorToFinTuple j) hyz + simpa using htuple + +theorem SimplexHypergraph.isSimplexCover_orderedDeletionToSimplex + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : SimplexHypergraph (fun _ : Fin (n + 1) => G)) + (D : OrderedPattern.DeletionFamily + (G := G) (n + 1) n) + (hcover : H.toOrderedPattern.IsCover D) : + H.IsSimplexCover (orderedDeletionToSimplex D) := by + intro x hx + have hxOrdered : + x ∈ H.toOrderedPattern.occurrenceFinset := by + rw [H.toOrderedPattern_occurrenceFinset] + exact hx + obtain ⟨e, he⟩ := hcover x hxOrdered + let j := (orderedFacetEquiv n).symm e + have heq : orderedFacet j = e := by + rw [← orderedFacetEquiv_apply] + exact (orderedFacetEquiv n).apply_symm_apply e + refine ⟨j, (mem_orderedDeletionToSimplex_iff D j _).2 ?_⟩ + rw [ + deletedVectorToFinTuple_deleteCoordinate_eq_orderedFaceTuple, + heq] + exact he + +theorem colorDeletionDensity_orderedDeletionToSimplex + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (D : OrderedPattern.DeletionFamily + (G := G) (n + 1) n) + (j : Fin (n + 1)) : + SimplexHypergraph.colorDeletionDensity + (orderedDeletionToSimplex D) j = + OrderedPattern.faceDeletionDensity + D (orderedFacet j) := by + rw [SimplexHypergraph.colorDeletionDensity, + OrderedPattern.faceDeletionDensity, + card_orderedDeletionToSimplex] + have hcard : + Fintype.card + (DeletedVector + (fun _ : Fin (n + 1) => G) j) = + Fintype.card (Fin n → G) := + Fintype.card_congr (deletedVectorFinTupleEquiv j) + rw [hcard] + +theorem normalizedDeletionCost_orderedDeletionToSimplex_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {n : ℕ} + (D : OrderedPattern.DeletionFamily + (G := G) (n + 1) n) + {ε : ℝ} + (hD : + ∀ e, OrderedPattern.faceDeletionDensity D e ≤ ε) : + SimplexHypergraph.normalizedDeletionCost + (orderedDeletionToSimplex D) ≤ ε := by + let M : ℕ := Fintype.card (Fin n → G) + have hM : 0 < M := Fintype.card_pos + have hface (j : Fin (n + 1)) : + Fintype.card + (DeletedVector + (fun _ : Fin (n + 1) => G) j) = M := by + exact Fintype.card_congr (deletedVectorFinTupleEquiv j) + have hcard (j : Fin (n + 1)) : + ((orderedDeletionToSimplex D j).card : ℝ) ≤ + ε * M := by + have hdensity := + colorDeletionDensity_orderedDeletionToSimplex D j + have hbound := hD (orderedFacet j) + rw [← hdensity] at hbound + rw [SimplexHypergraph.colorDeletionDensity, + hface] at hbound + have hMR : (0 : ℝ) < M := by + exact_mod_cast hM + exact (div_le_iff₀ hMR).mp hbound + have hcount : + (SimplexHypergraph.deletionCount + (orderedDeletionToSimplex D) : ℝ) ≤ + (n + 1 : ℝ) * (ε * M) := by + calc + (SimplexHypergraph.deletionCount + (orderedDeletionToSimplex D) : ℝ) = + ∑ j : Fin (n + 1), + ((orderedDeletionToSimplex D j).card : ℝ) := by + simp [SimplexHypergraph.deletionCount] + _ ≤ ∑ _j : Fin (n + 1), ε * M := + Finset.sum_le_sum fun j _ => hcard j + _ = (n + 1 : ℝ) * (ε * M) := by + simp + have hcapacity : + SimplexHypergraph.deletionCapacity + (fun _ : Fin (n + 1) => G) = + (n + 1) * M := by + unfold SimplexHypergraph.deletionCapacity + simp_rw [hface] + simp + rw [SimplexHypergraph.normalizedDeletionCost, + hcapacity] + have hdenom : + (0 : ℝ) < ((n + 1) * M : ℕ) := by + exact_mod_cast Nat.mul_pos (by omega) hM + apply (div_le_iff₀ hdenom).2 + calc + (SimplexHypergraph.deletionCount + (orderedDeletionToSimplex D) : ℝ) ≤ + (n + 1 : ℝ) * (ε * M) := hcount + _ = ε * (((n + 1) * M : ℕ) : ℝ) := by + push_cast + ring + +theorem hasUniformCyclicPartiteSimplexRemoval_of_ordered + (n : ℕ) + (hordered : + HasUniformOrderedPatternRemoval (n + 1) n) : + HasUniformCyclicPartiteSimplexRemoval (n + 1) := by + intro ε hε + obtain ⟨c, hc, hremove⟩ := hordered ε hε + refine ⟨c, hc, ?_⟩ + intro N inst H hcount + have horderedCount : + H.toOrderedPattern.toWeighted.patternCount < c := by + rw [H.toOrderedPattern_patternCount] + exact hcount + obtain ⟨D, hcover, hD⟩ := + hremove (ZMod N) H.toOrderedPattern horderedCount + exact + ⟨orderedDeletionToSimplex D, + H.isSimplexCover_orderedDeletionToSimplex D hcover, + normalizedDeletionCost_orderedDeletionToSimplex_le D hD⟩ + +theorem hasUniformCyclicPartiteSimplexRemoval_add_two_of_ordered + (r : ℕ) + (hordered : + HasUniformOrderedPatternRemoval (r + 2) (r + 1)) : + HasUniformCyclicPartiteSimplexRemoval (r + 2) := by + simpa [Nat.add_assoc] using + (hasUniformCyclicPartiteSimplexRemoval_of_ordered + (r + 1) (by simpa [Nat.add_assoc] using hordered)) + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +theorem exists_uniformDenseAPCount_of_orderedRemoval + (r : ℕ) + (hordered : + HasUniformOrderedPatternRemoval (r + 2) (r + 1)) + {δ : ℝ} (hδ : 0 < δ) : + ∃ c : ℝ, 0 < c ∧ + HasUniformDenseAPCount (r + 2) δ c := + exists_uniformDenseAPCount_of_simplexRemoval r + (hasUniformCyclicPartiteSimplexRemoval_add_two_of_ordered + r hordered) + hδ + +theorem exists_uniformWeightedAPCount_of_orderedRemoval + (r : ℕ) + (hordered : + HasUniformOrderedPatternRemoval (r + 2) (r + 1)) + {δ : ℝ} (hδ : 0 < δ) : + ∃ c : ℝ, 0 < c ∧ + HasUniformWeightedAPCount (r + 2) δ c := + exists_uniformWeightedAPCount_of_simplexRemoval r + (hasUniformCyclicPartiteSimplexRemoval_add_two_of_ordered + r hordered) + hδ + +theorem exists_uniformDenseAPCount_of_orderedRemoval_of_two_le + (k : ℕ) (hk : 2 ≤ k) + (hordered : + HasUniformOrderedPatternRemoval k (k - 1)) + {δ : ℝ} (hδ : 0 < δ) : + ∃ c : ℝ, 0 < c ∧ + HasUniformDenseAPCount k δ c := by + have hcolors : k - 2 + 2 = k := by + omega + have hrank : k - 2 + 1 = k - 1 := by + omega + have hordered' : + HasUniformOrderedPatternRemoval + (k - 2 + 2) (k - 2 + 1) := by + simpa only [hcolors, hrank] using hordered + simpa only [hcolors] using + (exists_uniformDenseAPCount_of_orderedRemoval + (k - 2) hordered' hδ) + +theorem exists_uniformWeightedAPCount_of_orderedRemoval_of_two_le + (k : ℕ) (hk : 2 ≤ k) + (hordered : + HasUniformOrderedPatternRemoval k (k - 1)) + {δ : ℝ} (hδ : 0 < δ) : + ∃ c : ℝ, 0 < c ∧ + HasUniformWeightedAPCount k δ c := by + have hcolors : k - 2 + 2 = k := by + omega + have hrank : k - 2 + 1 = k - 1 := by + omega + have hordered' : + HasUniformOrderedPatternRemoval + (k - 2 + 2) (k - 2 + 1) := by + simpa only [hcolors, hrank] using hordered + simpa only [hcolors] using + (exists_uniformWeightedAPCount_of_orderedRemoval + (k - 2) hordered' hδ) + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRemovalAssembly.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRemovalAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2ae8a65e045693fc23187caacbbdd1205fe8af1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/OrderedRemovalAssembly.lean @@ -0,0 +1,1251 @@ +import OAI.Combinatorics.Progressions.FixedDensity.SourceFullOrderedRemoval +import OAI.Combinatorics.Progressions.FixedDensity.StrongOrderedComplexRegularity + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def orderedRemovalConfigurationFaceCount (k r : ℕ) : ℕ := + Fintype.card (PositiveOrderedFace k r) + +noncomputable def orderedRemovalTopSubfaceCount (r : ℕ) : ℕ := + Fintype.card (OrderedPositiveSubface r) + +noncomputable def orderedRemovalComplexityCoefficient (r M : ℕ) : ℕ := + orderedRemovalTopSubfaceCount r * M + +noncomputable def orderedRemovalDensityFloor + (r M : ℕ) (ξ : ℝ) : ℝ := + min (1 / 2) + (ξ / + (4 * + ((orderedRemovalComplexityCoefficient r M : ℝ) + 1))) + +noncomputable def orderedRemovalCountingError + (k r M : ℕ) (ξ : ℝ) : ℝ := + orderedRemovalDensityFloor r M ξ ^ + orderedRemovalConfigurationFaceCount k r / + (4 * + ((orderedRemovalConfigurationFaceCount k r : ℝ) + 1)) + +noncomputable def orderedRemovalDefectThreshold + (k r M : ℕ) (ξ : ℝ) : ℝ := + orderedRemovalCountingError k r M ξ ^ 2 + +noncomputable def orderedRemovalEnergyGapTarget + (k r M : ℕ) (ξ : ℝ) : ℝ := + ξ * orderedRemovalDefectThreshold k r M ξ / 4 + +noncomputable def orderedRemovalAlpha + (r M : ℕ) (ξ : ℝ) : ℕ → ℝ := + fun _ => orderedRemovalDensityFloor r M ξ + +noncomputable def orderedRemovalBeta + (k r M : ℕ) (ξ : ℝ) : ℕ → ℝ := + fun _ => orderedRemovalDefectThreshold k r M ξ + +noncomputable def orderedRemovalTolerance + (k r M : ℕ) (ξ : ℝ) : + OrderedRegularityTolerance r := + fun _ => orderedRemovalCountingError k r M ξ + +noncomputable def orderedRemovalDeletionError + (r M : ℕ) (α gap β : ℝ) : ℝ := + (orderedRemovalComplexityCoefficient r M : ℝ) * α + + gap / β + +noncomputable def orderedRemovalConfigurationLowerBound + (k r : ℕ) (ρ η δ : ℝ) : ℝ := + ρ ^ orderedRemovalConfigurationFaceCount k r - + (orderedRemovalConfigurationFaceCount k r : ℝ) * + (η + δ) + +theorem orderedRemovalDensityFloor_pos + {r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + 0 < orderedRemovalDensityFloor r M ξ := by + unfold orderedRemovalDensityFloor + apply lt_min + · norm_num + · exact div_pos hξ + (mul_pos (by norm_num) + (by positivity)) + +theorem orderedRemovalDensityFloor_nonneg + {r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + 0 ≤ orderedRemovalDensityFloor r M ξ := + (orderedRemovalDensityFloor_pos hξ).le + +theorem orderedRemovalDensityFloor_le_half + (r M : ℕ) (ξ : ℝ) : + orderedRemovalDensityFloor r M ξ ≤ 1 / 2 := by + unfold orderedRemovalDensityFloor + exact min_le_left _ _ + +theorem orderedRemovalDensityFloor_le_fraction + (r M : ℕ) (ξ : ℝ) : + orderedRemovalDensityFloor r M ξ ≤ + ξ / + (4 * + ((orderedRemovalComplexityCoefficient r M : ℝ) + 1)) := by + unfold orderedRemovalDensityFloor + exact min_le_right _ _ + +theorem orderedRemovalCountingError_pos + {k r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + 0 < orderedRemovalCountingError k r M ξ := by + unfold orderedRemovalCountingError + exact div_pos + (pow_pos (orderedRemovalDensityFloor_pos hξ) _) + (mul_pos (by norm_num) (by positivity)) + +theorem orderedRemovalCountingError_nonneg + {k r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + 0 ≤ orderedRemovalCountingError k r M ξ := + (orderedRemovalCountingError_pos hξ).le + +theorem orderedRemovalDefectThreshold_pos + {k r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + 0 < orderedRemovalDefectThreshold k r M ξ := by + unfold orderedRemovalDefectThreshold + exact sq_pos_of_pos + (orderedRemovalCountingError_pos hξ) + +theorem orderedRemovalDefectThreshold_nonneg + {k r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + 0 ≤ orderedRemovalDefectThreshold k r M ξ := + (orderedRemovalDefectThreshold_pos hξ).le + +theorem orderedRemovalEnergyGapTarget_pos + {k r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + 0 < orderedRemovalEnergyGapTarget k r M ξ := by + unfold orderedRemovalEnergyGapTarget + exact div_pos + (mul_pos hξ (orderedRemovalDefectThreshold_pos hξ)) + (by norm_num) + +theorem orderedRemoval_complexity_mul_densityFloor_le_quarter + {r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + (orderedRemovalComplexityCoefficient r M : ℝ) * + orderedRemovalDensityFloor r M ξ ≤ + ξ / 4 := by + let C : ℝ := + (orderedRemovalComplexityCoefficient r M : ℝ) + have hC : 0 ≤ C := by + exact Nat.cast_nonneg _ + have hden : 0 < C + 1 := by positivity + have hfloor : + orderedRemovalDensityFloor r M ξ ≤ + ξ / (4 * (C + 1)) := by + exact orderedRemovalDensityFloor_le_fraction r M ξ + calc + C * orderedRemovalDensityFloor r M ξ ≤ + C * (ξ / (4 * (C + 1))) := + mul_le_mul_of_nonneg_left hfloor hC + _ = (C / (C + 1)) * (ξ / 4) := by + field_simp + _ ≤ 1 * (ξ / 4) := by + apply mul_le_mul_of_nonneg_right + · exact (div_le_one hden).2 (by linarith) + · positivity + _ = ξ / 4 := one_mul _ + +theorem orderedRemovalEnergyGapTarget_div_defectThreshold + {k r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + orderedRemovalEnergyGapTarget k r M ξ / + orderedRemovalDefectThreshold k r M ξ = + ξ / 4 := by + unfold orderedRemovalEnergyGapTarget + have hβ : + orderedRemovalDefectThreshold k r M ξ ≠ 0 := + (orderedRemovalDefectThreshold_pos hξ).ne' + field_simp + +theorem orderedRemovalDeletionError_le + {k r M : ℕ} {ξ gap : ℝ} + (hξ : 0 < ξ) + (hgap : + gap ≤ orderedRemovalEnergyGapTarget k r M ξ) : + orderedRemovalDeletionError r M + (orderedRemovalDensityFloor r M ξ) + gap + (orderedRemovalDefectThreshold k r M ξ) ≤ + ξ := by + unfold orderedRemovalDeletionError + have hβ : + 0 < orderedRemovalDefectThreshold k r M ξ := + orderedRemovalDefectThreshold_pos hξ + calc + (orderedRemovalComplexityCoefficient r M : ℝ) * + orderedRemovalDensityFloor r M ξ + + gap / orderedRemovalDefectThreshold k r M ξ ≤ + ξ / 4 + + orderedRemovalEnergyGapTarget k r M ξ / + orderedRemovalDefectThreshold k r M ξ := by + exact add_le_add + (orderedRemoval_complexity_mul_densityFloor_le_quarter hξ) + (div_le_div_of_nonneg_right hgap hβ.le) + _ = ξ / 2 := by + rw [orderedRemovalEnergyGapTarget_div_defectThreshold hξ] + ring + _ ≤ ξ := by linarith + +theorem orderedRemoval_counting_margin + {k r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + (orderedRemovalConfigurationFaceCount k r : ℝ) * + (orderedRemovalCountingError k r M ξ + + orderedRemovalCountingError k r M ξ) < + orderedRemovalDensityFloor r M ξ ^ + orderedRemovalConfigurationFaceCount k r := by + let N : ℝ := + (orderedRemovalConfigurationFaceCount k r : ℝ) + let p : ℝ := + orderedRemovalDensityFloor r M ξ ^ + orderedRemovalConfigurationFaceCount k r + have hN : 0 ≤ N := by + exact Nat.cast_nonneg _ + have hp : 0 < p := by + exact pow_pos (orderedRemovalDensityFloor_pos hξ) _ + have hden : 0 < 4 * (N + 1) := by positivity + have hcoeff : + (2 * N) / (4 * (N + 1)) < 1 := by + apply (div_lt_one hden).2 + linarith + calc + N * + (orderedRemovalCountingError k r M ξ + + orderedRemovalCountingError k r M ξ) = + ((2 * N) / (4 * (N + 1))) * p := by + unfold orderedRemovalCountingError + dsimp only [N, p] + ring + _ < 1 * p := + mul_lt_mul_of_pos_right hcoeff hp + _ = p := one_mul _ + +theorem orderedRemovalConfigurationLowerBound_pos + {k r M : ℕ} {ξ : ℝ} (hξ : 0 < ξ) : + 0 < + orderedRemovalConfigurationLowerBound k r + (orderedRemovalDensityFloor r M ξ) + (orderedRemovalCountingError k r M ξ) + (orderedRemovalCountingError k r M ξ) := by + unfold orderedRemovalConfigurationLowerBound + have hmargin := + orderedRemoval_counting_margin + (k := k) (r := r) (M := M) hξ + linarith + +noncomputable def orderedRemovalRegularityBudget + (k j : ℕ) (τ : ℝ) : ℕ := + Nat.ceil + ((Fintype.card (OrderedFace k (j + 1)) : ℝ) / + τ ^ 2) + + 1 + +noncomputable def orderedRemovalRegularityBudgetSchedule + (k r : ℕ) + (τ : (j : Fin r) → ℕ → ℝ) : + (j : Fin r) → ℕ → ℕ := + fun j n => orderedRemovalRegularityBudget k j.1 (τ j n) + +theorem orderedRemovalRegularityBudget_pos + (k j : ℕ) (τ : ℝ) : + 0 < orderedRemovalRegularityBudget k j τ := by + unfold orderedRemovalRegularityBudget + omega + +theorem orderedRemovalRegularityBudget_spec + {k j : ℕ} {τ : ℝ} (hτ : 0 < τ) : + (Fintype.card (OrderedFace k (j + 1)) : ℝ) < + (orderedRemovalRegularityBudget k j τ : ℝ) * τ ^ 2 := by + have hsq : 0 < τ ^ 2 := sq_pos_of_pos hτ + have hquot : + (Fintype.card (OrderedFace k (j + 1)) : ℝ) / + τ ^ 2 < + (orderedRemovalRegularityBudget k j τ : ℝ) := by + unfold orderedRemovalRegularityBudget + calc + (Fintype.card (OrderedFace k (j + 1)) : ℝ) / + τ ^ 2 ≤ + (Nat.ceil + ((Fintype.card + (OrderedFace k (j + 1)) : ℝ) / + τ ^ 2) : ℝ) := + Nat.le_ceil _ + _ < + (Nat.ceil + ((Fintype.card + (OrderedFace k (j + 1)) : ℝ) / + τ ^ 2) : ℝ) + 1 := by + linarith + _ = + ((Nat.ceil + ((Fintype.card + (OrderedFace k (j + 1)) : ℝ) / + τ ^ 2) + 1 : ℕ) : ℝ) := by + norm_num + exact (div_lt_iff₀ hsq).1 hquot + +theorem orderedRemovalRegularityBudgetSchedule_spec + {k r : ℕ} + {τ : (j : Fin r) → ℕ → ℝ} + (hτ : ∀ j n, 0 < τ j n) : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (orderedRemovalRegularityBudgetSchedule + k r τ j n : ℝ) * (τ j n) ^ 2 := by + intro j n + exact orderedRemovalRegularityBudget_spec (hτ j n) + +noncomputable def orderedRemovalEnergyTimescale + (k r : ℕ) (γ : ℝ) : ℕ := + Nat.ceil (orderedAllRankAtomEnergyBudget k r / γ) + 1 + +noncomputable def orderedRemovalEnergyLength + (k r : ℕ) (γ : ℝ) : Fin r → ℕ := + fun _ => orderedRemovalEnergyTimescale k r γ + +theorem orderedRemovalEnergyTimescale_pos + (k r : ℕ) (γ : ℝ) : + 0 < orderedRemovalEnergyTimescale k r γ := by + unfold orderedRemovalEnergyTimescale + omega + +theorem orderedRemovalEnergyLength_pos + (k r : ℕ) (γ : ℝ) : + ∀ j, 0 < orderedRemovalEnergyLength k r γ j := by + intro j + exact orderedRemovalEnergyTimescale_pos k r γ + +theorem orderedRemovalEnergyLength_sum_div_lt + {k r : ℕ} {γ : ℝ} (hγ : 0 < γ) : + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (orderedRemovalEnergyLength k r γ j : ℝ)) < + γ := by + let B : ℝ := orderedAllRankAtomEnergyBudget k r + let L : ℕ := orderedRemovalEnergyTimescale k r γ + have hLNat : 0 < L := + orderedRemovalEnergyTimescale_pos k r γ + have hLCast : (0 : ℝ) < (L : ℝ) := by + exact_mod_cast hLNat + have hquot : B / γ < (L : ℝ) := by + dsimp only [B, L] + unfold orderedRemovalEnergyTimescale + calc + orderedAllRankAtomEnergyBudget k r / γ ≤ + (Nat.ceil + (orderedAllRankAtomEnergyBudget k r / γ) : ℝ) := + Nat.le_ceil _ + _ < + (Nat.ceil + (orderedAllRankAtomEnergyBudget k r / γ) : ℝ) + 1 := by + linarith + _ = + ((Nat.ceil + (orderedAllRankAtomEnergyBudget k r / γ) + 1 : ℕ) : ℝ) := by + norm_num + have hbudget : B < (L : ℝ) * γ := + (div_lt_iff₀ hγ).1 hquot + unfold orderedRemovalEnergyLength + change + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / (L : ℝ)) < γ + rw [← Finset.sum_div] + change B / (L : ℝ) < γ + apply (div_lt_iff₀ hLCast).2 + simpa [mul_comm] using hbudget + +theorem fixedUpperLayerComplexityFactor_monotone + (j : ℕ) (budget : ℕ → ℕ) : + Monotone (fixedUpperLayerComplexityFactor j budget) := by + apply monotone_nat_of_le_succ + intro n + rw [fixedUpperLayerComplexityFactor] + exact Nat.le_mul_of_pos_left _ + (pow_pos (by positivity) _) + +def orderedRemovalFinePartitionComplexityBound + (r initialBound : ℕ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) : ℕ := + initialBound * + (1 + + ∑ j : Fin r, + fixedUpperLayerComplexityFactor + j.1 (budget j) (length j)) + +theorem fixedUpperLayerComplexityFactor_le_removalBoundFactor + {r : ℕ} + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) + (j : Fin r) : + fixedUpperLayerComplexityFactor + j.1 (budget j) (length j) ≤ + 1 + + ∑ i : Fin r, + fixedUpperLayerComplexityFactor + i.1 (budget i) (length i) := by + have hsum : + fixedUpperLayerComplexityFactor + j.1 (budget j) (length j) ≤ + ∑ i : Fin r, + fixedUpperLayerComplexityFactor + i.1 (budget i) (length i) := by + exact Finset.single_le_sum + (fun i _ => Nat.zero_le + (fixedUpperLayerComplexityFactor + i.1 (budget i) (length i))) + (Finset.mem_univ j) + omega + +namespace StrongOrderedComplexRegularityCertificate + +theorem fine_complexity_le_removalBound + {G : Type*} [Fintype G] [DecidableEq G] + {k r initialBound : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (hinitial : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (initial.partition j e) ≤ initialBound) : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (R.fine.partition j e) ≤ + orderedRemovalFinePartitionComplexityBound + r initialBound budget length := by + intro j + cases j using Fin.lastCases with + | last => + intro e + have htop := congrFun R.fine_topLayer_eq e + simp only [OrderedPartitionComplex.topLayer] at htop + rw [htop] + apply (hinitial (Fin.last r) e).trans + unfold orderedRemovalFinePartitionComplexityBound + exact Nat.le_mul_of_pos_right initialBound + (by positivity) + | cast i => + intro e + have hcertificate := R.fine_complexity i e + have hindex : + R.index i + 1 ≤ length i := + R.index_lt i + have hfactor : + fixedUpperLayerComplexityFactor + i.1 (budget i) (R.index i + 1) ≤ + fixedUpperLayerComplexityFactor + i.1 (budget i) (length i) := + fixedUpperLayerComplexityFactor_monotone + i.1 (budget i) hindex + have hfactorBound : + fixedUpperLayerComplexityFactor + i.1 (budget i) (length i) ≤ + 1 + + ∑ q : Fin r, + fixedUpperLayerComplexityFactor + q.1 (budget q) (length q) := + fixedUpperLayerComplexityFactor_le_removalBoundFactor + budget length i + calc + FacePartition.complexity + (R.fine.partition i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (budget i) (R.index i + 1) * + FacePartition.complexity + (initial.partition i.castSucc e) := + hcertificate + _ ≤ + fixedUpperLayerComplexityFactor + i.1 (budget i) (R.index i + 1) * + initialBound := + Nat.mul_le_mul_left _ + (hinitial i.castSucc e) + _ ≤ + fixedUpperLayerComplexityFactor + i.1 (budget i) (length i) * + initialBound := + Nat.mul_le_mul_right initialBound hfactor + _ ≤ + orderedRemovalFinePartitionComplexityBound + r initialBound budget length := by + unfold orderedRemovalFinePartitionComplexityBound + simpa [Nat.mul_comm] using + Nat.mul_le_mul_left initialBound hfactorBound + +end StrongOrderedComplexRegularityCertificate + +noncomputable def orderedRemovalRankCleaningError + (r : ℕ) + (complexity : Fin r → ℕ) + (α : ℕ → ℝ) + (gap : Fin r → ℝ) + (β : ℕ → ℝ) : ℝ := + ∑ j : Fin r, + ((Fintype.card + (OrderedFace r (j.1 + 1)) : ℝ) * + (complexity j : ℝ) * α (j.1 + 1) + + gap j / β (j.1 + 1)) + +noncomputable def orderedRemovalRankDensityProduct + (k r : ℕ) (α : ℕ → ℝ) : ℝ := + ∏ e : PositiveOrderedFace k r, α e.rank + +noncomputable def orderedRemovalRankCountingError + (k r : ℕ) + (η : Fin r → ℝ) + (δ : ℕ → ℝ) : ℝ := + ∑ e : PositiveOrderedFace k r, + (η e.lowerRank + δ e.rank) + +def IsRankSensitiveOrderedRemovalChoice + (k r : ℕ) (ξ : ℝ) + (complexity : Fin r → ℕ) + (α β : ℕ → ℝ) + (gap : Fin r → ℝ) + (η : Fin r → ℝ) + (δ : ℕ → ℝ) : Prop := + orderedRemovalRankCleaningError + r complexity α gap β ≤ ξ ∧ + orderedRemovalRankCountingError k r η δ < + orderedRemovalRankDensityProduct k r α + +structure IsStrongOrderedRemovalCompatible + {G : Type*} [Fintype G] [DecidableEq G] + {k r initialBound : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (ξ : ℝ) : Prop where + tolerance_le : + ∀ j : Fin r, + selectedOrderedComplexTolerance ε R.index j ≤ + orderedRemovalCountingError k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ + reciprocal_gap_le : + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ)) ≤ + orderedRemovalEnergyGapTarget k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ + +namespace StrongOrderedComplexRegularityCertificate + +theorem faceDeletionDensity_badBase_le_removalAllowance + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r initialBound : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (hinitial : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (initial.partition j e) ≤ initialBound) + {ξ : ℝ} (hξ : 0 < ξ) + (hcompatible : + IsStrongOrderedRemovalCompatible + (initialBound := initialBound) R ξ) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse + (orderedRemovalAlpha r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ) + (orderedRemovalBeta k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ)) e ≤ + ξ := by + let M := + orderedRemovalFinePartitionComplexityBound + r initialBound budget length + let gap : ℝ := + ∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ) + change + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse + (fun _ => orderedRemovalDensityFloor r M ξ) + (fun _ => + orderedRemovalDefectThreshold k r M ξ)) e ≤ + ξ + have hdeletion := + R.faceDeletionDensity_badBase_constant_of_complexity_le_sum_div + (M := M) + (α := orderedRemovalDensityFloor r M ξ) + (β := orderedRemovalDefectThreshold k r M ξ) + (fun j e => + R.fine_complexity_le_removalBound + hinitial j.succ e) + (orderedRemovalDensityFloor_nonneg + (r := r) (M := M) hξ) + (orderedRemovalDefectThreshold_pos + (k := k) (r := r) (M := M) hξ) + e + calc + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse + (fun _ => orderedRemovalDensityFloor r M ξ) + (fun _ => + orderedRemovalDefectThreshold k r M ξ)) e ≤ + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + (M : ℝ) * + orderedRemovalDensityFloor r M ξ + + gap / + orderedRemovalDefectThreshold k r M ξ := by + simpa [M, gap] using hdeletion + _ = + orderedRemovalDeletionError r M + (orderedRemovalDensityFloor r M ξ) + gap + (orderedRemovalDefectThreshold k r M ξ) := by + unfold orderedRemovalDeletionError + orderedRemovalComplexityCoefficient + orderedRemovalTopSubfaceCount + push_cast + ring + _ ≤ ξ := + orderedRemovalDeletionError_le hξ + hcompatible.reciprocal_gap_le + +theorem removalConfigurationLowerBound_le_fullConfigurationCount + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r initialBound : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (A : ClosedOrderedAtomConfiguration G k r R.fine) + {ξ : ℝ} (hξ : 0 < ξ) + (hcompatible : + IsStrongOrderedRemovalCompatible + (initialBound := initialBound) R ξ) + (hgood : + A.IsGood R.fine R.coarse + (orderedRemovalAlpha r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ) + (orderedRemovalBeta k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ)) : + orderedRemovalConfigurationLowerBound k r + (orderedRemovalDensityFloor r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ) + (orderedRemovalCountingError k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ) + (orderedRemovalCountingError k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ) ≤ + fullConfigurationCount A := by + let M := + orderedRemovalFinePartitionComplexityBound + r initialBound budget length + unfold orderedRemovalConfigurationLowerBound + orderedRemovalConfigurationFaceCount + apply + fullConfigurationCount_lower_bound + R.toCoarseFine A + (orderedRemovalAlpha r M ξ) + (orderedRemovalBeta k r M ξ) + hgood + (selectedOrderedComplexTolerance ε R.index) + R.regular + (orderedRemovalDensityFloor_nonneg hξ) + (orderedRemovalCountingError_nonneg hξ) + (orderedRemovalCountingError_nonneg hξ) + (fun _ => le_rfl) + hcompatible.tolerance_le + (fun _ => + orderedRemovalDefectThreshold_nonneg hξ) + (fun _ => le_rfl) + +theorem fullConfigurationCount_pos_of_removalParameters + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r initialBound : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (A : ClosedOrderedAtomConfiguration G k r R.fine) + {ξ : ℝ} (hξ : 0 < ξ) + (hcompatible : + IsStrongOrderedRemovalCompatible + (initialBound := initialBound) R ξ) + (hgood : + A.IsGood R.fine R.coarse + (orderedRemovalAlpha r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ) + (orderedRemovalBeta k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ)) : + 0 < fullConfigurationCount A := by + exact + (orderedRemovalConfigurationLowerBound_pos + (k := k) (r := r) + (M := orderedRemovalFinePartitionComplexityBound + r initialBound budget length) hξ).trans_le + (R.removalConfigurationLowerBound_le_fullConfigurationCount + A hξ hcompatible hgood) + +end StrongOrderedComplexRegularityCertificate + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +structure NatGrowthFunction where + toFun : ℕ → ℕ + monotone' : Monotone toFun + above_diagonal : ∀ n, n + 1 ≤ toFun n + +namespace NatGrowthFunction + +instance : CoeFun NatGrowthFunction (fun _ => ℕ → ℕ) := + ⟨NatGrowthFunction.toFun⟩ + +theorem monotone (F : NatGrowthFunction) : + Monotone F := + F.monotone' + +theorem positive (F : NatGrowthFunction) (n : ℕ) : + 0 < F n := by + exact lt_of_lt_of_le (Nat.zero_lt_succ n) + (F.above_diagonal n) + +theorem one_le (F : NatGrowthFunction) (n : ℕ) : + 1 ≤ F n := + F.positive n + +end NatGrowthFunction + +noncomputable def growthRegularityStepTolerance + (F : NatGrowthFunction) (M : ℕ) : ℝ := + 1 / (F M : ℝ) + +noncomputable def growthRegularityStepBudget + (k j : ℕ) (F : NatGrowthFunction) (M : ℕ) : ℕ := + orderedRemovalRegularityBudget + k j (growthRegularityStepTolerance F M) + +noncomputable def growthRegularityComplexity + (k j initialBound : ℕ) (F : NatGrowthFunction) : + ℕ → ℕ + | 0 => initialBound + | n + 1 => + (2 ^ (j + 1)) ^ + growthRegularityStepBudget + k j F + (growthRegularityComplexity + k j initialBound F n) * + growthRegularityComplexity + k j initialBound F n + +noncomputable def growthRegularityTolerance + (k j initialBound : ℕ) (F : NatGrowthFunction) : + ℕ → ℝ := + fun n => + growthRegularityStepTolerance F + (growthRegularityComplexity + k j initialBound F n) + +noncomputable def growthRegularityBudget + (k j initialBound : ℕ) (F : NatGrowthFunction) : + ℕ → ℕ := + fun n => + growthRegularityStepBudget k j F + (growthRegularityComplexity + k j initialBound F n) + +@[simp] +theorem growthRegularityComplexity_zero + (k j initialBound : ℕ) (F : NatGrowthFunction) : + growthRegularityComplexity + k j initialBound F 0 = initialBound := + rfl + +@[simp] +theorem growthRegularityComplexity_succ + (k j initialBound n : ℕ) (F : NatGrowthFunction) : + growthRegularityComplexity + k j initialBound F (n + 1) = + (2 ^ (j + 1)) ^ + growthRegularityBudget + k j initialBound F n * + growthRegularityComplexity + k j initialBound F n := + rfl + +@[simp] +theorem growthRegularityTolerance_eq + (k j initialBound n : ℕ) (F : NatGrowthFunction) : + growthRegularityTolerance + k j initialBound F n = + 1 / + (F (growthRegularityComplexity + k j initialBound F n) : ℝ) := + rfl + +@[simp] +theorem growthRegularityBudget_eq + (k j initialBound n : ℕ) (F : NatGrowthFunction) : + growthRegularityBudget + k j initialBound F n = + Nat.ceil + ((Fintype.card + (OrderedFace k (j + 1)) : ℝ) / + (growthRegularityTolerance + k j initialBound F n) ^ 2) + + 1 := + rfl + +theorem growthRegularityStepTolerance_pos + (F : NatGrowthFunction) (M : ℕ) : + 0 < growthRegularityStepTolerance F M := by + unfold growthRegularityStepTolerance + exact one_div_pos.mpr + (by exact_mod_cast F.positive M) + +theorem growthRegularityTolerance_pos + (k j initialBound : ℕ) (F : NatGrowthFunction) : + ∀ n, + 0 < + growthRegularityTolerance + k j initialBound F n := by + intro n + exact growthRegularityStepTolerance_pos F + (growthRegularityComplexity + k j initialBound F n) + +theorem growthRegularityBudget_pos + (k j initialBound : ℕ) (F : NatGrowthFunction) : + ∀ n, + 0 < + growthRegularityBudget + k j initialBound F n := by + intro n + exact orderedRemovalRegularityBudget_pos _ _ _ + +theorem growthRegularityBudget_spec + (k j initialBound : ℕ) (F : NatGrowthFunction) : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (growthRegularityBudget + k j initialBound F n : ℝ) * + (growthRegularityTolerance + k j initialBound F n) ^ 2 := by + intro n + exact orderedRemovalRegularityBudget_spec + (growthRegularityTolerance_pos + k j initialBound F n) + +theorem growthRegularityComplexity_eq_factor_mul + (k j initialBound : ℕ) (F : NatGrowthFunction) : + ∀ n, + growthRegularityComplexity + k j initialBound F n = + fixedUpperLayerComplexityFactor + j (growthRegularityBudget + k j initialBound F) n * + initialBound := by + intro n + induction n with + | zero => + simp [fixedUpperLayerComplexityFactor] + | succ n ih => + rw [growthRegularityComplexity_succ, ih] + simp [fixedUpperLayerComplexityFactor, + Nat.mul_assoc] + +theorem growthRegularityComplexity_pos + {k j initialBound : ℕ} (F : NatGrowthFunction) + (hinitial : 0 < initialBound) : + ∀ n, + 0 < + growthRegularityComplexity + k j initialBound F n := by + intro n + induction n with + | zero => + simpa using hinitial + | succ n ih => + rw [growthRegularityComplexity_succ] + exact Nat.mul_pos + (pow_pos (by positivity) _) + ih + +theorem growthRegularityComplexity_monotone + (k j initialBound : ℕ) (F : NatGrowthFunction) : + Monotone + (growthRegularityComplexity + k j initialBound F) := by + apply monotone_nat_of_le_succ + intro n + rw [growthRegularityComplexity_succ] + exact Nat.le_mul_of_pos_left _ + (pow_pos (by positivity) _) + +noncomputable def growthRegularityLength + (k j : ℕ) (γ : ℝ) : ℕ := + Nat.ceil + ((Fintype.card + (OrderedFace k (j + 1)) : ℝ) / γ) + + 1 + +theorem growthRegularityLength_pos + (k j : ℕ) (γ : ℝ) : + 0 < growthRegularityLength k j γ := by + unfold growthRegularityLength + omega + +theorem orderedFace_card_div_growthRegularityLength_lt + {k j : ℕ} {γ : ℝ} (hγ : 0 < γ) : + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) / + (growthRegularityLength k j γ : ℝ) < + γ := by + let A : ℝ := + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) + let L : ℕ := + growthRegularityLength k j γ + have hLNat : 0 < L := + growthRegularityLength_pos k j γ + have hLCast : (0 : ℝ) < (L : ℝ) := by + exact_mod_cast hLNat + have hquot : A / γ < (L : ℝ) := by + dsimp only [A, L] + unfold growthRegularityLength + calc + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) / γ ≤ + (Nat.ceil + ((Fintype.card + (OrderedFace k (j + 1)) : ℝ) / γ) : ℝ) := + Nat.le_ceil _ + _ < + (Nat.ceil + ((Fintype.card + (OrderedFace k (j + 1)) : ℝ) / γ) : ℝ) + 1 := by + linarith + _ = + ((Nat.ceil + ((Fintype.card + (OrderedFace k (j + 1)) : ℝ) / γ) + 1 : ℕ) : ℝ) := by + norm_num + have hA : A < (L : ℝ) * γ := + (div_lt_iff₀ hγ).1 hquot + apply (div_lt_iff₀ hLCast).2 + simpa [mul_comm] using hA + +structure GrowthFunctionFixedUpperCertificate + (G : Type*) [Fintype G] [DecidableEq G] + (k j initialBound : ℕ) + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (F : NatGrowthFunction) (γ : ℝ) where + index : ℕ + index_lt : + index < growthRegularityLength k j γ + coarse : OrderedFacePartitionSystem G k j + fine : OrderedFacePartitionSystem G k j + refines : OrderedFacePartitionRefines fine coarse + coarse_refines_initial : + OrderedFacePartitionRefines coarse initial + fine_regular : + IsPreliminaryOrderedRegular fine upper + (1 / + (F (growthRegularityComplexity + k j initialBound F index) : ℝ)) + gap_nonneg : + 0 ≤ + orderedLayerAtomEnergy fine upper - + orderedLayerAtomEnergy coarse upper + gap_le : + orderedLayerAtomEnergy fine upper - + orderedLayerAtomEnergy coarse upper ≤ γ + coarse_complexity : + ∀ e, + FacePartition.complexity (coarse e) ≤ + growthRegularityComplexity + k j initialBound F index + fine_complexity : + ∀ e, + FacePartition.complexity (fine e) ≤ + growthRegularityComplexity + k j initialBound F (index + 1) + +theorem GrowthFunctionFixedUpperCertificate.nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j initialBound : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (F : NatGrowthFunction) {γ : ℝ} (hγ : 0 < γ) + (hinitial : + ∀ e, + FacePartition.complexity (initial e) ≤ + initialBound) : + Nonempty + (GrowthFunctionFixedUpperCertificate + G k j initialBound initial upper F γ) := by + let τ : ℕ → ℝ := + growthRegularityTolerance k j initialBound F + let B : ℕ → ℕ := + growthRegularityBudget k j initialBound F + let L : ℕ := + growthRegularityLength k j γ + obtain ⟨R⟩ := + FixedUpperLayerCoarseFine.nonempty + initial upper τ B + (fun n => + (growthRegularityTolerance_pos + k j initialBound F n).le) + (growthRegularityBudget_spec + k j initialBound F) + (growthRegularityLength_pos k j γ) + refine ⟨{ + index := R.index + index_lt := R.index_lt + coarse := R.coarse + fine := R.fine + refines := R.refines + coarse_refines_initial := + R.coarse_refines_initial + fine_regular := ?_ + gap_nonneg := R.gap_nonneg + gap_le := ?_ + coarse_complexity := ?_ + fine_complexity := ?_ }⟩ + · simpa [τ, growthRegularityTolerance_eq] using + R.fine_regular + · exact R.gap_le.trans + (orderedFace_card_div_growthRegularityLength_lt + hγ).le + · intro e + calc + FacePartition.complexity (R.coarse e) ≤ + fixedUpperLayerComplexityFactor + j B R.index * + FacePartition.complexity (initial e) := + R.coarse_complexity e + _ ≤ + fixedUpperLayerComplexityFactor + j B R.index * + initialBound := + Nat.mul_le_mul_left _ (hinitial e) + _ = + growthRegularityComplexity + k j initialBound F R.index := by + rw [growthRegularityComplexity_eq_factor_mul] + · intro e + calc + FacePartition.complexity (R.fine e) ≤ + fixedUpperLayerComplexityFactor + j B (R.index + 1) * + FacePartition.complexity (initial e) := + R.fine_complexity e + _ ≤ + fixedUpperLayerComplexityFactor + j B (R.index + 1) * + initialBound := + Nat.mul_le_mul_left _ (hinitial e) + _ = + growthRegularityComplexity + k j initialBound F (R.index + 1) := by + rw [growthRegularityComplexity_eq_factor_mul] + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem complexity_orderedPatternInitialComplex_le_two + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} (H : OrderedPattern G k r) : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + ((orderedPatternInitialComplex H).partition j e) ≤ 2 := by + intro j + cases j using Fin.lastCases with + | last => + intro e + change + FacePartition.complexity + ((orderedPatternInitialComplex H).topLayer e) ≤ 2 + rw [orderedPatternInitialComplex_topLayer] + exact complexity_orderedPatternTopPartition_le_two H e + | cast i => + intro e + simp [orderedPatternInitialComplex, + indiscreteOrderedPartitionComplex, + OrderedPartitionComplex.withTopLayer] + +structure OrderedRemovalSchedule + (k r initialBound : ℕ) (ξ : ℝ) where + tolerance : (j : Fin r) → ℕ → ℝ + budget : (j : Fin r) → ℕ → ℕ + length : Fin r → ℕ + tolerance_pos : ∀ j n, 0 < tolerance j n + budget_spec : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budget j n : ℝ) * (tolerance j n) ^ 2 + length_pos : ∀ j, 0 < length j + tolerance_le : + ∀ j n, + tolerance j n ≤ + orderedRemovalCountingError k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ + reciprocal_gap_le : + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ)) ≤ + orderedRemovalEnergyGapTarget k r + (orderedRemovalFinePartitionComplexityBound + r initialBound budget length) ξ + +def HasOrderedRemovalSchedules + (k r initialBound : ℕ) : Prop := + ∀ ξ : ℝ, 0 < ξ → + Nonempty (OrderedRemovalSchedule k r initialBound ξ) + +namespace OrderedRemovalSchedule + +theorem certificateCompatible + {G : Type*} [Fintype G] [DecidableEq G] + {k r initialBound : ℕ} {ξ : ℝ} + {initial : OrderedPartitionComplex G k r} + (S : OrderedRemovalSchedule k r initialBound ξ) + (R : StrongOrderedComplexRegularityCertificate + G k r initial S.tolerance S.budget S.length) : + IsStrongOrderedRemovalCompatible + (initialBound := initialBound) R ξ where + tolerance_le j := + S.tolerance_le j (R.index j) + reciprocal_gap_le := + S.reciprocal_gap_le + +theorem certificate_nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r initialBound : ℕ} {ξ : ℝ} + (S : OrderedRemovalSchedule k r initialBound ξ) + (initial : OrderedPartitionComplex G k r) : + Nonempty + (StrongOrderedComplexRegularityCertificate + G k r initial S.tolerance S.budget S.length) := by + exact StrongOrderedComplexRegularityCertificate.nonempty + initial S.tolerance S.budget S.length + (fun j n => (S.tolerance_pos j n).le) + S.budget_spec S.length_pos + +end OrderedRemovalSchedule + +theorem hasUniformOrderedPatternRemoval_succ_of_schedules + (k n : ℕ) (hrank : n + 1 ≤ k) + (hschedules : + HasOrderedRemovalSchedules k (n + 1) 2) : + HasUniformOrderedPatternRemoval k (n + 1) := by + intro ξ hξ + let S : OrderedRemovalSchedule k (n + 1) 2 ξ := + Classical.choice (hschedules ξ hξ) + let M : ℕ := + orderedRemovalFinePartitionComplexityBound + (n + 1) 2 S.budget S.length + let c : ℝ := + orderedRemovalConfigurationLowerBound k (n + 1) + (orderedRemovalDensityFloor (n + 1) M ξ) + (orderedRemovalCountingError k (n + 1) M ξ) + (orderedRemovalCountingError k (n + 1) M ξ) + have hc : 0 < c := by + exact orderedRemovalConfigurationLowerBound_pos + (k := k) (r := n + 1) (M := M) hξ + refine ⟨c, hc, ?_⟩ + intro G instFintype instDecidableEq instNonempty H hcount + let initial : OrderedPartitionComplex G k (n + 1) := + orderedPatternInitialComplex H + obtain ⟨R⟩ := S.certificate_nonempty initial + let P : OrderedCoarseFineComplex G k (n + 1) := + R.toCoarseFine + let α : ℕ → ℝ := + orderedRemovalAlpha (n + 1) M ξ + let β : ℕ → ℝ := + orderedRemovalBeta k (n + 1) M ξ + let D : OrderedPattern.DeletionFamily + (G := G) k (n + 1) := + orderedBadBaseDeletionFamily R.fine R.coarse α β + have hinitial : + R.fine.Refines (orderedPatternInitialComplex H) := by + exact R.fine_refines_initial + have hcompatible : + IsStrongOrderedRemovalCompatible + (initialBound := 2) R ξ := + S.certificateCompatible R + have hcover : H.IsCover D := by + apply orderedBadBaseDeletionFamily_isCover + hrank H P hinitial α β + (selectedOrderedComplexTolerance S.tolerance R.index) + R.regular + (orderedRemovalDensityFloor_nonneg hξ) + (orderedRemovalCountingError_nonneg hξ) + (orderedRemovalCountingError_nonneg hξ) + (fun _ => le_rfl) + hcompatible.tolerance_le + (fun _ => orderedRemovalDefectThreshold_nonneg hξ) + (fun _ => le_rfl) + simpa [c, M, orderedRemovalConfigurationLowerBound, + orderedRemovalConfigurationFaceCount] using hcount + refine ⟨D, hcover, ?_⟩ + intro e + exact R.faceDeletionDensity_badBase_le_removalAllowance + (complexity_orderedPatternInitialComplex_le_two H) + hξ hcompatible e + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/PolynomialApproximation.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/PolynomialApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f636d2c5bb0ebf17beb8eb5095c5d6e811386a3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/PolynomialApproximation.lean @@ -0,0 +1,1128 @@ +import Mathlib.Analysis.LocallyConvex.Separation +import Mathlib.Topology.ContinuousMap.Weierstrass +import OAI.Combinatorics.Progressions.FixedDensity.Energy + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped Pointwise + +noncomputable def finitePairing + {Ω : Type*} [Fintype Ω] (f q : Ω → ℝ) : ℝ := + mean (fun x => f x * q x) + +theorem finitePairing_add_left + {Ω : Type*} [Fintype Ω] + (f g q : Ω → ℝ) : + finitePairing (f + g) q = + finitePairing f q + finitePairing g q := by + rw [finitePairing, finitePairing, finitePairing, ← mean_add] + apply congrArg mean + funext x + simp only [Pi.add_apply] + ring + +theorem finitePairing_add_right + {Ω : Type*} [Fintype Ω] + (f q r : Ω → ℝ) : + finitePairing f (q + r) = + finitePairing f q + finitePairing f r := by + rw [finitePairing, finitePairing, finitePairing, ← mean_add] + apply congrArg mean + funext x + simp only [Pi.add_apply] + ring + +theorem finitePairing_sub_left + {Ω : Type*} [Fintype Ω] + (f g q : Ω → ℝ) : + finitePairing (f - g) q = + finitePairing f q - finitePairing g q := by + rw [finitePairing, finitePairing, finitePairing, ← mean_sub] + apply congrArg mean + funext x + simp only [Pi.sub_apply] + ring + +theorem finitePairing_sub_right + {Ω : Type*} [Fintype Ω] + (f q r : Ω → ℝ) : + finitePairing f (q - r) = + finitePairing f q - finitePairing f r := by + rw [finitePairing, finitePairing, finitePairing, ← mean_sub] + apply congrArg mean + funext x + simp only [Pi.sub_apply] + ring + +theorem finitePairing_smul_left + {Ω : Type*} [Fintype Ω] + (c : ℝ) (f q : Ω → ℝ) : + finitePairing (c • f) q = c * finitePairing f q := by + rw [finitePairing, finitePairing, ← mean_smul] + apply congrArg mean + funext x + simp only [Pi.smul_apply, smul_eq_mul] + ring + +theorem finitePairing_smul_right + {Ω : Type*} [Fintype Ω] + (c : ℝ) (f q : Ω → ℝ) : + finitePairing f (c • q) = c * finitePairing f q := by + rw [finitePairing, finitePairing, ← mean_smul] + apply congrArg mean + funext x + simp only [Pi.smul_apply, smul_eq_mul] + ring + +theorem finitePairing_comm + {Ω : Type*} [Fintype Ω] + (f q : Ω → ℝ) : + finitePairing f q = finitePairing q f := by + apply congrArg mean + funext x + exact mul_comm _ _ + +theorem finitePairing_mono_left + {Ω : Type*} [Fintype Ω] + {f g q : Ω → ℝ} + (hfg : ∀ x, f x ≤ g x) (hq : ∀ x, 0 ≤ q x) : + finitePairing f q ≤ finitePairing g q := + mean_mono fun x => mul_le_mul_of_nonneg_right (hfg x) (hq x) + +theorem finitePairing_mono_right + {Ω : Type*} [Fintype Ω] + {f q r : Ω → ℝ} + (hf : ∀ x, 0 ≤ f x) (hqr : ∀ x, q x ≤ r x) : + finitePairing f q ≤ finitePairing f r := + mean_mono fun x => mul_le_mul_of_nonneg_left (hqr x) (hf x) + +def IsUnitBounded {Ω : Type*} (g : Ω → ℝ) : Prop := + (∀ x, 0 ≤ g x) ∧ ∀ x, g x ≤ 1 + +theorem IsUnitBounded.nonneg + {Ω : Type*} {g : Ω → ℝ} (hg : IsUnitBounded g) : + ∀ x, 0 ≤ g x := + hg.1 + +theorem IsUnitBounded.le_one + {Ω : Type*} {g : Ω → ℝ} (hg : IsUnitBounded g) : + ∀ x, g x ≤ 1 := + hg.2 + +theorem isUnitBounded_zero {Ω : Type*} : + IsUnitBounded (fun _ : Ω => (0 : ℝ)) := + ⟨fun _ => le_rfl, fun _ => zero_le_one⟩ + +theorem isUnitBounded_one {Ω : Type*} : + IsUnitBounded (fun _ : Ω => (1 : ℝ)) := + ⟨fun _ => zero_le_one, fun _ => le_rfl⟩ + +def unitCubeSet (Ω : Type*) : Set (Ω → ℝ) := + {g | IsUnitBounded g} + +theorem unitCubeSet_eq_Icc (Ω : Type*) : + unitCubeSet Ω = + Set.Icc (fun _ : Ω => (0 : ℝ)) (fun _ => 1) := by + ext g + simp [unitCubeSet, IsUnitBounded, Set.mem_Icc, Pi.le_def] + +theorem unitCubeSet_convex (Ω : Type*) : + Convex ℝ (unitCubeSet Ω) := by + rw [unitCubeSet_eq_Icc] + exact convex_Icc _ _ + +theorem unitCubeSet_compact (Ω : Type*) : + IsCompact (unitCubeSet Ω) := by + rw [unitCubeSet_eq_Icc] + exact isCompact_Icc + +theorem unitCubeSet_closed (Ω : Type*) : + IsClosed (unitCubeSet Ω) := by + rw [unitCubeSet_eq_Icc] + exact isClosed_Icc + +theorem unitCubeSet_nonempty (Ω : Type*) : + (unitCubeSet Ω).Nonempty := + ⟨fun _ => 0, isUnitBounded_zero⟩ + +noncomputable def finitePairingLinearMap + {Ω : Type*} [Fintype Ω] (q : Ω → ℝ) : + (Ω → ℝ) →ₗ[ℝ] ℝ where + toFun f := finitePairing f q + map_add' f g := finitePairing_add_left f g q + map_smul' c f := by + simpa [smul_eq_mul] using finitePairing_smul_left c f q + +noncomputable def finitePairingCLM + {Ω : Type*} [Fintype Ω] (q : Ω → ℝ) : + (Ω → ℝ) →L[ℝ] ℝ := + (finitePairingLinearMap q).toContinuousLinearMap + +@[simp] +theorem finitePairingCLM_apply + {Ω : Type*} [Fintype Ω] (q f : Ω → ℝ) : + finitePairingCLM q f = finitePairing f q := + rfl + +noncomputable def finiteTestProfile + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) : + (Ω → ℝ) →L[ℝ] (τ → ℝ) := + ContinuousLinearMap.pi (fun t => finitePairingCLM (q t)) + +@[simp] +theorem finiteTestProfile_apply + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (f : Ω → ℝ) (t : τ) : + finiteTestProfile q f t = finitePairing f (q t) := + rfl + +def profileErrorSet (τ : Type*) (ε : ℝ) : Set (τ → ℝ) := + Set.Icc (fun _ : τ => -ε) (fun _ => ε) + +theorem mem_profileErrorSet_iff + {τ : Type*} {ε : ℝ} {e : τ → ℝ} : + e ∈ profileErrorSet τ ε ↔ ∀ t, |e t| ≤ ε := by + constructor + · rintro ⟨hlower, hupper⟩ t + exact abs_le.mpr ⟨hlower t, hupper t⟩ + · intro h + exact + ⟨fun t => (abs_le.mp (h t)).1, + fun t => (abs_le.mp (h t)).2⟩ + +theorem profileErrorSet_convex (τ : Type*) (ε : ℝ) : + Convex ℝ (profileErrorSet τ ε) := + convex_Icc _ _ + +theorem profileErrorSet_compact + (τ : Type*) (ε : ℝ) : + IsCompact (profileErrorSet τ ε) := + isCompact_Icc + +theorem profileErrorSet_closed (τ : Type*) (ε : ℝ) : + IsClosed (profileErrorSet τ ε) := + isClosed_Icc + +theorem profileErrorSet_nonempty + (τ : Type*) {ε : ℝ} (hε : 0 ≤ ε) : + (profileErrorSet τ ε).Nonempty := by + refine ⟨fun _ => 0, ?_⟩ + rw [mem_profileErrorSet_iff] + intro t + simpa using hε + +noncomputable def denseModelProfileSet + (Ω τ : Type*) [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (ε : ℝ) : Set (τ → ℝ) := + finiteTestProfile q '' unitCubeSet Ω + profileErrorSet τ ε + +theorem denseModelProfileSet_convex + (Ω τ : Type*) [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (ε : ℝ) : + Convex ℝ (denseModelProfileSet Ω τ q ε) := by + change Convex ℝ + (finiteTestProfile q '' unitCubeSet Ω + + profileErrorSet τ ε) + exact + (unitCubeSet_convex Ω).linear_image + (finiteTestProfile q).toLinearMap |>.add + (profileErrorSet_convex τ ε) + +theorem denseModelProfileSet_compact + (Ω τ : Type*) [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (ε : ℝ) : + IsCompact (denseModelProfileSet Ω τ q ε) := by + change IsCompact + (finiteTestProfile q '' unitCubeSet Ω + + profileErrorSet τ ε) + exact + ((unitCubeSet_compact Ω).image + (finiteTestProfile q).continuous).add + (profileErrorSet_compact τ ε) + +theorem denseModelProfileSet_closed + (Ω τ : Type*) [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (ε : ℝ) : + IsClosed (denseModelProfileSet Ω τ q ε) := + (denseModelProfileSet_compact Ω τ q ε).isClosed + +theorem denseModelProfileSet_nonempty + (Ω τ : Type*) [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) {ε : ℝ} (hε : 0 ≤ ε) : + (denseModelProfileSet Ω τ q ε).Nonempty := + by + change + (finiteTestProfile q '' unitCubeSet Ω + + profileErrorSet τ ε).Nonempty + exact + ((unitCubeSet_nonempty Ω).image + (finiteTestProfile q)).add + (profileErrorSet_nonempty τ hε) + +def HasFiniteDenseModel + {Ω τ : Type*} [Fintype Ω] + (q : τ → Ω → ℝ) (f : Ω → ℝ) (ε : ℝ) : Prop := + ∃ g : Ω → ℝ, IsUnitBounded g ∧ + ∀ t, |finitePairing (f - g) (q t)| ≤ ε + +theorem hasFiniteDenseModel_iff_profile_mem + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (f : Ω → ℝ) (ε : ℝ) : + HasFiniteDenseModel q f ε ↔ + finiteTestProfile q f ∈ + denseModelProfileSet Ω τ q ε := by + constructor + · rintro ⟨g, hg, hmatch⟩ + change + finiteTestProfile q f ∈ + finiteTestProfile q '' unitCubeSet Ω + + profileErrorSet τ ε + refine ⟨finiteTestProfile q g, ⟨g, hg, rfl⟩, + finiteTestProfile q (f - g), ?_, ?_⟩ + · rw [mem_profileErrorSet_iff] + intro t + exact hmatch t + · ext t + simp only [Pi.add_apply, finiteTestProfile_apply] + rw [finitePairing_sub_left] + ring + · intro hmem + change + finiteTestProfile q f ∈ + finiteTestProfile q '' unitCubeSet Ω + + profileErrorSet τ ε at hmem + rcases hmem with ⟨p, ⟨g, hg, rfl⟩, e, he, hsum⟩ + refine ⟨g, hg, ?_⟩ + rw [mem_profileErrorSet_iff] at he + intro t + have ht := congrFun hsum t + simp only [Pi.add_apply, finiteTestProfile_apply] at ht + rw [finitePairing_sub_left] + rw [← ht] + simpa using he t + +theorem exists_finiteDenseModel_separator + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (f : Ω → ℝ) + {ε : ℝ} (hε : 0 ≤ ε) + (hfail : ¬HasFiniteDenseModel q f ε) : + ∃ L : StrongDual ℝ (τ → ℝ), L ≠ 0 ∧ + ∀ (g : Ω → ℝ), IsUnitBounded g → + ∀ e ∈ profileErrorSet τ ε, + L (finiteTestProfile q g + e) < + L (finiteTestProfile q f) := by + have hnotmem : + finiteTestProfile q f ∉ + denseModelProfileSet Ω τ q ε := by + simpa [hasFiniteDenseModel_iff_profile_mem] using hfail + obtain ⟨L, u, hleft, hright⟩ := + geometric_hahn_banach_closed_point + (denseModelProfileSet_convex Ω τ q ε) + (denseModelProfileSet_closed Ω τ q ε) + hnotmem + have hLne : L ≠ 0 := by + obtain ⟨s, hs⟩ := + denseModelProfileSet_nonempty Ω τ q hε + intro hzero + have hslt := hleft s hs + rw [hzero] at hslt hright + simp only [zero_apply] at hslt hright + linarith + refine ⟨L, hLne, ?_⟩ + intro g hg e he + have hmem : + finiteTestProfile q g + e ∈ + denseModelProfileSet Ω τ q ε := by + change + finiteTestProfile q g + e ∈ + finiteTestProfile q '' unitCubeSet Ω + + profileErrorSet τ ε + exact ⟨finiteTestProfile q g, ⟨g, hg, rfl⟩, + e, he, rfl⟩ + exact (hleft _ hmem).trans hright + +noncomputable def dualCoefficient + {τ : Type*} [Fintype τ] + (L : StrongDual ℝ (τ → ℝ)) (t : τ) : ℝ := by + classical + exact L (Pi.single t 1) + +theorem dual_apply_eq_sum_coefficient + {τ : Type*} [Fintype τ] + (L : StrongDual ℝ (τ → ℝ)) (v : τ → ℝ) : + L v = ∑ t, dualCoefficient L t * v t := by + classical + calc + L v = + L (∑ t, (v t) • + Pi.single (M := fun _ : τ => ℝ) t 1) := by + rw [← pi_eq_sum_univ' v] + _ = ∑ t, + L ((v t) • + Pi.single (M := fun _ : τ => ℝ) t 1) := by + exact map_sum L _ _ + _ = ∑ t, dualCoefficient L t * v t := by + apply Fintype.sum_congr + intro t + rw [map_smul] + simp [dualCoefficient, mul_comm] + +noncomputable def coefficientL1 + {τ : Type*} [Fintype τ] (c : τ → ℝ) : ℝ := + ∑ t, |c t| + +theorem coefficientL1_nonneg + {τ : Type*} [Fintype τ] (c : τ → ℝ) : + 0 ≤ coefficientL1 c := + Finset.sum_nonneg fun _ _ => abs_nonneg _ + +theorem coefficientL1_eq_zero_iff + {τ : Type*} [Fintype τ] (c : τ → ℝ) : + coefficientL1 c = 0 ↔ c = 0 := by + classical + constructor + · intro h + funext t + have ht : |c t| = 0 := by + exact + (Finset.sum_eq_zero_iff_of_nonneg + (fun i _ => abs_nonneg (c i))).mp h t + (Finset.mem_univ t) + exact abs_eq_zero.mp ht + · rintro rfl + simp [coefficientL1] + +theorem coefficientL1_smul + {τ : Type*} [Fintype τ] (a : ℝ) (c : τ → ℝ) : + coefficientL1 (a • c) = |a| * coefficientL1 c := by + classical + simp [coefficientL1, abs_mul, Finset.mul_sum] + +theorem coefficientL1_dualCoefficient_pos + {τ : Type*} [Fintype τ] + {L : StrongDual ℝ (τ → ℝ)} (hL : L ≠ 0) : + 0 < coefficientL1 (dualCoefficient L) := by + classical + have hexists : ∃ t, dualCoefficient L t ≠ 0 := by + by_contra h + push Not at h + apply hL + ext v + rw [dual_apply_eq_sum_coefficient] + simp [h] + obtain ⟨t, ht⟩ := hexists + unfold coefficientL1 + exact Finset.sum_pos' + (fun i _ => abs_nonneg (dualCoefficient L i)) + ⟨t, Finset.mem_univ t, abs_pos.mpr ht⟩ + +noncomputable def finiteTestCombination + {Ω τ : Type*} [Fintype τ] + (q : τ → Ω → ℝ) (c : τ → ℝ) : Ω → ℝ := + ∑ t, c t • q t + +@[simp] +theorem finiteTestCombination_zero + {Ω τ : Type*} [Fintype τ] (q : τ → Ω → ℝ) : + finiteTestCombination q 0 = 0 := by + classical + ext x + simp [finiteTestCombination] + +theorem finiteTestCombination_smul_coeff + {Ω τ : Type*} [Fintype τ] + (q : τ → Ω → ℝ) (a : ℝ) (c : τ → ℝ) : + finiteTestCombination q (a • c) = + a • finiteTestCombination q c := by + classical + ext x + simp [finiteTestCombination, Finset.mul_sum, mul_assoc] + +theorem finitePairing_finiteTestCombination + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (f : Ω → ℝ) (q : τ → Ω → ℝ) (c : τ → ℝ) : + finitePairing f (finiteTestCombination q c) = + ∑ t, c t * finitePairing f (q t) := by + rw [finiteTestCombination] + unfold finitePairing mean + simp_rw [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, + Finset.mul_sum] + rw [Finset.expect_sum_comm] + apply Fintype.sum_congr + intro t + calc + (Finset.univ.expect fun x => f x * (c t * q t x)) = + Finset.univ.expect (fun x => c t * (f x * q t x)) := by + apply Finset.expect_congr rfl + intro x _ + ring + _ = c t * + Finset.univ.expect (fun x => f x * q t x) := by + exact (Finset.mul_expect Finset.univ + (fun x => f x * q t x) (c t)).symm + +theorem dual_profile_eq_pairing_combination + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (L : StrongDual ℝ (τ → ℝ)) + (q : τ → Ω → ℝ) (f : Ω → ℝ) : + L (finiteTestProfile q f) = + finitePairing f + (finiteTestCombination q (dualCoefficient L)) := by + rw [dual_apply_eq_sum_coefficient, + finitePairing_finiteTestCombination] + apply Fintype.sum_congr + intro t + rw [finiteTestProfile_apply] + +noncomputable def dualErrorVector + {τ : Type*} [Fintype τ] + (ε : ℝ) (L : StrongDual ℝ (τ → ℝ)) : τ → ℝ := + fun t => ε * + ((SignType.sign (dualCoefficient L t) : SignType) : ℝ) + +theorem dualErrorVector_mem + {τ : Type*} [Fintype τ] + {ε : ℝ} (hε : 0 ≤ ε) + (L : StrongDual ℝ (τ → ℝ)) : + dualErrorVector ε L ∈ profileErrorSet τ ε := by + rw [mem_profileErrorSet_iff] + intro t + rw [dualErrorVector, abs_mul, abs_of_nonneg hε] + have hsign : + |((SignType.sign (dualCoefficient L t) : SignType) : ℝ)| ≤ 1 := by + rw [sign_apply] + split_ifs <;> norm_num + simpa using mul_le_mul_of_nonneg_left hsign hε + +theorem dual_apply_dualErrorVector + {τ : Type*} [Fintype τ] + (ε : ℝ) (L : StrongDual ℝ (τ → ℝ)) : + L (dualErrorVector ε L) = + ε * coefficientL1 (dualCoefficient L) := by + rw [dual_apply_eq_sum_coefficient] + calc + (∑ t, dualCoefficient L t * dualErrorVector ε L t) = + ∑ t, ε * |dualCoefficient L t| := by + apply Fintype.sum_congr + intro t + rw [dualErrorVector] + rw [← self_mul_sign (dualCoefficient L t)] + ring + _ = ε * coefficientL1 (dualCoefficient L) := by + rw [coefficientL1, Finset.mul_sum] + +def positivePart {Ω : Type*} (q : Ω → ℝ) : Ω → ℝ := + fun x => max (q x) 0 + +@[simp] +theorem positivePart_apply + {Ω : Type*} (q : Ω → ℝ) (x : Ω) : + positivePart q x = max (q x) 0 := + rfl + +theorem positivePart_nonneg + {Ω : Type*} (q : Ω → ℝ) (x : Ω) : + 0 ≤ positivePart q x := + le_max_right _ _ + +theorem le_positivePart + {Ω : Type*} (q : Ω → ℝ) (x : Ω) : + q x ≤ positivePart q x := + le_max_left _ _ + +@[simp] +theorem positivePart_of_nonneg + {Ω : Type*} {q : Ω → ℝ} {x : Ω} + (hx : 0 ≤ q x) : + positivePart q x = q x := + max_eq_left hx + +@[simp] +theorem positivePart_of_nonpos + {Ω : Type*} {q : Ω → ℝ} {x : Ω} + (hx : q x ≤ 0) : + positivePart q x = 0 := + max_eq_right hx + +@[simp] +theorem positivePart_zero {Ω : Type*} : + positivePart (0 : Ω → ℝ) = 0 := by + ext x + simp [positivePart] + +theorem positivePart_smul_of_nonneg + {Ω : Type*} {a : ℝ} (ha : 0 ≤ a) (q : Ω → ℝ) : + positivePart (a • q) = a • positivePart q := by + ext x + simp only [positivePart, Pi.smul_apply, smul_eq_mul] + rw [mul_max_of_nonneg _ _ ha, mul_zero] + +noncomputable def positiveSupportIndicator + {Ω : Type*} (q : Ω → ℝ) : Ω → ℝ := + fun x => if 0 ≤ q x then 1 else 0 + +theorem positiveSupportIndicator_unitBounded + {Ω : Type*} (q : Ω → ℝ) : + IsUnitBounded (positiveSupportIndicator q) := by + constructor <;> intro x <;> + simp only [positiveSupportIndicator] <;> + split <;> norm_num + +@[simp] +theorem positiveSupportIndicator_mul + {Ω : Type*} (q : Ω → ℝ) (x : Ω) : + positiveSupportIndicator q x * q x = + positivePart q x := by + by_cases hx : 0 ≤ q x + · simp [positiveSupportIndicator, positivePart, hx] + · have hx' : q x ≤ 0 := le_of_not_ge hx + simp [positiveSupportIndicator, positivePart, hx, hx'] + +theorem finitePairing_positiveSupportIndicator + {Ω : Type*} [Fintype Ω] (q : Ω → ℝ) : + finitePairing (positiveSupportIndicator q) q = + mean (positivePart q) := by + apply congrArg mean + funext x + exact positiveSupportIndicator_mul q x + +theorem finitePairing_le_mean_positivePart + {Ω : Type*} [Fintype Ω] + {g q : Ω → ℝ} (hg : IsUnitBounded g) : + finitePairing g q ≤ mean (positivePart q) := by + apply mean_mono + intro x + by_cases hx : 0 ≤ q x + · rw [positivePart_of_nonneg hx] + exact mul_le_of_le_one_left hx (hg.le_one x) + · rw [positivePart_of_nonpos (le_of_not_ge hx)] + exact mul_nonpos_of_nonneg_of_nonpos + (hg.nonneg x) (le_of_not_ge hx) + +theorem finitePairing_le_majorant_positivePart + {Ω : Type*} [Fintype Ω] + {f ν q : Ω → ℝ} + (hf0 : ∀ x, 0 ≤ f x) (hfν : ∀ x, f x ≤ ν x) : + finitePairing f q ≤ finitePairing ν (positivePart q) := by + apply mean_mono + intro x + by_cases hx : 0 ≤ q x + · rw [positivePart_of_nonneg hx] + exact mul_le_mul_of_nonneg_right (hfν x) hx + · rw [positivePart_of_nonpos (le_of_not_ge hx), mul_zero] + exact mul_nonpos_of_nonneg_of_nonpos + (hf0 x) (le_of_not_ge hx) + +@[simp] +theorem finitePairing_one_left + {Ω : Type*} [Fintype Ω] (q : Ω → ℝ) : + finitePairing (fun _ : Ω => (1 : ℝ)) q = mean q := by + simp [finitePairing] + +theorem majorant_positivePart_correlation_of_separates_unitCube + {Ω : Type*} [Fintype Ω] + {f ν q : Ω → ℝ} {δ : ℝ} + (hf0 : ∀ x, 0 ≤ f x) (hfν : ∀ x, f x ≤ ν x) + (hsep : + ∀ g : Ω → ℝ, IsUnitBounded g → + finitePairing g q + δ < finitePairing f q) : + δ < finitePairing (ν - fun _ => 1) (positivePart q) := by + have hsupport := hsep (positiveSupportIndicator q) + (positiveSupportIndicator_unitBounded q) + rw [finitePairing_positiveSupportIndicator] at hsupport + have hmajorant : + finitePairing f q ≤ finitePairing ν (positivePart q) := + finitePairing_le_majorant_positivePart + (q := q) hf0 hfν + rw [finitePairing_sub_left, finitePairing_one_left] + linarith + +def HasPositivePartCorrelationBound + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (ν : Ω → ℝ) (ε : ℝ) : Prop := + ∀ c : τ → ℝ, + finitePairing (ν - fun _ => 1) + (positivePart (finiteTestCombination q c)) ≤ + ε * coefficientL1 c + +def HasNormalizedPositivePartCorrelationBound + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (ν : Ω → ℝ) (ε : ℝ) : Prop := + ∀ c : τ → ℝ, coefficientL1 c = 1 → + finitePairing (ν - fun _ => 1) + (positivePart (finiteTestCombination q c)) ≤ ε + +theorem hasPositivePartCorrelationBound_of_normalized + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) (ν : Ω → ℝ) (ε : ℝ) + (h : + HasNormalizedPositivePartCorrelationBound q ν ε) : + HasPositivePartCorrelationBound q ν ε := by + intro c + by_cases hc : coefficientL1 c = 0 + · have hc0 : c = 0 := + (coefficientL1_eq_zero_iff c).mp hc + subst c + rw [hc] + simp [finitePairing, positivePart] + · have hcpos : 0 < coefficientL1 c := + lt_of_le_of_ne (coefficientL1_nonneg c) (Ne.symm hc) + let A := coefficientL1 c + let c' : τ → ℝ := A⁻¹ • c + have hApos : 0 < A := hcpos + have hc'L1 : coefficientL1 c' = 1 := by + change coefficientL1 (A⁻¹ • c) = 1 + rw [coefficientL1_smul, abs_of_pos (inv_pos.mpr hApos)] + exact inv_mul_cancel₀ hApos.ne' + have hnormalized := h c' hc'L1 + have hcombination : + finiteTestCombination q c' = + A⁻¹ • finiteTestCombination q c := by + exact finiteTestCombination_smul_coeff q A⁻¹ c + rw [hcombination, + positivePart_smul_of_nonneg (inv_nonneg.mpr hApos.le), + finitePairing_smul_right] at hnormalized + have hmul := + mul_le_mul_of_nonneg_left hnormalized hApos.le + rw [← mul_assoc, mul_inv_cancel₀ hApos.ne', one_mul] at hmul + simpa [A, mul_comm] using hmul + +theorem hasFiniteDenseModel_of_positivePartCorrelationBound + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (q : τ → Ω → ℝ) {f ν : Ω → ℝ} {ε : ℝ} + (hε : 0 ≤ ε) + (hf0 : ∀ x, 0 ≤ f x) (hfν : ∀ x, f x ≤ ν x) + (hpseudo : HasPositivePartCorrelationBound q ν ε) : + HasFiniteDenseModel q f ε := by + by_contra hfail + obtain ⟨L, _hL, hsep⟩ := + exists_finiteDenseModel_separator q f hε hfail + have hsepPair : + ∀ g : Ω → ℝ, IsUnitBounded g → + finitePairing g + (finiteTestCombination q (dualCoefficient L)) + + ε * coefficientL1 (dualCoefficient L) < + finitePairing f + (finiteTestCombination q (dualCoefficient L)) := by + intro g hg + have h := hsep g hg (dualErrorVector ε L) + (dualErrorVector_mem hε L) + rw [map_add, dual_profile_eq_pairing_combination, + dual_apply_dualErrorVector, + dual_profile_eq_pairing_combination] at h + exact h + have hpositive := + majorant_positivePart_correlation_of_separates_unitCube + hf0 hfν hsepPair + exact (not_lt_of_ge (hpseudo (dualCoefficient L))) hpositive + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators Polynomial + +def testMonomial + {Ω τ : Type*} (q : τ → Ω → ℝ) + {n : ℕ} (s : Fin n → τ) : Ω → ℝ := + fun x => ∏ i, q (s i) x + +@[simp] +theorem testMonomial_apply + {Ω τ : Type*} (q : τ → Ω → ℝ) + {n : ℕ} (s : Fin n → τ) (x : Ω) : + testMonomial q s x = ∏ i, q (s i) x := + rfl + +noncomputable def polynomialCoefficientL1 (p : ℝ[X]) : ℝ := + ∑ n ∈ p.support, |p.coeff n| + +theorem polynomialCoefficientL1_nonneg (p : ℝ[X]) : + 0 ≤ polynomialCoefficientL1 p := + Finset.sum_nonneg fun _ _ => abs_nonneg _ + +@[simp] +theorem finiteTestCombination_apply + {Ω τ : Type*} [Fintype τ] + (q : τ → Ω → ℝ) (c : τ → ℝ) (x : Ω) : + finiteTestCombination q c x = ∑ t, c t * q t x := by + classical + simp [finiteTestCombination] + +theorem finitePairing_finset_sum_right + {Ω κ : Type*} [Fintype Ω] + (f : Ω → ℝ) (s : Finset κ) (q : κ → Ω → ℝ) : + finitePairing f (fun x => ∑ i ∈ s, q i x) = + ∑ i ∈ s, finitePairing f (q i) := by + classical + unfold finitePairing mean + calc + (𝔼 x, f x * ∑ i ∈ s, q i x) = + 𝔼 x, ∑ i ∈ s, f x * q i x := by + apply Finset.expect_congr rfl + intro x _ + rw [Finset.mul_sum] + _ = ∑ i ∈ s, 𝔼 x, f x * q i x := by + exact Finset.expect_sum_comm Finset.univ s _ + +theorem finitePairing_fintype_sum_right + {Ω κ : Type*} [Fintype Ω] [Fintype κ] + (f : Ω → ℝ) (q : κ → Ω → ℝ) : + finitePairing f (fun x => ∑ i, q i x) = + ∑ i, finitePairing f (q i) := by + simpa using finitePairing_finset_sum_right f Finset.univ q + +theorem finiteTestCombination_pow_eq_sum_monomials + {Ω τ : Type*} [Fintype τ] + (q : τ → Ω → ℝ) (c : τ → ℝ) + (n : ℕ) (x : Ω) : + (finiteTestCombination q c x) ^ n = + ∑ s : Fin n → τ, + (∏ i, c (s i)) * testMonomial q s x := by + classical + rw [finiteTestCombination_apply, Fintype.sum_pow] + apply Fintype.sum_congr + intro s + rw [Finset.prod_mul_distrib] + rfl + +theorem polynomial_eval_finiteTestCombination + {Ω τ : Type*} [Fintype τ] + (p : ℝ[X]) (q : τ → Ω → ℝ) (c : τ → ℝ) (x : Ω) : + p.eval (finiteTestCombination q c x) = + ∑ n ∈ p.support, + ∑ s : Fin n → τ, + (p.coeff n * ∏ i, c (s i)) * + testMonomial q s x := by + classical + rw [Polynomial.eval_eq_sum] + change + (∑ n ∈ p.support, + p.coeff n * (finiteTestCombination q c x) ^ n) = _ + apply Finset.sum_congr rfl + intro n hn + rw [finiteTestCombination_pow_eq_sum_monomials, + Finset.mul_sum] + apply Fintype.sum_congr + intro s + ring + +theorem finitePairing_polynomial_eval_finiteTestCombination + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + (f : Ω → ℝ) (p : ℝ[X]) + (q : τ → Ω → ℝ) (c : τ → ℝ) : + finitePairing f + (fun x => p.eval (finiteTestCombination q c x)) = + ∑ n ∈ p.support, + ∑ s : Fin n → τ, + (p.coeff n * ∏ i, c (s i)) * + finitePairing f (testMonomial q s) := by + classical + have heval : + (fun x => p.eval (finiteTestCombination q c x)) = + fun x => ∑ n ∈ p.support, + ∑ s : Fin n → τ, + (p.coeff n * ∏ i, c (s i)) * + testMonomial q s x := by + funext x + exact polynomial_eval_finiteTestCombination p q c x + rw [heval, finitePairing_finset_sum_right] + apply Finset.sum_congr rfl + intro n hn + rw [finitePairing_fintype_sum_right] + apply Fintype.sum_congr + intro s + change + finitePairing f + ((p.coeff n * ∏ i, c (s i)) • testMonomial q s) = + _ + exact + finitePairing_smul_right + (p.coeff n * ∏ i, c (s i)) f (testMonomial q s) + +theorem sum_abs_coefficientMonomial + {τ : Type*} [Fintype τ] + (c : τ → ℝ) (n : ℕ) : + ∑ s : Fin n → τ, |∏ i, c (s i)| = + coefficientL1 c ^ n := by + classical + unfold coefficientL1 + rw [Fintype.sum_pow] + apply Fintype.sum_congr + intro s + rw [Finset.abs_prod] + +def HasMonomialCorrelationBound + {Ω τ : Type*} [Fintype Ω] + (q : τ → Ω → ℝ) (ν : Ω → ℝ) + (d : ℕ) (η : ℝ) : Prop := + ∀ (n : ℕ), n ≤ d → ∀ s : Fin n → τ, + |finitePairing (ν - fun _ => 1) (testMonomial q s)| ≤ η + +theorem abs_finitePairing_polynomial_eval_le + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + {q : τ → Ω → ℝ} {ν : Ω → ℝ} + {η : ℝ} (p : ℝ[X]) (c : τ → ℝ) + (hc : coefficientL1 c = 1) + (hmono : + HasMonomialCorrelationBound q ν p.natDegree η) : + |finitePairing (ν - fun _ => 1) + (fun x => p.eval (finiteTestCombination q c x))| ≤ + polynomialCoefficientL1 p * η := by + classical + rw [finitePairing_polynomial_eval_finiteTestCombination] + calc + |∑ n ∈ p.support, + ∑ s : Fin n → τ, + (p.coeff n * ∏ i, c (s i)) * + finitePairing (ν - fun _ => 1) + (testMonomial q s)| ≤ + ∑ n ∈ p.support, + |∑ s : Fin n → τ, + (p.coeff n * ∏ i, c (s i)) * + finitePairing (ν - fun _ => 1) + (testMonomial q s)| := by + exact Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ n ∈ p.support, |p.coeff n| * η := by + apply Finset.sum_le_sum + intro n hn + calc + |∑ s : Fin n → τ, + (p.coeff n * ∏ i, c (s i)) * + finitePairing (ν - fun _ => 1) + (testMonomial q s)| ≤ + ∑ s : Fin n → τ, + |(p.coeff n * ∏ i, c (s i)) * + finitePairing (ν - fun _ => 1) + (testMonomial q s)| := by + exact Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ s : Fin n → τ, + |p.coeff n| * |∏ i, c (s i)| * η := by + apply Finset.sum_le_sum + intro s hs + rw [abs_mul, abs_mul] + exact mul_le_mul_of_nonneg_left + (hmono n + (Polynomial.le_natDegree_of_mem_supp n hn) s) + (mul_nonneg (abs_nonneg _) (abs_nonneg _)) + _ = |p.coeff n| * + (∑ s : Fin n → τ, |∏ i, c (s i)|) * η := by + rw [Finset.mul_sum, Finset.sum_mul] + _ = |p.coeff n| * η := by + rw [sum_abs_coefficientMonomial, hc, one_pow, mul_one] + _ = polynomialCoefficientL1 p * η := by + rw [polynomialCoefficientL1, Finset.sum_mul] + +def IsUnitBoundedTestFamily + {Ω τ : Type*} (q : τ → Ω → ℝ) : Prop := + ∀ t, IsUnitBounded (q t) + +theorem abs_finiteTestCombination_le_coefficientL1 + {Ω τ : Type*} [Fintype τ] + {q : τ → Ω → ℝ} + (hq : IsUnitBoundedTestFamily q) + (c : τ → ℝ) (x : Ω) : + |finiteTestCombination q c x| ≤ coefficientL1 c := by + classical + rw [finiteTestCombination_apply] + calc + |∑ t, c t * q t x| ≤ ∑ t, |c t * q t x| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ t, |c t| := by + apply Finset.sum_le_sum + intro t ht + rw [abs_mul] + have habs : |q t x| ≤ 1 := by + rw [abs_le] + constructor + · linarith [(hq t).nonneg x] + · exact (hq t).le_one x + exact mul_le_of_le_one_right (abs_nonneg (c t)) habs + _ = coefficientL1 c := by + rfl + +theorem finiteTestCombination_mem_unitInterval + {Ω τ : Type*} [Fintype τ] + {q : τ → Ω → ℝ} + (hq : IsUnitBoundedTestFamily q) + {c : τ → ℝ} (hc : coefficientL1 c = 1) + (x : Ω) : + finiteTestCombination q c x ∈ Set.Icc (-1 : ℝ) 1 := by + rw [Set.mem_Icc, ← abs_le] + simpa [hc] using + abs_finiteTestCombination_le_coefficientL1 hq c x + +def ApproximatesPositivePartOnUnitInterval + (p : ℝ[X]) (δ : ℝ) : Prop := + ∀ x ∈ Set.Icc (-1 : ℝ) 1, + |p.eval x - max x 0| ≤ δ + +theorem exists_polynomial_approximating_positivePart + {δ : ℝ} (hδ : 0 < δ) : + ∃ p : ℝ[X], ApproximatesPositivePartOnUnitInterval p δ := by + have hcontinuous : + ContinuousOn (fun x : ℝ => max x 0) + (Set.Icc (-1 : ℝ) 1) := + (continuous_id.max continuous_const).continuousOn + obtain ⟨p, hp⟩ := + exists_polynomial_near_of_continuousOn + (-1 : ℝ) 1 (fun x : ℝ => max x 0) + hcontinuous δ hδ + exact ⟨p, fun x hx => (hp x hx).le⟩ + +theorem polynomial_eval_approximates_positivePart_combination + {Ω τ : Type*} [Fintype τ] + {q : τ → Ω → ℝ} + (hq : IsUnitBoundedTestFamily q) + {p : ℝ[X]} {δ : ℝ} + (hp : ApproximatesPositivePartOnUnitInterval p δ) + {c : τ → ℝ} (hc : coefficientL1 c = 1) + (x : Ω) : + |p.eval (finiteTestCombination q c x) - + positivePart (finiteTestCombination q c) x| ≤ δ := by + exact hp _ (finiteTestCombination_mem_unitInterval hq hc x) + +theorem abs_finitePairing_le_mul_mean_abs + {Ω : Type*} [Fintype Ω] + (f e : Ω → ℝ) {δ : ℝ} + (he : ∀ x, |e x| ≤ δ) : + |finitePairing f e| ≤ δ * mean (fun x => |f x|) := by + calc + |finitePairing f e| ≤ mean (fun x => |f x * e x|) := by + unfold finitePairing mean + exact Finset.abs_expect_le Finset.univ _ + _ ≤ mean (fun x => δ * |f x|) := by + apply mean_mono + intro x + rw [abs_mul] + have hmul := + mul_le_mul_of_nonneg_left (he x) (abs_nonneg (f x)) + simpa [mul_comm] using hmul + _ = δ * mean (fun x => |f x|) := + mean_smul δ _ + +noncomputable def centeredAbsoluteMean + {Ω : Type*} [Fintype Ω] (ν : Ω → ℝ) : ℝ := + mean fun x => |ν x - 1| + +theorem centeredAbsoluteMean_nonneg + {Ω : Type*} [Fintype Ω] (ν : Ω → ℝ) : + 0 ≤ centeredAbsoluteMean ν := + mean_nonneg fun _ => abs_nonneg _ + +theorem centeredAbsoluteMean_le_mean_add_one + {Ω : Type*} [Fintype Ω] [Nonempty Ω] + {ν : Ω → ℝ} (hν : ∀ x, 0 ≤ ν x) : + centeredAbsoluteMean ν ≤ mean ν + 1 := by + unfold centeredAbsoluteMean + calc + mean (fun x => |ν x - 1|) ≤ + mean (fun x => ν x + 1) := by + apply mean_mono + intro x + rw [abs_le] + constructor <;> linarith [hν x] + _ = mean ν + mean (fun _ : Ω => (1 : ℝ)) := + mean_add _ _ + _ = mean ν + 1 := by + rw [mean_const] + +theorem hasNormalizedPositivePartCorrelationBound_of_polynomial + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + {q : τ → Ω → ℝ} {ν : Ω → ℝ} + (hq : IsUnitBoundedTestFamily q) + {p : ℝ[X]} {δ η M : ℝ} + (hδ : 0 ≤ δ) + (hp : ApproximatesPositivePartOnUnitInterval p δ) + (hM : centeredAbsoluteMean ν ≤ M) + (hmono : + HasMonomialCorrelationBound q ν p.natDegree η) : + HasNormalizedPositivePartCorrelationBound q ν + (polynomialCoefficientL1 p * η + δ * M) := by + intro c hc + let Q := finiteTestCombination q c + let P : Ω → ℝ := fun x => p.eval (Q x) + have hpoly : + finitePairing (ν - fun _ => 1) P ≤ + polynomialCoefficientL1 p * η := by + exact le_trans (le_abs_self _) <| + abs_finitePairing_polynomial_eval_le p c hc hmono + have hpoint : + ∀ x, |positivePart Q x - P x| ≤ δ := by + intro x + have hx := + polynomial_eval_approximates_positivePart_combination + hq hp hc x + simpa [Q, P, abs_sub_comm] using hx + have herr0 : + |finitePairing (ν - fun _ => 1) + (positivePart Q - P)| ≤ + δ * centeredAbsoluteMean ν := by + have hbase := + abs_finitePairing_le_mul_mean_abs + (ν - fun _ => 1) (positivePart Q - P) + (by + intro x + simpa using hpoint x) + have hcentered : + (fun x => + |(ν - (fun _ : Ω => (1 : ℝ))) x|) = + (fun x => |ν x - 1|) := by + funext x + rfl + rw [hcentered] at hbase + exact hbase + have herr : + finitePairing (ν - fun _ => 1) + (positivePart Q - P) ≤ δ * M := by + calc + finitePairing (ν - fun _ => 1) + (positivePart Q - P) ≤ + |finitePairing (ν - fun _ => 1) + (positivePart Q - P)| := + le_abs_self _ + _ ≤ δ * centeredAbsoluteMean ν := herr0 + _ ≤ δ * M := + mul_le_mul_of_nonneg_left hM hδ + have hsplit : + finitePairing (ν - fun _ => 1) (positivePart Q) = + finitePairing (ν - fun _ => 1) P + + finitePairing (ν - fun _ => 1) + (positivePart Q - P) := by + rw [← finitePairing_add_right] + congr 1 + funext x + simp + rw [hsplit] + exact add_le_add hpoly herr + +theorem hasPositivePartCorrelationBound_of_polynomial + {Ω τ : Type*} [Fintype Ω] [Fintype τ] + {q : τ → Ω → ℝ} {ν : Ω → ℝ} + (hq : IsUnitBoundedTestFamily q) + {p : ℝ[X]} {δ η M : ℝ} + (hδ : 0 ≤ δ) + (hp : ApproximatesPositivePartOnUnitInterval p δ) + (hM : centeredAbsoluteMean ν ≤ M) + (hmono : + HasMonomialCorrelationBound q ν p.natDegree η) : + HasPositivePartCorrelationBound q ν + (polynomialCoefficientL1 p * η + δ * M) := + hasPositivePartCorrelationBound_of_normalized q ν _ + (hasNormalizedPositivePartCorrelationBound_of_polynomial + hq hδ hp hM hmono) + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/RankwiseBundleEnvelopeSelection.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/RankwiseBundleEnvelopeSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..38413b29132e964d30948c36f02befb3ef36166e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/RankwiseBundleEnvelopeSelection.lean @@ -0,0 +1,708 @@ +import OAI.Combinatorics.Progressions.FixedDensity.HypergraphBundleEnvelopeSelection + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open Filter Topology + +def bundleRankwiseDensityFloor (α : ℕ → ℝ) : ℕ → ℝ + | 0 => α 0 + | d + 1 => min (bundleRankwiseDensityFloor α d) (α (d + 1)) + +@[simp] +theorem bundleRankwiseDensityFloor_zero (α : ℕ → ℝ) : + bundleRankwiseDensityFloor α 0 = α 0 := + rfl + +@[simp] +theorem bundleRankwiseDensityFloor_succ (α : ℕ → ℝ) (d : ℕ) : + bundleRankwiseDensityFloor α (d + 1) = + min (bundleRankwiseDensityFloor α d) (α (d + 1)) := + rfl + +theorem bundleRankwiseDensityFloor_pos + {α : ℕ → ℝ} (hα : ∀ d, 0 < α d) : + ∀ d, 0 < bundleRankwiseDensityFloor α d := by + intro d + induction d with + | zero => simpa using hα 0 + | succ d ih => + simpa using lt_min ih (hα (d + 1)) + +theorem bundleRankwiseDensityFloor_le + (α : ℕ → ℝ) {i d : ℕ} (hid : i ≤ d) : + bundleRankwiseDensityFloor α d ≤ α i := by + induction d with + | zero => + have hi : i = 0 := Nat.eq_zero_of_le_zero hid + subst i + exact le_rfl + | succ d ih => + rw [bundleRankwiseDensityFloor_succ] + by_cases hi : i = d + 1 + · subst i + exact min_le_right _ _ + · exact (min_le_left _ _).trans (ih (Nat.le_of_lt_succ (lt_of_le_of_ne hid hi))) + +theorem bundleRankwiseDensityFloor_antitone (α : ℕ → ℝ) : + Antitone (bundleRankwiseDensityFloor α) := by + apply antitone_nat_of_succ_le + intro d + rw [bundleRankwiseDensityFloor_succ] + exact min_le_left _ _ + +noncomputable def bundleRankwiseStepIncrement + (α β μ : ℕ → ℝ) (τ : ℝ) + (lower : ℕ → ℝ) (d n : ℕ) : ℝ := + Real.sqrt + (β (d + 1) * + (1 + lower (n + 1)) * + (1 + lower (2 * (n + 1)))) / + (α (d + 1)) ^ (n + 1) + + τ / (μ (d + 1)) ^ (n + 1) + +noncomputable def bundleRankwiseNextRow + (α β μ : ℕ → ℝ) (τ : ℝ) + (d : ℕ) (lower : ℕ → ℝ) : ℕ → ℝ + | 0 => 0 + | n + 1 => + max (lower (n + 1)) + (bundleRankwiseNextRow α β μ τ d lower n + + bundleRankwiseStepIncrement α β μ τ lower d n) + +noncomputable def bundleRankwiseEnvelopeError + (α β μ : ℕ → ℝ) (τ : ℝ) : ℕ → ℕ → ℝ + | 0 => fun _ => 0 + | d + 1 => + bundleRankwiseNextRow α β μ τ d + (bundleRankwiseEnvelopeError α β μ τ d) + +@[simp] +theorem bundleRankwiseNextRow_zero + (α β μ : ℕ → ℝ) (τ : ℝ) (d : ℕ) (lower : ℕ → ℝ) : + bundleRankwiseNextRow α β μ τ d lower 0 = 0 := + rfl + +@[simp] +theorem bundleRankwiseNextRow_succ + (α β μ : ℕ → ℝ) (τ : ℝ) (d n : ℕ) (lower : ℕ → ℝ) : + bundleRankwiseNextRow α β μ τ d lower (n + 1) = + max (lower (n + 1)) + (bundleRankwiseNextRow α β μ τ d lower n + + bundleRankwiseStepIncrement α β μ τ lower d n) := + rfl + +@[simp] +theorem bundleRankwiseEnvelopeError_zero_order + (α β μ : ℕ → ℝ) (τ : ℝ) (n : ℕ) : + bundleRankwiseEnvelopeError α β μ τ 0 n = 0 := + rfl + +@[simp] +theorem bundleRankwiseEnvelopeError_succ_order + (α β μ : ℕ → ℝ) (τ : ℝ) (d n : ℕ) : + bundleRankwiseEnvelopeError α β μ τ (d + 1) n = + bundleRankwiseNextRow α β μ τ d + (bundleRankwiseEnvelopeError α β μ τ d) n := + rfl + +theorem bundleRankwiseStepIncrement_nonneg + {α β μ : ℕ → ℝ} {τ : ℝ} + (hα : ∀ d, 0 ≤ α d) (hμ : ∀ d, 0 ≤ μ d) + (hτ : 0 ≤ τ) (lower : ℕ → ℝ) (d n : ℕ) : + 0 ≤ bundleRankwiseStepIncrement α β μ τ lower d n := by + unfold bundleRankwiseStepIncrement + exact add_nonneg + (div_nonneg (Real.sqrt_nonneg _) (pow_nonneg (hα _) _)) + (div_nonneg hτ (pow_nonneg (hμ _) _)) + +theorem bundleRankwiseNextRow_nonneg + {α β μ : ℕ → ℝ} {τ : ℝ} + (hα : ∀ d, 0 ≤ α d) (hμ : ∀ d, 0 ≤ μ d) + (hτ : 0 ≤ τ) (d : ℕ) (lower : ℕ → ℝ) : + ∀ n, 0 ≤ bundleRankwiseNextRow α β μ τ d lower n := by + intro n + induction n with + | zero => simp + | succ n ih => + rw [bundleRankwiseNextRow_succ] + exact le_max_of_le_right + (add_nonneg ih + (bundleRankwiseStepIncrement_nonneg hα hμ hτ lower d n)) + +theorem bundleRankwiseEnvelopeError_nonneg + {α β μ : ℕ → ℝ} {τ : ℝ} + (hα : ∀ d, 0 ≤ α d) (hμ : ∀ d, 0 ≤ μ d) + (hτ : 0 ≤ τ) : + ∀ d n, 0 ≤ bundleRankwiseEnvelopeError α β μ τ d n := by + intro d + induction d with + | zero => + intro n + simp + | succ d _ih => + intro n + rw [bundleRankwiseEnvelopeError_succ_order] + exact bundleRankwiseNextRow_nonneg hα hμ hτ d _ n + +@[simp] +theorem bundleRankwiseEnvelopeError_zero_card + (α β μ : ℕ → ℝ) (τ : ℝ) : + ∀ d, bundleRankwiseEnvelopeError α β μ τ d 0 = 0 := by + intro d + cases d <;> simp + +theorem bundleRankwiseEnvelopeError_monotone_card + {α β μ : ℕ → ℝ} {τ : ℝ} + (hα : ∀ d, 0 ≤ α d) (hμ : ∀ d, 0 ≤ μ d) + (hτ : 0 ≤ τ) (d : ℕ) : + Monotone (bundleRankwiseEnvelopeError α β μ τ d) := by + apply monotone_nat_of_le_succ + intro n + cases d with + | zero => simp + | succ d => + rw [bundleRankwiseEnvelopeError_succ_order, + bundleRankwiseEnvelopeError_succ_order, + bundleRankwiseNextRow_succ] + exact le_max_of_le_right + (le_add_of_nonneg_right + (bundleRankwiseStepIncrement_nonneg hα hμ hτ _ d n)) + +theorem bundleRankwiseEnvelopeError_le_succ_order + (α β μ : ℕ → ℝ) (τ : ℝ) (d n : ℕ) : + bundleRankwiseEnvelopeError α β μ τ d n ≤ + bundleRankwiseEnvelopeError α β μ τ (d + 1) n := by + cases n with + | zero => simp + | succ n => + rw [bundleRankwiseEnvelopeError_succ_order, + bundleRankwiseNextRow_succ] + exact le_max_left _ _ + +theorem bundleRankwiseEnvelopeError_monotone_order + (α β μ : ℕ → ℝ) (τ : ℝ) (n : ℕ) : + Monotone (fun d => bundleRankwiseEnvelopeError α β μ τ d n) := by + apply monotone_nat_of_le_succ + exact fun d => bundleRankwiseEnvelopeError_le_succ_order α β μ τ d n + +theorem bundleRankwiseEnvelopeError_isEnvelope + {α β : ℕ → ℝ} {τ : ℝ} + (hα : ∀ d, 0 < α d) (hα_one : ∀ d, α d ≤ 1) + (hβ : ∀ d, 0 ≤ β d) (hτ : 0 ≤ τ) : + IsBundleCountingEnvelope α β + (bundleRankwiseDensityFloor α) τ + (bundleRankwiseEnvelopeError α β + (bundleRankwiseDensityFloor α) τ) := by + let μ := bundleRankwiseDensityFloor α + have hμ : ∀ d, 0 < μ d := bundleRankwiseDensityFloor_pos hα + refine + { density_pos := hα + density_le_one := hα_one + defect_nonneg := hβ + uniform_nonneg := hτ + floor_pos := hμ + rankFloor := ?_ + error_nonneg := bundleRankwiseEnvelopeError_nonneg + (fun d => (hα d).le) (fun d => (hμ d).le) hτ + error_mono_order := ?_ + error_mono_card := ?_ + step := ?_ } + · intro i d hid + exact bundleRankwiseDensityFloor_le α hid + · intro d d' n hdd' + exact (bundleRankwiseEnvelopeError_monotone_order α β μ τ n) hdd' + · intro d n n' hnn' + exact (bundleRankwiseEnvelopeError_monotone_card + (fun q => (hα q).le) (fun q => (hμ q).le) hτ d) hnn' + · intro d n + have hstep : + bundleRankwiseNextRow α β μ τ d + (bundleRankwiseEnvelopeError α β μ τ d) n + + bundleRankwiseStepIncrement α β μ τ + (bundleRankwiseEnvelopeError α β μ τ d) d n ≤ + max (bundleRankwiseEnvelopeError α β μ τ d (n + 1)) + (bundleRankwiseNextRow α β μ τ d + (bundleRankwiseEnvelopeError α β μ τ d) n + + bundleRankwiseStepIncrement α β μ τ + (bundleRankwiseEnvelopeError α β μ τ d) d n) := + le_max_right _ _ + simp [μ, bundleRankwiseStepIncrement, add_assoc] at hstep ⊢ + +@[simp] +theorem bundleRankwiseNextRow_zero_parameters + (α μ : ℕ → ℝ) (d : ℕ) (lower : ℕ → ℝ) + (hlower : ∀ n, lower n = 0) : + ∀ n, + bundleRankwiseNextRow α (fun _ => 0) μ 0 d lower n = 0 := by + intro n + induction n with + | zero => simp + | succ n ih => + rw [bundleRankwiseNextRow_succ, ih] + simp [bundleRankwiseStepIncrement, hlower] + +@[simp] +theorem bundleRankwiseEnvelopeError_zero_parameters + (α μ : ℕ → ℝ) : + ∀ d n, + bundleRankwiseEnvelopeError α (fun _ => 0) μ 0 d n = 0 := by + intro d + induction d with + | zero => + intro n + simp + | succ d ih => + intro n + rw [bundleRankwiseEnvelopeError_succ_order] + exact bundleRankwiseNextRow_zero_parameters α μ d _ ih n + +theorem continuous_bundleRankwiseNextRow + (α μ : ℕ → ℝ) (β : ℝ → ℕ → ℝ) (τ : ℝ → ℝ) + (d : ℕ) (lower : ℝ → ℕ → ℝ) + (hβ : ∀ q, Continuous (fun t => β t q)) + (hτ : Continuous τ) + (hlower : ∀ n, Continuous (fun t => lower t n)) : + ∀ n, + Continuous (fun t => + bundleRankwiseNextRow α (β t) μ (τ t) d (lower t) n) := by + intro n + induction n with + | zero => + simp only [bundleRankwiseNextRow_zero] + fun_prop + | succ n ih => + simp only [bundleRankwiseNextRow_succ, + bundleRankwiseStepIncrement] + have hβd := hβ (d + 1) + have hlower₁ := hlower (n + 1) + have hlower₂ := hlower (2 * (n + 1)) + fun_prop + +theorem continuous_bundleRankwiseEnvelopeError + (α μ : ℕ → ℝ) (β : ℝ → ℕ → ℝ) (τ : ℝ → ℝ) + (hβ : ∀ q, Continuous (fun t => β t q)) + (hτ : Continuous τ) : + ∀ d n, + Continuous (fun t => + bundleRankwiseEnvelopeError α (β t) μ (τ t) d n) := by + intro d + induction d with + | zero => + intro n + simp only [bundleRankwiseEnvelopeError_zero_order] + fun_prop + | succ d ih => + intro n + change Continuous (fun t => + bundleRankwiseNextRow α (β t) μ (τ t) d + (bundleRankwiseEnvelopeError α (β t) μ (τ t) d) n) + exact continuous_bundleRankwiseNextRow α μ β τ d _ hβ hτ ih n + +noncomputable def bundleRankwiseScaledDefect + (α : ℕ → ℝ) (power : ℕ → ℕ) (t : ℝ) (d : ℕ) : ℝ := + (t * (α d) ^ (power d)) ^ 2 + +noncomputable def bundleRankwiseScaledUniformity + (α : ℕ → ℝ) (rankBound uniformPower : ℕ) (t : ℝ) : ℝ := + (t * + (bundleRankwiseDensityFloor α rankBound) ^ uniformPower) ^ 2 + +theorem continuous_bundleRankwiseScaledDefect + (α : ℕ → ℝ) (power : ℕ → ℕ) (d : ℕ) : + Continuous (fun t => bundleRankwiseScaledDefect α power t d) := by + unfold bundleRankwiseScaledDefect + fun_prop + +theorem continuous_bundleRankwiseScaledUniformity + (α : ℕ → ℝ) (rankBound uniformPower : ℕ) : + Continuous (bundleRankwiseScaledUniformity α rankBound uniformPower) := by + unfold bundleRankwiseScaledUniformity + fun_prop + +@[simp] +theorem bundleRankwiseScaledDefect_zero + (α : ℕ → ℝ) (power : ℕ → ℕ) (d : ℕ) : + bundleRankwiseScaledDefect α power 0 d = 0 := by + simp [bundleRankwiseScaledDefect] + +@[simp] +theorem bundleRankwiseScaledUniformity_zero + (α : ℕ → ℝ) (rankBound uniformPower : ℕ) : + bundleRankwiseScaledUniformity α rankBound uniformPower 0 = 0 := by + simp [bundleRankwiseScaledUniformity] + +theorem tendsto_bundleRankwiseScaledEnvelopeError_zero + (α : ℕ → ℝ) (power : ℕ → ℕ) + (rankBound uniformPower d n : ℕ) : + Tendsto + (fun t => + bundleRankwiseEnvelopeError α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t) + d n) + (𝓝 0) (𝓝 0) := by + have hcontinuous := + continuous_bundleRankwiseEnvelopeError + α (bundleRankwiseDensityFloor α) + (fun t => bundleRankwiseScaledDefect α power t) + (bundleRankwiseScaledUniformity α rankBound uniformPower) + (continuous_bundleRankwiseScaledDefect α power) + (continuous_bundleRankwiseScaledUniformity α rankBound uniformPower) + d n + have hβzero : + bundleRankwiseScaledDefect α power 0 = fun _ => 0 := by + funext q + exact bundleRankwiseScaledDefect_zero α power q + simpa [hβzero] using hcontinuous.tendsto 0 + +theorem exists_bundleRankwiseScaledEnvelopeError_lt + {α : ℕ → ℝ} + (hα : ∀ d, 0 < α d) (hα_one : ∀ d, α d ≤ 1) + (power : ℕ → ℕ) (rankBound edgeBound uniformPower : ℕ) + {parameterReserve errorReserve : ℝ} + (hparameter : 0 < parameterReserve) + (herror : 0 < errorReserve) : + ∃ t : ℝ, + 0 < t ∧ t < parameterReserve ∧ t < 1 ∧ + IsBundleCountingEnvelope α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t) + (bundleRankwiseEnvelopeError α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t)) ∧ + bundleRankwiseEnvelopeError α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t) + rankBound edgeBound < errorReserve := by + have heventually : + ∀ᶠ t : ℝ in 𝓝 0, + bundleRankwiseEnvelopeError α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t) + rankBound edgeBound < errorReserve := + (tendsto_bundleRankwiseScaledEnvelopeError_zero + α power rankBound uniformPower rankBound edgeBound).eventually_lt_const herror + obtain ⟨δ, hδ, hball⟩ := Metric.eventually_nhds_iff_ball.mp heventually + let t : ℝ := min δ (min parameterReserve 1) / 2 + have hmin : 0 < min δ (min parameterReserve 1) := + lt_min hδ (lt_min hparameter zero_lt_one) + have ht : 0 < t := by + dsimp [t] + linarith + have htδ : t < δ := by + dsimp [t] + have hle : min δ (min parameterReserve 1) ≤ δ := min_le_left _ _ + linarith + have htparameter : t < parameterReserve := by + dsimp [t] + have hle₁ : min δ (min parameterReserve 1) ≤ min parameterReserve 1 := + min_le_right _ _ + have hle₂ : min parameterReserve 1 ≤ parameterReserve := min_le_left _ _ + linarith + have htone : t < 1 := by + dsimp [t] + have hle₁ : min δ (min parameterReserve 1) ≤ min parameterReserve 1 := + min_le_right _ _ + have hle₂ : min parameterReserve 1 ≤ 1 := min_le_right _ _ + linarith + have henvelope : + IsBundleCountingEnvelope α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t) + (bundleRankwiseEnvelopeError α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t)) := + bundleRankwiseEnvelopeError_isEnvelope hα hα_one + (fun d => sq_nonneg (t * (α d) ^ (power d))) + (sq_nonneg + (t * (bundleRankwiseDensityFloor α rankBound) ^ uniformPower)) + refine ⟨t, ht, htparameter, htone, henvelope, ?_⟩ + apply hball + simpa [Real.dist_eq, abs_of_pos ht] using htδ + +theorem exists_bundleRankwiseScaledEnvelopeError_lt_half + {α : ℕ → ℝ} + (hα : ∀ d, 0 < α d) (hα_one : ∀ d, α d ≤ 1) + (power : ℕ → ℕ) (rankBound edgeBound uniformPower : ℕ) : + ∃ t : ℝ, + 0 < t ∧ t < 1 ∧ + IsBundleCountingEnvelope α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t) + (bundleRankwiseEnvelopeError α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t)) ∧ + bundleRankwiseEnvelopeError α + (bundleRankwiseScaledDefect α power t) + (bundleRankwiseDensityFloor α) + (bundleRankwiseScaledUniformity α rankBound uniformPower t) + rankBound edgeBound < 1 / 2 := by + obtain ⟨t, ht, htone, _htone', hE, hfinal⟩ := + exists_bundleRankwiseScaledEnvelopeError_lt hα hα_one power + rankBound edgeBound uniformPower zero_lt_one + (by norm_num : (0 : ℝ) < 1 / 2) + exact ⟨t, ht, htone, hE, hfinal⟩ + +def bundleReverseDoublingHorizon + (rankBound edgeBound d : ℕ) : ℕ := + (edgeBound + 1) * 2 ^ (rankBound - d) + +theorem bundleReverseDoublingHorizon_two_mul_succ + {rankBound edgeBound d : ℕ} (hd : d < rankBound) : + 2 * bundleReverseDoublingHorizon rankBound edgeBound (d + 1) = + bundleReverseDoublingHorizon rankBound edgeBound d := by + have hsub : rankBound - d = rankBound - (d + 1) + 1 := by + omega + simp only [bundleReverseDoublingHorizon, hsub, pow_succ] + ring + +theorem bundleReverseDoublingHorizon_le_zero + (rankBound edgeBound d : ℕ) : + bundleReverseDoublingHorizon rankBound edgeBound d ≤ + bundleReverseDoublingHorizon rankBound edgeBound 0 := by + unfold bundleReverseDoublingHorizon + apply Nat.mul_le_mul_left + exact (pow_right_monotone (by norm_num : (1 : ℕ) ≤ 2)) + (Nat.sub_le rankBound d) + +theorem bundleRankwiseStepIncrement_le_of_lower_le + {α β μ : ℕ → ℝ} {τ B η : ℝ} + (hα : ∀ d, 0 ≤ α d) (hβ : ∀ d, 0 ≤ β d) + (lower : ℕ → ℝ) (d n : ℕ) + (hlower_nonneg : ∀ m, 0 ≤ lower m) + (hlower₁ : lower (n + 1) ≤ B) + (hlower₂ : lower (2 * (n + 1)) ≤ B) + (hdefect : + Real.sqrt + (β (d + 1) * (1 + B) * (1 + B)) / + (α (d + 1)) ^ (n + 1) ≤ η / 2) + (huniform : + τ / (μ (d + 1)) ^ (n + 1) ≤ η / 2) : + bundleRankwiseStepIncrement α β μ τ lower d n ≤ η := by + have hlower₁nonneg : 0 ≤ 1 + lower (n + 1) := by + linarith [hlower_nonneg (n + 1)] + have hlower₂nonneg : 0 ≤ 1 + lower (2 * (n + 1)) := by + linarith [hlower_nonneg (2 * (n + 1))] + have hB₁nonneg : 0 ≤ 1 + B := by + linarith [hlower_nonneg (n + 1), hlower₁] + have hproduct : + (1 + lower (n + 1)) * (1 + lower (2 * (n + 1))) ≤ + (1 + B) * (1 + B) := by + exact mul_le_mul + (by linarith) + (by linarith) + hlower₂nonneg hB₁nonneg + have hradicand : + β (d + 1) * + (1 + lower (n + 1)) * + (1 + lower (2 * (n + 1))) ≤ + β (d + 1) * (1 + B) * (1 + B) := by + simpa [mul_assoc] using + mul_le_mul_of_nonneg_left hproduct (hβ (d + 1)) + have hsqrt : + Real.sqrt + (β (d + 1) * + (1 + lower (n + 1)) * + (1 + lower (2 * (n + 1)))) ≤ + Real.sqrt (β (d + 1) * (1 + B) * (1 + B)) := + Real.sqrt_le_sqrt hradicand + have hnormalized : + Real.sqrt + (β (d + 1) * + (1 + lower (n + 1)) * + (1 + lower (2 * (n + 1)))) / + (α (d + 1)) ^ (n + 1) ≤ η / 2 := + (div_le_div_of_nonneg_right hsqrt + (pow_nonneg (hα (d + 1)) (n + 1))).trans hdefect + unfold bundleRankwiseStepIncrement + linarith + +theorem bundleRankwiseEnvelopeError_le_finiteBudget + {α β μ : ℕ → ℝ} {τ η B : ℝ} + (hα : ∀ d, 0 ≤ α d) (hβ : ∀ d, 0 ≤ β d) + (hμ : ∀ d, 0 ≤ μ d) (hτ : 0 ≤ τ) (hη : 0 ≤ η) + (rankBound : ℕ) (horizon : ℕ → ℕ) + (hreverse : ∀ d, d < rankBound → + 2 * horizon (d + 1) ≤ horizon d) + (hzero : ∀ d, d ≤ rankBound → horizon d ≤ horizon 0) + (hcap : + (rankBound : ℝ) * (horizon 0 : ℝ) * η ≤ B) + (hdefect : ∀ d, d < rankBound → ∀ n, n < horizon (d + 1) → + Real.sqrt + (β (d + 1) * (1 + B) * (1 + B)) / + (α (d + 1)) ^ (n + 1) ≤ η / 2) + (huniform : ∀ d, d < rankBound → ∀ n, n < horizon (d + 1) → + τ / (μ (d + 1)) ^ (n + 1) ≤ η / 2) : + ∀ d, d ≤ rankBound → ∀ n, n ≤ horizon d → + bundleRankwiseEnvelopeError α β μ τ d n ≤ + (d : ℝ) * (horizon 0 : ℝ) * η := by + intro d hd + induction d with + | zero => + intro n hn + simp + | succ d ih => + have hdlt : d < rankBound := Nat.lt_of_succ_le hd + let lower := bundleRankwiseEnvelopeError α β μ τ d + have hlower_nonneg : ∀ m, 0 ≤ lower m := + bundleRankwiseEnvelopeError_nonneg hα hμ hτ d + have hdle : d ≤ rankBound := Nat.le_of_lt hdlt + have hdbound : + (d : ℝ) * (horizon 0 : ℝ) * η ≤ B := by + have hdcast : (d : ℝ) ≤ rankBound := by exact_mod_cast hdle + have hq0 : 0 ≤ (horizon 0 : ℝ) := by positivity + have hscale : 0 ≤ (horizon 0 : ℝ) * η := mul_nonneg hq0 hη + calc + (d : ℝ) * (horizon 0 : ℝ) * η = + (d : ℝ) * ((horizon 0 : ℝ) * η) := by ring + _ ≤ (rankBound : ℝ) * ((horizon 0 : ℝ) * η) := + mul_le_mul_of_nonneg_right hdcast hscale + _ = (rankBound : ℝ) * (horizon 0 : ℝ) * η := by ring + _ ≤ B := hcap + have hrow : ∀ m, m ≤ horizon (d + 1) → + bundleRankwiseNextRow α β μ τ d lower m ≤ + (d : ℝ) * (horizon 0 : ℝ) * η + (m : ℝ) * η := by + intro m hm + induction m with + | zero => + simp only [bundleRankwiseNextRow_zero, Nat.cast_zero, zero_mul, + add_zero] + exact mul_nonneg (mul_nonneg (by positivity) (by positivity)) hη + | succ m ihm => + have hmle : m ≤ horizon (d + 1) := Nat.le_trans (Nat.le_succ m) hm + have hm_lt : m < horizon (d + 1) := Nat.lt_of_succ_le hm + have hsmall₁ : m + 1 ≤ horizon d := by + have hrev := hreverse d hdlt + omega + have hsmall₂ : 2 * (m + 1) ≤ horizon d := by + have hrev := hreverse d hdlt + omega + have hlower₁raw := ih hdle (m + 1) hsmall₁ + have hlower₂raw := ih hdle (2 * (m + 1)) hsmall₂ + have hlower₁ : lower (m + 1) ≤ B := hlower₁raw.trans hdbound + have hlower₂ : lower (2 * (m + 1)) ≤ B := hlower₂raw.trans hdbound + have hincrement : + bundleRankwiseStepIncrement α β μ τ lower d m ≤ η := + bundleRankwiseStepIncrement_le_of_lower_le hα hβ lower d m + hlower_nonneg hlower₁ hlower₂ + (hdefect d hdlt m hm_lt) (huniform d hdlt m hm_lt) + rw [bundleRankwiseNextRow_succ] + apply max_le + · calc + lower (m + 1) ≤ + (d : ℝ) * (horizon 0 : ℝ) * η := hlower₁raw + _ ≤ (d : ℝ) * (horizon 0 : ℝ) * η + + ((m + 1 : ℕ) : ℝ) * η := + le_add_of_nonneg_right (mul_nonneg (by positivity) hη) + · calc + bundleRankwiseNextRow α β μ τ d lower m + + bundleRankwiseStepIncrement α β μ τ lower d m ≤ + ((d : ℝ) * (horizon 0 : ℝ) * η + (m : ℝ) * η) + η := + add_le_add (ihm hmle) hincrement + _ = (d : ℝ) * (horizon 0 : ℝ) * η + + ((m + 1 : ℕ) : ℝ) * η := by + push_cast + ring + intro n hn + rw [bundleRankwiseEnvelopeError_succ_order] + have hmain := hrow n hn + have hnzero : n ≤ horizon 0 := hn.trans (hzero (d + 1) hd) + have hncast : (n : ℝ) ≤ horizon 0 := by exact_mod_cast hnzero + have hηscale : (n : ℝ) * η ≤ (horizon 0 : ℝ) * η := + mul_le_mul_of_nonneg_right hncast hη + calc + bundleRankwiseNextRow α β μ τ d lower n ≤ + (d : ℝ) * (horizon 0 : ℝ) * η + (n : ℝ) * η := hmain + _ ≤ (d : ℝ) * (horizon 0 : ℝ) * η + + (horizon 0 : ℝ) * η := add_le_add_right hηscale _ + _ = ((d + 1 : ℕ) : ℝ) * (horizon 0 : ℝ) * η := by + push_cast + ring + +theorem bundleRankwiseEnvelopeError_le_reverseDoublingBudget + {α β μ : ℕ → ℝ} {τ η B : ℝ} + (hα : ∀ d, 0 ≤ α d) (hβ : ∀ d, 0 ≤ β d) + (hμ : ∀ d, 0 ≤ μ d) (hτ : 0 ≤ τ) (hη : 0 ≤ η) + (rankBound edgeBound : ℕ) + (hcap : + (rankBound : ℝ) * + (bundleReverseDoublingHorizon rankBound edgeBound 0 : ℝ) * η ≤ B) + (hdefect : ∀ d, d < rankBound → ∀ n, + n < bundleReverseDoublingHorizon rankBound edgeBound (d + 1) → + Real.sqrt + (β (d + 1) * (1 + B) * (1 + B)) / + (α (d + 1)) ^ (n + 1) ≤ η / 2) + (huniform : ∀ d, d < rankBound → ∀ n, + n < bundleReverseDoublingHorizon rankBound edgeBound (d + 1) → + τ / (μ (d + 1)) ^ (n + 1) ≤ η / 2) : + bundleRankwiseEnvelopeError α β μ τ rankBound (edgeBound + 1) ≤ + (rankBound : ℝ) * + (bundleReverseDoublingHorizon rankBound edgeBound 0 : ℝ) * η := by + apply bundleRankwiseEnvelopeError_le_finiteBudget hα hβ hμ hτ hη + rankBound (bundleReverseDoublingHorizon rankBound edgeBound) + (fun d hd => (bundleReverseDoublingHorizon_two_mul_succ hd).le) + (fun d _hd => bundleReverseDoublingHorizon_le_zero rankBound edgeBound d) + hcap hdefect huniform rankBound le_rfl (edgeBound + 1) + simp [bundleReverseDoublingHorizon] + +theorem bundleRankwiseEnvelope_and_error_lt_half_of_reverseDoublingBudget + {α β : ℕ → ℝ} {τ η : ℝ} + (hα : ∀ d, 0 < α d) (hα_one : ∀ d, α d ≤ 1) + (hβ : ∀ d, 0 ≤ β d) (hτ : 0 ≤ τ) (hη : 0 ≤ η) + (rankBound edgeBound : ℕ) + (hcap : + (rankBound : ℝ) * + (bundleReverseDoublingHorizon rankBound edgeBound 0 : ℝ) * η ≤ 1) + (hfinal : + (rankBound : ℝ) * + (bundleReverseDoublingHorizon rankBound edgeBound 0 : ℝ) * η < 1 / 2) + (hdefect : ∀ d, d < rankBound → ∀ n, + n < bundleReverseDoublingHorizon rankBound edgeBound (d + 1) → + Real.sqrt + (β (d + 1) * (1 + (1 : ℝ)) * (1 + (1 : ℝ))) / + (α (d + 1)) ^ (n + 1) ≤ η / 2) + (huniform : ∀ d, d < rankBound → ∀ n, + n < bundleReverseDoublingHorizon rankBound edgeBound (d + 1) → + τ / + (bundleRankwiseDensityFloor α (d + 1)) ^ (n + 1) ≤ + η / 2) : + IsBundleCountingEnvelope α β + (bundleRankwiseDensityFloor α) τ + (bundleRankwiseEnvelopeError α β + (bundleRankwiseDensityFloor α) τ) ∧ + bundleRankwiseEnvelopeError α β + (bundleRankwiseDensityFloor α) τ rankBound edgeBound < 1 / 2 := by + have hμ : ∀ d, 0 ≤ bundleRankwiseDensityFloor α d := + fun d => (bundleRankwiseDensityFloor_pos hα d).le + have hbound := + bundleRankwiseEnvelopeError_le_reverseDoublingBudget + (fun d => (hα d).le) hβ hμ hτ hη rankBound edgeBound + hcap hdefect huniform + have hcard : + bundleRankwiseEnvelopeError α β + (bundleRankwiseDensityFloor α) τ rankBound edgeBound ≤ + bundleRankwiseEnvelopeError α β + (bundleRankwiseDensityFloor α) τ rankBound (edgeBound + 1) := + (bundleRankwiseEnvelopeError_monotone_card + (fun d => (hα d).le) hμ hτ rankBound) (Nat.le_succ edgeBound) + exact ⟨bundleRankwiseEnvelopeError_isEnvelope hα hα_one hβ hτ, + (hcard.trans hbound).trans_lt hfinal⟩ + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/ShortInterval.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/ShortInterval.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea4ad068690f3525de4ef31ad76f23140052f095 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/ShortInterval.lean @@ -0,0 +1,124 @@ +import Mathlib.Data.Int.ModEq +import OAI.Combinatorics.Progressions.FixedDensity.Energy + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +def cyclicAPVal {N : ℕ} [NeZero N] (a d : ZMod N) (j : ℕ) : ℕ := + (a + (j : ZMod N) * d).val + +@[simp] +theorem cyclicAPVal_cast {N : ℕ} [NeZero N] + (a d : ZMod N) (j : ℕ) : + (cyclicAPVal a d j : ZMod N) = a + (j : ZMod N) * d := + ZMod.natCast_zmod_val _ + +theorem abs_secondDifference_le {L U z₀ z₁ z₂ : ℤ} + (hz₀ : L ≤ z₀ ∧ z₀ ≤ U) + (hz₁ : L ≤ z₁ ∧ z₁ ≤ U) + (hz₂ : L ≤ z₂ ∧ z₂ ≤ U) : + |z₂ - 2 * z₁ + z₀| ≤ 2 * (U - L) := by + rw [abs_le] + constructor <;> linarith + +theorem cyclicAPVal_secondDifference_eq_zero {k N : ℕ} [NeZero N] + (a d : ZMod N) (L U : ℤ) + (hmem : + ∀ i : ℕ, i < k → + L ≤ cyclicAPVal a d i ∧ cyclicAPVal a d i ≤ U) + (hwidth : 2 * (U - L) < (N : ℤ)) + (j : ℕ) (hj : j + 2 < k) : + (cyclicAPVal a d (j + 2) : ℤ) - + 2 * cyclicAPVal a d (j + 1) + + cyclicAPVal a d j = 0 := by + let z : ℤ := + (cyclicAPVal a d (j + 2) : ℤ) - + 2 * cyclicAPVal a d (j + 1) + + cyclicAPVal a d j + apply Int.eq_zero_of_abs_lt_dvd (m := (N : ℤ)) (x := z) + · rw [← ZMod.intCast_zmod_eq_zero_iff_dvd] + dsimp [z] + push_cast + simp only [cyclicAPVal_cast, Nat.cast_add, Nat.cast_ofNat] + ring + · exact lt_of_le_of_lt + (abs_secondDifference_le + (hmem j (by omega)) + (hmem (j + 1) (by omega)) + (hmem (j + 2) hj)) + hwidth + +theorem eq_affine_of_secondDifference_zero + (z : ℕ → ℤ) (k : ℕ) + (hsecond : + ∀ j : ℕ, j + 2 < k → + z (j + 2) - 2 * z (j + 1) + z j = 0) : + ∀ j : ℕ, j < k → + z j = z 0 + (j : ℤ) * (z 1 - z 0) := by + intro j + induction j using Nat.twoStepInduction with + | zero => + intro + ring + | one => + intro + ring + | more j ihj ihj₁ => + intro hj + have hj₀ : j < k := by omega + have hj₁ : j + 1 < k := by omega + have hs := hsecond j hj + rw [ihj hj₀, ihj₁ hj₁] at hs + push_cast at hs ⊢ + linarith + +theorem cyclicAPVal_eq_affine {k N : ℕ} [NeZero N] + (a d : ZMod N) (L U : ℤ) + (hmem : + ∀ j : ℕ, j < k → + L ≤ cyclicAPVal a d j ∧ cyclicAPVal a d j ≤ U) + (hwidth : 2 * (U - L) < (N : ℤ)) : + ∀ j : ℕ, j < k → + (cyclicAPVal a d j : ℤ) = + cyclicAPVal a d 0 + + (j : ℤ) * + ((cyclicAPVal a d 1 : ℤ) - cyclicAPVal a d 0) := by + apply eq_affine_of_secondDifference_zero + intro j hj + exact cyclicAPVal_secondDifference_eq_zero a d L U hmem hwidth j hj + +theorem cyclicAPVal_one_sub_zero_ne_zero {N : ℕ} [NeZero N] + (a d : ZMod N) (hd : d ≠ 0) : + (cyclicAPVal a d 1 : ℤ) - cyclicAPVal a d 0 ≠ 0 := by + intro hzero + have hval : cyclicAPVal a d 1 = cyclicAPVal a d 0 := by + exact_mod_cast sub_eq_zero.mp hzero + have had : a + d = a := by + apply ZMod.val_injective N + simpa [cyclicAPVal] using hval + apply hd + apply add_left_cancel (a := a) + simpa using had + +theorem cyclicAPVal_isIntegerAP {k N : ℕ} [NeZero N] + (a d : ZMod N) (hd : d ≠ 0) (L U : ℤ) + (hmem : + ∀ j : ℕ, j < k → + L ≤ cyclicAPVal a d j ∧ cyclicAPVal a d j ≤ U) + (hwidth : 2 * (U - L) < (N : ℤ)) : + ∃ s : ℤ, s ≠ 0 ∧ + ∀ j : ℕ, j < k → + (cyclicAPVal a d j : ℤ) = + cyclicAPVal a d 0 + (j : ℤ) * s := by + refine ⟨(cyclicAPVal a d 1 : ℤ) - cyclicAPVal a d 0, + cyclicAPVal_one_sub_zero_ne_zero a d hd, ?_⟩ + exact cyclicAPVal_eq_affine a d L U hmem hwidth + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/SimplexTelescoping.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/SimplexTelescoping.lean new file mode 100644 index 0000000000000000000000000000000000000000..6152c58f9965a8a4914468791f84acd12826197e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/SimplexTelescoping.lean @@ -0,0 +1,599 @@ +import Mathlib.Algebra.BigOperators.Ring.Finset +import OAI.Combinatorics.Progressions.Results.LinearFormsBasic + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +abbrev DeletedVector {k : ℕ} (V : Fin k → Type*) (j : Fin k) := + (i : {i : Fin k // i ≠ j}) → V i.1 + +def deleteCoordinate {k : ℕ} {V : Fin k → Type*} + (x : (i : Fin k) → V i) (j : Fin k) : + DeletedVector V j := + fun i => x i.1 + +structure WeightedSimplexSystem {k : ℕ} (V : Fin k → Type*) where + edgeWeight : (j : Fin k) → DeletedVector V j → ℝ + +namespace WeightedSimplexSystem + +def simplexWeight {k : ℕ} {V : Fin k → Type*} + (H : WeightedSimplexSystem V) (x : (i : Fin k) → V i) : ℝ := + ∏ j : Fin k, H.edgeWeight j (deleteCoordinate x j) + +noncomputable def simplexCount {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] (H : WeightedSimplexSystem V) : ℝ := + mean H.simplexWeight + +theorem simplexWeight_nonneg {k : ℕ} {V : Fin k → Type*} + (H : WeightedSimplexSystem V) + (hH : ∀ j x, 0 ≤ H.edgeWeight j x) + (x : (i : Fin k) → V i) : + 0 ≤ H.simplexWeight x := by + exact Finset.prod_nonneg fun j _ => hH j (deleteCoordinate x j) + +theorem simplexCount_nonneg {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H : WeightedSimplexSystem V) + (hH : ∀ j x, 0 ≤ H.edgeWeight j x) : + 0 ≤ H.simplexCount := + mean_nonneg (H.simplexWeight_nonneg hH) + +theorem simplexWeight_mono {k : ℕ} {V : Fin k → Type*} + (H G : WeightedSimplexSystem V) + (hH : ∀ j x, 0 ≤ H.edgeWeight j x) + (hHG : ∀ j x, H.edgeWeight j x ≤ G.edgeWeight j x) + (x : (i : Fin k) → V i) : + H.simplexWeight x ≤ G.simplexWeight x := by + exact Finset.prod_le_prod₀ + (fun j _ => hH j (deleteCoordinate x j)) + (fun j _ => hHG j (deleteCoordinate x j)) + +theorem simplexCount_mono {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H G : WeightedSimplexSystem V) + (hH : ∀ j x, 0 ≤ H.edgeWeight j x) + (hHG : ∀ j x, H.edgeWeight j x ≤ G.edgeWeight j x) : + H.simplexCount ≤ G.simplexCount := + mean_mono (H.simplexWeight_mono G hH hHG) + +end WeightedSimplexSystem + +def apSimplexForm (k N : ℕ) (j : Fin k) + (x : DeletedVector (fun _ : Fin k => ZMod N) j) : ZMod N := + ∑ i : {i : Fin k // i ≠ j}, + (((i.1 : ℤ) - (j : ℤ) : ℤ) : ZMod N) * x i + +def simplexCoordinateSum (k N : ℕ) + (x : Fin k → ZMod N) : ZMod N := + ∑ i : Fin k, x i + +def simplexCoordinateMoment (k N : ℕ) + (x : Fin k → ZMod N) : ZMod N := + ∑ i : Fin k, (i : ZMod N) * x i + +theorem apSimplexForm_deleteCoordinate (k N : ℕ) (j : Fin k) + (x : Fin k → ZMod N) : + apSimplexForm k N j (deleteCoordinate x j) = + simplexCoordinateMoment k N x - + (j : ZMod N) * simplexCoordinateSum k N x := by + classical + let f : Fin k → ZMod N := + fun i => (((i : ℤ) - (j : ℤ) : ℤ) : ZMod N) * x i + have hsplit := + Fintype.sum_subtype_add_sum_subtype (fun i : Fin k => i ≠ j) f + have hcomplement : + (∑ i : {i : Fin k // ¬i ≠ j}, f i.1) = 0 := by + apply Finset.sum_eq_zero + intro i + simp only [Finset.mem_univ, forall_const] + have hij : i.1 = j := not_ne_iff.mp i.2 + rw [hij] + simp [f] + have hsum : (∑ i : {i : Fin k // i ≠ j}, f i.1) = ∑ i : Fin k, f i := by + rw [hcomplement, add_zero] at hsplit + exact hsplit + rw [apSimplexForm] + change (∑ i : {i : Fin k // i ≠ j}, f i.1) = + simplexCoordinateMoment k N x - + (j : ZMod N) * simplexCoordinateSum k N x + rw [hsum] + simp only [simplexCoordinateMoment, simplexCoordinateSum, f] + push_cast + simp_rw [sub_mul] + rw [Finset.sum_sub_distrib, Finset.mul_sum] + +def apSimplexSystem (k N : ℕ) (f : ZMod N → ℝ) : + WeightedSimplexSystem (fun _ : Fin k => ZMod N) where + edgeWeight j x := f (apSimplexForm k N j x) + +theorem apSimplexSystem_simplexWeight + (k N : ℕ) (f : ZMod N → ℝ) + (x : Fin k → ZMod N) : + (apSimplexSystem k N f).simplexWeight x = + cyclicAPProduct k N f + (simplexCoordinateMoment k N x) + (-simplexCoordinateSum k N x) := by + apply Finset.prod_congr rfl + intro j _ + change + f (apSimplexForm k N j (deleteCoordinate x j)) = + f (cyclicAPTerm + (simplexCoordinateMoment k N x) + (-simplexCoordinateSum k N x) j) + congr 1 + rw [apSimplexForm_deleteCoordinate] + simp [cyclicAPTerm] + ring + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def simplexTailSum (r N : ℕ) (y : Fin r → ZMod N) : ZMod N := + ∑ i : Fin r, y i + +def simplexTailMoment (r N : ℕ) (y : Fin r → ZMod N) : ZMod N := + ∑ i : Fin r, (i.succ.succ : ZMod N) * y i + +def simplexCoordinatesOfAP (r N : ℕ) (a d : ZMod N) + (y : Fin r → ZMod N) : Fin (r + 2) → ZMod N := + Fin.cases + (simplexTailMoment r N y - a - d - simplexTailSum r N y) + (Fin.cases (a - simplexTailMoment r N y) y) + +@[simp] +theorem simplexCoordinatesOfAP_zero (r N : ℕ) (a d : ZMod N) + (y : Fin r → ZMod N) : + simplexCoordinatesOfAP r N a d y 0 = + simplexTailMoment r N y - a - d - simplexTailSum r N y := + rfl + +@[simp] +theorem simplexCoordinatesOfAP_one (r N : ℕ) (a d : ZMod N) + (y : Fin r → ZMod N) : + simplexCoordinatesOfAP r N a d y 1 = + a - simplexTailMoment r N y := + rfl + +@[simp] +theorem simplexCoordinatesOfAP_succ_succ (r N : ℕ) + (a d : ZMod N) (y : Fin r → ZMod N) (i : Fin r) : + simplexCoordinatesOfAP r N a d y i.succ.succ = y i := + rfl + +theorem simplexCoordinateSum_decompose (r N : ℕ) + (x : Fin (r + 2) → ZMod N) : + simplexCoordinateSum (r + 2) N x = + x 0 + x 1 + + simplexTailSum r N (fun i => x i.succ.succ) := by + simp [simplexCoordinateSum, simplexTailSum, Fin.sum_univ_succ, + add_assoc] + +theorem simplexCoordinateMoment_decompose (r N : ℕ) + (x : Fin (r + 2) → ZMod N) : + simplexCoordinateMoment (r + 2) N x = + x 1 + simplexTailMoment r N (fun i => x i.succ.succ) := by + simp [simplexCoordinateMoment, simplexTailMoment, + Fin.sum_univ_succ] + +@[simp] +theorem simplexCoordinateSum_coordinatesOfAP (r N : ℕ) + (a d : ZMod N) (y : Fin r → ZMod N) : + simplexCoordinateSum (r + 2) N + (simplexCoordinatesOfAP r N a d y) = -d := by + rw [simplexCoordinateSum_decompose] + simp + ring + +@[simp] +theorem simplexCoordinateMoment_coordinatesOfAP (r N : ℕ) + (a d : ZMod N) (y : Fin r → ZMod N) : + simplexCoordinateMoment (r + 2) N + (simplexCoordinatesOfAP r N a d y) = a := by + rw [simplexCoordinateMoment_decompose] + simp + +def simplexAPEquiv (r N : ℕ) : + (Fin (r + 2) → ZMod N) ≃ + (ZMod N × ZMod N) × (Fin r → ZMod N) where + toFun x := + ((simplexCoordinateMoment (r + 2) N x, + -simplexCoordinateSum (r + 2) N x), + fun i => x i.succ.succ) + invFun y := simplexCoordinatesOfAP r N y.1.1 y.1.2 y.2 + left_inv x := by + funext i + refine Fin.cases ?_ (fun i => Fin.cases ?_ (fun _ => rfl) i) i + · change + simplexCoordinatesOfAP r N + (simplexCoordinateMoment (r + 2) N x) + (-simplexCoordinateSum (r + 2) N x) + (fun i => x i.succ.succ) 0 = + x 0 + rw [simplexCoordinatesOfAP_zero, + simplexCoordinateMoment_decompose, + simplexCoordinateSum_decompose] + ring + · change + simplexCoordinatesOfAP r N + (simplexCoordinateMoment (r + 2) N x) + (-simplexCoordinateSum (r + 2) N x) + (fun i => x i.succ.succ) 1 = + x 1 + rw [simplexCoordinatesOfAP_one, + simplexCoordinateMoment_decompose] + ring + right_inv y := by + rcases y with ⟨⟨a, d⟩, tail⟩ + apply Prod.ext + · apply Prod.ext + · change + simplexCoordinateMoment (r + 2) N + (simplexCoordinatesOfAP r N a d tail) = + a + exact simplexCoordinateMoment_coordinatesOfAP r N a d tail + · change + -simplexCoordinateSum (r + 2) N + (simplexCoordinatesOfAP r N a d tail) = + d + rw [simplexCoordinateSum_coordinatesOfAP] + simp + · funext i + change simplexCoordinatesOfAP r N a d tail i.succ.succ = tail i + exact simplexCoordinatesOfAP_succ_succ r N a d tail i + +theorem mean_equiv {α β : Type*} [Fintype α] [Fintype β] + (e : α ≃ β) (f : α → ℝ) (g : β → ℝ) + (h : ∀ x, f x = g (e x)) : + mean f = mean g := by + exact Fintype.expect_equiv e f g h + +theorem mean_prod {α β : Type*} [Fintype α] [Fintype β] + (f : α → β → ℝ) : + mean (fun p : α × β => f p.1 p.2) = mean₂ f := by + simpa [mean, mean₂] using + (Finset.expect_product' + (Finset.univ : Finset α) (Finset.univ : Finset β) f) + +theorem mean_prod_fst {α β : Type*} [Fintype α] [Fintype β] + [Nonempty β] (f : α → ℝ) : + mean (fun p : α × β => f p.1) = mean f := by + calc + mean (fun p : α × β => f p.1) = + mean₂ (fun a (_ : β) => f a) := by + exact mean_prod (fun a (_ : β) => f a) + _ = mean f := by + simp [mean₂] + +theorem apSimplexSystem_simplexCount_eq_cyclicAPCount + (r N : ℕ) [NeZero N] (f : ZMod N → ℝ) : + (apSimplexSystem (r + 2) N f).simplexCount = + cyclicAPCount (r + 2) N f := by + rw [WeightedSimplexSystem.simplexCount, cyclicAPCount] + calc + mean (apSimplexSystem (r + 2) N f).simplexWeight = + mean (fun x : Fin (r + 2) → ZMod N => + cyclicAPProduct (r + 2) N f + (simplexCoordinateMoment (r + 2) N x) + (-simplexCoordinateSum (r + 2) N x)) := by + apply congrArg mean + funext x + exact apSimplexSystem_simplexWeight (r + 2) N f x + _ = + mean (fun y : + (ZMod N × ZMod N) × (Fin r → ZMod N) => + cyclicAPProduct (r + 2) N f y.1.1 y.1.2) := by + apply mean_equiv (simplexAPEquiv r N) + intro x + rfl + _ = + mean (fun p : ZMod N × ZMod N => + cyclicAPProduct (r + 2) N f p.1 p.2) := by + exact mean_prod_fst + (fun p : ZMod N × ZMod N => + cyclicAPProduct (r + 2) N f p.1 p.2) + _ = + mean₂ (fun a d => + cyclicAPProduct (r + 2) N f a d) := by + exact mean_prod + (fun a d => cyclicAPProduct (r + 2) N f a d) + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +structure SimplexHypergraph {k : ℕ} (V : Fin k → Type*) where + edge : (j : Fin k) → DeletedVector V j → Prop + +namespace SimplexHypergraph + +noncomputable def edgeFinset {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (j : Fin k) : + Finset (DeletedVector V j) := by + classical + exact Finset.univ.filter (H.edge j) + +@[simp] +theorem mem_edgeFinset {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (j : Fin k) + (x : DeletedVector V j) : + x ∈ H.edgeFinset j ↔ H.edge j x := by + classical + simp [edgeFinset] + +noncomputable def simplexFinset {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : + Finset ((i : Fin k) → V i) := by + classical + exact Finset.univ.filter fun x => ∀ j, H.edge j (deleteCoordinate x j) + +@[simp] +theorem mem_simplexFinset {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) (x : (i : Fin k) → V i) : + x ∈ H.simplexFinset ↔ + ∀ j, H.edge j (deleteCoordinate x j) := by + classical + simp [simplexFinset] + +noncomputable def toWeighted {k : ℕ} {V : Fin k → Type*} + (H : SimplexHypergraph V) : WeightedSimplexSystem V := by + classical + exact + { edgeWeight := fun j x => if H.edge j x then 1 else 0 } + +@[simp] +theorem toWeighted_edgeWeight_of_edge {k : ℕ} + {V : Fin k → Type*} (H : SimplexHypergraph V) + {j : Fin k} {x : DeletedVector V j} + (hx : H.edge j x) : + H.toWeighted.edgeWeight j x = 1 := by + classical + simp [toWeighted, hx] + +@[simp] +theorem toWeighted_edgeWeight_of_not_edge {k : ℕ} + {V : Fin k → Type*} (H : SimplexHypergraph V) + {j : Fin k} {x : DeletedVector V j} + (hx : ¬H.edge j x) : + H.toWeighted.edgeWeight j x = 0 := by + classical + simp [toWeighted, hx] + +theorem toWeighted_edgeWeight_nonneg {k : ℕ} + {V : Fin k → Type*} (H : SimplexHypergraph V) + (j : Fin k) (x : DeletedVector V j) : + 0 ≤ H.toWeighted.edgeWeight j x := by + classical + simp only [toWeighted] + split <;> norm_num + +theorem toWeighted_edgeWeight_le_one {k : ℕ} + {V : Fin k → Type*} (H : SimplexHypergraph V) + (j : Fin k) (x : DeletedVector V j) : + H.toWeighted.edgeWeight j x ≤ 1 := by + classical + simp only [toWeighted] + split <;> norm_num + +theorem toWeighted_simplexWeight_eq_indicator {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + [∀ i, DecidableEq (V i)] + (H : SimplexHypergraph V) (x : (i : Fin k) → V i) : + H.toWeighted.simplexWeight x = + finsetIndicator H.simplexFinset x := by + classical + by_cases hx : x ∈ H.simplexFinset + · have hedges : + ∀ j, H.edge j (deleteCoordinate x j) := + (H.mem_simplexFinset x).mp hx + simp [WeightedSimplexSystem.simplexWeight, toWeighted, + finsetIndicator, hx, hedges] + · have hnot : + ¬∀ j, H.edge j (deleteCoordinate x j) := by + simpa using hx + push Not at hnot + obtain ⟨j, hj⟩ := hnot + have hzero : + ∏ i : Fin k, + H.toWeighted.edgeWeight i (deleteCoordinate x i) = 0 := by + apply Finset.prod_eq_zero (Finset.mem_univ j) + exact toWeighted_edgeWeight_of_not_edge H hj + rw [WeightedSimplexSystem.simplexWeight, hzero] + exact (finsetIndicator_of_not_mem hx).symm + +theorem toWeighted_simplexCount_eq_card_div {k : ℕ} + {V : Fin k → Type*} [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) : + H.toWeighted.simplexCount = + (H.simplexFinset.card : ℝ) / + Fintype.card ((i : Fin k) → V i) := by + classical + rw [WeightedSimplexSystem.simplexCount] + have hfun : + H.toWeighted.simplexWeight = + finsetIndicator H.simplexFinset := by + funext x + exact toWeighted_simplexWeight_eq_indicator H x + rw [hfun, mean_finsetIndicator] + +def IsSimplexCover {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) + (deleted : (j : Fin k) → Finset (DeletedVector V j)) : Prop := + ∀ x ∈ H.simplexFinset, + ∃ j, deleteCoordinate x j ∈ deleted j + +theorem isSimplexCover_iff {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H : SimplexHypergraph V) + (deleted : (j : Fin k) → Finset (DeletedVector V j)) : + H.IsSimplexCover deleted ↔ + ∀ x, (∀ j, deleteCoordinate x j ∉ deleted j) → + ∃ j, ¬H.edge j (deleteCoordinate x j) := by + classical + constructor + · intro hcover x hsurvives + by_contra h + push Not at h + have hx : x ∈ H.simplexFinset := by + simpa using h + obtain ⟨j, hj⟩ := hcover x hx + exact hsurvives j hj + · intro hnosimplex x hx + by_contra h + push Not at h + obtain ⟨j, hj⟩ := hnosimplex x h + exact hj ((H.mem_simplexFinset x).mp hx j) + +end SimplexHypergraph + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +theorem prod_sub_prod_eq_sum_ordered + {ι : Type*} [LinearOrder ι] + (s : Finset ι) (f g : ι → ℝ) : + (∏ i ∈ s, f i) - ∏ i ∈ s, g i = + ∑ i ∈ s, + (f i - g i) * + (∏ j ∈ s with j < i, f j) * + ∏ j ∈ s with i < j, g j := by + have h := + Finset.prod_add_ordered s g (fun i => f i - g i) + have hleft : + (∏ i ∈ s, (g i + (f i - g i))) = + ∏ i ∈ s, f i := by + apply Finset.prod_congr rfl + intro i _ + ring + have hlower (i : ι) : + (∏ j ∈ s with j < i, + (g j + (f j - g j))) = + ∏ j ∈ s with j < i, f j := by + apply Finset.prod_congr rfl + intro j _ + ring + rw [hleft] at h + simp_rw [hlower] at h + linarith + +def mixedSimplexTerm {k : ℕ} {V : Fin k → Type*} + (H G : WeightedSimplexSystem V) (j : Fin k) + (x : (i : Fin k) → V i) : ℝ := + (H.edgeWeight j (deleteCoordinate x j) - + G.edgeWeight j (deleteCoordinate x j)) * + (∏ i ∈ (Finset.univ : Finset (Fin k)) with i < j, + H.edgeWeight i (deleteCoordinate x i)) * + ∏ i ∈ (Finset.univ : Finset (Fin k)) with j < i, + G.edgeWeight i (deleteCoordinate x i) + +theorem simplexWeight_sub_eq_sum_mixed + {k : ℕ} {V : Fin k → Type*} + (H G : WeightedSimplexSystem V) + (x : (i : Fin k) → V i) : + H.simplexWeight x - G.simplexWeight x = + ∑ j : Fin k, mixedSimplexTerm H G j x := by + change + (∏ j : Fin k, + H.edgeWeight j (deleteCoordinate x j)) - + ∏ j : Fin k, + G.edgeWeight j (deleteCoordinate x j) = + ∑ j : Fin k, mixedSimplexTerm H G j x + simpa [mixedSimplexTerm] using + prod_sub_prod_eq_sum_ordered Finset.univ + (fun j : Fin k => + H.edgeWeight j (deleteCoordinate x j)) + (fun j : Fin k => + G.edgeWeight j (deleteCoordinate x j)) + +noncomputable def mixedSimplexCorrelation + {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H G : WeightedSimplexSystem V) (j : Fin k) : ℝ := + mean (mixedSimplexTerm H G j) + +theorem simplexCount_sub_eq_sum_mixedCorrelation + {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H G : WeightedSimplexSystem V) : + H.simplexCount - G.simplexCount = + ∑ j : Fin k, mixedSimplexCorrelation H G j := by + rw [WeightedSimplexSystem.simplexCount, + WeightedSimplexSystem.simplexCount, ← mean_sub] + calc + mean (fun x => H.simplexWeight x - G.simplexWeight x) = + mean (fun x => + ∑ j : Fin k, mixedSimplexTerm H G j x) := by + apply congrArg mean + funext x + exact simplexWeight_sub_eq_sum_mixed H G x + _ = ∑ j : Fin k, mean (mixedSimplexTerm H G j) := + mean_finset_sum Finset.univ + (fun j => mixedSimplexTerm H G j) + _ = ∑ j : Fin k, mixedSimplexCorrelation H G j := by + rfl + +theorem abs_simplexCount_sub_le_sum_mixedCorrelation + {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H G : WeightedSimplexSystem V) : + |H.simplexCount - G.simplexCount| ≤ + ∑ j : Fin k, |mixedSimplexCorrelation H G j| := by + rw [simplexCount_sub_eq_sum_mixedCorrelation] + exact Finset.abs_sum_le_sum_abs _ _ + +def MixedSimplexCorrelationLe + {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H G : WeightedSimplexSystem V) (ε : ℝ) : Prop := + ∀ j, |mixedSimplexCorrelation H G j| ≤ ε + +theorem simplexCount_abs_sub_le_of_mixedCorrelation + {k : ℕ} {V : Fin k → Type*} + [∀ i, Fintype (V i)] + (H G : WeightedSimplexSystem V) {ε : ℝ} + (h : MixedSimplexCorrelationLe H G ε) : + |H.simplexCount - G.simplexCount| ≤ (k : ℝ) * ε := by + calc + |H.simplexCount - G.simplexCount| ≤ + ∑ j : Fin k, |mixedSimplexCorrelation H G j| := + abs_simplexCount_sub_le_sum_mixedCorrelation H G + _ ≤ ∑ _j : Fin k, ε := + Finset.sum_le_sum fun j _ => h j + _ = (k : ℝ) * ε := by + simp + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullBundleRemovalParameters.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullBundleRemovalParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2f0c362b2afbad41772b30c464b8ad46a375e4c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullBundleRemovalParameters.lean @@ -0,0 +1,567 @@ +import OAI.Combinatorics.Progressions.FixedDensity.RankwiseBundleEnvelopeSelection +import OAI.Combinatorics.Progressions.FixedDensity.SourceFullCoarseTargetRegularity + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +noncomputable def sourceBundleDensity (δ : ℝ) (m : ℕ) : ℝ := + δ / (m + 1 : ℕ) + +noncomputable def sourceBundleDefectScale + (δ η : ℝ) (N m : ℕ) : ℝ := + η * sourceBundleDensity δ m ^ N + +theorem sourceBundleDensity_pos + {δ : ℝ} (hδ : 0 < δ) (m : ℕ) : + 0 < sourceBundleDensity δ m := by + unfold sourceBundleDensity + positivity + +theorem sourceBundleDensity_nonneg + {δ : ℝ} (hδ : 0 ≤ δ) (m : ℕ) : + 0 ≤ sourceBundleDensity δ m := by + unfold sourceBundleDensity + positivity + +theorem sourceBundleDensity_le_one + {δ : ℝ} (hδ : δ ≤ 1) (hδ0 : 0 ≤ δ) (m : ℕ) : + sourceBundleDensity δ m ≤ 1 := by + unfold sourceBundleDensity + have hden : (1 : ℝ) ≤ (m + 1 : ℕ) := by + exact_mod_cast Nat.succ_le_succ (Nat.zero_le m) + exact (div_le_self hδ0 hden).trans hδ + +theorem sourceBundleDensity_antitone + {δ : ℝ} (hδ : 0 ≤ δ) : + Antitone (sourceBundleDensity δ) := by + intro a b hab + unfold sourceBundleDensity + apply div_le_div_of_nonneg_left hδ + · positivity + · exact_mod_cast Nat.add_le_add_right hab 1 + +theorem mul_sourceBundleDensity_le + {δ : ℝ} (hδ : 0 ≤ δ) (m : ℕ) : + (m : ℝ) * sourceBundleDensity δ m ≤ δ := by + unfold sourceBundleDensity + have hden : (0 : ℝ) < (m + 1 : ℕ) := by positivity + calc + (m : ℝ) * (δ / (m + 1 : ℕ)) = + δ * ((m : ℝ) / (m + 1 : ℕ)) := by ring + _ ≤ δ * 1 := by + apply mul_le_mul_of_nonneg_left _ hδ + exact (div_le_one hden).2 (by norm_num) + _ = δ := mul_one δ + +theorem sourceBundleDefectScale_pos + {δ η : ℝ} (hδ : 0 < δ) (hη : 0 < η) + (N m : ℕ) : + 0 < sourceBundleDefectScale δ η N m := by + unfold sourceBundleDefectScale + exact mul_pos hη (pow_pos (sourceBundleDensity_pos hδ m) N) + +theorem sourceBundleDefectScale_nonneg + {δ η : ℝ} (hδ : 0 ≤ δ) (hη : 0 ≤ η) + (N m : ℕ) : + 0 ≤ sourceBundleDefectScale δ η N m := by + unfold sourceBundleDefectScale + exact mul_nonneg hη + (pow_nonneg (sourceBundleDensity_nonneg hδ m) N) + +def sourceBundleSelectedScale + {r : ℕ} (scale : Fin (r + 1) → ℕ) (d : ℕ) : ℕ := + scale ⟨min d r, Nat.lt_succ_iff.mpr (Nat.min_le_right d r)⟩ + +@[simp] +theorem sourceBundleSelectedScale_zero + {r : ℕ} (scale : Fin (r + 1) → ℕ) : + sourceBundleSelectedScale scale 0 = scale 0 := by + simp [sourceBundleSelectedScale] + +theorem sourceBundleSelectedScale_of_le + {r d : ℕ} (scale : Fin (r + 1) → ℕ) (hd : d ≤ r) : + sourceBundleSelectedScale scale d = + scale ⟨d, Nat.lt_succ_iff.mpr hd⟩ := by + simp [sourceBundleSelectedScale, Nat.min_eq_left hd] + +noncomputable def sourceBundleRankwiseDensity + {r : ℕ} (δ : ℝ) (scale : Fin (r + 1) → ℕ) (d : ℕ) : ℝ := + sourceBundleDensity δ (sourceBundleSelectedScale scale d) + +noncomputable def sourceBundleRankwiseDefect + {r : ℕ} (δ κ : ℝ) (N : ℕ) + (scale : Fin (r + 1) → ℕ) (d : ℕ) : ℝ := + sourceBundleDefectScale δ κ N + (sourceBundleSelectedScale scale d) ^ 2 + +theorem sourceBundleRankwiseDensity_pos + {r : ℕ} {δ : ℝ} (hδ : 0 < δ) + (scale : Fin (r + 1) → ℕ) (d : ℕ) : + 0 < sourceBundleRankwiseDensity δ scale d := + sourceBundleDensity_pos hδ _ + +theorem sourceBundleRankwiseDensity_le_one + {r : ℕ} {δ : ℝ} (hδ : 0 ≤ δ) (hδ_one : δ ≤ 1) + (scale : Fin (r + 1) → ℕ) (d : ℕ) : + sourceBundleRankwiseDensity δ scale d ≤ 1 := + sourceBundleDensity_le_one hδ_one hδ _ + +theorem sourceBundleRankwiseDefect_nonneg + {r : ℕ} (δ κ : ℝ) (N : ℕ) + (scale : Fin (r + 1) → ℕ) (d : ℕ) : + 0 ≤ sourceBundleRankwiseDefect δ κ N scale d := + sq_nonneg _ + +theorem sourceBundleRankwiseDensity_zero_le + {r : ℕ} {δ : ℝ} (hδ : 0 ≤ δ) + {scale : Fin (r + 1) → ℕ} (hscale : Antitone scale) + (d : ℕ) : + sourceBundleRankwiseDensity δ scale 0 ≤ + sourceBundleRankwiseDensity δ scale d := by + apply sourceBundleDensity_antitone hδ + exact hscale (Fin.zero_le _) + +theorem le_bundleRankwiseDensityFloor_of_zero_le + {α : ℕ → ℝ} (hα : ∀ d, α 0 ≤ α d) : + ∀ d, α 0 ≤ bundleRankwiseDensityFloor α d := by + intro d + induction d with + | zero => exact le_rfl + | succ d ih => + rw [bundleRankwiseDensityFloor_succ] + exact le_min ih (hα (d + 1)) + +def sourceBundleRemovalGrowth (Q N : ℕ) : NatGrowthFunction where + toFun m := Q * (m + 1) ^ N + (m + 1) + monotone' := by + intro a b hab + apply Nat.add_le_add + · exact Nat.mul_le_mul_left Q + (Nat.pow_le_pow_left (Nat.add_le_add_right hab 1) N) + · exact Nat.add_le_add_right hab 1 + above_diagonal := by + intro m + exact (Nat.le_add_left (m + 1) (Q * (m + 1) ^ N)) + +@[simp] +theorem sourceBundleRemovalGrowth_apply + (Q N m : ℕ) : + sourceBundleRemovalGrowth Q N m = + Q * (m + 1) ^ N + (m + 1) := + rfl + +theorem sourceBundleRemovalGrowth_polynomial_le + (Q N m : ℕ) : + Q * (m + 1) ^ N ≤ sourceBundleRemovalGrowth Q N m := by + rw [sourceBundleRemovalGrowth_apply] + exact Nat.le_add_right _ _ + +structure SourceBundleRemovalGrowthConditions + (δ η : ℝ) (N Q : ℕ) : Prop where + uniform : + 1 ≤ (Q : ℝ) * η ^ 2 * δ ^ N + gap : + 1 ≤ δ * (Q : ℝ) ^ 2 * η ^ 2 * δ ^ (2 * N) + +theorem exists_sourceBundleRemovalGrowthCoefficient + {δ η : ℝ} (hδ : 0 < δ) (hδ_one : δ ≤ 1) + (hη : 0 < η) (_hη_one : η ≤ 1) (N : ℕ) : + ∃ Q : ℕ, + SourceBundleRemovalGrowthConditions δ η N Q := by + let x : ℝ := η ^ 2 * δ ^ (2 * N + 1) + have hx : 0 < x := by + dsimp [x] + positivity + obtain ⟨Q, hQ⟩ := exists_nat_gt (1 / x) + have hQpos : 0 < (Q : ℝ) := (div_pos one_pos hx).trans hQ + have hQone : (1 : ℝ) ≤ Q := by + exact_mod_cast (Nat.one_le_iff_ne_zero.mpr + (by exact_mod_cast ne_of_gt hQpos)) + have hQx : 1 < (Q : ℝ) * x := by + calc + 1 = (1 / x) * x := by field_simp + _ < (Q : ℝ) * x := mul_lt_mul_of_pos_right hQ hx + refine ⟨Q, ?_, ?_⟩ + · have hpow : δ ^ (2 * N + 1) ≤ δ ^ N := by + exact pow_le_pow_of_le_one hδ.le hδ_one (by omega) + calc + 1 ≤ (Q : ℝ) * x := hQx.le + _ ≤ (Q : ℝ) * η ^ 2 * δ ^ N := by + dsimp [x] + simpa [mul_assoc] using + (mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_left hpow (sq_nonneg η)) + hQpos.le) + · calc + 1 ≤ (Q : ℝ) * x := hQx.le + _ ≤ (Q : ℝ) * ((Q : ℝ) * x) := by + simpa only [one_mul] using + (mul_le_mul_of_nonneg_right hQone + (mul_nonneg hQpos.le hx.le)) + _ = δ * (Q : ℝ) ^ 2 * η ^ 2 * δ ^ (2 * N) := by + dsimp [x] + ring + +theorem one_div_sourceBundleRemovalGrowth_le + {δ η : ℝ} {N Q : ℕ} + (hδ : 0 < δ) (hη : 0 < η) + (hQ : SourceBundleRemovalGrowthConditions δ η N Q) + (m : ℕ) : + 1 / (sourceBundleRemovalGrowth Q N m : ℝ) ≤ + η ^ 2 * sourceBundleDensity δ m ^ N := by + have hx : (0 : ℝ) < (m + 1 : ℕ) := by positivity + have hF : (0 : ℝ) < sourceBundleRemovalGrowth Q N m := by + exact_mod_cast (sourceBundleRemovalGrowth Q N).positive m + apply (div_le_iff₀ hF).2 + have hpoly : + (Q : ℝ) * ((m + 1 : ℕ) : ℝ) ^ N ≤ + (sourceBundleRemovalGrowth Q N m : ℕ) := by + exact_mod_cast sourceBundleRemovalGrowth_polynomial_le Q N m + calc + 1 ≤ (Q : ℝ) * η ^ 2 * δ ^ N := hQ.uniform + _ = + (η ^ 2 * sourceBundleDensity δ m ^ N) * + ((Q : ℝ) * ((m + 1 : ℕ) : ℝ) ^ N) := by + unfold sourceBundleDensity + rw [div_pow] + field_simp + _ ≤ + (η ^ 2 * sourceBundleDensity δ m ^ N) * + (sourceBundleRemovalGrowth Q N m : ℕ) := by + apply mul_le_mul_of_nonneg_left hpoly + exact mul_nonneg (sq_nonneg η) + (pow_nonneg (sourceBundleDensity_nonneg hδ.le m) N) + +theorem sourceFullRankGap_div_sourceBundleDefectScale_sq_le + {δ η : ℝ} {N Q : ℕ} + (hδ : 0 < δ) (hη : 0 < η) + (hQ : SourceBundleRemovalGrowthConditions δ η N Q) + (m : ℕ) : + (1 / (sourceBundleRemovalGrowth Q N m : ℝ) ^ 2) / + sourceBundleDefectScale δ η N m ^ 2 ≤ + δ := by + have hx : (0 : ℝ) < (m + 1 : ℕ) := by positivity + have hF : (0 : ℝ) < sourceBundleRemovalGrowth Q N m := by + exact_mod_cast (sourceBundleRemovalGrowth Q N).positive m + have ht : 0 < sourceBundleDefectScale δ η N m := + sourceBundleDefectScale_pos hδ hη N m + rw [div_le_iff₀ (sq_pos_of_pos ht)] + rw [div_le_iff₀ (sq_pos_of_pos hF)] + have hpoly : + (Q : ℝ) * ((m + 1 : ℕ) : ℝ) ^ N ≤ + (sourceBundleRemovalGrowth Q N m : ℕ) := by + exact_mod_cast sourceBundleRemovalGrowth_polynomial_le Q N m + have hpolySq : + ((Q : ℝ) * ((m + 1 : ℕ) : ℝ) ^ N) ^ 2 ≤ + (sourceBundleRemovalGrowth Q N m : ℝ) ^ 2 := by + exact + (sq_le_sq₀ + (mul_nonneg (Nat.cast_nonneg Q) (pow_nonneg hx.le N)) + hF.le).2 hpoly + calc + 1 ≤ δ * (Q : ℝ) ^ 2 * η ^ 2 * δ ^ (2 * N) := hQ.gap + _ = + δ * (((Q : ℝ) * ((m + 1 : ℕ) : ℝ) ^ N) ^ 2 * + sourceBundleDefectScale δ η N m ^ 2) := by + unfold sourceBundleDefectScale sourceBundleDensity + rw [div_pow] + field_simp + ring + _ ≤ + δ * ((sourceBundleRemovalGrowth Q N m : ℝ) ^ 2 * + sourceBundleDefectScale δ η N m ^ 2) := by + apply mul_le_mul_of_nonneg_left _ hδ.le + exact mul_le_mul_of_nonneg_right hpolySq (sq_nonneg _) + _ = + δ * sourceBundleDefectScale δ η N m ^ 2 * + (sourceBundleRemovalGrowth Q N m : ℝ) ^ 2 := by + ring + +theorem sqrt_sourceBundleDefectScale_sq_four_div_pow_le + {δ κ step : ℝ} {N p m : ℕ} + (hδ : 0 < δ) (hδ_one : δ ≤ 1) + (hκ : 0 ≤ κ) (hκ_step : 4 * κ ≤ step) + (hp : p ≤ N) : + Real.sqrt + (sourceBundleDefectScale δ κ N m ^ 2 * + (1 + (1 : ℝ)) * (1 + (1 : ℝ))) / + sourceBundleDensity δ m ^ p ≤ + step / 2 := by + let a := sourceBundleDensity δ m + let t := sourceBundleDefectScale δ κ N m + have ha : 0 < a := sourceBundleDensity_pos hδ m + have ha_one : a ≤ 1 := + sourceBundleDensity_le_one hδ_one hδ.le m + have ht : 0 ≤ t := + sourceBundleDefectScale_nonneg hδ.le hκ N m + have hpow : a ^ N ≤ a ^ p := + pow_le_pow_of_le_one ha.le ha_one hp + have hsqrt : + Real.sqrt (t ^ 2 * (1 + (1 : ℝ)) * (1 + (1 : ℝ))) = + 2 * t := by + rw [show + t ^ 2 * (1 + (1 : ℝ)) * (1 + (1 : ℝ)) = + (2 * t) ^ 2 by ring] + exact Real.sqrt_sq (mul_nonneg (by norm_num) ht) + rw [show sourceBundleDefectScale δ κ N m = t by rfl, + show sourceBundleDensity δ m = a by rfl, hsqrt] + have hnormalized : 2 * t / a ^ p ≤ 2 * κ := by + apply (div_le_iff₀ (pow_pos ha p)).2 + calc + 2 * t = (2 * κ) * a ^ N := by + dsimp [t, a, sourceBundleDefectScale] + ring + _ ≤ (2 * κ) * a ^ p := + mul_le_mul_of_nonneg_left hpow (by positivity) + exact hnormalized.trans (by linarith) + +theorem div_pow_le_sq_of_le_scaled_pow + {τ κ a μ : ℝ} {p N : ℕ} + (ha : 0 < a) (ha_one : a ≤ 1) (haμ : a ≤ μ) + (hτ : τ ≤ κ ^ 2 * a ^ N) (hp : p ≤ N) : + τ / μ ^ p ≤ κ ^ 2 := by + have hμ : 0 < μ := ha.trans_le haμ + have hpow₁ : a ^ N ≤ a ^ p := + pow_le_pow_of_le_one ha.le ha_one hp + have hpow₂ : a ^ p ≤ μ ^ p := + pow_le_pow_left₀ ha.le haμ p + apply (div_le_iff₀ (pow_pos hμ p)).2 + exact hτ.trans + (mul_le_mul_of_nonneg_left (hpow₁.trans hpow₂) (sq_nonneg κ)) + +theorem sourceBundleRankwiseEnvelope_and_error_lt_half + {r edgeBound Q : ℕ} {δ κ step : ℝ} + (hδ : 0 < δ) (hδ_one : δ ≤ 1) + (hκ : 0 < κ) (hstep : 0 ≤ step) + (hκ_step : 4 * κ ≤ step) + (hκ_sq : κ ^ 2 ≤ step / 2) + (hcap : + (r : ℝ) * + (bundleReverseDoublingHorizon r edgeBound 0 : ℝ) * step ≤ 1) + (hfinal : + (r : ℝ) * + (bundleReverseDoublingHorizon r edgeBound 0 : ℝ) * step < 1 / 2) + (hQ : SourceBundleRemovalGrowthConditions δ κ + (bundleReverseDoublingHorizon r edgeBound 0) Q) + (scale : Fin (r + 1) → ℕ) (hscale : Antitone scale) : + IsBundleCountingEnvelope + (sourceBundleRankwiseDensity δ scale) + (sourceBundleRankwiseDefect δ κ + (bundleReverseDoublingHorizon r edgeBound 0) scale) + (bundleRankwiseDensityFloor + (sourceBundleRankwiseDensity δ scale)) + (sourceFullCommonTolerance + (sourceBundleRemovalGrowth Q + (bundleReverseDoublingHorizon r edgeBound 0)) scale) + (bundleRankwiseEnvelopeError + (sourceBundleRankwiseDensity δ scale) + (sourceBundleRankwiseDefect δ κ + (bundleReverseDoublingHorizon r edgeBound 0) scale) + (bundleRankwiseDensityFloor + (sourceBundleRankwiseDensity δ scale)) + (sourceFullCommonTolerance + (sourceBundleRemovalGrowth Q + (bundleReverseDoublingHorizon r edgeBound 0)) scale)) ∧ + bundleRankwiseEnvelopeError + (sourceBundleRankwiseDensity δ scale) + (sourceBundleRankwiseDefect δ κ + (bundleReverseDoublingHorizon r edgeBound 0) scale) + (bundleRankwiseDensityFloor + (sourceBundleRankwiseDensity δ scale)) + (sourceFullCommonTolerance + (sourceBundleRemovalGrowth Q + (bundleReverseDoublingHorizon r edgeBound 0)) scale) + r edgeBound < 1 / 2 := by + let N := bundleReverseDoublingHorizon r edgeBound 0 + let α := sourceBundleRankwiseDensity δ scale + let β := sourceBundleRankwiseDefect δ κ N scale + let μ := bundleRankwiseDensityFloor α + let τ := sourceFullCommonTolerance + (sourceBundleRemovalGrowth Q N) scale + have hα : ∀ d, 0 < α d := by + intro d + exact sourceBundleRankwiseDensity_pos hδ scale d + have hα_one : ∀ d, α d ≤ 1 := by + intro d + exact sourceBundleRankwiseDensity_le_one hδ.le hδ_one scale d + have hβ : ∀ d, 0 ≤ β d := by + intro d + exact sourceBundleRankwiseDefect_nonneg δ κ N scale d + have hτ : 0 ≤ τ := by + exact (sourceFullCommonTolerance_pos + (sourceBundleRemovalGrowth Q N) scale).le + have hαzero : ∀ d, α 0 ≤ α d := by + intro d + exact sourceBundleRankwiseDensity_zero_le hδ.le hscale d + have hfinitePower : + ∀ d, d < r → ∀ n, + n < bundleReverseDoublingHorizon r edgeBound (d + 1) → + n + 1 ≤ N := by + intro d _hd n hn + have hhorizon := + bundleReverseDoublingHorizon_le_zero r edgeBound (d + 1) + dsimp only [N] + omega + apply + (bundleRankwiseEnvelope_and_error_lt_half_of_reverseDoublingBudget + hα hα_one hβ hτ hstep r edgeBound hcap hfinal) + · intro d hd n hn + have hp := hfinitePower d hd n hn + simpa only [α, β, N, sourceBundleRankwiseDefect, + sourceBundleRankwiseDensity] using + (sqrt_sourceBundleDefectScale_sq_four_div_pow_le + hδ hδ_one hκ.le hκ_step hp) + · intro d hd n hn + have hp := hfinitePower d hd n hn + have ha0 : 0 < α 0 := hα 0 + have ha0_one : α 0 ≤ 1 := hα_one 0 + have ha0μ : α 0 ≤ μ (d + 1) := + le_bundleRankwiseDensityFloor_of_zero_le hαzero (d + 1) + have hτscaled : τ ≤ κ ^ 2 * (α 0) ^ N := by + simpa only [τ, α, N, sourceFullCommonTolerance, + sourceBundleRankwiseDensity, sourceBundleSelectedScale_zero] using + (one_div_sourceBundleRemovalGrowth_le hδ hκ hQ (scale 0)) + exact + (div_pow_le_sq_of_le_scaled_pow + ha0 ha0_one ha0μ hτscaled hp).trans hκ_sq + +namespace SourceFullCoarseTargetSchedule.Certificate + +theorem scale_antitone + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (C : SourceFullCoarseTargetSchedule.Certificate + k r initial initialBound F scaleFloor) : + Antitone C.scale := by + rw [Fin.antitone_iff_succ_le] + intro j + exact + (Nat.le_succ _).trans + ((F.above_diagonal (C.scale j.succ)).trans + (C.scale_hierarchy j)) + +end SourceFullCoarseTargetSchedule.Certificate + +namespace SourceFullCoarseTargetSchedule.Bounded + +structure Certificate + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (S : SourceFullCoarseTargetSchedule.Bounded + k r initialBound F scaleFloor) + (initial : OrderedPartitionComplex G k r) where + toSourceFull : + SourceFullCoarseTargetSchedule.Certificate + k r initial initialBound F scaleFloor + scale_zero_le_ceiling : toSourceFull.scale 0 ≤ S.ceiling + +theorem certificate_nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (S : SourceFullCoarseTargetSchedule.Bounded + k r initialBound F scaleFloor) + (initial : OrderedPartitionComplex G k r) + (hinitial : + ∀ (q : Fin (r + 1)) (e : OrderedFace k q.1), + FacePartition.complexity + (initial.partition q e) ≤ + initialBound q) : + Nonempty (Certificate S initial) := by + obtain ⟨P, R, hindex⟩ := + S.plan.schedule.exists_landing_certificate + initial S.plan.schedule_admissible + let C : SourceFullCoarseTargetSchedule.Certificate + k r initial initialBound F scaleFloor := + { tolerance := P.tolerance + budget := P.budget + length := P.length + regularity := R + scale := S.plan.scale P + scaleFloor_le := S.plan.scaleFloor_le P + scale_hierarchy := S.plan.scale_hierarchy P + selected_tolerance_nonneg := by + intro j + simp only [selectedOrderedComplexTolerance] + rw [congrFun hindex j] + exact + P.tolerance_nonneg S.plan.schedule_admissible + j (P.index j) + selected_tolerance_le_common := by + intro j + simpa [selectedOrderedComplexTolerance, hindex] using + S.plan.selected_tolerance_le_common P j + rank_gap_le := by + intro j + have hgap := R.gap_le j + have hreciprocal := S.plan.reciprocal_gap_le P j + change + orderedLayerAtomEnergy + (R.fine.partition j.castSucc) + (R.coarse.partition j.succ) - + orderedLayerAtomEnergy + (R.coarse.partition j.castSucc) + (R.coarse.partition j.succ) ≤ + sourceFullRankGap F (S.plan.scale P) j + exact hgap.trans hreciprocal + coarse_complexity := by + intro q + cases q using Fin.lastCases with + | last => + intro e + have htop := congrFun R.coarse_topLayer_eq e + simp only [OrderedPartitionComplex.topLayer] at htop + rw [htop] + calc + FacePartition.complexity + (initial.partition (Fin.last r) e) ≤ + initialBound (Fin.last r) := + hinitial (Fin.last r) e + _ = adaptiveSelectedCoarseLayerBound + initialBound P (Fin.last r) := by + simp [adaptiveSelectedCoarseLayerBound] + _ ≤ S.plan.scale P (Fin.last r) := + S.plan.selected_coarse_bound P (Fin.last r) + | cast j => + intro e + calc + FacePartition.complexity + (R.coarse.partition j.castSucc e) ≤ + fixedUpperLayerComplexityFactor + j.1 (P.budget j) (P.index j) * + FacePartition.complexity + (initial.partition j.castSucc e) := by + rw [← congrFun hindex j] + exact R.coarse_complexity j e + _ ≤ fixedUpperLayerComplexityFactor + j.1 (P.budget j) (P.index j) * + initialBound j.castSucc := + Nat.mul_le_mul_left _ (hinitial j.castSucc e) + _ = adaptiveSelectedCoarseLayerBound + initialBound P j.castSucc := by + simp [adaptiveSelectedCoarseLayerBound] + _ ≤ S.plan.scale P j.castSucc := + S.plan.selected_coarse_bound P j.castSucc } + exact ⟨⟨C, S.scale_zero_le P⟩⟩ + +end SourceFullCoarseTargetSchedule.Bounded + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullCoarseTargetRegularity.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullCoarseTargetRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..9250d1babc14cb13137b2802e5ce3e13c969cd87 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullCoarseTargetRegularity.lean @@ -0,0 +1,987 @@ +import OAI.Combinatorics.Progressions.FixedDensity.AdaptiveCoarseTargetRegularity +import OAI.Combinatorics.Progressions.FixedDensity.TowerDominatingGrowth + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +noncomputable def sourceFullCommonTolerance + {r : ℕ} (F : NatGrowthFunction) + (scale : Fin (r + 1) → ℕ) : ℝ := + 1 / (F (scale 0) : ℝ) + +noncomputable def sourceFullRankGap + {r : ℕ} (F : NatGrowthFunction) + (scale : Fin (r + 1) → ℕ) + (j : Fin r) : ℝ := + 1 / (F (scale j.succ) : ℝ) ^ 2 + +theorem sourceFullCommonTolerance_pos + {r : ℕ} (F : NatGrowthFunction) + (scale : Fin (r + 1) → ℕ) : + 0 < sourceFullCommonTolerance F scale := by + unfold sourceFullCommonTolerance + exact one_div_pos.mpr + (by exact_mod_cast F.positive (scale 0)) + +theorem sourceFullRankGap_pos + {r : ℕ} (F : NatGrowthFunction) + (scale : Fin (r + 1) → ℕ) + (j : Fin r) : + 0 < sourceFullRankGap F scale j := by + unfold sourceFullRankGap + exact one_div_pos.mpr + (sq_pos_of_pos + (by exact_mod_cast F.positive (scale j.succ))) + +def adaptiveSelectedCoarseLayerBound + {k r : ℕ} + (initialBound : Fin (r + 1) → ℕ) + {S : AdaptiveCoarseTargetSchedule k r} + (P : S.Landing) : + Fin (r + 1) → ℕ := + Fin.lastCases + (initialBound (Fin.last r)) + (fun j => + fixedUpperLayerComplexityFactor + j.1 (P.budget j) (P.index j) * + initialBound j.castSucc) + +structure SourceFullCoarseTargetSchedule + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) where + schedule : AdaptiveCoarseTargetSchedule k r + schedule_admissible : schedule.IsAdmissible + scale : schedule.Landing → Fin (r + 1) → ℕ + scaleFloor_le_deepest : + ∀ P, scaleFloor ≤ scale P (Fin.last r) + scale_hierarchy : + ∀ P (j : Fin r), + F (scale P j.succ) ≤ scale P j.castSucc + selected_tolerance_le_common : + ∀ P (j : Fin r), + P.tolerance j (P.index j) ≤ + sourceFullCommonTolerance F (scale P) + reciprocal_gap_le : + ∀ P (j : Fin r), + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (P.length j : ℝ) ≤ + sourceFullRankGap F (scale P) j + selected_coarse_bound : + ∀ P q, + adaptiveSelectedCoarseLayerBound initialBound P q ≤ + scale P q + +namespace SourceFullCoarseTargetSchedule + +theorem scale_antitone + {k r : ℕ} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (S : SourceFullCoarseTargetSchedule + k r initialBound F scaleFloor) + (P : S.schedule.Landing) : + Antitone (S.scale P) := by + rw [Fin.antitone_iff_succ_le] + intro j + exact + (Nat.le_succ _).trans + ((F.above_diagonal (S.scale P j.succ)).trans + (S.scale_hierarchy P j)) + +theorem scaleFloor_le + {k r : ℕ} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (S : SourceFullCoarseTargetSchedule + k r initialBound F scaleFloor) + (P : S.schedule.Landing) + (q : Fin (r + 1)) : + scaleFloor ≤ S.scale P q := by + exact (S.scaleFloor_le_deepest P).trans + (S.scale_antitone P (Fin.le_last q)) + +structure Certificate + {G : Type*} [Fintype G] [DecidableEq G] + (k r : ℕ) + (initial : OrderedPartitionComplex G k r) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) where + tolerance : (j : Fin r) → ℕ → ℝ + budget : (j : Fin r) → ℕ → ℕ + length : Fin r → ℕ + regularity : + CoarseTargetOrderedComplexRegularityCertificate + G k r initial tolerance budget length + scale : Fin (r + 1) → ℕ + scaleFloor_le : ∀ q, scaleFloor ≤ scale q + scale_hierarchy : + ∀ j : Fin r, + F (scale j.succ) ≤ scale j.castSucc + selected_tolerance_nonneg : + ∀ j : Fin r, + 0 ≤ + selectedOrderedComplexTolerance + tolerance regularity.index j + selected_tolerance_le_common : + ∀ j : Fin r, + selectedOrderedComplexTolerance + tolerance regularity.index j ≤ + sourceFullCommonTolerance F scale + rank_gap_le : + ∀ j : Fin r, + regularity.toCoarseFine.coarseUpperLayerAtomEnergyGap j ≤ + sourceFullRankGap F scale j + coarse_complexity : + ∀ (q : Fin (r + 1)) (e : OrderedFace k q.1), + FacePartition.complexity + (regularity.coarse.partition q e) ≤ + scale q + +theorem certificate_nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (S : SourceFullCoarseTargetSchedule + k r initialBound F scaleFloor) + (initial : OrderedPartitionComplex G k r) + (hinitial : + ∀ (q : Fin (r + 1)) (e : OrderedFace k q.1), + FacePartition.complexity + (initial.partition q e) ≤ + initialBound q) : + Nonempty + (Certificate k r initial initialBound F scaleFloor) := by + obtain ⟨P, R, hindex⟩ := + S.schedule.exists_landing_certificate + initial S.schedule_admissible + refine ⟨{ + tolerance := P.tolerance + budget := P.budget + length := P.length + regularity := R + scale := S.scale P + scaleFloor_le := S.scaleFloor_le P + scale_hierarchy := S.scale_hierarchy P + selected_tolerance_nonneg := ?_ + selected_tolerance_le_common := ?_ + rank_gap_le := ?_ + coarse_complexity := ?_ }⟩ + · intro j + simp only [selectedOrderedComplexTolerance] + rw [congrFun hindex j] + exact + P.tolerance_nonneg S.schedule_admissible + j (P.index j) + · intro j + simpa [selectedOrderedComplexTolerance, hindex] using + S.selected_tolerance_le_common P j + · intro j + have hgap := R.gap_le j + have hreciprocal := S.reciprocal_gap_le P j + change + orderedLayerAtomEnergy + (R.fine.partition j.castSucc) + (R.coarse.partition j.succ) - + orderedLayerAtomEnergy + (R.coarse.partition j.castSucc) + (R.coarse.partition j.succ) ≤ + sourceFullRankGap F (S.scale P) j + exact hgap.trans hreciprocal + · intro q + cases q using Fin.lastCases with + | last => + intro e + have htop := congrFun R.coarse_topLayer_eq e + simp only [OrderedPartitionComplex.topLayer] at htop + rw [htop] + calc + FacePartition.complexity + (initial.partition (Fin.last r) e) ≤ + initialBound (Fin.last r) := + hinitial (Fin.last r) e + _ = + adaptiveSelectedCoarseLayerBound + initialBound P (Fin.last r) := by + simp [adaptiveSelectedCoarseLayerBound] + _ ≤ S.scale P (Fin.last r) := + S.selected_coarse_bound P (Fin.last r) + | cast j => + intro e + calc + FacePartition.complexity + (R.coarse.partition j.castSucc e) ≤ + fixedUpperLayerComplexityFactor + j.1 (P.budget j) (P.index j) * + FacePartition.complexity + (initial.partition j.castSucc e) := by + rw [← congrFun hindex j] + exact R.coarse_complexity j e + _ ≤ + fixedUpperLayerComplexityFactor + j.1 (P.budget j) (P.index j) * + initialBound j.castSucc := + Nat.mul_le_mul_left _ + (hinitial j.castSucc e) + _ = + adaptiveSelectedCoarseLayerBound + initialBound P j.castSucc := by + simp [adaptiveSelectedCoarseLayerBound] + _ ≤ S.scale P j.castSucc := + S.selected_coarse_bound P j.castSucc + +def zero + (k : ℕ) + (initialBound : Fin 1 → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) : + SourceFullCoarseTargetSchedule + k 0 initialBound F scaleFloor where + schedule := .nil + schedule_admissible := trivial + scale := fun _ _ => + max scaleFloor (initialBound 0) + scaleFloor_le_deepest := by + intro P + exact le_max_left _ _ + scale_hierarchy := by + intro P j + exact Fin.elim0 j + selected_tolerance_le_common := by + intro P j + exact Fin.elim0 j + reciprocal_gap_le := by + intro P j + exact Fin.elim0 j + selected_coarse_bound := by + intro P q + have hq : q = 0 := Fin.eq_zero q + subst q + change initialBound 0 ≤ + max scaleFloor (initialBound 0) + exact le_max_right _ _ + +theorem certificate_nonempty_zero + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + (k : ℕ) + (initial : OrderedPartitionComplex G k 0) + (initialBound : Fin 1 → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) + (hinitial : + ∀ (q : Fin 1) (e : OrderedFace k q.1), + FacePartition.complexity + (initial.partition q e) ≤ + initialBound q) : + Nonempty + (Certificate k 0 initial initialBound F scaleFloor) := + (zero k initialBound F scaleFloor).certificate_nonempty + initial hinitial + +def nodeScale + {k r length : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (topScale : ℕ) + (lowerScale : + ∀ i : Fin length, + (next i).Landing → Fin (r + 1) → ℕ) + (P : + (AdaptiveCoarseTargetSchedule.node + tolerance budget length next).Landing) : + Fin (r + 2) → ℕ := + match P with + | .node chosen lower => + Fin.lastCases topScale + (lowerScale chosen lower) + +@[simp] +theorem nodeScale_node + {k r length : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (topScale : ℕ) + (lowerScale : + ∀ i : Fin length, + (next i).Landing → Fin (r + 1) → ℕ) + (chosen : Fin length) + (lower : (next chosen).Landing) : + nodeScale (tolerance := tolerance) (budget := budget) + topScale lowerScale + (AdaptiveCoarseTargetSchedule.Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower) = + Fin.lastCases topScale + (lowerScale chosen lower) := + rfl + +@[simp] +theorem nodeScale_node_last + {k r length : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (topScale : ℕ) + (lowerScale : + ∀ i : Fin length, + (next i).Landing → Fin (r + 1) → ℕ) + (chosen : Fin length) + (lower : (next chosen).Landing) : + nodeScale (tolerance := tolerance) (budget := budget) + topScale lowerScale + (AdaptiveCoarseTargetSchedule.Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower) + (Fin.last (r + 1)) = + topScale := by + simp [nodeScale] + +@[simp] +theorem nodeScale_node_castSucc + {k r length : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (topScale : ℕ) + (lowerScale : + ∀ i : Fin length, + (next i).Landing → Fin (r + 1) → ℕ) + (chosen : Fin length) + (lower : (next chosen).Landing) + (q : Fin (r + 1)) : + nodeScale (tolerance := tolerance) (budget := budget) + topScale lowerScale + (AdaptiveCoarseTargetSchedule.Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower) + q.castSucc = + lowerScale chosen lower q := by + simp [nodeScale] + +@[simp] +theorem sourceFullCommonTolerance_nodeScale + {k r length : ℕ} + {tolerance : ℕ → ℝ} + {budget : ℕ → ℕ} + {next : Fin length → AdaptiveCoarseTargetSchedule k r} + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerScale : + ∀ i : Fin length, + (next i).Landing → Fin (r + 1) → ℕ) + (chosen : Fin length) + (lower : (next chosen).Landing) : + sourceFullCommonTolerance F + (nodeScale (tolerance := tolerance) (budget := budget) + topScale lowerScale + (AdaptiveCoarseTargetSchedule.Landing.node + (tolerance := tolerance) (budget := budget) + chosen lower)) = + sourceFullCommonTolerance F + (lowerScale chosen lower) := by + unfold sourceFullCommonTolerance + rw [show + (0 : Fin (r + 2)) = + (0 : Fin (r + 1)).castSucc by rfl] + rw [nodeScale_node_castSucc] + +def lowerInitialBound + {r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (budget : ℕ → ℕ) + {length : ℕ} + (i : Fin length) : + Fin (r + 1) → ℕ := + Fin.lastCases + (fixedUpperLayerComplexityFactor r budget i.1 * + initialBound (Fin.last r).castSucc) + (fun q => initialBound q.castSucc.castSucc) + +def node + {k r : ℕ} + {initialBound : Fin (r + 2) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (topScale : ℕ) + (tolerance : ℕ → ℝ) + (budget : ℕ → ℕ) + (length : ℕ) + (next : + (i : Fin length) → + SourceFullCoarseTargetSchedule + k r (lowerInitialBound initialBound budget i) + F (F topScale)) + (htolerance : ∀ n, 0 ≤ tolerance n) + (hbudget : + ∀ n, + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) < + (budget n : ℝ) * (tolerance n) ^ 2) + (hlength : 0 < length) + (hscaleFloor : scaleFloor ≤ topScale) + (hinitialTop : + initialBound (Fin.last (r + 1)) ≤ topScale) + (htopTolerance : + ∀ (i : Fin length) + (P : (next i).schedule.Landing), + tolerance i.1 ≤ + sourceFullCommonTolerance F ((next i).scale P)) + (htopGap : + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) / + (length : ℝ) ≤ + 1 / (F topScale : ℝ) ^ 2) : + SourceFullCoarseTargetSchedule + k (r + 1) initialBound F scaleFloor where + schedule := + .node tolerance budget length + (fun i => (next i).schedule) + schedule_admissible := by + exact ⟨htolerance, hbudget, hlength, + fun i => (next i).schedule_admissible⟩ + scale := + nodeScale topScale + (fun i => (next i).scale) + scaleFloor_le_deepest := by + intro P + cases P with + | node chosen lower => + simpa only [nodeScale_node_last] using + hscaleFloor + scale_hierarchy := by + intro P j + cases P with + | node chosen lower => + cases j using Fin.lastCases with + | last => + simpa only [Fin.succ_last, + nodeScale_node_last, + nodeScale_node_castSucc] using + (next chosen).scaleFloor_le_deepest lower + | cast q => + simpa only [Fin.succ_castSucc, + nodeScale_node_castSucc] using + (next chosen).scale_hierarchy lower q + selected_tolerance_le_common := by + intro P j + cases P with + | node chosen lower => + cases j using Fin.lastCases with + | last => + simpa only [ + AdaptiveCoarseTargetSchedule.Landing.tolerance_node_last, + AdaptiveCoarseTargetSchedule.Landing.index_node_last, + sourceFullCommonTolerance_nodeScale] using + htopTolerance chosen lower + | cast q => + simpa only [ + AdaptiveCoarseTargetSchedule.Landing.tolerance_node_castSucc, + AdaptiveCoarseTargetSchedule.Landing.index_node_castSucc, + sourceFullCommonTolerance_nodeScale] using + (next chosen).selected_tolerance_le_common + lower q + reciprocal_gap_le := by + intro P j + cases P with + | node chosen lower => + cases j using Fin.lastCases with + | last => + simp only [ + AdaptiveCoarseTargetSchedule.Landing.length_node_last, + sourceFullRankGap, Fin.succ_last, + nodeScale_node_last, Fin.val_last] + convert htopGap using 1 + | cast q => + simp only [ + AdaptiveCoarseTargetSchedule.Landing.length_node_castSucc, + sourceFullRankGap, Fin.succ_castSucc, + nodeScale_node_castSucc, + Fin.val_castSucc] + convert + (next chosen).reciprocal_gap_le lower q using 1 + · congr 1 + selected_coarse_bound := by + intro P q + cases P with + | node chosen lower => + cases q using Fin.lastCases with + | last => + simpa [adaptiveSelectedCoarseLayerBound, + nodeScale_node_last] using + hinitialTop + | cast q => + cases q using Fin.lastCases with + | last => + simpa [adaptiveSelectedCoarseLayerBound, + lowerInitialBound, + nodeScale_node_castSucc] using + (next chosen).selected_coarse_bound + lower (Fin.last r) + | cast j => + simpa [adaptiveSelectedCoarseLayerBound, + lowerInitialBound, + nodeScale_node_castSucc] using + (next chosen).selected_coarse_bound + lower j.castSucc + +structure Bounded + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) where + plan : + SourceFullCoarseTargetSchedule + k r initialBound F scaleFloor + ceiling : ℕ + scale_zero_le : + ∀ P : plan.schedule.Landing, + plan.scale P 0 ≤ ceiling + +namespace Bounded + +def castInitialBound + {k r : ℕ} + {initialBound newInitialBound : + Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {scaleFloor : ℕ} + (S : Bounded k r initialBound F scaleFloor) + (h : initialBound = newInitialBound) : + Bounded k r newInitialBound F scaleFloor where + plan := h ▸ S.plan + ceiling := S.ceiling + scale_zero_le := by + subst newInitialBound + exact S.scale_zero_le + +end Bounded + +def boundedZero + (k : ℕ) + (initialBound : Fin 1 → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) : + Bounded k 0 initialBound F scaleFloor where + plan := zero k initialBound F scaleFloor + ceiling := max scaleFloor (initialBound 0) + scale_zero_le := by + intro P + change + max scaleFloor (initialBound 0) ≤ + max scaleFloor (initialBound 0) + exact le_rfl + +def factorLowerInitialBound + {r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (factor : ℕ) : + Fin (r + 1) → ℕ := + Fin.lastCases + (factor * initialBound (Fin.last r).castSucc) + (fun q => initialBound q.castSucc.castSucc) + +noncomputable def sourceFullStageFactor + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) : + ℕ → ℕ + | 0 => 1 + | n + 1 => + let previous := + sourceFullStageFactor + initialBound F topScale lowerBuilder n + let lower := + lowerBuilder + (factorLowerInitialBound + initialBound previous) + let tolerance := + growthRegularityStepTolerance + F lower.ceiling + let budget := + orderedRemovalRegularityBudget + k r tolerance + (2 ^ (r + 1)) ^ budget * previous + +noncomputable def sourceFullStageBound + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (n : ℕ) : + Fin (r + 1) → ℕ := + factorLowerInitialBound initialBound + (sourceFullStageFactor + initialBound F topScale lowerBuilder n) + +noncomputable def sourceFullStagePlan + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (n : ℕ) : + Bounded k r + (sourceFullStageBound + initialBound F topScale lowerBuilder n) + F (F topScale) := + lowerBuilder + (sourceFullStageBound + initialBound F topScale lowerBuilder n) + +noncomputable def sourceFullStageTolerance + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (n : ℕ) : ℝ := + growthRegularityStepTolerance F + (sourceFullStagePlan + initialBound F topScale lowerBuilder n).ceiling + +noncomputable def sourceFullStageBudget + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (n : ℕ) : ℕ := + orderedRemovalRegularityBudget k r + (sourceFullStageTolerance + initialBound F topScale lowerBuilder n) + +@[simp] +theorem sourceFullStageFactor_zero + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) : + sourceFullStageFactor + initialBound F topScale lowerBuilder 0 = 1 := + rfl + +@[simp] +theorem sourceFullStageFactor_succ + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (n : ℕ) : + sourceFullStageFactor + initialBound F topScale lowerBuilder (n + 1) = + (2 ^ (r + 1)) ^ + sourceFullStageBudget + initialBound F topScale lowerBuilder n * + sourceFullStageFactor + initialBound F topScale lowerBuilder n := + rfl + +theorem fixedUpperLayerComplexityFactor_sourceFullStageBudget + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) : + ∀ n, + fixedUpperLayerComplexityFactor r + (sourceFullStageBudget + initialBound F topScale lowerBuilder) n = + sourceFullStageFactor + initialBound F topScale lowerBuilder n := by + intro n + induction n with + | zero => + rfl + | succ n ih => + change + (2 ^ (r + 1)) ^ + sourceFullStageBudget + initialBound F topScale lowerBuilder n * + fixedUpperLayerComplexityFactor r + (sourceFullStageBudget + initialBound F topScale lowerBuilder) n = + (2 ^ (r + 1)) ^ + sourceFullStageBudget + initialBound F topScale lowerBuilder n * + sourceFullStageFactor + initialBound F topScale lowerBuilder n + rw [ih] + +theorem lowerInitialBound_sourceFullStageBudget + {k r length : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (i : Fin length) : + lowerInitialBound initialBound + (sourceFullStageBudget + initialBound F topScale lowerBuilder) i = + sourceFullStageBound + initialBound F topScale lowerBuilder i.1 := by + funext q + cases q using Fin.lastCases with + | last => + simp [lowerInitialBound, sourceFullStageBound, + factorLowerInitialBound, + fixedUpperLayerComplexityFactor_sourceFullStageBudget] + | cast q => + simp [lowerInitialBound, sourceFullStageBound, + factorLowerInitialBound] + +noncomputable def sourceFullStageNext + {k r length : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (i : Fin length) : + Bounded k r + (lowerInitialBound initialBound + (sourceFullStageBudget + initialBound F topScale lowerBuilder) i) + F (F topScale) := + (sourceFullStagePlan + initialBound F topScale lowerBuilder i.1).castInitialBound + (lowerInitialBound_sourceFullStageBudget + initialBound F topScale lowerBuilder i).symm + +@[simp] +theorem sourceFullStageNext_ceiling + {k r length : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (i : Fin length) : + (sourceFullStageNext + initialBound F topScale lowerBuilder i).ceiling = + (sourceFullStagePlan + initialBound F topScale lowerBuilder i.1).ceiling := + rfl + +theorem sourceFullStageTolerance_pos + {k r : ℕ} + (initialBound : Fin (r + 2) → ℕ) + (F : NatGrowthFunction) + (topScale : ℕ) + (lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale)) + (n : ℕ) : + 0 < + sourceFullStageTolerance + initialBound F topScale lowerBuilder n := by + exact growthRegularityStepTolerance_pos F + (sourceFullStagePlan + initialBound F topScale lowerBuilder n).ceiling + +theorem bounded_nonempty + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) : + Nonempty + (Bounded k r initialBound F scaleFloor) := by + induction r generalizing scaleFloor with + | zero => + exact + ⟨boundedZero + k initialBound F scaleFloor⟩ + | succ r ih => + let topScale : ℕ := + max scaleFloor + (initialBound (Fin.last (r + 1))) + let gap : ℝ := + 1 / (F topScale : ℝ) ^ 2 + let length : ℕ := + growthRegularityLength k r gap + let lowerBuilder : + (bound : Fin (r + 1) → ℕ) → + Bounded k r bound F (F topScale) := + fun bound => + Classical.choice + (ih bound (F topScale)) + let tolerance : ℕ → ℝ := + sourceFullStageTolerance + initialBound F topScale lowerBuilder + let budget : ℕ → ℕ := + sourceFullStageBudget + initialBound F topScale lowerBuilder + let next : + (i : Fin length) → + Bounded k r + (lowerInitialBound initialBound budget i) + F (F topScale) := + fun i => + sourceFullStageNext + initialBound F topScale lowerBuilder i + have hgap_pos : 0 < gap := by + dsimp only [gap] + exact one_div_pos.mpr + (sq_pos_of_pos + (by exact_mod_cast F.positive topScale)) + let plan : + SourceFullCoarseTargetSchedule + k (r + 1) initialBound F scaleFloor := + node topScale tolerance budget length + (fun i => (next i).plan) + (by + intro n + exact + (sourceFullStageTolerance_pos + initialBound F topScale lowerBuilder n).le) + (by + intro n + change + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) < + (sourceFullStageBudget + initialBound F topScale lowerBuilder n : ℝ) * + (sourceFullStageTolerance + initialBound F topScale lowerBuilder n) ^ 2 + exact + orderedRemovalRegularityBudget_spec + (sourceFullStageTolerance_pos + initialBound F topScale lowerBuilder n)) + (by + exact growthRegularityLength_pos k r gap) + (by + exact le_max_left _ _) + (by + exact le_max_right _ _) + (by + intro i P + have hscale : + (next i).plan.scale P 0 ≤ + (sourceFullStagePlan + initialBound F topScale + lowerBuilder i.1).ceiling := by + exact + ((next i).scale_zero_le P).trans_eq + (sourceFullStageNext_ceiling + initialBound F topScale + lowerBuilder i) + change + growthRegularityStepTolerance F + (sourceFullStagePlan + initialBound F topScale + lowerBuilder i.1).ceiling ≤ + sourceFullCommonTolerance F + ((next i).plan.scale P) + unfold growthRegularityStepTolerance + sourceFullCommonTolerance + apply one_div_le_one_div_of_le + · exact_mod_cast + F.positive ((next i).plan.scale P 0) + · exact_mod_cast F.monotone hscale) + (by + have hgap := + orderedFace_card_div_growthRegularityLength_lt + (k := k) (j := r) hgap_pos + exact hgap.le) + let ceiling : ℕ := + finiteMaximum length + (fun i => (next i).ceiling) + refine ⟨{ + plan := plan + ceiling := ceiling + scale_zero_le := ?_ }⟩ + intro P + cases P with + | node chosen lower => + dsimp only [plan, ceiling, node] + change + nodeScale topScale + (fun i => (next i).plan.scale) + (AdaptiveCoarseTargetSchedule.Landing.node + chosen lower) 0 ≤ + finiteMaximum length + (fun i => (next i).ceiling) + rw [show + (0 : Fin (r + 2)) = + (0 : Fin (r + 1)).castSucc by rfl] + rw [nodeScale_node_castSucc] + exact + ((next chosen).scale_zero_le lower).trans + (le_finiteMaximum + (fun i => (next i).ceiling) chosen) + +theorem nonempty + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) : + Nonempty + (SourceFullCoarseTargetSchedule + k r initialBound F scaleFloor) := by + obtain ⟨S⟩ := + bounded_nonempty + k r initialBound F scaleFloor + exact ⟨S.plan⟩ + +theorem certificate_nonempty_full + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + (k r : ℕ) + (initial : OrderedPartitionComplex G k r) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (scaleFloor : ℕ) + (hinitial : + ∀ (q : Fin (r + 1)) (e : OrderedFace k q.1), + FacePartition.complexity + (initial.partition q e) ≤ + initialBound q) : + Nonempty + (Certificate + k r initial initialBound F scaleFloor) := by + obtain ⟨S⟩ := + nonempty k r initialBound F scaleFloor + exact S.certificate_nonempty initial hinitial + +end SourceFullCoarseTargetSchedule + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullOrderedRemoval.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullOrderedRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..a061fbd214d22dc55cae64db734730ccc7ace7e2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/SourceFullOrderedRemoval.lean @@ -0,0 +1,1069 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedFullBoundary + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +def topPositiveOrderedFace + {k n : ℕ} (e : OrderedFace k (n + 1)) : + PositiveOrderedFace k (n + 1) where + lowerRank := Fin.last n + face := e + +@[simp] +theorem topPositiveOrderedFace_rank + {k n : ℕ} (e : OrderedFace k (n + 1)) : + (topPositiveOrderedFace e).rank = n + 1 := by + rfl + +@[simp] +theorem topPositiveOrderedFace_lowerRank_succ + {k n : ℕ} (e : OrderedFace k (n + 1)) : + (topPositiveOrderedFace e).lowerRank.succ = + Fin.last (n + 1) := by + apply Fin.ext + rfl + +theorem partialConfigurationWeight_univ_eq_zero_of_not_occurrence + {G : Type*} [Fintype G] [DecidableEq G] + {k n : ℕ} + (H : OrderedPattern G k (n + 1)) + {C : OrderedPartitionComplex G k (n + 1)} + (hC : OrderedFacePartitionRefines C.topLayer + (orderedPatternTopPartition H)) + (A : ClosedOrderedAtomConfiguration G k (n + 1) C) + (hA : H.IsOccurrence A.witness) + {x : Fin k → G} (hx : ¬H.IsOccurrence x) : + partialConfigurationWeight A Finset.univ x = 0 := by + have hmissing : + ∃ e : OrderedFace k (n + 1), + orderedFaceTuple e x ∉ + (A.atom (Fin.last (n + 1)) e).1 := by + by_contra h + push Not at h + exact hx + (A.isOccurrence_of_mem_topAtoms + H hC hA x h) + obtain ⟨e, he⟩ := hmissing + unfold partialConfigurationWeight + apply Finset.prod_eq_zero + (Finset.mem_univ (topPositiveOrderedFace e)) + unfold configurationFaceWeight + change + partitionAtomIndicator + (C.partition (Fin.last (n + 1)) e) + (A.atom (Fin.last (n + 1)) e) + (orderedFaceTuple e x) = + 0 + exact + partitionAtomIndicator_of_not_mem + (C.partition (Fin.last (n + 1)) e) + (A.atom (Fin.last (n + 1)) e) he + +theorem partialConfigurationWeight_univ_le_patternWeight + {G : Type*} [Fintype G] [DecidableEq G] + {k n : ℕ} + (H : OrderedPattern G k (n + 1)) + {C : OrderedPartitionComplex G k (n + 1)} + (hC : OrderedFacePartitionRefines C.topLayer + (orderedPatternTopPartition H)) + (A : ClosedOrderedAtomConfiguration G k (n + 1) C) + (hA : H.IsOccurrence A.witness) + (x : Fin k → G) : + partialConfigurationWeight A Finset.univ x ≤ + H.toWeighted.patternWeight x := by + by_cases hx : H.IsOccurrence x + · rw [H.toWeighted_patternWeight_of_occurrence hx] + exact partialConfigurationWeight_le_one + A Finset.univ x + · rw [H.toWeighted_patternWeight_of_not_occurrence hx, + partialConfigurationWeight_univ_eq_zero_of_not_occurrence + H hC A hA hx] + +theorem fullConfigurationCount_le_patternCount + {G : Type*} [Fintype G] [DecidableEq G] + {k n : ℕ} + (H : OrderedPattern G k (n + 1)) + {C : OrderedPartitionComplex G k (n + 1)} + (hC : OrderedFacePartitionRefines C.topLayer + (orderedPatternTopPartition H)) + (A : ClosedOrderedAtomConfiguration G k (n + 1) C) + (hA : H.IsOccurrence A.witness) : + fullConfigurationCount A ≤ + H.toWeighted.patternCount := by + unfold fullConfigurationCount partialConfigurationCount + WeightedOrderedPattern.patternCount + exact mean_mono + (partialConfigurationWeight_univ_le_patternWeight + H hC A hA) + +theorem orderedBadBaseDeletionFamily_isCover_of_good_count + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k n : ℕ} (hrk : n + 1 ≤ k) + (H : OrderedPattern G k (n + 1)) + (P : OrderedCoarseFineComplex G k (n + 1)) + (hinitial : + P.fine.Refines (orderedPatternInitialComplex H)) + (α β : ℕ → ℝ) (c : ℝ) + (hcount : H.toWeighted.patternCount < c) + (hgoodCount : + ∀ A : ClosedOrderedAtomConfiguration + G k (n + 1) P.fine, + A.IsGood P.fine P.coarse α β → + c ≤ fullConfigurationCount A) : + H.IsCover + (orderedBadBaseDeletionFamily + P.fine P.coarse α β) := by + intro x hx + by_contra hsurvives + push Not at hsurvives + let A : + ClosedOrderedAtomConfiguration + G k (n + 1) P.fine := + ClosedOrderedAtomConfiguration.ofTuple P.fine x + have hgood : + A.IsGood P.fine P.coarse α β := by + exact + ClosedOrderedAtomConfiguration.isGood_of_avoids_topBadBaseDeletion + hrk P.fine P.coarse x α β hsurvives + have hcA : c ≤ fullConfigurationCount A := + hgoodCount A hgood + have htop : + OrderedFacePartitionRefines P.fine.topLayer + (orderedPatternTopPartition H) := + orderedPatternTopPartition_refines_of_complex_refines_initial + H hinitial + have hAH : + fullConfigurationCount A ≤ + H.toWeighted.patternCount := by + exact fullConfigurationCount_le_patternCount + H htop A ((H.mem_occurrenceFinset x).1 hx) + linarith + +theorem orderedBadBaseDeletionFamily_isCover + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k n : ℕ} (hrk : n + 1 ≤ k) + (H : OrderedPattern G k (n + 1)) + (P : OrderedCoarseFineComplex G k (n + 1)) + (hinitial : + P.fine.Refines (orderedPatternInitialComplex H)) + (α β : ℕ → ℝ) + (ε : OrderedRegularityTolerance (n + 1)) + (hregular : + IsFullyPreliminaryOrderedRegular P.fine ε) + {ρ η δ : ℝ} + (hρ : 0 ≤ ρ) (hη : 0 ≤ η) (hδ : 0 ≤ δ) + (hα : ∀ m, ρ ≤ α m) + (hε : ∀ j, ε j ≤ η) + (hβ0 : ∀ m, 0 ≤ β m) + (hβδ : ∀ m, β m ≤ δ ^ 2) + (hcount : + H.toWeighted.patternCount < + ρ ^ Fintype.card + (PositiveOrderedFace k (n + 1)) - + (Fintype.card + (PositiveOrderedFace k (n + 1)) : ℝ) * + (η + δ)) : + H.IsCover + (orderedBadBaseDeletionFamily + P.fine P.coarse α β) := by + apply orderedBadBaseDeletionFamily_isCover_of_good_count + hrk H P hinitial α β + (ρ ^ Fintype.card + (PositiveOrderedFace k (n + 1)) - + (Fintype.card + (PositiveOrderedFace k (n + 1)) : ℝ) * + (η + δ)) + hcount + intro A hgood + exact fullConfigurationCount_lower_bound + P A α β hgood ε hregular + hρ hη hδ hα hε hβ0 hβδ + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace OrderedCoarseFineComplex + +noncomputable def sourceFullAtomDefectSq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) + (x : Fin (e.lowerRank.1 + 1) → G) : ℝ := + atomBoundaryDefectSq + (orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face) + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + upper a x + +theorem sourceFullAtomDefectSq_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) + (x : Fin (e.lowerRank.1 + 1) → G) : + 0 ≤ P.sourceFullAtomDefectSq e upper a x := by + exact atomBoundaryDefectSq_nonneg _ _ upper a x + +noncomputable def sourceFullLargeDefectBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) (β : ℝ) : + Finset (Fin (e.lowerRank.1 + 1) → G) := + largeAverageBaseSupport + (orderedFullLowerBoundaryPartition P.coarse e) + (P.sourceFullAtomDefectSq e upper a) β + +@[simp] +theorem mem_sourceFullLargeDefectBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) (β : ℝ) + (x : Fin (e.lowerRank.1 + 1) → G) : + x ∈ P.sourceFullLargeDefectBaseSupport e upper a β ↔ + β < + conditionalMean + (orderedFullLowerBoundaryPartition P.coarse e) + (P.sourceFullAtomDefectSq e upper a) x := by + exact + mem_largeAverageBaseSupport + (orderedFullLowerBoundaryPartition P.coarse e) + (P.sourceFullAtomDefectSq e upper a) β x + +theorem mul_mean_indicator_sourceFullLargeDefectBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) + {β : ℝ} (hβ : 0 ≤ β) : + β * mean (finsetIndicator + (P.sourceFullLargeDefectBaseSupport e upper a β)) ≤ + mean (P.sourceFullAtomDefectSq e upper a) := by + exact + mul_mean_indicator_largeAverageBaseSupport_le + (orderedFullLowerBoundaryPartition P.coarse e) + (P.sourceFullAtomDefectSq e upper a) + (P.sourceFullAtomDefectSq_nonneg e upper a) + hβ + +theorem mul_mean_indicator_sourceFullLargeDefectBaseSupport_le_atomEnergy_sub + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) + {β : ℝ} (hβ : 0 ≤ β) : + β * mean (finsetIndicator + (P.sourceFullLargeDefectBaseSupport e upper a β)) ≤ + orderedAtomEnergy + (positiveFaceLowerLayer P.fine e) e.face upper - + orderedAtomEnergy + (positiveFaceLowerLayer P.coarse e) e.face upper := by + refine + (P.mul_mean_indicator_sourceFullLargeDefectBaseSupport_le + e upper a hβ).trans ?_ + change + mean + (atomBoundaryDefectSq + (orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face) + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + upper a) ≤ + partitionAtomEnergy + (orderedBoundaryPartition + (positiveFaceLowerLayer P.fine e) e.face) upper - + partitionAtomEnergy + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) upper + exact + mean_atomBoundaryDefectSq_le_atomEnergy_sub + (orderedBoundaryPartition_mono + (fun f => P.refines e.lowerRank.castSucc f) e.face) + upper a + +theorem mean_indicator_sourceFullLargeDefectBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) + {β : ℝ} (hβ : 0 < β) : + mean (finsetIndicator + (P.sourceFullLargeDefectBaseSupport e upper a β)) ≤ + mean (P.sourceFullAtomDefectSq e upper a) / β := by + apply (le_div_iff₀ hβ).2 + simpa [mul_comm] using + P.mul_mean_indicator_sourceFullLargeDefectBaseSupport_le + e upper a hβ.le + +theorem orderedAtomEnergy_sub_eq_sum_mean_sourceFullAtomDefectSq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) : + orderedAtomEnergy + (positiveFaceLowerLayer P.fine e) e.face upper - + orderedAtomEnergy + (positiveFaceLowerLayer P.coarse e) e.face upper = + ∑ a : upper.parts, + mean (P.sourceFullAtomDefectSq e upper a) := by + rw [orderedAtomEnergy_sub_eq_sum_mean_sq + (fine := positiveFaceLowerLayer P.fine e) + (coarse := positiveFaceLowerLayer P.coarse e) + (fun f => P.refines e.lowerRank.castSucc f) + e.face upper] + rfl + +noncomputable def sourceFullAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) (α β : ℝ) : + Finset (Fin (e.lowerRank.1 + 1) → G) := + smallAverageBaseSupport + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (partitionAtomIndicator upper a) α ∪ + P.sourceFullLargeDefectBaseSupport e upper a β + +@[simp] +theorem mem_sourceFullAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) (α β : ℝ) + (x : Fin (e.lowerRank.1 + 1) → G) : + x ∈ P.sourceFullAtomBadBaseSupport e upper a α β ↔ + conditionalMean + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (partitionAtomIndicator upper a) x < α ∨ + β < + conditionalMean + (orderedFullLowerBoundaryPartition P.coarse e) + (P.sourceFullAtomDefectSq e upper a) x := by + rw [sourceFullAtomBadBaseSupport, Finset.mem_union, + mem_smallAverageBaseSupport, + P.mem_sourceFullLargeDefectBaseSupport] + +theorem mean_indicator_atom_inter_sourceFullAtomBadBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (a : upper.parts) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (a.1 ∩ P.sourceFullAtomBadBaseSupport + e upper a α β)) ≤ + α + mean (P.sourceFullAtomDefectSq e upper a) / β := by + calc + mean (finsetIndicator + (a.1 ∩ P.sourceFullAtomBadBaseSupport + e upper a α β)) ≤ + mean (finsetIndicator + (a.1 ∩ + smallAverageBaseSupport + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (partitionAtomIndicator upper a) α)) + + mean (finsetIndicator + (P.sourceFullLargeDefectBaseSupport + e upper a β)) := by + exact + mean_indicator_inter_union_le_add + a.1 + (smallAverageBaseSupport + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (partitionAtomIndicator upper a) α) + (P.sourceFullLargeDefectBaseSupport e upper a β) + _ ≤ + α + mean (P.sourceFullAtomDefectSq e upper a) / β := + add_le_add + (mean_indicator_inter_smallAverageBaseSupport_le + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + a.1 hα) + (P.mean_indicator_sourceFullLargeDefectBaseSupport_le + e upper a hβ) + +noncomputable def sourceFullOwnAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (α β : ℝ) : + Finset (Fin (e.lowerRank.1 + 1) → G) := by + classical + exact + (Finset.univ : Finset upper.parts).biUnion fun a => + a.1 ∩ P.sourceFullAtomBadBaseSupport e upper a α β + +@[simp] +theorem mem_sourceFullOwnAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + (α β : ℝ) (x : Fin (e.lowerRank.1 + 1) → G) : + x ∈ P.sourceFullOwnAtomBadBaseSupport e upper α β ↔ + x ∈ P.sourceFullAtomBadBaseSupport e upper + (partitionAtomAt upper x) α β := by + classical + constructor + · intro hx + rw [sourceFullOwnAtomBadBaseSupport] at hx + obtain ⟨a, _ha, hxpart⟩ := + Finset.mem_biUnion.mp hx + have hxa : x ∈ a.1 := + (Finset.mem_inter.mp hxpart).1 + have hbad : + x ∈ P.sourceFullAtomBadBaseSupport + e upper a α β := + (Finset.mem_inter.mp hxpart).2 + have hcanonical : partitionAtomAt upper x = a := + (partitionAtomAt_eq_iff_mem upper x a).2 hxa + simpa [hcanonical] using hbad + · intro hbad + rw [sourceFullOwnAtomBadBaseSupport] + apply Finset.mem_biUnion.mpr + refine ⟨partitionAtomAt upper x, Finset.mem_univ _, ?_⟩ + exact Finset.mem_inter.mpr + ⟨upper.mem_part (Finset.mem_univ x), hbad⟩ + +theorem mean_indicator_sourceFullOwnAtomBadBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (upper : FacePartition (Fin (e.lowerRank.1 + 1) → G)) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (P.sourceFullOwnAtomBadBaseSupport + e upper α β)) ≤ + (FacePartition.complexity upper : ℝ) * α + + (orderedAtomEnergy + (positiveFaceLowerLayer P.fine e) e.face upper - + orderedAtomEnergy + (positiveFaceLowerLayer P.coarse e) e.face upper) / β := by + calc + mean (finsetIndicator + (P.sourceFullOwnAtomBadBaseSupport + e upper α β)) ≤ + ∑ a : upper.parts, + mean (finsetIndicator + (a.1 ∩ P.sourceFullAtomBadBaseSupport + e upper a α β)) := by + exact + mean_finsetIndicator_biUnion_le_sum + (Finset.univ : Finset upper.parts) + (fun a => + a.1 ∩ P.sourceFullAtomBadBaseSupport + e upper a α β) + _ ≤ + ∑ a : upper.parts, + (α + mean + (P.sourceFullAtomDefectSq e upper a) / β) := by + apply Finset.sum_le_sum + intro a _ha + exact + P.mean_indicator_atom_inter_sourceFullAtomBadBaseSupport_le + e upper a hα hβ + _ = + (FacePartition.complexity upper : ℝ) * α + + (orderedAtomEnergy + (positiveFaceLowerLayer P.fine e) e.face upper - + orderedAtomEnergy + (positiveFaceLowerLayer P.coarse e) e.face upper) / β := by + rw [Finset.sum_add_distrib, ← Finset.sum_div] + simp only [Finset.sum_const, Finset.card_univ, + nsmul_eq_mul] + rw [Fintype.card_coe] + rw [← P.orderedAtomEnergy_sub_eq_sum_mean_sourceFullAtomDefectSq + e upper] + rfl + +noncomputable def sourceFullCoarseOwnAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (α β : ℝ) : + Finset (Fin (e.lowerRank.1 + 1) → G) := + P.sourceFullOwnAtomBadBaseSupport e + (P.coarse.partition e.lowerRank.succ e.face) α β + +@[simp] +theorem mem_sourceFullCoarseOwnAtomBadBaseSupport + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + (α β : ℝ) (x : Fin (e.lowerRank.1 + 1) → G) : + x ∈ P.sourceFullCoarseOwnAtomBadBaseSupport e α β ↔ + x ∈ P.sourceFullAtomBadBaseSupport e + (P.coarse.partition e.lowerRank.succ e.face) + (partitionAtomAt + (P.coarse.partition e.lowerRank.succ e.face) x) + α β := by + exact + P.mem_sourceFullOwnAtomBadBaseSupport e + (P.coarse.partition e.lowerRank.succ e.face) α β x + +theorem mean_indicator_sourceFullCoarseOwnAtomBadBaseSupport_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : PositiveOrderedFace k r) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) : + mean (finsetIndicator + (P.sourceFullCoarseOwnAtomBadBaseSupport e α β)) ≤ + (FacePartition.complexity + (P.coarse.partition e.lowerRank.succ e.face) : ℝ) * α + + P.coarseUpperFaceAtomEnergyGap + e.lowerRank e.face / β := by + unfold sourceFullCoarseOwnAtomBadBaseSupport + coarseUpperFaceAtomEnergyGap + exact + P.mean_indicator_sourceFullOwnAtomBadBaseSupport_le + e (P.coarse.partition e.lowerRank.succ e.face) hα hβ + +end OrderedCoarseFineComplex + +theorem sourceFullMixedDefect_eq_orderedAtomBoundaryDefect_of_mem + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (y : Fin (e.lowerRank.1 + 1) → G) + (hy : + y ∈ + (orderedFullLowerBoundaryPartition P.coarse e).part + (orderedFaceTuple e.face A.witness)) : + sourceFullMixedDefect P A e y = + orderedAtomBoundaryDefect + (positiveFaceLowerLayer P.fine e) + (positiveFaceLowerLayer P.coarse e) + e.face + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face) y := by + have himmediate : + y ∈ + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face).part + (orderedFaceTuple e.face A.witness) := + FacePartition.part_subset_of_le + (orderedFullLowerBoundaryPartition_le_immediate + P.coarse e) + (orderedFaceTuple e.face A.witness) hy + have hindicator : + mixedConfigurationBoundaryIndicator P A e y = 1 := by + unfold mixedConfigurationBoundaryIndicator + exact partitionAtomIndicator_of_mem _ _ himmediate + have h := + mixedConfigurationDefect_mul_boundaryIndicator P A e y + rw [hindicator, mul_one, mul_one] at h + simpa [sourceFullMixedDefect] using h + +theorem conditionalMean_sourceFullMixedDefect_sq_eq + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) : + conditionalMean + (orderedFullLowerBoundaryPartition P.coarse e) + (fun y => sourceFullMixedDefect P A e y ^ 2) + (orderedFaceTuple e.face A.witness) = + conditionalMean + (orderedFullLowerBoundaryPartition P.coarse e) + (P.sourceFullAtomDefectSq e + (P.coarse.partition e.lowerRank.succ e.face) + (A.atom e.lowerRank.succ e.face)) + (orderedFaceTuple e.face A.witness) := by + unfold conditionalMean + apply Finset.expect_congr rfl + intro y hy + rw [sourceFullMixedDefect_eq_orderedAtomBoundaryDefect_of_mem + P A e y hy] + rfl + +namespace ClosedOrderedAtomConfiguration + +def AvoidsSourceFullBadBases + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) : Prop := + ∀ e : PositiveOrderedFace k r, + orderedFaceTuple e.face A.witness ∉ + P.sourceFullCoarseOwnAtomBadBaseSupport e + (α e.rank) (β e.rank) + +theorem sourceFullMixedGoodAtFace_of_not_mem_badBase + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (e : PositiveOrderedFace k r) + (α β : ℝ) + (havoid : + orderedFaceTuple e.face A.witness ∉ + P.sourceFullCoarseOwnAtomBadBaseSupport e α β) : + SourceFullMixedGoodAtFace P A e α β := by + let upper := + P.coarse.partition e.lowerRank.succ e.face + let a : upper.parts := + A.atom e.lowerRank.succ e.face + let x : Fin (e.lowerRank.1 + 1) → G := + orderedFaceTuple e.face A.witness + have hcanonical : + partitionAtomAt upper x = a := by + exact (A.atom_eq_partitionAtomAt + e.lowerRank.succ e.face).symm + have hlocal : + x ∉ P.sourceFullAtomBadBaseSupport + e upper a α β := by + intro hbad + apply havoid + apply + (P.mem_sourceFullCoarseOwnAtomBadBaseSupport + e α β x).2 + change + x ∈ P.sourceFullAtomBadBaseSupport + e upper (partitionAtomAt upper x) α β + rw [hcanonical] + exact hbad + have hlow : + x ∉ + smallAverageBaseSupport + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (partitionAtomIndicator upper a) α := by + intro h + exact hlocal (Finset.mem_union_left _ h) + have hlarge : + x ∉ + P.sourceFullLargeDefectBaseSupport + e upper a β := by + intro h + exact hlocal (Finset.mem_union_right _ h) + constructor + · have hdensity : + α ≤ + conditionalMean + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (partitionAtomIndicator upper a) x := + not_lt.mp fun h => + hlow + ((mem_smallAverageBaseSupport + (orderedBoundaryPartition + (positiveFaceLowerLayer P.coarse e) e.face) + (partitionAtomIndicator upper a) α x).2 h) + simpa [sourceFullMixedCoarseDensity, + mixedConfigurationCoarseDensity, upper, a, x, + orderedBoundaryStructured] using hdensity + · rw [conditionalMean_sourceFullMixedDefect_sq_eq P A e] + have hdefect : + conditionalMean + (orderedFullLowerBoundaryPartition P.coarse e) + (P.sourceFullAtomDefectSq e upper a) x ≤ + β := + not_lt.mp fun h => + hlarge + ((P.mem_sourceFullLargeDefectBaseSupport + e upper a β x).2 h) + simpa [upper, a, x] using hdefect + +theorem isSourceFullMixedGood_of_avoids_badBases + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (A : ClosedOrderedAtomConfiguration G k r P.coarse) + (α β : ℕ → ℝ) + (havoid : A.AvoidsSourceFullBadBases P α β) : + A.IsSourceFullMixedGood P α β := by + intro e + exact + A.sourceFullMixedGoodAtFace_of_not_mem_badBase + P e (α e.rank) (β e.rank) (havoid e) + +end ClosedOrderedAtomConfiguration + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +namespace OrderedCoarseFineComplex + +noncomputable def sourceFullTopBadBaseDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : OrderedFace k r) + (α β : ℕ → ℝ) : + Finset (Fin r → G) := by + classical + exact + (Finset.univ : + Finset (OrderedPositiveSubface r)).biUnion fun q => + orderedFacePullbackFinset q.2 + (P.sourceFullCoarseOwnAtomBadBaseSupport + ({ lowerRank := q.1 + face := q.2.trans e } : PositiveOrderedFace k r) + (α (q.1.1 + 1)) + (β (q.1.1 + 1))) + +noncomputable def sourceFullBadBaseDeletionFamily + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (α β : ℕ → ℝ) : + OrderedPattern.DeletionFamily (G := G) k r := + fun e => P.sourceFullTopBadBaseDeletion e α β + +theorem mean_indicator_sourceFullTopBadBaseDeletion_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (e : OrderedFace k r) + (α β : ℕ → ℝ) + (hα : ∀ j, 0 ≤ α (j + 1)) + (hβ : ∀ j, 0 < β (j + 1)) : + mean (finsetIndicator + (P.sourceFullTopBadBaseDeletion e α β)) ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap + q.1 (q.2.trans e) / + β (q.1.1 + 1)) := by + calc + mean (finsetIndicator + (P.sourceFullTopBadBaseDeletion e α β)) ≤ + ∑ q : OrderedPositiveSubface r, + mean (finsetIndicator + (orderedFacePullbackFinset q.2 + (P.sourceFullCoarseOwnAtomBadBaseSupport + ({ lowerRank := q.1 + face := q.2.trans e } : + PositiveOrderedFace k r) + (α (q.1.1 + 1)) + (β (q.1.1 + 1))))) := by + exact + mean_finsetIndicator_biUnion_le_sum + (Finset.univ : Finset (OrderedPositiveSubface r)) + (fun q => + orderedFacePullbackFinset q.2 + (P.sourceFullCoarseOwnAtomBadBaseSupport + ({ lowerRank := q.1 + face := q.2.trans e } : + PositiveOrderedFace k r) + (α (q.1.1 + 1)) + (β (q.1.1 + 1)))) + _ ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap + q.1 (q.2.trans e) / + β (q.1.1 + 1)) := by + apply Finset.sum_le_sum + intro q _hq + rw [mean_indicator_orderedFacePullbackFinset] + exact + P.mean_indicator_sourceFullCoarseOwnAtomBadBaseSupport_le + ({ lowerRank := q.1 + face := q.2.trans e } : PositiveOrderedFace k r) + (hα q.1.1) (hβ q.1.1) + +theorem faceDeletionDensity_sourceFullBadBaseDeletionFamily_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (α β : ℕ → ℝ) + (hα : ∀ j, 0 ≤ α (j + 1)) + (hβ : ∀ j, 0 < β (j + 1)) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (P.sourceFullBadBaseDeletionFamily α β) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap + q.1 (q.2.trans e) / + β (q.1.1 + 1)) := by + rw [show + OrderedPattern.faceDeletionDensity + (P.sourceFullBadBaseDeletionFamily α β) e = + mean (finsetIndicator + (P.sourceFullTopBadBaseDeletion e α β)) by + unfold OrderedPattern.faceDeletionDensity + sourceFullBadBaseDeletionFamily + rw [mean_finsetIndicator]] + exact + P.mean_indicator_sourceFullTopBadBaseDeletion_le + e α β hα hβ + +theorem faceDeletionDensity_sourceFullBadBaseDeletionFamily_le_fineGap + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) + (α β : ℕ → ℝ) + (hα : ∀ j, 0 ≤ α (j + 1)) + (hβ : ∀ j, 0 < β (j + 1)) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (P.sourceFullBadBaseDeletionFamily α β) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + ((FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + P.faceAtomEnergyGap q.1 (q.2.trans e)) / + β (q.1.1 + 1)) := by + calc + OrderedPattern.faceDeletionDensity + (P.sourceFullBadBaseDeletionFamily α β) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + P.coarseUpperFaceAtomEnergyGap + q.1 (q.2.trans e) / + β (q.1.1 + 1)) := + P.faceDeletionDensity_sourceFullBadBaseDeletionFamily_le + α β hα hβ e + _ ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * + α (q.1.1 + 1) + + ((FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + P.faceAtomEnergyGap q.1 (q.2.trans e)) / + β (q.1.1 + 1)) := by + apply Finset.sum_le_sum + intro q _hq + exact add_le_add + (le_refl _) + (div_le_div_of_nonneg_right + (P.coarseUpperFaceAtomEnergyGap_le + q.1 (q.2.trans e)) + (hβ q.1.1).le) + +theorem faceDeletionDensity_sourceFullBadBaseDeletionFamily_constant_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r coarseBound fineBound : ℕ} + (P : OrderedCoarseFineComplex G k r) + (hcoarse : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (P.coarse.partition j e) ≤ coarseBound) + (hfine : + ∀ (j : Fin (r + 1)) (e : OrderedFace k j.1), + FacePartition.complexity + (P.fine.partition j e) ≤ fineBound) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (P.sourceFullBadBaseDeletionFamily + (fun _ => α) (fun _ => β)) e ≤ + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + ((coarseBound : ℝ) * α + + (fineBound : ℝ) * P.totalAtomEnergyGap / β) := by + calc + OrderedPattern.faceDeletionDensity + (P.sourceFullBadBaseDeletionFamily + (fun _ => α) (fun _ => β)) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (P.coarse.partition q.1.succ + (q.2.trans e)) : ℝ) * α + + ((FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + P.faceAtomEnergyGap q.1 (q.2.trans e)) / β) := by + exact + P.faceDeletionDensity_sourceFullBadBaseDeletionFamily_le_fineGap + (fun _ => α) (fun _ => β) + (fun _ => hα) (fun _ => hβ) e + _ ≤ + ∑ _q : OrderedPositiveSubface r, + ((coarseBound : ℝ) * α + + (fineBound : ℝ) * P.totalAtomEnergyGap / β) := by + apply Finset.sum_le_sum + intro q _hq + apply add_le_add + · exact mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr + (hcoarse q.1.succ (q.2.trans e))) + hα + · apply div_le_div_of_nonneg_right _ hβ.le + calc + (FacePartition.complexity + (P.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * + P.faceAtomEnergyGap q.1 (q.2.trans e) ≤ + (fineBound : ℝ) * + P.faceAtomEnergyGap q.1 (q.2.trans e) := + mul_le_mul_of_nonneg_right + (Nat.cast_le.mpr + (hfine q.1.succ (q.2.trans e))) + (P.faceAtomEnergyGap_nonneg + q.1 (q.2.trans e)) + _ ≤ + (fineBound : ℝ) * P.totalAtomEnergyGap := + mul_le_mul_of_nonneg_left + (P.faceAtomEnergyGap_le_total + q.1 (q.2.trans e)) + (Nat.cast_nonneg fineBound) + _ = + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + ((coarseBound : ℝ) * α + + (fineBound : ℝ) * P.totalAtomEnergyGap / β) := by + simp only [Finset.sum_const, Finset.card_univ, + nsmul_eq_mul] + +end OrderedCoarseFineComplex + +namespace ClosedOrderedAtomConfiguration + +theorem isSourceFullMixedGood_of_avoids_sourceFullTopBadBaseDeletion + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} (hrk : r ≤ k) + (P : OrderedCoarseFineComplex G k r) + (x : Fin k → G) (α β : ℕ → ℝ) + (havoid : + ∀ e : OrderedFace k r, + orderedFaceTuple e x ∉ + P.sourceFullTopBadBaseDeletion e α β) : + (ClosedOrderedAtomConfiguration.ofTuple + P.coarse x).IsSourceFullMixedGood P α β := by + apply + (ClosedOrderedAtomConfiguration.ofTuple + P.coarse x).isSourceFullMixedGood_of_avoids_badBases + P α β + intro f hbad + obtain ⟨e, d, hde⟩ := + exists_orderedFace_factor_through + (Nat.succ_le_iff.mpr f.lowerRank.2) hrk f.face + apply havoid e + rw [OrderedCoarseFineComplex.sourceFullTopBadBaseDeletion] + apply Finset.mem_biUnion.mpr + refine ⟨⟨f.lowerRank, d⟩, Finset.mem_univ _, ?_⟩ + rw [mem_orderedFacePullbackFinset] + change + orderedFaceTuple (d.trans e) x ∈ + P.sourceFullCoarseOwnAtomBadBaseSupport + ({ lowerRank := f.lowerRank + face := d.trans e } : PositiveOrderedFace k r) + (α (f.lowerRank.1 + 1)) + (β (f.lowerRank.1 + 1)) + rw [hde] + exact hbad + +end ClosedOrderedAtomConfiguration + +theorem sourceFullBadBaseDeletionFamily_isCover_of_sourceFullMixedGood_count + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k n : ℕ} (hrk : n + 1 ≤ k) + (H : OrderedPattern G k (n + 1)) + (P : OrderedCoarseFineComplex G k (n + 1)) + (hinitial : + P.coarse.Refines (orderedPatternInitialComplex H)) + (α β : ℕ → ℝ) (c : ℝ) + (hcount : H.toWeighted.patternCount < c) + (hgoodCount : + ∀ A : ClosedOrderedAtomConfiguration + G k (n + 1) P.coarse, + A.IsSourceFullMixedGood P α β → + c ≤ fullConfigurationCount A) : + H.IsCover + (P.sourceFullBadBaseDeletionFamily α β) := by + intro x hx + by_contra hsurvives + push Not at hsurvives + let A : + ClosedOrderedAtomConfiguration + G k (n + 1) P.coarse := + ClosedOrderedAtomConfiguration.ofTuple P.coarse x + have hgood : A.IsSourceFullMixedGood P α β := by + exact + ClosedOrderedAtomConfiguration.isSourceFullMixedGood_of_avoids_sourceFullTopBadBaseDeletion + hrk P x α β hsurvives + have hcA : c ≤ fullConfigurationCount A := + hgoodCount A hgood + have htop : + OrderedFacePartitionRefines P.coarse.topLayer + (orderedPatternTopPartition H) := + orderedPatternTopPartition_refines_of_complex_refines_initial + H hinitial + have hAH : + fullConfigurationCount A ≤ + H.toWeighted.patternCount := + fullConfigurationCount_le_patternCount + H htop A ((H.mem_occurrenceFinset x).1 hx) + linarith + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/StrongFullOrderedRegularity.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/StrongFullOrderedRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..50370c46ca5a0a14b7c88c1bb80ceddd979aec76 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/StrongFullOrderedRegularity.lean @@ -0,0 +1,667 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedPatternPartition + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def IsFullyPreliminaryOrderedBoundedRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (ε : OrderedRegularityTolerance r) : Prop := + ∀ j : Fin r, + IsPreliminaryOrderedBoundedRegular + (C.partition j.castSucc) + (C.partition j.succ) + (ε j) + +theorem IsFullyPreliminaryOrderedRegular.toBounded + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {C : OrderedPartitionComplex G k r} + {ε : OrderedRegularityTolerance r} + (h : IsFullyPreliminaryOrderedRegular C ε) : + IsFullyPreliminaryOrderedBoundedRegular C ε := by + intro j + exact (h j).toBounded + +noncomputable def chosenFullOrderedRegularityCertificate + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) + (ε : OrderedRegularityTolerance r) + (budget : OrderedRegularityBudget r) + (hε : ∀ j, 0 ≤ ε j) + (hbudget : + IsOrderedRegularityBudget k r ε budget) : + FullOrderedRegularityCertificate C ε budget := + Classical.choice + (exists_fullOrderedRegularityCertificate + C ε budget hε hbudget) + +noncomputable def strongFullOrderedRegularityTower + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) : + ℕ → OrderedPartitionComplex G k r + | 0 => initial + | n + 1 => + (chosenFullOrderedRegularityCertificate + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) + (ε n) (budget n) (hε n) (hbudget n)).fine + +@[simp] +theorem strongFullOrderedRegularityTower_zero + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) : + strongFullOrderedRegularityTower + initial ε budget hε hbudget 0 = initial := + rfl + +@[simp] +theorem strongFullOrderedRegularityTower_succ + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + (n : ℕ) : + strongFullOrderedRegularityTower + initial ε budget hε hbudget (n + 1) = + (chosenFullOrderedRegularityCertificate + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) + (ε n) (budget n) (hε n) (hbudget n)).fine := + rfl + +noncomputable def strongFullOrderedRegularityStepSchedule + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + (n : ℕ) : + OrderedRegularityStepSchedule r := + (chosenFullOrderedRegularityCertificate + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) + (ε n) (budget n) (hε n) (hbudget n)).steps + +theorem strongFullOrderedRegularityTower_refines + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + (n : ℕ) : + (strongFullOrderedRegularityTower + initial ε budget hε hbudget (n + 1)).Refines + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) := by + rw [strongFullOrderedRegularityTower_succ] + exact + (chosenFullOrderedRegularityCertificate + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) + (ε n) (budget n) (hε n) (hbudget n)).refines + +theorem strongFullOrderedRegularityTower_topLayer_succ + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + (n : ℕ) : + (strongFullOrderedRegularityTower + initial ε budget hε hbudget (n + 1)).topLayer = + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n).topLayer := by + rw [strongFullOrderedRegularityTower_succ] + exact + (chosenFullOrderedRegularityCertificate + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) + (ε n) (budget n) (hε n) (hbudget n)).topLayer_eq + +theorem strongFullOrderedRegularityTower_topLayer + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) : + ∀ n, + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n).topLayer = + initial.topLayer := by + intro n + induction n with + | zero => rfl + | succ n ih => + rw [strongFullOrderedRegularityTower_topLayer_succ] + exact ih + +theorem strongFullOrderedRegularityTower_regular + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + (n : ℕ) : + IsFullyPreliminaryOrderedRegular + (strongFullOrderedRegularityTower + initial ε budget hε hbudget (n + 1)) + (ε n) := by + rw [strongFullOrderedRegularityTower_succ] + exact + (chosenFullOrderedRegularityCertificate + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) + (ε n) (budget n) (hε n) (hbudget n)).regular + +theorem strongFullOrderedRegularityTower_boundedRegular + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + (n : ℕ) : + IsFullyPreliminaryOrderedBoundedRegular + (strongFullOrderedRegularityTower + initial ε budget hε hbudget (n + 1)) + (ε n) := + (strongFullOrderedRegularityTower_regular + initial ε budget hε hbudget n).toBounded + +theorem strongFullOrderedRegularityStepSchedule_lt + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + (n : ℕ) (j : Fin r) : + strongFullOrderedRegularityStepSchedule + initial ε budget hε hbudget n j < + budget n j := + (chosenFullOrderedRegularityCertificate + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) + (ε n) (budget n) (hε n) (hbudget n)).steps_lt j + +def strongFullOrderedComplexityFactor + {r : ℕ} + (budget : ℕ → OrderedRegularityBudget r) + (j : Fin r) : ℕ → ℕ + | 0 => 1 + | n + 1 => + (2 ^ (j.1 + 1)) ^ (budget n j) * + strongFullOrderedComplexityFactor budget j n + +@[simp] +theorem strongFullOrderedComplexityFactor_zero + {r : ℕ} + (budget : ℕ → OrderedRegularityBudget r) + (j : Fin r) : + strongFullOrderedComplexityFactor budget j 0 = 1 := + rfl + +@[simp] +theorem strongFullOrderedComplexityFactor_succ + {r : ℕ} + (budget : ℕ → OrderedRegularityBudget r) + (j : Fin r) (n : ℕ) : + strongFullOrderedComplexityFactor budget j (n + 1) = + (2 ^ (j.1 + 1)) ^ (budget n j) * + strongFullOrderedComplexityFactor budget j n := + rfl + +theorem complexity_strongFullOrderedRegularityTower_succ_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + (n : ℕ) (j : Fin r) + (e : OrderedFace k j.1) : + FacePartition.complexity + ((strongFullOrderedRegularityTower + initial ε budget hε hbudget (n + 1)).partition + j.castSucc e) ≤ + (2 ^ (j.1 + 1)) ^ (budget n j) * + FacePartition.complexity + ((strongFullOrderedRegularityTower + initial ε budget hε hbudget n).partition + j.castSucc e) := by + let certificate := + chosenFullOrderedRegularityCertificate + (strongFullOrderedRegularityTower + initial ε budget hε hbudget n) + (ε n) (budget n) (hε n) (hbudget n) + have hchosen := certificate.complexity j e + have hexponent : + (2 ^ (j.1 + 1)) ^ (certificate.steps j) ≤ + (2 ^ (j.1 + 1)) ^ (budget n j) := + Nat.pow_le_pow_right (by positivity) + (Nat.le_of_lt (certificate.steps_lt j)) + rw [strongFullOrderedRegularityTower_succ] + exact hchosen.trans + (Nat.mul_le_mul_right _ hexponent) + +theorem complexity_strongFullOrderedRegularityTower_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) : + ∀ (n : ℕ) (j : Fin r) + (e : OrderedFace k j.1), + FacePartition.complexity + ((strongFullOrderedRegularityTower + initial ε budget hε hbudget n).partition + j.castSucc e) ≤ + strongFullOrderedComplexityFactor + budget j n * + FacePartition.complexity + (initial.partition j.castSucc e) := by + intro n + induction n with + | zero => + intro j e + simp + | succ n ih => + intro j e + calc + FacePartition.complexity + ((strongFullOrderedRegularityTower + initial ε budget hε hbudget (n + 1)).partition + j.castSucc e) ≤ + (2 ^ (j.1 + 1)) ^ (budget n j) * + FacePartition.complexity + ((strongFullOrderedRegularityTower + initial ε budget hε hbudget n).partition + j.castSucc e) := + complexity_strongFullOrderedRegularityTower_succ_le + initial ε budget hε hbudget n j e + _ ≤ + (2 ^ (j.1 + 1)) ^ (budget n j) * + (strongFullOrderedComplexityFactor + budget j n * + FacePartition.complexity + (initial.partition j.castSucc e)) := + Nat.mul_le_mul_left _ (ih j e) + _ = + strongFullOrderedComplexityFactor + budget j (n + 1) * + FacePartition.complexity + (initial.partition j.castSucc e) := by + simp [Nat.mul_assoc] + +noncomputable def orderedAllRankAtomEnergyBudget + (k r : ℕ) : ℝ := + ∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) + +noncomputable def orderedFixedTargetAtomEnergy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (lower target : OrderedPartitionComplex G k r) : ℝ := + ∑ j : Fin r, + orderedLayerAtomEnergy + (lower.partition j.castSucc) + (target.partition j.succ) + +theorem orderedFixedTargetAtomEnergy_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (lower target : OrderedPartitionComplex G k r) : + 0 ≤ orderedFixedTargetAtomEnergy lower target := by + unfold orderedFixedTargetAtomEnergy + exact Finset.sum_nonneg fun j _ => + orderedLayerAtomEnergy_nonneg + (lower.partition j.castSucc) + (target.partition j.succ) + +theorem orderedFixedTargetAtomEnergy_le_budget + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (lower target : OrderedPartitionComplex G k r) : + orderedFixedTargetAtomEnergy lower target ≤ + orderedAllRankAtomEnergyBudget k r := by + unfold orderedFixedTargetAtomEnergy + orderedAllRankAtomEnergyBudget + exact Finset.sum_le_sum fun j _ => + orderedLayerAtomEnergy_le_card + (lower.partition j.castSucc) + (target.partition j.succ) + +theorem orderedFixedTargetAtomEnergy_mono + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {fine coarse target : + OrderedPartitionComplex G k r} + (hfc : fine.Refines coarse) : + orderedFixedTargetAtomEnergy coarse target ≤ + orderedFixedTargetAtomEnergy fine target := by + unfold orderedFixedTargetAtomEnergy + apply Finset.sum_le_sum + intro j _ + exact orderedLayerAtomEnergy_mono + (fun e => hfc j.castSucc e) + (target.partition j.succ) + +noncomputable def orderedFixedTargetAtomEnergyGap + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (target fine coarse : + OrderedPartitionComplex G k r) : ℝ := + orderedFixedTargetAtomEnergy fine target - + orderedFixedTargetAtomEnergy coarse target + +theorem orderedFixedTargetAtomEnergyGap_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {target fine coarse : + OrderedPartitionComplex G k r} + (hfc : fine.Refines coarse) : + 0 ≤ orderedFixedTargetAtomEnergyGap + target fine coarse := + sub_nonneg.mpr + (orderedFixedTargetAtomEnergy_mono hfc) + +theorem exists_adjacent_fixedTargetAtomEnergyGap_le_div + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (tower : ℕ → OrderedPartitionComplex G k r) + (target : OrderedPartitionComplex G k r) + (hnested : ∀ n, (tower (n + 1)).Refines (tower n)) + {m : ℕ} (hm : 0 < m) : + ∃ i : ℕ, i < m ∧ + 0 ≤ orderedFixedTargetAtomEnergyGap + target (tower (i + 1)) (tower i) ∧ + orderedFixedTargetAtomEnergyGap + target (tower (i + 1)) (tower i) ≤ + orderedAllRankAtomEnergyBudget k r / + (m : ℝ) := by + let E : ℕ → ℝ := + fun n => orderedFixedTargetAtomEnergy + (tower n) target + have htel : + ∑ i ∈ Finset.range m, + (E (i + 1) - E i) = + E m - E 0 := + Finset.sum_range_sub E m + have hsum : + ∑ i ∈ Finset.range m, + (E (i + 1) - E i) ≤ + ∑ _i ∈ Finset.range m, + orderedAllRankAtomEnergyBudget k r / + (m : ℝ) := by + rw [htel] + calc + E m - E 0 ≤ + orderedAllRankAtomEnergyBudget k r := by + have h0 := + orderedFixedTargetAtomEnergy_nonneg + (tower 0) target + have hmBound := + orderedFixedTargetAtomEnergy_le_budget + (tower m) target + dsimp only [E] at h0 hmBound ⊢ + linarith + _ = + ∑ _i ∈ Finset.range m, + orderedAllRankAtomEnergyBudget k r / + (m : ℝ) := by + simp only [Finset.sum_const, + Finset.card_range, nsmul_eq_mul] + field_simp + obtain ⟨i, hi, hsmall⟩ := + Finset.exists_le_of_sum_le + ⟨0, Finset.mem_range.mpr hm⟩ hsum + refine ⟨i, Finset.mem_range.mp hi, ?_, ?_⟩ + · exact orderedFixedTargetAtomEnergyGap_nonneg + (hnested i) + · exact hsmall + +theorem exists_strongFullOrdered_fixedTarget_pair + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial target : OrderedPartitionComplex G k r) + (ε : ℕ → OrderedRegularityTolerance r) + (budget : ℕ → OrderedRegularityBudget r) + (hε : ∀ n j, 0 ≤ ε n j) + (hbudget : + ∀ n, IsOrderedRegularityBudget + k r (ε n) (budget n)) + {m : ℕ} (hm : 0 < m) : + ∃ i : ℕ, i < m ∧ + let coarse := + strongFullOrderedRegularityTower + initial ε budget hε hbudget i + let fine := + strongFullOrderedRegularityTower + initial ε budget hε hbudget (i + 1) + fine.Refines coarse ∧ + IsFullyPreliminaryOrderedBoundedRegular + fine (ε i) ∧ + 0 ≤ orderedFixedTargetAtomEnergyGap + target fine coarse ∧ + orderedFixedTargetAtomEnergyGap + target fine coarse ≤ + orderedAllRankAtomEnergyBudget k r / + (m : ℝ) ∧ + ∀ (j : Fin r) (e : OrderedFace k j.1), + FacePartition.complexity + (fine.partition j.castSucc e) ≤ + strongFullOrderedComplexityFactor + budget j (i + 1) * + FacePartition.complexity + (initial.partition j.castSucc e) := by + let tower := + strongFullOrderedRegularityTower + initial ε budget hε hbudget + obtain ⟨i, hi, hgap0, hgap⟩ := + exists_adjacent_fixedTargetAtomEnergyGap_le_div + tower target + (strongFullOrderedRegularityTower_refines + initial ε budget hε hbudget) + hm + refine ⟨i, hi, ?_, ?_, hgap0, hgap, ?_⟩ + · exact strongFullOrderedRegularityTower_refines + initial ε budget hε hbudget i + · exact strongFullOrderedRegularityTower_boundedRegular + initial ε budget hε hbudget i + · exact complexity_strongFullOrderedRegularityTower_le + initial ε budget hε hbudget (i + 1) + +noncomputable def orderedMovingAtomEnergy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) : ℝ := + orderedFixedTargetAtomEnergy C C + +noncomputable def orderedUpperRefinementAtomEnergyLoss + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) : ℝ := + orderedFixedTargetAtomEnergy coarse coarse - + orderedFixedTargetAtomEnergy coarse fine + +theorem totalAtomEnergyGap_eq_fixedTarget + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : + P.totalAtomEnergyGap = + orderedFixedTargetAtomEnergyGap + P.fine P.fine P.coarse := by + unfold OrderedCoarseFineComplex.totalAtomEnergyGap + OrderedCoarseFineComplex.layerAtomEnergyGap + orderedFixedTargetAtomEnergyGap + orderedFixedTargetAtomEnergy + rw [Finset.sum_sub_distrib] + +theorem totalAtomEnergyGap_eq_moving_sub_add_upperLoss + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : + P.totalAtomEnergyGap = + orderedMovingAtomEnergy P.fine - + orderedMovingAtomEnergy P.coarse + + orderedUpperRefinementAtomEnergyLoss + P.fine P.coarse := by + rw [totalAtomEnergyGap_eq_fixedTarget] + unfold orderedFixedTargetAtomEnergyGap + orderedMovingAtomEnergy + orderedUpperRefinementAtomEnergyLoss + ring + +theorem orderedUpperRefinementAtomEnergyLoss_le_budget + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) : + orderedUpperRefinementAtomEnergyLoss fine coarse ≤ + orderedAllRankAtomEnergyBudget k r := by + have hleft := + orderedFixedTargetAtomEnergy_le_budget + coarse coarse + have hright := + orderedFixedTargetAtomEnergy_nonneg + coarse fine + unfold orderedUpperRefinementAtomEnergyLoss + linarith + +theorem one_le_facePartition_complexity + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] [Nonempty Ω] + (P : FacePartition Ω) : + 1 ≤ FacePartition.complexity P := by + unfold FacePartition.complexity + exact Finset.card_pos.mpr + (P.parts_nonempty + Finset.univ_nonempty.ne_empty) + +noncomputable def orderedAllRankUpperComplexity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) : ℝ := + ∑ j : Fin r, + ∑ e : OrderedFace k (j.1 + 1), + (FacePartition.complexity + (C.partition j.succ e) : ℝ) + +theorem orderedAllRankAtomEnergyBudget_le_upperComplexity + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (C : OrderedPartitionComplex G k r) : + orderedAllRankAtomEnergyBudget k r ≤ + orderedAllRankUpperComplexity C := by + unfold orderedAllRankAtomEnergyBudget + orderedAllRankUpperComplexity + apply Finset.sum_le_sum + intro j _ + calc + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) = + ∑ _e : OrderedFace k (j.1 + 1), + (1 : ℝ) := by simp + _ ≤ + ∑ e : OrderedFace k (j.1 + 1), + (FacePartition.complexity + (C.partition j.succ e) : ℝ) := by + apply Finset.sum_le_sum + intro e _ + exact_mod_cast + one_le_facePartition_complexity + (C.partition j.succ e) + +theorem orderedUpperRefinementAtomEnergyLoss_le_upperComplexity + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (fine coarse : OrderedPartitionComplex G k r) : + orderedUpperRefinementAtomEnergyLoss fine coarse ≤ + orderedAllRankUpperComplexity fine := + (orderedUpperRefinementAtomEnergyLoss_le_budget + fine coarse).trans + (orderedAllRankAtomEnergyBudget_le_upperComplexity + fine) + +theorem totalAtomEnergyGap_le_moving_sub_add_budget + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (P : OrderedCoarseFineComplex G k r) : + P.totalAtomEnergyGap ≤ + orderedMovingAtomEnergy P.fine - + orderedMovingAtomEnergy P.coarse + + orderedAllRankAtomEnergyBudget k r := by + have hidentity := + totalAtomEnergyGap_eq_moving_sub_add_upperLoss P + have hloss : + orderedUpperRefinementAtomEnergyLoss + P.fine P.coarse ≤ + orderedAllRankAtomEnergyBudget k r := + orderedUpperRefinementAtomEnergyLoss_le_budget + P.fine P.coarse + linarith + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/StrongOrderedComplexRegularity.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/StrongOrderedComplexRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..48fb71dc30bf6262589e8fae49aa85f314d4aff5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/StrongOrderedComplexRegularity.lean @@ -0,0 +1,1406 @@ +import OAI.Combinatorics.Progressions.FixedDensity.CoarseOrderedRemoval +import OAI.Combinatorics.Progressions.FixedDensity.StrongFullOrderedRegularity + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +structure FixedUpperLayerRegularityCertificate + (G : Type*) [Fintype G] [DecidableEq G] + (k j : ℕ) + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) (budget : ℕ) where + steps : ℕ + fine : OrderedFacePartitionSystem G k j + steps_lt : steps < budget + refines : OrderedFacePartitionRefines fine lower + regular : IsPreliminaryOrderedRegular fine upper ε + complexity : + ∀ e, + FacePartition.complexity (fine e) ≤ + (2 ^ (j + 1)) ^ steps * + FacePartition.complexity (lower e) + +theorem FixedUpperLayerRegularityCertificate.nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + {ε : ℝ} {budget : ℕ} + (hε : 0 ≤ ε) + (hlong : + (Fintype.card (OrderedFace k (j + 1)) : ℝ) < + (budget : ℝ) * ε ^ 2) : + Nonempty + (FixedUpperLayerRegularityCertificate + G k j lower upper ε budget) := by + obtain ⟨steps, fine, hsteps, hrefines, + hregular, hcomplexity⟩ := + exists_preliminaryOrderedRegular_refinement_with_complexity_before + lower upper hε hlong + exact ⟨{ + steps := steps + fine := fine + steps_lt := hsteps + refines := hrefines + regular := hregular + complexity := hcomplexity }⟩ + +noncomputable def chosenFixedUpperLayerRegularityCertificate + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (lower : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℝ) (budget : ℕ) + (hε : 0 ≤ ε) + (hlong : + (Fintype.card (OrderedFace k (j + 1)) : ℝ) < + (budget : ℝ) * ε ^ 2) : + FixedUpperLayerRegularityCertificate + G k j lower upper ε budget := + Classical.choice + (FixedUpperLayerRegularityCertificate.nonempty + lower upper hε hlong) + +noncomputable def fixedUpperLayerRegularityTower + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) : + ℕ → OrderedFacePartitionSystem G k j + | 0 => initial + | n + 1 => + (chosenFixedUpperLayerRegularityCertificate + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n) + upper (ε n) (budget n) + (hε n) (hlong n)).fine + +@[simp] +theorem fixedUpperLayerRegularityTower_zero + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) : + fixedUpperLayerRegularityTower + initial upper ε budget hε hlong 0 = initial := + rfl + +@[simp] +theorem fixedUpperLayerRegularityTower_succ + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) + (n : ℕ) : + fixedUpperLayerRegularityTower + initial upper ε budget hε hlong (n + 1) = + (chosenFixedUpperLayerRegularityCertificate + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n) + upper (ε n) (budget n) + (hε n) (hlong n)).fine := + rfl + +theorem fixedUpperLayerRegularityTower_refines + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) + (n : ℕ) : + OrderedFacePartitionRefines + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong (n + 1)) + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n) := by + rw [fixedUpperLayerRegularityTower_succ] + exact + (chosenFixedUpperLayerRegularityCertificate + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n) + upper (ε n) (budget n) + (hε n) (hlong n)).refines + +theorem fixedUpperLayerRegularityTower_refines_initial + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) : + ∀ n, + OrderedFacePartitionRefines + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n) + initial := by + intro n + induction n with + | zero => + exact OrderedFacePartitionRefines.refl initial + | succ n ih => + exact OrderedFacePartitionRefines.trans + (fixedUpperLayerRegularityTower_refines + initial upper ε budget hε hlong n) + ih + +theorem fixedUpperLayerRegularityTower_regular + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) + (n : ℕ) : + IsPreliminaryOrderedRegular + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong (n + 1)) + upper (ε n) := by + rw [fixedUpperLayerRegularityTower_succ] + exact + (chosenFixedUpperLayerRegularityCertificate + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n) + upper (ε n) (budget n) + (hε n) (hlong n)).regular + +def fixedUpperLayerComplexityFactor + (j : ℕ) (budget : ℕ → ℕ) : ℕ → ℕ + | 0 => 1 + | n + 1 => + (2 ^ (j + 1)) ^ (budget n) * + fixedUpperLayerComplexityFactor j budget n + +theorem complexity_fixedUpperLayerRegularityTower_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) : + ∀ (n : ℕ) (e : OrderedFace k j), + FacePartition.complexity + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n e) ≤ + fixedUpperLayerComplexityFactor j budget n * + FacePartition.complexity (initial e) := by + intro n + induction n with + | zero => + intro e + simp [fixedUpperLayerComplexityFactor] + | succ n ih => + intro e + let certificate := + chosenFixedUpperLayerRegularityCertificate + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n) + upper (ε n) (budget n) + (hε n) (hlong n) + have hstep := certificate.complexity e + have hexponent : + (2 ^ (j + 1)) ^ certificate.steps ≤ + (2 ^ (j + 1)) ^ (budget n) := + Nat.pow_le_pow_right (by positivity) + (Nat.le_of_lt certificate.steps_lt) + rw [fixedUpperLayerRegularityTower_succ] + calc + FacePartition.complexity (certificate.fine e) ≤ + (2 ^ (j + 1)) ^ certificate.steps * + FacePartition.complexity + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n e) := + hstep + _ ≤ + (2 ^ (j + 1)) ^ (budget n) * + FacePartition.complexity + (fixedUpperLayerRegularityTower + initial upper ε budget hε hlong n e) := + Nat.mul_le_mul_right _ hexponent + _ ≤ + (2 ^ (j + 1)) ^ (budget n) * + (fixedUpperLayerComplexityFactor + j budget n * + FacePartition.complexity (initial e)) := + Nat.mul_le_mul_left _ (ih e) + _ = + fixedUpperLayerComplexityFactor + j budget (n + 1) * + FacePartition.complexity (initial e) := by + simp [fixedUpperLayerComplexityFactor, + Nat.mul_assoc] + +structure FixedUpperLayerCoarseFine + (G : Type*) [Fintype G] [DecidableEq G] + (k j : ℕ) + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (length : ℕ) where + index : ℕ + index_lt : index < length + coarse : OrderedFacePartitionSystem G k j + fine : OrderedFacePartitionSystem G k j + refines : OrderedFacePartitionRefines fine coarse + coarse_refines_initial : + OrderedFacePartitionRefines coarse initial + fine_regular : + IsPreliminaryOrderedRegular fine upper (ε index) + gap_nonneg : + 0 ≤ orderedLayerAtomEnergy fine upper - + orderedLayerAtomEnergy coarse upper + gap_le : + orderedLayerAtomEnergy fine upper - + orderedLayerAtomEnergy coarse upper ≤ + (Fintype.card (OrderedFace k (j + 1)) : ℝ) / + (length : ℝ) + coarse_complexity : + ∀ e, + FacePartition.complexity (coarse e) ≤ + fixedUpperLayerComplexityFactor + j budget index * + FacePartition.complexity (initial e) + fine_complexity : + ∀ e, + FacePartition.complexity (fine e) ≤ + fixedUpperLayerComplexityFactor + j budget (index + 1) * + FacePartition.complexity (initial e) + +theorem exists_adjacent_real_sub_le_div + (E : ℕ → ℝ) {length : ℕ} + (hlength : 0 < length) + {B : ℝ} + (hE0 : 0 ≤ E 0) + (hElast : E length ≤ B) : + ∃ i : ℕ, i < length ∧ + E (i + 1) - E i ≤ B / length := by + have htel : + ∑ i ∈ Finset.range length, + (E (i + 1) - E i) = + E length - E 0 := + Finset.sum_range_sub E length + have hsum : + ∑ i ∈ Finset.range length, + (E (i + 1) - E i) ≤ + ∑ _i ∈ Finset.range length, + B / (length : ℝ) := by + rw [htel] + calc + E length - E 0 ≤ B := by linarith + _ = + ∑ _i ∈ Finset.range length, + B / (length : ℝ) := by + simp only [Finset.sum_const, + Finset.card_range, nsmul_eq_mul] + field_simp + obtain ⟨i, hi, hsmall⟩ := + Finset.exists_le_of_sum_le + ⟨0, Finset.mem_range.mpr hlength⟩ hsum + exact ⟨i, Finset.mem_range.mp hi, hsmall⟩ + +theorem FixedUpperLayerCoarseFine.nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) + {length : ℕ} (hlength : 0 < length) : + Nonempty + (FixedUpperLayerCoarseFine + G k j initial upper ε budget length) := by + let tower := + fixedUpperLayerRegularityTower + initial upper ε budget hε hlong + obtain ⟨i, hi, hgap⟩ := + exists_adjacent_real_sub_le_div + (fun n => orderedLayerAtomEnergy + (tower n) upper) + hlength + (orderedLayerAtomEnergy_nonneg + (tower 0) upper) + (orderedLayerAtomEnergy_le_card + (tower length) upper) + refine ⟨{ + index := i + index_lt := hi + coarse := tower i + fine := tower (i + 1) + refines := ?_ + coarse_refines_initial := ?_ + fine_regular := ?_ + gap_nonneg := ?_ + gap_le := hgap + coarse_complexity := ?_ + fine_complexity := ?_ }⟩ + · exact fixedUpperLayerRegularityTower_refines + initial upper ε budget hε hlong i + · exact fixedUpperLayerRegularityTower_refines_initial + initial upper ε budget hε hlong i + · exact fixedUpperLayerRegularityTower_regular + initial upper ε budget hε hlong i + · exact sub_nonneg.mpr + (orderedLayerAtomEnergy_mono + (fixedUpperLayerRegularityTower_refines + initial upper ε budget hε hlong i) + upper) + · exact complexity_fixedUpperLayerRegularityTower_le + initial upper ε budget hε hlong i + · exact complexity_fixedUpperLayerRegularityTower_le + initial upper ε budget hε hlong (i + 1) + +noncomputable def chosenFixedUpperLayerCoarseFine + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k j : ℕ} + (initial : OrderedFacePartitionSystem G k j) + (upper : OrderedFacePartitionSystem G k (j + 1)) + (ε : ℕ → ℝ) (budget : ℕ → ℕ) + (hε : ∀ n, 0 ≤ ε n) + (hlong : + ∀ n, + (Fintype.card + (OrderedFace k (j + 1)) : ℝ) < + (budget n : ℝ) * (ε n) ^ 2) + (length : ℕ) (hlength : 0 < length) : + FixedUpperLayerCoarseFine + G k j initial upper ε budget length := + Classical.choice + (FixedUpperLayerCoarseFine.nonempty + initial upper ε budget hε hlong hlength) + +def selectedOrderedComplexTolerance + {r : ℕ} + (ε : (j : Fin r) → ℕ → ℝ) + (index : Fin r → ℕ) : + OrderedRegularityTolerance r := + fun j => ε j (index j) + +structure StrongOrderedComplexRegularityCertificate + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) + (initial : OrderedPartitionComplex G k r) + (ε : (j : Fin r) → ℕ → ℝ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) where + index : Fin r → ℕ + coarse : OrderedPartitionComplex G k r + fine : OrderedPartitionComplex G k r + refines : fine.Refines coarse + coarse_refines_initial : coarse.Refines initial + coarse_topLayer_eq : + coarse.topLayer = initial.topLayer + fine_topLayer_eq : + fine.topLayer = initial.topLayer + index_lt : ∀ j, index j < length j + regular : + IsFullyPreliminaryOrderedRegular fine + (selectedOrderedComplexTolerance ε index) + gap_nonneg : + ∀ j : Fin r, + 0 ≤ + orderedLayerAtomEnergy + (fine.partition j.castSucc) + (fine.partition j.succ) - + orderedLayerAtomEnergy + (coarse.partition j.castSucc) + (fine.partition j.succ) + gap_le : + ∀ j : Fin r, + orderedLayerAtomEnergy + (fine.partition j.castSucc) + (fine.partition j.succ) - + orderedLayerAtomEnergy + (coarse.partition j.castSucc) + (fine.partition j.succ) ≤ + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ) + coarse_complexity : + ∀ (j : Fin r) (e : OrderedFace k j.1), + FacePartition.complexity + (coarse.partition j.castSucc e) ≤ + fixedUpperLayerComplexityFactor + j.1 (budget j) (index j) * + FacePartition.complexity + (initial.partition j.castSucc e) + fine_complexity : + ∀ (j : Fin r) (e : OrderedFace k j.1), + FacePartition.complexity + (fine.partition j.castSucc e) ≤ + fixedUpperLayerComplexityFactor + j.1 (budget j) (index j + 1) * + FacePartition.complexity + (initial.partition j.castSucc e) + +namespace StrongOrderedComplexRegularityCertificate + +def toCoarseFine + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) : + OrderedCoarseFineComplex G k r where + coarse := R.coarse + fine := R.fine + refines := R.refines + +theorem fine_refines_initial + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) : + R.fine.Refines initial := + OrderedPartitionComplex.Refines.trans + R.refines R.coarse_refines_initial + +theorem boundedRegular + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) : + IsFullyPreliminaryOrderedBoundedRegular R.fine + (selectedOrderedComplexTolerance ε R.index) := + R.regular.toBounded + +end StrongOrderedComplexRegularityCertificate + +theorem StrongOrderedComplexRegularityCertificate.nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : (j : Fin r) → ℕ → ℝ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) + (hε : ∀ j n, 0 ≤ ε j n) + (hlong : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budget j n : ℝ) * (ε j n) ^ 2) + (hlength : ∀ j, 0 < length j) : + Nonempty + (StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) := by + induction r with + | zero => + let index : Fin 0 → ℕ := fun j => Fin.elim0 j + refine ⟨{ + index := index + coarse := initial + fine := initial + refines := + OrderedPartitionComplex.Refines.refl initial + coarse_refines_initial := + OrderedPartitionComplex.Refines.refl initial + coarse_topLayer_eq := rfl + fine_topLayer_eq := rfl + index_lt := ?_ + regular := ?_ + gap_nonneg := ?_ + gap_le := ?_ + coarse_complexity := ?_ + fine_complexity := ?_ }⟩ + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + · intro j + exact Fin.elim0 j + | succ r ih => + let lowerInitial : + OrderedFacePartitionSystem G k r := + initial.dropTop.topLayer + let upper : + OrderedFacePartitionSystem G k (r + 1) := + initial.topLayer + have hεtop : + ∀ n, 0 ≤ ε (Fin.last r) n := + fun n => hε (Fin.last r) n + have hlongTop : + ∀ n, + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) < + (budget (Fin.last r) n : ℝ) * + (ε (Fin.last r) n) ^ 2 := by + intro n + have h := hlong (Fin.last r) n + change + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) < + (budget (Fin.last r) n : ℝ) * + (ε (Fin.last r) n) ^ 2 at h + exact h + let topChoice := + chosenFixedUpperLayerCoarseFine + lowerInitial upper + (ε (Fin.last r)) + (budget (Fin.last r)) + hεtop hlongTop + (length (Fin.last r)) + (hlength (Fin.last r)) + let prepared : + OrderedPartitionComplex G k r := + initial.dropTop.withTopLayer topChoice.fine + let εlower : (j : Fin r) → ℕ → ℝ := + fun j => ε j.castSucc + let budgetLower : (j : Fin r) → ℕ → ℕ := + fun j => budget j.castSucc + let lengthLower : Fin r → ℕ := + fun j => length j.castSucc + have hεlower : + ∀ j n, 0 ≤ εlower j n := + fun j n => hε j.castSucc n + have hlongLower : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budgetLower j n : ℝ) * + (εlower j n) ^ 2 := + fun j n => hlong j.castSucc n + have hlengthLower : + ∀ j, 0 < lengthLower j := + fun j => hlength j.castSucc + obtain ⟨lowerCertificate⟩ := + ih prepared εlower budgetLower lengthLower + hεlower hlongLower hlengthLower + let coarsePrefix : + OrderedPartitionComplex G k r := + lowerCertificate.coarse.withTopLayer + topChoice.coarse + let coarse : + OrderedPartitionComplex G k (r + 1) := + coarsePrefix.appendTop upper + let fine : + OrderedPartitionComplex G k (r + 1) := + lowerCertificate.fine.appendTop upper + let index : Fin (r + 1) → ℕ := + fun j => + Fin.lastCases topChoice.index + lowerCertificate.index j + have hlowerFineTop : + lowerCertificate.fine.topLayer = + topChoice.fine := by + calc + lowerCertificate.fine.topLayer = + prepared.topLayer := + lowerCertificate.fine_topLayer_eq + _ = topChoice.fine := + OrderedPartitionComplex.topLayer_withTopLayer + initial.dropTop topChoice.fine + have hlowerCoarseTop : + lowerCertificate.coarse.topLayer = + topChoice.fine := by + calc + lowerCertificate.coarse.topLayer = + prepared.topLayer := + lowerCertificate.coarse_topLayer_eq + _ = topChoice.fine := + OrderedPartitionComplex.topLayer_withTopLayer + initial.dropTop topChoice.fine + refine ⟨{ + index := index + coarse := coarse + fine := fine + refines := ?_ + coarse_refines_initial := ?_ + coarse_topLayer_eq := ?_ + fine_topLayer_eq := ?_ + index_lt := ?_ + regular := ?_ + gap_nonneg := ?_ + gap_le := ?_ + coarse_complexity := ?_ + fine_complexity := ?_ }⟩ + · have hprefix : + lowerCertificate.fine.Refines + coarsePrefix := by + intro q e + cases q using Fin.lastCases with + | last => + simp only [coarsePrefix, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last] + change OrderedFace k r at e + have heq : + lowerCertificate.fine.partition + (Fin.last r) e = + topChoice.fine e := + congrFun hlowerFineTop e + rw [heq] + exact topChoice.refines e + | cast i => + simp only [coarsePrefix, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc] + exact lowerCertificate.refines + i.castSucc e + exact OrderedPartitionComplex.appendTop_refines + hprefix + (OrderedFacePartitionRefines.refl upper) + · have hprefix : + coarsePrefix.Refines initial.dropTop := by + intro q e + cases q using Fin.lastCases with + | last => + simp only [coarsePrefix, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last] + change OrderedFace k r at e + exact topChoice.coarse_refines_initial e + | cast i => + simp only [coarsePrefix, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc] + have h := + lowerCertificate.coarse_refines_initial + i.castSucc e + simpa only [prepared, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + OrderedPartitionComplex.dropTop] using h + have happend := + OrderedPartitionComplex.appendTop_refines + hprefix + (OrderedFacePartitionRefines.refl upper) + simpa [coarse, upper] using happend + · simp [coarse, upper] + · simp [fine, upper] + · intro q + cases q using Fin.lastCases with + | last => + simpa [index] using topChoice.index_lt + | cast i => + simpa [index, lengthLower] using + lowerCertificate.index_lt i + · intro q + cases q using Fin.lastCases with + | last => + simp only [fine, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + Fin.succ_last, + selectedOrderedComplexTolerance, + index, Fin.lastCases_last] + change + @IsPreliminaryOrderedRegular + G _ _ k r + (lowerCertificate.fine.partition + (Fin.last r)) + upper + (ε (Fin.last r) topChoice.index) + have hregular := topChoice.fine_regular + rw [← hlowerFineTop] at hregular + exact hregular + | cast i => + have hregular := + lowerCertificate.regular i + simp only [fine, + OrderedPartitionComplex.appendTop_partition_castSucc, + Fin.succ_castSucc, + selectedOrderedComplexTolerance, + index, Fin.lastCases_castSucc] + change + @IsPreliminaryOrderedRegular + G _ _ k i.1 + (lowerCertificate.fine.partition + i.castSucc) + (lowerCertificate.fine.partition i.succ) + (ε i.castSucc + (lowerCertificate.index i)) + exact hregular + · intro q + cases q using Fin.lastCases with + | last => + have hgap := topChoice.gap_nonneg + simp only [fine, coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, Fin.succ_last] + change + 0 ≤ + orderedLayerAtomEnergy + lowerCertificate.fine.topLayer upper - + orderedLayerAtomEnergy + topChoice.coarse upper + rw [hlowerFineTop] + exact hgap + | cast i => + have hgap := + lowerCertificate.gap_nonneg i + simp only [fine, coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + Fin.succ_castSucc] + convert hgap using 1 + · intro q + cases q using Fin.lastCases with + | last => + have hgap := topChoice.gap_le + simp only [fine, coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.appendTop_partition_last, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, Fin.succ_last] + change + orderedLayerAtomEnergy + lowerCertificate.fine.topLayer upper - + orderedLayerAtomEnergy + topChoice.coarse upper ≤ + (Fintype.card + (OrderedFace k (r + 1)) : ℝ) / + (length (Fin.last r) : ℝ) + rw [hlowerFineTop] + exact hgap + | cast i => + have hgap := + lowerCertificate.gap_le i + simp only [fine, coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + Fin.succ_castSucc, lengthLower] + convert hgap using 1; rfl + · intro q + cases q using Fin.lastCases with + | last => + intro e + have hcomplexity := + topChoice.coarse_complexity e + simp only [coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_last, + index, Fin.lastCases_last] + change OrderedFace k r at e + change + FacePartition.complexity + (topChoice.coarse e) ≤ + fixedUpperLayerComplexityFactor + r (budget (Fin.last r)) + topChoice.index * + FacePartition.complexity + (initial.partition + (Fin.last r).castSucc e) + exact hcomplexity + | cast i => + intro e + change OrderedFace k i.1 at e + have hcomplexity := + lowerCertificate.coarse_complexity i e + simp only [coarse, coarsePrefix, + OrderedPartitionComplex.appendTop_partition_castSucc, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + index, Fin.lastCases_castSucc] + change + FacePartition.complexity + (lowerCertificate.coarse.partition + i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (budget i.castSucc) + (lowerCertificate.index i) * + FacePartition.complexity + (initial.partition + i.castSucc.castSucc e) + simp only [budgetLower, prepared, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + OrderedPartitionComplex.dropTop] at hcomplexity + convert hcomplexity using 1 + · intro q + cases q using Fin.lastCases with + | last => + intro e + change OrderedFace k r at e + have hcomplexity := + topChoice.fine_complexity e + simp only [fine, + OrderedPartitionComplex.appendTop_partition_castSucc, + index, Fin.lastCases_last] + change + FacePartition.complexity + (lowerCertificate.fine.partition + (Fin.last r) e) ≤ + fixedUpperLayerComplexityFactor + r (budget (Fin.last r)) + (topChoice.index + 1) * + FacePartition.complexity + (initial.partition + (Fin.last r).castSucc e) + have heq : + lowerCertificate.fine.partition + (Fin.last r) e = + topChoice.fine e := + congrFun hlowerFineTop e + rw [heq] + exact hcomplexity + | cast i => + intro e + change OrderedFace k i.1 at e + have hcomplexity := + lowerCertificate.fine_complexity i e + simp only [fine, + OrderedPartitionComplex.appendTop_partition_castSucc, + index, Fin.lastCases_castSucc] + change + FacePartition.complexity + (lowerCertificate.fine.partition + i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (budget i.castSucc) + (lowerCertificate.index i + 1) * + FacePartition.complexity + (initial.partition + i.castSucc.castSucc e) + simp only [budgetLower, prepared, + OrderedPartitionComplex.withTopLayer, + Fin.lastCases_castSucc, + OrderedPartitionComplex.dropTop] at hcomplexity + convert hcomplexity using 1 + +namespace StrongOrderedComplexRegularityCertificate + +theorem totalAtomEnergyGap_le_sum_div + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) : + R.toCoarseFine.totalAtomEnergyGap ≤ + ∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ) := by + unfold OrderedCoarseFineComplex.totalAtomEnergyGap + OrderedCoarseFineComplex.layerAtomEnergyGap + toCoarseFine + exact Finset.sum_le_sum fun j _ => R.gap_le j + +theorem totalAtomEnergyGap_nonneg + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) : + 0 ≤ R.toCoarseFine.totalAtomEnergyGap := + R.toCoarseFine.totalAtomEnergyGap_nonneg + +theorem sum_faceAtomEnergyGap_trans_le_layer + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (e : OrderedFace k r) (j : Fin r) : + (∑ d : OrderedFace r (j.1 + 1), + R.toCoarseFine.faceAtomEnergyGap + j (d.trans e)) ≤ + R.toCoarseFine.layerAtomEnergyGap j := by + classical + rw [R.toCoarseFine.layerAtomEnergyGap_eq_sum_face j] + let φ : OrderedFace r (j.1 + 1) → + OrderedFace k (j.1 + 1) := + fun d => d.trans e + have hφ : Function.Injective φ := by + intro d₁ d₂ h + ext i + exact congrArg Fin.val + (e.injective + (congrArg + (fun f : OrderedFace k (j.1 + 1) => f i) h)) + calc + (∑ d : OrderedFace r (j.1 + 1), + R.toCoarseFine.faceAtomEnergyGap j (φ d)) = + ∑ f ∈ + (Finset.univ : + Finset (OrderedFace r (j.1 + 1))).image φ, + R.toCoarseFine.faceAtomEnergyGap j f := by + rw [Finset.sum_image hφ.injOn] + _ ≤ + ∑ f : OrderedFace k (j.1 + 1), + R.toCoarseFine.faceAtomEnergyGap j f := by + exact + Finset.sum_le_sum_of_subset_of_nonneg + (Finset.subset_univ _) + (fun f _ _ => + R.toCoarseFine.faceAtomEnergyGap_nonneg j f) + +theorem sum_faceAtomEnergyGap_trans_le_total + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (e : OrderedFace k r) : + (∑ q : OrderedPositiveSubface r, + R.toCoarseFine.faceAtomEnergyGap + q.1 (q.2.trans e)) ≤ + R.toCoarseFine.totalAtomEnergyGap := by + unfold OrderedCoarseFineComplex.totalAtomEnergyGap + let E := + Equiv.psigmaEquivSigma + (fun j : Fin r => OrderedFace r (j.1 + 1)) + calc + (∑ q : OrderedPositiveSubface r, + R.toCoarseFine.faceAtomEnergyGap + q.1 (q.2.trans e)) = + ∑ q : (Σ j : Fin r, + OrderedFace r (j.1 + 1)), + R.toCoarseFine.faceAtomEnergyGap + q.1 (q.2.trans e) := by + rw [← E.sum_comp + (fun q : (Σ j : Fin r, + OrderedFace r (j.1 + 1)) => + R.toCoarseFine.faceAtomEnergyGap + q.1 (q.2.trans e))] + rfl + _ = + ∑ j : Fin r, + ∑ d : OrderedFace r (j.1 + 1), + R.toCoarseFine.faceAtomEnergyGap + j (d.trans e) := by + exact + Fintype.sum_sigma' + (fun (j : Fin r) + (d : OrderedFace r (j.1 + 1)) => + R.toCoarseFine.faceAtomEnergyGap + j (d.trans e)) + _ ≤ + ∑ j : Fin r, + R.toCoarseFine.layerAtomEnergyGap j := by + exact Finset.sum_le_sum fun j _ => + R.sum_faceAtomEnergyGap_trans_le_layer e j + +theorem sum_fineUpperComplexity_trans_le_allRankUpperComplexity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (e : OrderedFace k r) : + (∑ q : OrderedPositiveSubface r, + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ)) ≤ + orderedAllRankUpperComplexity R.fine := by + classical + unfold orderedAllRankUpperComplexity + let E := + Equiv.psigmaEquivSigma + (fun j : Fin r => OrderedFace r (j.1 + 1)) + calc + (∑ q : OrderedPositiveSubface r, + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ)) = + ∑ q : (Σ j : Fin r, + OrderedFace r (j.1 + 1)), + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ) := by + rw [← E.sum_comp + (fun q : (Σ j : Fin r, + OrderedFace r (j.1 + 1)) => + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ))] + rfl + _ = + ∑ j : Fin r, + ∑ d : OrderedFace r (j.1 + 1), + (FacePartition.complexity + (R.fine.partition j.succ + (d.trans e)) : ℝ) := by + exact + Fintype.sum_sigma' + (fun (j : Fin r) + (d : OrderedFace r (j.1 + 1)) => + (FacePartition.complexity + (R.fine.partition j.succ + (d.trans e)) : ℝ)) + _ ≤ + ∑ j : Fin r, + ∑ f : OrderedFace k (j.1 + 1), + (FacePartition.complexity + (R.fine.partition j.succ f) : ℝ) := by + apply Finset.sum_le_sum + intro j _hj + let φ : OrderedFace r (j.1 + 1) → + OrderedFace k (j.1 + 1) := + fun d => d.trans e + have hφ : Function.Injective φ := by + intro d₁ d₂ h + ext i + exact congrArg Fin.val + (e.injective + (congrArg + (fun f : OrderedFace k (j.1 + 1) => f i) h)) + calc + (∑ d : OrderedFace r (j.1 + 1), + (FacePartition.complexity + (R.fine.partition j.succ (φ d)) : ℝ)) = + ∑ f ∈ + (Finset.univ : + Finset (OrderedFace r + (j.1 + 1))).image φ, + (FacePartition.complexity + (R.fine.partition j.succ f) : ℝ) := by + rw [Finset.sum_image hφ.injOn] + _ ≤ + ∑ f : OrderedFace k (j.1 + 1), + (FacePartition.complexity + (R.fine.partition j.succ f) : ℝ) := by + exact + Finset.sum_le_sum_of_subset_of_nonneg + (Finset.subset_univ _) + (fun _ _ _ => Nat.cast_nonneg _) + +theorem faceDeletionDensity_badBase_constant_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse (fun _ => α) (fun _ => β)) e ≤ + (∑ q : OrderedPositiveSubface r, + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ)) * α + + R.toCoarseFine.totalAtomEnergyGap / β := by + let P := R.toCoarseFine + have hdeletion : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse (fun _ => α) (fun _ => β)) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * α + + P.faceAtomEnergyGap q.1 (q.2.trans e) / β) := by + convert + (faceDeletionDensity_orderedBadBaseDeletionFamily_le + R.refines (fun _ => α) (fun _ => β) + (fun _ => hα) (fun _ => hβ) e) using 1 + rfl + calc + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse (fun _ => α) (fun _ => β)) e ≤ + ∑ q : OrderedPositiveSubface r, + ((FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ) * α + + P.faceAtomEnergyGap q.1 (q.2.trans e) / β) := + hdeletion + _ = + (∑ q : OrderedPositiveSubface r, + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ)) * α + + (∑ q : OrderedPositiveSubface r, + P.faceAtomEnergyGap q.1 (q.2.trans e)) / β := by + rw [Finset.sum_add_distrib, Finset.sum_mul, + Finset.sum_div] + _ ≤ + (∑ q : OrderedPositiveSubface r, + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ)) * α + + P.totalAtomEnergyGap / β := by + exact add_le_add (le_refl _) + (div_le_div_of_nonneg_right + (R.sum_faceAtomEnergyGap_trans_le_total e) hβ.le) + +theorem faceDeletionDensity_badBase_constant_le_sum_div + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse (fun _ => α) (fun _ => β)) e ≤ + (∑ q : OrderedPositiveSubface r, + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ)) * α + + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ)) / β := by + exact + (R.faceDeletionDensity_badBase_constant_le hα hβ e).trans + (add_le_add (le_refl _) + (div_le_div_of_nonneg_right + R.totalAtomEnergyGap_le_sum_div hβ.le)) + +theorem faceDeletionDensity_badBase_constant_le_globalComplexity_sum_div + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse (fun _ => α) (fun _ => β)) e ≤ + orderedAllRankUpperComplexity R.fine * α + + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ)) / β := by + exact + (R.faceDeletionDensity_badBase_constant_le_sum_div + hα hβ e).trans + (add_le_add + (mul_le_mul_of_nonneg_right + (R.sum_fineUpperComplexity_trans_le_allRankUpperComplexity + e) + hα) + (le_refl _)) + +theorem faceDeletionDensity_badBase_constant_of_complexity_le_sum_div + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r M : ℕ} + {initial : OrderedPartitionComplex G k r} + {ε : (j : Fin r) → ℕ → ℝ} + {budget : (j : Fin r) → ℕ → ℕ} + {length : Fin r → ℕ} + (R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length) + (hcomplex : + ∀ (j : Fin r) (e : OrderedFace k (j.1 + 1)), + FacePartition.complexity + (R.fine.partition j.succ e) ≤ M) + {α β : ℝ} (hα : 0 ≤ α) (hβ : 0 < β) + (e : OrderedFace k r) : + OrderedPattern.faceDeletionDensity + (orderedBadBaseDeletionFamily + R.fine R.coarse (fun _ => α) (fun _ => β)) e ≤ + (Fintype.card (OrderedPositiveSubface r) : ℝ) * + (M : ℝ) * α + + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ)) / β := by + have hsum : + (∑ q : OrderedPositiveSubface r, + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ)) ≤ + (Fintype.card + (OrderedPositiveSubface r) : ℝ) * (M : ℝ) := by + calc + (∑ q : OrderedPositiveSubface r, + (FacePartition.complexity + (R.fine.partition q.1.succ + (q.2.trans e)) : ℝ)) ≤ + ∑ _q : OrderedPositiveSubface r, + (M : ℝ) := by + apply Finset.sum_le_sum + intro q _hq + exact_mod_cast hcomplex q.1 (q.2.trans e) + _ = + (Fintype.card + (OrderedPositiveSubface r) : ℝ) * (M : ℝ) := by + simp + exact + (R.faceDeletionDensity_badBase_constant_le_sum_div + hα hβ e).trans + (add_le_add + (mul_le_mul_of_nonneg_right hsum hα) + (le_refl _)) + +end StrongOrderedComplexRegularityCertificate + +theorem exists_strongOrderedComplexRegularity + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : (j : Fin r) → ℕ → ℝ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) + (hε : ∀ j n, 0 ≤ ε j n) + (hlong : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budget j n : ℝ) * (ε j n) ^ 2) + (hlength : ∀ j, 0 < length j) : + ∃ R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length, + R.toCoarseFine.totalAtomEnergyGap ≤ + ∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ) := by + obtain ⟨R⟩ := + StrongOrderedComplexRegularityCertificate.nonempty + initial ε budget length hε hlong hlength + exact ⟨R, R.totalAtomEnergyGap_le_sum_div⟩ + +theorem exists_strongOrderedComplexRegularity_of_sum_div_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : (j : Fin r) → ℕ → ℝ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) + (γ : ℝ) + (hε : ∀ j n, 0 ≤ ε j n) + (hlong : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budget j n : ℝ) * (ε j n) ^ 2) + (hlength : ∀ j, 0 < length j) + (hγ : + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ)) ≤ γ) : + ∃ R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length, + R.toCoarseFine.totalAtomEnergyGap ≤ γ := by + obtain ⟨R, hR⟩ := + exists_strongOrderedComplexRegularity + initial ε budget length hε hlong hlength + exact ⟨R, hR.trans hγ⟩ + +theorem exists_strongOrderedComplexRegularity_of_sum_div_lt + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (ε : (j : Fin r) → ℕ → ℝ) + (budget : (j : Fin r) → ℕ → ℕ) + (length : Fin r → ℕ) + (γ : ℝ) + (hε : ∀ j n, 0 ≤ ε j n) + (hlong : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (budget j n : ℝ) * (ε j n) ^ 2) + (hlength : ∀ j, 0 < length j) + (hγ : + (∑ j : Fin r, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) / + (length j : ℝ)) < γ) : + ∃ R : StrongOrderedComplexRegularityCertificate + G k r initial ε budget length, + R.toCoarseFine.totalAtomEnergyGap < γ := by + obtain ⟨R, hR⟩ := + exists_strongOrderedComplexRegularity + initial ε budget length hε hlong hlength + exact ⟨R, hR.trans_lt hγ⟩ + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/StructuredCleaning.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/StructuredCleaning.lean new file mode 100644 index 0000000000000000000000000000000000000000..e557707f86f80645e2b0ef4f6cd111ffc2b1b6ae --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/StructuredCleaning.lean @@ -0,0 +1,472 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedCounting +import OAI.Combinatorics.Progressions.FixedDensity.OrderedRemoval + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +open scoped BigOperators + +def IsZeroOneValued {Ω : Type*} (f : Ω → ℝ) : Prop := + ∀ x, f x = 0 ∨ f x = 1 + +namespace FaceRegularityState + +noncomputable def structuredSublevel + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) (τ : ℝ) : + BooleanCutTest Ω := by + classical + exact Finset.univ.filter fun x => S.structured f x < τ + +@[simp] +theorem mem_structuredSublevel + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) (τ : ℝ) + (x : Ω) : + x ∈ S.structuredSublevel f τ ↔ + S.structured f x < τ := by + simp [structuredSublevel] + +theorem structuredSublevel_measurable + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) (τ : ℝ) : + IsPartitionMeasurable S.partition + (S.structuredSublevel f τ).eval := by + intro x y hy + have hstructured : + S.structured f y = S.structured f x := + conditionalMean_eq_of_mem_part S.partition f hy + by_cases hx : S.structured f x < τ + · have hy' : S.structured f y < τ := by + simpa [hstructured] using hx + have hmy : y ∈ S.structuredSublevel f τ := + mem_structuredSublevel S f τ y |>.2 hy' + have hmx : x ∈ S.structuredSublevel f τ := + mem_structuredSublevel S f τ x |>.2 hx + rw [BooleanCutTest.eval_of_mem _ hmy, + BooleanCutTest.eval_of_mem _ hmx] + · have hy' : ¬S.structured f y < τ := by + simpa [hstructured] using hx + have hmy : y ∉ S.structuredSublevel f τ := + fun hmem => + hy' (mem_structuredSublevel S f τ y |>.1 hmem) + have hmx : x ∉ S.structuredSublevel f τ := + fun hmem => + hx (mem_structuredSublevel S f τ x |>.1 hmem) + rw [BooleanCutTest.eval_of_not_mem _ hmy, + BooleanCutTest.eval_of_not_mem _ hmx] + +theorem mean_mul_structuredSublevel_eq + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) (τ : ℝ) : + mean (fun x => + f x * (S.structuredSublevel f τ).eval x) = + mean (fun x => + S.structured f x * + (S.structuredSublevel f τ).eval x) := by + exact + mean_mul_eq_mean_conditionalMean_mul + S.partition f (S.structuredSublevel f τ).eval + (S.structuredSublevel_measurable f τ) + +noncomputable def lowStructuredOneFinset + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) (τ : ℝ) : + Finset Ω := by + classical + exact Finset.univ.filter fun x => + f x = 1 ∧ S.structured f x < τ + +@[simp] +theorem mem_lowStructuredOneFinset + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) (f : Ω → ℝ) (τ : ℝ) + (x : Ω) : + x ∈ S.lowStructuredOneFinset f τ ↔ + f x = 1 ∧ S.structured f x < τ := by + simp [lowStructuredOneFinset] + +theorem indicator_lowStructuredOneFinset + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (S : FaceRegularityState Ω) {f : Ω → ℝ} + (hf : IsZeroOneValued f) (τ : ℝ) (x : Ω) : + finsetIndicator (S.lowStructuredOneFinset f τ) x = + f x * (S.structuredSublevel f τ).eval x := by + rcases hf x with hzero | hone + · rw [hzero, zero_mul] + apply finsetIndicator_of_not_mem + intro hx + exact zero_ne_one + (hzero.symm.trans + (mem_lowStructuredOneFinset S f τ x |>.1 hx).1) + · rw [hone, one_mul] + by_cases hx : S.structured f x < τ + · rw [finsetIndicator_of_mem, + BooleanCutTest.eval_of_mem] + · exact mem_structuredSublevel S f τ x |>.2 hx + · exact mem_lowStructuredOneFinset S f τ x |>.2 + ⟨hone, hx⟩ + · rw [finsetIndicator_of_not_mem, + BooleanCutTest.eval_of_not_mem] + · exact fun hmem => + hx (mem_structuredSublevel S f τ x |>.1 hmem) + · exact fun hmem => + hx (mem_lowStructuredOneFinset S f τ x |>.1 hmem).2 + +theorem mean_indicator_lowStructuredOneFinset_le + {Ω : Type*} [Fintype Ω] [DecidableEq Ω] [Nonempty Ω] + (S : FaceRegularityState Ω) {f : Ω → ℝ} + (hf01 : IsZeroOneValued f) + {τ : ℝ} (hτ : 0 ≤ τ) : + mean (finsetIndicator + (S.lowStructuredOneFinset f τ)) ≤ τ := by + rw [show + finsetIndicator (S.lowStructuredOneFinset f τ) = + fun x => + f x * (S.structuredSublevel f τ).eval x by + funext x + exact S.indicator_lowStructuredOneFinset hf01 τ x] + rw [S.mean_mul_structuredSublevel_eq f τ] + calc + mean (fun x => + S.structured f x * + (S.structuredSublevel f τ).eval x) ≤ + mean (fun _x : Ω => τ) := by + apply mean_mono + intro x + by_cases hx : S.structured f x < τ + · rw [BooleanCutTest.eval_of_mem] + · simpa using hx.le + · exact mem_structuredSublevel S f τ x |>.2 hx + · rw [BooleanCutTest.eval_of_not_mem, mul_zero] + · exact hτ + · exact fun hmem => + hx (mem_structuredSublevel S f τ x |>.1 hmem) + _ = τ := mean_const _ + +end FaceRegularityState + +noncomputable def deletedFaceEquiv + {G : Type*} {n : ℕ} (j : Fin (n + 1)) : + DeletedVector (fun _ : Fin (n + 1) => G) j ≃ + (Fin n → G) where + toFun := deletedFaceTuple j + invFun := finTupleToDeletedVector j + left_inv := finTupleToDeletedVector_deletedFaceTuple j + right_inv := deletedFaceTuple_finTupleToDeletedVector j + +theorem canonicalEdgeFunction_toWeighted_zeroOne + {G : Type*} {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (j : Fin (n + 1)) : + IsZeroOneValued + (canonicalEdgeFunction H.toWeighted j) := by + intro y + classical + by_cases hy : + H.edge j (finTupleToDeletedVector j y) + · right + exact H.toWeighted_edgeWeight_of_edge hy + · left + exact H.toWeighted_edgeWeight_of_not_edge hy + +noncomputable def lowStructuredDeletion + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) (τ : ℝ) : + SimplexHypergraph.DeletionFamily + (fun _ : Fin (n + 1) => G) := + fun j => + ((S j).lowStructuredOneFinset + (canonicalEdgeFunction H.toWeighted j) τ).map + (deletedFaceEquiv j).symm.toEmbedding + +@[simp] +theorem card_lowStructuredDeletion + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) (τ : ℝ) + (j : Fin (n + 1)) : + (lowStructuredDeletion H S τ j).card = + ((S j).lowStructuredOneFinset + (canonicalEdgeFunction H.toWeighted j) τ).card := by + classical + simp [lowStructuredDeletion] + +@[simp] +theorem mem_lowStructuredDeletion_iff + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) (τ : ℝ) + (j : Fin (n + 1)) + (x : DeletedVector (fun _ : Fin (n + 1) => G) j) : + x ∈ lowStructuredDeletion H S τ j ↔ + deletedFaceTuple j x ∈ + (S j).lowStructuredOneFinset + (canonicalEdgeFunction H.toWeighted j) τ := by + classical + constructor + · intro hx + obtain ⟨y, hy, hyx⟩ := Finset.mem_map.mp hx + have heq : + y = deletedFaceTuple j x := by + change y = (deletedFaceEquiv j) x + calc + y = + (deletedFaceEquiv j) + ((deletedFaceEquiv j).symm y) := + ((deletedFaceEquiv j).apply_symm_apply y).symm + _ = (deletedFaceEquiv j) x := + congrArg (deletedFaceEquiv j) hyx + simpa [heq] using hy + · intro hx + apply Finset.mem_map.mpr + refine ⟨deletedFaceTuple j x, hx, ?_⟩ + exact (deletedFaceEquiv j).symm_apply_apply x + +theorem lowStructuredDeletion_isEdgeDeletion + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) (τ : ℝ) : + H.IsEdgeDeletion (lowStructuredDeletion H S τ) := by + intro j x hx + apply (H.mem_edgeFinset j x).2 + have hlow := + (mem_lowStructuredDeletion_iff H S τ j x).1 hx + have hone := + ((S j).mem_lowStructuredOneFinset + (canonicalEdgeFunction H.toWeighted j) τ + (deletedFaceTuple j x)).1 hlow |>.1 + by_contra hedge + have hzero : + H.toWeighted.edgeWeight j x = 0 := + H.toWeighted_edgeWeight_of_not_edge hedge + have hcanonical : + canonicalEdgeFunction H.toWeighted j + (deletedFaceTuple j x) = + H.toWeighted.edgeWeight j x := by + simp [canonicalEdgeFunction] + rw [hcanonical, hzero] at hone + norm_num at hone + +theorem colorDeletionDensity_lowStructuredDeletion_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) + {τ : ℝ} (hτ : 0 ≤ τ) + (j : Fin (n + 1)) : + SimplexHypergraph.colorDeletionDensity + (lowStructuredDeletion H S τ) j ≤ τ := by + have hmean := + (S j).mean_indicator_lowStructuredOneFinset_le + (canonicalEdgeFunction_toWeighted_zeroOne H j) hτ + rw [mean_finsetIndicator] at hmean + rw [SimplexHypergraph.colorDeletionDensity, + card_lowStructuredDeletion] + have hcard : + Fintype.card + (DeletedVector + (fun _ : Fin (n + 1) => G) j) = + Fintype.card (Fin n → G) := + Fintype.card_congr (deletedFaceEquiv j) + rw [hcard] + exact hmean + +theorem normalizedDeletionCost_lowStructuredDeletion_le + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) + {τ : ℝ} (hτ : 0 ≤ τ) : + SimplexHypergraph.normalizedDeletionCost + (lowStructuredDeletion H S τ) ≤ τ := by + let M : ℕ := Fintype.card (Fin n → G) + have hM : 0 < M := Fintype.card_pos + have hface (j : Fin (n + 1)) : + Fintype.card + (DeletedVector + (fun _ : Fin (n + 1) => G) j) = M := by + exact Fintype.card_congr (deletedFaceEquiv j) + have hcard (j : Fin (n + 1)) : + ((lowStructuredDeletion H S τ j).card : ℝ) ≤ + τ * M := by + have hdensity := + colorDeletionDensity_lowStructuredDeletion_le + H S hτ j + rw [SimplexHypergraph.colorDeletionDensity, + hface] at hdensity + have hMR : (0 : ℝ) < M := by exact_mod_cast hM + exact (div_le_iff₀ hMR).mp hdensity + have hcount : + (SimplexHypergraph.deletionCount + (lowStructuredDeletion H S τ) : ℝ) ≤ + (n + 1 : ℝ) * (τ * M) := by + calc + (SimplexHypergraph.deletionCount + (lowStructuredDeletion H S τ) : ℝ) = + ∑ j : Fin (n + 1), + ((lowStructuredDeletion H S τ j).card : ℝ) := by + simp [SimplexHypergraph.deletionCount] + _ ≤ ∑ _j : Fin (n + 1), τ * M := + Finset.sum_le_sum fun j _ => hcard j + _ = (n + 1 : ℝ) * (τ * M) := by + simp + have hcapacity : + SimplexHypergraph.deletionCapacity + (fun _ : Fin (n + 1) => G) = + (n + 1) * M := by + unfold SimplexHypergraph.deletionCapacity + simp_rw [hface] + simp + rw [SimplexHypergraph.normalizedDeletionCost, + hcapacity] + have hdenom : + (0 : ℝ) < ((n + 1) * M : ℕ) := by + exact_mod_cast Nat.mul_pos (by omega) hM + apply (div_le_iff₀ hdenom).2 + calc + (SimplexHypergraph.deletionCount + (lowStructuredDeletion H S τ) : ℝ) ≤ + (n + 1 : ℝ) * (τ * M) := hcount + _ = τ * (((n + 1) * M : ℕ) : ℝ) := by + push_cast + ring + +theorem regularized_edgeWeight_ge_of_not_mem_lowDeletion + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) (τ : ℝ) + (j : Fin (n + 1)) + (x : DeletedVector (fun _ : Fin (n + 1) => G) j) + (hx : H.edge j x) + (hnot : x ∉ lowStructuredDeletion H S τ j) : + τ ≤ + (regularizedSimplexSystem H.toWeighted S).edgeWeight j x := by + have hone : + canonicalEdgeFunction H.toWeighted j + (deletedFaceTuple j x) = 1 := by + rw [canonicalEdgeFunction] + have hface : + finTupleToDeletedVector j (deletedFaceTuple j x) = x := + finTupleToDeletedVector_deletedFaceTuple j x + rw [hface] + exact H.toWeighted_edgeWeight_of_edge hx + have hnlow : + deletedFaceTuple j x ∉ + (S j).lowStructuredOneFinset + (canonicalEdgeFunction H.toWeighted j) τ := by + exact fun hmem => + hnot ((mem_lowStructuredDeletion_iff H S τ j x).2 hmem) + have hnotlt : + ¬(S j).structured + (canonicalEdgeFunction H.toWeighted j) + (deletedFaceTuple j x) < τ := by + intro hlt + apply hnlow + exact + ((S j).mem_lowStructuredOneFinset + (canonicalEdgeFunction H.toWeighted j) τ + (deletedFaceTuple j x)).2 + ⟨hone, hlt⟩ + exact not_lt.mp hnotlt + +theorem pow_le_regularized_simplexWeight_of_avoids_lowDeletion + {G : Type*} [Fintype G] [DecidableEq G] {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) + {τ : ℝ} (hτ : 0 ≤ τ) + (x : Fin (n + 1) → G) + (hx : x ∈ H.simplexFinset) + (havoid : + ∀ j, deleteCoordinate x j ∉ + lowStructuredDeletion H S τ j) : + τ ^ (n + 1) ≤ + (regularizedSimplexSystem H.toWeighted S).simplexWeight x := by + change + τ ^ (n + 1) ≤ + ∏ j : Fin (n + 1), + (regularizedSimplexSystem H.toWeighted S).edgeWeight j + (deleteCoordinate x j) + calc + τ ^ (n + 1) = ∏ _j : Fin (n + 1), τ := by + simp + _ ≤ + ∏ j : Fin (n + 1), + (regularizedSimplexSystem H.toWeighted S).edgeWeight j + (deleteCoordinate x j) := by + apply Finset.prod_le_prod₀ + · intro _ _ + exact hτ + · intro j _ + exact regularized_edgeWeight_ge_of_not_mem_lowDeletion + H S τ j (deleteCoordinate x j) + ((H.mem_simplexFinset x).1 hx j) (havoid j) + +theorem lowStructuredDeletion_isSimplexCover_of_count_lt + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {n : ℕ} + (H : SimplexHypergraph + (fun _ : Fin (n + 1) => G)) + (S : SimplexRegularitySystem G n) + {τ : ℝ} (hτ : 0 < τ) + (hcount : + (regularizedSimplexSystem H.toWeighted S).simplexCount < + τ ^ (n + 1) / + Fintype.card (Fin (n + 1) → G)) : + H.IsSimplexCover (lowStructuredDeletion H S τ) := by + classical + by_contra hcover + unfold SimplexHypergraph.IsSimplexCover at hcover + push Not at hcover + obtain ⟨x, hx, havoid⟩ := hcover + let K := regularizedSimplexSystem H.toWeighted S + have hK : + EdgeWeightsInUnitInterval K := + regularizedSimplexSystem_unitInterval + (fun j y => ⟨H.toWeighted_edgeWeight_nonneg j y, + by + classical + by_cases hy : H.edge j y + · rw [H.toWeighted_edgeWeight_of_edge hy] + · rw [H.toWeighted_edgeWeight_of_not_edge hy] + norm_num⟩) + S + have hpoint : + τ ^ (n + 1) ≤ K.simplexWeight x := + pow_le_regularized_simplexWeight_of_avoids_lowDeletion + H S hτ.le x hx havoid + have hsingle : + K.simplexWeight x ≤ ∑ y, K.simplexWeight y := by + apply Finset.single_le_sum + · intro y _ + exact K.simplexWeight_nonneg + (fun j z => (hK j z).1) y + · exact Finset.mem_univ x + have hmean : + τ ^ (n + 1) / + Fintype.card (Fin (n + 1) → G) ≤ + K.simplexCount := by + rw [WeightedSimplexSystem.simplexCount, mean, + Fintype.expect_eq_sum_div_card] + exact div_le_div_of_nonneg_right + (hpoint.trans hsingle) (Nat.cast_nonneg _) + exact (not_lt_of_ge hmean) hcount + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/FixedDensity/TowerDominatingGrowth.lean b/lean/OAI/Combinatorics/Progressions/FixedDensity/TowerDominatingGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..d97ec5052c6fb496a4f25dd9ded17bada1ac5217 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/FixedDensity/TowerDominatingGrowth.lean @@ -0,0 +1,987 @@ +import OAI.Combinatorics.Progressions.FixedDensity.OrderedRemovalAssembly + +namespace OAI + +section + +namespace Erdos3.FixedDensity + +structure DescendingGrowthHierarchy + (F : NatGrowthFunction) (depth : ℕ) where + level : Fin (depth + 1) → ℕ + step_eq : + ∀ i : Fin depth, + level i.castSucc = F (level i.succ) + +namespace DescendingGrowthHierarchy + +theorem lower_le_growth + {F : NatGrowthFunction} {depth : ℕ} + (H : DescendingGrowthHierarchy F depth) + (i : Fin depth) : + H.level i.succ ≤ F (H.level i.succ) := by + exact (Nat.le_succ _).trans + (F.above_diagonal (H.level i.succ)) + +theorem growth_eq_upper + {F : NatGrowthFunction} {depth : ℕ} + (H : DescendingGrowthHierarchy F depth) + (i : Fin depth) : + F (H.level i.succ) = H.level i.castSucc := + (H.step_eq i).symm + +theorem lower_le_growth_le_upper + {F : NatGrowthFunction} {depth : ℕ} + (H : DescendingGrowthHierarchy F depth) + (i : Fin depth) : + H.level i.succ ≤ F (H.level i.succ) ∧ + F (H.level i.succ) ≤ H.level i.castSucc := by + exact ⟨H.lower_le_growth i, + (H.growth_eq_upper i).le⟩ + +theorem antitone + {F : NatGrowthFunction} {depth : ℕ} + (H : DescendingGrowthHierarchy F depth) : + Antitone H.level := by + rw [Fin.antitone_iff_succ_le] + intro i + exact (H.lower_le_growth i).trans_eq + (H.growth_eq_upper i) + +end DescendingGrowthHierarchy + +def canonicalDescendingGrowthHierarchy + (F : NatGrowthFunction) (depth bottom : ℕ) : + DescendingGrowthHierarchy F depth where + level q := + (F.toFun ^[depth - q.1]) bottom + step_eq := by + intro i + have hexponent : + depth - i.castSucc.1 = + (depth - i.succ.1) + 1 := by + simp only [Fin.val_castSucc, Fin.val_succ] + omega + rw [hexponent] + exact Function.iterate_succ_apply' + F.toFun (depth - i.succ.1) bottom + +@[simp] +theorem canonicalDescendingGrowthHierarchy_last + (F : NatGrowthFunction) (depth bottom : ℕ) : + (canonicalDescendingGrowthHierarchy + F depth bottom).level (Fin.last depth) = + bottom := by + simp [canonicalDescendingGrowthHierarchy] + +@[simp] +theorem canonicalDescendingGrowthHierarchy_zero + (F : NatGrowthFunction) (depth bottom : ℕ) : + (canonicalDescendingGrowthHierarchy + F depth bottom).level 0 = + (F.toFun ^[depth]) bottom := by + simp [canonicalDescendingGrowthHierarchy] + +noncomputable def growthComplexRegularityTolerance + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) : + (j : Fin r) → ℕ → ℝ := + fun j => + growthRegularityTolerance + k j.1 (initialBound j.castSucc) F + +noncomputable def growthComplexRegularityBudget + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) : + (j : Fin r) → ℕ → ℕ := + fun j => + growthRegularityBudget + k j.1 (initialBound j.castSucc) F + +noncomputable def growthComplexRegularityLength + (k r : ℕ) (γ : Fin r → ℝ) : + Fin r → ℕ := + fun j => + growthRegularityLength k j.1 (γ j) + +noncomputable def selectedGrowthCoarseComplexityBound + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (index : Fin r → ℕ) + (j : Fin r) : ℕ := + growthRegularityComplexity + k j.1 (initialBound j.castSucc) F (index j) + +noncomputable def selectedGrowthFineComplexityBound + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (index : Fin r → ℕ) + (j : Fin r) : ℕ := + growthRegularityComplexity + k j.1 (initialBound j.castSucc) F (index j + 1) + +noncomputable def selectedGrowthCoarseLayerComplexityBound + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (index : Fin r → ℕ) : + Fin (r + 1) → ℕ := + Fin.lastCases + (initialBound (Fin.last r)) + (fun j => + selectedGrowthCoarseComplexityBound + k r initialBound F index j) + +noncomputable def selectedGrowthFineLayerComplexityBound + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (index : Fin r → ℕ) : + Fin (r + 1) → ℕ := + Fin.lastCases + (initialBound (Fin.last r)) + (fun j => + selectedGrowthFineComplexityBound + k r initialBound F index j) + +theorem growthComplexRegularityTolerance_pos + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) : + ∀ j n, + 0 < + growthComplexRegularityTolerance + k r initialBound F j n := by + intro j n + exact growthRegularityTolerance_pos + k j.1 (initialBound j.castSucc) F n + +theorem growthComplexRegularityBudget_spec + (k r : ℕ) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) : + ∀ j n, + (Fintype.card + (OrderedFace k (j.1 + 1)) : ℝ) < + (growthComplexRegularityBudget + k r initialBound F j n : ℝ) * + (growthComplexRegularityTolerance + k r initialBound F j n) ^ 2 := by + intro j n + exact growthRegularityBudget_spec + k j.1 (initialBound j.castSucc) F n + +theorem growthComplexRegularityLength_pos + (k r : ℕ) (γ : Fin r → ℝ) : + ∀ j, + 0 < + growthComplexRegularityLength k r γ j := by + intro j + exact growthRegularityLength_pos k j.1 (γ j) + +structure GrowthFunctionOrderedComplexRegularityCertificate + (G : Type*) [Fintype G] [DecidableEq G] + (k r : ℕ) + (initial : OrderedPartitionComplex G k r) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (γ : Fin r → ℝ) where + index : Fin r → ℕ + coarse : OrderedPartitionComplex G k r + fine : OrderedPartitionComplex G k r + refines : fine.Refines coarse + coarse_refines_initial : coarse.Refines initial + coarse_topLayer_eq : + coarse.topLayer = initial.topLayer + fine_topLayer_eq : + fine.topLayer = initial.topLayer + index_lt : + ∀ j : Fin r, + index j < + growthRegularityLength k j.1 (γ j) + regular : + IsFullyPreliminaryOrderedRegular fine + (fun j => + 1 / + (F (selectedGrowthCoarseComplexityBound + k r initialBound F index j) : ℝ)) + gap_nonneg : + ∀ j : Fin r, + 0 ≤ + orderedLayerAtomEnergy + (fine.partition j.castSucc) + (fine.partition j.succ) - + orderedLayerAtomEnergy + (coarse.partition j.castSucc) + (fine.partition j.succ) + gap_le : + ∀ j : Fin r, + orderedLayerAtomEnergy + (fine.partition j.castSucc) + (fine.partition j.succ) - + orderedLayerAtomEnergy + (coarse.partition j.castSucc) + (fine.partition j.succ) ≤ + γ j + coarse_complexity : + ∀ (q : Fin (r + 1)) (e : OrderedFace k q.1), + FacePartition.complexity + (coarse.partition q e) ≤ + selectedGrowthCoarseLayerComplexityBound + k r initialBound F index q + fine_complexity : + ∀ (q : Fin (r + 1)) (e : OrderedFace k q.1), + FacePartition.complexity + (fine.partition q e) ≤ + selectedGrowthFineLayerComplexityBound + k r initialBound F index q + +namespace GrowthFunctionOrderedComplexRegularityCertificate + +def localCertificate + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound F γ) + (j : Fin r) : + GrowthFunctionFixedUpperCertificate + G k j.1 (initialBound j.castSucc) + (initial.partition j.castSucc) + (R.fine.partition j.succ) + F (γ j) where + index := R.index j + index_lt := R.index_lt j + coarse := R.coarse.partition j.castSucc + fine := R.fine.partition j.castSucc + refines := R.refines j.castSucc + coarse_refines_initial := + R.coarse_refines_initial j.castSucc + fine_regular := by + simpa [selectedGrowthCoarseComplexityBound] using + R.regular j + gap_nonneg := R.gap_nonneg j + gap_le := R.gap_le j + coarse_complexity := by + intro e + have h := R.coarse_complexity j.castSucc e + simp only [selectedGrowthCoarseLayerComplexityBound, + selectedGrowthCoarseComplexityBound, + Fin.lastCases_castSucc] at h + convert h using 1 + fine_complexity := by + intro e + have h := R.fine_complexity j.castSucc e + simp only [selectedGrowthFineLayerComplexityBound, + selectedGrowthFineComplexityBound, + Fin.lastCases_castSucc] at h + convert h using 1 + +theorem coarse_upper_complexity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound F γ) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : + FacePartition.complexity + (R.coarse.partition j.succ e) ≤ + selectedGrowthCoarseLayerComplexityBound + k r initialBound F R.index j.succ := + R.coarse_complexity j.succ e + +theorem fine_upper_complexity + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound F γ) + (j : Fin r) (e : OrderedFace k (j.1 + 1)) : + FacePartition.complexity + (R.fine.partition j.succ e) ≤ + selectedGrowthFineLayerComplexityBound + k r initialBound F R.index j.succ := + R.fine_complexity j.succ e + +end GrowthFunctionOrderedComplexRegularityCertificate + +theorem GrowthFunctionOrderedComplexRegularityCertificate.nonempty + {G : Type*} [Fintype G] [DecidableEq G] [Nonempty G] + {k r : ℕ} + (initial : OrderedPartitionComplex G k r) + (initialBound : Fin (r + 1) → ℕ) + (F : NatGrowthFunction) + (γ : Fin r → ℝ) + (hγ : ∀ j, 0 < γ j) + (hinitial : + ∀ (q : Fin (r + 1)) (e : OrderedFace k q.1), + FacePartition.complexity + (initial.partition q e) ≤ initialBound q) : + Nonempty + (GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound F γ) := by + let τ : (j : Fin r) → ℕ → ℝ := + growthComplexRegularityTolerance + k r initialBound F + let B : (j : Fin r) → ℕ → ℕ := + growthComplexRegularityBudget + k r initialBound F + let L : Fin r → ℕ := + growthComplexRegularityLength k r γ + obtain ⟨R⟩ := + StrongOrderedComplexRegularityCertificate.nonempty + initial τ B L + (fun j n => + (growthComplexRegularityTolerance_pos + k r initialBound F j n).le) + (growthComplexRegularityBudget_spec + k r initialBound F) + (growthComplexRegularityLength_pos k r γ) + refine ⟨{ + index := R.index + coarse := R.coarse + fine := R.fine + refines := R.refines + coarse_refines_initial := + R.coarse_refines_initial + coarse_topLayer_eq := R.coarse_topLayer_eq + fine_topLayer_eq := R.fine_topLayer_eq + index_lt := ?_ + regular := ?_ + gap_nonneg := R.gap_nonneg + gap_le := ?_ + coarse_complexity := ?_ + fine_complexity := ?_ }⟩ + · intro j + simpa [L, growthComplexRegularityLength] using + R.index_lt j + · intro j + have hregular := R.regular j + simpa [τ, growthComplexRegularityTolerance, + selectedOrderedComplexTolerance, + selectedGrowthCoarseComplexityBound, + growthRegularityTolerance_eq] using hregular + · intro j + exact (R.gap_le j).trans + (by + simpa [L, growthComplexRegularityLength] using + (orderedFace_card_div_growthRegularityLength_lt + (hγ j)).le) + · intro q + cases q using Fin.lastCases with + | last => + intro e + have htop := congrFun R.coarse_topLayer_eq e + simp only [OrderedPartitionComplex.topLayer] at htop + rw [htop] + simpa [selectedGrowthCoarseLayerComplexityBound] using + hinitial (Fin.last r) e + | cast i => + intro e + have hcomplexity := R.coarse_complexity i e + calc + FacePartition.complexity + (R.coarse.partition i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (B i) (R.index i) * + FacePartition.complexity + (initial.partition i.castSucc e) := by + simpa [B, growthComplexRegularityBudget] using + hcomplexity + _ ≤ + fixedUpperLayerComplexityFactor + i.1 (B i) (R.index i) * + initialBound i.castSucc := + Nat.mul_le_mul_left _ + (hinitial i.castSucc e) + _ = + selectedGrowthCoarseLayerComplexityBound + k r initialBound F R.index i.castSucc := by + simp only [ + selectedGrowthCoarseLayerComplexityBound, + selectedGrowthCoarseComplexityBound, + Fin.lastCases_castSucc] + rw [growthRegularityComplexity_eq_factor_mul] + rfl + · intro q + cases q using Fin.lastCases with + | last => + intro e + have htop := congrFun R.fine_topLayer_eq e + simp only [OrderedPartitionComplex.topLayer] at htop + rw [htop] + simpa [selectedGrowthFineLayerComplexityBound] using + hinitial (Fin.last r) e + | cast i => + intro e + have hcomplexity := R.fine_complexity i e + calc + FacePartition.complexity + (R.fine.partition i.castSucc e) ≤ + fixedUpperLayerComplexityFactor + i.1 (B i) (R.index i + 1) * + FacePartition.complexity + (initial.partition i.castSucc e) := by + simpa [B, growthComplexRegularityBudget] using + hcomplexity + _ ≤ + fixedUpperLayerComplexityFactor + i.1 (B i) (R.index i + 1) * + initialBound i.castSucc := + Nat.mul_le_mul_left _ + (hinitial i.castSucc e) + _ = + selectedGrowthFineLayerComplexityBound + k r initialBound F R.index i.castSucc := by + simp only [ + selectedGrowthFineLayerComplexityBound, + selectedGrowthFineComplexityBound, + Fin.lastCases_castSucc] + rw [growthRegularityComplexity_eq_factor_mul] + rfl + +end Erdos3.FixedDensity + +end + +section + +namespace Erdos3.FixedDensity + +noncomputable def growthRegularityOneStep + (k j : ℕ) (F : NatGrowthFunction) (M : ℕ) : ℕ := + (2 ^ (j + 1)) ^ + growthRegularityStepBudget k j F M * M + +@[simp] +theorem growthRegularityComplexity_succ_eq_oneStep + (k j initialBound n : ℕ) (F : NatGrowthFunction) : + growthRegularityComplexity + k j initialBound F (n + 1) = + growthRegularityOneStep k j F + (growthRegularityComplexity + k j initialBound F n) := + rfl + +noncomputable def boundedGrowthRegularityOneStepMaximum + (k j : ℕ) (F : NatGrowthFunction) : ℕ → ℕ + | 0 => growthRegularityOneStep k j F 0 + | M + 1 => + max + (boundedGrowthRegularityOneStepMaximum k j F M) + (growthRegularityOneStep k j F (M + 1)) + +theorem growthRegularityOneStep_le_boundedMaximum + (k j : ℕ) (F : NatGrowthFunction) + {m M : ℕ} (hm : m ≤ M) : + growthRegularityOneStep k j F m ≤ + boundedGrowthRegularityOneStepMaximum k j F M := by + induction M generalizing m with + | zero => + have hmzero : m = 0 := Nat.eq_zero_of_le_zero hm + subst m + rfl + | succ M ih => + rw [boundedGrowthRegularityOneStepMaximum] + by_cases hlast : m = M + 1 + · subst m + exact le_max_right _ _ + · have hmM : m ≤ M := by omega + exact (ih hmM).trans (le_max_left _ _) + +theorem boundedGrowthRegularityOneStepMaximum_monotone + (k j : ℕ) (F : NatGrowthFunction) : + Monotone + (boundedGrowthRegularityOneStepMaximum k j F) := by + apply monotone_nat_of_le_succ + intro M + rw [boundedGrowthRegularityOneStepMaximum] + exact le_max_left _ _ + +noncomputable def finiteRankGrowthRegularityOneStepMaximum + (k : ℕ) (F : NatGrowthFunction) (M : ℕ) : ℕ → ℕ + | 0 => 0 + | r + 1 => + max + (finiteRankGrowthRegularityOneStepMaximum k F M r) + (boundedGrowthRegularityOneStepMaximum k r F M) + +theorem growthRegularityOneStep_le_finiteRankMaximum + (k : ℕ) (F : NatGrowthFunction) + {j r m M : ℕ} (hj : j < r) (hm : m ≤ M) : + growthRegularityOneStep k j F m ≤ + finiteRankGrowthRegularityOneStepMaximum k F M r := by + induction r generalizing j with + | zero => + omega + | succ r ih => + rw [finiteRankGrowthRegularityOneStepMaximum] + by_cases hjlast : j = r + · subst j + exact + (growthRegularityOneStep_le_boundedMaximum + k r F hm).trans (le_max_right _ _) + · have hjr : j < r := by omega + exact (ih hjr).trans (le_max_left _ _) + +theorem finiteRankGrowthRegularityOneStepMaximum_monotone + (k r : ℕ) (F : NatGrowthFunction) : + Monotone + (fun M => + finiteRankGrowthRegularityOneStepMaximum + k F M r) := by + intro a b hab + induction r with + | zero => + simp [finiteRankGrowthRegularityOneStepMaximum] + | succ r ih => + simp only [finiteRankGrowthRegularityOneStepMaximum] + exact max_le_max ih + (boundedGrowthRegularityOneStepMaximum_monotone + k r F hab) + +noncomputable def towerDominatingGrowth + (k r : ℕ) (F : NatGrowthFunction) : + NatGrowthFunction where + toFun M := + max (M + 1) + (max (F M) + (finiteRankGrowthRegularityOneStepMaximum + k F M r)) + monotone' := by + intro a b hab + exact max_le_max + (Nat.add_le_add_right hab 1) + (max_le_max + (F.monotone hab) + (finiteRankGrowthRegularityOneStepMaximum_monotone + k r F hab)) + above_diagonal := by + intro M + exact le_max_left _ _ + +@[simp] +theorem towerDominatingGrowth_apply + (k r : ℕ) (F : NatGrowthFunction) (M : ℕ) : + towerDominatingGrowth k r F M = + max (M + 1) + (max (F M) + (finiteRankGrowthRegularityOneStepMaximum + k F M r)) := + rfl + +theorem le_towerDominatingGrowth + (k r : ℕ) (F : NatGrowthFunction) (M : ℕ) : + F M ≤ towerDominatingGrowth k r F M := by + rw [towerDominatingGrowth_apply] + exact (le_max_left _ _).trans (le_max_right _ _) + +theorem growthFunction_le_towerDominatingGrowth_of_le + (k r : ℕ) (F : NatGrowthFunction) + {m M : ℕ} (hm : m ≤ M) : + F m ≤ towerDominatingGrowth k r F M := by + exact (F.monotone hm).trans + (le_towerDominatingGrowth k r F M) + +theorem growthRegularityOneStep_le_towerDominatingGrowth + (k r : ℕ) (F : NatGrowthFunction) + (j : Fin r) {m M : ℕ} (hm : m ≤ M) : + growthRegularityOneStep k j.1 F m ≤ + towerDominatingGrowth k r F M := by + rw [towerDominatingGrowth_apply] + exact + (growthRegularityOneStep_le_finiteRankMaximum + k F j.isLt hm).trans + ((le_max_right _ _).trans (le_max_right _ _)) + +noncomputable def towerDominatingGrowthIteration + (k r : ℕ) (F : NatGrowthFunction) : + ℕ → NatGrowthFunction + | 0 => F + | stage + 1 => + towerDominatingGrowth k r + (towerDominatingGrowthIteration k r F stage) + +@[simp] +theorem towerDominatingGrowthIteration_zero + (k r : ℕ) (F : NatGrowthFunction) : + towerDominatingGrowthIteration k r F 0 = F := + rfl + +@[simp] +theorem towerDominatingGrowthIteration_succ + (k r : ℕ) (F : NatGrowthFunction) (stage : ℕ) : + towerDominatingGrowthIteration k r F (stage + 1) = + towerDominatingGrowth k r + (towerDominatingGrowthIteration k r F stage) := + rfl + +theorem le_towerDominatingGrowthIteration + (k r : ℕ) (F : NatGrowthFunction) : + ∀ stage M, + F M ≤ towerDominatingGrowthIteration k r F stage M := by + intro stage + induction stage with + | zero => + intro M + exact le_rfl + | succ stage ih => + intro M + exact (ih M).trans + (le_towerDominatingGrowth k r + (towerDominatingGrowthIteration k r F stage) M) + +theorem towerDominatingGrowthIteration_le_succ + (k r : ℕ) (F : NatGrowthFunction) + (stage M : ℕ) : + towerDominatingGrowthIteration k r F stage M ≤ + towerDominatingGrowthIteration k r F (stage + 1) M := by + exact le_towerDominatingGrowth k r + (towerDominatingGrowthIteration k r F stage) M + +theorem growthRegularityOneStep_le_nextGrowthIteration + (k r : ℕ) (F : NatGrowthFunction) + (stage : ℕ) (j : Fin r) {m M : ℕ} (hm : m ≤ M) : + growthRegularityOneStep k j.1 + (towerDominatingGrowthIteration k r F stage) m ≤ + towerDominatingGrowthIteration k r F (stage + 1) M := by + exact growthRegularityOneStep_le_towerDominatingGrowth + k r + (towerDominatingGrowthIteration k r F stage) + j hm + +theorem growthRegularityComplexity_succ_le_nextGrowthIteration + (k r initialBound : ℕ) (F : NatGrowthFunction) + (stage n : ℕ) (j : Fin r) : + growthRegularityComplexity + k j.1 initialBound + (towerDominatingGrowthIteration k r F stage) + (n + 1) ≤ + towerDominatingGrowthIteration k r F (stage + 1) + (growthRegularityComplexity + k j.1 initialBound + (towerDominatingGrowthIteration k r F stage) + n) := by + rw [growthRegularityComplexity_succ_eq_oneStep] + exact growthRegularityOneStep_le_nextGrowthIteration + k r F stage j le_rfl + +theorem towerDominatingGrowthIteration_reciprocal_le + (k r : ℕ) (F : NatGrowthFunction) + (stage M : ℕ) : + 1 / + (towerDominatingGrowthIteration + k r F stage M : ℝ) ≤ + 1 / (F M : ℝ) := by + apply one_div_le_one_div_of_le + · exact_mod_cast F.positive M + · exact_mod_cast + le_towerDominatingGrowthIteration + k r F stage M + +def finiteMaximum : (n : ℕ) → (Fin n → ℕ) → ℕ + | 0, _ => 0 + | n + 1, value => + max + (finiteMaximum n (fun i => value i.castSucc)) + (value (Fin.last n)) + +theorem le_finiteMaximum : + ∀ {n : ℕ} (value : Fin n → ℕ) (i : Fin n), + value i ≤ finiteMaximum n value + | 0, _, i => Fin.elim0 i + | n + 1, value, i => by + cases i using Fin.lastCases with + | last => + rw [finiteMaximum] + exact le_max_right _ _ + | cast i => + rw [finiteMaximum] + exact + (le_finiteMaximum + (fun q => value q.castSucc) i).trans + (le_max_left _ _) + +namespace GrowthFunctionOrderedComplexRegularityCertificate + +theorem selectedFineComplexity_le_nextGrowthIteration + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) + (j : Fin r) : + selectedGrowthFineComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j ≤ + towerDominatingGrowthIteration k r F (stage + 1) + (selectedGrowthCoarseComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j) := by + exact growthRegularityComplexity_succ_le_nextGrowthIteration + k r (initialBound j.castSucc) F stage (R.index j) j + +theorem regular_with_requestedGrowth + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) : + IsFullyPreliminaryOrderedRegular R.fine + (fun j => + 1 / + (F (selectedGrowthCoarseComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j) : ℝ)) := by + intro j e a b + exact (R.regular j e a b).trans + (towerDominatingGrowthIteration_reciprocal_le + k r F stage + (selectedGrowthCoarseComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j)) + +noncomputable def selectedRankTowerHierarchy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) + (j : Fin r) : + DescendingGrowthHierarchy + (towerDominatingGrowthIteration k r F (stage + 1)) 1 := + canonicalDescendingGrowthHierarchy + (towerDominatingGrowthIteration k r F (stage + 1)) 1 + (selectedGrowthCoarseComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j) + +@[simp] +theorem selectedRankTowerHierarchy_last + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) + (j : Fin r) : + (selectedRankTowerHierarchy R j).level (Fin.last 1) = + selectedGrowthCoarseComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j := by + exact canonicalDescendingGrowthHierarchy_last + (towerDominatingGrowthIteration k r F (stage + 1)) 1 + (selectedGrowthCoarseComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j) + +@[simp] +theorem selectedRankTowerHierarchy_zero + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) + (j : Fin r) : + (selectedRankTowerHierarchy R j).level 0 = + towerDominatingGrowthIteration k r F (stage + 1) + (selectedGrowthCoarseComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j) := by + simp [selectedRankTowerHierarchy] + +theorem selectedFineComplexity_le_selectedRankTowerHierarchy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) + (j : Fin r) : + selectedGrowthFineComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index j ≤ + (selectedRankTowerHierarchy R j).level 0 := by + rw [selectedRankTowerHierarchy_zero] + exact R.selectedFineComplexity_le_nextGrowthIteration j + +theorem finePartitionComplexity_le_selectedRankTowerHierarchy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) + (j : Fin r) (e : OrderedFace k j.1) : + FacePartition.complexity + (R.fine.partition j.castSucc e) ≤ + (selectedRankTowerHierarchy R j).level 0 := by + exact + ((R.localCertificate j).fine_complexity e).trans + (R.selectedFineComplexity_le_selectedRankTowerHierarchy j) + +noncomputable def selectedFineLayerMaximum + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) : ℕ := + finiteMaximum (r + 1) + (selectedGrowthFineLayerComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index) + +noncomputable def selectedAllRankTowerHierarchy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) : + DescendingGrowthHierarchy + (towerDominatingGrowthIteration k r F (stage + 1)) r := + canonicalDescendingGrowthHierarchy + (towerDominatingGrowthIteration k r F (stage + 1)) r + (selectedFineLayerMaximum R) + +@[simp] +theorem selectedAllRankTowerHierarchy_last + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) : + (selectedAllRankTowerHierarchy R).level (Fin.last r) = + selectedFineLayerMaximum R := by + exact canonicalDescendingGrowthHierarchy_last + (towerDominatingGrowthIteration k r F (stage + 1)) r + (selectedFineLayerMaximum R) + +theorem selectedFineLayerComplexity_le_allRankTowerHierarchy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) + (q : Fin (r + 1)) : + selectedGrowthFineLayerComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index q ≤ + (selectedAllRankTowerHierarchy R).level q := by + calc + selectedGrowthFineLayerComplexityBound + k r initialBound + (towerDominatingGrowthIteration k r F stage) + R.index q ≤ + selectedFineLayerMaximum R := by + exact le_finiteMaximum _ q + _ = + (selectedAllRankTowerHierarchy R).level + (Fin.last r) := by + symm + exact selectedAllRankTowerHierarchy_last R + _ ≤ + (selectedAllRankTowerHierarchy R).level q := by + exact (selectedAllRankTowerHierarchy R).antitone + (Fin.le_last q) + +theorem fineComplexity_le_allRankTowerHierarchy + {G : Type*} [Fintype G] [DecidableEq G] + {k r : ℕ} + {initial : OrderedPartitionComplex G k r} + {initialBound : Fin (r + 1) → ℕ} + {F : NatGrowthFunction} + {γ : Fin r → ℝ} + {stage : ℕ} + (R : GrowthFunctionOrderedComplexRegularityCertificate + G k r initial initialBound + (towerDominatingGrowthIteration k r F stage) γ) + (q : Fin (r + 1)) (e : OrderedFace k q.1) : + FacePartition.complexity + (R.fine.partition q e) ≤ + (selectedAllRankTowerHierarchy R).level q := by + exact (R.fine_complexity q e).trans + (R.selectedFineLayerComplexity_le_allRankTowerHierarchy q) + +end GrowthFunctionOrderedComplexRegularityCertificate + +end Erdos3.FixedDensity + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AffineFrequencyLift.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AffineFrequencyLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..24b4ba180707f9bcaadd00b4563eabda974f4575 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AffineFrequencyLift.lean @@ -0,0 +1,43 @@ +import OAI.Combinatorics.Progressions.Estimates.DehomogenizedExponent +import OAI.Combinatorics.Progressions.Lattices.AffineCoefficientSubspace + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +noncomputable def affineLiftFrequency {K J A : Type*} + (frequency : (K →₀ ℕ) → J → A) (d : Option K →₀ ℕ) : J → A := frequency d.some + +theorem affineModeLift_coefficientFunctional {K J : Type*} [Fintype J] + (frequency : (K →₀ ℕ) → J → ℝ) : + affineModeLift (coefficientFunctional frequency) = + coefficientFunctional (affineLiftFrequency frequency) := by + apply LinearMap.ext + intro p + conv_lhs => rw [← sum_monomial_coefficients p] + conv_rhs => rw [← sum_monomial_coefficients p] + simp only [Finsupp.sum, map_sum, affineModeLift, LinearMap.comp_apply, + dehomogenize_monomial, coefficientFunctional_monomial, affineLiftFrequency] + +theorem affineModeLift_integerFrequency {K J : Type*} [Fintype J] + (frequency : (K →₀ ℕ) → J → ℤ) : + affineModeLift (coefficientFunctional (fun d j => (frequency d j : ℝ))) = + coefficientFunctional (fun d j => ((affineLiftFrequency frequency d j : ℤ) : ℝ)) := + affineModeLift_coefficientFunctional _ + +theorem affineLiftFrequency_bound {K J : Type*} [Fintype K] + (frequency : (K →₀ ℕ) → J → ℤ) {h : ℕ} {C : ℝ} + (hbound : ∀ d, d.degree ≤ h → ∀ j, |(frequency d j : ℝ)| ≤ C) : + ∀ d, d.degree = h → ∀ j, |((affineLiftFrequency frequency d j : ℤ) : ℝ)| ≤ C := by + intro d hd j + exact hbound d.some ((some_degree_le d).trans hd.le) j + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AffineShortCoefficientMajorArc.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AffineShortCoefficientMajorArc.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0059e3fd2e6ec01b292871fd7fd2facebda132b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AffineShortCoefficientMajorArc.lean @@ -0,0 +1,152 @@ +import OAI.Combinatorics.Progressions.Fourier.PolynomialWeightedCubeMajorArc + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal +open CircleFourier + +theorem booleanBlockPhase_frequency_mul {G I : Type*} [Fintype G] [Fintype I] [DecidableEq I] + (a : ℝ) (ξ : Finset I → ℝ) (x : G → Option I → ℝ) : + booleanBlockPhase (fun S => a * ξ S) x = a * booleanBlockPhase ξ x := by + simp only [booleanBlockPhase, Finset.mul_sum, mul_assoc] + +theorem weighted_positiveCoefficient_major_arc {Ω I : Type*} [Fintype Ω] + [Fintype I] [DecidableEq I] {n : ℕ} + (p : FiniteProbabilityWeights Ω) (coefficient : Ω → ℤ) + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ a₀ T : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (ha₀ : 0 < a₀) + (hcoefficient : ∀ z, p.weight z ≠ 0 → a₀ ≤ (coefficient z : ℝ) ∧ (coefficient z : ℝ) ≤ T) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hbias : ζ ≤ ‖p.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((coefficient z : ℝ) * + booleanBlockPhase ξ (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle)))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ T * (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + localizedMajorArcErrorBudget n U ζ / (a₀ * ∏ j, ((s j).length : ℝ)) := by + obtain ⟨z, hz, hnorm⟩ := p.exists_positive_weight_norm_ge_mean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((coefficient z : ℝ) * + booleanBlockPhase ξ (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle))) + have hcz := hcoefficient z hz.ne' + have hcpos : 0 < (coefficient z : ℝ) := ha₀.trans_le hcz.1 + have hczpos : 0 < coefficient z := by exact_mod_cast hcpos + let c : ℕ := (coefficient z).toNat + have hcZ : (c : ℤ) = coefficient z := Int.toNat_of_nonneg hczpos.le + have hcR : (c : ℝ) = (coefficient z : ℝ) := by exact_mod_cast hcZ + have hc : 0 < c := Nat.cast_pos.mp (by rw [hcR]; exact hcpos) + have hscaled : ζ ≤ ‖(FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character ((booleanBlockPhase (fun S => (coefficient z : ℝ) * ξ S) + (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle))‖ := by + simpa only [booleanBlockPhase_frequency_mul] using hbias.trans hnorm + obtain ⟨D, hD, hDb, a, happ⟩ := polynomial_weightedCubeBlock_major_arc s A hA h hζ hζ1 hlen + (fun S => (coefficient z : ℝ) * ξ S) J hJ hscaled + have hbound : 0 ≤ (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card := + (Nat.cast_nonneg D).trans hDb + refine ⟨c * D, Nat.mul_pos hc hD, ?_, a, ?_⟩ + · rw [Nat.cast_mul, hcR] + exact (mul_le_mul_of_nonneg_left hDb hcpos.le).trans + (mul_le_mul_of_nonneg_right hcz.2 hbound) + · intro S + rw [Nat.cast_mul, hcR] + have heq : (coefficient z : ℝ) * (ξ S - (a S : ℝ) / ((coefficient z : ℝ) * D)) = + (coefficient z : ℝ) * ξ S - (a S : ℝ) / D := by + field_simp [hcpos.ne', (Nat.cast_pos.mpr hD : (0 : ℝ) < D).ne'] + have hmul : (coefficient z : ℝ) * |ξ S - (a S : ℝ) / ((coefficient z : ℝ) * D)| ≤ + localizedMajorArcErrorBudget n U ζ / ∏ j, ((s j).length : ℝ) := by + calc + _ = |(coefficient z : ℝ) * (ξ S - (a S : ℝ) / ((coefficient z : ℝ) * D))| := by + rw [abs_mul, abs_of_pos hcpos] + _ = _ := congrArg abs heq + _ ≤ _ := happ S + calc + _ ≤ (localizedMajorArcErrorBudget n U ζ / ∏ j, ((s j).length : ℝ)) / a₀ := + (le_div_iff₀ ha₀).mpr ((mul_comm _ _).trans_le + ((mul_le_mul_of_nonneg_right hcz.1 (abs_nonneg _)).trans hmul)) + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal +open CircleFourier + +theorem affine_weighted_positiveCoefficient_major_arc {Ω I : Type*} [Fintype Ω] + [Fintype I] [DecidableEq I] {n : ℕ} + (p : FiniteProbabilityWeights Ω) (coefficient : Ω → ℤ) + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ a₀ T : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (ha₀ : 0 < a₀) + (hcoefficient : ∀ z, p.weight z ≠ 0 → a₀ ≤ (coefficient z : ℝ) ∧ (coefficient z : ℝ) ≤ T) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (u : Fin (n + 1) → Option I → ℝ) (v : Fin (n + 1) → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (hstride : ∀ j i, ((v j i * (s j).modulus i : ℕ) : ℝ) ≤ U) + (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hbias : ζ ≤ ‖p.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((coefficient z : ℝ) * + booleanBlockPhase ξ (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle)))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ T * (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + localizedMajorArcErrorBudget n U ζ / (a₀ * ∏ j, ((s j).length : ℝ)) := by + obtain ⟨z, hz, hnorm⟩ := p.exists_positive_weight_norm_ge_mean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((coefficient z : ℝ) * + booleanBlockPhase ξ (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle))) + have hcz := hcoefficient z hz.ne' + have hcpos : 0 < (coefficient z : ℝ) := ha₀.trans_le hcz.1 + have hczpos : 0 < coefficient z := by exact_mod_cast hcpos + let c : ℕ := (coefficient z).toNat + have hcZ : (c : ℤ) = coefficient z := Int.toNat_of_nonneg hczpos.le + have hcR : (c : ℝ) = (coefficient z : ℝ) := by exact_mod_cast hcZ + have hc : 0 < c := Nat.cast_pos.mp (by rw [hcR]; exact hcpos) + have hscaled : ζ ≤ ‖(FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character ((booleanBlockPhase (fun S => (coefficient z : ℝ) * ξ S) + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle))‖ := by + simpa only [booleanBlockPhase_frequency_mul] using hbias.trans hnorm + obtain ⟨D, hD, hDb, a, happ⟩ := polynomial_affine_weightedCubeBlock_major_arc s A hA h hζ hζ1 hlen u v hv hstride + (fun S => (coefficient z : ℝ) * ξ S) J hJ hscaled + have hbound : 0 ≤ (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card := + (Nat.cast_nonneg D).trans hDb + refine ⟨c * D, Nat.mul_pos hc hD, ?_, a, ?_⟩ + · rw [Nat.cast_mul, hcR] + exact (mul_le_mul_of_nonneg_left hDb hcpos.le).trans + (mul_le_mul_of_nonneg_right hcz.2 hbound) + · intro S + rw [Nat.cast_mul, hcR] + have heq : (coefficient z : ℝ) * (ξ S - (a S : ℝ) / ((coefficient z : ℝ) * D)) = + (coefficient z : ℝ) * ξ S - (a S : ℝ) / D := by + field_simp [hcpos.ne', (Nat.cast_pos.mpr hD : (0 : ℝ) < D).ne'] + have hmul : (coefficient z : ℝ) * |ξ S - (a S : ℝ) / ((coefficient z : ℝ) * D)| ≤ + localizedMajorArcErrorBudget n U ζ / ∏ j, ((s j).length : ℝ) := by + calc + _ = |(coefficient z : ℝ) * (ξ S - (a S : ℝ) / ((coefficient z : ℝ) * D))| := by + rw [abs_mul, abs_of_pos hcpos] + _ = _ := congrArg abs heq + _ ≤ _ := happ S + calc + _ ≤ (localizedMajorArcErrorBudget n U ζ / ∏ j, ((s j).length : ℝ)) / a₀ := + (le_div_iff₀ ha₀).mpr ((mul_comm _ _).trans_le + ((mul_le_mul_of_nonneg_right hcz.1 (abs_nonneg _)).trans hmul)) + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AffineTorusDensityIncrement.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AffineTorusDensityIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..69d2fadeff253bfab5bfc8e19338364d1585c484 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AffineTorusDensityIncrement.lean @@ -0,0 +1,160 @@ +import OAI.Combinatorics.Progressions.Estimates.ProgressionPartitionComposition +import OAI.Combinatorics.Progressions.Estimates.SimultaneousDirichlet + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +variable {ι : Type*} [Fintype ι] + +theorem periodic_lipschitz_dist_le_of_integer_approx + {F : (ι → ℝ) → ℝ} {L : ℝ≥0} (hF : LipschitzWith L F) + (hperiod : ∀ x : ι → ℝ, ∀ m : ι → ℤ, F (fun i => x i + m i) = F x) + (x y : ι → ℝ) (m : ι → ℤ) {ε : ℝ} (hε : 0 ≤ ε) + (hclose : ∀ i, |x i - (y i + m i)| ≤ ε) : + dist (F x) (F y) ≤ L * ε := by + have hdist : dist x (fun i => y i + m i) ≤ ε := by + apply (dist_pi_le_iff hε).mpr + intro i + simpa only [Real.dist_eq] using hclose i + have h := hF.dist_le_mul x (fun i => y i + m i) + rw [hperiod] at h + exact h.trans (mul_le_mul_of_nonneg_left hdist L.coe_nonneg) + +omit [Fintype ι] in +theorem affine_phase_block_error {N q H Q : ℕ} (hq : 0 < q) + (hH : 0 < H) (hQ : 0 < Q) (alpha beta : ι → ℝ) (m : ι → ℤ) + (happrox : ∀ i, |(q : ℝ) * alpha i - m i| ≤ 1 / (Q : ℝ)) + (n : Fin N) (i : ι) : + |((n.val : ℝ) * alpha i + beta i) - + (((progressionBlockStart (progressionBlockLabel q H hq n) : ℕ) : ℝ) * alpha i + + beta i + ((n.val / q % H : ℕ) : ℝ) * m i)| ≤ (H : ℝ) / Q := by + have hn : (n.val : ℝ) = + (progressionBlockStart (progressionBlockLabel q H hq n) : ℝ) + + (q : ℝ) * (n.val / q % H : ℕ) := by + exact_mod_cast (progressionBlock_reconstruct (H := H) hq n).symm + have hoff : ((n.val / q % H : ℕ) : ℝ) ≤ H := by + exact_mod_cast (Nat.mod_lt (n.val / q) hH).le + calc + _ = |((n.val / q % H : ℕ) : ℝ) * ((q : ℝ) * alpha i - m i)| := by + congr 1 + rw [hn] + ring + _ = ((n.val / q % H : ℕ) : ℝ) * |(q : ℝ) * alpha i - m i| := by + rw [abs_mul, abs_of_nonneg (Nat.cast_nonneg _)] + _ ≤ ((n.val / q % H : ℕ) : ℝ) * (1 / (Q : ℝ)) := + mul_le_mul_of_nonneg_left (happrox i) (Nat.cast_nonneg _) + _ ≤ (H : ℝ) * (1 / (Q : ℝ)) := + mul_le_mul_of_nonneg_right hoff (by positivity) + _ = _ := by ring + +theorem affine_torus_block_error {N q H Q : ℕ} (hq : 0 < q) + (hH : 0 < H) (hQ : 0 < Q) (alpha beta : ι → ℝ) (m : ι → ℤ) + (happrox : ∀ i, |(q : ℝ) * alpha i - m i| ≤ 1 / (Q : ℝ)) + {F : (ι → ℝ) → ℝ} {L : ℝ≥0} (hF : LipschitzWith L F) + (hperiod : ∀ x : ι → ℝ, ∀ m : ι → ℤ, F (fun i => x i + m i) = F x) + (n : Fin N) : + dist (F (fun i => (n.val : ℝ) * alpha i + beta i)) + (F (fun i => (progressionBlockStart (progressionBlockLabel q H hq n) : ℝ) * + alpha i + beta i)) ≤ L * ((H : ℝ) / Q) := by + apply periodic_lipschitz_dist_le_of_integer_approx hF hperiod + _ _ (fun i => (n.val / q % H : ℕ) * m i) (by positivity) + intro i + simpa only [Int.cast_mul, Int.cast_natCast] using + affine_phase_block_error hq hH hQ alpha beta m happrox n i + +theorem exists_affine_torus_progression_partition {N H : ℕ} (hH : 0 < H) + (hsize : H ^ (2 * Fintype.card ι + 1) ≤ N) (alpha beta : ι → ℝ) + {F : (ι → ℝ) → ℝ} {L : ℝ≥0} (hF : LipschitzWith L F) + (hperiod : ∀ x : ι → ℝ, ∀ m : ι → ℤ, F (fun i => x i + m i) = F x) : + ∃ q : ℕ, ∃ hq : 0 < q, q ≤ H ^ (2 * Fintype.card ι) ∧ + Fintype.card (Fin q × Fin (N / q / H + 1)) * H ≤ 2 * N ∧ + ∀ n : Fin N, + dist (F (fun i => (n.val : ℝ) * alpha i + beta i)) + (F (fun i => (progressionBlockStart (progressionBlockLabel q H hq n) : ℝ) * + alpha i + beta i)) ≤ (L : ℝ) / H := by + obtain ⟨q, hq, hqbound, m, hm⟩ := simultaneous_dirichlet alpha (H ^ 2) (pow_pos hH _) + rw [← pow_mul] at hqbound + have hfit : q * H ≤ N := by + calc + _ ≤ H ^ (2 * Fintype.card ι) * H := Nat.mul_le_mul_right H hqbound + _ = H ^ (2 * Fintype.card ι + 1) := (pow_succ _ _).symm + _ ≤ N := hsize + refine ⟨q, hq, hqbound, progressionBlock_label_count_mul_le_twice hfit, ?_⟩ + intro n + have h := affine_torus_block_error hq hH (pow_pos hH 2) alpha beta m hm hF hperiod n + have hHR : (H : ℝ) ≠ 0 := by exact_mod_cast hH.ne' + convert h using 1 + push_cast + field_simp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem affine_torus_density_increment {ι : Type*} [Fintype ι] + {N H : ℕ} (hH : 0 < H) (hsize : H ^ (2 * Fintype.card ι + 1) ≤ N) + (alpha beta : ι → ℝ) (f : ℕ → ℝ) {F : (ι → ℝ) → ℝ} {L : ℝ≥0} + (hF : LipschitzWith L F) + (hperiod : ∀ x : ι → ℝ, ∀ m : ι → ℤ, F (fun i => x i + m i) = F x) + (hF01 : ∀ x, F x ∈ Set.Icc (0 : ℝ) 1) + (hf : ∀ n < N, f n ∈ Set.Icc (0 : ℝ) 1) + {b σ : ℝ} (hb : b ∈ Set.Icc (0 : ℝ) 1) (hσ : 0 < σ) + (hsmall : 4 * (L : ℝ) ≤ σ * H) + (hscore : σ ≤ 𝔼 n : Fin N, + (f n.val - b) * F (fun i => (n.val : ℝ) * alpha i + beta i)) : + ∃ q a len : ℕ, 0 < q ∧ q ≤ H ^ (2 * Fintype.card ι) ∧ + σ * H / 4 ≤ len ∧ len ≤ H ∧ + (∀ j < len, a + q * j < N) ∧ + b < 𝔼 j : Fin len, f (a + q * j.val) := by + have hN : 0 < N := (pow_pos hH _).trans_le hsize + let : NeZero N := ⟨hN.ne'⟩ + have hNR : (0 : ℝ) < N := by exact_mod_cast hN + have hHR : (0 : ℝ) < H := by exact_mod_cast hH + obtain ⟨q, hq, hqbound, hcount, hosc⟩ := + exists_affine_torus_progression_partition hH hsize alpha beta hF hperiod + let cell := progressionBlockLabel (N := N) q H hq + let B (n : Fin N) := F (fun i => (n.val : ℝ) * alpha i + beta i) + let c (i : Fin q × Fin (N / q / H + 1)) := + F (fun j => (progressionBlockStart i : ℝ) * alpha j + beta j) + have hcountR : (Fintype.card (Fin q × Fin (N / q / H + 1)) : ℝ) * H ≤ 2 * N := by + exact_mod_cast hcount + have hcost : (Fintype.card (Fin q × Fin (N / q / H + 1)) : ℝ) * + (σ * H / 4) / N ≤ σ / 2 := by + apply (div_le_iff₀ hNR).mpr + nlinarith [mul_le_mul_of_nonneg_left hcountR hσ.le] + have hoscSmall : (L : ℝ) / H ≤ σ / 4 := by + apply (div_le_iff₀ hHR).mpr + nlinarith + obtain ⟨i, hlarge, hdense⟩ := exists_large_cell_of_normalized_score cell + (fun n => f n.val) B c (b := b) (ω := (L : ℝ) / H) (σ := σ) + (σ * H / 4) (by positivity) (fun n => hf n.val n.isLt) hb + (fun n => hF01 _) (fun i => (hF01 _).1) (by positivity) + (fun n => by simpa only [B, c, cell, Real.dist_eq] using hosc n) + hscore (by simp only [Fintype.card_fin]; linarith) + let len := truncatedProgressionLength N (progressionBlockStart i) q H + refine ⟨q, progressionBlockStart i, len, hq, hqbound, ?_, ?_, ?_, ?_⟩ + · simpa only [cell, progressionBlock_card hq hH] using hlarge + · by_cases ha : progressionBlockStart i < N + · simpa only [len, truncatedProgressionLength, ite_eq_left ha] using + (min_le_left H ((N - 1 - progressionBlockStart i) / q + 1)) + · simp only [len, truncatedProgressionLength, ite_eq_right ha, Nat.zero_le] + · intro j hj + exact ((lt_truncatedProgressionLength_iff hq).mp hj).2 + · simpa only [cell, progressionBlock_expect hq hH] using hdense + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AffineTorusGeometry.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AffineTorusGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d1dd238c47afd53d844edfe1cd92393b9ac0676 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AffineTorusGeometry.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Estimates.WeightedCubePlateau +import OAI.Combinatorics.Progressions.Lattices.AffineBlockScale + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def affineTorusRadius (q g b : ℕ) (C V : ℝ) : ℕ := + ⌈affineBlockScaleBound q g b C V⌉₊ + +noncomputable def affineTorusFactor (q g b : ℕ) (C V : ℝ) : ℕ := + 2 * affineTorusRadius q g b C V + 1 + +theorem affineTorusFactor_pos (q g b : ℕ) (C V : ℝ) : 0 < affineTorusFactor q g b C V := by + unfold affineTorusFactor + omega + +instance affineTorusFactor_neZero (q g b : ℕ) (C V : ℝ) : NeZero (affineTorusFactor q g b C V) := + ⟨(affineTorusFactor_pos q g b C V).ne'⟩ + +theorem affineTorusFactor_le (q g b : ℕ) {C V : ℝ} (hC : 0 ≤ C) (hV : 0 ≤ V) : + (affineTorusFactor q g b C V : ℝ) ≤ 2 * affineBlockScaleBound q g b C V + 3 := by + exact integerSupportTorusFactor_upper (affineBlockScaleBound_nonneg q g b hC hV) + +theorem affineWeightedCube_bound_le_torus {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n K : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (u : B → Fin (n + 1) → Option I → ℤ) (v : B → Fin (n + 1) → Option I → ℕ) + {C V : ℝ} (hC : 0 ≤ C) + (hcoord : ∀ b j i, |(u b j i : ℝ)| + (v b j i : ℝ) * (s b j).length ≤ C * (s b j).length) + (hvol : ∀ b, (∏ j, ((s b j).length : ℝ)) ≤ V * K) + (S : Finset I) (hS : S.card ≤ n + 1) : + affineWeightedCubeJetBound s u v S ≤ + (affineTorusRadius (Fintype.card I) (n + 1) (Fintype.card B) C V : ℤ) * K := by + have h := (affineWeightedCubeJetBound_le_scale s u v hC hcoord hvol S hS).trans + (mul_le_mul_of_nonneg_right (Nat.le_ceil _) (Nat.cast_nonneg K)) + exact_mod_cast h + +theorem affineWeightedModerate_bound_le_torus {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n 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 → ℕ) + {C V : ℝ} (hC : 0 ≤ C) + (hcoord : ∀ b j i, |(u b j i : ℝ)| + (v b j i : ℝ) * (s b j).length ≤ C * (s b j).length) + (hvol : ∀ b, (|(offset b : ℝ)| + (stride b : ℝ) * (c b).length) * + (∏ j, ((s b j).length : ℝ)) ≤ V * K) + (S : Finset I) (hS : S.card ≤ n) : + affineWeightedModerateJetBound c s offset stride u v S ≤ + (affineTorusRadius (Fintype.card I) n (Fintype.card B) C V : ℤ) * K := by + have h := (affineWeightedModerateJetBound_le_scale c s offset stride u v hC + hcoord hvol S hS).trans (mul_le_mul_of_nonneg_right (Nat.le_ceil _) (Nat.cast_nonneg K)) + exact_mod_cast h + +theorem affineModerate_physical_volume_lower {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + {t : ℕ} (ht : 0 < t) {K D : ℝ} (hD : 0 ≤ D) + (hlower : K ≤ D * ((c.length : ℝ) * ∏ j, ((s j).length : ℝ))) : + K ≤ D * ((((t * c.modulus none : ℕ) : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) := by + have hm : (1 : ℝ) ≤ (t * c.modulus none : ℕ) := by exact_mod_cast Nat.mul_pos ht (c.modulus_pos none) + apply hlower.trans + apply mul_le_mul_of_nonneg_left _ hD + have hp : 0 ≤ (c.length : ℝ) * ∏ j, ((s j).length : ℝ) := by positivity + simpa only [one_mul, mul_assoc] using mul_le_mul_of_nonneg_right hm hp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AffineUniformSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AffineUniformSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..4cb88e933bfb7786b6438dda19780519007de195 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AffineUniformSpectrum.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Lattices.AffineBlockScale + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem affine_weightedCube_uniform_spectrum {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 → ℕ) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) (hε : 0 < ε) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) (hlen : ∀ b j, L ≤ (s b j).length) + (hv : ∀ b j i, 0 < v b j i) (hstride : ∀ b j i, ((v b j i * (s b j).modulus i : ℕ) : ℝ) ≤ U) + (M t : ℕ) (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : uniformSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (hscale : ∀ b, (M : ℝ) / ∏ j, ((s b j).length : ℝ) ≤ V) : + let ζ := uniformBlockRetainedBias n J.card t U V W ε + let S := uniformBlockSpectrumCover J M n U V L ζ + spectrumTail S (fun k => ‖∏ b, affineWeightedCubeGridCoefficient (s b) (u b) (v b) M J k‖) ≤ ε ∧ + (∑ k, ‖∏ b, affineWeightedCubeGridCoefficient (s b) (u b) (v b) M J k‖) ≤ + uniformSpectrumAbsoluteCap n J.card t U V W := by + let c b := affineWeightedCubeGridCoefficient (s b) (u b) (v b) M J + have hminor : ∀ δ, 0 < δ → δ ≤ 1 → majorArcLengthConstant n U / δ ^ majorArcLengthExponent n ≤ L → + ∀ b k, k ∉ polynomialGridCover J M (majorArcCoverConstant n (Fintype.card J) U V) + (majorArcCoverExponent n (Fintype.card J)) δ → ‖c b k‖ ≤ δ := by + intro δ hδ hδ1 hlength b k hk + apply le_of_lt (lt_of_not_ge (fun hh => hk ?_)) + simpa only [Fintype.card_coe] using affineWeightedCubeGridCoefficient_mem_cover (s b) A hA (h b) + hV hδ hδ1 (fun j => hlength.trans (hlen b j)) (u b) (v b) (hv b) (hstride b) + hM (hscale b) J hJ k hh + have hB' : uniformSpectrumBlockCount n (Fintype.card J) t ≤ Fintype.card B := by simpa only [Fintype.card_coe] using hB + have hsize' : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t := by simpa only [Fintype.card_coe] using hsize + obtain ⟨hζ, hζ1, hacc⟩ := uniformBlockRetainedBias_spec n (Fintype.card J) t hU hW hε + constructor + · simpa only [c, Fintype.card_coe] using uniformBlockSpectrum_tail M n t c hU hV hW hL + hζ hζ1 hε.le hB' hsize' hminor hacc + · simpa only [c, Fintype.card_coe] using uniformBlockSpectrum_absolute_cap M n t c hU hV hW hL + hB' hsize' (fun b k => affineWeightedCubeGridCoefficient_norm_le_one (s b) (u b) (v b) M J k) hminor + +theorem affine_weightedModerate_uniform_spectrum {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (shift : B → ℝ) (stride : B → ℕ) (u : B → Fin n → Option I → ℝ) (v : B → Fin n → Option I → ℕ) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) (hε : 0 < ε) + (hc : ∀ b, ScalarCubePrimitiveBudget (c b) A U) (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hclen : ∀ b, L ≤ (c b).length) (hlen : ∀ b j, L ≤ (s b j).length) + (ht : ∀ b, 0 < stride b) (hv : ∀ b j i, 0 < v b j i) + (hstride : ∀ b j i, ((v b j i * (s b j).modulus i : ℕ) : ℝ) ≤ U) + (hcoeff : ∀ b, ((stride b * (c b).modulus none : ℕ) : ℝ) ≤ U) + (M t : ℕ) (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hB : uniformSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (hscale : ∀ b, (M : ℝ) / ((((stride b * (c b).modulus none : ℕ) : ℝ) * (c b).length) * + ∏ j, ((s b j).length : ℝ)) ≤ V) : + let ζ := uniformBlockRetainedBias n J.card t U V W ε + let S := uniformBlockSpectrumCover J M n U V L ζ + spectrumTail S (fun k => ‖∏ b, affineWeightedModerateGridCoefficient (c b) (s b) (shift b) (stride b) (u b) (v b) M J k‖) ≤ ε ∧ + (∑ k, ‖∏ b, affineWeightedModerateGridCoefficient (c b) (s b) (shift b) (stride b) (u b) (v b) M J k‖) ≤ + uniformSpectrumAbsoluteCap n J.card t U V W := by + let f b := affineWeightedModerateGridCoefficient (c b) (s b) (shift b) (stride b) (u b) (v b) M J + have hminor : ∀ δ, 0 < δ → δ ≤ 1 → majorArcLengthConstant n U / δ ^ majorArcLengthExponent n ≤ L → + ∀ b k, k ∉ polynomialGridCover J M (majorArcCoverConstant n (Fintype.card J) U V) + (majorArcCoverExponent n (Fintype.card J)) δ → ‖f b k‖ ≤ δ := by + intro δ hδ hδ1 hlength b k hk + apply le_of_lt (lt_of_not_ge (fun hh => hk ?_)) + simpa only [Fintype.card_coe] using affineWeightedModerateGridCoefficient_mem_cover (c b) (s b) A hA + (hc b) (h b) hV hδ hδ1 (hlength.trans (hclen b)) (fun j => hlength.trans (hlen b j)) + (shift b) (stride b) (ht b) (u b) (v b) (hv b) (hstride b) (hcoeff b) hM (hscale b) J hJ k hh + have hB' : uniformSpectrumBlockCount n (Fintype.card J) t ≤ Fintype.card B := by simpa only [Fintype.card_coe] using hB + have hsize' : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t := by simpa only [Fintype.card_coe] using hsize + obtain ⟨hζ, hζ1, hacc⟩ := uniformBlockRetainedBias_spec n (Fintype.card J) t hU hW hε + constructor + · simpa only [f, Fintype.card_coe] using uniformBlockSpectrum_tail M n t f hU hV hW hL + hζ hζ1 hε.le hB' hsize' hminor hacc + · simpa only [f, Fintype.card_coe] using uniformBlockSpectrum_absolute_cap M n t f hU hV hW hL hB' hsize' + (fun b k => affineWeightedModerateGridCoefficient_norm_le_one (c b) (s b) (shift b) (stride b) (u b) (v b) M J k) hminor + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedCorrelatedModerateSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedCorrelatedModerateSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bfc6a9d6dc9c7bfcedd9c44055ea3a390e94080 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedCorrelatedModerateSpectrum.lean @@ -0,0 +1,237 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedPrincipalSourceScale +import OAI.Combinatorics.Progressions.Lattices.AllocatedResidueInterpolationMixture +import OAI.Combinatorics.Progressions.Lattices.WeightedIntegerGridDensityTail + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +variable {K T γ : ℝ} (hK : 0 < K) (hT : 0 < T) (hγ : 0 < γ) + (hlarge : 8 * (probabilityProfileLipschitz : ℝ) ≤ (γ / 2) * (K / T)) + (q : ℕ) [NeZero q] (hq : 0 < q) + +include hq in +theorem principalCorrelatedModerate_spectrum_tail + {B I : Type*} [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] {n : ℕ} + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (a : (B → ZMod q) → ℂ) (ha : ∀ r, ‖a r‖ ≤ 1) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} {t : ℕ} + (hUlong : scalarCubePrimitiveEnvelope Empty A 32 (256 * probabilityProfileLipschitz) q ≤ U) + (hUshort : scalarCubePrimitiveEnvelope Empty A 1 0 + (scalarCubeNormalizationThreshold Empty q 32 (256 * probabilityProfileLipschitz) + 1) ≤ U) + (hs : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hlen : ∀ b j, L ≤ (s b j).length) + {M : ℕ} [NeZero M] (hM : 0 < M) + (hscale : ∀ b, (M : ℝ) / ((principalIntervalLength K T γ : ℝ) * + ∏ j, ((s b j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) (shift : J → ℤ) + (hB : positiveModerateSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant n J.card U (4 * V) * + 2 ^ positiveModerateSpectrumExponent n J.card + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ ε) : + spectrumTail (positiveModerateSpectrumCover J M n U (4 * V) L ζ) + (fun k => ‖(weightedModerateIntegerProductSource + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s).complexMean (fun x => + a (fun b => ((x b).1 none : ℤ)) * rectangularGridCharacter M k + (weightedModerateIntegerJetSum + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s J + (fun _ => 0) shift x))‖) ≤ ε := by + let N := scalarCubeNormalizationThreshold Empty q 32 (256 * probabilityProfileLipschitz) + by_cases hlong : N ≤ principalIntervalLength K T γ + · simp_rw [weightedModerateIntegerJetSum_residue_coefficient, + norm_mul, rectangularGridCharacter_norm, one_mul] + apply principalCoefficientResidue_correlated_spectrum_tail hK hT hγ hlarge q hq hlong + s a ha A hA hUlong hs (by positivity) hW hL hζ hζ1 hε hlen hM + (fun b => (hscale b).trans (by linarith)) J hJ hB hsize haccuracy + · exact weightedModerateIntegerProductSource_short_correlated_spectrum_tail + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s + (fun z => a (fun b => ((z b none : ℤ) : ZMod q))) (fun z => ha _) + (fun _ => principalNormalizedSource_positive_support hK hT hγ hlarge) + (fun _ => (Nat.lt_of_not_ge hlong).le) A hA + ((fixedPositiveCoefficientSource_primitive N A).one_le.trans hUshort) + hUshort hs hV hW hL hζ hζ1 hε hlen hM hscale J hJ shift hB hsize haccuracy + +include hq in + +theorem principalCorrelatedModerate_gridDensity_error + {B I : Type*} [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] {n : ℕ} + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (a : (B → ZMod q) → ℂ) (ha : ∀ r, ‖a r‖ ≤ 1) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} {t : ℕ} + (hUlong : scalarCubePrimitiveEnvelope Empty A 32 (256 * probabilityProfileLipschitz) q ≤ U) + (hUshort : scalarCubePrimitiveEnvelope Empty A 1 0 + (scalarCubeNormalizationThreshold Empty q 32 (256 * probabilityProfileLipschitz) + 1) ≤ U) + (hs : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hlen : ∀ b j, L ≤ (s b j).length) + {M : ℕ} [NeZero M] (hM : 0 < M) + (hscale : ∀ b, (M : ℝ) / ((principalIntervalLength K T γ : ℝ) * + ∏ j, ((s b j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) (shift : J → ℤ) + (hB : positiveModerateSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant n J.card U (4 * V) * + 2 ^ positiveModerateSpectrumExponent n J.card + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ ε) + (Kgrid : ℕ) (z : J → ℤ) : + ‖(Kgrid : ℂ) ^ J.card * + (weightedModerateIntegerProductSource + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s).complexMean + (fun x => if integerGridResidue M (weightedModerateIntegerJetSum + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s J + (fun _ => 0) shift x) = integerGridResidue M z + then a (fun b => ((x b).1 none : ℤ)) else 0) - + ((Kgrid : ℂ) / M) ^ J.card * + ∑ k ∈ positiveModerateSpectrumCover J M n U (4 * V) L ζ, + (weightedModerateIntegerProductSource + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s).complexMean + (fun x => a (fun b => ((x b).1 none : ℤ)) * rectangularGridCharacter M k + (weightedModerateIntegerJetSum + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s J + (fun _ => 0) shift x)) * star (rectangularGridCharacter M k z)‖ ≤ + ((Kgrid : ℝ) / M) ^ J.card * ε := by + have ht := principalCorrelatedModerate_spectrum_tail hK hT hγ hlarge q hq + s a ha A hA hUlong hUshort hs hV hW hL hζ hζ1 hε hlen hM hscale J hJ shift + hB hsize haccuracy + simpa only [Fintype.card_coe] using weighted_integerGridDensity_error_of_tail + (weightedModerateIntegerProductSource + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s) + (weightedModerateIntegerJetSum + (fun _ : B => principalNormalizedSource hK hT hγ hlarge) s J (fun _ => 0) shift) + (fun x => a (fun b => ((x b).1 none : ℤ))) Kgrid M + (positiveModerateSpectrumCover J M n U (4 * V) L ζ) ht z + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (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 → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (j : Fin m) (i : Fin (n j)) +variable (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i) +variable (q : ℕ) [NeZero q] (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : (Fintype.card α + 1) * q ≤ S.value) (hR : ∀ j, 0 < R j) + +local notation "sources" => allocatedActiveResidueSources B U basis S j i hactive q hq r hsize +local notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactive +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +theorem allocatedCorrelatedModerateSpectrum_tail + (a : (B ⟨j, Sum.inr i⟩ → ZMod q) → ℂ) (ha : ∀ x, ‖a x‖ ≤ 1) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) + (hcLongP : scalarCubePrimitiveEnvelope Empty A 32 (256 * probabilityProfileLipschitz) q ≤ P) + (hcShortP : scalarCubePrimitiveEnvelope Empty A 1 0 + (scalarCubeNormalizationThreshold Empty q 32 (256 * probabilityProfileLipschitz) + 1) ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + {C W ζ ε : ℝ} {t M : ℕ} [NeZero M] (hC : 0 ≤ C) (hW : 0 ≤ W) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) (hM : 0 < M) + (hMK : (M : ℝ) ≤ C * basisAxisScale (basis j) i) + (rows : Finset (Finset α)) (hrows : ∀ s ∈ rows, s.card ≤ j.val + 1) + (shift : rows → ℤ) + (hB : positiveModerateSpectrumBlockCount j.val rows.card t ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (hcard : (M : ℝ) ^ rows.card ≤ W * (S.value : ℝ) ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant j.val rows.card P (4 * (C / (2 * gamma))) * + 2 ^ positiveModerateSpectrumExponent j.val rows.card + + W * (2 ^ positiveModerateLengthExponent j.val * positiveModerateLengthConstant j.val P) ^ t) * ζ ≤ ε) : + spectrumTail + (positiveModerateSpectrumCover rows M j.val P (4 * (C / (2 * gamma))) S.value ζ) + (fun k => ‖(weightedModerateIntegerProductSource + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources).complexMean (fun x => + a (fun b => ((x b).1 none : ℤ)) * rectangularGridCharacter M k + (weightedModerateIntegerJetSum + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources rows (fun _ => 0) shift x))‖) ≤ ε := by + have hs (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + ScalarCubePrimitiveBudget ((sources) b v) A P := + (allocatedActiveResidueSources_primitive B U basis S j i hactive q hq r hsize b v A).mono hsP + have hlength (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + (S.value : ℝ) ≤ ((sources) b v).length := by + rw [allocatedActiveResidueSources_length B U basis S j i hactive q hq r hsize b v] + have hproduct (b : B ⟨j, Sum.inr i⟩) : + (∏ v : Fin (j.val + 1), (((sources) b v).length : ℝ)) = + (S.value : ℝ) ^ (j.val + 1) := by + simp only [allocatedActiveResidueSources_length B U basis S j i hactive q hq r hsize, + Finset.prod_const, Finset.card_univ, Fintype.card_fin] + have hscale (b : B ⟨j, Sum.inr i⟩) : + (M : ℝ) / (((csource).length : ℝ) * ∏ v, (((sources) b v).length : ℝ)) ≤ + C / (2 * gamma) := by + rw [hproduct b] + exact allocatedPrincipalNormalizedSource_grid_ratio B U basis hR S j i hactive hC hMK + have hgamma : 0 < gamma := principalProfileSize_pos (hR j) _ + exact principalCorrelatedModerate_spectrum_tail + (K := (basisAxisScale (basis j) i : ℝ)) (T := (S.value : ℝ) ^ (j.val + 1)) (γ := gamma) + (by exact_mod_cast basisAxisScale_pos (basis j) i) + (pow_pos (by exact_mod_cast S.positive) _) hgamma + (integerAxisPrincipal_width (Nat.zero_lt_succ _) S.positive hgamma (S.gap j i hactive)) + q hq sources a ha A hA hcLongP hcShortP hs (div_nonneg hC (by positivity)) hW + (Nat.cast_nonneg S.value) hζ hζ1 hε hlength hM hscale rows hrows shift hB hcard haccuracy + +theorem allocatedCorrelatedModerate_gridDensity_error + (a : (B ⟨j, Sum.inr i⟩ → ZMod q) → ℂ) (ha : ∀ x, ‖a x‖ ≤ 1) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) + (hcLongP : scalarCubePrimitiveEnvelope Empty A 32 (256 * probabilityProfileLipschitz) q ≤ P) + (hcShortP : scalarCubePrimitiveEnvelope Empty A 1 0 + (scalarCubeNormalizationThreshold Empty q 32 (256 * probabilityProfileLipschitz) + 1) ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + {C W ζ ε : ℝ} {t M : ℕ} [NeZero M] (hC : 0 ≤ C) (hW : 0 ≤ W) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) (hM : 0 < M) + (hMK : (M : ℝ) ≤ C * basisAxisScale (basis j) i) + (rows : Finset (Finset α)) (hrows : ∀ s ∈ rows, s.card ≤ j.val + 1) + (shift : rows → ℤ) + (hB : positiveModerateSpectrumBlockCount j.val rows.card t ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (hcard : (M : ℝ) ^ rows.card ≤ W * (S.value : ℝ) ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant j.val rows.card P (4 * (C / (2 * gamma))) * + 2 ^ positiveModerateSpectrumExponent j.val rows.card + + W * (2 ^ positiveModerateLengthExponent j.val * positiveModerateLengthConstant j.val P) ^ t) * ζ ≤ ε) + (Kgrid : ℕ) (z : rows → ℤ) : + ‖(Kgrid : ℂ) ^ rows.card * + (weightedModerateIntegerProductSource + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources).complexMean + (fun x => if integerGridResidue M (weightedModerateIntegerJetSum + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources rows (fun _ => 0) shift x) = + integerGridResidue M z + then a (fun b => ((x b).1 none : ℤ)) else 0) - + ((Kgrid : ℂ) / M) ^ rows.card * + ∑ k ∈ positiveModerateSpectrumCover rows M j.val P (4 * (C / (2 * gamma))) S.value ζ, + (weightedModerateIntegerProductSource + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources).complexMean + (fun x => a (fun b => ((x b).1 none : ℤ)) * rectangularGridCharacter M k + (weightedModerateIntegerJetSum + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources rows (fun _ => 0) shift x)) * + star (rectangularGridCharacter M k z)‖ ≤ + ((Kgrid : ℝ) / M) ^ rows.card * ε := by + have ht := allocatedCorrelatedModerateSpectrum_tail B U basis S j i hactive q hq r hsize hR + a ha A hA P hcLongP hcShortP hsP hC hW hζ hζ1 hε hM hMK rows hrows shift hB hcard haccuracy + simpa only [Fintype.card_coe] using weighted_integerGridDensity_error_of_tail + (weightedModerateIntegerProductSource (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources) + (weightedModerateIntegerJetSum + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources rows (fun _ => 0) shift) + (fun x => a (fun b => ((x b).1 none : ℤ))) Kgrid M + (positiveModerateSpectrumCover rows M j.val P (4 * (C / (2 * gamma))) S.value ζ) ht z + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedCutoffFourierBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedCutoffFourierBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e01d51c83ddbb3725107aedde30f654fe7b0e3c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedCutoffFourierBudget.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedCutoffLipschitzBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module +open scoped BigOperators Classical NNReal + +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 (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] +variable (rowSets : Fin m → Finset (Finset α)) +variable (C V : Fin m → ℝ≥0) {P : ℝ} (hnum : AllocatedSourceNumerics B U b S C V P) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "H" => (2 : ℝ) ^ Fintype.card α + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + +local notation "amp" => ‖((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹‖ +local notation "ampN" => ‖((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹‖₊ + +include hnum in +theorem allocatedNormalizedCutoff_fourier_budget + (hR : ∀ j, 0 < R j) + (hV : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (r : ℝ≥0) (hr : 1 ≤ r) {η E Psp : ℝ} + (hE : 0 ≤ E) (hPsp : 0 ≤ Psp) (hηE : η⁻¹ ≤ Real.exp E) : + let L := allocatedCutoffFourierLog m (Fintype.card α) P (normalizedSiteCutoffBound : ℝ) E + let Q := allocatedCutoffSamplingLog m (Fintype.card α) P (normalizedSiteCutoffBound : ℝ) E Psp + 0 ≤ L ∧ 0 ≤ Q ∧ Psp ≤ Q ∧ P ≤ Q ∧ + (Fintype.card (JetAmbientIndex rowTypes J) : ℝ) ≤ L ∧ η⁻¹ ≤ Real.exp L ∧ + ((ampN * (Fintype.card (Finset α) * + (((Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * + ((⟨Real.exp P, (Real.exp_pos P).le⟩ : ℝ≥0) * ∑ j, C j * Fintype.card (J j))) * + ∑ j, (Finset.card (rowSets j) : ℝ≥0)))) : ℝ) ≤ Real.exp L ∧ + Real.exp ((2 * L + 2) ^ 4) ≤ Real.exp Q ∧ + Real.exp (2 * L * (2 * L + 2) ^ 4) * amp ≤ Real.exp Q := by + intro L Q + obtain ⟨hL, haL, hlL, hdL, heL, hpL⟩ := allocatedCutoffFourierLog_bounds m (Fintype.card α) + hnum.nonneg normalizedSiteCutoffBound.coe_nonneg hE + obtain ⟨hQ, hspQ, hLQ, hfQ, hcQ⟩ := allocatedCutoffSamplingLog_bounds m (Fintype.card α) + hnum.nonneg normalizedSiteCutoffBound.coe_nonneg hE hPsp + have hd := (allocatedNormalizedCutoff_dimensions B U b S rowSets C V hnum).2.2.2 + have hl := allocatedNormalizedCutoff_lipschitz_budget B U b S rowSets C V hnum hR hV r hr + have ha : amp ≤ Real.exp (allocatedCutoffAmplitudeLog m (Fintype.card α) P) := by + simpa only [allocatedCutoffAmplitudeLog, Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat] using + allocatedProductIdealNormalizer_source_budget B U b S rowSets hR C V hnum hV + refine ⟨hL, hQ, hspQ, hpL.trans hLQ, hd.trans hdL, + hηE.trans (Real.exp_le_exp.mpr heL), hl.trans (Real.exp_le_exp.mpr hlL), + Real.exp_le_exp.mpr hfQ, ?_⟩ + calc + _ ≤ Real.exp (2 * L * (2 * L + 2) ^ 4) * Real.exp L := + mul_le_mul_of_nonneg_left (ha.trans (Real.exp_le_exp.mpr haL)) (Real.exp_pos _).le + _ = Real.exp (2 * L * (2 * L + 2) ^ 4 + L) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr hcQ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedErrorFourierBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedErrorFourierBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..f0e62a706679aef1b7125ae4db93a9628139f3a7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedErrorFourierBudget.lean @@ -0,0 +1,95 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedReferenceIdealBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical NNReal + +noncomputable def allocatedErrorFourierInput {A : Type*} [Semiring A] (m : ℕ) (p : A) : A := + allocatedErrorPrimitiveLog m p + allocatedErrorKernelLog (allocatedErrorPrimitiveLog m p) + +noncomputable def allocatedErrorFourierOutput {A : Type*} [Semiring A] (m : ℕ) (p : A) : A := + let L := allocatedErrorFourierInput m p + p + 2 * L * (2 * L + 2) ^ 4 + L + (2 * L + 2) ^ 4 + +theorem allocatedErrorFourier_budgets (m : ℕ) {p : ℝ} (hp : 0 ≤ p) : + let T := allocatedErrorPrimitiveLog m p + let L := allocatedErrorFourierInput m p + let P := allocatedErrorFourierOutput m p + 0 ≤ L ∧ p ≤ L ∧ T ≤ L ∧ allocatedErrorKernelLog T ≤ L ∧ p ≤ P ∧ + (2 * L + 2) ^ 4 ≤ P ∧ 2 * L * (2 * L + 2) ^ 4 + L ≤ P := by + have hT := (allocatedErrorPrimitiveLog_bounds m hp).1 + have hpT := (allocatedErrorPrimitiveLog_bounds m hp).2.1 + have hlog := allocatedErrorKernelLog_nonneg hT + have hL : 0 ≤ allocatedErrorFourierInput m p := add_nonneg hT hlog + have hf : 0 ≤ (2 * allocatedErrorFourierInput m p + 2) ^ 4 := by positivity + have hc : 0 ≤ 2 * allocatedErrorFourierInput m p * (2 * allocatedErrorFourierInput m p + 2) ^ 4 := + mul_nonneg (mul_nonneg (by norm_num) hL) hf + refine ⟨hL, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · change p ≤ allocatedErrorPrimitiveLog m p + allocatedErrorKernelLog (allocatedErrorPrimitiveLog m p) + linarith + · exact le_add_of_nonneg_right hlog + · exact le_add_of_nonneg_left hT + all_goals dsimp only [allocatedErrorFourierOutput]; linarith + +theorem exists_allocatedErrorFourierOutput_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ p : ℝ, 0 ≤ p → allocatedErrorFourierOutput m p ≤ (p + a) ^ a := by + let poly : Polynomial ℕ := allocatedErrorFourierOutput m Polynomial.X + obtain ⟨a, ha, hbound⟩ := exists_natPolynomial_eval_budget poly + refine ⟨a, ha, ?_⟩ + intro p hp + simpa [poly, allocatedErrorFourierOutput, allocatedErrorFourierInput, allocatedErrorPrimitiveLog, + allocatedErrorKernelLog, allocatedComparisonDimension, Polynomial.eval₂_pow] using hbound p hp + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] + +theorem allocatedErrorPrimitive_fourier_budget + {α : Type*} [Fintype α] (rows : ∀ j, O j → Finset α) + (hq : Fintype.card α ≤ m + 1) (hinj : ∀ j, Function.Injective (rows j)) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + {Q : Fin m → Type*} [∀ j, Fintype (Q j)] + (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (M period : ℕ) (hperiod : period ≤ M ^ (m + 1)) + (η : ℝ≥0) (C V : Fin m → ℝ≥0) {p δ : ℝ} (hp : 0 ≤ p) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn : ∀ j, (n j : ℝ) ≤ p) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hη : η ≤ 1) (hM : (M : ℝ) ≤ Real.exp p) (hS : (S.value : ℝ) ≤ Real.exp p) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp p) (hV : ∀ j, (V j : ℝ) ≤ Real.exp p) + (hδ : δ⁻¹ ≤ Real.exp p) : + let L := allocatedErrorFourierInput m p + let P := allocatedErrorFourierOutput m p + let A := Real.toNNReal (coefficientDeckPeriodCap O Q period) + 0 ≤ L ∧ p ≤ P ∧ (Fintype.card (JetAmbientIndex O J) : ℝ) ≤ L ∧ δ⁻¹ ≤ Real.exp L ∧ + (allocatedErrorKernelLip B U b S (O := O) η A C V : ℝ) ≤ Real.exp L ∧ + Real.exp ((2 * L + 2) ^ 4) ≤ Real.exp P ∧ + Real.exp (2 * L * (2 * L + 2) ^ 4) * allocatedErrorKernelCap B U b S (O := O) η A V ≤ Real.exp P := by + obtain ⟨hamb, hcap, hlip⟩ := allocatedErrorPrimitive_constants B U b S rows hq hinj hb bW M period + hperiod η C V hp hvars hI hn hJ hη hM hS hC hV + obtain ⟨hL, hpL, hTL, hlogL, hpP, hfreq, hcoeff⟩ := allocatedErrorFourier_budgets m hp + have he := Real.exp_le_exp.mpr hlogL + refine ⟨hL, hpP, hamb.trans hTL, hδ.trans (Real.exp_le_exp.mpr hpL), hlip.trans he, + Real.exp_le_exp.mpr hfreq, ?_⟩ + calc + _ ≤ Real.exp (2 * allocatedErrorFourierInput m p * (2 * allocatedErrorFourierInput m p + 2) ^ 4) * + Real.exp (allocatedErrorFourierInput m p) := + mul_le_mul_of_nonneg_left (hcap.trans he) (Real.exp_pos _).le + _ = Real.exp (2 * allocatedErrorFourierInput m p * (2 * allocatedErrorFourierInput m p + 2) ^ 4 + + allocatedErrorFourierInput m p) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr hcoeff + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedErrorStandardFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedErrorStandardFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..c270d5eb89f3e8620b8918afbd228380dfd8fc0b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedErrorStandardFourier.lean @@ -0,0 +1,148 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalJetCoverCancellation + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {α : Type*} [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (rows : ∀ j, O j → Finset α) + +theorem exists_allocated_error_fourier (η A : ℝ≥0) (C V : Fin m → ℝ≥0) + (hC : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hdim : (Fintype.card (JetAmbientIndex O J) : ℝ) ≤ P) + (hLip : (allocatedErrorKernelLip B U b S (O := O) η A C V : ℝ) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → JetAmbientIndex O J → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a i, |(frequency a i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * + allocatedErrorKernelCap B U b S (O := O) η A V ∧ + ∀ y, ‖(allocatedErrorTorusKernel B U b S o hR hσ x u v rows η A y : ℂ) - + ∑ a, c a * ∏ i, CircleFourier.character (frequency a i • y i)‖ ≤ δ := by + have h := allocatedErrorTorusKernel_bounds B U b S o hR hσ x u v rows η A C V hC hV + have hl : LipschitzWith (allocatedErrorKernelLip B U b S (O := O) η A C V) + (fun y => (allocatedErrorTorusKernel B U b S o hR hσ x u v rows η A y : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro y z + rw [Complex.isometry_ofReal.dist_eq] + exact h.2.dist_le_mul y z + exact exists_ambient_torus_fourier_approximation _ _ _ hl + (fun y => by simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (h.1 y).1] using (h.1 y).2) + hδ hP hdim hLip hδP + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + +theorem allocatedCoefficientError_fourier_upper + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + {Q : Fin m → Type*} [∀ j, Fintype (Q j)] + (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (d period : ℕ) [NeZero d] [NeZero period] + (hperiod : ∀ j, integerScalarLattice (O j) (period : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (rows j)).mulVecLin.range) + (η : ℝ≥0) (C V : Fin m → ℝ≥0) + (hC : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + {F : Type*} [Fintype F] (frequency : F → JetAmbientIndex O J → ℤ) (c : F → ℂ) {δ : ℝ} + (happrox : ∀ y, ‖(allocatedErrorTorusKernel B U b S o hR hσ x u v rows η + (Real.toNNReal (coefficientDeckPeriodCap O Q period)) y : ℂ) - + ∑ a, c a * ∏ i, CircleFourier.character (frequency a i • y i)‖ ≤ δ) + (y : EuclideanJetLayers U O) : + restrictedChartDensity (mixedCoveredJetChart U o b hb bW d) + (mixedCoveredJetRegion (O := O) (E := Q) U o b d (fun j _ => standardLatticeClosedQuarterBox (J j))) + 1 (fun z : MixedCoveredJetSource I O Q n d => + allocatedCoveredFixedFactor B U b hR hσ S x u v rows Q d z.1 z.2 * + ((η : ℝ) / (∏ a, allocatedLongJetOutputScale B U b S (O := O) a))) y ≤ + (∑ a, c a * ∏ i, CircleFourier.character (frequency a i • coveredJetAmbientTorus U d y i)).re + δ := by + have h := allocatedCoefficientError_le_majorant B U b S o hR hσ x u v rows hb bW d period hperiod η C V hC hV y + have hnorm := happrox (coveredJetAmbientTorus U d y) + have hre := (Complex.re_le_norm _).trans hnorm + simp only [Complex.sub_re, Complex.ofReal_re] at hre + dsimp only [allocatedCoefficientErrorMajorant] at h + exact h.trans (by linarith) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule VectorPolynomial +open scoped BigOperators Classical NNReal + +variable {m q : ℕ} {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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {α : Type*} [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (rows : ∀ j : Fin m, BoundedBooleanJet (Fin q) (j.val + 1) → Finset α) + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet (Fin q) ((j : ℕ) + 1)) + +theorem exists_allocated_error_standard_fourier (d : ℕ) (η A : ℝ≥0) (C V : Fin m → ℝ≥0) + (hC : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hdim : (Fintype.card (JetAmbientIndex jets J) : ℝ) ≤ P) + (hLip : (allocatedErrorKernelLip B U b S (O := jets) η A C V : ℝ) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → ∀ j, (Fin q →₀ ℕ) → J j → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a j e, e.degree ≤ j.val + 1 → ∀ i, + |(frequency a j e i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4) * d) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * + allocatedErrorKernelCap B U b S (O := jets) η A V ∧ + ∀ y, ‖(allocatedCoefficientErrorMajorant B U b S o hR hσ x u v rows η A d + (standardPhysicalJetMap U y) : ℂ) - coefficientTorusFourierSum U frequency c y‖ ≤ δ := by + obtain ⟨F, inst, frequency, c, hcard, hfreq, hsum, herr⟩ := + exists_allocated_error_fourier B U b S o hR hσ x u v rows η A C V hC hV hδ hP hdim hLip hδP + let _ := inst + refine ⟨F, inst, fun a => standardJetFrequency d (frequency a), c, hcard, ?_, hsum, ?_⟩ + · intro a j e he i + exact standardJetFrequency_bound d (frequency a) (hfreq a) j e he i + · intro y + change ‖(allocatedErrorTorusKernel B U b S o hR hσ x u v rows η A + (coveredJetAmbientTorus U d (standardPhysicalJetMap U y)) : ℂ) - + ∑ a, c a * coefficientTorusCharacter U (standardJetFrequency d (frequency a)) y‖ ≤ δ + simpa only [standardJetFrequency_character] using + herr (coveredJetAmbientTorus U d (standardPhysicalJetMap U y)) + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedExternalCandidateSpatialNativeFrequencyTransport.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedExternalCandidateSpatialNativeFrequencyTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f8f2b00e2e7c1808600fdbddaea545238e60d81 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedExternalCandidateSpatialNativeFrequencyTransport.lean @@ -0,0 +1,119 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {A} {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + +def withFrequencies (eta : Pivot → LG →ₗ[ℚ] ℚ) (h : F.η = eta) : + AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip := + { F with + η := eta + hηheight := by simpa only [← h] using F.hηheight + hη := by simpa only [← h] using F.hη } + +variable (eta : Pivot → LG →ₗ[ℚ] ℚ) (h : F.η = eta) + +@[simp] theorem withFrequencies_eta : (F.withFrequencies eta h).η = eta := rfl + +@[simp] theorem withFrequencies_sourceChart : + (F.withFrequencies eta h).sourceChart = F.sourceChart := rfl + +@[simp] theorem withFrequencies_sourceCandidate : + (F.withFrequencies eta h).sourceCandidate = F.sourceCandidate := rfl + +@[simp] theorem withFrequencies_reference : + (F.withFrequencies eta h).reference = F.reference := rfl + +@[simp] theorem withFrequencies_nativeValue : + (F.withFrequencies eta h).nativeValue = F.nativeValue := rfl + +@[simp] theorem withFrequencies_native : + (F.withFrequencies eta h).native = F.native := rfl + +@[simp] theorem withFrequencies_twist : + (F.withFrequencies eta h).twist = F.twist := rfl + +@[simp] theorem withFrequencies_chart (a : Ω) : + (F.withFrequencies eta h).chart a = F.chart a := rfl + +@[simp] theorem withFrequencies_candidate (a : Ω) : + (F.withFrequencies eta h).candidate a = F.candidate a := rfl + +@[simp] theorem withFrequencies_localTest (a : Ω) (j : Pivot) : + (F.withFrequencies eta h).localTest a j = F.localTest a j := rfl + +@[simp] theorem withFrequencies_jointOrbit (a : Ω) : + (F.withFrequencies eta h).jointOrbit a = F.jointOrbit a := rfl + +@[simp] theorem withFrequencies_physicalBox (a : Ω) + (u : integerBox (fun i : {i // keep i} => A.sides i.val)) : + (F.withFrequencies eta h).physicalBox a u = F.physicalBox a u := rfl + +@[simp] theorem withFrequencies_sitePhysicalBox (a : Ω) (site : A.Site) : + (F.withFrequencies eta h).sitePhysicalBox a site = F.sitePhysicalBox a site := rfl + +@[simp] theorem withFrequencies_correlation (a : Ω) (j : Pivot) : + (F.withFrequencies eta h).correlation a j = F.correlation a j := rfl + +theorem withFrequencies_withBudget (q : ℝ) (hpq : p ≤ q) : + (F.withFrequencies eta h).withBudget q hpq = + (F.withBudget q hpq).withFrequencies eta h := rfl + +theorem withFrequencies_withFactorBudget : + (F.withFrequencies eta h).withFactorBudget = + F.withFactorBudget.withFrequencies eta h := rfl + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedFixedProjectedFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedFixedProjectedFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..861a28bdd1d60212265162f2405ca715add66849 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedFixedProjectedFourier.lean @@ -0,0 +1,104 @@ +import OAI.Combinatorics.Progressions.Probability.CommonSectionAmbientDensityMultiple + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory Polynomial +open scoped Classical NNReal + +theorem exists_allocated_fixed_projected_fourier (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {G : Type*} [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox (Fin q) S.value) + {P : ℝ} (_hP : 0 ≤ P) (_hG : (Fintype.card G : ℝ) ≤ P) + (_hc : ∀ g, |(c (.inl g) : ℝ)| ≤ Real.exp P) (_hL : (S.value : ℝ) ≤ Real.exp P) + {M : ℕ} (_hperiod : HasBoundedScalarPeriod (scalarCubeDifferenceMatrix x).mulVecLin.range M), + ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ (y : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin q) (allocatedPrincipalSides B U b S)) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (_hσ1 : ∀ j, σ j ≤ 1) (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)], + let density := allocatedCoefficientDensity B U b hb o hR hσ S + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + let root := allocatedPhysicalCubeRoot B U b S c x y + let dirs := allocatedPhysicalCubeDirections B U b S x y + let F := euclideanCoefficientJetMap U root dirs + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) + let cover := 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 : ℝ) cap) ∧ Integrable f ξ ∧ + (∫ z, f z ∂ξ) = 1 ∧ + (realDensityMeasure μ (fun z => density (cover z))).map F = realDensityMeasure ξ f ∧ + physicalDensityProjection U root dirs d density f ∧ + ∀ {T : Type*} [Fintype T] + (frequency : T → ∀ j, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) {L : ℝ}, 0 ≤ L → + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ L) → + ∃ rows : T → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ, + (∀ a j s t, |(rows a j s t : ℝ)| ≤ Real.exp ((P + A) ^ A) * L) ∧ + ∀ {X : Type*} (coeff : T → ℂ) {η : ℝ}, + (∀ z, ‖coefficientTorusFourierSum U frequency coeff z - (density z : ℂ)‖ ≤ η) → + ∀ (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)), + (∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) → + ∀ (hm : ∀ j e, coefficients (p j) e ∈ U j) + (v : Option (LayerSamplerVariables G I n B) → X → ℝ), + ‖retainedSiteFourierSum U root dirs frequency rows coeff + (affineCoveredSiteSample U root dirs d p hm v) - + (f (F (affineCoefficientCoverSample U p hm d v)) : ℂ)‖ ≤ η := by + obtain ⟨A₀, _, hcover⟩ := exists_fixed_kernel_euclidean_density_projected_fourier m q + obtain ⟨A, hA, hbudget⟩ := exists_natPolynomial_eval_budget ((X + C (q + 2 + A₀)) ^ A₀) + refine ⟨A, hA, ?_⟩ + intro G _ I _ n B _ J _ U b R σ S c x P hP hG hc hL M hperiod + let Q := P + (q + 2 : ℕ) + have hPQ : P ≤ Q := le_add_of_nonneg_right (Nat.cast_nonneg _) + have hQ : 0 ≤ Q := hP.trans hPQ + have hbound : (Q + A₀) ^ A₀ ≤ (P + A) ^ A := by + simpa [Q, Polynomial.eval₂_pow, Nat.cast_add, add_assoc] using hbudget P hP + obtain ⟨a, ha, _, hperiod⟩ := hperiod + obtain ⟨d, hd, hdb, hcover⟩ := hcover (fun g => c (.inl g) + (x g none : ℤ)) + (fun i g => (x g (some i) : ℤ)) (a : ℤ) (by exact_mod_cast ha.ne') hperiod hQ (hG.trans hPQ) + (kernelCubeBox_site_le_exp (fun g => c (.inl g)) x hc hL) + refine ⟨d, hd, hdb.trans (Real.exp_le_exp.mpr hbound), ?_⟩ + intro y _ _ _ _ _ _ hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ _ _ ν _ _ + have hs := allocatedCoefficientDensity_positive_spec B U b hb o hR hσ S C V hC hV + hσ1 Cinv hCinv hchart hsmall μ ν + intro density cap root dirs F cover ξ + obtain ⟨f, hfc, hfb, hfi, hfm, hflaw, hprojection, hf⟩ := hcover (allocatedPhysicalCubeRoot B U b S c x y) (allocatedPhysicalCubeDirections B U b S x y) + Sum.inl (fun _ => rfl) (fun _ _ => rfl) U μ ν _ hs.1 hs.2.1 hs.2.2.2.1 + refine ⟨f, hfc, hfb, hfi, hfm, hflaw, hprojection, ?_⟩ + intro T _ frequency L hL hfrequency + obtain ⟨rows, hrows, happ⟩ := hf frequency hL hfrequency + refine ⟨rows, ?_, happ⟩ + intro a j s t + exact (hrows a j s t).trans + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hbound) hL) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedGridFourierApproximation.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedGridFourierApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..30682747f27a67b730dc54a0b33e9cd805a1cb7e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedGridFourierApproximation.lean @@ -0,0 +1,76 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedGridlessProfileBound + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] (rows : ∀ j, O j → Finset α) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +theorem exists_allocated_grid_fourier_approximation + (C : Fin m → ℝ≥0) + (hC : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hJ : (Fintype.card (JetAmbientIndex O J) : ℝ) ≤ P) + (hL : ((Fintype.card {a // allocatedGridAxis (I := I) U b S.value a} : ℝ) * + (Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) * + (2 * ((S.value : ℝ) ^ (layerTailDegree m + 1)) ^ 2))) * + (∑ j, (C j : ℝ) * Fintype.card (J j)) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ g : (JetAmbientIndex O J → UnitAddCircle) → ℝ, + (∀ z, g z ∈ Icc (0 : ℝ) 1) ∧ + (∀ w : JetAmbientIndex O J → ℝ, (∀ i, |w i| ≤ 1 / 4) → + g (fun i => (w i : UnitAddCircle)) = + allocatedNormalizedGridInterpolation B U b hR hσ S u rows + (allocatedGridAmbientCoordinates B U b S o w)) ∧ + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → JetAmbientIndex O J → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a j, |(frequency a j : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + ∀ z, ‖(g z : ℂ) - + ∑ a, c a * ∏ j, CircleFourier.character (frequency a j • z j)‖ ≤ δ := by + obtain ⟨g, hg, hunit, hvalue⟩ := + exists_allocated_ambient_grid_factor_uniform B U b hR hσ S u rows o C hC + let L : ℝ≥0 := (Fintype.card {a // allocatedGridAxis (I := I) U b S.value a} * + (Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) * + (2 * ((S.value : ℝ≥0) ^ (layerTailDegree m + 1)) ^ 2))) * + (∑ j, C j * Fintype.card (J j)) + have hcomplex : LipschitzWith L (fun z => (g z : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro z w + rw [Complex.isometry_ofReal.dist_eq] + exact hg.dist_le_mul z w + have hbound : ∀ z, ‖(g z : ℂ)‖ ≤ (1 : ℝ≥0) := by + intro z + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hunit z).1] + exact (hunit z).2 + have hLc : (L : ℝ) ≤ Real.exp P := by + simpa only [L, NNReal.coe_mul, NNReal.coe_pow, NNReal.coe_natCast, NNReal.coe_sum, + NNReal.coe_ofNat] using hL + obtain ⟨F, inst, frequency, c, hcard, hfrequency, hmass, herr⟩ := + exists_ambient_torus_fourier_approximation (fun z => (g z : ℂ)) _ 1 hcomplex + hbound hδ hP hJ hLc hδP + refine ⟨g, hunit, hvalue, F, inst, frequency, c, hcard, hfrequency, ?_, herr⟩ + simpa only [NNReal.coe_one, mul_one] using hmass + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedGridSpectrumSize.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedGridSpectrumSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef2ba65433bcdfa39d2bdbca47a78d54804572a2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedGridSpectrumSize.lean @@ -0,0 +1,36 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedEnormousProfiles + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +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 σ) + +theorem allocatedGrid_modulus_cardinality (j : Fin m) (i : Fin (n j)) + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + {C : ℝ} {M : ℕ} (hC : 0 ≤ C) (hM : (M : ℝ) ≤ C * basisAxisScale (basis j) i) + (d : ℕ) : + (M : ℝ) ^ d ≤ C ^ d * (S.value : ℝ) ^ ((layerTailDegree m + 1) * d) := by + change basisAxisScale (basis j) i ≤ S.value ^ (layerTailDegree m + 1) at hgrid + have hK : (basisAxisScale (basis j) i : ℝ) ≤ + (S.value : ℝ) ^ (layerTailDegree m + 1) := by exact_mod_cast hgrid + calc + (M : ℝ) ^ d ≤ (C * (S.value : ℝ) ^ (layerTailDegree m + 1)) ^ d := + pow_le_pow_left₀ (Nat.cast_nonneg M) + (hM.trans (mul_le_mul_of_nonneg_left hK hC)) d + _ = C ^ d * (S.value : ℝ) ^ ((layerTailDegree m + 1) * d) := by + rw [mul_pow, ← pow_mul] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedIdealCoefficientFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedIdealCoefficientFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..4146661a1a2df5eafae3e1fb00fa2f72ce64ecef --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedIdealCoefficientFourier.lean @@ -0,0 +1,78 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedActualProfileBudget + +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)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {α : Type*} [Fintype α] {O : Fin m → Type*} [∀ j, Fintype (O j)] +variable {D : ℝ} (h : AllocatedComparisonDimensions (G := G) B α O D) +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +include h + +theorem allocatedIdealCoefficient_fourier_budget + {p e g s δF : ℝ} (hp : 0 ≤ p) (he : 0 ≤ e) (hg : 0 ≤ g) (hs : 0 ≤ s) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ D) + (η A : ℝ≥0) (hη : η ≤ 1) (hA : (A : ℝ) ≤ Real.exp g) + (hS : (S.value : ℝ) ≤ Real.exp s) + (C V : Fin m → ℝ≥0) (hC : ∀ j, (C j : ℝ) ≤ Real.exp p) + (hV : ∀ j, (V j : ℝ) ≤ Real.exp p) (hδF : δF⁻¹ ≤ Real.exp p) : + let T := allocatedActualProfileInput m D p e g s + let L := allocatedProfileFourierInput T + let Q := allocatedProfileFourierOutput T + 0 ≤ L ∧ p ≤ Q ∧ (Fintype.card (JetAmbientIndex O J) : ℝ) ≤ L ∧ + δF⁻¹ ≤ Real.exp L ∧ + (allocatedErrorKernelLip B U b S (O := O) η A C V : ℝ) ≤ Real.exp L ∧ + Real.exp ((2 * L + 2) ^ 4) ≤ Real.exp Q ∧ + Real.exp (2 * L * (2 * L + 2) ^ 4) * + allocatedErrorKernelCap B U b S (O := O) η A V ≤ Real.exp Q := by + dsimp only + obtain ⟨hT, hDT, hpT, hgT, hsT, _hcap, _hideal, _hproxyLip, _hidealLip⟩ := + allocatedActualProfileInput_bounds m h.nonneg hp he hg hs + have hk : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ + Real.exp (allocatedActualProfileInput m D p e g s) := by + calc + _ ≤ Real.exp s ^ (layerTailDegree m + 1) := pow_le_pow_left₀ (Nat.cast_nonneg _) hS _ + _ = Real.exp ((layerTailDegree m + 1 : ℕ) * s) := (Real.exp_nat_mul _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr hsT + obtain ⟨hL, hQ, hamb, hδL, hLip, hfreq, hcoeff⟩ := + allocatedProfileError_fourier_budget B U b S (O := O) A 1 0 0 0 C V hT + (h.degree.trans hDT) (h.axes.trans hDT) (h.outputs.trans hDT) + (fun j => (h.rows j).trans hDT) (fun j => (hJ j).trans hDT) + (hA.trans (Real.exp_le_exp.mpr hgT)) hk + (fun j => (hC j).trans (Real.exp_le_exp.mpr hpT)) + (fun j => (hV j).trans (Real.exp_le_exp.mpr hpT)) + (Real.one_le_exp hT) (Real.exp_nonneg _) (Real.exp_nonneg _) (Real.exp_nonneg _) + (hδF.trans (Real.exp_le_exp.mpr hpT)) + simp only [allocatedProfileErrorLip, add_zero, zero_add, zero_mul, mul_zero, one_mul] at hLip + simp only [allocatedProfileErrorCap, add_zero, mul_one] at hcoeff + have hLipMono : allocatedErrorKernelLip B U b S (O := O) η A C V ≤ + allocatedErrorKernelLip B U b S (O := O) 1 A C V := by + dsimp only [allocatedErrorKernelLip] + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hη zero_le) zero_le) + zero_le + have hCapMono : allocatedErrorKernelCap B U b S (O := O) η A V ≤ + allocatedErrorKernelCap B U b S (O := O) 1 A V := by + dsimp only [allocatedErrorKernelCap] + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hη zero_le) zero_le) + zero_le + exact ⟨hL, hpT.trans hQ, hamb, hδL, (NNReal.coe_le_coe.mpr hLipMono).trans hLip, + hfreq, (mul_le_mul_of_nonneg_left (NNReal.coe_le_coe.mpr hCapMono) + (Real.exp_pos _).le).trans hcoeff⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedInactiveGridSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedInactiveGridSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f660e70d5b6ad753c2babf83b55e36b010f631c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedInactiveGridSpectrum.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedInactiveResidueScale +import OAI.Combinatorics.Progressions.Lattices.WeightedModerateIntegerApproximation + +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)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (j : Fin m) (i : Fin (n j)) (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : ∀ (a : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)), + (Fintype.card α + 1) * q ≤ allocatedPrincipalSides B U b S ⟨⟨j, Sum.inr i⟩, a, v⟩) + +local notation "height" => basisAxisScale (b j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "cost" => (denom : ℝ) * 2 ^ degree +local notation "source" => allocatedLocalResidueSources B U b S j i q hq r hsize +local notation "torus" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 + +theorem exists_allocated_inactive_grid_spectrum + [Nonempty (B ⟨j, Sum.inr i⟩)] + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P ε : ℝ) + (hP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) (hε : 0 < ε) (hε1 : ε ≤ 1) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hB : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) : + letI : NeZero height := ⟨(basisAxisScale_pos (b j) i).ne'⟩ + let ζ := uniformBlockRetainedBias j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ε + ∃ F : Finset (rows → Fin (torus * height)), + (F.card : ℝ) ≤ uniformSpectrumSizeConstant j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) / + ε ^ max (majorArcSpectrumExponent j.val rows.card) (majorArcLengthExponent j.val * (degree * rows.card)) ∧ + (∑ k, ‖∏ a, weightedCubeGridCoefficient (source a) (torus * height) rows k‖) ≤ + uniformSpectrumAbsoluteCap j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ∧ + (∀ k ∈ F, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ + uniformCharacterDenominatorBound j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ζ ∧ + ∃ (a : rows → ℤ) (ξ : rows → ℝ), + (∀ t, |ξ t| ≤ 2 * majorArcCoverConstant j.val rows.card P ((torus : ℝ) * cost) / + ζ ^ majorArcCoverExponent j.val rows.card) ∧ + ∀ t, ((k t).val : ℝ) / (torus * height) = (a t : ℝ) / d + ξ t / height) ∧ + ∀ shift z : rows → ℤ, + (∀ t, |(z t : ℝ) - shift t| ≤ blockJetScaleBound (Fintype.card α) degree + (Fintype.card (B ⟨j, Sum.inr i⟩)) 1 * height) → + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedResidueJetPMF B U b hR hσ S q r hcell j i rows shift z).toReal : ℝ) : ℂ) - + weightedCubeGridApproximation source height (torus * height) rows shift z F‖ ≤ ε := by + let : NeZero height := ⟨(basisAxisScale_pos (b j) i).ne'⟩ + have hs (a : B ⟨j, Sum.inr i⟩) (v : Fin degree) : ScalarCubePrimitiveBudget (source a v) A P := + (allocatedLocalResidueSources_primitive B U b S j i q hq r hsize a v A).mono hP + have hP1 : 1 ≤ P := + (hs (Classical.choice (inferInstance : Nonempty (B ⟨j, Sum.inr i⟩))) ⟨0, Nat.zero_lt_succ _⟩).one_le + obtain ⟨hu, hl, hp⟩ := allocatedInactiveResidueSources_scale B U b S j i q hq r hsize hsmall hlarge + obtain ⟨F, hcard, hcap, hchar, herr⟩ := weightedCube_integer_density_approximation (K := height) + source A hA hP1 zero_le_one (by positivity) (by positivity) hε hε1 hs + (fun a => by simpa only [one_mul] using hu a) hl degree hp rows hrows hB + refine ⟨F, hcard, hcap, hchar, ?_⟩ + intro shift z hz + have h := herr shift z hz + rw [finiteImageMass_eq_toPMF, + allocatedInactiveResidueJetPMF_source B U b S j i q hq r hsize hR hσ hsmall hlarge hcell rows shift] at h + exact h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedJetFourierData.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedJetFourierData.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae6421ad6aaab8f9e0c1e01246e311b26cc18344 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedJetFourierData.lean @@ -0,0 +1,415 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedFixedPositiveDensity +import OAI.Combinatorics.Progressions.Probability.CommonSectionEuclideanDensity + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +theorem sitePullbackFrequency_unit_bound {K S : Type*} [Fintype S] {m : ℕ} + {J : Fin m → Type*} (site : S → K → ℤ) (b : ∀ j, Matrix S (J j) ℤ) + (hsite : ∀ s k, |(site s k : ℝ)| ≤ 1) {B : ℝ} + (hb : ∀ j s a, |(b j s a : ℝ)| ≤ B) + (j : Fin m) (e : K →₀ ℕ) (a : J j) : + |(sitePullbackFrequency site b j e a : ℝ)| ≤ Fintype.card S * B := by + have hmon (s : S) : |((e.prod (fun k n => site s k ^ n) : ℤ) : ℝ)| ≤ 1 := by + simp only [Finsupp.prod, Int.cast_prod, Int.cast_pow, Finset.abs_prod, abs_pow] + exact Finset.prod_le_one₀ (fun k _ => pow_nonneg (abs_nonneg _) _) + (fun k _ => pow_le_one₀ (abs_nonneg _) (hsite s k)) + simp only [sitePullbackFrequency, Int.cast_sum, Int.cast_mul] + calc + _ ≤ ∑ s, |((e.prod (fun k n => site s k ^ n) : ℤ) : ℝ) * (b j s a : ℝ)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _s : S, B := by + apply Finset.sum_le_sum + intro s _ + rw [abs_mul] + exact (mul_le_mul (hmon s) (hb j s a) (abs_nonneg _) (by norm_num)).trans_eq (one_mul B) + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + +end Erdos3.VectorPolynomial + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial +open scoped BigOperators Classical + +theorem standardPhysicalSite_bound {q : ℕ} (s : Finset (Fin q)) (i : Fin q) : + |(standardPhysicalSite s i : ℝ)| ≤ 1 := by + by_cases hi : i ∈ s <;> simp [standardPhysicalSite, integerAffineCube, Matrix.one_apply, hi] + +theorem standardSiteFrequency_bound {m q : ℕ} {J : Fin m → Type*} + (b : ∀ j, Matrix (Finset (Fin q)) (J j) ℤ) {B : ℝ} + (hb : ∀ j s a, |(b j s a : ℝ)| ≤ B) (j : Fin m) (e : Fin q →₀ ℕ) (a : J j) : + |(sitePullbackFrequency standardPhysicalSite b j e a : ℝ)| ≤ (2 : ℝ) ^ q * B := by + simpa only [Fintype.card_finset, Fintype.card_fin, Nat.cast_pow, Nat.cast_ofNat] using + sitePullbackFrequency_unit_bound standardPhysicalSite b standardPhysicalSite_bound hb j e a + +noncomputable def retainedSiteCoefficient {K F : 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 : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) (a : F) : ℂ := + if affineCubeModeFactors U root difference (frequency a) then c a else 0 + +theorem retainedSiteCoefficient_norm_sum {K F : Type*} [Fintype K] [Fintype F] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (root : K → ℤ) (difference : Fin q → K → ℤ) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) : + (∑ a, ‖retainedSiteCoefficient U root difference frequency c a‖) ≤ ∑ a, ‖c a‖ := by + apply Finset.sum_le_sum + intro a _ + unfold retainedSiteCoefficient + split_ifs <;> simp + +theorem retainedSiteFourierSum_standard {K F : Type*} [Fintype K] [Fintype F] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (root : K → ℤ) (difference : Fin q → K → ℤ) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (b : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ) (c : F → ℂ) + (y : CoefficientTorus (K := Fin q) U) : + retainedSiteFourierSum U root difference frequency b c + (coefficientSiteTorusMap U standardPhysicalSite y) = + coefficientTorusFourierSum U (fun a => sitePullbackFrequency standardPhysicalSite (b a)) + (retainedSiteCoefficient U root difference frequency c) y := by + rw [← siteTorusFourierSum_pullback] + unfold retainedSiteFourierSum siteTorusFourierSum retainedSiteCoefficient + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial + +theorem sampled_density_standard_fourier {K F : Type*} [Fintype K] [Fintype F] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (root : K → ℤ) (difference : Fin q → K → ℤ) (d : ℕ) (hd : 0 < d) + (a : ℤ) (ha : a ≠ 0) + (hperiod : integerScalarLattice (Fin q) a ≤ (Matrix.of difference).mulVecLin.range) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (rows : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ) (c : F → ℂ) + (g : EuclideanJetLayers U (fun j : Fin m => BoundedBooleanJet (Fin q) (j.val + 1)) → ℝ) + {η : ℝ} + (happrox : ∀ (p : ∀ j, VectorPolynomial K ℝ (J j → ℝ)), + (∀ j, DegreeLE (1 : K → ℕ) (j.val + 1) (p j)) → + ∀ (hm : ∀ j e, coefficients (p j) e ∈ U j) (z : Option K → K → ℝ), + ‖retainedSiteFourierSum U root difference frequency rows c + (affineCoveredSiteSample U root difference d p hm z) - + (g (euclideanCoefficientJetMap U root (Matrix.of difference) + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) + (affineCoefficientCoverSample U p hm d z)) : ℂ)‖ ≤ η) + (y : CoefficientTorus (K := Fin q) U) : + ‖(g (standardPhysicalJetMap U y) : ℂ) - + coefficientTorusFourierSum U (fun i => sitePullbackFrequency standardPhysicalSite (rows i)) + (retainedSiteCoefficient U root difference frequency c) y‖ ≤ η := by + have hglobal := sampled_jet_approximation_global U root difference d hd + (retainedSiteFourierSum U root difference frequency rows c) g happrox + have h := standard_jet_site_approximation U root (Matrix.of difference) a ha hperiod + (retainedSiteFourierSum U root difference frequency rows c) g hglobal y + rw [retainedSiteFourierSum_standard] at h + rw [norm_sub_rev] + exact h + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory Polynomial +open scoped Classical NNReal + +theorem exists_allocated_fixed_positive_fourier (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {G : Type*} [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox (Fin q) S.value) + {P : ℝ} (_hP : 0 ≤ P) (_hG : (Fintype.card G : ℝ) ≤ P) + (_hc : ∀ g, |(c (.inl g) : ℝ)| ≤ Real.exp P) (_hL : (S.value : ℝ) ≤ Real.exp P) + {M : ℕ} (_hperiod : HasBoundedScalarPeriod (scalarCubeDifferenceMatrix x).mulVecLin.range M), + ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ (y : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin q) (allocatedPrincipalSides B U b S)) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (_hσ1 : ∀ j, σ j ≤ 1) (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)], + let density := allocatedCoefficientDensity B U b hb o hR hσ S + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + let root := allocatedPhysicalCubeRoot B U b S c x y + let dirs := allocatedPhysicalCubeDirections B U b S x y + let F := euclideanCoefficientJetMap U root dirs + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) + let cover := 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 : ℝ) cap) ∧ Integrable f ξ ∧ + (∫ z, f z ∂ξ) = 1 ∧ + (realDensityMeasure μ (fun z => density (cover z))).map F = realDensityMeasure ξ f ∧ + ∀ {T : Type*} [Fintype T] + (frequency : T → ∀ j, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) {L : ℝ}, 0 ≤ L → + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ L) → + ∃ rows : T → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ, + (∀ a j s t, |(rows a j s t : ℝ)| ≤ Real.exp ((P + A) ^ A) * L) ∧ + ∀ {X : Type*} (coeff : T → ℂ) {η : ℝ}, + (∀ z, ‖coefficientTorusFourierSum U frequency coeff z - (density z : ℂ)‖ ≤ η) → + ∀ (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)), + (∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) → + ∀ (hm : ∀ j e, coefficients (p j) e ∈ U j) + (v : Option (LayerSamplerVariables G I n B) → X → ℝ), + ‖retainedSiteFourierSum U root dirs frequency rows coeff + (affineCoveredSiteSample U root dirs d p hm v) - + (f (F (affineCoefficientCoverSample U p hm d v)) : ℂ)‖ ≤ η := by + obtain ⟨A₀, _, hcover⟩ := exists_fixed_kernel_euclidean_density_fourier m q + obtain ⟨A, hA, hbudget⟩ := exists_natPolynomial_eval_budget ((X + C (q + 2 + A₀)) ^ A₀) + refine ⟨A, hA, ?_⟩ + intro G _ I _ n B _ J _ U b R σ S c x P hP hG hc hL M hperiod + let Q := P + (q + 2 : ℕ) + have hPQ : P ≤ Q := le_add_of_nonneg_right (Nat.cast_nonneg _) + have hQ : 0 ≤ Q := hP.trans hPQ + have hbound : (Q + A₀) ^ A₀ ≤ (P + A) ^ A := by + simpa [Q, Polynomial.eval₂_pow, Nat.cast_add, add_assoc] using hbudget P hP + obtain ⟨a, ha, _, hperiod⟩ := hperiod + obtain ⟨d, hd, hdb, hcover⟩ := hcover (fun g => c (.inl g) + (x g none : ℤ)) + (fun i g => (x g (some i) : ℤ)) (a : ℤ) (by exact_mod_cast ha.ne') hperiod hQ (hG.trans hPQ) + (kernelCubeBox_site_le_exp (fun g => c (.inl g)) x hc hL) + refine ⟨d, hd, hdb.trans (Real.exp_le_exp.mpr hbound), ?_⟩ + intro y _ _ _ _ _ _ hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ _ _ ν _ _ + have hs := allocatedCoefficientDensity_positive_spec B U b hb o hR hσ S C V hC hV + hσ1 Cinv hCinv hchart hsmall μ ν + intro density cap root dirs F cover ξ + obtain ⟨f, hfc, hfb, hfi, hfm, hflaw, hf⟩ := hcover (allocatedPhysicalCubeRoot B U b S c x y) (allocatedPhysicalCubeDirections B U b S x y) + Sum.inl (fun _ => rfl) (fun _ _ => rfl) U μ ν _ hs.1 hs.2.1 hs.2.2.2.1 + refine ⟨f, hfc, hfb, hfi, hfm, hflaw, ?_⟩ + intro T _ frequency L hL hfrequency + obtain ⟨rows, hrows, happ⟩ := hf frequency hL hfrequency + refine ⟨rows, ?_, happ⟩ + intro a j s t + exact (hrows a j s t).trans + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hbound) hL) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory Polynomial +open scoped BigOperators Classical NNReal + +theorem exists_allocated_uniform_jet_fourier (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {G : Type*} [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox (Fin q) S.value) + {P : ℝ} (_hP : 0 ≤ P) (_hG : (Fintype.card G : ℝ) ≤ P) + (_hc : ∀ g, |(c (.inl g) : ℝ)| ≤ Real.exp P) (_hL : (S.value : ℝ) ≤ Real.exp P) + {M : ℕ} (_hperiod : HasBoundedScalarPeriod (scalarCubeDifferenceMatrix x).mulVecLin.range M), + ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ (y : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin q) (allocatedPrincipalSides B U b S)) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (_hσ1 : ∀ j, σ j ≤ 1) (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)], + let density := allocatedCoefficientDensity B U b hb o hR hσ S + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + let root := allocatedPhysicalCubeRoot B U b S c x y + let dirs := allocatedPhysicalCubeDirections B U b S x y + let F := euclideanCoefficientJetMap U root dirs + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) + let cover := 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 : ℝ) cap) ∧ Integrable f ξ ∧ + (∫ z, f z ∂ξ) = 1 ∧ + (realDensityMeasure μ (fun z => density (cover z))).map F = realDensityMeasure ξ f ∧ + ∀ {T : Type*} [Fintype T] + (frequency : T → ∀ j, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) {L : ℝ}, 0 ≤ L → + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ L) → + ∃ frequency' : T → ∀ j, (Fin q →₀ ℕ) → J j → ℤ, + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, + |(frequency' a j e t : ℝ)| ≤ (2 : ℝ) ^ q * (Real.exp ((P + A) ^ A) * L)) ∧ + ∀ (coeff : T → ℂ) {η : ℝ}, + (∀ z, ‖coefficientTorusFourierSum U frequency coeff z - (density z : ℂ)‖ ≤ η) → + ∃ coeff' : T → ℂ, (∑ a, ‖coeff' a‖) ≤ ∑ a, ‖coeff a‖ ∧ + ∀ z : CoefficientTorus (K := Fin q) U, + ‖(f (standardPhysicalJetMap U z) : ℂ) - + coefficientTorusFourierSum U frequency' coeff' z‖ ≤ η := by + obtain ⟨A, hA, hsource⟩ := exists_allocated_fixed_positive_fourier m q + refine ⟨A, hA, ?_⟩ + intro G _ I _ n B _ J _ U b R σ S c x P hP hG hc hL M hperiod + obtain ⟨d, hd, hdb, hsource⟩ := hsource B U b S c x hP hG hc hL hperiod + refine ⟨d, hd, hdb, ?_⟩ + intro y _ _ _ _ _ _ hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ _ _ ν _ _ + density cap root dirs F cover ξ + obtain ⟨f, hfc, hfb, hfi, hfm, hflaw, hf⟩ := + hsource y hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ ν + refine ⟨f, hfc, hfb, hfi, hfm, hflaw, ?_⟩ + intro T _ frequency L hL hfrequency + obtain ⟨rows, hrows, happ⟩ := hf frequency hL hfrequency + refine ⟨fun a => sitePullbackFrequency standardPhysicalSite (rows a), ?_, ?_⟩ + · intro a j e _ t + exact standardSiteFrequency_bound (rows a) (hrows a) j e t + intro coeff η happrox + refine ⟨retainedSiteCoefficient U root dirs frequency coeff, + retainedSiteCoefficient_norm_sum U root dirs frequency coeff, ?_⟩ + obtain ⟨a, ha, _, hperiod⟩ := hperiod + have hdirs : integerScalarLattice (Fin q) (a : ℤ) ≤ dirs.mulVecLin.range := + hperiod.trans (integerPeriod_range_le_of_columns (scalarCubeDifferenceMatrix x) dirs Sum.inl + (fun _ _ => rfl)) + intro z + exact sampled_density_standard_fourier U root dirs d hd (a : ℤ) + (by exact_mod_cast ha.ne') hdirs frequency rows coeff f (happ coeff happrox) z + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory Polynomial +open scoped BigOperators Classical NNReal + +theorem exists_allocated_jet_fourier_data (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {G : Type*} [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox (Fin q) S.value) + {P : ℝ} (_hP : 0 ≤ P) (_hG : (Fintype.card G : ℝ) ≤ P) + (_hc : ∀ g, |(c (.inl g) : ℝ)| ≤ Real.exp P) (_hL : (S.value : ℝ) ≤ Real.exp P) + {M : ℕ} (_hperiod : HasBoundedScalarPeriod (scalarCubeDifferenceMatrix x).mulVecLin.range M), + ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ (y : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin q) (allocatedPrincipalSides B U b S)) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (_hσ1 : ∀ j, σ j ≤ 1) (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)], + let density := allocatedCoefficientDensity B U b hb o hR hσ S + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + let root := allocatedPhysicalCubeRoot B U b S c x y + let dirs := allocatedPhysicalCubeDirections B U b S x y + let F := euclideanCoefficientJetMap U root dirs + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) + let cover := 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 : ℝ) cap) ∧ Integrable f ξ ∧ + (∫ z, f z ∂ξ) = 1 ∧ + (realDensityMeasure μ (fun z => density (cover z))).map F = realDensityMeasure ξ f ∧ + ∀ (_hm : (m : ℝ) ≤ P) + (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (_hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + {δ : ℝ} (_hδ : 0 < δ) (_hδP : δ⁻¹ ≤ Real.exp P), + let Q := allocatedJetFourierBudget m q A P + ∃ (Index : Type) (inst : Fintype Index), letI := inst + ∃ (frequency : Index → ∀ j, (Fin q →₀ ℕ) → J j → ℤ) (coeff : Index → ℂ), + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ Real.exp Q) ∧ + (∑ a, ‖coeff a‖) ≤ Real.exp Q ∧ + ∀ z : CoefficientTorus (K := Fin q) U, + ‖(f (standardPhysicalJetMap U z) : ℂ) - coefficientTorusFourierSum U frequency coeff z‖ ≤ δ := by + obtain ⟨A, hA, hsource⟩ := exists_allocated_uniform_jet_fourier m q + refine ⟨A, hA, ?_⟩ + intro G _ I _ n B _ J _ U b R σ S c x P hP hG hc hL M hperiod + obtain ⟨d, hd, hdb, hsource⟩ := hsource B U b S c x hP hG hc hL hperiod + refine ⟨d, hd, hdb, ?_⟩ + intro y _ _ _ _ _ _ hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ _ _ ν _ _ + density cap root dirs F cover ξ + obtain ⟨f, hfc, hfb, hfi, hfm, hflaw, hfourier⟩ := + hsource y hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ ν + refine ⟨f, hfc, hfb, hfi, hfm, hflaw, ?_⟩ + intro hm hK hRP hσP hcount hI hn hJ hAP hCP hVP δ hδ hδP Q + obtain ⟨Index, inst, frequency, coeff, _, hfreq, hcoeff, herr⟩ := + exists_allocated_coefficient_uniform_fourier B U b hb o S C V hC hV + hR hσ hσ1 Cinv hCinv hchart hsmall hP hm hK hRP hσP hcount hI hn hJ + hAP hL hCP hVP hδ hδP + let _ := inst + obtain ⟨frequency', hfreq', hnext⟩ := hfourier frequency (Real.exp_pos _).le hfreq + obtain ⟨coeff', hcoeff', happ⟩ := hnext coeff (fun z => by rw [norm_sub_rev]; exact herr z) + have hbudget := allocatedJetFourierBudget_dominates m q A hP + refine ⟨Index, inst, frequency', coeff', ?_, ?_, happ⟩ + · intro a j e he t + exact (hfreq' a j e he t).trans hbudget.2.1 + · exact hcoeff'.trans (hcoeff.trans hbudget.2.2) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedMaskedCoefficientFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedMaskedCoefficientFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..df4d7d3e469b942215d93ac96aedc56c0eb8912c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedMaskedCoefficientFourier.lean @@ -0,0 +1,559 @@ +import OAI.Combinatorics.Progressions.Dynamics.CoefficientAmbientBudget +import OAI.Combinatorics.Progressions.Geometry.GeometricRetainedCommonCover +import OAI.Combinatorics.Progressions.Lattices.MaskedIntegerPeriodization +import OAI.Combinatorics.Progressions.Probability.AllocatedJointAmbientDensity + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (C V : Fin m → ℝ≥0) +variable (hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) +variable (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + +include hC hV in +theorem allocatedCoefficientAmbientDensity_bounds (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) : + let A := allocatedAmbientFactorCap (G := G) B R σ S.value V + let L := allocatedAmbientFactorLip (G := G) B R σ S.value (fun j => Fintype.card (J j)) C V + let N := Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + (∀ x, 0 ≤ allocatedCoefficientAmbientDensity B U b o S x ∧ + allocatedCoefficientAmbientDensity B U b o S x ≤ (A : ℝ)^N) ∧ + LipschitzWith (N * L * A^N) (allocatedCoefficientAmbientDensity B U b o S) := by + have h := allocatedAmbientFactor_bounds B U b S o C V hC hV hR hσ + exact coefficientAmbientDensity_bounds U b o _ _ _ + (allocatedAmbientFactorCap_one_le (G := G) B R σ S.value V) + (fun s x => (h s).1 x) (fun s => (h s).2) + +include hC hV in +theorem exists_allocated_coefficient_fourier_approximation + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hσ1 : ∀ j, σ j ≤ 1) + (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1/4) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hdim : (Fintype.card (CoefficientAmbientIndex (LayerSamplerVariables G I n B) J) : ℝ) ≤ P) + (hLP : let A := allocatedAmbientFactorCap (G := G) B R σ S.value V + let L := allocatedAmbientFactorLip (G := G) B R σ S.value (fun j => Fintype.card (J j)) C V + let N := Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + ((N * L * A^N : ℝ≥0) : ℝ) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → ∀ j : Fin m, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) (a : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ t j d, d.degree ≤ j.val + 1 → ∀ i, + |(frequency t j d i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ t, ‖a t‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * + (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ)^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) ∧ + ∀ x, ‖(allocatedCoefficientDensity B U b hb o hR hσ S x : ℂ) - + coefficientTorusFourierSum U frequency a x‖ ≤ δ := by + have h := allocatedAmbientFactor_bounds B U b S o C V hC hV hR hσ + exact exists_coefficient_ambient_fourier_approximation U b hb o _ _ _ _ + (fun j i d => (allocatedLayerIntegerInterpolation_spec B U b S hR hσ j i d).1) + (allocatedLayerColumns_quarter_support B U b hR hσ S o hσ1 Cinv hCinv hchart hsmall) + (allocatedAmbientFactorCap_one_le (G := G) B R σ S.value V) + (fun s x => (h s).1 x) (fun s => (h s).2) hδ hP hdim hLP hδP + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped NNReal + +noncomputable def coefficientAmbientBudgetExponent (m : ℕ) : ℕ := + (exists_natPolynomial_eval_budget (coefficientAmbientInputPolynomial m)).choose + +theorem coefficientAmbientBudgetExponent_bound (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + (m : ℝ) * (m+1) * (P+1)^m * (P+1) + P + 1 ≤ + (P + coefficientAmbientBudgetExponent m)^coefficientAmbientBudgetExponent m := by + simpa [coefficientAmbientInputPolynomial, coefficientAmbientBudgetExponent, Polynomial.eval₂_pow] + using (exists_natPolynomial_eval_budget (coefficientAmbientInputPolynomial m)).choose_spec.2 P hP + +noncomputable def allocatedFourierLogBudget (m : ℕ) (P : ℝ) : ℝ := + (P + allocatedAmbientLog m P + coefficientAmbientBudgetExponent m)^coefficientAmbientBudgetExponent m + +theorem allocatedFourierLogBudget_nonneg (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ allocatedFourierLogBudget m P := by + have h := allocatedAmbientLog_nonneg m hP + unfold allocatedFourierLogBudget + positivity + +theorem exists_allocatedFourierLogBudget_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ P : ℝ, 0 ≤ P → allocatedFourierLogBudget m P ≤ (P+a)^a := by + let e := coefficientAmbientBudgetExponent m + let scalar : Polynomial ℕ := 7 * (Polynomial.C (layerTailDegree m+1) * (4 * (Polynomial.X+8)) + 8) + let common : Polynomial ℕ := Polynomial.X + Polynomial.X * scalar + 1 + let width : Polynomial ℕ := Polynomial.C (m+4) * (Polynomial.X+8) + let mixed : Polynomial ℕ := (2*Polynomial.X+1)*(width+common)+3*Polynomial.X+1 + let ambient : Polynomial ℕ := Polynomial.X + Polynomial.X*(2*mixed+4*Polynomial.X+9)+1 + let budget : Polynomial ℕ := (Polynomial.X+ambient+Polynomial.C e)^e + obtain ⟨a, ha, hbound⟩ := exists_natPolynomial_eval_budget budget + refine ⟨a, ha, ?_⟩ + intro P hP + simpa [budget, ambient, mixed, width, common, scalar, e, allocatedFourierLogBudget, + allocatedAmbientLog, allocatedMixedLog, allocatedWidthLog, allocatedCommonLog, + allocatedScalarLog, integerInterpolationLogEnvelope, Polynomial.eval₂_pow] using hbound P hP + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + +theorem allocatedCoefficient_fourier_input_budget + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (R σ : Fin m → ℝ) (L : ℕ) (hL : 0 < L) (C V : Fin m → ℝ≥0) + {P : ℝ} (hP : 0 ≤ P) (hm : (m : ℝ) ≤ P) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hcount : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) ≤ P) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (hn : ∀ j, (n j : ℝ) ≤ P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) (hLP : (L : ℝ) ≤ Real.exp P) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) : + let A := allocatedAmbientFactorCap (G := G) B R σ L V + let F := allocatedAmbientFactorLip (G := G) B R σ L (fun j => Fintype.card (J j)) C V + let N := Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + P ≤ allocatedFourierLogBudget m P ∧ + (Fintype.card (CoefficientAmbientIndex (LayerSamplerVariables G I n B) J) : ℝ) ≤ allocatedFourierLogBudget m P ∧ + (A : ℝ)^N ≤ Real.exp (allocatedFourierLogBudget m P) ∧ + (N : ℝ)*F*(A : ℝ)^N ≤ Real.exp (allocatedFourierLogBudget m P) := by + let A := allocatedAmbientFactorCap (G := G) B R σ L V + let F := allocatedAmbientFactorLip (G := G) B R σ L (fun j => Fintype.card (J j)) C V + let T := P + allocatedAmbientLog m P + have hPT : P ≤ T := le_add_of_nonneg_right (allocatedAmbientLog_nonneg m hP) + have hT : 0 ≤ T := hP.trans hPT + obtain ⟨ha, hf⟩ := allocatedAmbientConstants_exp_bounds B R σ L hL _ C V hP hm + hR hσ hRP hσP hcount hI hn hJ hAP hLP hCP hVP + have he : Real.exp (allocatedAmbientLog m P) ≤ Real.exp T := + Real.exp_le_exp.mpr (le_add_of_nonneg_left hP) + have h := coefficient_ambient_input_exp_bounds + hT (hK.trans hPT) (fun j => (hJ j).trans hPT) A.coe_nonneg (ha.trans he) F.coe_nonneg (hf.trans he) + (coefficientAmbientBudgetExponent_bound m hT) + exact ⟨hPT.trans h.1, h.2.1, h.2.2.1, h.2.2.2⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +noncomputable def allocatedFourierOutputBudget (m : ℕ) (P : ℝ) : ℝ := + let Q := allocatedFourierLogBudget m P + 2*Q*(2*Q+2)^4+Q+(2*Q+2)^4 + +theorem allocatedFourierOutputBudget_dominates (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + let Q := allocatedFourierLogBudget m P + 2*Q*(2*Q+2)^4 ≤ allocatedFourierOutputBudget m P ∧ + (2*Q+2)^4 ≤ allocatedFourierOutputBudget m P ∧ + 2*Q*(2*Q+2)^4+Q ≤ allocatedFourierOutputBudget m P := by + have hQ := allocatedFourierLogBudget_nonneg m hP + have hpow : 0 ≤ (2*allocatedFourierLogBudget m P+2)^4 := by positivity + have hprod : 0 ≤ 2*allocatedFourierLogBudget m P*(2*allocatedFourierLogBudget m P+2)^4 := by positivity + dsimp only [allocatedFourierOutputBudget] + constructor + · linarith + constructor <;> linarith + +theorem exists_allocatedFourierOutputBudget_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ P : ℝ, 0 ≤ P → allocatedFourierOutputBudget m P ≤ (P+a)^a := by + obtain ⟨b, _, hb⟩ := exists_allocatedFourierLogBudget_bound m + let q : Polynomial ℕ := (Polynomial.X + Polynomial.C b)^b + let output : Polynomial ℕ := 2*q*(2*q+2)^4+q+(2*q+2)^4 + obtain ⟨a, ha, hout⟩ := exists_natPolynomial_eval_budget output + refine ⟨a, ha, ?_⟩ + intro P hP + have hQ := allocatedFourierLogBudget_nonneg m hP + have hqb := hb P hP + have hbound : 2*((P+b)^b)*(2*((P+b)^b)+2)^4+(P+b)^b+(2*((P+b)^b)+2)^4 ≤ (P+a)^a := by + simpa [output, q, Polynomial.eval₂_pow] using hout P hP + apply le_trans _ hbound + dsimp only [allocatedFourierOutputBudget] + gcongr + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +noncomputable def allocatedMaskedFourierBudget (m : ℕ) (P : ℝ) : ℝ := + let Q := allocatedFourierLogBudget m P + P + (4 * Q + 2) ^ 4 + (4 * Q * (4 * Q + 2) ^ 4 + Q) + +theorem allocatedMaskedFourierBudget_bounds (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + let Q := allocatedFourierLogBudget m P + let Ps := allocatedMaskedFourierBudget m P + 0 ≤ Ps ∧ P ≤ Ps ∧ (4 * Q + 2) ^ 4 ≤ Ps ∧ + 4 * Q * (4 * Q + 2) ^ 4 + Q ≤ Ps := by + have hQ := allocatedFourierLogBudget_nonneg m hP + have hF : 0 ≤ (4 * allocatedFourierLogBudget m P + 2) ^ 4 := by positivity + have hM : 0 ≤ 4 * allocatedFourierLogBudget m P * + (4 * allocatedFourierLogBudget m P + 2) ^ 4 + allocatedFourierLogBudget m P := by positivity + dsimp only [allocatedMaskedFourierBudget] + exact ⟨by linarith, by linarith, by linarith, by linarith⟩ + +theorem exists_allocatedMaskedFourierBudget_bound (m A : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ P : ℝ, 0 ≤ P → + allocatedMaskedFourierBudget m P ≤ (P + C) ^ C ∧ + (allocatedMaskedFourierBudget m P + A) ^ A ≤ (P + C) ^ C := by + obtain ⟨b, _, hb⟩ := exists_allocatedFourierLogBudget_bound m + let q : Polynomial ℕ := (Polynomial.X + Polynomial.C b) ^ b + let f : Polynomial ℕ := Polynomial.X + (4 * q + 2) ^ 4 + (4 * q * (4 * q + 2) ^ 4 + q) + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget (f + (f + Polynomial.C A) ^ A) + refine ⟨C, hC, ?_⟩ + intro P hP + let F : ℝ := P + (4 * (P + b) ^ b + 2) ^ 4 + + (4 * (P + b) ^ b * (4 * (P + b) ^ b + 2) ^ 4 + (P + b) ^ b) + have hF0 : 0 ≤ F := by dsimp only [F]; positivity + have hPs0 := (allocatedMaskedFourierBudget_bounds m hP).1 + have hPs : allocatedMaskedFourierBudget m P ≤ F := by + have hQ := allocatedFourierLogBudget_nonneg m hP + have hQB := hb P hP + dsimp only [allocatedMaskedFourierBudget, F] + gcongr + have hpow : (allocatedMaskedFourierBudget m P + A) ^ A ≤ (F + A) ^ A := by gcongr + have hpow0 : 0 ≤ (F + A) ^ A := by positivity + have htotal : F + (F + A) ^ A ≤ (P + C) ^ C := by + simpa [F, f, q, Polynomial.eval₂_pow] using hbound P hP + exact ⟨by linarith, by linarith⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (C V : Fin m → ℝ≥0) +variable (hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) +variable (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + +include hC hV in +theorem exists_allocated_coefficient_uniform_fourier + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hσ1 : ∀ j, σ j ≤ 1) + (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1/4) + {P δ : ℝ} (hP : 0 ≤ P) (hm : (m : ℝ) ≤ P) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hcount : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) ≤ P) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (hn : ∀ j, (n j : ℝ) ≤ P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hLP : (S.value : ℝ) ≤ Real.exp P) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (hδ : 0 < δ) (hδP : δ⁻¹ ≤ Real.exp P) : + let Q := allocatedFourierLogBudget m P + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → ∀ j : Fin m, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) (a : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2*Q*(2*Q+2)^4) ∧ + (∀ t j d, d.degree ≤ j.val+1 → ∀ i, |(frequency t j d i : ℝ)| ≤ Real.exp ((2*Q+2)^4)) ∧ + (∑ t, ‖a t‖) ≤ Real.exp (2*Q*(2*Q+2)^4+Q) ∧ + ∀ x, ‖(allocatedCoefficientDensity B U b hb o hR hσ S x : ℂ) - + coefficientTorusFourierSum U frequency a x‖ ≤ δ := by + have hbudget := allocatedCoefficient_fourier_input_budget B (J := J) R σ S.value S.positive C V + hP hm hK hR hσ hRP hσP hcount hI hn hJ hAP hLP hCP hVP + have hLip : + ((Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) * + allocatedAmbientFactorLip (G := G) B R σ S.value (fun j => Fintype.card (J j)) C V * + (allocatedAmbientFactorCap (G := G) B R σ S.value V)^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) : ℝ≥0) : ℝ) ≤ + Real.exp (allocatedFourierLogBudget m P) := by + simpa only [NNReal.coe_mul, NNReal.coe_pow, NNReal.coe_natCast] using hbudget.2.2.2 + obtain ⟨F, inst, frequency, a, hcard, hfreq, hsum, herr⟩ := + exists_allocated_coefficient_fourier_approximation B U b hb o S C V hC hV + hR hσ hσ1 Cinv hCinv hchart hsmall hδ (allocatedFourierLogBudget_nonneg m hP) + hbudget.2.1 hLip (hδP.trans (Real.exp_le_exp.mpr hbudget.1)) + let _ := inst + refine ⟨F, inst, frequency, a, hcard, hfreq, ?_, herr⟩ + exact hsum.trans ((mul_le_mul_of_nonneg_left hbudget.2.2.1 (Real.exp_nonneg _)).trans_eq + (Real.exp_add _ _).symm) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +noncomputable def allocatedJetFourierBudget (m q A : ℕ) (P : ℝ) : ℝ := + q + (P + A) ^ A + allocatedFourierOutputBudget m P + +theorem allocatedJetFourierBudget_nonneg (m q A : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ allocatedJetFourierBudget m q A P := by + have hQ := allocatedFourierLogBudget_nonneg m hP + unfold allocatedJetFourierBudget allocatedFourierOutputBudget + positivity + +theorem allocatedJetFourierBudget_dominates (m q A : ℕ) {P : ℝ} (hP : 0 ≤ P) : + let Q := allocatedFourierLogBudget m P + (P + A) ^ A ≤ allocatedJetFourierBudget m q A P ∧ + (2 : ℝ) ^ q * (Real.exp ((P + A) ^ A) * Real.exp ((2 * Q + 2) ^ 4)) ≤ + Real.exp (allocatedJetFourierBudget m q A P) ∧ + Real.exp (2 * Q * (2 * Q + 2) ^ 4 + Q) ≤ Real.exp (allocatedJetFourierBudget m q A P) := by + intro Q + have hQ := allocatedFourierLogBudget_nonneg m hP + have hF : 0 ≤ allocatedFourierOutputBudget m P := by + unfold allocatedFourierOutputBudget + positivity + have hA : 0 ≤ (P + A) ^ A := pow_nonneg (by positivity) _ + have hq : (0 : ℝ) ≤ q := Nat.cast_nonneg _ + have hdom := allocatedFourierOutputBudget_dominates m hP + have h2 : (2 : ℝ) ^ q ≤ Real.exp (q : ℝ) := by + calc + _ ≤ (Real.exp 1) ^ q := pow_le_pow_left₀ (by norm_num) + (by linarith [Real.add_one_le_exp (1 : ℝ)]) q + _ = _ := by rw [← Real.exp_nat_mul, mul_one] + refine ⟨?_, ?_, ?_⟩ + · unfold allocatedJetFourierBudget + linarith + · calc + _ ≤ Real.exp (q : ℝ) * (Real.exp ((P + A) ^ A) * Real.exp (allocatedFourierOutputBudget m P)) := + mul_le_mul h2 (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr hdom.2.1) (Real.exp_pos _).le) + (by positivity) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; unfold allocatedJetFourierBudget; ring + · apply Real.exp_le_exp.mpr + unfold allocatedJetFourierBudget + exact hdom.2.2.trans (by linarith) + +theorem exists_allocatedJetFourierBudget_bound (m q A : ℕ) : + ∃ B : ℕ, 2 ≤ B ∧ ∀ P : ℝ, 0 ≤ P → allocatedJetFourierBudget m q A P ≤ (P + B) ^ B := by + obtain ⟨b, _, hb⟩ := exists_allocatedFourierOutputBudget_bound m + obtain ⟨B, hB, hbound⟩ := exists_natPolynomial_eval_budget + (Polynomial.C q + (Polynomial.X + Polynomial.C A) ^ A + (Polynomial.X + Polynomial.C b) ^ b) + refine ⟨B, hB, ?_⟩ + intro P hP + have hpoly : (q : ℝ) + (P + A) ^ A + (P + b) ^ b ≤ (P + B) ^ B := by + simpa [Polynomial.eval₂_pow] using hbound P hP + unfold allocatedJetFourierBudget + linarith [hb P hP] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +def selectedScaleDimensionBudget (m : ℕ) (P : ℝ) : ℝ := + (m : ℝ) + geometricSiteBudget m 0 P + +theorem selectedScaleDimensionBudget_nonneg (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ selectedScaleDimensionBudget m P := + add_nonneg (Nat.cast_nonneg _) (geometricSiteBudget_nonneg m 0 hP) + +theorem le_selectedScaleDimensionBudget (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + P ≤ selectedScaleDimensionBudget m P := + (le_geometricSiteBudget m 0 hP).trans (le_add_of_nonneg_left (Nat.cast_nonneg _)) + +theorem degree_le_selectedScaleDimensionBudget (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + (m : ℝ) ≤ selectedScaleDimensionBudget m P := + le_add_of_nonneg_right (geometricSiteBudget_nonneg m 0 hP) + +theorem coefficientCount_le_selectedScaleDimensionBudget {K : Type*} [Fintype K] + (m : ℕ) {h : ℕ} (hh : h ≤ m) {P : ℝ} (hP : 0 ≤ P) (hK : (Fintype.card K : ℝ) ≤ P) : + (Fintype.card (BoundedCoefficientExponent K h) : ℝ) ≤ selectedScaleDimensionBudget m P := + (boundedCoefficientExponent_card_le_geometricSiteBudget m 0 hh hP hK).trans + (le_add_of_nonneg_left (Nat.cast_nonneg _)) + +def selectedFourierInputBudget (m : ℕ) (P : ℝ) : ℝ := + allocatedScaleLog (selectedScaleDimensionBudget m P) + +theorem selectedFourierInputBudget_nonneg (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ selectedFourierInputBudget m P := + allocatedScaleLog_nonneg (selectedScaleDimensionBudget_nonneg m hP) + +theorem le_selectedFourierInputBudget (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + P ≤ selectedFourierInputBudget m P := + (le_selectedScaleDimensionBudget m hP).trans + (le_allocatedScaleLog (selectedScaleDimensionBudget_nonneg m hP)) + +noncomputable def selectedFourierOutputBudget (m : ℕ) (P : ℝ) : ℝ := + allocatedFourierOutputBudget m (selectedFourierInputBudget m P) + +theorem exists_selectedFourierOutputBudget_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ P : ℝ, 0 ≤ P → selectedFourierOutputBudget m P ≤ (P+a)^a := by + obtain ⟨b, _, hb⟩ := exists_allocatedFourierOutputBudget_bound m + let t : Polynomial ℕ := Polynomial.C m + + (Polynomial.C (m+1) * (Polynomial.X+1)^(m+1) + 1) + let q : Polynomial ℕ := (1+t^2)*(5*t+49) + let budget : Polynomial ℕ := (q+Polynomial.C b)^b + obtain ⟨a, ha, hbudget⟩ := exists_natPolynomial_eval_budget budget + refine ⟨a, ha, ?_⟩ + intro P hP + apply (hb _ (selectedFourierInputBudget_nonneg m hP)).trans + simpa [budget, q, t, selectedFourierInputBudget, selectedScaleDimensionBudget, + geometricSiteBudget, allocatedScaleLog, Polynomial.eval₂_pow] using hbudget P hP + +noncomputable def selectedFourierExponent (m : ℕ) : ℕ := + (exists_selectedFourierOutputBudget_bound m).choose + +theorem selectedFourierExponent_two_le (m : ℕ) : 2 ≤ selectedFourierExponent m := + (exists_selectedFourierOutputBudget_bound m).choose_spec.1 + +theorem selectedFourierOutputBudget_bound (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + selectedFourierOutputBudget m P ≤ (P+selectedFourierExponent m)^selectedFourierExponent m := + (exists_selectedFourierOutputBudget_bound m).choose_spec.2 P hP + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule +open scoped BigOperators NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +noncomputable def allocatedMaskedCoefficientDensity (q : ℕ) + (mask : (CoefficientAmbientIndex (LayerSamplerVariables G I n B) J → ZMod q) → ℝ) + (x : CoefficientTorus (K := LayerSamplerVariables G I n B) U) : ℝ := + maskedIntegerTorusKernel q mask (allocatedCoefficientJointAmbientKernel B U b S o) + (coefficientAmbientTorus U x) + +variable (C V : Fin m → ℝ≥0) +variable (hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) +variable (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + +include hC hV in +theorem exists_allocated_masked_coefficient_fourier + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + (q : ℕ) (mask : (CoefficientAmbientIndex (LayerSamplerVariables G I n B) J → ZMod q) → ℝ) + (hmask : ∀ r, mask r ∈ Set.Icc (0 : ℝ) 1) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hdim : (Fintype.card (CoefficientAmbientIndex (LayerSamplerVariables G I n B) J) : ℝ) ≤ P) + (hLP : let A := allocatedAmbientFactorCap (G := G) B R σ S.value V + let L := allocatedAmbientFactorLip (G := G) B R σ S.value (fun j => Fintype.card (J j)) C V + let N := Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + (q : ℝ) * ((N * L * A^N : ℝ≥0) : ℝ) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → ∀ j : Fin m, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) + (a : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ t j d, d.degree ≤ j.val + 1 → ∀ i, + |(frequency t j d i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ t, ‖a t‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * + (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ)^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) ∧ + ∀ x, ‖(allocatedMaskedCoefficientDensity B U b o S q mask x : ℂ) - + coefficientTorusFourierSum U frequency a x‖ ≤ δ := by + have hk := allocatedCoefficientJointAmbientKernel_bounds B U b S o C V hC hV hR hσ + obtain ⟨F,inst,frequency,a,hcard,hfreq,hsum,herr⟩ := + exists_masked_integer_fourier_approximation q mask hmask + (allocatedCoefficientJointAmbientKernel B U b S o) _ + ((allocatedAmbientFactorCap (G := G) B R σ S.value V)^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m)) hk.2 + (fun x => by simpa only [NNReal.coe_pow, Set.mem_Icc] using hk.1 x) + (allocatedCoefficientJointAmbientKernel_support B U b S o) hδ hP hdim hLP hδP + let _ := inst + refine ⟨F,inst,fun t => coefficientSlotFrequency (fun s i => frequency t ⟨s,i⟩), + a,hcard,?_,?_,?_⟩ + · intro t + exact coefficientSlotFrequency_bound (fun s i => frequency t ⟨s,i⟩) + (fun s i => hfreq t ⟨s,i⟩) + · simpa only [NNReal.coe_pow] using hsum + · intro x + simpa only [allocatedMaskedCoefficientDensity, coefficientAmbientTorus_character, + coefficientTorusFourierSum] using herr (coefficientAmbientTorus U x) + +include hC hV in +theorem exists_allocated_masked_coefficient_uniform_fourier + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + (q : ℕ) (mask : (CoefficientAmbientIndex (LayerSamplerVariables G I n B) J → ZMod q) → ℝ) + (hmask : ∀ r, mask r ∈ Set.Icc (0 : ℝ) 1) + {P δ : ℝ} (hP : 0 ≤ P) (hm : (m : ℝ) ≤ P) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) ≤ P) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (hn : ∀ j, (n j : ℝ) ≤ P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hLP : (S.value : ℝ) ≤ Real.exp P) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (hqP : (q : ℝ) ≤ Real.exp P) (hδ : 0 < δ) (hδP : δ⁻¹ ≤ Real.exp P) : + let Q := allocatedFourierLogBudget m P + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → ∀ j : Fin m, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) + (a : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (4*Q*(4*Q+2)^4) ∧ + (∀ t j d, d.degree ≤ j.val+1 → ∀ i, |(frequency t j d i : ℝ)| ≤ Real.exp ((4*Q+2)^4)) ∧ + (∑ t, ‖a t‖) ≤ Real.exp (4*Q*(4*Q+2)^4+Q) ∧ + ∀ x, ‖(allocatedMaskedCoefficientDensity B U b o S q mask x : ℂ) - + coefficientTorusFourierSum U frequency a x‖ ≤ δ := by + let Q := allocatedFourierLogBudget m P + have hbudget := allocatedCoefficient_fourier_input_budget B (J := J) R σ S.value S.positive C V + hP hm hK hR hσ hRP hσP hcount hI hn hJ hAP hLP hCP hVP + have hQ : 0 ≤ Q := allocatedFourierLogBudget_nonneg m hP + have hP2 : P ≤ 2 * Q := hbudget.1.trans (by linarith) + have hscaled : let A := allocatedAmbientFactorCap (G := G) B R σ S.value V + let L := allocatedAmbientFactorLip (G := G) B R σ S.value (fun j => Fintype.card (J j)) C V + let N := Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + (q : ℝ) * ((N * L * A^N : ℝ≥0) : ℝ) ≤ Real.exp (2 * Q) := by + have hLip := hbudget.2.2.2 + simp only [NNReal.coe_mul, NNReal.coe_pow, NNReal.coe_natCast] + calc + _ ≤ Real.exp Q * Real.exp Q := mul_le_mul + (hqP.trans (Real.exp_le_exp.mpr hbudget.1)) hLip (by positivity) (Real.exp_nonneg _) + _ = Real.exp (2 * Q) := by rw [← Real.exp_add]; congr 1; ring + obtain ⟨F,inst,frequency,a,hcard,hfreq,hsum,herr⟩ := + exists_allocated_masked_coefficient_fourier B U b o S C V hC hV hR hσ q mask hmask + hδ (by positivity : 0 ≤ 2*Q) (hbudget.2.1.trans (by linarith)) hscaled + (hδP.trans (Real.exp_le_exp.mpr hP2)) + let _ := inst + have hfour : 2 * (2 * Q) = 4 * Q := by ring + refine ⟨F,inst,frequency,a,?_,?_,?_,herr⟩ + · simpa only [hfour] using hcard + · simpa only [hfour] using hfreq + · have hh := hsum.trans (mul_le_mul_of_nonneg_left hbudget.2.2.1 (Real.exp_nonneg _)) + simpa only [hfour, ← Real.exp_add] using hh + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedNormalizedTorusCutoff.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedNormalizedTorusCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c4e1522b731eaa17eb3f56547d77eab4bbad05b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedNormalizedTorusCutoff.lean @@ -0,0 +1,307 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedBufferedAmbientCutoff +import OAI.Combinatorics.Progressions.Estimates.AllocatedCanonicalNormalizer + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set +open scoped Classical BigOperators NNReal + +variable {m : ℕ} {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R : Fin m → ℝ} (r : ℝ≥0) (hr : 0 < r) +local notation "ambient" => JetAmbientIndex (fun _ : Fin m => Unit) J + +noncomputable def allocatedBufferedTorusCutoff : (ambient → UnitAddCircle) → ℝ := + smallBoxTorusKernel (allocatedBufferedAmbientCutoff (R := R) U b o r hr) + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + +include hR hC hchart hbudget in +theorem allocatedBufferedTorusCutoff_range (x : ambient → UnitAddCircle) : + 0 ≤ allocatedBufferedTorusCutoff (R := R) U b o r hr x ∧ + allocatedBufferedTorusCutoff (R := R) U b o r hr x ≤ 1 := by + apply smallBoxTorusKernel_range _ zero_le_one (allocatedBufferedAmbientCutoff_range U b o r hr) + intro z hz i + exact (allocatedBufferedAmbientCutoff_support U b o r hr hR C hC hchart hbudget z hz i).trans_lt (by norm_num) + +include hR hC hchart hbudget in +theorem allocatedBufferedTorusCutoff_lipschitz + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) : + LipschitzWith ((Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * + (K * ∑ j, Cforward j * Fintype.card (J j))) (allocatedBufferedTorusCutoff (R := R) U b o r hr) := by + apply smallBoxTorusKernel_lipschitz _ + (allocatedBufferedAmbientCutoff_lipschitz U b o r hr hR Cforward hforward K hK) + (fun z => (allocatedBufferedAmbientCutoff_range U b o r hr z).1) + intro z hz i + exact (allocatedBufferedAmbientCutoff_support U b o r hr hR C hC hchart hbudget z hz i).trans_lt (by norm_num) + +include hR hC hchart hbudget in +theorem allocatedBufferedTorusCutoff_local (z : ambient → ℝ) (hz : ∀ i, |z i| < 1 / 2) : + allocatedBufferedTorusCutoff (R := R) U b o r hr (fun i => (z i : UnitAddCircle)) = + allocatedBufferedAmbientCutoff (R := R) U b o r hr z := by + apply smallBoxTorusKernel_local _ _ z hz + intro v hv i + exact (allocatedBufferedAmbientCutoff_support U b o r hr hR C hC hchart hbudget v hv i).trans_lt (by norm_num) + +include hR hC hchart hbudget in +theorem allocatedBufferedTorusCutoff_zero_outside_quarter (x : ambient → UnitAddCircle) + (hx : ∃ i, 1 / 4 < ‖x i‖) : allocatedBufferedTorusCutoff (R := R) U b o r hr x = 0 := + smallBoxTorusKernel_zero_outside_quarter _ + (allocatedBufferedAmbientCutoff_support U b o r hr hR C hC hchart hbudget) x hx + +variable {G : Type*} [Fintype G] +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +include hR hC hchart hbudget in +theorem allocatedBufferedTorusCutoff_eq_siteChart + (y : EuclideanJetLayers U (fun _ => Unit)) : + (allocatedBufferedTorusCutoff (R := R) U b o r hr (coveredJetAmbientTorus U d y) : ℂ) = + allocatedBufferedSiteChartFactor B U b S o hb bW d r hr (fun _ => 1) y := by + let chart := mixedCoveredJetChart (O := fun _ => Unit) U o b hb bW d + let region := mixedCoveredJetRegion (O := fun _ => Unit) (E := E) U o b d + (fun j _ => standardLatticeSmallBox (J j)) + rw [allocatedBufferedSiteChartFactor_enlarge B U b S o hb bW d r hr (fun _ => 1) + hR C hC hchart hbudget (fun j _ => standardLatticeSmallBox (J j)) + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) (fun _ _ => Set.Subset.rfl)] + by_cases hy : y ∈ chart '' region + · obtain ⟨w, hw, rfl⟩ := hy + rw [restrictedComplexChartDensity_apply _ _ _ _ + (mixedCoveredJetChart_injOn U o b hb bW d _ (fun _ _ => Set.Subset.rfl)) hw, + Complex.ofReal_one, one_mul, coveredJetAmbientTorus_chart U b hb o bW d w] + have hs : ∀ i, |mixedJetAmbientPoint U b o w.1 i| < 1 / 2 := by + rintro ⟨j, t, i⟩ + exact (hw j (Set.mem_univ j) t (Set.mem_univ t)).1 i + rw [allocatedBufferedTorusCutoff_local U b o r hr hR C hC hchart hbudget _ hs] + unfold allocatedBufferedAmbientCutoff allocatedBufferedMixedSiteFactor bufferedCoordinateProjection + rw [allocatedFullAmbientSiteCoordinates_point, mul_one] + · rw [restrictedComplexChartDensity_zero _ _ _ _ hy] + suffices hz : allocatedBufferedTorusCutoff (R := R) U b o r hr (coveredJetAmbientTorus U d y) = 0 by + rw [hz, Complex.ofReal_zero] + by_contra hn + obtain ⟨v, hv, he, _⟩ := smallBoxTorusKernel_nonzero_quarter_lift _ + (allocatedBufferedAmbientCutoff_support U b o r hr hR C hC hchart hbudget) + (coveredJetAmbientTorus U d y) hn + exact hy (coveredJetAmbientTorus_smallBox_mem_chart U b hb o bW d y v + (fun i => congrFun he i) (fun i => (hv i).trans_lt (by norm_num))) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R : Fin m → ℝ} + +local notation "single" => (fun _ : Fin m => Unit) +local notation "ambient" => JetAmbientIndex single J + +variable (r : ℝ≥0) (hr : 0 < r) + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rowAmbient" => JetAmbientIndex rowTypes J + +noncomputable def allocatedProductTorusCutoff (z : rowAmbient → UnitAddCircle) : ℝ := + ∏ s : Finset α, allocatedBufferedTorusCutoff (R := R) U b o r hr (rowSiteAmbientTorus rowSets s z) + +include hR hC hchart hbudget in +theorem allocatedProductTorusCutoff_range (z : rowAmbient → UnitAddCircle) : + 0 ≤ allocatedProductTorusCutoff (R := R) U b o r hr rowSets z ∧ + allocatedProductTorusCutoff (R := R) U b o r hr rowSets z ≤ 1 := by + constructor + · exact Finset.prod_nonneg (fun s _ => (allocatedBufferedTorusCutoff_range U b o r hr hR C hC hchart hbudget _).1) + · exact Finset.prod_le_one₀ (fun s _ => (allocatedBufferedTorusCutoff_range U b o r hr hR C hC hchart hbudget _).1) + (fun s _ => (allocatedBufferedTorusCutoff_range U b o r hr hR C hC hchart hbudget _).2) + +include hR hC hchart hbudget in +theorem allocatedProductTorusCutoff_lipschitz (D : Fin m → ℝ≥0) + (hD : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ D j * ‖v‖) + (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) : + LipschitzWith (Fintype.card (Finset α) * + (((Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * + (K * ∑ j, D j * Fintype.card (J j))) * ∑ j, ((rowSets j).card : ℝ≥0))) + (allocatedProductTorusCutoff (R := R) U b o r hr rowSets) := by + let f := fun s (z : rowAmbient → UnitAddCircle) => + (allocatedBufferedTorusCutoff (R := R) U b o r hr (rowSiteAmbientTorus rowSets s z) : ℂ) + have hf (s : Finset α) : LipschitzWith + (((Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * + (K * ∑ j, D j * Fintype.card (J j))) * ∑ j, ((rowSets j).card : ℝ≥0)) (f s) := by + apply LipschitzWith.of_dist_le_mul + intro z w + rw [Complex.isometry_ofReal.dist_eq] + exact ((allocatedBufferedTorusCutoff_lipschitz U b o r hr hR C hC hchart hbudget D hD K hK).comp + (rowSiteAmbientTorus_lipschitz rowSets s)).dist_le_mul z w + have hbnd (s : Finset α) (z : rowAmbient → UnitAddCircle) : ‖f s z‖ ≤ (1 : ℝ≥0) := by + have h := allocatedBufferedTorusCutoff_range U b o r hr hR C hC hchart hbudget (rowSiteAmbientTorus rowSets s z) + simpa only [f, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg h.1, NNReal.coe_one] using h.2 + have h := (bounded_lipschitz_fintype_prod f (B := 1) le_rfl hf hbnd).2 + apply LipschitzWith.of_dist_le_mul + intro z w + have hd := h.dist_le_mul z w + simpa only [f, ← Complex.ofReal_prod, Complex.isometry_ofReal.dist_eq, + one_pow, mul_one, allocatedProductTorusCutoff] using hd + +variable {G : Type*} [Fintype G] +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +include hR hC hchart hbudget in +theorem allocatedProductTorusCutoff_eq (y : EuclideanJetLayers U rowTypes) : + (allocatedProductTorusCutoff (R := R) U b o r hr rowSets (coveredJetAmbientTorus U d y) : ℂ) = + allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr y := by + unfold allocatedProductTorusCutoff allocatedProductSiteCutoff + rw [Complex.ofReal_prod] + apply Finset.prod_congr rfl + intro s _ + rw [← coveredRowsSiteValue_ambient] + exact allocatedBufferedTorusCutoff_eq_siteChart U b o r hr hR C hC hchart hbudget B S hb bW d _ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R : Fin m → ℝ} + +local notation "single" => (fun _ : Fin m => Unit) +local notation "ambient" => JetAmbientIndex single J + +variable (r : ℝ≥0) (hr : 0 < r) + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rowAmbient" => JetAmbientIndex rowTypes J + +variable {G : Type*} [Fintype G] +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "amp" => ‖((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹‖ +local notation "ampN" => ‖((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹‖₊ + +noncomputable def allocatedNormalizedProductTorusCutoff (z : rowAmbient → UnitAddCircle) : ℝ := + amp * allocatedProductTorusCutoff (R := R) U b o r hr rowSets z + +omit [∀ j, Fintype (E j)] [NeZero d] in +include hR hC hchart hbudget in +theorem allocatedNormalizedProductTorusCutoff_range (z : rowAmbient → UnitAddCircle) : + 0 ≤ allocatedNormalizedProductTorusCutoff U b o r hr rowSets B S z ∧ + allocatedNormalizedProductTorusCutoff U b o r hr rowSets B S z ≤ amp := by + have h := allocatedProductTorusCutoff_range U b o r hr hR C hC hchart hbudget rowSets z + exact ⟨mul_nonneg (norm_nonneg _) h.1, + (mul_le_mul_of_nonneg_left h.2 (norm_nonneg _)).trans_eq (mul_one _)⟩ + +include hR hC hchart hbudget in +theorem allocatedNormalizedProductTorusCutoff_pullback (y : EuclideanJetLayers U rowTypes) : + allocatedNormalizedProductTorusCutoff U b o r hr rowSets B S (coveredJetAmbientTorus U d y) = + amp * ‖allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr y‖ := by + have he := congrArg norm (allocatedProductTorusCutoff_eq U b o r hr hR C hC hchart hbudget rowSets B S hb bW d y) + rw [Complex.norm_real, Real.norm_of_nonneg + (allocatedProductTorusCutoff_range U b o r hr hR C hC hchart hbudget rowSets _).1] at he + exact congrArg (fun z => amp * z) he + +variable (D : Fin m → ℝ≥0) +variable (hD : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ D j * ‖v‖) +variable (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) +local notation "cutoffL" => (Fintype.card (Finset α) * + (((Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * + (K * ∑ j, D j * Fintype.card (J j))) * ∑ j, (Finset.card (rowSets j) : ℝ≥0))) + +omit [∀ j, Fintype (E j)] [NeZero d] in +include hR hC hchart hbudget hD hK in +theorem allocatedNormalizedProductTorusCutoff_lipschitz : + LipschitzWith (ampN * cutoffL) (allocatedNormalizedProductTorusCutoff U b o r hr rowSets B S) := by + have h := allocatedProductTorusCutoff_lipschitz U b o r hr hR C hC hchart hbudget rowSets D hD K hK + apply LipschitzWith.of_dist_le_mul + intro z w + change |amp * allocatedProductTorusCutoff U b o r hr rowSets z - + amp * allocatedProductTorusCutoff U b o r hr rowSets w| ≤ _ + rw [← mul_sub, abs_mul, abs_of_nonneg (norm_nonneg _)] + have hh := mul_le_mul_of_nonneg_left (h.dist_le_mul z w) (norm_nonneg (((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹)) + simpa only [Real.dist_eq, NNReal.coe_mul, coe_nnnorm, mul_assoc] using hh + +omit [∀ j, Fintype (E j)] [NeZero d] in +include hR hC hchart hbudget hD hK in +theorem exists_allocated_normalized_cutoff_fourier {δ P : ℝ} + (hδ : 0 < δ) (hP : 0 ≤ P) (hdim : (Fintype.card rowAmbient : ℝ) ≤ P) + (hLip : ((ampN * cutoffL : ℝ≥0) : ℝ) ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), let _ : Fintype F := inst + ∃ (frequency : F → rowAmbient → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a i, |(frequency a i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * amp ∧ + ∀ z, ‖(allocatedNormalizedProductTorusCutoff U b o r hr rowSets B S z : ℂ) - + ∑ a, c a * ∏ i, CircleFourier.character (frequency a i • z i)‖ ≤ δ := by + have h := allocatedNormalizedProductTorusCutoff_lipschitz U b o r hr hR C hC hchart hbudget rowSets B S D hD K hK + have hl : LipschitzWith (ampN * cutoffL) + (fun z => (allocatedNormalizedProductTorusCutoff U b o r hr rowSets B S z : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro z w + rw [Complex.isometry_ofReal.dist_eq] + exact h.dist_le_mul z w + apply exists_ambient_torus_fourier_approximation _ (ampN * cutoffL) ampN hl _ hδ hP hdim hLip hδP + intro z + have hz := allocatedNormalizedProductTorusCutoff_range U b o r hr hR C hC hchart hbudget rowSets B S z + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hz.1, coe_nnnorm] using hz.2 + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedPointSpectrumCap.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedPointSpectrumCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..92e00c264b0aafe8ae15bb680c6e7f6e2b6c8ac8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedPointSpectrumCap.lean @@ -0,0 +1,106 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedPhysicalPointMixture + +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)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) +variable [∀ 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 → ℝ} (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 (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 hsize +local notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactive +local 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) + +theorem allocatedActiveResiduePointApproximation_norm_le + (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) + (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⟩)) + (shift z : rows → ℤ) (F : Finset (rows → Fin M)) : + ‖allocatedActiveResiduePointApproximation B U basis hR S q r j i hactive hq hsize + M rows shift z F‖ ≤ + positiveModerateSpectrumCardBudget j.val rows.card ((layerTailDegree m + 1) * rows.card) + P ((torus : ℝ) / (2 * gamma)) ((torus : ℝ) ^ rows.card) 1 + 1 := by + have hMK : (M : ℝ) ≤ (torus : ℝ) * basisAxisScale (basis j) i := by + simp only [hM, Nat.cast_mul, le_refl] + have hscale : ((basisAxisScale (basis j) i : ℝ) / M) ^ rows.card ≤ 1 := by + rw [hM, Nat.cast_mul] + exact grid_scale_factor_le_one _ _ _ (blockTorusFactor_pos _ _ _ _) + (basisAxisScale_pos (basis j) i) + have hcap := allocatedSupportedResidueSpectrum_absolute_cap B U basis hR S j i hactive q hq r hsize + hgrid A hA P hcP hsP (Nat.cast_nonneg torus) (Nat.pos_of_ne_zero (NeZero.ne M)) + hMK rows hrows hB + have hnorm := weightedModerateGridApproximation_norm_le_cap + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources (basisAxisScale (basis j) i) M rows + (fun _ => 0) shift z F hscale (by simpa only [Int.cast_zero] using hcap) + unfold allocatedActiveResiduePointApproximation + split_ifs + · exact hnorm + · simpa only [norm_zero] using (norm_nonneg _).trans hnorm + +theorem allocatedSupportedPointApproximation_norm_le + (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) + (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⟩)) + (ε : ℝ) (shift z : rows → ℤ) : + ‖allocatedSupportedPointApproximation B U basis hR S q r j i hactive hq hsize + P ε M rows shift z‖ ≤ + positiveModerateSpectrumCardBudget j.val rows.card ((layerTailDegree m + 1) * rows.card) + P ((torus : ℝ) / (2 * gamma)) ((torus : ℝ) ^ rows.card) 1 + 1 := by + unfold allocatedSupportedPointApproximation + exact allocatedActiveResiduePointApproximation_norm_le B U basis hR S q r j i hactive hq hsize + hgrid A hA P hcP hsP hM rows hrows hB shift z _ + +theorem allocatedSupportedPhysicalPointApproximation_norm_le + (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) + (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⟩)) + (ε : ℝ) (z : rows → ℤ) : + ‖allocatedSupportedPhysicalPointApproximation B U basis hR hσ S q r j i hactive hq hsize + P ε M rows z‖ ≤ + positiveModerateSpectrumCardBudget j.val rows.card ((layerTailDegree m + 1) * rows.card) + P ((torus : ℝ) / (2 * gamma)) ((torus : ℝ) ^ rows.card) 1 + 1 := by + unfold allocatedSupportedPhysicalPointApproximation + apply pmf_complex_average_norm_le + intro c + exact allocatedSupportedPointApproximation_norm_le B U basis hR S q r j i hactive hq hsize + hgrid A hA P hcP hsP hM rows hrows hB ε _ z + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedPositiveFourierData.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedPositiveFourierData.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b8dc3d5f48f27237b71efafbc0b0f92c9636ae5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedPositiveFourierData.lean @@ -0,0 +1,79 @@ +import OAI.Combinatorics.Progressions.Dynamics.PositiveComparisonDataBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (basis : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) +variable (C V : Fin m → ℝ≥0) +variable (hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ C j * ‖z‖) +variable (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ V j) + +include hC hV in +theorem exists_allocated_positive_fourier_data (q : ℕ) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hσ1 : ∀ j, σ j ≤ 1) + (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm z‖ ≤ Cinv j * ‖z‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + {p : ℝ} (hp : 0 ≤ p) (hm : (m : ℝ) ≤ p) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp p) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp p) + (hcount : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn : ∀ j, (n j : ℝ) ≤ p) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp p) (hLP : (S.value : ℝ) ≤ Real.exp p) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp p) (hVP : ∀ j, (V j : ℝ) ≤ Real.exp p) : + let Q := positiveComparisonDataBudget m q p + let b := allocatedFourierLogBudget m (2 * p + 4) + ((allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) ≤ Real.exp b) ∧ + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → ∀ j, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) (coeff : F → ℂ), + (∀ t j d, d.degree ≤ j.val + 1 → ∀ i, |(frequency t j d i : ℝ)| ≤ Real.exp Q) ∧ + (∑ t, ‖coeff t‖) ≤ Real.exp Q ∧ + ∀ z, ‖(allocatedCoefficientDensity B U basis hb o hR hσ S z : ℂ) - + coefficientTorusFourierSum U frequency coeff z‖ ≤ positiveProjectionAccuracy p := by + let P := 2 * p + 4 + have hP : 0 ≤ P := by dsimp [P]; linarith + have hpP : p ≤ P := by dsimp [P]; linarith + have hE := Real.exp_le_exp.mpr hpP + have hdata := allocatedCoefficient_fourier_input_budget B (J := J) R σ S.value S.positive C V + hP (hm.trans hpP) (hK.trans hpP) hR hσ + (fun j => (hRP j).trans hE) (fun j => (hσP j).trans hE) + (fun j => (hcount j).trans hpP) (fun j => (hI j).trans hpP) (fun j => (hn j).trans hpP) + (fun j => (hJ j).trans hpP) (hAP.trans hE) (hLP.trans hE) + (fun j => (hCP j).trans hE) (fun j => (hVP j).trans hE) + refine ⟨hdata.2.2.1, ?_⟩ + obtain ⟨F, inst, frequency, coeff, _, hfreq, hcoeff, happ⟩ := + exists_allocated_coefficient_uniform_fourier B U basis hb o S C V hC hV + hR hσ hσ1 Cinv hCinv hchart hsmall hP (hm.trans hpP) (hK.trans hpP) + (fun j => (hRP j).trans hE) (fun j => (hσP j).trans hE) + (fun j => (hcount j).trans hpP) (fun j => (hI j).trans hpP) (fun j => (hn j).trans hpP) + (fun j => (hJ j).trans hpP) (hAP.trans hE) (hLP.trans hE) + (fun j => (hCP j).trans hE) (fun j => (hVP j).trans hE) + (show 0 < positiveProjectionAccuracy p from Real.exp_pos _) + (by simp only [positiveProjectionAccuracy, Real.exp_neg, inv_inv]; exact le_rfl) + let _ := inst + have hQ := (positiveComparisonDataBudget_bounds m q hp).2.2.2.1 + have hF := allocatedFourierOutputBudget_dominates m hP + refine ⟨F, inst, frequency, coeff, ?_, ?_, happ⟩ + · exact fun t j d hd i => (hfreq t j d hd i).trans (Real.exp_le_exp.mpr (hF.2.1.trans hQ)) + · exact hcoeff.trans (Real.exp_le_exp.mpr (hF.2.2.trans hQ)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProbabilityFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProbabilityFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f8445b5e7313eea1f3728d2ab285456844e2cb2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProbabilityFourier.lean @@ -0,0 +1,102 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedProbabilityMajorantMass + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (laws : ∀ a : {a // allocatedGridAxis (I := I) U b S.value a}, PMF (CoefficientJetAxisRow O a.val)) + +theorem exists_allocated_probability_fourier (η A : ℝ≥0) (C V : Fin m → ℝ≥0) + (hC : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hdim : (Fintype.card (JetAmbientIndex O J) : ℝ) ≤ P) + (hLip : (allocatedErrorKernelLip B U b S (O := O) η A C V : ℝ) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), let _ : Fintype F := inst + ∃ (frequency : F → JetAmbientIndex O J → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a i, |(frequency a i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * + allocatedErrorKernelCap B U b S (O := O) η A V ∧ + ∀ y, ‖(allocatedProbabilityTorusKernel B U b S o laws η A y : ℂ) - + ∑ a, c a * ∏ i, CircleFourier.character (frequency a i • y i)‖ ≤ δ := by + have h := allocatedProbabilityTorusKernel_bounds B U b S o laws η A C V hC hV + have hl : LipschitzWith (allocatedErrorKernelLip B U b S (O := O) η A C V) + (fun y => (allocatedProbabilityTorusKernel B U b S o laws η A y : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro y z + rw [Complex.isometry_ofReal.dist_eq] + exact h.2.dist_le_mul y z + exact exists_ambient_torus_fourier_approximation _ _ _ hl + (fun y => by simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (h.1 y).1] using (h.1 y).2) + hδ hP hdim hLip hδP + +end Erdos3.VectorPolynomial + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule VectorPolynomial +open scoped BigOperators Classical NNReal + +variable {m q : ℕ} {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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +local notation "jets" => (fun j : Fin m => BoundedBooleanJet (Fin q) ((j : ℕ) + 1)) + +variable (laws : ∀ a : {a // allocatedGridAxis (I := I) U b S.value a}, + PMF (CoefficientJetAxisRow (fun j : Fin m => BoundedBooleanJet (Fin q) (j.val + 1)) a.val)) + +theorem exists_allocated_probability_standard_fourier (d : ℕ) (η A : ℝ≥0) (C V : Fin m → ℝ≥0) + (hC : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hdim : (Fintype.card (JetAmbientIndex jets J) : ℝ) ≤ P) + (hLip : (allocatedErrorKernelLip B U b S (O := jets) η A C V : ℝ) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), let _ : Fintype F := inst + ∃ (frequency : F → ∀ j, (Fin q →₀ ℕ) → J j → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a j e, e.degree ≤ j.val + 1 → ∀ i, + |(frequency a j e i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4) * d) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * + allocatedErrorKernelCap B U b S (O := jets) η A V ∧ + ∀ y, ‖(allocatedProbabilityMajorant B U b S o laws η A d + (standardPhysicalJetMap U y) : ℂ) - coefficientTorusFourierSum U frequency c y‖ ≤ δ := by + obtain ⟨F, inst, frequency, c, hcard, hfreq, hsum, herr⟩ := + exists_allocated_probability_fourier B U b S o laws η A C V hC hV hδ hP hdim hLip hδP + let _ := inst + refine ⟨F, inst, fun a => standardJetFrequency d (frequency a), c, hcard, ?_, hsum, ?_⟩ + · intro a j e he i + exact standardJetFrequency_bound d (frequency a) (hfreq a) j e he i + · intro y + change ‖(allocatedProbabilityTorusKernel B U b S o laws η A + (coveredJetAmbientTorus U d (standardPhysicalJetMap U y)) : ℂ) - + ∑ a, c a * coefficientTorusCharacter U (standardJetFrequency d (frequency a)) y‖ ≤ δ + simpa only [standardJetFrequency_character] using + herr (coveredJetAmbientTorus U d (standardPhysicalJetMap U y)) + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProfileErrorStandardFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProfileErrorStandardFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..0dd8c18cd115a0bfa9e380d8bdbcd05f4a40a8e1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProfileErrorStandardFourier.lean @@ -0,0 +1,80 @@ +import OAI.Combinatorics.Progressions.Linear.AllocatedProbabilityProfileKernel + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule VectorPolynomial +open scoped BigOperators Classical NNReal + +variable {m q : ℕ} {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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {α : Type*} [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (rows : ∀ j : Fin m, BoundedBooleanJet (Fin q) (j.val + 1) → Finset α) + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet (Fin q) ((j : ℕ) + 1)) + +local notation "output" => (Σ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, jets (Sigma.fst (Subtype.val a))) + +theorem exists_allocated_profile_error_standard_fourier (d : ℕ) (A : ℝ≥0) + (f g : (output → ℝ) → ℝ) {Cf Cg Kf Kg : ℝ≥0} + (hf : LipschitzWith Kf f) (hg : LipschitzWith Kg g) + (hfb : ∀ z, |f z| ≤ Cf) (hgb : ∀ z, |g z| ≤ Cg) + (C V : Fin m → ℝ≥0) + (hC : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hdim : (Fintype.card (JetAmbientIndex jets J) : ℝ) ≤ P) + (hLip : (allocatedProfileErrorLip B U b S (O := jets) A Cf Cg Kf Kg C V : ℝ) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), let _ : Fintype F := inst + ∃ (frequency : F → ∀ j, (Fin q →₀ ℕ) → J j → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a j e, e.degree ≤ j.val + 1 → ∀ i, + |(frequency a j e i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4) * d) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * + allocatedProfileErrorCap B U b S (O := jets) A Cf Cg V ∧ + ∀ y, ‖(allocatedProfileErrorMajorant B U b S o hR hσ x u v rows A f g d + (standardPhysicalJetMap U y) : ℂ) - coefficientTorusFourierSum U frequency c y‖ ≤ δ := by + obtain ⟨F, inst, frequency, c, hcard, hfreq, hsum, herr⟩ := + exists_allocated_profile_error_fourier B U b S o hR hσ x u v rows A f g hf hg hfb hgb C V hC hV hδ hP hdim hLip hδP + let _ : Fintype F := inst + refine ⟨F, inst, fun a => standardJetFrequency d (frequency a), c, hcard, ?_, hsum, ?_⟩ + · intro a j e he i + exact standardJetFrequency_bound d (frequency a) (hfreq a) j e he i + · intro y + change ‖(allocatedProfileErrorTorusKernel B U b S o hR hσ x u v rows A f g + (coveredJetAmbientTorus U d (standardPhysicalJetMap U y)) : ℂ) - + ∑ a, c a * coefficientTorusCharacter U (standardJetFrequency d (frequency a)) y‖ ≤ δ + simpa only [standardJetFrequency_character] using + herr (coveredJetAmbientTorus U d (standardPhysicalJetMap U y)) + +theorem allocatedProfileErrorMajorant_sample {X : Type*} (A : ℝ≥0) + (f g : (output → ℝ) → ℝ) (d : ℕ) [NeZero d] + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j e, coefficients (p j) e ∈ U j) (z : X → (Unit ⊕ Fin q) → ℤ) : + allocatedProfileErrorMajorant B U b S o hR hσ x u v rows A f g d + (physicalCubeEuclideanSample U d p hm z) = + allocatedProfileErrorMajorant B U b S o hR hσ x u v rows A f g 1 + (physicalCubeEuclideanSample U 1 p hm z) := by + unfold allocatedProfileErrorMajorant + rw [coveredJetAmbientTorus_sample] + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProjectedFourierData.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProjectedFourierData.lean new file mode 100644 index 0000000000000000000000000000000000000000..82252913a507c75ee74e21991ccf1a27e85c3d39 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedProjectedFourierData.lean @@ -0,0 +1,46 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedDensitySourceFamily + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel MeasureTheory +open scoped BigOperators Classical NNReal + +variable {m q : ℕ} {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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (C V : Fin m → ℝ≥0) (d : ℕ) +variable (g : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin q) (allocatedPrincipalSides B U b S) → + EuclideanJetLayers U (fun j => BoundedBooleanJet (Fin q) (j.val + 1)) → ℝ) + +def allocatedProjectedFourierData (A : ℕ) (P : ℝ) : Prop := + (d : ℝ) ≤ Real.exp (allocatedJetFourierBudget m q A P) ∧ + ∀ (_hm : (m : ℝ) ≤ P) + (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (_hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) (y), + ∀ {δ : ℝ} (_hδ : 0 < δ) (_hδP : δ⁻¹ ≤ Real.exp P), + let Q := allocatedJetFourierBudget m q A P + ∃ (Index : Type) (inst : Fintype Index), let _ := inst + ∃ (frequency : Index → ∀ j, (Fin q →₀ ℕ) → J j → ℤ) (coeff : Index → ℂ), + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ Real.exp Q) ∧ + (∑ a, ‖coeff a‖) ≤ Real.exp Q ∧ + ∀ z : CoefficientTorus (K := Fin q) U, + ‖(g y (standardPhysicalJetMap U z) : ℂ) - coefficientTorusFourierSum U frequency coeff z‖ ≤ δ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedRecoveredTagTorusVariation.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedRecoveredTagTorusVariation.lean new file mode 100644 index 0000000000000000000000000000000000000000..696c6e940067f8a2d704ff1d2d6ead0b1412f6c2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedRecoveredTagTorusVariation.lean @@ -0,0 +1,142 @@ +import OAI.Combinatorics.Progressions.Fourier.IntegerPolynomialTorusPeriod +import OAI.Combinatorics.Progressions.Geometry.CertifiedFullChartFrozenTerminal + +namespace OAI + +section + +namespace Erdos3 + +theorem unitCircle_dist_div_integer_parts {q : ℕ} (hq : 0 < q) + (center r₀ r₁ : ℝ) (z₀ z₁ : ℤ) + (hz : (((z₀ : ℝ) / q : ℝ) : UnitAddCircle) = + (((z₁ : ℝ) / q : ℝ) : UnitAddCircle)) : + dist (((center + r₀ + z₀) / q : ℝ) : UnitAddCircle) + (((center + r₁ + z₁) / q : ℝ) : UnitAddCircle) ≤ |r₀ - r₁| / q := by + have hqR : (0 : ℝ) < q := by exact_mod_cast hq + simp only [add_div, AddCircle.coe_add, hz, dist_add_right, dist_add_left] + rw [dist_eq_norm, ← QuotientAddGroup.mk_sub] + calc + _ ≤ ‖r₀ / (q : ℝ) - r₁ / q‖ := QuotientAddGroup.norm_mk_le_norm + _ = |r₀ - r₁| / q := by rw [← sub_div, Real.norm_eq_abs, abs_div, abs_of_pos hqR] + +namespace VectorPolynomial + +variable {m : ℕ} {X : Type*} {J : Fin m → Type*} [∀ j, Fintype (J j)] + +theorem physicalGridFactorInput_dist_le_of_integer_remainders + (q : ℕ) (hq : 0 < q) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (u v : X → ℝ) (center r₀ r₁ : ∀ j, J j → ℝ) (z₀ z₁ : ∀ j, J j → ℤ) + (hu : ∀ j i, eval u (poly j) i = center j i + r₀ j i + (z₀ j i : ℝ)) + (hv : ∀ j i, eval v (poly j) i = center j i + r₁ j i + (z₁ j i : ℝ)) + (hz : ∀ j i, (((z₀ j i : ℝ) / q : ℝ) : UnitAddCircle) = + (((z₁ j i : ℝ) / q : ℝ) : UnitAddCircle)) + {ε : ℝ} (hε : 0 ≤ ε) (herr : ∀ j i, |r₀ j i - r₁ j i| ≤ ε) : + dist (physicalGridFactorInput q poly u) (physicalGridFactorInput q poly v) ≤ ε / q := by + apply (dist_pi_le_iff (div_nonneg hε (Nat.cast_nonneg q))).mpr + intro z + change dist (((eval u (poly z.1) z.2 / q : ℝ) : UnitAddCircle)) + (((eval v (poly z.1) z.2 / q : ℝ) : UnitAddCircle)) ≤ _ + rw [hu, hv] + exact (unitCircle_dist_div_integer_parts hq _ _ _ _ _ (hz z.1 z.2)).trans + (div_le_div_of_nonneg_right (herr z.1 z.2) (Nat.cast_nonneg q)) + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical + +variable {G : Type*} [Fintype G] {I E : Fin m → Type*} +variable [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_remainder_at_site + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (x : LayerSamplerVariables G I n B → ℤ) (j : Fin m) (i : J j) : + eval (fun z => (jointIntegerPhysicalSite x (a, v) z : ℝ)) (poly j) i = + (c j).val i + mixedPolynomialPoint (euclideanSubspace (U j)) (b j) (o j) Subtype.val + (sample j).1 (sample j).2 (fun k => (x k : ℝ)) i + + (MvPolynomial.eval x (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample + (Sum.inr ⟨j, i⟩)) : ℝ) := by + have hr := h.integerFullChart_remainder B U b hb o S hR hσ poly hm hp c a v sample read + (fun k => (x k : ℝ)) j i + rw [← eval_jointIntegerPhysicalSite_eq_frame a v, integerSampledRealChart_eval] at hr + linarith + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_torus_dist + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (q : ℕ) (hq : 0 < q) (x y : LayerSamplerVariables G I n B → ℤ) + (hxy : ∀ k, (x k : ZMod q) = (y k : ZMod q)) + {ε : ℝ} (hε : 0 ≤ ε) + (herr : ∀ j i, |mixedPolynomialPoint (euclideanSubspace (U j)) (b j) (o j) Subtype.val + (sample j).1 (sample j).2 (fun k => (x k : ℝ)) i - + mixedPolynomialPoint (euclideanSubspace (U j)) (b j) (o j) Subtype.val + (sample j).1 (sample j).2 (fun k => (y k : ℝ)) i| ≤ ε) : + dist (physicalGridFactorInput q poly (fun z => (jointIntegerPhysicalSite x (a, v) z : ℝ))) + (physicalGridFactorInput q poly (fun z => (jointIntegerPhysicalSite y (a, v) z : ℝ))) ≤ ε / q := by + apply physicalGridFactorInput_dist_le_of_integer_remainders q hq poly + (fun z => (jointIntegerPhysicalSite x (a, v) z : ℝ)) + (fun z => (jointIntegerPhysicalSite y (a, v) z : ℝ)) + (fun j => (c j).val) + (fun j => mixedPolynomialPoint (euclideanSubspace (U j)) (b j) (o j) Subtype.val + (sample j).1 (sample j).2 (fun k => (x k : ℝ))) + (fun j => mixedPolynomialPoint (euclideanSubspace (U j)) (b j) (o j) Subtype.val + (sample j).1 (sample j).2 (fun k => (y k : ℝ))) + (fun j i => MvPolynomial.eval x + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample (Sum.inr ⟨j, i⟩))) + (fun j i => MvPolynomial.eval y + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample (Sum.inr ⟨j, i⟩))) + (h.integerFullChart_remainder_at_site B U b hb o S hR hσ poly hm hp c a v sample read x) + (h.integerFullChart_remainder_at_site B U b hb o S hR hσ poly hm hp c a v sample read y) + (fun j i => integerPolynomial_eval_addCircle_div_eq _ q x y hxy) hε herr + +theorem AllocatedCenteredFramedRecoveredSampleAt.frozenIntegerFullChart_torus_dist + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬ keep i} → ℤ) + (q : ℕ) (hq : 0 < q) (x y : {i // keep i} → ℤ) + (hxy : ∀ k, (x k : ZMod q) = (y k : ZMod q)) + {ε : ℝ} (hε : 0 ≤ ε) + (herr : ∀ j i, |mixedPolynomialPoint (euclideanSubspace (U j)) (b j) (o j) Subtype.val + (sample j).1 (sample j).2 (fun k => ((finiteSplitPoint keep x fixed k : ℤ) : ℝ)) i - + mixedPolynomialPoint (euclideanSubspace (U j)) (b j) (o j) Subtype.val + (sample j).1 (sample j).2 (fun k => ((finiteSplitPoint keep y fixed k : ℤ) : ℝ)) i| ≤ ε) : + dist (physicalGridFactorInput q poly (fun z => (integerSampledSpatial + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) x z : ℝ))) + (physicalGridFactorInput q poly (fun z => (integerSampledSpatial + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) y z : ℝ))) ≤ ε / q := by + rw [allocatedFrozenIntegerFullChart_spatial, allocatedFrozenIntegerFullChart_spatial] + apply h.integerFullChart_torus_dist B U b hb o S hR hσ poly hm hp c a v sample read q hq + (finiteSplitPoint keep x fixed) (finiteSplitPoint keep y fixed) _ hε herr + intro k + classical + by_cases hk : keep k + · simpa only [finiteSplitPoint, dite_eq_left hk] using hxy ⟨k, hk⟩ + · simp only [finiteSplitPoint, dite_eq_right hk] + +end VectorPolynomial +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedResidueSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedResidueSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..5446a0cf775255ce5e6458fa18791c173ae99868 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedResidueSpectrum.lean @@ -0,0 +1,99 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedPrincipalSourceScale +import OAI.Combinatorics.Progressions.Lattices.ContainedFullIntervalResidueIdentity + +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)] {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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : ∀ v, (Fintype.card α + 1) * q ≤ allocatedPrincipalSides B U basis S v) +variable (j : Fin m) (i : Fin (n j)) + +noncomputable def allocatedPrincipalResidueSources (b : B ⟨j, Sum.inr i⟩) : + Fin (j.val + 1) → NormalizedScalarCubeSource α := + fun v => principalResidueNormalizedSource B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) (allocatedPrincipalSides_pos B U basis S) + q hq r hsize ⟨⟨j, Sum.inr i⟩, b, v⟩ + +local notation "sources" => allocatedPrincipalResidueSources B U basis S q hq r hsize j i + +variable (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i) + +include hactive in +theorem allocatedPrincipalResidueSources_length (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + ((sources) b v).length = S.value := + allocatedPrincipalSides_active B U basis S j i hactive b v + +omit hactive in +theorem allocatedPrincipalResidueSources_primitive + (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) (A : ℝ≥0) : + ScalarCubePrimitiveBudget ((sources) b v) A (scalarCubePrimitiveEnvelope α A 1 0 q) := + principalResidueNormalizedSource_primitive B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) (allocatedPrincipalSides_pos B U basis S) + q hq r hsize ⟨⟨j, Sum.inr i⟩, b, v⟩ A + +variable (hR : ∀ j, 0 < R j) + +local notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactive +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +theorem allocatedPrincipalResidueSpectrum_tail + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) + (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + {C W ζ ε : ℝ} {t M : ℕ} (hC : 0 ≤ C) (hW : 0 ≤ W) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) (hM : 0 < M) + (hMK : (M : ℝ) ≤ C * basisAxisScale (basis j) i) + (rows : Finset (Finset α)) (hrows : ∀ s ∈ rows, s.card ≤ j.val + 1) + (hB : positiveModerateSpectrumBlockCount j.val rows.card t ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (hcard : (M : ℝ) ^ rows.card ≤ W * (S.value : ℝ) ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant j.val rows.card P (C / (2 * gamma)) * + 2 ^ positiveModerateSpectrumExponent j.val rows.card + + W * (2 ^ positiveModerateLengthExponent j.val * positiveModerateLengthConstant j.val P) ^ t) * ζ ≤ ε) : + spectrumTail + (positiveModerateSpectrumCover rows M j.val P (C / (2 * gamma)) S.value ζ) + (fun k => ‖∏ b : B ⟨j, Sum.inr i⟩, + weightedModerateGridCoefficient csource ((sources) b) 0 M rows k‖) ≤ ε := by + have hc : ScalarCubePrimitiveBudget csource A P := + (allocatedPrincipalNormalizedSource_primitive B U basis hR S j i hactive A).mono hcP + have hs (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + ScalarCubePrimitiveBudget ((sources) b v) A P := + (allocatedPrincipalResidueSources_primitive B U basis S q hq r hsize j i b v A).mono hsP + have hlength (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + (S.value : ℝ) ≤ ((sources) b v).length := by + rw [allocatedPrincipalResidueSources_length B U basis S q hq r hsize j i hactive b v] + have hproduct (b : B ⟨j, Sum.inr i⟩) : + (∏ v : Fin (j.val + 1), (((sources) b v).length : ℝ)) = + (S.value : ℝ) ^ (j.val + 1) := by + simp only [allocatedPrincipalResidueSources_length B U basis S q hq r hsize j i hactive, + Finset.prod_const, Finset.card_univ, Fintype.card_fin] + have hscale (b : B ⟨j, Sum.inr i⟩) : + (M : ℝ) / (((csource).length : ℝ) * ∏ v, (((sources) b v).length : ℝ)) ≤ + C / (2 * gamma) := by + rw [hproduct b] + exact allocatedPrincipalNormalizedSource_grid_ratio B U basis hR S j i hactive hC hMK + have hgamma : 0 < gamma := principalProfileSize_pos (hR j) _ + exact weightedPositiveModerate_uniform_spectrum_tail + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources A hA hc.one_le (fun _ => hc) hs + (fun _ z hz => allocatedPrincipalNormalizedSource_positive_support B U basis hR S j i hactive z hz) + (div_nonneg hC (by positivity)) hW (Nat.cast_nonneg S.value) hζ hζ1 hε hlength hM hscale + rows hrows hB hcard haccuracy + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteBufferFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteBufferFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..46d68c35ca1b737a6c7c5efeb1c545ed586aa825 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteBufferFourier.lean @@ -0,0 +1,86 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSiteBufferLog + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped Classical BigOperators NNReal + +def allocatedSiteBufferInput {A : Type*} [Semiring A] (m : ℕ) (D p g s c : A) : A := + D + p + g + (layerTailDegree m + 1 : ℕ) * s + D * p + (D * p + D + c + p) + 4 + +theorem allocatedSiteBufferInput_bounds (m : ℕ) {D p g s c : ℝ} + (hD : 0 ≤ D) (hp : 0 ≤ p) (hg : 0 ≤ g) (hs : 0 ≤ s) (hc : 0 ≤ c) : + let T := allocatedSiteBufferInput m D p g s c + 0 ≤ T ∧ D ≤ T ∧ p ≤ T ∧ g ≤ T ∧ (layerTailDegree m + 1 : ℕ) * s ≤ T ∧ + D * p ≤ T ∧ D * p + D + c + p ≤ T ∧ 4 ≤ T := by + have hprod : 0 ≤ D * p := mul_nonneg hD hp + have hscale : 0 ≤ (layerTailDegree m + 1 : ℕ) * s := mul_nonneg (Nat.cast_nonneg _) hs + dsimp only [allocatedSiteBufferInput] + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> linarith + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "output" => (Σ a : {a // ¬grid a}, jets (Sigma.fst (Subtype.val a))) +local notation "invVolume" => (∏ q : output, R (Sigma.fst (Subtype.val (Sigma.fst q))))⁻¹ + +theorem allocatedSiteBuffer_fourier_budget {D p g s : ℝ} + (h : AllocatedComparisonDimensions (G := G) B α jets D) + (hp : 0 ≤ p) (hg : 0 ≤ g) (hs : 0 ≤ s) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ D) + (hR : ∀ j, 0 ≤ R j) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp p) + (A : ℝ≥0) (hA : (A : ℝ) ≤ Real.exp g) + (hS : (S.value : ℝ) ≤ Real.exp s) + (C V : Fin m → ℝ≥0) (hC : ∀ j, (C j : ℝ) ≤ Real.exp p) (hV : ∀ j, (V j : ℝ) ≤ Real.exp p) : + let cap : ℝ≥0 := ‖invVolume‖₊ + let lip := allocatedSiteBufferLip (α := α) B U b S ⟨Real.exp p, (Real.exp_pos p).le⟩ + let T := allocatedSiteBufferInput m D p g s (normalizedSiteCutoffBound : ℝ) + let L := allocatedProfileFourierInput T + let Q := allocatedProfileFourierOutput T + 0 ≤ L ∧ 4 ≤ Q ∧ p ≤ Q ∧ D ≤ Q ∧ (Fintype.card (JetAmbientIndex jets J) : ℝ) ≤ L ∧ + (1 / 4 : ℝ)⁻¹ ≤ Real.exp L ∧ + (allocatedProfileErrorLip B U b S (O := jets) A cap 0 lip 0 C V : ℝ) ≤ Real.exp L ∧ + Real.exp ((2 * L + 2) ^ 4) ≤ Real.exp Q ∧ + Real.exp (2 * L * (2 * L + 2) ^ 4) * allocatedProfileErrorCap B U b S (O := jets) A cap 0 V ≤ Real.exp Q := by + dsimp only + obtain ⟨hT, hDT, hpT, hgT, hsT, hcapT, hlipT, h4T⟩ := + allocatedSiteBufferInput_bounds m h.nonneg hp hg hs normalizedSiteCutoffBound.coe_nonneg + have hcap := allocatedSiteBuffer_cap_le_exp (α := α) B U b S hp (h.active_outputs B _) hR hRi + have hlip := allocatedSiteBuffer_lip_le_exp (α := α) B U b S hp (h.active_outputs B _) hR hRi + have hscale : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ + Real.exp (allocatedSiteBufferInput m D p g s (normalizedSiteCutoffBound : ℝ)) := by + calc + _ ≤ (Real.exp s) ^ (layerTailDegree m + 1) := pow_le_pow_left₀ (Nat.cast_nonneg _) hS _ + _ = Real.exp ((layerTailDegree m + 1 : ℕ) * s) := (Real.exp_nat_mul _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr hsT + have hquarter : (1 / 4 : ℝ)⁻¹ ≤ + Real.exp (allocatedSiteBufferInput m D p g s (normalizedSiteCutoffBound : ℝ)) := by + norm_num + linarith [Real.add_one_le_exp (allocatedSiteBufferInput m D p g s (normalizedSiteCutoffBound : ℝ))] + obtain ⟨hL, hTQ, hamb, hδ, hLip, hfreq, hcoeff⟩ := + allocatedProfileError_fourier_budget (O := jets) B U b S A ‖invVolume‖₊ 0 + (allocatedSiteBufferLip (α := α) B U b S ⟨Real.exp p, (Real.exp_pos p).le⟩) 0 C V hT + (h.degree.trans hDT) (h.axes.trans hDT) (h.outputs.trans hDT) + (fun j => (h.rows j).trans hDT) (fun j => (hJ j).trans hDT) + (hA.trans (Real.exp_le_exp.mpr hgT)) hscale + (fun j => (hC j).trans (Real.exp_le_exp.mpr hpT)) + (fun j => (hV j).trans (Real.exp_le_exp.mpr hpT)) + (hcap.trans (Real.exp_le_exp.mpr hcapT)) (by exact (Real.exp_pos _).le) + (hlip.trans (Real.exp_le_exp.mpr hlipT)) (by exact (Real.exp_pos _).le) hquarter + exact ⟨hL, h4T.trans hTQ, hpT.trans hTQ, hDT.trans hTQ, hamb, hδ, hLip, hfreq, hcoeff⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteErrorFourierBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteErrorFourierBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc966dfc2c5799210022cb7d23f1f4acb0dbf70c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteErrorFourierBudget.lean @@ -0,0 +1,109 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedReferenceIdealBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical NNReal + +noncomputable def allocatedSiteErrorFourierInput {A : Type*} [Semiring A] + (m : ℕ) (p w v : A) : A := + let T := allocatedSiteErrorPrimitiveLog m p w v + T + allocatedErrorKernelLog T + +noncomputable def allocatedSiteErrorFourierOutput {A : Type*} [Semiring A] + (m : ℕ) (p w v : A) : A := + let L := allocatedSiteErrorFourierInput m p w v + p + 2 * L * (2 * L + 2) ^ 4 + L + (2 * L + 2) ^ 4 + +theorem allocatedSiteErrorFourier_budgets (m : ℕ) {p w v : ℝ} + (hp : 0 ≤ p) (hw : 0 ≤ w) (hv : 0 ≤ v) : + let T := allocatedSiteErrorPrimitiveLog m p w v + let L := allocatedSiteErrorFourierInput m p w v + let P := allocatedSiteErrorFourierOutput m p w v + 0 ≤ L ∧ p ≤ L ∧ T ≤ L ∧ allocatedErrorKernelLog T ≤ L ∧ p ≤ P ∧ + (2 * L + 2) ^ 4 ≤ P ∧ 2 * L * (2 * L + 2) ^ 4 + L ≤ P := by + have hT := (allocatedSiteErrorPrimitiveLog_bounds m hp hw hv).1 + have hpT := (allocatedSiteErrorPrimitiveLog_bounds m hp hw hv).2.1 + have hlog := allocatedErrorKernelLog_nonneg hT + have hL : 0 ≤ allocatedSiteErrorFourierInput m p w v := add_nonneg hT hlog + have hf : 0 ≤ (2 * allocatedSiteErrorFourierInput m p w v + 2) ^ 4 := by positivity + have hc : 0 ≤ 2 * allocatedSiteErrorFourierInput m p w v * + (2 * allocatedSiteErrorFourierInput m p w v + 2) ^ 4 := + mul_nonneg (mul_nonneg (by norm_num) hL) hf + refine ⟨hL, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · change p ≤ allocatedSiteErrorPrimitiveLog m p w v + + allocatedErrorKernelLog (allocatedSiteErrorPrimitiveLog m p w v) + linarith + · exact le_add_of_nonneg_right hlog + · exact le_add_of_nonneg_left hT + all_goals dsimp only [allocatedSiteErrorFourierOutput]; linarith + +theorem exists_allocatedSiteErrorFourierOutput_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ p : ℝ, 0 ≤ p → + allocatedSiteErrorFourierOutput m p p p ≤ (p + a) ^ a := by + let poly : Polynomial ℕ := allocatedSiteErrorFourierOutput m Polynomial.X Polynomial.X Polynomial.X + obtain ⟨a, ha, hbound⟩ := exists_natPolynomial_eval_budget poly + refine ⟨a, ha, ?_⟩ + intro p hp + simpa [poly, allocatedSiteErrorFourierOutput, allocatedSiteErrorFourierInput, + allocatedSiteErrorPrimitiveLog, allocatedErrorPrimitiveLog, allocatedErrorKernelLog, + allocatedComparisonDimension, Polynomial.eval₂_pow] using hbound p hp + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] + +theorem allocatedSiteErrorPrimitive_fourier_budget + {α : Type*} [Fintype α] (rows : ∀ j, O j → Finset α) + (hq : Fintype.card α ≤ m + 1) (hinj : ∀ j, Function.Injective (rows j)) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + {Q : Fin m → Type*} [∀ j, Fintype (Q j)] + (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (M period : ℕ) (hperiod : period ≤ M ^ (m + 1)) + (η CM Cf : ℝ≥0) (C V : Fin m → ℝ≥0) {p w v δ : ℝ} + (hp : 0 ≤ p) (hw : 0 ≤ w) (hv : 0 ≤ v) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn : ∀ j, (n j : ℝ) ≤ p) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hη : η ≤ 1) (hM : (M : ℝ) ≤ Real.exp p) (hS : (S.value : ℝ) ≤ Real.exp p) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp p) (hV : ∀ j, (V j : ℝ) ≤ Real.exp p) + (hCM : (CM : ℝ) ≤ Real.exp w) (hCf : (Cf : ℝ) ≤ Real.exp v) + (hδ : δ⁻¹ ≤ Real.exp p) : + let L := allocatedSiteErrorFourierInput m p w v + let P := allocatedSiteErrorFourierOutput m p w v + let A := Real.toNNReal (coefficientDeckPeriodCap O Q period) * + CM ^ Fintype.card (LayerSamplerAxis I n) * Cf + 0 ≤ L ∧ p ≤ P ∧ (Fintype.card (JetAmbientIndex O J) : ℝ) ≤ L ∧ δ⁻¹ ≤ Real.exp L ∧ + (allocatedErrorKernelLip B U b S (O := O) η A C V : ℝ) ≤ Real.exp L ∧ + Real.exp ((2 * L + 2) ^ 4) ≤ Real.exp P ∧ + Real.exp (2 * L * (2 * L + 2) ^ 4) * + allocatedErrorKernelCap B U b S (O := O) η A V ≤ Real.exp P := by + obtain ⟨hamb, hcap, hlip⟩ := allocatedSiteErrorPrimitive_constants B U b S rows hq hinj hb bW + M period hperiod η CM Cf C V hp hw hv hvars hI hn hJ hη hM hS hC hV hCM hCf + obtain ⟨hL, hpL, hTL, hlogL, hpP, hfreq, hcoeff⟩ := allocatedSiteErrorFourier_budgets m hp hw hv + have he := Real.exp_le_exp.mpr hlogL + refine ⟨hL, hpP, hamb.trans hTL, hδ.trans (Real.exp_le_exp.mpr hpL), hlip.trans he, + Real.exp_le_exp.mpr hfreq, ?_⟩ + calc + _ ≤ Real.exp (2 * allocatedSiteErrorFourierInput m p w v * + (2 * allocatedSiteErrorFourierInput m p w v + 2) ^ 4) * + Real.exp (allocatedSiteErrorFourierInput m p w v) := + mul_le_mul_of_nonneg_left (hcap.trans he) (Real.exp_pos _).le + _ = Real.exp (2 * allocatedSiteErrorFourierInput m p w v * + (2 * allocatedSiteErrorFourierInput m p w v + 2) ^ 4 + + allocatedSiteErrorFourierInput m p w v) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr hcoeff + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteSpectrumBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteSpectrumBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e1735e626f8ee61c8885acb28e436eaa7b30ffd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSiteSpectrumBudget.lean @@ -0,0 +1,461 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedIdealCoverErrorBudget +import OAI.Combinatorics.Progressions.Dynamics.UniformRetainedComplexityBudget +import OAI.Combinatorics.Progressions.Estimates.PositiveRetainedDenominatorLog + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +def allocatedGridTorusLog {A : Type*} [Semiring A] (D : A) : A := D ^ 2 + 2 * D + 8 + +def allocatedSpectrumScaleLog {A : Type*} [Semiring A] (D : A) : A := + D * (allocatedGridTorusLog D + 1) + +def allocatedSpectrumCardEnvelope {A : Type*} [Semiring A] (m : ℕ) (D p : A) : A := + ∑ j : Fin m, ∑ k : Fin (2 ^ (m + 1) + 1), + positiveSpectrumCardLog j.val k.val ((layerTailDegree m + 2) * k.val) + p (allocatedGridTorusLog D) (allocatedSpectrumScaleLog D) 0 + +def allocatedSpectrumFrequencyEnvelope {A : Type*} [Semiring A] (m : ℕ) (D p E : A) : A := + ∑ j : Fin m, ∑ k : Fin (2 ^ (m + 1) + 1), + positiveRetainedFrequencyLog j.val k.val ((layerTailDegree m + 2) * k.val) + p (allocatedGridTorusLog D) (allocatedSpectrumScaleLog D) E + +def allocatedGridFamilyLog {A : Type*} [Semiring A] (m : ℕ) (D p : A) : A := + D + D * (allocatedSpectrumCardEnvelope m D p + 1) + 1 + +theorem allocatedSpectrumScaleLogs_nonneg {D : ℝ} (hD : 0 ≤ D) : + 0 ≤ allocatedGridTorusLog D ∧ 0 ≤ allocatedSpectrumScaleLog D := by + unfold allocatedSpectrumScaleLog allocatedGridTorusLog + exact ⟨by positivity, by positivity⟩ + +theorem allocatedSpectrumCardEnvelope_nonneg (m : ℕ) {D p : ℝ} (hD : 0 ≤ D) (hp : 0 ≤ p) : + 0 ≤ allocatedSpectrumCardEnvelope m D p := by + obtain ⟨hT, hW⟩ := allocatedSpectrumScaleLogs_nonneg hD + exact Finset.sum_nonneg (fun j _ => Finset.sum_nonneg (fun k _ => + (positiveRetainedLogs_nonneg j.val k.val ((layerTailDegree m + 2) * k.val) + hp hT hW (le_refl (0 : ℝ))).2.1)) + +theorem allocatedSpectrumFrequencyEnvelope_nonneg (m : ℕ) {D p E : ℝ} + (hD : 0 ≤ D) (hp : 0 ≤ p) (hE : 0 ≤ E) : + 0 ≤ allocatedSpectrumFrequencyEnvelope m D p E := by + obtain ⟨hT, hW⟩ := allocatedSpectrumScaleLogs_nonneg hD + exact Finset.sum_nonneg (fun j _ => Finset.sum_nonneg (fun k _ => + (positiveRetainedLogs_nonneg j.val k.val ((layerTailDegree m + 2) * k.val) + hp hT hW hE).2.2)) + +theorem allocatedGridFamilyLog_nonneg (m : ℕ) {D p : ℝ} (hD : 0 ≤ D) (hp : 0 ≤ p) : + 0 ≤ allocatedGridFamilyLog m D p := by + have hC := allocatedSpectrumCardEnvelope_nonneg m hD hp + unfold allocatedGridFamilyLog + positivity + +theorem allocatedSpectrumCardEnvelope_member (m : ℕ) {D p : ℝ} (hD : 0 ≤ D) (hp : 0 ≤ p) + (j : Fin m) (k : ℕ) (hk : k ≤ 2 ^ (m + 1)) : + positiveSpectrumCardLog j.val k ((layerTailDegree m + 2) * k) + p (allocatedGridTorusLog D) (allocatedSpectrumScaleLog D) 0 ≤ + allocatedSpectrumCardEnvelope m D p := by + obtain ⟨hT, hW⟩ := allocatedSpectrumScaleLogs_nonneg hD + have hn (a : Fin m) (b : Fin (2 ^ (m + 1) + 1)) : + 0 ≤ positiveSpectrumCardLog a.val b.val ((layerTailDegree m + 2) * b.val) + p (allocatedGridTorusLog D) (allocatedSpectrumScaleLog D) 0 := + (positiveRetainedLogs_nonneg _ _ _ hp hT hW (le_refl (0 : ℝ))).2.1 + have hinner := Finset.single_le_sum (fun b _ => hn j b) + (Finset.mem_univ (⟨k, Nat.lt_succ_of_le hk⟩ : Fin (2 ^ (m + 1) + 1))) + exact hinner.trans (Finset.single_le_sum + (fun a _ => Finset.sum_nonneg (fun b _ => hn a b)) (Finset.mem_univ j)) + +theorem allocatedSpectrumFrequencyEnvelope_member (m : ℕ) {D p E : ℝ} + (hD : 0 ≤ D) (hp : 0 ≤ p) (hE : 0 ≤ E) + (j : Fin m) (k : ℕ) (hk : k ≤ 2 ^ (m + 1)) : + positiveRetainedFrequencyLog j.val k ((layerTailDegree m + 2) * k) + p (allocatedGridTorusLog D) (allocatedSpectrumScaleLog D) E ≤ + allocatedSpectrumFrequencyEnvelope m D p E := by + obtain ⟨hT, hW⟩ := allocatedSpectrumScaleLogs_nonneg hD + have hn (a : Fin m) (b : Fin (2 ^ (m + 1) + 1)) : + 0 ≤ positiveRetainedFrequencyLog a.val b.val ((layerTailDegree m + 2) * b.val) + p (allocatedGridTorusLog D) (allocatedSpectrumScaleLog D) E := + (positiveRetainedLogs_nonneg _ _ _ hp hT hW hE).2.2 + have hinner := Finset.single_le_sum (fun b _ => hn j b) + (Finset.mem_univ (⟨k, Nat.lt_succ_of_le hk⟩ : Fin (2 ^ (m + 1) + 1))) + exact hinner.trans (Finset.single_le_sum + (fun a _ => Finset.sum_nonneg (fun b _ => hn a b)) (Finset.mem_univ j)) + +theorem finiteBooleanRows_card_le {α : Type*} [Fintype α] (rows : Finset (Finset α)) + {m : ℕ} (hq : Fintype.card α ≤ m + 1) : rows.card ≤ 2 ^ (m + 1) := by + have hc : rows.card ≤ 2 ^ Fintype.card α := by + simpa only [Fintype.card_finset] using rows.card_le_univ + exact hc.trans (Nat.pow_le_pow_right (by norm_num) hq) + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {α : Type*} [Fintype α] (rowSets : Fin m → Finset (Finset α)) +variable {D : ℝ} (h : AllocatedComparisonDimensions (G := G) B α (fun j => (rowSets j : Type _)) D) + +include h + +theorem allocatedSpectrum_scales (a : Σ j : Fin m, Fin (n j)) : + (allocatedGridTorusFactor B α a : ℝ) ≤ Real.exp (allocatedGridTorusLog D) ∧ + (2 * (allocatedGridTorusFactor B α a : ℝ)) ^ (rowSets a.1).card ≤ + Real.exp (allocatedSpectrumScaleLog D) := by + have ht := allocatedGridTorusFactor_exp_bound B rowSets h a.1 a.2 + have hT := (allocatedSpectrumScaleLogs_nonneg h.nonneg).1 + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hbase : 2 * (allocatedGridTorusFactor B α a : ℝ) ≤ Real.exp (allocatedGridTorusLog D + 1) := + (mul_le_mul htwo ht (Nat.cast_nonneg _) (Real.exp_pos _).le).trans_eq + (by rw [← Real.exp_add, add_comm]; rfl) + have hrows : ((rowSets a.1).card : ℝ) ≤ D := by simpa only [Fintype.card_coe] using h.rows a.1 + exact ⟨ht, pow_le_exp_mul_of_le_exp (by positivity) hbase (by positivity) _ hrows⟩ + +theorem allocatedGridPointCap_exp_bound (hq : Fintype.card α ≤ m + 1) {P p : ℝ} + (hP : 1 ≤ P) (hp : 0 ≤ p) (hPp : P ≤ Real.exp p) (a : Σ j : Fin m, Fin (n j)) : + allocatedGridPointCap B P a (rowSets a.1) ≤ Real.exp (allocatedSpectrumCardEnvelope m D p + 1) := by + obtain ⟨hV, hW⟩ := allocatedSpectrum_scales B rowSets h a + obtain ⟨hT, hScale⟩ := allocatedSpectrumScaleLogs_nonneg h.nonneg + have hc := positiveModerateSpectrumCardBudget_exp_bound a.1.val (rowSets a.1).card + ((layerTailDegree m + 2) * (rowSets a.1).card) hP (Nat.cast_nonneg _) (by positivity) + (by norm_num : (0 : ℝ) < 1) hp hT hScale (le_refl (0 : ℝ)) hPp hV hW + (by norm_num : (1 : ℝ)⁻¹ ≤ Real.exp 0) + have henv := allocatedSpectrumCardEnvelope_member m h.nonneg hp a.1 (rowSets a.1).card + (finiteBooleanRows_card_le (rowSets a.1) hq) + have hplus := one_add_le_exp_succ (allocatedSpectrumCardEnvelope_nonneg m h.nonneg hp) + (hc.trans (Real.exp_le_exp.mpr henv)) + change _ + 1 ≤ _ + rw [add_comm] + exact hplus + +theorem allocatedGridFamilyCap_exp_bound (hq : Fintype.card α ≤ m + 1) {P p : ℝ} + (hP : 1 ≤ P) (hp : 0 ≤ p) (hPp : P ≤ Real.exp p) : + allocatedGridFamilyCap B (fun a => rowSets a.1) P + 1 ≤ Real.exp (allocatedGridFamilyLog m D p) := by + have hC := allocatedSpectrumCardEnvelope_nonneg m h.nonneg hp + have hD := h.nonneg + have hs := sum_le_exp_of_card_and_uniform_bound + (fun a => allocatedGridPointCap B P a (rowSets a.1)) (by positivity : 0 ≤ allocatedSpectrumCardEnvelope m D p + 1) + (allocatedIntegerAxes_card_le B rowSets h) (allocatedGridPointCap_exp_bound B rowSets h hq hP hp hPp) + have hplus := one_add_le_exp_succ + (by positivity : 0 ≤ D + D * (allocatedSpectrumCardEnvelope m D p + 1)) hs + rw [add_comm] + exact hplus + +theorem allocatedGridRetainedFrequency_exp_bound (hq : Fintype.card α ≤ m + 1) {P p ε E : ℝ} + (hP : 1 ≤ P) (hp : 0 ≤ p) (hPp : P ≤ Real.exp p) (hε : 0 < ε) (hE : 0 ≤ E) + (hεE : ε⁻¹ ≤ Real.exp E) (a : Σ j : Fin m, Fin (n j)) : + positiveRetainedFrequencyBound a.1.val (rowSets a.1).card P (allocatedGridTorusFactor B α a) + (positiveModerateRetainedBias a.1.val (rowSets a.1).card + ((layerTailDegree m + 2) * (rowSets a.1).card) P (allocatedGridTorusFactor B α a) + ((2 * (allocatedGridTorusFactor B α a : ℝ)) ^ (rowSets a.1).card) ε) ≤ + Real.exp (allocatedSpectrumFrequencyEnvelope m D p E) := by + obtain ⟨hV, hW⟩ := allocatedSpectrum_scales B rowSets h a + obtain ⟨hT, hScale⟩ := allocatedSpectrumScaleLogs_nonneg h.nonneg + have hf := positiveRetainedFrequencyBound_exp_bound a.1.val (rowSets a.1).card + ((layerTailDegree m + 2) * (rowSets a.1).card) hP (Nat.cast_nonneg _) (by positivity) hε + hp hT hScale hE hPp hV hW hεE + exact hf.trans (Real.exp_le_exp.mpr (allocatedSpectrumFrequencyEnvelope_member m h.nonneg hp hE + a.1 (rowSets a.1).card (finiteBooleanRows_card_le (rowSets a.1) hq))) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +def allocatedInactiveTorusLog {A : Type*} [Semiring A] (D : A) : A := D ^ 2 + 3 * D + 9 + +def allocatedInactiveScaleLog {A : Type*} [Semiring A] (D : A) : A := + D * allocatedInactiveTorusLog D + +def allocatedInactiveSpectrumLog {A : Type*} [Semiring A] (m : ℕ) (D p E : A) : A := + ∑ j : Fin m, ∑ k : Fin (2 ^ (m + 1) + 1), + uniformRetainedComplexityLog j.val k.val ((j.val + 1) * k.val) + p (allocatedInactiveTorusLog D) (allocatedInactiveScaleLog D) E + +noncomputable def allocatedInactiveSpectrumPrimitiveLog {A : Type*} [Semiring A] + (m : ℕ) (p E : A) : A := + allocatedInactiveSpectrumLog m (allocatedComparisonDimension m p) p E + +theorem allocatedInactiveScaleLogs_nonneg {D : ℝ} (hD : 0 ≤ D) : + 0 ≤ allocatedInactiveTorusLog D ∧ 0 ≤ allocatedInactiveScaleLog D := by + unfold allocatedInactiveScaleLog allocatedInactiveTorusLog + exact ⟨by positivity, by positivity⟩ + +theorem allocatedInactiveSpectrumLog_nonneg (m : ℕ) {D p E : ℝ} + (hD : 0 ≤ D) (hp : 0 ≤ p) (hE : 0 ≤ E) : + 0 ≤ allocatedInactiveSpectrumLog m D p E := by + obtain ⟨hV, hW⟩ := allocatedInactiveScaleLogs_nonneg hD + exact Finset.sum_nonneg (fun j _ => Finset.sum_nonneg (fun k _ => + (uniformRetainedComplexityLog_bounds j.val k.val ((j.val + 1) * k.val) hp hV hW hE).1)) + +theorem allocatedInactiveSpectrumLog_member (m : ℕ) {D p E : ℝ} + (hD : 0 ≤ D) (hp : 0 ≤ p) (hE : 0 ≤ E) + (j : Fin m) (k : ℕ) (hk : k ≤ 2 ^ (m + 1)) : + uniformRetainedComplexityLog j.val k ((j.val + 1) * k) + p (allocatedInactiveTorusLog D) (allocatedInactiveScaleLog D) E ≤ + allocatedInactiveSpectrumLog m D p E := by + obtain ⟨hV, hW⟩ := allocatedInactiveScaleLogs_nonneg hD + have hn (a : Fin m) (b : Fin (2 ^ (m + 1) + 1)) : + 0 ≤ uniformRetainedComplexityLog a.val b.val ((a.val + 1) * b.val) + p (allocatedInactiveTorusLog D) (allocatedInactiveScaleLog D) E := + (uniformRetainedComplexityLog_bounds _ _ _ hp hV hW hE).1 + have hinner := Finset.single_le_sum (fun b _ => hn j b) + (Finset.mem_univ (⟨k, Nat.lt_succ_of_le hk⟩ : Fin (2 ^ (m + 1) + 1))) + exact hinner.trans (Finset.single_le_sum + (fun a _ => Finset.sum_nonneg (fun b _ => hn a b)) (Finset.mem_univ j)) + +theorem exists_allocatedInactiveSpectrumPrimitiveLog_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ p : ℝ, 0 ≤ p → + allocatedInactiveSpectrumPrimitiveLog m p p ≤ (p + a) ^ a := by + let poly : Polynomial ℕ := allocatedInactiveSpectrumPrimitiveLog m Polynomial.X Polynomial.X + obtain ⟨a, ha, hbound⟩ := exists_natPolynomial_eval_budget poly + refine ⟨a, ha, ?_⟩ + intro p hp + simpa [poly, allocatedInactiveSpectrumPrimitiveLog, allocatedInactiveSpectrumLog, + allocatedComparisonDimension, allocatedInactiveTorusLog, allocatedInactiveScaleLog, + uniformRetainedComplexityLog, uniformSpectrumSizeLog, uniformSpectrumCardLog, + uniformRetainedFrequencyLog, uniformRetainedDenominatorLog, uniformRetainedBiasLog, + uniformBlockAccuracyLog, majorArcSpectrumLog, majorArcCoverLog, majorArcLengthLog, + majorArcBiasLog, majorArcErrorLog, majorArcLocalizationLog, + Polynomial.eval₂_finsetSum, Polynomial.eval₂_pow] using hbound p hp + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {α : Type*} [Fintype α] (rowSets : Fin m → Finset (Finset α)) +variable {D : ℝ} (h : AllocatedComparisonDimensions (G := G) B α (fun j => (rowSets j : Type _)) D) + +include h + +theorem allocatedInactiveSpectrum_scales (a : Σ j : Fin m, Fin (n j)) : + let V := (blockTorusFactor (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 2 : ℝ) * 2 ^ (a.1.val + 2) + V ≤ Real.exp (allocatedInactiveTorusLog D) ∧ + V ^ (rowSets a.1).card ≤ Real.exp (allocatedInactiveScaleLog D) := by + have hD := h.nonneg + have hblock := blockJetScaleBound_four_exp (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) hD h.cube (h.layer_degree B a.1) + (allocatedIntegerBlock_card_le B rowSets h a.1 a.2) + have h24 : blockJetScaleBound (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 2 ≤ + blockJetScaleBound (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 4 := by + unfold blockJetScaleBound + exact mul_le_mul_of_nonneg_left (by norm_num) (by positivity) + have ht : (blockTorusFactor (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 2 : ℝ) ≤ Real.exp (D ^ 2 + 2 * D + 8) := by + have hraw := blockTorusFactor_upper (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) (by norm_num : (0 : ℝ) ≤ 2) + have hupper := two_mul_add_three_exp_bound + (by positivity : 0 ≤ D ^ 2 + 2 * D + 4) hblock + have hupper' : 2 * blockJetScaleBound (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 4 + 3 ≤ Real.exp (D ^ 2 + 2 * D + 8) := + hupper.trans_eq (by congr 1; ring) + linarith only [hraw, h24, hupper'] + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hdegree : ((a.1.val + 2 : ℕ) : ℝ) ≤ D + 1 := by + have hdeg := h.layer_degree B a.1 + push_cast at hdeg ⊢ + linarith + have hcost : (2 : ℝ) ^ (a.1.val + 2) ≤ Real.exp (D + 1) := by + simpa only [mul_one] using pow_le_exp_mul_of_le_exp (by norm_num) htwo + (by norm_num) (a.1.val + 2) hdegree + have hV : (blockTorusFactor (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 2 : ℝ) * 2 ^ (a.1.val + 2) ≤ + Real.exp (allocatedInactiveTorusLog D) := by + have hh := (mul_le_mul ht hcost (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + exact hh.trans_eq (by unfold allocatedInactiveTorusLog; congr 1; ring) + have hrows : ((rowSets a.1).card : ℝ) ≤ D := by simpa only [Fintype.card_coe] using h.rows a.1 + exact ⟨hV, pow_le_exp_mul_of_le_exp (by positivity) hV + (allocatedInactiveScaleLogs_nonneg hD).1 (rowSets a.1).card hrows⟩ + +theorem allocatedInactiveSpectrum_exp_bounds (hq : Fintype.card α ≤ m + 1) {P p ε E : ℝ} + (hP : 1 ≤ P) (hp : 0 ≤ p) (hPp : P ≤ Real.exp p) + (hε : 0 < ε) (hε1 : ε ≤ 1) (hE : 0 ≤ E) (hεE : ε⁻¹ ≤ Real.exp E) + (a : Σ j : Fin m, Fin (n j)) : + let k := (rowSets a.1).card + let t := (a.1.val + 1) * k + let V := (blockTorusFactor (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 2 : ℝ) * 2 ^ (a.1.val + 2) + let ζ := uniformBlockRetainedBias a.1.val k t P V (V ^ k) ε + let Λ := allocatedInactiveSpectrumLog m D p E + uniformSpectrumAbsoluteCap a.1.val k t P V (V ^ k) + 1 ≤ Real.exp Λ ∧ + uniformSpectrumSizeConstant a.1.val k t P V (V ^ k) / + ε ^ max (majorArcSpectrumExponent a.1.val k) (majorArcLengthExponent a.1.val * t) ≤ Real.exp Λ ∧ + 2 * majorArcCoverConstant a.1.val k P V / ζ ^ majorArcCoverExponent a.1.val k ≤ Real.exp Λ ∧ + uniformCharacterDenominatorBound a.1.val k t P V (V ^ k) ζ ≤ Real.exp Λ := by + obtain ⟨hV, hW⟩ := allocatedInactiveSpectrum_scales B rowSets h a + obtain ⟨hv, hw⟩ := allocatedInactiveScaleLogs_nonneg h.nonneg + obtain ⟨hcap, hcard, hfreq, hden⟩ := uniformRetainedComplexity_exp_bounds a.1.val + (rowSets a.1).card ((a.1.val + 1) * (rowSets a.1).card) + hP (by positivity) (by positivity) hε hε1 hp hv hw hE hPp hV hW hεE + have henv := Real.exp_le_exp.mpr (allocatedInactiveSpectrumLog_member m h.nonneg hp hE + a.1 (rowSets a.1).card (finiteBooleanRows_card_le (rowSets a.1) hq)) + exact ⟨hcap.trans henv, hcard.trans henv, hfreq.trans henv, hden.trans henv⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators NNReal + +noncomputable def allocatedSiteSpectrumCapLog {A : Type*} [Semiring A] (m : ℕ) (p : A) : A := + allocatedGridFamilyLog m (allocatedComparisonDimension m p) p + +noncomputable def allocatedSiteSpectrumInput {A : Type*} [Semiring A] (m : ℕ) (p w v E : A) : A := + allocatedSiteConstructionLog m p w v E (allocatedSiteSpectrumCapLog m p) + +noncomputable def allocatedSiteSpectrumFrequencyLog {A : Type*} [Semiring A] + (m : ℕ) (p w v E : A) : A := + allocatedSpectrumFrequencyEnvelope m (allocatedComparisonDimension m p) p + (allocatedSiteSpectrumInput m p w v E) + +noncomputable def allocatedSiteSpectrumLog {A : Type*} [Semiring A] (m : ℕ) (p w v E : A) : A := + allocatedSiteSpectrumInput m p w v E + allocatedSiteSpectrumFrequencyLog m p w v E + + 2 * allocatedComparisonDimension m p + 13 + +theorem allocatedSiteSpectrumLog_bounds (m : ℕ) {p w v E : ℝ} + (hp : 0 ≤ p) (hw : 0 ≤ w) (hv : 0 ≤ v) (hE : 0 ≤ E) : + 0 ≤ allocatedSiteSpectrumCapLog m p ∧ 0 ≤ allocatedSiteSpectrumInput m p w v E ∧ + 0 ≤ allocatedSiteSpectrumFrequencyLog m p w v E ∧ 0 ≤ allocatedSiteSpectrumLog m p w v E ∧ + allocatedSiteSpectrumInput m p w v E ≤ allocatedSiteSpectrumLog m p w v E ∧ + allocatedSiteSpectrumFrequencyLog m p w v E + 2 * allocatedComparisonDimension m p + 13 ≤ + allocatedSiteSpectrumLog m p w v E := by + have hD := (allocatedComparisonDimension_bounds m hp).1 + have hC : 0 ≤ allocatedSiteSpectrumCapLog m p := allocatedGridFamilyLog_nonneg m hD hp + have hI : 0 ≤ allocatedSiteSpectrumInput m p w v E := + (allocatedSiteConstructionLog_bounds m hp hw hv hE hC).1 + have hF : 0 ≤ allocatedSiteSpectrumFrequencyLog m p w v E := + allocatedSpectrumFrequencyEnvelope_nonneg m hD hp hI + refine ⟨hC, hI, hF, ?_, ?_, ?_⟩ + all_goals unfold allocatedSiteSpectrumLog; linarith + +theorem exists_allocatedSiteSpectrumLog_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ p : ℝ, 0 ≤ p → allocatedSiteSpectrumLog m p p p p ≤ (p + a) ^ a := by + let poly : Polynomial ℕ := + allocatedSiteSpectrumLog m Polynomial.X Polynomial.X Polynomial.X Polynomial.X + obtain ⟨a, ha, hbound⟩ := exists_natPolynomial_eval_budget poly + refine ⟨a, ha, ?_⟩ + intro p hp + simpa [poly, allocatedSiteSpectrumLog, allocatedSiteSpectrumInput, allocatedSiteSpectrumCapLog, + allocatedSiteSpectrumFrequencyLog, allocatedSpectrumFrequencyEnvelope, allocatedGridFamilyLog, + allocatedSpectrumCardEnvelope, allocatedGridTorusLog, allocatedSpectrumScaleLog, + positiveRetainedFrequencyLog, positiveSpectrumCardLog, positiveRetainedBiasLog, + positiveModerateAccuracyLog, positiveModerateSpectrumLog, positiveModerateCoverLog, + positiveModerateLengthLog, majorArcCoverLog, majorArcErrorLog, majorArcLengthLog, + majorArcLocalizationLog, majorArcBiasLog, allocatedSiteConstructionLog, allocatedComparisonDimension, + allocatedNaturalSiteLog, uniformProductAccuracyLog, allocatedSitePointToleranceLog, + allocatedSiteFamilyWindowLog, allocatedSiteAxisWindowLog, allocatedSiteCoefficientLog, + allocatedSiteSpatialMassLog, coefficientMajorantMassLog, Polynomial.eval₂_finsetSum, + Polynomial.eval₂_pow] using hbound p hp + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {α : Type*} [Fintype α] (rowSets : Fin m → Finset (Finset α)) + +theorem allocatedSiteSpectrum_primitive_budget + (hq : Fintype.card α ≤ m + 1) {p w v E P : ℝ} + (hp : 0 ≤ p) (hw : 0 ≤ w) (hv : 0 ≤ v) (hE : 0 ≤ E) (hP : 1 ≤ P) (hPp : P ≤ Real.exp p) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn : ∀ j, (n j : ℝ) ≤ p) : + let δ := allocatedSitePrimitiveTolerance m p w v E + let halfAccuracy := uniformProductAccuracy (Fintype.card (Σ j : Fin m, Fin (n j))) + (allocatedGridFamilyCap B (fun a => rowSets a.1) P + 1) + (allocatedSitePointTolerance (G := G) B rowSets δ) / 2 + let frequency := fun a : Σ j : Fin m, Fin (n j) => Real.toNNReal + (positiveRetainedFrequencyBound a.1.val (rowSets a.1).card P (allocatedGridTorusFactor B α a) + (positiveModerateRetainedBias a.1.val (rowSets a.1).card ((layerTailDegree m + 2) * (rowSets a.1).card) + P (allocatedGridTorusFactor B α a) ((2 * (allocatedGridTorusFactor B α a : ℝ)) ^ (rowSets a.1).card) + halfAccuracy)) + let Λ := allocatedSiteSpectrumLog m p w v E + ∀ a : Σ j : Fin m, Fin (n j), + allocatedNaturalSiteRadius (G := G) B a.1 a.2 (rowSets a.1) + 1 / 4 ≤ Real.exp Λ ∧ + (halfAccuracy / (allocatedGridPointCap B P a (rowSets a.1) + 1))⁻¹ ≤ Real.exp Λ ∧ + (((CircleFourier.characterLipConstant * ((rowSets a.1).card * frequency a) + 4) * + (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) : ℝ) ≤ Real.exp Λ := by + let D := allocatedComparisonDimension m p + let δ := allocatedSitePrimitiveTolerance m p w v E + let halfAccuracy := uniformProductAccuracy (Fintype.card (Σ j : Fin m, Fin (n j))) + (allocatedGridFamilyCap B (fun a => rowSets a.1) P + 1) + (allocatedSitePointTolerance (G := G) B rowSets δ) / 2 + let frequency := fun a : Σ j : Fin m, Fin (n j) => Real.toNNReal + (positiveRetainedFrequencyBound a.1.val (rowSets a.1).card P (allocatedGridTorusFactor B α a) + (positiveModerateRetainedBias a.1.val (rowSets a.1).card ((layerTailDegree m + 2) * (rowSets a.1).card) + P (allocatedGridTorusFactor B α a) ((2 * (allocatedGridTorusFactor B α a : ℝ)) ^ (rowSets a.1).card) + halfAccuracy)) + have hd := allocatedComparisonDimensions_of_primitive B + (O := fun j => (rowSets j : Type _)) (fun _ => Subtype.val) hq + (fun _ => Subtype.val_injective) hp hvars hI hn + obtain ⟨hT, hInput, hF, _, hInputΛ, hFreqΛ⟩ := allocatedSiteSpectrumLog_bounds m hp hw hv hE + have hcap := allocatedGridFamilyCap_exp_bound B rowSets hd hq hP hp hPp + have hsite := allocatedSiteConstruction_primitive_budget B rowSets hq hp hw hv hE hT hP hvars hI hn hcap + have hδ := allocatedSitePrimitiveTolerance_pos m p w v E + have hpoint := (allocatedSitePointTolerance_spec (G := G) B rowSets hδ).1 + have hfamily := allocatedGridFamilyCap_nonneg B (fun a => rowSets a.1) hP + have hhalf : 0 < halfAccuracy := div_pos + (uniformProductAccuracy_spec _ (by positivity) hpoint).1 (by norm_num) + dsimp only + intro a + have hlocal := hsite a + have hcap0 : 0 ≤ allocatedGridPointCap B P a (rowSets a.1) := + zero_le_one.trans (allocatedGridPointCap_one_le B hP a (rowSets a.1)) + have hhalfInv : halfAccuracy⁻¹ ≤ Real.exp (allocatedSiteSpectrumInput m p w v E) := by + calc + _ ≤ (halfAccuracy / (allocatedGridPointCap B P a (rowSets a.1) + 1))⁻¹ := by + have hstep : halfAccuracy⁻¹ ≤ + (allocatedGridPointCap B P a (rowSets a.1) + 1) * halfAccuracy⁻¹ := by + simpa only [one_mul] using mul_le_mul_of_nonneg_right + (show (1 : ℝ) ≤ allocatedGridPointCap B P a (rowSets a.1) + 1 by linarith) + (inv_nonneg.mpr hhalf.le) + have heq : (halfAccuracy / (allocatedGridPointCap B P a (rowSets a.1) + 1))⁻¹ = + (allocatedGridPointCap B P a (rowSets a.1) + 1) * halfAccuracy⁻¹ := + (inv_div _ _).trans (div_eq_mul_inv _ _) + exact hstep.trans_eq heq.symm + _ ≤ _ := hlocal.2 + have hf := allocatedGridRetainedFrequency_exp_bound B rowSets hd hq hP hp hPp hhalf hInput hhalfInv a + have hfrequency : (frequency a : ℝ) ≤ Real.exp (allocatedSiteSpectrumFrequencyLog m p w v E) := + coe_toNNReal_le_exp hf + have hrow : ((rowSets a.1).card : ℝ) ≤ D := by simpa only [Fintype.card_coe] using hd.rows a.1 + have hrowexp : ((rowSets a.1).card : ℝ) ≤ Real.exp D := + hrow.trans (by linarith [Real.add_one_le_exp D]) + have hchar : (CircleFourier.characterLipConstant : ℝ) ≤ Real.exp 8 := by + rw [CircleFourier.coe_characterLipConstant] + linarith [Real.pi_lt_four, Real.add_one_le_exp (8 : ℝ)] + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hpow : (2 : ℝ) ^ Fintype.card α ≤ Real.exp D := by + simpa only [mul_one] using pow_le_exp_mul_of_le_exp (by norm_num) htwo + (by norm_num) (Fintype.card α) hd.cube + have hrowFreq := (mul_le_mul hrowexp hfrequency (frequency a).coe_nonneg (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + have hprod := (mul_le_mul hchar hrowFreq (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + have hD := hd.nonneg + have hplus := add_le_exp_add_one + (by positivity : 0 ≤ 8 + (D + allocatedSiteSpectrumFrequencyLog m p w v E)) + (by norm_num : (0 : ℝ) ≤ 4) hprod + (show (4 : ℝ) ≤ Real.exp 4 by linarith [Real.add_one_le_exp (4 : ℝ)]) + have htotal := (mul_le_mul hplus hpow (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + have htotal' : ((CircleFourier.characterLipConstant : ℝ) * + ((rowSets a.1).card * (frequency a : ℝ)) + 4) * (2 : ℝ) ^ Fintype.card α ≤ + Real.exp (allocatedSiteSpectrumFrequencyLog m p w v E + 2 * D + 13) := + htotal.trans_eq (by congr 1; ring) + refine ⟨hlocal.1.trans (Real.exp_le_exp.mpr hInputΛ), + hlocal.2.trans (Real.exp_le_exp.mpr hInputΛ), ?_⟩ + have hout := htotal'.trans (Real.exp_le_exp.mpr hFreqΛ) + simpa only [NNReal.coe_mul, NNReal.coe_add, NNReal.coe_natCast, NNReal.coe_ofNat, NNReal.coe_pow] using hout + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSupportedResidueSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSupportedResidueSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7e780b7f391c60d1c50696ea6131b3518a9aff9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSupportedResidueSpectrum.lean @@ -0,0 +1,278 @@ +import OAI.Combinatorics.Progressions.Fourier.FixedPrincipalCoefficientSpectrum +import OAI.Combinatorics.Progressions.Lattices.AllocatedResidueInterpolationMixture +import OAI.Combinatorics.Progressions.Sampling.CeilGridScaleRatio + +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)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) +variable [∀ 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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (j : Fin m) (i : Fin (n j)) +variable (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i) +variable (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : (Fintype.card α + 1) * q ≤ S.value) + +local notation "sources" => allocatedActiveResidueSources B U basis S j i hactive q hq r hsize + +variable (hR : ∀ j, 0 < R j) + +local notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactive +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +theorem allocatedActiveResidueSources_volume + (b : B ⟨j, Sum.inr i⟩) : + (|((0 : ℤ) : ℝ)| + ((csource).length : ℝ)) * + (∏ v : Fin (j.val + 1), (((sources) b v).length : ℝ)) ≤ + 4 * gamma * (basisAxisScale (basis j) i : ℝ) := by + simpa only [Int.cast_zero, abs_zero, zero_add, + allocatedActiveResidueSources_length B U basis S j i hactive q hq r hsize, + Finset.prod_const, Finset.card_univ, Fintype.card_fin] using + (allocatedPrincipalNormalizedSource_scale_bounds B U basis hR S j i hactive).2 + +theorem allocatedActiveResidueSpectrum_tail + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) + (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + {C W ζ ε : ℝ} {t M : ℕ} (hC : 0 ≤ C) (hW : 0 ≤ W) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) (hM : 0 < M) + (hMK : (M : ℝ) ≤ C * basisAxisScale (basis j) i) + (rows : Finset (Finset α)) (hrows : ∀ s ∈ rows, s.card ≤ j.val + 1) + (hB : positiveModerateSpectrumBlockCount j.val rows.card t ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (hcard : (M : ℝ) ^ rows.card ≤ W * (S.value : ℝ) ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant j.val rows.card P (C / (2 * gamma)) * + 2 ^ positiveModerateSpectrumExponent j.val rows.card + + W * (2 ^ positiveModerateLengthExponent j.val * positiveModerateLengthConstant j.val P) ^ t) * ζ ≤ ε) : + spectrumTail + (positiveModerateSpectrumCover rows M j.val P (C / (2 * gamma)) S.value ζ) + (fun k => ‖∏ b : B ⟨j, Sum.inr i⟩, + weightedModerateGridCoefficient csource ((sources) b) 0 M rows k‖) ≤ ε := by + have hc : ScalarCubePrimitiveBudget csource A P := + (allocatedPrincipalNormalizedSource_primitive B U basis hR S j i hactive A).mono hcP + have hs (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + ScalarCubePrimitiveBudget ((sources) b v) A P := + (allocatedActiveResidueSources_primitive B U basis S j i hactive q hq r hsize b v A).mono hsP + have hlength (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + (S.value : ℝ) ≤ ((sources) b v).length := by + rw [allocatedActiveResidueSources_length B U basis S j i hactive q hq r hsize b v] + have hproduct (b : B ⟨j, Sum.inr i⟩) : + (∏ v : Fin (j.val + 1), (((sources) b v).length : ℝ)) = + (S.value : ℝ) ^ (j.val + 1) := by + simp only [allocatedActiveResidueSources_length B U basis S j i hactive q hq r hsize, + Finset.prod_const, Finset.card_univ, Fintype.card_fin] + have hscale (b : B ⟨j, Sum.inr i⟩) : + (M : ℝ) / (((csource).length : ℝ) * ∏ v, (((sources) b v).length : ℝ)) ≤ + C / (2 * gamma) := by + rw [hproduct b] + exact allocatedPrincipalNormalizedSource_grid_ratio B U basis hR S j i hactive hC hMK + have hgamma : 0 < gamma := principalProfileSize_pos (hR j) _ + exact weightedPositiveModerate_uniform_spectrum_tail + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources A hA hc.one_le (fun _ => hc) hs + (fun _ z hz => allocatedPrincipalNormalizedSource_positive_support B U basis hR S j i hactive z hz) + (div_nonneg hC (by positivity)) hW (Nat.cast_nonneg S.value) hζ hζ1 hε hlength hM hscale + rows hrows hB hcard haccuracy + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +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 → ℝ} (hR : ∀ j, 0 < R j) +variable (S : LayerSamplerScale (G := G) B U basis R σ) (j : Fin m) (i : Fin (n j)) +variable (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : (Fintype.card α + 1) * q ≤ S.value) + +local notation "sources" => allocatedActiveResidueSources B U basis S j i hactive q hq r hsize +local notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactive +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) +local notation "scale" => allocatedPrincipalGridScale (G := G) B U basis (R := R) j i + +theorem allocatedNaturalGridSpectrum_tail + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + (hgamma : gamma ≤ S.value) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) + (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + {H ε : ℝ} {M : ℕ} (hH : 0 ≤ H) (hM : 0 < M) + (hMN : (M : ℝ) ≤ H * scale) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) + (hB : positiveModerateSpectrumBlockCount j.val rows.card + ((layerTailDegree m + 2) * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (hε : 0 < ε) (hε1 : ε ≤ 1) : + spectrumTail (positiveModerateSpectrumCover rows M j.val P H S.value + (positiveModerateRetainedBias j.val rows.card ((layerTailDegree m + 2) * rows.card) + P H ((2 * H) ^ rows.card) ε)) + (fun k => ‖∏ b : B ⟨j, Sum.inr i⟩, + weightedModerateGridCoefficient csource ((sources) b) 0 M rows k‖) ≤ ε := by + have hc : ScalarCubePrimitiveBudget csource A P := + (allocatedPrincipalNormalizedSource_primitive B U basis hR S j i hactive A).mono hcP + have hs (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + ScalarCubePrimitiveBudget ((sources) b v) A P := + (allocatedActiveResidueSources_primitive B U basis S j i hactive q hq r hsize b v A).mono hsP + have hlength (b : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)) : + (S.value : ℝ) ≤ ((sources) b v).length := by + rw [allocatedActiveResidueSources_length B U basis S j i hactive q hq r hsize b v] + have hscale (b : B ⟨j, Sum.inr i⟩) : + (M : ℝ) / (((csource).length : ℝ) * ∏ v, (((sources) b v).length : ℝ)) ≤ H := by + simp only [allocatedActiveResidueSources_length B U basis S j i hactive q hq r hsize, + Finset.prod_const, Finset.card_univ, Fintype.card_fin] + exact allocatedPrincipalGridScale_ratio B U basis hR S j i hactive hH hMN + obtain ⟨hζ, hζ1, hacc⟩ := positiveModerateRetainedBias_spec j.val rows.card + ((layerTailDegree m + 2) * rows.card) (V := H) hc.one_le + (by positivity : (0 : ℝ) ≤ (2 * H) ^ rows.card) hε hε1 + exact weightedPositiveModerate_uniform_spectrum_tail + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources A hA hc.one_le (fun _ => hc) hs + (fun _ z hz => allocatedPrincipalNormalizedSource_positive_support B U basis hR S j i hactive z hz) + hH (by positivity : (0 : ℝ) ≤ (2 * H) ^ rows.card) (Nat.cast_nonneg S.value) + hζ hζ1 hε.le hlength hM hscale rows hrows hB + (allocatedPrincipalGridScale_cardinality B U basis hR S j i hactive hgrid hgamma hH hMN rows.card) + hacc + +theorem allocatedNaturalGridSpectrum_absolute_cap + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + (hgamma : gamma ≤ S.value) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) + (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + {H : ℝ} {M : ℕ} (hH : 0 ≤ H) (hM : 0 < M) + (hMN : (M : ℝ) ≤ H * scale) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) + (hB : positiveModerateSpectrumBlockCount j.val rows.card + ((layerTailDegree m + 2) * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) : + (∑ k, ‖∏ b : B ⟨j, Sum.inr i⟩, + weightedModerateGridCoefficient csource ((sources) b) 0 M rows k‖) ≤ + positiveModerateSpectrumCardBudget j.val rows.card ((layerTailDegree m + 2) * rows.card) + P H ((2 * H) ^ rows.card) 1 + 1 := by + have hP := ((allocatedPrincipalNormalizedSource_primitive B U basis hR S j i hactive A).mono hcP).one_le + have ht := allocatedNaturalGridSpectrum_tail B U basis hR S j i hactive q hq r hsize + hgrid hgamma A hA P hcP hsP hH hM hMN rows hrows hB zero_lt_one le_rfl + exact weightedPositiveModerateSpectrum_absolute_cap + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources M ((layerTailDegree m + 2) * rows.card) rows + hP hH (by positivity : (0 : ℝ) ≤ (2 * H) ^ rows.card) (Nat.cast_nonneg S.value) + (allocatedPrincipalGridScale_cardinality B U basis hR S j i hactive hgrid hgamma hH hMN rows.card) ht + +omit [Fintype α] in +include hR hactive in +theorem allocatedNaturalGridSpectrum_cover_card + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + (hgamma : gamma ≤ S.value) {P H ε : ℝ} {M : ℕ} + (hP : 1 ≤ P) (hH : 0 ≤ H) (hMN : (M : ℝ) ≤ H * scale) + (rows : Finset (Finset α)) (hε : 0 < ε) (hε1 : ε ≤ 1) : + ((positiveModerateSpectrumCover rows M j.val P H S.value + (positiveModerateRetainedBias j.val rows.card ((layerTailDegree m + 2) * rows.card) + P H ((2 * H) ^ rows.card) ε)).card : ℝ) ≤ + positiveModerateSpectrumCardBudget j.val rows.card ((layerTailDegree m + 2) * rows.card) + P H ((2 * H) ^ rows.card) ε := by + have hc := positiveModerateSpectrumCover_card_budget rows M j.val + ((layerTailDegree m + 2) * rows.card) hP hH + (by positivity : (0 : ℝ) ≤ (2 * H) ^ rows.card) (Nat.cast_nonneg S.value) hε hε1 + (by simpa only [Fintype.card_coe] using + allocatedPrincipalGridScale_cardinality B U basis hR S j i hactive hgrid hgamma hH hMN rows.card) + simpa only [Fintype.card_coe] using hc + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +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 → ℝ} (hR : ∀ j, 0 < R j) +variable (S : LayerSamplerScale (G := G) B U basis R σ) (j : Fin m) (i : Fin (n j)) +variable (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : (Fintype.card α + 1) * q ≤ S.value) + +local notation "sources" => allocatedActiveResidueSources B U basis S j i hactive q hq r hsize +local notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactive +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +theorem allocatedSupportedResidueSpectrum_tail + (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) + {C ε : ℝ} {M : ℕ} (hC : 0 ≤ C) (hM : 0 < M) + (hMK : (M : ℝ) ≤ C * basisAxisScale (basis j) i) + (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⟩)) + (hε : 0 < ε) (hε1 : ε ≤ 1) : + spectrumTail (positiveModerateSpectrumCover rows M j.val P (C / (2 * gamma)) S.value + (positiveModerateRetainedBias j.val rows.card ((layerTailDegree m + 1) * rows.card) + P (C / (2 * gamma)) (C ^ rows.card) ε)) + (fun k => ‖∏ b : B ⟨j, Sum.inr i⟩, + weightedModerateGridCoefficient csource ((sources) b) 0 M rows k‖) ≤ ε := by + have hP := ((allocatedPrincipalNormalizedSource_primitive B U basis hR S j i hactive A).mono hcP).one_le + obtain ⟨hζ, hζ1, hacc⟩ := positiveModerateRetainedBias_spec j.val rows.card + ((layerTailDegree m + 1) * rows.card) (V := C / (2 * gamma)) + hP (pow_nonneg hC _) hε hε1 + exact allocatedActiveResidueSpectrum_tail B U basis S j i hactive q hq r hsize hR + A hA P hcP hsP hC (pow_nonneg hC _) hζ hζ1 hε.le hM hMK rows hrows hB + (allocatedGrid_modulus_cardinality B U basis S j i hgrid hC hMK rows.card) hacc + +theorem allocatedSupportedResidueSpectrum_absolute_cap + (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) + {C : ℝ} {M : ℕ} (hC : 0 ≤ C) (hM : 0 < M) + (hMK : (M : ℝ) ≤ C * basisAxisScale (basis j) i) + (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⟩)) : + (∑ k, ‖∏ b : B ⟨j, Sum.inr i⟩, + weightedModerateGridCoefficient csource ((sources) b) 0 M rows k‖) ≤ + positiveModerateSpectrumCardBudget j.val rows.card ((layerTailDegree m + 1) * rows.card) + P (C / (2 * gamma)) (C ^ rows.card) 1 + 1 := by + have hP := ((allocatedPrincipalNormalizedSource_primitive B U basis hR S j i hactive A).mono hcP).one_le + have hgamma : 0 < gamma := principalProfileSize_pos (hR j) _ + have ht := allocatedSupportedResidueSpectrum_tail B U basis hR S j i hactive q hq r hsize + hgrid A hA P hcP hsP hC hM hMK rows hrows hB zero_lt_one le_rfl + exact weightedPositiveModerateSpectrum_absolute_cap + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources M ((layerTailDegree m + 1) * rows.card) rows + hP (div_nonneg hC (by positivity)) (pow_nonneg hC _) (Nat.cast_nonneg S.value) + (allocatedGrid_modulus_cardinality B U basis S j i hgrid hC hMK rows.card) ht + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSupportedSlicedInactiveSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSupportedSlicedInactiveSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1c4f1de1ebfb5a69ba7904e7edbfd3f9d7ba00d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AllocatedSupportedSlicedInactiveSpectrum.lean @@ -0,0 +1,123 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedSupportedSlicedInactiveSource +import OAI.Combinatorics.Progressions.Lattices.AllocatedSupportedSlicedResidueGrid + +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (j : Fin m) (i : Fin (n j)) + +local notation "conditioned" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H step c (allocatedPrincipalSides_pos B U basis S) hH hsubset q r hcell + +variable (hsize : ∀ b v, (Fintype.card α + 1) * q ≤ H ⟨⟨j,Sum.inr i⟩,b,v⟩) + +local notation "height" => basisAxisScale (basis j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "side" => inactiveSideLength degree height denom +local notation "cost" => (denom : ℝ) * 2 ^ degree +local notation "sources" => principalSupportedAxisSources B (layerSamplerDegree I n) H hH q hq r + (Sigma.mk j (Sum.inr i)) hsize +local notation "lower" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin degree) (a : Option α) => + ite (a = none) (c (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) 0) +local notation "strides" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin degree) (_ : Option α) => + step (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) + +theorem allocatedSupportedSlicedInactiveGridDensity_approximation + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + {δ : ℝ} (hδ : 0 < δ) + (hlength : ∀ b v, δ * side ≤ (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) + (hstep : ∀ b v, 0 < step ⟨⟨j,Sum.inr i⟩,b,v⟩) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) (hP : 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hstride : ∀ b v, ((step ⟨⟨j,Sum.inr i⟩,b,v⟩ * q : ℕ) : ℝ) ≤ P) + {C ε : ℝ} {M : ℕ} [NeZero M] (hC : 0 ≤ C) (hMK : (M : ℝ) ≤ C * height) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hB : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (hε : 0 < ε) (hε1 : ε ≤ 1) : + let V := C * cost / δ ^ degree + let t := degree * rows.card + let W := (C * cost) ^ rows.card / δ ^ t + let ζ := uniformBlockRetainedBias j.val rows.card t P V W ε + let F := uniformBlockSpectrumCover rows M j.val P V (δ * side) ζ + (F.card : ℝ) ≤ uniformSpectrumSizeConstant j.val rows.card t P V W / + ε ^ max (majorArcSpectrumExponent j.val rows.card) (majorArcLengthExponent j.val * t) ∧ + (∑ k, ‖∏ b, affineWeightedCubeGridCoefficient (sources b) + (fun v a => (lower b v a : ℝ)) (strides b) M rows k‖) ≤ + uniformSpectrumAbsoluteCap j.val rows.card t P V W ∧ + ∀ shift z : rows → ℤ, + ‖(allocatedSupportedSlicedGridDensity B U basis hR hσ S q r H step c hH hsubset hcell j i M rows shift z : ℂ) - + integerGridApproximation (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) height M F z‖ ≤ + ((height : ℝ) / M) ^ rows.card * ε := by + intro V t W ζ F + have hside : 0 < side := inactiveSideLength_pos (Nat.zero_lt_succ _) (inactiveDenominator_pos _) + have hbase : (height : ℝ) ≤ cost * (side : ℝ) ^ degree := by + exact_mod_cast (inactiveSideLength_lower_power (Nat.zero_lt_succ _) (inactiveDenominator_pos _) hlarge).le + have hbound : (M : ℝ) ≤ (C * cost) * (side : ℝ) ^ degree := + hMK.trans (by simpa only [mul_assoc] using mul_le_mul_of_nonneg_left hbase hC) + have hratio : (M : ℝ) / (1 * (side : ℝ) ^ degree) ≤ C * cost := by + rw [one_mul] + exact (div_le_iff₀ (pow_pos (Nat.cast_pos.mpr hside) _)).mpr hbound + have hscale (b : B ⟨j,Sum.inr i⟩) : (M : ℝ) / ∏ v, (((sources) b v).length : ℝ) ≤ V := by + change (M : ℝ) / ∏ v : Fin degree, (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ) ≤ C * cost / δ ^ degree + simpa only [one_mul, layerSamplerDegree] using dense_slice_product_ratio (n := j.val + 1) + (fun v => (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) hδ (Nat.cast_pos.mpr hside) + zero_lt_one (Nat.cast_nonneg M) (hlength b) hratio + have hcard : (M : ℝ) ^ rows.card ≤ W * (δ * side) ^ t := by + apply dense_slice_grid_cardinality rows.card t hδ + simpa only [mul_pow, ← pow_mul] using pow_le_pow_left₀ (Nat.cast_nonneg M) hbound rows.card + have hV : 0 ≤ V := by dsimp [V]; positivity + have hW : 0 ≤ W := by dsimp [W]; positivity + have hL : 0 ≤ δ * side := mul_nonneg hδ.le (Nat.cast_nonneg _) + have hs (b : B ⟨j,Sum.inr i⟩) (v : Fin degree) := + (principalSupportedAxisSources_primitive B (layerSamplerDegree I n) H hH q hq r + ⟨j,Sum.inr i⟩ hsize b v A).mono hsP + refine ⟨?_, ?_, ?_⟩ + · simpa only [Fintype.card_coe] using uniformBlockSpectrumCover_polynomial_card rows M j.val t + hP hV hW hL hε hε1 (by simpa only [Fintype.card_coe] using hcard) + · exact (affine_weightedCube_uniform_spectrum sources (fun b v a => (lower b v a : ℝ)) strides + A hA hP hV hW hL hε hs hlength (fun b v _ => hstep b v) (fun b v _ => hstride b v) + M t (Nat.pos_of_ne_zero (NeZero.ne M)) rows hrows hB hcard hscale).2 + · intro shift z + have he := affine_weightedCube_grid_density sources lower strides A hA hP hV hW hL hε hs hlength + (fun b v _ => hstep b v) (fun b v _ => hstride b v) height M t rows hrows hB hcard hscale shift z + have hlaw := allocatedSupportedSlicedInactiveResidueJetPMF_source B U basis hR hσ S q hq r H step c + hH hsubset hcell j i hsmall hlarge hsize rows shift + have hd := integerGridDensity_eq_of_pmf_image (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) _ hlaw height M z + have hd' : integerGridDensity (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) height M z = + allocatedSupportedSlicedGridDensity B U basis hR hσ S q r H step c hH hsubset hcell j i M rows shift z := by + simpa only [allocatedSupportedSlicedGridDensity, Fintype.card_coe] using hd + rw [← hd'] + exact he + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/AnchoredCoefficientFourierNormalization.lean b/lean/OAI/Combinatorics/Progressions/Fourier/AnchoredCoefficientFourierNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..233c070728b09386312d555f2427cdf5eeee0c3f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/AnchoredCoefficientFourierNormalization.lean @@ -0,0 +1,394 @@ +import OAI.Combinatorics.Progressions.Estimates.AnchoredCoefficientCongruenceRemoval +import OAI.Combinatorics.Progressions.Lattices.AffineCoefficientAmplitudeCongruenceRemoval +import OAI.Combinatorics.Progressions.Lattices.AffineCoefficientCongruenceRemoval +import OAI.Combinatorics.Progressions.Lattices.SelectedResidueConstantMean + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem selectedResidueSmoothPMF_weighted_fourier_normalization {K I J : Type*} + [Fintype K] [Fintype I] [Fintype J] + (modulus : I → ℕ) (G : Finset (ColumnResiduePattern K I modulus)) + (V : K × I → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' x, selectedResidueSmoothWeight modulus G V x) + (w : (K × I → ℤ) → ℂ) (c : J → ℂ) (u : J → (K × I → ℤ) → ℂ) + (keep : J → Prop) [DecidablePred keep] {C τ : ℝ} + (hc : (∑ j, ‖c j‖) ≤ C) (hτ : 0 ≤ τ) + (hkeep : ∀ j, keep j → ∀ x, u j x = 1) + (hdiscard : ∀ j, ¬keep j → + ‖∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * + (w x * u j x)‖ ≤ τ) : + ‖(∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * + (w x * ∑ j, c j * u j x)) - + (∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * w x) * + (∑ j, if keep j then c j else 0)‖ ≤ C * τ := by + have hproject := selectedResidueSmoothPMF_discard_error modulus G V hV hZ + w c u keep hc hτ hdiscard + have heq (x : K × I → ℤ) : + (∑ j, if keep j then c j * u j x else 0) = + ∑ j, if keep j then c j else 0 := by + apply Finset.sum_congr rfl + intro j _ + by_cases hj : keep j + · simp only [hj, ite_true, hkeep j hj x, mul_one] + · simp only [hj, ite_false] + simp_rw [heq, ← mul_assoc] at hproject + rw [tsum_mul_right] at hproject + simpa only [mul_assoc] using hproject + +theorem selectedResidueSmoothPMF_weighted_density_normalization {K I J : Type*} + [Fintype K] [Fintype I] [Fintype J] + (modulus : I → ℕ) (G : Finset (ColumnResiduePattern K I modulus)) + (V : K × I → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' x, selectedResidueSmoothWeight modulus G V x) + (w D : (K × I → ℤ) → ℂ) (c : J → ℂ) (u : J → (K × I → ℤ) → ℂ) + (keep : J → Prop) [DecidablePred keep] {C τ η : ℝ} + (hc : (∑ j, ‖c j‖) ≤ C) (hτ : 0 ≤ τ) (hη : 0 ≤ η) + (hw : ∀ x ∈ rectangularWeightIndices 0 V 1, ‖w x‖ ≤ 1) + (hkeep : ∀ j, keep j → ∀ x, u j x = 1) + (hdiscard : ∀ j, ¬keep j → + ‖∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * + (w x * u j x)‖ ≤ τ) + (happrox : ∀ x ∈ rectangularWeightIndices 0 V 1, + ‖D x - ∑ j, c j * u j x‖ ≤ η) + (hmass : ‖(∑ j, if keep j then c j else 0) - 1‖ ≤ η) : + ‖(∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * + (w x * D x)) - + ∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * w x‖ ≤ + 2 * η + C * τ := by + have hproject := selectedResidueSmoothPMF_weighted_fourier_normalization + modulus G V hV hZ w c u keep hc hτ hkeep hdiscard + have h := selectedResidueSmoothPMF_projection_approximation modulus G V hV hZ + w D (fun x => ∑ j, c j * u j x) + (fun _ => ∑ j, if keep j then c j else 0) (fun _ => 1) + hη hw happrox (fun _ _ => hmass) (by + simpa only [← mul_assoc, tsum_mul_right] using hproject) + simpa only [mul_one] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Polynomial + +noncomputable def fourierModeError (B ε : ℝ) : ℝ := ε / (B + 1) + +theorem fourierModeError_pos {B ε : ℝ} (hB : 0 ≤ B) (hε : 0 < ε) : + 0 < fourierModeError B ε := div_pos hε (by linarith) + +theorem fourierModeError_cost_le {B ε : ℝ} (hB : 0 ≤ B) (hε : 0 < ε) : + B * fourierModeError B ε ≤ ε := by + have h := mul_le_mul_of_nonneg_right (show B ≤ B + 1 by linarith) (fourierModeError_pos hB hε).le + have he : (B + 1) * fourierModeError B ε = ε := by + unfold fourierModeError + field_simp + exact h.trans_eq he + +theorem fourierModeError_inv_le_exp {P B ε : ℝ} (hP : 0 ≤ P) (_hB : 0 ≤ B) + (hBP : B ≤ Real.exp P) (hε : 0 < ε) (hεP : 1 / ε ≤ Real.exp P) : + 1 / fourierModeError B ε ≤ Real.exp (2 * P + 2) := by + have hb : B + 1 ≤ Real.exp (P + 1) := by + simpa only [add_comm B 1] using one_add_le_exp_succ hP hBP + rw [fourierModeError, one_div, inv_div] + calc + _ = (B + 1) * (1 / ε) := by ring + _ ≤ Real.exp (P + 1) * Real.exp P := + mul_le_mul hb hεP (by positivity) (Real.exp_nonneg _) + _ = Real.exp (2 * P + 1) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + +theorem exists_fourier_uniform_budget (A B : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ P : ℝ, 0 ≤ P → + Real.exp ((2 * P + 2 + A) ^ A) ≤ Real.exp ((P + C) ^ C) ∧ + Real.exp ((2 * P + 2 + B) ^ B) ≤ Real.exp ((P + C) ^ C) := by + obtain ⟨C, hC, hp⟩ := exists_natPolynomial_eval_budget + (((2 * X + 2 + Polynomial.C A) ^ A) + ((2 * X + 2 + Polynomial.C B) ^ B)) + refine ⟨C, hC, ?_⟩ + intro P hP + have hh : (2 * P + 2 + A) ^ A + (2 * P + 2 + B) ^ B ≤ (P + C) ^ C := by + simpa [Polynomial.eval₂_pow] using hp P hP + have ha : 0 ≤ (2 * P + 2 + A) ^ A := by positivity + have hb : 0 ≤ (2 * P + 2 + B) ^ B := by positivity + exact ⟨Real.exp_le_exp.mpr (by linarith), Real.exp_le_exp.mpr (by linarith)⟩ + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +theorem exists_affine_coefficient_amplitude_fourier_normalization (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 → ℝ)) + {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) + (amplitude : (Option K × I → ℝ) → ℂ) (_hamp : ∀ x, ‖amplitude x‖ ≤ 1) + {Lip : ℝ≥0} (_hLip : LipschitzWith Lip amplitude) (_hLipP : (Lip : ℝ) ≤ Real.exp P), + ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, + ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * + (amplitude (fun t => (z t : ℝ) / V t) * ∑ a, c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ)))) - + (∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * + amplitude (fun t => (z t : ℝ) / V t)) * + (∑ a, if affineCoefficientModeTrivial U (frequency a) then c a else 0)‖ ≤ ε := by + classical + obtain ⟨A₀, _, hremove⟩ := exists_affine_coefficient_amplitude_congruence_removal m + obtain ⟨A₁, _, hthreshold⟩ := exists_mode_residue_threshold_exp_budget m + obtain ⟨A, hA, hbudget⟩ := exists_fourier_uniform_budget A₀ 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 stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth amplitude hamp Lip hLip hLipP + let P' := 2 * P + 2 + let δ := fourierModeError B ε + have hPP : P ≤ P' := by dsimp [P']; linarith + have hEP : Real.exp P ≤ Real.exp P' := Real.exp_le_exp.mpr hPP + have hδ : 0 < δ := fourierModeError_pos hB hε + have hδP : 1 / δ ≤ Real.exp P' := fourierModeError_inv_le_exp hP hB hBP hε hεP + obtain ⟨hb₀, hb₁⟩ := hbudget P hP + obtain ⟨hside, _⟩ := hthreshold (Fintype.card I) (Fintype.card (Option K × I)) + P' C 1 S ρ δ (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) hC (hCP.trans hEP) + zero_le_one (Real.one_le_exp (hP.trans hPP)) hS (hSP.trans hEP) hρ (hρP.trans hEP) hδ hδP + have hZ := selectedResidueSmoothWeight_pos_of_threshold m zero_le_one + hS hρ hδ stride hs hstride H (fun j => hside.trans (hb₁.trans (hsize j))) G hG V hV hwidth + refine ⟨hZ, ?_⟩ + have hdiscard (a : F) (hbad : ¬affineCoefficientModeTrivial U (frequency a)) : + ‖∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * + (amplitude (fun t => (z t : ℝ) / V t) * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ)))‖ ≤ δ := by + obtain ⟨_, hr⟩ := hremove (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) + U hC (hCP.trans hEP) (frequency a) (hbound a) + ((not_affineCoefficientModeTrivial_iff U (frequency a)).mp hbad) + p hp hm stride hs hS (hSP.trans hEP) hρ hδ (hρP.trans hEP) hδP hstride + H (fun j => hb₀.trans (hsize j)) hrank (hb₀.trans hR) G hG V hV hwidth + amplitude hamp hLip (hLipP.trans hEP) + exact hr + have hproj := selectedResidueSmoothPMF_weighted_fourier_normalization stride G V hV hZ + (fun z => amplitude (fun t => (z t : ℝ) / V t)) c + (fun a z => layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ))) + (fun a => affineCoefficientModeTrivial U (frequency a)) hcoefficients hδ.le + (fun a ha z => layeredCoefficientCharacter_eq_one_of_trivial U (frequency a) ha p hp hm + (fun k j => (z (k, j) : ℝ))) hdiscard + exact hproj.trans (fourierModeError_cost_le hB hε) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +theorem exists_affine_coefficient_fourier_normalization (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 → ℝ)) + {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 : ℂ) * + (∑ a, c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ)))) - + (∑ a, if affineCoefficientModeTrivial U (frequency a) then c a else 0)‖ ≤ ε := by + classical + obtain ⟨A₀, _, hremove⟩ := exists_affine_coefficient_congruence_removal m + obtain ⟨A₁, _, hthreshold⟩ := exists_mode_residue_threshold_exp_budget m + obtain ⟨A, hA, hbudget⟩ := exists_fourier_uniform_budget A₀ 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 stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth + let P' := 2 * P + 2 + let δ := fourierModeError B ε + have hPP : P ≤ P' := by dsimp [P']; linarith + have hEP : Real.exp P ≤ Real.exp P' := Real.exp_le_exp.mpr hPP + have hδ : 0 < δ := fourierModeError_pos hB hε + have hδP : 1 / δ ≤ Real.exp P' := fourierModeError_inv_le_exp hP hB hBP hε hεP + obtain ⟨hb₀, hb₁⟩ := hbudget P hP + obtain ⟨hside, _⟩ := hthreshold (Fintype.card I) (Fintype.card (Option K × I)) + P' C 1 S ρ δ (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) hC (hCP.trans hEP) + zero_le_one (Real.one_le_exp (hP.trans hPP)) hS (hSP.trans hEP) hρ (hρP.trans hEP) hδ hδP + have hZ := selectedResidueSmoothWeight_pos_of_threshold m zero_le_one + hS hρ hδ stride hs hstride H (fun j => hside.trans (hb₁.trans (hsize j))) G hG V hV hwidth + refine ⟨hZ, ?_⟩ + have hdiscard (a : F) (hbad : ¬affineCoefficientModeTrivial U (frequency a)) : + ‖∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * + ((1 : ℂ) * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ)))‖ ≤ δ := by + obtain ⟨_, hr⟩ := hremove (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) + U hC (hCP.trans hEP) (frequency a) (hbound a) + ((not_affineCoefficientModeTrivial_iff U (frequency a)).mp hbad) + p hp hm stride hs hS (hSP.trans hEP) hρ hδ (hρP.trans hEP) hδP hstride + H (fun j => hb₀.trans (hsize j)) hrank (hb₀.trans hR) G hG V hV hwidth + simpa only [one_mul] using hr + have hproj := selectedResidueSmoothPMF_discard_error stride G V hV hZ (fun _ => 1) c + (fun a z => layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ))) + (fun a => affineCoefficientModeTrivial U (frequency a)) hcoefficients hδ.le hdiscard + have hkeep (b : Option K → I → ℝ) : + (∑ a, if affineCoefficientModeTrivial U (frequency a) then + c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) p b + else 0) = ∑ a, if affineCoefficientModeTrivial U (frequency a) then c a else 0 := by + apply Finset.sum_congr rfl + intro a _ + by_cases ha : affineCoefficientModeTrivial U (frequency a) + · simp only [ha, ite_true, layeredCoefficientCharacter_eq_one_of_trivial U (frequency a) ha p hp hm b, + mul_one] + · simp only [ha, ite_false] + simp only [one_mul, hkeep, selectedResidueSmoothPMF_const] at hproj + exact hproj.trans (fourierModeError_cost_le hB hε) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +theorem exists_anchored_affine_coefficient_fourier_normalization (m : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} + [Fintype I] [DecidableEq I] [Fintype K] + (origin : Option K → I → ℝ) + {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 → ℝ)) + {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 : ℂ) * + (∑ a, c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (origin + fun k j => (z (k, j) : ℝ)))) - + (∑ a, if affineCoefficientModeTrivial U (frequency a) then c a else 0)‖ ≤ ε := by + classical + obtain ⟨A₀, _, hremove⟩ := exists_anchored_affine_coefficient_congruence_removal m + obtain ⟨A₁, _, hthreshold⟩ := exists_mode_residue_threshold_exp_budget m + obtain ⟨A, hA, hbudget⟩ := exists_fourier_uniform_budget A₀ A₁ + refine ⟨A, hA, ?_⟩ + intro I K _ _ _ origin 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 + let P' := 2 * P + 2 + let δ := fourierModeError B ε + have hPP : P ≤ P' := by dsimp [P']; linarith + have hEP : Real.exp P ≤ Real.exp P' := Real.exp_le_exp.mpr hPP + have hδ : 0 < δ := fourierModeError_pos hB hε + have hδP : 1 / δ ≤ Real.exp P' := fourierModeError_inv_le_exp hP hB hBP hε hεP + obtain ⟨hb₀, hb₁⟩ := hbudget P hP + obtain ⟨hside, _⟩ := hthreshold (Fintype.card I) (Fintype.card (Option K × I)) + P' C 1 S ρ δ (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) hC (hCP.trans hEP) + zero_le_one (Real.one_le_exp (hP.trans hPP)) hS (hSP.trans hEP) hρ (hρP.trans hEP) hδ hδP + have hZ := selectedResidueSmoothWeight_pos_of_threshold m zero_le_one + hS hρ hδ stride hs hstride H (fun j => hside.trans (hb₁.trans (hsize j))) G hG V hV hwidth + refine ⟨hZ, ?_⟩ + have hdiscard (a : F) (hbad : ¬affineCoefficientModeTrivial U (frequency a)) : + ‖∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * + ((1 : ℂ) * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (origin + fun k j => (z (k, j) : ℝ)))‖ ≤ δ := by + obtain ⟨_, hr⟩ := hremove origin (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) + U hC (hCP.trans hEP) (frequency a) (hbound a) + ((not_affineCoefficientModeTrivial_iff U (frequency a)).mp hbad) + p hp hm stride hs hS (hSP.trans hEP) hρ hδ (hρP.trans hEP) hδP hstride + H (fun j => hb₀.trans (hsize j)) hrank (hb₀.trans hR) G hG V hV hwidth + simpa only [one_mul] using hr + have hproj := selectedResidueSmoothPMF_discard_error stride G V hV hZ (fun _ => 1) c + (fun a z => layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (origin + fun k j => (z (k, j) : ℝ))) + (fun a => affineCoefficientModeTrivial U (frequency a)) hcoefficients hδ.le hdiscard + have hkeep (b : Option K → I → ℝ) : + (∑ a, if affineCoefficientModeTrivial U (frequency a) then + c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) p b + else 0) = ∑ a, if affineCoefficientModeTrivial U (frequency a) then c a else 0 := by + apply Finset.sum_congr rfl + intro a _ + by_cases ha : affineCoefficientModeTrivial U (frequency a) + · simp only [ha, ite_true, layeredCoefficientCharacter_eq_one_of_trivial U (frequency a) ha p hp hm b, + mul_one] + · simp only [ha, ite_false] + simp only [one_mul, hkeep, selectedResidueSmoothPMF_const] at hproj + exact hproj.trans (fourierModeError_cost_le hB hε) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BohrLocalMomentAlternatives.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BohrLocalMomentAlternatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba7edbf86b6c39697ddc3e63f5c374c58c91642e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BohrLocalMomentAlternatives.lean @@ -0,0 +1,68 @@ +import OAI.Combinatorics.Progressions.Estimates.LocalMomentScale +import OAI.Combinatorics.Progressions.Fourier.BohrTorusApproximation + +namespace OAI + +section + +namespace Erdos3.LocalConvolution + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem local_alternatives_of_regular_bohr + (L : CyclicBohr.Set N) (hL : L.IsRankRegular) + (S : Finset (ZMod N)) (hS : S.Nonempty) {kappa : ℝ≥0} + (hSL : S ⊆ (L.ndilate kappa).carrier) + (hkappa : kappa + kappa ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (f g : ZMod N → ℝ) + (hfsupport : ∀ x, x ∉ L.carrier → f x = 0) + (hgsupport : ∀ x, x ∉ L.carrier → g x = 0) + (hfsum : ∑ x, f x = L.carrier.card) (hgsum : ∑ x, g x = L.carrier.card) + {M delta : ℝ} (hf : ∀ x, |f x| ≤ M) (hg : ∀ x, |g x| ≤ M) + (hdelta : 0 < delta) + (hsmall : 1200 * (max L.rank 1 : ℕ) * ((kappa + kappa : ℝ≥0) : ℝ) * M ≤ + min (delta / 2) (localMomentGain delta)) + {m : ℕ} (hm : 0 < m) : + sumLp S (fun x => convolution L.carrier f g x - 1) (2 * m) ≤ delta ∨ + ∃ h : ZMod N → ℝ, (h = f ∨ h = g) ∧ ∃ m' : ℕ, + 0 < m' ∧ m ≤ m' ∧ m' ≤ localMomentExponentFactor delta * m ∧ + 1 + localMomentGain delta ≤ differenceLp S (correlation L.carrier h h) (2 * m') := by + have hM1 := normalized_cap_ge_one L.carrier_nonempty f hfsupport hfsum hf + have hM : 0 ≤ M := by linarith + let eta : ℝ := 400 * (max L.rank 1 : ℕ) * ((kappa + kappa : ℝ≥0) : ℝ) + have heta : 0 ≤ eta := by dsimp [eta]; positivity + have hbudget : 3 * M * eta ≤ min (delta / 2) (localMomentGain delta) := by + calc + _ = 1200 * (max L.rank 1 : ℕ) * ((kappa + kappa : ℝ≥0) : ℝ) * M := by + dsimp [eta] + ring + _ ≤ _ := hsmall + have hTV (t : ZMod N) (ht : t ∈ L.ndilate (kappa + kappa)) : + (∑ x, |realUniformMass L.carrier (x - t) - realUniformMass L.carrier x|) ≤ eta := + CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hL hkappa ht + apply local_alternatives_of_boundary L.carrier S hS f g hdelta hm + · intro s hs t ht + have hsum : s + t ∈ L.ndilate (kappa + kappa) := + CyclicBohr.Set.add_mem_ndilate (hSL hs) (hSL ht) + have hsymm : ∀ x, -x ∈ L.carrier ↔ x ∈ L.carrier := fun x => L.neg_mem_iff x + calc + _ ≤ M * ∑ x, |realUniformMass L.carrier (x - (s + t)) - realUniformMass L.carrier x| := + convolution_indicator_sub_one_le L.carrier_nonempty hsymm g hgsupport hgsum hg (s + t) + _ ≤ M * eta := mul_le_mul_of_nonneg_left (hTV _ hsum) hM + _ ≤ 3 * M * eta := by nlinarith [mul_nonneg hM heta] + _ ≤ delta / 2 := hbudget.trans (min_le_left _ _) + · intro s hs t ht + have hsub : s - t ∈ L.ndilate (kappa + kappa) := + CyclicBohr.Set.sub_mem_ndilate (hSL hs) (hSL ht) + have hneg : -(s - t) ∈ L.ndilate (kappa + kappa) := + ((L.ndilate (kappa + kappa)).neg_mem_iff _).2 hsub + exact (centered_correlation_error_le L.carrier_nonempty f hfsupport hfsum hf heta + (s - t) (hTV _ hsub) (hTV _ hneg)).trans (hbudget.trans (min_le_right _ _)) + +end Erdos3.LocalConvolution + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BohrLocalizedAverage.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BohrLocalizedAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cb679fed6d8c4db022ac0bc7b5d88fe0cfd5d23 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BohrLocalizedAverage.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Estimates.TranslatedLocalAverage +import OAI.Combinatorics.Progressions.Fourier.BohrTorusApproximation + +namespace OAI + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem exists_localized_difference_average_at_scale (S : Set N) + (hSpos : 0 < S.radius) (hSreg : S.IsRankRegular) (f : ZMod N → ℝ) + {R epsilon : ℝ} (hR : 0 ≤ R) (hf : ∀ x, |f x| ≤ R) (hepsilon : 0 < epsilon) + (kappa : ℝ≥0) (hkappa0 : 0 < kappa) + (hscale : kappa ≤ localizedAverageScale S.rank R epsilon) : + ∃ C : Set N, C.frequencies = S.frequencies ∧ C.IsRankRegular ∧ 0 < C.radius ∧ + (kappa : ℝ) * S.radius / 2 ≤ C.radius ∧ C.radius ≤ kappa * S.radius ∧ + C.carrier ⊆ (S.ndilate kappa).carrier ∧ + ∃ b ∈ S.carrier, (𝔼 a ∈ S.carrier, 𝔼 x ∈ S.carrier, f (a - x)) - epsilon ≤ + 𝔼 a ∈ S.carrier, 𝔼 t ∈ C.carrier, f (a - (b + t)) := by + obtain ⟨_, hlimit, hbound⟩ := localizedAverageScale_spec S.rank hR hepsilon + have hkappa := hscale.trans hlimit + have hscaleR : (kappa : ℝ) ≤ localizedAverageScale S.rank R epsilon := by + exact_mod_cast hscale + have herror : R * (400 * (max S.rank 1 : ℕ) * (kappa : ℝ)) ≤ epsilon := by + apply le_trans _ hbound + gcongr + have hkappa1 : kappa ≤ 1 := by + apply hkappa.trans + rw [div_le_one (by positivity)] + exact_mod_cast (show 1 ≤ 100 * (2 * max S.rank 1) by omega) + obtain ⟨C, hfreq, hreg, hlo, hhi, hsub, _⟩ := + S.exists_controlled_regular_subdilate hSpos kappa hkappa0 hkappa1 + have hkappaR : (0 : ℝ) < kappa := by exact_mod_cast hkappa0 + have hCpos : 0 < C.radius := (show 0 < (kappa : ℝ) * S.radius / 2 by positivity).trans_le hlo + have hTV : ∀ t ∈ C.carrier, + (∑ x, |realUniformMass S.carrier (x - t) - realUniformMass S.carrier x|) ≤ + 400 * (max S.rank 1 : ℕ) * (kappa : ℝ) := by + intro t ht + exact uniformMass_translation_le_of_rankRegular hSreg hkappa (hsub ht) + obtain ⟨b, hb, havg⟩ := exists_translated_local_average S.carrier C.carrier + S.carrier_nonempty C.carrier_nonempty f hR hf hTV + refine ⟨C, hfreq, hreg, hCpos, hlo, hhi, hsub, b, hb, ?_⟩ + linarith + +theorem exists_localized_difference_average (S : Set N) + (hSpos : 0 < S.radius) (hSreg : S.IsRankRegular) (f : ZMod N → ℝ) + {R epsilon : ℝ} (hR : 0 ≤ R) (hf : ∀ x, |f x| ≤ R) (hepsilon : 0 < epsilon) : + let kappa := localizedAverageScale S.rank R epsilon + ∃ C : Set N, C.frequencies = S.frequencies ∧ C.IsRankRegular ∧ 0 < C.radius ∧ + (kappa : ℝ) * S.radius / 2 ≤ C.radius ∧ C.radius ≤ kappa * S.radius ∧ + C.carrier ⊆ (S.ndilate kappa).carrier ∧ + ∃ b ∈ S.carrier, (𝔼 a ∈ S.carrier, 𝔼 x ∈ S.carrier, f (a - x)) - epsilon ≤ + 𝔼 a ∈ S.carrier, 𝔼 t ∈ C.carrier, f (a - (b + t)) := by + exact S.exists_localized_difference_average_at_scale hSpos hSreg f hR hf hepsilon + (localizedAverageScale S.rank R epsilon) + (localizedAverageScale_spec S.rank hR hepsilon).1 le_rfl + +end Erdos3.CyclicBohr.Set + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BohrMatchedContraction.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BohrMatchedContraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..51ac26cda8ec05846332e196e5855f1689f4327d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BohrMatchedContraction.lean @@ -0,0 +1,74 @@ +import OAI.Combinatorics.Progressions.Dynamics.MatchedPotentialContraction +import OAI.Combinatorics.Progressions.Fourier.BohrTorusApproximation + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Pointwise NNReal + +variable {N : ℕ} [NeZero N] + +theorem bohr_matched_potential_contraction + (L : CyclicBohr.Set N) (hL : L.IsRankRegular) (S C : Finset (ZMod N)) + (hS : S.Nonempty) (hC : C.Nonempty) {kappa : ℝ≥0} + (hSL : S ⊆ (L.ndilate kappa).carrier) + (hkappa : kappa + kappa ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (f g : ZMod N → ℝ) (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, 0 ≤ g x) + (hfsupport : ∀ x, x ∉ L.carrier → f x = 0) + (hgsupport : ∀ x, x ∉ L.carrier → g x = 0) + {u v M K c : ℝ} (hu : 0 < u) (hv : 0 < v) (hc : 0 < c) (hc1 : c ≤ 1) + (hmeanf : (𝔼 x ∈ L.carrier, f x) ≤ u) (hmeang : (𝔼 x ∈ L.carrier, g x) ≤ v) + (hcapg : ∀ x, g x / v ≤ M) + (hcellf : ∀ x, cellAverage C f x / u ≤ K) + (hcellg : ∀ x, cellAverage C g x / v ≤ K) + (herror : M ^ 2 * (400 * (max L.rank 1 : ℕ) * ((kappa + kappa : ℝ≥0) : ℝ)) ≤ c / 2) + (hsecond : (1 + c ≤ 𝔼 x ∈ L.carrier, cellAverage C (fun y => f y / u) x ^ 2) ∨ + (1 + c ≤ 𝔼 x ∈ L.carrier, cellAverage C (fun y => g y / v) x ^ 2)) : + let rho := 1 - c / (8 * (1 + Real.sqrt K) ^ 2) + 3 / 4 ≤ rho ∧ rho < 1 ∧ + (𝔼 z ∈ matchedCellSpace L.carrier S, + (matchedFirstCell C f z * matchedSecondCell C g z) ^ (1 / 4 : ℝ)) ≤ + rho * (u * v) ^ (1 / 4 : ℝ) := by + intro rho + let eta : ℝ := 400 * (max L.rank 1 : ℕ) * ((kappa + kappa : ℝ≥0) : ℝ) + have heta : 0 ≤ eta := by dsimp [eta]; positivity + have hsymm : -L.carrier = L.carrier := by + ext x + constructor + · intro h + obtain ⟨y, hy, rfl⟩ := Finset.mem_neg.mp h + exact (L.neg_mem_iff y).2 hy + · intro h + exact Finset.mem_neg.mpr ⟨-x, (L.neg_mem_iff x).2 h, neg_neg x⟩ + have hTV : ∀ s ∈ S, ∀ t ∈ S, + (∑ x, |realUniformMass L.carrier (x - (s + t)) - realUniformMass L.carrier x|) ≤ eta := by + intro s hs t ht + exact CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hL hkappa + (CyclicBohr.Set.add_mem_ndilate (hSL hs) (hSL ht)) + have hsecond' : + (1 + c / 2 + M ^ 2 * eta ≤ 𝔼 x ∈ L.carrier, cellAverage C (fun y => f y / u) x ^ 2) ∨ + (1 + c / 2 + M ^ 2 * eta ≤ 𝔼 x ∈ L.carrier, cellAverage C (fun y => g y / v) x ^ 2) := by + change M ^ 2 * eta ≤ c / 2 at herror + rcases hsecond with hsecond | hsecond + · left; linarith + · right; linarith + have h := matched_potential_contraction L.carrier S C L.carrier_nonempty hsymm hS hC f g hf hg + hfsupport hgsupport hu hv heta hmeanf hmeang hcapg hcellf hcellg hTV hsecond' + have heq : c / 2 / (4 * (1 + Real.sqrt K) ^ 2) = c / (8 * (1 + Real.sqrt K) ^ 2) := by + rw [div_div] + congr 1 + ring + rw [heq] at h + have hbounds := quarter_contraction_factor_bounds (M := K) (c := c / 2) + (by linarith) (by linarith) + rw [heq] at hbounds + exact ⟨hbounds.1, hbounds.2, h⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BohrMatchingScales.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BohrMatchingScales.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8b454e767e608f92ab5c551a262fb94820f2cdb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BohrMatchingScales.lean @@ -0,0 +1,216 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteCellRefinement +import OAI.Combinatorics.Progressions.Fourier.BohrTorusApproximation + +namespace OAI + +section + +namespace Erdos3.CellRefinement + +open scoped BigOperators Pointwise NNReal + +variable {N : ℕ} [NeZero N] + +theorem bohr_parent_truncated_comparison + (B L S : CyclicBohr.Set N) (hB : B.IsRankRegular) (hL : L.IsRankRegular) + {ell sigma delta : ℝ≥0} + (hLB : L.carrier ⊆ (B.ndilate ell).carrier) + (hSB : S.carrier ⊆ (B.ndilate sigma).carrier) + (hSL : S.carrier ⊆ (L.ndilate delta).carrier) + (hparent : ell + sigma + sigma ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (hlocal : delta + delta ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (a f g : ZMod N → ℝ) {M : ℝ} (hM : 0 ≤ M) (ha : ∀ x, |a x| ≤ M) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ 1) (hg : ∀ x, 0 ≤ g x ∧ g x ≤ 1) : + |bilinearIntegral B.carrier B.carrier a f g - + parentTruncatedIntegral B.carrier B.carrier L.carrier S.carrier a f g| ≤ + M * (2 * (400 * (max B.rank 1 : ℕ) * ((ell + sigma + sigma : ℝ≥0) : ℝ)) + + 400 * (max L.rank 1 : ℕ) * ((delta + delta : ℝ≥0) : ℝ)) := by + have hsymm : -L.carrier = L.carrier := by + ext x + constructor + · intro h + obtain ⟨y, hy, rfl⟩ := Finset.mem_neg.mp h + exact (L.neg_mem_iff y).2 hy + · intro h + exact Finset.mem_neg.mpr ⟨-x, (L.neg_mem_iff x).2 h, neg_neg x⟩ + have hfirst : ∀ r ∈ L.carrier, + (∑ x, |realUniformMass B.carrier (x - r) - realUniformMass B.carrier x|) ≤ + 400 * (max B.rank 1 : ℕ) * ((ell + sigma + sigma : ℝ≥0) : ℝ) := by + intro r hr + apply CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hB hparent + exact CyclicBohr.Set.carrier_ndilate_mono + (show ell ≤ ell + sigma + sigma from (le_self_add).trans le_self_add) (hLB hr) + have hsecond : ∀ r ∈ L.carrier, ∀ s ∈ S.carrier, ∀ t ∈ S.carrier, + (∑ x, |realUniformMass B.carrier (x - (-r + s + t)) - realUniformMass B.carrier x|) ≤ + 400 * (max B.rank 1 : ℕ) * ((ell + sigma + sigma : ℝ≥0) : ℝ) := by + intro r hr s hs t ht + apply CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hB hparent + have hmem := CyclicBohr.Set.sub_mem_ndilate + (CyclicBohr.Set.add_mem_ndilate (hSB hs) (hSB ht)) (hLB hr) + have hscale : sigma + sigma + ell = ell + sigma + sigma := by ac_rfl + have hpoint : (s + t) - r = -r + s + t := by abel + rwa [hscale, hpoint] at hmem + have hboundary : ∀ s ∈ S.carrier, ∀ t ∈ S.carrier, + (∑ x, |realUniformMass L.carrier (x - (s + t)) - realUniformMass L.carrier x|) ≤ + 400 * (max L.rank 1 : ℕ) * ((delta + delta : ℝ≥0) : ℝ) := by + intro s hs t ht + exact CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hL hlocal + (CyclicBohr.Set.add_mem_ndilate (hSL hs) (hSL ht)) + have h := parent_integral_truncated_comparison B.carrier B.carrier L.carrier S.carrier + B.carrier_nonempty B.carrier_nonempty L.carrier_nonempty S.carrier_nonempty hsymm + a f g hM ha hf hg hfirst hsecond hboundary + simpa only [two_mul] using h + +theorem bohr_matched_independent_integral_error + (L S : CyclicBohr.Set N) (hL : L.IsRankRegular) (hS : S.IsRankRegular) + (C : Finset (ZMod N)) (hC : C.Nonempty) {ell sigma : ℝ≥0} + (hCL : C ⊆ (L.ndilate ell).carrier) (hCS : C ⊆ (S.ndilate sigma).carrier) + (hell : ell ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (hsigma : sigma + sigma ≤ 1 / (100 * (2 * max S.rank 1 : ℕ) : ℝ≥0)) + (a f g : ZMod N → ℝ) {M : ℝ} (hM : 0 ≤ M) (ha : ∀ x, |a x| ≤ M) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ 1) (hg : ∀ x, 0 ≤ g x ∧ g x ≤ 1) : + |(𝔼 z ∈ matchedCellSpace L.carrier S.carrier, + bilinearIntegral (C.image (fun t => z.1 + t)) + (C.image (fun t => (-z.1 + z.2.1 + z.2.2) + t)) a f g) - + matchedIntegral L.carrier S.carrier a f g| ≤ + M * (400 * (max L.rank 1 : ℕ) * (ell : ℝ) + + 400 * (max S.rank 1 : ℕ) * ((sigma + sigma : ℝ≥0) : ℝ)) := by + have hfirst : ∀ u ∈ C, + (∑ x, |realUniformMass L.carrier (x - u) - realUniformMass L.carrier x|) ≤ + 400 * (max L.rank 1 : ℕ) * (ell : ℝ) := by + intro u hu + exact CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hL hell (hCL hu) + have hsecond : ∀ u ∈ C, ∀ v ∈ C, + (∑ x, |realUniformMass S.carrier (x - (u + v)) - realUniformMass S.carrier x|) ≤ + 400 * (max S.rank 1 : ℕ) * ((sigma + sigma : ℝ≥0) : ℝ) := by + intro u hu v hv + exact CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hS hsigma + (CyclicBohr.Set.add_mem_ndilate (hCS hu) (hCS hv)) + have h := abs_matchedIndependentAverage_sub_le L.carrier S.carrier C L.carrier_nonempty + S.carrier_nonempty hC (fun x y => f x * g y * a (x + y)) hM + (fun x y => abs_unit_weighted_mul_le (hf x) (hg y) (ha (x + y))) hfirst hsecond + rw [matchedIndependentAverage_eq_cells] at h + exact h + +end Erdos3.CellRefinement + +end + +section + +namespace Erdos3.CellRefinement + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem exists_bohr_matching_scales_with_scales + (B : CyclicBohr.Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) + {M epsilon : ℝ} (hM : 0 ≤ M) (hepsilon : 0 < epsilon) + (kappa tau : ℝ≥0) (hkappa0 : 0 < kappa) + (hkappaScale : kappa ≤ localizedAverageScale B.rank M (epsilon / 4)) + (htau0 : 0 < tau) (htau : tau ≤ kappa / 2) : + ∃ L S : CyclicBohr.Set N, + L.frequencies = B.frequencies ∧ S.frequencies = B.frequencies ∧ + L.IsRankRegular ∧ S.IsRankRegular ∧ 0 < L.radius ∧ 0 < S.radius ∧ + (kappa : ℝ) * B.radius / 6 ≤ L.radius ∧ L.radius ≤ (kappa : ℝ) * B.radius / 3 ∧ + (kappa : ℝ) * (tau : ℝ) * B.radius / 12 ≤ S.radius ∧ S.radius ≤ (tau : ℝ) * L.radius ∧ + L.carrier ⊆ (B.ndilate (kappa / 3)).carrier ∧ + S.carrier ⊆ (L.ndilate tau).carrier ∧ + ∀ a f g : ZMod N → ℝ, (∀ x, |a x| ≤ M) → + (∀ x, 0 ≤ f x ∧ f x ≤ 1) → (∀ x, 0 ≤ g x ∧ g x ≤ 1) → + |bilinearIntegral B.carrier B.carrier a f g - + parentTruncatedIntegral B.carrier B.carrier L.carrier S.carrier a f g| ≤ epsilon := by + obtain ⟨_, hlimit, hbound⟩ := localizedAverageScale_spec B.rank hM + (show 0 < epsilon / 4 by positivity) + have hkappa := hkappaScale.trans hlimit + have hscaleR : (kappa : ℝ) ≤ localizedAverageScale B.rank M (epsilon / 4) := by + exact_mod_cast hkappaScale + have herror : M * (400 * (max B.rank 1 : ℕ) * (kappa : ℝ)) ≤ epsilon / 4 := by + apply le_trans _ hbound + gcongr + have hkappaR : (0 : ℝ) < kappa := by exact_mod_cast hkappa0 + have hkappa1 : kappa ≤ 1 := by + apply hkappa.trans + rw [div_le_one (by positivity)] + exact_mod_cast (show 1 ≤ 100 * (2 * max B.rank 1) by omega) + have hell0 : 0 < kappa / 3 := div_pos hkappa0 (by norm_num) + have hell1 : kappa / 3 ≤ 1 := + (div_le_self (by positivity) (by norm_num)).trans hkappa1 + obtain ⟨L, hLfreq, hLreg, hLlo, hLhi, hLB, _⟩ := + B.exists_controlled_regular_subdilate hBpos (kappa / 3) hell0 hell1 + change (kappa : ℝ) / 3 * B.radius / 2 ≤ L.radius at hLlo + change L.radius ≤ (kappa : ℝ) / 3 * B.radius at hLhi + have hLlower : (kappa : ℝ) * B.radius / 6 ≤ L.radius := by nlinarith [hLlo] + have hLupper : L.radius ≤ (kappa : ℝ) * B.radius / 3 := by nlinarith [hLhi] + have hLpos : 0 < L.radius := (show 0 < (kappa : ℝ) * B.radius / 6 by positivity).trans_le hLlower + have hLrank : L.rank = B.rank := by simp only [CyclicBohr.Set.rank, hLfreq] + have htau1 : tau ≤ 1 := htau.trans + ((div_le_self (by positivity) (by norm_num)).trans hkappa1) + have htauR : (0 : ℝ) < tau := by exact_mod_cast htau0 + obtain ⟨S, hSfreq, hSreg, hSlo, hShi, hSL, _⟩ := + L.exists_controlled_regular_subdilate hLpos tau htau0 htau1 + have hSpos : 0 < S.radius := + (show 0 < (tau : ℝ) * L.radius / 2 by positivity).trans_le hSlo + have hSlower : (kappa : ℝ) * (tau : ℝ) * B.radius / 12 ≤ S.radius := by + have h := mul_le_mul_of_nonneg_left hLlower (show (0 : ℝ) ≤ tau / 2 by positivity) + nlinarith [hSlo] + have hSLbase : S.carrier ⊆ L.carrier := by + have h := hSL.trans (CyclicBohr.Set.carrier_ndilate_mono (B := L) htau1) + simpa only [CyclicBohr.Set.ndilate_one] using h + refine ⟨L, S, hLfreq, hSfreq.trans hLfreq, hLreg, hSreg, hLpos, hSpos, + hLlower, hLupper, hSlower, hShi, hLB, hSL, ?_⟩ + intro a f g ha hf hg + have hthirds : kappa / 3 + kappa / 3 + kappa / 3 = kappa := by ring + have htaus : tau + tau ≤ kappa := by + have h := add_le_add htau htau + simpa only [add_halves] using h + have hparent : kappa / 3 + kappa / 3 + kappa / 3 ≤ + 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0) := by rwa [hthirds] + have hlocal : tau + tau ≤ + 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0) := by + rw [hLrank] + exact htaus.trans hkappa + have h := bohr_parent_truncated_comparison B L S hB hLreg hLB (hSLbase.trans hLB) hSL + hparent hlocal a f g hM ha hf hg + rw [hthirds, hLrank] at h + have htausR : ((tau + tau : ℝ≥0) : ℝ) ≤ kappa := by exact_mod_cast htaus + have hlocalError : M * (400 * (max B.rank 1 : ℕ) * ((tau + tau : ℝ≥0) : ℝ)) ≤ epsilon / 4 := by + apply le_trans _ herror + gcongr + exact h.trans (by nlinarith [herror, hlocalError]) + +theorem exists_bohr_matching_scales + (B : CyclicBohr.Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) + {M epsilon : ℝ} (hM : 0 ≤ M) (hepsilon : 0 < epsilon) : + let kappa := localizedAverageScale B.rank M (epsilon / 4) + ∃ L S : CyclicBohr.Set N, + L.frequencies = B.frequencies ∧ S.frequencies = B.frequencies ∧ + L.IsRankRegular ∧ S.IsRankRegular ∧ 0 < L.radius ∧ 0 < S.radius ∧ + (kappa : ℝ) * B.radius / 6 ≤ L.radius ∧ L.radius ≤ (kappa : ℝ) * B.radius / 3 ∧ + (kappa : ℝ) ^ 2 * B.radius / 24 ≤ S.radius ∧ S.radius ≤ (kappa : ℝ) * L.radius / 2 ∧ + L.carrier ⊆ (B.ndilate (kappa / 3)).carrier ∧ + S.carrier ⊆ (L.ndilate (kappa / 2)).carrier ∧ + ∀ a f g : ZMod N → ℝ, (∀ x, |a x| ≤ M) → + (∀ x, 0 ≤ f x ∧ f x ≤ 1) → (∀ x, 0 ≤ g x ∧ g x ≤ 1) → + |bilinearIntegral B.carrier B.carrier a f g - + parentTruncatedIntegral B.carrier B.carrier L.carrier S.carrier a f g| ≤ epsilon := by + intro kappa + have hkappa0 : 0 < kappa := + (localizedAverageScale_spec B.rank hM (show 0 < epsilon / 4 by positivity)).1 + obtain ⟨L, S, hLfreq, hSfreq, hLreg, hSreg, hLpos, hSpos, + hLlo, hLhi, hSlo, hShi, hLB, hSL, hcompare⟩ := + exists_bohr_matching_scales_with_scales B hBpos hB hM hepsilon kappa (kappa / 2) + hkappa0 le_rfl (div_pos hkappa0 (by norm_num)) le_rfl + refine ⟨L, S, hLfreq, hSfreq, hLreg, hSreg, hLpos, hSpos, + hLlo, hLhi, ?_, ?_, hLB, hSL, hcompare⟩ + · change (kappa : ℝ) * ((kappa : ℝ) / 2) * B.radius / 12 ≤ S.radius at hSlo + nlinarith [hSlo] + · change S.radius ≤ (kappa : ℝ) / 2 * L.radius at hShi + nlinarith [hShi] + +end Erdos3.CellRefinement + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BohrNiltestBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BohrNiltestBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..998da7ac9eb03368b329e0e8356745c4cdab7b58 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BohrNiltestBudget.lean @@ -0,0 +1,963 @@ +import OAI.Combinatorics.Progressions.Dynamics.LocalizedAverageScaleBudget +import OAI.Combinatorics.Progressions.Estimates.NativeSpaceMap +import OAI.Combinatorics.Progressions.Estimates.RealificationModuleTopology +import OAI.Combinatorics.Progressions.Fourier.BohrTorusApproximation +import OAI.Combinatorics.Progressions.Fourier.RealQuarterTorusExtension +import OAI.Combinatorics.Progressions.Geometry.CoordinateQuotientModel +import OAI.Combinatorics.Progressions.Geometry.StepOneCoordinateMetric +import OAI.Combinatorics.Progressions.Lattices.RationalLatticeFunctional + +namespace OAI + +section + +namespace Erdos3.RationalTorus + +open Module + +def Algebra (d : ℕ) := Fin d → ℚ + +instance (d : ℕ) : AddCommGroup (Algebra d) := + inferInstanceAs (AddCommGroup (Fin d → ℚ)) + +instance (d : ℕ) : Module ℚ (Algebra d) := + inferInstanceAs (Module ℚ (Fin d → ℚ)) + +instance (d : ℕ) : LieRing (Algebra d) where + toAddCommGroup := inferInstanceAs (AddCommGroup (Fin d → ℚ)) + bracket _ _ := 0 + add_lie _ _ _ := by simp + lie_add _ _ _ := by simp + lie_self _ := rfl + leibniz_lie _ _ _ := by simp + +instance (d : ℕ) : LieAlgebra ℚ (Algebra d) where + toModule := inferInstanceAs (Module ℚ (Fin d → ℚ)) + lie_smul _ _ _ := by + change (0 : Algebra d) = _ • (0 : Algebra d) + exact (smul_zero _).symm + +theorem lie_eq_zero {d : ℕ} (x y : Algebra d) : ⁅x, y⁆ = 0 := rfl + +noncomputable def basis (d : ℕ) : Basis (Fin d) ℚ (Algebra d) := by + change Basis (Fin d) ℚ (Fin d → ℚ) + exact Pi.basisFun ℚ (Fin d) + +theorem basis_repr (d : ℕ) (x : Algebra d) (i : Fin d) : (basis d).repr x i = x i := by + change Fin d → ℚ at x + exact Pi.basisFun_repr ℚ (Fin d) x i + +theorem basis_equivFun (d : ℕ) (x : Algebra d) : (basis d).equivFun x = x := by + ext i + exact basis_repr d x i + +theorem basis_equivFun_symm (d : ℕ) (x : Fin d → ℚ) : (basis d).equivFun.symm x = x := by + have h := basis_equivFun d ((basis d).equivFun.symm x) + rw [LinearEquiv.apply_symm_apply] at h + exact h.symm + +def filtration (d : ℕ) : NilpotentLieFiltration (Algebra d) 1 where + layer j := if j ≤ 1 then ⊤ else ⊥ + antitone := by + intro i j hij + by_cases hj : j ≤ 1 + · have hi := hij.trans hj + simp only [hi, hj, ite_true, le_refl] + · simp only [hj, ite_false, bot_le] + one_eq_top := by simp + lie_mem := by + intro i j a b _ _ + rw [lie_eq_zero] + exact Submodule.zero_mem _ + terminal := by simp + +theorem basis_layers (d j : ℕ) : + (filtration d).layer j = Submodule.span ℚ ((basis d) '' {_i : Fin d | j ≤ (1 : ℕ)}) := by + by_cases hj : j ≤ 1 + · simpa only [filtration, hj, ite_true, Set.ofPred_true, Set.image_univ] using (basis d).span_eq.symm + · simp only [filtration, hj, ite_false, Set.ofPred_false, Set.image_empty, Submodule.span_empty] + +end Erdos3.RationalTorus + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +theorem exists_native_step_one_character : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L : Type*} [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] {d : ℕ} + (D : RationalFilteredNilmanifold L 1 d) {p : ℝ}, + 0 ≤ p → D.GeometryComplexityLE p → ∀ η : L →ₗ[ℚ] ℚ, + (∀ i, rationalLogHeight (η (D.basis i)) ≤ p) → + (∀ z : D.RealGroup, z ∈ D.realLattice → ∃ n : ℤ, realifyFunctional η z.coord = n) → + ∃ f : D.Space → ℂ, + (letI := D.metricSpace; LipschitzWith ⟨Real.exp ((p + C) ^ C), Real.exp_nonneg _⟩ f) ∧ + (∀ x, ‖f x‖ = 1) ∧ + ∀ z : D.RealGroup, f (QuotientGroup.mk z) = logCharacter (realifyFunctional η) z := by + obtain ⟨C, hC, hseed⟩ := exists_native_central_seed 1 + refine ⟨C, hC, ?_⟩ + intro L _ _ _ _ _ _ d D p hp hD η hη hint + let := D.metricSpace + obtain ⟨K, hK, f, hLip, _, heq⟩ := hseed D hp hD η hη hint + have heq' (z : D.RealGroup) : f (QuotientGroup.mk z) = logCharacter (realifyFunctional η) z := + heq z (by rw [D.filtration.realification.subgroup_one]; trivial) + refine ⟨f, hLip.weaken hK, ?_, heq'⟩ + intro x + induction x using Quotient.inductionOn with + | h z => rw [heq', logCharacter_norm] + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalTorus + +open Module + +noncomputable def lattice (d : ℕ) : Subgroup (filtration d).Group where + carrier := {g | IntegralVector g.coord} + one_mem' := ⟨0, fun _ => rfl⟩ + mul_mem' := by + intro a b ha hb + obtain ⟨z, hz⟩ := ha + obtain ⟨w, hw⟩ := hb + refine ⟨z + w, ?_⟩ + intro i + rw [(filtration d).stepOne_coord_mul] + change a.coord i + b.coord i = ((z + w) i : ℚ) + simp only [Pi.add_apply, Int.cast_add, hz, hw] + inv_mem' := by + intro a ha + obtain ⟨z, hz⟩ := ha + refine ⟨-z, ?_⟩ + intro i + change -(a.coord i) = ((-z) i : ℚ) + simp only [Pi.neg_apply, Int.cast_neg, hz] + +theorem lattice_coordinates (d : ℕ) : + bchSubgroupCoordinates (basis d) (lattice d) = {x | IntegralVector x} := by + ext x + change IntegralVector ((basis d).equivFun.symm x) ↔ IntegralVector x + rw [basis_equivFun_symm] + +theorem lattice_inner_grid (d : ℕ) : + scaledIntegerGrid 1 ⊆ bchSubgroupCoordinates (basis d) (lattice d) := by + rw [lattice_coordinates] + rintro x ⟨z, rfl⟩ + exact ⟨z, fun i => by simp⟩ + +theorem lattice_outer_grid (d : ℕ) : + bchSubgroupCoordinates (basis d) (lattice d) ⊆ denominatorGrid 1 := by + rw [lattice_coordinates] + intro x hx + simpa only [denominatorGrid, Set.mem_ofPred_eq, Nat.cast_one, one_smul] using hx + +noncomputable def nilmanifold (d : ℕ) : RationalFilteredNilmanifold (Algebra d) 1 d := + (filtration d).ofAdaptedBasis (basis d) (fun _ => 1) (basis_layers d) + (lattice d) 1 (by decide) (lattice_inner_grid d) (lattice_outer_grid d) + +theorem nilmanifold_geometry (d : ℕ) {p : ℝ} (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) : + (nilmanifold d).GeometryComplexityLE p := by + apply (filtration d).ofAdaptedBasis_geometry (basis d) (fun _ => 1) (basis_layers d) + (lattice d) 1 (by decide) (lattice_inner_grid d) (lattice_outer_grid d) hp hd + · simpa only [Nat.cast_one] using Real.one_le_exp hp + · intro i j k + simpa [lieStructureConstants, lie_eq_zero, rationalLogHeight] using hp + +end Erdos3.RationalTorus + +end + +section + +namespace Erdos3.RationalTorus + +open scoped TensorProduct + +noncomputable instance instRealTopology (d : ℕ) : TopologicalSpace (ℝ ⊗[ℚ] Algebra d) := + moduleTopology ℝ (ℝ ⊗[ℚ] Algebra d) + +instance instRealTopologicalAddGroup (d : ℕ) : IsTopologicalAddGroup (ℝ ⊗[ℚ] Algebra d) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + +instance instRealContinuousSMul (d : ℕ) : ContinuousSMul ℝ (ℝ ⊗[ℚ] Algebra d) := + ModuleTopology.continuousSMul ℝ _ + +instance instRealT2Space (d : ℕ) : T2Space (ℝ ⊗[ℚ] Algebra d) := + realification_moduleTopology_t2 (basis d) + +end Erdos3.RationalTorus + +end + +section + +namespace Erdos3.RationalTorus + +open scoped TensorProduct + +noncomputable def phaseCoordinates (d : ℕ) (g : (nilmanifold d).RealGroup) : + Fin d → CircleFourier.Circle := + fun i => (((basis d).baseChange ℝ).repr g.coord i : CircleFourier.Circle) + +theorem phaseCoordinates_one (d : ℕ) : + phaseCoordinates d 1 = 0 := by + ext i + simp [phaseCoordinates] + +theorem phaseCoordinates_mul (d : ℕ) (g h : (nilmanifold d).RealGroup) : + phaseCoordinates d (g * h) = phaseCoordinates d g + phaseCoordinates d h := by + ext i + simp only [phaseCoordinates, (nilmanifold d).filtration.realification.stepOne_coord_mul, + map_add, Finsupp.add_apply, AddCircle.coe_add, Pi.add_apply] + +theorem phaseCoordinates_inv (d : ℕ) (g : (nilmanifold d).RealGroup) : + phaseCoordinates d g⁻¹ = -phaseCoordinates d g := by + ext i + simp [phaseCoordinates] + +theorem phaseCoordinates_lattice (d : ℕ) (g : (nilmanifold d).RealGroup) + (hg : g ∈ (nilmanifold d).realLattice) : phaseCoordinates d g = 0 := by + obtain ⟨a, ha, rfl⟩ := Subgroup.mem_map.mp hg + obtain ⟨z, hz⟩ : IntegralVector a.coord := ha + ext i + change ((((basis d).baseChange ℝ).equivFun + (NilpotentLieBCHGroup.realificationHom a).coord) i : CircleFourier.Circle) = 0 + rw [NilpotentLieBCHGroup.realificationHom_coordinates] + dsimp only + rw [basis_repr, hz] + apply (AddCircle.coe_eq_zero_iff (1 : ℝ)).mpr + refine ⟨z i, ?_⟩ + simp + +noncomputable def phaseProjection (d : ℕ) : + (nilmanifold d).Space → (Fin d → CircleFourier.Circle) := + Quotient.lift (phaseCoordinates d) (fun a b hab => by + have h := phaseCoordinates_lattice d (a⁻¹ * b) (QuotientGroup.leftRel_apply.mp hab) + apply Eq.symm + apply sub_eq_zero.mp + simpa only [phaseCoordinates_mul, phaseCoordinates_inv, sub_eq_add_neg, add_comm] using h) + +@[simp] theorem phaseProjection_mk (d : ℕ) (g : (nilmanifold d).RealGroup) : + phaseProjection d (QuotientGroup.mk g) = phaseCoordinates d g := rfl + +end Erdos3.RationalTorus + +end + +section + +namespace Erdos3.RationalTorus + +open Module NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct NNReal + +abbrev BottomQuotient (d : ℕ) := Algebra d ⧸ (⊥ : LieIdeal ℚ (Algebra d)) + +theorem exists_bottom_quotient_character : + ∃ C : ℕ, 2 ≤ C ∧ ∀ (d : ℕ) + [TopologicalSpace (ℝ ⊗[ℚ] BottomQuotient d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] BottomQuotient d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] BottomQuotient d)] + [T2Space (ℝ ⊗[ℚ] BottomQuotient d)] (i₀ : Fin d) {p : ℝ}, + 0 ≤ p → (d : ℝ) ≤ p → + ∃ (e : ℕ) (E : RationalFilteredNilmanifold (BottomQuotient d) 1 e), + E.GeometryComplexityLE p ∧ + (∀ i j, rationalLogHeight (E.basis.repr + (lieQuotientMap (⊥ : LieIdeal ℚ (Algebra d)) (basis d j)) i) ≤ p) ∧ + ∃ (η : BottomQuotient d →ₗ[ℚ] ℚ) (V : E.Space → ℂ), + (∀ x, η (lieQuotientMap (⊥ : LieIdeal ℚ (Algebra d)) x) = x i₀) ∧ + (letI := E.metricSpace; + LipschitzWith ⟨Real.exp ((p + C) ^ C), Real.exp_nonneg _⟩ V) ∧ + (∀ x, ‖V x‖ = 1) ∧ + ∀ z : E.RealGroup, V (QuotientGroup.mk z) = logCharacter (realifyFunctional η) z := by + obtain ⟨C, hC, hcharacter⟩ := exists_native_step_one_character + refine ⟨C, hC, ?_⟩ + intro d _ _ _ _ i₀ p hp hd + classical + have hI : (filtration d).layer (1 + 1) ≤ (⊥ : LieIdeal ℚ (Algebra d)).toSubmodule := by + rw [(filtration d).terminal] + exact bot_le + have hspan : (⊥ : LieIdeal ℚ (Algebra d)).toSubmodule = + Submodule.span ℚ (basis d '' (∅ : Set (Fin d))) := by simp + let E := (filtration d).coordinateQuotientModel (basis d) (fun _ => 1) (basis_layers d) + (⊥ : LieIdeal ℚ (Algebra d)) hI ∅ hspan (lattice d) 1 (by decide) + (lattice_inner_grid d) (lattice_outer_grid d) + have hE : E.GeometryComplexityLE p := by + apply (filtration d).coordinateQuotientModel_geometry (basis d) (fun _ => 1) (basis_layers d) + (⊥ : LieIdeal ℚ (Algebra d)) hI ∅ hspan (lattice d) 1 (by decide) + (lattice_inner_grid d) (lattice_outer_grid d) hp + · simpa only [Fintype.card_fin] using hd + · simpa only [Nat.cast_one] using Real.one_le_exp hp + · intro i j k + simpa [lieStructureConstants, lie_eq_zero, rationalLogHeight] using hp + let η : BottomQuotient d →ₗ[ℚ] ℚ := + (⊥ : Submodule ℚ (Algebra d)).liftQ ((basis d).coord i₀) bot_le + have hη (x : Algebra d) : η (lieQuotientMap (⊥ : LieIdeal ℚ (Algebra d)) x) = x i₀ := + basis_repr d x i₀ + have hproj (i) (j) : rationalLogHeight (E.basis.repr + (lieQuotientMap (⊥ : LieIdeal ℚ (Algebra d)) (basis d j)) i) ≤ p := by + change rationalLogHeight (((supportedQuotientBasis (basis d) + (⊥ : Submodule ℚ (Algebra d)) ∅ hspan).reindex (Fintype.equivFin _)).repr + ((⊥ : Submodule ℚ (Algebra d)).mkQ (basis d j)) i) ≤ p + rw [Basis.repr_reindex_apply, supportedQuotientBasis_repr_mk] + exact rationalLogHeight_le_of_height (basis_repr_height_one _ _ _) + (by simpa only [Nat.cast_one] using Real.one_le_exp hp) + have hheight (i) : rationalLogHeight (η (E.basis i)) ≤ p := by + change rationalLogHeight (η (((supportedQuotientBasis (basis d) + (⊥ : Submodule ℚ (Algebra d)) ∅ hspan).reindex (Fintype.equivFin _)) i)) ≤ p + rw [Basis.reindex_apply, supportedQuotientBasis_apply] + change rationalLogHeight ((basis d).repr (basis d _) i₀) ≤ p + exact rationalLogHeight_le_of_height (basis_repr_height_one _ _ _) + (by simpa only [Nat.cast_one] using Real.one_le_exp hp) + have hint : ∀ z : E.RealGroup, z ∈ E.realLattice → + ∃ n : ℤ, realifyFunctional η z.coord = n := by + apply E.realLattice_functional_integral η + intro z hz + obtain ⟨g, hg, rfl⟩ := hz + obtain ⟨a, ha⟩ := hg + refine ⟨a i₀, ?_⟩ + change η (lieQuotientMap (⊥ : LieIdeal ℚ (Algebra d)) g.coord) = _ + rw [hη] + exact ha i₀ + obtain ⟨V, hLip, hnorm, heq⟩ := hcharacter E hp hE η hheight hint + exact ⟨_, E, hE, hproj, η, V, hη, hLip, hnorm, heq⟩ + +end Erdos3.RationalTorus + +end + +section + +namespace Erdos3.CircleFourier + +theorem real_phase_map_lipschitz {ι : Type*} [Fintype ι] : + LipschitzWith 1 (fun v : ι → ℝ => fun i => (v i : Circle)) := by + apply LipschitzWith.of_dist_le_mul + intro v w + rw [NNReal.coe_one, one_mul, dist_eq_norm] + apply (pi_norm_le_iff_of_nonneg dist_nonneg).mpr + intro i + change ‖(v i : Circle) - (w i : Circle)‖ ≤ dist v w + calc + _ = ‖((v i - w i : ℝ) : Circle)‖ := rfl + _ ≤ ‖v i - w i‖ := QuotientAddGroup.norm_mk_le_norm + _ = dist (v i) (w i) := rfl + _ ≤ dist v w := dist_le_pi_dist v w i + +end Erdos3.CircleFourier + +namespace Erdos3.RationalTorus + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +variable (d : ℕ) + [TopologicalSpace (ℝ ⊗[ℚ] Algebra d)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] Algebra d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] Algebra d)] [T2Space (ℝ ⊗[ℚ] Algebra d)] + +theorem phaseCoordinates_lipschitz : + letI := rightMetricSpace + (hnil := (nilmanifold d).filtration.realification.lowerCentralSeries_eq_bot) + ((basis d).baseChange ℝ) + LipschitzWith 1 (phaseCoordinates d) := by + let := rightMetricSpace + (hnil := (nilmanifold d).filtration.realification.lowerCentralSeries_eq_bot) + ((basis d).baseChange ℝ) + apply LipschitzWith.of_dist_le_mul + intro x y + have hc := ((nilmanifold d).filtration.realification.stepOne_coordinates_lipschitz + ((basis d).baseChange ℝ)).dist_le_mul x y + simp only [NNReal.coe_one, one_mul, basisHomeomorph_apply] at hc + have hphase : dist (phaseCoordinates d x) (phaseCoordinates d y) ≤ + dist (((basis d).baseChange ℝ).equivFun x.coord) + (((basis d).baseChange ℝ).equivFun y.coord) := by + change dist + (fun i : Fin d => (((basis d).baseChange ℝ).repr x.coord i : CircleFourier.Circle)) + (fun i : Fin d => (((basis d).baseChange ℝ).repr y.coord i : CircleFourier.Circle)) ≤ _ + simpa only [NNReal.coe_one, one_mul, Basis.equivFun_apply] using + CircleFourier.real_phase_map_lipschitz.dist_le_mul + (((basis d).baseChange ℝ).equivFun x.coord) + (((basis d).baseChange ℝ).equivFun y.coord) + simpa only [NNReal.coe_one, one_mul] using hphase.trans hc + +theorem phaseProjection_lipschitz : + letI := (nilmanifold d).metricSpace + LipschitzWith 1 (phaseProjection d) := by + let : FiniteDimensional ℝ (ℝ ⊗[ℚ] Algebra d) := + ((basis d).baseChange ℝ).finiteDimensional_of_finite + let := rightMetricSpace + (hnil := (nilmanifold d).filtration.realification.lowerCentralSeries_eq_bot) + ((basis d).baseChange ℝ) + let := rightMetricSpace_isIsometricSMul + (hnil := (nilmanifold d).filtration.realification.lowerCentralSeries_eq_bot) + ((basis d).baseChange ℝ) + exact rightCosetMetricSpace_lipschitz_lift (nilmanifold d).realLattice + (nilmanifold d).realLattice_closed_discrete.1 (phaseProjection d) + (phaseCoordinates_lipschitz d) + +end Erdos3.RationalTorus + +end + +section + +namespace Erdos3 + +open NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d t : ℕ} + +noncomputable def torusPhaseLinear (φ : L →ₗ⁅ℚ⁆ RationalTorus.Algebra t) : + (ℝ ⊗[ℚ] L) →ₗ[ℝ] (Fin t → ℝ) := + ((RationalTorus.basis t).baseChange ℝ).equivFun.toLinearMap.comp (φ.toLinearMap.baseChange ℝ) + +theorem torusPhaseLinear_tmul (φ : L →ₗ⁅ℚ⁆ RationalTorus.Algebra t) + (a : ℝ) (x : L) (i : Fin t) : + torusPhaseLinear φ (a ⊗ₜ[ℚ] x) i = a * (φ x i : ℝ) := by + change ((RationalTorus.basis t).baseChange ℝ).repr + (φ.toLinearMap.baseChange ℝ (a ⊗ₜ[ℚ] x)) i = _ + rw [LinearMap.baseChange_tmul, Module.Basis.baseChange_repr_tmul, RationalTorus.basis_repr] + simpa [Algebra.smul_def] using mul_comm (φ x i : ℝ) a + +variable (D : RationalFilteredNilmanifold L s d) (φ : L →ₗ⁅ℚ⁆ RationalTorus.Algebra t) + +theorem torusPhaseLinear_mul (g h : D.RealGroup) : + torusPhaseLinear φ (g * h).coord = torusPhaseLinear φ g.coord + torusPhaseLinear φ h.coord := by + let f := realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := (RationalTorus.nilmanifold t).filtration.lowerCentralSeries_eq_bot) φ + change ((RationalTorus.basis t).baseChange ℝ).equivFun (f (g * h)).coord = + ((RationalTorus.basis t).baseChange ℝ).equivFun (f g).coord + + ((RationalTorus.basis t).baseChange ℝ).equivFun (f h).coord + rw [f.map_mul, (RationalTorus.nilmanifold t).filtration.realification.stepOne_coord_mul, map_add] + +theorem torusPhaseLinear_inv (g : D.RealGroup) : + torusPhaseLinear φ g⁻¹.coord = -torusPhaseLinear φ g.coord := + (torusPhaseLinear φ).map_neg g.coord + +variable (hphase : ∀ z : D.filtration.Group, z ∈ D.lattice → IntegralVector (φ z.coord)) + +include hphase in +theorem torusPhase_lattice_map : + D.lattice ≤ (RationalTorus.nilmanifold t).lattice.comap + (mapOfSteps (hL := D.filtration.lowerCentralSeries_eq_bot) + (hM := (RationalTorus.nilmanifold t).filtration.lowerCentralSeries_eq_bot) φ) := by + intro z hz + exact hphase z hz + +noncomputable def nativeTorusProjection : D.Space → (Fin t → CircleFourier.Circle) := + (RationalTorus.phaseProjection t) ∘ + D.nativeSpaceMap (RationalTorus.nilmanifold t) φ (torusPhase_lattice_map D φ hphase) + +theorem nativeTorusProjection_mk (g : D.RealGroup) (i : Fin t) : + nativeTorusProjection D φ hphase (QuotientGroup.mk g) i = + (torusPhaseLinear φ g.coord i : CircleFourier.Circle) := rfl + +noncomputable def nativeTorusLocalLift : D.Space → (Fin t → ℝ) := + centeredTorusLift ∘ nativeTorusProjection D φ hphase + +theorem nativeTorusLocalLift_mk (g : D.RealGroup) + (hg : ∀ i, |torusPhaseLinear φ g.coord i| ≤ 1 / 4) : + nativeTorusLocalLift D φ hphase (QuotientGroup.mk g) = torusPhaseLinear φ g.coord := by + funext i + exact centeredCircleLift_coe (hg i) + +include hphase in +theorem torusPhaseLinear_eq_of_small (g h : D.RealGroup) + (hg : ∀ i, |torusPhaseLinear φ g.coord i| ≤ 1 / 4) + (hh : ∀ i, |torusPhaseLinear φ h.coord i| ≤ 1 / 4) + (heq : (QuotientGroup.mk g : D.Space) = QuotientGroup.mk h) : + torusPhaseLinear φ g.coord = torusPhaseLinear φ h.coord := by + rw [← nativeTorusLocalLift_mk D φ hphase g hg, ← nativeTorusLocalLift_mk D φ hphase h hh, heq] + +variable [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + +theorem nativeTorusProjection_lipschitz {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) + (ht : (t : ℝ) ≤ p) (hcoords : ∀ i j, rationalLogHeight (φ (D.basis j) i) ≤ p) : + letI := D.metricSpace + LipschitzWith ⟨Real.exp ((p + 3) ^ 2), (Real.exp_pos _).le⟩ + (nativeTorusProjection D φ hphase) := by + let := D.metricSpace + let := (RationalTorus.nilmanifold t).metricSpace + have hmap := D.nativeSpaceMap_lipschitz (RationalTorus.nilmanifold t) φ + (torusPhase_lattice_map D φ hphase) hp hD (RationalTorus.nilmanifold_geometry t hp ht) + (fun i j => by + change rationalLogHeight ((RationalTorus.basis t).repr (φ (D.basis j)) i) ≤ p + rw [RationalTorus.basis_repr] + exact hcoords i j) + have h : LipschitzWith ((1 : ℝ≥0) * ⟨Real.exp ((p + 3) ^ 2), (Real.exp_pos _).le⟩) + (nativeTorusProjection D φ hphase) := (RationalTorus.phaseProjection_lipschitz t).comp hmap + exact h.weaken (le_of_eq (_root_.one_mul + (⟨Real.exp ((p + 3) ^ 2), (Real.exp_pos _).le⟩ : ℝ≥0))) + +theorem nativeTorusLocalLift_lipschitzOn {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) + (ht : (t : ℝ) ≤ p) (hcoords : ∀ i j, rationalLogHeight (φ (D.basis j) i) ≤ p) : + letI := D.metricSpace + LipschitzOnWith ⟨Real.exp ((p + 3) ^ 2), (Real.exp_pos _).le⟩ + (nativeTorusLocalLift D φ hphase) + {x | ∀ i, ‖nativeTorusProjection D φ hphase x i‖ ≤ 1 / 4} := by + let := D.metricSpace + have hmap := nativeTorusProjection_lipschitz D φ hphase hp hD ht hcoords + apply LipschitzOnWith.of_dist_le_mul + intro x hx y hy + have h := centeredTorusLift_lipschitzOn.dist_le_mul + (nativeTorusProjection D φ hphase x) hx (nativeTorusProjection D φ hphase y) hy + simp only [NNReal.coe_one, _root_.one_mul] at h + exact h.trans (hmap.dist_le_mul x y) + +end Erdos3 + +end + +section + +namespace Erdos3.RationalTorus + +open scoped BigOperators TensorProduct NNReal + +variable {σ : Type*} [Fintype σ] (d : ℕ) + +noncomputable def affineOrbit (b : Fin d → ℝ) (a : σ → Fin d → ℝ) : + (nilmanifold d).filtration.realification.PolynomialOrbit (fun _ : σ => 1) := + (nilmanifold d).filtration.realification.affinePolynomialOrbit + (((basis d).baseChange ℝ).equivFun.symm b) + (fun j => ((basis d).baseChange ℝ).equivFun.symm (a j)) + +theorem affineOrbit_coordinates (b : Fin d → ℝ) (a : σ → Fin d → ℝ) (x : σ → ℤ) : + ((basis d).baseChange ℝ).equivFun + ((nilmanifold d).filtration.realification.polynomialOrbitEval (fun _ => 1) x + (affineOrbit d b a)).coord = + b + ∑ j, (x j : ℝ) • a j := by + unfold affineOrbit + rw [NilpotentLieFiltration.affinePolynomialOrbit_integer_coord, map_add, map_sum] + simp only [map_smul, LinearEquiv.apply_symm_apply] + +theorem affineOrbit_phases (b : Fin d → ℝ) (a : σ → Fin d → ℝ) (x : σ → ℤ) : + phaseCoordinates d + ((nilmanifold d).filtration.realification.polynomialOrbitEval (fun _ => 1) x + (affineOrbit d b a)) = + fun i => ((b + ∑ j, (x j : ℝ) • a j) i : CircleFourier.Circle) := by + change (fun i => (((basis d).baseChange ℝ).equivFun + ((nilmanifold d).filtration.realification.polynomialOrbitEval (fun _ => 1) x + (affineOrbit d b a)).coord i : CircleFourier.Circle)) = _ + rw [affineOrbit_coordinates] + +variable [TopologicalSpace (ℝ ⊗[ℚ] Algebra d)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] Algebra d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] Algebra d)] [T2Space (ℝ ⊗[ℚ] Algebra d)] + (b : Fin d → ℝ) (a : σ → Fin d → ℝ) + (Ψ : (Fin d → CircleFourier.Circle) → ℂ) (M K : ℝ≥0) + (hΨ : ∀ v, ‖Ψ v‖ ≤ M) (hLip : LipschitzWith K Ψ) + +noncomputable def affineNiltest : (nilmanifold d).Niltest (fun _ : σ => 1) where + orbit := affineOrbit d b a + observable := Ψ ∘ phaseProjection d + normBound := M + lipBound := K + norm_le x := hΨ (phaseProjection d x) + lipschitz := by + let := (nilmanifold d).metricSpace + simpa only [mul_one] using hLip.comp (phaseProjection_lipschitz d) + +theorem affineNiltest_eval (x : σ → ℤ) : + (affineNiltest d b a Ψ M K hΨ hLip).eval x = + Ψ (fun i => ((b + ∑ j, (x j : ℝ) • a j) i : CircleFourier.Circle)) := by + change Ψ (phaseCoordinates d + ((nilmanifold d).filtration.realification.polynomialOrbitEval (fun _ => 1) x + (affineOrbit d b a))) = _ + rw [affineOrbit_phases] + +theorem affineNiltest_evalCyclic (N : ℕ) [NeZero N] (x : σ → ZMod N) : + (affineNiltest d b a Ψ M K hΨ hLip).evalCyclic N x = + Ψ (fun i => ((b + ∑ j, ((x j).val : ℝ) • a j) i : CircleFourier.Circle)) := by + rw [RationalFilteredNilmanifold.Niltest.evalCyclic, affineNiltest_eval] + simp only [Int.cast_natCast] + +theorem affineNiltest_complexity {p : ℝ} (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) + (hbudget : Real.log (2 + (M : ℝ) + (K : ℝ)) ≤ p) : + (affineNiltest d b a Ψ M K hΨ hLip).ComplexityLE p := + ⟨nilmanifold_geometry d hp hd, hbudget⟩ + +end Erdos3.RationalTorus + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold CircleFourier +open scoped TensorProduct NNReal + +theorem exists_cyclic_character_niltest {N : ℕ} [NeZero N] (χ : AddChar (ZMod N) ℂ) : + ∃ T : (RationalTorus.nilmanifold 1).Niltest (fun _ : Unit => 1), + T.normBound ≤ 1 ∧ T.ComplexityLE 12 ∧ + ∀ x : ZMod N, T.evalCyclic N (fun _ => x) = χ x := by + obtain ⟨r, hr⟩ := AddChar.zmodAddEquiv.surjective χ + obtain ⟨theta, htheta⟩ := CyclicBohr.exists_real_frequency_phase r + have hphase (x : ZMod N) : + character (((x.val : ℝ) * theta : ℝ) : CircleFourier.Circle) = χ x := by + rw [htheta] + exact congrArg (fun ψ : AddChar (ZMod N) ℂ => ψ x) hr + let Ψ : (Fin 1 → CircleFourier.Circle) → ℂ := fun v => character (v 0) + have hΨ (v) : ‖Ψ v‖ ≤ (1 : ℝ≥0) := by + exact le_of_eq (norm_character (v 0)) + have hLip : LipschitzWith characterLipConstant Ψ := by + apply LipschitzWith.of_dist_le_mul + intro x y + exact (character_lipschitz.dist_le_mul (x 0) (y 0)).trans + (mul_le_mul_of_nonneg_left (dist_le_pi_dist x y 0) characterLipConstant.coe_nonneg) + let T := RationalTorus.affineNiltest 1 0 (fun _ : Unit => fun _ => theta) + Ψ 1 characterLipConstant hΨ hLip + have hT : T.ComplexityLE 12 := by + apply RationalTorus.affineNiltest_complexity 1 0 (fun _ : Unit => fun _ => theta) + Ψ 1 characterLipConstant hΨ hLip (by norm_num) (by norm_num) + change Real.log (2 + 1 + 2 * Real.pi) ≤ 12 + have hlog := Real.log_le_sub_one_of_pos (by positivity : 0 < 2 + 1 + 2 * Real.pi) + linarith [Real.pi_lt_four] + refine ⟨T, le_rfl, hT, ?_⟩ + intro x + simpa [T, Ψ, RationalTorus.affineNiltest_evalCyclic] using hphase x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct NNReal + +theorem torus_reindex_lipschitz {ι κ : Type*} [Fintype ι] [Fintype κ] (e : ι → κ) : + LipschitzWith 1 (fun v : κ → CircleFourier.Circle => fun i => v (e i)) := by + apply LipschitzWith.of_dist_le_mul + intro v w + rw [NNReal.coe_one, one_mul, dist_eq_norm] + apply (pi_norm_le_iff_of_nonneg dist_nonneg).mpr + intro i + change ‖v (e i) - w (e i)‖ ≤ dist v w + rw [← dist_eq_norm] + exact dist_le_pi_dist v w (e i) + +namespace RationalTorus + +variable {ι : Type*} [Fintype ι] {d : ℕ} (e : ι ≃ Fin d) + (Ψ : (ι → CircleFourier.Circle) → ℝ) + +noncomputable def reindexedRealObservable : (Fin d → CircleFourier.Circle) → ℂ := + fun v => (Ψ (fun i => v (e i)) : ℂ) + +omit [Fintype ι] in +theorem reindexedRealObservable_norm (hΨ : ∀ v, 0 ≤ Ψ v ∧ Ψ v ≤ 1) + (v : Fin d → CircleFourier.Circle) : ‖reindexedRealObservable e Ψ v‖ ≤ (1 : ℝ≥0) := by + change ‖(Ψ (fun i => v (e i)) : ℂ)‖ ≤ 1 + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hΨ _).1] + exact (hΨ _).2 + +theorem reindexedRealObservable_lipschitz {K : ℝ≥0} (hLip : LipschitzWith K Ψ) : + LipschitzWith K (reindexedRealObservable e Ψ) := by + change LipschitzWith K (fun v : Fin d → CircleFourier.Circle => (Ψ (fun i => v (e i)) : ℂ)) + simpa only [one_mul, mul_one, Function.comp_def] using + Complex.isometry_ofReal.lipschitzWith.comp (hLip.comp (torus_reindex_lipschitz e)) + +variable [TopologicalSpace (ℝ ⊗[ℚ] Algebra d)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] Algebra d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] Algebra d)] [T2Space (ℝ ⊗[ℚ] Algebra d)] + (b a : ι → ℝ) (K : ℝ≥0) + (hΨ : ∀ v, 0 ≤ Ψ v ∧ Ψ v ≤ 1) (hLip : LipschitzWith K Ψ) + +noncomputable def realAffineNiltest : (nilmanifold d).Niltest (fun _ : Unit => 1) := + affineNiltest d (fun i => b (e.symm i)) (fun _ : Unit => fun i => a (e.symm i)) + (reindexedRealObservable e Ψ) 1 K (reindexedRealObservable_norm e Ψ hΨ) + (reindexedRealObservable_lipschitz e Ψ hLip) + +theorem realAffineNiltest_unitInterval : + (realAffineNiltest e Ψ b a K hΨ hLip).UnitIntervalValued := by + intro z + change 0 = 0 ∧ 0 ≤ Ψ (fun i => phaseProjection d z (e i)) ∧ + Ψ (fun i => phaseProjection d z (e i)) ≤ 1 + exact ⟨rfl, hΨ _⟩ + +theorem realAffineNiltest_evalCyclic (N : ℕ) [NeZero N] (x : ZMod N) : + (realAffineNiltest e Ψ b a K hΨ hLip).evalCyclic N (fun _ => x) = + (Ψ (fun i => ((b i + (x.val : ℝ) * a i : ℝ) : CircleFourier.Circle)) : ℂ) := by + unfold realAffineNiltest + rw [affineNiltest_evalCyclic] + simp [reindexedRealObservable] + +theorem realAffineNiltest_complexity {p : ℝ} (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) + (hbudget : Real.log (3 + (K : ℝ)) ≤ p) : + (realAffineNiltest e Ψ b a K hΨ hLip).ComplexityLE p := by + apply affineNiltest_complexity _ _ _ _ _ _ _ _ hp hd + simpa only [NNReal.coe_one, show (2 : ℝ) + 1 = 3 by norm_num] using hbudget + +end RationalTorus +end Erdos3 + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped NNReal + +variable {N : ℕ} [NeZero N] + +noncomputable def approximationLipBound (B : Set N) (rho : ℝ≥0) : ℝ≥0 := + ((B.rank : ℝ≥0) * (B.approximationWidth rho)⁻¹) * CircleFourier.characterLipConstant + +noncomputable def approximationComplexity (B : Set N) (rho : ℝ≥0) : ℝ := + max (B.rank : ℝ) (Real.log (3 + (B.approximationLipBound rho : ℝ))) + +theorem approximationComplexity_nonneg (B : Set N) (rho : ℝ≥0) : + 0 ≤ B.approximationComplexity rho := + (Nat.cast_nonneg B.rank).trans (le_max_left _ _) + +theorem exists_upperApprox_niltest (B : Set N) (hB : 0 < B.radius) + (rho : ℝ≥0) (hrho : 0 < rho) (z : ZMod N) : + ∃ T : (RationalTorus.nilmanifold B.rank).Niltest (fun _ : Unit => 1), + T.UnitIntervalValued ∧ T.ComplexityLE (B.approximationComplexity rho) ∧ + ∀ x : ZMod N, T.evalCyclic N (fun _ => x) = (B.upperApprox rho (x - z) : ℂ) := by + obtain ⟨theta, htheta⟩ := B.exists_torus_approximation_orbit rho + have hΨ : ∀ v, 0 ≤ B.torusUpperApprox rho v ∧ B.torusUpperApprox rho v ≤ 1 := + fun v => (B.torus_approximation_ranges rho v).1 + have hLip : LipschitzWith (B.approximationLipBound rho) (B.torusUpperApprox rho) := + (B.torus_approximations_lipschitz hB rho hrho).1 + let e : B.frequencies ≃ Fin B.rank := B.frequencies.equivFin + let b : B.frequencies → ℝ := fun r => -(z.val : ℝ) * theta r + let T := RationalTorus.realAffineNiltest e (B.torusUpperApprox rho) b theta + (B.approximationLipBound rho) hΨ hLip + refine ⟨T, ?_, ?_, ?_⟩ + · exact RationalTorus.realAffineNiltest_unitInterval e (B.torusUpperApprox rho) b theta + (B.approximationLipBound rho) hΨ hLip + · exact RationalTorus.realAffineNiltest_complexity e (B.torusUpperApprox rho) b theta + (B.approximationLipBound rho) hΨ hLip (B.approximationComplexity_nonneg rho) + (le_max_left _ _) (le_max_right _ _) + · intro x + dsimp only [T] + rw [RationalTorus.realAffineNiltest_evalCyclic] + have hphase : (fun r => ((b r + (x.val : ℝ) * theta r : ℝ) : CircleFourier.Circle)) = + (fun r => ((((x.val : ℝ) - (z.val : ℝ)) * theta r : ℝ) : CircleFourier.Circle)) := by + funext r + congr 1 + dsimp [b] + ring + rw [hphase, (htheta x z).1] + +theorem exists_lowerApprox_niltest (B : Set N) (hB : 0 < B.radius) + (rho : ℝ≥0) (hrho : 0 < rho) (z : ZMod N) : + ∃ T : (RationalTorus.nilmanifold B.rank).Niltest (fun _ : Unit => 1), + T.UnitIntervalValued ∧ T.ComplexityLE (B.approximationComplexity rho) ∧ + ∀ x : ZMod N, T.evalCyclic N (fun _ => x) = (B.lowerApprox rho (x - z) : ℂ) := by + obtain ⟨theta, htheta⟩ := B.exists_torus_approximation_orbit rho + have hΨ : ∀ v, 0 ≤ B.torusLowerApprox rho v ∧ B.torusLowerApprox rho v ≤ 1 := + fun v => (B.torus_approximation_ranges rho v).2 + have hLip : LipschitzWith (B.approximationLipBound rho) (B.torusLowerApprox rho) := + (B.torus_approximations_lipschitz hB rho hrho).2 + let e : B.frequencies ≃ Fin B.rank := B.frequencies.equivFin + let b : B.frequencies → ℝ := fun r => -(z.val : ℝ) * theta r + let T := RationalTorus.realAffineNiltest e (B.torusLowerApprox rho) b theta + (B.approximationLipBound rho) hΨ hLip + refine ⟨T, ?_, ?_, ?_⟩ + · exact RationalTorus.realAffineNiltest_unitInterval e (B.torusLowerApprox rho) b theta + (B.approximationLipBound rho) hΨ hLip + · exact RationalTorus.realAffineNiltest_complexity e (B.torusLowerApprox rho) b theta + (B.approximationLipBound rho) hΨ hLip (B.approximationComplexity_nonneg rho) + (le_max_left _ _) (le_max_right _ _) + · intro x + dsimp only [T] + rw [RationalTorus.realAffineNiltest_evalCyclic] + have hphase : (fun r => ((b r + (x.val : ℝ) * theta r : ℝ) : CircleFourier.Circle)) = + (fun r => ((((x.val : ℝ) - (z.val : ℝ)) * theta r : ℝ) : CircleFourier.Circle)) := by + funext r + congr 1 + dsimp [b] + ring + rw [hphase, (htheta x z).2] + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem upperApprox_comparison_of_niltests + (B : Set N) (hB : 0 < B.radius) (rho : ℝ≥0) (hrho : 0 < rho) + (f g : ZMod N → ℝ) {P epsilon : ℝ} + (hbudget : B.approximationComplexity rho ≤ P) + (hcompare : CyclicNiltestUpperComparison.{0} 1 N P epsilon f g) (z : ZMod N) : + (𝔼 x, B.upperApprox rho (x - z) * (f x - g x)) ≤ epsilon := by + obtain ⟨T, hunit, hT, hEval⟩ := B.exists_upperApprox_niltest hB rho hrho z + have h := hcompare (RationalTorus.nilmanifold B.rank) le_rfl T hunit (hT.mono hbudget) + simpa only [hEval, Complex.ofReal_re, mul_comm] using h + +theorem average_sub_le_of_niltest_comparison + (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) (rho : ℝ≥0) (hrho : 0 < rho) + (hsmall : rho ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (f g : ZMod N → ℝ) {W P epsilon : ℝ} (hW : 0 ≤ W) + (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, g x ≤ W) + (hbudget : B.approximationComplexity rho ≤ P) + (hcompare : CyclicNiltestUpperComparison.{0} 1 N P epsilon f g) (z : ZMod N) : + (𝔼 x ∈ B.carrier, (f (z + x) - g (z + x))) ≤ + (N : ℝ) / B.carrier.card * epsilon + W * (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) := + B.average_sub_le_of_upperApprox hBpos hB rho hrho hsmall f g hW hf hg z + (B.upperApprox_comparison_of_niltests hBpos rho hrho f g hbudget hcompare z) + +theorem sum_average_sub_le_of_niltest_comparison + (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) (rho : ℝ≥0) (hrho : 0 < rho) + (hsmall : rho ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (f g : ZMod N → ℝ) {W P epsilon : ℝ} (hW : 0 ≤ W) + (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, g x ≤ W) + (hbudget : B.approximationComplexity rho ≤ P) + (hcompare : CyclicNiltestUpperComparison.{0} 1 N P epsilon f g) (z : ZMod N) : + (𝔼 s ∈ B.carrier, 𝔼 t ∈ B.carrier, (f (z + s + t) - g (z + s + t))) ≤ + (N : ℝ) / B.carrier.card * epsilon + W * (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) := + B.sum_average_sub_le_of_upperApprox hBpos hB rho hrho hsmall f g hW hf hg + (B.upperApprox_comparison_of_niltests hBpos rho hrho f g hbudget hcompare) z + +theorem small_sum_average_of_niltest_comparison + (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) + (f g : ZMod N → ℝ) {W eta P epsilon : ℝ} (hW : 0 ≤ W) (heta : 0 < eta) + (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, g x ≤ W) + (hepsilon : epsilon ≤ (eta / 2) * ((B.carrier.card : ℝ) / N)) + (hbudget : B.approximationComplexity (localizedAverageScale B.rank W (eta / 2)) ≤ P) + (hcompare : CyclicNiltestUpperComparison.{0} 1 N P epsilon f g) (z : ZMod N) : + (𝔼 s ∈ B.carrier, 𝔼 t ∈ B.carrier, (f (z + s + t) - g (z + s + t))) ≤ eta := by + apply B.small_sum_average_of_upperApprox hBpos hB f g hW heta hf hg hepsilon + intro y + exact B.upperApprox_comparison_of_niltests hBpos _ + (localizedAverageScale_spec B.rank hW (by positivity)).1 f g hbudget hcompare y + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem coe_approximationLipBound (B : Set N) (rho : ℝ≥0) : + (B.approximationLipBound rho : ℝ) = + (B.rank : ℝ) / ((rho : ℝ) * B.radius) * (2 * Real.pi) := by + have hwidth : (B.approximationWidth rho : ℝ) = (rho : ℝ) * B.radius := rfl + unfold approximationLipBound + rw [NNReal.coe_mul, NNReal.coe_mul, NNReal.coe_natCast, NNReal.coe_inv, + hwidth, CircleFourier.coe_characterLipConstant, div_eq_mul_inv] + +theorem approximationComplexity_exp_le (B : Set N) (rho : ℝ≥0) {Q R : ℝ} + (hQ : 0 ≤ Q) (hR : 0 ≤ R) + (hrho : Real.exp (-Q) ≤ (rho : ℝ)) (hwidth : Real.exp (-R) ≤ B.radius) : + B.approximationComplexity rho ≤ (B.rank : ℝ) + Q + R + 12 := by + have hrhopos : 0 < (rho : ℝ) := (Real.exp_pos _).trans_le hrho + have hwpos : 0 < B.radius := (Real.exp_pos _).trans_le hwidth + have hprod : Real.exp (-(Q + R)) ≤ (rho : ℝ) * B.radius := by + calc + _ = Real.exp (-Q) * Real.exp (-R) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := mul_le_mul hrho hwidth (Real.exp_nonneg _) hrhopos.le + have hinv : ((rho : ℝ) * B.radius)⁻¹ ≤ Real.exp (Q + R) := by + have h := one_div_le_one_div_of_le (Real.exp_pos _) hprod + simpa only [one_div, Real.exp_neg, inv_inv] using h + have hrank : (B.rank : ℝ) ≤ Real.exp (B.rank : ℝ) := by + linarith [Real.add_one_le_exp (B.rank : ℝ)] + have hpi : 2 * Real.pi ≤ (8 : ℝ) := by linarith [Real.pi_lt_four] + have hK : (B.approximationLipBound rho : ℝ) ≤ + 8 * Real.exp ((B.rank : ℝ) + Q + R) := by + rw [coe_approximationLipBound, div_eq_mul_inv] + calc + _ ≤ Real.exp (B.rank : ℝ) * Real.exp (Q + R) * 8 := by gcongr + _ = _ := by rw [← Real.exp_add, ← add_assoc, mul_comm] + have hone : 1 ≤ Real.exp ((B.rank : ℝ) + Q + R) := + Real.one_le_exp (by positivity) + change max (B.rank : ℝ) (Real.log (3 + (B.approximationLipBound rho : ℝ))) ≤ _ + apply max_le + · linarith + · apply (Real.log_le_iff_le_exp (by positivity)).mpr + calc + _ ≤ 11 * Real.exp ((B.rank : ℝ) + Q + R) := by linarith + _ ≤ Real.exp 12 * Real.exp ((B.rank : ℝ) + Q + R) := by + apply mul_le_mul_of_nonneg_right _ (Real.exp_nonneg _) + linarith [Real.add_one_le_exp 12] + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem card_ratio_ge_exp_width (B : Set N) (hB1 : B.radius ≤ 1) {R : ℝ} + (hwidth : Real.exp (-R) ≤ B.radius) : + Real.exp (-((B.rank : ℝ) * (R + 10))) ≤ (B.carrier.card : ℝ) / N := by + have hB : 0 < B.radius := (Real.exp_pos _).trans_le hwidth + have hbase : Real.exp (-(R + 10)) ≤ B.radius / 10 := by + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 10)).mpr + calc + _ ≤ Real.exp (-(R + 10)) * Real.exp 10 := by + apply mul_le_mul_of_nonneg_left _ (Real.exp_nonneg _) + linarith [Real.add_one_le_exp 10] + _ = Real.exp (-R) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := hwidth + have hpower : Real.exp (-((B.rank : ℝ) * (R + 10))) ≤ (B.radius / 10) ^ B.rank := by + calc + _ = Real.exp (-(R + 10)) ^ B.rank := by rw [← Real.exp_nat_mul]; congr 1; ring + _ ≤ _ := pow_le_pow_left₀ (Real.exp_nonneg _) hbase _ + have hN : (0 : ℝ) < N := by exact_mod_cast NeZero.pos N + apply (le_div_iff₀ hN).mpr + exact (mul_le_mul_of_nonneg_right hpower hN.le).trans (card_lower_bound B hB hB1) + +theorem small_sum_average_of_exponential_niltest_comparison + (B : Set N) (hB : B.IsRankRegular) (hB1 : B.radius ≤ 1) + (f g : ZMod N → ℝ) {W A E R P : ℝ} + (hW : 0 ≤ W) (hA : 0 ≤ A) (hE : 0 ≤ E) (hR : 0 ≤ R) + (hWcap : W ≤ Real.exp A) (hwidth : Real.exp (-R) ≤ B.radius) + (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, g x ≤ W) + (hcomplexity : 2 * (B.rank : ℝ) + A + E + R + 1612 ≤ P) + (hprecision : E + 2 + (B.rank : ℝ) * (R + 10) ≤ P) + (hcompare : CyclicNiltestUpperComparison.{0} 1 N P (Real.exp (-P)) f g) (z : ZMod N) : + (𝔼 s ∈ B.carrier, 𝔼 t ∈ B.carrier, (f (z + s + t) - g (z + s + t))) ≤ Real.exp (-E) := by + have hBpos : 0 < B.radius := (Real.exp_pos _).trans_le hwidth + have hbudget : B.approximationComplexity + (localizedAverageScale B.rank W (Real.exp (-E) / 2)) ≤ P := by + have h := B.approximationComplexity_exp_le _ + (show 0 ≤ (B.rank : ℝ) + A + E + 1600 by positivity) hR + (localizedAverageScale_exp_lower B.rank hW hWcap hA hE) hwidth + exact h.trans (by linarith) + have hhalf : Real.exp (-(E + 2)) ≤ Real.exp (-E) / 2 := by + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + calc + _ ≤ Real.exp (-(E + 2)) * Real.exp 2 := by + apply mul_le_mul_of_nonneg_left _ (Real.exp_nonneg _) + linarith [Real.add_one_le_exp 2] + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have herror : Real.exp (-P) ≤ (Real.exp (-E) / 2) * ((B.carrier.card : ℝ) / N) := by + calc + _ ≤ Real.exp (-(E + 2 + (B.rank : ℝ) * (R + 10))) := + Real.exp_le_exp.mpr (neg_le_neg hprecision) + _ = Real.exp (-(E + 2)) * Real.exp (-((B.rank : ℝ) * (R + 10))) := by + rw [← Real.exp_add] + congr 1 + ring + _ ≤ _ := mul_le_mul hhalf (B.card_ratio_ge_exp_width hB1 hwidth) + (Real.exp_nonneg _) (by positivity) + exact B.small_sum_average_of_niltest_comparison hBpos hB f g hW (Real.exp_pos _) + hf hg herror hbudget hcompare z + +end Erdos3.CyclicBohr.Set + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BohrTorusApproximation.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BohrTorusApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..46be9f45d142f627d2b003e3cb474f8b2d69c58b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BohrTorusApproximation.lean @@ -0,0 +1,902 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteApproximationComparison +import OAI.Combinatorics.Progressions.Estimates.FiniteShellSum +import OAI.Combinatorics.Progressions.Estimates.LocalizedAverageScaleOrder +import OAI.Combinatorics.Progressions.Estimates.MonotoneRegularPoint +import OAI.Combinatorics.Progressions.Fourier.CyclicAffineCharacterPhase +import OAI.Combinatorics.Progressions.Geometry.ChordBoxCutoff +import OAI.Combinatorics.Progressions.Probability.MassConvolution + +namespace OAI + +section + +namespace Erdos3.CyclicBohr.Set + +open Finset +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +def ndilate (B : Set N) (t : ℝ≥0) : Set N := B.dilate t + +@[simp] theorem radius_ndilate (B : Set N) (t : ℝ≥0) : + (B.ndilate t).radius = t * B.radius := by simp [ndilate] + +@[simp] theorem rank_ndilate (B : Set N) (t : ℝ≥0) : + (B.ndilate t).rank = B.rank := rfl + +@[simp] theorem ndilate_one (B : Set N) : B.ndilate 1 = B := by simp [ndilate] + +@[simp] theorem ndilate_ndilate (B : Set N) (s t : ℝ≥0) : + (B.ndilate s).ndilate t = B.ndilate (t * s) := by simp [ndilate] + +theorem carrier_ndilate_mono {B : Set N} {s t : ℝ≥0} (hst : s ≤ t) : + (B.ndilate s).carrier ⊆ (B.ndilate t).carrier := + B.dilate_mono s.coe_nonneg (by exact_mod_cast hst) + +def IsRankRegular (B : Set N) : Prop := + let d : ℕ := 2 * max B.rank 1 + ∀ kappa : ℝ≥0, + kappa ≤ 1 / (100 * (d : ℝ≥0)) → + (1 - 100 * (d : ℝ) * (kappa : ℝ)) * (B.carrier.card : ℝ) ≤ + ((B.ndilate (1 - kappa)).carrier.card : ℝ) ∧ + ((B.ndilate (1 + kappa)).carrier.card : ℝ) ≤ + (1 + 100 * (d : ℝ) * (kappa : ℝ)) * (B.carrier.card : ℝ) + +theorem isRankRegular_ndilate_iff (B : Set N) (rho : ℝ≥0) : + (B.ndilate rho).IsRankRegular ↔ + let d : ℕ := 2 * max B.rank 1 + ∀ kappa : ℝ≥0, + kappa ≤ 1 / (100 * (d : ℝ≥0)) → + (1 - 100 * (d : ℝ) * (kappa : ℝ)) * + ((B.ndilate rho).carrier.card : ℝ) ≤ + ((B.ndilate ((1 - kappa) * rho)).carrier.card : ℝ) ∧ + ((B.ndilate ((1 + kappa) * rho)).carrier.card : ℝ) ≤ + (1 + 100 * (d : ℝ) * (kappa : ℝ)) * + ((B.ndilate rho).carrier.card : ℝ) := by + simp [IsRankRegular, mul_comm] + +theorem log_card_growth_lt_five_mul_rank (B : Set N) (hB : 0 < B.radius) : + Real.log ((B.ndilate (5 / 4)).carrier.card : ℝ) - + Real.log ((B.ndilate (1 / 4)).carrier.card : ℝ) < + 5 * (2 * max B.rank 1 : ℕ) := by + classical + let d : ℕ := 2 * max B.rank 1 + have hcard : (B.ndilate (5 / 4)).carrier.card ≤ + 9 ^ (3 * B.rank) * (B.ndilate (1 / 4)).carrier.card := by + calc + (B.ndilate (5 / 4)).carrier.card ≤ (B.ndilate 2).carrier.card := + Finset.card_le_card (carrier_ndilate_mono + (show (5 / 4 : NNReal) ≤ 2 by + rw [div_le_iff₀ (by norm_num : (0 : NNReal) < 4)] + norm_num)) + _ ≤ 9 ^ (3 * B.rank) * (B.ndilate (1 / 4)).carrier.card := + by simpa [ndilate] using card_two_le_nine_pow_three_rank_mul_card_quarter B hB + have hsmall_pos : (0 : ℝ) < (B.ndilate (1 / 4)).carrier.card := by + exact_mod_cast (B.ndilate (1 / 4)).carrier_nonempty.card_pos + have hlarge_pos : (0 : ℝ) < (B.ndilate (5 / 4)).carrier.card := by + exact_mod_cast (B.ndilate (5 / 4)).carrier_nonempty.card_pos + have hlog := Real.log_le_log hlarge_pos (show + ((B.ndilate (5 / 4)).carrier.card : ℝ) ≤ + ((9 ^ (3 * B.rank) * (B.ndilate (1 / 4)).carrier.card : ℕ) : ℝ) by + exact_mod_cast hcard) + rw [Nat.cast_mul, Nat.cast_pow, Real.log_mul (by positivity) hsmall_pos.ne', + Real.log_pow] at hlog + have hdpos : (0 : ℝ) < d := by + exact_mod_cast (show 0 < d by simp [d]) + have hlog9 : Real.log (9 : ℝ) < 10 / 3 := by + have h := Real.log_le_log (by norm_num : (0 : ℝ) < 9) + (by norm_num : (9 : ℝ) ≤ 2 ^ 4) + rw [Real.log_pow] at h + norm_num only [Nat.cast_ofNat] at h + linarith [Real.log_two_lt_d9] + have hmain : (3 * B.rank : ℕ) * Real.log (9 : ℝ) < 5 * d := by + have hpos : (0 : ℝ) < (max B.rank 1 : ℕ) := by positivity + have hrank : (B.rank : ℝ) ≤ (max B.rank 1 : ℕ) := by exact_mod_cast le_max_left B.rank 1 + push_cast + calc + 3 * (B.rank : ℝ) * Real.log 9 ≤ 3 * (max B.rank 1 : ℕ) * Real.log 9 := by gcongr + _ < 3 * (max B.rank 1 : ℕ) * (10 / 3) := by gcongr + _ = 5 * d := by dsimp [d]; push_cast; ring + dsimp [d] at hmain ⊢ + linarith + +noncomputable def normalizedLogCard (B : Set N) (s : ℝ) : ℝ := + Real.log ((B.ndilate s.toNNReal).carrier.card : ℝ) / + (2 * max B.rank 1 : ℕ) + +theorem normalizedLogCard_monotone (B : Set N) : + Monotone B.normalizedLogCard := by + intro s t hst + dsimp [normalizedLogCard] + apply div_le_div_of_nonneg_right _ (by positivity) + apply Real.log_le_log + · exact_mod_cast (B.ndilate s.toNNReal).carrier_nonempty.card_pos + · exact_mod_cast Finset.card_le_card + (carrier_ndilate_mono (B := B) (Real.toNNReal_mono hst)) + +theorem normalizedLogCard_buffer_growth (B : Set N) (hB : 0 < B.radius) : + B.normalizedLogCard (5 / 4) - B.normalizedLogCard (1 / 4) < 5 := by + classical + have h := log_card_growth_lt_five_mul_rank B hB + have hd : (0 : ℝ) < (2 * max B.rank 1 : ℕ) := by positivity + have h54 : Real.toNNReal (5 / 4 : ℝ) = (5 / 4 : NNReal) := by + apply NNReal.eq + rw [Real.coe_toNNReal _ (by norm_num)] + norm_num + have h14 : Real.toNNReal (1 / 4 : ℝ) = (1 / 4 : NNReal) := by + apply NNReal.eq + rw [Real.coe_toNNReal _ (by norm_num)] + norm_num + dsimp [normalizedLogCard] + rw [h54, h14] + rw [div_sub_div_same] + exact (div_lt_iff₀ hd).2 (by simpa [mul_comm] using h) + +theorem exists_rankRegular_ndilate (B : Set N) (hB : 0 < B.radius) : + ∃ rho : NNReal, 1 / 2 ≤ rho ∧ rho ≤ 1 ∧ + (B.ndilate rho).IsRankRegular := by + classical + let d : ℕ := 2 * max B.rank 1 + obtain ⟨r, hr, hlip⟩ := exists_regular_point_of_monotone + B.normalizedLogCard (normalizedLogCard_monotone B) + (normalizedLogCard_buffer_growth B hB) + let rho : NNReal := r.toNNReal + have hrho : (rho : ℝ) = r := Real.coe_toNNReal r (by linarith [hr.1]) + have hrho_half : (1 / 2 : NNReal) ≤ rho := by + rw [← NNReal.coe_le_coe, hrho] + norm_num + exact hr.1 + have hrho_one : rho ≤ 1 := by + rw [← NNReal.coe_le_coe, hrho] + norm_num + exact hr.2 + refine ⟨rho, hrho_half, hrho_one, ?_⟩ + rw [isRankRegular_ndilate_iff] + dsimp only [rank_ndilate] + intro kappa hkappa + have hdposN : 0 < d := by simp [d] + have hdpos : (0 : ℝ) < d := by exact_mod_cast hdposN + have hkappa_one : kappa ≤ 1 := by + apply hkappa.trans + rw [div_le_one] + · exact_mod_cast (show 1 ≤ 100 * d by omega) + · positivity + have hkappa_real : (kappa : ℝ) ≤ 1 / (100 * (d : ℝ)) := by + exact_mod_cast hkappa + let sminus : NNReal := (1 - kappa) * rho + let splus : NNReal := (1 + kappa) * rho + have hkreal : (kappa : ℝ) ≤ 1 / 100 := by + calc + (kappa : ℝ) ≤ 1 / (100 * (d : ℝ)) := hkappa_real + _ ≤ 1 / 100 := by + apply div_le_div_of_nonneg_left (by norm_num) (by norm_num) + have hd_one : (1 : ℝ) ≤ d := by + exact_mod_cast (show 1 ≤ d by dsimp [d]; omega) + nlinarith + have hrho_real : (1 / 2 : ℝ) ≤ rho ∧ (rho : ℝ) ≤ 1 := by + exact ⟨by exact_mod_cast hrho_half, by exact_mod_cast hrho_one⟩ + have hsminus_buf : (sminus : ℝ) ∈ _root_.Set.Icc (1 / 4 : ℝ) (5 / 4) := by + dsimp [sminus] + rw [NNReal.coe_sub hkappa_one] + simp only [NNReal.coe_one] + have hk_lower : (99 / 100 : ℝ) ≤ 1 - (kappa : ℝ) := by + nlinarith + constructor + · calc + (1 / 4 : ℝ) ≤ (99 / 100) * (1 / 2) := by norm_num + _ ≤ (1 - (kappa : ℝ)) * (rho : ℝ) := by + exact mul_le_mul hk_lower hrho_real.1 (by norm_num) + (sub_nonneg.mpr (by exact_mod_cast hkappa_one)) + · calc + (1 - (kappa : ℝ)) * (rho : ℝ) ≤ 1 * rho := + mul_le_mul_of_nonneg_right (sub_le_self 1 (by positivity)) (by positivity) + _ ≤ 1 * 1 := mul_le_mul_of_nonneg_left hrho_real.2 (by norm_num) + _ ≤ 5 / 4 := by norm_num + have hsplus_buf : (splus : ℝ) ∈ _root_.Set.Icc (1 / 4 : ℝ) (5 / 4) := by + dsimp [splus] + constructor <;> nlinarith + have hdistminus : |(sminus : ℝ) - r| ≤ (kappa : ℝ) := by + rw [← hrho] + dsimp [sminus] + rw [NNReal.coe_sub hkappa_one] + simp only [NNReal.coe_one] + have hrnonneg : (0 : ℝ) ≤ rho := by positivity + rw [show (1 - (kappa : ℝ)) * (rho : ℝ) - rho = -(kappa * rho) by ring, + abs_neg, abs_of_nonneg (mul_nonneg (by positivity) hrnonneg)] + nlinarith [hrho_real.2] + have hdistplus : |(splus : ℝ) - r| ≤ (kappa : ℝ) := by + rw [← hrho] + dsimp [splus] + have hrnonneg : (0 : ℝ) ≤ rho := by positivity + rw [show (1 + (kappa : ℝ)) * (rho : ℝ) - rho = kappa * rho by ring, + abs_of_nonneg (mul_nonneg (by positivity) hrnonneg)] + nlinarith [hrho_real.2] + have hlipminus := hlip (sminus : ℝ) hsminus_buf + have hlipplus := hlip (splus : ℝ) hsplus_buf + simp only [normalizedLogCard, Real.toNNReal_coe, + show r.toNNReal = rho by rfl] at hlipminus hlipplus + change + |Real.log ((B.ndilate sminus).carrier.card : ℝ) / d - + Real.log ((B.ndilate rho).carrier.card : ℝ) / d| ≤ + 60 * |(sminus : ℝ) - r| at hlipminus + change + |Real.log ((B.ndilate splus).carrier.card : ℝ) / d - + Real.log ((B.ndilate rho).carrier.card : ℝ) / d| ≤ + 60 * |(splus : ℝ) - r| at hlipplus + rw [div_sub_div_same, abs_div, abs_of_pos hdpos] at hlipminus hlipplus + have hlogminus : + Real.log ((B.ndilate rho).carrier.card : ℝ) - + Real.log ((B.ndilate sminus).carrier.card : ℝ) ≤ + 60 * d * (kappa : ℝ) := by + have habs := (div_le_iff₀ hdpos).mp hlipminus + calc + _ ≤ |Real.log ((B.ndilate sminus).carrier.card : ℝ) - + Real.log ((B.ndilate rho).carrier.card : ℝ)| := by + rw [abs_sub_comm] + exact le_abs_self _ + _ ≤ 60 * |(sminus : ℝ) - r| * d := habs + _ ≤ 60 * (kappa : ℝ) * d := by gcongr + _ = 60 * d * (kappa : ℝ) := by ring + have hlogplus : + Real.log ((B.ndilate splus).carrier.card : ℝ) - + Real.log ((B.ndilate rho).carrier.card : ℝ) ≤ + 60 * d * (kappa : ℝ) := by + have habs := (div_le_iff₀ hdpos).mp hlipplus + calc + _ ≤ |Real.log ((B.ndilate splus).carrier.card : ℝ) - + Real.log ((B.ndilate rho).carrier.card : ℝ)| := le_abs_self _ + _ ≤ 60 * |(splus : ℝ) - r| * d := habs + _ ≤ 60 * (kappa : ℝ) * d := by gcongr + _ = 60 * d * (kappa : ℝ) := by ring + let u : ℝ := 100 * d * (kappa : ℝ) + have hu0 : 0 ≤ u := by dsimp [u]; positivity + have hu1 : u ≤ 1 := by + dsimp [u] + calc + 100 * (d : ℝ) * (kappa : ℝ) ≤ + 100 * d * (1 / (100 * d)) := by gcongr + _ = 1 := by field_simp + have hslope : 60 * d * (kappa : ℝ) = (3 / 5 : ℝ) * u := by + dsimp [u] + ring + constructor + · change (1 - u) * ((B.ndilate rho).carrier.card : ℝ) ≤ + ((B.ndilate sminus).carrier.card : ℝ) + by_cases hu : u = 1 + · rw [hu] + norm_num + · have hu_lt : u < 1 := lt_of_le_of_ne hu1 hu + have honeu : 0 < 1 - u := sub_pos.mpr hu_lt + have hcenter : (0 : ℝ) < (B.ndilate rho).carrier.card := by + exact_mod_cast (B.ndilate rho).carrier_nonempty.card_pos + have hinner : (0 : ℝ) < (B.ndilate sminus).carrier.card := by + exact_mod_cast (B.ndilate sminus).carrier_nonempty.card_pos + rw [← Real.log_le_log_iff (mul_pos honeu hcenter) hinner] + rw [Real.log_mul (sub_ne_zero.mpr (Ne.symm hu)) hcenter.ne'] + have hlogone := Real.log_le_sub_one_of_pos honeu + rw [hslope] at hlogminus + nlinarith + · change ((B.ndilate splus).carrier.card : ℝ) ≤ + (1 + u) * ((B.ndilate rho).carrier.card : ℝ) + have hcenter : (0 : ℝ) < (B.ndilate rho).carrier.card := by + exact_mod_cast (B.ndilate rho).carrier_nonempty.card_pos + have houter : (0 : ℝ) < (B.ndilate splus).carrier.card := by + exact_mod_cast (B.ndilate splus).carrier_nonempty.card_pos + rw [← Real.log_le_log_iff houter (mul_pos (by linarith) hcenter)] + rw [Real.log_mul (by linarith) hcenter.ne'] + have hlogone := Real.le_log_one_add_of_nonneg hu0 + have hfrac : (3 / 5 : ℝ) * u ≤ 2 * u / (u + 2) := by + rw [le_div_iff₀ (by linarith)] + nlinarith + rw [hslope] at hlogplus + linarith + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +variable {ι : Type*} [Fintype ι] + +noncomputable def torusChordCutoff (a : ℝ) (h : ℝ≥0) (v : ι → CircleFourier.Circle) : ℝ := + chordBoxCutoff a h (fun i => CircleFourier.character (v i)) + +theorem torusChordCutoff_range (a : ℝ) (h : ℝ≥0) (v : ι → CircleFourier.Circle) : + 0 ≤ torusChordCutoff a h v ∧ torusChordCutoff a h v ≤ 1 := chordBoxCutoff_range _ _ _ + +theorem torus_character_map_lipschitz : + LipschitzWith CircleFourier.characterLipConstant + (fun v : ι → CircleFourier.Circle => fun i => CircleFourier.character (v i)) := by + apply LipschitzWith.of_dist_le_mul + intro v w + rw [dist_eq_norm] + change ‖(fun i => CircleFourier.character (v i)) - (fun i => CircleFourier.character (w i))‖ ≤ + (2 * Real.pi) * dist v w + apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr + intro i + change ‖CircleFourier.character (v i) - CircleFourier.character (w i)‖ ≤ _ + have h : ‖CircleFourier.character (v i) - CircleFourier.character (w i)‖ ≤ + (2 * Real.pi) * dist (v i) (w i) := by + simpa only [dist_eq_norm, CircleFourier.coe_characterLipConstant] using + CircleFourier.character_lipschitz.dist_le_mul (v i) (w i) + exact h.trans (mul_le_mul_of_nonneg_left (dist_le_pi_dist v w i) + (show 0 ≤ 2 * Real.pi by positivity)) + +theorem torusChordCutoff_lipschitz (a : ℝ) (h : ℝ≥0) (hh : 0 < h) : + LipschitzWith (((Fintype.card ι : ℝ≥0) * h⁻¹) * CircleFourier.characterLipConstant) + (torusChordCutoff (ι := ι) a h) := + (chordBoxCutoff_lipschitz a h hh).comp torus_character_map_lipschitz + +end Erdos3 + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +noncomputable def approximationWidth (B : Set N) (rho : ℝ≥0) : ℝ≥0 := + rho * ⟨B.radius, B.radius_nonneg⟩ + +theorem approximationWidth_pos (B : Set N) (hB : 0 < B.radius) (rho : ℝ≥0) (hrho : 0 < rho) : + 0 < B.approximationWidth rho := mul_pos hrho hB + +noncomputable def upperApprox (B : Set N) (rho : ℝ≥0) (x : ZMod N) : ℝ := + chordBoxCutoff B.radius (B.approximationWidth rho) (fun r : B.frequencies => character r x) + +noncomputable def lowerApprox (B : Set N) (rho : ℝ≥0) (x : ZMod N) : ℝ := + chordBoxCutoff (B.radius - (rho : ℝ) * B.radius) (B.approximationWidth rho) + (fun r : B.frequencies => character r x) + +theorem upperApprox_range (B : Set N) (rho : ℝ≥0) (x : ZMod N) : + 0 ≤ B.upperApprox rho x ∧ B.upperApprox rho x ≤ 1 := chordBoxCutoff_range _ _ _ + +theorem lowerApprox_range (B : Set N) (rho : ℝ≥0) (x : ZMod N) : + 0 ≤ B.lowerApprox rho x ∧ B.lowerApprox rho x ≤ 1 := chordBoxCutoff_range _ _ _ + +theorem lowerApprox_le_upperApprox (B : Set N) (rho : ℝ≥0) (x : ZMod N) : + B.lowerApprox rho x ≤ B.upperApprox rho x := by + exact chordBoxCutoff_mono_center (by nlinarith [rho.coe_nonneg, B.radius_nonneg]) _ _ + +theorem upperApprox_eq_one (B : Set N) (hB : 0 < B.radius) (rho : ℝ≥0) (hrho : 0 < rho) + {x : ZMod N} (hx : x ∈ B.carrier) : B.upperApprox rho x = 1 := by + apply chordBoxCutoff_eq_one _ _ (B.approximationWidth_pos hB rho hrho) + intro r + exact (mem_carrier.mp hx) r r.property + +theorem lowerApprox_eq_zero (B : Set N) (rho : ℝ≥0) {x : ZMod N} (hx : x ∉ B.carrier) : + B.lowerApprox rho x = 0 := by + rw [mem_carrier] at hx + push Not at hx + obtain ⟨r, hr, hbad⟩ := hx + apply chordBoxCutoff_eq_zero + refine ⟨⟨r, hr⟩, ?_⟩ + change B.radius - (rho : ℝ) * B.radius + (rho : ℝ) * B.radius ≤ ‖1 - character r x‖ + linarith + +theorem lowerApprox_eq_one_inner (B : Set N) (hB : 0 < B.radius) (rho : ℝ≥0) + (hrho : 0 < rho) (hrho1 : rho ≤ 1) {x : ZMod N} (hx : x ∈ (B.ndilate (1 - rho)).carrier) : + B.lowerApprox rho x = 1 := by + apply chordBoxCutoff_eq_one _ _ (B.approximationWidth_pos hB rho hrho) + intro r + have h := (mem_carrier.mp hx) r r.property + rw [radius_ndilate, NNReal.coe_sub hrho1, NNReal.coe_one] at h + change ‖1 - character r x‖ ≤ B.radius - (rho : ℝ) * B.radius + nlinarith + +theorem upperApprox_eq_zero_outer (B : Set N) (rho : ℝ≥0) {x : ZMod N} + (hx : x ∉ (B.ndilate (1 + rho)).carrier) : B.upperApprox rho x = 0 := by + rw [mem_carrier] at hx + push Not at hx + obtain ⟨r, hr, hbad⟩ := hx + apply chordBoxCutoff_eq_zero + refine ⟨⟨r, hr⟩, ?_⟩ + rw [radius_ndilate, NNReal.coe_add, NNReal.coe_one] at hbad + change B.radius + (rho : ℝ) * B.radius ≤ ‖1 - character r x‖ + nlinarith + +theorem approximation_sandwich (B : Set N) (hB : 0 < B.radius) (rho : ℝ≥0) (hrho : 0 < rho) + (x : ZMod N) : + B.lowerApprox rho x ≤ (if x ∈ B.carrier then (1 : ℝ) else 0) ∧ + (if x ∈ B.carrier then (1 : ℝ) else 0) ≤ B.upperApprox rho x := by + by_cases hx : x ∈ B.carrier + · simp only [hx, ite_true] + exact ⟨(B.lowerApprox_range rho x).2, (B.upperApprox_eq_one hB rho hrho hx).ge⟩ + · simp only [hx, ite_false] + exact ⟨(B.lowerApprox_eq_zero rho hx).le, (B.upperApprox_range rho x).1⟩ + +theorem approximation_gap_le_shell (B : Set N) (hB : 0 < B.radius) (rho : ℝ≥0) + (hrho : 0 < rho) (hrho1 : rho ≤ 1) (x : ZMod N) : + B.upperApprox rho x - B.lowerApprox rho x ≤ + (if x ∈ (B.ndilate (1 + rho)).carrier then (1 : ℝ) else 0) - + (if x ∈ (B.ndilate (1 - rho)).carrier then (1 : ℝ) else 0) := by + by_cases hi : x ∈ (B.ndilate (1 - rho)).carrier + · have ho : x ∈ (B.ndilate (1 + rho)).carrier := + carrier_ndilate_mono ((tsub_le_self : 1 - rho ≤ (1 : ℝ≥0)).trans le_self_add) hi + simp only [hi, ho, ite_true] + rw [B.lowerApprox_eq_one_inner hB rho hrho hrho1 hi] + linarith [(B.upperApprox_range rho x).2] + · simp only [hi, ite_false, sub_zero] + by_cases ho : x ∈ (B.ndilate (1 + rho)).carrier + · simp only [ho, ite_true] + linarith [(B.upperApprox_range rho x).2, (B.lowerApprox_range rho x).1] + · simp only [ho, ite_false] + rw [B.upperApprox_eq_zero_outer rho ho] + linarith [(B.lowerApprox_range rho x).1] + +theorem approximation_observables_lipschitz (B : Set N) (hB : 0 < B.radius) + (rho : ℝ≥0) (hrho : 0 < rho) : + LipschitzWith (B.rank * (B.approximationWidth rho)⁻¹) + (chordBoxCutoff (ι := B.frequencies) B.radius (B.approximationWidth rho)) ∧ + LipschitzWith (B.rank * (B.approximationWidth rho)⁻¹) + (chordBoxCutoff (ι := B.frequencies) (B.radius - (rho : ℝ) * B.radius) (B.approximationWidth rho)) := by + constructor <;> simpa only [rank, Fintype.card_coe] using + chordBoxCutoff_lipschitz (ι := B.frequencies) _ _ (B.approximationWidth_pos hB rho hrho) + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem add_mem_ndilate {B : Set N} {r s : ℝ≥0} {x y : ZMod N} + (hx : x ∈ B.ndilate r) (hy : y ∈ B.ndilate s) : + x + y ∈ B.ndilate (r + s) := by + simpa only [ndilate, NNReal.coe_add] using add_mem_dilate r.coe_nonneg s.coe_nonneg hx hy + +theorem sub_mem_ndilate {B : Set N} {r s : ℝ≥0} {x y : ZMod N} + (hx : x ∈ B.ndilate r) (hy : y ∈ B.ndilate s) : + x - y ∈ B.ndilate (r + s) := by + simpa only [ndilate, NNReal.coe_add] using sub_mem_dilate r.coe_nonneg s.coe_nonneg hx hy + +theorem uniformMass_translation_le_shell (B : Set N) {kappa : ℝ≥0} + (hkappa : kappa ≤ 1) {t : ZMod N} (ht : t ∈ B.ndilate kappa) : + ∑ x : ZMod N, |realUniformMass B.carrier (x - t) - realUniformMass B.carrier x| ≤ + (((B.ndilate (1 + kappa)).carrier.card : ℝ) - (B.ndilate (1 - kappa)).carrier.card) / + B.carrier.card := by + apply Erdos3.uniformMass_translation_le_shell + · intro x hx + constructor + · have h := carrier_ndilate_mono (B := B) (show 1 - kappa ≤ 1 from tsub_le_self) hx + simpa only [ndilate_one] using h + · have h := sub_mem_ndilate (B := B) hx ht + simpa only [tsub_add_cancel_of_le hkappa, ndilate_one, mem_iff, mem_carrier] using h + · intro x hx + rcases hx with hx | hx + · have h := carrier_ndilate_mono (B := B) (show (1 : ℝ≥0) ≤ 1 + kappa from le_self_add) + apply h + simpa only [ndilate_one] using hx + · have h := add_mem_ndilate (B := B) (r := 1) (s := kappa) + (x := x - t) (y := t) (by simpa only [ndilate_one, mem_iff, mem_carrier] using hx) ht + simpa only [sub_add_cancel, mem_iff, mem_carrier] using h + +theorem uniformMass_translation_le_of_rankRegular {B : Set N} (hreg : B.IsRankRegular) + {kappa : ℝ≥0} (hkappa : kappa ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + {t : ZMod N} (ht : t ∈ B.ndilate kappa) : + ∑ x : ZMod N, |realUniformMass B.carrier (x - t) - realUniformMass B.carrier x| ≤ + 400 * ((max B.rank 1 : ℕ) : ℝ) * (kappa : ℝ) := by + have hkappa_one : kappa ≤ 1 := by + apply hkappa.trans + rw [div_le_one] + · exact_mod_cast (show 1 ≤ 100 * (2 * max B.rank 1) by omega) + · positivity + have hcards := hreg kappa hkappa + have hcenter : (0 : ℝ) < B.carrier.card := by exact_mod_cast B.card_pos + apply (uniformMass_translation_le_shell B hkappa_one ht).trans + rw [div_le_iff₀ hcenter] + push_cast at hcards ⊢ + nlinarith [hcards.1, hcards.2] + +theorem exists_regular_dilate_with_translation_bound (B : Set N) (hB : 0 < B.radius) : + ∃ rho : ℝ≥0, 1 / 2 ≤ rho ∧ rho ≤ 1 ∧ (B.ndilate rho).IsRankRegular ∧ + ∀ kappa : ℝ≥0, kappa ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0) → + ∀ t ∈ (B.ndilate rho).ndilate kappa, + ∑ x : ZMod N, + |realUniformMass (B.ndilate rho).carrier (x - t) - realUniformMass (B.ndilate rho).carrier x| ≤ + 400 * ((max B.rank 1 : ℕ) : ℝ) * (kappa : ℝ) := by + obtain ⟨rho, hrho0, hrho1, hreg⟩ := exists_rankRegular_ndilate B hB + refine ⟨rho, hrho0, hrho1, hreg, ?_⟩ + intro kappa hkappa t ht + simpa only [rank_ndilate] using uniformMass_translation_le_of_rankRegular hreg hkappa ht + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem sum_approximation_gap_le (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) + (rho : ℝ≥0) (hrho : 0 < rho) + (hsmall : rho ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) : + (∑ x, (B.upperApprox rho x - B.lowerApprox rho x)) ≤ + (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) * B.carrier.card := by + have hrho1 : rho ≤ 1 := by + apply hsmall.trans + rw [div_le_one (by positivity)] + exact_mod_cast (show 1 ≤ 100 * (2 * max B.rank 1) by omega) + have hsum : (∑ x, (B.upperApprox rho x - B.lowerApprox rho x)) ≤ + ((B.ndilate (1 + rho)).carrier.card : ℝ) - (B.ndilate (1 - rho)).carrier.card := by + calc + _ ≤ ∑ x, ((if x ∈ (B.ndilate (1 + rho)).carrier then (1 : ℝ) else 0) - + (if x ∈ (B.ndilate (1 - rho)).carrier then (1 : ℝ) else 0)) := + Finset.sum_le_sum (fun x _ => B.approximation_gap_le_shell hBpos rho hrho hrho1 x) + _ = _ := by + simp only [Finset.sum_sub_distrib, Finset.sum_ite_mem, Finset.univ_inter, + Finset.sum_const, nsmul_eq_mul, mul_one] + have hcards := hB rho hsmall + push_cast at hcards ⊢ + nlinarith [hcards.1, hcards.2] + +theorem mean_approximation_gap_le (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) + (rho : ℝ≥0) (hrho : 0 < rho) + (hsmall : rho ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) : + (𝔼 x, (B.upperApprox rho x - B.lowerApprox rho x)) ≤ + (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) * ((B.carrier.card : ℝ) / N) := by + rw [Fintype.expect_eq_sum_div_card] + have h := div_le_div_of_nonneg_right (B.sum_approximation_gap_le hBpos hB rho hrho hsmall) + (Nat.cast_nonneg (Fintype.card (ZMod N)) : (0 : ℝ) ≤ Fintype.card (ZMod N)) + simpa only [ZMod.card, mul_div_assoc] using h + +theorem mean_shifted_approximation_gap_le + (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) (rho : ℝ≥0) (hrho : 0 < rho) + (hsmall : rho ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) (z : ZMod N) : + (𝔼 x, (B.upperApprox rho (x - z) - B.lowerApprox rho (x - z))) ≤ + (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) * ((B.carrier.card : ℝ) / N) := by + have heq : (𝔼 x, (B.upperApprox rho x - B.lowerApprox rho x)) = + 𝔼 x, (B.upperApprox rho (x - z) - B.lowerApprox rho (x - z)) := by + apply Fintype.expect_equiv (Equiv.addRight z) + intro x + simp + rw [← heq] + exact B.mean_approximation_gap_le hBpos hB rho hrho hsmall + +theorem mean_indicator_approximation_error_le + (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) (rho : ℝ≥0) (hrho : 0 < rho) + (hsmall : rho ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) : + (𝔼 x, |(if x ∈ B.carrier then (1 : ℝ) else 0) - B.upperApprox rho x|) ≤ + (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) * ((B.carrier.card : ℝ) / N) ∧ + (𝔼 x, |(if x ∈ B.carrier then (1 : ℝ) else 0) - B.lowerApprox rho x|) ≤ + (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) * ((B.carrier.card : ℝ) / N) := by + have hgap := B.mean_approximation_gap_le hBpos hB rho hrho hsmall + constructor + · apply le_trans _ hgap + apply Finset.expect_le_expect + intro x _ + obtain ⟨hlo, hhi⟩ := B.approximation_sandwich hBpos rho hrho x + rw [abs_sub_comm, abs_of_nonneg (sub_nonneg.mpr hhi)] + linarith + · apply le_trans _ hgap + apply Finset.expect_le_expect + intro x _ + obtain ⟨hlo, hhi⟩ := B.approximation_sandwich hBpos rho hrho x + rw [abs_of_nonneg (sub_nonneg.mpr hlo)] + linarith + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.LocalConvolution + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem square_mean_le_local_add_boundary + (L : CyclicBohr.Set N) (hL : L.IsRankRegular) + (C : Finset (ZMod N)) (hC : C.Nonempty) {kappa : ℝ≥0} + (hCL : C ⊆ (L.ndilate kappa).carrier) + (hkappa : kappa ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (f : ZMod N → ℝ) (hsupport : ∀ x, x ∉ L.carrier → f x = 0) + {M : ℝ} (hf : ∀ x, 0 ≤ f x ∧ f x ≤ M) : + (∑ x, (𝔼 c ∈ C, f (x + c)) ^ 2) / L.carrier.card ≤ + (𝔼 x ∈ L.carrier, (𝔼 c ∈ C, f (x + c)) ^ 2) + + 200 * (max L.rank 1 : ℕ) * (kappa : ℝ) * M ^ 2 := by + let g : ZMod N → ℝ := fun x => 𝔼 c ∈ C, f (x + c) + let U := (L.ndilate (1 + kappa)).carrier + have hLc : (0 : ℝ) < L.carrier.card := by exact_mod_cast L.card_pos + have hg (x : ZMod N) : 0 ≤ g x ∧ g x ≤ M := by + constructor + · exact Finset.expect_nonneg (fun c _ => (hf (x + c)).1) + · exact (Finset.expect_le_expect (fun c (_ : c ∈ C) => (hf (x + c)).2)).trans_eq + (Finset.expect_const hC M) + have hgU : ∀ x, x ∉ U → g x = 0 := by + intro x hx + apply Finset.expect_eq_zero + intro c hc + apply hsupport + intro hxc + have h₁ : x + c ∈ L.ndilate (1 : ℝ≥0) := by + simpa only [CyclicBohr.Set.ndilate_one, CyclicBohr.Set.mem_iff, + CyclicBohr.Set.mem_carrier] using hxc + have h₂ := CyclicBohr.Set.sub_mem_ndilate h₁ (hCL hc) + exact hx (by simpa only [U, add_sub_cancel_right, CyclicBohr.Set.mem_iff, + CyclicBohr.Set.mem_carrier] using h₂) + have hLU : L.carrier ⊆ U := by + simpa only [CyclicBohr.Set.ndilate_one] using + CyclicBohr.Set.carrier_ndilate_mono (B := L) (show (1 : ℝ≥0) ≤ 1 + kappa from le_self_add) + have hshell : (U.card : ℝ) - L.carrier.card ≤ + (200 * (max L.rank 1 : ℕ) * (kappa : ℝ)) * L.carrier.card := by + have h := (hL kappa hkappa).2 + change ((L.ndilate (1 + kappa)).carrier.card : ℝ) - L.carrier.card ≤ _ + push_cast at h ⊢ + nlinarith + have hsum := sum_le_local_sum_add_shell L.carrier U hLU (fun x => g x ^ 2) + (fun x hx => by rw [hgU x hx]; norm_num) + (fun x => pow_le_pow_left₀ (hg x).1 (hg x).2 2) + have herror : M ^ 2 * (((U.card : ℝ) - L.carrier.card) / L.carrier.card) ≤ + 200 * (max L.rank 1 : ℕ) * (kappa : ℝ) * M ^ 2 := by + have h := mul_le_mul_of_nonneg_left ((div_le_iff₀ hLc).mpr hshell) (sq_nonneg M) + nlinarith + change (∑ x, g x ^ 2) / L.carrier.card ≤ + (𝔼 x ∈ L.carrier, g x ^ 2) + 200 * (max L.rank 1 : ℕ) * (kappa : ℝ) * M ^ 2 + calc + _ ≤ ((∑ x ∈ L.carrier, g x ^ 2) + M ^ 2 * ((U.card : ℝ) - L.carrier.card)) / + L.carrier.card := div_le_div_of_nonneg_right hsum hLc.le + _ = (𝔼 x ∈ L.carrier, g x ^ 2) + + M ^ 2 * (((U.card : ℝ) - L.carrier.card) / L.carrier.card) := by + rw [Finset.expect_eq_sum_div_card, add_div] + ring + _ ≤ _ := add_le_add le_rfl herror + +end Erdos3.LocalConvolution + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped NNReal + +variable {N : ℕ} [NeZero N] + +def whole : Set N := ofFrequencies {0} 1 (by norm_num) + +@[simp] theorem rank_whole : (whole : Set N).rank = 1 := by simp [whole] + +@[simp] theorem radius_whole : (whole : Set N).radius = 1 := rfl + +@[simp] theorem carrier_whole : (whole : Set N).carrier = Finset.univ := by + apply Finset.eq_univ_of_forall + intro x + simp [whole, mem_carrier, ofFrequencies] + +theorem exists_controlled_regular_subdilate (B : Set N) (hB : 0 < B.radius) + (r : ℝ≥0) (hr : 0 < r) (hr1 : r ≤ 1) : + ∃ C : Set N, C.frequencies = B.frequencies ∧ C.IsRankRegular ∧ + (r : ℝ) * B.radius / 2 ≤ C.radius ∧ C.radius ≤ r * B.radius ∧ + C.carrier ⊆ (B.ndilate r).carrier ∧ + ((r : ℝ) / 4) ^ (4 * B.rank) * (B.carrier.card : ℝ) ≤ C.carrier.card := by + have hrR : (0 : ℝ) < r := by exact_mod_cast hr + have hr1R : (r : ℝ) ≤ 1 := by exact_mod_cast hr1 + have hB0 : 0 < (B.ndilate r).radius := by + rw [radius_ndilate] + exact mul_pos hrR hB + obtain ⟨rho, hrho0, hrho1, hreg⟩ := exists_rankRegular_ndilate (B.ndilate r) hB0 + let C := (B.ndilate r).ndilate rho + have hrho0R : (1 / 2 : ℝ) ≤ rho := by exact_mod_cast hrho0 + have hrho1R : (rho : ℝ) ≤ 1 := by exact_mod_cast hrho1 + have hC : C.radius = (rho : ℝ) * ((r : ℝ) * B.radius) := by simp only [C, radius_ndilate] + refine ⟨C, rfl, hreg, ?_, ?_, ?_, ?_⟩ + · rw [hC] + nlinarith [mul_nonneg hrR.le hB.le] + · rw [hC] + nlinarith [mul_nonneg hrR.le hB.le] + · have h := carrier_ndilate_mono (B := B.ndilate r) hrho1 + simpa only [ndilate_one] using h + · have hprod : 0 < (rho : ℝ) * r := mul_pos (by linarith) hrR + have hprod1 : (rho : ℝ) * r ≤ 1 := by nlinarith + have hvol := relative_card_lower_bound B hB hprod hprod1 + have hlower : (r : ℝ) / 4 ≤ ((rho : ℝ) * r) / 2 := by nlinarith + have hcost := mul_le_mul_of_nonneg_right + (pow_le_pow_left₀ (show (0 : ℝ) ≤ r / 4 by positivity) hlower (4 * B.rank)) + (Nat.cast_nonneg B.carrier.card : (0 : ℝ) ≤ B.carrier.card) + have hfull := hcost.trans hvol + simpa only [C, ndilate, dilate_dilate] using hfull + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem average_sub_le_of_upperApprox + (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) (rho : ℝ≥0) (hrho : 0 < rho) + (hsmall : rho ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (f g : ZMod N → ℝ) {W epsilon : ℝ} (hW : 0 ≤ W) + (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, g x ≤ W) (z : ZMod N) + (hcompare : (𝔼 x, B.upperApprox rho (x - z) * (f x - g x)) ≤ epsilon) : + (𝔼 x ∈ B.carrier, (f (z + x) - g (z + x))) ≤ + (N : ℝ) / B.carrier.card * epsilon + W * (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) := by + have hmean : (𝔼 x, B.upperApprox rho x * (f (z + x) - g (z + x))) ≤ epsilon := by + calc + _ = 𝔼 x, B.upperApprox rho (x - z) * (f x - g x) := by + apply Fintype.expect_equiv (Equiv.addLeft z) + intro x + simp + _ ≤ epsilon := hcompare + have hgap : (𝔼 x, (B.upperApprox rho x - B.lowerApprox rho x)) ≤ + (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) * + ((B.carrier.card : ℝ) / Fintype.card (ZMod N)) := by + simpa only [ZMod.card] using B.mean_approximation_gap_le hBpos hB rho hrho hsmall + have h := local_average_le_of_approximation B.carrier B.carrier_nonempty + (fun x => f (z + x)) (fun x => g (z + x)) (B.lowerApprox rho) (B.upperApprox rho) + hW (fun x => hf (z + x)) (fun x => hg (z + x)) + (B.approximation_sandwich hBpos rho hrho) hmean hgap + simpa only [ZMod.card] using h + +theorem sum_average_sub_le_of_upperApprox + (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) (rho : ℝ≥0) (hrho : 0 < rho) + (hsmall : rho ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (f g : ZMod N → ℝ) {W epsilon : ℝ} (hW : 0 ≤ W) + (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, g x ≤ W) + (hcompare : ∀ z, (𝔼 x, B.upperApprox rho (x - z) * (f x - g x)) ≤ epsilon) + (z : ZMod N) : + (𝔼 s ∈ B.carrier, 𝔼 t ∈ B.carrier, (f (z + s + t) - g (z + s + t))) ≤ + (N : ℝ) / B.carrier.card * epsilon + W * (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) := by + have h := Finset.expect_le_expect (fun s (_ : s ∈ B.carrier) => + B.average_sub_le_of_upperApprox hBpos hB rho hrho hsmall f g hW hf hg (z + s) (hcompare (z + s))) + simpa only [Finset.expect_const B.carrier_nonempty] using h + +theorem small_sum_average_of_upperApprox + (B : Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) + (f g : ZMod N → ℝ) {W eta epsilon : ℝ} (hW : 0 ≤ W) (heta : 0 < eta) + (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, g x ≤ W) + (hepsilon : epsilon ≤ (eta / 2) * ((B.carrier.card : ℝ) / N)) : + let rho := localizedAverageScale B.rank W (eta / 2) + (∀ z, (𝔼 x, B.upperApprox rho (x - z) * (f x - g x)) ≤ epsilon) → + ∀ z, (𝔼 s ∈ B.carrier, 𝔼 t ∈ B.carrier, (f (z + s + t) - g (z + s + t))) ≤ eta := by + intro rho hcompare z + obtain ⟨hrho, hsmall, herror⟩ := localizedAverageScale_spec B.rank hW + (show 0 < eta / 2 by positivity) + change 0 < rho at hrho + change rho ≤ _ at hsmall + change W * (400 * (max B.rank 1 : ℕ) * (rho : ℝ)) ≤ eta / 2 at herror + have h := B.sum_average_sub_le_of_upperApprox hBpos hB rho hrho hsmall f g hW hf hg hcompare z + have hcard : (0 : ℝ) < B.carrier.card := by exact_mod_cast B.card_pos + have hN : (0 : ℝ) < N := by exact_mod_cast NeZero.pos N + have heps : (N : ℝ) / B.carrier.card * epsilon ≤ eta / 2 := by + calc + _ ≤ (N : ℝ) / B.carrier.card * ((eta / 2) * ((B.carrier.card : ℝ) / N)) := + mul_le_mul_of_nonneg_left hepsilon (by positivity) + _ = eta / 2 := by field_simp + linarith + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped NNReal + +variable {N : ℕ} [NeZero N] + +theorem carrier_eq_univ_of_rank_zero (B : Set N) (hB : B.rank = 0) : + B.carrier = Finset.univ := by + have hfreq : B.frequencies = ∅ := Finset.card_eq_zero.mp hB + apply Finset.eq_univ_of_forall + intro x + simp [mem_carrier, hfreq] + +@[simp] theorem carrier_ndilate_whole (t : ℝ≥0) : + ((whole : Set N).ndilate t).carrier = Finset.univ := by + apply Finset.eq_univ_of_forall + intro x + simp [mem_carrier, whole, ndilate, ofFrequencies, dilate] + +theorem isRankRegular_whole : (whole : Set N).IsRankRegular := by + intro kappa _ + simp only [rank_whole, max_self, Nat.mul_one, Nat.cast_ofNat, carrier_whole, + carrier_ndilate_whole] + have hcard : (0 : ℝ) ≤ (Finset.univ : Finset (ZMod N)).card := Nat.cast_nonneg _ + constructor <;> nlinarith [mul_nonneg kappa.coe_nonneg hcard] + +theorem exists_bounded_presentation (B : Set N) (hB : B.IsRankRegular) + (hBpos : 0 < B.radius) {d : ℕ} (hd : 1 ≤ d) (hrank : B.rank ≤ d) + {w : ℝ} (hw : w ≤ 1) (hwidth : w ≤ B.radius) : + ∃ C : Set N, C.carrier = B.carrier ∧ C.IsRankRegular ∧ + 0 < C.radius ∧ 1 ≤ C.rank ∧ C.rank ≤ d ∧ w ≤ C.radius ∧ C.radius ≤ 2 := by + by_cases hwhole : B.rank = 0 ∨ 2 ≤ B.radius + · have hcarrier : B.carrier = Finset.univ := hwhole.elim + (carrier_eq_univ_of_rank_zero B) (carrier_eq_univ_of_two_le_radius B) + refine ⟨whole, ?_, isRankRegular_whole, ?_, ?_, ?_, ?_, ?_⟩ + · rw [carrier_whole, hcarrier] + · norm_num + · norm_num + · simpa only [rank_whole] using hd + · simpa only [radius_whole] using hw + · norm_num + · push Not at hwhole + exact ⟨B, rfl, hB, hBpos, by omega, hrank, hwidth, hwhole.2.le⟩ + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +noncomputable def torusUpperApprox (B : Set N) (rho : ℝ≥0) : + (B.frequencies → CircleFourier.Circle) → ℝ := + torusChordCutoff B.radius (B.approximationWidth rho) + +noncomputable def torusLowerApprox (B : Set N) (rho : ℝ≥0) : + (B.frequencies → CircleFourier.Circle) → ℝ := + torusChordCutoff (B.radius - (rho : ℝ) * B.radius) (B.approximationWidth rho) + +theorem torus_approximation_ranges (B : Set N) (rho : ℝ≥0) (v : B.frequencies → CircleFourier.Circle) : + (0 ≤ B.torusUpperApprox rho v ∧ B.torusUpperApprox rho v ≤ 1) ∧ + (0 ≤ B.torusLowerApprox rho v ∧ B.torusLowerApprox rho v ≤ 1) := + ⟨torusChordCutoff_range _ _ _, torusChordCutoff_range _ _ _⟩ + +theorem torus_approximations_lipschitz (B : Set N) (hB : 0 < B.radius) + (rho : ℝ≥0) (hrho : 0 < rho) : + LipschitzWith (((B.rank : ℝ≥0) * (B.approximationWidth rho)⁻¹) * CircleFourier.characterLipConstant) + (B.torusUpperApprox rho) ∧ + LipschitzWith (((B.rank : ℝ≥0) * (B.approximationWidth rho)⁻¹) * CircleFourier.characterLipConstant) + (B.torusLowerApprox rho) := by + constructor <;> simpa only [rank, Fintype.card_coe, torusUpperApprox, torusLowerApprox] using + torusChordCutoff_lipschitz (ι := B.frequencies) _ _ (B.approximationWidth_pos hB rho hrho) + +theorem exists_torus_approximation_orbit (B : Set N) (rho : ℝ≥0) : + ∃ theta : B.frequencies → ℝ, ∀ x z : ZMod N, + B.torusUpperApprox rho + (fun r => ((((x.val : ℝ) - (z.val : ℝ)) * theta r : ℝ) : CircleFourier.Circle)) = + B.upperApprox rho (x - z) ∧ + B.torusLowerApprox rho + (fun r => ((((x.val : ℝ) - (z.val : ℝ)) * theta r : ℝ) : CircleFourier.Circle)) = + B.lowerApprox rho (x - z) := by + obtain ⟨theta, htheta⟩ := exists_real_frequency_phases B + refine ⟨theta, ?_⟩ + intro x z + have hcoords : + (fun r : B.frequencies => CircleFourier.character + ((((x.val : ℝ) - (z.val : ℝ)) * theta r : ℝ) : CircleFourier.Circle)) = + (fun r : B.frequencies => character r (x - z)) := funext (htheta x z) + constructor <;> simp only [torusUpperApprox, torusLowerApprox, torusChordCutoff, + upperApprox, lowerApprox, hcoords] + +end Erdos3.CyclicBohr.Set + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BooleanBlockMajorArc.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BooleanBlockMajorArc.lean new file mode 100644 index 0000000000000000000000000000000000000000..f785dabb5b94bdb3110cae36aed6557d5f9a27b9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BooleanBlockMajorArc.lean @@ -0,0 +1,45 @@ +import OAI.Combinatorics.Progressions.Estimates.StrideProductBounds + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem booleanBlockPhase_major_arc {n : ℕ} {α : Type*} [Fintype α] [DecidableEq α] + (N : Fin (n+1) → ℕ) (u : Fin (n+1) → Option α → ℝ) (ξ : Finset α → ℝ) + (J : Finset (Finset α)) (hJ : ∀ S ∈ J, S.card ≤ n+1) {ζ : ℝ} (hζ : 0 < ζ) + (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g) + (hbias : ζ ≤ ‖𝔼 x : ∀ g, Option α → Fin (N g), + character ((booleanBlockPhase ξ (fun g r => u g r+((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ (multiaffineBiasBudget n ζ)^J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S-(a S : ℝ)/D| ≤ + multiaffineBiasBudget n ζ / ∏ g, (N g : ℝ) := by + have h := exists_common_rational_approximations (fun S : J => ξ S) + (fun S => booleanBlockPhase_entry_approximation N u ξ S (hJ S S.property) hζ hN hbias) + simpa only [Fintype.card_coe] using h + +theorem booleanBlockPhase_minor_arc {n : ℕ} {α : Type*} [Fintype α] [DecidableEq α] + (N : Fin (n+1) → ℕ) (u : Fin (n+1) → Option α → ℝ) (ξ : Finset α → ℝ) + (J : Finset (Finset α)) (hJ : ∀ S ∈ J, S.card ≤ n+1) {ζ : ℝ} (hζ : 0 < ζ) + (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g) + (hminor : ∀ D : ℕ, 0 < D → (D : ℝ) ≤ (multiaffineBiasBudget n ζ)^J.card → + ∀ a : J → ℤ, ∃ S : J, multiaffineBiasBudget n ζ / ∏ g, (N g : ℝ) < + |ξ S-(a S : ℝ)/D|) : + ‖𝔼 x : ∀ g, Option α → Fin (N g), + character ((booleanBlockPhase ξ (fun g r => u g r+((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖ < ζ := by + by_contra h + obtain ⟨D,hD,hDQ,a,ha⟩ := booleanBlockPhase_major_arc N u ξ J hJ hζ hN (le_of_not_gt h) + obtain ⟨S,hS⟩ := hminor D hD hDQ a + exact (not_lt_of_ge (ha S)) hS + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BooleanCharacterReferenceError.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BooleanCharacterReferenceError.lean new file mode 100644 index 0000000000000000000000000000000000000000..c587741458c4bc0e985f21cce4024cc02e2dfb1f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BooleanCharacterReferenceError.lean @@ -0,0 +1,260 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedReferenceUniformError +import OAI.Combinatorics.Progressions.Fourier.NormalizedTwistSingleSiteFourierHaar +import OAI.Combinatorics.Progressions.Sampling.AllocatedGridlessProfileBound + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] (rows : ∀ j, O j → Finset α) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "quarter" => (fun j (_ : O j) => standardLatticeClosedQuarterBox (J j)) + +theorem allocatedCoveredProfileDensity_grid_fourier_error + (g : (JetAmbientIndex O J → UnitAddCircle) → ℝ) + (hvalue : ∀ w : JetAmbientIndex O J → ℝ, (∀ i, |w i| ≤ 1 / 4) → + g (fun i => (w i : UnitAddCircle)) = + allocatedNormalizedGridInterpolation B U b hR hσ S u rows + (allocatedGridAmbientCoordinates B U b S o w)) + (f : AllocatedLongJetRows B U b S O → ℝ) + {F : Type*} [Fintype F] (frequency : F → JetAmbientIndex O J → ℤ) (c : F → ℂ) + {δ C : ℝ} (hδ : 0 ≤ δ) + (happrox : ∀ z, ‖(g z : ℂ) - + ∑ a, c a * ∏ i, CircleFourier.character (frequency a i • z i)‖ ≤ δ) + (hcap : ∀ y, |allocatedGridlessCoveredProfile B U b S x u v rows hb o bW d f y| ≤ C) + (y : EuclideanJetLayers U O) : + ‖(allocatedCoveredProfileDensity B U b hR hσ S x u v rows hb o bW d quarter f y : ℂ) - + ∑ a, (c a * ∏ i, CircleFourier.character (frequency a i • coveredJetAmbientTorus U d y i)) * + (allocatedGridlessCoveredProfile B U b S x u v rows hb o bW d f y : ℂ)‖ ≤ δ * C := by + rw [allocatedCoveredProfileDensity_grid_factor B U b hR hσ S x u v rows hb o bW d g hvalue f] + simp only [Complex.ofReal_mul, ← Finset.sum_mul, ← sub_mul, norm_mul, + Complex.norm_real, Real.norm_eq_abs] + exact mul_le_mul (happrox _) (hcap y) (abs_nonneg _) hδ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (X : Type*) [Fintype X] +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (N : X → ℕ) {W τ ξ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) + +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] + +local notation "frozenTuple" => PrincipalAxisTuples (α := Fin dim) + (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) +local notation "label" => (PrincipalTupleIndex + (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B (Subtype.val a)) + (fun a => layerSamplerDegree I n (Subtype.val a)) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) + +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (rows : ∀ j, O j → Finset (Fin dim)) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "quarter" => (fun j (_ : O j) => standardLatticeClosedQuarterBox (J j)) + +theorem allocatedRefinedComplexReference_grid_fourier_error + (hτ : 0 < τ) (hξ : 0 < ξ) (hN : ∀ t, 0 < N t) (hq : ∀ t, 0 < q t) + (hH : ∀ t, 1 ≤ trimmedSpatialRootScale τ N q t) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) (hmesh : 0 < mesh) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection)) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) + (point : (X → (Unit ⊕ Fin dim) → ℤ) → EuclideanJetLayers U O) + (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) (htest : ∀ z, ‖test z‖ ≤ 1) + (g : frozenTuple → (JetAmbientIndex O J → UnitAddCircle) → ℝ) + (hvalue : ∀ u (w : JetAmbientIndex O J → ℝ), (∀ i, |w i| ≤ 1 / 4) → + g u (fun i => (w i : UnitAddCircle)) = + allocatedNormalizedGridInterpolation B U b hR hσ S u rows + (allocatedGridAmbientCoordinates B U b S o w)) + (f : frozenTuple → label → AllocatedLongJetRows B U b S O → ℝ) + {F : frozenTuple → Type*} [∀ u, Fintype (F u)] + (frequency : ∀ u, F u → JetAmbientIndex O J → ℤ) (c : ∀ u, F u → ℂ) + (site : frozenTuple → label → EuclideanJetLayers U O → ℂ) + (hsite : ∀ u r y, ‖site u r y‖ ≤ 1) + {δ C Z : ℝ} (hδ : 0 ≤ δ) (hC : 0 ≤ C) (hZ : 0 < Z) + (happrox : ∀ u z, ‖(g u z : ℂ) - + ∑ a, c u a * ∏ i, CircleFourier.character (frequency u a i • z i)‖ ≤ δ) + (hcap : ∀ u r y, + |allocatedGridlessCoveredProfile B U b S x u (reference u r) rows hb o bW d (f u r) y| ≤ C) : + ‖allocatedRefinedComplexReference (τ := τ) (ξ := ξ) + B U b S x X hM selection hx modulus q reference N hW mesh base cells point test Z + (fun u r y => (allocatedCoveredProfileDensity B U b hR hσ S x u (reference u r) + rows hb o bW d quarter (f u r) y : ℂ) * site u r y) - + allocatedRefinedComplexReference (τ := τ) (ξ := ξ) + B U b S x X hM selection hx modulus q reference N hW mesh base cells point test Z + (fun u r y => (∑ a, (c u a * ∏ i, + CircleFourier.character (frequency u a i • coveredJetAmbientTorus U d y i)) * + (allocatedGridlessCoveredProfile B U b S x u (reference u r) rows hb o bW d (f u r) y : ℂ)) * site u r y)‖ ≤ + (δ * C) * coefficientTailSpatialFactor X selection M modulus W S.value / Z := by + apply allocatedRefinedComplexReference_uniform_error + B U b S x X hM selection hx modulus q reference N hW mesh base cells + hτ hξ hN hq hH hbudget hmesh hperiod hmass point test htest + _ _ (mul_nonneg hδ hC) hZ + intro u r y + have he := allocatedCoveredProfileDensity_grid_fourier_error + B U b hR hσ S x u (reference u r) rows hb o bW d + (g u) (hvalue u) (f u r) (frequency u) (c u) hδ (happrox u) (hcap u r) y + rw [← sub_mul, norm_mul] + exact (mul_le_mul_of_nonneg_left (hsite u r y) (norm_nonneg _)).trans + (by simpa only [mul_one] using he) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (X : Type*) [Fintype X] +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (N : X → ℕ) {W τ ξ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet (Fin dim) ((j : ℕ) + 1)) +local notation "rows" => (fun j : Fin m => (Subtype.val : jets j → Finset (Fin dim))) +local notation "siteIndex" => JetAmbientIndex (fun _ : Fin m => Unit) J + +local notation "frozenTuple" => PrincipalAxisTuples (α := Fin dim) + (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) +local notation "label" => (PrincipalTupleIndex + (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B (Subtype.val a)) + (fun a => layerSamplerDegree I n (Subtype.val a)) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) + +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "quarter" => (fun j (_ : jets j) => standardLatticeClosedQuarterBox (J j)) + +theorem allocatedRefinedComplexReference_site_character_error + (hτ : 0 < τ) (hξ : 0 < ξ) (hN : ∀ t, 0 < N t) (hq : ∀ t, 0 < q t) + (hH : ∀ t, 1 ≤ trimmedSpatialRootScale τ N q t) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) (hmesh : 0 < mesh) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection)) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) + (point : (X → (Unit ⊕ Fin dim) → ℤ) → EuclideanJetLayers U jets) + (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) (htest : ∀ z, ‖test z‖ ≤ 1) + (g : frozenTuple → (JetAmbientIndex jets J → UnitAddCircle) → ℝ) + (hvalue : ∀ u (w : JetAmbientIndex jets J → ℝ), (∀ i, |w i| ≤ 1 / 4) → + g u (fun i => (w i : UnitAddCircle)) = + allocatedNormalizedGridInterpolation B U b hR hσ S u rows + (allocatedGridAmbientCoordinates B U b S o w)) + (f : frozenTuple → label → AllocatedLongJetRows B U b S jets → ℝ) + {F : frozenTuple → Type*} [∀ u, Fintype (F u)] + (frequency : ∀ u, F u → JetAmbientIndex jets J → ℤ) (c : ∀ u, F u → ℂ) + (gsite : Finset (Fin dim) → (siteIndex → UnitAddCircle) → ℂ) + (hsite : ∀ s z, ‖gsite s z‖ ≤ 1) + {δ C Z : ℝ} (hδ : 0 ≤ δ) (hC : 0 ≤ C) (hZ : 0 < Z) + (happrox : ∀ u z, ‖(g u z : ℂ) - + ∑ a, c u a * ∏ i, CircleFourier.character (frequency u a i • z i)‖ ≤ δ) + (hcap : ∀ u r y, + |allocatedGridlessCoveredProfile B U b S x u (reference u r) rows hb o bW d (f u r) y| ≤ C) : + ‖allocatedRefinedComplexReference (τ := τ) (ξ := ξ) + B U b S x X hM selection hx modulus q reference N hW mesh base cells point test Z + (fun u r y => (allocatedCoveredProfileDensity B U b hR hσ S x u (reference u r) + rows hb o bW d quarter (f u r) y : ℂ) * + ∏ s, gsite s (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s))) - + allocatedRefinedComplexReference (τ := τ) (ξ := ξ) + B U b S x X hM selection hx modulus q reference N hW mesh base cells point test Z + (fun u r y => ∑ a, c u a * + ((allocatedGridlessCoveredProfile B U b S x u (reference u r) rows hb o bW d (f u r) y : ℂ) * + ∏ s, booleanCharacterSiteFactor (frequency u a) gsite s + (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s))))‖ ≤ + (δ * C) * coefficientTailSpatialFactor X selection M modulus W S.value / Z := by + have hunit (y : EuclideanJetLayers U jets) : + ‖∏ s, gsite s (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s))‖ ≤ 1 := by + rw [norm_prod] + exact Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) (fun s _ => hsite s _) + have he := allocatedRefinedComplexReference_grid_fourier_error + B U b S x X hM selection hx modulus q reference N hW mesh base cells + hR hσ rows hb o bW d hτ hξ hN hq hH hbudget hmesh hperiod hmass point test htest + g hvalue f frequency c + (fun _ _ y => ∏ s, gsite s (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s))) + (fun _ _ y => hunit y) hδ hC hZ happrox hcap + simpa only [← booleanCharacterSiteFactor_expansion, ambientIntegerCharacter] using he + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BoundedFrequencyKernel.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BoundedFrequencyKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..6312163c1306e9a1875f63d611b869371a5b7d88 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BoundedFrequencyKernel.lean @@ -0,0 +1,159 @@ +import OAI.Combinatorics.Progressions.Estimates.BoundedSubmoduleIntersection +import OAI.Combinatorics.Progressions.Estimates.LinearCoefficientSplitting +import OAI.Combinatorics.Progressions.Fourier.PivotAnnihilatorFrequencyCode + +namespace OAI + +section + +namespace Erdos3 + +open Module CircleFourier +open scoped TensorProduct + +theorem realifyFunctional_zero {V : Type*} [AddCommGroup V] [Module ℚ V] + (x : ℝ ⊗[ℚ] V) : realifyFunctional (0 : V →ₗ[ℚ] ℚ) x = 0 := by + apply (mem_realified_frequency_kernel_iff (0 : V →ₗ[ℚ] ℚ) x).mp + rw [LinearMap.ker_zero, Submodule.baseChange_top] + trivial + +theorem exists_linear_frequency_splitting + {σ ι V : Type*} [Fintype σ] [DecidableEq σ] [AddCommGroup V] [Module ℚ V] + (b : Basis ι ℚ V) (η : V →ₗ[ℚ] ℚ) + {H : ℕ} (hH : 1 ≤ H) (hheight : ∀ i, RationalHeightLE (η (b i)) H) + (T : σ → ℕ) (hT : ∀ i, 0 < T i) (a : σ → ℝ ⊗[ℚ] V) + {δ : ℝ} (hδ : 0 < δ) + (hbias : δ ≤ ‖linearPhaseMean T (fun i => (realifyFunctional η (a i) : CircleFourier.Circle))‖) : + ∃ (m : ℕ) (e p r : σ → ℝ ⊗[ℚ] V), + 0 < m ∧ m ≤ H ∧ (∀ i, e i + p i + r i = a i) ∧ + (∀ i, realifyFunctional η (p i) = 0) ∧ + (∀ i j, |(b.baseChange ℝ).repr (e i) j| ≤ (H : ℝ) / (2 * T i * δ)) ∧ + (fun z : σ × ι => (b.baseChange ℝ).repr (r z.1) z.2) ∈ realDenominatorGrid m := by + by_cases hη : η = 0 + · subst η + refine ⟨1, 0, a, 0, Nat.zero_lt_one, hH, ?_, ?_, ?_, ?_⟩ + · intro i + simp + · intro i + exact realifyFunctional_zero (a i) + · intro i j + simp only [Pi.zero_apply, map_zero, Finsupp.zero_apply, abs_zero] + positivity + · refine ⟨0, ?_⟩ + ext z + simp + · exact exists_biased_linear_coefficient_splitting b η hη hH hheight T hT a hδ hbias + +theorem exists_bounded_frequency_kernel_spanning {ι V : Type*} [AddCommGroup V] [Module ℚ V] + (b : Basis ι ℚ V) (η : V →ₗ[ℚ] ℚ) + {H : ℕ} (hH : 1 ≤ H) (hheight : ∀ i, RationalHeightLE (η (b i)) H) : + ∃ v : ι → V, Submodule.span ℚ (Set.range v) = LinearMap.ker η ∧ + ∀ i j, RationalHeightLE (b.repr (v i) j) (2 * H ^ 2) := by + classical + by_cases hη : η = 0 + · subst η + refine ⟨b, ?_, ?_⟩ + · rw [LinearMap.ker_zero] + exact b.span_eq + · intro i j + have hh : 1 ≤ 2 * H ^ 2 := (one_le_pow₀ hH).trans (Nat.le_mul_of_pos_left _ (by decide : 0 < 2)) + rw [Basis.repr_self, Finsupp.single_apply] + split_ifs + · exact rationalHeightLE_one hh + · exact rationalHeightLE_zero hh + · obtain ⟨u, _, _, _, hu, huheight, _⟩ := exists_bounded_frequency_direction b η hη hH hheight + exact ⟨fun i => b i - η (b i) • u, frequencyKernel_spanning b η u hu, + frequencyKernel_spanning_height b η u hheight huheight⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped Classical + +theorem exists_frequency_kernel_basis_logHeight + {V : Type*} [AddCommGroup V] [Module ℚ V] {d D : ℕ} + (b : Basis (Fin d) ℚ V) (P : Submodule ℚ V) + (vP : Fin d → V) (hP : Submodule.span ℚ (Set.range vP) = P) + (eta : Fin D → V →ₗ[ℚ] ℚ) {p : ℝ} (hp : 0 ≤ p) + (hd : (d : ℝ) ≤ p) (hD : (D : ℝ) ≤ p) + (hvP : ∀ i j, rationalLogHeight (b.repr (vP i) j) ≤ p) + (heta : ∀ i j, rationalLogHeight (eta i (b j)) ≤ p) : + ∃ n : ℕ, n ≤ d ∧ + ∃ bk : Basis (Fin n) ℚ (finiteFrequencyKernel P eta (List.finRange D)), + ∀ i j, rationalLogHeight (b.repr (bk i : V) j) ≤ + ((2 * p + 6) ^ 2 + 2) ^ 63 := by + let H := ⌈Real.exp p⌉₊ + have hH : 1 ≤ H := one_le_ceil_exp p + have hHp : (H : ℝ) ≤ Real.exp (p + 1) := ceil_exp_le_exp_add_one hp + choose v hv hh using fun i => exists_bounded_frequency_kernel_spanning b (eta i) hH + (fun j => rationalHeightLE_ceil_exp (heta i j)) + let U : Option (Fin D) → Submodule ℚ V := fun z => z.elim P (fun i => LinearMap.ker (eta i)) + let gen : Option (Fin D) → Fin d → V := fun z => z.elim vP v + have hgen (z) : Submodule.span ℚ (Set.range (gen z)) = U z := by + cases z with + | none => exact hP + | some i => exact hv i + have hHmono : H ≤ 2 * H ^ 2 := by nlinarith + have hHe : ((2 * H ^ 2 : ℕ) : ℝ) ≤ Real.exp (2 * p + 4) := by + have h2 : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + calc + _ = 2 * (H : ℝ) ^ 2 := by push_cast; rfl + _ ≤ Real.exp 2 * (Real.exp (p + 1)) ^ 2 := by gcongr + _ = _ := by rw [← Real.exp_nat_mul, ← Real.exp_add]; congr 1; ring + have hheight (z) (i j) : rationalLogHeight (b.repr (gen z i) j) ≤ 2 * p + 4 := by + apply rationalLogHeight_le_of_height (H := 2 * H ^ 2) _ hHe + cases z with + | none => exact (rationalHeightLE_ceil_exp (hvP i j)).mono hHmono + | some k => exact hh k i j + have hcount : (Fintype.card (Option (Fin D)) : ℝ) ≤ 2 * p + 4 := by + simp only [Fintype.card_option, Fintype.card_fin, Nat.cast_add, Nat.cast_one] + linarith + obtain ⟨n, hn, bk, hbk⟩ := exists_submodule_intersection_basis_logHeight b U gen hgen + (by linarith : 0 ≤ 2 * p + 4) + (by simpa only [Fintype.card_fin] using (show (d : ℝ) ≤ 2 * p + 4 by linarith)) + (by simpa only [Fintype.card_fin] using (show (d : ℝ) ≤ 2 * p + 4 by linarith)) + hcount hheight + have hK : (⨅ z, U z) = finiteFrequencyKernel P eta (List.finRange D) := by + ext x + simp only [Submodule.mem_iInf, mem_finiteFrequencyKernel, List.mem_finRange, forall_true_left] + constructor + · intro h + exact ⟨h none, fun i => h (some i)⟩ + · intro h z + cases z with + | none => exact h.1 + | some i => exact h.2 i + refine ⟨n, by simpa only [Fintype.card_fin] using hn, + bk.map (LinearEquiv.ofEq _ _ hK), ?_⟩ + intro i j + simpa only [Basis.map_apply, LinearEquiv.coe_ofEq_apply, + show 2 * p + 4 + 2 = 2 * p + 6 by ring] using hbk i j + +theorem exists_frequency_code_kernel_basis_logHeight + {V J : Type*} [AddCommGroup V] [Module ℚ V] {d D : ℕ} + (b : Basis (Fin d) ℚ V) (P : Submodule ℚ V) + (vP : Fin d → V) (hP : Submodule.span ℚ (Set.range vP) = P) + (eta : J → V →ₗ[ℚ] ℚ) (code : Fin D → Option J) {p : ℝ} (hp : 0 ≤ p) + (hd : (d : ℝ) ≤ p) (hD : (D : ℝ) ≤ p) + (hvP : ∀ i j, rationalLogHeight (b.repr (vP i) j) ≤ p) + (heta : ∀ i j, rationalLogHeight (eta i (b j)) ≤ p) : + ∃ n : ℕ, n ≤ d ∧ ∃ bk : Basis (Fin n) ℚ (frequencyCodeKernel P eta code), + ∀ i j, rationalLogHeight (b.repr (bk i : V) j) ≤ ((2 * p + 6) ^ 2 + 2) ^ 63 := by + apply exists_frequency_kernel_basis_logHeight b P vP hP + (fun i => (code i).elim 0 eta) hp hd hD hvP + intro i j + cases code i with + | none => simpa [rationalLogHeight] using hp + | some k => exact heta k j + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/BoxDifferenceCharacter.lean b/lean/OAI/Combinatorics/Progressions/Fourier/BoxDifferenceCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fd7f758023d7802fa82e9a8d187c698d6d5312a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/BoxDifferenceCharacter.lean @@ -0,0 +1,30 @@ +import OAI.Combinatorics.Progressions.Geometry.BoxDifferenceHom + +namespace OAI + +section + +namespace Erdos3 + +open CircleFourier + +theorem character_real_sub (a b : ℝ) : + character ((a-b : ℝ) : CircleFourier.Circle) = + character (a : CircleFourier.Circle) * star (character (b : CircleFourier.Circle)) := by + rw [sub_eq_add_neg, AddCircle.coe_add, AddCircle.coe_neg, character_add, character_neg] + +theorem iteratedBoxDifference_character (n : ℕ) {X : Fin n → Type*} {Z : Type*} + (F : (∀ i, X i) → Z → ℝ) (u v : ∀ i, X i) (z : Z) : + iteratedBoxDifference n (fun x t => character (F x t : CircleFourier.Circle)) u v z = + character ((additiveBoxDifference n F u v z : ℝ) : CircleFourier.Circle) := by + induction n with + | zero => rfl + | succ n ih => + simp only [iteratedBoxDifference, additiveBoxDifference, ← character_real_sub] + exact ih _ (Fin.tail u) (Fin.tail v) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CRTConfigurationTorus.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CRTConfigurationTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..25177b7e46a1e1f4b131c0c892d8823f68c87467 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CRTConfigurationTorus.lean @@ -0,0 +1,65 @@ +import Mathlib.Data.ZMod.QuotientRing +import OAI.Combinatorics.Progressions.Estimates.ComplexFiniteMeans +import OAI.Combinatorics.Progressions.Fourier.RectangularGridCharacter + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def crtConfigurationEquiv {J : Type*} [Fintype J] (N : J → ℕ) + (hN : Pairwise (fun i j => Nat.Coprime (N i) (N j))) : + (ZMod (∏ j, N j) × ZMod (∏ j, N j)) ≃+ ((t : J × Bool) → ZMod (N t.1)) where + toFun z t := if t.2 then ZMod.prodEquivPi N hN z.2 t.1 else ZMod.prodEquivPi N hN z.1 t.1 + invFun w := ((ZMod.prodEquivPi N hN).symm (fun j => w (j, false)), + (ZMod.prodEquivPi N hN).symm (fun j => w (j, true))) + left_inv z := by + apply Prod.ext + · change (ZMod.prodEquivPi N hN).symm (ZMod.prodEquivPi N hN z.1) = z.1 + exact (ZMod.prodEquivPi N hN).symm_apply_apply z.1 + · change (ZMod.prodEquivPi N hN).symm (ZMod.prodEquivPi N hN z.2) = z.2 + exact (ZMod.prodEquivPi N hN).symm_apply_apply z.2 + right_inv w := by + funext ⟨j, b⟩ + cases b + · change ZMod.prodEquivPi N hN ((ZMod.prodEquivPi N hN).symm (fun j => w (j, false))) j = _ + exact congrFun ((ZMod.prodEquivPi N hN).apply_symm_apply _) j + · change ZMod.prodEquivPi N hN ((ZMod.prodEquivPi N hN).symm (fun j => w (j, true))) j = _ + exact congrFun ((ZMod.prodEquivPi N hN).apply_symm_apply _) j + map_add' z v := by + funext ⟨j, b⟩ + cases b + · change ZMod.prodEquivPi N hN (z.1 + v.1) j = _ + exact congrFun (map_add (ZMod.prodEquivPi N hN) z.1 v.1) j + · change ZMod.prodEquivPi N hN (z.2 + v.2) j = _ + exact congrFun (map_add (ZMod.prodEquivPi N hN) z.2 v.2) j + +noncomputable def crtConfigurationTorus {J : Type*} [Fintype J] (N : J → ℕ) + [∀ j, NeZero (N j)] (hN : Pairwise (fun i j => Nat.Coprime (N i) (N j))) : + (ZMod (∏ j, N j) × ZMod (∏ j, N j)) →+ ((J × Bool) → UnitAddCircle) where + toFun z t := ZMod.toAddCircle (crtConfigurationEquiv N hN z t) + map_zero' := by ext t; simp + map_add' z v := by ext t; simp + +theorem crt_configuration_expect {J : Type*} [Fintype J] [DecidableEq J] (N : J → ℕ) + [∀ j, NeZero (N j)] [NeZero (∏ j, N j)] (hN : Pairwise (fun i j => Nat.Coprime (N i) (N j))) + (f : ((t : J × Bool) → ZMod (N t.1)) → ℝ) : + (𝔼 z : ZMod (∏ j, N j) × ZMod (∏ j, N j), f (crtConfigurationEquiv N hN z)) = 𝔼 w, f w := + Fintype.expect_equiv (crtConfigurationEquiv N hN).toEquiv _ _ (fun _ => rfl) + +noncomputable def crtConfigurationCharacter {J : Type*} [Fintype J] (N : J → ℕ) + [∀ j, NeZero (N j)] (hN : Pairwise (fun i j => Nat.Coprime (N i) (N j))) (frequency : J × Bool → ℤ) : + AddChar (ZMod (∏ j, N j) × ZMod (∏ j, N j)) ℂ where + toFun z := ∏ t, CircleFourier.character (frequency t • crtConfigurationTorus N hN z t) + map_zero_eq_one' := by simp + map_add_eq_mul' z v := by + simp only [map_add, Pi.add_apply, smul_add, CircleFourier.character_add, Finset.prod_mul_distrib] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CanonicalDensityFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CanonicalDensityFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..d95625232cf156ccd36b45aec98b018ad1739e02 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CanonicalDensityFourier.lean @@ -0,0 +1,501 @@ +import OAI.Combinatorics.Progressions.Estimates.UniformCommutingCircleDecomposition +import OAI.Combinatorics.Progressions.Geometry.AllocatedLayerQuarterSupport +import OAI.Combinatorics.Progressions.Lattices.PositiveIntegerPeriodization +import OAI.Combinatorics.Progressions.Linear.CanonicalAmbientKernel +import OAI.Combinatorics.Progressions.Probability.LocalLayerOneSiteLaw + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem exists_ambient_torus_fourier_approximation {J : Type*} [Fintype J] + (f : (J → UnitAddCircle) → ℂ) (L B : ℝ≥0) (hf : LipschitzWith L f) + (hB : ∀ x, ‖f x‖ ≤ B) {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hJ : (Fintype.card J : ℝ) ≤ P) (hL : (L : ℝ) ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → J → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a j, |(frequency a j : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * B ∧ + ∀ x, ‖f x - ∑ a, c a * ∏ j, CircleFourier.character (frequency a j • x j)‖ ≤ δ := by + classical + have hact : ∀ t : J → UnitAddCircle, Isometry (fun x : J → UnitAddCircle => t +ᵥ x) := + fun t => isometry_add_left t + let A := CircleFourier.torusCoordinateAction hact + have horbit : ∀ i (t : UnitAddCircle) x, dist ((A i).act t x) x ≤ (1 : ℝ≥0) * ‖t‖ := by + intro i t x + change dist ((Pi.single i t : J → UnitAddCircle) + x) x ≤ (1 : ℝ) * ‖t‖ + rw [one_mul, dist_eq_norm, add_sub_cancel_right] + apply (pi_norm_le_iff_of_nonneg (norm_nonneg t)).mpr + intro j + by_cases h : j = i + · subst j; simp + · simp [Pi.single_eq_of_ne h] + obtain ⟨F, inst, frequency, v, hcard, hfrequency, hv, hchar, _, herr⟩ := + CircleFourier.exists_controlled_commuting_circle_decomposition A + (CircleFourier.torusCoordinateAction_commutes hact) f L B 1 hf hB horbit δ P hδ hP hJ hL + (by simpa using Real.one_le_exp hP) hδP + let _ := inst + have he (a : F) (x : J → UnitAddCircle) : + v a x = (∏ j, CircleFourier.character (frequency a j • x j)) * v a 0 := by + have hc : ∀ i (t : UnitAddCircle) z, + v a ((Pi.single i t : J → UnitAddCircle) +ᵥ z) = CircleFourier.character (frequency a i • t) * v a z := + fun i t z => hchar a i t z + have hh := CircleFourier.torus_character_of_coordinate_characters (v a) (frequency a) hc x 0 + change v a (x + 0) = _ at hh + simpa only [add_zero] using hh + refine ⟨F, inst, frequency, fun a => v a 0, hcard, hfrequency, ?_, ?_⟩ + · calc + _ ≤ ∑ _a : F, (B : ℝ) := Finset.sum_le_sum (fun a _ => (hv a).2 0) + _ = (Fintype.card F : ℝ) * B := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right hcard B.coe_nonneg + · intro x + have hs : (∑ a, v a x) = ∑ a, v a 0 * ∏ j, CircleFourier.character (frequency a j • x j) := by + apply Finset.sum_congr rfl + intro a _ + rw [he a x, mul_comm] + simpa only [hs, norm_sub_rev] using herr x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem exists_crtProgressionWeight_fourier {J : Type*} [Fintype J] + (k : ℕ) {δ : ℝ} (hδ : 0 < δ) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → J × Bool → ℤ) (c : F → ℂ), + ∀ (N : J → ℕ) [∀ j, NeZero (N j)] (hN : Pairwise (fun i j => Nat.Coprime (N i) (N j))) + (z : ZMod (∏ j, N j) × ZMod (∏ j, N j)), + ‖(crtProgressionWeight N hN k z : ℂ) - + ∑ a, c a * crtConfigurationCharacter N hN (frequency a) z‖ ≤ δ := by + let L : ℝ≥0 := ((64 * k : ℕ) : ℝ≥0) / 4 + let f : ((J × Bool) → UnitAddCircle) → ℂ := fun w => (progressionTorusCutoff k w : ℂ) + have hf : LipschitzWith L f := by + simpa only [one_mul, Function.comp_def] using + Complex.isometry_ofReal.lipschitzWith.comp (progressionTorusCutoff_lipschitz (J := J) k) + have hB : ∀ w, ‖f w‖ ≤ (1 : ℝ≥0) := by + intro w + simpa only [f, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (progressionTorusCutoff_range k w).1, NNReal.coe_one] using + (progressionTorusCutoff_range k w).2 + let P : ℝ := Fintype.card (J × Bool) + L + δ⁻¹ + have hi : 0 ≤ δ⁻¹ := inv_nonneg.mpr hδ.le + have hc : (0 : ℝ) ≤ Fintype.card (J × Bool) := Nat.cast_nonneg _ + have hP : 0 ≤ P := by dsimp [P]; positivity + have hJ : (Fintype.card (J × Bool) : ℝ) ≤ P := by dsimp [P]; linarith [L.coe_nonneg] + have hL : (L : ℝ) ≤ Real.exp P := by + have he := Real.add_one_le_exp P + dsimp [P] at he + linarith + have hδP : δ⁻¹ ≤ Real.exp P := by + have he := Real.add_one_le_exp P + dsimp [P] at he + linarith [L.coe_nonneg] + obtain ⟨F, inst, frequency, c, _, _, _, happ⟩ := + exists_ambient_torus_fourier_approximation f L 1 hf hB hδ hP hJ hL hδP + refine ⟨F, inst, frequency, c, ?_⟩ + intro N _ hN z + exact happ (crtConfigurationTorus N hN z) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem subspaceAmbientTorus_character {J : Type*} [Fintype J] + (U : Submodule ℝ (J → ℝ)) (frequency : J → ℤ) (x : SubspaceArrayTorus Unit U) : + (∏ j, CircleFourier.character (frequency j • subspaceAmbientTorus U x j)) = + subspaceArrayCharacter U (Matrix.of (fun (_ : Unit) j => frequency j)) x := by + obtain ⟨y, rfl⟩ := QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice Unit U) x + simp only [subspaceAmbientTorus_mk] + change _ = CircleFourier.character + ((∑ _u : Unit, ∑ j, (frequency j : ℝ) * (y ()).val j : ℝ) : UnitAddCircle) + rw [Fintype.sum_unique, character_real_sum] + apply Finset.prod_congr rfl + intro j _ + rw [← AddCircle.coe_zsmul, zsmul_eq_mul] + +theorem exists_subspace_ambient_fourier_approximation {J : Type*} [Fintype J] + (U : Submodule ℝ (J → ℝ)) (f : (J → UnitAddCircle) → ℂ) + (L B : ℝ≥0) (hf : LipschitzWith L f) (hB : ∀ x, ‖f x‖ ≤ B) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) (hJ : (Fintype.card J : ℝ) ≤ P) + (hL : (L : ℝ) ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (A : Type) (inst : Fintype A), letI := inst + ∃ (frequency : A → J → ℤ) (c : A → ℂ), + (Fintype.card A : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a j, |(frequency a j : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * B ∧ + ∀ x, ‖f (subspaceAmbientTorus U x) - + ∑ a, c a * subspaceArrayCharacter U (Matrix.of (fun (_ : Unit) j => frequency a j)) x‖ ≤ δ := by + obtain ⟨A, inst, frequency, c, hcard, hfreq, hmass, herr⟩ := + exists_ambient_torus_fourier_approximation f L B hf hB hδ hP hJ hL hδP + let _ := inst + refine ⟨A, inst, frequency, c, hcard, hfreq, hmass, ?_⟩ + intro x + simpa only [subspaceAmbientTorus_character] using herr (subspaceAmbientTorus U x) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal + +theorem exists_local_subspace_fourier_density {J : Type*} [Fintype J] + (U : Submodule ℝ (J → ℝ)) + [MeasurableSpace (SubspaceArrayTorus Unit U)] [BorelSpace (SubspaceArrayTorus Unit U)] + (μ : Measure (SubspaceArrayTorus Unit U)) [IsProbabilityMeasure μ] [μ.IsAddLeftInvariant] + {q : ℕ} (hq : 16 ≤ q) {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hJ : (Fintype.card J : ℝ) ≤ P) (hqP : (q : ℝ) ^ (Fintype.card J + 1) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ F : (J → UnitAddCircle) → ℝ, + (∀ z, 0 ≤ F z ∧ F z ≤ 2 * (q : ℝ) ^ Fintype.card J) ∧ + LipschitzWith ((q : ℝ≥0) ^ (Fintype.card J + 1)) F ∧ + ∀ center : SubspaceArrayTorus Unit U, + Integrable (fun x => F (subspaceAmbientTorus U (x - center))) μ ∧ + (∫ x, F (subspaceAmbientTorus U (x - center)) ∂μ) = 1 ∧ + (∀ x, F (subspaceAmbientTorus U (x - center)) ≠ 0 → + ∃ y : J → ℝ, ∀ j, (y j : UnitAddCircle) = subspaceAmbientTorus U (x - center) j ∧ + |y j| < 4 / (q : ℝ) ∧ |y j| < 1 / 4) ∧ + ∃ (A : Type) (inst : Fintype A), letI := inst + ∃ (frequency : A → J → ℤ) (c : A → ℂ), + (Fintype.card A : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a j, |(frequency a j : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * + (2 * (q : ℝ) ^ Fintype.card J) ∧ + ∀ x, ‖(F (subspaceAmbientTorus U (x - center)) : ℂ) - + ∑ a, c a * subspaceArrayCharacter U (Matrix.of (fun (_ : Unit) j => frequency a j)) x‖ ≤ δ := by + obtain ⟨F, hF, hLip, hlocal⟩ := exists_local_subspace_density U μ hq + refine ⟨F, hF, hLip, ?_⟩ + intro center + obtain ⟨hi, hm, hs⟩ := hlocal center + refine ⟨hi, hm, hs, ?_⟩ + let g : (J → UnitAddCircle) → ℂ := fun z => (F (z - subspaceAmbientTorus U center) : ℂ) + have hg : LipschitzWith ((q : ℝ≥0) ^ (Fintype.card J + 1)) g := by + apply LipschitzWith.of_dist_le_mul + intro x y + change dist (Complex.ofReal (F (x - subspaceAmbientTorus U center))) + (Complex.ofReal (F (y - subspaceAmbientTorus U center))) ≤ _ + rw [Complex.isometry_ofReal.dist_eq] + simpa only [dist_sub_right] using + hLip.dist_le_mul (x - subspaceAmbientTorus U center) (y - subspaceAmbientTorus U center) + have hb : ∀ z, ‖g z‖ ≤ (2 * (q : ℝ≥0) ^ Fintype.card J : ℝ≥0) := by + intro z + change ‖(F (z - subspaceAmbientTorus U center) : ℂ)‖ ≤ _ + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hF _).1, + NNReal.coe_mul, NNReal.coe_ofNat, NNReal.coe_pow, NNReal.coe_natCast] using + (hF (z - subspaceAmbientTorus U center)).2 + obtain ⟨A, inst, frequency, c, hcard, hfreq, hmass, herr⟩ := + exists_subspace_ambient_fourier_approximation U g _ _ hg hb hδ hP hJ + (by simpa only [NNReal.coe_pow, NNReal.coe_natCast] using hqP) hδP + let _ := inst + refine ⟨A, inst, frequency, c, hcard, hfreq, ?_, ?_⟩ + · simpa only [NNReal.coe_mul, NNReal.coe_ofNat, NNReal.coe_pow, NNReal.coe_natCast] using hmass + · intro x + simpa only [g, map_sub] using herr x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +variable {D : Type*} [Fintype D] + +noncomputable def smallBoxTorusKernel (H : (D → ℝ) → ℝ) : (D → UnitAddCircle) → ℝ := + realPeriodicTorusLift (positiveIntegerPeriodization H) + +omit [Fintype D] in +theorem smallBoxTorusKernel_local (H : (D → ℝ) → ℝ) + (hs : ∀ x, H x ≠ 0 → ∀ i, |x i| < 1/2) (x : D → ℝ) + (hx : ∀ i, |x i| < 1/2) : + smallBoxTorusKernel H (fun i => (x i : UnitAddCircle)) = H x := by + rw [smallBoxTorusKernel, realPeriodicTorusLift_coe _ (positiveIntegerPeriodization_periodic H)] + exact positiveIntegerPeriodization_local H hs x hx + +theorem smallBoxTorusKernel_lipschitz (H : (D → ℝ) → ℝ) {L : ℝ≥0} + (hL : LipschitzWith L H) (h0 : ∀ x, 0 ≤ H x) + (hs : ∀ x, H x ≠ 0 → ∀ i, |x i| < 1/2) : + LipschitzWith L (smallBoxTorusKernel H) := + realPeriodicTorusLift_lipschitz _ (positiveIntegerPeriodization_lipschitz H hL h0 hs) + (positiveIntegerPeriodization_periodic H) + +omit [Fintype D] in +theorem smallBoxTorusKernel_range (H : (D → ℝ) → ℝ) {B : ℝ} (hB : 0 ≤ B) + (hH : ∀ x, 0 ≤ H x ∧ H x ≤ B) + (hs : ∀ x, H x ≠ 0 → ∀ i, |x i| < 1/2) (x : D → UnitAddCircle) : + 0 ≤ smallBoxTorusKernel H x ∧ smallBoxTorusKernel H x ≤ B := + realPeriodicTorusLift_range _ (positiveIntegerPeriodization_range H hB hH hs) x + +theorem exists_small_box_fourier_approximation + (H : (D → ℝ) → ℝ) (L B : ℝ≥0) (hL : LipschitzWith L H) + (hB : ∀ x, 0 ≤ H x ∧ H x ≤ B) + (hs : ∀ x, H x ≠ 0 → ∀ i, |x i| < 1/2) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) (hD : (Fintype.card D : ℝ) ≤ P) + (hLP : (L : ℝ) ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → D → ℤ) (c : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ a i, |(frequency a i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ a, ‖c a‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * B ∧ + ∀ (x : D → ℝ), (∀ i, |x i| < 1/2) → + ‖(H x : ℂ) - ∑ a, c a * ∏ i, + CircleFourier.character (frequency a i • (x i : UnitAddCircle))‖ ≤ δ := by + have hl : LipschitzWith L (fun x => (smallBoxTorusKernel H x : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Complex.isometry_ofReal.dist_eq] + exact (smallBoxTorusKernel_lipschitz H hL (fun x => (hB x).1) hs).dist_le_mul x y + have hb (x : D → UnitAddCircle) : ‖(smallBoxTorusKernel H x : ℂ)‖ ≤ B := by + obtain ⟨h0, hcap⟩ := smallBoxTorusKernel_range H B.coe_nonneg hB hs x + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg h0] using hcap + obtain ⟨F, inst, frequency, c, hcard, hfreq, hsum, herr⟩ := + exists_ambient_torus_fourier_approximation _ L B hl hb hδ hP hD hLP hδP + let _ := inst + refine ⟨F, inst, frequency, c, hcard, hfreq, hsum, ?_⟩ + intro x hx + simpa only [smallBoxTorusKernel_local H hs x hx] using herr (fun i => (x i : UnitAddCircle)) + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped Classical + +variable {D : Type*} [Fintype D] + +omit [Fintype D] in +theorem smallBoxTorusKernel_nonzero_quarter_lift [Fintype D] (H : (D → ℝ) → ℝ) + (hs : ∀ v, H v ≠ 0 → ∀ i, |v i| ≤ 1 / 4) + (x : D → UnitAddCircle) (hx : smallBoxTorusKernel H x ≠ 0) : + ∃ v : D → ℝ, (∀ i, |v i| ≤ 1 / 4) ∧ + (fun i => (v i : UnitAddCircle)) = x ∧ H v = smallBoxTorusKernel H x := by + let a : D → ℝ := fun i => (AddCircle.equivIoc 1 0 (x i)).val + have hn : ∃ n : D → ℤ, H (fun i => a i + (n i : ℝ)) ≠ 0 := by + by_contra h + push Not at h + apply hx + change (∑' n : D → ℤ, H (fun i => a i + (n i : ℝ))) = 0 + simp only [h, tsum_zero] + obtain ⟨n, hn⟩ := hn + let v : D → ℝ := fun i => a i + (n i : ℝ) + have hv : ∀ i, |v i| ≤ 1 / 4 := hs v hn + have hcoe : (fun i => (v i : UnitAddCircle)) = x := by + funext i + simp [v, a] + refine ⟨v, hv, hcoe, ?_⟩ + rw [← hcoe] + symm + apply smallBoxTorusKernel_local H + · intro z hz i + exact (hs z hz i).trans_lt (by norm_num) + · intro i + exact (hv i).trans_lt (by norm_num) + +theorem smallBoxTorusKernel_zero_outside_quarter (H : (D → ℝ) → ℝ) + (hs : ∀ v, H v ≠ 0 → ∀ i, |v i| ≤ 1 / 4) + (x : D → UnitAddCircle) (hx : ∃ i, 1 / 4 < ‖x i‖) : smallBoxTorusKernel H x = 0 := by + by_contra hn + obtain ⟨v, hv, he, _⟩ := smallBoxTorusKernel_nonzero_quarter_lift H hs x hn + obtain ⟨i, hi⟩ := hx + rw [← he] at hi + rw [norm_eq_abs_centeredCircleLift, centeredCircleLift_coe (hv i)] at hi + exact (not_lt_of_ge (hv i)) hi + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module Submodule MeasureTheory +open scoped NNReal + +variable {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} + +theorem coordinate_integer_translate_sub_mem (u : EuclideanSpace ℝ D) (z : D → ℤ) : + u - (EuclideanSpace.equiv D ℝ).symm (fun i => u i + (z i : ℝ)) ∈ + standardEuclideanLattice D := by + apply (mem_standardEuclideanLattice D _).mpr + intro i + refine ⟨-z i, ?_⟩ + change ((-z i : ℤ) : ℝ) = u i - (u i + (z i : ℝ)) + push_cast + ring + +theorem exists_coordinate_integer_translate (u v : EuclideanSpace ℝ D) + (hv : u - v ∈ standardEuclideanLattice D) : + ∃ z : D → ℤ, (fun i => v i) = fun i => u i + (z i : ℝ) := by + choose z hz using (mem_standardEuclideanLattice D _).mp hv + refine ⟨fun i => -z i, ?_⟩ + funext i + have hi : (z i : ℝ) = u i - v i := hz i + push_cast + linarith + +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) +variable (hb : span ℤ (Set.range b) = projectedIntegerLattice W) (o : OrthonormalBasis I ℝ W) + +noncomputable def canonicalAmbientTorusDensity (c w : I → ℝ) (f : Fin n → ℝ → ℝ) : + (D → UnitAddCircle) → ℝ := + smallBoxTorusKernel (canonicalAmbientKernel W b o c w f) + +theorem canonicalAmbientTorusDensity_eq (c w : I → ℝ) (f : Fin n → ℝ → ℝ) + (p : Fin n → PMF ℤ) + (hf : ∀ i (k : ℤ), f i ((k : ℝ) / basisAxisScale b i) = basisAxisScale b i * (p i k).toReal) + (hs : ∀ x, mixedCoefficientDensity c w p x ≠ 0 → ∀ d, + |normalizedLatticePoint W b (orthonormalMixedChart o x) d| ≤ 1/4) + (u : W) : + canonicalAmbientTorusDensity W b o c w f (fun i => (u.val i : UnitAddCircle)) = + canonicalMixedDensity W b hb o c w p + (QuotientAddGroup.mk' (latticeSection (standardEuclideanLattice D) W).toAddSubgroup u) := by + let H := canonicalAmbientKernel W b o c w f + let d := canonicalMixedDensity W b hb o c w p + (QuotientAddGroup.mk' (latticeSection (standardEuclideanLattice D) W).toAddSubgroup u) + have hsupport : ∀ v, H v ≠ 0 → ∀ i, |v i| < 1/2 := + canonicalAmbientKernel_support W b o c w f + have hlocal (v : D → ℝ) + (hv : u.val - (EuclideanSpace.equiv D ℝ).symm v ∈ standardEuclideanLattice D) + (hvsmall : ∀ i, |v i| < 1/2) : H v = d := + canonicalAmbientKernel_eq_of_lift W b hb o c w f p hf hs u v hv hvsmall + change realPeriodicTorusLift (positiveIntegerPeriodization H) + (fun i => (u.val i : UnitAddCircle)) = d + rw [realPeriodicTorusLift_coe _ (positiveIntegerPeriodization_periodic H)] + by_cases hd : d = 0 + · rw [hd] + have hz : ∀ z : D → ℤ, H (fun i => u.val i + (z i : ℝ)) = 0 := by + intro z + by_cases hz : H (fun i => u.val i + (z i : ℝ)) = 0 + · exact hz + · exact (hlocal _ (coordinate_integer_translate_sub_mem u.val z) (hsupport _ hz)).trans hd + simp only [positiveIntegerPeriodization, hz, tsum_zero] + · obtain ⟨x, hxsmall, hq, _⟩ := canonicalMixedDensity_recover W b hb o c w p hd + let v := normalizedLatticePoint W b (orthonormalMixedChart o x) + have hv : u.val - v ∈ standardEuclideanLattice D := + normalizedLatticePoint_sub_mem_of_mk_eq W b hb u _ hq.symm + obtain ⟨z, hz⟩ := exists_coordinate_integer_translate u.val v hv + calc + positiveIntegerPeriodization H (fun i => u.val i) = + positiveIntegerPeriodization H (fun i => v i) := by + rw [hz] + exact (positiveIntegerPeriodization_periodic H _ z).symm + _ = H (fun i => v i) := positiveIntegerPeriodization_local H hsupport _ hxsmall + _ = d := hlocal _ hv hxsmall + +theorem canonicalAmbientTorusDensity_bounds (c w : I → ℝ) (f : Fin n → ℝ → ℝ) + {M J C V : ℝ≥0} + (hM : ∀ x, 0 ≤ mixedDensityInterpolation c w f x ∧ mixedDensityInterpolation c w f x ≤ M) + (hJ : LipschitzWith J (mixedDensityInterpolation c w f)) + (hC : ∀ x, ‖normalizedOrthogonalChart W b x‖ ≤ C * ‖x‖) + (hV : 0 ≤ mixedDensityCovolumeRatio W b ∧ mixedDensityCovolumeRatio W b ≤ V) : + (∀ x, 0 ≤ canonicalAmbientTorusDensity W b o c w f x ∧ + canonicalAmbientTorusDensity W b o c w f x ≤ V * M) ∧ + LipschitzWith (V * (J * (C * Fintype.card D)) + (V * M) * 8) + (canonicalAmbientTorusDensity W b o c w f) := by + obtain ⟨hcap, hlip⟩ := canonicalAmbientKernel_bounds W b o c w f hM hJ hC hV + exact ⟨smallBoxTorusKernel_range _ (mul_nonneg V.coe_nonneg M.coe_nonneg) hcap + (canonicalAmbientKernel_support W b o c w f), + smallBoxTorusKernel_lipschitz _ hlip (fun x => (hcap x).1) + (canonicalAmbientKernel_support W b o c w f)⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module Submodule MeasureTheory +open scoped BigOperators NNReal + +variable {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) +variable (hb : span ℤ (Set.range b) = projectedIntegerLattice W) (o : OrthonormalBasis I ℝ W) + +theorem canonicalAmbientTorusDensity_eq_of_support_bounds + (c w : I → ℝ) (f : Fin n → ℝ → ℝ) (p : Fin n → PMF ℤ) + (hf : ∀ i (k : ℤ), f i ((k : ℝ) / basisAxisScale b i) = basisAxisScale b i * (p i k).toReal) + {C R : ℝ} (hC : 0 ≤ C) (hR : 0 ≤ R) + (hchart : ∀ x, ‖(normalizedOrthogonalChart W b).symm x‖ ≤ C * ‖x‖) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1/4) + (hw : ∀ i, 0 < w i) (hcw : ∀ i, |c i| + w i ≤ R) + (hp : ∀ i k, k ∈ (p i).support → |(k : ℝ) / basisAxisScale b i| ≤ R) (u : W) : + canonicalAmbientTorusDensity W b o c w f (fun i => (u.val i : UnitAddCircle)) = + canonicalMixedDensity W b hb o c w p + (QuotientAddGroup.mk' (latticeSection (standardEuclideanLattice D) W).toAddSubgroup u) := + canonicalAmbientTorusDensity_eq W b hb o c w f p hf + (mixedCoefficient_quarter_support W b o hC hR hchart hsmall c w hw hcw p hp) u + +theorem exists_canonical_density_fourier_approximation + (c w : I → ℝ) (f : Fin n → ℝ → ℝ) (p : Fin n → PMF ℤ) + (hf : ∀ i (k : ℤ), f i ((k : ℝ) / basisAxisScale b i) = basisAxisScale b i * (p i k).toReal) + (hs : ∀ x, mixedCoefficientDensity c w p x ≠ 0 → ∀ d, + |normalizedLatticePoint W b (orthonormalMixedChart o x) d| ≤ 1/4) + {M J C V : ℝ≥0} + (hM : ∀ x, 0 ≤ mixedDensityInterpolation c w f x ∧ mixedDensityInterpolation c w f x ≤ M) + (hJ : LipschitzWith J (mixedDensityInterpolation c w f)) + (hC : ∀ x, ‖normalizedOrthogonalChart W b x‖ ≤ C * ‖x‖) + (hV : 0 ≤ mixedDensityCovolumeRatio W b ∧ mixedDensityCovolumeRatio W b ≤ V) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) (hD : (Fintype.card D : ℝ) ≤ P) + (hLP : ((V * (J * (C * Fintype.card D)) + (V * M) * 8 : ℝ≥0) : ℝ) ≤ Real.exp P) + (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → D → ℤ) (a : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ t i, |(frequency t i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ t, ‖a t‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * (V * M) ∧ + ∀ u : W, ‖(canonicalMixedDensity W b hb o c w p + (QuotientAddGroup.mk' (latticeSection (standardEuclideanLattice D) W).toAddSubgroup u) : ℂ) - + ∑ t, a t * ∏ i, CircleFourier.character (frequency t i • (u.val i : UnitAddCircle))‖ ≤ δ := by + obtain ⟨hcap, hlip⟩ := canonicalAmbientTorusDensity_bounds W b o c w f hM hJ hC hV + have hc : LipschitzWith (V * (J * (C * Fintype.card D)) + (V * M) * 8) + (fun x => (canonicalAmbientTorusDensity W b o c w f x : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Complex.isometry_ofReal.dist_eq] + exact hlip.dist_le_mul x y + have hbnd (x) : ‖(canonicalAmbientTorusDensity W b o c w f x : ℂ)‖ ≤ (V * M : ℝ≥0) := by + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hcap x).1, NNReal.coe_mul] + using (hcap x).2 + obtain ⟨F, inst, frequency, a, hcard, hfreq, hsum, herr⟩ := + exists_ambient_torus_fourier_approximation _ _ (V * M) hc hbnd hδ hP hD hLP hδP + let _ := inst + refine ⟨F, inst, frequency, a, hcard, hfreq, hsum, ?_⟩ + intro u + simpa only [canonicalAmbientTorusDensity_eq W b hb o c w f p hf hs u] using + herr (fun i => (u.val i : UnitAddCircle)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CharacterCenteredCounting.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CharacterCenteredCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ed2e8ecbce8e310ffedbdb35f90931f5ba2a32d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CharacterCenteredCounting.lean @@ -0,0 +1,113 @@ +import OAI.Combinatorics.Progressions.Estimates.ComplexPositiveMasks +import OAI.Combinatorics.Progressions.Estimates.FiniteProductSumEstimate +import OAI.Combinatorics.Progressions.Estimates.MaskedCenteredCounting + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct NNReal + +theorem positiveCyclicNiltest_characterMask {N degree : ℕ} [NeZero N] + (hdegree : 1 ≤ degree) (chi : AddChar (ZMod N) ℂ) (t : Bool × Bool) : + PositiveCyclicNiltest.{0} degree N 13 (fun x => complexPositiveMask t (chi x)) := by + obtain ⟨T, hTnorm, hTc, hTeval⟩ := exists_cyclic_character_niltest chi + have hbound (z) := complexPositiveMask_bounds t ((T.norm_le z).trans (by exact_mod_cast hTnorm)) + let S : (RationalTorus.nilmanifold 1).Niltest (fun _ : Unit => 1) := { + orbit := T.orbit + observable := fun z => (complexPositiveMask t (T.observable z) : ℂ) + normBound := 1 + lipBound := T.lipBound + norm_le := fun z => by + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hbound z).1, NNReal.coe_one] using (hbound z).2 + lipschitz := by + let := (RationalTorus.nilmanifold 1).metricSpace + simpa only [one_mul, Function.comp_def] using + Complex.isometry_ofReal.lipschitzWith.comp ((complexPositiveMask_lipschitz t).comp T.lipschitz) } + have hS : S.UnitIntervalValued := by + intro z + exact ⟨rfl, hbound z⟩ + have hSc : S.ComplexityLE 13 := by + refine ⟨hTc.1.mono _ (by norm_num), ?_⟩ + change Real.log (2 + 1 + (T.lipBound : ℝ)) ≤ 13 + apply (Real.log_le_iff_le_exp (by positivity)).2 + have h := T.observable_budget hTc + have he : Real.exp 13 = Real.exp 12 * Real.exp 1 := by rw [← Real.exp_add]; norm_num + rw [he] + nlinarith [T.normBound.coe_nonneg, Real.add_one_le_exp (1 : ℝ), Real.exp_pos (12 : ℝ)] + refine .of_test (RationalTorus.nilmanifold 1) hdegree S hS hSc ?_ + intro x + change complexPositiveMask t (chi x) = complexPositiveMask t (T.evalCyclic N (fun _ => x)) + rw [hTeval] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_character_centered_counting (s : ℕ) (hs : 1 ≤ s) + {epsilon : ℝ} (hepsilon : 0 < epsilon) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ {N : ℕ} [NeZero N] {p : ℝ}, 2 ≤ p → Odd N → Real.exp ((p + 2) ^ C) ≤ N → + ∀ mu : ZMod N → ℝ, (∀ x, 0 ≤ mu x ∧ mu x ≤ Real.exp p) → (𝔼 x, mu x) = 1 → + CyclicNiltestUpperComparison.{0} s N ((p + 2) ^ C) + (Real.exp (-((p + 2) ^ C))) mu (fun _ => 1 + xi) → + ∀ {I : Type} [Fintype I] [DecidableEq I] [Nonempty I], Fintype.card I ≤ s + 2 → + ∀ (slopes : I → ZMod N) (chi : I → AddChar (ZMod N) ℂ), + (∀ i j, i ≠ j → IsUnit (slopes i - slopes j)) → + ‖𝔼 x, 𝔼 d, ∏ i, chi i (x + slopes i * d) * ((mu (x + slopes i * d) - 1 : ℝ) : ℂ)‖ ≤ + epsilon := by + let delta := epsilon / (4 : ℝ) ^ (s + 2) + have hdelta : 0 < delta := by dsimp [delta]; positivity + obtain ⟨C, hC, xi, hxi, hcount⟩ := exists_masked_centered_counting s 2 hdelta + refine ⟨C, hC, xi, hxi, ?_⟩ + intro N _ p hp hodd hN mu hmu hmean hcompare I _ _ _ hI slopes chi hsep + let A : I → (Bool × Bool) → (ZMod N × ZMod N) → ℂ := fun i t z => + (complexPositiveMask t (chi i (z.1 + slopes i * z.2)) : ℂ) * + ((mu (z.1 + slopes i * z.2) - 1 : ℝ) : ℂ) + have hcost : (13 : ℝ) ≤ (p + 2) ^ 2 := by nlinarith + have hA (choice : I → Bool × Bool) : ‖𝔼 z, ∏ i, A i (choice i) z‖ ≤ delta := by + let phi : I → ZMod N → ℝ := fun i x => complexPositiveMask (choice i) (chi i x) + have hphi (i : I) : PositiveCyclicNiltest.{0} s N ((p + 2) ^ 2) (phi i) := + (positiveCyclicNiltest_characterMask hs (chi i) (choice i)).mono le_rfl hcost + have h := hcount hp hodd hN mu hmu hmean hcompare slopes phi hsep hphi + Finset.univ Finset.univ_nonempty (by simpa using hI) + have he : (𝔼 z, ∏ i, A i (choice i) z) = + (((𝔼 x, 𝔼 d, ∏ i, phi i (x + slopes i * d) * (mu (x + slopes i * d) - 1)) : ℝ) : ℂ) := by + simp only [A, ← Complex.ofReal_mul, ← Complex.ofReal_prod] + rw [expect_prod_split] + simp only [phi, Fintype.expect_eq_sum_div_card, Complex.ofReal_div, + Complex.ofReal_sum, Complex.ofReal_natCast] + rw [he] + simpa only [Complex.norm_real, Real.norm_eq_abs] using h + have h := norm_expect_product_sum_le (fun _ : I => complexMaskCoefficient) A + (fun _ t => complexMaskCoefficient_norm t) hA + have he (i : I) (z : ZMod N × ZMod N) : + (∑ t, complexMaskCoefficient t * A i t z) = + chi i (z.1 + slopes i * z.2) * ((mu (z.1 + slopes i * z.2) - 1 : ℝ) : ℂ) := by + dsimp only [A] + simp only [← mul_assoc] + rw [← Finset.sum_mul] + congr 1 + exact (complexPositiveMask_expansion _).symm + simp only [he, Fintype.card_prod, Fintype.card_bool, Nat.cast_mul, Nat.cast_ofNat] at h + rw [expect_prod_split] at h + apply h.trans + calc + ((2 : ℝ) * 2) ^ Fintype.card I * delta ≤ (4 : ℝ) ^ (s + 2) * delta := by + norm_num only [show (2 : ℝ) * 2 = 4 by norm_num] + exact mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by norm_num) hI) hdelta.le + _ = epsilon := by dsimp [delta]; field_simp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CharacterCoordinateScale.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CharacterCoordinateScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..d26b4252accc826449cc1067a993a5875e71db9e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CharacterCoordinateScale.lean @@ -0,0 +1,171 @@ +import Mathlib.Algebra.BigOperators.Pi +import Mathlib.Algebra.Group.AddChar +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Basic.Complex.Basic +import Mathlib.Data.Finset.Max +import Mathlib.GroupTheory.OrderOfElement +import Mathlib.RingTheory.RootsOfUnity.Complex +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def latticeCharacterCoordinates {I : Type*} [DecidableEq I] (χ : AddChar (I → ℤ) ℂ) (i : I) : ℂ := + χ (Pi.single i 1) + +theorem integerVector_sum_single {I : Type*} [Fintype I] [DecidableEq I] (v : I → ℤ) : + v = ∑ i, v i • (Pi.single i 1 : I → ℤ) := by + ext i + simp [Pi.single_apply] + +theorem latticeCharacter_eval {I : Type*} [Fintype I] [DecidableEq I] + (χ : AddChar (I → ℤ) ℂ) (v : I → ℤ) : + χ v = ∏ i, latticeCharacterCoordinates χ i ^ (v i : ℤ) := by + have hsum (s : Finset I) : χ (∑ i ∈ s, v i • (Pi.single i 1 : I → ℤ)) = + ∏ i ∈ s, latticeCharacterCoordinates χ i ^ (v i : ℤ) := by + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [Finset.sum_insert hi, Finset.prod_insert hi, χ.map_add_eq_mul, ih] + rw [χ.map_zsmul_eq_zpow] + rfl + rw [integerVector_sum_single v] + convert hsum Finset.univ using 1 + apply Finset.prod_congr rfl + intro i _ + simp [Pi.single_apply] + +theorem latticeCharacterCoordinates_injective {I : Type*} [Fintype I] [DecidableEq I] : + Function.Injective (latticeCharacterCoordinates (I := I)) := by + intro χ ψ h + ext v + rw [latticeCharacter_eval, latticeCharacter_eval, h] + +theorem latticeCharacterCoordinates_pow {I : Type*} [DecidableEq I] + (χ : AddChar (I → ℤ) ℂ) (n : ℕ) (i : I) : + latticeCharacterCoordinates (χ ^ n) i = latticeCharacterCoordinates χ i ^ n := rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem latticeCharacter_coordinate_order_dvd {I : Type*} [DecidableEq I] + (χ : AddChar (I → ℤ) ℂ) (a : ℕ) (hχ : χ ^ a = 1) (i : I) : + orderOf (latticeCharacterCoordinates χ i) ∣ a := + orderOf_dvd_iff_pow_eq_one.mpr + (congrArg (fun ψ : AddChar (I → ℤ) ℂ => ψ (Pi.single i 1)) hχ) + +theorem latticeCharacter_coordinate_order_pos {I : Type*} [DecidableEq I] + (χ : AddChar (I → ℤ) ℂ) (hχ : 0 < orderOf χ) (i : I) : + 0 < orderOf (latticeCharacterCoordinates χ i) := + Nat.pos_of_dvd_of_pos + (latticeCharacter_coordinate_order_dvd χ (orderOf χ) (pow_orderOf_eq_one χ) i) hχ + +theorem latticeCharacter_order_le_product {I : Type*} [Fintype I] [DecidableEq I] + (χ : AddChar (I → ℤ) ℂ) (hχ : 0 < orderOf χ) : + orderOf χ ≤ ∏ i, orderOf (latticeCharacterCoordinates χ i) := by + have hpos : 0 < ∏ i, orderOf (latticeCharacterCoordinates χ i) := + Finset.prod_pos (fun i _ => latticeCharacter_coordinate_order_pos χ hχ i) + apply Nat.le_of_dvd hpos + apply orderOf_dvd_iff_pow_eq_one.mpr + apply latticeCharacterCoordinates_injective + funext i + rw [latticeCharacterCoordinates_pow] + change (latticeCharacterCoordinates χ i) ^ (∏ j, orderOf (latticeCharacterCoordinates χ j)) = 1 + apply orderOf_dvd_iff_pow_eq_one.mp + exact Finset.dvd_prod_of_mem _ (Finset.mem_univ i) + +theorem exists_coordinate_order_power_ge {I : Type*} [Fintype I] [DecidableEq I] [Nonempty I] + (χ : AddChar (I → ℤ) ℂ) (hχ : 0 < orderOf χ) : + ∃ i, 0 < orderOf (latticeCharacterCoordinates χ i) ∧ + orderOf χ ≤ orderOf (latticeCharacterCoordinates χ i) ^ Fintype.card I := by + obtain ⟨i, _, hi⟩ := Finset.exists_max_image Finset.univ + (fun i => orderOf (latticeCharacterCoordinates χ i)) Finset.univ_nonempty + refine ⟨i, latticeCharacter_coordinate_order_pos χ hχ i, (latticeCharacter_order_le_product χ hχ).trans ?_⟩ + calc + _ ≤ ∏ _j : I, orderOf (latticeCharacterCoordinates χ i) := + Finset.prod_le_prod (fun coordinate hcoordinate => hi coordinate hcoordinate) + _ = _ := by simp + +end Erdos3 + +end + +section + +namespace Erdos3 + +abbrev TorsionLatticeCharacter (I : Type*) (a : ℕ) := + {χ : AddChar (I → ℤ) ℂ // χ ^ a = 1} + +noncomputable def torsionCharacterCoordinates {I : Type*} [DecidableEq I] {a : ℕ} [NeZero a] + (χ : TorsionLatticeCharacter I a) (i : I) : rootsOfUnity a ℂ := + rootsOfUnity.mkOfPowEq (latticeCharacterCoordinates χ.val i) + (congrArg (fun ψ : AddChar (I → ℤ) ℂ => ψ (Pi.single i 1)) χ.property) + +theorem torsionCharacterCoordinates_injective {I : Type*} [Fintype I] [DecidableEq I] + {a : ℕ} [NeZero a] : + Function.Injective (torsionCharacterCoordinates (I := I) (a := a)) := by + intro χ ψ h + apply Subtype.ext + apply latticeCharacterCoordinates_injective + funext i + exact congrArg (fun z : rootsOfUnity a ℂ => (z.val : ℂ)) (congrFun h i) + +noncomputable instance torsionLatticeCharacterFintype (I : Type*) [Fintype I] (a : ℕ) [NeZero a] : + Fintype (TorsionLatticeCharacter I a) := by + classical + let _ : Fintype (rootsOfUnity a ℂ) := Fintype.ofFinite _ + exact Fintype.ofInjective torsionCharacterCoordinates torsionCharacterCoordinates_injective + +theorem torsionLatticeCharacter_card_le (I : Type*) [Fintype I] (a : ℕ) [NeZero a] : + Fintype.card (TorsionLatticeCharacter I a) ≤ a ^ Fintype.card I := by + classical + let _ : Fintype (rootsOfUnity a ℂ) := Fintype.ofFinite _ + have h := Fintype.card_le_of_injective torsionCharacterCoordinates + (torsionCharacterCoordinates_injective (I := I) (a := a)) + have hc : Fintype.card (rootsOfUnity a ℂ) = a := by + rw [← Nat.card_eq_fintype_card, Complex.card_rootsOfUnity] + rw [Fintype.card_fun, hc] at h + exact h + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem exists_coordinate_order_rpow_ge {I : Type*} [Fintype I] [DecidableEq I] [Nonempty I] + (χ : AddChar (I → ℤ) ℂ) (hχ : 0 < orderOf χ) : + ∃ i, 0 < orderOf (latticeCharacterCoordinates χ i) ∧ + (orderOf χ : ℝ) ^ (1 / (Fintype.card I : ℝ)) ≤ orderOf (latticeCharacterCoordinates χ i) := by + obtain ⟨i, hi, hpow⟩ := exists_coordinate_order_power_ge χ hχ + refine ⟨i, hi, ?_⟩ + have hq : (0 : ℝ) < Fintype.card I := by exact_mod_cast Fintype.card_pos (α := I) + have hpowR : (orderOf χ : ℝ) ≤ (orderOf (latticeCharacterCoordinates χ i) : ℝ) ^ Fintype.card I := by + exact_mod_cast hpow + have hb : (0 : ℝ) ≤ orderOf (latticeCharacterCoordinates χ i) := Nat.cast_nonneg _ + calc + _ ≤ ((orderOf (latticeCharacterCoordinates χ i) : ℝ) ^ Fintype.card I) ^ + (1 / (Fintype.card I : ℝ)) := Real.rpow_le_rpow (Nat.cast_nonneg _) hpowR (by positivity) + _ = _ := by + rw [← Real.rpow_natCast, ← Real.rpow_mul hb, mul_one_div_cancel hq.ne', Real.rpow_one] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CircleActionFourierMetric.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CircleActionFourierMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5d7b2454f192824a6500df11c81d625a61850a7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CircleActionFourierMetric.lean @@ -0,0 +1,104 @@ +import OAI.Combinatorics.Progressions.Estimates.CircleFejerAverage + +namespace OAI + +section + +namespace Erdos3.CircleFourier + +open MeasureTheory +open scoped NNReal + +variable {X : Type*} [AddAction Circle X] + +noncomputable def circleFourierComponent (n : ℤ) (f : X → ℂ) (x : X) : ℂ := + ∫ t : Circle, character ((-n) • t) * f (t +ᵥ x) ∂circleHaar + +theorem circleFourierComponent_vadd (n : ℤ) (f : X → ℂ) (a : Circle) (x : X) : + circleFourierComponent n f (a +ᵥ x) = character (n • a) * circleFourierComponent n f x := by + unfold circleFourierComponent + calc + _ = ∫ t : Circle, character (n • a) * + (character ((-n) • (t + a)) * f ((t + a) +ᵥ x)) ∂circleHaar := by + apply integral_congr_ae + filter_upwards [] with t + rw [← add_vadd] + have hchar : character ((-n) • t) = character (n • a) * character ((-n) • (t + a)) := by + rw [← character_add] + congr 1 + simp only [smul_add, neg_smul] + abel + rw [hchar, mul_assoc] + _ = character (n • a) * ∫ t : Circle, + character ((-n) • (t + a)) * f ((t + a) +ᵥ x) ∂circleHaar := integral_const_mul _ _ + _ = _ := by rw [integral_add_right_eq_self + (fun t : Circle => character ((-n) • t) * f (t +ᵥ x)) a] + +theorem norm_circleFourierComponent_le (n : ℤ) (f : X → ℂ) {B : ℝ} + (hB : ∀ x, ‖f x‖ ≤ B) (x : X) : ‖circleFourierComponent n f x‖ ≤ B := by + apply (norm_integral_le_integral_norm _).trans + have h := integral_mono_of_nonneg + (ae_of_all circleHaar (fun t : Circle => norm_nonneg (character ((-n) • t) * f (t +ᵥ x)))) + (integrable_const B) (ae_of_all circleHaar (fun t : Circle => by + simpa only [norm_mul, norm_character, one_mul] using hB (t +ᵥ x))) + simpa using h + +variable [TopologicalSpace X] [ContinuousVAdd Circle X] + +theorem integrable_circleFourierComponent (n : ℤ) {f : X → ℂ} (hf : Continuous f) (x : X) : + Integrable (fun t : Circle => character ((-n) • t) * f (t +ᵥ x)) circleHaar := by + exact circle_integrable_of_continuous + ((fourier (-n)).continuous.mul (hf.comp (continuous_id.vadd continuous_const))) + +omit [TopologicalSpace X] [ContinuousVAdd Circle X] in +theorem circleFourierComponent_inherits_character (n : ℤ) {f : X → ℂ} + (a : Circle) (z : ℂ) (ha : ∀ x, f (a +ᵥ x) = z * f x) (x : X) : + circleFourierComponent n f (a +ᵥ x) = z * circleFourierComponent n f x := by + unfold circleFourierComponent + calc + _ = ∫ t : Circle, z * (character ((-n) • t) * f (t +ᵥ x)) ∂circleHaar := by + apply integral_congr_ae + filter_upwards [] with t + rw [← add_vadd, add_comm t a, add_vadd, ha] + ring + _ = _ := integral_const_mul _ _ + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier + +open MeasureTheory +open scoped NNReal + +variable {X : Type*} [PseudoMetricSpace X] [AddAction Circle X] [ContinuousVAdd Circle X] + +theorem lipschitz_circleFourierComponent (n : ℤ) {f : X → ℂ} {L : ℝ≥0} + (hf : LipschitzWith L f) (hact : ∀ t : Circle, Isometry (fun x : X => t +ᵥ x)) : + LipschitzWith L (circleFourierComponent n f) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [dist_eq_norm] + unfold circleFourierComponent + rw [← integral_sub (integrable_circleFourierComponent n hf.continuous x) + (integrable_circleFourierComponent n hf.continuous y)] + apply (norm_integral_le_integral_norm _).trans + have hpoint (t : Circle) : + ‖character ((-n) • t) * f (t +ᵥ x) - character ((-n) • t) * f (t +ᵥ y)‖ ≤ + (L : ℝ) * dist x y := by + rw [← mul_sub, norm_mul, norm_character, one_mul, ← dist_eq_norm] + exact (hf.dist_le_mul _ _).trans_eq (by rw [(hact t).dist_eq]) + have h := integral_mono_of_nonneg + (ae_of_all circleHaar (fun t : Circle => norm_nonneg + (character ((-n) • t) * f (t +ᵥ x) - character ((-n) • t) * f (t +ᵥ y)))) + (integrable_const ((L : ℝ) * dist x y)) (ae_of_all circleHaar hpoint) + simpa using h + +end Erdos3.CircleFourier + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ClearedSectionFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ClearedSectionFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6ccf4a3ada44fcffc54d785ea8ad0b2602a25a0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ClearedSectionFrequency.lean @@ -0,0 +1,58 @@ +import OAI.Combinatorics.Progressions.Estimates.ArrayFunctionalSection +import OAI.Combinatorics.Progressions.Sampling.RationalSpanGrid + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Matrix + +theorem clearedMatrix_real_entry {I S : Type*} [Fintype I] [Fintype S] + [DecidableEq I] [DecidableEq S] (T : Matrix I S ℚ) (i : I) (s : S) : + ((clearedMatrix T i s : ℤ) : ℝ) = (matrixDenominator T : ℝ) * (T i s : ℝ) := by + have h : ((clearedMatrix T i s : ℤ) : ℚ) = (matrixDenominator T : ℚ) * T i s := + congrFun (congrFun (clearedMatrix_cast T) i) s + exact_mod_cast h + +noncomputable def sectionIntegerFrequency {I S J : Type*} [Fintype I] [Fintype S] + [DecidableEq I] [DecidableEq S] (T : Matrix I S ℚ) (frequency : Matrix I J ℤ) : + Matrix S J ℤ := (clearedMatrix T)ᵀ * frequency + +theorem sectionIntegerFrequency_real {I S J : Type*} [Fintype I] [Fintype S] + [DecidableEq I] [DecidableEq S] (T : Matrix I S ℚ) (frequency : Matrix I J ℤ) : + Matrix.of (fun s a => ((sectionIntegerFrequency T frequency s a : ℤ) : ℝ)) = + (matrixDenominator T : ℝ) • + ((Matrix.of (fun i s => (T i s : ℝ)))ᵀ * Matrix.of (fun i a => (frequency i a : ℝ))) := by + funext s a + change ((∑ i, clearedMatrix T i s * frequency i a : ℤ) : ℝ) = + (matrixDenominator T : ℝ) * (∑ i, (T i s : ℝ) * (frequency i a : ℝ)) + simp only [Int.cast_sum, Int.cast_mul, clearedMatrix_real_entry, Finset.mul_sum, mul_assoc] + +theorem sectionIntegerFrequency_bound {I S J : Type*} [Fintype I] [Fintype S] + [DecidableEq I] [DecidableEq S] (T : Matrix I S ℚ) (frequency : Matrix I J ℤ) + {C H : ℝ} (hH : 0 ≤ H) + (hfrequency : ∀ i a, |(frequency i a : ℝ)| ≤ C) + (hT : ∀ i s, |(T i s : ℝ)| ≤ H) (s : S) (a : J) : + |(sectionIntegerFrequency T frequency s a : ℝ)| ≤ + (Fintype.card I : ℝ) * C * (matrixDenominator T : ℝ) * H := by + change |((∑ i, clearedMatrix T i s * frequency i a : ℤ) : ℝ)| ≤ _ + rw [Int.cast_sum] + apply (Finset.abs_sum_le_sum_abs _ _).trans + calc + _ ≤ ∑ _i : I, (matrixDenominator T : ℝ) * H * C := by + apply Finset.sum_le_sum + intro i _ + rw [Int.cast_mul, abs_mul, clearedMatrix_real_entry, abs_mul, + abs_of_nonneg (show (0 : ℝ) ≤ matrixDenominator T from Nat.cast_nonneg _)] + exact mul_le_mul + (mul_le_mul_of_nonneg_left (hT i s) (Nat.cast_nonneg _)) + (hfrequency i a) (abs_nonneg _) (mul_nonneg (Nat.cast_nonneg _) hH) + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientAmbientFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientAmbientFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bb4ab06d47853e8d427d4442085be1ef9bc1252 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientAmbientFourier.lean @@ -0,0 +1,72 @@ +import OAI.Combinatorics.Progressions.Probability.CoefficientAmbientDensity + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators NNReal + +variable {K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +theorem exists_coefficient_ambient_fourier_approximation + (c w : ∀ j : Fin m, I j → BoundedCoefficientExponent K (j.val + 1) → ℝ) + (f : ∀ j : Fin m, Fin (n j) → BoundedCoefficientExponent K (j.val + 1) → ℝ → ℝ) + (p : ∀ j : Fin m, Fin (n j) → BoundedCoefficientExponent K (j.val + 1) → PMF ℤ) + (hf : ∀ j i d (k : ℤ), f j i d ((k : ℝ) / basisAxisScale (b j) i) = + basisAxisScale (b j) i * (p j i d k).toReal) + (hs : ∀ j d x, mixedCoefficientDensity (fun i => c j i d) (fun i => w j i d) + (fun i => p j i d) x ≠ 0 → ∀ a, + |normalizedLatticePoint (euclideanSubspace (U j)) (b j) (orthonormalMixedChart (o j) x) a| ≤ 1/4) + {B L : ℝ≥0} (hB : 1 ≤ B) + (hcap : ∀ s x, 0 ≤ coefficientAmbientFactor U b o c w f s x ∧ + coefficientAmbientFactor U b o c w f s x ≤ B) + (hlip : ∀ s, LipschitzWith L (coefficientAmbientFactor U b o c w f s)) + {δ P : ℝ} (hδ : 0 < δ) (hP : 0 ≤ P) + (hdim : (Fintype.card (CoefficientAmbientIndex K J) : ℝ) ≤ P) + (hLP : ((Fintype.card (CoefficientSlot K m) * L * B^Fintype.card (CoefficientSlot K m) : ℝ≥0) : ℝ) + ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → ∀ j : Fin m, (K →₀ ℕ) → J j → ℤ) (a : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) ∧ + (∀ t j d, d.degree ≤ j.val + 1 → ∀ i, + |(frequency t j d i : ℝ)| ≤ Real.exp ((2 * P + 2) ^ 4)) ∧ + (∑ t, ‖a t‖) ≤ Real.exp (2 * P * (2 * P + 2) ^ 4) * (B : ℝ)^Fintype.card (CoefficientSlot K m) ∧ + ∀ x, ‖(canonicalCoefficientDensity U b hb o c w p x : ℂ) - + coefficientTorusFourierSum U frequency a x‖ ≤ δ := by + obtain ⟨hbound, hLip⟩ := coefficientAmbientDensity_bounds U b o c w f hB hcap hlip + have hc : LipschitzWith + (Fintype.card (CoefficientSlot K m) * L * B^Fintype.card (CoefficientSlot K m)) + (fun x => (coefficientAmbientDensity U b o c w f x : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Complex.isometry_ofReal.dist_eq] + exact hLip.dist_le_mul x y + have hbnd (x) : ‖(coefficientAmbientDensity U b o c w f x : ℂ)‖ ≤ + (B^Fintype.card (CoefficientSlot K m) : ℝ≥0) := by + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hbound x).1, NNReal.coe_pow] + using (hbound x).2 + obtain ⟨F, inst, frequency, a, hcard, hfreq, hsum, herr⟩ := + exists_ambient_torus_fourier_approximation _ _ _ hc hbnd hδ hP hdim hLP hδP + let _ := inst + refine ⟨F, inst, fun t => coefficientSlotFrequency (fun s i => frequency t ⟨s, i⟩), a, + hcard, ?_, hsum, ?_⟩ + · intro t + exact coefficientSlotFrequency_bound (fun s i => frequency t ⟨s, i⟩) (fun s i => hfreq t ⟨s, i⟩) + · intro x + simpa only [coefficientAmbientDensity_eq U b hb o c w f p hf hs x, + coefficientAmbientTorus_character, coefficientTorusFourierSum] using + herr (coefficientAmbientTorus U x) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientEvaluationTorus.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientEvaluationTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..0aa839d1038138e3a05be95d001f8fac97a8f46b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientEvaluationTorus.lean @@ -0,0 +1,68 @@ +import OAI.Combinatorics.Progressions.Estimates.CoefficientRowEvaluation + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +noncomputable def constantCoefficientTorusMap {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) : + CoefficientTorus (K := Empty) U →+ CoefficientTorus (K := K) U := + QuotientAddGroup.map (coefficientIntegerLattice U) (coefficientIntegerLattice U) + (constantCoefficientArray U).toAddMonoidHom + (constantCoefficientArray_preserves_lattice U) + +noncomputable def coefficientEvaluationTorus {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) : + CoefficientTorus (K := K) U →+ CoefficientTorus (K := Empty) U := + QuotientAddGroup.map (coefficientIntegerLattice U) (coefficientIntegerLattice U) + (coefficientEvaluationArray U t).toAddMonoidHom + (coefficientEvaluationArray_preserves_lattice U t) + +theorem constantCoefficientTorusMap_mk {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (x : CoefficientArray (K := Empty) U) : + constantCoefficientTorusMap (K := K) U (QuotientAddGroup.mk' (coefficientIntegerLattice U) x) = + QuotientAddGroup.mk' (coefficientIntegerLattice U) (constantCoefficientArray U x) := rfl + +theorem coefficientEvaluationTorus_mk {K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) (x : CoefficientArray (K := K) U) : + coefficientEvaluationTorus U t (QuotientAddGroup.mk' (coefficientIntegerLattice U) x) = + QuotientAddGroup.mk' (coefficientIntegerLattice U) (coefficientEvaluationArray U t x) := rfl + +theorem coefficientEvaluationTorus_constant {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) + (y : CoefficientTorus (K := Empty) U) : + coefficientEvaluationTorus U t (constantCoefficientTorusMap U y) = y := by + obtain ⟨x, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) y + rw [constantCoefficientTorusMap_mk, coefficientEvaluationTorus_mk, + coefficientEvaluationArray_constant] + +theorem constantCoefficientTorusMap_continuous {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) : + Continuous (constantCoefficientTorusMap (K := K) U) := by + apply (QuotientAddGroup.isQuotientMap_mk (coefficientIntegerLattice U)).continuous_iff.mpr + exact QuotientAddGroup.continuous_mk.comp (constantCoefficientArray U).continuous_of_finiteDimensional + +theorem coefficientEvaluationTorus_continuous {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) : + Continuous (coefficientEvaluationTorus U t) := by + apply (QuotientAddGroup.isQuotientMap_mk (coefficientIntegerLattice U)).continuous_iff.mpr + exact QuotientAddGroup.continuous_mk.comp (coefficientEvaluationArray U t).continuous_of_finiteDimensional + +theorem constantCoefficientTorusMap_nonconstant {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (y : CoefficientTorus (K := Empty) U) + (s : CoefficientSlot K m) (hs : s.2.val ≠ 0) : + coefficientCoordinateTorus U (constantCoefficientTorusMap U y) s = 0 := by + obtain ⟨x, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) y + rw [constantCoefficientTorusMap_mk, coefficientCoordinateTorus_mk] + have hzero : (fun _ : Unit => constantCoefficientArray (K := K) U x s) = 0 := by + funext u + simp [constantCoefficientArray, hs] + rw [hzero, map_zero] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientFourierTranslation.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientFourierTranslation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3709295f36c7c996d4ce7b888de70565dbc1f6b6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientFourierTranslation.lean @@ -0,0 +1,62 @@ +import Mathlib.MeasureTheory.Group.Integral +import OAI.Combinatorics.Progressions.Estimates.AllocatedFiberCap + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators + +variable {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +theorem coefficientTorusCharacter_add (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (y x : CoefficientTorus (K := K) U) : + coefficientTorusCharacter U frequency (y+x) = + coefficientTorusCharacter U frequency y * coefficientTorusCharacter U frequency x := + quotientLinearCharacter_add _ _ _ _ _ + +theorem coefficientTorusFourierSum_add + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (y x : CoefficientTorus (K := K) U) : + coefficientTorusFourierSum U frequency c (y+x) = + coefficientTorusFourierSum U frequency + (fun a => c a * coefficientTorusCharacter U (frequency a) y) x := by + simp only [coefficientTorusFourierSum, coefficientTorusCharacter_add, mul_assoc] + +theorem coefficientFourier_translate_norm + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (y : CoefficientTorus (K := K) U) : + (∑ a, ‖c a * coefficientTorusCharacter U (frequency a) y‖) = ∑ a, ‖c a‖ := by + simp only [norm_mul, coefficientTorusCharacter_norm, mul_one] + +theorem coefficientFourier_translate_approx (D : CoefficientTorus (K := K) U → ℝ) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) {δ : ℝ} + (happrox : ∀ x, ‖(D x : ℂ) - coefficientTorusFourierSum U frequency c x‖ ≤ δ) + (y x : CoefficientTorus (K := K) U) : + ‖(D (y+x) : ℂ) - coefficientTorusFourierSum U frequency + (fun a => c a * coefficientTorusCharacter U (frequency a) y) x‖ ≤ δ := by + rw [← coefficientTorusFourierSum_add] + exact happrox (y+x) + +theorem bounded_coefficient_translate_fiber_integrable + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + (μ : Measure (CoefficientTorus (K := K) U)) [IsFiniteMeasure μ] + (D : CoefficientTorus (K := K) U → ℝ) (hD : Measurable D) + {M : ℝ} (hbound : ∀ x, ‖D x‖ ≤ M) + (y : CoefficientTorus (K := K) U) (t : K → ℤ) + (z : CoefficientTorus (K := Empty) U) : + Integrable (fun x => D (y + coefficientFiberMap U t z x)) μ := by + apply Integrable.of_bound + (hD.comp (measurable_const.add (coefficientFiberMap_continuous U t z).measurable)).aestronglyMeasurable M + exact ae_of_all μ (fun x => hbound _) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientResidualCharacter.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientResidualCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..33da6605914b4002727757bc3bc3053af97fe700 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CoefficientResidualCharacter.lean @@ -0,0 +1,46 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedFiberCap +import OAI.Combinatorics.Progressions.Estimates.OneSiteCoefficientFactorization + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +noncomputable def coefficientResidualFunctional {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) + (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : CoefficientArray (K := K) U →ₗ[ℝ] ℝ := + (coefficientArrayFunctional U frequency).comp (coefficientResidualArray U t) + +theorem coefficientResidualFunctional_integral {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) + (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (x : CoefficientArray (K := K) U) (hx : x ∈ coefficientIntegerLattice U) : + ∃ n : ℤ, coefficientResidualFunctional U t frequency x = n := + coefficientArrayFunctional_integral U frequency _ + (coefficientResidualArray_preserves_lattice U t x hx) + +theorem coefficientTorusCharacter_fiber {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) + (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (y : CoefficientTorus (K := Empty) U) (x : CoefficientTorus (K := K) U) : + coefficientTorusCharacter U frequency (coefficientFiberMap U t y x) = + coefficientTorusCharacter U frequency (constantCoefficientTorusMap U y) * + quotientLinearCharacter (coefficientIntegerLattice U) (coefficientResidualFunctional U t frequency) + (coefficientResidualFunctional_integral U t frequency) x := by + unfold coefficientFiberMap + change quotientLinearCharacter _ _ _ (_ + _) = _ + rw [quotientLinearCharacter_add] + congr 1 + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + rw [coefficientEvaluationTorus_mk, constantCoefficientTorusMap_mk, ← map_sub] + rfl + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CokernelCharacterWitness.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CokernelCharacterWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6726dac625a4875a9dbe64d77c47ea5f5ec4220 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CokernelCharacterWitness.lean @@ -0,0 +1,60 @@ +import OAI.Combinatorics.Progressions.Fourier.PrimePowerCharacterScaling +import OAI.Combinatorics.Progressions.Lattices.IntegerCokernelExponent + +namespace OAI + +section + +namespace Erdos3 + +theorem integerCokernel_character {I : Type*} (L : Submodule ℤ (I → ℤ)) + [Finite ((I → ℤ) ⧸ L.toAddSubgroup)] : + ∃ χ : AddChar (I → ℤ) ℂ, orderOf χ = integerCokernelExponent L ∧ + ∀ x ∈ L, χ x = 1 := by + obtain ⟨ψ, hψ⟩ := exists_character_order_eq_exponent ((I → ℤ) ⧸ L.toAddSubgroup) + let q := QuotientAddGroup.mk' L.toAddSubgroup + refine ⟨characterPullback q ψ, + (characterPullback_order q (QuotientAddGroup.mk'_surjective _) ψ).trans hψ, ?_⟩ + intro x hx + change ψ (q x) = 1 + have hzero : q x = 0 := by + rw [QuotientAddGroup.mk'_apply, QuotientAddGroup.eq_zero_iff] + exact hx + rw [hzero, ψ.map_zero_eq_one] + +theorem integerLattice_pivot_period {I : Type*} [Fintype I] [DecidableEq I] + (L : Submodule ℤ (I → ℤ)) (A : Matrix I I ℤ) (hAin : A.mulVecLin.range ≤ L) : + integerScalarLattice I (A.det.natAbs : ℤ) ≤ L := by + rintro y ⟨z, rfl⟩ + change (A.det.natAbs : ℤ) • z ∈ L + exact hAin (integerMatrixImage_natAbs_smul A z) + +theorem integerCokernelExponent_le_det {I : Type*} [Fintype I] [DecidableEq I] + (L : Submodule ℤ (I → ℤ)) (A : Matrix I I ℤ) (hA : A.det ≠ 0) + (hAin : A.mulVecLin.range ≤ L) : + 0 < integerCokernelExponent L ∧ integerCokernelExponent L ≤ A.det.natAbs := by + let : NeZero A.det.natAbs := ⟨Int.natAbs_ne_zero.mpr hA⟩ + have hp := integerLattice_pivot_period L A hAin + let : Finite ((I → ℤ) ⧸ L.toAddSubgroup) := integerCokernel_finite L A.det.natAbs hp + exact ⟨integerCokernelExponent_pos L, + Nat.le_of_dvd (Int.natAbs_pos.mpr hA) (integerCokernelExponent_dvd_period L A.det.natAbs hp)⟩ + +theorem exists_bounded_annihilating_character {I : Type*} [Fintype I] [DecidableEq I] + (L : Submodule ℤ (I → ℤ)) (A : Matrix I I ℤ) (hA : A.det ≠ 0) + (hAin : A.mulVecLin.range ≤ L) (B : ℕ) (hB : B < integerCokernelExponent L) : + ∃ χ : AddChar (I → ℤ) ℂ, + B < orderOf χ ∧ orderOf χ ≤ A.det.natAbs ∧ ∀ x ∈ L, χ x = 1 := by + let : NeZero A.det.natAbs := ⟨Int.natAbs_ne_zero.mpr hA⟩ + let : Finite ((I → ℤ) ⧸ L.toAddSubgroup) := + integerCokernel_finite L A.det.natAbs (integerLattice_pivot_period L A hAin) + obtain ⟨χ, hχ, hann⟩ := integerCokernel_character L + refine ⟨χ, ?_, ?_, hann⟩ + · rwa [hχ] + · rw [hχ] + exact (integerCokernelExponent_le_det L A hA hAin).2 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CommonCoveredSiteCharacter.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CommonCoveredSiteCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f229f293211bc17d59c8a184ad086bddc3240fb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CommonCoveredSiteCharacter.lean @@ -0,0 +1,381 @@ +import OAI.Combinatorics.Progressions.Estimates.CocycleHorizontalNormalization +import OAI.Combinatorics.Progressions.Estimates.LinearQuotientCoverAverage +import OAI.Combinatorics.Progressions.Lattices.NormalizedLatticeSheet + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def subspaceArrayIntegerLattice (I : Type*) {J : Type*} (U : Submodule ℝ (J → ℝ)) : + AddSubgroup (I → U) where + carrier := {x | ∀ i a, ∃ n : ℤ, (x i).val a = n} + zero_mem' i a := ⟨0, by simp⟩ + add_mem' := by + intro x y hx hy i a + obtain ⟨n, hn⟩ := hx i a + obtain ⟨m, hm⟩ := hy i a + refine ⟨n + m, ?_⟩ + change (x i).val a + (y i).val a = ((n + m : ℤ) : ℝ) + rw [hn, hm, Int.cast_add] + neg_mem' := by + intro x hx i a + obtain ⟨n, hn⟩ := hx i a + refine ⟨-n, ?_⟩ + change -(x i).val a = ((-n : ℤ) : ℝ) + rw [hn, Int.cast_neg] + +abbrev SubspaceArrayTorus (I : Type*) {J : Type*} (U : Submodule ℝ (J → ℝ)) := + (I → U) ⧸ subspaceArrayIntegerLattice I U + +theorem subspaceArrayFunctional_integral {I J : Type*} [Fintype I] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (frequency : Matrix I J ℤ) + (x : I → U) (hx : x ∈ subspaceArrayIntegerLattice I U) : + ∃ n : ℤ, subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x = n := by + change ∀ i a, ∃ n : ℤ, (x i).val a = n at hx + choose z hz using hx + refine ⟨∑ i, ∑ a, frequency i a * z i a, ?_⟩ + change (∑ i, ∑ a, (frequency i a : ℝ) * (x i).val a) = _ + simp only [hz, Int.cast_sum, Int.cast_mul] + +noncomputable def subspaceArrayCharacter {I J : Type*} [Fintype I] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (frequency : Matrix I J ℤ) : SubspaceArrayTorus I U → ℂ := + quotientLinearCharacter (subspaceArrayIntegerLattice I U) + (subspaceArrayFunctional U (fun i a => (frequency i a : ℝ))) + (subspaceArrayFunctional_integral U frequency) + +theorem subspaceArrayCharacter_mk {I J : Type*} [Fintype I] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (frequency : Matrix I J ℤ) (x : I → U) : + subspaceArrayCharacter U frequency (QuotientAddGroup.mk' (subspaceArrayIntegerLattice I U) x) = + CircleFourier.character (subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x : CircleFourier.Circle) := rfl + +theorem subspaceArrayCharacter_norm {I J : Type*} [Fintype I] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (frequency : Matrix I J ℤ) (x : SubspaceArrayTorus I U) : + ‖subspaceArrayCharacter U frequency x‖ = 1 := quotientLinearCharacter_norm _ _ _ x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem subspaceArrayFunctional_mul_frequency {S J : Type*} [Fintype S] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (b : Matrix S J ℤ) (r : ℕ) (x : S → U) : + subspaceArrayFunctional U (fun s a => (((r : ℤ) * b s a : ℤ) : ℝ)) x = + (r : ℝ) * subspaceArrayFunctional U (fun s a => (b s a : ℝ)) x := by + change (∑ s, ∑ a, (((r : ℤ) * b s a : ℤ) : ℝ) * (x s).val a) = + (r : ℝ) * (∑ s, ∑ a, (b s a : ℝ) * (x s).val a) + simp only [Int.cast_mul, Int.cast_natCast, Finset.mul_sum, mul_assoc] + +theorem subspaceArrayCharacter_period_multiple {S J : Type*} [Fintype S] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (b : Matrix S J ℤ) + (q r : ℕ) (hq : 0 < q) (hr : 0 < r) (x : S → U) : + subspaceArrayCharacter U (fun s a => (r : ℤ) * b s a) + (QuotientAddGroup.mk' (subspaceArrayIntegerLattice S U) (((q * r : ℕ) : ℝ)⁻¹ • x)) = + subspaceArrayCharacter U b + (QuotientAddGroup.mk' (subspaceArrayIntegerLattice S U) ((q : ℝ)⁻¹ • x)) := by + have hq0 : (q : ℝ) ≠ 0 := by exact_mod_cast hq.ne' + have hr0 : (r : ℝ) ≠ 0 := by exact_mod_cast hr.ne' + change CircleFourier.character + (subspaceArrayFunctional U (fun s a => (((r : ℤ) * b s a : ℤ) : ℝ)) + (((q * r : ℕ) : ℝ)⁻¹ • x) : CircleFourier.Circle) = + CircleFourier.character + (subspaceArrayFunctional U (fun s a => (b s a : ℝ)) ((q : ℝ)⁻¹ • x) : CircleFourier.Circle) + apply congrArg (fun y : ℝ => CircleFourier.character (y : CircleFourier.Circle)) + have he : (r : ℝ) * ((q * r : ℕ) : ℝ)⁻¹ = (q : ℝ)⁻¹ := by + push_cast + field_simp + calc + _ = (r : ℝ) * subspaceArrayFunctional U (fun s a => (b s a : ℝ)) (((q * r : ℕ) : ℝ)⁻¹ • x) := + subspaceArrayFunctional_mul_frequency U b r _ + _ = _ := by rw [map_smul, map_smul, smul_eq_mul, smul_eq_mul, ← mul_assoc, he] + +end Erdos3 + +end + +section + +namespace Erdos3 + +def arrayCoordinateLinear {I J : Type*} (U : Submodule ℝ (J → ℝ)) (i : I) : + (I → U) →ₗ[ℝ] (Unit → U) where + toFun x _ := x i + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def arrayCoordinateTorus {I J : Type*} (U : Submodule ℝ (J → ℝ)) : + SubspaceArrayTorus I U →+ (I → SubspaceArrayTorus Unit U) := + AddMonoidHom.pi (fun i => QuotientAddGroup.map (subspaceArrayIntegerLattice I U) + (subspaceArrayIntegerLattice Unit U) (arrayCoordinateLinear U i).toAddMonoidHom + (fun _x hx _ a => hx i a)) + +theorem arrayCoordinateTorus_mk {I J : Type*} (U : Submodule ℝ (J → ℝ)) (x : I → U) (i : I) : + arrayCoordinateTorus U (QuotientAddGroup.mk' (subspaceArrayIntegerLattice I U) x) i = + QuotientAddGroup.mk' (subspaceArrayIntegerLattice Unit U) (fun _ => x i) := rfl + +theorem arrayCoordinateTorus_bijective {I J : Type*} (U : Submodule ℝ (J → ℝ)) : + Function.Bijective (arrayCoordinateTorus (I := I) U) := by + constructor + · intro x y h + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice I U) x + obtain ⟨w, rfl⟩ := QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice I U) y + apply QuotientAddGroup.eq_iff_sub_mem.mpr + intro i a + exact (QuotientAddGroup.eq_iff_sub_mem.mp (congrFun h i)) () a + · intro y + choose v hv using fun i => QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice Unit U) (y i) + refine ⟨QuotientAddGroup.mk' (subspaceArrayIntegerLattice I U) (fun i => v i ()), ?_⟩ + funext i + rw [arrayCoordinateTorus_mk] + have he : (fun _ : Unit => v i ()) = v i := funext (fun u => by cases u; rfl) + rw [he, hv i] + +noncomputable def arrayCoordinateEquiv {I J : Type*} (U : Submodule ℝ (J → ℝ)) : + SubspaceArrayTorus I U ≃+ (I → SubspaceArrayTorus Unit U) := + AddEquiv.ofBijective (arrayCoordinateTorus U) (arrayCoordinateTorus_bijective U) + +theorem arrayCoordinateEquiv_continuous {I J : Type*} [Fintype I] [Fintype J] + (U : Submodule ℝ (J → ℝ)) : Continuous (arrayCoordinateEquiv (I := I) U) := by + apply continuous_pi + intro i + apply (QuotientAddGroup.isQuotientMap_mk (subspaceArrayIntegerLattice I U)).continuous_iff.mpr + exact QuotientAddGroup.continuous_mk.comp (arrayCoordinateLinear U i).continuous_of_finiteDimensional + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem integerMatrix_preserves_array_lattice {I S J : Type*} [Fintype I] + (U : Submodule ℝ (J → ℝ)) (E : Matrix S I ℤ) (x : I → U) + (hx : x ∈ subspaceArrayIntegerLattice I U) : + matrixModuleAction (fun s i => (E s i : ℝ)) x ∈ subspaceArrayIntegerLattice S U := by + classical + change ∀ i a, ∃ n : ℤ, (x i).val a = n at hx + choose z hz using hx + intro s a + refine ⟨∑ i, E s i * z i a, ?_⟩ + change (∑ i, (E s i : ℝ) • x i).val a = _ + simp only [Submodule.coe_sum, Finset.sum_apply, Submodule.coe_smul, Pi.smul_apply, + smul_eq_mul, hz, Int.cast_sum, Int.cast_mul] + +noncomputable def integerMatrixTorusMap {I S J : Type*} [Fintype I] + (U : Submodule ℝ (J → ℝ)) (E : Matrix S I ℤ) : + SubspaceArrayTorus I U →+ SubspaceArrayTorus S U := + QuotientAddGroup.map (subspaceArrayIntegerLattice I U) (subspaceArrayIntegerLattice S U) + (matrixModuleAction (fun s i => (E s i : ℝ))).toAddMonoidHom + (fun x hx => integerMatrix_preserves_array_lattice U E x hx) + +theorem integerMatrixTorusMap_mk {I S J : Type*} [Fintype I] + (U : Submodule ℝ (J → ℝ)) (E : Matrix S I ℤ) (x : I → U) : + integerMatrixTorusMap U E (QuotientAddGroup.mk' (subspaceArrayIntegerLattice I U) x) = + QuotientAddGroup.mk' (subspaceArrayIntegerLattice S U) + (matrixModuleAction (fun s i => (E s i : ℝ)) x) := rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +def unitSubspaceCoordinate {J : Type*} (U : Submodule ℝ (J → ℝ)) (a : J) : + (Unit → U) →ₗ[ℝ] ℝ where + toFun x := (x ()).val a + map_add' _ _ := rfl + map_smul' _ _ := rfl + +noncomputable def subspaceAmbientTorus {J : Type*} (U : Submodule ℝ (J → ℝ)) : + SubspaceArrayTorus Unit U →+ (J → UnitAddCircle) := + AddMonoidHom.pi (fun a => quotientLinearPhase (subspaceArrayIntegerLattice Unit U) + (unitSubspaceCoordinate U a) (fun _x hx => hx () a)) + +theorem subspaceAmbientTorus_mk {J : Type*} (U : Submodule ℝ (J → ℝ)) (x : Unit → U) (a : J) : + subspaceAmbientTorus U (QuotientAddGroup.mk' (subspaceArrayIntegerLattice Unit U) x) a = + ((x ()).val a : UnitAddCircle) := rfl + +theorem subspaceAmbientTorus_continuous {J : Type*} [Fintype J] (U : Submodule ℝ (J → ℝ)) : + Continuous (subspaceAmbientTorus U) := by + apply continuous_pi + intro a + apply (QuotientAddGroup.isQuotientMap_mk (subspaceArrayIntegerLattice Unit U)).continuous_iff.mpr + exact (AddCircle.continuous_mk' (1 : ℝ)).comp + (unitSubspaceCoordinate U a).continuous_of_finiteDimensional + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem subspaceArrayCharacter_cover_factorization {I S J : Type*} + [Fintype I] [Fintype S] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (E : Matrix S I ℤ) (q : ℕ) (hq : 0 < q) + (frequency : Matrix I J ℤ) (b : Matrix S J ℤ) + (hfactor : ∀ x : I → U, subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x = + subspaceArrayFunctional U (fun s a => (b s a : ℝ)) + (matrixModuleAction (fun s i => (E s i : ℝ)) ((q : ℝ)⁻¹ • x))) + (x : SubspaceArrayTorus I U) : + subspaceArrayCharacter U frequency (quotientIntegerCover (subspaceArrayIntegerLattice I U) q x) = + subspaceArrayCharacter U b (integerMatrixTorusMap U E x) := by + have hq0 : (q : ℝ) ≠ 0 := by exact_mod_cast hq.ne' + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice I U) x + rw [quotientIntegerCover_mk, integerMatrixTorusMap_mk, subspaceArrayCharacter_mk, subspaceArrayCharacter_mk] + have he := hfactor ((q : ℝ) • v) + simp only [smul_smul, inv_mul_cancel₀ hq0, one_smul] at he + rw [he] + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {D : Type*} [Fintype D] (U : Submodule ℝ (D → ℝ)) + +noncomputable def euclideanSubspace : Submodule ℝ (EuclideanSpace ℝ D) := + U.comap (PiLp.continuousLinearEquiv 2 ℝ (fun _ : D => ℝ)).toLinearMap + +noncomputable def euclideanSubspaceArrayEquiv : euclideanSubspace U ≃L[ℝ] (Unit → U) where + toFun x _ := ⟨WithLp.ofLp x.val, x.property⟩ + invFun x := ⟨WithLp.toLp 2 (x ()).val, (x ()).property⟩ + left_inv _ := rfl + right_inv x := by funext u; cases u; rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + continuous_toFun := by + apply continuous_pi + intro u + exact ((PiLp.continuousLinearEquiv 2 ℝ (fun _ : D => ℝ)).continuous.comp + continuous_subtype_val).subtype_mk _ + continuous_invFun := by + exact ((PiLp.continuousLinearEquiv 2 ℝ (fun _ : D => ℝ)).symm.continuous.comp + (continuous_subtype_val.comp (continuous_apply ()))).subtype_mk _ + +omit [Fintype D] in +theorem euclideanSubspaceArrayEquiv_apply (x : euclideanSubspace U) (u : Unit) (i : D) : + (euclideanSubspaceArrayEquiv U x u).val i = x.val i := rfl + +theorem euclideanSubspaceArrayEquiv_mem_lattice (x : euclideanSubspace U) : + euclideanSubspaceArrayEquiv U x ∈ subspaceArrayIntegerLattice Unit U ↔ + x ∈ latticeSection (standardEuclideanLattice D) (euclideanSubspace U) := by + change (∀ u i, ∃ n : ℤ, x.val i = n) ↔ x.val ∈ standardEuclideanLattice D + rw [mem_standardEuclideanLattice] + constructor + · intro h i + obtain ⟨n, hn⟩ := h () i + exact ⟨n, hn.symm⟩ + · intro h u i + obtain ⟨n, hn⟩ := h i + exact ⟨n, hn.symm⟩ + +theorem euclideanSubspaceArrayEquiv_map_lattice : + (latticeSection (standardEuclideanLattice D) (euclideanSubspace U)).toAddSubgroup.map + (euclideanSubspaceArrayEquiv U).toLinearEquiv.toAddEquiv.toAddMonoidHom = + subspaceArrayIntegerLattice Unit U := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact (euclideanSubspaceArrayEquiv_mem_lattice U x).mpr hx + · intro hy + refine ⟨(euclideanSubspaceArrayEquiv U).symm y, ?_, + (euclideanSubspaceArrayEquiv U).apply_symm_apply y⟩ + exact (euclideanSubspaceArrayEquiv_mem_lattice U _).mp (by simpa using hy) + +noncomputable def euclideanSubspaceTorusEquiv : + (euclideanSubspace U ⧸ + (latticeSection (standardEuclideanLattice D) (euclideanSubspace U)).toAddSubgroup) ≃+ + SubspaceArrayTorus Unit U := + QuotientAddGroup.congr _ _ (euclideanSubspaceArrayEquiv U).toLinearEquiv.toAddEquiv + (euclideanSubspaceArrayEquiv_map_lattice U) + +instance euclideanSubspaceLattice_discrete : + DiscreteTopology (latticeSection (standardEuclideanLattice D) (euclideanSubspace U)).toAddSubgroup := + latticeSection_discrete (standardEuclideanLattice D) (euclideanSubspace U) + +instance euclideanSubspaceLattice_closed : + IsClosed ((latticeSection (standardEuclideanLattice D) (euclideanSubspace U)).toAddSubgroup : + Set (euclideanSubspace U)) := AddSubgroup.isClosed_of_discreteTopology + +theorem euclideanSubspaceTorusEquiv_mk (x : euclideanSubspace U) : + euclideanSubspaceTorusEquiv U (QuotientAddGroup.mk' _ x) = + QuotientAddGroup.mk' _ (euclideanSubspaceArrayEquiv U x) := rfl + +theorem euclideanSubspaceTorusEquiv_continuous : Continuous (euclideanSubspaceTorusEquiv U) := by + apply (QuotientAddGroup.isQuotientMap_mk _).continuous_iff.mpr + exact QuotientAddGroup.continuous_mk.comp (euclideanSubspaceArrayEquiv U).continuous + +theorem euclideanSubspaceTorusEquiv_symm_continuous : + Continuous (euclideanSubspaceTorusEquiv U).symm := by + apply (QuotientAddGroup.isQuotientMap_mk (subspaceArrayIntegerLattice Unit U)).continuous_iff.mpr + exact QuotientAddGroup.continuous_mk.comp (euclideanSubspaceArrayEquiv U).symm.continuous + +noncomputable def euclideanSubspaceTorusHomeomorph : + (euclideanSubspace U ⧸ + (latticeSection (standardEuclideanLattice D) (euclideanSubspace U)).toAddSubgroup) ≃ₜ + SubspaceArrayTorus Unit U where + toEquiv := (euclideanSubspaceTorusEquiv U).toEquiv + continuous_toFun := euclideanSubspaceTorusEquiv_continuous U + continuous_invFun := euclideanSubspaceTorusEquiv_symm_continuous U + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem exists_common_covered_site_character : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {I S : Type*} + [Fintype I] [Fintype S] [DecidableEq I] [DecidableEq S] + (E : Matrix S I ℤ) {H : ℕ} (_hH : 1 ≤ H) + (_hE : ∀ s i, RationalHeightLE (E s i : ℚ) H) + {P : ℝ} (_hP : 0 ≤ P) (_hI : (Fintype.card I : ℝ) ≤ P) + (_hS : (Fintype.card S : ℝ) ≤ P) (_hHP : (H : ℝ) ≤ Real.exp P), + ∃ q : ℕ, 0 < q ∧ (q : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ {J : Type*} [Fintype J] (U : Submodule ℝ (J → ℝ)) (frequency : Matrix I J ℤ) + {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) + (_hfrequency : ∀ i a, |(frequency i a : ℝ)| ≤ C) + (M : (S → U) →ₗ[ℝ] ℝ) + (_hfactor : ∀ x, subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x = + M (matrixModuleAction (fun s i => (E s i : ℝ)) x)), + ∃ b : Matrix S J ℤ, (∀ s a, |(b s a : ℝ)| ≤ Real.exp ((P + A) ^ A)) ∧ + ∀ x : SubspaceArrayTorus I U, + subspaceArrayCharacter U frequency (quotientIntegerCover (subspaceArrayIntegerLattice I U) q x) = + subspaceArrayCharacter U b (integerMatrixTorusMap U E x) := by + obtain ⟨A, hA, hdenominator⟩ := exists_common_site_denominator + refine ⟨A, hA, ?_⟩ + intro I S _ _ _ _ E H hH hE P hP hI hS hHP + obtain ⟨q, hq, hqP, hrows⟩ := hdenominator (fun s i => (E s i : ℚ)) hH hE hP hI hS hHP + refine ⟨q, hq, hqP, ?_⟩ + intro J _ U frequency C hC hCP hfrequency M hfactor + obtain ⟨b, hb, he⟩ := hrows U frequency hC hCP hfrequency M + (fun x => by simpa only [Rat.cast_intCast] using hfactor x) + refine ⟨b, hb, ?_⟩ + exact subspaceArrayCharacter_cover_factorization U E q hq frequency b + (fun x => by simpa only [Rat.cast_intCast] using he x) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CommonDependentWordFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CommonDependentWordFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..01103ba3d48113cabafa7164fe5d93a7670c24b7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CommonDependentWordFrequency.lean @@ -0,0 +1,62 @@ +import OAI.Combinatorics.Progressions.Estimates.CommonDependentWordLayers +import OAI.Combinatorics.Progressions.Estimates.FreeCorrelationRelationRefinement + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + {Q : ℝ} (B : D.CoefficientBases Q) + +theorem CoefficientBases.dependent_word_frequency_zero (a : FreeMagma D.CoefficientAlphabet) + (hd : lieTreeWeight D.coefficientWeight a = s) (hr : a.length = r) + (ha : 2 ≤ lieTreeMarkedCount D.coefficientIsDependent a) : + B.freeFrequency D (lieTreeEval D.coefficientFreeGenerator a) = 0 := by + obtain ⟨i, j, hij, hi, hj⟩ := exists_two_marked_occurrences D.coefficientIsDependent a ha + have hweight : + lieTreeWeight (fun k => (D.coefficientLayerIndex (lieTreeOccurrenceLabel a k)).val + 1) + (lieTreeOccurrenceTree a) = s := by + simp only [← D.coefficientWeight_eq_layerIndex] + exact (lieTreeOccurrenceTree_weight D.coefficientWeight a).trans hd + have h := B.finite_combined_free_sunflower D + (fun k => D.coefficientLayerIndex (lieTreeOccurrenceLabel a k)) + (lieTreeOccurrenceTree a) hweight ((lieTreeOccurrenceTree_length a).trans hr) + (D.coefficientFreeGenerator ∘ lieTreeOccurrenceLabel a) + (fun k => D.coefficientFreeGenerator_mem_combined (lieTreeOccurrenceLabel a k)) + i j hij (by rw [lieTreeOccurrenceTree_support]; trivial) + (by rw [lieTreeOccurrenceTree_support]; trivial) + (D.coefficientFreeGenerator_mem_dependent _ hi) + (D.coefficientFreeGenerator_mem_dependent _ hj) + rwa [lieTreeOccurrenceTree_eval] at h + +theorem CoefficientBases.dependentWordLayer_top_le_ker : + D.dependentWordLayer s 2 r ≤ (B.freeFrequency D).ker := + markedLieSpan_top_le_ker D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent D.coefficientFreeGenerator_mem_layer + 2 (B.freeFrequency D) (B.dependent_word_frequency_zero D) + +theorem CoefficientBases.real_dependentWordLayer_top_frequency_zero + (x : ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (hx : x ∈ (D.dependentWordLayer s 2 r).baseChange ℝ) : + realifyFunctional (B.freeFrequency D) x = 0 := + (mem_realified_frequency_kernel_iff (B.freeFrequency D) x).mp + (Submodule.baseChange_mono ℝ (B.dependentWordLayer_top_le_ker D) hx) + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CommonMarkedFrequencyModel.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CommonMarkedFrequencyModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..32f5967de3a75e6c2c4a4abee2a6d1a45f2b82a9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CommonMarkedFrequencyModel.lean @@ -0,0 +1,442 @@ +import OAI.Combinatorics.Progressions.Dynamics.MarkedEvaluationHeightBudget +import OAI.Combinatorics.Progressions.Estimates.CommonMarkedMultidegree +import OAI.Combinatorics.Progressions.Estimates.MultidegreeIntegralModel + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open Module + +theorem exists_bounded_integral_model_with_frequency + {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + (e : Basis (Fin d) ℚ L) + (b : ∀ a, Basis (Fin (finrank ℚ (F.layer a))) ℚ (F.layer a)) + {H : ℕ} (hb : ∀ a i j, RationalHeightLE (e.repr ((b a) i).val j) H) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants e i j k) H) + (ξ : L →ₗ[ℚ] ℚ) (hξ : ∀ i, RationalHeightLE (ξ (e i)) H) + (l : ℕ) (hl : 0 < l) : + ∃ B : ℕ, 0 < B ∧ l ∣ B ∧ B ≤ bchIntegralDenominatorBound s * H ^ (d ^ 3) * (l * H ^ d) ∧ + ∃ D : RationalFilteredNilmanifold L s d, ∃ M : D.MultidegreeStructure bound, + M.filtration = F ∧ D.basis = e ∧ D.grid = B ∧ + bchSubgroupCoordinates D.basis D.lattice = scaledIntegerGrid B ∧ + (∀ z : D.filtration.Group, z ∈ D.lattice → ∃ n : ℤ, ξ z.coord = n) ∧ + ∀ p : ℝ, (d : ℝ) ≤ p → (B : ℝ) ≤ Real.exp p → (H : ℝ) ≤ Real.exp p → M.ComplexityLE p := by + classical + let k := arrayDenominator (fun i => ξ (e i)) + have hk : 0 < k := arrayDenominator_pos _ + have hkH : k ≤ H ^ d := by + simpa only [Fintype.card_fin] using arrayDenominator_le (fun i => ξ (e i)) (fun i => (hξ i).2) + obtain ⟨B, hB, hdiv, hbound, D, M, hMF, hDe, hDB, hcoords, hcomplex⟩ := + F.exists_bounded_integral_model e b hb hc (l * k) (Nat.mul_pos hl hk) + refine ⟨B, hB, (dvd_mul_right l k).trans hdiv, + hbound.trans (Nat.mul_le_mul_left _ (Nat.mul_le_mul_left l hkH)), + D, M, hMF, hDe, hDB, hcoords, ?_, hcomplex⟩ + intro z hz + have hgrid : D.basis.equivFun z.coord ∈ scaledIntegerGrid B := by + rw [← hcoords] + change (⟨D.basis.equivFun.symm (D.basis.equivFun z.coord)⟩ : D.filtration.Group) ∈ D.lattice + simpa only [LinearEquiv.symm_apply_apply] using hz + rw [hDe] at hgrid + apply coordinateGrid_functional_integral e ξ k B ((dvd_mul_left k l).trans hdiv) + (fun i => ⟨clearedArray (fun j => ξ (e j)) i, (clearedArray_cast _ i).symm⟩) hgrid + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3 + +theorem markedPolynomialValueHeight_le_exp (s n T K A : ℕ) {p : ℝ} (hp : 0 ≤ p) + (hs : (s : ℝ) ≤ p) (hn : (n : ℝ) ≤ p) + (hT : (T : ℝ) ≤ Real.exp p) (hK : (K : ℝ) ≤ Real.exp p) + (hA : (A : ℝ) ≤ Real.exp p) : + ((A ^ s * ((n + 1) * (T * K) ^ n) : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 5) := by + have hpower : ((A ^ s : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 2) := by + rw [Nat.cast_pow] + calc + _ ≤ Real.exp p ^ s := pow_le_pow_left₀ (Nat.cast_nonneg _) hA _ + _ = Real.exp ((s : ℝ) * p) := (Real.exp_nat_mul _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith only [hs, hp, sq_nonneg p]) + have hproduct : ((T * K : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 2) := by + rw [Nat.cast_mul] + calc + _ ≤ Real.exp p * Real.exp p := mul_le_mul hT hK (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = Real.exp (p + p) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith only [hp, sq_nonneg p]) + have hsum := rational_sum_cost_le_exp n (T * K) hp 2 1 hproduct + (by simpa only [pow_one] using hn.trans (by linarith only [hp] : p ≤ p + 2)) + rw [Nat.cast_mul] + calc + _ ≤ Real.exp ((p + 2) ^ 2) * Real.exp ((p + 2) ^ 4) := + mul_le_mul hpower hsum (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = Real.exp ((p + 2) ^ 2 + (p + 2) ^ 4) := (Real.exp_add _ _).symm + _ ≤ _ := by + apply Real.exp_le_exp.mpr + have hpow : (p + 2) ^ 2 ≤ (p + 2) ^ 4 := + pow_le_pow_right₀ (by linarith only [hp]) (by decide) + calc + _ ≤ 2 * (p + 2) ^ 4 := by linarith only [hpow] + _ ≤ (p + 2) * (p + 2) ^ 4 := + mul_le_mul_of_nonneg_right (by linarith only [hp]) (by positivity) + _ = (p + 2) ^ 5 := by ring + +theorem markedQuotientFrequencyHeight_le_exp (s n a d m u H K A : ℕ) + {p : ℝ} (hp : 0 ≤ p) (hs : (s + 1 : ℕ) ≤ p) + (hn : (n : ℝ) ≤ p) (ha : (a : ℝ) ≤ p) (hd : (d : ℝ) ≤ p) + (hm : (m : ℝ) ≤ p) (hu : (u : ℝ) ≤ p) + (hH : (H : ℝ) ≤ Real.exp p) (hK : (K : ℝ) ≤ Real.exp p) + (hA : (A : ℝ) ≤ Real.exp p) : + (markedQuotientFrequencyHeight s n a d m u H K A : ℝ) ≤ + Real.exp ((p + 2) ^ ((5082 * s + 3566) * 8)) := by + let g := 5082 * s + 3564 + let R := (p + 2) ^ g + let T := lieTreeHeight n H s + let B := (a + 1) * (rationalSolveHeight d T * T) ^ a + let Q := rationalKernelHeight m B + let E := (d + 1) * (B * Q) ^ d + let V := A ^ s * ((n + 1) * (T * K) ^ n) + have hpR : p ≤ R := le_power_budget hp (by dsimp [g]; omega) + have hR : 0 ≤ R := hp.trans hpR + have hE : (E : ℝ) ≤ Real.exp R := by + have he : E ≤ markedQuotientHeight s n a d m 0 H := Nat.le_max_right _ _ + exact (Nat.cast_le.mpr he).trans + (markedQuotientHeight_le_exp s n a d m 0 H hp hs hn ha hd hm (by simpa using hp) hH) + let z := 6 * s + 2 + let S := (p + 2) ^ z + have hpS : p ≤ S := le_power_budget hp (by dsimp [z]; omega) + have hS : 0 ≤ S := hp.trans hpS + have hsS : (s : ℝ) ≤ S := by + have hss : (s : ℝ) ≤ (s + 1 : ℕ) := by exact_mod_cast Nat.le_succ s + exact hss.trans (hs.trans hpS) + have hV₀ := markedPolynomialValueHeight_le_exp s n T K A hS hsS (hn.trans hpS) + (lieTreeHeight_le_exp n H s hp hn hH) + (hK.trans (Real.exp_le_exp.mpr hpS)) (hA.trans (Real.exp_le_exp.mpr hpS)) + have hV : (V : ℝ) ≤ Real.exp R := by + have hb := exponential_budget_comp hp hS z 5 le_rfl hV₀ + apply hb.trans (Real.exp_le_exp.mpr ?_) + exact pow_le_pow_right₀ (by linarith only [hp]) (by dsimp [g, z]; omega) + have hfreq := embedding_coordinate_height_budget u u E V hR (hu.trans hpR) (hu.trans hpR) hE hV + have hout := exponential_budget_comp hp hR g 8 le_rfl hfreq + exact hout + +theorem markedQuotientJointHeight_le_exp (s n a d m q u H K A : ℕ) + {p : ℝ} (hp : 0 ≤ p) (hs : (s + 1 : ℕ) ≤ p) + (hn : (n : ℝ) ≤ p) (ha : (a : ℝ) ≤ p) (hd : (d : ℝ) ≤ p) + (hm : (m : ℝ) ≤ p) (hq : (q : ℝ) ≤ p) (hu : (u : ℝ) ≤ p) + (hH : (H : ℝ) ≤ Real.exp p) (hK : (K : ℝ) ≤ Real.exp p) + (hA : (A : ℝ) ≤ Real.exp p) : + ((max (markedQuotientHeight s n a d m q H) + (markedQuotientFrequencyHeight s n a d m u H K A) : ℕ) : ℝ) ≤ + Real.exp ((p + 2) ^ ((5082 * s + 3566) * 8)) := by + rw [Nat.cast_max] + apply max_le + · apply (markedQuotientHeight_le_exp s n a d m q H hp hs hn ha hd hm hq hH).trans + (Real.exp_le_exp.mpr ?_) + exact pow_le_pow_right₀ (by linarith only [hp]) (by omega) + · exact markedQuotientFrequencyHeight_le_exp s n a d m u H K A hp hs hn ha hd hm hu hH hK hA + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module + +def markedQuotientJointHeight (s n a d m q u H K A : ℕ) : ℕ := + max (markedQuotientHeight s n a d m q H) (markedQuotientFrequencyHeight s n a d m u H K A) + +variable {I ι L : Type*} [Fintype I] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.associatedDegree.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (hω : ∀ i, ω i ≤ s) (v : I → L) (w : I → ℕ) (marked : I → Bool) + (hw : ∀ i, 0 < w i) (hv : ∀ i, v i ∈ F.layer (w i) 1) + {H : ℕ} (hH : 1 ≤ H) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants b i j k) H) + (hgen : ∀ i j, RationalHeightLE (b.repr (v i) j) H) + +include hF hω hH hc hgen in +theorem exists_markedShift_integral_frequency_model (t : ℕ) + (η : L →ₗ[ℚ] ℚ) {K A : ℕ} (hη : ∀ i, RationalHeightLE (η (b i)) K) + (x : Fin t → ℚ) (hA : 1 ≤ A) (hx : ∀ i, RationalHeightLE (x i) A) + (d₀ k₀ l₀ : ℕ) + (hann : markedShiftPolynomialSubmodule F v w marked t d₀ k₀ l₀ ⊓ + (markedShiftSecondIdeal F v w marked t).toSubmodule ≤ + (η.comp (markedShiftEval F v w marked t x)).ker) + (l : ℕ) (hl : 0 < l) : + let a := finrank ℚ (F.associatedDegree.PolynomialShiftAlgebra t) + let d := finrank ℚ (markedShiftSubalgebra F v w marked t) + ∃ m : ℕ, m ≤ finrank ℚ (markedShiftSecondIdeal F v w marked t).toSubmodule ∧ + ∃ q : ℕ, q ≤ d ∧ ∃ u : ℕ, u ≤ q ∧ ∃ B : ℕ, 0 < B ∧ l ∣ B ∧ + B ≤ bchIntegralDenominatorBound (s + 1) * + markedQuotientJointHeight s (Fintype.card ι) a d m q u H K A ^ (q ^ 3) * + (l * markedQuotientJointHeight s (Fintype.card ι) a d m q u H K A ^ q) ∧ + ∃ D : RationalFilteredNilmanifold (MarkedShiftQuotient F v w marked t) (s + 1) q, + ∃ M : D.MultidegreeStructure (mixedCorrelationDegree s), + ∃ ξ : MarkedShiftQuotient F v w marked t →ₗ[ℚ] ℚ, + M.filtration = markedShiftMultidegree F v w marked hw hv t ∧ D.grid = B ∧ + bchSubgroupCoordinates D.basis D.lattice = scaledIntegerGrid B ∧ + (∀ i, RationalHeightLE (ξ (D.basis i)) + (markedQuotientJointHeight s (Fintype.card ι) a d m q u H K A)) ∧ + (∀ z ∈ markedShiftPolynomialSubmodule F v w marked t d₀ k₀ l₀, + ξ (lieQuotientMap (markedShiftSecondIdeal F v w marked t) z) = + η (markedShiftEval F v w marked t x z)) ∧ + (∀ z : D.filtration.Group, z ∈ D.lattice → ∃ n : ℤ, ξ z.coord = n) ∧ + ∀ p : ℝ, (q : ℝ) ≤ p → (B : ℝ) ≤ Real.exp p → + (markedQuotientJointHeight s (Fintype.card ι) a d m q u H K A : ℝ) ≤ Real.exp p → + M.ComplexityLE p := by + classical + obtain ⟨m, hm, q, hq, u, hu, f, hstructure, hlayers, ξ, hξ, hheight⟩ := + exists_markedShiftQuotient_bounded_frequency_data F b ω hF hω v w marked hw hv hH hc hgen + t η hη x hA hx d₀ k₀ l₀ hann + let J := markedQuotientJointHeight s (Fintype.card ι) + (finrank ℚ (F.associatedDegree.PolynomialShiftAlgebra t)) + (finrank ℚ (markedShiftSubalgebra F v w marked t)) m q u H K A + choose c hc' using hlayers + have hcJ (α i j) : RationalHeightLE (f.repr ((c α) i).val j) J := + (hc' α i j).mono (Nat.le_max_left _ _) + have hξJ (i) : RationalHeightLE (ξ (f i)) J := (hheight i).mono (Nat.le_max_right _ _) + let M₀ := markedShiftMultidegree F v w marked hw hv t + obtain ⟨B, hB, hdiv, hbound, D, M, hMF, hDf, hDB, hcoords, hintegral, hcomplex⟩ := + M₀.exists_bounded_integral_model_with_frequency f c hcJ + (fun i j k => (hstructure i j k).mono (Nat.le_max_left _ _)) ξ hξJ l hl + refine ⟨m, hm, q, hq, u, hu, B, hB, hdiv, hbound, D, M, ξ, + hMF, hDB, hcoords, ?_, hξ, hintegral, hcomplex⟩ + simpa only [hDf] using hξJ + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem integral_frequency_grid_allowance_le_exp (K d H l : ℕ) {p : ℝ} (hp : 0 ≤ p) + (hd : (d : ℝ) ≤ p) (hH : (H : ℝ) ≤ Real.exp p) (hl : (l : ℝ) ≤ Real.exp p) : + ((K * H ^ (d ^ 3) * (l * H ^ d) : ℕ) : ℝ) ≤ + Real.exp (((p + 2) ^ 2 + (K + 5 : ℕ)) ^ (K + 5)) := by + have hpQ : p ≤ (p + 2) ^ 2 := le_power_budget hp (by decide) + have hlQ : ((l * H ^ d : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 2) := by + rw [Nat.cast_mul, Nat.cast_pow] + calc + _ ≤ Real.exp p * Real.exp p ^ d := + mul_le_mul hl (pow_le_pow_left₀ (Nat.cast_nonneg _) hH _) (by positivity) (Real.exp_nonneg _) + _ = Real.exp (p + (d : ℝ) * p) := by rw [← Real.exp_nat_mul, ← Real.exp_add] + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith only [hp, hd, sq_nonneg p]) + exact integral_grid_allowance_le_exp K d H (l * H ^ d) (hp.trans hpQ) (hd.trans hpQ) + (hH.trans (Real.exp_le_exp.mpr hpQ)) hlQ + +noncomputable def markedFrequencyHeightBudget (s : ℕ) (p : ℝ) : ℝ := + (markedShiftInputBudget s p + 2) ^ ((5082 * s + 3566) * 8) + +noncomputable def markedFrequencyModelBudget (s : ℕ) (p : ℝ) : ℝ := + markedFrequencyHeightBudget s p + + ((markedFrequencyHeightBudget s p + 2) ^ 2 + (bchIntegralDenominatorBound (s + 1) + 5 : ℕ)) ^ + (bchIntegralDenominatorBound (s + 1) + 5) + +theorem markedShiftInputBudget_le_frequencyHeight (s : ℕ) {p : ℝ} (hp : 0 ≤ p) : + markedShiftInputBudget s p ≤ markedFrequencyHeightBudget s p := + le_power_budget (markedShiftInputBudget_nonneg s hp) (by omega) + +theorem markedFrequencyHeightBudget_nonneg (s : ℕ) {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ markedFrequencyHeightBudget s p := + (markedShiftInputBudget_nonneg s hp).trans (markedShiftInputBudget_le_frequencyHeight s hp) + +theorem markedFrequencyHeightBudget_le_model (s : ℕ) {p : ℝ} (hp : 0 ≤ p) : + markedFrequencyHeightBudget s p ≤ markedFrequencyModelBudget s p := by + have hQ := markedFrequencyHeightBudget_nonneg s hp + exact le_add_of_nonneg_right (by positivity) + +theorem exists_markedFrequencyModel_budget (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → markedFrequencyModelBudget s p ≤ (p + C) ^ C := by + let Q : Polynomial ℕ := Polynomial.X * Polynomial.C (s + 1) * (Polynomial.X + 1) ^ s + + Polynomial.X + Polynomial.C (s + 1) + let U : Polynomial ℕ := (Q + 2) ^ ((5082 * s + 3566) * 8) + let K := bchIntegralDenominatorBound (s + 1) + 5 + obtain ⟨C, hC, h⟩ := exists_natPolynomial_eval_budget (U + ((U + 2) ^ 2 + Polynomial.C K) ^ K) + refine ⟨C, hC, ?_⟩ + intro p hp + simpa only [markedFrequencyModelBudget, markedFrequencyHeightBudget, markedShiftInputBudget, + Q, U, K, Polynomial.eval₂_add, Polynomial.eval₂_mul, Polynomial.eval₂_pow, + Polynomial.eval₂_X, Polynomial.eval₂_C, Polynomial.eval₂_one, Polynomial.eval₂_ofNat, + Nat.coe_castRingHom] using h p hp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module + +variable {I ι L : Type*} [Fintype I] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.associatedDegree.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (hω : ∀ i, ω i ≤ s) (v : I → L) (w : I → ℕ) (marked : I → Bool) + (hw : ∀ i, 0 < w i) (hv : ∀ i, v i ∈ F.layer (w i) 1) + {H : ℕ} (hH : 1 ≤ H) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants b i j k) H) + (hgen : ∀ i j, RationalHeightLE (b.repr (v i) j) H) + +include hF hω hH hc hgen in +theorem exists_markedShift_frequency_model_with_budget (t : ℕ) + (η : L →ₗ[ℚ] ℚ) {K A : ℕ} (hη : ∀ i, RationalHeightLE (η (b i)) K) + (x : Fin t → ℚ) (hA : 1 ≤ A) (hx : ∀ i, RationalHeightLE (x i) A) + (d₀ k₀ l₀ : ℕ) + (hann : markedShiftPolynomialSubmodule F v w marked t d₀ k₀ l₀ ⊓ + (markedShiftSecondIdeal F v w marked t).toSubmodule ≤ + (η.comp (markedShiftEval F v w marked t x)).ker) + (l : ℕ) (hl : 0 < l) {p : ℝ} (hp : 0 ≤ p) + (hn : (Fintype.card ι : ℝ) ≤ p) (ht : (t : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hKp : (K : ℝ) ≤ Real.exp p) + (hAp : (A : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) : + ∃ q : ℕ, q ≤ Fintype.card ι * (s + 1) * (t + 1) ^ s + t ∧ + ∃ D : RationalFilteredNilmanifold (MarkedShiftQuotient F v w marked t) (s + 1) q, + ∃ M : D.MultidegreeStructure (mixedCorrelationDegree s), + ∃ ξ : MarkedShiftQuotient F v w marked t →ₗ[ℚ] ℚ, + M.filtration = markedShiftMultidegree F v w marked hw hv t ∧ + M.ComplexityLE (markedFrequencyModelBudget s p) ∧ l ∣ D.grid ∧ + bchSubgroupCoordinates D.basis D.lattice = scaledIntegerGrid D.grid ∧ + (∀ i, rationalLogHeight (ξ (D.basis i)) ≤ markedFrequencyModelBudget s p) ∧ + (∀ z ∈ markedShiftPolynomialSubmodule F v w marked t d₀ k₀ l₀, + ξ (lieQuotientMap (markedShiftSecondIdeal F v w marked t) z) = + η (markedShiftEval F v w marked t x z)) ∧ + ∀ z : D.filtration.Group, z ∈ D.lattice → ∃ n : ℤ, ξ z.coord = n := by + let _ := F.associatedDegree.polynomialShift_finiteDimensional b ω hF hω t + let _ : FiniteDimensional ℚ (markedShiftSubalgebra F v w marked t) := + inferInstanceAs (FiniteDimensional ℚ (markedShiftSubalgebra F v w marked t).toSubmodule) + let a := finrank ℚ (F.associatedDegree.PolynomialShiftAlgebra t) + let d := finrank ℚ (markedShiftSubalgebra F v w marked t) + have ha : a ≤ Fintype.card ι * (s + 1) * (t + 1) ^ s + t := + F.associatedDegree.polynomialShift_finrank_le b ω hF hω t + have hd : d ≤ a := (markedShiftSubalgebra F v w marked t).toSubmodule.finrank_le + have hi : finrank ℚ (markedShiftSecondIdeal F v w marked t).toSubmodule ≤ d := + (markedShiftSecondIdeal F v w marked t).toSubmodule.finrank_le + let R := markedShiftInputBudget s p + let Q := markedFrequencyHeightBudget s p + have hpR : p ≤ R := le_markedShiftInputBudget s hp + have hR : 0 ≤ R := markedShiftInputBudget_nonneg s hp + have hRQ : R ≤ Q := markedShiftInputBudget_le_frequencyHeight s hp + have hQS : Q ≤ markedFrequencyModelBudget s p := markedFrequencyHeightBudget_le_model s hp + have haR : (a : ℝ) ≤ R := (Nat.cast_le.mpr ha).trans + (markedShift_dimension_budget s (Fintype.card ι) t hp hn ht) + have hdR : (d : ℝ) ≤ R := (Nat.cast_le.mpr hd).trans haR + obtain ⟨m, hm, q, hq, u, hu, B, hB, hdiv, hbound, D, M, ξ, + hMF, hgrid, hcoords, hfreq, hpreserve, hintegral, hcomplex⟩ := + exists_markedShift_integral_frequency_model F b ω hF hω v w marked hw hv hH hc hgen + t η hη x hA hx d₀ k₀ l₀ hann l hl + have hmR : (m : ℝ) ≤ R := (Nat.cast_le.mpr (hm.trans hi)).trans hdR + have hqR : (q : ℝ) ≤ R := (Nat.cast_le.mpr hq).trans hdR + have huR : (u : ℝ) ≤ R := (Nat.cast_le.mpr hu).trans hqR + have hheight : (markedQuotientJointHeight s (Fintype.card ι) a d m q u H K A : ℝ) ≤ Real.exp Q := + markedQuotientJointHeight_le_exp s (Fintype.card ι) a d m q u H K A hR + (step_le_markedShiftInputBudget s hp) (hn.trans hpR) haR hdR hmR hqR huR + (hHp.trans (Real.exp_le_exp.mpr hpR)) (hKp.trans (Real.exp_le_exp.mpr hpR)) + (hAp.trans (Real.exp_le_exp.mpr hpR)) + have hgridS : (B : ℝ) ≤ Real.exp (markedFrequencyModelBudget s p) := by + have hb := integral_frequency_grid_allowance_le_exp (bchIntegralDenominatorBound (s + 1)) q + (markedQuotientJointHeight s (Fintype.card ι) a d m q u H K A) l + (hR.trans hRQ) (hqR.trans hRQ) hheight + (hlp.trans (Real.exp_le_exp.mpr (hpR.trans hRQ))) + exact (Nat.cast_le.mpr hbound).trans (hb.trans + (Real.exp_le_exp.mpr (le_add_of_nonneg_left (hR.trans hRQ)))) + refine ⟨q, hq.trans (hd.trans ha), D, M, ξ, hMF, + hcomplex _ (hqR.trans (hRQ.trans hQS)) hgridS + (hheight.trans (Real.exp_le_exp.mpr hQS)), ?_, ?_, ?_, hpreserve, hintegral⟩ + · rw [hgrid] + exact hdiv + · simpa only [hgrid] using hcoords + · exact fun i => (rationalLogHeight_le_of_height (hfreq i) hheight).trans hQS + +end Erdos3 + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +theorem exists_native_marked_common_frequency_model (s : ℕ) (hs : 1 ≤ s) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {r N : ℕ} [NeZero N] {b p q P M : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} + (D : R.CommonData P) (B : D.CoefficientBases M) (t : ℕ) (x : Fin t → ℚ) (l : ℕ), + 0 ≤ M → b ≤ M → (t : ℝ) ≤ M → (∀ i, rationalLogHeight (x i) ≤ M) → + 0 < l → (l : ℝ) ≤ Real.exp M → + ∃ d : ℕ, + ∃ E : RationalFilteredNilmanifold + (MarkedShiftQuotient D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t) (s + 1) d, + ∃ T : E.MultidegreeStructure (mixedCorrelationDegree s), + ∃ ξ : MarkedShiftQuotient D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t →ₗ[ℚ] ℚ, + T.filtration = D.markedQuotientMultidegree t ∧ + T.ComplexityLE ((M + C) ^ C) ∧ l ∣ E.grid ∧ + bchSubgroupCoordinates E.basis E.lattice = scaledIntegerGrid E.grid ∧ + (∀ i, rationalLogHeight (ξ (E.basis i)) ≤ (M + C) ^ C) ∧ + (∀ z ∈ markedShiftPolynomialSubmodule D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t s 1 r, + ξ (lieQuotientMap (markedShiftSecondIdeal D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t) z) = + B.freeFrequency D (markedShiftEval D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t x z)) ∧ + ∀ z : E.filtration.Group, z ∈ E.lattice → ∃ n : ℤ, ξ z.coord = n := by + obtain ⟨a, _, hsource⟩ := exists_common_marked_source_basis s hs + obtain ⟨c, _, hmodel⟩ := exists_markedFrequencyModel_budget s + let Q : Polynomial ℕ := Polynomial.X + (Polynomial.X + Polynomial.C a) ^ a + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((Q + Polynomial.C c) ^ c) + refine ⟨C, hC, ?_⟩ + intro r N _ b p q P M W out H R D B t x l hM hbM ht hx hl hlM + let U := (M + a) ^ a + let V := M + U + 1 + have hU : 0 ≤ U := by dsimp [U]; positivity + have hMV : M ≤ V := by dsimp [V]; linarith only [hU] + have hUV : U ≤ V := by dsimp [V]; linarith only [hM] + have hU1V : U + 1 ≤ V := by dsimp [V]; linarith only [hM] + have hM1V : M + 1 ≤ V := by dsimp [V]; linarith only [hU] + have hV : 0 ≤ V := hM.trans hMV + have hbound : markedFrequencyModelBudget s V ≤ (M + C) ^ C := by + apply (hmodel V hV).trans + simpa [Q, U, V, Polynomial.eval₂_pow] using hbudget M hM + obtain ⟨e, ω, hF, hω, hdim, hstructure, hgen, hfreq⟩ := hsource D B hM hbM + obtain ⟨d, _, E, T, ξ, hTF, hT, hdiv, hcoords, hξ, hpreserve, hintegral⟩ := + exists_markedShift_frequency_model_with_budget D.coefficientFreeFiltration e ω hF hω + D.coefficientFreeGenerator D.coefficientWeight D.coefficientIsDependent + D.coefficientWeight_pos D.coefficientFreeGenerator_mem_layer (one_le_ceil_exp U) + (fun i j k => rationalHeightLE_ceil_exp (hstructure i j k)) + (fun z i => rationalHeightLE_ceil_exp (hgen z i)) t (B.freeFrequency D) + (fun i => rationalHeightLE_ceil_exp (hfreq i)) x (one_le_ceil_exp M) + (fun i => rationalHeightLE_ceil_exp (hx i)) s 1 r (B.markedShift_top_inter_le_ker D t x) + l hl hV (by simpa only [Fintype.card_fin] using hdim.trans hUV) (ht.trans hMV) + ((ceil_exp_le_exp_add_one hU).trans (Real.exp_le_exp.mpr hU1V)) + ((ceil_exp_le_exp_add_one hU).trans (Real.exp_le_exp.mpr hU1V)) + ((ceil_exp_le_exp_add_one hM).trans (Real.exp_le_exp.mpr hM1V)) + (hlM.trans (Real.exp_le_exp.mpr hMV)) + exact ⟨d, E, T, ξ, hTF, hT.mono T hbound, hdiv, hcoords, + fun i => (hξ i).trans hbound, hpreserve, hintegral⟩ + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CommonShiftQuotientFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CommonShiftQuotientFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..2fd10bc14a12d5a0972d57c8be95684052ed5cd6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CommonShiftQuotientFrequency.lean @@ -0,0 +1,53 @@ +import OAI.Combinatorics.Progressions.Polynomial.CommonDependentPolynomialIntersections + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + {Q : ℝ} (B : D.CoefficientBases Q) + +theorem CoefficientBases.markedShift_top_inter_le_ker (t : ℕ) (a : Fin t → ℚ) : + markedShiftPolynomialSubmodule D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t s 1 r ⊓ + (markedShiftSecondIdeal D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t).toSubmodule ≤ + ((B.freeFrequency D).comp (markedShiftEval D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t a)).ker := by + intro x hx + change B.freeFrequency D (VectorPolynomial.eval a x.val.left.val) = 0 + exact B.dependentPolynomial_top_inter_le_ker D a ⟨hx.1.2, hx.2.2⟩ + +theorem CoefficientBases.exists_markedShift_quotient_frequency (t : ℕ) (a : Fin t → ℚ) : + ∃ ξ : MarkedShiftQuotient D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t →ₗ[ℚ] ℚ, + ∀ x ∈ markedShiftPolynomialSubmodule D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t s 1 r, + ξ (lieQuotientMap (markedShiftSecondIdeal D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t) x) = + B.freeFrequency D (markedShiftEval D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t a x) := + exists_quotient_functional_preserving_subspace + (markedShiftPolynomialSubmodule D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t s 1 r) + (markedShiftSecondIdeal D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t).toSubmodule + ((B.freeFrequency D).comp (markedShiftEval D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t a)) (B.markedShift_top_inter_le_ker D t a) + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ConfigurationCharacters.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ConfigurationCharacters.lean new file mode 100644 index 0000000000000000000000000000000000000000..7dbf32d448c6c9e75735461b186ea99d4e439560 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ConfigurationCharacters.lean @@ -0,0 +1,88 @@ +import OAI.Combinatorics.Progressions.Estimates.PivotStageBoundary + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def twoSlopeAddHom {R : Type*} [CommRing R] (a b : R) : (R × R) →+ (R × R) where + toFun z := (z.1 + a * z.2, z.1 + b * z.2) + map_zero' := by simp + map_add' x y := by ext <;> simp only [Prod.fst_add, Prod.snd_add] <;> ring + +theorem exists_two_slope_characters {R : Type*} [CommRing R] + (a b : R) (hab : IsUnit (b - a)) (Psi : AddChar (R × R) ℂ) : + ∃ chi rho : AddChar R ℂ, ∀ x d, Psi (x, d) = chi (x + a * d) * rho (x + b * d) := by + let e : (R × R) ≃+ (R × R) := AddEquiv.ofBijective (twoSlopeAddHom a b) + (twoSlopeMap_bijective a b hab) + let L : R →+ (R × R) := { toFun := fun x => (x, 0), map_zero' := rfl, map_add' := by intros; simp } + let M : R →+ (R × R) := { toFun := fun y => (0, y), map_zero' := rfl, map_add' := by intros; simp } + refine ⟨Psi.compAddMonoidHom (e.symm.toAddMonoidHom.comp L), + Psi.compAddMonoidHom (e.symm.toAddMonoidHom.comp M), ?_⟩ + intro x d + change Psi (x, d) = Psi (e.symm (x + a * d, 0)) * Psi (e.symm (0, x + b * d)) + have hpair : (x + a * d, 0) + (0, x + b * d) = e (x, d) := by + change (x + a * d, 0) + (0, x + b * d) = (x + a * d, x + b * d) + simp + rw [← AddChar.map_add_eq_mul, ← map_add, hpair, e.symm_apply_apply] + +theorem exists_single_slope_characters {R : Type*} [CommRing R] + (a : R) (Psi : AddChar (R × R) ℂ) : + ∃ chi rho : AddChar R ℂ, ∀ u d, Psi (u - a * d, d) = chi u * rho d := by + let L : R →+ (R × R) := { toFun := fun u => (u, 0), map_zero' := rfl, map_add' := by intros; simp } + let M : R →+ (R × R) := { + toFun := fun d => (-a * d, d) + map_zero' := by simp + map_add' := by intro x y; ext <;> simp [mul_add] } + refine ⟨Psi.compAddMonoidHom L, Psi.compAddMonoidHom M, ?_⟩ + intro u d + change Psi (u - a * d, d) = Psi (u, 0) * Psi (-a * d, d) + rw [← AddChar.map_add_eq_mul] + congr 1 + ext <;> simp [sub_eq_add_neg] + +theorem complex_expect_pivot_change {R : Type*} [Ring R] [Fintype R] + (a : R) (F : R → R → ℂ) : + (𝔼 x, 𝔼 d, F x d) = 𝔼 u, 𝔼 d, F (u - a * d) d := by + rw [Finset.expect_comm, Finset.expect_comm (Finset.univ : Finset R) (Finset.univ : Finset R) + (fun u d => F (u - a * d) d)] + apply Finset.expect_congr rfl + intro d _ + symm + apply Fintype.expect_equiv (Equiv.addRight (-(a * d))) + intro u + change F (u - a * d) d = F (u + -(a * d)) d + rw [sub_eq_add_neg] + +theorem complex_expect_single_slope {R : Type*} [Ring R] [Fintype R] + (a : R) (f : R → ℂ) : (𝔼 x, 𝔼 d, f (x + a * d)) = 𝔼 u, f u := by + rw [complex_expect_pivot_change a] + simp only [sub_add_cancel, Fintype.expect_const] + +theorem exists_single_slope_character_bound {R : Type*} [CommRing R] [Fintype R] + (a : R) (Psi : AddChar (R × R) ℂ) (f : R → ℂ) : + ∃ chi : AddChar R ℂ, + ‖𝔼 x, 𝔼 d, Psi (x, d) * f (x + a * d)‖ ≤ ‖𝔼 u, chi u * f u‖ := by + obtain ⟨chi, rho, hfactor⟩ := exists_single_slope_characters a Psi + refine ⟨chi, ?_⟩ + rw [complex_expect_pivot_change a] + simp only [sub_add_cancel, hfactor] + have he : (𝔼 u, 𝔼 d, chi u * rho d * f u) = + (𝔼 u, chi u * f u) * (𝔼 d, rho d) := by + have hpoint (u d : R) : chi u * rho d * f u = (chi u * f u) * rho d := by ring + simp only [hpoint, ← Finset.mul_expect, ← Finset.expect_mul] + rw [he, norm_mul] + have hrho : ‖𝔼 d, rho d‖ ≤ 1 := by + apply (RCLike.norm_expect_le (K := ℂ)).trans + simp only [AddChar.norm_apply, Fintype.expect_const] + exact le_rfl + simpa only [mul_one] using mul_le_mul_of_nonneg_left hrho (norm_nonneg _) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ControlledFrequencyExternalTransfer.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ControlledFrequencyExternalTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..d158dbbf9cfe9a7e1aa72cd1ebeb6edb34ad3553 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ControlledFrequencyExternalTransfer.lean @@ -0,0 +1,484 @@ +import OAI.Combinatorics.Progressions.Linear.ExternalFamilyKernelProjectionQuantitative +import OAI.Combinatorics.Progressions.Linear.NativeExternalKernelQuotientTransfer + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module + +theorem exists_controlled_frequency_quotient + {L J : Type*} [LieRing L] [LieAlgebra ℚ L] {s d r : ℕ} + (D : RationalFilteredNilmanifold L s d) (hs : 1 ≤ s) + (P : Submodule ℚ L) (hP : P ≤ D.filtration.layer s) + (vP : Fin d → L) (hspan : Submodule.span ℚ (Set.range vP) = P) + (eta : J → L →ₗ[ℚ] ℚ) (code : Fin r → Option J) + {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) (hr : (r : ℝ) ≤ p) + (hvP : ∀ i j, rationalLogHeight (D.basis.repr (vP i) j) ≤ p) + (heta : ∀ i j, rationalLogHeight (eta i (D.basis j)) ≤ p) : + let K := frequencyCodeKernel P eta code + let hK : K ≤ D.filtration.layer s := (finiteFrequencyKernel_le P _ _).trans hP + let I := D.filtration.topSubspaceIdeal K hK + let hI : D.filtration.layer (s + 1) ≤ I.toSubmodule := by rw [D.filtration.terminal]; exact bot_le + let q := p + ((2 * p + 6) ^ 2 + 2) ^ 63 + 1 + ∃ n : ℕ, n ≤ d ∧ ∃ Q : RationalFilteredNilmanifold (L ⧸ I) s n, + Q.filtration = D.filtration.quotientLie I hI ∧ + Q.lattice = D.lattice.map (D.filtration.quotientStepHom I hI) ∧ + Q.GeometryComplexityLE ((q + 3) ^ 11) ∧ + ∀ i j, rationalLogHeight (Q.basis.repr (lieQuotientMap I (D.basis i)) j) ≤ (q + 3) ^ 5 := by + intro K hK I hI q + obtain ⟨n, hn, bk, hbk⟩ := exists_frequency_code_kernel_basis_logHeight D.basis P vP hspan + eta code hp hD.1 hr hvP heta + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by + have : 0 ≤ ((2 * p + 6) ^ 2 + 2) ^ 63 := by positivity + dsimp [q] + exact (le_add_of_nonneg_right this).trans (le_add_of_nonneg_right zero_le_one) + have hbq : ((2 * p + 6) ^ 2 + 2) ^ 63 ≤ q := by dsimp [q]; linarith + exact D.exists_controlled_top_subspace_quotient hs K hK bk bk.span_eq hq + (hD.mono D hpq) (fun i j => (hbk i j).trans hbq) + +theorem exists_controlled_frequency_quotient_budget : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L J : Type*} [LieRing L] [LieAlgebra ℚ L] {s d r : ℕ} + (D : RationalFilteredNilmanifold L s d) (hs : 1 ≤ s) + (P : Submodule ℚ L) (hP : P ≤ D.filtration.layer s) + (vP : Fin d → L), Submodule.span ℚ (Set.range vP) = P → + ∀ (eta : J → L →ₗ[ℚ] ℚ) (code : Fin r → Option J) (p : ℝ), + 0 ≤ p → D.GeometryComplexityLE p → (r : ℝ) ≤ p → + (∀ i j, rationalLogHeight (D.basis.repr (vP i) j) ≤ p) → + (∀ i j, rationalLogHeight (eta i (D.basis j)) ≤ p) → + let K := frequencyCodeKernel P eta code + let hK : K ≤ D.filtration.layer s := (finiteFrequencyKernel_le P _ _).trans hP + let I := D.filtration.topSubspaceIdeal K hK + let hI : D.filtration.layer (s + 1) ≤ I.toSubmodule := by + rw [D.filtration.terminal]; exact bot_le + ∃ n : ℕ, n ≤ d ∧ ∃ Q : RationalFilteredNilmanifold (L ⧸ I) s n, + Q.filtration = D.filtration.quotientLie I hI ∧ + Q.lattice = D.lattice.map (D.filtration.quotientStepHom I hI) ∧ + Q.GeometryComplexityLE ((p + 2) ^ C) ∧ + ∀ i j, rationalLogHeight (Q.basis.repr (lieQuotientMap I (D.basis i)) j) ≤ (p + 2) ^ C := by + let X : Polynomial ℕ := Polynomial.X + let q := X + ((2 * X + 6) ^ 2 + 2) ^ 63 + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_fixed_power_budget ((q + 3) ^ 11 + (q + 3) ^ 5) + refine ⟨C, hC, ?_⟩ + intro L J _ _ s d r D hs P hP vP hspan eta code p hp hD hr hvP heta K hK I hI + obtain ⟨n, hn, Q, hQF, hQL, hQ, he⟩ := + D.exists_controlled_frequency_quotient hs P hP vP hspan eta code hp hD hr hvP heta + have hb : (p + ((2 * p + 6) ^ 2 + 2) ^ 63 + 1 + 3) ^ 11 + + (p + ((2 * p + 6) ^ 2 + 2) ^ 63 + 1 + 3) ^ 5 ≤ (p + 2) ^ C := by + simpa [X, q, Polynomial.eval₂_pow] using hbudget p hp + have hb11 : (p + ((2 * p + 6) ^ 2 + 2) ^ 63 + 1 + 3) ^ 11 ≤ (p + 2) ^ C := by + have : 0 ≤ (p + ((2 * p + 6) ^ 2 + 2) ^ 63 + 1 + 3) ^ 5 := by positivity + exact (le_add_of_nonneg_right this).trans hb + have hb5 : (p + ((2 * p + 6) ^ 2 + 2) ^ 63 + 1 + 3) ^ 5 ≤ (p + 2) ^ C := by + have : 0 ≤ (p + ((2 * p + 6) ^ 2 + 2) ^ 63 + 1 + 3) ^ 11 := by positivity + exact (le_add_of_nonneg_left this).trans hb + exact ⟨n, hn, Q, hQF, hQL, hQ.mono Q hb11, fun i j => (he i j).trans hb5⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold +open Module VectorPolynomial NilpotentLieFiltration CircleFourier +open scoped TensorProduct NNReal BigOperators Classical + +theorem exists_external_marked_contractive_frequency_quotient_prefix (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L M σ X Ω A : Type*} + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [Fintype Ω] [Fintype A] {d e : ℕ} (D : RationalFilteredNilmanifold L s d), + 1 ≤ s → ∀ (b : Basis (Fin e) ℚ M) (φ : L →ₗ⁅ℚ⁆ M) + {w : σ → ℕ} (tests : X → D.Niltest w) (p : ℝ), + 0 ≤ p → D.GeometryComplexityLE p → (e : ℝ) ≤ p → + (∀ i j, rationalLogHeight (b.repr (φ (D.basis j)) i) ≤ p) → + (∀ x, (tests x).UnitIntervalValued) → (∀ x, (tests x).ComplexityLE p) → + ∀ (outer : FiniteProbabilityWeights Ω) (productive : Finset Ω), 0 < outer.mass productive → + ∀ (localLaw : Ω → FiniteProbabilityWeights A) (physical : Ω → A → X) + (path : Ω → A → D.RealGroup) (weight : Ω → A → ℂ), + (∀ a x, ‖weight a x‖ ≤ Real.exp p) → + (∀ a ∈ productive, Real.exp (-p) ≤ ((localLaw a).complexMean + (fun x => weight a x * (tests (physical a x)).observable (QuotientGroup.mk (path a x)))).re) → + let P := D.filtration.layer s ⊓ LinearMap.ker φ.toLinearMap + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (eta : J → L →ₗ[ℚ] ℚ) (U : J → X → D.Niltest w) + (code : Fin (finrank ℚ P) → Option J) (retained : Finset Ω), + (Fintype.card J : ℝ) ≤ Real.exp ((p + 2) ^ C) ∧ + (∀ j i, rationalLogHeight (eta j (D.basis i)) ≤ (p + 2) ^ C) ∧ + (∀ j x, (U j x).ComplexityLE ((p + 2) ^ C) ∧ + (U j x).orbit = (tests x).orbit ∧ (U j x).normBound = (tests x).normBound ∧ + (U j x).lipBound = (tests x).lipBound) ∧ + (∀ j a (z : D.RealGroup), z ∈ D.filtration.realification.subgroup s → ∀ x, + (U j a).observable (z • x) = + character ((realifyFunctional (eta j) z.coord : ℝ) : CircleFourier.Circle) * (U j a).observable x) ∧ + (∀ j x y ε, (∀ z, ‖(tests x).observable z - (tests y).observable z‖ ≤ ε) → + ∀ z, ‖(U j x).observable z - (U j y).observable z‖ ≤ ε) ∧ + retained ⊆ productive ∧ 0 < outer.mass retained ∧ + outer.mass productive * Real.exp (-((p + 2) ^ C)) ≤ outer.mass retained ∧ + (∀ a ∈ retained, ∀ i j, code i = some j → Real.exp (-((p + 2) ^ C)) < + ‖(localLaw a).complexMean (fun x => weight a x * + (U j (physical a x)).observable (QuotientGroup.mk (path a x)))‖) ∧ + (let K := frequencyCodeKernel P eta code + let hK : K ≤ D.filtration.layer s := (finiteFrequencyKernel_le P _ _).trans inf_le_left + let I := D.filtration.topSubspaceIdeal K hK + let hI : D.filtration.layer (s + 1) ≤ I.toSubmodule := by + rw [D.filtration.terminal]; exact bot_le + ∃ _hker : ∀ x ∈ I, φ x = 0, + ∃ n : ℕ, n ≤ d ∧ ∃ Q : RationalFilteredNilmanifold (L ⧸ I) s n, + Q.filtration = D.filtration.quotientLie I hI ∧ + Q.lattice = D.lattice.map (D.filtration.quotientStepHom I hI) ∧ + Q.GeometryComplexityLE ((p + 2) ^ C) ∧ + (∀ i j, rationalLogHeight (Q.basis.repr (lieQuotientMap I (D.basis j)) i) ≤ (p + 2) ^ C) ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ I)) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ I)) := IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 Q.basis + ∃ descended : X → Q.Niltest w, + (∀ x, (descended x).UnitIntervalValued) ∧ + (∀ x, (descended x).ComplexityLE ((p + 2) ^ C)) ∧ + (∀ x y η, (∀ z, ‖(tests x).observable z - (tests y).observable z‖ ≤ η) → + ∀ q, ‖(descended x).observable q - (descended y).observable q‖ ≤ η) ∧ + (∀ x (g : D.RealGroup), (descended x).observable (QuotientGroup.mk + (NilpotentLieBCHGroup.realificationMap + (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) (lieQuotientMap I) g)) = + ((tests x).kernelProjection K hK).observable (QuotientGroup.mk g)) ∧ + ∀ a ∈ retained, Real.exp (-((p + 2) ^ C)) ≤ ((localLaw a).complexMean + (fun x => weight a x * (descended (physical a x)).observable (QuotientGroup.mk + (NilpotentLieBCHGroup.realificationMap + (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap I) (path a x))))).re)) := by + obtain ⟨a, _, hprojection⟩ := exists_external_family_contractive_quantitative_kernel_projection_budget + obtain ⟨bexp, _, hspanBudget⟩ := exists_nativeTopMarkKernel_spanning_budget + obtain ⟨c, _, hquotient⟩ := exists_controlled_frequency_quotient_budget + obtain ⟨dexp, _, hdescent⟩ := exists_external_kernelProjection_native_descent s + let Y : Polynomial ℕ := Polynomial.X + let P0 := Y + (Y + 2) ^ a + (Y + 2) ^ bexp + 1 + let P1 := P0 + (P0 + 2) ^ c + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_fixed_power_budget (P1 + (P1 + 2) ^ dexp) + refine ⟨C, hC, ?_⟩ + intro L M σ X Ω A _ _ _ _ _ _ _ _ _ _ d e D hs b φ w tests p hp hD he hφ + hunit htests outer productive hprod localLaw physical path weight hweight hscore P + let : FiniteDimensional ℚ L := D.basis.finiteDimensional_of_finite + obtain ⟨vP, hvPspan, hvP⟩ := hspanBudget D b φ p hs hp hD he hφ + obtain ⟨J, inst, eta, U, code, projected, retained, hJ, heta, hU, hvert, hcontract, hprojected, + hidentity, hinv, hsub, hmass, hlocal⟩ := hprojection tests p hp hD hunit htests P inf_le_left + outer productive localLaw physical (fun a x => QuotientGroup.mk (path a x)) weight hweight hscore + let := inst + let q0 := p + (p + 2) ^ a + (p + 2) ^ bexp + 1 + let q1 := q0 + (q0 + 2) ^ c + 1 + have hpowa : 0 ≤ (p + 2) ^ a := by positivity + have hpowb : 0 ≤ (p + 2) ^ bexp := by positivity + have hq0 : 0 ≤ q0 := by dsimp [q0]; positivity + have hpq0 : p ≤ q0 := by dsimp [q0]; linarith + have haq0 : (p + 2) ^ a ≤ q0 := by dsimp [q0]; linarith + have hbq0 : (p + 2) ^ bexp ≤ q0 := by dsimp [q0]; linarith + have hq1 : 0 ≤ q1 := by dsimp [q1]; positivity + have hpowc : 0 ≤ (q0 + 2) ^ c := by positivity + have h01 : q0 ≤ q1 := by dsimp [q1]; linarith + have hcq1 : (q0 + 2) ^ c ≤ q1 := by dsimp [q1]; linarith + have hbudget' : q1 + (q1 + 2) ^ dexp ≤ (p + 2) ^ C := by + simpa [P0, P1, Y, q0, q1, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q1 ≤ (p + 2) ^ C := + (le_add_of_nonneg_right (by positivity : 0 ≤ (q1 + 2) ^ dexp)).trans hbudget' + have hdC : (q1 + 2) ^ dexp ≤ (p + 2) ^ C := + (le_add_of_nonneg_left hq1).trans hbudget' + have haC : (p + 2) ^ a ≤ (p + 2) ^ C := haq0.trans (h01.trans hqC) + have hneg : Real.exp (-((p + 2) ^ C)) ≤ Real.exp (-((p + 2) ^ a)) := + Real.exp_le_exp.mpr (neg_le_neg haC) + have hretained : 0 < outer.mass retained := + (mul_pos hprod (Real.exp_pos _)).trans_le hmass + refine ⟨J, inst, eta, U, code, retained, + hJ.trans (Real.exp_le_exp.mpr haC), fun j i => (heta j i).trans haC, + fun j x => ⟨(hU j x).1.mono haC, (hU j x).2⟩, hvert, hcontract, + hsub, hretained, (mul_le_mul_of_nonneg_left hneg (outer.mass_nonneg productive)).trans hmass, + fun a ha i j hij => hneg.trans_lt ((hlocal a ha).1 i j hij), ?_⟩ + intro K hK I hI + have hker : ∀ x ∈ I, φ x = 0 := by + intro x hx + exact ((mem_frequencyCodeKernel P eta code x).mp hx).1.2 + have hdim : (finrank ℚ P : ℝ) ≤ p := by + have hb := Submodule.finrank_le P + rw [finrank_eq_card_basis D.basis, Fintype.card_fin] at hb + exact (Nat.cast_le.mpr hb).trans hD.1 + obtain ⟨n, hn, Q, hQF, hQL, hQ, hmap⟩ := + hquotient D hs P inf_le_left vP hvPspan eta code q0 hq0 (hD.mono D hpq0) + (hdim.trans hpq0) (fun i j => (hvP i j).trans hbq0) (fun i j => (heta i j).trans haq0) + refine ⟨hker, n, hn, Q, hQF, hQL, hQ.mono Q (hcq1.trans hqC), + fun i j => (hmap j i).trans (hcq1.trans hqC), ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ I)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ I)) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 Q.basis + obtain ⟨descended, _, _, hpositive, hcomplex, _, hrec, _, hcontraction⟩ := + hdescent D I hI Q hQF hQL hK tests q1 hq1 + (fun x => (htests x).mono (hpq0.trans h01)) hunit + (hQ.mono Q hcq1) (fun i j => (hmap j i).trans hcq1) + refine ⟨descended, hpositive, fun x => (hcomplex x).mono hdC, hcontraction, hrec, ?_⟩ + intro a ha + have hs := hneg.trans (hlocal a ha).2 + have hIK : I.toSubmodule = frequencyCodeKernel P eta code := rfl + simpa only [hrec, hidentity, hIK] using hs + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold +open Module VectorPolynomial NilpotentLieFiltration CircleFourier +open scoped TensorProduct NNReal BigOperators Classical + +theorem exists_external_marked_frequency_quotient_prefix (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L M σ X Ω A : Type*} + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [Fintype Ω] [Fintype A] {d e : ℕ} (D : RationalFilteredNilmanifold L s d), + 1 ≤ s → ∀ (b : Basis (Fin e) ℚ M) (φ : L →ₗ⁅ℚ⁆ M) + {w : σ → ℕ} (tests : X → D.Niltest w) (p : ℝ), + 0 ≤ p → D.GeometryComplexityLE p → (e : ℝ) ≤ p → + (∀ i j, rationalLogHeight (b.repr (φ (D.basis j)) i) ≤ p) → + (∀ x, (tests x).UnitIntervalValued) → (∀ x, (tests x).ComplexityLE p) → + ∀ (outer : FiniteProbabilityWeights Ω) (productive : Finset Ω), 0 < outer.mass productive → + ∀ (localLaw : Ω → FiniteProbabilityWeights A) (physical : Ω → A → X) + (path : Ω → A → D.RealGroup) (weight : Ω → A → ℂ), + (∀ a x, ‖weight a x‖ ≤ Real.exp p) → + (∀ a ∈ productive, Real.exp (-p) ≤ ((localLaw a).complexMean + (fun x => weight a x * (tests (physical a x)).observable (QuotientGroup.mk (path a x)))).re) → + let P := D.filtration.layer s ⊓ LinearMap.ker φ.toLinearMap + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (eta : J → L →ₗ[ℚ] ℚ) (U : J → X → D.Niltest w) + (code : Fin (finrank ℚ P) → Option J) (retained : Finset Ω), + (Fintype.card J : ℝ) ≤ Real.exp ((p + 2) ^ C) ∧ + (∀ j i, rationalLogHeight (eta j (D.basis i)) ≤ (p + 2) ^ C) ∧ + (∀ j x, (U j x).ComplexityLE ((p + 2) ^ C) ∧ + (U j x).orbit = (tests x).orbit ∧ (U j x).normBound = (tests x).normBound ∧ + (U j x).lipBound = (tests x).lipBound) ∧ + (∀ j a (z : D.RealGroup), z ∈ D.filtration.realification.subgroup s → ∀ x, + (U j a).observable (z • x) = + character ((realifyFunctional (eta j) z.coord : ℝ) : CircleFourier.Circle) * (U j a).observable x) ∧ + retained ⊆ productive ∧ 0 < outer.mass retained ∧ + outer.mass productive * Real.exp (-((p + 2) ^ C)) ≤ outer.mass retained ∧ + (∀ a ∈ retained, ∀ i j, code i = some j → Real.exp (-((p + 2) ^ C)) < + ‖(localLaw a).complexMean (fun x => weight a x * + (U j (physical a x)).observable (QuotientGroup.mk (path a x)))‖) ∧ + (let K := frequencyCodeKernel P eta code + let hK : K ≤ D.filtration.layer s := (finiteFrequencyKernel_le P _ _).trans inf_le_left + let I := D.filtration.topSubspaceIdeal K hK + let hI : D.filtration.layer (s + 1) ≤ I.toSubmodule := by + rw [D.filtration.terminal]; exact bot_le + ∃ _hker : ∀ x ∈ I, φ x = 0, + ∃ n : ℕ, n ≤ d ∧ ∃ Q : RationalFilteredNilmanifold (L ⧸ I) s n, + Q.filtration = D.filtration.quotientLie I hI ∧ + Q.lattice = D.lattice.map (D.filtration.quotientStepHom I hI) ∧ + Q.GeometryComplexityLE ((p + 2) ^ C) ∧ + (∀ i j, rationalLogHeight (Q.basis.repr (lieQuotientMap I (D.basis j)) i) ≤ (p + 2) ^ C) ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ I)) + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ I)) := IsModuleTopology.isTopologicalAddGroup ℝ _ + letI := realification_moduleTopology_t2 Q.basis + ∃ descended : X → Q.Niltest w, + (∀ x, (descended x).UnitIntervalValued) ∧ + (∀ x, (descended x).ComplexityLE ((p + 2) ^ C)) ∧ + (∀ x y η, (∀ z, ‖(tests x).observable z - (tests y).observable z‖ ≤ η) → + ∀ q, ‖(descended x).observable q - (descended y).observable q‖ ≤ η) ∧ + (∀ x (g : D.RealGroup), (descended x).observable (QuotientGroup.mk + (NilpotentLieBCHGroup.realificationMap + (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) (lieQuotientMap I) g)) = + ((tests x).kernelProjection K hK).observable (QuotientGroup.mk g)) ∧ + ∀ a ∈ retained, Real.exp (-((p + 2) ^ C)) ≤ ((localLaw a).complexMean + (fun x => weight a x * (descended (physical a x)).observable (QuotientGroup.mk + (NilpotentLieBCHGroup.realificationMap + (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap I) (path a x))))).re)) := by + obtain ⟨a, _, hprojection⟩ := exists_external_family_quantitative_kernel_projection_budget + obtain ⟨bexp, _, hspanBudget⟩ := exists_nativeTopMarkKernel_spanning_budget + obtain ⟨c, _, hquotient⟩ := exists_controlled_frequency_quotient_budget + obtain ⟨dexp, _, hdescent⟩ := exists_external_kernelProjection_native_descent s + let Y : Polynomial ℕ := Polynomial.X + let P0 := Y + (Y + 2) ^ a + (Y + 2) ^ bexp + 1 + let P1 := P0 + (P0 + 2) ^ c + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_fixed_power_budget (P1 + (P1 + 2) ^ dexp) + refine ⟨C, hC, ?_⟩ + intro L M σ X Ω A _ _ _ _ _ _ _ _ _ _ d e D hs b φ w tests p hp hD he hφ + hunit htests outer productive hprod localLaw physical path weight hweight hscore P + let : FiniteDimensional ℚ L := D.basis.finiteDimensional_of_finite + obtain ⟨vP, hvPspan, hvP⟩ := hspanBudget D b φ p hs hp hD he hφ + obtain ⟨J, inst, eta, U, code, projected, retained, hJ, heta, hU, hvert, hprojected, + hidentity, hinv, hsub, hmass, hlocal⟩ := hprojection tests p hp hD hunit htests P inf_le_left + outer productive localLaw physical (fun a x => QuotientGroup.mk (path a x)) weight hweight hscore + let := inst + let q0 := p + (p + 2) ^ a + (p + 2) ^ bexp + 1 + let q1 := q0 + (q0 + 2) ^ c + 1 + have hpowa : 0 ≤ (p + 2) ^ a := by positivity + have hpowb : 0 ≤ (p + 2) ^ bexp := by positivity + have hq0 : 0 ≤ q0 := by dsimp [q0]; positivity + have hpq0 : p ≤ q0 := by dsimp [q0]; linarith + have haq0 : (p + 2) ^ a ≤ q0 := by dsimp [q0]; linarith + have hbq0 : (p + 2) ^ bexp ≤ q0 := by dsimp [q0]; linarith + have hq1 : 0 ≤ q1 := by dsimp [q1]; positivity + have hpowc : 0 ≤ (q0 + 2) ^ c := by positivity + have h01 : q0 ≤ q1 := by dsimp [q1]; linarith + have hcq1 : (q0 + 2) ^ c ≤ q1 := by dsimp [q1]; linarith + have hbudget' : q1 + (q1 + 2) ^ dexp ≤ (p + 2) ^ C := by + simpa [P0, P1, Y, q0, q1, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q1 ≤ (p + 2) ^ C := + (le_add_of_nonneg_right (by positivity : 0 ≤ (q1 + 2) ^ dexp)).trans hbudget' + have hdC : (q1 + 2) ^ dexp ≤ (p + 2) ^ C := + (le_add_of_nonneg_left hq1).trans hbudget' + have haC : (p + 2) ^ a ≤ (p + 2) ^ C := haq0.trans (h01.trans hqC) + have hneg : Real.exp (-((p + 2) ^ C)) ≤ Real.exp (-((p + 2) ^ a)) := + Real.exp_le_exp.mpr (neg_le_neg haC) + have hretained : 0 < outer.mass retained := + (mul_pos hprod (Real.exp_pos _)).trans_le hmass + refine ⟨J, inst, eta, U, code, retained, + hJ.trans (Real.exp_le_exp.mpr haC), fun j i => (heta j i).trans haC, + fun j x => ⟨(hU j x).1.mono haC, (hU j x).2⟩, hvert, + hsub, hretained, (mul_le_mul_of_nonneg_left hneg (outer.mass_nonneg productive)).trans hmass, + fun a ha i j hij => hneg.trans_lt ((hlocal a ha).1 i j hij), ?_⟩ + intro K hK I hI + have hker : ∀ x ∈ I, φ x = 0 := by + intro x hx + exact ((mem_frequencyCodeKernel P eta code x).mp hx).1.2 + have hdim : (finrank ℚ P : ℝ) ≤ p := by + have hb := Submodule.finrank_le P + rw [finrank_eq_card_basis D.basis, Fintype.card_fin] at hb + exact (Nat.cast_le.mpr hb).trans hD.1 + obtain ⟨n, hn, Q, hQF, hQL, hQ, hmap⟩ := + hquotient D hs P inf_le_left vP hvPspan eta code q0 hq0 (hD.mono D hpq0) + (hdim.trans hpq0) (fun i j => (hvP i j).trans hbq0) (fun i j => (heta i j).trans haq0) + refine ⟨hker, n, hn, Q, hQF, hQL, hQ.mono Q (hcq1.trans hqC), + fun i j => (hmap j i).trans (hcq1.trans hqC), ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ I)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ I)) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 Q.basis + obtain ⟨descended, _, _, hpositive, hcomplex, _, hrec, _, hcontraction⟩ := + hdescent D I hI Q hQF hQL hK tests q1 hq1 + (fun x => (htests x).mono (hpq0.trans h01)) hunit + (hQ.mono Q hcq1) (fun i j => (hmap j i).trans hcq1) + refine ⟨descended, hpositive, fun x => (hcomplex x).mono hdC, hcontraction, hrec, ?_⟩ + intro a ha + have hs := hneg.trans (hlocal a ha).2 + have hIK : I.toSubmodule = frequencyCodeKernel P eta code := rfl + simpa only [hrec, hidentity, hIK] using hs + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold +open Module VectorPolynomial NilpotentLieFiltration +open scoped TensorProduct NNReal + +theorem exists_controlled_frequency_external_transfer (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L M σ X J : Type*} + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d r u : ℕ} (D : RationalFilteredNilmanifold L s d), 1 ≤ s → + ∀ (G : NilpotentLieFiltration M u) (φ : L →ₗ⁅ℚ⁆ M) + (vP : Fin d → L), + Submodule.span ℚ (Set.range vP) = D.filtration.layer s ⊓ LinearMap.ker φ.toLinearMap → + ∀ (eta : J → L →ₗ[ℚ] ℚ) (code : Fin r → Option J) (p : ℝ), + 0 ≤ p → D.GeometryComplexityLE p → (r : ℝ) ≤ p → + (∀ i j, rationalLogHeight (D.basis.repr (vP i) j) ≤ p) → + (∀ i j, rationalLogHeight (eta i (D.basis j)) ≤ p) → + ∀ {w : σ → ℕ} (tests : X → D.Niltest w), + (∀ x, (tests x).ComplexityLE p) → (∀ x, (tests x).UnitIntervalValued) → + let P := D.filtration.layer s ⊓ LinearMap.ker φ.toLinearMap + let K := frequencyCodeKernel P eta code + let hK : K ≤ D.filtration.layer s := (finiteFrequencyKernel_le P _ _).trans inf_le_left + let I := D.filtration.topSubspaceIdeal K hK + let hI : D.filtration.layer (s + 1) ≤ I.toSubmodule := by + rw [D.filtration.terminal]; exact bot_le + ∃ hker : ∀ x ∈ I, φ x = 0, + ∃ n : ℕ, n ≤ d ∧ ∃ Q : RationalFilteredNilmanifold (L ⧸ I) s n, + Q.filtration = D.filtration.quotientLie I hI ∧ + Q.lattice = D.lattice.map (D.filtration.quotientStepHom I hI) ∧ + Q.GeometryComplexityLE ((p + 2) ^ C) ∧ + (∀ i j, rationalLogHeight (Q.basis.repr (lieQuotientMap I (D.basis j)) i) ≤ (p + 2) ^ C) ∧ + (letI := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ I)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ I)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 Q.basis + ∃ descended : X → Q.Niltest w, + (∀ x, (descended x).UnitIntervalValued) ∧ + (∀ x, (descended x).ComplexityLE ((p + 2) ^ C)) ∧ + (∀ x y η, (∀ z, ‖(tests x).observable z - (tests y).observable z‖ ≤ η) → + ∀ q, ‖(descended x).observable q - (descended y).observable q‖ ≤ η) ∧ + ∀ {Ω A : Type*} [Fintype Ω] [Fintype A] + (q : Q.filtration.realification.PolynomialOrbit w) + (marked : G.realification.PolynomialOrbit w), + map ((realificationLieHom (quotientInducedMark I φ hker)).toLinearMap.restrictScalars ℚ) + q.log = marked.log → + ∀ (outer : FiniteProbabilityWeights Ω) (H : Finset Ω), 0 < outer.mass H → + ∀ (localLaw : Ω → FiniteProbabilityWeights A) + (physical : Ω → A → X) (point : Ω → A → σ → ℤ) (weight : X → ℂ) + {B δ : ℝ}, 0 < B → 0 < δ → + (∀ a ∈ H, ∀ j, ‖weight (physical a j)‖ ≤ B) → + (∀ a ∈ H, δ ≤ ((localLaw a).complexMean (fun j => weight (physical a j) * + ((descended (physical a j)).withOrbit q).eval (point a j))).re) → + ∃ restored : D.filtration.realification.PolynomialOrbit w, + map (realLieHomToRat (realificationLieHom φ)).toLinearMap restored.log = marked.log ∧ + (∀ x, ((tests x).withOrbit restored).observable = (tests x).observable ∧ + ((tests x).withOrbit restored).UnitIntervalValued ∧ + ∀ p', ((tests x).withOrbit restored).ComplexityLE p' ↔ (tests x).ComplexityLE p') ∧ + ∃ H' : Finset Ω, H' ⊆ H ∧ 0 < outer.mass H' ∧ + δ / (2 * B) * outer.mass H ≤ outer.mass H' ∧ + ∀ a ∈ H', δ / 2 ≤ ((localLaw a).complexMean (fun j => weight (physical a j) * + ((tests (physical a j)).withOrbit restored).eval (point a j))).re) := by + obtain ⟨a, _, hquotient⟩ := exists_controlled_frequency_quotient_budget + obtain ⟨b, _, htransfer⟩ := exists_external_kernel_quotient_transfer s + let polyX : Polynomial ℕ := Polynomial.X + let Pbudget := polyX + (polyX + 2) ^ a + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_fixed_power_budget + (Pbudget + (Pbudget + 2) ^ b) + refine ⟨C, hC, ?_⟩ + intro L M σ X J _ _ _ _ _ _ _ _ d r u D hs G φ vP hspan eta code p + hp hD hr hvP heta w tests htests hunit P K hK I hI + have hker : ∀ x ∈ I, φ x = 0 := by + intro x hx + exact ((mem_frequencyCodeKernel P eta code x).mp hx).1.2 + let qbudget := p + (p + 2) ^ a + 1 + have hq0 : 0 ≤ qbudget := by dsimp [qbudget]; positivity + have hpq : p ≤ qbudget := by + have : 0 ≤ (p + 2) ^ a := by positivity + dsimp [qbudget] + linarith + have haq : (p + 2) ^ a ≤ qbudget := by dsimp [qbudget]; linarith + have hbudget' : qbudget + (qbudget + 2) ^ b ≤ (p + 2) ^ C := by + simpa [Pbudget, polyX, qbudget, Polynomial.eval₂_pow] using hbudget p hp + have hqC : qbudget ≤ (p + 2) ^ C := + (le_add_of_nonneg_right (by positivity : 0 ≤ (qbudget + 2) ^ b)).trans hbudget' + have hbC : (qbudget + 2) ^ b ≤ (p + 2) ^ C := + (le_add_of_nonneg_left hq0).trans hbudget' + obtain ⟨n, hn, Q, hQF, hQL, hQ, he⟩ := + hquotient D hs P inf_le_left vP hspan eta code p hp hD hr hvP heta + refine ⟨hker, n, hn, Q, hQF, hQL, hQ.mono Q (haq.trans hqC), + fun i j => (he j i).trans (haq.trans hqC), ?_⟩ + let := moduleTopology ℝ (ℝ ⊗[ℚ] (L ⧸ I)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ I)) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let := realification_moduleTopology_t2 Q.basis + obtain ⟨descended, hpositive, hcomplex, hcontraction, hreturn⟩ := + htransfer D I hI Q hQF hQL hK tests qbudget hq0 + (fun x => (htests x).mono hpq) hunit (hQ.mono Q haq) (fun i j => (he j i).trans haq) + refine ⟨descended, hpositive, fun x => (hcomplex x).mono hbC, hcontraction, ?_⟩ + intro Ω A _ _ q marked hmark outer H hH localLaw physical point weight B δ hB hδ hweight hscore + exact hreturn G φ hker q marked hmark outer H hH localLaw physical point weight + hB hδ hweight hscore + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ControlledReplicatedFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ControlledReplicatedFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9492ed7074752255708adb563326648d1022a04 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ControlledReplicatedFrequency.lean @@ -0,0 +1,453 @@ +import OAI.Combinatorics.Progressions.Estimates.ComparisonAmbient + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open Module + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + +noncomputable def replicatedFrequency (η : L →ₗ[ℚ] ℚ) : + F.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1) →ₗ[ℚ] ℚ := + η.comp ((F.layer bound).subtype.comp F.replicatedTopCoefficient) + +theorem replicatedFrequency_apply (η : L →ₗ[ℚ] ℚ) + (x : F.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1)) : + F.replicatedFrequency η x = + η (squarefreePolynomialEquiv x.val (SquarefreeIndex.full (ReplicatedIndex bound))) := rfl + +theorem replicatedFrequency_permute (η : L →ₗ[ℚ] ℚ) (e : Equiv.Perm (ReplicatedIndex bound)) + (he : ∀ j, (e j).1 = j.1) + (x : F.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1)) : + F.replicatedFrequency η (F.squarefreeBlockPermute (fun j : ReplicatedIndex bound => j.1) e he x) = + F.replicatedFrequency η x := by + change η (squarefreePolynomialEquiv (squarefreePermute e x.val) _) = _ + rw [squarefreePermute_coefficient, SquarefreeIndex.permute_symm, SquarefreeIndex.permute_full] + rfl + +variable {κ : SquarefreeIndex (ReplicatedIndex bound) → Type*} + (b : ∀ a, Basis (κ a) ℚ (F.squarefreeCoefficientLayer (fun j : ReplicatedIndex bound => j.1) a)) + +theorem replicatedFrequency_basis_full (η : L →ₗ[ℚ] ℚ) + (j : κ (SquarefreeIndex.full (ReplicatedIndex bound))) : + F.replicatedFrequency η + (F.squarefreeBasis (fun j : ReplicatedIndex bound => j.1) b ⟨SquarefreeIndex.full _, j⟩) = + η (b (SquarefreeIndex.full _) j).val := by + rw [F.replicatedFrequency_apply, F.squarefreeBasis_coefficient_self] + +theorem replicatedFrequency_basis_ne (η : L →ₗ[ℚ] ℚ) (a : SquarefreeIndex (ReplicatedIndex bound)) + (ha : a ≠ SquarefreeIndex.full (ReplicatedIndex bound)) (j : κ a) : + F.replicatedFrequency η (F.squarefreeBasis (fun j : ReplicatedIndex bound => j.1) b ⟨a, j⟩) = 0 := by + rw [F.replicatedFrequency_apply, F.squarefreeBasis_coefficient_ne _ b a _ ha, map_zero] + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + +theorem replicatedTopCoefficient_blockLayerMap (hb : bound ≠ 0) (x : F.layer bound) : + F.replicatedTopCoefficient (F.blockLayerMap (fun j : ReplicatedIndex bound => j.1) bound hb x) = + (multidegreeFactorial bound : ℚ) • x := by + classical + apply Subtype.ext + rw [F.replicatedTopCoefficient_apply, F.blockLayerMap_coe, + factorialBlockMonomial_coefficient, replicated_blockDegree_full, ite_eq_left rfl] + rfl + +theorem replicatedFrequency_blockLayerMap_top (η : L →ₗ[ℚ] ℚ) + (hb : bound ≠ 0) (x : F.layer bound) : + F.replicatedFrequency η (F.blockLayerMap (fun j : ReplicatedIndex bound => j.1) bound hb x) = + (multidegreeFactorial bound : ℚ) * η x.val := by + change η (F.replicatedTopCoefficient (F.blockLayerMap _ bound hb x)).val = _ + rw [F.replicatedTopCoefficient_blockLayerMap hb x] + exact map_smul η _ x.val + +theorem replicatedFrequency_blockLayerMap_ne (η : L →ₗ[ℚ] ℚ) + (a : σ → ℕ) (ha : a ≠ 0) (hab : a ≠ bound) (x : F.layer a) : + F.replicatedFrequency η (F.blockLayerMap (fun j : ReplicatedIndex bound => j.1) a ha x) = 0 := by + classical + rw [F.replicatedFrequency_apply, F.blockLayerMap_coe, + factorialBlockMonomial_coefficient, replicated_blockDegree_full, + ite_eq_right (Ne.symm hab), map_zero] + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + +theorem comparisonLayer_top_frequency (hstep : s = ∑ i, bound i) (η : L →ₗ[ℚ] ℚ) + {z : L × F.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1)} + (hz : z ∈ F.comparisonLayer (fun j : ReplicatedIndex bound => j.1) s) : + (multidegreeFactorial bound : ℚ) * η z.1 = F.replicatedFrequency η z.2 := by + have hterminal : F.comparisonProductLayer (fun j : ReplicatedIndex bound => j.1) (s + 1) = ⊥ := by + have h := F.comparisonProductLayer_terminal (fun j : ReplicatedIndex bound => j.1) + simpa only [replicatedIndex_card, ← hstep, max_self] using h + obtain ⟨u, hu, v, hv, rfl⟩ := Submodule.mem_sup.mp hz + have hu0 : u = 0 := by simpa only [hterminal, Submodule.mem_bot] using hu + rw [hu0, zero_add] + refine F.comparisonGraphLayer_induction (fun j : ReplicatedIndex bound => j.1) s + (P := fun z => (multidegreeFactorial bound : ℚ) * η z.1 = F.replicatedFrequency η z.2) hv ?_ ?_ ?_ + · intro a ha hsa x + by_cases hab : a ≤ bound + · have heq : a = bound := by + funext i + apply le_antisymm (hab i) + by_contra hi + have hlt : a i < bound i := Nat.lt_of_not_ge hi + have hsum : (∑ j, a j) < ∑ j, bound j := + Finset.sum_lt_sum (fun j _ => hab j) ⟨i, Finset.mem_univ i, hlt⟩ + omega + subst a + exact (F.replicatedFrequency_blockLayerMap_top η ha x).symm + · have hx0 : x = 0 := by + apply Subtype.ext + have h : x.val ∈ (⊥ : Submodule ℚ L) := F.terminal a hab ▸ x.property + exact (Submodule.mem_bot ℚ).mp h + rw [hx0, map_zero] + simp only [Prod.fst_zero, Prod.snd_zero, map_zero, mul_zero] + · simp only [Prod.fst_zero, Prod.snd_zero, map_zero, mul_zero] + · intro x y hx hy + change (multidegreeFactorial bound : ℚ) * η (x.1 + y.1) = F.replicatedFrequency η (x.2 + y.2) + rw [map_add, map_add, mul_add, hx, hy] + +theorem comparisonTop_frequency (hstep : s = ∑ i, bound i) (η : L →ₗ[ℚ] ℚ) + {z : F.comparisonSubalgebra (fun j : ReplicatedIndex bound => j.1)} + (hz : z ∈ (F.comparisonFiltration (fun j : ReplicatedIndex bound => j.1)).layer s) : + (multidegreeFactorial bound : ℚ) * η (F.comparisonFirst (fun j : ReplicatedIndex bound => j.1) z) = + F.replicatedFrequency η (F.comparisonSecond (fun j : ReplicatedIndex bound => j.1) z) := + F.comparisonLayer_top_frequency hstep η hz + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped TensorProduct BigOperators + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + +theorem realComparisonTop_frequency (hstep : s = ∑ i, bound i) (η : L →ₗ[ℚ] ℚ) + {z : ℝ ⊗[ℚ] F.comparisonSubalgebra (fun j : ReplicatedIndex bound => j.1)} + (hz : z ∈ (F.comparisonFiltration (fun j : ReplicatedIndex bound => j.1)).realification.layer s) : + (multidegreeFactorial bound : ℝ) * realifyFunctional η + (realificationLieHom (F.comparisonFirst (fun j : ReplicatedIndex bound => j.1)) z) = + realifyFunctional (F.replicatedFrequency η) + (realificationLieHom (F.comparisonSecond (fun j : ReplicatedIndex bound => j.1)) z) := by + change z ∈ ((F.comparisonFiltration (fun j : ReplicatedIndex bound => j.1)).layer s).baseChange ℝ at hz + obtain ⟨y, rfl⟩ := hz + induction y using TensorProduct.inductionOn with + | tmul r y => + simp only [LinearMap.baseChange_tmul, realificationLieHom_tmul, realifyFunctional_tmul] + change (multidegreeFactorial bound : ℝ) * + (r * (η (F.comparisonFirst (fun j : ReplicatedIndex bound => j.1) y.val) : ℝ)) = + r * (F.replicatedFrequency η + (F.comparisonSecond (fun j : ReplicatedIndex bound => j.1) y.val) : ℝ) + have h := F.comparisonTop_frequency hstep η y.property + have hr : (multidegreeFactorial bound : ℝ) * + (η (F.comparisonFirst (fun j : ReplicatedIndex bound => j.1) y.val) : ℝ) = + (F.replicatedFrequency η + (F.comparisonSecond (fun j : ReplicatedIndex bound => j.1) y.val) : ℝ) := by + exact_mod_cast h + rw [← hr] + ring + | add y w hy hw => simp only [map_add, mul_add, hy, hw] + +end Erdos3.MultidegreeLieFiltration + +end + +section + +namespace Erdos3 + +def replicatedFrequencyHeight (d H : ℕ) : ℕ := (d + 1) * (H * H) ^ d + +theorem replicatedFrequencyHeight_pos (d : ℕ) {H : ℕ} (hH : 1 ≤ H) : + 0 < replicatedFrequencyHeight d H := by + have hHpos : 0 < H := by omega + unfold replicatedFrequencyHeight + positivity + +namespace RationalFilteredNilmanifold.MultidegreeStructure + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +theorem replicatedFrequency_basis_height {p : ℝ} (hM : M.ComplexityLE p) (η : L →ₗ[ℚ] ℚ) + (hη : ∀ i, rationalLogHeight (η (D.basis i)) ≤ p) (j : M.SquarefreeBasisIndex) : + RationalHeightLE (M.filtration.replicatedFrequency η (M.squarefreeBasis p j)) + (replicatedFrequencyHeight d ⌈Real.exp p⌉₊) := by + rcases j with ⟨a, k⟩ + by_cases ha : a = SquarefreeIndex.full (ReplicatedIndex bound) + · subst a + change RationalHeightLE (M.filtration.replicatedFrequency η + (M.filtration.squarefreeBasis _ (M.squarefreeCoefficientBasis p) ⟨_, k⟩)) _ + rw [M.filtration.replicatedFrequency_basis_full] + have h := linearFunctional_coordinate_height D.basis η + (fun i => rationalHeightLE_ceil_exp (hη i)) _ (M.squarefreeCoefficientBasis_height hM _ k) + simp only [Fintype.card_fin] at h + exact h + · change RationalHeightLE (M.filtration.replicatedFrequency η + (M.filtration.squarefreeBasis _ (M.squarefreeCoefficientBasis p) ⟨a, k⟩)) _ + rw [M.filtration.replicatedFrequency_basis_ne (M.squarefreeCoefficientBasis p) η a ha k] + exact rationalHeightLE_zero (replicatedFrequencyHeight_pos d (one_le_ceil_exp p)) + +theorem replicatedFrequency_finBasis_height {p : ℝ} (hM : M.ComplexityLE p) (η : L →ₗ[ℚ] ℚ) + (hη : ∀ i, rationalLogHeight (η (D.basis i)) ≤ p) (j) : + RationalHeightLE (M.filtration.replicatedFrequency η (M.squarefreeFinBasis p j)) + (replicatedFrequencyHeight d ⌈Real.exp p⌉₊) := by + rw [squarefreeFinBasis, Module.Basis.reindex_apply] + exact M.replicatedFrequency_basis_height hM η hη _ + +theorem exists_replicatedFrequency_denominator {p : ℝ} (hM : M.ComplexityLE p) (η : L →ₗ[ℚ] ℚ) + (hη : ∀ i, rationalLogHeight (η (D.basis i)) ≤ p) : + ∃ l : ℕ, 0 < l ∧ + l ≤ replicatedFrequencyHeight d ⌈Real.exp p⌉₊ ^ Fintype.card M.SquarefreeBasisIndex ∧ + ∀ j : M.SquarefreeBasisIndex, ∃ n : ℤ, + (l : ℚ) * M.filtration.replicatedFrequency η (M.squarefreeBasis p j) = n := by + obtain ⟨l, hl, hbound, z, hz, _⟩ := exists_bounded_integer_array + (fun j => M.filtration.replicatedFrequency η (M.squarefreeBasis p j)) + (M.replicatedFrequency_basis_height hM η hη) + exact ⟨l, hl, hbound, fun j => ⟨z j, (hz j).symm⟩⟩ + +end RationalFilteredNilmanifold.MultidegreeStructure + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def replicatedFrequencyDenominatorBudget (t : ℕ) (p : ℝ) : ℝ := + (2 : ℝ) ^ t * (p + 3) ^ 5 + +theorem replicatedFrequencyHeight_le_exp (d H : ℕ) {p : ℝ} (hp : 0 ≤ p) + (hd : (d : ℝ) ≤ p) (hH : (H : ℝ) ≤ Real.exp p) : + (replicatedFrequencyHeight d H : ℝ) ≤ Real.exp ((p + 2) ^ 4) := by + have hprod : ((H * H : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 2) := by + calc + _ ≤ Real.exp p * Real.exp p := by rw [Nat.cast_mul]; gcongr + _ = Real.exp (2 * p) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith) + exact rational_sum_cost_le_exp d (H * H) hp 2 1 hprod + (by simpa only [pow_one] using hd.trans (by linarith)) + +theorem replicatedFrequencyHeight_ceil_exp (d : ℕ) {p : ℝ} (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) : + (replicatedFrequencyHeight d ⌈Real.exp p⌉₊ : ℝ) ≤ Real.exp ((p + 3) ^ 4) := by + have h := replicatedFrequencyHeight_le_exp d ⌈Real.exp p⌉₊ + (p := p + 1) (by linarith) (by linarith) (ceil_exp_le_exp_add_one hp) + have heq : p + 1 + 2 = p + 3 := by ring + simpa only [heq] using h + +theorem replicatedFrequencyDenominator_le_exp (t N d l : ℕ) {p : ℝ} (hp : 0 ≤ p) + (hd : (d : ℝ) ≤ p) (hN : N ≤ 2 ^ t * d) + (hl : l ≤ replicatedFrequencyHeight d ⌈Real.exp p⌉₊ ^ N) : + (l : ℝ) ≤ Real.exp (replicatedFrequencyDenominatorBudget t p) := by + have hNr : (N : ℝ) ≤ (2 : ℝ) ^ t * (p + 3) := by + calc + _ ≤ (2 : ℝ) ^ t * d := by exact_mod_cast hN + _ ≤ _ := mul_le_mul_of_nonneg_left (hd.trans (by linarith)) (by positivity) + calc + (l : ℝ) ≤ (replicatedFrequencyHeight d ⌈Real.exp p⌉₊ : ℝ) ^ N := by exact_mod_cast hl + _ ≤ (Real.exp ((p + 3) ^ 4)) ^ N := + pow_le_pow_left₀ (Nat.cast_nonneg _) (replicatedFrequencyHeight_ceil_exp d hp hd) N + _ = Real.exp ((N : ℝ) * (p + 3) ^ 4) := (Real.exp_nat_mul _ _).symm + _ ≤ Real.exp (((2 : ℝ) ^ t * (p + 3)) * (p + 3) ^ 4) := + Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right hNr (by positivity)) + _ = _ := by congr 1; unfold replicatedFrequencyDenominatorBudget; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def squarefreeFrequencyInputBudget (t : ℕ) (p : ℝ) : ℝ := + squarefreeInputBudget t p + replicatedFrequencyDenominatorBudget t p + +noncomputable def squarefreeFrequencyModelBudget (t : ℕ) (p : ℝ) : ℝ := + squarefreeFrequencyInputBudget t p + + (squarefreeFrequencyInputBudget t p + (bchIntegralDenominatorBound t + 5 : ℕ)) ^ + (bchIntegralDenominatorBound t + 5) + +theorem squarefreeInputBudget_le_frequency (t : ℕ) {p : ℝ} (hp : 0 ≤ p) : + squarefreeInputBudget t p ≤ squarefreeFrequencyInputBudget t p := by + apply le_add_of_nonneg_right + unfold replicatedFrequencyDenominatorBudget + positivity + +theorem squarefreeFrequencyInputBudget_nonneg (t : ℕ) {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ squarefreeFrequencyInputBudget t p := + (squarefreeInputBudget_nonneg t hp).trans (squarefreeInputBudget_le_frequency t hp) + +theorem squarefreeFrequencyInputBudget_le_model (t : ℕ) {p : ℝ} (hp : 0 ≤ p) : + squarefreeFrequencyInputBudget t p ≤ squarefreeFrequencyModelBudget t p := by + exact le_add_of_nonneg_right + (pow_nonneg (add_nonneg (squarefreeFrequencyInputBudget_nonneg t hp) (Nat.cast_nonneg _)) _) + +theorem squarefree_frequency_grid_budget (t N d l B : ℕ) {p : ℝ} (hp : 0 ≤ p) + (hd : (d : ℝ) ≤ p) (hN : N ≤ 2 ^ t * d) + (hl : (l : ℝ) ≤ Real.exp (replicatedFrequencyDenominatorBudget t p)) + (hB : B ≤ bchIntegralDenominatorBound t * + squarefreeStructureHeight d ⌈Real.exp p⌉₊ ^ (N ^ 3) * l) : + (B : ℝ) ≤ Real.exp (squarefreeFrequencyModelBudget t p) := by + have hq := squarefreeFrequencyInputBudget_nonneg t hp + have hbase := squarefreeInputBudget_le_frequency t hp + have hNq : (N : ℝ) ≤ squarefreeFrequencyInputBudget t p := by + apply le_trans _ hbase + calc + _ ≤ (2 : ℝ) ^ t * d := by exact_mod_cast hN + _ ≤ (2 : ℝ) ^ t * p := mul_le_mul_of_nonneg_left hd (by positivity) + _ ≤ _ := le_add_of_nonneg_right (by positivity) + have hHq : (squarefreeStructureHeight d ⌈Real.exp p⌉₊ : ℝ) ≤ + Real.exp (squarefreeFrequencyInputBudget t p) := + (squarefreeStructureHeight_ceil_exp d hp hd).trans + (Real.exp_le_exp.mpr ((le_add_of_nonneg_left (mul_nonneg (by positivity) hp)).trans hbase)) + have hlq : (l : ℝ) ≤ Real.exp (squarefreeFrequencyInputBudget t p) := + hl.trans (Real.exp_le_exp.mpr (le_add_of_nonneg_left (squarefreeInputBudget_nonneg t hp))) + exact (Nat.cast_le.mpr hB).trans ((integral_grid_allowance_le_exp + (bchIntegralDenominatorBound t) N _ l hq hNq hHq hlq).trans + (Real.exp_le_exp.mpr (le_add_of_nonneg_left hq))) + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +theorem squarefreeLattice_frequency_integral (p : ℝ) (η : L →ₗ[ℚ] ℚ) (l B : ℕ) + (hstable : M.SquarefreeGridStable p B) (hdiv : l ∣ B) + (hη : ∀ j : M.SquarefreeBasisIndex, ∃ n : ℤ, + (l : ℚ) * M.filtration.replicatedFrequency η (M.squarefreeBasis p j) = n) + (g : (M.filtration.squarefreeOrdinaryFiltration (fun j : ReplicatedIndex bound => j.1)).Group) + (hg : g ∈ M.squarefreeLattice p B hstable) : + ∃ n : ℤ, M.filtration.replicatedFrequency η g.coord = n := + coordinateGrid_functional_integral (M.squarefreeBasis p) (M.filtration.replicatedFrequency η) + l B hdiv hη hg + +theorem squarefreeRealLattice_frequency_integral (p : ℝ) (η : L →ₗ[ℚ] ℚ) (l B : ℕ) + (hB : 0 < B) (hstable : M.SquarefreeGridStable p B) (hdiv : l ∣ B) + (hη : ∀ j : M.SquarefreeBasisIndex, ∃ n : ℤ, + (l : ℚ) * M.filtration.replicatedFrequency η (M.squarefreeBasis p j) = n) + (z : (M.squarefreeModel p B hB hstable).RealGroup) + (hz : z ∈ (M.squarefreeModel p B hB hstable).realLattice) : + ∃ n : ℤ, realifyFunctional (M.filtration.replicatedFrequency η) z.coord = n := + (M.squarefreeModel p B hB hstable).realLattice_functional_integral + (M.filtration.replicatedFrequency η) + (M.squarefreeLattice_frequency_integral p η l B hstable hdiv hη) z hz + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +section + +namespace Erdos3 + +theorem exists_squarefreeFrequency_cost (t : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → squarefreeFrequencyModelBudget t p ≤ (p + C) ^ C := by + let X : Polynomial ℕ := Polynomial.X + let K := bchIntegralDenominatorBound t + 5 + let A := Polynomial.C (2 ^ t) * X + (X + 3) ^ 8 + Polynomial.C (2 ^ t) * (X + 3) ^ 5 + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget (A + (A + Polynomial.C K) ^ K) + refine ⟨C, hC, ?_⟩ + intro p hp + simpa [X, K, A, squarefreeFrequencyModelBudget, squarefreeFrequencyInputBudget, + squarefreeInputBudget, replicatedFrequencyDenominatorBudget, Polynomial.eval₂_pow] using hbound p hp + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open scoped BigOperators + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +theorem exists_controlled_replicated_frequency {p : ℝ} (hM : M.ComplexityLE p) + (η : L →ₗ[ℚ] ℚ) (hη : ∀ i, rationalLogHeight (η (D.basis i)) ≤ p) : + ∃ (B : ℕ) (hB : 0 < B) (hstable : M.SquarefreeGridStable p B), + (M.squarefreeModelMultidegree p B hB hstable).ComplexityLE + (squarefreeFrequencyModelBudget (∑ i, bound i) p) ∧ + (∀ i, rationalLogHeight (M.filtration.replicatedFrequency η + ((M.squarefreeModel p B hB hstable).basis i)) ≤ + squarefreeFrequencyModelBudget (∑ i, bound i) p) ∧ + ∀ z : (M.squarefreeModel p B hB hstable).RealGroup, + z ∈ (M.squarefreeModel p B hB hstable).realLattice → + ∃ n : ℤ, realifyFunctional (M.filtration.replicatedFrequency η) z.coord = n := by + let t := ∑ i, bound i + have hp : 0 ≤ p := (Nat.cast_nonneg d).trans hM.1.1 + obtain ⟨l, hl, hlraw, hclear⟩ := M.exists_replicatedFrequency_denominator hM η hη + have hN := M.squarefreeBasisIndex_card_le p + have hlexp := replicatedFrequencyDenominator_le_exp t _ d l hp hM.1.1 hN hlraw + obtain ⟨B, hB, hdiv, hBraw, hstable⟩ := M.exists_squarefree_stable_grid hM l hl + rw [replicatedIndex_card] at hBraw + have hbase : squarefreeInputBudget t p ≤ squarefreeFrequencyModelBudget t p := + (squarefreeInputBudget_le_frequency t hp).trans (squarefreeFrequencyInputBudget_le_model t hp) + have hq : 0 ≤ squarefreeFrequencyModelBudget t p := (squarefreeInputBudget_nonneg t hp).trans hbase + have hdq : (Fintype.card M.SquarefreeBasisIndex : ℝ) ≤ squarefreeFrequencyModelBudget t p := by + apply le_trans _ hbase + calc + _ ≤ (2 : ℝ) ^ t * d := by exact_mod_cast hN + _ ≤ (2 : ℝ) ^ t * p := mul_le_mul_of_nonneg_left hM.1.1 (by positivity) + _ ≤ _ := le_add_of_nonneg_right (by positivity) + have h8 : (p + 3) ^ 8 ≤ squarefreeFrequencyModelBudget t p := + (le_add_of_nonneg_left (mul_nonneg (by positivity) hp)).trans hbase + have hHq : (squarefreeStructureHeight d ⌈Real.exp p⌉₊ : ℝ) ≤ + Real.exp (squarefreeFrequencyModelBudget t p) := + (squarefreeStructureHeight_ceil_exp d hp hM.1.1).trans (Real.exp_le_exp.mpr h8) + have hGq : (replicatedFrequencyHeight d ⌈Real.exp p⌉₊ : ℝ) ≤ + Real.exp (squarefreeFrequencyModelBudget t p) := + (replicatedFrequencyHeight_ceil_exp d hp hM.1.1).trans (Real.exp_le_exp.mpr + ((pow_le_pow_right₀ (by linarith : (1 : ℝ) ≤ p + 3) (by decide : 4 ≤ 8)).trans h8)) + refine ⟨B, hB, hstable, ?_, ?_, ?_⟩ + · exact M.squarefreeModel_complexity hM B hB hstable hq hdq + (squarefree_frequency_grid_budget t _ d l B hp hM.1.1 hN hlexp hBraw) hHq + · intro i + exact rationalLogHeight_le_of_height (M.replicatedFrequency_finBasis_height hM η hη i) hGq + · intro z hz + exact M.squarefreeRealLattice_frequency_integral p η l B hB hstable hdiv hclear z hz + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ControlledTorusDecomposition.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ControlledTorusDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f3d4ba5306b5cad5a2f88d4147abccf204319db --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ControlledTorusDecomposition.lean @@ -0,0 +1,69 @@ +import OAI.Combinatorics.Progressions.Estimates.UniformCommutingCircleDecomposition + +namespace OAI + +section + +namespace Erdos3.CircleFourier + +open scoped BigOperators NNReal + +variable {X : Type*} [PseudoMetricSpace X] {d : ℕ} + [AddAction (Fin d → Circle) X] [ContinuousVAdd (Fin d → Circle) X] + +theorem exists_controlled_torus_decomposition + (hact : ∀ t : Fin d → Circle, Isometry (fun x : X => t +ᵥ x)) + (f : X → ℂ) (L B D : ℝ≥0) (hf : LipschitzWith L f) (hb : ∀ x, ‖f x‖ ≤ B) + (horbit : ∀ (i : Fin d) (t : Circle) (x : X), + dist ((Pi.single i t : Fin d → Circle) +ᵥ x) x ≤ D * ‖t‖) + (δ p : ℝ) (hδ : 0 < δ) (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) + (hLp : (L : ℝ) ≤ Real.exp p) (hDp : (D : ℝ) ≤ Real.exp p) (hδp : δ⁻¹ ≤ Real.exp p) : + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (ν : J → Fin d → ℤ) (v : J → X → ℂ), + (Fintype.card J : ℝ) ≤ Real.exp (2 * p * (2 * p + 2) ^ 4) ∧ + (∀ j i, (|ν j i| : ℝ) ≤ Real.exp ((2 * p + 2) ^ 4)) ∧ + (∀ j, LipschitzWith L (v j) ∧ (∀ x, ‖v j x‖ ≤ B)) ∧ + (∀ j (t : Fin d → Circle) x, + v j (t +ᵥ x) = (∏ i, character (ν j i • t i)) * v j x) ∧ + (∀ (a : Fin d → Circle) (z : ℂ), (∀ x, f (a +ᵥ x) = z * f x) → + ∀ j x, v j (a +ᵥ x) = z * v j x) ∧ + ∀ x, ‖(∑ j, v j x) - f x‖ ≤ δ := by + classical + let A : Fin d → IsometricCircleAction X := torusCoordinateAction hact + let is := List.finRange d + have hd' : (is.length : ℝ) ≤ p := by simpa [is] using hd + obtain ⟨N, _, _, hcard, hprops, herr⟩ := exists_controlled_finite_circle_decomposition A is + (fun i _ j _ => torusCoordinateAction_commutes hact i j) f L B D hf hb + (fun i _ t x => horbit i t x) δ p hδ hp hd' hLp hDp hδp + have hcover : ∀ i : Fin d, ∃ r : Fin is.length, is.get r = i := by + intro i + apply List.mem_iff_get.mp + simp [is] + choose index hindex using hcover + let J := Fin is.length → FejerChoice N + let ν : J → Fin d → ℤ := fun k i => -(k (index i) : ℤ) + let v : J → X → ℂ := fun k => iteratedCircleComponent N A is (fun r => (k r : ℤ)) f + refine ⟨J, inferInstance, ν, v, hcard, ?_, ?_, ?_, ?_, herr⟩ + · intro k i + simpa only [ν, Int.cast_neg, abs_neg] using (hprops k).1 (index i) + · intro k + exact ⟨(hprops k).2.1, (hprops k).2.2.1⟩ + · intro k t x + apply torus_character_of_coordinate_characters (v k) (ν k) ?_ t x + intro i u y + have hi := (hprops k).2.2.2 (index i) u y + rw [hindex i] at hi + exact hi + · intro a z ha k x + apply iteratedCircleComponent_equivariant N A is (fun r => (k r : ℤ)) + (fun y => a +ᵥ y) z ?_ ha x + intro i _ t y + change (Pi.single i t : Fin d → Circle) +ᵥ (a +ᵥ y) = + a +ᵥ ((Pi.single i t : Fin d → Circle) +ᵥ y) + rw [← add_vadd, ← add_vadd, add_comm] + +end Erdos3.CircleFourier + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CoordinatedBohrMatching.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CoordinatedBohrMatching.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e75ad64ee29ba751ac945ea76e1fa41cfad4964 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CoordinatedBohrMatching.lean @@ -0,0 +1,107 @@ +import OAI.Combinatorics.Progressions.Geometry.CoordinatedMatchingScale + +namespace OAI + +section + +namespace Erdos3.CellRefinement + +open LocalConvolution +open scoped BigOperators NNReal + +noncomputable def matchingWidthLoss (rank : ℕ) (P K delta c : ℝ) : ℝ := + K + coordinatedMatchingScaleLoss rank P K delta c + 12 + +theorem matchingWidthLoss_nonneg (rank : ℕ) {P K delta c : ℝ} + (hP : 0 ≤ P) (hK : 0 ≤ K) (hdelta : 0 < delta) (hc : 0 < c) (hc1 : c ≤ 1) : + 0 ≤ matchingWidthLoss rank P K delta c := by + have hEd := (localMomentErrorBudget_spec hdelta).1 + have hEc := (unbalancedErrorBudget_spec hc hc1).1 + unfold matchingWidthLoss coordinatedMatchingScaleLoss + positivity + +variable {N : ℕ} [NeZero N] + +theorem exists_coordinated_bohr_matching + (B : CyclicBohr.Set N) (hBpos : 0 < B.radius) (hB : B.IsRankRegular) + {W epsilon M P K delta c : ℝ} (hW : 0 ≤ W) (hepsilon : 0 < epsilon) + (hM : 0 ≤ M) (hcap : M ≤ Real.exp P) (hP : 0 ≤ P) (hK : 0 ≤ K) + (hdelta : 0 < delta) (hc : 0 < c) (hc1 : c ≤ 1) + (kappa : ℝ≥0) (hkappa : kappa ≤ localizedAverageScale B.rank W (epsilon / 4)) + (hkappaLog : Real.exp (-K) ≤ (kappa : ℝ)) : + let tau := coordinatedMatchingScale B.rank M delta c kappa + ∃ L S : CyclicBohr.Set N, + L.frequencies = B.frequencies ∧ S.frequencies = L.frequencies ∧ + L.IsRankRegular ∧ S.IsRankRegular ∧ 0 < L.radius ∧ 0 < S.radius ∧ + L.radius ≤ B.radius / 3 ∧ S.radius ≤ L.radius ∧ + B.radius * Real.exp (-(K + 6)) ≤ L.radius ∧ + B.radius * Real.exp (-matchingWidthLoss B.rank P K delta c) ≤ S.radius ∧ + L.carrier ⊆ (B.ndilate (kappa / 3)).carrier ∧ + S.carrier ⊆ (L.ndilate tau).carrier ∧ + S.carrier ⊆ (L.ndilate (controlledLocalMomentScale L.rank M delta)).carrier ∧ + tau + tau ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0) ∧ + M ^ 2 * (400 * (max L.rank 1 : ℕ) * ((tau + tau : ℝ≥0) : ℝ)) ≤ c / 32 ∧ + ∀ a f g : ZMod N → ℝ, (∀ x, |a x| ≤ W) → + (∀ x, 0 ≤ f x ∧ f x ≤ 1) → (∀ x, 0 ≤ g x ∧ g x ≤ 1) → + |bilinearIntegral B.carrier B.carrier a f g - + parentTruncatedIntegral B.carrier B.carrier L.carrier S.carrier a f g| ≤ epsilon := by + intro tau + have hkappa0 : 0 < kappa := by + exact_mod_cast (Real.exp_pos (-K)).trans_le hkappaLog + obtain ⟨htau0, htau, hmoment, hsmall, herror⟩ := + coordinatedMatchingScale_spec B.rank hM hdelta hc hkappa0 + obtain ⟨L, S, hLfreq, hSfreq, hLreg, hSreg, hLpos, hSpos, + hLlo, hLhi, hSlo, hShi, hLB, hSL, hcompare⟩ := + exists_bohr_matching_scales_with_scales B hBpos hB hW hepsilon kappa tau + hkappa0 hkappa htau0 htau + have hLrank : L.rank = B.rank := congrArg Finset.card hLfreq + have hkappa1 : kappa ≤ 1 := hkappa.trans + (localizedAverageScale_le_one B.rank hW (show 0 < epsilon / 4 by positivity)) + have htau1 : tau ≤ 1 := htau.trans + ((div_le_self (by positivity) (by norm_num)).trans hkappa1) + have hkappa1R : (kappa : ℝ) ≤ 1 := by exact_mod_cast hkappa1 + have htau1R : (tau : ℝ) ≤ 1 := by exact_mod_cast htau1 + have hLwidth : L.radius ≤ B.radius / 3 := by + have h := mul_le_mul_of_nonneg_right hkappa1R B.radius_nonneg + linarith + have hSwidth : S.radius ≤ L.radius := + hShi.trans (by simpa only [one_mul] using mul_le_mul_of_nonneg_right htau1R L.radius_nonneg) + have h6 : Real.exp (-6 : ℝ) ≤ 1 / 6 := by + have h : (6 : ℝ) ≤ Real.exp 6 := by linarith [Real.add_one_le_exp 6] + simpa only [Real.exp_neg, one_div] using one_div_le_one_div_of_le (by norm_num) h + have h12 : Real.exp (-12 : ℝ) ≤ 1 / 12 := by + have h : (12 : ℝ) ≤ Real.exp 12 := by linarith [Real.add_one_le_exp 12] + simpa only [Real.exp_neg, one_div] using one_div_le_one_div_of_le (by norm_num) h + have htauLog := coordinatedMatchingScale_exp_lower B.rank hM hcap hP hK hdelta hc hc1 hkappaLog + have hBnonneg := B.radius_nonneg + have hLlower : B.radius * Real.exp (-(K + 6)) ≤ L.radius := by + calc + _ = Real.exp (-K) * B.radius * Real.exp (-6) := by + rw [neg_add, Real.exp_add] + ring + _ ≤ (kappa : ℝ) * B.radius * (1 / 6) := by gcongr + _ = (kappa : ℝ) * B.radius / 6 := by ring + _ ≤ _ := hLlo + have hSlower : B.radius * Real.exp (-matchingWidthLoss B.rank P K delta c) ≤ S.radius := by + calc + _ = Real.exp (-K) * Real.exp (-coordinatedMatchingScaleLoss B.rank P K delta c) * + B.radius * Real.exp (-12) := by + unfold matchingWidthLoss + rw [neg_add, Real.exp_add, neg_add, Real.exp_add] + ring + _ ≤ (kappa : ℝ) * (tau : ℝ) * B.radius * (1 / 12) := by gcongr + _ = (kappa : ℝ) * (tau : ℝ) * B.radius / 12 := by ring + _ ≤ _ := hSlo + refine ⟨L, S, hLfreq, hSfreq.trans hLfreq.symm, hLreg, hSreg, hLpos, hSpos, + hLwidth, hSwidth, hLlower, hSlower, hLB, hSL, ?_, ?_, ?_, hcompare⟩ + · apply hSL.trans + apply CyclicBohr.Set.carrier_ndilate_mono + simpa only [hLrank] using hmoment + · simpa only [hLrank] using hsmall + · simpa only [hLrank] using herror + +end Erdos3.CellRefinement + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CorrelatedModerateFourierShift.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CorrelatedModerateFourierShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..701cb8a49d040979fbf791893a85314ab9e182c1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CorrelatedModerateFourierShift.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCorrelatedModeratePlateau +import OAI.Combinatorics.Progressions.Sampling.ForecastModerateWeightedSite + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {B I : Type*} [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] +variable {n K M : ℕ} [NeZero M] +variable (c : B → NormalizedScalarCubeSource Empty) +variable (s : B → Fin n → NormalizedScalarCubeSource I) +variable (a : (∀ b, IntegerScalarCubeBox Empty (c b).length) → ℂ) (offset : B → ℤ) + +theorem correlatedModerateFourierCoefficient_shift + (rows : Finset (Finset I)) (shift : rows → ℤ) (k : rows → Fin M) : + correlatedModerateFourierCoefficient c s a offset M rows shift k = + correlatedModerateFourierCoefficient c s a offset M rows 0 k * + rectangularGridCharacter M k shift := by + have he (x : ∀ b, IntegerScalarCubeBox Empty (c b).length × + (∀ j, IntegerScalarCubeBox I (s b j).length)) : + weightedModerateIntegerJetSum c s rows offset shift x = + weightedModerateIntegerJetSum c s rows offset 0 x + shift := by + simp [weightedModerateIntegerJetSum, add_comm] + unfold correlatedModerateFourierCoefficient + simp_rw [he, rectangularGridCharacter_add, ← mul_assoc] + unfold FiniteProbabilityWeights.complexMean + simp only [mul_assoc, Finset.sum_mul] + +theorem correlatedModerateFourierCoefficient_norm_le + (ha : ∀ z, ‖a z‖ ≤ 1) (rows : Finset (Finset I)) + (shift : rows → ℤ) (k : rows → Fin M) : + ‖correlatedModerateFourierCoefficient c s a offset M rows shift k‖ ≤ 1 := + forecastWeightedGridCoefficient_norm_le (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s rows offset shift) + (fun x => a (fun b => (x b).1)) (fun _ => ha _) M k + +theorem correlatedModerateFourierCoefficient_retained_mass + (ha : ∀ z, ‖a z‖ ≤ 1) (rows : Finset (Finset I)) + (shift : rows → ℤ) (F : Finset (rows → Fin M)) : + (∑ k : F, ‖correlatedModerateFourierCoefficient c s a offset M rows shift k.val‖) ≤ + F.card := + forecastWeightedGridCoefficient_retained_mass (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s rows offset shift) + (fun x => a (fun b => (x b).1)) (fun _ => ha _) M F + +theorem correlatedModeratePlateauApproximation_eq_weightedFourierSum + (H : ℝ) (rows : Finset (Finset I)) (shift z : rows → ℤ) + (F : Finset (rows → Fin M)) : + correlatedModeratePlateauApproximation c s a offset K H rows shift z F = + forecastModerateWeightedFourierSum (K := K) rows F H + (fun k => correlatedModerateFourierCoefficient c s a offset M rows 0 k.val) shift z := by + unfold correlatedModeratePlateauApproximation correlatedModerateGridApproximation + forecastModerateWeightedFourierSum + simp only [correlatedModerateFourierCoefficient_shift c s a offset rows shift, + mul_assoc] + congr 2 + exact (Finset.sum_coe_sort F (fun k => + correlatedModerateFourierCoefficient c s a offset M rows 0 k * + (rectangularGridCharacter M k shift * star (rectangularGridCharacter M k z)))).symm + +theorem correlatedModeratePlateauApproximation_family {Cell : Type*} + (aCell : Cell → (∀ b, IntegerScalarCubeBox Empty (c b).length) → ℂ) + (ha : ∀ cell z, ‖aCell cell z‖ ≤ 1) + (H : ℝ) (rows : Finset (Finset I)) (shift : rows → ℤ) + (F : Finset (rows → Fin M)) : + let β := fun cell (k : F) => + correlatedModerateFourierCoefficient c s (aCell cell) offset M rows 0 k.val + (∀ cell, (∑ k, ‖β cell k‖) ≤ (F.card : ℝ)) ∧ + ∀ cell z, correlatedModeratePlateauApproximation c s (aCell cell) offset K H + rows shift z F = forecastModerateWeightedFourierSum (K := K) rows F H (β cell) shift z := by + dsimp only + exact ⟨fun cell => correlatedModerateFourierCoefficient_retained_mass c s (aCell cell) + offset (ha cell) rows 0 F, + fun cell z => correlatedModeratePlateauApproximation_eq_weightedFourierSum c s + (aCell cell) offset H rows shift z F⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CrossRowCharacterDifference.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CrossRowCharacterDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f9ccf2c84171a372c5eb471b28140220fde8d6f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CrossRowCharacterDifference.lean @@ -0,0 +1,57 @@ +import OAI.Combinatorics.Progressions.Estimates.BooleanCubeProduct +import OAI.Combinatorics.Progressions.Fourier.FiniteFourierSmoothing + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [Fintype G] + +noncomputable def characterCrossRow (f g : G → ℂ) (χ : G → AddChar G ℂ) (h n : G) : ℂ := + (f n * star (g (n + h))) * star (χ h n) + +theorem characterCrossRow_norm (f g : G → ℂ) (χ : G → AddChar G ℂ) + (hf : ∀ n, ‖f n‖ ≤ 1) (hg : ∀ n, ‖g n‖ ≤ 1) (h n : G) : + ‖characterCrossRow f g χ h n‖ ≤ 1 := by + simp only [characterCrossRow, norm_mul, norm_star, AddChar.norm_apply, mul_one] + exact (mul_le_of_le_one_left (norm_nonneg _) (hf n)).trans (hg (n + h)) + +theorem characterCrossRow_derivative (f g : G → ℂ) (χ : G → AddChar G ℂ) (h k n : G) : + multiplicativeDerivative (characterCrossRow f g χ h) k n = + (multiplicativeDerivative f k n * star (multiplicativeDerivative g k (n + h))) * χ h k := by + have hcancel : χ h n * star (χ h n) = 1 := by + change χ h n * (starRingEnd ℂ) (χ h n) = 1 + rw [Complex.mul_conj, Complex.normSq_eq_norm_sq, AddChar.norm_apply] + norm_num + have hshift : n + k + h = n + h + k := by abel + simp only [characterCrossRow, multiplicativeDerivative, star_mul, star_star, + (χ h).map_add_eq_mul, hshift] + calc + _ = (((f n * star (f (n + k))) * (star (g (n + h)) * g (n + h + k))) * χ h k) * + (χ h n * star (χ h n)) := by ring + _ = _ := by rw [hcancel, mul_one]; ring + +theorem characterCrossRow_derivative_correlation_norm (f g : G → ℂ) + (χ : G → AddChar G ℂ) (h k : G) (K : G → ℂ) : + ‖𝔼 n, multiplicativeDerivative (characterCrossRow f g χ h) k n * star (K n)‖ = + ‖𝔼 n, (multiplicativeDerivative f k n * star (multiplicativeDerivative g k (n + h))) * + star (K n)‖ := by + have heq : (𝔼 n, multiplicativeDerivative (characterCrossRow f g χ h) k n * star (K n)) = + χ h k * (𝔼 n, (multiplicativeDerivative f k n * + star (multiplicativeDerivative g k (n + h))) * star (K n)) := by + rw [Finset.mul_expect] + apply Finset.expect_congr rfl + intro n _ + rw [characterCrossRow_derivative] + ring + rw [heq, norm_mul, AddChar.norm_apply, one_mul] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CubicPrimitiveFourierRows.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CubicPrimitiveFourierRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..330970b8898900cbe838fb5244e3e15789ba9b5a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CubicPrimitiveFourierRows.lean @@ -0,0 +1,103 @@ +import OAI.Combinatorics.Progressions.Estimates.CubicFrozenLinearRows +import OAI.Combinatorics.Progressions.Estimates.CubicPrimitiveRows +import OAI.Combinatorics.Progressions.Estimates.NativeResidualCrossInduction + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators TensorProduct + +attribute [local instance] NativeMeanRowCorrelation.lie NativeMeanRowCorrelation.algebra + NativeMeanRowCorrelation.topology NativeMeanRowCorrelation.topologicalAdd + NativeMeanRowCorrelation.continuousSMul NativeMeanRowCorrelation.hausdorff + +theorem exists_cubic_primitive_fourier_rows : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ n, ‖f n‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 4 f → + ∃ q : ℝ, 0 ≤ q ∧ q ≤ (p + C) ^ C ∧ + ∃ W : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) q, + ∃ a : Fin W.outputDim × Fin W.outputDim, ∃ χ : ZMod N → AddChar (ZMod N) ℂ, + Nonempty (NativeMeanRowCorrelation (fun _ : Fin 2 => 1) 2 ((p + C) ^ C) + (fun h n : ZMod N => ![(h.val : ℤ), (n.val : ℤ)]) + (fun h n => (W.cubicPrimitiveFactor f a.1 n * + star (W.cubicPrimitiveFactor f a.2 (n + h))) * star (χ h n))) := by + obtain ⟨A, _, hrows⟩ := exists_cubic_primitive_rows + obtain ⟨B, _, hlinear⟩ := NativeMultidegreeNilcharacter.exists_cubicHhnTensor_row_expansion + obtain ⟨D, _, heliminate⟩ := exists_characters_of_stepOne_rows + let X : Polynomial ℕ := Polynomial.X + let P := (X + Polynomial.C A) ^ A + let Q := (P + Polynomial.C B) ^ B + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (P + (P + Q + Polynomial.C D) ^ D) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hGowers + let u := (p + A) ^ A + let t := (u + B) ^ B + let r := u + t + have hu : 0 ≤ u := by dsimp [u]; positivity + have ht : 0 ≤ t := by dsimp [t]; positivity + have hr : 0 ≤ r := by dsimp [r]; positivity + have hur : u ≤ r := le_add_of_nonneg_right ht + have htr : t ≤ r := le_add_of_nonneg_left hu + have hsum : u + (r + D) ^ D ≤ (p + C) ^ C := by + simpa [X, P, Q, u, t, r, Polynomial.eval₂_pow] using hbudget p hp + have huc : u ≤ (p + C) ^ C := (le_add_of_nonneg_right (by positivity)).trans hsum + have hrc : (r + D) ^ D ≤ (p + C) ^ C := (le_add_of_nonneg_left hu).trans hsum + obtain ⟨q, hq, hqu, W, a, b, χ, ⟨V⟩⟩ := + hrows hp ((Real.exp_le_exp.mpr huc).trans hN) f hf hGowers + let F : ZMod N → ZMod N → ℂ := fun h n => + (W.cubicPrimitiveFactor f a.1 n * star (W.cubicPrimitiveFactor f a.2 (n + h))) * + star (χ h n) * star (V.test.eval ![(h.val : ℤ), (n.val : ℤ)]) + let g : ZMod N → (Unit → ℤ) → ℂ := fun h x => star (W.cubicHhnTensor b ![(h.val : ℤ), x ()]) + have hF (h n : ZMod N) : ‖F h n‖ ≤ Real.exp r := by + dsimp only [F] + rw [norm_mul, norm_star] + apply (mul_le_of_le_one_left (norm_nonneg _) ?_).trans + ((V.test.eval_budget V.complexity _).trans (Real.exp_le_exp.mpr hur)) + rw [norm_mul, norm_star, AddChar.norm_apply, mul_one, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + (W.cubicPrimitiveFactor_norm f hf _ _)).trans + (W.cubicPrimitiveFactor_norm f hf _ _) + have hg (h n : ZMod N) : ‖g h (fun _ => (n.val : ℤ))‖ ≤ 1 := by + dsimp only [g] + rw [norm_star] + exact W.cubicHhnTensor_norm _ _ + have hqt : (q + B) ^ B ≤ t := pow_le_pow_left₀ (by positivity) (by linarith) B + have hE (h : ZMod N) : Nonempty (NativeIntegerExpansion (fun _ : Unit => 1) 1 r (g h)) := + ⟨(Classical.choice (hlinear W h.val b)).conjugate.mono (hqt.trans htr)⟩ + have hcorr : Real.exp (-r) ≤ 𝔼 h : ZMod N, + ‖𝔼 n : ZMod N, F h n * star (g h (fun _ => (n.val : ℤ)))‖ := by + apply (Real.exp_le_exp.mpr (neg_le_neg hur)).trans + simpa only [F, g, star_star, mul_assoc, mul_comm, mul_left_comm] using V.correlation + obtain ⟨ψ, hψ⟩ := heliminate hr F g hF hg hE hcorr + let χ' (h : ZMod N) : AddChar (ZMod N) ℂ := χ h * ψ h + have hrow (h : ZMod N) : finiteFourierCoeff (F h) (ψ h) = + 𝔼 n : ZMod N, (W.cubicPrimitiveFactor f a.1 n * + star (W.cubicPrimitiveFactor f a.2 (n + h))) * star (χ' h n) * + star (V.test.eval ![(h.val : ℤ), (n.val : ℤ)]) := by + unfold finiteFourierCoeff + apply Finset.expect_congr rfl + intro n _ + change ((W.cubicPrimitiveFactor f a.1 n * star (W.cubicPrimitiveFactor f a.2 (n + h))) * + star (χ h n) * star (V.test.eval ![(h.val : ℤ), (n.val : ℤ)])) * star (ψ h n) = + (W.cubicPrimitiveFactor f a.1 n * star (W.cubicPrimitiveFactor f a.2 (n + h))) * + star (χ h n * ψ h n) * star (V.test.eval ![(h.val : ℤ), (n.val : ℤ)]) + rw [star_mul] + ring + refine ⟨q, hq, hqu.trans huc, W, a, χ', ⟨{ + L := V.L + dim := V.dim + model := V.model + test := V.test + complexity := V.complexity.mono huc + correlation := ?_ }⟩⟩ + exact (Real.exp_le_exp.mpr (neg_le_neg hrc)).trans (by simpa only [hrow] using hψ) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CyclicAffineCharacterPhase.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CyclicAffineCharacterPhase.lean new file mode 100644 index 0000000000000000000000000000000000000000..84dcddeca9a67bb5303a133377aec7fb59f7714a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CyclicAffineCharacterPhase.lean @@ -0,0 +1,122 @@ +import OAI.Combinatorics.Progressions.Fourier.ExponentialBohrVolume +import OAI.Combinatorics.Progressions.Fourier.RectangularGridCharacter +import OAI.Combinatorics.Progressions.Lattices.IntegerAffineSubstitution + +namespace OAI + +section + +namespace Erdos3.CircleFourier + +theorem character_sub (x y : Circle) : character (x - y) = character x / character y := by + have hne : character y ≠ 0 := by + intro h + have hn := norm_character y + rw [h, norm_zero] at hn + norm_num at hn + apply (eq_div_iff hne).mpr + rw [← character_add, sub_add_cancel] + +theorem exists_real_character_phase {z : ℂ} (hz : ‖z‖ = 1) : + ∃ r : ℝ, character (r : Circle) = z := by + let c : _root_.Circle := ⟨z, mem_sphere_zero_iff_norm.mpr hz⟩ + obtain ⟨t, ht⟩ := (AddCircle.homeomorphCircle (T := (1 : ℝ)) one_ne_zero).surjective c + rw [AddCircle.homeomorphCircle_apply] at ht + obtain ⟨r, rfl⟩ := QuotientAddGroup.mk_surjective t + exact ⟨r, congrArg (fun c : _root_.Circle => (c : ℂ)) ht⟩ + +end Erdos3.CircleFourier + +namespace Erdos3.CyclicBohr + +variable {N : ℕ} [NeZero N] + +theorem exists_real_frequency_phase (r : ZMod N) : + ∃ theta : ℝ, ∀ x : ZMod N, + CircleFourier.character (((x.val : ℝ) * theta : ℝ) : CircleFourier.Circle) = character r x := by + obtain ⟨theta, htheta⟩ := CircleFourier.exists_real_character_phase (norm_character r 1) + refine ⟨theta, ?_⟩ + intro x + have hphase : (((x.val : ℝ) * theta : ℝ) : CircleFourier.Circle) = + x.val • (theta : CircleFourier.Circle) := by + simpa only [nsmul_eq_mul] using + (AddCircle.coe_nsmul (p := (1 : ℝ)) (n := x.val) (x := theta)) + rw [hphase, CircleFourier.character_nsmul, htheta] + calc + _ = character r (x.val • (1 : ZMod N)) := (AddChar.map_nsmul_eq_pow _ _ _).symm + _ = character r x := by simp + +theorem real_frequency_phase_sub {r : ZMod N} {theta : ℝ} + (htheta : ∀ x : ZMod N, + CircleFourier.character (((x.val : ℝ) * theta : ℝ) : CircleFourier.Circle) = character r x) + (x z : ZMod N) : + CircleFourier.character ((((x.val : ℝ) - (z.val : ℝ)) * theta : ℝ) : CircleFourier.Circle) = + character r (x - z) := by + rw [sub_mul, AddCircle.coe_sub, CircleFourier.character_sub, htheta, htheta, + AddChar.map_sub_eq_div] + +theorem exists_real_frequency_phases (B : Set N) : + ∃ theta : B.frequencies → ℝ, ∀ x z : ZMod N, ∀ r : B.frequencies, + CircleFourier.character ((((x.val : ℝ) - (z.val : ℝ)) * theta r : ℝ) : CircleFourier.Circle) = + character r (x - z) := by + classical + choose theta htheta using (fun r : B.frequencies => exists_real_frequency_phase (r : ZMod N)) + exact ⟨theta, fun x z r => real_frequency_phase_sub (htheta r) x z⟩ + +end Erdos3.CyclicBohr + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem CircleFourier.character_affine_integer_combination + {I : Type*} [Fintype I] (a t : ℝ) (b : I → ℝ) (x : I → ℤ) : + character ((t * (a + ∑ i, (x i : ℝ) * b i) : ℝ) : Circle) = + character ((t * a : ℝ) : Circle) * + ∏ i, character ((t * b i : ℝ) : Circle) ^ (x i) := by + classical + have hcoe (v : I → ℝ) : ((∑ i, v i : ℝ) : Circle) = ∑ i, (v i : Circle) := + map_sum (QuotientAddGroup.mk' (AddSubgroup.zmultiples (1 : ℝ))) v Finset.univ + rw [mul_add, Finset.mul_sum, AddCircle.coe_add, character_add, hcoe, character_fintype_sum] + congr 1 + apply Finset.prod_congr rfl + intro i _ + rw [← character_zsmul, ← AddCircle.coe_zsmul] + congr 1 + congr 1 + simp only [zsmul_eq_mul] + ring + +theorem exists_affine_cyclic_character_phase {I : Type*} [Fintype I] + {N : ℕ} [NeZero N] (ξ : (I → ℤ) →+ ZMod N) (ξ₀ : ZMod N) : + ∃ (a : ℝ) (b : I → ℝ), ∀ (x : I → ℤ) (n : ZMod N), + CircleFourier.character + (((n.val : ℝ) * (a + ∑ i, (x i : ℝ) * b i) : ℝ) : CircleFourier.Circle) = + AddChar.zmodAddEquiv (ξ₀ + ξ x) n := by + classical + obtain ⟨a, ha⟩ := CyclicBohr.exists_real_frequency_phase ξ₀ + choose b hb using fun i => CyclicBohr.exists_real_frequency_phase (ξ (Pi.single i 1)) + simp only [CyclicBohr.character] at ha hb + refine ⟨a, b, ?_⟩ + intro x n + have hx : ξ x = ∑ i, (x i) • ξ (Pi.single i 1) := by + conv_lhs => rw [pi_eq_sum_univ' x] + rw [map_sum] + simp only [map_zsmul] + rw [CircleFourier.character_affine_integer_combination, ha n, hx] + simp only [map_add, map_sum, map_zsmul, AddChar.add_apply, AddChar.sum_apply, + AddChar.zsmul_apply] + congr 1 + apply Finset.prod_congr rfl + intro i _ + rw [hb i n] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/CyclicTorusCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Fourier/CyclicTorusCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..477b6bf6eb2bf64febd9e05df60adbf4ad54f070 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/CyclicTorusCoordinates.lean @@ -0,0 +1,90 @@ +import OAI.Combinatorics.Progressions.Fourier.DivisibleCharacterExtension +import OAI.Combinatorics.Progressions.Lattices.LatticeCoordinateLifts + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {ι κ : Type} [Fintype ι] [Fintype κ] {N : ℕ} [NeZero N] + (η : (ι → ℤ) →+ ZMod N) (b : Basis κ ℤ (cyclicIntegerKernel η)) + +noncomputable def cyclicKernelRealCoordinates : (ι → ℝ) ≃ₗ[ℝ] (κ → ℝ) := + (b.ofZLatticeBasis ℝ (cyclicIntegerKernel η)).equivFun + +noncomputable def cyclicKernelCoordinateCharacter (i : κ) : + (ι → ℤ) →+ AddCircle (1 : ℝ) where + toFun x := (cyclicKernelRealCoordinates η b (integerVectorRealMap x) i : ℝ) + map_zero' := by simp + map_add' x y := by simp only [map_add, Pi.add_apply, AddCircle.coe_add] + +theorem cyclicKernelCoordinateCharacter_eq_zero (x : ι → ℤ) (hx : η x = 0) (i : κ) : + cyclicKernelCoordinateCharacter η b i x = 0 := by + let y : cyclicIntegerKernel η := + ⟨integerVectorRealMap x, (integerVectorRealMap_mem_cyclicIntegerKernel η x).mpr hx⟩ + change ((b.ofZLatticeBasis ℝ (cyclicIntegerKernel η)).repr (y : ι → ℝ) i : + AddCircle (1 : ℝ)) = 0 + rw [Basis.ofZLatticeBasis_repr_apply] + apply (AddCircle.coe_eq_zero_iff (1 : ℝ)).mpr + exact ⟨b.repr y i, by simp⟩ + +theorem cyclicKernelCoordinateCharacters_eq_zero_iff (x : ι → ℤ) : + (∀ i, cyclicKernelCoordinateCharacter η b i x = 0) ↔ η x = 0 := by + refine ⟨?_, fun hx i => cyclicKernelCoordinateCharacter_eq_zero η b x hx i⟩ + intro h + apply (integerVectorRealMap_mem_cyclicIntegerKernel η x).mp + rw [← b.ofZLatticeBasis_span ℝ (cyclicIntegerKernel η)] + rw [Basis.mem_span_iff_repr_mem] + intro i + obtain ⟨z, hz⟩ := (AddCircle.coe_eq_zero_iff (1 : ℝ)).mp (h i) + exact ⟨z, by simpa [cyclicKernelRealCoordinates, Basis.equivFun_apply] using hz⟩ + +theorem cyclicKernelCoordinateCharacters_eq_iff (x y : ι → ℤ) : + (∀ i, cyclicKernelCoordinateCharacter η b i x = + cyclicKernelCoordinateCharacter η b i y) ↔ η x = η y := by + rw [← sub_eq_zero, ← map_sub, ← cyclicKernelCoordinateCharacters_eq_zero_iff η b] + simp only [map_sub, sub_eq_zero] + +theorem exists_cyclic_kernel_real_frequencies : + ∃ t : κ → ℝ, (∀ i, t i ∈ Set.Ico (0 : ℝ) 1) ∧ + (∀ i, ∃ k : ℤ, (N : ℝ) * t i = (k : ℝ)) ∧ + ∀ (x : ι → ℤ) (n : ℤ), η x = (n : ZMod N) → ∀ i, + ((cyclicKernelRealCoordinates η b (integerVectorRealMap x) i : ℝ) : + AddCircle (1 : ℝ)) = (((n : ℝ) * t i : ℝ) : AddCircle (1 : ℝ)) := by + have h := fun i => exists_cyclic_real_character_lift η + (cyclicKernelCoordinateCharacter η b i) + (fun x hx => cyclicKernelCoordinateCharacter_eq_zero η b x hx i) + choose t ht hperiod hformula using h + exact ⟨t, ht, hperiod, fun x n hn i => hformula i x n hn⟩ + +theorem cyclicKernelCoordinateCharacters_injOn + (S : Set (ι → ℤ)) (hη : Set.InjOn η S) : + Set.InjOn (fun x i => cyclicKernelCoordinateCharacter η b i x) S := by + intro x hx y hy hxy + apply hη hx hy + exact (cyclicKernelCoordinateCharacters_eq_iff η b x y).mp (congrFun hxy) + +theorem exists_affine_cyclic_kernel_real_frequencies + (h₀ : ZMod N) : + ∃ t : κ → ℝ, (∀ i, t i ∈ Set.Ico (0 : ℝ) 1) ∧ + (∀ i, ∃ k : ℤ, (N : ℝ) * t i = (k : ℝ)) ∧ + ∀ (h : ZMod N) (x : ι → ℤ), h = h₀ + η x → ∀ i, + ((cyclicKernelRealCoordinates η b (integerVectorRealMap x) i : ℝ) : + AddCircle (1 : ℝ)) = + ((((h.val : ℝ) - h₀.val) * t i : ℝ) : AddCircle (1 : ℝ)) := by + obtain ⟨t, ht, hperiod, hformula⟩ := exists_cyclic_kernel_real_frequencies η b + refine ⟨t, ht, hperiod, ?_⟩ + intro h x hx i + have he : η x = (((h.val : ℤ) - h₀.val : ℤ) : ZMod N) := by + simp only [Int.cast_sub, Int.cast_natCast, ZMod.natCast_zmod_val] + rw [hx, add_sub_cancel_left] + simpa only [Int.cast_sub, Int.cast_natCast] using hformula x _ he i + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/DilationFrequencyPhase.lean b/lean/OAI/Combinatorics/Progressions/Fourier/DilationFrequencyPhase.lean new file mode 100644 index 0000000000000000000000000000000000000000..41ddbc20d9d9e19dc0bceb2536e200b7bd06bf71 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/DilationFrequencyPhase.lean @@ -0,0 +1,38 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeDilationObservable + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +theorem NilpotentLieFiltration.realDilationPair_frequency_phase + {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (q : ℤ) (η : L →ₗ[ℚ] ℚ) + (g : (F.dilationPairFiltration (q : ℚ)).realification.Group) + (hg : g ∈ (F.dilationPairFiltration (q : ℚ)).realification.subgroup s) : + (realifyFunctional η (F.realDilationPairProjection (q : ℚ) 0 g).coord : CircleFourier.Circle) = + (q ^ s) • (realifyFunctional η + (F.realDilationPairProjection (q : ℚ) 1 g).coord : CircleFourier.Circle) := by + rw [F.realDilationPair_top_group_relation q g hg, NilpotentLieBCHGroup.coord_zpow, + map_zsmul, AddCircle.coe_zsmul] + +theorem MultidegreeLieFiltration.realDilationPair_frequency_phase + {σ L : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + (q : ℤ) (η : L →ₗ[ℚ] ℚ) + (g : (F.dilationPairMultidegree (q : ℚ)).realification.Group) + (hg : g ∈ (F.dilationPairMultidegree (q : ℚ)).realification.subgroup bound) : + (realifyFunctional η (F.ordinary.realDilationPairProjection (q : ℚ) 0 g).coord : CircleFourier.Circle) = + (q ^ ∑ i, bound i) • (realifyFunctional η + (F.ordinary.realDilationPairProjection (q : ℚ) 1 g).coord : CircleFourier.Circle) := by + rw [F.realDilationPair_top_group_relation q g hg, NilpotentLieBCHGroup.coord_zpow, + map_zsmul, AddCircle.coe_zsmul] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/DivisibleCharacterExtension.lean b/lean/OAI/Combinatorics/Progressions/Fourier/DivisibleCharacterExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff40304ca7962a1103d8b6148125c16264b78aeb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/DivisibleCharacterExtension.lean @@ -0,0 +1,79 @@ +import Mathlib.Algebra.Category.Grp.Injective +import Mathlib.Data.ZMod.Basic +import Mathlib.GroupTheory.QuotientGroup.Basic +import Mathlib.Topology.Instances.AddCircle.Real + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_divisible_character_extension + {A G Q : Type} [AddCommGroup A] [AddCommGroup G] [AddCommGroup Q] + [DivisibleBy Q ℤ] (η : A →+ G) (φ : A →+ Q) + (hker : ∀ x, η x = 0 → φ x = 0) : + ∃ θ : G →+ Q, ∀ x, θ (η x) = φ x := by + let : Module.Injective ℤ Q := (Module.Baer.of_divisible Q).injective + let f := (QuotientAddGroup.kerLift η).toIntLinearMap + let g := (QuotientAddGroup.lift η.ker φ (fun x hx => hker x hx)).toIntLinearMap + obtain ⟨θ, hθ⟩ := Module.Injective.out f (QuotientAddGroup.kerLift_injective η) g + exact ⟨θ.toAddMonoidHom, fun x => hθ (QuotientAddGroup.mk x)⟩ + +theorem exists_cyclic_torus_character + {A : Type} [AddCommGroup A] {N : ℕ} [NeZero N] + (η : A →+ ZMod N) (φ : A →+ AddCircle (1 : ℝ)) + (hker : ∀ x, η x = 0 → φ x = 0) : + ∃ θ : AddCircle (1 : ℝ), N • θ = 0 ∧ ∀ x, φ x = (η x).val • θ := by + obtain ⟨χ, hχ⟩ := exists_divisible_character_extension η φ hker + refine ⟨χ 1, ?_, fun x => ?_⟩ + · rw [← map_nsmul] + simp [nsmul_eq_mul] + · rw [← hχ x, ← map_nsmul] + congr 1 + simp + +theorem exists_cyclic_real_character + {A : Type} [AddCommGroup A] {N : ℕ} [NeZero N] + (η : A →+ ZMod N) (φ : A →+ AddCircle (1 : ℝ)) + (hker : ∀ x, η x = 0 → φ x = 0) : + ∃ t ∈ Set.Ico (0 : ℝ) 1, + (∃ k : ℤ, (N : ℝ) * t = (k : ℝ)) ∧ + ∀ x, φ x = ((((η x).val : ℝ) * t : ℝ) : AddCircle (1 : ℝ)) := by + obtain ⟨θ, hN, hθ⟩ := exists_cyclic_torus_character η φ hker + obtain ⟨t, ht, he⟩ := AddCircle.eq_coe_Ico θ + refine ⟨t, ht, ?_, fun x => ?_⟩ + · rw [← he, ← AddCircle.coe_nsmul, AddCircle.coe_eq_zero_iff] at hN + obtain ⟨k, hk⟩ := hN + exact ⟨k, by simpa [nsmul_eq_mul] using hk.symm⟩ + · rw [hθ, ← he, ← AddCircle.coe_nsmul] + congr 1 + simp [nsmul_eq_mul] + +theorem exists_cyclic_real_character_lift + {A : Type} [AddCommGroup A] {N : ℕ} [NeZero N] + (η : A →+ ZMod N) (φ : A →+ AddCircle (1 : ℝ)) + (hker : ∀ x, η x = 0 → φ x = 0) : + ∃ t ∈ Set.Ico (0 : ℝ) 1, + (∃ k : ℤ, (N : ℝ) * t = (k : ℝ)) ∧ + ∀ (x : A) (n : ℤ), η x = (n : ZMod N) → + φ x = (((n : ℝ) * t : ℝ) : AddCircle (1 : ℝ)) := by + obtain ⟨χ, hχ⟩ := exists_divisible_character_extension η φ hker + obtain ⟨t, ht, he⟩ := AddCircle.eq_coe_Ico (χ 1) + have hN : N • χ 1 = 0 := by rw [← map_nsmul]; simp [nsmul_eq_mul] + refine ⟨t, ht, ?_, ?_⟩ + · rw [← he, ← AddCircle.coe_nsmul, AddCircle.coe_eq_zero_iff] at hN + obtain ⟨k, hk⟩ := hN + exact ⟨k, by simpa [nsmul_eq_mul] using hk.symm⟩ + · intro x n hn + rw [← hχ x, hn] + have hcast : (n : ZMod N) = n • (1 : ZMod N) := by simp [zsmul_eq_mul] + rw [hcast, map_zsmul, ← he, ← AddCircle.coe_zsmul] + congr 1 + simp [zsmul_eq_mul] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ElementaryCharacterTail.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ElementaryCharacterTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c981c049c9abad043acf8515a8a41862b47e3c9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ElementaryCharacterTail.lean @@ -0,0 +1,74 @@ +import Mathlib.Algebra.BigOperators.Fin +import Mathlib.Analysis.SpecialFunctions.Pow.Real +import Mathlib.Tactic +import OAI.Combinatorics.Progressions.Estimates.FiniteReciprocalTenthTail + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem sum_positiveOrders_eq_Ioc (f : ℕ → ℝ) (B R : ℕ) : + (∑ a : Fin R, if B < a.val + 1 then f (a.val + 1) else 0) = + ∑ a ∈ Finset.Ioc B R, f a := by + induction R with + | zero => simp + | succ R ih => + rw [Fin.sum_univ_castSucc] + simp only [Fin.val_castSucc, Fin.val_last, ih] + by_cases hBR : B ≤ R + · rw [Finset.sum_Ioc_succ_top hBR] + simp only [show B < R + 1 by omega, ite_true] + · have hRB : R + 1 ≤ B := by omega + simp [Finset.Ioc_eq_empty_of_le hRB, Finset.Ioc_eq_empty_of_le (by omega : R ≤ B), + show ¬ B < R + 1 by omega] + +theorem finite_positiveOrder_reciprocal_tail (B R : ℕ) (hB : 0 < B) : + (∑ a : Fin R, if B < a.val + 1 then 1 / ((a.val + 1 : ℕ) : ℝ) ^ 2 else 0) ≤ + 1 / (B : ℝ) := by + rw [sum_positiveOrders_eq_Ioc (fun a => 1 / (a : ℝ) ^ 2) B R] + exact finite_reciprocal_square_tail (Finset.Ioc B R) hB + (fun _ h => (Finset.mem_Ioc.mp h).1) + +theorem character_root_power_cancel (a C : ℝ) (ha : 0 < a) (n : ℕ) (hn : 0 < n) : + a ^ n * (C / a ^ (1 / (n : ℝ))) ^ (n * (n + 2)) = + C ^ (n * (n + 2)) / a ^ 2 := by + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + have hroot : (a ^ (1 / (n : ℝ))) ^ n = a := by + rw [← Real.rpow_natCast, ← Real.rpow_mul ha.le] + rw [one_div_mul_cancel hn', Real.rpow_one] + have hpow : (a ^ (1 / (n : ℝ))) ^ (n * (n + 2)) = a ^ (n + 2) := by + rw [pow_mul, hroot] + rw [div_pow, hpow, pow_add] + field_simp + +theorem finite_character_reciprocal_tail (B R n : ℕ) (hB : 0 < B) (hn : 0 < n) + (C : ℝ) (hC : 0 ≤ C) : + (∑ a : Fin R, if B < a.val + 1 then + ((a.val + 1 : ℕ) : ℝ) ^ n * + (C / ((a.val + 1 : ℕ) : ℝ) ^ (1 / (n : ℝ))) ^ (n * (n + 2)) else 0) ≤ + C ^ (n * (n + 2)) / (B : ℝ) := by + have heq : (∑ a : Fin R, if B < a.val + 1 then + ((a.val + 1 : ℕ) : ℝ) ^ n * + (C / ((a.val + 1 : ℕ) : ℝ) ^ (1 / (n : ℝ))) ^ (n * (n + 2)) else 0) = + C ^ (n * (n + 2)) * + ∑ a : Fin R, if B < a.val + 1 then 1 / ((a.val + 1 : ℕ) : ℝ) ^ 2 else 0 := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + by_cases h : B < a.val + 1 + · simp only [h, ite_true] + rw [character_root_power_cancel _ C (by positivity) n hn] + ring + · simp only [h, ite_false, mul_zero] + rw [heq, div_eq_mul_one_div] + exact mul_le_mul_of_nonneg_left (finite_positiveOrder_reciprocal_tail B R hB) (pow_nonneg hC _) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/EuclideanCoefficientTorus.lean b/lean/OAI/Combinatorics/Progressions/Fourier/EuclideanCoefficientTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca8441c284b75f77b0b904e6d97c16ea1c24adfc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/EuclideanCoefficientTorus.lean @@ -0,0 +1,116 @@ +import OAI.Combinatorics.Progressions.Estimates.CoefficientProductHaar +import OAI.Combinatorics.Progressions.Geometry.CoefficientCoordinateEquiv + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory + +variable {K : Type*} {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +abbrev EuclideanCoefficientLayers := + ∀ j : Fin m, BoundedCoefficientExponent K (j.val + 1) → + euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup + +instance euclideanCoefficientLayers_borel [Fintype K] : + BorelSpace (EuclideanCoefficientLayers (K := K) U) := by + let : ∀ j, BorelSpace (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) := + fun _ => QuotientAddGroup.borelSpace + let : ∀ j, BorelSpace (BoundedCoefficientExponent K (j.val + 1) → euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) := + fun _ => Pi.borelSpace + exact Pi.borelSpace + +noncomputable def euclideanCoefficientEquiv : + CoefficientTorus (K := K) U ≃+ EuclideanCoefficientLayers (K := K) U where + toFun x j d := (euclideanSubspaceTorusEquiv (U j)).symm + (coefficientCoordinateEquiv U x ⟨j, d⟩) + invFun y := (coefficientCoordinateEquiv U).symm + (fun s => euclideanSubspaceTorusEquiv (U s.1) (y s.1 s.2)) + left_inv x := by + apply (coefficientCoordinateEquiv U).injective + rw [AddEquiv.apply_symm_apply] + funext s + exact (euclideanSubspaceTorusEquiv (U s.1)).apply_symm_apply _ + right_inv y := by + funext j d + dsimp only + rw [AddEquiv.apply_symm_apply] + exact (euclideanSubspaceTorusEquiv (U j)).symm_apply_apply _ + map_add' x y := by + funext j d + simp only [map_add, Pi.add_apply] + +theorem euclideanCoefficientEquiv_apply (x : CoefficientTorus (K := K) U) + (j : Fin m) (d : BoundedCoefficientExponent K (j.val + 1)) : + euclideanCoefficientEquiv U x j d = (euclideanSubspaceTorusEquiv (U j)).symm + (coefficientCoordinateTorus U x ⟨j, d⟩) := rfl + +theorem euclideanCoefficientEquiv_continuous [Fintype K] : + Continuous (euclideanCoefficientEquiv (K := K) U) := by + apply continuous_pi + intro j + apply continuous_pi + intro d + exact (euclideanSubspaceTorusEquiv_symm_continuous (U j)).comp + ((continuous_apply ⟨j, d⟩).comp (coefficientCoordinateTorus_continuous U)) + +noncomputable def euclideanCoefficientHomeomorph [Fintype K] + [CompactSpace (CoefficientTorus (K := K) U)] : + CoefficientTorus (K := K) U ≃ₜ EuclideanCoefficientLayers (K := K) U := by + exact Continuous.homeoOfEquivCompactToT2 + (f := (euclideanCoefficientEquiv U).toEquiv) (euclideanCoefficientEquiv_continuous U) + +noncomputable def euclideanCoefficientMeasurableEquiv [Fintype K] + [CompactSpace (CoefficientTorus (K := K) U)] + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] : + CoefficientTorus (K := K) U ≃ᵐ EuclideanCoefficientLayers (K := K) U := + (euclideanCoefficientHomeomorph U).toMeasurableEquiv + +theorem euclideanCoefficient_measurePreserving [Fintype K] + [CompactSpace (CoefficientTorus (K := K) U)] + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) 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)] : + MeasurePreserving (euclideanCoefficientEquiv U) μ + (Measure.pi (fun j => Measure.pi (fun _ : BoundedCoefficientExponent K (j.val + 1) => ν j))) := by + let ξ := Measure.pi (fun j => Measure.pi (fun _ : BoundedCoefficientExponent K (j.val + 1) => ν j)) + let : CompactSpace (EuclideanCoefficientLayers (K := K) U) := by + have hc := isCompact_univ.image (euclideanCoefficientEquiv_continuous (K := K) U) + rw [Set.image_univ, Set.range_eq_univ.mpr (euclideanCoefficientEquiv U).surjective] at hc + exact ⟨hc⟩ + let : ∀ j, IsProbabilityMeasure + (Measure.pi (fun _ : BoundedCoefficientExponent K (j.val + 1) => ν j)) := + fun j => Measure.pi.instIsProbabilityMeasure _ + let : IsProbabilityMeasure ξ := Measure.pi.instIsProbabilityMeasure _ + let : IsFiniteMeasure ξ := ⟨by simp [measure_univ]⟩ + let : ∀ j, (Measure.pi (fun _ : BoundedCoefficientExponent K (j.val + 1) => ν j)).IsAddLeftInvariant := + fun j => Measure.pi.isAddLeftInvariant _ + let : ξ.IsAddLeftInvariant := Measure.pi.isAddLeftInvariant _ + let : μ.IsAddHaarMeasure := + { toIsFiniteMeasureOnCompacts := inferInstance + toIsAddLeftInvariant := inferInstance + toIsOpenPosMeasure := isOpenPosMeasure_of_addLeftInvariant_of_compact + (μ := μ) Set.univ isCompact_univ (by simp) } + let : ξ.IsAddHaarMeasure := + { toIsFiniteMeasureOnCompacts := ⟨fun _ _ => measure_lt_top ξ _⟩ + toIsAddLeftInvariant := inferInstance + toIsOpenPosMeasure := isOpenPosMeasure_of_addLeftInvariant_of_compact + (μ := ξ) Set.univ isCompact_univ (by simp) } + exact AddMonoidHom.measurePreserving + (f := (euclideanCoefficientEquiv U).toAddMonoidHom) + (euclideanCoefficientEquiv_continuous U) (euclideanCoefficientEquiv U).surjective (by simp) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/EuclideanJetTorus.lean b/lean/OAI/Combinatorics/Progressions/Fourier/EuclideanJetTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..bdb523aa5349968a320947f4ae3862a82d0c1752 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/EuclideanJetTorus.lean @@ -0,0 +1,620 @@ +import OAI.Combinatorics.Progressions.Fourier.CommonCoveredSiteCharacter +import OAI.Combinatorics.Progressions.Linear.BooleanJetMatrixFactor + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical + +def coefficientIntegerLattice {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) : AddSubgroup (CoefficientArray (K := K) U) where + carrier := {x | ∀ s a, ∃ n : ℤ, (x s).val a = n} + zero_mem' s a := ⟨0, by simp⟩ + add_mem' := by + intro x y hx hy s a + obtain ⟨n, hn⟩ := hx s a + obtain ⟨m, hm⟩ := hy s a + refine ⟨n + m, ?_⟩ + change (x s).val a + (y s).val a = ((n + m : ℤ) : ℝ) + rw [hn, hm, Int.cast_add] + neg_mem' := by + intro x hx s a + obtain ⟨n, hn⟩ := hx s a + refine ⟨-n, ?_⟩ + change -(x s).val a = ((-n : ℤ) : ℝ) + rw [hn, Int.cast_neg] + +abbrev CoefficientTorus {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) := + CoefficientArray (K := K) U ⧸ coefficientIntegerLattice U + +theorem coefficientArrayFunctional_integral {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (x : CoefficientArray (K := K) U) (hx : x ∈ coefficientIntegerLattice U) : + ∃ n : ℤ, coefficientArrayFunctional U frequency x = n := by + change ∀ s a, ∃ n : ℤ, (x s).val a = n at hx + choose z hz using hx + refine ⟨∑ s : CoefficientSlot K m, ∑ a, frequency s.1 s.2.val a * z s a, ?_⟩ + change (∑ s : CoefficientSlot K m, ∑ a, (frequency s.1 s.2.val a : ℝ) * (x s).val a) = _ + simp only [hz, Int.cast_sum, Int.cast_mul] + +noncomputable def coefficientTorusCharacter {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : + CoefficientTorus (K := K) U → ℂ := + quotientLinearCharacter (coefficientIntegerLattice U) (coefficientArrayFunctional U frequency) + (coefficientArrayFunctional_integral U frequency) + +theorem coefficientTorusCharacter_mk {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (x : CoefficientArray (K := K) U) : + coefficientTorusCharacter U frequency (QuotientAddGroup.mk' (coefficientIntegerLattice U) x) = + CircleFourier.character (coefficientArrayFunctional U frequency x : CircleFourier.Circle) := rfl + +theorem coefficientTorusCharacter_integrable {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (μ : Measure (CoefficientTorus (K := K) U)) [IsFiniteMeasure μ] : + Integrable (coefficientTorusCharacter U frequency) μ := + quotientLinearCharacter_integrable _ _ _ + (coefficientArrayFunctional U frequency).continuous_of_finiteDimensional μ + +theorem coefficientTorusCharacter_integral {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + [MeasurableSpace (CoefficientTorus (K := K) U)] [MeasurableAdd₂ (CoefficientTorus (K := K) U)] + (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] : + (∫ x, coefficientTorusCharacter U frequency x ∂μ) = + if affineCoefficientModeTrivial U frequency then 1 else 0 := by + rw [coefficientTorusCharacter, quotientLinearCharacter_integral, + coefficientArrayFunctional_eq_zero_iff_trivial] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +abbrev CoefficientCoordinateTori {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) := + ∀ s : CoefficientSlot K m, SubspaceArrayTorus Unit (U s.1) + +def coefficientCoordinateArray {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (s : CoefficientSlot K m) : + CoefficientArray (K := K) U →ₗ[ℝ] (Unit → U s.1) where + toFun x _ := x s + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def coefficientCoordinateTorus {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) : + CoefficientTorus (K := K) U →+ CoefficientCoordinateTori (K := K) U := + AddMonoidHom.pi (fun s => QuotientAddGroup.map (coefficientIntegerLattice U) + (subspaceArrayIntegerLattice Unit (U s.1)) (coefficientCoordinateArray U s).toAddMonoidHom + (fun _x hx _ a => hx s a)) + +theorem coefficientCoordinateTorus_mk {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (x : CoefficientArray (K := K) U) + (s : CoefficientSlot K m) : + coefficientCoordinateTorus U (QuotientAddGroup.mk' (coefficientIntegerLattice U) x) s = + QuotientAddGroup.mk' (subspaceArrayIntegerLattice Unit (U s.1)) (fun _ => x s) := rfl + +theorem coefficientCoordinateTorus_surjective {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) : + Function.Surjective (coefficientCoordinateTorus (K := K) U) := by + intro y + choose v hv using fun s => QuotientAddGroup.mk'_surjective + (subspaceArrayIntegerLattice Unit (U s.1)) (y s) + refine ⟨QuotientAddGroup.mk' (coefficientIntegerLattice U) (fun s => v s ()), ?_⟩ + funext s + rw [coefficientCoordinateTorus_mk] + have he : (fun _ : Unit => v s ()) = v s := funext (fun u => by cases u; rfl) + rw [he, hv s] + +theorem coefficientCoordinateTorus_continuous {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) : + Continuous (coefficientCoordinateTorus (K := K) U) := by + apply continuous_pi + intro s + apply (QuotientAddGroup.isQuotientMap_mk (coefficientIntegerLattice U)).continuous_iff.mpr + exact QuotientAddGroup.continuous_mk.comp (coefficientCoordinateArray U s).continuous_of_finiteDimensional + +theorem coefficientCoordinateTori_compact {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + [CompactSpace (CoefficientTorus (K := K) U)] : + CompactSpace (CoefficientCoordinateTori (K := K) U) := by + have h := isCompact_univ.image (coefficientCoordinateTorus_continuous (K := K) U) + rw [Set.image_univ, Set.range_eq_univ.mpr (coefficientCoordinateTorus_surjective U)] at h + exact ⟨h⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +def coefficientLayerArray {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (j : Fin m) : + CoefficientArray (K := K) U →ₗ[ℝ] (BoundedCoefficientExponent K (j.val + 1) → U j) where + toFun x d := x ⟨j, d⟩ + map_add' _ _ := rfl + map_smul' _ _ := rfl + +theorem coefficientLayerArray_preserves_lattice {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (j : Fin m) + (x : CoefficientArray (K := K) U) (hx : x ∈ coefficientIntegerLattice U) : + coefficientLayerArray U j x ∈ subspaceArrayIntegerLattice + (BoundedCoefficientExponent K (j.val + 1)) (U j) := fun d a => hx ⟨j, d⟩ a + +def coefficientLayerTorus {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (j : Fin m) : + CoefficientTorus (K := K) U →+ + SubspaceArrayTorus (BoundedCoefficientExponent K (j.val + 1)) (U j) := + QuotientAddGroup.map (coefficientIntegerLattice U) + (subspaceArrayIntegerLattice (BoundedCoefficientExponent K (j.val + 1)) (U j)) + (coefficientLayerArray U j).toAddMonoidHom (coefficientLayerArray_preserves_lattice U j) + +theorem coefficientLayerTorus_mk {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (j : Fin m) (x : CoefficientArray (K := K) U) : + coefficientLayerTorus U j (QuotientAddGroup.mk' (coefficientIntegerLattice U) x) = + QuotientAddGroup.mk' (subspaceArrayIntegerLattice + (BoundedCoefficientExponent K (j.val + 1)) (U j)) (coefficientLayerArray U j x) := rfl + +theorem coefficientLayerTorus_continuous {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (j : Fin m) : + Continuous (coefficientLayerTorus (K := K) U j) := by + apply (QuotientAddGroup.isQuotientMap_mk (coefficientIntegerLattice U)).continuous_iff.mpr + exact QuotientAddGroup.continuous_mk.comp (coefficientLayerArray U j).continuous_of_finiteDimensional + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module + +instance coefficientIntegerLattice_closed {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) : + IsClosed (coefficientIntegerLattice (K := K) U : Set (CoefficientArray (K := K) U)) := by + change IsClosed {x : CoefficientArray (K := K) U | ∀ s a, ∃ n : ℤ, (x s).val a = n} + simp only [Set.ofPred_forall] + apply isClosed_iInter + intro s + apply isClosed_iInter + intro a + have h₁ : Continuous (fun x : CoefficientArray (K := K) U => x s) := continuous_apply s + have h₂ : Continuous (fun x : CoefficientArray (K := K) U => (x s).val) := + continuous_subtype_val.comp h₁ + have h₃ : Continuous (fun x : CoefficientArray (K := K) U => (x s).val a) := + (continuous_apply a).comp h₂ + have h : IsClosed {x : CoefficientArray (K := K) U | ∃ n : ℤ, (n : ℝ) = (x s).val a} := + Real.isClosedEmbedding_intCast.isClosed_range.preimage h₃ + simpa only [eq_comm] using h + +theorem coefficientTorus_compact_of_basis {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + {B : Fin m → Type*} [∀ j, Fintype (B j)] + (b : ∀ j, Basis (B j) ℝ (U j)) + (hb : ∀ j i a, ∃ n : ℤ, (b j i).val a = n) : + CompactSpace (CoefficientTorus (K := K) U) := by + classical + apply compact_quotient_of_integral_basis (coefficientIntegerLattice U) + (Pi.basis (fun s : CoefficientSlot K m => b s.1)) + rintro ⟨s, i⟩ t a + simp only [Pi.basis_apply] + by_cases hts : t = s + · subst t + simpa only [Pi.single_eq_same] using hb s.1 i a + · exact ⟨0, by simp [Pi.single_eq_of_ne hts]⟩ + +noncomputable def coefficientTorusHaar {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + {B : Fin m → Type*} [∀ j, Fintype (B j)] + (b : ∀ j, Basis (B j) ℝ (U j)) + (hb : ∀ j i a, ∃ n : ℤ, (b j i).val a = n) : Measure (CoefficientTorus (K := K) U) := by + letI := coefficientTorus_compact_of_basis (K := K) U b hb + exact probabilityAddHaar _ + +instance coefficientTorusHaar_probability {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + {B : Fin m → Type*} [∀ j, Fintype (B j)] + (b : ∀ j, Basis (B j) ℝ (U j)) + (hb : ∀ j i a, ∃ n : ℤ, (b j i).val a = n) : + IsProbabilityMeasure (coefficientTorusHaar (K := K) U b hb) := by + let _ := coefficientTorus_compact_of_basis (K := K) U b hb + exact probabilityAddHaar_probability _ + +instance coefficientTorusHaar_invariant {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + {B : Fin m → Type*} [∀ j, Fintype (B j)] + (b : ∀ j, Basis (B j) ℝ (U j)) + (hb : ∀ j i a, ∃ n : ℤ, (b j i).val a = n) : + (coefficientTorusHaar (K := K) U b hb).IsAddLeftInvariant := by + let _ := coefficientTorus_compact_of_basis (K := K) U b hb + exact probabilityAddHaar_invariant _ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +noncomputable def affineSampleCoefficientArray {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) + (b : Option K → I → ℝ) : CoefficientArray (K := K) U := + fun s => coefficients (substitute (affineParameterSubstitution b) + (restrictCoefficients (U s.1) (p s.1) (hm s.1))) s.2.val + +theorem affineSampleCoefficientArray_val {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) + (b : Option K → I → ℝ) (s : CoefficientSlot K m) : + (affineSampleCoefficientArray U p hm b s).val = + coefficients (substitute (affineParameterSubstitution b) (p s.1)) s.2.val := by + change (U s.1).subtype (coefficients _ s.2.val) = _ + rw [← coefficients_map, map_substitute, map_restrictCoefficients] + +theorem coefficientArrayFunctional_sample {I K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (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 → ℝ) : + coefficientArrayFunctional U frequency (affineSampleCoefficientArray U p hm b) = + ∑ j, affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ))) + (substitute (fun u => rowPolynomial (fun k => b k u)) (p j)) := by + change (∑ s : CoefficientSlot K m, ∑ a, + (frequency s.1 s.2.val a : ℝ) * (affineSampleCoefficientArray U p hm b s).val a) = _ + simp only [affineSampleCoefficientArray_val, CoefficientSlot, Fintype.sum_sigma, + affineModeLift_substitute] + apply Finset.sum_congr rfl + intro j _ + exact (coefficientFunctional_bounded_expansion (fun d a => (frequency j d a : ℝ)) (h := j.val + 1) _ + (degreeLE_substitute_affine _ (affineParameterSubstitution_degree b) (p j) (hp j))).symm + +noncomputable def affineSampleCoefficientTorus {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) + (b : Option K → I → ℝ) : CoefficientTorus (K := K) U := + QuotientAddGroup.mk' (coefficientIntegerLattice U) (affineSampleCoefficientArray U p hm b) + +theorem coefficientTorusCharacter_sample {I K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (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 → ℝ) : + coefficientTorusCharacter U frequency (affineSampleCoefficientTorus U p hm b) = + layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p b := by + rw [affineSampleCoefficientTorus, coefficientTorusCharacter_mk, coefficientArrayFunctional_sample U frequency p hp hm] + rfl + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3 + +theorem integerMatrixTorusMap_continuous {I S J : Type*} [Fintype I] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (E : Matrix S I ℤ) : + Continuous (integerMatrixTorusMap U E) := by + apply (QuotientAddGroup.isQuotientMap_mk (subspaceArrayIntegerLattice I U)).continuous_iff.mpr + exact QuotientAddGroup.continuous_mk.comp + (matrixModuleAction (W := U) (fun s i => (E s i : ℝ))).continuous_of_finiteDimensional + +namespace VectorPolynomial + +abbrev SiteTorus (S : Type*) {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) := ∀ j, SubspaceArrayTorus S (U j) + +noncomputable def coefficientSiteTorusMap {K S : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (site : S → K → ℤ) : + CoefficientTorus (K := K) U →+ SiteTorus S U := + AddMonoidHom.pi (fun j => (integerMatrixTorusMap (U j) (boundedSiteMatrix (j.val + 1) site)).comp + (coefficientLayerTorus U j)) + +theorem coefficientSiteTorusMap_mk {K S : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (site : S → K → ℤ) + (x : CoefficientArray (K := K) U) (j : Fin m) : + coefficientSiteTorusMap U site (QuotientAddGroup.mk' (coefficientIntegerLattice U) x) j = + QuotientAddGroup.mk' (subspaceArrayIntegerLattice S (U j)) + (matrixModuleAction (fun s d => (boundedSiteMatrix (j.val + 1) site s d : ℝ)) + (coefficientLayerArray U j x)) := rfl + +theorem coefficientSiteTorusMap_continuous {K S : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (site : S → K → ℤ) : + Continuous (coefficientSiteTorusMap U site) := + continuous_pi (fun j => (integerMatrixTorusMap_continuous _ _).comp + (coefficientLayerTorus_continuous U j)) + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +def zeroCoefficientExponent (K : Type*) (h : ℕ) : BoundedCoefficientExponent K h := + ⟨0, by simp⟩ + +noncomputable def constantCoefficientTorus {K J : Type*} (U : Submodule ℝ (J → ℝ)) (h : ℕ) : + SubspaceArrayTorus Unit U →+ SubspaceArrayTorus (BoundedCoefficientExponent K h) U := + integerMatrixTorusMap U (Matrix.of (fun d _ => if d = zeroCoefficientExponent K h then 1 else 0)) + +theorem constantCoefficientTorus_mk {K J : Type*} (U : Submodule ℝ (J → ℝ)) (h : ℕ) + (x : Unit → U) : + constantCoefficientTorus (K := K) U h (QuotientAddGroup.mk' (subspaceArrayIntegerLattice Unit U) x) = + QuotientAddGroup.mk' (subspaceArrayIntegerLattice (BoundedCoefficientExponent K h) U) + (fun d => if d = zeroCoefficientExponent K h then x () else 0) := by + rw [constantCoefficientTorus, integerMatrixTorusMap_mk] + congr 1 + funext d + change (∑ _u : Unit, ((if d = zeroCoefficientExponent K h then 1 else 0 : ℤ) : ℝ) • x _u) = _ + by_cases hd : d = zeroCoefficientExponent K h <;> simp [hd] + +theorem constantCoefficientTorus_continuous {K J : Type*} [Fintype J] + (U : Submodule ℝ (J → ℝ)) (h : ℕ) : + Continuous (constantCoefficientTorus (K := K) U h) := integerMatrixTorusMap_continuous _ _ + +theorem oneSite_constantCoefficientTorus {K J : Type*} [Fintype K] + (U : Submodule ℝ (J → ℝ)) (h : ℕ) (t : K → ℤ) (c : SubspaceArrayTorus Unit U) : + integerMatrixTorusMap U (boundedSiteMatrix h (fun _ : Unit => t)) + (constantCoefficientTorus U h c) = c := by + obtain ⟨x, rfl⟩ := QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice Unit U) c + rw [constantCoefficientTorus_mk, integerMatrixTorusMap_mk] + congr 1 + funext u + change (∑ d : BoundedCoefficientExponent K h, (boundedSiteMatrix h (fun _ : Unit => t) u d : ℝ) • + (if d = zeroCoefficientExponent K h then x () else 0)) = x u + simp only [smul_ite, smul_zero, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + simp [boundedSiteMatrix, zeroCoefficientExponent] + +theorem oneSite_add_constantCoefficientTorus {K J : Type*} [Fintype K] + (U : Submodule ℝ (J → ℝ)) (h : ℕ) (t : K → ℤ) (c : SubspaceArrayTorus Unit U) + (r : SubspaceArrayTorus (BoundedCoefficientExponent K h) U) : + integerMatrixTorusMap U (boundedSiteMatrix h (fun _ : Unit => t)) + (constantCoefficientTorus U h c + r) = + c + integerMatrixTorusMap U (boundedSiteMatrix h (fun _ : Unit => t)) r := by + rw [map_add, oneSite_constantCoefficientTorus] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3 + +open scoped BigOperators Matrix + +theorem matrixModuleAction_surjective_of_period {I S W : Type*} + [Fintype I] [Fintype S] [AddCommGroup W] [Module ℝ W] + (E : Matrix S I ℤ) (a : ℤ) (ha : a ≠ 0) + (hperiod : integerScalarLattice S a ≤ E.mulVecLin.range) : + Function.Surjective (matrixModuleAction (W := W) (fun s i => (E s i : ℝ))) := by + classical + obtain ⟨n, hn⟩ := exists_integer_kernel_dual E a hperiod + let e : S → I → ℤ := E + let A : Matrix S I ℝ := Matrix.of (fun s i => (e s i : ℝ)) + let T : Matrix I S ℝ := fun i s => (n s i : ℝ) / a + have hET : A * T = 1 := by + ext s r + have hsum : (∑ i, (n r i : ℝ) * (e s i : ℝ)) = if r = s then (a : ℝ) else 0 := by + exact_mod_cast hn r s + change (∑ i, (e s i : ℝ) * ((n r i : ℝ) / a)) = _ + have hswap : (∑ i, (e s i : ℝ) * ((n r i : ℝ) / a)) = + (∑ i, (n r i : ℝ) * (e s i : ℝ)) / a := by + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro i _ + ring + rw [hswap, hsum] + by_cases hrs : r = s + · subst r + simp [ha] + · simp [hrs, Ne.symm hrs] + intro y + refine ⟨matrixModuleAction T y, ?_⟩ + change matrixModuleAction A (matrixModuleAction T y) = y + calc + _ = matrixModuleAction (A * T) y := matrixModuleAction_mul A T y + _ = matrixModuleAction (1 : Matrix S S ℝ) y := congrArg (fun M => matrixModuleAction M y) hET + _ = y := by ext s; simp [matrixModuleAction_apply, Matrix.one_apply] + +theorem integerMatrixTorusMap_surjective_of_period {I S J : Type*} + [Fintype I] [Fintype S] (U : Submodule ℝ (J → ℝ)) + (E : Matrix S I ℤ) (a : ℤ) (ha : a ≠ 0) + (hperiod : integerScalarLattice S a ≤ E.mulVecLin.range) : + Function.Surjective (integerMatrixTorusMap U E) := by + intro y + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice S U) y + obtain ⟨x, hx⟩ := matrixModuleAction_surjective_of_period (W := U) E a ha hperiod v + refine ⟨QuotientAddGroup.mk' (subspaceArrayIntegerLattice I U) x, ?_⟩ + rw [integerMatrixTorusMap_mk, hx] + +theorem integerMatrixTorusMap_comp {I S T J : Type*} + [Fintype I] [Fintype S] (U : Submodule ℝ (J → ℝ)) + (A : Matrix T S ℤ) (B : Matrix S I ℤ) (x : SubspaceArrayTorus I U) : + integerMatrixTorusMap U A (integerMatrixTorusMap U B x) = + integerMatrixTorusMap U (A * B) x := by + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice I U) x + have hcast : Matrix.of (fun t s => (A t s : ℝ)) * + Matrix.of (fun s i => (B s i : ℝ)) = + Matrix.of (fun t i => ((A * B) t i : ℝ)) := by + ext t i + simp [Matrix.mul_apply] + exact congrArg (QuotientAddGroup.mk' (subspaceArrayIntegerLattice T U)) + ((matrixModuleAction_mul (Matrix.of (fun t s => (A t s : ℝ))) + (Matrix.of (fun s i => (B s i : ℝ))) v).trans + (congrArg (fun M => matrixModuleAction M v) hcast)) + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped Classical + +abbrev BooleanJetTorus {m : ℕ} (O : Fin m → Type*) {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) := ∀ j, SubspaceArrayTorus (O j) (U j) + +noncomputable def siteBooleanJetTorusMap {α : Type*} [Fintype α] [DecidableEq α] + {m : ℕ} {O J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) + (rows : ∀ j, O j → Finset α) : SiteTorus (Finset α) U →+ BooleanJetTorus O U where + toFun x j := integerMatrixTorusMap (U j) (booleanJetExtractionMatrix (rows j)) (x j) + map_zero' := funext (fun j => map_zero (integerMatrixTorusMap (U j) _)) + map_add' x y := funext (fun j => map_add (integerMatrixTorusMap (U j) _) (x j) (y j)) + +theorem siteBooleanJetTorusMap_continuous {α : Type*} [Fintype α] [DecidableEq α] + {m : ℕ} {O J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (rows : ∀ j, O j → Finset α) : + Continuous (siteBooleanJetTorusMap U rows) := + continuous_pi (fun j => (integerMatrixTorusMap_continuous _ _).comp (continuous_apply j)) + +noncomputable def coefficientBooleanJetTorusMap {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] {m : ℕ} {O J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (D : Matrix α K ℤ) + (rows : ∀ j, O j → Finset α) : CoefficientTorus (K := K) U →+ BooleanJetTorus O U := + (siteBooleanJetTorusMap U rows).comp (coefficientSiteTorusMap U (integerAffineCube root D)) + +theorem coefficientBooleanJetTorusMap_mk {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] {m : ℕ} {O J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (D : Matrix α K ℤ) + (rows : ∀ j, O j → Finset α) (x : CoefficientArray (K := K) U) (j : Fin m) : + coefficientBooleanJetTorusMap U root D rows + (QuotientAddGroup.mk' (coefficientIntegerLattice U) x) j = + QuotientAddGroup.mk' (subspaceArrayIntegerLattice (O j) (U j)) + (matrixModuleAction + (fun o e => (boundedCoefficientJetMatrix root D (j.val + 1) (rows j) o e : ℝ)) + (coefficientLayerArray U j x)) := by + change integerMatrixTorusMap (U j) (booleanJetExtractionMatrix (rows j)) + (integerMatrixTorusMap (U j) (boundedSiteMatrix (j.val + 1) (integerAffineCube root D)) + (QuotientAddGroup.mk' _ (coefficientLayerArray U j x))) = _ + rw [integerMatrixTorusMap_comp, booleanJetExtractionMatrix_mul_boundedSite] + rfl + +theorem coefficientBooleanJetTorusMap_continuous {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] {m : ℕ} {O J : Fin m → Type*} + [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (root : K → ℤ) (D : Matrix α K ℤ) (rows : ∀ j, O j → Finset α) : + Continuous (coefficientBooleanJetTorusMap U root D rows) := + (siteBooleanJetTorusMap_continuous U rows).comp + (coefficientSiteTorusMap_continuous U (integerAffineCube root D)) + +theorem coefficientBooleanJetTorusMap_surjective {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] {m : ℕ} {O J : Fin m → Type*} + [∀ j, Fintype (O j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (root : K → ℤ) (D : Matrix α K ℤ) (a : ℤ) (ha : a ≠ 0) + (hperiod : integerScalarLattice α a ≤ D.mulVecLin.range) + (rows : ∀ j, O j → Finset α) (hinj : ∀ j, Function.Injective (rows j)) + (hdegree : ∀ j o, (rows j o).card ≤ j.val + 1) : + Function.Surjective (coefficientBooleanJetTorusMap U root D rows) := by + intro y + choose v hv using fun j => QuotientAddGroup.mk'_surjective + (subspaceArrayIntegerLattice (O j) (U j)) (y j) + choose c hc using fun j => matrixModuleAction_surjective_of_period (W := U j) + (boundedCoefficientJetMatrix root D (j.val + 1) (rows j)) (a ^ (j.val + 1)) + (pow_ne_zero _ ha) + (boundedCoefficientJetMatrix_period root D a hperiod (j.val + 1) (rows j) + (hinj j) (hdegree j)) (v j) + refine ⟨QuotientAddGroup.mk' (coefficientIntegerLattice U) (fun s => c s.1 s.2), ?_⟩ + funext j + rw [coefficientBooleanJetTorusMap_mk] + change QuotientAddGroup.mk' _ (matrixModuleAction _ (c j)) = y j + rw [hc j, hv j] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +variable {m : ℕ} {O J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +abbrev EuclideanJetLayers (O : Fin m → Type*) := + ∀ j : Fin m, O j → euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup + +instance euclideanJetLayers_borel [∀ j, Fintype (O j)] : BorelSpace (EuclideanJetLayers U O) := by + let : ∀ j, BorelSpace (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) := + fun _ => QuotientAddGroup.borelSpace + let : ∀ j, BorelSpace (O j → euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) := + fun _ => Pi.borelSpace + exact Pi.borelSpace + +noncomputable def euclideanJetEquiv : BooleanJetTorus O U ≃+ EuclideanJetLayers U O where + toFun x j o := (euclideanSubspaceTorusEquiv (U j)).symm (arrayCoordinateEquiv (U j) (x j) o) + invFun y j := (arrayCoordinateEquiv (U j)).symm (fun o => euclideanSubspaceTorusEquiv (U j) (y j o)) + left_inv x := by + funext j + apply (arrayCoordinateEquiv (U j)).injective + rw [AddEquiv.apply_symm_apply] + funext o + exact (euclideanSubspaceTorusEquiv (U j)).apply_symm_apply _ + right_inv y := by + funext j o + dsimp only + rw [AddEquiv.apply_symm_apply] + exact (euclideanSubspaceTorusEquiv (U j)).symm_apply_apply _ + map_add' x y := by + funext j o + simp only [map_add, Pi.add_apply] + +theorem euclideanJetEquiv_continuous [∀ j, Fintype (O j)] : + Continuous (euclideanJetEquiv (O := O) U) := by + apply continuous_pi + intro j + apply continuous_pi + intro o + exact (euclideanSubspaceTorusEquiv_symm_continuous (U j)).comp + ((continuous_apply o).comp ((arrayCoordinateEquiv_continuous (U j)).comp (continuous_apply j))) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ExpandingGramSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ExpandingGramSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c376705218d8f9ec39170ce5687dcd15bb87510 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ExpandingGramSpectrum.lean @@ -0,0 +1,73 @@ +import Mathlib.Algebra.Order.BigOperators.GroupWithZero.Finset +import Mathlib.Analysis.Matrix.PosDef +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open Matrix +open scoped ComplexOrder + +theorem one_le_eigenvalues_of_sub_one_posSemidef + {ι : Type*} [Fintype ι] [DecidableEq ι] + {M : Matrix ι ι ℝ} (hM : M.IsHermitian) (h : (M - 1).PosSemidef) (i : ι) : + 1 ≤ hM.eigenvalues i := by + let v := hM.eigenvectorBasis i + have hv : star (⇑v) ⬝ᵥ ⇑v = (1 : ℝ) := by + rw [dotProduct_comm] + change inner ℝ v v = 1 + rw [real_inner_self_eq_norm_sq, hM.eigenvectorBasis.orthonormal.1 i, one_pow] + have he : star (⇑v) ⬝ᵥ (M *ᵥ ⇑v) = hM.eigenvalues i := by + simpa only [RCLike.re_to_real] using (hM.eigenvalues_eq i).symm + have hp := h.dotProduct_mulVec_nonneg (⇑v) + rw [Matrix.sub_mulVec, Matrix.one_mulVec, dotProduct_sub, he, hv] at hp + linarith + +theorem one_le_det_of_sub_one_posSemidef + {ι : Type*} [Fintype ι] [DecidableEq ι] + {M : Matrix ι ι ℝ} (hM : M.IsHermitian) (h : (M - 1).PosSemidef) : + 1 ≤ M.det := by + rw [hM.det_eq_prod_eigenvalues] + exact Finset.one_le_prod₀ (fun i _ => one_le_eigenvalues_of_sub_one_posSemidef hM h i) + +theorem eigenvalues_le_det_of_sub_one_posSemidef + {ι : Type*} [Fintype ι] [DecidableEq ι] + {M : Matrix ι ι ℝ} (hM : M.IsHermitian) (h : (M - 1).PosSemidef) (i : ι) : + hM.eigenvalues i ≤ M.det := by + rw [hM.det_eq_prod_eigenvalues] + have heigen := one_le_eigenvalues_of_sub_one_posSemidef hM h + have hp := Finset.prod_le_prod_of_subset_of_one_le₀ + (f := hM.eigenvalues) (Finset.subset_univ ({i} : Finset ι)) + (fun j _ => zero_le_one.trans (heigen j)) (fun j _ _ => heigen j) + simpa only [Finset.prod_singleton, RCLike.ofReal_real_eq_id, id_eq] using hp + +theorem det_smul_one_sub_posSemidef + {ι : Type*} [Fintype ι] [DecidableEq ι] + {M : Matrix ι ι ℝ} (hM : M.IsHermitian) (h : (M - 1).PosSemidef) : + (M.det • (1 : Matrix ι ι ℝ) - M).PosSemidef := by + let U : Matrix ι ι ℝ := hM.eigenvectorUnitary + have hdiag : (Matrix.diagonal (fun i => M.det - hM.eigenvalues i)).PosSemidef := + Matrix.posSemidef_diagonal_iff.mpr (fun i => + sub_nonneg.mpr (eigenvalues_le_det_of_sub_one_posSemidef hM h i)) + have hd : Matrix.diagonal (fun i => M.det - hM.eigenvalues i) = + M.det • (1 : Matrix ι ι ℝ) - Matrix.diagonal hM.eigenvalues := by + ext i j + by_cases hij : i = j <;> simp [hij] + have hs : M = U * Matrix.diagonal hM.eigenvalues * U.conjTranspose := by + simpa only [Unitary.conjStarAlgAut_apply, Function.comp_def, RCLike.ofReal_real_eq_id, + id_eq, Matrix.star_eq_conjTranspose] using + hM.spectral_theorem + have hU : U * U.conjTranspose = 1 := Unitary.coe_mul_star_self hM.eigenvectorUnitary + have hp := hdiag.mul_mul_conjTranspose_same U + rw [hd, Matrix.mul_sub, Matrix.sub_mul, Matrix.mul_smul, Matrix.mul_one, + Matrix.smul_mul, hU, ← hs] at hp + exact hp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ExponentialBohrVolume.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ExponentialBohrVolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..402b30251af52c088d8926c7820574d219d91efd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ExponentialBohrVolume.lean @@ -0,0 +1,885 @@ +import Mathlib +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds +import Mathlib.Combinatorics.Additive.Dissociation +import Mathlib.Combinatorics.Pigeonhole + +namespace OAI + +section + +namespace Erdos3 + +open AddChar Finset +open scoped BigOperators + +namespace CyclicBohr + +variable {N : ℕ} [NeZero N] + +noncomputable def character (r : ZMod N) : AddChar (ZMod N) ℂ := + AddChar.zmodAddEquiv r + +@[simp] lemma character_zero (r : ZMod N) : character r 0 = 1 := by + exact AddChar.map_zero_eq_one _ + +@[simp] lemma character_add (r x y : ZMod N) : + character r (x + y) = character r x * character r y := by + exact AddChar.map_add_eq_mul _ _ _ + +@[simp] lemma norm_character (r x : ZMod N) : ‖character r x‖ = 1 := by + simp [character] + +lemma character_comm (r x : ZMod N) : character r x = character x r := by + obtain ⟨r, rfl⟩ := ZMod.intCast_surjective r + obtain ⟨x, rfl⟩ := ZMod.intCast_surjective x + change (↑(AddChar.zmod N (r : ZMod N) (x : ZMod N)) : ℂ) = + ↑(AddChar.zmod N (x : ZMod N) (r : ZMod N)) + rw [AddChar.zmod_intCast, AddChar.zmod_intCast] + congr 1 + ring_nf + rfl + +@[simp] lemma character_zero_index (x : ZMod N) : character 0 x = 1 := by + rw [character_comm, character_zero] + +@[simp] lemma character_add_index (r s x : ZMod N) : + character (r + s) x = character r x * character s x := by + rw [character_comm, character_add, character_comm x r, character_comm x s] + +lemma norm_one_sub_mul_of_norm_le_one {a b : ℂ} (ha : ‖a‖ ≤ 1) : + ‖1 - a * b‖ ≤ ‖1 - a‖ + ‖1 - b‖ := by + calc + ‖1 - a * b‖ = ‖(1 - a) + a * (1 - b)‖ := by ring_nf + _ ≤ ‖1 - a‖ + ‖a * (1 - b)‖ := norm_add_le _ _ + _ ≤ ‖1 - a‖ + ‖1 - b‖ := by + gcongr + exact (norm_mul_le _ _).trans (mul_le_of_le_one_left (norm_nonneg _) ha) + +structure Set (N : ℕ) [NeZero N] where + frequencies : Finset (ZMod N) + radius : ℝ + radius_nonneg : 0 ≤ radius + +namespace Set + +noncomputable def carrier (B : Set N) : Finset (ZMod N) := + Finset.univ.filter fun x ↦ + ∀ r ∈ B.frequencies, ‖1 - character r x‖ ≤ B.radius + +instance : Membership (ZMod N) (Set N) := ⟨fun B x ↦ x ∈ B.carrier⟩ + +@[simp] lemma mem_carrier {B : Set N} {x : ZMod N} : + x ∈ B.carrier ↔ + ∀ r ∈ B.frequencies, ‖1 - character r x‖ ≤ B.radius := by + simp [carrier] + +lemma mem_iff {B : Set N} {x : ZMod N} : + x ∈ B ↔ ∀ r ∈ B.frequencies, ‖1 - character r x‖ ≤ B.radius := + mem_carrier + +def rank (B : Set N) : ℕ := B.frequencies.card + +def dilate (ρ : ℝ) (B : Set N) : Set N where + frequencies := B.frequencies + radius := |ρ| * B.radius + radius_nonneg := mul_nonneg (abs_nonneg _) B.radius_nonneg + +def ofFrequencies (Γ : Finset (ZMod N)) (ρ : ℝ) (hρ : 0 ≤ ρ) : Set N where + frequencies := Γ + radius := ρ + radius_nonneg := hρ + +def meet (B C : Set N) : Set N where + frequencies := B.frequencies ∪ C.frequencies + radius := min B.radius C.radius + radius_nonneg := le_min B.radius_nonneg C.radius_nonneg + +@[simp] lemma frequencies_ofFrequencies (Γ : Finset (ZMod N)) (ρ : ℝ) (hρ : 0 ≤ ρ) : + (ofFrequencies Γ ρ hρ).frequencies = Γ := rfl + +@[simp] lemma radius_ofFrequencies (Γ : Finset (ZMod N)) (ρ : ℝ) (hρ : 0 ≤ ρ) : + (ofFrequencies Γ ρ hρ).radius = ρ := rfl + +@[simp] lemma rank_ofFrequencies (Γ : Finset (ZMod N)) (ρ : ℝ) (hρ : 0 ≤ ρ) : + (ofFrequencies Γ ρ hρ).rank = Γ.card := rfl + +@[simp] lemma frequencies_meet (B C : Set N) : + (B.meet C).frequencies = B.frequencies ∪ C.frequencies := rfl + +@[simp] lemma radius_meet (B C : Set N) : + (B.meet C).radius = min B.radius C.radius := rfl + +lemma rank_meet_le (B C : Set N) : (B.meet C).rank ≤ B.rank + C.rank := by + exact Finset.card_union_le _ _ + +@[simp] lemma frequencies_dilate (ρ : ℝ) (B : Set N) : + (B.dilate ρ).frequencies = B.frequencies := rfl + +@[simp] lemma radius_dilate (ρ : ℝ) (B : Set N) : + (B.dilate ρ).radius = |ρ| * B.radius := rfl + +@[simp] lemma rank_dilate (ρ : ℝ) (B : Set N) : + (B.dilate ρ).rank = B.rank := rfl + +@[simp] lemma zero_mem (B : Set N) : (0 : ZMod N) ∈ B := by + rw [mem_iff] + intro r hr + simp [B.radius_nonneg] + +lemma carrier_nonempty (B : Set N) : B.carrier.Nonempty := + ⟨0, B.zero_mem⟩ + +lemma card_pos (B : Set N) : 0 < B.carrier.card := + Finset.card_pos.mpr B.carrier_nonempty + +lemma neg_mem_iff (B : Set N) (x : ZMod N) : -x ∈ B ↔ x ∈ B := by + rw [mem_iff, mem_iff] + have hnorm (z : ℂ) : ‖1 - (starRingEnd ℂ) z‖ = ‖1 - z‖ := by + simpa using (RCLike.norm_conj (1 - z)) + constructor + · intro h r hr + have hr' := h r hr + rw [AddChar.map_neg_eq_conj, hnorm] at hr' + exact hr' + · intro h r hr + rw [AddChar.map_neg_eq_conj, hnorm] + exact h r hr + +lemma add_mem_of_mem {B₁ B₂ B₃ : Set N} + (hfreq₁ : B₃.frequencies ⊆ B₁.frequencies) + (hfreq₂ : B₃.frequencies ⊆ B₂.frequencies) + (hradius : B₁.radius + B₂.radius ≤ B₃.radius) + {x y : ZMod N} (hx : x ∈ B₁) (hy : y ∈ B₂) : x + y ∈ B₃ := by + rw [mem_iff] at hx hy ⊢ + intro r hr + calc + ‖1 - character r (x + y)‖ = + ‖1 - character r x * character r y‖ := by rw [character_add] + _ ≤ ‖1 - character r x‖ + ‖1 - character r y‖ := + norm_one_sub_mul_of_norm_le_one (by rw [norm_character]) + _ ≤ B₁.radius + B₂.radius := add_le_add (hx r (hfreq₁ hr)) (hy r (hfreq₂ hr)) + _ ≤ B₃.radius := hradius + +lemma add_mem_dilate {B : Set N} {ρ σ : ℝ} (hρ : 0 ≤ ρ) (hσ : 0 ≤ σ) + {x y : ZMod N} (hx : x ∈ B.dilate ρ) (hy : y ∈ B.dilate σ) : + x + y ∈ B.dilate (ρ + σ) := by + apply add_mem_of_mem (B₁ := B.dilate ρ) (B₂ := B.dilate σ) + (B₃ := B.dilate (ρ + σ)) + · simp + · simp + · simp [abs_of_nonneg hρ, abs_of_nonneg hσ, abs_of_nonneg (add_nonneg hρ hσ), add_mul] + · exact hx + · exact hy + +lemma sub_mem_dilate {B : Set N} {ρ σ : ℝ} (hρ : 0 ≤ ρ) (hσ : 0 ≤ σ) + {x y : ZMod N} (hx : x ∈ B.dilate ρ) (hy : y ∈ B.dilate σ) : + x - y ∈ B.dilate (ρ + σ) := by + rw [sub_eq_add_neg] + apply add_mem_dilate hρ hσ hx + exact (B.dilate σ).neg_mem_iff y |>.2 hy + +lemma carrier_mono {B₁ B₂ : Set N} (hfreq : B₂.frequencies ⊆ B₁.frequencies) + (hradius : B₁.radius ≤ B₂.radius) : B₁.carrier ⊆ B₂.carrier := by + intro x hx + rw [mem_carrier] at hx ⊢ + intro r hr + exact (hx r (hfreq hr)).trans hradius + +lemma carrier_meet_subset_left (B C : Set N) : (B.meet C).carrier ⊆ B.carrier := by + apply carrier_mono + · exact Finset.subset_union_left + · exact min_le_left _ _ + +lemma carrier_meet_subset_right (B C : Set N) : (B.meet C).carrier ⊆ C.carrier := by + apply carrier_mono + · exact Finset.subset_union_right + · exact min_le_right _ _ + +lemma dilate_mono (B : Set N) {ρ σ : ℝ} (hρ : 0 ≤ ρ) (hρσ : ρ ≤ σ) : + (B.dilate ρ).carrier ⊆ (B.dilate σ).carrier := by + apply carrier_mono + · simp + · have hσ : 0 ≤ σ := hρ.trans hρσ + simp only [radius_dilate, ge_iff_le] + rw [abs_of_nonneg hρ, abs_of_nonneg hσ] + exact mul_le_mul_of_nonneg_right hρσ B.radius_nonneg + +lemma carrier_eq_univ_of_two_le_radius (B : Set N) (hB : 2 ≤ B.radius) : + B.carrier = Finset.univ := by + apply Finset.eq_univ_of_forall + intro x + rw [mem_carrier] + intro r hr + calc + ‖1 - character r x‖ ≤ ‖(1 : ℂ)‖ + ‖character r x‖ := norm_sub_le _ _ + _ = 2 := by rw [norm_character]; norm_num + _ ≤ B.radius := hB + +@[simp] lemma dilate_one (B : Set N) : B.dilate 1 = B := by + cases B + simp [dilate] + +@[simp] lemma dilate_dilate (B : Set N) (s t : ℝ) : + (B.dilate s).dilate t = B.dilate (t * s) := by + cases B + simp [dilate, abs_mul, mul_assoc] + +end Set +end CyclicBohr +end Erdos3 + +end + +section + +namespace Erdos3 + +open AddChar Finset +open scoped BigOperators + +namespace CyclicBohr + +variable {N : ℕ} [NeZero N] + +lemma norm_sub_le_abs_arg_sub_of_norm_eq_one {z w : ℂ} + (hz : ‖z‖ = 1) (hw : ‖w‖ = 1) : + ‖z - w‖ ≤ |z.arg - w.arg| := by + have hzexp : Complex.exp (z.arg * Complex.I) = z := by + calc + Complex.exp (z.arg * Complex.I) = + ‖z‖ * Complex.exp (z.arg * Complex.I) := by simp [hz] + _ = z := Complex.norm_mul_exp_arg_mul_I z + have hwexp : Complex.exp (w.arg * Complex.I) = w := by + calc + Complex.exp (w.arg * Complex.I) = + ‖w‖ * Complex.exp (w.arg * Complex.I) := by simp [hw] + _ = w := Complex.norm_mul_exp_arg_mul_I w + calc + ‖z - w‖ = + ‖Complex.exp (z.arg * Complex.I) - Complex.exp (w.arg * Complex.I)‖ := by + rw [hzexp, hwexp] + _ = + ‖Complex.exp (w.arg * Complex.I) * + (Complex.exp ((z.arg - w.arg) * Complex.I) - 1)‖ := by + congr 1 + rw [mul_sub, mul_one, ← Complex.exp_add] + congr 2 + ring + _ = ‖Complex.exp ((z.arg - w.arg) * Complex.I) - 1‖ := by + rw [norm_mul, Complex.norm_exp] + simp + _ ≤ |z.arg - w.arg| := by + simpa [mul_comm, Real.norm_eq_abs] using + (Real.norm_exp_I_mul_ofReal_sub_one_le (x := z.arg - w.arg)) + +noncomputable def scaledArg (m : ℕ) (z : ℂ) : ℝ := + (z.arg + Real.pi) * m / (2 * Real.pi) + +lemma scaledArg_nonneg (m : ℕ) (z : ℂ) : 0 ≤ scaledArg m z := by + unfold scaledArg + have hz : 0 ≤ z.arg + Real.pi := by linarith [Complex.neg_pi_lt_arg z] + positivity + +lemma scaledArg_le (m : ℕ) (z : ℂ) : scaledArg m z ≤ m := by + unfold scaledArg + have hz : z.arg + Real.pi ≤ 2 * Real.pi := by + linarith [Complex.arg_le_pi z] + have hpi : 0 < 2 * Real.pi := by positivity + rw [div_le_iff₀ hpi] + nlinarith + +noncomputable def argBin (m : ℕ) (z : ℂ) : Fin (m + 1) := + ⟨⌊scaledArg m z⌋₊, by + rw [Nat.floor_lt' (Nat.add_one_ne_zero m)] + exact (scaledArg_le m z).trans_lt (by exact_mod_cast Nat.lt_succ_self m)⟩ + +lemma abs_scaledArg_sub_lt_one_of_argBin_eq {m : ℕ} {z w : ℂ} + (hbin : argBin m z = argBin m w) : + |scaledArg m z - scaledArg m w| < 1 := by + have hfloor : ⌊scaledArg m z⌋₊ = ⌊scaledArg m w⌋₊ := + congrArg Fin.val hbin + have hfloorR : (⌊scaledArg m z⌋₊ : ℝ) = ⌊scaledArg m w⌋₊ := by + exact_mod_cast hfloor + have hzlow : (⌊scaledArg m z⌋₊ : ℝ) ≤ scaledArg m z := + Nat.floor_le (scaledArg_nonneg m z) + have hwlow : (⌊scaledArg m w⌋₊ : ℝ) ≤ scaledArg m w := + Nat.floor_le (scaledArg_nonneg m w) + have hzup : scaledArg m z < (⌊scaledArg m z⌋₊ : ℝ) + 1 := + Nat.lt_floor_add_one _ + have hwup : scaledArg m w < (⌊scaledArg m w⌋₊ : ℝ) + 1 := + Nat.lt_floor_add_one _ + rw [abs_lt] + constructor <;> nlinarith + +lemma abs_arg_sub_lt_of_argBin_eq {m : ℕ} (hm : 0 < m) {z w : ℂ} + (hbin : argBin m z = argBin m w) : + |z.arg - w.arg| < 2 * Real.pi / m := by + have h := abs_scaledArg_sub_lt_one_of_argBin_eq hbin + have hmR : (0 : ℝ) < m := by exact_mod_cast hm + have hpi : 0 < 2 * Real.pi := by positivity + have hscale : + |scaledArg m z - scaledArg m w| = + |z.arg - w.arg| * (m : ℝ) / (2 * Real.pi) := by + have heq : scaledArg m z - scaledArg m w = + (z.arg - w.arg) * (m : ℝ) / (2 * Real.pi) := by + unfold scaledArg + ring + rw [heq, abs_div, abs_mul, abs_of_pos hmR, abs_of_pos hpi] + rw [hscale] at h + rw [lt_div_iff₀ hmR] + exact (div_lt_one hpi).mp h + +noncomputable def argumentCode (B : Set N) (m : ℕ) (x : ZMod N) : + (r : ↥B.frequencies) → Fin (m + 1) := + fun r ↦ argBin m (character r.1 x) + +@[simp] lemma card_argumentCodeSpace (B : Set N) (m : ℕ) : + Fintype.card ((r : ↥B.frequencies) → Fin (m + 1)) = + (m + 1) ^ B.rank := by + simp [Set.rank] + +lemma norm_one_sub_character_sub (r x y : ZMod N) : + ‖1 - character r (x - y)‖ = ‖character r x - character r y‖ := by + have hy : character r y ≠ 0 := + norm_ne_zero_iff.mp (by rw [norm_character]; norm_num) + rw [AddChar.map_sub_eq_div, one_sub_div hy, norm_div, norm_character] + simp [norm_sub_rev] + +lemma sub_mem_of_argumentCode_eq (B : Set N) {m : ℕ} (hm : 0 < m) + (hwidth : 2 * Real.pi / m ≤ B.radius) {x y : ZMod N} + (hcode : argumentCode B m x = argumentCode B m y) : + x - y ∈ B := by + rw [Set.mem_iff] + intro r hr + have hbin : argBin m (character r x) = argBin m (character r y) := by + exact congrFun hcode ⟨r, hr⟩ + calc + ‖1 - character r (x - y)‖ = ‖character r x - character r y‖ := + norm_one_sub_character_sub r x y + _ ≤ |(character r x).arg - (character r y).arg| := + norm_sub_le_abs_arg_sub_of_norm_eq_one (norm_character r x) (norm_character r y) + _ ≤ 2 * Real.pi / m := (abs_arg_sub_lt_of_argBin_eq hm hbin).le + _ ≤ B.radius := hwidth + +theorem natDiv_codeCard_le_card_carrier (B : Set N) {m : ℕ} (hm : 0 < m) + (hwidth : 2 * Real.pi / m ≤ B.radius) : + N / (m + 1) ^ B.rank ≤ B.carrier.card := by + let Q := (r : ↥B.frequencies) → Fin (m + 1) + let code : ZMod N → Q := argumentCode B m + have hQ : Fintype.card Q = (m + 1) ^ B.rank := by + simpa [Q] using card_argumentCodeSpace B m + have hpigeon : Fintype.card Q * (N / Fintype.card Q) ≤ + Fintype.card (ZMod N) := by + rw [ZMod.card] + exact Nat.mul_div_le N (Fintype.card Q) + obtain ⟨q, hq⟩ := + Fintype.exists_le_card_fiber_of_mul_le_card (f := code) hpigeon + let S : Finset (ZMod N) := Finset.univ.filter fun x ↦ code x = q + have hScard : N / Fintype.card Q ≤ S.card := by + simpa [S] using hq + by_cases hzero : N / Fintype.card Q = 0 + · rw [hQ] at hzero + rw [hzero] + exact Nat.zero_le _ + have hSnonempty : S.Nonempty := Finset.card_pos.mp (lt_of_lt_of_le + (Nat.pos_of_ne_zero hzero) hScard) + obtain ⟨x₀, hx₀⟩ := hSnonempty + let e : ZMod N ↪ ZMod N := (Equiv.subRight x₀).toEmbedding + have hmap : S.map e ⊆ B.carrier := by + intro z hz + rw [Finset.mem_map] at hz + obtain ⟨x, hxS, rfl⟩ := hz + have hcodex : code x = q := by simpa [S] using hxS + have hcodex₀ : code x₀ = q := by simpa [S] using hx₀ + exact sub_mem_of_argumentCode_eq B hm hwidth (hcodex.trans hcodex₀.symm) + calc + N / (m + 1) ^ B.rank = N / Fintype.card Q := by rw [hQ] + _ ≤ S.card := hScard + _ = (S.map e).card := (Finset.card_map e).symm + _ ≤ B.carrier.card := Finset.card_le_card hmap + +lemma abs_arg_character_le_two_radius (B : Set N) {x r : ZMod N} + (hx : x ∈ B) (hr : r ∈ B.frequencies) : + |(character r x).arg| ≤ 2 * B.radius := by + have hnorm := Set.mem_iff.mp hx r hr + have hangle := Complex.angle_le_mul_norm_sub + (norm_character r x) (by norm_num : ‖(1 : ℂ)‖ = 1) + calc + |(character r x).arg| = InnerProductGeometry.angle (character r x) 1 := + (Complex.angle_one_right (norm_ne_zero_iff.mp (by + rw [norm_character] + norm_num))).symm + _ ≤ Real.pi / 2 * ‖character r x - 1‖ := hangle + _ = Real.pi / 2 * ‖1 - character r x‖ := by rw [norm_sub_rev] + _ ≤ Real.pi / 2 * B.radius := + mul_le_mul_of_nonneg_left hnorm (by positivity) + _ ≤ 2 * B.radius := by + apply mul_le_mul_of_nonneg_right _ B.radius_nonneg + linarith [Real.pi_lt_four] + +noncomputable def localScaledArg (B : Set N) (z : ℂ) : ℝ := + 2 * (z.arg + 2 * B.radius) / B.radius + +lemma localScaledArg_nonneg (B : Set N) {x r : ZMod N} + (hB : 0 < B.radius) (hx : x ∈ B) (hr : r ∈ B.frequencies) : + 0 ≤ localScaledArg B (character r x) := by + have harg := abs_arg_character_le_two_radius B hx hr + rw [abs_le] at harg + unfold localScaledArg + have hsum : 0 ≤ (character r x).arg + 2 * B.radius := by linarith [harg.1] + exact div_nonneg (mul_nonneg (by norm_num) hsum) hB.le + +lemma localScaledArg_le_eight (B : Set N) {x r : ZMod N} + (hB : 0 < B.radius) (hx : x ∈ B) (hr : r ∈ B.frequencies) : + localScaledArg B (character r x) ≤ 8 := by + have harg := abs_arg_character_le_two_radius B hx hr + rw [abs_le] at harg + unfold localScaledArg + rw [div_le_iff₀ hB] + linarith + +noncomputable def localArgBin (B : Set N) (hB : 0 < B.radius) + (x : ↥B.carrier) (r : ↥B.frequencies) : Fin 9 := + ⟨⌊localScaledArg B (character r.1 x.1)⌋₊, by + rw [Nat.floor_lt' (by norm_num : (9 : ℕ) ≠ 0)] + exact (localScaledArg_le_eight B hB x.2 r.2).trans_lt (by norm_num)⟩ + +noncomputable def localArgumentCode (B : Set N) (hB : 0 < B.radius) + (x : ↥B.carrier) : (r : ↥B.frequencies) → Fin 9 := + fun r ↦ localArgBin B hB x r + +@[simp] lemma card_localArgumentCodeSpace (B : Set N) : + Fintype.card ((r : ↥B.frequencies) → Fin 9) = 9 ^ B.rank := by + simp [Set.rank] + +lemma abs_localScaledArg_sub_lt_one_of_localArgBin_eq + (B : Set N) (hB : 0 < B.radius) {x y : ↥B.carrier} + {r : ↥B.frequencies} + (hbin : localArgBin B hB x r = localArgBin B hB y r) : + |localScaledArg B (character r.1 x.1) - + localScaledArg B (character r.1 y.1)| < 1 := by + have hfloor : + ⌊localScaledArg B (character r.1 x.1)⌋₊ = + ⌊localScaledArg B (character r.1 y.1)⌋₊ := + congrArg Fin.val hbin + have hfloorR : + (⌊localScaledArg B (character r.1 x.1)⌋₊ : ℝ) = + ⌊localScaledArg B (character r.1 y.1)⌋₊ := by + exact_mod_cast hfloor + have hxlow : + (⌊localScaledArg B (character r.1 x.1)⌋₊ : ℝ) ≤ + localScaledArg B (character r.1 x.1) := + Nat.floor_le (localScaledArg_nonneg B hB x.2 r.2) + have hylow : + (⌊localScaledArg B (character r.1 y.1)⌋₊ : ℝ) ≤ + localScaledArg B (character r.1 y.1) := + Nat.floor_le (localScaledArg_nonneg B hB y.2 r.2) + have hxup := Nat.lt_floor_add_one + (localScaledArg B (character r.1 x.1)) + have hyup := Nat.lt_floor_add_one + (localScaledArg B (character r.1 y.1)) + rw [abs_lt] + constructor <;> nlinarith + +lemma abs_arg_sub_lt_half_radius_of_localArgBin_eq + (B : Set N) (hB : 0 < B.radius) {x y : ↥B.carrier} + {r : ↥B.frequencies} + (hbin : localArgBin B hB x r = localArgBin B hB y r) : + |(character r.1 x.1).arg - (character r.1 y.1).arg| < B.radius / 2 := by + have h := abs_localScaledArg_sub_lt_one_of_localArgBin_eq B hB hbin + have hscale : + |localScaledArg B (character r.1 x.1) - + localScaledArg B (character r.1 y.1)| = + 2 * |(character r.1 x.1).arg - (character r.1 y.1).arg| / B.radius := by + have heq : + localScaledArg B (character r.1 x.1) - + localScaledArg B (character r.1 y.1) = + 2 * ((character r.1 x.1).arg - (character r.1 y.1).arg) / + B.radius := by + unfold localScaledArg + ring + rw [heq, abs_div, abs_mul, abs_of_pos hB] + norm_num + rw [hscale] at h + rw [div_lt_iff₀ hB] at h + linarith + +lemma sub_mem_half_dilate_of_localArgumentCode_eq + (B : Set N) (hB : 0 < B.radius) {x y : ↥B.carrier} + (hcode : localArgumentCode B hB x = localArgumentCode B hB y) : + x.1 - y.1 ∈ B.dilate (1 / 2 : ℝ) := by + rw [Set.mem_iff] + intro r hr + have hbin : localArgBin B hB x ⟨r, hr⟩ = + localArgBin B hB y ⟨r, hr⟩ := congrFun hcode ⟨r, hr⟩ + calc + ‖1 - character r (x.1 - y.1)‖ = + ‖character r x.1 - character r y.1‖ := + norm_one_sub_character_sub r x.1 y.1 + _ ≤ |(character r x.1).arg - (character r y.1).arg| := + norm_sub_le_abs_arg_sub_of_norm_eq_one + (norm_character r x.1) (norm_character r y.1) + _ ≤ B.radius / 2 := + (abs_arg_sub_lt_half_radius_of_localArgBin_eq B hB hbin).le + _ = (B.dilate (1 / 2 : ℝ)).radius := by + simp [div_eq_mul_inv, mul_comm] + +theorem card_carrier_le_nine_pow_rank_mul_card_half + (B : Set N) (hB : 0 < B.radius) : + B.carrier.card ≤ 9 ^ B.rank * (B.dilate (1 / 2 : ℝ)).carrier.card := by + let Q := (r : ↥B.frequencies) → Fin 9 + let code : ↥B.carrier → Q := localArgumentCode B hB + have hQ : Fintype.card Q = 9 ^ B.rank := by + simpa [Q] using card_localArgumentCodeSpace B + have hmain : Fintype.card ↥B.carrier ≤ + Fintype.card Q * (B.dilate (1 / 2 : ℝ)).carrier.card := by + by_contra hbound + rw [not_le] at hbound + obtain ⟨q, hq⟩ := + Fintype.exists_lt_card_fiber_of_mul_lt_card (f := code) hbound + let S : Finset ↥B.carrier := Finset.univ.filter fun x ↦ code x = q + have hScard : (B.dilate (1 / 2 : ℝ)).carrier.card < S.card := by + simpa [S] using hq + have hSnonempty : S.Nonempty := Finset.card_pos.mp + (lt_of_le_of_lt (Nat.zero_le _) hScard) + obtain ⟨x₀, hx₀⟩ := hSnonempty + let e : ↥B.carrier ↪ ZMod N := + ⟨fun x ↦ x.1 - x₀.1, by + intro x y hxy + apply Subtype.ext + exact (Equiv.subRight x₀.1).injective hxy⟩ + have hmap : S.map e ⊆ (B.dilate (1 / 2 : ℝ)).carrier := by + intro z hz + rw [Finset.mem_map] at hz + obtain ⟨x, hxS, rfl⟩ := hz + have hcodex : code x = q := by simpa [S] using hxS + have hcodex₀ : code x₀ = q := by simpa [S] using hx₀ + exact sub_mem_half_dilate_of_localArgumentCode_eq B hB + (hcodex.trans hcodex₀.symm) + have hle : S.card ≤ (B.dilate (1 / 2 : ℝ)).carrier.card := by + calc + S.card = (S.map e).card := (Finset.card_map e).symm + _ ≤ (B.dilate (1 / 2 : ℝ)).carrier.card := Finset.card_le_card hmap + omega + rw [hQ] at hmain + have hcardcoe : Fintype.card ↥B.carrier = B.carrier.card := + Fintype.card_coe B.carrier + rw [hcardcoe] at hmain + exact hmain + +end CyclicBohr +end Erdos3 + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped BigOperators + +variable {N : ℕ} [NeZero N] + +lemma norm_one_sub_prod_le_sum {ι : Type*} + (s : Finset ι) (f : ι → ℂ) (hf : ∀ i ∈ s, ‖f i‖ ≤ 1) : + ‖1 - ∏ i ∈ s, f i‖ ≤ ∑ i ∈ s, ‖1 - f i‖ := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => + rw [Finset.prod_insert ha, Finset.sum_insert ha] + exact (norm_one_sub_mul_of_norm_le_one (hf a (by simp))).trans + (add_le_add le_rfl (ih fun i hi ↦ hf i (by simp [hi]))) + +lemma character_sum {ι : Type*} (s : Finset ι) + (f : ι → ZMod N) (x : ZMod N) : + character (∑ i ∈ s, f i) x = ∏ i ∈ s, character (f i) x := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => simp [ha, ih, character_add_index] + +@[simp] lemma character_neg_index (r x : ZMod N) : + character (-r) x = (starRingEnd ℂ) (character r x) := by + rw [character_comm, AddChar.map_neg_eq_conj, character_comm] + +@[simp] +lemma norm_one_sub_character_neg_index (r x : ZMod N) : + ‖1 - character (-r) x‖ = ‖1 - character r x‖ := by + rw [character_neg_index] + simpa using (RCLike.norm_conj (1 - character r x)) + +def signedSpan (B : Set N) : _root_.Set (ZMod N) := + B.frequencies.addSpan + +lemma norm_one_sub_character_le_rank_mul {B : Set N} {r x : ZMod N} + (hr : r ∈ B.signedSpan) (hx : x ∈ B) : + ‖1 - character r x‖ ≤ B.rank * B.radius := by + rw [signedSpan] at hr + obtain ⟨ε, hε, hsum⟩ := Finset.mem_addSpan.mp hr + rw [← hsum] + rw [character_sum] + calc + ‖1 - ∏ g ∈ B.frequencies, character (ε g • g) x‖ ≤ + ∑ g ∈ B.frequencies, ‖1 - character (ε g • g) x‖ := + norm_one_sub_prod_le_sum B.frequencies (fun g ↦ character (ε g • g) x) + (fun g hg ↦ by rw [norm_character]) + _ ≤ ∑ _g ∈ B.frequencies, B.radius := by + apply Finset.sum_le_sum + intro g hg + rcases hε g with hneg | hzero | hone + · rw [hneg, neg_one_zsmul, norm_one_sub_character_neg_index] + exact mem_iff.mp hx g hg + · simp [hzero, B.radius_nonneg] + · simpa [hone] using mem_iff.mp hx g hg + _ = B.rank * B.radius := by simp [rank] + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr + +lemma character_eq_one_mul {N : ℕ} [NeZero N] (r x : ZMod N) : + character r x = character 1 (r * x) := by + change (↑(AddChar.zmod N r x) : ℂ) = ↑(AddChar.zmod N 1 (r * x)) + simp [AddChar.zmod] + +lemma norm_one_sub_character_intCast {N : ℕ} [NeZero N] (t : ℤ) : + ‖1 - character 1 (t : ZMod N)‖ ≤ 8 * |(t : ℝ)| / N := by + change ‖1 - (↑(AddChar.zmod N 1 (t : ZMod N)) : ℂ)‖ ≤ _ + rw [show (1 : ZMod N) = ((1 : ℤ) : ZMod N) by simp] + rw [AddChar.zmod_intCast, Circle.coe_exp, norm_sub_rev] + simp only [Int.cast_one, one_mul] + have hN : (0 : ℝ) < N := by exact_mod_cast NeZero.pos N + have hnorm : ‖Complex.exp ((2 * Real.pi * ((t : ℝ) / N) : ℝ) * + Complex.I) - 1‖ ≤ |2 * Real.pi * ((t : ℝ) / N)| := by + simpa only [mul_comm, Real.norm_eq_abs] + using (Real.norm_exp_I_mul_ofReal_sub_one_le + (x := 2 * Real.pi * ((t : ℝ) / N))) + refine hnorm.trans ?_ + rw [← mul_div_assoc, abs_div, abs_mul, abs_mul, abs_of_pos hN, + abs_of_pos Real.pi_pos, abs_of_pos (by norm_num : (0 : ℝ) < 2)] + gcongr + linarith [Real.pi_le_four] + +lemma norm_one_sub_character_le_of_mul_eq_intCast {N : ℕ} [NeZero N] + (r x : ZMod N) (t : ℤ) (h : r * x = (t : ZMod N)) : + ‖1 - character r x‖ ≤ 8 * |(t : ℝ)| / N := by + rw [character_eq_one_mul, h] + exact norm_one_sub_character_intCast t + +end Erdos3.CyclicBohr + +end + +section + +namespace Erdos3.CyclicBohr + +open Finset +open scoped BigOperators + +variable {N : ℕ} [NeZero N] + +theorem card_le_codeCard_mul_card (B : Set N) {m : ℕ} (hm : 0 < m) + (hwidth : 2 * Real.pi / m ≤ B.radius) : + N ≤ (m + 1) ^ B.rank * B.carrier.card := by + classical + let Q := (r : ↥B.frequencies) → Fin (m + 1) + let code : ZMod N → Q := argumentCode B m + have hQ : Fintype.card Q = (m + 1) ^ B.rank := card_argumentCodeSpace B m + by_contra h + have hsmall : Fintype.card Q * B.carrier.card < Fintype.card (ZMod N) := by + simpa only [hQ, ZMod.card] using (not_le.mp h) + obtain ⟨q, hq⟩ := Fintype.exists_lt_card_fiber_of_mul_lt_card (f := code) hsmall + let A := Finset.univ.filter (fun x : ZMod N => code x = q) + have hA : B.carrier.card < A.card := by simpa only [A] using hq + obtain ⟨x₀, hx₀⟩ := Finset.card_pos.mp ((Nat.zero_le _).trans_lt hA) + let e : ZMod N ↪ ZMod N := (Equiv.subRight x₀).toEmbedding + have hmap : A.map e ⊆ B.carrier := by + intro z hz + obtain ⟨x, hx, rfl⟩ := Finset.mem_map.mp hz + exact sub_mem_of_argumentCode_eq B hm hwidth + ((Finset.mem_filter.mp hx).2.trans (Finset.mem_filter.mp hx₀).2.symm) + have hcard := Finset.card_le_card hmap + rw [Finset.card_map] at hcard + omega + +theorem card_lower_bound (B : Set N) (hB : 0 < B.radius) (hB1 : B.radius ≤ 1) : + (B.radius / 10) ^ B.rank * N ≤ (B.carrier.card : ℝ) := by + let m := ⌈2 * Real.pi / B.radius⌉₊ + have hratio : 0 < 2 * Real.pi / B.radius := div_pos (by positivity) hB + have hm : 0 < m := Nat.ceil_pos.mpr hratio + have hmR : (0 : ℝ) < m := by exact_mod_cast hm + have hwidth : 2 * Real.pi / m ≤ B.radius := by + rw [div_le_iff₀ hmR] + have h := (div_le_iff₀ hB).mp (Nat.le_ceil (2 * Real.pi / B.radius)) + nlinarith + have hcode : (N : ℝ) ≤ ((m + 1 : ℕ) : ℝ) ^ B.rank * B.carrier.card := by + exact_mod_cast card_le_codeCard_mul_card B hm hwidth + have hmUpper : ((m + 1 : ℕ) : ℝ) ≤ 10 / B.radius := by + have hceil := Nat.ceil_lt_add_one hratio.le + rw [Nat.cast_add, Nat.cast_one] + change (⌈2 * Real.pi / B.radius⌉₊ : ℝ) + 1 ≤ _ + rw [le_div_iff₀ hB] + have hceilmul := mul_lt_mul_of_pos_right hceil hB + have hquot : (2 * Real.pi / B.radius) * B.radius = 2 * Real.pi := + div_mul_cancel₀ _ hB.ne' + nlinarith [Real.pi_lt_four] + have hpower : ((B.radius / 10) * ((m + 1 : ℕ) : ℝ)) ^ B.rank ≤ 1 := by + apply pow_le_one₀ (by positivity) + have hmul := mul_le_mul_of_nonneg_left hmUpper (show 0 ≤ B.radius / 10 by positivity) + have heq : B.radius / 10 * (10 / B.radius) = 1 := by field_simp + exact hmul.trans_eq heq + calc + _ ≤ (B.radius / 10) ^ B.rank * (((m + 1 : ℕ) : ℝ) ^ B.rank * B.carrier.card) := + mul_le_mul_of_nonneg_left hcode (by positivity) + _ = ((B.radius / 10) * ((m + 1 : ℕ) : ℝ)) ^ B.rank * B.carrier.card := by + rw [mul_pow] + ring + _ ≤ 1 * (B.carrier.card : ℝ) := mul_le_mul_of_nonneg_right hpower (Nat.cast_nonneg _) + _ = _ := one_mul _ + +theorem card_two_le_nine_pow_three_rank_mul_card_quarter (B : Set N) (hB : 0 < B.radius) : + (B.dilate 2).carrier.card ≤ 9 ^ (3 * B.rank) * (B.dilate (1 / 4)).carrier.card := by + have h₂ := card_carrier_le_nine_pow_rank_mul_card_half (B.dilate 2) + (show 0 < (B.dilate 2).radius by simpa using mul_pos (by norm_num : (0 : ℝ) < 2) hB) + have h₁ := card_carrier_le_nine_pow_rank_mul_card_half B hB + have hh := card_carrier_le_nine_pow_rank_mul_card_half (B.dilate (1 / 2)) + (show 0 < (B.dilate (1 / 2)).radius by simpa using mul_pos (by norm_num : (0 : ℝ) < 1 / 2) hB) + simp only [Set.rank_dilate, Set.dilate_dilate] at h₂ hh + norm_num at h₂ hh + calc + _ ≤ 9 ^ B.rank * B.carrier.card := h₂ + _ ≤ 9 ^ B.rank * (9 ^ B.rank * (B.dilate (1 / 2)).carrier.card) := Nat.mul_le_mul_left _ h₁ + _ ≤ 9 ^ B.rank * (9 ^ B.rank * (9 ^ B.rank * (B.dilate (1 / 4)).carrier.card)) := by + gcongr + _ = _ := by + rw [← mul_assoc, ← pow_add, ← mul_assoc, ← pow_add] + congr 2 + omega + +end Erdos3.CyclicBohr + +end + +section + +namespace Erdos3.CyclicBohr + +variable {N : ℕ} [NeZero N] + +theorem card_le_dyadic_dilate (B : Set N) (hB : 0 < B.radius) (k : ℕ) : + B.carrier.card ≤ 9 ^ (k * B.rank) * (B.dilate ((1 / 2 : ℝ) ^ k)).carrier.card := by + induction k with + | zero => simp + | succ k ih => + have hpos : 0 < (B.dilate ((1 / 2 : ℝ) ^ k)).radius := by + simp only [Set.radius_dilate, abs_of_nonneg (pow_nonneg (by norm_num) _)] + positivity + have hh := card_carrier_le_nine_pow_rank_mul_card_half (B.dilate ((1 / 2 : ℝ) ^ k)) hpos + have heq : (1 / 2 : ℝ) * (1 / 2 : ℝ) ^ k = (1 / 2 : ℝ) ^ (k + 1) := by + rw [pow_succ, mul_comm] + simp only [Set.rank_dilate, Set.dilate_dilate, heq] at hh + calc + _ ≤ 9 ^ (k * B.rank) * (B.dilate ((1 / 2 : ℝ) ^ k)).carrier.card := ih + _ ≤ 9 ^ (k * B.rank) * + (9 ^ B.rank * (B.dilate ((1 / 2 : ℝ) ^ (k + 1))).carrier.card) := Nat.mul_le_mul_left _ hh + _ = _ := by simp only [Nat.add_mul, Nat.one_mul, pow_add, mul_assoc] + +theorem relative_card_lower_bound (B : Set N) (hB : 0 < B.radius) + {r : ℝ} (hr : 0 < r) (hr1 : r ≤ 1) : + (r / 2) ^ (4 * B.rank) * (B.carrier.card : ℝ) ≤ (B.dilate r).carrier.card := by + obtain ⟨n, hn, hn'⟩ := exists_nat_pow_near_of_lt_one hr hr1 + (by norm_num : (0 : ℝ) < 1 / 2) (by norm_num : (1 / 2 : ℝ) < 1) + let k := n + 1 + have hk : (1 / 2 : ℝ) ^ k ≤ r := hn.le + have hhalf : r / 2 ≤ (1 / 2 : ℝ) ^ k := by + dsimp [k] + rw [pow_succ] + nlinarith + have hd := card_le_dyadic_dilate B hB k + have hdR : (B.carrier.card : ℝ) ≤ + (9 : ℝ) ^ (k * B.rank) * (B.dilate ((1 / 2 : ℝ) ^ k)).carrier.card := by exact_mod_cast hd + have hcoef : ((1 / 2 : ℝ) ^ k) ^ (4 * B.rank) * 9 ^ (k * B.rank) ≤ 1 := by + calc + _ = ((1 / 2 : ℝ) ^ 4) ^ (k * B.rank) * 9 ^ (k * B.rank) := by + congr 1 + rw [← pow_mul, ← pow_mul] + congr 1 + ring + _ = ((1 / 2 : ℝ) ^ 4 * 9) ^ (k * B.rank) := (mul_pow _ _ _).symm + _ ≤ 1 := pow_le_one₀ (by norm_num) (by norm_num) + calc + _ ≤ ((1 / 2 : ℝ) ^ k) ^ (4 * B.rank) * B.carrier.card := + mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (by positivity) hhalf _) (Nat.cast_nonneg _) + _ ≤ ((1 / 2 : ℝ) ^ k) ^ (4 * B.rank) * + (9 ^ (k * B.rank) * (B.dilate ((1 / 2 : ℝ) ^ k)).carrier.card) := + mul_le_mul_of_nonneg_left hdR (by positivity) + _ ≤ 1 * ((B.dilate ((1 / 2 : ℝ) ^ k)).carrier.card : ℝ) := by + rw [← mul_assoc] + exact mul_le_mul_of_nonneg_right hcoef (Nat.cast_nonneg _) + _ ≤ (B.dilate r).carrier.card := by + rw [one_mul] + exact_mod_cast Finset.card_le_card (B.dilate_mono (pow_nonneg (by norm_num) _) hk) + +end Erdos3.CyclicBohr + +end + +section + +namespace Erdos3.CyclicBohr.Set + +theorem card_lower_bound_of_quartic_rank {N : ℕ} [NeZero N] + (B : Set N) {C p : ℝ} (hC : 0 ≤ C) (hp : 0 ≤ p) + (hB : 0 < B.radius) (hB1 : B.radius ≤ 1) + (hrank : (B.rank : ℝ) ≤ 1 + C * (p + 1) ^ 4) + (hwidth : Real.exp (-(C * (p + 1))) ≤ B.radius) : + Real.exp (-((C + 10) * (C + 1) * (p + 1) ^ 5)) * N ≤ (B.carrier.card : ℝ) := by + let u := p + 1 + have hu : 1 ≤ u := by dsimp [u]; linarith + have hu4 : 1 ≤ u ^ 4 := one_le_pow₀ hu + have hten : Real.exp (-10) ≤ (1 / 10 : ℝ) := by + rw [Real.exp_neg, ← one_div] + apply one_div_le_one_div_of_le (by norm_num) + linarith [Real.add_one_le_exp (10 : ℝ)] + have hbase : Real.exp (-((C + 10) * u)) ≤ B.radius / 10 := by + calc + Real.exp (-((C + 10) * u)) ≤ Real.exp (-(C * u)) * Real.exp (-10) := by + rw [← Real.exp_add] + apply Real.exp_le_exp.mpr + nlinarith + _ ≤ Real.exp (-(C * u)) * (1 / 10) := + mul_le_mul_of_nonneg_left hten (Real.exp_pos _).le + _ ≤ B.radius * (1 / 10) := mul_le_mul_of_nonneg_right hwidth (by norm_num) + _ = B.radius / 10 := by ring + have hr : (B.rank : ℝ) ≤ (C + 1) * u ^ 4 := by + calc + (B.rank : ℝ) ≤ 1 + C * u ^ 4 := hrank + _ ≤ (C + 1) * u ^ 4 := by nlinarith + have hexponent : (B.rank : ℝ) * ((C + 10) * u) ≤ (C + 10) * (C + 1) * u ^ 5 := by + calc + (B.rank : ℝ) * ((C + 10) * u) ≤ ((C + 1) * u ^ 4) * ((C + 10) * u) := + mul_le_mul_of_nonneg_right hr (by positivity) + _ = _ := by ring + have hpower : Real.exp (-((C + 10) * (C + 1) * u ^ 5)) ≤ + (B.radius / 10) ^ B.rank := by + calc + Real.exp (-((C + 10) * (C + 1) * u ^ 5)) ≤ + Real.exp ((B.rank : ℝ) * (-((C + 10) * u))) := by + apply Real.exp_le_exp.mpr + nlinarith + _ = Real.exp (-((C + 10) * u)) ^ B.rank := Real.exp_nat_mul _ _ + _ ≤ (B.radius / 10) ^ B.rank := pow_le_pow_left₀ (by positivity) hbase _ + exact (mul_le_mul_of_nonneg_right hpower (Nat.cast_nonneg N)).trans + (CyclicBohr.card_lower_bound B hB hB1) + +end Erdos3.CyclicBohr.Set + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FactoredPolynomialCharacter.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FactoredPolynomialCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..5517adc3132f5e81f1eb553f5b6dd13c3e3a2a88 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FactoredPolynomialCharacter.lean @@ -0,0 +1,42 @@ +import OAI.Combinatorics.Progressions.Estimates.HomogenizedModeFactorization + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators + +theorem factored_polynomial_mode_character {I K S W : Type*} [Fintype S] [DecidableEq S] + [AddCommGroup W] [Module ℝ W] (h : ℕ) (site : S → K → ℝ) + (Λ : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (M : (S → W) →ₗ[ℝ] ℝ) + (hfactor : ∀ q, DegreeLE (1 : K → ℕ) h q → Λ q = M (siteEvaluation site q)) + (p : VectorPolynomial I ℝ W) (hp : DegreeLE (1 : I → ℕ) h p) + (f : I → MvPolynomial K ℝ) (hf : ∀ i, (f i).totalDegree ≤ 1) : + character (Λ (substitute f p) : CircleFourier.Circle) = + ∏ s, siteFunctionalCharacter M s (eval (fun i => MvPolynomial.aeval (site s) (f i)) p) := by + rw [hfactor _ (degreeLE_substitute_affine f hf p hp), character_linear_site_sum] + apply Finset.prod_congr rfl + intro s _ + change siteFunctionalCharacter M s (eval (site s) (substitute f p)) = _ + rw [eval_substitute] + +theorem homogeneously_factored_polynomial_character {I K S W : Type*} [Fintype S] [DecidableEq S] + [AddCommGroup W] [Module ℝ W] (h : ℕ) (site : S → K → ℝ) + (Λ : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (M : (S → W) →ₗ[ℝ] ℝ) + (hfactor : ∀ q, Homogeneous h q → Λ (substitute dehomogenizingSubstitution q) = + M (siteEvaluation (fun s (i : Option K) => i.elim 1 (site s)) q)) + (p : VectorPolynomial I ℝ W) (hp : DegreeLE (1 : I → ℕ) h p) + (f : I → MvPolynomial K ℝ) (hf : ∀ i, (f i).totalDegree ≤ 1) : + character (Λ (substitute f p) : CircleFourier.Circle) = + ∏ s, siteFunctionalCharacter M s (eval (fun i => MvPolynomial.aeval (site s) (f i)) p) := + factored_polynomial_mode_character h site Λ M + ((homogeneous_site_factorization_iff h site Λ M).mp hfactor) p hp f hf + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FiniteCharacterOrderTail.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FiniteCharacterOrderTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a0907208daaa19ba82aab6a27ab8e0a0183dfdf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FiniteCharacterOrderTail.lean @@ -0,0 +1,172 @@ +import OAI.Combinatorics.Progressions.Estimates.DenseProductApproximation +import OAI.Combinatorics.Progressions.Fourier.CharacterCoordinateScale +import OAI.Combinatorics.Progressions.Fourier.PrimePowerCharacterScaling + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical + +variable {I H : Type*} [Fintype I] + [AddCommGroup H] [Fintype H] + +theorem finiteCharacter_exactOrder_card_le + (π : (I → ℤ) →+ H) (hπ : Function.Surjective π) (q : ℕ) (hq : 0 < q) : + (Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ = q)).card ≤ q ^ Fintype.card I := by + let : NeZero q := ⟨hq.ne'⟩ + let f : {χ : AddChar H ℂ // orderOf χ = q} → TorsionLatticeCharacter I q := + fun χ => ⟨characterPullback π χ.val, by + simpa only [map_pow, map_one, χ.property] using + congrArg (characterPullback π) (pow_orderOf_eq_one χ.val)⟩ + have hf : Function.Injective f := by + intro χ ψ h + apply Subtype.ext + exact AddChar.compAddMonoidHom_injective_left π hπ (congrArg Subtype.val h) + have hc := (Fintype.card_le_of_injective f hf).trans (torsionLatticeCharacter_card_le I q) + simpa only [Fintype.card_subtype] using hc + +theorem finiteCharacter_boundedOrder_card_le + (π : (I → ℤ) →+ H) (hπ : Function.Surjective π) (T : ℕ) : + (Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T)).card ≤ + T ^ (Fintype.card I + 1) := by + let S := Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T) + have hmap : (S : Set (AddChar H ℂ)).MapsTo orderOf (Finset.Icc 1 T) := by + intro χ hχ + exact Finset.mem_Icc.mpr ⟨(isOfFinOrder_of_finite χ).orderOf_pos, + (Finset.mem_filter.mp hχ).2⟩ + change S.card ≤ _ + rw [Finset.card_eq_sum_card_fiberwise hmap] + calc + _ ≤ ∑ q ∈ Finset.Icc 1 T, T ^ Fintype.card I := by + apply Finset.sum_le_sum + intro q hq + have hq0 : 0 < q := (Finset.mem_Icc.mp hq).1 + have hc := finiteCharacter_exactOrder_card_le π hπ q hq0 + have hsub : S.filter (fun χ => orderOf χ = q) ⊆ + Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ = q) := by + intro χ hχ + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, (Finset.mem_filter.mp hχ).2⟩ + exact (Finset.card_le_card hsub).trans + (hc.trans (Nat.pow_le_pow_left (Finset.mem_Icc.mp hq).2 _)) + _ = T ^ (Fintype.card I + 1) := by + rw [Finset.sum_const, Nat.card_Icc, nsmul_eq_mul, pow_succ] + simp only [Nat.add_sub_cancel] + exact Nat.mul_comm _ _ + +theorem finiteImage_boundedOrder_coefficient_mass {X : Type*} [Fintype X] + (π : (I → ℤ) →+ H) (hπ : Function.Surjective π) + (p : FiniteProbabilityWeights X) (Y : X → H) (T : ℕ) : + (∑ χ ∈ Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T), + ‖finiteImageCharacteristic p Y χ‖) ≤ (T : ℝ) ^ (Fintype.card I + 1) := by + calc + _ ≤ ∑ _χ ∈ Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T), (1 : ℝ) := + Finset.sum_le_sum (fun χ _ => finiteImageCharacteristic_norm_le_one p Y χ) + _ = ((Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T)).card : ℝ) := by simp + _ ≤ _ := by exact_mod_cast finiteCharacter_boundedOrder_card_le π hπ T + +theorem finiteCharacter_order_tail + (π : (I → ℤ) →+ H) (hπ : Function.Surjective π) + (f : AddChar H ℂ → ℝ) {C : ℝ} (hC : 0 ≤ C) + (hdecay : ∀ χ, f χ ≤ C / (orderOf χ : ℝ) ^ (Fintype.card I + 2)) + (T : ℕ) (hT : 0 < T) : + spectrumTail (Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T)) f ≤ C / T := by + let S := Finset.univ.filter (fun χ : AddChar H ℂ => T < orderOf χ) + let orders := S.image (fun χ => orderOf χ) + have heq : spectrumTail (Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T)) f = + ∑ χ ∈ S, f χ := by + simp only [spectrumTail, S, Finset.sum_filter, Finset.mem_filter, Finset.mem_univ, true_and] + apply Finset.sum_congr rfl + intro χ _ + by_cases h : orderOf χ ≤ T <;> simp [h, Nat.not_lt.mpr, Nat.lt_of_not_ge] + rw [heq, ← Finset.sum_fiberwise_of_maps_to (fun χ hχ => Finset.mem_image_of_mem (fun ψ => orderOf ψ) hχ) f] + change (∑ q ∈ orders, ∑ χ ∈ S with orderOf χ = q, f χ) ≤ _ + have horders (q) (hq : q ∈ orders) : T < q := by + obtain ⟨χ, hχ, rfl⟩ := Finset.mem_image.mp hq + exact (Finset.mem_filter.mp hχ).2 + have hinner (q) (hq : q ∈ orders) : + (∑ χ ∈ S with orderOf χ = q, f χ) ≤ C / (q : ℝ) ^ 2 := by + have hqpos : 0 < q := hT.trans (horders q hq) + have hqreal : (0 : ℝ) < q := Nat.cast_pos.mpr hqpos + have hc : (S.filter (fun χ => orderOf χ = q)).card ≤ q ^ Fintype.card I := + (Finset.card_le_card (by + intro χ hχ + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, (Finset.mem_filter.mp hχ).2⟩)).trans + (finiteCharacter_exactOrder_card_le π hπ q hqpos) + calc + _ ≤ ∑ _χ ∈ S with orderOf _χ = q, C / (q : ℝ) ^ (Fintype.card I + 2) := by + apply Finset.sum_le_sum + intro χ hχ + simpa only [(Finset.mem_filter.mp hχ).2] using hdecay χ + _ = (S.filter (fun χ => orderOf χ = q)).card * + (C / (q : ℝ) ^ (Fintype.card I + 2)) := by rw [Finset.sum_const, nsmul_eq_mul] + _ ≤ (q : ℝ) ^ Fintype.card I * (C / (q : ℝ) ^ (Fintype.card I + 2)) := + mul_le_mul_of_nonneg_right (by exact_mod_cast hc) (by positivity) + _ = C / (q : ℝ) ^ 2 := by rw [pow_add]; field_simp + calc + _ ≤ ∑ q ∈ orders, C / (q : ℝ) ^ 2 := Finset.sum_le_sum hinner + _ = C * ∑ q ∈ orders, 1 / (q : ℝ) ^ 2 := by simp only [Finset.mul_sum, mul_one_div] + _ ≤ C * (1 / (T : ℝ)) := + mul_le_mul_of_nonneg_left (finite_reciprocal_square_tail orders hT horders) hC + _ = C / T := mul_one_div _ _ + +theorem finiteImage_density_order_truncation {X : Type*} [Fintype X] [DecidableEq H] + (π : (I → ℤ) →+ H) (hπ : Function.Surjective π) + (p : FiniteProbabilityWeights X) (Y : X → H) {C : ℝ} (hC : 0 ≤ C) + (hdecay : ∀ χ, ‖finiteImageCharacteristic p Y χ‖ ≤ + C / (orderOf χ : ℝ) ^ (Fintype.card I + 2)) (T : ℕ) (hT : 0 < T) (z : H) : + ‖(Fintype.card H : ℂ) * finiteImageMass p Y z - + ∑ χ ∈ Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T), + finiteImageCharacteristic p Y χ * star (χ z)‖ ≤ C / T := by + have he := finiteImageFourier_truncation p Y + (Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ T)) z (Nat.cast_nonneg (Fintype.card H)) + have hcard : (Fintype.card H : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero + have hcardC : (Fintype.card H : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero + simp only [Complex.ofReal_natCast, div_self hcard, div_self hcardC, one_mul] at he + exact he.trans (finiteCharacter_order_tail π hπ _ hC hdecay T hT) + +theorem finiteImage_density_bound_of_order_decay {X : Type*} [Fintype X] [DecidableEq H] + (π : (I → ℤ) →+ H) (hπ : Function.Surjective π) + (p : FiniteProbabilityWeights X) (Y : X → H) {C : ℝ} (hC : 0 ≤ C) + (hdecay : ∀ χ, ‖finiteImageCharacteristic p Y χ‖ ≤ + C / (orderOf χ : ℝ) ^ (Fintype.card I + 2)) (z : H) : + (Fintype.card H : ℝ) * finiteImageMass p Y z ≤ 1 + C := by + have hset : Finset.univ.filter (fun χ : AddChar H ℂ => orderOf χ ≤ 1) = {1} := by + ext χ + simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_singleton] + constructor + · intro h + exact orderOf_eq_one_iff.mp (Nat.le_antisymm h (isOfFinOrder_of_finite χ).orderOf_pos) + · intro h + subst χ + simp + have he := finiteImage_density_order_truncation π hπ p Y hC hdecay 1 zero_lt_one z + rw [hset] at he + simp only [Finset.sum_singleton, finiteImageCharacteristic, AddChar.one_apply, + FiniteProbabilityWeights.complexMean_const, star_one, mul_one, Nat.cast_one, div_one] at he + have hre : |(Fintype.card H : ℝ) * finiteImageMass p Y z - 1| ≤ C := by + simpa only [← Complex.ofReal_natCast, ← Complex.ofReal_mul, ← Complex.ofReal_one, + ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using he + linarith [(abs_le.mp hre).2] + +theorem finiteCharacter_integer_decay_of_rpow {C P : ℝ} (hC : 0 ≤ C) + (hP : ((Fintype.card I + 2 : ℕ) : ℝ) ≤ P) (f : AddChar H ℂ → ℝ) + (hf : ∀ χ, f χ ≤ C * (orderOf χ : ℝ) ^ (-P)) : + ∀ χ, f χ ≤ C / (orderOf χ : ℝ) ^ (Fintype.card I + 2) := by + intro χ + have hq : (1 : ℝ) ≤ orderOf χ := by + exact_mod_cast (isOfFinOrder_of_finite χ).orderOf_pos + have hq0 : 0 < (orderOf χ : ℝ) := lt_of_lt_of_le zero_lt_one hq + have hpow : (orderOf χ : ℝ) ^ (Fintype.card I + 2) ≤ (orderOf χ : ℝ) ^ P := by + rw [← Real.rpow_natCast] + exact Real.rpow_le_rpow_of_exponent_le hq hP + apply (hf χ).trans + rw [Real.rpow_neg hq0.le, ← div_eq_mul_inv] + exact div_le_div_of_nonneg_left hC (pow_pos hq0 _) hpow + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FiniteFourierSmoothing.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FiniteFourierSmoothing.lean new file mode 100644 index 0000000000000000000000000000000000000000..2568ecc06b4a58951c36575adbc726d08697dc99 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FiniteFourierSmoothing.lean @@ -0,0 +1,644 @@ +import Mathlib.Analysis.Fourier.FiniteAbelian.PontryaginDuality +import Mathlib.GroupTheory.Index +import OAI.Combinatorics.Progressions.Estimates.FiniteFiberTest +import OAI.Combinatorics.Progressions.Fourier.FiniteSpectrumCutoff + +namespace OAI + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {H : Type*} [AddCommGroup H] [Fintype H] + +noncomputable def finiteFourierCoeff (f : H → ℂ) (χ : AddChar H ℂ) : ℂ := + 𝔼 x, f x * star (χ x) + +theorem addChar_sub_star (χ : AddChar H ℂ) (x y : H) : + χ (x - y) = χ x * star (χ y) := by + rw [AddChar.map_sub_eq_div, div_eq_mul_inv, AddChar.inv_apply_eq_conj] + rfl + +theorem star_finiteFourierCoeff (f : H → ℂ) (χ : AddChar H ℂ) : + star (finiteFourierCoeff f χ) = 𝔼 x, star (f x) * χ x := by + rw [finiteFourierCoeff, ← expect_star] + apply Finset.expect_congr rfl + intro x _ + simp only [star_mul, star_star] + ring + +theorem finiteFourier_inversion (f : H → ℂ) (x : H) : + (∑ χ : AddChar H ℂ, finiteFourierCoeff f χ * χ x) = f x := by + classical + calc + _ = 𝔼 y, f y * (∑ χ : AddChar H ℂ, χ (x - y)) := by + simp only [finiteFourierCoeff, Finset.expect_mul] + rw [← Finset.expect_sum_comm] + apply Finset.expect_congr rfl + intro y _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro χ _ + rw [addChar_sub_star] + ring + _ = 𝔼 y, if x = y then (Fintype.card H : ℂ) * f x else 0 := by + apply Finset.expect_congr rfl + intro y _ + rw [AddChar.sum_apply_eq_ite] + by_cases hxy : x = y + · subst y + simp [mul_comm] + · simp [sub_eq_zero, hxy] + _ = _ := by + have hc : (Fintype.card H : ℂ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + rw [Fintype.expect_eq_sum_div_card, Finset.sum_eq_single x] + · simp [hc] + · intro y _ hy + simp only [ite_eq_right (Ne.symm hy)] + · simp + +theorem finiteFourier_inner (f g : H → ℂ) : + (∑ χ : AddChar H ℂ, finiteFourierCoeff f χ * star (finiteFourierCoeff g χ)) = + 𝔼 x, f x * star (g x) := by + simp_rw [star_finiteFourierCoeff, Finset.mul_expect] + rw [← Finset.expect_sum_comm] + apply Finset.expect_congr rfl + intro x _ + calc + _ = (∑ χ : AddChar H ℂ, finiteFourierCoeff f χ * χ x) * star (g x) := by + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro χ _ + ring + _ = _ := by rw [finiteFourier_inversion] + +theorem finiteFourier_parseval (f : H → ℂ) : + (∑ χ : AddChar H ℂ, ‖finiteFourierCoeff f χ‖ ^ 2) = 𝔼 x, ‖f x‖ ^ 2 := by + have h := congrArg Complex.re (finiteFourier_inner f f) + simpa only [Complex.re_sum, expect_re, mul_star_re_eq_norm_sq] using h + +end Erdos3 + +end + +section + +open Finset +open scoped BigOperators + +namespace Erdos3 + +variable {G : Type*} [Fintype G] [AddCommGroup G] + +noncomputable def fourierL1 (f : G → ℂ) : ℝ := + ∑ ψ : AddChar G ℂ, ‖finiteFourierCoeff f ψ‖ + +theorem norm_sub_translate_le_fourier_sum (f : G → ℂ) (t x : G) : + ‖f (x - t) - f x‖ ≤ + ∑ ψ : AddChar G ℂ, + ‖finiteFourierCoeff f ψ‖ * ‖ψ (-t) - 1‖ := by + classical + rw [← finiteFourier_inversion f (x - t), + ← finiteFourier_inversion f x, ← Finset.sum_sub_distrib] + calc + ‖∑ ψ : AddChar G ℂ, + (finiteFourierCoeff f ψ * ψ (x - t) - + finiteFourierCoeff f ψ * ψ x)‖ + ≤ ∑ ψ : AddChar G ℂ, + ‖finiteFourierCoeff f ψ * ψ (x - t) - + finiteFourierCoeff f ψ * ψ x‖ := + norm_sum_le _ _ + _ = ∑ ψ : AddChar G ℂ, + ‖finiteFourierCoeff f ψ‖ * ‖ψ (-t) - 1‖ := by + apply sum_congr rfl + intro ψ _ + have hfactor : + finiteFourierCoeff f ψ * ψ (x - t) - + finiteFourierCoeff f ψ * ψ x = + (finiteFourierCoeff f ψ * ψ x) * (ψ (-t) - 1) := by + have hmap : ψ (x - t) = ψ x * ψ (-t) := by + rw [sub_eq_add_neg, ψ.map_add_eq_mul] + rw [hmap] + ring + rw [hfactor, norm_mul, norm_mul, AddChar.norm_apply, mul_one] + +theorem norm_sub_translate_le_mul_fourierL1 + (f : G → ℂ) (t x : G) {delta : ℝ} (_hdelta : 0 ≤ delta) + (hann : ∀ ψ : AddChar G ℂ, ‖ψ (-t) - 1‖ ≤ delta) : + ‖f (x - t) - f x‖ ≤ delta * fourierL1 f := by + classical + calc + ‖f (x - t) - f x‖ ≤ + ∑ ψ : AddChar G ℂ, + ‖finiteFourierCoeff f ψ‖ * ‖ψ (-t) - 1‖ := + norm_sub_translate_le_fourier_sum f t x + _ ≤ ∑ ψ : AddChar G ℂ, + ‖finiteFourierCoeff f ψ‖ * delta := by + gcongr with ψ + exact hann ψ + _ = delta * fourierL1 f := by + rw [fourierL1] + calc + Finset.univ.sum + (fun ψ : AddChar G ℂ ↦ ‖finiteFourierCoeff f ψ‖ * delta) = + Finset.univ.sum + (fun ψ : AddChar G ℂ ↦ ‖finiteFourierCoeff f ψ‖) * delta := + (Finset.sum_mul _ _ _).symm + _ = _ := mul_comm _ _ + +theorem norm_sub_translate_le_spectrum_cutoff + (f : G → ℂ) (Omega : Finset (AddChar G ℂ)) (t x : G) + {theta : ℝ} (_htheta : 0 ≤ theta) + (hann : ∀ psi ∈ Omega, ‖psi (-t) - 1‖ ≤ theta) : + ‖f (x - t) - f x‖ ≤ + theta * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∈ Omega), + ‖finiteFourierCoeff f psi‖ + + 2 * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∉ Omega), + ‖finiteFourierCoeff f psi‖ := by + classical + calc + ‖f (x - t) - f x‖ ≤ + ∑ psi : AddChar G ℂ, + ‖finiteFourierCoeff f psi‖ * ‖psi (-t) - 1‖ := + norm_sub_translate_le_fourier_sum f t x + _ = ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∈ Omega), + ‖finiteFourierCoeff f psi‖ * ‖psi (-t) - 1‖ + + ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∉ Omega), + ‖finiteFourierCoeff f psi‖ * ‖psi (-t) - 1‖ := by + rw [← Finset.sum_filter_add_sum_filter_not (s := Finset.univ) + (p := fun psi : AddChar G ℂ ↦ psi ∈ Omega)] + _ ≤ ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∈ Omega), + ‖finiteFourierCoeff f psi‖ * theta + + ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∉ Omega), + ‖finiteFourierCoeff f psi‖ * 2 := by + gcongr with psi hpsi psi hpsi + · exact hann psi (by simpa using hpsi) + · calc + ‖psi (-t) - 1‖ ≤ ‖psi (-t)‖ + ‖(1 : ℂ)‖ := norm_sub_le _ _ + _ = 2 := by norm_num + _ = theta * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∈ Omega), + ‖finiteFourierCoeff f psi‖ + + 2 * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∉ Omega), + ‖finiteFourierCoeff f psi‖ := by + rw [← Finset.sum_mul, ← Finset.sum_mul] + ring + +theorem norm_sub_translate_le_of_uniform_approx_and_spectrum_cutoff + (f p : G → ℂ) (Omega : Finset (AddChar G ℂ)) (t x : G) + {delta theta : ℝ} (_hdelta : 0 ≤ delta) (htheta : 0 ≤ theta) + (happrox : ∀ y, ‖p y - f y‖ ≤ delta) + (hann : ∀ psi ∈ Omega, ‖psi (-t) - 1‖ ≤ theta) : + ‖f (x - t) - f x‖ ≤ + 2 * delta + + theta * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∈ Omega), + ‖finiteFourierCoeff p psi‖ + + 2 * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∉ Omega), + ‖finiteFourierCoeff p psi‖ := by + classical + have hdecomp : f (x - t) - f x = + (f (x - t) - p (x - t)) + (p (x - t) - p x) + (p x - f x) := by ring + rw [hdecomp] + calc + ‖(f (x - t) - p (x - t)) + (p (x - t) - p x) + (p x - f x)‖ ≤ + ‖f (x - t) - p (x - t)‖ + ‖p (x - t) - p x‖ + ‖p x - f x‖ := by + calc + _ ≤ ‖(f (x - t) - p (x - t)) + (p (x - t) - p x)‖ + + ‖p x - f x‖ := norm_add_le _ _ + _ ≤ ‖f (x - t) - p (x - t)‖ + ‖p (x - t) - p x‖ + + ‖p x - f x‖ := by + gcongr + exact norm_add_le _ _ + _ ≤ delta + ‖p (x - t) - p x‖ + delta := by + gcongr + · simpa only [norm_sub_rev] using happrox (x - t) + · exact happrox x + _ ≤ delta + + (theta * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∈ Omega), + ‖finiteFourierCoeff p psi‖ + + 2 * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∉ Omega), + ‖finiteFourierCoeff p psi‖) + delta := by + gcongr + exact norm_sub_translate_le_spectrum_cutoff p Omega t x htheta hann + _ = 2 * delta + + theta * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∈ Omega), + ‖finiteFourierCoeff p psi‖ + + 2 * ∑ psi ∈ Finset.univ.filter (fun psi ↦ psi ∉ Omega), + ‖finiteFourierCoeff p psi‖ := by ring + +omit [Fintype G] in + +lemma norm_character_neg_sub_one [Finite G] (psi : AddChar G ℂ) (t : G) : + ‖psi (-t) - 1‖ = ‖1 - psi t‖ := by + rw [psi.map_neg_eq_inv] + have hne : psi t ≠ 0 := by + intro h + have := AddChar.norm_apply psi t + simp [h] at this + calc + ‖(psi t)⁻¹ - 1‖ = ‖(psi t)⁻¹ * (1 - psi t)‖ := by + congr 1 + field_simp + _ = ‖1 - psi t‖ := by + rw [norm_mul, norm_inv, AddChar.norm_apply, inv_one, one_mul] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def finiteImageMass {X H : Type*} [Fintype X] [DecidableEq H] + (p : FiniteProbabilityWeights X) (Y : X → H) (z : H) : ℝ := + p.mean (fun x => if Y x = z then 1 else 0) + +noncomputable def finiteImageCharacteristic {X H : Type*} [Fintype X] [AddCommGroup H] + (p : FiniteProbabilityWeights X) (Y : X → H) (χ : AddChar H ℂ) : ℂ := + p.complexMean (fun x => χ (Y x)) + +theorem finiteImageCharacteristic_norm_le_one {X H : Type*} [Fintype X] + [AddCommGroup H] [Fintype H] (p : FiniteProbabilityWeights X) (Y : X → H) (χ : AddChar H ℂ) : + ‖finiteImageCharacteristic p Y χ‖ ≤ 1 := by + exact (p.norm_complexMean_le_mean_norm _).trans_eq (by + simp only [AddChar.norm_apply, p.mean_const]) + +theorem finiteImageFourier_inversion {X H : Type*} [Fintype X] + [AddCommGroup H] [Fintype H] [DecidableEq H] + (p : FiniteProbabilityWeights X) (Y : X → H) (z : H) : + (∑ χ : AddChar H ℂ, finiteImageCharacteristic p Y χ * star (χ z)) = + (Fintype.card H : ℂ) * finiteImageMass p Y z := by + classical + calc + _ = ∑ x, (p.weight x : ℂ) * (∑ χ : AddChar H ℂ, χ (Y x - z)) := by + simp only [finiteImageCharacteristic, FiniteProbabilityWeights.complexMean, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro x _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro χ _ + rw [addChar_sub_star] + ring + _ = (Fintype.card H : ℂ) * finiteImageMass p Y z := by + simp only [AddChar.sum_apply_eq_ite, sub_eq_zero, finiteImageMass, + FiniteProbabilityWeights.mean, Complex.ofReal_sum, Complex.ofReal_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + by_cases hx : Y x = z <;> simp [hx, mul_comm] + +theorem finiteImageFourier_truncation {X H : Type*} [Fintype X] + [AddCommGroup H] [Fintype H] [DecidableEq H] + (p : FiniteProbabilityWeights X) (Y : X → H) (S : Finset (AddChar H ℂ)) (z : H) + {scale : ℝ} (hscale : 0 ≤ scale) : + ‖(scale : ℂ) * finiteImageMass p Y z - + ((scale : ℂ) / Fintype.card H) * ∑ χ ∈ S, finiteImageCharacteristic p Y χ * star (χ z)‖ ≤ + (scale / Fintype.card H) * spectrumTail S (fun χ => ‖finiteImageCharacteristic p Y χ‖) := by + have hc : (Fintype.card H : ℂ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + have he : (scale : ℂ) * finiteImageMass p Y z = ((scale : ℂ) / Fintype.card H) * + ∑ χ : AddChar H ℂ, finiteImageCharacteristic p Y χ * star (χ z) := by + rw [finiteImageFourier_inversion] + field_simp + rw [he, ← mul_sub, norm_mul] + have hn : ‖(scale : ℂ) / Fintype.card H‖ = scale / Fintype.card H := by + rw [norm_div, Complex.norm_real, Real.norm_of_nonneg hscale, Complex.norm_natCast] + rw [hn] + apply mul_le_mul_of_nonneg_left _ (by positivity) + exact finite_series_truncation_le S _ (fun χ => star (χ z)) + (fun χ => by simp only [norm_star, AddChar.norm_apply, le_refl]) + +end Erdos3 + +end + +section + +open Finset Function Real +open scoped BigOperators ComplexConjugate NNReal + +namespace Erdos3.Chang + +variable {G : Type*} [Fintype G] [AddCommGroup G] + +noncomputable def spectrumSum (A : Finset G) (psi : AddChar G ℂ) : ℂ := + ∑ x ∈ A, psi x + +noncomputable def largeSpectrum (A : Finset G) (eta : ℝ) : Finset (AddChar G ℂ) := + Finset.univ.filter fun psi ↦ eta * A.card ≤ ‖spectrumSum A psi‖ + +@[simp] +theorem mem_largeSpectrum {A : Finset G} {eta : ℝ} {psi : AddChar G ℂ} : + psi ∈ largeSpectrum A eta ↔ eta * A.card ≤ ‖spectrumSum A psi‖ := by + simp [largeSpectrum] + +end Erdos3.Chang + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] + +noncomputable def additiveCharacterKernel (χ : AddChar G ℂ) : AddSubgroup G where + carrier := {x | χ x = 1} + zero_mem' := χ.map_zero_eq_one + add_mem' := by + intro x y hx hy + change χ (x + y) = 1 + rw [AddChar.map_add_eq_mul, hx, hy, one_mul] + neg_mem' := by + intro x hx + change χ (-x) = 1 + rw [AddChar.map_neg_eq_inv, hx, inv_one] + +theorem additiveCharacterKernel_ne_top {χ : AddChar G ℂ} (hχ : χ ≠ 0) : + additiveCharacterKernel χ ≠ ⊤ := by + intro h + apply hχ + ext x + change χ x = 1 + have hx : x ∈ additiveCharacterKernel χ := by rw [h]; trivial + exact hx + +variable [Fintype G] + +theorem primePowerCharacter_kernel_index {p a : ℕ} (hp : p.Prime) + (hG : Fintype.card G = p ^ a) {χ : AddChar G ℂ} (hχ : χ ≠ 0) : + p ≤ (additiveCharacterKernel χ).index := by + have hd : (additiveCharacterKernel χ).index ∣ p ^ a := by + rw [← hG, ← Nat.card_eq_fintype_card] + exact (additiveCharacterKernel χ).index_dvd_card + obtain ⟨b, _, hb⟩ := (Nat.dvd_prime_pow hp).mp hd + have hbpos : 0 < b := by + by_contra hn + have hbzero : b = 0 := by omega + rw [hbzero, pow_zero] at hb + exact additiveCharacterKernel_ne_top hχ ((additiveCharacterKernel χ).index_eq_one.mp hb) + rw [hb] + simpa only [pow_one] using Nat.pow_le_pow_right hp.one_le hbpos + +theorem primePowerCharacter_kernel_probability {p a : ℕ} (hp : p.Prime) + (hG : Fintype.card G = p ^ a) {χ : AddChar G ℂ} (hχ : χ ≠ 0) : + (𝔼 x : G, if χ x = 1 then (1 : ℝ) else 0) ≤ (p : ℝ)⁻¹ := by + classical + let K := additiveCharacterKernel χ + have hindex := primePowerCharacter_kernel_index hp hG hχ + have hc : (Fintype.card K : ℝ) * K.index = Fintype.card G := by + have h : Fintype.card K * K.index = Fintype.card G := by + simpa only [Nat.card_eq_fintype_card] using K.card_mul_index + exact_mod_cast h + have hN : (0 : ℝ) < Fintype.card G := by exact_mod_cast Fintype.card_pos + have hp0 : (0 : ℝ) < p := by exact_mod_cast hp.pos + have hcard : (Finset.univ.filter (fun x : G => χ x = 1)).card = Fintype.card K := by + simp [K, additiveCharacterKernel, Fintype.card_subtype] + rw [Fintype.expect_eq_sum_div_card] + simp only [Finset.sum_boole, hcard] + apply (div_le_iff₀ hN).mpr + have hi : (p : ℝ) ≤ K.index := by exact_mod_cast hindex + calc + _ ≤ (p : ℝ)⁻¹ * ((Fintype.card K : ℝ) * K.index) := by + apply (le_inv_mul_iff₀ hp0).mpr + nlinarith [Nat.cast_nonneg (α := ℝ) (Fintype.card K)] + _ = _ := by rw [hc] + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {G : Type*} [AddCommGroup G] [Fintype G] + +noncomputable def finiteSetAverage (A : Finset G) (f : G → ℂ) (x : G) : ℂ := + 𝔼 a ∈ A, f (x - a) + +noncomputable def setFourierMultiplier (A : Finset G) (psi : AddChar G ℂ) : ℂ := + 𝔼 a ∈ A, star (psi a) + +theorem finiteFourierCoeff_translate (f : G → ℂ) (a : G) (psi : AddChar G ℂ) : + finiteFourierCoeff (fun x => f (x - a)) psi = star (psi a) * finiteFourierCoeff f psi := by + unfold finiteFourierCoeff + calc + (𝔼 x, f (x - a) * star (psi x)) = 𝔼 x, f x * star (psi (x + a)) := by + apply Fintype.expect_equiv (Equiv.subRight a) + intro x + simp + _ = star (psi a) * 𝔼 x, f x * star (psi x) := by + rw [Finset.mul_expect] + apply Finset.expect_congr rfl + intro x _ + rw [AddChar.map_add_eq_mul, star_mul] + ring + +theorem finiteFourierCoeff_finiteSetAverage + (A : Finset G) (f : G → ℂ) (psi : AddChar G ℂ) : + finiteFourierCoeff (finiteSetAverage A f) psi = + setFourierMultiplier A psi * finiteFourierCoeff f psi := by + unfold finiteFourierCoeff finiteSetAverage + simp_rw [Finset.expect_mul] + rw [Finset.expect_comm] + change (𝔼 a ∈ A, finiteFourierCoeff (fun x => f (x - a)) psi) = _ + simp_rw [finiteFourierCoeff_translate] + rw [← Finset.expect_mul] + rfl + +omit [Fintype G] in +theorem setFourierMultiplier_eq (A : Finset G) (psi : AddChar G ℂ) : + setFourierMultiplier A psi = star (Chang.spectrumSum A psi) / (A.card : ℂ) := by + simp only [setFourierMultiplier, Finset.expect_eq_sum_div_card, Chang.spectrumSum, star_sum] + +omit [Fintype G] in +theorem norm_setFourierMultiplier (A : Finset G) (psi : AddChar G ℂ) : + ‖setFourierMultiplier A psi‖ = ‖Chang.spectrumSum A psi‖ / A.card := by + rw [setFourierMultiplier_eq, norm_div, norm_star, Complex.norm_natCast] + +theorem norm_setFourierMultiplier_le_one {A : Finset G} (hA : A.Nonempty) + (psi : AddChar G ℂ) : ‖setFourierMultiplier A psi‖ ≤ 1 := by + apply (RCLike.norm_expect_le (K := ℂ)).trans + simp only [norm_star, AddChar.norm_apply, Finset.expect_const hA] + exact le_rfl + +theorem mem_largeSpectrum_iff_le_multiplier {A : Finset G} (hA : A.Nonempty) + (eta : ℝ) (psi : AddChar G ℂ) : + psi ∈ Chang.largeSpectrum A eta ↔ eta ≤ ‖setFourierMultiplier A psi‖ := by + have hcard : (0 : ℝ) < A.card := by exact_mod_cast hA.card_pos + rw [Chang.mem_largeSpectrum, norm_setFourierMultiplier, le_div_iff₀ hcard] + +noncomputable def iteratedFiniteSetAverage (A : Finset G) (f : G → ℂ) : ℕ → G → ℂ + | 0 => f + | n + 1 => finiteSetAverage A (iteratedFiniteSetAverage A f n) + +theorem finiteFourierCoeff_iteratedFiniteSetAverage + (A : Finset G) (f : G → ℂ) (psi : AddChar G ℂ) (n : ℕ) : + finiteFourierCoeff (iteratedFiniteSetAverage A f n) psi = + setFourierMultiplier A psi ^ n * finiteFourierCoeff f psi := by + induction n with + | zero => simp [iteratedFiniteSetAverage] + | succ n ih => + rw [iteratedFiniteSetAverage, finiteFourierCoeff_finiteSetAverage, ih, pow_succ] + ring + +end Erdos3 + +end + +section + +noncomputable section + +open Finset Function Real +open scoped BigOperators ComplexConjugate NNReal + +namespace Erdos3.RelativeChangSanders + +variable {G : Type*} [Fintype G] [AddCommGroup G] + +def IsWeightedDissociated (mu : G → ℝ) (K : ℝ) + (Delta : Finset (AddChar G ℂ)) : Prop := + ∀ u : AddChar G ℂ → ℂ, + (∀ psi ∈ Delta, ‖u psi‖ ≤ 1) → + ∑ x : G, mu x * + ∏ psi ∈ Delta, (1 + (u psi * psi x).re) ≤ exp K + +def weightedSpectrumSum (f : G → ℝ) (psi : AddChar G ℂ) : ℂ := + ∑ x : G, (f x : ℂ) * psi x + +def relativeLargeSpectrum (mu f : G → ℝ) (eta : ℝ) : + Finset (AddChar G ℂ) := + Finset.univ.filter fun psi ↦ + eta * (∑ x : G, f x * mu x) ≤ + ‖∑ x : G, (f x * mu x : ℝ) * psi x‖ + +@[simp] theorem mem_relativeLargeSpectrum {mu f : G → ℝ} {eta : ℝ} + {psi : AddChar G ℂ} : + psi ∈ relativeLargeSpectrum mu f eta ↔ + eta * (∑ x : G, f x * mu x) ≤ + ‖∑ x : G, (f x * mu x : ℝ) * psi x‖ := by + simp [relativeLargeSpectrum] + +end Erdos3.RelativeChangSanders + +end + +end + +section + +namespace Erdos3.Chang + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [Fintype G] + +omit [Fintype G] in +theorem spectrumSum_map_subRight (T : Finset G) (z : G) (psi : AddChar G ℂ) : + spectrumSum (T.map (Equiv.subRight z).toEmbedding) psi = + spectrumSum T psi * psi (-z) := by + unfold spectrumSum + rw [Finset.sum_map] + simp only [Equiv.toEmbedding_apply, Equiv.subRight_apply, + sub_eq_add_neg, AddChar.map_add_eq_mul] + rw [Finset.sum_mul] + +theorem norm_spectrumSum_map_subRight (T : Finset G) (z : G) (psi : AddChar G ℂ) : + ‖spectrumSum (T.map (Equiv.subRight z).toEmbedding) psi‖ = ‖spectrumSum T psi‖ := by + rw [spectrumSum_map_subRight, norm_mul, AddChar.norm_apply, mul_one] + +theorem mem_largeSpectrum_map_subRight_iff + (T : Finset G) (z : G) (eta : ℝ) (psi : AddChar G ℂ) : + psi ∈ largeSpectrum (T.map (Equiv.subRight z).toEmbedding) eta ↔ + psi ∈ largeSpectrum T eta := by + rw [mem_largeSpectrum, mem_largeSpectrum, Finset.card_map, norm_spectrumSum_map_subRight] + +end Erdos3.Chang + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {G : Type*} [AddCommGroup G] [Fintype G] + +theorem iteratedFiniteSetAverage_translate_le + {X : Finset G} (hX : X.Nonempty) (m : ℕ) (f : G → ℂ) + {eta theta : ℝ} (heta : 0 ≤ eta) (htheta : 0 ≤ theta) (t x : G) + (hphase : ∀ psi ∈ Chang.largeSpectrum X eta, ‖1 - psi t‖ ≤ theta) : + ‖iteratedFiniteSetAverage X f m (x - t) - iteratedFiniteSetAverage X f m x‖ ≤ + (theta + 2 * eta ^ m) * fourierL1 f := by + apply (norm_sub_translate_le_fourier_sum (iteratedFiniteSetAverage X f m) t x).trans + calc + (∑ psi : AddChar G ℂ, + ‖finiteFourierCoeff (iteratedFiniteSetAverage X f m) psi‖ * ‖psi (-t) - 1‖) ≤ + ∑ psi : AddChar G ℂ, (theta + 2 * eta ^ m) * ‖finiteFourierCoeff f psi‖ := by + apply Finset.sum_le_sum + intro psi _ + rw [finiteFourierCoeff_iteratedFiniteSetAverage, norm_mul, norm_pow, + norm_character_neg_sub_one] + have hmu := norm_setFourierMultiplier_le_one hX psi + by_cases hlarge : eta ≤ ‖setFourierMultiplier X psi‖ + · have hpow : ‖setFourierMultiplier X psi‖ ^ m ≤ 1 := + pow_le_one₀ (norm_nonneg _) hmu + have hp := hphase psi ((mem_largeSpectrum_iff_le_multiplier hX eta psi).2 hlarge) + calc + ‖setFourierMultiplier X psi‖ ^ m * ‖finiteFourierCoeff f psi‖ * ‖1 - psi t‖ ≤ + 1 * ‖finiteFourierCoeff f psi‖ * theta := by gcongr + _ ≤ (theta + 2 * eta ^ m) * ‖finiteFourierCoeff f psi‖ := by + have hepow : 0 ≤ eta ^ m := pow_nonneg heta m + have hf : 0 ≤ ‖finiteFourierCoeff f psi‖ := norm_nonneg _ + nlinarith + · have htail : ‖setFourierMultiplier X psi‖ ^ m ≤ eta ^ m := + pow_le_pow_left₀ (norm_nonneg _) (le_of_not_ge hlarge) m + have hchord : ‖1 - psi t‖ ≤ 2 := by + calc + ‖1 - psi t‖ ≤ ‖(1 : ℂ)‖ + ‖psi t‖ := norm_sub_le _ _ + _ = 2 := by norm_num + calc + ‖setFourierMultiplier X psi‖ ^ m * ‖finiteFourierCoeff f psi‖ * ‖1 - psi t‖ ≤ + eta ^ m * ‖finiteFourierCoeff f psi‖ * 2 := by gcongr + _ ≤ (theta + 2 * eta ^ m) * ‖finiteFourierCoeff f psi‖ := by + have hf : 0 ≤ ‖finiteFourierCoeff f psi‖ := norm_nonneg _ + nlinarith + _ = (theta + 2 * eta ^ m) * fourierL1 f := by rw [fourierL1, Finset.mul_sum] + +theorem translate_le_of_iteratedFiniteSetAverage_approx + {X : Finset G} (hX : X.Nonempty) (m : ℕ) (f : G → ℂ) + {delta eta theta : ℝ} (heta : 0 ≤ eta) (htheta : 0 ≤ theta) (t x : G) + (happrox : ∀ y, ‖iteratedFiniteSetAverage X f m y - f y‖ ≤ delta) + (hphase : ∀ psi ∈ Chang.largeSpectrum X eta, ‖1 - psi t‖ ≤ theta) : + ‖f (x - t) - f x‖ ≤ 2 * delta + (theta + 2 * eta ^ m) * fourierL1 f := by + let p := iteratedFiniteSetAverage X f m + have hdecomp : f (x - t) - f x = + (f (x - t) - p (x - t)) + (p (x - t) - p x) + (p x - f x) := by ring + rw [hdecomp] + calc + ‖(f (x - t) - p (x - t)) + (p (x - t) - p x) + (p x - f x)‖ ≤ + ‖f (x - t) - p (x - t)‖ + ‖p (x - t) - p x‖ + ‖p x - f x‖ := + (norm_add_le _ _).trans (add_le_add (norm_add_le _ _) le_rfl) + _ ≤ delta + ((theta + 2 * eta ^ m) * fourierL1 f) + delta := by + apply add_le_add + · apply add_le_add + · simpa only [norm_sub_rev] using happrox (x - t) + · exact iteratedFiniteSetAverage_translate_le hX m f heta htheta t x hphase + · exact happrox x + _ = 2 * delta + (theta + 2 * eta ^ m) * fourierL1 f := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FiniteSpectrumCutoff.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FiniteSpectrumCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b7b421d242727734c63d0a9e4a09490819bdb0c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FiniteSpectrumCutoff.lean @@ -0,0 +1,159 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def spectrumTail {K : Type*} [Fintype K] [DecidableEq K] + (S : Finset K) (f : K → ℝ) : ℝ := ∑ k, if k ∈ S then 0 else f k + +theorem spectrumTail_le_card {K : Type*} [Fintype K] [DecidableEq K] + (S : Finset K) (f : K → ℝ) {w : ℝ} (hw : 0 ≤ w) + (h : ∀ k, k ∉ S → f k ≤ w) : spectrumTail S f ≤ Fintype.card K * w := by + calc + _ ≤ ∑ _k : K, w := by + apply Finset.sum_le_sum + intro k _ + by_cases hk : k ∈ S <;> simp only [hk, ite_true, ite_false] + · exact hw + · exact h k hk + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + +theorem spectrumTail_step {K : Type*} [Fintype K] [DecidableEq K] + (S T : Finset K) (f : K → ℝ) (hf : ∀ k, 0 ≤ f k) {w : ℝ} (hw : 0 ≤ w) + (h : ∀ k, k ∉ S → f k ≤ w) : + spectrumTail S f ≤ T.card * w + spectrumTail T f := by + have hp (k : K) : (if k ∈ S then 0 else f k) ≤ + (if k ∈ T then w else 0) + (if k ∈ T then 0 else f k) := by + by_cases hs : k ∈ S <;> by_cases ht : k ∈ T <;> + simp only [hs, ht, ite_true, ite_false, zero_add, add_zero] + · exact hw + · exact hf k + · exact h k hs + · exact le_rfl + calc + _ ≤ ∑ k, ((if k ∈ T then w else 0) + (if k ∈ T then 0 else f k)) := + Finset.sum_le_sum (fun k _ => hp k) + _ = _ := by simp only [Finset.sum_add_distrib, Finset.sum_ite_mem, + Finset.univ_inter, Finset.sum_const, nsmul_eq_mul, spectrumTail] + +theorem spectrumTail_levels {K : Type*} [Fintype K] [DecidableEq K] + (S : ℕ → Finset K) (f : K → ℝ) (hf : ∀ k, 0 ≤ f k) + (w : ℕ → ℝ) (hw : ∀ i, 0 ≤ w i) (h : ∀ i k, k ∉ S i → f k ≤ w i) (n : ℕ) : + spectrumTail (S 0) f ≤ (∑ i ∈ Finset.range n, (S (i + 1)).card * w i) + + Fintype.card K * w n := by + induction n generalizing S w with + | zero => simpa only [Finset.range_zero, Finset.sum_empty, zero_add] using + spectrumTail_le_card (S 0) f (hw 0) (h 0) + | succ n ih => + have hstep := spectrumTail_step (S 0) (S 1) f hf (hw 0) (h 0) + have htail := ih (fun i => S (i + 1)) (fun i => w (i + 1)) + (fun i => hw (i + 1)) (fun i => h (i + 1)) + calc + _ ≤ (S 1).card * w 0 + ((∑ i ∈ Finset.range n, (S (i + 1 + 1)).card * w (i + 1)) + + Fintype.card K * w (n + 1)) := hstep.trans (add_le_add le_rfl htail) + _ = _ := by rw [Finset.sum_range_succ']; ring + +theorem spectrumTail_geometric {K : Type*} [Fintype K] [DecidableEq K] + (S : ℕ → Finset K) (f : K → ℝ) (hf : ∀ k, 0 ≤ f k) + (w : ℕ → ℝ) (hw : ∀ i, 0 ≤ w i) (h : ∀ i k, k ∉ S i → f k ≤ w i) + {C : ℝ} (hC : 0 ≤ C) (hlevel : ∀ i, (S (i + 1)).card * w i ≤ C * (1 / 2 : ℝ) ^ i) + (n : ℕ) : spectrumTail (S 0) f ≤ 2 * C + Fintype.card K * w n := by + apply (spectrumTail_levels S f hf w hw h n).trans + refine add_le_add ?_ le_rfl + calc + _ ≤ ∑ i ∈ Finset.range n, C * (1 / 2 : ℝ) ^ i := Finset.sum_le_sum (fun i _ => hlevel i) + _ = C * ∑ i ∈ Finset.range n, (1 / 2 : ℝ) ^ i := (Finset.mul_sum _ _ _).symm + _ ≤ C * 2 := mul_le_mul_of_nonneg_left (sum_geometric_two_le n) hC + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem finite_series_truncation_le {K : Type*} [Fintype K] [DecidableEq K] + (S : Finset K) (c ψ : K → ℂ) (hψ : ∀ k, ‖ψ k‖ ≤ 1) : + ‖(∑ k, c k * ψ k) - ∑ k ∈ S, c k * ψ k‖ ≤ spectrumTail S (fun k => ‖c k‖) := by + have hid : (∑ k, c k * ψ k) - ∑ k ∈ S, c k * ψ k = + ∑ k, if k ∈ S then 0 else c k * ψ k := by + calc + _ = ∑ k, (c k * ψ k - if k ∈ S then c k * ψ k else 0) := by + rw [Finset.sum_sub_distrib] + simp only [Finset.sum_ite_mem, Finset.univ_inter] + _ = _ := by + apply Finset.sum_congr rfl + intro k _ + by_cases hk : k ∈ S <;> simp only [hk, ite_true, ite_false, sub_self, sub_zero] + rw [hid] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro k _ + by_cases hk : k ∈ S + · simp only [hk, ite_true, norm_zero, le_refl] + · simp only [hk, ite_false, norm_mul] + exact mul_le_of_le_one_right (norm_nonneg _) (hψ k) + +theorem finite_series_norm_le {K : Type*} [Fintype K] (c ψ : K → ℂ) + (hψ : ∀ k, ‖ψ k‖ ≤ 1) : ‖∑ k, c k * ψ k‖ ≤ ∑ k, ‖c k‖ := by + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro k _ + rw [norm_mul] + exact mul_le_of_le_one_right (norm_nonneg _) (hψ k) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem spectrumTail_finite_levels {K : Type*} [Fintype K] [DecidableEq K] + (S : ℕ → Finset K) (f : K → ℝ) (hf : ∀ k, 0 ≤ f k) (w : ℕ → ℝ) (n : ℕ) + (hw : ∀ i ≤ n, 0 ≤ w i) (h : ∀ i ≤ n, ∀ k, k ∉ S i → f k ≤ w i) : + spectrumTail (S 0) f ≤ (∑ i ∈ Finset.range n, (S (i + 1)).card * w i) + + Fintype.card K * w n := by + have hs := spectrumTail_levels (fun i => S (min i n)) f hf (fun i => w (min i n)) + (fun i => hw _ (Nat.min_le_right i n)) (fun i => h _ (Nat.min_le_right i n)) n + simp only [Nat.zero_min, Nat.min_self] at hs + have heq : (∑ i ∈ Finset.range n, (S (min (i + 1) n)).card * w (min i n)) = + ∑ i ∈ Finset.range n, (S (i + 1)).card * w i := by + apply Finset.sum_congr rfl + intro i hi + have hi' := Finset.mem_range.mp hi + rw [Nat.min_eq_left (by omega : i + 1 ≤ n), Nat.min_eq_left (by omega : i ≤ n)] + rwa [heq] at hs + +theorem spectrumTail_finite_geometric {K : Type*} [Fintype K] [DecidableEq K] + (S : ℕ → Finset K) (f : K → ℝ) (hf : ∀ k, 0 ≤ f k) (w : ℕ → ℝ) (n : ℕ) + (hw : ∀ i ≤ n, 0 ≤ w i) (h : ∀ i ≤ n, ∀ k, k ∉ S i → f k ≤ w i) + {C : ℝ} (hC : 0 ≤ C) + (hlevel : ∀ i < n, (S (i + 1)).card * w i ≤ C * (1 / 2 : ℝ) ^ i) : + spectrumTail (S 0) f ≤ 2 * C + Fintype.card K * w n := by + apply (spectrumTail_finite_levels S f hf w n hw h).trans + refine add_le_add ?_ le_rfl + calc + _ ≤ ∑ i ∈ Finset.range n, C * (1 / 2 : ℝ) ^ i := + Finset.sum_le_sum (fun i hi => hlevel i (Finset.mem_range.mp hi)) + _ = C * ∑ i ∈ Finset.range n, (1 / 2 : ℝ) ^ i := (Finset.mul_sum _ _ _).symm + _ ≤ C * 2 := mul_le_mul_of_nonneg_left (sum_geometric_two_le n) hC + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FixedPrincipalCoefficientSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FixedPrincipalCoefficientSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..94c738dfad8ccb2587d66e9b1e07295fc57f54b5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FixedPrincipalCoefficientSpectrum.lean @@ -0,0 +1,631 @@ +import OAI.Combinatorics.Progressions.Estimates.FixedPositiveCoefficientSource +import OAI.Combinatorics.Progressions.Geometry.PrincipalCoefficientPositiveSupport + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedPositiveModerateGridCoefficient_mem_polynomial {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (c : NormalizedScalarCubeSource Empty) + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hpositive : ∀ z, c.source.weight z ≠ 0 → (c.length : ℝ) / 4 ≤ (z none : ℝ)) + (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, positiveModerateLengthConstant n U / ζ ^ positiveModerateLengthExponent n ≤ + (s j).length) + {M : ℕ} (hM : 0 < M) + (hscale : (M : ℝ) / ((c.length : ℝ) * ∏ j, ((s j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (k : J → Fin M) (hk : ζ ≤ ‖weightedModerateGridCoefficient c s 0 M J k‖) : + k ∈ polynomialGridCover J M (positiveModerateCoverConstant n J.card U V) + (positiveModerateCoverExponent n J.card) ζ := by + have hU := hc.one_le + have hU0 : 0 ≤ U := (by norm_num : (0 : ℝ) ≤ 1).trans hU + have hLc : 0 < (c.length : ℝ) := Nat.cast_pos.mpr c.length_pos + have hP : 0 < ∏ j, ((s j).length : ℝ) := + Finset.prod_pos (fun j _ => Nat.cast_pos.mpr (s j).length_pos) + have hlength := positiveModerateLengthBudget_bounds n hU hζ hζ1 + have hcover := positiveModerateCoverBudget_bounds n J.card hU hV hζ hζ1 + by_cases hlong : majorArcLengthConstant (n + 1) U / ζ ^ majorArcLengthExponent (n + 1) ≤ + (c.length : ℝ) + · have hm : (c.modulus none : ℝ) ≤ U := + (by exact_mod_cast c.modulus_le none : (c.modulus none : ℝ) ≤ c.modulusBound).trans + hc.modulus_le + have hm1 : (1 : ℝ) ≤ c.modulus none := by exact_mod_cast c.modulus_pos none + have hden : (c.length : ℝ) * ∏ j, ((s j).length : ℝ) ≤ + ((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ) := by + exact mul_le_mul_of_nonneg_right + (by simpa only [one_mul] using mul_le_mul_of_nonneg_right hm1 hLc.le) hP.le + have hscale' : (M : ℝ) / + (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) ≤ V := + (div_le_div_of_nonneg_left (Nat.cast_nonneg M) (mul_pos hLc hP) hden).trans hscale + have hq := (localizedMajorArcBudget_pos (n + 1) hU hζ).le + have hd : (localizedMajorArcBudget (n + 1) U ζ * + ((c.modulus none : ℝ) * U ^ (n + 1))) ^ J.card ≤ + (localizedMajorArcBudget (n + 1) U ζ * U ^ (n + 1 + 1)) ^ J.card := by + apply pow_le_pow_left₀ (by positivity) + apply mul_le_mul_of_nonneg_left _ hq + rw [pow_succ' U (n + 1)] + exact mul_le_mul_of_nonneg_right hm (pow_nonneg hU0 _) + apply weightedModerateGridCoefficient_mem_major c s A hA hc h hζ hζ1 + ((localizedMajorArcLengthBudget_le_power (n + 1) hU hζ hζ1).trans hlong) + (fun j => (localizedMajorArcLengthBudget_le_power (n + 1) hU hζ hζ1).trans + (hlength.2.trans (hlen j))) 0 hM J hJ + · exact (hd.trans (majorArc_denominator_le_cover (n + 1) J.card hU hV hζ hζ1)).trans + (hcover.2.1.trans (Nat.le_ceil _)) + · exact (majorArc_scaled_error_le_cover (n + 1) J.card hU hV hζ hζ1 hscale').trans + (hcover.2.1.trans (Nat.le_ceil _)) + · exact hk + · have hV4 : 0 ≤ 4 * V := by positivity + have hbias : ζ ≤ ‖c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => CircleFourier.character (((z none : ℝ) * + booleanBlockPhase (gridJetFrequency M J k) (fun j i => (x j i : ℝ)) : ℝ) : + CircleFourier.Circle)))‖ := by + simpa only [weightedModerateGridCoefficient, zero_add] using hk + obtain ⟨D, hD, hDb, a, ha⟩ := weighted_positiveCoefficient_major_arc (T := (c.length : ℝ)) c.source + (fun z => (z none : ℤ)) s A hA h hζ hζ1 (show 0 < (c.length : ℝ) / 4 by positivity) + (fun z hz => ⟨hpositive z hz, by + exact_mod_cast (Finset.mem_Ico.mp (z none).property).2.le⟩) + (fun j => (localizedMajorArcLengthBudget_le_power n hU hζ hζ1).trans + (hlength.1.trans (hlen j))) (gridJetFrequency M J k) J hJ hbias + have hraw : 0 ≤ (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card := by + have := (localizedMajorArcBudget_pos n hU hζ).le + positivity + have hupper : 0 ≤ majorArcLengthConstant (n + 1) U / + ζ ^ majorArcLengthExponent (n + 1) := by + have := (majorArcLengthConstant_pos (n + 1) hU).le + positivity + have hDQ : (D : ℝ) ≤ positiveModerateCoverConstant n J.card U V / + ζ ^ positiveModerateCoverExponent n J.card := hDb.trans + ((mul_le_mul (lt_of_not_ge hlong).le + (majorArc_denominator_le_cover n J.card hU hV4 hζ hζ1) hraw hupper).trans + hcover.2.2) + have hscale' : (M : ℝ) / (((c.length : ℝ) / 4) * ∏ j, ((s j).length : ℝ)) ≤ + 4 * V := by + calc + _ = 4 * ((M : ℝ) / ((c.length : ℝ) * ∏ j, ((s j).length : ℝ))) := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left hscale (by norm_num) + apply mem_rationalGridMajorBox hM k hD + (by exact_mod_cast hDQ.trans (Nat.le_ceil _)) a + (fun S => by simpa only [gridJetFrequency_apply] using ha S) + exact (majorArc_scaled_error_le_cover n J.card hU hV4 hζ hζ1 hscale').trans + (hcover.1.trans (Nat.le_ceil _)) + +theorem weightedPositiveModerateGridCoefficient_minor_polynomial {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (c : NormalizedScalarCubeSource Empty) + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hpositive : ∀ z, c.source.weight z ≠ 0 → (c.length : ℝ) / 4 ≤ (z none : ℝ)) + (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, positiveModerateLengthConstant n U / ζ ^ positiveModerateLengthExponent n ≤ + (s j).length) + {M : ℕ} (hM : 0 < M) + (hscale : (M : ℝ) / ((c.length : ℝ) * ∏ j, ((s j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (k : J → Fin M) (hk : k ∉ polynomialGridCover J M (positiveModerateCoverConstant n J.card U V) + (positiveModerateCoverExponent n J.card) ζ) : + ‖weightedModerateGridCoefficient c s 0 M J k‖ ≤ ζ := by + exact le_of_lt (lt_of_not_ge (fun hh => hk + (weightedPositiveModerateGridCoefficient_mem_polynomial c s A hA hc h hpositive + hV hζ hζ1 hlen hM hscale J hJ k hh))) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +def positiveModerateSpectrumExponent (n j : ℕ) : ℕ := + 4 * positiveModerateCoverExponent n j * j + +noncomputable def positiveModerateSpectrumConstant (n j : ℕ) (U V : ℝ) : ℝ := + (195 * positiveModerateCoverConstant n j U V ^ 4) ^ j + +def positiveModerateSpectrumBlockCount (n j t : ℕ) : ℕ := + max (positiveModerateSpectrumExponent n j) (positiveModerateLengthExponent n * t) + 1 + +noncomputable def positiveModerateSpectrumCover (J : Type*) [Fintype J] [DecidableEq J] + (M n : ℕ) (U V L ζ : ℝ) : Finset (J → Fin M) := + lengthAwareSpectrumCover (positiveModerateLengthConstant n U) L (positiveModerateLengthExponent n) + (polynomialGridCover J M (positiveModerateCoverConstant n (Fintype.card J) U V) + (positiveModerateCoverExponent n (Fintype.card J))) ζ + +theorem positiveModerateSpectrumCover_card (J : Type*) [Fintype J] [DecidableEq J] + (M n t : ℕ) {U V W L ζ : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) : + ((positiveModerateSpectrumCover J M n U V L ζ).card : ℝ) ≤ + positiveModerateSpectrumConstant n (Fintype.card J) U V / + ζ ^ positiveModerateSpectrumExponent n (Fintype.card J) + + W * positiveModerateLengthConstant n U ^ t / ζ ^ (positiveModerateLengthExponent n * t) := by + apply lengthAwareSpectrumCover_card _ hL hW + (show 0 ≤ positiveModerateSpectrumConstant n (Fintype.card J) U V by + unfold positiveModerateSpectrumConstant; positivity) + (positiveModerateLengthConstant_pos n hU).le hζ + · simpa only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] using hsize + · exact polynomialGridCover_card J M _ (positiveModerateCoverConstant_one_le n _ hU hV) hζ hζ1 + +theorem exists_positiveModerateSpectrum_level (n j t : ℕ) {U V W ε : ℝ} + (hU : 1 ≤ U) (hW : 0 ≤ W) (hε : 0 < ε) : + ∃ ζ : ℝ, 0 < ζ ∧ ζ ≤ 1 ∧ + (2 * positiveModerateSpectrumConstant n j U V * 2 ^ positiveModerateSpectrumExponent n j + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ + ε := by + have hC := (positiveModerateLengthConstant_pos n hU).le + exact exists_spectrum_retained_level + (show 0 ≤ positiveModerateSpectrumConstant n j U V by + unfold positiveModerateSpectrumConstant; positivity) + (show 0 ≤ W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t by + positivity) hε (positiveModerateSpectrumExponent n j) + +theorem positiveModerateSpectrum_tail {B J : Type*} [Fintype B] [Fintype J] [DecidableEq J] + (M n t : ℕ) (coeff : B → (J → Fin M) → ℂ) {U V W L ζ ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hB : positiveModerateSpectrumBlockCount n (Fintype.card J) t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) + (hminor : ∀ δ, 0 < δ → δ ≤ 1 → + positiveModerateLengthConstant n U / δ ^ positiveModerateLengthExponent n ≤ L → + ∀ b k, k ∉ polynomialGridCover J M (positiveModerateCoverConstant n (Fintype.card J) U V) + (positiveModerateCoverExponent n (Fintype.card J)) δ → ‖coeff b k‖ ≤ δ) + (haccuracy : (2 * positiveModerateSpectrumConstant n (Fintype.card J) U V * + 2 ^ positiveModerateSpectrumExponent n (Fintype.card J) + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ ε) : + spectrumTail (positiveModerateSpectrumCover J M n U V L ζ) (fun k => ‖∏ b, coeff b k‖) ≤ ε := by + apply lengthAwareSpectrumCover_accuracy coeff _ (t := t) + (a := positiveModerateSpectrumExponent n (Fintype.card J)) + (positiveModerateLengthConstant_pos n hU) hL hW + (show 0 ≤ positiveModerateSpectrumConstant n (Fintype.card J) U V by + unfold positiveModerateSpectrumConstant; positivity) hζ hζ1 hε + (positiveModerateLengthExponent_pos n) + · unfold positiveModerateSpectrumBlockCount at hB; omega + · unfold positiveModerateSpectrumBlockCount at hB; omega + · simpa only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] using hsize + · intro δ hδ hδ1 + exact polynomialGridCover_card J M _ (positiveModerateCoverConstant_one_le n _ hU hV) hδ hδ1 + · exact hminor + · exact haccuracy + +theorem weightedPositiveModerate_uniform_spectrum_tail {B I : Type*} + [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} + (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} {t : ℕ} + (hU : 1 ≤ U) (hc : ∀ b, ScalarCubePrimitiveBudget (c b) A U) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hpositive : ∀ b z, (c b).source.weight z ≠ 0 → ((c b).length : ℝ) / 4 ≤ (z none : ℝ)) + (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hlen : ∀ b j, L ≤ (s b j).length) + {M : ℕ} (hM : 0 < M) + (hscale : ∀ b, (M : ℝ) / (((c b).length : ℝ) * ∏ j, ((s b j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : positiveModerateSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant n J.card U V * + 2 ^ positiveModerateSpectrumExponent n J.card + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ ε) : + spectrumTail (positiveModerateSpectrumCover J M n U V L ζ) + (fun k => ‖∏ b, weightedModerateGridCoefficient (c b) (s b) 0 M J k‖) ≤ ε := by + refine positiveModerateSpectrum_tail M n t + (fun b k => weightedModerateGridCoefficient (c b) (s b) 0 M J k) hU hV hW hL hζ hζ1 hε + (by simpa only [Fintype.card_coe] using hB) + (by simpa only [Fintype.card_coe] using hsize) ?_ + (by simpa only [Fintype.card_coe] using haccuracy) + intro δ hδ hδ1 hstart b k hk + apply weightedPositiveModerateGridCoefficient_minor_polynomial (c b) (s b) A hA + (hc b) (h b) (hpositive b) hV hδ hδ1 (fun j => hstart.trans (hlen b j)) + hM (hscale b) J hJ k + simpa only [Fintype.card_coe] using hk + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedPositiveAffineModerate_uniform_spectrum_tail {B I : Type*} + [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} + (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} {t : ℕ} + (hU : 1 ≤ U) (hc : ∀ b, ScalarCubePrimitiveBudget (c b) A U) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (u : B → Fin (n + 1) → Option I → ℝ) (v : B → Fin (n + 1) → Option I → ℕ) + (hv : ∀ b j i, 0 < v b j i) + (hstride : ∀ b j i, ((v b j i * (s b j).modulus i : ℕ) : ℝ) ≤ U) + (hpositive : ∀ b z, (c b).source.weight z ≠ 0 → ((c b).length : ℝ) / 4 ≤ (z none : ℝ)) + (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hlen : ∀ b j, L ≤ (s b j).length) + {M : ℕ} (hM : 0 < M) + (hscale : ∀ b, (M : ℝ) / (((c b).length : ℝ) * ∏ j, ((s b j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : positiveModerateSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant n J.card U V * + 2 ^ positiveModerateSpectrumExponent n J.card + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ ε) : + spectrumTail (positiveModerateSpectrumCover J M n U V L ζ) + (fun k => ‖∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (u b) (v b) 0 M J k‖) ≤ ε := by + refine positiveModerateSpectrum_tail M n t + (fun b k => weightedAffineModerateGridCoefficient (c b) (s b) (u b) (v b) 0 M J k) hU hV hW hL hζ hζ1 hε + (by simpa only [Fintype.card_coe] using hB) + (by simpa only [Fintype.card_coe] using hsize) ?_ + (by simpa only [Fintype.card_coe] using haccuracy) + intro δ hδ hδ1 hstart b k hk + apply weightedPositiveAffineModerateGridCoefficient_minor_polynomial (c b) (s b) A hA + (hc b) (h b) (u b) (v b) (hv b) (hstride b) (hpositive b) hV hδ hδ1 (fun j => hstart.trans (hlen b j)) + hM (hscale b) J hJ k + simpa only [Fintype.card_coe] using hk + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def positiveModerateAccuracyScale (n j t : ℕ) (U V W : ℝ) : ℝ := + 1 + (2 * positiveModerateSpectrumConstant n j U V * 2 ^ positiveModerateSpectrumExponent n j + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) + +noncomputable def positiveModerateRetainedBias (n j t : ℕ) (U V W ε : ℝ) : ℝ := + ε / positiveModerateAccuracyScale n j t U V W + +theorem positiveModerateAccuracyScale_one_le (n j t : ℕ) {U V W : ℝ} + (hU : 1 ≤ U) (hW : 0 ≤ W) : + 1 ≤ positiveModerateAccuracyScale n j t U V W := by + have hL := (positiveModerateLengthConstant_pos n hU).le + have hC : 0 ≤ positiveModerateSpectrumConstant n j U V := by + unfold positiveModerateSpectrumConstant + positivity + unfold positiveModerateAccuracyScale + exact le_add_of_nonneg_right (by positivity) + +theorem positiveModerateRetainedBias_spec (n j t : ℕ) {U V W ε : ℝ} + (hU : 1 ≤ U) (hW : 0 ≤ W) (hε : 0 < ε) (hε1 : ε ≤ 1) : + 0 < positiveModerateRetainedBias n j t U V W ε ∧ + positiveModerateRetainedBias n j t U V W ε ≤ 1 ∧ + (2 * positiveModerateSpectrumConstant n j U V * 2 ^ positiveModerateSpectrumExponent n j + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * + positiveModerateRetainedBias n j t U V W ε ≤ ε := by + have hD := positiveModerateAccuracyScale_one_le n j t (V := V) hU hW + have hD0 : 0 < positiveModerateAccuracyScale n j t U V W := lt_of_lt_of_le zero_lt_one hD + have hb : 0 < positiveModerateRetainedBias n j t U V W ε := div_pos hε hD0 + refine ⟨hb, (div_le_one hD0).mpr (hε1.trans hD), ?_⟩ + calc + _ ≤ positiveModerateAccuracyScale n j t U V W * + positiveModerateRetainedBias n j t U V W ε := by + apply mul_le_mul_of_nonneg_right _ hb.le + unfold positiveModerateAccuracyScale + linarith + _ = ε := by + unfold positiveModerateRetainedBias + field_simp + +noncomputable def positiveModerateSpectrumCardBudget (n j t : ℕ) (U V W ε : ℝ) : ℝ := + positiveModerateSpectrumConstant n j U V / + positiveModerateRetainedBias n j t U V W ε ^ positiveModerateSpectrumExponent n j + + W * positiveModerateLengthConstant n U ^ t / + positiveModerateRetainedBias n j t U V W ε ^ (positiveModerateLengthExponent n * t) + +theorem positiveModerateSpectrumCover_card_budget (J : Type*) [Fintype J] [DecidableEq J] + (M n t : ℕ) {U V W L ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hε : 0 < ε) (hε1 : ε ≤ 1) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) : + ((positiveModerateSpectrumCover J M n U V L + (positiveModerateRetainedBias n (Fintype.card J) t U V W ε)).card : ℝ) ≤ + positiveModerateSpectrumCardBudget n (Fintype.card J) t U V W ε := by + obtain ⟨hζ, hζ1, _⟩ := positiveModerateRetainedBias_spec n (Fintype.card J) t hU hW hε hε1 + exact positiveModerateSpectrumCover_card J M n t hU hV hW hL hζ hζ1 hsize + +theorem positiveModerateSpectrum_absolute_cap {B J : Type*} + [Fintype B] [Fintype J] [DecidableEq J] + (M n t : ℕ) (coeff : B → (J → Fin M) → ℂ) {U V W L : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) + (hunit : ∀ b k, ‖coeff b k‖ ≤ 1) + (htail : spectrumTail (positiveModerateSpectrumCover J M n U V L + (positiveModerateRetainedBias n (Fintype.card J) t U V W 1)) + (fun k => ‖∏ b, coeff b k‖) ≤ 1) : + (∑ k, ‖∏ b, coeff b k‖) ≤ + positiveModerateSpectrumCardBudget n (Fintype.card J) t U V W 1 + 1 := by + exact (product_spectrum_absolute_cap coeff _ hunit).trans + (add_le_add (positiveModerateSpectrumCover_card_budget J M n t hU hV hW hL + zero_lt_one le_rfl hsize) htail) + +theorem weightedPositiveModerateSpectrum_absolute_cap {B I : Type*} + [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} + (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (M t : ℕ) (J : Finset (Finset I)) {U V W L : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (htail : spectrumTail (positiveModerateSpectrumCover J M n U V L + (positiveModerateRetainedBias n J.card t U V W 1)) + (fun k => ‖∏ b, weightedModerateGridCoefficient (c b) (s b) 0 M J k‖) ≤ 1) : + (∑ k, ‖∏ b, weightedModerateGridCoefficient (c b) (s b) 0 M J k‖) ≤ + positiveModerateSpectrumCardBudget n J.card t U V W 1 + 1 := by + classical + have hc := positiveModerateSpectrum_absolute_cap M n t + (fun b k => weightedModerateGridCoefficient (c b) (s b) 0 M J k) + hU hV hW hL (by simpa only [Fintype.card_coe] using hsize) + (fun b k => weightedModerateGridCoefficient_norm_le_one (c b) (s b) 0 M J k) + (by simpa only [Fintype.card_coe] using htail) + simpa only [Fintype.card_coe] using hc + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedAffineModerateGridCoefficient_norm_le_one {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 → ℕ) + (shift : ℝ) (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : + ‖weightedAffineModerateGridCoefficient c s u v shift M J k‖ ≤ 1 := by + let p := FiniteProbabilityWeights.pi (fun j => (s j).source) + apply (c.source.norm_complexMean_le_mean_norm _).trans + apply (c.source.mean_mono (fun z => ?_)).trans_eq (c.source.mean_const 1) + exact (p.norm_complexMean_le_mean_norm _).trans_eq (by + simp only [CircleFourier.norm_character, p.mean_const]) + +theorem weightedPositiveAffineModerateSpectrum_absolute_cap {B I : Type*} + [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} + (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L : ℝ} {t : ℕ} + (hU : 1 ≤ U) (hc : ∀ b, ScalarCubePrimitiveBudget (c b) A U) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (u : B → Fin (n + 1) → Option I → ℝ) (v : B → Fin (n + 1) → Option I → ℕ) + (hv : ∀ b j i, 0 < v b j i) + (hstride : ∀ b j i, ((v b j i * (s b j).modulus i : ℕ) : ℝ) ≤ U) + (hpositive : ∀ b z, (c b).source.weight z ≠ 0 → ((c b).length : ℝ) / 4 ≤ (z none : ℝ)) + (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hlen : ∀ b j, L ≤ (s b j).length) + {M : ℕ} (hM : 0 < M) + (hscale : ∀ b, (M : ℝ) / (((c b).length : ℝ) * ∏ j, ((s b j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : positiveModerateSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + : + (∑ k, ‖∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (u b) (v b) 0 M J k‖) ≤ + positiveModerateSpectrumCardBudget n J.card t U V W 1 + 1 := by + obtain ⟨hζ,hζ1,hacc⟩ := positiveModerateRetainedBias_spec n J.card t (V := V) hU hW + (by norm_num : (0 : ℝ) < 1) le_rfl + have ht := weightedPositiveAffineModerate_uniform_spectrum_tail c s A hA hU hc h u v hv hstride + hpositive hV hW hL hζ hζ1 (by norm_num : (0 : ℝ) ≤ 1) hlen hM hscale J hJ hB hsize hacc + have he := positiveModerateSpectrum_absolute_cap M n t + (fun b k => weightedAffineModerateGridCoefficient (c b) (s b) (u b) (v b) 0 M J k) + hU hV hW hL (by simpa only [Fintype.card_coe] using hsize) + (fun b k => weightedAffineModerateGridCoefficient_norm_le_one (c b) (s b) (u b) (v b) 0 M J k) + (by simpa only [Fintype.card_coe] using ht) + simpa only [Fintype.card_coe] using he + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def positiveRetainedFrequencyBound (n d : ℕ) (U V ζ : ℝ) : ℝ := + (⌈positiveModerateCoverConstant n d U V / ζ ^ positiveModerateCoverExponent n d⌉₊ : ℝ) + +noncomputable def positiveRetainedDenominatorBound (n d t : ℕ) (U V W ζ : ℝ) : ℝ := + max ((positiveRetainedFrequencyBound n d U V ζ + 1) ^ d) + (W * positiveModerateLengthConstant n U ^ t / ζ ^ (positiveModerateLengthExponent n * t)) + +theorem positiveRetainedFrequencyBound_nonneg (n d : ℕ) (U V ζ : ℝ) : + 0 ≤ positiveRetainedFrequencyBound n d U V ζ := Nat.cast_nonneg _ + +theorem positiveRetainedDenominatorBound_one_le (n d t : ℕ) (U V W ζ : ℝ) : + 1 ≤ positiveRetainedDenominatorBound n d t U V W ζ := by + apply (one_le_pow₀ (show 1 ≤ positiveRetainedFrequencyBound n d U V ζ + 1 by + linarith [positiveRetainedFrequencyBound_nonneg n d U V ζ])).trans + exact le_max_left _ _ + +theorem positiveModerateSpectrumCover_character {J : Type*} [Fintype J] [DecidableEq J] + {K M : ℕ} (hK : 0 < K) (hKM : K ≤ M) (n t : ℕ) {U V W L ζ : ℝ} + (hL : 0 ≤ L) (hW : 0 ≤ W) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) + (k : J → Fin M) (hk : k ∈ positiveModerateSpectrumCover J M n U V L ζ) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ positiveRetainedDenominatorBound n (Fintype.card J) t U V W ζ ∧ + ∃ (a : J → ℤ) (ω : J → ℝ), + (∀ j, |ω j| ≤ positiveRetainedFrequencyBound n (Fintype.card J) U V ζ) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ω j / K := + lengthAwarePolynomialGrid_character hK hKM hL hW hsize k hk + +theorem positiveModerateSpectrumCover_modes {J : Type*} [Fintype J] [DecidableEq J] + {K M : ℕ} (hK : 0 < K) (hKM : K ≤ M) (n t : ℕ) {U V W L ζ : ℝ} + (hL : 0 ≤ L) (hW : 0 ≤ W) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) : + ∃ (D : (J → Fin M) → ℕ) (a : (J → Fin M) → J → ℤ) (ω : (J → Fin M) → J → ℝ), + (∀ k, 0 < D k) ∧ ∀ k ∈ positiveModerateSpectrumCover J M n U V L ζ, + (D k : ℝ) ≤ positiveRetainedDenominatorBound n (Fintype.card J) t U V W ζ ∧ + (∀ j, |ω k j| ≤ positiveRetainedFrequencyBound n (Fintype.card J) U V ζ) ∧ + ∀ j, ((k j).val : ℝ) / M = (a k j : ℝ) / D k + ω k j / K := by + classical + have hex (k : J → Fin M) : ∃ D : ℕ, 0 < D ∧ ∃ (a : J → ℤ) (ω : J → ℝ), + k ∈ positiveModerateSpectrumCover J M n U V L ζ → + (D : ℝ) ≤ positiveRetainedDenominatorBound n (Fintype.card J) t U V W ζ ∧ + (∀ j, |ω j| ≤ positiveRetainedFrequencyBound n (Fintype.card J) U V ζ) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ω j / K := by + by_cases hk : k ∈ positiveModerateSpectrumCover J M n U V L ζ + · obtain ⟨D, hD, hb, a, ω, hω, he⟩ := + positiveModerateSpectrumCover_character hK hKM n t hL hW hsize k hk + exact ⟨D, hD, a, ω, fun _ => ⟨hb, hω, he⟩⟩ + · exact ⟨1, Nat.zero_lt_one, 0, 0, fun h => (hk h).elim⟩ + choose D hD a ω h using hex + exact ⟨D, a, ω, hD, h⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem positiveCoefficientSource_toNat_spec (c : NormalizedScalarCubeSource Empty) + (hpositive : ∀ z, c.source.weight z ≠ 0 → (c.length : ℝ) / 4 ≤ (z none : ℝ)) + (z : IntegerScalarCubeBox Empty c.length) (hz : c.source.weight z ≠ 0) : + 0 < (z none : ℤ).toNat ∧ ((z none : ℤ).toNat : ℤ) = (z none : ℤ) ∧ + (z none : ℤ).toNat < c.length := by + have hlen : (0 : ℝ) < c.length := by exact_mod_cast c.length_pos + have hzR : (0 : ℝ) < (z none : ℝ) := lt_of_lt_of_le (by positivity) (hpositive z hz) + have hzZ : (0 : ℤ) < (z none : ℤ) := by exact_mod_cast hzR + have hupper := (Finset.mem_Ico.mp (z none).property).2 + exact ⟨by omega, Int.toNat_of_nonneg hzZ.le, by omega⟩ + +theorem positiveCoefficientSource_fixed_mixture (c : NormalizedScalarCubeSource Empty) + (hpositive : ∀ z, c.source.weight z ≠ 0 → (c.length : ℝ) / 4 ≤ (z none : ℝ)) + (F : IntegerScalarCubeBox Empty c.length → ℤ → ℂ) : + c.source.complexMean (fun z => + (fixedPositiveCoefficientSource (z none : ℤ).toNat).source.complexMean + (fun x => F z (x none : ℤ))) = + c.source.complexMean (fun z => F z (z none : ℤ)) := by + simp_rw [fixedPositiveCoefficientSource_complexMean] + unfold FiniteProbabilityWeights.complexMean + apply Finset.sum_congr rfl + intro z _ + by_cases hz : c.source.weight z = 0 + · simp only [hz, Complex.ofReal_zero, zero_mul] + · dsimp only + rw [(positiveCoefficientSource_toNat_spec c hpositive z hz).2.1] + +theorem principalNormalizedSource_fixed_mixture {K T γ : ℝ} + (hK : 0 < K) (hT : 0 < T) (hγ : 0 < γ) + (hlarge : 8 * (probabilityProfileLipschitz : ℝ) ≤ (γ / 2) * (K / T)) + (F : IntegerScalarCubeBox Empty (principalNormalizedSource hK hT hγ hlarge).length → + ℤ → ℂ) : + (principalNormalizedSource hK hT hγ hlarge).source.complexMean (fun z => + (fixedPositiveCoefficientSource (z none : ℤ).toNat).source.complexMean + (fun x => F z (x none : ℤ))) = + (principalNormalizedSource hK hT hγ hlarge).source.complexMean + (fun z => F z (z none : ℤ)) := + positiveCoefficientSource_fixed_mixture _ + (principalNormalizedSource_positive_support hK hT hγ hlarge) F + +theorem positiveCoefficientSource_fixed_primitive (c : NormalizedScalarCubeSource Empty) + {N : ℕ} (hshort : c.length ≤ N) (A : ℝ≥0) + (z : IntegerScalarCubeBox Empty c.length) : + ScalarCubePrimitiveBudget (fixedPositiveCoefficientSource (z none : ℤ).toNat) A + (scalarCubePrimitiveEnvelope Empty A 1 0 (N + 1)) := by + apply fixedPositiveCoefficientSource_primitive_of_le + have hu := (Finset.mem_Ico.mp (z none).property).2 + omega + +theorem positiveCoefficientSource_fixed_scale (c : NormalizedScalarCubeSource Empty) + (hpositive : ∀ z, c.source.weight z ≠ 0 → (c.length : ℝ) / 4 ≤ (z none : ℝ)) + (z : IntegerScalarCubeBox Empty c.length) (hz : c.source.weight z ≠ 0) + {M P V : ℝ} (hP : 0 < P) (hV : 0 ≤ V) + (hscale : M / ((c.length : ℝ) * P) ≤ V) : + M / (((fixedPositiveCoefficientSource (z none : ℤ).toNat).length : ℝ) * P) ≤ + 4 * V := by + have hlen : (0 : ℝ) < c.length := by exact_mod_cast c.length_pos + have heZ := (positiveCoefficientSource_toNat_spec c hpositive z hz).2.1 + have heR : ((z none : ℤ).toNat : ℝ) = (z none : ℝ) := by exact_mod_cast heZ + have hquarter := hpositive z hz + have hlenle : (c.length : ℝ) ≤ + 4 * ((fixedPositiveCoefficientSource (z none : ℤ).toNat).length : ℝ) := by + simp only [fixedPositiveCoefficientSource_length, Nat.cast_add, Nat.cast_one] + linarith + have hscale' := (div_le_iff₀ (mul_pos hlen hP)).mp hscale + apply (div_le_iff₀ (mul_pos (by exact_mod_cast + (fixedPositiveCoefficientSource (z none : ℤ).toNat).length_pos) hP)).mpr + have hbound := mul_le_mul_of_nonneg_left hlenle (mul_nonneg hV hP.le) + nlinarith + +theorem fixedPositiveCoefficientSource_gridCoefficient {I : Type*} + [Fintype I] [DecidableEq I] {n : ℕ} (a : ℕ) + (s : Fin n → NormalizedScalarCubeSource I) (shift : ℝ) (M : ℕ) + (J : Finset (Finset I)) (k : J → Fin M) : + weightedModerateGridCoefficient (fixedPositiveCoefficientSource a) s shift M J k = + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => CircleFourier.character + (((shift + (a : ℝ)) * booleanBlockPhase (gridJetFrequency M J k) + (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle)) := by + have he := fixedPositiveCoefficientSource_complexMean a + (fun z => (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => CircleFourier.character + (((shift + (z : ℝ)) * booleanBlockPhase (gridJetFrequency M J k) + (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle))) + simpa only [weightedModerateGridCoefficient, Int.cast_natCast] using he + +theorem fixedPositiveCoefficientSource_uniform_spectrum_tail + {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] {n N : ℕ} + (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (z : ∀ b, IntegerScalarCubeBox Empty (c b).length) + (hz : ∀ b, (c b).source.weight (z b) ≠ 0) + (hpositive : ∀ b u, (c b).source.weight u ≠ 0 → + ((c b).length : ℝ) / 4 ≤ (u none : ℝ)) + (hshort : ∀ b, (c b).length ≤ N) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} {t : ℕ} + (hU : 1 ≤ U) (hbudget : scalarCubePrimitiveEnvelope Empty A 1 0 (N + 1) ≤ U) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hlen : ∀ b j, L ≤ (s b j).length) + {M : ℕ} (hM : 0 < M) + (hscale : ∀ b, (M : ℝ) / (((c b).length : ℝ) * + ∏ j, ((s b j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : positiveModerateSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant n J.card U (4 * V) * + 2 ^ positiveModerateSpectrumExponent n J.card + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ ε) : + spectrumTail (positiveModerateSpectrumCover J M n U (4 * V) L ζ) + (fun k => ‖∏ b, (FiniteProbabilityWeights.pi (fun j => (s b j).source)).complexMean + (fun x => CircleFourier.character + (((z b none : ℝ) * booleanBlockPhase (gridJetFrequency M J k) + (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle))‖) ≤ ε := by + have hfixed := weightedPositiveModerate_uniform_spectrum_tail + (fun b => fixedPositiveCoefficientSource (z b none : ℤ).toNat) s A hA hU + (fun b => (positiveCoefficientSource_fixed_primitive (c b) (hshort b) A (z b)).mono hbudget) + h (fun b u hu => fixedPositiveCoefficientSource_positive _ + (positiveCoefficientSource_toNat_spec (c b) (hpositive b) (z b) (hz b)).1 u hu) + (show 0 ≤ 4 * V by positivity) hW hL hζ hζ1 hε hlen hM + (fun b => positiveCoefficientSource_fixed_scale (c b) (hpositive b) (z b) (hz b) + (Finset.prod_pos (fun j _ => by exact_mod_cast (s b j).length_pos)) hV (hscale b)) + J hJ hB hsize haccuracy + have hvalue (b : B) : ((z b none : ℤ).toNat : ℝ) = (z b none : ℝ) := by + exact_mod_cast (positiveCoefficientSource_toNat_spec (c b) (hpositive b) (z b) (hz b)).2.1 + simpa only [fixedPositiveCoefficientSource_gridCoefficient, zero_add, hvalue] using hfixed + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveCharacterSite.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveCharacterSite.lean new file mode 100644 index 0000000000000000000000000000000000000000..423a5a0e04d73a53c4947072256420c509947797 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveCharacterSite.lean @@ -0,0 +1,345 @@ +import OAI.Combinatorics.Progressions.Sampling.ForecastInactiveFixedPhysical + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {A J K H : Type*} [Fintype A] [DecidableEq A] + [Fintype J] [DecidableEq J] + +noncomputable def forecastInactiveCharacterCoefficient + (poly : J → MvPolynomial (A ⊕ (K × H)) ℤ) (N : ℕ) [NeZero N] + (p : FiniteProbabilityWeights (A → ZMod N)) (χ : AddChar (J → ZMod N) ℂ) + (r : K → H → ZMod (orderOf χ)) : ℂ := + finiteImageCharacteristic p + (fun t j => (integerLongPolynomialOutput poly + (fun k => ((r k.1 k.2).val : ℤ)) N t j : ZMod N)) χ + +theorem forecastInactiveCharacterCoefficient_norm_le + (poly : J → MvPolynomial (A ⊕ (K × H)) ℤ) (N : ℕ) [NeZero N] + (p : FiniteProbabilityWeights (A → ZMod N)) (χ : AddChar (J → ZMod N) ℂ) + (r : K → H → ZMod (orderOf χ)) : + ‖forecastInactiveCharacterCoefficient poly N p χ r‖ ≤ 1 := + finiteImageCharacteristic_norm_le_one p _ χ + +theorem forecastInactiveCharacterCoefficient_eq + (poly : J → MvPolynomial (A ⊕ (K × H)) ℤ) (N : ℕ) [NeZero N] + (p : FiniteProbabilityWeights (A → ZMod N)) (χ : AddChar (J → ZMod N) ℂ) + (v : K → H → ℤ) : + finiteImageCharacteristic p + (fun t j => (integerLongPolynomialOutput poly (fun k => v k.1 k.2) N t j : ZMod N)) χ = + forecastInactiveCharacterCoefficient poly N p χ + (fun k h => (v k h : ZMod (orderOf χ))) := + integerLongPolynomial_characteristic_residue_representative poly N p χ + (fun k => v k.1 k.2) + +theorem forecastInactiveCharacterCoefficient_mean_indicator + {Ω Z : Type*} [Fintype Ω] + (μ : FiniteProbabilityWeights Ω) (v : Ω → K → H → ℤ) + (F : Ω → Z) (z : Z) + (poly : J → MvPolynomial (A ⊕ (K × H)) ℤ) (N : ℕ) [NeZero N] + (p : FiniteProbabilityWeights (A → ZMod N)) (χ : AddChar (J → ZMod N) ℂ) : + μ.complexMean (fun y => + finiteImageCharacteristic p + (fun t j => (integerLongPolynomialOutput poly (fun k => v y k.1 k.2) N t j : ZMod N)) χ * + (if F y = z then (1 : ℂ) else 0)) = + μ.complexMean (fun y => + forecastInactiveCharacterCoefficient poly N p χ + (fun k h => (v y k h : ZMod (orderOf χ))) * + (if F y = z then (1 : ℂ) else 0)) := by + congr 1 + funext y + rw [forecastInactiveCharacterCoefficient_eq] + +section Principal + +variable {D α : Type*} {B : D → Type*} {h : D → ℕ} + {L : PrincipalTupleIndex B h → ℕ} + +theorem forecastInactive_principal_characteristic_residue + (poly : J → MvPolynomial (A ⊕ (PrincipalTupleIndex B h × Option α)) ℤ) + (N : ℕ) [NeZero N] (p : FiniteProbabilityWeights (A → ZMod N)) + (χ : AddChar (J → ZMod N) ℂ) (y : PrincipalIntegerTuples B h α L) : + finiteImageCharacteristic p + (fun t j => (integerLongPolynomialOutput poly + (fun k => (y k.1 k.2 : ℤ)) N t j : ZMod N)) χ = + forecastInactiveCharacterCoefficient poly N p χ (principalResidueLabel (orderOf χ) y) := + forecastInactiveCharacterCoefficient_eq poly N p χ (fun k h => (y k h : ℤ)) + +variable [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] + [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] + +theorem forecastInactive_principal_characteristic_mean_indicator + (hL : ∀ k, 0 < L k) {Z : Type*} + (F : PrincipalIntegerTuples B h α L → Z) (z : Z) + (poly : J → MvPolynomial (A ⊕ (PrincipalTupleIndex B h × Option α)) ℤ) + (N : ℕ) [NeZero N] (p : FiniteProbabilityWeights (A → ZMod N)) + (χ : AddChar (J → ZMod N) ℂ) : + (principalTupleWeights B h L hL).complexMean (fun y => + finiteImageCharacteristic p + (fun t j => (integerLongPolynomialOutput poly + (fun k => (y k.1 k.2 : ℤ)) N t j : ZMod N)) χ * + (if F y = z then (1 : ℂ) else 0)) = + (principalTupleWeights B h L hL).complexMean (fun y => + forecastInactiveCharacterCoefficient poly N p χ (principalResidueLabel (orderOf χ) y) * + (if F y = z then (1 : ℂ) else 0)) := + forecastInactiveCharacterCoefficient_mean_indicator + (principalTupleWeights B h L hL) (fun y k h => (y k h : ℤ)) F z poly N p χ + +end Principal + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {A J D α : Type*} [Fintype A] [DecidableEq A] + [Fintype J] [DecidableEq J] + [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] +variable (B : D → Type*) [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] +variable (h : D → ℕ) + +theorem forecastInactive_principal_law_characteristic_mean_indicator + (L : PrincipalTupleIndex B h → ℕ) + (μ : FiniteProbabilityWeights (PrincipalIntegerTuples B h α L)) + {Z : Type*} (F : PrincipalIntegerTuples B h α L → Z) (z : Z) + (poly : J → MvPolynomial (A ⊕ (PrincipalTupleIndex B h × Option α)) ℤ) + (N : ℕ) [NeZero N] (p : FiniteProbabilityWeights (A → ZMod N)) + (χ : AddChar (J → ZMod N) ℂ) : + μ.complexMean (fun y => + finiteImageCharacteristic p + (fun t j => (integerLongPolynomialOutput poly + (fun k => (y k.1 k.2 : ℤ)) N t j : ZMod N)) χ * + (if F y = z then (1 : ℂ) else 0)) = + μ.complexMean (fun y => + forecastInactiveCharacterCoefficient poly N p χ (principalResidueLabel (orderOf χ) y) * + (if F y = z then (1 : ℂ) else 0)) := + forecastInactiveCharacterCoefficient_mean_indicator μ (fun y k a => (y k a : ℤ)) F z poly N p χ + +theorem forecastInactive_sliced_characteristic_mean_indicator + (L H step : PrincipalTupleIndex B h → ℕ) + (lower : PrincipalTupleIndex B h → ℤ) + (hL : ∀ j, 0 < L j) (hH : ∀ j, 0 < H j) + (hsubset : ∀ j, integerProgressionSupport (lower j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (L j : ℤ)) + {Z : Type*} (F : PrincipalIntegerTuples B h α L → Z) (z : Z) + (poly : J → MvPolynomial (A ⊕ (PrincipalTupleIndex B h × Option α)) ℤ) + (N : ℕ) [NeZero N] (p : FiniteProbabilityWeights (A → ZMod N)) + (χ : AddChar (J → ZMod N) ℂ) : + let child := principalTupleWeights (α := α) B h H hH + let map := containedProgressionTupleMap B h L H step lower hL hsubset + (child.fiberLaw map).complexMean (fun y => + finiteImageCharacteristic p + (fun t j => (integerLongPolynomialOutput poly + (fun k => (y k.1 k.2 : ℤ)) N t j : ZMod N)) χ * + (if F y = z then (1 : ℂ) else 0)) = + child.complexMean (fun y => + forecastInactiveCharacterCoefficient poly N p χ + (progressionPrincipalResidue B h step lower (orderOf χ) + (principalResidueLabel (orderOf χ) y)) * + (if F (map y) = z then (1 : ℂ) else 0)) := by + intro child map + rw [forecastInactive_principal_law_characteristic_mean_indicator, + child.fiberLaw_complexMean] + unfold FiniteProbabilityWeights.complexMean + apply Finset.sum_congr rfl + intro y _ + by_cases hy : child.weight y = 0 + · simp only [hy, Complex.ofReal_zero, zero_mul] + · dsimp only [map] + rw [containedProgressionTupleMap_residue_of_weight_ne_zero B h L H step lower hL hH hsubset + (orderOf χ) y hy] + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory BooleanCubeKernel +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G X Zsp : Type*} [Fintype G] [Fintype X] [Fintype Zsp] [DecidableEq Zsp] +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 → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (S : LayerSamplerScale (G := G) B U basis R σ) + +local notation "short" => allocatedShortAxis (I := I) U basis S.value +local notation "Active" => {a : LayerSamplerAxis I n // ¬short a} +local notation "degree" => layerSamplerDegree I n +local notation "activeB" => (fun a : Active => B (Subtype.val a)) +local notation "activeDegree" => (fun a : Active => degree (Subtype.val a)) +local notation "Input" => PrincipalTupleIndex activeB activeDegree +local notation "Output" => (Σ _a : Active, Unit) +local notation "Sample" => CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n +local notation "noise" => allocatedSampleRestrictedProfileNoise B U basis S short + +local notation "sides" => allocatedPrincipalSides B U basis S +local notation "hSides" => allocatedPrincipalSides_pos B U basis S +local notation "ShortTuple" => PrincipalAxisTuples (α := Empty) short sides +local notation "FullInput" => PrincipalTupleIndex B degree +local notation "Original" => PrincipalIntegerTuples B degree Empty sides +local notation "Domain" => (((Σ _ : X, Unit ⊕ Empty) → ℝ) × (Output → ℝ)) + +local instance {Out : Type*} [Fintype Out] [DecidableEq Out] + (N : ℕ) [NeZero N] (χ : AddChar (Out → ZMod N) ℂ) : NeZero (orderOf χ) := + ⟨(isOfFinOrder_of_finite χ).orderOf_pos.ne'⟩ + +theorem allocatedOriginalSample_character_forecast_comparison + (s : Empty ↪ Zsp) (root : Zsp → ℤ) (D : Matrix Empty Zsp ℤ) + (hp : (selectedSpatialPivot root D s).det ≠ 0) + {W L : ℝ} (hW : 0 ≤ W) (hL : 0 < L) + (hB : ∀ a : Active, 4 ≤ Fintype.card (B a.val)) + (hroot : ∀ j, |(root j : ℝ)| ≤ 1 + W) + (sample : Sample) + (hs : ∀ j, mixedArraySupported (allocatedLayerCenters B U basis S j) + (allocatedLayerWidths B U basis S j) + (allocatedLayerIntegerPMFs B U basis hR hσ S j) (sample j)) + (hS : 2 ≤ S.value) + {V Out : Type*} [Fintype V] [DecidableEq V] [Fintype Out] [DecidableEq Out] + (poly : Out → MvPolynomial (V ⊕ (FullInput × Option Empty)) ℤ) + (N : ℕ) [NeZero N] (pRat : FiniteProbabilityWeights (V → ZMod N)) + (χ : AddChar (Out → ZMod N) ℂ) + (hsize : orderOf χ ≤ S.value) + (hsmall : scalarCubeGridBoundaryConstant Empty * ((orderOf χ : ℝ) / S.value) < 1) + (φ : (FullInput → Option Empty → ZMod (orderOf χ)) → ShortTuple → Domain → ℂ) + {Kφ : ℝ≥0} (hφ : ∀ r u, LipschitzWith Kφ (φ r u)) + (hφone : ∀ r u y, ‖φ r u y‖ ≤ 1) : + let lower := fun (_a : Active) (_p : B _a.val × Fin (degree _a.val)) => (0 : ℝ) + let width := fun (_a : Active) (_p : B _a.val × Fin (degree _a.val)) => + ((S.value : ℝ) - 1) / S.value + let K := Kφ * allocatedOriginalSampleLiftLip B U basis S + let law := principalTupleWeights (α := Empty) B degree sides hSides + let Pos := {r : FullInput → Option Empty → ZMod (orderOf χ) // + 0 < law.mass (Finset.univ.filter (fun y => principalResidueLabel (orderOf χ) y = r))} + ‖(∫ z, law.complexMean (fun v => finiteImageCharacteristic pRat + (fun t o => (integerLongPolynomialOutput poly (fun k => (v k.1 k.2 : ℤ)) N t o : ZMod N)) χ * + φ (principalResidueLabel (orderOf χ) v) (principalAxisRestrict short v) + (z, allocatedOriginalSampleLiftMap B U basis S (fun _ _ => 0) (fun _ _ => 1) + sample (fun j => (((principalAxisRestrict (fun a => ¬short a) v) j none : ℤ) : ℝ) / S.value))) + ∂canonicalZeroSpatialLaw (X := X) s root D W L) - + ∑ r : Pos, (law.mass (Finset.univ.filter (fun y => principalResidueLabel (orderOf χ) y = r.val)) : ℂ) * + forecastInactiveCharacterCoefficient poly N pRat χ r.val * (allocatedShortPrincipalResidueLaw B U basis S (orderOf χ) r.val r.property).complexMean + (fun u => ∫ y, φ r.val u y ∂realDensityMeasure volume (allocatedOriginalSampleForecastDensity (X := X) + B U basis S s root D hp hW hL hB lower width sample))‖ ≤ + 2 * ((2 * scalarCubeGridBoundaryConstant Empty + K * 2) * + ∑ _j : Input, ((orderOf χ) : ℝ) / S.value + K * (1 / S.value)) := by + classical + simpa only [forecastInactive_principal_characteristic_residue] using + allocatedOriginalSample_residue_mixture_forecast_comparison + B U basis hR hσ S s root D hp hW hL hB hroot sample hs hS (orderOf χ) hsize hsmall + (forecastInactiveCharacterCoefficient poly N pRat χ) + (forecastInactiveCharacterCoefficient_norm_le poly N pRat χ) φ hφ hφone + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] +variable {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {A : Type*} [Fintype A] + +attribute [local instance] ScalarSiteExpansion.termFinite +variable {V Out : Type*} [Fintype V] [DecidableEq V] [Fintype Out] [DecidableEq Out] + +local instance (N : ℕ) [NeZero N] (χ : AddChar (Out → ZMod N) ℂ) : NeZero (orderOf χ) := + ⟨(isOfFinOrder_of_finite χ).orderOf_pos.ne'⟩ + +theorem exists_forecastInactive_character_physical_site + (selected : A → Σ j : Fin m, Fin (n j)) + (hselected : Function.Injective selected) + [∀ a, Nonempty (B ⟨(selected a).1, Sum.inr (selected a).2⟩)] + (poly : Out → MvPolynomial (V ⊕ (PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty)) ℤ) + (N : ℕ) [NeZero N] (pRat : FiniteProbabilityWeights (V → ZMod N)) + (χ : AddChar (Out → ZMod N) ℂ) + {D P p v δ E : ℝ} + (hD : AllocatedComparisonDimensions (G := G) B Empty + (fun _ : Fin m => ((Finset.univ : Finset (Finset Empty)) : Type)) D) + (hP : 1 ≤ P) (hp : 0 ≤ p) (hv : 0 ≤ v) + (hPp : P ≤ Real.exp p) (hqv : ((orderOf χ) : ℝ) ≤ Real.exp v) + (hδ : 0 < δ) (hE : 0 ≤ E) + (hδE : δ⁻¹ ≤ Real.exp E) + (hsize : (orderOf χ) ≤ S.value) (hR1 : ∀ a, R (selected a).1 ≤ 1) + (hsmall : ∀ a, basisAxisScale (b (selected a).1) (selected a).2 ≤ + S.value ^ ((selected a).1.val + 1)) + (hgrid : ∀ a, allocatedGridAxis (I := I) U b S.value + ⟨(selected a).1, Sum.inr (selected a).2⟩) + (c : ∀ a, BoundedCoefficientExponent (LayerSamplerVariables G I n B) + ((selected a).1.val + 1) → ℤ) + (hc : ∀ a d, c a d ∈ (allocatedLayerIntegerPMFs B U b hR hσ S + (selected a).1 (selected a).2 d).support) + (hσ1 : ∀ a, σ (selected a).1 ≤ 1) + (L : ℝ≥0) (hL : LipschitzWith L Real.smoothTransition) + (hprimitive : scalarCubePrimitiveEnvelope Empty L 1 0 (orderOf χ) ≤ P) + (hB : ∀ a, uniformSpectrumBlockCount (selected a).1.val 1 ((selected a).1.val + 1) ≤ + Fintype.card (B ⟨(selected a).1, Sum.inr (selected a).2⟩)) + {Pscale : ℝ} (hPscale : 0 ≤ Pscale) + (hRinv : ∀ a, (R (selected a).1)⁻¹ ≤ Real.exp Pscale) + (hslots : ∀ a, ((layerIntegerPrincipalSlots (G := G) B + (selected a).1 (selected a).2).card : ℝ) ≤ Pscale) : + let law := principalTupleWeights (α := Empty) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S) + let Pos := {r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option Empty → ZMod (orderOf χ) // + 0 < law.mass (Finset.univ.filter (fun y => principalResidueLabel (orderOf χ) y = r))} + let scale := fun a => basisAxisScale (b (selected a).1) (selected a).2 + let W := 4 * (Pscale + 8) + let O := allocatedInactiveJointSiteLog m D p v (E + D * W) + W + ∃ e : Pos → A → ScalarSiteExpansion.{0,0} (Finset Empty), + (∀ r a, (e r a).Bounds (Real.exp O) (Real.exp O) (Real.exp O) + ⟨Real.exp O, Real.exp_nonneg _⟩ (Real.exp (allocatedInactiveSupportLog D))) ∧ + (∑ t : Σ r, ∀ a, (e r a).Term, ‖forecastSiteMixtureCoefficient e + (fun r => (law.mass (Finset.univ.filter + (fun y => principalResidueLabel (orderOf χ) y = r.val)) : ℂ) * (forecastInactiveCharacterCoefficient poly N pRat χ) r.val) t‖) + ≤ Real.exp (Fintype.card A * O) ∧ + ∀ (x : G → IntegerScalarCubeBox Empty S.value) (z : A → ℤ), + ‖((∏ a, (scale a : ℝ)) : ℂ) * + law.complexMean (fun y => finiteImageCharacteristic pRat + (fun t j => (integerLongPolynomialOutput poly (fun k => (y k.1 k.2 : ℤ)) N t j : ZMod N)) χ * + (if forecastInactiveFixedOutput B U b S selected c x y = (fun a _ => z a) + then (1 : ℂ) else 0)) - + (∑ r : Pos, (law.mass (Finset.univ.filter + (fun y => principalResidueLabel (orderOf χ) y = r.val)) : ℂ) * (forecastInactiveCharacterCoefficient poly N pRat χ) r.val * + siteFamilyEval (e r) (fun _ => z) (fun _ a => (z a : ℝ) / scale a))‖ ≤ δ := by + intro law Pos scale W O + obtain ⟨e, he, hmass, herr⟩ := exists_forecastInactive_fixed_physical_site B U b S hR hσ + selected hselected (orderOf χ) (forecastInactiveCharacterCoefficient poly N pRat χ) + (forecastInactiveCharacterCoefficient_norm_le poly N pRat χ) hD hP hp hv hPp hqv + hδ hE hδE hsize hR1 hsmall hgrid c hc hσ1 L hL hprimitive hB hPscale hRinv hslots + refine ⟨e, he, hmass, ?_⟩ + intro x z + simp_rw [forecastInactive_principal_characteristic_residue poly N pRat χ] + exact herr x z + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveFixedSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveFixedSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd3ad61c75865787c14890e4b5cea03ba7c69ef3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveFixedSpectrum.lean @@ -0,0 +1,186 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedInactiveNaturalShort + +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)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (j : Fin m) (i : Fin (n j)) (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : ∀ (a : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)), + (Fintype.card α + 1) * q ≤ allocatedPrincipalSides B U b S ⟨⟨j, Sum.inr i⟩, a, v⟩) + +local notation "height" => basisAxisScale (b j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "cost" => (2 : ℝ) ^ (degree + 1) +local notation "scale" => allocatedPrincipalGridScale (G := G) B U b (R := R) j i +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) +local notation "source" => allocatedLocalResidueSources B U b S j i q hq r hsize +local notation "torus" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 + +theorem exists_allocated_inactive_natural_spectrum + [Nonempty (B ⟨j, Sum.inr i⟩)] + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hgamma : gamma ≤ 1) + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P ε : ℝ) + (hP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) (hε : 0 < ε) (hε1 : ε ≤ 1) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hB : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) : + let : NeZero scale := ⟨(allocatedPrincipalGridScale_pos_of_radius B U b hR j i).ne'⟩ + let ζ := uniformBlockRetainedBias j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ε + ∃ F : Finset (rows → Fin (torus * scale)), + (F.card : ℝ) ≤ uniformSpectrumSizeConstant j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) / + ε ^ max (majorArcSpectrumExponent j.val rows.card) (majorArcLengthExponent j.val * (degree * rows.card)) ∧ + (∑ k, ‖∏ a, weightedCubeGridCoefficient (source a) (torus * scale) rows k‖) ≤ + uniformSpectrumAbsoluteCap j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ∧ + (∀ k ∈ F, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ + uniformCharacterDenominatorBound j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ζ ∧ + ∃ (a : rows → ℤ) (ξ : rows → ℝ), + (∀ t, |ξ t| ≤ 2 * majorArcCoverConstant j.val rows.card P ((torus : ℝ) * cost) / + ζ ^ majorArcCoverExponent j.val rows.card) ∧ + ∀ t, ((k t).val : ℝ) / (torus * scale) = (a t : ℝ) / d + ξ t / scale) ∧ + ∀ shift z : rows → ℤ, + (∀ t, |(z t : ℝ) - shift t| ≤ blockJetScaleBound (Fintype.card α) degree + (Fintype.card (B ⟨j, Sum.inr i⟩)) 1 * scale) → + ‖(((scale : ℝ) ^ rows.card * + (allocatedSupportedResidueJetPMF B U b hR hσ S q r hcell j i rows shift z).toReal : ℝ) : ℂ) - + weightedCubeGridApproximation source scale (torus * scale) rows shift z F‖ ≤ ε := by + let : NeZero scale := ⟨(allocatedPrincipalGridScale_pos_of_radius B U b hR j i).ne'⟩ + have hs (a : B ⟨j, Sum.inr i⟩) (v : Fin degree) : ScalarCubePrimitiveBudget (source a v) A P := + (allocatedLocalResidueSources_primitive B U b S j i q hq r hsize a v A).mono hP + have hP1 : 1 ≤ P := + (hs (Classical.choice (inferInstance : Nonempty (B ⟨j, Sum.inr i⟩))) ⟨0, Nat.zero_lt_succ _⟩).one_le + obtain ⟨hu, hl, hp⟩ := allocatedInactiveResidueSources_natural_scale B U b S j i q hq r hsize hR hgamma hsmall hlarge + obtain ⟨F, hcard, hcap, hchar, herr⟩ := weightedCube_integer_density_approximation (K := scale) + source A hA hP1 zero_le_one (by positivity) (by positivity) hε hε1 hs + (fun a => by simpa only [one_mul] using hu a) hl degree hp rows hrows hB + refine ⟨F, hcard, hcap, hchar, ?_⟩ + intro shift z hz + have h := herr shift z hz + rw [finiteImageMass_eq_toPMF, + allocatedInactiveResidueJetPMF_source B U b S j i q hq r hsize hR hσ hsmall hlarge hcell rows shift] at h + exact h + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (j : Fin m) (i : Fin (n j)) (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : ∀ (a : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)), + (Fintype.card α + 1) * q ≤ allocatedPrincipalSides B U b S ⟨⟨j, Sum.inr i⟩, a, v⟩) + +local notation "height" => basisAxisScale (b j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "cost" => (2 : ℝ) ^ (degree + 1) +local notation "scale" => allocatedPrincipalGridScale (G := G) B U b (R := R) j i +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) +local notation "source" => allocatedLocalResidueSources B U b S j i q hq r hsize +local notation "torus" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 2 +local notation "radius" => blockJetScaleBound (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 + +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + +theorem exists_forecastInactive_fixed_spectrum + [Nonempty (B ⟨j, Sum.inr i⟩)] + (hgamma : gamma ≤ 1) (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P ε : ℝ) + (hP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) (hε : 0 < ε) (hε1 : ε ≤ 1) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hB : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) : + let : NeZero scale := ⟨(allocatedPrincipalGridScale_pos_of_radius B U b hR j i).ne'⟩ + let ζ := uniformBlockRetainedBias j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ε + ∃ F : Finset (rows → Fin (torus * scale)), + (F.card : ℝ) ≤ uniformSpectrumSizeConstant j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) / + ε ^ max (majorArcSpectrumExponent j.val rows.card) (majorArcLengthExponent j.val * (degree * rows.card)) ∧ + (∑ k, ‖∏ a, weightedCubeGridCoefficient (source a) (torus * scale) rows k‖) ≤ + uniformSpectrumAbsoluteCap j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ∧ + (∀ k ∈ F, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ + uniformCharacterDenominatorBound j.val rows.card (degree * rows.card) P + ((torus : ℝ) * cost) (((torus : ℝ) * cost) ^ rows.card) ζ ∧ + ∃ (a : rows → ℤ) (ξ : rows → ℝ), + (∀ t, |ξ t| ≤ 2 * majorArcCoverConstant j.val rows.card P ((torus : ℝ) * cost) / + ζ ^ majorArcCoverExponent j.val rows.card) ∧ + ∀ t, ((k t).val : ℝ) / (torus * scale) = (a t : ℝ) / d + ξ t / scale) ∧ + ∀ shift z : rows → ℤ, + ‖(((scale : ℝ) ^ rows.card * + (allocatedSupportedResidueJetPMF B U b hR hσ S q r hcell j i rows shift z).toReal : ℝ) : ℂ) - + weightedCubePlateauApproximation source scale radius rows shift z F‖ ≤ ε := by + let : NeZero scale := ⟨(allocatedPrincipalGridScale_pos_of_radius B U b hR j i).ne'⟩ + have hs (a : B ⟨j, Sum.inr i⟩) (v : Fin degree) : ScalarCubePrimitiveBudget (source a v) A P := + (allocatedLocalResidueSources_primitive B U b S j i q hq r hsize a v A).mono hP + have hP1 : 1 ≤ P := + (hs (Classical.choice (inferInstance : Nonempty (B ⟨j, Sum.inr i⟩))) ⟨0, Nat.zero_lt_succ _⟩).one_le + obtain ⟨hu, hl, hp⟩ := allocatedInactiveResidueSources_natural_scale B U b S j i q hq r hsize hR hgamma hsmall hlarge + have hu2 a : (∏ v, ((source a v).length : ℝ)) ≤ 2 * scale := + (hu a).trans (by linarith only [show (0 : ℝ) ≤ scale from Nat.cast_nonneg _]) + obtain ⟨F, hcard, hcap, hchar, herr⟩ := weightedCube_integer_density_approximation (K := scale) + source A hA hP1 (show (0 : ℝ) ≤ 2 by norm_num) (by positivity) (by positivity) hε hε1 hs + hu2 hl degree hp rows hrows hB + refine ⟨F, hcard, hcap, hchar, ?_⟩ + have hpoint (shift z : rows → ℤ) : + ‖(((scale : ℝ) ^ rows.card * + (allocatedSupportedResidueJetPMF B U b hR hσ S q r hcell j i rows shift z).toReal : ℝ) : ℂ) - + weightedCubePlateauApproximation source scale radius rows shift z F‖ ≤ ε := by + apply weightedCubePlateauApproximation_error source zero_le_one (allocatedPrincipalGridScale_pos_of_radius B U b hR j i) + (fun a => by simpa only [one_mul] using hu a) rows hrows shift z _ + (allocatedInactiveResidueJetPMF_source B U b S j i q hq r hsize hR hσ hsmall hlarge hcell rows shift) + F hε.le + intro hz + have hbuffer := blockJetScaleBound_buffer_le_double (Fintype.card α) degree + (Fintype.card (B ⟨j, Sum.inr i⟩)) Fintype.card_pos + have h := herr shift z (fun t => (hz t).trans + (mul_le_mul_of_nonneg_right hbuffer (Nat.cast_nonneg scale))) + rw [finiteImageMass_eq_toPMF, + allocatedInactiveResidueJetPMF_source B U b S j i q hq r hsize hR hσ hsmall hlarge hcell rows shift] at h + exact h + exact hpoint + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..5451ba8fabf0fb4403fb8fd5d23184c03b11e669 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ForecastInactiveSpectrum.lean @@ -0,0 +1,105 @@ +import OAI.Combinatorics.Progressions.Lattices.WeightedModerateIntegerApproximation +import OAI.Combinatorics.Progressions.Sampling.ForecastInactiveFiberLaw + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical NNReal + +theorem forecastInactive_retained_character_split + {J : Type*} [Fintype J] {M d K : ℕ} [NeZero M] [NeZero d] + (k : J → Fin M) (a : J → ℤ) (ξ : J → ℝ) + (hfreq : ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / d + ξ j / K) + (z : J → ℤ) : + rectangularGridCharacter M k z = + (∏ j, cyclicIntegerCharacter d (a j) (z j : ZMod d)) * + CircleFourier.character + ((∑ j, ξ j * ((z j : ℝ) / K) : ℝ) : CircleFourier.Circle) := by + have hpoint (j : J) : integerGridCharacter M (k j) (z j) = + cyclicIntegerCharacter d (a j) (z j : ZMod d) * + CircleFourier.character ((ξ j * ((z j : ℝ) / K) : ℝ) : CircleFourier.Circle) := by + rw [integerGridCharacter_eq, hfreq j, add_mul, AddCircle.coe_add, + CircleFourier.character_add, cyclicIntegerCharacter_intCast] + congr 2 <;> congr 1 <;> ring + simp only [rectangularGridCharacter, hpoint, Finset.prod_mul_distrib, + circle_coe_fintype_sum, CircleFourier.character_fintype_sum] + +variable {D α : Type*} [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] +variable (B : D → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable (degree : D → ℕ) +variable (L : PrincipalTupleIndex B (fun a => degree a + 1) → ℕ) (hL : ∀ t, 0 < L t) +variable (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (fun a => degree a + 1) → Option α → ZMod q) (axis : D) +variable (hsize : ∀ b v, (Fintype.card α + 1) * q ≤ L ⟨axis, b, v⟩) +local notation "sources" => principalSupportedAxisSources B (fun a => degree a + 1) L hL q hq r axis hsize +local notation "law" => principalTupleWeights (α := α) B (fun a => degree a + 1) L hL +local notation "cell" => Finset.univ.filter (fun y => principalResidueLabel q y = r) + +theorem exists_forecastInactive_fiber_spectrum + [Nonempty (B axis)] {K : ℕ} [NeZero K] + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {P V C E ε : ℝ} + (hP : 1 ≤ P) (hV : 0 ≤ V) (hC : 0 ≤ C) (hE : 0 ≤ E) + (hε : 0 < ε) (hε1 : ε ≤ 1) + (hprimitive : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hupper : ∀ b, (∏ v : Fin (degree axis + 1), (L ⟨axis, b, v⟩ : ℝ)) ≤ V * K) + (hlower : ∀ b, (K : ℝ) ≤ C * ∏ v : Fin (degree axis + 1), (L ⟨axis, b, v⟩ : ℝ)) + (power : ℕ) (hpower : ∀ b v, (K : ℝ) ≤ E * (L ⟨axis, b, v⟩ : ℝ) ^ power) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree axis + 1) + (hB : uniformSpectrumBlockCount (degree axis) rows.card (power * rows.card) ≤ Fintype.card (B axis)) : + let R := blockTorusFactor (Fintype.card α) (degree axis + 1) (Fintype.card (B axis)) V + let ζ := uniformBlockRetainedBias (degree axis) rows.card (power * rows.card) P + ((R : ℝ) * C) (((R : ℝ) * E) ^ rows.card) ε + ∃ F : Finset (rows → Fin (R * K)), + (F.card : ℝ) ≤ uniformSpectrumSizeConstant (degree axis) rows.card (power * rows.card) + P ((R : ℝ) * C) (((R : ℝ) * E) ^ rows.card) / + ε ^ max (majorArcSpectrumExponent (degree axis) rows.card) + (majorArcLengthExponent (degree axis) * (power * rows.card)) ∧ + (∑ k, ‖∏ b, weightedCubeGridCoefficient (sources b) (R * K) rows k‖) ≤ + uniformSpectrumAbsoluteCap (degree axis) rows.card (power * rows.card) + P ((R : ℝ) * C) (((R : ℝ) * E) ^ rows.card) ∧ + (∀ k ∈ F, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ uniformCharacterDenominatorBound + (degree axis) rows.card (power * rows.card) P + ((R : ℝ) * C) (((R : ℝ) * E) ^ rows.card) ζ ∧ + ∃ (a : rows → ℤ) (ξ : rows → ℝ), + (∀ t, |ξ t| ≤ 2 * majorArcCoverConstant (degree axis) rows.card P ((R : ℝ) * C) / + ζ ^ majorArcCoverExponent (degree axis) rows.card) ∧ + ∀ t, ((k t).val : ℝ) / (R * K) = (a t : ℝ) / d + ξ t / K) ∧ + ∀ shift z : rows → ℤ, + (∀ t, |(z t : ℝ) - shift t| ≤ blockJetScaleBound (Fintype.card α) (degree axis + 1) + (Fintype.card (B axis)) V * K) → + ‖(((K : ℝ) ^ rows.card * (law).fiberMean (principalResidueLabel q) r + (fun y => if (shift + ∑ b, fun t : rows => integerBooleanBlockJet + (fun v k => (y ⟨axis, b, v⟩ k : ℤ)) t) = z then 1 else 0) : ℝ) : ℂ) - + ((law).mass cell : ℂ) * weightedCubeGridApproximation sources K (R * K) rows shift z F‖ ≤ + (law).mass cell * ε := by + intro R ζ + have hs (b : B axis) (v : Fin (degree axis + 1)) : + ScalarCubePrimitiveBudget (sources b v) A P := + (principalSupportedAxisSources_primitive B (fun a => degree a + 1) L hL q hq r axis hsize b v A).mono hprimitive + obtain ⟨F, hcard, hcap, hchar, herr⟩ := weightedCube_integer_density_approximation (K := K) + sources A hA hP hV hC hE hε hε1 hs hupper hlower power hpower rows hrows hB + refine ⟨F, hcard, hcap, hchar, ?_⟩ + intro shift z hz + rw [forecastInactive_fiber_image_all B degree L hL q hq r axis hsize rows shift z] + have herror := herr shift z hz + have hmass := (law).mass_nonneg cell + have heq : + (((K : ℝ) ^ rows.card * ((law).mass cell * + finiteImageMass (weightedCubeIntegerSource sources) (weightedCubeIntegerJetSum sources rows shift) z) : ℝ) : ℂ) - + ((law).mass cell : ℂ) * weightedCubeGridApproximation sources K (R * K) rows shift z F = + ((law).mass cell : ℂ) * + ((((K : ℝ) ^ rows.card * finiteImageMass (weightedCubeIntegerSource sources) + (weightedCubeIntegerJetSum sources rows shift) z : ℝ) : ℂ) - + weightedCubeGridApproximation sources K (R * K) rows shift z F) := by + push_cast + ring + rw [heq, norm_mul, Complex.norm_real, Real.norm_of_nonneg hmass] + exact mul_le_mul_of_nonneg_left herror hmass + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ForecastSpatialCharacterSplit.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ForecastSpatialCharacterSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..73f4dbf2d22e4b3577477f22363b1ff6138586c5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ForecastSpatialCharacterSplit.lean @@ -0,0 +1,106 @@ +import OAI.Combinatorics.Progressions.Linear.AllocatedModularRankCongruenceOutput + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped Classical + +variable {m : ℕ} {X : Type*} {I E : Fin m → Type*} {n : Fin m → ℕ} +variable (inactive : LayerSamplerAxis I n → Prop) + +def forecastSpatialOutputHom {R : Type*} [AddCommMonoid R] : + (X → R) →+ (Sigma (AllocatedCongruenceRankOutput X E inactive) → R) where + toFun u o := match o.2 with + | .inl x => u x.val + | .inr _ => 0 + map_zero' := by + funext o + rcases o with ⟨j, x | i | a⟩ <;> rfl + map_add' u v := by + funext o + rcases o with ⟨j, x | i | a⟩ <;> simp + +def forecastCoefficientOutputHom {R : Type*} [AddCommMonoid R] : + (∀ j, Fin (n j) ⊕ E j → R) →+ + (Sigma (AllocatedCongruenceRankOutput X E inactive) → R) where + toFun label o := match o.2 with + | .inl _ => 0 + | .inr (.inl i) => label o.1 (.inr i) + | .inr (.inr a) => label o.1 (.inl a.val) + map_zero' := by + funext o + rcases o with ⟨j, x | i | a⟩ <;> rfl + map_add' u v := by + funext o + rcases o with ⟨j, x | i | a⟩ <;> simp + +def forecastCongruenceOutput {R : Type*} (u : X → R) + (label : ∀ j, Fin (n j) ⊕ E j → R) : + Sigma (AllocatedCongruenceRankOutput X E inactive) → R := fun o => + match o.2 with + | .inl x => u x.val + | .inr (.inl i) => label o.1 (.inr i) + | .inr (.inr a) => label o.1 (.inl a.val) + +theorem forecastCongruenceOutput_eq_add {R : Type*} [AddCommMonoid R] + (u : X → R) (label : ∀ j, Fin (n j) ⊕ E j → R) : + forecastCongruenceOutput inactive u label = + forecastSpatialOutputHom inactive u + forecastCoefficientOutputHom inactive label := by + funext o + rcases o with ⟨j, x | i | a⟩ <;> + simp [forecastCongruenceOutput, forecastSpatialOutputHom, forecastCoefficientOutputHom] + +theorem forecastCongruenceOutput_intCast (q : ℕ) (u : X → ℤ) + (label : ∀ j, Fin (n j) ⊕ E j → ℤ) : + (fun o => (forecastCongruenceOutput (R := ℤ) inactive u label o : ZMod q)) = + forecastCongruenceOutput inactive (fun x => (u x : ZMod q)) + (fun j i => (label j i : ZMod q)) := by + funext o + rcases o with ⟨j, x | i | a⟩ <;> rfl + +variable [Fintype X] [∀ j, Fintype (E j)] + +theorem exists_forecastSpatialCharacterSplit + {N : ℕ} [NeZero N] + (χ : AddChar (Sigma (AllocatedCongruenceRankOutput X E inactive) → ZMod N) ℂ) + (M : ℕ) [NeZero M] (hM : orderOf χ ∣ M) : + ∃ mask : AddChar (X → ZMod M) ℂ, + ∃ coeff : AddChar (∀ j, Fin (n j) ⊕ E j → ZMod M) ℂ, + (∀ u, ‖mask u‖ = 1) ∧ (∀ label, ‖coeff label‖ = 1) ∧ + (∀ (u : X → ℤ) (label : ∀ j, Fin (n j) ⊕ E j → ℤ), + χ (fun o => (forecastCongruenceOutput (R := ℤ) inactive u label o : ZMod N)) = + mask (fun x => (u x : ZMod M)) * coeff (fun j i => (label j i : ZMod M))) ∧ + ∀ (u : X → ℤ) (label : ∀ j, Fin (n j) ⊕ E j → ℤ), + star (χ (fun o => (forecastCongruenceOutput (R := ℤ) inactive u label o : ZMod N))) = + star (mask (fun x => (u x : ZMod M))) * + star (coeff (fun j i => (label j i : ZMod M))) := by + obtain ⟨ψ, _, _, _, hψ⟩ := exists_characterOrder_descent χ + let ψM := ψ.compAddMonoidHom (zmodPiReduction hM) + let mask := ψM.compAddMonoidHom (forecastSpatialOutputHom (E := E) inactive) + let coeff := ψM.compAddMonoidHom (forecastCoefficientOutputHom (X := X) inactive) + have heq (u : X → ℤ) (label : ∀ j, Fin (n j) ⊕ E j → ℤ) : + χ (fun o => (forecastCongruenceOutput (R := ℤ) inactive u label o : ZMod N)) = + mask (fun x => (u x : ZMod M)) * coeff (fun j i => (label j i : ZMod M)) := by + rw [hψ] + change ψ _ = ψM (forecastSpatialOutputHom inactive _) * + ψM (forecastCoefficientOutputHom inactive _) + rw [← AddChar.map_add_eq_mul, ← forecastCongruenceOutput_eq_add] + dsimp only [ψM, AddChar.compAddMonoidHom_apply] + congr 1 + funext o + rcases o with ⟨j, x | i | a⟩ <;> + simp [zmodPiReduction, forecastCongruenceOutput] + refine ⟨mask, coeff, (fun _ => AddChar.norm_apply _ _), + (fun _ => AddChar.norm_apply _ _), heq, ?_⟩ + intro u label + rw [heq] + exact map_mul (starRingEnd ℂ) _ _ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FourierLawTransport.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FourierLawTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..59de6101ba411d8cc9a41e5af72dba5a9aec1cf5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FourierLawTransport.lean @@ -0,0 +1,553 @@ +import OAI.Combinatorics.Progressions.Estimates.ModerateSliceTensorApproximation +import OAI.Combinatorics.Progressions.Probability.SmoothModerateBlockLaw + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +structure IntegerFourierAxis where + Source : Type + Coordinate : Type + [sourceFinite : Fintype Source] + [coordinateFinite : Fintype Coordinate] + scale : ℕ + [scaleNeZero : NeZero scale] + radius : ℕ + period : ℕ + [periodNeZero : NeZero period] + scale_le_period : scale ≤ period + law : FiniteProbabilityWeights Source + image : (Coordinate → ℤ) → Source → Coordinate → ℤ + countConstant : ℝ + countExponent : ℕ + coefficientCap : ℝ + denominatorBound : ℝ → ℝ + residualBound : ℝ → ℝ + approximation : ∀ ε : ℝ, 0 < ε → ε ≤ 1 → + ∃ S : Finset (Coordinate → Fin period), + (S.card : ℝ) ≤ countConstant / ε ^ countExponent ∧ + (∀ center, (∑ k, ‖integerGridCoefficient law (image center) period k‖) ≤ + coefficientCap) ∧ + (∀ k ∈ S, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ denominatorBound ε ∧ + ∃ (a : Coordinate → ℤ) (ξ : Coordinate → ℝ), + (∀ j, |ξ j| ≤ residualBound ε) ∧ + ∀ j, ((k j).val : ℝ) / period = (a j : ℝ) / d + ξ j / scale) ∧ + ∀ center z, centeredFundamentalBox radius scale center z → + ‖(((scale : ℝ) ^ Fintype.card Coordinate * finiteImageMass law (image center) z : ℝ) : ℂ) - + integerGridApproximation law (image center) scale period S z‖ ≤ ε + +attribute [local instance] IntegerFourierAxis.sourceFinite IntegerFourierAxis.coordinateFinite + IntegerFourierAxis.scaleNeZero IntegerFourierAxis.periodNeZero + +namespace IntegerFourierAxis + +noncomputable def ofEstimate {X J : Type} [Fintype X] [Fintype J] + (p : FiniteProbabilityWeights X) (Y : (J → ℤ) → X → J → ℤ) (K Q M : ℕ) [NeZero K] [NeZero M] + (hKM : K ≤ M) + (countConstant : ℝ) (countExponent : ℕ) (coefficientCap : ℝ) + (denominatorBound residualBound : ℝ → ℝ) + (h : ∀ ε : ℝ, 0 < ε → ε ≤ 1 → + ∃ S : Finset (J → Fin M), + (S.card : ℝ) ≤ countConstant / ε ^ countExponent ∧ + (∀ center, (∑ k, ‖integerGridCoefficient p (Y center) M k‖) ≤ coefficientCap) ∧ + (∀ k ∈ S, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ denominatorBound ε ∧ + ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ j, |ξ j| ≤ residualBound ε) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / d + ξ j / K) ∧ + ∀ center z, centeredFundamentalBox Q K center z → + ‖(((K : ℝ) ^ Fintype.card J * finiteImageMass p (Y center) z : ℝ) : ℂ) - + integerGridApproximation p (Y center) K M S z‖ ≤ ε) : IntegerFourierAxis := + { Source := X, Coordinate := J, scale := K, radius := Q, period := M, + scale_le_period := hKM, law := p, image := Y, + countConstant := countConstant, countExponent := countExponent, coefficientCap := coefficientCap, + denominatorBound := denominatorBound, residualBound := residualBound, approximation := h } + +end IntegerFourierAxis + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem integerGridCoefficient_norm_le_one {X J : Type*} [Fintype X] [Fintype J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (M : ℕ) [NeZero M] (k : J → Fin M) : + ‖integerGridCoefficient p Y M k‖ ≤ 1 := by + exact (p.norm_complexMean_le_mean_norm _).trans_eq (by + simp only [rectangularGridCharacter_norm, p.mean_const]) + +theorem integerGridCoefficient_full_cap {X J : Type*} [Fintype X] [Fintype J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (M B : ℕ) [NeZero M] (hMB : M ≤ B) : + (∑ k, ‖integerGridCoefficient p Y M k‖) ≤ (B : ℝ) ^ Fintype.card J := by + calc + _ ≤ ∑ _k : J → Fin M, (1 : ℝ) := + Finset.sum_le_sum (fun k _ => integerGridCoefficient_norm_le_one p Y M k) + _ = (M : ℝ) ^ Fintype.card J := by simp + _ ≤ (B : ℝ) ^ Fintype.card J := by exact_mod_cast Nat.pow_le_pow_left hMB (Fintype.card J) + +theorem short_side_scale_bound {K L T p : ℕ} {E : ℝ} (hE : 0 ≤ E) (hL : L ≤ T) + (hpower : (K : ℝ) ≤ E * (L : ℝ) ^ p) : K ≤ ⌈E * (T : ℝ) ^ p⌉₊ := by + have hp : (L : ℝ) ^ p ≤ (T : ℝ) ^ p := by exact_mod_cast Nat.pow_le_pow_left hL p + have he := hpower.trans (mul_le_mul_of_nonneg_left hp hE) + exact_mod_cast he.trans (Nat.le_ceil _) + +noncomputable def boundedIntegerFourierAxis {X J : Type} [Fintype X] [Fintype J] [DecidableEq J] + (p : FiniteProbabilityWeights X) (Y : (J → ℤ) → X → J → ℤ) (K Q B : ℕ) [NeZero K] + (hB : (2 * Q + 1) * K ≤ B) + (hY : ∀ center x, p.weight x ≠ 0 → ∀ j, |(Y center x j : ℝ) - center j| ≤ (Q : ℝ) * K) : + IntegerFourierAxis := by + letI : DecidableEq J := Classical.decEq J + let M := (2 * Q + 1) * K + have hK : 0 < K := Nat.pos_of_ne_zero (NeZero.ne K) + exact { + Source := X + Coordinate := J + scale := K + radius := Q + period := M + scale_le_period := Nat.le_mul_of_pos_left K (by omega) + law := p + image := Y + countConstant := (B : ℝ) ^ Fintype.card J + countExponent := 0 + coefficientCap := (B : ℝ) ^ Fintype.card J + denominatorBound := fun _ => B + residualBound := fun _ => 0 + approximation := by + intro ε hε _hε1 + refine ⟨Finset.univ, ?_, ?_, ?_, ?_⟩ + · simp only [pow_zero, div_one, Finset.card_univ, Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] + exact_mod_cast Nat.pow_le_pow_left hB (Fintype.card J) + · intro center + exact integerGridCoefficient_full_cap p (Y center) M B hB + · intro k _ + refine ⟨M, Nat.mul_pos (by omega) hK, by exact_mod_cast hB, + (fun j => (k j).val), (fun _ => 0), (fun _ => by norm_num), ?_⟩ + intro j + simp only [M, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one, + Int.cast_natCast, zero_div, add_zero] + · intro center z hz + have he := integerGridDensity_fourier p (Y center) K M z + rw [integerGridDensity_eq_imageMass_on_centered_box p (Y center) center z + hK le_rfl (hY center) hz] at he + change (((K : ℝ) ^ Fintype.card J * finiteImageMass p (Y center) z : ℝ) : ℂ) = + integerGridApproximation p (Y center) K M Finset.univ z at he + rw [he, sub_self, norm_zero] + exact hε.le } + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +structure IntegerFourierBudget where + radius : ℕ + countConstant : ℝ + countExponent : ℕ + coefficientCap : ℝ + denominatorBound : ℝ → ℝ + residualBound : ℝ → ℝ + +def IntegerFourierBudget.Controls (B : IntegerFourierBudget) + {X J : Type*} [Fintype X] [Fintype J] + (p : FiniteProbabilityWeights X) (Y : (J → ℤ) → X → J → ℤ) + (K M : ℕ) [NeZero M] : Prop := + ∀ ε : ℝ, 0 < ε → ε ≤ 1 → + ∃ S : Finset (J → Fin M), + (S.card : ℝ) ≤ B.countConstant / ε ^ B.countExponent ∧ + (∀ center, (∑ k, ‖integerGridCoefficient p (Y center) M k‖) ≤ B.coefficientCap) ∧ + (∀ k ∈ S, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ B.denominatorBound ε ∧ + ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ j, |ξ j| ≤ B.residualBound ε) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / d + ξ j / K) ∧ + ∀ center z, centeredFundamentalBox B.radius K center z → + ‖(((K : ℝ) ^ Fintype.card J * finiteImageMass p (Y center) z : ℝ) : ℂ) - + integerGridApproximation p (Y center) K M S z‖ ≤ ε + +namespace IntegerFourierAxis + +attribute [local instance] sourceFinite coordinateFinite scaleNeZero periodNeZero + +def budget (a : IntegerFourierAxis) : IntegerFourierBudget where + radius := a.radius + countConstant := a.countConstant + countExponent := a.countExponent + coefficientCap := a.coefficientCap + denominatorBound := a.denominatorBound + residualBound := a.residualBound + +theorem budget_controls (a : IntegerFourierAxis) : + a.budget.Controls a.law a.image a.scale a.period := a.approximation + +end IntegerFourierAxis + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def weightedSliceFourierAxis {b n q K : ℕ} [NeZero b] [NeZero K] + (s : Fin b → Fin (n + 1) → NormalizedScalarCubeSource (Fin q)) (root : Fin b → Fin (n + 1) → ℤ) + (A W T : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (M : ℕ) + (hM : ∀ a j, (s a j).modulusBound ≤ M) (hW : ∀ a j, (s a j).weightBound ≤ W) + (hT : ∀ a j, (s a j).weightLipschitz ≤ T) {O F D E : ℝ} + (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) + (hroot : ∀ a j, |(root a j : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ∏ j, ((s a j).length : ℝ)) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : IntegerFourierAxis := by + let U := affinePrimitiveEnvelope (Fin q) A W T M 1 + let Q := affineTorusRadius (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + let ζ := fun ε => uniformBlockRetainedBias n J.card (p * J.card) U ((R : ℝ) * D) + (((R : ℝ) * E) ^ J.card) ε + refine IntegerFourierAxis.ofEstimate (weightedSliceIntegerSource s root) + (weightedSliceIntegerSum s root J) K Q (R * K) + (Nat.le_mul_of_pos_left K (affineTorusFactor_pos _ _ _ _ _)) + (uniformSpectrumSizeConstant n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card)) + (max (majorArcSpectrumExponent n J.card) (majorArcLengthExponent n * (p * J.card))) + (uniformSpectrumAbsoluteCap n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card)) + (fun ε => uniformCharacterDenominatorBound n J.card (p * J.card) U + ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) (ζ ε)) + (fun ε => 2 * majorArcCoverConstant n J.card U ((R : ℝ) * D) / + (ζ ε) ^ majorArcCoverExponent n J.card) ?_ + intro ε hε hε1 + have he := weightedSlice_geometric_approximation s root A W T hA M + hM hW hT hO hD hE hε hε1 hroot hupper hlower p hpower J hJ hB + dsimp only at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS, ?_, ?_, ?_⟩ + · intro center + apply le_trans ?_ (hcap center) + apply le_of_eq + apply Finset.sum_congr + · ext k + simp only [Finset.mem_univ] + · intro k _ + rfl + · intro k hk + obtain ⟨d, hd, hdb, a, ξ, hξ, heq⟩ := hchar k hk + refine ⟨d, hd, hdb, a, ξ, hξ, ?_⟩ + intro j + simpa only [Nat.cast_mul] + using heq j + · intro center z hz + simpa only [R, integerGridApproximation, Fintype.card_coe] using happ center z hz + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def largeScaleFourierAxis {X J : Type} [Fintype X] [Fintype J] + (p : FiniteProbabilityWeights X) (Y : (J → ℤ) → X → J → ℤ) + (K Q Kmax : ℕ) [NeZero K] (Ccount Ccap : ℝ) (exponent : ℕ) + (denom residual : ℝ → ℝ) + (hsupport : ∀ center x, p.weight x ≠ 0 → ∀ j, |(Y center x j : ℝ) - center j| ≤ (Q : ℝ) * K) + (hlarge : Kmax < K → ∀ ε : ℝ, 0 < ε → ε ≤ 1 → + ∃ S : Finset (J → Fin ((2 * Q + 1) * K)), + (S.card : ℝ) ≤ Ccount / ε ^ exponent ∧ + (∀ center, (∑ k, ‖integerGridCoefficient p (Y center) ((2 * Q + 1) * K) k‖) ≤ Ccap) ∧ + (∀ k ∈ S, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ denom ε ∧ + ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ j, |ξ j| ≤ residual ε) ∧ + ∀ j, ((k j).val : ℝ) / ((2 * Q + 1) * K : ℕ) = (a j : ℝ) / d + ξ j / K) ∧ + ∀ center z, centeredFundamentalBox Q K center z → + ‖(((K : ℝ) ^ Fintype.card J * finiteImageMass p (Y center) z : ℝ) : ℂ) - + integerGridApproximation p (Y center) K ((2 * Q + 1) * K) S z‖ ≤ ε) : IntegerFourierAxis := by + let R := 2 * Q + 1 + let Cshort : ℝ := ((R * Kmax : ℕ) : ℝ) ^ Fintype.card J + refine IntegerFourierAxis.ofEstimate p Y K Q (R * K) (Nat.le_mul_of_pos_left K (by omega)) + (max Ccount Cshort) exponent (max Ccap Cshort) + (fun ε => max (denom ε) (R * Kmax : ℕ)) (fun ε => max (residual ε) 0) ?_ + intro ε hε hε1 + by_cases hK : Kmax < K + · obtain ⟨S, hS, hcap, hchar, happ⟩ := hlarge hK ε hε hε1 + refine ⟨S, hS.trans (div_le_div_of_nonneg_right (le_max_left _ _) (pow_nonneg hε.le _)), + (fun center => (hcap center).trans (le_max_left _ _)), ?_, happ⟩ + intro k hk + obtain ⟨d, hd, hdb, a, ξ, hξ, heq⟩ := hchar k hk + exact ⟨d, hd, hdb.trans (le_max_left _ _), a, ξ, (fun j => (hξ j).trans (le_max_left _ _)), heq⟩ + · have hbound : K ≤ Kmax := Nat.le_of_not_gt hK + have hperiod : R * K ≤ R * Kmax := Nat.mul_le_mul_left R hbound + have hcard : ((Finset.univ : Finset (J → Fin (R * K))).card : ℝ) ≤ Cshort := by + simp only [Finset.card_univ, Fintype.card_fun, Fintype.card_fin, Nat.cast_pow, Cshort] + exact_mod_cast Nat.pow_le_pow_left hperiod (Fintype.card J) + refine ⟨Finset.univ, ?_, ?_, ?_, ?_⟩ + · apply (le_div_iff₀ (pow_pos hε exponent)).mpr + calc + _ ≤ ((Finset.univ : Finset (J → Fin (R * K))).card : ℝ) * 1 := + mul_le_mul_of_nonneg_left (pow_le_one₀ hε.le hε1) (Nat.cast_nonneg _) + _ = _ := mul_one _ + _ ≤ max Ccount Cshort := hcard.trans (le_max_right _ _) + · intro center + exact (integerGridCoefficient_full_cap p (Y center) (R * K) (R * Kmax) hperiod).trans (le_max_right _ _) + · intro k _ + refine ⟨R * K, Nat.mul_pos (by omega) (NeZero.pos K), + (by exact_mod_cast hperiod : ((R * K : ℕ) : ℝ) ≤ ((R * Kmax : ℕ) : ℝ)).trans (le_max_right _ _), + (fun j => (k j).val), (fun _ => 0), (fun _ => ?_), ?_⟩ + · simpa only [abs_zero] using (le_max_right (residual ε) 0) + · intro j + simp only [Int.cast_natCast, zero_div, add_zero] + · intro center z hz + have he := integerGridDensity_fourier p (Y center) K (R * K) z + rw [integerGridDensity_eq_imageMass_on_centered_box p (Y center) center z + (NeZero.pos K) le_rfl (hsupport center) hz] at he + change (((K : ℝ) ^ Fintype.card J * finiteImageMass p (Y center) z : ℝ) : ℂ) = + integerGridApproximation p (Y center) K (R * K) Finset.univ z at he + rw [he, sub_self, norm_zero] + exact hε.le + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def boundedCubeSliceFourierAxis {b g q K : ℕ} {C : Type} [Fintype C] [NeZero K] + (s : Fin b → Fin g → FiniteCubeSlice q) (w : CubeSliceBlockDomain s C → ℝ) + (hw : ∀ x, 0 ≤ w x) (hmass : 0 < ∑ x, w x) (coeff : C → Fin b → ℤ) (H : Fin b → ℝ) + {O F : ℝ} (hO : 0 ≤ O) (hcoeff : ∀ c a, |(coeff c a : ℝ)| ≤ H a) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hvolume : ∀ a, H a * ∏ j, ((s a j).length : ℝ) ≤ F * K) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ g) + (Kmax : ℕ) (hKmax : K ≤ Kmax) : IntegerFourierAxis := by + let Q := ⌈blockJetScaleBound q g b ((O + 1) ^ g * F)⌉₊ + refine boundedIntegerFourierAxis (cubeSliceBlockWeights s w hw hmass) (cubeSliceBlockSum s coeff J) + K Q ((2 * Q + 1) * Kmax) (Nat.mul_le_mul_left _ hKmax) ?_ + intro center x _ S + exact (cubeSliceBlockSum_scale_bound s coeff H hO hcoeff hroot hvolume J hJ center x S).trans + (mul_le_mul_of_nonneg_right (Nat.le_ceil _) (Nat.cast_nonneg K)) + +noncomputable def shortCubeSliceFourierAxis {b g q K : ℕ} {C : Type} [Fintype C] [NeZero K] + (s : Fin b → Fin g → FiniteCubeSlice q) (w : CubeSliceBlockDomain s C → ℝ) + (hw : ∀ x, 0 ≤ w x) (hmass : 0 < ∑ x, w x) (coeff : C → Fin b → ℤ) (H : Fin b → ℝ) + {O F E : ℝ} (hO : 0 ≤ O) (hE : 0 ≤ E) (hcoeff : ∀ c a, |(coeff c a : ℝ)| ≤ H a) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hvolume : ∀ a, H a * ∏ j, ((s a j).length : ℝ) ≤ F * K) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ g) + (a : Fin b) (j : Fin g) (p T : ℕ) (hshort : (s a j).length ≤ T) + (hpower : (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) : IntegerFourierAxis := + boundedCubeSliceFourierAxis s w hw hmass coeff H hO hcoeff hroot hvolume J hJ + ⌈E * (T : ℝ) ^ p⌉₊ (short_side_scale_bound hE hshort hpower) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def smoothCubeFourierAxis {b n q M K : ℕ} [NeZero b] [NeZero K] {B T : ℝ≥0} + (s : Fin b → Fin (n + 1) → SmoothCubeSlice q M B T) + (hmass : ∀ a j, 0 < ∑ x, (s a j).sliceWeight x) (hB : 0 < B) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {O F D E : ℝ} + (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ∏ j, ((s a j).length : ℝ)) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hblocks : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : IntegerFourierAxis := by + let U := affinePrimitiveEnvelope (Fin q) A (2 * B) (2 * T) M 1 + let Q := affineTorusRadius (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + let Kmax := ⌈E * (scalarCubeNormalizationThreshold (Fin q) M B T : ℝ) ^ p⌉₊ + let Cshort : ℝ := ((R * Kmax : ℕ) : ℝ) ^ J.card + let Ccount := uniformSpectrumSizeConstant n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) + let Ccap := uniformSpectrumAbsoluteCap n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) + let exponent := max (majorArcSpectrumExponent n J.card) (majorArcLengthExponent n * (p * J.card)) + let ζ := fun ε => uniformBlockRetainedBias n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ε + let denom := fun ε => uniformCharacterDenominatorBound n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) (ζ ε) + let residual := fun ε => 2 * majorArcCoverConstant n J.card U ((R : ℝ) * D) / + (ζ ε) ^ majorArcCoverExponent n J.card + refine IntegerFourierAxis.ofEstimate (smoothCubeBlockSource s hmass) (smoothCubeBlockSum s J) + K Q (R * K) (Nat.le_mul_of_pos_left K (affineTorusFactor_pos _ _ _ _ _)) + (max Ccount Cshort) exponent (max Ccap Cshort) + (fun ε => max (denom ε) (R * Kmax : ℕ)) (fun ε => max (residual ε) 0) ?_ + intro ε hε hε1 + by_cases hlong : ∀ a j, scalarCubeNormalizationThreshold (Fin q) M B T ≤ (s a j).length + · have he := weightedSlice_geometric_approximation + (fun a j => (s a j).normalized hB (hlong a j)) (fun a j => (s a j).root) + A (2 * B) (2 * T) hA M (fun _ _ => le_rfl) (fun _ _ => le_rfl) (fun _ _ => le_rfl) + hO hD hE hε hε1 hroot hupper hlower p hpower J hJ hblocks + dsimp only at he + rw [smoothCubeBlockSource_normalized s hmass hB hlong, smoothCubeBlockSum_normalized s hB hlong] at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS.trans (div_le_div_of_nonneg_right (le_max_left _ _) (pow_nonneg hε.le _)), ?_, ?_, ?_⟩ + · intro center + apply le_trans ?_ (le_max_left Ccap Cshort) + apply le_trans ?_ (hcap center) + apply le_of_eq + apply Finset.sum_congr + · ext k + simp only [Finset.mem_univ] + · intro k _ + rfl + · intro k hk + obtain ⟨d, hd, hdb, a, ξ, hξ, heq⟩ := hchar k hk + refine ⟨d, hd, hdb.trans (le_max_left _ _), a, ξ, + (fun j => (hξ j).trans (le_max_left _ _)), ?_⟩ + intro j + simpa only [Nat.cast_mul] using heq j + · intro center z hz + have hh := happ center z hz + simp only [R, integerGridApproximation, Fintype.card_coe, finiteImageMass] at hh ⊢ + convert hh using 1 + apply congrArg norm + apply congrArg₂ (fun x y : ℂ => x - y) + · apply congrArg Complex.ofReal + apply congrArg (fun t : ℝ => (K : ℝ) ^ J.card * t) + unfold FiniteProbabilityWeights.mean + apply Finset.sum_congr + · apply Finset.ext + intro x + exact ⟨fun _ => Finset.mem_univ x, fun _ => Finset.mem_univ x⟩ + · intro x _ + rfl + · apply congrArg (fun t : ℂ => ((K : ℂ) / (R * K : ℕ)) ^ J.card * t) + apply Finset.sum_congr rfl + intro k _ + rfl + · push Not at hlong + obtain ⟨a, j, hshort⟩ := hlong + have hK : K ≤ Kmax := short_side_scale_bound hE hshort.le (hpower a j) + have hperiod : R * K ≤ R * Kmax := Nat.mul_le_mul_left R hK + have hSshort : ((Finset.univ : Finset (J → Fin (R * K))).card : ℝ) ≤ Cshort := by + simp only [Finset.card_univ, Fintype.card_fun, Fintype.card_fin, Fintype.card_coe, Nat.cast_pow, Cshort] + exact_mod_cast Nat.pow_le_pow_left hperiod J.card + refine ⟨Finset.univ, ?_, ?_, ?_, ?_⟩ + · apply (le_div_iff₀ (pow_pos hε exponent)).mpr + calc + _ ≤ ((Finset.univ : Finset (J → Fin (R * K))).card : ℝ) * 1 := + mul_le_mul_of_nonneg_left (pow_le_one₀ hε.le hε1) (Nat.cast_nonneg _) + _ = _ := mul_one _ + _ ≤ max Ccount Cshort := hSshort.trans (le_max_right _ _) + · intro center + apply le_trans ?_ (le_max_right Ccap Cshort) + simpa only [Fintype.card_coe, Cshort] using + integerGridCoefficient_full_cap (smoothCubeBlockSource s hmass) (smoothCubeBlockSum s J center) + (R * K) (R * Kmax) hperiod + · intro k _ + refine ⟨R * K, Nat.mul_pos (affineTorusFactor_pos _ _ _ _ _) (NeZero.pos K), + (by exact_mod_cast hperiod : ((R * K : ℕ) : ℝ) ≤ ((R * Kmax : ℕ) : ℝ)).trans (le_max_right _ _), + (fun j => (k j).val), (fun _ => 0), (fun _ => ?_), ?_⟩ + · simpa only [abs_zero] using (le_max_right (residual ε) 0) + · intro j + simp only [Int.cast_natCast, zero_div, add_zero] + · intro center z hz + have he := integerGridDensity_fourier (smoothCubeBlockSource s hmass) (smoothCubeBlockSum s J center) + K (R * K) z + have hgrid := integerGridDensity_eq_imageMass_on_centered_box (smoothCubeBlockSource s hmass) + (smoothCubeBlockSum s J center) center z (NeZero.pos K) le_rfl + (fun x _ Z => by + simpa only [Q, Fintype.card_fin] using smoothCubeBlockSum_support s hO hroot hupper J hJ center x Z) hz + change integerGridDensity (smoothCubeBlockSource s hmass) (smoothCubeBlockSum s J center) K (R * K) z = + (K : ℝ) ^ Fintype.card J * finiteImageMass (smoothCubeBlockSource s hmass) + (smoothCubeBlockSum s J center) z at hgrid + rw [hgrid] at he + change (((K : ℝ) ^ Fintype.card J * finiteImageMass (smoothCubeBlockSource s hmass) + (smoothCubeBlockSum s J center) z : ℝ) : ℂ) = + integerGridApproximation (smoothCubeBlockSource s hmass) (smoothCubeBlockSum s J center) + K (R * K) Finset.univ z at he + rw [he] + apply le_trans ?_ hε.le + apply le_of_eq + apply norm_eq_zero.mpr + apply sub_eq_zero.mpr + unfold integerGridApproximation + apply congrArg (fun t : ℂ => ((K : ℂ) / (R * K : ℕ)) ^ Fintype.card J * t) + apply Finset.sum_congr + · apply Finset.ext + intro k + exact ⟨fun _ => Finset.mem_univ k, fun _ => Finset.mem_univ k⟩ + · intro k _ + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem integerGridCoefficient_eq_of_complexMean {X Y J : Type*} + [Fintype X] [Fintype Y] [Fintype J] + (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) + (F : X → J → ℤ) (G : Y → J → ℤ) + (h : ∀ f : (J → ℤ) → ℂ, p.complexMean (fun x => f (F x)) = q.complexMean (fun y => f (G y))) + (M : ℕ) [NeZero M] (k : J → Fin M) : + integerGridCoefficient p F M k = integerGridCoefficient q G M k := h (rectangularGridCharacter M k) + +theorem integerGridApproximation_eq_of_complexMean {X Y J : Type*} + [Fintype X] [Fintype Y] [Fintype J] + (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) + (F : X → J → ℤ) (G : Y → J → ℤ) + (h : ∀ f : (J → ℤ) → ℂ, p.complexMean (fun x => f (F x)) = q.complexMean (fun y => f (G y))) + (K M : ℕ) [NeZero M] (S : Finset (J → Fin M)) (z : J → ℤ) : + integerGridApproximation p F K M S z = integerGridApproximation q G K M S z := by + unfold integerGridApproximation + simp_rw [integerGridCoefficient_eq_of_complexMean p q F G h M] + +theorem IntegerFourierBudget.controls_of_complexMean {X Y J : Type*} + [Fintype X] [Fintype Y] [Fintype J] (B : IntegerFourierBudget) + (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) + (F : (J → ℤ) → X → J → ℤ) (G : (J → ℤ) → Y → J → ℤ) + (K M : ℕ) [NeZero M] + (h : ∀ center (f : (J → ℤ) → ℂ), + p.complexMean (fun x => f (F center x)) = q.complexMean (fun y => f (G center y))) + (hmodel : B.Controls p F K M) : B.Controls q G K M := by + intro ε hε hε1 + obtain ⟨S, hcount, hcap, hchar, happ⟩ := hmodel ε hε hε1 + refine ⟨S, hcount, ?_, hchar, ?_⟩ + · intro center + have hc := hcap center + simp_rw [integerGridCoefficient_eq_of_complexMean p q (F center) (G center) (h center) M] at hc + exact hc + · intro center z hz + have ha := happ center z hz + rw [finiteImageMass_eq_of_complexMean p q (F center) (G center) (h center) z, + integerGridApproximation_eq_of_complexMean p q (F center) (G center) (h center) K M S z] at ha + exact ha + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FourierWeightedCounting.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FourierWeightedCounting.lean new file mode 100644 index 0000000000000000000000000000000000000000..17bfcd5c70c6144c8b5d9c81bf78537175ab17e7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FourierWeightedCounting.lean @@ -0,0 +1,69 @@ +import OAI.Combinatorics.Progressions.Estimates.ConfigurationCenteredCounting +import OAI.Combinatorics.Progressions.Estimates.WeightedCenteredExpansion + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def configurationFourierWeight {R J : Type*} [AddMonoid R] [Fintype J] + (c : J → ℂ) (Psi : J → AddChar (R × R) ℂ) (z : R × R) : ℂ := + ∑ j, c j * Psi j z + +theorem exists_fourier_weighted_counting (s : ℕ) (hs : 1 ≤ s) + {epsilon : ℝ} (hepsilon : 0 < epsilon) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ {N : ℕ} [NeZero N] {p : ℝ}, 2 ≤ p → Odd N → Real.exp ((p + 2) ^ C) ≤ N → + ∀ mu : ZMod N → ℝ, (∀ x, 0 ≤ mu x ∧ mu x ≤ Real.exp p) → (𝔼 x, mu x) = 1 → + CyclicNiltestUpperComparison.{0} s N ((p + 2) ^ C) + (Real.exp (-((p + 2) ^ C))) mu (fun _ => 1 + xi) → + ∀ {I : Type} [DecidableEq I] (slopes : I → ZMod N), + (∀ i j, i ≠ j → IsUnit (slopes i - slopes j)) → + ∀ S : Finset I, S.card ≤ s + 2 → + ∀ {J : Type} [Fintype J] (c : J → ℂ) (Psi : J → AddChar (ZMod N × ZMod N) ℂ), + ‖(𝔼 x, 𝔼 d, configurationFourierWeight c Psi (x, d) * + (∏ i ∈ S, (mu (x + slopes i * d) : ℂ))) - + (𝔼 x, 𝔼 d, configurationFourierWeight c Psi (x, d))‖ ≤ (∑ j, ‖c j‖) * epsilon := by + let delta := epsilon / (2 : ℝ) ^ (s + 2) + have hdelta : 0 < delta := by dsimp [delta]; positivity + obtain ⟨C, hC, xi, hxi, hcount⟩ := exists_configuration_centered_counting s hs hdelta + refine ⟨C, hC, xi, hxi, ?_⟩ + intro N _ p hp hodd hN mu hmu hmean hcompare I _ slopes hsep S hS J _ c Psi + let F : I → (ZMod N × ZMod N) → ℂ := fun i z => (mu (z.1 + slopes i * z.2) : ℂ) + let W := configurationFourierWeight c Psi + let L : ℝ := ∑ j, ‖c j‖ + have hL : 0 ≤ L := Finset.sum_nonneg (fun j _ => norm_nonneg _) + have hcenter (U : Finset I) (hUS : U ⊆ S) (hU : U.Nonempty) : + ‖𝔼 z, W z * (∏ i ∈ U, (F i z - 1))‖ ≤ L * delta := by + let : Nonempty U := ⟨⟨hU.choose, hU.choose_spec⟩⟩ + apply norm_expect_finite_weighted_sum_le c (fun j z => Psi j z) (fun z => ∏ i ∈ U, (F i z - 1)) + intro j + have hcard : Fintype.card U ≤ s + 2 := by + simpa only [Fintype.card_coe] using (Finset.card_le_card hUS).trans hS + have h := hcount hp hodd hN mu hmu hmean hcompare (I := U) hcard + (fun i => slopes i.val) + (fun i k hik => hsep i.val k.val (fun h => hik (Subtype.ext h))) (Psi j) + have hprod (x d : ZMod N) : + (∏ i : U, ((mu (x + slopes i.val * d) - 1 : ℝ) : ℂ)) = + ∏ i ∈ U, ((mu (x + slopes i * d) - 1 : ℝ) : ℂ) := + Finset.prod_coe_sort (s := U) (f := fun i : I => ((mu (x + slopes i * d) - 1 : ℝ) : ℂ)) + simp only [hprod] at h + rw [expect_prod_split] + simpa only [F, Complex.ofReal_sub, Complex.ofReal_one] using h + have h := weighted_product_count_of_centered S F W (mul_nonneg hL hdelta.le) hcenter + have hbound : (2 : ℝ) ^ S.card * (L * delta) ≤ L * epsilon := by + calc + _ = L * ((2 : ℝ) ^ S.card * delta) := by ring + _ ≤ L * ((2 : ℝ) ^ (s + 2) * delta) := mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by norm_num) hS) hdelta.le) hL + _ = L * epsilon := by congr 1; dsimp [delta]; field_simp + simpa only [expect_prod_split, F, W, L] using h.trans hbound + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FrequencyGridIntervals.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FrequencyGridIntervals.lean new file mode 100644 index 0000000000000000000000000000000000000000..70dee311d2f9400e58c7907f9002dbca254c43a5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FrequencyGridIntervals.lean @@ -0,0 +1,65 @@ +import OAI.Combinatorics.Progressions.Lattices.IntegerFiberCount + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def frequencyGridInterval (M : ℕ) (center radius : ℝ) : Finset (Fin M) := + Finset.univ.filter (fun k => |(k.val : ℝ) - center| ≤ radius) + +theorem frequencyGridInterval_card (M : ℕ) (center : ℝ) {radius : ℝ} (hr : 0 ≤ radius) : + ((frequencyGridInterval M center radius).card : ℝ) ≤ 2 * radius + 1 := by + classical + let A := frequencyGridInterval M center radius + have hinj : Function.Injective (fun k : Fin M => (k.val : ℤ)) := by + intro x y h + exact Fin.ext (Int.ofNat_inj.mp h) + have hc := card_integer_set_le_diameter_add_one (A.image (fun k => (k.val : ℤ))) + (by positivity : (0 : ℝ) ≤ 2 * radius) (by + intro x hx y hy + obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hx + obtain ⟨j, hj, rfl⟩ := Finset.mem_image.mp hy + have hi' := abs_le.mp (Finset.mem_filter.mp hi).2 + have hj' := abs_le.mp (Finset.mem_filter.mp hj).2 + push_cast + rw [abs_le] + constructor <;> linarith) + simpa only [Finset.card_image_of_injective _ hinj] using hc + +theorem scaled_grid_approximation {M : ℕ} (hM : 0 < M) (k : Fin M) (a : ℤ) (d : ℕ) + {E H : ℝ} (hclose : |(k.val : ℝ) / M - (a : ℝ) / d| ≤ E) (hE : M * E ≤ H) : + |(k.val : ℝ) - M * ((a : ℝ) / d)| ≤ H := by + have hM' : (0 : ℝ) < M := by exact_mod_cast hM + have he : (k.val : ℝ) - M * ((a : ℝ) / d) = + (M : ℝ) * ((k.val : ℝ) / M - (a : ℝ) / d) := by field_simp + rw [he, abs_mul, abs_of_pos hM'] + exact (mul_le_mul_of_nonneg_left hclose hM'.le).trans hE + +theorem grid_approximation_numerator_bound {M Q H d : ℕ} (hM : 0 < M) + (hd : 0 < d) (hdQ : d ≤ Q) (k : Fin M) (a : ℤ) + (hclose : |(k.val : ℝ) - M * ((a : ℝ) / d)| ≤ H) : + |a| ≤ (Q : ℤ) * (H + 1) := by + have hM' : (1 : ℝ) ≤ M := by exact_mod_cast hM + have hd' : (0 : ℝ) < d := by exact_mod_cast hd + have hdQ' : (d : ℝ) ≤ Q := by exact_mod_cast hdQ + have hk : (k.val : ℝ) < M := by exact_mod_cast k.isLt + have hk0 : (0 : ℝ) ≤ k.val := Nat.cast_nonneg _ + have hH : (0 : ℝ) ≤ H := Nat.cast_nonneg _ + have hmH : (H : ℝ) ≤ M * H := le_mul_of_one_le_left hH hM' + obtain ⟨hl, hu⟩ := abs_le.mp hclose + have hquot : |(a : ℝ) / d| ≤ H + 1 := by + rw [abs_le] + constructor <;> nlinarith + rw [abs_div, abs_of_pos hd'] at hquot + have ha := (div_le_iff₀ hd').mp hquot + have hbound : |(a : ℝ)| ≤ (Q : ℝ) * (H + 1) := + ha.trans (by nlinarith) + exact_mod_cast hbound + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/FrequencyProjectionBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/FrequencyProjectionBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..7989a624d6996036e148c18c3746d7aeeaaeec8c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/FrequencyProjectionBudget.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Dynamics.ModeThresholdLogBudget + +namespace OAI + +section + +namespace Erdos3 + +theorem frequency_projection_error_bound {p v M : ℝ} (hp : 0 ≤ p) + (hM : M ≤ Real.exp v) : + 2 * Real.exp p * Real.exp (-(2 * p + 8)) + M * Real.exp (-(p + v + 8)) ≤ + Real.exp (-p) / 2 := by + have parameterNonneg := hp + have h8 : (8 : ℝ) ≤ Real.exp 8 := by linarith [Real.add_one_le_exp (8 : ℝ)] + have hinv : Real.exp (-8 : ℝ) ≤ 1 / 8 := by + rw [Real.exp_neg] + simpa only [one_div] using one_div_le_one_div_of_le (by norm_num) h8 + have hfirst : 2 * Real.exp p * Real.exp (-(2 * p + 8)) = + 2 * Real.exp (-p) * Real.exp (-8) := by + rw [mul_assoc, ← Real.exp_add, mul_assoc, ← Real.exp_add] + congr 2 + ring + have hsecond : Real.exp v * Real.exp (-(p + v + 8)) = Real.exp (-p) * Real.exp (-8) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + have hbound := mul_le_mul_of_nonneg_right hM (Real.exp_nonneg (-(p + v + 8))) + rw [hsecond] at hbound + rw [hfirst] + have hsmall := mul_le_mul_of_nonneg_left hinv (Real.exp_nonneg (-p)) + linarith [parameterNonneg, Real.exp_pos (-p)] + +theorem frequency_code_count_bound {p v : ℝ} {D M : ℕ} + (hp : 0 ≤ p) (hv : 0 ≤ v) (hD : (D : ℝ) ≤ p) (hM : (M : ℝ) ≤ Real.exp v) : + ((M : ℝ) + 1) ^ D ≤ Real.exp (p * (v + 1)) := by + have parameterNonneg := hp + have hbase : (M : ℝ) + 1 ≤ Real.exp (v + 1) := by + simpa only [add_zero] using add_le_exp_add_one hv (le_refl (0 : ℝ)) hM + (by simp : (1 : ℝ) ≤ Real.exp 0) + calc + _ ≤ (Real.exp (v + 1)) ^ D := pow_le_pow_left₀ (by positivity) hbase D + _ = Real.exp ((D : ℝ) * (v + 1)) := (Real.exp_nat_mul _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right hD (by linarith [parameterNonneg])) + +theorem mass_div_frequency_count {mass p v R : ℝ} {D M : ℕ} + (hmass : 0 ≤ mass) (hp : 0 ≤ p) (hv : 0 ≤ v) (hD : (D : ℝ) ≤ p) + (hM : (M : ℝ) ≤ Real.exp v) (hR : p * (v + 1) ≤ R) : + mass * Real.exp (-R) ≤ mass / ((M : ℝ) + 1) ^ D := by + have hden := (frequency_code_count_bound hp hv hD hM).trans (Real.exp_le_exp.mpr hR) + have hi : Real.exp (-R) ≤ 1 / ((M : ℝ) + 1) ^ D := by + rw [Real.exp_neg] + simpa only [one_div] using one_div_le_one_div_of_le (by positivity) hden + simpa only [mul_one_div] using mul_le_mul_of_nonneg_left hi hmass + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/GowersFourierMultiplier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/GowersFourierMultiplier.lean new file mode 100644 index 0000000000000000000000000000000000000000..d630625003900f0192a825cb12852adb824bc980 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/GowersFourierMultiplier.lean @@ -0,0 +1,58 @@ +import OAI.Combinatorics.Progressions.Estimates.BooleanCubeProduct +import OAI.Combinatorics.Progressions.Estimates.FiniteConvolution + +namespace OAI + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {H : Type*} [AddCommGroup H] [Fintype H] + +theorem gowersNorm_mul_fourier (j : ℕ) (f : H → ℂ) (a : AddChar H ℂ → ℂ) : + gowersNorm (j + 2) (fun x => f x * (∑ χ : AddChar H ℂ, a χ * χ x)) ≤ + (∑ χ : AddChar H ℂ, ‖a χ‖) * gowersNorm (j + 2) f := by + simp only [Finset.mul_sum] + apply (gowersNorm_sum (j + 1) _).trans_eq + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro χ _ + have he : (fun x => f x * (a χ * χ x)) = (fun x => a χ * (χ x * f x)) := by + funext x + ring + rw [he, gowersNorm_const_mul, gowersNorm_mul_character j χ f χ.map_add_eq_mul χ.norm_apply] + +theorem gowersNorm_mul_convolution (j : ℕ) (f u v : H → ℂ) : + gowersNorm (j + 2) (fun x => f x * finiteConvolution u v x) ≤ + (∑ χ : AddChar H ℂ, ‖finiteFourierCoeff u χ * finiteFourierCoeff v χ‖) * + gowersNorm (j + 2) f := by + simp only [finiteConvolution_fourier] + exact gowersNorm_mul_fourier j f _ + +theorem gowersNorm_mul_approximation (j : ℕ) (f u v : H → ℂ) {M ε : ℝ} + (hε : 0 ≤ ε) (hf : ∀ x, ‖f x‖ ≤ 1) (huv : ∀ x, ‖u x - v x‖ ≤ 1) + (herror : (𝔼 x, ‖u x - v x‖) ≤ ε ^ (2 ^ (j + 2))) + (hmult : gowersNorm (j + 2) (fun x => f x * v x) ≤ M * gowersNorm (j + 2) f) : + gowersNorm (j + 2) (fun x => f x * u x) ≤ M * gowersNorm (j + 2) f + ε := by + let e := fun x => f x * (u x - v x) + have heunit (x : H) : ‖e x‖ ≤ 1 := by + simpa only [e, norm_mul, one_mul] using mul_le_mul (hf x) (huv x) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) + have hepoint (x : H) : ‖e x‖ ≤ ‖u x - v x‖ := by + simpa only [e, norm_mul, one_mul] using mul_le_mul_of_nonneg_right (hf x) (norm_nonneg (u x - v x)) + have he : gowersNorm (j + 2) e ≤ ε := + gowersNorm_le_of_mean_norm_le_pow (j + 1) e heunit hε + ((Finset.expect_le_expect (fun x _ => hepoint x)).trans herror) + have hsplit : (fun x => f x * u x) = (fun x => f x * v x + e x) := by + funext x + dsimp [e] + ring + rw [hsplit] + exact (gowersNorm_add (j + 1) _ _).trans (add_le_add hmult he) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/HomogeneousGradedProjectionFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/HomogeneousGradedProjectionFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7a0643574ffd2c80473e08b4364ccecbaf079d8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/HomogeneousGradedProjectionFrequency.lean @@ -0,0 +1,188 @@ +import OAI.Combinatorics.Progressions.Estimates.GradedPieceRepresentative +import OAI.Combinatorics.Progressions.Linear.HomogeneousGradedProjectionBounds + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {K V W ι κ : Type*} [Field K] [AddCommGroup V] [Module K V] + [AddCommGroup W] [Module K W] + +theorem graded_image_frequency_zero + (b : Basis ι K V) (ω : ι → ℕ) (c : Basis κ K W) (ν : κ → ℕ) + (T : V →ₗ[K] W) (s : ℕ) + (hT : ∀ x, T (basisGradeProjection b ω s x) = basisGradeProjection c ν s (T x)) + (U : Submodule K V) (hU : BasisGradedSubmodule b ω U) (η : W →ₗ[K] K) + (hsource : ∀ x ∈ U, basisGradeProjection b ω s x = x → η (T x) = 0) + {y : W} (hy : y ∈ U.map T) (hgrade : basisGradeProjection c ν s y = y) : + η y = 0 := by + obtain ⟨x, hx, rfl⟩ := hy + have h := hsource (basisGradeProjection b ω s x) (hU s x hx) + (basisCoordinateProjection_idempotent b {i | ω i = s} x) + rwa [hT, hgrade] at h + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +noncomputable def gradedFrequency (η : L →ₗ[ℚ] ℚ) : F.AssociatedGraded →ₗ[ℚ] ℚ := + η.comp (b.repr.symm.toLinearMap.comp (F.associatedGradedBasis b ω hF).repr.toLinearMap) + +theorem gradedFrequency_projection (η : L →ₗ[ℚ] ℚ) (j : ℕ) (x : L) : + F.gradedFrequency b ω hF η (F.gradedPieceProjection b ω hF j x) = + η (basisGradeProjection b ω j x) := by + change η (b.repr.symm ((F.associatedGradedBasis b ω hF).repr + ((F.associatedGradedBasis b ω hF).repr.symm (b.repr (basisGradeProjection b ω j x))))) = _ + rw [LinearEquiv.apply_symm_apply, LinearEquiv.symm_apply_apply] + +include hF in +theorem basisGradeProjection_top (x : F.layer s) : basisGradeProjection b ω s (x : L) = x := by + have he : {i | ω i = s} = {i | s ≤ ω i} := by + ext i + exact ⟨fun h => h.ge, fun h => le_antisymm (F.adaptedBasis_weight_le_step b ω hF i) h⟩ + change basisCoordinateProjection b {i | ω i = s} (x : L) = x + rw [he] + exact basisCoordinateProjection_eq_self b _ _ ((hF s) ▸ x.property) + +theorem gradedFrequency_top_piece (η : L →ₗ[ℚ] ℚ) (x : F.layer s) : + F.gradedFrequency b ω hF η (F.associatedGradedPieceMap s x) = η x := by + rw [← F.gradedPieceProjection_eq_pieceMap b ω hF, F.gradedFrequency_projection, + F.basisGradeProjection_top b ω hF x] + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s : ℕ} + (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M s) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (f : Basis κ ℚ M) (ν : κ → ℕ) + (hG : ∀ j, G.layer j = Submodule.span ℚ (f '' {i | j ≤ ν i})) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) + +theorem gradedFrequency_top_natural (η : M →ₗ[ℚ] ℚ) (x : F.AssociatedGraded) + (hx : basisGradeProjection (F.associatedGradedBasis e ω hF) ω s x = x) : + F.gradedFrequency e ω hF (η.comp φ.toLinearMap) x = + G.gradedFrequency f ν hG η (F.associatedGradedMap G φ hφ x) := by + obtain ⟨v, rfl⟩ := F.exists_associatedGradedPieceMap_of_pure e ω hF s x hx + rw [F.associatedGradedMap_piece, F.gradedFrequency_top_piece, + G.gradedFrequency_top_piece] + rfl + +theorem gradedFrequency_comap_top_zero (η : M →ₗ[ℚ] ℚ) + (U : LieSubalgebra ℚ G.AssociatedGraded) + (hzero : ∀ y ∈ U, basisGradeProjection (G.associatedGradedBasis f ν hG) ν s y = y → + G.gradedFrequency f ν hG η y = 0) : + ∀ x ∈ U.comap (F.associatedGradedMap G φ hφ), + basisGradeProjection (F.associatedGradedBasis e ω hF) ω s x = x → + F.gradedFrequency e ω hF (η.comp φ.toLinearMap) x = 0 := by + intro x hx hpure + rw [F.gradedFrequency_top_natural G e ω hF f ν hG φ hφ η x hpure] + apply hzero _ hx + exact (F.associatedGradedMap_gradeProjection G e ω hF f ν hG φ hφ s x).symm.trans + (congrArg (F.associatedGradedMap G φ hφ) hpure) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s : ℕ} + +theorem homogeneousAssociatedGradedEquiv_pieceMap + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (hb : BasisHomogeneousBrackets b ω) (j : ℕ) (x : F.layer j) : + F.homogeneousAssociatedGradedEquiv b ω hF hb (F.associatedGradedPieceMap j x) = + basisGradeProjection b ω j x.val := + F.associatedGradedPieceMap_repr_symm b ω hF j x + +theorem homogeneousAssociatedGradedEquiv_top_piece + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (hb : BasisHomogeneousBrackets b ω) (x : F.layer s) : + F.homogeneousAssociatedGradedEquiv b ω hF hb (F.associatedGradedPieceMap s x) = x.val := by + rw [F.homogeneousAssociatedGradedEquiv_pieceMap b ω hF hb, + F.basisGradeProjection_top b ω hF x] + +variable (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M s) + (c : Basis κ ℚ M) (ν : κ → ℕ) + (hG : ∀ j, G.layer j = Submodule.span ℚ (c '' {i | j ≤ ν i})) + (hc : BasisHomogeneousBrackets c ν) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem homogeneousGradedProjection_top_frequency (η : M →ₗ[ℚ] ℚ) + (x : F.AssociatedGraded) + (hx : basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x) : + η (F.homogeneousGradedProjection G c ν hG hc φ hφ x) = + F.gradedFrequency b ω hF (η.comp φ.toLinearMap) x := by + obtain ⟨v, hv⟩ := F.exists_associatedGradedPieceMap_of_pure b ω hF s x hx + rw [← hv, F.gradedFrequency_top_piece] + change η (G.homogeneousAssociatedGradedEquiv c ν hG hc + (F.associatedGradedMap G φ hφ (F.associatedGradedPieceMap s v))) = η (φ v.val) + rw [F.associatedGradedMap_piece G φ hφ, + G.homogeneousAssociatedGradedEquiv_top_piece c ν hG hc] + +theorem homogeneousGradedProjection_top_frequency_zero + (W : LieSubalgebra ℚ F.AssociatedGraded) + (hW : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule) + (η : M →ₗ[ℚ] ℚ) + (hη : ∀ x ∈ W, basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x → + F.gradedFrequency b ω hF (η.comp φ.toLinearMap) x = 0) + {y : M} (hy : y ∈ W.map (F.homogeneousGradedProjection G c ν hG hc φ hφ)) + (htop : y ∈ G.layer s) : η y = 0 := by + apply graded_image_frequency_zero (F.associatedGradedBasis b ω hF) ω c ν + (F.homogeneousGradedProjection G c ν hG hc φ hφ).toLinearMap s + (F.homogeneousGradedProjection_gradeProjection G c ν hG hc φ hφ b ω hF s) + W.toSubmodule hW η ?_ hy (G.basisGradeProjection_top c ν hG ⟨y, htop⟩) + intro x hx hpure + exact (F.homogeneousGradedProjection_top_frequency G c ν hG hc φ hφ b ω hF η x hpure).trans + (hη x hx hpure) + +theorem homogeneousGradedProjection_top_le_frequency_ker + (W : LieSubalgebra ℚ F.AssociatedGraded) + (hW : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule) + (η : M →ₗ[ℚ] ℚ) + (hη : ∀ x ∈ W, basisGradeProjection (F.associatedGradedBasis b ω hF) ω s x = x → + F.gradedFrequency b ω hF (η.comp φ.toLinearMap) x = 0) : + (W.map (F.homogeneousGradedProjection G c ν hG hc φ hφ)).toSubmodule ⊓ G.layer s ≤ + LinearMap.ker η := by + intro y hy + exact F.homogeneousGradedProjection_top_frequency_zero G c ν hG hc φ hφ b ω hF W hW η hη + hy.1 hy.2 + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/IndependentCharacterEvents.lean b/lean/OAI/Combinatorics/Progressions/Fourier/IndependentCharacterEvents.lean new file mode 100644 index 0000000000000000000000000000000000000000..208862d85d239e8226179fb8e0e8225a45135ca2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/IndependentCharacterEvents.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Fourier.CharacterCoordinateScale +import OAI.Combinatorics.Progressions.Probability.FiniteConditionedMass + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem independentCharacterEvent_probability_le {I J : Type*} [Fintype J] [DecidableEq J] + {Ω : J → Type*} [∀ j, Fintype (Ω j)] + (p : ∀ j, FiniteProbabilityWeights (Ω j)) (column : ∀ j, Ω j → I → ℤ) + (χ : AddChar (I → ℤ) ℂ) {q : ℝ} + (hsingle : ∀ j, (p j).eventProbability (fun x => χ (column j x) = 1) ≤ q) : + (FiniteProbabilityWeights.pi p).eventProbability (fun x => ∀ j, χ (column j (x j)) = 1) ≤ + q ^ Fintype.card J := by + rw [FiniteProbabilityWeights.eventProbability_pi p (fun j x => χ (column j x) = 1)] + calc + _ ≤ ∏ _j : J, q := Finset.prod_le_prod₀ + (fun j _ => (p j).eventProbability_nonneg _) (fun j _ => hsingle j) + _ = _ := by simp + +theorem largeOrderAnnihilator_probability_le {I J : Type*} + [Fintype I] [Fintype J] [DecidableEq J] + {Ω : J → Type*} [∀ j, Fintype (Ω j)] + (p : ∀ j, FiniteProbabilityWeights (Ω j)) (column : ∀ j, Ω j → I → ℤ) + (bad : (∀ j, Ω j) → Prop) (B R : ℕ) (q : ℕ → ℝ) (hq : ∀ a, 0 ≤ q a) + (hbad : ∀ x, bad x → ∃ χ : AddChar (I → ℤ) ℂ, + B < orderOf χ ∧ orderOf χ ≤ R ∧ ∀ j, χ (column j (x j)) = 1) + (hsingle : ∀ (a : ℕ), B < a → a ≤ R → ∀ χ : AddChar (I → ℤ) ℂ, + orderOf χ = a → ∀ j, (p j).eventProbability (fun x => χ (column j x) = 1) ≤ q a) : + (FiniteProbabilityWeights.pi p).eventProbability bad ≤ + ∑ a : Fin R, if B < a.val + 1 then + ((a.val + 1 : ℕ) : ℝ) ^ Fintype.card I * q (a.val + 1) ^ Fintype.card J else 0 := by + classical + let C := Σ a : Fin R, TorsionLatticeCharacter I (a.val + 1) + let F : C → (∀ j, Ω j) → Prop := fun c x => + B < c.1.val + 1 ∧ orderOf c.2.val = c.1.val + 1 ∧ ∀ j, c.2.val (column j (x j)) = 1 + have hcover (x) (hx : bad x) : ∃ c, F c x := by + obtain ⟨χ, hB, hR, hann⟩ := hbad x hx + let a : Fin R := ⟨orderOf χ - 1, by omega⟩ + have ha : a.val + 1 = orderOf χ := by dsimp [a]; omega + let c : TorsionLatticeCharacter I (a.val + 1) := ⟨χ, by rw [ha]; exact pow_orderOf_eq_one χ⟩ + refine ⟨⟨a, c⟩, ?_⟩ + change B < a.val + 1 ∧ orderOf χ = a.val + 1 ∧ ∀ j, χ (column j (x j)) = 1 + exact ⟨by rwa [ha], ha.symm, hann⟩ + apply ((FiniteProbabilityWeights.pi p).eventProbability_union_bound bad F hcover).trans + change (∑ c : Σ a : Fin R, TorsionLatticeCharacter I (a.val + 1), + (FiniteProbabilityWeights.pi p).eventProbability (F c)) ≤ _ + rw [Fintype.sum_sigma] + apply Finset.sum_le_sum + intro a _ + have hterm (χ : TorsionLatticeCharacter I (a.val + 1)) : + (FiniteProbabilityWeights.pi p).eventProbability (F ⟨a, χ⟩) ≤ + if B < a.val + 1 then q (a.val + 1) ^ Fintype.card J else 0 := by + by_cases hB : B < a.val + 1 + · rw [ite_eq_left hB] + by_cases ho : orderOf χ.val = a.val + 1 + · apply ((FiniteProbabilityWeights.pi p).eventProbability_mono _ _ (fun _ h => h.2.2)).trans + exact independentCharacterEvent_probability_le p column χ.val + (hsingle _ hB (by omega) χ.val ho) + · rw [(FiniteProbabilityWeights.pi p).eventProbability_false _ (fun _ h => ho h.2.1)] + exact pow_nonneg (hq _) _ + · rw [ite_eq_right hB, + (FiniteProbabilityWeights.pi p).eventProbability_false _ (fun _ h => hB h.1)] + calc + _ ≤ ∑ _χ : TorsionLatticeCharacter I (a.val + 1), + if B < a.val + 1 then q (a.val + 1) ^ Fintype.card J else 0 := + Finset.sum_le_sum (fun χ _ => hterm χ) + _ = (Fintype.card (TorsionLatticeCharacter I (a.val + 1)) : ℝ) * + (if B < a.val + 1 then q (a.val + 1) ^ Fintype.card J else 0) := by simp + _ ≤ ((a.val + 1 : ℕ) : ℝ) ^ Fintype.card I * + (if B < a.val + 1 then q (a.val + 1) ^ Fintype.card J else 0) := by + apply mul_le_mul_of_nonneg_right + · exact_mod_cast torsionLatticeCharacter_card_le I (a.val + 1) + · split_ifs + · exact pow_nonneg (hq _) _ + · exact le_rfl + _ = _ := by split_ifs <;> simp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/IntegerBoxCharacterBound.lean b/lean/OAI/Combinatorics/Progressions/Fourier/IntegerBoxCharacterBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d119cdcd5df2c3357d10dd693851a35cc5be9a8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/IntegerBoxCharacterBound.lean @@ -0,0 +1,74 @@ +import OAI.Combinatorics.Progressions.Estimates.AnnihilatorIntervalBound +import OAI.Combinatorics.Progressions.Geometry.FiniteCoordinateSlice +import OAI.Combinatorics.Progressions.Probability.FiniteConditionedMass + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem integerInterval_indicator_expect (a b : ℤ) (hab : a ≤ b) (E : ℤ → Prop) + [DecidablePred E] : + (𝔼 x : Finset.Ico a b, if E x then (1 : ℝ) else 0) = + ((Finset.filter E (Finset.Ico a b)).card : ℝ) / ((b - a : ℤ) : ℝ) := by + classical + rw [Fintype.expect_eq_sum_div_card, + Finset.sum_coe_sort (Finset.Ico a b) (fun x : ℤ => if E x then (1 : ℝ) else 0), + Fintype.card_coe] + have hcard : ((Finset.Ico a b).card : ℝ) = ((b - a : ℤ) : ℝ) := by + exact_mod_cast Int.card_Ico_of_le a b hab + rw [hcard] + congr 1 + simp only [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul, mul_one] + +theorem integerBox_character_expect_le {I K : Type*} + [Fintype I] [DecidableEq I] [Nonempty I] [Fintype K] [DecidableEq K] + (e : I → K) (he : Function.Injective e) (a b : ℤ) (hab : a < b) + (χ : AddChar (I → ℤ) ℂ) (hχ : 0 < orderOf χ) : + (𝔼 x : K → Finset.Ico a b, if χ (fun i => (x (e i) : ℤ)) = 1 then (1 : ℝ) else 0) ≤ + 1 / (orderOf χ : ℝ) ^ (1 / (Fintype.card I : ℝ)) + 1 / ((b - a : ℤ) : ℝ) := by + classical + let : Nonempty (Finset.Ico a b) := ⟨⟨a, Finset.mem_Ico.mpr ⟨le_rfl, hab⟩⟩⟩ + obtain ⟨i, hi⟩ := exists_annihilating_coordinate_bound χ hχ + apply expect_le_of_coordinate_slices (e i) + intro x + have hupdate (y : Finset.Ico a b) : + (fun j => (Function.update x (e i) y (e j) : ℤ)) = + Function.update (fun j => (x (e j) : ℤ)) i (y : ℤ) := by + funext j + by_cases hji : j = i + · subst j + simp + · simp [hji, he.ne hji] + simp_rw [hupdate] + rw [integerInterval_indicator_expect a b hab.le + (fun y => χ (Function.update (fun j => (x (e j) : ℤ)) i y) = 1)] + exact hi _ a b hab + +theorem integerBox_character_probability_le {I K : Type*} + [Fintype I] [DecidableEq I] [Nonempty I] [Fintype K] [DecidableEq K] + (e : I → K) (he : Function.Injective e) (a b : ℤ) (hab : a < b) + (p : FiniteProbabilityWeights (K → Finset.Ico a b)) (C : ℝ) (hC : 0 ≤ C) + (hw : ∀ x, p.weight x ≤ C * (Fintype.card (K → Finset.Ico a b) : ℝ)⁻¹) + (χ : AddChar (I → ℤ) ℂ) (hχ : 0 < orderOf χ) : + p.eventProbability (fun x => χ (fun i => (x (e i) : ℤ)) = 1) ≤ + C * (1 / (orderOf χ : ℝ) ^ (1 / (Fintype.card I : ℝ)) + 1 / ((b - a : ℤ) : ℝ)) := by + classical + let : Nonempty (Finset.Ico a b) := ⟨⟨a, Finset.mem_Ico.mpr ⟨le_rfl, hab⟩⟩⟩ + let u := FiniteProbabilityWeights.uniform (K → Finset.Ico a b) + have h := p.eventProbability_le_of_weight_le u C hw + (fun x => χ (fun i => (x (e i) : ℤ)) = 1) + apply h.trans + apply mul_le_mul_of_nonneg_left _ hC + unfold FiniteProbabilityWeights.eventProbability + rw [FiniteProbabilityWeights.uniform_mean] + exact integerBox_character_expect_le e he a b hab χ hχ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/IntegerPeriodicTorusLift.lean b/lean/OAI/Combinatorics/Progressions/Fourier/IntegerPeriodicTorusLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..df41ba21020c67e741fc65debdae27a4ae7781ad --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/IntegerPeriodicTorusLift.lean @@ -0,0 +1,43 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +variable {ι : Type*} + +noncomputable def integerPeriodicTorusLift (F : (ι → ℝ) → ℂ) (x : UnitAddTorus ι) : ℂ := + F (fun i => (AddCircle.equivIoc 1 0 (x i)).val) + +theorem integerPeriodicTorusLift_coe (F : (ι → ℝ) → ℂ) + (hF : ∀ (x : ι → ℝ) (n : ι → ℤ), F (fun i => x i + (n i : ℝ)) = F x) + (x : ι → ℝ) : integerPeriodicTorusLift F (fun i => (x i : UnitAddCircle)) = F x := by + classical + let y : ι → ℝ := fun i => (AddCircle.equivIoc 1 0 (x i : UnitAddCircle)).val + have hzero (i : ι) : (((y i - x i : ℝ) : UnitAddCircle)) = 0 := by + simp [y] + choose n hn using fun i => (AddCircle.coe_eq_zero_iff (p := (1 : ℝ))).mp (hzero i) + have hy : y = fun i => x i + (n i : ℝ) := by + funext i + have hi : (n i : ℝ) = y i - x i := by simpa only [zsmul_eq_mul, mul_one] using hn i + linarith + change F y = F x + rw [hy, hF] + +theorem continuous_integerPeriodicTorusLift (F : (ι → ℝ) → ℂ) (hc : Continuous F) + (hF : ∀ (x : ι → ℝ) (n : ι → ℤ), F (fun i => x i + (n i : ℝ)) = F x) : + Continuous (integerPeriodicTorusLift F) := by + have hq : IsOpenQuotientMap (fun x : ι → ℝ => fun i => (x i : UnitAddCircle)) := + IsOpenQuotientMap.piMap (fun _ => QuotientAddGroup.isOpenQuotientMap_mk) + apply hq.isQuotientMap.continuous_iff.mpr + convert hc using 1 + funext x + exact integerPeriodicTorusLift_coe F hF x + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/IntegerPolynomialTorusPeriod.lean b/lean/OAI/Combinatorics/Progressions/Fourier/IntegerPolynomialTorusPeriod.lean new file mode 100644 index 0000000000000000000000000000000000000000..827fd3a71004299a5ff37e3df8116dc224433ac8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/IntegerPolynomialTorusPeriod.lean @@ -0,0 +1,56 @@ +import Mathlib.Algebra.MvPolynomial.Eval +import Mathlib.Topology.Instances.AddCircle.Real + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +theorem integerPolynomial_eval_zmod_eq {K : Type*} (P : MvPolynomial K ℤ) + (q : ℕ) (x y : K → ℤ) (hxy : ∀ k, (x k : ZMod q) = (y k : ZMod q)) : + ((eval x P : ℤ) : ZMod q) = ((eval y P : ℤ) : ZMod q) := by + change (Int.castRingHom (ZMod q)) (eval x P) = (Int.castRingHom (ZMod q)) (eval y P) + rw [MvPolynomial.map_eval, MvPolynomial.map_eval] + exact congrArg (fun z => eval z (MvPolynomial.map (Int.castRingHom (ZMod q)) P)) (funext hxy) + +theorem integerPolynomial_eval_sub_dvd {K : Type*} (P : MvPolynomial K ℤ) + (q : ℕ) (x y : K → ℤ) (hxy : ∀ k, (x k : ZMod q) = (y k : ZMod q)) : + (q : ℤ) ∣ eval x P - eval y P := by + apply (ZMod.intCast_zmod_eq_zero_iff_dvd _ q).mp + rw [Int.cast_sub, integerPolynomial_eval_zmod_eq P q x y hxy, sub_self] + +theorem addCircle_int_div_eq_of_dvd_sub (q : ℕ) (a b : ℤ) + (h : (q : ℤ) ∣ a - b) : + (((a : ℝ) / q : ℝ) : AddCircle (1 : ℝ)) = + (((b : ℝ) / q : ℝ) : AddCircle (1 : ℝ)) := by + by_cases hq : q = 0 + · simp [hq] + · let : NeZero q := ⟨hq⟩ + have hab : (a : ZMod q) = (b : ZMod q) := by + apply sub_eq_zero.mp + rw [← Int.cast_sub] + exact (ZMod.intCast_zmod_eq_zero_iff_dvd _ q).mpr h + simpa only [ZMod.toAddCircle_intCast] using congrArg ZMod.toAddCircle hab + +theorem integerPolynomial_eval_addCircle_div_eq {K : Type*} (P : MvPolynomial K ℤ) + (q : ℕ) (x y : K → ℤ) (hxy : ∀ k, (x k : ZMod q) = (y k : ZMod q)) : + ((((eval x P : ℤ) : ℝ) / q : ℝ) : AddCircle (1 : ℝ)) = + ((((eval y P : ℤ) : ℝ) / q : ℝ) : AddCircle (1 : ℝ)) := + addCircle_int_div_eq_of_dvd_sub q _ _ (integerPolynomial_eval_sub_dvd P q x y hxy) + +theorem integerPolynomial_eval_addCircle_div_eq_of_cover {K : Type*} + (P : MvPolynomial K ℤ) (q d : ℕ) (hd : d ∣ q) + (x y : K → ℤ) (hxy : ∀ k, (x k : ZMod q) = (y k : ZMod q)) : + ((((eval x P : ℤ) : ℝ) / d : ℝ) : AddCircle (1 : ℝ)) = + ((((eval y P : ℤ) : ℝ) / d : ℝ) : AddCircle (1 : ℝ)) := by + apply addCircle_int_div_eq_of_dvd_sub + exact (Int.natCast_dvd_natCast.mpr hd).trans (integerPolynomial_eval_sub_dvd P q x y hxy) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/IntegerSupportTorus.lean b/lean/OAI/Combinatorics/Progressions/Fourier/IntegerSupportTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5a9792138c05acbe0e58a80e292331a958f7efd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/IntegerSupportTorus.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Lattices.WeightedCubeIntegerSupport + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def integerSupportTorusFactor (H : ℝ) : ℕ := 2 * ⌈H⌉₊ + 1 + +theorem integerSupportTorusFactor_pos (H : ℝ) : 0 < integerSupportTorusFactor H := by + unfold integerSupportTorusFactor + omega + +theorem integerSupportTorusFactor_gap (H : ℝ) : + 2 * H < (integerSupportTorusFactor H : ℝ) := by + have h := Nat.le_ceil H + simp only [integerSupportTorusFactor, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one] + linarith + +theorem integerSupportTorusFactor_upper {H : ℝ} (hH : 0 ≤ H) : + (integerSupportTorusFactor H : ℝ) ≤ 2 * H + 3 := by + have h := Nat.ceil_lt_add_one hH + simp only [integerSupportTorusFactor, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one] + linarith + +theorem scaled_integer_support_close {J : Type*} (y z center : J → ℤ) {H : ℝ} {K : ℕ} + (hK : 0 < K) (hy : ∀ j, |(y j : ℝ) - center j| ≤ H * K) + (hz : ∀ j, |(z j : ℝ) - center j| ≤ H * K) : + ∀ j, |y j - z j| < (integerSupportTorusFactor H * K : ℕ) := by + intro j + have hK' : (0 : ℝ) < K := by exact_mod_cast hK + have hgap := mul_lt_mul_of_pos_right (integerSupportTorusFactor_gap H) hK' + have ht : |(y j : ℝ) - z j| ≤ 2 * H * K := by + calc + _ = |((y j : ℝ) - center j) + (center j - z j)| := by congr 1; ring + _ ≤ |(y j : ℝ) - center j| + |(center j : ℝ) - z j| := abs_add_le _ _ + _ ≤ H * K + H * K := add_le_add (hy j) (by simpa only [abs_sub_comm] using hz j) + _ = _ := by ring + have hlt := ht.trans_lt hgap + exact_mod_cast hlt + +theorem integerGridMass_eq_imageMass_of_scaled_support {X J : Type*} + [Fintype X] [Fintype J] [DecidableEq J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (center z : J → ℤ) + {H : ℝ} {K : ℕ} (hK : 0 < K) + (hY : ∀ x, p.weight x ≠ 0 → ∀ j, |(Y x j : ℝ) - center j| ≤ H * K) + (hz : ∀ j, |(z j : ℝ) - center j| ≤ H * K) : + integerGridMass p Y (integerSupportTorusFactor H * K) z = finiteImageMass p Y z := by + apply integerGridMass_eq_imageMass + intro x hx + exact scaled_integer_support_close (Y x) z center hK (hY x hx) hz + +theorem grid_scale_factor_le_one (R K j : ℕ) (hR : 0 < R) (hK : 0 < K) : + ((K : ℝ) / (R * K)) ^ j ≤ 1 := by + have hK' : (0 : ℝ) < K := by exact_mod_cast hK + have hR' : (1 : ℝ) ≤ R := by exact_mod_cast hR + apply pow_le_one₀ (by positivity) + apply (div_le_iff₀ (by positivity)).mpr + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/JoinedFrequencyQuotientInjectivity.lean b/lean/OAI/Combinatorics/Progressions/Fourier/JoinedFrequencyQuotientInjectivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..273e5d55bdb981f84657f21a9f0cddbbca34797f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/JoinedFrequencyQuotientInjectivity.lean @@ -0,0 +1,610 @@ +import Mathlib.Algebra.Lie.Prod +import OAI.Combinatorics.Progressions.Estimates.RefilteredPointwiseSplitting +import OAI.Combinatorics.Progressions.Linear.TopSubspaceAdaptedBasis +import OAI.Combinatorics.Progressions.Nilpotent.NiltestProbabilityProjection + +namespace OAI + +section + +namespace Erdos3 + +open Module + +theorem RationalHeightLE.inv {q : ℚ} {H : ℕ} (hq : RationalHeightLE q H) (hne : q ≠ 0) : + RationalHeightLE q⁻¹ H := by + have hn : q.num ≠ 0 := by + intro hn + apply hne + rw [← q.num_div_den, hn, Int.cast_zero, zero_div] + have h := rationalHeightLE_fraction (q.den : ℤ) q.num hn + (by simpa only [Int.natAbs_natCast] using hq.2) hq.1 + have he : q⁻¹ = (q.den : ℚ) / q.num := by + calc + q⁻¹ = ((q.num : ℚ) / q.den)⁻¹ := congrArg Inv.inv q.num_div_den.symm + _ = _ := inv_div _ _ + simpa only [he, Int.cast_natCast] using h + +theorem exists_bounded_frequency_direction {ι V : Type*} [AddCommGroup V] [Module ℚ V] + (b : Basis ι ℚ V) (η : V →ₗ[ℚ] ℚ) (hη : η ≠ 0) + {H : ℕ} (hH : 1 ≤ H) (hheight : ∀ i, RationalHeightLE (η (b i)) H) : + ∃ (v : V) (m : ℕ), 0 < m ∧ m ≤ H ∧ η v = 1 ∧ + (∀ i, RationalHeightLE (b.repr v i) H) ∧ + (fun i => b.repr v i) ∈ denominatorGrid m := by + classical + have hex : ∃ i, η (b i) ≠ 0 := by + by_contra h + push Not at h + apply hη + apply b.ext + intro i + exact h i + obtain ⟨i, hi⟩ := hex + let c := (η (b i))⁻¹ + let v := c • b i + have hc : RationalHeightLE c H := (hheight i).inv hi + have hcoord (j : ι) : b.repr v j = if i = j then c else 0 := by + simp only [v, map_smul, Finsupp.smul_apply, Basis.repr_self, Finsupp.single_apply, smul_eq_mul] + split_ifs <;> simp + refine ⟨v, c.den, c.den_pos, hc.2, ?_, ?_, ?_⟩ + · change η (c • b i) = 1 + rw [map_smul, smul_eq_mul] + exact inv_mul_cancel₀ hi + · intro j + rw [hcoord] + split_ifs + · exact hc + · exact rationalHeightLE_zero hH + · refine ⟨fun j => if i = j then c.num else 0, ?_⟩ + intro j + change (c.den : ℚ) * b.repr v j = ((if i = j then c.num else 0 : ℤ) : ℚ) + rw [hcoord] + by_cases hj : i = j + · simp only [hj, ite_true] + have hcden := (div_eq_iff (show (c.den : ℚ) ≠ 0 from Nat.cast_ne_zero.mpr c.den_ne_zero)).mp c.num_div_den + simpa only [mul_comm] using hcden.symm + · simp only [hj, ite_false, mul_zero, Int.cast_zero] + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem rationalLogHeight_nat_inv_mul (n : ℕ) (hn : 0 < n) {x : ℚ} {p : ℝ} + (hx : rationalLogHeight x ≤ p) : rationalLogHeight ((n : ℚ)⁻¹ * x) ≤ p + n + 1 := by + have hp : 0 ≤ p := (rationalLogHeight_nonneg x).trans hx + have hnheight : RationalHeightLE (n : ℚ) (n + 1) := by simp [RationalHeightLE] + have hinv := hnheight.inv (by exact_mod_cast hn.ne') + apply rationalLogHeight_le_of_height (hinv.mul (rationalHeightLE_ceil_exp hx)) + calc + (((n + 1) * ⌈Real.exp p⌉₊ : ℕ) : ℝ) = ((n : ℝ) + 1) * (⌈Real.exp p⌉₊ : ℝ) := by push_cast; rfl + _ ≤ Real.exp (n : ℝ) * Real.exp (p + 1) := + mul_le_mul (Real.add_one_le_exp _) (ceil_exp_le_exp_add_one hp) + (Nat.cast_nonneg _) (Real.exp_pos _).le + _ = Real.exp (p + n + 1) := by rw [← Real.exp_add]; congr 1; ring + +variable {L : Type*} [AddCommGroup L] [Module ℚ L] + +noncomputable def dividedFrequency (n : ℕ) (η : L →ₗ[ℚ] ℚ) : L →ₗ[ℚ] ℚ := (n : ℚ)⁻¹ • η + +theorem dividedFrequency_compensate (n : ℕ) (hn : 0 < n) (η : L →ₗ[ℚ] ℚ) : + n • dividedFrequency n η = η := by + ext x + simp only [dividedFrequency, LinearMap.smul_apply, nsmul_eq_mul, smul_eq_mul] + rw [← mul_assoc, mul_inv_cancel₀ (by exact_mod_cast hn.ne' : (n : ℚ) ≠ 0), one_mul] + +theorem dividedFrequency_height (n : ℕ) (hn : 0 < n) (η : L →ₗ[ℚ] ℚ) + {p : ℝ} (x : L) (hx : rationalLogHeight (η x) ≤ p) : + rationalLogHeight (dividedFrequency n η x) ≤ p + n + 1 := + rationalLogHeight_nat_inv_mul n hn hx + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module + +variable {ι V : Type*} [AddCommGroup V] [Module ℚ V] + +noncomputable def frequencyKernelProjection (η : V →ₗ[ℚ] ℚ) (v : V) : V →ₗ[ℚ] V := + LinearMap.id - η.smulRight v + +@[simp] theorem frequencyKernelProjection_apply (η : V →ₗ[ℚ] ℚ) (v x : V) : + frequencyKernelProjection η v x = x - η x • v := rfl + +theorem frequencyKernelProjection_range (η : V →ₗ[ℚ] ℚ) (v : V) (hv : η v = 1) : + LinearMap.range (frequencyKernelProjection η v) = LinearMap.ker η := by + ext x + constructor + · rintro ⟨y, rfl⟩ + change η (y - η y • v) = 0 + simp only [map_sub, map_smul, hv, smul_eq_mul, mul_one, sub_self] + · intro hx + refine ⟨x, ?_⟩ + change x - η x • v = x + rw [show η x = 0 from hx, zero_smul, sub_zero] + +theorem frequencyKernel_spanning (b : Basis ι ℚ V) (η : V →ₗ[ℚ] ℚ) (v : V) (hv : η v = 1) : + Submodule.span ℚ (Set.range (fun i => b i - η (b i) • v)) = LinearMap.ker η := by + change Submodule.span ℚ (Set.range (frequencyKernelProjection η v ∘ b)) = _ + rw [Set.range_comp, ← Submodule.map_span, b.span_eq, Submodule.map_top, + frequencyKernelProjection_range η v hv] + +theorem frequencyKernel_spanning_height (b : Basis ι ℚ V) (η : V →ₗ[ℚ] ℚ) (v : V) + {H : ℕ} (hη : ∀ i, RationalHeightLE (η (b i)) H) + (hv : ∀ i, RationalHeightLE (b.repr v i) H) : + ∀ i j, RationalHeightLE (b.repr (b i - η (b i) • v) j) (2 * H ^ 2) := by + classical + intro i j + rw [map_sub, Finsupp.sub_apply, map_smul, Finsupp.smul_apply, smul_eq_mul] + have hbase : RationalHeightLE (b.repr (b i) j) 1 := by + rw [Basis.repr_self, Finsupp.single_apply] + split_ifs + · exact rationalHeightLE_one le_rfl + · exact rationalHeightLE_zero le_rfl + have h := hbase.sub ((hη i).mul (hv j)) + convert h using 1 + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct + +variable {V : Type*} [AddCommGroup V] [Module ℚ V] + +theorem realifyFunctional_eq_rid (η : V →ₗ[ℚ] ℚ) (x : ℝ ⊗[ℚ] V) : + realifyFunctional η x = TensorProduct.rid ℚ ℝ (η.baseChange ℝ x) := by + induction x using TensorProduct.inductionOn with + | tmul r v => + simp only [realifyFunctional_tmul, LinearMap.baseChange_tmul, TensorProduct.rid_tmul, + Rat.smul_def, mul_comm] + | add x y hx hy => simp only [map_add, hx, hy] + +theorem mem_realified_frequency_kernel_iff (η : V →ₗ[ℚ] ℚ) (x : ℝ ⊗[ℚ] V) : + x ∈ (LinearMap.ker η).baseChange ℝ ↔ realifyFunctional η x = 0 := by + rw [realification_ker, LinearMap.mem_ker, realifyFunctional_eq_rid] + constructor + · intro h + rw [h, map_zero] + · intro h + apply (TensorProduct.rid ℚ ℝ).injective + simpa only [map_zero] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct + +variable {V J : Type*} [AddCommGroup V] [Module ℚ V] + +def finiteFrequencyKernel (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) : + List J → Submodule ℚ V + | [] => P + | j :: js => LinearMap.ker (eta j) ⊓ finiteFrequencyKernel P eta js + +theorem mem_finiteFrequencyKernel (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) + (js : List J) (v : V) : + v ∈ finiteFrequencyKernel P eta js ↔ v ∈ P ∧ ∀ j ∈ js, eta j v = 0 := by + induction js with + | nil => simp [finiteFrequencyKernel] + | cons j js ih => + simp only [finiteFrequencyKernel, Submodule.mem_inf, LinearMap.mem_ker, ih, + List.forall_mem_cons] + tauto + +theorem finiteFrequencyKernel_le (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) (js : List J) : + finiteFrequencyKernel P eta js ≤ P := fun v hv => (mem_finiteFrequencyKernel P eta js v).mp hv |>.1 + +theorem mem_real_finiteFrequencyKernel (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) + (js : List J) (v : ℝ ⊗[ℚ] V) : + v ∈ (finiteFrequencyKernel P eta js).baseChange ℝ ↔ + v ∈ P.baseChange ℝ ∧ ∀ j ∈ js, realifyFunctional (eta j) v = 0 := by + induction js with + | nil => simp [finiteFrequencyKernel] + | cons j js ih => + simp only [finiteFrequencyKernel, realification_inf, Submodule.mem_inf, + mem_realified_frequency_kernel_iff, ih, List.forall_mem_cons] + tauto + +def restrictedFrequencySpan (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) (js : List J) : + Submodule ℚ (Module.Dual ℚ P) := + Submodule.span ℚ ((fun j => (eta j).comp P.subtype) '' {j | j ∈ js}) + +theorem mem_restrictedFrequencySpan_coannihilator (P : Submodule ℚ V) + (eta : J → V →ₗ[ℚ] ℚ) (js : List J) (v : P) : + v ∈ (restrictedFrequencySpan P eta js).dualCoannihilator ↔ + (v : V) ∈ finiteFrequencyKernel P eta js := by + change v ∈ ((Submodule.span ℚ ((fun j => (eta j).comp P.subtype) '' {j | j ∈ js})).dualCoannihilator : Set P) ↔ _ + rw [Submodule.coe_dualCoannihilator_span, mem_finiteFrequencyKernel] + simp only [Set.mem_ofPred_eq, Set.forall_mem_image, LinearMap.comp_apply, + Submodule.subtype_apply, v.property, true_and] + +theorem mem_restrictedFrequencySpan_iff [FiniteDimensional ℚ V] (P : Submodule ℚ V) + (eta : J → V →ₗ[ℚ] ℚ) (js : List J) (xi : V →ₗ[ℚ] ℚ) : + xi.comp P.subtype ∈ restrictedFrequencySpan P eta js ↔ + ∀ v ∈ finiteFrequencyKernel P eta js, xi v = 0 := by + rw [← Subspace.dualCoannihilator_dualAnnihilator_eq (W := restrictedFrequencySpan P eta js), + Submodule.mem_dualAnnihilator] + constructor + · intro h v hv + let x : P := ⟨v, finiteFrequencyKernel_le P eta js hv⟩ + exact h x ((mem_restrictedFrequencySpan_coannihilator P eta js x).mpr hv) + · intro h v hv + exact h v ((mem_restrictedFrequencySpan_coannihilator P eta js v).mp hv) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct + +theorem realifyFunctional_comp {V W : Type*} [AddCommGroup V] [Module ℚ V] + [AddCommGroup W] [Module ℚ W] (eta : W →ₗ[ℚ] ℚ) (f : V →ₗ[ℚ] W) (x : ℝ ⊗[ℚ] V) : + realifyFunctional (eta.comp f) x = realifyFunctional eta (f.baseChange ℝ x) := by + induction x using TensorProduct.inductionOn with + | tmul a v => simp only [realifyFunctional_tmul, LinearMap.baseChange_tmul, LinearMap.comp_apply] + | add x y hx hy => simp only [map_add, hx, hy] + +theorem projected_frequency_zero_on_kernel {V W Z J : Type*} + [AddCommGroup V] [Module ℚ V] [AddCommGroup W] [Module ℚ W] + [AddCommGroup Z] [Module ℚ Z] + (P : Submodule ℚ V) (f : V →ₗ[ℚ] W) (g : V →ₗ[ℚ] Z) + (eta : J → W →ₗ[ℚ] ℚ) (xi : J → Z →ₗ[ℚ] ℚ) + (hzero : ∀ j x, x ∈ P → eta j (f x) + xi j (g x) = 0) : + ∀ x ∈ P ⊓ LinearMap.ker g, ∀ j, eta j (f x) = 0 := by + intro x hx j + have h := hzero j x hx.1 + simpa only [show g x = 0 from hx.2, map_zero, add_zero] using h + +theorem projected_real_frequency_zero_on_kernel {V W Z J : Type*} + [AddCommGroup V] [Module ℚ V] [AddCommGroup W] [Module ℚ W] + [AddCommGroup Z] [Module ℚ Z] + (P : Submodule ℚ V) (f : V →ₗ[ℚ] W) (g : V →ₗ[ℚ] Z) + (eta : J → W →ₗ[ℚ] ℚ) (xi : J → Z →ₗ[ℚ] ℚ) + (hzero : ∀ j x, x ∈ P → eta j (f x) + xi j (g x) = 0) : + ∀ x ∈ (P ⊓ LinearMap.ker g).baseChange ℝ, ∀ j, + realifyFunctional (eta j) (f.baseChange ℝ x) = 0 := by + intro x hx j + have hle : P ⊓ LinearMap.ker g ≤ LinearMap.ker ((eta j).comp f) := by + intro v hv + exact projected_frequency_zero_on_kernel P f g eta xi hzero v hv j + have h := (mem_realified_frequency_kernel_iff ((eta j).comp f) x).mp + (Submodule.baseChange_mono ℝ hle hx) + rwa [realifyFunctional_comp] at h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +theorem basisGradedSubmodule_iInf {ι J V : Type*} [AddCommGroup V] [Module ℚ V] + (b : Basis ι ℚ V) (w : ι → ℕ) (U : J → Submodule ℚ V) + (hU : ∀ j, BasisGradedSubmodule b w (U j)) : BasisGradedSubmodule b w (⨅ j, U j) := by + intro k x hx + simp only [Submodule.mem_iInf] at hx ⊢ + exact fun j => hU j k x (hx j) + +namespace NilpotentLieFiltration + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (w : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + +theorem associatedGradedPieceMap_grade_fixed (j : ℕ) (x : F.layer j) : + basisGradeProjection (F.associatedGradedBasis b w hF) w j (F.associatedGradedPieceMap j x) = + F.associatedGradedPieceMap j x := by + rw [← F.gradedPieceProjection_eq_pieceMap b w hF j x] + apply (F.associatedGradedBasis b w hF).repr.injective + ext i + simp only [basisGradeProjection_repr, F.gradedPieceProjection_coordinate] + split_ifs <;> rfl + +theorem frequency_zero_on_refiltered_top (U : LieSubalgebra ℚ F.AssociatedGraded) + (eta : L →ₗ[ℚ] ℚ) + (hzero : ∀ x ∈ U, basisGradeProjection (F.associatedGradedBasis b w hF) w s x = x → + F.gradedFrequency b w hF eta x = 0) : + ∀ x ∈ F.gradedRefiltrationLayer U s, eta x = 0 := by + intro x hx + obtain ⟨hxs, hxU⟩ := (F.mem_gradedRefiltrationLayer U s x).mp hx + rw [← F.gradedFrequency_top_piece b w hF eta ⟨x, hxs⟩] + exact hzero _ hxU (F.associatedGradedPieceMap_grade_fixed b w hF s ⟨x, hxs⟩) + +theorem real_frequency_zero_on_refiltered_top (U : LieSubalgebra ℚ F.AssociatedGraded) + (eta : L →ₗ[ℚ] ℚ) + (hzero : ∀ x ∈ U, basisGradeProjection (F.associatedGradedBasis b w hF) w s x = x → + F.gradedFrequency b w hF eta x = 0) : + ∀ x ∈ F.realGradedRefiltrationLayer U s, realifyFunctional eta x = 0 := by + have hle : F.gradedRefiltrationLayer U s ≤ LinearMap.ker eta := + F.frequency_zero_on_refiltered_top b w hF U eta hzero + intro x hx + exact (mem_realified_frequency_kernel_iff eta x).mp (Submodule.baseChange_mono ℝ hle hx) + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.Niltest + +open Module CircleFourier +open scoped TensorProduct BigOperators + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} + +theorem exists_positive_frequency_projection_of_decomposition + (T : D.Niltest (fun _ : Unit => 1)) (hT : T.UnitIntervalValued) + {p : ℝ} (hTc : T.ComplexityLE p) {J : Type*} [Fintype J] + (eta : J → L →ₗ[ℚ] ℚ) (U : J → D.Niltest (fun _ : Unit => 1)) + (horbit : ∀ j, (U j).orbit = T.orbit) + (hvertical : ∀ j (z : D.RealGroup), z ∈ D.filtration.realification.subgroup s → ∀ x, + (U j).observable (z • x) = + character ((realifyFunctional (eta j) z.coord : ℝ) : CircleFourier.Circle) * (U j).observable x) + {N : ℕ} [NeZero N] (weight : ZMod N → ℂ) {B rho tau : ℝ} + (hB : 0 ≤ B) (htau : 0 ≤ tau) (hweight : ∀ x, ‖weight x‖ ≤ B) + (happrox : ∀ x, ‖T.observable x - ∑ j, (U j).observable x‖ ≤ rho) : + ∃ S : D.Niltest (fun _ : Unit => 1), S.UnitIntervalValued ∧ S.ComplexityLE p ∧ + S.orbit = T.orbit ∧ + (∀ z : D.RealGroup, z ∈ D.filtration.realification.subgroup s → + (∀ j, tau < ‖𝔼 n, weight n * (U j).evalCyclic N (fun _ => n)‖ → + realifyFunctional (eta j) z.coord = 0) → + ∀ x, S.observable (z • x) = S.observable x) ∧ + ‖(𝔼 n, weight n * T.evalCyclic N (fun _ => n)) - + (𝔼 n, weight n * S.evalCyclic N (fun _ => n))‖ ≤ + 2 * B * rho + Fintype.card J * tau := by + classical + let := D.metricSpace + let : FiniteDimensional ℚ L := D.basis.finiteDimensional_of_finite + let active : Finset J := Finset.univ.filter + (fun j => tau < ‖𝔼 n, weight n * (U j).evalCyclic N (fun _ => n)‖) + let js := active.toList + let K := finiteFrequencyKernel (D.filtration.layer s) eta js + have hK : K ≤ D.filtration.layer s := finiteFrequencyKernel_le _ _ _ + let b := Module.finBasis ℚ K + let v : Fin (finrank ℚ K) → L := fun i => b i + have hv (i : Fin (finrank ℚ K)) : v i ∈ D.filtration.layer s := hK (b i).property + let A : Fin (finrank ℚ K) → IsometricCircleAction D.Space := + fun i => D.centralRationalCircle (v i) (hv i) + have hfreq (j : J) (i : Fin (finrank ℚ K)) : ∃ n : ℤ, + (∀ t x, (U j).observable ((A i).act t x) = character (n • t) * (U j).observable x) ∧ + (eta j (v i) = 0 → n = 0) := + D.exists_centralRationalCircle_frequency (v i) (hv i) (eta j) (U j).observable (hvertical j) + choose n heigen hzero using hfreq + let is := List.finRange (finrank ℚ K) + have hcomm : ∀ i ∈ is, ∀ j ∈ is, (A i).Commutes (A j) := + fun i _ j _ => D.centralRationalCircle_commutes (v i) (v j) (hv i) (hv j) + have hsignificant (j : J) + (hj : tau < ‖𝔼 n, weight n * (U j).evalCyclic N (fun _ => n)‖) : + ∀ i ∈ is, n j i = 0 := by + intro i _ + apply hzero j i + have hj' : j ∈ js := by simpa only [js, active, Finset.mem_toList, Finset.mem_filter, + Finset.mem_univ, true_and] using hj + exact ((mem_finiteFrequencyKernel _ _ _ (v i)).mp (b i).property).2 j hj' + obtain ⟨S, hS, hSc, hSo, hSinv, herror⟩ := T.exists_positive_circle_projection hT hTc A is hcomm + U n horbit weight hB htau hweight happrox (fun j i _ => heigen j i) hsignificant + refine ⟨S, hS, hSc, hSo, ?_, herror⟩ + intro z hz hzeta x + have hzK : z.coord ∈ K.baseChange ℝ := by + apply (mem_real_finiteFrequencyKernel (D.filtration.layer s) eta js z.coord).mpr + refine ⟨hz, ?_⟩ + intro j hj + apply hzeta j + simpa only [js, active, Finset.mem_toList, Finset.mem_filter, Finset.mem_univ, true_and] using hj + exact D.invariant_of_kernel_circles K hK b S.observable + (fun i t y => hSinv i (by simp [is]) t y) z hzK x + +end Erdos3.RationalFilteredNilmanifold.Niltest + +end + +section + +namespace Erdos3 + +open Module + +variable {V I J : Type*} [AddCommGroup V] [Module ℚ V] + +theorem finiteFrequencyKernel_eq_map_coannihilator (P : Submodule ℚ V) + (eta : J → V →ₗ[ℚ] ℚ) (js : List J) : + finiteFrequencyKernel P eta js = + (restrictedFrequencySpan P eta js).dualCoannihilator.map P.subtype := by + ext v + constructor + · intro hv + let x : P := ⟨v, finiteFrequencyKernel_le P eta js hv⟩ + exact ⟨x, (mem_restrictedFrequencySpan_coannihilator P eta js x).mpr hv, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact (mem_restrictedFrequencySpan_coannihilator P eta js x).mp hx + +theorem finiteFrequencyKernel_eq_of_span_eq (P : Submodule ℚ V) + (eta : J → V →ₗ[ℚ] ℚ) (js : List J) (xi : I → V →ₗ[ℚ] ℚ) (is : List I) + (hspan : restrictedFrequencySpan P eta js = restrictedFrequencySpan P xi is) : + finiteFrequencyKernel P eta js = finiteFrequencyKernel P xi is := by + rw [finiteFrequencyKernel_eq_map_coannihilator, finiteFrequencyKernel_eq_map_coannihilator, hspan] + +theorem exists_restricted_frequency_basis [FiniteDimensional ℚ V] (P : Submodule ℚ V) + (eta : J → V →ₗ[ℚ] ℚ) (js : List J) : + ∃ m : ℕ, m ≤ finrank ℚ P ∧ ∃ indices : Fin m → J, + (∀ i, indices i ∈ js) ∧ + LinearIndependent ℚ (fun i => (eta (indices i)).comp P.subtype) ∧ + Submodule.span ℚ (Set.range (fun i => (eta (indices i)).comp P.subtype)) = + restrictedFrequencySpan P eta js := by + classical + let W := restrictedFrequencySpan P eta js + obtain ⟨u, hu, hspan, hlin⟩ := Submodule.exists_fun_fin_finrank_span_eq ℚ + ((fun j => (eta j).comp P.subtype) '' {j | j ∈ js}) + have hex (i : Fin (finrank ℚ W)) : + ∃ j, j ∈ js ∧ (eta j).comp P.subtype = u i := hu i + choose indices hindices heq using hex + have hfun : (fun i => (eta (indices i)).comp P.subtype) = u := funext heq + refine ⟨finrank ℚ W, ?_, indices, hindices, ?_, ?_⟩ + · have hdim := Subspace.finrank_add_finrank_dualCoannihilator_eq W + omega + · rw [hfun] + exact hlin + · rw [hfun] + exact hspan + +theorem restrictedFrequencySpan_finRange (P : Submodule ℚ V) {m : ℕ} + (eta : Fin m → V →ₗ[ℚ] ℚ) : + restrictedFrequencySpan P eta (List.finRange m) = + Submodule.span ℚ (Set.range (fun i => (eta i).comp P.subtype)) := by + unfold restrictedFrequencySpan + congr 1 + ext x + simp + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L Y W J : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing Y] [LieAlgebra ℚ Y] [LieRing W] [LieAlgebra ℚ W] {s : ℕ} + (F : NilpotentLieFiltration L s) (π : L →ₗ⁅ℚ⁆ Y) + (eta : J → L →ₗ[ℚ] ℚ) (js : List J) + +def pivotAnnihilatorIdeal : LieIdeal ℚ L := + F.topSubspaceIdeal (finiteFrequencyKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta js) + ((finiteFrequencyKernel_le _ _ _).trans inf_le_left) + +theorem mem_pivotAnnihilatorIdeal (x : L) : + x ∈ F.pivotAnnihilatorIdeal π eta js ↔ + x ∈ F.layer s ∧ π x = 0 ∧ ∀ j ∈ js, eta j x = 0 := by + change x ∈ finiteFrequencyKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta js ↔ _ + rw [mem_finiteFrequencyKernel] + change ((x ∈ F.layer s ∧ π x = 0) ∧ ∀ j ∈ js, eta j x = 0) ↔ _ + exact and_assoc + +noncomputable def pivotQuotientMarkedMap : (L ⧸ F.pivotAnnihilatorIdeal π eta js) →ₗ⁅ℚ⁆ Y := + lieQuotientDescend (F.pivotAnnihilatorIdeal π eta js) π + (fun x hx => ((F.mem_pivotAnnihilatorIdeal π eta js x).mp hx).2.1) + +noncomputable def pivotQuotientFrequency (j : J) (hj : j ∈ js) : + (L ⧸ F.pivotAnnihilatorIdeal π eta js) →ₗ[ℚ] ℚ := + (F.pivotAnnihilatorIdeal π eta js).toSubmodule.liftQ (eta j) + (fun x hx => ((F.mem_pivotAnnihilatorIdeal π eta js x).mp hx).2.2 j hj) + +@[simp] theorem pivotQuotientMarkedMap_mk (x : L) : + F.pivotQuotientMarkedMap π eta js (lieQuotientMap (F.pivotAnnihilatorIdeal π eta js) x) = + π x := rfl + +@[simp] theorem pivotQuotientFrequency_mk (j : J) (hj : j ∈ js) (x : L) : + F.pivotQuotientFrequency π eta js j hj + (lieQuotientMap (F.pivotAnnihilatorIdeal π eta js) x) = eta j x := rfl + +noncomputable def pivotProductQuotientMap : + (L × W) →ₗ⁅ℚ⁆ (L ⧸ F.pivotAnnihilatorIdeal π eta js) × W := + (lieQuotientMap (F.pivotAnnihilatorIdeal π eta js)).prodMap (LieHom.id : W →ₗ⁅ℚ⁆ W) + +noncomputable def pivotProductMarkedMap : + ((L ⧸ F.pivotAnnihilatorIdeal π eta js) × W) →ₗ⁅ℚ⁆ (Y × W) := + (F.pivotQuotientMarkedMap π eta js).prodMap (LieHom.id : W →ₗ⁅ℚ⁆ W) + +@[simp] theorem pivotProductMarkedMap_quotient (x : L × W) : + F.pivotProductMarkedMap π eta js (F.pivotProductQuotientMap π eta js x) = + (π x.1, x.2) := rfl + +variable (partner : J → W →ₗ[ℚ] ℚ) + +def joinedFrequencyTop : Submodule ℚ (L × W) := + finiteFrequencyKernel ((F.layer s).prod (⊤ : Submodule ℚ W)) + (fun j => (eta j).comp (LinearMap.fst ℚ L W) + + (partner j).comp (LinearMap.snd ℚ L W)) js + +theorem mem_joinedFrequencyTop (x : L × W) : + x ∈ F.joinedFrequencyTop eta js partner ↔ + x.1 ∈ F.layer s ∧ ∀ j ∈ js, eta j x.1 + partner j x.2 = 0 := by + rw [joinedFrequencyTop, mem_finiteFrequencyKernel] + simp only [Submodule.mem_prod, Submodule.mem_top, and_true, + LinearMap.add_apply, LinearMap.comp_apply, LinearMap.fst_apply, LinearMap.snd_apply] + +noncomputable def joinedFrequencyQuotientTop : + Submodule ℚ ((L ⧸ F.pivotAnnihilatorIdeal π eta js) × W) := + (F.joinedFrequencyTop eta js partner).map (F.pivotProductQuotientMap π eta js).toLinearMap + +theorem joinedFrequencyQuotientTop_constraint + (x : (L ⧸ F.pivotAnnihilatorIdeal π eta js) × W) + (hx : x ∈ F.joinedFrequencyQuotientTop π eta js partner) (j : J) (hj : j ∈ js) : + F.pivotQuotientFrequency π eta js j hj x.1 + partner j x.2 = 0 := by + obtain ⟨y, hy, rfl⟩ := hx + exact ((F.mem_joinedFrequencyTop eta js partner y).mp hy).2 j hj + +theorem joinedFrequencyQuotientTop_kernel_eq_zero + (x : (L ⧸ F.pivotAnnihilatorIdeal π eta js) × W) + (hx : x ∈ F.joinedFrequencyQuotientTop π eta js partner) + (hzero : F.pivotProductMarkedMap π eta js x = 0) : x = 0 := by + obtain ⟨y, hy, rfl⟩ := hx + have hπ : π y.1 = 0 := congrArg Prod.fst hzero + have hpartner : y.2 = 0 := congrArg Prod.snd hzero + obtain ⟨htop, hconstraints⟩ := (F.mem_joinedFrequencyTop eta js partner y).mp hy + have hmem : y.1 ∈ F.pivotAnnihilatorIdeal π eta js := by + apply (F.mem_pivotAnnihilatorIdeal π eta js y.1).mpr + refine ⟨htop, hπ, ?_⟩ + intro j hj + simpa only [hpartner, map_zero, add_zero] using hconstraints j hj + apply Prod.ext + · exact (lieQuotientMap_eq_zero (F.pivotAnnihilatorIdeal π eta js) y.1).mpr hmem + · exact hpartner + +theorem joinedFrequencyQuotientTop_injective : + Function.Injective (fun x : F.joinedFrequencyQuotientTop π eta js partner => + F.pivotProductMarkedMap π eta js x.val) := by + intro x y hxy + change F.pivotProductMarkedMap π eta js x.val = + F.pivotProductMarkedMap π eta js y.val at hxy + apply Subtype.ext + apply sub_eq_zero.mp + apply F.joinedFrequencyQuotientTop_kernel_eq_zero π eta js partner (x.val - y.val) + ((F.joinedFrequencyQuotientTop π eta js partner).sub_mem x.property y.property) + rw [map_sub, hxy, sub_self] + +theorem joinedFastTop_kernel_eq_zero + (T : Submodule ℚ ((L ⧸ F.pivotAnnihilatorIdeal π eta js) × W)) + (hT : T ≤ F.joinedFrequencyQuotientTop π eta js partner) + (x : (L ⧸ F.pivotAnnihilatorIdeal π eta js) × W) (hx : x ∈ T) + (hzero : F.pivotProductMarkedMap π eta js x = 0) : x = 0 := + F.joinedFrequencyQuotientTop_kernel_eq_zero π eta js partner x (hT hx) hzero + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/JoinedFrequencyRefilteredTop.lean b/lean/OAI/Combinatorics/Progressions/Fourier/JoinedFrequencyRefilteredTop.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c9b26595537e94f85af938d1c4a71bfd2c8f945 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/JoinedFrequencyRefilteredTop.lean @@ -0,0 +1,63 @@ +import OAI.Combinatorics.Progressions.Estimates.StrongRefiltrationReconstruction + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem graded_top_kernel_iff_refiltered_top_kernel + {ι L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s : ℕ} + (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M s) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) + (U : LieSubalgebra ℚ F.AssociatedGraded) : + (∀ a ∈ U, basisGradeProjection (F.associatedGradedBasis e ω hF) ω s a = a → + F.associatedGradedMap G φ hφ a = 0 → a = 0) ↔ + (∀ x ∈ F.gradedRefiltrationLayer U s, φ x = 0 → x = 0) := by + constructor + · exact fun htop => F.gradedRefiltrationLayer_top_kernel_eq_zero G e ω hF φ hφ U htop + · intro htop a ha hpure hzero + obtain ⟨x, hx⟩ := F.exists_associatedGradedPieceMap_of_pure e ω hF s a hpure + have hxU : (x : L) ∈ F.gradedRefiltrationLayer U s := by + apply (F.mem_gradedRefiltrationLayer U s x).mpr + exact ⟨x.property, hx.symm ▸ ha⟩ + have hpiece : G.associatedGradedPieceMap s ⟨φ x, hφ s x x.property⟩ = 0 := by + rw [← F.associatedGradedMap_piece G φ hφ s x, hx] + exact hzero + have hφzero : φ x = 0 := by + have hmem := (G.associatedGradedPieceMap_eq_zero_iff s + ⟨φ x, hφ s x x.property⟩).mp hpiece + rw [G.terminal] at hmem + exact hmem + have hxzero : x = 0 := Subtype.ext (htop x hxU hφzero) + rw [← hx, hxzero, map_zero] + +theorem joinedFrequency_graded_refiltered_top_kernel + {ι L Y W J : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing Y] [LieAlgebra ℚ Y] [LieRing W] [LieAlgebra ℚ W] {s : ℕ} + (F : NilpotentLieFiltration L s) (π : L →ₗ⁅ℚ⁆ Y) + (eta : J → L →ₗ[ℚ] ℚ) (js : List J) (partner : J → W →ₗ[ℚ] ℚ) + (H : NilpotentLieFiltration ((L ⧸ F.pivotAnnihilatorIdeal π eta js) × W) s) + (G : NilpotentLieFiltration (Y × W) s) + (e : Basis ι ℚ ((L ⧸ F.pivotAnnihilatorIdeal π eta js) × W)) (ω : ι → ℕ) + (hH : ∀ j, H.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (hφ : ∀ j, ∀ x ∈ H.layer j, F.pivotProductMarkedMap π eta js x ∈ G.layer j) + (U : LieSubalgebra ℚ H.AssociatedGraded) + (hjoined : H.gradedRefiltrationLayer U s ≤ F.joinedFrequencyQuotientTop π eta js partner) : + ∀ a ∈ U, basisGradeProjection (H.associatedGradedBasis e ω hH) ω s a = a → + H.associatedGradedMap G (F.pivotProductMarkedMap π eta js) hφ a = 0 → a = 0 := by + apply (H.graded_top_kernel_iff_refiltered_top_kernel G e ω hH + (F.pivotProductMarkedMap π eta js) hφ U).mpr + intro x hx hzero + exact F.joinedFrequencyQuotientTop_kernel_eq_zero π eta js partner x (hjoined hx) hzero + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/LatticeCoordinateResidueFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/LatticeCoordinateResidueFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..10049842506683bf149f46d3ee50dd2bc7814696 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/LatticeCoordinateResidueFourier.lean @@ -0,0 +1,213 @@ +import Mathlib.LinearAlgebra.Matrix.ToLin +import OAI.Combinatorics.Progressions.Lattices.StandardLatticeCoordinates + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Matrix + +theorem rectangularGridCharacter_zmod {I : Type*} [Fintype I] + (M : ℕ) [NeZero M] (k : I → Fin M) (x : I → ℤ) : + rectangularGridCharacter M k x = CircleFourier.character + (ZMod.toAddCircle (∑ i, ((k i).val : ZMod M) * (x i : ZMod M))) := by + rw [map_sum, CircleFourier.character_fintype_sum] + rfl + +noncomputable def pullbackResidueFrequency {I J : Type*} [Fintype I] + (A : Matrix I J ℤ) (M : ℕ) [NeZero M] (k : I → Fin M) (j : J) : Fin M := + ⟨(∑ i, ((k i).val : ZMod M) * (A i j : ZMod M)).val, ZMod.val_lt _⟩ + +theorem pullbackResidueFrequency_cast {I J : Type*} [Fintype I] + (A : Matrix I J ℤ) (M : ℕ) [NeZero M] (k : I → Fin M) (j : J) : + ((pullbackResidueFrequency A M k j).val : ZMod M) = + ∑ i, ((k i).val : ZMod M) * (A i j : ZMod M) := ZMod.natCast_zmod_val _ + +theorem pullbackResidueFrequency_normalized_bounds {I J : Type*} [Fintype I] + (A : Matrix I J ℤ) (M : ℕ) [NeZero M] (k : I → Fin M) (j : J) : + 0 ≤ ((pullbackResidueFrequency A M k j).val : ℝ) / M ∧ + ((pullbackResidueFrequency A M k j).val : ℝ) / M < 1 := by + have hM : (0 : ℝ) < M := by exact_mod_cast Nat.pos_of_ne_zero (NeZero.ne M) + refine ⟨div_nonneg (Nat.cast_nonneg _) hM.le, (div_lt_one hM).mpr ?_⟩ + exact_mod_cast (pullbackResidueFrequency A M k j).isLt + +theorem rectangularGridCharacter_mulVec {I J : Type*} [Fintype I] [Fintype J] + (A : Matrix I J ℤ) (M : ℕ) [NeZero M] (k : I → Fin M) (x : J → ℤ) : + rectangularGridCharacter M k (A *ᵥ x) = + rectangularGridCharacter M (pullbackResidueFrequency A M k) x := by + rw [rectangularGridCharacter_zmod, rectangularGridCharacter_zmod] + apply congrArg CircleFourier.character + apply congrArg ZMod.toAddCircle + simp only [Matrix.mulVec, dotProduct, Int.cast_sum, Int.cast_mul, + pullbackResidueFrequency_cast, Finset.mul_sum, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro i _ + ring + +theorem exists_integerMap_character_frequency {I J : Type*} [Fintype I] [Fintype J] + [DecidableEq J] (f : (J → ℤ) →ₗ[ℤ] (I → ℤ)) (M : ℕ) [NeZero M] (k : I → Fin M) : + ∃ ell : J → Fin M, ∀ x, rectangularGridCharacter M k (f x) = rectangularGridCharacter M ell x := by + refine ⟨pullbackResidueFrequency (LinearMap.toMatrix' f) M k, ?_⟩ + intro x + rw [← LinearMap.toMatrix'_mulVec f x] + exact rectangularGridCharacter_mulVec _ M k x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def residueGridRepresentative {I : Type*} (M : ℕ) (r : I → ZMod M) : I → ℤ := + fun i => (r i).val + +theorem integerGridResidue_representative {I : Type*} (M : ℕ) [NeZero M] (r : I → ZMod M) : + integerGridResidue M (residueGridRepresentative M r) = r := by + funext i + change (((r i).val : ℤ) : ZMod M) = r i + simp only [Int.cast_natCast, ZMod.natCast_zmod_val] + +noncomputable def residueFunctionCoefficient {I : Type*} [Fintype I] [DecidableEq I] + (M : ℕ) [NeZero M] (F : (I → ZMod M) → ℂ) (k : I → Fin M) : ℂ := + 𝔼 r, F r * star (rectangularGridCharacter M k (residueGridRepresentative M r)) + +theorem residueFunctionCoefficient_norm_le {I : Type*} [Fintype I] [DecidableEq I] + (M : ℕ) [NeZero M] (F : (I → ZMod M) → ℂ) (hF : ∀ r, ‖F r‖ ≤ 1) (k : I → Fin M) : + ‖residueFunctionCoefficient M F k‖ ≤ 1 := by + unfold residueFunctionCoefficient + apply (RCLike.norm_expect_le (K := ℂ)).trans + apply Finset.expect_le Finset.univ_nonempty + intro r _ + simpa only [norm_mul, norm_star, rectangularGridCharacter_norm, mul_one] using hF r + +theorem residueFunctionCoefficient_mass_le {I : Type*} [Fintype I] [DecidableEq I] + (M : ℕ) [NeZero M] (F : (I → ZMod M) → ℂ) (hF : ∀ r, ‖F r‖ ≤ 1) : + (∑ k : I → Fin M, ‖residueFunctionCoefficient M F k‖) ≤ (M : ℝ) ^ Fintype.card I := by + calc + _ ≤ ∑ _k : I → Fin M, (1 : ℝ) := Finset.sum_le_sum + (fun k _ => residueFunctionCoefficient_norm_le M F hF k) + _ = _ := by simp + +theorem residueFunctionFourier_inversion {I : Type*} [Fintype I] [DecidableEq I] + (M : ℕ) [NeZero M] (F : (I → ZMod M) → ℂ) (x : I → ℤ) : + (∑ k : I → Fin M, residueFunctionCoefficient M F k * rectangularGridCharacter M k x) = + F (integerGridResidue M x) := by + classical + calc + _ = 𝔼 r : I → ZMod M, F r * + (∑ k : I → Fin M, rectangularGridCharacter M k x * + star (rectangularGridCharacter M k (residueGridRepresentative M r))) := by + simp only [residueFunctionCoefficient, Finset.expect_mul] + rw [← Finset.expect_sum_comm] + apply Finset.expect_congr rfl + intro r _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + ring + _ = 𝔼 r : I → ZMod M, if integerGridResidue M x = r then + (M : ℂ) ^ Fintype.card I * F (integerGridResidue M x) else 0 := by + apply Finset.expect_congr rfl + intro r _ + rw [rectangularGridCharacter_orthogonality, integerGridResidue_representative] + by_cases hr : integerGridResidue M x = r + · rw [← hr] + simp [mul_comm] + · simp [hr] + _ = _ := by + have hM : (M : ℂ) ^ Fintype.card I ≠ 0 := + pow_ne_zero _ (Nat.cast_ne_zero.mpr (NeZero.ne M)) + rw [Fintype.expect_eq_sum_div_card] + simp [hM] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Matrix Classical + +theorem integerMap_residue_fourier_expansion {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + [DecidableEq J] (f : (J → ℤ) →ₗ[ℤ] (I → ℤ)) (M : ℕ) [NeZero M] + (F : (I → ZMod M) → ℂ) (hF : ∀ r, ‖F r‖ ≤ 1) : + ∃ (c : (I → Fin M) → ℂ) (ell : (I → Fin M) → J → Fin M), + (∀ k, ‖c k‖ ≤ 1) ∧ + (∑ k, ‖c k‖) ≤ (M : ℝ) ^ Fintype.card I ∧ + (∀ k j, 0 ≤ ((ell k j).val : ℝ) / M ∧ ((ell k j).val : ℝ) / M < 1) ∧ + ∀ x, F (integerResidueMap I M (f x)) = + ∑ k, c k * CircleFourier.character + ((∑ j, (((ell k j).val : ℝ) / M) * (x j : ℝ) : ℝ) : CircleFourier.Circle) := by + refine ⟨residueFunctionCoefficient M F, pullbackResidueFrequency (LinearMap.toMatrix' f) M, + residueFunctionCoefficient_norm_le M F hF, residueFunctionCoefficient_mass_le M F hF, ?_, ?_⟩ + · exact fun k j => pullbackResidueFrequency_normalized_bounds _ M k j + · intro x + calc + _ = ∑ k, residueFunctionCoefficient M F k * rectangularGridCharacter M k (f x) := + (residueFunctionFourier_inversion M F (f x)).symm + _ = ∑ k, residueFunctionCoefficient M F k * + rectangularGridCharacter M (pullbackResidueFrequency (LinearMap.toMatrix' f) M k) x := by + apply Finset.sum_congr rfl + intro k _ + rw [← LinearMap.toMatrix'_mulVec f x, rectangularGridCharacter_mulVec] + _ = _ := by simp only [rectangularGridCharacter_eq] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module Submodule +open scoped BigOperators Classical + +theorem latticeCoordinate_residue_fourier_expansion {D I J : Type*} + [Fintype D] [DecidableEq D] [Fintype I] [Fintype J] + (W : Submodule ℝ (EuclideanSpace ℝ D)) + (bW : Basis I ℤ (latticeSection (standardEuclideanLattice D) W)) + (bP : Basis J ℝ Wᗮ) (hP : span ℤ (Set.range bP) = projectedIntegerLattice W) + (M : ℕ) [NeZero M] (F : (J ⊕ I → ZMod M) → ℂ) (hF : ∀ r, ‖F r‖ ≤ 1) : + ∃ (c : ((J ⊕ I) → Fin M) → ℂ) (ell : ((J ⊕ I) → Fin M) → D → Fin M), + (∀ k, ‖c k‖ ≤ 1) ∧ + (∑ k, ‖c k‖) ≤ (M : ℝ) ^ Fintype.card (J ⊕ I) ∧ + (∀ k j, 0 ≤ ((ell k j).val : ℝ) / M ∧ ((ell k j).val : ℝ) / M < 1) ∧ + ∀ β, F (integerResidueMap (J ⊕ I) M (standardLatticeCoordinates W bW bP hP β)) = + ∑ k, c k * CircleFourier.character + ((∑ j, (((ell k j).val : ℝ) / M) * (β j : ℝ) : ℝ) : CircleFourier.Circle) := + integerMap_residue_fourier_expansion (standardLatticeCoordinates W bW bP hP).toLinearMap M F hF + +theorem latticeCoordinate_congruence_fourier_expansion {D I J : Type*} + [Fintype D] [DecidableEq D] [Fintype I] [Fintype J] + (W : Submodule ℝ (EuclideanSpace ℝ D)) + (bW : Basis I ℤ (latticeSection (standardEuclideanLattice D) W)) + (bP : Basis J ℝ Wᗮ) (hP : span ℤ (Set.range bP) = projectedIntegerLattice W) + (M : ℕ) [NeZero M] (Good : (J ⊕ I → ZMod M) → Prop) [DecidablePred Good] : + ∃ (c : ((J ⊕ I) → Fin M) → ℂ) (ell : ((J ⊕ I) → Fin M) → D → Fin M), + (∑ k, ‖c k‖) ≤ (M : ℝ) ^ Fintype.card (J ⊕ I) ∧ + (∀ k j, 0 ≤ ((ell k j).val : ℝ) / M ∧ ((ell k j).val : ℝ) / M < 1) ∧ + ∀ β, (if Good (integerResidueMap (J ⊕ I) M (standardLatticeCoordinates W bW bP hP β)) + then (1 : ℂ) else 0) = + ∑ k, c k * CircleFourier.character + ((∑ j, (((ell k j).val : ℝ) / M) * (β j : ℝ) : ℝ) : CircleFourier.Circle) := by + obtain ⟨c, ell, _, hc, he, h⟩ := latticeCoordinate_residue_fourier_expansion W bW bP hP M + (fun r => if Good r then (1 : ℂ) else 0) (by intro r; split <;> simp) + exact ⟨c, ell, hc, he, h⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/LatticeGaussianMeanFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/LatticeGaussianMeanFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..55c4d0b157c2ad663f3ebd844109b1de35431ab8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/LatticeGaussianMeanFourier.lean @@ -0,0 +1,88 @@ +import OAI.Combinatorics.Progressions.Lattices.LatticeGaussianPoisson +import OAI.Combinatorics.Progressions.Polynomial.SchmidtGaussianMean + +namespace OAI + +section + +namespace Erdos3 + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + (Λ : Submodule ℤ E) [DiscreteTopology Λ] [IsZLattice ℝ Λ] + +omit [MeasurableSpace E] [BorelSpace E] in +theorem latticeGaussian_fourier_summable_norm {t : ℝ} (ht : 0 < t) (x : E) : + Summable (fun ξ : euclideanDualLattice Λ => + ‖(Real.exp (-Real.pi / t * ‖(ξ : E)‖ ^ 2) : ℂ) * euclideanCharacter (ξ : E) x‖) := by + simpa only [norm_mul, norm_euclideanCharacter, mul_one, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos (Real.exp_pos _), zero_sub, norm_neg, div_eq_mul_inv] using + lattice_gaussian_summable (euclideanDualLattice Λ) (inv_pos.mpr ht) 0 + +omit [MeasurableSpace E] [BorelSpace E] in +theorem latticeGaussian_fourier_summable {t : ℝ} (ht : 0 < t) (x : E) : + Summable (fun ξ : euclideanDualLattice Λ => + (Real.exp (-Real.pi / t * ‖(ξ : E)‖ ^ 2) : ℂ) * euclideanCharacter (ξ : E) x) := + (latticeGaussian_fourier_summable_norm Λ ht x).of_norm + +theorem normalizedLatticeGaussian_zero_eq_dual {t : ℝ} (ht : 0 < t) : + normalizedLatticeGaussian Λ t 0 = latticeGaussianMass (euclideanDualLattice Λ) t⁻¹ 0 := by + apply Complex.ofReal_injective + rw [normalizedLatticeGaussian_poisson Λ ht] + simp only [euclideanCharacter_zero, mul_one, latticeGaussianMass, Complex.ofReal_tsum, + zero_sub, norm_neg, div_eq_mul_inv] + +theorem normalizedLatticeGaussian_le_origin {t : ℝ} (ht : 0 < t) (x : E) : + normalizedLatticeGaussian Λ t x ≤ normalizedLatticeGaussian Λ t 0 := by + calc + _ = ‖(normalizedLatticeGaussian Λ t x : ℂ)‖ := by + simp only [Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (normalizedLatticeGaussian_nonneg Λ t x)] + _ = ‖∑' ξ : euclideanDualLattice Λ, + (Real.exp (-Real.pi / t * ‖(ξ : E)‖ ^ 2) : ℂ) * euclideanCharacter (ξ : E) x‖ := by + rw [normalizedLatticeGaussian_poisson Λ ht] + _ ≤ ∑' ξ : euclideanDualLattice Λ, + ‖(Real.exp (-Real.pi / t * ‖(ξ : E)‖ ^ 2) : ℂ) * euclideanCharacter (ξ : E) x‖ := + norm_tsum_le_tsum_norm (latticeGaussian_fourier_summable_norm Λ ht x) + _ = latticeGaussianMass (euclideanDualLattice Λ) t⁻¹ 0 := by + simp only [norm_mul, norm_euclideanCharacter, mul_one, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos (Real.exp_pos _), latticeGaussianMass, + zero_sub, norm_neg, div_eq_mul_inv] + _ = _ := (normalizedLatticeGaussian_zero_eq_dual Λ ht).symm + +theorem normalizedLatticeGaussian_origin_mono {s t : ℝ} (hs : 0 < s) (hst : s ≤ t) : + normalizedLatticeGaussian Λ s 0 ≤ normalizedLatticeGaussian Λ t 0 := by + rw [normalizedLatticeGaussian_zero_eq_dual Λ hs, + normalizedLatticeGaussian_zero_eq_dual Λ (hs.trans_le hst)] + exact latticeGaussianMass_antitone (euclideanDualLattice Λ) (inv_pos.mpr (hs.trans_le hst)) + (inv_le_inv₀ (hs.trans_le hst) hs |>.mpr hst) 0 + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +theorem latticeGaussianMean_fourier (Λ : Submodule ℤ E) [DiscreteTopology Λ] [IsZLattice ℝ Λ] + {t : ℝ} (ht : 0 < t) (k : ℕ) (α : E) (N : ℕ) : + (latticeGaussianMean Λ t k α N : ℂ) = + ∑' ξ : euclideanDualLattice Λ, + (Real.exp (-Real.pi / t * ‖(ξ : E)‖ ^ 2) : ℂ) * monomialCharacterMean k α N ξ := by + unfold monomialCharacterMean + simp only [← mul_div_assoc, Finset.mul_sum] + rw [tsum_div_const] + rw [Summable.tsum_finsetSum (s := Finset.Icc (-(N : ℤ)) (N : ℤ)) + (fun (n : ℤ) _ => latticeGaussian_fourier_summable Λ ht ((n : ℝ) ^ k • α))] + simp only [← normalizedLatticeGaussian_poisson Λ ht] + simp only [latticeGaussianMean, Complex.ofReal_div, Complex.ofReal_sum, Complex.ofReal_natCast] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/LatticeTorusFourierCoefficient.lean b/lean/OAI/Combinatorics/Progressions/Fourier/LatticeTorusFourierCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fb181505698dbff9ae7842f7cafdb1d65df3dfa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/LatticeTorusFourierCoefficient.lean @@ -0,0 +1,94 @@ +import OAI.Combinatorics.Progressions.Fourier.IntegerPeriodicTorusLift +import OAI.Combinatorics.Progressions.Lattices.LatticeDualCoordinates +import OAI.Combinatorics.Progressions.Lattices.LatticeGaussianCoefficient +import OAI.Combinatorics.Progressions.Lattices.LatticeSheetHaar + +namespace OAI + +section + +namespace Erdos3 + +variable {ι E : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] + [FiniteDimensional ℝ E] (Λ : Submodule ℤ E) [DiscreteTopology Λ] [IsZLattice ℝ Λ] + +theorem latticeBasis_integerCoordinates (b : Module.Basis ι ℤ Λ) (n : ι → ℤ) : + (b.ofZLatticeBasis ℝ Λ).equivFun.symm (fun i => (n i : ℝ)) = (b.equivFun.symm n : E) := by + apply (b.ofZLatticeBasis ℝ Λ).equivFun.injective + ext i + rw [LinearEquiv.apply_symm_apply] + change (n i : ℝ) = (b.ofZLatticeBasis ℝ Λ).repr (b.equivFun.symm n : E) i + rw [Module.Basis.ofZLatticeBasis_repr_apply] + exact (congrArg (fun z : ℤ => (z : ℝ)) (congrFun (b.equivFun.apply_symm_apply n) i)).symm + +theorem latticeGaussian_integer_periodic (b : Module.Basis ι ℤ Λ) (t : ℝ) + (x : ι → ℝ) (n : ι → ℤ) : + latticeGaussianMass Λ t ((b.ofZLatticeBasis ℝ Λ).equivFun.symm (fun i => x i + (n i : ℝ))) = + latticeGaussianMass Λ t ((b.ofZLatticeBasis ℝ Λ).equivFun.symm x) := by + change latticeGaussianMass Λ t ((b.ofZLatticeBasis ℝ Λ).equivFun.symm (x + (fun i => (n i : ℝ)))) = _ + rw [map_add, latticeBasis_integerCoordinates] + exact latticeGaussianMass_add_lattice Λ t _ _ + +noncomputable def latticeGaussianTorus (b : Module.Basis ι ℤ Λ) {t : ℝ} (ht : 0 < t) : + C(UnitAddTorus ι, ℂ) where + toFun := integerPeriodicTorusLift (fun x => + (latticeGaussianMass Λ t ((b.ofZLatticeBasis ℝ Λ).equivFun.symm x) : ℂ)) + continuous_toFun := continuous_integerPeriodicTorusLift _ + (Complex.continuous_ofReal.comp ((continuous_latticeGaussianMass Λ ht).comp + (b.ofZLatticeBasis ℝ Λ).equivFunL.symm.continuous)) + (fun x n => congrArg (fun z : ℝ => (z : ℂ)) (latticeGaussian_integer_periodic Λ b t x n)) + +theorem latticeGaussianTorus_coe (b : Module.Basis ι ℤ Λ) {t : ℝ} (ht : 0 < t) + (x : ι → ℝ) : + latticeGaussianTorus Λ b ht (fun i => (x i : UnitAddCircle)) = + (latticeGaussianMass Λ t ((b.ofZLatticeBasis ℝ Λ).equivFun.symm x) : ℂ) := + integerPeriodicTorusLift_coe (fun y => + (latticeGaussianMass Λ t ((b.ofZLatticeBasis ℝ Λ).equivFun.symm y) : ℂ)) + (fun y n => congrArg (fun z : ℝ => (z : ℂ)) (latticeGaussian_integer_periodic Λ b t y n)) x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory Module + +variable {ι E : Type*} [Fintype ι] [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + (Λ : Submodule ℤ E) [DiscreteTopology Λ] [IsZLattice ℝ Λ] + +theorem latticeGaussianTorus_coefficient (b : Basis ι ℤ Λ) {t : ℝ} (ht : 0 < t) (n : ι → ℤ) : + (ZLattice.covolume Λ : ℂ) * UnitAddTorus.mFourierCoeff (latticeGaussianTorus Λ b ht) n = + ((((Real.sqrt t) ^ Module.finrank ℝ E)⁻¹ * + Real.exp (-Real.pi / t * ‖latticeDualPoint Λ b n‖ ^ 2) : ℝ) : ℂ) := by + classical + let bR := b.ofZLatticeBasis ℝ Λ + let f : E → ℂ := fun x => euclideanCharacter (-latticeDualPoint Λ b n) x * + (latticeGaussianMass Λ t x : ℂ) + have hsets : Set.pi Set.univ (fun _ : ι => Set.Ioc (0 : ℝ) 1) =ᵐ[volume] + Set.pi Set.univ (fun _ : ι => Set.Ico (0 : ℝ) 1) := + (Measure.ae_eq_set_pi (μ := fun _ : ι => (volume : Measure ℝ)) + (fun _ _ => Ico_ae_eq_Ioc)).symm + have hcoeff : UnitAddTorus.mFourierCoeff (latticeGaussianTorus Λ b ht) n = + ∫ x : ι → ℝ in Set.pi Set.univ (fun _ => Set.Ico (0 : ℝ) 1), f (bR.equivFun.symm x) := by + rw [UnitAddTorus.mFourierCoeff_eq_integral _ _ (fun _ => 0)] + simp only [zero_add, smul_eq_mul] + have he : {x : ι → ℝ | ∀ i, x i ∈ Set.Ioc (0 : ℝ) 1} = + Set.pi Set.univ (fun _ : ι => Set.Ioc (0 : ℝ) 1) := by ext; simp + rw [he, setIntegral_congr_set hsets] + apply integral_congr_ae + filter_upwards [] with x + rw [latticeGaussianTorus_coe, ← latticeDualPoint_character Λ b (-n) x, latticeDualPoint_neg] + rw [hcoeff, latticeBasis_integral_cube] + exact latticeGaussian_integral_character Λ (ZSpan.fundamentalDomain bR) + (ZSpan.fundamentalDomain_measurableSet bR) (ZSpan.fundamentalDomain_isBounded bR) + (ZLattice.isAddFundamentalDomain b volume) ht _ (latticeDualPoint_mem Λ b n) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/LayeredFourierCharacter.lean b/lean/OAI/Combinatorics/Progressions/Fourier/LayeredFourierCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6316f58171b640b346a9929c5ead33c08f5be3f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/LayeredFourierCharacter.lean @@ -0,0 +1,53 @@ +import OAI.Combinatorics.Progressions.Estimates.SubspaceLayeredModeSmoothRemoval + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open CircleFourier +open scoped BigOperators + +noncomputable def layeredCoefficientCharacter {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 → ℝ) : ℂ := + character (((∑ j, L j (substitute (fun u => rowPolynomial (fun k => b k u)) (p j))) : ℝ) : + CircleFourier.Circle) + +noncomputable def layeredSiteWeight {I K S : Type*} [Fintype K] [Fintype S] + (Q : MvPolynomial (K × I) ℝ) (site : S → K → ℤ) + (test : S → (I → ℝ) → ℂ) (b : K → I → ℝ) : ℂ := + character ((MvPolynomial.eval (fun z => b z.1 z.2) Q : ℝ) : CircleFourier.Circle) * + ∏ s, test s (integerSiteValue (site s) b) + +theorem layeredCoefficientCharacter_norm {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 → ℝ) : + ‖layeredCoefficientCharacter L p b‖ = 1 := norm_character _ + +theorem layeredSiteWeight_norm_le {I K S : Type*} [Fintype K] [Fintype S] + (Q : MvPolynomial (K × I) ℝ) (site : S → K → ℤ) + (test : S → (I → ℝ) → ℂ) (htest : ∀ s x, ‖test s x‖ ≤ 1) (b : K → I → ℝ) : + ‖layeredSiteWeight Q site test b‖ ≤ 1 := by + rw [layeredSiteWeight, norm_mul, norm_character, one_mul, norm_prod] + exact Finset.prod_le_one₀ (fun s _ => norm_nonneg _) (fun s _ => htest s _) + +theorem layeredModeTestedPhase_eq_weight_mul {I K S : Type*} [Fintype K] [Fintype S] {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)) (Q : MvPolynomial (K × I) ℝ) + (site : S → K → ℤ) (test : S → (I → ℝ) → ℂ) (b : K → I → ℝ) : + layeredModeTestedPhase L p Q site test b = + layeredSiteWeight Q site test b * layeredCoefficientCharacter L p b := by + unfold layeredModeTestedPhase layeredSiteWeight layeredCoefficientCharacter + rw [AddCircle.coe_add, character_add] + ring + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/LocalBohrAlmostPeriodsRelative.lean b/lean/OAI/Combinatorics/Progressions/Fourier/LocalBohrAlmostPeriodsRelative.lean new file mode 100644 index 0000000000000000000000000000000000000000..5535ae917cbbf9e09d001b948490f58d7dd2a7f5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/LocalBohrAlmostPeriodsRelative.lean @@ -0,0 +1,513 @@ +import OAI.Combinatorics.Progressions.Estimates.CyclicCutNeighborhood +import OAI.Combinatorics.Progressions.Estimates.CyclicRelativeChang +import OAI.Combinatorics.Progressions.Estimates.LocalBoostedAlmostPeriods + +namespace OAI + +section + +namespace Erdos3.CyclicBohr.Set + +open Finset +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +noncomputable def characterBasis (Delta : Finset (AddChar (ZMod N) ℂ)) + (r : ℝ≥0) : Set N := + ofFrequencies (Delta.map AddChar.zmodAddEquiv.symm.toEmbedding) r r.coe_nonneg + +@[simp] theorem rank_characterBasis (Delta : Finset (AddChar (ZMod N) ℂ)) (r : ℝ≥0) : + (characterBasis Delta r).rank = Delta.card := by + simp [characterBasis] + +@[simp] theorem radius_characterBasis (Delta : Finset (AddChar (ZMod N) ℂ)) (r : ℝ≥0) : + (characterBasis Delta r).radius = r := rfl + +theorem norm_one_sub_le_of_mem_characterBasis + {Delta : Finset (AddChar (ZMod N) ℂ)} {r : ℝ≥0} {x : ZMod N} + (hx : x ∈ characterBasis Delta r) {psi : AddChar (ZMod N) ℂ} (hpsi : psi ∈ Delta) : + ‖1 - psi x‖ ≤ r := by + have hmem : AddChar.zmodAddEquiv.symm psi ∈ + Delta.map AddChar.zmodAddEquiv.symm.toEmbedding := + Finset.mem_map.mpr ⟨psi, hpsi, rfl⟩ + have h := mem_iff.mp hx _ hmem + simpa only [characterBasis, radius_ofFrequencies, character, + AddEquiv.apply_symm_apply] using h + +theorem norm_one_sub_le_of_mem_characterBasis_addSpan + {Delta : Finset (AddChar (ZMod N) ℂ)} {r : ℝ≥0} {x : ZMod N} + (hx : x ∈ characterBasis Delta r) {psi : AddChar (ZMod N) ℂ} + (hpsi : psi ∈ Delta.addSpan) : + ‖1 - psi x‖ ≤ (Delta.card : ℝ) * r := by + obtain ⟨epsilon, hepsilon, hsum⟩ := Finset.mem_addSpan.mp hpsi + rw [← hsum, AddChar.sum_apply] + calc + ‖1 - ∏ gamma ∈ Delta, (epsilon gamma • gamma) x‖ ≤ + ∑ gamma ∈ Delta, ‖1 - (epsilon gamma • gamma) x‖ := + norm_one_sub_prod_le_sum Delta _ (fun gamma _ => by simp) + _ ≤ ∑ _gamma ∈ Delta, (r : ℝ) := by + apply Finset.sum_le_sum + intro gamma hgamma + have h := norm_one_sub_le_of_mem_characterBasis hx hgamma + rcases hepsilon gamma with hneg | hzero | hone + · rw [hneg, neg_one_zsmul, AddChar.neg_apply, AddChar.map_neg_eq_conj] + have heq : ‖1 - (starRingEnd ℂ) (gamma x)‖ = ‖1 - gamma x‖ := by + simpa using (RCLike.norm_conj (1 - gamma x)) + rwa [heq] + · simp [hzero] + · simpa [hone] using h + _ = (Delta.card : ℝ) * r := by simp + +noncomputable def adjoinCharacters (B : Set N) + (Delta : Finset (AddChar (ZMod N) ℂ)) (sigma r : ℝ≥0) : Set N := + (B.ndilate sigma).meet (characterBasis Delta r) + +theorem rank_adjoinCharacters_le (B : Set N) + (Delta : Finset (AddChar (ZMod N) ℂ)) (sigma r : ℝ≥0) : + (adjoinCharacters B Delta sigma r).rank ≤ B.rank + Delta.card := by + simpa only [adjoinCharacters, rank_ndilate, rank_characterBasis] using + rank_meet_le (B.ndilate sigma) (characterBasis Delta r) + +@[simp] theorem radius_adjoinCharacters (B : Set N) + (Delta : Finset (AddChar (ZMod N) ℂ)) (sigma r : ℝ≥0) : + (adjoinCharacters B Delta sigma r).radius = min ((sigma : ℝ) * B.radius) r := by + simp only [adjoinCharacters, radius_meet, radius_ndilate, radius_characterBasis] + +theorem adjoinCharacters_subset_ndilate (B : Set N) + (Delta : Finset (AddChar (ZMod N) ℂ)) (sigma r : ℝ≥0) : + (adjoinCharacters B Delta sigma r).carrier ⊆ (B.ndilate sigma).carrier := + carrier_meet_subset_left _ _ + +theorem norm_one_sub_le_of_relative_cover + (B : Set N) (hBreg : B.IsRankRegular) + {Delta Q : Finset (AddChar (ZMod N) ℂ)} {sigma r : ℝ≥0} + (hsigma : sigma ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (hcover : ∀ psi ∈ Q, ∃ z ∈ Delta.addSpan, + ∃ s ∈ Chang.largeSpectrum B.carrier (1 / 2), psi = z + s) + {x : ZMod N} (hx : x ∈ adjoinCharacters B Delta sigma r) + {psi : AddChar (ZMod N) ℂ} (hpsi : psi ∈ Q) : + ‖1 - psi x‖ ≤ (Delta.card : ℝ) * r + + 800 * ((max B.rank 1 : ℕ) : ℝ) * sigma := by + obtain ⟨z, hz, s, hs, rfl⟩ := hcover psi hpsi + have hxB := adjoinCharacters_subset_ndilate B Delta sigma r hx + have hxDelta : x ∈ characterBasis Delta r := + carrier_meet_subset_right (B.ndilate sigma) (characterBasis Delta r) hx + have hzbound := norm_one_sub_le_of_mem_characterBasis_addSpan hxDelta hz + have hsbound := Erdos3.norm_one_sub_le_of_mem_largeSpectrum_half hBreg hsigma hs hxB + rw [AddChar.add_apply] + exact (norm_one_sub_mul_of_norm_le_one (by simp)).trans (add_le_add hzbound hsbound) + +theorem exists_regular_bohr_of_relative_cover + (B : Set N) (hBpos : 0 < B.radius) (hBreg : B.IsRankRegular) + {Delta Q : Finset (AddChar (ZMod N) ℂ)} {sigma r : ℝ≥0} + (hsigma0 : 0 < sigma) (hr0 : 0 < r) + (hsigma : sigma ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (hcover : ∀ psi ∈ Q, ∃ z ∈ Delta.addSpan, + ∃ s ∈ Chang.largeSpectrum B.carrier (1 / 2), psi = z + s) : + ∃ R : Set N, R.IsRankRegular ∧ R.rank ≤ B.rank + Delta.card ∧ + min ((sigma : ℝ) * B.radius) r / 2 ≤ R.radius ∧ + R.radius ≤ min ((sigma : ℝ) * B.radius) r ∧ + R.carrier ⊆ (B.ndilate sigma).carrier ∧ + ∀ x ∈ R.carrier, ∀ psi ∈ Q, + ‖1 - psi x‖ ≤ (Delta.card : ℝ) * r + + 800 * ((max B.rank 1 : ℕ) : ℝ) * sigma := by + let D := adjoinCharacters B Delta sigma r + have hDpos : 0 < D.radius := by + rw [radius_adjoinCharacters] + exact lt_min (mul_pos (by exact_mod_cast hsigma0) hBpos) (by exact_mod_cast hr0) + obtain ⟨R, hfreq, hRreg, hlo, hhi, hsub, _⟩ := + exists_controlled_regular_subdilate D hDpos 1 (by norm_num) le_rfl + have hRD : R.carrier ⊆ D.carrier := by simpa only [ndilate_one] using hsub + have hrank : R.rank = D.rank := congrArg Finset.card hfreq + refine ⟨R, hRreg, hrank.le.trans (rank_adjoinCharacters_le B Delta sigma r), ?_, ?_, + hRD.trans (adjoinCharacters_subset_ndilate B Delta sigma r), ?_⟩ + · simpa only [NNReal.coe_one, one_mul, D, radius_adjoinCharacters] using hlo + · simpa only [NNReal.coe_one, one_mul, D, radius_adjoinCharacters] using hhi + · intro x hx psi hpsi + exact norm_one_sub_le_of_relative_cover B hBreg hsigma hcover (hRD hx) hpsi + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.RelativeChangSanders + +open scoped NNReal + +variable {N : ℕ} [NeZero N] + +theorem localChangBaseScale_pos (B : CyclicBohr.Set N) (X : Finset (ZMod N)) (eta : ℝ) : + 0 < localChangBaseScale B X eta := by + unfold localChangBaseScale + positivity + +theorem exists_regular_relative_spectrum_controller + (B : CyclicBohr.Set N) (hBpos : 0 < B.radius) (hBreg : B.IsRankRegular) + (X : Finset (ZMod N)) (hX : X.Nonempty) (hXB : X ⊆ B.carrier) + (eta : ℝ) (heta : 0 < eta) (sigma r : ℝ≥0) + (hsigma0 : 0 < sigma) (hr0 : 0 < r) + (hsigma : sigma ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) : + ∃ rho : ℝ≥0, ∃ C : CyclicBohr.Set N, + ∃ Delta : Finset (AddChar (ZMod N) ℂ), ∃ R : CyclicBohr.Set N, + 1 / 2 ≤ rho ∧ rho ≤ 1 ∧ + C = B.ndilate (rho * localChangBaseScale B X eta) ∧ + C.IsRankRegular ∧ + (Delta.card : ℝ) ≤ localChangDimension B X eta ∧ + Delta ⊆ Chang.largeSpectrum X eta ∧ + R.IsRankRegular ∧ R.rank ≤ B.rank + Delta.card ∧ + min ((sigma : ℝ) * ((localChangBaseScale B X eta : ℝ) * B.radius / 2)) r / 2 ≤ + R.radius ∧ + R.radius ≤ min ((sigma : ℝ) * ((localChangBaseScale B X eta : ℝ) * B.radius)) r ∧ + R.carrier ⊆ (C.ndilate sigma).carrier ∧ + ∀ x ∈ R.carrier, ∀ psi ∈ Chang.largeSpectrum X eta, + ‖1 - psi x‖ ≤ localChangDimension B X eta * r + + 800 * ((max B.rank 1 : ℕ) : ℝ) * sigma := by + obtain ⟨rho, C, Delta, hrho0, hrho1, hC, hCreg, hcard, hDelta, hcover⟩ := + exists_relativeLargeSpectrum_cover B hBpos hBreg X hX hXB eta heta + have hCrank : C.rank = B.rank := by simp [hC] + have hrho0R : (1 / 2 : ℝ) ≤ rho := by exact_mod_cast hrho0 + have hrho1R : (rho : ℝ) ≤ 1 := by exact_mod_cast hrho1 + have ha : (0 : ℝ) < localChangBaseScale B X eta := by + exact_mod_cast localChangBaseScale_pos B X eta + have hCradius : C.radius = (rho : ℝ) * ((localChangBaseScale B X eta : ℝ) * B.radius) := by + simp only [hC, CyclicBohr.Set.radius_ndilate, NNReal.coe_mul, mul_assoc] + have hCpos : 0 < C.radius := by + rw [hCradius] + exact mul_pos (by linarith) (mul_pos ha hBpos) + have hClo : (localChangBaseScale B X eta : ℝ) * B.radius / 2 ≤ C.radius := by + rw [hCradius] + nlinarith [mul_nonneg ha.le hBpos.le] + have hChi : C.radius ≤ (localChangBaseScale B X eta : ℝ) * B.radius := by + rw [hCradius] + nlinarith [mul_nonneg ha.le hBpos.le] + have hsigmaC : sigma ≤ 1 / (100 * (2 * max C.rank 1 : ℕ) : ℝ≥0) := by + simpa only [hCrank] using hsigma + obtain ⟨R, hRreg, hRrank, hRlo, hRhi, hRsub, hRphase⟩ := + CyclicBohr.Set.exists_regular_bohr_of_relative_cover + C hCpos hCreg hsigma0 hr0 hsigmaC hcover + refine ⟨rho, C, Delta, R, hrho0, hrho1, hC, hCreg, hcard, hDelta, hRreg, + ?_, ?_, ?_, hRsub, ?_⟩ + · simpa only [hCrank] using hRrank + · apply le_trans _ hRlo + exact div_le_div_of_nonneg_right + (min_le_min_right (r : ℝ) (mul_le_mul_of_nonneg_left hClo sigma.coe_nonneg)) + (by norm_num) + · apply hRhi.trans + exact min_le_min_right (r : ℝ) (mul_le_mul_of_nonneg_left hChi sigma.coe_nonneg) + · intro x hx psi hpsi + have hphase := hRphase x hx psi hpsi + rw [hCrank] at hphase + exact hphase.trans (add_le_add + (mul_le_mul_of_nonneg_right hcard r.coe_nonneg) le_rfl) + +end Erdos3.RelativeChangSanders + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] + +theorem finiteFourierCoeff_finiteIndicator (A : Finset G) (psi : AddChar G ℂ) : + finiteFourierCoeff (finiteIndicator A) psi = + (∑ a ∈ A, star (psi a)) / (Fintype.card G : ℂ) := by + simp [finiteFourierCoeff, Fintype.expect_eq_sum_div_card, finiteIndicator, ite_mul] + +theorem finiteFourierCoeff_averagingKernel {A : Finset G} (hA : A.Nonempty) + (psi : AddChar G ℂ) : + finiteFourierCoeff (averagingKernel A) psi = setFourierMultiplier A psi := by + have hN : (Fintype.card G : ℂ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + have hcard : (A.card : ℂ) ≠ 0 := by exact_mod_cast hA.card_pos.ne' + have heq : finiteFourierCoeff (averagingKernel A) psi = + ((Fintype.card G : ℂ) / A.card) * finiteFourierCoeff (finiteIndicator A) psi := by + unfold finiteFourierCoeff averagingKernel + simp only [mul_assoc, Finset.mul_expect] + rw [heq, finiteFourierCoeff_finiteIndicator, setFourierMultiplier, + Finset.expect_eq_sum_div_card] + field_simp + +theorem sum_sq_setFourierMultiplier {A : Finset G} (hA : A.Nonempty) : + (∑ psi : AddChar G ℂ, ‖setFourierMultiplier A psi‖ ^ 2) = + (Fintype.card G : ℝ) / A.card := by + simp_rw [← finiteFourierCoeff_averagingKernel hA] + rw [finiteFourier_parseval, mean_averagingKernel_norm_sq hA] + +theorem fourierL1_triple_average_sq_le {A L : Finset G} + (hA : A.Nonempty) (hL : L.Nonempty) (M : Finset G) : + fourierL1 (finiteSetAverage L (finiteSetAverage A (finiteIndicator M))) ^ 2 ≤ + (M.card : ℝ) / L.card := by + let s : ℝ := ∑ psi : AddChar G ℂ, + ‖setFourierMultiplier L psi‖ * ‖finiteFourierCoeff (finiteIndicator M) psi‖ + have hbound : fourierL1 (finiteSetAverage L (finiteSetAverage A (finiteIndicator M))) ≤ s := by + unfold fourierL1 + apply Finset.sum_le_sum + intro psi _ + rw [finiteFourierCoeff_finiteSetAverage, finiteFourierCoeff_finiteSetAverage] + simp only [norm_mul] + have hAone := norm_setFourierMultiplier_le_one hA psi + exact mul_le_mul_of_nonneg_left + (mul_le_of_le_one_left (norm_nonneg _) hAone) (norm_nonneg _) + have hnonneg : 0 ≤ fourierL1 + (finiteSetAverage L (finiteSetAverage A (finiteIndicator M))) := + Finset.sum_nonneg (fun _ _ => norm_nonneg _) + have hCS : s ^ 2 ≤ + (∑ psi : AddChar G ℂ, ‖setFourierMultiplier L psi‖ ^ 2) * + ∑ psi : AddChar G ℂ, ‖finiteFourierCoeff (finiteIndicator M) psi‖ ^ 2 := + Finset.sum_mul_sq_le_sq_mul_sq Finset.univ _ _ + rw [sum_sq_setFourierMultiplier hL, finiteFourier_parseval, mean_indicator_norm_sq] at hCS + have hN : (Fintype.card G : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + have hcancel : ((Fintype.card G : ℝ) / L.card) * (M.card / (Fintype.card G : ℝ)) = + (M.card : ℝ) / L.card := by field_simp + exact (pow_le_pow_left₀ hnonneg hbound 2).trans (hCS.trans_eq hcancel) + +theorem fourierL1_triple_average_le {A L : Finset G} + (hA : A.Nonempty) (hL : L.Nonempty) (M : Finset G) : + fourierL1 (finiteSetAverage L (finiteSetAverage A (finiteIndicator M))) ≤ + Real.sqrt ((M.card : ℝ) / L.card) := + Real.le_sqrt_of_sq_le (fourierL1_triple_average_sq_le hA hL M) + +end Erdos3 + +end + +section + +namespace Erdos3.CyclicCrootSisask + +open scoped BigOperators + +variable {N : ℕ} [NeZero N] + +omit [NeZero N] in +theorem finiteSetAverage_ofReal (A : Finset (ZMod N)) (u : ZMod N → ℝ) : + finiteSetAverage A (fun x => (u x : ℂ)) = fun x => (setAverageTranslate A u x : ℂ) := by + funext x + rw [finiteSetAverage, Finset.expect_eq_sum_div_card, setAverageTranslate] + push_cast + rfl + +omit [NeZero N] in +theorem iteratedFiniteSetAverage_ofReal (A : Finset (ZMod N)) (u : ZMod N → ℝ) (q : ℕ) : + iteratedFiniteSetAverage A (fun x => (u x : ℂ)) q = + fun x => (iteratedSetAverage A u q x : ℂ) := by + induction q with + | zero => rfl + | succ q ih => + rw [iteratedFiniteSetAverage, ih, finiteSetAverage_ofReal] + rfl + +omit [NeZero N] in +theorem finiteIndicator_eq_ofReal_realSetIndicator (M : Finset (ZMod N)) : + finiteIndicator M = fun x => (realSetIndicator M x : ℂ) := by + funext x + by_cases hx : x ∈ M <;> simp [finiteIndicator, realSetIndicator, hx] + +omit [NeZero N] in +theorem triple_average_ofReal (A L M : Finset (ZMod N)) : + finiteSetAverage L (finiteSetAverage A (finiteIndicator M)) = + fun x => (setAverageTranslate L (setAverageTranslate A (realSetIndicator M)) x : ℂ) := by + rw [finiteIndicator_eq_ofReal_realSetIndicator, finiteSetAverage_ofReal, finiteSetAverage_ofReal] + +theorem triple_translate_le_of_iterated_approx + {A L X : Finset (ZMod N)} (hA : A.Nonempty) (hL : L.Nonempty) (hX : X.Nonempty) + (M : Finset (ZMod N)) (q : ℕ) {delta eta theta : ℝ} + (heta : 0 ≤ eta) (htheta : 0 ≤ theta) (t x : ZMod N) : + let u := setAverageTranslate L (setAverageTranslate A (realSetIndicator M)) + (∀ y, |iteratedSetAverage X u q y - u y| ≤ delta) → + (∀ psi ∈ Chang.largeSpectrum X eta, ‖1 - psi t‖ ≤ theta) → + |u (x - t) - u x| ≤ + 2 * delta + (theta + 2 * eta ^ q) * Real.sqrt ((M.card : ℝ) / L.card) := by + intro u happrox hphase + let f := finiteSetAverage L (finiteSetAverage A (finiteIndicator M)) + have hf : f = fun y => (u y : ℂ) := triple_average_ofReal A L M + have happrox' : ∀ y, ‖iteratedFiniteSetAverage X f q y - f y‖ ≤ delta := by + intro y + rw [hf, iteratedFiniteSetAverage_ofReal] + simpa only [← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using happrox y + have h := translate_le_of_iteratedFiniteSetAverage_approx hX q f heta htheta t x happrox' hphase + have hreal : |u (x - t) - u x| ≤ 2 * delta + (theta + 2 * eta ^ q) * fourierL1 f := by + simpa only [hf, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using h + exact hreal.trans (add_le_add le_rfl + (mul_le_mul_of_nonneg_left (fourierL1_triple_average_le hA hL M) + (add_nonneg htheta (mul_nonneg (by norm_num) (pow_nonneg heta q))))) + +end Erdos3.CyclicCrootSisask + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Pointwise + +variable {N : ℕ} [NeZero N] + +namespace RelativeChangSanders + +theorem localChangBaseScale_le_one + (B : CyclicBohr.Set N) (X : Finset (ZMod N)) (eta : ℝ) : + localChangBaseScale B X eta ≤ 1 := by + have hd : (1 : ℝ≥0) ≤ (2 * max B.rank 1 : ℕ) := by + exact_mod_cast (show 1 ≤ 2 * max B.rank 1 by omega) + have hk : (1 : ℝ≥0) ≤ (2 * localChangCap B X eta + 1 : ℕ) := by + exact_mod_cast (show 1 ≤ 2 * localChangCap B X eta + 1 by omega) + unfold localChangBaseScale + rw [← one_div, div_le_one (by positivity)] + nlinarith + +end RelativeChangSanders + +namespace CyclicCrootSisask + +open RelativeChangSanders + +theorem exists_local_bohr_triple_almostPeriods + (B : CyclicBohr.Set N) (hBpos : 0 < B.radius) (hBreg : B.IsRankRegular) + {A S L : Finset (ZMod N)} (hA : A.Nonempty) (hS : S.Nonempty) (hL : L.Nonempty) + (hSB : S - S ⊆ B.carrier) (M : Finset (ZMod N)) + (q : ℕ) (hq : 0 < q) {delta : ℝ} (hdelta : 0 < delta) + (sigma r : ℝ≥0) (hsigma0 : 0 < sigma) (hr0 : 0 < r) + (hsigma : sigma ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) : + let m := convolutionMomentOrder M L + let k := crootSisaskSampleSize m ((delta / q) / Real.exp 1) + let u := setAverageTranslate L (setAverageTranslate A (realSetIndicator M)) + ∃ (X : Finset (ZMod N)) (R : CyclicBohr.Set N), + 0 ∈ X ∧ X ⊆ S - S ∧ + (((A.card : ℝ) ^ k / 2 * S.card) / ((A + S).card : ℝ) ^ k ≤ X.card) ∧ + R.IsRankRegular ∧ (R.rank : ℝ) ≤ B.rank + localChangDimension B X (1 / 2) ∧ + min ((sigma : ℝ) * ((localChangBaseScale B X (1 / 2) : ℝ) * B.radius / 2)) r / 2 ≤ + R.radius ∧ + R.carrier ⊆ B.carrier ∧ + ∀ t ∈ R.carrier, ∀ x, + |u (x + t) - u x| ≤ 2 * delta + + (localChangDimension B X (1 / 2) * r + + 800 * ((max B.rank 1 : ℕ) : ℝ) * sigma + 2 * (1 / 2 : ℝ) ^ q) * + Real.sqrt ((M.card : ℝ) / L.card) := by + intro m k u + obtain ⟨T, X, z, hTS, hz, hXeq, hzero, hXS, hcount, happrox⟩ := + exists_local_boosted_triple_almostPeriods hA hS hL M q hq hdelta + have hX : X.Nonempty := ⟨0, hzero⟩ + obtain ⟨rho, C, Delta, R, hrho0, hrho1, hC, hCreg, hcard, hDelta, + hRreg, hRrank, hRwidth, hRupper, hRsub, hphase⟩ := + exists_regular_relative_spectrum_controller B hBpos hBreg X hX (hXS.trans hSB) + (1 / 2) (by norm_num) sigma r hsigma0 hr0 hsigma + have hsigma1 : sigma ≤ 1 := by + apply hsigma.trans + rw [div_le_one (by positivity)] + exact_mod_cast (show 1 ≤ 100 * (2 * max B.rank 1) by omega) + have ha1 := localChangBaseScale_le_one B X (1 / 2) + have hscale : sigma * (rho * localChangBaseScale B X (1 / 2)) ≤ 1 := by + calc + sigma * (rho * localChangBaseScale B X (1 / 2)) ≤ 1 * (1 * 1) := + mul_le_mul hsigma1 (mul_le_mul hrho1 ha1 (by positivity) (by norm_num)) + (by positivity) (by norm_num) + _ = 1 := by norm_num + have hCB : (C.ndilate sigma).carrier ⊆ B.carrier := by + rw [hC, CyclicBohr.Set.ndilate_ndilate] + simpa only [CyclicBohr.Set.ndilate_one] using + CyclicBohr.Set.carrier_ndilate_mono (B := B) hscale + have hcountX : (((A.card : ℝ) ^ k / 2 * S.card) / + ((A + S).card : ℝ) ^ k ≤ X.card) := by simpa [hXeq] using hcount + have hdim0 : 0 ≤ localChangDimension B X (1 / 2) := + (Nat.cast_nonneg Delta.card).trans hcard + refine ⟨X, R, hzero, hXS, hcountX, hRreg, ?_, hRwidth, hRsub.trans hCB, ?_⟩ + · have hRrankR : (R.rank : ℝ) ≤ B.rank + Delta.card := by exact_mod_cast hRrank + exact hRrankR.trans (add_le_add le_rfl hcard) + · intro t ht x + have htheta : 0 ≤ localChangDimension B X (1 / 2) * (r : ℝ) + + 800 * ((max B.rank 1 : ℕ) : ℝ) * sigma := by positivity + have h := triple_translate_le_of_iterated_approx hA hL hX M q + (eta := (1 / 2 : ℝ)) (by norm_num) htheta t (x + t) happrox + (fun psi hpsi => hphase t ht psi hpsi) + simpa only [add_sub_cancel_right, abs_sub_comm] using h + +end CyclicCrootSisask +end Erdos3 + +end + +section + +namespace Erdos3.CyclicCrootSisask + +open scoped BigOperators NNReal Pointwise +open RelativeChangSanders + +variable {N : ℕ} [NeZero N] + +theorem exists_local_bohr_triple_almostPeriods_relative + (B : CyclicBohr.Set N) (hBpos : 0 < B.radius) (hBreg : B.IsRankRegular) + {A S L : Finset (ZMod N)} (hA : A.Nonempty) (hS : S.Nonempty) (hL : L.Nonempty) + (hSB : S ⊆ B.carrier) (M : Finset (ZMod N)) + (q : ℕ) (hq : 0 < q) {delta : ℝ} (hdelta : 0 < delta) + (sigma r : ℝ≥0) (hsigma0 : 0 < sigma) (hr0 : 0 < r) + (hsigma : sigma ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) : + let m := convolutionMomentOrder M L + let k := crootSisaskSampleSize m ((delta / q) / Real.exp 1) + let u := setAverageTranslate L (setAverageTranslate A (realSetIndicator M)) + ∃ (T : Finset (ZMod N)) (R : CyclicBohr.Set N), + T.Nonempty ∧ T ⊆ S ∧ + (((A.card : ℝ) ^ k / 2 * S.card) / ((A + S).card : ℝ) ^ k ≤ T.card) ∧ + R.IsRankRegular ∧ (R.rank : ℝ) ≤ B.rank + localChangDimension B T (1 / 2) ∧ + min ((sigma : ℝ) * ((localChangBaseScale B T (1 / 2) : ℝ) * B.radius / 2)) r / 2 ≤ + R.radius ∧ + R.radius ≤ r ∧ + R.carrier ⊆ B.carrier ∧ + ∀ t ∈ R.carrier, ∀ x, + |u (x + t) - u x| ≤ 2 * delta + + (localChangDimension B T (1 / 2) * r + + 800 * ((max B.rank 1 : ℕ) : ℝ) * sigma + 2 * (1 / 2 : ℝ) ^ q) * + Real.sqrt ((M.card : ℝ) / L.card) := by + intro m k u + obtain ⟨T, X, z, hTS, hz, hXeq, hzero, hXS, hcount, happrox⟩ := + exists_local_boosted_triple_almostPeriods hA hS hL M q hq hdelta + have hX : X.Nonempty := ⟨0, hzero⟩ + have hT : T.Nonempty := ⟨z, hz⟩ + obtain ⟨rho, C, Delta, R, hrho0, hrho1, hC, hCreg, hcard, hDelta, + hRreg, hRrank, hRwidth, hRupper, hRsub, hphase⟩ := + exists_regular_relative_spectrum_controller B hBpos hBreg T hT (hTS.trans hSB) + (1 / 2) (by norm_num) sigma r hsigma0 hr0 hsigma + have hsigma1 : sigma ≤ 1 := by + apply hsigma.trans + rw [div_le_one (by positivity)] + exact_mod_cast (show 1 ≤ 100 * (2 * max B.rank 1) by omega) + have ha1 := localChangBaseScale_le_one B T (1 / 2) + have hscale : sigma * (rho * localChangBaseScale B T (1 / 2)) ≤ 1 := by + calc + sigma * (rho * localChangBaseScale B T (1 / 2)) ≤ 1 * (1 * 1) := + mul_le_mul hsigma1 (mul_le_mul hrho1 ha1 (by positivity) (by norm_num)) + (by positivity) (by norm_num) + _ = 1 := by norm_num + have hCB : (C.ndilate sigma).carrier ⊆ B.carrier := by + rw [hC, CyclicBohr.Set.ndilate_ndilate] + simpa only [CyclicBohr.Set.ndilate_one] using + CyclicBohr.Set.carrier_ndilate_mono (B := B) hscale + have hdim0 : 0 ≤ localChangDimension B T (1 / 2) := + (Nat.cast_nonneg Delta.card).trans hcard + refine ⟨T, R, hT, hTS, hcount, hRreg, ?_, hRwidth, + hRupper.trans (min_le_right _ _), hRsub.trans hCB, ?_⟩ + · have hRrankR : (R.rank : ℝ) ≤ B.rank + Delta.card := by exact_mod_cast hRrank + exact hRrankR.trans (add_le_add le_rfl hcard) + · intro t ht x + have htheta : 0 ≤ localChangDimension B T (1 / 2) * (r : ℝ) + + 800 * ((max B.rank 1 : ℕ) : ℝ) * sigma := by positivity + have h := triple_translate_le_of_iterated_approx hA hL hX M q + (eta := (1 / 2 : ℝ)) (by norm_num) htheta t (x + t) happrox + (fun psi hpsi => hphase t ht psi (by + rw [hXeq] at hpsi + exact (Chang.mem_largeSpectrum_map_subRight_iff T z (1 / 2) psi).1 hpsi)) + simpa only [add_sub_cancel_right, abs_sub_comm] using h + +end Erdos3.CyclicCrootSisask + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/LocalSpectrumBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/LocalSpectrumBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab2c395a7c930dcd3c6ae0c9399195618372460b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/LocalSpectrumBudget.lean @@ -0,0 +1,69 @@ +import OAI.Combinatorics.Progressions.Estimates.CyclicRelativeChang +import OAI.Combinatorics.Progressions.Sampling.LocalSamplingBudget + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal Pointwise + +theorem samplingDensity_le_of_smallDoubling + {G : Type*} [AddCommGroup G] [DecidableEq G] + {A S T : Finset G} (hA : A.Nonempty) (hS : S.Nonempty) (k : ℕ) + {K : ℝ} (hK : 0 < K) (hdoubling : ((A + S).card : ℝ) ≤ K * A.card) + (hcount : (((A.card : ℝ) ^ k / 2 * S.card) / ((A + S).card : ℝ) ^ k ≤ T.card)) : + (S.card : ℝ) / (2 * K ^ k) ≤ T.card := by + have hsumpos : (0 : ℝ) < (A + S).card := by exact_mod_cast (hA.add hS).card_pos + have hden : 0 < ((A + S).card : ℝ) ^ k := pow_pos hsumpos _ + have hKden : 0 < 2 * K ^ k := mul_pos (by norm_num) (pow_pos hK _) + apply le_trans _ hcount + apply (div_le_div_iff₀ hKden hden).mpr + have hp := pow_le_pow_left₀ (Nat.cast_nonneg _) hdoubling k + calc + _ ≤ (S.card : ℝ) * (K * A.card) ^ k := + mul_le_mul_of_nonneg_left hp (Nat.cast_nonneg _) + _ = _ := by rw [mul_pow]; ring + +namespace RelativeChangSanders + +variable {N : ℕ} [NeZero N] + +theorem localChangDimension_half_le_of_card + (B : CyclicBohr.Set N) {T : Finset (ZMod N)} (hT : T.Nonempty) + {K : ℝ} (hK : 0 < K) (k : ℕ) + (hcount : (B.carrier.card : ℝ) / (2 * K ^ k) ≤ T.card) : + localChangDimension B T (1 / 2) ≤ 8 * (1 + Real.log 4 + k * Real.log K) := by + have hTpos : (0 : ℝ) < T.card := by exact_mod_cast hT.card_pos + have hBpos : (0 : ℝ) < B.carrier.card := by exact_mod_cast B.card_pos + have hden : 0 < 2 * K ^ k := by positivity + have hprod := (div_le_iff₀ hden).mp hcount + have hratio : 2 * (B.carrier.card : ℝ) / T.card ≤ 4 * K ^ k := by + rw [div_le_iff₀ hTpos] + nlinarith + have hlog := Real.log_le_log (by positivity : 0 < 2 * (B.carrier.card : ℝ) / T.card) hratio + rw [Real.log_mul (by norm_num) (pow_ne_zero k hK.ne'), Real.log_pow] at hlog + unfold localChangDimension + norm_num + linarith + +theorem localChangBaseScale_ge_of_dimension_le + (B : CyclicBohr.Set N) (T : Finset (ZMod N)) (eta D : ℝ) + (hD : localChangDimension B T eta ≤ D) : + (100 * ((2 * max B.rank 1 : ℕ) : ℝ≥0) * + ((2 * (⌈D⌉₊ + 1) + 1 : ℕ) : ℝ≥0))⁻¹ ≤ localChangBaseScale B T eta := by + have hcap : localChangCap B T eta ≤ ⌈D⌉₊ + 1 := + Nat.add_le_add_right (Nat.ceil_mono hD) 1 + have hcap' : ((2 * localChangCap B T eta + 1 : ℕ) : ℝ≥0) ≤ + ((2 * (⌈D⌉₊ + 1) + 1 : ℕ) : ℝ≥0) := by + exact_mod_cast Nat.add_le_add_right (Nat.mul_le_mul_left 2 hcap) 1 + unfold localChangBaseScale + exact inv_anti₀ (by positivity) (mul_le_mul_of_nonneg_left hcap' (by positivity)) + +end RelativeChangSanders +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/LogCharacterBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/LogCharacterBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..a15fa2f9aea8b08692cce70228c972f2f03929d3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/LogCharacterBudget.lean @@ -0,0 +1,172 @@ +import OAI.Combinatorics.Progressions.Nilpotent.BCHSmoothPartitionBudget + +namespace OAI + +section + +namespace Erdos3.NilpotentLieBCHGroup + +open CircleFourier + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] [LieAlgebra ℝ L] + {s : ℕ} {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + +noncomputable def logCharacter (η : L →ₗ[ℝ] ℝ) (g : NilpotentLieBCHGroup L s hnil) : ℂ := + character (η g.coord : CircleFourier.Circle) + +theorem logCharacter_norm (η : L →ₗ[ℝ] ℝ) (g : NilpotentLieBCHGroup L s hnil) : + ‖logCharacter η g‖ = 1 := norm_character _ + +theorem logCharacter_mul (η : L →ₗ[ℝ] ℝ) (g h : NilpotentLieBCHGroup L s hnil) + (hgh : ⁅g.coord, h.coord⁆ = 0) : + logCharacter η (g * h) = logCharacter η g * logCharacter η h := by + simp only [logCharacter, coord_mul, lieBCH_eq_add_of_lie_eq_zero hnil hgh, + map_add, AddCircle.coe_add, character_add] + +theorem logCharacter_inv_mul (η : L →ₗ[ℝ] ℝ) (g : NilpotentLieBCHGroup L s hnil) : + logCharacter η g⁻¹ * logCharacter η g = 1 := by + simp only [logCharacter, coord_inv, map_neg, AddCircle.coe_neg, ← character_add, + neg_add_cancel, character_zero] + +theorem logCharacter_of_integral (η : L →ₗ[ℝ] ℝ) (g : NilpotentLieBCHGroup L s hnil) + (hg : ∃ n : ℤ, η g.coord = n) : logCharacter η g = 1 := by + obtain ⟨n, hn⟩ := hg + apply (character_eq_one_iff _).mpr + apply (AddCircle.coe_eq_zero_iff (1 : ℝ)).mpr + exact ⟨n, by simpa only [zsmul_eq_mul, mul_one] using hn.symm⟩ + +end Erdos3.NilpotentLieBCHGroup + +end + +section + +namespace Erdos3.NilpotentLieBCHGroup + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] [LieAlgebra ℝ L] + {s : ℕ} {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + +theorem logCharacter_norm_sub_eq_relative (η : L →ₗ[ℝ] ℝ) + (x y γ : NilpotentLieBCHGroup L s hnil) + (hx : ∀ v : L, ⁅x.coord, v⁆ = 0) (hy : ∀ v : L, ⁅y.coord, v⁆ = 0) + (hγ : logCharacter η γ = 1) : + ‖logCharacter η x - logCharacter η y‖ = + ‖logCharacter η (y * γ * x⁻¹) - 1‖ := by + have hzero : ⁅(y * γ).coord, x.coord⁆ = 0 := by rw [← lie_skew, hx, neg_zero] + have hright : ⁅(y * γ).coord, x⁻¹.coord⁆ = 0 := by + simp only [coord_inv, lie_neg, hzero, neg_zero] + have hprod : logCharacter η (y * γ * x⁻¹) * logCharacter η x = logCharacter η y := by + rw [logCharacter_mul η (y * γ) x⁻¹ hright, + logCharacter_mul η y γ (hy γ.coord), hγ, mul_one, mul_assoc, logCharacter_inv_mul, mul_one] + calc + _ = ‖logCharacter η y - logCharacter η x‖ := norm_sub_rev _ _ + _ = ‖(logCharacter η (y * γ * x⁻¹) - 1) * logCharacter η x‖ := by + rw [sub_mul, one_mul, hprod] + _ = _ := by rw [norm_mul, logCharacter_norm, mul_one] + +end Erdos3.NilpotentLieBCHGroup + +end + +section + +namespace Erdos3 + +open scoped NNReal + +noncomputable def logCharacterMetricConstant (s d H : ℕ) (A : ℝ≥0) : ℝ≥0 := + (2 + CircleFourier.characterLipConstant * A) * bchLogMetricConstant s d H 1 + +namespace NilpotentLieBCHGroup + +open Module + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] [LieAlgebra ℝ L] + [IsScalarTower ℚ ℝ L] [TopologicalSpace L] [IsTopologicalAddGroup L] + [ContinuousSMul ℝ L] [T2Space L] + {s H : ℕ} {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + +theorem logCharacter_dist_one_le (e : Basis ι ℝ L) (c : ι → ι → ι → ℚ) + (hstructure : ∀ i j k, algebraMap ℚ ℝ (c i j k) = e.repr ⁅e i, e j⁆ k) + (hc : ∀ i j k, RationalHeightLE (c i j k) H) + (η : L →ₗ[ℝ] ℝ) (A : ℝ≥0) (hη : ∀ x, |η x| ≤ A * ‖e.equivFun x‖) + (g : NilpotentLieBCHGroup L s hnil) : + letI := rightMetricSpace (hnil := hnil) e + ‖logCharacter η g - 1‖ ≤ logCharacterMetricConstant s (Fintype.card ι) H A * dist 1 g := by + let := rightMetricSpace (hnil := hnil) e + let C := bchLogMetricConstant s (Fintype.card ι) H 1 + change ‖logCharacter η g - 1‖ ≤ + (2 + (CircleFourier.characterLipConstant : ℝ) * A) * C * dist 1 g + by_cases hnear : (C : ℝ) * dist 1 g < 1 + · have hcoord := norm_coordinates_le_of_near_one e c hstructure hc 1 le_rfl g hnear + have hchar := norm_character_real_sub_one_le (η g.coord) + have hlinear := hη g.coord + have hscale := mul_le_mul_of_nonneg_left hcoord A.coe_nonneg + change ‖e.equivFun g.coord‖ ≤ (C : ℝ) * dist 1 g at hcoord + have hbound : |η g.coord| ≤ A * ((C : ℝ) * dist 1 g) := hlinear.trans hscale + apply hchar.trans + have h := mul_le_mul_of_nonneg_left hbound CircleFourier.characterLipConstant.coe_nonneg + nlinarith [C.coe_nonneg, dist_nonneg (x := (1 : NilpotentLieBCHGroup L s hnil)) (y := g)] + · have hfar : 1 ≤ (C : ℝ) * dist 1 g := le_of_not_gt hnear + apply (CircleFourier.norm_character_sub_one_le_two _).trans + nlinarith [CircleFourier.characterLipConstant.coe_nonneg, A.coe_nonneg, + C.coe_nonneg, dist_nonneg (x := (1 : NilpotentLieBCHGroup L s hnil)) (y := g), + mul_nonneg CircleFourier.characterLipConstant.coe_nonneg A.coe_nonneg] + +end NilpotentLieBCHGroup +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem bchLogMetricConstant_le_inverse (s d H : ℕ) : + bchLogMetricConstant s d H 1 ≤ bchInverseBoxConstant s d H 1 := by + change bchBoxCoordinateBound s d H 1 + 1 ≤ + (bchBoxCoordinateBound s d H 1 + 2 * 1) * (bchBoxCoordinateBound s d H 1 + 1) + have h := bchBoxCoordinateBound_nonneg s d H (by norm_num : (0 : ℝ) ≤ 1) + nlinarith + +theorem exists_logCharacterMetricConstant_exp_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ (d H : ℕ) (A : ℝ≥0) (p : ℝ), + 0 ≤ p → (d : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → (A : ℝ) ≤ Real.exp p → + ((2 * logCharacterMetricConstant s d H A : ℝ≥0) : ℝ) ≤ Real.exp ((p + C) ^ C) := by + obtain ⟨a, _, hbound⟩ := exists_bchInverseBoxConstant_exp_bound s 0 + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hpoly⟩ := exists_natPolynomial_eval_budget (X + 11 + (X + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro d H A p hp hd hH hA + have hlog : (bchLogMetricConstant s d H 1 : ℝ) ≤ Real.exp ((p + a) ^ a) := + (show (bchLogMetricConstant s d H 1 : ℝ) ≤ bchInverseBoxConstant s d H 1 from + bchLogMetricConstant_le_inverse s d H).trans + (hbound d H 1 p hp hd hH (by simp only [NNReal.coe_one, pow_zero]; exact Real.one_le_exp zero_le_one)) + have hfront : 2 + (CircleFourier.characterLipConstant : ℝ) * A ≤ Real.exp (p + 10) := by + have hpi : (CircleFourier.characterLipConstant : ℝ) ≤ 8 := by + rw [CircleFourier.coe_characterLipConstant] + linarith [Real.pi_lt_four] + have hten : (10 : ℝ) ≤ Real.exp 10 := by linarith [Real.add_one_le_exp (10 : ℝ)] + have hone := Real.one_le_exp hp + rw [Real.exp_add] + nlinarith [mul_le_mul_of_nonneg_right hpi A.coe_nonneg] + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hsmall : ((2 * logCharacterMetricConstant s d H A : ℝ≥0) : ℝ) ≤ + Real.exp (p + 11 + (p + a) ^ a) := by + change 2 * ((2 + (CircleFourier.characterLipConstant : ℝ) * A) * + (bchLogMetricConstant s d H 1 : ℝ)) ≤ _ + calc + _ ≤ Real.exp 1 * (Real.exp (p + 10) * Real.exp ((p + a) ^ a)) := + mul_le_mul htwo (mul_le_mul hfront hlog (by positivity) (Real.exp_pos _).le) + (by positivity) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + apply hsmall.trans (Real.exp_le_exp.mpr ?_) + simpa [X, Polynomial.eval₂_pow] using hpoly p hp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/MajorPhaseLowFourierExtraction.lean b/lean/OAI/Combinatorics/Progressions/Fourier/MajorPhaseLowFourierExtraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..8840cc52af6ddf7e44f18d50fb8765d659e0fa65 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/MajorPhaseLowFourierExtraction.lean @@ -0,0 +1,627 @@ +import OAI.Combinatorics.Progressions.Dynamics.NormalizedTwistExtractionBudget +import OAI.Combinatorics.Progressions.Nilpotent.MajorTranslationPartnerNiltest +import OAI.Combinatorics.Progressions.Polynomial.LowTaggedPolynomialCoordinates +import OAI.Combinatorics.Progressions.Polynomial.OrdinaryPolynomialPhaseAffineInverse + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_majorPhaseLowFourierExtraction_budget (a b : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → + let q := (p + a) ^ a + p + 1 + q ≤ (p + C) ^ C ∧ (q + b) ^ b ≤ (p + C) ^ C ∧ + 3 * q + 16 ≤ (p + C) ^ C := by + let Q : Polynomial ℕ := (Polynomial.X + Polynomial.C a) ^ a + Polynomial.X + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (Q + (Q + Polynomial.C b) ^ b + 3 * Q + 16) + refine ⟨C, hC, ?_⟩ + intro p hp + dsimp only + let q : ℝ := (p + a) ^ a + p + 1 + have hq : 0 ≤ q := by dsimp [q]; positivity + have hb : 0 ≤ (q + b) ^ b := by positivity + have htotal : q + (q + b) ^ b + 3 * q + 16 ≤ (p + C) ^ C := by + simpa [Q, q, Polynomial.eval₂_pow] using hbudget p hp + change q ≤ _ ∧ (q + b) ^ b ≤ _ ∧ 3 * q + 16 ≤ _ + exact ⟨by linarith, by linarith, by linarith⟩ + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open MvPolynomial +open scoped BigOperators + +theorem normalizedTwistFrequencyPolynomial_truncate_correlation + {X Ω : Type*} {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (cover d : ℕ) (W : ∀ j, Submodule ℝ (J j → ℝ)) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ W j) + (hann : ∀ j, d < j.val + 1 → + W j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩))) + (s : Finset Ω) (u : Ω → X → ℝ) (signal : Ω → ℂ) : + ‖𝔼 x ∈ s, (Real.fourierChar (MvPolynomial.eval (u x) + (normalizedTwistFrequencyPolynomial cover a poly)) : ℂ) * signal x‖ = + ‖𝔼 x ∈ s, (Real.fourierChar (MvPolynomial.eval (u x) + (normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly)) : ℂ) * + signal x‖ := by + have he (x : Ω) : + (Real.fourierChar (MvPolynomial.eval (u x) + (normalizedTwistFrequencyPolynomial cover a poly)) : ℂ) * signal x = + (Real.fourierChar (normalizedTwistHighFrequencyConstant cover d a poly) : ℂ) * + ((Real.fourierChar (MvPolynomial.eval (u x) + (normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly)) : ℂ) * + signal x) := by + rw [normalizedTwistFrequencyPolynomial_low_add_constant cover d W a poly hcoeff hann, + map_add, eval_C, Real.fourierChar.map_add_eq_mul, Circle.coe_mul] + ring + simp_rw [he] + rw [← Finset.mul_expect, norm_mul, Circle.norm_coe, one_mul] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MvPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +theorem exists_normalizedTwist_high_frequency_removal_on_progression (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L : Type} [Fintype X] [DecidableEq X] + [LieRing L] [LieAlgebra ℚ L] {t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (J : Fin m → Type) [∀ j, Fintype (J j)] (d : ℕ) + (D : RationalFilteredNilmanifold L t e) (_htd : t ≤ d) + (R : D.Niltest (fun _ : X => 1)) + (cover : ℕ) (_hcover : 0 < cover) (a : (Σ j, J j) → ℤ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (W : ∀ j, Submodule ℝ (J j → ℝ)) + (_hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ W j) + (p Rrank : ℝ), 0 ≤ p → R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + (cover : ℝ) ≤ Real.exp p → (∀ i, |(a i : ℝ)| ≤ Real.exp p) → + ∀ (q : ℕ), 0 < q → (q : ℝ) ≤ Real.exp p → + ∀ (start : X → ℤ) (K : ℝ), 1 ≤ K → K ≤ Real.exp p → + ∀ (N : X → ℝ), (∀ i, 0 < N i) → + ∀ (origin : X → ℤ) (lengths : X → ℕ), (∀ i, 0 < lengths i) → + (∀ i, N i ≤ K * (q : ℝ) * (lengths i : ℝ)) → + (Fintype.card X : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, d < j.val + 1 → HasLayerSamplingRank (j.val + 1) + N Rrank (W j) (poly j)) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, + (Real.fourierChar (MvPolynomial.eval (fun i => (start i : ℝ) + (q : ℝ) * (x i : ℝ)) + (normalizedTwistFrequencyPolynomial cover a poly)) : ℂ) * R.eval x‖ → + ∀ j, d < j.val + 1 → W j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩)) := by + classical + choose c hc hinverse using fun j : Fin m => + OrdinaryPolynomialPhase.exists_ordinary_polynomial_phase_affine_inverse (j.val + 1) + (Nat.succ_pos _) + let B := (∑ j, c j) + 2 + have hcB (j : Fin m) : c j ≤ B := + (Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ j)).trans + (Nat.le_add_right _ _) + have hB : 2 ≤ B := by dsimp [B]; omega + let Q : Polynomial ℕ := Polynomial.X + (Polynomial.X + Polynomial.C B) ^ B + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget Q + refine ⟨C, hC, ?_⟩ + intro X L _ _ _ _ t e _ _ _ _ J _ d D htd R cover hcover a poly hpoly W hcoeff p Rrank hp + hR hRcap hcoverp ha q hq hqp start K hK hKp N hN origin lengths hlengths hNL hX hlarge hRrank hrank hcorr + have hbudget' : p + (p + B) ^ B + 2 ≤ (p + C) ^ C := by + simpa [Q, Polynomial.eval₂_pow] using hbudget p hp + have hbase : 1 ≤ p + B := by + have hb : (2 : ℝ) ≤ B := by exact_mod_cast hB + linarith + have hlocal (j : Fin m) : (p + c j) ^ c j ≤ (p + B) ^ B := by + have hb : p + (c j : ℝ) ≤ p + B := by + have hh : (c j : ℝ) ≤ B := Nat.cast_le.mpr (hcB j) + linarith + apply (pow_le_pow_left₀ (by positivity) hb _).trans + exact pow_le_pow_right₀ hbase (hcB j) + rcases highest_nonannihilating_tag d W a with hann | ⟨h, hd, hw, hhigher⟩ + · exact hann + · exfalso + have hhigh (j : Fin m) (hj : h < j) : + integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j) = + MvPolynomial.C ((integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j)).coeff 0) := + integerRowPolynomial_constant_of_annihilates (W j) _ _ (hcoeff j) (hhigher j hj) + have hdegree (j : Fin m) := integerRowPolynomial_totalDegree_le + (fun i => a ⟨j, i⟩) (hpoly j) + have hphase : (normalizedTwistFrequencyPolynomial cover a poly).totalDegree ≤ h.val + 1 := by + apply (totalDegree_mul _ _).trans + simp only [totalDegree_C, zero_add] + exact taggedScalar_sum_degree h _ hdegree hhigh + have htop : homogeneousComponent (h.val + 1) (normalizedTwistFrequencyPolynomial cover a poly) = + MvPolynomial.C (1 / (cover : ℝ)) * homogeneousComponent (h.val + 1) + (integerRowPolynomial (fun i => a ⟨h, i⟩) (poly h)) := by + rw [normalizedTwistFrequencyPolynomial, homogeneousComponent_C_mul, + taggedScalar_sum_top h _ hdegree hhigh] + have hcost : p + (p + c h) ^ c h ≤ (p + C) ^ C := by linarith [hlocal h] + have hap := hinverse h D (by omega) (normalizedTwistFrequencyPolynomial cover a poly) + hphase R p hp hR hRcap q hq hqp start K hK hKp N hN origin lengths hlengths hNL hX + (fun i => (Real.exp_le_exp.mpr (by linarith : (p + c h) ^ c h ≤ (p + C) ^ C)).trans + (hlarge i)) (by + simpa only [Int.cast_add, Int.cast_mul, Int.cast_natCast] using hcorr) + apply normalizedTwistFrequencyPolynomial_top_not_approximation cover hcover h a poly + (W h) N Rrank (Real.exp ((p + c h) ^ c h)) hN + ?_ (hrank h hd) ?_ hw htop hap + · calc + _ ≤ Real.exp p * Real.exp ((p + c h) ^ c h) := + mul_le_mul_of_nonneg_right hcoverp (Real.exp_nonneg _) + _ = Real.exp (p + (p + c h) ^ c h) := (Real.exp_add _ _).symm + _ ≤ Rrank := (Real.exp_le_exp.mpr hcost).trans hRrank + · intro i + exact (ha ⟨h, i⟩).trans ((Real.exp_le_exp.mpr + (by linarith [pow_nonneg (show 0 ≤ p + B by positivity) B] : p ≤ (p + C) ^ C)).trans hRrank) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +open RationalFilteredNilmanifold +open scoped TensorProduct NNReal BigOperators + +theorem exists_rank_localized_correlating_frequency (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L : Type} [Fintype X] [DecidableEq X] + [LieRing L] [LieAlgebra ℚ L] {t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (J : Fin m → Type) [∀ j, Fintype (J j)] + {periodCap coverCap : ℝ} {Lip : ℝ≥0} + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (d : ℕ) (D : RationalFilteredNilmanifold L t e) (_htd : t ≤ d) + (R : D.Niltest (fun _ : X => 1)) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (_hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (p Rrank : ℝ), 0 ≤ p → R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + (Fintype.card X : ℝ) ≤ p → (Fintype.card (Σ j, J j) : ℝ) ≤ p → + (W.modulus : ℝ) ≤ Real.exp p → (W.cover : ℝ) ≤ Real.exp p → + (Lip : ℝ) ≤ Real.exp p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (N i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, d < j.val + 1 → HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp (-p) ≤ ‖𝔼 u ∈ integerBox N, W.eval N poly u * R.eval u‖ → + ∃ (start length : X → ℕ) (a : (Σ j, J j) → ℤ), + (∀ i, 0 < length i) ∧ + (∀ i, (N i : ℝ) * Real.exp (-(3 * p + 16)) ≤ length i) ∧ + (∀ i, (N i : ℝ) ≤ Real.exp (3 * p + 16) * W.modulus * length i) ∧ + (∀ v ∈ integerBox length, + (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i) ∈ integerBox N) ∧ + (∀ j, |(a j : ℝ)| ≤ Real.exp ((p + C) ^ C)) ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖𝔼 v ∈ integerBox length, + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (W.modulus : ℝ) * v i) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * + R.eval (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i)‖ ∧ + ∀ j, d < j.val + 1 → U j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩)) := by + obtain ⟨aC, _, hselect⟩ := exists_localized_correlating_frequency + obtain ⟨bC, _, hremove⟩ := exists_normalizedTwist_high_frequency_removal_on_progression m + obtain ⟨C, hC, hbudget⟩ := exists_normalizedTwistExtractionBudget aC bC + refine ⟨C, hC, ?_⟩ + intro X L _ _ _ _ t e _ _ _ _ J _ periodCap coverCap Lip W d D htd R N poly hpoly + U hcoeff p Rrank hp hR hcap hX hJ hmod hcover hLip hN hRrank hrank hcorr + let q : ℝ := (p + aC) ^ aC + 3 * p + 16 + have hpow : 0 ≤ (p + aC) ^ aC := by positivity + have hq : 0 ≤ q := by dsimp [q]; positivity + have hpq : p ≤ q := by dsimp [q]; linarith + have hsideq : 3 * p + 16 ≤ q := by dsimp [q]; linarith + have hfreqq : (p + aC) ^ aC ≤ q := by dsimp [q]; linarith + have hbudget' : q + (q + bC) ^ bC + 3 * p + 16 ≤ (p + C) ^ C := hbudget p hp + have hremoven : 0 ≤ (q + bC) ^ bC := by positivity + have hqfinal : q ≤ (p + C) ^ C := by linarith + have hremovefinal : (q + bC) ^ bC ≤ (p + C) ^ C := by linarith + have hsidefinal : 3 * p + 16 ≤ (p + C) ^ C := hsideq.trans hqfinal + have hsmallN (i : X) : Real.exp (3 * p + 16) ≤ (N i : ℝ) := + (Real.exp_le_exp.mpr hsidefinal).trans (hN i) + obtain ⟨start, length, a, hpos, hlength, hcomparison, hinside, ha, hselected⟩ := + hselect W N poly R.eval p hp hJ hmod hLip hsmallN + (fun u _ => (R.norm_eval_le u).trans hcap) hcorr + let R' := R.scalarAffinePullback (W.modulus : ℚ) (fun i => (start i : ℚ)) + have hR' : R'.ComplexityLE q := hR.mono hpq + have hR'cap : (R'.normBound : ℝ) ≤ 1 := hcap + have hR'eval (v : X → ℤ) : + R'.eval v = R.eval (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i) := by + simpa only [R', Int.cast_natCast, add_comm] using + R.scalarAffinePullback_eval_integer (W.modulus : ℤ) (fun i => (start i : ℤ)) v + have hzero : translatedIntegerBox (0 : X → ℤ) length = integerBox length := by + ext v + simp only [mem_translatedIntegerBox, mem_integerBox, Pi.zero_apply, zero_add] + have hlong (i : X) : Real.exp ((q + bC) ^ bC) ≤ (length i : ℝ) := by + calc + _ = Real.exp ((q + bC) ^ bC + (3 * p + 16)) * Real.exp (-(3 * p + 16)) := by + rw [← Real.exp_add] + congr 1 + ring + _ ≤ Real.exp ((p + C) ^ C) * Real.exp (-(3 * p + 16)) := by + gcongr + linarith + _ ≤ (N i : ℝ) * Real.exp (-(3 * p + 16)) := + mul_le_mul_of_nonneg_right (hN i) (Real.exp_nonneg _) + _ ≤ _ := hlength i + have hselected' : Real.exp (-q) ≤ ‖𝔼 v ∈ translatedIntegerBox (0 : X → ℤ) length, + (Real.fourierChar (MvPolynomial.eval + (fun i => ((start i : ℤ) : ℝ) + (W.modulus : ℝ) * (v i : ℝ)) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * R'.eval v‖ := by + rw [hzero] + simpa only [hR'eval, Int.cast_natCast] using + (Real.exp_le_exp.mpr (neg_le_neg hfreqq)).trans hselected + have hann := hremove J d D htd R' W.cover W.cover_pos a poly hpoly U hcoeff q Rrank + hq hR' hR'cap (hcover.trans (Real.exp_le_exp.mpr hpq)) + (fun i => (ha i).trans (Real.exp_le_exp.mpr hfreqq)) + W.modulus W.modulus_pos (hmod.trans (Real.exp_le_exp.mpr hpq)) + (fun i => (start i : ℤ)) (Real.exp (3 * p + 16)) + (Real.one_le_exp (by positivity)) (Real.exp_le_exp.mpr hsideq) + (fun i => (N i : ℝ)) (fun i => (Real.exp_pos _).trans_le (hN i)) + 0 length hpos hcomparison (hX.trans hpq) hlong + ((Real.exp_le_exp.mpr hremovefinal).trans hRrank) hrank hselected' + refine ⟨start, length, a, hpos, hlength, hcomparison, hinside, ?_, ?_, hann⟩ + · exact fun i => (ha i).trans (Real.exp_le_exp.mpr (hfreqq.trans hqfinal)) + · exact (Real.exp_le_exp.mpr (neg_le_neg (hfreqq.trans hqfinal))).trans hselected + +theorem exists_low_localized_correlating_frequency (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L : Type} [Fintype X] [DecidableEq X] + [LieRing L] [LieAlgebra ℚ L] {t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (J : Fin m → Type) [∀ j, Fintype (J j)] + {periodCap coverCap : ℝ} {Lip : ℝ≥0} + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (d : ℕ) (D : RationalFilteredNilmanifold L t e) (_htd : t ≤ d) + (R : D.Niltest (fun _ : X => 1)) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (_hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (p Rrank : ℝ), 0 ≤ p → R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + (Fintype.card X : ℝ) ≤ p → (Fintype.card (Σ j, J j) : ℝ) ≤ p → + (W.modulus : ℝ) ≤ Real.exp p → (W.cover : ℝ) ≤ Real.exp p → + (Lip : ℝ) ≤ Real.exp p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (N i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, d < j.val + 1 → HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp (-p) ≤ ‖𝔼 u ∈ integerBox N, W.eval N poly u * R.eval u‖ → + ∃ (start length : X → ℕ) (a : (Σ j, J j) → ℤ), + (∀ i, 0 < length i) ∧ + (∀ i, (N i : ℝ) * Real.exp (-(3 * p + 16)) ≤ length i) ∧ + (∀ i, (N i : ℝ) ≤ Real.exp (3 * p + 16) * W.modulus * length i) ∧ + (∀ v ∈ integerBox length, + (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i) ∈ integerBox N) ∧ + (∀ j, |(a j : ℝ)| ≤ Real.exp ((p + C) ^ C)) ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖𝔼 v ∈ integerBox length, + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (W.modulus : ℝ) * v i) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * + R.eval (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i)‖ ∧ + (∀ j, d < j.val + 1 → ∀ i, a ⟨j, i⟩ = 0) ∧ + (normalizedTwistFrequencyPolynomial W.cover a poly).totalDegree ≤ d := by + obtain ⟨C, hC, hextract⟩ := exists_rank_localized_correlating_frequency m + refine ⟨C, hC, ?_⟩ + intro X L _ _ _ _ t e _ _ _ _ J _ periodCap coverCap Lip W d D htd R N poly hpoly + U hcoeff p Rrank hp hR hcap hX hJ hmod hcover hLip hN hRrank hrank hcorr + obtain ⟨start, length, a, hpos, hlength, hcomparison, hinside, ha, hselected, hann⟩ := + hextract J W d D htd R N poly hpoly U hcoeff p Rrank hp hR hcap hX hJ + hmod hcover hLip hN hRrank hrank hcorr + refine ⟨start, length, truncateTaggedFrequency d a, hpos, hlength, hcomparison, hinside, + ?_, ?_, ?_, normalizedTwistFrequencyPolynomial_low_degree W.cover d a poly hpoly⟩ + · intro i + by_cases hi : i.1.val + 1 ≤ d + · simpa only [truncateTaggedFrequency, ite_eq_left hi] using ha i + · simp only [truncateTaggedFrequency, ite_eq_right hi, Int.cast_zero, abs_zero] + exact Real.exp_nonneg _ + · rw [← normalizedTwistFrequencyPolynomial_truncate_correlation W.cover d U a poly + hcoeff hann (integerBox length) + (fun v i => (start i : ℝ) + (W.modulus : ℝ) * v i) + (fun v => R.eval (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i))] + exact hselected + · intro j hj i + simp only [truncateTaggedFrequency, ite_eq_right (not_le_of_gt hj)] + +end Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +end + +section + +namespace Erdos3.VectorPolynomial + +open MvPolynomial RationalFilteredNilmanifold +open scoped BigOperators TensorProduct Classical + +variable {X : Type*} {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + +theorem normalizedTwistFrequencyPolynomial_eq_zero_of_annihilates + (cover : ℕ) (a : (Σ j, J j) → ℤ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (hm : ∀ j α, coefficients (poly j) α ∈ U j) + (ha : ∀ j, U j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩))) : + normalizedTwistFrequencyPolynomial cover a poly = 0 := by + have hz (j : Fin m) : integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j) = 0 := by + ext α + rw [integerRowPolynomial_coeff, AddMonoidAlgebra.coeff_zero, ← integerRowLinear_apply] + exact ha j (hm j α) + simp only [normalizedTwistFrequencyPolynomial, hz, Finset.sum_const_zero, mul_zero] + +theorem exists_normalizedTwist_uniform_box_frequency_comparison (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X : Type} [Fintype X] [DecidableEq X] + {J : Fin m → Type} [∀ j, Fintype (J j)] + (cover : ℕ), 0 < cover → ∀ (a : (Σ j, J j) → ℤ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)), + (∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) → + ∀ (U : ∀ j, Submodule ℝ (J j → ℝ)), + (∀ j α, coefficients (poly j) α ∈ U j) → + ∀ (p Rrank : ℝ), 2 ≤ p → + (cover : ℝ) ≤ Real.exp p → (∀ i, |(a i : ℝ)| ≤ Real.exp p) → + ∀ (q : ℕ), 0 < q → (q : ℝ) ≤ Real.exp p → + ∀ (start : X → ℤ) (K : ℝ), 1 ≤ K → K ≤ Real.exp p → + ∀ (N : X → ℝ), (∀ i, 0 < N i) → + ∀ (origin : X → ℤ) (lengths : X → ℕ), (∀ i, 0 < lengths i) → + (∀ i, N i ≤ K * (q : ℝ) * (lengths i : ℝ)) → + (Fintype.card X : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, HasLayerSamplingRank (j.val + 1) N Rrank (U j) (poly j)) → + ‖(𝔼 x ∈ translatedIntegerBox origin lengths, + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (q : ℝ) * (x i : ℝ)) + (normalizedTwistFrequencyPolynomial cover a poly)) : ℂ)) - + (if ∀ j, U j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩)) + then 1 else 0)‖ ≤ Real.exp (-p) := by + classical + obtain ⟨C, hC, hremove⟩ := exists_normalizedTwist_high_frequency_removal_on_progression m + refine ⟨C, hC, ?_⟩ + intro X _ _ J _ cover hcover a poly hpoly U hm p Rrank hp hcoverp ha + q hq hqp start K hK hKp N hN origin lengths hlengths hNL hdim hlarge hRrank hrank + by_cases hann : ∀ j, U j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩)) + · rw [ite_eq_left hann, normalizedTwistFrequencyPolynomial_eq_zero_of_annihilates cover a poly U hm hann] + let : ∀ i, NeZero (lengths i) := fun i => ⟨(hlengths i).ne'⟩ + simp only [map_zero, Real.fourierChar.map_zero_eq_one, Circle.coe_one, + Finset.expect_const (translatedIntegerBox_nonempty lengths origin), sub_self, norm_zero] + exact (Real.exp_pos _).le + · rw [ite_eq_right hann, sub_zero] + apply le_of_lt + by_contra! hcorr + let R := Niltest.const (RationalTorus.trivialNilmanifold 0) (fun _ : X => 1) 1 + have hR : R.ComplexityLE p := RationalTorus.trivialNilmanifold_const_one_complexity 0 _ hp + have hcap : (R.normBound : ℝ) ≤ 1 := by simp [R, Niltest.const] + have hcorr' : Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (q : ℝ) * (x i : ℝ)) + (normalizedTwistFrequencyPolynomial cover a poly)) : ℂ) * R.eval x‖ := by + simpa only [R, Niltest.eval_const, mul_one] using hcorr + have hall := hremove J 0 (RationalTorus.trivialNilmanifold 0) le_rfl R cover hcover a poly hpoly U + (fun j α _ => hm j α) p Rrank (by linarith) hR hcap hcoverp ha q hq hqp + start K hK hKp N hN origin lengths hlengths hNL hdim hlarge hRrank + (fun j _ => hrank j) hcorr' + exact hann (fun j => hall j (Nat.succ_pos _)) + +theorem exists_normalizedTwist_uniform_box_fourier_comparison (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X : Type} [Fintype X] [DecidableEq X] + {J : Fin m → Type} [∀ j, Fintype (J j)] + {F : Type*} [Fintype F] (cover : ℕ), 0 < cover → + ∀ (frequency : F → (Σ j, J j) → ℤ) (coeff : F → ℂ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)), + (∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) → + ∀ (U : ∀ j, Submodule ℝ (J j → ℝ)), + (∀ j α, coefficients (poly j) α ∈ U j) → + ∀ (p Rrank : ℝ), 2 ≤ p → + (cover : ℝ) ≤ Real.exp p → (∀ b i, |(frequency b i : ℝ)| ≤ Real.exp p) → + ∀ (q : ℕ), 0 < q → (q : ℝ) ≤ Real.exp p → + ∀ (start : X → ℤ) (K : ℝ), 1 ≤ K → K ≤ Real.exp p → + ∀ (N : X → ℝ), (∀ i, 0 < N i) → + ∀ (origin : X → ℤ) (lengths : X → ℕ), (∀ i, 0 < lengths i) → + (∀ i, N i ≤ K * (q : ℝ) * (lengths i : ℝ)) → + (Fintype.card X : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, HasLayerSamplingRank (j.val + 1) N Rrank (U j) (poly j)) → + ‖(𝔼 x ∈ translatedIntegerBox origin lengths, + ∑ b, coeff b * (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (q : ℝ) * (x i : ℝ)) + (normalizedTwistFrequencyPolynomial cover (frequency b) poly)) : ℂ)) - + ∑ b, coeff b * (if ∀ j, U j ≤ LinearMap.ker + (integerRowLinear (fun i => frequency b ⟨j, i⟩)) then 1 else 0)‖ ≤ + (∑ b, ‖coeff b‖) * Real.exp (-p) := by + obtain ⟨C, hC, hfreq⟩ := exists_normalizedTwist_uniform_box_frequency_comparison m + refine ⟨C, hC, ?_⟩ + intro X _ _ J _ F _ cover hcover frequency coeff poly hpoly U hm p Rrank hp hcoverp ha + q hq hqp start K hK hKp N hN origin lengths hlengths hNL hdim hlarge hRrank hrank + simp_rw [Finset.expect_sum_comm, ← Finset.mul_expect] + rw [← Finset.sum_sub_distrib, Finset.sum_mul] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro b _ + rw [← mul_sub, norm_mul] + exact mul_le_mul_of_nonneg_left + (hfreq cover hcover (frequency b) poly hpoly U hm p Rrank hp hcoverp (ha b) + q hq hqp start K hK hKp N hN origin lengths hlengths hNL hdim hlarge hRrank hrank) + (norm_nonneg _) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MvPolynomial Module RationalFilteredNilmanifold PolynomialTranslationLie +open scoped TensorProduct NNReal BigOperators + +noncomputable def majorPhaseSample {m : ℕ} {X : Type} + (J : Fin m → Type) [∀ j, Fintype (J j)] (d : ℕ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (Ψ : PatchKernel (Fintype.card (LowTaggedIndex J d))) + (c : Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) + (F : MvPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J d))) ℝ) + (β : (X → ℤ) → Fin (Fintype.card (LowTaggedIndex J d)) → ℤ) + (r : (X → ℤ) → ℂ) (u : X → ℤ) : ℂ := + ((Ψ.value (fun i => MvPolynomial.eval (fun x => (u x : ℝ)) + (lowTaggedPolynomial J d poly i) - c i - (β u i : ℝ)) : ℂ) * + (Real.fourierChar (MvPolynomial.eval (fun j => ((Sum.elim u (β u) j : ℤ) : ℝ)) F) : ℂ)) * r u + +theorem exists_majorPhase_low_localized_correlating_frequency (m d : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L : Type} [Fintype X] [DecidableEq X] + [LieRing L] [LieAlgebra ℚ L] {t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (J : Fin m → Type) [∀ j, Fintype (J j)] + {periodCap coverCap : ℝ} {Lip : ℝ≥0} + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (D : RationalFilteredNilmanifold L t e) (_htd : t ≤ d) + (R : D.Niltest (fun _ : X => 1)) (_hd : 0 < d) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (_hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (Ψ : PatchKernel (Fintype.card (LowTaggedIndex J d))) + (c : Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) + (F : MvPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J d))) ℝ) + (_hF : F ∈ weightedSupportLE + (Sum.elim (fun _ : X => 1) (lowTaggedWeight J d)) d) + (β : (X → ℤ) → Fin (Fintype.card (LowTaggedIndex J d)) → ℤ) + (_hβ : ∀ u ∈ integerBox N, ∀ i, + |MvPolynomial.eval (fun x => (u x : ℝ)) (lowTaggedPolynomial J d poly i) - + c i - (β u i : ℝ)| ≤ 1 / 2) + (p Rrank : ℝ), 0 ≤ p → R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + ((Fintype.card X + Fintype.card (Σ j, J j) : ℕ) : ℝ) ≤ p → + (W.modulus : ℝ) ≤ Real.exp p → (W.cover : ℝ) ≤ Real.exp p → + (Lip : ℝ) ≤ Real.exp p → (Ψ.lip : ℝ) ≤ Real.exp p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (N i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, d < j.val + 1 → HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp (-p) ≤ ‖𝔼 u ∈ integerBox N, + W.eval N poly u * majorPhaseSample J d poly Ψ c F β R.eval u‖ → + ∃ (start length : X → ℕ) (a : (Σ j, J j) → ℤ), + (∀ i, 0 < length i) ∧ + (∀ i, (N i : ℝ) * Real.exp (-((p + C) ^ C)) ≤ length i) ∧ + (∀ i, (N i : ℝ) ≤ Real.exp ((p + C) ^ C) * W.modulus * length i) ∧ + (∀ v ∈ integerBox length, + (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i) ∈ integerBox N) ∧ + (∀ j, |(a j : ℝ)| ≤ Real.exp ((p + C) ^ C)) ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖𝔼 v ∈ integerBox length, + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (W.modulus : ℝ) * v i) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * + majorPhaseSample J d poly Ψ c F β R.eval + (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i)‖ ∧ + (∀ j, d < j.val + 1 → ∀ i, a ⟨j, i⟩ = 0) ∧ + (normalizedTwistFrequencyPolynomial W.cover a poly).totalDegree ≤ d := by + obtain ⟨aC, _, hpartner⟩ := exists_majorTranslation_partner_niltest d + obtain ⟨bC, _, hextract⟩ := + NormalizedPolynomialTwist.exists_low_localized_correlating_frequency m + obtain ⟨C, hC, hbudget⟩ := exists_majorPhaseLowFourierExtraction_budget aC bC + refine ⟨C, hC, ?_⟩ + intro X L _ _ _ _ t e _ _ _ _ J _ periodCap coverCap Lip W D htd R hd + N poly hpoly U hcoeff Ψ c F hF β hβ p Rrank hp hR hcap hdim hmod hcover hLip hΨ + hN hRrank hrank hcorr + let w := lowTaggedWeight J d + have hw : ∀ i, 0 < w i := lowTaggedWeight_pos J d + have hwd : ∀ i, w i ≤ d := lowTaggedWeight_le J d + let := weightedBasisIndex_finite w d hw + let : Fintype (WeightedBasisIndex w d) := Fintype.ofFinite _ + let := moduleTopology ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d) := + realification_moduleTopology_t2 (weightedBasis w d hw) + let A := fun i => lowTaggedPolynomial J d poly i - MvPolynomial.C (c i) + have hA : ∀ i, (A i).totalDegree ≤ w i := fun i => + (MvPolynomial.totalDegree_sub_C_le _ _).trans (lowTaggedPolynomial_degree J d poly hpoly i) + have hdimMajor : ((Fintype.card X + Fintype.card (LowTaggedIndex J d) : ℕ) : ℝ) ≤ p := by + apply le_trans _ hdim + exact_mod_cast Nat.add_le_add_left (lowTaggedIndex_card_le J d) _ + let M := majorTranslationPartnerModel w d hw hwd D htd + let : FiniteDimensional ℚ (PairAlgebra (weightedSubalgebra w d) L) := + M.basis.finiteDimensional_of_finite + let := moduleTopology ℝ (ℝ ⊗[ℚ] PairAlgebra (weightedSubalgebra w d) L) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] PairAlgebra (weightedSubalgebra w d) L) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] PairAlgebra (weightedSubalgebra w d) L) := + realification_moduleTopology_t2 M.basis + obtain ⟨S, hSnorm, hS, hSeval⟩ := + hpartner w hw hwd D htd R hd Ψ F hF A hA p hp hdimMajor hΨ hR hcap + have hsample (u : X → ℤ) (hu : u ∈ integerBox N) : + S.eval u = majorPhaseSample J d poly Ψ c F β R.eval u := by + have hclose : ∀ i, |MvPolynomial.eval (fun j => (u j : ℝ)) (A i) - (β u i : ℝ)| ≤ 1/2 := by + simpa only [A, map_sub, eval_C] using hβ u hu + simpa only [majorPhaseSample, A, map_sub, eval_C] using hSeval u (β u) hclose + let q : ℝ := (p + aC) ^ aC + p + 1 + have hpow : 0 ≤ (p + aC) ^ aC := by positivity + have hpq : p ≤ q := by dsimp [q]; linarith + have hq : 0 ≤ q := hp.trans hpq + have hSq : S.ComplexityLE q := hS.mono (by dsimp [q]; linarith) + have hcapS : (S.normBound : ℝ) ≤ 1 := by rw [hSnorm]; rfl + have hX : (Fintype.card X : ℝ) ≤ p := by + apply le_trans _ hdim + exact_mod_cast Nat.le_add_right (Fintype.card X) (Fintype.card (Σ j, J j)) + have hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p := by + apply le_trans _ hdim + exact_mod_cast Nat.le_add_left (Fintype.card (Σ j, J j)) (Fintype.card X) + obtain ⟨_, hfinal, hside⟩ := hbudget p hp + have hcorrS : Real.exp (-q) ≤ ‖𝔼 u ∈ integerBox N, W.eval N poly u * S.eval u‖ := by + have heq : (𝔼 u ∈ integerBox N, W.eval N poly u * S.eval u) = + 𝔼 u ∈ integerBox N, W.eval N poly u * majorPhaseSample J d poly Ψ c F β R.eval u := by + apply Finset.expect_congr rfl + intro u hu + rw [hsample u hu] + rw [heq] + exact (Real.exp_le_exp.mpr (neg_le_neg hpq)).trans hcorr + obtain ⟨start, length, a, hpos, hlength, hcomparison, hinside, ha, hselected, hhigh, hdegree⟩ := + hextract J W d M le_rfl S N poly hpoly U hcoeff q Rrank hq hSq hcapS + (hX.trans hpq) (hJ.trans hpq) + (hmod.trans (Real.exp_le_exp.mpr hpq)) (hcover.trans (Real.exp_le_exp.mpr hpq)) + (hLip.trans (Real.exp_le_exp.mpr hpq)) + (fun i => (Real.exp_le_exp.mpr hfinal).trans (hN i)) + ((Real.exp_le_exp.mpr hfinal).trans hRrank) hrank hcorrS + refine ⟨start, length, a, hpos, ?_, ?_, hinside, ?_, ?_, hhigh, hdegree⟩ + · intro i + exact (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (neg_le_neg hside)) + (Nat.cast_nonneg (N i))).trans (hlength i) + · intro i + exact (hcomparison i).trans (by + gcongr) + · exact fun j => (ha j).trans (Real.exp_le_exp.mpr hfinal) + · have heq : (𝔼 v ∈ integerBox length, + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (W.modulus : ℝ) * v i) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * + S.eval (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i)) = + 𝔼 v ∈ integerBox length, + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (W.modulus : ℝ) * v i) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * + majorPhaseSample J d poly Ψ c F β R.eval + (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i) := by + apply Finset.expect_congr rfl + intro v hv + rw [hsample _ (hinside v hv)] + rw [heq] at hselected + exact (Real.exp_le_exp.mpr (neg_le_neg hfinal)).trans hselected + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/MarkedQuotientFrequencyBounds.lean b/lean/OAI/Combinatorics/Progressions/Fourier/MarkedQuotientFrequencyBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b0f0b83eaf8f80c5b2c4fbb8375d459b47fe521 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/MarkedQuotientFrequencyBounds.lean @@ -0,0 +1,110 @@ +import OAI.Combinatorics.Progressions.Linear.MarkedProjectionBounds +import OAI.Combinatorics.Progressions.Polynomial.MarkedPolynomialFunctionalBounds + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {I ι L : Type*} [Fintype I] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + {s r : ℕ} (F : DegreeRankLieFiltration L s r) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.associatedDegree.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (v : I → L) (w : I → ℕ) (marked : I → Bool) (hw : ∀ i, 0 < w i) + (hv : ∀ i, v i ∈ F.layer (w i) 1) {H : ℕ} (hH : 1 ≤ H) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants b i j k) H) + (hgen : ∀ i j, RationalHeightLE (b.repr (v i) j) H) + +include hH hc hgen in +theorem markedShiftPolynomialGenerator_quotient_height (hω : ∀ i, ω i ≤ s) (t : ℕ) + (e : Basis (Fin (finrank ℚ (markedShiftSubalgebra F v w marked t))) ℚ + (markedShiftSubalgebra F v w marked t)) + (he : ∀ i j, RationalHeightLE ((F.associatedDegree.polynomialShiftBasis b ω hF t).repr + (e i).val j) (lieTreeHeight (Fintype.card ι) H s)) + {q Q : ℕ} (f : Basis (Fin q) ℚ (MarkedShiftQuotient F v w marked t)) + (hf : ∀ i j, RationalHeightLE + (f.repr (lieQuotientMap (markedShiftSecondIdeal F v w marked t) (e j)) i) Q) + (d k l : ℕ) (p : finiteMarkedPolynomialValues (σ := Fin t) v w marked s d k l) + (j : Fin q) : + let T := lieTreeHeight (Fintype.card ι) H s + let a := finrank ℚ (F.associatedDegree.PolynomialShiftAlgebra t) + let n := finrank ℚ (markedShiftSubalgebra F v w marked t) + let C := (a + 1) * (rationalSolveHeight n T * T) ^ a + RationalHeightLE + (f.repr (lieQuotientMap (markedShiftSecondIdeal F v w marked t) + (markedShiftPolynomialGenerator F v w marked hw hv t d k l p)) j) + ((n + 1) * (C * Q) ^ n) := by + classical + dsimp only + let _ : Fintype (NilpotentLieFiltration.AdaptedBasisIndex (fun _ : Fin t => 1) ω) := + NilpotentLieFiltration.adaptedBasisIndexFintype (fun _ : Fin t => 1) ω s (by simp) hω + let g := markedShiftPolynomialGenerator F v w marked hw hv t d k l p + have hg (i) := markedShiftPolynomialGenerator_coordinate_height F v w marked hw hv + b ω hF hH hc hgen t d k l p i + have hcoords (i) := embedding_basis_coordinate_height e + (F.associatedDegree.polynomialShiftBasis b ω hF t) + (markedShiftSubalgebra F v w marked t).incl.toLinearMap + (fun _ _ h => Subtype.ext h) (hH.trans (lieTreeHeight_ge_input _ _ _)) + (fun j i => he i j) g hg i + have h := linearMap_coordinate_height e f + (lieQuotientMap (markedShiftSecondIdeal F v w marked t)).toLinearMap + (fun i j => hf j i) g hcoords j + simpa only [LieHom.coe_toLinearMap, g, Fintype.card_fin, + ← finrank_eq_card_basis (F.associatedDegree.polynomialShiftBasis b ω hF t)] using h + +include hw hv hH hc hgen in +theorem exists_markedShift_bounded_quotient_frequency (hω : ∀ i, ω i ≤ s) (t : ℕ) + (e : Basis (Fin (finrank ℚ (markedShiftSubalgebra F v w marked t))) ℚ + (markedShiftSubalgebra F v w marked t)) + (he : ∀ i j, RationalHeightLE ((F.associatedDegree.polynomialShiftBasis b ω hF t).repr + (e i).val j) (lieTreeHeight (Fintype.card ι) H s)) + {q Q K A : ℕ} (f : Basis (Fin q) ℚ (MarkedShiftQuotient F v w marked t)) + (hQ : 1 ≤ Q) + (hf : ∀ i j, RationalHeightLE + (f.repr (lieQuotientMap (markedShiftSecondIdeal F v w marked t) (e j)) i) Q) + (η : L →ₗ[ℚ] ℚ) (hη : ∀ i, RationalHeightLE (η (b i)) K) + (a : Fin t → ℚ) (hA : 1 ≤ A) (ha : ∀ i, RationalHeightLE (a i) A) + (d k l : ℕ) + (hann : markedShiftPolynomialSubmodule F v w marked t d k l ⊓ + (markedShiftSecondIdeal F v w marked t).toSubmodule ≤ + (η.comp (markedShiftEval F v w marked t a)).ker) : + let T := lieTreeHeight (Fintype.card ι) H s + let z := finrank ℚ (F.associatedDegree.PolynomialShiftAlgebra t) + let n := finrank ℚ (markedShiftSubalgebra F v w marked t) + let C := (z + 1) * (rationalSolveHeight n T * T) ^ z + let E := (n + 1) * (C * Q) ^ n + let V := A ^ s * ((Fintype.card ι + 1) * (T * K) ^ Fintype.card ι) + let m := finrank ℚ ((markedShiftPolynomialSubmodule F v w marked t d k l).map + (markedShiftSecondIdeal F v w marked t).toSubmodule.mkQ) + ∃ ξ : MarkedShiftQuotient F v w marked t →ₗ[ℚ] ℚ, + (∀ x ∈ markedShiftPolynomialSubmodule F v w marked t d k l, + ξ (lieQuotientMap (markedShiftSecondIdeal F v w marked t) x) = + η (markedShiftEval F v w marked t a x)) ∧ + ∀ i, RationalHeightLE (ξ (f i)) ((m + 1) * (rationalSolveHeight m E * V) ^ m) := by + dsimp only + have hT : 0 < lieTreeHeight (Fintype.card ι) H s := + Nat.zero_lt_of_lt (hH.trans (lieTreeHeight_ge_input _ _ _)) + have hsolve := rationalSolveHeight_pos + (finrank ℚ (markedShiftSubalgebra F v w marked t)) (Nat.succ_le_iff.mpr hT) + have hQpos : 0 < Q := Nat.zero_lt_of_lt hQ + apply exists_bounded_quotient_functional + (markedShiftPolynomialSubmodule F v w marked t d k l) + (markedShiftSecondIdeal F v w marked t).toSubmodule f + (markedShiftPolynomialGenerator F v w marked hw hv t d k l) + (markedShiftPolynomialGenerator_span F v w marked hw hv t d k l) + (η.comp (markedShiftEval F v w marked t a)) hann + · exact Nat.succ_le_iff.mpr (by positivity) + · intro p j + exact markedShiftPolynomialGenerator_quotient_height F b ω hF v w marked hw hv + hH hc hgen hω t e he f hf d k l p j + · intro p + exact finiteMarkedPolynomialValues_functional_height v w marked b η hA hc hgen hη + t d k l a ha p.property + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/MarkedRealFrequencyCompatibility.lean b/lean/OAI/Combinatorics/Progressions/Fourier/MarkedRealFrequencyCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..8eee815080fc1e10c0dc595b60fc1faaea76bb92 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/MarkedRealFrequencyCompatibility.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Estimates.MarkedShiftGeneratorBounds + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct + +variable {I L : Type*} [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (v : I → L) (w : I → ℕ) (marked : I → Bool) + (t : ℕ) (a : Fin t → ℚ) (d k l : ℕ) + (ξ : MarkedShiftQuotient F v w marked t →ₗ[ℚ] ℚ) (η : L →ₗ[ℚ] ℚ) + +theorem marked_frequency_realification + (hξ : ∀ z ∈ markedShiftPolynomialSubmodule F v w marked t d k l, + ξ (lieQuotientMap (markedShiftSecondIdeal F v w marked t) z) = + η (markedShiftEval F v w marked t a z)) + (z : ℝ ⊗[ℚ] markedShiftSubalgebra F v w marked t) + (hz : z ∈ (markedShiftPolynomialSubmodule F v w marked t d k l).baseChange ℝ) : + realifyFunctional ξ + ((lieQuotientMap (markedShiftSecondIdeal F v w marked t)).toLinearMap.baseChange ℝ z) = + realifyFunctional η ((markedShiftEval F v w marked t a).baseChange ℝ z) := by + have h := realifyFunctional_eq_on_submodule + (markedShiftPolynomialSubmodule F v w marked t d k l) + (ξ.comp (lieQuotientMap (markedShiftSecondIdeal F v w marked t)).toLinearMap) + (η.comp (markedShiftEval F v w marked t a)) hξ z hz + simpa only [realifyFunctional_comp] using h + +theorem marked_frequency_character_eq + (hξ : ∀ z ∈ markedShiftPolynomialSubmodule F v w marked t d k l, + ξ (lieQuotientMap (markedShiftSecondIdeal F v w marked t) z) = + η (markedShiftEval F v w marked t a z)) + (z : ℝ ⊗[ℚ] markedShiftSubalgebra F v w marked t) + (hz : z ∈ (markedShiftPolynomialSubmodule F v w marked t d k l).baseChange ℝ) : + CircleFourier.character ((realifyFunctional ξ + ((lieQuotientMap (markedShiftSecondIdeal F v w marked t)).toLinearMap.baseChange ℝ z) : ℝ) : + CircleFourier.Circle) = + CircleFourier.character ((realifyFunctional η + ((markedShiftEval F v w marked t a).baseChange ℝ z) : ℝ) : CircleFourier.Circle) := + congrArg (fun x : ℝ => CircleFourier.character (x : CircleFourier.Circle)) + (marked_frequency_realification F v w marked t a d k l ξ η hξ z hz) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/MixedDiscreteFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/MixedDiscreteFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e480f7b67a67be2e47dc637a63af115fe0d5a68 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/MixedDiscreteFourier.lean @@ -0,0 +1,131 @@ +import OAI.Combinatorics.Progressions.Estimates.BoundedWeightedSliceAxis + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def moderateSliceFourierAxis {b n q K : ℕ} [NeZero b] [NeZero K] + (c : Fin b → NormalizedScalarCubeSource Empty) + (s : Fin b → Fin n → NormalizedScalarCubeSource (Fin q)) + (offset : Fin b → ℤ) (stride : Fin b → ℕ) (root : Fin b → Fin n → ℤ) + (A W T : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (M V : ℕ) (hV : 1 ≤ V) + (hcM : ∀ a, (c a).modulusBound ≤ M) (hcW : ∀ a, (c a).weightBound ≤ W) + (hcT : ∀ a, (c a).weightLipschitz ≤ T) + (hM : ∀ a j, (s a j).modulusBound ≤ M) (hW : ∀ a j, (s a j).weightBound ≤ W) + (hT : ∀ a j, (s a j).weightLipschitz ≤ T) (ht : ∀ a, 0 < stride a) (htV : ∀ a, stride a ≤ V) + {O F D E : ℝ} (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) + (hroot : ∀ a j, |(root a j : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (|(offset a : ℝ)| + (stride a : ℝ) * (c a).length) * + (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ((c a).length * ∏ j, ((s a j).length : ℝ))) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (hcpower : ∀ a, (K : ℝ) ≤ E * ((c a).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n) + (hB : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : IntegerFourierAxis := by + let U := affinePrimitiveEnvelope (Fin q) A W T M V + let Q := affineTorusRadius (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) F + let ζ := fun ε => uniformBlockRetainedBias n J.card (p * J.card) U ((R : ℝ) * D) + (((R : ℝ) * E) ^ J.card) ε + refine IntegerFourierAxis.ofEstimate (moderateSliceIntegerSource c s root) + (moderateSliceIntegerSum c s offset stride root J) K Q (R * K) + (Nat.le_mul_of_pos_left K (affineTorusFactor_pos _ _ _ _ _)) + (uniformSpectrumSizeConstant n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card)) + (max (majorArcSpectrumExponent n J.card) (majorArcLengthExponent n * (p * J.card))) + (uniformSpectrumAbsoluteCap n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card)) + (fun ε => uniformCharacterDenominatorBound n J.card (p * J.card) U + ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) (ζ ε)) + (fun ε => 2 * majorArcCoverConstant n J.card U ((R : ℝ) * D) / + (ζ ε) ^ majorArcCoverExponent n J.card) ?_ + intro ε hε hε1 + have he := moderateSlice_geometric_approximation c s offset stride root + A W T hA M V hV hcM hcW hcT hM hW hT ht htV hO hD hE hε hε1 + hroot hupper hlower p hpower hcpower J hJ hB + dsimp only at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS, ?_, ?_, ?_⟩ + · intro center + apply le_trans ?_ (hcap center) + apply le_of_eq + apply Finset.sum_congr + · ext k + simp only [Finset.mem_univ] + · intro k _ + rfl + · intro k hk + obtain ⟨d, hd, hdb, a, ξ, hξ, heq⟩ := hchar k hk + refine ⟨d, hd, hdb, a, ξ, hξ, ?_⟩ + intro j + simpa only [Nat.cast_mul] + using heq j + · intro center z hz + simpa only [R, integerGridApproximation, Fintype.card_coe] using happ center z hz + +end Erdos3 + +end + +section + +namespace Erdos3.IntegerFourierAxis + +open scoped BigOperators Classical + +attribute [local instance] sourceFinite coordinateFinite scaleNeZero periodNeZero + +theorem family_approximation {D : Type*} [Fintype D] [DecidableEq D] + (a : D → IntegerFourierAxis) {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) : + let C := finiteFamilyCap (fun d => (a d).coefficientCap) + let δ := jointGridAxisTolerance (Fintype.card D) (C + 1) ε + ∃ S : ∀ d, Finset ((a d).Coordinate → Fin (a d).period), + (Fintype.card (∀ d, S d) : ℝ) ≤ ∏ d, (a d).countConstant / δ ^ (a d).countExponent ∧ + (∀ center : ∀ d, (a d).Coordinate → ℤ, + (∑ k : ∀ d, S d, ‖∏ d, integerRetainedCoefficient (a d).law ((a d).image (center d)) + (a d).scale (a d).period (k d)‖) ≤ C ^ Fintype.card D) ∧ + (∀ k : ∀ d, S d, ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ ∏ d, (a d).denominatorBound δ ∧ + ∃ (v : ∀ d, (a d).Coordinate → ℤ) (ξ : ∀ d, (a d).Coordinate → ℝ), + (∀ d j, |ξ d j| ≤ (a d).residualBound δ) ∧ + ∀ d j, (((k d).val j).val : ℝ) / (a d).period = (v d j : ℝ) / m + ξ d j / (a d).scale) ∧ + ∀ center z : ∀ d, (a d).Coordinate → ℤ, + (∀ d, centeredFundamentalBox (a d).radius (a d).scale (center d) (z d)) → + ‖(((∏ d, ((a d).scale : ℝ) ^ Fintype.card (a d).Coordinate) * + finiteImageMass (FiniteProbabilityWeights.pi (fun d => (a d).law)) + (fun x d => (a d).image (center d) (x d)) z : ℝ) : ℂ) - + jointRetainedExpansion S + (fun d => integerRetainedCoefficient (a d).law ((a d).image (center d)) (a d).scale (a d).period) + (fun d k w => star (rectangularGridCharacter (a d).period k w)) z‖ ≤ ε := by + dsimp only + let C := finiteFamilyCap (fun d => (a d).coefficientCap) + let δ := jointGridAxisTolerance (Fintype.card D) (C + 1) ε + have hC : 0 ≤ C := finiteFamilyCap_nonneg _ + have hδ := jointGridAxisTolerance_spec (Fintype.card D) (by linarith : 0 ≤ C + 1) hε + have hi (d : D) := (a d).approximation δ hδ.1 (hδ.2.1.trans hε1) + choose S hcard hcap hchar happ using hi + have hcapC (center : ∀ d, (a d).Coordinate → ℤ) (d : D) : + (∑ k, ‖integerGridCoefficient (a d).law ((a d).image (center d)) (a d).period k‖) ≤ C := + (hcap d (center d)).trans (le_finiteFamilyCap (fun e => (a e).coefficientCap) d) + refine ⟨S, jointRetainedExpansion_card_le_product S _ hcard, ?_, ?_, ?_⟩ + · intro center + exact independentPeriodTensor_coefficient_mass (fun d => (a d).law) + (fun d => (a d).image (center d)) (fun d => (a d).scale) (fun d => (a d).period) S + (fun d => (a d).scale_le_period) (hcapC center) + · intro k + exact independent_rational_frequencies + (fun d j => (((k d).val j).val : ℝ) / (a d).period) (fun d => (a d).scale) + (fun d => (a d).denominatorBound δ) (fun d => (a d).residualBound δ) + (fun d => hchar d (k d).val (k d).property) + · intro center z hz + exact independentPeriodTensor_approximation (fun d => (a d).law) + (fun d => (a d).image (center d)) (fun d => (a d).scale) (fun d => (a d).period) + S z hC hε hε1 (fun d => (a d).scale_le_period) (hcapC center) + (fun d => happ d (center d) (z d) (hz d)) + +end Erdos3.IntegerFourierAxis + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/MixedOriginalPairFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/MixedOriginalPairFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7afbcd875e642fae75fd80816f91977512cb508 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/MixedOriginalPairFrequency.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedPairComparison + +namespace OAI + +section + +namespace Erdos3.NativePolynomialOrbitFactors + +open RationalFilteredNilmanifold VectorPolynomial +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +variable {n m : ℕ} [NeZero m] {p q r : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p} {i j : Fin (W.tensorPower m).outputDim} + {V : NativeSampleCorrelation (fun _ : Fin (n + 2) => 1) (n + 1) q + Finset.univ (fun z : Fin (n + 2) → ZMod N => fun k => ((z k).val : ℤ)) + (fun z => (W.tensorPower m).mixedAntisymmetric i j (fun k => ((z k).val : ℤ)))} + (R : NativePolynomialOrbitFactors (pi V.mixedPairModels) + V.mixedPairPolynomial (piFrequency V.mixedPairFrequencies) + (fun _ : Fin (n + 2) => (N : ℝ)) r) + +variable (V) in +noncomputable def _root_.OAI.Erdos3.NativeSampleCorrelation.mixedOriginalPairProjection (k : Fin 2) : + V.MixedPairAlgebra →ₗ⁅ℚ⁆ W.L := liePiEval (some k) + +theorem mixed_original_pair_top_agreement (x : ℝ ⊗[ℚ] V.MixedPairAlgebra) + (hx : x ∈ (pi V.mixedPairModels).filtration.realGradedRefiltrationLayer + R.subalgebra (∑ _ : MixedReplicatedIndex (n + 1), 1)) : + realifyFunctional W.vertical.frequency (realificationLieHom (V.mixedOriginalPairProjection 0) x) = + realifyFunctional W.vertical.frequency (realificationLieHom (V.mixedOriginalPairProjection 1) x) := by + have cancel (a b : ℝ ⊗[ℚ] W.L) + (h : realifyFunctional (m • W.vertical.frequency) a = + realifyFunctional (m • W.vertical.frequency) b) : + realifyFunctional W.vertical.frequency a = realifyFunctional W.vertical.frequency b := by + rw [realifyFunctional_nsmul, realifyFunctional_nsmul] at h + simp only [nsmul_eq_mul] at h + exact mul_left_cancel₀ (Nat.cast_ne_zero.mpr (NeZero.ne m) : (m : ℝ) ≠ 0) h + exact cancel _ _ (R.mixed_pair_top_agreement x hx) + +theorem mixed_original_pair_middle_top_agreement (α : (Fin (n + 2)) →₀ ℕ) + (hα : Finsupp.weight (fun _ => 1) α = ∑ _ : MixedReplicatedIndex (n + 1), 1) : + realifyFunctional W.vertical.frequency (realificationLieHom (V.mixedOriginalPairProjection 0) + (coefficients (R.middle.coord : VectorPolynomial (Fin (n + 2)) ℚ + (ℝ ⊗[ℚ] V.MixedPairAlgebra)) α)) = + realifyFunctional W.vertical.frequency (realificationLieHom (V.mixedOriginalPairProjection 1) + (coefficients (R.middle.coord : VectorPolynomial (Fin (n + 2)) ℚ + (ℝ ⊗[ℚ] V.MixedPairAlgebra)) α)) := by + apply R.mixed_original_pair_top_agreement + simpa only [hα] using R.middle_coefficients α + +theorem mixed_original_pair_middle_bracket_agreement (α β : (Fin (n + 2)) →₀ ℕ) + (hαβ : Finsupp.weight (fun _ => 1) α + Finsupp.weight (fun _ => 1) β = + ∑ _ : MixedReplicatedIndex (n + 1), 1) : + realifyFunctional W.vertical.frequency + ⁅realificationLieHom (V.mixedOriginalPairProjection 0) + (coefficients (R.middle.coord : VectorPolynomial (Fin (n + 2)) ℚ + (ℝ ⊗[ℚ] V.MixedPairAlgebra)) α), + realificationLieHom (V.mixedOriginalPairProjection 0) + (coefficients (R.middle.coord : VectorPolynomial (Fin (n + 2)) ℚ + (ℝ ⊗[ℚ] V.MixedPairAlgebra)) β)⁆ = + realifyFunctional W.vertical.frequency + ⁅realificationLieHom (V.mixedOriginalPairProjection 1) + (coefficients (R.middle.coord : VectorPolynomial (Fin (n + 2)) ℚ + (ℝ ⊗[ℚ] V.MixedPairAlgebra)) α), + realificationLieHom (V.mixedOriginalPairProjection 1) + (coefficients (R.middle.coord : VectorPolynomial (Fin (n + 2)) ℚ + (ℝ ⊗[ℚ] V.MixedPairAlgebra)) β)⁆ := by + have cancel (a b : ℝ ⊗[ℚ] W.L) + (h : realifyFunctional (m • W.vertical.frequency) a = + realifyFunctional (m • W.vertical.frequency) b) : + realifyFunctional W.vertical.frequency a = realifyFunctional W.vertical.frequency b := by + rw [realifyFunctional_nsmul, realifyFunctional_nsmul] at h + simp only [nsmul_eq_mul] at h + exact mul_left_cancel₀ (Nat.cast_ne_zero.mpr (NeZero.ne m) : (m : ℝ) ≠ 0) h + exact cancel _ _ (R.mixed_pair_middle_bracket_agreement α β hαβ) + +end Erdos3.NativePolynomialOrbitFactors + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/MonomialCharacterMean.lean b/lean/OAI/Combinatorics/Progressions/Fourier/MonomialCharacterMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d3b94c04245a0649841c497e5eb1e386fbefbcf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/MonomialCharacterMean.lean @@ -0,0 +1,157 @@ +import OAI.Combinatorics.Progressions.Lattices.NormalizedLatticeSheet + +namespace OAI + +section + +namespace Erdos3 + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +noncomputable def euclideanCharacter (ξ x : E) : ℂ := + CircleFourier.character ((inner ℝ ξ x : ℝ) : CircleFourier.Circle) + +@[simp] +theorem euclideanCharacter_zero (ξ : E) : euclideanCharacter ξ 0 = 1 := by + simp [euclideanCharacter] + +@[simp] +theorem euclideanCharacter_add (ξ x y : E) : + euclideanCharacter ξ (x + y) = euclideanCharacter ξ x * euclideanCharacter ξ y := by + simp [euclideanCharacter, inner_add_right] + +@[simp] +theorem euclideanCharacter_neg (ξ x : E) : + euclideanCharacter ξ (-x) = star (euclideanCharacter ξ x) := by + simp [euclideanCharacter] + +@[simp] +theorem norm_euclideanCharacter (ξ x : E) : ‖euclideanCharacter ξ x‖ = 1 := by + simp [euclideanCharacter] + +theorem continuous_euclideanCharacter (ξ : E) : Continuous (euclideanCharacter ξ) := by + unfold euclideanCharacter CircleFourier.character + fun_prop + +theorem euclideanCharacter_eq_exp (ξ x : E) : + euclideanCharacter ξ x = Complex.exp (2 * Real.pi * Complex.I * (inner ℝ ξ x : ℝ)) := by + simpa only [euclideanCharacter, CircleFourier.character, fourier_apply, + one_zsmul, Int.cast_one, Complex.ofReal_one, mul_one, div_one] using + (fourier_coe_apply (T := (1 : ℝ)) (n := 1) (x := inner ℝ ξ x)) + +theorem euclideanCharacter_on_lattice (Λ : Submodule ℤ E) (ξ : E) + (hξ : ξ ∈ euclideanDualLattice Λ) (m : Λ) : euclideanCharacter ξ m = 1 := by + obtain ⟨n, hn⟩ := (mem_euclideanDualLattice Λ ξ).mp hξ m m.property + rw [euclideanCharacter, hn] + have hnzero : (((n : ℝ) : CircleFourier.Circle)) = 0 := by + exact (AddCircle.coe_eq_zero_iff (p := (1 : ℝ))).mpr ⟨n, by simp⟩ + rw [hnzero, CircleFourier.character_zero] + +theorem euclideanCharacter_sub_lattice (Λ : Submodule ℤ E) (ξ : E) + (hξ : ξ ∈ euclideanDualLattice Λ) (x : E) (m : Λ) : + euclideanCharacter ξ (x - m) = euclideanCharacter ξ x := by + rw [sub_eq_add_neg, euclideanCharacter_add, euclideanCharacter_neg, + euclideanCharacter_on_lattice Λ ξ hξ m, star_one, mul_one] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory Real +open scoped FourierTransform + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +theorem gaussian_character_integrable {t : ℝ} (ht : 0 < t) (ξ : E) : + Integrable (fun x : E => euclideanCharacter ξ x * + (Real.exp (-Real.pi * t * ‖x‖ ^ 2) : ℂ)) := by + have h := GaussianFourier.integrable_cexp_neg_mul_sq_norm_add + (show 0 < ((Real.pi * t : ℝ) : ℂ).re by simpa using mul_pos Real.pi_pos ht) + (2 * Real.pi * Complex.I) ξ + convert h using 1 + ext x + rw [euclideanCharacter_eq_exp, Complex.exp_add] + push_cast + rw [mul_comm] + simp only [neg_mul] + +theorem gaussian_fourier_prefactor {t : ℝ} (ht : 0 < t) (d : ℕ) : + ((Real.pi : ℂ) / ((Real.pi * t : ℝ) : ℂ)) ^ ((d : ℂ) / 2) = + (((Real.sqrt t) ^ d)⁻¹ : ℝ) := by + have he : (Real.pi : ℂ) / ((Real.pi * t : ℝ) : ℂ) = ((t⁻¹ : ℝ) : ℂ) := by + push_cast + field_simp + rw [he, ← Complex.ofReal_natCast, ← Complex.ofReal_ofNat, ← Complex.ofReal_div, + ← Complex.ofReal_cpow (inv_nonneg.mpr ht.le), Real.inv_rpow ht.le] + congr 2 + rw [show (d : ℝ) / 2 = (1 / 2 : ℝ) * d by ring, + Real.rpow_mul_natCast ht.le, Real.sqrt_eq_rpow] + +theorem gaussian_fourier_integral {t : ℝ} (ht : 0 < t) (ξ : E) : + (∫ x : E, euclideanCharacter (-ξ) x * (Real.exp (-Real.pi * t * ‖x‖ ^ 2) : ℂ)) = + ((((Real.sqrt t) ^ Module.finrank ℝ E)⁻¹ * + Real.exp (-Real.pi / t * ‖ξ‖ ^ 2) : ℝ) : ℂ) := by + have h := fourier_gaussian_innerProductSpace + (show 0 < ((Real.pi * t : ℝ) : ℂ).re by simpa using mul_pos Real.pi_pos ht) ξ + rw [gaussian_fourier_prefactor ht] at h + calc + _ = 𝓕 (fun v : E => Complex.exp (-((Real.pi * t : ℝ) : ℂ) * ‖v‖ ^ 2)) ξ := by + simp only [fourier_eq', smul_eq_mul, euclideanCharacter_eq_exp, inner_neg_left] + congr 1 + ext x + rw [real_inner_comm x ξ] + push_cast + congr 2 <;> ring + _ = _ := h + _ = _ := by + push_cast + congr 1 + congr 1 + field_simp + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +noncomputable def monomialCharacterMean (k : ℕ) (α : E) (N : ℕ) (ξ : E) : ℂ := + (∑ n ∈ Finset.Icc (-(N : ℤ)) (N : ℤ), euclideanCharacter ξ ((n : ℝ) ^ k • α)) / + ((Finset.Icc (-(N : ℤ)) (N : ℤ)).card : ℂ) + +theorem monomialCharacterMean_norm_le_one (k : ℕ) (α : E) (N : ℕ) (ξ : E) : + ‖monomialCharacterMean k α N ξ‖ ≤ 1 := by + have hne : (Finset.Icc (-(N : ℤ)) (N : ℤ)).Nonempty := ⟨0, by simp⟩ + have hc : (0 : ℝ) < (Finset.Icc (-(N : ℤ)) (N : ℤ)).card := by + exact_mod_cast hne.card_pos + rw [monomialCharacterMean, norm_div, Complex.norm_natCast] + apply (div_le_one hc).mpr + calc + _ ≤ ∑ n ∈ Finset.Icc (-(N : ℤ)) (N : ℤ), ‖euclideanCharacter ξ ((n : ℝ) ^ k • α)‖ := + norm_sum_le _ _ + _ = _ := by simp + +@[simp] +theorem monomialCharacterMean_zero (k : ℕ) (α : E) (N : ℕ) : + monomialCharacterMean k α N 0 = 1 := by + have hne : (Finset.Icc (-(N : ℤ)) (N : ℤ)).Nonempty := ⟨0, by simp⟩ + have hc : ((Finset.Icc (-(N : ℤ)) (N : ℤ)).card : ℂ) ≠ 0 := by + exact_mod_cast hne.card_ne_zero + simp only [monomialCharacterMean, euclideanCharacter, inner_zero_left, + AddCircle.coe_zero, CircleFourier.character_zero, Finset.sum_const, nsmul_eq_mul, + mul_one, div_self hc] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/NativeCharacterCrossFamily.lean b/lean/OAI/Combinatorics/Progressions/Fourier/NativeCharacterCrossFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..9358eaa7856edbc46a9352f7e384c775ccdac6c8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/NativeCharacterCrossFamily.lean @@ -0,0 +1,97 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeResidualCrossInduction + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMeanRowCorrelation.lie NativeMeanRowCorrelation.algebra + NativeMeanRowCorrelation.topology NativeMeanRowCorrelation.topologicalAdd + NativeMeanRowCorrelation.continuousSMul NativeMeanRowCorrelation.hausdorff + +theorem exists_gowers_of_native_character_cross_family {s A : ℕ} (hdetect : NativeCharacterCrossRowDetection s A) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {I : Type*} [Fintype I] [Nonempty I] {N : ℕ} [NeZero N] + {p : ℝ}, 0 ≤ p → Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ (a b : I → ZMod N → ℂ) (χ : I → ZMod N → AddChar (ZMod N) ℂ) + (K : I → (Fin 2 → ℤ) → ℂ), + (∀ i n, ‖a i n‖ ≤ 1) → (∀ i n, ‖b i n‖ ≤ 1) → + (∀ i, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) s p (K i))) → + Real.exp (-p) ≤ (𝔼 i, 𝔼 h : ZMod N, ‖𝔼 n : ZMod N, + characterCrossRow (a i) (b i) (χ i) h n * star (K i ![(h.val : ℤ), (n.val : ℤ)])‖) → + Real.exp (-((p + C) ^ C)) ≤ 𝔼 i, gowersNorm (s + 1) (b i) := by + let X : Polynomial ℕ := Polynomial.X + let T := 3 * X + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (T + (T + X + Polynomial.C A) ^ A) + refine ⟨C, hC, ?_⟩ + intro I _ _ N _ p hp hN a b χ K ha hb hK hcorr + classical + let c (i : I) := 𝔼 h : ZMod N, ‖𝔼 n : ZMod N, + characterCrossRow (a i) (b i) (χ i) h n * star (K i ![(h.val : ℤ), (n.val : ℤ)])‖ + let z (i : I) := Real.exp (-(2 * p)) * c i + let t := 3 * p + 2 + have ht : 0 ≤ t := by dsimp [t]; linarith + have hc0 (i : I) : 0 ≤ c i := Finset.expect_nonneg (fun _ _ => norm_nonneg _) + have hcap (i : I) : c i ≤ Real.exp (2 * p) := by + apply Finset.expect_le Finset.univ_nonempty + intro h _ + apply (RCLike.norm_expect_le (K := ℂ)).trans + apply Finset.expect_le Finset.univ_nonempty + intro n _ + rw [norm_mul, norm_star] + apply (mul_le_of_le_one_left (norm_nonneg _) ?_).trans + ((Classical.choice (hK i)).norm_eval_le _) + exact characterCrossRow_norm (a i) (b i) (χ i) (ha i) (hb i) h n + have hzcap (i : I) : z i ≤ 1 := by + calc + _ ≤ Real.exp (-(2 * p)) * Real.exp (2 * p) := + mul_le_mul_of_nonneg_left (hcap i) (Real.exp_nonneg _) + _ = 1 := by rw [← Real.exp_add, neg_add_cancel, Real.exp_zero] + have hzmean : Real.exp (-(3 * p)) ≤ 𝔼 i, z i := by + change Real.exp (-(3 * p)) ≤ 𝔼 i, Real.exp (-(2 * p)) * c i + rw [← Finset.mul_expect] + have heq : Real.exp (-(3 * p)) = Real.exp (-(2 * p)) * Real.exp (-p) := by + rw [← Real.exp_add] + congr 1 + ring + rw [heq] + exact mul_le_mul_of_nonneg_left hcorr (Real.exp_nonneg _) + obtain ⟨S, hS, hlarge⟩ := exists_dense_level_set z (Real.exp_nonneg (-(3 * p))) hzcap hzmean + have hhalf : Real.exp (-t) ≤ Real.exp (-(3 * p)) / 2 := by + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + calc + _ ≤ Real.exp (-t) * Real.exp 2 := mul_le_mul_of_nonneg_left + (by linarith [Real.add_one_le_exp (2 : ℝ)]) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; dsimp [t]; ring + have hzle (i : I) : z i ≤ c i := mul_le_of_le_one_left (hc0 i) + (Real.exp_le_one_iff.mpr (by linarith)) + have hcost : t + (t + p + A) ^ A ≤ (p + C) ^ C := by + simpa [X, T, t, Polynomial.eval₂_pow] using hbudget p hp + have hN' : Real.exp ((t + p + A) ^ A) ≤ (N : ℝ) := + (Real.exp_le_exp.mpr (by linarith)).trans hN + have hnorm (i : I) (hi : i ∈ S) : + Real.exp (-((t + p + A) ^ A)) ≤ gowersNorm (s + 1) (b i) := by + have hc : Real.exp (-t) ≤ c i := hhalf.trans ((hlarge i hi).trans (hzle i)) + obtain ⟨V⟩ := NativeMeanRowCorrelation.exists_of_expansion + (Classical.choice (hK i)) ht hc + exact hdetect V.model V.test (by linarith : 0 ≤ t + p) V.complexity hN' + (a i) (b i) (χ i) (ha i) (hb i) V.correlation + have hmass := dense_set_mean_lower_bound S (fun i => gowersNorm (s + 1) (b i)) + (fun i => gowersNorm_nonneg s (b i)) (Real.exp_nonneg (-((t + p + A) ^ A))) + ((mul_le_mul_of_nonneg_right hhalf (Nat.cast_nonneg _)).trans hS) hnorm + apply (Real.exp_le_exp.mpr (neg_le_neg hcost)).trans + have heq : Real.exp (-(t + (t + p + A) ^ A)) = + Real.exp (-t) * Real.exp (-((t + p + A) ^ A)) := by + rw [← Real.exp_add] + congr 1 + ring + rwa [heq] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/NativeMixedFourierProfiles.lean b/lean/OAI/Combinatorics/Progressions/Fourier/NativeMixedFourierProfiles.lean new file mode 100644 index 0000000000000000000000000000000000000000..8df373fc6e58d001bff34d229d21d1e3490d7e1e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/NativeMixedFourierProfiles.lean @@ -0,0 +1,364 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeMixedCubeResiduals + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def cyclicRealLinearPhase {N : ℕ} (β : ℝ) (n : ZMod N) : ℂ := + CircleFourier.character (((n.val : ℝ) * β : ℝ) : CircleFourier.Circle) + +@[simp] theorem norm_cyclicRealLinearPhase {N : ℕ} (β : ℝ) (n : ZMod N) : + ‖cyclicRealLinearPhase β n‖ = 1 := CircleFourier.norm_character _ + +theorem cyclicRealLinearPhase_unit_shift_error {N : ℕ} [NeZero N] (β : ℝ) : + (𝔼 n : ZMod N, ‖cyclicRealLinearPhase β (n + 1) - + CircleFourier.character (β : CircleFourier.Circle) * cyclicRealLinearPhase β n‖) ≤ 2 / N := by + classical + let b : ZMod N := ((N - 1 : ℕ) : ZMod N) + have hpoint (n : ZMod N) : + ‖cyclicRealLinearPhase β (n + 1) - + CircleFourier.character (β : CircleFourier.Circle) * cyclicRealLinearPhase β n‖ ≤ + if n = b then 2 else 0 := by + by_cases hn : n = b + · rw [ite_eq_left hn] + calc + _ ≤ ‖cyclicRealLinearPhase β (n + 1)‖ + + ‖CircleFourier.character (β : CircleFourier.Circle) * cyclicRealLinearPhase β n‖ := norm_sub_le _ _ + _ = 2 := by simp only [norm_mul, norm_cyclicRealLinearPhase, CircleFourier.norm_character]; norm_num + · rw [ite_eq_right hn] + have hnlt : n.val + 1 < N := by + have hv := n.val_lt + by_contra h + have he : n.val = N - 1 := by omega + apply hn + rw [← ZMod.natCast_zmod_val n, he] + have hval : (n + 1).val = n.val + 1 := by + have he : n + 1 = ((n.val + 1 : ℕ) : ZMod N) := by simp + rw [he, ZMod.val_natCast_of_lt hnlt] + have heq : cyclicRealLinearPhase β (n + 1) = + CircleFourier.character (β : CircleFourier.Circle) * cyclicRealLinearPhase β n := by + simp only [cyclicRealLinearPhase, hval, Nat.cast_add, Nat.cast_one, add_mul, + one_mul, AddCircle.coe_add, CircleFourier.character_add] + ring + rw [heq, sub_self, norm_zero] + calc + _ ≤ 𝔼 n : ZMod N, if n = b then (2 : ℝ) else 0 := + Finset.expect_le_expect (fun n _ => hpoint n) + _ = 2 / N := by rw [Fintype.expect_eq_sum_div_card]; simp + +theorem mean_twisted_nat_translate_error {N : ℕ} [NeZero N] + (q : ZMod N → ℂ) (ζ : ℂ) (hζ : ‖ζ‖ ≤ 1) {ε : ℝ} + (hstep : (𝔼 n : ZMod N, ‖q (n + 1) - ζ * q n‖) ≤ ε) (m : ℕ) : + (𝔼 n : ZMod N, ‖q (n + m) - ζ ^ m * q n‖) ≤ (m : ℝ) * ε := by + induction m with + | zero => simp + | succ m ih => + have hpoint (n : ZMod N) : + ‖q (n + (m + 1 : ℕ)) - ζ ^ (m + 1) * q n‖ ≤ + ‖q ((n + m) + 1) - ζ * q (n + m)‖ + ‖q (n + m) - ζ ^ m * q n‖ := by + calc + _ = ‖(q ((n + m) + 1) - ζ * q (n + m)) + + ζ * (q (n + m) - ζ ^ m * q n)‖ := by + simp only [Nat.cast_add, Nat.cast_one, add_assoc, pow_succ] + congr 1 + ring + _ ≤ ‖q ((n + m) + 1) - ζ * q (n + m)‖ + + ‖ζ * (q (n + m) - ζ ^ m * q n)‖ := norm_add_le _ _ + _ ≤ _ := by + rw [norm_mul] + exact add_le_add le_rfl (mul_le_of_le_one_left (norm_nonneg _) hζ) + have hshift : (𝔼 n : ZMod N, ‖q ((n + m) + 1) - ζ * q (n + m)‖) = + 𝔼 n : ZMod N, ‖q (n + 1) - ζ * q n‖ := by + exact Fintype.expect_equiv (Equiv.addRight (m : ZMod N)) _ _ (fun _ => rfl) + calc + _ ≤ (𝔼 n : ZMod N, ‖q ((n + m) + 1) - ζ * q (n + m)‖) + + (𝔼 n : ZMod N, ‖q (n + m) - ζ ^ m * q n‖) := by + rw [← Finset.expect_add_distrib] + exact Finset.expect_le_expect (fun n _ => hpoint n) + _ ≤ ε + (m : ℝ) * ε := by rw [hshift]; exact add_le_add hstep ih + _ = ((m + 1 : ℕ) : ℝ) * ε := by push_cast; ring + +theorem exists_fourier_of_twisted_unit_shift {N : ℕ} [NeZero N] + (q f : ZMod N → ℂ) (ζ : ℂ) (hq : ∀ n, ‖q n‖ ≤ 1) (hf : ∀ n, ‖f n‖ ≤ 1) + (hζ : ‖ζ‖ = 1) (hstep : (𝔼 n : ZMod N, ‖q (n + 1) - ζ * q n‖) ≤ 2 / N) + {ρ : ℝ} (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) + (hcorr : ρ ≤ ‖𝔼 n, f n * star (q n)‖) : + ∃ χ : AddChar (ZMod N) ℂ, ρ ^ 2 / 16 ≤ ‖finiteFourierCoeff f χ‖ := by + let C (h : ZMod N) := 𝔼 n : ZMod N, q n * star (f (n + h)) + let c := 𝔼 n : ZMod N, q n * star (f n) + have hc : ρ ≤ ‖c‖ := by + have heq : c = star (𝔼 n : ZMod N, f n * star (q n)) := by + rw [← expect_star] + apply Finset.expect_congr rfl + intro n _ + simp only [star_mul, star_star] + rw [heq, norm_star] + exact hcorr + have hrow (m : ℕ) : ρ - (m : ℝ) * (2 / N) ≤ ‖C (m : ZMod N)‖ := by + have hshift : c = 𝔼 n : ZMod N, q (n + m) * star (f (n + m)) := + (Fintype.expect_equiv (Equiv.addRight (m : ZMod N)) _ _ (fun _ => rfl)).symm + have hmul : ζ ^ m * C (m : ZMod N) = + 𝔼 n : ZMod N, (ζ ^ m * q n) * star (f (n + m)) := by + rw [Finset.mul_expect] + apply Finset.expect_congr rfl + intro n _ + ring + have herr : ‖c - ζ ^ m * C (m : ZMod N)‖ ≤ (m : ℝ) * (2 / N) := by + rw [hshift, hmul, ← Finset.expect_sub_distrib] + apply (RCLike.norm_expect_le (K := ℂ)).trans + apply le_trans _ (mean_twisted_nat_translate_error q ζ hζ.le hstep m) + apply Finset.expect_le_expect + intro n _ + rw [← sub_mul, norm_mul, norm_star] + exact mul_le_of_le_one_right (norm_nonneg _) (hf _) + have hnorm : ‖ζ ^ m * C (m : ZMod N)‖ = ‖C (m : ZMod N)‖ := by + rw [norm_mul, norm_pow, hζ, one_pow, one_mul] + have htriangle : ‖c‖ ≤ ‖c - ζ ^ m * C (m : ZMod N)‖ + ‖C (m : ZMod N)‖ := by + rw [← hnorm] + exact norm_le_norm_sub_add _ _ + linarith + let δ := ρ / 4 + have hδ : 0 < δ := by dsimp [δ]; positivity + have hδ1 : δ ≤ 1 := by dsimp [δ]; linarith + obtain ⟨K, hK, hKN, hsmall, hratio⟩ := exists_smoothing_scale (NeZero.pos N) hδ hδ1 + let H := cyclicInterval (0 : ZMod N) K + have hKpos : (0 : ℝ) < K := by exact_mod_cast hK + have hNpos : (0 : ℝ) < N := by exact_mod_cast NeZero.pos N + have hdense : (ρ / 8) * Fintype.card (ZMod N) ≤ (H.card : ℝ) := by + have hh := (div_le_div_iff₀ hKpos hδ).mp hratio + dsimp only [δ] at hh + rw [show H.card = K from cyclicInterval_card 0 hKN, ZMod.card] + nlinarith + have hlarge (h : ZMod N) (hh : h ∈ H) : ρ / 2 ≤ ‖C h‖ := by + obtain ⟨m, hm, he⟩ := Finset.mem_image.mp hh + have hmK : m ≤ K - 1 := by have := Finset.mem_range.mp hm; omega + have hmreal : (m : ℝ) ≤ δ * N := (Nat.cast_le.mpr hmK).trans hsmall + have he' : (m : ZMod N) = h := by simpa using he + have heps : (m : ℝ) * (2 / N) ≤ ρ / 2 := by + rw [← mul_div_assoc] + apply (div_le_iff₀ hNpos).mpr + dsimp only [δ] at hmreal + nlinarith + rw [← he'] + linarith [hrow m] + have hmass := dense_set_mean_lower_bound H (fun h => ‖C h‖) (fun _ => norm_nonneg _) + (show 0 ≤ ρ / 2 by positivity) hdense hlarge + obtain ⟨χ, hχ⟩ := exists_large_fourier_of_mean_cross_correlation q f hq + refine ⟨χ, ?_⟩ + have heq : (ρ / 8) * (ρ / 2) = ρ ^ 2 / 16 := by ring + rw [heq] at hmass + exact hmass.trans hχ + +theorem exists_fourier_of_real_linear_phase {N : ℕ} [NeZero N] + (f : ZMod N → ℂ) (hf : ∀ n, ‖f n‖ ≤ 1) (β : ℝ) + {ρ : ℝ} (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) + (hcorr : ρ ≤ ‖𝔼 n, f n * star (cyclicRealLinearPhase β n)‖) : + ∃ χ : AddChar (ZMod N) ℂ, ρ ^ 2 / 16 ≤ ‖finiteFourierCoeff f χ‖ := + exists_fourier_of_twisted_unit_shift (cyclicRealLinearPhase β) f + (CircleFourier.character (β : CircleFourier.Circle)) + (fun n => (norm_cyclicRealLinearPhase β n).le) hf (CircleFourier.norm_character _) + (cyclicRealLinearPhase_unit_shift_error β) hρ hρ1 hcorr + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators TensorProduct + +attribute [local instance] NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +theorem exists_fourier_of_stepOne_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + ∀ {g : (Unit → ℤ) → ℂ} (_E : NativeIntegerExpansion (fun _ : Unit => 1) 1 p g) + (f : ZMod N → ℂ), (∀ n, ‖f n‖ ≤ 1) → + Real.exp (-p) ≤ ‖𝔼 n : ZMod N, f n * star (g (fun _ => (n.val : ℤ)))‖ → + ∃ χ : AddChar (ZMod N) ℂ, Real.exp (-((p + C) ^ C)) ≤ ‖finiteFourierCoeff f χ‖ := by + obtain ⟨A, _, hphase⟩ := exists_stepOne_scalar_phase_budget + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (2 * (2 * X + Polynomial.C A) ^ A + 16) + refine ⟨C, hC, ?_⟩ + intro N _ p hp g E f hf hc + obtain ⟨i, hi⟩ := E.select_sample_correlation Finset.univ + (fun n : ZMod N => fun _ => (n.val : ℤ)) f hc + obtain ⟨β, hβ⟩ := hphase (E.model i) (by positivity : 0 ≤ 2 * p) (E.test i) + ((E.complexity i).mono (by linarith)) f hf (by + change Real.exp (-(2 * p)) ≤ + ‖𝔼 n : ZMod N, f n * star ((E.test i).eval (fun _ => (n.val : ℤ)))‖ + simpa only [two_mul] using hi) + let t := (2 * p + A) ^ A + have ht : 0 ≤ t := by dsimp [t]; positivity + obtain ⟨χ, hχ⟩ := exists_fourier_of_real_linear_phase f hf β + (Real.exp_pos (-t)) (Real.exp_le_one_iff.mpr (neg_nonpos.mpr ht)) hβ + have hsmall : Real.exp (-(2 * t + 16)) ≤ Real.exp (-t) ^ 2 / 16 := by + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 16)).mpr + calc + _ ≤ Real.exp (-(2 * t + 16)) * Real.exp 16 := + mul_le_mul_of_nonneg_left (by linarith [Real.add_one_le_exp (16 : ℝ)]) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add, ← Real.exp_nat_mul]; congr 1; norm_num + have hcost : 2 * t + 16 ≤ (p + C) ^ C := by + simpa [X, t, Polynomial.eval₂_pow] using hbudget p hp + exact ⟨χ, (Real.exp_le_exp.mpr (neg_le_neg hcost)).trans (hsmall.trans hχ)⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_cubic_fixed_fourier_correlation : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 4 f → + ∃ H : Finset (ZMod N), H.Nonempty ∧ Real.exp (-((p + C) ^ C)) * N ≤ (H.card : ℝ) ∧ + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 2) ((p + C) ^ C), + ∃ i : Fin M.outputDim, ∃ χ : ZMod N → AddChar (ZMod N) ℂ, ∀ h ∈ H, + Real.exp (-((p + C) ^ C)) ≤ ‖finiteFourierCoeff + (fun n => multiplicativeDerivative f h n * star (M.evalCyclic N i (correlationInput h n))) (χ h)‖ := by + obtain ⟨A, _, hphase⟩ := exists_cubic_fixed_phase_correlation + let X : Polynomial ℕ := Polynomial.X + let Q := (X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (3 * Q + 16) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hGowers + classical + let q := (p + A) ^ A + have hq : 0 ≤ q := by dsimp [q]; positivity + have htotal : 3 * q + 16 ≤ (p + C) ^ C := by + simpa [X, Q, q, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := by linarith + have hcorrC : 2 * q + 16 ≤ (p + C) ^ C := by linarith + obtain ⟨H, hH, hdense, M, i, θ, hcorr⟩ := + hphase hp ((Real.exp_le_exp.mpr hqC).trans hN) f hf hGowers + have hsmall : Real.exp (-(2 * q + 16)) ≤ Real.exp (-q) ^ 2 / 16 := by + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 16)).mpr + calc + _ ≤ Real.exp (-(2 * q + 16)) * Real.exp 16 := + mul_le_mul_of_nonneg_left (by linarith [Real.add_one_le_exp (16 : ℝ)]) (Real.exp_nonneg _) + _ = _ := by + rw [← Real.exp_add, ← Real.exp_nat_mul] + congr 1 + norm_num + have hcharacter (h : ZMod N) (hh : h ∈ H) : ∃ ψ : AddChar (ZMod N) ℂ, + Real.exp (-(2 * q + 16)) ≤ ‖finiteFourierCoeff + (fun n => multiplicativeDerivative f h n * star (M.evalCyclic N i (correlationInput h n))) ψ‖ := by + obtain ⟨ψ, hψ⟩ := exists_fourier_of_real_linear_phase + (fun n => multiplicativeDerivative f h n * star (M.evalCyclic N i (correlationInput h n))) + (fun n => by + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + (multiplicativeDerivative_norm_le_one f hf h n)).trans (M.norm_eval _ _)) + (θ h) (Real.exp_pos (-q)) + (Real.exp_le_one_iff.mpr (by linarith)) (hcorr h hh) + exact ⟨ψ, hsmall.trans hψ⟩ + let χ (h : ZMod N) : AddChar (ZMod N) ℂ := + if hh : h ∈ H then Classical.choose (hcharacter h hh) else 1 + refine ⟨H, hH, ?_, M.mono hqC, i, χ, ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hqC)) + (Nat.cast_nonneg _)).trans hdense + · intro h hh + dsimp only [χ] + rw [dite_eq_left hh] + exact (Real.exp_le_exp.mpr (neg_le_neg hcorrC)).trans (Classical.choose_spec (hcharacter h hh)) + +theorem exists_cubic_frequency_correlation : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 4 f → + ∃ H : Finset (ZMod N), H.Nonempty ∧ Real.exp (-((p + C) ^ C)) * N ≤ (H.card : ℝ) ∧ + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 2) ((p + C) ^ C), + ∃ i : Fin M.outputDim, ∃ ξ : ZMod N → ZMod N, ∀ h ∈ H, + Real.exp (-((p + C) ^ C)) ≤ ‖finiteFourierCoeff + (fun n => multiplicativeDerivative f h n * star (M.evalCyclic N i (correlationInput h n))) + (AddChar.zmodAddEquiv (ξ h))‖ := by + obtain ⟨C, hC, hfourier⟩ := exists_cubic_fixed_fourier_correlation + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hGowers + obtain ⟨H, hH, hdense, M, i, χ, hcorr⟩ := hfourier hp hN f hf hGowers + let ξ (h : ZMod N) := Classical.choose (AddChar.zmodAddEquiv.surjective (χ h)) + refine ⟨H, hH, hdense, M, i, ξ, ?_⟩ + intro h hh + have heq : AddChar.zmodAddEquiv (ξ h) = χ h := + Classical.choose_spec (AddChar.zmodAddEquiv.surjective (χ h)) + rw [heq] + exact hcorr h hh + +end Erdos3 + +end + +section + +namespace Erdos3.NativeMixedCorrelation + +open scoped BigOperators TensorProduct + +attribute [local instance] NativeVectorCorrelation.lie NativeVectorCorrelation.algebra + NativeVectorCorrelation.topology NativeVectorCorrelation.topologicalAdd + NativeVectorCorrelation.continuousSMul NativeVectorCorrelation.hausdorff + +theorem exists_cube_residual_fourier_profiles (d : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → + ∀ M : NativeMixedCorrelation (d + 2) N p f, + ∃ i : Fin M.mixed.outputDim, ∃ Q : Finset (Fin (d + 1) → ZMod N), Q.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * (N : ℝ) ^ (d + 1) ≤ (Q.card : ℝ) ∧ + ∃ χ : (Fin (d + 1) → ZMod N) → AddChar (ZMod N) ℂ, + ∀ u ∈ Q, u 0 ∈ M.shifts ∧ Real.exp (-((p + C) ^ C)) ≤ + ‖finiteFourierCoeff (nativeMixedCubeResidual f M.mixed i u) (χ u)‖ := by + obtain ⟨a, _, hresidual⟩ := exists_degree_one_cube_residuals d + obtain ⟨b, _, hfourier⟩ := exists_fourier_of_stepOne_expansion + let X : Polynomial ℕ := Polynomial.X + let P := (X + Polynomial.C a) ^ a + let R := (P + Polynomial.C b) ^ b + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (P + R) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf M + classical + let q := (p + a) ^ a + let r := (q + b) ^ b + have hq : 0 ≤ q := by dsimp [q]; positivity + have hr : 0 ≤ r := by dsimp [r]; positivity + have hsum : q + r ≤ (p + C) ^ C := by + simpa [X, P, R, q, r, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := by linarith + have hrC : r ≤ (p + C) ^ C := by linarith + obtain ⟨i, Q, hQ, hdense, hcorr⟩ := hresidual hp ((Real.exp_le_exp.mpr hqC).trans hN) f hf M + have hchar (u : Fin (d + 1) → ZMod N) (hu : u ∈ Q) : + ∃ χ : AddChar (ZMod N) ℂ, Real.exp (-r) ≤ + ‖finiteFourierCoeff (nativeMixedCubeResidual f M.mixed i u) χ‖ := by + obtain ⟨V⟩ := (hcorr u hu).2 + let E := NativeIntegerExpansion.ofTest V.test V.complexity (fun _ => rfl) + exact hfourier hq E (nativeMixedCubeResidual f M.mixed i u) + (nativeMixedCubeResidual_norm_le_one f hf M.mixed i u) V.correlation + let χ (u : Fin (d + 1) → ZMod N) : AddChar (ZMod N) ℂ := + if hu : u ∈ Q then Classical.choose (hchar u hu) else 1 + refine ⟨i, Q, hQ, ?_, χ, ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hqC)) + (pow_nonneg (Nat.cast_nonneg N) _)).trans hdense + · intro u hu + refine ⟨(hcorr u hu).1, ?_⟩ + dsimp only [χ] + rw [dite_eq_left hu] + exact (Real.exp_le_exp.mpr (neg_le_neg hrC)).trans (Classical.choose_spec (hchar u hu)) + +end Erdos3.NativeMixedCorrelation + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/NativeRoundedBohrModel.lean b/lean/OAI/Combinatorics/Progressions/Fourier/NativeRoundedBohrModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ff75e118996f320d1bca9b70afd0bebd6f83ac8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/NativeRoundedBohrModel.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeRoundedCyclicModel + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open scoped Pointwise +open CyclicCrootSisask + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + +theorem rounded_graph_bohr_model {I : Type*} [Fintype I] + (a : ZMod N → I → ℝ) (c : I → ℝ) (M l : ℕ) [NeZero M] {ε : ℝ} + (hsmall : (M : ℝ) * l * ε ≤ 1) + (hnear : ∀ t ∈ D.quadruples, ∃ q ∈ realDenominatorGrid l, + ‖c + (a (rankQuadrupleParameters t 1) + a (rankQuadrupleParameters t 2) - + a (rankQuadrupleParameters t 0) - a (rankQuadrupleParameters t 3)) - q‖ ≤ ε) : + let K := Real.exp (P + 13 * Fintype.card I) + let C := (2 ^ 14 : ℝ) * K ^ 6 * 16 ^ (Fintype.card I + 1) + let z := roundedModelLogBudget P (Fintype.card I) + let v := fun h => roundedCoefficient M l (a h) + ∃ J ⊆ H, J.Nonempty ∧ + (2 ^ 4 : ℝ)⁻¹ * K⁻¹ * H.card ≤ 16 ^ (Fintype.card I + 2) * (J.card : ℝ) ∧ + ∃ (Q : ℕ+) (B : Finset (ZMod (Q : ℕ))) + (f : (ZMod N × (I → ZMod M)) → ZMod (Q : ℕ)) + (L : ZMod (Q : ℕ) → (ZMod N × (I → ZMod M))) (S : CyclicBohr.Set (Q : ℕ)), + B.Nonempty ∧ B = (additiveGraph J v).image f ∧ B.card = J.card ∧ + IsAddFreimanIso 8 (additiveGraph J v : Set _) (B : Set _) f ∧ + (Q : ℝ) ≤ 2 * C ^ 16 * H.card ∧ + S.IsRankRegular ∧ 0 < S.radius ∧ S.radius ≤ 1 ∧ + (S.rank : ℝ) ≤ 1 + quarticBogolyubovConstant * (z + 1) ^ 4 ∧ + Real.exp (-(quarticBogolyubovConstant * (z + 1))) ≤ S.radius ∧ + Real.exp (-(quarticBogolyubovVolumeConstant * (z + 1) ^ 5)) * (Q : ℝ) ≤ + (S.carrier.card : ℝ) ∧ S.carrier ⊆ 2 • B - 2 • B ∧ + Set.MapsTo L (S.carrier : Set _) + (2 • additiveGraph J v - 2 • additiveGraph J v : Finset _) ∧ + Set.InjOn L (S.carrier : Set _) ∧ L 0 = 0 ∧ + ∀ x ∈ S.carrier, ∀ y ∈ S.carrier, ∀ w ∈ S.carrier, ∀ t ∈ S.carrier, + L x + L y = L w + L t ↔ x + y = w + t := by + intro K C z v + classical + obtain ⟨J, hJH, hJ, hsize, Q, B, f, L, hQ, hB, hBimage, hBcard, hf, + hQsize, hdensity, hmap, hinj, hzero, hadd⟩ := D.rounded_graph_cyclic_model a c M l hsmall hnear + let _ : NeZero Q := ⟨hQ.ne'⟩ + have hdensity' : Real.exp (-z) * Q ≤ (B.card : ℝ) := by + apply (le_div_iff₀ (by exact_mod_cast hQ : (0 : ℝ) < Q)).mp + exact (exp_neg_roundedModelLogBudget_le_density P (Fintype.card I)).trans hdensity + obtain ⟨S, hSreg, hSpos, hSupper, hSrank, hSwidth, hSvolume, hSsub⟩ := + exists_quartic_bogolyubov_with_volume B (roundedModelLogBudget_nonneg P _) hdensity' + refine ⟨J, hJH, hJ, hsize, ⟨Q, hQ⟩, B, f, L, S, hB, hBimage, hBcard, hf, + hQsize, hSreg, hSpos, hSupper, hSrank, hSwidth, hSvolume, hSsub, + (fun x hx => hmap (hSsub hx)), hinj.mono hSsub, hzero, ?_⟩ + intro x hx y hy w hw t ht + exact hadd x (hSsub hx) y (hSsub hy) w (hSsub hw) t (hSsub ht) + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/NaturalFrequencyMultiples.lean b/lean/OAI/Combinatorics/Progressions/Fourier/NaturalFrequencyMultiples.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d7622208379566d970a1dddc8acb9b83c64fbf8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/NaturalFrequencyMultiples.lean @@ -0,0 +1,38 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeCentralSeed + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct + +theorem rationalLogHeight_nat_mul (n : ℕ) {x : ℚ} {p : ℝ} + (hx : rationalLogHeight x ≤ p) : rationalLogHeight ((n : ℚ) * x) ≤ p + n + 1 := by + have hp : 0 ≤ p := (rationalLogHeight_nonneg x).trans hx + have hn : RationalHeightLE (n : ℚ) (n + 1) := by + simp [RationalHeightLE] + apply rationalLogHeight_le_of_height (hn.mul (rationalHeightLE_ceil_exp hx)) + calc + (((n + 1) * ⌈Real.exp p⌉₊ : ℕ) : ℝ) = ((n : ℝ) + 1) * (⌈Real.exp p⌉₊ : ℝ) := by push_cast; rfl + _ ≤ Real.exp (n : ℝ) * Real.exp (p + 1) := + mul_le_mul (Real.add_one_le_exp _) (ceil_exp_le_exp_add_one hp) + (Nat.cast_nonneg _) (Real.exp_pos _).le + _ = Real.exp (p + n + 1) := by rw [← Real.exp_add]; congr 1; ring + +theorem realifyFunctional_nsmul {L : Type*} [AddCommGroup L] [Module ℚ L] + (n : ℕ) (η : L →ₗ[ℚ] ℚ) (x : ℝ ⊗[ℚ] L) : + realifyFunctional (n • η) x = n • realifyFunctional η x := by + induction x using TensorProduct.inductionOn with + | tmul r x => + simp only [realifyFunctional_tmul, LinearMap.smul_apply, nsmul_eq_mul, + Rat.cast_mul, Rat.cast_natCast] + ring + | add x y hx hy => simp only [map_add, hx, hy, smul_add] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/NiltestConjugateFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/NiltestConjugateFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2373ad98fb425bf520ea9fc6cca38d63e51425f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/NiltestConjugateFrequency.lean @@ -0,0 +1,42 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeCentralSeed +import OAI.Combinatorics.Progressions.Nilpotent.NativeNilsequenceExpansion + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct + +theorem realifyFunctional_neg {V : Type*} [AddCommGroup V] [Module ℚ V] + (eta : V →ₗ[ℚ] ℚ) (x : ℝ ⊗[ℚ] V) : + realifyFunctional (-eta) x = -realifyFunctional eta x := by + induction x using TensorProduct.inductionOn with + | tmul r x => simp only [realifyFunctional_tmul, LinearMap.neg_apply, Rat.cast_neg, mul_neg] + | add x y hx hy => simp only [map_add, hx, hy, neg_add] + +namespace RationalFilteredNilmanifold.Niltest + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} {w : σ → ℕ} + +theorem conjugate_vertical (T : D.Niltest w) (eta : L →ₗ[ℚ] ℚ) + (hvert : ∀ z, z ∈ D.filtration.realification.subgroup s → ∀ x, + T.observable (z • x) = CircleFourier.character + ((realifyFunctional eta z.coord : ℝ) : CircleFourier.Circle) * T.observable x) + (z : D.RealGroup) (hz : z ∈ D.filtration.realification.subgroup s) (x : D.Space) : + T.conjugate.observable (z • x) = CircleFourier.character + ((realifyFunctional (-eta) z.coord : ℝ) : CircleFourier.Circle) * T.conjugate.observable x := by + change star (T.observable (z • x)) = _ * star (T.observable x) + rw [hvert z hz x, star_mul, realifyFunctional_neg, AddCircle.coe_neg, CircleFourier.character_neg] + exact mul_comm _ _ + +end RationalFilteredNilmanifold.Niltest +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistHighFrequencyRemoval.lean b/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistHighFrequencyRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c8e00f0f76eca9551100b67e95d91ae8be957d6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistHighFrequencyRemoval.lean @@ -0,0 +1,103 @@ +import OAI.Combinatorics.Progressions.Fourier.NormalizedTwistLocalizedFourierSelection +import OAI.Combinatorics.Progressions.Polynomial.OrdinaryPolynomialPhaseAffineInverse + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MvPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +theorem exists_normalizedTwist_high_frequency_removal (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L : Type} [Fintype X] [DecidableEq X] + [LieRing L] [LieAlgebra ℚ L] {t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (J : Fin m → Type) [∀ j, Fintype (J j)] (d : ℕ) + (D : RationalFilteredNilmanifold L t e) (_htd : t ≤ d) + (R : D.Niltest (fun _ : X => 1)) + (cover : ℕ) (_hcover : 0 < cover) (a : (Σ j, J j) → ℤ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (W : ∀ j, Submodule ℝ (J j → ℝ)) + (_hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ W j) + (p Rrank : ℝ), 0 ≤ p → R.ComplexityLE p → (R.normBound : ℝ) ≤ 1 → + (cover : ℝ) ≤ Real.exp p → (∀ i, |(a i : ℝ)| ≤ Real.exp p) → + ∀ (origin : X → ℤ) (lengths : X → ℕ), (∀ i, 0 < lengths i) → + (Fintype.card X : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, d < j.val + 1 → HasLayerSamplingRank (j.val + 1) + (fun i => (lengths i : ℝ)) Rrank (W j) (poly j)) → + Real.exp (-p) ≤ ‖𝔼 x ∈ translatedIntegerBox origin lengths, + (Real.fourierChar (MvPolynomial.eval (fun i => (x i : ℝ)) + (normalizedTwistFrequencyPolynomial cover a poly)) : ℂ) * R.eval x‖ → + ∀ j, d < j.val + 1 → W j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩)) := by + classical + choose c hc hinverse using fun j : Fin m => + OrdinaryPolynomialPhase.exists_ordinary_polynomial_phase_inverse (j.val + 1) + (Nat.succ_pos _) + let B := (∑ j, c j) + 2 + have hcB (j : Fin m) : c j ≤ B := + (Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ j)).trans + (Nat.le_add_right _ _) + have hB : 2 ≤ B := by dsimp [B]; omega + let Q : Polynomial ℕ := Polynomial.X + (Polynomial.X + Polynomial.C B) ^ B + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget Q + refine ⟨C, hC, ?_⟩ + intro X L _ _ _ _ t e _ _ _ _ J _ d D htd R cover hcover a poly hpoly W hcoeff p Rrank hp + hR hRcap hcoverp ha origin lengths hlengths hX hlarge hRrank hrank hcorr + have hT : ∀ i, 0 < (lengths i : ℝ) := fun i => by exact_mod_cast hlengths i + have hbudget' : p + (p + B) ^ B + 2 ≤ (p + C) ^ C := by + simpa [Q, Polynomial.eval₂_pow] using hbudget p hp + have hbase : 1 ≤ p + B := by + have hb : (2 : ℝ) ≤ B := by exact_mod_cast hB + linarith + have hlocal (j : Fin m) : (p + c j) ^ c j ≤ (p + B) ^ B := by + have hb : p + (c j : ℝ) ≤ p + B := by + have hh : (c j : ℝ) ≤ B := Nat.cast_le.mpr (hcB j) + linarith + apply (pow_le_pow_left₀ (by positivity) hb _).trans + exact pow_le_pow_right₀ hbase (hcB j) + rcases highest_nonannihilating_tag d W a with hann | ⟨h, hd, hw, hhigher⟩ + · exact hann + · exfalso + have hhigh (j : Fin m) (hj : h < j) : + integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j) = + MvPolynomial.C ((integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j)).coeff 0) := + integerRowPolynomial_constant_of_annihilates (W j) _ _ (hcoeff j) (hhigher j hj) + have hdegree (j : Fin m) := integerRowPolynomial_totalDegree_le + (fun i => a ⟨j, i⟩) (hpoly j) + have hphase : (normalizedTwistFrequencyPolynomial cover a poly).totalDegree ≤ h.val + 1 := by + apply (totalDegree_mul _ _).trans + simp only [totalDegree_C, zero_add] + exact taggedScalar_sum_degree h _ hdegree hhigh + have htop : homogeneousComponent (h.val + 1) (normalizedTwistFrequencyPolynomial cover a poly) = + MvPolynomial.C (1 / (cover : ℝ)) * homogeneousComponent (h.val + 1) + (integerRowPolynomial (fun i => a ⟨h, i⟩) (poly h)) := by + rw [normalizedTwistFrequencyPolynomial, homogeneousComponent_C_mul, + taggedScalar_sum_top h _ hdegree hhigh] + have hcost : p + (p + c h) ^ c h ≤ (p + C) ^ C := by linarith [hlocal h] + have hap := hinverse h D (by omega) (normalizedTwistFrequencyPolynomial cover a poly) + hphase R p hp hR hRcap origin lengths hlengths hX + (fun i => (Real.exp_le_exp.mpr (by linarith : (p + c h) ^ c h ≤ (p + C) ^ C)).trans + (hlarge i)) hcorr + apply normalizedTwistFrequencyPolynomial_top_not_approximation cover hcover h a poly + (W h) (fun i => (lengths i : ℝ)) Rrank (Real.exp ((p + c h) ^ c h)) hT + ?_ (hrank h hd) ?_ hw htop hap + · calc + _ ≤ Real.exp p * Real.exp ((p + c h) ^ c h) := + mul_le_mul_of_nonneg_right hcoverp (Real.exp_nonneg _) + _ = Real.exp (p + (p + c h) ^ c h) := (Real.exp_add _ _).symm + _ ≤ Rrank := (Real.exp_le_exp.mpr hcost).trans hRrank + · intro i + exact (ha ⟨h, i⟩).trans ((Real.exp_le_exp.mpr + (by linarith [pow_nonneg (show 0 ≤ p + B by positivity) B] : p ≤ (p + C) ^ C)).trans hRrank) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistLocalizedFourierSelection.lean b/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistLocalizedFourierSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..d26594980f39eaad40cbc50e1083f7d661505c00 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistLocalizedFourierSelection.lean @@ -0,0 +1,696 @@ +import OAI.Combinatorics.Progressions.Lattices.ActualResidueSpatialFreezing + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem torus_integer_character_real_phase {J : Type*} [Fintype J] + (a : J → ℤ) (x : J → ℝ) : + (∏ j, CircleFourier.character (a j • (x j : UnitAddCircle))) = + (Real.fourierChar (∑ j, (a j : ℝ) * x j) : ℂ) := by + rw [← CircleFourier.character_fintype_sum] + have he : (∑ j, a j • (x j : UnitAddCircle)) = + ((∑ j, (a j : ℝ) * x j : ℝ) : UnitAddCircle) := by + simp only [← AddCircle.coe_zsmul, zsmul_eq_mul] + exact (map_sum (QuotientAddGroup.mk' (AddSubgroup.zmultiples (1 : ℝ))) + (fun j => (a j : ℝ) * x j) Finset.univ).symm + rw [he, CircleFourier.character_coe_exp, Real.fourierChar_apply] + congr 1 + push_cast + ring + +namespace VectorPolynomial + +open MvPolynomial + +variable {X : Type*} {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + +noncomputable def normalizedTwistFrequencyPolynomial (cover : ℕ) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) : + MvPolynomial X ℝ := + C (1 / (cover : ℝ)) * ∑ j, integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j) + +theorem normalizedTwistFrequencyPolynomial_eval (cover : ℕ) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (u : X → ℝ) : + MvPolynomial.eval u (normalizedTwistFrequencyPolynomial cover a poly) = + ∑ i : Σ j, J j, (a i : ℝ) * (eval u (poly i.1) i.2 / cover) := by + simp only [normalizedTwistFrequencyPolynomial, map_mul, eval_C, map_sum, + integerRowPolynomial_eval, Fintype.sum_sigma, Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro i _ + ring + +theorem normalizedTwistFrequencyPolynomial_degree (cover : ℕ) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) : + (normalizedTwistFrequencyPolynomial cover a poly).totalDegree ≤ m := by + apply (totalDegree_mul _ _).trans + simp only [totalDegree_C, zero_add] + apply totalDegree_finsetSum_le + intro j _ + exact (integerRowPolynomial_totalDegree_le _ (hpoly j)).trans (by omega) + +theorem physicalGrid_character_eq_polynomial_phase (cover : ℕ) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (u : X → ℝ) : + (∏ i, CircleFourier.character (a i • physicalGridFactorInput cover poly u i)) = + (Real.fourierChar (MvPolynomial.eval u + (normalizedTwistFrequencyPolynomial cover a poly)) : ℂ) := by + rw [normalizedTwistFrequencyPolynomial_eval] + exact torus_integer_character_real_phase a _ + +namespace NormalizedPolynomialTwist + +variable [Fintype X] {periodCap coverCap : ℝ} {L : ℝ≥0} + +theorem exists_frozen_ambient_fourier + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (residue : X → ZMod W.modulus) (center : X → ℝ) + {δ p : ℝ} (hδ : 0 < δ) (hp : 0 ≤ p) + (hdim : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hL : (L : ℝ) ≤ Real.exp p) (hδp : δ⁻¹ ≤ Real.exp p) : + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → (Σ j, J j) → ℤ) (coeff : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp (2 * p * (2 * p + 2) ^ 4) ∧ + (∀ a j, |(frequency a j : ℝ)| ≤ Real.exp ((2 * p + 2) ^ 4)) ∧ + (∑ a, ‖coeff a‖) ≤ Real.exp (2 * p * (2 * p + 2) ^ 4) ∧ + ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (u : X → ℝ), + ‖W.frozenTorus residue center (physicalGridFactorInput W.cover poly u) - + ∑ a, coeff a * (Real.fourierChar (MvPolynomial.eval u + (normalizedTwistFrequencyPolynomial W.cover (frequency a) poly)) : ℂ)‖ ≤ δ := by + obtain ⟨F, inst, freq, coeff, hcard, hfreq, hmass, herr⟩ := + exists_ambient_torus_fourier_approximation (W.frozenTorus residue center) L 1 + (W.frozenTorus_lipschitz residue center) (W.norm_frozenTorus_le residue center) + hδ hp hdim hL hδp + let := inst + refine ⟨F, inst, freq, coeff, hcard, hfreq, ?_, ?_⟩ + · simpa only [NNReal.coe_one, mul_one] using hmass + · intro poly u + simpa only [physicalGrid_character_eq_polynomial_phase] using + herr (physicalGridFactorInput W.cover poly u) + +end NormalizedPolynomialTwist +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +open scoped BigOperators NNReal + +variable {X Ω : Type*} [Fintype X] [Fintype Ω] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + {periodCap coverCap : ℝ} {L : ℝ≥0} + +theorem norm_correlation_star_eq_product (μ : FiniteProbabilityWeights Ω) + (signal test : Ω → ℂ) : + ‖μ.correlation (fun x => star (signal x)) test‖ = + ‖μ.complexMean (fun x => signal x * test x)‖ := by + have he : μ.correlation (fun x => star (signal x)) test = + star (μ.complexMean (fun x => signal x * test x)) := by + unfold FiniteProbabilityWeights.correlation FiniteProbabilityWeights.complexMean + rw [star_sum] + apply Finset.sum_congr rfl + intro x _ + simp only [star_mul, Complex.star_def, Complex.conj_ofReal] + ring + rw [he, norm_star] + +theorem exists_correlating_frequency + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (μ : FiniteProbabilityWeights Ω) (u : Ω → X → ℤ) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (signal : Ω → ℂ) (residue : X → ZMod W.modulus) (center : X → ℝ) + (radius ε δ p : ℝ) (hε : 0 < ε) (hδ : 0 < δ) (hp : 0 ≤ p) + (hdim : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hL : (L : ℝ) ≤ Real.exp p) (hεp : ε⁻¹ ≤ Real.exp p) + (hcell : ∀ x, 0 < μ.weight x → + (fun i => (u x i : ZMod W.modulus)) = residue ∧ + dist (fun i => (u x i : ℝ) / N i) center ≤ radius) + (hsignal : ∀ x, 0 < μ.weight x → ‖signal x‖ ≤ 1) + (herror : (L : ℝ) * radius + ε ≤ δ / 2) + (hcorr : δ ≤ ‖μ.correlation signal (fun x => W.eval N poly (u x))‖) : + ∃ a : (Σ j, J j) → ℤ, + (∀ j, |(a j : ℝ)| ≤ Real.exp ((2 * p + 2) ^ 4)) ∧ + δ / (2 * Real.exp (2 * p * (2 * p + 2) ^ 4)) ≤ + ‖μ.correlation signal (fun x => + (Real.fourierChar (MvPolynomial.eval (fun i => (u x i : ℝ)) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ))‖ := by + classical + obtain ⟨F, inst, freq, coeff, _hcard, hfreq, hmass, herr⟩ := + W.exists_frozen_ambient_fourier residue center hε hp hdim hL hεp + let := inst + let atom : F → Ω → ℂ := fun a x => + Real.fourierChar (MvPolynomial.eval (fun i => (u x i : ℝ)) + (normalizedTwistFrequencyPolynomial W.cover (freq a) poly)) + let approx : Ω → ℂ := fun x => ∑ a, coeff a * atom a x + have happrox (x : Ω) (hx : μ.weight x ≠ 0) : + ‖W.eval N poly (u x) - approx x‖ ≤ (L : ℝ) * radius + ε := by + have hxpos := lt_of_le_of_ne (μ.nonneg x) (Ne.symm hx) + obtain ⟨hres, hdist⟩ := hcell x hxpos + have hfreeze : W.frozenSpatialEval center poly (u x) = + W.frozenTorus residue center + (physicalGridFactorInput W.cover poly (fun i => (u x i : ℝ))) := by + simp only [frozenSpatialEval, hres] + have he := herr poly (fun i => (u x i : ℝ)) + calc + _ ≤ ‖W.eval N poly (u x) - W.frozenSpatialEval center poly (u x)‖ + + ‖W.frozenSpatialEval center poly (u x) - approx x‖ := + norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ (L : ℝ) * radius + ε := add_le_add + ((W.eval_sub_frozenSpatialEval N center poly (u x)).trans + (mul_le_mul_of_nonneg_left hdist L.coe_nonneg)) + (by rw [hfreeze]; exact he) + have hmean : ‖μ.correlation signal (fun x => W.eval N poly (u x)) - + μ.correlation signal approx‖ ≤ (L : ℝ) * radius + ε := by + rw [μ.correlation_eq_complexMean, μ.correlation_eq_complexMean] + apply (μ.norm_complexMean_sub_le _ _ (fun _ => (L : ℝ) * radius + ε) ?_).trans_eq + (μ.mean_const _) + intro x hx + rw [← mul_sub, ← star_sub, norm_mul, norm_star] + calc + _ ≤ 1 * ‖W.eval N poly (u x) - approx x‖ := + mul_le_mul_of_nonneg_right + (hsignal x (lt_of_le_of_ne (μ.nonneg x) (Ne.symm hx))) (norm_nonneg _) + _ ≤ _ := by rw [one_mul]; exact happrox x hx + have hexpand : μ.correlation signal approx = + ∑ a, star (coeff a) * μ.correlation signal (atom a) := by + simp only [FiniteProbabilityWeights.correlation_eq_complexMean, approx, star_sum, star_mul] + simpa only [mul_comm] using μ.complexMean_weighted_expansion signal + (fun a => star (coeff a)) (fun a x => star (atom a x)) + have hlarge : δ / 2 ≤ ‖∑ a, star (coeff a) * μ.correlation signal (atom a)‖ := by + have htriangle := norm_le_norm_add_norm_sub (μ.correlation signal approx) + (μ.correlation signal (fun x => W.eval N poly (u x))) + rw [norm_sub_rev] at htriangle + rw [← hexpand] + linarith + obtain ⟨a, ha⟩ := exists_large_weighted_term (fun a => star (coeff a)) + (fun a => μ.correlation signal (atom a)) (by positivity : 0 < δ / 2) + (Real.exp_pos _) (by simpa only [norm_star] using hmass) hlarge + refine ⟨freq a, hfreq a, ?_⟩ + simpa only [div_div, atom] using ha + +theorem exists_correlating_frequency_product + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (μ : FiniteProbabilityWeights Ω) (u : Ω → X → ℤ) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (signal : Ω → ℂ) (residue : X → ZMod W.modulus) (center : X → ℝ) + (radius ε δ p : ℝ) (hε : 0 < ε) (hδ : 0 < δ) (hp : 0 ≤ p) + (hdim : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hL : (L : ℝ) ≤ Real.exp p) (hεp : ε⁻¹ ≤ Real.exp p) + (hcell : ∀ x, 0 < μ.weight x → + (fun i => (u x i : ZMod W.modulus)) = residue ∧ + dist (fun i => (u x i : ℝ) / N i) center ≤ radius) + (hsignal : ∀ x, 0 < μ.weight x → ‖signal x‖ ≤ 1) + (herror : (L : ℝ) * radius + ε ≤ δ / 2) + (hcorr : δ ≤ ‖μ.complexMean (fun x => W.eval N poly (u x) * signal x)‖) : + ∃ a : (Σ j, J j) → ℤ, + (∀ j, |(a j : ℝ)| ≤ Real.exp ((2 * p + 2) ^ 4)) ∧ + δ / (2 * Real.exp (2 * p * (2 * p + 2) ^ 4)) ≤ + ‖μ.complexMean (fun x => + (Real.fourierChar (MvPolynomial.eval (fun i => (u x i : ℝ)) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * signal x)‖ := by + obtain ⟨a, ha, hc⟩ := W.exists_correlating_frequency μ u N poly + (fun x => star (signal x)) residue center radius ε δ p hε hδ hp hdim hL hεp hcell + (fun x hx => by simpa only [norm_star] using hsignal x hx) herror (by + rw [norm_correlation_star_eq_product] + simpa only [mul_comm] using hcorr) + refine ⟨a, ha, ?_⟩ + rw [norm_correlation_star_eq_product] at hc + simpa only [mul_comm] using hc + +end Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +end + +section + +namespace Erdos3.VectorPolynomial + +open MvPolynomial +open scoped BigOperators + +variable {X : Type*} {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + +theorem integerRowPolynomial_constant_of_annihilates {I K : Type*} [Fintype K] + (W : Submodule ℝ (K → ℝ)) (a : K → ℤ) (p : VectorPolynomial I ℝ (K → ℝ)) + (hp : ∀ α, α ≠ 0 → coefficients p α ∈ W) + (ha : W ≤ LinearMap.ker (integerRowLinear a)) : + integerRowPolynomial a p = C ((integerRowPolynomial a p).coeff 0) := by + classical + ext α + by_cases hα : α = 0 + · subst α + simp + · have hz : integerRowLinear a (coefficients p α) = 0 := ha (hp α hα) + rw [integerRowPolynomial_coeff, ← integerRowLinear_apply, hz, coeff_C] + simp only [Ne.symm hα, ite_false] + +noncomputable def taggedScalarLowPolynomial (d : ℕ) (F : Fin m → MvPolynomial X ℝ) : + MvPolynomial X ℝ := ∑ j, if j.val + 1 ≤ d then F j else 0 + +noncomputable def taggedScalarHighConstant (d : ℕ) (F : Fin m → MvPolynomial X ℝ) : ℝ := + ∑ j, if d < j.val + 1 then (F j).coeff 0 else 0 + +theorem taggedScalar_sum_eq_low_add_constant (d : ℕ) (F : Fin m → MvPolynomial X ℝ) + (hhigh : ∀ j, d < j.val + 1 → F j = C ((F j).coeff 0)) : + (∑ j, F j) = taggedScalarLowPolynomial d F + C (taggedScalarHighConstant d F) := by + classical + unfold taggedScalarLowPolynomial taggedScalarHighConstant + rw [map_sum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro j _ + by_cases hj : j.val + 1 ≤ d + · simp only [hj, Nat.not_lt.mpr hj, ite_true, ite_false, map_zero, add_zero] + · have hj' : d < j.val + 1 := Nat.lt_of_not_ge hj + simp only [hj, hj', ite_false, ite_true, zero_add] + exact hhigh j hj' + +theorem taggedScalarLowPolynomial_degree (d : ℕ) (F : Fin m → MvPolynomial X ℝ) + (hdegree : ∀ j, (F j).totalDegree ≤ j.val + 1) : + (taggedScalarLowPolynomial d F).totalDegree ≤ d := by + classical + apply totalDegree_finsetSum_le + intro j _ + split_ifs with hj + · exact (hdegree j).trans hj + · simp only [totalDegree_zero, Nat.zero_le] + +theorem taggedScalar_sum_degree (h : Fin m) (F : Fin m → MvPolynomial X ℝ) + (hdegree : ∀ j, (F j).totalDegree ≤ j.val + 1) + (hhigh : ∀ j, h < j → F j = C ((F j).coeff 0)) : + (∑ j, F j).totalDegree ≤ h.val + 1 := by + apply totalDegree_finsetSum_le + intro j _ + by_cases hj : j ≤ h + · exact (hdegree j).trans (Nat.add_le_add_right hj 1) + · rw [hhigh j (lt_of_not_ge hj), totalDegree_C] + omega + +theorem taggedScalar_sum_top (h : Fin m) (F : Fin m → MvPolynomial X ℝ) + (hdegree : ∀ j, (F j).totalDegree ≤ j.val + 1) + (hhigh : ∀ j, h < j → F j = C ((F j).coeff 0)) : + homogeneousComponent (h.val + 1) (∑ j, F j) = + homogeneousComponent (h.val + 1) (F h) := by + classical + rw [map_sum] + apply Finset.sum_eq_single h + · intro j _ hj + apply homogeneousComponent_eq_zero + by_cases hjh : j < h + · exact (hdegree j).trans_lt (Nat.add_lt_add_right hjh 1) + · have hlt : h < j := lt_of_le_of_ne (le_of_not_gt hjh) (Ne.symm hj) + rw [hhigh j hlt, totalDegree_C] + omega + · simp + +theorem highest_nonannihilating_tag (d : ℕ) + (W : ∀ j, Submodule ℝ (J j → ℝ)) (a : (Σ j, J j) → ℤ) : + (∀ j : Fin m, d < j.val + 1 → + W j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩))) ∨ + ∃ h : Fin m, d < h.val + 1 ∧ + (∃ w ∈ W h, integerRowLinear (fun i => a ⟨h, i⟩) w ≠ 0) ∧ + ∀ j : Fin m, h < j → W j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩)) := by + classical + let S : Finset (Fin m) := Finset.univ.filter (fun j => d < j.val + 1 ∧ + ¬ W j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩))) + by_cases hs : S.Nonempty + · let h := S.max' hs + have hh : h ∈ S := Finset.max'_mem S hs + have hh' := (Finset.mem_filter.mp hh).2 + refine Or.inr ⟨h, hh'.1, ?_, ?_⟩ + · by_contra! hn + apply hh'.2 + intro w hw + exact hn w hw + · intro j hj + by_contra hn + have hjS : j ∈ S := Finset.mem_filter.mpr ⟨Finset.mem_univ _, + ⟨hh'.1.trans (Nat.add_lt_add_right hj 1), hn⟩⟩ + exact (not_le_of_gt hj) (Finset.le_max' S j hjS) + · refine Or.inl ?_ + intro j hj + by_contra hn + exact hs ⟨j, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj, hn⟩⟩ + +def truncateTaggedFrequency (d : ℕ) (a : (Σ j, J j) → ℤ) : (Σ j, J j) → ℤ := + fun i => if i.1.val + 1 ≤ d then a i else 0 + +theorem integerRowPolynomial_truncateTaggedFrequency (d : ℕ) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (j : Fin m) : + integerRowPolynomial (fun i => truncateTaggedFrequency d a ⟨j, i⟩) (poly j) = + if j.val + 1 ≤ d then integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j) else 0 := by + classical + by_cases hj : j.val + 1 ≤ d + · simp only [truncateTaggedFrequency, hj, ite_true] + · simp only [truncateTaggedFrequency, hj, ite_false] + ext α + simp only [integerRowPolynomial_coeff, Int.cast_zero, zero_mul, + Finset.sum_const_zero, AddMonoidAlgebra.coeff_zero, Finsupp.zero_apply] + +theorem normalizedTwistFrequencyPolynomial_truncate (cover d : ℕ) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) : + normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly = + C (1 / (cover : ℝ)) * taggedScalarLowPolynomial d + (fun j => integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j)) := by + simp only [normalizedTwistFrequencyPolynomial, integerRowPolynomial_truncateTaggedFrequency, + taggedScalarLowPolynomial] + +noncomputable def normalizedTwistHighFrequencyConstant (cover d : ℕ) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) : ℝ := + (1 / (cover : ℝ)) * taggedScalarHighConstant d + (fun j => integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j)) + +theorem normalizedTwistFrequencyPolynomial_low_degree (cover d : ℕ) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) : + (normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly).totalDegree ≤ d := by + rw [normalizedTwistFrequencyPolynomial_truncate] + apply (totalDegree_mul _ _).trans + simp only [totalDegree_C, zero_add] + exact taggedScalarLowPolynomial_degree d _ + (fun j => integerRowPolynomial_totalDegree_le _ (hpoly j)) + +theorem normalizedTwistFrequencyPolynomial_low_add_constant (cover d : ℕ) + (W : ∀ j, Submodule ℝ (J j → ℝ)) (a : (Σ j, J j) → ℤ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ W j) + (hann : ∀ j, d < j.val + 1 → + W j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩))) : + normalizedTwistFrequencyPolynomial cover a poly = + normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly + + C (normalizedTwistHighFrequencyConstant cover d a poly) := by + rw [normalizedTwistFrequencyPolynomial_truncate] + unfold normalizedTwistFrequencyPolynomial normalizedTwistHighFrequencyConstant + rw [taggedScalar_sum_eq_low_add_constant d _ (fun j hj => + integerRowPolynomial_constant_of_annihilates (W j) _ _ (hcoeff j) (hann j hj)), + mul_add, ← map_mul] + +theorem normalizedTwistFrequencyPolynomial_highest_layer (cover d : ℕ) + (W : ∀ j, Submodule ℝ (J j → ℝ)) (a : (Σ j, J j) → ℤ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ W j) : + (normalizedTwistFrequencyPolynomial cover a poly = + normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly + + C (normalizedTwistHighFrequencyConstant cover d a poly) ∧ + (normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly).totalDegree ≤ d) ∨ + ∃ h : Fin m, d < h.val + 1 ∧ + (∃ w ∈ W h, integerRowLinear (fun i => a ⟨h, i⟩) w ≠ 0) ∧ + (∀ j : Fin m, h < j → + integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j) = + C ((integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j)).coeff 0)) ∧ + (normalizedTwistFrequencyPolynomial cover a poly).totalDegree ≤ h.val + 1 ∧ + homogeneousComponent (h.val + 1) (normalizedTwistFrequencyPolynomial cover a poly) = + C (1 / (cover : ℝ)) * homogeneousComponent (h.val + 1) + (integerRowPolynomial (fun i => a ⟨h, i⟩) (poly h)) := by + rcases highest_nonannihilating_tag d W a with hann | ⟨h, hd, hw, hhigher⟩ + · exact Or.inl ⟨normalizedTwistFrequencyPolynomial_low_add_constant cover d W a poly hcoeff hann, + normalizedTwistFrequencyPolynomial_low_degree cover d a poly hpoly⟩ + · have hhigh (j : Fin m) (hj : h < j) : + integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j) = + C ((integerRowPolynomial (fun i => a ⟨j, i⟩) (poly j)).coeff 0) := + integerRowPolynomial_constant_of_annihilates (W j) _ _ (hcoeff j) (hhigher j hj) + have hdegree (j : Fin m) := integerRowPolynomial_totalDegree_le + (fun i => a ⟨j, i⟩) (hpoly j) + refine Or.inr ⟨h, hd, hw, hhigh, ?_, ?_⟩ + · apply (totalDegree_mul _ _).trans + simp only [totalDegree_C, zero_add] + exact taggedScalar_sum_degree h _ hdegree hhigh + · rw [normalizedTwistFrequencyPolynomial, homogeneousComponent_C_mul, + taggedScalar_sum_top h _ hdegree hhigh] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +open scoped NNReal + +theorem exists_correlating_frequency_early : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X Ω : Type*} [Fintype X] [Fintype Ω] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + {periodCap coverCap : ℝ} {L : ℝ≥0} + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (μ : FiniteProbabilityWeights Ω) (u : Ω → X → ℤ) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (signal : Ω → ℂ) (residue : X → ZMod W.modulus) (center : X → ℝ) + (p : ℝ), 0 ≤ p → (Fintype.card (Σ j, J j) : ℝ) ≤ p → + (L : ℝ) ≤ Real.exp p → + (∀ x, 0 < μ.weight x → + (fun i => (u x i : ZMod W.modulus)) = residue ∧ + dist (fun i => (u x i : ℝ) / N i) center ≤ Real.exp (-2 * p) / 4) → + (∀ x, 0 < μ.weight x → ‖signal x‖ ≤ 1) → + Real.exp (-p) ≤ ‖μ.correlation signal (fun x => W.eval N poly (u x))‖ → + ∃ a : (Σ j, J j) → ℤ, + (∀ j, |(a j : ℝ)| ≤ Real.exp ((p + C) ^ C)) ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖μ.correlation signal (fun x => + (Real.fourierChar (MvPolynomial.eval (fun i => (u x i : ℝ)) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ))‖ := by + let Q : Polynomial ℕ := Polynomial.X + 4 + + (2 * (Polynomial.X + 4) + 1) * (2 * (Polynomial.X + 4) + 2) ^ 4 + obtain ⟨C, hC, hQ⟩ := exists_natPolynomial_eval_budget Q + refine ⟨C, hC, ?_⟩ + intro X Ω _ _ m J _ periodCap coverCap L W μ u N poly signal residue center p hp hdim hL + hcell hsignal hcorr + let q := p + 4 + let A := 2 * q * (2 * q + 2) ^ 4 + have hq : 0 ≤ q := by dsimp [q]; linarith + have hpq : p ≤ q := by dsimp [q]; linarith + have hfour : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + have hε : 0 < Real.exp (-p) / 4 := by positivity + have hεp : (Real.exp (-p) / 4)⁻¹ ≤ Real.exp q := by + rw [inv_div, Real.exp_neg, div_inv_eq_mul] + change 4 * Real.exp p ≤ Real.exp (p + 4) + rw [Real.exp_add] + nlinarith [Real.exp_pos p] + have herr : (L : ℝ) * (Real.exp (-2 * p) / 4) + Real.exp (-p) / 4 ≤ + Real.exp (-p) / 2 := by + calc + _ ≤ Real.exp p * (Real.exp (-2 * p) / 4) + Real.exp (-p) / 4 := by + gcongr + _ = _ := by + have he : Real.exp p * Real.exp (-2 * p) = Real.exp (-p) := by + rw [← Real.exp_add] + congr 1 + ring + rw [← mul_div_assoc, he] + ring + obtain ⟨a, ha, hscore⟩ := W.exists_correlating_frequency μ u N poly signal residue center + (Real.exp (-2 * p) / 4) (Real.exp (-p) / 4) (Real.exp (-p)) q hε (Real.exp_pos _) + hq (hdim.trans hpq) (hL.trans (Real.exp_le_exp.mpr hpq)) hεp hcell hsignal herr hcorr + have hbudget : p + 4 + (2 * q + 1) * (2 * q + 2) ^ 4 ≤ (p + C) ^ C := by + simpa [Q, q, Polynomial.eval₂_pow] using hQ p hp + have hfreq : (2 * q + 2) ^ 4 ≤ (p + C) ^ C := by + apply le_trans _ hbudget + nlinarith [pow_nonneg (show 0 ≤ 2 * q + 2 by linarith) 4] + have hcost : p + A + 4 ≤ (p + C) ^ C := by + dsimp [A] + nlinarith [pow_nonneg (show 0 ≤ 2 * q + 2 by linarith) 4] + refine ⟨a, fun j => (ha j).trans (Real.exp_le_exp.mpr hfreq), ?_⟩ + apply le_trans (Real.exp_le_exp.mpr (neg_le_neg hcost)) + apply le_trans ?_ hscore + change Real.exp (-(p + A + 4)) ≤ Real.exp (-p) / (2 * Real.exp A) + apply (le_div_iff₀ (by positivity : 0 < 2 * Real.exp A)).mpr + have he : Real.exp (-(p + A + 4)) * (2 * Real.exp A) = + 2 * Real.exp (-p) / Real.exp 4 := by + rw [mul_comm (2 : ℝ), ← mul_assoc, ← Real.exp_add] + have hx : -(p + A + 4) + A = -p - 4 := by ring + rw [hx, Real.exp_sub] + ring + rw [he] + apply (div_le_iff₀ (Real.exp_pos _)).mpr + nlinarith [Real.exp_pos (-p)] + +theorem exists_correlating_frequency_product_early : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X Ω : Type*} [Fintype X] [Fintype Ω] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + {periodCap coverCap : ℝ} {L : ℝ≥0} + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (μ : FiniteProbabilityWeights Ω) (u : Ω → X → ℤ) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (signal : Ω → ℂ) (residue : X → ZMod W.modulus) (center : X → ℝ) + (p : ℝ), 0 ≤ p → (Fintype.card (Σ j, J j) : ℝ) ≤ p → + (L : ℝ) ≤ Real.exp p → + (∀ x, 0 < μ.weight x → + (fun i => (u x i : ZMod W.modulus)) = residue ∧ + dist (fun i => (u x i : ℝ) / N i) center ≤ Real.exp (-2 * p) / 4) → + (∀ x, 0 < μ.weight x → ‖signal x‖ ≤ 1) → + Real.exp (-p) ≤ ‖μ.complexMean (fun x => W.eval N poly (u x) * signal x)‖ → + ∃ a : (Σ j, J j) → ℤ, + (∀ j, |(a j : ℝ)| ≤ Real.exp ((p + C) ^ C)) ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖μ.complexMean (fun x => + (Real.fourierChar (MvPolynomial.eval (fun i => (u x i : ℝ)) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * signal x)‖ := by + obtain ⟨C, hC, h⟩ := exists_correlating_frequency_early + refine ⟨C, hC, ?_⟩ + intro X Ω _ _ m J _ periodCap coverCap L W μ u N poly signal residue center p hp hdim hL + hcell hsignal hcorr + obtain ⟨a, ha, hc⟩ := h W μ u N poly (fun x => star (signal x)) residue center p hp + hdim hL hcell (fun x hx => by simpa only [norm_star] using hsignal x hx) (by + rw [norm_correlation_star_eq_product] + simpa only [mul_comm] using hcorr) + refine ⟨a, ha, ?_⟩ + rw [norm_correlation_star_eq_product] at hc + simpa only [mul_comm] using hc + +end Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +end + +section + +namespace Erdos3 + +namespace VectorPolynomial + +open MvPolynomial + +variable {X : Type*} {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + +theorem normalizedTwistFrequencyPolynomial_top_not_approximation + (cover : ℕ) (hcover : 0 < cover) (h : Fin m) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (W : Submodule ℝ (J h → ℝ)) (T : X → ℝ) (R S : ℝ) + (hT : ∀ i, 0 < T i) (hcost : (cover : ℝ) * S ≤ R) + (hrank : HasLayerSamplingRank (h.val + 1) T R W (poly h)) + (ha : ∀ i, |(a ⟨h, i⟩ : ℝ)| ≤ R) + (hw : ∃ w ∈ W, integerRowLinear (fun i => a ⟨h, i⟩) w ≠ 0) + (htop : homogeneousComponent (h.val + 1) + (normalizedTwistFrequencyPolynomial cover a poly) = + C (1 / (cover : ℝ)) * homogeneousComponent (h.val + 1) + (integerRowPolynomial (fun i => a ⟨h, i⟩) (poly h))) : + ¬ PolynomialRationalApproximation T S (homogeneousComponent (h.val + 1) + (normalizedTwistFrequencyPolynomial cover a poly)) := by + intro happ + obtain ⟨w, hw, hwa⟩ := hw + have hwan : ∑ i, (a ⟨h, i⟩ : ℝ) * w i ≠ 0 := by + simpa only [integerRowLinear_apply] using hwa + apply hrank (fun i => a ⟨h, i⟩) ha ⟨⟨w, hw⟩, hwan⟩ + have hscaled := (happ.nat_smul cover hcover).mono hcost hT + rw [htop] at hscaled + have hcancel (P : MvPolynomial X ℝ) : + (cover : ℝ) • (C (1 / (cover : ℝ)) * P) = P := by + rw [smul_eq_C_mul, ← mul_assoc, ← map_mul] + rw [mul_one_div_cancel (Nat.cast_ne_zero.mpr hcover.ne'), map_one, one_mul] + rwa [hcancel] at hscaled + +theorem normalizedTwistFrequencyPolynomial_rank_dichotomy + (cover : ℕ) (hcover : 0 < cover) (d : ℕ) + (W : ∀ j, Submodule ℝ (J j → ℝ)) + (a : (Σ j, J j) → ℤ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (T : X → ℝ) (R S : ℝ) (hT : ∀ i, 0 < T i) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ W j) + (hrank : ∀ j, d < j.val + 1 → HasLayerSamplingRank (j.val + 1) T R (W j) (poly j)) + (ha : ∀ i, |(a i : ℝ)| ≤ R) (hcost : (cover : ℝ) * S ≤ R) : + (normalizedTwistFrequencyPolynomial cover a poly = + normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly + + C (normalizedTwistHighFrequencyConstant cover d a poly) ∧ + (normalizedTwistFrequencyPolynomial cover (truncateTaggedFrequency d a) poly).totalDegree ≤ d) ∨ + ∃ h : Fin m, d < h.val + 1 ∧ + (normalizedTwistFrequencyPolynomial cover a poly).totalDegree ≤ h.val + 1 ∧ + ¬ PolynomialRationalApproximation T S (homogeneousComponent (h.val + 1) + (normalizedTwistFrequencyPolynomial cover a poly)) := by + rcases normalizedTwistFrequencyPolynomial_highest_layer cover d W a poly hpoly hcoeff with + hlow | ⟨h, hd, hw, _, hdegree, htop⟩ + · exact Or.inl hlow + · exact Or.inr ⟨h, hd, hdegree, + normalizedTwistFrequencyPolynomial_top_not_approximation cover hcover h a poly (W h) + T R S hT hcost (hrank h hd) (fun i => ha ⟨h, i⟩) hw htop⟩ + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +open scoped NNReal BigOperators + +theorem exists_localized_correlating_frequency : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X : Type*} [Fintype X] [DecidableEq X] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + {periodCap coverCap : ℝ} {L : ℝ≥0} + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (signal : (X → ℤ) → ℂ) (p : ℝ), + 0 ≤ p → (Fintype.card (Σ j, J j) : ℝ) ≤ p → + (W.modulus : ℝ) ≤ Real.exp p → (L : ℝ) ≤ Real.exp p → + (∀ i, Real.exp (3 * p + 16) ≤ (N i : ℝ)) → + (∀ u ∈ integerBox N, ‖signal u‖ ≤ 1) → + Real.exp (-p) ≤ ‖𝔼 u ∈ integerBox N, W.eval N poly u * signal u‖ → + ∃ (start length : X → ℕ) (a : (Σ j, J j) → ℤ), + (∀ i, 0 < length i) ∧ + (∀ i, (N i : ℝ) * Real.exp (-(3 * p + 16)) ≤ length i) ∧ + (∀ i, (N i : ℝ) ≤ Real.exp (3 * p + 16) * W.modulus * length i) ∧ + (∀ v ∈ integerBox length, + (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i) ∈ integerBox N) ∧ + (∀ j, |(a j : ℝ)| ≤ Real.exp ((p + C) ^ C)) ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖𝔼 v ∈ integerBox length, + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (W.modulus : ℝ) * v i) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * + signal (fun i => (start i : ℤ) + (W.modulus : ℤ) * v i)‖ := by + obtain ⟨C, hC, hfourier⟩ := exists_correlating_frequency_product_early + refine ⟨C, hC, ?_⟩ + intro X _ _ m J _ periodCap coverCap L W N poly signal p hp hdim hmod hL hN hsignal hcorr + obtain ⟨start, length, hpos, hlength, hcomparison, hinside, _, hspatial, _, hselected⟩ := + exists_correlated_integer_residue_box N W.modulus p hp W.modulus_pos hmod hN + (fun u => W.eval N poly u * signal u) + have hnonempty : (integerBox length).Nonempty := by + refine ⟨0, (mem_integerBox length 0).mpr ?_⟩ + intro i + simp only [Pi.zero_apply] + exact ⟨le_rfl, by exact_mod_cast hpos i⟩ + let μ := FiniteProbabilityWeights.uniformFinset (integerBox length) hnonempty + let u : ↥(integerBox length) → X → ℤ := + fun v i => (start i : ℤ) + (W.modulus : ℤ) * v.val i + have hcell (v : ↥(integerBox length)) (_ : 0 < μ.weight v) : + (fun i => (u v i : ZMod W.modulus)) = (fun i => (start i : ZMod W.modulus)) ∧ + dist (fun i => (u v i : ℝ) / N i) (fun i => (start i : ℝ) / N i) ≤ + Real.exp (-2 * p) / 4 := by + constructor + · funext i + simp [u] + · apply (dist_pi_le_iff (by positivity)).mpr + intro i + simpa only [u, Real.dist_eq, Int.cast_add, Int.cast_mul, Int.cast_natCast, + neg_mul] using hspatial v.val v.property i + have hselected' : Real.exp (-p) ≤ ‖μ.complexMean + (fun v => W.eval N poly (u v) * signal (u v))‖ := by + dsimp only [μ, u] + rw [FiniteProbabilityWeights.uniformFinset_complexMean _ _ + (fun v : X → ℤ => W.eval N poly (fun i => (start i : ℤ) + W.modulus * v i) * + signal (fun i => (start i : ℤ) + W.modulus * v i))] + exact hcorr.trans hselected + obtain ⟨a, ha, hc⟩ := hfourier W μ u N poly (fun v => signal (u v)) + (fun i => (start i : ZMod W.modulus)) (fun i => (start i : ℝ) / N i) p hp hdim hL + hcell (fun v _ => hsignal _ (hinside v.val v.property)) hselected' + refine ⟨start, length, a, hpos, hlength, hcomparison, hinside, ha, ?_⟩ + dsimp only [μ, u] at hc + rw [FiniteProbabilityWeights.uniformFinset_complexMean _ _ + (fun v : X → ℤ => (Real.fourierChar (MvPolynomial.eval + (fun i => (((start i : ℤ) + W.modulus * v i : ℤ) : ℝ)) + (normalizedTwistFrequencyPolynomial W.cover a poly)) : ℂ) * + signal (fun i => (start i : ℤ) + W.modulus * v i))] at hc + simpa only [u, Int.cast_add, Int.cast_mul, Int.cast_natCast] using hc + +end Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistSingleSiteFourierHaar.lean b/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistSingleSiteFourierHaar.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f6bf0876f67a8e1eedb699be09c0d39593f66f6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/NormalizedTwistSingleSiteFourierHaar.lean @@ -0,0 +1,444 @@ +import Mathlib.MeasureTheory.Integral.Pi +import OAI.Combinatorics.Progressions.Estimates.AmbientBooleanReconstruction +import OAI.Combinatorics.Progressions.Estimates.PhysicalSingleSiteCommonCover + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +noncomputable def ambientIntegerCharacter {J : Type*} [Fintype J] (frequency : J → ℤ) + (x : J → UnitAddCircle) : ℂ := + ∏ j, CircleFourier.character (frequency j • x j) + +theorem ambientIntegerCharacter_norm {J : Type*} [Fintype J] + (frequency : J → ℤ) (x : J → UnitAddCircle) : + ‖ambientIntegerCharacter frequency x‖ = 1 := by + simp [ambientIntegerCharacter, norm_prod, CircleFourier.norm_character] + +theorem ambientIntegerCharacter_lipschitz {J : Type*} [Fintype J] + (frequency : J → ℤ) (C : ℝ≥0) (hC : ∀ j, |(frequency j : ℝ)| ≤ C) : + LipschitzWith (Fintype.card J * (CircleFourier.characterLipConstant * C)) + (ambientIntegerCharacter frequency) := by + have hcoord (j : J) : LipschitzWith C (fun x : J → UnitAddCircle => frequency j • x j) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [dist_eq_norm, ← smul_sub] + apply (norm_zsmul_le (frequency j) (x j - y j)).trans + apply mul_le_mul + · simpa only [Int.norm_eq_abs] using hC j + · simpa only [dist_eq_norm] using dist_le_pi_dist x y j + · exact norm_nonneg _ + · exact C.coe_nonneg + have h := (bounded_lipschitz_fintype_prod + (fun j (x : J → UnitAddCircle) => CircleFourier.character (frequency j • x j)) + (B := 1) le_rfl (fun j => CircleFourier.character_lipschitz.comp (hcoord j)) + (fun j x => (CircleFourier.norm_character _).le)).2 + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [one_pow, mul_one, ambientIntegerCharacter] using h.dist_le_mul x y + +theorem ambientIntegerCharacter_reconstruction {J S : Type*} [Fintype J] [Fintype S] + (frequency : J → ℤ) (A : Matrix J S ℤ) (x : S → UnitAddCircle) : + ambientIntegerCharacter frequency (fun j => ∑ s, A j s • x s) = + ambientIntegerCharacter (fun s => ∑ j, frequency j * A j s) x := by + simp only [ambientIntegerCharacter, Finset.smul_sum, Finset.sum_smul, + ← mul_smul, CircleFourier.character_fintype_sum] + exact Finset.prod_comm + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators NNReal + +noncomputable def ambientFourierSum {J F : Type*} [Fintype J] [Fintype F] + (frequency : F → J → ℤ) (coeff : F → ℂ) (x : J → UnitAddCircle) : ℂ := + ∑ a, coeff a * ambientIntegerCharacter (frequency a) x + +theorem ambientFourierSum_norm_le {J F : Type*} [Fintype J] [Fintype F] + (frequency : F → J → ℤ) (coeff : F → ℂ) {B : ℝ} + (hcoeff : (∑ a, ‖coeff a‖) ≤ B) (x : J → UnitAddCircle) : + ‖ambientFourierSum frequency coeff x‖ ≤ B := by + apply (norm_sum_le _ _).trans + simpa only [norm_mul, ambientIntegerCharacter_norm, mul_one] using hcoeff + +theorem ambientFourierSum_lipschitz {J F : Type*} [Fintype J] [Fintype F] + (frequency : F → J → ℤ) (coeff : F → ℂ) (C B : ℝ≥0) + (hfreq : ∀ a j, |(frequency a j : ℝ)| ≤ C) + (hcoeff : (∑ a, ‖coeff a‖) ≤ B) : + LipschitzWith (B * (Fintype.card J * (CircleFourier.characterLipConstant * C))) + (ambientFourierSum frequency coeff) := by + let L : ℝ≥0 := Fintype.card J * (CircleFourier.characterLipConstant * C) + have hL (a) := ambientIntegerCharacter_lipschitz (frequency a) C (hfreq a) + apply LipschitzWith.of_dist_le_mul + intro x y + change dist (ambientFourierSum frequency coeff x) (ambientFourierSum frequency coeff y) ≤ + (B * L : ℝ≥0) * dist x y + simp only [dist_eq_norm, ambientFourierSum, ← Finset.sum_sub_distrib, ← mul_sub, NNReal.coe_mul] + calc + _ ≤ ∑ a, ‖coeff a * (ambientIntegerCharacter (frequency a) x - + ambientIntegerCharacter (frequency a) y)‖ := norm_sum_le _ _ + _ ≤ ∑ a, ‖coeff a‖ * ((L : ℝ) * ‖x - y‖) := by + apply Finset.sum_le_sum + intro a _ + rw [norm_mul] + apply mul_le_mul_of_nonneg_left _ (norm_nonneg _) + simpa only [dist_eq_norm] using (hL a).dist_le_mul x y + _ = (∑ a, ‖coeff a‖) * ((L : ℝ) * ‖x - y‖) := (Finset.sum_mul _ _ _).symm + _ ≤ (B : ℝ) * ((L : ℝ) * ‖x - y‖) := + mul_le_mul_of_nonneg_right hcoeff (mul_nonneg L.coe_nonneg (norm_nonneg _)) + _ = _ := (mul_assoc _ _ _).symm + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal + +variable {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (coeff : F → ℂ) + +noncomputable def coefficientFourierAmbient : (CoefficientAmbientIndex K J → UnitAddCircle) → ℂ := + ambientFourierSum (fun a t => frequency a t.1.1 t.1.2.val t.2) coeff + +theorem coefficientFourierAmbient_eq (z : CoefficientTorus (K := K) U) : + coefficientFourierAmbient frequency coeff (coefficientAmbientTorus U z) = + coefficientTorusFourierSum U frequency coeff z := by + unfold coefficientFourierAmbient ambientFourierSum coefficientTorusFourierSum + apply Finset.sum_congr rfl + intro a _ + congr 1 + rw [ambientIntegerCharacter, coefficientAmbientTorus_character] + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) z + simp only [coefficientTorusCharacter_mk, coefficientArrayFunctional, + LinearMap.coe_mk, AddHom.coe_mk, coefficientSlotFrequency_apply] + +theorem coefficientFourierAmbient_norm_le {C : ℝ} (hc : (∑ a, ‖coeff a‖) ≤ C) + (z : CoefficientAmbientIndex K J → UnitAddCircle) : + ‖coefficientFourierAmbient frequency coeff z‖ ≤ C := + ambientFourierSum_norm_le _ coeff hc z + +theorem coefficientFourierAmbient_lipschitz (L C : ℝ≥0) + (hfreq : ∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ L) + (hc : (∑ a, ‖coeff a‖) ≤ C) : + LipschitzWith (C * (Fintype.card (CoefficientAmbientIndex K J) * + (CircleFourier.characterLipConstant * L))) (coefficientFourierAmbient frequency coeff) := + ambientFourierSum_lipschitz _ coeff L C (fun a t => hfreq a t.1.1 t.1.2.val t.1.2.property t.2) hc + +theorem exists_mean_coefficient_ambient_approximation + {Y : Type*} [Fintype Y] (law : FiniteProbabilityWeights Y) + (g : Y → CoefficientTorus (K := K) U → ℝ) (C L : ℝ≥0) {δ : ℝ} + (h : ∀ y, ∃ (F : Type) (inst : Fintype F), let _ := inst + ∃ (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (coeff : F → ℂ), + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ L) ∧ + (∑ a, ‖coeff a‖) ≤ C ∧ + ∀ z, ‖(g y z : ℂ) - coefficientTorusFourierSum U frequency coeff z‖ ≤ δ) : + ∃ f : (CoefficientAmbientIndex K J → UnitAddCircle) → ℂ, + LipschitzWith (C * (Fintype.card (CoefficientAmbientIndex K J) * + (CircleFourier.characterLipConstant * L))) f ∧ + (∀ z, ‖f z‖ ≤ C) ∧ + ∀ z, ‖(law.mean (fun y => g y z) : ℂ) - f (coefficientAmbientTorus U z)‖ ≤ δ := by + obtain ⟨F, inst, frequency, coeff, hfreq, hc, happ⟩ := + exists_coefficientFourierMixture U law g h + let _ := inst + refine ⟨coefficientFourierAmbient frequency coeff, + coefficientFourierAmbient_lipschitz frequency coeff L C hfreq hc, + coefficientFourierAmbient_norm_le frequency coeff hc, ?_⟩ + intro z + rw [coefficientFourierAmbient_eq] + exact happ z + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +variable {m : ℕ} {α : Type*} [Fintype α] [DecidableEq α] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) + +noncomputable def booleanSiteAmbientFrequency + (frequency : JetAmbientIndex jets J → ℤ) (s : Finset α) : + JetAmbientIndex (fun _ : Fin m => Unit) J → ℤ := fun a => + ∑ r : jets a.1, frequency ⟨a.1, r, a.2.2⟩ * booleanJetExtractionMatrix Subtype.val r s + +omit [∀ j, Fintype (J j)] in +theorem booleanSiteAmbientFrequency_bound + (frequency : JetAmbientIndex jets J → ℤ) {C : ℝ} (hC : 0 ≤ C) + (hf : ∀ a, |(frequency a : ℝ)| ≤ C) + (s : Finset α) (a : JetAmbientIndex (fun _ : Fin m => Unit) J) : + |(booleanSiteAmbientFrequency frequency s a : ℝ)| ≤ Fintype.card (jets a.1) * C := by + simp only [booleanSiteAmbientFrequency, Int.cast_sum, Int.cast_mul] + calc + _ ≤ ∑ r : jets a.1, |(frequency ⟨a.1, r, a.2.2⟩ : ℝ) * + (booleanJetExtractionMatrix Subtype.val r s : ℝ)| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _r : jets a.1, C := by + apply Finset.sum_le_sum + intro r _ + rw [abs_mul] + exact (mul_le_mul (hf _) (booleanJetExtractionMatrix_abs_le_one Subtype.val r s) + (abs_nonneg _) hC).trans_eq (mul_one C) + _ = _ := by simp + +theorem ambientJetCharacter_site_factorization + (U : ∀ j, Submodule ℝ (J j → ℝ)) (d : ℕ) + (frequency : JetAmbientIndex jets J → ℤ) (y : EuclideanJetLayers U jets) : + ambientIntegerCharacter frequency (coveredJetAmbientTorus U d y) = + ∏ s : Finset α, ambientIntegerCharacter (booleanSiteAmbientFrequency frequency s) + (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s)) := by + let term := fun (s : Finset α) (j : Fin m) (i : J j) => + CircleFourier.character (booleanSiteAmbientFrequency frequency s ⟨j, (), i⟩ • + coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s) ⟨j, (), i⟩) + have hrow (j : Fin m) (i : J j) : + (∏ r : jets j, CircleFourier.character + (frequency ⟨j, r, i⟩ • coveredJetAmbientTorus U d y ⟨j, r, i⟩)) = + ∏ s : Finset α, term s j i := by + simpa only [ambientIntegerCharacter, booleanSiteAmbientFrequency, term, + coveredJetAmbientTorus_booleanInverse] using + ambientIntegerCharacter_reconstruction (fun r : jets j => frequency ⟨j, r, i⟩) + (booleanJetExtractionMatrix Subtype.val) + (fun s => coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s) ⟨j, (), i⟩) + simp only [ambientIntegerCharacter, Fintype.prod_sigma, Fintype.prod_prod_type, + Fintype.prod_unique] + change (∏ j, ∏ r : jets j, ∏ i : J j, CircleFourier.character + (frequency ⟨j, r, i⟩ • coveredJetAmbientTorus U d y ⟨j, r, i⟩)) = + ∏ s : Finset α, ∏ j, ∏ i : J j, term s j i + calc + _ = ∏ j, ∏ i : J j, ∏ r : jets j, CircleFourier.character + (frequency ⟨j, r, i⟩ • coveredJetAmbientTorus U d y ⟨j, r, i⟩) := + Finset.prod_congr rfl (fun _ _ => Finset.prod_comm) + _ = ∏ j, ∏ i : J j, ∏ s : Finset α, term s j i := by + simp_rw [hrow] + _ = ∏ j, ∏ s : Finset α, ∏ i : J j, term s j i := + Finset.prod_congr rfl (fun _ _ => Finset.prod_comm) + _ = _ := Finset.prod_comm + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {α : Type*} [Fintype α] [DecidableEq α] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "siteIndex" => JetAmbientIndex (fun _ : Fin m => Unit) J + +noncomputable def booleanCharacterSiteFactor + (frequency : JetAmbientIndex jets J → ℤ) + (g : Finset α → (siteIndex → UnitAddCircle) → ℂ) + (s : Finset α) (z : siteIndex → UnitAddCircle) : ℂ := + ambientIntegerCharacter (booleanSiteAmbientFrequency frequency s) z * g s z + +theorem booleanCharacterSiteFactor_norm + (frequency : JetAmbientIndex jets J → ℤ) + (g : Finset α → (siteIndex → UnitAddCircle) → ℂ) + (hg : ∀ s z, ‖g s z‖ ≤ 1) (s : Finset α) (z : siteIndex → UnitAddCircle) : + ‖booleanCharacterSiteFactor frequency g s z‖ ≤ 1 := by + simpa only [booleanCharacterSiteFactor, norm_mul, ambientIntegerCharacter_norm, one_mul] using hg s z + +theorem booleanCharacterSiteFactor_lipschitz + (frequency : JetAmbientIndex jets J → ℤ) + (g : Finset α → (siteIndex → UnitAddCircle) → ℂ) + (L C D : ℝ≥0) (hf : ∀ a, |(frequency a : ℝ)| ≤ C) + (hD : ∀ j, (Fintype.card (jets j) : ℝ) ≤ D) + (hg : ∀ s, LipschitzWith L (g s)) (hunit : ∀ s z, ‖g s z‖ ≤ 1) + (s : Finset α) : + LipschitzWith (L + Fintype.card siteIndex * (CircleFourier.characterLipConstant * (D * C))) + (booleanCharacterSiteFactor frequency g s) := by + have hfreq (a : siteIndex) : |(booleanSiteAmbientFrequency frequency s a : ℝ)| ≤ (D * C : ℝ≥0) := + (booleanSiteAmbientFrequency_bound frequency C.coe_nonneg hf s a).trans + (mul_le_mul_of_nonneg_right (hD a.1) C.coe_nonneg) + have hchar := ambientIntegerCharacter_lipschitz (booleanSiteAmbientFrequency frequency s) (D * C) hfreq + have h := lipschitz_mul_of_bounds (ambientIntegerCharacter (booleanSiteAmbientFrequency frequency s)) (g s) + (Bf := 1) (Bg := 1) hchar (hg s) + (fun z => (ambientIntegerCharacter_norm _ z).le) (hunit s) + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [one_mul, booleanCharacterSiteFactor] using h.dist_le_mul x y + +theorem booleanCharacterSiteFactor_product + (U : ∀ j, Submodule ℝ (J j → ℝ)) (d : ℕ) + (frequency : JetAmbientIndex jets J → ℤ) + (g : Finset α → (siteIndex → UnitAddCircle) → ℂ) (y : EuclideanJetLayers U jets) : + ambientIntegerCharacter frequency (coveredJetAmbientTorus U d y) * + (∏ s, g s (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s))) = + ∏ s, booleanCharacterSiteFactor frequency g s + (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s)) := by + rw [ambientJetCharacter_site_factorization] + simp only [booleanCharacterSiteFactor, Finset.prod_mul_distrib] + +theorem booleanCharacterSiteFactor_expansion {F : Type*} [Fintype F] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (d : ℕ) + (frequency : F → JetAmbientIndex jets J → ℤ) (c : F → ℂ) + (g : Finset α → (siteIndex → UnitAddCircle) → ℂ) (R : ℂ) (y : EuclideanJetLayers U jets) : + (∑ a, c a * ambientIntegerCharacter (frequency a) (coveredJetAmbientTorus U d y) * R) * + (∏ s, g s (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s))) = + ∑ a, c a * (R * ∏ s, booleanCharacterSiteFactor (frequency a) g s + (coveredJetAmbientTorus U d (coveredBooleanSiteValue U y s))) := by + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro a _ + rw [← booleanCharacterSiteFactor_product U d (frequency a) g y] + ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical NNReal + +private noncomputable def singleSiteEuclideanRow {D : Type*} [Fintype D] + (U : Submodule ℝ (D → ℝ)) (a : D → ℤ) : euclideanSubspace U →ₗ[ℝ] ℝ := + (integerRowLinear a).comp (U.subtype.comp + ((LinearMap.proj ()).comp (euclideanSubspaceArrayEquiv U).toLinearMap)) + +private theorem singleSiteEuclideanRow_apply {D : Type*} [Fintype D] + (U : Submodule ℝ (D → ℝ)) (a : D → ℤ) (x : euclideanSubspace U) : + singleSiteEuclideanRow U a x = ∑ i, (a i : ℝ) * x.val i := by + change integerRowLinear a (fun i => x.val i) = _ + exact integerRowLinear_apply a _ + +private theorem singleSiteEuclideanRow_integral {D : Type*} [Fintype D] + (U : Submodule ℝ (D → ℝ)) (a : D → ℤ) (x : euclideanSubspace U) + (hx : x ∈ (latticeSection (standardEuclideanLattice D) + (euclideanSubspace U)).toAddSubgroup) : + ∃ n : ℤ, singleSiteEuclideanRow U a x = n := by + have h := (euclideanSubspaceArrayEquiv_mem_lattice U x).mpr hx + choose z hz using fun i => h () i + refine ⟨∑ i, a i * z i, ?_⟩ + rw [singleSiteEuclideanRow_apply] + simp only [euclideanSubspaceArrayEquiv_apply] at hz + simp only [hz, Int.cast_sum, Int.cast_mul] + +private theorem singleSiteEuclideanRow_eq_zero {D : Type*} [Fintype D] + (U : Submodule ℝ (D → ℝ)) (a : D → ℤ) : + singleSiteEuclideanRow U a = 0 ↔ U ≤ LinearMap.ker (integerRowLinear a) := by + constructor + · intro h x hx + have he := LinearMap.congr_fun h + ((euclideanSubspaceArrayEquiv U).symm (fun _ => ⟨x, hx⟩)) + change integerRowLinear a + ((euclideanSubspaceArrayEquiv U + ((euclideanSubspaceArrayEquiv U).symm (fun _ => ⟨x, hx⟩))) ()).val = 0 at he + rw [ContinuousLinearEquiv.apply_symm_apply] at he + exact he + · intro h + ext x + exact h ((euclideanSubspaceArrayEquiv U x ()).property) + +private theorem singleSiteEuclideanRow_character {D : Type*} [Fintype D] + (U : Submodule ℝ (D → ℝ)) (a : D → ℤ) + (y : euclideanSubspace U ⧸ + (latticeSection (standardEuclideanLattice D) (euclideanSubspace U)).toAddSubgroup) : + (∏ i, CircleFourier.character + (a i • subspaceAmbientTorus U (euclideanSubspaceTorusEquiv U y) i)) = + quotientLinearCharacter _ (singleSiteEuclideanRow U a) + (singleSiteEuclideanRow_integral U a) y := by + obtain ⟨x, rfl⟩ := QuotientAddGroup.mk'_surjective _ y + rw [euclideanSubspaceTorusEquiv_mk, quotientLinearCharacter_mk, + singleSiteEuclideanRow_apply, character_real_sum] + apply Finset.prod_congr rfl + intro i _ + rw [subspaceAmbientTorus_mk, euclideanSubspaceArrayEquiv_apply, + ← AddCircle.coe_zsmul, zsmul_eq_mul] + +theorem singleSiteHaar_ambientIntegerCharacter_integral + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) + (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (a : (Σ j, J j) → ℤ) : + (∫ y, ambientIntegerCharacter a + (fun i => coveredJetAmbientTorus U 1 y ⟨i.1, (), i.2⟩) + ∂Measure.pi (fun j => Measure.pi (fun _ : Unit => ν j))) = + if ∀ j, U j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩)) + then 1 else 0 := by + have he (y : EuclideanJetLayers U (fun _ => Unit)) : + ambientIntegerCharacter a + (fun i => coveredJetAmbientTorus U 1 y ⟨i.1, (), i.2⟩) = + ∏ j, ∏ u : Unit, quotientLinearCharacter _ + (singleSiteEuclideanRow (U j) (fun i => a ⟨j, i⟩)) + (singleSiteEuclideanRow_integral (U j) (fun i => a ⟨j, i⟩)) (y j u) := by + simp only [ambientIntegerCharacter, Fintype.prod_sigma, Fintype.prod_unique, + coveredJetAmbientTorus, quotientIntegerCover, nsmulAddMonoidHom_apply, one_nsmul] + apply Finset.prod_congr rfl + intro j _ + exact singleSiteEuclideanRow_character (U j) (fun i => a ⟨j, i⟩) (y j ()) + simp_rw [he] + rw [integral_fintype_prod_eq_prod (fun j (v : Unit → _) => + ∏ u : Unit, quotientLinearCharacter _ + (singleSiteEuclideanRow (U j) (fun i => a ⟨j, i⟩)) + (singleSiteEuclideanRow_integral (U j) (fun i => a ⟨j, i⟩)) (v u))] + simp_rw [integral_fintype_prod_eq_prod] + simp_rw [quotientLinearCharacter_integral, singleSiteEuclideanRow_eq_zero] + simp only [Fintype.prod_unique] + split_ifs with h + · simp only [h, ite_true, Finset.prod_const_one] + · obtain ⟨j, hj⟩ := not_forall.mp h + exact Finset.prod_eq_zero (Finset.mem_univ j) (ite_eq_right hj) + +theorem singleSiteHaar_ambientIntegerCharacter_integrable + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) + (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, IsProbabilityMeasure (ν j)] + (a : (Σ j, J j) → ℤ) : + Integrable (fun y => ambientIntegerCharacter a + (fun i => coveredJetAmbientTorus U 1 y ⟨i.1, (), i.2⟩)) + (Measure.pi (fun j => Measure.pi (fun _ : Unit => ν j))) := by + have : ∀ j, IsProbabilityMeasure (Measure.pi (fun _ : Unit => ν j)) := + fun _ => Measure.pi.instIsProbabilityMeasure _ + have : IsProbabilityMeasure + (Measure.pi (fun j => Measure.pi (fun _ : Unit => ν j))) := + Measure.pi.instIsProbabilityMeasure _ + apply Integrable.of_bound _ 1 + (ae_of_all _ (fun _ => (ambientIntegerCharacter_norm a _).le)) + apply Continuous.aestronglyMeasurable + let C : ℝ≥0 := ⟨∑ i, |(a i : ℝ)|, Finset.sum_nonneg (fun i _ => abs_nonneg _)⟩ + have hc : Continuous (ambientIntegerCharacter a) := + (ambientIntegerCharacter_lipschitz a C (fun i => + Finset.single_le_sum (fun j _ => abs_nonneg (a j : ℝ)) (Finset.mem_univ i))).continuous + apply hc.comp + apply continuous_pi + intro i + exact (continuous_apply (⟨i.1, (), i.2⟩ : JetAmbientIndex (fun _ : Fin m => Unit) J)).comp + (coveredJetAmbientTorus_continuous (O := fun _ : Fin m => Unit) U 1) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/OneSiteFourierAverage.lean b/lean/OAI/Combinatorics/Progressions/Fourier/OneSiteFourierAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..74ab74ca4daac48f0e0fd571f8c0c4461568f3fe --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/OneSiteFourierAverage.lean @@ -0,0 +1,63 @@ +import OAI.Combinatorics.Progressions.Estimates.CoefficientFiberOrthogonality +import OAI.Combinatorics.Progressions.Estimates.OneSiteResidualFactor + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open MeasureTheory VectorPolynomial +open scoped BigOperators Classical + +theorem coefficientTorusFourierSum_fiber_integrable {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (μ : Measure (CoefficientTorus (K := K) U)) [IsFiniteMeasure μ] + (y : CoefficientTorus (K := Empty) U) : + Integrable (fun x => coefficientTorusFourierSum U frequency c (coefficientFiberMap U t y x)) μ := by + apply integrable_finsetSum + intro a _ + exact (coefficientTorusCharacter_fiber_integrable U t (frequency a) μ y).const_mul (c a) + +theorem coefficientTorusFourierSum_fiberAverage {K F : Type*} [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 μ] + (x : CoefficientTorus (K := K) U) : + coefficientFiberAverage U μ t (coefficientTorusFourierSum U frequency c) (coefficientEvaluationTorus U t x) = + ∑ a, if affineCubeModeFactors U t difference (frequency a) then + c a * coefficientTorusCharacter U (frequency a) x else 0 := by + change (∫ z, ∑ a, c a * coefficientTorusCharacter U (frequency a) + (coefficientFiberMap U t (coefficientEvaluationTorus U t x) z) ∂μ) = _ + rw [integral_finsetSum _ (fun a _ => + (coefficientTorusCharacter_fiber_integrable U t (frequency a) μ _).const_mul (c a))] + simp only [integral_const_mul] + change (∑ a, c a * coefficientFiberAverage U μ t (coefficientTorusCharacter U (frequency a)) + (coefficientEvaluationTorus U t x)) = _ + simp only [coefficientTorusCharacter_fiberAverage_evaluation, + coefficientResidualFunctional_eq_zero_iff_oneSite U t difference, mul_ite, mul_zero] + +theorem affineCubeFourierProjection_eq_fiberAverage {I K F : Type*} [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 μ] + (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 t difference frequency p c b = + coefficientFiberAverage U μ t (coefficientTorusFourierSum U frequency c) + (coefficientEvaluationTorus U t (affineSampleCoefficientTorus U p hm b)) := by + rw [coefficientTorusFourierSum_fiberAverage U t difference] + simp only [coefficientTorusCharacter_sample U _ p hp hm b, affineCubeFourierProjection] + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ParametricQuarterTorusExtension.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ParametricQuarterTorusExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..232cf42d949c97905609c95fb34172fed9386907 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ParametricQuarterTorusExtension.lean @@ -0,0 +1,48 @@ +import OAI.Combinatorics.Progressions.Fourier.RealQuarterTorusExtension + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_parametric_quarter_torus_extension + {Y D : Type*} [PseudoMetricSpace Y] [Fintype D] + (F : Y × (D → ℝ) → ℂ) (L B : ℝ≥0) + (hL : LipschitzWith L F) (hB : ∀ p, ‖F p‖ ≤ B) : + ∃ g : Y × (D → AddCircle (1 : ℝ)) → ℂ, + LipschitzWith (2 * L) g ∧ (∀ z, ‖g z‖ ≤ 2 * B) ∧ + ∀ y (v : D → ℝ), (∀ i, |v i| ≤ 1 / 4) → + g (y, fun i => (v i : AddCircle (1 : ℝ))) = F (y, v) := by + let Q : Set (Y × (D → AddCircle (1 : ℝ))) := {p | ∀ i, ‖p.2 i‖ ≤ 1 / 4} + let H : Y × (D → AddCircle (1 : ℝ)) → ℂ := fun p => F (p.1, centeredTorusLift p.2) + have hH : LipschitzOnWith L H Q := by + apply LipschitzOnWith.of_dist_le_mul + intro x hx y hy + have hc : dist (centeredTorusLift x.2) (centeredTorusLift y.2) ≤ dist x.2 y.2 := by + simpa only [NNReal.coe_one, one_mul] using centeredTorusLift_lipschitzOn.dist_le_mul x.2 hx y.2 hy + have hp : dist (x.1, centeredTorusLift x.2) (y.1, centeredTorusLift y.2) ≤ dist x y := + max_le_max le_rfl hc + exact (hL.dist_le_mul _ _).trans (mul_le_mul_of_nonneg_left hp L.coe_nonneg) + obtain ⟨g, hg, heq, hgb⟩ := exists_complex_bounded_lipschitz_extension H Q L B hH + (fun p _ => hB (p.1, centeredTorusLift p.2)) + refine ⟨g, hg, hgb, ?_⟩ + intro y v hv + have hQ : (y, fun i => (v i : AddCircle (1 : ℝ))) ∈ Q := by + intro i + rw [norm_eq_abs_centeredCircleLift, centeredCircleLift_coe (hv i)] + exact hv i + rw [← heq hQ] + apply congrArg F + apply Prod.ext + · rfl + · funext i + exact centeredCircleLift_coe (hv i) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PivotAnnihilatorFrequencyCode.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PivotAnnihilatorFrequencyCode.lean new file mode 100644 index 0000000000000000000000000000000000000000..d2a38ece8bb838ec8dd6921185ccc3bfc81d3e0e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PivotAnnihilatorFrequencyCode.lean @@ -0,0 +1,470 @@ +import OAI.Combinatorics.Progressions.Estimates.CommonPivotQuotientTop +import OAI.Combinatorics.Progressions.Nilpotent.NiltestVerticalBounds + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold.Niltest + +open CircleFourier +open scoped TensorProduct BigOperators + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} + +theorem exists_positive_fourier_projection (T : D.Niltest (fun _ : Unit => 1)) + {p rho tau B : ℝ} (hp : 0 ≤ p) (hT : T.UnitIntervalValued) (hTc : T.ComplexityLE p) + (hrho : 0 < rho) (hrhop : rho⁻¹ ≤ Real.exp p) (htau : 0 ≤ tau) (hB : 0 ≤ B) + {N : ℕ} [NeZero N] (weight : ZMod N → ℂ) (hweight : ∀ x, ‖weight x‖ ≤ B) : + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (eta : J → L →ₗ[ℚ] ℚ) (U : J → D.Niltest (fun _ : Unit => 1)) + (S : D.Niltest (fun _ : Unit => 1)), + (Fintype.card J : ℝ) ≤ Real.exp (verticalDecompositionBudget p) ∧ + (∀ j i, rationalLogHeight (eta j (D.basis i)) ≤ verticalDecompositionBudget p) ∧ + (∀ j, (U j).ComplexityLE p ∧ (U j).orbit = T.orbit) ∧ + (∀ j (z : D.RealGroup), z ∈ D.filtration.realification.subgroup s → ∀ x, + (U j).observable (z • x) = + character ((realifyFunctional (eta j) z.coord : ℝ) : CircleFourier.Circle) * (U j).observable x) ∧ + (∀ x, ‖(∑ j, (U j).observable x) - T.observable x‖ ≤ rho) ∧ + S.UnitIntervalValued ∧ S.ComplexityLE p ∧ S.orbit = T.orbit ∧ + (∀ z : D.RealGroup, z ∈ D.filtration.realification.subgroup s → + (∀ j, tau < ‖𝔼 n, weight n * (U j).evalCyclic N (fun _ => n)‖ → + realifyFunctional (eta j) z.coord = 0) → + ∀ x, S.observable (z • x) = S.observable x) ∧ + ‖(𝔼 n, weight n * T.evalCyclic N (fun _ => n)) - + (𝔼 n, weight n * S.evalCyclic N (fun _ => n))‖ ≤ + 2 * B * rho + Real.exp (verticalDecompositionBudget p) * tau := by + obtain ⟨J, inst, eta, U, hcard, hheight, hU, hvertical, _, _, happrox, _⟩ := + T.exists_controlled_vertical_decomposition hp hTc rho hrho hrhop + let := inst + obtain ⟨S, hS, hSc, hSo, hinv, herr⟩ := T.exists_positive_frequency_projection_of_decomposition + hT hTc eta U (fun j => (hU j).2) hvertical weight hB htau hweight + (fun x => by simpa only [norm_sub_rev] using happrox x) + refine ⟨J, inst, eta, U, S, hcard, hheight, hU, hvertical, happrox, hS, hSc, hSo, hinv, ?_⟩ + exact herr.trans (add_le_add le_rfl (mul_le_mul_of_nonneg_right hcard htau)) + +end Erdos3.RationalFilteredNilmanifold.Niltest + +end + +section + +namespace Erdos3 + +open Module +open scoped Classical + +variable {V J : Type*} [AddCommGroup V] [Module ℚ V] + +def frequencyCodeKernel (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) + {D : ℕ} (code : Fin D → Option J) : Submodule ℚ V := + finiteFrequencyKernel P (fun i => (code i).elim 0 eta) (List.finRange D) + +theorem mem_frequencyCodeKernel (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) + {D : ℕ} (code : Fin D → Option J) (v : V) : + v ∈ frequencyCodeKernel P eta code ↔ v ∈ P ∧ + ∀ i j, code i = some j → eta j v = 0 := by + simp only [frequencyCodeKernel, mem_finiteFrequencyKernel, List.mem_finRange, forall_true_left] + refine and_congr_right (fun _ => ?_) + constructor + · intro h i j hij + simpa only [hij, Option.elim_some] using h i + · intro h i + cases hi : code i with + | none => simp + | some j => simpa only [Option.elim_some] using h i j hi + +theorem exists_frequency_basis_code [FiniteDimensional ℚ V] + (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) (js : List J) : + ∃ code : Fin (finrank ℚ P) → Option J, + (∀ i j, code i = some j → j ∈ js) ∧ + finiteFrequencyKernel P eta js = frequencyCodeKernel P eta code := by + obtain ⟨m, hm, index, hindex, hlin, hspan⟩ := exists_restricted_frequency_basis P eta js + let code : Fin (finrank ℚ P) → Option J := fun i => + if hi : i.val < m then some (index ⟨i.val, hi⟩) else none + have hkernel : finiteFrequencyKernel P eta js = + finiteFrequencyKernel P (fun i => eta (index i)) (List.finRange m) := by + apply finiteFrequencyKernel_eq_of_span_eq + rw [restrictedFrequencySpan_finRange] + exact hspan.symm + refine ⟨code, ?_, ?_⟩ + · intro i j hij + dsimp only [code] at hij + split_ifs at hij with hi + · cases hij + exact hindex _ + · rw [hkernel] + ext v + rw [mem_finiteFrequencyKernel, mem_frequencyCodeKernel] + simp only [List.mem_finRange, forall_true_left] + refine and_congr_right (fun _ => ?_) + constructor + · intro h i j hij + dsimp only [code] at hij + split_ifs at hij with hi + · cases hij + exact h _ + · intro h i + let k : Fin (finrank ℚ P) := ⟨i.val, lt_of_lt_of_le i.isLt hm⟩ + apply h k (index i) + simp only [code, k, i.isLt, dite_true] + +theorem exists_common_frequency_kernel [FiniteDimensional ℚ V] + {Ω : Type*} [Fintype Ω] [Fintype J] + (law : FiniteProbabilityWeights Ω) (productive : Finset Ω) + (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) (js : Ω → List J) : + ∃ (code : Fin (finrank ℚ P) → Option J) (retained : Finset Ω), + retained ⊆ productive ∧ + law.mass productive / (Fintype.card J + 1) ^ finrank ℚ P ≤ law.mass retained ∧ + ∀ a ∈ retained, (∀ i j, code i = some j → j ∈ js a) ∧ + finiteFrequencyKernel P eta (js a) = frequencyCodeKernel P eta code := by + choose code hmem hkernel using fun a => exists_frequency_basis_code P eta (js a) + obtain ⟨c, hc⟩ := law.exists_code_fiber_mass productive code + refine ⟨c, productive.filter (fun a => code a = c), Finset.filter_subset _ _, ?_, ?_⟩ + · have hcard : (Fintype.card (Fin (finrank ℚ P) → Option J) : ℝ) = + (Fintype.card J + 1 : ℝ) ^ finrank ℚ P := by simp + rw [hcard] at hc + convert hc using 1; try rfl + congr 1 + ext a + simp only [Finset.mem_filter] + · intro a ha + have he := (Finset.mem_filter.mp ha).2 + rw [← he] + exact ⟨hmem a, hkernel a⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +theorem exists_restricted_frequency_basis_real_kernel + {V J : Type*} [AddCommGroup V] [Module ℚ V] [FiniteDimensional ℚ V] + (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) (js : List J) : + ∃ m : ℕ, m ≤ finrank ℚ P ∧ ∃ indices : Fin m → J, + (∀ i, indices i ∈ js) ∧ + LinearIndependent ℚ (fun i => (eta (indices i)).comp P.subtype) ∧ + ∀ x ∈ P.baseChange ℝ, + (∀ j ∈ js, realifyFunctional (eta j) x = 0) ↔ + ∀ i, realifyFunctional (eta (indices i)) x = 0 := by + obtain ⟨m, hm, indices, hmem, hlin, hspan⟩ := exists_restricted_frequency_basis P eta js + have hK : finiteFrequencyKernel P eta js = + finiteFrequencyKernel P (fun i => eta (indices i)) (List.finRange m) := by + apply finiteFrequencyKernel_eq_of_span_eq + rw [restrictedFrequencySpan_finRange] + exact hspan.symm + refine ⟨m, hm, indices, hmem, hlin, ?_⟩ + intro x hx + constructor + · intro h + have hk := (mem_real_finiteFrequencyKernel P eta js x).mpr ⟨hx, h⟩ + rw [hK] at hk + have hsel := (mem_real_finiteFrequencyKernel P (fun i => eta (indices i)) (List.finRange m) x).mp hk + exact fun i => hsel.2 i (by simp) + · intro h + have hk := (mem_real_finiteFrequencyKernel P (fun i => eta (indices i)) (List.finRange m) x).mpr + ⟨hx, fun i _ => h i⟩ + rw [← hK] at hk + exact ((mem_real_finiteFrequencyKernel P eta js x).mp hk).2 + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.Niltest + +open Module CircleFourier +open scoped TensorProduct BigOperators + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} + +theorem exists_bounded_positive_fourier_basis (T : D.Niltest (fun _ : Unit => 1)) + {p rho tau B : ℝ} (hp : 0 ≤ p) (hT : T.UnitIntervalValued) (hTc : T.ComplexityLE p) + (hcap : T.normBound ≤ 1) (hrho : 0 < rho) (hrhop : rho⁻¹ ≤ Real.exp p) + (htau : 0 ≤ tau) (hB : 0 ≤ B) {N : ℕ} [NeZero N] + (weight : ZMod N → ℂ) (hweight : ∀ x, ‖weight x‖ ≤ B) : + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (eta : J → L →ₗ[ℚ] ℚ) (U : J → D.Niltest (fun _ : Unit => 1)) + (S : D.Niltest (fun _ : Unit => 1)) (m : ℕ) (indices : Fin m → J), + (Fintype.card J : ℝ) ≤ Real.exp (verticalDecompositionBudget p) ∧ + (∀ j i, rationalLogHeight (eta j (D.basis i)) ≤ verticalDecompositionBudget p) ∧ + (∀ j, (U j).ComplexityLE p ∧ (U j).orbit = T.orbit ∧ (U j).normBound ≤ 1) ∧ + (∀ j z, z ∈ D.filtration.realification.subgroup s → ∀ x, + (U j).observable (z • x) = + character ((realifyFunctional (eta j) z.coord : ℝ) : CircleFourier.Circle) * (U j).observable x) ∧ + m ≤ d ∧ + (∀ i, tau < ‖𝔼 n, weight n * (U (indices i)).evalCyclic N (fun _ => n)‖) ∧ + LinearIndependent ℚ (fun i => (eta (indices i)).comp (D.filtration.layer s).subtype) ∧ + S.UnitIntervalValued ∧ S.ComplexityLE p ∧ S.orbit = T.orbit ∧ + (∀ z : D.RealGroup, z ∈ D.filtration.realification.subgroup s → + (∀ i, realifyFunctional (eta (indices i)) z.coord = 0) → + ∀ x, S.observable (z • x) = S.observable x) ∧ + ‖(𝔼 n, weight n * T.evalCyclic N (fun _ => n)) - + (𝔼 n, weight n * S.evalCyclic N (fun _ => n))‖ ≤ + 2 * B * rho + Real.exp (verticalDecompositionBudget p) * tau := by + classical + let : FiniteDimensional ℚ L := D.basis.finiteDimensional_of_finite + obtain ⟨J, inst, eta, U, hcard, hheight, hU, hvertical, _, happrox, _⟩ := + T.exists_vertical_decomposition_preserving_bounds hp hTc hrho hrhop + let := inst + obtain ⟨S, hS, hSc, hSo, hinv, herr⟩ := T.exists_positive_frequency_projection_of_decomposition + hT hTc eta U (fun j => (hU j).2.1) hvertical weight hB htau hweight + (fun x => by simpa only [norm_sub_rev] using happrox x) + let active : Finset J := Finset.univ.filter + (fun j => tau < ‖𝔼 n, weight n * (U j).evalCyclic N (fun _ => n)‖) + let js := active.toList + obtain ⟨m, hm, indices, hindices, hlin, hkernel⟩ := + exists_restricted_frequency_basis_real_kernel (D.filtration.layer s) eta js + have hmd : m ≤ d := hm.trans (by + simpa only [finrank_eq_card_basis D.basis, Fintype.card_fin] using (D.filtration.layer s).finrank_le) + refine ⟨J, inst, eta, U, S, m, indices, hcard, hheight, ?_, hvertical, hmd, ?_, hlin, + hS, hSc, hSo, ?_, ?_⟩ + · intro j + refine ⟨(hU j).1, (hU j).2.1, ?_⟩ + rw [(hU j).2.2.1] + exact hcap + · intro i + simpa only [js, active, Finset.mem_toList, Finset.mem_filter, Finset.mem_univ, true_and] + using hindices i + · intro z hz hbasis x + apply hinv z hz _ x + have hfull := (hkernel z.coord hz).mpr hbasis + intro j hj + exact hfull j (by simpa only [js, active, Finset.mem_toList, Finset.mem_filter, + Finset.mem_univ, true_and] using hj) + · exact herr.trans (add_le_add le_rfl (mul_le_mul_of_nonneg_right hcard htau)) + +end Erdos3.RationalFilteredNilmanifold.Niltest + +end + +section + +namespace Erdos3 + +open Module +open scoped Classical TensorProduct + +variable {V J : Type*} [AddCommGroup V] [Module ℚ V] + +def frequencyCodeIndices {D : ℕ} (code : Fin D → Option J) : List J := + (List.ofFn code).filterMap id + +theorem mem_frequencyCodeIndices {D : ℕ} (code : Fin D → Option J) (j : J) : + j ∈ frequencyCodeIndices code ↔ ∃ i, code i = some j := by + simp only [frequencyCodeIndices, List.mem_filterMap, List.mem_ofFn] + constructor + · rintro ⟨x, ⟨i, rfl⟩, hx⟩ + exact ⟨i, hx⟩ + · rintro ⟨i, hi⟩ + exact ⟨code i, ⟨i, rfl⟩, hi⟩ + +theorem finiteFrequencyKernel_codeIndices (P : Submodule ℚ V) + (eta : J → V →ₗ[ℚ] ℚ) {D : ℕ} (code : Fin D → Option J) : + finiteFrequencyKernel P eta (frequencyCodeIndices code) = frequencyCodeKernel P eta code := by + ext x + rw [mem_finiteFrequencyKernel, mem_frequencyCodeKernel] + refine and_congr_right (fun _ => ?_) + constructor + · intro h i j hij + exact h j ((mem_frequencyCodeIndices code j).mpr ⟨i, hij⟩) + · intro h j hj + obtain ⟨i, hi⟩ := (mem_frequencyCodeIndices code j).mp hj + exact h i j hi + +theorem restrictedFrequencySpan_eq_of_kernel_eq [FiniteDimensional ℚ V] + {I : Type*} (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) (js : List J) + (xi : I → V →ₗ[ℚ] ℚ) (is : List I) + (hker : finiteFrequencyKernel P eta js = finiteFrequencyKernel P xi is) : + restrictedFrequencySpan P eta js = restrictedFrequencySpan P xi is := by + have hco : (restrictedFrequencySpan P eta js).dualCoannihilator = + (restrictedFrequencySpan P xi is).dualCoannihilator := by + ext x + rw [mem_restrictedFrequencySpan_coannihilator, + mem_restrictedFrequencySpan_coannihilator, hker] + calc + _ = (restrictedFrequencySpan P eta js).dualCoannihilator.dualAnnihilator := + Subspace.dualCoannihilator_dualAnnihilator_eq.symm + _ = (restrictedFrequencySpan P xi is).dualCoannihilator.dualAnnihilator := by rw [hco] + _ = _ := Subspace.dualCoannihilator_dualAnnihilator_eq + +theorem exists_common_significant_frequency_basis [FiniteDimensional ℚ V] + {H : Type*} [Fintype H] [Fintype J] + (law : FiniteProbabilityWeights H) (productive : Finset H) + (hproductive : 0 < law.mass productive) + (P : Submodule ℚ V) (eta : J → V →ₗ[ℚ] ℚ) (significant : H → Finset J) + (D : ℕ) (hD : finrank ℚ P ≤ D) : + ∃ (m : ℕ) (indices : Fin m → J) (retained : Finset H), + m ≤ finrank ℚ P ∧ m ≤ D ∧ + LinearIndependent ℚ (fun i => (eta (indices i)).comp P.subtype) ∧ + retained ⊆ productive ∧ + law.mass productive / (Fintype.card J + 1 : ℝ) ^ D ≤ law.mass retained ∧ + 0 < law.mass retained ∧ + ∀ h ∈ retained, + (∀ i, indices i ∈ significant h) ∧ + restrictedFrequencySpan P eta (significant h).toList = + Submodule.span ℚ (Set.range (fun i => (eta (indices i)).comp P.subtype)) ∧ + finiteFrequencyKernel P eta (significant h).toList = + finiteFrequencyKernel P (fun i => eta (indices i)) (List.finRange m) ∧ + ∀ x ∈ P.baseChange ℝ, + (∀ j ∈ significant h, realifyFunctional (eta j) x = 0) ↔ + ∀ i, realifyFunctional (eta (indices i)) x = 0 := by + obtain ⟨code, retained, hsub, hmass, hfixed⟩ := + exists_common_frequency_kernel law productive P eta (fun h => (significant h).toList) + obtain ⟨m, hm, indices, hindices, hlin, hspan⟩ := + exists_restricted_frequency_basis P eta (frequencyCodeIndices code) + have hkernel : finiteFrequencyKernel P eta (frequencyCodeIndices code) = + finiteFrequencyKernel P (fun i => eta (indices i)) (List.finRange m) := by + apply finiteFrequencyKernel_eq_of_span_eq + rw [restrictedFrequencySpan_finRange] + exact hspan.symm + have hmass' : law.mass productive / (Fintype.card J + 1 : ℝ) ^ D ≤ + law.mass retained := by + apply le_trans _ hmass + apply div_le_div_of_nonneg_left (law.mass_nonneg productive) (by positivity) + exact pow_le_pow_right₀ (le_add_of_nonneg_left (Nat.cast_nonneg _)) hD + refine ⟨m, indices, retained, hm, hm.trans hD, hlin, hsub, hmass', + (div_pos hproductive (by positivity)).trans_le hmass', ?_⟩ + intro h hh + have hk : finiteFrequencyKernel P eta (significant h).toList = + finiteFrequencyKernel P (fun i => eta (indices i)) (List.finRange m) := by + rw [(hfixed h hh).2, ← finiteFrequencyKernel_codeIndices] + exact hkernel + refine ⟨?_, ?_, hk, ?_⟩ + · intro i + obtain ⟨k, hk⟩ := (mem_frequencyCodeIndices code (indices i)).mp (hindices i) + exact Finset.mem_toList.mp ((hfixed h hh).1 k (indices i) hk) + · have hs := restrictedFrequencySpan_eq_of_kernel_eq P eta (significant h).toList + (fun i => eta (indices i)) (List.finRange m) hk + simpa only [restrictedFrequencySpan_finRange] using hs + · intro x hx + have heq : x ∈ (finiteFrequencyKernel P eta (significant h).toList).baseChange ℝ ↔ + x ∈ (finiteFrequencyKernel P (fun i => eta (indices i)) (List.finRange m)).baseChange ℝ := by + rw [hk] + simpa only [mem_real_finiteFrequencyKernel, hx, true_and, + Finset.mem_toList, List.mem_finRange, forall_true_left] using heq + +end Erdos3 + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.Niltest + +open Module CircleFourier +open scoped TensorProduct BigOperators + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} + +theorem exists_positive_fourier_projection_basis (T : D.Niltest (fun _ : Unit => 1)) + {p rho tau B : ℝ} (hp : 0 ≤ p) (hT : T.UnitIntervalValued) (hTc : T.ComplexityLE p) + (hrho : 0 < rho) (hrhop : rho⁻¹ ≤ Real.exp p) (htau : 0 ≤ tau) (hB : 0 ≤ B) + {N : ℕ} [NeZero N] (weight : ZMod N → ℂ) (hweight : ∀ x, ‖weight x‖ ≤ B) : + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (eta : J → L →ₗ[ℚ] ℚ) (U : J → D.Niltest (fun _ : Unit => 1)) + (S : D.Niltest (fun _ : Unit => 1)) (m : ℕ) (indices : Fin m → J), + (Fintype.card J : ℝ) ≤ Real.exp (verticalDecompositionBudget p) ∧ + (∀ j i, rationalLogHeight (eta j (D.basis i)) ≤ verticalDecompositionBudget p) ∧ + (∀ j, (U j).ComplexityLE p ∧ (U j).orbit = T.orbit) ∧ + (∀ j (z : D.RealGroup), z ∈ D.filtration.realification.subgroup s → ∀ x, + (U j).observable (z • x) = + character ((realifyFunctional (eta j) z.coord : ℝ) : CircleFourier.Circle) * (U j).observable x) ∧ + m ≤ d ∧ + (∀ i, tau < ‖𝔼 n, weight n * (U (indices i)).evalCyclic N (fun _ => n)‖) ∧ + LinearIndependent ℚ (fun i => (eta (indices i)).comp (D.filtration.layer s).subtype) ∧ + S.UnitIntervalValued ∧ S.ComplexityLE p ∧ S.orbit = T.orbit ∧ + (∀ z : D.RealGroup, z ∈ D.filtration.realification.subgroup s → + (∀ i, realifyFunctional (eta (indices i)) z.coord = 0) → + ∀ x, S.observable (z • x) = S.observable x) ∧ + ‖(𝔼 n, weight n * T.evalCyclic N (fun _ => n)) - + (𝔼 n, weight n * S.evalCyclic N (fun _ => n))‖ ≤ + 2 * B * rho + Real.exp (verticalDecompositionBudget p) * tau := by + classical + let : FiniteDimensional ℚ L := D.basis.finiteDimensional_of_finite + obtain ⟨J, inst, eta, U, S, hcard, hheight, hU, hvertical, _, hS, hSc, hSo, hinv, herr⟩ := + T.exists_positive_fourier_projection hp hT hTc hrho hrhop htau hB weight hweight + let := inst + let active : Finset J := Finset.univ.filter + (fun j => tau < ‖𝔼 n, weight n * (U j).evalCyclic N (fun _ => n)‖) + let js := active.toList + obtain ⟨m, hm, indices, hindices, hlin, hkernel⟩ := + exists_restricted_frequency_basis_real_kernel (D.filtration.layer s) eta js + have hmd : m ≤ d := hm.trans (by + simpa only [finrank_eq_card_basis D.basis, Fintype.card_fin] using (D.filtration.layer s).finrank_le) + refine ⟨J, inst, eta, U, S, m, indices, hcard, hheight, hU, hvertical, hmd, ?_, hlin, + hS, hSc, hSo, ?_, herr⟩ + · intro i + simpa only [js, active, Finset.mem_toList, Finset.mem_filter, Finset.mem_univ, true_and] + using hindices i + · intro z hz hbasis x + apply hinv z hz _ x + have hfull := (hkernel z.coord hz).mpr hbasis + intro j hj + exact hfull j (by simpa only [js, active, Finset.mem_toList, Finset.mem_filter, + Finset.mem_univ, true_and] using hj) + +end Erdos3.RationalFilteredNilmanifold.Niltest + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +variable {L Y J : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing Y] [LieAlgebra ℚ Y] {s n : ℕ} + (F : NilpotentLieFiltration L s) (π : L →ₗ⁅ℚ⁆ Y) + (eta : J → L →ₗ[ℚ] ℚ) (code : Fin n → Option J) + +theorem pivotAnnihilatorIdeal_codeIndices + (hK : frequencyCodeKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta code ≤ + F.layer s) : + F.pivotAnnihilatorIdeal π eta (frequencyCodeIndices code) = + F.topSubspaceIdeal + (frequencyCodeKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta code) hK := by + ext x + change x ∈ finiteFrequencyKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta + (frequencyCodeIndices code) ↔ + x ∈ frequencyCodeKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta code + rw [finiteFrequencyKernel_codeIndices] + +theorem quotientLie_heq_of_ideal_eq {I I' : LieIdeal ℚ L} (h : I = I') + {t : ℕ} (hI : F.layer (t + 1) ≤ I.toSubmodule) + (hI' : F.layer (t + 1) ≤ I'.toSubmodule) : + HEq (F.quotientLie I hI) (F.quotientLie I' hI') := by + subst I' + rfl + +theorem pivotQuotientFiltration_codeIndices_heq + (hK : frequencyCodeKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta code ≤ + F.layer s) + (hI : F.layer (s + 1) ≤ (F.topSubspaceIdeal + (frequencyCodeKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta code) hK).toSubmodule) : + HEq (F.pivotQuotientFiltration π eta (frequencyCodeIndices code)) + (F.quotientLie (F.topSubspaceIdeal + (frequencyCodeKernel (F.layer s ⊓ LinearMap.ker π.toLinearMap) eta code) hK) hI) := + F.quotientLie_heq_of_ideal_eq (F.pivotAnnihilatorIdeal_codeIndices π eta code hK) _ hI + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PlateauFourierMode.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PlateauFourierMode.lean new file mode 100644 index 0000000000000000000000000000000000000000..94e053585cb4e9a54ee821efd98213847c0945b0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PlateauFourierMode.lean @@ -0,0 +1,124 @@ +import OAI.Combinatorics.Progressions.Estimates.BufferedSiteExpansion +import OAI.Combinatorics.Progressions.Fourier.RectangularGridCharacter +import OAI.Combinatorics.Progressions.Geometry.NormalizedSupportPlateau + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +variable {J : Type*} [Fintype J] + +noncomputable def realLinearCharacter (ω x : J → ℝ) : ℂ := + CircleFourier.character ((∑ j, ω j * x j : ℝ) : CircleFourier.Circle) + +theorem realLinearCharacter_norm (ω x : J → ℝ) : ‖realLinearCharacter ω x‖ = 1 := + CircleFourier.norm_character _ + +theorem realLinearCharacter_lipschitz (ω : J → ℝ) (W : ℝ≥0) + (hW : ∀ j, |ω j| ≤ W) : + LipschitzWith (CircleFourier.characterLipConstant * (Fintype.card J * W)) + (realLinearCharacter ω) := by + have hlin : LipschitzWith (Fintype.card J * W) (fun x : J → ℝ => ∑ j, ω j * x j) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Real.dist_eq, ← Finset.sum_sub_distrib] + calc + _ ≤ ∑ j, |ω j * x j - ω j * y j| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _j : J, (W : ℝ) * dist x y := by + apply Finset.sum_le_sum + intro j _ + rw [← mul_sub, abs_mul] + exact mul_le_mul (hW j) (by simpa only [Real.dist_eq] using dist_le_pi_dist x y j) + (abs_nonneg _) W.coe_nonneg + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, + NNReal.coe_mul, NNReal.coe_natCast]; ring + have hquot : LipschitzWith 1 (fun x : ℝ => (x : CircleFourier.Circle)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [dist_eq_norm, ← AddCircle.coe_sub, NNReal.coe_one, one_mul, dist_eq_norm] + exact QuotientAddGroup.norm_mk_le_norm + have hc := CircleFourier.character_lipschitz.comp (hquot.comp hlin) + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [one_mul, Function.comp_def, realLinearCharacter] using hc.dist_le_mul x y + +noncomputable def plateauFourierMode (H : ℝ) (ω x : J → ℝ) : ℂ := + (normalizedSupportPlateau H x : ℂ) * realLinearCharacter ω x + +theorem plateauFourierMode_norm (H : ℝ) (ω x : J → ℝ) : ‖plateauFourierMode H ω x‖ ≤ 1 := by + rw [plateauFourierMode, norm_mul, realLinearCharacter_norm, mul_one, + Complex.norm_real, Real.norm_of_nonneg (normalizedSupportPlateau_range H x).1] + exact (normalizedSupportPlateau_range H x).2 + +theorem plateauFourierMode_lipschitz (H : ℝ) (ω : J → ℝ) (W : ℝ≥0) + (hW : ∀ j, |ω j| ≤ W) : + LipschitzWith (CircleFourier.characterLipConstant * (Fintype.card J * W) + 4) + (plateauFourierMode H ω) := by + have hp : LipschitzWith 4 (fun x : J → ℝ => (normalizedSupportPlateau H x : ℂ)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [dist_eq_norm, ← Complex.ofReal_sub, Complex.norm_real] using + (normalizedSupportPlateau_lipschitz (J := J) H).dist_le_mul x y + have hc := lipschitz_mul_of_bounds (fun x : J → ℝ => (normalizedSupportPlateau H x : ℂ)) + (realLinearCharacter ω) hp (realLinearCharacter_lipschitz ω W hW) + (Bf := 1) (Bg := 1) + (fun x => by + rw [Complex.norm_real, Real.norm_of_nonneg (normalizedSupportPlateau_range H x).1] + exact (normalizedSupportPlateau_range H x).2) + (fun x => (realLinearCharacter_norm ω x).le) + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [one_mul, plateauFourierMode] using hc.dist_le_mul x y + +noncomputable def rationalGridPhase (D : ℕ) [NeZero D] (a : J → ℤ) (r : J → ZMod D) : ℂ := + CircleFourier.character (ZMod.toAddCircle (∑ j, (a j : ZMod D) * r j)) + +theorem rationalGridPhase_norm (D : ℕ) [NeZero D] (a : J → ℤ) (r : J → ZMod D) : + ‖rationalGridPhase D a r‖ = 1 := CircleFourier.norm_character _ + +theorem rationalGridPhase_intCast (D : ℕ) [NeZero D] (a z : J → ℤ) : + rationalGridPhase D a (integerGridResidue D z) = + realLinearCharacter (fun j => (a j : ℝ) / D) (fun j => (z j : ℝ)) := by + have he : (∑ j, (a j : ZMod D) * (z j : ZMod D)) = ((∑ j, a j * z j : ℤ) : ZMod D) := by + simp only [Int.cast_sum, Int.cast_mul] + unfold rationalGridPhase integerGridResidue realLinearCharacter + rw [he, ZMod.toAddCircle_intCast] + congr 2 + simp only [Int.cast_sum, Int.cast_mul, Finset.sum_div] + apply Finset.sum_congr rfl + intro j _ + ring + +theorem plateau_grid_character_split (H : ℝ) {K M D : ℕ} [NeZero M] [NeZero D] + (hK : 0 < K) (k : J → Fin M) (a : J → ℤ) (ω : J → ℝ) + (hfreq : ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ω j / K) + (shift z : J → ℤ) : + (normalizedSupportPlateau H (fun j => ((z j : ℝ) - shift j) / K) : ℂ) * + (rectangularGridCharacter M k shift * star (rectangularGridCharacter M k z)) = + rationalGridPhase D a (integerGridResidue D (shift - z)) * + plateauFourierMode H (fun j => -ω j) (fun j => ((z j : ℝ) - shift j) / K) := by + have hK0 : (K : ℝ) ≠ 0 := (Nat.cast_pos.mpr hK).ne' + have hphase : (∑ j, ((k j).val : ℝ) / M * ((shift j : ℝ) - z j)) = + (∑ j, (a j : ℝ) / D * ((shift j : ℝ) - z j)) + + ∑ j, -ω j * (((z j : ℝ) - shift j) / K) := by + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro j _ + rw [hfreq j] + field_simp [hK0] + ring + rw [← rectangularGridCharacter_sub, rectangularGridCharacter_eq, + rationalGridPhase_intCast, plateauFourierMode] + simp only [realLinearCharacter, Pi.sub_apply, Int.cast_sub] + rw [hphase, AddCircle.coe_add, CircleFourier.character_add] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialCharacterRowPhase.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialCharacterRowPhase.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b646a5a8d0edcffab5cfd44637ce17156fd0572 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialCharacterRowPhase.lean @@ -0,0 +1,65 @@ +import Mathlib.RingTheory.MvPolynomial.Homogeneous + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators Classical + +variable {I V R S : Type*} [Fintype I] [CommRing R] [CommRing S] + +noncomputable def polynomialCharacterRow (row : I → R) (F : I → MvPolynomial V R) : + MvPolynomial V R := ∑ i, C (row i) * F i + +theorem polynomialCharacterRow_totalDegree_le (row : I → R) + (F : I → MvPolynomial V R) {d : ℕ} (hF : ∀ i, (F i).totalDegree ≤ d) : + (polynomialCharacterRow row F).totalDegree ≤ d := by + unfold polynomialCharacterRow + apply totalDegree_finsetSum_le + intro i _ + exact (totalDegree_mul _ _).trans (by simpa using hF i) + +theorem polynomialCharacterRow_eval (row : I → R) (F : I → MvPolynomial V R) + (x : V → R) : + eval x (polynomialCharacterRow row F) = ∑ i, row i * eval x (F i) := by + simp only [polynomialCharacterRow, map_sum, map_mul, eval_C] + +theorem polynomialCharacterRow_homogeneousComponent (row : I → R) + (F : I → MvPolynomial V R) (d : ℕ) : + homogeneousComponent d (polynomialCharacterRow row F) = + polynomialCharacterRow row (fun i => homogeneousComponent d (F i)) := by + simp only [polynomialCharacterRow, map_sum, homogeneousComponent_C_mul] + +theorem polynomialCharacterRow_map (φ : R →+* S) (row : I → R) + (F : I → MvPolynomial V R) : + map φ (polynomialCharacterRow row F) = + polynomialCharacterRow (fun i => φ (row i)) (fun i => map φ (F i)) := by + simp only [polynomialCharacterRow, map_sum, map_mul, map_C] + +theorem map_homogeneousComponent (φ : R →+* S) (d : ℕ) (P : MvPolynomial V R) : + map φ (homogeneousComponent d P) = homogeneousComponent d (map φ P) := by + ext e + simp only [coeff_map, coeff_homogeneousComponent] + split_ifs <;> simp + +theorem map_homogeneousComponent_polynomialCharacterRow (φ : R →+* S) + (row : I → R) (F : I → MvPolynomial V R) (d : ℕ) : + map φ (homogeneousComponent d (polynomialCharacterRow row F)) = + ∑ i, C (φ (row i)) * map φ (homogeneousComponent d (F i)) := by + rw [polynomialCharacterRow_homogeneousComponent, polynomialCharacterRow_map] + rfl + +theorem map_homogeneousComponent_row_sum (φ : R →+* S) + (row : I → R) (F : I → MvPolynomial V R) (d : ℕ) : + map φ (homogeneousComponent d (∑ i, C (row i) * F i)) = + ∑ i, C (φ (row i)) * map φ (homogeneousComponent d (F i)) := + map_homogeneousComponent_polynomialCharacterRow φ row F d + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialSpectrumAccuracy.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialSpectrumAccuracy.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ae7739be5b98cc5eb5af192ecb51c983c6cce4a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialSpectrumAccuracy.lean @@ -0,0 +1,195 @@ +import OAI.Combinatorics.Progressions.Fourier.FiniteSpectrumCutoff +import OAI.Combinatorics.Progressions.Polynomial.IndependentPhaseCoefficients + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem product_spectrumTail_levels {B K : Type*} [Fintype B] [Fintype K] [DecidableEq K] + (c : B → K → ℂ) (S : ℕ → Finset K) (ζ : ℕ → ℝ) (n : ℕ) + (hζ : ∀ i ≤ n, 0 ≤ ζ i) + (hsmall : ∀ i ≤ n, ∀ b k, k ∉ S i → ‖c b k‖ ≤ ζ i) : + spectrumTail (S 0) (fun k => ‖∏ b, c b k‖) ≤ + (∑ i ∈ Finset.range n, (S (i + 1)).card * (ζ i) ^ Fintype.card B) + + Fintype.card K * (ζ n) ^ Fintype.card B := by + apply spectrumTail_finite_levels S _ (fun _ => norm_nonneg _) _ n + (fun i hi => pow_nonneg (hζ i hi) _) + intro i hi k hk + exact norm_product_coefficients_le _ (fun b => hsmall i hi b k hk) + +theorem product_spectrum_truncation_levels {B K : Type*} [Fintype B] [Fintype K] [DecidableEq K] + (c : B → K → ℂ) (ψ : K → ℂ) (hψ : ∀ k, ‖ψ k‖ ≤ 1) + (S : ℕ → Finset K) (ζ : ℕ → ℝ) (n : ℕ) + (hζ : ∀ i ≤ n, 0 ≤ ζ i) + (hsmall : ∀ i ≤ n, ∀ b k, k ∉ S i → ‖c b k‖ ≤ ζ i) : + ‖(∑ k, (∏ b, c b k) * ψ k) - ∑ k ∈ S 0, (∏ b, c b k) * ψ k‖ ≤ + (∑ i ∈ Finset.range n, (S (i + 1)).card * (ζ i) ^ Fintype.card B) + + Fintype.card K * (ζ n) ^ Fintype.card B := + (finite_series_truncation_le (S 0) _ ψ hψ).trans + (product_spectrumTail_levels c S ζ n hζ hsmall) + +theorem product_spectrumTail_geometric {B K : Type*} [Fintype B] [Fintype K] [DecidableEq K] + (c : B → K → ℂ) (S : ℕ → Finset K) (ζ : ℕ → ℝ) (n : ℕ) + (hζ : ∀ i ≤ n, 0 ≤ ζ i) + (hsmall : ∀ i ≤ n, ∀ b k, k ∉ S i → ‖c b k‖ ≤ ζ i) + {C : ℝ} (hC : 0 ≤ C) + (hlevel : ∀ i < n, (S (i + 1)).card * (ζ i) ^ Fintype.card B ≤ C * (1 / 2 : ℝ) ^ i) : + spectrumTail (S 0) (fun k => ‖∏ b, c b k‖) ≤ + 2 * C + Fintype.card K * (ζ n) ^ Fintype.card B := by + apply spectrumTail_finite_geometric S _ (fun _ => norm_nonneg _) _ n + (fun i hi => pow_nonneg (hζ i hi) _) _ hC hlevel + intro i hi k hk + exact norm_product_coefficients_le _ (fun b => hsmall i hi b k hk) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem dyadic_power_ratio {a b : ℕ} (hab : a + 1 ≤ b) (i : ℕ) : + (2 : ℝ) ^ (a * i) / 2 ^ (b * i) ≤ (1 / 2 : ℝ) ^ i := by + rw [one_div_pow] + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + rw [one_mul, ← pow_add] + apply pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) + simpa only [Nat.add_mul, Nat.one_mul] using Nat.mul_le_mul_right i hab + +theorem dyadic_level_mass_bound {a b i : ℕ} {C ζ count : ℝ} + (hab : a + 1 ≤ b) (hC : 0 ≤ C) (hζ : 0 ≤ ζ) + (hcount : count ≤ C * ((2 : ℝ) ^ a) ^ i) : + count * (ζ / 2 ^ i) ^ b ≤ (C * ζ ^ b) * (1 / 2 : ℝ) ^ i := by + calc + _ ≤ (C * ((2 : ℝ) ^ a) ^ i) * (ζ / 2 ^ i) ^ b := + mul_le_mul_of_nonneg_right hcount (by positivity) + _ = (C * ζ ^ b) * ((2 : ℝ) ^ (a * i) / 2 ^ (b * i)) := by + rw [div_pow, ← pow_mul, ← pow_mul] + rw [Nat.mul_comm i b] + ring + _ ≤ _ := mul_le_mul_of_nonneg_left (dyadic_power_ratio hab i) (by positivity) + +theorem product_spectrumTail_dyadic {B K : Type*} [Fintype B] [Fintype K] [DecidableEq K] + (c : B → K → ℂ) (S : ℕ → Finset K) (n a : ℕ) {C ζ : ℝ} + (hC : 0 ≤ C) (hζ : 0 ≤ ζ) (hab : a + 1 ≤ Fintype.card B) + (hcount : ∀ i < n, ((S (i + 1)).card : ℝ) ≤ C * ((2 : ℝ) ^ a) ^ i) + (hsmall : ∀ i ≤ n, ∀ b k, k ∉ S i → ‖c b k‖ ≤ ζ / 2 ^ i) : + spectrumTail (S 0) (fun k => ‖∏ b, c b k‖) ≤ + 2 * (C * ζ ^ Fintype.card B) + Fintype.card K * (ζ / 2 ^ n) ^ Fintype.card B := by + apply product_spectrumTail_geometric c S (fun i => ζ / 2 ^ i) n + (fun _ _ => by positivity) hsmall (by positivity) + intro i hi + exact dyadic_level_mass_bound hab hC hζ (hcount i hi) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem cutoff_power_mass_bound {N T δ ζ : ℝ} {p b : ℕ} + (hT : 0 ≤ T) (hδ : 0 ≤ δ) (hδζ : δ ≤ ζ) (hpb : p ≤ b) + (hcutoff : N * δ ^ p ≤ T) : N * δ ^ b ≤ T * ζ ^ (b - p) := by + have he : δ ^ b = δ ^ p * δ ^ (b - p) := by + rw [← pow_add, Nat.add_sub_of_le hpb] + rw [he, ← mul_assoc] + exact (mul_le_mul_of_nonneg_right hcutoff (pow_nonneg hδ _)).trans + (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hδ hδζ _) hT) + +theorem dyadic_polynomial_count_factor (A ζ : ℝ) (a i : ℕ) : + A * ((2 : ℝ) ^ (i + 1) / ζ) ^ a = (A * (2 / ζ) ^ a) * ((2 : ℝ) ^ a) ^ i := by + simp only [pow_succ', mul_pow, div_pow, ← pow_mul] + rw [Nat.mul_comm i a] + ring + +theorem polynomial_bias_mass_factor {A ζ : ℝ} {a b : ℕ} + (hζ : 0 < ζ) (hab : a ≤ b) : + (A * (2 / ζ) ^ a) * ζ ^ b = A * 2 ^ a * ζ ^ (b - a) := by + rw [div_pow, pow_sub₀ ζ hζ.ne' hab] + ring + +theorem product_spectrumTail_polynomial_cutoff {B K : Type*} + [Fintype B] [Fintype K] [DecidableEq K] + (c : B → K → ℂ) (S : ℕ → Finset K) (n a p : ℕ) {A T ζ : ℝ} + (hA : 0 ≤ A) (hT : 0 ≤ T) (hζ : 0 < ζ) + (hab : a + 1 ≤ Fintype.card B) (hpb : p ≤ Fintype.card B) + (hcount : ∀ i < n, ((S (i + 1)).card : ℝ) ≤ A * (2 ^ (i + 1) / ζ) ^ a) + (hsmall : ∀ i ≤ n, ∀ b k, k ∉ S i → ‖c b k‖ ≤ ζ / 2 ^ i) + (hcutoff : (Fintype.card K : ℝ) * (ζ / 2 ^ n) ^ p ≤ T) : + spectrumTail (S 0) (fun k => ‖∏ b, c b k‖) ≤ + 2 * A * 2 ^ a * ζ ^ (Fintype.card B - a) + T * ζ ^ (Fintype.card B - p) := by + have hc : ∀ i < n, ((S (i + 1)).card : ℝ) ≤ + (A * (2 / ζ) ^ a) * ((2 : ℝ) ^ a) ^ i := by + intro i hi + rw [← dyadic_polynomial_count_factor] + exact hcount i hi + have ht := product_spectrumTail_dyadic c S n a (by positivity) hζ.le hab hc hsmall + rw [polynomial_bias_mass_factor hζ (by omega)] at ht + have hδ : ζ / 2 ^ n ≤ ζ := by + exact div_le_self hζ.le (one_le_pow₀ (by norm_num : (1 : ℝ) ≤ 2)) + have hb := cutoff_power_mass_bound hT (by positivity) hδ hpb hcutoff + exact ht.trans (by nlinarith only [hb]) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_spectrum_retained_level {A T ε : ℝ} (hA : 0 ≤ A) (hT : 0 ≤ T) + (hε : 0 < ε) (a : ℕ) : + ∃ ζ : ℝ, 0 < ζ ∧ ζ ≤ 1 ∧ (2 * A * 2 ^ a + T) * ζ ≤ ε := by + let C := 2 * A * 2 ^ a + T + have hC : 0 ≤ C := by dsimp only [C]; positivity + let ζ := min 1 (ε / (C + 1)) + have hζ : 0 < ζ := lt_min (by norm_num) (div_pos hε (by linarith)) + refine ⟨ζ, hζ, min_le_left _ _, ?_⟩ + change C * ζ ≤ ε + calc + _ ≤ (C + 1) * ζ := mul_le_mul_of_nonneg_right (by linarith) hζ.le + _ ≤ (C + 1) * (ε / (C + 1)) := + mul_le_mul_of_nonneg_left (min_le_right _ _) (by linarith) + _ = ε := by field_simp + +theorem product_spectrumTail_le_accuracy {B K : Type*} + [Fintype B] [Fintype K] [DecidableEq K] + (c : B → K → ℂ) (S : ℕ → Finset K) (n a p : ℕ) {A T ζ ε : ℝ} + (hA : 0 ≤ A) (hT : 0 ≤ T) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hab : a + 1 ≤ Fintype.card B) (hpb : p + 1 ≤ Fintype.card B) + (hcount : ∀ i < n, ((S (i + 1)).card : ℝ) ≤ A * (2 ^ (i + 1) / ζ) ^ a) + (hsmall : ∀ i ≤ n, ∀ b k, k ∉ S i → ‖c b k‖ ≤ ζ / 2 ^ i) + (hcutoff : (Fintype.card K : ℝ) * (ζ / 2 ^ n) ^ p ≤ T) + (haccuracy : (2 * A * 2 ^ a + T) * ζ ≤ ε) : + spectrumTail (S 0) (fun k => ‖∏ b, c b k‖) ≤ ε := by + have ht := product_spectrumTail_polynomial_cutoff c S n a p hA hT hζ hab (by omega) + hcount hsmall hcutoff + have ha : ζ ^ (Fintype.card B - a) ≤ ζ := + pow_le_of_le_one hζ.le hζ1 (by omega) + have hp : ζ ^ (Fintype.card B - p) ≤ ζ := + pow_le_of_le_one hζ.le hζ1 (by omega) + apply ht.trans + calc + _ ≤ 2 * A * 2 ^ a * ζ + T * ζ := by gcongr + _ = (2 * A * 2 ^ a + T) * ζ := by ring + _ ≤ ε := haccuracy + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialTorusDensityIncrement.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialTorusDensityIncrement.lean new file mode 100644 index 0000000000000000000000000000000000000000..36c64e4b21cd159de6fc47894ae8cdac91913f77 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialTorusDensityIncrement.lean @@ -0,0 +1,64 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialProgressionPartition +import OAI.Combinatorics.Progressions.Probability.ProgressionPartitionDensity + +namespace OAI + +section + +namespace Erdos3 + +universe u + +open Polynomial +open scoped NNReal BigOperators + +theorem PolynomialProgressionPartitionBound.density_increment {k p : ℕ} {K : ℝ} + (hpartition : PolynomialProgressionPartitionBound.{u} k K p) + {ι : Type u} [Fintype ι] (P : ι → Polynomial ℝ) (hP : ∀ i, (P i).natDegree ≤ k) + (N H : ℕ) (hH : 0 < H) (hscale : K * ((Fintype.card ι : ℝ) + 1) ≤ H) + (hsize : H ^ (p * (Fintype.card ι + 1) ^ (2 * k)) ≤ N) + (f : ℕ → ℝ) {F : (ι → ℝ) → ℝ} {L : ℝ≥0} (hF : LipschitzWith L F) + (hperiod : ∀ x : ι → ℝ, ∀ m : ι → ℤ, F (fun i => x i + m i) = F x) + (hF01 : ∀ x, F x ∈ Set.Icc (0 : ℝ) 1) (hf : ∀ n < N, f n ∈ Set.Icc (0 : ℝ) 1) + {b σ : ℝ} (hb : b ∈ Set.Icc (0 : ℝ) 1) (hσ : 0 < σ) + (hsmall : 4 * (k : ℝ) * L ≤ σ * H) + (hscore : σ ≤ 𝔼 n : Fin N, (f n.val - b) * F (fun i => (P i).eval (n.val : ℝ))) : + ∃ q a len : ℕ, 0 < q ∧ σ * H / (2 : ℝ) ^ (k + 2) ≤ len ∧ + (∀ n < len, a + q * n < N) ∧ b < 𝔼 n : Fin len, f (a + q * n.val) := by + have hN : 0 < N := (pow_pos hH _).trans_le hsize + have hHR : (0 : ℝ) < H := by exact_mod_cast hH + obtain ⟨Q, c, hcard, hc, herror⟩ := hpartition ι P hP N H hH hscale hsize F L hF hperiod hF01 + have hcount : (Fintype.card Q.Label : ℝ) * H ≤ (2 : ℝ) ^ k * N := by exact_mod_cast hcard + have hsmall' : 4 * ((k : ℝ) * L / H) ≤ σ := by + rw [← mul_div_assoc] + exact (div_le_iff₀ hHR).mpr (by nlinarith) + obtain ⟨q, a, len, hq, hlarge, hinside, hdense⟩ := Q.density_increment hN hH f + (fun n => F (fun i => (P i).eval (n : ℝ))) c hb hσ (by positivity : 0 < (2 : ℝ) ^ k) + hf (fun n _ => hF01 _) (fun i => (hc i).1) (by positivity) hsmall' hcount herror hscore + refine ⟨q, a, len, hq, ?_, hinside, hdense⟩ + have heq : (2 : ℝ) ^ (k + 2) = 4 * (2 : ℝ) ^ k := by rw [pow_add]; ring + simpa only [heq] using hlarge + +theorem polynomial_torus_density_increment (k : ℕ) : + ∃ (K : ℝ) (p : ℕ), 1 ≤ K ∧ 0 < p ∧ + ∀ (ι : Type u) [Fintype ι] (P : ι → Polynomial ℝ), + (∀ i, (P i).natDegree ≤ k) → ∀ (N H : ℕ), 0 < H → + K * ((Fintype.card ι : ℝ) + 1) ≤ H → + H ^ (p * (Fintype.card ι + 1) ^ (2 * k)) ≤ N → + ∀ (f : ℕ → ℝ) (F : (ι → ℝ) → ℝ) (L : ℝ≥0), LipschitzWith L F → + (∀ x : ι → ℝ, ∀ m : ι → ℤ, F (fun i => x i + m i) = F x) → + (∀ x, F x ∈ Set.Icc (0 : ℝ) 1) → (∀ n < N, f n ∈ Set.Icc (0 : ℝ) 1) → + ∀ b σ : ℝ, b ∈ Set.Icc (0 : ℝ) 1 → 0 < σ → 4 * (k : ℝ) * L ≤ σ * H → + σ ≤ (𝔼 n : Fin N, (f n.val - b) * F (fun i => (P i).eval (n.val : ℝ))) → + ∃ q a len : ℕ, 0 < q ∧ σ * H / (2 : ℝ) ^ (k + 2) ≤ len ∧ + (∀ n < len, a + q * n < N) ∧ b < 𝔼 n : Fin len, f (a + q * n.val) := by + obtain ⟨K, p, hK, hp, hpartition⟩ := exists_polynomial_progression_partition_bound.{u} k + refine ⟨K, p, hK, hp, ?_⟩ + intro ι _ P hP N H hH hscale hsize f F L hF hperiod hF01 hf b σ hb hσ hsmall hscore + exact hpartition.density_increment P hP N H hH hscale hsize f hF hperiod hF01 hf hb hσ hsmall hscore + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialWeightedCubeMajorArc.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialWeightedCubeMajorArc.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8f313e1df857e8efe7d213a6fbc74de5aaac45d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PolynomialWeightedCubeMajorArc.lean @@ -0,0 +1,530 @@ +import OAI.Combinatorics.Progressions.Estimates.CoefficientFamilyLocalization +import OAI.Combinatorics.Progressions.Estimates.CoefficientLengthProduct +import OAI.Combinatorics.Progressions.Estimates.UniformStridedBlockEntry +import OAI.Combinatorics.Progressions.Geometry.EmptyCubeCoordinate +import OAI.Combinatorics.Progressions.Lattices.AffineCubeCoordinates +import OAI.Combinatorics.Progressions.Polynomial.PolynomialScalarCubeLength + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +theorem booleanBlockPhase_bounded_stride_major_arc {n : ℕ} {α : Type*} [Fintype α] [DecidableEq α] + (N : Fin (n+1) → ℕ) (s : Fin (n+1) → Option α → ℕ) + (u : Fin (n+1) → Option α → ℝ) (ξ : Finset α → ℝ) + (J : Finset (Finset α)) (hJ : ∀ S ∈ J, S.card ≤ n+1) + (hs : ∀ g r, 0 < s g r) {R : ℝ} (hR : ∀ g r, (s g r : ℝ) ≤ R) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g) + (hbias : ζ ≤ ‖𝔼 x : ∀ g, Option α → Fin (N g), + character ((booleanBlockPhase ξ (fun g r => u g r+(s g r : ℝ)*((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ (multiaffineBiasBudget n ζ*R^(n+1))^J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S-(a S : ℝ)/D| ≤ + multiaffineBiasBudget n ζ / ∏ g, (N g : ℝ) := by + have h := exists_common_rational_approximations (fun S : J => ξ S) + (fun S => booleanBlockPhase_bounded_stride_entry N s u ξ S (hJ S S.property) hs hR hζ hN hbias) + simpa only [Fintype.card_coe] using h + +theorem moderateBooleanBlock_bounded_stride_major_arc {n : ℕ} {α : Type*} [Fintype α] [DecidableEq α] + (N : Fin n → ℕ) (s : Fin n → Option α → ℕ) (M k : ℕ) + (u : Fin n → Option α → ℝ) (w : ℝ) (ξ : Finset α → ℝ) + (J : Finset (Finset α)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hs : ∀ g r, 0 < s g r) (hk : 0 < k) {R : ℝ} (hR : ∀ g r, (s g r : ℝ) ≤ R) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ g, multiaffineBiasBudget n ζ ≤ N g) + (hM : multiaffineBiasBudget n ζ ≤ M) + (hbias : ζ ≤ ‖𝔼 c : Fin M, 𝔼 x : ∀ g, Option α → Fin (N g), + character (((w+(k : ℝ)*(c.val : ℝ))* + booleanBlockPhase ξ (fun g r => u g r+(s g r : ℝ)*((x g r).val : ℝ)) : ℝ) : + CircleFourier.Circle)‖) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ (multiaffineBiasBudget n ζ*((k : ℝ)*R^n))^J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S-(a S : ℝ)/D| ≤ + multiaffineBiasBudget n ζ / (((k : ℝ)*M)*∏ g, (N g : ℝ)) := by + have h := exists_common_rational_approximations (fun S : J => ξ S) + (fun S => moderateBooleanBlock_bounded_stride_entry N s M k u w ξ S (hJ S S.property) + hs hk hR hζ hN hM hbias) + simpa only [Fintype.card_coe] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators +open CircleFourier + +theorem weightedCubeBlock_major_arc {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (d : Fin (n + 1) → ScalarCubeLocalizationData I) (τ : Fin (n + 2) → ℝ) + (hτ : ∀ j : Fin (n + 1), 0 < τ j.succ) + (herror : ∀ j, (d j).error (τ j.succ) ≤ τ j.castSucc) + (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + {R : ℝ} (hR : ∀ j i, ((d j).modulus i : ℝ) ≤ R) + (hN : ∀ j, multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ (d j).cellLength) + (hbias : τ 0 ≤ ‖(FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun z => character ((booleanBlockPhase ξ (fun j i => (z j i : ℝ)) : ℝ) : CircleFourier.Circle))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ (multiaffineBiasBudget n (τ (Fin.last (n + 1))) * R ^ (n + 1)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + multiaffineBiasBudget n (τ (Fin.last (n + 1))) / ∏ j, ((d j).cellLength : ℝ) := by + let F : (Fin (n + 1) → Option I → ℝ) → ℂ := fun x => + character ((booleanBlockPhase ξ (fun j i => ((d j).length : ℝ) * x j i) : ℝ) : CircleFourier.Circle) + have hF (x) : ‖F x‖ ≤ 1 := le_of_eq (norm_character _) + have hsourceeq : (fun z : ∀ j, IntegerScalarCubeBox I (d j).length => F (fun j => (d j).point (z j))) = + (fun z => character ((booleanBlockPhase ξ (fun j i => (z j i : ℝ)) : ℝ) : CircleFourier.Circle)) := by + funext z + have hx : (fun j i => ((d j).length : ℝ) * (d j).point (z j) i) = + (fun j i => (z j i : ℝ)) := by + funext j i + exact (d j).point_scale (z j) i + dsimp only [F] + rw [hx] + have hs : τ 0 ≤ ‖(FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun z => F (fun j => (d j).point (z j)))‖ := by + rwa [hsourceeq] + obtain ⟨k, _, hphase⟩ := scalarCubeFamily_localize (fun _ => I) d τ hτ herror F hF hs + have hcell (t : ∀ j, Option I → Fin (d j).cellLength) : + F (fun j => (d j).cell (k j) (t j)) = + character ((booleanBlockPhase ξ (fun j i => (d j).integerOffset (k j) i + + ((d j).modulus i : ℝ) * (t j i).val) : ℝ) : CircleFourier.Circle) := by + have hx : (fun j i => ((d j).length : ℝ) * (d j).cell (k j) (t j) i) = + (fun j i => (d j).integerOffset (k j) i + ((d j).modulus i : ℝ) * (t j i).val) := by + funext j + exact (d j).cell_scale (k j) (t j) + dsimp only [F] + rw [hx] + have hm := Finset.expect_congr (s := Finset.univ) rfl (fun t _ => hcell t) + have hp := hphase.trans_eq (congrArg norm hm) + exact booleanBlockPhase_bounded_stride_major_arc (fun j => (d j).cellLength) + (fun j => (d j).modulus) (fun j => (d j).integerOffset (k j)) ξ J hJ + (fun j => (d j).modulus_pos) hR (hτ (Fin.last n)) hN hp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators +open CircleFourier + +theorem weightedModerateBlock_major_arc {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : ScalarCubeLocalizationData Empty) (d : Fin n → ScalarCubeLocalizationData I) + (τ : Fin (n + 2) → ℝ) (hτ : ∀ j : Fin (n + 1), 0 < τ j.succ) + (hc : c.error (τ 1) ≤ τ 0) + (hd : ∀ j : Fin n, (d j).error (τ j.succ.succ) ≤ τ j.castSucc.succ) + (shift : ℝ) (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + {R : ℝ} (hR : ∀ j i, ((d j).modulus i : ℝ) ≤ R) + (hN : ∀ j, multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ (d j).cellLength) + (hM : multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ c.cellLength) + (hbias : τ 0 ≤ ‖c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun x => character (((shift + (z none : ℝ)) * + booleanBlockPhase ξ (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle)))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ (multiaffineBiasBudget n (τ (Fin.last (n + 1))) * + ((c.modulus none : ℝ) * R ^ n)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + multiaffineBiasBudget n (τ (Fin.last (n + 1))) / + (((c.modulus none : ℝ) * c.cellLength) * ∏ j, ((d j).cellLength : ℝ)) := by + let F : (Option Empty → ℝ) → (Fin n → Option I → ℝ) → ℂ := fun z x => + character (((shift + (c.length : ℝ) * z none) * + booleanBlockPhase ξ (fun j i => ((d j).length : ℝ) * x j i) : ℝ) : CircleFourier.Circle) + have hF (z x) : ‖F z x‖ ≤ 1 := le_of_eq (norm_character _) + have hsource (z : IntegerScalarCubeBox Empty c.length) + (x : ∀ j, IntegerScalarCubeBox I (d j).length) : F (c.point z) (fun j => (d j).point (x j)) = + character (((shift + (z none : ℝ)) * + booleanBlockPhase ξ (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle) := by + have hx : (fun j i => ((d j).length : ℝ) * (d j).point (x j) i) = + (fun j i => (x j i : ℝ)) := by + funext j i + exact (d j).point_scale (x j) i + dsimp only [F] + rw [c.point_scale, hx] + have hs : τ 0 ≤ ‖c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun x => F (c.point z) (fun j => (d j).point (x j))))‖ := by + simpa only [hsource] using hbias + obtain ⟨a, k, _, _, hphase⟩ := coefficientCubeFamily_localize c d τ hτ hc hd F hF hs + have hcell (t : Option Empty → Fin c.cellLength) (u : ∀ j, Option I → Fin (d j).cellLength) : + F (c.cell a t) (fun j => (d j).cell (k j) (u j)) = + character (((shift + c.integerOffset a none + (c.modulus none : ℝ) * (t none).val) * + booleanBlockPhase ξ (fun j i => (d j).integerOffset (k j) i + + ((d j).modulus i : ℝ) * (u j i).val) : ℝ) : CircleFourier.Circle) := by + have hx : (fun j i => ((d j).length : ℝ) * (d j).cell (k j) (u j) i) = + (fun j i => (d j).integerOffset (k j) i + ((d j).modulus i : ℝ) * (u j i).val) := by + funext j + exact (d j).cell_scale (k j) (u j) + have hz := congrFun (c.cell_scale a t) none + dsimp only [F] + rw [hz, hx, ← add_assoc] + have hm := Finset.expect_congr (s := Finset.univ) rfl + (fun t _ => Finset.expect_congr (s := Finset.univ) rfl (fun u _ => hcell t u)) + have hp := hphase.trans_eq (congrArg norm hm) + rw [expect_emptyCubeCoordinate (fun t : Fin c.cellLength => + 𝔼 u : ∀ j, Option I → Fin (d j).cellLength, + character (((shift + c.integerOffset a none + (c.modulus none : ℝ) * t.val) * + booleanBlockPhase ξ (fun j i => (d j).integerOffset (k j) i + + ((d j).modulus i : ℝ) * (u j i).val) : ℝ) : CircleFourier.Circle))] at hp + exact moderateBooleanBlock_bounded_stride_major_arc (fun j => (d j).cellLength) + (fun j => (d j).modulus) c.cellLength (c.modulus none) + (fun j => (d j).integerOffset (k j)) (shift + c.integerOffset a none) ξ J hJ + (fun j => (d j).modulus_pos) (c.modulus_pos none) hR (hτ (Fin.last n)) hN hM hp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators +open CircleFourier + +theorem affine_weightedCubeBlock_major_arc {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (d : Fin (n + 1) → ScalarCubeLocalizationData I) (τ : Fin (n + 2) → ℝ) + (hτ : ∀ j : Fin (n + 1), 0 < τ j.succ) + (herror : ∀ j, (d j).error (τ j.succ) ≤ τ j.castSucc) + (u : Fin (n + 1) → Option I → ℝ) (v : Fin (n + 1) → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (ξ : Finset I → ℝ) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + {R : ℝ} (hR : ∀ j i, ((v j i * (d j).modulus i : ℕ) : ℝ) ≤ R) + (hN : ∀ j, multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ (d j).cellLength) + (hbias : τ 0 ≤ ‖(FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun z => character ((booleanBlockPhase ξ + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (z j i : ℝ))) : ℝ) : CircleFourier.Circle))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ (multiaffineBiasBudget n (τ (Fin.last (n + 1))) * R ^ (n + 1)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + multiaffineBiasBudget n (τ (Fin.last (n + 1))) / ∏ j, ((d j).cellLength : ℝ) := by + let F : (Fin (n + 1) → Option I → ℝ) → ℂ := fun x => character ((booleanBlockPhase ξ + (fun j => affineCubeCoordinates (u j) (v j) (fun i => ((d j).length : ℝ) * x j i)) : ℝ) : CircleFourier.Circle) + have hF (x) : ‖F x‖ ≤ 1 := le_of_eq (norm_character _) + have hsource (z : ∀ j, IntegerScalarCubeBox I (d j).length) : + F (fun j => (d j).point (z j)) = character ((booleanBlockPhase ξ + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (z j i : ℝ))) : ℝ) : CircleFourier.Circle) := by + dsimp only [F] + simp only [ScalarCubeLocalizationData.affine_point_scale] + have hs : τ 0 ≤ ‖(FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun z => F (fun j => (d j).point (z j)))‖ := by simpa only [hsource] using hbias + obtain ⟨k, _, hphase⟩ := scalarCubeFamily_localize (fun _ => I) d τ hτ herror F hF hs + have hcell (t : ∀ j, Option I → Fin (d j).cellLength) : + F (fun j => (d j).cell (k j) (t j)) = character ((booleanBlockPhase ξ (fun j i => + (u j i + (v j i : ℝ) * (d j).integerOffset (k j) i) + + ((v j i * (d j).modulus i : ℕ) : ℝ) * (t j i).val) : ℝ) : CircleFourier.Circle) := by + dsimp only [F] + simp only [ScalarCubeLocalizationData.affine_cell_scale] + have hm := Finset.expect_congr (s := Finset.univ) rfl (fun t _ => hcell t) + have hp := hphase.trans_eq (congrArg norm hm) + exact booleanBlockPhase_bounded_stride_major_arc (fun j => (d j).cellLength) + (fun j i => v j i * (d j).modulus i) + (fun j i => u j i + (v j i : ℝ) * (d j).integerOffset (k j) i) ξ J hJ + (fun j i => Nat.mul_pos (hv j i) ((d j).modulus_pos i)) hR (hτ (Fin.last n)) hN hp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators +open CircleFourier + +theorem affine_weightedModerateBlock_major_arc {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : ScalarCubeLocalizationData Empty) (d : Fin n → ScalarCubeLocalizationData I) + (τ : Fin (n + 2) → ℝ) (hτ : ∀ j : Fin (n + 1), 0 < τ j.succ) + (hc : c.error (τ 1) ≤ τ 0) + (hd : ∀ j : Fin n, (d j).error (τ j.succ.succ) ≤ τ j.castSucc.succ) + (shift : ℝ) (t : ℕ) (ht : 0 < t) (u : Fin n → Option I → ℝ) (v : Fin n → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + {R : ℝ} (hR : ∀ j i, ((v j i * (d j).modulus i : ℕ) : ℝ) ≤ R) + (hN : ∀ j, multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ (d j).cellLength) + (hM : multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ c.cellLength) + (hbias : τ 0 ≤ ‖c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean (fun x => character + (((shift + (t : ℝ) * (z none : ℝ)) * booleanBlockPhase ξ + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle)))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ (multiaffineBiasBudget n (τ (Fin.last (n + 1))) * + (((t * c.modulus none : ℕ) : ℝ) * R ^ n)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + multiaffineBiasBudget n (τ (Fin.last (n + 1))) / + ((((t * c.modulus none : ℕ) : ℝ) * c.cellLength) * ∏ j, ((d j).cellLength : ℝ)) := by + let F : (Option Empty → ℝ) → (Fin n → Option I → ℝ) → ℂ := fun z x => character + (((shift + (t : ℝ) * ((c.length : ℝ) * z none)) * booleanBlockPhase ξ + (fun j => affineCubeCoordinates (u j) (v j) (fun i => ((d j).length : ℝ) * x j i)) : ℝ) : CircleFourier.Circle) + have hF (z x) : ‖F z x‖ ≤ 1 := le_of_eq (norm_character _) + have hsource (z : IntegerScalarCubeBox Empty c.length) (x : ∀ j, IntegerScalarCubeBox I (d j).length) : + F (c.point z) (fun j => (d j).point (x j)) = character + (((shift + (t : ℝ) * (z none : ℝ)) * booleanBlockPhase ξ + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle) := by + dsimp only [F] + rw [c.point_scale] + simp only [ScalarCubeLocalizationData.affine_point_scale] + have hs : τ 0 ≤ ‖c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun x => F (c.point z) (fun j => (d j).point (x j))))‖ := by simpa only [hsource] using hbias + obtain ⟨a, k, _, _, hphase⟩ := coefficientCubeFamily_localize c d τ hτ hc hd F hF hs + have hcell (z : Option Empty → Fin c.cellLength) (x : ∀ j, Option I → Fin (d j).cellLength) : + F (c.cell a z) (fun j => (d j).cell (k j) (x j)) = character + (((shift + (t : ℝ) * c.integerOffset a none + ((t * c.modulus none : ℕ) : ℝ) * (z none).val) * + booleanBlockPhase ξ (fun j i => (u j i + (v j i : ℝ) * (d j).integerOffset (k j) i) + + ((v j i * (d j).modulus i : ℕ) : ℝ) * (x j i).val) : ℝ) : CircleFourier.Circle) := by + dsimp only [F] + rw [congrFun (c.cell_scale a z) none] + simp only [ScalarCubeLocalizationData.affine_cell_scale] + congr 2 + push_cast + ring + have hm := Finset.expect_congr (s := Finset.univ) rfl + (fun z _ => Finset.expect_congr (s := Finset.univ) rfl (fun x _ => hcell z x)) + have hp := hphase.trans_eq (congrArg norm hm) + rw [expect_emptyCubeCoordinate (fun z : Fin c.cellLength => + 𝔼 x : ∀ j, Option I → Fin (d j).cellLength, character + (((shift + (t : ℝ) * c.integerOffset a none + ((t * c.modulus none : ℕ) : ℝ) * z.val) * + booleanBlockPhase ξ (fun j i => (u j i + (v j i : ℝ) * (d j).integerOffset (k j) i) + + ((v j i * (d j).modulus i : ℕ) : ℝ) * (x j i).val) : ℝ) : CircleFourier.Circle))] at hp + exact moderateBooleanBlock_bounded_stride_major_arc (fun j => (d j).cellLength) + (fun j i => v j i * (d j).modulus i) c.cellLength (t * c.modulus none) + (fun j i => u j i + (v j i : ℝ) * (d j).integerOffset (k j) i) + (shift + (t : ℝ) * c.integerOffset a none) ξ J hJ + (fun j i => Nat.mul_pos (hv j i) ((d j).modulus_pos i)) (Nat.mul_pos ht (c.modulus_pos none)) + hR (hτ (Fin.last n)) hN hM hp + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +namespace NormalizedScalarCubeSource + +variable {I : Type*} [Fintype I] [DecidableEq I] (s : NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {n : ℕ} {U ζ : ℝ} + (h : ScalarCubePrimitiveBudget s A U) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : localizedMajorArcLengthBudget n U ζ ≤ s.length) + +noncomputable def majorArcLocalizationData : ScalarCubeLocalizationData I := + s.polynomialLocalizationData A hA h (localizationThreshold_pos h.one_le hζ (n + 1)) + (localizationThreshold_le_one h.one_le hζ hζ1 (n + 1)) + (by linarith [localizedMajorArcBudget_pos n h.one_le hζ]) hlen + +theorem majorArcLocalizationData_source : + (s.majorArcLocalizationData A hA h hζ hζ1 hlen).source = s.source := rfl + +theorem majorArcLocalizationData_cellLength : + localizedMajorArcBudget n U ζ ≤ + ((s.majorArcLocalizationData A hA h hζ hζ1 hlen).cellLength : ℝ) := by + exact (le_add_of_nonneg_right (by norm_num : (0 : ℝ) ≤ 1)).trans + (s.polynomialLocalizationData_cellLength A hA h + (localizationThreshold_pos h.one_le hζ (n + 1)) + (localizationThreshold_le_one h.one_le hζ hζ1 (n + 1)) + (by linarith [localizedMajorArcBudget_pos n h.one_le hζ]) hlen) + +theorem majorArcLocalizationData_error {i : ℕ} (hi : i + 1 ≤ n + 1) : + (s.majorArcLocalizationData A hA h hζ hζ1 hlen).error (localizationThreshold U ζ (i + 1)) ≤ + localizationThreshold U ζ i := by + exact (s.polynomialLocalizationData_error A hA h + (localizationThreshold_pos h.one_le hζ (n + 1)) + (localizationThreshold_le_one h.one_le hζ hζ1 (n + 1)) + (by linarith [localizedMajorArcBudget_pos n h.one_le hζ]) hlen + (localizationThreshold_pos h.one_le hζ (i + 1)).le).trans + (localizationThreshold_step h.one_le hζ hi) + +theorem majorArcLocalizationData_lengthLoss : + (s.majorArcLocalizationData A hA h hζ hζ1 hlen).lengthLoss ≤ + localizationLengthBudget U (localizationThreshold U ζ (n + 1)) 1 := + s.polynomialLocalizationData_lengthLoss A hA h + (localizationThreshold_pos h.one_le hζ (n + 1)) + (localizationThreshold_le_one h.one_le hζ hζ1 (n + 1)) + (by linarith [localizedMajorArcBudget_pos n h.one_le hζ]) hlen + +end NormalizedScalarCubeSource +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal +open CircleFourier + +theorem polynomial_affine_weightedCubeBlock_major_arc {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (u : Fin (n + 1) → Option I → ℝ) (v : Fin (n + 1) → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (hstride : ∀ j i, ((v j i * (s j).modulus i : ℕ) : ℝ) ≤ U) + (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hbias : ζ ≤ ‖(FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun z => character ((booleanBlockPhase ξ + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (z j i : ℝ))) : ℝ) : CircleFourier.Circle))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + localizedMajorArcErrorBudget n U ζ / ∏ j, ((s j).length : ℝ) := by + let d j := (s j).majorArcLocalizationData A hA (h j) hζ hζ1 (hlen j) + let τ : Fin (n + 2) → ℝ := fun i => localizationThreshold U ζ i.val + have hU := (h 0).one_le + have hτ (j : Fin (n + 1)) : 0 < τ j.succ := localizationThreshold_pos hU hζ _ + have herr (j : Fin (n + 1)) : (d j).error (τ j.succ) ≤ τ j.castSucc := + (s j).majorArcLocalizationData_error A hA (h j) hζ hζ1 (hlen j) (by omega) + have hN (j : Fin (n + 1)) : multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ (d j).cellLength := + (s j).majorArcLocalizationData_cellLength A hA (h j) hζ hζ1 (hlen j) + have hb : τ 0 ≤ ‖(FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun z => character ((booleanBlockPhase ξ + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (z j i : ℝ))) : ℝ) : CircleFourier.Circle))‖ := by + change localizationThreshold U ζ 0 ≤ _ + rw [localizationThreshold_zero] + exact hbias + obtain ⟨D, hD, hDb, a, ha⟩ := affine_weightedCubeBlock_major_arc d τ hτ herr u v hv ξ J hJ hstride hN hb + refine ⟨D, hD, hDb, a, fun S => (ha S).trans ?_⟩ + have he := polynomialScalarCube_inverse_product (fun _ : Fin (n + 1) => I) s A hA h + (localizationThreshold_pos hU hζ (n + 1)) + (localizationThreshold_le_one hU hζ hζ1 (n + 1)) + (by linarith [localizedMajorArcBudget_pos n hU hζ]) hlen + (localizedMajorArcBudget_pos n hU hζ).le + simpa only [Fintype.card_fin, localizedMajorArcErrorBudget, localizedMajorArcBudget, + τ, Fin.val_last, d, NormalizedScalarCubeSource.majorArcLocalizationData] using he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal +open CircleFourier + +theorem polynomial_affine_weightedModerateBlock_major_arc {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hclen : localizedMajorArcLengthBudget n U ζ ≤ c.length) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (shift : ℝ) (t : ℕ) (ht : 0 < t) + (u : Fin n → Option I → ℝ) (v : Fin n → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (hstride : ∀ j i, ((v j i * (s j).modulus i : ℕ) : ℝ) ≤ U) + (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hbias : ζ ≤ ‖c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((shift + (t : ℝ) * (z none : ℝ)) * + booleanBlockPhase ξ (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle)))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ (localizedMajorArcBudget n U ζ * (((t * c.modulus none : ℕ) : ℝ) * U ^ n)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + localizedMajorArcErrorBudget n U ζ / + ((((t * c.modulus none : ℕ) : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) := by + let d j := (s j).majorArcLocalizationData A hA (h j) hζ hζ1 (hlen j) + let e := c.majorArcLocalizationData A hA hc hζ hζ1 hclen + let τ : Fin (n + 2) → ℝ := fun i => localizationThreshold U ζ i.val + have hτ (j : Fin (n + 1)) : 0 < τ j.succ := localizationThreshold_pos hc.one_le hζ _ + have he : e.error (τ 1) ≤ τ 0 := by + simpa only [τ, Fin.val_one, Fin.val_zero] using + c.majorArcLocalizationData_error A hA hc hζ hζ1 hclen (i := 0) (by omega) + have hd (j : Fin n) : (d j).error (τ j.succ.succ) ≤ τ j.castSucc.succ := + (s j).majorArcLocalizationData_error A hA (h j) hζ hζ1 (hlen j) (by omega) + have hR (j : Fin n) (i : Option I) : ((v j i * (d j).modulus i : ℕ) : ℝ) ≤ U := + hstride j i + have hN (j : Fin n) : multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ (d j).cellLength := + (s j).majorArcLocalizationData_cellLength A hA (h j) hζ hζ1 (hlen j) + have hM : multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ e.cellLength := + c.majorArcLocalizationData_cellLength A hA hc hζ hζ1 hclen + have hb : τ 0 ≤ ‖e.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun x => character (((shift + (t : ℝ) * (z none : ℝ)) * + booleanBlockPhase ξ (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle)))‖ := by + change localizationThreshold U ζ 0 ≤ _ + rw [localizationThreshold_zero] + exact hbias + obtain ⟨D, hD, hDb, a, ha⟩ := affine_weightedModerateBlock_major_arc e d τ hτ he hd shift t ht u v hv ξ J hJ hR hN hM hb + refine ⟨D, hD, hDb, a, fun S => (ha S).trans ?_⟩ + have hcloss := c.majorArcLocalizationData_lengthLoss A hA hc hζ hζ1 hclen + have hsloss j := (s j).majorArcLocalizationData_lengthLoss A hA (h j) hζ hζ1 (hlen j) + apply coefficient_inverse_product_le (fun j => ((s j).length : ℝ)) + (fun j => ((d j).cellLength : ℝ)) + (by exact_mod_cast c.length_pos) (by exact_mod_cast e.cellLength_pos) + (by exact_mod_cast Nat.mul_pos ht (c.modulus_pos none)) + (fun j => by exact_mod_cast (s j).length_pos) + (fun j => by exact_mod_cast (d j).cellLength_pos) + (e.length_le_lengthLoss_mul_cellLength.trans + (mul_le_mul_of_nonneg_right hcloss (Nat.cast_nonneg _))) + (fun j => (d j).length_le_lengthLoss_mul_cellLength.trans + (mul_le_mul_of_nonneg_right (hsloss j) (Nat.cast_nonneg _))) + (localizedMajorArcBudget_pos n hc.one_le hζ).le + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal +open CircleFourier + +theorem polynomial_weightedCubeBlock_major_arc {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hbias : ζ ≤ ‖(FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun z => character ((booleanBlockPhase ξ (fun j i => (z j i : ℝ)) : ℝ) : CircleFourier.Circle))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + localizedMajorArcErrorBudget n U ζ / ∏ j, ((s j).length : ℝ) := by + let d j := (s j).majorArcLocalizationData A hA (h j) hζ hζ1 (hlen j) + let τ : Fin (n + 2) → ℝ := fun i => localizationThreshold U ζ i.val + have hU := (h 0).one_le + have hτ (j : Fin (n + 1)) : 0 < τ j.succ := localizationThreshold_pos hU hζ _ + have herr (j : Fin (n + 1)) : (d j).error (τ j.succ) ≤ τ j.castSucc := + (s j).majorArcLocalizationData_error A hA (h j) hζ hζ1 (hlen j) (by omega) + have hR (j : Fin (n + 1)) (i : Option I) : ((d j).modulus i : ℝ) ≤ U := + (by exact_mod_cast (s j).modulus_le i : ((s j).modulus i : ℝ) ≤ (s j).modulusBound).trans + (h j).modulus_le + have hN (j : Fin (n + 1)) : multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ (d j).cellLength := + (s j).majorArcLocalizationData_cellLength A hA (h j) hζ hζ1 (hlen j) + have hb : τ 0 ≤ ‖(FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun z => character ((booleanBlockPhase ξ (fun j i => (z j i : ℝ)) : ℝ) : CircleFourier.Circle))‖ := by + change localizationThreshold U ζ 0 ≤ _ + rw [localizationThreshold_zero] + exact hbias + obtain ⟨D, hD, hDb, a, ha⟩ := weightedCubeBlock_major_arc d τ hτ herr ξ J hJ hR hN hb + refine ⟨D, hD, hDb, a, fun S => (ha S).trans ?_⟩ + have he := polynomialScalarCube_inverse_product (fun _ : Fin (n + 1) => I) s A hA h + (localizationThreshold_pos hU hζ (n + 1)) + (localizationThreshold_le_one hU hζ hζ1 (n + 1)) + (by linarith [localizedMajorArcBudget_pos n hU hζ]) hlen + (localizedMajorArcBudget_pos n hU hζ).le + simpa only [Fintype.card_fin, localizedMajorArcErrorBudget, localizedMajorArcBudget, + τ, Fin.val_last, d, NormalizedScalarCubeSource.majorArcLocalizationData] using he + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PositiveTorusMasks.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PositiveTorusMasks.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4c661462c537689d0abe1c8b2025bff69828afa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PositiveTorusMasks.lean @@ -0,0 +1,42 @@ +import OAI.Combinatorics.Progressions.Fourier.BohrNiltestBudget +import OAI.Combinatorics.Progressions.Nilpotent.NiltestComplement + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct NNReal + +theorem positiveCyclicNiltest_affine_torus {I : Type} [Fintype I] + {N degree : ℕ} [NeZero N] {p : ℝ} (hdegree : 1 ≤ degree) (hp : 0 ≤ p) + (hI : (Fintype.card I : ℝ) ≤ p) + (Psi : (I → CircleFourier.Circle) → ℝ) (b a : I → ℝ) (K : ℝ≥0) + (hPsi : ∀ v, 0 ≤ Psi v ∧ Psi v ≤ 1) (hLip : LipschitzWith K Psi) + (hbudget : Real.log (3 + (K : ℝ)) ≤ p) : + PositiveCyclicNiltest.{0} degree N p + (fun x => Psi (fun i => ((b i + (x.val : ℝ) * a i : ℝ) : CircleFourier.Circle))) := by + let d := Fintype.card I + let e : I ≃ Fin d := Fintype.equivFin I + let : FiniteDimensional ℚ (RationalTorus.Algebra d) := + (RationalTorus.basis d).finiteDimensional_of_finite + let := moduleTopology ℝ (ℝ ⊗[ℚ] RationalTorus.Algebra d) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] RationalTorus.Algebra d) := + IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] RationalTorus.Algebra d) := + realification_moduleTopology_t2 (RationalTorus.basis d) + let T := RationalTorus.realAffineNiltest e Psi b a K hPsi hLip + refine .of_test (RationalTorus.nilmanifold d) hdegree T + (RationalTorus.realAffineNiltest_unitInterval e Psi b a K hPsi hLip) + (RationalTorus.realAffineNiltest_complexity e Psi b a K hPsi hLip hp hI hbudget) ?_ + intro x + change _ = ((RationalTorus.realAffineNiltest e Psi b a K hPsi hLip).evalCyclic N (fun _ => x)).re + rw [RationalTorus.realAffineNiltest_evalCyclic] + rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PreparedCoefficientTorusCompact.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PreparedCoefficientTorusCompact.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e74fd9ae4bf823fc928204df76fdce37ff52730 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PreparedCoefficientTorusCompact.lean @@ -0,0 +1,37 @@ +import OAI.Combinatorics.Progressions.Linear.RankPreparationProjectedAxisBudget + +namespace OAI + +section + +namespace Erdos3.RankPreparationFamily + +open Module Submodule VectorPolynomial + +variable {X J : Type} {m : ℕ} (L : RankPreparationFamily X J m) + +theorem PreparedHeights.euclideanLayerTorus_compact + {p : ℝ} {R : ℕ} (hL : L.PreparedHeights p R) + (hp : 0 ≤ p) (hR : 1 ≤ R) (j : Fin m) : + CompactSpace (euclideanSubspace (L j).space ⧸ + (latticeSection (standardEuclideanLattice (L j).Coord) + (euclideanSubspace (L j).space)).toAddSubgroup) := by + let Λ := latticeSection (standardEuclideanLattice (L j).Coord) + (euclideanSubspace (L j).space) + let : IsZLattice ℝ Λ := hL.lattice_full L hp hR j + have hc := IsZLattice.isCompact_range_of_periodic Λ + (QuotientAddGroup.mk' Λ.toAddSubgroup) + (QuotientAddGroup.isQuotientMap_mk Λ.toAddSubgroup).continuous (by + intro x z hz + rw [map_add] + have hz0 : QuotientAddGroup.mk' Λ.toAddSubgroup z = 0 := + (QuotientAddGroup.eq_zero_iff z).mpr hz + rw [hz0, add_zero]) + rw [Set.range_eq_univ.mpr (QuotientAddGroup.mk'_surjective Λ.toAddSubgroup)] at hc + exact ⟨hc⟩ + +end Erdos3.RankPreparationFamily + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerCharacterDepth.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerCharacterDepth.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7f4b038807d8de7354f2e9e6fdfb1cdaf1bb70e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerCharacterDepth.lean @@ -0,0 +1,52 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteProductImageDecay + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators + +theorem primePower_character_tag_depth_max + {Tag : Type*} [Fintype Tag] [DecidableEq Tag] [Nonempty Tag] + {H : Tag → Type*} [∀ j, AddCommGroup (H j)] + {p a : ℕ} (hp : p.Prime) (χ : AddChar (∀ j, H j) ℂ) + (depth : Tag → ℕ) + (hcoord : ∀ j, orderOf (finiteProductCharacterCoordinate χ j) = p ^ depth j) + (horder : orderOf χ = p ^ a) : + (∀ j, depth j ≤ a) ∧ ∃ j, depth j = a := by + classical + have hpow : χ ^ (p ^ a) = 1 := by rw [← horder]; exact pow_orderOf_eq_one χ + have hcoordPow (j : Tag) : (finiteProductCharacterCoordinate χ j) ^ (p ^ a) = 1 := by + ext x + exact congrArg (fun ψ : AddChar (∀ j, H j) ℂ => ψ (Pi.single j x)) hpow + have hdepth (j : Tag) : depth j ≤ a := by + have hdvd := orderOf_dvd_of_pow_eq_one (hcoordPow j) + rw [hcoord j] at hdvd + exact (Nat.pow_dvd_pow_iff_le_right hp.one_lt).mp hdvd + refine ⟨hdepth, ?_⟩ + by_cases ha : a = 0 + · obtain ⟨j⟩ := ‹Nonempty Tag› + exact ⟨j, by have := hdepth j; omega⟩ + by_contra! hmax + have hsmall (j : Tag) : depth j ≤ a - 1 := by have := hdepth j; have := hmax j; omega + have hkilled (j : Tag) : (finiteProductCharacterCoordinate χ j) ^ (p ^ (a - 1)) = 1 := by + apply orderOf_dvd_iff_pow_eq_one.mp + rw [hcoord j] + exact pow_dvd_pow p (hsmall j) + have hkill : χ ^ (p ^ (a - 1)) = 1 := by + rw [← finiteProductCharacter_decomposition χ, ← map_pow] + have hpi : (finiteProductCharacterCoordinate χ) ^ (p ^ (a - 1)) = 1 := by + funext j + exact hkilled j + rw [hpi, map_one] + have hdvd := orderOf_dvd_of_pow_eq_one hkill + rw [horder] at hdvd + have hle := (Nat.pow_dvd_pow_iff_le_right hp.one_lt).mp hdvd + omega + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerCharacterScaling.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerCharacterScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..2561bb1a6ca6042cad020aaf6abd498c52cb0832 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerCharacterScaling.lean @@ -0,0 +1,231 @@ +import Mathlib.Algebra.Group.Pi.Lemmas +import Mathlib.Algebra.Group.Subgroup.Basic +import Mathlib.Algebra.Group.TypeTags.Hom +import Mathlib.Algebra.Group.Units.Hom +import Mathlib.Analysis.Fourier.FiniteAbelian.PontryaginDuality +import Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar +import Mathlib.Data.ZMod.Basic +import Mathlib.GroupTheory.Exponent + +namespace OAI + +section + +namespace Erdos3 + +theorem finiteCharacter_exponent (G : Type*) [AddCommGroup G] [Finite G] : + Monoid.exponent (AddChar G ℂ) = AddMonoid.exponent G := by + apply Nat.dvd_antisymm + · apply Monoid.exponent_dvd_of_forall_pow_eq_one + intro χ + ext x + rw [AddChar.pow_apply, ← AddChar.map_nsmul_eq_pow, AddMonoid.exponent_nsmul_eq_zero] + exact χ.map_zero_eq_one + · apply AddMonoid.exponent_dvd_of_forall_nsmul_eq_zero + intro x + apply AddChar.forall_apply_eq_zero.mp + intro χ + rw [AddChar.map_nsmul_eq_pow] + have h := congrArg (fun ψ : AddChar G ℂ => ψ x) (Monoid.pow_exponent_eq_one χ) + exact h + +theorem exists_character_order_eq_exponent (G : Type*) [AddCommGroup G] [Finite G] : + ∃ χ : AddChar G ℂ, orderOf χ = AddMonoid.exponent G := by + obtain ⟨χ, hχ⟩ := Monoid.exists_orderOf_eq_exponent + (G := AddChar G ℂ) Monoid.ExponentExists.of_finite + exact ⟨χ, hχ.trans (finiteCharacter_exponent G)⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +def characterPullback {G H : Type*} [AddCommGroup G] [AddCommGroup H] + (f : G →+ H) : AddChar H ℂ →* AddChar G ℂ where + toFun χ := χ.compAddMonoidHom f + map_one' := rfl + map_mul' _ _ := rfl + +theorem characterPullback_order {G H : Type*} [AddCommGroup G] [AddCommGroup H] + (f : G →+ H) (hf : Function.Surjective f) (χ : AddChar H ℂ) : + orderOf (characterPullback f χ) = orderOf χ := + orderOf_injective (characterPullback f) (AddChar.compAddMonoidHom_injective_left f hf) χ + +end Erdos3 + +end + +section + +namespace Erdos3 + +def zmodPiReduction {I : Type*} {n m : ℕ} (h : m ∣ n) : + (I → ZMod n) →+ (I → ZMod m) := + AddMonoidHom.piMap fun _ => (ZMod.castHom h (ZMod m)).toAddMonoidHom + +@[simp] theorem zmodPiReduction_apply {I : Type*} {n m : ℕ} (h : m ∣ n) + (x : I → ZMod n) (i : I) : + zmodPiReduction h x i = ZMod.castHom h (ZMod m) (x i) := rfl + +theorem zmodPiReduction_surjective {I : Type*} {n m : ℕ} (h : m ∣ n) : + Function.Surjective (zmodPiReduction (I := I) h) := by + intro y + choose x hx using fun i => ZMod.castHom_surjective h (y i) + exact ⟨x, funext hx⟩ + +theorem zmodPiReduction_kernel_nsmul {I : Type*} {n m : ℕ} [NeZero n] + (h : m ∣ n) (x : I → ZMod n) (hx : zmodPiReduction h x = 0) : + ∃ y : I → ZMod n, m • y = x := by + have hdvd (i : I) : m ∣ (x i).val := by + apply (ZMod.natCast_eq_zero_iff _ _).mp + have hi := congrFun hx i + simpa only [zmodPiReduction_apply, ZMod.castHom_apply, ZMod.cast_eq_val, + Pi.zero_apply] using hi + choose w hw using hdvd + refine ⟨fun i => (w i : ZMod n), ?_⟩ + funext i + change m • (w i : ZMod n) = x i + rw [nsmul_eq_mul, ← Nat.cast_mul, ← hw i, ZMod.natCast_zmod_val] + +theorem zmodPiReduction_kernel_character {I : Type*} {n m : ℕ} [NeZero n] + (h : m ∣ n) (χ : AddChar (I → ZMod n) ℂ) (hχ : χ ^ m = 1) + (x : I → ZMod n) (hx : zmodPiReduction h x = 0) : χ x = 1 := by + obtain ⟨y, hy⟩ := zmodPiReduction_kernel_nsmul h x hx + rw [← hy, AddChar.map_nsmul_eq_pow] + exact congrArg (fun ψ : AddChar (I → ZMod n) ℂ => ψ y) hχ + +theorem exists_zmodPiReduction_character {I : Type*} {n m : ℕ} [NeZero n] + (h : m ∣ n) (χ : AddChar (I → ZMod n) ℂ) (hχ : χ ^ m = 1) : + ∃ ψ : AddChar (I → ZMod m) ℂ, + characterPullback (zmodPiReduction h) ψ = χ ∧ orderOf ψ = orderOf χ := by + let q := zmodPiReduction (I := I) h + let f := q.toMultiplicative + have hf : Function.Surjective f := zmodPiReduction_surjective h + let g := χ.toMonoidHom.toHomUnits + have hker : f.ker ≤ g.ker := by + intro x hx + apply Units.ext + change χ x.toAdd = 1 + exact zmodPiReduction_kernel_character h χ hχ x.toAdd hx + let lifted := f.liftOfSurjective hf ⟨g, hker⟩ + let ψ : AddChar (I → ZMod m) ℂ := + AddChar.toMonoidHomEquiv.symm ((Units.coeHom ℂ).comp lifted) + have heq : characterPullback q ψ = χ := by + apply AddChar.ext + intro x + change (lifted (f (Multiplicative.ofAdd x)) : ℂ) = χ x + simp only [lifted, MonoidHom.liftOfSurjective, + MonoidHom.liftOfRightInverse_comp_apply] + rfl + refine ⟨ψ, heq, ?_⟩ + rw [← characterPullback_order q (zmodPiReduction_surjective h) ψ, heq] + +theorem exists_primePower_character_descent {I : Type*} {p A a : ℕ} + [NeZero (p ^ A)] (ha : a ≤ A) (χ : AddChar (I → ZMod (p ^ A)) ℂ) + (hχ : orderOf χ = p ^ a) : + ∃ ψ : AddChar (I → ZMod (p ^ a)) ℂ, + characterPullback (zmodPiReduction (pow_dvd_pow p ha)) ψ = χ ∧ + orderOf ψ = p ^ a := by + have hpow : χ ^ (p ^ a) = 1 := by + rw [← hχ] + exact pow_orderOf_eq_one χ + obtain ⟨ψ, hψ, hord⟩ := exists_zmodPiReduction_character (pow_dvd_pow p ha) χ hpow + exact ⟨ψ, hψ, hord.trans hχ⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem zmod_character_order_dvd {I : Type*} {N : ℕ} + (χ : AddChar (I → ZMod N) ℂ) : orderOf χ ∣ N := by + apply orderOf_dvd_of_pow_eq_one + ext x + rw [AddChar.pow_apply, ← AddChar.map_nsmul_eq_pow] + have hx : N • x = 0 := by + funext i + simp only [Pi.smul_apply, nsmul_eq_mul, ZMod.natCast_self, zero_mul, Pi.zero_apply] + rw [hx, AddChar.map_zero_eq_one, AddChar.one_apply] + +theorem zmod_character_order_pos {I : Type*} {N : ℕ} [NeZero N] + (χ : AddChar (I → ZMod N) ℂ) : 0 < orderOf χ := by + apply Nat.pos_of_ne_zero + intro hz + have hdvd := zmod_character_order_dvd χ + rw [hz, zero_dvd_iff] at hdvd + exact NeZero.ne N hdvd + +theorem exists_characterOrder_descent {I : Type*} {N : ℕ} [NeZero N] + (χ : AddChar (I → ZMod N) ℂ) : + ∃ ψ : AddChar (I → ZMod (orderOf χ)) ℂ, + characterPullback (zmodPiReduction (zmod_character_order_dvd χ)) ψ = χ ∧ + orderOf ψ = orderOf χ ∧ + (∀ x, χ x = ψ (zmodPiReduction (zmod_character_order_dvd χ) x)) ∧ + ∀ b : I → ℤ, χ (fun i => (b i : ZMod N)) = + ψ (fun i => (b i : ZMod (orderOf χ))) := by + obtain ⟨ψ, hpull, horder⟩ := exists_zmodPiReduction_character + (zmod_character_order_dvd χ) χ (pow_orderOf_eq_one χ) + have hpoint (x : I → ZMod N) : + χ x = ψ (zmodPiReduction (zmod_character_order_dvd χ) x) := + (congrArg (fun η : AddChar (I → ZMod N) ℂ => η x) hpull).symm + refine ⟨ψ, hpull, horder, hpoint, ?_⟩ + intro b + have hred : zmodPiReduction (zmod_character_order_dvd χ) + (fun i => (b i : ZMod N)) = (fun i => (b i : ZMod (orderOf χ))) := by + funext i + exact map_intCast (ZMod.castHom (zmod_character_order_dvd χ) (ZMod (orderOf χ))) (b i) + rw [hpoint, hred] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem stdAddChar_mul_modulus_ratio {n m d : ℕ} [NeZero n] [NeZero m] [NeZero d] + (h : m ∣ n) (hn : n = m * d) (x : ZMod n) : + ZMod.stdAddChar ((d : ZMod n) * x) = + ZMod.stdAddChar (ZMod.castHom h (ZMod m) x) := by + obtain ⟨z, rfl⟩ := ZMod.intCast_surjective x + rw [← Int.cast_natCast d, ← Int.cast_mul, ZMod.stdAddChar_coe, + map_intCast, ZMod.stdAddChar_coe] + congr 1 + push_cast + rw [hn, Nat.cast_mul] + have hm : (m : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (NeZero.ne m) + have hd : (d : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (NeZero.ne d) + field_simp + +theorem stdAddChar_primePower_scaling {p A a : ℕ} [NeZero p] + (ha : a ≤ A) (x : ZMod (p ^ A)) : + ZMod.stdAddChar (((p ^ (A - a) : ℕ) : ZMod (p ^ A)) * x) = + ZMod.stdAddChar (ZMod.castHom (pow_dvd_pow p ha) (ZMod (p ^ a)) x) := + stdAddChar_mul_modulus_ratio (pow_dvd_pow p ha) (pow_mul_pow_sub p ha).symm x + +theorem stdAddChar_primePower_row_scaling {I : Type*} [Fintype I] + {p A a : ℕ} [NeZero p] (ha : a ≤ A) + (coeff : I → ZMod (p ^ a)) (x : I → ZMod (p ^ A)) : + ZMod.stdAddChar (∑ i, + ((p ^ (A - a) : ℕ) : ZMod (p ^ A)) * ((coeff i).val : ZMod (p ^ A)) * x i) = + ZMod.stdAddChar (∑ i, coeff i * zmodPiReduction (pow_dvd_pow p ha) x i) := by + simp only [mul_assoc, ← Finset.mul_sum] + rw [stdAddChar_primePower_scaling ha] + congr 1 + simp only [map_sum, map_mul, map_natCast, ZMod.natCast_zmod_val, + zmodPiReduction_apply] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerTaggedCharacterRows.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerTaggedCharacterRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..57fb252fca06eaa6f7be3e225696b38abc6396d5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PrimePowerTaggedCharacterRows.lean @@ -0,0 +1,186 @@ +import Mathlib.Analysis.Fourier.FiniteAbelian.PontryaginDuality +import Mathlib.Analysis.SpecialFunctions.Complex.CircleAddChar +import OAI.Combinatorics.Progressions.Estimates.FiniteProductImageDecay + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators + +theorem zmodAddEquiv_apply_eq_std {q : ℕ} [NeZero q] (a x : ZMod q) : + AddChar.zmodAddEquiv a x = ZMod.stdAddChar (a * x) := by + rfl + +theorem exists_zmod_character_row {I : Type*} [Fintype I] [DecidableEq I] + {q : ℕ} [NeZero q] (χ : AddChar (I → ZMod q) ℂ) : + ∃ coeff : I → ZMod q, ∀ x, χ x = ZMod.stdAddChar (∑ i, coeff i * x i) := by + choose coeff hcoeff using fun i => AddChar.zmodAddEquiv.surjective + (finiteProductCharacterCoordinate χ i) + refine ⟨coeff, ?_⟩ + intro x + have h := congrArg (fun ψ : AddChar (I → ZMod q) ℂ => ψ x) + (finiteProductCharacter_decomposition χ) + calc + χ x = ∏ i, finiteProductCharacterCoordinate χ i (x i) := h.symm + _ = ∏ i, ZMod.stdAddChar (coeff i * x i) := by + apply Finset.prod_congr rfl + intro i _ + rw [← hcoeff i, zmodAddEquiv_apply_eq_std] + _ = ZMod.stdAddChar (∑ i, coeff i * x i) := by + exact (map_sum ZMod.stdAddChar.toAddMonoidHom (fun i => coeff i * x i) Finset.univ).symm + +theorem primePower_character_row_primitive {I : Type*} [Fintype I] + {p a : ℕ} (hp : p.Prime) (ha : 0 < a) [NeZero (p ^ a)] + (χ : AddChar (I → ZMod (p ^ a)) ℂ) (coeff : I → ZMod (p ^ a)) + (hrow : ∀ x, χ x = ZMod.stdAddChar (∑ i, coeff i * x i)) + (horder : orderOf χ = p ^ a) : ∃ i, IsUnit (coeff i) := by + classical + by_contra! hunit + have hdiv (i : I) : p ∣ (coeff i).val := by + by_contra hh + apply hunit i + rw [← ZMod.natCast_zmod_val (coeff i)] + exact (ZMod.isUnit_natCast_iff_not_dvd_pow hp ha).mpr hh + have hkill (i : I) : (p ^ (a - 1) : ℕ) * coeff i = (0 : ZMod (p ^ a)) := by + obtain ⟨b, hb⟩ := hdiv i + rw [← ZMod.natCast_zmod_val (coeff i), hb, ← Nat.cast_mul, + ← Nat.mul_assoc, ← pow_succ, Nat.sub_add_cancel (by omega)] + simp only [Nat.cast_mul, ZMod.natCast_self, zero_mul] + have hpow : χ ^ (p ^ (a - 1)) = 1 := by + ext x + rw [AddChar.pow_apply, ← AddChar.map_nsmul_eq_pow, hrow, AddChar.one_apply] + have hz : (∑ i, coeff i * ((p ^ (a - 1)) • x) i) = 0 := by + apply Finset.sum_eq_zero + intro i _ + simp only [Pi.smul_apply, nsmul_eq_mul] + rw [mul_left_comm, ← mul_assoc, hkill, zero_mul] + rw [hz, AddChar.map_zero_eq_one] + have hdvd := orderOf_dvd_of_pow_eq_one hpow + rw [horder] at hdvd + have hle := Nat.le_of_dvd (pow_pos hp.pos _) hdvd + have hlt : p ^ (a - 1) < p ^ a := Nat.pow_lt_pow_right hp.one_lt (by omega) + omega + +theorem exists_primePower_character_primitive_row {I : Type*} [Fintype I] + {p a : ℕ} (hp : p.Prime) (ha : 0 < a) [NeZero (p ^ a)] + (χ : AddChar (I → ZMod (p ^ a)) ℂ) (horder : orderOf χ = p ^ a) : + ∃ coeff : I → ZMod (p ^ a), (∃ i, IsUnit (coeff i)) ∧ + ∀ x, χ x = ZMod.stdAddChar (∑ i, coeff i * x i) := by + classical + obtain ⟨coeff, hcoeff⟩ := exists_zmod_character_row χ + exact ⟨coeff, primePower_character_row_primitive hp ha χ coeff hcoeff horder, hcoeff⟩ + +theorem primePower_primitive_row_cast {I : Type*} {p a b : ℕ} (hab : b ≤ a) + (coeff : I → ZMod (p ^ a)) (hcoeff : ∃ i, IsUnit (coeff i)) : + ∃ i, IsUnit (ZMod.castHom (pow_dvd_pow p hab) (ZMod (p ^ b)) (coeff i)) := by + obtain ⟨i, hi⟩ := hcoeff + exact ⟨i, hi.map (ZMod.castHom (pow_dvd_pow p hab) (ZMod (p ^ b)))⟩ + +theorem exists_primePower_character_conductor_row {I : Type*} [Fintype I] + {p A a : ℕ} (hp : p.Prime) (ha : a ≤ A) [NeZero (p ^ A)] [NeZero (p ^ a)] + (χ : AddChar (I → ZMod (p ^ A)) ℂ) (horder : orderOf χ = p ^ a) : + ∃ coeff : I → ZMod (p ^ a), + (0 < a → ∀ {b : ℕ} (hab : b ≤ a), + ∃ i, IsUnit (ZMod.castHom (pow_dvd_pow p hab) (ZMod (p ^ b)) (coeff i))) ∧ + ∀ x, χ x = ZMod.stdAddChar + (∑ i, coeff i * ZMod.castHom (pow_dvd_pow p ha) (ZMod (p ^ a)) (x i)) := by + classical + obtain ⟨ψ, hψ, hord⟩ := exists_primePower_character_descent ha χ horder + obtain ⟨coeff, hcoeff⟩ := exists_zmod_character_row ψ + refine ⟨coeff, ?_, ?_⟩ + · intro ha0 b hab + exact primePower_primitive_row_cast hab coeff + (primePower_character_row_primitive hp ha0 ψ coeff hcoeff hord) + · intro x + calc + χ x = ψ (zmodPiReduction (pow_dvd_pow p ha) x) := + (congrArg (fun θ : AddChar (I → ZMod (p ^ A)) ℂ => θ x) hψ).symm + _ = _ := hcoeff _ + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators + +theorem exists_primePower_tagged_conductor_rows + {Tag : Type*} [Fintype Tag] [DecidableEq Tag] + {I : Tag → Type*} [∀ j, Fintype (I j)] + {p A : ℕ} [NeZero p] (hp : p.Prime) + (χ : AddChar (∀ j, I j → ZMod (p ^ A)) ℂ) : + ∃ (depth : Tag → ℕ) (hdepth : ∀ j, depth j ≤ A) + (coeff : ∀ j, I j → ZMod (p ^ depth j)), + (∀ j, orderOf (finiteProductCharacterCoordinate χ j) = p ^ depth j) ∧ + (∀ j, 0 < depth j → ∀ {b : ℕ} (hb : b ≤ depth j), + ∃ i, IsUnit (ZMod.castHom (pow_dvd_pow p hb) (ZMod (p ^ b)) (coeff j i))) ∧ + (∀ j (x : I j → ZMod (p ^ A)), finiteProductCharacterCoordinate χ j x = + ZMod.stdAddChar (∑ i, coeff j i * + ZMod.castHom (pow_dvd_pow p (hdepth j)) (ZMod (p ^ depth j)) (x i))) ∧ + ∀ x, χ x = ∏ j, ZMod.stdAddChar (∑ i, coeff j i * + ZMod.castHom (pow_dvd_pow p (hdepth j)) (ZMod (p ^ depth j)) (x j i)) := by + classical + have hkill : ∀ j (x : I j → ZMod (p ^ A)), (p ^ A) • x = 0 := by + intro j x + ext i + simp only [Pi.smul_apply, nsmul_eq_mul, ZMod.natCast_self, zero_mul, Pi.zero_apply] + have horderDiv (j : Tag) : orderOf (finiteProductCharacterCoordinate χ j) ∣ p ^ A := + finiteProductCharacterCoordinate_order_dvd χ (fun _ => p ^ A) hkill j + choose depth hdepth horder using fun j => (Nat.dvd_prime_pow hp).mp (horderDiv j) + choose coeff hcoeff hrow using fun j => + exists_primePower_character_conductor_row hp (hdepth j) + (finiteProductCharacterCoordinate χ j) (horder j) + refine ⟨depth, hdepth, coeff, horder, hcoeff, hrow, ?_⟩ + intro x + calc + χ x = ∏ j, finiteProductCharacterCoordinate χ j (x j) := + (congrArg (fun θ : AddChar (∀ j, I j → ZMod (p ^ A)) ℂ => θ x) + (finiteProductCharacter_decomposition χ)).symm + _ = _ := Finset.prod_congr rfl (fun j _ => hrow j (x j)) + +theorem exists_primePower_tagged_ambient_rows + {Tag : Type*} [Fintype Tag] [DecidableEq Tag] + {I : Tag → Type*} [∀ j, Fintype (I j)] + {p A : ℕ} [NeZero p] (hp : p.Prime) + (χ : AddChar (∀ j, I j → ZMod (p ^ A)) ℂ) : + ∃ (depth : Tag → ℕ) (hdepth : ∀ j, depth j ≤ A) + (coeff : ∀ j, I j → ZMod (p ^ A)), + (∀ j, orderOf (finiteProductCharacterCoordinate χ j) = p ^ depth j) ∧ + (∀ j, 0 < depth j → ∀ {b : ℕ} (hb : b ≤ depth j), + ∃ i, IsUnit (ZMod.castHom (pow_dvd_pow p (hb.trans (hdepth j))) + (ZMod (p ^ b)) (coeff j i))) ∧ + ∀ x, χ x = ZMod.stdAddChar + (∑ j, ((p ^ (A - depth j) : ℕ) : ZMod (p ^ A)) * ∑ i, coeff j i * x j i) := by + classical + obtain ⟨depth, hdepth, c, horder, hunit, hrow, hphase⟩ := + exists_primePower_tagged_conductor_rows hp χ + let coeff := fun j i => ((c j i).val : ZMod (p ^ A)) + refine ⟨depth, hdepth, coeff, horder, ?_, ?_⟩ + · intro j hj b hb + obtain ⟨i, hi⟩ := hunit j hj hb + refine ⟨i, ?_⟩ + simpa only [coeff, map_natCast, ZMod.castHom_apply, ZMod.cast_eq_val] using hi + · intro x + rw [hphase] + calc + _ = ∏ j, ZMod.stdAddChar + (((p ^ (A - depth j) : ℕ) : ZMod (p ^ A)) * ∑ i, coeff j i * x j i) := by + apply Finset.prod_congr rfl + intro j _ + simpa only [coeff, zmodPiReduction_apply, mul_assoc, ← Finset.mul_sum] using + (stdAddChar_primePower_row_scaling (hdepth j) (c j) (x j)).symm + _ = ZMod.stdAddChar (∑ j, ((p ^ (A - depth j) : ℕ) : ZMod (p ^ A)) * + ∑ i, coeff j i * x j i) := + (map_sum ZMod.stdAddChar.toAddMonoidHom + (fun j => ((p ^ (A - depth j) : ℕ) : ZMod (p ^ A)) * + ∑ i, coeff j i * x j i) Finset.univ).symm + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/PrincipalCoefficientResidueSpectrum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/PrincipalCoefficientResidueSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a96a828ae1013fbb329ac519d129cf4a91a899d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/PrincipalCoefficientResidueSpectrum.lean @@ -0,0 +1,435 @@ +import OAI.Combinatorics.Progressions.Fourier.FixedPrincipalCoefficientSpectrum +import OAI.Combinatorics.Progressions.Lattices.OriginalKernelResidueRetained + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical +open CircleFourier + +private theorem independent_residue_weighted_product + {B : Type*} [Fintype B] [DecidableEq B] + {X R : B → Type*} [∀ b, Fintype (X b)] [∀ b, Fintype (R b)] + [∀ b, DecidableEq (R b)] + (p : ∀ b, FiniteProbabilityWeights (X b)) (label : ∀ b, X b → R b) + (a : (∀ b, R b) → ℂ) (g : ∀ b, X b → ℂ) : + (FiniteProbabilityWeights.pi p).complexMean + (fun x => a (fun b => label b (x b)) * ∏ b, g b (x b)) = + ∑ r, a r * ∏ b, (p b).fiberComplexMean (label b) (r b) (g b) := by + let f := fun (r : ∀ b, R b) (x : ∀ b, X b) => a r * ∏ b, if label b (x b) = r b then g b (x b) else 0 + have hf (x : ∀ b, X b) : (∑ r, f r x) = + a (fun b => label b (x b)) * ∏ b, g b (x b) := by + simp only [f, Fintype.prod_ite_zero, ← funext_iff, mul_ite, mul_zero] + simp + rw [show (fun x => a (fun b => label b (x b)) * ∏ b, g b (x b)) = + fun x => ∑ r, f r x from funext (fun x => (hf x).symm), + FiniteProbabilityWeights.complexMean_sum] + apply Finset.sum_congr rfl + intro r _ + rw [show f r = fun x => a r * ∏ b, + if label b (x b) = r b then g b (x b) else 0 from rfl, + FiniteProbabilityWeights.complexMean_mul_left, + FiniteProbabilityWeights.complexMean_pi_product p + (fun b x => if label b x = r b then g b x else 0)] + rfl + +noncomputable def weightedModerateResidueBlockCoefficient + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (q : ℕ) [NeZero q] (r : ZMod q) (M : ℕ) [NeZero M] + (J : Finset (Finset I)) (offset : ℤ) (k : J → Fin M) : ℂ := + c.source.fiberComplexMean (fun z => ((z none : ℤ) : ZMod q)) r + (fun z => (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean (fun x => + rectangularGridCharacter M k (weightedModerateIntegerBlock c s J offset (z, x)))) + +theorem weightedModerateIntegerJetSum_residue_coefficient + {B : Type*} [Fintype B] [DecidableEq B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (q : ℕ) [NeZero q] (a : (B → ZMod q) → ℂ) + (M : ℕ) [NeZero M] (J : Finset (Finset I)) + (offset : B → ℤ) (shift : J → ℤ) (k : J → Fin M) : + (weightedModerateIntegerProductSource c s).complexMean (fun x => + a (fun b => ((x b).1 none : ℤ)) * + rectangularGridCharacter M k (weightedModerateIntegerJetSum c s J offset shift x)) = + rectangularGridCharacter M k shift * ∑ r : B → ZMod q, + a r * ∏ b, weightedModerateResidueBlockCoefficient (c b) (s b) q (r b) M J (offset b) k := by + simp only [weightedModerateIntegerJetSum, rectangularGridCharacter_add, + rectangularGridCharacter_fintype_sum] + have he (x : ∀ b, IntegerScalarCubeBox Empty (c b).length × + (∀ j, IntegerScalarCubeBox I (s b j).length)) : a (fun b => (((x b).1 none : ℤ) : ZMod q)) * + (rectangularGridCharacter M k shift * + ∏ b, rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) (x b))) = + rectangularGridCharacter M k shift * + (a (fun b => (((x b).1 none : ℤ) : ZMod q)) * + ∏ b, rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) (x b))) := by ring + simp_rw [he] + rw [FiniteProbabilityWeights.complexMean_mul_left] + congr 1 + rw [weightedModerateIntegerProductSource, independent_residue_weighted_product + (fun b => weightedModerateIntegerSource (c b) (s b)) + (fun b z => ((z.1 none : ℤ) : ZMod q)) a + (fun b z => rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) z))] + apply Finset.sum_congr rfl + intro r _ + congr 1 + apply Finset.prod_congr rfl + intro b _ + unfold FiniteProbabilityWeights.fiberComplexMean weightedModerateIntegerSource + weightedModerateResidueBlockCoefficient + rw [FiniteProbabilityWeights.complexMean_prod] + congr 1 + funext z + by_cases hz : (z none : ℤ) = (r b : ZMod q) + · simp only [hz, ite_true] + · simp only [hz, ite_false, FiniteProbabilityWeights.complexMean_const] + +theorem weightedModerateResidueBlockCoefficient_eq_condition + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (q : ℕ) [NeZero q] (r : ZMod q) (M : ℕ) [NeZero M] + (J : Finset (Finset I)) (offset : ℤ) (k : J → Fin M) + (hr : 0 < c.source.mass (Finset.univ.filter + (fun z => ((z none : ℤ) : ZMod q) = r))) : + weightedModerateResidueBlockCoefficient c s q r M J offset k = + (c.source.mass (Finset.univ.filter (fun z => ((z none : ℤ) : ZMod q) = r)) : ℂ) * + (c.source.condition _ hr).complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean (fun x => + rectangularGridCharacter M k (weightedModerateIntegerBlock c s J offset (z, x)))) := by + exact c.source.fiberComplexMean_eq_condition _ _ _ hr + +theorem weightedModerateResidueBlockCoefficient_norm_le + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (q : ℕ) [NeZero q] (r : ZMod q) (M : ℕ) [NeZero M] + (J : Finset (Finset I)) (offset : ℤ) (k : J → Fin M) : + ‖weightedModerateResidueBlockCoefficient c s q r M J offset k‖ ≤ + (c.source.fiberLaw (fun z => ((z none : ℤ) : ZMod q))).weight r := by + unfold weightedModerateResidueBlockCoefficient FiniteProbabilityWeights.fiberComplexMean + apply (c.source.norm_complexMean_le_mean_norm _).trans + apply c.source.mean_mono + intro z + by_cases hz : ((z none : ℤ) : ZMod q) = r + · simp only [hz, ite_true] + have hb := (FiniteProbabilityWeights.pi (fun j => (s j).source)).norm_complexMean_le_mean_norm + (fun x => rectangularGridCharacter M k (weightedModerateIntegerBlock c s J offset (z, x))) + simpa only [rectangularGridCharacter_norm, FiniteProbabilityWeights.mean_const] using hb + · simp only [hz, ite_false, norm_zero, le_refl] + +theorem weightedModerateResidueProduct_coefficient_mass + {B : Type*} [Fintype B] [DecidableEq B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (q : ℕ) [NeZero q] (a : (B → ZMod q) → ℂ) (ha : ∀ r, ‖a r‖ ≤ 1) + (M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (k : J → Fin M) : + (∑ r : B → ZMod q, ‖a r * ∏ b, + weightedModerateResidueBlockCoefficient (c b) (s b) q (r b) M J (offset b) k‖) ≤ 1 := by + let p := fun b => (c b).source.fiberLaw (fun z => ((z none : ℤ) : ZMod q)) + calc + _ ≤ ∑ r : B → ZMod q, ∏ b, (p b).weight (r b) := by + apply Finset.sum_le_sum + intro r _ + rw [norm_mul, norm_prod] + apply (mul_le_of_le_one_left (Finset.prod_nonneg (fun _ _ => norm_nonneg _)) (ha r)).trans + exact Finset.prod_le_prod₀ (fun _ _ => norm_nonneg _) + (fun b _ => weightedModerateResidueBlockCoefficient_norm_le (c b) (s b) q (r b) M J (offset b) k) + _ = 1 := (FiniteProbabilityWeights.pi p).total + +theorem weighted_integerGridDensity_fourier + {X O : Type*} [Fintype X] [Fintype O] [DecidableEq O] + (p : FiniteProbabilityWeights X) (Y : X → O → ℤ) (a : X → ℂ) + (K M : ℕ) [NeZero M] (z : O → ℤ) : + (K : ℂ) ^ Fintype.card O * p.complexMean + (fun x => if integerGridResidue M (Y x) = integerGridResidue M z then a x else 0) = + ((K : ℂ) / M) ^ Fintype.card O * ∑ k : O → Fin M, + p.complexMean (fun x => a x * rectangularGridCharacter M k (Y x)) * + star (rectangularGridCharacter M k z) := by + have hi : (∑ k : O → Fin M, + p.complexMean (fun x => a x * rectangularGridCharacter M k (Y x)) * + star (rectangularGridCharacter M k z)) = + (M : ℂ) ^ Fintype.card O * p.complexMean + (fun x => if integerGridResidue M (Y x) = integerGridResidue M z then a x else 0) := by + calc + _ = ∑ x, (p.weight x : ℂ) * a x * + (∑ k : O → Fin M, rectangularGridCharacter M k (Y x) * + star (rectangularGridCharacter M k z)) := by + simp only [FiniteProbabilityWeights.complexMean, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro x _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro k _ + ring + _ = _ := by + simp only [rectangularGridCharacter_orthogonality, + FiniteProbabilityWeights.complexMean, Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + by_cases hx : integerGridResidue M (Y x) = integerGridResidue M z <;> simp [hx, mul_comm, mul_left_comm] + rw [hi, div_pow] + have hM : (M : ℂ) ≠ 0 := by exact_mod_cast NeZero.ne M + field_simp + +theorem weightedModerateIntegerJetSum_residue_density_fourier + {B : Type*} [Fintype B] [DecidableEq B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (q : ℕ) [NeZero q] (a : (B → ZMod q) → ℂ) + (K M : ℕ) [NeZero M] (J : Finset (Finset I)) + (offset : B → ℤ) (shift z : J → ℤ) : + (K : ℂ) ^ J.card * (weightedModerateIntegerProductSource c s).complexMean (fun x => + if integerGridResidue M (weightedModerateIntegerJetSum c s J offset shift x) = + integerGridResidue M z then a (fun b => ((x b).1 none : ℤ)) else 0) = + ((K : ℂ) / M) ^ J.card * ∑ k : J → Fin M, + (∑ r : B → ZMod q, a r * ∏ b, + weightedModerateResidueBlockCoefficient (c b) (s b) q (r b) M J (offset b) k) * + (rectangularGridCharacter M k shift * star (rectangularGridCharacter M k z)) := by + rw [show J.card = Fintype.card J from Fintype.card_coe J |>.symm, + weighted_integerGridDensity_fourier] + simp only [Fintype.card_coe, weightedModerateIntegerJetSum_residue_coefficient] + congr 1 + apply Finset.sum_congr rfl + intro k _ + ring + +theorem weightedModerateIntegerJetSum_coefficient_mixture + {B : Type*} [Fintype B] [DecidableEq B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (a : (∀ b, IntegerScalarCubeBox Empty (c b).length) → ℂ) + (M : ℕ) [NeZero M] (J : Finset (Finset I)) + (offset : B → ℤ) (shift : J → ℤ) (k : J → Fin M) : + (weightedModerateIntegerProductSource c s).complexMean (fun x => + a (fun b => (x b).1) * + rectangularGridCharacter M k (weightedModerateIntegerJetSum c s J offset shift x)) = + rectangularGridCharacter M k shift * + (FiniteProbabilityWeights.pi (fun b => (c b).source)).complexMean (fun z => a z * ∏ b, + (FiniteProbabilityWeights.pi (fun j => (s b j).source)).complexMean (fun x => + rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) (z b,x)))) := by + simp only [weightedModerateIntegerJetSum, rectangularGridCharacter_add, + rectangularGridCharacter_fintype_sum] + have he (x : ∀ b, IntegerScalarCubeBox Empty (c b).length × + (∀ j, IntegerScalarCubeBox I (s b j).length)) : + a (fun b => (x b).1) * (rectangularGridCharacter M k shift * + ∏ b, rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) (x b))) = + rectangularGridCharacter M k shift * (a (fun b => (x b).1) * + ∏ b, rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) (x b))) := by ring + simp_rw [he] + rw [FiniteProbabilityWeights.complexMean_mul_left] + congr 1 + rw [weightedModerateIntegerProductSource, independent_residue_weighted_product + (fun b => weightedModerateIntegerSource (c b) (s b)) (fun _ z => z.1) a + (fun b z => rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) z))] + have hb (b) (z : IntegerScalarCubeBox Empty (c b).length) : + (weightedModerateIntegerSource (c b) (s b)).fiberComplexMean (fun u => u.1) z + (fun x => rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) x)) = + ((c b).source.weight z : ℂ) * + (FiniteProbabilityWeights.pi (fun j => (s b j).source)).complexMean (fun x => + rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) (z,x))) := by + unfold FiniteProbabilityWeights.fiberComplexMean weightedModerateIntegerSource + rw [FiniteProbabilityWeights.complexMean_prod] + change (∑ u, ((c b).source.weight u : ℂ) * _) = _ + have hi (u : IntegerScalarCubeBox Empty (c b).length) : + (FiniteProbabilityWeights.pi (fun j => (s b j).source)).complexMean (fun x => + if u = z then rectangularGridCharacter M k + (weightedModerateIntegerBlock (c b) (s b) J (offset b) (u,x)) else 0) = + if u = z then (FiniteProbabilityWeights.pi (fun j => (s b j).source)).complexMean (fun x => + rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J (offset b) (u,x))) else 0 := by + by_cases hu : u = z <;> simp [hu, FiniteProbabilityWeights.complexMean_const] + simp only [hi, mul_ite, mul_zero] + simp + simp only [hb, Finset.prod_mul_distrib, ← Complex.ofReal_prod, + FiniteProbabilityWeights.complexMean, FiniteProbabilityWeights.pi] + apply Finset.sum_congr rfl + intro z _ + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem spectrumTail_complexMean_weighted_on_support + {R O : Type*} [Fintype R] [Fintype O] [DecidableEq O] + (p : FiniteProbabilityWeights R) (a : R → ℂ) (ha : ∀ r, ‖a r‖ ≤ 1) + (f : R → O → ℂ) (S : Finset O) {ε : ℝ} + (he : ∀ r, p.weight r ≠ 0 → spectrumTail S (fun k => ‖f r k‖) ≤ ε) : + spectrumTail S (fun k => ‖p.complexMean (fun r => a r * f r k)‖) ≤ ε := by + unfold spectrumTail + calc + _ ≤ ∑ k, if k ∈ S then 0 else p.mean (fun r => ‖f r k‖) := by + apply Finset.sum_le_sum + intro k _ + by_cases hk : k ∈ S + · simp only [hk, ite_true, le_refl] + simp only [hk, ite_false] + apply (p.norm_complexMean_le_mean_norm _).trans + apply p.mean_mono + intro r + rw [norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (ha r) + _ = p.mean (fun r => spectrumTail S (fun k => ‖f r k‖)) := by + unfold FiniteProbabilityWeights.mean spectrumTail + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + by_cases hk : k ∈ S <;> simp [hk] + _ ≤ ε := (p.mean_mono_on_support he).trans_eq (p.mean_const ε) + +theorem weightedModerateIntegerProductSource_short_correlated_spectrum_tail + {B I : Type*} [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] {n N : ℕ} + (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (a : (∀ b, IntegerScalarCubeBox Empty (c b).length) → ℂ) + (ha : ∀ z, ‖a z‖ ≤ 1) + (hpositive : ∀ b z, (c b).source.weight z ≠ 0 → + ((c b).length : ℝ) / 4 ≤ (z none : ℝ)) + (hshort : ∀ b, (c b).length ≤ N) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} {t : ℕ} + (hU : 1 ≤ U) (hbudget : scalarCubePrimitiveEnvelope Empty A 1 0 (N + 1) ≤ U) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hlen : ∀ b j, L ≤ (s b j).length) + {M : ℕ} [NeZero M] (hM : 0 < M) + (hscale : ∀ b, (M : ℝ) / (((c b).length : ℝ) * + ∏ j, ((s b j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) (shift : J → ℤ) + (hB : positiveModerateSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant n J.card U (4 * V) * + 2 ^ positiveModerateSpectrumExponent n J.card + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ ε) : + spectrumTail (positiveModerateSpectrumCover J M n U (4 * V) L ζ) + (fun k => ‖(weightedModerateIntegerProductSource c s).complexMean (fun x => + a (fun b => (x b).1) * rectangularGridCharacter M k + (weightedModerateIntegerJetSum c s J (fun _ => 0) shift x))‖) ≤ ε := by + simp_rw [weightedModerateIntegerJetSum_coefficient_mixture, + norm_mul, rectangularGridCharacter_norm, one_mul] + apply spectrumTail_complexMean_weighted_on_support _ a ha + intro z hz + have hz' (b : B) : (c b).source.weight (z b) ≠ 0 := by + intro hb + apply hz + exact Finset.prod_eq_zero (Finset.mem_univ b) hb + have htail := fixedPositiveCoefficientSource_uniform_spectrum_tail c s z hz' + hpositive hshort A hA hU hbudget h hV hW hL hζ hζ1 hε hlen hM hscale + J hJ hB hsize haccuracy + have he (b : B) (k : J → Fin M) + (x : ∀ j, IntegerScalarCubeBox I (s b j).length) : + rectangularGridCharacter M k (weightedModerateIntegerBlock (c b) (s b) J 0 (z b, x)) = + CircleFourier.character + (((z b none : ℝ) * booleanBlockPhase (gridJetFrequency M J k) + (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle) := by + rw [rectangularGridCharacter_eq] + simp only [weightedModerateIntegerBlock, zero_add, integerBooleanBlockJet_scaled_pairing] + simpa only [he] using htail + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +variable {K T γ : ℝ} (hK : 0 < K) (hT : 0 < T) (hγ : 0 < γ) + (hlarge : 8 * (probabilityProfileLipschitz : ℝ) ≤ (γ / 2) * (K / T)) + (q : ℕ) [NeZero q] (hq : 0 < q) + (hlength : scalarCubeNormalizationThreshold Empty q 32 + (256 * probabilityProfileLipschitz) ≤ principalIntervalLength K T γ) + +theorem principalCoefficientResidueBlock_eq + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin n → NormalizedScalarCubeSource I) (r : ZMod q) + (M : ℕ) [NeZero M] (J : Finset (Finset I)) (k : J → Fin M) : + weightedModerateResidueBlockCoefficient (principalNormalizedSource hK hT hγ hlarge) + s q r M J 0 k = + (((principalNormalizedSource hK hT hγ hlarge).source.fiberLaw + (fun z => ((z none : ℤ) : ZMod q))).weight r : ℂ) * + weightedModerateGridCoefficient + (principalCoefficientResidueSource hK hT hγ hlarge q hq r hlength) s 0 M J k := by + have hp := principalCoefficientResidue_mass_pos_filter hK hT hγ hlarge q hq r hlength + rw [weightedModerateResidueBlockCoefficient_eq_condition _ s q r M J 0 k hp, + FiniteProbabilityWeights.fiberLaw_weight_eq_mass] + congr 1 + have hl := principalCoefficientResidueSource_law_filter hK hT hγ hlarge q hq r hlength + unfold weightedModerateGridCoefficient + rw [hl] + congr 1 + funext z + congr 1 + funext x + rw [rectangularGridCharacter_eq] + simp only [weightedModerateIntegerBlock, integerBooleanBlockJet_scaled_pairing, + zero_add] + +include hq hlength in +theorem principalCoefficientResidue_correlated_spectrum_tail + {B I : Type*} [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] {n : ℕ} + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (a : (B → ZMod q) → ℂ) (ha : ∀ r, ‖a r‖ ≤ 1) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} {t : ℕ} + (hU : scalarCubePrimitiveEnvelope Empty A 32 (256 * probabilityProfileLipschitz) q ≤ U) + (hs : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hlen : ∀ b j, L ≤ (s b j).length) + {M : ℕ} [NeZero M] (hM : 0 < M) + (hscale : ∀ b, (M : ℝ) / ((principalIntervalLength K T γ : ℝ) * + ∏ j, ((s b j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : positiveModerateSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (haccuracy : (2 * positiveModerateSpectrumConstant n J.card U V * + 2 ^ positiveModerateSpectrumExponent n J.card + + W * (2 ^ positiveModerateLengthExponent n * positiveModerateLengthConstant n U) ^ t) * ζ ≤ ε) : + spectrumTail (positiveModerateSpectrumCover J M n U V L ζ) + (fun k => ‖∑ r : B → ZMod q, a r * ∏ b, + weightedModerateResidueBlockCoefficient (principalNormalizedSource hK hT hγ hlarge) + (s b) q (r b) M J 0 k‖) ≤ ε := by + let p := (principalNormalizedSource hK hT hγ hlarge).source.fiberLaw + (fun z => ((z none : ℤ) : ZMod q)) + let c := fun (r : B → ZMod q) b => + principalCoefficientResidueSource hK hT hγ hlarge q hq (r b) hlength + have hc (r : B → ZMod q) (b : B) : ScalarCubePrimitiveBudget (c r b) A U := + (principalCoefficientResidueSource_primitive hK hT hγ hlarge q hq (r b) hlength A).mono hU + have ht (r : B → ZMod q) : + spectrumTail (positiveModerateSpectrumCover J M n U V L ζ) + (fun k => ‖∏ b, weightedModerateGridCoefficient (c r b) (s b) 0 M J k‖) ≤ ε := by + apply weightedPositiveModerate_uniform_spectrum_tail (c r) s A hA + ((principalCoefficientResidueSource_primitive hK hT hγ hlarge q hq 0 hlength A).one_le.trans hU) + (hc r) hs + (fun b => principalCoefficientResidueSource_positive_support hK hT hγ hlarge q hq (r b) hlength) + hV hW hL hζ hζ1 hε hlen hM hscale J hJ hB hsize haccuracy + have he (k : J → Fin M) : (∑ r : B → ZMod q, a r * ∏ b, + weightedModerateResidueBlockCoefficient (principalNormalizedSource hK hT hγ hlarge) + (s b) q (r b) M J 0 k) = + (FiniteProbabilityWeights.pi (fun _ : B => p)).complexMean + (fun r => a r * ∏ b, weightedModerateGridCoefficient (c r b) (s b) 0 M J k) := by + simp only [principalCoefficientResidueBlock_eq hK hT hγ hlarge q hq hlength, + Finset.prod_mul_distrib, ← Complex.ofReal_prod, + FiniteProbabilityWeights.complexMean, FiniteProbabilityWeights.pi] + apply Finset.sum_congr rfl + intro r _ + ring + simp_rw [he] + exact spectrumTail_complexMean_weighted_on_support _ a ha _ _ (fun r _ => ht r) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ProductFrequencyKernel.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ProductFrequencyKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..89982b333ebe5138192c0cac23fccaaf5770856c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ProductFrequencyKernel.lean @@ -0,0 +1,100 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeCentralSeed + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct BigOperators + +variable {ι : Type*} [Fintype ι] {L : ι → Type*} + [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] + +noncomputable def piFrequency (eta : ∀ i, L i →ₗ[ℚ] ℚ) : (∀ i, L i) →ₗ[ℚ] ℚ := + ∑ i, (eta i).comp (liePiEval i).toLinearMap + +theorem piFrequency_apply (eta : ∀ i, L i →ₗ[ℚ] ℚ) (x : ∀ i, L i) : + piFrequency eta x = ∑ i, eta i (x i) := by + simp only [piFrequency, LinearMap.sum_apply, LinearMap.comp_apply, LieHom.coe_toLinearMap, + liePiEval_apply] + +theorem piFrequency_single (eta : ∀ i, L i →ₗ[ℚ] ℚ) (i : ι) (x : L i) : + letI := Classical.decEq ι + piFrequency eta (Pi.single i x) = eta i x := by + classical + rw [piFrequency_apply, Finset.sum_eq_single i] + · rw [Pi.single_eq_same] + · intro j _ hji + rw [Pi.single_eq_of_ne hji, map_zero] + · simp + +theorem realify_piFrequency (eta : ∀ i, L i →ₗ[ℚ] ℚ) (x : ℝ ⊗[ℚ] (∀ i, L i)) : + realifyFunctional (piFrequency eta) x = + ∑ i, realifyFunctional (eta i) (realificationLieHom (liePiEval i) x) := by + induction x using TensorProduct.inductionOn with + | tmul r x => + simp only [realifyFunctional_tmul, piFrequency_apply, Rat.cast_sum, + realificationLieHom_tmul, liePiEval_apply, Finset.mul_sum] + | add x y hx hy => simp only [map_add, hx, hy, Finset.sum_add_distrib] + +namespace RationalFilteredNilmanifold + +variable {s : ℕ} {d : ι → ℕ} (D : ∀ i, RationalFilteredNilmanifold (L i) s (d i)) + +theorem piFrequency_basis (eta : ∀ i, L i →ₗ[ℚ] ℚ) + (k : Fin (Fintype.card (Σ i, Fin (d i)))) : + let z := (Fintype.equivFin (Σ i, Fin (d i))).symm k + piFrequency eta ((pi D).basis k) = eta z.1 ((D z.1).basis z.2) := by + classical + change piFrequency eta (productFinBasis D k) = _ + rw [productFinBasis, Basis.reindex_apply] + generalize hz : (Fintype.equivFin (Σ i, Fin (d i))).symm k = z + rcases z with ⟨i, j⟩ + rw [Pi.basis_apply, piFrequency_single] + +theorem piFrequency_logHeight (eta : ∀ i, L i →ₗ[ℚ] ℚ) {p : ℝ} + (hheight : ∀ i j, rationalLogHeight (eta i ((D i).basis j)) ≤ p) + (k : Fin (Fintype.card (Σ i, Fin (d i)))) : + rationalLogHeight (piFrequency eta ((pi D).basis k)) ≤ p := by + rw [piFrequency_basis D] + exact hheight _ _ + +end RationalFilteredNilmanifold +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +variable {ι : Type*} [Fintype ι] {L : ι → Type*} + [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] + +theorem realify_piFrequency_eq_component (eta : ∀ i, L i →ₗ[ℚ] ℚ) (i : ι) + (x : ℝ ⊗[ℚ] (∀ i, L i)) + (hother : ∀ j, j ≠ i → realificationLieHom (liePiEval j) x = 0) : + realifyFunctional (piFrequency eta) x = + realifyFunctional (eta i) (realificationLieHom (liePiEval i) x) := by + classical + rw [realify_piFrequency, Finset.sum_eq_single i] + · intro j _ hji + rw [hother j hji, map_zero] + · simp + +theorem realify_component_zero_of_piFrequency_zero (eta : ∀ i, L i →ₗ[ℚ] ℚ) (i : ι) + (x : ℝ ⊗[ℚ] (∀ i, L i)) (hzero : realifyFunctional (piFrequency eta) x = 0) + (hother : ∀ j, j ≠ i → realificationLieHom (liePiEval j) x = 0) : + realifyFunctional (eta i) (realificationLieHom (liePiEval i) x) = 0 := by + rw [← realify_piFrequency_eq_component eta i x hother] + exact hzero + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/QuadraticFrequencyCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Fourier/QuadraticFrequencyCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..cdc5cc52b57734ad88cddb6014fabed9e8925338 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/QuadraticFrequencyCoordinates.lean @@ -0,0 +1,571 @@ +import OAI.Combinatorics.Progressions.Geometry.SmallDifferenceGraphCoordinates + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [Fintype G] + +theorem finiteFourierCoeff_convolution (f g : G → ℂ) (χ : AddChar G ℂ) : + finiteFourierCoeff (finiteConvolution f g) χ = finiteFourierCoeff f χ * finiteFourierCoeff g χ := by + calc + _ = 𝔼 x, f x * finiteFourierCoeff (fun y => g (y - x)) χ := by + simp only [finiteFourierCoeff, finiteConvolution, Finset.expect_mul, Finset.mul_expect] + rw [Finset.expect_comm] + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro y _ + ring + _ = 𝔼 x, f x * (star (χ x) * finiteFourierCoeff g χ) := by + simp_rw [finiteFourierCoeff_translate] + _ = _ := by + change (𝔼 x, f x * (star (χ x) * finiteFourierCoeff g χ)) = + (𝔼 x, f x * star (χ x)) * finiteFourierCoeff g χ + rw [Finset.expect_mul] + apply Finset.expect_congr rfl + intro x _ + ring + +theorem finiteFourierCoeff_reflected_conjugate (f : G → ℂ) (χ : AddChar G ℂ) : + finiteFourierCoeff (fun x => star (f (-x))) χ = star (finiteFourierCoeff f χ) := by + rw [finiteFourierCoeff, star_finiteFourierCoeff] + apply Fintype.expect_equiv (Equiv.neg G) + intro x + simp only [Equiv.neg_apply, AddChar.map_neg_eq_inv, AddChar.inv_apply_eq_conj] + rfl + +theorem gowersNorm_two_fourier (f : G → ℂ) : + gowersNorm 2 f ^ 4 = ∑ χ : AddChar G ℂ, ‖finiteFourierCoeff f χ‖ ^ 4 := by + let C := finiteConvolution f (fun x => star (f (-x))) + calc + _ = 𝔼 h, ‖𝔼 x, multiplicativeDerivative f h x‖ ^ 2 := by + simpa only [gowersNorm_one, Nat.zero_add, show 2 ^ 2 = 4 by norm_num, + show 2 ^ 1 = 2 by norm_num] using gowersNorm_derivative 0 f + _ = 𝔼 h, ‖C h‖ ^ 2 := by + apply Fintype.expect_equiv (Equiv.neg G) + intro h + simp only [C, finiteConvolution, Equiv.neg_apply, neg_sub, + sub_neg_eq_add, multiplicativeDerivative] + _ = ∑ χ : AddChar G ℂ, ‖finiteFourierCoeff C χ‖ ^ 2 := (finiteFourier_parseval C).symm + _ = _ := by + apply Finset.sum_congr rfl + intro χ _ + simp only [C, finiteFourierCoeff_convolution, finiteFourierCoeff_reflected_conjugate, + norm_mul, norm_star] + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [Fintype G] + +theorem cross_correlation_fourier_energy (f g : G → ℂ) : + (𝔼 h, ‖𝔼 x, f x * star (g (x + h))‖ ^ 2) = + ∑ χ : AddChar G ℂ, ‖finiteFourierCoeff f χ‖ ^ 2 * ‖finiteFourierCoeff g χ‖ ^ 2 := by + let C := finiteConvolution f (fun x => star (g (-x))) + calc + _ = 𝔼 h, ‖C h‖ ^ 2 := by + apply Fintype.expect_equiv (Equiv.neg G) + intro h + simp only [C, finiteConvolution, Equiv.neg_apply, neg_sub, sub_neg_eq_add] + _ = ∑ χ : AddChar G ℂ, ‖finiteFourierCoeff C χ‖ ^ 2 := (finiteFourier_parseval C).symm + _ = _ := by + simp only [C, finiteFourierCoeff_convolution, finiteFourierCoeff_reflected_conjugate, + norm_mul, norm_star, mul_pow] + +theorem exists_large_fourier_of_mean_cross_correlation (f g : G → ℂ) + (hf : ∀ x, ‖f x‖ ≤ 1) : + ∃ χ : AddChar G ℂ, (𝔼 h, ‖𝔼 x, f x * star (g (x + h))‖) ≤ ‖finiteFourierCoeff g χ‖ := by + classical + obtain ⟨χ, _, hmax⟩ := Finset.exists_max_image Finset.univ + (fun χ : AddChar G ℂ => ‖finiteFourierCoeff g χ‖) Finset.univ_nonempty + have hmass : (∑ ψ : AddChar G ℂ, ‖finiteFourierCoeff f ψ‖ ^ 2) ≤ 1 := by + rw [finiteFourier_parseval] + apply Finset.expect_le Finset.univ_nonempty + intro x _ + simpa only [one_pow] using pow_le_pow_left₀ (norm_nonneg _) (hf x) 2 + have henergy : (𝔼 h, ‖𝔼 x, f x * star (g (x + h))‖ ^ 2) ≤ ‖finiteFourierCoeff g χ‖ ^ 2 := by + rw [cross_correlation_fourier_energy] + calc + _ ≤ ∑ ψ : AddChar G ℂ, ‖finiteFourierCoeff f ψ‖ ^ 2 * ‖finiteFourierCoeff g χ‖ ^ 2 := by + apply Finset.sum_le_sum + intro ψ _ + exact mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (norm_nonneg _) (hmax ψ (Finset.mem_univ ψ)) 2) (sq_nonneg _) + _ = (∑ ψ : AddChar G ℂ, ‖finiteFourierCoeff f ψ‖ ^ 2) * ‖finiteFourierCoeff g χ‖ ^ 2 := + (Finset.sum_mul _ _ _).symm + _ ≤ ‖finiteFourierCoeff g χ‖ ^ 2 := mul_le_of_le_one_left (sq_nonneg _) hmass + refine ⟨χ, (sq_le_sq₀ (Finset.expect_nonneg (fun _ _ => norm_nonneg _)) (norm_nonneg _)).mp ?_⟩ + exact (expect_square_le (fun h => ‖𝔼 x, f x * star (g (x + h))‖)).trans henergy + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_large_fourier_of_gowers_two {G : Type*} [AddCommGroup G] [Fintype G] + (f : G → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : + ∃ χ : AddChar G ℂ, gowersNorm 2 f ^ 2 ≤ ‖finiteFourierCoeff f χ‖ := by + classical + obtain ⟨χ, _, hmax⟩ := Finset.exists_max_image Finset.univ + (fun χ : AddChar G ℂ => ‖finiteFourierCoeff f χ‖) Finset.univ_nonempty + have hmass : (∑ ψ : AddChar G ℂ, ‖finiteFourierCoeff f ψ‖ ^ 2) ≤ 1 := by + rw [finiteFourier_parseval] + apply Finset.expect_le Finset.univ_nonempty + intro x _ + simpa only [one_pow] using pow_le_pow_left₀ (norm_nonneg (f x)) (hf x) 2 + have hfourth : gowersNorm 2 f ^ 4 ≤ ‖finiteFourierCoeff f χ‖ ^ 2 := by + rw [gowersNorm_two_fourier] + calc + _ ≤ ∑ ψ : AddChar G ℂ, ‖finiteFourierCoeff f χ‖ ^ 2 * ‖finiteFourierCoeff f ψ‖ ^ 2 := by + apply Finset.sum_le_sum + intro ψ _ + have h := pow_le_pow_left₀ (norm_nonneg (finiteFourierCoeff f ψ)) + (hmax ψ (Finset.mem_univ ψ)) 2 + nlinarith [sq_nonneg (‖finiteFourierCoeff f ψ‖)] + _ = ‖finiteFourierCoeff f χ‖ ^ 2 * ∑ ψ : AddChar G ℂ, ‖finiteFourierCoeff f ψ‖ ^ 2 := + (Finset.mul_sum _ _ _).symm + _ ≤ ‖finiteFourierCoeff f χ‖ ^ 2 := by + simpa only [mul_one] using mul_le_mul_of_nonneg_left hmass (sq_nonneg ‖finiteFourierCoeff f χ‖) + refine ⟨χ, (sq_le_sq₀ (sq_nonneg (gowersNorm 2 f)) (norm_nonneg (finiteFourierCoeff f χ))).mp ?_⟩ + simpa only [← pow_mul, show 2 * 2 = 4 by norm_num] using hfourth + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem mean_derivative_fourier_fourth_le_gowers_three {G : Type*} + [AddCommGroup G] [Fintype G] (f : G → ℂ) (χ : G → AddChar G ℂ) : + (𝔼 k, ‖finiteFourierCoeff (multiplicativeDerivative f k) (χ k)‖) ^ 4 ≤ + gowersNorm 3 f ^ 8 := by + classical + let z (k : G) := ‖finiteFourierCoeff (multiplicativeDerivative f k) (χ k)‖ + have hp (x : ℝ) : (x ^ 2) ^ 2 = x ^ 4 := by ring + have hJ : (𝔼 k, z k) ^ 4 ≤ 𝔼 k, z k ^ 4 := by + rw [← hp] + apply (pow_le_pow_left₀ (sq_nonneg _) (expect_square_le z) 2).trans + calc + _ ≤ 𝔼 k, (z k ^ 2) ^ 2 := expect_square_le (fun k => z k ^ 2) + _ = 𝔼 k, z k ^ 4 := by + apply Finset.expect_congr rfl + intro k _ + ring + have hpoint (k : G) : z k ^ 4 ≤ gowersNorm 2 (multiplicativeDerivative f k) ^ 4 := by + rw [gowersNorm_two_fourier] + exact Finset.single_le_sum (fun ψ _ => pow_nonneg (norm_nonneg _) 4) (Finset.mem_univ (χ k)) + apply hJ.trans + calc + _ ≤ 𝔼 k, gowersNorm 2 (multiplicativeDerivative f k) ^ 4 := + Finset.expect_le_expect (fun k _ => hpoint k) + _ = gowersNorm 3 f ^ 8 := by simpa using (gowersNorm_derivative 1 f).symm + +theorem exp_le_gowers_three_of_mean_derivative_fourier {G : Type*} + [AddCommGroup G] [Fintype G] (f : G → ℂ) (χ : G → AddChar G ℂ) {p : ℝ} + (hp : 0 ≤ p) + (hcorr : Real.exp (-p) ≤ 𝔼 k, ‖finiteFourierCoeff (multiplicativeDerivative f k) (χ k)‖) : + Real.exp (-p) ≤ gowersNorm 3 f := by + have hexp : Real.exp (-p) ^ 8 ≤ Real.exp (-p) ^ 4 := by + rw [← Real.exp_nat_mul, ← Real.exp_nat_mul] + apply Real.exp_le_exp.mpr + push_cast + linarith + have hpower := hexp.trans ((pow_le_pow_left₀ (Real.exp_nonneg _) hcorr 4).trans + (mean_derivative_fourier_fourth_le_gowers_three f χ)) + exact (pow_le_pow_iff_left₀ (Real.exp_nonneg _) (gowersNorm_nonneg 2 f) (by norm_num : (8 : ℕ) ≠ 0)).mp hpower + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G : Type*} [AddCommGroup G] [Fintype G] + +theorem character_relation_of_quadruple_pos (χ : G → AddChar G ℂ) (a h k : G) + (hpos : 0 < additiveQuadrupleCorrelation (fun h x => χ h x) a h k) : + χ (h - a) + χ k = χ h + χ (k - a) := by + let ψ := χ (h - a) + χ k - χ h - χ (k - a) + let c := χ (h - a) a * star (χ (k - a) a) + have hfactor (x : G) : + star (χ h x) * χ (h - a) (x + a) * χ k x * star (χ (k - a) (x + a)) = + c * ψ x := by + simp only [ψ, c, AddChar.sub_apply, AddChar.add_apply, AddChar.map_add_eq_mul, + AddChar.map_neg_eq_conj, Complex.star_def, map_mul] + ring + have hmean : (𝔼 x, star (χ h x) * χ (h - a) (x + a) * χ k x * + star (χ (k - a) (x + a))) = c * (𝔼 x, ψ x) := by + simp_rw [hfactor] + exact (Finset.mul_expect _ _ _).symm + have hψ : ψ = 0 := by + by_contra hn + have hz : (𝔼 x, ψ x) = 0 := AddChar.expect_eq_zero_iff_ne_zero.mpr hn + change 0 < ‖𝔼 x, star (χ h x) * χ (h - a) (x + a) * χ k x * + star (χ (k - a) (x + a))‖ at hpos + rw [hmean, hz, mul_zero, norm_zero] at hpos + exact (lt_irrefl 0) hpos + apply sub_eq_zero.mp + calc + (χ (h - a) + χ k) - (χ h + χ (k - a)) = ψ := by dsimp [ψ]; abel + _ = 0 := hψ + +theorem exists_many_derivative_character_relations + (f : G → ℂ) (H : Finset G) (χ : G → AddChar G ℂ) + (hf : ∀ x, ‖f x‖ ≤ 1) {α δ : ℝ} (hα : 0 < α) (hδ : 0 < δ) + (hdense : α * Fintype.card G ≤ (H.card : ℝ)) + (hcorr : ∀ h ∈ H, δ ≤ ‖finiteFourierCoeff (multiplicativeDerivative f h) (χ h)‖) : + ∃ Q : Finset (G × G × G), Q.Nonempty ∧ + (α * δ) ^ 4 / 2 * (Fintype.card G : ℝ) ^ 3 ≤ (Q.card : ℝ) ∧ + ∀ t ∈ Q, t.2.1 ∈ H ∧ t.2.1 - t.1 ∈ H ∧ t.2.2 ∈ H ∧ t.2.2 - t.1 ∈ H ∧ + χ (t.2.1 - t.1) + χ t.2.2 = χ t.2.1 + χ (t.2.2 - t.1) := by + classical + let g (h x : G) : ℂ := if h ∈ H then χ h x else 0 + have hg (h x : G) : ‖g h x‖ ≤ 1 := by + dsimp [g] + split_ifs + · exact (AddChar.norm_apply _ _).le + · simp + have hzero (h : G) (hh : h ∉ H) (x : G) : g h x = 0 := by simp [g, hh] + have hcorr' (h : G) (hh : h ∈ H) : + δ ≤ ‖𝔼 x, multiplicativeDerivative f h x * star (g h x)‖ := by + simpa only [g, ite_eq_left hh, finiteFourierCoeff] using hcorr h hh + obtain ⟨Q, hQ, hcard, hrelations⟩ := + exists_many_correlated_additive_quadruples f g H hf hg hzero hα hδ hdense hcorr' + refine ⟨Q, hQ, hcard, ?_⟩ + intro t ht + obtain ⟨h₁, h₂, h₃, h₄, hlarge⟩ := hrelations t ht + refine ⟨h₁, h₂, h₃, h₄, character_relation_of_quadruple_pos χ t.1 t.2.1 t.2.2 ?_⟩ + have heq : additiveQuadrupleCorrelation g t.1 t.2.1 t.2.2 = + additiveQuadrupleCorrelation (fun h x => χ h x) t.1 t.2.1 t.2.2 := by + simp only [additiveQuadrupleCorrelation, g, ite_eq_left h₁, ite_eq_left h₂, ite_eq_left h₃, ite_eq_left h₄] + rw [heq] at hlarge + exact lt_of_lt_of_le (by positivity) hlarge + +theorem derivative_character_graph_energy [DecidableEq G] + (f : G → ℂ) (H : Finset G) (χ : G → AddChar G ℂ) + (hf : ∀ x, ‖f x‖ ≤ 1) {α δ : ℝ} (hα : 0 < α) (hδ : 0 < δ) + (hdense : α * Fintype.card G ≤ (H.card : ℝ)) + (hcorr : ∀ h ∈ H, δ ≤ ‖finiteFourierCoeff (multiplicativeDerivative f h) (χ h)‖) : + (α * δ) ^ 4 / 2 * (Fintype.card G : ℝ) ^ 3 ≤ + (Finset.addEnergy (additiveGraph H χ) (additiveGraph H χ) : ℝ) := by + classical + obtain ⟨Q, _, hcard, hrelations⟩ := + exists_many_derivative_character_relations f H χ hf hα hδ hdense hcorr + have henergy := graph_energy_of_few_quadruple_differences H Q χ {0} + (fun t ht => let h := hrelations t ht; ⟨h.1, h.2.1, h.2.2.1, h.2.2.2.1⟩) + (by + intro t ht + simp only [Finset.mem_singleton] + rw [(hrelations t ht).2.2.2.2] + abel) + have henergy' : Q.card ≤ Finset.addEnergy (additiveGraph H χ) (additiveGraph H χ) := by + simpa only [Finset.card_singleton, one_mul] using henergy + exact hcard.trans (by exact_mod_cast henergy') + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Pointwise + +variable {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] + +theorem exists_quadratic_frequency_graph {p : ℝ} (hp : 0 ≤ p) + (f : G → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) (hG : Real.exp (-p) ≤ gowersNorm 3 f) : + ∃ H : Finset G, H.Nonempty ∧ + Real.exp (-(128 * (p + 1))) * Fintype.card G ≤ (H.card : ℝ) ∧ + ∃ χ : G → AddChar G ℂ, + (∀ h ∈ H, Real.exp (-(128 * (p + 1))) ≤ + ‖finiteFourierCoeff (multiplicativeDerivative f h) (χ h)‖) ∧ + Real.exp (-(128 * (p + 1))) * (Fintype.card G : ℝ) ^ 3 ≤ + (Finset.addEnergy (additiveGraph H χ) (additiveGraph H χ) : ℝ) := by + classical + obtain ⟨H, hH, hdense, hderivative⟩ := exists_many_large_gowers_derivatives 1 f hf hp hG + choose χ hχ using fun h => + exists_large_fourier_of_gowers_two (multiplicativeDerivative f h) + (multiplicativeDerivative_norm_le_one f hf h) + let d := derivativeInverseBudget 1 p + have hd : d = 8 * p + 2 := by norm_num [d, derivativeInverseBudget] + have hcorr (h : G) (hh : h ∈ H) : Real.exp (-(2 * d)) ≤ + ‖finiteFourierCoeff (multiplicativeDerivative f h) (χ h)‖ := by + calc + _ = Real.exp (-d) ^ 2 := by rw [pow_two, ← Real.exp_add]; congr 1; ring + _ ≤ gowersNorm 2 (multiplicativeDerivative f h) ^ 2 := + pow_le_pow_left₀ (Real.exp_nonneg _) (hderivative h hh) 2 + _ ≤ _ := hχ h + have hdP : d ≤ 128 * (p + 1) := by rw [hd]; linarith + have h2dP : 2 * d ≤ 128 * (p + 1) := by rw [hd]; linarith + have henergy := derivative_character_graph_energy f H χ hf + (Real.exp_pos (-d)) (Real.exp_pos (-(2 * d))) hdense hcorr + have hthreshold : Real.exp (-(128 * (p + 1))) ≤ + (Real.exp (-d) * Real.exp (-(2 * d))) ^ 4 / 2 := by + rw [derivative_quadruple_exp_threshold] + calc + _ ≤ Real.exp (-(12 * d) - 1) := Real.exp_le_exp.mpr (by rw [hd]; linarith) + _ ≤ _ := exp_sub_one_le_half_exp _ + refine ⟨H, hH, ?_, χ, ?_, ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hdP)) + (Nat.cast_nonneg _)).trans hdense + · intro h hh + exact (Real.exp_le_exp.mpr (neg_le_neg h2dP)).trans (hcorr h hh) + · exact (mul_le_mul_of_nonneg_right hthreshold (by positivity)).trans henergy + +theorem exists_quadratic_frequency_small_difference {p : ℝ} (hp : 0 ≤ p) + (f : G → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) (hG : Real.exp (-p) ≤ gowersNorm 3 f) : + ∃ H : Finset G, H.Nonempty ∧ + Real.exp (-(1024 * (p + 1))) * Fintype.card G ≤ (H.card : ℝ) ∧ + ∃ χ : G → AddChar G ℂ, + (∀ h ∈ H, Real.exp (-(1024 * (p + 1))) ≤ + ‖finiteFourierCoeff (multiplicativeDerivative f h) (χ h)‖) ∧ + ((additiveGraph H χ - additiveGraph H χ).card : ℝ) ≤ + Real.exp (1024 * (p + 1)) * H.card := by + classical + obtain ⟨H, hH, hdense, χ, hcorr, henergy⟩ := exists_quadratic_frequency_graph hp f hf hG + let q := 128 * (p + 1) + let P := 1024 * (p + 1) + have hqP : q ≤ P := by dsimp [q, P]; linarith + have henergy' : (Real.exp q)⁻¹ * (H.card : ℝ) ^ 3 ≤ + (Finset.addEnergy (additiveGraph H χ) (additiveGraph H χ) : ℝ) := by + rw [← Real.exp_neg] + apply le_trans _ henergy + gcongr + exact_mod_cast Finset.card_le_univ H + obtain ⟨J, hJH, hJ, hsize, hdiff⟩ := + exists_large_graph_subset_small_difference H hH χ (Real.exp_pos q) henergy' + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hfour : (2 : ℝ) ^ 4 ≤ Real.exp 4 := by + calc + _ ≤ Real.exp 1 ^ 4 := pow_le_pow_left₀ (by norm_num) htwo 4 + _ = _ := by rw [← Real.exp_nat_mul]; norm_num + have hfourteen : (2 : ℝ) ^ 14 ≤ Real.exp 14 := by + calc + _ ≤ Real.exp 1 ^ 14 := pow_le_pow_left₀ (by norm_num) htwo 14 + _ = _ := by rw [← Real.exp_nat_mul]; norm_num + have hnegfour : Real.exp (-4) ≤ ((2 : ℝ) ^ 4)⁻¹ := by + simpa only [Real.exp_neg, one_div] using + one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 2 ^ 4) hfour + have hsize' : Real.exp (-P) * Fintype.card G ≤ (J.card : ℝ) := by + calc + _ ≤ Real.exp (-(2 * q + 4)) * Fintype.card G := + mul_le_mul_of_nonneg_right + (Real.exp_le_exp.mpr (by dsimp [q, P]; linarith)) (Nat.cast_nonneg _) + _ = Real.exp (-4) * (Real.exp (-q) * (Real.exp (-q) * Fintype.card G)) := by + rw [show -(2 * q + 4) = -4 + -q + -q by ring, Real.exp_add, Real.exp_add] + ring + _ ≤ ((2 : ℝ) ^ 4)⁻¹ * (Real.exp (-q) * (Real.exp (-q) * Fintype.card G)) := + mul_le_mul_of_nonneg_right hnegfour (by positivity) + _ ≤ ((2 : ℝ) ^ 4)⁻¹ * (Real.exp (-q) * H.card) := by + gcongr + _ = ((2 : ℝ) ^ 4)⁻¹ * (Real.exp q)⁻¹ * H.card := by + rw [Real.exp_neg] + ring + _ ≤ _ := hsize + refine ⟨J, hJ, hsize', χ, ?_, ?_⟩ + · intro h hh + exact (Real.exp_le_exp.mpr (neg_le_neg hqP)).trans (hcorr h (hJH hh)) + · apply hdiff.trans + apply mul_le_mul_of_nonneg_right _ (Nat.cast_nonneg _) + calc + (2 : ℝ) ^ 14 * Real.exp q ^ 6 ≤ Real.exp 14 * Real.exp q ^ 6 := by gcongr + _ = Real.exp (6 * q + 14) := by + rw [← Real.exp_nat_mul, ← Real.exp_add] + congr 1 + ring + _ ≤ Real.exp P := Real.exp_le_exp.mpr (by dsimp [q, P]; linarith) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_cyclic_interval_fourier_smoothing {N : ℕ} [NeZero N] + (a : ZMod N) (L : ℕ) {δ : ℝ} (hδ : 0 < δ) (hδ1 : δ ≤ 1) : + ∃ (v : ZMod N → ℂ) (c : AddChar (ZMod N) ℂ → ℂ), + (∀ x, ‖v x‖ ≤ 1) ∧ + (𝔼 x, ‖finiteIndicator (cyclicInterval a L) x - v x‖) ≤ 2 * δ ∧ + (∑ χ, ‖c χ‖) ≤ 2 / δ ∧ ∀ x, v x = ∑ χ, c χ * χ x := by + obtain ⟨K, hK, hKN, hsmall, hratio⟩ := exists_smoothing_scale (NeZero.pos N) hδ hδ1 + let I := cyclicInterval a L + let B := cyclicInterval (0 : ZMod N) K + have hB : B.Nonempty := cyclicInterval_nonempty 0 hK + have hcard : B.card = K := cyclicInterval_card 0 hKN + refine ⟨smoothedIndicator I B, + (fun χ => finiteFourierCoeff (averagingKernel B) χ * finiteFourierCoeff (finiteIndicator I) χ), + smoothedIndicator_norm_le_one I hB, ?_, ?_, ?_⟩ + · apply mean_indicator_smoothing_error I hB + intro h hh + obtain ⟨m, hm, he⟩ := Finset.mem_image.mp hh + have hmK : m ≤ K - 1 := by have := Finset.mem_range.mp hm; omega + have hmreal : (m : ℝ) ≤ δ * N := (Nat.cast_le.mpr hmK).trans hsmall + have hmean := cyclicInterval_nat_shift_error a L m + have hhcast : (m : ZMod N) = h := by simpa using he + rw [hhcast] at hmean + apply hmean.trans + apply (div_le_iff₀ (by exact_mod_cast NeZero.pos N : (0 : ℝ) < N)).mpr + nlinarith + · have hmass := smoothedIndicator_fourier_mass hB I + rw [ZMod.card, hcard] at hmass + exact hmass.trans hratio + · intro x + rw [smoothedIndicator_eq_convolution] + simpa only [finiteFourierCoeff_convolution] using + (finiteFourier_inversion (finiteConvolution (averagingKernel B) (finiteIndicator I)) x).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped Pointwise + +theorem additiveGraph_difference_card_hom + {G K L : Type*} [AddCommGroup G] [AddCommGroup K] [AddCommGroup L] + [DecidableEq G] [DecidableEq K] [DecidableEq L] + (H : Finset G) (b : G → K) (e : K →+ L) (he : Function.Injective e) : + (additiveGraph H (fun h => e (b h)) - additiveGraph H (fun h => e (b h))).card = + (additiveGraph H b - additiveGraph H b).card := by + let F : G × K →+ G × L := { + toFun := fun x => (x.1, e x.2) + map_zero' := by simp + map_add' := by intro x y; simp } + have hF : Function.Injective F := by + intro x y h + exact Prod.ext (congrArg (fun z : G × L => z.1) h) + (he (congrArg (fun z : G × L => z.2) h)) + have hgraph : additiveGraph H (fun h => e (b h)) = (additiveGraph H b).image F := by + unfold additiveGraph + rw [Finset.image_image] + rfl + rw [hgraph] + apply FreimanModel.card_difference_image_of_freiman + exact FreimanModel.isAddFreimanIso_of_injOn_iterated_sums F (additiveGraph H b) 2 + hF.injOn hF.injOn + +theorem exists_quadratic_affine_frequency_coordinates + {N : ℕ} [NeZero N] {p : ℝ} (hp : 0 ≤ p) (f : ZMod N → ℂ) + (hf : ∀ x, ‖f x‖ ≤ 1) (hG : Real.exp (-p) ≤ gowersNorm 3 f) : + let P := 1024 * (p + 1) + ∃ H : Finset (ZMod N), H.Nonempty ∧ + Real.exp (-(P + properAffineRecoveryLogLoss P 1)) * N ≤ (H.card : ℝ) ∧ + ∃ (r : ℕ) (R : Fin r → ℕ) (η ξ : (Fin r → ℤ) →+ ZMod N) (h₀ ξ₀ : ZMod N), + (r : ℝ) ≤ properAffineRankBound P 1 ∧ + Set.InjOn η (centeredIntegerBox R : Set _) ∧ + ∀ h ∈ H, ∃ x : Fin r → ℤ, (∀ i, |x i| ≤ (R i : ℤ)) ∧ h = h₀ + η x ∧ + Real.exp (-P) ≤ ‖finiteFourierCoeff (multiplicativeDerivative f h) + (AddChar.zmodAddEquiv (ξ₀ + ξ x))‖ := by + intro P + classical + obtain ⟨H, hH, hdense, χ, hcorr, hsmall⟩ := exists_quadratic_frequency_small_difference hp f hf hG + let e₀ : AddChar (ZMod N) ℂ ≃+ ZMod N := (AddChar.zmodAddEquiv (n := N)).symm + let e : AddChar (ZMod N) ℂ →+ (Unit → ZMod N) := { + toFun := fun c _ => e₀ c + map_zero' := by ext; simp + map_add' := by intro c d; ext; simp } + have he : Function.Injective e := by + intro c d h + exact e₀.injective (congrFun h ()) + let b (h : ZMod N) := e (χ h) + have hsmall' : ((additiveGraph H b - additiveGraph H b).card : ℝ) ≤ Real.exp P * H.card := by + rw [additiveGraph_difference_card_hom H χ e he] + exact hsmall + obtain ⟨J, hJH, hJ, hJdense, r, R, Φ, base, hrank, hproper, hrepr⟩ := + exists_small_difference_graph_affine_coordinates N (fun _ : Unit => N) H hH b + (by dsimp [P]; positivity) hsmall' + let reduce := FreimanModel.variableIntegerGraphReduction N (fun _ : Unit => N) + let η := (AddMonoidHom.fst (ZMod N) (Unit → ZMod N)).comp (reduce.comp Φ) + let ξ : (Fin r → ℤ) →+ ZMod N := { + toFun := fun x => (reduce (Φ x)).2 () + map_zero' := by simp + map_add' := by intro x y; simp } + have hdense' : Real.exp (-P) * N ≤ (H.card : ℝ) := by + simpa only [ZMod.card] using hdense + have hJdense' : Real.exp (-properAffineRecoveryLogLoss P 1) * H.card ≤ (J.card : ℝ) := by + simpa only [Fintype.card_unique] using hJdense + refine ⟨J, hJ, ?_, r, R, η, ξ, (reduce base).1, (reduce base).2 (), ?_, hproper, ?_⟩ + · calc + _ = Real.exp (-properAffineRecoveryLogLoss P 1) * (Real.exp (-P) * N) := by + rw [neg_add, Real.exp_add] + ring + _ ≤ Real.exp (-properAffineRecoveryLogLoss P 1) * H.card := + mul_le_mul_of_nonneg_left hdense' (Real.exp_nonneg _) + _ ≤ _ := hJdense' + · simpa only [Fintype.card_unique] using hrank + · intro h hh + obtain ⟨x, hx, heq⟩ := hrepr h hh + have hred : (h, b h) = reduce base + reduce (Φ x) := by + have h := congrArg reduce heq + simpa only [reduce, FreimanModel.variableIntegerGraphReduction_lift, map_add] using h + have hfreq : AddChar.zmodAddEquiv ((reduce base).2 () + ξ x) = χ h := by + have hv : e₀ (χ h) = (reduce base).2 () + ξ x := congrArg (fun v => v.2 ()) hred + rw [← hv] + exact (AddChar.zmodAddEquiv (n := N)).apply_symm_apply _ + refine ⟨x, hx, congrArg Prod.fst hred, ?_⟩ + rw [hfreq] + exact hcorr h (hJH hh) + +theorem exists_quadratic_affine_frequency_coordinates_budget : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 3 f → + ∃ H : Finset (ZMod N), H.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * N ≤ (H.card : ℝ) ∧ + ∃ (r : ℕ) (R : Fin r → ℕ) (η ξ : (Fin r → ℤ) →+ ZMod N) (h₀ ξ₀ : ZMod N), + (r : ℝ) ≤ (p + C) ^ C ∧ Set.InjOn η (centeredIntegerBox R : Set _) ∧ + ∀ h ∈ H, ∃ x : Fin r → ℤ, (∀ i, |x i| ≤ (R i : ℤ)) ∧ h = h₀ + η x ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖finiteFourierCoeff (multiplicativeDerivative f h) + (AddChar.zmodAddEquiv (ξ₀ + ξ x))‖ := by + obtain ⟨C, hC, hbudget⟩ := exists_quadratic_affine_budget + refine ⟨C, hC, ?_⟩ + intro N _ p hp f hf hG + obtain ⟨H, hH, hdense, r, R, η, ξ, h₀, ξ₀, hrank, hproper, hcorr⟩ := + exists_quadratic_affine_frequency_coordinates hp f hf hG + obtain ⟨hcost, hrankCost, hcorrCost⟩ := hbudget p hp + refine ⟨H, hH, ?_, r, R, η, ξ, h₀, ξ₀, hrank.trans hrankCost, hproper, ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hcost)) + (Nat.cast_nonneg _)).trans hdense + · intro h hh + obtain ⟨x, hx, hshift, hlarge⟩ := hcorr h hh + exact ⟨x, hx, hshift, (Real.exp_le_exp.mpr (neg_le_neg hcorrCost)).trans hlarge⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/QuadraticLocalFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/QuadraticLocalFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..620dfda553726b859c781c30247ae9c8b7bd5a8a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/QuadraticLocalFrequency.lean @@ -0,0 +1,190 @@ +import OAI.Combinatorics.Progressions.Fourier.QuadraticFrequencyCoordinates + +namespace OAI + +section + +namespace Erdos3 + +open Module VectorPolynomial +open scoped BigOperators + +variable {ι κ D V : Type} [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℝ V] + +noncomputable def affineBasisCoefficient + (B : Basis ι ℝ (κ → ℝ)) (β : κ → D → V) (i : ι) (d : D) : V := + ∑ j, B i j • β j d + +noncomputable def affineBasisConstant + (B : Basis ι ℝ (κ → ℝ)) (α : D → V) (β : κ → D → V) (c : ι → ℝ) (d : D) : V := + α d + ∑ i, c i • affineBasisCoefficient B β i d + +theorem affine_basis_coordinate_sum + (B : Basis ι ℝ (κ → ℝ)) (β : κ → D → V) (v : ι → ℝ) (d : D) : + (∑ j, B.equivFun.symm v j • β j d) = ∑ i, v i • affineBasisCoefficient B β i d := by + classical + rw [Basis.equivFun_symm_apply] + simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, affineBasisCoefficient, + Finset.sum_smul, Finset.smul_sum, smul_smul] + exact Finset.sum_comm + +theorem affine_basis_change + (B : Basis ι ℝ (κ → ℝ)) (α : D → V) (β : κ → D → V) + (c u : ι → ℝ) (d : D) : + α d + ∑ j, B.equivFun.symm (c + u) j • β j d = + affineBasisConstant B α β c d + ∑ i, u i • affineBasisCoefficient B β i d := by + rw [affine_basis_coordinate_sum] + simp only [Pi.add_apply, add_smul, Finset.sum_add_distrib, affineBasisConstant, add_assoc] + +omit [Fintype ι] in +theorem affineBasisCoefficient_mem + (B : Basis ι ℝ (κ → ℝ)) (β : κ → D → V) (U : D → Submodule ℝ V) + (hβ : ∀ j d, β j d ∈ U d) (i : ι) (d : D) : + affineBasisCoefficient B β i d ∈ U d := + Submodule.sum_mem _ (fun j _ => Submodule.smul_mem _ _ (hβ j d)) + +theorem affineBasisConstant_mem + (B : Basis ι ℝ (κ → ℝ)) (α : D → V) (β : κ → D → V) (c : ι → ℝ) + (U : D → Submodule ℝ V) (hα : ∀ d, α d ∈ U d) (hβ : ∀ j d, β j d ∈ U d) (d : D) : + affineBasisConstant B α β c d ∈ U d := + Submodule.add_mem _ (hα d) (Submodule.sum_mem _ + (fun i _ => Submodule.smul_mem _ _ (affineBasisCoefficient_mem B β U hβ i d))) + +theorem positiveUnivariate_affine_basis_change [Module ℚ V] + {s : ℕ} (B : Basis ι ℝ (κ → ℝ)) (α : Fin s → V) (β : κ → Fin s → V) + (c u : ι → ℝ) (Γ : VectorPolynomial Unit ℚ V) : + Γ + positiveUnivariate (fun d => α d + ∑ j, B.equivFun.symm (c + u) j • β j d) = + Γ + positiveUnivariate (fun d => affineBasisConstant B α β c d + + ∑ i, u i • affineBasisCoefficient B β i d) := by + congr 2 + funext d + exact affine_basis_change B α β c u d + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped BigOperators + +theorem exists_local_affine_scalar_chart + {r N : ℕ} [NeZero N] {p : ℝ} (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) + (η : (Fin r → ℤ) →+ ZMod N) (R : Fin r → ℕ) + (hinj : Set.InjOn η {x | ∀ i, |x i| ≤ (R i : ℤ)}) + (h₀ : ZMod N) (J : Finset (ZMod N)) (hJ : J.Nonempty) + (hdense : Real.exp (-p) * N ≤ (J.card : ℝ)) (x : ZMod N → Fin r → ℤ) + (hx : ∀ h ∈ J, ∀ i, |x h i| ≤ (R i : ℤ)) + (hrep : ∀ h ∈ J, h = h₀ + η (x h)) (a : ℝ) (b : Fin r → ℝ) : + ∃ K ⊆ J, K.Nonempty ∧ Real.exp (-((p + 4) ^ 7)) * N ≤ (K.card : ℝ) ∧ + ∃ (t c : Fin r → ℝ) (a' : ℝ) (b' : Fin r → ℝ), + (∀ i, t i ∈ Set.Ico (0 : ℝ) 1) ∧ + (∀ i, ∃ k : ℤ, (N : ℝ) * t i = (k : ℝ)) ∧ + (∀ i, |c i| ≤ properCyclicCoordinateBound r (Real.exp (-p)) + 1 / 16) ∧ + ∀ h ∈ K, (∀ i, |affineCyclicTorusLocalLift t c h₀ h i| ≤ 1 / 16) ∧ + a + ∑ i, (x h i : ℝ) * b i = + a' + ∑ i, affineCyclicTorusLocalLift t c h₀ h i * b' i := by + obtain ⟨basis, _, t, ht, hperiod, K, hKJ, hK, hcard, c, hc, hdata⟩ := + exists_localized_cyclic_torus_chart η R hinj h₀ J hJ (Real.exp (-p)) + (Real.exp_pos _) hdense x hx hrep 8 (by norm_num) + let B := basis.ofZLatticeBasis ℝ (cyclicIntegerKernel η) + let a' := affineBasisConstant B (fun _ : Unit => a) (fun i _ => b i) c () + let b' (i : Fin r) := affineBasisCoefficient B (fun j (_ : Unit) => b j) i () + refine ⟨K, hKJ, hK, local_cyclic_torus_density hp hr J K hdense hcard, + t, c, a', b', ht, hperiod, ?_, ?_⟩ + · simpa only [Nat.cast_ofNat, div_div, show (2 : ℝ) * 8 = 16 by norm_num] using hc + · intro h hh + obtain ⟨_, hsmall, hcoord⟩ := hdata h hh + refine ⟨by norm_num at hsmall ⊢; exact hsmall, ?_⟩ + change a + ∑ i, integerVectorRealMap (x h) i * b i = _ + rw [hcoord] + exact affine_basis_change B (fun _ : Unit => a) (fun i _ => b i) c + (affineCyclicTorusLocalLift t c h₀ h) () + +theorem exists_quadratic_local_frequency : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 3 f → + ∃ H : Finset (ZMod N), H.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * N ≤ (H.card : ℝ) ∧ + ∃ (r : ℕ) (t c b : Fin r → ℝ) (a : ℝ) (h₀ : ZMod N), + (r : ℝ) ≤ (p + C) ^ C ∧ + (∀ i, t i ∈ Set.Ico (0 : ℝ) 1) ∧ + (∀ i, ∃ k : ℤ, (N : ℝ) * t i = (k : ℝ)) ∧ + (∀ i, |c i| ≤ Real.exp ((p + C) ^ C)) ∧ + ∀ h ∈ H, (∀ i, |affineCyclicTorusLocalLift t c h₀ h i| ≤ 1 / 16) ∧ + Real.exp (-((p + C) ^ C)) ≤ + ‖𝔼 n : ZMod N, multiplicativeDerivative f h n * + star (CircleFourier.character + (((n.val : ℝ) * (a + ∑ i, affineCyclicTorusLocalLift t c h₀ h i * b i) : ℝ) : + CircleFourier.Circle))‖ := by + obtain ⟨A, _, hfrequencies⟩ := exists_quadratic_affine_frequency_coordinates_budget + let X : Polynomial ℕ := Polynomial.X + let P : Polynomial ℕ := (X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (P + (P + 4) ^ 7 + (P + 4) ^ 5 + 2) + refine ⟨C, hC, ?_⟩ + intro N _ p hp f hf hG + classical + obtain ⟨J, hJ, hdense, r, R, η, ξ, h₀, ξ₀, hrank, hproper, hselected⟩ := + hfrequencies hp f hf hG + let q := (p + A) ^ A + have hq : 0 ≤ q := by dsimp [q]; positivity + have htotal : q + (q + 4) ^ 7 + (q + 4) ^ 5 + 2 ≤ (p + C) ^ C := by + simpa [X, P, q, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := by + have h₇ : 0 ≤ (q + 4) ^ 7 := by positivity + have h₅ : 0 ≤ (q + 4) ^ 5 := by positivity + linarith + have hchartC : (q + 4) ^ 7 ≤ (p + C) ^ C := by + have h₅ : 0 ≤ (q + 4) ^ 5 := by positivity + linarith + have hcenterC : (q + 4) ^ 5 + 2 ≤ (p + C) ^ C := by + have h₇ : 0 ≤ (q + 4) ^ 7 := by positivity + linarith + choose x hx hrep hlarge using fun h : {h // h ∈ J} => hselected h.val h.property + let x' (h : ZMod N) : Fin r → ℤ := if hh : h ∈ J then x ⟨h, hh⟩ else 0 + have hx' (h : ZMod N) (hh : h ∈ J) : ∀ i, |x' h i| ≤ (R i : ℤ) := by + simpa only [x', dite_eq_left hh] using hx ⟨h, hh⟩ + have hrep' (h : ZMod N) (hh : h ∈ J) : h = h₀ + η (x' h) := by + simpa only [x', dite_eq_left hh] using hrep ⟨h, hh⟩ + have hlarge' (h : ZMod N) (hh : h ∈ J) : Real.exp (-q) ≤ + ‖finiteFourierCoeff (multiplicativeDerivative f h) (AddChar.zmodAddEquiv (ξ₀ + ξ (x' h)))‖ := by + simpa only [x', dite_eq_left hh] using hlarge ⟨h, hh⟩ + have hinj : Set.InjOn η {x | ∀ i, |x i| ≤ (R i : ℤ)} := by + simpa only [Set.InjOn, Finset.mem_coe, mem_centeredIntegerBox, Set.mem_ofPred_eq] using hproper + obtain ⟨a, b, hphase⟩ := exists_affine_cyclic_character_phase ξ ξ₀ + obtain ⟨K, hKJ, hK, hKsize, t, c, a', b', ht, hperiod, hc, hlocal⟩ := + exists_local_affine_scalar_chart hq hrank η R hinj h₀ J hJ hdense x' hx' hrep' a b + refine ⟨K, hK, ?_, r, t, c, b', a', h₀, hrank.trans hqC, ht, hperiod, ?_, ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hchartC)) + (Nat.cast_nonneg _)).trans hKsize + · intro i + have hcoord := properCyclicCoordinateBound_le_exp hq hrank + have hE : 1 ≤ Real.exp ((q + 4) ^ 5) := Real.one_le_exp (by positivity) + calc + |c i| ≤ properCyclicCoordinateBound r (Real.exp (-q)) + 1 / 16 := hc i + _ ≤ 2 * Real.exp ((q + 4) ^ 5) := by linarith + _ ≤ Real.exp 2 * Real.exp ((q + 4) ^ 5) := by + gcongr + linarith [Real.add_one_le_exp (2 : ℝ)] + _ = Real.exp ((q + 4) ^ 5 + 2) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr hcenterC + · intro h hh + obtain ⟨hsmall, heq⟩ := hlocal h hh + refine ⟨hsmall, ?_⟩ + have heval (n : ZMod N) : CircleFourier.character + (((n.val : ℝ) * (a' + ∑ i, affineCyclicTorusLocalLift t c h₀ h i * b' i) : ℝ) : + CircleFourier.Circle) = AddChar.zmodAddEquiv (ξ₀ + ξ (x' h)) n := by + rw [← heq] + exact hphase (x' h) n + simp only [heval] + exact (Real.exp_le_exp.mpr (neg_le_neg hqC)).trans (hlarge' h (hKJ hh)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/QuantitativeBohrBound.lean b/lean/OAI/Combinatorics/Progressions/Fourier/QuantitativeBohrBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..2543855dd7f45002e04f776305c80d0f8d7694ab --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/QuantitativeBohrBound.lean @@ -0,0 +1,160 @@ +import OAI.Combinatorics.Progressions.Estimates.FixedBilinearRefinement + +namespace OAI + +section + +namespace Erdos3.CellRefinement + +open LocalConvolution + +theorem refinementComparisonBudget_mono {r d : ℕ} {p R R' epsilon : ℝ} + (hrd : r ≤ d) (hp : 0 ≤ p) (hR : 0 ≤ R) (hRR' : R ≤ R') + (hepsilon : 0 < epsilon) : + refinementComparisonBudget r p R epsilon ≤ refinementComparisonBudget d p R' epsilon := by + have hr : (r : ℝ) ≤ d := by exact_mod_cast hrd + have hm := refinementMatchingLoss_mono_rank hrd p epsilon + have hm0 := refinementMatchingLoss_nonneg r hp hepsilon + have hi : R + refinementMatchingLoss r p epsilon + 10 ≤ + R' + refinementMatchingLoss d p epsilon + 10 := by linarith + have hprod := mul_le_mul hr hi (by positivity : 0 ≤ R + refinementMatchingLoss r p epsilon + 10) + (Nat.cast_nonneg d : (0 : ℝ) ≤ d) + unfold refinementComparisonBudget + apply max_le_max <;> linarith + +variable {N : ℕ} [NeZero N] {epsilon : ℝ} + +local notation "δ" => flatComparisonDelta epsilon +local notation "γ" => localMomentGain δ + +theorem bohr_refinement_iteration + (B₀ : CyclicBohr.Set N) (hB₀ : B₀.IsRankRegular) + (hBpos : 0 < B₀.radius) (hBwidth : B₀.radius ≤ 2) (hBrank : 1 ≤ B₀.rank) + {p R H P W : ℝ} (hepsilon : 0 < epsilon) (hp : 512 ≤ p) (hR : 0 ≤ R) (hH : 0 ≤ H) + (hBwide : Real.exp (-R) ≤ B₀.radius) (n : ℕ) + (A B : ZMod N → ℝ) + (hA : ∀ r, 0 ≤ A r ∧ A r ≤ Real.exp p) (hB : ∀ r, 0 ≤ B r ∧ B r ≤ Real.exp p) + (hW : 0 ≤ W) (hWcap : W ≤ Real.exp (p / 8)) + (ha : ∀ r, |A r - (1 + epsilon) * B r| ≤ W) + (hcompare : CyclicNiltestUpperComparison.{0} 1 N P (Real.exp (-P)) A B) + (m : ℕ) (hm : 0 < m) + (horder : (1 + 1 + ((1 / 4 : ℝ) + 1) + Real.log 3) * p ≤ + ((2 * m : ℕ) : ℝ) * Real.log 2) + (horders : ∀ m' : ℕ, m ≤ m' → m' ≤ localMomentExponentFactor δ * m → + ((2 * m' : ℕ) : ℝ) ≤ H * p ∧ + (1 + γ / 4) ^ (2 * m') ≤ (γ / 64) / 2 * (1 + γ / 2) ^ (2 * m')) + (hbudget : let d := B₀.rank + n * unbalancedRankExtra γ p H + let loss := refinementRoundLoss d p H epsilon + refinementComparisonBudget d p (R + n * loss) epsilon ≤ P) : + CellBilinearBound B₀.carrier (fun r => A r - (1 + epsilon) * B r) + ((refinementContraction epsilon) ^ n * W + + (4 * Real.exp (-p / 4)) / (1 - refinementContraction epsilon)) := by + let extra := unbalancedRankExtra γ p H + let d := B₀.rank + n * extra + let loss := refinementRoundLoss d p H epsilon + let family : ℕ → CyclicBohr.Set N → Prop := fun j C => + C.IsRankRegular ∧ 0 < C.radius ∧ C.radius ≤ 2 ∧ 1 ≤ C.rank ∧ + C.rank ≤ B₀.rank + j * extra ∧ Real.exp (-(R + (j : ℝ) * loss)) ≤ C.radius + have hp0 : 0 ≤ p := by linarith + have hloss : 0 ≤ loss := (by linarith : (0 : ℝ) ≤ 2).trans + (two_le_refinementRoundLoss d hp0 hH hepsilon) + have hroot : family 0 B₀ := by + refine ⟨hB₀, hBpos, hBwidth, hBrank, ?_, ?_⟩ + · simp + · simpa only [Nat.cast_zero, zero_mul, add_zero] using hBwide + apply finite_cell_refinement CyclicBohr.Set.carrier family + (fun r => A r - (1 + epsilon) * B r) n hW + (refinementContraction_bounds epsilon).1 (refinementContraction_bounds epsilon).2 + (by positivity) (fun r => (le_abs_self _).trans (ha r)) + (fun _ C _ => C.carrier_nonempty) ?_ B₀ hroot + intro j hj T hT hchildren C hC + obtain ⟨hCreg, hCpos, hCwidth, hCrank, hCsize, hCwide⟩ := hC + have hjn : j ≤ n := Nat.le_of_lt hj + have hjnR : (j : ℝ) ≤ (n : ℝ) := by exact_mod_cast hjn + have hCtotal : C.rank ≤ d := hCsize.trans (Nat.add_le_add_left (Nat.mul_le_mul_right extra hjn) _) + have hCround : refinementRoundLoss C.rank p H epsilon ≤ loss := + refinementRoundLoss_mono_rank hCtotal p H epsilon + have hRj : 0 ≤ R + (j : ℝ) * loss := by positivity + have hRjn : R + (j : ℝ) * loss ≤ R + (n : ℝ) * loss := by + exact add_le_add le_rfl (mul_le_mul_of_nonneg_right hjnR hloss) + have hCbudget : refinementComparisonBudget C.rank p (R + (j : ℝ) * loss) epsilon ≤ P := + (refinementComparisonBudget_mono hCtotal hp0 hRj hRjn hepsilon).trans hbudget + apply fixed_bilinear_refinement_step C hCreg hCpos hCwidth hCrank hepsilon hp hRj hH hCwide + A B hA hB hW hWcap ha hcompare hCbudget m hm horder horders hT + intro D hDreg hDpos hDrank hDsize hDwide hDwidth + apply hchildren D + refine ⟨hDreg, hDpos, hDwidth, hDrank, ?_, ?_⟩ + · change D.rank ≤ C.rank + extra at hDsize + rw [Nat.add_mul, Nat.one_mul] + omega + · have hnext : R + (j : ℝ) * loss + refinementRoundLoss C.rank p H epsilon ≤ + R + ((j + 1 : ℕ) : ℝ) * loss := by + push_cast + nlinarith + exact (Real.exp_le_exp.mpr (neg_le_neg hnext)).trans hDwide + +end Erdos3.CellRefinement + +end + +section + +namespace Erdos3.CellRefinement + +open LocalConvolution + +theorem refinement_error_small {p gap : ℝ} (hgap : 0 < gap) (hp : 32 / gap ≤ p) : + 4 * Real.exp (-p / 4) ≤ gap * Real.exp (-p / 8) := by + have hp' : 32 ≤ p * gap := (div_le_iff₀ hgap).mp hp + have hscaled := mul_le_mul_of_nonneg_left (Real.add_one_le_exp (p / 8)) hgap.le + have hfour : 4 ≤ gap * Real.exp (p / 8) := by nlinarith + calc + _ ≤ (gap * Real.exp (p / 8)) * Real.exp (-p / 4) := + mul_le_mul_of_nonneg_right hfour (Real.exp_nonneg _) + _ = _ := by + rw [mul_assoc, ← Real.exp_add] + congr 2 + ring + +theorem exists_quantitative_bohr_bound {epsilon : ℝ} (hepsilon : 0 < epsilon) : + ∃ H : ℝ, 0 ≤ H ∧ ∀ (N : ℕ) [NeZero N] (B₀ : CyclicBohr.Set N) (p R P W : ℝ), + B₀.IsRankRegular → 0 < B₀.radius → B₀.radius ≤ 2 → 1 ≤ B₀.rank → + 512 ≤ p → 32 / (1 - refinementContraction epsilon) ≤ p → 0 ≤ R → + Real.exp (-R) ≤ B₀.radius → + ∀ A B : ZMod N → ℝ, + (∀ r, 0 ≤ A r ∧ A r ≤ Real.exp p) → (∀ r, 0 ≤ B r ∧ B r ≤ Real.exp p) → + 0 ≤ W → W ≤ Real.exp (p / 8) → (∀ r, |A r - (1 + epsilon) * B r| ≤ W) → + CyclicNiltestUpperComparison.{0} 1 N P (Real.exp (-P)) A B → + (let n := ⌈(p / 4) / (1 - refinementContraction epsilon)⌉₊ + let d := B₀.rank + n * unbalancedRankExtra (localMomentGain (flatComparisonDelta epsilon)) p H + let loss := refinementRoundLoss d p H epsilon + refinementComparisonBudget d p (R + n * loss) epsilon ≤ P) → + CellBilinearBound B₀.carrier (fun r => A r - (1 + epsilon) * B r) + (2 * Real.exp (-p / 8)) := by + obtain ⟨C, H, _, hH, hmoment⟩ := + exists_refinement_moment_orders (epsilon := epsilon) (D := 1 / 4) (by norm_num) + refine ⟨H, hH, ?_⟩ + intro N hN B₀ p R P W hB₀ hBpos hBwidth hBrank hp hplarge hR hBwide + A B hA hB hW hWcap ha hcompare hbudget + obtain ⟨m, hm, _, horder, horders⟩ := hmoment p (by linarith) + let rho := refinementContraction epsilon + let n := ⌈(p / 4) / (1 - rho)⌉₊ + have hrho : 0 ≤ rho := (refinementContraction_bounds epsilon).1 + have hrho1 : rho < 1 := (refinementContraction_bounds epsilon).2 + have hgap : 0 < 1 - rho := by linarith + have hdepth : p / 8 + p / 8 ≤ (1 - rho) * (n : ℝ) := by + have h := (div_le_iff₀ hgap).mp (Nat.le_ceil ((p / 4) / (1 - rho))) + dsimp only [n] + nlinarith + have hnoise : 4 * Real.exp (-p / 4) ≤ (1 - rho) * Real.exp (-(p / 8)) := by + simpa only [neg_div] using refinement_error_small hgap hplarge + have h := bohr_refinement_iteration B₀ hB₀ hBpos hBwidth hBrank + hepsilon hp hR hH hBwide n A B hA hB hW hWcap ha hcompare m hm horder horders hbudget + apply h.mono + simpa only [neg_div] using refinement_coefficient_le hrho hrho1 hW hWcap hdepth hnoise + +end Erdos3.CellRefinement + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/QuarticBohrProgression.lean b/lean/OAI/Combinatorics/Progressions/Fourier/QuarticBohrProgression.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f025ca36f0196efdbe8f3dbb13508dd29ed2c64 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/QuarticBohrProgression.lean @@ -0,0 +1,838 @@ +import OAI.Combinatorics.Progressions.Estimates.MinkowskiSecondInduction +import OAI.Combinatorics.Progressions.Fourier.ExponentialBohrVolume + +namespace OAI + +section + +open scoped BigOperators Matrix Pointwise + +namespace Erdos3.BohrProgression + +open Erdos3.BohrLattice.BoxCertificate +open Erdos3.BohrLattice.MinkowskiSecondBox + +noncomputable section + +noncomputable def indexedCyclicCharacter {N : ℕ} + (Gamma : Finset (ZMod N)) : Fin (Gamma.card + 1) → ZMod N := + Fin.cases 1 fun i => (Gamma.equivFin.symm i : Gamma) + +@[simp] lemma indexedCyclicCharacter_zero {N : ℕ} + (Gamma : Finset (ZMod N)) : indexedCyclicCharacter Gamma 0 = 1 := rfl + +lemma indexedCyclicCharacter_succ_mem {N : ℕ} + (Gamma : Finset (ZMod N)) (i : Fin Gamma.card) : + indexedCyclicCharacter Gamma i.succ ∈ Gamma := by + change ((Gamma.equivFin.symm i : Gamma) : ZMod N) ∈ Gamma + exact (Gamma.equivFin.symm i).property + +def bohrLatticeMatrixInt {N : ℕ} (Gamma : Finset (ZMod N)) : + Matrix (Fin (Gamma.card + 1)) (Fin (Gamma.card + 1)) ℤ := + fun i j => if j = 0 then ((indexedCyclicCharacter Gamma i).val : ℤ) + else if i = j then (N : ℤ) else 0 + +def bohrLatticeMatrix {N : ℕ} (Gamma : Finset (ZMod N)) : + Matrix (Fin (Gamma.card + 1)) (Fin (Gamma.card + 1)) ℝ := + (bohrLatticeMatrixInt Gamma).map (Int.castRingHom ℝ) + +@[simp] lemma bohrLatticeMatrixInt_zero_succ {N : ℕ} + (Gamma : Finset (ZMod N)) (j : Fin Gamma.card) : + bohrLatticeMatrixInt Gamma 0 j.succ = 0 := by + simp [bohrLatticeMatrixInt, (Fin.succ_ne_zero j).symm] + +@[simp] lemma bohrLatticeMatrix_zero_zero {N : ℕ} + (Gamma : Finset (ZMod N)) (hN : 1 < N) : + bohrLatticeMatrix Gamma 0 0 = 1 := by + simp [bohrLatticeMatrix, bohrLatticeMatrixInt, ZMod.val_one'' (by omega : N ≠ 1)] + +@[simp] lemma bohrLatticeMatrix_zero_succ {N : ℕ} + (Gamma : Finset (ZMod N)) (j : Fin Gamma.card) : + bohrLatticeMatrix Gamma 0 j.succ = 0 := by + simp [bohrLatticeMatrix] + +@[simp] lemma bohrLatticeMatrix_succ_succ {N : ℕ} + (Gamma : Finset (ZMod N)) (i j : Fin Gamma.card) : + bohrLatticeMatrix Gamma i.succ j.succ = + if i = j then (N : ℝ) else 0 := by + simp [bohrLatticeMatrix, bohrLatticeMatrixInt, Fin.succ_inj] + +lemma det_bohrLatticeMatrix {N : ℕ} (Gamma : Finset (ZMod N)) (hN : 1 < N) : + (bohrLatticeMatrix Gamma).det = (N : ℝ) ^ Gamma.card := by + have hminor : + (bohrLatticeMatrix Gamma).submatrix Fin.succ (Fin.succAbove 0) = + Matrix.diagonal (fun _ : Fin Gamma.card => (N : ℝ)) := by + ext i j + rw [Matrix.diagonal_apply] + simp [Matrix.submatrix] + rw [Matrix.det_succ_row_zero, Fin.sum_univ_succ] + simp only [bohrLatticeMatrix_zero_zero Gamma hN, bohrLatticeMatrix_zero_succ] + rw [hminor] + rw [Matrix.det_diagonal] + simp + +lemma det_bohrLatticeMatrix_ne_zero {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) : + (bohrLatticeMatrix Gamma).det ≠ 0 := by + rw [det_bohrLatticeMatrix Gamma hN] + positivity + +noncomputable def bohrLatticeBasis {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) : + Module.Basis (Fin (Gamma.card + 1)) ℝ + (Fin (Gamma.card + 1) → ℝ) := + matrixBasis (bohrLatticeMatrix Gamma) + (det_bohrLatticeMatrix_ne_zero Gamma hN) + +@[simp] lemma bohrLatticeBasis_apply {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) + (j i : Fin (Gamma.card + 1)) : + bohrLatticeBasis Gamma hN j i = bohrLatticeMatrix Gamma i j := by + exact congrFun (matrixBasis_apply (bohrLatticeMatrix Gamma) + (det_bohrLatticeMatrix_ne_zero Gamma hN) j) i + +def bohrLatticePoint {N : ℕ} (Gamma : Finset (ZMod N)) + (z : Fin (Gamma.card + 1) → ℤ) : Fin (Gamma.card + 1) → ℤ := + Matrix.mulVec (bohrLatticeMatrixInt Gamma) z + +lemma intCastVec_bohrLatticePoint {N : ℕ} (Gamma : Finset (ZMod N)) + (z : Fin (Gamma.card + 1) → ℤ) : + intCastVec (bohrLatticePoint Gamma z) = + Matrix.mulVec (bohrLatticeMatrix Gamma) (intCastVec z) := by + funext i + simp [bohrLatticePoint, bohrLatticeMatrix, Matrix.mulVec, dotProduct, + intCastVec] + +lemma bohrLatticePoint_zero {N : ℕ} (Gamma : Finset (ZMod N)) (hN : 1 < N) + (z : Fin (Gamma.card + 1) → ℤ) : + bohrLatticePoint Gamma z 0 = z 0 := by + simp [bohrLatticePoint, Matrix.mulVec, dotProduct, Fin.sum_univ_succ, + bohrLatticeMatrixInt, ZMod.val_one'' (by omega : N ≠ 1), + (fun x : Fin Gamma.card => (Fin.succ_ne_zero x).symm)] + +lemma bohrLatticePoint_cast_coordinate {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (z : Fin (Gamma.card + 1) → ℤ) + (hN : 1 < N) + (i : Fin (Gamma.card + 1)) : + (bohrLatticePoint Gamma z i : ZMod N) = + (bohrLatticePoint Gamma z 0 : ZMod N) * + indexedCyclicCharacter Gamma i := by + rw [bohrLatticePoint_zero Gamma hN] + simp only [bohrLatticePoint, Matrix.mulVec, dotProduct] + rw [Fin.sum_univ_succ] + simp only [bohrLatticeMatrixInt] + by_cases hi : i = 0 + · subst i + simp + · simp [mul_comm] + +structure CyclicCenteredGAP (N : ℕ) where + rank : ℕ + step : Fin rank → ZMod N + radius : Fin rank → ℕ + +namespace CyclicCenteredGAP + +abbrev Param {N : ℕ} (Q : CyclicCenteredGAP N) := + (i : Fin Q.rank) → Fin (2 * Q.radius i + 1) + +def coeff {N : ℕ} (Q : CyclicCenteredGAP N) (x : Q.Param) + (i : Fin Q.rank) : ℤ := (x i : ℤ) - Q.radius i + +def eval {N : ℕ} (Q : CyclicCenteredGAP N) (x : Q.Param) : ZMod N := + ∑ i, (Q.coeff x i : ZMod N) * Q.step i + +noncomputable def carrier {N : ℕ} (Q : CyclicCenteredGAP N) : Finset (ZMod N) := + (Finset.univ : Finset Q.Param).image Q.eval + +def Proper {N : ℕ} (Q : CyclicCenteredGAP N) : Prop := + Function.Injective Q.eval + +lemma card_carrier_of_proper {N : ℕ} (Q : CyclicCenteredGAP N) + (hQ : Q.Proper) : + Q.carrier.card = ∏ i, (2 * Q.radius i + 1) := by + rw [carrier, Finset.card_image_of_injective _ hQ, Finset.card_univ] + simp [Param] + +lemma coeff_abs_le {N : ℕ} (Q : CyclicCenteredGAP N) + (x : Q.Param) (i : Fin Q.rank) : + |Q.coeff x i| ≤ (Q.radius i : ℤ) := by + change |(x i : ℤ) - Q.radius i| ≤ (Q.radius i : ℤ) + rw [abs_le] + have hi := (x i).isLt + change (x i : ℕ) < 2 * Q.radius i + 1 at hi + constructor <;> omega + +lemma coeff_sub_abs_le_two_mul {N : ℕ} (Q : CyclicCenteredGAP N) + (x y : Q.Param) (i : Fin Q.rank) : + |Q.coeff x i - Q.coeff y i| ≤ (2 * Q.radius i : ℕ) := by + calc + |Q.coeff x i - Q.coeff y i| ≤ + |Q.coeff x i| + |Q.coeff y i| := abs_sub _ _ + _ ≤ (Q.radius i : ℤ) + Q.radius i := + add_le_add (Q.coeff_abs_le x i) (Q.coeff_abs_le y i) + _ = (2 * Q.radius i : ℕ) := by push_cast; ring + +end CyclicCenteredGAP + +noncomputable def bohrSuccessiveCertificate {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) : + SuccessiveProductCertificate + (Submodule.span ℤ (Set.range (bohrLatticeBasis Gamma hN))).toAddSubgroup + (fun _ => R) + (minkowskiSecondConstant (Gamma.card + 1) * + |(Matrix.of (bohrLatticeBasis Gamma hN)).det| * + (∏ _i : Fin (Gamma.card + 1), R)⁻¹) := + Classical.choice + (realBox_has_minkowskiSecondCertificate + (bohrLatticeBasis Gamma hN) (fun _ => R) (fun _ => hR)) + +noncomputable def bohrCertificateCoeff {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i : Fin (Gamma.card + 1)) : Fin (Gamma.card + 1) → ℤ := + Classical.choose + ((Submodule.mem_span_range_iff_exists_fun ℤ).mp + ((bohrSuccessiveCertificate Gamma hN R hR).point_mem i)) + +lemma bohrCertificateCoeff_spec {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i : Fin (Gamma.card + 1)) : + ∑ j, bohrCertificateCoeff Gamma hN R hR i j • + bohrLatticeBasis Gamma hN j = + (bohrSuccessiveCertificate Gamma hN R hR).point i := + Classical.choose_spec + ((Submodule.mem_span_range_iff_exists_fun ℤ).mp + ((bohrSuccessiveCertificate Gamma hN R hR).point_mem i)) + +noncomputable def bohrCertificatePoint {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i : Fin (Gamma.card + 1)) : Fin (Gamma.card + 1) → ℤ := + bohrLatticePoint Gamma (bohrCertificateCoeff Gamma hN R hR i) + +lemma intCastVec_bohrCertificatePoint {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i : Fin (Gamma.card + 1)) : + intCastVec (bohrCertificatePoint Gamma hN R hR i) = + (bohrSuccessiveCertificate Gamma hN R hR).point i := by + rw [bohrCertificatePoint, intCastVec_bohrLatticePoint] + rw [← bohrCertificateCoeff_spec Gamma hN R hR i] + funext k + simp only [Matrix.mulVec, dotProduct, Finset.sum_apply, Pi.smul_apply] + apply Finset.sum_congr rfl + intro j hj + rw [bohrLatticeBasis_apply] + simp [intCastVec, mul_comm] + +lemma bohrCertificatePoint_independent {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) : + LinearIndependent ℝ (fun i => + intCastVec (bohrCertificatePoint Gamma hN R hR i)) := by + simpa only [intCastVec_bohrCertificatePoint] using + (bohrSuccessiveCertificate Gamma hN R hR).independent + +lemma bohrCertificate_scale_pos {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i : Fin (Gamma.card + 1)) : + 0 < (bohrSuccessiveCertificate Gamma hN R hR).scale i := by + let C := bohrSuccessiveCertificate Gamma hN R hR + have hs := C.scale_nonneg i + refine hs.lt_of_ne ?_ + intro hz + have hpzero : C.point i = 0 := by + have hm := C.mem_scaledBox i + rw [← hz, zero_smul] at hm + ext j + have hlo := hm.1 j + have hhi := hm.2 j + simp only [Pi.zero_apply, neg_zero] at hlo hhi + exact le_antisymm hhi hlo + exact C.independent.ne_zero i hpzero + +noncomputable def bohrProgressionRadius {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i : Fin (Gamma.card + 1)) : ℕ := + ⌊((4 * (Gamma.card + 1) : ℝ) * + (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹⌋₊ + +noncomputable def bohrCyclicProgression {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) : + CyclicCenteredGAP N where + rank := Gamma.card + 1 + step i := (bohrCertificatePoint Gamma hN R hR i 0 : ZMod N) + radius := bohrProgressionRadius Gamma hN R hR + +lemma bohrProgressionRadius_mul_scale_le {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i : Fin (Gamma.card + 1)) : + (bohrProgressionRadius Gamma hN R hR i : ℝ) * + (bohrSuccessiveCertificate Gamma hN R hR).scale i ≤ + 1 / (4 * (Gamma.card + 1) : ℝ) := by + let s := (bohrSuccessiveCertificate Gamma hN R hR).scale i + have hs : 0 < s := bohrCertificate_scale_pos Gamma hN R hR i + have hm : (0 : ℝ) < 4 * (Gamma.card + 1) := by positivity + have hfloor : + (bohrProgressionRadius Gamma hN R hR i : ℝ) ≤ + ((4 * (Gamma.card + 1) : ℝ) * s)⁻¹ := by + apply Nat.floor_le + positivity + calc + (bohrProgressionRadius Gamma hN R hR i : ℝ) * s ≤ + ((4 * (Gamma.card + 1) : ℝ) * s)⁻¹ * s := + mul_le_mul_of_nonneg_right hfloor hs.le + _ = 1 / (4 * (Gamma.card + 1) : ℝ) := by + field_simp + +lemma abs_intCast_bohrCertificatePoint_le {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i j : Fin (Gamma.card + 1)) : + |(bohrCertificatePoint Gamma hN R hR i j : ℝ)| ≤ + (bohrSuccessiveCertificate Gamma hN R hR).scale i * R := by + let C := bohrSuccessiveCertificate Gamma hN R hR + have hm := C.mem_scaledBox i + have hlo := hm.1 j + have hhi := hm.2 j + rw [← intCastVec_bohrCertificatePoint Gamma hN R hR i] at hlo hhi + change -(C.scale i * R) ≤ + (bohrCertificatePoint Gamma hN R hR i j : ℝ) at hlo + change (bohrCertificatePoint Gamma hN R hR i j : ℝ) ≤ + C.scale i * R at hhi + exact (abs_le.mpr ⟨hlo, hhi⟩) + +def bohrCertificateCombination {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (u : Fin (Gamma.card + 1) → ℤ) : Fin (Gamma.card + 1) → ℤ := + fun j => ∑ i, u i * bohrCertificatePoint Gamma hN R hR i j + +lemma bohrCertificateCombination_cast_coordinate {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (u : Fin (Gamma.card + 1) → ℤ) (j : Fin (Gamma.card + 1)) : + (bohrCertificateCombination Gamma hN R hR u j : ZMod N) = + (bohrCertificateCombination Gamma hN R hR u 0 : ZMod N) * + indexedCyclicCharacter Gamma j := by + simp only [bohrCertificateCombination, Int.cast_sum, Int.cast_mul] + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i hi + have hp := bohrLatticePoint_cast_coordinate Gamma + (bohrCertificateCoeff Gamma hN R hR i) hN j + change (bohrCertificatePoint Gamma hN R hR i j : ZMod N) = + (bohrCertificatePoint Gamma hN R hR i 0 : ZMod N) * + indexedCyclicCharacter Gamma j at hp + rw [hp] + ring + +lemma abs_intCast_bohrCertificateCombination_le {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (a : ℕ) (u : Fin (Gamma.card + 1) → ℤ) + (hu : ∀ i, |u i| ≤ (a * bohrProgressionRadius Gamma hN R hR i : ℕ)) + (j : Fin (Gamma.card + 1)) : + |(bohrCertificateCombination Gamma hN R hR u j : ℝ)| ≤ + (a : ℝ) * R / 4 := by + let m := Gamma.card + 1 + have hm : (0 : ℝ) < m := by positivity + have hR0 : 0 ≤ R := hR.le + have hterm (i : Fin m) : + |(u i : ℝ) * + (bohrCertificatePoint Gamma hN R hR i j : ℝ)| ≤ + (a : ℝ) * R / (4 * m : ℝ) := by + rw [abs_mul] + have huR : |(u i : ℝ)| ≤ + (a : ℝ) * bohrProgressionRadius Gamma hN R hR i := by + rw [← Int.cast_abs] + exact_mod_cast hu i + calc + |(u i : ℝ)| * + |(bohrCertificatePoint Gamma hN R hR i j : ℝ)| ≤ + ((a : ℝ) * bohrProgressionRadius Gamma hN R hR i) * + ((bohrSuccessiveCertificate Gamma hN R hR).scale i * R) := by + gcongr + exact abs_intCast_bohrCertificatePoint_le Gamma hN R hR i j + _ = (a : ℝ) * + ((bohrProgressionRadius Gamma hN R hR i : ℝ) * + (bohrSuccessiveCertificate Gamma hN R hR).scale i) * R := by ring + _ ≤ (a : ℝ) * (1 / (4 * m : ℝ)) * R := by + gcongr + simpa [m, Nat.cast_add, Nat.cast_one] using + bohrProgressionRadius_mul_scale_le Gamma hN R hR i + _ = (a : ℝ) * R / (4 * m : ℝ) := by ring + have hcast : (bohrCertificateCombination Gamma hN R hR u j : ℝ) = + ∑ i, (u i : ℝ) * + (bohrCertificatePoint Gamma hN R hR i j : ℝ) := by + simp [bohrCertificateCombination] + rw [hcast] + calc + |∑ i, (u i : ℝ) * + (bohrCertificatePoint Gamma hN R hR i j : ℝ)| ≤ + ∑ i, |(u i : ℝ) * + (bohrCertificatePoint Gamma hN R hR i j : ℝ)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i : Fin m, ((a : ℝ) * R / (4 * m : ℝ)) := by + exact Finset.sum_le_sum fun i hi => hterm i + _ = (a : ℝ) * R / 4 := by + simp [m] + field_simp + +lemma eval_bohrCyclicProgression {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (x : (bohrCyclicProgression Gamma hN R hR).Param) : + (bohrCyclicProgression Gamma hN R hR).eval x = + (bohrCertificateCombination Gamma hN R hR + ((bohrCyclicProgression Gamma hN R hR).coeff x) 0 : ZMod N) := by + simp only [CyclicCenteredGAP.eval, bohrCyclicProgression, + bohrCertificateCombination, Int.cast_sum, Int.cast_mul] + apply Finset.sum_congr rfl + intro i hi + rfl + +lemma int_eq_zero_of_cast_zmod_eq_zero_of_abs_lt {N : ℕ} [NeZero N] + {t : ℤ} (ht0 : (t : ZMod N) = 0) (htN : |(t : ℝ)| < N) : t = 0 := by + have hdvd : (N : ℤ) ∣ t := + (ZMod.intCast_zmod_eq_zero_iff_dvd t N).mp ht0 + have habs : (t.natAbs : ℝ) = |(t : ℝ)| := by + calc + (t.natAbs : ℝ) = (((t.natAbs : ℕ) : ℤ) : ℝ) := by norm_num + _ = ((|t| : ℤ) : ℝ) := by rw [Int.natCast_natAbs] + _ = |(t : ℝ)| := Int.cast_abs + have hnat : t.natAbs < N := by + exact_mod_cast (habs.trans_lt htN) + apply Int.eq_zero_of_dvd_of_natAbs_lt_natAbs hdvd + simpa using hnat + +theorem bohrCyclicProgression_proper {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (hsmall : R < 2 * N) : + (bohrCyclicProgression Gamma hN R hR).Proper := by + let Q := bohrCyclicProgression Gamma hN R hR + intro x y hxy + let u : Fin (Gamma.card + 1) → ℤ := fun i => Q.coeff x i - Q.coeff y i + let v := bohrCertificateCombination Gamma hN R hR u + have hu (i : Fin (Gamma.card + 1)) : + |u i| ≤ (2 * bohrProgressionRadius Gamma hN R hR i : ℕ) := by + exact CyclicCenteredGAP.coeff_sub_abs_le_two_mul Q x y i + have hv0cast : (v 0 : ZMod N) = 0 := by + have hx := eval_bohrCyclicProgression Gamma hN R hR x + have hy := eval_bohrCyclicProgression Gamma hN R hR y + have hvsub : (v 0 : ZMod N) = + (bohrCyclicProgression Gamma hN R hR).eval x - + (bohrCyclicProgression Gamma hN R hR).eval y := by + rw [hx, hy] + simp only [v, u, bohrCertificateCombination, Int.cast_sum, Int.cast_mul, + Int.cast_sub] + rw [← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro i hi + ring + rw [hvsub, hxy, sub_self] + have hvcast (j : Fin (Gamma.card + 1)) : (v j : ZMod N) = 0 := by + rw [bohrCertificateCombination_cast_coordinate Gamma hN R hR u j, + hv0cast, zero_mul] + have hvabs (j : Fin (Gamma.card + 1)) : |(v j : ℝ)| ≤ R / 2 := by + convert abs_intCast_bohrCertificateCombination_le Gamma hN R hR 2 u hu j + using 1; norm_num; ring + have hvzero : v = 0 := by + funext j + apply int_eq_zero_of_cast_zmod_eq_zero_of_abs_lt (hvcast j) + exact (hvabs j).trans_lt (by linarith) + have hsum : ∑ i, (u i : ℝ) • + intCastVec (bohrCertificatePoint Gamma hN R hR i) = 0 := by + funext j + have hj := congrFun hvzero j + have hjR : (v j : ℝ) = 0 := by exact_mod_cast hj + simpa [v, bohrCertificateCombination, intCastVec] using hjR + have huR : ∀ i, (u i : ℝ) = 0 := + (Fintype.linearIndependent_iff.mp + (bohrCertificatePoint_independent Gamma hN R hR)) _ hsum + have hu0 : u = 0 := by + funext i + change u i = 0 + exact_mod_cast huR i + funext i + apply Fin.ext + have hi0 : u i = 0 := by + change u i = (0 : Fin (Gamma.card + 1) → ℤ) i + exact congrFun hu0 i + have hi : (x i : ℤ) = (y i : ℤ) := by + dsimp only [u, Q] at hi0 + simp only [CyclicCenteredGAP.coeff] at hi0 + omega + exact_mod_cast hi + +lemma matrixOf_bohrLatticeBasis {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) : + Matrix.of (bohrLatticeBasis Gamma hN) = + (bohrLatticeMatrix Gamma)ᵀ := by + ext i j + rw [Matrix.of_apply, Matrix.transpose_apply] + exact bohrLatticeBasis_apply Gamma hN i j + +lemma abs_det_matrixOf_bohrLatticeBasis {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) : + |(Matrix.of (bohrLatticeBasis Gamma hN)).det| = + (N : ℝ) ^ Gamma.card := by + rw [matrixOf_bohrLatticeBasis Gamma hN, + Matrix.det_transpose, det_bohrLatticeMatrix Gamma hN, abs_of_nonneg] + positivity + +lemma inv_scale_le_two_mul_bohrProgressionRadius_add_one + {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (i : Fin (Gamma.card + 1)) : + (((4 * (Gamma.card + 1) : ℝ) * + (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹) ≤ + 2 * (bohrProgressionRadius Gamma hN R hR i : ℝ) + 1 := by + have hlt := Nat.lt_floor_add_one + (((4 * (Gamma.card + 1) : ℝ) * + (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹) + change (((4 * (Gamma.card + 1) : ℝ) * + (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹) < + (bohrProgressionRadius Gamma hN R hR i : ℝ) + 1 at hlt + have hradius : 0 ≤ (bohrProgressionRadius Gamma hN R hR i : ℝ) := by + positivity + linarith + +theorem bohrCyclicProgression_card_lower_bound {N : ℕ} [NeZero N] + (Gamma : Finset (ZMod N)) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (hsmall : R < 2 * N) : + ((((4 * (Gamma.card + 1) : ℝ) ^ (Gamma.card + 1)) * + (minkowskiSecondConstant (Gamma.card + 1) * + (N : ℝ) ^ Gamma.card * + (R ^ (Gamma.card + 1))⁻¹))⁻¹) ≤ + ((bohrCyclicProgression Gamma hN R hR).carrier.card : ℝ) := by + let c : ℝ := 4 * (Gamma.card + 1) + let B : ℝ := minkowskiSecondConstant (Gamma.card + 1) * + |(Matrix.of (bohrLatticeBasis Gamma hN)).det| * + (∏ _i : Fin (Gamma.card + 1), R)⁻¹ + have hc : 0 < c := by positivity + have hscale (i : Fin (Gamma.card + 1)) : + 0 < (bohrSuccessiveCertificate Gamma hN R hR).scale i := by + exact bohrCertificate_scale_pos Gamma hN R hR i + have hprodscale : 0 < + ∏ i, (bohrSuccessiveCertificate Gamma hN R hR).scale i := by + exact Finset.prod_pos fun i _ => hscale i + have hB : 0 < B := by + simp only [B, abs_det_matrixOf_bohrLatticeBasis Gamma hN, + Finset.prod_const, Finset.card_univ, Fintype.card_fin] + unfold minkowskiSecondConstant + positivity + have hcertificate : + (∏ i, (bohrSuccessiveCertificate Gamma hN R hR).scale i) ≤ B := by + exact (bohrSuccessiveCertificate Gamma hN R hR).product_le + have hreciprocal : (c ^ (Gamma.card + 1) * B)⁻¹ ≤ + (c ^ (Gamma.card + 1) * + ∏ i, (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹ := by + apply (inv_le_inv₀ (mul_pos (pow_pos hc _) hB) + (mul_pos (pow_pos hc _) hprodscale)).2 + exact mul_le_mul_of_nonneg_left hcertificate (pow_nonneg hc.le _) + have hproduct : + (c ^ (Gamma.card + 1) * + ∏ i, (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹ ≤ + ∏ i : Fin (Gamma.card + 1), + (2 * (bohrProgressionRadius Gamma hN R hR i : ℝ) + 1) := by + calc + (c ^ (Gamma.card + 1) * + ∏ i, (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹ = + (∏ i : Fin (Gamma.card + 1), + c * (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹ := by + congr 1 + rw [Finset.prod_mul_distrib] + simp only [Finset.prod_const, Finset.card_univ, Fintype.card_fin] + _ = ∏ i : Fin (Gamma.card + 1), + (c * (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹ := by + rw [Finset.prod_inv_distrib] + _ ≤ ∏ i : Fin (Gamma.card + 1), + (2 * (bohrProgressionRadius Gamma hN R hR i : ℝ) + 1) := by + apply Finset.prod_le_prod₀ + · intro i hi + exact inv_nonneg.mpr (mul_nonneg hc.le + ((bohrSuccessiveCertificate Gamma hN R hR).scale_nonneg i)) + · intro i hi + simpa [c] using + inv_scale_le_two_mul_bohrProgressionRadius_add_one + Gamma hN R hR i + have hcard := CyclicCenteredGAP.card_carrier_of_proper + (bohrCyclicProgression Gamma hN R hR) + (bohrCyclicProgression_proper Gamma hN R hR hsmall) + have hBform : B = minkowskiSecondConstant (Gamma.card + 1) * + (N : ℝ) ^ Gamma.card * (R ^ (Gamma.card + 1))⁻¹ := by + simp [B, abs_det_matrixOf_bohrLatticeBasis Gamma hN, + Finset.prod_const] + calc + ((((4 * (Gamma.card + 1) : ℝ) ^ (Gamma.card + 1)) * + (minkowskiSecondConstant (Gamma.card + 1) * + (N : ℝ) ^ Gamma.card * + (R ^ (Gamma.card + 1))⁻¹))⁻¹) = + (c ^ (Gamma.card + 1) * B)⁻¹ := by + rw [hBform] + _ ≤ (c ^ (Gamma.card + 1) * + ∏ i, (bohrSuccessiveCertificate Gamma hN R hR).scale i)⁻¹ := + hreciprocal + _ ≤ ∏ i : Fin (Gamma.card + 1), + (2 * (bohrProgressionRadius Gamma hN R hR i : ℝ) + 1) := hproduct + _ = ((bohrCyclicProgression Gamma hN R hR).carrier.card : ℝ) := by + rw [hcard] + norm_cast + +end + +end Erdos3.BohrProgression + +end + +section + +namespace Erdos3.BohrProgression + +open scoped BigOperators +open BohrLattice.MinkowskiSecondBox + +theorem bohrCyclicProgression_carrier_subset {N : ℕ} [NeZero N] + (B : CyclicBohr.Set N) (hN : 1 < N) (R : ℝ) (hR : 0 < R) + (hsmall : 2 * R ≤ B.radius * N) : + (bohrCyclicProgression B.frequencies hN R hR).carrier ⊆ B.carrier := by + intro z hz + obtain ⟨x, _hx, rfl⟩ := Finset.mem_image.mp hz + rw [CyclicBohr.Set.mem_carrier] + intro k hk + let Γ := B.frequencies + let i : Fin Γ.card := Γ.equivFin ⟨k, hk⟩ + let u : Fin (Γ.card + 1) → ℤ := + (bohrCyclicProgression Γ hN R hR).coeff x + let v := bohrCertificateCombination Γ hN R hR u + have hu (j : Fin (Γ.card + 1)) : + |u j| ≤ (bohrProgressionRadius Γ hN R hR j : ℕ) := + CyclicCenteredGAP.coeff_abs_le (bohrCyclicProgression Γ hN R hR) x j + have heval : (bohrCyclicProgression Γ hN R hR).eval x = (v 0 : ZMod N) := + eval_bohrCyclicProgression Γ hN R hR x + have hchar : indexedCyclicCharacter Γ i.succ = k := by + change ((Γ.equivFin.symm i : Γ) : ZMod N) = k + simp [i] + have hvchar : k * (bohrCyclicProgression Γ hN R hR).eval x = + (v i.succ : ZMod N) := by + rw [bohrCertificateCombination_cast_coordinate Γ hN R hR u i.succ, + hchar, heval, mul_comm] + have hvabs : |(v i.succ : ℝ)| ≤ R / 4 := by + simpa using abs_intCast_bohrCertificateCombination_le Γ hN R hR 1 u + (by simpa using hu) i.succ + refine (CyclicBohr.norm_one_sub_character_le_of_mul_eq_intCast + k _ (v i.succ) hvchar).trans ?_ + have hNpos : (0 : ℝ) < N := by exact_mod_cast NeZero.pos N + apply (div_le_iff₀ hNpos).2 + nlinarith + +theorem exists_proper_progression_subset {N : ℕ} [NeZero N] + (B : CyclicBohr.Set N) (hB : 0 < B.radius) (hB1 : B.radius ≤ 1) + (hN : 1 < N) : + ∃ Q : CyclicCenteredGAP N, + Q.rank = B.rank + 1 ∧ Q.Proper ∧ Q.carrier ⊆ B.carrier ∧ + (N : ℝ) * (B.radius / (8 * (B.rank + 1))) ^ (B.rank + 1) / + minkowskiSecondConstant (B.rank + 1) ≤ (Q.carrier.card : ℝ) := by + let R := B.radius * N / 2 + have hNpos : (0 : ℝ) < N := by exact_mod_cast NeZero.pos N + have hR : 0 < R := by dsimp [R]; positivity + have hsmall : R < 2 * N := by dsimp [R]; nlinarith + refine ⟨bohrCyclicProgression B.frequencies hN R hR, rfl, + bohrCyclicProgression_proper B.frequencies hN R hR hsmall, + bohrCyclicProgression_carrier_subset B hN R hR (by dsimp [R]; linarith), ?_⟩ + have hcard := bohrCyclicProgression_card_lower_bound B.frequencies hN R hR hsmall + have hn : (0 : ℝ) < B.rank + 1 := by positivity + have hc : 0 < minkowskiSecondConstant (B.rank + 1) := by + unfold minkowskiSecondConstant + positivity + have heq : + (N : ℝ) * (B.radius / (8 * (B.rank + 1))) ^ (B.rank + 1) / + minkowskiSecondConstant (B.rank + 1) = + (((4 * (B.rank + 1) : ℝ) ^ (B.rank + 1)) * + (minkowskiSecondConstant (B.rank + 1) * (N : ℝ) ^ B.rank * + (R ^ (B.rank + 1))⁻¹))⁻¹ := by + dsimp [R] + simp only [div_pow, mul_pow, pow_succ, mul_inv_rev, inv_inv] + field_simp + rw [show (8 : ℝ) ^ B.rank = (2 : ℝ) ^ B.rank * 4 ^ B.rank by + rw [← mul_pow]; norm_num] + ring + rw [heq] + exact hcard + +end Erdos3.BohrProgression + +end + +section + +namespace Erdos3.BohrProgression + +open BohrLattice.MinkowskiSecondBox + +lemma minkowskiSecondConstant_le_exp (m : ℕ) : + minkowskiSecondConstant m ≤ Real.exp (2 * (m : ℝ) ^ 2) := by + have hidx : m * (m - 1) / 2 ≤ m * m := + (Nat.div_le_self _ _).trans (Nat.mul_le_mul_left m (Nat.sub_le m 1)) + have hcast : ((m * (m - 1) / 2 : ℕ) : ℝ) ≤ (m : ℝ) ^ 2 := by + rw [pow_two] + exact_mod_cast hidx + calc + minkowskiSecondConstant m = (2 : ℝ) ^ (m * (m - 1) / 2) := rfl + _ ≤ Real.exp 2 ^ (m * (m - 1) / 2) := by + apply pow_le_pow_left₀ (by norm_num) + linarith [Real.add_one_le_exp (2 : ℝ)] + _ = Real.exp (((m * (m - 1) / 2 : ℕ) : ℝ) * 2) := + (Real.exp_nat_mul _ _).symm + _ ≤ Real.exp (2 * (m : ℝ) ^ 2) := by + apply Real.exp_le_exp.mpr + linarith + +lemma progression_size_factor_lower_bound (m : ℕ) (hm : 0 < m) + {w δ : ℝ} (hδ : Real.exp (-w) ≤ δ) : + Real.exp (-((m : ℝ) * w + 10 * (m : ℝ) ^ 2)) ≤ + (δ / (8 * m)) ^ m / minkowskiSecondConstant m := by + have hmR : (0 : ℝ) < m := by exact_mod_cast hm + have hden : (0 : ℝ) < 8 * m := by positivity + have hrecip : Real.exp (-(8 * m : ℝ)) ≤ (8 * m : ℝ)⁻¹ := by + rw [Real.exp_neg] + apply (inv_le_inv₀ (Real.exp_pos _) hden).2 + linarith [Real.add_one_le_exp (8 * m : ℝ)] + have hbase : Real.exp (-(w + 8 * m)) ≤ δ / (8 * m) := by + calc + Real.exp (-(w + 8 * m)) = Real.exp (-w) * Real.exp (-(8 * m : ℝ)) := by + rw [← Real.exp_add] + congr 1 + ring + _ ≤ δ * (8 * m : ℝ)⁻¹ := + mul_le_mul hδ hrecip (Real.exp_pos _).le ((Real.exp_pos _).le.trans hδ) + _ = δ / (8 * m) := by rw [div_eq_mul_inv] + have hpower : Real.exp (-((m : ℝ) * w + 8 * (m : ℝ) ^ 2)) ≤ + (δ / (8 * m)) ^ m := by + calc + _ = Real.exp (-(w + 8 * m)) ^ m := by + rw [← Real.exp_nat_mul] + congr 1 + ring + _ ≤ _ := pow_le_pow_left₀ (Real.exp_pos _).le hbase _ + have hc : 0 < minkowskiSecondConstant m := by + unfold minkowskiSecondConstant + positivity + have hinv : Real.exp (-(2 * (m : ℝ) ^ 2)) ≤ (minkowskiSecondConstant m)⁻¹ := by + rw [Real.exp_neg] + exact (inv_le_inv₀ (Real.exp_pos _) hc).2 (minkowskiSecondConstant_le_exp m) + calc + _ = Real.exp (-((m : ℝ) * w + 8 * (m : ℝ) ^ 2)) * + Real.exp (-(2 * (m : ℝ) ^ 2)) := by + rw [← Real.exp_add] + congr 1 + ring + _ ≤ (δ / (8 * m)) ^ m * (minkowskiSecondConstant m)⁻¹ := + mul_le_mul hpower hinv (Real.exp_pos _).le ((Real.exp_pos _).le.trans hpower) + _ = _ := by simp only [div_eq_mul_inv] + +theorem exists_large_proper_progression {N : ℕ} [NeZero N] + (B : CyclicBohr.Set N) (hB : 0 < B.radius) (hB1 : B.radius ≤ 1) + (hN : 1 < N) {w : ℝ} (hwidth : Real.exp (-w) ≤ B.radius) : + ∃ Q : CyclicCenteredGAP N, + Q.rank = B.rank + 1 ∧ Q.Proper ∧ Q.carrier ⊆ B.carrier ∧ + Real.exp (-(((B.rank : ℝ) + 1) * w + 10 * ((B.rank : ℝ) + 1) ^ 2)) * N ≤ + (Q.carrier.card : ℝ) := by + obtain ⟨Q, hr, hQ, hsub, hcard⟩ := exists_proper_progression_subset B hB hB1 hN + refine ⟨Q, hr, hQ, hsub, ?_⟩ + have hfactor := progression_size_factor_lower_bound (B.rank + 1) (by omega) hwidth + push_cast at hfactor + calc + _ ≤ ((B.radius / (8 * ((B.rank : ℝ) + 1))) ^ (B.rank + 1) / + minkowskiSecondConstant (B.rank + 1)) * N := + mul_le_mul_of_nonneg_right hfactor (Nat.cast_nonneg N) + _ = _ := by ring + _ ≤ _ := hcard + +end Erdos3.BohrProgression + +end + +section + +namespace Erdos3.BohrProgression + +namespace CyclicCenteredGAP + +def zero (N : ℕ) : CyclicCenteredGAP N where + rank := 0 + step := Fin.elim0 + radius := Fin.elim0 + +lemma zero_proper (N : ℕ) : (zero N).Proper := by + intro x y _ + funext i + exact Fin.elim0 i + +@[simp] lemma zero_carrier (N : ℕ) : (zero N).carrier = {0} := by + have heval : (zero N).eval = fun _ => 0 := by + funext x + unfold eval + exact Finset.sum_eq_zero fun i _ => Fin.elim0 i + rw [carrier, heval] + exact Finset.image_const ⟨(fun i => Fin.elim0 i), Finset.mem_univ _⟩ 0 + +end CyclicCenteredGAP + +theorem exists_large_proper_progression_all {N : ℕ} [NeZero N] + (B : CyclicBohr.Set N) (hB : 0 < B.radius) (hB1 : B.radius ≤ 1) + {w : ℝ} (hw : 0 ≤ w) (hwidth : Real.exp (-w) ≤ B.radius) : + ∃ Q : CyclicCenteredGAP N, + Q.rank ≤ B.rank + 1 ∧ Q.Proper ∧ Q.carrier ⊆ B.carrier ∧ + Real.exp (-(((B.rank : ℝ) + 1) * w + 10 * ((B.rank : ℝ) + 1) ^ 2)) * N ≤ + (Q.carrier.card : ℝ) := by + by_cases hN : 1 < N + · obtain ⟨Q, hr, hQ, hsub, hcard⟩ := exists_large_proper_progression B hB hB1 hN hwidth + exact ⟨Q, hr.le, hQ, hsub, hcard⟩ + · have hNeq : N = 1 := by have := NeZero.pos N; omega + subst N + refine ⟨CyclicCenteredGAP.zero 1, by simp [CyclicCenteredGAP.zero], + CyclicCenteredGAP.zero_proper 1, ?_, ?_⟩ + · intro x hx + rw [CyclicCenteredGAP.zero_carrier, Finset.mem_singleton] at hx + subst x + exact B.zero_mem + · simp only [CyclicCenteredGAP.zero_carrier, Finset.card_singleton, Nat.cast_one, + mul_one] + apply Real.exp_le_one_iff.mpr + have : 0 ≤ ((B.rank : ℝ) + 1) * w + 10 * ((B.rank : ℝ) + 1) ^ 2 := by positivity + linarith + +theorem exists_proper_progression_of_quartic_bounds {N : ℕ} [NeZero N] + (B : CyclicBohr.Set N) {C p : ℝ} (hC : 0 ≤ C) (hp : 0 ≤ p) + (hB : 0 < B.radius) (hB1 : B.radius ≤ 1) + (hrank : (B.rank : ℝ) ≤ 1 + C * (p + 1) ^ 4) + (hwidth : Real.exp (-(C * (p + 1))) ≤ B.radius) : + ∃ Q : CyclicCenteredGAP N, + (Q.rank : ℝ) ≤ 2 + C * (p + 1) ^ 4 ∧ Q.Proper ∧ Q.carrier ⊆ B.carrier ∧ + Real.exp (-(11 * (C + 2) ^ 2 * (p + 1) ^ 8)) * N ≤ (Q.carrier.card : ℝ) := by + obtain ⟨Q, hr, hQ, hsub, hcard⟩ := exists_large_proper_progression_all B hB hB1 + (by positivity : 0 ≤ C * (p + 1)) hwidth + have hrR : (Q.rank : ℝ) ≤ B.rank + 1 := by exact_mod_cast hr + refine ⟨Q, by linarith, hQ, hsub, ?_⟩ + let u := p + 1 + let m := (B.rank : ℝ) + 1 + have hu : 1 ≤ u := by dsimp [u]; linarith + have hu4 : 1 ≤ u ^ 4 := one_le_pow₀ hu + have huu4 : u ≤ u ^ 4 := by + simpa only [pow_one] using pow_le_pow_right₀ hu (by decide : 1 ≤ (4 : ℕ)) + have hm0 : 0 ≤ m := by dsimp [m]; positivity + have hm : m ≤ (C + 2) * u ^ 4 := by dsimp [m]; nlinarith + have hw : C * u ≤ (C + 2) * u ^ 4 := by nlinarith + have hprod : m * (C * u) ≤ ((C + 2) * u ^ 4) ^ 2 := by + simpa only [pow_two] using mul_le_mul hm hw (by positivity : 0 ≤ C * u) + (by positivity : 0 ≤ (C + 2) * u ^ 4) + have hsquare : m ^ 2 ≤ ((C + 2) * u ^ 4) ^ 2 := + pow_le_pow_left₀ hm0 hm 2 + have hcost : m * (C * u) + 10 * m ^ 2 ≤ 11 * (C + 2) ^ 2 * u ^ 8 := by + calc + _ ≤ 11 * ((C + 2) * u ^ 4) ^ 2 := by linarith + _ = _ := by ring + apply le_trans (b := Real.exp (-(m * (C * u) + 10 * m ^ 2)) * N) ?_ hcard + apply mul_le_mul_of_nonneg_right _ (Nat.cast_nonneg N) + apply Real.exp_le_exp.mpr + linarith + +end Erdos3.BohrProgression + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/QuarticExchangedFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/QuarticExchangedFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ec270631c68649b2f7942765c2e149ca5e13b58 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/QuarticExchangedFourier.lean @@ -0,0 +1,103 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeMixedDerivativeResiduals +import OAI.Combinatorics.Progressions.Estimates.QuarticNativeMixed + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators TensorProduct + +attribute [local instance] NativeVectorCorrelation.lie NativeVectorCorrelation.algebra + NativeVectorCorrelation.topology NativeVectorCorrelation.topologicalAdd + NativeVectorCorrelation.continuousSMul NativeVectorCorrelation.hausdorff + +theorem exists_quartic_exchanged_fourier_correlation_with_mixed : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ n, ‖f n‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 5 f → + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 3) ((p + C) ^ C), + M.HasMixedCorrelation f ∧ + ∃ i : Fin M.outputDim, ∃ Q : Finset (ZMod N × ZMod N), Q.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * (N : ℝ) ^ 2 ≤ (Q.card : ℝ) ∧ + ∃ χ : (ZMod N × ZMod N) → AddChar (ZMod N) ℂ, ∀ t ∈ Q, + Real.exp (-((p + C) ^ C)) ≤ ‖finiteFourierCoeff + (fun n => multiplicativeDerivative (multiplicativeDerivative f t.1) t.2 n * + star (multiplicativeDerivative + (fun x => M.evalCyclic N i (correlationInput t.2 x)) t.1 n)) (χ t)‖ := by + obtain ⟨A, _, hmixed⟩ := exists_quartic_native_mixed_correlation + obtain ⟨B, _, hdifference⟩ := + NativeMixedCorrelation.exists_differenced_residual_correlations 3 (by omega) + obtain ⟨D, _, hfourier⟩ := exists_fourier_of_stepOne_expansion + let X : Polynomial ℕ := Polynomial.X + let U := (X + Polynomial.C A) ^ A + let V := (U + Polynomial.C B) ^ B + let T := (V + Polynomial.C D) ^ D + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (U + V + T) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hGowers + classical + let u := (p + A) ^ A + let v := (u + B) ^ B + let t := (v + D) ^ D + have hu : 0 ≤ u := by dsimp [u]; positivity + have hv : 0 ≤ v := by dsimp [v]; positivity + have ht : 0 ≤ t := by dsimp [t]; positivity + have htotal : u + v + t ≤ (p + C) ^ C := by + simpa [X, U, V, T, u, v, t, Polynomial.eval₂_pow] using hbudget p hp + have huC : u ≤ (p + C) ^ C := by linarith + have hvC : v ≤ (p + C) ^ C := by linarith + have htC : t ≤ (p + C) ^ C := by linarith + obtain ⟨W⟩ := hmixed hp ((Real.exp_le_exp.mpr huC).trans hN) f hf hGowers + obtain ⟨i, Q, hQ, hQdense, hQcorr⟩ := + hdifference hu ((Real.exp_le_exp.mpr hvC).trans hN) hf W + let signal (a : ZMod N × ZMod N) (n : ZMod N) := + multiplicativeDerivative (multiplicativeDerivative f a.1) a.2 n * + star (multiplicativeDerivative + (fun x => W.mixed.evalCyclic N i (correlationInput a.2 x)) a.1 n) + have hsignal (a : ZMod N × ZMod N) (n : ZMod N) : ‖signal a n‖ ≤ 1 := by + dsimp only [signal] + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + (multiplicativeDerivative_norm_le_one _ (multiplicativeDerivative_norm_le_one f hf a.1) a.2 n)).trans + (multiplicativeDerivative_norm_le_one _ (fun x => W.mixed.norm_eval i _) a.1 n) + have hchar (a : ZMod N × ZMod N) (ha : a ∈ Q) : ∃ χ : AddChar (ZMod N) ℂ, + Real.exp (-t) ≤ ‖finiteFourierCoeff (signal a) χ‖ := by + obtain ⟨R⟩ := (hQcorr a ha).2 + let E := NativeIntegerExpansion.ofTest R.test R.complexity (fun _ => rfl) + exact hfourier hv E (signal a) (hsignal a) R.correlation + let χ (a : ZMod N × ZMod N) : AddChar (ZMod N) ℂ := + if ha : a ∈ Q then Classical.choose (hchar a ha) else 1 + refine ⟨W.mixed.mono huC, W.hasMixedCorrelation.mono huC, i, Q, hQ, ?_, χ, ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hvC)) + (sq_nonneg _)).trans hQdense + · intro a ha + change Real.exp (-((p + C) ^ C)) ≤ ‖finiteFourierCoeff (signal a) (χ a)‖ + dsimp only [χ] + rw [dite_eq_left ha] + exact (Real.exp_le_exp.mpr (neg_le_neg htC)).trans (Classical.choose_spec (hchar a ha)) + +theorem exists_quartic_exchanged_fourier_correlation : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ n, ‖f n‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 5 f → + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 3) ((p + C) ^ C), + ∃ i : Fin M.outputDim, ∃ Q : Finset (ZMod N × ZMod N), Q.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * (N : ℝ) ^ 2 ≤ (Q.card : ℝ) ∧ + ∃ χ : (ZMod N × ZMod N) → AddChar (ZMod N) ℂ, ∀ t ∈ Q, + Real.exp (-((p + C) ^ C)) ≤ ‖finiteFourierCoeff + (fun n => multiplicativeDerivative (multiplicativeDerivative f t.1) t.2 n * + star (multiplicativeDerivative + (fun x => M.evalCyclic N i (correlationInput t.2 x)) t.1 n)) (χ t)‖ := by + obtain ⟨C, hC, h⟩ := exists_quartic_exchanged_fourier_correlation_with_mixed + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hGowers + obtain ⟨M, _hret, hM⟩ := h hp hN f hf hGowers + exact ⟨M, hM⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/QuarticOriginalPairFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/QuarticOriginalPairFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..83a665a16edfdc446c174ebe4e3c737df9c48633 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/QuarticOriginalPairFrequency.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Estimates.QuarticPairComparison + +namespace OAI + +section + +namespace Erdos3.NativePolynomialOrbitFactors + +open RationalFilteredNilmanifold VectorPolynomial +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +variable {p q r : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p} {i j : Fin (W.tensorPower 6).outputDim} + {V : NativeSampleCorrelation (fun _ : Fin 4 => 1) 3 q + Finset.univ (fun z : Fin 4 → ZMod N => fun k => ((z k).val : ℤ)) + (fun z => (W.tensorPower 6).quarticAntisymmetric i j (fun k => ((z k).val : ℤ)))} + (R : NativePolynomialOrbitFactors (pi V.quarticPairModels) + V.quarticPairPolynomial (piFrequency V.quarticPairFrequencies) + (fun _ : Fin 4 => (N : ℝ)) r) + +variable (V) in +noncomputable def _root_.OAI.Erdos3.NativeSampleCorrelation.quarticOriginalPairProjection (k : Fin 2) : + V.QuarticPairAlgebra →ₗ⁅ℚ⁆ W.L := liePiEval (some k) + +theorem quartic_original_pair_top_agreement (x : ℝ ⊗[ℚ] V.QuarticPairAlgebra) + (hx : x ∈ (pi V.quarticPairModels).filtration.realGradedRefiltrationLayer + R.subalgebra (∑ _ : QuarticReplicatedIndex, 1)) : + realifyFunctional W.vertical.frequency (realificationLieHom (V.quarticOriginalPairProjection 0) x) = + realifyFunctional W.vertical.frequency (realificationLieHom (V.quarticOriginalPairProjection 1) x) := by + have cancel (a b : ℝ ⊗[ℚ] W.L) + (h : realifyFunctional ((6 : ℕ) • W.vertical.frequency) a = + realifyFunctional ((6 : ℕ) • W.vertical.frequency) b) : + realifyFunctional W.vertical.frequency a = realifyFunctional W.vertical.frequency b := by + rw [realifyFunctional_nsmul, realifyFunctional_nsmul] at h + simp only [nsmul_eq_mul] at h + exact mul_left_cancel₀ (by norm_num : ((6 : ℕ) : ℝ) ≠ 0) h + exact cancel _ _ (R.quartic_pair_top_agreement x hx) + +theorem quartic_original_pair_middle_top_agreement (α : (Fin 4) →₀ ℕ) + (hα : Finsupp.weight (fun _ => 1) α = ∑ _ : QuarticReplicatedIndex, 1) : + realifyFunctional W.vertical.frequency (realificationLieHom (V.quarticOriginalPairProjection 0) + (coefficients (R.middle.coord : VectorPolynomial (Fin 4) ℚ + (ℝ ⊗[ℚ] V.QuarticPairAlgebra)) α)) = + realifyFunctional W.vertical.frequency (realificationLieHom (V.quarticOriginalPairProjection 1) + (coefficients (R.middle.coord : VectorPolynomial (Fin 4) ℚ + (ℝ ⊗[ℚ] V.QuarticPairAlgebra)) α)) := by + apply R.quartic_original_pair_top_agreement + simpa only [hα] using R.middle_coefficients α + +theorem quartic_original_pair_middle_bracket_agreement (α β : (Fin 4) →₀ ℕ) + (hαβ : Finsupp.weight (fun _ => 1) α + Finsupp.weight (fun _ => 1) β = + ∑ _ : QuarticReplicatedIndex, 1) : + realifyFunctional W.vertical.frequency + ⁅realificationLieHom (V.quarticOriginalPairProjection 0) + (coefficients (R.middle.coord : VectorPolynomial (Fin 4) ℚ + (ℝ ⊗[ℚ] V.QuarticPairAlgebra)) α), + realificationLieHom (V.quarticOriginalPairProjection 0) + (coefficients (R.middle.coord : VectorPolynomial (Fin 4) ℚ + (ℝ ⊗[ℚ] V.QuarticPairAlgebra)) β)⁆ = + realifyFunctional W.vertical.frequency + ⁅realificationLieHom (V.quarticOriginalPairProjection 1) + (coefficients (R.middle.coord : VectorPolynomial (Fin 4) ℚ + (ℝ ⊗[ℚ] V.QuarticPairAlgebra)) α), + realificationLieHom (V.quarticOriginalPairProjection 1) + (coefficients (R.middle.coord : VectorPolynomial (Fin 4) ℚ + (ℝ ⊗[ℚ] V.QuarticPairAlgebra)) β)⁆ := by + have cancel (a b : ℝ ⊗[ℚ] W.L) + (h : realifyFunctional ((6 : ℕ) • W.vertical.frequency) a = + realifyFunctional ((6 : ℕ) • W.vertical.frequency) b) : + realifyFunctional W.vertical.frequency a = realifyFunctional W.vertical.frequency b := by + rw [realifyFunctional_nsmul, realifyFunctional_nsmul] at h + simp only [nsmul_eq_mul] at h + exact mul_left_cancel₀ (by norm_num : ((6 : ℕ) : ℝ) ≠ 0) h + exact cancel _ _ (R.quartic_pair_middle_bracket_agreement α β hαβ) + +end Erdos3.NativePolynomialOrbitFactors + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RationalBohrWidth.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RationalBohrWidth.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f7dca785347c022264fbd48cd826c75eb8dceb0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RationalBohrWidth.lean @@ -0,0 +1,126 @@ +import OAI.Combinatorics.Progressions.Results.Basic + +namespace OAI + +section + +namespace Erdos3.BohrWidthBudget + +theorem selector_scale_lower_bound {d D : ℝ} (hd : 0 < d) (hD : 0 ≤ D) : + 1 / (1000 * d * (D + 1)) ≤ + (100 * (2 * d) * ((2 * (⌈D⌉₊ + 1) + 1 : ℕ) : ℝ))⁻¹ := by + have hceil := (Nat.ceil_lt_add_one hD).le + have hsmall : (((2 * (⌈D⌉₊ + 1) + 1 : ℕ) : ℝ)) ≤ 5 * (D + 1) := by + push_cast + linarith + rw [← one_div] + apply one_div_le_one_div_of_le (by positivity) + have hmul := mul_le_mul_of_nonneg_left hsmall (show 0 ≤ 100 * (2 * d) by positivity) + nlinarith + +theorem polynomial_denominator_le_exp {W p d : ℝ} + (hW : 0 < W) (hp : 0 ≤ p) (hd : 1 ≤ d) : + Real.exp p * W * d ^ 3 * (p + 1) ^ 4 ≤ + Real.exp ((W + 8) * (1 + p + Real.log (2 + d))) := by + have hWexp : W ≤ Real.exp W := by linarith [Real.add_one_le_exp W] + have hd0 : 0 ≤ d := by linarith + have hdlog : d ^ 3 ≤ Real.exp (3 * Real.log (2 + d)) := by + calc + d ^ 3 ≤ (2 + d) ^ 3 := pow_le_pow_left₀ hd0 (by linarith) 3 + _ = Real.exp (3 * Real.log (2 + d)) := by + simpa only [Nat.cast_ofNat, Real.exp_log (by positivity : 0 < 2 + d)] using + (Real.exp_nat_mul (Real.log (2 + d)) 3).symm + have hppow : (p + 1) ^ 4 ≤ Real.exp (4 * p) := by + calc + (p + 1) ^ 4 ≤ Real.exp p ^ 4 := + pow_le_pow_left₀ (by positivity) (Real.add_one_le_exp p) 4 + _ = Real.exp (4 * p) := by + simpa only [Nat.cast_ofNat] using (Real.exp_nat_mul p 4).symm + have hlog : 0 ≤ Real.log (2 + d) := Real.log_nonneg (by linarith) + calc + Real.exp p * W * d ^ 3 * (p + 1) ^ 4 ≤ + Real.exp p * Real.exp W * Real.exp (3 * Real.log (2 + d)) * Real.exp (4 * p) := by + gcongr + _ = Real.exp (p + W + 3 * Real.log (2 + d) + 4 * p) := by + rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + _ ≤ Real.exp ((W + 8) * (1 + p + Real.log (2 + d))) := by + apply Real.exp_le_exp.mpr + nlinarith [mul_nonneg hW.le hp, mul_nonneg hW.le hlog] + +theorem exp_neg_budget_le_reciprocal {W p d : ℝ} + (hW : 0 < W) (hp : 0 ≤ p) (hd : 1 ≤ d) : + Real.exp (-((W + 8) * (1 + p + Real.log (2 + d)))) ≤ + 1 / (Real.exp p * W * d ^ 3 * (p + 1) ^ 4) := by + rw [Real.exp_neg, ← one_div] + exact one_div_le_one_div_of_le (by positivity) + (polynomial_denominator_le_exp hW hp hd) + +end Erdos3.BohrWidthBudget + +end + +section + +namespace Erdos3.BohrWidthBudget + +theorem rational_width_lower_bound {u d D w v a : ℝ} + (hu : 0 < u) (hd : 1 ≤ d) (hD : 0 ≤ D) (hw : 0 < w) (hw1 : w ≤ 1) + (hv : w / (400 * d) ≤ v) (ha : 1 / (1000 * d * (D + 1)) ≤ a) : + u * w / (10240000000 * d ^ 3 * (D + 1)) ≤ + min ((u / (6400 * d)) * (a * v / 2)) (u / (8 * (D + 1))) / 2 := by + have hd0 : 0 < d := by linarith + have ha0 : 0 < a := lt_of_lt_of_le (by positivity) ha + have hprod : (1 / (1000 * d * (D + 1))) * (w / (400 * d)) ≤ a * v := + mul_le_mul ha hv (by positivity) ha0.le + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + apply le_min + · calc + u * w / (10240000000 * d ^ 3 * (D + 1)) * 2 = + (u / (6400 * d)) * ((1 / (1000 * d * (D + 1))) * (w / (400 * d)) / 2) := by + field_simp + ring + _ ≤ (u / (6400 * d)) * (a * v / 2) := + mul_le_mul_of_nonneg_left (div_le_div_of_nonneg_right hprod (by norm_num)) (by positivity) + · have hd3 : 1 ≤ d ^ 3 := one_le_pow₀ hd + have hfrac : w / (5120000000 * d ^ 3) ≤ 1 / 8 := by + rw [div_le_iff₀ (by positivity)] + nlinarith + calc + u * w / (10240000000 * d ^ 3 * (D + 1)) * 2 = + (u / (D + 1)) * (w / (5120000000 * d ^ 3)) := by + field_simp + ring + _ ≤ (u / (D + 1)) * (1 / 8) := mul_le_mul_of_nonneg_left hfrac (by positivity) + _ = u / (8 * (D + 1)) := by field_simp + +theorem rational_width_ge_exponential {epsilon C p d w : ℝ} + (hepsilon : 0 < epsilon) (hC : 0 ≤ C) (hp : 0 ≤ p) (hd : 1 ≤ d) (hw : 0 ≤ w) : + let W := 10240000000 * (C + 1) / epsilon + w * Real.exp (-((W + 8) * (1 + p + Real.log (2 + d)))) ≤ + epsilon * Real.exp (-p) * w / (10240000000 * d ^ 3 * (C * (p + 1) ^ 4 + 1)) := by + intro W + have hW : 0 < W := by dsimp [W]; positivity + have hd0 : 0 < d := by linarith + have hbound := mul_le_mul_of_nonneg_left (exp_neg_budget_le_reciprocal hW hp hd) hw + have hp4 : 1 ≤ (p + 1) ^ 4 := one_le_pow₀ (show 1 ≤ p + 1 by linarith) + have hden : 10240000000 * d ^ 3 * (C * (p + 1) ^ 4 + 1) ≤ + 10240000000 * d ^ 3 * ((C + 1) * (p + 1) ^ 4) := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + nlinarith + calc + w * Real.exp (-((W + 8) * (1 + p + Real.log (2 + d)))) ≤ + w * (1 / (Real.exp p * W * d ^ 3 * (p + 1) ^ 4)) := hbound + _ = epsilon * Real.exp (-p) * w / + (10240000000 * d ^ 3 * ((C + 1) * (p + 1) ^ 4)) := by + rw [Real.exp_neg] + dsimp [W] + field_simp + _ ≤ epsilon * Real.exp (-p) * w / + (10240000000 * d ^ 3 * (C * (p + 1) ^ 4 + 1)) := + div_le_div_of_nonneg_left (by positivity) (by positivity) hden + +end Erdos3.BohrWidthBudget + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RationalCharacterIndividualModulus.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RationalCharacterIndividualModulus.lean new file mode 100644 index 0000000000000000000000000000000000000000..873098fe6f0d2d6d7663850e3d4fbbc5492ea86c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RationalCharacterIndividualModulus.lean @@ -0,0 +1,174 @@ +import OAI.Combinatorics.Progressions.Lattices.MixedSmoothUniformBadPrimeProduct + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {O : Type*} {N : ℕ} + +noncomputable def rationalCharacterIndividualModulus (qW : ℕ) + (χ : AddChar (O → ZMod N) ℂ) : ℕ := Nat.lcm qW (orderOf χ) + +theorem rationalCharacterIndividualModulus_dvd (qW : ℕ) + (χ : AddChar (O → ZMod N) ℂ) (hW : qW ∣ N) : + rationalCharacterIndividualModulus qW χ ∣ N := + Nat.lcm_dvd hW (zmod_character_order_dvd χ) + +theorem rationalCharacterIndividualModulus_test_dvd (qW : ℕ) + (χ : AddChar (O → ZMod N) ℂ) : + qW ∣ rationalCharacterIndividualModulus qW χ := Nat.dvd_lcm_left _ _ + +theorem rationalCharacterIndividualModulus_order_dvd (qW : ℕ) + (χ : AddChar (O → ZMod N) ℂ) : + orderOf χ ∣ rationalCharacterIndividualModulus qW χ := Nat.dvd_lcm_right _ _ + +variable [NeZero N] (qW : ℕ) [NeZero qW] (χ : AddChar (O → ZMod N) ℂ) + +theorem rationalCharacterIndividualModulus_pos : + 0 < rationalCharacterIndividualModulus qW χ := + Nat.lcm_pos (NeZero.pos qW) (zmod_character_order_pos χ) + +noncomputable instance rationalCharacterIndividualModulus_neZero : + NeZero (rationalCharacterIndividualModulus qW χ) := + ⟨(rationalCharacterIndividualModulus_pos qW χ).ne'⟩ + +theorem rationalCharacterIndividualModulus_le_mul {T : ℕ} (hχ : orderOf χ ≤ T) : + rationalCharacterIndividualModulus qW χ ≤ qW * T := by + exact (Nat.le_of_dvd (Nat.mul_pos (NeZero.pos qW) (zmod_character_order_pos χ)) + (Nat.lcm_dvd_mul qW (orderOf χ))).trans (Nat.mul_le_mul_left qW hχ) + +variable (hW : qW ∣ N) + +omit [NeZero qW] in +private theorem exists_rationalCharacterIndividualReduction [NeZero qW] : + ∃ ψ : AddChar (O → ZMod (rationalCharacterIndividualModulus qW χ)) ℂ, + characterPullback (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ hW)) ψ = χ ∧ + orderOf ψ = orderOf χ := by + apply exists_zmodPiReduction_character (rationalCharacterIndividualModulus_dvd qW χ hW) χ + exact orderOf_dvd_iff_pow_eq_one.mp (rationalCharacterIndividualModulus_order_dvd qW χ) + +noncomputable def rationalCharacterIndividualReduction : + AddChar (O → ZMod (rationalCharacterIndividualModulus qW χ)) ℂ := + (exists_rationalCharacterIndividualReduction qW χ hW).choose + +theorem rationalCharacterIndividualReduction_order : + orderOf (rationalCharacterIndividualReduction qW χ hW) = orderOf χ := + (exists_rationalCharacterIndividualReduction qW χ hW).choose_spec.2 + +theorem rationalCharacterIndividualReduction_apply (b : O → ZMod N) : + rationalCharacterIndividualReduction qW χ hW + (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ hW) b) = χ b := + congrArg (fun ψ : AddChar (O → ZMod N) ℂ => ψ b) + (exists_rationalCharacterIndividualReduction qW χ hW).choose_spec.1 + +theorem rationalCharacterIndividualReduction_intCast (b : O → ℤ) : + rationalCharacterIndividualReduction qW χ hW + (fun o => (b o : ZMod (rationalCharacterIndividualModulus qW χ))) = + χ (fun o => (b o : ZMod N)) := by + have h := rationalCharacterIndividualReduction_apply qW χ hW (fun o => (b o : ZMod N)) + have hred : zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ hW) + (fun o => (b o : ZMod N)) = + (fun o => (b o : ZMod (rationalCharacterIndividualModulus qW χ))) := by + funext o + exact map_intCast (ZMod.castHom (rationalCharacterIndividualModulus_dvd qW χ hW) + (ZMod (rationalCharacterIndividualModulus qW χ))) (b o) + rwa [hred] at h + +omit [NeZero N] [NeZero qW] in +theorem rationalCharacterIndividualModulus_reduce_test {D : Type*} (b : D → ZMod N) : + zmodPiReduction (rationalCharacterIndividualModulus_test_dvd qW χ) + (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ hW) b) = + zmodPiReduction hW b := by + funext o + exact RingHom.congr_fun (ZMod.castHom_comp + (rationalCharacterIndividualModulus_test_dvd qW χ) + (rationalCharacterIndividualModulus_dvd qW χ hW)) (b o) + +variable [Fintype O] + +theorem rationalCharacterIndividualReduction_phase_uniform + (phase : ℂ → ℂ) (test : (O → ZMod qW) → ℂ) : + (𝔼 b : O → ZMod N, phase (χ b) * test (zmodPiReduction hW b)) = + 𝔼 b : O → ZMod (rationalCharacterIndividualModulus qW χ), + phase (rationalCharacterIndividualReduction qW χ hW b) * + test (zmodPiReduction (rationalCharacterIndividualModulus_test_dvd qW χ) b) := by + have hu := uniform_complexMean_surjective_hom + (zmodPiReduction (I := O) (rationalCharacterIndividualModulus_dvd qW χ hW)) + (zmodPiReduction_surjective (rationalCharacterIndividualModulus_dvd qW χ hW)) + (fun b => phase (rationalCharacterIndividualReduction qW χ hW b) * + test (zmodPiReduction (rationalCharacterIndividualModulus_test_dvd qW χ) b)) + simpa only [FiniteProbabilityWeights.uniform_complexMean, + rationalCharacterIndividualReduction_apply, + rationalCharacterIndividualModulus_reduce_test qW χ hW] + using hu + +theorem rationalCharacterIndividualReduction_uniform + (test : (O → ZMod qW) → ℂ) : + (𝔼 b : O → ZMod N, χ b * test (zmodPiReduction hW b)) = + 𝔼 b : O → ZMod (rationalCharacterIndividualModulus qW χ), + rationalCharacterIndividualReduction qW χ hW b * + test (zmodPiReduction (rationalCharacterIndividualModulus_test_dvd qW χ) b) := + rationalCharacterIndividualReduction_phase_uniform qW χ hW id test + +theorem rationalCharacterIndividualReduction_star_uniform + (test : (O → ZMod qW) → ℂ) : + (𝔼 b : O → ZMod N, star (χ b) * test (zmodPiReduction hW b)) = + 𝔼 b : O → ZMod (rationalCharacterIndividualModulus qW χ), + star (rationalCharacterIndividualReduction qW χ hW b) * + test (zmodPiReduction (rationalCharacterIndividualModulus_test_dvd qW χ) b) := + rationalCharacterIndividualReduction_phase_uniform qW χ hW star test + +section Partial + +variable {Aux D : Type*} [Fintype D] +variable (χ' : AddChar ((Aux ⊕ D) → ZMod N) ℂ) + +theorem rationalCharacterIndividualReduction_partial_phase_uniform + (aux : Aux → ZMod N) (phase : ℂ → ℂ) (test : (D → ZMod qW) → ℂ) : + (𝔼 b : D → ZMod N, phase (χ' (Sum.elim aux b)) * test (zmodPiReduction hW b)) = + 𝔼 b : D → ZMod (rationalCharacterIndividualModulus qW χ'), + phase (rationalCharacterIndividualReduction qW χ' hW + (Sum.elim (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ' hW) aux) b)) * + test (zmodPiReduction (rationalCharacterIndividualModulus_test_dvd qW χ') b) := by + have hphase (b : D → ZMod N) : + rationalCharacterIndividualReduction qW χ' hW + (Sum.elim (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ' hW) aux) + (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ' hW) b)) = + χ' (Sum.elim aux b) := by + have hred : zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ' hW) + (Sum.elim aux b) = + Sum.elim (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ' hW) aux) + (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ' hW) b) := by + funext o + cases o <;> rfl + rw [← hred] + exact rationalCharacterIndividualReduction_apply qW χ' hW _ + have hu := uniform_complexMean_surjective_hom + (zmodPiReduction (I := D) (rationalCharacterIndividualModulus_dvd qW χ' hW)) + (zmodPiReduction_surjective (rationalCharacterIndividualModulus_dvd qW χ' hW)) + (fun b => phase (rationalCharacterIndividualReduction qW χ' hW + (Sum.elim (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ' hW) aux) b)) * + test (zmodPiReduction (rationalCharacterIndividualModulus_test_dvd qW χ') b)) + simpa only [FiniteProbabilityWeights.uniform_complexMean, hphase, + rationalCharacterIndividualModulus_reduce_test qW χ' hW] using hu + +theorem rationalCharacterIndividualReduction_partial_star_uniform + (aux : Aux → ZMod N) (test : (D → ZMod qW) → ℂ) : + (𝔼 b : D → ZMod N, star (χ' (Sum.elim aux b)) * test (zmodPiReduction hW b)) = + 𝔼 b : D → ZMod (rationalCharacterIndividualModulus qW χ'), + star (rationalCharacterIndividualReduction qW χ' hW + (Sum.elim (zmodPiReduction (rationalCharacterIndividualModulus_dvd qW χ' hW) aux) b)) * + test (zmodPiReduction (rationalCharacterIndividualModulus_test_dvd qW χ') b) := + rationalCharacterIndividualReduction_partial_phase_uniform qW hW χ' aux star test + +end Partial + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RationalFrequencyHeight.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RationalFrequencyHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..822cc3a9dc1aee555011e180005a858e7dddb645 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RationalFrequencyHeight.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeCentralSeed + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped BigOperators + +variable {L ι κ : Type*} [AddCommGroup L] [Module ℚ L] + +theorem basisFrequency_logHeight_le (e : Basis κ ℚ L) (b : Basis ι ℚ L) + (S : Set ι) [Fintype S] (N : ℕ) (hN : 0 < N) (n : S → ℤ) + {p : ℝ} (hp : 0 ≤ p) (hd : (Fintype.card S : ℝ) ≤ p) + (hNp : (N : ℝ) ≤ Real.exp p) (hn : ∀ j, (|n j| : ℝ) ≤ Real.exp p) + (hb : ∀ i j, rationalLogHeight (b.repr (e i) j) ≤ p) (i : κ) : + rationalLogHeight (basisFrequency b S N n (e i)) ≤ (p + 2) ^ 4 := by + classical + let H := ⌈Real.exp p⌉₊ + have hH : (H : ℝ) ≤ Real.exp (p + 1) := ceil_exp_le_exp_add_one hp + have hfrac (j : S) : RationalHeightLE ((n j : ℚ) / (N : ℚ)) H := by + have ha : (n j).natAbs ≤ H := by + apply (Nat.cast_le (α := ℝ)).mp + simpa only [Nat.cast_natAbs, Int.cast_abs] using (hn j).trans (Nat.le_ceil (Real.exp p)) + have hbN : (N : ℤ).natAbs ≤ H := by + simpa only [Int.natAbs_natCast] using + (Nat.cast_le.mp (hNp.trans (Nat.le_ceil (Real.exp p))) : N ≤ H) + simpa only [Int.cast_natCast] using + rationalHeightLE_fraction (n j) (N : ℤ) (by exact_mod_cast hN.ne') ha hbN + have hterms (j : S) : + RationalHeightLE (((n j : ℚ) / (N : ℚ)) * b.repr (e i) j) (H * H) := + (hfrac j).mul (rationalHeightLE_ceil_exp (hb i j)) + have hHH : ((H * H : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 2) := by + rw [Nat.cast_mul] + calc + _ ≤ Real.exp (p + 1) * Real.exp (p + 1) := by gcongr + _ = Real.exp (2 * p + 2) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [sq_nonneg p]) + rw [basisFrequency_apply] + apply (rationalLogHeight_le_iff _ _).mpr + simpa only [show (2 + 1 + 1 : ℕ) = 4 from rfl] using + rational_sum_exp_height _ hterms hp 2 1 hHH (by simpa using hd.trans (by linarith : p ≤ p + 2)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RationalLiftCharacterTwist.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RationalLiftCharacterTwist.lean new file mode 100644 index 0000000000000000000000000000000000000000..e85051702cb333ce223614dff4cfe0cb4437c035 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RationalLiftCharacterTwist.lean @@ -0,0 +1,145 @@ +import Mathlib.Analysis.Complex.Circle +import Mathlib.Analysis.Normed.Group.Constructions +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds +import Mathlib.Data.ZMod.Basic +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +theorem real_fourierChar_norm_sub_le (a b : ℝ) : + ‖(Real.fourierChar a : ℂ) - (Real.fourierChar b : ℂ)‖ ≤ + 2 * Real.pi * |a - b| := by + have hmul : (Real.fourierChar a : ℂ) = + (Real.fourierChar (a - b) : ℂ) * (Real.fourierChar b : ℂ) := by + rw [← Circle.coe_mul, ← Real.fourierChar.map_add_eq_mul, sub_add_cancel] + calc + ‖(Real.fourierChar a : ℂ) - (Real.fourierChar b : ℂ)‖ = + ‖((Real.fourierChar (a - b) : ℂ) - 1) * (Real.fourierChar b : ℂ)‖ := by + rw [sub_mul, one_mul, ← hmul] + _ = ‖(Real.fourierChar (a - b) : ℂ) - 1‖ := by + rw [norm_mul, Circle.norm_coe, mul_one] + _ ≤ ‖2 * Real.pi * (a - b)‖ := by + rw [Real.fourierChar_apply, mul_comm _ Complex.I] + exact Real.norm_exp_I_mul_ofReal_sub_one_le + _ = 2 * Real.pi * |a - b| := by + rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (by positivity : 0 ≤ 2 * Real.pi)] + +theorem real_fourierChar_norm_sub_le_four_mul (a b : ℝ) : + ‖(Real.fourierChar a : ℂ) - (Real.fourierChar b : ℂ)‖ ≤ + 4 * Real.pi * |a - b| := by + refine (real_fourierChar_norm_sub_le a b).trans ?_ + exact mul_le_mul_of_nonneg_right (by nlinarith [Real.pi_pos]) (abs_nonneg _) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +variable {m : ℕ} + +noncomputable def rationalLiftCharacterTwist (M : ℕ) (a : Fin m → ℤ) (c : Fin m → ℝ) + (y : Fin m → ℝ) (r : Fin m → ZMod M) : ℂ := + Real.fourierChar ((∑ i, (a i : ℝ) * (y i + (r i).val + c i)) / (M : ℝ)) + +noncomputable def rationalLiftCharacterTwistLip (M : ℕ) (a : Fin m → ℤ) : ℝ≥0 := + ⟨2 * Real.pi * (∑ i, |(a i : ℝ)|) / (M : ℝ), by positivity⟩ + +theorem rationalLiftCharacterTwist_norm (M : ℕ) (a : Fin m → ℤ) (c y : Fin m → ℝ) + (r : Fin m → ZMod M) : ‖rationalLiftCharacterTwist M a c y r‖ = 1 := + Circle.norm_coe _ + +theorem rationalLiftCharacterTwist_lipschitz (M : ℕ) (a : Fin m → ℤ) (c : Fin m → ℝ) + (r : Fin m → ZMod M) : + LipschitzWith (rationalLiftCharacterTwistLip M a) (fun y => rationalLiftCharacterTwist M a c y r) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [dist_eq_norm] + have hdiff : |(∑ i, (a i : ℝ) * (x i + (r i).val + c i)) / (M : ℝ) - + (∑ i, (a i : ℝ) * (y i + (r i).val + c i)) / (M : ℝ)| ≤ + (∑ i, |(a i : ℝ)|) / (M : ℝ) * dist x y := by + rw [← sub_div, ← Finset.sum_sub_distrib] + have heq : (∑ i, ((a i : ℝ) * (x i + (r i).val + c i) - + (a i : ℝ) * (y i + (r i).val + c i))) = + ∑ i, (a i : ℝ) * (x i - y i) := by + apply Finset.sum_congr rfl + intro i _ + ring + rw [heq, abs_div, abs_of_nonneg (Nat.cast_nonneg M : (0 : ℝ) ≤ M)] + calc + _ ≤ (∑ i, |(a i : ℝ) * (x i - y i)|) / (M : ℝ) := + div_le_div_of_nonneg_right (Finset.abs_sum_le_sum_abs _ _) (Nat.cast_nonneg M) + _ ≤ (∑ i, |(a i : ℝ)| * dist x y) / (M : ℝ) := by + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg M) + apply Finset.sum_le_sum + intro i _ + rw [abs_mul] + exact mul_le_mul_of_nonneg_left (dist_le_pi_dist x y i) (abs_nonneg _) + _ = _ := by rw [← Finset.sum_mul]; ring + change ‖(Real.fourierChar _ : ℂ) - (Real.fourierChar _ : ℂ)‖ ≤ _ + apply (real_fourierChar_norm_sub_le _ _).trans + apply (mul_le_mul_of_nonneg_left hdiff (by positivity : 0 ≤ 2 * Real.pi)).trans_eq + change 2 * Real.pi * ((∑ i, |(a i : ℝ)|) / (M : ℝ) * dist x y) = + (2 * Real.pi * (∑ i, |(a i : ℝ)|) / (M : ℝ)) * dist x y + ring + +theorem rationalLiftCharacterTwistLip_le (M : ℕ) (hM : 0 < M) (a : Fin m → ℤ) + (A : ℝ) (ha : ∀ i, |(a i : ℝ)| ≤ A) : + (rationalLiftCharacterTwistLip M a : ℝ) ≤ 2 * Real.pi * m * A := by + have hs : (∑ i, |(a i : ℝ)|) ≤ (m : ℝ) * A := by + calc + _ ≤ ∑ _i : Fin m, A := Finset.sum_le_sum (fun i _ => ha i) + _ = _ := by simp + change 2 * Real.pi * (∑ i, |(a i : ℝ)|) / (M : ℝ) ≤ _ + apply (div_le_self (by positivity) + (show (1 : ℝ) ≤ M by exact_mod_cast Nat.succ_le_of_lt hM)).trans + simpa only [mul_assoc] using mul_le_mul_of_nonneg_left hs + (by positivity : 0 ≤ 2 * Real.pi) + +theorem rationalLiftCharacterTwist_residual (M : ℕ) (hM : 0 < M) + (a : Fin m → ℤ) (c x : Fin m → ℝ) (β : Fin m → ℤ) : + rationalLiftCharacterTwist M a c (fun i => x i - (β i : ℝ)) + (fun i => (β i : ZMod M)) = + (Real.fourierChar ((∑ i, (a i : ℝ) * (x i + c i)) / (M : ℝ)) : ℂ) := by + let : NeZero M := ⟨hM.ne'⟩ + have hzexists (i : Fin m) : ∃ z : ℤ, + β i = ((β i : ZMod M).val : ℤ) + (M : ℤ) * z := + (ZMod.intCast_eq_iff M (β i) (β i : ZMod M)).mp rfl + choose z hz using hzexists + have hβ (i : Fin m) : (β i : ℝ) = ((β i : ZMod M).val : ℝ) + (M : ℝ) * (z i : ℝ) := by + exact_mod_cast hz i + have hMr : (M : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr hM.ne' + have hphase : (∑ i, (a i : ℝ) * (x i - (β i : ℝ) + (β i : ZMod M).val + c i)) / (M : ℝ) = + (∑ i, (a i : ℝ) * (x i + c i)) / (M : ℝ) - ((∑ i, a i * z i : ℤ) : ℝ) := by + calc + _ = ∑ i, ((a i : ℝ) * (x i + c i) / (M : ℝ) - ((a i * z i : ℤ) : ℝ)) := by + rw [div_eq_mul_inv, Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + rw [hβ i, Int.cast_mul] + field_simp + ring + _ = _ := by + rw [Finset.sum_sub_distrib, Int.cast_sum] + simp only [div_eq_mul_inv, Finset.sum_mul] + have hzchar : Real.fourierChar (((∑ i, a i * z i : ℤ) : ℝ)) = 1 := by + apply Subtype.ext + change (Circle.exp (2 * Real.pi * (((∑ i, a i * z i : ℤ) : ℝ))) : ℂ) = 1 + rw [mul_comm (2 * Real.pi), Circle.exp_intCast_mul] + simp + unfold rationalLiftCharacterTwist + rw [hphase, Real.fourierChar.map_sub_eq_div, hzchar, div_one] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RawCubeFourierBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RawCubeFourierBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..29f63a91d865c86ebc3f38113c4ea2df75566bbd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RawCubeFourierBudget.lean @@ -0,0 +1,38 @@ +import OAI.Combinatorics.Progressions.Dynamics.RelativeCubeUniformBudget + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem rawCubeBlock_fourier_controls {b n q M K : ℕ} [NeZero b] [NeZero K] {B T η : ℝ≥0} + (s : Fin b → Fin (n + 1) → RetainedCubeSlice q M B T η) (hη : 0 < η) (hB : 0 < B) + (t : Fin b → Fin (n + 1) → FiniteCubeSlice q) (ht : ∀ a j, (s a j).finiteSlice = t a j) + (w : Fin b → Fin (n + 1) → (Option (Fin q) → ℤ) → ℝ) (hw : ∀ a j z, 0 ≤ w a j z) + (hs : ∀ a j x, (s a j).sliceWeight x = w a j ((s a j).finiteSlice.coordinates x)) + (htotal : ∀ a j, 0 < ∑ x : (t a j).Domain, w a j ((t a j).coordinates x)) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {O F D E : ℝ} + (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ∏ j, ((s a j).length : ℝ)) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hblocks : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : + (retainedFourierBudget n (n + 1) q b J.card p M 1 A B T η O F D E).Controls + (rawCubeBlockSource t w hw htotal) (rawCubeBlockSum t J) + K (affineTorusFactor q (n + 1) b (O + 1) F * K) := by + apply IntegerFourierBudget.controls_of_complexMean _ + (retainedCubeBlockSource s hη) (rawCubeBlockSource t w hw htotal) + (retainedCubeBlockSum s J) (rawCubeBlockSum t J) K (affineTorusFactor q (n + 1) b (O + 1) F * K) + (fun center f => retainedCubeBlockSum_raw_complexMean s hη t ht w hw hs htotal J center f) + exact retainedCubeFourier_controls s hη hB A hA hO hD hE hroot hupper hlower p hpower J hJ hblocks + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RawModerateFourierBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RawModerateFourierBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e5d9c9f3abb043a47aeaa4baf225fa84aa4a2c4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RawModerateFourierBudget.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Dynamics.RelativeModerateUniformBudget + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem rawModerateBlock_fourier_controls {b n q M K : ℕ} [NeZero b] [NeZero K] {B T η : ℝ≥0} + (c : Fin b → RetainedCoefficientSlice M B T η) (s : Fin b → Fin n → RetainedCubeSlice q M B T η) + (hη : 0 < η) (hB : 0 < B) (offset : Fin b → ℤ) (stride : Fin b → ℕ) + (d : Fin b → FiniteCoefficientSlice) (t : Fin b → Fin n → FiniteCubeSlice q) + (hd : ∀ a, (c a).finiteSlice (offset a) (stride a) = d a) (ht : ∀ a j, (s a j).finiteSlice = t a j) + (v : Fin b → ℤ → ℝ) (w : Fin b → Fin n → (Option (Fin q) → ℤ) → ℝ) + (hv : ∀ a z, 0 ≤ v a z) (hw : ∀ a j z, 0 ≤ w a j z) + (hc : ∀ a x, (c a).sliceWeight x = v a (((c a).finiteSlice (offset a) (stride a)).value x)) + (hs : ∀ a j x, (s a j).sliceWeight x = w a j ((s a j).finiteSlice.coordinates x)) + (vtotal : ∀ a, 0 < ∑ x : (d a).Domain, v a ((d a).value x)) + (htotal : ∀ a j, 0 < ∑ x : (t a j).Domain, w a j ((t a j).coordinates x)) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (V : ℕ) (hV : 1 ≤ V) + (hstride : ∀ a, 0 < stride a) (hstrideV : ∀ a, stride a ≤ V) + {O F D E : ℝ} (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (|(offset a : ℝ)| + (stride a : ℝ) * (c a).length) * + (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ((c a).length * ∏ j, ((s a j).length : ℝ))) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (hcpower : ∀ a, (K : ℝ) ≤ E * ((c a).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n) + (hblocks : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : + (retainedFourierBudget n n q b J.card p M V A B T η O F D E).Controls + (rawModerateBlockSource d t v w hv hw vtotal htotal) (rawModerateBlockSum d t J) + K (affineTorusFactor q n b (O + 1) F * K) := by + apply IntegerFourierBudget.controls_of_complexMean _ + (retainedModerateBlockSource c s hη) (rawModerateBlockSource d t v w hv hw vtotal htotal) + (retainedModerateBlockSum c s offset stride J) (rawModerateBlockSum d t J) + K (affineTorusFactor q n b (O + 1) F * K) + (fun center f => retainedModerateBlockSum_raw_complexMean c s hη offset stride d t hd ht + v w hv hw hc hs vtotal htotal J center f) + exact retainedModerateFourier_controls c s hη hB offset stride A hA V hV hstride hstrideV + hO hD hE hroot hupper hlower p hpower hcpower J hJ hblocks + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RealLayerHorizontalFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RealLayerHorizontalFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..80e0c48064aeb16d9d0bcdf24bd0ddf44952cf65 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RealLayerHorizontalFrequency.lean @@ -0,0 +1,103 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeProductCoefficient + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct + +theorem realification_range {V W : Type*} [AddCommGroup V] [Module ℚ V] + [AddCommGroup W] [Module ℚ W] (f : V →ₗ[ℚ] W) : + (LinearMap.range f).baseChange ℝ = LinearMap.range (f.baseChange ℝ) := by + rw [← Submodule.map_top, realification_map, Submodule.baseChange_top, Submodule.map_top] + +theorem real_lieTreeEval_hom {I L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] (φ : L →ₗ⁅ℚ⁆ M) + (v : I → ℝ ⊗[ℚ] L) (a : FreeMagma I) : + lieTreeEval (fun i => realificationLieHom φ (v i)) a = + realificationLieHom φ (lieTreeEval v a) := by + induction a using FreeMagma.rec with + | of i => rfl + | mul a b ha hb => simp only [lieTreeEval, ha, hb, LieHom.map_lie] + +namespace DegreeRankLieFiltration + +variable {I L M : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s r : ℕ} (F : DegreeRankLieFiltration L s r) (A : ℕ → Submodule ℚ M) + (φ : M →ₗ⁅ℚ⁆ (Fin 4 → L)) + (hφ : ∀ d x, x ∈ A d → ∀ k, φ x k ∈ F.layer d 1) + +include hφ + +theorem real_layerProjection_mem (d : ℕ) (k : Fin 4) (x : ℝ ⊗[ℚ] M) + (hx : x ∈ (A d).baseChange ℝ) : + realificationLieHom ((liePiEval k).comp φ) x ∈ (F.layer d 1).baseChange ℝ := + baseChange_mem_of_mapsTo (A d) (F.layer d 1) ((liePiEval k).comp φ).toLinearMap + (fun x hx => hφ d x hx k) hx + +noncomputable def realLayerProjection (d : ℕ) (k : Fin 4) : + (A d).baseChange ℝ →ₗ[ℝ] (F.layer d 1).baseChange ℝ := + (((realificationLieHom ((liePiEval k).comp φ)).toLinearMap).comp + ((A d).baseChange ℝ).subtype).codRestrict ((F.layer d 1).baseChange ℝ) + (fun x => F.real_layerProjection_mem A φ hφ d k x.val x.property) + +theorem real_layerHorizontalMap_component (d : ℕ) (k : Fin 4) (x : ℝ ⊗[ℚ] A d) : + (LinearMap.proj k).baseChange ℝ ((F.layerHorizontalMap A φ hφ d).baseChange ℝ x) = + F.realHorizontalMap d + (F.realLayerProjection A φ hφ d k (realificationSubmoduleEquiv (A d) x)) := by + induction x using TensorProduct.inductionOn with + | tmul a x => + let y : F.layer d 1 := ⟨φ x.val k, hφ d x.val x.property k⟩ + have heq : F.realLayerProjection A φ hφ d k + (realificationSubmoduleEquiv (A d) (a ⊗ₜ[ℚ] x)) = + realificationSubmoduleEquiv (F.layer d 1) (a ⊗ₜ[ℚ] y) := by + apply Subtype.ext + rfl + rw [heq, F.realHorizontalMap_baseChange] + rfl + | add x y hx hy => simp only [map_add, hx, hy] + +theorem real_layerHorizontalImage_frequency + (η : L →ₗ[ℚ] ℚ) (d : I → ℕ) (a : FreeMagma I) + (hd : lieTreeWeight d a = s) (hr : a.length = r) + (hker : ∀ u : I → ℝ ⊗[ℚ] M, (∀ i, u i ∈ (A (d i)).baseChange ℝ) → + realifyFunctional η (realificationLieHom ((liePiEval 0).comp φ) (lieTreeEval u a)) + + realifyFunctional η (realificationLieHom ((liePiEval 1).comp φ) (lieTreeEval u a)) - + realifyFunctional η (realificationLieHom ((liePiEval 2).comp φ) (lieTreeEval u a)) - + realifyFunctional η (realificationLieHom ((liePiEval 3).comp φ) (lieTreeEval u a)) = 0) + (v : ∀ i, ℝ ⊗[ℚ] (Fin 4 → F.HigherHorizontal (d i))) + (hv : ∀ i, v i ∈ (F.layerHorizontalImage A φ hφ (d i)).baseChange ℝ) : + realifyFunctional η (F.realHorizontalTreeValue d a (fun i => (LinearMap.proj (0 : Fin 4)).baseChange ℝ (v i))) + + realifyFunctional η (F.realHorizontalTreeValue d a (fun i => (LinearMap.proj (1 : Fin 4)).baseChange ℝ (v i))) - + realifyFunctional η (F.realHorizontalTreeValue d a (fun i => (LinearMap.proj (2 : Fin 4)).baseChange ℝ (v i))) - + realifyFunctional η (F.realHorizontalTreeValue d a (fun i => (LinearMap.proj (3 : Fin 4)).baseChange ℝ (v i))) = 0 := by + classical + have hlift (i : I) : ∃ w : ℝ ⊗[ℚ] A (d i), + (F.layerHorizontalMap A φ hφ (d i)).baseChange ℝ w = v i := by + have h := hv i + rw [layerHorizontalImage, realification_range] at h + exact h + choose w hw using hlift + let u (i : I) := realificationSubmoduleEquiv (A (d i)) (w i) + have hmap (k : Fin 4) : + (fun i => F.realHorizontalMap (d i) (F.realLayerProjection A φ hφ (d i) k (u i))) = + (fun i => (LinearMap.proj k).baseChange ℝ (v i)) := by + funext i + exact (F.real_layerHorizontalMap_component A φ hφ (d i) k (w i)).symm.trans + (congrArg ((LinearMap.proj k).baseChange ℝ) (hw i)) + have hvalue (k : Fin 4) : + F.realHorizontalTreeValue d a (fun i => (LinearMap.proj k).baseChange ℝ (v i)) = + realificationLieHom ((liePiEval k).comp φ) (lieTreeEval (fun i => (u i).val) a) := by + rw [← hmap k, F.realHorizontalTreeValue_map d a hd hr] + exact real_lieTreeEval_hom ((liePiEval k).comp φ) (fun i => (u i).val) a + rw [hvalue 0, hvalue 1, hvalue 2, hvalue 3] + exact hker (fun i => (u i).val) (fun i => (u i).property) + +end DegreeRankLieFiltration +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RealQuarterTorusExtension.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RealQuarterTorusExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..9574e6efa7b9fc4d85e2d65ba6769b11e8902a5b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RealQuarterTorusExtension.lean @@ -0,0 +1,522 @@ +import Mathlib.Analysis.Normed.Group.AddCircle +import OAI.Combinatorics.Progressions.Estimates.LipschitzExtensionAlongMap +import OAI.Combinatorics.Progressions.Fourier.IntegerPeriodicTorusLift +import OAI.Combinatorics.Progressions.Geometry.DenseRealBoxCell +import OAI.Combinatorics.Progressions.Linear.ProperCyclicKernelBasis + +namespace OAI + +section + +namespace Erdos3 + +open Module + +noncomputable def properCyclicCoordinateBound (r : ℕ) (δ : ℝ) : ℝ := + (r : ℝ) * r.factorial * properCyclicKernelBasisBound r δ ^ (r - 1) + +theorem properCyclicCoordinateBound_nonneg (r : ℕ) {δ : ℝ} (hδ : 0 < δ) : + 0 ≤ properCyclicCoordinateBound r δ := by + have h := properCyclicKernelBasisBound_nonneg r hδ + unfold properCyclicCoordinateBound + positivity + +theorem exists_controlled_cyclic_torus_model + {r N : ℕ} [NeZero N] (η : (Fin r → ℤ) →+ ZMod N) (R : Fin r → ℕ) + (hinj : Set.InjOn η {x | ∀ i, |x i| ≤ (R i : ℤ)}) + (h₀ : ZMod N) (J : Finset (ZMod N)) + (δ : ℝ) (hδ : 0 < δ) (hdense : δ * N ≤ (J.card : ℝ)) + (hrep : ∀ h ∈ J, ∃ x : Fin r → ℤ, (∀ i, |x i| ≤ (R i : ℤ)) ∧ h = h₀ + η x) : + ∃ b : Basis (Fin r) ℤ (cyclicIntegerKernel η), + (∀ i j, |(b i : Fin r → ℝ) j| ≤ properCyclicKernelBasisBound r δ * ((R j : ℝ) + 1)) ∧ + (∀ x : Fin r → ℝ, (∀ j, |x j| ≤ (R j : ℝ) + 1) → ∀ i, + |cyclicKernelRealCoordinates η b x i| ≤ properCyclicCoordinateBound r δ) ∧ + Set.InjOn (fun x i => cyclicKernelCoordinateCharacter η b i x) + {x | ∀ i, |x i| ≤ (R i : ℤ)} ∧ + ∃ t : Fin r → ℝ, (∀ i, t i ∈ Set.Ico (0 : ℝ) 1) ∧ + (∀ i, ∃ k : ℤ, (N : ℝ) * t i = (k : ℝ)) ∧ + ∀ (h : ZMod N) (x : Fin r → ℤ), h = h₀ + η x → ∀ i, + ((cyclicKernelRealCoordinates η b (integerVectorRealMap x) i : ℝ) : + AddCircle (1 : ℝ)) = + ((((h.val : ℝ) - h₀.val) * t i : ℝ) : AddCircle (1 : ℝ)) := by + obtain ⟨b, hb, t, ht, hperiod, hformula⟩ := + exists_proper_affine_torus_basis η R hinj h₀ J δ hδ hdense hrep + refine ⟨b, hb, ?_, cyclicKernelCoordinateCharacters_injOn η b _ hinj, + t, ht, hperiod, hformula⟩ + intro x hx i + exact lattice_basis_coordinates_bound (cyclicIntegerKernel η) b + (fun j => (R j : ℝ) + 1) (by intro j; positivity) + (properCyclicKernelBasisBound_nonneg r hδ) hb + (proper_cyclic_kernel_covolume_lower_bound η R hinj) x hx i + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem properCyclicKernelBasisBound_le_exp {r : ℕ} {p : ℝ} + (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) : + properCyclicKernelBasisBound r (Real.exp (-p)) ≤ Real.exp ((p + 4) ^ 3) := by + have htwo : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have hpow (k : ℕ) : (2 : ℝ) ^ k ≤ Real.exp (2 * (k : ℝ)) := by + calc + _ ≤ (Real.exp 2) ^ k := pow_le_pow_left₀ (by norm_num) htwo k + _ = _ := by rw [← Real.exp_nat_mul]; congr 1; ring + have hk : r * (r - 1) / 2 ≤ r * r := + (Nat.div_le_self _ _).trans (Nat.mul_le_mul_left r (Nat.sub_le _ _)) + have hkR : ((r * (r - 1) / 2 : ℕ) : ℝ) ≤ p ^ 2 := by + have h : ((r * (r - 1) / 2 : ℕ) : ℝ) ≤ (r : ℝ) * r := by exact_mod_cast hk + exact h.trans (by nlinarith [Nat.cast_nonneg (α := ℝ) r]) + have hM : BohrLattice.MinkowskiSecondBox.minkowskiSecondConstant r ≤ Real.exp (2 * p ^ 2) := + (hpow _).trans (Real.exp_le_exp.mpr (by linarith)) + have h2r : (2 : ℝ) ^ r ≤ Real.exp (2 * p) := + (hpow r).trans (Real.exp_le_exp.mpr (by linarith)) + have hrp : (r : ℝ) ≤ Real.exp p := hr.trans + ((le_add_of_nonneg_right zero_le_one).trans (Real.add_one_le_exp p)) + have hM0 : 0 ≤ BohrLattice.MinkowskiSecondBox.minkowskiSecondConstant r := by + unfold BohrLattice.MinkowskiSecondBox.minkowskiSecondConstant + positivity + have hmain : properCyclicKernelBasisBound r (Real.exp (-p)) ≤ Real.exp (2 * p ^ 2 + 4 * p) := by + unfold properCyclicKernelBasisBound + rw [Real.exp_neg, div_eq_mul_inv, inv_inv] + calc + _ ≤ Real.exp p * Real.exp (2 * p ^ 2) * Real.exp (2 * p) * Real.exp p := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add]; congr 1; ring + apply hmain.trans + apply Real.exp_le_exp.mpr + have h : 0 ≤ p ^ 3 + 10 * p ^ 2 + 44 * p + 64 := by positivity + nlinarith + +theorem properCyclicCoordinateBound_le_exp {r : ℕ} {p : ℝ} + (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) : + properCyclicCoordinateBound r (Real.exp (-p)) ≤ Real.exp ((p + 4) ^ 5) := by + have hB := properCyclicKernelBasisBound_le_exp hp hr + have hB0 := properCyclicKernelBasisBound_nonneg r (Real.exp_pos (-p)) + have hrp : (r : ℝ) ≤ Real.exp p := hr.trans + ((le_add_of_nonneg_right zero_le_one).trans (Real.add_one_le_exp p)) + have hfac : (r.factorial : ℝ) ≤ Real.exp (p ^ 2) := + (factorial_le_exp_sq r).trans (Real.exp_le_exp.mpr + (by nlinarith [Nat.cast_nonneg (α := ℝ) r])) + have hsub : ((r - 1 : ℕ) : ℝ) ≤ p := + (Nat.cast_le.mpr (Nat.sub_le r 1)).trans hr + have hpower : properCyclicKernelBasisBound r (Real.exp (-p)) ^ (r - 1) ≤ + Real.exp (p * (p + 4) ^ 3) := by + calc + _ ≤ (Real.exp ((p + 4) ^ 3)) ^ (r - 1) := pow_le_pow_left₀ hB0 hB _ + _ = Real.exp (((r - 1 : ℕ) : ℝ) * (p + 4) ^ 3) := by rw [Real.exp_nat_mul] + _ ≤ _ := Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right hsub (by positivity)) + have hmain : properCyclicCoordinateBound r (Real.exp (-p)) ≤ + Real.exp (p + p ^ 2 + p * (p + 4) ^ 3) := by + unfold properCyclicCoordinateBound + calc + _ ≤ Real.exp p * Real.exp (p ^ 2) * Real.exp (p * (p + 4) ^ 3) := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add] + apply hmain.trans + apply Real.exp_le_exp.mpr + have h : 0 ≤ p ^ 5 + 19 * p ^ 4 + 148 * p ^ 3 + 591 * p ^ 2 + 1215 * p + 1024 := by + positivity + nlinarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module + +noncomputable def centeredCircleLift (z : AddCircle (1 : ℝ)) : ℝ := + (AddCircle.equivIco (1 : ℝ) (-(1 / 2)) z).val + +theorem coe_centeredCircleLift (z : AddCircle (1 : ℝ)) : + (centeredCircleLift z : AddCircle (1 : ℝ)) = z := AddCircle.coe_equivIco + +theorem centeredCircleLift_coe {y : ℝ} (hy : |y| ≤ 1 / 4) : + centeredCircleLift (y : AddCircle (1 : ℝ)) = y := by + apply AddCircle.equivIco_coe_of_mem + constructor <;> linarith [(abs_le.mp hy).1, (abs_le.mp hy).2] + +noncomputable def affineCyclicTorusLocalLift {r N : ℕ} + (t c : Fin r → ℝ) (h₀ h : ZMod N) : Fin r → ℝ := + fun i => centeredCircleLift + (((((h.val : ℝ) - h₀.val) * t i - c i) : ℝ) : AddCircle (1 : ℝ)) + +theorem exists_localized_cyclic_torus_chart + {r N : ℕ} [NeZero N] (η : (Fin r → ℤ) →+ ZMod N) (R : Fin r → ℕ) + (hinj : Set.InjOn η {x | ∀ i, |x i| ≤ (R i : ℤ)}) + (h₀ : ZMod N) (J : Finset (ZMod N)) (hJ : J.Nonempty) + (δ : ℝ) (hδ : 0 < δ) (hdense : δ * N ≤ (J.card : ℝ)) + (x : ZMod N → Fin r → ℤ) + (hx : ∀ h ∈ J, ∀ i, |x h i| ≤ (R i : ℤ)) + (hrep : ∀ h ∈ J, h = h₀ + η (x h)) (q : ℕ) (hq : 2 ≤ q) : + ∃ b : Basis (Fin r) ℤ (cyclicIntegerKernel η), + (∀ i j, |(b i : Fin r → ℝ) j| ≤ properCyclicKernelBasisBound r δ * ((R j : ℝ) + 1)) ∧ + ∃ t : Fin r → ℝ, (∀ i, t i ∈ Set.Ico (0 : ℝ) 1) ∧ + (∀ i, ∃ k : ℤ, (N : ℝ) * t i = (k : ℝ)) ∧ + ∃ K ⊆ J, K.Nonempty ∧ + J.card ≤ realBoxCellCount (properCyclicCoordinateBound r δ) q ^ r * K.card ∧ + ∃ c : Fin r → ℝ, + (∀ i, |c i| ≤ properCyclicCoordinateBound r δ + (1 / 2 : ℝ) / q) ∧ + ∀ h ∈ K, + cyclicKernelRealCoordinates η b (integerVectorRealMap (x h)) = + c + affineCyclicTorusLocalLift t c h₀ h ∧ + (∀ i, |affineCyclicTorusLocalLift t c h₀ h i| ≤ (1 / 2 : ℝ) / q) ∧ + integerVectorRealMap (x h) = (cyclicKernelRealCoordinates η b).symm + (c + affineCyclicTorusLocalLift t c h₀ h) := by + classical + obtain ⟨b, hb, hcoordinates, _, t, ht, hperiod, hphase⟩ := + exists_controlled_cyclic_torus_model η R hinj h₀ J δ hδ hdense + (fun h hh => ⟨x h, hx h hh, hrep h hh⟩) + let y (h : ZMod N) := cyclicKernelRealCoordinates η b (integerVectorRealMap (x h)) + have hy : ∀ h ∈ J, ∀ i, |y h i| ≤ properCyclicCoordinateBound r δ := by + intro h hh i + apply hcoordinates _ _ i + intro j + have hj : |(x h j : ℝ)| ≤ (R j : ℝ) := by exact_mod_cast hx h hh j + change |(x h j : ℝ)| ≤ (R j : ℝ) + 1 + linarith + obtain ⟨K, hKJ, hK, hcard, c, hc, hclose⟩ := exists_dense_real_box_cell J hJ y hy q (by omega) + have hquarter : (1 / 2 : ℝ) / q ≤ 1 / 4 := by + have hqR : (2 : ℝ) ≤ q := by exact_mod_cast hq + apply (div_le_iff₀ (by linarith : (0 : ℝ) < q)).mpr + linarith + refine ⟨b, hb, t, ht, hperiod, K, hKJ, hK, ?_, c, hc, ?_⟩ + · simpa only [Fintype.card_fin] using hcard + · intro h hh + have hlocal (i) : affineCyclicTorusLocalLift t c h₀ h i = y h i - c i := by + have he : ((y h i - c i : ℝ) : AddCircle (1 : ℝ)) = + (((((h.val : ℝ) - h₀.val) * t i - c i) : ℝ) : AddCircle (1 : ℝ)) := by + rw [AddCircle.coe_sub, AddCircle.coe_sub] + exact congrArg (fun z : AddCircle (1 : ℝ) => z - (c i : AddCircle (1 : ℝ))) + (hphase h (x h) (hrep h (hKJ hh)) i) + change centeredCircleLift _ = _ + rw [← he] + exact centeredCircleLift_coe ((hclose h hh i).trans hquarter) + have he : y h = c + affineCyclicTorusLocalLift t c h₀ h := by + funext i + rw [Pi.add_apply, hlocal] + ring + refine ⟨he, ?_, ?_⟩ + · intro i + rw [hlocal] + exact hclose h hh i + · exact (LinearEquiv.eq_symm_apply (cyclicKernelRealCoordinates η b)).mpr he + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem centeredCircleLift_eq_sub_floor (x : ℝ) : + centeredCircleLift (x : AddCircle (1 : ℝ)) = x - (⌊x + 1 / 2⌋ : ℤ) := by + have hmem : x - (⌊x + 1 / 2⌋ : ℤ) ∈ Set.Ico (-(1 / 2 : ℝ)) (-(1 / 2 : ℝ) + 1) := by + constructor + · linarith [Int.floor_le (x + 1 / 2)] + · linarith [Int.lt_floor_add_one (x + 1 / 2)] + have hint : (((⌊x + 1 / 2⌋ : ℤ) : ℝ) : AddCircle (1 : ℝ)) = 0 := by + apply (AddCircle.coe_eq_zero_iff (1 : ℝ)).mpr + exact ⟨⌊x + 1 / 2⌋, by simp⟩ + have he : ((x - (⌊x + 1 / 2⌋ : ℤ) : ℝ) : AddCircle (1 : ℝ)) = x := by + rw [AddCircle.coe_sub, hint, sub_zero] + rw [← he] + exact AddCircle.equivIco_coe_of_mem hmem + +noncomputable def affineCyclicTorusCarry {r N : ℕ} + (t c : Fin r → ℝ) (h₀ h : ZMod N) (i : Fin r) : ℤ := + ⌊((h.val : ℝ) - h₀.val) * t i - c i + 1 / 2⌋ + +theorem affineCyclicTorusLocalLift_eq_sub_carry {r N : ℕ} + (t c : Fin r → ℝ) (h₀ h : ZMod N) (i : Fin r) : + affineCyclicTorusLocalLift t c h₀ h i = + ((h.val : ℝ) - h₀.val) * t i - c i - affineCyclicTorusCarry t c h₀ h i := + centeredCircleLift_eq_sub_floor _ + +theorem affineCyclicTorusCarry_identity {r N : ℕ} + (t c : Fin r → ℝ) (h₀ h : ZMod N) (i : Fin r) : + (-(h₀.val : ℝ) * t i - c i) + + ((-(affineCyclicTorusCarry t c h₀ h i) : ℤ) : ℚ) + (h.val : ℝ) * t i = + affineCyclicTorusLocalLift t c h₀ h i := by + rw [affineCyclicTorusLocalLift_eq_sub_carry] + push_cast + ring + +theorem affineCyclicTorusCarry_bound {r N : ℕ} [NeZero N] + (t c : Fin r → ℝ) (ht : ∀ i, t i ∈ Set.Ico (0 : ℝ) 1) + (h₀ h : ZMod N) (i : Fin r) : + |(affineCyclicTorusCarry t c h₀ h i : ℝ)| ≤ N + |c i| + 1 := by + have hh : (h.val : ℝ) < N := by exact_mod_cast h.val_lt + have hh₀ : (h₀.val : ℝ) < N := by exact_mod_cast h₀.val_lt + have ht0 := (ht i).1 + have ht1 := (ht i).2 + have hlo := Int.floor_le (((h.val : ℝ) - h₀.val) * t i - c i + 1 / 2) + have hhi := Int.lt_floor_add_one (((h.val : ℝ) - h₀.val) * t i - c i + 1 / 2) + change |((⌊((h.val : ℝ) - h₀.val) * t i - c i + 1 / 2⌋ : ℤ) : ℝ)| ≤ _ + apply abs_le.mpr + constructor <;> nlinarith [Nat.cast_nonneg (α := ℝ) h.val, Nat.cast_nonneg (α := ℝ) h₀.val, + le_abs_self (c i), neg_abs_le (c i)] + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem local_cyclic_torus_cell_count_le_exp {r : ℕ} {p : ℝ} + (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) : + ((realBoxCellCount (properCyclicCoordinateBound r (Real.exp (-p))) 8 : ℕ) : ℝ) ^ r ≤ + Real.exp ((r : ℝ) * ((p + 4) ^ 5 + 17)) := by + have hC := properCyclicCoordinateBound_le_exp hp hr + have hC0 := properCyclicCoordinateBound_nonneg r (Real.exp_pos (-p)) + have hm := realBoxCellCount_le hC0 8 + have hE : 1 ≤ Real.exp ((p + 4) ^ 5) := Real.one_le_exp (by positivity) + have h17 : (17 : ℝ) ≤ Real.exp 17 := by linarith [Real.add_one_le_exp (17 : ℝ)] + have hcount : (realBoxCellCount (properCyclicCoordinateBound r (Real.exp (-p))) 8 : ℝ) ≤ + Real.exp ((p + 4) ^ 5 + 17) := by + calc + _ ≤ 17 * Real.exp ((p + 4) ^ 5) := by norm_num at hm; linarith + _ ≤ Real.exp 17 * Real.exp ((p + 4) ^ 5) := + mul_le_mul_of_nonneg_right h17 (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + calc + _ ≤ (Real.exp ((p + 4) ^ 5 + 17)) ^ r := pow_le_pow_left₀ (Nat.cast_nonneg _) hcount r + _ = _ := (Real.exp_nat_mul _ _).symm + +theorem local_cyclic_torus_total_loss_le {r : ℕ} {p : ℝ} + (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) : + p + (r : ℝ) * ((p + 4) ^ 5 + 17) ≤ (p + 4) ^ 7 := by + let U := p + 4 + have hU : 4 ≤ U := by dsimp [U]; linarith + have h1 : 1 ≤ U := by linarith + have hU0 : 0 ≤ U := by linarith + have hpow : (4 : ℝ) ^ 3 ≤ U ^ 3 := pow_le_pow_left₀ (by norm_num) hU 3 + have hlinear : 18 * U ≤ U ^ 4 := by + have h := mul_le_mul_of_nonneg_right hpow hU0 + nlinarith + calc + _ ≤ U + U * (U ^ 5 + 17) := by dsimp [U]; gcongr <;> linarith + _ = U ^ 6 + 18 * U := by ring + _ ≤ U ^ 6 + U ^ 4 := add_le_add (le_refl _) hlinear + _ ≤ U ^ 6 + U ^ 6 := add_le_add (le_refl _) (pow_le_pow_right₀ h1 (by omega)) + _ ≤ U ^ 7 := by + have h := mul_le_mul_of_nonneg_right (show (2 : ℝ) ≤ U by linarith) (pow_nonneg hU0 6) + nlinarith + +theorem local_cyclic_torus_density {r N : ℕ} {p : ℝ} + (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) (J K : Finset (ZMod N)) + (hJ : Real.exp (-p) * N ≤ (J.card : ℝ)) + (hK : J.card ≤ realBoxCellCount (properCyclicCoordinateBound r (Real.exp (-p))) 8 ^ r * K.card) : + Real.exp (-((p + 4) ^ 7)) * N ≤ (K.card : ℝ) := by + let L := (r : ℝ) * ((p + 4) ^ 5 + 17) + have hcount := local_cyclic_torus_cell_count_le_exp hp hr + have hretain : Real.exp (-(p + L)) * N ≤ (K.card : ℝ) := by + apply (mul_le_mul_iff_right₀ (Real.exp_pos L)).mp + calc + _ = Real.exp (-p) * N := by + rw [← mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ (J.card : ℝ) := hJ + _ ≤ ((realBoxCellCount (properCyclicCoordinateBound r (Real.exp (-p))) 8 : ℕ) : ℝ) ^ r * K.card := by + exact_mod_cast hK + _ ≤ Real.exp L * K.card := mul_le_mul_of_nonneg_right hcount (Nat.cast_nonneg _) + exact (mul_le_mul_of_nonneg_right + (Real.exp_le_exp.mpr (neg_le_neg (local_cyclic_torus_total_loss_le hp hr))) + (Nat.cast_nonneg N)).trans hretain + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem centeredCircleLift_abs_le_half (z : AddCircle (1 : ℝ)) : + |centeredCircleLift z| ≤ 1 / 2 := by + have h := (AddCircle.equivIco (1 : ℝ) (-(1 / 2)) z).property + change -(1 / 2 : ℝ) ≤ centeredCircleLift z ∧ centeredCircleLift z < -(1 / 2) + 1 at h + exact abs_le.mpr ⟨h.1, by linarith [h.2]⟩ + +theorem norm_eq_abs_centeredCircleLift (z : AddCircle (1 : ℝ)) : + ‖z‖ = |centeredCircleLift z| := by + calc + ‖z‖ = ‖(centeredCircleLift z : AddCircle (1 : ℝ))‖ := + congrArg norm (coe_centeredCircleLift z).symm + _ = _ := (AddCircle.norm_coe_eq_abs_iff (1 : ℝ) (by norm_num : (1 : ℝ) ≠ 0)).mpr + (by simpa only [abs_one] using centeredCircleLift_abs_le_half z) + +theorem centeredCircleLift_dist {x y : AddCircle (1 : ℝ)} + (hx : ‖x‖ ≤ 1 / 4) (hy : ‖y‖ ≤ 1 / 4) : + dist (centeredCircleLift x) (centeredCircleLift y) = dist x y := by + rw [norm_eq_abs_centeredCircleLift] at hx hy + have hsmall : |centeredCircleLift x - centeredCircleLift y| ≤ 1 / 2 := + (abs_sub _ _).trans (by linarith) + have he := (AddCircle.norm_coe_eq_abs_iff (1 : ℝ) (by norm_num : (1 : ℝ) ≠ 0)).mpr + (by simpa only [abs_one] using hsmall) + calc + dist (centeredCircleLift x) (centeredCircleLift y) = + |centeredCircleLift x - centeredCircleLift y| := Real.dist_eq _ _ + _ = ‖((centeredCircleLift x - centeredCircleLift y : ℝ) : AddCircle (1 : ℝ))‖ := he.symm + _ = dist x y := by rw [AddCircle.coe_sub, coe_centeredCircleLift, coe_centeredCircleLift, dist_eq_norm] + +noncomputable def centeredTorusLift {ι : Type*} (x : ι → AddCircle (1 : ℝ)) : ι → ℝ := + fun i => centeredCircleLift (x i) + +theorem centeredTorusLift_lipschitzOn {ι : Type*} [Fintype ι] : + LipschitzOnWith 1 (centeredTorusLift (ι := ι)) + {x | ∀ i, ‖x i‖ ≤ 1 / 4} := by + apply LipschitzOnWith.of_dist_le_mul + intro x hx y hy + simp only [NNReal.coe_one, one_mul] + apply (dist_pi_le_iff (dist_nonneg)).mpr + intro i + change dist (centeredCircleLift (x i)) (centeredCircleLift (y i)) ≤ dist x y + rw [centeredCircleLift_dist (hx i) (hy i)] + exact dist_le_pi_dist x y i + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_quarter_torus_extension {D : Type*} [Fintype D] + (F : (D → ℝ) → ℂ) (L B : ℝ≥0) (hL : LipschitzWith L F) + (hB : ∀ v, ‖F v‖ ≤ B) : + ∃ g : (D → AddCircle (1 : ℝ)) → ℂ, + LipschitzWith (2 * L) g ∧ (∀ z, ‖g z‖ ≤ 2 * B) ∧ + ∀ v : D → ℝ, (∀ i, |v i| ≤ 1 / 4) → g (fun i => (v i : AddCircle (1 : ℝ))) = F v := by + let Q : Set (D → AddCircle (1 : ℝ)) := {z | ∀ i, ‖z i‖ ≤ 1 / 4} + have hlocal : LipschitzOnWith L (fun z => F (centeredTorusLift z)) Q := by + apply LipschitzOnWith.of_dist_le_mul + intro x hx y hy + have hdist : dist (centeredTorusLift x) (centeredTorusLift y) ≤ dist x y := by + simpa only [NNReal.coe_one, one_mul] using centeredTorusLift_lipschitzOn.dist_le_mul x hx y hy + exact (hL.dist_le_mul _ _).trans (mul_le_mul_of_nonneg_left hdist L.coe_nonneg) + obtain ⟨g, hg, heq, hgb⟩ := exists_complex_bounded_lipschitz_extension + (fun z => F (centeredTorusLift z)) Q L B hlocal (fun z _ => hB _) + refine ⟨g, hg, hgb, ?_⟩ + intro v hv + have hvQ : (fun i => (v i : AddCircle (1 : ℝ))) ∈ Q := by + intro i + rw [norm_eq_abs_centeredCircleLift, centeredCircleLift_coe (hv i)] + exact hv i + rw [← heq hvQ] + apply congrArg F + funext i + exact centeredCircleLift_coe (hv i) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +variable {D : Type*} [Fintype D] + +noncomputable def realPeriodicTorusLift (F : (D → ℝ) → ℝ) (x : D → UnitAddCircle) : ℝ := + (integerPeriodicTorusLift (fun y => (F y : ℂ)) x).re + +omit [Fintype D] in +theorem realPeriodicTorusLift_coe (F : (D → ℝ) → ℝ) + (hF : ∀ (x : D → ℝ) (n : D → ℤ), F (fun i => x i + (n i : ℝ)) = F x) (x : D → ℝ) : + realPeriodicTorusLift F (fun i => (x i : UnitAddCircle)) = F x := by + unfold realPeriodicTorusLift + rw [integerPeriodicTorusLift_coe _ (fun x n => congrArg Complex.ofReal (hF x n))] + rfl + +theorem realPeriodicTorusLift_lipschitz (F : (D → ℝ) → ℝ) {L : ℝ≥0} + (hL : LipschitzWith L F) + (hF : ∀ (x : D → ℝ) (n : D → ℤ), F (fun i => x i + (n i : ℝ)) = F x) : + LipschitzWith L (realPeriodicTorusLift F) := by + apply LipschitzWith.of_dist_le_mul + intro x y + let a : D → ℝ := fun i => centeredCircleLift (x i) + let b : D → ℝ := fun i => a i + centeredCircleLift (y i - x i) + have ha : (fun i => (a i : UnitAddCircle)) = x := funext (fun i => coe_centeredCircleLift _) + have hb : (fun i => (b i : UnitAddCircle)) = y := by + funext i + change ((a i + centeredCircleLift (y i - x i) : ℝ) : UnitAddCircle) = y i + rw [AddCircle.coe_add, coe_centeredCircleLift, coe_centeredCircleLift] + change x i + (y i - x i) = y i + abel + have hd : dist a b ≤ dist x y := by + apply (dist_pi_le_iff dist_nonneg).mpr + intro i + change dist (a i) (a i + centeredCircleLift (y i - x i)) ≤ dist x y + rw [Real.dist_eq, sub_add_cancel_left, abs_neg, ← norm_eq_abs_centeredCircleLift, ← dist_eq_norm] + exact (dist_le_pi_dist y x i).trans_eq (dist_comm y x) + have heA : realPeriodicTorusLift F x = F a := by + rw [← ha] + exact realPeriodicTorusLift_coe F hF a + have heB : realPeriodicTorusLift F y = F b := by + rw [← hb] + exact realPeriodicTorusLift_coe F hF b + rw [heA, heB] + exact (hL.dist_le_mul a b).trans (mul_le_mul_of_nonneg_left hd L.coe_nonneg) + +omit [Fintype D] in +theorem realPeriodicTorusLift_range (F : (D → ℝ) → ℝ) {B : ℝ} + (hB : ∀ x, 0 ≤ F x ∧ F x ≤ B) (x : D → UnitAddCircle) : + 0 ≤ realPeriodicTorusLift F x ∧ realPeriodicTorusLift F x ≤ B := by + exact hB _ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_real_quarter_torus_extension {D : Type*} [Fintype D] + (F : (D → ℝ) → ℝ) (L : ℝ≥0) (hL : LipschitzWith L F) + (a b : ℝ) (hab : a ≤ b) (hF : ∀ v, F v ∈ Set.Icc a b) : + ∃ g : (D → AddCircle (1 : ℝ)) → ℝ, + LipschitzWith L g ∧ (∀ z, g z ∈ Set.Icc a b) ∧ + ∀ v : D → ℝ, (∀ i, |v i| ≤ 1 / 4) → g (fun i => (v i : AddCircle (1 : ℝ))) = F v := by + let Q : Set (D → AddCircle (1 : ℝ)) := {z | ∀ i, ‖z i‖ ≤ 1 / 4} + have hlocal : LipschitzOnWith L (fun z => F (centeredTorusLift z)) Q := by + apply LipschitzOnWith.of_dist_le_mul + intro x hx y hy + have hdist : dist (centeredTorusLift x) (centeredTorusLift y) ≤ dist x y := by + simpa only [NNReal.coe_one, one_mul] using centeredTorusLift_lipschitzOn.dist_le_mul x hx y hy + exact (hL.dist_le_mul _ _).trans (mul_le_mul_of_nonneg_left hdist L.coe_nonneg) + obtain ⟨g, hg, heq, hgb⟩ := exists_real_lipschitz_extension_interval + (fun z => F (centeredTorusLift z)) Q L hlocal a b hab (fun z _ => hF _) + refine ⟨g, hg, hgb, ?_⟩ + intro v hv + have hvQ : (fun i => (v i : AddCircle (1 : ℝ))) ∈ Q := by + intro i + rw [norm_eq_abs_centeredCircleLift, centeredCircleLift_coe (hv i)] + exact hv i + rw [← heq hvQ] + apply congrArg F + funext i + exact centeredCircleLift_coe (hv i) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RectangularGridCharacter.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RectangularGridCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..5bed0345f66f99dc1561dbe9a25ad481c3d13e1a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RectangularGridCharacter.lean @@ -0,0 +1,528 @@ +import Mathlib +import Mathlib.GroupTheory.QuotientGroup.Defs +import Mathlib.LinearAlgebra.Pi +import Mathlib.Topology.Algebra.Group.Quotient +import Mathlib.Topology.Instances.AddCircle.Real + +namespace OAI + +section + +open scoped BigOperators ComplexConjugate ENNReal Real + +open Finset Function MeasureTheory Set + +namespace Erdos3.CircleFourier + +noncomputable section + +abbrev Circle := UnitAddCircle + +abbrev circleHaar : Measure Circle := AddCircle.haarAddCircle + +theorem circleHaar_eq_volume : circleHaar = (volume : Measure Circle) := by + symm + simpa [circleHaar] using + (AddCircle.volume_eq_smul_haarAddCircle (T := (1 : ℝ))) + +def integerDistance (x : Circle) : ℝ := ‖x‖ + +theorem integerDistance_nonneg (x : Circle) : 0 ≤ integerDistance x := norm_nonneg x + +theorem integerDistance_le_half (x : Circle) : integerDistance x ≤ 1 / 2 := by + simpa [integerDistance] using AddCircle.norm_le_half_period (1 : ℝ) one_ne_zero (x := x) + +@[simp] +theorem integerDistance_zero : integerDistance (0 : Circle) = 0 := by + simp [integerDistance] + +@[simp] +theorem integerDistance_neg (x : Circle) : integerDistance (-x) = integerDistance x := by + simp [integerDistance] + +@[simp] +theorem integerDistance_coe (x : ℝ) : + integerDistance (x : Circle) = |x - round x| := by + simp [integerDistance, UnitAddCircle.norm_eq] + +def character (x : Circle) : ℂ := AddCircle.toCircle x + +@[simp] +theorem character_zero : character 0 = 1 := by + simp [character] + +@[simp] +theorem character_add (x y : Circle) : character (x + y) = character x * character y := by + unfold character + rw [AddCircle.toCircle_add] + rfl + +@[simp] +theorem character_neg (x : Circle) : character (-x) = star (character x) := by + unfold character + rw [AddCircle.toCircle_neg, _root_.Circle.coe_inv, Complex.inv_def, + _root_.Circle.normSq_coe] + simp + +@[simp] +theorem character_nsmul (n : ℕ) (x : Circle) : character (n • x) = character x ^ n := by + unfold character + rw [AddCircle.toCircle_nsmul] + rfl + +@[simp] +theorem character_zsmul (n : ℤ) (x : Circle) : character (n • x) = character x ^ n := by + unfold character + rw [AddCircle.toCircle_zsmul] + rfl + +@[simp] +theorem character_finset_sum {I : Type*} (s : Finset I) (f : I → Circle) : + character (∑ i ∈ s, f i) = ∏ i ∈ s, character (f i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => simp [ha, ih, character_add] + +@[simp] +theorem character_fintype_sum {I : Type*} [Fintype I] (f : I → Circle) : + character (∑ i, f i) = ∏ i, character (f i) := by + simp + +@[simp] +theorem norm_character (x : Circle) : ‖character x‖ = 1 := by + exact Circle.norm_coe _ + +theorem character_eq_one_iff (x : Circle) : character x = 1 ↔ x = 0 := by + constructor + · intro h + apply AddCircle.injective_toCircle one_ne_zero + apply Subtype.ext + simpa [character] using h + · rintro rfl + exact character_zero + +def geometricCharacterSum (N : ℕ) (x : Circle) : ℂ := + ∑ n ∈ range N, character (n • x) + +theorem geometricCharacterSum_mul (N : ℕ) (x : Circle) : + geometricCharacterSum N x * (character x - 1) = character (N • x) - 1 := by + simp only [geometricCharacterSum, character_nsmul] + exact geom_sum_mul (character x) N + +theorem norm_character_sub_one_le_two (x : Circle) : ‖character x - 1‖ ≤ 2 := by + calc + ‖character x - 1‖ ≤ ‖character x‖ + ‖(1 : ℂ)‖ := norm_sub_le _ _ + _ = 2 := by norm_num + +theorem four_mul_integerDistance_le_norm_character_sub_one (x : Circle) : + 4 * integerDistance x ≤ ‖character x - 1‖ := by + obtain ⟨r, rfl⟩ := QuotientAddGroup.mk_surjective x + let y : ℝ := r - round r + have hyabs : |y| ≤ 1 / 2 := by + simpa [y] using abs_sub_round r + have hypi_abs : |π * y| ≤ π / 2 := by + rw [abs_mul, abs_of_pos Real.pi_pos] + nlinarith [Real.pi_pos] + have hsin : 2 * |y| ≤ |Real.sin (π * y)| := by + have h := Real.mul_abs_le_abs_sin hypi_abs + calc + 2 * |y| = (2 / π) * |π * y| := by + rw [abs_mul, abs_of_pos Real.pi_pos] + field_simp [Real.pi_ne_zero] + _ ≤ |Real.sin (π * y)| := h + have hry : (r : Circle) = (y : Circle) := by + simp [y, sub_eq_add_neg] + have hcharacter : + character (y : Circle) = Complex.exp (Complex.I * (2 * π * y : ℝ)) := by + unfold character + rw [AddCircle.toCircle, Function.Periodic.lift_coe, Circle.coe_exp] + congr 1 + push_cast + ring + rw [integerDistance_coe] + change 4 * |y| ≤ _ + rw [hry, hcharacter, Complex.norm_exp_I_mul_ofReal_sub_one] + change 4 * |y| ≤ |2 * Real.sin ((2 * π * y) / 2)| + rw [abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] + calc + 4 * |y| = 2 * (2 * |y|) := by ring + _ ≤ 2 * |Real.sin (π * y)| := + mul_le_mul_of_nonneg_left hsin (by norm_num) + _ = 2 * |Real.sin ((2 * π * y) / 2)| := by ring_nf + +theorem two_mul_integerDistance_mul_norm_geometricCharacterSum_le_one + (N : ℕ) (x : Circle) : + 2 * integerDistance x * ‖geometricCharacterSum N x‖ ≤ 1 := by + have hprod : + ‖geometricCharacterSum N x‖ * ‖character x - 1‖ ≤ 2 := by + rw [← norm_mul, geometricCharacterSum_mul] + exact norm_character_sub_one_le_two _ + have hden := four_mul_integerDistance_le_norm_character_sub_one x + have hnorm : 0 ≤ ‖geometricCharacterSum N x‖ := norm_nonneg _ + nlinarith [mul_le_mul_of_nonneg_left hden hnorm] + +theorem norm_geometricCharacterSum_le (N : ℕ) {x : Circle} (hx : x ≠ 0) : + ‖geometricCharacterSum N x‖ ≤ (2 * integerDistance x)⁻¹ := by + have hdist : 0 < integerDistance x := by + simpa [integerDistance, norm_pos_iff] using hx + rw [inv_eq_one_div, le_div_iff₀ (by positivity)] + simpa [mul_assoc, mul_left_comm, mul_comm] using + two_mul_integerDistance_mul_norm_geometricCharacterSum_le_one N x + +theorem geometricCharacterSum_eq_sum_fin (N : ℕ) (x : Circle) : + geometricCharacterSum N x = ∑ n : Fin N, character ((n : ℕ) • x) := by + rw [Finset.sum_fin_eq_sum_range] + rw [geometricCharacterSum] + apply Finset.sum_congr rfl + intro n hn + simp [Finset.mem_range.mp hn] + +end +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3.CircleFourier + +open scoped Real NNReal + +noncomputable def characterLipConstant : ℝ≥0 := ⟨2 * Real.pi, by positivity⟩ + +theorem coe_characterLipConstant : (characterLipConstant : ℝ) = 2 * Real.pi := rfl + +theorem character_coe_exp (r : ℝ) : + character (r : Circle) = Complex.exp (Complex.I * (2 * Real.pi * r : ℝ)) := by + unfold character + rw [AddCircle.toCircle, Function.Periodic.lift_coe, _root_.Circle.coe_exp] + congr 1 + push_cast + ring + +theorem norm_character_sub_one_le (x : Circle) : + ‖character x - 1‖ ≤ 2 * Real.pi * ‖x‖ := by + obtain ⟨r, rfl⟩ := QuotientAddGroup.mk_surjective x + let y : ℝ := r - round r + have hry : (r : Circle) = (y : Circle) := by simp [y, sub_eq_add_neg] + change ‖character (r : Circle) - 1‖ ≤ 2 * Real.pi * integerDistance (r : Circle) + rw [integerDistance_coe] + change ‖character (r : Circle) - 1‖ ≤ 2 * Real.pi * |y| + rw [hry, character_coe_exp, Complex.norm_exp_I_mul_ofReal_sub_one] + have heq : (2 * Real.pi * y) / 2 = Real.pi * y := by ring + rw [heq, Real.norm_eq_abs, abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] + calc + _ ≤ 2 * |Real.pi * y| := mul_le_mul_of_nonneg_left Real.abs_sin_le_abs (by norm_num) + _ = _ := by rw [abs_mul, abs_of_pos Real.pi_pos]; ring + +theorem character_lipschitz : LipschitzWith characterLipConstant character := by + apply LipschitzWith.of_dist_le_mul + intro x y + have hxy : character (x - y) * character y = character x := by + rw [← character_add, sub_add_cancel] + have heq : (character (x - y) - 1) * character y = character x - character y := by + rw [sub_mul, one_mul, hxy] + have hnorm : ‖character x - character y‖ = ‖character (x - y) - 1‖ := by + rw [← heq, norm_mul, norm_character, mul_one] + rw [dist_eq_norm, hnorm, dist_eq_norm] + exact norm_character_sub_one_le (x - y) + +end Erdos3.CircleFourier + +end + +section + +namespace Erdos3 + +open scoped BigOperators +open CircleFourier + +noncomputable def cyclicIntegerCharacter (M : ℕ) [NeZero M] (z : ℤ) : AddChar (ZMod M) ℂ where + toFun r := character (ZMod.toAddCircle (r * (z : ZMod M))) + map_zero_eq_one' := by simp only [zero_mul, map_zero, character_zero] + map_add_eq_mul' r s := by + simp only [add_mul, map_add, character_add] + +theorem cyclicIntegerCharacter_intCast (M : ℕ) [NeZero M] (r z : ℤ) : + cyclicIntegerCharacter M z (r : ZMod M) = + character (((r : ℝ) * (z : ℝ) / M : ℝ) : CircleFourier.Circle) := by + change character (ZMod.toAddCircle ((r : ZMod M) * (z : ZMod M))) = _ + rw [← Int.cast_mul, ZMod.toAddCircle_intCast] + simp only [Int.cast_mul] + +theorem cyclicIntegerCharacter_eq_zero_iff (M : ℕ) [NeZero M] (z : ℤ) : + cyclicIntegerCharacter M z = 0 ↔ (z : ZMod M) = 0 := by + constructor + · intro h + have he := DFunLike.congr_fun h (1 : ZMod M) + change character (ZMod.toAddCircle ((1 : ZMod M) * (z : ZMod M))) = 1 at he + rw [one_mul, character_eq_one_iff, ZMod.toAddCircle_eq_zero] at he + exact he + · intro h + apply AddChar.ext + intro r + change character (ZMod.toAddCircle (r * (z : ZMod M))) = 1 + simp only [h, mul_zero, map_zero, character_zero] + +theorem cyclicIntegerCharacter_sum (M : ℕ) [NeZero M] (z : ℤ) : + (∑ r : ZMod M, cyclicIntegerCharacter M z r) = + if (z : ZMod M) = 0 then (M : ℂ) else 0 := by + classical + simpa only [cyclicIntegerCharacter_eq_zero_iff, ZMod.card] using + AddChar.sum_eq_ite (cyclicIntegerCharacter M z) + +noncomputable def gridResidueEquiv (M : ℕ) [NeZero M] : Fin M ≃ ZMod M where + toFun k := (k.val : ZMod M) + invFun r := ⟨r.val, ZMod.val_lt r⟩ + left_inv k := by + apply Fin.ext + simp only [ZMod.val_natCast, Nat.mod_eq_of_lt k.isLt] + right_inv r := ZMod.natCast_zmod_val r + +noncomputable def integerGridCharacter (M : ℕ) [NeZero M] (k : Fin M) (z : ℤ) : ℂ := + cyclicIntegerCharacter M z (gridResidueEquiv M k) + +theorem integerGridCharacter_eq (M : ℕ) [NeZero M] (k : Fin M) (z : ℤ) : + integerGridCharacter M k z = + character ((((k.val : ℝ) / M) * z : ℝ) : CircleFourier.Circle) := by + have h := cyclicIntegerCharacter_intCast M (k.val : ℤ) z + simpa only [integerGridCharacter, gridResidueEquiv, Equiv.coe_fn_mk, + Int.cast_natCast, div_mul_eq_mul_div] using h + +theorem integerGridCharacter_sum (M : ℕ) [NeZero M] (z : ℤ) : + (∑ k : Fin M, integerGridCharacter M k z) = + if (z : ZMod M) = 0 then (M : ℂ) else 0 := by + rw [← cyclicIntegerCharacter_sum M z] + exact (Equiv.sum_comp (gridResidueEquiv M) (cyclicIntegerCharacter M z)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier + +variable {E : Type*} [AddCommGroup E] [Module ℝ E] + +noncomputable def linearCircleHom (L : E →ₗ[ℝ] ℝ) : E →+ CircleFourier.Circle := + (QuotientAddGroup.mk' (AddSubgroup.zmultiples (1 : ℝ))).comp L.toAddMonoidHom + +theorem integral_subgroup_le_linearCircleHom_ker (Γ : AddSubgroup E) (L : E →ₗ[ℝ] ℝ) + (hint : ∀ x ∈ Γ, ∃ n : ℤ, L x = n) : Γ ≤ (linearCircleHom L).ker := by + intro x hx + change (L x : CircleFourier.Circle) = 0 + obtain ⟨n, hn⟩ := hint x hx + apply (AddCircle.coe_eq_zero_iff (1 : ℝ)).mpr + exact ⟨n, by simp [hn]⟩ + +noncomputable def quotientLinearPhase (Γ : AddSubgroup E) (L : E →ₗ[ℝ] ℝ) + (hint : ∀ x ∈ Γ, ∃ n : ℤ, L x = n) : (E ⧸ Γ) →+ CircleFourier.Circle := + QuotientAddGroup.lift Γ (linearCircleHom L) (integral_subgroup_le_linearCircleHom_ker Γ L hint) + +noncomputable def quotientLinearCharacter (Γ : AddSubgroup E) (L : E →ₗ[ℝ] ℝ) + (hint : ∀ x ∈ Γ, ∃ n : ℤ, L x = n) (x : E ⧸ Γ) : ℂ := + character (quotientLinearPhase Γ L hint x) + +theorem quotientLinearCharacter_mk (Γ : AddSubgroup E) (L : E →ₗ[ℝ] ℝ) + (hint : ∀ x ∈ Γ, ∃ n : ℤ, L x = n) (x : E) : + quotientLinearCharacter Γ L hint (QuotientAddGroup.mk' Γ x) = + character (L x : CircleFourier.Circle) := rfl + +theorem quotientLinearCharacter_add (Γ : AddSubgroup E) (L : E →ₗ[ℝ] ℝ) + (hint : ∀ x ∈ Γ, ∃ n : ℤ, L x = n) (x y : E ⧸ Γ) : + quotientLinearCharacter Γ L hint (x + y) = + quotientLinearCharacter Γ L hint x * quotientLinearCharacter Γ L hint y := by + simp only [quotientLinearCharacter, map_add, character_add] + +theorem quotientLinearCharacter_norm (Γ : AddSubgroup E) (L : E →ₗ[ℝ] ℝ) + (hint : ∀ x ∈ Γ, ∃ n : ℤ, L x = n) (x : E ⧸ Γ) : + ‖quotientLinearCharacter Γ L hint x‖ = 1 := norm_character _ + +theorem quotientLinearCharacter_zero (Γ : AddSubgroup E) + (hint : ∀ x ∈ Γ, ∃ n : ℤ, (0 : E →ₗ[ℝ] ℝ) x = n) (x : E ⧸ Γ) : + quotientLinearCharacter Γ 0 hint x = 1 := by + obtain ⟨y, rfl⟩ := QuotientAddGroup.mk'_surjective Γ x + simp only [quotientLinearCharacter_mk, LinearMap.zero_apply, AddCircle.coe_zero, character_zero] + +theorem quotientLinearCharacter_continuous [TopologicalSpace E] + (Γ : AddSubgroup E) (L : E →ₗ[ℝ] ℝ) + (hint : ∀ x ∈ Γ, ∃ n : ℤ, L x = n) (hL : Continuous L) : + Continuous (quotientLinearCharacter Γ L hint) := by + apply (QuotientAddGroup.isQuotientMap_mk Γ).continuous_iff.mpr + change Continuous (fun x : E => character (L x : CircleFourier.Circle)) + exact (continuous_subtype_val.comp AddCircle.continuous_toCircle).comp + ((AddCircle.continuous_mk' (1 : ℝ)).comp hL) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped BigOperators + +theorem linear_site_sum {S W : Type*} [Fintype S] [DecidableEq S] + [AddCommGroup W] [Module ℝ W] (M : (S → W) →ₗ[ℝ] ℝ) (v : S → W) : + M v = ∑ s, M (Pi.single s (v s)) := by + have hv : v = ∑ s, Pi.single s (v s) := by + funext s + simp [Pi.single_apply] + exact (congrArg M hv).trans (map_sum M _ _) + +theorem character_real_sum {S : Type*} (s : Finset S) (f : S → ℝ) : + character ((∑ t ∈ s, f t : ℝ) : CircleFourier.Circle) = + ∏ t ∈ s, character (f t : CircleFourier.Circle) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert t s ht ih => + simp only [Finset.sum_insert ht, AddCircle.coe_add, character_add, Finset.prod_insert ht, ih] + +noncomputable def siteFunctionalCharacter {S W : Type*} [DecidableEq S] + [AddCommGroup W] [Module ℝ W] (M : (S → W) →ₗ[ℝ] ℝ) (s : S) (w : W) : ℂ := + character (M (Pi.single s w) : CircleFourier.Circle) + +theorem siteFunctionalCharacter_norm {S W : Type*} [DecidableEq S] + [AddCommGroup W] [Module ℝ W] (M : (S → W) →ₗ[ℝ] ℝ) (s : S) (w : W) : + ‖siteFunctionalCharacter M s w‖ = 1 := norm_character _ + +theorem character_linear_site_sum {S W : Type*} [Fintype S] [DecidableEq S] + [AddCommGroup W] [Module ℝ W] (M : (S → W) →ₗ[ℝ] ℝ) (v : S → W) : + character (M v : CircleFourier.Circle) = ∏ s, siteFunctionalCharacter M s (v s) := by + rw [linear_site_sum M v] + exact character_real_sum _ _ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped BigOperators NNReal + +theorem abs_linearMap_le_basis_bound {ι V : Type*} [Fintype ι] + [AddCommGroup V] [Module ℝ V] (e : Basis ι ℝ V) (η : V →ₗ[ℝ] ℝ) + (A : ℝ≥0) (hη : ∀ i, |η (e i)| ≤ A) (x : V) : + |η x| ≤ (Fintype.card ι : ℝ) * A * ‖e.equivFun x‖ := by + have hx : η x = ∑ i, e.repr x i * η (e i) := by + conv_lhs => rw [← e.sum_repr x] + simp only [map_sum, map_smul, smul_eq_mul] + rw [hx] + calc + _ ≤ ∑ i, |e.repr x i * η (e i)| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i : ι, ‖e.equivFun x‖ * A := by + apply Finset.sum_le_sum + intro i _ + rw [abs_mul] + have he : |e.repr x i| ≤ ‖e.equivFun x‖ := by + simpa only [Real.norm_eq_abs, Basis.equivFun_apply] using (norm_le_pi_norm (e.equivFun x) i) + exact mul_le_mul he (hη i) (abs_nonneg _) (norm_nonneg _) + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; ring + +theorem norm_character_real_sub_one_le (r : ℝ) : + ‖CircleFourier.character (r : CircleFourier.Circle) - 1‖ ≤ + (CircleFourier.characterLipConstant : ℝ) * |r| := by + apply (CircleFourier.norm_character_sub_one_le _).trans + exact mul_le_mul_of_nonneg_left + (by simpa only [Real.norm_eq_abs] using + (show ‖(r : CircleFourier.Circle)‖ ≤ ‖r‖ from QuotientAddGroup.norm_mk_le_norm)) + (by positivity : 0 ≤ 2 * Real.pi) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators +open CircleFourier + +theorem circle_coe_fintype_sum {J : Type*} [Fintype J] (f : J → ℝ) : + ((∑ j, f j : ℝ) : CircleFourier.Circle) = ∑ j, (f j : CircleFourier.Circle) := + map_sum (QuotientAddGroup.mk' (AddSubgroup.zmultiples (1 : ℝ))) f Finset.univ + +noncomputable def rectangularGridCharacter {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) (y : J → ℤ) : ℂ := + ∏ j, integerGridCharacter M (k j) (y j) + +def integerGridResidue {J : Type*} (M : ℕ) (y : J → ℤ) : J → ZMod M := fun j => (y j : ZMod M) + +theorem rectangularGridCharacter_eq {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) (y : J → ℤ) : + rectangularGridCharacter M k y = + character ((∑ j, (((k j).val : ℝ) / M) * (y j : ℝ) : ℝ) : CircleFourier.Circle) := by + simp only [rectangularGridCharacter, integerGridCharacter_eq, circle_coe_fintype_sum, character_fintype_sum] + +theorem rectangularGridCharacter_norm {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) (y : J → ℤ) : + ‖rectangularGridCharacter M k y‖ = 1 := by + rw [rectangularGridCharacter_eq, norm_character] + +theorem rectangularGridCharacter_add {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) (y z : J → ℤ) : + rectangularGridCharacter M k (y + z) = + rectangularGridCharacter M k y * rectangularGridCharacter M k z := by + simp only [rectangularGridCharacter_eq, Pi.add_apply, Int.cast_add, mul_add, + Finset.sum_add_distrib, AddCircle.coe_add, character_add] + +theorem rectangularGridCharacter_sub {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) (y z : J → ℤ) : + rectangularGridCharacter M k (y - z) = + rectangularGridCharacter M k y * star (rectangularGridCharacter M k z) := by + simp only [rectangularGridCharacter_eq, Pi.sub_apply, Int.cast_sub, mul_sub, Finset.sum_sub_distrib] + rw [AddCircle.coe_sub, sub_eq_add_neg, character_add, character_neg] + +theorem rectangularGridCharacter_fintype_sum {J B : Type*} [Fintype J] [Fintype B] + (M : ℕ) [NeZero M] (k : J → Fin M) (y : B → J → ℤ) : + rectangularGridCharacter M k (∑ b, y b) = ∏ b, rectangularGridCharacter M k (y b) := by + classical + simp only [rectangularGridCharacter_eq, Finset.sum_apply, Int.cast_sum, Finset.mul_sum] + rw [Finset.sum_comm] + simp only [circle_coe_fintype_sum, character_fintype_sum] + +theorem rectangularGridCharacter_sum {J : Type*} [Fintype J] [DecidableEq J] + (M : ℕ) [NeZero M] (y : J → ℤ) : + (∑ k : J → Fin M, rectangularGridCharacter M k y) = + if integerGridResidue M y = 0 then (M : ℂ) ^ Fintype.card J else 0 := by + classical + change (∑ k : J → Fin M, ∏ j, integerGridCharacter M (k j) (y j)) = _ + rw [← Fintype.prod_sum (fun j (k : Fin M) => integerGridCharacter M k (y j))] + simp only [integerGridCharacter_sum] + by_cases hy : integerGridResidue M y = 0 + · have hz j : (y j : ZMod M) = 0 := congrFun hy j + simp only [hz, ite_true, Finset.prod_const, Finset.card_univ, hy] + · have hz : ∃ j, (y j : ZMod M) ≠ 0 := by + by_contra! h + exact hy (funext h) + obtain ⟨j, hj⟩ := hz + rw [ite_eq_right hy] + exact Finset.prod_eq_zero (Finset.mem_univ j) (ite_eq_right hj) + +theorem rectangularGridCharacter_orthogonality {J : Type*} [Fintype J] [DecidableEq J] + (M : ℕ) [NeZero M] (y z : J → ℤ) : + (∑ k : J → Fin M, rectangularGridCharacter M k y * star (rectangularGridCharacter M k z)) = + if integerGridResidue M y = integerGridResidue M z then + (M : ℂ) ^ Fintype.card J else 0 := by + simp only [← rectangularGridCharacter_sub, rectangularGridCharacter_sum] + have h : integerGridResidue M (y - z) = 0 ↔ integerGridResidue M y = integerGridResidue M z := by + simp only [funext_iff, integerGridResidue, Pi.sub_apply, Pi.zero_apply, Int.cast_sub, sub_eq_zero] + simp only [h] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RelativeModerateFourierAxis.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RelativeModerateFourierAxis.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1e17b244cc442f6bac080e1dd91e90fbdc599f6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RelativeModerateFourierAxis.lean @@ -0,0 +1,316 @@ +import OAI.Combinatorics.Progressions.Probability.RelativeRetainedLawTransport + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def retainedCubeFourierAxis {b n q M K : ℕ} [NeZero b] [NeZero K] {B T η : ℝ≥0} + (s : Fin b → Fin (n + 1) → RetainedCubeSlice q M B T η) (hη : 0 < η) (hB : 0 < B) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {O F D E : ℝ} + (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ∏ j, ((s a j).length : ℝ)) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hblocks : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : IntegerFourierAxis := by + let U := affinePrimitiveEnvelope (Fin q) A (B / η) (T / η) M 1 + let Q := affineTorusRadius (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + let H := (q + 1) * M + let Kmax := ⌈E * (H : ℝ) ^ p⌉₊ + let Ccount := uniformSpectrumSizeConstant n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) + let Ccap := uniformSpectrumAbsoluteCap n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) + let exponent := max (majorArcSpectrumExponent n J.card) (majorArcLengthExponent n * (p * J.card)) + let ζ := fun ε => uniformBlockRetainedBias n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ε + let denom := fun ε => uniformCharacterDenominatorBound n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) (ζ ε) + let residual := fun ε => 2 * majorArcCoverConstant n J.card U ((R : ℝ) * D) / + (ζ ε) ^ majorArcCoverExponent n J.card + refine largeScaleFourierAxis (retainedCubeBlockSource s hη) (retainedCubeBlockSum s J) + K Q Kmax Ccount Ccap exponent denom residual + (fun center x _ Z => by + simpa only [Q, Fintype.card_fin] using retainedCubeBlockSum_support s hO hroot hupper J hJ center x Z) ?_ + intro hK ε hε hε1 + have hlong (a : Fin b) (j : Fin (n + 1)) : H ≤ (s a j).length := by + by_contra! hL + exact (Nat.not_le_of_lt hK) (short_side_scale_bound hE hL.le (hpower a j)) + have he := weightedSlice_geometric_approximation + (fun a j => (s a j).normalized hB hη (hlong a j)) (fun a j => (s a j).root) + A (B / η) (T / η) hA M (fun _ _ => le_rfl) (fun _ _ => le_rfl) (fun _ _ => le_rfl) + hO hD hE hε hε1 hroot hupper hlower p hpower J hJ hblocks + dsimp only at he + rw [retainedCubeBlockSource_normalized s hη hB hlong, + retainedCubeBlockSum_normalized s hB hη hlong] at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS, ?_, ?_, ?_⟩ + · intro center + apply le_trans ?_ (hcap center) + apply le_of_eq + apply Finset.sum_congr + · apply congrArg (fun f : Fintype (J → Fin ((2 * Q + 1) * K)) => @Finset.univ _ f) + exact Subsingleton.elim _ _ + · intro k _ + rfl + · intro k hk + obtain ⟨d, hd, hdb, a, ξ, hξ, heq⟩ := hchar k hk + refine ⟨d, hd, hdb, a, ξ, hξ, ?_⟩ + intro j + simpa only [Nat.cast_mul, affineTorusFactor, Q] using heq j + · intro center z hz + change ‖(((K : ℝ) ^ Fintype.card J * finiteImageMass (retainedCubeBlockSource s hη) + (retainedCubeBlockSum s J center) z : ℝ) : ℂ) - + integerGridApproximation (retainedCubeBlockSource s hη) + (retainedCubeBlockSum s J center) K (R * K) S z‖ ≤ ε + have hh := happ center z hz + simp only [R, integerGridApproximation, Fintype.card_coe, finiteImageMass] at hh ⊢ + convert hh using 1 + apply congrArg norm + apply congrArg₂ (fun x y : ℂ => x - y) + · apply congrArg Complex.ofReal + apply congrArg (fun t : ℝ => (K : ℝ) ^ J.card * t) + unfold FiniteProbabilityWeights.mean + apply Finset.sum_congr + · apply congrArg (fun f : Fintype (RetainedCubeBlockDomain s) => @Finset.univ _ f) + exact Subsingleton.elim _ _ + · intro x _ + rfl + · apply congrArg (fun t : ℂ => ((K : ℂ) / (R * K : ℕ)) ^ J.card * t) + apply Finset.sum_congr rfl + intro k _ + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def retainedModerateFourierAxis {b n q M K : ℕ} [NeZero b] [NeZero K] {B T η : ℝ≥0} + (c : Fin b → RetainedCoefficientSlice M B T η) (s : Fin b → Fin n → RetainedCubeSlice q M B T η) + (hη : 0 < η) + (hB : 0 < B) (offset : Fin b → ℤ) (stride : Fin b → ℕ) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (V : ℕ) (hV : 1 ≤ V) + (ht : ∀ a, 0 < stride a) (htV : ∀ a, stride a ≤ V) + {O F D E : ℝ} (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (|(offset a : ℝ)| + (stride a : ℝ) * (c a).length) * + (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ((c a).length * ∏ j, ((s a j).length : ℝ))) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (hcpower : ∀ a, (K : ℝ) ≤ E * ((c a).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n) + (hblocks : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : IntegerFourierAxis := by + let U := affinePrimitiveEnvelope (Fin q) A (B / η) (T / η) M V + let Q := affineTorusRadius (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) F + let H := (q + 1) * M + let Kmax := ⌈E * (H : ℝ) ^ p⌉₊ + let Ccount := uniformSpectrumSizeConstant n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) + let Ccap := uniformSpectrumAbsoluteCap n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) + let exponent := max (majorArcSpectrumExponent n J.card) (majorArcLengthExponent n * (p * J.card)) + let ζ := fun ε => uniformBlockRetainedBias n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ε + let denom := fun ε => uniformCharacterDenominatorBound n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) (ζ ε) + let residual := fun ε => 2 * majorArcCoverConstant n J.card U ((R : ℝ) * D) / + (ζ ε) ^ majorArcCoverExponent n J.card + refine largeScaleFourierAxis (retainedModerateBlockSource c s hη) + (retainedModerateBlockSum c s offset stride J) K Q Kmax Ccount Ccap exponent denom residual + (fun center x _ Z => by + simpa only [Q, Fintype.card_fin] using + retainedModerateBlockSum_support c s offset stride hO hroot hupper J hJ center x Z) ?_ + intro hK ε hε hε1 + have hlong (L : ℕ) (hp : (K : ℝ) ≤ E * (L : ℝ) ^ p) : H ≤ L := by + by_contra! hL + exact (Nat.not_le_of_lt hK) (short_side_scale_bound hE hL.le hp) + have hclong (a : Fin b) : M ≤ (c a).length := + (Nat.le_mul_of_pos_left M (by omega : 0 < q + 1)).trans (hlong (c a).length (hcpower a)) + have hslong (a : Fin b) (j : Fin n) : (q + 1) * M ≤ (s a j).length := + hlong (s a j).length (hpower a j) + have he := moderateSlice_geometric_approximation + (fun a => (c a).normalized hB hη (hclong a)) (fun a j => (s a j).normalized hB hη (hslong a j)) + offset stride (fun a j => (s a j).root) A (B / η) (T / η) hA M V hV + (fun _ => le_rfl) (fun _ => le_rfl) (fun _ => le_rfl) + (fun _ _ => le_rfl) (fun _ _ => le_rfl) (fun _ _ => le_rfl) ht htV + hO hD hE hε hε1 hroot hupper hlower p hpower hcpower J hJ hblocks + dsimp only at he + rw [retainedModerateBlockSource_normalized c s hη hB hclong hslong, + retainedModerateBlockSum_normalized c s hB hη hclong hslong] at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS, ?_, ?_, ?_⟩ + · intro center + apply le_trans ?_ (hcap center) + apply le_of_eq + apply Finset.sum_congr + · apply congrArg (fun f : Fintype (J → Fin ((2 * Q + 1) * K)) => @Finset.univ _ f) + exact Subsingleton.elim _ _ + · intro k _ + rfl + · intro k hk + obtain ⟨d, hd, hdb, a, ξ, hξ, heq⟩ := hchar k hk + refine ⟨d, hd, hdb, a, ξ, hξ, ?_⟩ + intro j + simpa only [Nat.cast_mul, affineTorusFactor, Q] using heq j + · intro center z hz + change ‖(((K : ℝ) ^ Fintype.card J * finiteImageMass (retainedModerateBlockSource c s hη) + (retainedModerateBlockSum c s offset stride J center) z : ℝ) : ℂ) - + integerGridApproximation (retainedModerateBlockSource c s hη) + (retainedModerateBlockSum c s offset stride J center) K (R * K) S z‖ ≤ ε + have hh := happ center z hz + simp only [R, integerGridApproximation, Fintype.card_coe, finiteImageMass] at hh ⊢ + convert hh using 1 + apply congrArg norm + apply congrArg₂ (fun x y : ℂ => x - y) + · apply congrArg Complex.ofReal + apply congrArg (fun t : ℝ => (K : ℝ) ^ J.card * t) + unfold FiniteProbabilityWeights.mean + apply Finset.sum_congr + · apply Finset.ext + intro x + exact ⟨fun _ => Finset.mem_univ x, fun _ => Finset.mem_univ x⟩ + · intro x _ + rfl + · apply congrArg (fun t : ℂ => ((K : ℂ) / (R * K : ℕ)) ^ J.card * t) + apply Finset.sum_congr rfl + intro k _ + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +noncomputable def retainedFourierBudget (n g q b j p M V : ℕ) + (A B T η : ℝ≥0) (O F D E : ℝ) : IntegerFourierBudget := + let U := affinePrimitiveEnvelope (Fin q) A (B / η) (T / η) M V + let Q := affineTorusRadius q g b (O + 1) F + let R := affineTorusFactor q g b (O + 1) F + let Kmax := ⌈E * (((q + 1) * M : ℕ) : ℝ) ^ p⌉₊ + let Cshort := ((R * Kmax : ℕ) : ℝ) ^ j + let ζ := fun ε => uniformBlockRetainedBias n j (p * j) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ j) ε + { radius := Q + countConstant := max (uniformSpectrumSizeConstant n j (p * j) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ j)) Cshort + countExponent := max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * (p * j)) + coefficientCap := max (uniformSpectrumAbsoluteCap n j (p * j) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ j)) Cshort + denominatorBound := fun ε => max (uniformCharacterDenominatorBound n j (p * j) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ j) (ζ ε)) (R * Kmax : ℕ) + residualBound := fun ε => max (2 * majorArcCoverConstant n j U ((R : ℝ) * D) / + (ζ ε) ^ majorArcCoverExponent n j) 0 } + +theorem retainedFourierBudget_coefficientCap_nonneg (n g q b j p M V : ℕ) + (A B T η : ℝ≥0) (O F D E : ℝ) : + 0 ≤ (retainedFourierBudget n g q b j p M V A B T η O F D E).coefficientCap := by + unfold retainedFourierBudget + exact (pow_nonneg (Nat.cast_nonneg _) j).trans (le_max_right _ _) + +theorem retainedFourierBudget_countConstant_nonneg (n g q b j p M V : ℕ) + (A B T η : ℝ≥0) (O F D E : ℝ) : + 0 ≤ (retainedFourierBudget n g q b j p M V A B T η O F D E).countConstant := by + unfold retainedFourierBudget + exact (pow_nonneg (Nat.cast_nonneg _) j).trans (le_max_right _ _) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def relativeCubeFourierAxis {b n q K : ℕ} [NeZero b] [NeZero K] + {δ : ℝ} (P : Fin b → Fin (n + 1) → RelativeProgression δ) (hδ : 0 < δ) + (R : ℕ) (hR : 0 < R) (r : ∀ a j, (P a j).CubeResidueLabel q R) + (w : Fin b → Fin (n + 1) → (Option (Fin q) → ℝ) → ℝ) + (B T η : ℝ≥0) (hB : 0 < B) (hη : 0 < η) + (hw : ∀ a j x, 0 ≤ w a j x ∧ w a j x ≤ B) (hLip : ∀ a j, LipschitzWith T (w a j)) + (hr : ∀ a j, r a j ∉ ((P a j).cubeReference q hδ).lowWeightFibers + (((P a j).cubeSlice q).residueLabelMap (fun _ => (P a j).canonicalStep * R)) + (fun x => translatedCubeWeight (P a j).parentLength 0 (w a j) (((P a j).cubeSlice q).coordinates x)) η) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {F D E : ℝ} + (hD : 0 ≤ D) (hE : 0 ≤ E) + (hupper : ∀ a, (∏ j, ((P a j).parentLength : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ∏ j, ((P a j).parentLength : ℝ)) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((P a j).parentLength : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hblocks : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : IntegerFourierAxis := by + let s := fun a j => (P a j).retainedCubeSource q R hδ hR (r a j) (w a j) B T η (hw a j) (hLip a j) (hr a j) + have hg a := relativeProgression_family_bounds (P a) hδ hD hE (hupper a) (hlower a) p (hpower a) + exact retainedCubeFourierAxis s hη hB A hA + (O := δ⁻¹) (F := (2 : ℝ) ^ (n + 1) * F) (D := D * (δ⁻¹) ^ (n + 1)) (E := E * (δ⁻¹) ^ p) + (inv_nonneg.mpr hδ.le) (by positivity) (by positivity) + (fun a j => (hg a).2.1 j) (fun a => (hg a).2.2.1) (fun a => (hg a).2.2.2.1) + p (fun a j => (hg a).2.2.2.2 j) J hJ hblocks + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def relativeModerateFourierAxis {b n q K : ℕ} [NeZero b] [NeZero K] + {δ : ℝ} (C : Fin b → RelativeProgression δ) (P : Fin b → Fin n → RelativeProgression δ) (hδ : 0 < δ) + (R : ℕ) (hR : 0 < R) (rc : ∀ a, (C a).CoefficientResidueLabel R) + (r : ∀ a j, (P a j).CubeResidueLabel q R) + (wc : Fin b → (Option Empty → ℝ) → ℝ) (w : Fin b → Fin n → (Option (Fin q) → ℝ) → ℝ) + (B T η : ℝ≥0) (hB : 0 < B) (hη : 0 < η) + (hwc : ∀ a x, 0 ≤ wc a x ∧ wc a x ≤ B) (hLipC : ∀ a, LipschitzWith T (wc a)) + (hw : ∀ a j x, 0 ≤ w a j x ∧ w a j x ≤ B) (hLip : ∀ a j, LipschitzWith T (w a j)) + (hrc : ∀ a, rc a ∉ ((C a).coefficientReference hδ).lowWeightFibers ((C a).coefficientSlice.residueLabelMap R) + (fun x => wc a (fun _ => (((C a).coefficientSlice.value x : ℤ) : ℝ) / (C a).parentLength)) η) + (hr : ∀ a j, r a j ∉ ((P a j).cubeReference q hδ).lowWeightFibers + (((P a j).cubeSlice q).residueLabelMap (fun _ => (P a j).canonicalStep * R)) + (fun x => translatedCubeWeight (P a j).parentLength 0 (w a j) (((P a j).cubeSlice q).coordinates x)) η) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {F D E : ℝ} + (hD : 0 ≤ D) (hE : 0 ≤ E) + (hupper : ∀ a, ((C a).parentLength : ℝ) * (∏ j, ((P a j).parentLength : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * (((C a).parentLength : ℝ) * ∏ j, ((P a j).parentLength : ℝ))) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((P a j).parentLength : ℝ) ^ p) + (hcpower : ∀ a, (K : ℝ) ≤ E * ((C a).parentLength : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n) + (hblocks : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : IntegerFourierAxis := by + let c := fun a => (C a).retainedCoefficientSource R hδ hR (rc a) (wc a) B T η (hwc a) (hLipC a) (hrc a) + let s := fun a j => (P a j).retainedCubeSource q R hδ hR (r a j) (w a j) B T η (hw a j) (hLip a j) (hr a j) + have hg a := relativeModerate_family_bounds (C a) (P a) hδ hD hE (hupper a) (hlower a) p (hpower a) (hcpower a) + have hV : 1 ≤ ⌈2 / δ⌉₊ := (C ⟨0, NeZero.pos b⟩).canonicalStep_pos.trans_le + ((C ⟨0, NeZero.pos b⟩).geometric_bounds hδ).2.2.1 + exact retainedModerateFourierAxis c s hη hB (fun a => (C a).root) (fun a => (C a).canonicalStep) + A hA ⌈2 / δ⌉₊ hV (fun a => (C a).canonicalStep_pos) (fun a => ((C a).geometric_bounds hδ).2.2.1) + (O := δ⁻¹) (F := (3 * (2 : ℝ) ^ n) * F) (D := D * (δ⁻¹) ^ (n + 1)) (E := E * (δ⁻¹) ^ p) + (inv_nonneg.mpr hδ.le) (by positivity) (by positivity) + (fun a j => ((P a j).geometric_bounds hδ).2.2.2) + (fun a => (hg a).1) (fun a => (hg a).2.1) p + (fun a j => (hg a).2.2.1 j) (fun a => (hg a).2.2.2) J hJ hblocks + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RelativeSpectrumDimension.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RelativeSpectrumDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..0836ff2bd68347b4e5bd15a0b4d7a21aa4ce2b51 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RelativeSpectrumDimension.lean @@ -0,0 +1,293 @@ +import OAI.Combinatorics.Progressions.Estimates.WeightedRudin +import OAI.Combinatorics.Progressions.Probability.MassConvolution + +namespace OAI + +section + +open Finset +open scoped BigOperators + +namespace Erdos3 + +noncomputable def realFinsetIndicator {G : Type*} (A : Finset G) (x : G) : ℝ := by + classical + exact if x ∈ A then 1 else 0 + +namespace RelativeSpectrumBridge + +variable {G : Type*} [Fintype G] [AddCommGroup G] + +omit [AddCommGroup G] in + +theorem sum_realFinsetIndicator_mul_eq_const_mul_card + {B X : Finset G} (hXB : X ⊆ B) {w : G → ℝ} {c : ℝ} + (hw : ∀ x ∈ B, w x = c) : + ∑ x : G, realFinsetIndicator X x * w x = c * X.card := by + classical + calc + ∑ x : G, realFinsetIndicator X x * w x = ∑ x ∈ X, c := by + rw [← Finset.sum_subset (s₁ := X) (s₂ := Finset.univ)] + · apply Finset.sum_congr rfl + intro x hx + simp [realFinsetIndicator, hx, hw x (hXB hx)] + · simp + · intro x hxU hxX + simp [realFinsetIndicator, hxX] + _ = c * X.card := by simp [mul_comm] + +theorem sum_realFinsetIndicator_mul_character_eq_const_mul + {B X : Finset G} (hXB : X ⊆ B) {w : G → ℝ} {c : ℝ} + (hw : ∀ x ∈ B, w x = c) (psi : AddChar G ℂ) : + ∑ x : G, ((realFinsetIndicator X x * w x : ℝ) : ℂ) * psi x = + (c : ℂ) * Chang.spectrumSum X psi := by + classical + calc + ∑ x : G, ((realFinsetIndicator X x * w x : ℝ) : ℂ) * psi x = + ∑ x ∈ X, (c : ℂ) * psi x := by + rw [← Finset.sum_subset (s₁ := X) (s₂ := Finset.univ)] + · apply Finset.sum_congr rfl + intro x hx + simp [realFinsetIndicator, hx, hw x (hXB hx)] + · simp + · intro x hxU hxX + simp [realFinsetIndicator, hxX] + _ = (c : ℂ) * Chang.spectrumSum X psi := by + rw [Chang.spectrumSum, Finset.mul_sum] + +theorem mem_relativeLargeSpectrum_of_eq_const_iff + {B X : Finset G} (hXB : X ⊆ B) {w : G → ℝ} {c : ℝ} + (hw : ∀ x ∈ B, w x = c) (hc : 0 < c) + (eta : ℝ) (psi : AddChar G ℂ) : + psi ∈ RelativeChangSanders.relativeLargeSpectrum w (realFinsetIndicator X) eta ↔ + psi ∈ Chang.largeSpectrum X eta := by + classical + rw [RelativeChangSanders.mem_relativeLargeSpectrum, Chang.mem_largeSpectrum] + rw [sum_realFinsetIndicator_mul_eq_const_mul_card hXB hw] + rw [sum_realFinsetIndicator_mul_character_eq_const_mul hXB hw] + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hc] + constructor + · intro h + have hh : c * (eta * (X.card : ℝ)) ≤ + c * ‖Chang.spectrumSum X psi‖ := by + calc + c * (eta * (X.card : ℝ)) = eta * (c * (X.card : ℝ)) := by ring + _ ≤ c * ‖Chang.spectrumSum X psi‖ := h + nlinarith + · intro h + calc + eta * (c * (X.card : ℝ)) = c * (eta * (X.card : ℝ)) := by ring + _ ≤ c * ‖Chang.spectrumSum X psi‖ := + mul_le_mul_of_nonneg_left h hc.le + +end RelativeSpectrumBridge +end Erdos3 + +end + +section + +noncomputable section + +open Finset Function Real +open scoped BigOperators ComplexConjugate NNReal + +namespace Erdos3.RelativeChangSanders + +variable {G : Type*} [Fintype G] [AddCommGroup G] + +theorem card_weightedDissociated_relativeLargeSpectrum_le + (mu f : G → ℝ) (K eta : ℝ) (Delta : Finset (AddChar G ℂ)) + (hmu : ∀ x, 0 ≤ mu x) (hf0 : ∀ x, 0 ≤ f x) + (hf1 : ∀ x, f x ≤ 1) + (heta : 0 < eta) + (hDelta : IsWeightedDissociated mu K Delta) + (hsub : Delta ⊆ relativeLargeSpectrum mu f eta) + (hmass : 0 < ∑ x : G, f x * mu x) : + (Delta.card : ℝ) ≤ + 2 * (K + log ((∑ x : G, f x * mu x)⁻¹)) / eta ^ 2 := by + let a : ℝ := ∑ x : G, f x * mu x + have ha : 0 < a := by simpa [a] using hmass + let spec : AddChar G ℂ → ℂ := fun psi ↦ + ∑ x : G, (f x * mu x : ℝ) * psi x + choose u hu huspec using fun psi : AddChar G ℂ ↦ + Complex.exists_norm_eq_mul_self (spec psi) + let c : AddChar G ℂ → ℂ := fun psi ↦ (eta : ℂ) * u psi + let P : G → ℝ := fun x ↦ (∑ psi ∈ Delta, c psi * psi x).re + have hc_norm (psi : AddChar G ℂ) : ‖c psi‖ ^ 2 = eta ^ 2 := by + simp [c, hu, abs_of_pos heta] + have hc_sq : ∑ psi ∈ Delta, ‖c psi‖ ^ 2 = eta ^ 2 * Delta.card := by + simp_rw [hc_norm] + simp + ring + have hcomplex : + ∑ x : G, ((f x * mu x : ℝ) : ℂ) * + (∑ psi ∈ Delta, c psi * psi x) = + (eta : ℂ) * ∑ psi ∈ Delta, (‖spec psi‖ : ℂ) := by + calc + ∑ x : G, ((f x * mu x : ℝ) : ℂ) * + (∑ psi ∈ Delta, c psi * psi x) = + ∑ psi ∈ Delta, + c psi * ∑ x : G, ((f x * mu x : ℝ) : ℂ) * psi x := by + simp_rw [Finset.mul_sum] + rw [Finset.sum_comm] + apply sum_congr rfl + intro psi hpsi + apply sum_congr rfl + intro x hx + ring + _ = ∑ psi ∈ Delta, (eta : ℂ) * (‖spec psi‖ : ℂ) := by + apply sum_congr rfl + intro psi hpsi + dsimp [c, spec] + rw [mul_assoc, ← huspec] + _ = (eta : ℂ) * ∑ psi ∈ Delta, (‖spec psi‖ : ℂ) := by + rw [Finset.mul_sum] + have hmeanP : + ∑ x : G, f x * mu x * P x = + eta * ∑ psi ∈ Delta, ‖spec psi‖ := by + have hre := congrArg Complex.re hcomplex + calc + ∑ x : G, f x * mu x * P x = + (∑ x : G, ((f x * mu x : ℝ) : ℂ) * + (∑ psi ∈ Delta, c psi * psi x)).re := by + simp [P, Complex.re_sum, Complex.mul_re] + _ = ((eta : ℂ) * + ∑ psi ∈ Delta, (‖spec psi‖ : ℂ)).re := hre + _ = eta * ∑ psi ∈ Delta, ‖spec psi‖ := by simp + have hmean_lower : + eta ^ 2 * a * Delta.card ≤ ∑ x : G, f x * mu x * P x := by + rw [hmeanP] + calc + eta ^ 2 * a * (Delta.card : ℝ) = + ∑ psi ∈ Delta, eta * (eta * a) := by + simp + ring + _ ≤ ∑ psi ∈ Delta, eta * ‖spec psi‖ := by + gcongr with psi hpsi + have hs := mem_relativeLargeSpectrum.mp (hsub hpsi) + simpa [a, spec] using hs + _ = eta * ∑ psi ∈ Delta, ‖spec psi‖ := by + rw [Finset.mul_sum] + let w : G → ℝ := fun x ↦ f x * mu x / a + have hw0 : ∀ x, 0 ≤ w x := by + intro x + exact div_nonneg (mul_nonneg (hf0 x) (hmu x)) ha.le + have hw_sum : ∑ x : G, w x = 1 := by + dsimp [w] + rw [← Finset.sum_div] + dsimp [a] + exact div_self ha.ne' + have hmean_w : eta ^ 2 * Delta.card ≤ ∑ x : G, w x * P x := by + calc + eta ^ 2 * (Delta.card : ℝ) ≤ + (∑ x : G, f x * mu x * P x) / a := by + rw [le_div_iff₀ ha] + calc + eta ^ 2 * (Delta.card : ℝ) * a = + eta ^ 2 * a * (Delta.card : ℝ) := by ring + _ ≤ _ := hmean_lower + _ = ∑ x : G, w x * P x := by + dsimp [w] + rw [Finset.sum_div] + apply sum_congr rfl + intro x hx + ring + have hJensen : + exp (eta ^ 2 * Delta.card) ≤ + ∑ x : G, w x * exp (P x) := by + calc + exp (eta ^ 2 * Delta.card) ≤ exp (∑ x : G, w x * P x) := by + exact Real.exp_le_exp.mpr hmean_w + _ ≤ _ := exp_weightedAverage_le_weightedAverage_exp w hw0 hw_sum P + have hweighted_le : + ∑ x : G, w x * exp (P x) ≤ + a⁻¹ * ∑ x : G, mu x * exp (P x) := by + dsimp [w] + rw [Finset.mul_sum] + apply sum_le_sum + intro x hx + rw [div_eq_inv_mul] + calc + a⁻¹ * (f x * mu x) * exp (P x) ≤ + a⁻¹ * (1 * mu x) * exp (P x) := by + apply mul_le_mul_of_nonneg_right _ (exp_pos _).le + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr ha.le) + exact mul_le_mul_of_nonneg_right (hf1 x) (hmu x) + _ = a⁻¹ * (mu x * exp (P x)) := by ring + have hRudin : + ∑ x : G, mu x * exp (P x) ≤ + exp (K + eta ^ 2 * Delta.card / 2) := by + have hr := weighted_rudin_exp_ineq mu K Delta hmu hDelta c + simpa [P, hc_sq] using hr + have hchain : + exp (eta ^ 2 * Delta.card) ≤ + a⁻¹ * exp (K + eta ^ 2 * Delta.card / 2) := + hJensen.trans (hweighted_le.trans + (mul_le_mul_of_nonneg_left hRudin (inv_nonneg.mpr ha.le))) + have hmul : + a * exp (eta ^ 2 * Delta.card) ≤ + exp (K + eta ^ 2 * Delta.card / 2) := by + calc + a * exp (eta ^ 2 * Delta.card) ≤ + a * (a⁻¹ * exp (K + eta ^ 2 * Delta.card / 2)) := by + gcongr + _ = exp (K + eta ^ 2 * Delta.card / 2) := by + field_simp + have hlinear : + log a + eta ^ 2 * Delta.card ≤ + K + eta ^ 2 * Delta.card / 2 := by + rw [← exp_log ha, ← exp_add] at hmul + exact Real.exp_le_exp.mp hmul + have heta_sq : 0 < eta ^ 2 := sq_pos_of_pos heta + rw [le_div_iff₀ heta_sq] + rw [log_inv] + nlinarith + +theorem card_weightedDissociated_realFinsetIndicator_le + (B X : Finset G) (hXB : X ⊆ B) (hX : X.Nonempty) + (w : G → ℝ) (c R eta : ℝ) + (hw0 : ∀ x, 0 ≤ w x) (hw : ∀ x ∈ B, w x = c) + (hc : 0 < c) (hR : (c * X.card)⁻¹ ≤ R) + (heta : 0 < eta) (Delta : Finset (AddChar G ℂ)) + (hDelta : IsWeightedDissociated w 1 Delta) + (hsub : Delta ⊆ Chang.largeSpectrum X eta) : + (Delta.card : ℝ) ≤ 2 * (1 + log R) / eta ^ 2 := by + classical + have hmass_eq : + ∑ x : G, realFinsetIndicator X x * w x = c * X.card := + RelativeSpectrumBridge.sum_realFinsetIndicator_mul_eq_const_mul_card hXB hw + have hmass : 0 < ∑ x : G, realFinsetIndicator X x * w x := by + rw [hmass_eq] + have hXcard : (0 : ℝ) < X.card := by exact_mod_cast hX.card_pos + positivity + have hsub' : Delta ⊆ + relativeLargeSpectrum w (realFinsetIndicator X) eta := by + intro psi hpsi + exact (RelativeSpectrumBridge.mem_relativeLargeSpectrum_of_eq_const_iff + hXB hw hc eta psi).2 (hsub hpsi) + have hdim := card_weightedDissociated_relativeLargeSpectrum_le + w (realFinsetIndicator X) 1 eta Delta hw0 + (by intro x; unfold realFinsetIndicator; split <;> norm_num) + (by intro x; unfold realFinsetIndicator; split <;> norm_num) + heta hDelta hsub' hmass + have hmassInv : + ((∑ x : G, realFinsetIndicator X x * w x)⁻¹) ≤ R := by + simpa [hmass_eq] using hR + have hlog : + log ((∑ x : G, realFinsetIndicator X x * w x)⁻¹) ≤ log R := + Real.log_le_log (inv_pos.mpr hmass) hmassInv + calc + (Delta.card : ℝ) ≤ + 2 * (1 + log ((∑ x : G, realFinsetIndicator X x * w x)⁻¹)) / + eta ^ 2 := by simpa using hdim + _ ≤ 2 * (1 + log R) / eta ^ 2 := by + gcongr + +end Erdos3.RelativeChangSanders + +end + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/ResidueFourierProjection.lean b/lean/OAI/Combinatorics/Progressions/Fourier/ResidueFourierProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f84c86a2a679eddacac74fb98695799be578a25 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/ResidueFourierProjection.lean @@ -0,0 +1,86 @@ +import OAI.Combinatorics.Progressions.Lattices.WeightedSliceIntegerImage + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def rectangularResidueCharacter {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) : AddChar (J → ZMod M) ℂ where + toFun z := ∏ j, cyclicIntegerCharacter M ((k j).val : ℤ) (z j) + map_zero_eq_one' := by simp + map_add_eq_mul' x y := by + simp only [Pi.add_apply, AddChar.map_add_eq_mul, Finset.prod_mul_distrib] + +theorem rectangularResidueCharacter_integerGridResidue {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) (y : J → ℤ) : + rectangularResidueCharacter M k (integerGridResidue M y) = rectangularGridCharacter M k y := by + change (∏ j, cyclicIntegerCharacter M ((k j).val : ℤ) (y j : ZMod M)) = + ∏ j, cyclicIntegerCharacter M (y j) ((k j).val : ZMod M) + apply Finset.prod_congr rfl + intro j _ + change CircleFourier.character (ZMod.toAddCircle ((y j : ZMod M) * (((k j).val : ℤ) : ZMod M))) = + CircleFourier.character (ZMod.toAddCircle (((k j).val : ZMod M) * (y j : ZMod M))) + simp only [Int.cast_natCast, mul_comm] + +noncomputable def rectangularResidueMode {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) : AddChar (J → ZMod M) ℂ := + (rectangularResidueCharacter M k)⁻¹ + +theorem rectangularResidueMode_integerGridResidue {J : Type*} [Fintype J] + (M : ℕ) [NeZero M] (k : J → Fin M) (y : J → ℤ) : + rectangularResidueMode M k (integerGridResidue M y) = star (rectangularGridCharacter M k y) := by + rw [rectangularResidueMode, AddChar.inv_apply, AddChar.map_neg_eq_inv, AddChar.inv_apply_eq_conj, + rectangularResidueCharacter_integerGridResidue] + rfl + +noncomputable def residueGridApproximation {X J : Type*} [Fintype X] [Fintype J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (K M : ℕ) [NeZero M] + (S : Finset (J → Fin M)) (z : J → ZMod M) : ℂ := + ∑ k : S, integerRetainedCoefficient p Y K M k * rectangularResidueMode M k z + +theorem residueGridApproximation_integerGridResidue {X J : Type*} [Fintype X] [Fintype J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (K M : ℕ) [NeZero M] + (S : Finset (J → Fin M)) (y : J → ℤ) : + residueGridApproximation p Y K M S (integerGridResidue M y) = + integerGridApproximation p Y K M S y := by + rw [residueGridApproximation, integerGridApproximation_eq_sum] + simp_rw [rectangularResidueMode_integerGridResidue] + exact Finset.sum_coe_sort S + (fun k => integerRetainedCoefficient p Y K M k * star (rectangularGridCharacter M k y)) + +theorem residueGridProjection_tested_error {X J H G : Type*} + [Fintype X] [Fintype J] [AddCommGroup H] [Fintype H] [Fintype G] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (K M : ℕ) [NeZero M] + (S : Finset (J → Fin M)) (q : FiniteProbabilityWeights G) (ι : H →+ (J → ZMod M)) + (f w : G → ℂ) (path : G → J → ℤ) {B C ρ τ : ℝ} + (hKM : K ≤ M) (hρ : 0 ≤ ρ) (hτ : 0 ≤ τ) (hw : q.mean (fun x => ‖w x‖) ≤ B) + (hcap : (∑ k, ‖integerGridCoefficient p Y M k‖) ≤ C) + (happrox : ∀ x, q.weight x ≠ 0 → ‖f x - integerGridApproximation p Y K M S (path x)‖ ≤ ρ) + (hdiscard : ∀ k : S, (rectangularResidueMode M k).compAddMonoidHom ι ≠ 1 → + ‖q.complexMean (fun x => w x * star (rectangularGridCharacter M k (path x)))‖ ≤ τ) : + ‖q.complexMean (fun x => w x * f x) - + q.complexMean (fun x => w x * finiteCosetAverage ι (residueGridApproximation p Y K M S) + (integerGridResidue M (path x)))‖ ≤ B * ρ + C * τ := by + apply finiteCosetAverage_truncation_tested_error q ι f (fun x => integerGridResidue M (path x)) w + (fun k : S => integerRetainedCoefficient p Y K M k) (fun k : S => rectangularResidueMode M k) + hρ hτ hw + · calc + _ = ∑ k ∈ S, ‖integerRetainedCoefficient p Y K M k‖ := + Finset.sum_coe_sort S (fun k => ‖integerRetainedCoefficient p Y K M k‖) + _ ≤ C := integerRetainedCoefficient_mass_le p Y K M S hKM hcap + · intro x hx + change ‖f x - residueGridApproximation p Y K M S (integerGridResidue M (path x))‖ ≤ ρ + rw [residueGridApproximation_integerGridResidue] + exact happrox x hx + · intro k hk + simpa only [rectangularResidueMode_integerGridResidue] using hdiscard k hk + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/RetainedCharacterGridSum.lean b/lean/OAI/Combinatorics/Progressions/Fourier/RetainedCharacterGridSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbe3912a556c931a2fec0acb5b1435a6fd43539e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/RetainedCharacterGridSum.lean @@ -0,0 +1,87 @@ +import Mathlib.Topology.Algebra.InfiniteSum.Ring +import OAI.Combinatorics.Progressions.Estimates.CorrelationDerivative + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem retainedCharacterGrid_tsum {K Χ : Type*} + (S : Finset Χ) (coeff : Χ → ℂ) (g : K → ℂ) + (phase : Χ → K → ℂ) (φ : K → ℂ) (v : ℂ) + (hs : ∀ χ ∈ S, Summable (fun k => phase χ k * g k * φ k)) : + (∑' k, g k * (∑ χ ∈ S, coeff χ * phase χ k) * φ k) / v = + ∑ χ ∈ S, coeff χ * ((∑' k, phase χ k * g k * φ k) / v) := by + have he (k : K) : g k * (∑ χ ∈ S, coeff χ * phase χ k) * φ k = + ∑ χ ∈ S, coeff χ * (phase χ k * g k * φ k) := by + simp only [Finset.mul_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro χ _ + ring + simp_rw [he] + rw [Summable.tsum_finsetSum (fun χ hχ => (hs χ hχ).mul_left (coeff χ))] + simp_rw [tsum_mul_left, Finset.sum_div, mul_div_assoc] + +theorem retainedCharacterGrid_expect {B Χ : Type*} [Fintype B] + (S : Finset Χ) (coeff : Χ → ℂ) (phase : Χ → B → ℂ) (φ : B → ℂ) : + (𝔼 b, (∑ χ ∈ S, coeff χ * phase χ b) * φ b) = + ∑ χ ∈ S, coeff χ * (𝔼 b, phase χ b * φ b) := by + simp only [Finset.expect_eq_sum_div_card, Finset.sum_mul] + rw [Finset.sum_comm, Finset.sum_div] + apply Finset.sum_congr rfl + intro χ _ + simp_rw [mul_assoc] + rw [← Finset.mul_sum, mul_div_assoc] + +theorem retainedCharacterGrid_complexMean {B Χ : Type*} [Fintype B] + (p : FiniteProbabilityWeights B) (S : Finset Χ) (coeff : Χ → ℂ) + (phase : Χ → B → ℂ) (φ : B → ℂ) : + p.complexMean (fun b => (∑ χ ∈ S, coeff χ * phase χ b) * φ b) = + ∑ χ ∈ S, coeff χ * p.complexMean (fun b => phase χ b * φ b) := by + simp only [FiniteProbabilityWeights.complexMean, Finset.sum_mul, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro χ _ + apply Finset.sum_congr rfl + intro b _ + ring + +theorem retainedCharacterGrid_norm_sub_le {Χ : Type*} + (S : Finset Χ) (coeff disc cont : Χ → ℂ) {M E : ℝ} + (hE : 0 ≤ E) (hcoeff : (∑ χ ∈ S, ‖coeff χ‖) ≤ M) + (he : ∀ χ ∈ S, ‖disc χ - cont χ‖ ≤ E) : + ‖(∑ χ ∈ S, coeff χ * disc χ) - (∑ χ ∈ S, coeff χ * cont χ)‖ ≤ M * E := by + rw [← Finset.sum_sub_distrib] + simp_rw [← mul_sub] + calc + _ ≤ ∑ χ ∈ S, ‖coeff χ * (disc χ - cont χ)‖ := norm_sum_le _ _ + _ ≤ ∑ χ ∈ S, ‖coeff χ‖ * E := by + apply Finset.sum_le_sum + intro χ hχ + rw [norm_mul] + exact mul_le_mul_of_nonneg_left (he χ hχ) (norm_nonneg _) + _ = (∑ χ ∈ S, ‖coeff χ‖) * E := (Finset.sum_mul ..).symm + _ ≤ M * E := mul_le_mul_of_nonneg_right hcoeff hE + +theorem retainedCharacterGrid_tsum_sub_expect_le {K B Χ : Type*} [Fintype B] + (S : Finset Χ) (coeff : Χ → ℂ) (g : K → ℂ) + (phase : Χ → K → ℂ) (φ : K → ℂ) (v : ℂ) + (refPhase : Χ → B → ℂ) (refTest : B → ℂ) {M E : ℝ} + (hs : ∀ χ ∈ S, Summable (fun k => phase χ k * g k * φ k)) + (hE : 0 ≤ E) (hcoeff : (∑ χ ∈ S, ‖coeff χ‖) ≤ M) + (he : ∀ χ ∈ S, ‖(∑' k, phase χ k * g k * φ k) / v - + (𝔼 b, refPhase χ b * refTest b)‖ ≤ E) : + ‖(∑' k, g k * (∑ χ ∈ S, coeff χ * phase χ k) * φ k) / v - + (𝔼 b, (∑ χ ∈ S, coeff χ * refPhase χ b) * refTest b)‖ ≤ M * E := by + rw [retainedCharacterGrid_tsum S coeff g phase φ v hs, + retainedCharacterGrid_expect S coeff refPhase refTest] + exact retainedCharacterGrid_norm_sub_le S coeff _ _ hE hcoeff he + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SectionPolynomialCharacter.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SectionPolynomialCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..88341535a20e49034b3ac27219e6d6217511a291 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SectionPolynomialCharacter.lean @@ -0,0 +1,110 @@ +import OAI.Combinatorics.Progressions.Estimates.BoundedExtendedSiteSection +import OAI.Combinatorics.Progressions.Linear.BooleanJetMatrixFactor + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Matrix + +theorem integer_section_functional_factor {I S J : Type*} + [Fintype I] [Fintype S] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (E : Matrix S I ℤ) (T : Matrix I S ℤ) + (d : ℕ) (hd : 0 < d) + (hT : ∀ x : I → U, matrixModuleAction (fun s i => (E s i : ℝ)) + (matrixModuleAction (fun i s => (T i s : ℝ)) + (matrixModuleAction (fun s i => (E s i : ℝ)) x)) = + (d : ℝ) • matrixModuleAction (fun s i => (E s i : ℝ)) x) + (frequency : Matrix I J ℤ) (M : (S → U) →ₗ[ℝ] ℝ) + (hfactor : ∀ x, subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x = + M (matrixModuleAction (fun s i => (E s i : ℝ)) x)) (x : I → U) : + subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x = + subspaceArrayFunctional U (fun s a => ((T.transpose * frequency) s a : ℝ)) + ((d : ℝ)⁻¹ • matrixModuleAction (fun s i => (E s i : ℝ)) x) := by + have hfun : subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) + (matrixModuleAction (fun i s => (T i s : ℝ)) + (matrixModuleAction (fun s i => (E s i : ℝ)) x)) = + (d : ℝ) • subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x := by + rw [hfactor, hT, map_smul, hfactor] + have hcast : Matrix.of (fun s a => ((T.transpose * frequency) s a : ℝ)) = + (Matrix.of (fun i s => (T i s : ℝ))).transpose * Matrix.of (fun i a => (frequency i a : ℝ)) := by + ext s a + simp only [Matrix.mul_apply, Matrix.transpose_apply, Matrix.of_apply, Int.cast_sum, Int.cast_mul] + rw [show (fun s a => ((T.transpose * frequency) s a : ℝ)) = + ((Matrix.of (fun i s => (T i s : ℝ))).transpose * + Matrix.of (fun i a => (frequency i a : ℝ))) from hcast] + rw [← subspaceArrayFunctional_matrix, map_smul, map_smul] + change subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x = + (d : ℝ)⁻¹ • subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) + (matrixModuleAction (fun i s => (T i s : ℝ)) + (matrixModuleAction (fun s i => (E s i : ℝ)) x)) + rw [hfun] + have hn : (d : ℝ) ≠ 0 := (Nat.cast_pos.mpr hd).ne' + simp only [smul_eq_mul, ← mul_assoc, inv_mul_cancel₀ hn, one_mul] + +theorem integer_section_character_factor {I S J : Type*} + [Fintype I] [Fintype S] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (E : Matrix S I ℤ) (T : Matrix I S ℤ) + (d : ℕ) (hd : 0 < d) + (hT : ∀ x : I → U, matrixModuleAction (fun s i => (E s i : ℝ)) + (matrixModuleAction (fun i s => (T i s : ℝ)) + (matrixModuleAction (fun s i => (E s i : ℝ)) x)) = + (d : ℝ) • matrixModuleAction (fun s i => (E s i : ℝ)) x) + (frequency : Matrix I J ℤ) (M : (S → U) →ₗ[ℝ] ℝ) + (hfactor : ∀ x, subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x = + M (matrixModuleAction (fun s i => (E s i : ℝ)) x)) (x : I → U) : + CircleFourier.character (subspaceArrayFunctional U (fun i a => (frequency i a : ℝ)) x : CircleFourier.Circle) = + subspaceArrayCharacter U (T.transpose * frequency) + (QuotientAddGroup.mk' (subspaceArrayIntegerLattice S U) + ((d : ℝ)⁻¹ • matrixModuleAction (fun s i => (E s i : ℝ)) x)) := by + rw [subspaceArrayCharacter_mk] + exact congrArg (fun t : ℝ => CircleFourier.character (t : CircleFourier.Circle)) + (integer_section_functional_factor U E T d hd hT frequency M hfactor x) + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped Matrix + +theorem integer_section_polynomial_character {K S J : Type*} + [Fintype K] [Fintype S] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (h : ℕ) (site : S → K → ℤ) + (T : Matrix (BoundedCoefficientExponent K h) S ℤ) (d : ℕ) (hd : 0 < d) + (hT : ∀ x : BoundedCoefficientExponent K h → U, + matrixModuleAction (fun s i => (boundedSiteMatrix h site s i : ℝ)) + (matrixModuleAction (fun i s => (T i s : ℝ)) + (matrixModuleAction (fun s i => (boundedSiteMatrix h site s i : ℝ)) x)) = + (d : ℝ) • matrixModuleAction (fun s i => (boundedSiteMatrix h site s i : ℝ)) x) + (frequency : (K →₀ ℕ) → J → ℤ) (M : (S → U) →ₗ[ℝ] ℝ) + (hfactor : ∀ p : VectorPolynomial K ℝ U, DegreeLE (1 : K → ℕ) h p → + coefficientFunctional (fun e a => (frequency e a : ℝ)) (map U.subtype p) = + M (siteEvaluation (fun s k => (site s k : ℝ)) p)) + (p : VectorPolynomial K ℝ U) (hp : DegreeLE (1 : K → ℕ) h p) : + CircleFourier.character + (coefficientFunctional (fun e a => (frequency e a : ℝ)) (map U.subtype p) : CircleFourier.Circle) = + subspaceArrayCharacter U (T.transpose * Matrix.of (fun e a => frequency e.val a)) + (QuotientAddGroup.mk' (subspaceArrayIntegerLattice S U) + ((d : ℝ)⁻¹ • siteEvaluation (fun s k => (site s k : ℝ)) p)) := by + have hfun := coefficientFunctional_boundedArrayPolynomial U h + (fun e a => (frequency e a : ℝ)) (fun e => coefficients p e.val) + rw [boundedArrayPolynomial_reconstruct p hp] at hfun + have hrow := integer_section_functional_factor U (boundedSiteMatrix h site) T d hd hT + (Matrix.of (fun e a => frequency e.val a)) M + (bounded_site_factorization_to_array U h site (fun e a => (frequency e a : ℝ)) M hfactor) + (fun e => coefficients p e.val) + rw [← siteEvaluation_bounded_coefficients site p hp] at hrow + rw [subspaceArrayCharacter_mk] + exact congrArg (fun t : ℝ => CircleFourier.character (t : CircleFourier.Circle)) (hfun.trans hrow) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SectionRetainedFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SectionRetainedFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..191bb88320d1079670f980d5ec427efd48815dc9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SectionRetainedFourier.lean @@ -0,0 +1,411 @@ +import OAI.Combinatorics.Progressions.Estimates.AnchoredCubeCongruenceRemoval +import OAI.Combinatorics.Progressions.Fourier.AnchoredCoefficientFourierNormalization +import OAI.Combinatorics.Progressions.Fourier.SectionPolynomialCharacter +import OAI.Combinatorics.Progressions.Lattices.AffineCoveredSiteValues +import OAI.Combinatorics.Progressions.Linear.FixedKernelGeometricCover + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial +open scoped BigOperators Classical + +noncomputable def affineCubeFourierSum {I K F : Type*} [Fintype K] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (c : F → ℂ) (b : Option K → I → ℝ) : ℂ := + ∑ a, c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) p b + +noncomputable def affineCubeFourierProjection {I K F : Type*} [Fintype K] [Fintype F] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (c : F → ℂ) (b : Option K → I → ℝ) : ℂ := + ∑ a, if affineCubeModeFactors U root difference (frequency a) then + c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) p b else 0 + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial +open scoped BigOperators + +theorem exists_affine_cube_fourier_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), + ∃ 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) : ℝ)) * + affineCubeFourierProjection U root difference frequency p c (fun k j => (z (k, j) : ℝ))))‖ ≤ ε := by + obtain ⟨A₀, _, hremove⟩ := exists_affine_cube_congruence_removal m q + obtain ⟨A₁, _, hthreshold⟩ := exists_cube_residue_threshold_exp_budget m q + obtain ⟨A, hA, hbudget⟩ := exists_fourier_uniform_budget A₀ A₁ + 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 + classical + let P' := 2 * P + 2 + let δ := fourierModeError B ε + have hPP : P ≤ P' := by dsimp [P']; linarith + have hEP : Real.exp P ≤ Real.exp P' := Real.exp_le_exp.mpr hPP + have hδ : 0 < δ := fourierModeError_pos hB hε + have hδP : 1 / δ ≤ Real.exp P' := fourierModeError_inv_le_exp hP hB hBP hε hεP + obtain ⟨hb₀, hb₁⟩ := hbudget P hP + obtain ⟨hside, _⟩ := hthreshold (Fintype.card I) (Fintype.card (Option K × I)) + P' C L S ρ δ (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) hC (hCP.trans hEP) + hL (hLP.trans hEP) hS (hSP.trans hEP) hρ (hρP.trans hEP) hδ hδP + have hZ := selectedResidueSmoothWeight_pos_of_threshold m (cubeModePolynomialBudget_pos q hL).le + hS hρ hδ stride hs hstride H (fun j => hside.trans (hb₁.trans (hsize j))) G hG V hV hwidth + refine ⟨hZ, ?_⟩ + apply le_trans ?_ (fourierModeError_cost_le hB hε) + unfold affineCubeFourierSum affineCubeFourierProjection + apply selectedResidueSmoothPMF_discard_error stride G V hV hZ + (fun z => layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ))) + c (fun a z => layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ))) + (fun a => affineCubeModeFactors U root difference (frequency a)) hcoefficients hδ.le + intro a hbad + obtain ⟨_, hr⟩ := hremove (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) + U root difference hlin hL hC (hLP.trans hEP) (hCP.trans hEP) hsite (frequency a) (hbound a) + ((not_affineCubeModeFactors_iff U root difference (frequency a)).mp hbad) + p hp hm stride hs hS (hSP.trans hEP) hρ hδ (hρP.trans hEP) hδP hstride + H (fun j => hb₀.trans (hsize j)) hrank (hb₀.trans hR) Q hQ test htest G hG V hV hwidth + simpa only [layeredModeTestedPhase_eq_weight_mul] using hr + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial +open scoped BigOperators + +theorem exists_anchored_affine_cube_fourier_projection (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} + [Fintype I] [DecidableEq I] [Fintype K] + (anchor : Option K × I → ℤ) + {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), + ∃ 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 => ((anchor + z) (k, j) : ℝ)) * + affineCubeFourierSum frequency p c (fun k j => ((anchor + 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 => ((anchor + z) (k, j) : ℝ)) * + affineCubeFourierProjection U root difference frequency p c (fun k j => ((anchor + z) (k, j) : ℝ))))‖ ≤ ε := by + obtain ⟨A₀, _, hremove⟩ := exists_anchored_affine_cube_congruence_removal m q + obtain ⟨A₁, _, hthreshold⟩ := exists_cube_residue_threshold_exp_budget m q + obtain ⟨A, hA, hbudget⟩ := exists_fourier_uniform_budget A₀ A₁ + refine ⟨A, hA, ?_⟩ + intro I K _ _ _ anchor 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 + classical + let P' := 2 * P + 2 + let δ := fourierModeError B ε + have hPP : P ≤ P' := by dsimp [P']; linarith + have hEP : Real.exp P ≤ Real.exp P' := Real.exp_le_exp.mpr hPP + have hδ : 0 < δ := fourierModeError_pos hB hε + have hδP : 1 / δ ≤ Real.exp P' := fourierModeError_inv_le_exp hP hB hBP hε hεP + obtain ⟨hb₀, hb₁⟩ := hbudget P hP + obtain ⟨hside, _⟩ := hthreshold (Fintype.card I) (Fintype.card (Option K × I)) + P' C L S ρ δ (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) hC (hCP.trans hEP) + hL (hLP.trans hEP) hS (hSP.trans hEP) hρ (hρP.trans hEP) hδ hδP + have hZ := selectedResidueSmoothWeight_pos_of_threshold m (cubeModePolynomialBudget_pos q hL).le + hS hρ hδ stride hs hstride H (fun j => hside.trans (hb₁.trans (hsize j))) G hG V hV hwidth + refine ⟨hZ, ?_⟩ + apply le_trans ?_ (fourierModeError_cost_le hB hε) + unfold affineCubeFourierSum affineCubeFourierProjection + apply selectedResidueSmoothPMF_discard_error stride G V hV hZ + (fun z => layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => ((anchor + z) (k, j) : ℝ))) + c (fun a z => layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => ((anchor + z) (k, j) : ℝ))) + (fun a => affineCubeModeFactors U root difference (frequency a)) hcoefficients hδ.le + intro a hbad + obtain ⟨_, hr⟩ := hremove anchor (hP.trans hPP) (hn.trans hPP) (hd.trans hPP) + U root difference hlin hL hC (hLP.trans hEP) (hCP.trans hEP) hsite (frequency a) (hbound a) + ((not_affineCubeModeFactors_iff U root difference (frequency a)).mp hbad) + p hp hm stride hs hS (hSP.trans hEP) hρ hδ (hρP.trans hEP) hδP hstride + H (fun j => hb₀.trans (hsize j)) hrank (hb₀.trans hR) Q hQ test htest G hG V hV hwidth + simpa only [layeredModeTestedPhase_eq_weight_mul] using hr + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial +open scoped BigOperators Classical + +noncomputable def retainedSiteFourierSum {K F : Type*} [Fintype K] [Fintype F] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (b : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ) (c : F → ℂ) + (x : ∀ j, SubspaceArrayTorus (Finset (Fin q)) (U j)) : ℂ := + ∑ a, if affineCubeModeFactors U root difference (frequency a) then + c a * ∏ j, subspaceArrayCharacter (U j) (b a j) (x j) else 0 + +theorem retainedSiteFourierSum_norm_le {K F : Type*} [Fintype K] [Fintype F] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (b : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ) (c : F → ℂ) + (x : ∀ j, SubspaceArrayTorus (Finset (Fin q)) (U j)) : + ‖retainedSiteFourierSum U root difference frequency b c x‖ ≤ ∑ a, ‖c a‖ := by + unfold retainedSiteFourierSum + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro a _ + by_cases ha : affineCubeModeFactors U root difference (frequency a) + · simp [ha, norm_prod, subspaceArrayCharacter_norm] + · simp [ha] + +theorem exists_geometric_site_fourier_projection (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {K : Type*} [Fintype K] + (root : K → ℤ) (difference : Fin q → K → ℤ) + {P : ℝ} (_hP : 0 ≤ P) (_hK : (Fintype.card K : ℝ) ≤ P) + (_hsite : ∀ (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)] {F : Type*} [Fintype F] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (_hfrequency : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, + |(frequency a j d t : ℝ)| ≤ Real.exp P), + ∃ b : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ, + (∀ a j s t, |(b a j s t : ℝ)| ≤ Real.exp ((P + A) ^ A)) ∧ + ∀ {I : Type*} (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) (c : F → ℂ) (x : Option K → I → ℝ), + affineCubeFourierProjection U root difference frequency p c x = + retainedSiteFourierSum U root difference frequency b c + (affineCoveredSiteSample U root difference D p hm x) := by + obtain ⟨A, hA, hcover⟩ := exists_geometric_retained_common_cover m q + refine ⟨A, hA, ?_⟩ + intro K _ root difference P hP hK hsite + obtain ⟨D, hD, hDP, hrows⟩ := hcover root difference hP hK hsite + refine ⟨D, hD, hDP, ?_⟩ + intro J _ F _ U frequency hfrequency + choose b hb hchar using fun a : {a : F // affineCubeModeFactors U root difference (frequency a)} => + hrows U (frequency a) (hfrequency a) a.property + let row : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ := fun a => + if ha : affineCubeModeFactors U root difference (frequency a) then b ⟨a, ha⟩ else fun _ => 0 + refine ⟨row, ?_, ?_⟩ + · intro a j s t + by_cases ha : affineCubeModeFactors U root difference (frequency a) + · simpa only [row, dite_eq_left ha] using hb ⟨a, ha⟩ j s t + · simp [row, ha, (Real.exp_pos _).le] + · intro I p hp hm c x + unfold affineCubeFourierProjection retainedSiteFourierSum + apply Finset.sum_congr rfl + intro a _ + by_cases ha : affineCubeModeFactors U root difference (frequency a) + · rw [ite_eq_left ha, ite_eq_left ha] + congr 1 + simpa only [row, dite_eq_left ha] using + layeredCoefficientCharacter_of_site_factorization U root difference D + (frequency a) (b ⟨a, ha⟩) (hchar ⟨a, ha⟩) p hp hm x + · simp only [ite_eq_right ha] + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial +open scoped BigOperators Classical + +theorem exists_fixed_kernel_site_fourier_projection (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {K₀ : Type*} [Fintype K₀] + (root₀ : K₀ → ℤ) (difference₀ : Fin q → K₀ → ℤ) + (a : ℤ) (_ha : a ≠ 0) + (_hperiod : integerScalarLattice (Fin q) a ≤ (Matrix.of difference₀).mulVecLin.range) + {P : ℝ} (_hP : 0 ≤ P) (_hK : (Fintype.card K₀ : ℝ) ≤ P) + (_hsite : ∀ (s : Finset (Fin q)) k, + |((affineSite root₀ difference₀ s (some k) : ℤ) : ℝ)| ≤ Real.exp P), + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ {K : Type*} [Fintype K] (root : K → ℤ) (difference : Fin q → K → ℤ) (e : K₀ → K) + (_hroot : ∀ k, root (e k) = root₀ k) (_hdifference : ∀ i k, difference i (e k) = difference₀ i k) + {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (_hfrequency : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, + |(frequency a j d t : ℝ)| ≤ Real.exp P), + ∃ b : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ, + (∀ a j s t, |(b a j s t : ℝ)| ≤ Real.exp ((P + A) ^ A)) ∧ + ∀ {I : Type*} (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) (c : F → ℂ) (x : Option K → I → ℝ), + affineCubeFourierProjection U root difference frequency p c x = + retainedSiteFourierSum U root difference frequency b c + (affineCoveredSiteSample U root difference D p hm x) := by + obtain ⟨A, hA, hcover⟩ := exists_fixed_kernel_geometric_cover m q + refine ⟨A, hA, ?_⟩ + intro K₀ _ root₀ difference₀ a ha hperiod P hP hK hsite + obtain ⟨D, hD, hDP, hrows⟩ := hcover root₀ difference₀ a ha hperiod hP hK hsite + refine ⟨D, hD, hDP, ?_⟩ + intro K _ root difference e hroot hdifference J _ F _ U frequency hfrequency + choose b hb hchar using fun a : {a : F // affineCubeModeFactors U root difference (frequency a)} => + hrows root difference e hroot hdifference U (frequency a) (hfrequency a) a.property + let row : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ := fun a => + if ha : affineCubeModeFactors U root difference (frequency a) then b ⟨a, ha⟩ else fun _ => 0 + refine ⟨row, ?_, ?_⟩ + · intro a j s t + by_cases ha : affineCubeModeFactors U root difference (frequency a) + · simpa only [row, dite_eq_left ha] using hb ⟨a, ha⟩ j s t + · simp [row, ha, (Real.exp_pos _).le] + · intro I p hp hm c x + unfold affineCubeFourierProjection retainedSiteFourierSum + apply Finset.sum_congr rfl + intro a _ + by_cases ha : affineCubeModeFactors U root difference (frequency a) + · rw [ite_eq_left ha, ite_eq_left ha] + congr 1 + simpa only [row, dite_eq_left ha] using + layeredCoefficientCharacter_of_site_factorization U root difference D + (frequency a) (b ⟨a, ha⟩) (hchar ⟨a, ha⟩) p hp hm x + · simp only [ite_eq_right ha] + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial +open scoped BigOperators Matrix Classical + +noncomputable def sectionSiteFrequency {K : Type*} [Fintype K] {m q : ℕ} + {J : Fin m → Type*} + (T : ∀ j : Fin m, Matrix (BoundedCoefficientExponent K (j.val + 1)) (Finset (Fin q)) ℤ) + (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : ∀ j, Matrix (Finset (Fin q)) (J j) ℤ := + fun j => (T j).transpose * Matrix.of (fun e a => frequency j e.val a) + +theorem sectionSiteFrequency_bound {K : Type*} [Fintype K] {m q : ℕ} {J : Fin m → Type*} + (T : ∀ j : Fin m, Matrix (BoundedCoefficientExponent K (j.val + 1)) (Finset (Fin q)) ℤ) + (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + {B C : ℝ} (hC : 0 ≤ C) (hT : ∀ j s, (∑ e, |(T j e s : ℝ)|) ≤ B) + (hf : ∀ j e, e.degree ≤ j.val + 1 → ∀ a, |(frequency j e a : ℝ)| ≤ C) + (j : Fin m) (s : Finset (Fin q)) (a : J j) : + |(sectionSiteFrequency T frequency j s a : ℝ)| ≤ B * C := + integer_section_frequency_bound (T j) (Matrix.of (fun e a => frequency j e.val a)) + hC (hT j) (fun e a => hf j e.val e.property a) s a + +theorem section_retained_fourier_sum {I K F : Type*} [Fintype K] [Fintype F] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (root : K → ℤ) (difference : Fin q → K → ℤ) (d : ℕ) (hd : 0 < d) + (T : ∀ j : Fin m, Matrix (BoundedCoefficientExponent K (j.val + 1)) (Finset (Fin q)) ℤ) + (hT : ∀ j (x : BoundedCoefficientExponent K (j.val + 1) → U j), + let E := boundedSiteMatrix (j.val + 1) (fun s k => affineSite root difference s (some k)) + matrixModuleAction (fun s e => (E s e : ℝ)) + (matrixModuleAction (fun e s => (T j e s : ℝ)) + (matrixModuleAction (fun s e => (E s e : ℝ)) x)) = + (d : ℝ) • matrixModuleAction (fun s e => (E s e : ℝ)) x) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) + (hm : ∀ j e, coefficients (p j) e ∈ U j) (x : Option K → I → ℝ) : + affineCubeFourierProjection U root difference frequency p c x = + retainedSiteFourierSum U root difference frequency (fun a => sectionSiteFrequency T (frequency a)) c + (affineCoveredSiteSample U root difference d p hm x) := by + unfold affineCubeFourierProjection retainedSiteFourierSum + apply Finset.sum_congr rfl + intro a _ + by_cases ha : affineCubeModeFactors U root difference (frequency a) + · rw [ite_eq_left ha, ite_eq_left ha] + congr 1 + apply layeredCoefficientCharacter_of_site_factorization U root difference d (frequency a) + (sectionSiteFrequency T (frequency a)) _ p hp hm x + intro j v hv + obtain ⟨M, hM⟩ := affineCubeModeFactors_bounded U root difference (frequency a) ha j + exact integer_section_polynomial_character (U j) (j.val + 1) + (fun s k => affineSite root difference s (some k)) (T j) d hd (hT j) (frequency a j) M hM v hv + · simp only [ite_eq_right ha] + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SelectedDensityAmbientProductFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SelectedDensityAmbientProductFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7cd7c6c4b19c77ccf2fac8c9fedde3c13f0128b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SelectedDensityAmbientProductFourier.lean @@ -0,0 +1,280 @@ +import OAI.Combinatorics.Progressions.Fourier.AllocatedMaskedCoefficientFourier +import OAI.Combinatorics.Progressions.Probability.CanonicalCoverLaw + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +variable {K F G : Type*} [Fintype K] [Fintype F] [Fintype G] {m : ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +theorem coefficientTorusCharacter_frequency_add + (frequency₁ frequency₂ : ∀ j, (K →₀ ℕ) → J j → ℤ) + (x : CoefficientTorus (K := K) U) : + coefficientTorusCharacter U (frequency₁ + frequency₂) x = + coefficientTorusCharacter U frequency₁ x * coefficientTorusCharacter U frequency₂ x := by + obtain ⟨y, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + simp only [coefficientTorusCharacter_mk] + have hsum : coefficientArrayFunctional U (frequency₁ + frequency₂) y = + coefficientArrayFunctional U frequency₁ y + coefficientArrayFunctional U frequency₂ y := by + change (∑ s : CoefficientSlot K m, ∑ a, + ((frequency₁ s.1 s.2.val a + frequency₂ s.1 s.2.val a : ℤ) : ℝ) * (y s).val a) = + (∑ s : CoefficientSlot K m, ∑ a, (frequency₁ s.1 s.2.val a : ℝ) * (y s).val a) + + ∑ s : CoefficientSlot K m, ∑ a, (frequency₂ s.1 s.2.val a : ℝ) * (y s).val a + simp only [Int.cast_add, add_mul, Finset.sum_add_distrib] + rw [hsum, AddCircle.coe_add, CircleFourier.character_add] + +theorem coefficientTorusFourierSum_mul + (frequency₁ : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c₁ : F → ℂ) + (frequency₂ : G → ∀ j, (K →₀ ℕ) → J j → ℤ) (c₂ : G → ℂ) + (x : CoefficientTorus (K := K) U) : + coefficientTorusFourierSum U frequency₁ c₁ x * coefficientTorusFourierSum U frequency₂ c₂ x = + coefficientTorusFourierSum U (fun a : F × G => frequency₁ a.1 + frequency₂ a.2) + (fun a => c₁ a.1 * c₂ a.2) x := by + simp only [coefficientTorusFourierSum, Fintype.sum_prod_type, + coefficientTorusCharacter_frequency_add, Finset.sum_mul, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + ring + +theorem coefficientFourierProduct_mass (c₁ : F → ℂ) (c₂ : G → ℂ) : + (∑ a : F × G, ‖c₁ a.1 * c₂ a.2‖) = (∑ a, ‖c₁ a‖) * ∑ b, ‖c₂ b‖ := by + simp only [Fintype.sum_prod_type, norm_mul, Finset.sum_mul, Finset.mul_sum] + exact Finset.sum_comm + +theorem coefficientFourierProduct_mass_le (c₁ : F → ℂ) (c₂ : G → ℂ) + {C₁ C₂ : ℝ} (hc₁ : (∑ a, ‖c₁ a‖) ≤ C₁) (hc₂ : (∑ b, ‖c₂ b‖) ≤ C₂) : + (∑ a : F × G, ‖c₁ a.1 * c₂ a.2‖) ≤ C₁ * C₂ := by + rw [coefficientFourierProduct_mass] + exact mul_le_mul hc₁ hc₂ (Finset.sum_nonneg (fun _ _ => norm_nonneg _)) + ((Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hc₁) + +omit [Fintype K] [Fintype F] [Fintype G] [∀ j, Fintype (J j)] in +theorem coefficientFourierProduct_frequency_bound + (frequency₁ : F → ∀ j, (K →₀ ℕ) → J j → ℤ) + (frequency₂ : G → ∀ j, (K →₀ ℕ) → J j → ℤ) {M₁ M₂ : ℝ} + (h₁ : ∀ a j d, d.degree ≤ j.val + 1 → ∀ i, |(frequency₁ a j d i : ℝ)| ≤ M₁) + (h₂ : ∀ b j d, d.degree ≤ j.val + 1 → ∀ i, |(frequency₂ b j d i : ℝ)| ≤ M₂) : + ∀ a : F × G, ∀ j d, d.degree ≤ j.val + 1 → ∀ i, + |((frequency₁ a.1 + frequency₂ a.2) j d i : ℝ)| ≤ M₁ + M₂ := by + intro a j d hd i + simp only [Pi.add_apply, Int.cast_add] + exact (abs_add_le _ _).trans (add_le_add (h₁ a.1 j d hd i) (h₂ a.2 j d hd i)) + +theorem coefficientFourierProduct_approximation + (D : CoefficientTorus (K := K) U → ℝ) (f : CoefficientTorus (K := K) U → ℂ) + (frequencyD : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (cD : F → ℂ) + (frequencyF : G → ∀ j, (K →₀ ℕ) → J j → ℤ) (cF : G → ℂ) + {ηD ηf : ℝ} + (hD : ∀ x, ‖(D x : ℂ) - coefficientTorusFourierSum U frequencyD cD x‖ ≤ ηD) + (hf : ∀ x, ‖f x‖ ≤ 1) + (happrox : ∀ x, ‖f x - coefficientTorusFourierSum U frequencyF cF x‖ ≤ ηf) + (x : CoefficientTorus (K := K) U) : + ‖(D x : ℂ) * f x - + coefficientTorusFourierSum U (fun a : F × G => frequencyD a.1 + frequencyF a.2) + (fun a => cD a.1 * cF a.2) x‖ ≤ ηD + (∑ a, ‖cD a‖) * ηf := by + rw [← coefficientTorusFourierSum_mul] + let PD := coefficientTorusFourierSum U frequencyD cD x + let Pf := coefficientTorusFourierSum U frequencyF cF x + have heq : (D x : ℂ) * f x - PD * Pf = ((D x : ℂ) - PD) * f x + PD * (f x - Pf) := by ring + change ‖(D x : ℂ) * f x - PD * Pf‖ ≤ _ + rw [heq] + apply (norm_add_le _ _).trans + apply add_le_add + · rw [norm_mul] + exact ((mul_le_mul_of_nonneg_left (hf x) (norm_nonneg _)).trans_eq (mul_one _)).trans (hD x) + · rw [norm_mul] + exact mul_le_mul (coefficientTorusFourierSum_norm_le U frequencyD cD x) (happrox x) + (norm_nonneg _) (Finset.sum_nonneg (fun _ _ => norm_nonneg _)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + +theorem selectedLayerSamplerScale_input_bound (R σ : Fin m → ℝ) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (L₀ : ℕ) + {P : ℝ} (hP : 0 ≤ P) (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hn : ∀ j, (n j : ℝ) ≤ P) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hA : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) (hL₀ : (L₀ : ℝ) ≤ Real.exp P) : + ((selectedLayerSamplerScale (G := G) B U b R σ hR hσ L₀).value : ℝ) ≤ + Real.exp (selectedFourierInputBudget m P) := by + have hPT := le_selectedScaleDimensionBudget m hP + have he := Real.exp_le_exp.mpr hPT + apply selectedLayerSamplerScale_exp_bound B U b R σ hR hσ L₀ + (selectedScaleDimensionBudget_nonneg m hP) (degree_le_selectedScaleDimensionBudget m hP) + (fun j => (hn j).trans hPT) (fun j => (hRP j).trans he) (fun j => (hσP j).trans he) + _ (hA.trans he) (hL₀.trans he) + intro j + exact coefficientCount_le_selectedScaleDimensionBudget m (by omega) hP hK + +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (C V : Fin m → ℝ≥0) +variable (hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) +variable (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + +include hC hV in +theorem exists_selected_coefficient_uniform_fourier (R σ : Fin m → ℝ) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hσ1 : ∀ j, σ j ≤ 1) + (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1/4) + (L₀ : ℕ) {P δ : ℝ} (hP : 0 ≤ P) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (hn : ∀ j, (n j : ℝ) ≤ P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hL₀P : (L₀ : ℝ) ≤ Real.exp P) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (hδ : 0 < δ) (hδP : δ⁻¹ ≤ Real.exp P) : + let S := selectedLayerSamplerScale (G := G) B U b R σ hR hσ L₀ + let E := (P+selectedFourierExponent m)^selectedFourierExponent m + ∃ (F : Type) (inst : Fintype F), letI := inst + ∃ (frequency : F → ∀ j : Fin m, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) (a : F → ℂ), + (Fintype.card F : ℝ) ≤ Real.exp E ∧ + (∀ t j d, d.degree ≤ j.val+1 → ∀ i, |(frequency t j d i : ℝ)| ≤ Real.exp E) ∧ + (∑ t, ‖a t‖) ≤ Real.exp E ∧ + ∀ x, ‖(allocatedCoefficientDensity B U b hb o hR hσ S x : ℂ) - + coefficientTorusFourierSum U frequency a x‖ ≤ δ := by + let S := selectedLayerSamplerScale (G := G) B U b R σ hR hσ L₀ + have hT := selectedScaleDimensionBudget_nonneg m hP + have hTQ := le_allocatedScaleLog hT + have hQ := selectedFourierInputBudget_nonneg m hP + have hPQ := le_selectedFourierInputBudget m hP + have he := Real.exp_le_exp.mpr hPQ + have hcount (j : Fin m) : + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) ≤ + selectedFourierInputBudget m P := + (coefficientCount_le_selectedScaleDimensionBudget m (by omega) hP hK).trans hTQ + have hLP := selectedLayerSamplerScale_input_bound B U b R σ hR hσ L₀ hP hK hn hRP hσP hAP hL₀P + obtain ⟨F, inst, frequency, a, hcard, hfreq, hsum, herr⟩ := + exists_allocated_coefficient_uniform_fourier B U b hb o S C V hC hV + hR hσ hσ1 Cinv hCinv hchart hsmall hQ + ((degree_le_selectedScaleDimensionBudget m hP).trans hTQ) (hK.trans hPQ) + (fun j => (hRP j).trans he) (fun j => (hσP j).trans he) hcount + (fun j => (hI j).trans hPQ) (fun j => (hn j).trans hPQ) (fun j => (hJ j).trans hPQ) + (hAP.trans he) hLP (fun j => (hCP j).trans he) (fun j => (hVP j).trans he) hδ (hδP.trans he) + let _ := inst + have hd := allocatedFourierOutputBudget_dominates m hQ + have hout := selectedFourierOutputBudget_bound m hP + refine ⟨F, inst, frequency, a, ?_, ?_, ?_, herr⟩ + · exact hcard.trans (Real.exp_le_exp.mpr (hd.1.trans hout)) + · intro t j d hdg i + exact (hfreq t j d hdg i).trans (Real.exp_le_exp.mpr (hd.2.1.trans hout)) + · exact hsum.trans (Real.exp_le_exp.mpr (hd.2.2.trans hout)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (C V : Fin m → ℝ≥0) +variable (hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) +variable (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + +include hC hV in +theorem exists_selected_density_ambient_product_fourier (R σ : Fin m → ℝ) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hσ1 : ∀ j, σ j ≤ 1) + (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1/4) + (L₀ : ℕ) {P δ : ℝ} (hP : 0 ≤ P) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (hn : ∀ j, (n j : ℝ) ≤ P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hL₀P : (L₀ : ℝ) ≤ Real.exp P) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (hδ : 0 < δ) (hδP : δ⁻¹ ≤ Real.exp P) + (cover : ℕ) + (f : (CoefficientAmbientIndex (LayerSamplerVariables G I n B) J → UnitAddCircle) → ℂ) + (Lf : ℝ≥0) (hf : LipschitzWith Lf f) (hfb : ∀ x, ‖f x‖ ≤ 1) + {η Q : ℝ} (hη : 0 < η) (hQ : 0 ≤ Q) + (hdim : (Fintype.card (CoefficientAmbientIndex (LayerSamplerVariables G I n B) J) : ℝ) ≤ Q) + (hLf : (Lf : ℝ) ≤ Real.exp Q) (hηQ : η⁻¹ ≤ Real.exp Q) : + let S := selectedLayerSamplerScale (G := G) B U b R σ hR hσ L₀ + let ED := (P + selectedFourierExponent m) ^ selectedFourierExponent m + let EF := 2 * Q * (2 * Q + 2) ^ 4 + ∃ (T : Type) (inst : Fintype T), letI := inst + ∃ (frequency : T → ∀ j : Fin m, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) + (a : T → ℂ), + (Fintype.card T : ℝ) ≤ Real.exp ED * Real.exp EF ∧ + (∀ t j d, d.degree ≤ j.val + 1 → ∀ i, + |(frequency t j d i : ℝ)| ≤ cover * Real.exp ED + Real.exp ((2 * Q + 2) ^ 4)) ∧ + (∑ t, ‖a t‖) ≤ Real.exp ED * Real.exp EF ∧ + ∀ x, ‖(allocatedCoefficientDensity B U b hb o hR hσ S + (quotientIntegerCover (coefficientIntegerLattice U) cover x) : ℂ) * + f (coefficientAmbientTorus U x) - coefficientTorusFourierSum U frequency a x‖ ≤ + δ + Real.exp ED * η := by + dsimp only + obtain ⟨FD, instD, frequencyD, cD, hcardD, hfreqD, hmassD, happD⟩ := + exists_selected_coefficient_uniform_fourier B U b hb o C V hC hV R σ hR hσ hσ1 + Cinv hCinv hchart hsmall L₀ hP hK hRP hσP hI hn hJ hAP hL₀P hCP hVP hδ hδP + let _ := instD + obtain ⟨FF, instF, frequencyF, cF, hcardF, hfreqF, hmassF, happF⟩ := + exists_ambient_torus_fourier_approximation f Lf 1 hf hfb hη hQ hdim hLf hηQ + let _ := instF + let fD := fun a => dilateCoefficientFrequency cover (frequencyD a) + let fF := fun a => coefficientSlotFrequency (fun s i => frequencyF a ⟨s, i⟩) + refine ⟨FD × FF, inferInstance, fun a => fD a.1 + fF a.2, + fun a => cD a.1 * cF a.2, ?_, ?_, ?_, ?_⟩ + · simp only [Fintype.card_prod, Nat.cast_mul] + exact mul_le_mul hcardD hcardF (Nat.cast_nonneg _) (Real.exp_nonneg _) + · intro a j d hd i + change |((fD a.1 j d i + fF a.2 j d i : ℤ) : ℝ)| ≤ _ + rw [Int.cast_add] + exact (abs_add_le _ _).trans (add_le_add + (dilateCoefficientFrequency_bound cover (frequencyD a.1) (hfreqD a.1) j d hd i) + (coefficientSlotFrequency_bound _ (fun s i => hfreqF a.2 ⟨s, i⟩) j d hd i)) + · apply coefficientFourierProduct_mass_le cD cF hmassD + simpa only [NNReal.coe_one, mul_one] using hmassF + · intro x + have hD := coefficientCover_density_approximation U cover _ frequencyD cD happD + have hF (y : CoefficientTorus (K := LayerSamplerVariables G I n B) U) : ‖f (coefficientAmbientTorus U y) - coefficientTorusFourierSum U fF cF y‖ ≤ η := by + simpa only [coefficientAmbientTorus_character, coefficientTorusFourierSum, fF] using + happF (coefficientAmbientTorus U y) + exact (coefficientFourierProduct_approximation U _ (fun y => f (coefficientAmbientTorus U y)) + fD cD fF cF hD (fun y => hfb _) hF x).trans + (add_le_add le_rfl (mul_le_mul_of_nonneg_right hmassD hη.le)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SharedFreeFactorizationFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SharedFreeFactorizationFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7f4545361ffbd08bd7025ae3f10fe822494e8d0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SharedFreeFactorizationFrequency.lean @@ -0,0 +1,268 @@ +import OAI.Combinatorics.Progressions.Linear.RankTwoOrbitTree +import OAI.Combinatorics.Progressions.Linear.SharedFreeCommonProjection + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +theorem CoefficientBases.real_finite_refined_petal_vanish {J : Type*} [Fintype J] + (hfreq : V.frequency = B.freeFrequency D) (d : J → Fin s) + (a : FreeMagma J) (hd : lieTreeWeight (fun i => (d i).val + 1) a = s) (hr : a.length = r) + (v : J → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (hv : ∀ i, v i ∈ (fourRefinedRelation ((D.coefficientFreeSpan (d i)).baseChange ℝ) + ((D.dependentFreeSpan (d i)).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨(d i).val + 1, by omega⟩)).map (LinearMap.proj 0)) + (i : J) (hi : i ∈ lieTreeSupport a) + (hvi : v i ∈ fourPetalSpace ((D.dependentFreeSpan (d i)).baseChange ℝ) + (fourRefinedRelation ((D.coefficientFreeSpan (d i)).baseChange ℝ) + ((D.dependentFreeSpan (d i)).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨(d i).val + 1, by omega⟩))) : + realifyFunctional (B.freeFrequency D) (lieTreeEval v a) = 0 := by + classical + let e := Fintype.equivFin J + have hweight : lieTreeWeight (fun k => (d (e.symm k)).val + 1) (FreeMagma.map e a) = s := by + rw [lieTreeWeight_relabel] + simpa only [Function.comp_def, Equiv.symm_apply_apply] using hd + have hsupp : e i ∈ lieTreeSupport (FreeMagma.map e a) := by + rw [lieTreeSupport_relabel] + exact ⟨i, hi, rfl⟩ + have h := B.real_correlation_refined_petal_vanish D E T hbQ hT V g hg D' hfreq + (Fintype.card J) (fun k => d (e.symm k)) (FreeMagma.map e a) hweight + ((lieTreeLength_relabel e a).trans hr) (fun k => v (e.symm k)) + (fun k => hv (e.symm k)) (e i) hsupp + (by simpa only [Equiv.symm_apply_apply] using hvi) + simpa only [lieTreeEval_relabel, Function.comp_def, Equiv.symm_apply_apply] using h + +theorem CoefficientBases.real_refined_petal_add_invariant {J : Type*} + (hfreq : V.frequency = B.freeFrequency D) (d : J → Fin s) + (a : FreeMagma J) (hd : lieTreeWeight (fun i => (d i).val + 1) a = s) (hr : a.length = r) + (x y : J → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (hx : ∀ i, x i ∈ (fourRefinedRelation ((D.coefficientFreeSpan (d i)).baseChange ℝ) + ((D.dependentFreeSpan (d i)).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨(d i).val + 1, by omega⟩)).map (LinearMap.proj 0)) + (hy : ∀ i, y i ∈ fourPetalSpace ((D.dependentFreeSpan (d i)).baseChange ℝ) + (fourRefinedRelation ((D.coefficientFreeSpan (d i)).baseChange ℝ) + ((D.dependentFreeSpan (d i)).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨(d i).val + 1, by omega⟩))) : + realifyFunctional (B.freeFrequency D) (lieTreeEval (x + y) a) = + realifyFunctional (B.freeFrequency D) (lieTreeEval x a) := by + apply lieTree_eq_of_one_petal_vanish (realifyFunctional (B.freeFrequency D)) + (fun i => (fourRefinedRelation ((D.coefficientFreeSpan (d i)).baseChange ℝ) + ((D.dependentFreeSpan (d i)).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨(d i).val + 1, by omega⟩)).map (LinearMap.proj 0)) + (fun i => fourPetalSpace ((D.dependentFreeSpan (d i)).baseChange ℝ) + (fourRefinedRelation ((D.coefficientFreeSpan (d i)).baseChange ℝ) + ((D.dependentFreeSpan (d i)).baseChange ℝ) + (D'.realCoefficientFourSpace ⟨(d i).val + 1, by omega⟩))) + (fun i => fourPetalSpace_le_first _ _) a _ x y hx hy + intro v hv i hi + exact B.real_finite_refined_petal_vanish D E T hbQ hT V g hg D' hfreq + (fun k => d (lieTreeOccurrenceLabel a k)) (lieTreeOccurrenceTree a) + ((lieTreeOccurrenceTree_weight (fun k => (d k).val + 1) a).trans hd) + ((lieTreeOccurrenceTree_length a).trans hr) v hv i + (by rw [lieTreeOccurrenceTree_support]; trivial) hi + +theorem CoefficientBases.real_corrected_common_petal_invariant {J : Type*} + (hfreq : V.frequency = B.freeFrequency D) + (γ : Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (hγ : ∀ d, γ d ∈ ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + (d : J → Fin s) (a : FreeMagma J) + (hd : lieTreeWeight (fun i => (d i).val + 1) a = s) (hr : a.length = r) + (u p : J → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (hu : ∀ i, u i ∈ (D.dependentFreeSpan (d i)).baseChange ℝ) + (hp : ∀ i, p i ∈ (fourPetalSpace (D.dependentFreeSpan (d i)) + (fourRefinedRelation (D.coefficientFreeSpan (d i)) (D.dependentFreeSpan (d i)) + (D'.coefficientFourSpace ⟨(d i).val + 1, by omega⟩))).baseChange ℝ) : + realifyFunctional (B.freeFrequency D) (lieTreeEval (fun i => γ (d i) + u i + p i) a) = + realifyFunctional (B.freeFrequency D) (lieTreeEval (fun i => γ (d i) + u i) a) := by + have hspace (k : Fin s) := realification_fourRefinedRelation (D.coefficientFreeSpan k) + (D.dependentFreeSpan k) (D'.coefficientFourSpace ⟨k.val + 1, by omega⟩) + have hfirst (k : Fin s) := realification_firstProjection + (fourRefinedRelation (D.coefficientFreeSpan k) (D.dependentFreeSpan k) + (D'.coefficientFourSpace ⟨k.val + 1, by omega⟩)) + have hpetal (k : Fin s) := realification_fourPetalSpace (D.dependentFreeSpan k) + (fourRefinedRelation (D.coefficientFreeSpan k) (D.dependentFreeSpan k) + (D'.coefficientFourSpace ⟨k.val + 1, by omega⟩)) + simp_rw [hspace] at hfirst hpetal + apply B.real_refined_petal_add_invariant D E T hbQ hT V g hg D' hfreq d a hd hr + (fun i => γ (d i) + u i) p + · intro i + have h₁ := hγ (d i) + have h₂ := Submodule.baseChange_mono ℝ + (dependent_le_refined_firstProjection (D.coefficientFreeSpan (d i)) + (D.dependentFreeSpan (d i)) (D'.coefficientFourSpace ⟨(d i).val + 1, by omega⟩)) (hu i) + rw [hfirst] at h₁ h₂ + exact Submodule.add_mem _ h₁ h₂ + · intro i + have h := hp i + rw [hpetal] at h + exact h + +theorem CoefficientBases.exists_corrected_common_petal_invariance + (F : FreeCoordinateFrame E.basis Q) (hfreq : V.frequency = B.freeFrequency D) + (hs : 2 ≤ s) (hp' : 0 ≤ p') (hP' : 0 ≤ P') (hQP' : Q ≤ P') (hpp' : p' ≤ P') + (ξ : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (v : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hsplit : ∀ h, g h = ξ * v h) + (hξ : ∀ d : Fin s, VectorPolynomial.coefficients ξ.log (Finsupp.single () (d.val + 1)) ∈ + (D.commonFreeSpan d).baseChange ℝ) + (hv : ∀ h (d : Fin s), VectorPolynomial.coefficients (v h).log (Finsupp.single () (d.val + 1)) ∈ + (D.dependentFreeSpan d).baseChange ℝ) + (hN : Real.exp ((P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s) ≤ (N : ℝ)) : + let Λ := (P' + sharedFreeAffineConstant s) ^ sharedFreeAffineConstant s + ∃ (m : Fin s → ℕ) (γ e q : Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra), + (∀ d, 0 < m d ∧ (m d : ℝ) ≤ Real.exp Λ ∧ + γ d ∈ ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ ∧ + VectorPolynomial.coefficients ξ.log (Finsupp.single () (d.val + 1)) = γ d + e d + q d ∧ + ‖(E.basis.baseChange ℝ).equivFun (e d)‖ ≤ Real.exp Λ / (N : ℝ) ^ (d.val + 1) ∧ + (E.basis.baseChange ℝ).equivFun (q d) ∈ realDenominatorGrid (m d)) ∧ + ∀ (n : ℕ) (d : Fin n → Fin s) (a : FreeMagma (Fin n)), + lieTreeWeight (fun i => (d i).val + 1) a = s → a.length = r → + ∀ u p : Fin n → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra, + (∀ i, u i ∈ (D.dependentFreeSpan (d i)).baseChange ℝ) → + (∀ i, p i ∈ (fourPetalSpace (D.dependentFreeSpan (d i)) + (fourRefinedRelation (D.coefficientFreeSpan (d i)) (D.dependentFreeSpan (d i)) + (D'.coefficientFourSpace ⟨(d i).val + 1, by omega⟩))).baseChange ℝ) → + realifyFunctional (B.freeFrequency D) (lieTreeEval (fun i => γ (d i) + u i + p i) a) = + realifyFunctional (B.freeFrequency D) (lieTreeEval (fun i => γ (d i) + u i) a) := by + intro Λ + obtain ⟨m, γ, e, q, hcommon⟩ := D.exists_shared_free_common_projection E T hbQ hT F V g hg D' + hs hp' hP' hQP' hpp' ξ v hsplit hξ hv hN + refine ⟨m, γ, e, q, hcommon, ?_⟩ + intro n d a hd hr u p hu hp + exact B.real_corrected_common_petal_invariant D E T hbQ hT V g hg D' hfreq γ + (fun d => (hcommon d).2.2.1) d a hd hr u p hu hp + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module VectorPolynomial +open scoped TensorProduct BigOperators + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P Q : ℝ} {f : ZMod N → ℂ} + {W : NativeCorrelationStructure s r N b f} {out : Fin W.family.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W.family out H p q} (D : R.CommonData P) + (B : D.CoefficientBases Q) + (E : RationalFilteredNilmanifold D.CoefficientFreeLieAlgebra s + (finrank ℚ D.CoefficientFreeLieAlgebra)) + (T : E.DegreeRankStructure r) (hbQ : b ≤ Q) (hT : T.ComplexityLE Q) + [TopologicalSpace (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + [T2Space (ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra)] + (V : E.UnitVerticalObservable (T.realSubgroup s r) (Fin W.family.outputDim) Q) + (g : ZMod N → E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hg : ∀ h, E.filtration.realification.polynomialOrbitEval (fun _ : Unit => 1) 0 (g h) = 1) + +variable {out' : Fin W.family.outputDim} {H' : Finset (ZMod N)} {p' q' P' : ℝ} + {R' : NativeRankRelation (W.replacementFamily E T hbQ hT V g hg) out' H' p' q'} + (D' : R'.CommonData P') + +theorem CoefficientBases.real_corrected_orbit_petal_invariant {I : Type*} + (hs : 1 ≤ s) (hfreq : V.frequency = B.freeFrequency D) + (γ v : Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (hγ : ∀ d, γ d ∈ ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + (hv : ∀ d, v d ∈ (D.dependentFreeSpan d).baseChange ℝ) + (A K U : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (hA : ∀ d, coefficients A.log (Finsupp.single () (d.val + 1)) = γ d + v d) + (hK : ∀ d : Fin s, coefficients K.log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ) + (hU : ∀ d : Fin s, coefficients U.log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) + (d : I → Fin s) (a : FreeMagma I) + (hd : lieTreeWeight (fun i => (d i).val + 1) a = s) (hr : a.length = r) : + realifyFunctional (B.freeFrequency D) + (lieTreeEval (fun i => coefficients (A * K * U).log (Finsupp.single () ((d i).val + 1))) a) = + realifyFunctional (B.freeFrequency D) + (lieTreeEval (fun i => coefficients A.log (Finsupp.single () ((d i).val + 1))) a) := by + rw [T.top_tree_product_rank_two hs A K U hK d a hd hr] + simp_rw [hA] + exact B.real_corrected_common_petal_invariant D E T hbQ hT V g hg D' hfreq γ hγ d a hd hr + (fun i => v (d i)) (fun i => coefficients U.log (Finsupp.single () ((d i).val + 1))) + (fun i => hv (d i)) (fun i => hU (d i)) + +theorem CoefficientBases.real_affine_orbit_petal_invariant {I : Type*} {n : ℕ} + (hs : 1 ≤ s) (hfreq : V.frequency = B.freeFrequency D) + (Γ A K U : E.filtration.realification.PolynomialOrbit (fun _ : Unit => 1)) + (α : Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) + (β : Fin n → Fin s → ℝ ⊗[ℚ] D.CoefficientFreeLieAlgebra) (x : Fin n → ℤ) + (hΓ : ∀ d : Fin s, coefficients Γ.log (Finsupp.single () (d.val + 1)) ∈ + ((fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩)).map (LinearMap.proj 0)).baseChange ℝ) + (hα : ∀ d, α d ∈ (D.dependentFreeSpan d).baseChange ℝ) + (hβ : ∀ j d, β j d ∈ (D.dependentFreeSpan d).baseChange ℝ) + (hA : A.log = Γ.log + positiveUnivariate (fun d => α d + ∑ j, (x j : ℝ) • β j d)) + (hK : ∀ d : Fin s, coefficients K.log (Finsupp.single () (d.val + 1)) ∈ + (T.filtration.layer (d.val + 1) 2).baseChange ℝ) + (hU : ∀ d : Fin s, coefficients U.log (Finsupp.single () (d.val + 1)) ∈ + (fourPetalSpace (D.dependentFreeSpan d) + (fourRefinedRelation (D.coefficientFreeSpan d) (D.dependentFreeSpan d) + (D'.coefficientFourSpace ⟨d.val + 1, by omega⟩))).baseChange ℝ) + (d : I → Fin s) (a : FreeMagma I) + (hd : lieTreeWeight (fun i => (d i).val + 1) a = s) (hr : a.length = r) : + realifyFunctional (B.freeFrequency D) + (lieTreeEval (fun i => coefficients (A * K * U).log (Finsupp.single () ((d i).val + 1))) a) = + realifyFunctional (B.freeFrequency D) + (lieTreeEval (fun i => coefficients A.log (Finsupp.single () ((d i).val + 1))) a) := by + apply B.real_corrected_orbit_petal_invariant D E T hbQ hT V g hg D' hs hfreq + (fun j => coefficients Γ.log (Finsupp.single () (j.val + 1))) + (fun j => α j + ∑ k, (x k : ℝ) • β k j) hΓ _ A K U _ hK hU d a hd hr + · intro j + exact Submodule.add_mem _ (hα j) + (Submodule.sum_mem _ (fun k _ => Submodule.smul_mem _ _ (hβ k j))) + · intro j + rw [hA, map_add, Finsupp.add_apply, positiveUnivariate_coefficient] + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierHaarMean.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierHaarMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a7278282e70e6c62a3fa88f9ca84083049d4b1b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierHaarMean.lean @@ -0,0 +1,445 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteImageProducts +import OAI.Combinatorics.Progressions.Linear.IntegralCoefficientBasis + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem finiteTensorExpansion {D : Type*} [Fintype D] [DecidableEq D] + {A Z : D → Type*} [∀ d, Fintype (A d)] (c : ∀ d, A d → ℂ) + (ψ : ∀ d, A d → Z d → ℂ) (z : ∀ d, Z d) : + (∏ d, ∑ a, c d a * ψ d a (z d)) = + ∑ a : ∀ d, A d, (∏ d, c d (a d)) * (∏ d, ψ d (a d) (z d)) := by + simp only [← Finset.prod_mul_distrib] + exact Fintype.prod_sum (fun d a => c d a * ψ d a (z d)) + +theorem finiteTensorCoefficientMass {D : Type*} [Fintype D] [DecidableEq D] + {A : D → Type*} [∀ d, Fintype (A d)] (c : ∀ d, A d → ℂ) : + (∑ a : ∀ d, A d, ‖∏ d, c d (a d)‖) = ∏ d, ∑ a, ‖c d a‖ := by + simp only [norm_prod] + exact (Fintype.prod_sum (fun d a => ‖c d a‖)).symm + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical + +noncomputable def coefficientTorusFourierSum {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (x : CoefficientTorus (K := K) U) : ℂ := ∑ a, c a * coefficientTorusCharacter U (frequency a) x + +theorem coefficientTorusFourierSum_integrable {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (μ : Measure (CoefficientTorus (K := K) U)) [IsFiniteMeasure μ] : + Integrable (coefficientTorusFourierSum U frequency c) μ := by + apply integrable_finsetSum + intro a _ + exact (coefficientTorusCharacter_integrable U (frequency a) μ).const_mul (c a) + +theorem coefficientTorusFourierSum_integral {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + [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 μ] : + (∫ x, coefficientTorusFourierSum U frequency c x ∂μ) = + ∑ a, if affineCoefficientModeTrivial U (frequency a) then c a else 0 := by + change (∫ x, ∑ a, c a * coefficientTorusCharacter U (frequency a) x ∂μ) = _ + rw [integral_finsetSum _ (fun a _ => (coefficientTorusCharacter_integrable U (frequency a) μ).const_mul (c a))] + simp only [integral_const_mul, coefficientTorusCharacter_integral] + apply Finset.sum_congr rfl + intro a _ + split_ifs <;> simp + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +def dilateCoefficientFrequency {K : Type*} {m : ℕ} {J : Fin m → Type*} + (q : ℕ) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : ∀ j, (K →₀ ℕ) → J j → ℤ := + fun j d a => (q : ℤ) * frequency j d a + +theorem coefficientArrayFunctional_dilate {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (q : ℕ) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : + coefficientArrayFunctional U (dilateCoefficientFrequency q frequency) = + (q : ℝ) • coefficientArrayFunctional U frequency := by + apply LinearMap.ext + intro x + change (∑ s : CoefficientSlot K m, ∑ a, + (dilateCoefficientFrequency q frequency s.1 s.2.val a : ℝ) * (x s).val a) = + (q : ℝ) * (∑ s : CoefficientSlot K m, ∑ a, (frequency s.1 s.2.val a : ℝ) * (x s).val a) + simp only [dilateCoefficientFrequency, Int.cast_mul, Int.cast_natCast, Finset.mul_sum, mul_assoc] + +theorem affineCoefficientModeTrivial_dilate_iff {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (q : ℕ) (hq : 0 < q) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : + affineCoefficientModeTrivial U (dilateCoefficientFrequency q frequency) ↔ + affineCoefficientModeTrivial U frequency := by + have hq0 : (q : ℝ) ≠ 0 := by exact_mod_cast hq.ne' + rw [← coefficientArrayFunctional_eq_zero_iff_trivial U (dilateCoefficientFrequency q frequency), + ← coefficientArrayFunctional_eq_zero_iff_trivial U frequency, coefficientArrayFunctional_dilate] + simp only [smul_eq_zero, hq0, false_or] + +theorem coefficientTorusCharacter_cover {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (q : ℕ) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) (x : CoefficientTorus (K := K) U) : + coefficientTorusCharacter U frequency (quotientIntegerCover (coefficientIntegerLattice U) q x) = + coefficientTorusCharacter U (dilateCoefficientFrequency q frequency) x := by + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + rw [quotientIntegerCover_mk, coefficientTorusCharacter_mk, coefficientTorusCharacter_mk, + coefficientArrayFunctional_dilate] + simp only [map_smul, LinearMap.smul_apply] + +theorem dilateCoefficientFrequency_bound {K : Type*} {m : ℕ} {J : Fin m → Type*} + (q : ℕ) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) {C : ℝ} + (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) : + ∀ j d, d.degree ≤ j.val + 1 → ∀ a, + |(dilateCoefficientFrequency q frequency j d a : ℝ)| ≤ (q : ℝ) * C := by + intro j d hd a + simp only [dilateCoefficientFrequency, Int.cast_mul, Int.cast_natCast, abs_mul, + abs_of_nonneg (show (0 : ℝ) ≤ q from Nat.cast_nonneg q)] + exact mul_le_mul_of_nonneg_left (hbound j d hd a) (Nat.cast_nonneg q) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +variable {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +theorem coefficientTorusCharacter_norm (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (x : CoefficientTorus (K := K) U) : ‖coefficientTorusCharacter U frequency x‖ = 1 := + quotientLinearCharacter_norm _ _ _ _ + +theorem coefficientTorusFourierSum_norm_le + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (x : CoefficientTorus (K := K) U) : + ‖coefficientTorusFourierSum U frequency c x‖ ≤ ∑ a, ‖c a‖ := by + unfold coefficientTorusFourierSum + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro a _ + simp only [norm_mul, coefficientTorusCharacter_norm, mul_one, le_refl] + +theorem coefficientDensity_cap_of_fourier + (D : CoefficientTorus (K := K) U → ℝ) + (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + {ε M : ℝ} (hc : (∑ a, ‖c a‖) ≤ M) + (herr : ∀ x, ‖(D x : ℂ) - coefficientTorusFourierSum U frequency c x‖ ≤ ε) + (x : CoefficientTorus (K := K) U) : D x ≤ ε + M := by + have hnorm := norm_le_norm_sub_add (D x : ℂ) (coefficientTorusFourierSum U frequency c x) + have hsum := (coefficientTorusFourierSum_norm_le U frequency c x).trans hc + have hreal : D x ≤ ‖(D x : ℂ)‖ := by + simpa only [Complex.norm_real, Real.norm_eq_abs] using le_abs_self (D x) + linarith [herr x] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical + +variable {K Y : Type*} [Fintype K] [Fintype Y] {m : ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (law : FiniteProbabilityWeights Y) +variable {F : Y → Type*} [∀ y, Fintype (F y)] +variable (frequency : ∀ y, F y → ∀ j, (K →₀ ℕ) → J j → ℤ) +variable (coeff : ∀ y, F y → ℂ) + +theorem coefficientTorusFourierSum_mixture (z : CoefficientTorus (K := K) U) : + coefficientTorusFourierSum U (fun a : Σ y, F y => frequency a.1 a.2) + (fun a : Σ y, F y => (law.weight a.1 : ℂ) * coeff a.1 a.2) z = + law.complexMean (fun y => coefficientTorusFourierSum U (frequency y) (coeff y) z) := by + simp only [coefficientTorusFourierSum, Fintype.sum_sigma, + FiniteProbabilityWeights.complexMean, Finset.mul_sum, mul_assoc] + +omit [Fintype K] [∀ j, Fintype (J j)] in +theorem coefficientFourierMixture_mass_le {C : ℝ} + (hcoeff : ∀ y, (∑ a, ‖coeff y a‖) ≤ C) : + (∑ a : Σ y, F y, ‖(law.weight a.1 : ℂ) * coeff a.1 a.2‖) ≤ C := by + simp only [Fintype.sum_sigma, norm_mul, Complex.norm_real, + Real.norm_of_nonneg (law.nonneg _), ← Finset.mul_sum] + exact (law.mean_mono hcoeff).trans_eq (law.mean_const C) + +theorem coefficientFourierMixture_uniform_error + (g : Y → CoefficientTorus (K := K) U → ℝ) {δ : ℝ} + (happrox : ∀ y z, ‖(g y z : ℂ) - coefficientTorusFourierSum U (frequency y) (coeff y) z‖ ≤ δ) + (z : CoefficientTorus (K := K) U) : + ‖(law.mean (fun y => g y z) : ℂ) - + coefficientTorusFourierSum U (fun a : Σ y, F y => frequency a.1 a.2) + (fun a : Σ y, F y => (law.weight a.1 : ℂ) * coeff a.1 a.2) z‖ ≤ δ := by + rw [coefficientTorusFourierSum_mixture, ← law.complexMean_ofReal] + exact (law.norm_complexMean_sub_le _ _ (fun _ => δ) (fun y _ => happrox y z)).trans_eq + (law.mean_const δ) + +theorem exists_coefficientFourierMixture + (g : Y → CoefficientTorus (K := K) U → ℝ) {C L δ : ℝ} + (h : ∀ y, ∃ (F : Type) (inst : Fintype F), let _ := inst + ∃ (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (coeff : F → ℂ), + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ L) ∧ + (∑ a, ‖coeff a‖) ≤ C ∧ + ∀ z, ‖(g y z : ℂ) - coefficientTorusFourierSum U frequency coeff z‖ ≤ δ) : + ∃ (F : Type) (inst : Fintype F), let _ := inst + ∃ (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (coeff : F → ℂ), + (∀ a j e, e.degree ≤ j.val + 1 → ∀ t, |(frequency a j e t : ℝ)| ≤ L) ∧ + (∑ a, ‖coeff a‖) ≤ C ∧ + ∀ z, ‖(law.mean (fun y => g y z) : ℂ) - coefficientTorusFourierSum U frequency coeff z‖ ≤ δ := by + choose F inst frequency coeff hfreq hcoeff happ using h + let _ := inst + let e := (Fintype.equivFin (Σ y, F y)).symm + let mixfreq := fun a : Σ y, F y => frequency a.1 a.2 + let mixcoeff := fun a : Σ y, F y => (law.weight a.1 : ℂ) * coeff a.1 a.2 + refine ⟨Fin (Fintype.card (Σ y, F y)), inferInstance, mixfreq ∘ e, mixcoeff ∘ e, ?_, ?_, ?_⟩ + · intro a j k hk t + exact hfreq (e a).1 (e a).2 j k hk t + · calc + _ = ∑ a : Σ y, F y, ‖mixcoeff a‖ := e.sum_comp (fun a => ‖mixcoeff a‖) + _ ≤ C := coefficientFourierMixture_mass_le law coeff hcoeff + · intro z + have heq : coefficientTorusFourierSum U (mixfreq ∘ e) (mixcoeff ∘ e) z = + coefficientTorusFourierSum U mixfreq mixcoeff z := + e.sum_comp (fun a => mixcoeff a * coefficientTorusCharacter U (mixfreq a) z) + rw [heq] + exact coefficientFourierMixture_uniform_error U law frequency coeff g happ z + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +noncomputable def coefficientSlotFrequency {K : Type*} {m : ℕ} {J : Fin m → Type*} + (frequency : ∀ s : CoefficientSlot K m, J s.1 → ℤ) : + ∀ j, (K →₀ ℕ) → J j → ℤ := fun j d a => + if h : d.degree ≤ j.val + 1 then frequency ⟨j, ⟨d, h⟩⟩ a else 0 + +theorem coefficientSlotFrequency_apply {K : Type*} {m : ℕ} {J : Fin m → Type*} + (frequency : ∀ s : CoefficientSlot K m, J s.1 → ℤ) + (s : CoefficientSlot K m) (a : J s.1) : + coefficientSlotFrequency frequency s.1 s.2.val a = frequency s a := by + simp only [coefficientSlotFrequency, dite_eq_left s.2.property] + +theorem coefficientSlotFrequency_bound {K : Type*} {m : ℕ} {J : Fin m → Type*} + (frequency : ∀ s : CoefficientSlot K m, J s.1 → ℤ) {C : ℝ} + (hfrequency : ∀ s a, |(frequency s a : ℝ)| ≤ C) : + ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(coefficientSlotFrequency frequency j d a : ℝ)| ≤ C := by + intro j d hd a + simpa only [coefficientSlotFrequency, dite_eq_left hd] using hfrequency ⟨j, ⟨d, hd⟩⟩ a + +theorem coefficientTorusCharacter_slot_product {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (frequency : ∀ s : CoefficientSlot K m, J s.1 → ℤ) (x : CoefficientTorus (K := K) U) : + coefficientTorusCharacter U (coefficientSlotFrequency frequency) x = + ∏ s : CoefficientSlot K m, subspaceArrayCharacter (U s.1) (fun _ a => frequency s a) + (coefficientCoordinateTorus U x s) := by + obtain ⟨y, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + rw [coefficientTorusCharacter_mk] + change CircleFourier.character ((∑ s : CoefficientSlot K m, ∑ a, + (coefficientSlotFrequency frequency s.1 s.2.val a : ℝ) * (y s).val a : ℝ) : + CircleFourier.Circle) = _ + simp only [coefficientSlotFrequency_apply] + rw [character_real_sum] + apply Finset.prod_congr rfl + intro s _ + rw [coefficientCoordinateTorus_mk] + change _ = CircleFourier.character + ((∑ _u : Unit, ∑ a, (frequency s a : ℝ) * (y s).val a : ℝ) : CircleFourier.Circle) + simp only [Fintype.sum_unique] + +theorem coefficientTensorFourier_eq {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + {F : CoefficientSlot K m → Type*} [∀ s, Fintype (F s)] + (frequency : ∀ s : CoefficientSlot K m, F s → J s.1 → ℤ) (c : ∀ s, F s → ℂ) + (x : CoefficientTorus (K := K) U) : + (∏ s : CoefficientSlot K m, ∑ a, c s a * + subspaceArrayCharacter (U s.1) (fun _ t => frequency s a t) (coefficientCoordinateTorus U x s)) = + coefficientTorusFourierSum U (fun a : ∀ s, F s => coefficientSlotFrequency (fun s => frequency s (a s))) + (fun a => ∏ s, c s (a s)) x := by + rw [finiteTensorExpansion c (fun s a y => subspaceArrayCharacter (U s.1) (fun _ t => frequency s a t) y)] + simp only [coefficientTorusFourierSum, coefficientTorusCharacter_slot_product] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical Matrix + +def sitePullbackFrequency {K S : Type*} [Fintype S] {m : ℕ} {J : Fin m → Type*} + (site : S → K → ℤ) (b : ∀ j, Matrix S (J j) ℤ) : + ∀ j, (K →₀ ℕ) → J j → ℤ := + fun j d a => ∑ s, d.prod (fun k n => site s k ^ n) * b j s a + +theorem sitePullbackFrequency_matrix {K S : Type*} [Fintype S] {m : ℕ} + {J : Fin m → Type*} (site : S → K → ℤ) (b : ∀ j, Matrix S (J j) ℤ) (j : Fin m) : + (fun (d : BoundedCoefficientExponent K (j.val + 1)) a => (sitePullbackFrequency site b j d.val a : ℝ)) = + (Matrix.of (fun s d => (boundedSiteMatrix (j.val + 1) site s d : ℝ)))ᵀ * + Matrix.of (fun s a => (b j s a : ℝ)) := by + funext d a + simp only [sitePullbackFrequency, Matrix.mul_apply, Matrix.transpose_apply, + Matrix.of_apply, boundedSiteMatrix, Int.cast_sum, Int.cast_mul] + +theorem coefficientArrayFunctional_sitePullback {K S : Type*} [Fintype K] [Fintype S] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (site : S → K → ℤ) + (b : ∀ j, Matrix S (J j) ℤ) (x : CoefficientArray (K := K) U) : + coefficientArrayFunctional U (sitePullbackFrequency site b) x = + ∑ j, subspaceArrayFunctional (U j) (fun s a => (b j s a : ℝ)) + (matrixModuleAction (fun s d => (boundedSiteMatrix (j.val + 1) site s d : ℝ)) + (coefficientLayerArray U j x)) := by + change (∑ s : CoefficientSlot K m, ∑ a, (sitePullbackFrequency site b s.1 s.2.val a : ℝ) * + (x s).val a) = _ + rw [show (∑ s : CoefficientSlot K m, ∑ a, (sitePullbackFrequency site b s.1 s.2.val a : ℝ) * + (x s).val a) = ∑ j, ∑ d : BoundedCoefficientExponent K (j.val + 1), ∑ a, + (sitePullbackFrequency site b j d.val a : ℝ) * (x ⟨j, d⟩).val a from Fintype.sum_sigma _] + apply Finset.sum_congr rfl + intro j _ + change subspaceArrayFunctional (U j) (fun d a => (sitePullbackFrequency site b j d.val a : ℝ)) + (coefficientLayerArray U j x) = _ + exact (congrArg (fun f => subspaceArrayFunctional (U j) f (coefficientLayerArray U j x)) + (sitePullbackFrequency_matrix site b j)).trans + (subspaceArrayFunctional_matrix (U j) + (Matrix.of (fun s d => (boundedSiteMatrix (j.val + 1) site s d : ℝ))) + (Matrix.of (fun s a => (b j s a : ℝ))) (coefficientLayerArray U j x)).symm + +theorem coefficientTorusCharacter_sitePullback {K S : Type*} [Fintype K] [Fintype S] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (site : S → K → ℤ) + (b : ∀ j, Matrix S (J j) ℤ) (x : CoefficientTorus (K := K) U) : + coefficientTorusCharacter U (sitePullbackFrequency site b) x = + ∏ j, subspaceArrayCharacter (U j) (b j) (coefficientSiteTorusMap U site x j) := by + obtain ⟨y, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + rw [coefficientTorusCharacter_mk, coefficientArrayFunctional_sitePullback, character_real_sum] + apply Finset.prod_congr rfl + intro j _ + rw [coefficientSiteTorusMap_mk, subspaceArrayCharacter_mk] + +noncomputable def siteTorusFourierSum {S F : Type*} [Fintype S] [Fintype F] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (b : F → ∀ j, Matrix S (J j) ℤ) (c : F → ℂ) + (x : SiteTorus S U) : ℂ := ∑ a, c a * ∏ j, subspaceArrayCharacter (U j) (b a j) (x j) + +theorem siteTorusFourierSum_pullback {K S F : Type*} [Fintype K] [Fintype S] [Fintype F] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (site : S → K → ℤ) + (b : F → ∀ j, Matrix S (J j) ℤ) (c : F → ℂ) (x : CoefficientTorus (K := K) U) : + siteTorusFourierSum U b c (coefficientSiteTorusMap U site x) = + coefficientTorusFourierSum U (fun a => sitePullbackFrequency site (b a)) c x := by + simp only [siteTorusFourierSum, coefficientTorusFourierSum, coefficientTorusCharacter_sitePullback] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical + +theorem coefficientTorusFourierSum_cover {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (q : ℕ) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (x : CoefficientTorus (K := K) U) : + coefficientTorusFourierSum U frequency c (quotientIntegerCover (coefficientIntegerLattice U) q x) = + coefficientTorusFourierSum U (fun a => dilateCoefficientFrequency q (frequency a)) c x := by + simp only [coefficientTorusFourierSum, coefficientTorusCharacter_cover] + +theorem coefficientTorusFourierSum_cover_integral {K F : Type*} [Fintype K] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + (q : ℕ) (hq : 0 < q) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) + (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] : + (∫ x, coefficientTorusFourierSum U frequency c + (quotientIntegerCover (coefficientIntegerLattice U) q x) ∂μ) = + ∫ x, coefficientTorusFourierSum U frequency c x ∂μ := by + simp_rw [coefficientTorusFourierSum_cover] + rw [coefficientTorusFourierSum_integral, coefficientTorusFourierSum_integral] + simp only [affineCoefficientModeTrivial_dilate_iff U q hq] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical + +theorem siteTorusFourierSum_pullback_integrable {K S F : Type*} + [Fintype K] [Fintype S] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (site : S → K → ℤ) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + (b : F → ∀ j, Matrix S (J j) ℤ) (c : F → ℂ) + (μ : Measure (CoefficientTorus (K := K) U)) [IsFiniteMeasure μ] : + Integrable (fun x => siteTorusFourierSum U b c (coefficientSiteTorusMap U site x)) μ := by + have he : (fun x => siteTorusFourierSum U b c (coefficientSiteTorusMap U site x)) = + coefficientTorusFourierSum U (fun a => sitePullbackFrequency site (b a)) c := + funext (siteTorusFourierSum_pullback U site b c) + rw [he] + exact coefficientTorusFourierSum_integrable U _ c μ + +theorem siteTorusFourierSum_haar_mean {K S F : Type*} + [Fintype K] [Fintype S] [Fintype F] {m : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (site : S → K → ℤ) + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + (b : F → ∀ j, Matrix S (J j) ℤ) (c : F → ℂ) + (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] : + (∫ x, siteTorusFourierSum U b c (coefficientSiteTorusMap U site x) ∂μ) = + ∑ a, if affineCoefficientModeTrivial U (sitePullbackFrequency site (b a)) then c a else 0 := by + have he : (fun x => siteTorusFourierSum U b c (coefficientSiteTorusMap U site x)) = + coefficientTorusFourierSum U (fun a => sitePullbackFrequency site (b a)) c := + funext (siteTorusFourierSum_pullback U site b c) + rw [he] + exact coefficientTorusFourierSum_integral U _ c μ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierPullbackBound.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierPullbackBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..645f825ad0c370fa4d0c9a5b3ee992048c7087a3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierPullbackBound.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Fourier.SiteFourierHaarMean +import OAI.Combinatorics.Progressions.Geometry.GeometricRetainedCommonCover + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +theorem sitePullbackFrequency_bound {K S : Type*} [Fintype S] {m : ℕ} + {J : Fin m → Type*} (site : S → K → ℤ) (b : ∀ j, Matrix S (J j) ℤ) + {P B : ℝ} (hP : 0 ≤ P) + (hsite : ∀ s k, |(site s k : ℝ)| ≤ Real.exp P) + (hb : ∀ j s a, |(b j s a : ℝ)| ≤ B) + (j : Fin m) (d : K →₀ ℕ) (hd : d.degree ≤ j.val + 1) (a : J j) : + |(sitePullbackFrequency site b j d a : ℝ)| ≤ + (Fintype.card S : ℝ) * Real.exp ((m : ℝ) * (P + 1)) * B := by + have he (s : S) : |((d.prod (fun k n => site s k ^ n) : ℤ) : ℝ)| ≤ + Real.exp ((m : ℝ) * (P + 1)) := by + have hh := (boundedSiteMatrix_height_of_exp m (Nat.succ_le_of_lt j.isLt) + site hsite s ⟨d, hd⟩).abs_real_le + have hh' : |((d.prod (fun k n => site s k ^ n) : ℤ) : ℝ)| ≤ + (exponentialSiteHeight m P : ℝ) := by + simpa only [boundedSiteMatrix, Rat.cast_intCast] using hh + exact hh'.trans (exponentialSiteHeight_le m hP) + simp only [sitePullbackFrequency, Int.cast_sum, Int.cast_mul] + calc + _ ≤ ∑ s, |((d.prod (fun k n => site s k ^ n) : ℤ) : ℝ) * (b j s a : ℝ)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _s : S, Real.exp ((m : ℝ) * (P + 1)) * B := by + apply Finset.sum_le_sum + intro s _ + rw [abs_mul] + exact mul_le_mul (he s) (hb j s a) (abs_nonneg _) (Real.exp_pos _).le + _ = _ := by simp; ring + +theorem sitePullbackFrequency_exp_bound {K S : Type*} [Fintype S] {m : ℕ} + {J : Fin m → Type*} (site : S → K → ℤ) (b : ∀ j, Matrix S (J j) ℤ) + {P : ℝ} (hP : 0 ≤ P) (hS : (Fintype.card S : ℝ) ≤ Real.exp P) + (hsite : ∀ s k, |(site s k : ℝ)| ≤ Real.exp P) + (hb : ∀ j s a, |(b j s a : ℝ)| ≤ Real.exp P) + (j : Fin m) (d : K →₀ ℕ) (hd : d.degree ≤ j.val + 1) (a : J j) : + |(sitePullbackFrequency site b j d a : ℝ)| ≤ Real.exp (((m : ℝ) + 2) * (P + 1)) := by + apply (sitePullbackFrequency_bound site b hP hsite hb j d hd a).trans + calc + _ ≤ Real.exp P * Real.exp ((m : ℝ) * (P + 1)) * Real.exp P := by gcongr + _ = Real.exp (2 * P + (m : ℝ) * (P + 1)) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierRegularity.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..676e7e99b6f6994715d823a9c89dcb5e3e3bbeb7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SiteFourierRegularity.lean @@ -0,0 +1,46 @@ +import OAI.Combinatorics.Progressions.Fourier.SiteFourierHaarMean + +namespace OAI + +section + +namespace Erdos3 + +theorem subspaceArrayCharacter_continuous {I J : Type*} [Fintype I] [Fintype J] + (U : Submodule ℝ (J → ℝ)) (b : Matrix I J ℤ) : + Continuous (subspaceArrayCharacter U b) := + quotientLinearCharacter_continuous _ _ _ + (subspaceArrayFunctional U (fun i a => (b i a : ℝ))).continuous_of_finiteDimensional + +namespace VectorPolynomial + +open scoped BigOperators + +theorem siteTorusFourierSum_continuous {S F : Type*} [Fintype S] [Fintype F] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (b : F → ∀ j, Matrix S (J j) ℤ) (c : F → ℂ) : + Continuous (siteTorusFourierSum U b c) := by + unfold siteTorusFourierSum + apply continuous_finsetSum + intro a _ + apply continuous_const.mul + apply continuous_finsetProd + intro j _ + exact (subspaceArrayCharacter_continuous (U j) (b a j)).comp (continuous_apply j) + +theorem siteTorusFourierSum_norm_le {S F : Type*} [Fintype S] [Fintype F] + {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (b : F → ∀ j, Matrix S (J j) ℤ) (c : F → ℂ) + (x : SiteTorus S U) : ‖siteTorusFourierSum U b c x‖ ≤ ∑ a, ‖c a‖ := by + unfold siteTorusFourierSum + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro a _ + simp [norm_prod, subspaceArrayCharacter_norm] + +end VectorPolynomial +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SmoothModerateFourierAxis.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SmoothModerateFourierAxis.lean new file mode 100644 index 0000000000000000000000000000000000000000..acf00847db52fd92baad197257d85b68fbf531e8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SmoothModerateFourierAxis.lean @@ -0,0 +1,130 @@ +import OAI.Combinatorics.Progressions.Estimates.SmoothModerateBlockBounds +import OAI.Combinatorics.Progressions.Fourier.FourierLawTransport + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +noncomputable def moderateNormalizationThreshold (q M : ℕ) (B T : ℝ≥0) : ℕ := + max (scalarCubeNormalizationThreshold Empty M B T) (scalarCubeNormalizationThreshold (Fin q) M B T) + +theorem moderateNormalizationThreshold_mul (q : ℕ) {M : ℕ} (hM : 0 < M) (B T : ℝ≥0) : + moderateNormalizationThreshold q M B T ≤ M * moderateNormalizationThreshold q 1 B T := by + unfold moderateNormalizationThreshold + exact max_le + ((scalarCubeNormalizationThreshold_mul Empty hM B T).trans (Nat.mul_le_mul_left M (le_max_left _ _))) + ((scalarCubeNormalizationThreshold_mul (Fin q) hM B T).trans (Nat.mul_le_mul_left M (le_max_right _ _))) + +theorem moderateNormalizationThreshold_power_budget (q : ℕ) {M : ℕ} (hM : 0 < M) + (B T : ℝ≥0) (p : ℕ) {E : ℝ} (hE : 0 ≤ E) : + ⌈E * (moderateNormalizationThreshold q M B T : ℝ) ^ p⌉₊ ≤ + ⌈(E * (moderateNormalizationThreshold q 1 B T : ℝ) ^ p) * (M : ℝ) ^ p⌉₊ := by + apply Nat.ceil_mono + have hp : (moderateNormalizationThreshold q M B T : ℝ) ^ p ≤ + ((M * moderateNormalizationThreshold q 1 B T : ℕ) : ℝ) ^ p := by + exact_mod_cast Nat.pow_le_pow_left (moderateNormalizationThreshold_mul q hM B T) p + apply (mul_le_mul_of_nonneg_left hp hE).trans_eq + push_cast + ring + +noncomputable def smoothModerateFourierAxis {b n q M K : ℕ} [NeZero b] [NeZero K] {B T : ℝ≥0} + (c : Fin b → SmoothCoefficientSlice M B T) (s : Fin b → Fin n → SmoothCubeSlice q M B T) + (hcmass : ∀ a, 0 < ∑ x, (c a).sliceWeight x) (hmass : ∀ a j, 0 < ∑ x, (s a j).sliceWeight x) + (hB : 0 < B) (offset : Fin b → ℤ) (stride : Fin b → ℕ) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (V : ℕ) (hV : 1 ≤ V) + (ht : ∀ a, 0 < stride a) (htV : ∀ a, stride a ≤ V) + {O F D E : ℝ} (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) + (hroot : ∀ a j, |((s a j).root : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (|(offset a : ℝ)| + (stride a : ℝ) * (c a).length) * + (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ((c a).length * ∏ j, ((s a j).length : ℝ))) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (hcpower : ∀ a, (K : ℝ) ≤ E * ((c a).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n) + (hblocks : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : IntegerFourierAxis := by + let U := affinePrimitiveEnvelope (Fin q) A (2 * B) (2 * T) M V + let Q := affineTorusRadius (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) F + let H := moderateNormalizationThreshold q M B T + let Kmax := ⌈E * (H : ℝ) ^ p⌉₊ + let Ccount := uniformSpectrumSizeConstant n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) + let Ccap := uniformSpectrumAbsoluteCap n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) + let exponent := max (majorArcSpectrumExponent n J.card) (majorArcLengthExponent n * (p * J.card)) + let ζ := fun ε => uniformBlockRetainedBias n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ε + let denom := fun ε => uniformCharacterDenominatorBound n J.card (p * J.card) + U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) (ζ ε) + let residual := fun ε => 2 * majorArcCoverConstant n J.card U ((R : ℝ) * D) / + (ζ ε) ^ majorArcCoverExponent n J.card + refine largeScaleFourierAxis (smoothModerateBlockSource c s hcmass hmass) + (smoothModerateBlockSum c s offset stride J) K Q Kmax Ccount Ccap exponent denom residual + (fun center x _ Z => by + simpa only [Q, Fintype.card_fin] using + smoothModerateBlockSum_support c s offset stride hO hroot hupper J hJ center x Z) ?_ + intro hK ε hε hε1 + have hlong (L : ℕ) (hp : (K : ℝ) ≤ E * (L : ℝ) ^ p) : H ≤ L := by + by_contra! hL + exact (Nat.not_le_of_lt hK) (short_side_scale_bound hE hL.le hp) + have hclong (a : Fin b) : scalarCubeNormalizationThreshold Empty M B T ≤ (c a).length := + (le_max_left _ _).trans (hlong (c a).length (hcpower a)) + have hslong (a : Fin b) (j : Fin n) : scalarCubeNormalizationThreshold (Fin q) M B T ≤ (s a j).length := + (le_max_right _ _).trans (hlong (s a j).length (hpower a j)) + have he := moderateSlice_geometric_approximation + (fun a => (c a).normalized hB (hclong a)) (fun a j => (s a j).normalized hB (hslong a j)) + offset stride (fun a j => (s a j).root) A (2 * B) (2 * T) hA M V hV + (fun _ => le_rfl) (fun _ => le_rfl) (fun _ => le_rfl) + (fun _ _ => le_rfl) (fun _ _ => le_rfl) (fun _ _ => le_rfl) ht htV + hO hD hE hε hε1 hroot hupper hlower p hpower hcpower J hJ hblocks + dsimp only at he + rw [smoothModerateBlockSource_normalized c s hcmass hmass hB hclong hslong, + smoothModerateBlockSum_normalized c s hB hclong hslong] at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS, ?_, ?_, ?_⟩ + · intro center + apply le_trans ?_ (hcap center) + apply le_of_eq + apply Finset.sum_congr + · apply congrArg (fun f : Fintype (J → Fin ((2 * Q + 1) * K)) => @Finset.univ _ f) + exact Subsingleton.elim _ _ + · intro k _ + rfl + · intro k hk + obtain ⟨d, hd, hdb, a, ξ, hξ, heq⟩ := hchar k hk + refine ⟨d, hd, hdb, a, ξ, hξ, ?_⟩ + intro j + simpa only [Nat.cast_mul, affineTorusFactor, Q] using heq j + · intro center z hz + change ‖(((K : ℝ) ^ Fintype.card J * finiteImageMass (smoothModerateBlockSource c s hcmass hmass) + (smoothModerateBlockSum c s offset stride J center) z : ℝ) : ℂ) - + integerGridApproximation (smoothModerateBlockSource c s hcmass hmass) + (smoothModerateBlockSum c s offset stride J center) K (R * K) S z‖ ≤ ε + have hh := happ center z hz + simp only [R, integerGridApproximation, Fintype.card_coe, finiteImageMass] at hh ⊢ + convert hh using 1 + apply congrArg norm + apply congrArg₂ (fun x y : ℂ => x - y) + · apply congrArg Complex.ofReal + apply congrArg (fun t : ℝ => (K : ℝ) ^ J.card * t) + unfold FiniteProbabilityWeights.mean + apply Finset.sum_congr + · apply Finset.ext + intro x + exact ⟨fun _ => Finset.mem_univ x, fun _ => Finset.mem_univ x⟩ + · intro x _ + rfl + · apply congrArg (fun t : ℂ => ((K : ℂ) / (R * K : ℕ)) ^ J.card * t) + apply Finset.sum_congr rfl + intro k _ + rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/SquareModeGradedFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/SquareModeGradedFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f3696c56d7ca61cba7fa31e258532a3f7734829 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/SquareModeGradedFrequency.lean @@ -0,0 +1,110 @@ +import OAI.Combinatorics.Progressions.Estimates.CommonNativeSquareFactors +import OAI.Combinatorics.Progressions.Estimates.FastGradedRelativeInvariance +import OAI.Combinatorics.Progressions.Linear.ReducedSquareGradedKernel + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + +local notation "ωW" => (fun a : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val a)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) +local notation "δ" => F.reducedSquareGradedDifference e ω hF + +theorem fullFastGradedRelative_top_frequency (hs : 1 ≤ s) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + (hW : BasisGradedSubmodule bW ωW W.toSubmodule) + (ξ : F.squareFiltration.quotientTop.AssociatedGraded →ₗ[ℚ] ℚ) + (η : F.AssociatedGraded →ₗ[ℚ] ℚ) + (hrestriction : ∀ x : F.layer (s + 1), + ξ (F.reducedSquareGradedRelativePiece s hs x) = η (F.associatedGradedPieceMap (s + 1) x)) + (hξ : ∀ y ∈ W, basisGradeProjection bW ωW s y = y → ξ y = 0) : + ∀ x ∈ F.fullFastGradedRelative e ω hF W, + basisGradeProjection (F.associatedGradedBasis e ω hF) ω (s + 1) x = x → η x = 0 := by + rintro x ⟨y, hy, rfl⟩ hpure + let ys := basisGradeProjection bW ωW s y + have hys : ys ∈ F.fastGradedRelativeKernel W := + F.fastGradedRelativeKernel_graded e ω hF W hW s y hy + have hysPure : basisGradeProjection bW ωW s ys = ys := + basisCoordinateProjection_idempotent bW {i | ωW i = s} y + have hδ : δ ys = δ y := (F.reducedSquareGradedDifference_gradeProjection e ω hF s y).trans hpure + obtain ⟨z, hz⟩ := F.exists_reducedSquareGradedRelativePiece_of_pure_kernel e ω hF + s hs le_rfl ys hysPure hys.2 + calc + η (δ y) = η (δ ys) := congrArg η hδ.symm + _ = η (δ (F.reducedSquareGradedRelativePiece s hs z)) := + congrArg (fun u => η (δ u)) hz.symm + _ = η (F.associatedGradedPieceMap (s + 1) z) := + congrArg η (F.reducedSquareGradedDifference_relativePiece e ω hF s hs z) + _ = ξ (F.reducedSquareGradedRelativePiece s hs z) := (hrestriction z).symm + _ = ξ ys := congrArg ξ hz + _ = 0 := hξ ys hys.1 hysPure + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +local notation "bq" => F.reducedSquareBasis b ω hF +local notation "ωq" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "hq" => F.reducedSquareBasis_layers b ω hF +local notation "bG" => F.squareFiltration.quotientTop.associatedGradedBasis bq ωq hq + +theorem square_gradedFrequency_restriction (hs : 1 ≤ s) + (η : L →ₗ[ℚ] ℚ) + (ξ : (F.squareLieSubalgebra ⧸ F.squareFiltration.layerIdeal (s + 1)) →ₗ[ℚ] ℚ) + (hrestriction : ∀ x : F.layer (s + 1), + ξ (lieQuotientMap (F.squareFiltration.layerIdeal (s + 1)) + (F.squareRelativeLayer s hs x).val) = η x) + (x : F.layer (s + 1)) : + F.squareFiltration.quotientTop.gradedFrequency bq ωq hq ξ + (F.reducedSquareGradedRelativePiece s hs x) = + F.gradedFrequency b ω hF η (F.associatedGradedPieceMap (s + 1) x) := by + change F.squareFiltration.quotientTop.gradedFrequency bq ωq hq ξ + (F.squareFiltration.quotientTopGradedMap + (F.squareFiltration.associatedGradedPieceMap s (F.squareRelativeLayer s hs x))) = _ + rw [F.squareFiltration.quotientTopGradedMap_piece, + F.squareFiltration.quotientTop.gradedFrequency_top_piece, + F.gradedFrequency_top_piece] + exact hrestriction x + +theorem square_mode_fullFast_top_frequency (hs : 1 ≤ s) + (η : L →ₗ[ℚ] ℚ) + (ξ : (F.squareLieSubalgebra ⧸ F.squareFiltration.layerIdeal (s + 1)) →ₗ[ℚ] ℚ) + (hrestriction : ∀ x : F.layer (s + 1), + ξ (lieQuotientMap (F.squareFiltration.layerIdeal (s + 1)) + (F.squareRelativeLayer s hs x).val) = η x) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + (hW : BasisGradedSubmodule bG ωq W.toSubmodule) + (hξ : ∀ y ∈ W, basisGradeProjection bG ωq s y = y → + F.squareFiltration.quotientTop.gradedFrequency bq ωq hq ξ y = 0) : + ∀ x ∈ F.fullFastGradedRelative b ω hF W, + basisGradeProjection (F.associatedGradedBasis b ω hF) ω (s + 1) x = x → + F.gradedFrequency b ω hF η x = 0 := by + exact F.fullFastGradedRelative_top_frequency b ω hF hs W hW + (F.squareFiltration.quotientTop.gradedFrequency bq ωq hq ξ) + (F.gradedFrequency b ω hF η) + (F.square_gradedFrequency_restriction b ω hF hs η ξ hrestriction) hξ + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/StandardJetFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/StandardJetFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..f043c4665ce31f031a0fc830488fe1dd70278150 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/StandardJetFourier.lean @@ -0,0 +1,321 @@ +import OAI.Combinatorics.Progressions.Fourier.AllocatedJetFourierData +import OAI.Combinatorics.Progressions.Sampling.AllocatedProbabilityGrid + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule +open scoped Classical + +theorem euclideanAmbientTorus_normalized {D : Type*} [Fintype D] + (U : Submodule ℝ (D → ℝ)) {n : ℕ} + (b : Basis (Fin n) ℝ (euclideanSubspace U)ᗮ) + (hb : span ℤ (Set.range b) = projectedIntegerLattice (euclideanSubspace U)) + (x : euclideanSubspace U × (Fin n → ℤ)) (i : D) : + subspaceAmbientTorus U (euclideanSubspaceTorusEquiv U + (normalizedLatticeQuotient (euclideanSubspace U) b hb x)) i = + (normalizedLatticePoint (euclideanSubspace U) b x i : UnitAddCircle) := by + let u := normalizedLatticeRepresentative (euclideanSubspace U) b hb x + have hu : QuotientAddGroup.mk' _ u = normalizedLatticeQuotient (euclideanSubspace U) b hb x := + normalizedLatticeRepresentative_mk (euclideanSubspace U) b hb x + rw [← hu, euclideanSubspaceTorusEquiv_mk, subspaceAmbientTorus_mk, euclideanSubspaceArrayEquiv_apply] + apply sub_eq_zero.mp + rw [← AddCircle.coe_sub] + obtain ⟨z, hz⟩ := (mem_standardEuclideanLattice D _).mp + (normalizedLatticePoint_sub_mem_of_mk_eq (euclideanSubspace U) b hb u x hu) i + apply (AddCircle.coe_eq_zero_iff (1 : ℝ)).mpr + exact ⟨z, by simpa only [zsmul_eq_mul, mul_one, PiLp.sub_apply] using hz⟩ + +theorem normalizedCoveredChart_projection {D Q : Type*} [Fintype D] [Fintype Q] + (W : Submodule ℝ (EuclideanSpace ℝ D)) {n : ℕ} (b : Basis (Fin n) ℝ Wᗮ) + (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + (bW : Basis Q ℤ (latticeSection (standardEuclideanLattice D) W)) + (d : ℕ) [NeZero d] (x : (W × (Fin n → ℤ)) × (Q → ZMod d)) : + quotientIntegerCover (latticeSection (standardEuclideanLattice D) W).toAddSubgroup d + (normalizedCoveredChart W b hb bW d x) = normalizedLatticeQuotient W b hb x.1 := by + let Γ := (latticeSection (standardEuclideanLattice D) W).toAddSubgroup + let e := coverKernelBasisEquiv Γ bW d (Nat.pos_of_ne_zero (NeZero.ne d)) + have hk : quotientIntegerCover Γ d (e x.2).val = 0 := (e x.2).property + change quotientIntegerCover Γ d (normalizedCoverLift W b hb d x.1 + (e x.2).val) = _ + rw [map_add, + normalizedCoverLift_projection W b hb d (Nat.pos_of_ne_zero (NeZero.ne d)), hk, add_zero] + +namespace VectorPolynomial + +variable {m : ℕ} {O J : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +noncomputable def coveredJetAmbientTorus (d : ℕ) (y : EuclideanJetLayers U O) : + JetAmbientIndex O J → UnitAddCircle := fun a => + subspaceAmbientTorus (U a.1) (euclideanSubspaceTorusEquiv (U a.1) + (quotientIntegerCover (latticeSection (standardEuclideanLattice (J a.1)) + (euclideanSubspace (U a.1))).toAddSubgroup d (y a.1 a.2.1))) a.2.2 + +omit [∀ j, Fintype (O j)] in +theorem coveredJetAmbientTorus_continuous (d : ℕ) : + Continuous (coveredJetAmbientTorus (O := O) U d) := by + apply continuous_pi + intro a + exact (continuous_apply a.2.2).comp ((subspaceAmbientTorus_continuous (U a.1)).comp + ((euclideanSubspaceTorusEquiv_continuous (U a.1)).comp + ((quotientIntegerCover_continuous _ d).comp + ((continuous_apply a.2.1).comp (continuous_apply a.1))))) + +omit [∀ j, Fintype (O j)] in +theorem coveredJetAmbientTorus_chart + {I Q : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (Q j)] {n : Fin m → ℕ} + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (d : ℕ) [NeZero d] (z : MixedCoveredJetSource I O Q n d) : + coveredJetAmbientTorus U d (mixedCoveredJetChart U o b hb bW d z) = + fun a => (mixedJetAmbientPoint U b o z.1 a : UnitAddCircle) := by + funext a + change subspaceAmbientTorus (U a.1) (euclideanSubspaceTorusEquiv (U a.1) + (quotientIntegerCover _ d (normalizedCoveredChart _ (b a.1) (hb a.1) (bW a.1) d + (mixedCoveredJetCoordinates U o d z a.1 a.2.1)))) a.2.2 = _ + rw [normalizedCoveredChart_projection] + exact euclideanAmbientTorus_normalized (U a.1) (b a.1) (hb a.1) _ a.2.2 + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +variable {α K : Type*} [Fintype α] [DecidableEq α] [Fintype K] {m : ℕ} +variable {O J : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (root : K → ℤ) (D : Matrix α K ℤ) (rows : ∀ j, O j → Finset α) + +omit [∀ j, Fintype (O j)] in +theorem coveredJetAmbientTorus_coefficient (d : ℕ) (x : CoefficientTorus (K := K) U) + (j : Fin m) (o : O j) (i : J j) : + coveredJetAmbientTorus U d (euclideanCoefficientJetMap U root D rows x) ⟨j, o, i⟩ = + ∑ e : BoundedCoefficientExponent K (j.val + 1), + ((d : ℤ) * boundedCoefficientJetMatrix root D (j.val + 1) (rows j) o e) • + coefficientAmbientTorus U x ⟨⟨j, e⟩, i⟩ := by + change subspaceAmbientTorus (U j) (euclideanSubspaceTorusEquiv (U j) + (d • euclideanCoefficientJetMap U root D rows x j o)) i = _ + rw [euclideanCoefficientJetMap_apply, map_nsmul, map_sum, map_nsmul, map_sum] + simp only [map_zsmul, euclideanCoefficientEquiv_apply, AddEquiv.apply_symm_apply, + Pi.smul_apply, Finset.sum_apply] + rw [Finset.smul_sum] + apply Finset.sum_congr rfl + intro e _ + change d • (boundedCoefficientJetMatrix root D (j.val + 1) (rows j) o e • + coefficientAmbientTorus U x ⟨⟨j, e⟩, i⟩) = _ + rw [← natCast_zsmul, ← mul_smul] + +noncomputable def jetAmbientCoefficientFrequency (d : ℕ) + (frequency : JetAmbientIndex O J → ℤ) : ∀ j, (K →₀ ℕ) → J j → ℤ := + coefficientSlotFrequency (fun s i => ∑ o : O s.1, + frequency ⟨s.1, o, i⟩ * ((d : ℤ) * + boundedCoefficientJetMatrix root D (s.1.val + 1) (rows s.1) o s.2)) + +theorem jetAmbientCoefficientFrequency_character (d : ℕ) + (frequency : JetAmbientIndex O J → ℤ) (x : CoefficientTorus (K := K) U) : + (∏ a, CircleFourier.character + (frequency a • coveredJetAmbientTorus U d (euclideanCoefficientJetMap U root D rows x) a)) = + coefficientTorusCharacter U (jetAmbientCoefficientFrequency root D rows d frequency) x := by + let f : CoefficientAmbientIndex K J → ℤ := fun a => ∑ o : O a.1.1, + frequency ⟨a.1.1, o, a.2⟩ * ((d : ℤ) * + boundedCoefficientJetMatrix root D (a.1.1.val + 1) (rows a.1.1) o a.1.2) + change _ = coefficientTorusCharacter U (coefficientSlotFrequency (fun s i => f ⟨s, i⟩)) x + rw [← coefficientAmbientTorus_character U f x] + rw [Fintype.prod_sigma, Fintype.prod_sigma] + rw [Fintype.prod_sigma] + apply Finset.prod_congr rfl + intro j _ + rw [Fintype.prod_prod_type] + simp only [f, coveredJetAmbientTorus_coefficient, Finset.smul_sum, ← mul_smul, + CircleFourier.character_fintype_sum, Finset.sum_smul] + let t := fun (o : O j) (i : J j) (e : BoundedCoefficientExponent K (j.val + 1)) => + CircleFourier.character ((frequency ⟨j, o, i⟩ * + ((d : ℤ) * boundedCoefficientJetMatrix root D (j.val + 1) (rows j) o e)) • + coefficientAmbientTorus U x ⟨⟨j, e⟩, i⟩) + change (∏ o, ∏ i, ∏ e, t o i e) = ∏ e, ∏ i, ∏ o, t o i e + calc + _ = ∏ o, ∏ e, ∏ i, t o i e := + Finset.prod_congr rfl (fun _ _ => Finset.prod_comm) + _ = ∏ e, ∏ o, ∏ i, t o i e := Finset.prod_comm + _ = _ := Finset.prod_congr rfl (fun _ _ => Finset.prod_comm) + +omit [Fintype α] [∀ j, Fintype (J j)] in +theorem jetAmbientCoefficientFrequency_bound (d : ℕ) + (frequency : JetAmbientIndex O J → ℤ) {C M : ℝ} (hC : 0 ≤ C) + (hf : ∀ a, |(frequency a : ℝ)| ≤ C) + (hD : ∀ j o e, |(boundedCoefficientJetMatrix root D (j.val + 1) (rows j) o e : ℝ)| ≤ M) + (j : Fin m) (e : K →₀ ℕ) (he : e.degree ≤ j.val + 1) (i : J j) : + |(jetAmbientCoefficientFrequency root D rows d frequency j e i : ℝ)| ≤ + Fintype.card (O j) * (C * ((d : ℝ) * M)) := by + change |(coefficientSlotFrequency _ j e i : ℝ)| ≤ _ + rw [coefficientSlotFrequency, dite_eq_left he, Int.cast_sum] + calc + _ ≤ ∑ o : O j, |((frequency ⟨j, o, i⟩ * ((d : ℤ) * + boundedCoefficientJetMatrix root D (j.val + 1) (rows j) o ⟨e, he⟩) : ℤ) : ℝ)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _o : O j, C * ((d : ℝ) * M) := by + apply Finset.sum_le_sum + intro o _ + simp only [Int.cast_mul, Int.cast_natCast, abs_mul, abs_of_nonneg (Nat.cast_nonneg d : (0 : ℝ) ≤ d)] + exact mul_le_mul (hf _) (mul_le_mul_of_nonneg_left (hD j o _) (Nat.cast_nonneg d)) + (mul_nonneg (Nat.cast_nonneg d) (abs_nonneg _)) hC + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "single" => (fun _ : Fin m => Unit) + +noncomputable def rowSiteAmbientTorus (s : Finset α) (z : JetAmbientIndex rowTypes J → UnitAddCircle) : + JetAmbientIndex single J → UnitAddCircle := + fun a => ∑ t : rowTypes a.1, rowRestrictedSiteMatrix (rowSets a.1) s t • z ⟨a.1, t, a.2.2⟩ + +omit [Fintype α] in +theorem rowSiteAmbientTorus_lipschitz (s : Finset α) : + LipschitzWith (∑ j, ((rowSets j).card : ℝ≥0)) (rowSiteAmbientTorus (J := J) rowSets s) := by + apply LipschitzWith.of_dist_le_mul + intro z w + apply (dist_pi_le_iff (by positivity)).mpr + rintro ⟨j, t, k⟩ + have hterm (u : rowTypes j) : + dist (rowRestrictedSiteMatrix (rowSets j) s u • z ⟨j, u, k⟩) + (rowRestrictedSiteMatrix (rowSets j) s u • w ⟨j, u, k⟩) ≤ dist z w := by + simp only [rowRestrictedSiteMatrix, booleanReconstructionMatrix] + split_ifs + · simpa only [one_zsmul] using dist_le_pi_dist z w ⟨j, u, k⟩ + · simp only [zero_zsmul, dist_self] + exact dist_nonneg + have hc : ((rowSets j).card : ℝ≥0) ≤ ∑ j, ((rowSets j).card : ℝ≥0) := + Finset.single_le_sum (f := fun j => ((rowSets j).card : ℝ≥0)) (fun _ _ => zero_le) (Finset.mem_univ j) + calc + dist (rowSiteAmbientTorus rowSets s z ⟨j, t, k⟩) (rowSiteAmbientTorus rowSets s w ⟨j, t, k⟩) ≤ + ∑ _u : rowTypes j, dist z w := (dist_sum_sum_le _ _ _).trans (Finset.sum_le_sum (fun u _ => hterm u)) + _ = ((rowSets j).card : ℝ) * dist z w := by simp + _ ≤ ((∑ j, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) * dist z w := + mul_le_mul_of_nonneg_right (by exact_mod_cast hc) dist_nonneg + +omit [Fintype α] in +theorem coveredRowsSiteValue_ambient (U : ∀ j, Submodule ℝ (J j → ℝ)) + (d : ℕ) (y : EuclideanJetLayers U rowTypes) (s : Finset α) : + coveredJetAmbientTorus U d (coveredRowsSiteValue rowSets U y s) = + rowSiteAmbientTorus rowSets s (coveredJetAmbientTorus U d y) := by + funext a + simp only [coveredJetAmbientTorus, coveredRowsSiteValue, rowSiteAmbientTorus, + map_sum, map_zsmul, Finset.sum_apply, Pi.smul_apply] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial +open scoped BigOperators Classical Matrix + +theorem standardPhysicalSite_apply {q : ℕ} (s : Finset (Fin q)) (i : Fin q) : + standardPhysicalSite s i = if i ∈ s then 1 else 0 := by + simp [standardPhysicalSite, integerAffineCube, Matrix.one_apply] + +theorem boundedSiteMatrix_standard {q h : ℕ} (s : Finset (Fin q)) + (e : BoundedCoefficientExponent (Fin q) h) : + boundedSiteMatrix h standardPhysicalSite s e = if e.val.support ⊆ s then 1 else 0 := by + change (∏ i ∈ e.val.support, standardPhysicalSite s i ^ e.val i) = _ + simp only [standardPhysicalSite_apply] + by_cases hs : e.val.support ⊆ s + · rw [ite_eq_left hs] + exact Finset.prod_eq_one (fun i hi => by rw [ite_eq_left (hs hi), one_pow]) + · rw [ite_eq_right hs] + obtain ⟨i, hi, his⟩ := Finset.not_subset.mp hs + exact Finset.prod_eq_zero hi (by rw [ite_eq_right his, zero_pow (Finsupp.mem_support_iff.mp hi)]) + +theorem boundedCoefficientJetMatrix_standard {q h : ℕ} {O : Type*} + (rows : O → Finset (Fin q)) (o : O) (e : BoundedCoefficientExponent (Fin q) h) : + boundedCoefficientJetMatrix (fun _ => 0) (1 : Matrix (Fin q) (Fin q) ℤ) h rows o e = + if rows o = e.val.support then 1 else 0 := by + rw [← booleanJetExtractionMatrix_mul_boundedSite] + change (booleanJetExtractionMatrix rows *ᵥ (fun s => boundedSiteMatrix h standardPhysicalSite s e)) o = _ + rw [booleanJetExtractionMatrix_mulVec] + simp only [boundedSiteMatrix_standard] + exact booleanCoefficient_monomial e.val.support (rows o) + +theorem coefficientExponent_support_card_le {K : Type*} (e : K →₀ ℕ) : + e.support.card ≤ e.degree := by + calc + _ = ∑ _i ∈ e.support, 1 := by simp + _ ≤ ∑ i ∈ e.support, e i := Finset.sum_le_sum + (fun i hi => Nat.one_le_iff_ne_zero.mpr (Finsupp.mem_support_iff.mp hi)) + _ = _ := rfl + +noncomputable def standardJetFrequency {m q : ℕ} {J : Fin m → Type*} + (d : ℕ) (frequency : JetAmbientIndex (fun j : Fin m => BoundedBooleanJet (Fin q) (j.val + 1)) J → ℤ) : + ∀ j, (Fin q →₀ ℕ) → J j → ℤ := + jetAmbientCoefficientFrequency (fun _ => 0) (1 : Matrix (Fin q) (Fin q) ℤ) + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) d frequency + +theorem standardJetFrequency_apply {m q : ℕ} {J : Fin m → Type*} + (d : ℕ) (frequency : JetAmbientIndex (fun j : Fin m => BoundedBooleanJet (Fin q) (j.val + 1)) J → ℤ) + (j : Fin m) (e : Fin q →₀ ℕ) (he : e.degree ≤ j.val + 1) (i : J j) : + standardJetFrequency d frequency j e i = + frequency ⟨j, ⟨e.support, (coefficientExponent_support_card_le e).trans he⟩, i⟩ * (d : ℤ) := by + unfold standardJetFrequency jetAmbientCoefficientFrequency + rw [coefficientSlotFrequency, dite_eq_left he] + simp only [boundedCoefficientJetMatrix_standard] + let s : BoundedBooleanJet (Fin q) (j.val + 1) := + ⟨e.support, (coefficientExponent_support_card_le e).trans he⟩ + rw [Finset.sum_eq_single s] + · simp [s] + · intro b _ hbs + have hb : b.val ≠ e.support := fun h => hbs (Subtype.ext h) + simp [hb] + · simp + +theorem standardJetFrequency_bound {m q : ℕ} {J : Fin m → Type*} + (d : ℕ) (frequency : JetAmbientIndex (fun j : Fin m => BoundedBooleanJet (Fin q) (j.val + 1)) J → ℤ) + {C : ℝ} (hf : ∀ a, |(frequency a : ℝ)| ≤ C) + (j : Fin m) (e : Fin q →₀ ℕ) (he : e.degree ≤ j.val + 1) (i : J j) : + |(standardJetFrequency d frequency j e i : ℝ)| ≤ C * d := by + rw [standardJetFrequency_apply d frequency j e he i, Int.cast_mul, Int.cast_natCast, abs_mul, + abs_of_nonneg (Nat.cast_nonneg d : (0 : ℝ) ≤ d)] + exact mul_le_mul_of_nonneg_right (hf _) (Nat.cast_nonneg d) + +theorem standardJetFrequency_character {m q : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) (d : ℕ) + (frequency : JetAmbientIndex (fun j : Fin m => BoundedBooleanJet (Fin q) (j.val + 1)) J → ℤ) + (x : CoefficientTorus (K := Fin q) U) : + (∏ a, CircleFourier.character + (frequency a • coveredJetAmbientTorus U d (standardPhysicalJetMap U x) a)) = + coefficientTorusCharacter U (standardJetFrequency d frequency) x := + jetAmbientCoefficientFrequency_character U (fun _ => 0) (1 : Matrix (Fin q) (Fin q) ℤ) + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) d frequency x + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/StepOneFamilyFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/StepOneFamilyFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..73b619f6582e86b1596289bc1acb5b1dde5155d4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/StepOneFamilyFourier.lean @@ -0,0 +1,98 @@ +import OAI.Combinatorics.Progressions.Estimates.HigherResidualRowDifferences + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMeanRowCorrelation.lie NativeMeanRowCorrelation.algebra + NativeMeanRowCorrelation.topology NativeMeanRowCorrelation.topologicalAdd + NativeMeanRowCorrelation.continuousSMul NativeMeanRowCorrelation.hausdorff + +theorem exists_fourier_of_stepOne_cross_family : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {I : Type*} [Fintype I] [Nonempty I] {N : ℕ} [NeZero N] + {p : ℝ}, 0 ≤ p → ∀ (a b : I → ZMod N → ℂ) (K : I → (Fin 2 → ℤ) → ℂ), + (∀ i n, ‖a i n‖ ≤ 1) → (∀ i n, ‖b i n‖ ≤ 1) → + (∀ i, Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 p (K i))) → + Real.exp (-p) ≤ (𝔼 i, 𝔼 h : ZMod N, ‖𝔼 n : ZMod N, + (a i n * star (b i (n + h))) * star (K i ![(h.val : ℤ), (n.val : ℤ)])‖) → + ∃ χ : I → AddChar (ZMod N) ℂ, + Real.exp (-((p + C) ^ C)) ≤ 𝔼 i, ‖finiteFourierCoeff (b i) (χ i)‖ := by + obtain ⟨A, _, hfourier⟩ := exists_fourier_of_stepOne_cross_correlation + let X : Polynomial ℕ := Polynomial.X + let T := 3 * X + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (T + (T + X + Polynomial.C A) ^ A) + refine ⟨C, hC, ?_⟩ + intro I _ _ N _ p hp a b K ha hb hK hcorr + classical + let c (i : I) := 𝔼 h : ZMod N, ‖𝔼 n : ZMod N, + (a i n * star (b i (n + h))) * star (K i ![(h.val : ℤ), (n.val : ℤ)])‖ + let z (i : I) := Real.exp (-(2 * p)) * c i + let t := 3 * p + 2 + have ht : 0 ≤ t := by dsimp [t]; linarith + have hc0 (i : I) : 0 ≤ c i := Finset.expect_nonneg (fun _ _ => norm_nonneg _) + have hcap (i : I) : c i ≤ Real.exp (2 * p) := by + apply Finset.expect_le Finset.univ_nonempty + intro h _ + apply (RCLike.norm_expect_le (K := ℂ)).trans + apply Finset.expect_le Finset.univ_nonempty + intro n _ + rw [norm_mul, norm_star] + apply (mul_le_of_le_one_left (norm_nonneg _) ?_).trans + ((Classical.choice (hK i)).norm_eval_le _) + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (ha i n)).trans (hb i (n + h)) + have hzcap (i : I) : z i ≤ 1 := by + calc + _ ≤ Real.exp (-(2 * p)) * Real.exp (2 * p) := + mul_le_mul_of_nonneg_left (hcap i) (Real.exp_nonneg _) + _ = 1 := by rw [← Real.exp_add, neg_add_cancel, Real.exp_zero] + have hzmean : Real.exp (-(3 * p)) ≤ 𝔼 i, z i := by + change Real.exp (-(3 * p)) ≤ 𝔼 i, Real.exp (-(2 * p)) * c i + rw [← Finset.mul_expect] + have heq : Real.exp (-(3 * p)) = Real.exp (-(2 * p)) * Real.exp (-p) := by + rw [← Real.exp_add] + congr 1 + ring + rw [heq] + exact mul_le_mul_of_nonneg_left hcorr (Real.exp_nonneg _) + obtain ⟨S, hS, hlarge⟩ := exists_dense_level_set z (Real.exp_nonneg (-(3 * p))) hzcap hzmean + have hhalf : Real.exp (-t) ≤ Real.exp (-(3 * p)) / 2 := by + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + calc + _ ≤ Real.exp (-t) * Real.exp 2 := mul_le_mul_of_nonneg_left + (by linarith [Real.add_one_le_exp (2 : ℝ)]) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; dsimp [t]; ring + have hzle (i : I) : z i ≤ c i := mul_le_of_le_one_left (hc0 i) + (Real.exp_le_one_iff.mpr (by linarith)) + have hcharacter (i : I) (hi : i ∈ S) : ∃ χ : AddChar (ZMod N) ℂ, + Real.exp (-((t + p + A) ^ A)) ≤ ‖finiteFourierCoeff (b i) χ‖ := by + have hc : Real.exp (-t) ≤ c i := hhalf.trans ((hlarge i hi).trans (hzle i)) + obtain ⟨V⟩ := NativeMeanRowCorrelation.exists_of_expansion + (Classical.choice (hK i)) ht hc + exact hfourier V.model (by linarith : 0 ≤ t + p) V.test V.complexity + (a i) (b i) (ha i) (hb i) V.correlation + let χ (i : I) : AddChar (ZMod N) ℂ := if hi : i ∈ S then Classical.choose (hcharacter i hi) else 1 + have hmass := dense_set_mean_lower_bound S (fun i => ‖finiteFourierCoeff (b i) (χ i)‖) + (fun _ => norm_nonneg _) (Real.exp_nonneg (-((t + p + A) ^ A))) + ((mul_le_mul_of_nonneg_right hhalf (Nat.cast_nonneg _)).trans hS) + (fun i hi => by simpa only [χ, dite_eq_left hi] using Classical.choose_spec (hcharacter i hi)) + have hcost : t + (t + p + A) ^ A ≤ (p + C) ^ C := by + simpa [X, T, t, Polynomial.eval₂_pow] using hbudget p hp + refine ⟨χ, (Real.exp_le_exp.mpr (neg_le_neg hcost)).trans ?_⟩ + have heq : Real.exp (-(t + (t + p + A) ^ A)) = + Real.exp (-t) * Real.exp (-((t + p + A) ^ A)) := by + rw [← Real.exp_add] + congr 1 + ring + rwa [heq] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/TaggedMajorFourierNiltest.lean b/lean/OAI/Combinatorics/Progressions/Fourier/TaggedMajorFourierNiltest.lean new file mode 100644 index 0000000000000000000000000000000000000000..127895a4bfa640f6fcae32d2bc3533a7d1f42e42 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/TaggedMajorFourierNiltest.lean @@ -0,0 +1,83 @@ +import OAI.Combinatorics.Progressions.Nilpotent.MajorTranslationRationalLiftNiltest +import OAI.Combinatorics.Progressions.Polynomial.LowTaggedPolynomialCoordinates + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module VectorPolynomial +open scoped TensorProduct NNReal BigOperators + +theorem exists_tagged_major_fourier_niltest (d : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {U : Type*} [Fintype U] {m : ℕ} + (J : Fin m → Type*) [∀ j, Fintype (J j)] + [Fintype (WeightedBasisIndex (lowTaggedWeight J d) d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra (lowTaggedWeight J d) d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra (lowTaggedWeight J d) d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra (lowTaggedWeight J d) d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra (lowTaggedWeight J d) d)] + (_hd : 0 < d) (cover : ℕ) (hcover : 0 < cover) + (Ψ : PatchKernel (Fintype.card (LowTaggedIndex J d))) + (D : MvPolynomial (U ⊕ Fin (Fintype.card (LowTaggedIndex J d))) ℝ) + (hD : D.IsWeightedHomogeneous (Sum.elim (fun _ : U => 1) (lowTaggedWeight J d)) d) + (poly : ∀ j, VectorPolynomial U ℝ (J j → ℝ)) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (W : ∀ j, Submodule ℝ (J j → ℝ)) + (_hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ W j) + (c : Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) (a : (Σ j, J j) → ℤ) + (_hann : ∀ j, d < j.val + 1 → + W j ≤ LinearMap.ker (integerRowLinear (fun i => a ⟨j, i⟩))) + {p : ℝ} (_hp : 0 ≤ p) (_hdim : (Fintype.card U + Fintype.card (Σ j, J j) : ℕ) ≤ p) + (_hcoverp : (cover : ℝ) ≤ Real.exp p) (_hΨ : (Ψ.lip : ℝ) ≤ Real.exp p) + (_ha : ∀ i, |(a i : ℝ)| ≤ Real.exp p), + ∃ F : (weightedTranslationResidueNilmanifold (lowTaggedWeight J d) d + (lowTaggedWeight_pos J d) (lowTaggedWeight_le J d) cover hcover).Niltest + (fun _ : U => 1), + F.normBound = 1 ∧ F.ComplexityLE ((p + C) ^ C) ∧ + F.orbit = majorTranslationPolynomialOrbit (lowTaggedWeight J d) d + (lowTaggedWeight_pos J d) (lowTaggedWeight_le J d) + (fractionalCoefficientPolynomial D) + (fun _ hα => (fractionalCoefficientPolynomial_isWeightedHomogeneous D + (Sum.elim (fun _ : U => 1) (lowTaggedWeight J d)) d hD + (mem_support_iff.mp hα)).le) + (fun i => lowTaggedPolynomial J d poly i - MvPolynomial.C (c i)) + (fun i => (MvPolynomial.totalDegree_sub_C_le _ _).trans + (lowTaggedPolynomial_degree J d poly hpoly i)) ∧ + ∀ u : U → ℤ, + F.eval u = + (Ψ.value (fun i => MvPolynomial.eval (fun j => (u j : ℝ)) + (lowTaggedPolynomial J d poly i) - c i - + (nearestLowCoordinateLift (lowTaggedPolynomial J d poly) c u i : ℝ)) : ℂ) * + (Real.fourierChar (MvPolynomial.eval (fun j => + ((Sum.elim u (nearestLowCoordinateLift (lowTaggedPolynomial J d poly) c u) + j : ℤ) : ℝ)) D) : ℂ) * + (Real.fourierChar (MvPolynomial.eval (fun j => (u j : ℝ)) + (normalizedTwistFrequencyPolynomial cover a poly)) : ℂ) := by + obtain ⟨C, hC, hmain⟩ := exists_majorTranslation_rationalLift_niltest_nearest d + refine ⟨C, hC, ?_⟩ + intro U _ m J _ _ _ _ _ _ hd cover hcover Ψ D hD poly hpoly W hcoeff c a hann p hp + hdim hcoverp hΨ ha + have hlowdim : ((Fintype.card U + Fintype.card (LowTaggedIndex J d) : ℕ) : ℝ) ≤ p := + (Nat.cast_le.mpr (Nat.add_le_add_left (lowTaggedIndex_card_le J d) _)).trans hdim + obtain ⟨F, hnorm, hcomp, horbit, heval⟩ := hmain (lowTaggedWeight J d) + (lowTaggedWeight_pos J d) (lowTaggedWeight_le J d) hd cover hcover Ψ D hD + (lowTaggedPolynomial J d poly) (lowTaggedPolynomial_degree J d poly hpoly) + c (lowTaggedFrequency J d a) hp hlowdim hcoverp hΨ + (lowTaggedFrequency_bound J d a _ ha) + let k := normalizedTwistHighFrequencyConstant cover d a poly + refine ⟨F.phaseShift k, by simpa using hnorm, by simpa using hcomp, horbit, ?_⟩ + intro u + rw [RationalFilteredNilmanifold.Niltest.phaseShift_eval, heval] + rw [normalizedTwistFrequencyPolynomial_low_add_constant cover d W a poly hcoeff hann, + map_add, eval_C, normalizedTwistFrequencyPolynomial_low_eval] + rw [Real.fourierChar.map_add_eq_mul, Circle.coe_mul] + dsimp only [k] + ring + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/TorusCellBudget.lean b/lean/OAI/Combinatorics/Progressions/Fourier/TorusCellBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..87063927e8a6f7f4167511b9af2a5c568263ab26 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/TorusCellBudget.lean @@ -0,0 +1,535 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteImageCover +import OAI.Combinatorics.Progressions.Fourier.RectangularGridCharacter +import OAI.Combinatorics.Progressions.Lattices.IntegerLiftOffset +import OAI.Combinatorics.Progressions.Linear.PeriodicKernelPartition +import OAI.Combinatorics.Progressions.Linear.WeightedParameterPatchRankPadding +import OAI.Combinatorics.Progressions.Sampling.PositivePartitionScore + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def torusGridCenter {d : ℕ} (q : ℕ) (a : Fin d → Fin q) : Fin d → ℝ := + fun i => (a i).val / (q : ℝ) + +theorem fractionalPartBin_center_error {q : ℕ} (hq : 0 < q) (x : ℝ) : + |((fractionalPartBin q hq x).val : ℝ) / q - Int.fract x| ≤ 1 / (q : ℝ) := by + have hqR : (0 : ℝ) < q := by exact_mod_cast hq + have hlo : ((fractionalPartBin q hq x).val : ℝ) ≤ (q : ℝ) * Int.fract x := + Nat.floor_le (mul_nonneg (Nat.cast_nonneg q) (Int.fract_nonneg x)) + have hhi : (q : ℝ) * Int.fract x < ((fractionalPartBin q hq x).val : ℝ) + 1 := + Nat.lt_floor_add_one _ + have hle : ((fractionalPartBin q hq x).val : ℝ) / q ≤ Int.fract x := + (div_le_iff₀ hqR).mpr (by simpa only [mul_comm] using hlo) + rw [abs_of_nonpos (sub_nonpos.mpr hle), neg_sub] + apply (le_div_iff₀ hqR).mpr + rw [sub_mul, div_mul_cancel₀ _ hqR.ne'] + nlinarith + +theorem torusGrid_coordinate_cover {d q : ℕ} (hq : 0 < q) (x : Fin d → ℝ) : + ∃ (a : Fin d → Fin q) (b : Fin d → ℤ), + ∀ i, |(b i : ℝ) - (x - torusGridCenter q a) i| ≤ 1 / (q : ℝ) := by + let a := fun i => fractionalPartBin q hq (x i) + let b := fun i => Int.floor (x i) + refine ⟨a, b, ?_⟩ + intro i + have heq : (b i : ℝ) - (x - torusGridCenter q a) i = + ((fractionalPartBin q hq (x i)).val : ℝ) / q - Int.fract (x i) := by + simp only [b, a, Pi.sub_apply, torusGridCenter, Int.fract] + ring + rw [heq] + exact fractionalPartBin_center_error hq (x i) + +theorem torusGrid_cover {d q : ℕ} (hq : 0 < q) (x : Fin d → ℝ) : + ∃ (a : Fin d → Fin q) (b : Fin d → ℤ), + dist (fun i => (b i : ℝ) - (x - torusGridCenter q a) i) 0 ≤ 1 / (q : ℝ) := by + obtain ⟨a, b, hab⟩ := torusGrid_coordinate_cover hq x + refine ⟨a, b, (dist_pi_le_iff (by positivity)).mpr ?_⟩ + intro i + simpa only [Pi.zero_apply, Real.dist_eq, sub_zero] using hab i + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier + +theorem circle_grid_cover {q : ℕ} (hq : 0 < q) (x : UnitAddCircle) : + ∃ a : Fin q, dist x (((a.val : ℝ) / q : ℝ) : UnitAddCircle) ≤ 1 / (q : ℝ) := by + obtain ⟨r, rfl⟩ := QuotientAddGroup.mk'_surjective (AddSubgroup.zmultiples (1 : ℝ)) x + refine ⟨fractionalPartBin q hq r, ?_⟩ + calc + _ = ‖((Int.fract r - (fractionalPartBin q hq r).val / (q : ℝ) : ℝ) : UnitAddCircle)‖ := by + rw [dist_eq_norm, AddCircle.coe_sub, AddCircle.coe_fract] + rfl + _ ≤ |Int.fract r - (fractionalPartBin q hq r).val / (q : ℝ)| := by + exact QuotientAddGroup.norm_mk_le_norm + _ ≤ 1 / (q : ℝ) := by + simpa only [abs_sub_comm] using fractionalPartBin_center_error hq r + +noncomputable def ambientTorusGrid {J : Type*} (q : ℕ) (a : J → Fin q) : J → UnitAddCircle := + fun j => (((a j).val : ℝ) / q : ℝ) + +theorem ambientTorusGrid_cover {J : Type*} [Fintype J] {q : ℕ} (hq : 0 < q) + (x : J → UnitAddCircle) : ∃ a : J → Fin q, dist x (ambientTorusGrid q a) ≤ 1 / (q : ℝ) := by + choose a ha using fun j => circle_grid_cover hq (x j) + exact ⟨a, (dist_pi_le_iff (by positivity)).mpr ha⟩ + +theorem ambientTorus_image_cover {G J : Type*} [Nonempty G] [Fintype J] + (f : G → J → UnitAddCircle) {q : ℕ} (hq : 0 < q) : + ∃ a : (J → Fin q) → G, ∀ x, ∃ i, dist (f x) (f (a i)) ≤ 2 / (q : ℝ) := by + obtain ⟨a, ha⟩ := finite_cover_inside_image f (ambientTorusGrid q) + (fun x => ambientTorusGrid_cover hq (f x)) + refine ⟨a, fun x => ?_⟩ + simpa only [mul_one_div] using ha x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped NNReal + +noncomputable def ambientTorusTent {J : Type*} [Fintype J] (q : ℕ) (x : J → UnitAddCircle) : ℝ := + max 0 (1 - (q : ℝ) / 4 * ‖x‖) + +theorem ambientTorusTent_range {J : Type*} [Fintype J] (q : ℕ) (x : J → UnitAddCircle) : + 0 ≤ ambientTorusTent q x ∧ ambientTorusTent q x ≤ 1 := by + refine ⟨le_max_left _ _, max_le zero_le_one ?_⟩ + have h : 0 ≤ (q : ℝ) / 4 * ‖x‖ := by positivity + linarith + +theorem ambientTorusTent_ge_half {J : Type*} [Fintype J] {q : ℕ} (hq : 0 < q) + (x : J → UnitAddCircle) (hx : ‖x‖ ≤ 2 / (q : ℝ)) : 1 / 2 ≤ ambientTorusTent q x := by + have hq' : (0 : ℝ) < q := by exact_mod_cast hq + have he := (le_div_iff₀ hq').mp hx + apply le_trans _ (le_max_right _ _) + nlinarith + +theorem ambientTorusTent_support {J : Type*} [Fintype J] {q : ℕ} (hq : 0 < q) + (x : J → UnitAddCircle) (hx : ambientTorusTent q x ≠ 0) : ‖x‖ < 4 / (q : ℝ) := by + have hq' : (0 : ℝ) < q := by exact_mod_cast hq + have he : 0 < 1 - (q : ℝ) / 4 * ‖x‖ := by + by_contra h + exact hx (max_eq_left (by linarith)) + apply (lt_div_iff₀ hq').mpr + nlinarith + +theorem ambientTorusTent_lipschitz {J : Type*} [Fintype J] (q : ℕ) : + LipschitzWith ((q : ℝ≥0) / 4) (ambientTorusTent (J := J) q) := by + apply LipschitzWith.of_dist_le_mul + intro x y + change |max 0 (1 - (q : ℝ) / 4 * ‖x‖) - max 0 (1 - (q : ℝ) / 4 * ‖y‖)| ≤ _ + calc + _ ≤ |(1 - (q : ℝ) / 4 * ‖x‖) - (1 - (q : ℝ) / 4 * ‖y‖)| := by + rw [max_comm 0 _, max_comm 0 _] + exact abs_max_sub_max_le_abs _ _ _ + _ = (q : ℝ) / 4 * |‖x‖ - ‖y‖| := by + rw [show (1 - (q : ℝ) / 4 * ‖x‖) - (1 - (q : ℝ) / 4 * ‖y‖) = + -((q : ℝ) / 4) * (‖x‖ - ‖y‖) by ring, abs_mul, abs_neg, + abs_of_nonneg (by positivity : 0 ≤ (q : ℝ) / 4)] + _ ≤ _ := by + simpa only [NNReal.coe_div, NNReal.coe_natCast, NNReal.coe_ofNat, dist_eq_norm] using + mul_le_mul_of_nonneg_left (abs_norm_sub_norm_le x y) (by positivity : 0 ≤ (q : ℝ) / 4) + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem residue_quotient_double_bound {N q : ℕ} (hq : 0 < q) (hN : q ≤ N) : + N ≤ 2 * q * (N / q) := by + have hpos : 1 ≤ N / q := Nat.le_div_iff_mul_le hq |>.mpr (by simpa using hN) + have hlt := Nat.lt_mul_div_succ N hq + nlinarith + +theorem exists_residue_circle_neighborhood_embedding {N q : ℕ} [NeZero N] + (hq : 0 < q) (hN : q ≤ N) (c : UnitAddCircle) : + ∃ e : Fin (N / q) ↪ ZMod N, + ∀ a, dist (ZMod.toAddCircle (e a)) c ≤ 2 / (q : ℝ) := by + obtain ⟨b, hb⟩ := circle_grid_cover (NeZero.pos N) c + have hqR : (0 : ℝ) < q := by exact_mod_cast hq + have hNR : (0 : ℝ) < N := by exact_mod_cast NeZero.pos N + have hqN : (q : ℝ) ≤ N := by exact_mod_cast hN + have hdiv : N / q ≤ N := Nat.div_le_self N q + let e : Fin (N / q) ↪ ZMod N := + ⟨fun a => (b.val : ZMod N) + a.val, by + intro a a' h + have hh : (a.val : ZMod N) = a'.val := add_left_cancel h + have ha : a.val < N := a.isLt.trans_le hdiv + have ha' : a'.val < N := a'.isLt.trans_le hdiv + have hv := congrArg ZMod.val hh + rw [ZMod.val_natCast_of_lt ha, ZMod.val_natCast_of_lt ha'] at hv + exact Fin.ext hv⟩ + refine ⟨e, fun a => ?_⟩ + have haq : (a.val : ℝ) * q ≤ N := by + exact_mod_cast (Nat.mul_le_mul_right q a.isLt.le).trans (Nat.div_mul_le_self N q) + have ha : (a.val : ℝ) / N ≤ 1 / q := by + apply (div_le_div_iff₀ hNR hqR).mpr + simpa only [one_mul] using haq + have hd : dist (ZMod.toAddCircle (e a)) (ZMod.toAddCircle (b.val : ZMod N)) ≤ + (a.val : ℝ) / N := by + change dist (ZMod.toAddCircle ((b.val : ZMod N) + (a.val : ZMod N))) _ ≤ _ + rw [map_add, dist_eq_norm, add_sub_cancel_left, ZMod.toAddCircle_natCast] + calc + _ ≤ ‖(a.val : ℝ) / N‖ := QuotientAddGroup.norm_mk_le_norm + _ = _ := Real.norm_of_nonneg (by positivity) + have hb' : dist (ZMod.toAddCircle (b.val : ZMod N)) c ≤ 1 / (N : ℝ) := by + simpa only [ZMod.toAddCircle_natCast, dist_comm] using hb + have hi : 1 / (N : ℝ) ≤ 1 / q := one_div_le_one_div_of_le hqR hqN + exact (dist_triangle _ _ _).trans ((add_le_add (hd.trans ha) (hb'.trans hi)).trans + (by ring_nf; exact le_rfl)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +noncomputable def centeredTorusTent {J : Type*} [Fintype J] (q : ℕ) + (c x : J → UnitAddCircle) : ℝ := ambientTorusTent q (x - c) + +theorem centeredTorusTent_range {J : Type*} [Fintype J] (q : ℕ) + (c x : J → UnitAddCircle) : 0 ≤ centeredTorusTent q c x ∧ centeredTorusTent q c x ≤ 1 := + ambientTorusTent_range q (x - c) + +theorem centeredTorusTent_lipschitz {J : Type*} [Fintype J] (q : ℕ) + (c : J → UnitAddCircle) : LipschitzWith ((q : ℝ≥0) / 4) (centeredTorusTent q c) := by + unfold centeredTorusTent + simpa only [mul_one, Function.comp_def, sub_eq_add_neg] using + (ambientTorusTent_lipschitz (J := J) q).comp (isometry_add_right (-c)).lipschitzWith + +theorem centeredTorusTent_coordinate_support {J : Type*} [Fintype J] {q : ℕ} + (hq : 0 < q) (c x : J → UnitAddCircle) (h : centeredTorusTent q c x ≠ 0) (j : J) : + dist (x j) (c j) < 4 / (q : ℝ) := by + have hnorm := ambientTorusTent_support hq (x - c) h + calc + dist (x j) (c j) = ‖(x - c) j‖ := dist_eq_norm _ _ + _ ≤ ‖x - c‖ := norm_le_pi_norm (x - c) j + _ < _ := hnorm + +theorem centeredTorusTent_residue_mean {J : Type*} [Fintype J] [DecidableEq J] (N : J → ℕ) + [∀ j, NeZero (N j)] {q : ℕ} (hq : 0 < q) (hN : ∀ j, q ≤ N j) + (c : J → UnitAddCircle) : + 1 / (2 * (2 * (q : ℝ)) ^ Fintype.card J) ≤ + 𝔼 u : (j : J) → ZMod (N j), centeredTorusTent q c (fun j => ZMod.toAddCircle (u j)) := by + classical + choose e he using fun j => exists_residue_circle_neighborhood_embedding hq (hN j) (c j) + let E : ((j : J) → Fin (N j / q)) → ((j : J) → ZMod (N j)) := fun a j => e j (a j) + have hinj : Function.Injective E := by + intro a b h + funext j + exact (e j).injective (congrFun h j) + let W : ((j : J) → ZMod (N j)) → ℝ := + fun u => centeredTorusTent q c (fun j => ZMod.toAddCircle (u j)) + have hhalf (a : (j : J) → Fin (N j / q)) : 1 / 2 ≤ W (E a) := by + apply ambientTorusTent_ge_half hq + apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr + intro j + simpa only [Pi.sub_apply, ← dist_eq_norm] using he j (a j) + have hsum : (Fintype.card ((j : J) → Fin (N j / q)) : ℝ) / 2 ≤ ∑ u, W u := by + have h := Finset.sum_le_sum_of_injOn (s := Finset.univ) (t := Finset.univ) + (f := fun _ : (j : J) → Fin (N j / q) => (1 / 2 : ℝ)) (g := W) + E hinj.injOn (Finset.subset_univ _) (fun a _ => hhalf a) + (fun u _ _ => (centeredTorusTent_range q c _).1) + simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one_div] using h + have hcard : (Fintype.card ((j : J) → ZMod (N j)) : ℝ) ≤ + (2 * (q : ℝ)) ^ Fintype.card J * (Fintype.card ((j : J) → Fin (N j / q)) : ℝ) := by + simp only [Fintype.card_pi, ZMod.card, Fintype.card_fin, Nat.cast_prod] + calc + (∏ j, (N j : ℝ)) ≤ ∏ j, 2 * (q : ℝ) * (N j / q : ℕ) := by + apply Finset.prod_le_prod₀ + · intro j _; positivity + · intro j _; exact_mod_cast residue_quotient_double_bound hq (hN j) + _ = _ := by rw [Finset.prod_mul_distrib]; simp + have hd : (0 : ℝ) < Fintype.card ((j : J) → ZMod (N j)) := by + exact_mod_cast Fintype.card_pos + have hqR : (0 : ℝ) < q := by exact_mod_cast hq + rw [Fintype.expect_eq_sum_div_card] + change 1 / (2 * (2 * (q : ℝ)) ^ Fintype.card J) ≤ (∑ u, W u) / _ + apply (le_div_iff₀ hd).mpr + calc + _ = (Fintype.card ((j : J) → ZMod (N j)) : ℝ) / + (2 * (2 * (q : ℝ)) ^ Fintype.card J) := by ring + _ ≤ _ := by + apply (div_le_iff₀ (by positivity : 0 < 2 * (2 * (q : ℝ)) ^ Fintype.card J)).mpr + nlinarith [mul_le_mul_of_nonneg_left hsum + (by positivity : 0 ≤ 2 * (2 * (q : ℝ)) ^ Fintype.card J)] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem localTent_translateSum_ge_half (d q : ℕ) (hq : 8 ≤ q) (x : Fin d → ℝ) : + 1 / 2 ≤ (localTentKernel d q hq).translateSum (torusGridCenter q) x := by + obtain ⟨a, b, hab⟩ := torusGrid_cover (show 0 < q by omega) x + exact (localTentKernel_ge_half hq _ hab).trans + (((localTentKernel d q hq).kernel_le_periodicValue (x - torusGridCenter q a) b).trans + ((localTentKernel d q hq).periodicValue_le_translateSum (torusGridCenter q) a x)) + +noncomputable def torusGridKernel (d q : ℕ) (hq : 8 ≤ q) (a : Fin d → Fin q) : PatchKernel d := + (localTentKernel d q hq).normalizedTranslate (torusGridCenter q) (1 / 2) (by norm_num) + (fun x => by simpa using localTent_translateSum_ge_half d q hq x) a + +theorem torusGridKernel_lip (d q : ℕ) (hq : 8 ≤ q) (a : Fin d → Fin q) : + (torusGridKernel d q hq a).lip = (q : ℝ≥0) * (2 * (q : ℝ≥0) ^ d + 1) := by + norm_num [torusGridKernel, PatchKernel.normalizedTranslate, localTentKernel] + ring + +theorem torusGridKernel_support (d q : ℕ) (hq : 8 ≤ q) (a : Fin d → Fin q) + (x : Fin d → ℝ) (hx : (torusGridKernel d q hq a).value x ≠ 0) : + dist x 0 ≤ 2 / (q : ℝ) := by + apply localTentKernel_support hq + intro h + apply hx + change (localTentKernel d q hq).value x / _ = 0 + rw [h, zero_div] + +theorem sum_torusGridKernel_periodicValue (d q : ℕ) (hq : 8 ≤ q) (x : Fin d → ℝ) : + (∑ a : Fin d → Fin q, (torusGridKernel d q hq a).periodicValue (x - torusGridCenter q a)) = 1 := + (localTentKernel d q hq).sum_normalizedTranslate_periodicValue (torusGridCenter q) + (1 / 2) (by norm_num) (fun x => by simpa using localTent_translateSum_ge_half d q hq x) x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators NNReal + +namespace PolynomialPatch + +theorem ofCoordinates_value {σ : Type*} {s d : ℕ} (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) + (t : σ → ℝ) : + (ofCoordinates w hw hws hmono P hP Φ).value t = Φ.periodicValue (fun i => aeval t (P i)) := by + change ((ofCoordinates w hw hws hmono P hP Φ).form.slots t).patchValue Φ = + (constantSlots (fun i => aeval t (P i))).patchValue Φ + apply congrArg (fun A : TriangularSlots d => A.patchValue Φ) + apply TriangularSlots.ext + intro x i + exact PolynomialSlots.ofCoordinates_center P hP t x i + +end PolynomialPatch + +variable {σ : Type*} {s d : ℕ} + +noncomputable def polynomialTorusCell (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)) + (q : ℕ) (hq : 8 ≤ q) (a : Fin d → Fin q) : PolynomialPatch σ s d := + PolynomialPatch.ofCoordinates w hw hws hmono (fun i => P i - C (torusGridCenter q a i)) + (fun i => (weightedSupportLE _ _).sub_mem (hP i) (weightedSupportLE_C _ _ _)) + (torusGridKernel d q hq a) + +theorem polynomialTorusCell_value (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)) + (q : ℕ) (hq : 8 ≤ q) (a : Fin d → Fin q) (t : σ → ℝ) : + (polynomialTorusCell w hw hws hmono P hP q hq a).value t = + (torusGridKernel d q hq a).periodicValue ((fun i => aeval t (P i)) - torusGridCenter q a) := by + rw [polynomialTorusCell, PolynomialPatch.ofCoordinates_value] + congr 1 + funext i + simp + +theorem polynomialTorusCell_lip (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)) + (q : ℕ) (hq : 8 ≤ q) (a : Fin d → Fin q) : + (polynomialTorusCell w hw hws hmono P hP q hq a).kernel.lip = + (q : ℝ≥0) * (2 * (q : ℝ≥0) ^ d + 1) := torusGridKernel_lip d q hq a + +theorem sum_polynomialTorusCell_value (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)) + (q : ℕ) (hq : 8 ≤ q) (t : σ → ℝ) : + (∑ a : Fin d → Fin q, (polynomialTorusCell w hw hws hmono P hP q hq a).value t) = 1 := by + simp only [polynomialTorusCell_value] + exact sum_torusGridKernel_periodicValue d q hq _ + +theorem exists_polynomialTorusCell_score {Ω : Type*} [Fintype Ω] + (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)) + (q : ℕ) (hq : 8 ≤ q) (t : Ω → σ → ℝ) (score : Ω → ℝ) {S : ℝ} + (hS : S ≤ 𝔼 x, score x) : + ∃ a : Fin d → Fin q, + S / (q : ℝ) ^ d ≤ 𝔼 x, score x * (polynomialTorusCell w hw hws hmono P hP q hq a).value (t x) := by + let : NeZero q := ⟨by omega⟩ + simpa only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] using + exists_weighted_partition_score score + (fun a x => (polynomialTorusCell w hw hws hmono P hP q hq a).value (t x)) + (fun x => sum_polynomialTorusCell_value w hw hws hmono P hP q hq (t x)) hS + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem exists_torusCell_lift_offset {Ω : Type*} {d m q : ℕ} + (hq : 8 ≤ q) (S : Set Ω) (M : Fin m → Fin d → ℤ) (a : Fin d → Fin q) + (x : Ω → Fin d → ℝ) (k : Ω → Fin d → ℤ) (β : Ω → Fin m → ℤ) {K : ℝ} + (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) (hmesh : 16 * K ≤ (q : ℝ)) + (hcell : ∀ u ∈ S, (torusGridKernel d q hq a).value + (fun j => (k u j : ℝ) - (x u - torusGridCenter q a) j) ≠ 0) + (hβ : ∀ u ∈ S, ∀ i, |(∑ j, (M i j : ℝ) * x u j) - β u i| ≤ 1 / 4) : + ∃ c : Fin m → ℤ, ∀ u ∈ S, β u = fun i => c i + ∑ j, M i j * k u j := by + have hqR : (0 : ℝ) < q := by exact_mod_cast (show 0 < q by omega) + apply exists_integer_lift_offset S M (torusGridCenter q a) x k β hM + (r := 2 / (q : ℝ)) (by positivity) _ _ hβ + · have hsmall : 4 * K / (q : ℝ) ≤ 1 / 4 := + (div_le_iff₀ hqR).mpr (by linarith) + calc + 2 * K * (2 / (q : ℝ)) + 1 / 2 = 4 * K / (q : ℝ) + 1 / 2 := by ring + _ < 1 := by linarith + · intro u hu j + have h := torusGridKernel_support d q hq a _ (hcell u hu) + have hc := (dist_le_pi_dist (fun j => (k u j : ℝ) - (x u - torusGridCenter q a) j) 0 j).trans h + simp only [Real.dist_eq, Pi.zero_apply, sub_zero, Pi.sub_apply] at hc + have heq : x u j - (k u j : ℝ) - torusGridCenter q a j = + -((k u j : ℝ) - (x u j - torusGridCenter q a j)) := by ring + simpa only [heq, abs_neg] using hc + +end Erdos3 + +end + +section + +namespace Erdos3 + +namespace PatchKernel + +variable {d : ℕ} + +noncomputable def integerLift (Φ : PatchKernel d) (x : Fin d → ℝ) : Fin d → ℤ := by + classical + exact if h : ∃ b : Fin d → ℤ, Φ.value (fun j => (b j : ℝ) - x j) ≠ 0 then h.choose else 0 + +theorem periodicValue_eq_integerLift (Φ : PatchKernel d) (x : Fin d → ℝ) : + Φ.periodicValue x = Φ.value (fun j => (Φ.integerLift x j : ℝ) - x j) := by + classical + by_cases h : ∃ b : Fin d → ℤ, Φ.value (fun j => (b j : ℝ) - x j) ≠ 0 + · simp only [integerLift, dite_eq_left h] + exact (constantSlots x).patchValue_eq_of_nonzero Φ h.choose_spec + · have hz : ∀ b : Fin d → ℤ, Φ.value (fun j => (b j : ℝ) - x j) = 0 := by simpa using h + have hp : Φ.periodicValue x = 0 := (constantSlots x).patchValue_eq_zero Φ hz + simpa only [integerLift, dite_eq_right h, hz] using hp + +theorem integerLift_contributes (Φ : PatchKernel d) (x : Fin d → ℝ) + (hx : Φ.periodicValue x ≠ 0) : Φ.value (fun j => (Φ.integerLift x j : ℝ) - x j) ≠ 0 := by + rwa [← Φ.periodicValue_eq_integerLift x] + +end PatchKernel + +theorem exists_torusCell_affine_recovery {Ω : Type*} {d m q : ℕ} + (hq : 8 ≤ q) (S : Set Ω) (M : Fin m → Fin d → ℤ) (a : Fin d → Fin q) + (x : Ω → Fin d → ℝ) (β : Ω → Fin m → ℤ) {K : ℝ} + (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) (hmesh : 16 * K ≤ (q : ℝ)) + (hactive : ∀ u ∈ S, (torusGridKernel d q hq a).periodicValue (x u - torusGridCenter q a) ≠ 0) + (hβ : ∀ u ∈ S, ∀ i, |(∑ j, (M i j : ℝ) * x u j) - β u i| ≤ 1 / 4) : + ∃ c : Fin m → ℤ, ∀ u ∈ S, β u = fun i => c i + ∑ j, M i j * + (torusGridKernel d q hq a).integerLift (x u - torusGridCenter q a) j := by + apply exists_torusCell_lift_offset hq S M a x + (fun u => (torusGridKernel d q hq a).integerLift (x u - torusGridCenter q a)) β hM hmesh + · intro u hu + exact (torusGridKernel d q hq a).integerLift_contributes _ (hactive u hu) + · exact hβ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +theorem torusGrid_log_card (d q : ℕ) : + Real.log (Fintype.card (Fin d → Fin q) : ℝ) = (d : ℝ) * Real.log q := by + simp only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow, Real.log_pow] + +theorem torusGridKernel_lip_add_one_le (d q : ℕ) (hq : 8 ≤ q) (a : Fin d → Fin q) : + ((torusGridKernel d q hq a).lip : ℝ) + 1 ≤ 4 * (q : ℝ) ^ (d + 1) := by + rw [torusGridKernel_lip] + push_cast + have hq1 : (1 : ℝ) ≤ q := by exact_mod_cast (show 1 ≤ q by omega) + have hpow : (1 : ℝ) ≤ (q : ℝ) ^ d := one_le_pow₀ hq1 + have hmul : (q : ℝ) ≤ (q : ℝ) * (q : ℝ) ^ d := by + nlinarith [mul_nonneg (Nat.cast_nonneg (α := ℝ) q) (sub_nonneg.mpr hpow)] + rw [pow_succ] + nlinarith + +theorem torusGridKernel_log_lip (d q : ℕ) (hq : 8 ≤ q) (a : Fin d → Fin q) : + Real.log (((torusGridKernel d q hq a).lip : ℝ) + 1) ≤ + Real.log 4 + ((d : ℝ) + 1) * Real.log q := by + have hq0 : (q : ℝ) ≠ 0 := by exact_mod_cast (show q ≠ 0 by omega) + have h := Real.log_le_log (by positivity) + (torusGridKernel_lip_add_one_le d q hq a) + simpa only [Real.log_mul (by norm_num : (4 : ℝ) ≠ 0) (pow_ne_zero _ hq0), + Real.log_pow, Nat.cast_add, Nat.cast_one] using h + +theorem exists_torus_lift_mesh {K : ℝ} (hK : 0 ≤ K) : + ∃ q : ℕ, 8 ≤ q ∧ 16 * K ≤ (q : ℝ) ∧ (q : ℝ) ≤ 17 * (K + 1) := by + let q := ⌈16 * (K + 1)⌉₊ + have hlo : 16 * (K + 1) ≤ (q : ℝ) := Nat.le_ceil _ + have hhi : (q : ℝ) < 16 * (K + 1) + 1 := Nat.ceil_lt_add_one (by positivity) + refine ⟨q, ?_, by linarith, by linarith⟩ + have hq : (8 : ℝ) ≤ q := by linarith + exact_mod_cast hq + +theorem exists_polynomialTorusCell_exp_score {σ Ω : Type*} [Fintype Ω] {s d : ℕ} + (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)) + (q : ℕ) (hq : 8 ≤ q) (t : Ω → σ → ℝ) (score : Ω → ℝ) (p : ℝ) + (hscore : Real.exp (-p) ≤ 𝔼 x, score x) : + ∃ a : Fin d → Fin q, + Real.exp (-(p + (d : ℝ) * Real.log q)) ≤ + 𝔼 x, score x * (polynomialTorusCell w hw hws hmono P hP q hq a).value (t x) := by + obtain ⟨a, ha⟩ := exists_polynomialTorusCell_score w hw hws hmono P hP q hq t score hscore + refine ⟨a, ?_⟩ + have hq0 : (0 : ℝ) < q := by exact_mod_cast (show 0 < q by omega) + rw [show -(p + (d : ℝ) * Real.log q) = -p - (d : ℝ) * Real.log q by ring, + Real.exp_sub, Real.exp_nat_mul, Real.exp_log hq0] + exact ha + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/TorusCircleActions.lean b/lean/OAI/Combinatorics/Progressions/Fourier/TorusCircleActions.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a23b44b4583e441b0262c1b100f610de1e5d711 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/TorusCircleActions.lean @@ -0,0 +1,117 @@ +import OAI.Combinatorics.Progressions.Estimates.PeriodicIsometricAction + +namespace OAI + +section + +namespace Erdos3.CircleFourier.IsometricCircleAction + +open MeasureTheory +open scoped BigOperators + +variable {X : Type*} [PseudoMetricSpace X] + +def Commutes (A B : IsometricCircleAction X) : Prop := + ∀ t u x, A.act t (B.act u x) = B.act u (A.act t x) + +theorem Commutes.symm {A B : IsometricCircleAction X} (h : A.Commutes B) : B.Commutes A := + fun t u x => (h u t x).symm + +theorem component_equivariant (A : IsometricCircleAction X) (N : ℕ) (h : ℤ) + {f : X → ℂ} (g : X → X) (z : ℂ) + (hg : ∀ t x, A.act t (g x) = g (A.act t x)) + (hf : ∀ x, f (g x) = z * f x) (x : X) : + A.component N h f (g x) = z * A.component N h f x := by + unfold component fejerComponent circleFourierComponent + change (fejerCoefficient N h : ℂ) * + (∫ t : Circle, character ((-(-h)) • t) * f (A.act t (g x)) ∂circleHaar) = + z * ((fejerCoefficient N h : ℂ) * + (∫ t : Circle, character ((-(-h)) • t) * f (A.act t x) ∂circleHaar)) + have heq : (∫ t : Circle, character ((-(-h)) • t) * f (A.act t (g x)) ∂circleHaar) = + z * (∫ t : Circle, character ((-(-h)) • t) * f (A.act t x) ∂circleHaar) := by + rw [← integral_const_mul] + apply integral_congr_ae + filter_upwards [] with t + rw [hg, hf] + ring + rw [heq] + ring + +theorem component_preserves_character (A B : IsometricCircleAction X) (hAB : A.Commutes B) + (N : ℕ) (h n : ℤ) {f : X → ℂ} + (hf : ∀ t x, f (B.act t x) = character (n • t) * f x) (t : Circle) (x : X) : + A.component N h f (B.act t x) = character (n • t) * A.component N h f x := + A.component_equivariant N h (B.act t) (character (n • t)) (fun u x => hAB u t x) (hf t) x + +theorem component_sum {ι : Type*} (A : IsometricCircleAction X) (N : ℕ) (h : ℤ) + (s : Finset ι) (f : ι → X → ℂ) (hf : ∀ i ∈ s, Continuous (f i)) (x : X) : + A.component N h (fun y => ∑ i ∈ s, f i y) x = ∑ i ∈ s, A.component N h (f i) x := by + let := A.toAddAction + let := A.toContinuousVAdd + unfold component fejerComponent circleFourierComponent + simp_rw [Finset.mul_sum] + rw [integral_finsetSum] + · exact Finset.mul_sum s _ _ + · intro i hi + exact integrable_circleFourierComponent (-h) (hf i hi) x + +end Erdos3.CircleFourier.IsometricCircleAction + +end + +section + +namespace Erdos3.CircleFourier + +open scoped BigOperators + +variable {ι X : Type*} [Fintype ι] [DecidableEq ι] [PseudoMetricSpace X] + [AddAction (ι → Circle) X] [ContinuousVAdd (ι → Circle) X] + +def torusCoordinateAction (hact : ∀ t : ι → Circle, Isometry (fun x : X => t +ᵥ x)) + (i : ι) : IsometricCircleAction X where + act t x := (Pi.single i t : ι → Circle) +ᵥ x + zero_act x := by simp + add_act t u x := by simp only [Pi.single_add, add_vadd] + continuous_act := by + have hs : Continuous (fun p : Circle × X => (Pi.single i p.1 : ι → Circle)) := by + apply continuous_pi + intro j + by_cases h : j = i + · subst j + simpa only [Pi.single_eq_same] using (continuous_fst : Continuous (fun p : Circle × X => p.1)) + · simpa only [Pi.single_eq_of_ne h] using + (continuous_const : Continuous (fun _p : Circle × X => (0 : Circle))) + exact hs.vadd continuous_snd + isometry_act t := hact (Pi.single i t) + +omit [Fintype ι] in +theorem torusCoordinateAction_commutes + (hact : ∀ t : ι → Circle, Isometry (fun x : X => t +ᵥ x)) (i j : ι) : + (torusCoordinateAction hact i).Commutes (torusCoordinateAction hact j) := by + intro t u x + change (Pi.single i t : ι → Circle) +ᵥ ((Pi.single j u : ι → Circle) +ᵥ x) = + (Pi.single j u : ι → Circle) +ᵥ ((Pi.single i t : ι → Circle) +ᵥ x) + rw [← add_vadd, ← add_vadd, add_comm] + +omit [PseudoMetricSpace X] [ContinuousVAdd (ι → Circle) X] in + +theorem torus_character_of_coordinate_characters (f : X → ℂ) (n : ι → ℤ) + (hf : ∀ (i : ι) (t : Circle) x, + f ((Pi.single i t : ι → Circle) +ᵥ x) = character (n i • t) * f x) + (t : ι → Circle) (x : X) : + f (t +ᵥ x) = (∏ i, character (n i • t i)) * f x := by + have hs (s : Finset ι) : ∀ x, f ((∑ i ∈ s, Pi.single i (t i) : ι → Circle) +ᵥ x) = + (∏ i ∈ s, character (n i • t i)) * f x := by + induction s using Finset.induction_on with + | empty => intro x; simp + | @insert i s hi ih => + intro x + rw [Finset.sum_insert hi, add_vadd, hf, ih, Finset.prod_insert hi, mul_assoc] + simpa only [Finset.univ_sum_single] using hs Finset.univ x + +end Erdos3.CircleFourier + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/TranslatedBohrDifference.lean b/lean/OAI/Combinatorics/Progressions/Fourier/TranslatedBohrDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..687c28996796458dd776c487538bdfce84dfc548 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/TranslatedBohrDifference.lean @@ -0,0 +1,602 @@ +import OAI.Combinatorics.Progressions.Estimates.LocalWeightedSifting +import OAI.Combinatorics.Progressions.Fourier.BohrTorusApproximation +import OAI.Combinatorics.Progressions.Fourier.FiniteFourierSmoothing + +namespace OAI + +section + +open Finset +open scoped BigOperators + +namespace Erdos3 + +noncomputable section + +variable {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] + +def massCoeff (w : G → ℝ) (ψ : AddChar G ℂ) : ℂ := + ∑ x : G, (w x : ℂ) * ψ x + +theorem massCoeff_realUniformMass (A : Finset G) (ψ : AddChar G ℂ) : + massCoeff (realUniformMass A) ψ = + ((A.card : ℝ)⁻¹ : ℂ) * Chang.spectrumSum A ψ := by + calc + massCoeff (realUniformMass A) ψ = + ∑ x ∈ A, ((A.card : ℝ)⁻¹ : ℂ) * ψ x := by + rw [massCoeff, ← Finset.sum_subset (s₁ := A) (s₂ := Finset.univ)] + · apply Finset.sum_congr rfl + intro x hx + simp [realUniformMass, hx] + · simp + · intro x hxU hxA + simp [realUniformMass, hxA] + _ = ((A.card : ℝ)⁻¹ : ℂ) * Chang.spectrumSum A ψ := by + rw [Chang.spectrumSum, Finset.mul_sum] + +theorem norm_massCoeff_realUniformMass_lt_half_of_not_mem_largeSpectrum + (A : Finset G) (hA : A.Nonempty) (ψ : AddChar G ℂ) + (hψ : ψ ∉ Chang.largeSpectrum A (1 / 2)) : + ‖massCoeff (realUniformMass A) ψ‖ < 1 / 2 := by + have hcard : (0 : ℝ) < A.card := by + exact_mod_cast hA.card_pos + have hspectrum : + ‖Chang.spectrumSum A ψ‖ < (1 / 2 : ℝ) * A.card := by + apply lt_of_not_ge + intro h + exact hψ (Chang.mem_largeSpectrum.mpr h) + calc + ‖massCoeff (realUniformMass A) ψ‖ = + (A.card : ℝ)⁻¹ * ‖Chang.spectrumSum A ψ‖ := by + rw [massCoeff_realUniformMass, norm_mul] + simp [norm_inv] + _ < (A.card : ℝ)⁻¹ * + ((1 / 2 : ℝ) * A.card) := + mul_lt_mul_of_pos_left hspectrum (inv_pos.mpr hcard) + _ = 1 / 2 := by field_simp + +omit [DecidableEq G] in + +theorem massCoeff_massConvolution (f g : G → ℝ) (ψ : AddChar G ℂ) : + massCoeff (massConvolution f g) ψ = massCoeff f ψ * massCoeff g ψ := by + unfold massCoeff massConvolution + push_cast + calc + ∑ x : G, (∑ y : G, (f y : ℂ) * (g (x - y) : ℂ)) * ψ x = + ∑ x : G, ∑ y : G, (f y : ℂ) * (g (x - y) : ℂ) * ψ x := by + apply Finset.sum_congr rfl + intro x hx + rw [Finset.sum_mul] + _ = ∑ y : G, ∑ x : G, (f y : ℂ) * (g (x - y) : ℂ) * ψ x := + Finset.sum_comm + _ = + ∑ y : G, ((f y : ℂ) * ψ y) * + ∑ z : G, (g z : ℂ) * ψ z := by + apply Finset.sum_congr rfl + intro y hy + rw [Finset.mul_sum] + refine Fintype.sum_equiv (Equiv.subRight y) _ _ fun z ↦ ?_ + have hψ : ψ z = ψ y * ψ (z - y) := by + calc + ψ z = ψ (y + (z - y)) := congrArg ψ (by simp) + _ = ψ y * ψ (z - y) := AddChar.map_add_eq_mul ψ y (z - y) + simp only [Equiv.subRight_apply] + rw [hψ] + ring + _ = (∑ y : G, (f y : ℂ) * ψ y) * + ∑ z : G, (g z : ℂ) * ψ z := by + simpa using + (Finset.sum_mul (univ : Finset G) (fun y ↦ (f y : ℂ) * ψ y) + (∑ z : G, (g z : ℂ) * ψ z)).symm + +theorem massCoeff_convolutionPower (f : G → ℝ) (ψ : AddChar G ℂ) : + ∀ n, massCoeff (convolutionPower f n) ψ = massCoeff f ψ ^ n := by + intro n + induction n with + | zero => + unfold massCoeff + rw [Fintype.sum_eq_single 0] + · simp [realUniformMass] + · intro y hy + simp [realUniformMass, hy] + | succ n ihn => + rw [convolutionPower_succ, massCoeff_massConvolution, ihn, pow_succ] + +omit [DecidableEq G] in + +theorem norm_massCoeff_le_sum {w : G → ℝ} (hw : ∀ x, 0 ≤ w x) + (ψ : AddChar G ℂ) : + ‖massCoeff w ψ‖ ≤ ∑ x : G, w x := by + unfold massCoeff + calc + ‖∑ x : G, (w x : ℂ) * ψ x‖ ≤ + ∑ x : G, ‖(w x : ℂ) * ψ x‖ := norm_sum_le _ _ + _ = ∑ x : G, w x := by + apply Finset.sum_congr rfl + intro x hx + simp [hw x] + +end + +end Erdos3 + +end + +section + +open Finset +open scoped BigOperators NNReal + +namespace Erdos3 + +noncomputable section + +variable {N : ℕ} [NeZero N] + +theorem convolutionPower_realUniformMass_support + (B : CyclicBohr.Set N) (σ : ℝ≥0) : + ∀ n x, convolutionPower (realUniformMass (B.ndilate σ).carrier) n x ≠ 0 → + x ∈ (B.ndilate ((n : ℝ≥0) * σ)).carrier := by + intro n + induction n with + | zero => + intro x hx + have hx0 : x = 0 := by + simpa using + (realUniformMass_ne_zero_iff (singleton_nonempty 0) x).mp hx + subst x + simpa only [Nat.cast_zero, zero_mul, CyclicBohr.Set.mem_iff, + CyclicBohr.Set.mem_carrier] using (B.ndilate 0).zero_mem + | succ n ihn => + intro x hx + rw [convolutionPower_succ, massConvolution] at hx + obtain ⟨y, -, hy⟩ := Finset.exists_ne_zero_of_sum_ne_zero hx + have hypow : convolutionPower (realUniformMass (B.ndilate σ).carrier) n y ≠ 0 := + (mul_ne_zero_iff.mp hy).1 + have hysmall : realUniformMass (B.ndilate σ).carrier (x - y) ≠ 0 := + (mul_ne_zero_iff.mp hy).2 + have hyB := ihn y hypow + have hxyB : x - y ∈ (B.ndilate σ).carrier := + (realUniformMass_ne_zero_iff + (B.ndilate σ).carrier_nonempty (x - y)).mp hysmall + have hadd := CyclicBohr.Set.add_mem_ndilate hyB hxyB + have hxsum : y + (x - y) = x := by simp + rw [hxsum] at hadd + simpa only [Nat.cast_add, Nat.cast_one, add_mul, one_mul, + CyclicBohr.Set.mem_iff, CyclicBohr.Set.mem_carrier] using hadd + +def bohrSmoothingMeasure (B : CyclicBohr.Set N) (σ : ℝ≥0) (n : ℕ) : (ZMod N) → ℝ := + massConvolution + (realUniformMass (B.ndilate (1 + (n : ℝ≥0) * σ)).carrier) + (convolutionPower (realUniformMass (B.ndilate σ).carrier) n) + +theorem bohrSmoothingMeasure_nonneg (B : CyclicBohr.Set N) (σ : ℝ≥0) (n : ℕ) (x : (ZMod N)) : + 0 ≤ bohrSmoothingMeasure B σ n x := by + exact massConvolution_nonneg + (realUniformMass_nonneg _) + (convolutionPower_nonneg (realUniformMass_nonneg _) n) x + +theorem sum_bohrSmoothingMeasure (B : CyclicBohr.Set N) (σ : ℝ≥0) (n : ℕ) : + ∑ x : (ZMod N), bohrSmoothingMeasure B σ n x = 1 := by + rw [bohrSmoothingMeasure, sum_massConvolution, + sum_realUniformMass (B.ndilate (1 + (n : ℝ≥0) * σ)).carrier_nonempty, + sum_convolutionPower + (sum_realUniformMass (B.ndilate σ).carrier_nonempty), one_mul] + +theorem bohrSmoothingMeasure_apply_of_mem + (B : CyclicBohr.Set N) (σ : ℝ≥0) (n : ℕ) {x : (ZMod N)} (hx : x ∈ B.carrier) : + bohrSmoothingMeasure B σ n x = + (((B.ndilate (1 + (n : ℝ≥0) * σ)).carrier.card : ℝ)⁻¹) := by + rw [bohrSmoothingMeasure, massConvolution_comm] + simp only [massConvolution] + calc + ∑ t : (ZMod N), convolutionPower (realUniformMass (B.ndilate σ).carrier) n t * + realUniformMass (B.ndilate (1 + (n : ℝ≥0) * σ)).carrier (x - t) = + ∑ t : (ZMod N), convolutionPower (realUniformMass (B.ndilate σ).carrier) n t * + (((B.ndilate (1 + (n : ℝ≥0) * σ)).carrier.card : ℝ)⁻¹) := by + apply Finset.sum_congr rfl + intro t ht + by_cases hνt : + convolutionPower (realUniformMass (B.ndilate σ).carrier) n t = 0 + · simp [hνt] + · have htB : t ∈ (B.ndilate ((n : ℝ≥0) * σ)).carrier := + convolutionPower_realUniformMass_support B σ n t hνt + have hxt : x - t ∈ + (B.ndilate (1 + (n : ℝ≥0) * σ)).carrier := by + exact CyclicBohr.Set.sub_mem_ndilate + (B := B) (r := 1) (s := (n : ℝ≥0) * σ) + (by simpa only [CyclicBohr.Set.ndilate_one, CyclicBohr.Set.mem_iff, + CyclicBohr.Set.mem_carrier] using hx) htB + rw [realUniformMass_apply_mem hxt] + _ = (∑ t : (ZMod N), + convolutionPower (realUniformMass (B.ndilate σ).carrier) n t) * + (((B.ndilate (1 + (n : ℝ≥0) * σ)).carrier.card : ℝ)⁻¹) := by + rw [Finset.sum_mul] + _ = (((B.ndilate (1 + (n : ℝ≥0) * σ)).carrier.card : ℝ)⁻¹) := by + rw [sum_convolutionPower + (sum_realUniformMass (B.ndilate σ).carrier_nonempty)] + simp + +theorem card_dilate_one_add_le_two_mul + {B : CyclicBohr.Set N} (hreg : B.IsRankRegular) {σ : ℝ≥0} (n : ℕ) + (hsmall : (n : ℝ≥0) * σ ≤ + 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) : + (B.ndilate (1 + (n : ℝ≥0) * σ)).carrier.card ≤ + 2 * B.carrier.card := by + let κ : ℝ≥0 := (n : ℝ≥0) * σ + let d : ℕ := 2 * max B.rank 1 + have hcards := hreg κ (by simpa [κ, d] using hsmall) + have hfactor : (1 + 100 * (d : ℝ) * (κ : ℝ)) ≤ 2 := by + have hsmallR : (κ : ℝ) ≤ 1 / (100 * (d : ℝ)) := by + exact_mod_cast (show κ ≤ 1 / (100 * (d : ℝ≥0)) by + simpa [κ, d] using hsmall) + have hd : (0 : ℝ) < d := by exact_mod_cast (show 0 < d by simp [d]) + calc + 1 + 100 * (d : ℝ) * (κ : ℝ) ≤ + 1 + 100 * (d : ℝ) * (1 / (100 * (d : ℝ))) := by gcongr + _ = 2 := by field_simp; ring + have hcardR : + ((B.ndilate (1 + κ)).carrier.card : ℝ) ≤ + 2 * (B.carrier.card : ℝ) := by + calc + ((B.ndilate (1 + κ)).carrier.card : ℝ) ≤ + (1 + 100 * (d : ℝ) * (κ : ℝ)) * (B.carrier.card : ℝ) := by + simpa [κ, d] using hcards.2 + _ ≤ 2 * (B.carrier.card : ℝ) := by gcongr + exact_mod_cast hcardR + +theorem realUniformMass_le_two_mul_bohrSmoothingMeasure + {B : CyclicBohr.Set N} (hreg : B.IsRankRegular) {σ : ℝ≥0} (n : ℕ) + (hsmall : (n : ℝ≥0) * σ ≤ + 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) (x : (ZMod N)) : + realUniformMass B.carrier x ≤ 2 * bohrSmoothingMeasure B σ n x := by + let κ : ℝ≥0 := (n : ℝ≥0) * σ + by_cases hx : x ∈ B.carrier + · rw [realUniformMass_apply_mem hx, + bohrSmoothingMeasure_apply_of_mem B σ n hx] + have hcard := card_dilate_one_add_le_two_mul hreg n hsmall + have hcardR : + (((B.ndilate (1 + κ)).carrier.card : ℕ) : ℝ) ≤ + 2 * (B.carrier.card : ℝ) := by + exact_mod_cast (show (B.ndilate (1 + κ)).carrier.card ≤ + 2 * B.carrier.card by simpa [κ] using hcard) + have hBpos : (0 : ℝ) < B.carrier.card := by + exact_mod_cast B.carrier_nonempty.card_pos + have hOuterPos : (0 : ℝ) < (B.ndilate (1 + κ)).carrier.card := by + exact_mod_cast (B.ndilate (1 + κ)).carrier_nonempty.card_pos + rw [show (1 + (n : ℝ≥0) * σ) = 1 + κ by rfl] + have hdiv : 1 / (B.carrier.card : ℝ) ≤ + 2 / ((B.ndilate (1 + κ)).carrier.card : ℝ) := by + rw [div_le_div_iff₀ hBpos hOuterPos] + simpa [mul_comm] using hcardR + simpa only [one_div, div_eq_mul_inv, one_mul] using hdiv + · rw [realUniformMass_apply_not_mem hx] + exact mul_nonneg (by norm_num) (bohrSmoothingMeasure_nonneg B σ n x) + +theorem norm_massCoeff_bohrSmoothingMeasure_le + (B : CyclicBohr.Set N) (σ : ℝ≥0) (n : ℕ) (ψ : AddChar (ZMod N) ℂ) : + ‖massCoeff (bohrSmoothingMeasure B σ n) ψ‖ ≤ + ‖massCoeff (realUniformMass (B.ndilate σ).carrier) ψ‖ ^ n := by + rw [bohrSmoothingMeasure, massCoeff_massConvolution, + massCoeff_convolutionPower, norm_mul, norm_pow] + have houter : + ‖massCoeff (realUniformMass + (B.ndilate (1 + (n : ℝ≥0) * σ)).carrier) ψ‖ ≤ 1 := by + simpa [sum_realUniformMass + (B.ndilate (1 + (n : ℝ≥0) * σ)).carrier_nonempty] using + norm_massCoeff_le_sum + (w := realUniformMass + (B.ndilate (1 + (n : ℝ≥0) * σ)).carrier) + (realUniformMass_nonneg _) ψ + exact mul_le_of_le_one_left (by positivity) houter + +end + +end Erdos3 + +end + +section + +open AddChar Finset +open scoped BigOperators NNReal + +namespace Erdos3 + +noncomputable section + +variable {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] + +private lemma normalizedSpectrum_eq (A : Finset G) (psi : AddChar G ℂ) : + (∑ x : G, (realUniformMass A x : ℂ) * psi x) = + ((A.card : ℂ)⁻¹) * Chang.spectrumSum A psi := by + classical + rw [Chang.spectrumSum, Finset.mul_sum] + calc + (∑ x : G, (realUniformMass A x : ℂ) * psi x) = + ∑ x : G, if x ∈ A then ((A.card : ℂ)⁻¹) * psi x else 0 := by + apply Finset.sum_congr rfl + intro x _ + by_cases hx : x ∈ A <;> simp [realUniformMass, hx] + _ = ∑ x ∈ A, ((A.card : ℂ)⁻¹) * psi x := by + rw [← Finset.sum_filter] + have hfilter : + (Finset.univ.filter fun x : G ↦ x ∈ A) = A := by + ext x + simp + rw [hfilter] + +private lemma normalizedSpectrum_translate (A : Finset G) + (psi : AddChar G ℂ) (t : G) : + (1 - psi t) * (∑ x : G, (realUniformMass A x : ℂ) * psi x) = + ∑ x : G, + ((realUniformMass A x - realUniformMass A (x - t) : ℝ) : ℂ) * + psi x := by + classical + have htranslate : + (∑ x : G, (realUniformMass A (x - t) : ℂ) * psi x) = + psi t * ∑ x : G, (realUniformMass A x : ℂ) * psi x := by + rw [← (Equiv.addRight t).sum_comp] + · change + (∑ x : G, (realUniformMass A ((x + t) - t) : ℂ) * psi (x + t)) = + psi t * ∑ x : G, (realUniformMass A x : ℂ) * psi x + simp_rw [add_sub_cancel_right, map_add_eq_mul] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + ring + · simp + push_cast + simp_rw [sub_mul] + rw [Finset.sum_sub_distrib, htranslate] + ring + +variable {N : ℕ} [NeZero N] + +theorem norm_one_sub_le_of_mem_largeSpectrum + {C : CyclicBohr.Set N} (hreg : C.IsRankRegular) {eta : ℝ} (heta : 0 < eta) + {sigma : ℝ≥0} + (hsigma : sigma ≤ 1 / (100 * (2 * max C.rank 1 : ℕ) : ℝ≥0)) + {psi : AddChar (ZMod N) ℂ} (hpsi : psi ∈ Chang.largeSpectrum C.carrier eta) + {t : (ZMod N)} (ht : t ∈ (C.ndilate sigma).carrier) : + ‖1 - psi t‖ ≤ + 400 * ((max C.rank 1 : ℕ) : ℝ) * (sigma : ℝ) / eta := by + classical + let F : ℂ := ∑ x : (ZMod N), (realUniformMass C.carrier x : ℂ) * psi x + have hcard : (0 : ℝ) < C.carrier.card := by + exact_mod_cast C.carrier_nonempty.card_pos + have hFnorm : ‖F‖ = ‖Chang.spectrumSum C.carrier psi‖ / C.carrier.card := by + dsimp [F] + rw [normalizedSpectrum_eq, norm_mul] + simp [div_eq_inv_mul] + have hlarge : eta ≤ ‖F‖ := by + rw [hFnorm, le_div_iff₀ hcard] + exact Chang.mem_largeSpectrum.mp hpsi + have hphase : + ‖1 - psi t‖ * ‖F‖ ≤ + ∑ x : (ZMod N), + |realUniformMass C.carrier (x - t) - + realUniformMass C.carrier x| := by + rw [← norm_mul, normalizedSpectrum_translate C.carrier psi t] + calc + ‖∑ x : (ZMod N), + ((realUniformMass C.carrier x - + realUniformMass C.carrier (x - t) : ℝ) : ℂ) * psi x‖ ≤ + ∑ x : (ZMod N), + ‖((realUniformMass C.carrier x - + realUniformMass C.carrier (x - t) : ℝ) : ℂ) * psi x‖ := + norm_sum_le _ _ + _ = ∑ x : (ZMod N), + |realUniformMass C.carrier (x - t) - + realUniformMass C.carrier x| := by + apply Finset.sum_congr rfl + intro x _ + rw [norm_mul] + rw [Complex.norm_real, Real.norm_eq_abs, abs_sub_comm] + simp + have htranslation := + CyclicBohr.Set.uniformMass_translation_le_of_rankRegular + hreg hsigma ht + have hmul : + ‖1 - psi t‖ * eta ≤ + 400 * ((max C.rank 1 : ℕ) : ℝ) * (sigma : ℝ) := by + calc + ‖1 - psi t‖ * eta ≤ ‖1 - psi t‖ * ‖F‖ := + mul_le_mul_of_nonneg_left hlarge (norm_nonneg _) + _ ≤ ∑ x : (ZMod N), + |realUniformMass C.carrier (x - t) - + realUniformMass C.carrier x| := hphase + _ ≤ 400 * ((max C.rank 1 : ℕ) : ℝ) * (sigma : ℝ) := htranslation + exact (le_div_iff₀ heta).2 hmul + +theorem norm_one_sub_le_of_mem_largeSpectrum_half + {C : CyclicBohr.Set N} (hreg : C.IsRankRegular) {sigma : ℝ≥0} + (hsigma : sigma ≤ 1 / (100 * (2 * max C.rank 1 : ℕ) : ℝ≥0)) + {psi : AddChar (ZMod N) ℂ} (hpsi : psi ∈ Chang.largeSpectrum C.carrier (1 / 2)) + {t : (ZMod N)} (ht : t ∈ (C.ndilate sigma).carrier) : + ‖1 - psi t‖ ≤ 800 * ((max C.rank 1 : ℕ) : ℝ) * (sigma : ℝ) := by + classical + have h := norm_one_sub_le_of_mem_largeSpectrum hreg (eta := (1 / 2 : ℝ)) + (by norm_num) hsigma hpsi ht + convert h using 1 + ring + +end + +end Erdos3 + +end + +section + +namespace Erdos3.LocalConvolution + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem exists_dense_sets_of_bohr_correlation_moment + (L : CyclicBohr.Set N) (hL : L.IsRankRegular) (S T K : Finset (ZMod N)) + (hS : S.Nonempty) (hT : T.Nonempty) {kappa : ℝ≥0} + (hSL : S ⊆ (L.ndilate kappa).carrier) + (hkappa : kappa ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (f : ZMod N → ℝ) (hfsupport : ∀ x, x ∉ L.carrier → f x = 0) + {M alpha threshold epsilon : ℝ} (hM : 0 < M) (halpha : 0 < alpha) + (hthreshold : 0 ≤ threshold) (hepsilon : 0 < epsilon) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ M) (q : ℕ) + (hmoment : alpha ^ q ≤ 𝔼 a ∈ S, 𝔼 b ∈ T, correlation L.carrier f f (a - b) ^ q) + (hbad : ∀ a ∈ S, ∀ b ∈ T, a - b ∉ K → correlation L.carrier f f (a - b) ≤ threshold) + (hseparation : threshold ^ q ≤ epsilon / 2 * alpha ^ q) : + ∃ A ⊆ S, ∃ B ⊆ T, A.Nonempty ∧ B.Nonempty ∧ + ((alpha / (2 * M ^ 2)) ^ q / 2) * S.card ≤ A.card ∧ + ((alpha / (2 * M ^ 2)) ^ q / 2) * T.card ≤ B.card ∧ + 1 - epsilon ≤ 𝔼 a ∈ A, 𝔼 b ∈ B, if a - b ∈ K then (1 : ℝ) else 0 := by + let U := (L.ndilate (1 + kappa)).carrier + have hU : U.Nonempty := (L.ndilate (1 + kappa)).carrier_nonempty + have hUcard : U.card ≤ 2 * L.carrier.card := by + simpa only [Nat.cast_one, one_mul] using + Erdos3.card_dilate_one_add_le_two_mul hL 1 (by simpa only [Nat.cast_one, one_mul] using hkappa) + have hsupport : ∀ a ∈ S, ∀ b ∈ T, ∀ x, x ∉ U → f (x + a) * f (x + b) = 0 := by + intro a ha b _ x hx + have hxa : x + a ∉ L.carrier := by + intro h + have h₁ : x + a ∈ L.ndilate (1 : ℝ≥0) := by + simpa only [CyclicBohr.Set.ndilate_one, CyclicBohr.Set.mem_iff, + CyclicBohr.Set.mem_carrier] using h + have h₂ := CyclicBohr.Set.sub_mem_ndilate h₁ (hSL ha) + exact hx (by simpa only [U, add_sub_cancel_right, CyclicBohr.Set.mem_iff, + CyclicBohr.Set.mem_carrier] using h₂) + rw [hfsupport _ hxa, zero_mul] + obtain ⟨A, hAS, B, hBT, hA, hB, hAdensity, hBdensity, hprob⟩ := + exists_dense_sets_of_correlation_moment L.carrier U S T K L.carrier_nonempty hU hS hT + f hM halpha hthreshold hepsilon hf hsupport q hmoment hbad hseparation + have hLc : (0 : ℝ) < L.carrier.card := by exact_mod_cast L.card_pos + have hUc : (0 : ℝ) < U.card := by exact_mod_cast hU.card_pos + have hUcardR : (U.card : ℝ) ≤ 2 * L.carrier.card := by exact_mod_cast hUcard + have hratio : 1 / (2 * M ^ 2) ≤ (L.carrier.card : ℝ) / ((U.card : ℝ) * M ^ 2) := by + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + nlinarith [mul_le_mul_of_nonneg_right hUcardR (sq_nonneg M)] + have hbase : alpha / (2 * M ^ 2) ≤ + (L.carrier.card : ℝ) / ((U.card : ℝ) * M ^ 2) * alpha := by + simpa only [one_div, div_eq_mul_inv, mul_comm, one_mul] using + mul_le_mul_of_nonneg_right hratio halpha.le + have hdensity := div_le_div_of_nonneg_right + (pow_le_pow_left₀ (by positivity : 0 ≤ alpha / (2 * M ^ 2)) hbase q) + (by norm_num : (0 : ℝ) ≤ 2) + exact ⟨A, hAS, B, hBT, hA, hB, + (mul_le_mul_of_nonneg_right hdensity (Nat.cast_nonneg S.card)).trans hAdensity, + (mul_le_mul_of_nonneg_right hdensity (Nat.cast_nonneg T.card)).trans hBdensity, hprob⟩ + +end Erdos3.LocalConvolution + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped NNReal Pointwise + +variable {N : ℕ} [NeZero N] + +theorem card_add_le_two_mul_of_small_bohr + (B : Set N) (hBreg : B.IsRankRegular) {kappa : ℝ≥0} + (hkappa : kappa ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + {A S : Finset (ZMod N)} (z : ZMod N) + (hA : ∀ a ∈ A, a - z ∈ B.carrier) (hS : S ⊆ (B.ndilate kappa).carrier) : + (A + S).card ≤ 2 * B.carrier.card := by + have hsub : A + S ⊆ (B.ndilate (1 + kappa)).carrier.image (fun x => z + x) := by + intro x hx + obtain ⟨a, ha, s, hs, rfl⟩ := Finset.mem_add.mp hx + have haB : a - z ∈ B.ndilate (1 : ℝ≥0) := by + simpa only [ndilate_one, mem_iff, mem_carrier] using hA a ha + have hadd := add_mem_ndilate haB (hS hs) + refine Finset.mem_image.mpr ⟨(a - z) + s, hadd, ?_⟩ + abel + have houter : (B.ndilate (1 + kappa)).carrier.card ≤ 2 * B.carrier.card := by + simpa only [Nat.cast_one, one_mul] using + Erdos3.card_dilate_one_add_le_two_mul hBreg 1 (by simpa only [Nat.cast_one, one_mul] using hkappa) + exact (Finset.card_le_card hsub).trans (Finset.card_image_le.trans houter) + +noncomputable def initialSamplingScale (B : Set N) : ℝ≥0 := + 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0) + +theorem initialSamplingScale_pos (B : Set N) : 0 < B.initialSamplingScale := by + unfold initialSamplingScale + positivity + +theorem initialSamplingScale_le_one (B : Set N) : B.initialSamplingScale ≤ 1 := by + unfold initialSamplingScale + rw [div_le_one (by positivity)] + exact_mod_cast (show 1 ≤ 100 * (2 * max B.rank 1) by omega) + +theorem exists_initial_regular_sampling_bohr + (B : Set N) (hBpos : 0 < B.radius) (hBreg : B.IsRankRegular) : + ∃ C : Set N, C.frequencies = B.frequencies ∧ C.IsRankRegular ∧ + (B.initialSamplingScale : ℝ) * B.radius / 2 ≤ C.radius ∧ + C.radius ≤ B.initialSamplingScale * B.radius ∧ C.carrier ⊆ B.carrier ∧ + ∀ (A : Finset (ZMod N)) (z : ZMod N), + (∀ a ∈ A, a - z ∈ B.carrier) → (A + C.carrier).card ≤ 2 * B.carrier.card := by + obtain ⟨C, hfreq, hreg, hlo, hhi, hsub, _⟩ := + exists_controlled_regular_subdilate B hBpos B.initialSamplingScale + B.initialSamplingScale_pos B.initialSamplingScale_le_one + have hCB : C.carrier ⊆ B.carrier := by + apply hsub.trans + simpa only [ndilate_one] using + carrier_ndilate_mono (B := B) B.initialSamplingScale_le_one + refine ⟨C, hfreq, hreg, hlo, hhi, hCB, ?_⟩ + intro A z hA + exact card_add_le_two_mul_of_small_bohr B hBreg le_rfl z hA hsub + +theorem sumset_le_exp_of_relative_density + (B : Set N) {A S : Finset (ZMod N)} {p : ℝ} + (hsum : (A + S).card ≤ 2 * B.carrier.card) + (hdensity : Real.exp (-p) * B.carrier.card ≤ A.card) : + ((A + S).card : ℝ) ≤ (2 * Real.exp p) * A.card := by + have hsize : (B.carrier.card : ℝ) ≤ Real.exp p * A.card := by + calc + (B.carrier.card : ℝ) = Real.exp p * (Real.exp (-p) * B.carrier.card) := by + rw [← mul_assoc, ← Real.exp_add] + simp + _ ≤ Real.exp p * A.card := + mul_le_mul_of_nonneg_left hdensity (Real.exp_pos p).le + have hsumR : ((A + S).card : ℝ) ≤ 2 * B.carrier.card := by exact_mod_cast hsum + nlinarith + +end Erdos3.CyclicBohr.Set + +end + +section + +namespace Erdos3.CyclicBohr.Set + +open scoped Pointwise NNReal + +variable {N : ℕ} [NeZero N] + +theorem card_sub_translated_small_le_two_mul + (S : Set N) (hS : S.IsRankRegular) {kappa : ℝ≥0} + (hkappa : kappa ≤ 1 / (100 * (2 * max S.rank 1 : ℕ) : ℝ≥0)) + (C : Finset (ZMod N)) (hC : C ⊆ (S.ndilate kappa).carrier) (z : ZMod N) : + (S.carrier - C.image (fun t => z + t)).card ≤ 2 * S.carrier.card := by + have hsub : S.carrier - C.image (fun t => z + t) ⊆ + (S.ndilate (1 + kappa)).carrier.image (fun x => x - z) := by + intro x hx + obtain ⟨a, ha, b, hb, rfl⟩ := Finset.mem_sub.mp hx + obtain ⟨t, ht, rfl⟩ := Finset.mem_image.mp hb + have haS : a ∈ S.ndilate (1 : ℝ≥0) := by + simpa only [ndilate_one, mem_iff, mem_carrier] using ha + have hdiff := sub_mem_ndilate haS (hC ht) + refine Finset.mem_image.mpr ⟨a - t, hdiff, ?_⟩ + abel + have houter : (S.ndilate (1 + kappa)).carrier.card ≤ 2 * S.carrier.card := by + simpa only [Nat.cast_one, one_mul] using + Erdos3.card_dilate_one_add_le_two_mul hS 1 (by simpa only [Nat.cast_one, one_mul] using hkappa) + exact (Finset.card_le_card hsub).trans (Finset.card_image_le.trans houter) + +end Erdos3.CyclicBohr.Set + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/TranslationPhaseCharacterBounds.lean b/lean/OAI/Combinatorics/Progressions/Fourier/TranslationPhaseCharacterBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..b61fa7f330e2e8e1b913b39304322df6f6c2533a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/TranslationPhaseCharacterBounds.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Polynomial.TranslationPhaseQuotient + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +variable {B : Type*} [Fintype B] + +theorem translationPhaseCharacter_left_increment_bound + (D₀ : MvPolynomial B ℝ) (z g : PolynomialTranslationGroupOver ℝ B) + (β : B → ℝ) {d : ℕ} {ε : ℝ} (hε : 0 ≤ ε) + (hdegree : D₀.totalDegree ≤ d) + (hres : ∀ i, |β i - g.base i| ≤ 1) + (hnew : ∀ i, |β i - g.base i - z.base i| ≤ 1) + (hbase : ∀ i, |z.base i| ≤ ε) (hmass : realPolynomialMass z.polynomial ≤ ε) : + ‖(Real.fourierChar (translationPhaseArgument D₀ (z * g) β) : ℂ) - + (Real.fourierChar (translationPhaseArgument D₀ g β) : ℂ)‖ ≤ + (2 * Real.pi) * (1 + realPolynomialMass D₀ * Fintype.card B * d) * ε := by + have hphase := translationPhaseArgument_left_increment_bound D₀ z g β + hε hdegree hres hnew hbase hmass + exact (real_fourierChar_norm_sub_le _ _).trans + ((mul_le_mul_of_nonneg_left hphase (by positivity)).trans_eq (by ring)) + +theorem translationPhaseCharacter_left_increment_mass_bound + (D₀ : MvPolynomial B ℝ) (z g : PolynomialTranslationGroupOver ℝ B) + (β : B → ℝ) {d : ℕ} {ε M : ℝ} (hε : 0 ≤ ε) + (hdegree : D₀.totalDegree ≤ d) (hD : realPolynomialMass D₀ ≤ M) + (hres : ∀ i, |β i - g.base i| ≤ 1) + (hnew : ∀ i, |β i - g.base i - z.base i| ≤ 1) + (hbase : ∀ i, |z.base i| ≤ ε) (hmass : realPolynomialMass z.polynomial ≤ ε) : + ‖(Real.fourierChar (translationPhaseArgument D₀ (z * g) β) : ℂ) - + (Real.fourierChar (translationPhaseArgument D₀ g β) : ℂ)‖ ≤ + (2 * Real.pi) * (1 + M * Fintype.card B * d) * ε := by + apply (translationPhaseCharacter_left_increment_bound D₀ z g β hε hdegree + hres hnew hbase hmass).trans + gcongr + +theorem translationPhaseFunction_left_increment_on_chart_bound + (D₀ : MvPolynomial B ℝ) (z g : PolynomialTranslationGroupOver ℝ B) + (β : B → ℤ) {d : ℕ} {ε M : ℝ} (hε : 0 ≤ ε) + (hdegree : D₀.totalDegree ≤ d) (hD : realPolynomialMass D₀ ≤ M) + (hchart : ∀ i, |g.base i - (β i : ℝ)| < 1 / 2) + (hchart' : ∀ i, |(z * g).base i - (β i : ℝ)| < 1 / 2) + (hbase : ∀ i, |z.base i| ≤ ε) (hmass : realPolynomialMass z.polynomial ≤ ε) : + ‖translationPhaseFunction D₀ (z * g) - translationPhaseFunction D₀ g‖ ≤ + (2 * Real.pi) * (1 + M * Fintype.card B * d) * ε := by + rw [translationPhaseFunction_on_chart D₀ (z * g) β hchart', + translationPhaseFunction_on_chart D₀ g β hchart] + apply translationPhaseCharacter_left_increment_mass_bound D₀ z g + (fun i => (β i : ℝ)) hε hdegree hD ?_ ?_ hbase hmass + · intro i + rw [abs_sub_comm] + exact (hchart i).le.trans (by norm_num) + · intro i + have he : (β i : ℝ) - g.base i - z.base i = + -((z * g).base i - (β i : ℝ)) := by + simp only [PolynomialTranslationGroupOver.base_mul, Pi.add_apply] + ring + rw [he, abs_neg] + exact (hchart' i).le.trans (by norm_num) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/UnbalancedBohrShape.lean b/lean/OAI/Combinatorics/Progressions/Fourier/UnbalancedBohrShape.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e0925da43e36ec2d8f5722e4b1d3156b97b003b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/UnbalancedBohrShape.lean @@ -0,0 +1,578 @@ +import OAI.Combinatorics.Progressions.Estimates.LocalizedSiftingAlmostPeriods +import OAI.Combinatorics.Progressions.Estimates.MatchedFlatDecay +import OAI.Combinatorics.Progressions.Estimates.PeelingCellCaps +import OAI.Combinatorics.Progressions.Estimates.PeelingChildBound +import OAI.Combinatorics.Progressions.Estimates.RefinementErrorNormalization + +namespace OAI + +section + +namespace Erdos3.Peeling + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +def admissibleBohrShape (B : CyclicBohr.Set N) (scale : ℝ≥0) (rankExtra : ℕ) + (minimumWidth : ℝ) (C : CyclicBohr.Set N) : Prop := + C.IsRankRegular ∧ C.carrier ⊆ (B.ndilate scale).carrier ∧ + C.rank ≤ B.rank + rankExtra ∧ minimumWidth ≤ C.radius + +def admissibleBohrCarriers (B : CyclicBohr.Set N) (scale : ℝ≥0) (rankExtra : ℕ) + (minimumWidth : ℝ) (A : Finset (ZMod N)) : Prop := + ∃ C : CyclicBohr.Set N, admissibleBohrShape B scale rankExtra minimumWidth C ∧ A = C.carrier + +theorem removed_cell_has_admissible_shape + {B : CyclicBohr.Set N} {scale : ℝ≥0} {rankExtra : ℕ} {minimumWidth K kappa : ℝ} + {f g : ZMod N → ℝ} {cs : List (Finset (ZMod N))} + (h : Chain B.carrier (translatedCellFamily (admissibleBohrCarriers B scale rankExtra minimumWidth)) + K kappa f g cs) {A : Finset (ZMod N)} (hA : A ∈ cs) : + ∃ C : CyclicBohr.Set N, ∃ z : ZMod N, + admissibleBohrShape B scale rankExtra minimumWidth C ∧ A = C.carrier.image (fun t => z + t) := by + obtain ⟨D, ⟨C, hC, hD⟩, z, hAz⟩ := h.admissible_mem A hA + exact ⟨C, z, hC, by simpa only [hD] using hAz⟩ + +theorem exists_budgeted_bohr_peeling + (B : CyclicBohr.Set N) (scale : ℝ≥0) (rankExtra : ℕ) (minimumWidth : ℝ) + {K kappa : ℝ} (hK : 0 < K) (hkappa : 0 < kappa) (f g : ZMod N → ℝ) + (hf : ∀ x, 0 ≤ f x) (hg : ∀ x, 0 ≤ g x) + (hfsupport : ∀ x, x ∉ B.carrier → f x = 0) (hgsupport : ∀ x, x ∉ B.carrier → g x = 0) : + let Shapes := admissibleBohrCarriers B scale rankExtra minimumWidth + ∃ f' g' cs ds, Chain B.carrier (translatedCellFamily Shapes) K kappa f f' cs ∧ + Chain B.carrier (translatedCellFamily Shapes) K kappa g g' ds ∧ + cs.length + ds.length ≤ (positiveSupport f).card + (positiveSupport g).card ∧ + (∀ x, 0 ≤ f' x ∧ f' x ≤ f x) ∧ (∀ x, 0 ≤ g' x ∧ g' x ≤ g x) ∧ + (∀ x, x ∉ B.carrier → f' x = 0) ∧ (∀ x, x ∉ B.carrier → g' x = 0) ∧ + (1 / 4 : ℝ) * K ^ (3 / 4 : ℝ) * + (potentialCost B.carrier (𝔼 x ∈ B.carrier, g x) f cs + + potentialCost B.carrier (𝔼 x ∈ B.carrier, f' x) g ds) ≤ + ((𝔼 x ∈ B.carrier, f x) * (𝔼 x ∈ B.carrier, g x)) ^ (1 / 4 : ℝ) - + ((𝔼 x ∈ B.carrier, f' x) * (𝔼 x ∈ B.carrier, g' x)) ^ (1 / 4 : ℝ) ∧ + coefficientCost B.carrier cs + coefficientCost B.carrier ds ≤ + ((𝔼 x ∈ B.carrier, f x) + 𝔼 x ∈ B.carrier, g x) / (K * kappa) ∧ + ((𝔼 x ∈ B.carrier, f' x) < kappa ∨ (𝔼 x ∈ B.carrier, g' x) < kappa ∨ + ((∀ C, admissibleBohrShape B scale rankExtra minimumWidth C → ∀ z, + cellAverage C.carrier f' z ≤ K * (𝔼 x ∈ B.carrier, f' x)) ∧ + (∀ C, admissibleBohrShape B scale rankExtra minimumWidth C → ∀ z, + cellAverage C.carrier g' z ≤ K * (𝔼 x ∈ B.carrier, g' x)))) := by + intro Shapes + obtain ⟨f', g', cs, ds, hF, hG, hterminal⟩ := + exists_terminal_pair_with_cell_caps B.carrier Shapes hK hkappa f g + refine ⟨f', g', cs, ds, hF, hG, + Nat.add_le_add (hF.length_le_support hK hkappa) (hG.length_le_support hK hkappa), + hF.bounds hf, hG.bounds hg, hF.supported hf hfsupport, hG.supported hg hgsupport, + pair_potential_budget hF hG hK hkappa hf hg hfsupport hgsupport, + pair_coefficientCost_le hF hG hK hkappa hf hg hfsupport hgsupport, ?_⟩ + rcases hterminal with hfsmall | hgsmall | ⟨hfcap, hgcap⟩ + · exact Or.inl hfsmall + · exact Or.inr (Or.inl hgsmall) + · exact Or.inr (Or.inr ⟨fun C hC z => hfcap C.carrier ⟨C, hC, rfl⟩ z, + fun C hC z => hgcap C.carrier ⟨C, hC, rfl⟩ z⟩) + +end Erdos3.Peeling + +end + +section + +namespace Erdos3.LocalConvolution + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem exists_bohr_average_square_mean + (L A B : Finset (ZMod N)) (hL : L.Nonempty) (hA : A.Nonempty) (hB : B.Nonempty) + (R : CyclicBohr.Set N) (hRpos : 0 < R.radius) (hRreg : R.IsRankRegular) + (f : ZMod N → ℝ) (hsupport : ∀ x, x ∉ L → f x = 0) + {M beta epsilon : ℝ} (hf : ∀ x, 0 ≤ f x ∧ f x ≤ M) (hepsilon : 0 < epsilon) + (hlarge : beta ≤ 𝔼 a ∈ A, 𝔼 b ∈ B, 𝔼 t ∈ R.carrier, correlation L f f (a - b + t)) : + let sigma := localizedAverageScale R.rank (M ^ 2) epsilon + ∃ C : CyclicBohr.Set N, C.frequencies = R.frequencies ∧ C.IsRankRegular ∧ 0 < C.radius ∧ + (sigma : ℝ) * R.radius / 4 ≤ C.radius ∧ C.radius ≤ sigma * R.radius / 2 ∧ + C.carrier ⊆ R.carrier ∧ + beta - epsilon ≤ (∑ x, (𝔼 c ∈ C.carrier, f (x + c)) ^ 2) / L.card := by + intro sigma + obtain ⟨hsigma0, hsigma, herror⟩ := localizedAverageScale_spec R.rank (sq_nonneg M) hepsilon + change 0 < sigma at hsigma0 + change sigma ≤ _ at hsigma + change M ^ 2 * (400 * (max R.rank 1 : ℕ) * (sigma : ℝ)) ≤ epsilon at herror + have hsigma1 : sigma ≤ 1 := by + apply hsigma.trans + rw [div_le_one (by positivity)] + exact_mod_cast (show 1 ≤ 100 * (2 * max R.rank 1) by omega) + let kappa : ℝ≥0 := sigma / 2 + have hkappa0 : 0 < kappa := by dsimp [kappa]; positivity + have hkappa1 : kappa ≤ 1 := + (div_le_self hsigma0.le (by norm_num : (1 : ℝ≥0) ≤ 2)).trans hsigma1 + have hkappasum : kappa + kappa = sigma := by dsimp [kappa]; ring + obtain ⟨C, hfreq, hreg, hlo, hhi, hsub, _⟩ := + R.exists_controlled_regular_subdilate hRpos kappa hkappa0 hkappa1 + have hkappaR : (0 : ℝ) < kappa := by exact_mod_cast hkappa0 + have hCpos : 0 < C.radius := (show 0 < (kappa : ℝ) * R.radius / 2 by positivity).trans_le hlo + have hlo' : (sigma : ℝ) * R.radius / 4 ≤ C.radius := by + have h : (kappa : ℝ) * R.radius / 2 = (sigma : ℝ) * R.radius / 4 := by + dsimp [kappa] + ring + rwa [h] at hlo + have hhi' : C.radius ≤ (sigma : ℝ) * R.radius / 2 := by + have h : (kappa : ℝ) * R.radius = (sigma : ℝ) * R.radius / 2 := by + dsimp [kappa] + ring + rwa [h] at hhi + have hCR : C.carrier ⊆ R.carrier := by + apply hsub.trans + simpa only [CyclicBohr.Set.ndilate_one] using + CyclicBohr.Set.carrier_ndilate_mono (B := R) hkappa1 + have hTV : ∀ c ∈ C.carrier, ∀ d ∈ C.carrier, + (∑ x, |realUniformMass R.carrier (x - (c - d)) - realUniformMass R.carrier x|) ≤ + 400 * (max R.rank 1 : ℕ) * (sigma : ℝ) := by + intro c hc d hd + have hdiff := CyclicBohr.Set.sub_mem_ndilate (hsub hc) (hsub hd) + rw [hkappasum] at hdiff + exact CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hRreg hsigma hdiff + have henergy := triple_smoothed_correlation_le_square_mean L A B R.carrier C.carrier + hL hA hB R.carrier_nonempty C.carrier_nonempty f hsupport hf hTV + refine ⟨C, hfreq, hreg, hCpos, hlo', hhi', hCR, ?_⟩ + linarith + +end Erdos3.LocalConvolution + +end + +section + +namespace Erdos3.LocalConvolution + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem exists_bohr_average_local_second_moment + (L : CyclicBohr.Set N) (hL : L.IsRankRegular) + (A B : Finset (ZMod N)) (hA : A.Nonempty) (hB : B.Nonempty) + (R : CyclicBohr.Set N) (hRpos : 0 < R.radius) (hRreg : R.IsRankRegular) + {kappa : ℝ≥0} (hRL : R.carrier ⊆ (L.ndilate kappa).carrier) + (hkappa : kappa ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (f : ZMod N → ℝ) (hsupport : ∀ x, x ∉ L.carrier → f x = 0) + {M beta epsilon : ℝ} (hf : ∀ x, 0 ≤ f x ∧ f x ≤ M) (hepsilon : 0 < epsilon) + (hlarge : beta ≤ 𝔼 a ∈ A, 𝔼 b ∈ B, 𝔼 t ∈ R.carrier, correlation L.carrier f f (a - b + t)) : + let sigma := localizedAverageScale R.rank (M ^ 2) epsilon + ∃ C : CyclicBohr.Set N, C.frequencies = R.frequencies ∧ C.IsRankRegular ∧ 0 < C.radius ∧ + (sigma : ℝ) * R.radius / 4 ≤ C.radius ∧ C.radius ≤ sigma * R.radius / 2 ∧ + C.carrier ⊆ R.carrier ∧ + beta - epsilon - 200 * (max L.rank 1 : ℕ) * (kappa : ℝ) * M ^ 2 ≤ + 𝔼 x ∈ L.carrier, (𝔼 c ∈ C.carrier, f (x + c)) ^ 2 := by + intro sigma + obtain ⟨C, hfreq, hreg, hpos, hlo, hhi, hCR, henergy⟩ := + exists_bohr_average_square_mean L.carrier A B L.carrier_nonempty hA hB R hRpos hRreg + f hsupport hf hepsilon hlarge + have hlocal := square_mean_le_local_add_boundary L hL C.carrier C.carrier_nonempty + (hCR.trans hRL) hkappa f hsupport hf + refine ⟨C, hfreq, hreg, hpos, hlo, hhi, hCR, ?_⟩ + linarith + +end Erdos3.LocalConvolution + +end + +section + +namespace Erdos3.Peeling + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem exists_admissible_shape_selection + (B : CyclicBohr.Set N) (scale : ℝ≥0) (rankExtra : ℕ) (minimumWidth : ℝ) : + ∃ shape : Finset (ZMod N) → CyclicBohr.Set N, ∀ D, + translatedCellFamily (admissibleBohrCarriers B scale rankExtra minimumWidth) D → + admissibleBohrShape B scale rankExtra minimumWidth (shape D) ∧ + ∃ z, D = (shape D).carrier.image (fun t => z + t) := by + classical + have hex : ∀ D : Finset (ZMod N), ∃ C : CyclicBohr.Set N, + translatedCellFamily (admissibleBohrCarriers B scale rankExtra minimumWidth) D → + admissibleBohrShape B scale rankExtra minimumWidth C ∧ + ∃ z, D = C.carrier.image (fun t => z + t) := by + intro D + by_cases hD : translatedCellFamily (admissibleBohrCarriers B scale rankExtra minimumWidth) D + · obtain ⟨E, ⟨C, hC, hE⟩, z, hz⟩ := hD + exact ⟨C, fun _ => ⟨hC, z, by simpa only [hE] using hz⟩⟩ + · exact ⟨B, fun h => False.elim (hD h)⟩ + choose shape hshape using hex + exact ⟨shape, hshape⟩ + +theorem admissible_shape_translation_control + (B : CyclicBohr.Set N) (hB : B.IsRankRegular) {scale : ℝ≥0} + (hscale : scale ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + {rankExtra : ℕ} {minimumWidth : ℝ} (D : Finset (ZMod N)) (C : CyclicBohr.Set N) + (hC : admissibleBohrShape B scale rankExtra minimumWidth C) + (hD : ∃ z, D = C.carrier.image (fun t => z + t)) : + D.Nonempty ∧ C.carrier.Nonempty ∧ ∀ t ∈ C.carrier, + (∑ y, |realUniformMass B.carrier (y - t) - realUniformMass B.carrier y|) ≤ + 400 * (max B.rank 1 : ℕ) * (scale : ℝ) := by + refine ⟨?_, C.carrier_nonempty, ?_⟩ + · obtain ⟨z, rfl⟩ := hD + obtain ⟨x, hx⟩ := C.carrier_nonempty + exact ⟨z + x, Finset.mem_image.mpr ⟨x, hx, rfl⟩⟩ + · intro t ht + apply CyclicBohr.Set.uniformMass_translation_le_of_rankRegular hB hscale + simpa only [CyclicBohr.Set.mem_iff, CyclicBohr.Set.mem_carrier] using hC.2.1 ht + +end Erdos3.Peeling + +namespace Erdos3.CellRefinement + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem exists_bohr_replacement_family + (B : CyclicBohr.Set N) (hB : B.IsRankRegular) {scale : ℝ≥0} + (hscale : scale ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (rankExtra : ℕ) (minimumWidth : ℝ) {K kappa M : ℝ} + (hK : 0 < K) (hkappa : 0 < kappa) (hM : 0 ≤ M) + (a f g : ZMod N → ℝ) (ha : ∀ x, |a x| ≤ M) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ 1) (hg : ∀ x, 0 ≤ g x ∧ g x ≤ 1) + (hfsupport : ∀ x, x ∉ B.carrier → f x = 0) + (hgsupport : ∀ x, x ∉ B.carrier → g x = 0) + {f' g' : ZMod N → ℝ} {cs ds : List (Finset (ZMod N))} + (hF : Peeling.Chain B.carrier + (Peeling.translatedCellFamily (Peeling.admissibleBohrCarriers B scale rankExtra minimumWidth)) + K kappa f f' cs) + (hG : Peeling.Chain B.carrier + (Peeling.translatedCellFamily (Peeling.admissibleBohrCarriers B scale rankExtra minimumWidth)) + K kappa g g' ds) : + ∃ shape : Finset (ZMod N) → CyclicBohr.Set N, + (∀ D, Peeling.translatedCellFamily (Peeling.admissibleBohrCarriers B scale rankExtra minimumWidth) D → + Peeling.admissibleBohrShape B scale rankExtra minimumWidth (shape D) ∧ + ∃ z, D = (shape D).carrier.image (fun t => z + t)) ∧ + |bilinearIntegral B.carrier B.carrier a f g - + (bilinearIntegral B.carrier B.carrier a f' g' + + replacementIntegralSum B.carrier B.carrier (fun D => (shape D).carrier) a g f cs + + replacementIntegralSum B.carrier B.carrier (fun D => (shape D).carrier) a f' g ds)| ≤ + (M * (400 * (max B.rank 1 : ℕ) * (scale : ℝ))) * + (((𝔼 x ∈ B.carrier, f x) + 𝔼 x ∈ B.carrier, g x) / (K * kappa)) ∧ + (1 / 4 : ℝ) * K ^ (3 / 4 : ℝ) * + (replacementPotentialSum B.carrier B.carrier (fun D => (shape D).carrier) g f cs + + replacementPotentialSum B.carrier B.carrier (fun D => (shape D).carrier) f' g ds) ≤ + ((𝔼 x ∈ B.carrier, f x) * (𝔼 x ∈ B.carrier, g x)) ^ (1 / 4 : ℝ) - + ((𝔼 x ∈ B.carrier, f' x) * (𝔼 x ∈ B.carrier, g' x)) ^ (1 / 4 : ℝ) := by + obtain ⟨shape, hshape⟩ := Peeling.exists_admissible_shape_selection B scale rankExtra minimumWidth + refine ⟨shape, hshape, ?_, ?_⟩ + · apply pair_replacement_integral_error_le_mass hF hG hK hkappa _ a hM + (by positivity) ha hf hg hfsupport hgsupport + intro D hD + exact Peeling.admissible_shape_translation_control B hB hscale D (shape D) + (hshape D hD).1 (hshape D hD).2 + · exact pair_replacement_potential_budget B.carrier_nonempty hF hG hK hkappa _ + (fun D _ => (shape D).carrier_nonempty) (fun x => (hf x).1) (fun x => (hg x).1) + hfsupport hgsupport + +end Erdos3.CellRefinement + +end + +section + +namespace Erdos3.LocalConvolution + +open scoped BigOperators NNReal +open CyclicCrootSisask + +variable {N : ℕ} [NeZero N] + +theorem exists_unbalanced_bohr_second_moment_at_scale + (L S : CyclicBohr.Set N) (hL : L.IsRankRegular) + (hSpos : 0 < S.radius) (hSwidth : S.radius ≤ 1) + (hSreg : S.IsRankRegular) (hSrank : 1 ≤ S.rank) + {kappa₀ : ℝ≥0} (hSL : S.carrier ⊆ (L.ndilate kappa₀).carrier) + (hkappa₀ : kappa₀ ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (f : ZMod N → ℝ) (hsupport : ∀ x, x ∉ L.carrier → f x = 0) + {M c p H : ℝ} (hM : 0 < M) (hc : 0 < c) (hc1 : c ≤ 1) + (hp : 1 ≤ p) (hH : 0 ≤ H) (hcap : M ≤ Real.exp p) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ M) + (hboundary : 200 * (max L.rank 1 : ℕ) * (kappa₀ : ℝ) * M ^ 2 ≤ c / 64) + (q : ℕ) (hq : 0 < q) (heven : Even q) (hqp : (q : ℝ) ≤ H * p) + (hlarge : 1 + c ≤ differenceLp S.carrier (correlation L.carrier f f) q) + (hseparation : (1 + c / 4) ^ q ≤ (c / 64) / 2 * (1 + c / 2) ^ q) + (kappa : ℝ≥0) (hkappa0 : 0 < kappa) + (hscale : kappa ≤ localizedAverageScale S.rank (M ^ (2 * q)) + ((1 + c) ^ q - (1 + c / 2) ^ q)) : + let D := (3 * H + 1) * p ^ 2 + ∃ C : CyclicBohr.Set N, C.IsRankRegular ∧ 0 < C.radius ∧ C.radius ≤ 1 ∧ + C.carrier ⊆ S.carrier ∧ C.carrier ⊆ (S.ndilate kappa).carrier ∧ + (C.rank : ℝ) ≤ S.rank + almostPeriodicityWidthConstant (c / 64) * (1 + D) ^ 4 ∧ + ((kappa : ℝ) * (localizedAverageScale C.rank (M ^ 2) (c / 64) : ℝ) * S.radius / 8) * + Real.exp (-(almostPeriodicityWidthConstant (c / 64) * + (1 + D + Real.log (2 + S.rank)))) ≤ C.radius ∧ + 1 + c / 16 ≤ 𝔼 x ∈ L.carrier, cellAverage C.carrier f x ^ 2 := by + intro D + have htol : 0 < c / 64 := by positivity + have hcontrol := unbalanced_error_control hc hc1 + obtain ⟨C₀, hfreq₀, _, _, hlow₀, _, hC₀S, hC₀small, _, _, A, _, B, _, hA, hB, _, _, + R, hRreg, hRpos, hRwidth, hRC₀, hRrank, hRlow, hlargeR⟩ := + exists_smoothing_of_large_correlation_at_scale L S hL hSpos hSwidth hSreg hSrank hSL hkappa₀ + f hsupport hM hc htol htol hcontrol.2.1 hp hH hcap hf q hq heven hqp hlarge hseparation kappa hkappa0 hscale + have hRSL : R.carrier ⊆ (L.ndilate kappa₀).carrier := (hRC₀.trans hC₀S).trans hSL + obtain ⟨C, hfreq, hCreg, hCpos, hClow, hChi, hCR, hsecond⟩ := + exists_bohr_average_local_second_moment L hL A B hA hB R hRpos hRreg hRSL hkappa₀ + f hsupport hf htol hlargeR + have hCrank : C.rank = R.rank := congrArg Finset.card hfreq + have hC₀rank : C₀.rank = S.rank := congrArg Finset.card hfreq₀ + have hsigma1 : (localizedAverageScale R.rank (M ^ 2) (c / 64) : ℝ) ≤ 1 := by + exact_mod_cast localizedAverageScale_le_one R.rank (sq_nonneg M) htol + have hCwidth : C.radius ≤ 1 := by + have hmul := mul_le_mul_of_nonneg_right hsigma1 R.radius_nonneg + have hnonneg := (localizedAverageScale R.rank (M ^ 2) (c / 64)).coe_nonneg + have hRnonneg := R.radius_nonneg + linarith + refine ⟨C, hCreg, hCpos, hCwidth, hCR.trans (hRC₀.trans hC₀S), + hCR.trans (hRC₀.trans hC₀small), ?_, ?_, ?_⟩ + · rw [hCrank] + simpa only [hC₀rank] using hRrank + · rw [hCrank] + have hRlow' : ((kappa : ℝ) * S.radius / 2) * + Real.exp (-(almostPeriodicityWidthConstant (c / 64) * + (1 + D + Real.log (2 + S.rank)))) ≤ R.radius := by + have h := mul_le_mul_of_nonneg_right hlow₀ + (Real.exp_nonneg (-(almostPeriodicityWidthConstant (c / 64) * + (1 + D + Real.log (2 + S.rank))))) + exact h.trans (by simpa only [hC₀rank] using hRlow) + calc + _ = ((localizedAverageScale R.rank (M ^ 2) (c / 64) : ℝ) / 4) * + (((kappa : ℝ) * S.radius / 2) * + Real.exp (-(almostPeriodicityWidthConstant (c / 64) * + (1 + D + Real.log (2 + S.rank))))) := by ring + _ ≤ ((localizedAverageScale R.rank (M ^ 2) (c / 64) : ℝ) / 4) * R.radius := + mul_le_mul_of_nonneg_left hRlow' (by positivity) + _ = (localizedAverageScale R.rank (M ^ 2) (c / 64) : ℝ) * R.radius / 4 := by ring + _ ≤ C.radius := hClow + · change (1 + c / 4) * (1 - c / 64 - c / 64) - c / 64 - + 200 * (max L.rank 1 : ℕ) * (kappa₀ : ℝ) * M ^ 2 ≤ + 𝔼 x ∈ L.carrier, cellAverage C.carrier f x ^ 2 at hsecond + have hgain := hcontrol.2.2.2 + linarith + +theorem exists_unbalanced_bohr_second_moment + (L S : CyclicBohr.Set N) (hL : L.IsRankRegular) + (hSpos : 0 < S.radius) (hSwidth : S.radius ≤ 1) + (hSreg : S.IsRankRegular) (hSrank : 1 ≤ S.rank) + {kappa₀ : ℝ≥0} (hSL : S.carrier ⊆ (L.ndilate kappa₀).carrier) + (hkappa₀ : kappa₀ ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (f : ZMod N → ℝ) (hsupport : ∀ x, x ∉ L.carrier → f x = 0) + {M c p H : ℝ} (hM : 0 < M) (hc : 0 < c) (hc1 : c ≤ 1) + (hp : 1 ≤ p) (hH : 0 ≤ H) (hcap : M ≤ Real.exp p) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ M) + (hboundary : 200 * (max L.rank 1 : ℕ) * (kappa₀ : ℝ) * M ^ 2 ≤ c / 64) + (q : ℕ) (hq : 0 < q) (heven : Even q) (hqp : (q : ℝ) ≤ H * p) + (hlarge : 1 + c ≤ differenceLp S.carrier (correlation L.carrier f f) q) + (hseparation : (1 + c / 4) ^ q ≤ (c / 64) / 2 * (1 + c / 2) ^ q) : + let kappa := localizedAverageScale S.rank (M ^ (2 * q)) + ((1 + c) ^ q - (1 + c / 2) ^ q) + let D := (3 * H + 1) * p ^ 2 + ∃ C : CyclicBohr.Set N, C.IsRankRegular ∧ 0 < C.radius ∧ C.radius ≤ 1 ∧ + C.carrier ⊆ S.carrier ∧ + (C.rank : ℝ) ≤ S.rank + almostPeriodicityWidthConstant (c / 64) * (1 + D) ^ 4 ∧ + ((kappa : ℝ) * (localizedAverageScale C.rank (M ^ 2) (c / 64) : ℝ) * S.radius / 8) * + Real.exp (-(almostPeriodicityWidthConstant (c / 64) * + (1 + D + Real.log (2 + S.rank)))) ≤ C.radius ∧ + 1 + c / 16 ≤ 𝔼 x ∈ L.carrier, cellAverage C.carrier f x ^ 2 := by + intro kappa D + have hgap : 0 < (1 + c) ^ q - (1 + c / 2) ^ q := by + have h := pow_lt_pow_left₀ (show 1 + c / 2 < 1 + c by linarith) + (show 0 ≤ 1 + c / 2 by linarith) hq.ne' + linarith + obtain ⟨C, hreg, hpos, hwidth, hCS, _, hrank, hlower, hsecond⟩ := + exists_unbalanced_bohr_second_moment_at_scale L S hL hSpos hSwidth hSreg hSrank + hSL hkappa₀ f hsupport hM hc hc1 hp hH hcap hf hboundary q hq heven hqp + hlarge hseparation kappa + (localizedAverageScale_spec S.rank (pow_nonneg hM.le _) hgap).1 le_rfl + exact ⟨C, hreg, hpos, hwidth, hCS, hrank, hlower, hsecond⟩ + +end Erdos3.LocalConvolution + +end + +section + +namespace Erdos3.CellRefinement + +open scoped BigOperators NNReal + +variable {N : ℕ} [NeZero N] + +theorem bohr_peeling_parent_bound + (B : CyclicBohr.Set N) (hB : B.IsRankRegular) {scale : ℝ≥0} + (hscale : scale ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (rankExtra : ℕ) (minimumWidth : ℝ) {K kappa T rho error W : ℝ} + (hK : 0 < K) (hkappa : 0 < kappa) (hKfactor : 2 ≤ (1 / 4 : ℝ) * K ^ (3 / 4 : ℝ)) + (hT : 0 ≤ T) (hrho : 1 / 2 ≤ rho) (hW : 0 ≤ W) + (a f g : ZMod N → ℝ) (origin : ZMod N) (ha : ∀ x, |a x| ≤ W) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ 1) (hg : ∀ x, 0 ≤ g x ∧ g x ≤ 1) + (hfsupport : ∀ x, x ∉ B.carrier → f x = 0) (hgsupport : ∀ x, x ∉ B.carrier → g x = 0) + {f' g' : ZMod N → ℝ} {cs ds : List (Finset (ZMod N))} + (hF : Peeling.Chain B.carrier + (Peeling.translatedCellFamily (Peeling.admissibleBohrCarriers B scale rankExtra minimumWidth)) + K kappa f f' cs) + (hG : Peeling.Chain B.carrier + (Peeling.translatedCellFamily (Peeling.admissibleBohrCarriers B scale rankExtra minimumWidth)) + K kappa g g' ds) + (hchildren : ∀ C, Peeling.admissibleBohrShape B scale rankExtra minimumWidth C → + CellBilinearBound C.carrier a T) + (hremainder : bilinearIntegral B.carrier B.carrier (fun r => a (origin + r)) f' g' ≤ + T * rho * ((𝔼 x ∈ B.carrier, f' x) * (𝔼 x ∈ B.carrier, g' x)) ^ (1 / 4 : ℝ) + error) : + bilinearIntegral B.carrier B.carrier (fun r => a (origin + r)) f g ≤ + T * rho * ((𝔼 x ∈ B.carrier, f x) * (𝔼 x ∈ B.carrier, g x)) ^ (1 / 4 : ℝ) + error + + (W * (400 * (max B.rank 1 : ℕ) * (scale : ℝ))) * + (((𝔼 x ∈ B.carrier, f x) + 𝔼 x ∈ B.carrier, g x) / (K * kappa)) := by + obtain ⟨shape, hshape⟩ := Peeling.exists_admissible_shape_selection B scale rankExtra minimumWidth + apply peeling_parent_bound_of_remainder B.carrier_nonempty hF hG hK hkappa hKfactor hT hrho + hW (by positivity) (fun D => (shape D).carrier) a origin ha hf hg hfsupport hgsupport _ hremainder + intro D hD + obtain ⟨hC, htranslate⟩ := hshape D hD + obtain ⟨hDn, hCn, hTV⟩ := Peeling.admissible_shape_translation_control B hB hscale D (shape D) hC htranslate + exact ⟨hDn, hCn, htranslate, hchildren (shape D) hC, hTV⟩ + +theorem bohr_parent_bound_from_capped + (B : CyclicBohr.Set N) (hB : B.IsRankRegular) {scale : ℝ≥0} + (hscale : scale ≤ 1 / (100 * (2 * max B.rank 1 : ℕ) : ℝ≥0)) + (rankExtra : ℕ) (minimumWidth : ℝ) {K kappa T rho epsilon eta W : ℝ} + (hK : 0 < K) (hkappa : 0 < kappa) (hKfactor : 2 ≤ (1 / 4 : ℝ) * K ^ (3 / 4 : ℝ)) + (hT : 0 ≤ T) (hrho : 1 / 2 ≤ rho) (hepsilon : 0 ≤ epsilon) (heta : 0 ≤ eta) (hW : 0 ≤ W) + (htiny : W * kappa ^ (3 / 4 : ℝ) ≤ epsilon) + (a f g : ZMod N → ℝ) (origin : ZMod N) (ha : ∀ x, |a x| ≤ W) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ 1) (hg : ∀ x, 0 ≤ g x ∧ g x ≤ 1) + (hfsupport : ∀ x, x ∉ B.carrier → f x = 0) (hgsupport : ∀ x, x ∉ B.carrier → g x = 0) + (hchildren : ∀ C, Peeling.admissibleBohrShape B scale rankExtra minimumWidth C → + CellBilinearBound C.carrier a T) + (hcapped : ∀ f' g' : ZMod N → ℝ, + (∀ x, 0 ≤ f' x ∧ f' x ≤ 1) → (∀ x, 0 ≤ g' x ∧ g' x ≤ 1) → + (∀ x, x ∉ B.carrier → f' x = 0) → (∀ x, x ∉ B.carrier → g' x = 0) → + kappa ≤ (𝔼 x ∈ B.carrier, f' x) → kappa ≤ (𝔼 x ∈ B.carrier, g' x) → + (∀ C, Peeling.admissibleBohrShape B scale rankExtra minimumWidth C → ∀ z, + cellAverage C.carrier f' z ≤ K * (𝔼 x ∈ B.carrier, f' x)) → + (∀ C, Peeling.admissibleBohrShape B scale rankExtra minimumWidth C → ∀ z, + cellAverage C.carrier g' z ≤ K * (𝔼 x ∈ B.carrier, g' x)) → + bilinearIntegral B.carrier B.carrier (fun r => a (origin + r)) f' g' ≤ + (T * rho + epsilon) * ((𝔼 x ∈ B.carrier, f' x) * (𝔼 x ∈ B.carrier, g' x)) ^ (1 / 4 : ℝ) + eta) : + bilinearIntegral B.carrier B.carrier (fun r => a (origin + r)) f g ≤ + (T * rho + epsilon) * ((𝔼 x ∈ B.carrier, f x) * (𝔼 x ∈ B.carrier, g x)) ^ (1 / 4 : ℝ) + eta + + (W * (400 * (max B.rank 1 : ℕ) * (scale : ℝ))) * + (((𝔼 x ∈ B.carrier, f x) + 𝔼 x ∈ B.carrier, g x) / (K * kappa)) := by + obtain ⟨f', g', cs, ds, hF, hG, _, hfb, hgb, hfs, hgs, _, _, hterminal⟩ := + Peeling.exists_budgeted_bohr_peeling B scale rankExtra minimumWidth hK hkappa f g + (fun x => (hf x).1) (fun x => (hg x).1) hfsupport hgsupport + have hf' : ∀ x, 0 ≤ f' x ∧ f' x ≤ 1 := fun x => ⟨(hfb x).1, (hfb x).2.trans (hf x).2⟩ + have hg' : ∀ x, 0 ≤ g' x ∧ g' x ≤ 1 := fun x => ⟨(hgb x).1, (hgb x).2.trans (hg x).2⟩ + have hPhi := quarter_cell_potential_mono B.carrier f f' g g' (fun x => (hfb x).1) + (fun x => (hgb x).1) (fun x => (hfb x).2) (fun x => (hgb x).2) + have hPhi0 : 0 ≤ ((𝔼 x ∈ B.carrier, f' x) * (𝔼 x ∈ B.carrier, g' x)) ^ (1 / 4 : ℝ) := + Real.rpow_nonneg (mul_nonneg (Finset.expect_nonneg (fun x _ => (hf' x).1)) + (Finset.expect_nonneg (fun x _ => (hg' x).1))) _ + have hrem : bilinearIntegral B.carrier B.carrier (fun r => a (origin + r)) f' g' ≤ + (T * rho + epsilon) * ((𝔼 x ∈ B.carrier, f' x) * (𝔼 x ∈ B.carrier, g' x)) ^ (1 / 4 : ℝ) + eta := by + by_cases hsmall : min (𝔼 x ∈ B.carrier, f' x) (𝔼 x ∈ B.carrier, g' x) < kappa + · have h := tiny_cell_integral_le B.carrier B.carrier_nonempty a f' g' origin hW + (fun x => (le_abs_self (a x)).trans (ha x)) hf' hg' hsmall + have hcoef := mul_nonneg hT (show 0 ≤ rho by linarith) + have ht := mul_le_mul_of_nonneg_right htiny hPhi0 + nlinarith only [h, ht, mul_nonneg hcoef hPhi0, heta] + · have hlower := le_min_iff.mp (le_of_not_gt hsmall) + rcases hterminal with hsmallF | hsmallG | ⟨hcapF, hcapG⟩ + · exact False.elim (hsmall (min_lt_iff.mpr (Or.inl hsmallF))) + · exact False.elim (hsmall (min_lt_iff.mpr (Or.inr hsmallG))) + · exact hcapped f' g' hf' hg' hfs hgs hlower.1 hlower.2 hcapF hcapG + have hrem' : bilinearIntegral B.carrier B.carrier (fun r => a (origin + r)) f' g' ≤ + T * rho * ((𝔼 x ∈ B.carrier, f' x) * (𝔼 x ∈ B.carrier, g' x)) ^ (1 / 4 : ℝ) + + (epsilon * ((𝔼 x ∈ B.carrier, f x) * (𝔼 x ∈ B.carrier, g x)) ^ (1 / 4 : ℝ) + eta) := by + have h := mul_le_mul_of_nonneg_left hPhi hepsilon + nlinarith only [hrem, h] + have h := bohr_peeling_parent_bound B hB hscale rankExtra minimumWidth hK hkappa hKfactor + hT hrho hW a f g origin ha hf hg hfsupport hgsupport hF hG hchildren hrem' + nlinarith only [h] + +end Erdos3.CellRefinement + +end + +section + +namespace Erdos3.LocalConvolution + +open scoped BigOperators NNReal +open CyclicCrootSisask + +variable {N : ℕ} [NeZero N] + +noncomputable def unbalancedRankExtra (c p H : ℝ) : ℕ := + ⌈almostPeriodicityWidthConstant (c / 64) * (1 + (3 * H + 1) * p ^ 2) ^ 4⌉₊ + +noncomputable def unbalancedMinimumWidth (S : CyclicBohr.Set N) (M c p H : ℝ) (q : ℕ) : ℝ := + (localizedAverageScale S.rank (M ^ (2 * q)) ((1 + c) ^ q - (1 + c / 2) ^ q) : ℝ) * + (localizedAverageScale (S.rank + unbalancedRankExtra c p H) (M ^ 2) (c / 64) : ℝ) * + S.radius / 8 * Real.exp (-(almostPeriodicityWidthConstant (c / 64) * + (1 + (3 * H + 1) * p ^ 2 + Real.log (2 + S.rank)))) + +theorem unbalancedMinimumWidth_pos (S : CyclicBohr.Set N) (hS : 0 < S.radius) + {M c p H : ℝ} (hM : 0 ≤ M) (hc : 0 < c) {q : ℕ} (hq : 0 < q) : + 0 < unbalancedMinimumWidth S M c p H q := by + have hgap : 0 < (1 + c) ^ q - (1 + c / 2) ^ q := by + have h := pow_lt_pow_left₀ (show 1 + c / 2 < 1 + c by linarith) + (show 0 ≤ 1 + c / 2 by linarith) hq.ne' + linarith + have hκ := (localizedAverageScale_spec S.rank (pow_nonneg hM (2 * q)) hgap).1 + have hσ := (localizedAverageScale_spec (S.rank + unbalancedRankExtra c p H) + (sq_nonneg M) (show 0 < c / 64 by positivity)).1 + have hκR : (0 : ℝ) < localizedAverageScale S.rank (M ^ (2 * q)) + ((1 + c) ^ q - (1 + c / 2) ^ q) := by exact_mod_cast hκ + have hσR : (0 : ℝ) < localizedAverageScale (S.rank + unbalancedRankExtra c p H) + (M ^ 2) (c / 64) := by exact_mod_cast hσ + unfold unbalancedMinimumWidth + positivity + +theorem exists_unbalanced_admissible_shape + (L S : CyclicBohr.Set N) (hL : L.IsRankRegular) + (hSpos : 0 < S.radius) (hSwidth : S.radius ≤ 1) + (hSreg : S.IsRankRegular) (hSrank : 1 ≤ S.rank) + {kappa₀ : ℝ≥0} (hSL : S.carrier ⊆ (L.ndilate kappa₀).carrier) + (hkappa₀ : kappa₀ ≤ 1 / (100 * (2 * max L.rank 1 : ℕ) : ℝ≥0)) + (f : ZMod N → ℝ) (hsupport : ∀ x, x ∉ L.carrier → f x = 0) + {M c p H : ℝ} (hM : 0 < M) (hc : 0 < c) (hc1 : c ≤ 1) + (hp : 1 ≤ p) (hH : 0 ≤ H) (hcap : M ≤ Real.exp p) + (hf : ∀ x, 0 ≤ f x ∧ f x ≤ M) + (hboundary : 200 * (max L.rank 1 : ℕ) * (kappa₀ : ℝ) * M ^ 2 ≤ c / 64) + (q : ℕ) (hq : 0 < q) (heven : Even q) (hqp : (q : ℝ) ≤ H * p) + (hlarge : 1 + c ≤ differenceLp S.carrier (correlation L.carrier f f) q) + (hseparation : (1 + c / 4) ^ q ≤ (c / 64) / 2 * (1 + c / 2) ^ q) : + ∃ C : CyclicBohr.Set N, + Peeling.admissibleBohrShape S 1 (unbalancedRankExtra c p H) + (unbalancedMinimumWidth S M c p H q) C ∧ + 0 < C.radius ∧ C.radius ≤ 1 ∧ + 1 + c / 16 ≤ 𝔼 x ∈ L.carrier, cellAverage C.carrier f x ^ 2 := by + obtain ⟨C, hCreg, hCpos, hCwidth, hCS, hrank, hwidth, hsecond⟩ := + exists_unbalanced_bohr_second_moment L S hL hSpos hSwidth hSreg hSrank hSL hkappa₀ + f hsupport hM hc hc1 hp hH hcap hf hboundary q hq heven hqp hlarge hseparation + have hbound : C.rank ≤ S.rank + unbalancedRankExtra c p H := by + have hceil := Nat.le_ceil + (almostPeriodicityWidthConstant (c / 64) * (1 + (3 * H + 1) * p ^ 2) ^ 4) + have hreal : (C.rank : ℝ) ≤ (S.rank : ℝ) + (unbalancedRankExtra c p H : ℝ) := + hrank.trans (add_le_add le_rfl hceil) + exact_mod_cast hreal + have hσ := localizedAverageScale_antitone_rank (sq_nonneg M) + (show 0 ≤ c / 64 by positivity) hbound + have hσR : (localizedAverageScale (S.rank + unbalancedRankExtra c p H) (M ^ 2) (c / 64) : ℝ) ≤ + (localizedAverageScale C.rank (M ^ 2) (c / 64) : ℝ) := by exact_mod_cast hσ + refine ⟨C, ⟨hCreg, ?_, hbound, ?_⟩, hCpos, hCwidth, hsecond⟩ + · simpa only [CyclicBohr.Set.ndilate_one] using hCS + · apply le_trans _ hwidth + unfold unbalancedMinimumWidth + gcongr + +end Erdos3.LocalConvolution + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/UniformEmbeddedFourier.lean b/lean/OAI/Combinatorics/Progressions/Fourier/UniformEmbeddedFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6978494a7c7b35e17aa55f8fb06cd5765db733b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/UniformEmbeddedFourier.lean @@ -0,0 +1,241 @@ +import OAI.Combinatorics.Progressions.Probability.RawWeightCellMixture + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {R J : Type*} [Fintype R] [Fintype J] [DecidableEq J] + {X : R → Type*} [∀ r, Fintype (X r)] + +noncomputable def integerGridMixture (w : R → ℝ) + (p : ∀ r, FiniteProbabilityWeights (X r)) (Y : ∀ r, X r → J → ℤ) + (K : ℕ) (M : R → ℕ) [∀ r, NeZero (M r)] + (S : ∀ r, Finset (J → Fin (M r))) (z : J → ℤ) : ℂ := + weightedMixtureExpansion (A := fun r => S r) w + (fun r k => integerRetainedCoefficient (p r) (Y r) K (M r) k) + (fun r k z => star (rectangularGridCharacter (M r) k z)) z + +theorem integerGridMixture_eq_sum (w : R → ℝ) + (p : ∀ r, FiniteProbabilityWeights (X r)) (Y : ∀ r, X r → J → ℤ) + (K : ℕ) (M : R → ℕ) [∀ r, NeZero (M r)] + (S : ∀ r, Finset (J → Fin (M r))) (z : J → ℤ) : + integerGridMixture w p Y K M S z = + ∑ r, (w r : ℂ) * integerGridApproximation (p r) (Y r) K (M r) (S r) z := by + rw [integerGridMixture, weightedMixtureExpansion_eq_sum] + apply Finset.sum_congr rfl + intro r _ + rw [integerGridApproximation_eq_sum] + congr 1 + exact Finset.sum_coe_sort (S r) + (fun k => integerRetainedCoefficient (p r) (Y r) K (M r) k * star (rectangularGridCharacter (M r) k z)) + +theorem integerGridMixture_coefficient_mass (w : R → ℝ) + (p : ∀ r, FiniteProbabilityWeights (X r)) (Y : ∀ r, X r → J → ℤ) + (K : ℕ) (M : R → ℕ) [∀ r, NeZero (M r)] + (S : ∀ r, Finset (J → Fin (M r))) {C : ℝ} + (hw : ∀ r, 0 ≤ w r) (hmass : ∑ r, w r ≤ 1) (hC : 0 ≤ C) + (hKM : ∀ r, K ≤ M r) + (hcap : ∀ r, (∑ k, ‖integerGridCoefficient (p r) (Y r) (M r) k‖) ≤ C) : + (∑ t : Σ r, S r, + ‖(w t.1 : ℂ) * integerRetainedCoefficient (p t.1) (Y t.1) K (M t.1) t.2‖) ≤ C := by + apply weightedMixtureExpansion_mass_le (A := fun r => S r) w + (fun r k => integerRetainedCoefficient (p r) (Y r) K (M r) k) hw hmass hC + intro r + calc + _ = ∑ k ∈ S r, ‖integerRetainedCoefficient (p r) (Y r) K (M r) k‖ := + Finset.sum_coe_sort (S r) (fun k => ‖integerRetainedCoefficient (p r) (Y r) K (M r) k‖) + _ ≤ C := integerRetainedCoefficient_mass_le (p r) (Y r) K (M r) (S r) (hKM r) (hcap r) + +theorem integerGridMixture_approximation (w : R → ℝ) + (p : ∀ r, FiniteProbabilityWeights (X r)) (Y : ∀ r, X r → J → ℤ) + (K : ℕ) (M : R → ℕ) [∀ r, NeZero (M r)] + (S : ∀ r, Finset (J → Fin (M r))) (z : J → ℤ) {ε : ℝ} + (hw : ∀ r, 0 ≤ w r) (hmass : ∑ r, w r ≤ 1) (hε : 0 ≤ ε) + (he : ∀ r, ‖(((K : ℝ) ^ Fintype.card J * finiteImageMass (p r) (Y r) z : ℝ) : ℂ) - + integerGridApproximation (p r) (Y r) K (M r) (S r) z‖ ≤ ε) : + ‖(((K : ℝ) ^ Fintype.card J * (∑ r, w r * finiteImageMass (p r) (Y r) z) : ℝ) : ℂ) - + integerGridMixture w p Y K M S z‖ ≤ ε := by + rw [integerGridMixture_eq_sum] + have hsum : (((K : ℝ) ^ Fintype.card J * (∑ r, w r * finiteImageMass (p r) (Y r) z) : ℝ) : ℂ) = + ∑ r, (w r : ℂ) * (((K : ℝ) ^ Fintype.card J * finiteImageMass (p r) (Y r) z : ℝ) : ℂ) := by + push_cast + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro r _ + ring + rw [hsum] + exact norm_weighted_mixture_sub_le_uniform w _ _ hw hmass hε he + +end Erdos3 + +end + +section + +namespace Erdos3.IntegerFourierBudget + +open scoped BigOperators Classical + +theorem mixture_approximation {R J : Type*} [Fintype R] [Fintype J] + {X : R → Type*} [∀ r, Fintype (X r)] (B : IntegerFourierBudget) + (w : R → ℝ) (hw : ∀ r, 0 ≤ w r) (hmass : ∑ r, w r ≤ 1) + (p : ∀ r, FiniteProbabilityWeights (X r)) (Y : ∀ r, (J → ℤ) → X r → J → ℤ) + (K : ℕ) (M : R → ℕ) [∀ r, NeZero (M r)] (hKM : ∀ r, K ≤ M r) + (hcap : 0 ≤ B.coefficientCap) (hmodel : ∀ r, B.Controls (p r) (Y r) K (M r)) + {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) : + ∃ S : ∀ r, Finset (J → Fin (M r)), + (Fintype.card (Σ r, S r) : ℝ) ≤ (Fintype.card R : ℝ) * B.countConstant / ε ^ B.countExponent ∧ + (∀ center, (∑ t : Σ r, S r, + ‖(w t.1 : ℂ) * integerRetainedCoefficient (p t.1) (Y t.1 center) K (M t.1) t.2‖) ≤ + B.coefficientCap) ∧ + (∀ t : Σ r, S r, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ B.denominatorBound ε ∧ + ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ j, |ξ j| ≤ B.residualBound ε) ∧ + ∀ j, ((t.2.val j).val : ℝ) / M t.1 = (a j : ℝ) / d + ξ j / K) ∧ + ∀ center z, centeredFundamentalBox B.radius K center z → + ‖(((K : ℝ) ^ Fintype.card J * + (∑ r, w r * finiteImageMass (p r) (Y r center) z) : ℝ) : ℂ) - + integerGridMixture w p (fun r => Y r center) K M S z‖ ≤ ε := by + have hm (r : R) := hmodel r ε hε hε1 + choose S hcount hfull hchar happ using hm + refine ⟨S, ?_, ?_, ?_, ?_⟩ + · calc + _ ≤ ∑ r : R, B.countConstant / ε ^ B.countExponent := + weightedMixtureExpansion_card_le (fun r => S r) (fun _ => B.countConstant / ε ^ B.countExponent) + (fun r => by simpa only [Fintype.card_coe] using hcount r) + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_div_assoc] + · intro center + exact integerGridMixture_coefficient_mass w p (fun r => Y r center) K M S hw hmass hcap hKM + (fun r => hfull r center) + · intro t + exact hchar t.1 t.2.val t.2.property + · intro center z hz + exact integerGridMixture_approximation w p (fun r => Y r center) K M S z hw hmass hε.le + (fun r => happ r center z hz) + +end Erdos3.IntegerFourierBudget + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def retainedImageMass {X R Z : Type*} [Fintype X] [DecidableEq R] [DecidableEq Z] + (p : FiniteProbabilityWeights X) (F : X → R) (S : Finset R) (O : X → Z) (z : Z) : ℝ := + p.mean (fun x => if F x ∈ S then if O x = z then 1 else 0 else 0) + +namespace FiniteProbabilityWeights + +theorem embedded_cell_image_mass {X R Z : Type*} + [Fintype X] [DecidableEq X] [DecidableEq R] [DecidableEq Z] + (w : X → ℝ) (hw : ∀ x, 0 ≤ w x) (htotal : 0 < ∑ x, w x) + (F : X → R) (S : Finset R) (Y : S → Type*) [∀ r, Fintype (Y r)] + (e : ∀ r, Y r ↪ X) + (hcell : ∀ r, finiteEmbeddingRange (e r) = Finset.univ.filter (fun x => F x = r.val)) + (hchild : ∀ r, 0 < ∑ y, w (e r y)) (O : X → Z) (z : Z) : + (∑ r : S, (ofPositiveWeights w hw htotal).mass (Finset.univ.filter (fun x => F x = r.val)) * + finiteImageMass (ofPositiveWeights (fun y => w (e r y)) (fun y => hw (e r y)) (hchild r)) + (fun y => O (e r y)) z) = retainedImageMass (ofPositiveWeights w hw htotal) F S O z := by + have h := congrArg Complex.re (embedded_cell_mixture w hw htotal F S Y e hcell hchild + (fun x => if O x = z then (1 : ℂ) else 0)) + simpa only [Complex.re_sum, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, sub_zero, complexMean_re, apply_ite, Complex.one_re, Complex.zero_re, + retainedImageMass, finiteImageMass] using h + +theorem embedded_cell_fourier_approximation {X R J : Type*} + [Fintype X] [DecidableEq X] [Fintype R] [DecidableEq R] [Fintype J] [DecidableEq J] + (w : X → ℝ) (hw : ∀ x, 0 ≤ w x) (htotal : 0 < ∑ x, w x) + (F : X → R) (S : Finset R) (Y : S → Type*) [∀ r, Fintype (Y r)] + (e : ∀ r, Y r ↪ X) + (hcell : ∀ r, finiteEmbeddingRange (e r) = Finset.univ.filter (fun x => F x = r.val)) + (hchild : ∀ r, 0 < ∑ y, w (e r y)) (O : X → J → ℤ) + (K : ℕ) (M : S → ℕ) [∀ r, NeZero (M r)] + (T : ∀ r, Finset (J → Fin (M r))) (z : J → ℤ) {ε : ℝ} (hε : 0 ≤ ε) + (he : ∀ r : S, + ‖(((K : ℝ) ^ Fintype.card J * + finiteImageMass (ofPositiveWeights (fun y => w (e r y)) (fun y => hw (e r y)) (hchild r)) + (fun y => O (e r y)) z : ℝ) : ℂ) - + integerGridApproximation + (ofPositiveWeights (fun y => w (e r y)) (fun y => hw (e r y)) (hchild r)) + (fun y => O (e r y)) K (M r) (T r) z‖ ≤ ε) : + ‖(((K : ℝ) ^ Fintype.card J * retainedImageMass (ofPositiveWeights w hw htotal) F S O z : ℝ) : ℂ) - + integerGridMixture + (fun r : S => (ofPositiveWeights w hw htotal).mass (Finset.univ.filter (fun x => F x = r.val))) + (fun r => ofPositiveWeights (fun y => w (e r y)) (fun y => hw (e r y)) (hchild r)) + (fun r y => O (e r y)) K M T z‖ ≤ ε := by + have h := integerGridMixture_approximation + (fun r : S => (ofPositiveWeights w hw htotal).mass (Finset.univ.filter (fun x => F x = r.val))) + (fun r => ofPositiveWeights (fun y => w (e r y)) (fun y => hw (e r y)) (hchild r)) + (fun r y => O (e r y)) K M T z + (fun r => (ofPositiveWeights w hw htotal).mass_nonneg _) + ((ofPositiveWeights w hw htotal).sum_fiber_masses_le_one F S) hε he + rw [embedded_cell_image_mass w hw htotal F S Y e hcell hchild O z] at h + exact h + +end FiniteProbabilityWeights + +end Erdos3 + +end + +section + +namespace Erdos3.IntegerFourierBudget + +open scoped BigOperators Classical + +theorem embedded_mixture_approximation {X R J : Type*} + [Fintype X] [Fintype R] [Fintype J] (B : IntegerFourierBudget) + (w : X → ℝ) (hw : ∀ x, 0 ≤ w x) (htotal : 0 < ∑ x, w x) + (F : X → R) (C : Finset R) (Y : C → Type*) [∀ r, Fintype (Y r)] + (e : ∀ r, Y r ↪ X) + (hcell : ∀ r, finiteEmbeddingRange (e r) = Finset.univ.filter (fun x => F x = r.val)) + (hchild : ∀ r, 0 < ∑ y, w (e r y)) (O : (J → ℤ) → X → J → ℤ) + (K : ℕ) (M : C → ℕ) [∀ r, NeZero (M r)] (hKM : ∀ r, K ≤ M r) + (hcap : 0 ≤ B.coefficientCap) + (hmodel : ∀ r, B.Controls + (FiniteProbabilityWeights.ofPositiveWeights (fun y => w (e r y)) (fun y => hw (e r y)) (hchild r)) + (fun center y => O center (e r y)) K (M r)) + {ε : ℝ} (hε : 0 < ε) (hε1 : ε ≤ 1) : + let p := FiniteProbabilityWeights.ofPositiveWeights w hw htotal + let weights := fun r : C => p.mass (Finset.univ.filter (fun x => F x = r.val)) + let q := fun r : C => FiniteProbabilityWeights.ofPositiveWeights + (fun y => w (e r y)) (fun y => hw (e r y)) (hchild r) + ∃ S : ∀ r, Finset (J → Fin (M r)), + (Fintype.card (Σ r, S r) : ℝ) ≤ (C.card : ℝ) * B.countConstant / ε ^ B.countExponent ∧ + (∀ center, (∑ t : Σ r, S r, + ‖(weights t.1 : ℂ) * integerRetainedCoefficient (q t.1) (fun y => O center (e t.1 y)) K (M t.1) t.2‖) ≤ + B.coefficientCap) ∧ + (∀ t : Σ r, S r, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ B.denominatorBound ε ∧ + ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ j, |ξ j| ≤ B.residualBound ε) ∧ + ∀ j, ((t.2.val j).val : ℝ) / M t.1 = (a j : ℝ) / d + ξ j / K) ∧ + ∀ center z, centeredFundamentalBox B.radius K center z → + ‖(((K : ℝ) ^ Fintype.card J * retainedImageMass p F C (O center) z : ℝ) : ℂ) - + integerGridMixture weights q (fun r y => O center (e r y)) K M S z‖ ≤ ε := by + dsimp only + let p := FiniteProbabilityWeights.ofPositiveWeights w hw htotal + let weights := fun r : C => p.mass (Finset.univ.filter (fun x => F x = r.val)) + let q := fun r : C => FiniteProbabilityWeights.ofPositiveWeights + (fun y => w (e r y)) (fun y => hw (e r y)) (hchild r) + obtain ⟨S, hcount, hcoef, hchar, happ⟩ := B.mixture_approximation weights + (fun r => p.mass_nonneg _) (p.sum_fiber_masses_le_one F C) + q (fun r center y => O center (e r y)) K M hKM hcap hmodel hε hε1 + refine ⟨S, ?_, hcoef, hchar, ?_⟩ + · simpa only [Fintype.card_coe] using hcount + · intro center z hz + have h := happ center z hz + dsimp only [weights, p, q] at h + rw [FiniteProbabilityWeights.embedded_cell_image_mass w hw htotal F C Y e hcell hchild (O center) z] at h + exact h + +end Erdos3.IntegerFourierBudget + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/UniformScaledRetainedCharacters.lean b/lean/OAI/Combinatorics/Progressions/Fourier/UniformScaledRetainedCharacters.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0bb3789a6a714ce25c58b5588c00fb52da9363c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/UniformScaledRetainedCharacters.lean @@ -0,0 +1,670 @@ +import OAI.Combinatorics.Progressions.Dynamics.MultiaffineBiasBudget +import OAI.Combinatorics.Progressions.Estimates.LengthDyadicCutoff +import OAI.Combinatorics.Progressions.Geometry.GeometricLocalizationThreshold +import OAI.Combinatorics.Progressions.Polynomial.PolynomialGridCover + +namespace OAI + +section + +namespace Erdos3 + +theorem unscale_grid_interval {M H d : ℕ} (hM : 0 < M) (k : Fin M) (a : ℤ) + (h : |(k.val : ℝ) - M * ((a : ℝ) / d)| ≤ H) : + |(k.val : ℝ) / M - (a : ℝ) / d| ≤ (H : ℝ) / M := by + have hM' : (0 : ℝ) < M := by exact_mod_cast hM + have he : (k.val : ℝ) / M - (a : ℝ) / d = + ((k.val : ℝ) - M * ((a : ℝ) / d)) / M := by field_simp + rw [he, abs_div, abs_of_pos hM'] + exact div_le_div_of_nonneg_right h hM'.le + +theorem rationalGridMajorSet_rational {M Q H : ℕ} (hM : 0 < M) (k : Fin M) + (hk : k ∈ rationalGridMajorSet M Q H) : + ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ (Q + 1 : ℝ) ∧ + ∃ a : ℤ, |(k.val : ℝ) / M - (a : ℝ) / d| ≤ (H : ℝ) / M := by + classical + obtain ⟨d, hd, ha⟩ := Finset.mem_biUnion.mp hk + obtain ⟨a, _, hk⟩ := Finset.mem_biUnion.mp ha + have he := (Finset.mem_filter.mp hk).2 + by_cases hd0 : d = 0 + · refine ⟨1, by omega, by exact_mod_cast (show 1 ≤ Q + 1 by omega), 0, ?_⟩ + apply unscale_grid_interval hM k 0 + simpa only [hd0, Nat.cast_zero, div_zero, Int.cast_zero, zero_div, mul_zero, sub_zero] using he + · refine ⟨d, Nat.pos_of_ne_zero hd0, ?_, a, unscale_grid_interval hM k a he⟩ + exact_mod_cast (Finset.mem_range.mp hd).le + +theorem rationalGridMajorBox_character {J : Type*} [Fintype J] [DecidableEq J] + {M Q H : ℕ} (hM : 0 < M) (k : J → Fin M) (hk : k ∈ rationalGridMajorBox J M Q H) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ (Q + 1 : ℝ) ^ Fintype.card J ∧ + ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ j, |ξ j| ≤ H) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ξ j / M := by + have hj := Fintype.mem_piFinset.mp hk + obtain ⟨D, hD, hDQ, a, ha⟩ := exists_common_rational_approximations + (fun j => ((k j).val : ℝ) / M) (fun j => rationalGridMajorSet_rational hM (k j) (hj j)) + let ξ j := (M : ℝ) * (((k j).val : ℝ) / M - (a j : ℝ) / D) + have hM' : (0 : ℝ) < M := by exact_mod_cast hM + refine ⟨D, hD, hDQ, a, ξ, ?_, ?_⟩ + · intro j + dsimp only [ξ] + rw [abs_mul, abs_of_pos hM'] + calc + _ ≤ (M : ℝ) * ((H : ℝ) / M) := mul_le_mul_of_nonneg_left (ha j) hM'.le + _ = H := by field_simp + · intro j + dsimp only [ξ] + field_simp + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def lengthAwareSpectrumCover {K : Type*} [Fintype K] + (C L : ℝ) (c : ℕ) (cover : ℝ → Finset K) (ζ : ℝ) : Finset K := by + classical + exact if C / ζ ^ c ≤ L then cover ζ else Finset.univ + +theorem lengthAwareSpectrumCover_card {K : Type*} [Fintype K] + (cover : ℝ → Finset K) {C L V A ζ : ℝ} {c t a : ℕ} + (hL : 0 ≤ L) (hV : 0 ≤ V) (hA : 0 ≤ A) (hC : 0 ≤ C) (hζ : 0 < ζ) + (hsize : (Fintype.card K : ℝ) ≤ V * L ^ t) + (hcover : ((cover ζ).card : ℝ) ≤ A / ζ ^ a) : + ((lengthAwareSpectrumCover C L c cover ζ).card : ℝ) ≤ + A / ζ ^ a + V * C ^ t / ζ ^ (c * t) := by + classical + unfold lengthAwareSpectrumCover + split_ifs with hstart + · exact hcover.trans (le_add_of_nonneg_right (by positivity)) + · rw [Finset.card_univ] + have hb := length_small_grid_bound hV hL hsize (le_of_lt (lt_of_not_ge hstart)) + exact hb.trans (le_add_of_nonneg_left (by positivity)) + +theorem lengthAwareSpectrumCover_accuracy {B K : Type*} + [Fintype B] [Fintype K] [DecidableEq K] + (coeff : B → K → ℂ) (cover : ℝ → Finset K) {C L V A ζ ε : ℝ} {c t a : ℕ} + (hC : 0 < C) (hL : 0 ≤ L) (hV : 0 ≤ V) (hA : 0 ≤ A) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) (hc : 0 < c) + (haB : a + 1 ≤ Fintype.card B) (htB : c * t + 1 ≤ Fintype.card B) + (hsize : (Fintype.card K : ℝ) ≤ V * L ^ t) + (hcover : ∀ δ, 0 < δ → δ ≤ 1 → ((cover δ).card : ℝ) ≤ A / δ ^ a) + (hminor : ∀ δ, 0 < δ → δ ≤ 1 → C / δ ^ c ≤ L → + ∀ b k, k ∉ cover δ → ‖coeff b k‖ ≤ δ) + (haccuracy : (2 * A * 2 ^ a + V * (2 ^ c * C) ^ t) * ζ ≤ ε) : + spectrumTail (lengthAwareSpectrumCover C L c cover ζ) + (fun k => ‖∏ b, coeff b k‖) ≤ ε := by + classical + by_cases hstart : C / ζ ^ c ≤ L + · obtain ⟨n, hn, hlast⟩ := exists_length_dyadic_cutoff hC hζ hc hstart + have hδ (i : ℕ) : 0 < ζ / 2 ^ i ∧ ζ / 2 ^ i ≤ 1 := by + refine ⟨by positivity, ?_⟩ + exact (div_le_self hζ.le (one_le_pow₀ (by norm_num : (1 : ℝ) ≤ 2))).trans hζ1 + have hb := length_cutoff_mass_bound hV hL (hδ n).1.le hsize hlast + have hcount (i : ℕ) (_hi : i < n) : + ((cover (ζ / 2 ^ (i + 1))).card : ℝ) ≤ A * (2 ^ (i + 1) / ζ) ^ a := by + have hh := hcover (ζ / 2 ^ (i + 1)) (hδ _).1 (hδ _).2 + apply hh.trans_eq + simp only [div_pow, div_div_eq_mul_div] + ring + have hsmall (i : ℕ) (hi : i ≤ n) := + hminor (ζ / 2 ^ i) (hδ i).1 (hδ i).2 (hn i hi) + have ht := product_spectrumTail_le_accuracy coeff (fun i => cover (ζ / 2 ^ i)) + n a (c * t) hA (by positivity) hζ hζ1 haB htB hcount hsmall hb haccuracy + simpa only [lengthAwareSpectrumCover, ite_eq_left hstart, pow_zero, div_one] using ht + · simpa only [lengthAwareSpectrumCover, ite_eq_right hstart, spectrumTail, + Finset.mem_univ, ite_true, Finset.sum_const_zero] using hε + +theorem exists_lengthAwareSpectrum_accuracy {B K : Type*} + [Fintype B] [Fintype K] [DecidableEq K] + (coeff : B → K → ℂ) (cover : ℝ → Finset K) {C L V A ε : ℝ} {c t a : ℕ} + (hC : 0 < C) (hL : 0 ≤ L) (hV : 0 ≤ V) (hA : 0 ≤ A) (hε : 0 < ε) (hc : 0 < c) + (haB : a + 1 ≤ Fintype.card B) (htB : c * t + 1 ≤ Fintype.card B) + (hsize : (Fintype.card K : ℝ) ≤ V * L ^ t) + (hcover : ∀ δ, 0 < δ → δ ≤ 1 → ((cover δ).card : ℝ) ≤ A / δ ^ a) + (hminor : ∀ δ, 0 < δ → δ ≤ 1 → C / δ ^ c ≤ L → + ∀ b k, k ∉ cover δ → ‖coeff b k‖ ≤ δ) : + ∃ ζ : ℝ, 0 < ζ ∧ ζ ≤ 1 ∧ + ((lengthAwareSpectrumCover C L c cover ζ).card : ℝ) ≤ + A / ζ ^ a + V * C ^ t / ζ ^ (c * t) ∧ + spectrumTail (lengthAwareSpectrumCover C L c cover ζ) + (fun k => ‖∏ b, coeff b k‖) ≤ ε := by + obtain ⟨ζ, hζ, hζ1, hacc⟩ := exists_spectrum_retained_level hA + (show 0 ≤ V * (2 ^ c * C) ^ t by positivity) hε a + refine ⟨ζ, hζ, hζ1, ?_, ?_⟩ + · exact lengthAwareSpectrumCover_card cover hL hV hA hC.le hζ hsize (hcover ζ hζ hζ1) + · exact lengthAwareSpectrumCover_accuracy coeff cover hC hL hV hA hζ hζ1 hε.le hc + haB htB hsize hcover hminor hacc + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem rationalGridMajorBox_scaled_character {J : Type*} [Fintype J] [DecidableEq J] + {K M Q H : ℕ} (hK : 0 < K) (hKM : K ≤ M) + (k : J → Fin M) (hk : k ∈ rationalGridMajorBox J M Q H) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ (Q + 1 : ℝ) ^ Fintype.card J ∧ + ∃ (a : J → ℤ) (ω : J → ℝ), (∀ j, |ω j| ≤ H) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ω j / K := by + have hM : 0 < M := lt_of_lt_of_le hK hKM + have hK0 : (K : ℝ) ≠ 0 := (Nat.cast_pos.mpr hK).ne' + have hM0 : (M : ℝ) ≠ 0 := (Nat.cast_pos.mpr hM).ne' + obtain ⟨D, hD, hDQ, a, ξ, hξ, he⟩ := rationalGridMajorBox_character hM k hk + refine ⟨D, hD, hDQ, a, (fun j => (K : ℝ) * ξ j / M), ?_, ?_⟩ + · intro j + simp only [abs_div, abs_mul, abs_of_nonneg (Nat.cast_nonneg K : (0 : ℝ) ≤ K), + abs_of_nonneg (Nat.cast_nonneg M : (0 : ℝ) ≤ M)] + apply (div_le_iff₀ (Nat.cast_pos.mpr hM)).mpr + calc + (K : ℝ) * |ξ j| ≤ (K : ℝ) * H := mul_le_mul_of_nonneg_left (hξ j) (Nat.cast_nonneg K) + _ ≤ (M : ℝ) * H := mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hKM) (Nat.cast_nonneg H) + _ = (H : ℝ) * M := mul_comm _ _ + · intro j + rw [he j] + congr 1 + field_simp + +theorem lengthAwarePolynomialGrid_character {J : Type*} [Fintype J] [DecidableEq J] + {K M : ℕ} (hK : 0 < K) (hKM : K ≤ M) + {C L V A ζ : ℝ} {c t r : ℕ} (hL : 0 ≤ L) (hV : 0 ≤ V) + (hsize : (M : ℝ) ^ Fintype.card J ≤ V * L ^ t) + (k : J → Fin M) + (hk : k ∈ lengthAwareSpectrumCover C L c (polynomialGridCover J M A r) ζ) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ max ((⌈A / ζ ^ r⌉₊ + 1 : ℝ) ^ Fintype.card J) + (V * C ^ t / ζ ^ (c * t)) ∧ + ∃ (a : J → ℤ) (ω : J → ℝ), (∀ j, |ω j| ≤ (⌈A / ζ ^ r⌉₊ : ℝ)) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ω j / K := by + classical + by_cases hstart : C / ζ ^ c ≤ L + · have hk' : k ∈ rationalGridMajorBox J M ⌈A / ζ ^ r⌉₊ ⌈A / ζ ^ r⌉₊ := by + simpa only [lengthAwareSpectrumCover, ite_eq_left hstart, polynomialGridCover] using hk + obtain ⟨D, hD, hb, a, ω, hω, he⟩ := rationalGridMajorBox_scaled_character hK hKM k hk' + exact ⟨D, hD, hb.trans (le_max_left _ _), a, ω, hω, he⟩ + · cases isEmpty_or_nonempty J with + | inl hJ => + let := hJ + refine ⟨1, Nat.zero_lt_one, ?_, (fun j => isEmptyElim j), + (fun j => isEmptyElim j), (fun j => isEmptyElim j), (fun j => isEmptyElim j)⟩ + simpa only [Fintype.card_eq_zero, pow_zero, Nat.cast_one] using + (le_max_left (1 : ℝ) (V * C ^ t / ζ ^ (c * t))) + | inr hJ => + let := hJ + have hM : 0 < M := lt_of_lt_of_le hK hKM + have hpow : (M : ℝ) ≤ (M : ℝ) ^ Fintype.card J := + le_self_pow₀ (by exact_mod_cast hM) (Fintype.card_pos.ne') + have hb := length_small_grid_bound hV hL hsize (le_of_lt (lt_of_not_ge hstart)) + refine ⟨M, hM, (hpow.trans hb).trans (le_max_right _ _), + (fun j => ((k j).val : ℤ)), (fun _ => 0), ?_, ?_⟩ + · intro j + simpa only [abs_zero] using (Nat.cast_nonneg ⌈A / ζ ^ r⌉₊ : (0 : ℝ) ≤ _) + · intro j + simp only [Int.cast_natCast, zero_div, add_zero] + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def localizedMajorArcBudget (n : ℕ) (U ζ : ℝ) : ℝ := + multiaffineBiasBudget n (localizationThreshold U ζ (n + 1)) + +noncomputable def localizedMajorArcLengthBudget (n : ℕ) (U ζ : ℝ) : ℝ := + localizationLengthBudget U (localizationThreshold U ζ (n + 1)) + (localizedMajorArcBudget n U ζ + 1) + +noncomputable def localizedMajorArcErrorBudget (n : ℕ) (U ζ : ℝ) : ℝ := + localizedMajorArcBudget n U ζ * + (localizationLengthBudget U (localizationThreshold U ζ (n + 1)) 1) ^ (n + 1) + +theorem localizedMajorArcBudget_pos (n : ℕ) {U ζ : ℝ} (hU : 1 ≤ U) (hζ : 0 < ζ) : + 0 < localizedMajorArcBudget n U ζ := + multiaffineBiasBudget_pos n (localizationThreshold_pos hU hζ (n + 1)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem localizationLengthBudget_threshold_eq (U ζ W : ℝ) (m : ℕ) : + localizationLengthBudget U (localizationThreshold U ζ m) W = + 256 * U ^ 6 * W * (2 * U ^ 2) ^ (m * 2) / ζ ^ 2 := by + simp only [localizationLengthBudget, localizationThreshold, div_pow, div_div_eq_mul_div, pow_mul] + +theorem localizedMajorArcBudget_eq_power (n : ℕ) {U ζ : ℝ} + (hU : 1 ≤ U) (hζ : 0 < ζ) : + localizedMajorArcBudget n U ζ = + ((denseProductDensityConstant n : ℝ) * (2 * 3 ^ n) ^ denseProductExponent n) * + (2 * U ^ 2) ^ ((n + 1) * (2 ^ n * (denseProductExponent n + 1))) / + ζ ^ (2 ^ n * (denseProductExponent n + 1)) := by + unfold localizedMajorArcBudget + rw [multiaffineBiasBudget_eq_power n (localizationThreshold_pos hU hζ (n + 1))] + simp only [localizationThreshold, div_pow, div_div_eq_mul_div, pow_mul] + +theorem localizedMajorArcLengthBudget_eq (n : ℕ) (U ζ : ℝ) : + localizedMajorArcLengthBudget n U ζ = + 256 * U ^ 6 * (localizedMajorArcBudget n U ζ + 1) * + (2 * U ^ 2) ^ ((n + 1) * 2) / ζ ^ 2 := + localizationLengthBudget_threshold_eq U ζ (localizedMajorArcBudget n U ζ + 1) (n + 1) + +theorem localizedMajorArcErrorBudget_eq (n : ℕ) (U ζ : ℝ) : + localizedMajorArcErrorBudget n U ζ = + localizedMajorArcBudget n U ζ * + (256 * U ^ 6 * (2 * U ^ 2) ^ ((n + 1) * 2) / ζ ^ 2) ^ (n + 1) := by + unfold localizedMajorArcErrorBudget + rw [localizationLengthBudget_threshold_eq] + simp only [mul_one] + +end Erdos3 + +end + +section + +namespace Erdos3 + +def majorArcBiasExponent (n : ℕ) : ℕ := 2 ^ n * (denseProductExponent n + 1) + +noncomputable def majorArcBiasConstant (n : ℕ) (U : ℝ) : ℝ := + ((denseProductDensityConstant n : ℝ) * (2 * 3 ^ n) ^ denseProductExponent n) * + (2 * U ^ 2) ^ ((n + 1) * majorArcBiasExponent n) + +noncomputable def majorArcLocalizationConstant (n : ℕ) (U : ℝ) : ℝ := + 256 * U ^ 6 * (2 * U ^ 2) ^ ((n + 1) * 2) + +def majorArcLengthExponent (n : ℕ) : ℕ := majorArcBiasExponent n + 2 + +noncomputable def majorArcLengthConstant (n : ℕ) (U : ℝ) : ℝ := + majorArcLocalizationConstant n U * (majorArcBiasConstant n U + 1) + +def majorArcErrorExponent (n : ℕ) : ℕ := majorArcBiasExponent n + 2 * (n + 1) + +noncomputable def majorArcErrorConstant (n : ℕ) (U : ℝ) : ℝ := + majorArcBiasConstant n U * majorArcLocalizationConstant n U ^ (n + 1) + +theorem majorArcBiasConstant_pos (n : ℕ) {U : ℝ} (hU : 1 ≤ U) : + 0 < majorArcBiasConstant n U := by + have h := localizedMajorArcBudget_pos n hU (by norm_num : (0 : ℝ) < 1) + rw [localizedMajorArcBudget_eq_power n hU (by norm_num)] at h + simpa only [majorArcBiasConstant, majorArcBiasExponent, one_pow, div_one] using h + +theorem majorArcLocalizationConstant_pos (n : ℕ) {U : ℝ} (hU : 1 ≤ U) : + 0 < majorArcLocalizationConstant n U := by + have : 0 < U := lt_of_lt_of_le (by norm_num) hU + unfold majorArcLocalizationConstant + positivity + +theorem majorArcLengthConstant_pos (n : ℕ) {U : ℝ} (hU : 1 ≤ U) : + 0 < majorArcLengthConstant n U := by + have := majorArcBiasConstant_pos n hU + have := majorArcLocalizationConstant_pos n hU + unfold majorArcLengthConstant + positivity + +theorem majorArcErrorConstant_pos (n : ℕ) {U : ℝ} (hU : 1 ≤ U) : + 0 < majorArcErrorConstant n U := by + have := majorArcBiasConstant_pos n hU + have := majorArcLocalizationConstant_pos n hU + unfold majorArcErrorConstant + positivity + +theorem localizedMajorArcBudget_constant (n : ℕ) {U ζ : ℝ} + (hU : 1 ≤ U) (hζ : 0 < ζ) : + localizedMajorArcBudget n U ζ = majorArcBiasConstant n U / ζ ^ majorArcBiasExponent n := + localizedMajorArcBudget_eq_power n hU hζ + +theorem localizedMajorArcLengthBudget_le_power (n : ℕ) {U ζ : ℝ} + (hU : 1 ≤ U) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) : + localizedMajorArcLengthBudget n U ζ ≤ + majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n := by + have hp : 0 < ζ ^ majorArcBiasExponent n := pow_pos hζ _ + have hp1 : ζ ^ majorArcBiasExponent n ≤ 1 := pow_le_one₀ hζ.le hζ1 + have hone : (1 : ℝ) ≤ 1 / ζ ^ majorArcBiasExponent n := (le_div_iff₀ hp).mpr (by simpa) + have hC := (majorArcLocalizationConstant_pos n hU).le + rw [localizedMajorArcLengthBudget_eq, localizedMajorArcBudget_constant n hU hζ] + have he (x : ℝ) : 256 * U ^ 6 * x * (2 * U ^ 2) ^ ((n + 1) * 2) = + majorArcLocalizationConstant n U * x := by + unfold majorArcLocalizationConstant + ring + rw [he] + calc + _ ≤ majorArcLocalizationConstant n U * + (majorArcBiasConstant n U / ζ ^ majorArcBiasExponent n + + 1 / ζ ^ majorArcBiasExponent n) / ζ ^ 2 := by gcongr + _ = _ := by + simp only [majorArcLengthConstant, majorArcLengthExponent, pow_add] + ring + +theorem localizedMajorArcErrorBudget_constant (n : ℕ) {U ζ : ℝ} + (hU : 1 ≤ U) (hζ : 0 < ζ) : + localizedMajorArcErrorBudget n U ζ = + majorArcErrorConstant n U / ζ ^ majorArcErrorExponent n := by + rw [localizedMajorArcErrorBudget_eq, localizedMajorArcBudget_constant n hU hζ] + change (majorArcBiasConstant n U / ζ ^ majorArcBiasExponent n) * + (majorArcLocalizationConstant n U / ζ ^ 2) ^ (n + 1) = _ + simp only [majorArcErrorConstant, majorArcErrorExponent, div_pow, pow_add, pow_mul] + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +def majorArcCoverExponent (n j : ℕ) : ℕ := + majorArcBiasExponent n * j + majorArcErrorExponent n + +noncomputable def majorArcCoverConstant (n j : ℕ) (U V : ℝ) : ℝ := + 1 + (majorArcBiasConstant n U * U ^ (n + 1)) ^ j + V * majorArcErrorConstant n U + +def majorArcSpectrumExponent (n j : ℕ) : ℕ := 4 * majorArcCoverExponent n j * j + +noncomputable def majorArcSpectrumConstant (n j : ℕ) (U V : ℝ) : ℝ := + (195 * majorArcCoverConstant n j U V ^ 4) ^ j + +theorem majorArcCoverConstant_one_le (n j : ℕ) {U V : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) : 1 ≤ majorArcCoverConstant n j U V := by + have hq := (majorArcBiasConstant_pos n hU).le + have he := (majorArcErrorConstant_pos n hU).le + have hU0 : 0 ≤ U := le_trans (by norm_num) hU + have hd : 0 ≤ (majorArcBiasConstant n U * U ^ (n + 1)) ^ j := by positivity + unfold majorArcCoverConstant + nlinarith only [hd, mul_nonneg hV he] + +theorem majorArcSpectrumConstant_nonneg (n j : ℕ) (U V : ℝ) : + 0 ≤ majorArcSpectrumConstant n j U V := by + unfold majorArcSpectrumConstant + positivity + +theorem majorArc_denominator_le_cover (n j : ℕ) {U V ζ : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) : + (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ j ≤ + majorArcCoverConstant n j U V / ζ ^ majorArcCoverExponent n j := by + have he := (majorArcErrorConstant_pos n hU).le + have hC := (majorArcCoverConstant_one_le n j hU hV).trans' (by norm_num : (0 : ℝ) ≤ 1) + have hle : (majorArcBiasConstant n U * U ^ (n + 1)) ^ j ≤ + majorArcCoverConstant n j U V := by + unfold majorArcCoverConstant + nlinarith only [mul_nonneg hV he] + calc + _ = (majorArcBiasConstant n U * U ^ (n + 1)) ^ j / ζ ^ (majorArcBiasExponent n * j) := by + rw [localizedMajorArcBudget_constant n hU hζ, div_mul_eq_mul_div, div_pow, pow_mul] + _ ≤ _ := inverse_power_mono hC hle hζ hζ1 (by unfold majorArcCoverExponent; omega) + +theorem majorArc_scaled_error_le_cover (n j : ℕ) {U V ζ R P : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hscale : R / P ≤ V) : + R * (localizedMajorArcErrorBudget n U ζ / P) ≤ + majorArcCoverConstant n j U V / ζ ^ majorArcCoverExponent n j := by + have hE := (majorArcErrorConstant_pos n hU).le + have hQ := (majorArcBiasConstant_pos n hU).le + have hU0 : 0 ≤ U := le_trans (by norm_num) hU + have hd : 0 ≤ (majorArcBiasConstant n U * U ^ (n + 1)) ^ j := by positivity + have hC : 0 ≤ majorArcCoverConstant n j U V := + le_trans (by norm_num) (majorArcCoverConstant_one_le n j hU hV) + have hle : V * majorArcErrorConstant n U ≤ majorArcCoverConstant n j U V := by + unfold majorArcCoverConstant + linarith only [hd] + rw [localizedMajorArcErrorBudget_constant n hU hζ] + calc + _ = (R / P) * (majorArcErrorConstant n U / ζ ^ majorArcErrorExponent n) := by ring + _ ≤ V * (majorArcErrorConstant n U / ζ ^ majorArcErrorExponent n) := + mul_le_mul_of_nonneg_right hscale (by positivity) + _ = (V * majorArcErrorConstant n U) / ζ ^ majorArcErrorExponent n := by ring + _ ≤ _ := inverse_power_mono hC hle hζ hζ1 (by unfold majorArcCoverExponent; omega) + +theorem uniformMajorArcCover_card (J : Type*) [Fintype J] [DecidableEq J] + (M n : ℕ) {U V ζ : ℝ} (hU : 1 ≤ U) (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) : + ((polynomialGridCover J M (majorArcCoverConstant n (Fintype.card J) U V) + (majorArcCoverExponent n (Fintype.card J)) ζ).card : ℝ) ≤ + majorArcSpectrumConstant n (Fintype.card J) U V / + ζ ^ majorArcSpectrumExponent n (Fintype.card J) := + polynomialGridCover_card J M _ (majorArcCoverConstant_one_le n _ hU hV) hζ hζ1 + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def uniformSpectrumBlockCount (n j t : ℕ) : ℕ := + max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t) + 1 + +noncomputable def uniformBlockSpectrumCover (J : Type*) [Fintype J] [DecidableEq J] + (M n : ℕ) (U V L ζ : ℝ) : Finset (J → Fin M) := + lengthAwareSpectrumCover (majorArcLengthConstant n U) L (majorArcLengthExponent n) + (polynomialGridCover J M (majorArcCoverConstant n (Fintype.card J) U V) + (majorArcCoverExponent n (Fintype.card J))) ζ + +noncomputable def uniformBlockSpectrumCardBudget (n j t : ℕ) (U V W ζ : ℝ) : ℝ := + majorArcSpectrumConstant n j U V / ζ ^ majorArcSpectrumExponent n j + + W * majorArcLengthConstant n U ^ t / ζ ^ (majorArcLengthExponent n * t) + +noncomputable def uniformBlockSpectrumAccuracyConstant (n j t : ℕ) (U V W : ℝ) : ℝ := + 2 * majorArcSpectrumConstant n j U V * 2 ^ majorArcSpectrumExponent n j + + W * (2 ^ majorArcLengthExponent n * majorArcLengthConstant n U) ^ t + +theorem uniformBlockSpectrumCover_card (J : Type*) [Fintype J] [DecidableEq J] + (M n t : ℕ) {U V W L ζ : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) : + ((uniformBlockSpectrumCover J M n U V L ζ).card : ℝ) ≤ + uniformBlockSpectrumCardBudget n (Fintype.card J) t U V W ζ := by + apply lengthAwareSpectrumCover_card _ hL hW (majorArcSpectrumConstant_nonneg _ _ _ _) + (majorArcLengthConstant_pos n hU).le hζ + · simpa only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] using hsize + · exact uniformMajorArcCover_card J M n hU hV hζ hζ1 + +theorem uniformBlockSpectrum_tail {B J : Type*} [Fintype B] [Fintype J] [DecidableEq J] + (M n t : ℕ) (coeff : B → (J → Fin M) → ℂ) {U V W L ζ ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (hB : uniformSpectrumBlockCount n (Fintype.card J) t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) + (hminor : ∀ δ, 0 < δ → δ ≤ 1 → majorArcLengthConstant n U / δ ^ majorArcLengthExponent n ≤ L → + ∀ b k, k ∉ polynomialGridCover J M (majorArcCoverConstant n (Fintype.card J) U V) + (majorArcCoverExponent n (Fintype.card J)) δ → ‖coeff b k‖ ≤ δ) + (haccuracy : uniformBlockSpectrumAccuracyConstant n (Fintype.card J) t U V W * ζ ≤ ε) : + spectrumTail (uniformBlockSpectrumCover J M n U V L ζ) (fun k => ‖∏ b, coeff b k‖) ≤ ε := by + classical + apply lengthAwareSpectrumCover_accuracy coeff _ (t := t) + (a := majorArcSpectrumExponent n (Fintype.card J)) + (majorArcLengthConstant_pos n hU) hL hW + (majorArcSpectrumConstant_nonneg n (Fintype.card J) U V) hζ hζ1 hε + · unfold majorArcLengthExponent; omega + · unfold uniformSpectrumBlockCount at hB; omega + · unfold uniformSpectrumBlockCount at hB; omega + · simpa only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] using hsize + · intro δ hδ hδ1 + exact uniformMajorArcCover_card J M n hU hV hδ hδ1 + · exact hminor + · exact haccuracy + +theorem exists_uniformBlockSpectrum_level (n j t : ℕ) {U V W ε : ℝ} + (hU : 1 ≤ U) (hW : 0 ≤ W) (hε : 0 < ε) : + ∃ ζ : ℝ, 0 < ζ ∧ ζ ≤ 1 ∧ uniformBlockSpectrumAccuracyConstant n j t U V W * ζ ≤ ε := by + have hC := (majorArcLengthConstant_pos n hU).le + exact exists_spectrum_retained_level (majorArcSpectrumConstant_nonneg n j U V) + (show 0 ≤ W * (2 ^ majorArcLengthExponent n * majorArcLengthConstant n U) ^ t by positivity) + hε (majorArcSpectrumExponent n j) + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem polynomialGridCover_character {J : Type*} [Fintype J] [DecidableEq J] + {M : ℕ} (hM : 0 < M) {C ζ : ℝ} (r : ℕ) (hC : 1 ≤ C) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (k : J → Fin M) (hk : k ∈ polynomialGridCover J M C r ζ) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ (3 * C) ^ Fintype.card J / ζ ^ (r * Fintype.card J) ∧ + ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ j, |ξ j| ≤ 2 * C / ζ ^ r) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ξ j / M := by + have hX := one_le_inverse_power hC hζ hζ1 r + have hceil := Nat.ceil_lt_add_one (show 0 ≤ C / ζ ^ r by linarith) + obtain ⟨D, hD, hDQ, a, ξ, hξ, he⟩ := rationalGridMajorBox_character hM k hk + refine ⟨D, hD, ?_, a, ξ, ?_, he⟩ + · have hq : (⌈C / ζ ^ r⌉₊ : ℝ) + 1 ≤ 3 * (C / ζ ^ r) := by linarith + apply (hDQ.trans (pow_le_pow_left₀ (by positivity) hq _)).trans_eq + rw [← mul_div_assoc, div_pow, pow_mul] + · intro j + have hh := hξ j + have heq : 2 * C / ζ ^ r = 2 * (C / ζ ^ r) := by ring + rw [heq] + linarith + +theorem fullGrid_rational_character {J : Type*} [Fintype J] + {M : ℕ} (hM : 0 < M) {A : ℝ} (hA : 0 ≤ A) + (hsize : (M : ℝ) ^ Fintype.card J ≤ A) (k : J → Fin M) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ 1 + A ∧ + ∃ a : J → ℤ, ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D := by + classical + by_cases hj : Fintype.card J = 0 + · let : IsEmpty J := Fintype.card_eq_zero_iff.mp hj + exact ⟨1, by omega, by norm_num; linarith, fun _ => 0, fun j => isEmptyElim j⟩ + · have hM1 : (1 : ℝ) ≤ M := by exact_mod_cast hM + have hp : (M : ℝ) ≤ (M : ℝ) ^ Fintype.card J := by + simpa only [pow_one] using pow_le_pow_right₀ hM1 (show 1 ≤ Fintype.card J by omega) + refine ⟨M, hM, by linarith, fun j => (k j).val, ?_⟩ + intro j + simp only [Int.cast_natCast] + +noncomputable def uniformCharacterDenominatorBound (n j t : ℕ) (U V W ζ : ℝ) : ℝ := + 1 + (3 * majorArcCoverConstant n j U V) ^ j / ζ ^ (majorArcCoverExponent n j * j) + + W * majorArcLengthConstant n U ^ t / ζ ^ (majorArcLengthExponent n * t) + +theorem uniformBlockSpectrumCover_character {J : Type*} [Fintype J] [DecidableEq J] + {M : ℕ} (hM : 0 < M) (n t : ℕ) {U V W L ζ : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) + (k : J → Fin M) (hk : k ∈ uniformBlockSpectrumCover J M n U V L ζ) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ uniformCharacterDenominatorBound n (Fintype.card J) t U V W ζ ∧ + ∃ (a : J → ℤ) (ξ : J → ℝ), + (∀ j, |ξ j| ≤ 2 * majorArcCoverConstant n (Fintype.card J) U V / ζ ^ majorArcCoverExponent n (Fintype.card J)) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ξ j / M := by + classical + have hC := majorArcCoverConstant_one_le n (Fintype.card J) hU hV + have hCL := (majorArcLengthConstant_pos n hU).le + by_cases hl : majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ L + · have hk' : k ∈ polynomialGridCover J M (majorArcCoverConstant n (Fintype.card J) U V) + (majorArcCoverExponent n (Fintype.card J)) ζ := by + simpa only [uniformBlockSpectrumCover, lengthAwareSpectrumCover, ite_eq_left hl] using hk + obtain ⟨D, hD, hDb, a, ξ, hξ, he⟩ := polynomialGridCover_character hM _ hC hζ hζ1 k hk' + refine ⟨D, hD, ?_, a, ξ, hξ, he⟩ + unfold uniformCharacterDenominatorBound + have hs : 0 ≤ W * majorArcLengthConstant n U ^ t / ζ ^ (majorArcLengthExponent n * t) := by positivity + linarith + · have hb := length_small_grid_bound hW hL hsize (le_of_lt (lt_of_not_ge hl)) + obtain ⟨D, hD, hDb, a, ha⟩ := fullGrid_rational_character hM (by positivity) hb k + refine ⟨D, hD, ?_, a, fun _ => 0, ?_, ?_⟩ + · unfold uniformCharacterDenominatorBound + have hs : 0 ≤ (3 * majorArcCoverConstant n (Fintype.card J) U V) ^ Fintype.card J / + ζ ^ (majorArcCoverExponent n (Fintype.card J) * Fintype.card J) := by positivity + linarith + · intro j + simp only [abs_zero] + positivity + · intro j + simpa only [zero_div, add_zero] using ha j + +theorem grid_character_rescale {J : Type*} {R K D : ℕ} (hR : 0 < R) + (k : J → Fin (R * K)) (a : J → ℤ) (ξ : J → ℝ) {H : ℝ} + (hξ : ∀ j, |ξ j| ≤ H) + (he : ∀ j, ((k j).val : ℝ) / (R * K) = (a j : ℝ) / D + ξ j / (R * K)) : + ∃ ρ : J → ℝ, (∀ j, |ρ j| ≤ H) ∧ + ∀ j, ((k j).val : ℝ) / (R * K) = (a j : ℝ) / D + ρ j / K := by + have hR1 : (1 : ℝ) ≤ R := by exact_mod_cast hR + refine ⟨fun j => ξ j / R, ?_, ?_⟩ + · intro j + rw [abs_div, abs_of_nonneg (show (0 : ℝ) ≤ R from Nat.cast_nonneg R)] + exact (div_le_self (abs_nonneg _) hR1).trans (hξ j) + · intro j + simpa only [div_div] using he j + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def uniformScaledRetainedFrequencyBound (n d : ℕ) (U V ζ : ℝ) : ℝ := + (⌈majorArcCoverConstant n d U V / ζ ^ majorArcCoverExponent n d⌉₊ : ℝ) + +noncomputable def uniformScaledRetainedDenominatorBound (n d t : ℕ) (U V W ζ : ℝ) : ℝ := + max ((uniformScaledRetainedFrequencyBound n d U V ζ + 1) ^ d) + (W * majorArcLengthConstant n U ^ t / ζ ^ (majorArcLengthExponent n * t)) + +theorem uniformScaledRetainedFrequencyBound_nonneg (n d : ℕ) (U V ζ : ℝ) : + 0 ≤ uniformScaledRetainedFrequencyBound n d U V ζ := Nat.cast_nonneg _ + +theorem uniformScaledRetainedDenominatorBound_one_le (n d t : ℕ) (U V W ζ : ℝ) : + 1 ≤ uniformScaledRetainedDenominatorBound n d t U V W ζ := by + apply (one_le_pow₀ (show 1 ≤ uniformScaledRetainedFrequencyBound n d U V ζ + 1 by + linarith [uniformScaledRetainedFrequencyBound_nonneg n d U V ζ])).trans + exact le_max_left _ _ + +theorem uniformBlockSpectrumCover_scaled_character {J : Type*} [Fintype J] [DecidableEq J] + {K M : ℕ} (hK : 0 < K) (hKM : K ≤ M) (n t : ℕ) {U V W L ζ : ℝ} + (hL : 0 ≤ L) (hW : 0 ≤ W) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) + (k : J → Fin M) (hk : k ∈ uniformBlockSpectrumCover J M n U V L ζ) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ uniformScaledRetainedDenominatorBound n (Fintype.card J) t U V W ζ ∧ + ∃ (a : J → ℤ) (ω : J → ℝ), + (∀ j, |ω j| ≤ uniformScaledRetainedFrequencyBound n (Fintype.card J) U V ζ) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ω j / K := + lengthAwarePolynomialGrid_character hK hKM hL hW hsize k hk + +theorem uniformBlockSpectrumCover_modes {J : Type*} [Fintype J] [DecidableEq J] + {K M : ℕ} (hK : 0 < K) (hKM : K ≤ M) (n t : ℕ) {U V W L ζ : ℝ} + (hL : 0 ≤ L) (hW : 0 ≤ W) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) : + ∃ (D : (J → Fin M) → ℕ) (a : (J → Fin M) → J → ℤ) (ω : (J → Fin M) → J → ℝ), + (∀ k, 0 < D k) ∧ ∀ k ∈ uniformBlockSpectrumCover J M n U V L ζ, + (D k : ℝ) ≤ uniformScaledRetainedDenominatorBound n (Fintype.card J) t U V W ζ ∧ + (∀ j, |ω k j| ≤ uniformScaledRetainedFrequencyBound n (Fintype.card J) U V ζ) ∧ + ∀ j, ((k j).val : ℝ) / M = (a k j : ℝ) / D k + ω k j / K := by + classical + have hex (k : J → Fin M) : ∃ D : ℕ, 0 < D ∧ ∃ (a : J → ℤ) (ω : J → ℝ), + k ∈ uniformBlockSpectrumCover J M n U V L ζ → + (D : ℝ) ≤ uniformScaledRetainedDenominatorBound n (Fintype.card J) t U V W ζ ∧ + (∀ j, |ω j| ≤ uniformScaledRetainedFrequencyBound n (Fintype.card J) U V ζ) ∧ + ∀ j, ((k j).val : ℝ) / M = (a j : ℝ) / D + ω j / K := by + by_cases hk : k ∈ uniformBlockSpectrumCover J M n U V L ζ + · obtain ⟨D, hD, hb, a, ω, hω, he⟩ := + uniformBlockSpectrumCover_scaled_character hK hKM n t hL hW hsize k hk + exact ⟨D, hD, a, ω, fun _ => ⟨hb, hω, he⟩⟩ + · exact ⟨1, Nat.zero_lt_one, 0, 0, fun h => (hk h).elim⟩ + choose D hD a ω h using hex + exact ⟨D, a, ω, hD, h⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumAbsoluteCap.lean b/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumAbsoluteCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d38e4afca62f623af24954c6b37719756b8e35c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumAbsoluteCap.lean @@ -0,0 +1,553 @@ +import OAI.Combinatorics.Progressions.Dynamics.PositiveModerateBudget +import OAI.Combinatorics.Progressions.Fourier.AffineShortCoefficientMajorArc + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem mem_rationalGridMajorBox {J : Type*} [Fintype J] [DecidableEq J] + {M Q H : ℕ} (hM : 0 < M) (k : J → Fin M) + {D : ℕ} (hD : 0 < D) (hDQ : D ≤ Q) (a : J → ℤ) {E : ℝ} + (hclose : ∀ j, |((k j).val : ℝ) / M - (a j : ℝ) / D| ≤ E) + (hE : M * E ≤ H) : k ∈ rationalGridMajorBox J M Q H := by + apply Fintype.mem_piFinset.mpr + intro j + exact mem_rationalGridMajorSet hM hD hDQ (k j) (a j) + (scaled_grid_approximation hM (k j) (a j) (D) (hclose j) hE) + +theorem grid_large_spectrum_card {J : Type*} [Fintype J] [DecidableEq J] + {M Q H : ℕ} (hM : 0 < M) (f : (J → Fin M) → ℂ) (ζ E : ℝ) + (hmajor : ∀ k, ζ ≤ ‖f k‖ → ∃ D : ℕ, 0 < D ∧ D ≤ Q ∧ + ∃ a : J → ℤ, ∀ j, |((k j).val : ℝ) / M - (a j : ℝ) / D| ≤ E) + (hE : M * E ≤ H) : + ((Finset.univ.filter (fun k => ζ ≤ ‖f k‖)).card : ℝ) ≤ + ((Q + 1 : ℝ) * (2 * Q * (H + 1) + 1) * (2 * H + 1)) ^ Fintype.card J := by + classical + have hsub : Finset.univ.filter (fun k => ζ ≤ ‖f k‖) ⊆ rationalGridMajorBox J M Q H := by + intro k hk + obtain ⟨D, hD, hDQ, a, ha⟩ := hmajor k (Finset.mem_filter.mp hk).2 + exact mem_rationalGridMajorBox hM k hD hDQ a ha hE + have hc : ((Finset.univ.filter (fun k => ζ ≤ ‖f k‖)).card : ℝ) ≤ + (rationalGridMajorBox J M Q H).card := by exact_mod_cast Finset.card_le_card hsub + exact hc.trans (rationalGridMajorBox_card J M Q H) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal +open CircleFourier + +theorem polynomial_weightedModerateBlock_major_arc {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hclen : localizedMajorArcLengthBudget n U ζ ≤ c.length) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (shift : ℝ) (ξ : Finset I → ℝ) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hbias : ζ ≤ ‖c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((shift + (z none : ℝ)) * + booleanBlockPhase ξ (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle)))‖) : + ∃ D : ℕ, 0 < D ∧ + (D : ℝ) ≤ (localizedMajorArcBudget n U ζ * ((c.modulus none : ℝ) * U ^ n)) ^ J.card ∧ + ∃ a : J → ℤ, ∀ S : J, |ξ S - (a S : ℝ) / D| ≤ + localizedMajorArcErrorBudget n U ζ / + (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) := by + let d j := (s j).majorArcLocalizationData A hA (h j) hζ hζ1 (hlen j) + let e := c.majorArcLocalizationData A hA hc hζ hζ1 hclen + let τ : Fin (n + 2) → ℝ := fun i => localizationThreshold U ζ i.val + have hτ (j : Fin (n + 1)) : 0 < τ j.succ := localizationThreshold_pos hc.one_le hζ _ + have he : e.error (τ 1) ≤ τ 0 := by + simpa only [τ, Fin.val_one, Fin.val_zero] using + c.majorArcLocalizationData_error A hA hc hζ hζ1 hclen (i := 0) (by omega) + have hd (j : Fin n) : (d j).error (τ j.succ.succ) ≤ τ j.castSucc.succ := + (s j).majorArcLocalizationData_error A hA (h j) hζ hζ1 (hlen j) (by omega) + have hR (j : Fin n) (i : Option I) : ((d j).modulus i : ℝ) ≤ U := + (by exact_mod_cast (s j).modulus_le i : ((s j).modulus i : ℝ) ≤ (s j).modulusBound).trans + (h j).modulus_le + have hN (j : Fin n) : multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ (d j).cellLength := + (s j).majorArcLocalizationData_cellLength A hA (h j) hζ hζ1 (hlen j) + have hM : multiaffineBiasBudget n (τ (Fin.last (n + 1))) ≤ e.cellLength := + c.majorArcLocalizationData_cellLength A hA hc hζ hζ1 hclen + have hb : τ 0 ≤ ‖e.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (d j).source)).complexMean + (fun x => character (((shift + (z none : ℝ)) * + booleanBlockPhase ξ (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle)))‖ := by + change localizationThreshold U ζ 0 ≤ _ + rw [localizationThreshold_zero] + exact hbias + obtain ⟨D, hD, hDb, a, ha⟩ := weightedModerateBlock_major_arc e d τ hτ he hd shift ξ J hJ hR hN hM hb + refine ⟨D, hD, hDb, a, fun S => (ha S).trans ?_⟩ + have hcloss := c.majorArcLocalizationData_lengthLoss A hA hc hζ hζ1 hclen + have hsloss j := (s j).majorArcLocalizationData_lengthLoss A hA (h j) hζ hζ1 (hlen j) + apply coefficient_inverse_product_le (fun j => ((s j).length : ℝ)) + (fun j => ((d j).cellLength : ℝ)) + (by exact_mod_cast c.length_pos) (by exact_mod_cast e.cellLength_pos) + (by exact_mod_cast c.modulus_pos none) + (fun j => by exact_mod_cast (s j).length_pos) + (fun j => by exact_mod_cast (d j).cellLength_pos) + (e.length_le_lengthLoss_mul_cellLength.trans + (mul_le_mul_of_nonneg_right hcloss (Nat.cast_nonneg _))) + (fun j => (d j).length_le_lengthLoss_mul_cellLength.trans + (mul_le_mul_of_nonneg_right (hsloss j) (Nat.cast_nonneg _))) + (localizedMajorArcBudget_pos n hc.one_le hζ).le + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical +open CircleFourier + +noncomputable def gridJetFrequency {I : Type*} [DecidableEq I] + (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) (S : Finset I) : ℝ := + if h : S ∈ J then ((k ⟨S, h⟩).val : ℝ) / M else 0 + +theorem gridJetFrequency_apply {I : Type*} [DecidableEq I] + (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) (S : J) : + gridJetFrequency M J k S = ((k S).val : ℝ) / M := by + simp only [gridJetFrequency, dite_eq_left S.property] + +noncomputable def weightedCubeGridCoefficient {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) (M : ℕ) (J : Finset (Finset I)) + (k : J → Fin M) : ℂ := + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun z => character ((booleanBlockPhase (gridJetFrequency M J k) + (fun j i => (z j i : ℝ)) : ℝ) : CircleFourier.Circle)) + +theorem weightedCubeGridCoefficient_mem_major {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + {M Q H : ℕ} (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hQ : (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card ≤ Q) + (hH : M * (localizedMajorArcErrorBudget n U ζ / ∏ j, ((s j).length : ℝ)) ≤ H) + (k : J → Fin M) (hk : ζ ≤ ‖weightedCubeGridCoefficient s M J k‖) : + k ∈ rationalGridMajorBox J M Q H := by + obtain ⟨D, hD, hDQ, a, ha⟩ := polynomial_weightedCubeBlock_major_arc s A hA h hζ hζ1 hlen + (gridJetFrequency M J k) J hJ hk + apply mem_rationalGridMajorBox hM k hD (by exact_mod_cast hDQ.trans hQ) a _ hH + intro S + simpa only [gridJetFrequency_apply] using ha S + +theorem weightedCubeGridCoefficient_large_card {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + {M Q H : ℕ} (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hQ : (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card ≤ Q) + (hH : M * (localizedMajorArcErrorBudget n U ζ / ∏ j, ((s j).length : ℝ)) ≤ H) : + ((Finset.univ.filter (fun k => ζ ≤ ‖weightedCubeGridCoefficient s M J k‖)).card : ℝ) ≤ + ((Q + 1 : ℝ) * (2 * Q * (H + 1) + 1) * (2 * H + 1)) ^ J.card := by + have hsub : Finset.univ.filter (fun k => ζ ≤ ‖weightedCubeGridCoefficient s M J k‖) ⊆ + rationalGridMajorBox J M Q H := by + intro k hk + exact weightedCubeGridCoefficient_mem_major s A hA h hζ hζ1 hlen hM J hJ hQ hH k + (Finset.mem_filter.mp hk).2 + have hc : ((Finset.univ.filter (fun k => ζ ≤ ‖weightedCubeGridCoefficient s M J k‖)).card : ℝ) ≤ + (rationalGridMajorBox J M Q H).card := by exact_mod_cast Finset.card_le_card hsub + exact hc.trans (by + simpa only [Fintype.card_coe] using rationalGridMajorBox_card J M Q H) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical +open CircleFourier + +noncomputable def weightedAffineModerateGridCoefficient {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 → ℕ) + (shift : ℝ) (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : ℂ := + c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((shift + (z none : ℝ)) * booleanBlockPhase (gridJetFrequency M J k) + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle))) + +theorem weightedAffineModerateGridCoefficient_mem_major {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hclen : localizedMajorArcLengthBudget n U ζ ≤ c.length) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (u : Fin n → Option I → ℝ) (v : Fin n → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (hstride : ∀ j i, ((v j i * (s j).modulus i : ℕ) : ℝ) ≤ U) + (shift : ℝ) {M Q H : ℕ} (hM : 0 < M) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hQ : (localizedMajorArcBudget n U ζ * ((c.modulus none : ℝ) * U ^ n)) ^ J.card ≤ Q) + (hH : M * (localizedMajorArcErrorBudget n U ζ / + (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ))) ≤ H) + (k : J → Fin M) (hk : ζ ≤ ‖weightedAffineModerateGridCoefficient c s u v shift M J k‖) : + k ∈ rationalGridMajorBox J M Q H := by + obtain ⟨D, hD, hDQ, a, ha⟩ := polynomial_affine_weightedModerateBlock_major_arc c s A hA hc h hζ hζ1 + hclen hlen shift 1 Nat.zero_lt_one u v hv hstride (gridJetFrequency M J k) J hJ (by + simpa only [weightedAffineModerateGridCoefficient, Nat.cast_one, one_mul] using hk) + simp only [one_mul] at hDQ ha + apply mem_rationalGridMajorBox hM k hD (by exact_mod_cast hDQ.trans hQ) a _ hH + intro S + simpa only [gridJetFrequency_apply, one_mul] using ha S + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical +open CircleFourier + +theorem weightedCubeGrid_sum_coefficient {B : Type*} [Fintype B] [DecidableEq B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) (shift : CircleFourier.Circle) : + (FiniteProbabilityWeights.pi (fun b => + FiniteProbabilityWeights.pi (fun j => (s b j).source))).complexMean + (fun z => character (shift + ∑ b, + ((booleanBlockPhase (gridJetFrequency M J k) (fun j i => (z b j i : ℝ)) : ℝ) : + CircleFourier.Circle))) = + character shift * ∏ b, weightedCubeGridCoefficient (s b) M J k := + independent_phase_coefficient + (fun b => FiniteProbabilityWeights.pi (fun j => (s b j).source)) + (fun _b z => ((booleanBlockPhase (gridJetFrequency M J k) (fun j i => (z j i : ℝ)) : ℝ) : + CircleFourier.Circle)) shift + +theorem weightedCubeGridProduct_truncation_le {B : Type*} [Fintype B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U : ℝ} + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (ζ : ℕ → ℝ) (m : ℕ) (hζ : ∀ i ≤ m, 0 < ζ i ∧ ζ i ≤ 1) + (hlen : ∀ i ≤ m, ∀ b j, localizedMajorArcLengthBudget n U (ζ i) ≤ (s b j).length) + {M : ℕ} (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (Q H : ℕ → ℕ) + (hQ : ∀ i ≤ m, (localizedMajorArcBudget n U (ζ i) * U ^ (n + 1)) ^ J.card ≤ Q i) + (hH : ∀ i ≤ m, ∀ b, M * (localizedMajorArcErrorBudget n U (ζ i) / + ∏ j, ((s b j).length : ℝ)) ≤ H i) + (ψ : (J → Fin M) → ℂ) (hψ : ∀ k, ‖ψ k‖ ≤ 1) : + ‖(∑ k, (∏ b, weightedCubeGridCoefficient (s b) M J k) * ψ k) - + ∑ k ∈ rationalGridMajorBox J M (Q 0) (H 0), + (∏ b, weightedCubeGridCoefficient (s b) M J k) * ψ k‖ ≤ + (∑ i ∈ Finset.range m, + (((Q (i + 1) + 1 : ℝ) * (2 * Q (i + 1) * (H (i + 1) + 1) + 1) * + (2 * H (i + 1) + 1)) ^ J.card) * (ζ i) ^ Fintype.card B) + + (M : ℝ) ^ J.card * (ζ m) ^ Fintype.card B := by + let S i := rationalGridMajorBox J M (Q i) (H i) + have hsmall : ∀ i ≤ m, ∀ b k, k ∉ S i → + ‖weightedCubeGridCoefficient (s b) M J k‖ ≤ ζ i := by + intro i hi b k hk + by_contra hnot + exact hk (weightedCubeGridCoefficient_mem_major (s b) A hA (h b) + (hζ i hi).1 (hζ i hi).2 (hlen i hi b) hM J hJ (hQ i hi) (hH i hi b) k + (le_of_lt (lt_of_not_ge hnot))) + have ht := product_spectrum_truncation_levels + (fun b k => weightedCubeGridCoefficient (s b) M J k) ψ hψ S ζ m + (fun i hi => (hζ i hi).1.le) hsmall + apply ht.trans + apply add_le_add + · apply Finset.sum_le_sum + intro i hi + apply mul_le_mul_of_nonneg_right + · simpa only [Fintype.card_coe] using rationalGridMajorBox_card J M (Q (i + 1)) (H (i + 1)) + · exact pow_nonneg (hζ i (by have := Finset.mem_range.mp hi; omega)).1.le _ + · exact le_of_eq (by simp only [Fintype.card_fun, Fintype.card_fin, Fintype.card_coe, Nat.cast_pow]) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical +open CircleFourier + +noncomputable def weightedModerateGridCoefficient {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (shift : ℝ) (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : ℂ := + c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((shift + (z none : ℝ)) * booleanBlockPhase (gridJetFrequency M J k) + (fun j i => (x j i : ℝ)) : ℝ) : CircleFourier.Circle))) + +theorem weightedModerateGridCoefficient_mem_major {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hclen : localizedMajorArcLengthBudget n U ζ ≤ c.length) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (shift : ℝ) {M Q H : ℕ} (hM : 0 < M) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hQ : (localizedMajorArcBudget n U ζ * ((c.modulus none : ℝ) * U ^ n)) ^ J.card ≤ Q) + (hH : M * (localizedMajorArcErrorBudget n U ζ / + (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ))) ≤ H) + (k : J → Fin M) (hk : ζ ≤ ‖weightedModerateGridCoefficient c s shift M J k‖) : + k ∈ rationalGridMajorBox J M Q H := by + obtain ⟨D, hD, hDQ, a, ha⟩ := polynomial_weightedModerateBlock_major_arc c s A hA hc h hζ hζ1 + hclen hlen shift (gridJetFrequency M J k) J hJ hk + apply mem_rationalGridMajorBox hM k hD (by exact_mod_cast hDQ.trans hQ) a _ hH + intro S + simpa only [gridJetFrequency_apply] using ha S + +theorem weightedModerateGridCoefficient_large_card {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hclen : localizedMajorArcLengthBudget n U ζ ≤ c.length) + (hlen : ∀ j, localizedMajorArcLengthBudget n U ζ ≤ (s j).length) + (shift : ℝ) {M Q H : ℕ} (hM : 0 < M) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hQ : (localizedMajorArcBudget n U ζ * ((c.modulus none : ℝ) * U ^ n)) ^ J.card ≤ Q) + (hH : M * (localizedMajorArcErrorBudget n U ζ / + (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ))) ≤ H) : + ((Finset.univ.filter (fun k => ζ ≤ ‖weightedModerateGridCoefficient c s shift M J k‖)).card : ℝ) ≤ + ((Q + 1 : ℝ) * (2 * Q * (H + 1) + 1) * (2 * H + 1)) ^ J.card := by + have hsub : Finset.univ.filter (fun k => ζ ≤ ‖weightedModerateGridCoefficient c s shift M J k‖) ⊆ + rationalGridMajorBox J M Q H := by + intro k hk + exact weightedModerateGridCoefficient_mem_major c s A hA hc h hζ hζ1 hclen hlen shift + hM J hJ hQ hH k (Finset.mem_filter.mp hk).2 + have hcard : ((Finset.univ.filter + (fun k => ζ ≤ ‖weightedModerateGridCoefficient c s shift M J k‖)).card : ℝ) ≤ + (rationalGridMajorBox J M Q H).card := by exact_mod_cast Finset.card_le_card hsub + exact hcard.trans (by simpa only [Fintype.card_coe] using rationalGridMajorBox_card J M Q H) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedPositiveAffineModerateGridCoefficient_mem_polynomial {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (c : NormalizedScalarCubeSource Empty) + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (u : Fin (n + 1) → Option I → ℝ) (v : Fin (n + 1) → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (hstride : ∀ j i, ((v j i * (s j).modulus i : ℕ) : ℝ) ≤ U) + (hpositive : ∀ z, c.source.weight z ≠ 0 → (c.length : ℝ) / 4 ≤ (z none : ℝ)) + (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, positiveModerateLengthConstant n U / ζ ^ positiveModerateLengthExponent n ≤ + (s j).length) + {M : ℕ} (hM : 0 < M) + (hscale : (M : ℝ) / ((c.length : ℝ) * ∏ j, ((s j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (k : J → Fin M) (hk : ζ ≤ ‖weightedAffineModerateGridCoefficient c s u v 0 M J k‖) : + k ∈ polynomialGridCover J M (positiveModerateCoverConstant n J.card U V) + (positiveModerateCoverExponent n J.card) ζ := by + have hU := hc.one_le + have hU0 : 0 ≤ U := (by norm_num : (0 : ℝ) ≤ 1).trans hU + have hLc : 0 < (c.length : ℝ) := Nat.cast_pos.mpr c.length_pos + have hP : 0 < ∏ j, ((s j).length : ℝ) := + Finset.prod_pos (fun j _ => Nat.cast_pos.mpr (s j).length_pos) + have hlength := positiveModerateLengthBudget_bounds n hU hζ hζ1 + have hcover := positiveModerateCoverBudget_bounds n J.card hU hV hζ hζ1 + by_cases hlong : majorArcLengthConstant (n + 1) U / ζ ^ majorArcLengthExponent (n + 1) ≤ + (c.length : ℝ) + · have hm : (c.modulus none : ℝ) ≤ U := + (by exact_mod_cast c.modulus_le none : (c.modulus none : ℝ) ≤ c.modulusBound).trans + hc.modulus_le + have hm1 : (1 : ℝ) ≤ c.modulus none := by exact_mod_cast c.modulus_pos none + have hden : (c.length : ℝ) * ∏ j, ((s j).length : ℝ) ≤ + ((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ) := by + exact mul_le_mul_of_nonneg_right + (by simpa only [one_mul] using mul_le_mul_of_nonneg_right hm1 hLc.le) hP.le + have hscale' : (M : ℝ) / + (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) ≤ V := + (div_le_div_of_nonneg_left (Nat.cast_nonneg M) (mul_pos hLc hP) hden).trans hscale + have hq := (localizedMajorArcBudget_pos (n + 1) hU hζ).le + have hd : (localizedMajorArcBudget (n + 1) U ζ * + ((c.modulus none : ℝ) * U ^ (n + 1))) ^ J.card ≤ + (localizedMajorArcBudget (n + 1) U ζ * U ^ (n + 1 + 1)) ^ J.card := by + apply pow_le_pow_left₀ (by positivity) + apply mul_le_mul_of_nonneg_left _ hq + rw [pow_succ' U (n + 1)] + exact mul_le_mul_of_nonneg_right hm (pow_nonneg hU0 _) + apply weightedAffineModerateGridCoefficient_mem_major c s A hA hc h hζ hζ1 + ((localizedMajorArcLengthBudget_le_power (n + 1) hU hζ hζ1).trans hlong) + (fun j => (localizedMajorArcLengthBudget_le_power (n + 1) hU hζ hζ1).trans + (hlength.2.trans (hlen j))) u v hv hstride 0 hM J hJ + · exact (hd.trans (majorArc_denominator_le_cover (n + 1) J.card hU hV hζ hζ1)).trans + (hcover.2.1.trans (Nat.le_ceil _)) + · exact (majorArc_scaled_error_le_cover (n + 1) J.card hU hV hζ hζ1 hscale').trans + (hcover.2.1.trans (Nat.le_ceil _)) + · exact hk + · have hV4 : 0 ≤ 4 * V := by positivity + have hbias : ζ ≤ ‖c.source.complexMean (fun z => + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => CircleFourier.character (((z none : ℝ) * + booleanBlockPhase (gridJetFrequency M J k) (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : + CircleFourier.Circle)))‖ := by + simpa only [weightedAffineModerateGridCoefficient, zero_add] using hk + obtain ⟨D, hD, hDb, a, ha⟩ := affine_weighted_positiveCoefficient_major_arc (T := (c.length : ℝ)) c.source + (fun z => (z none : ℤ)) s A hA h hζ hζ1 (show 0 < (c.length : ℝ) / 4 by positivity) + (fun z hz => ⟨hpositive z hz, by + exact_mod_cast (Finset.mem_Ico.mp (z none).property).2.le⟩) + (fun j => (localizedMajorArcLengthBudget_le_power n hU hζ hζ1).trans + (hlength.1.trans (hlen j))) u v hv hstride (gridJetFrequency M J k) J hJ hbias + have hraw : 0 ≤ (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card := by + have := (localizedMajorArcBudget_pos n hU hζ).le + positivity + have hupper : 0 ≤ majorArcLengthConstant (n + 1) U / + ζ ^ majorArcLengthExponent (n + 1) := by + have := (majorArcLengthConstant_pos (n + 1) hU).le + positivity + have hDQ : (D : ℝ) ≤ positiveModerateCoverConstant n J.card U V / + ζ ^ positiveModerateCoverExponent n J.card := hDb.trans + ((mul_le_mul (lt_of_not_ge hlong).le + (majorArc_denominator_le_cover n J.card hU hV4 hζ hζ1) hraw hupper).trans + hcover.2.2) + have hscale' : (M : ℝ) / (((c.length : ℝ) / 4) * ∏ j, ((s j).length : ℝ)) ≤ + 4 * V := by + calc + _ = 4 * ((M : ℝ) / ((c.length : ℝ) * ∏ j, ((s j).length : ℝ))) := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left hscale (by norm_num) + apply mem_rationalGridMajorBox hM k hD + (by exact_mod_cast hDQ.trans (Nat.le_ceil _)) a + (fun S => by simpa only [gridJetFrequency_apply] using ha S) + exact (majorArc_scaled_error_le_cover n J.card hU hV4 hζ hζ1 hscale').trans + (hcover.1.trans (Nat.le_ceil _)) + +theorem weightedPositiveAffineModerateGridCoefficient_minor_polynomial {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (c : NormalizedScalarCubeSource Empty) + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (u : Fin (n + 1) → Option I → ℝ) (v : Fin (n + 1) → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (hstride : ∀ j i, ((v j i * (s j).modulus i : ℕ) : ℝ) ≤ U) + (hpositive : ∀ z, c.source.weight z ≠ 0 → (c.length : ℝ) / 4 ≤ (z none : ℝ)) + (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, positiveModerateLengthConstant n U / ζ ^ positiveModerateLengthExponent n ≤ + (s j).length) + {M : ℕ} (hM : 0 < M) + (hscale : (M : ℝ) / ((c.length : ℝ) * ∏ j, ((s j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (k : J → Fin M) (hk : k ∉ polynomialGridCover J M (positiveModerateCoverConstant n J.card U V) + (positiveModerateCoverExponent n J.card) ζ) : + ‖weightedAffineModerateGridCoefficient c s u v 0 M J k‖ ≤ ζ := by + exact le_of_lt (lt_of_not_ge (fun hh => hk + (weightedPositiveAffineModerateGridCoefficient_mem_polynomial c s A hA hc h u v hv hstride hpositive + hV hζ hζ1 hlen hM hscale J hJ k hh))) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators +open CircleFourier + +theorem weightedCubeGridCoefficient_norm_le_one {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : + ‖weightedCubeGridCoefficient s M J k‖ ≤ 1 := by + let p := FiniteProbabilityWeights.pi (fun j => (s j).source) + exact (p.norm_complexMean_le_mean_norm _).trans_eq (by + simp only [norm_character, p.mean_const]) + +theorem weightedModerateGridCoefficient_norm_le_one {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (shift : ℝ) (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : + ‖weightedModerateGridCoefficient c s shift M J k‖ ≤ 1 := by + let p := FiniteProbabilityWeights.pi (fun j => (s j).source) + apply (c.source.norm_complexMean_le_mean_norm _).trans + apply (c.source.mean_mono (fun z => ?_)).trans_eq (c.source.mean_const 1) + exact (p.norm_complexMean_le_mean_norm _).trans_eq (by + simp only [norm_character, p.mean_const]) + +theorem sum_eq_retained_add_spectrumTail {K : Type*} [Fintype K] [DecidableEq K] + (S : Finset K) (f : K → ℝ) : ∑ k, f k = (∑ k ∈ S, f k) + spectrumTail S f := by + calc + _ = ∑ k, ((if k ∈ S then f k else 0) + (if k ∈ S then 0 else f k)) := by + apply Finset.sum_congr rfl + intro k _ + by_cases hk : k ∈ S <;> simp only [hk, ite_true, ite_false, add_zero, zero_add] + _ = _ := by simp only [Finset.sum_add_distrib, Finset.sum_ite_mem, Finset.univ_inter, spectrumTail] + +theorem product_spectrum_absolute_cap {B K : Type*} [Fintype B] [Fintype K] [DecidableEq K] + (c : B → K → ℂ) (S : Finset K) (hunit : ∀ b k, ‖c b k‖ ≤ 1) : + (∑ k, ‖∏ b, c b k‖) ≤ S.card + spectrumTail S (fun k => ‖∏ b, c b k‖) := by + rw [sum_eq_retained_add_spectrumTail S] + refine add_le_add ?_ le_rfl + calc + _ ≤ ∑ _k ∈ S, (1 : ℝ) := by + apply Finset.sum_le_sum + intro k _ + simpa only [one_pow] using norm_product_coefficients_le (fun b => c b k) (fun b => hunit b k) + _ = _ := by simp only [Finset.sum_const, nsmul_eq_mul, mul_one] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def uniformSpectrumAbsoluteCap (n j t : ℕ) (U V W : ℝ) : ℝ := + uniformSpectrumSizeConstant n j t U V W + 1 + +theorem uniformBlockSpectrum_absolute_cap {B J : Type*} [Fintype B] [Fintype J] [DecidableEq J] + (M n t : ℕ) (coeff : B → (J → Fin M) → ℂ) {U V W L : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hB : uniformSpectrumBlockCount n (Fintype.card J) t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) + (hunit : ∀ b k, ‖coeff b k‖ ≤ 1) + (hminor : ∀ δ, 0 < δ → δ ≤ 1 → majorArcLengthConstant n U / δ ^ majorArcLengthExponent n ≤ L → + ∀ b k, k ∉ polynomialGridCover J M (majorArcCoverConstant n (Fintype.card J) U V) + (majorArcCoverExponent n (Fintype.card J)) δ → ‖coeff b k‖ ≤ δ) : + (∑ k, ‖∏ b, coeff b k‖) ≤ uniformSpectrumAbsoluteCap n (Fintype.card J) t U V W := by + classical + obtain ⟨hζ, hζ1, hacc⟩ := uniformBlockRetainedBias_spec n (Fintype.card J) t hU hW (by norm_num : (0 : ℝ) < 1) + let S := uniformBlockSpectrumCover J M n U V L (uniformBlockRetainedBias n (Fintype.card J) t U V W 1) + have ht := uniformBlockSpectrum_tail M n t coeff hU hV hW hL hζ hζ1 (by norm_num) hB hsize hminor hacc + have hc : (S.card : ℝ) ≤ uniformSpectrumSizeConstant n (Fintype.card J) t U V W := by + simpa only [one_pow, div_one] using uniformBlockSpectrumCover_polynomial_card J M n t + hU hV hW hL (by norm_num : (0 : ℝ) < 1) le_rfl hsize + exact (product_spectrum_absolute_cap coeff S hunit).trans (add_le_add hc ht) + +theorem finite_product_retained_mass_le {B K : Type*} [Fintype B] [Fintype K] [DecidableEq K] + (coeff : B → K → ℂ) (S : Finset K) {A : ℝ} (hcap : (∑ k, ‖∏ b, coeff b k‖) ≤ A) : + (∑ k ∈ S, ‖∏ b, coeff b k‖) ≤ A := by + apply le_trans _ hcap + exact Finset.sum_le_univ_sum_of_nonneg (fun _ => norm_nonneg _) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumLogBounds.lean b/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumLogBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a0517392e50f2e3b6a85046d5f452932ac3cdd2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumLogBounds.lean @@ -0,0 +1,238 @@ +import OAI.Combinatorics.Progressions.Estimates.InactiveShortLogBounds +import OAI.Combinatorics.Progressions.Fourier.UniformSpectrumAbsoluteCap + +namespace OAI + +section + +namespace Erdos3 + +def majorArcBiasLog {A : Type*} [Semiring A] (n : ℕ) (p : A) : A := + (denseProductDensityConstant n * (2 * 3 ^ n) ^ denseProductExponent n : ℕ) + + ((n + 1) * majorArcBiasExponent n : ℕ) * (1 + 2 * p) + +def majorArcLocalizationLog {A : Type*} [Semiring A] (n : ℕ) (p : A) : A := + 256 + 6 * p + ((n + 1) * 2 : ℕ) * (1 + 2 * p) + +def majorArcLengthLog {A : Type*} [Semiring A] (n : ℕ) (p : A) : A := + majorArcLocalizationLog n p + majorArcBiasLog n p + 1 + +def majorArcErrorLog {A : Type*} [Semiring A] (n : ℕ) (p : A) : A := + majorArcBiasLog n p + (n + 1 : ℕ) * majorArcLocalizationLog n p + +def majorArcCoverLog {A : Type*} [Semiring A] (n j : ℕ) (p v : A) : A := + j * (majorArcBiasLog n p + (n + 1 : ℕ) * p) + v + majorArcErrorLog n p + 2 + +theorem majorArcBaseLogs_nonneg (n : ℕ) {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ majorArcBiasLog n p ∧ 0 ≤ majorArcLocalizationLog n p ∧ + 0 ≤ majorArcLengthLog n p ∧ 0 ≤ majorArcErrorLog n p := by + unfold majorArcLengthLog majorArcErrorLog majorArcBiasLog majorArcLocalizationLog + exact ⟨by positivity, by positivity, by positivity, by positivity⟩ + +theorem majorArcCoverLog_nonneg (n j : ℕ) {p v : ℝ} (hp : 0 ≤ p) (hv : 0 ≤ v) : + 0 ≤ majorArcCoverLog n j p v := by + obtain ⟨hb, _, _, he⟩ := majorArcBaseLogs_nonneg n hp + unfold majorArcCoverLog + positivity + +theorem majorArcConstants_exp_bounds (n : ℕ) {U p : ℝ} + (hU : 0 ≤ U) (hp : 0 ≤ p) (hUp : U ≤ Real.exp p) : + majorArcBiasConstant n U ≤ Real.exp (majorArcBiasLog n p) ∧ + majorArcLocalizationConstant n U ≤ Real.exp (majorArcLocalizationLog n p) ∧ + majorArcLengthConstant n U ≤ Real.exp (majorArcLengthLog n p) ∧ + majorArcErrorConstant n U ≤ Real.exp (majorArcErrorLog n p) := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hU2 : U ^ 2 ≤ Real.exp (2 * p) := + pow_le_exp_mul_of_le_exp hU hUp hp 2 le_rfl + have hbase : 2 * U ^ 2 ≤ Real.exp (1 + 2 * p) := + (mul_le_mul htwo hU2 (sq_nonneg U) (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + have hbpow := pow_le_exp_mul_of_le_exp (by positivity : 0 ≤ 2 * U ^ 2) + hbase (by positivity) ((n + 1) * majorArcBiasExponent n) le_rfl + let c : ℕ := denseProductDensityConstant n * (2 * 3 ^ n) ^ denseProductExponent n + have hc : (c : ℝ) ≤ Real.exp (c : ℝ) := by linarith [Real.add_one_le_exp (c : ℝ)] + have hb : majorArcBiasConstant n U ≤ Real.exp (majorArcBiasLog n p) := by + calc + _ = (c : ℝ) * (2 * U ^ 2) ^ ((n + 1) * majorArcBiasExponent n) := by + simp only [majorArcBiasConstant, c, Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat] + _ ≤ Real.exp (c : ℝ) * Real.exp (((n + 1) * majorArcBiasExponent n : ℕ) * (1 + 2 * p)) := + mul_le_mul hc hbpow (by positivity) (Real.exp_pos _).le + _ = _ := (Real.exp_add _ _).symm + have hU6 : U ^ 6 ≤ Real.exp (6 * p) := + pow_le_exp_mul_of_le_exp hU hUp hp 6 le_rfl + have hlpow := pow_le_exp_mul_of_le_exp (by positivity : 0 ≤ 2 * U ^ 2) + hbase (by positivity) ((n + 1) * 2) le_rfl + have h256 : (256 : ℝ) ≤ Real.exp 256 := by linarith [Real.add_one_le_exp (256 : ℝ)] + have hl : majorArcLocalizationConstant n U ≤ Real.exp (majorArcLocalizationLog n p) := by + unfold majorArcLocalizationConstant majorArcLocalizationLog + calc + _ ≤ Real.exp 256 * Real.exp (6 * p) * Real.exp (((n + 1) * 2 : ℕ) * (1 + 2 * p)) := by + gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add] + obtain ⟨hb0, hl0, _, _⟩ := majorArcBaseLogs_nonneg n hp + have hbc : 0 ≤ majorArcBiasConstant n U := by unfold majorArcBiasConstant; positivity + have hlc : 0 ≤ majorArcLocalizationConstant n U := by unfold majorArcLocalizationConstant; positivity + have hplus : majorArcBiasConstant n U + 1 ≤ Real.exp (majorArcBiasLog n p + 1) := by + rw [add_comm] + exact one_add_le_exp_succ hb0 hb + have hlength : majorArcLengthConstant n U ≤ Real.exp (majorArcLengthLog n p) := by + have hmul := (mul_le_mul hl hplus (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + exact hmul.trans_eq (by unfold majorArcLengthLog; congr 1; ring) + have hlpow' := pow_le_exp_mul_of_le_exp hlc hl hl0 (n + 1) le_rfl + have herror : majorArcErrorConstant n U ≤ Real.exp (majorArcErrorLog n p) := + (mul_le_mul hb hlpow' (pow_nonneg hlc _) (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + exact ⟨hb, hl, hlength, herror⟩ + +theorem majorArcCoverConstant_exp_bound (n j : ℕ) {U V p v : ℝ} + (hU : 0 ≤ U) (hp : 0 ≤ p) (hv : 0 ≤ v) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) : + majorArcCoverConstant n j U V ≤ Real.exp (majorArcCoverLog n j p v) := by + obtain ⟨hb, _, _, he⟩ := majorArcConstants_exp_bounds n hU hp hUp + obtain ⟨hb0, _, _, he0⟩ := majorArcBaseLogs_nonneg n hp + have hbc : 0 ≤ majorArcBiasConstant n U := by unfold majorArcBiasConstant; positivity + have hec : 0 ≤ majorArcErrorConstant n U := by + unfold majorArcErrorConstant majorArcBiasConstant majorArcLocalizationConstant + positivity + have hUpow := pow_le_exp_mul_of_le_exp hU hUp hp (n + 1) le_rfl + have hmul := (mul_le_mul hb hUpow (pow_nonneg hU _) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + have hpow := pow_le_exp_mul_of_le_exp (mul_nonneg hbc (pow_nonneg hU _)) hmul + (by positivity) j le_rfl + have hfirst := one_add_le_exp_succ + (by positivity : 0 ≤ (j : ℝ) * (majorArcBiasLog n p + (n + 1 : ℕ) * p)) hpow + have hsecond := (mul_le_mul hVv he hec (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + have hsum := add_le_exp_add_one + (by positivity : 0 ≤ (j : ℝ) * (majorArcBiasLog n p + (n + 1 : ℕ) * p) + 1) + (add_nonneg hv he0) hfirst hsecond + exact hsum.trans_eq (by unfold majorArcCoverLog; congr 1; ring) + +end Erdos3 + +end + +section + +namespace Erdos3 + +def majorArcSpectrumLog {A : Type*} [Semiring A] (n j : ℕ) (p v : A) : A := + j * (195 + 4 * majorArcCoverLog n j p v) + +def uniformBlockAccuracyLog {A : Type*} [Semiring A] + (n j t : ℕ) (p v w : A) : A := + 1 + majorArcSpectrumLog n j p v + (majorArcSpectrumExponent n j : ℕ) + + (w + t * ((majorArcLengthExponent n : ℕ) + majorArcLengthLog n p)) + 2 + +def uniformSpectrumSizeLog {A : Type*} [Semiring A] + (n j t : ℕ) (p v w : A) : A := + majorArcSpectrumLog n j p v + (w + t * majorArcLengthLog n p) + 1 + + (max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t) : ℕ) * + uniformBlockAccuracyLog n j t p v w + +theorem uniformSpectrumLogs_nonneg (n j t : ℕ) {p v w : ℝ} + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) : + 0 ≤ majorArcSpectrumLog n j p v ∧ 0 ≤ uniformBlockAccuracyLog n j t p v w ∧ + 0 ≤ uniformSpectrumSizeLog n j t p v w := by + have hC := majorArcCoverLog_nonneg n j hp hv + have hL := (majorArcBaseLogs_nonneg n hp).2.2.1 + have hS : 0 ≤ majorArcSpectrumLog n j p v := by + unfold majorArcSpectrumLog + positivity + have hA : 0 ≤ uniformBlockAccuracyLog n j t p v w := by + unfold uniformBlockAccuracyLog + positivity + refine ⟨hS, hA, ?_⟩ + unfold uniformSpectrumSizeLog + positivity + +theorem majorArcSpectrumConstant_exp_bound (n j : ℕ) {U V p v : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hp : 0 ≤ p) (hv : 0 ≤ v) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) : + majorArcSpectrumConstant n j U V ≤ Real.exp (majorArcSpectrumLog n j p v) := by + have hc := majorArcCoverConstant_exp_bound n j (zero_le_one.trans hU) hp hv hUp hVv + have hc0 := zero_le_one.trans (majorArcCoverConstant_one_le n j hU hV) + have hlog := majorArcCoverLog_nonneg n j hp hv + have hp4 := pow_le_exp_mul_of_le_exp hc0 hc hlog 4 le_rfl + have h195 : (195 : ℝ) ≤ Real.exp 195 := by linarith [Real.add_one_le_exp (195 : ℝ)] + have hbase := (mul_le_mul h195 hp4 (pow_nonneg hc0 _) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + exact pow_le_exp_mul_of_le_exp (by positivity) hbase (by positivity) j le_rfl + +theorem uniformBlockSpectrumAccuracy_exp_bound (n j t : ℕ) {U V W p v w : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) : + uniformBlockSpectrumAccuracyConstant n j t U V W + 1 ≤ + Real.exp (uniformBlockAccuracyLog n j t p v w) := by + have hlen := (majorArcConstants_exp_bounds n (zero_le_one.trans hU) hp hUp).2.2.1 + have hspec := majorArcSpectrumConstant_exp_bound n j hU hV hp hv hUp hVv + have hL := (majorArcBaseLogs_nonneg n hp).2.2.1 + have hS := (uniformSpectrumLogs_nonneg n j t hp hv hw).1 + have hlen0 := (majorArcLengthConstant_pos n hU).le + have hspec0 := majorArcSpectrumConstant_nonneg n j U V + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hpowS : (2 : ℝ) ^ majorArcSpectrumExponent n j ≤ + Real.exp (majorArcSpectrumExponent n j : ℝ) := by + simpa only [mul_one] using pow_le_exp_mul_of_le_exp (by norm_num) htwo + (by norm_num) (majorArcSpectrumExponent n j) le_rfl + have hpowL : (2 : ℝ) ^ majorArcLengthExponent n ≤ Real.exp (majorArcLengthExponent n : ℝ) := by + simpa only [mul_one] using pow_le_exp_mul_of_le_exp (by norm_num) htwo + (by norm_num) (majorArcLengthExponent n) le_rfl + have hfirst : 2 * majorArcSpectrumConstant n j U V * 2 ^ majorArcSpectrumExponent n j ≤ + Real.exp (1 + majorArcSpectrumLog n j p v + (majorArcSpectrumExponent n j : ℝ)) := by + have hh := mul_le_mul (mul_le_mul htwo hspec hspec0 (Real.exp_pos _).le) hpowS + (by positivity) (by positivity) + simpa only [← Real.exp_add] using hh + have hbase := (mul_le_mul hpowL hlen hlen0 (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + have hbasepow := pow_le_exp_mul_of_le_exp (by positivity) hbase (by positivity) t le_rfl + have hsecond := (mul_le_mul hWw hbasepow (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + have hsum := add_le_exp_add_one + (by positivity : 0 ≤ 1 + majorArcSpectrumLog n j p v + (majorArcSpectrumExponent n j : ℝ)) + (by positivity : 0 ≤ w + (t : ℝ) * ((majorArcLengthExponent n : ℝ) + majorArcLengthLog n p)) + hfirst hsecond + have hplus := one_add_le_exp_succ (by positivity) hsum + calc + _ = 1 + (2 * majorArcSpectrumConstant n j U V * 2 ^ majorArcSpectrumExponent n j + + W * (2 ^ majorArcLengthExponent n * majorArcLengthConstant n U) ^ t) := by + unfold uniformBlockSpectrumAccuracyConstant + ring + _ ≤ _ := hplus + _ = _ := by unfold uniformBlockAccuracyLog; congr 1; ring + +theorem uniformSpectrumSizeConstant_exp_bound (n j t : ℕ) {U V W p v w : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) : + uniformSpectrumSizeConstant n j t U V W ≤ Real.exp (uniformSpectrumSizeLog n j t p v w) := by + have hS := majorArcSpectrumConstant_exp_bound n j hU hV hp hv hUp hVv + have hL := (majorArcConstants_exp_bounds n (zero_le_one.trans hU) hp hUp).2.2.1 + have hA := uniformBlockSpectrumAccuracy_exp_bound n j t hU hV hp hv hw hUp hVv hWw + have hL0 := (majorArcBaseLogs_nonneg n hp).2.2.1 + obtain ⟨hS0, hA0, _⟩ := uniformSpectrumLogs_nonneg n j t hp hv hw + have hlen0 := (majorArcLengthConstant_pos n hU).le + have hspec0 := majorArcSpectrumConstant_nonneg n j U V + have hLt := pow_le_exp_mul_of_le_exp hlen0 hL hL0 t le_rfl + have hsecond := (mul_le_mul hWw hLt (pow_nonneg hlen0 _) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + have hsum := add_le_exp_add_one hS0 (by positivity) hS hsecond + have haccuracy0 : 0 ≤ uniformBlockSpectrumAccuracyConstant n j t U V W + 1 := by + unfold uniformBlockSpectrumAccuracyConstant + positivity + have hpow := pow_le_exp_mul_of_le_exp haccuracy0 hA hA0 + (max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t)) le_rfl + exact (mul_le_mul hsum hpow (pow_nonneg haccuracy0 _) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + +theorem uniformSpectrumAbsoluteCap_exp_bound (n j t : ℕ) {U V W p v w : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) + (hp : 0 ≤ p) (hv : 0 ≤ v) (hw : 0 ≤ w) + (hUp : U ≤ Real.exp p) (hVv : V ≤ Real.exp v) (hWw : W ≤ Real.exp w) : + uniformSpectrumAbsoluteCap n j t U V W ≤ Real.exp (uniformSpectrumSizeLog n j t p v w + 1) := by + have hbound := uniformSpectrumSizeConstant_exp_bound n j t hU hV hW hp hv hw hUp hVv hWw + have hplus := one_add_le_exp_succ (uniformSpectrumLogs_nonneg n j t hp hv hw).2.2 hbound + simpa only [uniformSpectrumAbsoluteCap, add_comm] using hplus + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumSize.lean b/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..fba01b78a94d3b34693bfdd39ba611f17834b5c5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/UniformSpectrumSize.lean @@ -0,0 +1,122 @@ +import OAI.Combinatorics.Progressions.Fourier.UniformScaledRetainedCharacters + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def uniformBlockRetainedBias (n j t : ℕ) (U V W ε : ℝ) : ℝ := + min 1 (ε / (uniformBlockSpectrumAccuracyConstant n j t U V W + 1)) + +theorem uniformBlockRetainedBias_spec (n j t : ℕ) {U V W ε : ℝ} + (hU : 1 ≤ U) (hW : 0 ≤ W) (hε : 0 < ε) : + 0 < uniformBlockRetainedBias n j t U V W ε ∧ + uniformBlockRetainedBias n j t U V W ε ≤ 1 ∧ + uniformBlockSpectrumAccuracyConstant n j t U V W * + uniformBlockRetainedBias n j t U V W ε ≤ ε := by + have hC := (majorArcLengthConstant_pos n hU).le + have hA := majorArcSpectrumConstant_nonneg n j U V + have hnonneg : 0 ≤ uniformBlockSpectrumAccuracyConstant n j t U V W := by + unfold uniformBlockSpectrumAccuracyConstant + positivity + have hpos : 0 < uniformBlockRetainedBias n j t U V W ε := + lt_min (by norm_num) (div_pos hε (by linarith)) + refine ⟨hpos, min_le_left _ _, ?_⟩ + calc + _ ≤ (uniformBlockSpectrumAccuracyConstant n j t U V W + 1) * + uniformBlockRetainedBias n j t U V W ε := + mul_le_mul_of_nonneg_right (by linarith) hpos.le + _ ≤ (uniformBlockSpectrumAccuracyConstant n j t U V W + 1) * + (ε / (uniformBlockSpectrumAccuracyConstant n j t U V W + 1)) := + mul_le_mul_of_nonneg_left (min_le_right _ _) (by linarith) + _ = ε := by field_simp + +theorem uniformSpectrumBlockCount_quadratic (n j s : ℕ) : + uniformSpectrumBlockCount n j (s * j) ≤ + (4 * majorArcBiasExponent n + 4 * majorArcErrorExponent n + majorArcLengthExponent n * s + 1) * + (j + 1) ^ 2 := by + have hj : j ≤ (j + 1) ^ 2 := by nlinarith + have hj2 : j ^ 2 ≤ (j + 1) ^ 2 := by nlinarith + have h1 : 1 ≤ (j + 1) ^ 2 := by nlinarith + unfold uniformSpectrumBlockCount majorArcSpectrumExponent majorArcCoverExponent + have hm (x y : ℕ) : max x y ≤ x + y := max_le (by omega) (by omega) + apply (Nat.add_le_add_right (hm _ _) 1).trans + nlinarith [Nat.mul_le_mul_left (4 * majorArcBiasExponent n) hj2, + Nat.mul_le_mul_left (4 * majorArcErrorExponent n) hj, + Nat.mul_le_mul_left (majorArcLengthExponent n * s) hj] + +theorem grid_size_power_bound {M K R D L : ℝ} {s j : ℕ} + (hR : 0 ≤ R) (hM : 0 ≤ M) + (hMK : M ≤ R * K) (hKL : K ≤ D * L ^ s) : + M ^ j ≤ (R * D) ^ j * L ^ (s * j) := by + have hm : M ≤ (R * D) * L ^ s := by + calc + _ ≤ R * K := hMK + _ ≤ R * (D * L ^ s) := mul_le_mul_of_nonneg_left hKL hR + _ = _ := by ring + calc + _ ≤ ((R * D) * L ^ s) ^ j := pow_le_pow_left₀ hM hm j + _ = _ := by rw [mul_pow, pow_mul] + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem uniformBlockRetainedBias_eq (n j t : ℕ) {U V W ε : ℝ} + (hU : 1 ≤ U) (hW : 0 ≤ W) (hε1 : ε ≤ 1) : + uniformBlockRetainedBias n j t U V W ε = + ε / (uniformBlockSpectrumAccuracyConstant n j t U V W + 1) := by + have hC := (majorArcLengthConstant_pos n hU).le + have hA := majorArcSpectrumConstant_nonneg n j U V + have hnonneg : 0 ≤ uniformBlockSpectrumAccuracyConstant n j t U V W := by + unfold uniformBlockSpectrumAccuracyConstant + positivity + apply min_eq_right + apply (div_le_iff₀ (by linarith)).mpr + linarith + +noncomputable def uniformSpectrumSizeConstant (n j t : ℕ) (U V W : ℝ) : ℝ := + (majorArcSpectrumConstant n j U V + W * majorArcLengthConstant n U ^ t) * + (uniformBlockSpectrumAccuracyConstant n j t U V W + 1) ^ + max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t) + +theorem uniformBlockSpectrumCardBudget_le_accuracy_power (n j t : ℕ) {U V W ε : ℝ} + (hU : 1 ≤ U) (hW : 0 ≤ W) (hε : 0 < ε) (hε1 : ε ≤ 1) : + uniformBlockSpectrumCardBudget n j t U V W (uniformBlockRetainedBias n j t U V W ε) ≤ + uniformSpectrumSizeConstant n j t U V W / + ε ^ max (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t) := by + obtain ⟨hζ, hζ1, _⟩ := uniformBlockRetainedBias_spec n j t hU hW hε + have hC := (majorArcLengthConstant_pos n hU).le + have hA := majorArcSpectrumConstant_nonneg n j U V + have hb : 0 ≤ W * majorArcLengthConstant n U ^ t := by positivity + have ha := inverse_power_mono hA le_rfl hζ hζ1 + (le_max_left (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t)) + have hp := inverse_power_mono hb le_rfl hζ hζ1 + (le_max_right (majorArcSpectrumExponent n j) (majorArcLengthExponent n * t)) + unfold uniformBlockSpectrumCardBudget + apply (add_le_add ha hp).trans_eq + rw [← add_div, uniformBlockRetainedBias_eq n j t hU hW hε1] + simp only [uniformSpectrumSizeConstant, div_pow, div_div_eq_mul_div] + +theorem uniformBlockSpectrumCover_polynomial_card (J : Type*) [Fintype J] [DecidableEq J] + (M n t : ℕ) {U V W L ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hsize : (M : ℝ) ^ Fintype.card J ≤ W * L ^ t) : + ((uniformBlockSpectrumCover J M n U V L + (uniformBlockRetainedBias n (Fintype.card J) t U V W ε)).card : ℝ) ≤ + uniformSpectrumSizeConstant n (Fintype.card J) t U V W / + ε ^ max (majorArcSpectrumExponent n (Fintype.card J)) (majorArcLengthExponent n * t) := by + obtain ⟨hζ, hζ1, _⟩ := uniformBlockRetainedBias_spec n (Fintype.card J) t hU hW hε + exact (uniformBlockSpectrumCover_card J M n t hU hV hW hL hζ hζ1 hsize).trans + (uniformBlockSpectrumCardBudget_le_accuracy_power n (Fintype.card J) t hU hW hε hε1) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/UniformWeightTorusModel.lean b/lean/OAI/Combinatorics/Progressions/Fourier/UniformWeightTorusModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..5627390bd1185fc4065b344aebb0de5d2a740b9f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/UniformWeightTorusModel.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Lattices.TriangularAffineReset +import OAI.Combinatorics.Progressions.Polynomial.PolynomialPatchResidualCell + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial +open scoped NNReal + +namespace PolynomialPatch + +theorem exists_uniform_weight_torus_model {σ : Type*} {s d h : ℕ} + (A : PolynomialPatch σ s d) (hh : 0 < h) (hw : ∀ i, A.weight i = h) : + ∃ (F : (Fin d → ℝ) → ℝ) (Q : Fin d → MvPolynomial σ ℝ), + LipschitzWith (A.kernel.lip * d) F ∧ + (∀ x, F x ∈ Set.Icc (0 : ℝ) 1) ∧ + (∀ x : Fin d → ℝ, ∀ m : Fin d → ℤ, F (fun i => x i + m i) = F x) ∧ + (∀ i, Q i ∈ weightedSupportLE (fun _ : σ => 1) h) ∧ + ∀ t : σ → ℝ, A.value t = F (fun i => aeval t (Q i)) := by + let L := A.lowestLayerModel (D := d) (E := 0) hh (fun i => hw (i.castAdd 0)) + let T := 1 - L.matrix + have hTtri : T.IsLowerTriangular := by + intro i j hij + change i < j at hij + simp only [T, Matrix.sub_apply, Matrix.one_apply_ne hij.ne, + L.strict i j hij.le, sub_self] + have hTdiag : ∀ i, T i i = 1 := by + intro i + simp [T, Matrix.sub_apply, L.strict i i le_rfl] + let U := triangularReductionMatrix T + let V := U⁻¹.map (Int.castRingHom ℝ) + let B := reducedTriangularMatrix T + let Q := polynomialMatrixAction V L.origin + have hU : IsUnit U.det := by rw [triangularReductionMatrix_det]; exact isUnit_one + refine ⟨triangularLatticeValue B A.kernel, Q, + triangularLatticeValue_lipschitz B + (reducedTriangularMatrix_above T hTtri hTdiag) + (reducedTriangularMatrix_diag T hTtri hTdiag) + (reducedTriangularMatrix_bound T hTtri hTdiag) A.kernel, + triangularLatticeValue_mem_Icc B + (reducedTriangularMatrix_above T hTtri hTdiag) + (reducedTriangularMatrix_diag T hTtri hTdiag) A.kernel, + triangularLatticeValue_integer_periodic B A.kernel, + polynomialMatrixAction_degree V L.origin L.degree, ?_⟩ + intro t + have hslots := L.form_eq t + rw [TriangularSlots.takePrefix_zero] at hslots + have hraw : A.value t = triangularLatticeValue T A.kernel + (fun i => aeval t (L.origin i)) := by + change (A.form.slots t).patchValue A.kernel = _ + rw [hslots] + simp only [TriangularSlots.patchValue, TriangularSlots.affineBlock_residual, + triangularLatticeValue, T] + rw [hraw, triangularLatticeValue_change_basis T U hU A.kernel] + change triangularLatticeValue B A.kernel (V.mulVec (fun i => aeval t (L.origin i))) = + triangularLatticeValue B A.kernel (fun i => aeval t (polynomialMatrixAction V L.origin i)) + rw [polynomialMatrixAction_eval] + +end PolynomialPatch +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/VerticalFrequencyIdentification.lean b/lean/OAI/Combinatorics/Progressions/Fourier/VerticalFrequencyIdentification.lean new file mode 100644 index 0000000000000000000000000000000000000000..59aaa072ef690f71ac2372ba04877c2ba8ccbc42 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/VerticalFrequencyIdentification.lean @@ -0,0 +1,332 @@ +import OAI.Combinatorics.Progressions.Estimates.BoundedRealifiedSquareOrbit +import OAI.Combinatorics.Progressions.Estimates.NativeCentralSeed + +namespace OAI + +section + +namespace Erdos3.NilpotentLieBCHGroup + +open Module +open scoped TensorProduct + +variable {L X ι : Type*} [LieRing L] [LieAlgebra ℚ L] [LieAlgebra ℝ L] + {s : ℕ} {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + [MulAction (NilpotentLieBCHGroup L s hnil) X] + +theorem central_span_character (u : ι → L) (hu : ∀ i (w : L), ⁅u i, w⁆ = 0) + (η : L →ₗ[ℝ] ℝ) (f : X → ℂ) + (hf : ∀ i (r : ℝ) x, f (realBCHLine (hnil := hnil) (u i) r • x) = + CircleFourier.character ((r * η (u i) : ℝ) : CircleFourier.Circle) * f x) + {v : L} (hv : v ∈ Submodule.span ℝ (Set.range u)) (x : X) : + f ((⟨v⟩ : NilpotentLieBCHGroup L s hnil) • x) = + CircleFourier.character ((η v : ℝ) : CircleFourier.Circle) * f x := by + have h : (∀ w : L, ⁅v, w⁆ = 0) ∧ ∀ (r : ℝ) x, + f (realBCHLine (hnil := hnil) v r • x) = + CircleFourier.character ((r * η v : ℝ) : CircleFourier.Circle) * f x := by + induction hv using Submodule.span_induction with + | mem v hv => + obtain ⟨i, rfl⟩ := hv + exact ⟨hu i, hf i⟩ + | zero => + refine ⟨fun w => zero_lie w, ?_⟩ + intro r x + have he : realBCHLine (hnil := hnil) (0 : L) r = 1 := by + apply ext + exact smul_zero r + simp [he] + | @add v w hv hw ihv ihw => + refine ⟨fun z => by rw [add_lie, ihv.1, ihw.1, add_zero], ?_⟩ + intro r x + have he : realBCHLine (hnil := hnil) (v + w) r = + realBCHLine v r * realBCHLine w r := by + apply ext + change r • (v + w) = lieBCH s (r • v) (r • w) + rw [lieBCH_eq_add_of_lie_eq_zero hnil (by rw [smul_lie, ihv.1, smul_zero]), smul_add] + rw [he, mul_smul, ihv.2, ihw.2, map_add, mul_add, + AddCircle.coe_add, CircleFourier.character_add, mul_assoc] + | @smul a v hv ih => + refine ⟨fun w => by rw [smul_lie, ih.1, smul_zero], ?_⟩ + intro r x + have he : realBCHLine (hnil := hnil) (a • v) r = realBCHLine v (r * a) := by + apply ext + exact (mul_smul r a v).symm + rw [he, ih.2, map_smul, smul_eq_mul, mul_assoc] + simpa only [realBCHLine_one, one_mul] using h.2 1 x + +end Erdos3.NilpotentLieBCHGroup + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open NilpotentLieBCHGroup CircleFourier +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (Γ : Subgroup F.Group) + +theorem realSquareObservable_relative_character (ε : F.realification.Group) + (u : F.realification.Group ⧸ Γ.map realificationHom → ℂ) + (χ : F.realification.Group → CircleFourier.Circle) + (hu : ∀ z ∈ F.realification.subgroup s, ∀ x, u (z • x) = character (χ z) * u x) + (k : F.squareFiltration.realification.Group) + (hk : F.realSquareFstHom k ∈ F.realification.subgroup s) + (hs : F.realSquareSndHom k = 1) + (x : F.squareFiltration.realification.Group ⧸ (F.squareLattice Γ).map realificationHom) : + F.realSquareObservable Γ ε u (k • x) = + character (χ (F.realSquareFstHom k)) * F.realSquareObservable Γ ε u x := by + have hcomm (y : F.realification.Group ⧸ Γ.map realificationHom) : + ε • (F.realSquareFstHom k • y) = F.realSquareFstHom k • (ε • y) := by + rw [← mul_smul, ← mul_smul, (F.realification.top_commutes _ hk ε).eq] + simp only [realSquareObservable, cosetMap_smul, hs, one_smul] + rw [hcomm, hu _ hk] + exact mul_assoc _ _ _ + +variable (F : NilpotentLieFiltration L (s + 1)) (Γ : Subgroup F.Group) + +theorem realSquare_descent_relative_character (ε : F.realification.Group) + (u : F.realification.Group ⧸ Γ.map realificationHom → ℂ) + (χ : F.realification.Group → CircleFourier.Circle) + (hu : ∀ z ∈ F.realification.subgroup (s + 1), ∀ x, u (z • x) = character (χ z) * u x) + (v : F.squareFiltration.quotientTop.realification.Group ⧸ + ((F.squareLattice Γ).map (F.squareFiltration.quotientStepHom + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl)).map realificationHom → ℂ) + (hv : ∀ g, v (QuotientGroup.mk (F.squareFiltration.realQuotientStepHom + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl g)) = + F.realSquareObservable Γ ε u (QuotientGroup.mk g)) + (k : F.squareFiltration.realification.Group) + (hk : F.realSquareFstHom k ∈ F.realification.subgroup (s + 1)) + (hs : F.realSquareSndHom k = 1) + (x : F.squareFiltration.quotientTop.realification.Group ⧸ + ((F.squareLattice Γ).map (F.squareFiltration.quotientStepHom + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl)).map realificationHom) : + v (F.squareFiltration.realQuotientStepHom + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl k • x) = + character (χ (F.realSquareFstHom k)) * v x := by + obtain ⟨g, rfl⟩ := QuotientGroup.mk_surjective x + obtain ⟨y, rfl⟩ := F.squareFiltration.realQuotientStepHom_surjective + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl g + change v (QuotientGroup.mk + (F.squareFiltration.realQuotientStepHom _ (t := s) le_rfl k * + F.squareFiltration.realQuotientStepHom _ (t := s) le_rfl y)) = _ + rw [← map_mul, hv, hv] + exact F.realSquareObservable_relative_character Γ ε u χ hu k hk hs (QuotientGroup.mk y) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +open NilpotentLieBCHGroup CircleFourier +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + (Γ : Subgroup F.realification.Group) + +theorem vertical_frequency_integral_on_lattice (η : L →ₗ[ℚ] ℚ) + (f : F.realification.Group ⧸ Γ → ℂ) + (hf : ∀ z : F.realification.Group, z ∈ F.realification.subgroup s → ∀ x, + f (z • x) = character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * f x) + (hne : ∃ x, f x ≠ 0) (z : F.realification.Group) + (hz : z ∈ F.realification.subgroup s) (hΓ : z ∈ Γ) : + ∃ n : ℤ, realifyFunctional η z.coord = n := by + obtain ⟨x, hx⟩ := hne + have hc : ∀ a : F.realification.Group, Commute z a := by + intro a + exact commute_of_lie_eq_zero z a (F.realification.top_layer_central hz a.coord) + have he : character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) = 1 := by + apply mul_right_cancel₀ hx + calc + _ = f (z • x) := (hf z hz x).symm + _ = f x := by rw [central_smul_eq_self_of_mem Γ hΓ hc x] + _ = 1 * f x := (one_mul _).symm + obtain ⟨n, hn⟩ := (AddCircle.coe_eq_zero_iff (1 : ℝ)).mp ((character_eq_one_iff _).mp he) + exact ⟨n, by simpa only [zsmul_eq_mul, mul_one] using hn.symm⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped TensorProduct + +theorem real_frequency_eq_of_character_multiples (a b : ℝ) + (h : ∀ t : ℝ, character ((t * a : ℝ) : CircleFourier.Circle) = + character ((t * b : ℝ) : CircleFourier.Circle)) : a = b := by + have hinj : Function.Injective character := by + intro x y hxy + apply AddCircle.injective_toCircle one_ne_zero + exact Subtype.ext hxy + have hzero (t : ℝ) : ((t * (a - b) : ℝ) : CircleFourier.Circle) = 0 := by + rw [mul_sub, AddCircle.coe_sub] + exact sub_eq_zero.mpr (hinj (h t)) + by_contra hne + have hab : a - b ≠ 0 := sub_ne_zero.mpr hne + have ht : (1 / (2 * (a - b))) * (a - b) = (1 : ℝ) / 2 := by + field_simp + have hhalf := hzero (1 / (2 * (a - b))) + rw [ht] at hhalf + obtain ⟨n, hn⟩ := (AddCircle.coe_eq_zero_iff (1 : ℝ)).mp hhalf + have hn' : (n : ℝ) = 1 / 2 := by simpa only [zsmul_eq_mul, mul_one] using hn + have hn0 : (0 : ℤ) < n := by exact_mod_cast (show (0 : ℝ) < n by linarith) + have hn1 : n < (1 : ℤ) := by exact_mod_cast (show (n : ℝ) < 1 by linarith) + omega + +theorem vertical_frequency_on_real_direction + {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (Γ : Subgroup F.realification.Group) + (ξ : L →ₗ[ℚ] ℚ) (f : F.realification.Group ⧸ Γ → ℂ) + (hvert : ∀ z ∈ F.realification.subgroup s, ∀ x, + f (z • x) = character ((realifyFunctional ξ z.coord : ℝ) : CircleFourier.Circle) * f x) + (hne : ∃ x, f x ≠ 0) (y : L) (hy : y ∈ F.layer s) (a : ℝ) + (hcharacter : ∀ t : ℝ, ∀ x, + f ((⟨t ⊗ₜ[ℚ] y⟩ : F.realification.Group) • x) = + character ((t * a : ℝ) : CircleFourier.Circle) * f x) : + (ξ y : ℝ) = a := by + obtain ⟨x, hx⟩ := hne + apply real_frequency_eq_of_character_multiples + intro t + apply mul_right_cancel₀ hx + have hz : (⟨t ⊗ₜ[ℚ] y⟩ : F.realification.Group) ∈ F.realification.subgroup s := + Submodule.tmul_mem_baseChange_of_mem t hy + have heq := (hvert _ hz x).symm.trans (hcharacter t x) + simpa only [realifyFunctional_tmul] using heq + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open NilpotentLieBCHGroup CircleFourier +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) + +theorem square_mode_relative_frequency (hs : 1 ≤ s) + (Γ : Subgroup F.squareFiltration.quotientTop.realification.Group) + (η : L →ₗ[ℚ] ℚ) + (ξ : (F.squareLieSubalgebra ⧸ F.squareFiltration.layerIdeal (s + 1)) →ₗ[ℚ] ℚ) + (f : F.squareFiltration.quotientTop.realification.Group ⧸ Γ → ℂ) + (hvert : ∀ z ∈ F.squareFiltration.quotientTop.realification.subgroup s, ∀ y, + f (z • y) = character ((realifyFunctional ξ z.coord : ℝ) : CircleFourier.Circle) * f y) + (hne : ∃ y, f y ≠ 0) + (hrelative : ∀ k : F.squareFiltration.realification.Group, + F.realSquareFstHom k ∈ F.realification.subgroup (s + 1) → + F.realSquareSndHom k = 1 → ∀ y, + f (F.squareFiltration.realQuotientStepHom + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl k • y) = + character ((realifyFunctional η (F.realSquareFstHom k).coord : ℝ) : CircleFourier.Circle) * f y) + (x : F.layer (s + 1)) : + ξ (lieQuotientMap (F.squareFiltration.layerIdeal (s + 1)) + (F.squareRelativeLayer s hs x).val) = η x := by + let z : F.squareLieSubalgebra := (F.squareRelativeLayer s hs x).val + let q := lieQuotientMap (F.squareFiltration.layerIdeal (s + 1)) z + have hq : q ∈ F.squareFiltration.quotientTop.layer s := + F.squareFiltration.quotientLie_mem _ le_rfl (F.squareRelativeLayer s hs x).property + have h := vertical_frequency_on_real_direction F.squareFiltration.quotientTop Γ ξ f + hvert hne q hq (η x : ℝ) (by + intro t y + let k : F.squareFiltration.realification.Group := ⟨t ⊗ₜ[ℚ] z⟩ + have hf : F.realSquareFstHom k = (⟨t ⊗ₜ[ℚ] (x : L)⟩ : F.realification.Group) := + NilpotentLieBCHGroup.ext rfl + have hk : F.realSquareFstHom k ∈ F.realification.subgroup (s + 1) := by + rw [hf] + exact Submodule.tmul_mem_baseChange_of_mem t x.property + have hkzero : F.realSquareSndHom k = 1 := by + apply NilpotentLieBCHGroup.ext + change t ⊗ₜ[ℚ] (0 : L) = 0 + simp only [TensorProduct.tmul_zero] + have hπ : F.squareFiltration.realQuotientStepHom + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl k = + (⟨t ⊗ₜ[ℚ] q⟩ : F.squareFiltration.quotientTop.realification.Group) := + NilpotentLieBCHGroup.ext rfl + have he := hrelative k hk hkzero y + rw [hπ, hf] at he + simpa only [realifyFunctional_tmul] using he) + exact_mod_cast h + +theorem descended_square_mode_frequency_restriction (hs : 1 ≤ s) + (Γ : Subgroup F.Group) (ε : F.realification.Group) + (η : L →ₗ[ℚ] ℚ) (u : F.realification.Group ⧸ Γ.map realificationHom → ℂ) + (hu : ∀ z ∈ F.realification.subgroup (s + 1), ∀ y, + u (z • y) = character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * u y) + (v f : F.squareFiltration.quotientTop.realification.Group ⧸ + ((F.squareLattice Γ).map (F.squareFiltration.quotientStepHom + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl)).map realificationHom → ℂ) + (hv : ∀ g, v (QuotientGroup.mk (F.squareFiltration.realQuotientStepHom + (F.squareFiltration.layerIdeal (s + 1)) (t := s) le_rfl g)) = + F.realSquareObservable Γ ε u (QuotientGroup.mk g)) + (ξ : (F.squareLieSubalgebra ⧸ F.squareFiltration.layerIdeal (s + 1)) →ₗ[ℚ] ℚ) + (hvert : ∀ z ∈ F.squareFiltration.quotientTop.realification.subgroup s, ∀ y, + f (z • y) = character ((realifyFunctional ξ z.coord : ℝ) : CircleFourier.Circle) * f y) + (hne : ∃ y, f y ≠ 0) + (hpres : ∀ (z : F.squareFiltration.quotientTop.realification.Group) (c : ℂ), + (∀ y, v (z • y) = c * v y) → ∀ y, f (z • y) = c * f y) + (x : F.layer (s + 1)) : + ξ (lieQuotientMap (F.squareFiltration.layerIdeal (s + 1)) + (F.squareRelativeLayer s hs x).val) = η x := by + apply F.square_mode_relative_frequency hs _ η ξ f hvert hne + intro k hk hkzero y + exact hpres _ _ + (fun z => F.realSquare_descent_relative_character Γ ε u + (fun a => ((realifyFunctional η a.coord : ℝ) : CircleFourier.Circle)) + hu v hv k hk hkzero z) y + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + +theorem vertical_frequency_eq_of_real_line + (F : NilpotentLieFiltration L s) (Γ : Subgroup F.realification.Group) + (η : L →ₗ[ℚ] ℚ) (f : F.realification.Group ⧸ Γ → ℂ) + (hvert : ∀ z ∈ F.realification.subgroup s, ∀ x, + f (z • x) = character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * f x) + (hne : ∃ x, f x ≠ 0) (c : L) (hc : c ∈ F.layer s) (a : ℚ) + (hline : ∀ t : ℝ, ∀ x, + f ((⟨t ⊗ₜ[ℚ] c⟩ : F.realification.Group) • x) = + character ((t * a : ℝ) : CircleFourier.Circle) * f x) : + η c = a := by + exact_mod_cast vertical_frequency_on_real_direction F Γ η f hvert hne c hc (a : ℝ) hline + +theorem vertical_frequency_eq_one_of_real_line + (F : NilpotentLieFiltration L s) (Γ : Subgroup F.realification.Group) + (η : L →ₗ[ℚ] ℚ) (f : F.realification.Group ⧸ Γ → ℂ) + (hvert : ∀ z ∈ F.realification.subgroup s, ∀ x, + f (z • x) = character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * f x) + (hne : ∃ x, f x ≠ 0) (c : L) (hc : c ∈ F.layer s) + (hline : ∀ t : ℝ, ∀ x, + f ((⟨t ⊗ₜ[ℚ] c⟩ : F.realification.Group) • x) = + character (t : CircleFourier.Circle) * f x) : + η c = 1 := by + apply vertical_frequency_eq_of_real_line F Γ η f hvert hne c hc 1 + simpa only [Rat.cast_one, mul_one] using hline + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/WeightedBlockTorus.lean b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedBlockTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9d8afc5bb1cafa57ead18e6f22b336228fe1fa3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedBlockTorus.lean @@ -0,0 +1,81 @@ +import OAI.Combinatorics.Progressions.Geometry.WeightedBlockSupportScale + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def blockTorusFactor (q h b : ℕ) (A : ℝ) : ℕ := + integerSupportTorusFactor (blockJetScaleBound q h b A) + +theorem blockTorusFactor_pos (q h b : ℕ) (A : ℝ) : 0 < blockTorusFactor q h b A := + integerSupportTorusFactor_pos _ + +theorem blockTorusFactor_upper (q h b : ℕ) {A : ℝ} (hA : 0 ≤ A) : + (blockTorusFactor q h b A : ℝ) ≤ 2 * blockJetScaleBound q h b A + 3 := + integerSupportTorusFactor_upper (blockJetScaleBound_nonneg q h b hA) + +theorem weightedCubeIntegerJetSum_scale_bound {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + {A K : ℝ} (hA : 0 ≤ A) (hK : 0 ≤ K) + (hvol : ∀ b, (∏ j, ((s b j).length : ℝ)) ≤ A * K) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) (shift : J → ℤ) + (x : ∀ b j, IntegerScalarCubeBox I (s b j).length) (S : J) : + |(weightedCubeIntegerJetSum s J shift x S : ℝ) - shift S| ≤ + blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) A * K := by + have hb : |(weightedCubeIntegerJetSum s J shift x S : ℝ) - shift S| ≤ (weightedCubeJetBound s S : ℝ) := by + exact_mod_cast weightedCubeIntegerJetSum_bound s J shift x S + exact hb.trans (weightedCubeJetBound_le_scale s hA hK hvol S (hJ S S.property)) + +theorem weightedModerateIntegerJetSum_scale_bound {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin n → NormalizedScalarCubeSource I) (offset : B → ℤ) + {A K : ℝ} (hA : 0 ≤ A) (hK : 0 ≤ K) + (hvol : ∀ b, (|(offset b : ℝ)| + (c b).length) * (∏ j, ((s b j).length : ℝ)) ≤ A * K) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) (shift : J → ℤ) + (x : ∀ b, IntegerScalarCubeBox Empty (c b).length × (∀ j, IntegerScalarCubeBox I (s b j).length)) + (S : J) : |(weightedModerateIntegerJetSum c s J offset shift x S : ℝ) - shift S| ≤ + blockJetScaleBound (Fintype.card I) n (Fintype.card B) A * K := by + have hb : |(weightedModerateIntegerJetSum c s J offset shift x S : ℝ) - shift S| ≤ + (weightedModerateJetBound c s offset S : ℝ) := by + exact_mod_cast weightedModerateIntegerJetSum_bound c s J offset shift x S + exact hb.trans (weightedModerateJetBound_le_scale c s offset hA hK hvol S (hJ S S.property)) + +theorem weightedCube_grid_mass_eq_torus {B I : Type*} + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] + {n K : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) {A : ℝ} + (hA : 0 ≤ A) (hK : 0 < K) (hvol : ∀ b, (∏ j, ((s b j).length : ℝ)) ≤ A * K) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) (shift z : J → ℤ) + (hz : ∀ S, |(z S : ℝ) - shift S| ≤ blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) A * K) : + integerGridMass (weightedCubeIntegerSource s) (weightedCubeIntegerJetSum s J shift) + (blockTorusFactor (Fintype.card I) (n + 1) (Fintype.card B) A * K) z = + finiteImageMass (weightedCubeIntegerSource s) (weightedCubeIntegerJetSum s J shift) z := by + apply integerGridMass_eq_imageMass_of_scaled_support _ _ shift z hK _ hz + intro x _ S + exact weightedCubeIntegerJetSum_scale_bound s hA (Nat.cast_nonneg _) hvol J hJ shift x S + +theorem weightedModerate_grid_mass_eq_torus {B I : Type*} + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] + {n K : ℕ} (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin n → NormalizedScalarCubeSource I) (offset : B → ℤ) {A : ℝ} + (hA : 0 ≤ A) (hK : 0 < K) + (hvol : ∀ b, (|(offset b : ℝ)| + (c b).length) * (∏ j, ((s b j).length : ℝ)) ≤ A * K) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) (shift z : J → ℤ) + (hz : ∀ S, |(z S : ℝ) - shift S| ≤ blockJetScaleBound (Fintype.card I) n (Fintype.card B) A * K) : + integerGridMass (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s J offset shift) + (blockTorusFactor (Fintype.card I) n (Fintype.card B) A * K) z = + finiteImageMass (weightedModerateIntegerProductSource c s) + (weightedModerateIntegerJetSum c s J offset shift) z := by + apply integerGridMass_eq_imageMass_of_scaled_support _ _ shift z hK _ hz + intro x _ S + exact weightedModerateIntegerJetSum_scale_bound c s offset hA (Nat.cast_nonneg _) hvol J hJ shift x S + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/WeightedFourierExtraction.lean b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedFourierExtraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..022077e0c649e966f677503ac6dc95d2e77a8e89 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedFourierExtraction.lean @@ -0,0 +1,72 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +theorem summable_weighted_unit_coefficients {ι : Type*} (w : ι → ℝ) (c : ι → ℂ) + (hw : Summable w) (hwpos : ∀ i, 0 ≤ w i) (hc : ∀ i, ‖c i‖ ≤ 1) : + Summable (fun i => (w i : ℂ) * c i) := by + apply hw.of_norm_bounded + intro i + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hwpos i)] + exact mul_le_of_le_one_right (hwpos i) (hc i) + +theorem exists_large_allowed_coefficient {ι : Type*} (w : ι → ℝ) (c : ι → ℂ) + (allowed : ι → Prop) [DecidablePred allowed] (z : ι) {A δ τ : ℝ} + (hw : Summable w) (hwpos : ∀ i, 0 ≤ w i) (hwz : w z = 1) (hcz : c z = 1) + (hc : ∀ i, ‖c i‖ ≤ 1) (hδ : 0 ≤ δ) (hA : ∑' i, w i ≤ A) + (htail : (∑' i, if allowed i then 0 else w i) ≤ τ) + (hsmall : (∑' i, (w i : ℂ) * c i).re < 1 - δ * A - τ) : + ∃ i, i ≠ z ∧ allowed i ∧ δ < ‖c i‖ := by + classical + by_contra! hnone + let tail : ι → ℝ := fun i => if allowed i then 0 else w i + have ht : Summable tail := by + convert! hw.indicator {i | ¬ allowed i} using 1 + funext i + simp only [tail, Set.indicator_apply, Set.mem_ofPred_eq, ite_not] + have hsum := summable_weighted_unit_coefficients w c hw hwpos hc + have hr : Summable (fun i => ((w i : ℂ) * c i).re) := + (Complex.hasSum_re hsum.hasSum).summable + let f : ι → ℝ := fun i => ((w i : ℂ) * c i).re + δ * w i + tail i + have hf : Summable f := (hr.add (hw.mul_left δ)).add ht + have hnonneg (i : ι) : 0 ≤ f i := by + have hre : -‖c i‖ ≤ (c i).re := (abs_le.mp (Complex.abs_re_le_norm (c i))).1 + by_cases hi : i = z + · subst i + simp only [f, hwz, hcz, Complex.ofReal_one, mul_one, Complex.one_re] + have htz : 0 ≤ tail z := by simp only [tail]; split_ifs <;> positivity + linarith + · by_cases ha : allowed i + · have hci := hnone i hi ha + have he : 0 ≤ (c i).re + δ := by linarith + have hm := mul_nonneg (hwpos i) he + simpa only [f, tail, ha, ite_true, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero, add_zero] using (by nlinarith : 0 ≤ w i * (c i).re + δ * w i) + · have he : 0 ≤ (c i).re + 1 := by linarith [hc i] + have hm := mul_nonneg (hwpos i) he + have hd := mul_nonneg hδ (hwpos i) + simp only [f, tail, ha, ite_false, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + nlinarith + have hz : 1 ≤ f z := by + have htz : 0 ≤ tail z := by simp only [tail]; split_ifs <;> positivity + simp only [f, hwz, hcz, Complex.ofReal_one, mul_one, Complex.one_re] + linarith + have hone : 1 ≤ ∑' i, f i := hz.trans (hf.le_tsum z (fun i _ => hnonneg i)) + rw [show (∑' i, f i) = (∑' i, ((w i : ℂ) * c i).re) + δ * (∑' i, w i) + ∑' i, tail i by + simp only [f, Summable.tsum_add (hr.add (hw.mul_left δ)) ht, + Summable.tsum_add hr (hw.mul_left δ), tsum_mul_left]] at hone + rw [← Complex.re_tsum hsum] at hone + have hweight := mul_le_mul_of_nonneg_left hA hδ + change (∑' i, tail i) ≤ τ at htail + linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/WeightedModerateProductFourierTail.lean b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedModerateProductFourierTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef2825cc42e810f2a96e799ad5e4c5fb09f3bdfa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedModerateProductFourierTail.lean @@ -0,0 +1,54 @@ +import OAI.Combinatorics.Progressions.Sampling.WeightedCubeGridDensity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedModerateGridProduct_truncation_le {B : Type*} [Fintype B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U : ℝ} + (hc : ∀ b, ScalarCubePrimitiveBudget (c b) A U) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (ζ : ℕ → ℝ) (m : ℕ) (hζ : ∀ i ≤ m, 0 < ζ i ∧ ζ i ≤ 1) + (hclen : ∀ i ≤ m, ∀ b, localizedMajorArcLengthBudget n U (ζ i) ≤ (c b).length) + (hlen : ∀ i ≤ m, ∀ b j, localizedMajorArcLengthBudget n U (ζ i) ≤ (s b j).length) + {M : ℕ} (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (offset : B → ℝ) (Q H : ℕ → ℕ) + (hQ : ∀ i ≤ m, ∀ b, (localizedMajorArcBudget n U (ζ i) * ((c b).modulus none * U ^ n)) ^ J.card ≤ Q i) + (hH : ∀ i ≤ m, ∀ b, M * (localizedMajorArcErrorBudget n U (ζ i) / + (((c b).modulus none * (c b).length : ℝ) * ∏ j, ((s b j).length : ℝ))) ≤ H i) + (ψ : (J → Fin M) → ℂ) (hψ : ∀ k, ‖ψ k‖ ≤ 1) : + ‖(∑ k, (∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b) M J k) * ψ k) - + ∑ k ∈ rationalGridMajorBox J M (Q 0) (H 0), + (∏ b, weightedModerateGridCoefficient (c b) (s b) (offset b) M J k) * ψ k‖ ≤ + gridBlockTailBudget M J.card (Fintype.card B) Q H ζ m := by + let S i := rationalGridMajorBox J M (Q i) (H i) + have hsmall : ∀ i ≤ m, ∀ b k, k ∉ S i → + ‖weightedModerateGridCoefficient (c b) (s b) (offset b) M J k‖ ≤ ζ i := by + intro i hi b k hk + by_contra hnot + exact hk (weightedModerateGridCoefficient_mem_major (c b) (s b) A hA (hc b) (h b) + (hζ i hi).1 (hζ i hi).2 (hclen i hi b) (hlen i hi b) (offset b) hM J hJ + (hQ i hi b) (hH i hi b) k (le_of_lt (lt_of_not_ge hnot))) + have ht := product_spectrum_truncation_levels + (fun b k => weightedModerateGridCoefficient (c b) (s b) (offset b) M J k) ψ hψ S ζ m + (fun i hi => (hζ i hi).1.le) hsmall + apply ht.trans + apply add_le_add + · apply Finset.sum_le_sum + intro i hi + apply mul_le_mul_of_nonneg_right + · simpa only [Fintype.card_coe] using rationalGridMajorBox_card J M (Q (i + 1)) (H (i + 1)) + · exact pow_nonneg (hζ i (by have := Finset.mem_range.mp hi; omega)).1.le _ + · exact le_of_eq (by simp only [Fintype.card_fun, Fintype.card_fin, Fintype.card_coe, Nat.cast_pow]) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/WeightedTranslationBufferedCentralFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedTranslationBufferedCentralFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..436ac49c38ccb4986271246662a7fc393cafb35f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedTranslationBufferedCentralFrequency.lean @@ -0,0 +1,75 @@ +import OAI.Combinatorics.Progressions.Nilpotent.LocalMajorDenseSliceNiltest + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module +open scoped TensorProduct + +variable {σ : Type*} [Fintype σ] + +noncomputable def centralConstantPolynomial (w : σ → ℕ) (d : ℕ) (hd : 0 < d) + (t : ℝ) : weightedSupportLT (R := ℝ) w d := + ⟨C t, (monomial_mem_restrictSupport ℝ).mpr (Or.inl (by simpa using hd))⟩ + +noncomputable def centralRealLine (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) (t : ℝ) : + (weightedFiltration w d hwd).realification.Group := + ⟨polynomialRealElement w d hw (centralConstantPolynomial w d hd t)⟩ + +@[simp] theorem centralRealLine_map (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) (t : ℝ) : + bchRealTranslationHom w d hwd (centralRealLine w d hw hd hwd t) = ⟨0, C t⟩ := + bchRealTranslationHom_pure_polynomial_of_shape w d hwd _ _ + (polynomialRealElement_shear_base w d hw _) + (polynomialRealElement_shear_extra w d hw _) + +@[simp] theorem centralRealLine_zero (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) : + centralRealLine w d hw hd hwd 0 = 1 := by + apply bchRealTranslationHom_injective w d hwd + simp only [centralRealLine_map, map_one, map_zero] + rfl + +@[simp] theorem centralRealLine_add (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) (t u : ℝ) : + centralRealLine w d hw hd hwd (t + u) = + centralRealLine w d hw hd hwd t * centralRealLine w d hw hd hwd u := by + apply bchRealTranslationHom_injective w d hwd + simp only [map_mul, centralRealLine_map] + apply PolynomialTranslationGroupOver.ext <;> simp + + theorem centralRealLine_commute (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) (t : ℝ) + (g : (weightedFiltration w d hwd).realification.Group) : + Commute (centralRealLine w d hw hd hwd t) g := by + apply bchRealTranslationHom_injective w d hwd + simp only [map_mul, centralRealLine_map] + apply PolynomialTranslationGroupOver.ext <;> simp [add_comm] + +variable {m : ℕ} (w : Fin m → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) [Fintype (WeightedBasisIndex w d)] + +theorem weightedTranslationBufferedObservable_central + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) (t : ℝ) + (q : (weightedTranslationNilmanifold w d hw hwd).Space) : + weightedTranslationBufferedObservable w d hw hwd Ψ D₀ + (centralRealLine w d hw hd hwd t • q) = + weightedTranslationBufferedObservable w d hw hwd Ψ D₀ q * + (Real.fourierChar t : ℂ) := by + induction q using Quotient.inductionOn with + | h g => + change weightedTranslationBufferedObservable w d hw hwd Ψ D₀ + (QuotientGroup.mk (centralRealLine w d hw hd hwd t * g)) = _ + rw [(centralRealLine_commute w d hw hd hwd t g).eq] + simp only [weightedTranslationBufferedObservable_mk, map_mul, centralRealLine_map] + exact bufferedTranslationPhase_central Ψ D₀ _ t + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/WeightedTranslationTwistedCentralFrequency.lean b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedTranslationTwistedCentralFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f73b1bd03394fa4966d9162c49bf937b7bea55e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedTranslationTwistedCentralFrequency.lean @@ -0,0 +1,319 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeFixedVerticalPower +import OAI.Combinatorics.Progressions.Estimates.WeightedTranslationCentralTop +import OAI.Combinatorics.Progressions.Nilpotent.WeightedTranslationTwistedNiltest + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold.Niltest + +open CircleFourier +open scoped TensorProduct BigOperators + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + {D : RationalFilteredNilmanifold L s d} {w : σ → ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + +theorem exists_vertical_decomposition_preserving_bounds_and_characters (T : D.Niltest w) + {p rho : ℝ} (hp : 0 ≤ p) (hT : T.ComplexityLE p) (hrho : 0 < rho) + (hrhop : rho⁻¹ ≤ Real.exp p) : + ∃ (J : Type) (inst : Fintype J), letI := inst + ∃ (eta : J → L →ₗ[ℚ] ℚ) (U : J → D.Niltest w), + (Fintype.card J : ℝ) ≤ Real.exp (verticalDecompositionBudget p) ∧ + (∀ j i, rationalLogHeight (eta j (D.basis i)) ≤ verticalDecompositionBudget p) ∧ + (∀ j, (U j).ComplexityLE p ∧ (U j).orbit = T.orbit ∧ + (U j).normBound = T.normBound ∧ (U j).lipBound = T.lipBound) ∧ + (∀ j (z : D.RealGroup), z ∈ D.filtration.realification.subgroup s → ∀ x, + (U j).observable (z • x) = + character ((realifyFunctional (eta j) z.coord : ℝ) : CircleFourier.Circle) * (U j).observable x) ∧ + (∀ j, (∃ x, (U j).observable x ≠ 0) → ∀ z : D.RealGroup, + z ∈ D.filtration.realification.subgroup s → z ∈ D.realLattice → + ∃ n : ℤ, realifyFunctional (eta j) z.coord = n) ∧ + (∀ (z : D.RealGroup) (c : ℂ), (∀ x, T.observable (z • x) = c * T.observable x) → + ∀ j x, (U j).observable (z • x) = c * (U j).observable x) ∧ + (∀ x, ‖(∑ j, (U j).observable x) - T.observable x‖ ≤ rho) ∧ + ∀ x : σ → ℤ, ‖(∑ j, (U j).eval x) - T.eval x‖ ≤ rho := by + let := D.metricSpace + have hK : (T.lipBound : ℝ) ≤ Real.exp p := by + have h := observable_budget hT + have hB := T.normBound.coe_nonneg + linarith + obtain ⟨J, inst, eta, v, hcard, hheight, hv, hchar, hpres, herr⟩ := + D.exists_controlled_vertical_decomposition hp hT.1 T.observable T.lipBound T.normBound + T.lipschitz T.norm_le hK rho hrho hrhop + let U : J → D.Niltest w := fun j => + { orbit := T.orbit + observable := v j + normBound := T.normBound + lipBound := T.lipBound + norm_le := (hv j).2 + lipschitz := (hv j).1 } + refine ⟨J, inst, eta, U, hcard, hheight, fun _ => ⟨hT, rfl, rfl, rfl⟩, hchar, ?_, hpres, herr, ?_⟩ + · intro j hne z hz hGamma + exact vertical_frequency_integral_on_lattice D.filtration D.realLattice (eta j) (v j) + (hchar j) hne z hz hGamma + · intro x + exact herr (QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval w x T.orbit)) + +end Erdos3.RationalFilteredNilmanifold.Niltest + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped TensorProduct BigOperators + +theorem exists_native_vertical_pair_preserving_characters_on_finset + {X σ L M : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s d e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (D : RationalFilteredNilmanifold L s d) (D' : RationalFilteredNilmanifold M s e) + {w : σ → ℕ} (Q : D.Niltest w) (R : D'.Niltest w) + {p q delta rho eta : ℝ} (hp : 0 ≤ p) (hq : 0 ≤ q) (hdelta : 0 < delta) + (hrho : 0 < rho) (heta : 0 < eta) (hrhop : rho⁻¹ ≤ Real.exp p) (hetaq : eta⁻¹ ≤ Real.exp q) + (hQc : Q.ComplexityLE p) (hRc : R.ComplexityLE q) + (hQcap : (Q.normBound : ℝ) ≤ 1) (hRcap : (R.normBound : ℝ) ≤ 1) + (hsmall : rho + Real.exp (verticalDecompositionBudget p) * eta ≤ delta / 2) + (B : Finset X) (hB : B.Nonempty) (sample : X → σ → ℤ) (U : X → ℂ) + (hU : ∀ x ∈ B, ‖U x‖ ≤ 1) + (hcorr : delta ≤ ‖𝔼 x ∈ B, U x * Q.eval (sample x) * R.eval (sample x)‖) : + ∃ (freq : L →ₗ[ℚ] ℚ) (freq' : M →ₗ[ℚ] ℚ) (V : D.Niltest w) (W : D'.Niltest w), + V.ComplexityLE p ∧ V.orbit = Q.orbit ∧ V.normBound = Q.normBound ∧ + W.ComplexityLE q ∧ W.orbit = R.orbit ∧ W.normBound = R.normBound ∧ + (∀ i, rationalLogHeight (freq (D.basis i)) ≤ verticalDecompositionBudget p) ∧ + (∀ i, rationalLogHeight (freq' (D'.basis i)) ≤ verticalDecompositionBudget q) ∧ + (∀ z, z ∈ D.filtration.realification.subgroup s → ∀ x, + V.observable (z • x) = character ((realifyFunctional freq z.coord : ℝ) : CircleFourier.Circle) * + V.observable x) ∧ + (∀ z, z ∈ D'.filtration.realification.subgroup s → ∀ x, + W.observable (z • x) = character ((realifyFunctional freq' z.coord : ℝ) : CircleFourier.Circle) * + W.observable x) ∧ + (∀ (z : D.RealGroup) (c : ℂ), + (∀ x, Q.observable (z • x) = c * Q.observable x) → + ∀ x, V.observable (z • x) = c * V.observable x) ∧ + (∀ (z : D'.RealGroup) (c : ℂ), + (∀ x, R.observable (z • x) = c * R.observable x) → + ∀ x, W.observable (z • x) = c * W.observable x) ∧ + (∃ x, V.observable x ≠ 0) ∧ (∃ x, W.observable x ≠ 0) ∧ + (delta / 2) / (Real.exp (verticalDecompositionBudget p) * Real.exp (verticalDecompositionBudget q)) ≤ + ‖𝔼 x ∈ B, U x * V.eval (sample x) * W.eval (sample x)‖ := by + obtain ⟨I, instI, freqV, V, hI, hheightV, hcertV, hvertV, _, hpresV, _, happroxV⟩ := + Q.exists_vertical_decomposition_preserving_bounds_and_characters hp hQc hrho hrhop + let := instI + obtain ⟨J, instJ, freqW, W, hJ, hheightW, hcertW, hvertW, _, hpresW, _, happroxW⟩ := + R.exists_vertical_decomposition_preserving_bounds_and_characters hq hRc heta hetaq + let := instJ + obtain ⟨i, j, hbias⟩ := exists_correlating_components_on_finset B hB U + (fun x => Q.eval (sample x)) (fun x => R.eval (sample x)) + (fun i x => (V i).eval (sample x)) (fun j x => (W j).eval (sample x)) + hdelta (Real.exp_pos _) (Real.exp_pos _) hrho.le heta.le hI hJ hU + (fun x _ => (R.norm_eval_le (sample x)).trans hRcap) + (fun i x _ => ((V i).norm_eval_le (sample x)).trans (by rw [(hcertV i).2.2.1]; exact hQcap)) + (fun x _ => by simpa only [norm_sub_rev] using happroxV (sample x)) + (fun x _ => by simpa only [norm_sub_rev] using happroxW (sample x)) hsmall hcorr + have hbiaspos : 0 < ‖𝔼 x ∈ B, U x * (V i).eval (sample x) * (W j).eval (sample x)‖ := + lt_of_lt_of_le (div_pos (div_pos hdelta (by norm_num)) + (mul_pos (Real.exp_pos _) (Real.exp_pos _))) hbias + have hVne : ∃ x, (V i).observable x ≠ 0 := by + by_contra! hzero + have heval : ∀ x, (V i).eval (sample x) = 0 := fun x => hzero _ + simp [heval] at hbiaspos + have hWne : ∃ x, (W j).observable x ≠ 0 := by + by_contra! hzero + have heval : ∀ x, (W j).eval (sample x) = 0 := fun x => hzero _ + simp [heval] at hbiaspos + exact ⟨freqV i, freqW j, V i, W j, (hcertV i).1, (hcertV i).2.1, (hcertV i).2.2.1, + (hcertW j).1, (hcertW j).2.1, (hcertW j).2.2.1, hheightV i, hheightW j, hvertV i, hvertW j, + (fun z c hz => hpresV z c hz i), (fun z c hz => hpresW z c hz j), hVne, hWne, hbias⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped TensorProduct BigOperators + +theorem exists_native_vertical_pair_preserving_characters_power : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X σ L M : Type*} + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] {s d e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (D : RationalFilteredNilmanifold L s d) (D' : RationalFilteredNilmanifold M s e) + {w : σ → ℕ} (Q : D.Niltest w) (R : D'.Niltest w) (p : ℝ), 0 ≤ p → + Q.ComplexityLE p → R.ComplexityLE p → + (Q.normBound : ℝ) ≤ 1 → (R.normBound : ℝ) ≤ 1 → + ∀ (B : Finset X), B.Nonempty → ∀ (sample : X → σ → ℤ) (U : X → ℂ), + (∀ x ∈ B, ‖U x‖ ≤ 1) → + Real.exp (-p) ≤ ‖𝔼 x ∈ B, U x * Q.eval (sample x) * R.eval (sample x)‖ → + ∃ (freq : L →ₗ[ℚ] ℚ) (freq' : M →ₗ[ℚ] ℚ) (V : D.Niltest w) (W : D'.Niltest w), + V.ComplexityLE ((p + C) ^ C) ∧ V.orbit = Q.orbit ∧ V.normBound = Q.normBound ∧ + W.ComplexityLE ((p + C) ^ C) ∧ W.orbit = R.orbit ∧ W.normBound = R.normBound ∧ + (∀ i, rationalLogHeight (freq (D.basis i)) ≤ (p + C) ^ C) ∧ + (∀ i, rationalLogHeight (freq' (D'.basis i)) ≤ (p + C) ^ C) ∧ + (∀ z, z ∈ D.filtration.realification.subgroup s → ∀ x, + V.observable (z • x) = character ((realifyFunctional freq z.coord : ℝ) : CircleFourier.Circle) * + V.observable x) ∧ + (∀ z, z ∈ D'.filtration.realification.subgroup s → ∀ x, + W.observable (z • x) = character ((realifyFunctional freq' z.coord : ℝ) : CircleFourier.Circle) * + W.observable x) ∧ + (∀ (z : D.RealGroup) (c : ℂ), + (∀ x, Q.observable (z • x) = c * Q.observable x) → + ∀ x, V.observable (z • x) = c * V.observable x) ∧ + (∀ (z : D'.RealGroup) (c : ℂ), + (∀ x, R.observable (z • x) = c * R.observable x) → + ∀ x, W.observable (z • x) = c * W.observable x) ∧ + (∃ x, V.observable x ≠ 0) ∧ (∃ x, W.observable x ≠ 0) ∧ + Real.exp (-((p + C) ^ C)) ≤ ‖𝔼 x ∈ B, U x * V.eval (sample x) * W.eval (sample x)‖ := by + obtain ⟨C, hC, hprecision⟩ := exists_vertical_pair_precision + refine ⟨C, hC, ?_⟩ + intro X σ L M _ _ _ _ s d e _ _ _ _ _ _ _ _ D D' w Q R p hp hQ hR hQcap hRcap + B hB sample U hU hcorr + obtain ⟨q, r, rho, eta, hpq, hpr, hqC, hrC, hVq, hVr, hrho, heta, hrhoq, hetar, hsmall, hloss⟩ := + hprecision p hp + obtain ⟨freq, freq', V, W, hVc, hVo, hVn, hWc, hWo, hWn, hVheight, hWheight, + hvertV, hvertW, hpresV, hpresW, hVne, hWne, hbias⟩ := + exists_native_vertical_pair_preserving_characters_on_finset D D' Q R + (hp.trans hpq) (hp.trans hpr) (Real.exp_pos _) hrho heta hrhoq hetar + (hQ.mono hpq) (hR.mono hpr) hQcap hRcap hsmall B hB sample U hU hcorr + exact ⟨freq, freq', V, W, hVc.mono hqC, hVo, hVn, hWc.mono hrC, hWo, hWn, + fun i => (hVheight i).trans hVq, fun i => (hWheight i).trans hVr, + hvertV, hvertW, hpresV, hpresW, hVne, hWne, hloss.trans hbias⟩ + +end Erdos3 + +end + +section + +namespace Erdos3.PolynomialTranslationLie +open MvPolynomial CircleFourier +open scoped TensorProduct + +variable {m : ℕ} (w : Fin m → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) [Fintype (WeightedBasisIndex w d)] + + theorem central_character_eq_fourierChar (t : ℝ) : + character (t : CircleFourier.Circle) = (Real.fourierChar t : ℂ) := by + rw [character_coe_exp, Real.fourierChar_apply] + congr 1 + push_cast + ring + +theorem weightedTranslation_frequency_one_of_central + {σ : Type*} [Fintype σ] (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) + (Γ : Subgroup (weightedFiltration w d hwd).realification.Group) + (η : weightedSubalgebra w d →ₗ[ℚ] ℚ) + (f : (weightedFiltration w d hwd).realification.Group ⧸ Γ → ℂ) + (hvert : ∀ z ∈ (weightedFiltration w d hwd).realification.subgroup d, ∀ x, + f (z • x) = character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * f x) + (hne : ∃ x, f x ≠ 0) + (hline : ∀ t x, f (centralRealLine w d hw hd hwd t • x) = + (Real.fourierChar t : ℂ) * f x) : + η (centralRationalElement w d hd 1) = 1 := by + apply vertical_frequency_eq_one_of_real_line (weightedFiltration w d hwd) Γ + η f hvert hne _ (centralRationalElement_mem_top w d hd hwd 1) + intro t x + have he : (⟨t ⊗ₜ[ℚ] centralRationalElement w d hd 1⟩ : + (weightedFiltration w d hwd).realification.Group) = centralRealLine w d hw hd hwd t := by + apply NilpotentLieBCHGroup.ext + exact (centralRealLine_coord w d hw hd hwd t).symm + rw [he, central_character_eq_fourierChar] + exact hline t x + +theorem weightedTranslation_selected_frequency_one + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) + (η : weightedSubalgebra w d →ₗ[ℚ] ℚ) + (f : (weightedTranslationNilmanifold w d hw hwd).Space → ℂ) + (hvert : ∀ z ∈ (weightedFiltration w d hwd).realification.subgroup d, ∀ x, + f (z • x) = character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * f x) + (hne : ∃ x, f x ≠ 0) + (hpres : ∀ (z : (weightedFiltration w d hwd).realification.Group) (c : ℂ), + (∀ x, weightedTranslationBufferedObservable w d hw hwd Ψ D₀ (z • x) = + c * weightedTranslationBufferedObservable w d hw hwd Ψ D₀ x) → + ∀ x, f (z • x) = c * f x) : + η (centralRationalElement w d hd 1) = 1 := by + apply vertical_frequency_eq_one_of_real_line + (weightedFiltration w d hwd) (weightedTranslationNilmanifold w d hw hwd).realLattice + η f hvert hne _ (centralRationalElement_mem_top w d hd hwd 1) + intro t x + have he : (⟨t ⊗ₜ[ℚ] centralRationalElement w d hd 1⟩ : + (weightedFiltration w d hwd).realification.Group) = centralRealLine w d hw hd hwd t := by + apply NilpotentLieBCHGroup.ext + exact (centralRealLine_coord w d hw hd hwd t).symm + rw [he, central_character_eq_fourierChar] + apply hpres + intro y + rw [weightedTranslationBufferedObservable_central w d hw hd hwd] + exact mul_comm _ _ + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial CircleFourier + +variable {m : ℕ} (w : Fin m → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (hd : 0 < d) (hwd : ∀ i, w i ≤ d) [Fintype (WeightedBasisIndex w d)] + (M : ℕ) (hM : 0 < M) + +theorem weightedTranslationTwistedObservable_central + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) + (T : (Fin m → ℝ) → (Fin m → ZMod M) → ℂ) (t : ℝ) + (x : (weightedTranslationResidueNilmanifold w d hw hwd M hM).Space) : + weightedTranslationTwistedObservable w d hw hwd M hM Ψ D₀ T + (centralRealLine w d hw hd hwd t • x) = + weightedTranslationTwistedObservable w d hw hwd M hM Ψ D₀ T x * + (Real.fourierChar t : ℂ) := by + induction x using Quotient.inductionOn with + | h g => + change weightedTranslationTwistedObservable w d hw hwd M hM Ψ D₀ T + (QuotientGroup.mk (centralRealLine w d hw hd hwd t * g)) = _ + rw [(centralRealLine_commute w d hw hd hwd t g).eq] + simp only [weightedTranslationTwistedObservable_mk, map_mul, centralRealLine_map] + exact twistedBufferedTranslationPhase_central M Ψ D₀ T _ t + +theorem weightedTranslation_twisted_selected_frequency_one + (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) + (T : (Fin m → ℝ) → (Fin m → ZMod M) → ℂ) + (η : weightedSubalgebra w d →ₗ[ℚ] ℚ) + (f : (weightedTranslationResidueNilmanifold w d hw hwd M hM).Space → ℂ) + (hvert : ∀ z ∈ (weightedFiltration w d hwd).realification.subgroup d, ∀ x, + f (z • x) = character ((realifyFunctional η z.coord : ℝ) : CircleFourier.Circle) * f x) + (hne : ∃ x, f x ≠ 0) + (hpres : ∀ (z : (weightedFiltration w d hwd).realification.Group) (c : ℂ), + (∀ x, weightedTranslationTwistedObservable w d hw hwd M hM Ψ D₀ T (z • x) = + c * weightedTranslationTwistedObservable w d hw hwd M hM Ψ D₀ T x) → + ∀ x, f (z • x) = c * f x) : + η (centralRationalElement w d hd 1) = 1 := by + apply weightedTranslation_frequency_one_of_central w d hw hd hwd + (weightedTranslationResidueNilmanifold w d hw hwd M hM).realLattice η f hvert hne + intro t x + apply hpres + intro y + rw [weightedTranslationTwistedObservable_central w d hw hd hwd M hM] + exact mul_comm _ _ + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Fourier/WeightedUniformSpectrumTail.lean b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedUniformSpectrumTail.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b3ae894cdc0b83c4d9bc4a7548abe382569bfba --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Fourier/WeightedUniformSpectrumTail.lean @@ -0,0 +1,155 @@ +import OAI.Combinatorics.Progressions.Fourier.UniformSpectrumAbsoluteCap + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedCubeGridCoefficient_mem_polynomial {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) (hV : 0 ≤ V) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ (s j).length) + {M : ℕ} (hM : 0 < M) (hscale : (M : ℝ) / ∏ j, ((s j).length : ℝ) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (k : J → Fin M) (hk : ζ ≤ ‖weightedCubeGridCoefficient s M J k‖) : + k ∈ polynomialGridCover J M (majorArcCoverConstant n J.card U V) + (majorArcCoverExponent n J.card) ζ := by + have hU := (h 0).one_le + apply weightedCubeGridCoefficient_mem_major s A hA h hζ hζ1 + (fun j => (localizedMajorArcLengthBudget_le_power n hU hζ hζ1).trans (hlen j)) hM J hJ + · exact (majorArc_denominator_le_cover n J.card hU hV hζ hζ1).trans (Nat.le_ceil _) + · exact (majorArc_scaled_error_le_cover n J.card hU hV hζ hζ1 hscale).trans (Nat.le_ceil _) + · exact hk + +theorem weightedCubeGridCoefficient_minor_polynomial {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) (hV : 0 ≤ V) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ (s j).length) + {M : ℕ} (hM : 0 < M) (hscale : (M : ℝ) / ∏ j, ((s j).length : ℝ) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (k : J → Fin M) (hk : k ∉ polynomialGridCover J M (majorArcCoverConstant n J.card U V) + (majorArcCoverExponent n J.card) ζ) : ‖weightedCubeGridCoefficient s M J k‖ ≤ ζ := by + exact le_of_lt (lt_of_not_ge (fun hh => hk + (weightedCubeGridCoefficient_mem_polynomial s A hA h hV hζ hζ1 hlen hM hscale J hJ k hh))) + +theorem weightedModerateGridCoefficient_mem_polynomial {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (c : NormalizedScalarCubeSource Empty) + (s : Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hclen : majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ c.length) + (hlen : ∀ j, majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ (s j).length) + (shift : ℝ) {M : ℕ} (hM : 0 < M) + (hscale : (M : ℝ) / (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (k : J → Fin M) (hk : ζ ≤ ‖weightedModerateGridCoefficient c s shift M J k‖) : + k ∈ polynomialGridCover J M (majorArcCoverConstant n J.card U V) + (majorArcCoverExponent n J.card) ζ := by + have hU := hc.one_le + have hU0 : 0 ≤ U := le_trans (by norm_num) hU + have hm : (c.modulus none : ℝ) ≤ U := + (by exact_mod_cast c.modulus_le none : (c.modulus none : ℝ) ≤ c.modulusBound).trans hc.modulus_le + have hq := (localizedMajorArcBudget_pos n hU hζ).le + have hd : (localizedMajorArcBudget n U ζ * ((c.modulus none : ℝ) * U ^ n)) ^ J.card ≤ + (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card := by + apply pow_le_pow_left₀ (by positivity) + apply mul_le_mul_of_nonneg_left _ hq + rw [pow_succ'] + exact mul_le_mul_of_nonneg_right hm (pow_nonneg hU0 n) + apply weightedModerateGridCoefficient_mem_major c s A hA hc h hζ hζ1 + ((localizedMajorArcLengthBudget_le_power n hU hζ hζ1).trans hclen) + (fun j => (localizedMajorArcLengthBudget_le_power n hU hζ hζ1).trans (hlen j)) shift hM J hJ + · exact (hd.trans (majorArc_denominator_le_cover n J.card hU hV hζ hζ1)).trans (Nat.le_ceil _) + · exact (majorArc_scaled_error_le_cover n J.card hU hV hζ hζ1 hscale).trans (Nat.le_ceil _) + · exact hk + +theorem weightedModerateGridCoefficient_minor_polynomial {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (c : NormalizedScalarCubeSource Empty) + (s : Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hclen : majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ c.length) + (hlen : ∀ j, majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ (s j).length) + (shift : ℝ) {M : ℕ} (hM : 0 < M) + (hscale : (M : ℝ) / (((c.modulus none : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (k : J → Fin M) (hk : k ∉ polynomialGridCover J M (majorArcCoverConstant n J.card U V) + (majorArcCoverExponent n J.card) ζ) : ‖weightedModerateGridCoefficient c s shift M J k‖ ≤ ζ := by + exact le_of_lt (lt_of_not_ge (fun hh => hk + (weightedModerateGridCoefficient_mem_polynomial c s A hA hc h hV hζ hζ1 + hclen hlen shift hM hscale J hJ k hh))) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem weightedCube_uniform_spectrum_tail {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hlen : ∀ b j, L ≤ (s b j).length) + (M t : ℕ) (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : uniformSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (hscale : ∀ b, (M : ℝ) / ∏ j, ((s b j).length : ℝ) ≤ V) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (haccuracy : uniformBlockSpectrumAccuracyConstant n J.card t U V W * ζ ≤ ε) : + spectrumTail (uniformBlockSpectrumCover J M n U V L ζ) + (fun k => ‖∏ b, weightedCubeGridCoefficient (s b) M J k‖) ≤ ε := by + apply uniformBlockSpectrum_tail M n t (fun b => weightedCubeGridCoefficient (s b) M J) + hU hV hW hL hζ hζ1 hε (by simpa only [Fintype.card_coe] using hB) + (by simpa only [Fintype.card_coe] using hsize) + · intro δ hδ hδ1 hlength b k hk + exact weightedCubeGridCoefficient_minor_polynomial (s b) A hA (h b) hV hδ hδ1 + (fun j => hlength.trans (hlen b j)) hM (hscale b) J hJ k + (by simpa only [Fintype.card_coe] using hk) + · simpa only [Fintype.card_coe] using haccuracy + +theorem weightedModerate_uniform_spectrum_tail {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin n → NormalizedScalarCubeSource I) (shift : B → ℝ) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V W L ζ ε : ℝ} + (hU : 1 ≤ U) (hV : 0 ≤ V) (hW : 0 ≤ W) (hL : 0 ≤ L) + (hc : ∀ b, ScalarCubePrimitiveBudget (c b) A U) + (h : ∀ b j, ScalarCubePrimitiveBudget (s b j) A U) + (hclen : ∀ b, L ≤ (c b).length) (hlen : ∀ b j, L ≤ (s b j).length) + (M t : ℕ) (hM : 0 < M) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (hB : uniformSpectrumBlockCount n J.card t ≤ Fintype.card B) + (hsize : (M : ℝ) ^ J.card ≤ W * L ^ t) + (hscale : ∀ b, (M : ℝ) / ((((c b).modulus none : ℝ) * (c b).length) * + ∏ j, ((s b j).length : ℝ)) ≤ V) + (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) + (haccuracy : uniformBlockSpectrumAccuracyConstant n J.card t U V W * ζ ≤ ε) : + spectrumTail (uniformBlockSpectrumCover J M n U V L ζ) + (fun k => ‖∏ b, weightedModerateGridCoefficient (c b) (s b) (shift b) M J k‖) ≤ ε := by + apply uniformBlockSpectrum_tail M n t + (fun b => weightedModerateGridCoefficient (c b) (s b) (shift b) M J) + hU hV hW hL hζ hζ1 hε (by simpa only [Fintype.card_coe] using hB) + (by simpa only [Fintype.card_coe] using hsize) + · intro δ hδ hδ1 hlength b k hk + exact weightedModerateGridCoefficient_minor_polynomial (c b) (s b) A hA (hc b) (h b) + hV hδ hδ1 (hlength.trans (hclen b)) (fun j => hlength.trans (hlen b j)) (shift b) + hM (hscale b) J hJ k (by simpa only [Fintype.card_coe] using hk) + · simpa only [Fintype.card_coe] using haccuracy + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualCandidateSpatialCenter.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualCandidateSpatialCenter.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa049508171fff7e993e07ee598e69db78aa4328 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualCandidateSpatialCenter.lean @@ -0,0 +1,73 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedExternalCandidateSamplerFamily + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + +namespace AllocatedExternalCandidateSampler + +variable (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ stride cells center) + +theorem path_base_abs_le (z : A.Path) (x : X) : |(z.1.val x : ℝ)| ≤ N x := by + have hz := z.1.property + obtain ⟨a, ha, he⟩ := Finset.mem_image.mp hz + have hax := (mem_integerBox _ _).mp ha x + have hx := congrFun he x + simp only [Pi.add_apply] at hx + have hi : |z.1.val x| ≤ (N x : ℤ) := by + rw [abs_of_nonneg (by omega : 0 ≤ z.1.val x)] + omega + exact_mod_cast hi + +theorem path_spatial_center_mass_le_trim (z : A.Path) (x : X) : + |(jointIntegerFrame (z.1.val, z.2.val) none x : ℝ)| / (N x : ℝ) + τ / 8 ≤ + 1 + τ / 4 := by + have hN : (0 : ℝ) < N x := by exact_mod_cast A.size_pos x + have hnoise := rectangularWeightIndices_zero_bound + (allocatedExternalCandidateWidths B U b S N τ ξ) z.2.property (none, x) + have hnoise' : |(z.2.val (none, x) : ℝ)| ≤ τ * (N x : ℝ) / 8 := by + simpa only [allocatedExternalCandidateWidths, narrowTrimmedSpatialWidths, + trimmedSpatialWidths, centeredSpatialWidths, one_mul, mul_div_assoc] using hnoise + have hcenter : |(jointIntegerFrame (z.1.val, z.2.val) none x : ℝ)| ≤ + (N x : ℝ) + τ * (N x : ℝ) / 8 := by + simp only [jointIntegerFrame, Int.cast_add] + exact (abs_add_le _ _).trans (add_le_add (A.path_base_abs_le z x) hnoise') + have hnorm : |(jointIntegerFrame (z.1.val, z.2.val) none x : ℝ)| / (N x : ℝ) ≤ + 1 + τ / 8 := by + apply (div_le_iff₀ hN).mpr + nlinarith + linarith + +theorem path_spatial_center_mass_le (hτ1 : τ ≤ 1) (z : A.Path) (x : X) : + |(jointIntegerFrame (z.1.val, z.2.val) none x : ℝ)| / (N x : ℝ) + τ / 8 ≤ 2 := by + have h := A.path_spatial_center_mass_le_trim z x + linarith + +end AllocatedExternalCandidateSampler +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialDenseSliceCenter.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialDenseSliceCenter.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f8d81efde4e3c1a6399c33e1424b4e7d361bf60 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialDenseSliceCenter.lean @@ -0,0 +1,249 @@ +import OAI.Combinatorics.Progressions.Dynamics.ArbitraryStepPrescribedBudget +import OAI.Combinatorics.Progressions.Lattices.ActualFixedSpatialSlicedForecastFromResidueBox +import OAI.Combinatorics.Progressions.Sampling.ActualSlicedForecastLateData +import OAI.Combinatorics.Progressions.Sampling.AllocatedDenseFiberSliceForecastGeometry + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod : ℕ} {Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice : ℝ} + +variable {A : Type} [Fintype A] {selected : A → Σ j : Fin m, Fin (n j)} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod selected τ δslice) +variable (q : ActualFixedSpatialSlicedForecastNumerics s) + +structure ActualFixedSpatialDenseSliceInput where + keep : G ⊕ PrincipalTupleIndex B (layerSamplerDegree I n) → Prop + [keepDecidable : DecidablePred keep] + keep_iff : ∀ k, keep k ↔ q.Hchild ≤ + Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) k + step : ℕ + step_pos : 0 < step + box : ResidueBoxSlice + (fun k : {k // keep k} => Sum.elim (fun _ : G => S.value) + (allocatedPrincipalSides B U b S) k.val) step + fixed : {k // ¬keep k} → ℤ + fixed_inside : ∀ k, 0 ≤ fixed k ∧ fixed k < + ((Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) k.val : ℕ) : ℤ) + commonTuple : G → IntegerScalarCubeBox Empty S.value + cost : ℝ + dense : ∀ k, Real.exp (-cost) * + ((Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) k.val : ℕ) : ℝ) ≤ box.length k + kernel_nonempty : Nonempty G + cutoff_le : q.Hchild ≤ S.value + late_floor : 2 ≤ Real.exp (-cost) * (S.value : ℝ) + density_le : q.δ ≤ Real.exp (-cost) + active_width : δslice ≤ Real.exp (-cost) / 2 + kernel_log : cost + 1 ≤ q.v + prescribed_log : cost + 1 ≤ s.Ppres + stride_cap : 2 * Real.exp cost ≤ q.Ptail + +attribute [instance] ActualFixedSpatialDenseSliceInput.keepDecidable + +namespace ActualFixedSpatialDenseSliceInput +variable {s q} (input : ActualFixedSpatialDenseSliceInput s q) + +theorem side_pos (k : G ⊕ PrincipalTupleIndex B (layerSamplerDegree I n)) : + 0 < Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U b S j + +omit [DecidableEq X] in +theorem length_pos (k : {k // input.keep k}) : 0 < input.box.length k := by + have hp : (0 : ℝ) < ((Sum.elim (fun _ : G => S.value) + (allocatedPrincipalSides B U b S) k.val : ℕ) : ℝ) := Nat.cast_pos.mpr (side_pos (S := S) k.val) + exact Nat.cast_pos.mp ((mul_pos (Real.exp_pos _) hp).trans_le (input.dense k)) + +omit [DecidableEq X] in +theorem kernel_kept (g : G) : input.keep (Sum.inl g) := + (input.keep_iff _).mpr input.cutoff_le + +omit [DecidableEq X] in +theorem active_kept (a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}) + (p : B a.val × Fin (layerSamplerDegree I n a.val)) : input.keep (Sum.inr ⟨a.val,p⟩) := by + apply (input.keep_iff _).mpr + change q.Hchild ≤ allocatedPrincipalSides B U b S ⟨a.val,p⟩ + rw [allocatedPrincipalSides_not_short B U b S a p] + exact input.cutoff_le + +noncomputable def principalLower + (a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}) + (p : B a.val × Fin (layerSamplerDegree I n a.val)) : ℝ := + (input.box.fiberParameterStart input.fixed (Sum.inr ⟨a.val,p⟩) : ℝ) / + allocatedPrincipalSides B U b S ⟨a.val,p⟩ + +noncomputable def principalWidth + (a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}) + (p : B a.val × Fin (layerSamplerDegree I n a.val)) : ℝ := + (ResidueBoxSlice.fiberParameterStride (keep := input.keep) (q := input.step) + (Sum.inr ⟨a.val,p⟩) : ℝ) * + (input.box.fiberParameterLength (Sum.inr ⟨a.val,p⟩) - 1 : ℕ) / + allocatedPrincipalSides B U b S ⟨a.val,p⟩ + +omit [DecidableEq X] in +theorem kernel_geometry (g : G) : + 2 ≤ input.box.length ⟨Sum.inl g,input.kernel_kept g⟩ ∧ + 0 ≤ (input.box.start ⟨Sum.inl g,input.kernel_kept g⟩ : ℝ) / S.value ∧ + Real.exp (-input.cost) / 2 ≤ + (input.step : ℝ) * (input.box.length ⟨Sum.inl g,input.kernel_kept g⟩ - 1 : ℕ) / S.value ∧ + (input.box.start ⟨Sum.inl g,input.kernel_kept g⟩ : ℝ) / S.value + + (input.step : ℝ) * (input.box.length ⟨Sum.inl g,input.kernel_kept g⟩ - 1 : ℕ) / S.value < 1 ∧ + (input.step : ℝ) * (input.box.length ⟨Sum.inl g,input.kernel_kept g⟩ - 1 : ℕ) / S.value ≤ 1 ∧ + (input.step : ℝ) ≤ 2 * Real.exp input.cost := + input.box.denseCoordinate_geometry ⟨Sum.inl g,input.kernel_kept g⟩ input.step_pos + S.positive (input.dense _) input.late_floor + +omit [DecidableEq X] in +theorem principal_geometry + (a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}) + (p : B a.val × Fin (layerSamplerDegree I n a.val)) : + 0 ≤ input.principalLower a p ∧ + Real.exp (-input.cost) / 2 ≤ input.principalWidth a p ∧ + |input.principalLower a p| + |input.principalWidth a p| ≤ 1 := by + have heq := allocatedPrincipalSides_not_short B U b S a p + have hf : 2 ≤ Real.exp (-input.cost) * + ((Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) (Sum.inr ⟨a.val,p⟩) : ℕ) : ℝ) := by + simpa only [Sum.elim_inr, heq] using input.late_floor + have hg := input.box.fiberParameter_dense_geometry input.fixed + (Sum.inr ⟨a.val,p⟩) (input.active_kept a p) input.step_pos + (side_pos (S := S) _) (input.dense ⟨Sum.inr ⟨a.val,p⟩,input.active_kept a p⟩) hf + exact ⟨hg.2.1, hg.2.2.1, hg.2.2.2.2⟩ + +omit [DecidableEq X] in +theorem step_le : (input.step : ℝ) ≤ 2 * Real.exp input.cost := by + obtain ⟨g⟩ := input.kernel_nonempty + exact (input.kernel_geometry g).2.2.2.2.2 + +omit [DecidableEq X] in +theorem kernel_exp_width : Real.exp (-q.v) ≤ Real.exp (-input.cost) / 2 := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + Real.exp (-q.v) ≤ Real.exp (-input.cost - 1) := Real.exp_le_exp.mpr (by linarith [input.kernel_log]) + _ = Real.exp (-input.cost) / Real.exp 1 := Real.exp_sub _ _ + _ ≤ _ := div_le_div_of_nonneg_left (Real.exp_nonneg _) (by norm_num) htwo + +end ActualFixedSpatialDenseSliceInput + +namespace ActualFixedSpatialForecastPath + +variable {s q} {δbase PpresBase : ℝ} +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δbase s.P s.Pbad PpresBase) + +noncomputable def toDenseSliceMember (input : ActualFixedSpatialDenseSliceInput s q) : + ActualFixedSpatialSlicedAdmissiblePath + (hR := hR) (hσ := hσ) (spatial := spatial) (kernel := kernel) (block := block) + (spatialEquiv := spatialEquiv) (Wsp := Wsp) (Lsp := Lsp) (physicalN := physicalN) s q := by + classical + let origin : ∀ p : path.primes, LayerSamplerLongVariables + (allocatedShortAxis (I := I) U b S.value) G B → ZMod (p.val ^ path.exponent p.val) := + fun p v => ((Sum.elim + (fun g => (input.box.start ⟨Sum.inl g,input.kernel_kept g⟩ : ℤ)) + (fun a => input.box.fiberParameterStart input.fixed (Sum.inr ⟨a.1.val,a.2⟩)) v : ℤ) : + ZMod (p.val ^ path.exponent p.val)) + have hpres : ((∏ p : path.primes, p.val ^ padicValNat p.val input.step : ℕ) : ℝ) ≤ + Real.exp s.Ppres := + (arbitraryStep_prescribed_product_exp_le path.primes path.prime input.step_pos input.step_le).trans + (Real.exp_le_exp.mpr input.prescribed_log) + let newpath := path.reparameterize δslice s.Ppres input.commonTuple + (fun p => padicValNat p input.step) origin hpres + input.principalLower input.principalWidth + (fun a p => input.active_width.trans (input.principal_geometry a p).2.1) + (fun a p => (input.principal_geometry a p).1) + (fun a p => (input.principal_geometry a p).2.2) + let slice := newpath.withResidueBoxSlice input.box input.length_pos input.fixed input.fixed_inside + input.kernel_kept input.active_kept input.step_pos (fun g => (input.kernel_geometry g).1) + (fun _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) (fun _ _ => rfl) + refine ⟨slice, ?_, ?_, ?_⟩ + · intro a + have hdense (k : {k // input.keep k}) : q.δ * + ((Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) k.val : ℕ) : ℝ) ≤ input.box.length k := + (mul_le_mul_of_nonneg_right input.density_le (Nat.cast_nonneg _)).trans (input.dense k) + have hregular := input.box.fiberParameter_regular_of_threshold hdense input.step_pos + (fun k hk => (input.keep_iff k).mpr hk) + (fun p : B ⟨(selected a).1,Sum.inr (selected a).2⟩ × Fin ((selected a).1.val + 1) => + Sum.inr (⟨⟨(selected a).1,Sum.inr (selected a).2⟩,p⟩ : PrincipalTupleIndex B (layerSamplerDegree I n))) + rcases hregular with ⟨⟨i,v⟩,hsmall⟩ | ⟨hd,hs⟩ + · exact Or.inl ⟨i,v,hsmall⟩ + · exact Or.inr ⟨fun i v => hd (i,v), fun i v => hs (i,v)⟩ + · intro a i v + exact (Nat.cast_le.mpr (ResidueBoxSlice.fiberParameterStride_le (keep := input.keep) + (q := input.step) (Sum.inr ⟨⟨(selected a).1,Sum.inr (selected a).2⟩,i,v⟩))).trans + (input.step_le.trans input.stride_cap) + · intro g + exact input.kernel_exp_width.trans (input.kernel_geometry g).2.2.1 + +end ActualFixedSpatialForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod : ℕ} {Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice : ℝ} + +variable {A : Type} [Fintype A] {selected : A → Σ j : Fin m, Fin (n j)} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod selected τ δslice) +variable (q : ActualFixedSpatialSlicedForecastNumerics s) + +namespace ActualFixedSpatialForecastPath + +variable {s q} {δbase PpresBase : ℝ} +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δbase s.P s.Pbad PpresBase) + +omit [Fintype Tsp] in + +@[simp] theorem toDenseSliceMember_center (input : ActualFixedSpatialDenseSliceInput s q) : + (path.toDenseSliceMember input).slice.path.center = path.center := rfl + +end ActualFixedSpatialForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialNumericalPatchEndpoint.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialNumericalPatchEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9bae5102c2eb32ce61c49db02e880d5f627856d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialNumericalPatchEndpoint.lean @@ -0,0 +1,282 @@ +import OAI.Combinatorics.Progressions.Dynamics.ActualSlicedNumericsRecoveredBudget +import OAI.Combinatorics.Progressions.Linear.ActualFixedSpatialScaledRetainedKernelBounds +import OAI.Combinatorics.Progressions.Linear.RecoveredKernelScalarBudget +import OAI.Combinatorics.Progressions.Sampling.ActualFixedSpatialSlicedRetainedKernelGridCap + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +variable {A : Type} [Fintype A] +variable (selected : A → Σ j : Fin m, Fin (n j)) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + 4 ≤ Fintype.card (B a.val)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + +variable {d : ℕ} (e : Fin d ≃ Σ j, J j) + +theorem relativePatchSliceConclusion_of_primitive_retained_forecast_score + (hmpos : 0 < m) + (hD : Fintype.card X + ∑ j : Fin m, (Fintype.card (Eout j) + n j) ≤ Dmod) + (cutoff : ℕ) (hcutoff : 0 < cutoff) (hsmall : 2 / (cutoff : ℝ) ≤ 1 / 2) + (κ : ℝ≥0) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j q, coefficients (poly j) q ∈ U j) + (hN : ∀ i, 0 < physicalN i) + {s r E rankBound : ℕ} + (w : Fin r → ℕ) (hw : ∀ j, 1 ≤ w j) (hws : ∀ j, w j ≤ s) (hmono : Monotone w) + (Pscalar : Fin r → MvPolynomial X ℝ) + (hP : ∀ j, Pscalar j ∈ weightedSupportLE (fun _ : X => 1) (w j)) + (p : Fin d → ℕ) + (Bpatch : WeightedParameterPatch (X ⊕ Fin d) (Sum.elim (fun _ => 1) p) s E) + (χ : PatchKernel d) (M : Fin d → Fin r → ℤ) (K : ℝ≥0) + (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) + (hweight : ∀ i j, M i j ≠ 0 → w j ≤ p i) + (hcoords : ∀ x : X → ℤ, + fullTaggedBufferedCoordinates e poly (fun j => (slice.path.center j).val) x = + realIntegerMatrix M (fun j => MvPolynomial.aeval (fun i => (x i : ℝ)) (Pscalar j))) + (hcol : ∀ j a, (standardEuclideanPoint (J j) + (fun i => M (e.symm ⟨j,i⟩) a)).val ∈ euclideanSubspace (U j)) + (hdiv : ∀ i a, (slice.path.referenceRetainedCRTModulus cutoff : ℤ) ∣ M i a) + (D Icap : ℝ≥0) + (hdensity : ∀ y, slice.density hB y ∈ Set.Icc (0 : ℝ) D) + (hDlip : LipschitzWith D (slice.density hB)) + (hgrid : ∀ z : A → ℤ, + (∏ a, (basisAxisScale (b (selected a).1) (selected a).2 : ℝ)) * + slice.principalLaw.fiberMean + (forecastInactiveFixedOutput B U b S selected + (allocatedOriginalSampleInactiveCoefficients B selected slice.path.sample) + slice.path.commonTuple) + (fun a _ => z a) (fun _ => 1) ≤ Icap) + (Cchart : Fin m → ℝ≥0) + (hchart : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ + Cchart j * ‖z‖) + (Kchart : ℝ≥0) (hKchart : ∀ j, (R j)⁻¹ ≤ Kchart) (hτ : 0 < τ) + (f : (X → ℤ) → ℝ) (hf : ∀ x ∈ integerBox physicalN, f x ∈ Set.Icc (0 : ℝ) 1) + {lam δ ε score budget : ℝ} + (hlam : lam ∈ Set.Icc (0 : ℝ) 1) (hδ : δ ∈ Set.Icc (0 : ℝ) 1) + (haccuracy : 4 / (cutoff : ℝ) ≤ δ) (hε : ε ∈ Set.Icc (0 : ℝ) 1) + (hdiscount : (1 + δ) * (1 - ε) ≤ 1 - δ) + (hscore : score / 2 ≤ 𝔼 x : ↥(integerBox physicalN), + (slice.targetAt selected hB o bW hb poly hm κ x.val).re * + bufferedScalarScore χ + (fullTaggedBufferedCoordinates e poly (fun j => (slice.path.center j).val)) + (fun u β => Bpatch.value (Sum.elim (fun i => (u i : ℝ)) (fun i => (β i : ℝ)))) + f lam x.val) + (hbudget : 1 ≤ budget) + (hr : (r : ℝ) ≤ budget) (hE : (E : ℝ) ≤ budget) + (hn : (Fintype.card X : ℝ) ≤ budget) + (hOut : (Fintype.card (Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value))) : ℝ) ≤ budget) + (hKbudget : (K : ℝ) ≤ Real.exp budget) + (hχbudget : (χ.lip : ℝ) ≤ Real.exp budget) + (hBbudget : (Bpatch.kernel.lip : ℝ) ≤ Real.exp budget) + (hjoint : (κ : ℝ) * (D : ℝ) * (Icap : ℝ) ≤ Real.exp budget) + (hqbudget : (slice.path.referenceRetainedCRTModulus cutoff : ℝ) ≤ Real.exp budget) + (hchartBudget : ((Kchart * ∑ j, Cchart j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ + Real.exp budget) + (hτBudget : 8 / τ ≤ Real.exp budget) + (hscoreLower : Real.exp (-budget) ≤ score) + (hlarge : ∀ i, Real.exp (spatialPatchExtractionCost (recoveredKernelScalarBudget budget)) ≤ + (physicalN i : ℝ)) + (hrank : r + E ≤ rankBound) : + RelativePatchSliceConclusion s physicalN f ((1 - ε) * lam) rankBound + (spatialPatchExtractionCost (recoveredKernelScalarBudget budget)) := by + let q := slice.path.referenceRetainedCRTModulus cutoff + let outDim := Fintype.card (Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value))) + let Rcap : ℝ≥0 := Icap * (q : ℝ≥0) ^ outDim + let L := recoveredKernelScalarBudget budget + let C : ℝ≥0 := ⟨Real.exp L, Real.exp_nonneg _⟩ + have hL := (recoveredKernelScalarBudget_ge hbudget).1 + have hbudgetL := (recoveredKernelScalarBudget_ge hbudget).2 + have hexp : Real.exp budget ≤ Real.exp L := Real.exp_le_exp.mpr hbudgetL + have hC : 1 ≤ C := Real.one_le_exp_iff.mpr (le_trans zero_le_one hL) + have hcap : ∀ residue β, + |slice.retainedRecoveredRationalFactor selected bW hb e cutoff residue β| ≤ Rcap := by + intro residue β + simpa only [Rcap, q, outDim, NNReal.coe_mul, NNReal.coe_pow, NNReal.coe_natCast] using + (slice.retainedRecoveredRationalFactor_abs_le_grid_modulus_pow selected bW hb e + cutoff hgrid residue β) + have hconstants := recoveredKernel_joint_constants_le_exp hbudget κ D D D Icap + (Kchart * ∑ j, Cchart j * Fintype.card (J j)) ⟨8 / τ, by positivity⟩ q outDim + le_rfl le_rfl hjoint hqbudget hOut hchartBudget hτBudget + have hCcap : κ * (D * Rcap) ≤ C := hconstants.1 + have hCspace : κ * (Rcap * (D * ⟨8 / τ, by positivity⟩)) ≤ C := hconstants.2.1 + have hClift : κ * (Rcap * (D * (Kchart * ∑ j, Cchart j * Fintype.card (J j)))) ≤ C := + hconstants.2.2 + apply slice.relativePatchSliceConclusion_of_actual_retained_forecast_score + selected hB o bW hb e hmpos hD cutoff hcutoff hsmall κ κ.coe_nonneg poly hm hN + w hw hws hmono Pscalar hP p Bpatch χ M K hM hweight hcoords + C C C hC ?_ ?_ ?_ ?_ f hf hlam hδ.1 haccuracy hε hdiscount hscore + hL (hr.trans hbudgetL) (hE.trans hbudgetL) (hn.trans hbudgetL) + (hKbudget.trans hexp) le_rfl le_rfl le_rfl (hχbudget.trans hexp) (hBbudget.trans hexp) + (hqbudget.trans hexp) + (recoveredKernelScalarBudget_discounted_score hbudget hscoreLower hδ.1 hδ.2) hlarge hrank + · intro residue β y + exact (slice.scaledRetainedRecoveredG_spatial_lipschitz selected hB o bW hb e cutoff κ + hτ hDlip hcap residue β y).weaken hCspace + · intro v residue β + exact (slice.scaledRetainedRecoveredG_lift_lipschitz selected hB o bW hb e cutoff κ + Cchart hchart Kchart hKchart hDlip hcap v residue β).weaken hClift + · intro v residue β y + have h := slice.scaledRetainedRecoveredG_mem_Icc selected hB o bW hb e cutoff κ + hdensity hcap v residue β y + exact ⟨h.1, h.2.trans hCcap⟩ + · exact slice.scaledRetainedRecoveredG_recovered_invariant selected hB o bW hb e cutoff κ + M hcol hdiv + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod : ℕ} {Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice : ℝ} +variable {A : Type} [Fintype A] {selected : A → Σ j : Fin m, Fin (n j)} + +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod selected τ δslice) +variable (qnum : ActualFixedSpatialSlicedForecastNumerics s) + +namespace ActualFixedSpatialSlicedAdmissiblePath + +variable (member : ActualFixedSpatialSlicedAdmissiblePath + (hR := hR) (hσ := hσ) (spatial := spatial) (kernel := kernel) (block := block) + (spatialEquiv := spatialEquiv) (Wsp := Wsp) (Lsp := Lsp) (physicalN := physicalN) s qnum) + +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {d : ℕ} (e : Fin d ≃ Σ j, J j) + +theorem relativePatchSliceConclusion_of_numerical_retained_forecast_score + (cutoff : ℕ) (hcutoff : 0 < cutoff) (hsmall : 2 / (cutoff : ℝ) ≤ 1 / 2) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j q, coefficients (poly j) q ∈ U j) + {degree r E rankBound : ℕ} + (w : Fin r → ℕ) (hw : ∀ j, 1 ≤ w j) (hws : ∀ j, w j ≤ degree) (hmono : Monotone w) + (Pscalar : Fin r → MvPolynomial X ℝ) + (hP : ∀ j, Pscalar j ∈ weightedSupportLE (fun _ : X => 1) (w j)) + (p : Fin d → ℕ) + (Bpatch : WeightedParameterPatch (X ⊕ Fin d) (Sum.elim (fun _ => 1) p) degree E) + (χ : PatchKernel d) (M : Fin d → Fin r → ℤ) (K : ℝ≥0) + (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) + (hweight : ∀ i j, M i j ≠ 0 → w j ≤ p i) + (hcoords : ∀ x : X → ℤ, + fullTaggedBufferedCoordinates e poly (fun j => (member.slice.path.center j).val) x = + realIntegerMatrix M (fun j => MvPolynomial.aeval (fun i => (x i : ℝ)) (Pscalar j))) + (hcol : ∀ j a, (standardEuclideanPoint (J j) + (fun i => M (e.symm ⟨j,i⟩) a)).val ∈ euclideanSubspace (U j)) + (hdiv : ∀ i a, (member.slice.path.referenceRetainedCRTModulus cutoff : ℤ) ∣ M i a) + (f : (X → ℤ) → ℝ) (hf : ∀ x ∈ integerBox physicalN, f x ∈ Set.Icc (0 : ℝ) 1) + {lam δ ε score budget : ℝ} + (hlam : lam ∈ Set.Icc (0 : ℝ) 1) (hδ : δ ∈ Set.Icc (0 : ℝ) 1) + (haccuracy : 4 / (cutoff : ℝ) ≤ δ) (hε : ε ∈ Set.Icc (0 : ℝ) 1) + (hdiscount : (1 + δ) * (1 - ε) ≤ 1 - δ) + (hscore : score / 2 ≤ 𝔼 x : ↥(integerBox physicalN), + (member.slice.targetAt selected s.hBactive o bW hb poly hm s.κ x.val).re * + bufferedScalarScore χ + (fullTaggedBufferedCoordinates e poly (fun j => (member.slice.path.center j).val)) + (fun u β => Bpatch.value (Sum.elim (fun i => (u i : ℝ)) (fun i => (β i : ℝ)))) + f lam x.val) + (hbudget : 1 ≤ budget) + (hr : (r : ℝ) ≤ budget) (hE : (E : ℝ) ≤ budget) + (hDmodBudget : (Dmod : ℝ) ≤ budget) + (hKbudget : (K : ℝ) ≤ Real.exp budget) + (hχbudget : (χ.lip : ℝ) ≤ Real.exp budget) + (hBbudget : (Bpatch.kernel.lip : ℝ) ≤ Real.exp budget) + (hcapLog : qnum.capLog ≤ budget) (hPnative : qnum.Pnative ≤ budget) + (hqbudget : (member.slice.path.referenceRetainedCRTModulus cutoff : ℝ) ≤ Real.exp budget) + (hscoreLower : Real.exp (-budget) ≤ score) + (hlarge : ∀ i, Real.exp (spatialPatchExtractionCost (recoveredKernelScalarBudget budget)) ≤ + (physicalN i : ℝ)) + (hrank : r + E ≤ rankBound) : + RelativePatchSliceConclusion degree physicalN f ((1 - ε) * lam) rankBound + (spatialPatchExtractionCost (recoveredKernelScalarBudget budget)) := by + let D : ℝ≥0 := ⟨actualSlicedForecastDensityBudget s qnum.v, Real.exp_nonneg _⟩ + let Icap : ℝ≥0 := ⟨qnum.Ctail ^ Fintype.card A, pow_nonneg qnum.hCtail _⟩ + have hN (i : X) : 0 < physicalN i := Nat.cast_pos.mp + ((Real.exp_pos (spatialPatchExtractionCost (recoveredKernelScalarBudget budget))).trans_le + (hlarge i)) + have hXnat : Fintype.card X ≤ Dmod := + (Nat.le_add_right (Fintype.card X) _).trans s.hDmod + have hX : (Fintype.card X : ℝ) ≤ budget := (Nat.cast_le.mpr hXnat).trans hDmodBudget + have hOutNat : Fintype.card (Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value))) ≤ Dmod := by + rw [Fintype.card_sigma] + exact (allocatedCongruenceRankOutput_sum_card_le (X := X) (E := Eout) + s.hm (allocatedShortAxis (I := I) U b S.value)).trans s.hDmod + have hOut : (Fintype.card (Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value))) : ℝ) ≤ budget := + (Nat.cast_le.mpr hOutNat).trans hDmodBudget + exact member.slice.relativePatchSliceConclusion_of_primitive_retained_forecast_score + selected s.hBactive o bW hb e s.hm s.hDmod cutoff hcutoff hsmall ⟨s.κ, s.hκ⟩ + poly hm hN w hw hws hmono Pscalar hP p Bpatch χ M K hM hweight hcoords hcol hdiv + D Icap (member.density_mem_Icc s qnum) (member.density_lipschitz_nnreal s qnum) + (member.inactive_grid_mass_le s qnum) s.forward s.hforward s.K s.hK s.hτ f hf + hlam hδ haccuracy hε hdiscount hscore hbudget hr hE hX hOut + hKbudget hχbudget hBbudget + ((qnum.joint_density_grid_cap_le_exp s).trans (Real.exp_le_exp.mpr hcapLog)) + hqbudget (qnum.hcoord.trans (Real.exp_le_exp.mpr hPnative)) + ((qnum.spatial_inverse_factor_le_exp s).trans (Real.exp_le_exp.mpr hPnative)) + hscoreLower hlarge hrank + +end ActualFixedSpatialSlicedAdmissiblePath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialPreparedCertificate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialPreparedCertificate.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d39def705d9525c182b71b59d69761d8a697b82 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialPreparedCertificate.lean @@ -0,0 +1,148 @@ +import OAI.Combinatorics.Progressions.Sampling.ActualForecastModelPrecision + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical NNReal + +theorem exists_actualFixedSpatialPreparedParameters + {m : ℕ} (Dmod d : ℕ) + {X : Type*} [Fintype X] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + {P δslice : ℝ} (hP : 1 ≤ P) (hδslice : 0 < δslice) + (hδsliceInv : δslice⁻¹ ≤ Real.exp P) + (hX : (Fintype.card X : ℝ) ≤ P) + (hblocks : (∑ a, (Fintype.card (B a) : ℝ)) ≤ P) + (forward : Fin m → ℝ≥0) (K r : ℝ≥0) + {D pcap Pscale Pbad Ppres E Pτ PK PF τ : ℝ} + (hD : 0 ≤ D) (hDP : D ≤ P) + (haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ D) + (hdim : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ D) + (hpcap : 0 ≤ pcap) (hscale : 0 ≤ Pscale) + (hbad : 0 ≤ Pbad) (hpres : 0 ≤ Ppres) (hE : 0 ≤ E) + (hPτ : 0 ≤ Pτ) (hPK : 0 ≤ PK) (hPF : 0 ≤ PF) + (hτ : 0 < τ) (hτinv : τ⁻¹ ≤ Real.exp Pτ) + (hforward : ∀ j, (forward j : ℝ) ≤ Real.exp PF) + (hK : (K : ℝ) ≤ Real.exp PK) (hr : 1 ≤ r) : + let q := actualFixedSpatialForecastLogs m Dmod d P D pcap Pscale Pbad Ppres E Pτ PK PF + ∃ (T : ℕ) (δ : ℝ), 0 < T ∧ (T : ℝ) ≤ Real.exp q.V ∧ + 0 < δ ∧ δ ≤ 1 ∧ δ⁻¹ ≤ Real.exp q.Esite ∧ + ∀ A₀ A₁ : (X → ℝ) ≃L[ℝ] (X → ℝ), + inverseJacobian A₁ ≤ Real.exp P → ‖A₀.symm.toContinuousLinearMap‖ ≤ Real.exp P → + let H := (fixedSpatialOriginalForecastCap B A₁ hδslice : ℝ) + 1 + let L := fixedSpatialOriginalForecastLip B A₀ A₁ hδslice + H ≤ Real.exp q.sm ∧ (L : ℝ) ≤ Real.exp q.sm ∧ + (∀ (Rbad Qpres : ℕ) (Icap : ℝ), Icap ≤ Real.exp q.Pin → + (Rbad : ℝ) ≤ Real.exp Pbad → (Qpres : ℝ) ≤ Real.exp Ppres → + H * (Icap * ((((Rbad * Qpres : ℕ) : ℝ) ^ + (modularRankDecayExponent m (modularForecastRankConstant m Dmod : ℝ) * + modularRankChargeFactor m)) / T) + (T : ℝ) ^ d * δ) ≤ Real.exp (-E)) ∧ + (∀ a : ℕ, (a : ℝ) ≤ D → + 2 * H * ((T : ℝ) ^ d * Real.exp (a * q.O)) ≤ Real.exp q.mass) ∧ + (∀ (a period : ℕ), (a : ℝ) ≤ D → (period : ℝ) ≤ Real.exp (q.V + a * q.O) → + (period : ℝ) ≤ Real.exp q.native ∧ + (((L + a * ⟨Real.exp q.O, Real.exp_nonneg _⟩) * + max ⟨8 / τ, by positivity⟩ 1 : ℝ≥0) : ℝ) ≤ Real.exp q.native) ∧ + ((K * ∑ j, forward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp q.native ∧ + (((Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * + (K * ∑ j, forward j * Fintype.card (J j)) : ℝ≥0) : ℝ) ≤ Real.exp q.native := by + intro q + obtain ⟨_, _, _, _, _, T, δ, hT, hTv, hδ, hδ1, hδb, hprepared⟩ := + exists_preparedFixedSpatialForecastParameters Dmod d B hP hδslice hδsliceInv hX hblocks + forward K r hD hDP haxes hdim hpcap hscale hbad hpres hE hPτ hPK hPF + hτ hτinv hforward hK hr + refine ⟨T, δ, hT, hTv, hδ, hδ1, hδb, ?_⟩ + intro A₀ A₁ hjac hinverse H L + obtain ⟨hH, hL, herror, _, hmass, hfactor, hcoord, hcut⟩ := + hprepared A₀ A₁ hjac hinverse + exact ⟨hH, hL, herror, hmass, hfactor, hcoord, hcut⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical NNReal + +structure ActualFixedSpatialPreparedCertificate + {m : ℕ} {X : Type*} [Fintype X] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + {δslice : ℝ} (hδslice : 0 < δslice) + (forward : Fin m → ℝ≥0) (K r : ℝ≥0) + (τ : ℝ) (hτ : 0 < τ) (Dmod d : ℕ) + (P D Pbad Ppres E : ℝ) (q : ActualFixedSpatialForecastLogs) + (T : ℕ) (δ : ℝ) : Prop where + hT : 0 < T + hTv : (T : ℝ) ≤ Real.exp q.V + hδ : 0 < δ + hδ1 : δ ≤ 1 + hδb : δ⁻¹ ≤ Real.exp q.Esite + bounds : ∀ A₀ A₁ : (X → ℝ) ≃L[ℝ] (X → ℝ), + inverseJacobian A₁ ≤ Real.exp P → ‖A₀.symm.toContinuousLinearMap‖ ≤ Real.exp P → + let H := (fixedSpatialOriginalForecastCap B A₁ hδslice : ℝ) + 1 + let L := fixedSpatialOriginalForecastLip B A₀ A₁ hδslice + H ≤ Real.exp q.sm ∧ (L : ℝ) ≤ Real.exp q.sm ∧ + (∀ (Rbad Qpres : ℕ) (Icap : ℝ), Icap ≤ Real.exp q.Pin → + (Rbad : ℝ) ≤ Real.exp Pbad → (Qpres : ℝ) ≤ Real.exp Ppres → + H * (Icap * ((((Rbad * Qpres : ℕ) : ℝ) ^ + (modularRankDecayExponent m (modularForecastRankConstant m Dmod : ℝ) * + modularRankChargeFactor m)) / T) + (T : ℝ) ^ d * δ) ≤ Real.exp (-E)) ∧ + (∀ a : ℕ, (a : ℝ) ≤ D → + 2 * H * ((T : ℝ) ^ d * Real.exp (a * q.O)) ≤ Real.exp q.mass) ∧ + (∀ (a period : ℕ), (a : ℝ) ≤ D → (period : ℝ) ≤ Real.exp (q.V + a * q.O) → + (period : ℝ) ≤ Real.exp q.native ∧ + (((L + a * ⟨Real.exp q.O, Real.exp_nonneg _⟩) * + max ⟨8 / τ, by positivity⟩ 1 : ℝ≥0) : ℝ) ≤ Real.exp q.native) ∧ + ((K * ∑ j, forward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp q.native ∧ + (((Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * + (K * ∑ j, forward j * Fintype.card (J j)) : ℝ≥0) : ℝ) ≤ Real.exp q.native + +theorem exists_actualFixedSpatialPreparedCertificate + {m : ℕ} (Dmod d : ℕ) + {X : Type*} [Fintype X] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + {P δslice : ℝ} (hP : 1 ≤ P) (hδslice : 0 < δslice) + (hδsliceInv : δslice⁻¹ ≤ Real.exp P) + (hX : (Fintype.card X : ℝ) ≤ P) + (hblocks : (∑ a, (Fintype.card (B a) : ℝ)) ≤ P) + (forward : Fin m → ℝ≥0) (K r : ℝ≥0) + {D pcap Pscale Pbad Ppres E Pτ PK PF τ : ℝ} + (hD : 0 ≤ D) (hDP : D ≤ P) + (haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ D) + (hdim : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ D) + (hpcap : 0 ≤ pcap) (hscale : 0 ≤ Pscale) + (hbad : 0 ≤ Pbad) (hpres : 0 ≤ Ppres) (hE : 0 ≤ E) + (hPτ : 0 ≤ Pτ) (hPK : 0 ≤ PK) (hPF : 0 ≤ PF) + (hτ : 0 < τ) (hτinv : τ⁻¹ ≤ Real.exp Pτ) + (hforward : ∀ j, (forward j : ℝ) ≤ Real.exp PF) + (hK : (K : ℝ) ≤ Real.exp PK) (hr : 1 ≤ r) : + let q := actualFixedSpatialForecastLogs m Dmod d P D pcap Pscale Pbad Ppres E Pτ PK PF + ∃ (T : ℕ) (δ : ℝ), + ActualFixedSpatialPreparedCertificate (X := X) (J := J) B hδslice forward K r + τ hτ Dmod d P D Pbad Ppres E q T δ := by + intro q + obtain ⟨T, δ, hT, hTv, hδ, hδ1, hδb, hbounds⟩ := + exists_actualFixedSpatialPreparedParameters Dmod d B hP hδslice hδsliceInv hX hblocks + forward K r hD hDP haxes hdim hpcap hscale hbad hpres hE hPτ hPK hPF + hτ hτinv hforward hK hr + exact ⟨T, δ, hT, hTv, hδ, hδ1, hδb, hbounds⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialRetainedModulusBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialRetainedModulusBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e90034d25208164abb3f3571ddedc6b08947a13 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialRetainedModulusBudget.lean @@ -0,0 +1,326 @@ +import OAI.Combinatorics.Progressions.Lattices.ActualFixedSpatialGoodPrimeDeletion + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem crtPolynomialInputLaw_integerLong_density_of_output + {L V Inactive Out : Type*} [Fintype L] [Fintype V] [Fintype Out] [DecidableEq Out] + (p A e : L → ℕ) [∀ l, NeZero (p l)] + (hq : Pairwise (fun l k => (p l ^ A l).Coprime (p k ^ A k))) + (origin : ∀ l, V → ZMod (p l ^ A l)) + (poly : Out → MvPolynomial (V ⊕ Inactive) ℤ) (inactive : Inactive → ℤ) + (Y : (∀ l, V → ZMod (p l ^ A l)) → Out → ℤ) + (hY : ∀ x j, Y x j = MvPolynomial.eval + (Sum.elim (fun v => ((prescribedCRTPolynomialInput p A e hq origin x v).val : ℤ)) + inactive) (poly j)) + (β : Out → ZMod (∏ l, p l ^ A l)) : + letI : NeZero (∏ l, p l ^ A l) := + ⟨Finset.prod_ne_zero_iff.mpr (fun l _ => pow_ne_zero _ (NeZero.ne (p l)))⟩ + rationalOutputDensity (crtPolynomialInputLaw p A e hq origin) + (integerLongPolynomialOutput poly inactive (∏ l, p l ^ A l)) (∏ l, p l ^ A l) β = + rationalOutputDensity (crtPrimePowerPolynomialLaw (V := V) p A) Y (∏ l, p l ^ A l) β := by + let : NeZero (∏ l, p l ^ A l) := + ⟨Finset.prod_ne_zero_iff.mpr (fun l _ => pow_ne_zero _ (NeZero.ne (p l)))⟩ + unfold rationalOutputDensity finiteImageMass crtPolynomialInputLaw + rw [FiniteProbabilityWeights.fiberLaw_mean] + congr 1 + apply congrArg (crtPrimePowerPolynomialLaw (V := V) p A).mean + funext x + have heq : (fun j => (integerLongPolynomialOutput poly inactive (∏ l, p l ^ A l) + (prescribedCRTPolynomialInput p A e hq origin x) j : ZMod (∏ l, p l ^ A l))) = + fun j => (Y x j : ZMod (∏ l, p l ^ A l)) := by + funext j + exact congrArg (fun a : ℤ => (a : ZMod (∏ l, p l ^ A l))) (hY x j).symm + dsimp only + simp only [heq] + +namespace VectorPolynomial +open _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice P Pbad Ppres : ℝ} + +namespace ActualFixedSpatialForecastPath + +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +@[instance_reducible] noncomputable def retainedLabelDecidableEq (cutoff : ℕ) : + DecidableEq (path.referenceRetainedPrimes cutoff) := Classical.decEq _ + +attribute [local instance] retainedLabelDecidableEq + +noncomputable def referenceRetainedCRTModulus (cutoff : ℕ) : ℕ := + ∏ p : path.referenceRetainedPrimes cutoff, p.val.val ^ path.exponent p.val.val + +omit [Fintype Tsp] in +theorem referenceRetainedCRTModulus_eq (cutoff : ℕ) : + path.referenceRetainedCRTModulus cutoff = path.referenceRetainedModulus cutoff := by + exact Finset.prod_coe_sort (path.referenceRetainedPrimes cutoff) + (fun p : path.primes => p.val ^ path.exponent p.val) + +omit [Fintype Tsp] in +theorem referenceRetainedCRTModulus_dvd (cutoff : ℕ) : + path.referenceRetainedCRTModulus cutoff ∣ path.referenceModulus := by + rw [path.referenceRetainedCRTModulus_eq] + exact path.referenceRetainedModulus_dvd cutoff + +local instance smallReferencePrimeNeZero : ∀ p : path.primes, NeZero p.val := + path.primeNeZero + +local instance smallReferenceModulusNeZero (cutoff : ℕ) : + NeZero (path.referenceRetainedCRTModulus cutoff) := + ⟨by rw [path.referenceRetainedCRTModulus_eq]; exact (path.referenceRetainedModulus_pos cutoff).ne'⟩ + +noncomputable def referenceRetainedCRTInputLaw (cutoff : ℕ) : FiniteProbabilityWeights + (LayerSamplerLongVariables (allocatedShortAxis (I := I) U b S.value) G B → + ZMod (path.referenceRetainedCRTModulus cutoff)) := + crtPolynomialInputLaw (fun p : path.referenceRetainedPrimes cutoff => p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.exponent p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.prescribed p.val.val) + (primePower_crt_coprime (fun p : path.referenceRetainedPrimes cutoff => p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.exponent p.val.val) + (fun p => path.prime p.val.val p.val.property) + (Subtype.val_injective.comp Subtype.val_injective)) (fun p => path.origin p.val) + +omit [Fintype Tsp] in + +theorem referenceRetainedCRT_density_eq (cutoff : ℕ) + (raw : PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod (path.referenceRetainedCRTModulus cutoff)) : + rationalOutputDensity (path.referenceRetainedCRTInputLaw cutoff) + (integerLongPolynomialOutput path.referencePolynomial raw + (path.referenceRetainedCRTModulus cutoff)) (path.referenceRetainedCRTModulus cutoff) β = + rationalOutputDensity + (crtPrimePowerPolynomialLaw + (V := LayerSamplerLongVariables (allocatedShortAxis (I := I) U b S.value) G B) + (fun p : path.referenceRetainedPrimes cutoff => p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.exponent p.val.val)) + (crtPrimePowerIntegerPolynomialOutput + (fun p : path.referenceRetainedPrimes cutoff => p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.exponent p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.prescribed p.val.val) + (primePower_crt_coprime (fun p : path.referenceRetainedPrimes cutoff => p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.exponent p.val.val) + (fun p => path.prime p.val.val p.val.property) + (Subtype.val_injective.comp Subtype.val_injective)) + (path.localReferencePolynomial raw) (fun p => path.origin p.val)) + (path.referenceRetainedCRTModulus cutoff) β := by + apply crtPolynomialInputLaw_integerLong_density_of_output + intro x o + simpa only [crtPrimePowerIntegerPolynomialOutput, prescribedCRTPolynomialInput, + localReferencePolynomial, referencePolynomial, allocatedForecastPolynomial] using + (allocatedSeparatedCongruencePolynomial_eval (allocatedShortAxis (I := I) U b S.value) + o.1 path.base path.noise (allocatedReadDeck path.read) + (fun a => allocatedReadProjection path.read ⟨o.1, a.val⟩) o.2 _ raw).symm + +noncomputable def retainedCRTReferenceForecast {Ω Z : Type*} [Fintype Ω] + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (cutoff : ℕ) (gridVolume : ℝ) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : ℝ := + rationalInactiveForecast inactive (fun _ => path.referenceRetainedCRTInputLaw cutoff) gridPoint + (fun i => integerLongPolynomialOutput path.referencePolynomial (raw i) + (path.referenceRetainedCRTModulus cutoff)) + (path.referenceRetainedCRTModulus cutoff) gridVolume z + (fun j => ZMod.castHom (path.referenceRetainedCRTModulus_dvd cutoff) + (ZMod (path.referenceRetainedCRTModulus cutoff)) (β j)) + +noncomputable def retainedCRTIndependentForecast {Ω Z : Type*} [Fintype Ω] + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (cutoff : ℕ) (gridVolume : ℝ) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : ℝ := + rationalInactiveForecast inactive + (fun _ => crtPrimePowerPolynomialLaw + (V := LayerSamplerLongVariables (allocatedShortAxis (I := I) U b S.value) G B) + (fun p : path.referenceRetainedPrimes cutoff => p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.exponent p.val.val)) gridPoint + (fun i => crtPrimePowerIntegerPolynomialOutput + (fun p : path.referenceRetainedPrimes cutoff => p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.exponent p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.prescribed p.val.val) + (primePower_crt_coprime (fun p : path.referenceRetainedPrimes cutoff => p.val.val) + (fun p : path.referenceRetainedPrimes cutoff => path.exponent p.val.val) + (fun p => path.prime p.val.val p.val.property) + (Subtype.val_injective.comp Subtype.val_injective)) + (path.localReferencePolynomial (raw i)) (fun p => path.origin p.val)) + (path.referenceRetainedCRTModulus cutoff) gridVolume z + (fun j => ZMod.castHom (path.referenceRetainedCRTModulus_dvd cutoff) + (ZMod (path.referenceRetainedCRTModulus cutoff)) (β j)) + +omit [Fintype Tsp] in +theorem retainedCRTIndependentForecast_eq {Ω Z : Type*} [Fintype Ω] + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (cutoff : ℕ) (gridVolume : ℝ) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : + path.retainedCRTIndependentForecast inactive gridPoint raw cutoff gridVolume z β = + path.retainedReferenceForecast inactive gridPoint raw cutoff gridVolume z β := by + dsimp only [retainedCRTIndependentForecast, retainedReferenceForecast, + referenceLocalDensity, referenceRetainedCRTModulus] + have h := crt_integer_polynomial_retained_inactive_density_product inactive gridPoint + (fun p : path.primes => p.val) (fun p : path.primes => path.exponent p.val) + (fun p : path.primes => path.prescribed p.val) + (primePower_crt_coprime (fun p : path.primes => p.val) + (fun p : path.primes => path.exponent p.val) + (fun p => path.prime p.val p.property) Subtype.val_injective) + (fun i => path.localReferencePolynomial (raw i)) (fun _ => path.origin) + (path.referenceRetainedPrimes cutoff) gridVolume z β + dsimp only at h + simp only [rationalInactiveForecast, rationalOutputDensity, ← Nat.card_eq_fintype_card] at h ⊢ + exact h + +omit [Fintype Tsp] in +theorem retainedCRTReferenceForecast_eq_independent {Ω Z : Type*} [Fintype Ω] + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (cutoff : ℕ) (gridVolume : ℝ) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : + path.retainedCRTReferenceForecast inactive gridPoint raw cutoff gridVolume z β = + path.retainedCRTIndependentForecast inactive gridPoint raw cutoff gridVolume z β := by + unfold retainedCRTReferenceForecast retainedCRTIndependentForecast rationalInactiveForecast + congr 1 + apply congrArg (inactive.fiberMean gridPoint z) + funext i + exact path.referenceRetainedCRT_density_eq cutoff (raw i) _ + +omit [Fintype Tsp] in + +theorem retainedCRTReferenceForecast_eq {Ω Z : Type*} [Fintype Ω] + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (cutoff : ℕ) (gridVolume : ℝ) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : + path.retainedCRTReferenceForecast inactive gridPoint raw cutoff gridVolume z β = + path.retainedReferenceForecast inactive gridPoint raw cutoff gridVolume z β := + (path.retainedCRTReferenceForecast_eq_independent inactive gridPoint raw cutoff gridVolume z β).trans + (path.retainedCRTIndependentForecast_eq inactive gridPoint raw cutoff gridVolume z β) + +omit [Fintype Tsp] in +theorem referenceRetainedCRTModulus_pos (cutoff : ℕ) : + 0 < path.referenceRetainedCRTModulus cutoff := by + rw [path.referenceRetainedCRTModulus_eq] + exact path.referenceRetainedModulus_pos cutoff + +local instance retainedFullReferenceModulusNeZero : NeZero path.referenceModulus := + ⟨path.referenceModulus_pos.ne'⟩ + +omit [Fintype Tsp] in + +theorem reference_inactive_goodPrimeDeletion_retainedCRT {Ω Z : Type*} [Fintype Ω] + (hm : 0 < m) + (hD : Fintype.card X + ∑ j : Fin m, (Fintype.card (Eout j) + n j) ≤ Dmod) + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (cutoff : ℕ) (hcutoff : 0 < cutoff) (hsmall : 2 / (cutoff : ℝ) ≤ 1 / 2) + {δ : ℝ} (hδ : 0 ≤ δ) (haccuracy : 4 / (cutoff : ℝ) ≤ δ) + (gridVolume : ℝ) (hvolume : 0 ≤ gridVolume) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : + let full := rationalInactiveForecast inactive (fun _ => path.referenceInputLaw) gridPoint + (fun i => integerLongPolynomialOutput path.referencePolynomial (raw i) path.referenceModulus) + path.referenceModulus gridVolume z β + let truncated := path.retainedCRTReferenceForecast inactive gridPoint raw cutoff gridVolume z β + (1 - δ) * truncated ≤ full ∧ full ≤ (1 + δ) * truncated := by + dsimp only + rw [path.retainedCRTReferenceForecast_eq] + exact path.reference_inactive_goodPrimeDeletion hm hD inactive gridPoint raw + cutoff hcutoff hsmall hδ haccuracy gridVolume hvolume z β + +end ActualFixedSpatialForecastPath +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice P Pbad Ppres : ℝ} + +namespace ActualFixedSpatialForecastPath + +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +omit [Fintype Tsp] in + +theorem referenceRetainedCRTModulus_log_le_tested (cutoff : ℕ) + {Ptest : ℝ} (hPtest : 0 ≤ Ptest) + (hexponent : ∀ p : path.primes, + path.exponent p.val ≤ Nat.log p.val ⌈Real.exp (2 * Ptest)⌉₊) : + Real.log (path.referenceRetainedCRTModulus cutoff : ℝ) ≤ + (4 * Ptest + 2) * + (Pbad + Ppres + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1)) := by + obtain ⟨depth, hdepth, hprime⟩ := exists_testedPrimeDepth hPtest + rw [path.referenceRetainedCRTModulus_eq] + exact path.referenceRetainedModulus_log_le cutoff depth + (fun p => (hexponent p).trans (hprime p.val (path.prime p.val p.property))) + (4 * Ptest + 2) hdepth + +omit [Fintype Tsp] in + +theorem referenceRetainedCRTModulus_le_exp_tested (cutoff : ℕ) + {Ptest : ℝ} (hPtest : 0 ≤ Ptest) + (hexponent : ∀ p : path.primes, + path.exponent p.val ≤ Nat.log p.val ⌈Real.exp (2 * Ptest)⌉₊) : + (path.referenceRetainedCRTModulus cutoff : ℝ) ≤ + Real.exp ((4 * Ptest + 2) * + (Pbad + Ppres + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1))) := by + exact (Real.log_le_iff_le_exp + (Nat.cast_pos.mpr (path.referenceRetainedCRTModulus_pos cutoff))).mp + (path.referenceRetainedCRTModulus_log_le_tested cutoff hPtest hexponent) + +end ActualFixedSpatialForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialRetainedPatchEndpoint.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialRetainedPatchEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..187a63a204c15af5fdcd3f57864204859fbfca5b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialRetainedPatchEndpoint.lean @@ -0,0 +1,896 @@ +import OAI.Combinatorics.Progressions.Estimates.RelativePatchRecoveredEndpoint +import OAI.Combinatorics.Progressions.Sampling.ActualFixedSpatialBufferedScore +import OAI.Combinatorics.Progressions.Sampling.NativeMarkedFreezingSliceScore + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal +open BoxProgressionPartition + +theorem exists_spatially_frozen_slice {ι : Type*} [Fintype ι] [DecidableEq ι] + (N : ι → ℕ) (hN : ∀ i, 0 < N i) (q : ℕ) (hq : 0 < q) + (score : (∀ i, Fin (N i)) → ℝ) (F : (ι → ℝ) → (∀ i, Fin (N i)) → ℝ) + (Λ : ℝ≥0) (hF : ∀ x, LipschitzWith Λ (fun z => F z x)) + {C τ ρ θ S : ℝ} (hC : 0 ≤ C) (hτ : 0 ≤ τ) (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) (hθ : 0 < θ) + (hscoreBound : ∀ x, |score x| ≤ 1) + (hcap : ∀ x, F (normalizedPoint x) x ∈ Set.Icc (0 : ℝ) C) + (hlarge : ∀ i, 2 * (q : ℝ) ≤ ρ * N i) + (hscore : S ≤ 𝔼 x, score x * F (normalizedPoint x) x) + (hbudget : τ + Λ * ρ + C * θ < S) : + ∃ A : ResidueBoxSlice N q, + (∀ i, θ * ρ * N i / (4 * q * (Fintype.card ι + 1)) ≤ (A.length i : ℝ)) ∧ + (∀ i, 0 < A.length i) ∧ + τ < 𝔼 j : (∀ i, Fin (A.length i)), score (A.point j) * F A.center (A.point j) := by + obtain ⟨H, hH, hfit, hwidth, hlower⟩ := exists_box_block_mesh N q hq hρ hρ1 hlarge + let P := fun i => FiniteProgressionPartition.blocks (N i) q (H i) hq (hH i) + let L : ι → ℝ := fun i => θ * H i / (2 * (Fintype.card ι + 1)) + have hL (i) : 0 ≤ L i := by dsimp only [L]; positivity + have hsmall : (∑ i, (Fintype.card (P i).Label : ℝ) * L i / N i) ≤ θ := + boxBlock_short_side_budget N H q hN hH hfit hθ.le + have hwidthP (a : ∀ i, (P i).Label) (i) : + ((P i).step (a i) : ℝ) * (P i).length (a i) ≤ ρ * N i := by + have hlen : ((P i).length (a i) : ℝ) ≤ H i := by + exact_mod_cast truncatedProgressionLength_le (N i) (progressionBlockStart (a i)) q (H i) + exact (mul_le_mul_of_nonneg_left hlen (Nat.cast_nonneg q)).trans (hwidth i) + obtain ⟨a, ha, hs⟩ := exists_long_spatially_frozen_box P hN L hL score F Λ hF hC hτ hρ.le + hscoreBound hcap hwidthP hscore + ((add_le_add le_rfl (mul_le_mul_of_nonneg_left hsmall hC)).trans_lt hbudget) + let A := ResidueBoxSlice.ofBlocks H hq hH a + have hlen (i) : θ * ρ * N i / (4 * q * (Fintype.card ι + 1)) ≤ (A.length i : ℝ) := by + apply le_trans _ (ha i) + dsimp only [L] + calc + _ = θ * (ρ * N i / (2 * q)) / (2 * (Fintype.card ι + 1)) := by + have hq0 : (q : ℝ) ≠ 0 := by exact_mod_cast hq.ne' + have hn0 : (Fintype.card ι : ℝ) + 1 ≠ 0 := by positivity + field_simp + ring + _ ≤ _ := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (hlower i) hθ.le) (by positivity) + refine ⟨A, hlen, ?_, ?_⟩ + · intro i + have hp : (0 : ℝ) < θ * ρ * N i / (4 * q * (Fintype.card ι + 1)) := by + have hNi : (0 : ℝ) < N i := by exact_mod_cast hN i + have hqi : (0 : ℝ) < q := by exact_mod_cast hq + positivity + exact_mod_cast hp.trans_le (hlen i) + · have hcenter : A.center = normalizedStart P a := rfl + have hpoint (j : ∀ i, Fin (A.length i)) : A.point j = point P a j := + ResidueBoxSlice.ofBlocks_point H hq hH a j + simpa only [hcenter, hpoint] using hs + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal BigOperators + +noncomputable def bufferedSpatialWeight {Ω Θ : Type*} {m : ℕ} + (χ : PatchKernel m) (x : Ω → Fin m → ℝ) (T : Ω → (Fin m → ℤ) → ℝ) + (G : Θ → Ω → (Fin m → ℤ) → ℝ) (z : Θ) (u : Ω) : ℝ := + ∑' b, χ.value (fun i => x u i - (b i : ℝ)) * G z u b * T u b + +theorem bufferedSpatialWeight_eq_nearest {Ω Θ : Type*} {m : ℕ} + (χ : PatchKernel m) (x : Ω → Fin m → ℝ) (T : Ω → (Fin m → ℤ) → ℝ) + (G : Θ → Ω → (Fin m → ℤ) → ℝ) (z : Θ) (u : Ω) : + bufferedSpatialWeight χ x T G z u = + χ.value (fun i => x u i - (nearestIntegerLift (x u) i : ℝ)) * + G z u (nearestIntegerLift (x u)) * T u (nearestIntegerLift (x u)) := by + simpa only [bufferedSpatialWeight, mul_assoc] using + χ.buffered_sum_eq_nearest (x u) (fun b => G z u b * T u b) + +theorem bufferedSpatialWeight_mem_Icc {Ω Θ : Type*} {m : ℕ} + (χ : PatchKernel m) (x : Ω → Fin m → ℝ) (T : Ω → (Fin m → ℤ) → ℝ) + (G : Θ → Ω → (Fin m → ℤ) → ℝ) {C : ℝ} + (hT : ∀ u b, T u b ∈ Set.Icc (0 : ℝ) 1) + (hG : ∀ z u b, G z u b ∈ Set.Icc (0 : ℝ) C) (z : Θ) (u : Ω) : + bufferedSpatialWeight χ x T G z u ∈ Set.Icc (0 : ℝ) C := by + rw [bufferedSpatialWeight_eq_nearest] + have ht := hT u (nearestIntegerLift (x u)) + have hg := hG z u (nearestIntegerLift (x u)) + constructor + · exact mul_nonneg (mul_nonneg (χ.nonneg _) hg.1) ht.1 + · calc + _ = (χ.value _ * T u (nearestIntegerLift (x u))) * G z u (nearestIntegerLift (x u)) := by ring + _ ≤ G z u (nearestIntegerLift (x u)) := + mul_le_of_le_one_left hg.1 ((mul_le_of_le_one_left ht.1 (χ.le_one _)).trans ht.2) + _ ≤ C := hg.2 + +theorem bufferedSpatialWeight_lipschitz {Ω Θ : Type*} [PseudoMetricSpace Θ] {m : ℕ} + (χ : PatchKernel m) (x : Ω → Fin m → ℝ) (T : Ω → (Fin m → ℤ) → ℝ) + (G : Θ → Ω → (Fin m → ℤ) → ℝ) (Λ : ℝ≥0) + (hT : ∀ u b, T u b ∈ Set.Icc (0 : ℝ) 1) + (hG : ∀ u b, LipschitzWith Λ (fun z => G z u b)) (u : Ω) : + LipschitzWith Λ (fun z => bufferedSpatialWeight χ x T G z u) := by + apply LipschitzWith.of_dist_le_mul + intro z w + rw [bufferedSpatialWeight_eq_nearest, bufferedSpatialWeight_eq_nearest, Real.dist_eq] + let b := nearestIntegerLift (x u) + let c := χ.value (fun i => x u i - (b i : ℝ)) * T u b + have hc0 : 0 ≤ c := mul_nonneg (χ.nonneg _) (hT u b).1 + have hc1 : c ≤ 1 := (mul_le_of_le_one_left (hT u b).1 (χ.le_one _)).trans (hT u b).2 + have heq : χ.value (fun i => x u i - (b i : ℝ)) * G z u b * T u b - + χ.value (fun i => x u i - (b i : ℝ)) * G w u b * T u b = c * (G z u b - G w u b) := by + dsimp only [c] + ring + change |χ.value _ * G z u b * T u b - χ.value _ * G w u b * T u b| ≤ _ + rw [heq, abs_mul, abs_of_nonneg hc0] + exact (mul_le_of_le_one_left (abs_nonneg _) hc1).trans + (by simpa only [Real.dist_eq] using (hG u b).dist_le_mul z w) + +theorem exists_spatially_frozen_buffered_slice {ι : Type*} [Fintype ι] [DecidableEq ι] + (N : ι → ℕ) (hN : ∀ i, 0 < N i) (q : ℕ) (hq : 0 < q) {m : ℕ} + (χ : PatchKernel m) (x : (∀ i, Fin (N i)) → Fin m → ℝ) + (T : (∀ i, Fin (N i)) → (Fin m → ℤ) → ℝ) + (G : (ι → ℝ) → (∀ i, Fin (N i)) → (Fin m → ℤ) → ℝ) + (score : (∀ i, Fin (N i)) → ℝ) (Λ : ℝ≥0) + (hT : ∀ u b, T u b ∈ Set.Icc (0 : ℝ) 1) + (hG : ∀ u b, LipschitzWith Λ (fun z => G z u b)) + {C τ ρ θ S : ℝ} (hC : 0 ≤ C) (hτ : 0 ≤ τ) (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) (hθ : 0 < θ) + (hGcap : ∀ z u b, G z u b ∈ Set.Icc (0 : ℝ) C) + (hscoreBound : ∀ u, |score u| ≤ 1) (hlarge : ∀ i, 2 * (q : ℝ) ≤ ρ * N i) + (hscore : S ≤ 𝔼 u, score u * bufferedSpatialWeight χ x T G (BoxProgressionPartition.normalizedPoint u) u) + (hbudget : τ + Λ * ρ + C * θ < S) : + ∃ A : ResidueBoxSlice N q, + (∀ i, θ * ρ * N i / (4 * q * (Fintype.card ι + 1)) ≤ (A.length i : ℝ)) ∧ + (∀ i, 0 < A.length i) ∧ + τ < 𝔼 j : (∀ i, Fin (A.length i)), + score (A.point j) * bufferedSpatialWeight χ x T G A.center (A.point j) := by + exact exists_spatially_frozen_slice N hN q hq score (bufferedSpatialWeight χ x T G) Λ + (bufferedSpatialWeight_lipschitz χ x T G Λ hT hG) hC hτ hρ hρ1 hθ hscoreBound + (fun u => bufferedSpatialWeight_mem_Icc χ x T G hT hGcap _ u) hlarge hscore hbudget + +end Erdos3 + +end + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped NNReal BigOperators + +theorem ResidueBoxSlice.point_cast {ι : Type*} {N : ι → ℕ} {q : ℕ} + (A : ResidueBoxSlice N q) (j : ∀ i, Fin (A.length i)) : + (fun i => ((A.point j i).val : ZMod q)) = fun i => (A.start i : ZMod q) := by + funext i + simp [ResidueBoxSlice.point] + +theorem exists_spatially_localized_patch {ι σ : Type*} [Fintype ι] [DecidableEq ι] + (N : ι → ℕ) (hN : ∀ i, 0 < N i) (q₀ : ℕ) (hq₀ : 0 < q₀) {s d E m : ℕ} + (w : Fin d → ℕ) (hw : ∀ j, 1 ≤ w j) (hws : ∀ j, w j ≤ s) (hmono : Monotone w) + (P : Fin d → MvPolynomial σ ℝ) (hP : ∀ j, P j ∈ weightedSupportLE (fun _ : σ => 1) (w j)) + (p : Fin m → ℕ) (B : WeightedParameterPatch (σ ⊕ Fin m) (Sum.elim (fun _ => 1) p) s E) + (χ : PatchKernel m) (M : Fin m → Fin d → ℤ) (K : ℝ≥0) + (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) (hweight : ∀ i j, M i j ≠ 0 → w j ≤ p i) + (G : (ι → ℝ) → (ι → ZMod q₀) → (Fin m → ℤ) → (Fin m → ℝ) → ℝ) + (Λ L C : ℝ≥0) (hC : 1 ≤ C) + (hGspace : ∀ r b y, LipschitzWith Λ (fun z => G z r b y)) + (hGlift : ∀ z r b, LipschitzWith L (G z r b)) + (hGcap : ∀ z r b y, G z r b y ∈ Set.Icc (0 : ℝ) C) + (hinvariant : ∀ z r c k, G z r (recoveredIntegerLift M c k) = G z r c) + (q : ℕ) (hq : 8 ≤ q) (hmesh : 16 * (K : ℝ) ≤ q) + (t : (∀ i, Fin (N i)) → σ → ℝ) (score : (∀ i, Fin (N i)) → ℝ) + {τ ρ θ S : ℝ} (hτ : 0 ≤ τ) (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) (hθ : 0 < θ) + (hscoreBound : ∀ u, |score u| ≤ 1) (hlarge : ∀ i, 2 * (q₀ : ℝ) ≤ ρ * N i) + (hscore : S ≤ 𝔼 u, score u * ∑' b : Fin m → ℤ, + χ.value (fun i => realIntegerMatrix M (fun j => aeval (t u) (P j)) i - (b i : ℝ)) * + G (BoxProgressionPartition.normalizedPoint u) (fun i => ((u i).val : ZMod q₀)) b + (fun i => realIntegerMatrix M (fun j => aeval (t u) (P j)) i - (b i : ℝ)) * + B.value (Sum.elim (t u) (fun i => (b i : ℝ)))) + (hbudget : τ + Λ * ρ + C * θ < S) : + ∃ (A : ResidueBoxSlice N q₀) (Q : PolynomialPatch σ s (d + E)), + (∀ i, θ * ρ * N i / (4 * q₀ * (Fintype.card ι + 1)) ≤ (A.length i : ℝ)) ∧ + (∀ i, 0 < A.length i) ∧ + Q.kernel.lip ≤ (q : ℝ≥0) * (2 * (q : ℝ≥0) ^ d + 1) + + (χ.lip + L / C) * K + B.kernel.lip ∧ + τ / ((C : ℝ) * (q : ℝ) ^ d) ≤ + 𝔼 j : (∀ i, Fin (A.length i)), score (A.point j) * Q.value (t (A.point j)) := by + let x : (∀ i, Fin (N i)) → Fin m → ℝ := + fun u => realIntegerMatrix M (fun j => aeval (t u) (P j)) + let T : (∀ i, Fin (N i)) → (Fin m → ℤ) → ℝ := + fun u b => B.value (Sum.elim (t u) (fun i => (b i : ℝ))) + let W : (ι → ℝ) → (∀ i, Fin (N i)) → (Fin m → ℤ) → ℝ := + fun z u b => G z (fun i => ((u i).val : ZMod q₀)) b (fun i => x u i - (b i : ℝ)) + obtain ⟨A, hlength, hpos, hs⟩ := exists_spatially_frozen_buffered_slice N hN q₀ hq₀ χ x T W + score Λ (fun u b => B.value_mem_Icc _) (fun u b => hGspace _ _ _) C.coe_nonneg hτ hρ hρ1 hθ + (fun z u b => hGcap _ _ _ _) hscoreBound hlarge hscore hbudget + let F := G A.center (fun i => (A.start i : ZMod q₀)) + have hlocalized : τ ≤ 𝔼 j : (∀ i, Fin (A.length i)), score (A.point j) * ∑' b : Fin m → ℤ, + χ.value (fun i => x (A.point j) i - (b i : ℝ)) * + F b (fun i => x (A.point j) i - (b i : ℝ)) * T (A.point j) b := by + apply hs.le.trans_eq + apply Finset.expect_congr rfl + intro j _ + apply congrArg (fun a => score (A.point j) * a) + apply tsum_congr + intro b + change χ.value _ * G A.center (fun i => ((A.point j i).val : ZMod q₀)) b _ * _ = _ + rw [A.point_cast j] + obtain ⟨Q, hQlip, hQscore⟩ := exists_fiberwise_weighted_patch w hw hws hmono P hP p B χ F L C hC + (hGlift A.center _) (hGcap A.center _) M K hM hweight (hinvariant A.center _) q hq hmesh + (fun j => t (A.point j)) (fun j => score (A.point j)) hlocalized + exact ⟨A, Q, hlength, hpos, hQlip, hQscore⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def spatialPatchExtractionCost (L : ℝ) : ℝ := 20 * (L + 1) ^ 2 + +private theorem extraction_exp_two {L : ℝ} (hL : 1 ≤ L) : 2 ≤ Real.exp L := by + linarith only [hL, Real.add_one_le_exp L] + +private theorem extraction_exp_four {L : ℝ} (hL : 1 ≤ L) : 4 ≤ Real.exp (2 * L) := by + have h := extraction_exp_two hL + have he : Real.exp (2 * L) = Real.exp L * Real.exp L := by + rw [← Real.exp_add] + congr 1 + ring + rw [he] + nlinarith + +theorem spatialPatchExtraction_radius {L : ℝ} (hL : 1 ≤ L) : + 0 < Real.exp (-4 * L) ∧ Real.exp (-4 * L) ≤ 1 := by + exact ⟨Real.exp_pos _, Real.exp_le_one_iff.mpr (by linarith)⟩ + +theorem spatialPatchExtraction_strict_budget {L Λ C S : ℝ} + (hL : 1 ≤ L) (hΛ : Λ ≤ Real.exp L) (hC : C ≤ Real.exp L) + (hS : Real.exp (-L) ≤ S) : + Real.exp (-3 * L) + Λ * Real.exp (-4 * L) + C * Real.exp (-4 * L) < S := by + have hprod : Real.exp L * Real.exp (-4 * L) = Real.exp (-3 * L) := by + rw [← Real.exp_add] + congr 1 + ring + have hΛ' : Λ * Real.exp (-4 * L) ≤ Real.exp (-3 * L) := by + rw [← hprod] + exact mul_le_mul_of_nonneg_right hΛ (Real.exp_nonneg _) + have hC' : C * Real.exp (-4 * L) ≤ Real.exp (-3 * L) := by + rw [← hprod] + exact mul_le_mul_of_nonneg_right hC (Real.exp_nonneg _) + have he : Real.exp (2 * L) * Real.exp (-3 * L) = Real.exp (-L) := by + rw [← Real.exp_add] + congr 1 + ring + have hh := mul_le_mul_of_nonneg_right (extraction_exp_four hL) (Real.exp_nonneg (-3 * L)) + rw [he] at hh + have hp := Real.exp_pos (-3 * L) + linarith + +theorem spatialPatchExtraction_side_lower {L : ℝ} (hL : 1 ≤ L) + (q₀ n : ℕ) (hq₀ : 0 < q₀) (hq₀bound : (q₀ : ℝ) ≤ Real.exp L) + (hn : (n : ℝ) ≤ L) : + Real.exp (-spatialPatchExtractionCost L) ≤ + Real.exp (-4 * L) * Real.exp (-4 * L) / (4 * (q₀ : ℝ) * (n + 1)) := by + have hdenpos : 0 < 4 * (q₀ : ℝ) * (n + 1) := by positivity + have hnexp : (n : ℝ) + 1 ≤ Real.exp L := by + linarith only [hn, Real.add_one_le_exp L] + have hden : 4 * (q₀ : ℝ) * (n + 1) ≤ Real.exp (4 * L) := by + calc + _ ≤ Real.exp (2 * L) * Real.exp L * Real.exp L := by + exact mul_le_mul (mul_le_mul (extraction_exp_four hL) hq₀bound + (by positivity) (Real.exp_nonneg _)) hnexp (by positivity) (by positivity) + _ = Real.exp (4 * L) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + have hcost : 12 * L ≤ spatialPatchExtractionCost L := by + unfold spatialPatchExtractionCost + nlinarith [sq_nonneg L] + have hbase : Real.exp (-12 * L) ≤ + Real.exp (-4 * L) * Real.exp (-4 * L) / (4 * (q₀ : ℝ) * (n + 1)) := by + apply (le_div_iff₀ hdenpos).mpr + calc + _ ≤ Real.exp (-12 * L) * Real.exp (4 * L) := + mul_le_mul_of_nonneg_left hden (Real.exp_nonneg _) + _ = Real.exp (-4 * L) * Real.exp (-4 * L) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + exact (Real.exp_le_exp.mpr (by linarith : -spatialPatchExtractionCost L ≤ -12 * L)).trans hbase + +theorem spatialPatchExtraction_large {L N : ℝ} (hL : 1 ≤ L) + (q₀ : ℕ) (hq₀ : (q₀ : ℝ) ≤ Real.exp L) + (hN : Real.exp (spatialPatchExtractionCost L) ≤ N) : + 2 * (q₀ : ℝ) ≤ Real.exp (-4 * L) * N := by + have hcost : 6 * L ≤ spatialPatchExtractionCost L := by + unfold spatialPatchExtractionCost + nlinarith [sq_nonneg L] + calc + _ ≤ 2 * Real.exp L := mul_le_mul_of_nonneg_left hq₀ (by norm_num) + _ ≤ Real.exp L * Real.exp L := + mul_le_mul_of_nonneg_right (extraction_exp_two hL) (Real.exp_nonneg L) + _ = Real.exp (2 * L) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ Real.exp (-4 * L + spatialPatchExtractionCost L) := + Real.exp_le_exp.mpr (by linarith) + _ = Real.exp (-4 * L) * Real.exp (spatialPatchExtractionCost L) := Real.exp_add _ _ + _ ≤ _ := mul_le_mul_of_nonneg_left hN (Real.exp_nonneg _) + +theorem spatialPatchExtraction_gain_lower {L C : ℝ} (hL : 1 ≤ L) + (hCpos : 0 < C) (hC : C ≤ Real.exp L) (q d : ℕ) (hq : 0 < q) + (hqd : (q : ℝ) ^ d ≤ Real.exp (6 * L ^ 2)) : + Real.exp (-spatialPatchExtractionCost L) ≤ + Real.exp (-3 * L) / (C * (q : ℝ) ^ d) := by + have hdenpos : 0 < C * (q : ℝ) ^ d := by positivity + have hden : C * (q : ℝ) ^ d ≤ Real.exp (L + 6 * L ^ 2) := by + calc + _ ≤ Real.exp L * Real.exp (6 * L ^ 2) := + mul_le_mul hC hqd (by positivity) (Real.exp_nonneg _) + _ = _ := (Real.exp_add _ _).symm + have hcost : 6 * L ^ 2 + 4 * L ≤ spatialPatchExtractionCost L := by + unfold spatialPatchExtractionCost + nlinarith [sq_nonneg L] + have hbase : Real.exp (-(6 * L ^ 2 + 4 * L)) ≤ + Real.exp (-3 * L) / (C * (q : ℝ) ^ d) := by + apply (le_div_iff₀ hdenpos).mpr + calc + _ ≤ Real.exp (-(6 * L ^ 2 + 4 * L)) * Real.exp (L + 6 * L ^ 2) := + mul_le_mul_of_nonneg_left hden (Real.exp_nonneg _) + _ = Real.exp (-3 * L) := by + rw [← Real.exp_add] + congr 1 + ring + exact (Real.exp_le_exp.mpr (by linarith : + -spatialPatchExtractionCost L ≤ -(6 * L ^ 2 + 4 * L))).trans hbase + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem spatialPatchExtractionCost_le_power {p L : ℝ} {a : ℕ} + (hp : 2 ≤ p) (hL : 0 ≤ L) (hbudget : L ≤ (p + 2) ^ a) : + spatialPatchExtractionCost L ≤ (p + 2) ^ (2 * a + 4) := by + have hb : 1 ≤ p + 2 := by linarith + have hpow : 1 ≤ (p + 2) ^ a := one_le_pow₀ hb + have hplus : L + 1 ≤ 2 * (p + 2) ^ a := by linarith + have hfour : (80 : ℝ) ≤ (p + 2) ^ 4 := by + have h := pow_le_pow_left₀ (by norm_num : (0 : ℝ) ≤ 4) + (by linarith : (4 : ℝ) ≤ p + 2) 4 + norm_num at h + linarith + unfold spatialPatchExtractionCost + calc + 20 * (L + 1) ^ 2 ≤ 20 * (2 * (p + 2) ^ a) ^ 2 := + mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (by linarith) hplus 2) (by norm_num) + _ = 80 * ((p + 2) ^ a) ^ 2 := by ring + _ ≤ (p + 2) ^ 4 * ((p + 2) ^ a) ^ 2 := + mul_le_mul_of_nonneg_right hfour (sq_nonneg _) + _ = (p + 2) ^ (2 * a + 4) := by + rw [← pow_mul, ← pow_add] + congr 1 + omega + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem relativePatchSliceScore_reparamPatch {X : Type*} [Fintype X] + {s d q : ℕ} {N : X → ℕ} (S : ResidueBoxSlice N q) + (f : (X → ℤ) → ℝ) (target : ℝ) (A : PolynomialPatch X s d) : + relativePatchSliceScore S f target (S.reparamPatch A) = + (𝔼 j : (∀ i, Fin (S.length i)), + (f (fun i => ((S.point j i).val : ℤ)) - target) * + A.value (fun i => ((S.point j i).val : ℝ))) := by + unfold relativePatchSliceScore + apply Finset.expect_congr rfl + intro j _ + rw [S.reparamPatch_value] + +theorem relativePatchSliceConclusion_of_spatially_localized_patch + {X : Type*} [Fintype X] {s d q rankBound : ℕ} {N : X → ℕ} + (S : ResidueBoxSlice N q) (hq : 0 < q) + (f : (X → ℤ) → ℝ) (target cost gain : ℝ) + (A : PolynomialPatch X s d) (lip : ℝ≥0) + (hrank : d ≤ rankBound) + (hlength : ∀ i, Real.exp (-cost) * (N i : ℝ) ≤ S.length i) + (hlip : A.kernel.lip ≤ lip) + (hbudget : (d : ℝ) + Real.log (1 + (lip : ℝ)) ≤ cost) + (hgain : Real.exp (-cost) ≤ gain) + (hscore : gain ≤ + (𝔼 j : (∀ i, Fin (S.length i)), + (f (fun i => ((S.point j i).val : ℤ)) - target) * + A.value (fun i => ((S.point j i).val : ℝ)))) : + RelativePatchSliceConclusion s N f target rankBound cost := by + refine ⟨q, hq, S, d, S.reparamPatch A, hlength, hrank, ?_, ?_⟩ + · apply le_trans _ hbudget + unfold relativePatchComplexity + rw [S.reparamPatch_kernel] + apply add_le_add le_rfl + apply Real.log_le_log (by positivity) + exact add_le_add le_rfl (show (A.kernel.lip : ℝ) ≤ lip from hlip) + · rw [relativePatchSliceScore_reparamPatch] + exact hgain.trans hscore + +end Erdos3 + +end + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators NNReal Classical + +theorem relativePatchSliceConclusion_of_discounted_spatial_buffered_score + {X : Type*} [Fintype X] [DecidableEq X] (N : X → ℕ) (hN : ∀ i, 0 < N i) + (q₀ : ℕ) (hq₀ : 0 < q₀) {s d E m rankBound : ℕ} + (w : Fin d → ℕ) (hw : ∀ j, 1 ≤ w j) (hws : ∀ j, w j ≤ s) (hmono : Monotone w) + (P : Fin d → MvPolynomial X ℝ) (hP : ∀ j, P j ∈ weightedSupportLE (fun _ : X => 1) (w j)) + (p : Fin m → ℕ) (B : WeightedParameterPatch (X ⊕ Fin m) (Sum.elim (fun _ => 1) p) s E) + (χ : PatchKernel m) (M : Fin m → Fin d → ℤ) (K : ℝ≥0) + (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) (hweight : ∀ i j, M i j ≠ 0 → w j ≤ p i) + (G : (X → ℝ) → (X → ZMod q₀) → (Fin m → ℤ) → (Fin m → ℝ) → ℝ) + (Λ L C : ℝ≥0) (hC : 1 ≤ C) + (hGspace : ∀ r b y, LipschitzWith Λ (fun z => G z r b y)) + (hGlift : ∀ z r b, LipschitzWith L (G z r b)) + (hGcap : ∀ z r b y, G z r b y ∈ Set.Icc (0 : ℝ) C) + (hinvariant : ∀ z r c k, G z r (recoveredIntegerLift M c k) = G z r c) + (q : ℕ) (hq : 8 ≤ q) (hmesh : 16 * (K : ℝ) ≤ q) + (f : (X → ℤ) → ℝ) (hf : ∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) + (full : (∀ i, Fin (N i)) → (Fin m → ℤ) → ℝ) + {lam δ ε gain surplus meshWidth shortLoss cost : ℝ} + (hlam : lam ∈ Set.Icc (0 : ℝ) 1) (hδ : 0 ≤ δ) (hε : ε ∈ Set.Icc (0 : ℝ) 1) + (hdiscount : (1 + δ) * (1 - ε) ≤ 1 - δ) + (hlower : ∀ u β, (1 - δ) * + G (BoxProgressionPartition.normalizedPoint u) (fun i => ((u i).val : ZMod q₀)) β + (fun i => realIntegerMatrix M (fun j => aeval (fun x => ((u x).val : ℝ)) (P j)) i - + (β i : ℝ)) ≤ full u β) + (hupper : ∀ u β, full u β ≤ (1 + δ) * + G (BoxProgressionPartition.normalizedPoint u) (fun i => ((u i).val : ZMod q₀)) β + (fun i => realIntegerMatrix M (fun j => aeval (fun x => ((u x).val : ℝ)) (P j)) i - + (β i : ℝ))) + (hscore : gain ≤ 𝔼 u : (∀ i, Fin (N i)), + (f (fun i => ((u i).val : ℤ)) - lam) * ∑' β : Fin m → ℤ, + χ.value (fun i => realIntegerMatrix M (fun j => aeval (fun x => ((u x).val : ℝ)) (P j)) i - + (β i : ℝ)) * full u β * + B.value (Sum.elim (fun i => ((u i).val : ℝ)) (fun i => (β i : ℝ)))) + (hsurplus : 0 ≤ surplus) (hmeshWidth : 0 < meshWidth) (hmeshWidth1 : meshWidth ≤ 1) + (hshortLoss : 0 < shortLoss) (hlarge : ∀ i, 2 * (q₀ : ℝ) ≤ meshWidth * N i) + (hfreeze : surplus + Λ * meshWidth + C * shortLoss < gain / (1 + δ)) + (hrank : d + E ≤ rankBound) + (hlength : ∀ i, Real.exp (-cost) * (N i : ℝ) ≤ + shortLoss * meshWidth * N i / (4 * q₀ * (Fintype.card X + 1))) + (hbudget : ((d + E : ℕ) : ℝ) + Real.log (1 + + ((q : ℝ≥0) * (2 * (q : ℝ≥0) ^ d + 1) + + (χ.lip + L / C) * K + B.kernel.lip : ℝ≥0)) ≤ cost) + (hgain : Real.exp (-cost) ≤ surplus / ((C : ℝ) * (q : ℝ) ^ d)) : + RelativePatchSliceConclusion s N f ((1 - ε) * lam) rankBound cost := by + let t : (∀ i, Fin (N i)) → X → ℝ := fun u i => ((u i).val : ℝ) + let input : (∀ i, Fin (N i)) → ℝ := fun u => f (fun i => ((u i).val : ℤ)) + let x : (∀ i, Fin (N i)) → Fin m → ℝ := + fun u => realIntegerMatrix M (fun j => aeval (t u) (P j)) + let T := fun (u : ∀ i, Fin (N i)) (β : Fin m → ℤ) => + B.value (Sum.elim (t u) (fun i => (β i : ℝ))) + let reduced := fun (u : ∀ i, Fin (N i)) (β : Fin m → ℤ) => + G (BoxProgressionPartition.normalizedPoint u) (fun i => ((u i).val : ZMod q₀)) β + (fun i => x u i - (β i : ℝ)) + have hinput (u : ∀ i, Fin (N i)) : input u ∈ Set.Icc (0 : ℝ) 1 := + hf _ ((mem_integerBox N _).mpr (fun i => + ⟨by positivity, by exact_mod_cast (u i).isLt⟩)) + have htarget : (1 - ε) * lam ∈ Set.Icc (0 : ℝ) 1 := by + constructor + · exact mul_nonneg (sub_nonneg.mpr hε.2) hlam.1 + · exact (mul_le_of_le_one_left hlam.1 (by linarith only [hε.1])).trans hlam.2 + have hdiscounted := buffered_score_discount χ x T full reduced input hδ + (fun u => (hinput u).1) hlam.1 (fun u β => (B.value_mem_Icc _).1) + (fun u β => (hGcap _ _ _ _).1) hlower hupper hdiscount hscore + obtain ⟨S, Q, hlen, _, hQl, hQs⟩ := exists_spatially_localized_patch N hN q₀ hq₀ + w hw hws hmono P hP p B χ M K hM hweight G Λ L C hC hGspace hGlift hGcap + hinvariant q hq hmesh t (fun u => input u - (1 - ε) * lam) + hsurplus hmeshWidth hmeshWidth1 hshortLoss + (fun u => abs_le.mpr ⟨by linarith only [(hinput u).1, htarget.2], + by linarith only [(hinput u).2, htarget.1]⟩) + hlarge hdiscounted hfreeze + apply relativePatchSliceConclusion_of_spatially_localized_patch S hq₀ f + ((1 - ε) * lam) cost (surplus / ((C : ℝ) * (q : ℝ) ^ d)) Q _ hrank + (fun i => (hlength i).trans (hlen i)) hQl hbudget hgain + apply hQs.trans_eq + apply Finset.expect_congr + · ext j + simp + · intro j _ + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +noncomputable def spatialPatchExtractionMesh (L : ℝ) : ℕ := + ⌈Real.exp (5 * L)⌉₊ + +theorem spatialPatchExtractionMesh_exp_le (L : ℝ) : + Real.exp (5 * L) ≤ (spatialPatchExtractionMesh L : ℝ) := Nat.le_ceil _ + +theorem spatialPatchExtractionMesh_le_exp {L : ℝ} (hL : 1 ≤ L) : + (spatialPatchExtractionMesh L : ℝ) ≤ Real.exp (6 * L) := by + have hfive : 0 ≤ 5 * L := by linarith + exact (ceil_exp_le_exp_add_one hfive).trans (Real.exp_le_exp.mpr (by linarith)) + +theorem spatialPatchExtractionMesh_bounds {L : ℝ} (hL : 1 ≤ L) + (K : ℝ≥0) (hK : (K : ℝ) ≤ Real.exp L) : + 8 ≤ spatialPatchExtractionMesh L ∧ + 16 * (K : ℝ) ≤ (spatialPatchExtractionMesh L : ℝ) ∧ + (spatialPatchExtractionMesh L : ℝ) ≤ Real.exp (6 * L) := by + have hexp : (2 : ℝ) ≤ Real.exp L := by linarith [Real.add_one_le_exp L] + have hfour : (16 : ℝ) ≤ Real.exp (4 * L) := by + have hp := pow_le_pow_left₀ (by norm_num : (0 : ℝ) ≤ 2) hexp 4 + simpa only [← Real.exp_nat_mul, Nat.cast_ofNat, show (2 : ℝ)^4 = 16 by norm_num] using hp + have hlarge : 16 * Real.exp L ≤ Real.exp (5 * L) := by + calc + _ ≤ Real.exp (4 * L) * Real.exp L := + mul_le_mul_of_nonneg_right hfour (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hq := spatialPatchExtractionMesh_exp_le L + have height : (8 : ℝ) ≤ (spatialPatchExtractionMesh L : ℝ) := by + linarith + refine ⟨by exact_mod_cast height, ?_, spatialPatchExtractionMesh_le_exp hL⟩ + exact (mul_le_mul_of_nonneg_left hK (by norm_num)).trans (hlarge.trans hq) + +theorem spatialPatchExtractionMesh_pow_le {L : ℝ} (hL : 1 ≤ L) + (d : ℕ) (hd : (d : ℝ) ≤ L) : + (spatialPatchExtractionMesh L : ℝ)^d ≤ Real.exp (6 * L^2) := by + have hp := pow_le_exp_mul_of_le_exp (Nat.cast_nonneg _) + (spatialPatchExtractionMesh_le_exp hL) (by linarith : 0 ≤ 6 * L) d hd + convert hp using 1 + congr 1 + ring + +theorem spatialPatchExtraction_log_complexity_le_of_mesh {L E : ℝ} + (hL : 1 ≤ L) (hE : E ≤ L) (d q : ℕ) (hd : (d : ℝ) ≤ L) + (hq : (q : ℝ) ≤ Real.exp (6 * L)) + (hqd : (q : ℝ)^d ≤ Real.exp (6 * L^2)) + (K χlip Llift Blip C : ℝ≥0) + (hK : (K : ℝ) ≤ Real.exp L) (hχ : (χlip : ℝ) ≤ Real.exp L) + (hLift : (Llift : ℝ) ≤ Real.exp L) (hB : (Blip : ℝ) ≤ Real.exp L) + (hC : 1 ≤ C) : + ((d : ℝ) + E) + Real.log + (1 + (q : ℝ) * (2 * (q : ℝ)^d + 1) + + ((χlip : ℝ) + (Llift : ℝ) / C) * K + Blip) ≤ 20 * (L + 1)^2 := by + let T : ℝ := 6 * L^2 + 6 * L + have hL0 : 0 ≤ L := by linarith + have hT0 : 0 ≤ T := by dsimp only [T]; positivity + have hTtwo : 2 * L ≤ T := by dsimp only [T]; nlinarith [sq_nonneg L] + have hTL : L ≤ T := by linarith + have hbase : 1 ≤ Real.exp T := Real.one_le_exp hT0 + have hpbase : 1 ≤ Real.exp (6 * L^2) := Real.one_le_exp (by positivity) + have hinner : 2 * (q : ℝ)^d + 1 ≤ 3 * Real.exp (6 * L^2) := by linarith + have hmesh : (q : ℝ) * (2 * (q : ℝ)^d + 1) ≤ 3 * Real.exp T := by + calc + _ ≤ Real.exp (6 * L) * (3 * Real.exp (6 * L^2)) := + mul_le_mul hq hinner (by positivity) (Real.exp_nonneg _) + _ = _ := by dsimp only [T]; rw [Real.exp_add]; ring + have hCr : (1 : ℝ) ≤ C := by exact_mod_cast hC + have hdiv : (Llift : ℝ) / C ≤ Llift := div_le_self Llift.coe_nonneg hCr + have hsum : (χlip : ℝ) + (Llift : ℝ) / C ≤ 2 * Real.exp L := by linarith + have hlift : ((χlip : ℝ) + (Llift : ℝ) / C) * K ≤ 2 * Real.exp T := by + calc + _ ≤ (2 * Real.exp L) * Real.exp L := + mul_le_mul hsum hK K.coe_nonneg (by positivity) + _ = 2 * Real.exp (2 * L) := by rw [show 2 * L = L + L by ring, Real.exp_add]; ring + _ ≤ _ := mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr hTtwo) (by norm_num) + have hBlip : (Blip : ℝ) ≤ Real.exp T := hB.trans (Real.exp_le_exp.mpr hTL) + have htotal : 1 + (q : ℝ) * (2 * (q : ℝ)^d + 1) + + ((χlip : ℝ) + (Llift : ℝ) / C) * K + Blip ≤ Real.exp (T + 7) := by + calc + _ ≤ 7 * Real.exp T := by linarith + _ ≤ Real.exp 7 * Real.exp T := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (7 : ℝ)]) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hlog : Real.log (1 + (q : ℝ) * (2 * (q : ℝ)^d + 1) + + ((χlip : ℝ) + (Llift : ℝ) / C) * K + Blip) ≤ T + 7 := + (Real.log_le_iff_le_exp (by positivity)).mpr htotal + dsimp only [T] at hlog + nlinarith [sq_nonneg L] + +theorem spatialPatchExtraction_log_complexity_le {L E : ℝ} + (hL : 1 ≤ L) (hE : E ≤ L) (d : ℕ) (hd : (d : ℝ) ≤ L) + (K χlip Llift Blip C : ℝ≥0) + (hK : (K : ℝ) ≤ Real.exp L) (hχ : (χlip : ℝ) ≤ Real.exp L) + (hLift : (Llift : ℝ) ≤ Real.exp L) (hB : (Blip : ℝ) ≤ Real.exp L) + (hC : 1 ≤ C) : + ((d : ℝ) + E) + Real.log + (1 + (spatialPatchExtractionMesh L : ℝ) * + (2 * (spatialPatchExtractionMesh L : ℝ)^d + 1) + + ((χlip : ℝ) + (Llift : ℝ) / C) * K + Blip) ≤ 20 * (L + 1)^2 := + spatialPatchExtraction_log_complexity_le_of_mesh hL hE d (spatialPatchExtractionMesh L) hd + (spatialPatchExtractionMesh_le_exp hL) (spatialPatchExtractionMesh_pow_le hL d hd) + K χlip Llift Blip C hK hχ hLift hB hC + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped NNReal + +theorem exists_spatialPatchExtraction_parameters {L S : ℝ} (hL : 1 ≤ L) + (d E n : ℕ) (hd : (d : ℝ) ≤ L) (hE : (E : ℝ) ≤ L) (hn : (n : ℝ) ≤ L) + (K Λ C Llift χlip Blip : ℝ≥0) + (hK : (K : ℝ) ≤ Real.exp L) (hΛ : (Λ : ℝ) ≤ Real.exp L) + (hC : (C : ℝ) ≤ Real.exp L) (hLift : (Llift : ℝ) ≤ Real.exp L) + (hχ : (χlip : ℝ) ≤ Real.exp L) (hB : (Blip : ℝ) ≤ Real.exp L) + (hC1 : 1 ≤ C) (q₀ : ℕ) (hq₀ : 0 < q₀) (hq₀bound : (q₀ : ℝ) ≤ Real.exp L) + (hS : Real.exp (-L) ≤ S) : + ∃ (q : ℕ) (ρ θ τ : ℝ), + 8 ≤ q ∧ 16 * (K : ℝ) ≤ q ∧ 0 < ρ ∧ ρ ≤ 1 ∧ 0 < θ ∧ 0 ≤ τ ∧ + τ + (Λ : ℝ) * ρ + (C : ℝ) * θ < S ∧ + Real.exp (-spatialPatchExtractionCost L) ≤ θ * ρ / (4 * (q₀ : ℝ) * (n + 1)) ∧ + Real.exp (-spatialPatchExtractionCost L) ≤ τ / ((C : ℝ) * (q : ℝ) ^ d) ∧ + (d + E : ℝ) + Real.log + (1 + (q : ℝ) * (2 * (q : ℝ) ^ d + 1) + + ((χlip : ℝ) + (Llift : ℝ) / (C : ℝ)) * (K : ℝ) + (Blip : ℝ)) ≤ + spatialPatchExtractionCost L ∧ + (∀ N : ℝ, Real.exp (spatialPatchExtractionCost L) ≤ N → + 2 * (q₀ : ℝ) ≤ ρ * N) := by + let q := spatialPatchExtractionMesh L + obtain ⟨hq8, hqK, hqupper⟩ := spatialPatchExtractionMesh_bounds hL K hK + obtain ⟨hρ, hρ1⟩ := spatialPatchExtraction_radius hL + have hCpos : 0 < (C : ℝ) := by + have hc : (1 : ℝ) ≤ (C : ℝ) := by exact_mod_cast hC1 + linarith + refine ⟨q, Real.exp (-4 * L), Real.exp (-4 * L), Real.exp (-3 * L), + hq8, hqK, hρ, hρ1, hρ, (Real.exp_pos _).le, + spatialPatchExtraction_strict_budget hL hΛ hC hS, + spatialPatchExtraction_side_lower hL q₀ n hq₀ hq₀bound hn, + spatialPatchExtraction_gain_lower hL hCpos hC q d (by omega) + (spatialPatchExtractionMesh_pow_le hL d hd), ?_, + fun N hN => spatialPatchExtraction_large hL q₀ hq₀bound hN⟩ + exact spatialPatchExtraction_log_complexity_le hL hE d hd K χlip Llift Blip C + hK hχ hLift hB hC1 + +end Erdos3 + +end + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators NNReal Classical + +theorem relativePatchSliceConclusion_of_budgeted_spatial_buffered_score + {X : Type*} [Fintype X] [DecidableEq X] (N : X → ℕ) (hN : ∀ i, 0 < N i) + (q₀ : ℕ) (hq₀ : 0 < q₀) {s d E m rankBound : ℕ} + (w : Fin d → ℕ) (hw : ∀ j, 1 ≤ w j) (hws : ∀ j, w j ≤ s) (hmono : Monotone w) + (P : Fin d → MvPolynomial X ℝ) (hP : ∀ j, P j ∈ weightedSupportLE (fun _ : X => 1) (w j)) + (p : Fin m → ℕ) (B : WeightedParameterPatch (X ⊕ Fin m) (Sum.elim (fun _ => 1) p) s E) + (χ : PatchKernel m) (M : Fin m → Fin d → ℤ) (K : ℝ≥0) + (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) (hweight : ∀ i j, M i j ≠ 0 → w j ≤ p i) + (G : (X → ℝ) → (X → ZMod q₀) → (Fin m → ℤ) → (Fin m → ℝ) → ℝ) + (Λ Llift C : ℝ≥0) (hC : 1 ≤ C) + (hGspace : ∀ r b y, LipschitzWith Λ (fun z => G z r b y)) + (hGlift : ∀ z r b, LipschitzWith Llift (G z r b)) + (hGcap : ∀ z r b y, G z r b y ∈ Set.Icc (0 : ℝ) C) + (hinvariant : ∀ z r c k, G z r (recoveredIntegerLift M c k) = G z r c) + (f : (X → ℤ) → ℝ) (hf : ∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) + (full : (∀ i, Fin (N i)) → (Fin m → ℤ) → ℝ) + {lam δ ε gain L : ℝ} + (hlam : lam ∈ Set.Icc (0 : ℝ) 1) (hδ : 0 ≤ δ) (hε : ε ∈ Set.Icc (0 : ℝ) 1) + (hdiscount : (1 + δ) * (1 - ε) ≤ 1 - δ) + (hlower : ∀ u β, (1 - δ) * + G (BoxProgressionPartition.normalizedPoint u) (fun i => ((u i).val : ZMod q₀)) β + (fun i => realIntegerMatrix M (fun j => aeval (fun x => ((u x).val : ℝ)) (P j)) i - + (β i : ℝ)) ≤ full u β) + (hupper : ∀ u β, full u β ≤ (1 + δ) * + G (BoxProgressionPartition.normalizedPoint u) (fun i => ((u i).val : ZMod q₀)) β + (fun i => realIntegerMatrix M (fun j => aeval (fun x => ((u x).val : ℝ)) (P j)) i - + (β i : ℝ))) + (hscore : gain ≤ 𝔼 u : (∀ i, Fin (N i)), + (f (fun i => ((u i).val : ℤ)) - lam) * ∑' β : Fin m → ℤ, + χ.value (fun i => realIntegerMatrix M (fun j => aeval (fun x => ((u x).val : ℝ)) (P j)) i - + (β i : ℝ)) * full u β * + B.value (Sum.elim (fun i => ((u i).val : ℝ)) (fun i => (β i : ℝ)))) + (hL : 1 ≤ L) (hd : (d : ℝ) ≤ L) (hE : (E : ℝ) ≤ L) + (hn : (Fintype.card X : ℝ) ≤ L) + (hKbudget : (K : ℝ) ≤ Real.exp L) (hΛbudget : (Λ : ℝ) ≤ Real.exp L) + (hCbudget : (C : ℝ) ≤ Real.exp L) (hLiftbudget : (Llift : ℝ) ≤ Real.exp L) + (hχbudget : (χ.lip : ℝ) ≤ Real.exp L) (hBbudget : (B.kernel.lip : ℝ) ≤ Real.exp L) + (hq₀budget : (q₀ : ℝ) ≤ Real.exp L) + (hgainBudget : Real.exp (-L) ≤ gain / (1 + δ)) + (hlarge : ∀ i, Real.exp (spatialPatchExtractionCost L) ≤ (N i : ℝ)) + (hrank : d + E ≤ rankBound) : + RelativePatchSliceConclusion s N f ((1 - ε) * lam) rankBound + (spatialPatchExtractionCost L) := by + obtain ⟨q, ρ, θ, surplus, hq, hmesh, hρ, hρ1, hθ, hsurplus, hfreeze, + hside, hgain, hcomplex, hbig⟩ := exists_spatialPatchExtraction_parameters hL d E + (Fintype.card X) hd hE hn K Λ C Llift χ.lip B.kernel.lip hKbudget hΛbudget + hCbudget hLiftbudget hχbudget hBbudget hC q₀ hq₀ hq₀budget hgainBudget + have hlength (i : X) : Real.exp (-spatialPatchExtractionCost L) * (N i : ℝ) ≤ + θ * ρ * N i / (4 * q₀ * (Fintype.card X + 1)) := by + calc + _ ≤ (θ * ρ / (4 * (q₀ : ℝ) * (Fintype.card X + 1))) * (N i : ℝ) := + mul_le_mul_of_nonneg_right hside (Nat.cast_nonneg _) + _ = _ := by ring + apply relativePatchSliceConclusion_of_discounted_spatial_buffered_score N hN q₀ hq₀ + w hw hws hmono P hP p B χ M K hM hweight G Λ Llift C hC hGspace hGlift hGcap + hinvariant q hq hmesh f hf full hlam hδ hε hdiscount hlower hupper hscore + hsurplus hρ hρ1 hθ (fun i => hbig (N i) (hlarge i)) hfreeze hrank + hlength ?_ hgain + simpa only [NNReal.coe_add, NNReal.coe_mul, NNReal.coe_div, NNReal.coe_natCast, + NNReal.coe_pow, NNReal.coe_ofNat, NNReal.coe_one, Nat.cast_add, add_assoc] using hcomplex + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +variable {A : Type} [Fintype A] +variable (selected : A → Σ j : Fin m, Fin (n j)) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + 4 ≤ Fintype.card (B a.val)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + +variable {d : ℕ} (e : Fin d ≃ Σ j, J j) + +noncomputable def scaledRetainedRecoveredG (cutoff : ℕ) (κ : ℝ) + (v : X → ℝ) (r : X → ZMod (slice.path.referenceRetainedCRTModulus cutoff)) + (β : Fin d → ℤ) (y : Fin d → ℝ) : ℝ := + κ * slice.retainedRecoveredG selected hB o bW hb e cutoff v r β y + +theorem relativePatchSliceConclusion_of_actual_retained_forecast_score + (hmpos : 0 < m) + (hD : Fintype.card X + ∑ j : Fin m, (Fintype.card (Eout j) + n j) ≤ Dmod) + (cutoff : ℕ) (hcutoff : 0 < cutoff) (hsmall : 2 / (cutoff : ℝ) ≤ 1 / 2) + (κ : ℝ) (hκ : 0 ≤ κ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j q, coefficients (poly j) q ∈ U j) + (hN : ∀ i, 0 < physicalN i) + {s r E rankBound : ℕ} + (w : Fin r → ℕ) (hw : ∀ j, 1 ≤ w j) (hws : ∀ j, w j ≤ s) (hmono : Monotone w) + (Pscalar : Fin r → MvPolynomial X ℝ) + (hP : ∀ j, Pscalar j ∈ weightedSupportLE (fun _ : X => 1) (w j)) + (p : Fin d → ℕ) + (Bpatch : WeightedParameterPatch (X ⊕ Fin d) (Sum.elim (fun _ => 1) p) s E) + (χ : PatchKernel d) (M : Fin d → Fin r → ℤ) (K : ℝ≥0) + (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) + (hweight : ∀ i j, M i j ≠ 0 → w j ≤ p i) + (hcoords : ∀ x : X → ℤ, + fullTaggedBufferedCoordinates e poly (fun j => (slice.path.center j).val) x = + realIntegerMatrix M (fun j => MvPolynomial.aeval (fun i => (x i : ℝ)) (Pscalar j))) + (Λ Llift C : ℝ≥0) (hC : 1 ≤ C) + (hGspace : ∀ residue β y, LipschitzWith Λ + (fun v => slice.scaledRetainedRecoveredG selected hB o bW hb e cutoff κ v residue β y)) + (hGlift : ∀ v residue β, LipschitzWith Llift + (slice.scaledRetainedRecoveredG selected hB o bW hb e cutoff κ v residue β)) + (hGcap : ∀ v residue β y, + slice.scaledRetainedRecoveredG selected hB o bW hb e cutoff κ v residue β y ∈ + Set.Icc (0 : ℝ) C) + (hinvariant : ∀ v residue β k, + slice.scaledRetainedRecoveredG selected hB o bW hb e cutoff κ v residue + (recoveredIntegerLift M β k) = + slice.scaledRetainedRecoveredG selected hB o bW hb e cutoff κ v residue β) + (f : (X → ℤ) → ℝ) (hf : ∀ x ∈ integerBox physicalN, f x ∈ Set.Icc (0 : ℝ) 1) + {lam δ ε gain L : ℝ} + (hlam : lam ∈ Set.Icc (0 : ℝ) 1) (hδ : 0 ≤ δ) + (haccuracy : 4 / (cutoff : ℝ) ≤ δ) (hε : ε ∈ Set.Icc (0 : ℝ) 1) + (hdiscount : (1 + δ) * (1 - ε) ≤ 1 - δ) + (hscore : gain ≤ 𝔼 x : ↥(integerBox physicalN), + (slice.targetAt selected hB o bW hb poly hm κ x.val).re * + bufferedScalarScore χ + (fullTaggedBufferedCoordinates e poly (fun j => (slice.path.center j).val)) + (fun u β => Bpatch.value (Sum.elim (fun i => (u i : ℝ)) (fun i => (β i : ℝ)))) + f lam x.val) + (hL : 1 ≤ L) (hr : (r : ℝ) ≤ L) (hE : (E : ℝ) ≤ L) + (hn : (Fintype.card X : ℝ) ≤ L) + (hKbudget : (K : ℝ) ≤ Real.exp L) (hΛbudget : (Λ : ℝ) ≤ Real.exp L) + (hCbudget : (C : ℝ) ≤ Real.exp L) (hLiftbudget : (Llift : ℝ) ≤ Real.exp L) + (hχbudget : (χ.lip : ℝ) ≤ Real.exp L) (hBbudget : (Bpatch.kernel.lip : ℝ) ≤ Real.exp L) + (hqbudget : (slice.path.referenceRetainedCRTModulus cutoff : ℝ) ≤ Real.exp L) + (hgainBudget : Real.exp (-L) ≤ gain / (1 + δ)) + (hlarge : ∀ i, Real.exp (spatialPatchExtractionCost L) ≤ (physicalN i : ℝ)) + (hrank : r + E ≤ rankBound) : + RelativePatchSliceConclusion s physicalN f ((1 - ε) * lam) rankBound + (spatialPatchExtractionCost L) := by + let full : (∀ i, Fin (physicalN i)) → (Fin d → ℤ) → ℝ := fun u β => + κ * slice.recoveredG selected hB o bW hb e + (BoxProgressionPartition.normalizedPoint u) + (fun i => ((u i).val : ZMod slice.path.referenceModulus)) β + (fun i => realIntegerMatrix M + (fun j => MvPolynomial.aeval (fun x => ((u x).val : ℝ)) (Pscalar j)) i - (β i : ℝ)) + have hscoreFin := hscore.trans_eq + (slice.targetAt_mean_mul_bufferedScalarScore_eq_fin selected hB o bW hb e poly hm κ χ + (fun u β => Bpatch.value (Sum.elim (fun i => (u i : ℝ)) (fun i => (β i : ℝ)))) f lam) + apply relativePatchSliceConclusion_of_budgeted_spatial_buffered_score physicalN hN + (slice.path.referenceRetainedCRTModulus cutoff) + (slice.path.referenceRetainedCRTModulus_pos cutoff) + w hw hws hmono Pscalar hP p Bpatch χ M K hM hweight + (slice.scaledRetainedRecoveredG selected hB o bW hb e cutoff κ) + Λ Llift C hC hGspace hGlift hGcap hinvariant f hf full hlam hδ hε hdiscount + ?_ ?_ ?_ hL hr hE hn hKbudget hΛbudget hCbudget hLiftbudget hχbudget hBbudget + hqbudget hgainBudget hlarge hrank + · intro u β + have h := (slice.recoveredG_retained_comparison selected hB o bW hb e hmpos hD + cutoff hcutoff hsmall hδ haccuracy (BoxProgressionPartition.normalizedPoint u) + (fun i => ((u i).val : ZMod slice.path.referenceModulus)) β + (fun i => realIntegerMatrix M + (fun j => MvPolynomial.aeval (fun x => ((u x).val : ℝ)) (Pscalar j)) i - + (β i : ℝ))).1 + have hs := mul_le_mul_of_nonneg_left h hκ + simpa only [full, scaledRetainedRecoveredG, map_natCast, mul_left_comm κ (1 - δ)] using hs + · intro u β + have h := (slice.recoveredG_retained_comparison selected hB o bW hb e hmpos hD + cutoff hcutoff hsmall hδ haccuracy (BoxProgressionPartition.normalizedPoint u) + (fun i => ((u i).val : ZMod slice.path.referenceModulus)) β + (fun i => realIntegerMatrix M + (fun j => MvPolynomial.aeval (fun x => ((u x).val : ℝ)) (Pscalar j)) i - + (β i : ℝ))).2 + have hs := mul_le_mul_of_nonneg_left h hκ + simpa only [full, scaledRetainedRecoveredG, map_natCast, mul_left_comm κ (1 + δ)] using hs + · apply hscoreFin.trans_eq + apply Finset.expect_congr + · ext u + simp + · intro u _ + simp only [full, hcoords, Int.cast_natCast] + unfold BoxProgressionPartition.normalizedPoint + rfl + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedAnalyticIdentification.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedAnalyticIdentification.lean new file mode 100644 index 0000000000000000000000000000000000000000..5dc8b7ebba5ba1bb8570c70a1fb69111388574da --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedAnalyticIdentification.lean @@ -0,0 +1,127 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedFixedPathSlicedNativeAmbientComparison +import OAI.Combinatorics.Progressions.Sampling.ActualFixedSpatialSlicedForecastSourceLaw + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +local notation "Active" => {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a} + +omit [Fintype Tsp] in +theorem kernelSupport (g : G) : + integerProgressionSupport (slice.kernelStart g) (slice.step : ℤ) (slice.kernelLength g) ⊆ + Finset.Ico (0 : ℤ) (S.value : ℤ) := + integerProgressionSupport_subset_of_fin _ _ _ _ (slice.kernelInside g) + +omit [Fintype Tsp] in +theorem activeSide (a : Active) (p : B a.val × Fin (layerSamplerDegree I n a.val)) : + allocatedPrincipalSides B U b S ⟨a.val,p⟩ = S.value := + allocatedPrincipalSides_long_of_not_short B U b S a.val a.property p.1 p.2 + +omit [Fintype Tsp] in +theorem activeLength_two (hδ : 0 < δslice) + (a : Active) (p : B a.val × Fin (layerSamplerDegree I n a.val)) : + 2 ≤ slice.principalLength ⟨a.val,p⟩ := by + by_contra h + have hlen : slice.principalLength ⟨a.val,p⟩ - 1 = 0 := by omega + have hw := slice.path.hwidth a p + rw [slice.width_eq a p, hlen, Nat.cast_zero, mul_zero, zero_div] at hw + exact (not_le_of_gt hδ) hw + +omit [Fintype Tsp] in +theorem activeSupport (a : Active) (p : B a.val × Fin (layerSamplerDegree I n a.val)) : + integerProgressionSupport (slice.principalStart ⟨a.val,p⟩) (slice.step : ℤ) + (slice.principalLength ⟨a.val,p⟩) ⊆ Finset.Ico (0 : ℤ) (S.value : ℤ) := by + simpa only [slice.principalStep_active a p, activeSide (B := B) (U := U) (b := b) (S := S) a p] using + slice.principalSupport ⟨a.val,p⟩ + +omit [Fintype Tsp] in +theorem activeLower_eq (a : Active) (p : B a.val × Fin (layerSamplerDegree I n a.val)) : + slice.path.lower a p = (slice.principalStart ⟨a.val,p⟩ : ℝ) / S.value := by + rw [slice.lower_eq a p, activeSide (B := B) (U := U) (b := b) (S := S) a p] + +omit [Fintype Tsp] in +theorem activeWidth_eq (hδ : 0 < δslice) + (a : Active) (p : B a.val × Fin (layerSamplerDegree I n a.val)) : + slice.path.width a p = (slice.step : ℝ) * ((slice.principalLength ⟨a.val,p⟩ : ℝ) - 1) / + S.value := by + have hlen : 1 ≤ slice.principalLength ⟨a.val,p⟩ := + le_trans (by decide : 1 ≤ 2) (slice.activeLength_two hδ a p) + rw [slice.width_eq a p, slice.principalStep_active a p, activeSide (B := B) (U := U) (b := b) (S := S) a p, + Nat.cast_sub hlen, Nat.cast_one] + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv (allocatedPhysicalRootBudget B U b S (fun _ => 0)) (S.value : ℝ) physicalN τ δslice P Pbad Ppres) + +omit [Fintype Tsp] in +theorem normalizedNoise_eq_kernelFrame (ξ : ℝ) : + slice.path.normalizedNoise = + allocatedFixedPathKernelFrame B U b S τ ξ physicalN slice.path.noise := by + funext k + rcases k with ⟨_ | g, x⟩ <;> + rfl + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedDataComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedDataComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..88af8d71b8c7bd784f1821b4442e3c8cd4589f2c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedDataComparison.lean @@ -0,0 +1,652 @@ +import OAI.Combinatorics.Progressions.Lattices.ActualFixedSpatialSlicedCRTIdentification +import OAI.Combinatorics.Progressions.Probability.ActualFixedSpatialSlicedDensityIdentification + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod : ℕ} {Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j, a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice P Pbad Ppres : ℝ} + +namespace ActualFixedSpatialForecastPath + +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = + projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (originalpoly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hmem : ∀ j d, coefficients (originalpoly j) d ∈ U j) (C : ℝ) +variable {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} +variable {sampleFn : (Option (LayerSamplerVariables G I n B) × X → ℤ) → + CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n} +variable {readFn : (Option (LayerSamplerVariables G I n B) × X → ℤ) → + AllocatedActualCoefficientIndex G X I Eout n B → ℤ} + +omit [Fintype Tsp] in + +theorem centered_recovery + (h : AllocatedCenteredRecoveredSampleReadAt B U bW b hb o S hR hσ originalpoly hmem + (allocatedShortAxis (I := I) U b S.value) spatial kernel block C + center path.center path.base sampleFn readFn) + (hz : allocatedCenteredJointDensity B U b hb o hR hσ S originalpoly hmem + center path.base path.noise ≠ 0) + (hsample : sampleFn path.noise = path.sample) + (hread : readFn path.noise = path.read) : + canonicalCoefficientSample U b hb o path.sample = + affineSampleCoefficientTorus U (path.physicalPolynomial originalpoly) + (path.physicalPolynomial_mem originalpoly hmem) + (fun k x => (jointIntegerFrame (path.base, path.noise) k x : ℝ)) ∧ + (∀ j, mixedArrayInChart (euclideanSubspace (U j)) (b j) (o j) (path.sample j) ∧ + mixedArraySupported (allocatedLayerCenters B U b S j) + (allocatedLayerWidths B U b S j) (allocatedLayerIntegerPMFs B U b hR hσ S j) + (path.sample j)) ∧ + (∀ d, |coefficientSamplerAmbientPoint U b o path.sample d| < 1 / 2) ∧ + (∀ (q : ℕ) (hq : 0 < q), letI : NeZero q := ⟨hq.ne'⟩ + ∀ event : CoefficientChartResidues (LayerSamplerVariables G I n B) n Eout q → Prop, + coefficientDeckChartEvent U bW b hb o q event + (affineCoefficientCoverSample U (path.physicalPolynomial originalpoly) + (path.physicalPolynomial_mem originalpoly hmem) q + (fun k x => (jointIntegerFrame (path.base, path.noise) k x : ℝ))) ↔ + event (allocatedReadCoefficientChartResidues (fun i => (path.read i : ZMod q)))) := by + have hr := h.centeredJointFrame_recovery B U bW b hb o S hR hσ originalpoly hmem + (allocatedShortAxis (I := I) U b S.value) spatial kernel block C path.noise hz + rw [h.centeredJointFrame_read B U bW b hb o S hR hσ originalpoly hmem + (allocatedShortAxis (I := I) U b S.value) spatial kernel block C path.noise, + hsample, hread] at hr + exact ⟨hr.2.1, hr.2.2.1, hr.2.2.2.1, hr.2.2.2.2.2⟩ + +end ActualFixedSpatialForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +local instance slicedDecayModulusNeZero : NeZero slice.path.referenceModulus := + ⟨slice.path.referenceModulus_pos.ne'⟩ + +omit [Fintype Tsp] in + +theorem stepInputLaw_sample_characteristic_decay (hm : 0 < m) + (y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U b S)) + (χ : AddChar (Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod slice.path.referenceModulus) ℂ) : + ‖finiteImageCharacteristic slice.stepInputLaw + (fun t j => (integerLongPolynomialOutput + (allocatedForecastPolynomial (allocatedShortAxis (I := I) U b S.value) + slice.path.base slice.path.noise (allocatedReadDeck slice.path.read) + (allocatedOriginalSampleCongruenceProjection B U b S slice.path.sample)) + (fun k => (y k.1 k.2 : ℤ)) slice.path.referenceModulus t j : + ZMod slice.path.referenceModulus)) χ‖ ≤ + ((slice.path.Rbad * ∏ p : slice.path.primes, + p.val ^ slice.path.prescribed p.val : ℕ) : ℝ) ^ + (modularRankDecayExponent m (modularForecastRankConstant m Dmod : ℝ) * + modularRankChargeFactor m) * + (orderOf χ : ℝ) ^ (-modularRankDecayExponent m + (modularForecastRankConstant m Dmod : ℝ)) := by + have h := slice.path.reference_characteristic_decay hm y χ + rw [slice.referenceInputLaw_eq_step, slice.referencePolynomial_eq_sample] at h + exact h + +end ActualFixedSpatialSlicedForecastPath + +namespace ActualFixedSpatialForecastSetup +variable {B U b S Dmod τ δslice} +variable {A : Type} [Fintype A] {selected : A → Σ j : Fin m, Fin (n j)} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod selected τ δslice) + +omit [DecidableEq X] [Fintype A] in +include s in + +theorem modular_decay_dimension : + ((Fintype.card (Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value))) + 2 : ℕ) : ℝ) ≤ + modularRankDecayExponent m (modularForecastRankConstant m Dmod : ℝ) := by + exact allocatedCongruenceForecastRankConstant_dimension + (allocatedShortAxis (I := I) U b S.value) s.hm Dmod s.hDmod + +end ActualFixedSpatialForecastSetup +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory BooleanCubeKernel +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [decX : DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv (allocatedPhysicalRootBudget B U b S (fun _ => 0)) (S.value : ℝ) physicalN τ δslice P Pbad Ppres) + +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod (allocatedShortIntegerSelection U b S.value) τ δslice) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = + projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable {periodCap coverCap : ℝ} {Lip : ℝ≥0} +variable (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) +variable (originalpoly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hmem : ∀ j d, coefficients (originalpoly j) d ∈ U j) +variable (hdegree : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (originalpoly j)) +variable (ξ : ℝ) (hξ : 0 < ξ) +variable (hbox : ∀ x, 0 < physicalN x) +variable (hframe : slice.path.noise ∈ rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ physicalN) 1) +variable {t δ ε η : ℝ} (ht : 0 < t) (hσbound : ∀ j, |σ j| ≤ t) +variable (hδ : 0 < δ) (hδone : δ ≤ 1) +variable (hdense : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), δ * S.value ≤ + ((integerProgressionSupport (slice.principalStart ⟨a.val,p⟩) (slice.step : ℤ) + (slice.principalLength ⟨a.val,p⟩)).card : ℝ)) +variable (q : ℕ) [NeZero q] +variable (hperiod : W.modulus ∣ q) (hcover : W.cover ∣ q) +variable (hqN : q ∣ slice.path.referenceModulus) +variable (hsizeG : ∀ g, q ≤ slice.kernelLength g) +variable (hsmallG : ∀ g, scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / slice.kernelLength g) < 1) +variable (hsize : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), q ≤ slice.principalLength ⟨a.val,p⟩) +variable (hsmall : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), + scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / slice.principalLength ⟨a.val,p⟩) < 1) +variable (hε : 0 ≤ ε) (hmesh : (slice.step : ℝ) / S.value ≤ ε) +variable (hη : 0 < η) +variable (htail : |t| * polynomialMassC2Budget + (Fintype.card (Σ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val))) m 1 ≤ + slicedPrincipalC2Tolerance + (Fintype.card (Σ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val))) + (Fintype.card {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}) m 1 + (unitProfilePrincipalLowerBound B) (δ / 2) s.L η) + +local notation "Active" => {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a} +local notation "activeH" => (fun j : (Σ a : Active, B (Subtype.val a) × Fin (layerSamplerDegree I n (Subtype.val a))) => + slice.principalLength (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) +local notation "activeStart" => (fun j : (Σ a : Active, B (Subtype.val a) × Fin (layerSamplerDegree I n (Subtype.val a))) => + slice.principalStart (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) +local notation "selected" => allocatedShortIntegerSelection U b S.value +local notation "Original" => PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U b S) +local notation "Out" => Sigma (AllocatedCongruenceRankOutput X Eout (allocatedShortAxis U b S.value)) +local notation "Knative" => Lip * max ‖τ / 8‖₊ (forecastNativeAmbientLip U b o R) +local instance actualComparisonReferenceNeZero : NeZero slice.path.referenceModulus := + ⟨slice.path.referenceModulus_pos.ne'⟩ + +noncomputable def nativeMean : ℂ := + allocatedSlicedNativeEvalMean B U b S W slice.path.base slice.path.noise physicalN + (slice.path.physicalPolynomial originalpoly) slice.principalLength slice.principalStep + slice.principalStart slice.principalInside slice.principalLength_pos slice.kernelLength + slice.kernelLength_two slice.kernelStart slice.step slice.kernelSupport activeH activeStart + (fun j => slice.activeLength_two s.hδslice j.1 j.2) (fun j => slice.activeSupport j.1 j.2) + +noncomputable def decayConstant : ℝ := + ((slice.path.Rbad * ∏ p : slice.path.primes, p.val ^ slice.path.prescribed p.val : ℕ) : ℝ) ^ + (modularRankDecayExponent m (modularForecastRankConstant m Dmod : ℝ) * modularRankChargeFactor m) + +variable (gridVolume : ℝ) (hVpos : 0 < gridVolume) +local notation "κ" => ((forecastGeometricJacobian (X := X) (I := I) U b R S.value gridVolume τ : ℝ) : ℂ) +local notation "referenceTarget" => forecastLawDensityPhysicalTarget B U b S slice.principalLaw + (slice.density s.hBactive) selected slice.path.sample slice.path.commonTuple + (fun _ : Original => slice.path.referenceInputLaw) + (fun y => integerLongPolynomialOutput slice.path.referencePolynomial + (fun k => (y (Prod.fst k) (Prod.snd k) : ℤ)) slice.path.referenceModulus) + slice.path.referenceModulus gridVolume slice.path.base physicalN τ o hb bW + +variable [hlattice : ∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) + (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] +variable [hcompact : CompactSpace (EuclideanJetLayers U (fun _ : Fin m => Unit))] +variable (hmargin : ∀ i, 2 * spatialTrimMargin τ physicalN i ≤ physicalN i) +variable (htrimbase : slice.path.base ∈ trimmedIntegerBox physicalN (spatialTrimMargin τ physicalN)) +variable {Findex : Type} [Fintype Findex] {pf cf : ℝ} {Lf : ℝ≥0} +variable (F : Findex → NormalizedPolynomialTwist X (Σ j, J j) pf cf Lf) +variable (nativeCoeff : Findex → ℂ) (δnative : ℝ) +variable (happrox : ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖((forecastGeometricJacobian (X := X) (I := I) U b R S.value gridVolume τ : ℝ) : ℂ) * + forecastLawDensityPhysicalTarget B U b S slice.principalLaw (slice.density s.hBactive) + (allocatedShortIntegerSelection U b S.value) slice.path.sample slice.path.commonTuple + (fun _ : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U b S) => + slice.path.referenceInputLaw) + (fun y => integerLongPolynomialOutput slice.path.referencePolynomial + (fun k => (y (Prod.fst k) (Prod.snd k) : ℤ)) slice.path.referenceModulus) + slice.path.referenceModulus gridVolume slice.path.base physicalN τ o hb bW poly hp u - + ∑ i, nativeCoeff i * (F i).eval physicalN poly u‖ ≤ δnative) +variable {Pambient Eprec Rrank M : ℝ} (hPambient : 0 ≤ Pambient) (hEprec : 0 ≤ Eprec) +variable (hPP : s.P ≤ Pambient) +variable (hLip : ((Lip * max 1 (Real.toNNReal cf) + Lf * max 1 (Real.toNNReal coverCap) : ℝ≥0) : ℝ) ≤ Real.exp Pambient) +variable (hcoverF : ∀ i, ((W.cover * (F i).cover : ℕ) : ℝ) ≤ Real.exp Pambient) +variable (hmodF : ∀ i, ((W.modulus * (F i).modulus : ℕ) : ℝ) ≤ Real.exp Pambient) +variable (hmass : ∑ i, ‖nativeCoeff i‖ ≤ M) +variable (hlarge : ∀ i, Real.exp ((max Pambient Eprec + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ (physicalN i : ℝ)) +variable (hRrank : Real.exp ((max Pambient Eprec + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ Rrank) +variable (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (physicalN i : ℝ)) + Rrank (U j) (originalpoly j)) +variable (cutoff : ℕ) (hcutoff : 0 < cutoff) +variable {δgrid : ℝ} (hδgrid : 0 ≤ δgrid) (hδgrid1 : δgrid ≤ 1) +variable (hgridmesh : ∀ j, ((q * cutoff : ℕ) : ℝ) / + forecastJointGridScale U b R S.value physicalN τ j ≤ δgrid) + +noncomputable def comparisonError : ℝ := + allocatedSlicedPhysicalComparisonError B U b S ξ slice.kernelLength (t := t) activeH q + (ε := ε) (η := η) (Kφ := Knative) + + ((2 * δnative + M * Real.exp (-Eprec)) + + allocatedSlicedPhysicalAmbientGridError (B := B) (U := U) (basis := b) (S := S) (E := Eout) + (τ := τ) (ξ := ξ) (box := physicalN) (integerFrame := slice.path.noise) + (HG := slice.kernelLength) (hHG := slice.kernelLength_two) (cG := slice.kernelStart) + (stepG := slice.step) (hstepG := slice.step_pos) (e := spatialEquiv) + (h0 := slice.analyticKernelDetFalse ξ) (h1 := slice.analyticKernelDetTrue ξ) + (hδ := hδ) (o := o) (Lip := Lip) (cutoff := cutoff) (D := slice.decayConstant) (δgrid := δgrid)) + +variable (C : ℝ) +variable {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} +variable {sampleFn : (Option (LayerSamplerVariables G I n B) × X → ℤ) → + CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n} +variable {readFn : (Option (LayerSamplerVariables G I n B) × X → ℤ) → + AllocatedActualCoefficientIndex G X I Eout n B → ℤ} +variable (hglobal : AllocatedCenteredRecoveredSampleReadAt B U bW b hb o S hR hσ + originalpoly hmem (allocatedShortAxis (I := I) U b S.value) spatial kernel block C + center slice.path.center slice.path.base sampleFn readFn) +variable (hz : allocatedCenteredJointDensity B U b hb o hR hσ S originalpoly hmem + center slice.path.base slice.path.noise ≠ 0) +variable (hsampleAt : sampleFn slice.path.noise = slice.path.sample) +variable (hreadAt : readFn slice.path.noise = slice.path.read) + +include hR hσ hdegree hξ hbox hframe ht hσbound hδ hδone hdense hperiod hcover hqN + hsizeG hsmallG hsize hsmall hε hmesh hη htail hVpos ν hlattice hcompact + hmargin htrimbase happrox hPambient hEprec hPP hLip hcoverF hmodF hmass hlarge + hRrank hrank hcutoff hδgrid hδgrid1 hgridmesh hglobal hz hsampleAt hreadAt in + +theorem native_ambient_comparison : + ‖slice.nativeMean s W originalpoly - + (𝔼 u ∈ integerBox physicalN, + W.eval physicalN (slice.path.physicalPolynomial originalpoly) u * + (κ * referenceTarget (slice.path.physicalPolynomial originalpoly) + (slice.path.physicalPolynomial_mem originalpoly hmem) u))‖ ≤ + slice.comparisonError (Lip := Lip) (ξ := ξ) (t := t) (δ := δ) (ε := ε) (η := η) (q := q) + (hδ := hδ) (o := o) (δnative := δnative) (M := M) (Eprec := Eprec) (cutoff := cutoff) (δgrid := δgrid) := by + cases Subsingleton.elim decX (Classical.decEq X) + let := Classical.decEq X + let := slice.path.primeNeZero + have hr := slice.path.centered_recovery bW hb o originalpoly hmem C + hglobal hz hsampleAt hreadAt + have hframeEq : (fun k x => (jointIntegerFrame (slice.path.base, slice.path.noise) k x : ℝ)) = + (fun k x => ((integerBaseTranslation (K := LayerSamplerVariables G I n B) + slice.path.base + slice.path.noise) (k,x) : ℝ)) := by + funext k x + cases k <;> simp [jointIntegerFrame, integerBaseTranslation, baseArrayJoin] + rw [hframeEq] at hr + have hphysicalDegree : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) + (slice.path.physicalPolynomial originalpoly j) := + fun j => (hdegree j).subtractConstant _ + have hphysicalRank : ∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (physicalN i : ℝ)) Rrank (U j) + (slice.path.physicalPolynomial originalpoly j) := by + intro j + exact (hasLayerSamplingRank_subtractConstant_iff (Nat.succ_pos j.val) + _ _ _ _ _).mpr (hrank j) + have hnonempty : ∀ a : Active, Nonempty (B a.val) := fun a => + Fintype.card_pos_iff.mp (lt_of_lt_of_le (by decide : 0 < 4) (s.hBactive a)) + let bActive : ∀ a : Active, B a.val := fun a => Classical.choice (hnonempty a) + have hdim : (Fintype.card (Σ j, J j) : ℝ) ≤ Pambient := by + simpa only [Fintype.card_sigma] using s.hdim.trans (s.hDP.trans hPP) + have hPdecay := s.modular_decay_dimension + have hdecay := slice.stepInputLaw_sample_characteristic_decay s.hm + have happrox' := happrox + rw [slice.density_eq_allocatedSlicedPhysicalForecastDensity s.hBactive s.hδslice ξ, + slice.referenceInputLaw_eq_step, slice.referencePolynomial_eq_sample] at happrox' + dsimp only [nativeMean, comparisonError] + rw [slice.density_eq_allocatedSlicedPhysicalForecastDensity s.hBactive s.hδslice ξ, + slice.referenceInputLaw_eq_step, slice.referencePolynomial_eq_sample] + dsimp only [principalLaw, stepInputLaw] at happrox' hdecay ⊢ + exact allocatedFixedPath_sliced_native_ambient_comparison + (B := B) (U := U) (basis := b) (hR := hR) (hσ := hσ) (S := S) + (primes := fun p : slice.path.primes => p.val) + (exponent := fun p : slice.path.primes => slice.path.exponent p.val) + (HP := slice.principalLength) (stepP := slice.principalStep) + (cP := slice.principalStart) (hinsideP := slice.principalInside) + (hHP := slice.principalLength_pos) (τ := τ) (ξ := ξ) (hτ := s.hτ) (hξ := hξ) + (box := physicalN) (hbox := hbox) (integerFrame := slice.path.noise) (hframe := hframe) + (HG := slice.kernelLength) (hHG := slice.kernelLength_two) (cG := slice.kernelStart) + (stepG := slice.step) (hstepG := slice.step_pos) (hcontainedG := slice.kernelSupport) + (e := spatialEquiv) (h0 := slice.analyticKernelDetFalse ξ) + (h1 := slice.analyticKernelDetTrue ξ) (hB := s.hBactive) + (sample := slice.path.sample) (hs := slice.path.hs) (ht := ht) (hσbound := hσbound) + (H := fun j => slice.principalLength ⟨j.1.val,j.2⟩) + (c := fun j => slice.principalStart ⟨j.1.val,j.2⟩) + (hH := fun j => slice.activeLength_two s.hδslice j.1 j.2) + (hδ := hδ) (hsubset := fun j => slice.activeSupport j.1 j.2) + (hdense := fun j => hdense j.1 j.2) (q := q) (hsizeG := hsizeG) (hsmallG := hsmallG) + (hsize := fun j => hsize j.1 j.2) (hsmall := fun j => hsmall j.1 j.2) + (hε := hε) (hmesh := fun _ => hmesh) (hδone := hδone) + (b := bActive) (hη := hη) (A := s.L) (hA := s.hL) (htail := htail) + (hb := hb) (o := o) (bW := bW) (W := W) (hm := s.hm) + (hperiod := hperiod) (hcover := hcover) (xref := slice.path.commonTuple) + (base := slice.path.base) (read := slice.path.read) + (hp := fun p => slice.path.prime p.val p.property) + (hcoprime := primePower_crt_coprime (fun p : slice.path.primes => p.val) + (fun p : slice.path.primes => slice.path.exponent p.val) + (fun p => slice.path.prime p.val p.property) Subtype.val_injective) + (hqN := hqN) (hV := hVpos.ne') + (nativePoly := slice.path.physicalPolynomial originalpoly) + (hmem := slice.path.physicalPolynomial_mem originalpoly hmem) + (hdegree := hphysicalDegree) (hbase := hr.1) (hsmallChart := hr.2.2.1) + (hread := hr.2.2.2 W.cover W.cover_pos) + (ν := ν) (hσ1 := s.hσ1) (radius := s.radius) + (hradius0 := by exact_mod_cast lt_of_lt_of_le (by norm_num : (0 : ℝ) < 3) s.hr3) + (hradius3 := s.hr3) (hradius := s.hradius) + (chartCap := s.inverse) (hchartCap := s.hinverse) (hchart := s.hchart) + (hchartBudget := s.hbudget) (hmargin := hmargin) (htrimbase := htrimbase) + (hVpos := hVpos) (F := F) (nativeCoeff := nativeCoeff) (δnative := δnative) + (happrox := happrox') (hPambient := hPambient) (hEprec := hEprec) + (hX := s.hX.trans hPP) (hdim := hdim) (hLip := hLip) (hcoverF := hcoverF) + (hmodF := hmodF) (hmass := hmass) (hlarge := hlarge) (hRrank := hRrank) + (hrank := hphysicalRank) (cutoff := cutoff) (hcutoff := hcutoff) + (D := slice.decayConstant) (hD := Real.rpow_nonneg (Nat.cast_nonneg _) _) + (hPdecay := hPdecay) (hdecay := hdecay) (hδgrid := hδgrid) + (hδgrid1 := hδgrid1) (hgridmesh := hgridmesh) + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory BooleanCubeKernel +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [decX : DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv (allocatedPhysicalRootBudget B U b S (fun _ => 0)) (S.value : ℝ) physicalN τ δslice P Pbad Ppres) + +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod (allocatedShortIntegerSelection U b S.value) τ δslice) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = + projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable {periodCap coverCap : ℝ} {Lip : ℝ≥0} +variable (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) +variable (originalpoly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hmem : ∀ j d, coefficients (originalpoly j) d ∈ U j) +variable (hdegree : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (originalpoly j)) +variable (ξ : ℝ) (hξ : 0 < ξ) +variable (hbox : ∀ x, 0 < physicalN x) +variable (hframe : slice.path.noise ∈ rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ physicalN) 1) +variable {t δ ε η : ℝ} (ht : 0 < t) (hσbound : ∀ j, |σ j| ≤ t) +variable (hδ : 0 < δ) (hδone : δ ≤ 1) +variable (hdense : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), δ * S.value ≤ + ((integerProgressionSupport (slice.principalStart ⟨a.val,p⟩) (slice.step : ℤ) + (slice.principalLength ⟨a.val,p⟩)).card : ℝ)) +variable (q : ℕ) [NeZero q] +variable (hperiod : W.modulus ∣ q) (hcover : W.cover ∣ q) +variable (hqN : q ∣ slice.path.referenceModulus) +variable (hsizeG : ∀ g, q ≤ slice.kernelLength g) +variable (hsmallG : ∀ g, scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / slice.kernelLength g) < 1) +variable (hsize : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), q ≤ slice.principalLength ⟨a.val,p⟩) +variable (hsmall : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), + scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / slice.principalLength ⟨a.val,p⟩) < 1) +variable (hε : 0 ≤ ε) (hmesh : (slice.step : ℝ) / S.value ≤ ε) +variable (hη : 0 < η) +variable (htail : |t| * polynomialMassC2Budget + (Fintype.card (Σ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val))) m 1 ≤ + slicedPrincipalC2Tolerance + (Fintype.card (Σ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val))) + (Fintype.card {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}) m 1 + (unitProfilePrincipalLowerBound B) (δ / 2) s.L η) + +variable [hlattice : ∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) + (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] +variable [hcompact : CompactSpace (EuclideanJetLayers U (fun _ : Fin m => Unit))] +variable (hmargin : ∀ i, 2 * spatialTrimMargin τ physicalN i ≤ physicalN i) +variable (htrimbase : slice.path.base ∈ trimmedIntegerBox physicalN (spatialTrimMargin τ physicalN)) + +variable {Pnative massLog capLog Edata Ptest : ℝ} +variable (data : ActualForecastData physicalN originalpoly Pnative massLog capLog Edata) +variable (hcenter : data.centerConstant = fun j => (slice.path.center j).val) +variable (hκ : s.κ = forecastGeometricJacobian (X := X) (I := I) U b R S.value (∏ a, (basisAxisScale (b ((allocatedShortIntegerSelection U b S.value) a).1) ((allocatedShortIntegerSelection U b S.value) a).2 : ℝ)) τ) +variable (hUniversal : ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖slice.targetAt (allocatedShortIntegerSelection U b S.value) s.hBactive o bW hb poly hm s.κ u - + ∑ i, data.coefficient i * (data.twists i).eval physicalN + (fun j => subtractConstant (data.centerConstant j) (poly j)) u‖ ≤ Real.exp (-Edata)) +variable (hPtest : 0 ≤ Ptest) (hLw : (Lip : ℝ) ≤ Real.exp Ptest) +variable (hpw : periodCap ≤ Real.exp Ptest) (hcw : coverCap ≤ Real.exp Ptest) +variable {Eprec Rrank : ℝ} (hEprec : 0 ≤ Eprec) +variable (hlarge : ∀ i, Real.exp ((max (max s.P (2 * max Ptest (3 * Pnative + 3) + 1)) Eprec + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ (physicalN i : ℝ)) +variable (hRrank : Real.exp ((max (max s.P (2 * max Ptest (3 * Pnative + 3) + 1)) Eprec + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ Rrank) +variable (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (physicalN i : ℝ)) + Rrank (U j) (originalpoly j)) +variable (cutoff : ℕ) (hcutoff : 0 < cutoff) +variable {δgrid : ℝ} (hδgrid : 0 ≤ δgrid) (hδgrid1 : δgrid ≤ 1) +variable (hgridmesh : ∀ j, ((q * cutoff : ℕ) : ℝ) / + forecastJointGridScale U b R S.value physicalN τ j ≤ δgrid) +variable (C : ℝ) +variable {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} +variable {sampleFn : (Option (LayerSamplerVariables G I n B) × X → ℤ) → + CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n} +variable {readFn : (Option (LayerSamplerVariables G I n B) × X → ℤ) → + AllocatedActualCoefficientIndex G X I Eout n B → ℤ} +variable (hglobal : AllocatedCenteredRecoveredSampleReadAt B U bW b hb o S hR hσ + originalpoly hmem (allocatedShortAxis (I := I) U b S.value) spatial kernel block C + center slice.path.center slice.path.base sampleFn readFn) +variable (hz : allocatedCenteredJointDensity B U b hb o hR hσ S originalpoly hmem + center slice.path.base slice.path.noise ≠ 0) +variable (hsampleAt : sampleFn slice.path.noise = slice.path.sample) +variable (hreadAt : readFn slice.path.noise = slice.path.read) + +include hR hσ hdegree hξ hbox hframe ht hσbound hδ hδone hdense hperiod hcover hqN + hsizeG hsmallG hsize hsmall hε hmesh hη htail ν hlattice hcompact hmargin htrimbase + hcenter hκ hUniversal hPtest hLw hpw hcw hEprec hlarge hRrank hrank hcutoff hδgrid + hδgrid1 hgridmesh hglobal hz hsampleAt hreadAt in + +theorem native_ambient_comparison_actualForecastData : + ‖slice.nativeMean s W originalpoly - + (𝔼 u ∈ integerBox physicalN, + W.eval physicalN (slice.path.physicalPolynomial originalpoly) u * + slice.rawTarget (allocatedShortIntegerSelection U b S.value) s.hBactive o bW hb s.κ + (slice.path.physicalPolynomial originalpoly) + (slice.path.physicalPolynomial_mem originalpoly hmem) u)‖ ≤ + slice.comparisonError (Lip := Lip) (ξ := ξ) (t := t) (δ := δ) (ε := ε) (η := η) (q := q) + (hδ := hδ) (o := o) (δnative := Real.exp (-Edata)) (M := Real.exp massLog) + (Eprec := Eprec) (cutoff := cutoff) (δgrid := δgrid) := by + have hV : 0 < (∏ a, (basisAxisScale (b ((allocatedShortIntegerSelection U b S.value) a).1) ((allocatedShortIntegerSelection U b S.value) a).2 : ℝ)) := by + apply Finset.prod_pos + intro a _ + exact_mod_cast basisAxisScale_pos (b ((allocatedShortIntegerSelection U b S.value) a).1) ((allocatedShortIntegerSelection U b S.value) a).2 + have hPa : 0 ≤ (max s.P (2 * max Ptest (3 * Pnative + 3) + 1)) := (by linarith [s.hP] : (0 : ℝ) ≤ s.P).trans (le_max_left _ _) + have hbds := data.native_product_bounds W hPtest hLw hpw hcw + have hLip := data.native_product_lipschitz_bound W hPtest hLw hcw + have hexp : Real.exp (2 * max Ptest (3 * Pnative + 3) + 1) ≤ Real.exp (max s.P (2 * max Ptest (3 * Pnative + 3) + 1)) := + Real.exp_le_exp.mpr (le_max_right _ _) + have happ := slice.rawTarget_actualForecastData_approx (allocatedShortIntegerSelection U b S.value) s.hBactive o bW hb + originalpoly data hcenter s.κ hUniversal + have hcomp := slice.native_ambient_comparison + (s := s) (hb := hb) (o := o) (bW := bW) (W := W) (originalpoly := originalpoly) + (hmem := hmem) (hdegree := hdegree) (ξ := ξ) (hξ := hξ) (hbox := hbox) + (hframe := hframe) (ht := ht) (hσbound := hσbound) (hδ := hδ) (hδone := hδone) + (hdense := hdense) (q := q) (hperiod := hperiod) (hcover := hcover) (hqN := hqN) + (hsizeG := hsizeG) (hsmallG := hsmallG) (hsize := hsize) (hsmall := hsmall) + (hε := hε) (hmesh := hmesh) (hη := hη) (htail := htail) + (gridVolume := (∏ a, (basisAxisScale (b ((allocatedShortIntegerSelection U b S.value) a).1) ((allocatedShortIntegerSelection U b S.value) a).2 : ℝ))) (hVpos := hV) (ν := ν) (hmargin := hmargin) + (htrimbase := htrimbase) (F := data.twists) (nativeCoeff := data.coefficient) + (δnative := Real.exp (-Edata)) (happrox := by simpa only [rawTarget, hκ] using happ) + (hPambient := hPa) (hEprec := hEprec) (hPP := le_max_left _ _) + (hLip := hLip.trans hexp) (hcoverF := fun i => (hbds i).2.1.trans hexp) + (hmodF := fun i => (hbds i).2.2.trans hexp) (hmass := data.mass) + (hlarge := hlarge) (hRrank := hRrank) (hrank := hrank) (cutoff := cutoff) + (hcutoff := hcutoff) (hδgrid := hδgrid) (hδgrid1 := hδgrid1) (hgridmesh := hgridmesh) + (C := C) (hglobal := hglobal) (hz := hz) (hsampleAt := hsampleAt) (hreadAt := hreadAt) + simpa only [rawTarget, hκ] using hcomp + +variable (hfinite : (integerBox physicalN).Nonempty) +variable (htarget : data.target = slice.target (allocatedShortIntegerSelection U b S.value) s.hBactive o bW hb originalpoly hmem s.κ) + +include hR hσ hdegree hξ hbox hframe ht hσbound hδ hδone hdense hperiod hcover hqN + hsizeG hsmallG hsize hsmall hε hmesh hη htail ν hlattice hcompact hmargin htrimbase + hcenter hκ hUniversal hPtest hLw hpw hcw hEprec hlarge hRrank hrank hcutoff hδgrid + hδgrid1 hgridmesh hglobal hz hsampleAt hreadAt hfinite htarget in + +theorem native_ambient_model_comparison : + ‖slice.nativeMean s W originalpoly - + (FiniteProbabilityWeights.uniformFinset (integerBox physicalN) hfinite).complexMean + (fun u => W.eval physicalN + (fun j => subtractConstant (data.centerConstant j) (originalpoly j)) u.val * data.target u)‖ ≤ + slice.comparisonError (Lip := Lip) (ξ := ξ) (t := t) (δ := δ) (ε := ε) (η := η) (q := q) + (hδ := hδ) (o := o) (δnative := Real.exp (-Edata)) (M := Real.exp massLog) + (Eprec := Eprec) (cutoff := cutoff) (δgrid := δgrid) := by + have hc := slice.native_ambient_comparison_actualForecastData + (s := s) (hb := hb) (o := o) (bW := bW) (W := W) (originalpoly := originalpoly) + (hmem := hmem) (hdegree := hdegree) (ξ := ξ) (hξ := hξ) (hbox := hbox) + (hframe := hframe) (ht := ht) (hσbound := hσbound) (hδ := hδ) (hδone := hδone) + (hdense := hdense) (q := q) (hperiod := hperiod) (hcover := hcover) (hqN := hqN) + (hsizeG := hsizeG) (hsmallG := hsmallG) (hsize := hsize) (hsmall := hsmall) + (hε := hε) (hmesh := hmesh) (hη := hη) (htail := htail) + (ν := ν) (hmargin := hmargin) (htrimbase := htrimbase) + (data := data) (hcenter := hcenter) (hκ := hκ) (hUniversal := hUniversal) + (hPtest := hPtest) (hLw := hLw) (hpw := hpw) (hcw := hcw) + (hEprec := hEprec) (hlarge := hlarge) (hRrank := hRrank) (hrank := hrank) + (cutoff := cutoff) (hcutoff := hcutoff) (hδgrid := hδgrid) (hδgrid1 := hδgrid1) + (hgridmesh := hgridmesh) (C := C) (hglobal := hglobal) (hz := hz) + (hsampleAt := hsampleAt) (hreadAt := hreadAt) + have he := FiniteProbabilityWeights.uniformFinset_complexMean (integerBox physicalN) hfinite + (fun u => W.eval physicalN (slice.path.physicalPolynomial originalpoly) u * + slice.rawTarget (allocatedShortIntegerSelection U b S.value) s.hBactive o bW hb s.κ + (slice.path.physicalPolynomial originalpoly) + (slice.path.physicalPolynomial_mem originalpoly hmem) u) + rw [← he] at hc + have hfunctions : + (fun u : integerBox physicalN => W.eval physicalN + (fun j => subtractConstant (data.centerConstant j) (originalpoly j)) u.val * data.target u) = + (fun u : integerBox physicalN => W.eval physicalN + (slice.path.physicalPolynomial originalpoly) u.val * + slice.rawTarget (allocatedShortIntegerSelection U b S.value) s.hBactive o bW hb s.κ + (slice.path.physicalPolynomial originalpoly) + (slice.path.physicalPolynomial_mem originalpoly hmem) u.val) := by + funext u + rw [hcenter, htarget] + rfl + rw [hfunctions] + exact hc + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedModelPrecision.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedModelPrecision.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9f7e343fd32cc6d45541b889574e1ea54b9f19e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedModelPrecision.lean @@ -0,0 +1,587 @@ +import OAI.Combinatorics.Progressions.Sampling.ActualFixedSpatialSlicedGridErrorIdentification + +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)] {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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {X : Type} [Fintype X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {A : Type} {Dmod : ℕ} {selected : A → Σ j : Fin m, Fin (n j)} +variable {τ δslice : ℝ} + +namespace ActualFixedSpatialForecastSetup + +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod selected τ δslice) +variable (hR : ∀ j, 0 < R j) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +include s hR + +theorem inverse_radius_le_one (j : Fin m) : + s.inverse j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 := by + have hnonneg : 0 ≤ s.inverse j * ((Fintype.card (I j) : ℝ) + 1) * R j := + mul_nonneg (mul_nonneg (s.hinverse j) (by positivity)) (hR j).le + have hbudget := s.hbudget j + have hcompare := mul_le_mul_of_nonneg_right + (show (1 : ℝ) ≤ 2 * (s.radius : ℝ) by linarith [s.hr3]) hnonneg + nlinarith + +theorem nativeAmbientLip_le_one : forecastNativeAmbientLip U b o R ≤ 1 := by + change ‖(forecastNativeAmbientLinear U b o R).toContinuousLinearMap‖ ≤ (1 : ℝ) + apply (forecastNativeAmbientLinear U b o R).toContinuousLinearMap.opNorm_le_bound zero_le_one + intro v + rw [one_mul] + apply (pi_norm_le_iff_of_nonneg (norm_nonneg v)).mpr + intro a + have hcoord (k : LayerSamplerAxis I n) : + |R a.1 * v k| ≤ R a.1 * ‖v‖ := by + rw [abs_mul, abs_of_pos (hR a.1)] + exact mul_le_mul_of_nonneg_left + (by simpa only [Real.norm_eq_abs] using norm_le_pi_norm v k) (hR a.1).le + have hrow := mixedRealPoint_norm_le (euclideanSubspace (U a.1)) (b a.1) (o a.1) + (s.hinverse a.1) (mul_nonneg (hR a.1).le (norm_nonneg v)) (s.hchart a.1) + (fun i => R a.1 * v ⟨a.1, Sum.inl i⟩) + (fun i => R a.1 * v ⟨a.1, Sum.inr i⟩) + (fun i => hcoord ⟨a.1, Sum.inl i⟩) (fun i => hcoord ⟨a.1, Sum.inr i⟩) + have hpoint := (PiLp.norm_apply_le (mixedRealPoint (euclideanSubspace (U a.1)) + (b a.1) (o a.1) ((fun i => R a.1 * v ⟨a.1, Sum.inl i⟩), + fun i => R a.1 * v ⟨a.1, Sum.inr i⟩)) a.2).trans hrow + change ‖mixedRealPoint (euclideanSubspace (U a.1)) (b a.1) (o a.1) + ((fun i => R a.1 * v ⟨a.1, Sum.inl i⟩), + fun i => R a.1 * v ⟨a.1, Sum.inr i⟩) a.2‖ ≤ _ + apply hpoint.trans + calc + _ = (s.inverse a.1 * ((Fintype.card (I a.1) : ℝ) + 1) * R a.1) * ‖v‖ := by ring + _ ≤ 1 * ‖v‖ := mul_le_mul_of_nonneg_right (s.inverse_radius_le_one hR a.1) (norm_nonneg v) + _ = ‖v‖ := one_mul _ + +theorem nativePullbackLip_le {Lip : ℝ≥0} (hτ1 : τ ≤ 1) : + Lip * max ‖τ / 8‖₊ (forecastNativeAmbientLip U b o R) ≤ Lip := by + have hτnorm : ‖τ / 8‖₊ ≤ (1 : ℝ≥0) := by + change ‖τ / 8‖ ≤ (1 : ℝ) + rw [Real.norm_of_nonneg (div_nonneg s.hτ.le (by norm_num))] + linarith + exact (mul_le_mul_of_nonneg_left (max_le hτnorm (s.nativeAmbientLip_le_one hR o)) + (show 0 ≤ Lip from zero_le)).trans_eq + (mul_one _) + +theorem nativePullback_lipschitz {periodCap coverCap : ℝ} {Lip : ℝ≥0} + (hτ1 : τ ≤ 1) + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (P : LayerSamplerAxis I n → Prop) [DecidablePred P] + (residue : X → ZMod W.modulus) (deck : (Σ j, J j) → ZMod W.cover) + (center : X → ℝ) (frozen : {a : LayerSamplerAxis I n // P a} → ℝ) : + LipschitzWith Lip (W.forecastPullback U b o R P residue deck center τ frozen) := + (W.forecastPullback_lipschitz U b o R P residue deck center τ frozen).weaken + (s.nativePullbackLip_le hR o hτ1) + +end ActualFixedSpatialForecastSetup +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod Lrank : ℕ} {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} +variable {physicalN : X → ℕ} {τ cost : ℝ} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod (allocatedShortIntegerSelection U b S.value) τ (Real.exp (-cost) / 2)) +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv (allocatedPhysicalRootBudget B U b S (fun _ => 0)) + (S.value : ℝ) physicalN τ (Real.exp (-cost) / 2) s.P s.Pbad s.Ppres) + +namespace ActualFixedSpatialSlicedForecastPath + +omit [Fintype Tsp] in +theorem decayConstant_le_exp : + slice.decayConstant ≤ + Real.exp ((s.Pbad + s.Ppres) * ((Dmod + 2 : ℕ) : ℝ) * modularRankChargeFactor m) := + forecastModularCharge_exp_bound m Dmod slice.path.Rbad + (∏ p : slice.path.primes, p.val ^ slice.path.prescribed p.val) + slice.path.RbadBound slice.path.presBound + +omit [Fintype Tsp] in +theorem kernelWidth_lower_of_length + (hHG : ∀ g, Real.exp (-cost) * S.value ≤ (slice.kernelLength g : ℝ)) : + ∀ g, Real.exp (-(cost + 1)) ≤ slice.kernelWidth g := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hexp : Real.exp (-(cost + 1)) ≤ Real.exp (-cost) / 2 := by + have he := mul_le_mul_of_nonneg_right htwo (Real.exp_nonneg (-(cost + 1))) + have heq : Real.exp 1 * Real.exp (-(cost + 1)) = Real.exp (-cost) := by + rw [← Real.exp_add] + congr 1 + ring + rw [heq] at he + linarith + intro g + apply hexp.trans + have hwidth := fixedPathSliceWidth_lower S.positive slice.step_pos (slice.kernelLength_two g) (hHG g) + change Real.exp (-cost) / 2 ≤ (slice.step : ℝ) * ((slice.kernelLength g - 1 : ℕ) : ℝ) / S.value + rw [Nat.cast_sub (show 1 ≤ slice.kernelLength g by have := slice.kernelLength_two g; omega), Nat.cast_one] + exact hwidth + +noncomputable def comparisonGridLog (Pu : ℝ) : ℝ := + max Pu (max (forecastOriginalSmoothBudget m (s.P + (Fintype.card X + 1) * (cost + 1))) + ((s.Pbad + s.Ppres) * ((Dmod + 2 : ℕ) : ℝ) * modularRankChargeFactor m)) + +noncomputable def comparisonPrecisionFloor (d : ℕ) (Pu V E : ℝ) : ℕ := + max (fixedPathSlicedGridMeshFloor s.D 4 V cost (2 * Pu + (E + 4) + 14)) + (forecastJointGridSamplerFloor d (comparisonGridLog s Pu) (E + 4) V s.PK) + +theorem comparisonError_le_exp + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + {Lip : ℝ≥0} {Pu V E Edata Q ξ Mmass : ℝ} + (hcost : 0 ≤ cost) (hPu : 2 ≤ Pu) (hE : 0 ≤ E) + (hDsq : s.D * s.D ≤ Pu) (hAL : (s.L : ℝ) ≤ Real.exp Pu) + (hτ1 : τ ≤ 1) (hLip : (Lip : ℝ) ≤ Real.exp Pu) + (q : ℕ) [NeZero q] (hq : (q : ℝ) ≤ Real.exp V) + (hfloor : comparisonPrecisionFloor s (Dmod + Fintype.card (Σ j, I j)) Pu V E ≤ S.value) + (hHP : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), + Real.exp (-cost) * S.value ≤ (slice.principalLength ⟨a.val,p⟩ : ℝ)) + (hHG : ∀ g, Real.exp (-cost) * S.value ≤ (slice.kernelLength g : ℝ)) + (hξ0 : 0 ≤ ξ) (hξ : ξ ≤ Real.exp (-(2 * Pu + (E + 4) + 14))) + (hM : Mmass ≤ Real.exp Q) (hEdata : E + 8 ≤ Edata) : + let d := Dmod + Fintype.card (Σ j, I j) + let F := 2 * Pu + (E + 4) + 14 + let η := Real.exp (-F) + let t := Real.exp (-fixedPathSlicedPerturbationLog s.D (s.D + Pu + 4) (cost + 1) F m) + let Pg := comparisonGridLog s Pu + slice.comparisonError (Lip := Lip) (ξ := ξ) (t := t) (δ := Real.exp (-cost)) + (ε := 2 * Real.exp cost / S.value) (η := η) (q := q) (hδ := Real.exp_pos _) + (o := o) (δnative := Real.exp (-Edata)) (M := Mmass) (Eprec := Q + E + 8) + (cutoff := forecastJointGridCutoff Pg (E + 4)) + (δgrid := forecastJointGridMesh d Pg (E + 4)) ≤ Real.exp (-E) := by + intro d F η t Pg + obtain ⟨hdout, hdj, hdc⟩ := s.gridDimensions_le + have hNative : ((Lip * max ‖τ / 8‖₊ (forecastNativeAmbientLip U b o R) : ℝ≥0) : ℝ) ≤ + Real.exp Pu := (show ((Lip * max ‖τ / 8‖₊ (forecastNativeAmbientLip U b o R) : ℝ≥0) : ℝ) ≤ + (Lip : ℝ) from s.nativePullbackLip_le hR o hτ1).trans hLip + have hPu0 : 0 ≤ Pu := by linarith + have hPg : 0 ≤ Pg := hPu0.trans (le_max_left _ _) + have hE4 : 0 ≤ E + 4 := by linarith + have hLift : (Fintype.card (PrincipalTupleIndex B (layerSamplerDegree I n)) : ℝ) * m ≤ Pu := + (mul_le_mul s.hD.tuples s.hD.degree (Nat.cast_nonneg _) s.hD.nonneg).trans hDsq + have hsourceFloor : fixedPathSlicedGridMeshFloor s.D 4 V cost F ≤ S.value := + (le_max_left _ _).trans hfloor + have hF : 0 ≤ F := by dsimp only [F]; positivity + have htdata := allocatedFixedPathSlicedPerturbation_chosen_tail (G := G) B U b + s.hD.nonneg hPu0 hcost hF s.hD.tuples s.haxes s.L + (Real.exp_pos (-F)) hAL (by rw [Real.exp_neg, inv_inv]) + have hL := allocatedOriginalSampleFullSliceLip_le_two_exp_of_allAxis B U b S + htdata.1.le htdata.2.1 hLift + let Kφ := Lip * max ‖τ / 8‖₊ (forecastNativeAmbientLip U b o R) + have hKK : (Kφ : ℝ) * allocatedOriginalSampleFullSliceLip B U b S t ≤ + Real.exp (2 * Pu + 2) := by + calc + _ ≤ Real.exp Pu * (2 * Real.exp Pu) := + mul_le_mul hNative hL (NNReal.coe_nonneg _) (Real.exp_nonneg _) + _ = 2 * Real.exp (2 * Pu) := by rw [two_mul Pu, Real.exp_add]; ring + _ ≤ Real.exp 2 * Real.exp (2 * Pu) := + mul_le_mul_of_nonneg_right (by linarith [Real.add_one_le_exp (2 : ℝ)]) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hNative' : (Kφ : ℝ) ≤ Real.exp (2 * Pu + 2) := + hNative.trans (Real.exp_le_exp.mpr (by linarith)) + let HP := fun j : PrincipalTupleIndex + (fun a : {a // ¬allocatedShortAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) => slice.principalLength ⟨j.1.val,j.2⟩ + have hcard : (Fintype.card (PrincipalTupleIndex + (fun a : {a // ¬allocatedShortAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val)) : ℝ) ≤ s.D := + (Nat.cast_le.mpr (allocatedOriginalSampleLiftInput_card_le_allAxis B U b S)).trans s.hD.tuples + have hprec : F = (2 * Pu + 2) + (E + 4) + 12 := by dsimp only [F]; ring + have hsrc := fixedPathSlicedSourceErrorBudget_of_floor s.hD.nonneg + (by linarith : 2 ≤ 2 * Pu + 2) hE4 HP slice.kernelLength hcard s.hD.kernel_variables + (NeZero.pos q) hq (by simpa only [hprec] using hsourceFloor) + (fun j => hHP j.1 j.2) hHG (by positivity) Kφ.coe_nonneg hξ0 hKK hNative' + (by simpa only [← hprec] using hξ) + have hwidth := slice.kernelWidth_lower_of_length s hHG + have hdensity := slice.density_uniform_budget s.hBactive s.hP s.hδslice s.hδsliceInv + s.hX (s.haxes.trans s.hDP) s.hblocks (by linarith : 0 ≤ cost + 1) hwidth + have hsm : forecastOriginalSmoothBudget m (s.P + (Fintype.card X + 1) * (cost + 1)) ≤ Pg := + (le_max_left _ _).trans (le_max_right _ _) + have hdec : (s.Pbad + s.Ppres) * ((Dmod + 2 : ℕ) : ℝ) * modularRankChargeFactor m ≤ Pg := + (le_max_right _ _).trans (le_max_right _ _) + have hC := (show (fixedSpatialOriginalForecastCap B (slice.slicedBlockEquiv true) s.hδslice : ℝ) ≤ + Real.exp (forecastOriginalSmoothBudget m (s.P + (Fintype.card X + 1) * (cost + 1))) by + linarith [hdensity.1]).trans (Real.exp_le_exp.mpr hsm) + have hLgrid := hdensity.2.1.trans (Real.exp_le_exp.mpr hsm) + have hDgrid := (slice.decayConstant_le_exp s).trans (Real.exp_le_exp.mpr hdec) + have hKgrid : (Kφ : ℝ) ≤ Real.exp Pg := + hNative.trans (Real.exp_le_exp.mpr (le_max_left _ _)) + unfold comparisonError + rw [slice.ambientGridError_eq_forecastJointGridError, + allocatedSlicedPhysicalComparisonError_eq_sourceError] + have htotal := fixedPathSlicedAmbientScalarPrecision_error _ _ _ d hdout hdj hdc hPg hE + hsrc.2.2 hM (Real.rpow_nonneg (Nat.cast_nonneg _) _) (NNReal.coe_nonneg _) + (NNReal.coe_nonneg _) Kφ.coe_nonneg hDgrid hLgrid hC hKgrid + (forecastJointGridMesh_bounds d hPg hE4).1.le le_rfl + have hδnative : Real.exp (-Edata) ≤ Real.exp (-(E + 8)) := + Real.exp_le_exp.mpr (neg_le_neg hEdata) + simp only [η, hprec, Kφ, HP, add_assoc, NNReal.coe_mul, decayConstant] at htotal ⊢ + linarith only [htotal, hδnative] + +include hR in +omit [DecidableEq X] in +theorem comparisonPrecision_grid_mesh + {Pu V E : ℝ} (hPu : 0 ≤ Pu) (hE : 0 ≤ E) + (d q : ℕ) (hq : (q : ℝ) ≤ Real.exp V) + (hfloor : comparisonPrecisionFloor s d Pu V E ≤ S.value) + (hN : ∀ i, Real.exp (forecastJointGridAmbientLog d (comparisonGridLog s Pu) + (E + 4) V s.Pτ) ≤ (physicalN i : ℝ)) : + ∀ j, (((q * forecastJointGridCutoff (comparisonGridLog s Pu) (E + 4) : ℕ) : ℝ) / + forecastJointGridScale U b R S.value physicalN τ j) ≤ + forecastJointGridMesh d (comparisonGridLog s Pu) (E + 4) := by + apply forecastJointGridScale_mesh_of_floor U b d (hPu.trans (le_max_left _ _)) + (by linarith : 0 ≤ E + 4) hR s.hτ q S.value physicalN hq s.hτinv + (fun j => (s.hK j).trans s.hKBound) _ hN + exact (le_max_right _ _).trans hfloor + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod Lrank : ℕ} {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} +variable {physicalN : X → ℕ} {τ cost : ℝ} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod (allocatedShortIntegerSelection U b S.value) τ (Real.exp (-cost) / 2)) +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv (allocatedPhysicalRootBudget B U b S (fun _ => 0)) + (S.value : ℝ) physicalN τ (Real.exp (-cost) / 2) s.P s.Pbad s.Ppres) + +namespace ActualFixedSpatialSlicedForecastPath + +omit [Fintype Tsp] in + +theorem comparisonPrecision_geometry + {Pu V E : ℝ} (hPu : 2 ≤ Pu) (hE : 0 ≤ E) + (d q : ℕ) (hq0 : 0 < q) (hq : (q : ℝ) ≤ Real.exp V) + (hfloor : comparisonPrecisionFloor s d Pu V E ≤ S.value) + (hHP : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), + Real.exp (-cost) * S.value ≤ (slice.principalLength ⟨a.val,p⟩ : ℝ)) + (hHG : ∀ g, Real.exp (-cost) * S.value ≤ (slice.kernelLength g : ℝ)) : + (∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), + 2 ≤ slice.principalLength ⟨a.val,p⟩ ∧ q ≤ slice.principalLength ⟨a.val,p⟩ ∧ + scalarCubeGridBoundaryConstant Empty * + ((q : ℝ) / slice.principalLength ⟨a.val,p⟩) < 1) ∧ + (∀ g, 2 ≤ slice.kernelLength g ∧ q ≤ slice.kernelLength g ∧ + scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / slice.kernelLength g) < 1) ∧ + (∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), + Real.exp (-cost) * S.value ≤ + ((integerProgressionSupport (slice.principalStart ⟨a.val,p⟩) (slice.step : ℤ) + (slice.principalLength ⟨a.val,p⟩)).card : ℝ)) := by + let HP := fun j : PrincipalTupleIndex + (fun a : {a // ¬allocatedShortAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) => slice.principalLength ⟨j.1.val,j.2⟩ + have hcard : (Fintype.card (PrincipalTupleIndex + (fun a : {a // ¬allocatedShortAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val)) : ℝ) ≤ s.D := + (Nat.cast_le.mpr (allocatedOriginalSampleLiftInput_card_le_allAxis B U b S)).trans s.hD.tuples + have hF : 0 ≤ 2 * Pu + (E + 4) + 14 := by linarith + have hsource : fixedPathSlicedGridMeshFloor s.D 4 V cost (2 * Pu + (E + 4) + 14) ≤ S.value := + (le_max_left _ _).trans hfloor + have hp := fixedPathSlicedGridMesh_of_floor s.hD.nonneg (by norm_num : (0 : ℝ) ≤ 4) + hF HP hcard hq0 hq hsource (fun j => hHP j.1 j.2) + (fun _ => (0 : ℝ)) (fun _ => by positivity) + have hg := fixedPathSlicedGridMesh_of_floor s.hD.nonneg (by norm_num : (0 : ℝ) ≤ 4) + hF slice.kernelLength s.hD.kernel_variables hq0 hq hsource hHG + (fun _ => (0 : ℝ)) (fun _ => by positivity) + refine ⟨fun a p => hp.2.2.2 ⟨a,p⟩, hg.2.2.2, ?_⟩ + intro a p + rw [card_integerProgressionSupport _ _ _ slice.step_pos] + exact hHP a p + +omit [DecidableEq X] [Fintype Tsp] in + +theorem comparisonPrecision_tail + {Pu E : ℝ} (hcost : 0 ≤ cost) (hPu : 2 ≤ Pu) (hE : 0 ≤ E) + (hAL : (s.L : ℝ) ≤ Real.exp Pu) : + let F := 2 * Pu + (E + 4) + 14 + let η := Real.exp (-F) + let t := Real.exp (-fixedPathSlicedPerturbationLog s.D (s.D + Pu + 4) (cost + 1) F m) + 0 < t ∧ t ≤ 1 ∧ 0 < η ∧ η ≤ 1 ∧ + |t| * polynomialMassC2Budget + (Fintype.card (Σ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val))) m 1 ≤ + slicedPrincipalC2Tolerance + (Fintype.card (Σ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val))) + (Fintype.card {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}) m 1 + (unitProfilePrincipalLowerBound B) (Real.exp (-cost) / 2) s.L η := by + intro F η t + have hF : 0 ≤ F := by dsimp only [F]; linarith + have hη : 0 < η := Real.exp_pos _ + have ht := allocatedFixedPathSlicedPerturbation_chosen_tail (G := G) B U b + s.hD.nonneg (by linarith : 0 ≤ Pu) hcost hF s.hD.tuples s.haxes s.L + hη hAL (by dsimp only [η]; rw [Real.exp_neg, inv_inv]) + exact ⟨ht.1, ht.2.1, hη, Real.exp_le_one_iff.mpr (neg_nonpos.mpr hF), ht.2.2 S⟩ + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial.ActualFixedSpatialSlicedForecastPath +open scoped BigOperators NNReal + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {X : Type} [Fintype X] {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod : ℕ} {τ cost : ℝ} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod (allocatedShortIntegerSelection U b S.value) τ (Real.exp (-cost) / 2)) + +theorem comparisonPrecisionFloor_pos (d : ℕ) (Pu V E : ℝ) : + 0 < comparisonPrecisionFloor s d Pu V E := + (fixedPathSlicedGridMeshFloor_pos _ _ _ _ _).trans_le (le_max_left _ _) + +theorem comparisonPrecisionFloor_le_exp (d : ℕ) {Pu V E : ℝ} + (hPu : 0 ≤ Pu) (hV : 0 ≤ V) (hcost : 0 ≤ cost) (hE : 0 ≤ E) : + (comparisonPrecisionFloor s d Pu V E : ℝ) ≤ + Real.exp (allocatedFixedPathSlicedAmbientFloorLog d s.D Pu V cost E + (comparisonGridLog s Pu) s.PK) := by + have hfour : (4 : ℝ) ≤ Real.exp 2 := by + have h := Real.quadratic_le_exp_of_nonneg (by norm_num : (0 : ℝ) ≤ 2) + norm_num at h + linarith + have hF : 0 ≤ 2 * Pu + (E + 4) + 14 := by positivity + have hsrc := fixedPathSlicedGridMeshFloor_le_exp_of_prefactor s.hD.nonneg + (by norm_num : (0 : ℝ) ≤ 4) (by norm_num) hfour hV hcost hF + have hgrid := forecastJointGridSamplerFloor_le_exp d + (hPu.trans (le_max_left _ _) : 0 ≤ comparisonGridLog s Pu) + (show 0 ≤ E + 4 by linarith) hV s.hPK + unfold comparisonPrecisionFloor + rw [Nat.cast_max] + apply max_le + · apply hsrc.trans (Real.exp_le_exp.mpr _) + apply le_trans _ (le_max_left _ _) + linarith + · exact hgrid.trans (Real.exp_le_exp.mpr (le_max_right _ _)) + +end Erdos3.VectorPolynomial.ActualFixedSpatialSlicedForecastPath + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory BooleanCubeKernel +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod Lrank : ℕ} {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} +variable {physicalN : X → ℕ} {τ cost : ℝ} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) + B U b S Dmod (allocatedShortIntegerSelection U b S.value) τ (Real.exp (-cost) / 2)) +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv (allocatedPhysicalRootBudget B U b S (fun _ => 0)) + (S.value : ℝ) physicalN τ (Real.exp (-cost) / 2) s.P s.Pbad s.Ppres) + +namespace ActualFixedSpatialSlicedForecastPath + +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = + projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable {periodCap coverCap : ℝ} {Lip : ℝ≥0} +variable (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) +variable (originalpoly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hmem : ∀ j d, coefficients (originalpoly j) d ∈ U j) +variable (hdegree : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (originalpoly j)) +variable (ξ : ℝ) (hξ : 0 < ξ) +variable (hbox : ∀ x, 0 < physicalN x) +variable (hframe : slice.path.noise ∈ rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ physicalN) 1) +variable {Pu V E : ℝ} +variable (hσbound : ∀ j, |σ j| ≤ Real.exp (-fixedPathSlicedPerturbationLog + s.D (s.D + Pu + 4) (cost + 1) (2 * Pu + (E + 4) + 14) m)) +variable (q : ℕ) [NeZero q] +variable (hperiod : W.modulus ∣ q) (hcover : W.cover ∣ q) +variable (hqN : q ∣ slice.path.referenceModulus) +variable [hlattice : ∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) + (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] +variable [hcompact : CompactSpace (EuclideanJetLayers U (fun _ : Fin m => Unit))] +variable (hmargin : ∀ i, 2 * spatialTrimMargin τ physicalN i ≤ physicalN i) +variable (htrimbase : slice.path.base ∈ trimmedIntegerBox physicalN (spatialTrimMargin τ physicalN)) + +variable {Pnative massLog capLog Edata Ptest : ℝ} +variable (data : ActualForecastData physicalN originalpoly Pnative massLog capLog Edata) +variable (hcenter : data.centerConstant = fun j => (slice.path.center j).val) +variable (hκ : s.κ = forecastGeometricJacobian (X := X) (I := I) U b R S.value (∏ a, (basisAxisScale (b ((allocatedShortIntegerSelection U b S.value) a).1) ((allocatedShortIntegerSelection U b S.value) a).2 : ℝ)) τ) +variable (hUniversal : ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖slice.targetAt (allocatedShortIntegerSelection U b S.value) s.hBactive o bW hb poly hm s.κ u - + ∑ i, data.coefficient i * (data.twists i).eval physicalN + (fun j => subtractConstant (data.centerConstant j) (poly j)) u‖ ≤ Real.exp (-Edata)) +variable (hPtest : 0 ≤ Ptest) (hLw : (Lip : ℝ) ≤ Real.exp Ptest) +variable (hpw : periodCap ≤ Real.exp Ptest) (hcw : coverCap ≤ Real.exp Ptest) +variable {Rrank : ℝ} (hEprec : 0 ≤ massLog + E + 8) +variable (hlarge : ∀ i, Real.exp ((max (max s.P (2 * max Ptest (3 * Pnative + 3) + 1)) (massLog + E + 8) + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ (physicalN i : ℝ)) +variable (hRrank : Real.exp ((max (max s.P (2 * max Ptest (3 * Pnative + 3) + 1)) (massLog + E + 8) + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ Rrank) +variable (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (physicalN i : ℝ)) + Rrank (U j) (originalpoly j)) +variable (C : ℝ) +variable {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} +variable {sampleFn : (Option (LayerSamplerVariables G I n B) × X → ℤ) → + CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n} +variable {readFn : (Option (LayerSamplerVariables G I n B) × X → ℤ) → + AllocatedActualCoefficientIndex G X I Eout n B → ℤ} +variable (hglobal : AllocatedCenteredRecoveredSampleReadAt B U bW b hb o S hR hσ + originalpoly hmem (allocatedShortAxis (I := I) U b S.value) spatial kernel block C + center slice.path.center slice.path.base sampleFn readFn) +variable (hz : allocatedCenteredJointDensity B U b hb o hR hσ S originalpoly hmem + center slice.path.base slice.path.noise ≠ 0) +variable (hsampleAt : sampleFn slice.path.noise = slice.path.sample) +variable (hreadAt : readFn slice.path.noise = slice.path.read) + +variable (hfinite : (integerBox physicalN).Nonempty) +variable (htarget : data.target = slice.target (allocatedShortIntegerSelection U b S.value) + s.hBactive o bW hb originalpoly hmem s.κ) +variable (hcost : 0 ≤ cost) (hPu : 2 ≤ Pu) (hE : 0 ≤ E) +variable (hDsq : s.D * s.D ≤ Pu) (hAL : (s.L : ℝ) ≤ Real.exp Pu) +variable (hτ1 : τ ≤ 1) (hLip : (Lip : ℝ) ≤ Real.exp Pu) +variable (hq : (q : ℝ) ≤ Real.exp V) +variable (hfloor : comparisonPrecisionFloor s (Dmod + Fintype.card (Σ j, I j)) Pu V E ≤ S.value) +variable (hHP : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), + Real.exp (-cost) * S.value ≤ (slice.principalLength ⟨a.val,p⟩ : ℝ)) +variable (hHG : ∀ g, Real.exp (-cost) * S.value ≤ (slice.kernelLength g : ℝ)) +variable (hstep : (slice.step : ℝ) ≤ 2 * Real.exp cost) +variable (hξsmall : ξ ≤ Real.exp (-(2 * Pu + (E + 4) + 14))) +variable (hEdata : E + 8 ≤ Edata) +variable (hNgrid : ∀ i, Real.exp (forecastJointGridAmbientLog + (Dmod + Fintype.card (Σ j, I j)) (comparisonGridLog s Pu) + (E + 4) V s.Pτ) ≤ (physicalN i : ℝ)) + +include hR hσ hdegree hξ hbox hframe hσbound hperiod hcover hqN + ν hlattice hcompact hmargin htrimbase hcenter hκ hUniversal hPtest hLw hpw hcw + hEprec hlarge hRrank hrank hglobal hz hsampleAt hreadAt hfinite htarget + hcost hPu hE hDsq hAL hτ1 hLip hq hfloor hHP hHG hstep hξsmall hEdata hNgrid in + +theorem native_ambient_model_precision : + ‖slice.nativeMean s W originalpoly - + (FiniteProbabilityWeights.uniformFinset (integerBox physicalN) hfinite).complexMean + (fun u => W.eval physicalN + (fun j => subtractConstant (data.centerConstant j) (originalpoly j)) u.val * + data.target u)‖ ≤ Real.exp (-E) := by + have hPu0 : 0 ≤ Pu := by linarith + have hE4 : 0 ≤ E + 4 := by linarith + have hPg : 0 ≤ comparisonGridLog s Pu := hPu0.trans (le_max_left _ _) + have hgeom := slice.comparisonPrecision_geometry s hPu hE + (Dmod + Fintype.card (Σ j, I j)) q (NeZero.pos q) hq hfloor hHP hHG + have htail := comparisonPrecision_tail s hcost hPu hE hAL + have hgrid := comparisonPrecision_grid_mesh s (hR := hR) hPu0 hE + (Dmod + Fintype.card (Σ j, I j)) q hq hfloor hNgrid + have hgridbounds := forecastJointGridMesh_bounds + (Dmod + Fintype.card (Σ j, I j)) hPg hE4 + have hcomp := slice.native_ambient_model_comparison + (s := s) (hb := hb) (o := o) (bW := bW) (W := W) (originalpoly := originalpoly) + (hmem := hmem) (hdegree := hdegree) (ξ := ξ) (hξ := hξ) (hbox := hbox) + (hframe := hframe) (ht := htail.1) (hσbound := hσbound) + (hδ := Real.exp_pos (-cost)) + (hδone := Real.exp_le_one_iff.mpr (neg_nonpos.mpr hcost)) + (hdense := hgeom.2.2) (q := q) (hperiod := hperiod) (hcover := hcover) (hqN := hqN) + (hsizeG := fun g => (hgeom.2.1 g).2.1) + (hsmallG := fun g => (hgeom.2.1 g).2.2) + (hsize := fun a p => (hgeom.1 a p).2.1) + (hsmall := fun a p => (hgeom.1 a p).2.2) + (ε := 2 * Real.exp cost / S.value) (hε := by positivity) + (hmesh := div_le_div_of_nonneg_right hstep (Nat.cast_nonneg S.value)) + (hη := htail.2.2.1) (htail := htail.2.2.2.2) + (ν := ν) (hmargin := hmargin) (htrimbase := htrimbase) + (data := data) (hcenter := hcenter) (hκ := hκ) (hUniversal := hUniversal) + (hPtest := hPtest) (hLw := hLw) (hpw := hpw) (hcw := hcw) + (hEprec := hEprec) (hlarge := hlarge) (hRrank := hRrank) (hrank := hrank) + (cutoff := forecastJointGridCutoff (comparisonGridLog s Pu) (E + 4)) + (hcutoff := forecastJointGridCutoff_pos hPg hE4) + (hδgrid := hgridbounds.1.le) (hδgrid1 := hgridbounds.2) (hgridmesh := hgrid) + (C := C) (hglobal := hglobal) (hz := hz) (hsampleAt := hsampleAt) + (hreadAt := hreadAt) (hfinite := hfinite) (htarget := htarget) + exact hcomp.trans (slice.comparisonError_le_exp s o hcost hPu hE hDsq hAL + hτ1 hLip q hq hfloor hHP hHG hξ.le hξsmall le_rfl hEdata) + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedPrimitiveGeometry.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedPrimitiveGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..dac3444cf9438da21b340f6879496938fdec8af4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedPrimitiveGeometry.lean @@ -0,0 +1,101 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedExternalLocalGoodForecastPath + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {A : Type} [Fintype A] +variable {Dmod : ℕ} {selected : A → Σ j : Fin m, Fin (n j)} +variable {τ δslice : ℝ} + +namespace ActualFixedSpatialForecastSetup +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) B U b S Dmod selected τ δslice) + +noncomputable def slicedGeometryDimension : ℝ := s.P + (layerTailDegree m + 1 : ℕ) + 1 +noncomputable def slicedGeometryRadiusLog : ℝ := s.P + s.Pscale + +omit [DecidableEq X] in +theorem sliced_primitive_geometry_bounds (hR : ∀ j, 0 < R j) : + 1 ≤ s.slicedGeometryDimension ∧ + (Fintype.card A : ℝ) ≤ s.slicedGeometryDimension ∧ + (∀ a, (((selected a).1.val + 1 : ℕ) : ℝ) ≤ s.slicedGeometryDimension) ∧ + ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ s.slicedGeometryDimension ∧ + (∀ a, (Fintype.card (B ⟨(selected a).1, Sum.inr (selected a).2⟩) : ℝ) ≤ s.slicedGeometryDimension) ∧ + 0 ≤ s.slicedGeometryRadiusLog ∧ + (∀ a, 0 < R (selected a).1) ∧ + (∀ a, R (selected a).1 ≤ Real.exp s.slicedGeometryRadiusLog) ∧ + (∀ a, (R (selected a).1)⁻¹ ≤ Real.exp s.slicedGeometryRadiusLog) ∧ + (∀ a, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) + ((selected a).1.val + 1)) : ℝ) ≤ Real.exp s.slicedGeometryRadiusLog) := by + have hP0 : 0 ≤ s.P := zero_le_one.trans s.hP + have hPD : s.P ≤ s.slicedGeometryDimension := by + dsimp [slicedGeometryDimension] + have := Nat.cast_nonneg (α := ℝ) (layerTailDegree m + 1) + linarith + have hDg : s.D ≤ s.slicedGeometryDimension := s.hDP.trans hPD + have hvg : 0 ≤ s.slicedGeometryRadiusLog := add_nonneg hP0 s.hPscale + have hPvg : s.P ≤ s.slicedGeometryRadiusLog := le_add_of_nonneg_right s.hPscale + have hScalevg : s.Pscale ≤ s.slicedGeometryRadiusLog := le_add_of_nonneg_left hP0 + have hcardA : (Fintype.card A : ℝ) ≤ s.D := + (Nat.cast_le.mpr (Fintype.card_le_of_injective selected s.hselected)).trans + (allocatedIntegerAxes_card_le B (fun _ => Finset.univ : Fin m → Finset (Finset Empty)) s.hD) + refine ⟨s.hP.trans hPD, hcardA.trans hDg, ?_, ?_, ?_, hvg, + fun a => hR (selected a).1, ?_, ?_, ?_⟩ + · intro a + exact (s.hD.layer_degree B (selected a).1).trans hDg + · dsimp [slicedGeometryDimension] + linarith + · intro a + have hblock : (Fintype.card (B ⟨(selected a).1, Sum.inr (selected a).2⟩) : ℝ) ≤ + ∑ v : LayerSamplerAxis I n, (Fintype.card (B v) : ℝ) := + Finset.single_le_sum + (f := fun v : LayerSamplerAxis I n => (Fintype.card (B v) : ℝ)) + (fun _ _ => Nat.cast_nonneg _) + (Finset.mem_univ (⟨(selected a).1, Sum.inr (selected a).2⟩ : LayerSamplerAxis I n)) + exact (hblock.trans s.hblocks).trans hPD + · intro a + exact (s.hR1 a).trans (Real.one_le_exp_iff.mpr hvg) + · intro a + exact (s.hRinv a).trans (Real.exp_le_exp.mpr hScalevg) + · intro a + exact ((s.hD.coefficients (selected a).1).trans s.hDP).trans + ((by linarith [Real.add_one_le_exp s.P] : s.P ≤ Real.exp s.P).trans + (Real.exp_le_exp.mpr hPvg)) + +omit [DecidableEq X] [Fintype A] in +theorem sliced_ambient_coordinate_cutoff_bounds : + let Lcoord := s.K * ∑ j, s.forward j * Fintype.card (J j) + let Lcut := (Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / + (2 * s.radius)) * Lcoord + (Lcoord : ℝ) ≤ Real.exp (s.PK + s.PF + s.D) ∧ + (Lcut : ℝ) ≤ Real.exp (s.PK + s.PF + 2 * s.D + normalizedSiteCutoffBound + 1) := by + apply forecast_ambient_coordinate_cutoff_exp_bounds s.forward s.K s.radius + s.hD.nonneg s.hPK s.hPF s.hdim s.haxes s.hforwardBound s.hKBound + have h3 := s.hr3 + change (1 : ℝ) ≤ (s.radius : ℝ) + linarith + +omit [DecidableEq X] [Fintype A] in +theorem sliced_spatial_coordinate_bound : + (max ⟨8 / τ, by have := s.hτ; positivity⟩ 1 : ℝ≥0) ≤ + ⟨Real.exp (s.Pτ + 8), Real.exp_nonneg _⟩ := + forecast_spatial_coordinate_exp_bound s.hτ s.hPτ s.hτinv + +end ActualFixedSpatialForecastSetup +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedSourceLog.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedSourceLog.lean new file mode 100644 index 0000000000000000000000000000000000000000..489ed94faaad88961c8da473e833b38e2a16aecb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedSourceLog.lean @@ -0,0 +1,79 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedExternalLocalGoodForecastPath + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial.ActualFixedSpatialForecastSetup +open scoped BigOperators NNReal + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {X : Type} [Fintype X] {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {A : Type} [Fintype A] {Dmod : ℕ} {selected : A → Σ j, Fin (n j)} +variable {τ δslice : ℝ} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) B U b S Dmod selected τ δslice) + +omit [Fintype A] in +theorem transitionLip_le_Pcap : (s.L : ℝ) ≤ s.Pcap := by + have h := s.hprimitiveCap + have hpad : 0 ≤ paddedResidueDensityCap Empty 1 := by + unfold paddedResidueDensityCap scalarCubeResidueDensityCap + positivity + norm_num [scalarCubePrimitiveEnvelope, scalarCubeCutoffDerivativeNumerator, + scalarCubeGridBoundaryConstant] at h + linarith [s.L.coe_nonneg] + +omit [Fintype A] in +theorem transitionLip_le_exp : (s.L : ℝ) ≤ Real.exp s.pcap := + s.transitionLip_le_Pcap.trans s.hPcapp + +end Erdos3.VectorPolynomial.ActualFixedSpatialForecastSetup + +end + +section + +namespace Erdos3.VectorPolynomial.ActualFixedSpatialForecastSetup +open scoped BigOperators NNReal + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {X : Type} [Fintype X] {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {A : Type} {Dmod : ℕ} {selected : A → Σ j, Fin (n j)} +variable {τ δslice : ℝ} +variable (s : ActualFixedSpatialForecastSetup (X := X) (Eout := Eout) B U b S Dmod selected τ δslice) + +noncomputable def slicedComparisonSourceLog (Ptest : ℝ) : ℝ := + 2 + s.D * s.D + s.pcap + max 0 Ptest + +theorem slicedComparisonSourceLog_bounds (Ptest : ℝ) : + 2 ≤ s.slicedComparisonSourceLog Ptest ∧ + s.D * s.D ≤ s.slicedComparisonSourceLog Ptest ∧ + (s.L : ℝ) ≤ Real.exp (s.slicedComparisonSourceLog Ptest) ∧ + Ptest ≤ s.slicedComparisonSourceLog Ptest := by + have hD := mul_self_nonneg s.D + have hc := s.hpcap + have hmax : 0 ≤ max 0 Ptest := le_max_left _ _ + have htest : Ptest ≤ max 0 Ptest := le_max_right _ _ + have hpc : s.pcap ≤ s.slicedComparisonSourceLog Ptest := by + unfold slicedComparisonSourceLog + linarith + refine ⟨?_, ?_, s.transitionLip_le_exp.trans (Real.exp_le_exp.mpr hpc), ?_⟩ <;> + unfold slicedComparisonSourceLog <;> linarith + +end Erdos3.VectorPolynomial.ActualFixedSpatialForecastSetup + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedTargetReal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedTargetReal.lean new file mode 100644 index 0000000000000000000000000000000000000000..a86a49c2d7792ec046c069f1b429344484084bb3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ActualFixedSpatialSlicedTargetReal.lean @@ -0,0 +1,467 @@ +import OAI.Combinatorics.Progressions.Lattices.BoundedPrimeDepthBudget +import OAI.Combinatorics.Progressions.Polynomial.ActualFixedSpatialPhysicalPolynomialRange +import OAI.Combinatorics.Progressions.Sampling.ActualSlicedForecastLateData +import OAI.Combinatorics.Progressions.Sampling.ForecastLawPhysicalTargetReal + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +noncomputable def referenceModulus : ℕ := ∏ p : path.primes, p.val ^ path.exponent p.val + +omit [Fintype Tsp] in +theorem referenceModulus_pos : 0 < path.referenceModulus := by + apply Finset.prod_pos + intro p _ + exact pow_pos (path.prime p.val p.property).pos _ + +local instance actualPathReferenceNeZero : NeZero path.referenceModulus := + ⟨path.referenceModulus_pos.ne'⟩ + +noncomputable def referencePolynomial := + allocatedForecastPolynomial (allocatedShortAxis (I := I) U b S.value) path.base path.noise + (allocatedReadDeck path.read) (fun j a => allocatedReadProjection path.read ⟨j,a.val⟩) + +noncomputable def referenceInputLaw : FiniteProbabilityWeights + (LayerSamplerLongVariables (allocatedShortAxis (I := I) U b S.value) G B → + ZMod path.referenceModulus) := by + letI := path.primeNeZero + exact crtPolynomialInputLaw (fun p : path.primes => p.val) + (fun p : path.primes => path.exponent p.val) (fun p : path.primes => path.prescribed p.val) + (primePower_crt_coprime (fun p : path.primes => p.val) + (fun p : path.primes => path.exponent p.val) + (fun p => path.prime p.val p.property) Subtype.val_injective) path.origin + +omit [Fintype Tsp] in +theorem reference_characteristic_decay (hm : 0 < m) + (y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U b S)) + (χ : AddChar (Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) ℂ) : + ‖finiteImageCharacteristic path.referenceInputLaw + (fun t j => (integerLongPolynomialOutput path.referencePolynomial + (fun k => (y k.1 k.2 : ℤ)) path.referenceModulus t j : ZMod path.referenceModulus)) χ‖ ≤ + ((path.Rbad * ∏ p : path.primes, p.val ^ path.prescribed p.val : ℕ) : ℝ) ^ + (modularRankDecayExponent m (modularForecastRankConstant m Dmod : ℝ) * + modularRankChargeFactor m) * + (orderOf χ : ℝ) ^ (-modularRankDecayExponent m (modularForecastRankConstant m Dmod : ℝ)) := by + let _ := path.primeNeZero + exact allocatedForecastPolynomial_crt_decay_of_bad_product + (allocatedShortAxis (I := I) U b S.value) path.noise (allocatedReadDeck path.read) + (fun j a => allocatedReadProjection path.read ⟨j,a.val⟩) spatial kernel block + hm path.primes path.exponent path.prescribed path.prime + (modularForecastRankConstant m Dmod : ℝ) (Nat.cast_nonneg _) path.Rbad path.hbad + path.base path.origin (fun k => (y k.1 k.2 : ℤ)) χ + +end ActualFixedSpatialForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3 + +theorem boundedPrimes_log_prime_power_le_slicedTargetReal (Q : ℕ) : + ∀ p ∈ boundedPrimes Q, p ^ Nat.log p Q ≤ Q := by + intro p hp + exact boundedPrimePower_le Q ⟨p, hp⟩ + +theorem boundedPrimes_prime_slicedTargetReal (Q : ℕ) : + ∀ p ∈ boundedPrimes Q, p.Prime := by + intro p hp + exact ((mem_boundedPrimes Q p).mp hp).1 + +namespace VectorPolynomial + +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j, a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice P Pbad Ppres : ℝ} + +namespace ActualFixedSpatialForecastPath + +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +omit [Fintype Tsp] in + +theorem referenceModulus_eq_boundedPrimeProduct_slicedTargetReal (Q : ℕ) + (hprimes : path.primes = boundedPrimes Q) + (hexponent : path.exponent = fun p => Nat.log p Q) : + path.referenceModulus = boundedPrimeProduct Q := by + unfold referenceModulus + rw [hexponent, hprimes] + rfl + +omit [Fintype Tsp] in + +theorem dvd_referenceModulus_of_le_bound_slicedTargetReal (Q : ℕ) + (hprimes : path.primes = boundedPrimes Q) + (hexponent : path.exponent = fun p => Nat.log p Q) + {q : ℕ} (hq : 0 < q) (hqQ : q ≤ Q) : + q ∣ path.referenceModulus := by + rw [path.referenceModulus_eq_boundedPrimeProduct_slicedTargetReal Q hprimes hexponent] + exact boundedPrimeProduct_captures hq hqQ + +end ActualFixedSpatialForecastPath +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem boundedPrimes_log_prime_power_le (Q : ℕ) : + ∀ p ∈ boundedPrimes Q, p ^ Nat.log p Q ≤ Q := by + intro p hp + exact boundedPrimePower_le Q ⟨p, hp⟩ + +theorem boundedPrimes_prime (Q : ℕ) : + ∀ p ∈ boundedPrimes Q, p.Prime := by + intro p hp + exact ((mem_boundedPrimes Q p).mp hp).1 + +namespace VectorPolynomial + +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j, a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice P Pbad Ppres : ℝ} + +namespace ActualFixedSpatialForecastPath + +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +omit [Fintype Tsp] in + +theorem referenceModulus_eq_boundedPrimeProduct (Q : ℕ) + (hprimes : path.primes = boundedPrimes Q) + (hexponent : path.exponent = fun p => Nat.log p Q) : + path.referenceModulus = boundedPrimeProduct Q := by + unfold referenceModulus + rw [hexponent, hprimes] + rfl + +omit [Fintype Tsp] in + +theorem dvd_referenceModulus_of_le_bound (Q : ℕ) + (hprimes : path.primes = boundedPrimes Q) + (hexponent : path.exponent = fun p => Nat.log p Q) + {q : ℕ} (hq : 0 < q) (hqQ : q ≤ Q) : + q ∣ path.referenceModulus := by + rw [path.referenceModulus_eq_boundedPrimeProduct Q hprimes hexponent] + exact boundedPrimeProduct_captures hq hqQ + +end ActualFixedSpatialForecastPath +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +variable {A : Type} [Fintype A] +variable (selected : A → Σ j : Fin m, Fin (n j)) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + 4 ≤ Fintype.card (B a.val)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + +noncomputable def rawTarget (κ : ℝ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ) : ℂ := by + letI : NeZero slice.path.referenceModulus := ⟨slice.path.referenceModulus_pos.ne'⟩ + exact (κ : ℂ) * forecastLawDensityPhysicalTarget B U b S slice.principalLaw + (slice.density hB) selected slice.path.sample slice.path.commonTuple + (fun _ => slice.path.referenceInputLaw) + (fun y t j => integerLongPolynomialOutput slice.path.referencePolynomial + (fun k => (y k.1 k.2 : ℤ)) slice.path.referenceModulus t j) + slice.path.referenceModulus (∏ a, (basisAxisScale (b (selected a).1) (selected a).2 : ℝ)) + slice.path.base physicalN τ o hb bW poly hm u + +theorem targetAt_eq_rawTarget + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) (κ : ℝ) (u : X → ℤ) : + slice.targetAt selected hB o bW hb poly hm κ u = + slice.rawTarget selected hB o bW hb κ (slice.path.physicalPolynomial poly) + (slice.path.physicalPolynomial_mem poly hm) u := by + rfl + +theorem rawTarget_universal_approx + {Findex : Type} [Fintype Findex] {period cover : ℝ} {L : ℝ≥0} + (F : Findex → NormalizedPolynomialTwist X (Σ j, J j) period cover L) + (c : Findex → ℂ) (κ δ : ℝ) + (h : ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖slice.targetAt selected hB o bW hb poly hm κ u - + ∑ i, c i * (F i).eval physicalN (slice.path.physicalPolynomial poly) u‖ ≤ δ) : + ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖slice.rawTarget selected hB o bW hb κ poly hm u - + ∑ i, c i * (F i).eval physicalN poly u‖ ≤ δ := by + apply slice.path.forall_physicalPolynomial_of_universal + (fun poly hm => ∀ u, ‖slice.rawTarget selected hB o bW hb κ poly hm u - + ∑ i, c i * (F i).eval physicalN poly u‖ ≤ δ) + intro poly hm u + simpa only [slice.targetAt_eq_rawTarget selected hB o bW hb poly hm κ u] using h poly hm u + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +variable {A : Type} [Fintype A] +variable (selected : A → Σ j : Fin m, Fin (n j)) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + 4 ≤ Fintype.card (B a.val)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + +theorem rawTarget_actualForecastData_approx + (originalpoly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + {Pnative massLog capLog E : ℝ} + (data : ActualForecastData physicalN originalpoly Pnative massLog capLog E) + (hc : data.centerConstant = fun j => (slice.path.center j).val) + (κ : ℝ) + (h : ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖slice.targetAt selected hB o bW hb poly hm κ u - + ∑ i, data.coefficient i * (data.twists i).eval physicalN + (fun j => subtractConstant (data.centerConstant j) (poly j)) u‖ ≤ Real.exp (-E)) : + ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖slice.rawTarget selected hB o bW hb κ poly hm u - + ∑ i, data.coefficient i * (data.twists i).eval physicalN poly u‖ ≤ Real.exp (-E) := by + apply slice.rawTarget_universal_approx selected hB o bW hb data.twists data.coefficient + κ (Real.exp (-E)) + intro poly hm u + change ‖slice.targetAt selected hB o bW hb poly hm κ u - + ∑ i, data.coefficient i * (data.twists i).eval physicalN + (fun j => subtractConstant (slice.path.center j).val (poly j)) u‖ ≤ Real.exp (-E) + simpa only [hc] using h poly hm u + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +variable {A : Type} [Fintype A] +variable (selected : A → Σ j : Fin m, Fin (n j)) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + 4 ≤ Fintype.card (B a.val)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + +variable (κ : ℝ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +theorem rawTarget_real (u : X → ℤ) : + ((slice.rawTarget selected hB o bW hb κ poly hm u).re : ℂ) = + slice.rawTarget selected hB o bW hb κ poly hm u := by + let : NeZero slice.path.referenceModulus := ⟨slice.path.referenceModulus_pos.ne'⟩ + unfold rawTarget + apply forecastLawDensityPhysicalTarget_scaled_real + +theorem rawTarget_star (u : X → ℤ) : + star (slice.rawTarget selected hB o bW hb κ poly hm u) = + slice.rawTarget selected hB o bW hb κ poly hm u := by + rw [← slice.rawTarget_real selected hB o bW hb κ poly hm u] + simp only [Complex.star_def, Complex.conj_ofReal] + +theorem targetAt_real (u : X → ℤ) : + ((slice.targetAt selected hB o bW hb poly hm κ u).re : ℂ) = + slice.targetAt selected hB o bW hb poly hm κ u := by + rw [slice.targetAt_eq_rawTarget selected hB o bW hb poly hm κ u] + exact slice.rawTarget_real selected hB o bW hb κ _ _ u + +theorem targetAt_star (u : X → ℤ) : + star (slice.targetAt selected hB o bW hb poly hm κ u) = + slice.targetAt selected hB o bW hb poly hm κ u := by + rw [← slice.targetAt_real selected hB o bW hb κ poly hm u] + simp only [Complex.star_def, Complex.conj_ofReal] + +theorem target_real (u : integerBox physicalN) : + ((slice.target selected hB o bW hb poly hm κ u).re : ℂ) = + slice.target selected hB o bW hb poly hm κ u := by + exact slice.targetAt_real selected hB o bW hb κ poly hm u.val + +theorem target_star (u : integerBox physicalN) : + star (slice.target selected hB o bW hb poly hm κ u) = + slice.target selected hB o bW hb poly hm κ u := by + exact slice.targetAt_star selected hB o bW hb κ poly hm u.val + +variable {Pnative massLog capLog E : ℝ} +variable (data : ActualForecastData physicalN poly Pnative massLog capLog E) +variable (htarget : data.target = slice.target selected hB o bW hb poly hm κ) + +include htarget in +theorem actualForecastData_target_real (u : integerBox physicalN) : + ((data.target u).re : ℂ) = data.target u := by + rw [htarget] + exact slice.target_real selected hB o bW hb κ poly hm u + +include htarget in +theorem actualForecastData_target_star (u : integerBox physicalN) : + star (data.target u) = data.target u := by + rw [htarget] + exact slice.target_star selected hB o bW hb κ poly hm u + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedActiveSiteChartValues.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedActiveSiteChartValues.lean new file mode 100644 index 0000000000000000000000000000000000000000..884d820a56d9a353de62d019cc1721347a4edb39 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedActiveSiteChartValues.lean @@ -0,0 +1,116 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedActivePlateauAverage + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical + +universe uα + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (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 (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "O" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset α)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "active" => allocatedActiveGrid B U b S +local notation "activeAxes" => {a : {a // grid a} // active a} +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "split" => coefficientJetAxisSplit O I n grid +local notation "volumeN" => allocatedActiveNaturalVolume B U b S rowSets + +noncomputable def allocatedActiveRowsOfMixed + (z : ∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) + (a : activeAxes) : CoefficientJetAxisRow O a.val.val := (split z).1 a.val + +omit [Fintype α] [DecidableEq α] in +theorem allocatedActiveRowsOfMixed_integer + (z : ∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) (a : activeAxes) : + allocatedGridIntegerValues B U b S rowSets a.val + (allocatedActiveRowsOfMixed B U b S rowSets z a) = (z (ig a.val).1).2 (ig a.val).2 := by + rcases a with ⟨⟨⟨j, i | i⟩, ha⟩, hactive⟩ + · exact False.elim ha + · rfl + +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (d : ℕ) + +omit [∀ j, Fintype (E j)] in +theorem allocatedActiveSiteValues_mixed (z : MixedCoveredJetSource I O E n d) + (s : Finset α) (a : activeAxes) : + allocatedActiveSiteValues B U b S rowSets + (allocatedActiveRowsOfMixed B U b S rowSets z.1) s a = + ((mixedCoveredRowsSiteValue rowSets d z s).1 (ig a.val).1).2 (ig a.val).2 () := by + rw [mixedCoveredRowsSiteValue_integer] + unfold allocatedActiveSiteValues + rw [allocatedActiveRowsOfMixed_integer] + +omit [∀ j, Fintype (E j)] in +theorem allocatedActiveSiteApproximation_mixed + (e : activeAxes → ScalarSiteExpansion.{uα,uα} (Finset α)) + (z : MixedCoveredJetSource I O E n d) : + allocatedActiveSiteApproximation B U b S rowSets e + (allocatedActiveRowsOfMixed B U b S rowSets z.1) = + siteFamilyEval e + (fun s a => ((mixedCoveredRowsSiteValue rowSets d z s).1 (ig a.val).1).2 (ig a.val).2 ()) + (fun s a => (((mixedCoveredRowsSiteValue rowSets d z s).1 (ig a.val).1).2 (ig a.val).2 () : ℝ) / + allocatedGridNaturalScale B U b S a.val) := by + have hy : allocatedActiveSiteValues B U b S rowSets + (allocatedActiveRowsOfMixed B U b S rowSets z.1) = + fun s a => ((mixedCoveredRowsSiteValue rowSets d z s).1 (ig a.val).1).2 (ig a.val).2 () := by + funext s a + exact allocatedActiveSiteValues_mixed B U b S rowSets d z s a + unfold allocatedActiveSiteApproximation + rw [hy] + +variable [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (x : G → IntegerScalarCubeBox α S.value) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable [NeZero d] (q : ℕ) +variable (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U b S)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = principalResidueLabel q y₀))) +variable (f : ((Σ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, + {t : Finset α // t ∈ rowSets (Sigma.fst (Subtype.val a))}) → ℝ) → ℝ) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "laws" => allocatedSupportedGridJetPMF B U b hR hσ S x rows q (principalResidueLabel q y₀) hcell + +noncomputable def allocatedActiveSiteChartPrefactor (z : MixedCoveredJetSource I O E n d) : ℂ := + ((∏ a : {a : {a // grid a} // ¬active a}, (laws a.val ((split z.1).1 a.val)).toReal : ℝ) : ℂ) / + (volumeN : ℂ) * (allocatedWholeMaskedGridlessProfile B U b S x y₀ rows hb o bW d q f (chart z) : ℂ) + +theorem allocatedActiveSiteProfile_mixed + (e : activeAxes → ScalarSiteExpansion.{uα,uα} (Finset α)) + (z : MixedCoveredJetSource I O E n d) + (hz : z ∈ mixedCoveredJetRegion U o b d + (fun j (_ : O j) => standardLatticeClosedQuarterBox (J j))) : + allocatedActiveSiteProfile B U b hR hσ S rowSets x hb o bW d q y₀ hcell f e (chart z) = + allocatedActiveSiteChartPrefactor B U b S rowSets d hR hσ x hb o bW q y₀ hcell f z * + allocatedActiveSiteApproximation B U b S rowSets e + (allocatedActiveRowsOfMixed B U b S rowSets z.1) := by + rw [allocatedActiveSiteProfile, allocatedComplexGridMultiplier_apply B U b S O hb o bW d _ z hz] + unfold allocatedSelectedGridExtension selectedProductExtension allocatedActiveSiteChartPrefactor + allocatedActiveRowsOfMixed + ring + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedActiveSiteSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedActiveSiteSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..3991366da3e4e6b17099e816b3bd97710cfe8c8d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedActiveSiteSupport.lean @@ -0,0 +1,101 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedPhysicalLongIdealCap + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +universe uα + +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 (b : ∀ 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 b R σ) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "gridAxes" => {a // allocatedGridAxis (I := I) U b S.value a} +local notation "activeAxes" => {a : gridAxes // allocatedActiveGrid B U b S a} +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "axisN" => allocatedGridNaturalScale B U b S +local notation "siteH" => (fun a : activeAxes => + allocatedNaturalSiteRadius (G := G) B (Sigma.fst (ig (Subtype.val a))) (Sigma.snd (ig (Subtype.val a))) (rowSets (Sigma.fst (ig (Subtype.val a)))) + 1 / 4) + +noncomputable def allocatedActiveSiteValues + (z : (a : activeAxes) → CoefficientJetAxisRow (rowTypes) a.val.val) + (s : Finset α) (a : activeAxes) : ℤ := + integerBooleanSitesFromRows (rowSets (ig a.val).1) + (allocatedGridIntegerValues B U b S rowSets a.val (z a)) s + +noncomputable def allocatedActiveSiteApproximation + (e : activeAxes → ScalarSiteExpansion.{uα,uα} (Finset α)) + (z : (a : activeAxes) → CoefficientJetAxisRow (rowTypes) a.val.val) : ℂ := + siteFamilyEval e (allocatedActiveSiteValues B U b S rowSets z) + (fun s a => (allocatedActiveSiteValues B U b S rowSets z s a : ℝ) / axisN a.val) + +include hR in +omit [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] in +theorem allocatedActiveSiteApproximation_zero + (e : activeAxes → ScalarSiteExpansion.{uα,uα} (Finset α)) + (hrows : ∀ j t, t ∈ rowSets j → t.card ≤ j.val + 1) + (he : ∀ a i s r v, (siteH) a ≤ |v| → (e a).factor i s r v = 0) + (z : (a : activeAxes) → CoefficientJetAxisRow (rowTypes) a.val.val) + (hz : ∃ a, z a ∉ allocatedGridSiteWindow B rowSets U b S a.val) : + allocatedActiveSiteApproximation B U b S rowSets e z = 0 := by + obtain ⟨a, ha⟩ := hz + rw [allocatedActiveSiteApproximation, siteFamilyEval_eq] + apply Finset.prod_eq_zero (Finset.mem_univ a) + have hH : 0 ≤ (siteH) a := by + have h := allocatedNaturalSiteRadius_nonneg (G := G) B (ig a.val).1 (ig a.val).2 (rowSets (ig a.val).1) + linarith + exact reconstructedSiteEval_zero_off_window (rowSets (ig a.val).1) (e a) + (allocatedGridNaturalScale_pos B U b hR S a.val) (hrows _) hH + (allocatedSiteCoefficientRadius_sites (G := G) B rowSets (ig a.val)) (he a) + (allocatedGridIntegerValues B U b S rowSets a.val (z a)) + (fun h => ha ((allocatedGridSiteWindow_integer B rowSets U b S a.val (z a)).mpr h)) + +variable (x : G → IntegerScalarCubeBox α S.value) +variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (hq : 0 < q) (hsize : (Fintype.card α + 1) * q ≤ S.value) + +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset α)) +local notation "laws" => allocatedSupportedGridJetPMF B U b hR hσ S x (rows) q r hcell + +include hq hsize in +theorem allocatedActiveGridMass_zero_off_site_window + (hrows : ∀ j t, t ∈ rowSets j → t.card ≤ j.val + 1) + (z : (a : activeAxes) → CoefficientJetAxisRow (rowTypes) a.val.val) + (hz : ∃ a, z a ∉ allocatedGridSiteWindow B rowSets U b S a.val) : + (∏ a, (laws a.val (z a)).toReal) = 0 := by + obtain ⟨a, ha⟩ := hz + apply Finset.prod_eq_zero (Finset.mem_univ a) + rw [allocatedSupportedGridJetPMF_integer B U b hR hσ S rowSets x q r hcell] + have hout : ¬∀ t, |(allocatedGridIntegerValues B U b S rowSets a.val (z a) t : ℝ)| ≤ + allocatedNaturalSupportRadius (G := G) B α (ig a.val).1 (ig a.val).2 * axisN a.val := by + intro ht + apply ha + apply allocatedGridSiteWindow_mem B rowSets U b S a.val (z a) + intro t + exact (ht t).trans (mul_le_mul_of_nonneg_right + (allocatedSiteCoefficientRadius_physical (G := G) B rowSets (ig a.val)) (Nat.cast_nonneg _)) + rw [allocatedNaturalPhysicalPoint_zero_off_window B U b hR hσ S (ig a.val).1 (ig a.val).2 + a.property q r hq hsize hcell (allocatedGridIntegerAxis_grid B U b S a.val) + (rowSets (ig a.val).1) (hrows _) x _ hout, ENNReal.toReal_zero] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientBoxTests.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientBoxTests.lean new file mode 100644 index 0000000000000000000000000000000000000000..95e3246983c64b24c20d68fbe57a08d49173a71a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientBoxTests.lean @@ -0,0 +1,1443 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedBufferedSiteTwist +import OAI.Combinatorics.Progressions.Estimates.FiniteWindowVolumeCancellation +import OAI.Combinatorics.Progressions.Lattices.AllocatedNormalizedProductResidueCover + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "labels" => (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod refined) + +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (N : X → ℕ) {τ : ℝ} (mesh : ℝ) (base : X → ℤ) + +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) + +noncomputable def allocatedRecenteredSpatialTwist (r : labels) + (a : ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q) + (t : terms) (s : Finset (Fin dim)) (u : X → ℤ) : ℂ := + physicalResidueSpatialSiteFactor + (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (wholeReference r)) + (allocatedPhysicalCubeDirections B U b S x (wholeReference r)) base + (boundedColumnResidueRepresentative q a) q 4 mesh (trimmedSpatialRootScale τ N q) t s u + +omit [DecidableEq G] [NeZero modulus] in +theorem allocatedRecenteredSpatialTwist_bound (hmesh : 0 < mesh) + (r : labels) (a : ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q) + (t : terms) (s : Finset (Fin dim)) (u : X → ℤ) : + ‖allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base r a t s u‖ ≤ 1 := by + exact physicalResidueSpatialSiteFactor_bound _ _ base _ q 4 hmesh _ t s u + +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable {W : ℝ} (hW : 0 ≤ W) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) + +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "reconstruct" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +theorem allocatedRecenteredResidueWeight_expansion (hq : ∀ z, 0 < q z) + (r : labels) (a : cells) (v : X → (Unit ⊕ Fin dim) → ℤ) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) : + allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r a v = + ∑ t : terms, (coeff (principalResidueLabel modulus (wholeReference r)) t / ((volume : ℝ) : ℂ)) * + ∏ s, test s (fun z => (physicalCubeVertexValue (reconstruct r a.val v) s z : ℝ)) * + twist r a.val t s (physicalCubeVertexValue (reconstruct r a.val v) s) := by + have hexp : + allocatedResidueSpatialKernel B U b S x X hM selection hx modulus + (trimmedSpatialRootScale τ N q) hW mesh (principalResidueLabel modulus (wholeReference r)) v * + physicalCubeSiteTest test (reconstruct r a.val v) = + ∑ t : terms, coeff (principalResidueLabel modulus (wholeReference r)) t * + ∏ s, test s (fun z => (physicalCubeVertexValue (reconstruct r a.val v) s z : ℝ)) * + twist r a.val t s (physicalCubeVertexValue (reconstruct r a.val v) s) := by + exact physicalResidue_spatialSiteExpansion _ _ base _ q hq _ _ modulus _ _ 4 mesh v test + unfold allocatedRecenteredResidueWeight + rw [div_mul_eq_mul_div, hexp, Finset.sum_div] + apply Finset.sum_congr rfl + intro t _ + ring + +theorem allocatedRecenteredSpatialCoefficient_sum_le + (hq : ∀ z, 0 < q z) (hN : ∀ z, 0 < N z) (hτ : 0 < τ) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection)) (r : labels) : + (∑ t : terms, ‖coeff (principalResidueLabel modulus (wholeReference r)) t / ((volume : ℝ) : ℂ)‖) ≤ + allocatedSpatialCoefficientCap X selection M modulus mesh / volume := by + have hscales (z : X) : 0 < trimmedSpatialRootScale τ N q z ∧ + 0 < trimmedSpatialSlopeScale W τ N q z := trimmedSpatial_scales_pos hW hτ N q z (hN z) (hq z) + have hA : 0 < volume := Finset.prod_pos (fun z _ => Finset.prod_pos (fun i _ => + physicalSpatialOutputScale_pos (Fin dim) (hscales z).1 (hscales z).2 (Nat.cast_pos.mpr S.positive) i)) + simp only [norm_div, Complex.norm_real, Real.norm_of_nonneg hA.le, ← Finset.sum_div] + exact div_le_div_of_nonneg_right + (allocatedSpatialExpansionCoefficient_sum_le B U b S x X hM selection hx modulus hW mesh + hbudget hperiod (principalResidueLabel modulus (wholeReference r))) hA.le + +theorem allocatedRecenteredSpatial_sum_expansion (hq : ∀ z, 0 < q z) + (r : labels) (a : cells) (vset : Finset (X → (Unit ⊕ Fin dim) → ℤ)) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) + (F : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) : + (∑ v ∈ vset, allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x + hM selection hx N hW mesh base cells (physicalCubeSiteTest test) r a v * F v) = + ∑ t : terms, (coeff (principalResidueLabel modulus (wholeReference r)) t / ((volume : ℝ) : ℂ)) * + ∑ v ∈ vset, (∏ s, test s (fun z => (physicalCubeVertexValue (reconstruct r a.val v) s z : ℝ)) * + twist r a.val t s (physicalCubeVertexValue (reconstruct r a.val v) s)) * F v := by + simp_rw [allocatedRecenteredResidueWeight_expansion B U b S X modulus q wholeReference x N mesh base + hM selection hx hW cells hq, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro t _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro v _ + ring + +theorem allocatedRecenteredSpatial_mixedMass_le [NeZero (residueRefinedPeriod modulus q)] + (hq : ∀ z, 0 < q z) (hN : ∀ z, 0 < N z) (hτ : 0 < τ) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection)) + (law : FiniteProbabilityWeights labels) + {T : labels → Type*} [∀ r, Fintype (T r)] (c : ∀ r, T r → ℂ) : + law.mean (fun r => ∑ t : terms, ∑ k : T r, + ‖(coeff (principalResidueLabel modulus (wholeReference r)) t / ((volume : ℝ) : ℂ)) * c r k‖) ≤ + (allocatedSpatialCoefficientCap X selection M modulus mesh / volume) * + law.mean (fun r => ∑ k, ‖c r k‖) := by + have hpoint (r : labels) : (∑ t : terms, ∑ k : T r, + ‖(coeff (principalResidueLabel modulus (wholeReference r)) t / ((volume : ℝ) : ℂ)) * c r k‖) ≤ + (allocatedSpatialCoefficientCap X selection M modulus mesh / volume) * ∑ k, ‖c r k‖ := by + simp only [norm_mul, ← Finset.mul_sum, ← Finset.sum_mul] + exact mul_le_mul_of_nonneg_right + (allocatedRecenteredSpatialCoefficient_sum_le B U b S X modulus q wholeReference x N mesh + hM selection hx hW hq hN hτ hbudget hperiod r) (Finset.sum_nonneg (fun _ _ => norm_nonneg _)) + exact (law.mean_mono hpoint).trans_eq (law.mean_const_mul _ _) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +omit [NeZero (residueRefinedPeriod modulus q)] in +theorem allocatedRecenteredClippedFullGridCover_expansion + (hq : ∀ z, 0 < q z) (hmesh : 0 < mesh) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (htest : ∀ s u, ‖test s u‖ ≤ 1) + (hg : ∀ k s u, ‖g r k s u‖ ≤ 1) : + let factor := fun (t : terms) (k : ∀ j, ((coverWitness r).expansion j).Term) + (s : Finset (Fin dim)) (u : X → ℤ) => + test s (fun z => (u z : ℝ)) * twist r.val a.val t s u * + g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / + commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle)) + (∀ t k s u, ‖factor t k s u‖ ≤ 1) ∧ + ∀ v : X → (Unit ⊕ Fin dim) → ℤ, + allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r.val a v * + allocatedClippedFullGridCoverValue B U b hR S refined coverWitness hb o bW d g δ x p hm + (point v) r.val = + ∑ t : terms, ∑ k : ∀ j, ((coverWitness r).expansion j).Term, + ((coeff (principalResidueLabel modulus (wholeReference r.val)) t / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion k) * + (allocatedClippedFullGridGlobalPrefactor B U b S rowSets d + (allocatedIdealCoverSupport (G := G) B rowSets) x hb o bW refined (coverWitness r).representative + (allocatedPhysicalLongIdeal B U b hR S rowSets δ) + (physicalCubeRowSample U d rows p hm (point v)) * + ∏ s, factor t k s (physicalCubeVertexValue (point v) s)) := by + dsimp only + constructor + · intro t k s u + rw [norm_mul, norm_mul] + have ht := allocatedRecenteredSpatialTwist_bound (τ := τ) B U b S X modulus q wholeReference x N mesh base + hmesh r.val a.val t s u + exact (mul_le_mul (mul_le_mul (htest s _) ht (norm_nonneg _) zero_le_one) + (hg k s _) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1 * 1)).trans_eq (by norm_num) + · intro v + rw [allocatedRecenteredResidueWeight_expansion B U b S X modulus q wholeReference x N mesh base + hM selection hx hW cells hq] + simp only [allocatedClippedFullGridCoverValue, dite_eq_left r.property] + simp_rw [Finset.sum_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro k _ + simp only [Finset.prod_mul_distrib] + ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +omit [NeZero (residueRefinedPeriod modulus q)] in +theorem allocatedRecenteredProductFullGridCover_expansion + (hq : ∀ z, 0 < q z) (hmesh : 0 < mesh) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (htest : ∀ s u, ‖test s u‖ ≤ 1) + (hg : ∀ k s u, ‖g r k s u‖ ≤ 1) : + let factor := fun (t : terms) (k : ∀ j, ((coverWitness r).expansion j).Term) + (s : Finset (Fin dim)) (u : X → ℤ) => + test s (fun z => (u z : ℝ)) * twist r.val a.val t s u * + g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / + commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle)) + (∀ t k s u, ‖factor t k s u‖ ≤ 1) ∧ + ∀ v : X → (Unit ⊕ Fin dim) → ℤ, + allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r.val a v * + allocatedProductFullGridCoverValue B U b hR S refined coverWitness hb o bW d g δ x p hm + (point v) r.val = + ∑ t : terms, ∑ k : ∀ j, ((coverWitness r).expansion j).Term, + ((coeff (principalResidueLabel modulus (wholeReference r.val)) t / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion k) * + (allocatedProductFullGridPrefactor B U b S rowSets d + (allocatedProductIdealSiteRadius (G := G) B rowSets) (allocatedProductIdealSiteRadius_pos B rowSets) x hb o bW refined (coverWitness r).representative + (allocatedPhysicalLongIdeal B U b hR S rowSets δ) + (physicalCubeRowSample U d rows p hm (point v)) * + ∏ s, factor t k s (physicalCubeVertexValue (point v) s)) := by + dsimp only + constructor + · intro t k s u + rw [norm_mul, norm_mul] + have ht := allocatedRecenteredSpatialTwist_bound (τ := τ) B U b S X modulus q wholeReference x N mesh base + hmesh r.val a.val t s u + exact (mul_le_mul (mul_le_mul (htest s _) ht (norm_nonneg _) zero_le_one) + (hg k s _) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1 * 1)).trans_eq (by norm_num) + · intro v + rw [allocatedRecenteredResidueWeight_expansion B U b S X modulus q wholeReference x N mesh base + hM selection hx hW cells hq] + simp only [allocatedProductFullGridCoverValue, dite_eq_left r.property] + simp_rw [Finset.sum_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro k _ + simp only [Finset.prod_mul_distrib] + ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "labels" => (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod refined) + +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (N : X → ℕ) {τ : ℝ} (mesh : ℝ) (base : X → ℤ) + +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) + +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable {W ξ : ℝ} (hW : 0 ≤ W) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) + +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "reconstruct" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base +local notation "window" => spatialWindow (α := Fin dim) (trimmedSpatialRootScale τ N q) 4 +local notation "V" => narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + +theorem allocatedRecentered_exists_twisted_source + (hq : ∀ z, 0 < q z) (hmesh : 0 < mesh) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection)) + (hV : ∀ z, 0 < V z) (hZ : 0 < ∑' z, selectedResidueSmoothWeight q cells V z) + (r : labels) (test : Finset (Fin dim) → (X → ℝ) → ℂ) + (F : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) + {δ C : ℝ} (hδ : 0 < δ) (hC : 0 < C) + (hcoeff : allocatedSpatialCoefficientCap X selection M modulus mesh ≤ C) + (hsource : δ ≤ ‖∑ a : cells, (selectedResidueCellWeight q cells V a : ℂ) * + ∑ v ∈ window, allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x + hM selection hx N hW mesh base cells (physicalCubeSiteTest test) r a v * F (reconstruct r a.val v)‖) : + ∃ (a : cells) (t : terms), + coeff (principalResidueLabel modulus (wholeReference r)) t ≠ 0 ∧ + (∀ s u, ‖twist r a.val t s u‖ ≤ 1) ∧ + δ / C ≤ ‖(∑ v ∈ window, + (∏ s, test s (fun z => (physicalCubeVertexValue (reconstruct r a.val v) s z : ℝ)) * + twist r a.val t s (physicalCubeVertexValue (reconstruct r a.val v) s)) * + F (reconstruct r a.val v)) / ((volume : ℝ) : ℂ)‖ := by + let c : cells → ℂ := fun a => (selectedResidueCellWeight q cells V a : ℂ) + let d : terms → ℂ := coeff (principalResidueLabel modulus (wholeReference r)) + let z : cells → terms → ℂ := fun a t => (∑ v ∈ window, + (∏ s, test s (fun u => (physicalCubeVertexValue (reconstruct r a.val v) s u : ℝ)) * + twist r a.val t s (physicalCubeVertexValue (reconstruct r a.val v) s)) * + F (reconstruct r a.val v)) / ((volume : ℝ) : ℂ) + have hc : (∑ a, ‖c a‖) ≤ 1 := by + simp only [c, Complex.norm_real, Real.norm_of_nonneg (selectedResidueCellWeight_nonneg q cells V _)] + exact (selectedResidueCellWeight_sum q cells V hV hZ).le + have hd : (∑ t, ‖d t‖) ≤ C := + (allocatedSpatialExpansionCoefficient_sum_le B U b S x X hM selection hx modulus hW mesh + hbudget hperiod _).trans hcoeff + have heq (a : cells) : + (∑ v ∈ window, allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x + hM selection hx N hW mesh base cells (physicalCubeSiteTest test) r a v * F (reconstruct r a.val v)) = + ∑ t, d t * z a t := by + rw [allocatedRecenteredSpatial_sum_expansion B U b S X modulus q wholeReference x N mesh base + hM selection hx hW cells hq r a window test (fun v => F (reconstruct r a.val v))] + apply Finset.sum_congr rfl + intro t _ + dsimp only [d, z] + ring + simp_rw [heq, Finset.mul_sum, ← mul_assoc] at hsource + obtain ⟨a, t, _, hdt, ht⟩ := exists_large_weighted_pair_nonzero c (fun _ => d) z hδ zero_lt_one hC hc + (fun _ => hd) hsource + refine ⟨a, t, hdt, ?_, ?_⟩ + · exact allocatedRecenteredSpatialTwist_bound B U b S X modulus q wholeReference x N mesh base hmesh r a.val t + · simpa only [one_mul] using ht + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +variable (period : ℕ) [NeZero period] +variable {K : Type*} [Fintype K] (cI : K → ℂ) +variable (fI : K → Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets + +omit [NeZero (residueRefinedPeriod modulus q)] in +theorem allocatedRecenteredMaskedSpatialAssembly + (hq : ∀ z, 0 < q z) (hmesh : 0 < mesh) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hg : ∀ k s u, ‖g r k s u‖ ≤ 1) (hfI : ∀ k s z, ‖fI k s z‖ ≤ 1) + (error : ℝ) + (herr : ∀ y : EuclideanJetLayers U (fun j : Fin m => + {t : Finset (Fin dim) // t ∈ boundedBooleanJetRows (Fin dim) (Fin.val j + 1)}), + ‖allocatedProductFullGridPrefactor B U b S rowSets d radius positiveRadius x hb o bW + refined (coverWitness r).representative (allocatedPhysicalLongIdeal B U b hR S rowSets δ) y - + allocatedProductChartIdealApproximation B U b S rowSets x (coverWitness r).representative + refined d period radius positiveRadius hb o bW cI fI y‖ ≤ error) : + let c := fun t : terms × (∀ j, ((coverWitness r).expansion j).Term) => + (coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 + let Ψ := fun (t : terms × (∀ j, ((coverWitness r).expansion j).Term)) (label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)))) k s (u : X → ℤ) => + twist r.val a.val t.1 s u * (fun k s (u : X → ℤ) => g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle))) t.2 s u * (fun label k s (u : X → ℤ) => allocatedMaskedSiteChartFactor B U b S o hb bW d radius positiveRadius period (label s) (fI k s) (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ)))) label k s u + (∀ t label k s u, ‖Ψ t label k s u‖ ≤ 1) ∧ + ∀ (test : Finset (Fin dim) → (X → ℝ) → ℂ), (∀ s u, ‖test s u‖ ≤ 1) → + ∀ v : X → (Unit ⊕ Fin dim) → ℤ, + ‖allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r.val a v * + allocatedProductFullGridCoverValue B U b hR S refined coverWitness hb o bW d g δ x p hm + (point v) r.val - + ∑ t : terms × (∀ j, ((coverWitness r).expansion j).Term), ∑ label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period))), ∑ k, + (c t * (allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative refined d period cI) label k) * ∏ s, + test s (fun z => (physicalCubeVertexValue (point v) s z : ℝ)) * + Ψ t label k s (physicalCubeVertexValue (point v) s)‖ ≤ + (∑ t, ‖c t‖) * error := by + intro c Ψ + constructor + · intro t label k s u + dsimp only [Ψ] + rw [norm_mul, norm_mul] + have ht := allocatedRecenteredSpatialTwist_bound (τ := τ) B U b S X modulus q wholeReference + x N mesh base hmesh r.val a.val t.1 s u + have hi := allocatedMaskedSiteChartFactor_norm B U b S o hb bW d radius positiveRadius period + (label s) (fI k s) (hfI k s) (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ))) + exact (mul_le_mul (mul_le_mul ht (hg t.2 s _) (norm_nonneg _) zero_le_one) + hi (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1 * 1)).trans_eq (by norm_num) + · intro test htest v + have hprevious := allocatedRecenteredProductFullGridCover_expansion (τ := τ) B U b hR S X modulus q + wholeReference coverWitness hb o bW d g δ x hM selection hx N hW mesh base cells p hm r a + hq hmesh test htest hg + have hphysical := allocatedProductPrefactor_physical_site_error B U b S x + (coverWitness r).representative refined d period radius positiveRadius hb o bW cI fI + p hp hm (point v) hR δ error herr + have hsub := finiteSitePrefactor_substitution_error c (allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative refined d period cI) + (fun (t : terms × (∀ j, ((coverWitness r).expansion j).Term)) s u => test s (fun z => (u z : ℝ)) * + twist r.val a.val t.1 s u * (fun k s (u : X → ℤ) => g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle))) t.2 s u) + (fun label k s (u : X → ℤ) => allocatedMaskedSiteChartFactor B U b S o hb bW d radius positiveRadius period (label s) (fI k s) (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ)))) (physicalCubeVertexValue (point v)) + (allocatedProductFullGridPrefactor B U b S rowSets d radius positiveRadius x hb o bW + refined (coverWitness r).representative (allocatedPhysicalLongIdeal B U b hR S rowSets δ) + (physicalCubeRowSample U d rows p hm (point v))) + (fun t s u => hprevious.1 t.1 t.2 s u) hphysical + rw [hprevious.2 v] + simpa only [c, Ψ, Fintype.sum_prod_type, mul_assoc] using hsub + +omit [NeZero (residueRefinedPeriod modulus q)] in +theorem allocatedRecenteredMaskedSpatialAssembly_coefficient_mass : + (∑ t : terms × (∀ j, ((coverWitness r).expansion j).Term), ∑ label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period))), ∑ k, + ‖((coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2) * (allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative refined d period cI) label k‖) = + (∑ t : terms, ‖coeff (principalResidueLabel modulus (wholeReference r.val)) t / ((volume : ℝ) : ℂ)‖) * + (∑ k : (∀ j, ((coverWitness r).expansion j).Term), ‖coverSiteCoefficient (coverWitness r).expansion k‖) * + ∑ label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period))), ∑ k, ‖(allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative refined d period cI) label k‖ := by + rw [finiteSitePrefactor_coefficient_mass] + simp only [Fintype.sum_prod_type, norm_mul, ← Finset.mul_sum, ← Finset.sum_mul] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +variable (period : ℕ) [NeZero period] +variable {K : Type*} [Fintype K] (cI : K → ℂ) +variable (fI : K → Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets + +omit [NeZero (residueRefinedPeriod modulus q)] in +theorem allocatedRecenteredMaskedSpatialAssembly_pointwise + (hq : ∀ z, 0 < q z) (hmesh : 0 < mesh) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hg : ∀ k s u, ‖g r k s u‖ ≤ 1) (hfI : ∀ k s z, ‖fI k s z‖ ≤ 1) + (error : EuclideanJetLayers U (fun j : Fin m => + {t : Finset (Fin dim) // t ∈ boundedBooleanJetRows (Fin dim) (Fin.val j + 1)}) → ℝ) + (herr : ∀ y : EuclideanJetLayers U (fun j : Fin m => + {t : Finset (Fin dim) // t ∈ boundedBooleanJetRows (Fin dim) (Fin.val j + 1)}), + ‖allocatedProductFullGridPrefactor B U b S rowSets d radius positiveRadius x hb o bW + refined (coverWitness r).representative (allocatedPhysicalLongIdeal B U b hR S rowSets δ) y - + allocatedProductChartIdealApproximation B U b S rowSets x (coverWitness r).representative + refined d period radius positiveRadius hb o bW cI fI y‖ ≤ error y) : + let c := fun t : terms × (∀ j, ((coverWitness r).expansion j).Term) => + (coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 + let Ψ := fun (t : terms × (∀ j, ((coverWitness r).expansion j).Term)) (label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)))) k s (u : X → ℤ) => + twist r.val a.val t.1 s u * (fun k s (u : X → ℤ) => g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle))) t.2 s u * (fun label k s (u : X → ℤ) => allocatedMaskedSiteChartFactor B U b S o hb bW d radius positiveRadius period (label s) (fI k s) (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ)))) label k s u + (∀ t label k s u, ‖Ψ t label k s u‖ ≤ 1) ∧ + ∀ (test : Finset (Fin dim) → (X → ℝ) → ℂ), (∀ s u, ‖test s u‖ ≤ 1) → + ∀ v : X → (Unit ⊕ Fin dim) → ℤ, + ‖allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r.val a v * + allocatedProductFullGridCoverValue B U b hR S refined coverWitness hb o bW d g δ x p hm + (point v) r.val - + ∑ t : terms × (∀ j, ((coverWitness r).expansion j).Term), ∑ label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period))), ∑ k, + (c t * (allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative refined d period cI) label k) * ∏ s, + test s (fun z => (physicalCubeVertexValue (point v) s z : ℝ)) * + Ψ t label k s (physicalCubeVertexValue (point v) s)‖ ≤ + (∑ t, ‖c t‖) * error (physicalCubeRowSample U d rows p hm (point v)) := by + intro c Ψ + constructor + · intro t label k s u + dsimp only [Ψ] + rw [norm_mul, norm_mul] + have ht := allocatedRecenteredSpatialTwist_bound (τ := τ) B U b S X modulus q wholeReference + x N mesh base hmesh r.val a.val t.1 s u + have hi := allocatedMaskedSiteChartFactor_norm B U b S o hb bW d radius positiveRadius period + (label s) (fI k s) (hfI k s) (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ))) + exact (mul_le_mul (mul_le_mul ht (hg t.2 s _) (norm_nonneg _) zero_le_one) + hi (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1 * 1)).trans_eq (by norm_num) + · intro test htest v + have hprevious := allocatedRecenteredProductFullGridCover_expansion (τ := τ) B U b hR S X modulus q + wholeReference coverWitness hb o bW d g δ x hM selection hx N hW mesh base cells p hm r a + hq hmesh test htest hg + have hphysical := herr (physicalCubeRowSample U d rows p hm (point v)) + rw [allocatedProductChartIdealApproximation_physical B U b S x + (coverWitness r).representative refined d period radius positiveRadius hb o bW cI fI + p hp hm (point v)] at hphysical + have hsub := finiteSitePrefactor_substitution_error c (allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative refined d period cI) + (fun (t : terms × (∀ j, ((coverWitness r).expansion j).Term)) s u => test s (fun z => (u z : ℝ)) * + twist r.val a.val t.1 s u * (fun k s (u : X → ℤ) => g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle))) t.2 s u) + (fun label k s (u : X → ℤ) => allocatedMaskedSiteChartFactor B U b S o hb bW d radius positiveRadius period (label s) (fI k s) (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ)))) (physicalCubeVertexValue (point v)) + (allocatedProductFullGridPrefactor B U b S rowSets d radius positiveRadius x hb o bW + refined (coverWitness r).representative (allocatedPhysicalLongIdeal B U b hR S rowSets δ) + (physicalCubeRowSample U d rows p hm (point v))) + (fun t s u => hprevious.1 t.1 t.2 s u) hphysical + rw [hprevious.2 v] + simpa only [c, Ψ, Fintype.sum_prod_type, mul_assoc] using hsub + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +variable (period : ℕ) [NeZero period] +variable {K : Type*} [Fintype K] (cI : K → ℂ) +variable (fI : K → Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets + +noncomputable def allocatedRecenteredMaskedSpatialApproximation + (test : Finset (Fin dim) → (X → ℝ) → ℂ) + (v : X → (Unit ⊕ Fin dim) → ℤ) : ℂ := + let c := fun t : terms × (∀ j, ((coverWitness r).expansion j).Term) => + (coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 + let Ψ := fun (t : terms × (∀ j, ((coverWitness r).expansion j).Term)) (label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)))) k s (u : X → ℤ) => + twist r.val a.val t.1 s u * (fun k s (u : X → ℤ) => g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle))) t.2 s u * (fun label k s (u : X → ℤ) => allocatedMaskedSiteChartFactor B U b S o hb bW d radius positiveRadius period (label s) (fI k s) (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ)))) label k s u + ∑ t : terms × (∀ j, ((coverWitness r).expansion j).Term), ∑ label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period))), ∑ k, + (c t * (allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative refined d period cI) label k) * ∏ s, + test s (fun z => (physicalCubeVertexValue (point v) s z : ℝ)) * + Ψ t label k s (physicalCubeVertexValue (point v) s) + +local notation "H" => trimmedSpatialRootScale τ N q +local notation "factor" => ((30 / smoothProbabilityProfile 0) ^ Fintype.card (Option (Fin dim) × X) * + (((1 + W) / (S.value : ℝ)) ^ dim) ^ Fintype.card X) +local notation "amp" => ‖((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹‖ +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d radius positiveRadius +local notation "gridMass" => ∑ k, ‖coverSiteCoefficient (AllocatedFullGridResidueWitness.expansion (coverWitness r)) k‖ +local notation "spatialCap" => allocatedSpatialCoefficientCap X selection M modulus mesh + +omit [NeZero (residueRefinedPeriod modulus q)] in +theorem allocatedRecenteredMaskedSpatialApproximation_window_error + (hq : ∀ z, 0 < q z) (hN : ∀ z, 0 < N z) (hτ : 0 < τ) (hmesh : 0 < mesh) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hg : ∀ k s u, ‖g r k s u‖ ≤ 1) (hfI : ∀ k s z, ‖fI k s z‖ ≤ 1) + (hrows : ∀ z, Fintype.card (Option (LayerSamplerVariables G I n B)) * + allocatedPhysicalEntryBudget B U b S (fun _ => 0) ≤ H z) + (hscale : ∀ z, 8 * (probabilityProfileLipschitz : ℝ) ≤ 20 * H z) + {T A ε : ℝ} (hA : 0 ≤ A) (hε : 0 ≤ ε) + (href : ∀ cell : ColumnResiduePattern (Option (Fin dim)) X q, + ∃ _hZ : 0 < ∑' z, selectedResidueSmoothWeight q {cell} (referenceJetEnvelopeWidths q H) z, + selectedResidueDensityMass q {cell} (referenceJetEnvelopeWidths q H) + (fun z => amp * ‖cutoff (physicalCubeRowSample U d rows p hm + (translatePhysicalCube base (standardPhysicalCubeOutput z)))‖) ≤ T) + (herr : ∀ y : EuclideanJetLayers U (fun j : Fin m => + {t : Finset (Fin dim) // t ∈ boundedBooleanJetRows (Fin dim) (Fin.val j + 1)}), + ‖allocatedProductFullGridPrefactor B U b S rowSets d radius positiveRadius x hb o bW + refined (coverWitness r).representative (allocatedPhysicalLongIdeal B U b hR S rowSets δ) y - + allocatedProductChartIdealApproximation B U b S rowSets x (coverWitness r).representative + refined d period radius positiveRadius hb o bW cI fI y‖ ≤ amp * A * (‖cutoff y‖ * ε)) : + ∀ (test : Finset (Fin dim) → (X → ℝ) → ℂ), (∀ s u, ‖test s u‖ ≤ 1) → + (∑ v ∈ spatialWindow H 4, + ‖allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r.val a v * + allocatedProductFullGridCoverValue B U b hR S refined coverWitness hb o bW d g δ x p hm + (point v) r.val - + allocatedRecenteredMaskedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period cI fI test v‖) ≤ + (spatialCap * gridMass) * (A * ε) * (factor * T) := by + intro test htest + let c := fun t : terms × (∀ j, ((coverWitness r).expansion j).Term) => + (coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 + have hpos (z : X) := trimmedSpatial_scales_pos hW hτ N q z (hN z) (hq z) + have hvolume : 0 < volume := Finset.prod_pos (fun z _ => Finset.prod_pos (fun i _ => + physicalSpatialOutputScale_pos (Fin dim) (hpos z).1 (hpos z).2 (Nat.cast_pos.mpr S.positive) i)) + have hcap := allocatedRecenteredSpatialCoefficient_sum_le (τ := τ) B U b S X modulus q + wholeReference x N mesh hM selection hx hW hq hN hτ hbudget hperiod r.val + have hc : (∑ t, ‖c t‖) ≤ (spatialCap * gridMass) / volume := by + calc + _ = (∑ t : terms, ‖coeff (principalResidueLabel modulus (wholeReference r.val)) t / + ((volume : ℝ) : ℂ)‖) * gridMass := by + simp only [c, Fintype.sum_prod_type, norm_mul, ← Finset.mul_sum, ← Finset.sum_mul] + _ ≤ (spatialCap / volume) * gridMass := + mul_le_mul_of_nonneg_right hcap (Finset.sum_nonneg (fun _ _ => norm_nonneg _)) + _ = _ := by ring + have hmass := allocatedNormalizedCutoff_reconstructed_cell_mass B U b S rowSets o hb bW d + radius positiveRadius p hm q N hq hN modulus wholeReference x base hW hτ hrows hscale href r.val a.val + have hpoint := allocatedRecenteredMaskedSpatialAssembly_pointwise (τ := τ) B U b hR S X modulus q + wholeReference coverWitness hb o bW d g δ x hM selection hx N hW mesh base cells p hm r a + period cI fI hq hmesh hp hg hfI (fun y => amp * A * (‖cutoff y‖ * ε)) herr + apply finiteWindow_norm_sum_cancel_volume (spatialWindow H 4) + (fun v => allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r.val a v * + allocatedProductFullGridCoverValue B U b hR S refined coverWitness hb o bW d g δ x p hm + (point v) r.val - + allocatedRecenteredMaskedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period cI fI test v) + (fun v => amp * ‖cutoff (physicalCubeRowSample U d rows p hm (point v))‖) + hvolume (Finset.sum_nonneg (fun _ _ => norm_nonneg _)) (mul_nonneg hA hε) + (fun _ _ => mul_nonneg (norm_nonneg _) (norm_nonneg _)) hc hmass + intro v _ + apply (hpoint.2 test htest v).trans_eq + dsimp only [c] + ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ i, Fintype (B i)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (N : X → ℕ) {τ : ℝ} (mesh : ℝ≥0) (base : X → ℤ) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) +variable (a : ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q) +variable (period : ℕ) + +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "expansion" => AllocatedFullGridResidueWitness.expansion (coverWitness r) +local notation "root" => allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (wholeReference r.val) +local notation "directions" => allocatedPhysicalCubeDirections B U b S x (wholeReference r.val) +local notation "residue" => boundedColumnResidueRepresentative q a + +variable (spatial : X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +variable (kg : ∀ i, ((coverWitness r).expansion i).Term) +variable (label : (∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)) +variable (fi : (LayerSamplerAxis I n → ℝ) → ℂ) (s : Finset (Fin dim)) + +noncomputable def allocatedRecenteredNormalizedSiteFactor + (gridLabel : ∀ i, ZMod (((coverWitness r).expansion i).period (kg i))) (u : X → ℤ) : ℂ := + restrictedComplexChartDensity (mixedCoveredJetChart (O := fun _ => Unit) U o b hb bW d) + (mixedCoveredJetRegion U o b d (fun j (_ : Unit) => standardLatticeSmallBox (J j))) 1 + (allocatedNormalizedCommonSiteFactor B U b S expansion ig radius positiveRadius kg s fi d + root directions base residue q 4 mesh (trimmedSpatialRootScale τ N q) (fun z => (N z : ℝ)) spatial + (siteTwistCommonModulus_spatial_dvd modulus q expansion kg period) + (siteTwistCommonModulus_grid_dvd modulus q expansion kg period) + (siteTwistCommonModulus_ideal_dvd modulus q expansion kg period) label gridLabel u) + (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ))) + +variable [∀ i, NeZero (((coverWitness r).expansion i).period (kg i))] + +omit [DecidableEq G] [NeZero modulus] in +theorem allocatedRecenteredNormalizedSiteFactor_sum + (g : (((Σ j, J j) → UnitAddCircle) → ℂ)) + (hsite : ∀ (u₀ : ∀ j, euclideanSubspace (U j)) (w₀ : ∀ j, (I j → ℝ) × (Fin (n j) → ℤ)), + (∀ j, (QuotientAddGroup.mk (u₀ j) : euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) = + normalizedLatticeQuotient (euclideanSubspace (U j)) (b j) (hb j) (orthonormalMixedChart (o j) (w₀ j))) → + (∀ j i, |normalizedLatticePoint (euclideanSubspace (U j)) (b j) (orthonormalMixedChart (o j) (w₀ j)) i| ≤ 1 / 4) → + g (fun v => ((((u₀ v.1).val v.2) / commonSitePeriod expansion kg : ℝ) : UnitAddCircle)) = + allocatedFullGridSiteFactor (G := G) B U b (R := R) expansion ig kg s + (fun i => ((w₀ (ig i).1).2 (ig i).2 : ZMod (((coverWitness r).expansion i).period (kg i)))) + (allocatedFullMixedSiteValue (R := R) U b w₀) / 2) + (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hsmall : ∀ j, R j ≤ allocatedProductGridRadius (G := G) B rowSets C j) + (hN : ∀ z, 0 < N z) (u : X → ℤ) : + (allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + r.val a spatial s u * + g (fun v => (((eval (fun z => (u z : ℝ)) (p v.1) v.2) / commonSitePeriod expansion kg : ℝ) : UnitAddCircle))) * + allocatedMaskedSiteChartFactor B U b S o hb bW d radius positiveRadius period label fi + (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ))) = + ∑ gridLabel : ∀ i, ZMod (((coverWitness r).expansion i).period (kg i)), + allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a period spatial kg label fi s gridLabel u := by + exact allocatedPhysicalSiteTwist_common_global B U b S expansion ig radius positiveRadius kg s fi + o hb bW d p hm root directions base residue q 4 mesh (trimmedSpatialRootScale τ N q) + (fun z => (N z : ℝ)) spatial + (siteTwistCommonModulus_spatial_dvd modulus q expansion kg period) + (siteTwistCommonModulus_grid_dvd modulus q expansion kg period) + (siteTwistCommonModulus_ideal_dvd modulus q expansion kg period) label hR C hC hchart + (allocatedProductGridRadius_source_budget B rowSets C hC (fun j => (hR j).le) hsmall) + g hsite (fun z => Nat.cast_ne_zero.mpr (hN z).ne') u + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ≥0) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +variable (period : ℕ) [NeZero period] +variable {K : Type*} [Fintype K] (cI : K → ℂ) +variable (fI : K → Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets + +variable [∀ (i : {i // allocatedGridAxis (I := I) U b S.value i}) + (ki : ((coverWitness r).expansion i).Term), NeZero (((coverWitness r).expansion i).period ki)] + +noncomputable def allocatedRecenteredNormalizedSpatialApproximation + (test : Finset (Fin dim) → (X → ℝ) → ℂ) + (v : X → (Unit ⊕ Fin dim) → ℤ) : ℂ := + let c := fun t : terms × (∀ j, ((coverWitness r).expansion j).Term) => + (coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 + ∑ t : terms × (∀ i, ((coverWitness r).expansion i).Term), + ∑ label : Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)), + ∑ k : K, + ∑ gridLabel : Finset (Fin dim) → ∀ i, ZMod (((coverWitness r).expansion i).period (t.2 i)), + (c t * allocatedProductMaskedIdealCoefficient B U b S rowSets x + (coverWitness r).representative refined d period cI label k) * + ∏ s, test s (fun z => (physicalCubeVertexValue (point v) s z : ℝ)) * + allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s + (gridLabel s) (physicalCubeVertexValue (point v) s) + +local notation "ig" => allocatedGridIntegerAxis B U b S + +include hR in +omit [NeZero (residueRefinedPeriod modulus q)] in +theorem allocatedRecenteredMaskedSpatialApproximation_normalized + (hsite : ∀ kg s (u₀ : ∀ j, euclideanSubspace (U j)) (w₀ : ∀ j, (I j → ℝ) × (Fin (n j) → ℤ)), + (∀ j, (QuotientAddGroup.mk (u₀ j) : euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) = + normalizedLatticeQuotient (euclideanSubspace (U j)) (b j) (hb j) (orthonormalMixedChart (o j) (w₀ j))) → + (∀ j i, |normalizedLatticePoint (euclideanSubspace (U j)) (b j) (orthonormalMixedChart (o j) (w₀ j)) i| ≤ 1 / 4) → + g r kg s (fun v => ((((u₀ v.1).val v.2) / commonSitePeriod (coverWitness r).expansion kg : ℝ) : UnitAddCircle)) = + allocatedFullGridSiteFactor (G := G) B U b (R := R) (coverWitness r).expansion ig kg s + (fun i => ((w₀ (ig i).1).2 (ig i).2 : ZMod (((coverWitness r).expansion i).period (kg i)))) + (allocatedFullMixedSiteValue (R := R) U b w₀) / 2) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (hsmall : ∀ j, R j ≤ allocatedProductGridRadius (G := G) B rowSets C j) + (hN : ∀ z, 0 < N z) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (v : X → (Unit ⊕ Fin dim) → ℤ) : + allocatedRecenteredMaskedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period cI fI test v = + allocatedRecenteredNormalizedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d x hM selection hx N hW mesh base cells p hm r a period cI fI test v := by + unfold allocatedRecenteredMaskedSpatialApproximation allocatedRecenteredNormalizedSpatialApproximation + dsimp only + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro label _ + apply Finset.sum_congr rfl + intro k _ + rw [← Finset.mul_sum] + rw [← Fintype.prod_sum (fun (s : Finset (Fin dim)) + (gl : ∀ i, ZMod (((coverWitness r).expansion i).period (t.2 i))) => + test s (fun z => (physicalCubeVertexValue (point v) s z : ℝ)) * + allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s gl + (physicalCubeVertexValue (point v) s))] + apply congrArg (fun z : ℂ => + ((coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 * + allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative + refined d period cI label k) * z) + apply Finset.prod_congr rfl + intro s _ + rw [← Finset.mul_sum] + apply congrArg (fun z : ℂ => + test s (fun z => (physicalCubeVertexValue (point v) s z : ℝ)) * z) + exact allocatedRecenteredNormalizedSiteFactor_sum (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s + (g r t.2 s) (hsite t.2 s) hR C hC hchart hsmall hN (physicalCubeVertexValue (point v) s) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ i, Fintype (B i)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (N : X → ℕ) {τ : ℝ} (mesh : ℝ≥0) (base : X → ℤ) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) +variable (a : ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q) +variable (period : ℕ) + +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "expansion" => AllocatedFullGridResidueWitness.expansion (coverWitness r) +local notation "root" => allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (wholeReference r.val) +local notation "directions" => allocatedPhysicalCubeDirections B U b S x (wholeReference r.val) +local notation "residue" => boundedColumnResidueRepresentative q a + +variable (spatial : X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +variable (kg : ∀ i, ((coverWitness r).expansion i).Term) +variable (label : (∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)) +variable (fi : (LayerSamplerAxis I n → ℝ) → ℂ) (s : Finset (Fin dim)) + +omit [DecidableEq G] [NeZero modulus] in +theorem allocatedRecenteredNormalizedSiteFactor_norm + (hR : ∀ j, 0 < R j) + {T Vg Cg Hg : {i // allocatedGridAxis (I := I) U b S.value i} → ℝ} {L LI : ℝ≥0} + (he : ∀ i, ((coverWitness r).expansion i).Bounds (T i) (Vg i) (Cg i) L (Hg i)) + (Q : ℝ≥0) (hQ : ∀ i, 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (ig i).1 (ig i).2) : ℝ) + 1) ≤ Q) + (hf : ∀ y, ‖fi y‖ ≤ 1) + (hI : LipschitzWith LI (bufferedCoordinateProjection + (allocatedGridAxis (I := I) U b S.value) radius positiveRadius fi)) + (hmesh : 0 < mesh) (hq : ∀ z, 0 < q z) (hN : ∀ z, 0 < N z) (hτ : 0 < τ) + (gridLabel : ∀ i, ZMod (((coverWitness r).expansion i).period (kg i))) (u : X → ℤ) : + ‖allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a period spatial kg label fi s gridLabel u‖ ≤ 1 := by + let Lsp : ℝ≥0 := ⟨8 / τ, div_nonneg (by norm_num) hτ.le⟩ + have hscale (z : X) : |(N z : ℝ) / ((q z : ℝ) * trimmedSpatialRootScale τ N q z)| ≤ Lsp := by + rw [trimmedSpatialRootScale_normalized_ratio N q hτ hN hq z] + exact (abs_of_nonneg (div_nonneg (by norm_num : (0 : ℝ) ≤ 8) hτ.le)).le + unfold allocatedRecenteredNormalizedSiteFactor + apply restrictedComplexChartDensity_norm_le _ _ + (mixedCoveredJetChart_injOn U o b hb bW d _ (fun _ _ => Set.Subset.rfl)) _ zero_le_one + intro w + exact allocatedNormalizedCommonSiteFactor_norm B U b S expansion ig radius positiveRadius kg s fi d + root directions base residue q 4 mesh (trimmedSpatialRootScale τ N q) (fun z => (N z : ℝ)) spatial + (siteTwistCommonModulus_spatial_dvd modulus q expansion kg period) + (siteTwistCommonModulus_grid_dvd modulus q expansion kg period) + (siteTwistCommonModulus_ideal_dvd modulus q expansion kg period) label hR he Q hQ hf hI hmesh hscale + gridLabel u w + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ≥0) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +variable (period : ℕ) [NeZero period] +variable {K : Type*} [Fintype K] (cI : K → ℂ) +variable (fI : K → Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets + +variable [∀ (i : {i // allocatedGridAxis (I := I) U b S.value i}) + (ki : ((coverWitness r).expansion i).Term), NeZero (((coverWitness r).expansion i).period ki)] + +noncomputable def allocatedAmbientMaskedSpatialApproximation + (test : Finset (Fin dim) → (X → ℝ) → ℂ) + (u : X → (Unit ⊕ Fin dim) → ℤ) : ℂ := + let c := fun t : terms × (∀ j, ((coverWitness r).expansion j).Term) => + (coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 + let Ψ := fun (t : terms × (∀ j, ((coverWitness r).expansion j).Term)) (label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)))) k s (u : X → ℤ) => + twist r.val a.val t.1 s u * (fun k s (u : X → ℤ) => g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle))) t.2 s u * (fun label k s (u : X → ℤ) => allocatedMaskedSiteChartFactor B U b S o hb bW d radius positiveRadius period (label s) (fI k s) (physicalSingleSiteValue U d p hm (fun z => (u z : ℝ)))) label k s u + ∑ t : terms × (∀ j, ((coverWitness r).expansion j).Term), ∑ label : (Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period))), ∑ k, + (c t * (allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative refined d period cI) label k) * ∏ s, + test s (fun z => (physicalCubeVertexValue u s z : ℝ)) * + Ψ t label k s (physicalCubeVertexValue u s) + +noncomputable def allocatedAmbientNormalizedSpatialApproximation + (test : Finset (Fin dim) → (X → ℝ) → ℂ) + (u : X → (Unit ⊕ Fin dim) → ℤ) : ℂ := + let c := fun t : terms × (∀ j, ((coverWitness r).expansion j).Term) => + (coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 + ∑ t : terms × (∀ i, ((coverWitness r).expansion i).Term), + ∑ label : Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)), + ∑ k : K, + ∑ gridLabel : Finset (Fin dim) → ∀ i, ZMod (((coverWitness r).expansion i).period (t.2 i)), + (c t * allocatedProductMaskedIdealCoefficient B U b S rowSets x + (coverWitness r).representative refined d period cI label k) * + ∏ s, test s (fun z => (physicalCubeVertexValue u s z : ℝ)) * + allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s + (gridLabel s) (physicalCubeVertexValue u s) + +omit [∀ (i : {i // allocatedGridAxis (I := I) U b S.value i}) + (ki : ((coverWitness r).expansion i).Term), NeZero (((coverWitness r).expansion i).period ki)] in +theorem allocatedAmbientMaskedSpatialApproximation_reconstruction + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (v : X → (Unit ⊕ Fin dim) → ℤ) : + allocatedAmbientMaskedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period cI fI test (point v) = + allocatedRecenteredMaskedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period cI fI test v := rfl + +theorem allocatedAmbientNormalizedSpatialApproximation_reconstruction + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (v : X → (Unit ⊕ Fin dim) → ℤ) : + allocatedAmbientNormalizedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d x hM selection hx N hW mesh base cells p hm r a period cI fI test (point v) = + allocatedRecenteredNormalizedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d x hM selection hx N hW mesh base cells p hm r a period cI fI test v := rfl + +local notation "ig" => allocatedGridIntegerAxis B U b S + +include hR in +theorem allocatedAmbientMaskedSpatialApproximation_normalized + (hsite : ∀ kg s (u₀ : ∀ j, euclideanSubspace (U j)) (w₀ : ∀ j, (I j → ℝ) × (Fin (n j) → ℤ)), + (∀ j, (QuotientAddGroup.mk (u₀ j) : euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) = + normalizedLatticeQuotient (euclideanSubspace (U j)) (b j) (hb j) (orthonormalMixedChart (o j) (w₀ j))) → + (∀ j i, |normalizedLatticePoint (euclideanSubspace (U j)) (b j) (orthonormalMixedChart (o j) (w₀ j)) i| ≤ 1 / 4) → + g r kg s (fun v => ((((u₀ v.1).val v.2) / commonSitePeriod (coverWitness r).expansion kg : ℝ) : UnitAddCircle)) = + allocatedFullGridSiteFactor (G := G) B U b (R := R) (coverWitness r).expansion ig kg s + (fun i => ((w₀ (ig i).1).2 (ig i).2 : ZMod (((coverWitness r).expansion i).period (kg i)))) + (allocatedFullMixedSiteValue (R := R) U b w₀) / 2) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (hsmall : ∀ j, R j ≤ allocatedProductGridRadius (G := G) B rowSets C j) + (hN : ∀ z, 0 < N z) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (u : X → (Unit ⊕ Fin dim) → ℤ) : + allocatedAmbientMaskedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period cI fI test u = + allocatedAmbientNormalizedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d x hM selection hx N hW mesh base cells p hm r a period cI fI test u := by + unfold allocatedAmbientMaskedSpatialApproximation allocatedAmbientNormalizedSpatialApproximation + dsimp only + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro label _ + apply Finset.sum_congr rfl + intro k _ + rw [← Finset.mul_sum] + rw [← Fintype.prod_sum (fun (s : Finset (Fin dim)) + (gl : ∀ i, ZMod (((coverWitness r).expansion i).period (t.2 i))) => + test s (fun z => (physicalCubeVertexValue u s z : ℝ)) * + allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s gl + (physicalCubeVertexValue u s))] + apply congrArg (fun z : ℂ => + ((coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 * + allocatedProductMaskedIdealCoefficient B U b S rowSets x (coverWitness r).representative + refined d period cI label k) * z) + apply Finset.prod_congr rfl + intro s _ + rw [← Finset.mul_sum] + apply congrArg (fun z : ℂ => + test s (fun z => (physicalCubeVertexValue u s z : ℝ)) * z) + exact allocatedRecenteredNormalizedSiteFactor_sum (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s + (g r t.2 s) (hsite t.2 s) hR C hC hchart hsmall hN (physicalCubeVertexValue u s) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ≥0) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +variable (period : ℕ) [NeZero period] +variable {K : Type*} [Fintype K] (cI : K → ℂ) +variable (fI : K → Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets + +variable [∀ (i : {i // allocatedGridAxis (I := I) U b S.value i}) + (ki : ((coverWitness r).expansion i).Term), NeZero (((coverWitness r).expansion i).period ki)] + +local notation "ambient" => allocatedAmbientNormalizedSpatialApproximation (τ := τ) B U b S X modulus q + wholeReference coverWitness hb o bW d x hM selection hx N hW mesh base cells p hm r a period cI fI + +theorem allocatedAmbientNormalizedSpatialApproximation_test_congr + (test other : Finset (Fin dim) → (X → ℝ) → ℂ) (u : X → (Unit ⊕ Fin dim) → ℤ) + (heq : ∀ s, test s (fun z => (physicalCubeVertexValue u s z : ℝ)) = + other s (fun z => (physicalCubeVertexValue u s z : ℝ))) : + ambient test u = ambient other u := by + unfold allocatedAmbientNormalizedSpatialApproximation + dsimp only + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro label _ + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro gridLabel _ + congr 1 + apply Finset.prod_congr rfl + intro s _ + rw [heq s] + +theorem allocatedAmbientNormalizedSpatialApproximation_zero_of_test_zero + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (u : X → (Unit ⊕ Fin dim) → ℤ) + (s₀ : Finset (Fin dim)) (hzero : test s₀ (fun z => (physicalCubeVertexValue u s₀ z : ℝ)) = 0) : + ambient test u = 0 := by + unfold allocatedAmbientNormalizedSpatialApproximation + dsimp only + apply Finset.sum_eq_zero + intro t _ + apply Finset.sum_eq_zero + intro label _ + apply Finset.sum_eq_zero + intro k _ + apply Finset.sum_eq_zero + intro gridLabel _ + apply mul_eq_zero.mpr + right + apply Finset.prod_eq_zero (Finset.mem_univ s₀) + rw [hzero, zero_mul] + +variable [DecidableEq X] + +theorem allocatedAmbientNormalizedSpatialApproximation_testExtension_eq + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (u : X → (Unit ⊕ Fin dim) → ℤ) + (hu : u ∈ physicalIntegerBoxCubes N dim) : + ambient (fun s => integerBoxTestExtension N (test s)) u = ambient test u := by + apply allocatedAmbientNormalizedSpatialApproximation_test_congr + intro s + exact integerBoxTestExtension_of_mem N (test s) (physicalCubeVertexValue u s) + ((mem_physicalIntegerBoxCubes N dim u).mp hu s) + +theorem allocatedAmbientNormalizedSpatialApproximation_testExtension_nonzero_mem_box + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (u : X → (Unit ⊕ Fin dim) → ℤ) + (hu : ambient (fun s => integerBoxTestExtension N (test s)) u ≠ 0) : + u ∈ physicalIntegerBoxCubes N dim := by + apply (mem_physicalIntegerBoxCubes N dim u).mpr + intro s + by_contra hs + apply hu + exact allocatedAmbientNormalizedSpatialApproximation_zero_of_test_zero + B U b S X modulus q wholeReference coverWitness hb o bW d x hM selection hx N hW mesh + base cells p hm r a period cI fI (fun s => integerBoxTestExtension N (test s)) u s + (integerBoxTestExtension_of_not_mem N (test s) (physicalCubeVertexValue u s) hs) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientLongBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientLongBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..01adfb19b3524a8f011a90927ff9d9c8acbd51de --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientLongBox.lean @@ -0,0 +1,362 @@ +import OAI.Combinatorics.Progressions.Estimates.JetAxisReference +import OAI.Combinatorics.Progressions.Lattices.AllocatedIntegerSupport +import OAI.Combinatorics.Progressions.Linear.AllocatedKernelSupport +import OAI.Combinatorics.Progressions.Probability.AllocatedPhysicalCoveredDensity + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Matrix Classical + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 "grid" => allocatedGridAxis (I := I) U basis (LayerSamplerScale.value S) +local notation "sides" => allocatedPrincipalSides B U basis S +local notation "lengths" => principalAxisLength (fun a => ¬grid a) sides + +section Box + +variable (O : Fin m → Type*) [∀ j, Fintype (O j)] + +noncomputable def allocatedLongJetRowBox (T : ℝ) : + ∀ a : {a // ¬grid a}, Set (CoefficientJetAxisRow O a.val) + | ⟨⟨j, .inl _⟩, _⟩ => (Metric.closedBall (0 : O j → ℝ) T : Set (O j → ℝ)) + | ⟨⟨j, .inr i⟩, _⟩ => + (rectangularWeightIndices (fun _ => 0) (fun _ : O j => (basisAxisScale (basis j) i : ℝ)) T : Set (O j → ℤ)) + +noncomputable def allocatedLongJetBox (T : ℝ) : Set (AllocatedLongJetRows B U basis S O) := + Set.univ.pi (allocatedLongJetRowBox B U basis S O T) + +theorem allocatedLongJetRowBox_measurable (T : ℝ) (a : {a // ¬grid a}) : + MeasurableSet (allocatedLongJetRowBox B U basis S O T a) := by + rcases a with ⟨⟨j, a⟩, ha⟩ + cases a with + | inl i => + change MeasurableSet (Metric.closedBall (0 : O j → ℝ) T) + exact measurableSet_closedBall + | inr i => + change MeasurableSet (rectangularWeightIndices (fun _ => 0) + (fun _ : O j => (basisAxisScale (basis j) i : ℝ)) T : Set (O j → ℤ)) + exact Finset.measurableSet _ + +theorem allocatedLongJetBox_measurable (T : ℝ) : + MeasurableSet (allocatedLongJetBox B U basis S O T) := + MeasurableSet.univ_pi (allocatedLongJetRowBox_measurable B U basis S O T) + +end Box + +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {α : Type*} [Fintype α] [DecidableEq α] [DecidableEq G] +variable (x : G → IntegerScalarCubeBox α S.value) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] +variable (rows : ∀ j, O j → Finset α) +variable (s : ∀ j, O j ↪ BoundedIntegerExponent G (j.val+1)) +variable (hA : ∀ j, ((scalarKernelIntegerJet x (j.val+1) (rows j)).submatrix id (s j)).det ≠ 0) +variable {M : ℕ} (hM : 0 < M) +variable (hi : ∀ j : Fin m, + fixedKernelInverseBound S.positive x (j.val+1) (rows j) (s j) (hA j) (1/(M : ℝ))) +variable {P : ℝ} (hP : 0 ≤ P) (hMP : (M : ℝ) ≤ Real.exp P) +variable (hRP : ∀ j, R j ≤ Real.exp P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) +variable (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) +variable (hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ)+1 ≤ Real.exp P) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S)) +variable (hσ1 : ∀ j, σ j ≤ 1) + +local notation "T" => Real.exp (allocatedJetSupportLog (G := G) B α O P) +local notation "box" => allocatedLongJetBox B U basis S O T + +include hR hσ hM hi hP hMP hRP hRi hσi hcount + +theorem allocatedLongJetFactor_zero_off_box + (v : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) + (a : {a // ¬grid a}) (z : CoefficientJetAxisRow O a.val) + (hz : z ∉ allocatedLongJetRowBox B U basis S O T a) : + allocatedLongJetFactor B U basis hR hσ S x u v rows s hA hσ1 a z = 0 := by + have hv : ‖principalTupleNormalized lengths v‖ ≤ 1 := + principalTupleNormalized_norm_le (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val) lengths + (fun d => allocatedPrincipalSides_pos B U basis S ⟨d.1.val, d.2⟩) v + rcases a with ⟨⟨j, a⟩, ha⟩ + cases a with + | inl i => + change O j → ℝ at z + apply allocatedContinuousKernelDensity_zero_off_box B U basis hR hσ S x rows s hA + hM hi hP hMP hRP hRi hσi hcount u hσ1 j i _ hv z + change ¬dist z (0 : O j → ℝ) ≤ T at hz + rw [dist_zero_right] at hz + exact lt_of_not_ge hz + | inr i => + change (allocatedIntegerKernelPMF B U basis hR hσ S x u v rows j i (hσ1 j) (Nat.lt_of_not_ge ha) z).toReal = 0 + rw [allocatedIntegerKernelPMF_zero_off_box B U basis hR hσ S x u v rows j i (hσ1 j) + (Nat.lt_of_not_ge ha) hP (hRP j) z hz, ENNReal.toReal_zero] + +theorem allocatedLongJetDensity_zero_off_box + (v : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) + (z : AllocatedLongJetRows B U basis S O) (hz : z ∉ box) : + allocatedLongJetDensity B U basis hR hσ S x u v rows s hA hσ1 z = 0 := by + have ha : ∃ a, z a ∉ allocatedLongJetRowBox B U basis S O T a := by + simpa only [allocatedLongJetBox, Set.mem_univ_pi, not_forall] using hz + obtain ⟨a, ha⟩ := ha + exact Finset.prod_eq_zero (Finset.mem_univ a) + (allocatedLongJetFactor_zero_off_box B U basis S hR hσ x rows s hA hM hi hP hMP hRP hRi hσi hcount u hσ1 v a (z a) ha) + +include hσ1 in +theorem allocatedLongJetTarget_zero_off_box + (y : PrincipalAxisParameter (B := B) (h := layerSamplerDegree I n) (α := α) (fun a => ¬grid a) → ℝ) + (hy : ‖y‖ ≤ 1) (a : {a // ¬grid a}) (z : CoefficientJetAxisRow O a.val) + (hz : z ∉ allocatedLongJetRowBox B U basis S O T a) : + allocatedLongJetTarget B U basis S x u rows s hA y a z = 0 := by + rcases a with ⟨⟨j, a⟩, ha⟩ + cases a with + | inl i => + change O j → ℝ at z + apply allocatedContinuousKernelDensity_zero_off_box B U basis hR hσ S x rows s hA + hM hi hP hMP hRP hRi hσi hcount u hσ1 j i y hy z + change ¬dist z (0 : O j → ℝ) ≤ T at hz + rw [dist_zero_right] at hz + exact lt_of_not_ge hz + | inr i => + exact allocatedIntegerKernelDensity_zero_off_box B U basis hR hσ S x rows s hA + hM hi hP hMP hRP hRi hσi hcount u hσ1 j i y hy z hz + +include hσ1 in +theorem allocatedLongJetTarget_integral_zero_off_box + (z : AllocatedLongJetRows B U basis S O) (hz : z ∉ box) : + (∫ y, (∏ a, allocatedLongJetTarget B U basis S x u rows s hA y a (z a)) + ∂jointBooleanSource (fun a : {a // ¬grid a} => layerSamplerDegree I n a.val)) = 0 := by + have ha : ∃ a, z a ∉ allocatedLongJetRowBox B U basis S O T a := by + simpa only [allocatedLongJetBox, Set.mem_univ_pi, not_forall] using hz + obtain ⟨a, ha⟩ := ha + apply integral_eq_zero_of_ae + filter_upwards [jointBooleanSource_ae_closedBall (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val)] with y hy + exact Finset.prod_eq_zero (Finset.mem_univ a) + (allocatedLongJetTarget_zero_off_box B U basis S hR hσ x rows s hA hM hi hP hMP hRP hRi hσi hcount u hσ1 + y (by simpa only [Metric.mem_closedBall, dist_zero_right] using hy) a (z a) ha) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical ENNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable (O : Fin m → Type*) [∀ j, Fintype (O j)] + +local notation "grid" => allocatedGridAxis (I := I) U basis (LayerSamplerScale.value S) + +theorem allocatedLongJetRowBox_measure_lt_top (T : ℝ) (a : {a // ¬grid a}) : + coefficientJetAxisReference O a.val (allocatedLongJetRowBox B U basis S O T a) < ∞ := by + rcases a with ⟨⟨j, a⟩, ha⟩ + cases a with + | inl i => + change volume (Metric.closedBall (0 : O j → ℝ) T) < ∞ + exact (isCompact_closedBall (0 : O j → ℝ) T).measure_lt_top + | inr i => + change Measure.count (↑(rectangularWeightIndices (fun _ => 0) + (fun _ : O j => (basisAxisScale (basis j) i : ℝ)) T) : Set (O j → ℤ)) < ∞ + rw [Measure.count_apply_finset] + simp + +theorem allocatedLongJetBox_measure_lt_top (T : ℝ) : + allocatedLongJetReference B U basis S O (allocatedLongJetBox B U basis S O T) < ∞ := by + unfold allocatedLongJetReference allocatedLongJetBox + rw [Measure.pi_pi] + exact ENNReal.prod_lt_top (fun a _ => allocatedLongJetRowBox_measure_lt_top B U basis S O T a) + +theorem allocatedLongJetRowBox_measure_bound {T : ℝ} (hT : 0 ≤ T) (a : {a // ¬grid a}) : + (coefficientJetAxisReference O a.val).real (allocatedLongJetRowBox B U basis S O T a) ≤ + (2*T+1)^Fintype.card (O a.val.1) * allocatedLongJetOutputScale B U basis S (O := O) a := by + rcases a with ⟨⟨j, a⟩, ha⟩ + cases a with + | inl i => + change volume.real (Metric.closedBall (0 : O j → ℝ) T) ≤ (2*T+1)^Fintype.card (O j)*1 + rw [mul_one, measureReal_def, Real.volume_pi_closedBall 0 hT, ENNReal.toReal_ofReal (by positivity)] + exact pow_le_pow_left₀ (by positivity) (by linarith) _ + | inr i => + change (Measure.count : Measure (O j → ℤ)).real + (↑(rectangularWeightIndices (fun _ : O j => 0) (fun _ => (basisAxisScale (basis j) i : ℝ)) T) : Set (O j → ℤ)) ≤ + (2*T+1)^Fintype.card (O j) * (basisAxisScale (basis j) i : ℝ)^Fintype.card (O j) + rw [measureReal_def, Measure.count_apply_finset, ENNReal.toReal_natCast] + have hH : (1 : ℝ) ≤ basisAxisScale (basis j) i := by + exact_mod_cast Nat.succ_le_of_lt (basisAxisScale_pos (basis j) i) + simpa only [Finset.prod_const, Finset.card_univ] using + rectangularWeightIndices_card_le (fun _ : O j => 0) (fun _ => (basisAxisScale (basis j) i : ℝ)) + (fun _ => hH) hT + +theorem allocatedLongJetBox_measure_bound {T : ℝ} (hT : 0 ≤ T) : + (allocatedLongJetReference B U basis S O).real (allocatedLongJetBox B U basis S O T) ≤ + (2*T+1)^Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) * + ∏ a, allocatedLongJetOutputScale B U basis S (O := O) a := by + have hc : Fintype.card (Σ a : {a // ¬grid a}, O a.val.1) ≤ + Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) := by + apply Fintype.card_le_of_injective + (fun z : Σ a : {a // ¬grid a}, O a.val.1 => (⟨z.1.val, z.2⟩ : Σ a : LayerSamplerAxis I n, O a.1)) + intro a b hab + rcases a with ⟨⟨a, ha⟩, x⟩ + rcases b with ⟨⟨b, hb⟩, y⟩ + cases hab + rfl + have hs : (∑ a : {a // ¬grid a}, Fintype.card (O a.val.1)) ≤ + Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) := by + simpa only [Fintype.card_sigma] using hc + calc + _ = ∏ a : {a // ¬grid a}, + (coefficientJetAxisReference O a.val).real (allocatedLongJetRowBox B U basis S O T a) := by + simp only [measureReal_def, allocatedLongJetReference, allocatedLongJetBox, Measure.pi_pi, ENNReal.toReal_prod] + _ ≤ ∏ a : {a // ¬grid a}, + ((2*T+1)^Fintype.card (O a.val.1) * allocatedLongJetOutputScale B U basis S (O := O) a) := + Finset.prod_le_prod₀ (fun _ _ => ENNReal.toReal_nonneg) + (fun a _ => allocatedLongJetRowBox_measure_bound B U basis S O hT a) + _ = (2*T+1)^(∑ a : {a // ¬grid a}, Fintype.card (O a.val.1)) * + ∏ a, allocatedLongJetOutputScale B U basis S (O := O) a := by + rw [Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum] + _ ≤ _ := mul_le_mul_of_nonneg_right + (pow_le_pow_right₀ (by linarith) hs) + (Finset.prod_nonneg (fun a _ => (allocatedLongJetOutputScale_pos B U basis S a).le)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule Set +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (O Q : Fin m → Type*) [∀ j, Fintype (O j)] (d : ℕ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +theorem allocatedChart_long_rows_box {C : Fin m → ℝ} {T : ℝ} + (hC : ∀ j, 0 ≤ C j) (hT : 0 ≤ T) + (hchart : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + (hCT : ∀ j, C j * ((Fintype.card (J j) : ℝ) + 1) ≤ T) + (z : MixedCoveredJetSource I O Q n d) + (hz : z ∈ mixedCoveredJetRegion U o b d (fun j _ => standardLatticeClosedQuarterBox (J j))) : + (coefficientJetAxisSplit O I n (allocatedGridAxis (I := I) U b S.value) z.1).2 ∈ + allocatedLongJetBox B U b S O T := by + have hc (j : Fin m) (t : O j) : + ‖(orthonormalChart (o j) (fun i => (z.1 j).1 i t), + fun i => ((z.1 j).2 i t : ℝ) / (basisAxisScale (b j) i : ℝ))‖ ≤ T := by + let p := normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (orthonormalChart (o j) (fun i => (z.1 j).1 i t), fun i => (z.1 j).2 i t) + have hp : p ∈ standardLatticeClosedQuarterBox (J j) := (hz j (mem_univ _) t (mem_univ _)).1 + have hn : ‖p‖ ≤ (Fintype.card (J j) : ℝ) + 1 := by + calc + _ ≤ ∑ i, |p i| := euclidean_norm_le_sum_abs p + _ ≤ ∑ _i : J j, (1 : ℝ) := Finset.sum_le_sum (fun i _ => (hp i).trans (by norm_num)) + _ ≤ _ := by simp + have h := (hchart j p).trans ((mul_le_mul_of_nonneg_left hn (hC j)).trans (hCT j)) + change ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)) + ((normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm _)‖ ≤ T at h + rwa [ContinuousLinearEquiv.apply_symm_apply] at h + intro a _ + rcases a with ⟨⟨j, i | i⟩, ha⟩ + · change (z.1 j).1 i ∈ Metric.closedBall (0 : O j → ℝ) T + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg hT).mpr + intro t + have h := (orthonormalChart_symm_norm_le (o j) + (orthonormalChart (o j) (fun i => (z.1 j).1 i t))).trans ((norm_fst_le _).trans (hc j t)) + rw [ContinuousLinearEquiv.symm_apply_apply] at h + exact (norm_le_pi_norm (fun i => (z.1 j).1 i t) i).trans h + · change (z.1 j).2 i ∈ rectangularWeightIndices (fun _ => 0) + (fun _ : O j => (basisAxisScale (b j) i : ℝ)) T + apply mem_rectangularWeightIndices_zero_of_norm_le _ (fun _ => basisAxisScale_cast_pos (b j) i) + apply (pi_norm_le_iff_of_nonneg hT).mpr + intro t + exact (norm_le_pi_norm (fun i => ((z.1 j).2 i t : ℝ) / (basisAxisScale (b j) i : ℝ)) i).trans + ((norm_snd_le _).trans (hc j t)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule Set +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (O : Fin m → Type*) [∀ j, Fintype (O j)] +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +theorem allocatedAmbient_long_rows_box {C : Fin m → ℝ} {T : ℝ} + (hC : ∀ j, 0 ≤ C j) (hT : 0 ≤ T) + (hchart : ∀ j w, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ C j * ‖w‖) + (hCT : ∀ j, C j * ((Fintype.card (J j) : ℝ) + 1) ≤ T) + (z : ∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) + (hz : ∀ a, |mixedJetAmbientPoint U b o z a| ≤ 1) : + (coefficientJetAxisSplit O I n (allocatedGridAxis (I := I) U b S.value) z).2 ∈ + allocatedLongJetBox B U b S O T := by + have hc (j : Fin m) (t : O j) : + ‖(orthonormalChart (o j) (fun i => (z j).1 i t), + fun i => ((z j).2 i t : ℝ) / (basisAxisScale (b j) i : ℝ))‖ ≤ T := by + let p := normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (orthonormalChart (o j) (fun i => (z j).1 i t), fun i => (z j).2 i t) + have hn : ‖p‖ ≤ (Fintype.card (J j) : ℝ) + 1 := by + calc + _ ≤ ∑ i, |p i| := euclidean_norm_le_sum_abs p + _ ≤ ∑ _i : J j, (1 : ℝ) := Finset.sum_le_sum (fun i _ => hz ⟨j, t, i⟩) + _ ≤ _ := by simp + have h := (hchart j p).trans ((mul_le_mul_of_nonneg_left hn (hC j)).trans (hCT j)) + change ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)) + ((normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm _)‖ ≤ T at h + rwa [ContinuousLinearEquiv.apply_symm_apply] at h + intro a _ + rcases a with ⟨⟨j, i | i⟩, ha⟩ + · change (z j).1 i ∈ Metric.closedBall (0 : O j → ℝ) T + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg hT).mpr + intro t + have h := (orthonormalChart_symm_norm_le (o j) + (orthonormalChart (o j) (fun i => (z j).1 i t))).trans ((norm_fst_le _).trans (hc j t)) + rw [ContinuousLinearEquiv.symm_apply_apply] at h + exact (norm_le_pi_norm (fun i => (z j).1 i t) i).trans h + · change (z j).2 i ∈ rectangularWeightIndices (fun _ => 0) + (fun _ : O j => (basisAxisScale (b j) i : ℝ)) T + apply mem_rectangularWeightIndices_zero_of_norm_le _ (fun _ => basisAxisScale_cast_pos (b j) i) + apply (pi_norm_le_iff_of_nonneg hT).mpr + intro t + exact (norm_le_pi_norm (fun i => ((z j).2 i t : ℝ) / (basisAxisScale (b j) i : ℝ)) i).trans + ((norm_snd_le _).trans (hc j t)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientSiteCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientSiteCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4e59453c0ddeaf2376a50dd3e5d14e762b99a08 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedAmbientSiteCoordinates.lean @@ -0,0 +1,155 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedIdealSiteReconstruction + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "output" => (Σ a : {a // ¬grid a}, O (Sigma.fst (Subtype.val a))) + +noncomputable def allocatedLongAmbientCoordinates (z : JetAmbientIndex O J → ℝ) : output → ℝ + | ⟨⟨⟨j, .inl i⟩, _⟩, t⟩ => (mixedRealCoordinates (euclideanSubspace (U j)) (b j) (o j) + ((EuclideanSpace.equiv (J j) ℝ).symm (fun k => z ⟨j, t, k⟩))).1 i + | ⟨⟨⟨j, .inr i⟩, _⟩, t⟩ => (mixedRealCoordinates (euclideanSubspace (U j)) (b j) (o j) + ((EuclideanSpace.equiv (J j) ℝ).symm (fun k => z ⟨j, t, k⟩))).2 i + +omit [∀ j, Fintype (O j)] in +theorem allocatedLongAmbientCoordinates_point + (z : ∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) : + allocatedLongAmbientCoordinates B U b S o (mixedJetAmbientPoint U b o z) = + allocatedLongJetRealCoordinates B U b S (fun a => coefficientJetAxisEquiv O I n z a.val) := by + funext a + rcases a with ⟨⟨⟨j, i | i⟩, ha⟩, t⟩ + · change (mixedRealCoordinates (euclideanSubspace (U j)) (b j) (o j) + ((EuclideanSpace.equiv (J j) ℝ).symm ((EuclideanSpace.equiv (J j) ℝ) + (normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (orthonormalMixedChart (o j) (mixedArrayRegroup _ _ _ (z j) t)))))).1 i = _ + rw [ContinuousLinearEquiv.symm_apply_apply, mixedRealCoordinates_integer] + rfl + · change (mixedRealCoordinates (euclideanSubspace (U j)) (b j) (o j) + ((EuclideanSpace.equiv (J j) ℝ).symm ((EuclideanSpace.equiv (J j) ℝ) + (normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (orthonormalMixedChart (o j) (mixedArrayRegroup _ _ _ (z j) t)))))).2 i = _ + rw [ContinuousLinearEquiv.symm_apply_apply, mixedRealCoordinates_integer] + rfl + +theorem allocatedLongAmbientCoordinates_lipschitz (C : Fin m → ℝ≥0) + (hC : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ C j * ‖v‖) : + LipschitzWith (∑ j, C j * Fintype.card (J j)) (allocatedLongAmbientCoordinates B U b S (O := O) o) := by + apply LipschitzWith.of_dist_le_mul + intro z w + apply (dist_pi_le_iff (by positivity)).mpr + intro a + rcases a with ⟨⟨⟨j, i⟩, ha⟩, t⟩ + have hrow := ((mixedRealCoordinates_lipschitz (euclideanSubspace (U j)) (b j) (o j) (hC j)).comp + (euclideanFromCoordinates_lipschitz (D := J j))).dist_le_mul + (fun k => z ⟨j, t, k⟩) (fun k => w ⟨j, t, k⟩) + have hin : dist (fun k => z ⟨j, t, k⟩) (fun k => w ⟨j, t, k⟩) ≤ dist z w := + (dist_pi_le_iff dist_nonneg).mpr (fun k => dist_le_pi_dist z w ⟨j, t, k⟩) + let pz := mixedRealCoordinates (euclideanSubspace (U j)) (b j) (o j) + ((EuclideanSpace.equiv (J j) ℝ).symm (fun k => z ⟨j, t, k⟩)) + let pw := mixedRealCoordinates (euclideanSubspace (U j)) (b j) (o j) + ((EuclideanSpace.equiv (J j) ℝ).symm (fun k => w ⟨j, t, k⟩)) + have hout : dist (allocatedLongAmbientCoordinates B U b S o z ⟨⟨⟨j, i⟩, ha⟩, t⟩) + (allocatedLongAmbientCoordinates B U b S o w ⟨⟨⟨j, i⟩, ha⟩, t⟩) ≤ dist pz pw := by + cases i with + | inl i => exact (dist_le_pi_dist pz.1 pw.1 i).trans (le_max_left _ _) + | inr i => exact (dist_le_pi_dist pz.2 pw.2 i).trans (le_max_right _ _) + have hc : C j * Fintype.card (J j) ≤ ∑ j, C j * Fintype.card (J j) := + Finset.single_le_sum (f := fun k => C k * Fintype.card (J k)) + (fun _ _ => by positivity) (Finset.mem_univ j) + exact (hout.trans hrow).trans ((mul_le_mul_of_nonneg_right + (by exact_mod_cast hc) (dist_nonneg (x := z) (y := w))).trans' + (mul_le_mul_of_nonneg_left hin (NNReal.coe_nonneg _))) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped Classical BigOperators NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +local notation "single" => (fun _ : Fin m => Unit) +local notation "grid" => allocatedGridAxis (I := I) U b S.value + +noncomputable def allocatedAmbientSiteCoordinates + (z : JetAmbientIndex single J → ℝ) : LayerSamplerAxis I n → ℝ := + fun a => if h : ¬grid a then + allocatedLongAmbientCoordinates B U b S o z ⟨⟨a, h⟩, ()⟩ / R a.1 else 0 + +theorem allocatedAmbientSiteCoordinates_point + (z : ∀ j, (I j → Unit → ℝ) × (Fin (n j) → Unit → ℤ)) : + allocatedAmbientSiteCoordinates B U b S o (mixedJetAmbientPoint U b o z) = + allocatedNormalizedMixedSiteValue B U b S (fun j => mixedArrayRegroup _ _ _ (z j) ()) := by + funext a + rcases a with ⟨j, i | i⟩ + · by_cases h : grid ⟨j, Sum.inl i⟩ + · simp only [allocatedAmbientSiteCoordinates, allocatedNormalizedMixedSiteValue, h, + not_true_eq_false, dite_false, ite_true] + · simp only [allocatedAmbientSiteCoordinates, allocatedNormalizedMixedSiteValue, h, + not_false_eq_true, dite_true, ite_false, allocatedLongAmbientCoordinates_point] + rfl + · by_cases h : grid ⟨j, Sum.inr i⟩ + · simp only [allocatedAmbientSiteCoordinates, allocatedNormalizedMixedSiteValue, h, + not_true_eq_false, dite_false, ite_true] + · simp only [allocatedAmbientSiteCoordinates, allocatedNormalizedMixedSiteValue, h, + not_false_eq_true, dite_true, ite_false, allocatedLongAmbientCoordinates_point] + rfl + +theorem allocatedAmbientSiteCoordinates_lipschitz (hR : ∀ j, 0 < R j) + (C : Fin m → ℝ≥0) + (hC : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ C j * ‖v‖) + (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) : + LipschitzWith (K * ∑ j, C j * Fintype.card (J j)) (allocatedAmbientSiteCoordinates B U b S o) := by + have hlong := allocatedLongAmbientCoordinates_lipschitz B U b S (O := single) o C hC + apply LipschitzWith.of_dist_le_mul + intro z w + apply (dist_pi_le_iff (by positivity)).mpr + intro a + by_cases h : ¬grid a + · have hd := (dist_le_pi_dist (allocatedLongAmbientCoordinates B U b S o z) + (allocatedLongAmbientCoordinates B U b S o w) ⟨⟨a, h⟩, ()⟩).trans (hlong.dist_le_mul z w) + simp only [allocatedAmbientSiteCoordinates, dite_eq_left h, Real.dist_eq, ← sub_div, + abs_div, abs_of_pos (hR a.1)] + rw [Real.dist_eq] at hd + calc + _ ≤ (((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w) / R a.1 := + div_le_div_of_nonneg_right hd (hR a.1).le + _ = (R a.1)⁻¹ * (((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w) := by ring + _ ≤ (K : ℝ) * (((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w) := + mul_le_mul_of_nonneg_right (hK a.1) (mul_nonneg (NNReal.coe_nonneg _) dist_nonneg) + _ = _ := by simp only [NNReal.coe_mul]; ring + · simp only [allocatedAmbientSiteCoordinates, dite_eq_right h, dist_self] + positivity + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedArraySupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedArraySupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6ff35b084ff9d225d68e44dfd10e2cf3d9d26d0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedArraySupport.lean @@ -0,0 +1,48 @@ +import OAI.Combinatorics.Progressions.Polynomial.ContinuousPolynomialSupport +import OAI.Combinatorics.Progressions.Polynomial.IntegerPolynomialSupport + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem allocatedProfile_term_bound {J : Type*} [Fintype J] (P : Finset J) (j₀ : J) + (hj₀ : j₀ ∉ P) {R σ : ℝ} (hR : 0 < R) (hσ : 0 < σ) (hσ1 : σ ≤ 1) (j : J) : + |coefficientProfileCenter P (principalProfileSize R P.card) j| + + coefficientProfileWidth P j₀ (R / 4) (principalProfileSize R P.card) + (tailProfileSize R σ (Fintype.card J)) j ≤ 3 * R / 4 := by + classical + apply (Finset.single_le_sum (s := Finset.univ) + (fun i _ => add_nonneg (abs_nonneg _) (continuousPolynomialDensity_width_pos P j₀ hR hσ i).le) + (Finset.mem_univ j)).trans + exact (coefficientProfile_budget P j₀ hj₀ (principalProfileSize_pos hR _).le + (tailProfileSize_pos hR hσ _).le).trans (allocatedProfile_budget hR.le hσ1 _ _) + +theorem allocatedIntegerCoefficient_bound {J V : Type*} [Fintype J] + (P : Finset J) (j₀ : J) (h K L s : ℕ) (hh : 0 < h) (hK : 0 < K) (hL : 0 < L) + (T : V → ℝ) (hT : ∀ v, 0 < T v) (hTL : ∀ v, T v ≤ L) + (e : J → V →₀ ℕ) (he : ∀ j, (e j).sum (fun _ n => n) ≤ s) + (R σ : ℝ) (hR : 0 < R) (hσ : 0 < σ) (hσ1 : σ ≤ 1) + (hgap : L ^ h < K → (principalSamplingGapRatio (principalProfileSize R P.card) * L) ^ h ≤ K) + (hεL : 8 * (probabilityProfileLipschitz : ℝ) ≤ tailProfileSize R σ (Fintype.card J) * L) + (hj₀ : j₀ ∉ P) (he₀ : e j₀ = 0) + (hprincipal : ∀ j ∈ P, monomialScale T (e j) = + (integerAxisSideLength h K L (principalProfileSize R P.card) : ℝ) ^ h) + (j : J) {k : ℤ} + (hk : k ∈ (allocatedIntegerPolynomialCoordinatePMF P j₀ h K L s hh hK hL T hT hTL e he + R σ hR hσ hgap hεL j).support) : + |(k : ℝ) / K| * monomialScale T (e j) ≤ 3 * R / 4 := by + have hb := integerPolynomialCoordinatePMF_bound P j₀ h K L s hh hK hL T hT hTL e he + (R / 4) (principalProfileSize R P.card) (tailProfileSize R σ (Fintype.card J)) + (by positivity) (principalProfileSize_pos hR _) (tailProfileSize_pos hR hσ _) + hgap hεL hj₀ he₀ hprincipal j hk + exact hb.trans (allocatedProfile_term_bound P j₀ hj₀ hR hσ hσ1 j) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCanonicalSpatialCoarseSource.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCanonicalSpatialCoarseSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..c913e71c2f5be1e673ef18db780ca92910d8d253 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCanonicalSpatialCoarseSource.lean @@ -0,0 +1,551 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCanonicalUniformCoarseSource + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (C V : Fin m → ℝ≥0) + +theorem AllocatedSourceNumerics.canonical_spatial_size + {P : ℝ} (hnum : AllocatedSourceNumerics B U b S C V P) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + {X : Type*} [Fintype X] {dim M : ℕ} (selection : Fin dim ↪ G) + {p target Ecap Qstride Etau : ℝ} + (hp : 0 ≤ p) (htarget : 0 ≤ target) + (hEcap : 0 ≤ Ecap) (hQstride : 0 ≤ Qstride) (hEtau : 0 ≤ Etau) + (hM : 0 < M) (hm : ((m + 1 : ℕ) : ℝ) ≤ p) + (hdim : ((dim + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hMp : (M : ℝ) ≤ Real.exp p) + (stride N : X → ℕ) (hstride : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + {τ : ℝ} (hτ : 0 < τ) (hτinv : τ⁻¹ ≤ Real.exp Etau) + (hside : ∀ i, Real.exp (normalizedTupleSideLog X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection p target + (allocatedSpatialLateLog (G := G) B P P + Ecap + Qstride + Etau)) ≤ (N i : ℝ)) : + let W := allocatedPhysicalRootBudget B U b S (fun _ => 0) + let C₀ := 1 + (S.value : ℝ) + W + let Centry := allocatedPhysicalEntryBudget B U b S (fun _ => 0) + ∀ i, 8 * (1 + W) * (stride i : ℝ) * normalizedTupleResolution X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection M p target + C₀ W (Real.exp Ecap) Centry ≤ + (normalizedTupleNarrowWidth X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p target * τ) * (N i : ℝ) := by + intro W C₀ Centry i + obtain ⟨hW, hl₀, _, hC₀, _, _, hC₀l, _, hCentryl, hWl, hprofile⟩ := + hnum.late_bounds B U b S C V hR hσ + let l := allocatedSpatialLateLog (G := G) B P P + Ecap + Qstride + Etau + have hl : 0 ≤ l := by dsimp [l]; linarith only [hl₀, hEcap, hQstride, hEtau] + have hl₀l : allocatedSpatialLateLog (G := G) B P P ≤ l := by + dsimp [l]; linarith only [hEcap, hQstride, hEtau] + have hEcapl : Ecap ≤ l := by dsimp [l]; linarith only [hl₀, hQstride, hEtau] + have hQstridel : Qstride ≤ l := by dsimp [l]; linarith only [hl₀, hEcap, hEtau] + have hEtaul : Etau ≤ l := by dsimp [l]; linarith only [hl₀, hEcap, hQstride] + exact normalizedTupleSpatialSize X (PrincipalTupleIndex B (layerSamplerDegree I n)) + (m := m) selection hp htarget hl hM hm hdim hG hX hMp + (zero_le_one.trans hC₀) hW (Real.exp_pos _).le + (zero_le_one.trans (allocatedPhysicalEntryBudget_one_le B U b S (fun _ => 0))) + (hC₀l.trans (Real.exp_le_exp.mpr hl₀l)) (hWl.trans (Real.exp_le_exp.mpr hl₀l)) + (Real.exp_le_exp.mpr hEcapl) (hCentryl.trans (Real.exp_le_exp.mpr hl₀l)) + (hprofile.trans (Real.exp_le_exp.mpr hl₀l)) (Nat.cast_nonneg _) + ((hstride i).trans (Real.exp_le_exp.mpr hQstridel)) hτ + (hτinv.trans (Real.exp_le_exp.mpr hEtaul)) (hside i) + +theorem AllocatedSourceNumerics.canonical_spatial_choices + {P : ℝ} (hnum : AllocatedSourceNumerics B U b S C V P) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + {X : Type*} [Fintype X] {dim M : ℕ} (selection : Fin dim ↪ G) + {p target Ecap Qstride Etau earlyMesh : ℝ} + (hp : 0 ≤ p) (htarget : 0 ≤ target) + (hEcap : 0 ≤ Ecap) (hQstride : 0 ≤ Qstride) (hEtau : 0 ≤ Etau) + (hM : 0 < M) (hm : ((m + 1 : ℕ) : ℝ) ≤ p) + (hdim : ((dim + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hMp : (M : ℝ) ≤ Real.exp p) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp p) + (hearlyMesh : 0 < earlyMesh) + (stride N : X → ℕ) (hstridepos : ∀ i, 0 < stride i) + (hstride : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + {τ : ℝ} (hτ : 0 < τ) (hτinv : τ⁻¹ ≤ Real.exp Etau) + (hside : ∀ i, Real.exp (normalizedTupleSideLog X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection p target + (allocatedSpatialLateLog (G := G) B P P + Ecap + Qstride + Etau)) ≤ (N i : ℝ)) : + let W := allocatedPhysicalRootBudget B U b S (fun _ => 0) + let C₀ := 1 + (S.value : ℝ) + W + let Centry := allocatedPhysicalEntryBudget B U b S (fun _ => 0) + let ξ := normalizedTupleNarrowWidth X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p target + let δ := normalizedTupleRadius X selection M p target W + let ρ := normalizedTupleResolution X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p target C₀ W (Real.exp Ecap) Centry + let mesh := min (δ / 4) earlyMesh + 0 ≤ W ∧ 1 ≤ C₀ ∧ (S.value : ℝ) ≤ C₀ ∧ W ≤ C₀ ∧ + W ≤ Fintype.card (LayerSamplerVariables G I n B) * (S.value : ℝ) ∧ + 0 < ξ ∧ ξ ≤ 1 ∧ 0 < δ ∧ δ ≤ 1 ∧ 0 < ρ ∧ + 0 < mesh ∧ mesh ≤ earlyMesh ∧ mesh ≤ δ / 4 ∧ + (∀ i, 8 * (1 + W) * (stride i : ℝ) * ρ ≤ (ξ * τ) * (N i : ℝ)) ∧ + anisotropicSpatialMeshThreshold selection (PrincipalTupleIndex B (layerSamplerDegree I n)) C₀ ≤ ρ ∧ + 8 * probabilityProfileLipschitz ≤ ρ ∧ + 2 * (Fintype.card (Option (LayerSamplerVariables G I n B)) * (2 * Centry)) ≤ ρ ∧ + Fintype.card (PrincipalTupleIndex B (layerSamplerDegree I n)) * (2 * Centry) ≤ δ * ρ ∧ + Real.exp Ecap * (24 * probabilityProfileLipschitz * + Fintype.card (Option (LayerSamplerVariables G I n B) × X) / ρ) ≤ normalizedSpatialShare target / 2 ∧ + (∀ period : ℕ, period ≤ M ^ (m + 1) → + allocatedTupleSpatialError (Fintype.card X) selection + (PrincipalTupleIndex B (layerSamplerDegree I n)) M period C₀ ρ ξ W δ mesh * + coarseReferenceMassConstant dim X W S.value ≤ normalizedSpatialShare target / 2) ∧ + let widths := narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + (∀ i, 0 < N i) ∧ (∀ z, 0 < widths z) ∧ + ∀ cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride), + cells.Nonempty → 0 < ∑' z, selectedResidueSmoothWeight stride cells widths z := by + intro W C₀ Centry ξ δ ρ mesh + obtain ⟨hW, _, _, hC₀, hLC, hWC, _⟩ := hnum.late_bounds B U b S C V hR hσ + have hWscale : W ≤ Fintype.card (LayerSamplerVariables G I n B) * (S.value : ℝ) := by + simp only [W, allocatedPhysicalRootBudget, Int.cast_zero, abs_zero, Finset.sum_const_zero, + zero_add, le_refl] + have hL : (1 : ℝ) ≤ S.value := by exact_mod_cast S.positive + obtain ⟨hξ, hξ1, _, hchoices⟩ := canonicalSlicedSpatialChoices + (N := PrincipalTupleIndex B (layerSamplerDegree I n)) (X := X) (m := m) + selection hM hp htarget hm hdim hG hX hMp + obtain ⟨hδ, hδ1, hρ, hmesh, hmeshEarly, hmeshFine, hthreshold, hρ8, + hshift, hmove, hboundary, hsite⟩ := + hchoices (C₀ := C₀) (W := W) (L := S.value) (Cg := Real.exp Ecap) + (Centry := Centry) (growth := Fintype.card (LayerSamplerVariables G I n B)) + (zero_le_one.trans hC₀) hW hL (Real.exp_pos _).le + (zero_le_one.trans (allocatedPhysicalEntryBudget_one_le B U b S (fun _ => 0))) + hvars hWscale hearlyMesh + have hphysical := hnum.canonical_spatial_size B U b S C V hR hσ selection hp htarget + hEcap hQstride hEtau hM hm hdim hG hX hMp stride N hstride hτ hτinv hside + have hN (i) : 0 < N i := by + exact_mod_cast (Real.exp_pos _).trans_le (hside i) + have hwidth := narrowTrimmedSpatialWidths_pos (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) hW hτ hξ N hN + refine ⟨hW, hC₀, hLC, hWC, hWscale, hξ, hξ1, hδ, hδ1, hρ, + hmesh, hmeshEarly, hmeshFine, hphysical, hthreshold, hρ8, ?_, hmove, hboundary, hsite, + hN, hwidth, ?_⟩ + · simpa only [mul_assoc] using hshift + · intro cells hcells + exact (exists_selectedResidue_physical_cap (fun _ : LayerSamplerVariables G I n B => 0) + stride hstridepos cells hcells _ hwidth (fun z => hρ8.trans + (narrowTrimmedSpatial_residue_width_lower hW hτ hξ1 hρ.le N stride hN hstridepos + hphysical z))).choose + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +theorem exists_allocatedCanonicalSpatial_cutoff (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {G : Type*} [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {X : Type*} [Fintype X] {dim : ℕ} (selection : Fin dim ↪ G) + {P p target Ecap Qstride Etau : ℝ}, + 0 ≤ P → p ∈ Set.Icc 0 P → target ∈ Set.Icc 0 P → + Ecap ∈ Set.Icc 0 P → Qstride ∈ Set.Icc 0 P → Etau ∈ Set.Icc 0 P → + ((dim + 1 : ℕ) : ℝ) ≤ P → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P → + (Fintype.card X : ℝ) ≤ P → + let l := allocatedSpatialLateLog (G := G) B P P + Ecap + Qstride + Etau + normalizedTupleSideLog X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection p target l ≤ (P + C) ^ C := by + obtain ⟨a, _, hlate⟩ := exists_allocatedSpatialLateLog_bound m + let Xpoly : Polynomial ℕ := Polynomial.X + let latePoly := (Xpoly + Polynomial.C a) ^ a + 3 * Xpoly + let poly := tupleSideLogEnvelope Xpoly Xpoly latePoly + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget poly + refine ⟨C, hC, ?_⟩ + intro G _ I _ n B _ X _ dim selection P p target Ecap Qstride Etau + hP hp htarget hEcap hQstride hEtau hdim hvars hX l + have hl₀ := allocatedSpatialLateLog_nonneg (G := G) B hP hP + have hl : 0 ≤ l := by dsimp [l]; linarith only [hl₀, hEcap.1, hQstride.1, hEtau.1] + have hlbound : l ≤ (P + a) ^ a + 3 * P := by + have hb := hlate B hP hP le_rfl le_rfl hvars + dsimp only [l] + linarith only [hb, hEcap.2, hQstride.2, hEtau.2] + have hG : (Fintype.card G : ℝ) ≤ P := by + change (Fintype.card (G ⊕ PrincipalTupleIndex B (layerSamplerDegree I n)) : ℝ) ≤ P at hvars + simp only [Fintype.card_sum, Nat.cast_add] at hvars + linarith only [hvars, Nat.cast_nonneg (α := ℝ) + (Fintype.card (PrincipalTupleIndex B (layerSamplerDegree I n)))] + have hindices : (Fintype.card (PrincipalTupleIndex B (layerSamplerDegree I n)) : ℝ) ≤ P := by + change (Fintype.card (G ⊕ PrincipalTupleIndex B (layerSamplerDegree I n)) : ℝ) ≤ P at hvars + simp only [Fintype.card_sum, Nat.cast_add] at hvars + linarith only [hvars, Nat.cast_nonneg (α := ℝ) (Fintype.card G)] + have hqdim : (Fintype.card (Unit ⊕ Fin dim) : ℝ) ≤ P := by + simpa only [Fintype.card_sum, Fintype.card_unit, Fintype.card_fin, + Nat.add_comm 1] using hdim + have hs := (normalizedTuple_log_envelopes_of_le X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection hp.1 htarget.1 hl + hp.2 hqdim hG hindices hX).2 + apply (hs.trans (tupleSideLogEnvelope_mono hP htarget.1 hl le_rfl htarget.2 hlbound)).trans + simpa [poly, Xpoly, latePoly, tupleSideLogEnvelope, tupleLateLogEnvelope, + tupleWidthLogEnvelope, tupleEarlyLogEnvelope, spatialTupleToleranceLog, + spatialDiscretizationEnvelope, spatialMeshEnvelope, spatialLipschitzCostEnvelope, + spatialLipschitzEnvelope, spatialDisplacementEnvelope, spatialFixedProfileEnvelope, + anisotropicSpatialCapLog, coefficientErrorVolumeLog, Polynomial.eval₂_pow] using hbound P hP + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +universe uX uJ uO uG uI uB +open BooleanCubeKernel MeasureTheory +open scoped BigOperators Classical NNReal +attribute [local instance 2000] fullBooleanRowSetFintype + +private noncomputable abbrev canonicalCoverExponent + (m dim : ℕ) (_X : Type uX) (_G : Type uG) (I : Fin m → Type uI) + (n : Fin m → ℕ) (_B : LayerSamplerAxis I n → Type uB) (_J : Fin m → Type uJ) : ℕ := + Classical.choose (exists_allocated_canonical_constructed_projection.{uX,uG,uI,uB,uJ} m dim) + +variable {m : ℕ} {G : Type uG} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type uI} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type uB) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type uJ} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (Cproj Vproj : Fin m → ℝ≥0) +variable {dim : ℕ} + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "sides" => allocatedPrincipalSides B U b S +local notation "fullTuple" => PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) sides + +variable (X : Type uX) [Fintype X] [DecidableEq X] (modulus : ℕ) (q : X → ℕ) +local notation "refined" => residueRefinedPeriod modulus q +local notation "labels" => (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod refined) + +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (label₀ : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → + ZMod (residueRefinedPeriod modulus q)) +variable (hcell : 0 < (principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel (residueRefinedPeriod modulus q) y = label₀))) +variable (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (hy₀ : 0 < (containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) + hH hsubset (residueRefinedPeriod modulus q) label₀ hcell).weight y₀) +local notation "law" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) + hH hsubset refined label₀ hcell +local notation "wholeReference" => (fun _ : labels => y₀) + +variable (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable [NeZero modulus] {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (hcanonical : modulus = kernelPeriodCandidate (m + 1) (goodKernelUniformCandidate selection x hx m)) +variable (N : X → ℕ) {τ p target E : ℝ} +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +local notation "O" => (fun j : Fin m => (boundedBooleanJetRows (Fin dim) (Fin.val j + 1) : Type)) +local notation "rows" => (fun j => (Subtype.val : O j → Finset (Fin dim))) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) +variable (hm : ∀ j ex, coefficients (poly j) ex ∈ U j) +local notation "point" d => physicalCubeRowSample U d rows poly hm +variable (signal : (X → ℤ) → ℂ) (hsignal : ∀ u, ‖signal u‖ ≤ 1) +local notation "test" => physicalCubeSiteTest (integerSelfSiteTest dim signal) + +local notation "window" => spatialWindow (α := Fin dim) (trimmedSpatialRootScale τ N q) 4 + +variable (hN : ∀ t, 0 < N t) (hq : ∀ t, 0 < q t) (hτ : 0 < τ) +variable [CompactSpace (CoefficientTorus (K := Fin dim) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin dim) U)] +variable [BorelSpace (CoefficientTorus (K := Fin dim) U)] +variable (μ : Measure (CoefficientTorus (K := Fin dim) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] +local notation "jetHaar" => Measure.pi (fun j => @Measure.pi (O j) _ + (fullBooleanRowSetFintype dim (Fin.val j + 1)) _ (fun _ : O j => ν j)) + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (SiteTorus (Finset (Fin dim)) U)] +variable [BorelSpace (SiteTorus (Finset (Fin dim)) U)] +variable (μcoeff : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μcoeff.IsAddLeftInvariant] [IsProbabilityMeasure μcoeff] + +variable {Pproj Pk : ℝ} +local notation "coverExponent" => canonicalCoverExponent m dim X G I n B J +local notation "samplingExponent" => Classical.choose + (exists_allocatedCanonicalProjection_composed_budget m dim coverExponent) +local notation "Pmass" => (Pproj + samplingExponent) ^ samplingExponent +local notation "projectionLip" => (Subtype.mk (Real.exp Pmass) (Real.exp_nonneg _) : ℝ≥0) +local notation "projectionCapNN" => (Subtype.mk (Real.exp Pmass) (Real.exp_nonneg _) : ℝ≥0) +local notation "projectionCap" => Real.exp Pmass + +local notation "W" => allocatedPhysicalRootBudget B U b S (fun _ => 0) +local notation "C₀" => 1 + (S.value : ℝ) + W +local notation "Centry" => allocatedPhysicalEntryBudget B U b S (fun _ => 0) +local notation "ξ" => normalizedTupleNarrowWidth X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection M p target +local notation "δ" => normalizedTupleRadius X selection M p target W +local notation "ρ" => normalizedTupleResolution X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection M p target C₀ W projectionCap Centry +local notation "mesh" => min (δ / 4) (allocatedEarlyRecenteredMesh X selection M modulus p E) + +include hp μ hN hq hτ hcanonical hy₀ hsignal in +theorem exists_allocatedCanonicalSlice_spatial_projected_coarse_source + (hGproj : (Fintype.card G : ℝ) ≤ Pproj) + (hLproj : (S.value : ℝ) ≤ Real.exp Pproj) + (hMkPk : (M : ℝ) ≤ Real.exp Pk) (hperiodP : ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj) + (hCactual : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ Cproj j * ‖z‖) + (hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Vproj j) + (hσ1 : ∀ j, σ j ≤ 1) (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Cinv j * ‖z‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + {Rrank : ℝ} + (hXmass : (Fintype.card X : ℝ) ≤ Pmass) + (hframe : (Fintype.card (Option (Fin dim) × X) : ℝ) ≤ Pmass) + (hstrideP : ∀ i, (q i : ℝ) ≤ Real.exp Pmass) + (hτP : 1 / τ ≤ Real.exp Pmass) + (hsizeMass : ∀ i, Real.exp ((Pmass + Classical.choose + (exists_translated_physical_jet_density_window_mass.{uX,uJ,0,max uG uI uB} m dim)) ^ Classical.choose + (exists_translated_physical_jet_density_window_mass.{uX,uJ,0,max uG uI uB} m dim)) ≤ (N i : ℝ)) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) + (hRrank : Real.exp ((Pmass + Classical.choose + (exists_translated_physical_jet_density_window_mass.{uX,uJ,0,max uG uI uB} m dim)) ^ Classical.choose + (exists_translated_physical_jet_density_window_mass.{uX,uJ,0,max uG uI uB} m dim)) ≤ Rrank) + (hamb : (Fintype.card (CoefficientAmbientIndex (Fin dim) J) : ℝ) ≤ Pmass) + (hjet : ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin dim) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass) + {κ : ℝ} + (hpBudget : 0 ≤ p) (hE : 0 ≤ E) (htarget : 0 ≤ target) + (hmGeometry : ((m + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hdim : ((dim + 1 : ℕ) : ℝ) ≤ p) + (hMP : (M : ℝ) ≤ Real.exp p) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp p) + (hPproj : 1 ≤ Pproj) (hmProj : (m : ℝ) ≤ Pproj) + (hKproj : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj) + (hWproj : W ≤ Real.exp Pproj) + (hRproj : ∀ j, (R j)⁻¹ ≤ Real.exp Pproj) (hσproj : ∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) + (hcountProj : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) + (hIproj : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) (hnProj : ∀ j, (n j : ℝ) ≤ Pproj) + (hJproj : ∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) + (hProfileProj : (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj) + (hCproj : ∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) (hVproj : ∀ j, (Vproj j : ℝ) ≤ Real.exp Pproj) + (hXproj : (Fintype.card X : ℝ) ≤ Pproj) + (hFrameProj : (Fintype.card (Option (LayerSamplerVariables G I n B) × X) : ℝ) ≤ Pproj) + (hStrideProj : ∀ i, (q i : ℝ) ≤ Real.exp Pproj) + (hτProj : τ⁻¹ ≤ Real.exp Pproj) (hξProj : ξ⁻¹ ≤ Real.exp Pproj) + (hSizeProj : ∀ i, Real.exp ((Pproj + Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{uX,uG,uI,uB,uJ} m dim))) ^ Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{uX,uG,uI,uB,uJ} m dim))) ≤ (N i : ℝ)) + (hRankProj : Real.exp ((Pproj + Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{uX,uG,uI,uB,uJ} m dim))) ^ Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{uX,uG,uI,uB,uJ} m dim))) ≤ Rrank) + {Pside : ℝ} (hProjSide : Pproj ≤ Pside) (hCapSide : Pmass ≤ Pside) + (hpSide : p ≤ Pside) (htargetSide : target ≤ Pside) + (hside : ∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,uX} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,uX} m)) ≤ (N i : ℝ)) + (hCells : cells.Nonempty) (bases : Finset (X → ℤ)) (hbases : bases.Nonempty) : + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{uX,uG,uI,uB,uJ} m dim) + let coverLog := (Pproj + (dim + 2 : ℕ) + Acover) ^ Acover + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value Vproj : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let Z := selectedJointDensityMass bases q cells V + (allocatedJointBaseDensity B U b hb o hR hσ S X poly hm) + let hW := allocatedPhysicalRootBudget_nonneg B U b S (fun _ => 0) + let hξ := (canonicalSlicedSpatialChoices + (N := PrincipalTupleIndex B (layerSamplerDegree I n)) (X := X) (m := m) + selection hM hpBudget htarget hmGeometry hdim hG hX hMP).1 + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells V z), + κ ≤ ((law).complexMean (fun y => allocatedSlicedTupleValue B U b hb o hR hσ S X poly hm + N hN hW hτ hξ q cells hmass bases x y signal)).re → + ∃ cover : ℕ, modulus ∣ cover ∧ 0 < cover ∧ (cover : ℝ) ≤ Real.exp coverLog ∧ + ∃ g : fullTuple → EuclideanJetLayers U O → ℝ, + (∀ y, Continuous (g y)) ∧ + (∀ y z, g y z ∈ Set.Icc (0 : ℝ) cap) ∧ + (∀ y, Integrable (g y) jetHaar) ∧ + (∀ y, (∫ z, g y z ∂jetHaar) = 1) ∧ + (∀ y, (realDensityMeasure μcoeff (fun z => allocatedCoefficientDensity B U b hb o hR hσ S + (quotientIntegerCover (coefficientIntegerLattice (K := LayerSamplerVariables G I n B) U) cover z))).map + (euclideanCoefficientJetMap U (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) rows) = realDensityMeasure jetHaar (g y)) ∧ + (∀ law₁ : FiniteProbabilityWeights fullTuple, + ∃ F : (JetAmbientIndex O J → UnitAddCircle) → ℂ, + LipschitzWith projectionLip F ∧ (∀ z, ‖F z‖ ≤ projectionCapNN) ∧ + ∀ z, law₁.complexMean (fun y => (g y z : ℂ)) = F (coveredJetAmbientTorus U 1 z)) ∧ + ∃ base ∈ bases, Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ + Z * (κ - Real.exp (-Pproj) - Real.exp (-target)) - Real.exp (-E) ≤ + ((law).complexMean (allocatedRecenteredProfileTerm (τ := τ) («ξ» := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW + (allocatedEarlyRecenteredMesh X selection M modulus p E) base cells (point cover) test + (fun y z => (g y z : ℂ)))).re := by + intro Acover coverLog cap V Z hW hξ hmass hsource + have hPproj0 : 0 ≤ Pproj := zero_le_one.trans hPproj + have hPmass : 0 ≤ Pmass := by positivity + have hPside0 : 0 ≤ Pside := hPproj0.trans hProjSide + have hexp := Real.exp_le_exp.mpr hProjSide + have hnumSide : AllocatedSourceNumerics B U b S Cproj Vproj Pside := + ⟨hPside0, hmProj.trans hProjSide, hKproj.trans hProjSide, hLproj.trans hexp, + fun j => (hRproj j).trans hexp, fun j => (hσproj j).trans hexp, + fun j => (hcountProj j).trans hProjSide, fun j => (hIproj j).trans hProjSide, + fun j => (hnProj j).trans hProjSide, fun j => (hJproj j).trans hProjSide, + hProfileProj.trans hexp, fun j => (hCproj j).trans hexp, fun j => (hVproj j).trans hexp, + hWproj.trans hexp⟩ + have hperiod : modulus ≤ M ^ (m + 1) := by + rw [hcanonical] + exact kernelPeriodCandidate_le _ _ + have hearly := (allocatedEarlyRecenteredMesh_partition_budget m X selection + hpBudget hE hG hX hM hMP hperiod).1 + have hcutoff := (Classical.choose_spec (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,uX} m)).2 + (X := X) B selection hPside0 ⟨hpBudget, hpSide⟩ ⟨htarget, htargetSide⟩ ⟨hPmass, hCapSide⟩ + ⟨hPproj0, hProjSide⟩ ⟨hPproj0, hProjSide⟩ (hdim.trans hpSide) + (hKproj.trans hProjSide) (hX.trans hpSide) + have hactualSide (i) := (Real.exp_le_exp.mpr hcutoff).trans (hside i) + obtain ⟨hW', hC₀, hLC, hWC, hWscale, hξ', hξ1, hδpos, hδ1, hρ, hmeshpos, + hmeshCoarse, hmeshFine, hsize, hmesh, hρ8, hρshift, hρmove, hboundary, hsite, + hN', hwidths, hselectedMass⟩ := + hnumSide.canonical_spatial_choices B U b S Cproj Vproj hR hσ selection + hpBudget htarget hPmass hPproj0 hPproj0 hM hmGeometry hdim hG hX hMP hvars hearly + q N hq hStrideProj hτ hτProj hactualSide + have hmass' := hselectedMass cells hCells + exact exists_allocatedCanonicalSlice_uniform_projected_coarse_source + (B := B) + (U := U) + (b := b) + (S := S) + (hb := hb) + (o := o) + (hR := hR) + (hσ := hσ) + (Cproj := Cproj) + (Vproj := Vproj) + (X := X) + (modulus := modulus) + (q := q) + (H := H) + (step := step) + (c := c) + (hH := hH) + (hsubset := hsubset) + (label₀ := label₀) + (hcell := hcell) + (y₀ := y₀) + (hy₀ := hy₀) + (x := x) + (hM := hM) + (selection := selection) + (hx := hx) + (hcanonical := hcanonical) + (N := N) + (hW := hW) + («mesh» := mesh) + (cells := cells) + (poly := poly) + (hp := hp) + (hm := hm) + (signal := signal) + (hsignal := hsignal) + (hN := hN') + (hq := hq) + (hτ := hτ) + (hρ := hρ) + (hbudget := le_rfl) + (hC₀ := hC₀) + (hLC := hLC) + (hWC := hWC) + (hξ := hξ') + (hξ1 := hξ1) + (hsize := hsize) + (hmesh := hmesh) + (hρ8 := hρ8) + (hδ := hδpos.le) + (hρshift := hρshift) + (hρmove := hρmove) + (hmeshpos := hmeshpos) + (hmass := hmass') + (μ := μ) + (ν := ν) + (hXmass := hXmass) + (hframe := hframe) + (hstrideP := hstrideP) + (hτP := hτP) + (hsizeMass := hsizeMass) + (hrank := hrank) + (hRrank := hRrank) + (hamb := hamb) + (hjet := hjet) + (hboundary := hboundary) + (hsite := hsite modulus hperiod) + (hpBudget := hpBudget) + (hE := hE) + (hG := hG) + (hX := hX) + (hdim := hdim) + (hMP := hMP) + (hvars := hvars) + (hWscale := hWscale) + (hmeshCoarse := hmeshCoarse) + (hPproj := hPproj) + (hmProj := hmProj) + (hKproj := hKproj) + (hWproj := hWproj) + (hRproj := hRproj) + (hσproj := hσproj) + (hcountProj := hcountProj) + (hIproj := hIproj) + (hnProj := hnProj) + (hJproj := hJproj) + (hProfileProj := hProfileProj) + (hCproj := hCproj) + (hVproj := hVproj) + (hXproj := hXproj) + (hFrameProj := hFrameProj) + (hStrideProj := hStrideProj) + (hτProj := hτProj) + (hξProj := hξProj) + (hSizeProj := hSizeProj) + (hRankProj := hRankProj) + (hCells := hCells) + (bases := bases) + (hbases := hbases) + (μcoeff := μcoeff) + (hGproj := hGproj) + (hLproj := hLproj) + (hMkPk := hMkPk) + (hperiodP := hperiodP) + (hCactual := hCactual) + (hVactual := hVactual) + (hσ1 := hσ1) + (Cinv := Cinv) + (hCinv := hCinv) + (hchart := hchart) + (hsmall := hsmall) + hsource + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCanonicalSpatialProxy.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCanonicalSpatialProxy.lean new file mode 100644 index 0000000000000000000000000000000000000000..da045c9ffaa1043466d748823fafdd17d2931d89 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCanonicalSpatialProxy.lean @@ -0,0 +1,136 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedReferenceWindowTest + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def anisotropicVectorSiteError {α G : Type*} [Fintype α] [Fintype G] + (X N : Type*) [Fintype X] [Fintype N] (selection : α ↪ G) + (M modulus : ℕ) (W κ C₀ ρ ξ r : ℝ) : ℝ := + let E := anisotropicSpatialError selection N M κ C₀ ρ ξ + let Γ := (modulus : ℝ) ^ Fintype.card (Unit ⊕ α) + Fintype.card X * (E + 4 * Γ * (anisotropicSpatialDensityLip selection κ * (1 + W)) * r) * + (1 + Γ * anisotropicSpatialDensityCap selection κ + E) ^ Fintype.card X + +theorem anisotropicVectorSiteError_nonneg {α G : Type*} [Fintype α] [Fintype G] + (X N : Type*) [Fintype X] [Fintype N] (selection : α ↪ G) (M modulus : ℕ) + {W κ C₀ ρ ξ r : ℝ} (hW : 0 ≤ W) (hκ : 0 ≤ κ) (hC : 0 ≤ C₀) + (hρ : 0 ≤ ρ) (hξ : 0 ≤ ξ) (hr : 0 ≤ r) : + 0 ≤ anisotropicVectorSiteError X N selection M modulus W κ C₀ ρ ξ r := by + have he := anisotropicSpatialError_nonneg selection N M hκ hC hρ hξ + have hc := anisotropicSpatialDensityCap_nonneg selection hκ + have hl := anisotropicSpatialDensityLip_nonneg selection hκ + unfold anisotropicVectorSiteError + positivity + +namespace VectorPolynomial + +open BooleanCubeKernel +open scoped Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S)) + +local notation "vars" => LayerSamplerVariables G I n B +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "sides" => allocatedPrincipalSides B U basis S +local notation "ker" => (fun g => c (Sum.inl g) + (x g none : ℤ)) + +noncomputable def allocatedCenteredSpatialLaw {X : Type*} [Fintype X] + (Q : Option vars × X → ℝ) (hQ : ∀ z, 0 < Q z) + (w : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) : PMF (X → (Unit ⊕ α) → ℤ) := + (smoothProductPMF Q hQ).map (centeredPhysicalCubeMap + (allocatedPhysicalCubeRoot B U basis S c x (principalAxisJoin grid u w)) + (allocatedPhysicalCubeDirections B U basis S x (principalAxisJoin grid u w))) + +noncomputable def allocatedCanonicalSpatialProxy {X : Type*} [Fintype X] + (selection : α ↪ G) (hp : (selectedSpatialPivot ker (scalarCubeDifferenceMatrix x) selection).det ≠ 0) + (H : X → ℝ) (W : ℝ) (hW : 0 ≤ W) (modulus : ℕ) [NeZero modulus] + (label : PrincipalTupleIndex (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option α → ZMod modulus) + (mesh : ℝ) (v : X → (Unit ⊕ α) → ℤ) : ℂ := + ∏ d, spatialSiteApprox (selectedSpatialPivot ker (scalarCubeDifferenceMatrix x) selection) + (Matrix.fromCols (selectedSpatialFreeColumns ker (scalarCubeDifferenceMatrix x) selection) + (liftResidueMatrix (principalSpatialResidueColumns modulus (fun j => c (Sum.inr j)) id + (principalAxisResidueJoin grid u modulus label)))) + modulus (canonicalSpatialSiteDensity selection ker (scalarCubeDifferenceMatrix x) hp W S.value + hW (Nat.cast_pos.mpr S.positive)) (H d) 3 mesh (v d) + +omit [DecidableEq G] [DecidableEq α] in +theorem allocatedTrimmedSpatial_common_window {X : Type*} [Fintype X] + (N q : X → ℕ) (hN : ∀ d, 0 < N d) (hq : ∀ d, 0 < q d) + {W τ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (w : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) : + centeredPhysicalCubeWindow (allocatedPhysicalCubeRoot B U basis S c x (principalAxisJoin grid u w)) + (allocatedPhysicalCubeDirections B U basis S x (principalAxisJoin grid u w)) + (residueProfileWidth q (trimmedSpatialWidths (K := vars) W τ N)) ⊆ + commonSpatialWindow (trimmedSpatialRootScale τ N q) := by + intro v hv + exact (mem_commonSpatialWindow_scaled_iff _ + (fun d => (trimmedSpatial_scales_pos hW hτ N q d (hN d) (hq d)).1) v).mpr + (allocatedTrimmedSpatial_window_bound B U basis S c x (principalAxisJoin grid u w) + N q hN hq hW hτ hbudget v hv) + +theorem allocatedTrimmedSpatial_fiber_site_error (selection : α ↪ G) {M : ℕ} + {X : Type*} [Fintype X] (N q : X → ℕ) (hN : ∀ d, 0 < N d) (hq : ∀ d, 0 < q d) + {W τ κ C₀ ρ ξ mesh : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hκ : 0 < κ) (hρ : 0 < ρ) + (hx : GoodScalarKernelTuple selection κ M x) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (hC₀ : 1 ≤ C₀) (hLC : (S.value : ℝ) ≤ C₀) (hWC : W ≤ C₀) + (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + (hprincipalRoot : ∀ j, ((|c (.inr j)| : ℤ) + (sides j : ℤ) : ℝ) ≤ ξ * (1 + W)) + (hprincipalDir : ∀ j, ((|c (.inr j)| : ℤ) + (sides j : ℤ) : ℝ) ≤ ξ * S.value) + (hsize : ∀ d, 8 * (1 + W) * (q d : ℝ) * ρ ≤ τ * (N d : ℝ)) + (hmeshSize : anisotropicSpatialMeshThreshold selection (PrincipalTupleIndex B (layerSamplerDegree I n)) C₀ ≤ ρ) + (modulus : ℕ) [NeZero modulus] + (hperiod : integerScalarLattice (Unit ⊕ α) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot ker (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns ker (scalarCubeDifferenceMatrix x) selection)) + (hmesh : 0 < mesh) + (label : PrincipalTupleIndex (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option α → ZMod modulus) + (w : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) + (hw : principalResidueLabel modulus w = label) + (v : X → (Unit ⊕ α) → ℤ) (hv : v ∈ commonSpatialWindow (trimmedSpatialRootScale τ N q)) : + let H := trimmedSpatialRootScale τ N q + let T := trimmedSpatialSlopeScale W τ N q + let V := trimmedSpatialWidths (K := vars) W τ N + let hV := trimmedSpatialWidths_pos (K := vars) hW hτ N hN + let Q := residueProfileWidth q V + let hQ := residueProfileWidth_pos q V hq hV + let hp := goodScalarKernelTuple_spatial_det_ne_zero selection x ker hκ hx + ‖(((∏ d, ∏ i, physicalSpatialOutputScale α (H d) (T d) S.value i) * + (allocatedCenteredSpatialLaw B U basis S c x u Q hQ w v).toReal : ℝ) : ℂ) - + allocatedCanonicalSpatialProxy B U basis S c x u selection hp H W hW modulus label mesh v‖ ≤ + anisotropicVectorSiteError X (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + M modulus W κ C₀ ρ ξ mesh := by + intro H T V hV Q hQ hp + have h := allocatedTrimmedSpatial_vector_site_error B U basis S c x (principalAxisJoin grid u w) + selection N q hN hq hW hτ hκ hρ hx hbudget hC₀ hLC hWC hξ0 hξ1 hprincipalRoot hprincipalDir + hsize hmeshSize modulus hperiod (by norm_num : (0 : ℝ) < 3) hmesh v + ((mem_commonSpatialWindow_scaled_iff H + (fun d => (trimmedSpatial_scales_pos hW hτ N q d (hN d) (hq d)).1) v).mp hv) + dsimp only [H, T, V, Q] + unfold allocatedCenteredSpatialLaw centeredPhysicalCubeMap + simpa only [allocatedCanonicalSpatialProxy, + anisotropicVectorSiteError, principalSpatialColumns_join_residue, hw] using h + +end VectorPolynomial +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCenteredJointExcessTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCenteredJointExcessTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..41c53c10b2be200a61ef50f9d2b351c3bdfa44db --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCenteredJointExcessTransport.lean @@ -0,0 +1,101 @@ +import OAI.Combinatorics.Progressions.Probability.PreparedModularGeneralCenteredLaw + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] +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 (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (S : LayerSamplerScale (G := G) B U b R σ) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hmem : ∀ j e, coefficients (poly j) e ∈ U j) + +theorem allocatedCenteredJointDensity_normalizer_of_subtractConstant + (stride : X → ℕ) + (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) + (widths : Option (LayerSamplerVariables G I n B) × X → ℝ) + (bases : Finset (X → ℤ)) + (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) + (c : ∀ j, U j) + (hc : coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun s => c s.1)))) + (E : ℝ) + (hshift : + let Z : ℝ := selectedJointDensityMass bases stride cells widths + (allocatedJointBaseDensity B U b hb o hR hσ S X + (fun j => subtractConstant (c j).val (poly j)) + (fun j => coefficients_subtractConstant_mem (U j) (c j) (poly j) (hmem j))); + |Z - 1| ≤ Real.exp (-E) ∧ Z ∈ Set.Icc (1/2) (3/2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) : + let Z : ℝ := selectedJointDensityMass bases stride cells widths + (allocatedCenteredJointDensity B U b hb o hR hσ S poly hmem center); + |Z - 1| ≤ Real.exp (-E) ∧ Z ∈ Set.Icc (1/2) (3/2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2 := by + simpa only [allocatedJointBaseDensity_subtractConstant_centered + B U b hb o hR hσ S poly hmem center c hc] using hshift + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (N : X → ℕ) (hN : ∀ i, 0 < N i) +variable {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ : 0 < ξ) +variable (stride : X → ℕ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) +local notation "widths" => narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N +variable (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells + (narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) +variable (bases : Finset (X → ℤ)) (hbases : bases.Nonempty) + +omit [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] in +theorem allocatedCenteredJointFiniteLaw_site_excess_of_subtractConstant + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) + (c : ∀ j, U j) + (hc : coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun s => c s.1)))) + (htotal : 0 < selectedJointDensityMass bases stride cells widths + (allocatedJointBaseDensity B U b hb o hR hσ S X + (fun j => subtractConstant (c j).val (poly j)) + (fun j => coefficients_subtractConstant_mem (U j) (c j) (poly j) (hmem j)))) + (hcenter : 0 < selectedJointDensityMass bases stride cells widths + (allocatedCenteredJointDensity B U b hb o hR hσ S poly hmem center)) + {Sites Y : Type*} [Fintype Sites] [Nonempty Sites] [Fintype Y] + (physical : (bases × rectangularWeightIndices 0 widths 1) → Sites → Y) + (reference : FiniteProbabilityWeights Y) (cap ε : ℝ) + (hexcess : reference.excessMass + ((allocatedOriginalPathLaw B U b hb o hR hσ S X + (fun j => subtractConstant (c j).val (poly j)) + (fun j => coefficients_subtractConstant_mem (U j) (c j) (poly j) (hmem j)) + N hN hW hτ hξ stride cells hmass bases hbases htotal).siteLaw physical) cap ≤ ε) : + reference.excessMass + ((selectedJointFiniteLaw bases hbases stride cells widths + (narrowTrimmedSpatialWidths_pos hW hτ hξ N hN) hmass + (allocatedCenteredJointDensity B U b hb o hR hσ S poly hmem center) + (allocatedCenteredJointDensity_nonneg B U b hb o hR hσ S poly hmem center) + hcenter).siteLaw physical) cap ≤ ε := by + rw [← allocatedOriginalPathLaw_subtractConstant_eq_centered + B U b hb o hR hσ S poly hmem N hN hW hτ hξ stride cells hmass bases hbases + center c hc htotal hcenter] + exact hexcess + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedChartIdealAmbientLift.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedChartIdealAmbientLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef3c27ed7c9e15d70b67224b4703025a7be68bb1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedChartIdealAmbientLift.lean @@ -0,0 +1,110 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedFiniteModelPhysicalExpansion + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowTypes j → Finset α)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit rowTypes I n grid +local notation "baseVolume" => (allocatedFullGridNaturalVolume B U b S rowSets * + coveredJetArrayScale (O := rowTypes) U * ∏ a, allocatedLongJetOutputScale B U b S (O := rowTypes) a) + +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (x : G → IntegerScalarCubeBox α S.value) +variable (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U b S)) +variable (q d period : ℕ) [NeZero d] [NeZero period] +variable (r : ℝ≥0) (hr : 0 < r) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "region" => mixedCoveredJetRegion (E := E) U o b d + (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr +local notation "mask" => allocatedClippedPrefactorSiteMask B U b S rowSets x y₀ q d period +local notation "residue" => (fun j => integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict grid y₀) rows j (principalAxisRestrict (fun a => ¬grid a) y₀)) q) +local notation "inverseNormalizer" => ((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹ + +theorem exists_allocated_chart_ideal_ambient_lift + (hdiv : period ∣ d) + (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) + {T : Type*} [Fintype T] (a : T → ℂ) + (f : T → Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) {L : ℝ≥0} + (hf : ∀ k s, LipschitzWith L (f k s)) (hf1 : ∀ k s z, ‖f k s z‖ ≤ 1) : + let Lcoord := K * ∑ j, Cforward j * Fintype.card (J j) + let Lcut := (Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * Lcoord + let Lsite := Lcut * d + max (L * Lcoord * period) (4 * period) * (d / period : ℕ) + let Lrows := ∑ j : Fin m, ((rowSets j).card : ℝ≥0) + let mass := ∑ label : Finset α → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)), + ∑ k, ‖(2 : ℂ) ^ Fintype.card (Finset α) * + allocatedProductMaskedIdealCoefficient B U b S rowSets x y₀ q d period a label k‖₊ + ∃ F : (JetAmbientIndex rowTypes J → UnitAddCircle) → ℂ, + LipschitzWith (mass * (Fintype.card (Finset α) * (Lsite * Lrows))) F ∧ + (∀ z, ‖F z‖ ≤ mass) ∧ + ∀ y : EuclideanJetLayers U rowTypes, + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y = + F (coveredJetAmbientTorus U 1 y) := by + intro Lcoord Lcut Lsite Lrows mass + let Label := Finset α → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) + have hex (label : Label) (k : T) (s : Finset α) := + exists_allocated_masked_ambient_lift B U b S o hb bW d r hr period + hdiv hR C hC hchart hbudget Cforward hforward K hK (label s) (f k s) (hf k s) (hf1 k s) + choose g hg hgb hgv using hex + let c := fun t : Label × T => (2 : ℂ) ^ Fintype.card (Finset α) * + allocatedProductMaskedIdealCoefficient B U b S rowSets x y₀ q d period a t.1 t.2 + let v := fun t : Label × T => fun z : JetAmbientIndex rowTypes J → UnitAddCircle => + ∏ s, g t.1 t.2 s (rowsAmbientSite rowSets s z) + have hv (t : Label × T) : (∀ z, ‖v t z‖ ≤ 1) ∧ + LipschitzWith (Fintype.card (Finset α) * (Lsite * Lrows)) (v t) := by + have h := bounded_lipschitz_fintype_prod + (fun s z => g t.1 t.2 s (rowsAmbientSite rowSets s z)) (B := 1) le_rfl + (fun s => (hg t.1 t.2 s).comp (rowsAmbientSite_lipschitz rowSets s)) + (fun s z => hgb t.1 t.2 s _) + simpa only [one_pow, mul_one, NNReal.coe_one] using h + have hsum := finite_lipschitz_linear_combination c v (fun t => (hv t).2) (B := 1) + (fun t z => (hv t).1 z) + have hm : (∑ t, ‖c t‖₊) = mass := by + rw [Fintype.sum_prod_type] + rw [hm, mul_one] at hsum + refine ⟨fun z => ∑ t, c t * v t z, hsum.2, hsum.1, ?_⟩ + intro y + simp only [Fintype.sum_prod_type] + unfold allocatedProductChartIdealApproximation + apply Finset.sum_congr rfl + intro label _ + apply Finset.sum_congr rfl + intro k _ + dsimp only [c, v] + simp_rw [hgv, rowsAmbientSite_eq U rowSets] + rw [Finset.prod_mul_distrib] + simp only [Finset.prod_const, Finset.card_univ] + ring + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedChartIdealModelBound.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedChartIdealModelBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fcb4986f1b3b4551e0a12ee2bfd71a2ff1ed000 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedChartIdealModelBound.lean @@ -0,0 +1,60 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedRecenteredIdealError + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowTypes j → Finset α)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit rowTypes I n grid +local notation "baseVolume" => (allocatedFullGridNaturalVolume B U b S rowSets * + coveredJetArrayScale (O := rowTypes) U * ∏ a, allocatedLongJetOutputScale B U b S (O := rowTypes) a) + +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (x : G → IntegerScalarCubeBox α S.value) +variable (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U b S)) +variable (q d period : ℕ) [NeZero d] [NeZero period] +variable (r : ℝ≥0) (hr : 0 < r) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +theorem allocatedProductChartIdealApproximation_norm_le {K : Type*} [Fintype K] + (a : K → ℂ) (f : K → Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (hf : ∀ k s v, ‖f k s v‖ ≤ 1) (y : EuclideanJetLayers U rowTypes) : + ‖allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y‖ ≤ + ∑ label : Finset α → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)), ∑ k, + ‖allocatedProductMaskedIdealCoefficient B U b S rowSets x y₀ q d period a label k‖ := by + unfold allocatedProductChartIdealApproximation + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro label _ + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro k _ + rw [norm_mul, norm_prod] + apply (mul_le_mul_of_nonneg_left ?_ (norm_nonneg _)).trans_eq (mul_one _) + apply Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) + intro s _ + exact allocatedMaskedSiteChartFactor_norm B U b S o hb bW d r hr period (label s) (f k s) (hf k s) _ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCommonSupportedMesh.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCommonSupportedMesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cff6642599d9dfa4e3dab56cfd1931284513d88 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedCommonSupportedMesh.lean @@ -0,0 +1,487 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedGenuineCoverFromRaw + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +universe uG uI uB uGeom uCover uSpace + +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped ContDiff BigOperators Classical NNReal + +variable {m : ℕ} {G : Type uG} [Fintype G] [DecidableEq G] +attribute [local instance 2000] fullBooleanRowSetFintype + +variable {I : Fin m → Type uI} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type uB) [∀ a, Fintype (B a)] +variable {dim : ℕ} + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet (Fin dim) ((j : ℕ) + 1)) +local notation "jetRows" => (fun j : Fin m => (Subtype.val : BoundedBooleanJet (Fin dim) ((j : ℕ) + 1) → Finset (Fin dim))) + +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rowTypes" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) + +section FixedScale + +variable {J : Fin m → Type uGeom} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + +def AllocatedOriginalMeshForSampler + (S : LayerSamplerScale (G := G) B U b R σ) + (lengthLog Pbase Q Psp E pNum : ℝ) (δ : ℝ≥0) (A K : ℕ) : Prop := + (S.value : ℝ) ≤ Real.exp lengthLog ∧ + ∀ (x : G → IntegerScalarCubeBox (Fin dim) S.value) + {Mk : ℕ} (hMk : 0 < Mk) (selection : Fin dim ↪ G) + (hx : GoodScalarKernelTuple selection (1 / (Mk : ℝ)) Mk x) + (_hqDim : dim ≤ m + 1) (_hMkPsp : (Mk : ℝ) ≤ Real.exp Psp), + ∃ (d : ℕ) (hd : 0 < d), + let : NeZero d := ⟨hd.ne'⟩ + (d : ℝ) ≤ Real.exp ((Pbase + A) ^ A) ∧ + ∀ (modulus : ℕ) (hmodulus : 0 < modulus), + let : NeZero modulus := ⟨hmodulus.ne'⟩ + ∀ (_hmodulusSize : modulus ≤ Mk ^ (m + 1)) + (_hspatialPeriod : ∀ root : G → ℤ, integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) + (_hcoefficientPeriod : ∀ j, integerScalarLattice (jets j) (modulus : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (jetRows j)).mulVecLin.range), + ∃ (s : ∀ j, jets j ↪ BoundedIntegerExponent G (j.val + 1)) + (hA : ∀ j, ((scalarKernelIntegerJet x (j.val + 1) (jetRows j)).submatrix id (s j)).det ≠ 0), + (∀ j : Fin m, fixedKernelInverseBound S.positive x (j.val + 1) (jetRows j) (s j) (hA j) (1 / (Mk : ℝ))) ∧ + ∀ (_block : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, jets a.val.1 ↪ B a.val) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin dim)) U)] [BorelSpace (SiteTorus (Finset (Fin dim)) U)] + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + {Kcov : Fin m → Type uCover} [∀ j, Fintype (Kcov j)] + (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (_hCp : ∀ j, (C j : ℝ) ≤ Real.exp pNum) (_hVp : ∀ j, (V j : ℝ) ≤ Real.exp pNum) + (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, R j ≤ allocatedPhysicalChartRadius (G := G) B (Fin dim) Cinv 1 j) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + {X : Type uSpace} [Fintype X] [DecidableEq X] + (_hXPsp : (Fintype.card X : ℝ) ≤ Psp) + (q : X → ℕ) (_hq : ∀ t, 0 < q t) (_hqPsp : ∀ t, (q t : ℝ) ≤ Real.exp Psp), + let refined := residueRefinedPeriod modulus q + ∃ hRefined : 0 < refined, + let : NeZero refined := ⟨hRefined.ne'⟩ + (∀ t, q t * modulus ∣ refined) ∧ + (refined : ℝ) ≤ Real.exp ((m + 1 : ℕ) * Psp + Fintype.card X * Psp) ∧ + ∃ hsize : ∀ a, (Fintype.card (Fin dim) + 1) * refined ≤ + principalAxisLength (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S) a, + ∃ (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬(allocatedGridAxis (I := I) U b S.value) a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) + (residue : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + ∀ j, Matrix (jets j) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)), + (∀ u r, principalResidueLabel refined (reference u r) = r) ∧ + (∀ u r v, (allocatedLongResidueWeights B U b S refined hRefined r hsize).weight v ≠ 0 → + ∀ j, integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u jetRows j v) modulus = residue u r j) ∧ + let W := allocatedPhysicalRootBudget B U b S (fun _ => 0) + let hW := allocatedPhysicalRootBudget_nonneg B U b S (fun _ => 0) + let indices := PrincipalTupleIndex B (layerSamplerDegree I n) + let ξ := normalizedTupleNarrowWidth X indices selection Mk Psp (E + 2) + let hξ := normalizedTupleNarrowWidth_pos X indices selection Mk Psp (E + 2) + let mesh := normalizedTupleRadius X selection Mk Psp (E + 2) W / 4 + ∀ (small : ℝ) (_hsmall : 0 < small) (_hsmallMesh : small ≤ mesh) + {τ : ℝ} (hτ : 0 < τ) (_hτP : 1 / τ ≤ Real.exp pNum) + (N : X → ℕ) (hN : ∀ t, 0 < N t) + (_hsize : ∀ t, Real.exp ((Q + K) ^ K) ≤ (N t : ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j e, coefficients (poly j) e ∈ U j) + {rank : ℝ} + (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun t => (N t : ℝ)) rank (U j) (poly j)) + (_hRank : Real.exp ((Q + K) ^ K) ≤ rank) + (base : X → ℤ) + (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) + (_hcells : cells.Nonempty) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (_htest : ∀ site v, ‖test site v‖ ≤ 1) + (Z : ℝ) (_hZ : 1 / 2 ≤ Z), + ∃ hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := indices) W τ ξ N) z, + ‖allocatedOriginalTupleSource B U b hR hσ S x X q hb o N hN hW hτ hξ base cells hmass + (physicalCubeSiteTest test) Z poly hmem - + allocatedWholeIdealReference (τ := τ) (ξ := ξ) + B U b hR hσ S x jetRows X hMk selection hx modulus q reference hb o bW d + N hW small base cells (physicalCubeEuclideanSample U d poly hmem) (physicalCubeSiteTest test) Z δ‖ ≤ + Real.exp (-E) + +def AllocatedOriginalSupportedMeshAtScale (D Psp E e pNum p₁ wCover vCover : ℝ) (δ : ℝ≥0) + (A T Kproj Kideal Kcover : ℕ) : Prop := + let w : ℝ := (m * 2 ^ (m + 1) : ℕ) * Psp + let error := allocatedReferenceIdealError m D Psp (E + 1 + 4) + let gainLog := allocatedProfileGainLog m D Psp w + let S := allocatedIdealScale (G := G) B U b hR hσ D pNum e w error + let lengthLog := allocatedIdealScaleLog m D pNum e w error + let Pbase := allocatedIdealSourceBudget m D pNum e w error + let l := allocatedSpatialLateLog (G := G) B Pbase Pbase + let F := allocatedProfileFourierOutput (allocatedActualProfileInput m D pNum e gainLog lengthLog) + let Q := allocatedSourceSamplingBudget m dim A Pbase (E + 1) l F + let K := max T (max Kproj Kideal) + let Pjoined := max Q (max p₁ (max (Psp ^ 2) + (max (allocatedSiteErrorFourierOutput m p₁ wCover vCover) + (allocatedOriginalGeometryLog m Psp p₁ wCover vCover (E + 1))))) + let Kjoined := max K Kcover + (S.value : ℝ) ≤ Real.exp lengthLog ∧ + ∀ (x : G → IntegerScalarCubeBox (Fin dim) S.value) + {Mk : ℕ} (hMk : 0 < Mk) (selection : Fin dim ↪ G) + (hx : GoodScalarKernelTuple selection (1 / (Mk : ℝ)) Mk x) + (_hqDim : dim ≤ m + 1) (_hMkPsp : (Mk : ℝ) ≤ Real.exp Psp), + ∃ (d : ℕ) (hd : 0 < d), + let : NeZero d := ⟨hd.ne'⟩ + (d : ℝ) ≤ Real.exp ((Pbase + A) ^ A) ∧ + ∀ (modulus : ℕ) (hmodulus : 0 < modulus), + let : NeZero modulus := ⟨hmodulus.ne'⟩ + ∀ (_hmodulusSize : modulus ≤ Mk ^ (m + 1)) + (_hspatialPeriod : ∀ root : G → ℤ, integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) + (_hcoefficientPeriod : ∀ j, integerScalarLattice (jets j) (modulus : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (jetRows j)).mulVecLin.range), + ∃ (s : ∀ j, jets j ↪ BoundedIntegerExponent G (j.val + 1)) + (hA : ∀ j, ((scalarKernelIntegerJet x (j.val + 1) (jetRows j)).submatrix id (s j)).det ≠ 0), + (∀ j : Fin m, fixedKernelInverseBound S.positive x (j.val + 1) (jetRows j) (s j) (hA j) (1 / (Mk : ℝ))) ∧ + ∀ (_block : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, jets a.val.1 ↪ B a.val) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin dim)) U)] [BorelSpace (SiteTorus (Finset (Fin dim)) U)] + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + {Kcov : Fin m → Type uCover} [∀ j, Fintype (Kcov j)] + (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (_hCp : ∀ j, (C j : ℝ) ≤ Real.exp pNum) (_hVp : ∀ j, (V j : ℝ) ≤ Real.exp pNum) + (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, R j ≤ allocatedPhysicalChartRadius (G := G) B (Fin dim) Cinv 1 j) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + {X : Type uSpace} [Fintype X] [DecidableEq X] + (_hXPsp : (Fintype.card X : ℝ) ≤ Psp) + (q : X → ℕ) (_hq : ∀ t, 0 < q t) (_hqPsp : ∀ t, (q t : ℝ) ≤ Real.exp Psp), + let refined := residueRefinedPeriod modulus q + ∃ hRefined : 0 < refined, + let : NeZero refined := ⟨hRefined.ne'⟩ + (∀ t, q t * modulus ∣ refined) ∧ + (refined : ℝ) ≤ Real.exp ((m + 1 : ℕ) * Psp + Fintype.card X * Psp) ∧ + ∃ hsize : ∀ a, (Fintype.card (Fin dim) + 1) * refined ≤ + principalAxisLength (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S) a, + ∃ (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬(allocatedGridAxis (I := I) U b S.value) a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) + (residue : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + ∀ j, Matrix (jets j) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)), + (∀ u r, principalResidueLabel refined (reference u r) = r) ∧ + (∀ u r v, (allocatedLongResidueWeights B U b S refined hRefined r hsize).weight v ≠ 0 → + ∀ j, integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u jetRows j v) modulus = residue u r j) ∧ + ∀ (witnesses : (r : AllocatedPositiveResidue (dim := dim) B U b S refined) → + AllocatedResidueSiteWitness (dim := dim) B U b S refined r.val) + (_hcontract : AllocatedSourceCoverContract.{uG,uI,uB,uGeom,uCover,uSpace} + B U b hR hσ S q modulus witnesses o p₁ wCover vCover e E Psp) + [CompactSpace (CoefficientTorus (K := Fin dim) U)] + [MeasurableSpace (CoefficientTorus (K := Fin dim) U)] + [BorelSpace (CoefficientTorus (K := Fin dim) U)] + (μsmall : Measure (CoefficientTorus (K := Fin dim) U)) + [μsmall.IsAddLeftInvariant] [IsProbabilityMeasure μsmall], + let W := allocatedPhysicalRootBudget B U b S (fun _ => 0) + let hW := allocatedPhysicalRootBudget_nonneg B U b S (fun _ => 0) + let indices := PrincipalTupleIndex B (layerSamplerDegree I n) + let ξ := normalizedTupleNarrowWidth X indices selection Mk Psp (E + 1 + 2) + let hξ := normalizedTupleNarrowWidth_pos X indices selection Mk Psp (E + 1 + 2) + let sourceMesh := normalizedTupleRadius X selection Mk Psp (E + 1 + 2) W / 4 + let small := min sourceMesh (allocatedOriginalCoverMesh m Psp p₁ wCover vCover (E + 1)) + ∀ {τ : ℝ} (hτ : 0 < τ) (_hτP : 1 / τ ≤ Real.exp pNum) + (N : X → ℕ) (hN : ∀ t, 0 < N t) + (_hsize : ∀ t, Real.exp ((Pjoined + Kjoined) ^ Kjoined) ≤ (N t : ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j e, coefficients (poly j) e ∈ U j) + {rank : ℝ} + (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun t => (N t : ℝ)) rank (U j) (poly j)) + (_hRank : Real.exp ((Pjoined + Kjoined) ^ Kjoined) ≤ rank) + (base : X → ℤ) + (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) + (_hcells : cells.Nonempty) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (_htest : ∀ site v, ‖test site v‖ ≤ 1) + (Z : ℝ) (_hZ : 1 / 2 ≤ Z), + let f := allocatedPhysicalLongIdeal B U b hR S rowSets δ + let reference₀ := allocatedSupportedWholeReference (dim := dim) B U b S refined + let point := physicalCubeRowSample (O := rowTypes) U d rows poly hmem + let law := principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S) + let target := allocatedSupportedResidueSiteProfile B U b hR hσ S refined x hb o bW d f witnesses + let reconstruct := allocatedWholeResidueReconstruction B U b S X modulus q reference₀ x base + let weight := allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q reference₀ x hMk selection hx + N hW small base cells (physicalCubeSiteTest test) + let H := trimmedSpatialRootScale τ N q + let V₀ := narrowTrimmedSpatialWidths (G := G) (J := indices) W τ ξ N + ∃ hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := indices) W τ ξ N) z, + ‖allocatedOriginalTupleSource B U b hR hσ S x X q hb o N hN hW hτ hξ base cells hmass + (physicalCubeSiteTest test) Z poly hmem - + (law.fiberLaw (principalResidueLabel refined)).complexMean (fun r => + ∑ a : cells, (selectedResidueCellWeight q cells V₀ a : ℂ) * + ∑ v ∈ spatialWindow H 4, weight r a v * target r (point (reconstruct r a.val v))) / (Z : ℂ)‖ ≤ + Real.exp (-E) + +omit [DecidableEq G] in +theorem allocatedOriginalSupportedMesh_budgets + {D Psp E e pNum p₁ wCover vCover : ℝ} {A T Kproj Kideal Kcover : ℕ} + (hD : 0 ≤ D) (hPsp : 0 ≤ Psp) (hE : 0 ≤ E) (he : 0 ≤ e) (hpNum : 0 ≤ pNum) + (hpNum₁ : pNum ≤ p₁) (hPsp₁ : Psp ≤ p₁) (hT : 2 ≤ T) (hKcover : 2 ≤ Kcover) : + let w : ℝ := (m * 2 ^ (m + 1) : ℕ) * Psp + let error := allocatedReferenceIdealError m D Psp (E + 1 + 4) + let gainLog := allocatedProfileGainLog m D Psp w + let lengthLog := allocatedIdealScaleLog m D pNum e w error + let Pbase := allocatedIdealSourceBudget m D pNum e w error + let l := allocatedSpatialLateLog (G := G) B Pbase Pbase + let F := allocatedProfileFourierOutput (allocatedActualProfileInput m D pNum e gainLog lengthLog) + let Q := allocatedSourceSamplingBudget m dim A Pbase (E + 1) l F + let K := max T (max Kproj Kideal) + let Pjoined := max Q (max p₁ (max (Psp ^ 2) + (max (allocatedSiteErrorFourierOutput m p₁ wCover vCover) + (allocatedOriginalGeometryLog m Psp p₁ wCover vCover (E + 1))))) + let Kjoined := max K Kcover + 0 ≤ Pjoined ∧ Psp ≤ Pjoined ∧ pNum ≤ Pjoined ∧ Psp ^ 2 ≤ Pjoined ∧ + allocatedSiteErrorFourierOutput m p₁ wCover vCover ≤ Pjoined ∧ + allocatedOriginalGeometryLog m Psp p₁ wCover vCover (E + 1) ≤ Pjoined ∧ + (Q + K) ^ K ≤ (Pjoined + Kjoined) ^ Kjoined ∧ + (Pjoined + Kcover) ^ Kcover ≤ (Pjoined + Kjoined) ^ Kjoined := by + intro w error gainLog lengthLog Pbase l F Q K Pjoined Kjoined + have hw : 0 ≤ w := mul_nonneg (Nat.cast_nonneg _) hPsp + have herror : 0 ≤ error := allocatedReferenceIdealError_nonneg m hD hPsp (by linarith) + have hgain : 0 ≤ gainLog := allocatedProfileGainLog_nonneg m hD hPsp hw + have hlength : 0 ≤ lengthLog := by + have h := allocatedIdealScaleInput_bounds m hD hpNum he hw herror + exact h.2.1.trans h.2.2.2.2.2 + have hF : 0 ≤ F := allocatedProfileFourierOutput_nonneg + (allocatedActualProfileInput_bounds m hD hpNum he hgain hlength).1 + have hPbase : 0 ≤ Pbase := zero_le_one.trans + (allocatedIdealSourceBudget_bounds m hD hpNum he hw herror).1 + have hl : 0 ≤ l := allocatedSpatialLateLog_nonneg (G := G) B hPbase hPbase + have hQ : 0 ≤ Q := zero_le_one.trans + (allocatedSourceSamplingBudget_bounds m dim A hPbase (by linarith) hl hF).1 + have hQjoined : Q ≤ Pjoined := le_max_left _ _ + have hpjoined : p₁ ≤ Pjoined := (le_max_left _ _).trans (le_max_right _ _) + have hPjoined : 0 ≤ Pjoined := hQ.trans hQjoined + have hPspJoined : Psp ≤ Pjoined := hPsp₁.trans hpjoined + have hpNumJoined : pNum ≤ Pjoined := hpNum₁.trans hpjoined + have hSquareJoined : Psp ^ 2 ≤ Pjoined := + (le_max_left _ _).trans ((le_max_right _ _).trans (le_max_right _ _)) + have hFourierJoined : allocatedSiteErrorFourierOutput m p₁ wCover vCover ≤ Pjoined := + (le_max_left _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans (le_max_right _ _))) + have hGeometryJoined : allocatedOriginalGeometryLog m Psp p₁ wCover vCover (E + 1) ≤ Pjoined := + (le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans (le_max_right _ _))) + have hK : 1 ≤ K := (show 1 ≤ T by omega).trans (le_max_left _ _) + have hSourceCut : (Q + K) ^ K ≤ (Pjoined + Kjoined) ^ Kjoined := + (pow_le_pow_left₀ (by positivity) (add_le_add hQjoined le_rfl) K).trans + (shifted_power_self_mono hPjoined hK (le_max_left _ _)) + have hCoverCut : (Pjoined + Kcover) ^ Kcover ≤ (Pjoined + Kjoined) ^ Kjoined := + shifted_power_self_mono hPjoined (by omega) (le_max_right _ _) + exact ⟨hPjoined, hPspJoined, hpNumJoined, hSquareJoined, hFourierJoined, + hGeometryJoined, hSourceCut, hCoverCut⟩ + +theorem allocatedOriginalResidueWeightedMeshAtScale_supported + {D Psp E e pNum p₁ wCover vCover : ℝ} {δ : ℝ≥0} {A T Kproj Kideal Kcover : ℕ} + (hD : 0 ≤ D) (hPsp : 0 ≤ Psp) (hE : 0 ≤ E) (he : 0 ≤ e) (hpNum : 0 ≤ pNum) + (hp₁ : 0 ≤ p₁) (hwCover : 0 ≤ wCover) (hvCover : 0 ≤ vCover) + (hpNum₁ : pNum ≤ p₁) (hPsp₁ : Psp ≤ p₁) + (hdimSp : ((dim + 1 : ℕ) : ℝ) ≤ Psp) + (hvarsGrowth : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Psp) + (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp p₁) + (hδ : 0 < δ) (hδe : (δ : ℝ)⁻¹ ≤ Real.exp e) + (hT : 2 ≤ T) (hKcover : 2 ≤ Kcover) + (hSampling : AllocatedBooleanRowsSampling.{uSpace,uGeom,uG,uI,uB,uCover} + m dim Kcover rowTypes rows) + (horiginal : AllocatedOriginalResidueWeightedMeshAtScale.{uG,uI,uB,uGeom,uCover,uSpace} + (G := G) (dim := dim) B U b hR hσ D Psp (E + 1) e pNum δ A T Kproj Kideal) : + AllocatedOriginalSupportedMeshAtScale.{uG,uI,uB,uGeom,uCover,uSpace} + (G := G) (dim := dim) B U b hR hσ D Psp E e pNum p₁ wCover vCover δ A T Kproj Kideal Kcover := by + unfold AllocatedOriginalSupportedMeshAtScale + intro w error gainLog S lengthLog Pbase l F Q K Pjoined Kjoined + have hraw : AllocatedOriginalMeshForSampler.{uG,uI,uB,uGeom,uCover,uSpace} + (dim := dim) B U b hR hσ S lengthLog Pbase Q Psp (E + 1) pNum δ A K := horiginal + clear horiginal + have horiginal := hraw + clear hraw + obtain ⟨hPjoined, hPspJoined, hpNumJoined, hSquareJoined, hFourierJoined, + hGeometryJoined, hSourceCut, hCoverCut⟩ := + allocatedOriginalSupportedMesh_budgets (G := G) (dim := dim) B + (A := A) (Kproj := Kproj) (Kideal := Kideal) (wCover := wCover) (vCover := vCover) + hD hPsp hE he hpNum hpNum₁ hPsp₁ hT hKcover + obtain ⟨hS, horiginal⟩ := horiginal + refine ⟨hS, ?_⟩ + intro x Mk hMk selection hx hqDim hMkPsp + obtain ⟨d, hd, hdb, horiginal⟩ := horiginal x hMk selection hx hqDim hMkPsp + let : NeZero d := ⟨hd.ne'⟩ + refine ⟨d, hd, hdb, ?_⟩ + intro modulus hmodulus + let : NeZero modulus := ⟨hmodulus.ne'⟩ + intro _ hmodulusSize hspatialPeriod hcoefficientPeriod + obtain ⟨s, hA, hinverse, horiginal⟩ := horiginal modulus hmodulus + hmodulusSize hspatialPeriod hcoefficientPeriod + refine ⟨s, hA, hinverse, ?_⟩ + intro block _ _ _ _ _ _ hb o Kcov _ bW C V hC hV hCp hVp Cinv hCinv hchart hsmall μ _ _ ν _ _ + X _ _ hXPsp q hq hqPsp refined + obtain ⟨hRefined, hdiv, hRefinedBound, hsize, reference, residue, href, hresidue, horiginal⟩ := + horiginal block hb o bW C V hC hV hCp hVp Cinv hCinv hchart hsmall μ ν hXPsp q hq hqPsp + let : NeZero (residueRefinedPeriod modulus q) := ⟨hRefined.ne'⟩ + refine ⟨hRefined, hdiv, hRefinedBound, hsize, reference, residue, href, hresidue, ?_⟩ + intro witnesses hcontract _ _ _ μsmall _ _ W hW indices ξ hξ sourceMesh small τ hτ hτP + N hN hsizeN poly hpoly hmem rank hrank hRank base cells hcells test htest Z hZ + f reference₀ point law target reconstruct weight H V₀ + have hsourceMesh : 0 < sourceMesh := by + have ht : 0 < normalizedTupleTolerance X Psp (E + 1 + 2) := + (spatialTupleTolerance_spec (Fintype.card X) (Real.exp_nonneg _) + (Real.exp_nonneg _) (half_pos (Real.exp_pos _))).1 + have hLip := anisotropicSpatialDensityLip_nonneg selection (show 0 ≤ 1 / (Mk : ℝ) by positivity) + exact div_pos (twoTermErrorWidth_spec (by positivity) ht).1 (by norm_num) + have hcoverMesh := (allocatedOriginalCoverMesh_spec m hPsp hp₁ hwCover hvCover (by linarith : 0 ≤ E + 1)).1 + have hsmallPos : 0 < small := lt_min hsourceMesh hcoverMesh + obtain ⟨hmass, hsource⟩ := horiginal small hsmallPos (min_le_left _ _) hτ hτP N hN + (fun t => (Real.exp_le_exp.mpr hSourceCut).trans (hsizeN t)) poly hpoly hmem hrank + ((Real.exp_le_exp.mpr hSourceCut).trans hRank) base cells hcells test htest Z hZ + refine ⟨hmass, ?_⟩ + have hXJoined : (Fintype.card X : ℝ) ≤ Pjoined := hXPsp.trans hPspJoined + have hdimJoined : (Fintype.card (Option (Fin dim) × X) : ℝ) ≤ Pjoined := by + apply le_trans _ hSquareJoined + simp only [Fintype.card_prod, Fintype.card_option, Fintype.card_fin, Nat.cast_mul, + Nat.cast_add, Nat.cast_one, pow_two] + have hd : (dim : ℝ) + 1 ≤ Psp := by exact_mod_cast hdimSp + exact mul_le_mul hd hXPsp (Nat.cast_nonneg _) hPsp + let Prows (O : Fin m → Type) [∀ j, Fintype (O j)] (values : ∀ j, O j → Finset (Fin dim)) : Prop := + ∀ j, integerScalarLattice (O j) (modulus : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (values j)).mulVecLin.range + have hperiod : Prows rowTypes rows := + boundedBooleanJetRows_family_transport (fun j : Fin m => j.val + 1) Prows hcoefficientPeriod + (fun j => fullBooleanRowSetFintype dim (j.val + 1)) + have hWscale : W ≤ (Fintype.card (LayerSamplerVariables G I n B) : ℝ) * S.value := by + simp only [W, allocatedPhysicalRootBudget, Int.cast_zero, abs_zero, Finset.sum_const_zero, zero_add, le_refl] + have hZpos : 0 < Z := lt_of_lt_of_le (by norm_num) hZ + have hZi : Z⁻¹ ≤ 2 := (inv_le_iff_one_le_mul₀ hZpos).2 (by linarith) + exact hcontract sourceMesh hsourceMesh hKcover hSampling δ hδ hδe hRi + x hb bW d hperiod C V hC hV + (fun j => (hCp j).trans (Real.exp_le_exp.mpr hpNum₁)) + (fun j => (hVp j).trans (Real.exp_le_exp.mpr hpNum₁)) + hPjoined hXJoined hdimJoined hFourierJoined hGeometryJoined μsmall ν poly hpoly hmem + (Real.exp_nonneg Psp) (Real.exp_le_exp.mpr hPspJoined) hτ + (hτP.trans (Real.exp_le_exp.mpr hpNumJoined)) hqPsp N + (fun t => (Real.exp_le_exp.mpr hCoverCut).trans (hsizeN t)) hrank + ((Real.exp_le_exp.mpr hCoverCut).trans hRank) W hW + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) hvarsGrowth hWscale + base cells ξ hξ hmass Mk hMk hMkPsp selection hx le_rfl + (hspatialPeriod (fun g => (0 : ℤ) + (x g none : ℤ))) reference href + (physicalCubeSiteTest test) (physicalCubeSiteTest_norm_le test htest) Z hZpos hZi hsource + +end FixedScale + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +universe uG uI uB uGeom uCover uSpace + +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance 2000] fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type uG} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type uI} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type uB) [∀ a, Fintype (B a)] + +def AllocatedCommonSupportedMeshAt (p Psp E e t : ℝ) (δ : ℝ≥0) + (A T Kproj Kideal Kcover : ℕ) : Prop := + ∀ {c : ℝ} (_hc : 0 ≤ c) {J : Fin m → Type uGeom} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + (_hσt : ∀ j, σ j ≤ t) (_hR1 : ∀ j, R j ≤ 1) + (_hRi : ∀ j, (R j)⁻¹ ≤ Real.exp c) (_hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp c), + let p₁ := allocatedCommonRefinedSourceLog m p c Psp e (E + 1 + 4) + (allocatedOriginalCoverAccuracy Psp (E + 1)) + let w := allocatedSiteKernelMaskLog m Psp + let v := allocatedIdealProfileLog m p₁ e + AllocatedOriginalSupportedMeshAtScale.{uG,uI,uB,uGeom,uCover,uSpace} + (G := G) (dim := dim) B U b hR hσ (allocatedComparisonDimension m p) Psp E e + (allocatedCommonScaleNumeric m p c Psp (E + 1 + 4)) p₁ w v δ A T Kproj Kideal Kcover + +theorem allocatedCommonResidueWeightedOriginalMeshAt_supported + {p Psp E e t : ℝ} {δ : ℝ≥0} {A T Kproj Kideal : ℕ} + (hp : 0 ≤ p) (hPsp : 0 ≤ Psp) (hE : 0 ≤ E) (he : 0 ≤ e) + (hdim : dim ≤ m + 1) (hmPsp : ((m + 2 : ℕ) : ℝ) ≤ Psp) (hpPsp : p ≤ Psp) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hδ : 0 < δ) (hδe : (δ : ℝ)⁻¹ ≤ Real.exp e) (hT : 2 ≤ T) + (horiginal : AllocatedCommonResidueWeightedOriginalMeshAt.{uG,uI,uB,uGeom,uCover,uSpace} + (G := G) (dim := dim) B p Psp (E + 1) e t δ A T Kproj Kideal) : + ∃ Kcover : ℕ, 2 ≤ Kcover ∧ + AllocatedCommonSupportedMeshAt.{uG,uI,uB,uGeom,uCover,uSpace} + (G := G) (dim := dim) B p Psp E e t δ A T Kproj Kideal Kcover := by + obtain ⟨Kcover, hKcover, hSampling⟩ := + exists_allocated_boolean_rows_sampling.{uSpace,uGeom,uG,uI,uB,uCover} m dim + refine ⟨Kcover, hKcover, ?_⟩ + intro c hc J _ U b R σ hR hσ hσt hR1 hRi hσi p₁ w v + have hraw : 0 ≤ E + 1 + 4 := by linarith + have hsite : 0 ≤ allocatedOriginalCoverAccuracy Psp (E + 1) := by + have hsp := coefficientErrorSpatialLog_nonneg hPsp + unfold allocatedOriginalCoverAccuracy + linarith + obtain ⟨hp₁, _, _, hc₁, hPsp₁, _, _, _, _, hpNum₁, _⟩ := + allocatedCommonRefinedSourceLog_bounds m hp hc hPsp he hraw hsite + have hdimSp : ((dim + 1 : ℕ) : ℝ) ≤ Psp := by + apply le_trans _ hmPsp + exact_mod_cast (show dim + 1 ≤ m + 2 by omega) + have hvarsGrowth : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Psp := + (hvars.trans hpPsp).trans (by linarith [Real.add_one_le_exp Psp]) + exact allocatedOriginalResidueWeightedMeshAtScale_supported B U b hR hσ + (allocatedComparisonDimension_bounds m hp).1 hPsp hE he + (allocatedCommonScaleNumeric_bounds m hp hc hPsp hraw).1 hp₁ + (allocatedSiteKernelMaskLog_nonneg m hPsp) (allocatedIdealProfileLog_nonneg m hp₁ he) + hpNum₁ hPsp₁ hdimSp hvarsGrowth (fun j => (hRi j).trans (Real.exp_le_exp.mpr hc₁)) + hδ hδe hT hKcover (hSampling (fun j => fullBooleanRowSetFintype dim (j.val + 1))) + (horiginal hc U b hR hσ hσt hR1 hRi hσi) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedConstructedSpatialIdeal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedConstructedSpatialIdeal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2d0cc154fea8898d69471dfcae8c456f28fdc2f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedConstructedSpatialIdeal.lean @@ -0,0 +1,180 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedScaledSpatialMixture + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +universe uX uJ + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 uJ} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ1 : ∀ j, σ j ≤ 1) +variable (S : LayerSamplerScale (G := G) B U b R σ) +variable (X : Type uX) [Fintype X] [DecidableEq X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {τ : ℝ} (mesh : ℝ) (base : X → ℤ) +local notation "W" => allocatedPhysicalRootBudget B U b S (fun _ => 0) +local notation "hW" => allocatedPhysicalRootBudget_nonneg B U b S (fun _ => 0) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "H" => trimmedSpatialRootScale τ N q +local notation "factor" => ((30 / smoothProbabilityProfile 0) ^ Fintype.card (Option (Fin dim) × X) * + (((1 + W) / (S.value : ℝ)) ^ dim) ^ Fintype.card X) +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets +local notation "amp" => ‖((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹‖ +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d radius positiveRadius +local notation "spatialCap" => allocatedSpatialCoefficientCap X selection M modulus mesh +local notation "law" => principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S) +local notation "residueLaw" => FiniteProbabilityWeights.fiberLaw (law) (principalResidueLabel refined) +local notation "labels" => (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod refined) +local notation "reconstruct" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base + +local notation "rowTypes" => (fun j : Fin m => (rowSets j : Type)) +local notation "massCap" => (allocatedUniformGridVolumeCap B rowSets radius * + (2 * ((2 : ℝ) ^ dim * (2 * (radius : ℝ))) + 1) ^ + Fintype.card (Σ a : LayerSamplerAxis I n, rowTypes (Sigma.fst a))) + +variable (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable {Dgeom cgeom : ℝ} +variable (hgeom : AllocatedComparisonDimensions (G := G) B (Fin dim) + (fun j : Fin m => (boundedBooleanJetRows (Fin dim) (Fin.val j + 1) : Type)) Dgeom) +variable (hcgeom : 0 ≤ cgeom) +variable (hIgeom : ∀ j, (Fintype.card (I j) : ℝ) ≤ Dgeom) +variable (hngeom : ∀ j, (n j : ℝ) ≤ Dgeom) +variable (hCgeom : ∀ j, C j ≤ Real.exp cgeom) +variable (hsmall : ∀ j, R j ≤ allocatedProductChartRadius m Dgeom cgeom) +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (D : Fin m → ℝ≥0) +variable (hD : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ D j * ‖v‖) +variable (Vcov : Fin m → ℝ≥0) {Psrc Elog P : ℝ} +variable (hnum : AllocatedSourceNumerics B U b S D Vcov Psrc) +variable (hVcov : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Vcov j) +local notation "Qbudget" => allocatedCutoffSamplingLog m dim Psrc (normalizedSiteCutoffBound : ℝ) Elog P +local notation "uniformFactor" => ((30 / smoothProbabilityProfile 0) ^ Fintype.card (Option (Fin dim) × X) * + ((Psrc + 1) ^ dim) ^ Fintype.card X) + +include hσ1 hC hchart hgeom hcgeom hIgeom hngeom hCgeom hsmall hD hnum hVcov in +theorem exists_allocated_scaled_spatial_ideal_approximation + {Ksample : ℕ} (hKsample : 2 ≤ Ksample) + (hSampling : PhysicalAmbientRowsKernelSampling.{uX, uJ, 0} m dim Ksample rowTypes rows) + (hP : 0 ≤ P) (hn : (Fintype.card X : ℝ) ≤ P) + (hdim : (Fintype.card (Option (Fin dim) × X) : ℝ) ≤ P) + [CompactSpace (CoefficientTorus (K := Fin dim) U)] + [MeasurableSpace (CoefficientTorus (K := Fin dim) U)] [BorelSpace (CoefficientTorus (K := Fin dim) U)] + (μ : Measure (CoefficientTorus (K := Fin dim) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + {Rrank S₀ εs η : ℝ} (hS : 0 ≤ S₀) (hSP : S₀ ≤ Real.exp P) + (hεs : 0 < εs) (hτP : 1 / τ ≤ Real.exp P) (hεsP : 1 / εs ≤ Real.exp P) + (hstride : ∀ z, (q z : ℝ) ≤ S₀) + (hsize : ∀ z, Real.exp ((Qbudget + Ksample) ^ Ksample) ≤ (N z : ℝ)) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun z => (N z : ℝ)) Rrank (U j) (p j)) + (hRrank : Real.exp ((Qbudget + Ksample) ^ Ksample) ≤ Rrank) + (hη : 0 < η) (hElog : 0 ≤ Elog) (hηE : η⁻¹ ≤ Real.exp Elog) + (hq : ∀ z, 0 < q z) (hτ : 0 < τ) (hmesh : 0 < mesh) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hg : ∀ r k s u, ‖g r k s u‖ ≤ 1) + (hdimSmall : dim ≤ m + 1) (hδ : 0 < δ) (hδ1 : δ ≤ 1) + {ε ξ eδ eε : ℝ} (hε : 0 < ε) (hξ : 0 < ξ) + (heδ : 0 ≤ eδ) (heε : 0 ≤ eε) + (hδexp : (δ : ℝ)⁻¹ ≤ Real.exp eδ) (hεexp : ε⁻¹ ≤ Real.exp eε) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) : + ∃ t : Fin M, kernelPeriodCandidate (m + 1) t ≤ M ^ (m + 1) ∧ + ∃ F : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) + (allocatedPrincipalSides B U b S) → AllocatedFiniteIdealData (Fin dim) I n, + (∀ y₀, (F y₀).Bounds B U b S rowSets x y₀ refined d (kernelPeriodCandidate (m + 1) t) + hb o bW hR δ ε (allocatedFiniteIdealInputLog m Dgeom eδ eε) (layerKernelIndexBound m M)) ∧ + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + ∀ (test : Finset (Fin dim) → (X → ℝ) → ℂ), (∀ s u, ‖test s u‖ ≤ 1) → + let source := fun r : labels => ∑ a : cells, (selectedResidueCellWeight q cells V a : ℂ) * + ∑ v ∈ spatialWindow H 4, + allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r a v * + allocatedProductFullGridCoverValue B U b hR S refined coverWitness hb o bW d g δ x p hm + (reconstruct r a.val v) r + let target := fun r : labels => + if hr : 0 < (law).mass (Finset.univ.filter (fun y => principalResidueLabel refined y = r)) then + let rr : AllocatedPositiveResidue (dim := dim) B U b S refined := ⟨r, hr⟩ + ∑ a : cells, (selectedResidueCellWeight q cells V a : ℂ) * + ∑ v ∈ spatialWindow H 4, + allocatedRecenteredMaskedSpatialApproximation (τ := τ) B U b S X modulus q wholeReference + coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm rr a + (kernelPeriodCandidate (m + 1) t) (F ((coverWitness rr).representative)).coefficient + (F ((coverWitness rr).representative)).factor test v + else 0 + ‖(residueLaw).complexMean source - (residueLaw).complexMean target‖ ≤ + (spatialCap * allocatedClippedFullGridCoverCoefficientMass B U b S refined coverWitness) * + (((layerKernelIndexBound m M : ℝ) ^ Fintype.card (LayerSamplerAxis I n) * + coefficientDeckPeriodCap + (fun j : Fin m => {s : Finset (Fin dim) // s ∈ boundedBooleanJetRows (Fin dim) (Fin.val j + 1)}) + Kcov (kernelPeriodCandidate (m + 1) t)) * ε) * (uniformFactor * (massCap + 2 * η + εs)) := by + obtain ⟨t, _, _, hfamily⟩ := exists_good_kernel_finite_ideal_family B U b S hR x hM selection hx + hb o bW d hgeom hcgeom hIgeom hngeom C hC hchart hCgeom hsmall hdimSmall + δ hδ hδ1 hε heδ heε hδexp hεexp + obtain ⟨F, hF⟩ := hfamily refined + refine ⟨t, kernelPeriodCandidate_le (m + 1) t, F, hF, ?_⟩ + let maskCap : ℝ := (layerKernelIndexBound m M : ℝ) ^ Fintype.card (LayerSamplerAxis I n) * + coefficientDeckPeriodCap + (fun j : Fin m => {s : Finset (Fin dim) // s ∈ boundedBooleanJetRows (Fin dim) (Fin.val j + 1)}) + Kcov (kernelPeriodCandidate (m + 1) t) + have hA : 0 ≤ maskCap := mul_nonneg (pow_nonneg (Nat.cast_nonneg _) _) + (coefficientDeckPeriodCap_nonneg _ _ _) + have hfI : ∀ r k s z, ‖(F ((coverWitness r).representative)).factor k s z‖ ≤ 1 := + fun r => (hF ((coverWitness r).representative)).2.2.2.1 + have herr := fun r => (hF ((coverWitness r).representative)).2.2.2.2.2.2.2.2.2.2 + exact allocatedRecenteredMaskedSpatialApproximation_scaled_error + (K := fun r => (F ((coverWitness r).representative)).Term) + B U b hR hσ1 S X modulus q wholeReference coverWitness hb o bW d g δ x hM selection hx + N mesh base cells p hm (fun _ => kernelPeriodCandidate (m + 1) t) + (fun r => (F ((coverWitness r).representative)).coefficient) + (fun r => (F ((coverWitness r).representative)).factor) + C hC hchart hgeom hcgeom hIgeom hngeom hCgeom hsmall D hD Vcov hnum hVcov + hKsample hSampling hP hn hdim μ ν hS hSP hεs hτP hεsP hstride hsize hrank hRrank + hη hElog hηE hq hτ hmesh hperiod hp hg hfI hA hε.le hξ hZ herr + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedDetectedSpatialNativeSource.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedDetectedSpatialNativeSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca4f782ddb43e974e0dd3a0fc065842ad7e7fa92 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedDetectedSpatialNativeSource.lean @@ -0,0 +1,1032 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCanonicalProjectedNativeSource +import OAI.Combinatorics.Progressions.Estimates.PreparedModularCanonicalDetectorThreshold +import OAI.Combinatorics.Progressions.Geometry.AllocatedCanonicalSpatialCoarseSource + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +omit [DecidableEq G] in + +theorem allocatedCanonicalRoot_native_geometry + {dim M period : ℕ} (selection : Fin dim ↪ G) + (x : G → IntegerScalarCubeBox (Fin dim) S.value) + (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) + (hcanonical : period = kernelPeriodCandidate (m + 1) (goodKernelUniformCandidate selection x hx m)) + {p : ℝ} (hp : 0 ≤ p) (hdegree : ((m + 1 : ℕ) : ℝ) ≤ p) + (hM : (M : ℝ) ≤ Real.exp p) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp p) : + let W := allocatedPhysicalRootBudget B U b S (fun _ => 0) + let Dphysical := (Fintype.card (LayerSamplerVariables G I n B) : ℝ) + 0 ≤ W ∧ Dphysical ≤ Real.exp p ∧ W ≤ Dphysical * S.value ∧ + W ≤ Real.exp p * S.value ∧ (period : ℝ) ≤ Real.exp (p ^ 2) := by + intro W Dphysical + have hW : W = Dphysical * S.value := by + simp only [W, Dphysical, allocatedPhysicalRootBudget, Int.cast_zero, abs_zero, + Finset.sum_const_zero, zero_add] + have hperiod : period ≤ M ^ (m + 1) := by + rw [hcanonical] + exact kernelPeriodCandidate_le _ _ + refine ⟨allocatedPhysicalRootBudget_nonneg B U b S (fun _ => 0), hvars, hW.le, ?_, ?_⟩ + · rw [hW] + exact mul_le_mul_of_nonneg_right hvars (Nat.cast_nonneg _) + · exact coefficientErrorPeriod_exp_sq hp hdegree hM hperiod + +end Erdos3.VectorPolynomial + +namespace Erdos3.VectorPolynomial +universe uG uI uB uJ uQ +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal +attribute [local irreducible] residueRefinedPeriod + +variable {m : ℕ} {G : Type uG} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type uI} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type uB) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type uJ} [∀ j, Fintype (J j)] (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 {s nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (x : G → IntegerScalarCubeBox (Fin (s + 1)) S.value) +variable {Mk : ℕ} (hMk : 0 < Mk) +variable (selection : Fin (s + 1) ↪ G) +variable (hgood : GoodScalarKernelTuple selection (1 / (Mk : ℝ)) Mk x) +variable (period : ℕ) [NeZero period] (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (hperiodCanonical : period = kernelPeriodCandidate (m + 1) (goodKernelUniformCandidate selection x hgood m)) +variable (modulus : ℕ) +variable (hmodulusRefined : modulus = residueRefinedPeriod period stride) +variable {P : ℝ} (hP : 0 ≤ P) (hMkP : (Mk : ℝ) ≤ Real.exp P) +variable (hRP : ∀ j, R j ≤ Real.exp P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) +variable (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) +variable (hcount : ∀ j : Fin m, (Fintype.card + (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) + 1 ≤ Real.exp P) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type uQ) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable (H₀ step₀ : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c₀ : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH₀ : ∀ t, 0 < H₀ t) +variable (hsubset₀ : ∀ t, integerProgressionSupport (c₀ t) (step₀ t : ℤ) (H₀ t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (r₀ : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin (s + 1)) → ZMod modulus) +variable (hcell : 0 < (principalTupleWeights (α := (Fin (s + 1))) B (layerSamplerDegree I n) H₀ hH₀).mass + (Finset.univ.filter (fun y => principalResidueLabel modulus y = r₀))) +local notation "embed" => (fun j : Tuple => (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j) : PrincipalTupleIndex B (layerSamplerDegree I n))) +local notation "H" => (fun j : Tuple => H₀ (embed j)) +local notation "step" => (fun j : Tuple => step₀ (embed j)) +local notation "c" => (fun j : Tuple => c₀ (embed j)) +local notation "hsubset" => (fun j : Tuple => hsubset₀ (embed j)) +local notation "residue" => (fun j : Tuple => r₀ (embed j)) +local notation "GridTuples" => PrincipalAxisTuples (α := (Fin (s + 1))) grid (allocatedPrincipalSides B U basis S) +local notation "wholeLaw" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H₀ step₀ c₀ (allocatedPrincipalSides_pos B U basis S) hH₀ hsubset₀ modulus r₀ hcell +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H₀ step₀ c₀ (allocatedPrincipalSides_pos B U basis S) hH₀ hsubset₀ modulus r₀ hcell grid +local notation "wholeRoot" y => allocatedPhysicalCubeRoot B U basis S (fun _ => 0) x y +local notation "wholeDirs" y => allocatedPhysicalCubeDirections B U basis S x y + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +include hb o bW hperiodCanonical hmodulusRefined μ ν μrows hR hσ hMk hgood hP hMkP hRP hRi hσi hcount in + +theorem exists_allocatedCanonicalSlice_spatial_native_source + {D target Pk Prho F Qstride : ℝ} + (hdimensions : AllocatedComparisonDimensions (G := G) B (Fin (s + 1)) selectedRows D) + (hPk : 0 ≤ Pk) + (hMkPk : (Mk : ℝ) ≤ Real.exp Pk) + (hPrho : 0 ≤ Prho) + (htarget : 0 ≤ target) + (hF : 0 ≤ F) + (hQstride : 0 ≤ Qstride) + (hstride : ∀ i, 0 < stride i) + (hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (hlength : Real.exp (allocatedAffineLengthLog m D P Prho Pk target F (((m + 1 : ℕ) : ℝ) * Pk + Fintype.card (Fin nX) * Qstride)) ≤ S.value) + {δ η : ℝ} + (ρ : (LayerSamplerAxis I n → Prop) → ℝ≥0) + (t : ℝ) + (htone : t ≤ 1) + (hs : AllocatedAffineCoveredComparison.{uJ, uQ, _, _, _, _, _} (G := G) B rows δ η ρ t htone) + (hρ : 0 < ρ grid) + (hρ1 : ρ grid ≤ 1) + (hσsmall : ∀ j, σ j ≤ t) + (hstep : ∀ j : Tuple, 0 < step j) + (hδ : 0 < δ) + (hδF : δ⁻¹ ≤ Real.exp F) + (hdense : ∀ j : Tuple, δ * L j ≤ ((integerProgressionSupport (c j) (step j : ℤ) (H j)).card : ℝ)) + (hq : Fintype.card (Fin (s + 1)) ≤ m + 1) + (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin (s + 1)) (allocatedPrincipalSides B U basis S)) + (hy₀ : 0 < (wholeLaw).weight y₀) + (T : Fin m → ℝ) + (hT : ∀ j, partitionedIdealRadius (Fin (s + 1)) m + 1 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (s + 1)) * ((Fintype.card (Fin (s + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (C : Fin m → ℝ) + (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) + (hρlog : (ρ grid : ℝ)⁻¹ ≤ Real.exp Prho) + (hη0 : 0 ≤ η) + (hηsmall : η ≤ Real.exp (-(target + 1 + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 4))) + (siteRadius : ℝ≥0) + (hrone : 1 ≤ siteRadius) + (hsitebudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (s + 1))) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4) + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) + (hK : ∀ j, (R j)⁻¹ ≤ K) + (hradius : ∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) + {Pbox Vlog Nlog Mlog baseAmbient : ℝ} + (hPbox : 0 ≤ Pbox) + (hVlog : 0 ≤ Vlog) + (hNlog : 0 ≤ Nlog) + (hMlog : 0 ≤ Mlog) + (hbox : 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp Pbox) + (hvolume : allocatedFullGridNaturalVolume B U basis S rowSets ≤ Real.exp Vlog) + (hnormalizer : ‖((allocatedProductIdealNormalizer B U basis S rowSets : ℝ) : ℂ)⁻¹‖ ≤ Real.exp Nlog) + (hmask : (layerKernelIndexBound m Mk : ℝ) ^ Fintype.card (LayerSamplerAxis I n) * + coefficientDeckPeriodCap selectedRows Q period ≤ Real.exp Mlog) + (hbaseAmbient : 0 ≤ baseAmbient) + (hvbase : Vlog ≤ baseAmbient) + (hnbase : Nlog ≤ baseAmbient) + (hmbase : Mlog ≤ baseAmbient) + (hsites : (Fintype.card (Finset (Fin (s + 1))) : ℝ) ≤ baseAmbient) + (haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ baseAmbient) + (hlabels : (Fintype.card ((∀ j, Fin (n j) → ZMod period) × (∀ j, Q j → ZMod period)) : ℝ) ≤ Real.exp baseAmbient) + (hKbase : (K : ℝ) ≤ Real.exp baseAmbient) + (hcoords : ((∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp baseAmbient) + (hpbase : (period : ℝ) ≤ Real.exp baseAmbient) + (hrowsAmbient : ((∑ j : Fin m, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (houtputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ baseAmbient) + (hheight : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ Real.exp baseAmbient) + (Qgrid : ℝ≥0) + (hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U basis S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U basis S a).1 (allocatedGridIntegerAxis B U basis S a).2) : ℝ) + 1) ≤ Qgrid) + {δg : ℝ} + (hδg : 0 < δg) + (hdenseg : ∀ tg, δg * allocatedPrincipalSides B U basis S tg ≤ (H₀ tg : ℝ)) + (Tg : ℕ) + (hQTg : (((Fintype.card (Fin (s + 1)) + 1) * modulus : ℕ) : ℝ) / δg ≤ Tg) + (hstepAll : ∀ tg, 0 < step₀ tg) + (Ag : ℝ≥0) + (hAg : LipschitzWith Ag Real.smoothTransition) + (Pg : ℝ) + (hPg : 1 ≤ Pg) + (hcP : scalarCubePrimitiveEnvelope Empty Ag 16 (128 * probabilityProfileLipschitz) 1 ≤ Pg) + (hsP : scalarCubePrimitiveEnvelope (Fin (s + 1)) Ag 1 0 modulus ≤ Pg) + (hstrideGrid : ∀ tg, ((step₀ tg * modulus : ℕ) : ℝ) ≤ Pg) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg tg pg : ℝ} + (hDg : 0 ≤ Dg) + (hvg : 0 ≤ vg) + (hwg : 0 ≤ wg) + (htg : 0 ≤ tg) + (hpg : 0 ≤ pg) + (hcube : (Fintype.card (Fin (s + 1)) : ℝ) ≤ Dg) + (hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (hrowsD : ∀ j : Fin m, ((boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card : ℝ) ≤ Dg) + (htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (hRv : ∀ j, R j ≤ Real.exp vg) + (hRiGrid : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (hδw : δg⁻¹ ≤ Real.exp wg) + (hTg : (Tg : ℝ) ≤ Real.exp tg) + (hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (hPp₀ : Pg ≤ Real.exp pg) + (haxesGrid : (Fintype.card {a // grid a} : ℝ) ≤ Dg) + (hfullAxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ Dg) + (hfullOutputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ Dg) + (hambientCount : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ Dg) + (hprofileBudget : (probabilityProfileLipschitz : ℝ) ≤ Dg) + {Banalytic : ℝ} + (hBanalytic : 0 ≤ Banalytic) + (hDanalytic : Dg ≤ Banalytic) + (hcutoffAnalytic : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Banalytic) + (hcoordAnalytic : ((K * ∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp Banalytic) + (hgridAnalytic : (Qgrid : ℝ) ≤ Real.exp Banalytic) + {Pnum : ℝ} + (hPnum : 0 ≤ Pnum) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) + (hn : ∀ j, (n j : ℝ) ≤ Pnum) + (hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Real.exp Pnum) + {gain Pproj coarseTarget Ecoarse pGain : ℝ} + : + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (s + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + let ξn := normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection Mk Pphysical coarseTarget + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + (signal : ((Fin nX) → ℤ) → ℂ), + (∀ u ∈ integerBox N, ‖signal u‖ ≤ 1) → + (∀ u, u ∉ integerBox N → signal u = 0) → + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (s + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,uJ,0} m (s + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (hPhysicalNonneg : 0 ≤ Pphysical) → (hMkPhysicalBound : (Mk : ℝ) ≤ Real.exp Pphysical) → + (hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (hCoarseNonneg : 0 ≤ coarseTarget) → + (hDimPhysicalBound : (((s + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (s + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (s + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (s + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ gain → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj Vproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,uG,uI,uB,uJ} m (s + 1)) + let coverLog := (Pproj + ((s + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (s + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vproj j) → + (∀ j, σ j ≤ 1) → + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (s + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,uJ,0,max uG uI uB} m (s + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vproj j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,uG,uI,uB,uJ} m (s + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,0} m)) ≤ (N i : ℝ)) → + cells.Nonempty → ∀ (bases : Finset (Fin nX → ℤ)), bases.Nonempty → + let hξn := (canonicalSlicedSpatialChoices + (N := PrincipalTupleIndex B (layerSamplerDegree I n)) (X := Fin nX) (m := m) + selection hMk hPhysicalNonneg hCoarseNonneg + hmPhysicalBound hDimPhysicalBound hGPhysicalBound hXPhysicalBound hMkPhysicalBound).1 + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + gain ≤ ((wholeLaw).complexMean (fun y => allocatedSlicedTupleValue B U basis hb o hR hσ S + (Fin nX) poly hmem N (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW + hτSpatial hξn stride cells hmass bases x y signal)).re → + let C := Classical.choose (exists_canonicalSlicedNative_input_budget m (s + 1) Amass Aanalytic) + let Bbudget := (Pnative + C) ^ C + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{uG,uI,uB,uJ,0,uJ} m (s + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun u : integerBox N => u.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) (integerBox_nonempty N)).correlation + (fun u => signal u.val) (fun u => star (twistData.eval N poly u.val) * Fnative u)‖ := by + subst modulus + intro ambientQ ambientBudget τ Pphysical W ξn hW cells poly hp hmem signal hsignal hzero + lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual hσ1 hsmall hXmass hframeMass hstrideMass hτMass + AmassWindow hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj Aproj hSizeProj hRankProj + Pside hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hξn hmass hdetected + Cbudget Bbudget Anorm Anative Abudget budget + have hPproj0 : 0 ≤ Pproj := zero_le_one.trans hPproj + have hPmass : 0 ≤ Pmass := by positivity + have hPside0 : 0 ≤ Pside := hPproj0.trans hProjSide + have hexp := Real.exp_le_exp.mpr hProjSide + have hnumSide : AllocatedSourceNumerics B U basis S Cproj Vproj Pside := + ⟨hPside0, hmProj.trans hProjSide, hKproj.trans hProjSide, hLproj.trans hexp, + fun j => (hRproj j).trans hexp, fun j => (hσproj j).trans hexp, + fun j => (hcountProj j).trans hProjSide, fun j => (hIproj j).trans hProjSide, + fun j => (hnProj j).trans hProjSide, fun j => (hJproj j).trans hProjSide, + hProfileProj.trans hexp, fun j => (hCproj j).trans hexp, fun j => (hVproj j).trans hexp, + hWproj.trans hexp⟩ + have hperiod : period ≤ Mk ^ (m + 1) := by + rw [hperiodCanonical] + exact kernelPeriodCandidate_le _ _ + have hearly := (allocatedEarlyRecenteredMesh_partition_budget m (Fin nX) selection + hPphysical hEcoarseNative.1 hGPhysical hXPhysical hMk hMkPhysical hperiod).1 + have hsideCutoff := (Classical.choose_spec (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,0} m)).2 + (X := Fin nX) B selection hPside0 ⟨hPphysical, hpSide⟩ ⟨hcoarseTarget0, htargetSide⟩ ⟨hPmass, hCapSide⟩ + ⟨hPproj0, hProjSide⟩ ⟨hPproj0, hProjSide⟩ (hDimPhysical.trans hpSide) + (hKproj.trans hProjSide) (hXPhysical.trans hpSide) + have hactualSide (i) := (Real.exp_le_exp.mpr hsideCutoff).trans (hside i) + obtain ⟨hW', hC₀, hLC, hWC, hWscale, hξ', hξ1, hδpos, hδ1, hρphysical, hfineMesh, + hmeshCoarse, hmeshFine, hsizePhysical, hmeshThreshold, hρ8, hρshift, hρmove, hboundary, hsite, + hN', hwidths, hselectedMass⟩ := + hnumSide.canonical_spatial_choices B U basis S Cproj Vproj hR hσ selection + hPphysical hcoarseTarget0 hPmass hPproj0 hPproj0 hMk hmGeometry hDimPhysical hGPhysical hXPhysical + hMkPhysical hvars hearly stride N hstridepos hStrideProj hτ hτProj hactualSide + have hmass' := hselectedMass cells hCells + have hPeriodPhysical : (period : ℝ) ≤ Real.exp (Pphysical ^ 2) := + coefficientErrorPeriod_exp_sq hPphysical hmGeometry hMkPhysical hperiod + have hnative := exists_allocatedCanonicalSlice_projected_native_source + (B := B) (U := U) (basis := basis) (S := S) (hb := hb) (o := o) (bW := bW) + (hR := hR) (hσ := hσ) (Q := Q) (ν := ν) (μ := μ) (μrows := μrows) + (x := x) (hMk := hMk) (selection := selection) (hgood := hgood) + (period := period) (stride := stride) (N := N) (hperiodCanonical := hperiodCanonical) + (modulus := residueRefinedPeriod period stride) (hmodulusRefined := rfl) + (hP := hP) (hMkP := hMkP) (hRP := hRP) (hRi := hRi) (hσi := hσi) (hcount := hcount) + (H₀ := H₀) (step₀ := step₀) (c₀ := c₀) (hH₀ := hH₀) (hsubset₀ := hsubset₀) + (r₀ := r₀) (hcell := hcell) + (hdimensions := hdimensions) + (hPk := hPk) + (hMkPk := hMkPk) + (hPrho := hPrho) + (htarget := htarget) + (hF := hF) + (hQstride := hQstride) + (hstride := hstride) + (hstrideBound := hstrideBound) + (hlength := hlength) + (ρ := ρ) + (t := t) + (htone := htone) + (hs := hs) + (hρ := hρ) + (hρ1 := hρ1) + (hσsmall := hσsmall) + (hstep := hstep) + (hδ := hδ) + (hδF := hδF) + (hdense := hdense) + (hq := hq) + (y₀ := y₀) + (hy₀ := hy₀) + (T := T) + (hT := hT) + (hsource := hsource) + (C := C) + (hC := hC) + (hchart := hchart) + (hbudget := hbudget) + (hρlog := hρlog) + (hη0 := hη0) + (hηsmall := hηsmall) + (siteRadius := siteRadius) + (hrone := hrone) + (hsitebudget := hsitebudget) + (Cforward := Cforward) + (hforward := hforward) + (K := K) + (hK := hK) + (hradius := hradius) + (hPbox := hPbox) + (hVlog := hVlog) + (hNlog := hNlog) + (hMlog := hMlog) + (hbox := hbox) + (hvolume := hvolume) + (hnormalizer := hnormalizer) + (hmask := hmask) + (hbaseAmbient := hbaseAmbient) + (hvbase := hvbase) + (hnbase := hnbase) + (hmbase := hmbase) + (hsites := hsites) + (haxes := haxes) + (hlabels := hlabels) + (hKbase := hKbase) + (hcoords := hcoords) + (hcutoff := hcutoff) + (hpbase := hpbase) + (hrowsAmbient := hrowsAmbient) + (houtputs := houtputs) + (hheight := hheight) + (Qgrid := Qgrid) + (hQgrid := hQgrid) + (hδg := hδg) + (hdenseg := hdenseg) + (Tg := Tg) + (hQTg := hQTg) + (hstepAll := hstepAll) + (Ag := Ag) + (hAg := hAg) + (Pg := Pg) + (hPg := hPg) + (hcP := hcP) + (hsP := hsP) + (hstrideGrid := hstrideGrid) + (hBa := hBa) + (hBi := hBi) + (hDg := hDg) + (hvg := hvg) + (hwg := hwg) + (htg := htg) + (hpg := hpg) + (hcube := hcube) + (hdegree := hdegree) + (hrowsD := hrowsD) + (htail := htail) + (hblocks := hblocks) + (hRv := hRv) + (hRiGrid := hRiGrid) + (hδw := hδw) + (hTg := hTg) + (hcoeff := hcoeff) + (hPp₀ := hPp₀) + (haxesGrid := haxesGrid) + (hfullAxes := hfullAxes) + (hfullOutputs := hfullOutputs) + (hambientCount := hambientCount) + (hprofileBudget := hprofileBudget) + (hBanalytic := hBanalytic) + (hDanalytic := hDanalytic) + (hcutoffAnalytic := hcutoffAnalytic) + (hcoordAnalytic := hcoordAnalytic) + (hgridAnalytic := hgridAnalytic) + (hPnum := hPnum) + (hI := hI) + (hn := hn) + (hcoeffEarly := hcoeffEarly) + (hRiEarly := hRiEarly) + (hVEarly := hVEarly) + (gain := gain) (Pproj := Pproj) (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + (W := W) (τ := τ) (ξn := ξn) + have hnative := hnative hW cells poly hp hmem signal hsignal hzero + (lossTarget := lossTarget) (Pphysical := Pphysical) + (Dphysical := (Fintype.card (LayerSamplerVariables G I n B) : ℝ)) + (Psample := Psample) (Rrank := Rrank) (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ le_rfl hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + have hnative := hnative hwidths hmass' + hξ1 hsizePhysical hρ8 hρshift + hPphysical hMkPhysical hPeriodPhysical hDimPhysical hGPhysical hXPhysical hvars hWscale + hprecision hηprecision hεprecision + hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hξ' hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + have hnative := hnative Cproj Vproj hcoverAmbient hcoverSample hmassSample + hCactual hVactual hσ1 hsmall hXmass hframeMass hstrideMass hτMass + hsizeMass hRrankMass hambMass hjetMass + hρphysical hC₀ hLC hWC hmeshThreshold hδpos.le hρmove hfineMesh + hboundary (hsite period hperiod) hvars hWscale hmeshCoarse + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj hSizeProj hRankProj hCells bases hbases hdetected + exact hnative + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +variable {m : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (0 + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (0 + 1)))) +variable (selection : Fin (0 + 1) ↪ G) (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (Pdetect : Polynomial ℕ) (pDetect qDetect α : ℝ) +variable {P : ℝ} (hP : 0 ≤ P) (hMkP : ((allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp P) +variable (hRP : ∀ j, R j ≤ Real.exp P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) +variable (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) +variable (hcount : ∀ j : Fin m, (Fintype.card + (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) + 1 ≤ Real.exp P) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (0 + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (0 + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (0 + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (0 + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (0 + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (0 + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + +include hb o bW μ ν μrows hR hσ hP hMkP hRP hRi hσi hcount in + +theorem exists_allocatedDetected_spatial_native_source_zero + {D target Pk Prho Qstride : ℝ} + (hdimensions : AllocatedComparisonDimensions (G := G) B (Fin (0 + 1)) selectedRows D) + (hPk : 0 ≤ Pk) + (hMkPk : ((allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pk) + (hPrho : 0 ≤ Prho) + (htarget : 0 ≤ target) + (hQstride : 0 ≤ Qstride) + (hstride : ∀ i, 0 < stride i) + (hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (hlength : Real.exp (allocatedAffineLengthLog m D P Prho Pk target (pDetect + 1) (((m + 1 : ℕ) : ℝ) * Pk + Fintype.card (Fin nX) * Qstride)) ≤ S.value) + {η : ℝ} + (ρ : (LayerSamplerAxis I n → Prop) → ℝ≥0) + (t : ℝ) + (htone : t ≤ 1) + (hs : AllocatedAffineCoveredComparison.{0, 0, _, _, _, _, _} (G := G) B rows (Real.exp (-(pDetect + 1))) η ρ t htone) + (hρ : 0 < ρ grid) + (hρ1 : ρ grid ≤ 1) + (hσsmall : ∀ j, σ j ≤ t) + (T : Fin m → ℝ) + (hT : ∀ j, partitionedIdealRadius (Fin (0 + 1)) m + 1 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (0 + 1)) * ((Fintype.card (Fin (0 + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (C : Fin m → ℝ) + (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) + (hρlog : (ρ grid : ℝ)⁻¹ ≤ Real.exp Prho) + (hη0 : 0 ≤ η) + (hηsmall : η ≤ Real.exp (-(target + 1 + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 4))) + (siteRadius : ℝ≥0) + (hrone : 1 ≤ siteRadius) + (hsitebudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (0 + 1))) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4) + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) + (hK : ∀ j, (R j)⁻¹ ≤ K) + (hradius : ∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) + {Pbox Vlog Nlog Mlog baseAmbient : ℝ} + (hPbox : 0 ≤ Pbox) + (hVlog : 0 ≤ Vlog) + (hNlog : 0 ≤ Nlog) + (hMlog : 0 ≤ Mlog) + (hbox : 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp Pbox) + (hvolume : allocatedFullGridNaturalVolume B U basis S rowSets ≤ Real.exp Vlog) + (hnormalizer : ‖((allocatedProductIdealNormalizer B U basis S rowSets : ℝ) : ℂ)⁻¹‖ ≤ Real.exp Nlog) + (hmaskLog : (Fintype.card (LayerSamplerAxis I n) : ℝ) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * (((m + 1 : ℕ) : ℝ) * Pk)) ≤ Mlog) + (hbaseAmbient : 0 ≤ baseAmbient) + (hvbase : Vlog ≤ baseAmbient) + (hnbase : Nlog ≤ baseAmbient) + (hmbase : Mlog ≤ baseAmbient) + (hsites : (Fintype.card (Finset (Fin (0 + 1))) : ℝ) ≤ baseAmbient) + (haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ baseAmbient) + (hlabelLog : (∑ j, (n j : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk)) + + ∑ j, (Fintype.card (Q j) : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk) ≤ baseAmbient) + (hKbase : (K : ℝ) ≤ Real.exp baseAmbient) + (hcoords : ((∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp baseAmbient) + (hperiodLog : ((m + 1 : ℕ) : ℝ) * Pk ≤ baseAmbient) + (hrowsAmbient : ((∑ j : Fin m, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (houtputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ baseAmbient) + (hheight : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ Real.exp baseAmbient) + (Qgrid : ℝ≥0) + (hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U basis S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U basis S a).1 (allocatedGridIntegerAxis B U basis S a).2) : ℝ) + 1) ≤ Qgrid) + (Ag : ℝ≥0) (hAg : LipschitzWith Ag Real.smoothTransition) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg : ℝ} + (hDg : 0 ≤ Dg) + (hvg : 0 ≤ vg) + (hwg : 0 ≤ wg) + (hcube : (Fintype.card (Fin (0 + 1)) : ℝ) ≤ Dg) + (hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (hrowsD : ∀ j : Fin m, ((boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card : ℝ) ≤ Dg) + (htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (hRv : ∀ j, R j ≤ Real.exp vg) + (hRiGrid : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (hδw : pDetect + 1 ≤ wg) + (hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (haxesGrid : (Fintype.card {a // grid a} : ℝ) ≤ Dg) + (hfullAxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ Dg) + (hfullOutputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ Dg) + (hambientCount : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ Dg) + (hprofileBudget : (probabilityProfileLipschitz : ℝ) ≤ Dg) + {Banalytic : ℝ} + (hBanalytic : 0 ≤ Banalytic) + (hDanalytic : Dg ≤ Banalytic) + (hcutoffAnalytic : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Banalytic) + (hcoordAnalytic : ((K * ∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp Banalytic) + (hgridAnalytic : (Qgrid : ℝ) ≤ Real.exp Banalytic) + {Pnum : ℝ} + (hPnum : 0 ≤ Pnum) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) + (hn : ∀ j, (n j : ℝ) ≤ Pnum) + (hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Real.exp Pnum) + {Pproj coarseTarget Ecoarse pGain : ℝ} + : + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (0 + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + let ξn := normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + (signal : ((Fin nX) → ℤ) → ℂ), + (∀ u ∈ integerBox N, ‖signal u‖ ≤ 1) → + (∀ u, u ∉ integerBox N → signal u = 0) → + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (0 + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,0,0} m (0 + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (0 + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (0 + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (hPhysicalNonneg : 0 ≤ Pphysical) → (hMkPhysicalBound : ((allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pphysical) → + (hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (hCoarseNonneg : 0 ≤ coarseTarget) → + (hDimPhysicalBound : (((0 + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (0 + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (0 + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (0 + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let Cgrid := Classical.choose (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (0 + 1) Ag) + let Qlog := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let tg := ((0 + 1 : ℕ) : ℝ) + Qlog + (pDetect + 1) + 1 + let pg := (Cgrid : ℝ) + (((0 + 1) + 1 : ℕ) : ℝ) * Qlog + (pDetect + 1) + 4 + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ (allocatedDetectedZeroGain (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2 → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj Vproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (0 + 1)) + let coverLog := (Pproj + ((0 + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (0 + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vproj j) → + (∀ j, σ j ≤ 1) → + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (0 + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,0,0,max 0 0 0} m (0 + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (0 + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (0 + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vproj j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (0 + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ≤ (N i : ℝ)) → + cells.Nonempty → ∀ (bases : Finset (Fin nX → ℤ)), (hbases : bases.Nonempty) → + let hξn := normalizedTupleNarrowWidth_pos (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + (htotal : 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem)) → + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW hτSpatial hξn stride cells hmass bases hbases htotal + ∀ {Tdetect : Type} [Fintype Tdetect] [Nonempty Tdetect] + (e : Tdetect → LayerSamplerVariables G I n B → ℤ), Function.Injective e → + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) 0 (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Tdetect) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + 0 ≤ pDetect → 0 ≤ qDetect → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pDetect ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + 0 < α → α ≤ 1 → + Fintype.card (LayerSamplerVariables G I n B) * Real.exp (-pDetect) ≤ α / 8 → + Real.exp (-qDetect) ≤ α / 4 → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + (0 + 1) * (0 + 3) ≤ Fintype.card G → (allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) ≤ S.value → + let C := Classical.choose (exists_canonicalSlicedNative_input_budget m (0 + 1) Amass Aanalytic) + let Bbudget := (Pnative + C) ^ C + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{0,0,0,0,0,0} m (0 + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} 0) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) 0 budget + (fun u : integerBox N => u.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) (integerBox_nonempty N)).correlation + (fun u => signal u.val) (fun u => star (twistData.eval N poly u.val) * Fnative u)‖ := by + intro ambientQ ambientBudget τ Pphysical W ξn hW cells poly hp hmem signal hsignal hzero + lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel Cgrid Qlog tg pg p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual hσ1 hsmall hXmass hframeMass hstrideMass hτMass + AmassWindow hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj Aproj hSizeProj hRankProj + Pside hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hξn hmass htotal Path pathLaw + Tdetect _ _ e he Tests _ Ldetect _ _ dims _ _ _ _ Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hpDetect hqDetect hdenseDetect hdimensionDetect hcomplexity hcap + hα hαone hmeshDetect hthreshold hdetected hGdetect hkernel + Cbudget Bbudget Anorm Anative Abudget budget + have hsignalAll (u) : ‖signal u‖ ≤ 1 := by + by_cases hu : u ∈ integerBox N + · exact hsignal u hu + · simp only [hzero u hu, norm_zero, zero_le_one] + have hF : 0 ≤ pDetect + 1 := by positivity + obtain ⟨hδ, _hδ1, hδF, htg, hpg, Tg, hTg, hgrid⟩ := + (Classical.choose_spec (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (0 + 1) Ag)).2 + (nX := nX) hPk hQstride hpDetect + have hδw' : (Real.exp (-(pDetect + 1)))⁻¹ ≤ Real.exp wg := + hδF.trans (Real.exp_le_exp.mpr hδw) + have hfound := allocatedOriginalPathLaw_canonical_period_source (s := 0) + B U basis hb o hR hσ S (Fin nX) poly hmem N hN hW hτ hξn + stride cells hmass bases hbases htotal Pdetect e he Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices pDetect qDetect hpDetect hqDetect hdenseDetect hdimensionDetect hcomplexity hcap + signal hsignalAll α hα hαone hmeshDetect hthreshold hdetected selection hGdetect hkernel hstridepos + obtain ⟨c₀, step₀, H₀, hstep₀, hH₀, hsubsetAll, hdenseAll, hstepBound, + x, hgood, hMk, hperiodPos, hperiodBound, r₀, hcell, hsubset, hdetectedTuple, + y₀, hy₀, _hyCube, _hyAxis, _hselected⟩ := hfound + let period := kernelPeriodCandidate (m + 1) (goodKernelUniformCandidate selection x hgood m) + have : NeZero period := ⟨hperiodPos.ne'⟩ + let modulus := residueRefinedPeriod period stride + let Hnative := fun j : PrincipalTupleIndex B (layerSamplerDegree I n) => H₀ (Sum.inr j) + let stepnative := fun _ : PrincipalTupleIndex B (layerSamplerDegree I n) => step₀ + let cnative := fun j : PrincipalTupleIndex B (layerSamplerDegree I n) => c₀ (Sum.inr j) + have hHnative (j) : 0 < Hnative j := hH₀ (Sum.inr j) + have hdenseNative (j : Tuple) : + Real.exp (-(pDetect + 1)) * L j ≤ + ((integerProgressionSupport + (c₀ (Sum.inr (Sigma.mk j.1.val j.2))) (step₀ : ℤ) + (H₀ (Sum.inr (Sigma.mk j.1.val j.2)))).card : ℝ) := by + rw [card_integerProgressionSupport _ _ _ hstep₀] + exact hdenseAll (Sum.inr (Sigma.mk j.1.val j.2)) + have hperiodBounds := canonicalPeriod_primitive_bounds + (LayerSamplerAxis I n) n selectedRows Q hMkPk hperiodBound + have hmask := hperiodBounds.2.1.trans (Real.exp_le_exp.mpr hmaskLog) + have hlabels := hperiodBounds.2.2.trans (Real.exp_le_exp.mpr hlabelLog) + have hpbase := hperiodBounds.1.trans (Real.exp_le_exp.mpr hperiodLog) + obtain ⟨hQTg, hPg, hcP, hsP, hstrideGrid⟩ := + hgrid stride hMkPk hperiodPos hperiodBound hstridepos hstrideBound + have hstrideGrid' (j : PrincipalTupleIndex B (layerSamplerDegree I n)) : + ((stepnative j * modulus : ℕ) : ℝ) ≤ Real.exp pg := by + exact hstrideGrid (Y := PrincipalTupleIndex B (layerSamplerDegree I n)) + stepnative (fun _ => hstepBound) j + have hnative := exists_allocatedCanonicalSlice_spatial_native_source + (s := 0) (nX := nX) (τ := τ) (Pphysical := Pphysical) (gain := (allocatedDetectedZeroGain (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2) (Pproj := Pproj) + (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + B U basis hR hσ S x hMk selection hgood period stride N rfl modulus rfl + hP hMkP hRP hRi hσi hcount Q hb o bW Hnative stepnative cnative hHnative hsubset r₀ hcell ν μ μrows + hdimensions hPk hMkPk hPrho htarget hF hQstride hstride hstrideBound hlength + ρ t htone hs hρ hρ1 hσsmall (fun _ => hstep₀) hδ hδF hdenseNative + (by simp only [Fintype.card_fin]; omega) y₀ hy₀ + T hT hsource C hC hchart hbudget hρlog hη0 hηsmall + siteRadius hrone hsitebudget Cforward hforward K hK hradius + hPbox hVlog hNlog hMlog hbox hvolume hnormalizer hmask hbaseAmbient hvbase hnbase hmbase + hsites haxes hlabels hKbase hcoords hcutoff hpbase hrowsAmbient houtputs hheight + Qgrid hQgrid hδ (fun j => hdenseAll (Sum.inr j)) Tg + (by simpa only [Fintype.card_fin] using hQTg) (fun _ => hstep₀) + Ag hAg (Real.exp pg) hPg hcP hsP hstrideGrid' + hBa hBi hDg hvg hwg htg hpg hcube hdegree hrowsD htail hblocks hRv hRiGrid hδw' hTg hcoeff + le_rfl haxesGrid hfullAxes hfullOutputs hambientCount hprofileBudget + hBanalytic hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic + hPnum hI hn hcoeffEarly hRiEarly hVEarly + have hnative := hnative (Pnative := Pnative) cells poly hp hmem signal hsignal hzero + (lossTarget := lossTarget) (Psample := Psample) (Rrank := Rrank) + (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision + have hnative := hnative (Pside := Pside) hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj hcoverAmbient hcoverSample hmassSample hCactual hVactual hσ1 hsmall + hXmass hframeMass hstrideMass hτMass hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj + hProfileProj hCproj hVproj hXproj hFrameProj hStrideProj hτProj hξProj hSizeProj hRankProj + exact hnative hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hmass hdetectedTuple + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedEnormousProfileSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedEnormousProfileSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..abf0cdea71aa3125a5f0b16810b1393e6f2277f4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedEnormousProfileSupport.lean @@ -0,0 +1,62 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedEnormousProfiles + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 (j : Fin m) (i : Fin (n j)) (hσ1 : σ j ≤ 1) +variable (henormous : S.value ^ (layerTailDegree m + 1) < basisAxisScale (basis j) i) + +theorem allocatedEnormousProfile_support + (z : BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1) → ℤ) + (hz : z ∈ (allocatedEnormousProfilePMF B U basis hR hσ S j i hσ1 henormous).support) : + affineProductProfile (allocatedIntegerProfileCenters B R j i) + (allocatedIntegerProfileWidths B R σ j i) + (fun e => (z e : ℝ) / allocatedIntegerProfileScales B U basis S j i e) ≠ 0 := by + have hpos := ENNReal.toReal_pos ((PMF.mem_support_iff _ _).mp hz) + (PMF.apply_ne_top _ _) + rw [allocatedEnormousProfilePMF, coefficientPMF_apply] at hpos + change 0 < affineProductProfile (allocatedIntegerProfileCenters B R j i) + (allocatedIntegerProfileWidths B R σ j i) + (fun e => (z e : ℝ) / allocatedIntegerProfileScales B U basis S j i e) / _ at hpos + intro hzero + rw [hzero, zero_div] at hpos + exact (lt_irrefl 0) hpos + +include hσ1 henormous in +theorem allocatedEnormousProfile_support_of_coordinate_support + (z : BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1) → ℤ) + (hz : ∀ e, z e ∈ (allocatedLayerIntegerPMFs B U basis hR hσ S j i e).support) : + affineProductProfile (allocatedIntegerProfileCenters B R j i) + (allocatedIntegerProfileWidths B R σ j i) + (fun e => (z e : ℝ) / allocatedIntegerProfileScales B U basis S j i e) ≠ 0 := by + classical + let p := independentProductPMF (allocatedLayerIntegerPMFs B U basis hR hσ S j i) + have hp : p = allocatedEnormousProfilePMF B U basis hR hσ S j i hσ1 henormous := by + apply PMF.toMeasure_injective + change (Measure.pi (fun e => + (allocatedLayerIntegerPMFs B U basis hR hσ S j i e).toMeasure)).toPMF.toMeasure = _ + rw [Measure.toPMF_toMeasure] + exact allocatedEnormous_coefficient_law B U basis hR hσ S j i hσ1 henormous + apply allocatedEnormousProfile_support B U basis hR hσ S j i hσ1 henormous z + rw [← hp, PMF.mem_support_iff] + change independentProductPMF _ z ≠ 0 + rw [independentProductPMF_apply] + exact Finset.prod_ne_zero_iff.mpr (fun e _ => (PMF.mem_support_iff _ _).mp (hz e)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateAxisChartOrbit.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateAxisChartOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc354a54fe0a198d81796131088d5761ea5e7b4c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateAxisChartOrbit.lean @@ -0,0 +1,100 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalCandidateAxisFreezingConclusion + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped Classical TensorProduct + +attribute [local irreducible] polynomialOrbitRealChart realChartSubstitute + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalLocalChart + +variable {cost : ℝ} (C : AllocatedExternalLocalChart (E := E) A cost) + (keep : LayerSamplerVariables G I n B → Prop) + (hkeep : ∀ i, keep i → C.keep i) + (fixed : {i : C.Variables // ¬keep i.val} → ℤ) + (hfixed : ∀ i, fixed i ∈ integerProgressionSupport + (C.slice.start i.val : ℤ) C.step (C.slice.length i.val)) + +include hkeep in + +theorem axisPolynomial_freeze (p : MvPolynomial (LayerSamplerVariables G I n B) ℝ) : + freezePolynomial keep (fun i => (C.axisFixed keep fixed i : ℝ)) p = + MvPolynomial.aeval (C.axisPolynomial keep fixed) + (freezePolynomial C.keep (fun i => (C.fixed i : ℝ)) p) := by + unfold freezePolynomial + rw [MvPolynomial.comp_aeval_apply] + apply congrArg (fun f => MvPolynomial.aeval f p) + funext i + by_cases hk : keep i + · have hc := hkeep i hk + simp [frozenCoordinate, axisPolynomial, hk, hc] + · by_cases hc : C.keep i + · simp [frozenCoordinate, axisPolynomial, axisFixed, hk, hc] + · simp [frozenCoordinate, axisFixed, hk, hc] + +theorem restrictAxes_integerSampledRealChart : + integerSampledRealChart (C.restrictAxes keep hkeep fixed hfixed).integerChart = + fun i => MvPolynomial.aeval (C.axisPolynomial keep fixed) + (integerSampledRealChart C.integerChart i) := by + funext i + change integerSampledRealChart + (fun z => freezePolynomial keep (C.axisFixed keep fixed) + (allocatedRecoveredIntegerFullChart B U b o poly hm C.centerLift + C.path.1.val C.path.2.val C.sample z)) i = + MvPolynomial.aeval (C.axisPolynomial keep fixed) + (integerSampledRealChart + (fun z => freezePolynomial C.keep C.fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm C.centerLift + C.path.1.val C.path.2.val C.sample z)) i) + rw [integerSampledRealChart_freeze, integerSampledRealChart_freeze] + exact C.axisPolynomial_freeze keep hkeep fixed _ + +theorem restrictAxes_polynomialOrbitRealChart + {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + (g : F.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)) : + F.polynomialOrbitRealChart (fullTaggedVariableWeight J) (fun _ => 1) + (integerSampledRealChart (C.restrictAxes keep hkeep fixed hfixed).integerChart) + (C.restrictAxes keep hkeep fixed hfixed).integerChart_support g = + F.polynomialOrbitRealChart (fun _ : C.Variables => 1) (fun _ => 1) + (C.axisPolynomial keep fixed) (C.axisPolynomial_support keep fixed) + (F.polynomialOrbitRealChart (fullTaggedVariableWeight J) (fun _ => 1) + (integerSampledRealChart C.integerChart) C.integerChart_support g) := by + apply Subtype.ext + apply NilpotentLieBCHGroup.ext + change (F.polynomialOrbitRealChart _ _ _ _ g).log = + (F.polynomialOrbitRealChart _ _ _ _ (F.polynomialOrbitRealChart _ _ _ _ g)).log + simp only [polynomialOrbitRealChart_log] + rw [C.restrictAxes_integerSampledRealChart keep hkeep fixed hfixed] + exact (realChartSubstitute_comp (integerSampledRealChart C.integerChart) + (C.axisPolynomial keep fixed) g.log).symm + +end AllocatedExternalLocalChart + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateBufferedCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateBufferedCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..db2cfaf1d2375a5f6206e1e6b950831262ad650f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateBufferedCoordinates.lean @@ -0,0 +1,138 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedExternalCandidateRetainedSliceLaw + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +variable {m d : ℕ} {X : Type*} {J : Fin m → Type*} + +noncomputable def fullTaggedBufferedCoordinates (e : Fin d ≃ Σ j, J j) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : ∀ j, J j → ℝ) (x : X → ℤ) : Fin d → ℝ := + fun i => eval (fun a => (x a : ℝ)) (poly (e i).1) (e i).2 - c (e i).1 (e i).2 + +theorem fullTaggedPhysicalIntegerPoint_eq_nearest + (e : Fin d ≃ Σ j, J j) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : ∀ j, J j → ℝ) (x : X → ℤ) : + fullTaggedPhysicalIntegerPoint J poly c x = + Sum.elim x (fun a => nearestIntegerLift (fullTaggedBufferedCoordinates e poly c x) + (e.symm a)) := by + funext v + rcases v with a | a + · rfl + · simp only [fullTaggedPhysicalIntegerPoint, Sum.elim_inr, nearestIntegerLift, + fullTaggedBufferedCoordinates] + rw [e.apply_symm_apply] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +namespace AllocatedExternalLocalChart + +variable {A} {cost : ℝ} (C : AllocatedExternalLocalChart (E := E) A cost) + +variable (hσ1 : ∀ j, σ j ≤ 1) (H : Fin m → ℝ) (hH : ∀ j, 0 ≤ H j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ H j * ‖v‖) + (hsmall : ∀ j, H j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ 1 / 8) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + +include hσ1 H hH hchart hsmall hp + +theorem fullTaggedBufferedCoordinates_close_on_slice + {tagCount : ℕ} (e : Fin tagCount ≃ Σ j, J j) + (u : C.Variables → ℤ) (hu : u ∈ C.slice.integerPoints) (i : Fin tagCount) : + |fullTaggedBufferedCoordinates e poly (fun j => (C.centerLift j).val) (C.physical u) i - + (nearestIntegerLift + (fullTaggedBufferedCoordinates e poly (fun j => (C.centerLift j).val) + (C.physical u)) i : ℝ)| ≤ 1 / 8 := by + have hj : (e i).1.val + 1 ≤ m + 1 := by omega + have hr := C.low_residual_on_slice hσ1 H hH hchart hsmall hp (m + 1) u hu + (lowTaggedSlot J (m + 1) (e i).1 hj (e i).2) + rw [lowTaggedPolynomial_eval] at hr + simp only [integerSampledLowTags] at hr + rw [lowTaggedIndex_slot] at hr + change |eval (fun x => (C.physical u x : ℝ)) (poly (e i).1) (e i).2 - + (C.centerLift (e i).1).val (e i).2 - + (C.chartValues u (Sum.inr (e i)) : ℝ)| ≤ 1 / 8 at hr + rw [C.chartValues_tag_eq_round hσ1 H hH hchart hsmall hp u + (C.slice.integerPoints_subset_integerBox hu) (e i).1 (e i).2] at hr + exact hr + +end AllocatedExternalLocalChart + +namespace AllocatedExternalCandidateProblem + +variable {A} {L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {r d t : ℕ} + {D : RationalFilteredNilmanifold L r d} {Fmark : NilpotentLieFiltration M t} + {φ : L →ₗ⁅ℚ⁆ M} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {observable : (X → ℤ) → D.Space → ℂ} {weight : (X → ℤ) → ℂ} + {cost massThreshold scoreThreshold : ℝ} + {P : AllocatedExternalCandidateProblem (E := E) A D Fmark φ marked observable weight + cost massThreshold scoreThreshold} + {outputCost outputMass outputScore : ℝ} + +namespace Conclusion + +variable (out : P.Conclusion outputCost outputMass outputScore) + +variable (hσ1 : ∀ j, σ j ≤ 1) (H : Fin m → ℝ) (hH : ∀ j, 0 ≤ H j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ H j * ‖v‖) + (hsmall : ∀ j, H j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ 1 / 8) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + +include hσ1 H hH hchart hsmall hp + +theorem siteLaw_fullTaggedBufferedCoordinates_close + {tagCount : ℕ} (e : Fin tagCount ≃ Σ j, J j) + (z : out.retained) (site : A.Site) (hsite : (out.siteLaw z).weight site ≠ 0) + (i : Fin tagCount) : + |fullTaggedBufferedCoordinates e poly (fun j => (P.centerLift j).val) + (A.physical z.val site) i - + (nearestIntegerLift + (fullTaggedBufferedCoordinates e poly (fun j => (P.centerLift j).val) + (A.physical z.val site)) i : ℝ)| ≤ 1 / 8 := by + have hpos : 0 < (out.siteLaw z).weight site := + lt_of_le_of_ne ((out.siteLaw z).nonneg site) (Ne.symm hsite) + obtain ⟨u, _, hu, _, hphysical⟩ := out.siteLaw_support z site hpos + rw [hphysical] + have h := (P.chart ⟨z.val, out.subset z.property⟩).fullTaggedBufferedCoordinates_close_on_slice + hσ1 H hH hchart hsmall hp e u hu i + rw [P.chart_centerLift] at h + exact h + +end Conclusion +end AllocatedExternalCandidateProblem +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateNativeMiddleCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateNativeMiddleCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4ffe807f2fb2d1b57e84f1d71d672d25be25271 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateNativeMiddleCoordinates.lean @@ -0,0 +1,96 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedExternalCandidateNativeFrozenScore + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct NNReal + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +namespace AllocatedExternalCandidateProblem + +variable {L M ι κ : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s d f nD nF nQ nQF : ℕ} + {D : RationalFilteredNilmanifold L (s + 1) d} + (Fmark : RationalFilteredNilmanifold M (s + 1) f) + (φ : L →ₗ⁅ℚ⁆ M) + (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ Fmark.filtration.layer j) + {marked : Fmark.filtration.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {observable : (X → ℤ) → D.Space → ℂ} {weight : (X → ℤ) → ℂ} + {cost massThreshold scoreThreshold : ℝ} + (P : AllocatedExternalCandidateProblem (E := E) A D Fmark.filtration φ marked + observable weight cost massThreshold scoreThreshold) + (W : LieSubalgebra ℚ D.filtration.AssociatedGraded) + (Dref : RationalFilteredNilmanifold + (D.filtration.gradedRefiltrationSubalgebra W) (s + 1) nD) + (hDref : Dref.filtration = D.filtration.gradedRefiltration W) + (Fref : RationalFilteredNilmanifold + (Fmark.filtration.gradedRefiltrationSubalgebra + (W.map (D.filtration.associatedGradedMap Fmark.filtration φ hφ))) (s + 1) nF) + (hFref : Fref.filtration = Fmark.filtration.gradedRefiltration + (W.map (D.filtration.associatedGradedMap Fmark.filtration φ hφ))) + + (markedMiddle : Fref.filtration.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)) + (middle : ∀ z : P.productive, + AllocatedExternalLocalCandidate (P.chart z) Dref Fref.filtration (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) markedMiddle) + +theorem refilteredLocalCoordinates_eq_of_log + (nativeMiddle : ∀ z : P.productive, + (D.filtration.realification.adaptedPolynomialFiltration + (fun _ : (P.chart z).Variables => 1)).Group) + (hlog : ∀ z, map + (realLieHomToRat (realificationLieHom + (D.filtration.gradedRefiltrationSubalgebra W).incl)).toLinearMap + (middle z).orbit.log = ((nativeMiddle z).coord : + VectorPolynomial (P.chart z).Variables ℚ (ℝ ⊗[ℚ] L))) + (z : P.productive) : + P.refilteredLocalCoordinates A Fmark φ hφ W Dref hDref Fref markedMiddle middle z = + nativeMiddle z := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + exact hlog z + +theorem refilteredLocalCoordinates_factor_of_log + (left nativeMiddle right : ∀ z : P.productive, + (D.filtration.realification.adaptedPolynomialFiltration + (fun _ : (P.chart z).Variables => 1)).Group) + (hlog : ∀ z, map + (realLieHomToRat (realificationLieHom + (D.filtration.gradedRefiltrationSubalgebra W).incl)).toLinearMap + (middle z).orbit.log = ((nativeMiddle z).coord : + VectorPolynomial (P.chart z).Variables ℚ (ℝ ⊗[ℚ] L))) + (hfactor : ∀ z, left z * nativeMiddle z * right z = + D.filtration.realification.polynomialOrbitCoordinates _ (P.candidate z).orbit) + (z : P.productive) : + left z * P.refilteredLocalCoordinates A Fmark φ hφ W Dref hDref Fref + markedMiddle middle z * right z = + D.filtration.realification.polynomialOrbitCoordinates _ (P.candidate z).orbit := by + rw [P.refilteredLocalCoordinates_eq_of_log A Fmark φ hφ W Dref hDref Fref + markedMiddle middle nativeMiddle hlog z] + exact hfactor z + +end AllocatedExternalCandidateProblem +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateRefilteredSupportedStep.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateRefilteredSupportedStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b044b63401d4353bf4767b6b4378ef7a5216c26 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateRefilteredSupportedStep.lean @@ -0,0 +1,338 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedExternalCandidateNativeFrozenScore + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open VectorPolynomial NilpotentLieFiltration NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +variable {L M σ : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s d e n m : ℕ} + (D : RationalFilteredNilmanifold L (s + 1) d) + (E : RationalFilteredNilmanifold M (s + 1) e) + (φ : L →ₗ⁅ℚ⁆ M) + (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ E.filtration.layer j) + (Q : RationalFilteredNilmanifold (L ⧸ D.filtration.layerIdeal (s + 1)) s n) + (hQ : Q.filtration = D.filtration.quotientTop) + (QF : RationalFilteredNilmanifold (M ⧸ E.filtration.layerIdeal (s + 1)) s m) + (hQF : QF.filtration = E.filtration.quotientTop) {w : σ → ℕ} + +theorem exists_marked_topQuotientOrbit_lift_externalFamily_on + [PseudoMetricSpace Q.Space] [PseudoMetricSpace E.Space] + {A : Type*} (K : ℝ≥0) (observable : A → D.RealGroup → ℂ) (allowed : A → Prop) + (hrecovery : ∀ a, allowed a → ∀ source, + positiveImageSlice (D.markedTopQuotientDiagram E φ Q) K + (observable a) (D.markedTopQuotientDiagram E φ Q source).2 + (D.markedTopQuotientDiagram E φ Q source).1 = observable a source) + (hsurj : ∀ j, ∀ y ∈ E.filtration.layer j, ∃ x ∈ D.filtration.layer j, φ x = y) + (q : Q.filtration.realification.PolynomialOrbit w) + (marked : E.filtration.realification.PolynomialOrbit w) + (heq : D.topQuotientMarkedOrbit E φ hφ Q hQ QF hQF q = E.topQuotientOrbit QF hQF marked) : + ∃ g : D.filtration.realification.PolynomialOrbit w, + D.topQuotientOrbit Q hQ g = q ∧ + map (realLieHomToRat (realificationLieHom φ)).toLinearMap g.log = marked.log ∧ + ∀ a, allowed a → ∀ z : σ → ℝ, + positiveImageSlice (D.markedTopQuotientDiagram E φ Q) K (observable a) + (QuotientGroup.mk (E.filtration.realification.polynomialOrbitRealEval w z marked)) + (QuotientGroup.mk (Q.filtration.realification.polynomialOrbitRealEval w z q)) = + observable a (D.filtration.realification.polynomialOrbitRealEval w z g) := by + obtain ⟨g, hg, hm, hdiagram⟩ := + D.exists_marked_topQuotientOrbit_lift_diagram E φ hφ Q hQ QF hQF hsurj q marked heq + refine ⟨g, hg, hm, ?_⟩ + intro a ha z + have h := hrecovery a ha (D.filtration.realification.polynomialOrbitRealEval w z g) + rw [hdiagram z] at h + exact h + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + +namespace AllocatedExternalCandidateSampler + +variable (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +theorem sides_pos (k : LayerSamplerVariables G I n B) : 0 < A.sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U b S j + +include A in + +theorem trimMargin_proper (x : X) : 2 * spatialTrimMargin τ N x < N x := by + obtain ⟨base, hbase⟩ := A.bases_nonempty + obtain ⟨a, ha, _⟩ := Finset.mem_image.mp hbase + have hx := (mem_integerBox _ _).mp ha x + omega + +theorem physical_mem_integerBox (hξ1 : ξ ≤ 1) (z : A.Path) (site : A.Site) : + A.physical z site ∈ integerBox N := by + have hroot : (∑ k, |(site.val k : ℝ)|) ≤ + allocatedExternalCandidateRootBudget B U b S := by + rw [allocatedExternalCandidateRootBudget_eq] + exact allocatedParameterSite_sum_bound B U b S site + exact jointIntegerPhysicalSite_mem_box site.val N (spatialTrimMargin τ N) + (fun x => (A.trimMargin_proper x).le) A.widths + (narrowTrimmedSpatialWidths_fit + (allocatedExternalCandidateRootBudget_nonneg B U b S) A.trim_pos hξ1 + site.val hroot N A.size_pos) z + +end AllocatedExternalCandidateSampler + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct NNReal + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +namespace AllocatedExternalLocalChart + +variable {A} {chartCost : ℝ} (C : AllocatedExternalLocalChart (E := E) A chartCost) + +theorem physical_mem_integerBox (hξ1 : ξ ≤ 1) (u : C.Variables → ℤ) + (hu : u ∈ C.slice.integerPoints) : C.physical u ∈ integerBox N := by + rw [C.physical_eq_sampler u (C.slice.integerPoints_subset_integerBox hu)] + exact A.physical_mem_integerBox hξ1 C.path _ + +end AllocatedExternalLocalChart + +namespace AllocatedExternalCandidateProblem + +variable {L M ι κ : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s d f nD nF nQ nQF : ℕ} + {D : RationalFilteredNilmanifold L (s + 1) d} + (Fmark : RationalFilteredNilmanifold M (s + 1) f) + (φ : L →ₗ⁅ℚ⁆ M) + (hφ : ∀ j, ∀ x ∈ D.filtration.layer j, φ x ∈ Fmark.filtration.layer j) + {marked : Fmark.filtration.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {observable : (X → ℤ) → D.Space → ℂ} {weight : (X → ℤ) → ℂ} + {cost massThreshold scoreThreshold : ℝ} + (P : AllocatedExternalCandidateProblem (E := E) A D Fmark.filtration φ marked + observable weight cost massThreshold scoreThreshold) + (W : LieSubalgebra ℚ D.filtration.AssociatedGraded) + (Dref : RationalFilteredNilmanifold + (D.filtration.gradedRefiltrationSubalgebra W) (s + 1) nD) + (hDref : Dref.filtration = D.filtration.gradedRefiltration W) + (Fref : RationalFilteredNilmanifold + (Fmark.filtration.gradedRefiltrationSubalgebra + (W.map (D.filtration.associatedGradedMap Fmark.filtration φ hφ))) (s + 1) nF) + (hFref : Fref.filtration = Fmark.filtration.gradedRefiltration + (W.map (D.filtration.associatedGradedMap Fmark.filtration φ hφ))) + (Q : RationalFilteredNilmanifold + ((D.filtration.gradedRefiltrationSubalgebra W) ⧸ Dref.filtration.layerIdeal (s + 1)) s nQ) + (hQ : Q.filtration = Dref.filtration.quotientTop) + (QF : RationalFilteredNilmanifold + ((Fmark.filtration.gradedRefiltrationSubalgebra + (W.map (D.filtration.associatedGradedMap Fmark.filtration φ hφ))) ⧸ + Fref.filtration.layerIdeal (s + 1)) s nQF) + (hQF : QF.filtration = Fref.filtration.quotientTop) + [PseudoMetricSpace Q.Space] [PseudoMetricSpace Fref.Space] + +variable (left right : D.filtration.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)) + (markedMiddle : Fref.filtration.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)) + (K : ℝ≥0) + +variable (hσ1 : ∀ j, σ j ≤ 1) (H : Fin m → ℝ) (hH : ∀ j, 0 ≤ H j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ H j * ‖v‖) + (hsmall : ∀ j, H j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ 1 / 8) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (middle : ∀ z : P.productive, + AllocatedExternalLocalCandidate (P.chart z) Dref Fref.filtration (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) markedMiddle) + (allowed : (X → ℤ) → Prop) + (hphysical : ∀ z : P.productive, ∀ u ∈ (P.chart z).slice.integerPoints, + allowed ((P.chart z).physical u)) + (hrecovery : ∀ x, allowed x → ∀ source, positiveImageSlice (Dref.markedTopQuotientDiagram Fref (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) Q) K + (P.refilteredFrozenObservable A Fmark φ W Dref left right x) + (Dref.markedTopQuotientDiagram Fref (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) Q source).2 + (Dref.markedTopQuotientDiagram Fref (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) Q source).1 = + P.refilteredFrozenObservable A Fmark φ W Dref left right x source) + +include hσ1 H hH hchart hsmall hp hphysical hrecovery in + +theorem refilteredQuotientCandidate_score_eq_frozen_on (z : P.productive) : + ((middle z).topQuotient Fref (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) (D.refilteredMarkedMap_mem_layer Fmark φ hφ W Dref hDref Fref hFref) Q hQ QF hQF).score + (P.refilteredQuotientObservable A Fmark φ hφ W Dref Fref Q left right markedMiddle K) + weight = P.refilteredFrozenScore A Fmark φ hφ W Dref Fref left right markedMiddle middle z := by + unfold AllocatedExternalLocalCandidate.score refilteredFrozenScore + apply congrArg Complex.re + apply Finset.expect_congr rfl + intro u hu + congr 1 + rw [AllocatedExternalLocalCandidate.topQuotient_value] + have htags := P.chartValues_eq_physicalIntegerPoint hσ1 H hH hchart hsmall hp z u hu + have hmark := (middle z).mark_on_slice u hu + rw [htags] at hmark + have hr := hrecovery ((P.chart z).physical u) (hphysical z u hu) + (Dref.filtration.realification.polynomialOrbitEval (fun _ => 1) u (middle z).orbit) + simp only [RationalFilteredNilmanifold.markedTopQuotientDiagram, hmark] at hr + exact hr + +variable {frozenScoreThreshold : ℝ} + (hscore : ∀ z : P.productive, frozenScoreThreshold ≤ + P.refilteredFrozenScore A Fmark φ hφ W Dref Fref left right markedMiddle middle z) + +noncomputable def refilteredQuotientScoredProblem_on : + AllocatedExternalCandidateProblem (E := E) A Q QF.filtration + (Dref.topQuotientMarkedMap Fref (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) (D.refilteredMarkedMap_mem_layer Fmark φ hφ W Dref hDref Fref hFref)) (Fref.topQuotientOrbit QF hQF markedMiddle) + (P.refilteredQuotientObservable A Fmark φ hφ W Dref Fref Q left right markedMiddle K) + weight cost massThreshold frozenScoreThreshold where + productive := P.productive + mass := P.mass + chart := P.chart + chart_path := P.chart_path + centerLift := P.centerLift + chart_centerLift := P.chart_centerLift + frozen_side := P.frozen_side + candidate z := (middle z).topQuotient Fref (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) (D.refilteredMarkedMap_mem_layer Fmark φ hφ W Dref hDref Fref hFref) Q hQ QF hQF + score z := by + rw [P.refilteredQuotientCandidate_score_eq_frozen_on A Fmark φ hφ W Dref hDref Fref hFref + Q hQ QF hQF left right markedMiddle K hσ1 H hH hchart hsmall hp middle allowed hphysical hrecovery z] + exact hscore z + +variable (hmarkFactor : ∀ z : P.productive, ∀ u ∈ (P.chart z).slice.integerPoints, + realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Fmark.filtration.lowerCentralSeries_eq_bot) φ + (D.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight (X := X) J) ((P.chart z).chartValues u) left * + realificationMap (hnil := Dref.filtration.lowerCentralSeries_eq_bot) + (hM := D.filtration.lowerCentralSeries_eq_bot) + (D.filtration.gradedRefiltrationSubalgebra W).incl + (Dref.filtration.realification.polynomialOrbitEval (fun _ => 1) u (middle z).orbit) * + D.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight (X := X) J) ((P.chart z).chartValues u) right) = + Fmark.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight (X := X) J) ((P.chart z).chartValues u) marked) + +include hmarkFactor in + +theorem conclusion_of_refilteredQuotientScored_on + (db : Basis ι ℚ L) (dw : ι → ℕ) + (hdb : ∀ j, D.filtration.layer j = Submodule.span ℚ (db '' {i | j ≤ dw i})) + (fb : Basis κ ℚ M) (fw : κ → ℕ) + (hfb : ∀ j, Fmark.filtration.layer j = Submodule.span ℚ (fb '' {i | j ≤ fw i})) + (hW : BasisGradedSubmodule (D.filtration.associatedGradedBasis db dw hdb) dw W.toSubmodule) + (hsurj : ∀ j, ∀ y ∈ Fmark.filtration.layer j, ∃ x ∈ D.filtration.layer j, φ x = y) + {outputCost outputMass outputScore : ℝ} + (lower : (P.refilteredQuotientScoredProblem_on A Fmark φ hφ W Dref hDref Fref hFref + Q hQ QF hQF left right markedMiddle K hσ1 H hH hchart hsmall hp middle allowed hphysical hrecovery hscore).Conclusion + outputCost outputMass outputScore) : + Nonempty (P.Conclusion outputCost outputMass outputScore) := by + have hcompat : Dref.topQuotientMarkedOrbit Fref (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) (D.refilteredMarkedMap_mem_layer Fmark φ hφ W Dref hDref Fref hFref) Q hQ QF hQF lower.ambient = + Fref.topQuotientOrbit QF hQF markedMiddle := by + apply Subtype.ext + apply NilpotentLieBCHGroup.ext + exact lower.marked + obtain ⟨ambientMiddle, _, hmarkedMiddle, hevalMiddle⟩ := + Dref.exists_marked_topQuotientOrbit_lift_externalFamily_on Fref (D.filtration.gradedRefiltrationMap Fmark.filtration φ hφ W) (D.refilteredMarkedMap_mem_layer Fmark φ hφ W Dref hDref Fref hFref) Q hQ QF hQF K + (P.refilteredFrozenObservable A Fmark φ W Dref left right) allowed hrecovery + (D.refilteredMarkedMap_layer_surjective Fmark φ hφ W Dref hDref Fref hFref + db dw hdb fb fw hfb hW hsurj) + lower.ambient markedMiddle hcompat + let candidate := D.externalCandidateOrbit W Dref hDref (fullTaggedVariableWeight (X := X) J) left right ambientMiddle + obtain ⟨restored, hmark, _, hkeep⟩ := + D.filtration.exists_formal_marked_orbit_restoration Fmark.filtration φ hφ + fb fw hfb hsurj (fullTaggedVariableWeight (X := X) J) candidate marked + have hretained (z : P.productive) (u : (P.chart z).Variables → ℤ) + (hu : u ∈ (P.chart z).slice.integerPoints) : + D.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight (X := X) J) ((P.chart z).chartValues u) restored = + D.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight (X := X) J) ((P.chart z).chartValues u) candidate := by + have hk := hkeep (fun i => ((P.chart z).chartValues u i : ℝ)) (by + simpa only [polynomialOrbitRealEval_integer] using + P.refilteredScoredAssembly_mark_on_slice A Fmark φ hφ W Dref hDref Fref left right + markedMiddle middle hmarkFactor ambientMiddle hmarkedMiddle z u hu) + simpa only [polynomialOrbitRealEval_integer] using hk + refine ⟨{ + ambient := restored + marked := hmark + retained := lower.retained + subset := lower.subset + mass := lower.mass + step := lower.step + step_pos := lower.step_pos + slice := lower.slice + dense := lower.dense + inside := lower.inside + score := ?_ + }⟩ + intro z + apply (lower.score z).trans_eq + unfold ambientScore + apply congrArg Complex.re + apply Finset.expect_congr rfl + intro u hu + let zp : P.productive := ⟨z.val, lower.subset z.property⟩ + have huOriginal : u ∈ (P.chart zp).slice.integerPoints := lower.inside z hu + have htags := P.chartValues_eq_physicalIntegerPoint hσ1 H hH hchart hsmall hp zp u huOriginal + change weight ((P.chart zp).physical u) * + P.refilteredQuotientObservable A Fmark φ hφ W Dref Fref Q left right markedMiddle K + ((P.chart zp).physical u) + (QuotientGroup.mk (Q.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight (X := X) J) + ((P.chart zp).chartValues u) lower.ambient)) = + weight ((P.chart zp).physical u) * observable ((P.chart zp).physical u) + (QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight (X := X) J) + ((P.chart zp).chartValues u) restored)) + congr 1 + rw [hretained zp u huOriginal] + have ha := D.externalCandidateOrbit_realEval W Dref hDref (fullTaggedVariableWeight (X := X) J) left right ambientMiddle + (fun i => ((P.chart zp).chartValues u i : ℝ)) + simp only [polynomialOrbitRealEval_integer] at ha + change _ = observable ((P.chart zp).physical u) + (QuotientGroup.mk (D.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight (X := X) J) + ((P.chart zp).chartValues u) (D.externalCandidateOrbit W Dref hDref (fullTaggedVariableWeight (X := X) J) left right ambientMiddle))) + rw [ha] + have hr := hevalMiddle ((P.chart zp).physical u) (hphysical zp u huOriginal) + (fun i => ((P.chart zp).chartValues u i : ℝ)) + simp only [polynomialOrbitRealEval_integer] at hr + simpa only [refilteredQuotientObservable, refilteredFrozenObservable, ← htags] using hr + +end AllocatedExternalCandidateProblem +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedConclusion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedConclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..70aaf627be7ecb78e52bc20f7c55066090ac0f8b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedConclusion.lean @@ -0,0 +1,311 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeAutomaticLongGeometry + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable {originalMass originalScore : ℝ} + (P : AllocatedExternalCandidateProblem (E := Deck) A D Fmark φ marked observable weight + cost originalMass originalScore) + (hH : H ⊆ P.productive) + (hsourceChart : ∀ a (ha : a ∈ H), F.sourceChart a = P.chart ⟨a, hH ha⟩) + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) + +def conclusion_of_actualSourceProblemOn {outputCost outputMass outputScore : ℝ} + (result : (F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).Conclusion outputCost outputMass outputScore) : + P.Conclusion outputCost outputMass outputScore := by + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + have hsourceSub : source.productive ⊆ P.productive := fun _ ha => hH (hsub ha) + have hsourceKeep (z : source.productive) : + (P.chart ⟨z.val, hsourceSub z.property⟩).keep = keep := by + rw [← hsourceChart z.val (hsub z.property)] + exact F.keep_eq z.val + have hchart (z : source.productive) : + source.chart z = + (P.chart ⟨z.val, hsourceSub z.property⟩).withKeep keep (hsourceKeep z) := by + change (F.sourceChart z.val).withKeep keep (F.keep_eq z.val) = _ + congr 1 + exact hsourceChart z.val (hsub z.property) + exact P.conclusion_of_chartwise_withKeep source hsourceSub keep hsourceKeep hchart result + +include hH hsourceChart in + +theorem conclusion_of_actualSourceOptionQuotient + (ideal : LieIdeal ℚ LG) + (hI : D.filtration.layer (s + 1) ≤ ideal.toSubmodule) + {dQ : ℕ} (Q : RationalFilteredNilmanifold (LG ⧸ ideal) s dQ) + (hQ : Q.filtration = D.filtration.quotientLie ideal hI) + (hker : ∀ x ∈ ideal, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) (lieQuotientMap ideal) g)) = + observable x (QuotientGroup.mk g)) + {outputCost outputMass outputScore : ℝ} + (result : ((F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).optionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + ideal hI Q hQ hker descended hrecovery).Conclusion outputCost outputMass outputScore) : + Nonempty (P.Conclusion outputCost outputMass outputScore) := by + obtain ⟨original⟩ := + (F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).conclusion_of_optionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + ideal hI Q hQ hker descended hrecovery result + exact ⟨F.conclusion_of_actualSourceProblemOn H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore P hH hsourceChart retained hsub hmass original⟩ + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +@[simp] theorem actualSourceProblemOn_withKeep + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) : + (F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).withKeep keep (fun _ => rfl) = + F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass := rfl + +@[simp] theorem actualSourceProblemOn_withKeep_optionJoint + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) : + ((F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).withKeep keep (fun _ => rfl)).optionJoint + (fun j => (F.native j).model) + (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) = + F.actualJointProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass := rfl + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable {originalMass originalScore : ℝ} + (P : AllocatedExternalCandidateProblem (E := Deck) A D Fmark φ marked observable weight + cost originalMass originalScore) + (hH : H ⊆ P.productive) + (hsourceChart : ∀ a (ha : a ∈ H), F.sourceChart a = P.chart ⟨a, hH ha⟩) + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) + +include hH hsourceChart in + +theorem conclusion_of_actualSourceAdaptedOptionQuotient + (ideal : LieIdeal ℚ LG) + (hI : D.filtration.layer (s + 1) ≤ ideal.toSubmodule) + {dQ : ℕ} (Q : RationalFilteredNilmanifold (LG ⧸ ideal) s dQ) + (hQ : Q.filtration = D.filtration.quotientLie ideal hI) + (hker : ∀ x ∈ ideal, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) (lieQuotientMap ideal) g)) = + observable x (QuotientGroup.mk g)) + (adapted : (optionProduct Q (fun j => (F.native j).model)).AdaptedModelData) + {outputCost outputMass outputScore : ℝ} + (result : (((F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + ideal hI Q hQ hker descended hrecovery adapted).Conclusion + outputCost outputMass outputScore) : + Nonempty (P.Conclusion outputCost outputMass outputScore) := by + obtain ⟨original⟩ := + ((F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).withKeep keep (fun _ => rfl)).conclusion_of_adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + ideal hI Q hQ hker descended hrecovery adapted result + exact ⟨F.conclusion_of_actualSourceProblemOn H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore P hH hsourceChart retained hsub hmass original⟩ + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedPhysicalTerminal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedPhysicalTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6b14abdb9cfc44ea6b283f01400cbbbabaec75a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedPhysicalTerminal.lean @@ -0,0 +1,255 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedOrdinaryLongPhysicalTerminalConclusion +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeAutomaticLongGeometry + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom realSymbolGradeEvaluation + CertifiedFullChartFiniteHistory.outer + CertifiedFullChartFiniteHistory.earlyForwardBranchTree realGradedSymbolPolynomial + +noncomputable section + +variable {m : ℕ} {G X : Type} [Fintype G] [Fintype X] [DecidableEq X] + {I J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type} {Pivot : Type} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable {α : Type} [Fintype α] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) + (js : List Pivot) + {dQ : ℕ} + (Q : RationalFilteredNilmanifold (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)) + (adapted : (optionProduct Q (fun j => (F.native j).model)).AdaptedModelData) + +local notation "countConstants" => (fun n => fullChartStageCountConstant (n + 1) 254) + +theorem ActualAdaptedPivotQuotientFactors.exists_affine_physical_terminal + {qVertical qCommon pProj : ℝ} + (hproduced : F.ActualAdaptedPivotQuotientFactors H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + qVertical qCommon pProj) + (stageKeep : ℕ → LayerSamplerVariables G I n B → Prop) + {κ : Type} [Fintype κ] + (bMark : Basis κ ℚ (∀ i : Option Pivot, optionLieSpace LM (fun j => (F.native j).L) i)) + (ν : κ → ℕ) + (hMark : ∀ k, (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).layer k = Submodule.span ℚ (bMark '' {i | k ≤ ν i})) + (hmarkΦ : ∀ k, ∀ z ∈ (adapted.model.filtration).layer k, (optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) z ∈ (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).layer k) + [Fintype (SymbolBasisIndex (fun _ : LayerSamplerVariables G I n B => 1) adapted.weight)] + [Fintype (SymbolBasisIndex (fun _ : LayerSamplerVariables G I n B => 1) ν)] + [∀ r, Fintype (SymbolBasisIndex + (fun _ : {i : LayerSamplerVariables G I n B // stageKeep r i} => 1) adapted.weight)] + [∀ r, Fintype (SymbolBasisIndex + (fun _ : {i : LayerSamplerVariables G I n B // stageKeep r i} => 1) ν)] + [∀ r, TopologicalSpace (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, IsTopologicalAddGroup (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, ContinuousSMul ℝ (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, T2Space (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + (pGeometry Rrank : ℝ) (Hbr : ℕ) + (hpGeometry : 0 ≤ pGeometry) + (hSourceGeometry : (finrank ℚ (∀ i : Option Pivot, + optionLieSpace (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) + (fun j => (F.native j).L) i) : ℝ) ≤ pGeometry) + (hMarkedGeometry : (Fintype.card κ : ℝ) ≤ pGeometry) + (hGeneratorGeometry : (Fintype.card α : ℝ) ≤ pGeometry) + (hSamplerGeometry : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ pGeometry) + (hQuotientGeometry : (pProj + 2) ^ 4 ≤ pGeometry) + (scheduleExponent : ℕ) (x gainLog stageLog : ℝ) + (hx : 0 ≤ x) (hgain : gainLog ∈ Set.Icc 0 x) (hstage : stageLog ∈ Set.Icc 0 x) + (Cprimitive Csource : ℕ) (sourceNative pTest detectionLoss : ℕ → ℝ) + (hSourceNonneg : ∀ r < s, 0 ≤ sourceNative r) + (hSourceBound : ∀ r < s, sourceNative r ≤ + (preparedFiniteForwardSourcePrecision scheduleExponent countConstants r x gainLog stageLog + + preparedFiniteForwardWork scheduleExponent countConstants r x + Csource) ^ Csource) + (hBaseExponent : allocatedCandidateStageBaseExponent s m Cprimitive ≤ scheduleExponent) + (hphaseExponent : ∀ r < s, + allocatedCandidateCompositePhaseConstant s m 1 + (allocatedCandidatePromotedMajorConstant Csource) r ≤ scheduleExponent) + (hCprimitive : 1 ≤ Cprimitive) + (hGeometryBase : allocatedCandidateCommonFastBudget s pGeometry ≤ x) + (hHbr : 1 ≤ Hbr) + (hTagsBase : (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ x) + (hmEarly : (m : ℝ) ≤ x) + (hblocksEarly : ((s * (Fintype.card κ * m) : ℕ) : ℝ) ≤ x) + (hHbrBase : (Hbr : ℝ) ≤ Real.exp x) + (hcost : cost ≤ (x + Cprimitive) ^ Cprimitive) + (HMap : ℕ) (hHMap : 1 ≤ HMap) + (hHMapGeometry : (HMap : ℝ) ≤ Real.exp pGeometry) + (hNativeBase : (pProj + 2) ^ 3 + qCommon ≤ (x + Cprimitive) ^ Cprimitive) + (hentries : ∀ i j, RationalHeightLE (bMark.repr ((optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) (adapted.model.basis j)) i) HMap) + (hbracket : ∀ i j z, RationalHeightLE (bMark.repr ⁅bMark i, bMark j⁆ z) Hbr) + (hkept : ∀ r, ∀ i, stageKeep r i → Real.exp (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x)) ≤ (A.sides i : ℝ)) + (hfrozenStage : ∀ r, ∀ i, ¬stageKeep r i → (A.sides i : ℝ) ≤ Real.exp + (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x))) + (hTest : ∀ r < s, OrdinaryPolynomialPhase.budget r ≤ pTest r) + (hDetectionLoss : ∀ r < s, detectionLoss r ≤ (9 / 10 : ℝ) * + (Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H)) + (hdirect : ∀ r < s, A.NativeDetection r (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x)) + (pTest r) (sourceNative r) (detectionLoss r)) + (hN : ∀ i, Real.exp (preparedFiniteForwardCumulative scheduleExponent countConstants s x) ≤ (N i : ℝ)) + (hRrank : Real.exp (preparedFiniteForwardCumulative scheduleExponent countConstants s x) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) + (hs : 0 < s) (separation : ℝ) + (hseparation : certifiedAffineLongSideBound + (preparedFiniteForwardCumulative scheduleExponent countConstants s x) ≤ separation) : + ∃ (retained : Finset A.Path) (hsub : retained ⊆ H) + (hmass : Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H ≤ A.law.mass retained), + 0 < A.law.mass retained ∧ + ∃ W : LieSubalgebra ℚ ((optionProduct D (fun j => (F.native j).model)).filtration).AssociatedGraded, + let V := W.map (((optionProduct D (fun j => (F.native j).model)).filtration).associatedGradedMap (adapted.model.filtration) (optionMarkedLieMap (L := fun j => (F.native j).L) (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) (D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model))) + (∀ z ∈ (adapted.model.filtration).gradedRefiltrationLayer V s, (optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) z = 0 → z = 0) ∧ + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + target.NativeCommonPhysicalTerminal bMark ν hMark hmarkΦ V + scheduleExponent Cprimitive x separation := by + classical + obtain ⟨retained, hsub, hmass, hpos, theta, W, v, den, hv, hW, hvH, hzero, + hden, hdenBound, denQ, hdenQ, hdenQBound, hdiv, hvQ, hWQ, hvQH, hfactorQ, + htop, hgradedTop⟩ := hproduced + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + let V := W.map (((optionProduct D (fun j => (F.native j).model)).filtration).associatedGradedMap (adapted.model.filtration) (optionMarkedLieMap (L := fun j => (F.native j).L) (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) (D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model))) + let vQ := ((optionProduct D (fun j => (F.native j).model)).filtration).gradedImageSpanningFamily (adapted.model.filtration) (optionMarkedLieMap (L := fun j => (F.native j).L) (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) (D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model)) v + have hpGeometryX : pGeometry ≤ x := + (allocatedCandidateCommonFastBudget_bounds s hpGeometry).2.2.trans hGeometryBase + have hprimitive : x ≤ (x + Cprimitive) ^ Cprimitive := by + have hC : (1 : ℝ) ≤ Cprimitive := by exact_mod_cast hCprimitive + have hbase : 1 ≤ x + Cprimitive := by linarith + exact (le_add_of_nonneg_right (Nat.cast_nonneg Cprimitive)).trans + (by simpa only [pow_one] using pow_le_pow_right₀ hbase hCprimitive) + have hdenQBase : (denQ : ℝ) ≤ Real.exp ((x + Cprimitive) ^ Cprimitive) := + hdenQBound.trans (Real.exp_le_exp.mpr + ((hQuotientGeometry.trans hpGeometryX).trans hprimitive)) + have hOriginal (z : target.productive) : + (adapted.model.filtration).HasCommonRefilteredOrbitFactors adapted.model.basis adapted.weight adapted.model_layers + (fun i : (target.chart z).Variables => (A.sides i.val : ℝ)) + ((pProj + 2) ^ 3 + qCommon) denQ V + ((adapted.model.filtration).realification.polynomialOrbitCoordinates (fun _ => 1) (target.candidate z).orbit) := + hfactorQ z + have hselectedMass : 0 < Real.exp + (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H := by + apply mul_pos (Real.exp_pos _) + apply hpos.trans_le + exact Finset.sum_le_sum_of_subset_of_nonneg hsub (fun a _ _ => A.law.nonneg a) + have ht := target.exists_native_common_affine_physical_terminal stageKeep + adapted.model.basis adapted.weight adapted.model_layers bMark ν hMark hmarkΦ V + vQ hvQ hWQ pGeometry Rrank Hbr hpGeometry + (by simpa only [Fintype.card_fin] using hSourceGeometry) hMarkedGeometry + (by simpa only [Fintype.card_fin] using hGeneratorGeometry) hSamplerGeometry + (fun a i => (hvQH a i).trans hQuotientGeometry) + scheduleExponent x gainLog stageLog hx hgain hstage Cprimitive Csource + sourceNative pTest detectionLoss hSourceNonneg hSourceBound hBaseExponent hphaseExponent + hCprimitive hGeometryBase hHbr hTagsBase hmEarly hblocksEarly hHbrBase hcost + HMap denQ ((pProj + 2) ^ 3 + qCommon) hHMap hdenQ hHMapGeometry hdenQBase + hNativeBase hentries hbracket hOriginal F.hτ1 F.hξ F.hσ1 F.Cgeo F.hCgeo F.hchart F.hsmall + F.hpoly hkept hfrozenStage hTest hDetectionLoss hdirect hN hRrank hrank + hs hselectedMass separation hseparation + obtain ⟨qDim, hdim, eQ, lift, hfast, hsection, hterminal⟩ := ht + refine ⟨retained, hsub, hmass, hpos, W, htop, ?_⟩ + have hηBase : (Fintype.card (Fin qDim) : ℝ) ≤ x := by + simpa only [Fintype.card_fin] using + (Nat.cast_le.mpr hdim).trans (hMarkedGeometry.trans hpGeometryX) + have hblocks : ((s * (Fintype.card (Fin qDim) * m) : ℕ) : ℝ) ≤ x := by + simpa only [Fintype.card_fin] using + (Nat.cast_le.mpr (Nat.mul_le_mul_left s (Nat.mul_le_mul_right m hdim))).trans hblocksEarly + have hXEarly : (Fintype.card X : ℝ) ≤ x := by + have hsum : (Fintype.card X : ℝ) + (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + simpa only [Fintype.card_sum, Nat.cast_add] using hTagsBase + exact (le_add_of_nonneg_right (Nat.cast_nonneg _)).trans hsum + have hJEarly : (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + have hsum : (Fintype.card X : ℝ) + (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + simpa only [Fintype.card_sum, Nat.cast_add] using hTagsBase + exact (le_add_of_nonneg_left (Nat.cast_nonneg _)).trans hsum + have hNEarly : ∀ i, 1 ≤ N i := by + intro i + have hpositive : 0 < N i := by exact_mod_cast ((Real.exp_pos _).trans_le (hN i)) + exact Nat.succ_le_iff.mpr hpositive + refine ⟨qDim, hdim, eQ, lift, hfast, hsection, hx, hXEarly, hmEarly, hJEarly, + hηBase, hblocks, hNEarly, ?_⟩ + dsimp only at hterminal ⊢ + exact hterminal + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedTerminal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e93e263fd54ea8569b50d07f68ed3af7538c992 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAdaptedTerminal.lean @@ -0,0 +1,240 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedOrdinaryLongPhysicalTerminalConclusion +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeAutomaticLongGeometry + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom realSymbolGradeEvaluation + CertifiedFullChartFiniteHistory.outer + CertifiedFullChartFiniteHistory.earlyForwardBranchTree realGradedSymbolPolynomial + +noncomputable section + +variable {m : ℕ} {G X : Type} [Fintype G] [Fintype X] [DecidableEq X] + {I J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type} {Pivot : Type} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable {α : Type} [Fintype α] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) + (js : List Pivot) + {dQ : ℕ} + (Q : RationalFilteredNilmanifold (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)) + (adapted : (optionProduct Q (fun j => (F.native j).model)).AdaptedModelData) + +local notation "countConstants" => (fun n => fullChartStageCountConstant (n + 1) 254) + +theorem ActualAdaptedPivotQuotientFactors.exists_early_forward_terminal + {qVertical qCommon pProj : ℝ} + (hproduced : F.ActualAdaptedPivotQuotientFactors H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + qVertical qCommon pProj) + (stageKeep : ℕ → LayerSamplerVariables G I n B → Prop) + {κ : Type} [Fintype κ] + (bMark : Basis κ ℚ (∀ i : Option Pivot, optionLieSpace LM (fun j => (F.native j).L) i)) + (ν : κ → ℕ) + (hMark : ∀ k, (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).layer k = Submodule.span ℚ (bMark '' {i | k ≤ ν i})) + (hmarkΦ : ∀ k, ∀ z ∈ (adapted.model.filtration).layer k, (optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) z ∈ (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).layer k) + [Fintype (SymbolBasisIndex (fun _ : LayerSamplerVariables G I n B => 1) adapted.weight)] + [Fintype (SymbolBasisIndex (fun _ : LayerSamplerVariables G I n B => 1) ν)] + [∀ r, Fintype (SymbolBasisIndex + (fun _ : {i : LayerSamplerVariables G I n B // stageKeep r i} => 1) adapted.weight)] + [∀ r, Fintype (SymbolBasisIndex + (fun _ : {i : LayerSamplerVariables G I n B // stageKeep r i} => 1) ν)] + [∀ r, TopologicalSpace (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, IsTopologicalAddGroup (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, ContinuousSMul ℝ (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, T2Space (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + (pGeometry Rrank : ℝ) (Hbr : ℕ) + (hpGeometry : 0 ≤ pGeometry) + (hSourceGeometry : (finrank ℚ (∀ i : Option Pivot, + optionLieSpace (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) + (fun j => (F.native j).L) i) : ℝ) ≤ pGeometry) + (hMarkedGeometry : (Fintype.card κ : ℝ) ≤ pGeometry) + (hGeneratorGeometry : (Fintype.card α : ℝ) ≤ pGeometry) + (hSamplerGeometry : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ pGeometry) + (hQuotientGeometry : (pProj + 2) ^ 4 ≤ pGeometry) + (scheduleExponent : ℕ) (x gainLog stageLog : ℝ) + (hx : 0 ≤ x) (hgain : gainLog ∈ Set.Icc 0 x) (hstage : stageLog ∈ Set.Icc 0 x) + (Cprimitive Csource : ℕ) (sourceNative pTest detectionLoss : ℕ → ℝ) + (hSourceNonneg : ∀ r < s, 0 ≤ sourceNative r) + (hSourceBound : ∀ r < s, sourceNative r ≤ + (preparedFiniteForwardSourcePrecision scheduleExponent countConstants r x gainLog stageLog + + preparedFiniteForwardWork scheduleExponent countConstants r x + Csource) ^ Csource) + (hBaseExponent : allocatedCandidateStageBaseExponent s m Cprimitive ≤ scheduleExponent) + (hphaseExponent : ∀ r < s, + allocatedCandidateCompositePhaseConstant s m 1 + (allocatedCandidatePromotedMajorConstant Csource) r ≤ scheduleExponent) + (hCprimitive : 1 ≤ Cprimitive) + (hGeometryBase : allocatedCandidateCommonFastBudget s pGeometry ≤ x) + (hHbr : 1 ≤ Hbr) + (hTagsBase : (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ x) + (hmEarly : (m : ℝ) ≤ x) + (hblocksEarly : ((s * (Fintype.card κ * m) : ℕ) : ℝ) ≤ x) + (hHbrBase : (Hbr : ℝ) ≤ Real.exp x) + (hcost : cost ≤ (x + Cprimitive) ^ Cprimitive) + (HMap : ℕ) (hHMap : 1 ≤ HMap) + (hHMapGeometry : (HMap : ℝ) ≤ Real.exp pGeometry) + (hNativeBase : (pProj + 2) ^ 3 + qCommon ≤ (x + Cprimitive) ^ Cprimitive) + (hentries : ∀ i j, RationalHeightLE (bMark.repr ((optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) (adapted.model.basis j)) i) HMap) + (hbracket : ∀ i j z, RationalHeightLE (bMark.repr ⁅bMark i, bMark j⁆ z) Hbr) + (hkept : ∀ r, ∀ i, stageKeep r i → Real.exp (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x)) ≤ (A.sides i : ℝ)) + (hfrozenStage : ∀ r, ∀ i, ¬stageKeep r i → (A.sides i : ℝ) ≤ Real.exp + (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x))) + (hTest : ∀ r < s, OrdinaryPolynomialPhase.budget r ≤ pTest r) + (hDetectionLoss : ∀ r < s, detectionLoss r ≤ (9 / 10 : ℝ) * + (Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H)) + (hdirect : ∀ r < s, A.NativeDetection r (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x)) + (pTest r) (sourceNative r) (detectionLoss r)) + (hN : ∀ i, Real.exp (preparedFiniteForwardCumulative scheduleExponent countConstants s x) ≤ (N i : ℝ)) + (hRrank : Real.exp (preparedFiniteForwardCumulative scheduleExponent countConstants s x) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) : + ∃ (retained : Finset A.Path) (hsub : retained ⊆ H) + (_hmass : Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H ≤ A.law.mass retained), + 0 < A.law.mass retained ∧ + ∃ W : LieSubalgebra ℚ ((optionProduct D (fun j => (F.native j).model)).filtration).AssociatedGraded, + let V := W.map (((optionProduct D (fun j => (F.native j).model)).filtration).associatedGradedMap (adapted.model.filtration) (optionMarkedLieMap (L := fun j => (F.native j).L) (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) (D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model))) + (∀ z ∈ (adapted.model.filtration).gradedRefiltrationLayer V s, (optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) z = 0 → z = 0) ∧ + (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).NativeCommonTerminal bMark ν hMark J + (V.map ((adapted.model.filtration).associatedGradedMap (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))) (optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) hmarkΦ)) (piRealOrbit (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration)) (AllocatedExternalLocalCandidate.optionJointMarkedOrbits (marked := marked) (partners := (fun j => (F.native j).model)) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit))) U poly N + scheduleExponent x hm := by + classical + obtain ⟨retained, hsub, hmass, hpos, theta, W, v, den, hv, hW, hvH, hzero, + hden, hdenBound, denQ, hdenQ, hdenQBound, hdiv, hvQ, hWQ, hvQH, hfactorQ, + htop, hgradedTop⟩ := hproduced + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + let V := W.map (((optionProduct D (fun j => (F.native j).model)).filtration).associatedGradedMap (adapted.model.filtration) (optionMarkedLieMap (L := fun j => (F.native j).L) (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) (D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model))) + let vQ := ((optionProduct D (fun j => (F.native j).model)).filtration).gradedImageSpanningFamily (adapted.model.filtration) (optionMarkedLieMap (L := fun j => (F.native j).L) (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) (D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model)) v + have hpGeometryX : pGeometry ≤ x := + (allocatedCandidateCommonFastBudget_bounds s hpGeometry).2.2.trans hGeometryBase + have hprimitive : x ≤ (x + Cprimitive) ^ Cprimitive := by + have hC : (1 : ℝ) ≤ Cprimitive := by exact_mod_cast hCprimitive + have hbase : 1 ≤ x + Cprimitive := by linarith + exact (le_add_of_nonneg_right (Nat.cast_nonneg Cprimitive)).trans + (by simpa only [pow_one] using pow_le_pow_right₀ hbase hCprimitive) + have hdenQBase : (denQ : ℝ) ≤ Real.exp ((x + Cprimitive) ^ Cprimitive) := + hdenQBound.trans (Real.exp_le_exp.mpr + ((hQuotientGeometry.trans hpGeometryX).trans hprimitive)) + have hOriginal (z : target.productive) : + (adapted.model.filtration).HasCommonRefilteredOrbitFactors adapted.model.basis adapted.weight adapted.model_layers + (fun i : (target.chart z).Variables => (A.sides i.val : ℝ)) + ((pProj + 2) ^ 3 + qCommon) denQ V + ((adapted.model.filtration).realification.polynomialOrbitCoordinates (fun _ => 1) (target.candidate z).orbit) := + hfactorQ z + have ht := target.exists_early_forward_terminal_of_native_common_factors stageKeep + adapted.model.basis adapted.weight adapted.model_layers bMark ν hMark hmarkΦ V + vQ hvQ hWQ pGeometry Rrank Hbr hpGeometry + (by simpa only [Fintype.card_fin] using hSourceGeometry) hMarkedGeometry + (by simpa only [Fintype.card_fin] using hGeneratorGeometry) hSamplerGeometry + (fun a i => (hvQH a i).trans hQuotientGeometry) + scheduleExponent x gainLog stageLog hx hgain hstage Cprimitive Csource + sourceNative pTest detectionLoss hSourceNonneg hSourceBound hBaseExponent hphaseExponent + hCprimitive hGeometryBase hHbr hTagsBase hmEarly hblocksEarly hHbrBase hcost + HMap denQ ((pProj + 2) ^ 3 + qCommon) hHMap hdenQ hHMapGeometry hdenQBase + hNativeBase hentries hbracket hOriginal F.hτ1 F.hξ F.hσ1 F.Cgeo F.hCgeo F.hchart F.hsmall + F.hpoly hkept hfrozenStage hTest hDetectionLoss hdirect hN hRrank hrank + obtain ⟨qDim, hdim, eQ, lift, hfast, hsection, hterminal⟩ := ht + refine ⟨retained, hsub, hmass, hpos, W, htop, ?_⟩ + have hηBase : (Fintype.card (Fin qDim) : ℝ) ≤ x := by + simpa only [Fintype.card_fin] using + (Nat.cast_le.mpr hdim).trans (hMarkedGeometry.trans hpGeometryX) + have hblocks : ((s * (Fintype.card (Fin qDim) * m) : ℕ) : ℝ) ≤ x := by + simpa only [Fintype.card_fin] using + (Nat.cast_le.mpr (Nat.mul_le_mul_left s (Nat.mul_le_mul_right m hdim))).trans hblocksEarly + have hXEarly : (Fintype.card X : ℝ) ≤ x := by + have hsum : (Fintype.card X : ℝ) + (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + simpa only [Fintype.card_sum, Nat.cast_add] using hTagsBase + exact (le_add_of_nonneg_right (Nat.cast_nonneg _)).trans hsum + have hJEarly : (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + have hsum : (Fintype.card X : ℝ) + (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + simpa only [Fintype.card_sum, Nat.cast_add] using hTagsBase + exact (le_add_of_nonneg_left (Nat.cast_nonneg _)).trans hsum + have hNEarly : ∀ i, 1 ≤ N i := by + intro i + have hpositive : 0 < N i := by exact_mod_cast ((Real.exp_pos _).trans_le (hN i)) + exact Nat.succ_le_iff.mpr hpositive + refine ⟨qDim, hdim, eQ, lift, hfast, hsection, hx, hXEarly, hmEarly, hJEarly, + hηBase, hblocks, hNEarly, ?_⟩ + dsimp only at hterminal ⊢ + exact hterminal + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAutomaticGeometry.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAutomaticGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf9b2cf209586fecb52a1237e6fc0ca21fe72869 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAutomaticGeometry.lean @@ -0,0 +1,185 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeAutomaticLongGeometry + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + +noncomputable section + +theorem exists_allocatedExternalCandidateSpatialNativeFamily_native_geometry_factors + (s : ℕ) (hs : 1 ≤ s) : + ∃ Cgeometry C Cbasis K T : ℕ, 2 ≤ Cgeometry ∧ 2 ≤ C ∧ 2 ≤ Cbasis ∧ 2 ≤ K ∧ 2 ≤ T ∧ + ∀ {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + + {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip), + ∀ {qVertical : ℝ}, pNative ≤ qVertical → pLocal + r + 1 ≤ qVertical → + verticalDecompositionBudget qVertical ≤ p → + r + verticalDecompositionBudget qVertical + 2 ≤ p → + ∀ (H : Finset A.Path), 0 < A.law.mass H → + (∀ a ∈ H, ∀ j, Real.exp (-r) ≤ ‖F.correlation a j‖) → + ∀ (pGeometry : ℝ), 2 ≤ pGeometry → D.GeometryComplexityLE pGeometry → + pNative ≤ pGeometry → (Fintype.card Pivot : ℝ) ≤ pGeometry → + ∀ (js : List Pivot) {dQ : ℕ} + (Q : RationalFilteredNilmanifold + (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0), + Q.GeometryComplexityLE pGeometry → + (∀ i j, rationalLogHeight + (Q.basis.repr (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (D.basis j)) i) ≤ pGeometry) → + let pGeo := (pGeometry + 2) ^ 2 + let jointGeo := (pGeometry + 3) ^ 2 + let adaptedBudget := (jointGeo + 2) ^ Cgeometry + let bnd := adaptedBudget + (pGeo + 3) ^ 5 + pGeo + jointGeo + pGeometry + p + 2 + let localCost := allocatedFrozenTaggedPairBudget s C Cbasis pGeo p + let jointCost := allocatedFrozenTaggedFamilyInputBudget bnd localCost + let P := jointCost + (jointCost + K) ^ K + ∀ [Nonempty {i // keep i}], + (∀ i : {i // keep i}, Real.exp ((p + 2 + C) ^ C + 7 * p + 22) ≤ + (A.sides i.val : ℝ)) → + (∀ i : {i // keep i}, Real.exp ((P + 2) ^ T) ≤ (A.sides i.val : ℝ)) → + let qCommon := (P + 2) ^ T + (((P + 2) ^ 2 + 2) ^ 63 + 1) + P + 1 + let pProj := max qCommon 0 + adaptedBudget + 1 + ∀ (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)), + ∃ geometry : (optionProduct D (fun j => (F.native j).model)).AdaptedMapGeometryData + (optionProduct Q (fun j => (F.native j).model)) + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) + jointGeo adaptedBudget, + F.ActualAdaptedPivotQuotientFactors H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore geometry.source.basis geometry.source.weight geometry.source.layers + js Q hQ hker descended hrecovery geometry.target qVertical qCommon pProj := by + obtain ⟨Cgeometry, hCgeometry, hgeometry⟩ := exists_native_adapted_map_geometry + obtain ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, hfactor⟩ := + exists_allocatedExternalCandidateSpatialNativeFamily_actual_adapted_quotient_factors s hs + refine ⟨Cgeometry, C, Cbasis, K, T, hCgeometry, hC, hCbasis, hK, hT, ?_⟩ + intro m G X _ _ I J _ _ n B _ U b R σ S hb o hR hσ N poly hm τ ξ stride cells center + _ A Deck Pivot _ LG LM _ _ _ _ _ _ _ _ d₀ D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip F + qVertical hpq hprecision hfrequency hbudget H hH hcorr + pGeometry hpGeometry hD hpNative hPivot js dQ Q hQ hker hQGeometry hmap + pGeo jointGeo adaptedBudget bnd localCost jointCost P _ hlong hcommonLong qCommon pProj + sourceCenter hpath hcenter hfrozen observable weight scoreThreshold hscore descended hrecovery + have hpGeometry0 : 0 ≤ pGeometry := (by norm_num : (0 : ℝ) ≤ 2).trans hpGeometry + have hnative (j : Pivot) : (F.native j).model.GeometryComplexityLE pGeometry := + (F.native j).complexity.1.mono (F.native j).model hpNative + have hpGeo : 0 ≤ pGeo := by dsimp [pGeo]; positivity + have hjointGeo : 0 ≤ jointGeo := by dsimp [jointGeo]; positivity + have hGeometryJoint : pGeometry ≤ jointGeo := by dsimp [jointGeo]; nlinarith + have hsourceGeo := optionProduct_geometry D (fun j => (F.native j).model) + hpGeometry0 hPivot hD hnative + have htargetGeo := optionProduct_geometry Q (fun j => (F.native j).model) + hpGeometry0 hPivot hQGeometry hnative + have hmapJoint := optionMarkedLieMap_native_logHeight D Q + (fun j => (F.native j).model) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) hpGeometry0 hmap + obtain ⟨geometry⟩ := hgeometry + (optionProduct D (fun j => (F.native j).model)) + (optionProduct Q (fun j => (F.native j).model)) + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) + hjointGeo hsourceGeo htargetGeo (fun i j => (hmapJoint j i).trans hGeometryJoint) + refine ⟨geometry, ?_⟩ + have hpair (j : Pivot) : (pi (pairModels D (F.native j).model)).GeometryComplexityLE pGeo := by + apply pi_geometry _ hpGeometry0 + · simpa only [Fintype.card_bool, Nat.cast_ofNat] using hpGeometry + · intro k + cases k + · exact hnative j + · exact hD + have hadapted : 0 ≤ adaptedBudget := geometry.budget_nonneg + have hpow : 0 ≤ (pGeo + 3) ^ 5 := by positivity + have hbnd : 0 ≤ bnd := by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp] + have habnd : adaptedBudget ≤ bnd := by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp] + have hpbnd : p ≤ bnd := by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0] + have hgbnd : jointGeo + 1 ≤ bnd := by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp] + have hsourceDim : (Fintype.card (Fin (finrank ℚ + (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i))) : ℝ) ≤ bnd := by + simpa only [Fintype.card_fin] using geometry.source_dimension.trans (by linarith only [hgbnd] : jointGeo ≤ bnd) + have hProj : 0 ≤ pProj := + add_nonneg (add_nonneg (le_max_right qCommon 0) hadapted) zero_le_one + have hqProj : qCommon ≤ pProj := + (le_max_left qCommon 0).trans + ((le_add_of_nonneg_right hadapted).trans (le_add_of_nonneg_right zero_le_one)) + have haProj : adaptedBudget ≤ pProj := + (le_add_of_nonneg_left (le_max_right qCommon 0)).trans + (le_add_of_nonneg_right zero_le_one) + have hJointProj : jointGeo ≤ pProj := + (le_add_of_nonneg_right (zero_le_one : (0 : ℝ) ≤ 1)).trans + (geometry.forward_budget.trans haProj) + exact hfactor F hpq hprecision hfrequency hbudget H hH hcorr + (α := Fin (finrank ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i))) + (pGeo := pGeo) (bnd := bnd) hpGeo hbnd hpair + (by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp]) + (by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp]) hsourceDim + (hPivot.trans (by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp])) + geometry.source.basis geometry.source.weight geometry.source.layers + (fun i j k => (geometry.source_structure i j k).trans habnd) + (fun i k => (geometry.source_forward i k).trans hgbnd) + (F.hK.trans hpbnd) hlong hcommonLong + sourceCenter hpath hcenter hfrozen observable weight scoreThreshold hscore + js Q hQ hker descended hrecovery geometry.target + (height := geometry.entries_height) (pProj := pProj) geometry.entries hProj hqProj + (by simpa only [Fintype.card_fin] using geometry.source_dimension.trans hJointProj) + (geometry.target_dimension.trans hJointProj) + (geometry.entries_bound.trans (Real.exp_le_exp.mpr haProj)) + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAutomaticLongGeometry.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAutomaticLongGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b571346ae3c14c2bf8c146b0f940978678dff22 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeAutomaticLongGeometry.lean @@ -0,0 +1,1500 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeLongCommonFactors +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalLocalCandidateOptionQuotientChart + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open VectorPolynomial +open scoped TensorProduct BigOperators + +variable {ι σ τ : Type*} [Fintype ι] {L : ι → Type*} + [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] {s : ℕ} + (F : ∀ i, NilpotentLieFiltration (L i) s) {w : σ → ℕ} {v : τ → ℕ} + +attribute [local irreducible] realChartSubstitute polynomialOrbitRealChart + weightedAdaptedRealChartHom + +theorem piRealOrbit_polynomialOrbitRealChart_log + (g : ∀ i, (F i).realification.PolynomialOrbit w) + (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) : + (piRealOrbit F (fun i => (F i).polynomialOrbitRealChart w v β hβ (g i))).log = + realChartSubstitute β (piRealOrbit F g).log := by + simp only [piRealOrbit, PolynomialOrbit.log, polynomialOrbitOfLog, map_sum] + apply Finset.sum_congr rfl + intro i _ + change VectorPolynomial.map ((realProductSingle i).restrictScalars ℚ) + ((F i).polynomialOrbitRealChart w v β hβ (g i)).log = + realChartSubstitute β + (VectorPolynomial.map ((realProductSingle i).restrictScalars ℚ) (g i).log) + rw [polynomialOrbitRealChart_log] + exact (realChartSubstitute_map β (realProductSingle i) (g i).log).symm + +attribute [local irreducible] piRealOrbit + +theorem piRealOrbit_polynomialOrbitRealChart + (g : ∀ i, (F i).realification.PolynomialOrbit w) + (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) : + piRealOrbit F (fun i => (F i).polynomialOrbitRealChart w v β hβ (g i)) = + (pi F).polynomialOrbitRealChart w v β hβ (piRealOrbit F g) := by + apply Subtype.ext + apply NilpotentLieBCHGroup.ext + exact (piRealOrbit_polynomialOrbitRealChart_log F g β hβ).trans + ((pi F).polynomialOrbitRealChart_log w v β hβ (piRealOrbit F g)).symm + +theorem piRealOrbit_polynomialOrbitRealChart_coordinates + (g : ∀ i, (F i).realification.PolynomialOrbit w) + (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) : + (pi F).realification.polynomialOrbitCoordinates v + (piRealOrbit F (fun i => (F i).polynomialOrbitRealChart w v β hβ (g i))) = + (pi F).weightedAdaptedRealChartHom w v β hβ + ((pi F).realification.polynomialOrbitCoordinates w (piRealOrbit F g)) := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + exact (piRealOrbit_polynomialOrbitRealChart_log F g β hβ).trans + ((pi F).weightedAdaptedRealChartHom_coord w v β hβ + ((pi F).realification.polynomialOrbitCoordinates w (piRealOrbit F g))).symm + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Ω] [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + +def CommonFactors + (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) + {α : Type*} [Fintype α] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) (qVertical qCommon : ℝ) : Prop := + ∃ (theta : ∀ j, (F.native j).L →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (v : Fin (Fintype.card α) → + (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (den : ℕ) (H' : Finset Ω), + H' ⊆ H ∧ 0 < outer.mass H' ∧ + Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * outer.mass H ≤ outer.mass H' ∧ + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule + ((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF) + ω W.toSubmodule ∧ + (∀ i k, rationalLogHeight + (((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis + e ω hF).repr (v i) k) ≤ qCommon) ∧ + (∀ j x, x ∈ (optionProduct D (fun j => (F.native j).model)).filtration.realGradedRefiltrationLayer W s → + realifyFunctional ((pairFrequency (F.η j) (theta j)).comp + (optionPairProjection j).toLinearMap) x = 0) ∧ + 0 < den ∧ (den : ℝ) ≤ Real.exp qCommon ∧ + ∀ a ∈ H', (optionProduct D (fun j => (F.native j).model)).filtration.HasCommonRefilteredOrbitFactors + e ω hF (fun i : {i // keep i} => (A.sides i.val : ℝ)) qCommon den W + ⟨⟨(piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.jointOrbit a)).log, + (piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.jointOrbit a)).property⟩⟩ + +end AllocatedExternalCandidateSpatialNativeFamily + +private theorem compose_exponential_mass_losses {a b x y z : ℝ} + (hfirst : Real.exp (-a) * x ≤ y) (hsecond : Real.exp (-b) * y ≤ z) : + Real.exp (-(a + b)) * x ≤ z := by + calc + _ = Real.exp (-b) * (Real.exp (-a) * x) := by + rw [← mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ _ := (mul_le_mul_of_nonneg_left hfirst (Real.exp_pos _).le).trans hsecond + +theorem exists_allocatedExternalCandidateSpatialNativeFamily_common_factors + (s : ℕ) (hs : 1 ≤ s) : + ∃ C Cbasis K T : ℕ, 2 ≤ C ∧ 2 ≤ Cbasis ∧ 2 ≤ K ∧ 2 ≤ T ∧ + ∀ {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + + {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Ω] [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip), + ∀ {qVertical : ℝ}, pNative ≤ qVertical → pLocal + r + 1 ≤ qVertical → + verticalDecompositionBudget qVertical ≤ p → + r + verticalDecompositionBudget qVertical + 2 ≤ p → + ∀ (outer : FiniteProbabilityWeights Ω) (H : Finset Ω), 0 < outer.mass H → + (∀ a ∈ H, ∀ j, Real.exp (-r) ≤ ‖F.correlation a j‖) → + ∀ {α : Type*} [Fintype α] {pGeo bnd : ℝ}, + 0 ≤ pGeo → 0 ≤ bnd → + (∀ j, (pi (pairModels D (F.native j).model)).GeometryComplexityLE pGeo) → + pGeo ≤ bnd → (pGeo + 3) ^ 5 ≤ bnd → + (Fintype.card α : ℝ) ≤ bnd → (Fintype.card Pivot : ℝ) ≤ bnd → + ∀ (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})), + (∀ i j k, rationalLogHeight (e.repr ⁅e i, e j⁆ k) ≤ bnd) → + (∀ i k, rationalLogHeight + ((optionProduct D (fun j => (F.native j).model)).basis.repr (e i) k) ≤ bnd) → + let localCost := allocatedFrozenTaggedPairBudget s C Cbasis pGeo p + let jointCost := allocatedFrozenTaggedFamilyInputBudget bnd localCost + let P := jointCost + (jointCost + K) ^ K + ∀ [Nonempty {i // keep i}], (Fintype.card {i // keep i} : ℝ) ≤ bnd → + (∀ i : {i // keep i}, Real.exp ((p + 2 + C) ^ C + 7 * p + 22) ≤ + (A.sides i.val : ℝ)) → + (∀ i : {i // keep i}, Real.exp ((P + 2) ^ T) ≤ (A.sides i.val : ℝ)) → + let qCommon := (P + 2) ^ T + (((P + 2) ^ 2 + 2) ^ 63 + 1) + P + 1 + F.CommonFactors outer H e ω hF qVertical qCommon := by + obtain ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, hcommon⟩ := + exists_allocatedExternalCandidateTaggedPairFamily_common_factors s hs + refine ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, ?_⟩ + intro m G X _ _ I J _ _ n B _ U b R σ S hb o hR hσ N poly hm τ ξ stride cells center + _ A Deck Ω Pivot _ _ LG LM _ _ _ _ _ _ _ _ d₀ t D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip F + qVertical hpq hprecision hfrequency hbudget outer H hH hcorr + α _ pGeo bnd hpGeo hbnd hGeo hpGeoB hInvB hα hPivot e ω hF hstructure he + localCost jointCost P _ hkeep hlong hcommonLong + obtain ⟨retained, hretSub, hretPos, hretMass, selected, + _hchart, _hcandidate, _hreference, _htwist, heta, _hambient, hjoint⟩ := + F.exists_taggedPairFamily outer H hH hpq hprecision hfrequency hbudget hcorr + have hselectedCommon := hcommon (A := A) (D := D) + (E := fun j => (F.native j).model) (H := retained) hpGeo hbnd hGeo hpGeoB hInvB hα hPivot e ω hF + hstructure he outer hretPos selected hkeep hlong hcommonLong + obtain ⟨W, v, den, H', hsub, hpos, hmass, hspan, hgraded, hheight, hzero, + hden, hdenBound, hfactor⟩ := hselectedCommon + refine ⟨selected.θ, W, v, den, H', fun a ha => hretSub (hsub ha), hpos, + ?_, hspan, hgraded, hheight, ?_, hden, hdenBound, ?_⟩ + · apply compose_exponential_mass_losses (hsecond := hmass) + simpa only [neg_mul] using hretMass + · simpa only [heta] using hzero + · intro a ha + have hj := selected.extendedJointOrbit_mem a (hsub ha) + rw [hjoint ⟨a, hsub ha⟩] at hj + simpa only [hj] using hfactor a ha + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +def actualSourceProblemOn + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) : + AllocatedExternalCandidateProblem (E := Deck) A D Fmark φ marked observable weight + cost massThreshold scoreThreshold where + productive := retained + mass := hmass + chart a := F.chart a.val + chart_path a := hpath a.val (hsub a.property) + centerLift := sourceCenter + chart_centerLift a := hcenter a.val (hsub a.property) + frozen_side a := hfrozen a.val (hsub a.property) + candidate a := F.candidate a.val + score a := by + exact (hscore a.val (hsub a.property)).trans_eq + ((F.sourceCandidate a.val).withKeep_score + (observable := observable) (weight := weight) keep (F.keep_eq a.val)).symm + +def actualJointProblemOn + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) := + (F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).optionJoint + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + +@[simp] theorem actualJointProblemOn_productive + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) : + (F.actualJointProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).productive = retained := rfl + +@[simp] theorem actualJointProblemOn_keep + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) (a : retained) : + ((F.actualJointProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).chart a).keep = keep := rfl + +@[simp] theorem actualJointProblemOn_orbit + (retained : Finset A.Path) (hsub : retained ⊆ H) + {massThreshold : ℝ} (hmass : massThreshold ≤ A.law.mass retained) (a : retained) : + ((F.actualJointProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass).candidate a).orbit = + piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.jointOrbit a.val) := by + change piRealOrbit _ ((F.candidate a.val).optionJointLocalOrbits + (fun j => (F.native j).model) + (fun j => ((F.native j).test.fullTaggedSpatial J).orbit)) = _ + congr 1 + +theorem CommonFactors.exists_actualJointProblem + {α : Type*} [Fintype α] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) + {qVertical qCommon : ℝ} (hcommon : F.CommonFactors A.law H e ω hF qVertical qCommon) : + ∃ (retained : Finset A.Path) (hsub : retained ⊆ H) + (hmass : Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H ≤ A.law.mass retained), + 0 < A.law.mass retained ∧ + ∃ (theta : ∀ j, (F.native j).L →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (v : Fin (Fintype.card α) → + (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (den : ℕ), + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule + ((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF) + ω W.toSubmodule ∧ + (∀ i k, rationalLogHeight + (((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis + e ω hF).repr (v i) k) ≤ qCommon) ∧ + (∀ j x, x ∈ (optionProduct D (fun j => (F.native j).model)).filtration.realGradedRefiltrationLayer W s → + realifyFunctional ((pairFrequency (F.η j) (theta j)).comp + (optionPairProjection j).toLinearMap) x = 0) ∧ + 0 < den ∧ (den : ℝ) ≤ Real.exp qCommon ∧ + let P := F.actualJointProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + ∀ a : P.productive, + (optionProduct D (fun j => (F.native j).model)).filtration.HasCommonRefilteredOrbitFactors + e ω hF (fun i : {i // keep i} => (A.sides i.val : ℝ)) qCommon den W + ⟨⟨(P.candidate a).orbit.log, (P.candidate a).orbit.property⟩⟩ := by + obtain ⟨theta, W, v, den, retained, hsub, hpos, hmass, hspan, hgraded, + hheight, hzero, hden, hdenBound, hfactor⟩ := hcommon + refine ⟨retained, hsub, hmass, hpos, theta, W, v, den, hspan, hgraded, + hheight, hzero, hden, hdenBound, ?_⟩ + intro P a + exact hfactor a.val a.property + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Ω] [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + +def jointPolynomialOrbit (a : Ω) : + ((optionProduct D (fun j => (F.native j).model)).filtration.realification.adaptedPolynomialFiltration + (fun _ : {i // keep i} => 1)).Group := + ⟨⟨(piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.jointOrbit a)).log, + (piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.jointOrbit a)).property⟩⟩ + +variable (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) (js : List Pivot) + {α κ : Type*} [Fintype α] [Fintype κ] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) + +abbrev quotientFiltration := D.filtration.pivotProductQuotientFiltration φ F.η js + (NilpotentLieFiltration.pi (fun j => (F.native j).model.filtration)) + +variable + (c : Basis κ ℚ ((LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) × (∀ j, (F.native j).L))) + (ν : κ → ℕ) + (hQ : ∀ k, (F.quotientFiltration js).layer k = Submodule.span ℚ (c '' {i | k ≤ ν i})) + +def QuotientFactors (qVertical qCommon pProj : ℝ) : Prop := + ∃ (theta : ∀ j, (F.native j).L →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (v : Fin (Fintype.card α) → (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (V : LieSubalgebra ℚ (F.quotientFiltration js).AssociatedGraded) (den denQ : ℕ) (H' : Finset Ω), + H' ⊆ H ∧ 0 < outer.mass H' ∧ + Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * outer.mass H ≤ outer.mass H' ∧ + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule ((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF) + ω W.toSubmodule ∧ + (∀ i k, rationalLogHeight + (((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF).repr (v i) k) ≤ qCommon) ∧ + (∀ j x, x ∈ (optionProduct D (fun j => (F.native j).model)).filtration.realGradedRefiltrationLayer W s → + realifyFunctional ((pairFrequency (F.η j) (theta j)).comp + (optionPairProjection j).toLinearMap) x = 0) ∧ + 0 < den ∧ (den : ℝ) ≤ Real.exp qCommon ∧ + (∀ a ∈ H', (optionProduct D (fun j => (F.native j).model)).filtration.HasCommonRefilteredOrbitFactors + e ω hF (fun i : {i // keep i} => (A.sides i.val : ℝ)) qCommon den W + (F.jointPolynomialOrbit a)) ∧ + V = optionCommonPivotQuotientFast D (fun j => (F.native j).model) φ F.η js W ∧ + 0 < denQ ∧ (denQ : ℝ) ≤ Real.exp ((pProj + 2) ^ 4) ∧ den ∣ denQ ∧ + (∀ a ∈ H', ∃ El Pl Rl : + (F.quotientFiltration js).RealPolynomialSymbolGroup (fun _ : {i // keep i} => 1), + El * Pl * Rl = (F.quotientFiltration js).realPolynomialSymbolHom c ν hQ (fun _ => 1) + ((optionProduct D (fun j => (F.native j).model)).filtration.realPolynomialGroupMap (F.quotientFiltration js) + (optionPivotProductQuotientMap D φ F.η js) + (optionPivotProductQuotientMap_mem_layer D (fun j => (F.native j).model) φ F.η js) + (fun _ => 1) (F.jointPolynomialOrbit a)) ∧ + Pl.coord ∈ realificationLieSubalgebra + ((F.quotientFiltration js).symbolPointwiseSubalgebra c ν hQ (fun _ => 1) V) ∧ + (F.quotientFiltration js).SymbolSlowBound c ν hQ (fun _ => 1) + (fun i : {i // keep i} => (A.sides i.val : ℝ)) (Real.exp ((pProj + 2) ^ 3 + qCommon)) El ∧ + (F.quotientFiltration js).SymbolRationalGrid c ν hQ (fun _ => 1) denQ Rl) ∧ + BasisGradedSubmodule ((F.quotientFiltration js).associatedGradedBasis c ν hQ) ν V.toSubmodule ∧ + (∀ x ∈ (F.quotientFiltration js).gradedRefiltrationLayer V s, + D.filtration.pivotProductMarkedMap φ F.η js x = 0 → x = 0) ∧ + (∀ (Gmark : NilpotentLieFiltration (LM × (∀ j, (F.native j).L)) s) + (hmarked : ∀ k, ∀ x ∈ (F.quotientFiltration js).layer k, + D.filtration.pivotProductMarkedMap φ F.η js x ∈ Gmark.layer k), + ∀ a ∈ V, basisGradeProjection ((F.quotientFiltration js).associatedGradedBasis c ν hQ) ν s a = a → + (F.quotientFiltration js).associatedGradedMap Gmark (D.filtration.pivotProductMarkedMap φ F.η js) + hmarked a = 0 → a = 0) + +private def projectedData + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (den : ℕ) (H' : Finset Ω) (qCommon pProj : ℝ) : Prop := + let V := optionCommonPivotQuotientFast D (fun j => (F.native j).model) φ F.η js W + ∃ denQ : ℕ, 0 < denQ ∧ (denQ : ℝ) ≤ Real.exp ((pProj + 2) ^ 4) ∧ den ∣ denQ ∧ + (∀ a ∈ H', ∃ El Pl Rl : + (F.quotientFiltration js).RealPolynomialSymbolGroup (fun _ : {i // keep i} => 1), + El * Pl * Rl = (F.quotientFiltration js).realPolynomialSymbolHom c ν hQ (fun _ => 1) + ((optionProduct D (fun j => (F.native j).model)).filtration.realPolynomialGroupMap (F.quotientFiltration js) + (optionPivotProductQuotientMap D φ F.η js) + (optionPivotProductQuotientMap_mem_layer D (fun j => (F.native j).model) φ F.η js) + (fun _ => 1) (F.jointPolynomialOrbit a)) ∧ + Pl.coord ∈ realificationLieSubalgebra + ((F.quotientFiltration js).symbolPointwiseSubalgebra c ν hQ (fun _ => 1) V) ∧ + (F.quotientFiltration js).SymbolSlowBound c ν hQ (fun _ => 1) + (fun i : {i // keep i} => (A.sides i.val : ℝ)) (Real.exp ((pProj + 2) ^ 3 + qCommon)) El ∧ + (F.quotientFiltration js).SymbolRationalGrid c ν hQ (fun _ => 1) denQ Rl) ∧ + BasisGradedSubmodule ((F.quotientFiltration js).associatedGradedBasis c ν hQ) ν V.toSubmodule ∧ + (∀ x ∈ (F.quotientFiltration js).gradedRefiltrationLayer V s, + D.filtration.pivotProductMarkedMap φ F.η js x = 0 → x = 0) ∧ + (∀ (Gmark : NilpotentLieFiltration (LM × (∀ j, (F.native j).L)) s) + (hmarked : ∀ k, ∀ x ∈ (F.quotientFiltration js).layer k, + D.filtration.pivotProductMarkedMap φ F.η js x ∈ Gmark.layer k), + ∀ a ∈ V, basisGradeProjection ((F.quotientFiltration js).associatedGradedBasis c ν hQ) ν s a = a → + (F.quotientFiltration js).associatedGradedMap Gmark (D.filtration.pivotProductMarkedMap φ F.η js) + hmarked a = 0 → a = 0) + +omit [Fintype κ] in +private theorem assembleQuotientFactors + {qVertical qCommon pProj : ℝ} + (hcommon : F.CommonFactors outer H e ω hF qVertical qCommon) + (hproject : ∀ (theta : ∀ j, (F.native j).L →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (den : ℕ) (H' : Finset Ω), + BasisGradedSubmodule + ((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF) + ω W.toSubmodule → + (∀ j x, x ∈ (optionProduct D (fun j => (F.native j).model)).filtration.realGradedRefiltrationLayer W s → + realifyFunctional ((pairFrequency (F.η j) (theta j)).comp + (optionPairProjection j).toLinearMap) x = 0) → + 0 < den → (den : ℝ) ≤ Real.exp qCommon → + (∀ a ∈ H', (optionProduct D (fun j => (F.native j).model)).filtration.HasCommonRefilteredOrbitFactors + e ω hF (fun i : {i // keep i} => (A.sides i.val : ℝ)) qCommon den W + (F.jointPolynomialOrbit a)) → + F.projectedData js c ν hQ W den H' qCommon pProj) : + F.QuotientFactors outer H js e ω hF c ν hQ qVertical qCommon pProj := by + obtain ⟨theta, W, v, den, H', hsub, hmass, hmassLower, hspan, hgraded, hheightW, + hzero, hden, hdenBound, hfactor⟩ := hcommon + obtain ⟨denQ, hdenQ, hdenQBound, hdiv, hquotient, hquotientGraded, hkernel, hgradedKernel⟩ := + hproject theta W den H' hgraded hzero hden hdenBound hfactor + unfold QuotientFactors + refine ⟨theta, W, v, ?_⟩ + let V : LieSubalgebra ℚ (F.quotientFiltration js).AssociatedGraded := + optionCommonPivotQuotientFast D (fun j => (F.native j).model) φ F.η js W + refine ⟨V, den, denQ, H', ?_⟩ + refine And.intro hsub ?_ + refine And.intro hmass ?_ + refine And.intro hmassLower ?_ + refine And.intro hspan ?_ + refine And.intro hgraded ?_ + refine And.intro hheightW ?_ + refine And.intro hzero ?_ + refine And.intro hden ?_ + refine And.intro hdenBound ?_ + refine And.intro hfactor ?_ + refine And.intro rfl ?_ + refine And.intro hdenQ ?_ + refine And.intro hdenQBound ?_ + refine And.intro hdiv ?_ + exact ⟨hquotient, hquotientGraded, hkernel, hgradedKernel⟩ + +theorem CommonFactors.toQuotientFactors + [Fintype (SymbolBasisIndex (fun _ : {i // keep i} => 1) ω)] + [Fintype (SymbolBasisIndex (fun _ : {i // keep i} => 1) ν)] + {qVertical qCommon pProj : ℝ} + (hcommon : F.CommonFactors outer H e ω hF qVertical qCommon) + {height : ℕ} (hheight : 1 ≤ height) + (hentries : ∀ i j, + RationalHeightLE (c.repr (optionPivotProductQuotientMap D φ F.η js (e j)) i) height) + (hpProj : 0 ≤ pProj) (hqProj : qCommon ≤ pProj) + (hsource : (Fintype.card (SymbolBasisIndex (fun _ : {i // keep i} => 1) ω) : ℝ) ≤ pProj) + (htarget : (Fintype.card (SymbolBasisIndex (fun _ : {i // keep i} => 1) ν) : ℝ) ≤ pProj) + (hheightProj : (height : ℝ) ≤ Real.exp pProj) : + F.QuotientFactors outer H js e ω hF c ν hQ qVertical qCommon pProj := by + apply assembleQuotientFactors F outer H js e ω hF c ν hQ hcommon + intro theta W den H' hgraded hzero hden hdenBound hfactor + have hside (i : {i // keep i}) : (0 : ℝ) < A.sides i.val := + Nat.cast_pos.mpr (A.sides_pos i.val) + have hdenProj : (den : ℝ) ≤ Real.exp pProj := + hdenBound.trans (Real.exp_le_exp.mpr hqProj) + dsimp only [projectedData, quotientFiltration] + exact exists_optionCommonPivotQuotient_family_symbol_factors + D (fun j => (F.native j).model) φ F.η js e ω hF c ν hQ hheight hden hentries hpProj + hsource htarget hheightProj hdenProj W hgraded theta hzero + H' (fun i : {i // keep i} => (A.sides i.val : ℝ)) hside qCommon + F.jointPolynomialOrbit hfactor + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable {α : Type*} [Fintype α] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) + (js : List Pivot) + {dQ : ℕ} + (Q : RationalFilteredNilmanifold (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)) + (adapted : (optionProduct Q (fun j => (F.native j).model)).AdaptedModelData) + +def ActualAdaptedPivotQuotientFactors (qVertical qCommon pProj : ℝ) : Prop := + ∃ (retained : Finset A.Path) (hsub : retained ⊆ H) + (hmass : Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H ≤ A.law.mass retained), + 0 < A.law.mass retained ∧ + ∃ (theta : ∀ j, (F.native j).L →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (v : Fin (Fintype.card α) → + (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (den : ℕ), + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule + ((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF) + ω W.toSubmodule ∧ + (∀ i k, rationalLogHeight + (((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis + e ω hF).repr (v i) k) ≤ qCommon) ∧ + (∀ j x, x ∈ (optionProduct D (fun j => (F.native j).model)).filtration.realGradedRefiltrationLayer W s → + realifyFunctional ((pairFrequency (F.η j) (theta j)).comp + (optionPairProjection j).toLinearMap) x = 0) ∧ + 0 < den ∧ (den : ℝ) ≤ Real.exp qCommon ∧ + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + let F₀ := (optionProduct D (fun j => (F.native j).model)).filtration + let FQ := adapted.model.filtration + let ψ := optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) + let hψ := D.optionQuotientMap_mem_layer + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model) + let V := W.map (F₀.associatedGradedMap FQ ψ hψ) + let vQ := F₀.gradedImageSpanningFamily FQ ψ hψ v + ∃ denQ : ℕ, 0 < denQ ∧ (denQ : ℝ) ≤ Real.exp ((pProj + 2) ^ 4) ∧ den ∣ denQ ∧ + Submodule.span ℚ (Set.range vQ) = V.toSubmodule ∧ + BasisGradedSubmodule + (FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers) + adapted.weight V.toSubmodule ∧ + (∀ a i, rationalLogHeight + ((FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers).repr + (vQ a) i) ≤ (pProj + 2) ^ 4) ∧ + (∀ z : target.productive, + FQ.HasCommonRefilteredOrbitFactors adapted.model.basis adapted.weight adapted.model_layers + (fun i : {i // keep i} => (A.sides i.val : ℝ)) ((pProj + 2) ^ 3 + qCommon) denQ V + ⟨⟨(target.candidate z).orbit.log, (target.candidate z).orbit.property⟩⟩) ∧ + (∀ x ∈ FQ.gradedRefiltrationLayer V s, + optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker) x = 0 → + x = 0) ∧ + (∀ (Gmark : NilpotentLieFiltration + (∀ i : Option Pivot, optionLieSpace LM (fun j => (F.native j).L) i) s) + (hmarked : ∀ k, ∀ x ∈ FQ.layer k, + optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker) x ∈ + Gmark.layer k), + ∀ a ∈ V, + basisGradeProjection + (FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers) + adapted.weight s a = a → + FQ.associatedGradedMap Gmark + (optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) + hmarked a = 0 → a = 0) + +theorem CommonFactors.toActualAdaptedPivotQuotientFactors + {qVertical qCommon pProj : ℝ} + (hcommon : F.CommonFactors A.law H e ω hF qVertical qCommon) + {height : ℕ} + (hentries : ∀ i j, RationalHeightLE + (adapted.basis.repr + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) (e j)) i) height) + (hpProj : 0 ≤ pProj) (hqProj : qCommon ≤ pProj) + (hsource : (Fintype.card α : ℝ) ≤ pProj) + (htarget : (finrank ℚ (∀ i : Option Pivot, + optionLieSpace (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) + (fun j => (F.native j).L) i) : ℝ) ≤ pProj) + (hheight : (height : ℝ) ≤ Real.exp pProj) : + F.ActualAdaptedPivotQuotientFactors H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + qVertical qCommon pProj := by + obtain ⟨retained, hsub, hmass, hpos, theta, W, v, den, hv, hW, hvH, hzero, + hden, hdenBound, hfactor⟩ := + hcommon.exists_actualJointProblem F H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore e ω hF + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + have hproject := source.exists_withKeep_adaptedOptionQuotient_common_factors + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + keep (fun _ => rfl) e ω hF hentries hpProj hsource htarget hheight den hden + (hdenBound.trans (Real.exp_le_exp.mpr hqProj)) W v hv hW + (fun a i => (hvH a i).trans hqProj) hfactor + obtain ⟨denQ, hdenQ, hdenQBound, hdiv, hvQ, hWQ, hvQH, hfactorQ⟩ := hproject + refine ⟨retained, hsub, hmass, hpos, theta, W, v, den, hv, hW, hvH, hzero, + hden, hdenBound, denQ, hdenQ, hdenQBound, hdiv, hvQ, hWQ, hvQH, hfactorQ, ?_, ?_⟩ + · exact optionNativeCommonPivotQuotientFast_top_kernel_eq_zero + D (fun j => (F.native j).model) φ F.η js hker W theta hzero Q hQ + e ω hF adapted.basis adapted.weight adapted.layers hW + · exact optionNativeCommonPivotQuotientFast_graded_top_kernel + D (fun j => (F.native j).model) φ F.η js hker W theta hzero Q hQ + e ω hF adapted.basis adapted.weight adapted.layers hW + +end AllocatedExternalCandidateSpatialNativeFamily + +theorem exists_allocatedExternalCandidateSpatialNativeFamily_actual_adapted_quotient_factors + (s : ℕ) (hs : 1 ≤ s) : + ∃ C Cbasis K T : ℕ, 2 ≤ C ∧ 2 ≤ Cbasis ∧ 2 ≤ K ∧ 2 ≤ T ∧ + ∀ {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + + {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip), + ∀ {qVertical : ℝ}, pNative ≤ qVertical → pLocal + r + 1 ≤ qVertical → + verticalDecompositionBudget qVertical ≤ p → + r + verticalDecompositionBudget qVertical + 2 ≤ p → + ∀ (H : Finset A.Path), 0 < A.law.mass H → + (∀ a ∈ H, ∀ j, Real.exp (-r) ≤ ‖F.correlation a j‖) → + ∀ {α : Type*} [Fintype α] {pGeo bnd : ℝ}, + 0 ≤ pGeo → 0 ≤ bnd → + (∀ j, (pi (pairModels D (F.native j).model)).GeometryComplexityLE pGeo) → + pGeo ≤ bnd → (pGeo + 3) ^ 5 ≤ bnd → + (Fintype.card α : ℝ) ≤ bnd → (Fintype.card Pivot : ℝ) ≤ bnd → + ∀ (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})), + (∀ i j k, rationalLogHeight (e.repr ⁅e i, e j⁆ k) ≤ bnd) → + (∀ i k, rationalLogHeight + ((optionProduct D (fun j => (F.native j).model)).basis.repr (e i) k) ≤ bnd) → + let localCost := allocatedFrozenTaggedPairBudget s C Cbasis pGeo p + let jointCost := allocatedFrozenTaggedFamilyInputBudget bnd localCost + let P := jointCost + (jointCost + K) ^ K + ∀ [Nonempty {i // keep i}], (Fintype.card {i // keep i} : ℝ) ≤ bnd → + (∀ i : {i // keep i}, Real.exp ((p + 2 + C) ^ C + 7 * p + 22) ≤ + (A.sides i.val : ℝ)) → + (∀ i : {i // keep i}, Real.exp ((P + 2) ^ T) ≤ (A.sides i.val : ℝ)) → + let qCommon := (P + 2) ^ T + (((P + 2) ^ 2 + 2) ^ 63 + 1) + P + 1 + ∀ (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + (js : List Pivot) {dQ : ℕ} + (Q : RationalFilteredNilmanifold + (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)) + (adapted : (optionProduct Q (fun j => (F.native j).model)).AdaptedModelData) + {height : ℕ} {pProj : ℝ}, + (∀ i j, RationalHeightLE + (adapted.basis.repr + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) (e j)) i) height) → + 0 ≤ pProj → qCommon ≤ pProj → + (Fintype.card α : ℝ) ≤ pProj → + (finrank ℚ (∀ i : Option Pivot, + optionLieSpace (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) + (fun j => (F.native j).L) i) : ℝ) ≤ pProj → + (height : ℝ) ≤ Real.exp pProj → + F.ActualAdaptedPivotQuotientFactors H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + qVertical qCommon pProj := by + obtain ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, hcommon⟩ := + exists_allocatedExternalCandidateSpatialNativeFamily_common_factors s hs + refine ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, ?_⟩ + intro m G X _ _ I J _ _ n B _ U b R σ S hb o hR hσ N poly hm τ ξ stride cells center + _ A Deck Pivot _ LG LM _ _ _ _ _ _ _ _ d₀ D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip F + qVertical hpq hprecision hfrequency hbudget H hH hcorr + α _ pGeo bnd hpGeo hbnd hGeo hpGeoB hInvB hα hPivot e ω hF hstructure he + localCost jointCost P _ hkeep hlong hcommonLong qCommon + sourceCenter hpath hcenter hfrozen observable weight scoreThreshold hscore + js dQ Q hQ hker descended hrecovery adapted height pProj hentries hpProj hqProj + hsource htarget hheight + have hc : F.CommonFactors A.law H e ω hF qVertical qCommon := + hcommon F hpq hprecision hfrequency hbudget A.law H hH hcorr + hpGeo hbnd hGeo hpGeoB hInvB hα hPivot e ω hF hstructure he hkeep hlong hcommonLong + exact hc.toActualAdaptedPivotQuotientFactors F H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + hentries hpProj hqProj hsource htarget hheight + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + weightedAdaptedRealChartHom realPolynomialGroupMap + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (keepLong : LayerSamplerVariables G I n B → Prop) + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable {α : Type*} [Fintype α] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) + (js : List Pivot) + {dQ : ℕ} + (Q : RationalFilteredNilmanifold (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)) + (adapted : (optionProduct Q (fun j => (F.native j).model)).AdaptedModelData) + +def ActualAdaptedPivotQuotientLongFactors (qVertical qCommon pProj : ℝ) : Prop := + ∃ (retained : Finset A.Path) (hsub : retained ⊆ H) + (hmass : Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H ≤ A.law.mass retained), + 0 < A.law.mass retained ∧ + ∃ (theta : ∀ j, (F.native j).L →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (v : Fin (Fintype.card α) → + (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (den : ℕ), + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule + ((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF) + ω W.toSubmodule ∧ + (∀ i k, rationalLogHeight + (((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis + e ω hF).repr (v i) k) ≤ qCommon) ∧ + (∀ j x, x ∈ (optionProduct D (fun j => (F.native j).model)).filtration.realGradedRefiltrationLayer W s → + realifyFunctional ((pairFrequency (F.η j) (theta j)).comp + (optionPairProjection j).toLinearMap) x = 0) ∧ + 0 < den ∧ (den : ℝ) ≤ Real.exp qCommon ∧ + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + let F₀ := (optionProduct D (fun j => (F.native j).model)).filtration + let FQ := adapted.model.filtration + let ψ := optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) + let hψ := D.optionQuotientMap_mem_layer + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model) + let V := W.map (F₀.associatedGradedMap FQ ψ hψ) + let vQ := F₀.gradedImageSpanningFamily FQ ψ hψ v + ∃ denQ : ℕ, 0 < denQ ∧ (denQ : ℝ) ≤ Real.exp ((pProj + 2) ^ 4) ∧ den ∣ denQ ∧ + Submodule.span ℚ (Set.range vQ) = V.toSubmodule ∧ + BasisGradedSubmodule + (FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers) + adapted.weight V.toSubmodule ∧ + (∀ a i, rationalLogHeight + ((FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers).repr + (vQ a) i) ≤ (pProj + 2) ^ 4) ∧ + (∀ z : target.productive, + FQ.HasCommonRefilteredOrbitFactors adapted.model.basis adapted.weight adapted.model_layers + (fun i : {i // keepLong i} => (A.sides i.val : ℝ)) ((pProj + 2) ^ 3 + qCommon) denQ V + (FQ.weightedAdaptedRealChartHom + (fun _ : {i // keep i} => 1) (fun _ : {i // keepLong i} => 1) + ((target.chart z).axisPolynomial keepLong (fun _ => 0)) + ((target.chart z).axisPolynomial_support keepLong (fun _ => 0)) + (FQ.realification.polynomialOrbitCoordinates (fun _ => 1) + (target.candidate z).orbit))) ∧ + (∀ x ∈ FQ.gradedRefiltrationLayer V s, + optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker) x = 0 → + x = 0) ∧ + (∀ (Gmark : NilpotentLieFiltration + (∀ i : Option Pivot, optionLieSpace LM (fun j => (F.native j).L) i) s) + (hmarked : ∀ k, ∀ x ∈ FQ.layer k, + optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker) x ∈ + Gmark.layer k), + ∀ a ∈ V, + basisGradeProjection + (FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers) + adapted.weight s a = a → + FQ.associatedGradedMap Gmark + (optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) + hmarked a = 0 → a = 0) + +theorem longJointOrbit_polynomialCoordinates (a : A.Path) : + (optionProduct D (fun j => (F.native j).model)).filtration.realification.polynomialOrbitCoordinates + (fun _ : {i // keepLong i} => 1) + (piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.longJointOrbit keepLong a)) = + (optionProduct D (fun j => (F.native j).model)).filtration.weightedAdaptedRealChartHom + (fun _ : {i // keep i} => 1) (fun _ : {i // keepLong i} => 1) + ((F.chart a).axisPolynomial keepLong (fun _ => 0)) + ((F.chart a).axisPolynomial_support keepLong (fun _ => 0)) + ((optionProduct D (fun j => (F.native j).model)).filtration.realification.polynomialOrbitCoordinates + (fun _ : {i // keep i} => 1) + (piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.jointOrbit a))) := + piRealOrbit_polynomialOrbitRealChart_coordinates + (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.jointOrbit a) ((F.chart a).axisPolynomial keepLong (fun _ => 0)) + ((F.chart a).axisPolynomial_support keepLong (fun _ => 0)) + +theorem LongCommonFactors.toActualAdaptedPivotQuotientLongFactors + {qVertical qCommon pProj : ℝ} + (hcommon : F.LongCommonFactors keepLong A.law H e ω hF qVertical qCommon) + {height : ℕ} + (hentries : ∀ i j, RationalHeightLE + (adapted.basis.repr + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) (e j)) i) height) + (hpProj : 0 ≤ pProj) (hqProj : qCommon ≤ pProj) + (hsource : (Fintype.card α : ℝ) ≤ pProj) + (htarget : (finrank ℚ (∀ i : Option Pivot, + optionLieSpace (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) + (fun j => (F.native j).L) i) : ℝ) ≤ pProj) + (hheight : (height : ℝ) ≤ Real.exp pProj) : + F.ActualAdaptedPivotQuotientLongFactors keepLong H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + qVertical qCommon pProj := by + obtain ⟨theta, W, v, den, retained, hsub, hpos, hmass, hv, hW, hvH, hzero, + hden, hdenBound, hfactor⟩ := hcommon + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + let F₀ := (optionProduct D (fun j => (F.native j).model)).filtration + let FQ := adapted.model.filtration + let ψ := optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) + let hψ := D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model) + obtain ⟨denQ, hdenQ, hdenQBound, hdiv, htransport⟩ := + F₀.exists_common_refiltered_mapped_orbit_factors + (σ := {i // keepLong i}) FQ e ω hF + adapted.model.basis adapted.weight adapted.model_layers ψ hψ + hentries hpProj hsource (by simpa only [Fintype.card_fin] using htarget) hheight + den hden (hdenBound.trans (Real.exp_le_exp.mpr hqProj)) + obtain ⟨hvQ, hWQ, hvQH⟩ := + F₀.gradedImage_bounded_spanning FQ ψ hψ e ω hF + adapted.model.basis adapted.weight adapted.model_layers W v hv hW + hpProj hsource (fun a i => (hvH a i).trans hqProj) + (fun i j => rationalLogHeight_le_of_height (hentries j i) hheight) + have hfactorLong (z : source.productive) : + F₀.HasCommonRefilteredOrbitFactors e ω hF + (fun i : {i // keepLong i} => (A.sides i.val : ℝ)) qCommon den W + (F₀.weightedAdaptedRealChartHom + (fun _ : {i // keep i} => 1) (fun _ : {i // keepLong i} => 1) + ((source.chart z).axisPolynomial keepLong (fun _ => 0)) + ((source.chart z).axisPolynomial_support keepLong (fun _ => 0)) + (F₀.realification.polynomialOrbitCoordinates (fun _ => 1) + ((source.optionJoint (fun j => (F.native j).model) + (fun j => ((F.native j).test.fullTaggedSpatial J).orbit)).candidate z).orbit)) := by + have hc := hfactor z.val z.property + change F₀.HasCommonRefilteredOrbitFactors e ω hF + (fun i : {i // keepLong i} => (A.sides i.val : ℝ)) qCommon den W + (F₀.realification.polynomialOrbitCoordinates (fun _ => 1) + (piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.longJointOrbit keepLong z.val))) at hc + rw [F.longJointOrbit_polynomialCoordinates keepLong z.val] at hc + exact hc + refine ⟨retained, hsub, hmass, hpos, theta, W, v, den, hv, hW, hvH, hzero, + hden, hdenBound, denQ, hdenQ, hdenQBound, hdiv, hvQ, hWQ, hvQH, ?_, ?_, ?_⟩ + · intro z + have ht := htransport (fun i => (A.sides i.val : ℝ)) + (fun i => by exact_mod_cast A.sides_pos i.val) qCommon W _ (hfactorLong z) + have he := ((source.withKeep keep (fun _ => rfl)).candidate z).optionJoint_lieQuotient_chart_polynomialCoordinates + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + ((target.chart z).axisPolynomial keepLong (fun _ => 0)) + ((target.chart z).axisPolynomial_support keepLong (fun _ => 0)) + exact Eq.mpr (congrArg + (FQ.HasCommonRefilteredOrbitFactors adapted.model.basis adapted.weight adapted.model_layers + (fun i : {i // keepLong i} => (A.sides i.val : ℝ)) ((pProj + 2) ^ 3 + qCommon) denQ + (W.map (F₀.associatedGradedMap FQ ψ hψ))) he) ht + · exact optionNativeCommonPivotQuotientFast_top_kernel_eq_zero + D (fun j => (F.native j).model) φ F.η js hker W theta hzero Q hQ + e ω hF adapted.basis adapted.weight adapted.layers hW + · exact optionNativeCommonPivotQuotientFast_graded_top_kernel + D (fun j => (F.native j).model) φ F.η js hker W theta hzero Q hQ + e ω hF adapted.basis adapted.weight adapted.layers hW + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + +noncomputable section + +theorem exists_allocatedExternalCandidateSpatialNativeFamily_actual_adapted_long_quotient_factors + (s : ℕ) (hs : 1 ≤ s) : + ∃ C Cbasis K T : ℕ, 2 ≤ C ∧ 2 ≤ Cbasis ∧ 2 ≤ K ∧ 2 ≤ T ∧ + ∀ {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + + {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip), + ∀ {qVertical : ℝ}, pNative ≤ qVertical → pLocal + r + 1 ≤ qVertical → + verticalDecompositionBudget qVertical ≤ p → + r + verticalDecompositionBudget qVertical + 2 ≤ p → + ∀ (H : Finset A.Path), 0 < A.law.mass H → + (∀ a ∈ H, ∀ j, Real.exp (-r) ≤ ‖F.correlation a j‖) → + ∀ {α : Type*} [Fintype α] {pGeo bnd : ℝ}, + 0 ≤ pGeo → 0 ≤ bnd → + (∀ j, (pi (pairModels D (F.native j).model)).GeometryComplexityLE pGeo) → + pGeo ≤ bnd → (pGeo + 3) ^ 5 ≤ bnd → + (Fintype.card α : ℝ) ≤ bnd → (Fintype.card Pivot : ℝ) ≤ bnd → + ∀ (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})), + (∀ i j k, rationalLogHeight (e.repr ⁅e i, e j⁆ k) ≤ bnd) → + (∀ i k, rationalLogHeight + ((optionProduct D (fun j => (F.native j).model)).basis.repr (e i) k) ≤ bnd) → + let localCost := allocatedFrozenTaggedPairBudget s C Cbasis pGeo p + let jointCost := allocatedFrozenTaggedFamilyInputBudget bnd localCost + let P := jointCost + (jointCost + K) ^ K + ∀ (keepLong : LayerSamplerVariables G I n B → Prop), + (∀ i, keepLong i → keep i) → + ∀ [Nonempty {i // keepLong i}], (Fintype.card {i // keepLong i} : ℝ) ≤ bnd → + (∀ i : {i // keepLong i}, Real.exp ((p + 2 + C) ^ C + 7 * p + 22) ≤ + (A.sides i.val : ℝ)) → + (∀ i : {i // keepLong i}, Real.exp ((P + 2) ^ T) ≤ (A.sides i.val : ℝ)) → + let qCommon := (P + 2) ^ T + (((P + 2) ^ 2 + 2) ^ 63 + 1) + P + 1 + ∀ (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + (js : List Pivot) {dQ : ℕ} + (Q : RationalFilteredNilmanifold + (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)) + (adapted : (optionProduct Q (fun j => (F.native j).model)).AdaptedModelData) + {height : ℕ} {pProj : ℝ}, + (∀ i j, RationalHeightLE + (adapted.basis.repr + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) (e j)) i) height) → + 0 ≤ pProj → qCommon ≤ pProj → + (Fintype.card α : ℝ) ≤ pProj → + (finrank ℚ (∀ i : Option Pivot, + optionLieSpace (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) + (fun j => (F.native j).L) i) : ℝ) ≤ pProj → + (height : ℝ) ≤ Real.exp pProj → + F.ActualAdaptedPivotQuotientLongFactors keepLong H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + qVertical qCommon pProj := by + obtain ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, hcommon⟩ := + exists_allocatedExternalCandidateSpatialNativeFamily_long_common_factors s hs + refine ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, ?_⟩ + intro m G X _ _ I J _ _ n B _ U b R σ S hb o hR hσ N poly hm τ ξ stride cells center + _ A Deck Pivot _ LG LM _ _ _ _ _ _ _ _ d₀ D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip F + qVertical hpq hprecision hfrequency hbudget H hH hcorr + α _ pGeo bnd hpGeo hbnd hGeo hpGeoB hInvB hα hPivot e ω hF hstructure he + localCost jointCost P keepLong hLongSub _ hkeep hlong hcommonLong qCommon + sourceCenter hpath hcenter hfrozen observable weight scoreThreshold hscore + js dQ Q hQ hker descended hrecovery adapted height pProj hentries hpProj hqProj + hsource htarget hheight + have hc : F.LongCommonFactors keepLong A.law H e ω hF qVertical qCommon := + hcommon F hpq hprecision hfrequency hbudget A.law H hH hcorr + hpGeo hbnd hGeo hpGeoB hInvB hα hPivot e ω hF hstructure he keepLong hLongSub hkeep hlong hcommonLong + exact hc.toActualAdaptedPivotQuotientLongFactors F keepLong H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + hentries hpProj hqProj hsource htarget hheight + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + +noncomputable section + +theorem exists_allocatedExternalCandidateSpatialNativeFamily_native_long_geometry_factors + (s : ℕ) (hs : 1 ≤ s) : + ∃ Cgeometry C Cbasis K T : ℕ, 2 ≤ Cgeometry ∧ 2 ≤ C ∧ 2 ≤ Cbasis ∧ 2 ≤ K ∧ 2 ≤ T ∧ + ∀ {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + + {Deck : Fin m → Type*} {Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip), + ∀ {qVertical : ℝ}, pNative ≤ qVertical → pLocal + r + 1 ≤ qVertical → + verticalDecompositionBudget qVertical ≤ p → + r + verticalDecompositionBudget qVertical + 2 ≤ p → + ∀ (H : Finset A.Path), 0 < A.law.mass H → + (∀ a ∈ H, ∀ j, Real.exp (-r) ≤ ‖F.correlation a j‖) → + ∀ (pGeometry : ℝ), 2 ≤ pGeometry → D.GeometryComplexityLE pGeometry → + pNative ≤ pGeometry → (Fintype.card Pivot : ℝ) ≤ pGeometry → + ∀ (js : List Pivot) {dQ : ℕ} + (Q : RationalFilteredNilmanifold + (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0), + Q.GeometryComplexityLE pGeometry → + (∀ i j, rationalLogHeight + (Q.basis.repr (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (D.basis j)) i) ≤ pGeometry) → + let pGeo := (pGeometry + 2) ^ 2 + let jointGeo := (pGeometry + 3) ^ 2 + let adaptedBudget := (jointGeo + 2) ^ Cgeometry + let bnd := adaptedBudget + (pGeo + 3) ^ 5 + pGeo + jointGeo + pGeometry + p + 2 + let localCost := allocatedFrozenTaggedPairBudget s C Cbasis pGeo p + let jointCost := allocatedFrozenTaggedFamilyInputBudget bnd localCost + let P := jointCost + (jointCost + K) ^ K + ∀ (keepLong : LayerSamplerVariables G I n B → Prop) + (_hLongSub : ∀ i, keepLong i → keep i) [Nonempty {i // keepLong i}], + (∀ i : {i // keepLong i}, Real.exp ((p + 2 + C) ^ C + 7 * p + 22) ≤ + (A.sides i.val : ℝ)) → + (∀ i : {i // keepLong i}, Real.exp ((P + 2) ^ T) ≤ (A.sides i.val : ℝ)) → + let qCommon := (P + 2) ^ T + (((P + 2) ^ 2 + 2) ^ 63 + 1) + P + 1 + let pProj := max qCommon 0 + adaptedBudget + 1 + ∀ (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)), + ∃ geometry : (optionProduct D (fun j => (F.native j).model)).AdaptedMapGeometryData + (optionProduct Q (fun j => (F.native j).model)) + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) + jointGeo adaptedBudget, + F.ActualAdaptedPivotQuotientLongFactors keepLong H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore geometry.source.basis geometry.source.weight geometry.source.layers + js Q hQ hker descended hrecovery geometry.target qVertical qCommon pProj := by + obtain ⟨Cgeometry, hCgeometry, hgeometry⟩ := exists_native_adapted_map_geometry + obtain ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, hfactor⟩ := + exists_allocatedExternalCandidateSpatialNativeFamily_actual_adapted_long_quotient_factors s hs + refine ⟨Cgeometry, C, Cbasis, K, T, hCgeometry, hC, hCbasis, hK, hT, ?_⟩ + intro m G X _ _ I J _ _ n B _ U b R σ S hb o hR hσ N poly hm τ ξ stride cells center + _ A Deck Pivot _ LG LM _ _ _ _ _ _ _ _ d₀ D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip F + qVertical hpq hprecision hfrequency hbudget H hH hcorr + pGeometry hpGeometry hD hpNative hPivot js dQ Q hQ hker hQGeometry hmap + pGeo jointGeo adaptedBudget bnd localCost jointCost P keepLong hLongSub _ hlong hcommonLong qCommon pProj + sourceCenter hpath hcenter hfrozen observable weight scoreThreshold hscore descended hrecovery + have hpGeometry0 : 0 ≤ pGeometry := (by norm_num : (0 : ℝ) ≤ 2).trans hpGeometry + have hnative (j : Pivot) : (F.native j).model.GeometryComplexityLE pGeometry := + (F.native j).complexity.1.mono (F.native j).model hpNative + have hpGeo : 0 ≤ pGeo := by dsimp [pGeo]; positivity + have hjointGeo : 0 ≤ jointGeo := by dsimp [jointGeo]; positivity + have hGeometryJoint : pGeometry ≤ jointGeo := by dsimp [jointGeo]; nlinarith + have hsourceGeo := optionProduct_geometry D (fun j => (F.native j).model) + hpGeometry0 hPivot hD hnative + have htargetGeo := optionProduct_geometry Q (fun j => (F.native j).model) + hpGeometry0 hPivot hQGeometry hnative + have hmapJoint := optionMarkedLieMap_native_logHeight D Q + (fun j => (F.native j).model) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) hpGeometry0 hmap + obtain ⟨geometry⟩ := hgeometry + (optionProduct D (fun j => (F.native j).model)) + (optionProduct Q (fun j => (F.native j).model)) + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) + hjointGeo hsourceGeo htargetGeo (fun i j => (hmapJoint j i).trans hGeometryJoint) + refine ⟨geometry, ?_⟩ + have hpair (j : Pivot) : (pi (pairModels D (F.native j).model)).GeometryComplexityLE pGeo := by + apply pi_geometry _ hpGeometry0 + · simpa only [Fintype.card_bool, Nat.cast_ofNat] using hpGeometry + · intro k + cases k + · exact hnative j + · exact hD + have hadapted : 0 ≤ adaptedBudget := geometry.budget_nonneg + have hpow : 0 ≤ (pGeo + 3) ^ 5 := by positivity + have hbnd : 0 ≤ bnd := by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp] + have habnd : adaptedBudget ≤ bnd := by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp] + have hpbnd : p ≤ bnd := by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0] + have hgbnd : jointGeo + 1 ≤ bnd := by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp] + have hLongCard : (Fintype.card {i // keepLong i} : ℝ) ≤ p := by + have hcard : Fintype.card {i // keepLong i} ≤ Fintype.card {i // keep i} := + Fintype.card_le_of_injective + (fun i : {i // keepLong i} => (⟨i.val, hLongSub i.val i.property⟩ : {i // keep i})) + (fun _ _ h => Subtype.ext (congrArg (fun i : {i // keep i} => i.val) h)) + exact (Nat.cast_le.mpr hcard).trans F.hK + have hsourceDim : (Fintype.card (Fin (finrank ℚ + (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i))) : ℝ) ≤ bnd := by + simpa only [Fintype.card_fin] using geometry.source_dimension.trans (by linarith only [hgbnd] : jointGeo ≤ bnd) + have hProj : 0 ≤ pProj := + add_nonneg (add_nonneg (le_max_right qCommon 0) hadapted) zero_le_one + have hqProj : qCommon ≤ pProj := + (le_max_left qCommon 0).trans + ((le_add_of_nonneg_right hadapted).trans (le_add_of_nonneg_right zero_le_one)) + have haProj : adaptedBudget ≤ pProj := + (le_add_of_nonneg_left (le_max_right qCommon 0)).trans + (le_add_of_nonneg_right zero_le_one) + have hJointProj : jointGeo ≤ pProj := + (le_add_of_nonneg_right (zero_le_one : (0 : ℝ) ≤ 1)).trans + (geometry.forward_budget.trans haProj) + exact hfactor F hpq hprecision hfrequency hbudget H hH hcorr + (α := Fin (finrank ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i))) + (pGeo := pGeo) (bnd := bnd) hpGeo hbnd hpair + (by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp]) + (by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp]) hsourceDim + (hPivot.trans (by dsimp only [bnd]; linarith only [hadapted, hpow, hpGeo, hjointGeo, hpGeometry0, F.hp])) + geometry.source.basis geometry.source.weight geometry.source.layers + (fun i j k => (geometry.source_structure i j k).trans habnd) + (fun i k => (geometry.source_forward i k).trans hgbnd) + keepLong hLongSub (hLongCard.trans hpbnd) hlong hcommonLong + sourceCenter hpath hcenter hfrozen observable weight scoreThreshold hscore + js Q hQ hker descended hrecovery geometry.target + (height := geometry.entries_height) (pProj := pProj) geometry.entries hProj hqProj + (by simpa only [Fintype.card_fin] using geometry.source_dimension.trans hJointProj) + (geometry.target_dimension.trans hJointProj) + (geometry.entries_bound.trans (Real.exp_le_exp.mpr haProj)) + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac0814f5b5c6cd71c44a8d01c8f5313a2e6e2bf6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeBudget.lean @@ -0,0 +1,875 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalCandidatePrecenterNativePartners +import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalCandidateTaggedSourceEvaluation +import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalRetainedResidual +import OAI.Combinatorics.Progressions.Probability.NativeSliceLawVerticalPartners + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +def spatialNativeVerticalParameter (pNative pLocal r : ℝ) : ℝ := + max pNative 0 + pLocal + r + 1 + +def spatialNativeFactorParameter (p pNative pLocal r : ℝ) : ℝ := + max p (r + verticalDecompositionBudget (spatialNativeVerticalParameter pNative pLocal r) + 2) + +theorem spatialNativeVerticalFactorBounds (p pNative pLocal r : ℝ) + (hlocal : 0 ≤ pLocal) (hr : 0 ≤ r) : + 0 ≤ spatialNativeVerticalParameter pNative pLocal r ∧ + pNative ≤ spatialNativeVerticalParameter pNative pLocal r ∧ + pLocal + r + 1 ≤ spatialNativeVerticalParameter pNative pLocal r ∧ + p ≤ spatialNativeFactorParameter p pNative pLocal r ∧ + 0 ≤ spatialNativeFactorParameter p pNative pLocal r ∧ + verticalDecompositionBudget (spatialNativeVerticalParameter pNative pLocal r) ≤ + spatialNativeFactorParameter p pNative pLocal r ∧ + r + verticalDecompositionBudget (spatialNativeVerticalParameter pNative pLocal r) + 2 ≤ + spatialNativeFactorParameter p pNative pLocal r := by + have hmax0 : 0 ≤ max pNative 0 := le_max_right _ _ + have hmax : pNative ≤ max pNative 0 := le_max_left _ _ + have hvertical : 0 ≤ spatialNativeVerticalParameter pNative pLocal r := by + unfold spatialNativeVerticalParameter + linarith only [hmax0, hlocal, hr] + have hdecomp := verticalDecompositionBudget_nonneg hvertical + have hright : r + verticalDecompositionBudget + (spatialNativeVerticalParameter pNative pLocal r) + 2 ≤ + spatialNativeFactorParameter p pNative pLocal r := le_max_right _ _ + refine ⟨hvertical, ?_, ?_, le_max_left _ _, ?_, ?_, hright⟩ + · unfold spatialNativeVerticalParameter + linarith only [hmax, hlocal, hr] + · unfold spatialNativeVerticalParameter + linarith only [hmax0] + · exact (by linarith only [hr, hdecomp] : + 0 ≤ r + verticalDecompositionBudget + (spatialNativeVerticalParameter pNative pLocal r) + 2).trans hright + · exact (by linarith only [hr] : + verticalDecompositionBudget (spatialNativeVerticalParameter pNative pLocal r) ≤ + r + verticalDecompositionBudget + (spatialNativeVerticalParameter pNative pLocal r) + 2).trans hright + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +variable {m : ℕ} {X : Type*} (J : Fin m → Type*) + +noncomputable def fullTaggedSpatialIntegerChart (x : X) : MvPolynomial (X ⊕ (Σ j, J j)) ℤ := + MvPolynomial.X (Sum.inl x) + +theorem fullTaggedSpatialIntegerChart_support (x : X) : + integerSampledRealChart (fullTaggedSpatialIntegerChart (X := X) J) x ∈ + weightedSupportLE (fullTaggedVariableWeight J) 1 := by + change MvPolynomial.map (Int.castRingHom ℝ) (MvPolynomial.X (Sum.inl x)) ∈ _ + rw [MvPolynomial.map_X] + exact weightedSupportLE_X (fullTaggedVariableWeight J) (Sum.inl x) + +end Erdos3.VectorPolynomial + +namespace Erdos3.RationalFilteredNilmanifold.Niltest + +open VectorPolynomial +open scoped TensorProduct + +variable {m : ℕ} {X L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {D : RationalFilteredNilmanifold L s d} + (Q : D.Niltest (fun _ : X => 1)) (J : Fin m → Type*) + +noncomputable def fullTaggedSpatial : D.Niltest (fullTaggedVariableWeight (X := X) J) := + Q.integerChartPullback (fullTaggedVariableWeight J) (fullTaggedSpatialIntegerChart J) + (fullTaggedSpatialIntegerChart_support J) + +@[simp] theorem fullTaggedSpatial_eval (u : X ⊕ (Σ j, J j) → ℤ) : + (Q.fullTaggedSpatial J).eval u = Q.eval (fun x => u (Sum.inl x)) := by + rw [fullTaggedSpatial, integerChartPullback_eval] + simp only [fullTaggedSpatialIntegerChart, MvPolynomial.eval_X] + +@[simp] theorem fullTaggedSpatial_eval_physical + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (c : ∀ j, J j → ℝ) + (u : X → ℤ) : + (Q.fullTaggedSpatial J).eval (fullTaggedPhysicalIntegerPoint J poly c u) = Q.eval u := by + rw [fullTaggedSpatial_eval] + rfl + +@[simp] theorem fullTaggedSpatial_normBound : + (Q.fullTaggedSpatial J).normBound = Q.normBound := rfl + +@[simp] theorem fullTaggedSpatial_complexity (p : ℝ) : + (Q.fullTaggedSpatial J).ComplexityLE p ↔ Q.ComplexityLE p := Iff.rfl + +end Erdos3.RationalFilteredNilmanifold.Niltest + +namespace Erdos3.NativeSampleModel + +open VectorPolynomial +open scoped TensorProduct + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +variable {m s : ℕ} {X T : Type*} {p : ℝ} + {sample : T → X → ℤ} {f : T → ℂ} + (Q : NativeSampleModel (fun _ : X => 1) s p sample f) + (J : Fin m → Type*) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + +noncomputable def fullTaggedSpatial (c : ∀ j, J j → ℝ) : + NativeSampleModel (fullTaggedVariableWeight J) s p + (fun t => fullTaggedPhysicalIntegerPoint J poly c (sample t)) f where + L := Q.L + dim := Q.dim + model := Q.model + test := Q.test.fullTaggedSpatial J + norm := Q.norm + complexity := Q.complexity + eval t := by + rw [RationalFilteredNilmanifold.Niltest.fullTaggedSpatial_eval_physical] + exact Q.eval t + +theorem fullTaggedSpatial_test_independent (c c' : ∀ j, J j → ℝ) : + (Q.fullTaggedSpatial J poly c).test = (Q.fullTaggedSpatial J poly c').test := rfl + +theorem fullTaggedSpatial_orbit_independent (c c' : ∀ j, J j → ℝ) : + (Q.fullTaggedSpatial J poly c).test.orbit = + (Q.fullTaggedSpatial J poly c').test.orbit := rfl + +end Erdos3.NativeSampleModel + +end + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold VectorPolynomial CircleFourier +open scoped TensorProduct BigOperators Classical + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +theorem exists_spatialNative_slice_tagged_vertical_partners + {Ω Pivot K X T LG : Type*} [Fintype Ω] [Fintype Pivot] [Fintype K] [DecidableEq K] + [LieRing LG] [LieAlgebra ℚ LG] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {m s d : ℕ} (J : Fin m → Type*) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (D : RationalFilteredNilmanifold LG s d) + {pNative : ℝ} (sample : T → X → ℤ) + (nativeValue : Pivot → T → ℂ) + (native : ∀ j, NativeSampleModel (fun _ : X => 1) s pNative sample (nativeValue j)) + (P : Ω → Pivot → D.Niltest (fun _ : K => 1)) + (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) (hH : 0 < outer.mass H) + {N : K → ℕ} (stride : Ω → Pivot → ℕ) + (S : ∀ a j, ResidueBoxSlice N (stride a j)) + (hstride : ∀ a ∈ H, ∀ j, 0 < stride a j) + (hlen : ∀ a j i, 0 < (S a j).length i) + (physical : Ω → integerBox N → T) + (center : Ω → ∀ j, J j → ℝ) + (twist : Ω → Pivot → integerBox N → ℂ) + {pLocal r q : ℝ} (hpLocal : 0 ≤ pLocal) (hr : 0 ≤ r) (hpq : pNative ≤ q) + (hprecision : pLocal + r + 1 ≤ q) + (hP : ∀ a ∈ H, ∀ j, (P a j).ComplexityLE pLocal) + (htwist : ∀ a ∈ H, ∀ j t, ‖twist a j t‖ ≤ 1) + (hcorr : ∀ a ∈ H, ∀ j, Real.exp (-r) ≤ + ‖((S a j).fullSliceLaw (hlen a j)).complexMean (fun t => + (star (twist a j t) * nativeValue j (physical a t)) * (P a j).eval t.val)‖) : + ∃ (freq : ∀ j, (native j).L →ₗ[ℚ] ℚ) + (V : ∀ j, (native j).model.Niltest (fullTaggedVariableWeight (X := X) J)) + (retained : Finset Ω), + retained ⊆ H ∧ 0 < outer.mass retained ∧ + Real.exp (-verticalDecompositionBudget q * Fintype.card Pivot) * outer.mass H ≤ + outer.mass retained ∧ + (∀ j, (V j).orbit = ((native j).test.fullTaggedSpatial J).orbit ∧ + (V j).ComplexityLE pNative ∧ (V j).normBound ≤ 1) ∧ + (∀ j i, rationalLogHeight (freq j ((native j).model.basis i)) ≤ + verticalDecompositionBudget q) ∧ + (∀ j z, z ∈ (native j).model.filtration.realification.subgroup s → ∀ x, + (V j).observable (z • x) = character + ((realifyFunctional (freq j) z.coord : ℝ) : CircleFourier.Circle) * (V j).observable x) ∧ + ∀ a ∈ retained, ∀ j, + Real.exp (-r) / (2 * Real.exp (verticalDecompositionBudget q)) ≤ + ‖((S a j).fullSliceLaw (hlen a j)).complexMean (fun t => + star (twist a j t) * ((P a j).eval t.val * + (V j).eval (fullTaggedPhysicalIntegerPoint J poly (center a) + (sample (physical a t)))))‖ := by + have hnativeCorr (a : Ω) (ha : a ∈ H) (j : Pivot) : + Real.exp (-r) ≤ ‖((S a j).fullSliceLaw (hlen a j)).complexMean (fun t => + ((P a j).eval t.val * star (twist a j t)) * + (native j).test.eval (sample (physical a t)))‖ := by + convert hcorr a ha j using 2 + congr 1 + funext t + rw [(native j).eval] + ring + obtain ⟨freq, V, retained, hsub, hpos, hmass, hcert, hheight, hvert, _hint, + _hpres, hselected⟩ := exists_sliceLaw_localPivot_weighted_native_vertical_partners + (fun j => (native j).model) (fun _ _ => D) (fun j => (native j).test) P + outer H hH stride S hstride hlen (fun a t => sample (physical a t)) (fun _ _ t => t.val) + (fun a j t => star (twist a j t)) hpLocal hr hpq hprecision + (fun j => (native j).complexity) (fun j => by exact_mod_cast (native j).norm) + hP (fun a ha j t => by simpa only [norm_star] using htwist a ha j t) hnativeCorr + refine ⟨freq, (fun j => (V j).fullTaggedSpatial J), retained, + hsub, hpos, hmass, ?_, hheight, hvert, ?_⟩ + · intro j + refine ⟨?_, (hcert j).1, ?_⟩ + · simp only [Niltest.fullTaggedSpatial, Niltest.integerChartPullback, + Niltest.withOrbit, (hcert j).2.1] + · exact_mod_cast (hcert j).2.2.2.2 + · intro a ha j + convert hselected a ha j using 2 + congr 1 + funext t + rw [Niltest.fullTaggedSpatial_eval_physical] + ring + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +structure AllocatedExternalCandidateSpatialNativeFamily + (Deck : Fin m → Type*) (Ω Pivot : Type*) [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ t : ℕ} + (D : RationalFilteredNilmanifold LG s d₀) + (Fmark : NilpotentLieFiltration LM t) (φ : LG →ₗ⁅ℚ⁆ LM) + (marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)) + (keep : LayerSamplerVariables G I n B → Prop) + (cost p pLocal pNative r periodCap coverCap : ℝ) (Lip : ℝ≥0) where + hpoly : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j) + hτ1 : τ ≤ 1 + hξ : ξ ≤ 1 + hσ1 : ∀ j, σ j ≤ 1 + Cgeo : Fin m → ℝ + hCgeo : ∀ j, 0 ≤ Cgeo j + hchart : ∀ j x, + ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cgeo j * ‖x‖ + hsmall : ∀ j, Cgeo j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ 1 / 8 + sourceChart : Ω → AllocatedExternalLocalChart (E := Deck) A cost + keep_eq : ∀ a, (sourceChart a).keep = keep + sourceCandidate : ∀ a, AllocatedExternalLocalCandidate (sourceChart a) D Fmark φ marked + reference : Ω → Pivot → D.Niltest (fullTaggedVariableWeight (X := X) J) + nativeValue : Pivot → integerBox N → ℂ + native : ∀ j, NativeSampleModel (fun _ : X => 1) s pNative + (fun x : integerBox N => x.val) (nativeValue j) + twist : Ω → Pivot → NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip + hp : 0 ≤ p + hpLocal : 0 ≤ pLocal + hr : 0 ≤ r + hcost : cost ≤ p + hlocal : pLocal ≤ p + hnative : pNative ≤ p + hperiod : ∀ a j, (((twist a j).modulus * (twist a j).cover : ℕ) : ℝ) ≤ Real.exp p + hvariation : (Lip : ℝ) * (1 + (m : ℝ) * (((m + 1 : ℕ) : ℝ) * + ((Fintype.card (LayerSamplerVariables G I n B) + 1 : ℕ) : ℝ) ^ m)) ≤ Real.exp p + hV : ∀ a j, (reference a j).ComplexityLE pLocal + η : Pivot → LG →ₗ[ℚ] ℚ + hηheight : ∀ j i, rationalLogHeight (η j (D.basis i)) ≤ p + hη : ∀ a j z, z ∈ D.filtration.realification.subgroup s → ∀ x, + (reference a j).observable (z • x) = CircleFourier.character + ((realifyFunctional (η j) z.coord : ℝ) : CircleFourier.Circle) * (reference a j).observable x + hK : (Fintype.card {i // keep i} : ℝ) ≤ p + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {A} {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + +def chart (a : Ω) : AllocatedExternalLocalChart (E := Deck) A cost := + (F.sourceChart a).withKeep keep (F.keep_eq a) + +def candidate (a : Ω) : AllocatedExternalLocalCandidate (F.chart a) D Fmark φ marked := + (F.sourceCandidate a).withKeep keep (F.keep_eq a) + +def localTest (a : Ω) (j : Pivot) : D.Niltest (fun _ : {i // keep i} => 1) := + (F.reference a j).withOrbit (F.candidate a).orbit + +def jointOrbit (a : Ω) : ∀ i : Option Pivot, + (optionFactors D (fun j => (F.native j).model) i).filtration.realification.PolynomialOrbit + (fun _ : {i // keep i} => 1) + | none => (F.candidate a).orbit + | some j => (((F.native j).test.fullTaggedSpatial J).integerChartPullback + (fun _ : {i // keep i} => 1) + (F.chart a).integerChart (F.chart a).integerChart_support).orbit + +def physicalBox (a : Ω) (u : integerBox (fun i : {i // keep i} => A.sides i.val)) : + integerBox N := + ⟨A.physical (F.chart a).path ((F.chart a).site u.val u.property), + A.physical_mem_integerBox F.hξ _ _⟩ + +@[simp] theorem physicalBox_val (a : Ω) + (u : integerBox (fun i : {i // keep i} => A.sides i.val)) : + (F.physicalBox a u).val = (F.chart a).physical u.val := rfl + +def sitePhysicalBox (a : Ω) (site : A.Site) : integerBox N := + ⟨A.physical (F.sourceChart a).path site, + A.physical_mem_integerBox F.hξ _ _⟩ + +def correlation (a : Ω) (j : Pivot) : ℂ := + (F.sourceChart a).localLaw.complexMean (fun site => + star ((F.twist a j).eval N poly (F.sitePhysicalBox a site).val) * + ((F.reference a j).observable ((F.sourceCandidate a).siteValue site) * + F.nativeValue j (F.sitePhysicalBox a site))) + +@[simp] theorem chart_localLaw (a : Ω) : + (F.chart a).localLaw = (F.sourceChart a).localLaw := + (F.sourceChart a).withKeep_localLaw A keep (F.keep_eq a) + +theorem rawCorrelation_fullSliceLaw (a : Ω) (j : Pivot) + (hcorr : Real.exp (-r) ≤ ‖F.correlation a j‖) : + Real.exp (-r) ≤ + ‖((F.chart a).slice.fullSliceLaw + ((F.chart a).slice.length_pos_of_dense (F.chart a).dense)).complexMean (fun u => + (star ((F.twist a j).eval N poly (F.physicalBox a u).val) * + F.nativeValue j (F.physicalBox a u)) * (F.localTest a j).eval u.val)‖ := by + have hm := (F.chart a).localLaw_complexMean_eq_fullSliceLaw_site (fun site => + star ((F.twist a j).eval N poly (F.sitePhysicalBox a site).val) * + ((F.reference a j).observable ((F.sourceCandidate a).siteValue site) * + F.nativeValue j (F.sitePhysicalBox a site))) + rw [F.chart_localLaw] at hm + unfold correlation at hcorr + rw [hm] at hcorr + convert hcorr using 2 + congr 1 + funext u + have hv : (F.sourceCandidate a).siteValue ((F.chart a).site u.val u.property) = + (F.candidate a).value u.val := by + rw [← (F.sourceCandidate a).withKeep_siteValue keep (F.keep_eq a)] + change (F.candidate a).value + ((F.chart a).retainedParameter ((F.chart a).parameter u.val)) = _ + rw [(F.chart a).retainedParameter_parameter] + simp only [localTest, hv] + change (star ((F.twist a j).eval N poly (F.physicalBox a u).val) * + F.nativeValue j (F.physicalBox a u)) * + (F.reference a j).observable ((F.candidate a).value u.val) = + star ((F.twist a j).eval N poly (F.physicalBox a u).val) * + ((F.reference a j).observable ((F.candidate a).value u.val) * + F.nativeValue j (F.physicalBox a u)) + ring + +theorem selectedCorrelation_localLaw + (V : ∀ j, (F.native j).model.Niltest (fullTaggedVariableWeight (X := X) J)) + (a : Ω) (j : Pivot) + (hcorr : Real.exp (-p) ≤ + ‖((F.chart a).slice.fullSliceLaw + ((F.chart a).slice.length_pos_of_dense (F.chart a).dense)).complexMean (fun u => + star ((F.twist a j).eval N poly (F.physicalBox a u).val) * + ((F.localTest a j).eval u.val * + (V j).eval (fullTaggedPhysicalIntegerPoint J poly + (fun k => ((F.chart a).centerLift k).val) (F.physicalBox a u).val)))‖) : + Real.exp (-p) ≤ ‖(F.sourceChart a).localLaw.complexMean (fun site => + star ((F.twist a j).eval N poly (A.physical (F.sourceChart a).path site)) * + ((F.reference a j).observable + ((F.candidate a).value ((F.chart a).retainedParameter site.val)) * + (V j).eval (fullTaggedPhysicalIntegerPoint J poly + (fun k => ((F.sourceChart a).centerLift k).val) + (A.physical (F.sourceChart a).path site))))‖ := by + have hm := (F.chart a).localLaw_complexMean_eq_fullSliceLaw_site (fun site => + star ((F.twist a j).eval N poly (A.physical (F.sourceChart a).path site)) * + ((F.reference a j).observable + ((F.candidate a).value ((F.chart a).retainedParameter site.val)) * + (V j).eval (fullTaggedPhysicalIntegerPoint J poly + (fun k => ((F.sourceChart a).centerLift k).val) + (A.physical (F.sourceChart a).path site)))) + rw [F.chart_localLaw] at hm + rw [hm] + convert hcorr using 2 + congr 1 + funext u + change star ((F.twist a j).eval N poly (F.physicalBox a u).val) * + ((F.reference a j).observable + ((F.candidate a).value ((F.chart a).retainedParameter ((F.chart a).parameter u.val))) * + (V j).eval (fullTaggedPhysicalIntegerPoint J poly + (fun k => ((F.chart a).centerLift k).val) (F.physicalBox a u).val)) = _ + rw [(F.chart a).retainedParameter_parameter] + rfl + +theorem exp_correlation_bound {q : ℝ} + (hbudget : r + verticalDecompositionBudget q + 2 ≤ p) : + Real.exp (-p) ≤ Real.exp (-r) / (2 * Real.exp (verticalDecompositionBudget q)) := by + apply (Real.exp_le_exp.mpr (neg_le_neg hbudget)).trans + apply (le_div_iff₀ (by positivity)).mpr + have he : Real.exp (-(r + verticalDecompositionBudget q + 2)) * + (2 * Real.exp (verticalDecompositionBudget q)) = 2 * Real.exp (-r - 2) := by + rw [mul_left_comm, ← Real.exp_add] + congr 2 + ring + rw [he] + have htwo : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + calc + _ ≤ Real.exp 2 * Real.exp (-r - 2) := + mul_le_mul_of_nonneg_right htwo (Real.exp_pos _).le + _ = Real.exp (-r) := by rw [← Real.exp_add]; congr 1; ring + +theorem exists_taggedPairFamily [Fintype Ω] + (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) (hH : 0 < outer.mass H) + {q : ℝ} (hpq : pNative ≤ q) (hprecision : pLocal + r + 1 ≤ q) + (hfrequency : verticalDecompositionBudget q ≤ p) + (hbudget : r + verticalDecompositionBudget q + 2 ≤ p) + (hcorr : ∀ a ∈ H, ∀ j, Real.exp (-r) ≤ ‖F.correlation a j‖) : + ∃ (retained : Finset Ω), + retained ⊆ H ∧ 0 < outer.mass retained ∧ + Real.exp (-verticalDecompositionBudget q * Fintype.card Pivot) * outer.mass H ≤ + outer.mass retained ∧ + ∃ selectedFamily : AllocatedExternalCandidateTaggedPairFamily A Deck + {a // a ∈ retained} Pivot D (fun j => (F.native j).model) Fmark φ marked + keep cost p periodCap coverCap Lip, + (∀ a, selectedFamily.sourceChart a = F.sourceChart a.val) ∧ + (∀ a, HEq (selectedFamily.sourceCandidate a) (F.sourceCandidate a.val)) ∧ + selectedFamily.reference = (fun a => F.reference a.val) ∧ + selectedFamily.twist = (fun a => F.twist a.val) ∧ + selectedFamily.η = F.η ∧ + (∀ j, selectedFamily.ambient j = (F.native j).test.fullTaggedSpatial J) ∧ + ∀ a, selectedFamily.jointOrbit a = F.jointOrbit a.val := by + classical + have hfull (a : Ω) (ha : a ∈ H) (j : Pivot) : + Real.exp (-r) ≤ + ‖((F.chart a).slice.fullSliceLaw + ((F.chart a).slice.length_pos_of_dense (F.chart a).dense)).complexMean (fun u => + (star ((F.twist a j).eval N poly (F.physicalBox a u).val) * + F.nativeValue j (F.physicalBox a u)) * (F.localTest a j).eval u.val)‖ := by + exact F.rawCorrelation_fullSliceLaw a j (hcorr a ha j) + obtain ⟨freq, V, retained, hsub, hpos, hmass, hcert, hheight, hvert, hselected⟩ := + exists_spatialNative_slice_tagged_vertical_partners + (Ω := Ω) (Pivot := Pivot) (K := {i // keep i}) + (N := fun i : {i // keep i} => A.sides i.val) + (pNative := pNative) (pLocal := pLocal) (r := r) (q := q) J poly D + (fun x : integerBox N => x.val) F.nativeValue F.native F.localTest outer H hH + (fun a _ => (F.chart a).step) (fun a _ => (F.chart a).slice) + (fun a _ _ => (F.chart a).step_pos) + (fun a _ i => (F.chart a).slice.length_pos_of_dense (F.chart a).dense i) + F.physicalBox (fun a k => ((F.chart a).centerLift k).val) + (fun a j u => (F.twist a j).eval N poly (F.physicalBox a u).val) + F.hpLocal F.hr hpq hprecision + (fun a _ j => F.hV a j) + (fun a _ j u => (F.twist a j).norm_eval_le N poly _) hfull + let selectedFamily : AllocatedExternalCandidateTaggedPairFamily A Deck + {a // a ∈ retained} Pivot D (fun j => (F.native j).model) Fmark φ marked + keep cost p periodCap coverCap Lip := { + hpoly := F.hpoly + hτ1 := F.hτ1 + hξ := F.hξ + hσ1 := F.hσ1 + Cgeo := F.Cgeo + hCgeo := F.hCgeo + hchart := F.hchart + hsmall := F.hsmall + sourceChart := fun a => F.sourceChart a.val + keep_eq := fun a => F.keep_eq a.val + sourceCandidate := fun a => F.sourceCandidate a.val + reference := fun a => F.reference a.val + ambient := fun j => (F.native j).test.fullTaggedSpatial J + selected := V + selected_orbit := fun j => (hcert j).1 + twist := fun a => F.twist a.val + hp := F.hp + hcost := F.hcost + hperiod := fun a => F.hperiod a.val + hvariation := F.hvariation + hV := fun a j => (F.hV a.val j).mono F.hlocal + hW := fun j => (hcert j).2.1.mono F.hnative + hWnorm := fun j => (hcert j).2.2 + η := F.η + θ := freq + hηheight := F.hηheight + hθheight := fun j i => (hheight j i).trans hfrequency + hη := fun a => F.hη a.val + hθ := hvert + hK := F.hK + hcorr := by + intro a j + exact F.selectedCorrelation_localLaw V a.val j + ((exp_correlation_bound hbudget).trans (hselected a.val a.property j)) } + exact ⟨retained, hsub, hpos, hmass, selectedFamily, + (fun _ => rfl), (fun _ => HEq.rfl), rfl, rfl, rfl, (fun _ => rfl), (fun _ => rfl)⟩ + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule MeasureTheory BooleanCubeKernel NilpotentLieFiltration +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +noncomputable section + +variable {m : ℕ} {G X : Type} [Fintype G] [Fintype X] + {I Deck J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +namespace AllocatedExternalCandidateSampler + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {Ω Freq Bin : Type} [Fintype Ω] [Fintype Bin] [Nonempty Bin] + {LG LM : Type} [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d t rank : ℕ} (D : RationalFilteredNilmanifold LG s d) + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {cost : ℝ} (C : Ω → AllocatedExternalLocalChart (E := Deck) A cost) + (candidate : ∀ a, AllocatedExternalLocalCandidate (C a) D Fmark φ marked) + (hξ1 : ξ ≤ 1) + +theorem exists_precenter_spatial_native_family + (external : Freq → integerBox N → D.Niltest (fullTaggedVariableWeight (X := X) J)) + (representative : Bin → integerBox N) + (eta : Freq → LG →ₗ[ℚ] ℚ) + {p pLocal pNative r inputBound ε δ coefficientBound termBound residualBound : ℝ} + (hcomplex : ∀ f x, (external f x).ComplexityLE pLocal) + (hnet : ∀ f x, ∃ i, ∀ y, ‖(external f x).observable y - + (external f (representative i)).observable y‖ ≤ ε) + (input : integerBox N → ℂ) + (models : (Freq × Bin) → CenteredForecastModel (integerBox N)) + (periodCap coverCap : ℝ) (Lip : ℝ≥0) + {Y Forecast : Type} [MeasurableSpace Y] + (jointLaw : Measure Y) (referenceLaw : FiniteProbabilityWeights (integerBox N)) + (forecast : Forecast → integerBox N → ℂ) + (localSeminorm : (integerBox N → ℂ) → ℝ) + (selectedLocal : (integerBox N → ℂ) → (Y → ℂ) → Prop) + (hmodels : ∀ branch, CenteredForecastModelBounds jointLaw + (twistedNativeSampleFunctions (fun _ : X => 1) s pNative + (fun x : integerBox N => x.val) + (fun (twist : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (x : integerBox N) => twist.eval N poly x.val)) + referenceLaw forecast localSeminorm selectedLocal + (externalNetMaskFamily (fun f x => (external f x).observable) + (fun f i => (external f (representative i)).observable) hnet input branch) + coefficientBound residualBound termBound (models branch)) + (hM : 0 < coefficientBound) (hterm : 1 ≤ termBound) + (code : Fin rank → Option Freq) + (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) (hH : 0 < outer.mass H) + (hB : 0 ≤ inputBound) (hδ : 0 < δ) (herror : inputBound * ε ≤ δ / 2) + (hinput : ∀ x, ‖input x‖ ≤ inputBound) + {Eres sliceBudget testBudget : ℝ} + (hcost0 : 0 ≤ cost) + (hshort : ∀ a ∈ H, ∀ i : {i // ¬(C a).keep i}, + (A.sides i.val : ℝ) ≤ Real.exp cost) + (hSliceBudget : cost ≤ sliceBudget) (hTestBudget : pLocal ≤ testBudget) + (hUniform : ∀ a ∈ H, ∀ f i, + ∀ packet : UniversalLocalMajorSliceTest A.sides s sliceBudget testBudget, + ‖𝔼 site ∈ packet.slice.subtypeSites, + (models (f, i)).residual (A.boxedPhysical hξ1 (C a).path site) * + packet.weight site.val‖ ≤ Real.exp (-Eres)) + (hresBudget : Real.exp (pLocal - Eres) ≤ (δ / (2 * Fintype.card Bin)) / 2) + (hscore : ∀ a ∈ H, ∀ i f, code i = some f → δ ≤ + ‖(C a).localLaw.complexMean (fun site => + input (A.boxedPhysical hξ1 (C a).path site) * + (external f (A.boxedPhysical hξ1 (C a).path site)).observable + ((candidate a).siteValue site))‖) + (hcorrBudget : Real.exp (-r) ≤ (δ / (2 * Fintype.card Bin)) / (2 * coefficientBound)) + (keep : LayerSamplerVariables G I n B → Prop) + (hkeep : ∀ a, (C a).keep = keep) + (hpoly : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hτ1 : τ ≤ 1) (hσ1 : ∀ j, σ j ≤ 1) + (Cgeo : Fin m → ℝ) (hCgeo : ∀ j, 0 ≤ Cgeo j) + (hchart : ∀ j x, + ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cgeo j * ‖x‖) + (hsmall : ∀ j, Cgeo j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ 1 / 8) + (hp : 0 ≤ p) (hpLocal : 0 ≤ pLocal) (hr : 0 ≤ r) + (hcost : cost ≤ p) (hlocal : pLocal ≤ p) (hnative : pNative ≤ p) + (hperiod : periodCap * coverCap ≤ Real.exp p) + (hvariation : (Lip : ℝ) * (1 + (m : ℝ) * (((m + 1 : ℕ) : ℝ) * + ((Fintype.card (LayerSamplerVariables G I n B) + 1 : ℕ) : ℝ) ^ m)) ≤ Real.exp p) + (hetaHeight : ∀ f i, rationalLogHeight (eta f (D.basis i)) ≤ p) + (hvertical : ∀ f x z, z ∈ D.filtration.realification.subgroup s → ∀ y, + (external f x).observable (z • y) = CircleFourier.character + ((realifyFunctional (eta f) z.coord : ℝ) : CircleFourier.Circle) * + (external f x).observable y) + (hK : (Fintype.card {i // keep i} : ℝ) ≤ p) : + ∃ (retained : Finset Ω), retained ⊆ H ∧ 0 < outer.mass retained ∧ + outer.mass H / ((Fintype.card Bin : ℝ) ^ rank * termBound ^ rank) ≤ outer.mass retained ∧ + ∃ F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω + (KernelProjectionPresentPivot code) D Fmark φ marked keep cost p pLocal pNative r + periodCap coverCap Lip, + F.sourceChart = C ∧ (∀ a, HEq (F.sourceCandidate a) (candidate a)) ∧ + F.η = (fun k => eta (kernelProjectionSelectedPivot code k)) ∧ + ∀ a ∈ retained, ∀ k, Real.exp (-r) ≤ ‖F.correlation a k‖ := by + have hresidual : ∀ a ∈ H, ∀ f i, + ‖(C a).localLaw.complexMean (fun site => + (models (f, i)).residual (A.boxedPhysical hξ1 (C a).path site) * + (external f (representative i)).observable ((candidate a).siteValue site))‖ ≤ + (δ / (2 * Fintype.card Bin)) / 2 := by + intro a ha f i + exact ((candidate a).localLaw_residual_le_exp_of_universal_native_budget + (external f (representative i)) (hcomplex f _) hcost0 (hshort a ha) + hSliceBudget hTestBudget + (fun site => (models (f, i)).residual (A.boxedPhysical hξ1 (C a).path site)) + (hUniform a ha f i)).trans hresBudget + obtain ⟨chosen, twist, value, native, retained, hsub, hpos, hmass, _, hcorr⟩ := + A.exists_precenter_native_partners D C candidate hξ1 external representative hcomplex hnet + input models s pNative periodCap coverCap Lip jointLaw referenceLaw forecast localSeminorm + selectedLocal hmodels hM hterm code outer H hH hB hδ herror hinput hresidual hscore + let F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω + (KernelProjectionPresentPivot code) D Fmark φ marked keep cost p pLocal pNative r + periodCap coverCap Lip := { + hpoly := hpoly + hτ1 := hτ1 + hξ := hξ1 + hσ1 := hσ1 + Cgeo := Cgeo + hCgeo := hCgeo + hchart := hchart + hsmall := hsmall + sourceChart := C + keep_eq := hkeep + sourceCandidate := candidate + reference := fun _ k => external (kernelProjectionSelectedPivot code k) (representative (chosen k)) + nativeValue := value + native := native + twist := fun _ => twist + hp := hp + hpLocal := hpLocal + hr := hr + hcost := hcost + hlocal := hlocal + hnative := hnative + hperiod := by + intro a k + rw [Nat.cast_mul] + exact (mul_le_mul (twist k).modulus_bound (twist k).cover_bound + (Nat.cast_nonneg _) ((Nat.cast_nonneg _).trans (twist k).modulus_bound)).trans hperiod + hvariation := hvariation + hV := fun _ k => hcomplex _ _ + η := fun k => eta (kernelProjectionSelectedPivot code k) + hηheight := fun k i => hetaHeight _ i + hη := fun _ k => hvertical _ _ + hK := hK } + refine ⟨retained, hsub, hpos, hmass, F, rfl, (fun _ => HEq.rfl), rfl, ?_⟩ + intro a ha k + apply hcorrBudget.trans + simpa only [AllocatedExternalCandidateSpatialNativeFamily.correlation, + AllocatedExternalCandidateSpatialNativeFamily.sitePhysicalBox, F, boxedPhysical, mul_assoc] + using hcorr a ha k + +end AllocatedExternalCandidateSampler +end +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {A} {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + +def withBudget (q : ℝ) (hpq : p ≤ q) : + AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost q pLocal pNative r periodCap coverCap Lip where + hpoly := F.hpoly + hτ1 := F.hτ1 + hξ := F.hξ + hσ1 := F.hσ1 + Cgeo := F.Cgeo + hCgeo := F.hCgeo + hchart := F.hchart + hsmall := F.hsmall + sourceChart := F.sourceChart + keep_eq := F.keep_eq + sourceCandidate := F.sourceCandidate + reference := F.reference + nativeValue := F.nativeValue + native := F.native + twist := F.twist + hp := F.hp.trans hpq + hpLocal := F.hpLocal + hr := F.hr + hcost := F.hcost.trans hpq + hlocal := F.hlocal.trans hpq + hnative := F.hnative.trans hpq + hperiod := fun a j => (F.hperiod a j).trans (Real.exp_le_exp.mpr hpq) + hvariation := F.hvariation.trans (Real.exp_le_exp.mpr hpq) + hV := F.hV + η := F.η + hηheight := fun j i => (F.hηheight j i).trans hpq + hη := F.hη + hK := F.hK.trans hpq + +@[simp] theorem withBudget_sourceChart (q : ℝ) (hpq : p ≤ q) : + (F.withBudget q hpq).sourceChart = F.sourceChart := rfl + +@[simp] theorem withBudget_sourceCandidate (q : ℝ) (hpq : p ≤ q) : + (F.withBudget q hpq).sourceCandidate = F.sourceCandidate := rfl + +@[simp] theorem withBudget_reference (q : ℝ) (hpq : p ≤ q) : + (F.withBudget q hpq).reference = F.reference := rfl + +@[simp] theorem withBudget_nativeValue (q : ℝ) (hpq : p ≤ q) : + (F.withBudget q hpq).nativeValue = F.nativeValue := rfl + +@[simp] theorem withBudget_native (q : ℝ) (hpq : p ≤ q) : + (F.withBudget q hpq).native = F.native := rfl + +@[simp] theorem withBudget_twist (q : ℝ) (hpq : p ≤ q) : + (F.withBudget q hpq).twist = F.twist := rfl + +@[simp] theorem withBudget_eta (q : ℝ) (hpq : p ≤ q) : + (F.withBudget q hpq).η = F.η := rfl + +@[simp] theorem withBudget_chart (q : ℝ) (hpq : p ≤ q) (a : Ω) : + (F.withBudget q hpq).chart a = F.chart a := rfl + +@[simp] theorem withBudget_candidate (q : ℝ) (hpq : p ≤ q) (a : Ω) : + (F.withBudget q hpq).candidate a = F.candidate a := rfl + +@[simp] theorem withBudget_jointOrbit (q : ℝ) (hpq : p ≤ q) (a : Ω) : + (F.withBudget q hpq).jointOrbit a = F.jointOrbit a := rfl + +@[simp] theorem withBudget_correlation (q : ℝ) (hpq : p ≤ q) (a : Ω) (j : Pivot) : + (F.withBudget q hpq).correlation a j = F.correlation a j := rfl + +def withFactorBudget : + AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost (spatialNativeFactorParameter p pNative pLocal r) + pLocal pNative r periodCap coverCap Lip := + F.withBudget (spatialNativeFactorParameter p pNative pLocal r) (le_max_left _ _) + +@[simp] theorem withFactorBudget_sourceChart : + F.withFactorBudget.sourceChart = F.sourceChart := rfl + +@[simp] theorem withFactorBudget_sourceCandidate : + F.withFactorBudget.sourceCandidate = F.sourceCandidate := rfl + +@[simp] theorem withFactorBudget_native : F.withFactorBudget.native = F.native := rfl + +@[simp] theorem withFactorBudget_twist : F.withFactorBudget.twist = F.twist := rfl + +@[simp] theorem withFactorBudget_eta : F.withFactorBudget.η = F.η := rfl + +@[simp] theorem withFactorBudget_correlation (a : Ω) (j : Pivot) : + F.withFactorBudget.correlation a j = F.correlation a j := rfl + +include F in + +theorem factorBudget_bounds : + pNative ≤ spatialNativeVerticalParameter pNative pLocal r ∧ + pLocal + r + 1 ≤ spatialNativeVerticalParameter pNative pLocal r ∧ + verticalDecompositionBudget (spatialNativeVerticalParameter pNative pLocal r) ≤ + spatialNativeFactorParameter p pNative pLocal r ∧ + r + verticalDecompositionBudget (spatialNativeVerticalParameter pNative pLocal r) + 2 ≤ + spatialNativeFactorParameter p pNative pLocal r := by + obtain ⟨_, hnative, hprecision, _, _, hfrequency, hbudget⟩ := + spatialNativeVerticalFactorBounds p pNative pLocal r F.hpLocal F.hr + exact ⟨hnative, hprecision, hfrequency, hbudget⟩ + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeLongCommonFactors.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeLongCommonFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..35166dc1e2bf53db33fe7088f2468d7ab0047bd9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeLongCommonFactors.lean @@ -0,0 +1,203 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalCandidateTaggedPairLongUniformFactors + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Ω] [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + +def longJointOrbit (keepLong : LayerSamplerVariables G I n B → Prop) (a : Ω) : + ∀ i : Option Pivot, + (optionFactors D (fun j => (F.native j).model) i).filtration.realification.PolynomialOrbit + (fun _ : {i // keepLong i} => 1) := + fun i => (optionFactors D (fun j => (F.native j).model) i).filtration.polynomialOrbitRealChart + (fun _ : {i // keep i} => 1) (fun _ : {i // keepLong i} => 1) + ((F.chart a).axisPolynomial keepLong (fun _ => 0)) + ((F.chart a).axisPolynomial_support keepLong (fun _ => 0)) (F.jointOrbit a i) + +def LongCommonFactors + (keepLong : LayerSamplerVariables G I n B → Prop) + (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) + {α : Type*} [Fintype α] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) (qVertical qCommon : ℝ) : Prop := + ∃ (theta : ∀ j, (F.native j).L →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (v : Fin (Fintype.card α) → + (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (den : ℕ) (H' : Finset Ω), + H' ⊆ H ∧ 0 < outer.mass H' ∧ + Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * outer.mass H ≤ outer.mass H' ∧ + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule + ((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF) + ω W.toSubmodule ∧ + (∀ i k, rationalLogHeight + (((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis + e ω hF).repr (v i) k) ≤ qCommon) ∧ + (∀ j x, x ∈ (optionProduct D (fun j => (F.native j).model)).filtration.realGradedRefiltrationLayer W s → + realifyFunctional ((pairFrequency (F.η j) (theta j)).comp + (optionPairProjection j).toLinearMap) x = 0) ∧ + 0 < den ∧ (den : ℝ) ≤ Real.exp qCommon ∧ + ∀ a ∈ H', (optionProduct D (fun j => (F.native j).model)).filtration.HasCommonRefilteredOrbitFactors + e ω hF (fun i : {i // keepLong i} => (A.sides i.val : ℝ)) qCommon den W + ⟨⟨(piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.longJointOrbit keepLong a)).log, + (piRealOrbit (fun i => (optionFactors D (fun j => (F.native j).model) i).filtration) + (F.longJointOrbit keepLong a)).property⟩⟩ + +end AllocatedExternalCandidateSpatialNativeFamily + +private theorem compose_exponential_mass_losses {a b x y z : ℝ} + (hfirst : Real.exp (-a) * x ≤ y) (hsecond : Real.exp (-b) * y ≤ z) : + Real.exp (-(a + b)) * x ≤ z := by + calc + _ = Real.exp (-b) * (Real.exp (-a) * x) := by + rw [← mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ _ := (mul_le_mul_of_nonneg_left hfirst (Real.exp_pos _).le).trans hsecond + +theorem exists_allocatedExternalCandidateSpatialNativeFamily_long_common_factors + (s : ℕ) (hs : 1 ≤ s) : + ∃ C Cbasis K T : ℕ, 2 ≤ C ∧ 2 ≤ Cbasis ∧ 2 ≤ K ∧ 2 ≤ T ∧ + ∀ {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + + {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Ω] [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip), + ∀ {qVertical : ℝ}, pNative ≤ qVertical → pLocal + r + 1 ≤ qVertical → + verticalDecompositionBudget qVertical ≤ p → + r + verticalDecompositionBudget qVertical + 2 ≤ p → + ∀ (outer : FiniteProbabilityWeights Ω) (H : Finset Ω), 0 < outer.mass H → + (∀ a ∈ H, ∀ j, Real.exp (-r) ≤ ‖F.correlation a j‖) → + ∀ {α : Type*} [Fintype α] {pGeo bnd : ℝ}, + 0 ≤ pGeo → 0 ≤ bnd → + (∀ j, (pi (pairModels D (F.native j).model)).GeometryComplexityLE pGeo) → + pGeo ≤ bnd → (pGeo + 3) ^ 5 ≤ bnd → + (Fintype.card α : ℝ) ≤ bnd → (Fintype.card Pivot : ℝ) ≤ bnd → + ∀ (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})), + (∀ i j k, rationalLogHeight (e.repr ⁅e i, e j⁆ k) ≤ bnd) → + (∀ i k, rationalLogHeight + ((optionProduct D (fun j => (F.native j).model)).basis.repr (e i) k) ≤ bnd) → + let localCost := allocatedFrozenTaggedPairBudget s C Cbasis pGeo p + let jointCost := allocatedFrozenTaggedFamilyInputBudget bnd localCost + let P := jointCost + (jointCost + K) ^ K + ∀ (keepLong : LayerSamplerVariables G I n B → Prop), + (∀ i, keepLong i → keep i) → + ∀ [Nonempty {i // keepLong i}], (Fintype.card {i // keepLong i} : ℝ) ≤ bnd → + (∀ i : {i // keepLong i}, Real.exp ((p + 2 + C) ^ C + 7 * p + 22) ≤ + (A.sides i.val : ℝ)) → + (∀ i : {i // keepLong i}, Real.exp ((P + 2) ^ T) ≤ (A.sides i.val : ℝ)) → + let qCommon := (P + 2) ^ T + (((P + 2) ^ 2 + 2) ^ 63 + 1) + P + 1 + F.LongCommonFactors keepLong outer H e ω hF qVertical qCommon := by + obtain ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, hcommon⟩ := + exists_allocatedExternalCandidateTaggedPairFamily_long_common_factors s hs + refine ⟨C, Cbasis, K, T, hC, hCbasis, hK, hT, ?_⟩ + intro m G X _ _ I J _ _ n B _ U b R σ S hb o hR hσ N poly hm τ ξ stride cells center + _ A Deck Ω Pivot _ _ LG LM _ _ _ _ _ _ _ _ d₀ t D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip F + qVertical hpq hprecision hfrequency hbudget outer H hH hcorr + α _ pGeo bnd hpGeo hbnd hGeo hpGeoB hInvB hα hPivot e ω hF hstructure he + localCost jointCost P keepLong hLongSub _ hkeep hlong hcommonLong + obtain ⟨retained, hretSub, hretPos, hretMass, selected, + _hchart, _hcandidate, _hreference, _htwist, heta, _hambient, hjoint⟩ := + F.exists_taggedPairFamily outer H hH hpq hprecision hfrequency hbudget hcorr + have hselectedCommon := hcommon (A := A) (D := D) + (E := fun j => (F.native j).model) (H := retained) hpGeo hbnd hGeo hpGeoB hInvB hα hPivot e ω hF + hstructure he outer hretPos selected keepLong hLongSub hkeep hlong hcommonLong + obtain ⟨W, v, den, H', hsub, hpos, hmass, hspan, hgraded, hheight, hzero, + hden, hdenBound, hfactor⟩ := hselectedCommon + refine ⟨selected.θ, W, v, den, H', fun a ha => hretSub (hsub ha), hpos, + ?_, hspan, hgraded, hheight, ?_, hden, hdenBound, ?_⟩ + · apply compose_exponential_mass_losses (hsecond := hmass) + simpa only [neg_mul] using hretMass + · simpa only [heta] using hzero + · intro a ha + have hj : selected.extendedLongJointOrbit keepLong a = F.longJointOrbit keepLong a := by + rw [selected.extendedLongJointOrbit_mem keepLong a (hsub ha)] + unfold AllocatedExternalCandidateTaggedPairFamily.longJointOrbit + AllocatedExternalCandidateSpatialNativeFamily.longJointOrbit + rw [hjoint ⟨a, hsub ha⟩] + rfl + simpa only [hj] using hfactor a ha + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeOrdinaryTerminal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeOrdinaryTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a1f999fe487a9c60cf7dcddbb40a4e5b1a054a7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeOrdinaryTerminal.lean @@ -0,0 +1,791 @@ +import OAI.Combinatorics.Progressions.Dynamics.NativeAdaptedOrdinaryResetGeometry +import OAI.Combinatorics.Progressions.Estimates.AllocatedCandidateZeroRestrictedNativeCommonPhysicalTerminal +import OAI.Combinatorics.Progressions.Estimates.AllocatedOrdinaryLongPhysicalTerminalConclusion +import OAI.Combinatorics.Progressions.Estimates.AllocatedPrimitiveFrontInitialLong +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeAutomaticLongGeometry + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom realSymbolGradeEvaluation + CertifiedFullChartFiniteHistory.outer + CertifiedFullChartFiniteHistory.earlyForwardBranchTree realGradedSymbolPolynomial + +noncomputable section + +variable {m : ℕ} {G X : Type} [Fintype G] [Fintype X] [DecidableEq X] + {I J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type} {Pivot : Type} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM s} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (keepLong : LayerSamplerVariables G I n B → Prop) + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable {α : Type} [Fintype α] + (e : Basis α ℚ (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)) + (ω : α → ℕ) + (hF : ∀ k, (optionProduct D (fun j => (F.native j).model)).filtration.layer k = + Submodule.span ℚ (e '' {i | k ≤ ω i})) + (js : List Pivot) + {dQ : ℕ} + (Q : RationalFilteredNilmanifold (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)) + (adapted : (optionProduct Q (fun j => (F.native j).model)).AdaptedModelData) + +local notation "countConstants" => (fun n => fullChartStageCountConstant (n + 1) 254) + +def ActualAdaptedPivotQuotientLongPhysicalTerminal + {κ : Type} [Fintype κ] + (bMark : Basis κ ℚ (∀ i : Option Pivot, optionLieSpace LM (fun j => (F.native j).L) i)) + (ν : κ → ℕ) + (hMark : ∀ k, (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).layer k = Submodule.span ℚ (bMark '' {i | k ≤ ν i})) + (hmarkΦ : ∀ k, ∀ z ∈ (adapted.model.filtration).layer k, (optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) z ∈ (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).layer k) + (scheduleExponent Cprimitive : ℕ) (x separation qVertical qCommon pProj : ℝ) : Prop := + ∃ (retained : Finset A.Path) (hsub : retained ⊆ H) + (hmass : Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H ≤ A.law.mass retained), + 0 < A.law.mass retained ∧ + ∃ (theta : ∀ j, (F.native j).L →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (v : Fin (Fintype.card α) → + (optionProduct D (fun j => (F.native j).model)).filtration.AssociatedGraded) + (den : ℕ), + Submodule.span ℚ (Set.range v) = W.toSubmodule ∧ + BasisGradedSubmodule + ((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis e ω hF) + ω W.toSubmodule ∧ + (∀ i k, rationalLogHeight + (((optionProduct D (fun j => (F.native j).model)).filtration.associatedGradedBasis + e ω hF).repr (v i) k) ≤ qCommon) ∧ + (∀ j x, x ∈ (optionProduct D (fun j => (F.native j).model)).filtration.realGradedRefiltrationLayer W s → + realifyFunctional ((pairFrequency (F.η j) (theta j)).comp + (optionPairProjection j).toLinearMap) x = 0) ∧ + 0 < den ∧ (den : ℝ) ≤ Real.exp qCommon ∧ + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + let F₀ := (optionProduct D (fun j => (F.native j).model)).filtration + let FQ := adapted.model.filtration + let ψ := optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) + let hψ := D.optionQuotientMap_mem_layer + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model) + let V := W.map (F₀.associatedGradedMap FQ ψ hψ) + let vQ := F₀.gradedImageSpanningFamily FQ ψ hψ v + ∃ denQ : ℕ, 0 < denQ ∧ (denQ : ℝ) ≤ Real.exp ((pProj + 2) ^ 4) ∧ den ∣ denQ ∧ + Submodule.span ℚ (Set.range vQ) = V.toSubmodule ∧ + BasisGradedSubmodule + (FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers) + adapted.weight V.toSubmodule ∧ + (∀ a i, rationalLogHeight + ((FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers).repr + (vQ a) i) ≤ (pProj + 2) ^ 4) ∧ + (∀ z : target.productive, + FQ.HasCommonRefilteredOrbitFactors adapted.model.basis adapted.weight adapted.model_layers + (fun i : {i // keepLong i} => (A.sides i.val : ℝ)) ((pProj + 2) ^ 3 + qCommon) denQ V + (FQ.weightedAdaptedRealChartHom + (fun _ : {i // keep i} => 1) (fun _ : {i // keepLong i} => 1) + ((target.chart z).axisPolynomial keepLong (fun _ => 0)) + ((target.chart z).axisPolynomial_support keepLong (fun _ => 0)) + (FQ.realification.polynomialOrbitCoordinates (fun _ => 1) + (target.candidate z).orbit))) ∧ + (∀ x ∈ FQ.gradedRefiltrationLayer V s, + optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker) x = 0 → + x = 0) ∧ + (∀ (Gmark : NilpotentLieFiltration + (∀ i : Option Pivot, optionLieSpace LM (fun j => (F.native j).L) i) s) + (hmarked : ∀ k, ∀ x ∈ FQ.layer k, + optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker) x ∈ + Gmark.layer k), + ∀ a ∈ V, + basisGradeProjection + (FQ.associatedGradedBasis adapted.model.basis adapted.weight adapted.model_layers) + adapted.weight s a = a → + FQ.associatedGradedMap Gmark + (optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) + hmarked a = 0 → a = 0) ∧ + target.NativeCommonPhysicalTerminal bMark ν hMark hmarkΦ V + scheduleExponent Cprimitive x separation + +theorem ActualAdaptedPivotQuotientLongFactors.exists_affine_physical_terminal + {qVertical qCommon pProj : ℝ} + (hproduced : F.ActualAdaptedPivotQuotientLongFactors keepLong H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + qVertical qCommon pProj) + (stageKeep : ℕ → LayerSamplerVariables G I n B → Prop) + (hstageLong : ∀ r < s, ∀ i, stageKeep r i → keepLong i) + {κ : Type} [Fintype κ] + (bMark : Basis κ ℚ (∀ i : Option Pivot, optionLieSpace LM (fun j => (F.native j).L) i)) + (ν : κ → ℕ) + (hMark : ∀ k, (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).layer k = Submodule.span ℚ (bMark '' {i | k ≤ ν i})) + (hmarkΦ : ∀ k, ∀ z ∈ (adapted.model.filtration).layer k, (optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) z ∈ (NilpotentLieFiltration.pi (optionFiltrations Fmark (fun j => ((fun j => (F.native j).model) j).filtration))).layer k) + [Fintype (SymbolBasisIndex (fun _ : LayerSamplerVariables G I n B => 1) adapted.weight)] + [Fintype (SymbolBasisIndex (fun _ : LayerSamplerVariables G I n B => 1) ν)] + [∀ r, Fintype (SymbolBasisIndex + (fun _ : {i : LayerSamplerVariables G I n B // stageKeep r i} => 1) adapted.weight)] + [∀ r, Fintype (SymbolBasisIndex + (fun _ : {i : LayerSamplerVariables G I n B // stageKeep r i} => 1) ν)] + [∀ r, TopologicalSpace (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, IsTopologicalAddGroup (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, ContinuousSMul ℝ (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, T2Space (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + (pGeometry Rrank : ℝ) (Hbr : ℕ) + (hpGeometry : 0 ≤ pGeometry) + (hSourceGeometry : (finrank ℚ (∀ i : Option Pivot, + optionLieSpace (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) + (fun j => (F.native j).L) i) : ℝ) ≤ pGeometry) + (hMarkedGeometry : (Fintype.card κ : ℝ) ≤ pGeometry) + (hGeneratorGeometry : (Fintype.card α : ℝ) ≤ pGeometry) + (hSamplerGeometry : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ pGeometry) + (hQuotientGeometry : (pProj + 2) ^ 4 ≤ pGeometry) + (scheduleExponent : ℕ) (x gainLog stageLog : ℝ) + (hx : 0 ≤ x) (hgain : gainLog ∈ Set.Icc 0 x) (hstage : stageLog ∈ Set.Icc 0 x) + (Cprimitive Csource : ℕ) (sourceNative pTest detectionLoss : ℕ → ℝ) + (hSourceNonneg : ∀ r < s, 0 ≤ sourceNative r) + (hSourceBound : ∀ r < s, sourceNative r ≤ + (preparedFiniteForwardSourcePrecision scheduleExponent countConstants r x gainLog stageLog + + preparedFiniteForwardWork scheduleExponent countConstants r x + Csource) ^ Csource) + (hBaseExponent : allocatedCandidateStageBaseExponent s m Cprimitive ≤ scheduleExponent) + (hphaseExponent : ∀ r < s, + allocatedCandidateCompositePhaseConstant s m 1 + (allocatedCandidatePromotedMajorConstant Csource) r ≤ scheduleExponent) + (hCprimitive : 1 ≤ Cprimitive) + (hGeometryBase : allocatedCandidateCommonFastBudget s pGeometry ≤ x) + (hHbr : 1 ≤ Hbr) + (hTagsBase : (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ x) + (hmEarly : (m : ℝ) ≤ x) + (hblocksEarly : ((s * (Fintype.card κ * m) : ℕ) : ℝ) ≤ x) + (hHbrBase : (Hbr : ℝ) ≤ Real.exp x) + (hcost : cost ≤ (x + Cprimitive) ^ Cprimitive) + (HMap : ℕ) (hHMap : 1 ≤ HMap) + (hHMapGeometry : (HMap : ℝ) ≤ Real.exp pGeometry) + (hNativeBase : (pProj + 2) ^ 3 + qCommon ≤ (x + Cprimitive) ^ Cprimitive) + (hentries : ∀ i j, RationalHeightLE (bMark.repr ((optionMarkedLieMap (L := fun j => (F.native j).L) (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) (adapted.model.basis j)) i) HMap) + (hbracket : ∀ i j z, RationalHeightLE (bMark.repr ⁅bMark i, bMark j⁆ z) Hbr) + (hkept : ∀ r, ∀ i, stageKeep r i → Real.exp (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x)) ≤ (A.sides i : ℝ)) + (hfrozenStage : ∀ r, ∀ i, ¬stageKeep r i → (A.sides i : ℝ) ≤ Real.exp + (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x))) + (hTest : ∀ r < s, OrdinaryPolynomialPhase.budget r ≤ pTest r) + (hDetectionLoss : ∀ r < s, detectionLoss r ≤ (9 / 10 : ℝ) * + (Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H)) + (hdirect : ∀ r < s, A.NativeDetection r (allocatedCandidateStageSlice s m Cprimitive + (preparedFiniteForwardParameter scheduleExponent countConstants r x)) + (pTest r) (sourceNative r) (detectionLoss r)) + (hN : ∀ i, Real.exp (preparedFiniteForwardCumulative scheduleExponent countConstants s x) ≤ (N i : ℝ)) + (hRrank : Real.exp (preparedFiniteForwardCumulative scheduleExponent countConstants s x) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) + (hs : 0 < s) (separation : ℝ) + (hseparation : certifiedAffineLongSideBound + (preparedFiniteForwardCumulative scheduleExponent countConstants s x) ≤ separation) : + F.ActualAdaptedPivotQuotientLongPhysicalTerminal keepLong H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore e ω hF js Q hQ hker descended hrecovery adapted + bMark ν hMark hmarkΦ scheduleExponent Cprimitive x separation qVertical qCommon pProj := by + classical + obtain ⟨retained, hsub, hmass, hpos, theta, W, v, den, hv, hW, hvH, hzero, + hden, hdenBound, denQ, hdenQ, hdenQBound, hdiv, hvQ, hWQ, hvQH, hfactorQ, + htop, hgradedTop⟩ := hproduced + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery adapted + let V := W.map (((optionProduct D (fun j => (F.native j).model)).filtration).associatedGradedMap (adapted.model.filtration) (optionMarkedLieMap (L := fun j => (F.native j).L) (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) (D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model))) + let vQ := ((optionProduct D (fun j => (F.native j).model)).filtration).gradedImageSpanningFamily (adapted.model.filtration) (optionMarkedLieMap (L := fun j => (F.native j).L) (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) (D.optionQuotientMap_mem_layer (D.filtration.pivotAnnihilatorIdeal φ F.η js) (by rw [D.filtration.terminal]; exact bot_le) Q hQ (fun j => (F.native j).model)) v + have hpGeometryX : pGeometry ≤ x := + (allocatedCandidateCommonFastBudget_bounds s hpGeometry).2.2.trans hGeometryBase + have hprimitive : x ≤ (x + Cprimitive) ^ Cprimitive := by + have hC : (1 : ℝ) ≤ Cprimitive := by exact_mod_cast hCprimitive + have hbase : 1 ≤ x + Cprimitive := by linarith + exact (le_add_of_nonneg_right (Nat.cast_nonneg Cprimitive)).trans + (by simpa only [pow_one] using pow_le_pow_right₀ hbase hCprimitive) + have hdenQBase : (denQ : ℝ) ≤ Real.exp ((x + Cprimitive) ^ Cprimitive) := + hdenQBound.trans (Real.exp_le_exp.mpr + ((hQuotientGeometry.trans hpGeometryX).trans hprimitive)) + have hOriginal (z : target.productive) : + (adapted.model.filtration).HasCommonRefilteredOrbitFactors adapted.model.basis adapted.weight adapted.model_layers + (fun i : {i : LayerSamplerVariables G I n B // keepLong i} => (A.sides i.val : ℝ)) + ((pProj + 2) ^ 3 + qCommon) denQ V + ((adapted.model.filtration).weightedAdaptedRealChartHom + (fun _ : (target.chart z).Variables => 1) + (fun _ : {i : LayerSamplerVariables G I n B // keepLong i} => 1) + ((target.chart z).axisPolynomial keepLong (fun _ => 0)) + ((target.chart z).axisPolynomial_support keepLong (fun _ => 0)) + ((adapted.model.filtration).realification.polynomialOrbitCoordinates + (fun _ => 1) (target.candidate z).orbit)) := + hfactorQ z + have hselectedMass : 0 < Real.exp + (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H := by + apply mul_pos (Real.exp_pos _) + apply hpos.trans_le + exact Finset.sum_le_sum_of_subset_of_nonneg hsub (fun a _ _ => A.law.nonneg a) + have ht := target.exists_zero_restricted_native_common_affine_physical_terminal stageKeep + adapted.model.basis adapted.weight adapted.model_layers bMark ν hMark hmarkΦ V + vQ hvQ hWQ pGeometry Rrank Hbr hpGeometry + (by simpa only [Fintype.card_fin] using hSourceGeometry) hMarkedGeometry + (by simpa only [Fintype.card_fin] using hGeneratorGeometry) hSamplerGeometry + (fun a i => (hvQH a i).trans hQuotientGeometry) + scheduleExponent x gainLog stageLog hx hgain hstage Cprimitive Csource + sourceNative pTest detectionLoss hSourceNonneg hSourceBound hBaseExponent hphaseExponent + hCprimitive hGeometryBase hHbr hTagsBase hmEarly hblocksEarly hHbrBase hcost + HMap denQ ((pProj + 2) ^ 3 + qCommon) hHMap hdenQ hHMapGeometry hdenQBase + hNativeBase hentries hbracket keepLong hstageLong hOriginal F.hτ1 F.hξ F.hσ1 F.Cgeo F.hCgeo F.hchart F.hsmall + F.hpoly hkept hfrozenStage hTest hDetectionLoss hdirect hN hRrank hrank + hs hselectedMass separation hseparation + obtain ⟨qDim, hdim, eQ, lift, hfast, hsection, hterminal⟩ := ht + refine ⟨retained, hsub, hmass, hpos, theta, W, v, den, hv, hW, hvH, hzero, + hden, hdenBound, denQ, hdenQ, hdenQBound, hdiv, hvQ, hWQ, hvQH, hfactorQ, + htop, hgradedTop, ?_⟩ + have hηBase : (Fintype.card (Fin qDim) : ℝ) ≤ x := by + simpa only [Fintype.card_fin] using + (Nat.cast_le.mpr hdim).trans (hMarkedGeometry.trans hpGeometryX) + have hblocks : ((s * (Fintype.card (Fin qDim) * m) : ℕ) : ℝ) ≤ x := by + simpa only [Fintype.card_fin] using + (Nat.cast_le.mpr (Nat.mul_le_mul_left s (Nat.mul_le_mul_right m hdim))).trans hblocksEarly + have hXEarly : (Fintype.card X : ℝ) ≤ x := by + have hsum : (Fintype.card X : ℝ) + (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + simpa only [Fintype.card_sum, Nat.cast_add] using hTagsBase + exact (le_add_of_nonneg_right (Nat.cast_nonneg _)).trans hsum + have hJEarly : (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + have hsum : (Fintype.card X : ℝ) + (Fintype.card (Σ j, J j) : ℝ) ≤ x := by + simpa only [Fintype.card_sum, Nat.cast_add] using hTagsBase + exact (le_add_of_nonneg_left (Nat.cast_nonneg _)).trans hsum + have hNEarly : ∀ i, 1 ≤ N i := by + intro i + have hpositive : 0 < N i := by exact_mod_cast ((Real.exp_pos _).trans_le (hN i)) + exact Nat.succ_le_iff.mpr hpositive + refine ⟨qDim, hdim, eQ, lift, hfast, hsection, hx, hXEarly, hmEarly, hJEarly, + hηBase, hblocks, hNEarly, ?_⟩ + dsimp only at hterminal ⊢ + exact hterminal + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom realSymbolGradeEvaluation + CertifiedFullChartFiniteHistory.outer + CertifiedFullChartFiniteHistory.earlyForwardBranchTree realGradedSymbolPolynomial + +noncomputable section + +theorem exists_allocatedExternalCandidateSpatialNativeFamily_actual_physical_terminal + (s : ℕ) (hs : 1 ≤ s) : + ∃ Cgeometry C Cbasis K T : ℕ, 2 ≤ Cgeometry ∧ 2 ≤ C ∧ 2 ≤ Cbasis ∧ 2 ≤ K ∧ 2 ≤ T ∧ + ∀ {m : ℕ} {G X : Type} [Fintype G] [Fintype X] + {I J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + + {Deck : Fin m → Type} {Pivot : Type} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {dMark : ℕ} {Mmark : RationalFilteredNilmanifold LM s dMark} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Mmark.filtration.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Mmark.filtration φ marked + keep cost p pLocal pNative r periodCap coverCap Lip), + ∀ {qVertical : ℝ}, pNative ≤ qVertical → pLocal + r + 1 ≤ qVertical → + verticalDecompositionBudget qVertical ≤ p → + r + verticalDecompositionBudget qVertical + 2 ≤ p → + ∀ (H : Finset A.Path), 0 < A.law.mass H → + (∀ a ∈ H, ∀ j, Real.exp (-r) ≤ ‖F.correlation a j‖) → + ∀ (pGeometry : ℝ), 2 ≤ pGeometry → D.GeometryComplexityLE pGeometry → + Mmark.GeometryComplexityLE pGeometry → + ∀ (hφ : ∀ k, ∀ z ∈ D.filtration.layer k, φ z ∈ Mmark.filtration.layer k), + (∀ i j, rationalLogHeight (Mmark.basis.repr (φ (D.basis j)) i) ≤ pGeometry) → + pNative ≤ pGeometry → (Fintype.card Pivot : ℝ) ≤ pGeometry → + ∀ (js : List Pivot) {dQ : ℕ} + (Q : RationalFilteredNilmanifold + (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ x ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ x = 0), + Q.GeometryComplexityLE pGeometry → + (∀ i j, rationalLogHeight + (Q.basis.repr (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (D.basis j)) i) ≤ pGeometry) → + let pGeo := (pGeometry + 2) ^ 2 + let jointGeo := (pGeometry + 3) ^ 2 + let adaptedBudget := (jointGeo + 2) ^ Cgeometry + let bnd := adaptedBudget + (pGeo + 3) ^ 5 + pGeo + jointGeo + pGeometry + p + 2 + let localCost := allocatedFrozenTaggedPairBudget s C Cbasis pGeo p + let jointCost := allocatedFrozenTaggedFamilyInputBudget bnd localCost + let P := jointCost + (jointCost + K) ^ K + let initialShortLog := max ((p + 2 + C) ^ C + 7 * p + 22) ((P + 2) ^ T) + let keepLong := fun i => keep i ∧ Real.exp initialShortLog ≤ (A.sides i : ℝ) + ∀ [Nonempty {i // keepLong i}], + let qCommon := (P + 2) ^ T + (((P + 2) ^ 2 + 2) ^ 63 + 1) + P + 1 + let pProj := max qCommon 0 + adaptedBudget + 1 + let markInput := nativeOptionFixedSourceQuotientMarkInput pGeometry + let markBudget := (markInput + 2) ^ nativeOptionFixedSourceMarkExponent.{0, 0} + let pTerminal := (pProj + 2) ^ 4 + markInput + markBudget + jointGeo + + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) + 2 + ∀ (source : A.InnerSourceProfile s) + (_hFastInput : allocatedCandidateCommonFastBudget s pTerminal ≤ source.x) + (_hblocks : (s : ℝ) * (markInput * m) ≤ source.x) + (_hShortInput : max cost initialShortLog ≤ (source.x + source.Cprimitive) ^ source.Cprimitive) + (_hNativeInput : (pProj + 2) ^ 3 + qCommon ≤ + (source.x + source.Cprimitive) ^ source.Cprimitive) + (massLog : ℝ) (hmass : Real.exp (-massLog) ≤ A.law.mass H) + (_hMassInput : verticalDecompositionBudget qVertical * (Fintype.card Pivot : ℝ) + + ((qCommon + 2) ^ 5 + qCommon) + massLog ≤ source.gainLog) + (separation : ℝ) + (_hseparation : certifiedAffineLongSideBound + (preparedFiniteForwardCumulative source.scheduleExponent + AllocatedExternalCandidateSampler.degreeSourceCountConstants s source.x) ≤ separation) + [∀ r, TopologicalSpace (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, IsTopologicalAddGroup (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, ContinuousSMul ℝ (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + [∀ r, T2Space (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra OrdinaryPolynomialPhase.weight r)] + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)), + ∃ geometry : (optionProduct D (fun j => (F.native j).model)).AdaptedMapGeometryData + (optionProduct Q (fun j => (F.native j).model)) + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) + jointGeo adaptedBudget, + ∃ markGeometry : (optionProduct Q (fun j => (F.native j).model)).FixedSourceAdaptedMarkGeometryData + (optionProduct Mmark (fun j => (F.native j).model)) geometry.target + (optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) + markInput markBudget, + let hmarkΦ := D.nativeOptionFixedSourceQuotientMark_mem_layer Mmark + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ + (fun j => (F.native j).model) φ hker hφ geometry.target + let hMark : ∀ k, (NilpotentLieFiltration.pi (optionFiltrations Mmark.filtration + (fun j => (F.native j).model.filtration))).layer k = + Submodule.span ℚ (markGeometry.target.basis '' {i | k ≤ markGeometry.target.weight i}) := by + intro k + exact Mmark.optionAdaptedModel_layers (fun j => (F.native j).model) markGeometry.target k + F.ActualAdaptedPivotQuotientLongPhysicalTerminal keepLong H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore geometry.source.basis geometry.source.weight + geometry.source.layers js Q hQ hker descended hrecovery geometry.target + markGeometry.target.basis markGeometry.target.weight hMark hmarkΦ + source.scheduleExponent source.Cprimitive source.x separation qVertical qCommon pProj := by + obtain ⟨Cgeometry, C, Cbasis, K, T, hCgeometry, hC, hCbasis, hK, hT, hfactor⟩ := + exists_allocatedExternalCandidateSpatialNativeFamily_native_long_geometry_factors s hs + refine ⟨Cgeometry, C, Cbasis, K, T, hCgeometry, hC, hCbasis, hK, hT, ?_⟩ + intro m G X _ _ I J _ _ n B _ U b R σ S hb o hR hσ N poly hm τ ξ stride cells center + _ A Deck Pivot _ LG LM _ _ _ _ _ _ _ _ d₀ D dMark Mmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip F + qVertical hpq hprecision hfrequency hbudget H hH hcorr + pGeometry hpGeometry hD hMmark hφ hmark hpNative hPivot js dQ Q hQ hker hQGeometry hmap + pGeo jointGeo adaptedBudget bnd localCost jointCost P initialShortLog keepLong _ qCommon pProj + markInput markBudget pTerminal source hFastInput hblocks hShortInput hNativeInput + massLog hmass hMassInput separation hseparation _ _ _ _ + sourceCenter hpath hcenter hfrozen observable weight scoreThreshold hscore descended hrecovery + classical + have hpGeometry0 : 0 ≤ pGeometry := (by norm_num : (0 : ℝ) ≤ 2).trans hpGeometry + have hlong (i : {i // keepLong i}) : + Real.exp ((p + 2 + C) ^ C + 7 * p + 22) ≤ (A.sides i.val : ℝ) := + (Real.exp_le_exp.mpr (le_max_left _ _)).trans i.property.2 + have hcommonLong (i : {i // keepLong i}) : + Real.exp ((P + 2) ^ T) ≤ (A.sides i.val : ℝ) := + (Real.exp_le_exp.mpr (le_max_right _ _)).trans i.property.2 + obtain ⟨geometry, hproduced⟩ := hfactor F hpq hprecision hfrequency hbudget H hH hcorr + pGeometry hpGeometry hD hpNative hPivot js Q hQ hker hQGeometry hmap + keepLong (fun _ hi => hi.1) hlong hcommonLong sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore descended hrecovery + have hAtoms (j : Pivot) : (F.native j).model.GeometryComplexityLE pGeometry := + (F.native j).complexity.1.mono (F.native j).model hpNative + obtain ⟨markGeometry, hmarkFiltration, hmarked⟩ := + D.exists_nativeOptionFixedSourceQuotientMarkGeometry Mmark + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ + (fun j => (F.native j).model) φ hker hφ geometry.target + hpGeometry0 hD hMmark hQGeometry hAtoms hPivot hmap hmark geometry.target_forward + refine ⟨geometry, markGeometry, ?_⟩ + intro hmarkΦ hMark + let stageKeep := source.stageKeep + let Hbr := ⌈Real.exp markBudget⌉₊ + have hMarkInput0 : 0 ≤ markInput := + (nativeOptionFixedSourceQuotientMarkInput_bounds hpGeometry0).1 + have hMarkBudget0 : 0 ≤ markBudget := by dsimp only [markBudget]; positivity + have hJoint0 : 0 ≤ jointGeo := by dsimp only [jointGeo]; positivity + have hProj0 : 0 ≤ (pProj + 2) ^ 4 := by positivity + have hSampler0 : (0 : ℝ) ≤ Fintype.card (LayerSamplerVariables G I n B) := Nat.cast_nonneg _ + have hTerminal0 : 0 ≤ pTerminal := by + dsimp only [pTerminal] + linarith only [hProj0, hMarkInput0, hMarkBudget0, hJoint0, hSampler0] + have hJointTerminal : jointGeo ≤ pTerminal := by + dsimp only [pTerminal] + linarith only [hProj0, hMarkInput0, hMarkBudget0, hSampler0] + have hMarkInputTerminal : markInput ≤ pTerminal := by + dsimp only [pTerminal] + linarith only [hProj0, hMarkBudget0, hJoint0, hSampler0] + have hMarkBudgetTerminal : markBudget + 1 ≤ pTerminal := by + dsimp only [pTerminal] + linarith only [hProj0, hMarkInput0, hJoint0, hSampler0] + have hProjTerminal : (pProj + 2) ^ 4 ≤ pTerminal := by + dsimp only [pTerminal] + linarith only [hMarkInput0, hMarkBudget0, hJoint0, hSampler0] + have hSamplerTerminal : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ pTerminal := by + dsimp only [pTerminal] + linarith only [hProj0, hMarkInput0, hMarkBudget0, hJoint0] + have hTerminalX : pTerminal ≤ source.x := + (allocatedCandidateCommonFastBudget_bounds s hTerminal0).2.2.trans hFastInput + have hHbr := source.markHeight_bounds hMarkBudget0 (hMarkBudgetTerminal.trans hTerminalX) + have hHnonempty : H.Nonempty := by + by_contra he + have hzero : A.law.mass H = 0 := by + rw [Finset.not_nonempty_iff_eq_empty.mp he] + simp [FiniteProbabilityWeights.mass] + linarith only [hH, hzero] + obtain ⟨a, ha⟩ := hHnonempty + have hshort : ∀ i, ¬keepLong i → + (A.sides i : ℝ) ≤ Real.exp (max cost initialShortLog) := + allocatedCandidate_initialLong_excluded_bound (fun i => (A.sides i : ℝ)) keep + (fun i hi => hfrozen a ha ⟨i, hi⟩) + have hstageLong := source.stageKeep_subset_initialLong keepLong hShortInput hshort + have hcost : cost ≤ (source.x + source.Cprimitive) ^ source.Cprimitive := + (le_max_left _ _).trans hShortInput + let : Fintype (SymbolBasisIndex (fun _ : LayerSamplerVariables G I n B => 1) + geometry.target.weight) := symbolBasisIndexFintype _ _ s (fun _ => Nat.zero_lt_one) + (geometry.target.model.filtration.adaptedBasis_weight_le_step + geometry.target.model.basis geometry.target.weight geometry.target.model_layers) + let : Fintype (SymbolBasisIndex (fun _ : LayerSamplerVariables G I n B => 1) + markGeometry.target.weight) := symbolBasisIndexFintype _ _ s (fun _ => Nat.zero_lt_one) + (markGeometry.target.model.filtration.adaptedBasis_weight_le_step + markGeometry.target.model.basis markGeometry.target.weight markGeometry.target.model_layers) + let (r : ℕ) : Fintype (SymbolBasisIndex (fun _ : {i // stageKeep r i} => 1) + geometry.target.weight) := symbolBasisIndexFintype _ _ s (fun _ => Nat.zero_lt_one) + (geometry.target.model.filtration.adaptedBasis_weight_le_step + geometry.target.model.basis geometry.target.weight geometry.target.model_layers) + let (r : ℕ) : Fintype (SymbolBasisIndex (fun _ : {i // stageKeep r i} => 1) + markGeometry.target.weight) := symbolBasisIndexFintype _ _ s (fun _ => Nat.zero_lt_one) + (markGeometry.target.model.filtration.adaptedBasis_weight_le_step + markGeometry.target.model.basis markGeometry.target.weight markGeometry.target.model_layers) + have hblocksActual : ((s * (Fintype.card (Fin (finrank ℚ + (∀ i : Option Pivot, optionLieSpace LM (fun j => (F.native j).L) i))) * m) : ℕ) : ℝ) ≤ + source.x := by + simpa only [Fintype.card_fin, Nat.cast_mul] using + (mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right markGeometry.target_dimension (Nat.cast_nonneg m)) + (Nat.cast_nonneg s)).trans hblocks + exact AllocatedExternalCandidateSpatialNativeFamily.ActualAdaptedPivotQuotientLongFactors.exists_affine_physical_terminal + F keepLong H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore geometry.source.basis geometry.source.weight + geometry.source.layers js Q hQ hker descended hrecovery geometry.target hproduced + stageKeep (fun r _ => hstageLong r) + markGeometry.target.basis markGeometry.target.weight hMark hmarkΦ + pTerminal source.rankThreshold Hbr hTerminal0 + (geometry.target_dimension.trans hJointTerminal) + (by simpa only [Fintype.card_fin] using markGeometry.target_dimension.trans hMarkInputTerminal) + (by simpa only [Fintype.card_fin] using geometry.source_dimension.trans hJointTerminal) + hSamplerTerminal hProjTerminal + source.scheduleExponent source.x source.gainLog source.stageLog source.x_nonneg + source.gain_range source.stage_range source.Cprimitive source.Csource + source.sourceNative source.pTest source.detectionLoss source.source_nonneg source.source_bound + source.base_exponent source.phase_exponent source.primitive_pos hFastInput hHbr.1 + source.tags_input source.layers_input hblocksActual hHbr.2 hcost + markGeometry.entries_height (Nat.one_le_of_lt markGeometry.entries_height_pos) + (markGeometry.entries_bound.trans (Real.exp_le_exp.mpr + ((le_add_of_nonneg_right zero_le_one).trans hMarkBudgetTerminal))) + hNativeInput markGeometry.entries + (fun i j k => rationalHeightLE_ceil_exp (markGeometry.target_structure i j k)) + source.stageKeep_kept source.stageKeep_frozen source.test_floor + (source.detectionLoss_le_spatialNativeMass (Pivot := Pivot) hmass hMassInput) + source.detection source.size_floor source.rank_floor source.sampling_rank hs + separation hseparation + +end +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom realSymbolGradeEvaluation + CertifiedFullChartFiniteHistory.outer + CertifiedFullChartFiniteHistory.earlyForwardBranchTree realGradedSymbolPolynomial + +noncomputable section + +variable {m : ℕ} {G X : Type} [Fintype G] [Fintype X] + {I J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type} {Pivot : Type} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {dMark : ℕ} {Mmark : RationalFilteredNilmanifold LM s dMark} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Mmark.filtration.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Mmark.filtration φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (keepLong : LayerSamplerVariables G I n B → Prop) + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable (js : List Pivot) {dQ : ℕ} + (Q : RationalFilteredNilmanifold + (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) s dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ z ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ z = 0) + (descended : (X → ℤ) → Q.Space → ℂ) + (hrecovery : ∀ x (g : D.RealGroup), + descended x (QuotientGroup.mk + (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + observable x (QuotientGroup.mk g)) + {jointGeo adaptedBudget markInput markBudget : ℝ} + (geometry : (optionProduct D (fun j => (F.native j).model)).AdaptedMapGeometryData + (optionProduct Q (fun j => (F.native j).model)) + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) jointGeo adaptedBudget) + (markGeometry : (optionProduct Q (fun j => (F.native j).model)).FixedSourceAdaptedMarkGeometryData + (optionProduct Mmark (fun j => (F.native j).model)) geometry.target + (optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) + markInput markBudget) + +theorem ordinaryData_of_actualAdaptedPivotQuotientLongPhysicalTerminal + (hφ : ∀ k, ∀ z ∈ D.filtration.layer k, φ z ∈ Mmark.filtration.layer k) + (hsurj : ∀ k, ∀ y ∈ Mmark.filtration.layer k, + ∃ z ∈ D.filtration.layer k, φ z = y) + {scheduleExponent Cprimitive : ℕ} {x separation qVertical qCommon pProj p0 : ℝ} + (hp0 : 0 ≤ p0) (hgeometry : adaptedBudget ≤ p0) (hmark : markBudget ≤ p0) + (hgenerator : jointGeo ≤ p0) + (hvariables : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p0) + (hprojection : (pProj + 2) ^ 4 ≤ p0) + (hfactor : (pProj + 2) ^ 3 + qCommon ≤ p0) + (hcost : cost ≤ p0) + (hshort : ∀ i, ¬keepLong i → (A.sides i : ℝ) ≤ Real.exp p0) : + let hmarkΦ := D.nativeOptionFixedSourceQuotientMark_mem_layer Mmark + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ + (fun j => (F.native j).model) φ hker hφ geometry.target + F.ActualAdaptedPivotQuotientLongPhysicalTerminal keepLong H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore geometry.source.basis geometry.source.weight + geometry.source.layers js Q hQ hker descended hrecovery geometry.target + markGeometry.target.basis markGeometry.target.weight + (Mmark.optionAdaptedModel_layers (fun j => (F.native j).model) markGeometry.target) hmarkΦ + scheduleExponent Cprimitive x separation qVertical qCommon pProj → + ∃ (retained : Finset A.Path) (hsub : retained ⊆ H) + (hmass : Real.exp (-(verticalDecompositionBudget qVertical * Fintype.card Pivot + + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H ≤ A.law.mass retained), + 0 < A.law.mass retained ∧ + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker descended hrecovery geometry.target + Nonempty (AllocatedExternalCandidateProblem.OrdinaryLongPhysicalTerminalData + (D := geometry.target.model) + (Fmark := NilpotentLieFiltration.pi + (optionFiltrations Mmark.filtration (fun j => (F.native j).model.filtration))) + (φ := optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) + target markGeometry.target.model + geometry.target.weight geometry.target.model_layers + markGeometry.target.weight + (Mmark.optionAdaptedModel_layers (fun j => (F.native j).model) markGeometry.target) hmarkΦ p0 + (Fintype.card (Fin (finrank ℚ + (∀ i : Option Pivot, optionLieSpace LG (fun j => (F.native j).L) i)))) + keepLong scheduleExponent Cprimitive x separation) := by + intro hmarkΦ hproduced + obtain ⟨retained, hsub, hmass, hpos, theta, W, v, den, hv, hW, hvH, hzero, + hden, hdenBound, denQ, hdenQ, hdenQBound, hdiv, hvQ, hWQ, hvQH, hfactorQ, + htop, hgradedTop, hterminal⟩ := hproduced + obtain ⟨hsourceGeo, hmarkedGeo, hforward, hentries, hnativeEntries, hcount, _, _⟩ := + geometry.ordinaryResetGeometry markGeometry hp0 hgeometry hmark hgenerator + refine ⟨retained, hsub, hmass, hpos, ?_⟩ + refine ⟨{ + model_filtration := by + change NilpotentLieFiltration.pi + (fun i => (optionFactors Mmark (fun j => (F.native j).model) i).filtration) = _ + congr 1 + funext i + cases i <;> rfl + nonnegative := hp0 + source_geometry := hsourceGeo + marked_geometry := hmarkedGeo + marked_basis_height := ?_ + mark_height := hnativeEntries + generator_count := ?_ + variable_count := hvariables + cost_bound := hcost + short := hshort + W := _ + generators := _ + span := hvQ + graded := hWQ + generator_height := fun a i => (hvQH a i).trans hprojection + q := (pProj + 2) ^ 3 + qCommon + q_bound := hfactor + denominator := denQ + denominator_pos := hdenQ + denominator_bound := hdenQBound.trans (Real.exp_le_exp.mpr hprojection) + zero_factors := hfactorQ + top_kernel := htop + surjective := ?_ + terminal := hterminal + }⟩ + · intro i j + exact hforward j i + · exact hcount + · exact D.nativeOptionFixedSourceQuotientMark_layer_surjective Mmark + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ + (fun j => (F.native j).model) φ hker geometry.target hsurj + +end AllocatedExternalCandidateSpatialNativeFamily +end +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativePhysicalConclusion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativePhysicalConclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..98ccc1f7a27261098db1cee56ef886a5a86b8c7c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativePhysicalConclusion.lean @@ -0,0 +1,204 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeOrdinaryTerminal + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +attribute [local irreducible] polynomialOrbitRealChart piRealOrbit + weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom realSymbolGradeEvaluation + CertifiedFullChartFiniteHistory.outer + CertifiedFullChartFiniteHistory.earlyForwardBranchTree realGradedSymbolPolynomial + +noncomputable section + +variable {m : ℕ} {G X : Type} [Fintype G] [Fintype X] + {I J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {Deck : Fin m → Type} {Pivot : Type} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ : ℕ} {D : RationalFilteredNilmanifold LG (s + 1) d₀} + {dMark : ℕ} {Mmark : RationalFilteredNilmanifold LM (s + 1) dMark} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Mmark.filtration.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck A.Path Pivot D Mmark.filtration φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + + (keepLong : LayerSamplerVariables G I n B → Prop) + (H : Finset A.Path) + (sourceCenter : ∀ j, U j) + (hpath : ∀ a ∈ H, (F.sourceChart a).path = a) + (hcenter : ∀ a ∈ H, (F.sourceChart a).centerLift = sourceCenter) + (hfrozen : ∀ a ∈ H, ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost) + (observable : (X → ℤ) → D.Space → ℂ) (weight : (X → ℤ) → ℂ) + (scoreThreshold : ℝ) + (hscore : ∀ a ∈ H, scoreThreshold ≤ (F.sourceCandidate a).score observable weight) + +variable (js : List Pivot) {dQ : ℕ} + (Q : RationalFilteredNilmanifold + (LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js) (s + 1) dQ) + (hQ : Q.filtration = D.filtration.pivotQuotientFiltration φ F.η js) + (hker : ∀ z ∈ D.filtration.pivotAnnihilatorIdeal φ F.η js, φ z = 0) + +local notation "LQuot" => LG ⧸ D.filtration.pivotAnnihilatorIdeal φ F.η js + +variable + {pGeometry adaptedBudget markInput markBudget : ℝ} + (geometry : (optionProduct D (fun j => (F.native j).model)).AdaptedMapGeometryData + (optionProduct Q (fun j => (F.native j).model)) + (optionMarkedLieMap (L := fun j => (F.native j).L) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js))) ((pGeometry + 3) ^ 2) adaptedBudget) + (markGeometry : (optionProduct Q (fun j => (F.native j).model)).FixedSourceAdaptedMarkGeometryData + (optionProduct Mmark (fun j => (F.native j).model)) geometry.target + (optionMarkedLieMap (L := fun j => (F.native j).L) + (quotientInducedMark (D.filtration.pivotAnnihilatorIdeal φ F.η js) φ hker)) + markInput markBudget) + +variable {scheduleExponent Cprimitive : ℕ} {x qVertical qCommon pProj : ℝ} + +local notation "fullBudget" => nativePhysicalTerminalFullBudget + (s + 1) m Cprimitive scheduleExponent x +local notation "affineBudget" => nativePhysicalTerminalAffineBudget (s + 1) scheduleExponent x +local notation "ordinaryBudget" => candidatePhysicalOrdinaryBudget fullBudget +local notation "backendBudget" => allocatedAffineCanonicalBudget s ordinaryBudget fullBudget +local notation "separation" => Real.exp (candidatePrimitiveFreezingCutoff s 1 backendBudget) +local notation "recursiveBudget" => finiteFreezingRecursiveParameter + (candidatePrimitivePhysicalBudgetExponent s 1) backendBudget +local notation "factorMass" => Real.exp (-(verticalDecompositionBudget qVertical * + Fintype.card Pivot + ((qCommon + 2) ^ 5 + qCommon))) * A.law.mass H + +theorem conclusion_of_actualAdaptedPivotQuotientLongPhysicalTerminal + (hφ : ∀ k, ∀ z ∈ D.filtration.layer k, φ z ∈ Mmark.filtration.layer k) + (hsurj : ∀ k, ∀ y ∈ Mmark.filtration.layer k, + ∃ z ∈ D.filtration.layer k, φ z = y) + (hx : 0 ≤ x) + (hgeometry : adaptedBudget ≤ fullBudget) (hmark : markBudget ≤ fullBudget) + (hjoint : (pGeometry + 3) ^ 2 ≤ fullBudget) + (hvariables : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ fullBudget) + (hprojection : (pProj + 2) ^ 4 ≤ fullBudget) + (hfactor : (pProj + 2) ^ 3 + qCommon ≤ fullBudget) + (hcost : cost ≤ fullBudget) + (hshort : ∀ i, ¬keepLong i → (A.sides i : ℝ) ≤ Real.exp fullBudget) + (hweight : ∀ y, ‖weight y‖ ≤ Real.exp fullBudget) + (hscoreBound : Real.exp (-fullBudget) ≤ scoreThreshold) + (hmassBound : Real.exp (-fullBudget) ≤ factorMass) + {e : ℕ} + (outputCost : ℝ) + (lowerIH : A.DegreeGlobalizationAt (E := Deck) weight s + (refilteredQuotientNetExponent.{0, 0, 0} s 1 e + 2) recursiveBudget outputCost) + (houtput : recursiveBudget ≤ outputCost) : + ∀ [TopologicalSpace (ℝ ⊗[ℚ] LQuot)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LQuot)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LQuot)] [T2Space (ℝ ⊗[ℚ] LQuot)] + [TopologicalSpace (ℝ ⊗[ℚ] (∀ i : Option Pivot, optionLieSpace LQuot (fun j => (F.native j).L) i))] [IsTopologicalAddGroup (ℝ ⊗[ℚ] (∀ i : Option Pivot, optionLieSpace LQuot (fun j => (F.native j).L) i))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (∀ i : Option Pivot, optionLieSpace LQuot (fun j => (F.native j).L) i))] [T2Space (ℝ ⊗[ℚ] (∀ i : Option Pivot, optionLieSpace LQuot (fun j => (F.native j).L) i))] + (descendedTests : (X → ℤ) → Q.Niltest (fullTaggedVariableWeight (X := X) J)) + (hrecovery : ∀ x (g : D.RealGroup), + (descendedTests x).observable (QuotientGroup.mk + (realificationMap (L := LG) (M := LQuot) (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := Q.filtration.lowerCentralSeries_eq_bot) + (lieQuotientMap (D.filtration.pivotAnnihilatorIdeal φ F.η js)) g)) = + (observable : (X → ℤ) → D.Space → ℂ) x (QuotientGroup.mk g)) + (hpGeometry : 0 ≤ pGeometry) (hQgeometry : Q.GeometryComplexityLE pGeometry) + (hunit : ∀ y, (descendedTests y).UnitIntervalValued) + (hcomplexity : ∀ y, (descendedTests y).ComplexityLE pGeometry) + (hnet : ∀ accuracy : ℝ, 0 < accuracy → accuracy ≤ 1 → ∃ count : ℕ, + (count : ℝ) ≤ Real.exp ((fullBudget + Real.log (1 / accuracy) + e) ^ e) ∧ + ∃ centers : Fin count → integerBox N, + ∀ y ∈ integerBox N, ∃ i, ∀ z, + ‖(fun x => (descendedTests x).observable) y z - (fun x => (descendedTests x).observable) (centers i).val z‖ ≤ accuracy), + let hmarkΦ := D.nativeOptionFixedSourceQuotientMark_mem_layer Mmark + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ + (fun j => (F.native j).model) φ hker hφ geometry.target + F.ActualAdaptedPivotQuotientLongPhysicalTerminal keepLong H sourceCenter hpath hcenter hfrozen + observable weight scoreThreshold hscore geometry.source.basis geometry.source.weight + geometry.source.layers js Q hQ hker (fun x => (descendedTests x).observable) hrecovery geometry.target + markGeometry.target.basis markGeometry.target.weight + (Mmark.optionAdaptedModel_layers (fun j => (F.native j).model) markGeometry.target) hmarkΦ + scheduleExponent Cprimitive x separation qVertical qCommon pProj → + ∃ (retained : Finset A.Path) (hsub : retained ⊆ H) + (hmass : factorMass ≤ A.law.mass retained), + 0 < A.law.mass retained ∧ + let source := F.actualSourceProblemOn H sourceCenter hpath hcenter hfrozen observable weight + scoreThreshold hscore retained hsub hmass + let target := (source.withKeep keep (fun _ => rfl)).adaptedOptionQuotient + (fun j => (F.native j).model) (fun j => ((F.native j).test.fullTaggedSpatial J).orbit) + (D.filtration.pivotAnnihilatorIdeal φ F.η js) + (by rw [D.filtration.terminal]; exact bot_le) Q hQ hker (fun x => (descendedTests x).observable) hrecovery geometry.target + Nonempty (target.Conclusion outputCost (Real.exp (-outputCost)) (Real.exp (-outputCost))) := by + classical + intro _ _ _ _ _ _ _ _ descendedTests hrecovery hpGeometry hQgeometry hunit hcomplexity hnet + hmarkΦ hterminal + obtain ⟨ha, hw, hpFull⟩ := + nativePhysicalTerminalBudgets_nonneg (s + 1) m Cprimitive scheduleExponent hx + have hcenterBudget : certifiedAffineCenterBudget affineBudget ≤ fullBudget := + (allocatedCandidateTerminalFullInput_bounds (s + 1) m Cprimitive hx hw ha).2.2.2.2.2.2.1 + have hordinary := candidatePhysicalOrdinaryBudget_bounds hpFull + have hscalar := hordinary.2.1 + obtain ⟨retained, hsub, hmass, hpos, packet⟩ := + F.ordinaryData_of_actualAdaptedPivotQuotientLongPhysicalTerminal keepLong H sourceCenter + hpath hcenter hfrozen observable weight scoreThreshold hscore js Q hQ hker (fun x => (descendedTests x).observable) + hrecovery geometry markGeometry hφ hsurj hordinary.1 + (hgeometry.trans hscalar) (hmark.trans hscalar) (hjoint.trans hscalar) + (hvariables.trans hscalar) (hprojection.trans hscalar) (hfactor.trans hscalar) + (hcost.trans hscalar) + (fun i hi => (hshort i hi).trans (Real.exp_le_exp.mpr hscalar)) hterminal + obtain ⟨packet⟩ := packet + obtain ⟨hpositive, _hnorm, hLip, hnetTransfer⟩ := + geometry.optionTarget_observable_regularity Q (fun j => (F.native j).model) + descendedTests hpGeometry hQgeometry hunit hcomplexity + have hnet' := hnetTransfer (integerBox N) + (fun accuracy => Real.exp ((fullBudget + Real.log (1 / accuracy) + e) ^ e)) hnet + refine ⟨retained, hsub, hmass, hpos, ?_⟩ + apply packet.conclusion_of_bounds rfl F.hσ1 F.Cgeo F.hCgeo F.hchart F.hsmall F.hpoly + (fun y => (hweight y).trans (Real.exp_le_exp.mpr hscalar)) + ((Real.exp_le_exp.mpr (neg_le_neg hscalar)).trans hscoreBound) + (candidatePhysicalOrdinaryBudget_mass hpFull ha hcenterBudget hmassBound) + F.hξ ⟨Real.exp (nativeOptionTargetObservableBudget pGeometry), Real.exp_nonneg _⟩ + (Real.exp_le_exp.mpr (candidatePhysicalOrdinaryBudget_observable hpFull hjoint)) + hLip hpositive ?_ outputCost lowerIH houtput + intro accuracy haccuracy haccuracy1 + obtain ⟨count, hcount, centers, hcenters⟩ := hnet' accuracy haccuracy haccuracy1 + refine ⟨count, hcount.trans ?_, centers, hcenters⟩ + apply Real.exp_le_exp.mpr + have hlog : 0 ≤ Real.log (1 / accuracy) := + Real.log_nonneg ((one_le_div haccuracy).mpr haccuracy1) + exact pow_le_pow_left₀ (by positivity) (by linarith only [hscalar]) e + +end AllocatedExternalCandidateSpatialNativeFamily +end +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeReindex.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..4778c87cc68cfc88e61326b73e7cf1aaaef4a55a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalCandidateSpatialNativeReindex.lean @@ -0,0 +1,165 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedExternalCandidateSpatialNativeBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct NNReal + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center) + +namespace AllocatedExternalCandidateSpatialNativeFamily + +variable {A} {Deck : Fin m → Type*} {Ω Pivot : Type*} [Fintype Pivot] + {LG LM : Type} + [LieRing LG] [LieAlgebra ℚ LG] [LieRing LM] [LieAlgebra ℚ LM] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d₀ t : ℕ} {D : RationalFilteredNilmanifold LG s d₀} + {Fmark : NilpotentLieFiltration LM t} {φ : LG →ₗ⁅ℚ⁆ LM} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {keep : LayerSamplerVariables G I n B → Prop} + {cost p pLocal pNative r periodCap coverCap : ℝ} {Lip : ℝ≥0} + (F : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip) + +def reindex {Ω' : Type*} (f : Ω' → Ω) : + AllocatedExternalCandidateSpatialNativeFamily A Deck Ω' Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip where + hpoly := F.hpoly + hτ1 := F.hτ1 + hξ := F.hξ + hσ1 := F.hσ1 + Cgeo := F.Cgeo + hCgeo := F.hCgeo + hchart := F.hchart + hsmall := F.hsmall + sourceChart := fun a => F.sourceChart (f a) + keep_eq := fun a => F.keep_eq (f a) + sourceCandidate := fun a => F.sourceCandidate (f a) + reference := fun a => F.reference (f a) + nativeValue := F.nativeValue + native := F.native + twist := fun a => F.twist (f a) + hp := F.hp + hpLocal := F.hpLocal + hr := F.hr + hcost := F.hcost + hlocal := F.hlocal + hnative := F.hnative + hperiod := fun a => F.hperiod (f a) + hvariation := F.hvariation + hV := fun a => F.hV (f a) + η := F.η + hηheight := F.hηheight + hη := fun a => F.hη (f a) + hK := F.hK + +@[simp] theorem reindex_nativeValue {Ω' : Type*} (f : Ω' → Ω) : + (F.reindex f).nativeValue = F.nativeValue := rfl + +@[simp] theorem reindex_native {Ω' : Type*} (f : Ω' → Ω) : + (F.reindex f).native = F.native := rfl + +@[simp] theorem reindex_η {Ω' : Type*} (f : Ω' → Ω) : + (F.reindex f).η = F.η := rfl + +@[simp] theorem reindex_sourceChart {Ω' : Type*} (f : Ω' → Ω) (a : Ω') : + (F.reindex f).sourceChart a = F.sourceChart (f a) := rfl + +@[simp] theorem reindex_sourceCandidate {Ω' : Type*} (f : Ω' → Ω) (a : Ω') : + (F.reindex f).sourceCandidate a = F.sourceCandidate (f a) := rfl + +@[simp] theorem reindex_correlation {Ω' : Type*} (f : Ω' → Ω) (a : Ω') (j : Pivot) : + (F.reindex f).correlation a j = F.correlation (f a) j := rfl + +@[simp] theorem reindex_jointOrbit {Ω' : Type*} (f : Ω' → Ω) (a : Ω') : + (F.reindex f).jointOrbit a = F.jointOrbit (f a) := rfl + +def positiveMassRetract [Fintype Ω] + (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) (hH : 0 < outer.mass H) + (a : Ω) : {a // a ∈ H} := by + have hne : H.Nonempty := Finset.nonempty_iff_ne_empty.mpr (by + intro he + simp only [he, FiniteProbabilityWeights.mass, Finset.sum_empty, + lt_self_iff_false] at hH) + exact if ha : a ∈ H then ⟨a, ha⟩ else ⟨hne.choose, hne.choose_spec⟩ + +@[simp] theorem positiveMassRetract_mem [Fintype Ω] + (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) (hH : 0 < outer.mass H) + (a : Ω) (ha : a ∈ H) : + positiveMassRetract outer H hH a = ⟨a, ha⟩ := by + simp only [positiveMassRetract, dite_eq_left ha] + +variable [Fintype Ω] (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) + (hH : 0 < outer.mass H) + (FH : AllocatedExternalCandidateSpatialNativeFamily A Deck {a // a ∈ H} Pivot + D Fmark φ marked keep cost p pLocal pNative r periodCap coverCap Lip) + +def extend : AllocatedExternalCandidateSpatialNativeFamily A Deck Ω Pivot D Fmark φ marked + keep cost p pLocal pNative r periodCap coverCap Lip := + FH.reindex (positiveMassRetract outer H hH) + +@[simp] theorem extend_nativeValue : + (FH.extend outer H hH).nativeValue = FH.nativeValue := rfl + +@[simp] theorem extend_native : + (FH.extend outer H hH).native = FH.native := rfl + +@[simp] theorem extend_η : + (FH.extend outer H hH).η = FH.η := rfl + +@[simp] theorem extend_sourceChart (a : Ω) (ha : a ∈ H) : + (FH.extend outer H hH).sourceChart a = FH.sourceChart ⟨a, ha⟩ := by + change FH.sourceChart (positiveMassRetract outer H hH a) = _ + rw [positiveMassRetract_mem outer H hH a ha] + +@[simp] theorem extend_sourceCandidate (a : Ω) (ha : a ∈ H) : + HEq ((FH.extend outer H hH).sourceCandidate a) (FH.sourceCandidate ⟨a, ha⟩) := by + change HEq (FH.sourceCandidate (positiveMassRetract outer H hH a)) _ + rw [positiveMassRetract_mem outer H hH a ha] + +@[simp] theorem extend_correlation (a : Ω) (ha : a ∈ H) (j : Pivot) : + (FH.extend outer H hH).correlation a j = FH.correlation ⟨a, ha⟩ j := by + change FH.correlation (positiveMassRetract outer H hH a) j = _ + rw [positiveMassRetract_mem outer H hH a ha] + +@[simp] theorem extend_jointOrbit (a : Ω) (ha : a ∈ H) : + (FH.extend outer H hH).jointOrbit a = FH.jointOrbit ⟨a, ha⟩ := by + change FH.jointOrbit (positiveMassRetract outer H hH a) = _ + rw [positiveMassRetract_mem outer H hH a ha] + +end AllocatedExternalCandidateSpatialNativeFamily + +end + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalCandidateOptionQuotientChart.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalCandidateOptionQuotientChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..65ac0a666edfbfc9a64603b4eecbb37448611307 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalCandidateOptionQuotientChart.lean @@ -0,0 +1,99 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalCandidateAdaptedOptionQuotientFactors +import OAI.Combinatorics.Progressions.Polynomial.RealPolynomialGroupMapChart + +namespace OAI + +section + +universe u v + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open RationalFilteredNilmanifold +open scoped BigOperators Classical TensorProduct + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I Deck J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + {cost : ℝ} {C : AllocatedExternalLocalChart (E := Deck) A cost} + {Pivot : Type v} [Fintype Pivot] + {L M : Type u} {P : Pivot → Type u} + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [∀ j, LieRing (P j)] [∀ j, LieAlgebra ℚ (P j)] + {s d dQ : ℕ} {dp : Pivot → ℕ} {D : RationalFilteredNilmanifold L s d} + {Fmark : NilpotentLieFiltration M s} {φ : L →ₗ⁅ℚ⁆ M} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + +namespace AllocatedExternalLocalCandidate + +variable (candidate : AllocatedExternalLocalCandidate C D Fmark φ marked) + (ideal : LieIdeal ℚ L) (hI : D.filtration.layer (s + 1) ≤ ideal.toSubmodule) + (Q : RationalFilteredNilmanifold (L ⧸ ideal) s dQ) + (hQ : Q.filtration = D.filtration.quotientLie ideal hI) + (hker : ∀ x ∈ ideal, φ x = 0) + (partners : ∀ j, RationalFilteredNilmanifold (P j) s (dp j)) + (partnerOrbit : ∀ j, (partners j).filtration.realification.PolynomialOrbit + (fullTaggedVariableWeight (X := X) J)) + +attribute [local irreducible] NilpotentLieFiltration.realPolynomialGroupMap + NilpotentLieFiltration.weightedAdaptedRealChartHom + +theorem optionJoint_lieQuotient_chart_polynomialCoordinates + {K : Type*} (β : C.Variables → MvPolynomial K ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE (fun _ : K => 1) 1) : + (optionProduct Q partners).filtration.weightedAdaptedRealChartHom + (fun _ : C.Variables => 1) (fun _ : K => 1) β hβ + ((optionProduct Q partners).filtration.realification.polynomialOrbitCoordinates + (fun _ : C.Variables => 1) + ((candidate.lieQuotient ideal hI Q hQ hker).optionJoint partners partnerOrbit).orbit) = + (optionProduct D partners).filtration.realPolynomialGroupMap + (optionProduct Q partners).filtration + (optionMarkedLieMap (L := P) (lieQuotientMap ideal)) + (D.optionQuotientMap_mem_layer ideal hI Q hQ partners) + (fun _ : K => 1) + ((optionProduct D partners).filtration.weightedAdaptedRealChartHom + (fun _ : C.Variables => 1) (fun _ : K => 1) β hβ + ((optionProduct D partners).filtration.realification.polynomialOrbitCoordinates + (fun _ : C.Variables => 1) (candidate.optionJoint partners partnerOrbit).orbit)) := by + calc + _ = (optionProduct Q partners).filtration.weightedAdaptedRealChartHom + (fun _ : C.Variables => 1) (fun _ : K => 1) β hβ + ((optionProduct D partners).filtration.realPolynomialGroupMap + (optionProduct Q partners).filtration + (optionMarkedLieMap (L := P) (lieQuotientMap ideal)) + (D.optionQuotientMap_mem_layer ideal hI Q hQ partners) + (fun _ : C.Variables => 1) + ((optionProduct D partners).filtration.realification.polynomialOrbitCoordinates + (fun _ : C.Variables => 1) (candidate.optionJoint partners partnerOrbit).orbit)) := + congrArg ((optionProduct Q partners).filtration.weightedAdaptedRealChartHom + (fun _ : C.Variables => 1) (fun _ : K => 1) β hβ) + (candidate.optionJoint_lieQuotient_polynomialCoordinates + ideal hI Q hQ hker partners partnerOrbit) + _ = _ := ((optionProduct D partners).filtration.realPolynomialGroupMap_weightedAdaptedRealChartHom + (optionProduct Q partners).filtration + (optionMarkedLieMap (L := P) (lieQuotientMap ideal)) + (D.optionQuotientMap_mem_layer ideal hI Q hQ partners) + (fun _ : C.Variables => 1) (fun _ : K => 1) β hβ + ((optionProduct D partners).filtration.realification.polynomialOrbitCoordinates + (fun _ : C.Variables => 1) (candidate.optionJoint partners partnerOrbit).orbit)).symm + +end AllocatedExternalLocalCandidate +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalChartKeepBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalChartKeepBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..b09e16e52e62a091d099dd35f6466bb4486be29f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalChartKeepBounds.lean @@ -0,0 +1,376 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalCandidateRefinementLabels + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalLocalChart + +variable {cost : ℝ} (C : AllocatedExternalLocalChart (E := E) A cost) + (keep : LayerSamplerVariables G I n B → Prop) (hkeep : C.keep = keep) + +noncomputable def withKeep : AllocatedExternalLocalChart (E := E) A cost where + path := C.path + path_supported := C.path_supported + centerLift := C.centerLift + center_eq := C.center_eq + sample := C.sample + read := C.read + recovered := C.recovered + keep := keep + fixed := hkeep ▸ C.fixed + fixed_in_box := by cases hkeep; exact C.fixed_in_box + step := C.step + step_pos := C.step_pos + slice := hkeep ▸ C.slice + dense := by cases hkeep; exact C.dense + +@[simp] theorem withKeep_self : C.withKeep C.keep rfl = C := rfl + +theorem withKeep_slice_transport {q : ℕ} {outputCost outputScore : ℝ} + (slice : ResidueBoxSlice (fun i : {i // keep i} => A.sides i.val) q) + (hdense : IsDenseCommonStrideBox (fun i : {i // keep i} => A.sides i.val) + outputCost slice.integerPoints) + (hinside : slice.integerPoints ⊆ (C.withKeep keep hkeep).slice.integerPoints) + (f : (X → ℤ) → (X ⊕ (Σ j, J j) → ℤ) → ℂ) + (hscore : outputScore ≤ (𝔼 u ∈ slice.integerPoints, + f ((C.withKeep keep hkeep).physical u) ((C.withKeep keep hkeep).chartValues u)).re) : + ∃ oldSlice : ResidueBoxSlice (fun i : C.Variables => A.sides i.val) q, + IsDenseCommonStrideBox (fun i : C.Variables => A.sides i.val) + outputCost oldSlice.integerPoints ∧ + oldSlice.integerPoints ⊆ C.slice.integerPoints ∧ + outputScore ≤ (𝔼 u ∈ oldSlice.integerPoints, f (C.physical u) (C.chartValues u)).re := by + cases hkeep + exact ⟨slice, hdense, hinside, hscore⟩ + +end AllocatedExternalLocalChart + +variable {L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {r d t : ℕ} + {D : RationalFilteredNilmanifold L r d} {Fmark : NilpotentLieFiltration M t} + {φ : L →ₗ⁅ℚ⁆ M} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {observable : (X → ℤ) → D.Space → ℂ} {weight : (X → ℤ) → ℂ} + +namespace AllocatedExternalLocalCandidate + +variable {cost : ℝ} {C : AllocatedExternalLocalChart (E := E) A cost} + (candidate : AllocatedExternalLocalCandidate C D Fmark φ marked) + (keep : LayerSamplerVariables G I n B → Prop) (hkeep : C.keep = keep) + +noncomputable def withKeep : + AllocatedExternalLocalCandidate (C.withKeep keep hkeep) D Fmark φ marked := by + cases hkeep + exact candidate + +@[simp] theorem withKeep_score : + (candidate.withKeep keep hkeep).score observable weight = candidate.score observable weight := by + cases hkeep + rfl + +end AllocatedExternalLocalCandidate + +namespace AllocatedExternalCandidateProblem + +variable {cost massThreshold scoreThreshold : ℝ} + (P : AllocatedExternalCandidateProblem (E := E) A D Fmark φ marked observable weight + cost massThreshold scoreThreshold) + (keep : LayerSamplerVariables G I n B → Prop) + (hkeep : ∀ z : P.productive, (P.chart z).keep = keep) + +noncomputable def withKeep : + AllocatedExternalCandidateProblem (E := E) A D Fmark φ marked observable weight + cost massThreshold scoreThreshold where + productive := P.productive + mass := P.mass + chart z := (P.chart z).withKeep keep (hkeep z) + chart_path := P.chart_path + centerLift := P.centerLift + chart_centerLift := P.chart_centerLift + frozen_side z := by + change ∀ i : {i // ¬keep i}, (A.sides i.val : ℝ) ≤ Real.exp cost + rw [← hkeep z] + exact P.frozen_side z + candidate z := (P.candidate z).withKeep keep (hkeep z) + score z := by rw [AllocatedExternalLocalCandidate.withKeep_score]; exact P.score z + +@[simp] theorem withKeep_chart_keep (z : P.productive) : + ((P.withKeep keep hkeep).chart z).keep = keep := rfl + +noncomputable def conclusion_of_withKeep {outputCost outputMass outputScore : ℝ} + (result : (P.withKeep keep hkeep).Conclusion outputCost outputMass outputScore) : + P.Conclusion outputCost outputMass outputScore := by + have hex (z : result.retained) : + ∃ slice : ResidueBoxSlice + (fun i : (P.chart ⟨z.val, result.subset z.property⟩).Variables => A.sides i.val) + (result.step z), + IsDenseCommonStrideBox + (fun i : (P.chart ⟨z.val, result.subset z.property⟩).Variables => A.sides i.val) + outputCost slice.integerPoints ∧ + slice.integerPoints ⊆ (P.chart ⟨z.val, result.subset z.property⟩).slice.integerPoints ∧ + outputScore ≤ P.ambientScore result.ambient ⟨z.val, result.subset z.property⟩ + slice.integerPoints := by + exact (P.chart ⟨z.val, result.subset z.property⟩).withKeep_slice_transport + keep (hkeep _) (result.slice z) (result.dense z) (result.inside z) + (fun x y => weight x * observable x (QuotientGroup.mk + (D.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight J) + y result.ambient))) (result.score z) + choose slice hdense hinside hscore using hex + exact + { ambient := result.ambient + marked := result.marked + retained := result.retained + subset := result.subset + mass := result.mass + step := result.step + step_pos := result.step_pos + slice := slice + dense := hdense + inside := hinside + score := hscore } + +end AllocatedExternalCandidateProblem +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped BigOperators Classical TensorProduct + +noncomputable section + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I Deck J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalLocalChart + +variable {cost : ℝ} (C : AllocatedExternalLocalChart (E := Deck) A cost) + +theorem slice_transport_of_eq_withKeep + (keep : LayerSamplerVariables G I n B → Prop) (hkeep : C.keep = keep) + (C' : AllocatedExternalLocalChart (E := Deck) A cost) + (hchart : C' = C.withKeep keep hkeep) + {q : ℕ} {outputCost outputScore : ℝ} + (slice : ResidueBoxSlice (fun i : C'.Variables => A.sides i.val) q) + (hdense : IsDenseCommonStrideBox (fun i : C'.Variables => A.sides i.val) + outputCost slice.integerPoints) + (hinside : slice.integerPoints ⊆ C'.slice.integerPoints) + (f : (X → ℤ) → (X ⊕ (Σ j, J j) → ℤ) → ℂ) + (hscore : outputScore ≤ (𝔼 u ∈ slice.integerPoints, + f (C'.physical u) (C'.chartValues u)).re) : + ∃ oldSlice : ResidueBoxSlice (fun i : C.Variables => A.sides i.val) q, + IsDenseCommonStrideBox (fun i : C.Variables => A.sides i.val) + outputCost oldSlice.integerPoints ∧ + oldSlice.integerPoints ⊆ C.slice.integerPoints ∧ + outputScore ≤ (𝔼 u ∈ oldSlice.integerPoints, f (C.physical u) (C.chartValues u)).re := by + subst C' + exact C.withKeep_slice_transport keep hkeep slice hdense hinside f hscore + +end AllocatedExternalLocalChart + +namespace AllocatedExternalCandidateProblem + +variable {L M : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s d t : ℕ} {D : RationalFilteredNilmanifold L s d} + {Fmark : NilpotentLieFiltration M t} {φ : L →ₗ⁅ℚ⁆ M} + {marked : Fmark.realification.PolynomialOrbit (fullTaggedVariableWeight (X := X) J)} + {observable : (X → ℤ) → D.Space → ℂ} {weight : (X → ℤ) → ℂ} + {cost massThreshold scoreThreshold massThreshold' scoreThreshold' : ℝ} + (P : AllocatedExternalCandidateProblem (E := Deck) A D Fmark φ marked + observable weight cost massThreshold scoreThreshold) + (Q : AllocatedExternalCandidateProblem (E := Deck) A D Fmark φ marked + observable weight cost massThreshold' scoreThreshold') + +def conclusion_of_chartwise_withKeep + (hsub : Q.productive ⊆ P.productive) + (keep : LayerSamplerVariables G I n B → Prop) + (hkeep : ∀ z : Q.productive, (P.chart ⟨z.val, hsub z.property⟩).keep = keep) + (hchart : ∀ z : Q.productive, + Q.chart z = (P.chart ⟨z.val, hsub z.property⟩).withKeep keep (hkeep z)) + {outputCost outputMass outputScore : ℝ} + (result : Q.Conclusion outputCost outputMass outputScore) : + P.Conclusion outputCost outputMass outputScore := by + have hex (z : result.retained) : + ∃ slice : ResidueBoxSlice + (fun i : (P.chart ⟨z.val, hsub (result.subset z.property)⟩).Variables => A.sides i.val) + (result.step z), + IsDenseCommonStrideBox + (fun i : (P.chart ⟨z.val, hsub (result.subset z.property)⟩).Variables => A.sides i.val) + outputCost slice.integerPoints ∧ + slice.integerPoints ⊆ (P.chart ⟨z.val, hsub (result.subset z.property)⟩).slice.integerPoints ∧ + outputScore ≤ P.ambientScore result.ambient + ⟨z.val, hsub (result.subset z.property)⟩ slice.integerPoints := by + exact (P.chart ⟨z.val, hsub (result.subset z.property)⟩).slice_transport_of_eq_withKeep + keep (hkeep ⟨z.val, result.subset z.property⟩) + (Q.chart ⟨z.val, result.subset z.property⟩) (hchart ⟨z.val, result.subset z.property⟩) + (result.slice z) (result.dense z) (result.inside z) + (fun x y => weight x * observable x (QuotientGroup.mk + (D.filtration.realification.polynomialOrbitEval (fullTaggedVariableWeight J) + y result.ambient))) (result.score z) + choose slice hdense hinside hscore using hex + exact { + ambient := result.ambient + marked := result.marked + retained := result.retained + subset := fun _ hz => hsub (result.subset hz) + mass := result.mass + step := result.step + step_pos := result.step_pos + slice := slice + dense := hdense + inside := hinside + score := hscore + } + +@[simp] theorem conclusion_of_chartwise_withKeep_retained + (hsub : Q.productive ⊆ P.productive) + (keep : LayerSamplerVariables G I n B → Prop) + (hkeep : ∀ z : Q.productive, (P.chart ⟨z.val, hsub z.property⟩).keep = keep) + (hchart : ∀ z : Q.productive, + Q.chart z = (P.chart ⟨z.val, hsub z.property⟩).withKeep keep (hkeep z)) + {outputCost outputMass outputScore : ℝ} + (result : Q.Conclusion outputCost outputMass outputScore) : + (P.conclusion_of_chartwise_withKeep Q hsub keep hkeep hchart result).retained = + result.retained := rfl + +@[simp] theorem conclusion_of_chartwise_withKeep_ambient + (hsub : Q.productive ⊆ P.productive) + (keep : LayerSamplerVariables G I n B → Prop) + (hkeep : ∀ z : Q.productive, (P.chart ⟨z.val, hsub z.property⟩).keep = keep) + (hchart : ∀ z : Q.productive, + Q.chart z = (P.chart ⟨z.val, hsub z.property⟩).withKeep keep (hkeep z)) + {outputCost outputMass outputScore : ℝ} + (result : Q.Conclusion outputCost outputMass outputScore) : + (P.conclusion_of_chartwise_withKeep Q hsub keep hkeep hchart result).ambient = + result.ambient := rfl + +end AllocatedExternalCandidateProblem + +end + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration +open scoped BigOperators Classical TensorProduct +attribute [local irreducible] weightedAdaptedRealChartHom + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + +namespace AllocatedExternalLocalChart + +variable {cost : ℝ} (C : AllocatedExternalLocalChart (E := E) A cost) + (keep : LayerSamplerVariables G I n B → Prop) (hkeep : C.keep = keep) + +theorem withKeep_chart_fixed + (β : X ⊕ (Σ j, J j) → MvPolynomial (X ⊕ (Σ j, J j)) ℝ) + (hfixed : ∀ x : C.Variables → ℝ, + (fun v => MvPolynomial.eval + (fun i => MvPolynomial.eval x (integerSampledRealChart C.integerChart i)) (β v)) = + (fun i => MvPolynomial.eval x (integerSampledRealChart C.integerChart i))) : + ∀ x : (C.withKeep keep hkeep).Variables → ℝ, + (fun v => MvPolynomial.eval + (fun i => MvPolynomial.eval x + (integerSampledRealChart (C.withKeep keep hkeep).integerChart i)) (β v)) = + (fun i => MvPolynomial.eval x + (integerSampledRealChart (C.withKeep keep hkeep).integerChart i)) := by + cases hkeep + exact hfixed + +theorem withKeep_polynomialSlowBound + {L κ : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (basis : Basis κ ℚ L) + (g : (F.realification.adaptedPolynomialFiltration (fullTaggedVariableWeight (X := X) J)).Group) + (M : ℝ) + (hslow : F.PolynomialSlowBound basis (fun _ : C.Variables => 1) + (fun i : C.Variables => (A.sides i.val : ℝ)) M + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : C.Variables => 1) (integerSampledRealChart C.integerChart) + C.integerChart_support g)) : + F.PolynomialSlowBound basis (fun _ : (C.withKeep keep hkeep).Variables => 1) + (fun i : (C.withKeep keep hkeep).Variables => (A.sides i.val : ℝ)) M + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : (C.withKeep keep hkeep).Variables => 1) + (integerSampledRealChart (C.withKeep keep hkeep).integerChart) + (C.withKeep keep hkeep).integerChart_support g) := by + cases hkeep + exact hslow + +theorem withKeep_dense (dCost : ℝ) + (hdense : IsDenseCommonStrideBox (fun i : C.Variables => A.sides i.val) + dCost C.slice.integerPoints) : + IsDenseCommonStrideBox (fun i : (C.withKeep keep hkeep).Variables => A.sides i.val) + dCost (C.withKeep keep hkeep).slice.integerPoints := by + cases hkeep + exact hdense + +theorem withKeep_original_dense : + IsDenseCommonStrideBox (fun i : (C.withKeep keep hkeep).Variables => A.sides i.val) + cost (C.withKeep keep hkeep).slice.integerPoints := + C.withKeep_dense keep hkeep cost C.dense + +end AllocatedExternalLocalChart +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalChartOrbitValues.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalChartOrbitValues.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ad05526aae3c5ead703a947c90bee14a10641e2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedExternalLocalChartOrbitValues.lean @@ -0,0 +1,68 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalCandidateOptionJointConclusion + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel NilpotentLieFiltration NilpotentLieBCHGroup +open scoped Classical TensorProduct + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] + {I E J : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {A : AllocatedExternalCandidateSampler B U b S hb o hR hσ N poly hm τ ξ stride cells center} + {cost : ℝ} (C : AllocatedExternalLocalChart (E := E) A cost) + +namespace AllocatedExternalLocalChart + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + (g : (F.realification.adaptedPolynomialFiltration + (fullTaggedVariableWeight (X := X) J)).Group) + +theorem globalOrbit_chart_values (u : C.Variables → ℤ) : + F.adaptedPolynomialRealValueHom (fun _ : C.Variables => 1) (fun i => (u i : ℝ)) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : C.Variables => 1) (integerSampledRealChart C.integerChart) + C.integerChart_support g) = + F.realification.polynomialOrbitRealEval (fullTaggedVariableWeight J) + (fun i => (C.chartValues u i : ℝ)) + ((F.realification.polynomialOrbitCoordinates (fullTaggedVariableWeight J)).symm g) := by + rw [F.adaptedPolynomialRealValueHom_weightedChart] + have heval : (fun i => MvPolynomial.eval (fun j => (u j : ℝ)) + (integerSampledRealChart C.integerChart i)) = + (fun i => (C.chartValues u i : ℝ)) := by + funext i + exact integerSampledRealChart_eval C.integerChart u i + rw [heval] + rfl + +theorem globalOrbit_chart_integer_values (u : C.Variables → ℤ) : + F.adaptedPolynomialRealValueHom (fun _ : C.Variables => 1) (fun i => (u i : ℝ)) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : C.Variables => 1) (integerSampledRealChart C.integerChart) + C.integerChart_support g) = + F.realification.polynomialOrbitEval (fullTaggedVariableWeight J) (C.chartValues u) + ((F.realification.polynomialOrbitCoordinates (fullTaggedVariableWeight J)).symm g) := by + simpa only [polynomialOrbitRealEval_integer] using C.globalOrbit_chart_values F g u + +end AllocatedExternalLocalChart +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedFixedPathLiftSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedFixedPathLiftSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..32d2195213685bb1b8f6c0e0a80add26c7d97afb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedFixedPathLiftSupport.lean @@ -0,0 +1,102 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedSlicedIdealDensity + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical NNReal + +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 [∀ a, DecidableEq (B a)] +variable (P : LayerSamplerAxis I n → Prop) [DecidablePred P] +variable (R σ : Fin m → ℝ) + +local notation "degree" => layerSamplerDegree I n +local notation "Active" => {a // ¬P a} +local notation "Coeff" => ActiveProfileCoefficientIndex G B degree P +local notation "Input" => (Σ a : {a : LayerSamplerAxis I n // ¬P a}, + B (Subtype.val a) × Fin (layerSamplerDegree I n (Subtype.val a))) +local notation "Output" => (Σ _a : Active, Unit) + +omit [∀ a, DecidableEq (B a)] in +theorem allocatedFixedPathLiftMap_measurable + (lower width : ∀ a : Active, B a.val × Fin (degree a.val) → ℝ) (r : Coeff → ℝ) : + Measurable (allocatedFixedPathLiftMap B P R σ lower width r) := by + unfold allocatedFixedPathLiftMap jointSlicedPrincipal sigmaAxisSampler + principalSliceSingleton principalSliceValue + fun_prop + +omit [∀ a, DecidableEq (B a)] in +theorem allocatedFixedPathLiftMap_norm_le (hR : ∀ j, R j ≠ 0) + (lower width : ∀ a : Active, B a.val × Fin (degree a.val) → ℝ) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + (r : Coeff → ℝ) (hr : ∀ e, |r e| ≤ 1) + (x : Input → ℝ) (hx : ∀ p, |x p| ≤ 1) : + ‖allocatedFixedPathLiftMap B P R σ lower width r x‖ ≤ 2 := by + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)).mpr + intro o + have hp := principalSliceValue_abs_le + (jointSlicedProfilePrincipal degree Subtype.val (unitProfilePrincipalSize (B := B)) + (fun a e => r ⟨a,e⟩) o.1) + (lower o.1) (width o.1) (hwidth o.1) (fun p => x ⟨o.1,p⟩) (fun p => hx _) + have hm := jointSlicedProfilePrincipal_unit_mass degree Subtype.val + (fun a e => r ⟨a,e⟩) (fun _ _ => hr _) o.1 + have hc : |(1 / 4 : ℝ) * r ⟨o.1, constantCoefficientSlot _ _⟩| ≤ 1 / 4 := by + rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 4)] + exact mul_le_of_le_one_right (by norm_num) (hr _) + simp only [allocatedFixedPathLiftMap, allocatedFixedPathPrincipal_eq B P R σ hR, + allocatedFixedPathShift_eq B P R σ hR, Pi.add_apply] + change |(1 / 4 : ℝ) * r ⟨o.1, constantCoefficientSlot _ _⟩ + + principalSliceValue _ _ _ _| ≤ 2 + exact (abs_add_le _ _).trans ((add_le_add hc (hp.trans hm)).trans (by norm_num)) + +theorem allocatedFixedPathLiftDensity_zero_off_ball + (hR : ∀ j, R j ≠ 0) (hB : ∀ a : Active, 4 ≤ Fintype.card (B a.val)) + (lower width : ∀ a : Active, B a.val × Fin (degree a.val) → ℝ) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ : ℝ} (ha : 0 < a) (hδ : 0 < δ) + (hprincipal : ∀ j : Active, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (r : Coeff → ℝ) (hr : ∀ e, |r e| ≤ 1) + (z : Output → ℝ) (hz : 2 < ‖z‖) : + allocatedFixedPathLiftDensity B P R σ hB lower width r z = 0 := by + have hd := allocatedFixedPathLiftDensity_law_probability B P R σ hR hB lower width + ha hδ hprincipal hw hl r hr + have hb := allocatedFixedPathLiftDensity_cap_lipschitz B P R σ hR hB lower width + ha hδ hprincipal hw hl r hr + have hm := allocatedFixedPathLiftMap_measurable B P R σ lower width r + apply continuousDensity_zero_off_closed volume _ hb.2.continuous hd.2.1 + (S := Metric.closedBall 0 2) Metric.isClosed_closedBall ?_ z + (by simpa only [Metric.mem_closedBall, dist_zero_right, not_le] using hz) + rw [← hd.1] + apply (ae_map_iff hm.aemeasurable Metric.isClosed_closedBall.measurableSet).mpr + filter_upwards [unitBoxMeasure_ae] with x hx + simpa only [dist_zero_right] using + allocatedFixedPathLiftMap_norm_le B P R σ hR lower width hwidth r hr x + (fun p => by rw [abs_of_nonneg (hx p).1.le]; exact (hx p).2) + +theorem allocatedFixedPathLiftDensity_compact + (hR : ∀ j, R j ≠ 0) (hB : ∀ a : Active, 4 ≤ Fintype.card (B a.val)) + (lower width : ∀ a : Active, B a.val × Fin (degree a.val) → ℝ) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ : ℝ} (ha : 0 < a) (hδ : 0 < δ) + (hprincipal : ∀ j : Active, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (r : Coeff → ℝ) (hr : ∀ e, |r e| ≤ 1) : + HasCompactSupport (allocatedFixedPathLiftDensity B P R σ hB lower width r) := by + apply HasCompactSupport.intro (isCompact_closedBall (0 : Output → ℝ) 2) + intro z hz + exact allocatedFixedPathLiftDensity_zero_off_ball B P R σ hR hB lower width hwidth + ha hδ hprincipal hw hl r hr z + (by simpa only [Metric.mem_closedBall, dist_zero_right, not_le] using hz) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedFullSiteSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedFullSiteSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..20de7d2a3441eb6c7f37470569836e2aaebfc227 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedFullSiteSupport.lean @@ -0,0 +1,504 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCoveredSiteExpansion +import OAI.Combinatorics.Progressions.Estimates.AllocatedFullSiteRadius +import OAI.Combinatorics.Progressions.Linear.BufferedCoordinateProjection + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped Classical BigOperators + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +noncomputable def allocatedFullMixedSiteValue + (w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ)) : LayerSamplerAxis I n → ℝ + | ⟨j, .inl i⟩ => (w j).1 i / R j + | ⟨j, .inr i⟩ => ((w j).2 i : ℝ) / (basisAxisScale (b j) i : ℝ) / R j + +theorem allocatedFullMixedSiteValue_projection + (w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ)) : + coordinateZeroProjection (allocatedGridAxis (I := I) U b S.value) + (allocatedFullMixedSiteValue (R := R) U b w) = allocatedNormalizedMixedSiteValue B U b S w := by + funext a + rcases a with ⟨j, i | i⟩ <;> rfl + +omit [∀ j, Fintype (I j)] in +theorem allocatedFullMixedSiteValue_continuous : + Continuous (allocatedFullMixedSiteValue (I := I) (R := R) U b) := by + apply continuous_pi + rintro ⟨j, i | i⟩ + · change Continuous (fun w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ) => (w j).1 i / R j) + fun_prop + · change Continuous (fun w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ) => + ((w j).2 i : ℝ) / (basisAxisScale (b j) i : ℝ) / R j) + fun_prop + +theorem allocatedFullMixedSiteValue_point_bound + (hR : ∀ j, 0 < R j) (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ)) + {r : ℝ} (hr : 0 ≤ r) (hw : ∀ a, |allocatedFullMixedSiteValue (R := R) U b w a| ≤ r) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (j : Fin m) : + ‖normalizedLatticePoint (euclideanSubspace (U j)) (b j) (orthonormalMixedChart (o j) (w j))‖ ≤ + C j * (((Fintype.card (I j) : ℝ) + 1) * (r * R j)) := by + have hreal (i : I j) : |(w j).1 i| ≤ r * R j := by + have h := hw ⟨j, Sum.inl i⟩ + change |(w j).1 i / R j| ≤ r at h + rw [abs_div, abs_of_pos (hR j)] at h + exact (div_le_iff₀ (hR j)).mp h + have hint (i : Fin (n j)) : |((w j).2 i : ℝ) / basisAxisScale (b j) i| ≤ r * R j := by + have h := hw ⟨j, Sum.inr i⟩ + change |((w j).2 i : ℝ) / basisAxisScale (b j) i / R j| ≤ r at h + rw [abs_div, abs_of_pos (hR j)] at h + exact (div_le_iff₀ (hR j)).mp h + exact mixedRealPoint_norm_le (euclideanSubspace (U j)) (b j) (o j) (hC j) + (mul_nonneg hr (hR j).le) (hchart j) (w j).1 + (fun i => ((w j).2 i : ℝ) / basisAxisScale (b j) i) hreal hint + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "single" => (fun _ : Fin m => Unit) +local notation "quarter" => (fun j (_ : Unit) => standardLatticeClosedQuarterBox (J j)) +local notation "chart" => mixedCoveredJetChart (O := single) U o b hb bW d +local notation "region" => mixedCoveredJetRegion (O := single) (E := Q) U o b d quarter + +noncomputable def allocatedIdealSiteChartFactor (f : (LayerSamplerAxis I n → ℝ) → ℂ) : + EuclideanJetLayers U single → ℂ := + restrictedComplexChartDensity chart region 1 (fun z => + f (allocatedNormalizedMixedSiteValue B U b S + (fun j => mixedArrayRegroup _ _ _ (z.1 j) ()))) + +theorem allocatedIdealSiteChartFactor_norm_le + (f : (LayerSamplerAxis I n → ℝ) → ℂ) {C : ℝ} (hC : 0 ≤ C) (hf : ∀ v, ‖f v‖ ≤ C) + (y : EuclideanJetLayers U single) : ‖allocatedIdealSiteChartFactor B U b S o hb bW d f y‖ ≤ C := by + by_cases hy : y ∈ chart '' region + · obtain ⟨z, hz, rfl⟩ := hy + rw [allocatedIdealSiteChartFactor, restrictedComplexChartDensity_apply _ _ _ _ + (mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j))) hz, + Complex.ofReal_one, one_mul] + exact hf _ + · rw [allocatedIdealSiteChartFactor, restrictedComplexChartDensity_zero _ _ _ _ hy, norm_zero] + exact hC + +variable {α : Type*} [Fintype α] [DecidableEq α] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value + +theorem allocatedIdealSiteChartFactor_apply + (f : (LayerSamplerAxis I n → ℝ) → ℂ) (z : MixedCoveredJetSource I jets Q n d) + (s : Finset α) (hs : mixedCoveredBooleanSiteValue d z s ∈ region) : + allocatedIdealSiteChartFactor B U b S o hb bW d f + (coveredBooleanSiteValue U (mixedCoveredJetChart U o b hb bW d z) s) = + f (allocatedIdealSiteCoordinates B U b S ((coefficientJetAxisSplit jets I n grid z.1).2) s) := by + rw [← mixedCoveredBooleanSiteValue_chart U o b hb bW d z s] + rw [allocatedIdealSiteChartFactor, restrictedComplexChartDensity_apply _ _ _ _ + (mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j))) hs, + Complex.ofReal_one, one_mul] + change f (allocatedNormalizedMixedSiteValue B U b S (mixedBooleanSiteValue z.1 s)) = _ + rw [allocatedIdealSiteCoordinates_mixed_value] + +theorem allocatedIdealSiteChartFactor_product + (f : Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (z : MixedCoveredJetSource I jets Q n d) + (hs : ∀ s, mixedCoveredBooleanSiteValue d z s ∈ region) : + (∏ s, allocatedIdealSiteChartFactor B U b S o hb bW d (f s) + (coveredBooleanSiteValue U (mixedCoveredJetChart U o b hb bW d z) s)) = + ∏ s, f s (allocatedIdealSiteCoordinates B U b S ((coefficientJetAxisSplit jets I n grid z.1).2) s) := by + exact Finset.prod_congr rfl (fun s _ => allocatedIdealSiteChartFactor_apply B U b S o hb bW d (f s) z s (hs s)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (r : ℝ≥0) (hr : 0 < r) (f : (LayerSamplerAxis I n → ℝ) → ℂ) + +noncomputable def allocatedBufferedMixedSiteFactor + (w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ)) : ℂ := + bufferedCoordinateProjection (allocatedGridAxis (I := I) U b S.value) r hr f + (allocatedFullMixedSiteValue (R := R) U b w) + +theorem allocatedBufferedMixedSiteFactor_norm_le (hf : ∀ z, ‖f z‖ ≤ 1) + (w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ)) : + ‖allocatedBufferedMixedSiteFactor B U b S r hr f w‖ ≤ 1 := + bufferedCoordinateProjection_norm_le _ r hr f hf _ + +theorem allocatedBufferedMixedSiteFactor_continuous {L : ℝ≥0} + (hf : LipschitzWith L f) (hf1 : ∀ z, ‖f z‖ ≤ 1) : + Continuous (allocatedBufferedMixedSiteFactor B U b S r hr f) := + (bufferedCoordinateProjection_lipschitz _ r hr f hf hf1).continuous.comp + (allocatedFullMixedSiteValue_continuous (I := I) (R := R) U b) + +theorem allocatedBufferedMixedSiteFactor_eq + (w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ)) + (hw : ∀ a, |allocatedFullMixedSiteValue (R := R) U b w a| ≤ (r : ℝ)) : + allocatedBufferedMixedSiteFactor B U b S r hr f w = + f (allocatedNormalizedMixedSiteValue B U b S w) := by + rw [allocatedBufferedMixedSiteFactor, bufferedCoordinateProjection_eq _ r hr f _ hw, + allocatedFullMixedSiteValue_projection] + +theorem allocatedBufferedMixedSiteFactor_nonzero_point_bound + (hR : ∀ j, 0 < R j) (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (w : ∀ j : Fin m, (I j → ℝ) × (Fin (n j) → ℤ)) + (hw : allocatedBufferedMixedSiteFactor B U b S r hr f w ≠ 0) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (j : Fin m) : + ‖normalizedLatticePoint (euclideanSubspace (U j)) (b j) (orthonormalMixedChart (o j) (w j))‖ ≤ + C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) := by + exact allocatedFullMixedSiteValue_point_bound U b hR o w + (mul_nonneg (by norm_num) r.coe_nonneg) + (bufferedCoordinateProjection_nonzero_box _ r hr f _ hw) C hC hchart j + +theorem allocatedBufferedMixedSiteFactor_nonzero_mem_quarter + (hR : ∀ j, 0 < R j) (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + {Q : Fin m → Type*} (d : ℕ) + (z : MixedCoveredJetSource I (fun _ => Unit) Q n d) + (hz : allocatedBufferedMixedSiteFactor B U b S r hr f + (fun j => mixedArrayRegroup _ _ _ (z.1 j) ()) ≠ 0) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) : + z ∈ mixedCoveredJetRegion U o b d (fun j (_ : Unit) => standardLatticeClosedQuarterBox (J j)) := by + intro j _ t _ + refine ⟨?_, Set.mem_univ _⟩ + intro i + cases t + have h := (allocatedBufferedMixedSiteFactor_nonzero_point_bound B U b S r hr f + hR o (fun j => mixedArrayRegroup _ _ _ (z.1 j) ()) hz C hC hchart j).trans (hbudget j) + exact (PiLp.norm_apply_le (normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (orthonormalMixedChart (o j) (mixedArrayRegroup _ _ _ (z.1 j) ()))) i).trans h + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R : Fin m → ℝ} + +local notation "single" => (fun _ : Fin m => Unit) +local notation "ambient" => JetAmbientIndex single J + +noncomputable def allocatedFullAmbientSiteCoordinates (z : ambient → ℝ) : LayerSamplerAxis I n → ℝ := + fun a => + let w := mixedRealCoordinates (euclideanSubspace (U a.1)) (b a.1) (o a.1) + ((EuclideanSpace.equiv (J a.1) ℝ).symm (fun k => z ⟨a.1, (), k⟩)) + Sum.elim w.1 w.2 a.2 / R a.1 + +theorem allocatedFullAmbientSiteCoordinates_point + (z : ∀ j, (I j → Unit → ℝ) × (Fin (n j) → Unit → ℤ)) : + allocatedFullAmbientSiteCoordinates (R := R) U b o (mixedJetAmbientPoint U b o z) = + allocatedFullMixedSiteValue (R := R) U b (fun j => mixedArrayRegroup _ _ _ (z j) ()) := by + have hp (j : Fin m) : (EuclideanSpace.equiv (J j) ℝ).symm + (fun k => mixedJetAmbientPoint U b o z ⟨j, (), k⟩) = + normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (orthonormalMixedChart (o j) (mixedArrayRegroup _ _ _ (z j) ())) := by + have hv : (fun k => mixedJetAmbientPoint U b o z ⟨j, (), k⟩) = + (EuclideanSpace.equiv (J j) ℝ) (normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (orthonormalMixedChart (o j) (mixedArrayRegroup _ _ _ (z j) ()))) := by + funext k + rfl + rw [hv, ContinuousLinearEquiv.symm_apply_apply] + funext a + rcases a with ⟨j, i | i⟩ <;> + dsimp only [allocatedFullAmbientSiteCoordinates, allocatedFullMixedSiteValue] <;> + rw [hp, mixedRealCoordinates_integer] <;> rfl + +theorem allocatedFullAmbientSiteCoordinates_lipschitz (hR : ∀ j, 0 < R j) + (C : Fin m → ℝ≥0) + (hC : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ C j * ‖v‖) + (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) : + LipschitzWith (K * ∑ j, C j * Fintype.card (J j)) + (allocatedFullAmbientSiteCoordinates (R := R) U b o) := by + apply LipschitzWith.of_dist_le_mul + intro z w + apply (dist_pi_le_iff (by positivity)).mpr + intro a + let pz := mixedRealCoordinates (euclideanSubspace (U a.1)) (b a.1) (o a.1) + ((EuclideanSpace.equiv (J a.1) ℝ).symm (fun k => z ⟨a.1, (), k⟩)) + let pw := mixedRealCoordinates (euclideanSubspace (U a.1)) (b a.1) (o a.1) + ((EuclideanSpace.equiv (J a.1) ℝ).symm (fun k => w ⟨a.1, (), k⟩)) + have hout : dist (Sum.elim pz.1 pz.2 a.2) (Sum.elim pw.1 pw.2 a.2) ≤ dist pz pw := by + rcases a.2 with i | i + · exact (dist_le_pi_dist pz.1 pw.1 i).trans (le_max_left _ _) + · exact (dist_le_pi_dist pz.2 pw.2 i).trans (le_max_right _ _) + have hrow := ((mixedRealCoordinates_lipschitz (euclideanSubspace (U a.1)) (b a.1) (o a.1) (hC a.1)).comp + (euclideanFromCoordinates_lipschitz (D := J a.1))).dist_le_mul + (fun k => z ⟨a.1, (), k⟩) (fun k => w ⟨a.1, (), k⟩) + have hin : dist (fun k => z ⟨a.1, (), k⟩) (fun k => w ⟨a.1, (), k⟩) ≤ dist z w := + (dist_pi_le_iff dist_nonneg).mpr (fun k => dist_le_pi_dist z w ⟨a.1, (), k⟩) + have hc : C a.1 * Fintype.card (J a.1) ≤ ∑ j, C j * Fintype.card (J j) := + Finset.single_le_sum (f := fun j => C j * Fintype.card (J j)) + (fun _ _ => by positivity) (Finset.mem_univ a.1) + have hd : dist (Sum.elim pz.1 pz.2 a.2) (Sum.elim pw.1 pw.2 a.2) ≤ + ((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w := + (hout.trans hrow).trans ((mul_le_mul_of_nonneg_left hin (NNReal.coe_nonneg _)).trans + (mul_le_mul_of_nonneg_right (by exact_mod_cast hc) dist_nonneg)) + change |Sum.elim pz.1 pz.2 a.2 / R a.1 - Sum.elim pw.1 pw.2 a.2 / R a.1| ≤ _ + rw [← sub_div, abs_div, abs_of_pos (hR a.1)] + calc + _ ≤ (((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w) / R a.1 := + div_le_div_of_nonneg_right hd (hR a.1).le + _ = (R a.1)⁻¹ * (((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w) := by ring + _ ≤ (K : ℝ) * (((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w) := + mul_le_mul_of_nonneg_right (hK a.1) (mul_nonneg (NNReal.coe_nonneg _) dist_nonneg) + _ = _ := by rw [NNReal.coe_mul, mul_assoc] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] (r : ℝ≥0) (hr : 0 < r) + +local notation "single" => (fun _ : Fin m => Unit) +local notation "quarter" => (fun j (_ : Unit) => standardLatticeClosedQuarterBox (J j)) +local notation "chart" => mixedCoveredJetChart (O := single) U o b hb bW d +local notation "region" => mixedCoveredJetRegion (O := single) (E := Q) U o b d quarter + +noncomputable def allocatedBufferedSiteChartFactor (f : (LayerSamplerAxis I n → ℝ) → ℂ) : + EuclideanJetLayers U single → ℂ := + restrictedComplexChartDensity chart region 1 (fun z => + allocatedBufferedMixedSiteFactor B U b S r hr f (fun j => mixedArrayRegroup _ _ _ (z.1 j) ())) + +theorem allocatedBufferedSiteChartFactor_norm_le + (f : (LayerSamplerAxis I n → ℝ) → ℂ) (hf : ∀ v, ‖f v‖ ≤ 1) + (y : EuclideanJetLayers U single) : ‖allocatedBufferedSiteChartFactor B U b S o hb bW d r hr f y‖ ≤ 1 := + restrictedComplexChartDensity_norm_le chart region + (mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j))) _ zero_le_one + (fun _ => allocatedBufferedMixedSiteFactor_norm_le B U b S r hr f hf _) y + +theorem allocatedBufferedSiteChartFactor_measurable + (f : (LayerSamplerAxis I n → ℝ) → ℂ) {L : ℝ≥0} + (hf : LipschitzWith L f) (hf1 : ∀ v, ‖f v‖ ≤ 1) : + Measurable (allocatedBufferedSiteChartFactor B U b S o hb bW d r hr f) := by + apply mixedCoveredJet_restrictedComplexDensity_measurable U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) + (fun j _ => (standardLatticeClosedQuarterBox_isCompact (J j)).isClosed.measurableSet) + let : ∀ j, BorelSpace ((I j → ℝ) × (Fin (n j) → ℤ)) := fun _ => inferInstance + let : BorelSpace (∀ j, (I j → ℝ) × (Fin (n j) → ℤ)) := Pi.borelSpace + apply (allocatedBufferedMixedSiteFactor_continuous B U b S r hr f hf hf1).measurable.comp + change Measurable (fun z : MixedCoveredJetSource I single Q n d => + fun j => ((fun i => (z.1 j).1 i ()), (fun i => (z.1 j).2 i ()))) + fun_prop + +theorem allocatedBufferedSiteChartFactor_enlarge + (f : (LayerSamplerAxis I n → ℝ) → ℂ) (hR : ∀ j, 0 < R j) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + (Ω : ∀ j, Unit → Set (EuclideanSpace ℝ (J j))) + (hquarter : ∀ j t, standardLatticeClosedQuarterBox (J j) ⊆ Ω j t) + (hΩ : ∀ j t, Ω j t ⊆ standardLatticeSmallBox (J j)) : + allocatedBufferedSiteChartFactor B U b S o hb bW d r hr f = + restrictedComplexChartDensity chart (mixedCoveredJetRegion U o b d Ω) 1 (fun z => + allocatedBufferedMixedSiteFactor B U b S r hr f (fun j => mixedArrayRegroup _ _ _ (z.1 j) ())) := by + apply restrictedComplexChartDensity_enlarge chart region _ + (mixedCoveredJetRegion_mono U o b d hquarter) (mixedCoveredJetChart_injOn U o b hb bW d Ω hΩ) + intro z hz + exact allocatedBufferedMixedSiteFactor_nonzero_mem_quarter B U b S r hr f hR o d z hz C hC hchart hbudget + +variable {α : Type*} [Fintype α] [DecidableEq α] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value + +theorem allocatedBufferedSiteChartFactor_apply + (f : (LayerSamplerAxis I n → ℝ) → ℂ) (z : MixedCoveredJetSource I jets Q n d) + (s : Finset α) (hs : mixedCoveredBooleanSiteValue d z s ∈ region) + (hbox : ∀ a, |allocatedFullMixedSiteValue (R := R) U b (mixedBooleanSiteValue z.1 s) a| ≤ (r : ℝ)) : + allocatedBufferedSiteChartFactor B U b S o hb bW d r hr f + (coveredBooleanSiteValue U (mixedCoveredJetChart U o b hb bW d z) s) = + f (allocatedIdealSiteCoordinates B U b S ((coefficientJetAxisSplit jets I n grid z.1).2) s) := by + rw [← mixedCoveredBooleanSiteValue_chart U o b hb bW d z s] + rw [allocatedBufferedSiteChartFactor, restrictedComplexChartDensity_apply _ _ _ _ + (mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j))) hs, + Complex.ofReal_one, one_mul] + change allocatedBufferedMixedSiteFactor B U b S r hr f (mixedBooleanSiteValue z.1 s) = _ + rw [allocatedBufferedMixedSiteFactor_eq B U b S r hr f _ hbox, + allocatedIdealSiteCoordinates_mixed_value] + +theorem allocatedBufferedSiteChartFactor_product + (f : Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) (z : MixedCoveredJetSource I jets Q n d) + (hs : ∀ s, mixedCoveredBooleanSiteValue d z s ∈ region) + (hbox : ∀ s a, |allocatedFullMixedSiteValue (R := R) U b (mixedBooleanSiteValue z.1 s) a| ≤ (r : ℝ)) : + (∏ s, allocatedBufferedSiteChartFactor B U b S o hb bW d r hr (f s) + (coveredBooleanSiteValue U (mixedCoveredJetChart U o b hb bW d z) s)) = + ∏ s, f s (allocatedIdealSiteCoordinates B U b S ((coefficientJetAxisSplit jets I n grid z.1).2) s) := by + exact Finset.prod_congr rfl (fun s _ => allocatedBufferedSiteChartFactor_apply B U b S o hb bW d r hr + (f s) z s (hs s) (hbox s)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped NNReal + +variable {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + +def singleSiteFromLayered (v : (Σ j, J j) → ℝ) : + JetAmbientIndex (fun _ : Fin m => Unit) J → ℝ := fun a => v ⟨a.1, a.2.2⟩ + +theorem singleSiteFromLayered_lipschitz : LipschitzWith 1 (singleSiteFromLayered (J := J)) := by + apply LipschitzWith.of_dist_le_mul + intro v w + simp only [NNReal.coe_one, one_mul] + apply (dist_pi_le_iff dist_nonneg).mpr + intro a + exact dist_le_pi_dist v w ⟨a.1, a.2.2⟩ + +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R : Fin m → ℝ} + +theorem allocatedFullAmbientSiteCoordinates_layered_point + (w : ∀ j, (I j → ℝ) × (Fin (n j) → ℤ)) : + allocatedFullAmbientSiteCoordinates (R := R) U b o + (singleSiteFromLayered (fun a : Σ j, J j => + normalizedLatticePoint (euclideanSubspace (U a.1)) (b a.1) (orthonormalMixedChart (o a.1) (w a.1)) a.2)) = + allocatedFullMixedSiteValue (R := R) U b w := by + let z := fun j => ((fun i (_ : Unit) => (w j).1 i), (fun i (_ : Unit) => (w j).2 i)) + change allocatedFullAmbientSiteCoordinates (R := R) U b o (mixedJetAmbientPoint U b o z) = _ + rw [allocatedFullAmbientSiteCoordinates_point] + rfl + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) (allocatedPrincipalSides B U b S)) + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "rows" => (fun j : Fin m => (Subtype.val : jets j → Finset α)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit jets I n grid + +theorem allocatedSiteBox_full_site_bound (hσ1 : ∀ j, σ j ≤ 1) + (z : ∀ j, (I j → jets j → ℝ) × (Fin (n j) → jets j → ℤ)) + (hz : allocatedGridJetDensity B U b hR hσ S x u v rows + (fun a => coefficientJetAxisEquiv jets I n z a.val) ≠ 0) + (hsites : ∀ s a, |allocatedIdealSiteCoordinates B U b S (split z).2 s a| ≤ 2 * idealSiteBoxRadius α m) : + ∀ s a, |allocatedFullMixedSiteValue (R := R) U b (mixedBooleanSiteValue z s) a| ≤ + allocatedFullSiteRadius (G := G) B α := by + intro s a + rcases a with ⟨j, i | i⟩ + · apply le_trans _ (allocatedFullSiteRadius_dominates (G := G) B α j) + change |(mixedBooleanSiteValue z s j).1 i / R j| ≤ _ + rw [mixedBooleanSiteValue_real, ← realBoundedSiteReconstruction_div] + apply realBoundedSiteReconstruction_bound _ _ (allocatedSiteJetSize_nonneg B α j) + intro t + rw [abs_div, abs_of_pos (hR j)] + exact (div_le_iff₀ (hR j)).mpr + ((allocatedSiteBox_mixed_coordinate_bounds B U b hR hσ S x u v hσ1 z hz hsites j t).1 i) + · apply le_trans _ (allocatedFullSiteRadius_dominates (G := G) B α j) + change |((mixedBooleanSiteValue z s j).2 i : ℝ) / basisAxisScale (b j) i / R j| ≤ _ + rw [mixedBooleanSiteValue_integer, ← realBoundedSiteReconstruction_div, + ← realBoundedSiteReconstruction_div] + apply realBoundedSiteReconstruction_bound _ _ (allocatedSiteJetSize_nonneg B α j) + intro t + rw [abs_div, abs_of_pos (hR j)] + exact (div_le_iff₀ (hR j)).mpr + ((allocatedSiteBox_mixed_coordinate_bounds B U b hR hσ S x u v hσ1 z hz hsites j t).2 i) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedGenuineSpatialReindex.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedGenuineSpatialReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..32689f155fb4b8803e8d062308a1ef2ffa663a0e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedGenuineSpatialReindex.lean @@ -0,0 +1,418 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalCubeWindowReindex +import OAI.Combinatorics.Progressions.Geometry.AllocatedAmbientBoxTests + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ≥0) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +variable (period : ℕ) [NeZero period] +variable {K : Type*} [Fintype K] (cI : K → ℂ) +variable (fI : K → Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets + +noncomputable def allocatedAmbientSpatialWeight (u : X → (Unit ⊕ Fin dim) → ℤ) : ℂ := + ∑ t : terms, (coeff (principalResidueLabel modulus (wholeReference r.val)) t / ((volume : ℝ) : ℂ)) * + ∏ s, twist r.val a.val t s (physicalCubeVertexValue u s) + +noncomputable def allocatedAmbientGridIdealValue + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (u : X → (Unit ⊕ Fin dim) → ℤ) : ℂ := + ∑ kg : ∀ i, ((coverWitness r).expansion i).Term, + ∑ label : Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)), + ∑ k : K, + (coverSiteCoefficient (coverWitness r).expansion kg * + allocatedProductMaskedIdealCoefficient B U b S rowSets x + (coverWitness r).representative refined d period cI label k) * + ∏ s, test s (fun z => (physicalCubeVertexValue u s z : ℝ)) * + (g r kg s (fun j => (((eval (fun z => (physicalCubeVertexValue u s z : ℝ)) (p j.1) j.2) / + commonSitePeriod (coverWitness r).expansion kg : ℝ) : UnitAddCircle)) * + allocatedMaskedSiteChartFactor B U b S o hb bW d radius positiveRadius period + (label s) (fI k s) (physicalSingleSiteValue U d p hm + (fun z => (physicalCubeVertexValue u s z : ℝ)))) + +local notation "weight" => allocatedAmbientSpatialWeight (τ := τ) B U b S X modulus q wholeReference + x hM selection hx N hW mesh base cells r a +local notation "gridIdeal" => allocatedAmbientGridIdealValue B U b S X modulus q coverWitness + hb o bW d g x p hm r period cI fI +local notation "ambient" => allocatedAmbientMaskedSpatialApproximation (τ := τ) B U b S X modulus q + wholeReference coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period cI fI + +theorem allocatedAmbientMaskedSpatialApproximation_factor + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (u : X → (Unit ⊕ Fin dim) → ℤ) : + ambient test u = weight u * gridIdeal test u := by + unfold allocatedAmbientMaskedSpatialApproximation allocatedAmbientSpatialWeight allocatedAmbientGridIdealValue + dsimp only + rw [Finset.sum_mul] + simp only [Fintype.sum_prod_type, Finset.mul_sum, Finset.prod_mul_distrib] + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro kg _ + apply Finset.sum_congr rfl + intro label _ + apply Finset.sum_congr rfl + intro k _ + ring + +theorem allocatedAmbientSpatialWeight_reconstruction (hq : ∀ z, 0 < q z) + (v : X → (Unit ⊕ Fin dim) → ℤ) : + weight (point v) = + allocatedResidueSpatialKernel B U b S x X hM selection hx modulus + (trimmedSpatialRootScale τ N q) hW mesh + (principalResidueLabel modulus (wholeReference r.val)) v / ((volume : ℝ) : ℂ) := by + have h := allocatedRecenteredResidueWeight_expansion (τ := τ) B U b S X modulus q + wholeReference x N mesh base hM selection hx hW cells hq r.val a v (fun _ _ => 1) + simpa only [allocatedAmbientSpatialWeight, allocatedRecenteredResidueWeight, + physicalCubeSiteTest, Finset.prod_const_one, mul_one, one_mul] using h.symm + +theorem allocatedAmbientSpatialWeight_zero_off_image (u : X → (Unit ⊕ Fin dim) → ℤ) + (hu : u ∉ Set.range point) : weight u = 0 := by + unfold allocatedAmbientSpatialWeight + apply Finset.sum_eq_zero + intro t _ + have hz : (∏ s, twist r.val a.val t s (physicalCubeVertexValue u s)) = 0 := by + by_contra hn + apply hu + exact physicalResidueSpatialSiteFactor_prod_nonzero_mem_range + (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (wholeReference r.val)) + (allocatedPhysicalCubeDirections B U b S x (wholeReference r.val)) base + (boundedColumnResidueRepresentative q a.val) q 4 mesh (trimmedSpatialRootScale τ N q) t u hn + rw [hz, mul_zero] + +theorem allocatedAmbientSpatialWeight_zero_outside_window + (hq : ∀ z, 0 < q z) (hH : ∀ z, 0 < trimmedSpatialRootScale τ N q z) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hmesh : 0 < (mesh : ℝ)) (hmargin : 3 + 2 * (mesh : ℝ) ≤ 4) + (v : X → (Unit ⊕ Fin dim) → ℤ) + (hv : v ∉ spatialWindow (trimmedSpatialRootScale τ N q) 4) : + weight (point v) = 0 := by + rw [allocatedAmbientSpatialWeight_reconstruction B U b S X modulus q wholeReference x hM + selection hx N hW mesh base cells r a hq] + have hv' : v ∉ spatialWindow (trimmedSpatialRootScale τ N q) (3 + 2 * (mesh : ℝ)) := + fun h => hv (spatialWindow_radius_mono _ (fun z => (hH z).le) hmargin h) + rw [allocatedResidueSpatialKernel_zero_outside B U b S x X hM selection hx modulus + (trimmedSpatialRootScale τ N q) hW mesh hbudget hH hmesh + (principalResidueLabel modulus (wholeReference r.val)) v hv', zero_div] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] fullGridCoverAxisDecidableEq fullBooleanRowSetFintype + +theorem finiteNestedCubeMixtureMean + {T L K Ω : Type*} [Fintype T] [Fintype L] [Fintype K] [Fintype Ω] + {D : T → Type*} [∀ t, Fintype (D t)] (a : ℂ) (c : T → L → K → ℂ) + (value : ∀ t, L → K → D t → Ω → ℂ) : + a * (𝔼 ω, ∑ t, ∑ l, ∑ k, ∑ d, c t l k * value t l k d ω) = + ∑ t, ∑ l, ∑ k, ∑ d, (a * c t l k) * (𝔼 ω, value t l k d ω) := by + simp only [Finset.expect_sum_comm, Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro l _ + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro d _ + rw [← Finset.mul_expect, mul_assoc] + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ≥0) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +variable (period : ℕ) [NeZero period] +variable {K : Type*} [Fintype K] (cI : K → ℂ) +variable (fI : K → Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets +local notation "positiveRadius" => allocatedProductIdealSiteRadius_pos (G := G) B rowSets + +variable [∀ (i : {i // allocatedGridAxis (I := I) U b S.value i}) + (ki : ((coverWitness r).expansion i).Term), NeZero (((coverWitness r).expansion i).period ki)] + +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "ambient" => allocatedAmbientNormalizedSpatialApproximation (τ := τ) B U b S X modulus q + wholeReference coverWitness hb o bW d x hM selection hx N hW mesh base cells p hm r a period cI fI +local notation "recentered" => allocatedRecenteredNormalizedSpatialApproximation (τ := τ) B U b S X modulus q + wholeReference coverWitness hb o bW d x hM selection hx N hW mesh base cells p hm r a period cI fI + +theorem allocatedAmbientNormalizedSpatialApproximation_mixture [DecidableEq X] + (test : Finset (Fin dim) → (X → ℝ) → ℂ) : + (integerBoxCubeCount N dim : ℂ) * + (𝔼 cube : SupportedCube dim (integerBox N : Set (X → ℤ)), + ambient test ((physicalCubeParametersEquiv X dim).symm cube.val)) = + ∑ t : terms × (∀ i, ((coverWitness r).expansion i).Term), + ∑ label : Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)), + ∑ k : K, + ∑ gridLabel : Finset (Fin dim) → ∀ i, ZMod (((coverWitness r).expansion i).period (t.2 i)), + ((integerBoxCubeCount N dim : ℂ) * + ((coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 * + allocatedProductMaskedIdealCoefficient B U b S rowSets x + (coverWitness r).representative refined d period cI label k)) * + 𝔼 cube : SupportedCube dim (integerBox N : Set (X → ℤ)), + let u : X → (Unit ⊕ Fin dim) → ℤ := (physicalCubeParametersEquiv X dim).symm cube.val + ∏ s, test s (fun z => (physicalCubeVertexValue u s z : ℝ)) * + allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s + (gridLabel s) (physicalCubeVertexValue u s) := by + let coefficient (t : terms × (∀ i, ((coverWitness r).expansion i).Term)) + (label : Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period))) + (k : K) : ℂ := + (coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 * + allocatedProductMaskedIdealCoefficient B U b S rowSets x + (coverWitness r).representative refined d period cI label k + let value (t : terms × (∀ i, ((coverWitness r).expansion i).Term)) + (label : Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period))) + (k : K) + (gridLabel : Finset (Fin dim) → ∀ i, ZMod (((coverWitness r).expansion i).period (t.2 i))) + (cube : SupportedCube dim (integerBox N : Set (X → ℤ))) : ℂ := + let u : X → (Unit ⊕ Fin dim) → ℤ := (physicalCubeParametersEquiv X dim).symm cube.val + ∏ s, test s (fun z => (physicalCubeVertexValue u s z : ℝ)) * + allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s + (gridLabel s) (physicalCubeVertexValue u s) + have h := finiteNestedCubeMixtureMean (integerBoxCubeCount N dim : ℂ) coefficient value + dsimp only [coefficient, value] at h + unfold allocatedAmbientNormalizedSpatialApproximation + dsimp only + convert h using 1 + apply congrArg (fun z : ℂ => (integerBoxCubeCount N dim : ℂ) * z) + refine Finset.expect_congr (by ext z; simp only [Finset.mem_univ]) ?_ + intro cube _ + refine Finset.sum_congr (by ext z; simp only [Finset.mem_univ]) ?_ + intro t _ + refine Finset.sum_congr (by ext z; simp only [Finset.mem_univ]) ?_ + intro label _ + refine Finset.sum_congr (by ext z; simp only [Finset.mem_univ]) ?_ + intro k _ + refine Finset.sum_congr (by ext z; simp only [Finset.mem_univ]) ?_ + intro gridLabel _ + rfl + +variable + (hsite : ∀ (kg : ∀ i, ((coverWitness r).expansion i).Term) + (s : Finset (Fin dim)) (u₀ : ∀ j, euclideanSubspace (U j)) (w₀ : ∀ j, (I j → ℝ) × (Fin (n j) → ℤ)), + (∀ j, (QuotientAddGroup.mk (u₀ j) : euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) = + normalizedLatticeQuotient (euclideanSubspace (U j)) (b j) (hb j) (orthonormalMixedChart (o j) (w₀ j))) → + (∀ j i, |normalizedLatticePoint (euclideanSubspace (U j)) (b j) (orthonormalMixedChart (o j) (w₀ j)) i| ≤ 1 / 4) → + g r kg s (fun v => ((((u₀ v.1).val v.2) / commonSitePeriod (coverWitness r).expansion kg : ℝ) : UnitAddCircle)) = + allocatedFullGridSiteFactor (G := G) B U b (R := R) (coverWitness r).expansion (allocatedGridIntegerAxis B U b S) kg s + (fun i => ((w₀ (allocatedGridIntegerAxis B U b S i).1).2 (allocatedGridIntegerAxis B U b S i).2 : ZMod (((coverWitness r).expansion i).period (kg i)))) + (allocatedFullMixedSiteValue (R := R) U b w₀) / 2) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (hsmall : ∀ j, R j ≤ allocatedProductGridRadius (G := G) B (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) C j) + (hN : ∀ z, 0 < N z) + +include hR hsite hC hchart hsmall hN + +theorem allocatedAmbientNormalizedSpatialApproximation_zero_off_image + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (u : X → (Unit ⊕ Fin dim) → ℤ) + (hu : u ∉ Set.range point) : ambient test u = 0 := by + rw [← allocatedAmbientMaskedSpatialApproximation_normalized (τ := τ) B U b hR S X modulus q + wholeReference coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period + cI fI hsite C hC hchart hsmall hN test u] + rw [allocatedAmbientMaskedSpatialApproximation_factor, + allocatedAmbientSpatialWeight_zero_off_image B U b S X modulus q wholeReference x hM + selection hx N hW mesh base cells r a u hu, zero_mul] + +theorem allocatedAmbientNormalizedSpatialApproximation_zero_outside_window + (hq : ∀ z, 0 < q z) (hτ : 0 < τ) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hmesh : 0 < (mesh : ℝ)) (hmargin : 3 + 2 * (mesh : ℝ) ≤ 4) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (v : X → (Unit ⊕ Fin dim) → ℤ) + (hv : v ∉ spatialWindow (trimmedSpatialRootScale τ N q) 4) : ambient test (point v) = 0 := by + rw [← allocatedAmbientMaskedSpatialApproximation_normalized (τ := τ) B U b hR S X modulus q + wholeReference coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period + cI fI hsite C hC hchart hsmall hN test (point v)] + rw [allocatedAmbientMaskedSpatialApproximation_factor, + allocatedAmbientSpatialWeight_zero_outside_window B U b S X modulus q wholeReference x hM + selection hx N hW mesh base cells r a hq + (fun z => (trimmedSpatial_scales_pos hW hτ N q z (hN z) (hq z)).1) + hbudget hmesh hmargin v hv, zero_mul] + +variable [DecidableEq X] + +theorem allocatedNormalizedSpatial_sum_eq_genuine_cube_mean + (hq : ∀ z, 0 < q z) (hτ : 0 < τ) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hmesh : 0 < (mesh : ℝ)) (hmargin : 3 + 2 * (mesh : ℝ) ≤ 4) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) : + (∑ v ∈ spatialWindow (trimmedSpatialRootScale τ N q) 4, + recentered (fun s => integerBoxTestExtension N (test s)) v) = + (integerBoxCubeCount N dim : ℂ) * + 𝔼 cube : SupportedCube dim (integerBox N : Set (X → ℤ)), + ambient test ((physicalCubeParametersEquiv X dim).symm cube.val) := by + have hbox : ∀ v ∈ spatialWindow (trimmedSpatialRootScale τ N q) 4, + ambient (fun s => integerBoxTestExtension N (test s)) (point v) ≠ 0 → + ∀ s, physicalCubeVertexValue (point v) s ∈ integerBox N := by + intro v _ hv + apply (mem_physicalIntegerBoxCubes N dim (point v)).mp + exact allocatedAmbientNormalizedSpatialApproximation_testExtension_nonzero_mem_box + B U b S X modulus q wholeReference coverWitness hb o bW d x hM selection hx N hW mesh + base cells p hm r a period cI fI test (point v) hv + have hwindow : ∀ v, v ∉ spatialWindow (trimmedSpatialRootScale τ N q) 4 → + ambient (fun s => integerBoxTestExtension N (test s)) (point v) = 0 := by + intro v hv + exact allocatedAmbientNormalizedSpatialApproximation_zero_outside_window + B U b hR S X modulus q wholeReference coverWitness hb o bW d g x hM selection hx N hW mesh + base cells p hm r a period cI fI hsite C hC hchart hsmall hN hq hτ hbudget hmesh hmargin + (fun s => integerBoxTestExtension N (test s)) v hv + have hresidue : ∀ u, ambient (fun s => integerBoxTestExtension N (test s)) u ≠ 0 → + u ∈ Set.range point := by + intro u hu + by_contra hn + apply hu + exact allocatedAmbientNormalizedSpatialApproximation_zero_off_image + B U b hR S X modulus q wholeReference coverWitness hb o bW d g x hM selection hx N hW mesh + base cells p hm r a period cI fI hsite C hC hchart hsmall hN + (fun s => integerBoxTestExtension N (test s)) u hn + have hsum := physicalResidueWindow_sum_eq_count_mul_mean + (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (wholeReference r.val)) + (allocatedPhysicalCubeDirections B U b S x (wholeReference r.val)) base + (boundedColumnResidueRepresentative q a.val) q N hq + (spatialWindow (trimmedSpatialRootScale τ N q) 4) + (ambient (fun s => integerBoxTestExtension N (test s))) hbox hwindow hresidue + calc + _ = ∑ v ∈ spatialWindow (trimmedSpatialRootScale τ N q) 4, + ambient (fun s => integerBoxTestExtension N (test s)) (point v) := by + simp only [allocatedAmbientNormalizedSpatialApproximation_reconstruction] + _ = (integerBoxCubeCount N dim : ℂ) * + 𝔼 cube : SupportedCube dim (integerBox N : Set (X → ℤ)), + ambient (fun s => integerBoxTestExtension N (test s)) + ((physicalCubeParametersEquiv X dim).symm cube.val) := hsum + _ = _ := by + apply congrArg (fun z : ℂ => (integerBoxCubeCount N dim : ℂ) * z) + apply Finset.expect_congr rfl + intro cube _ + apply allocatedAmbientNormalizedSpatialApproximation_testExtension_eq + exact Finset.mem_image.mpr ⟨cube, Finset.mem_univ _, rfl⟩ + +theorem allocatedNormalizedSpatial_sum_eq_genuine_cube_mixture + (hq : ∀ z, 0 < q z) (hτ : 0 < τ) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hmesh : 0 < (mesh : ℝ)) (hmargin : 3 + 2 * (mesh : ℝ) ≤ 4) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) : + (∑ v ∈ spatialWindow (trimmedSpatialRootScale τ N q) 4, + recentered (fun s => integerBoxTestExtension N (test s)) v) = + ∑ t : terms × (∀ i, ((coverWitness r).expansion i).Term), + ∑ label : Finset (Fin dim) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, Kcov j → ZMod period)), + ∑ k : K, + ∑ gridLabel : Finset (Fin dim) → ∀ i, ZMod (((coverWitness r).expansion i).period (t.2 i)), + ((integerBoxCubeCount N dim : ℂ) * + ((coeff (principalResidueLabel modulus (wholeReference r.val)) t.1 / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion t.2 * + allocatedProductMaskedIdealCoefficient B U b S rowSets x + (coverWitness r).representative refined d period cI label k)) * + 𝔼 cube : SupportedCube dim (integerBox N : Set (X → ℤ)), + let u : X → (Unit ⊕ Fin dim) → ℤ := (physicalCubeParametersEquiv X dim).symm cube.val + ∏ s, test s (fun z => (physicalCubeVertexValue u s z : ℝ)) * + allocatedRecenteredNormalizedSiteFactor (τ := τ) B U b S X modulus q wholeReference coverWitness + hb o bW d x N mesh base p hm r a.val period t.1 t.2 (label s) (fI k s) s + (gridLabel s) (physicalCubeVertexValue u s) := by + exact (allocatedNormalizedSpatial_sum_eq_genuine_cube_mean B U b hR S X modulus q wholeReference + coverWitness hb o bW d g x hM selection hx N hW mesh base cells p hm r a period cI fI + hsite C hC hchart hsmall hN hq hτ hbudget hmesh hmargin test).trans + (allocatedAmbientNormalizedSpatialApproximation_mixture B U b S X modulus q wholeReference + coverWitness hb o bW d x hM selection hx N hW mesh base cells p hm r a period cI fI test) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedGeometricInputBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedGeometricInputBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..c93873cd04dbc313274ee89f37c1084cb5aef59c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedGeometricInputBudget.lean @@ -0,0 +1,539 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedFixedInitializedCover +import OAI.Combinatorics.Progressions.Estimates.AllocatedInitializedIdealCover + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule MeasureTheory + +def allocatedUniformChartLog {A : Type*} [Semiring A] (p : A) : A := 20 * (p + 1) ^ 3 + +theorem allocatedUniformChartLog_nonneg {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ allocatedUniformChartLog p := by unfold allocatedUniformChartLog; positivity + +theorem exists_uniform_projected_chart {J : Type*} [Fintype J] + (W : Submodule ℝ (EuclideanSpace ℝ J)) + [IsZLattice ℝ (latticeSection (standardEuclideanLattice J) W)] + {p : ℝ} (hdim : (Fintype.card J : ℝ) ≤ p) : + ∃ b : Basis (Fin (finrank ℝ Wᗮ)) ℝ Wᗮ, + span ℤ (Set.range b) = projectedIntegerLattice W ∧ + (∀ z, ‖normalizedOrthogonalChart W b z‖ ≤ Real.exp (allocatedUniformChartLog p) * ‖z‖) ∧ + (∀ z, ‖(normalizedOrthogonalChart W b).symm z‖ ≤ Real.exp (allocatedUniformChartLog p) * ‖z‖) ∧ + 0 ≤ mixedDensityCovolumeRatio W b ∧ + mixedDensityCovolumeRatio W b ≤ Real.exp (allocatedUniformChartLog p) := by + have hn : finrank ℝ Wᗮ ≤ Fintype.card J := by + simpa only [finrank_euclideanSpace] using Wᗮ.finrank_le + have hnp : (finrank ℝ Wᗮ : ℝ) ≤ p := (Nat.cast_le.mpr hn).trans hdim + have hlog : 20 * ((finrank ℝ Wᗮ : ℝ) + 1) ^ 3 ≤ allocatedUniformChartLog p := by + unfold allocatedUniformChartLog + gcongr + have he := Real.exp_le_exp.mpr hlog + obtain ⟨b, hb, _, hf, hi, _, hv⟩ := exists_quantitative_projected_chart W + exact ⟨b, hb, fun z => (hf z).trans (mul_le_mul_of_nonneg_right he (norm_nonneg z)), + fun z => (hi z).trans (mul_le_mul_of_nonneg_right he (norm_nonneg z)), + (mixedDensityCovolumeRatio_pos W b).le, hv.trans he⟩ + +namespace VectorPolynomial + +theorem exists_allocated_uniform_charts {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {p : ℝ} (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) : + ∃ b : ∀ j, Basis (Fin (finrank ℝ (euclideanSubspace (U j))ᗮ)) ℝ (euclideanSubspace (U j))ᗮ, + (∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) ∧ + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ + Real.exp (allocatedUniformChartLog p) * ‖z‖) ∧ + (∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ + Real.exp (allocatedUniformChartLog p) * ‖z‖) ∧ + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Real.exp (allocatedUniformChartLog p)) := by + choose b hb hf hi hv0 hv using (fun j => exists_uniform_projected_chart (euclideanSubspace (U j)) (hJ j)) + exact ⟨b, hb, hf, hi, fun j => ⟨hv0 j, hv j⟩⟩ + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set BooleanCubeKernel +open scoped BigOperators Classical NNReal + +noncomputable def allocatedGeometryInput {A : Type*} [Semiring A] + (m : ℕ) (p c s E : A) : A := + p + c + s + E + allocatedIdealCoverPrimitiveLog m p c + +theorem allocatedGeometryInput_bounds (m : ℕ) {p c s E : ℝ} + (hp : 0 ≤ p) (hc : 0 ≤ c) (hs : 0 ≤ s) (hE : 0 ≤ E) : + let q := allocatedGeometryInput m p c s E + 0 ≤ q ∧ p ≤ q ∧ c ≤ q ∧ s ≤ q ∧ E ≤ q ∧ allocatedIdealCoverPrimitiveLog m p c ≤ q := by + have hL := (allocatedIdealCoverPrimitiveRadius_bounds m hp hc).1 + dsimp only [allocatedGeometryInput] + constructor + · positivity + constructor + · linarith + constructor + · linarith + constructor + · linarith + constructor <;> linarith + +theorem exists_allocatedGeometryInput_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ p : ℝ, 0 ≤ p → allocatedGeometryInput m p p p p ≤ (p + a) ^ a := by + let poly : Polynomial ℕ := allocatedGeometryInput m Polynomial.X Polynomial.X Polynomial.X Polynomial.X + obtain ⟨a, ha, hbound⟩ := exists_natPolynomial_eval_budget poly + refine ⟨a, ha, ?_⟩ + intro p hp + simpa [poly, allocatedGeometryInput, allocatedIdealCoverPrimitiveLog, allocatedIdealCoverInputLog, + allocatedSiteCoefficientLog, allocatedComparisonDimension, Polynomial.eval₂_pow] using hbound p hp + +noncomputable def allocatedGeometrySourceInput {A : Type*} [Semiring A] + (m : ℕ) (p c e E : A) : A := + allocatedGeometryInput m p c + (allocatedSiteScaleLog m (allocatedGeometryInput m p c 0 E) e E) E + +universe uG uI uB uJ uQ uX + +attribute [local instance 2000] fullBooleanRowSetFintype activeAmbientAxisDecidableEq +attribute [local instance] ScalarSiteExpansion.termFinite + +variable {m dim : ℕ} {G : Type uG} [Fintype G] +variable {I : Fin m → Type uI} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type uB) +variable [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type uJ} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {p c e E : ℝ} +local notation "radius" => allocatedIdealCoverPrimitiveRadius m p c +variable {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (S : LayerSamplerScale (G := G) B U b R σ) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rowTypes" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) + +variable (M₀ : ℕ) +local notation "period" => kernelPeriodCandidate (m + 1) +local notation "P" => canonicalScalarSourceEnvelope m M₀ +local notation "L" => scalarSourceTransitionBound + +local notation "scaleInput" => allocatedGeometryInput m p c 0 E +local notation "scaleLog" => allocatedSiteScaleLog m scaleInput e E +local notation "inputParameter" => allocatedGeometrySourceInput m p c e E +local notation "sourceParameter" => siteSourceParameter m inputParameter +local notation "maskLog" => siteSourceMaskLog m inputParameter +local notation "δ" => allocatedSitePrimitiveTolerance m sourceParameter maskLog (allocatedIdealProfileLog m sourceParameter e) E +local notation "Λ" => allocatedSiteSpectrumLog m sourceParameter maskLog (allocatedIdealProfileLog m sourceParameter e) E +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "active" => allocatedActiveGrid B U b S +local notation "activeAxes" => {a : {a // grid a} // active a} +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "axisN" => allocatedGridNaturalScale B U b S + +local notation "sitePeriods" => (fun a : activeAxes => + (allocatedPositiveSitePeriod B (Fin dim) U b hR S (Subtype.val a) : ℕ)) + +local notation "pointTolerance" => allocatedSitePointTolerance (G := G) B rowSets δ +local notation "torus" => (fun a : activeAxes => allocatedGridTorusFactor B (Fin dim) (ig (Subtype.val a))) +local notation "chartCap" => (NNReal.mk (Real.exp c) (Real.exp_nonneg c)) +local notation "geometryQ" => Real.toNNReal (8 * (allocatedComparisonDimension m p + 1)) +local notation "siteLip" => (NNReal.mk (Real.exp (1 + 6 * Λ + 12)) (Real.exp_nonneg _) + 4 : ℝ≥0) +local notation "coefficientCap" => (fun a : activeAxes => + allocatedGridPointCap B P (ig (Subtype.val a)) (rowSets (Sigma.fst (ig (Subtype.val a)))) * + Real.exp (Fintype.card (Finset (Fin dim)) * (4 * Λ + 8) + Λ)) + +theorem exists_geometric_good_kernel_ideal_cover_family + (hp : 0 ≤ p) (hc : 0 ≤ c) (he : 0 ≤ e) (hE : 0 ≤ E) + (hdimSmall : dim ≤ m + 1) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn₁ : ∀ j, (n j : ℝ) ≤ p) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hcutoff : (M₀ : ℝ) ≤ Real.exp p) + (hScale : S = allocatedSiteScale (G := G) B U b hR hσ scaleInput e E) + (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp p) + (hRadius : ∀ j, R j = radius) + (hforward : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ Real.exp c * ‖z‖) + (hinverse : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Real.exp c * ‖z‖) + (hvolume : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Real.exp c) + (hσ1 : ∀ j, σ j ≤ 1) + (hBlocks : ∀ j i, siteSpectrumBlockCount m ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) : + ∃ K : ℕ, 2 ≤ K ∧ + ∃ witnesses : (t : Fin M₀) → (r : AllocatedPositiveResidue (dim := dim) B U b S (period t)) → + AllocatedResidueSiteWitness (dim := dim) B U b S (period t) r.val, + (∀ t r, allocatedActiveSiteBounds B U b S rowSets P pointTolerance Λ sitePeriods (witnesses t r).expansion) ∧ ∀ + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + {Q : Fin m → Type uQ} [∀ j, Fintype (Q j)] + (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (d : ℕ) [NeZero d] + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))], + ∃ g : (t : Fin M₀) → (r : AllocatedPositiveResidue (dim := dim) B U b S (period t)) → + (∀ a, ((witnesses t r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ), + (∀ t r k s, LipschitzWith (max (((Fintype.card activeAxes * siteLip) * geometryQ) * + (Real.toNNReal (Real.exp sourceParameter) * ∑ j, chartCap * Fintype.card (J j)) * commonSitePeriod (witnesses t r).expansion k) + (4 * commonSitePeriod (witnesses t r).expansion k)) (g t r k s) ∧ ∀ z, ‖g t r k s z‖ ≤ 1) ∧ + (∀ t r, (∑ k, ‖coverSiteCoefficient (witnesses t r).expansion k‖) ≤ + (2 : ℝ) ^ Fintype.card (Finset (Fin dim)) * ∏ a, (coefficientCap) a) ∧ + (∀ t, allocatedResidueCoverCoefficientMass B U b S (period t) (witnesses t) ≤ + (2 : ℝ) ^ Fintype.card (Finset (Fin dim)) * ∏ a, (coefficientCap) a) ∧ + ∀ (x : G → IntegerScalarCubeBox (Fin dim) S.value) + (selection : Fin dim ↪ G) {κ : ℝ} + (_hx : GoodScalarKernelTuple selection κ M₀ x), + ∃ t : Fin M₀, + (∀ root : G → ℤ, integerScalarLattice (Unit ⊕ Fin dim) (period t : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) ∧ + (∀ j, integerScalarLattice (rowTypes j) (period t : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (rows j)).mulVecLin.range) ∧ + ∀ (τ : ℝ≥0), 0 < τ → τ ≤ 1 → (τ : ℝ)⁻¹ ≤ Real.exp e → ∀ + {X : Type uX} [Fintype X] [DecidableEq X] + {P₀ : ℝ} (_hP : 0 ≤ P₀) (_hn : (Fintype.card X : ℝ) ≤ P₀) + (_hdim : (Fintype.card (Option (Fin dim) × X) : ℝ) ≤ P₀) + (_hbudget : allocatedSiteErrorFourierOutput m sourceParameter maskLog (allocatedIdealProfileLog m sourceParameter e) ≤ P₀) + [CompactSpace (CoefficientTorus (K := Fin dim) U)] + [MeasurableSpace (CoefficientTorus (K := Fin dim) U)] [BorelSpace (CoefficientTorus (K := Fin dim) U)] + (μ : Measure (CoefficientTorus (K := Fin dim) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hmp : ∀ j e, coefficients (p j) e ∈ U j) + (stride : X → ℕ) (_hs : ∀ x, 0 < stride x) + {R₁ S₀ ρ : ℝ} (_hS : 0 ≤ S₀) (_hSP : S₀ ≤ Real.exp P₀) (_hρ : 0 < ρ) + (_hρP : 1 / ρ ≤ Real.exp P₀) + (_hstride : ∀ x, (stride x : ℝ) ≤ S₀) + (H : X → ℝ) (_hsize : ∀ x, Real.exp ((P₀ + K) ^ K) ≤ H x) + (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) H R₁ (U j) (p j)) + (_hR : Real.exp ((P₀ + K) ^ K) ≤ R₁) + (cells : Finset (ColumnResiduePattern (Option (Fin dim)) X stride)) (_hcells : cells.Nonempty) + (W : Option (Fin dim) × X → ℝ) (hW : ∀ z, 0 < W z) (_hwidth : ∀ z, ρ * H z.2 ≤ W z), + let f := allocatedPhysicalLongIdeal B U b hR S rowSets τ + let law := principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S) + let error := fun z : Option (Fin dim) × X → ℤ => + law.complexMean (fun y₀ => + (allocatedWholeMaskedCoveredProfile (O := rowTypes) B U b hR hσ S x (rows) hb o bW d y₀ (period t) f + (physicalCubeRowSample U d (rows) p hmp (standardPhysicalCubeOutput z)) : ℂ)) - + (law.fiberLaw (principalResidueLabel (period t))).complexMean + (allocatedSupportedIdealCoverValue B U b hR hσ S (period t) (witnesses t) hb o bW d (g t) τ x p hmp + (standardPhysicalCubeOutput z)) + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride cells W z, + selectedResidueDensityMass stride cells W (fun z => ‖error z‖) ≤ Real.exp (-E) ∧ + ∀ φ : (Option (Fin dim) × X → ℤ) → ℂ, (∀ z, ‖φ z‖ ≤ 1) → + ‖∑' z, ((selectedResidueSmoothPMF stride cells W hW hZ z).toReal : ℂ) * + (error z * φ z)‖ ≤ Real.exp (-E) := by + have hradius := allocatedIdealCoverPrimitiveRadius_bounds m hp hc + obtain ⟨hq₀, hpq₀, _, _, _, hLq₀⟩ := allocatedGeometryInput_bounds m hp hc (le_refl 0) hE + have hs₀ : 0 ≤ scaleLog := (allocatedSiteSourceLog_bounds m hq₀ he hE).1 + obtain ⟨hq, hpq, hcq, hsq, hEq, hLq⟩ := allocatedGeometryInput_bounds m hp hc hs₀ hE + have hqSource := (siteSourceParameter_bounds m hq).2.1 + have hrowdim : Fintype.card (Fin dim) ≤ m + 1 := by + simpa only [Fintype.card_fin] using hdimSmall + have hRq₀ (j : Fin m) : (R j)⁻¹ ≤ Real.exp scaleInput := by + rw [hRadius j] + exact hradius.2.2.2.trans_le (Real.exp_le_exp.mpr hLq₀) + have hS₁ : (S.value : ℝ) ≤ Real.exp scaleLog := by + rw [hScale] + exact allocatedSiteScale_upper (G := G) B U b hR hσ rows hrowdim + (fun _ => Subtype.val_injective) hq₀ he hE (hvars.trans hpq₀) + (fun j => (hI j).trans hpq₀) (fun j => (hn₁ j).trans hpq₀) hRq₀ + (fun j => (hσi j).trans (Real.exp_le_exp.mpr hpq₀)) + have hsize : (Fintype.card (Fin dim) + 1) * M₀ ^ (m + 1) ≤ S.value := by + rw [hScale] + exact allocatedSiteScale_period_window (G := G) B U b hR hσ hdimSmall hq₀ he hE + (hcutoff.trans (Real.exp_le_exp.mpr hpq₀)) + have hdim := allocatedComparisonDimensions_of_primitive (G := G) B rows hrowdim + (fun _ => Subtype.val_injective) hp hvars hI hn₁ + have hsmall := allocatedIdealCoverPrimitiveRadius_le (G := G) B rowSets hp hc hrowdim + hvars hI hn₁ (fun _ => Real.exp c) (fun _ => (Real.exp_pos c).le) (fun _ => le_rfl) + have hQsite (a : activeAxes) : 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (ig a.val).1 (ig a.val).2) : ℝ) + 1) ≤ geometryQ := by + have hcount := allocatedIntegerBlock_card_le B rowSets hdim (ig a.val).1 (ig a.val).2 + have hD := hdim.nonneg + rw [Real.coe_toNNReal _ (by positivity)] + simpa only [layerIntegerPrincipalSlots_card] using (show + 8 * ((Fintype.card (B ⟨(ig a.val).1, Sum.inr (ig a.val).2⟩) : ℝ) + 1) ≤ + 8 * (allocatedComparisonDimension m p + 1) by linarith) + obtain ⟨K, hK, witnesses, hBounds, hgeometry⟩ := exists_initialized_good_kernel_ideal_cover_family + (B := B) (U := U) (b := b) (hR := hR) (hσ := hσ) (S := S) (M₀ := M₀) + (hsize := hsize) (p := inputParameter) hq he hE hdimSmall + (hvars.trans hpq) (fun j => (hI j).trans hpq) (fun j => (hn₁ j).trans hpq) + (fun j => (hJ j).trans hpq) (hcutoff.trans (Real.exp_le_exp.mpr hpq)) + (hS₁.trans (Real.exp_le_exp.mpr hsq)) hEq (fun j => (hRadius j).trans_le hradius.2.2.1) hBlocks + refine ⟨K, hK, witnesses, hBounds, ?_⟩ + intro hb o Q _ bW d _ _ + have hRinv (j : Fin m) : (R j)⁻¹ ≤ Real.exp sourceParameter := by + rw [hRadius j] + exact hradius.2.2.2.trans_le (Real.exp_le_exp.mpr (hLq.trans hqSource)) + exact hgeometry hb o bW d (fun _ => chartCap) (fun _ => chartCap) + hforward (fun j => ⟨(mixedDensityCovolumeRatio_pos _ _).le, hvolume j⟩) + (fun _ => Real.exp_le_exp.mpr (hcq.trans hqSource)) + (fun _ => Real.exp_le_exp.mpr (hcq.trans hqSource)) hRinv hσ1 geometryQ hQsite + (fun _ => Real.exp c) (fun _ => (Real.exp_pos c).le) hinverse (fun j => (hRadius j).trans_le (hsmall j)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set BooleanCubeKernel +open scoped BigOperators Classical NNReal + +universe uG uI uB uJ uQ uX + +attribute [local instance 2000] fullBooleanRowSetFintype activeAmbientAxisDecidableEq +attribute [local instance] ScalarSiteExpansion.termFinite + +variable {m dim : ℕ} {G : Type uG} [Fintype G] +variable {I : Fin m → Type uI} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type uB) +variable [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type uJ} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {p c e E : ℝ} +local notation "radius" => allocatedIdealCoverPrimitiveRadius m p c +variable {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (S : LayerSamplerScale (G := G) B U b R σ) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rowTypes" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) + +variable (M₀ : ℕ) +local notation "period" => kernelPeriodCandidate (m + 1) +local notation "P" => canonicalScalarSourceEnvelope m M₀ +local notation "L" => scalarSourceTransitionBound + +local notation "scaleInput" => allocatedGeometryInput m p c 0 E +local notation "scaleLog" => allocatedSiteScaleLog m scaleInput e E +local notation "inputParameter" => allocatedGeometrySourceInput m p c e E +local notation "sourceParameter" => siteSourceParameter m inputParameter +local notation "maskLog" => siteSourceMaskLog m inputParameter +local notation "δ" => allocatedSitePrimitiveTolerance m sourceParameter maskLog (allocatedIdealProfileLog m sourceParameter e) E +local notation "Λ" => allocatedSiteSpectrumLog m sourceParameter maskLog (allocatedIdealProfileLog m sourceParameter e) E +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "active" => allocatedActiveGrid B U b S +local notation "activeAxes" => {a : {a // grid a} // active a} +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "axisN" => allocatedGridNaturalScale B U b S + +local notation "sitePeriods" => (fun a : activeAxes => + (allocatedPositiveSitePeriod B (Fin dim) U b hR S (Subtype.val a) : ℕ)) + +local notation "pointTolerance" => allocatedSitePointTolerance (G := G) B rowSets δ +local notation "torus" => (fun a : activeAxes => allocatedGridTorusFactor B (Fin dim) (ig (Subtype.val a))) +local notation "chartCap" => (NNReal.mk (Real.exp c) (Real.exp_nonneg c)) +local notation "geometryQ" => Real.toNNReal (8 * (allocatedComparisonDimension m p + 1)) +local notation "siteLip" => (NNReal.mk (Real.exp (1 + 6 * Λ + 12)) (Real.exp_nonneg _) + 4 : ℝ≥0) +local notation "coefficientCap" => (fun a : activeAxes => + allocatedGridPointCap B P (ig (Subtype.val a)) (rowSets (Sigma.fst (ig (Subtype.val a)))) * + Real.exp (Fintype.card (Finset (Fin dim)) * (4 * Λ + 8) + Λ)) + +variable {K : ℕ} +variable (hSampling : ∀ inst : ∀ j : Fin m, + Fintype {s : Finset (Fin dim) // s ∈ boundedBooleanJetRows (Fin dim) (j.val + 1)}, + @AllocatedBooleanRowsSampling.{uX,uJ,uG,uI,uB,uQ} m dim K + (fun j => {s : Finset (Fin dim) // s ∈ boundedBooleanJetRows (Fin dim) (j.val + 1)}) + inst (fun _ => Subtype.val)) + +include hSampling in +theorem geometric_good_kernel_ideal_cover_at_sampling + (hp : 0 ≤ p) (hc : 0 ≤ c) (he : 0 ≤ e) (hE : 0 ≤ E) + (hdimSmall : dim ≤ m + 1) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn₁ : ∀ j, (n j : ℝ) ≤ p) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hcutoff : (M₀ : ℝ) ≤ Real.exp p) + (hScale : S = allocatedSiteScale (G := G) B U b hR hσ scaleInput e E) + (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp p) + (hRadius : ∀ j, R j = radius) + (hforward : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ Real.exp c * ‖z‖) + (hinverse : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Real.exp c * ‖z‖) + (hvolume : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Real.exp c) + (hσ1 : ∀ j, σ j ≤ 1) + (hBlocks : ∀ j i, siteSpectrumBlockCount m ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) : + ∃ witnesses : (t : Fin M₀) → (r : AllocatedPositiveResidue (dim := dim) B U b S (period t)) → + AllocatedResidueSiteWitness (dim := dim) B U b S (period t) r.val, + (∀ t r, allocatedActiveSiteBounds B U b S rowSets P pointTolerance Λ sitePeriods (witnesses t r).expansion) ∧ ∀ + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + {Q : Fin m → Type uQ} [∀ j, Fintype (Q j)] + (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (d : ℕ) [NeZero d] + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))], + ∃ g : (t : Fin M₀) → (r : AllocatedPositiveResidue (dim := dim) B U b S (period t)) → + (∀ a, ((witnesses t r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ), + (∀ t r k s, LipschitzWith (max (((Fintype.card activeAxes * siteLip) * geometryQ) * + (Real.toNNReal (Real.exp sourceParameter) * ∑ j, chartCap * Fintype.card (J j)) * commonSitePeriod (witnesses t r).expansion k) + (4 * commonSitePeriod (witnesses t r).expansion k)) (g t r k s) ∧ ∀ z, ‖g t r k s z‖ ≤ 1) ∧ + (∀ t r, (∑ k, ‖coverSiteCoefficient (witnesses t r).expansion k‖) ≤ + (2 : ℝ) ^ Fintype.card (Finset (Fin dim)) * ∏ a, (coefficientCap) a) ∧ + (∀ t, allocatedResidueCoverCoefficientMass B U b S (period t) (witnesses t) ≤ + (2 : ℝ) ^ Fintype.card (Finset (Fin dim)) * ∏ a, (coefficientCap) a) ∧ + ∀ (x : G → IntegerScalarCubeBox (Fin dim) S.value) + (selection : Fin dim ↪ G) {κ : ℝ} + (_hx : GoodScalarKernelTuple selection κ M₀ x), + ∃ t : Fin M₀, + (∀ root : G → ℤ, integerScalarLattice (Unit ⊕ Fin dim) (period t : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) ∧ + (∀ j, integerScalarLattice (rowTypes j) (period t : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (rows j)).mulVecLin.range) ∧ + ∀ (τ : ℝ≥0), 0 < τ → τ ≤ 1 → (τ : ℝ)⁻¹ ≤ Real.exp e → ∀ + {X : Type uX} [Fintype X] [DecidableEq X] + {P₀ : ℝ} (_hP : 0 ≤ P₀) (_hn : (Fintype.card X : ℝ) ≤ P₀) + (_hdim : (Fintype.card (Option (Fin dim) × X) : ℝ) ≤ P₀) + (_hbudget : allocatedSiteErrorFourierOutput m sourceParameter maskLog (allocatedIdealProfileLog m sourceParameter e) ≤ P₀) + [CompactSpace (CoefficientTorus (K := Fin dim) U)] + [MeasurableSpace (CoefficientTorus (K := Fin dim) U)] [BorelSpace (CoefficientTorus (K := Fin dim) U)] + (μ : Measure (CoefficientTorus (K := Fin dim) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hmp : ∀ j e, coefficients (p j) e ∈ U j) + (stride : X → ℕ) (_hs : ∀ x, 0 < stride x) + {R₁ S₀ ρ : ℝ} (_hS : 0 ≤ S₀) (_hSP : S₀ ≤ Real.exp P₀) (_hρ : 0 < ρ) + (_hρP : 1 / ρ ≤ Real.exp P₀) + (_hstride : ∀ x, (stride x : ℝ) ≤ S₀) + (H : X → ℝ) (_hsize : ∀ x, Real.exp ((P₀ + K) ^ K) ≤ H x) + (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) H R₁ (U j) (p j)) + (_hR : Real.exp ((P₀ + K) ^ K) ≤ R₁) + (cells : Finset (ColumnResiduePattern (Option (Fin dim)) X stride)) (_hcells : cells.Nonempty) + (W : Option (Fin dim) × X → ℝ) (hW : ∀ z, 0 < W z) (_hwidth : ∀ z, ρ * H z.2 ≤ W z), + let f := allocatedPhysicalLongIdeal B U b hR S rowSets τ + let law := principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S) + let error := fun z : Option (Fin dim) × X → ℤ => + law.complexMean (fun y₀ => + (allocatedWholeMaskedCoveredProfile (O := rowTypes) B U b hR hσ S x (rows) hb o bW d y₀ (period t) f + (physicalCubeRowSample U d (rows) p hmp (standardPhysicalCubeOutput z)) : ℂ)) - + (law.fiberLaw (principalResidueLabel (period t))).complexMean + (allocatedSupportedIdealCoverValue B U b hR hσ S (period t) (witnesses t) hb o bW d (g t) τ x p hmp + (standardPhysicalCubeOutput z)) + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride cells W z, + selectedResidueDensityMass stride cells W (fun z => ‖error z‖) ≤ Real.exp (-E) ∧ + ∀ φ : (Option (Fin dim) × X → ℤ) → ℂ, (∀ z, ‖φ z‖ ≤ 1) → + ‖∑' z, ((selectedResidueSmoothPMF stride cells W hW hZ z).toReal : ℂ) * + (error z * φ z)‖ ≤ Real.exp (-E) := by + have hradius := allocatedIdealCoverPrimitiveRadius_bounds m hp hc + obtain ⟨hq₀, hpq₀, _, _, _, hLq₀⟩ := allocatedGeometryInput_bounds m hp hc (le_refl 0) hE + have hs₀ : 0 ≤ scaleLog := (allocatedSiteSourceLog_bounds m hq₀ he hE).1 + obtain ⟨hq, hpq, hcq, hsq, hEq, hLq⟩ := allocatedGeometryInput_bounds m hp hc hs₀ hE + have hqSource := (siteSourceParameter_bounds m hq).2.1 + have hrowdim : Fintype.card (Fin dim) ≤ m + 1 := by + simpa only [Fintype.card_fin] using hdimSmall + have hRq₀ (j : Fin m) : (R j)⁻¹ ≤ Real.exp scaleInput := by + rw [hRadius j] + exact hradius.2.2.2.trans_le (Real.exp_le_exp.mpr hLq₀) + have hS₁ : (S.value : ℝ) ≤ Real.exp scaleLog := by + rw [hScale] + exact allocatedSiteScale_upper (G := G) B U b hR hσ rows hrowdim + (fun _ => Subtype.val_injective) hq₀ he hE (hvars.trans hpq₀) + (fun j => (hI j).trans hpq₀) (fun j => (hn₁ j).trans hpq₀) hRq₀ + (fun j => (hσi j).trans (Real.exp_le_exp.mpr hpq₀)) + have hsize : (Fintype.card (Fin dim) + 1) * M₀ ^ (m + 1) ≤ S.value := by + rw [hScale] + exact allocatedSiteScale_period_window (G := G) B U b hR hσ hdimSmall hq₀ he hE + (hcutoff.trans (Real.exp_le_exp.mpr hpq₀)) + have hdim := allocatedComparisonDimensions_of_primitive (G := G) B rows hrowdim + (fun _ => Subtype.val_injective) hp hvars hI hn₁ + have hsmall := allocatedIdealCoverPrimitiveRadius_le (G := G) B rowSets hp hc hrowdim + hvars hI hn₁ (fun _ => Real.exp c) (fun _ => (Real.exp_pos c).le) (fun _ => le_rfl) + have hQsite (a : activeAxes) : 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (ig a.val).1 (ig a.val).2) : ℝ) + 1) ≤ geometryQ := by + have hcount := allocatedIntegerBlock_card_le B rowSets hdim (ig a.val).1 (ig a.val).2 + have hD := hdim.nonneg + rw [Real.coe_toNNReal _ (by positivity)] + simpa only [layerIntegerPrincipalSlots_card] using (show + 8 * ((Fintype.card (B ⟨(ig a.val).1, Sum.inr (ig a.val).2⟩) : ℝ) + 1) ≤ + 8 * (allocatedComparisonDimension m p + 1) by linarith) + obtain ⟨witnesses, hBounds, hgeometry⟩ := initialized_good_kernel_ideal_cover_at_sampling (hSampling := hSampling) + (B := B) (U := U) (b := b) (hR := hR) (hσ := hσ) (S := S) (M₀ := M₀) + (hsize := hsize) (p := inputParameter) hq he hE hdimSmall + (hvars.trans hpq) (fun j => (hI j).trans hpq) (fun j => (hn₁ j).trans hpq) + (fun j => (hJ j).trans hpq) (hcutoff.trans (Real.exp_le_exp.mpr hpq)) + (hS₁.trans (Real.exp_le_exp.mpr hsq)) hEq (fun j => (hRadius j).trans_le hradius.2.2.1) hBlocks + refine ⟨witnesses, hBounds, ?_⟩ + intro hb o Q _ bW d _ _ + have hRinv (j : Fin m) : (R j)⁻¹ ≤ Real.exp sourceParameter := by + rw [hRadius j] + exact hradius.2.2.2.trans_le (Real.exp_le_exp.mpr (hLq.trans hqSource)) + exact hgeometry hb o bW d (fun _ => chartCap) (fun _ => chartCap) + hforward (fun j => ⟨(mixedDensityCovolumeRatio_pos _ _).le, hvolume j⟩) + (fun _ => Real.exp_le_exp.mpr (hcq.trans hqSource)) + (fun _ => Real.exp_le_exp.mpr (hcq.trans hqSource)) hRinv hσ1 geometryQ hQsite + (fun _ => Real.exp c) (fun _ => (Real.exp_pos c).le) hinverse (fun j => (hRadius j).trans_le (hsmall j)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +noncomputable def allocatedGeometricSourceBudget {A : Type*} [Semiring A] + (m : ℕ) (p c e E : A) : A := + let q := allocatedGeometrySourceInput m p c e E + q + siteSourceParameter m q + siteSourceMaskLog m q + +theorem allocatedGeometricSourceBudget_controls (m : ℕ) {p c e E : ℝ} + (hp : 0 ≤ p) (hc : 0 ≤ c) (he : 0 ≤ e) (hE : 0 ≤ E) : + let q := allocatedGeometrySourceInput m p c e E + let B := allocatedGeometricSourceBudget m p c e E + 0 ≤ q ∧ q ≤ B ∧ siteSourceParameter m q ≤ B ∧ siteSourceMaskLog m q ≤ B := by + have hscaleInput := (allocatedGeometryInput_bounds m hp hc (le_refl 0) hE).1 + have hscale := (allocatedSiteSourceLog_bounds m hscaleInput he hE).1 + have hq : 0 ≤ allocatedGeometrySourceInput m p c e E := + (allocatedGeometryInput_bounds m hp hc hscale hE).1 + have hparameter := (siteSourceParameter_bounds m hq).1 + have hmask := siteSourceMaskLog_nonneg m hq + dsimp only [allocatedGeometricSourceBudget] + exact ⟨hq, by linarith, by linarith, by linarith⟩ + +theorem map_allocatedGeometricSourceBudget {A B : Type*} [Semiring A] [Semiring B] + (f : A →+* B) (m : ℕ) (p c e E : A) : + f (allocatedGeometricSourceBudget m p c e E) = + allocatedGeometricSourceBudget m (f p) (f c) (f e) (f E) := by + simp [map_ofNat, allocatedGeometricSourceBudget, allocatedGeometrySourceInput, allocatedGeometryInput, + allocatedIdealCoverPrimitiveLog, allocatedIdealCoverInputLog, allocatedSiteCoefficientLog, + siteSourceParameter, siteSourceMaskLog, canonicalScalarSourceLog, + allocatedSiteScaleLog, allocatedSiteScaleNumeric, allocatedSiteKernelMaskLog, + allocatedComparisonDimension, allocatedIdealScaleLog, allocatedIdealScaleInput, + allocatedPhysicalIdealLengthEnvelope, allocatedTestLengthEnvelope, allocatedJointLengthEnvelope, + allocatedTestEnvelope, allocatedFrontEnvelope, allocatedAccuracyEnvelope, allocatedTupleEnvelope, + allocatedKernelEnvelope, allocatedIdealMeshEnvelope, allocatedIdealGridEnvelope, + allocatedIdealRadiusEnvelope, allocatedProxyLipEnvelope, allocatedIdealLipEnvelope, + allocatedSupportEnvelope, allocatedDensityEnvelope, kernelOutputEnvelope, + kernelGeometryEnvelope, kernelInverseEnvelope] + +theorem exists_allocatedGeometricSourceBudget_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ p : ℝ, 0 ≤ p → allocatedGeometricSourceBudget m p p p p ≤ (p + a) ^ a := by + let poly : Polynomial ℕ := allocatedGeometricSourceBudget m Polynomial.X Polynomial.X Polynomial.X Polynomial.X + obtain ⟨a, ha, hbound⟩ := exists_natPolynomial_eval_budget poly + refine ⟨a, ha, ?_⟩ + intro p hp + have heval : poly.eval₂ (Nat.castRingHom ℝ) p = allocatedGeometricSourceBudget m p p p p := by + simpa only [poly, Polynomial.coe_eval₂RingHom, Polynomial.eval₂_X] using + map_allocatedGeometricSourceBudget (Polynomial.eval₂RingHom (Nat.castRingHom ℝ) p) + m Polynomial.X Polynomial.X Polynomial.X Polynomial.X + exact heval ▸ hbound p hp + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedIdealRowTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedIdealRowTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..d207da5e3d19cf0af6409fdcabe6c4954115ae21 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedIdealRowTransport.lean @@ -0,0 +1,73 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedWholeProfileEnvelope + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory BooleanCubeKernel +open scoped BigOperators Matrix NNReal Classical + +attribute [local instance 2000] fullBooleanRowSetFintype + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (X : Type*) [Fintype X] +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Module.Basis (Kcov j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (N : X → ℕ) {W τ ξ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) (Z : ℝ) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hmem : ∀ j e, coefficients (p j) e ∈ U j) + +local notation "standardRows" => (fun j : Fin m => + (Subtype.val : BoundedBooleanJet (Fin dim) (Fin.val j + 1) → Finset (Fin dim))) +local notation "fullRows" => (fun j : Fin m => + (Subtype.val : boundedBooleanJetRows (Fin dim) (Fin.val j + 1) → Finset (Fin dim))) + +theorem allocatedWholeIdealReference_full_rows (δ : ℝ≥0) : + allocatedWholeIdealReference (τ := τ) (ξ := ξ) + B U b hR hσ S x standardRows X hM selection hx modulus q reference hb o bW d + N hW mesh base cells (physicalCubeEuclideanSample U d p hmem) test Z δ = + allocatedWholeIdealReference (τ := τ) (ξ := ξ) + B U b hR hσ S x fullRows X hM selection hx modulus q reference hb o bW d + N hW mesh base cells (physicalCubeRowSample U d fullRows p hmem) test Z δ := by + let P (O : Fin m → Type) [∀ j, Fintype (O j)] (rows : ∀ j, O j → Finset (Fin dim)) : Prop := + allocatedWholeIdealReference (τ := τ) (ξ := ξ) + B U b hR hσ S x standardRows X hM selection hx modulus q reference hb o bW d + N hW mesh base cells (physicalCubeEuclideanSample U d p hmem) test Z δ = + allocatedWholeIdealReference (τ := τ) (ξ := ξ) + B U b hR hσ S x rows X hM selection hx modulus q reference hb o bW d + N hW mesh base cells (physicalCubeRowSample U d rows p hmem) test Z δ + have hP : P (fun j : Fin m => BoundedBooleanJet (Fin dim) (Fin.val j + 1)) standardRows := by + rfl + exact boundedBooleanJetRows_family_transport (fun j : Fin m => Fin.val j + 1) P hP + (fun j => fullBooleanRowSetFintype dim (Fin.val j + 1)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveNaturalSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveNaturalSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..d418ee23ff5c644cc5f318ef3c7b59623e0a3768 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveNaturalSupport.lean @@ -0,0 +1,95 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedInactiveNaturalPlateau + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (j : Fin m) (i : Fin (n j)) (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : ∀ (a : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)), + (Fintype.card α + 1) * q ≤ allocatedPrincipalSides B U b S ⟨⟨j, Sum.inr i⟩, a, v⟩) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + +local notation "height" => basisAxisScale (b j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "source" => allocatedLocalResidueSources B U b S j i q hq r hsize +local notation "radius" => blockJetScaleBound (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 +local notation "constantLaw" => allocatedLayerIntegerPMFs B U b hR hσ S j i + (principalCoefficientChoice (G := G) (layerSamplerDegree I n) (Sigma.mk j (Sum.inr i)) none) + +local notation "scale" => allocatedPrincipalGridScale (G := G) B U b (R := R) j i +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) +local notation "constantRadius" => 2 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B j i) : ℝ) + 1) + +include hq hsize in +theorem allocatedInactiveNaturalPoint_zero_off_window + (hgamma : gamma ≤ 1) (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (hgrid : allocatedGridAxis (I := I) U b S.value ⟨j, Sum.inr i⟩) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (x : G → IntegerScalarCubeBox α S.value) (z : rows → ℤ) + (hz : ¬∀ t, |(z t : ℝ)| ≤ (radius + constantRadius) * scale) : + allocatedSupportedPhysicalGridPMF B U b hR hσ S q r hcell j i rows x z = 0 := by + unfold allocatedSupportedPhysicalGridPMF + rw [allocatedSupportedResidueJetPMF_constant_mixture B U b hR hσ S q r hcell j i hgrid rows x] + apply pmf_bind_zero_of_support + intro c hc + apply weightedCubePMF_zero_off_scaled_support source zero_le_one + (fun a => by simpa only [one_mul] using + (allocatedInactiveResidueSources_natural_scale B U b S j i q hq r hsize hR hgamma hsmall hlarge).1 a) + rows hrows (fun t => booleanCoefficient (fun _ : Finset α => c) t) z _ + (allocatedInactiveResidueJetPMF_source B U b S j i q hq r hsize hR hσ hsmall hlarge hcell rows _) + intro hrelative + apply hz + apply real_coordinate_support_add z _ hrelative + intro t + rw [booleanCoefficient_const] + split_ifs + · exact (div_le_iff₀ (Nat.cast_pos.mpr (allocatedPrincipalGridScale_pos_of_radius B U b hR j i))).mp + (allocatedConstantLaw_natural_bound B U b hR hσ S j i c hc) + · simp only [Int.cast_zero, abs_zero] + positivity + +include hq hsize in +theorem allocatedInactiveNaturalSites_bound + (hgamma : gamma ≤ 1) (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (hgrid : allocatedGridAxis (I := I) U b S.value ⟨j, Sum.inr i⟩) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ) + (hy : ∀ t ∉ rows, booleanCoefficient y t = 0) + (hmass : allocatedSupportedPhysicalGridPMF B U b hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t) ≠ 0) : + ∀ u, |(y u : ℝ) / scale| ≤ rows.card * (radius + constantRadius) := by + have hcoeff : ∀ t : rows, |((booleanCoefficient y t : ℤ) : ℝ)| ≤ (radius + constantRadius) * scale := by + by_contra hn + exact hmass (allocatedInactiveNaturalPoint_zero_off_window B U b S j i q hq r hsize hR hσ + hgamma hsmall hlarge hcell hgrid rows hrows x _ hn) + intro u + exact integer_boolean_sites_bound y rows hy + (add_nonneg (blockJetScaleBound_nonneg _ _ _ zero_le_one) (by positivity)) + (Nat.cast_pos.mpr (allocatedPrincipalGridScale_pos_of_radius B U b hR j i)) (fun t ht => hcoeff ⟨t, ht⟩) u + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..a23a7e85b840d6b30a9e230f6d2640f3ed8268e5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveSupport.lean @@ -0,0 +1,101 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedInactivePointCap + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (j : Fin m) (i : Fin (n j)) (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hsize : ∀ (a : B ⟨j, Sum.inr i⟩) (v : Fin (j.val + 1)), + (Fintype.card α + 1) * q ≤ allocatedPrincipalSides B U b S ⟨⟨j, Sum.inr i⟩, a, v⟩) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + +local notation "height" => basisAxisScale (b j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "source" => allocatedLocalResidueSources B U b S j i q hq r hsize +local notation "radius" => blockJetScaleBound (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 +local notation "constantLaw" => allocatedLayerIntegerPMFs B U b hR hσ S j i + (principalCoefficientChoice (G := G) (layerSamplerDegree I n) (Sigma.mk j (Sum.inr i)) none) + +omit [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] in +theorem allocatedConstantLaw_height_bound (c : ℤ) (hc : c ∈ (constantLaw).support) : + |(c : ℝ)| ≤ (R j / 4) * height := by + change c ∈ (allocatedLayerIntegerPMFs B U b hR hσ S j i (constantCoefficientSlot _ _)).support at hc + rw [allocatedLayerIntegerPMFs_constant B U b hR hσ S j i] at hc + have hk : (0 : ℝ) < height := Nat.cast_pos.mpr (basisAxisScale_pos (b j) i) + have hb := constantIntegerPMF_support height (R j / 4) hk (div_pos (hR j) (by norm_num)) hc + have hdiv : |(c : ℝ) / height| ≤ R j / 4 := by linarith only [hb, hR j] + rw [abs_div, abs_of_pos hk] at hdiv + exact (div_le_iff₀ hk).mp hdiv + +include hq hsize in +theorem allocatedInactivePhysicalPoint_zero_off_window + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (hgrid : allocatedGridAxis (I := I) U b S.value ⟨j, Sum.inr i⟩) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (x : G → IntegerScalarCubeBox α S.value) (z : rows → ℤ) + (hz : ¬∀ t, |(z t : ℝ)| ≤ (radius + R j / 4) * height) : + allocatedSupportedPhysicalGridPMF B U b hR hσ S q r hcell j i rows x z = 0 := by + unfold allocatedSupportedPhysicalGridPMF + rw [allocatedSupportedResidueJetPMF_constant_mixture B U b hR hσ S q r hcell j i hgrid rows x] + apply pmf_bind_zero_of_support + intro c hc + apply weightedCubePMF_zero_off_scaled_support source zero_le_one + (fun a => by simpa only [one_mul] using + (allocatedInactiveResidueSources_scale B U b S j i q hq r hsize hsmall hlarge).1 a) + rows hrows (fun t => booleanCoefficient (fun _ : Finset α => c) t) z _ + (allocatedInactiveResidueJetPMF_source B U b S j i q hq r hsize hR hσ hsmall hlarge hcell rows _) + intro hrelative + apply hz + apply real_coordinate_support_add z _ hrelative + intro t + rw [booleanCoefficient_const] + split_ifs + · exact allocatedConstantLaw_height_bound B U b S j i hR hσ c hc + · simp only [Int.cast_zero, abs_zero] + exact mul_nonneg (div_nonneg (hR j).le (by norm_num)) (Nat.cast_nonneg _) + +include hq hsize in +theorem allocatedInactivePhysicalSites_bound + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (hgrid : allocatedGridAxis (I := I) U b S.value ⟨j, Sum.inr i⟩) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ) + (hy : ∀ t ∉ rows, booleanCoefficient y t = 0) + (hmass : allocatedSupportedPhysicalGridPMF B U b hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t) ≠ 0) : + ∀ u, |(y u : ℝ) / height| ≤ rows.card * (radius + R j / 4) := by + have hcoeff : ∀ t : rows, |((booleanCoefficient y t : ℤ) : ℝ)| ≤ (radius + R j / 4) * height := by + by_contra hn + exact hmass (allocatedInactivePhysicalPoint_zero_off_window B U b S j i q hq r hsize hR hσ + hsmall hlarge hcell hgrid rows hrows x _ hn) + intro u + exact integer_boolean_sites_bound y rows hy + (add_nonneg (blockJetScaleBound_nonneg _ _ _ zero_le_one) (div_nonneg (hR j).le (by norm_num))) + (Nat.cast_pos.mpr (basisAxisScale_pos (b j) i)) (fun t ht => hcoeff ⟨t, ht⟩) u + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveSupportBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveSupportBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..679d30812145309879732e7685864dbb1063fb81 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedInactiveSupportBudget.lean @@ -0,0 +1,256 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedPhysicalLongIdealCap + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem two_mul_add_three_exp_bound {x P : ℝ} (hP : 0 ≤ P) (hx : x ≤ Real.exp P) : + 2 * x + 3 ≤ Real.exp (P + 4) := by + have h1 := Real.one_le_exp_iff.mpr hP + have h5 : (5 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + calc + _ ≤ 5 * Real.exp P := by linarith + _ ≤ Real.exp 4 * Real.exp P := mul_le_mul_of_nonneg_right h5 (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, add_comm] + +theorem blockJetScaleBound_four_exp (q h b : ℕ) {D : ℝ} (hD : 0 ≤ D) + (hq : (q : ℝ) ≤ D) (hh : (h : ℝ) ≤ D) (hb : (b : ℝ) ≤ D) : + blockJetScaleBound q h b 4 ≤ Real.exp (D ^ 2 + 2 * D + 4) := by + have hbexp : (b : ℝ) ≤ Real.exp D := hb.trans (by linarith [Real.add_one_le_exp D]) + have hqexp : ((q + 1 : ℕ) : ℝ) ≤ Real.exp D := by + push_cast + linarith [Real.add_one_le_exp D] + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hpowtwo : (2 : ℝ) ^ h ≤ Real.exp D := by + simpa only [mul_one] using pow_le_exp_mul_of_le_exp (by norm_num) htwo (by norm_num) h hh + have hpowq := pow_le_exp_mul_of_le_exp (Nat.cast_nonneg (q + 1)) hqexp hD h hh + have hfour : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + unfold blockJetScaleBound + calc + _ ≤ Real.exp D * Real.exp D * Real.exp (D * D) * Real.exp 4 := by + gcongr + _ = _ := by + rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + +namespace VectorPolynomial + +def allocatedNaturalSupportLog {A : Type*} [Semiring A] (D : A) : A := D ^ 2 + 3 * D + 7 + +def allocatedNaturalSiteLog {A : Type*} [Semiring A] (D : A) : A := D ^ 2 + 4 * D + 8 + +def allocatedSiteCoefficientLog {A : Type*} [Semiring A] (D : A) : A := D ^ 2 + 5 * D + 8 + +theorem allocatedNaturalSupportLog_nonneg {D : ℝ} (hD : 0 ≤ D) : + 0 ≤ allocatedNaturalSupportLog D := by unfold allocatedNaturalSupportLog; positivity + +theorem allocatedNaturalSiteLog_nonneg {D : ℝ} (hD : 0 ≤ D) : + 0 ≤ allocatedNaturalSiteLog D := by unfold allocatedNaturalSiteLog; positivity + +theorem allocatedSiteCoefficientLog_nonneg {D : ℝ} (hD : 0 ≤ D) : + 0 ≤ allocatedSiteCoefficientLog D := by unfold allocatedSiteCoefficientLog; positivity + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {α : Type*} [Fintype α] (rowSets : Fin m → Finset (Finset α)) +variable {D : ℝ} (h : AllocatedComparisonDimensions (G := G) B α (fun j => (rowSets j : Type _)) D) + +include h + +theorem allocatedIntegerBlock_card_le (j : Fin m) (i : Fin (n j)) : + (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ D := by + have hs : ((layerIntegerPrincipalSlots (G := G) B j i).card : ℝ) ≤ D := + (Nat.cast_le.mpr (Finset.card_le_univ _)).trans (h.coefficients j) + simpa only [layerIntegerPrincipalSlots_card] using hs + +theorem allocatedGridTorusFactor_exp_bound (j : Fin m) (i : Fin (n j)) : + (allocatedGridTorusFactor B α ⟨j, i⟩ : ℝ) ≤ Real.exp (D ^ 2 + 2 * D + 8) := by + have hb := blockJetScaleBound_four_exp (Fintype.card α) (j.val + 1) + (Fintype.card (B ⟨j, Sum.inr i⟩)) h.nonneg h.cube (h.layer_degree B j) + (allocatedIntegerBlock_card_le B rowSets h j i) + have ht := (blockTorusFactor_upper (Fintype.card α) (j.val + 1) + (Fintype.card (B ⟨j, Sum.inr i⟩)) (by norm_num : (0 : ℝ) ≤ 4)).trans + (two_mul_add_three_exp_bound (by have hD := h.nonneg; positivity) hb) + calc + _ = (blockTorusFactor (Fintype.card α) (j.val + 1) + (Fintype.card (B ⟨j, Sum.inr i⟩)) 4 : ℝ) := rfl + _ ≤ Real.exp (D ^ 2 + 2 * D + 4 + 4) := ht + _ = _ := by congr 1; ring + +theorem allocatedNaturalSupportRadius_exp_bound (j : Fin m) (i : Fin (n j)) : + allocatedNaturalSupportRadius (G := G) B α j i ≤ Real.exp (allocatedNaturalSupportLog D) := by + have hb := allocatedIntegerBlock_card_le B rowSets h j i + have hs : ((layerIntegerPrincipalSlots (G := G) B j i).card : ℝ) ≤ D := by + simpa only [layerIntegerPrincipalSlots_card] using hb + have hblock := blockJetScaleBound_four_exp (Fintype.card α) (j.val + 1) + (Fintype.card (B ⟨j, Sum.inr i⟩)) h.nonneg h.cube (h.layer_degree B j) hb + have hD := h.nonneg + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hc : allocatedNaturalConstantRadius (G := G) B j i ≤ Real.exp (D + 1) := by + unfold allocatedNaturalConstantRadius + calc + _ ≤ Real.exp 1 * Real.exp D := mul_le_mul htwo + (by linarith [Real.add_one_le_exp D]) (by positivity) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, add_comm] + have ha := add_le_exp_add_one (by positivity : 0 ≤ D ^ 2 + 2 * D + 4) + (by norm_num : (0 : ℝ) ≤ 0) hblock (by norm_num : (1 / 4 : ℝ) ≤ Real.exp 0) + have ht := add_le_exp_add_one (by positivity : 0 ≤ (D ^ 2 + 2 * D + 4) + 0 + 1) + (by positivity : 0 ≤ D + 1) ha hc + exact ht.trans_eq (by + congr 1 + unfold allocatedNaturalSupportLog + ring) + +theorem allocatedNaturalSiteRadius_exp_bound (j : Fin m) (i : Fin (n j)) : + allocatedNaturalSiteRadius (G := G) B j i (rowSets j) + 1 / 4 ≤ + Real.exp (allocatedNaturalSiteLog D) := by + have hD := h.nonneg + have hrow : ((rowSets j).card : ℝ) ≤ D := by + simpa only [Fintype.card_coe] using h.rows j + have hr : ((rowSets j).card : ℝ) ≤ Real.exp D := + hrow.trans (show D ≤ Real.exp D by linarith [Real.add_one_le_exp D]) + have hs := allocatedNaturalSupportRadius_exp_bound B rowSets h j i + have hm : allocatedNaturalSiteRadius (G := G) B j i (rowSets j) ≤ + Real.exp (D + allocatedNaturalSupportLog D) := by + unfold allocatedNaturalSiteRadius + exact (mul_le_mul hr hs (allocatedNaturalSupportRadius_nonneg B α j i) + (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + have ht := add_le_exp_add_one (add_nonneg hD (allocatedNaturalSupportLog_nonneg hD)) + (by norm_num : (0 : ℝ) ≤ 0) hm (by norm_num : (1 / 4 : ℝ) ≤ Real.exp 0) + exact ht.trans_eq (by + congr 1 + unfold allocatedNaturalSiteLog allocatedNaturalSupportLog + ring) + +theorem allocatedSiteCoefficientRadius_exp_bound (a : Σ j : Fin m, Fin (n j)) : + allocatedSiteCoefficientRadius (G := G) B rowSets a ≤ Real.exp (allocatedSiteCoefficientLog D) := by + have hD := h.nonneg + have hs := allocatedNaturalSupportRadius_exp_bound B rowSets h a.1 a.2 + have ht := allocatedNaturalSiteRadius_exp_bound B rowSets h a.1 a.2 + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hp : (2 : ℝ) ^ (a.1.val + 1) ≤ Real.exp D := by + simpa only [mul_one] using pow_le_exp_mul_of_le_exp (by norm_num) htwo + (by norm_num) (a.1.val + 1) (h.layer_degree B a.1) + unfold allocatedSiteCoefficientRadius + refine max_le (hs.trans (Real.exp_le_exp.mpr ?_)) ?_ + · unfold allocatedNaturalSupportLog allocatedSiteCoefficientLog + linarith + · have hh := (mul_le_mul hp ht + (by have hn := allocatedNaturalSiteRadius_nonneg (G := G) B a.1 a.2 (rowSets a.1); positivity) + (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + exact hh.trans_eq (by + congr 1 + unfold allocatedSiteCoefficientLog allocatedNaturalSiteLog + ring) + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +def allocatedInactiveSupportLog {A : Type*} [Semiring A] (D : A) : A := D ^ 2 + 4 * D + 9 + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {α : Type*} [Fintype α] (rowSets : Fin m → Finset (Finset α)) + +noncomputable def allocatedInactiveLongRadius (a : Σ j : Fin m, Fin (n j)) : ℝ := + (rowSets a.1).card * (blockJetScaleBound (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 1 + allocatedNaturalConstantRadius (G := G) B a.1 a.2) + +noncomputable def allocatedInactiveShortRadius (a : Σ j : Fin m, Fin (n j)) : ℝ := + (rowSets a.1).card * + ((Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (a.1.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ (a.1.val + 1)) * + (8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B a.1 a.2) : ℝ) + 1))) + +noncomputable def allocatedInactiveSiteRadius (a : Σ j : Fin m, Fin (n j)) : ℝ := + max (allocatedInactiveLongRadius (G := G) B rowSets a) + (allocatedInactiveShortRadius (G := G) B rowSets a) + 1 / 4 + +omit [Fintype G] [∀ j, Fintype (I j)] in +theorem allocatedInactiveLongRadius_le_natural (a : Σ j : Fin m, Fin (n j)) : + allocatedInactiveLongRadius (G := G) B rowSets a ≤ + allocatedNaturalSiteRadius (G := G) B a.1 a.2 (rowSets a.1) := by + have h14 : blockJetScaleBound (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 1 ≤ + blockJetScaleBound (Fintype.card α) (a.1.val + 1) + (Fintype.card (B ⟨a.1, Sum.inr a.2⟩)) 4 := by + unfold blockJetScaleBound + exact mul_le_mul_of_nonneg_left (by norm_num) (by positivity) + unfold allocatedInactiveLongRadius allocatedNaturalSiteRadius allocatedNaturalSupportRadius + apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) + linarith only [h14] + +variable {D : ℝ} (h : AllocatedComparisonDimensions (G := G) B α (fun j => (rowSets j : Type _)) D) + +include h + +theorem allocatedInactiveShortRadius_exp_bound (a : Σ j : Fin m, Fin (n j)) : + allocatedInactiveShortRadius (G := G) B rowSets a ≤ Real.exp (D ^ 2 + 4 * D + 8) := by + have hD := h.nonneg + have hrow : ((rowSets a.1).card : ℝ) ≤ D := by simpa only [Fintype.card_coe] using h.rows a.1 + have hrowexp : ((rowSets a.1).card : ℝ) ≤ Real.exp D := + hrow.trans (by linarith [Real.add_one_le_exp D]) + have hslots : (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) + (a.1.val + 1)) : ℝ) ≤ Real.exp D := + (h.coefficients a.1).trans (by linarith [Real.add_one_le_exp D]) + have hprincipal : ((Finset.card (layerIntegerPrincipalSlots (G := G) B a.1 a.2) : ℝ) + 1) ≤ + Real.exp D := by + have hb := allocatedIntegerBlock_card_le B rowSets h a.1 a.2 + rw [layerIntegerPrincipalSlots_card] + linarith [Real.add_one_le_exp D] + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have htwoc : (2 : ℝ) ^ Fintype.card α ≤ Real.exp D := by + simpa only [mul_one] using pow_le_exp_mul_of_le_exp (by norm_num) htwo + (by norm_num) (Fintype.card α) h.cube + have hc : (Fintype.card α : ℝ) + 1 ≤ Real.exp D := by + have hc' := h.cube + linarith [Real.add_one_le_exp D] + have hcpow := pow_le_exp_mul_of_le_exp (by positivity) hc hD (a.1.val + 1) (h.layer_degree B a.1) + have height : (8 : ℝ) ≤ Real.exp 8 := by linarith [Real.add_one_le_exp (8 : ℝ)] + have hconstant := (mul_le_mul height hprincipal (by positivity) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + unfold allocatedInactiveShortRadius + calc + _ ≤ Real.exp D * (Real.exp D * (Real.exp D * Real.exp (D * D)) * Real.exp (8 + D)) := by + gcongr + _ = _ := by + simp only [← Real.exp_add] + congr 1 + ring + +theorem allocatedInactiveSiteRadius_exp_bound (a : Σ j : Fin m, Fin (n j)) : + allocatedInactiveSiteRadius (G := G) B rowSets a ≤ Real.exp (allocatedInactiveSupportLog D) := by + have hD := h.nonneg + have hlong := (add_le_add (allocatedInactiveLongRadius_le_natural B rowSets a) + (le_refl (1 / 4 : ℝ))).trans (allocatedNaturalSiteRadius_exp_bound B rowSets h a.1 a.2) + have hlong' : allocatedInactiveLongRadius (G := G) B rowSets a + 1 / 4 ≤ + Real.exp (allocatedInactiveSupportLog D) := hlong.trans (Real.exp_le_exp.mpr (by + unfold allocatedNaturalSiteLog allocatedInactiveSupportLog + linarith)) + have hshort := add_le_exp_add_one (by positivity : 0 ≤ D ^ 2 + 4 * D + 8) + (le_refl (0 : ℝ)) (allocatedInactiveShortRadius_exp_bound B rowSets h a) + (by norm_num : (1 / 4 : ℝ) ≤ Real.exp 0) + have hshort' : allocatedInactiveShortRadius (G := G) B rowSets a + 1 / 4 ≤ + Real.exp (allocatedInactiveSupportLog D) := + hshort.trans_eq (by unfold allocatedInactiveSupportLog; congr 1; ring) + rcases le_total (allocatedInactiveLongRadius (G := G) B rowSets a) + (allocatedInactiveShortRadius (G := G) B rowSets a) with hls | hsl + · simpa only [allocatedInactiveSiteRadius, max_eq_right hls] using hshort' + · simpa only [allocatedInactiveSiteRadius, max_eq_left hsl] using hlong' + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedJetChartSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedJetChartSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0900838b7819431d937ab5d77417a14e94a8403 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedJetChartSupport.lean @@ -0,0 +1,99 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedLongMixedCoefficientBound +import OAI.Combinatorics.Progressions.Lattices.MixedArrayIntegerImage + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule +open scoped BigOperators Matrix + +theorem boundedCoefficientJetMatrix_scaled_entry_bound {α K O : Type*} + [Fintype α] [DecidableEq α] [Fintype K] [Fintype O] [DecidableEq O] + (root : K → ℤ) (A : Matrix α K ℤ) (T : K → ℝ) (hT : ∀ k, 0 < T k) + (hroot : ∀ k, |(root k : ℝ) / T k| ≤ 1) + (hA : ∀ i k, |(A i k : ℝ) / T k| ≤ 1) + (h : ℕ) (rows : O → Finset α) (o : O) (e : VectorPolynomial.BoundedCoefficientExponent K h) : + |(boundedCoefficientJetMatrix root A h rows o e : ℝ)| / monomialScale T e.val ≤ + (2 : ℝ) ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ h := by + let e' := boundedCoefficientIntegerExponentEquiv K h e + have he := congrFun (congrFun (normalizedBoundedIntegerJetMatrix_eq root A h rows T + (H := 1) one_ne_zero) o) e' + rw [normalizedIntegerColumns_entry_div] at he + have hb := boundedDegreeRealJetMatrix_entry_bound _ _ hroot hA h rows o e' + rw [← he] at hb + change |(boundedDegreeIntegerJetMatrix root A h rows o e' : ℝ)| / monomialScale T e'.val ≤ _ + simpa only [div_one, mul_one_div, abs_div, abs_of_pos (monomialScale_pos T hT e'.val)] using hb + +namespace VectorPolynomial + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) + +theorem allocatedLayerSupported_jet_quarter {α : Type*} [Fintype α] [DecidableEq α] + {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] + (root : LayerSamplerVariables G I n B → ℤ) + (A : Matrix α (LayerSamplerVariables G I n B) ℤ) (rows : ∀ j, O j → Finset α) + (hroot : ∀ k, |(root k : ℝ) / layerSamplerBox B U b S k| ≤ 1) + (hA : ∀ i k, |(A i k : ℝ) / layerSamplerBox B U b S k| ≤ 1) + (hσ1 : ∀ j, σ j ≤ 1) (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hsmall : ∀ j, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ (j.val + 1)) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * R j)) ≤ 1 / 4) + (j : Fin m) (a) + (ha : mixedArraySupported (allocatedLayerCenters B U b S j) (allocatedLayerWidths B U b S j) + (allocatedLayerIntegerPMFs B U b hR hσ S j) a) (t : O j) (i : J j) : + |normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (orthonormalMixedChart (o j) (mixedArrayRegroup _ _ _ + (mixedArrayIntegerImage (boundedCoefficientJetMatrix root A (j.val + 1) (rows j)) a) t)) i| ≤ 1 / 4 := by + classical + let T := layerSamplerBox B U b S + let Q := C j * (((Fintype.card (I j) : ℝ) + 1) * R j) + let M := (2 : ℝ) ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ (j.val + 1) + have hT (k) : 0 < T k := lt_of_lt_of_le zero_lt_one (layerSamplerBox_one_le B U b S k) + have hQ : 0 ≤ Q := mul_nonneg (hC j) (mul_nonneg (by positivity) (hR j).le) + have hc (e : BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : + |mixedLiftCoefficient (euclideanSubspace (U j)) (b j) (o j) a e i| ≤ Q / monomialScale T e.val := by + have h := allocatedLayerCoefficient_scaled_bounds B U b hR hσ S hσ1 j a ha e + exact mixedRealPoint_scaled_coordinate_bound _ (b j) (o j) (hC j) (hR j).le + (monomialScale_pos T hT e.val) (hchart j) _ _ h.1 h.2 i + have hterm (e : BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : + |(boundedCoefficientJetMatrix root A (j.val + 1) (rows j) t e : ℝ) * + mixedLiftCoefficient (euclideanSubspace (U j)) (b j) (o j) a e i| ≤ M * Q := by + rw [abs_mul] + calc + _ ≤ |(boundedCoefficientJetMatrix root A (j.val + 1) (rows j) t e : ℝ)| * + (Q / monomialScale T e.val) := mul_le_mul_of_nonneg_left (hc e) (abs_nonneg _) + _ = (|(boundedCoefficientJetMatrix root A (j.val + 1) (rows j) t e : ℝ)| / + monomialScale T e.val) * Q := by ring + _ ≤ M * Q := mul_le_mul_of_nonneg_right + (boundedCoefficientJetMatrix_scaled_entry_bound root A T hT hroot hA _ (rows j) t e) hQ + have he := congrArg (fun v : EuclideanSpace ℝ (J j) => v i) + (mixedArrayIntegerImage_point (euclideanSubspace (U j)) (b j) (o j) + (boundedCoefficientJetMatrix root A (j.val + 1) (rows j)) a t) + change _ = (PiLp.projₗ (𝕜 := ℝ) 2 (fun _ : J j => ℝ) i) _ at he + rw [map_sum] at he + simp only [map_zsmul, zsmul_eq_mul] at he + rw [he] + apply (Finset.abs_sum_le_sum_abs _ _).trans + calc + _ ≤ ∑ _e : BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1), M * Q := + Finset.sum_le_sum (fun e _ => hterm e) + _ = (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * M * Q := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_assoc] + _ ≤ 1 / 4 := hsmall j + +end VectorPolynomial +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedJetSupportBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedJetSupportBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2f626347a16b28f4f5c17b535667004eaa81a95 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedJetSupportBudget.lean @@ -0,0 +1,99 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedDensityParameterBounds + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Matrix Classical + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + +noncomputable def allocatedJetSupportLog (α : Type*) [Fintype α] + (O : Fin m → Type*) [∀ j, Fintype (O j)] (P : ℝ) : ℝ := + allocatedDensityLog (G := G) B α O P + P + + ∑ j : Fin m, + ((Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) + + (Fintype.card α : ℝ)*((j.val+1 : ℕ)+1)) + +theorem allocatedJetSupportLog_bounds (α : Type*) [Fintype α] + (O : Fin m → Type*) [∀ j, Fintype (O j)] {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ allocatedJetSupportLog (G := G) B α O P ∧ + allocatedDensityLog (G := G) B α O P ≤ allocatedJetSupportLog (G := G) B α O P ∧ + ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) + + (Fintype.card α : ℝ)*((j.val+1 : ℕ)+1) + P ≤ allocatedJetSupportLog (G := G) B α O P := by + have hQ := (allocatedDensityLog_bounds (G := G) B α O hP).1 + have hj (j : Fin m) : 0 ≤ + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) + + (Fintype.card α : ℝ)*((j.val+1 : ℕ)+1) := by positivity + have hs := Finset.sum_nonneg (fun j (_ : j ∈ (Finset.univ : Finset (Fin m))) => hj j) + unfold allocatedJetSupportLog + refine ⟨by positivity, by linarith, ?_⟩ + intro j + have he := Finset.single_le_sum (fun k _ => hj k) (Finset.mem_univ j) + linarith + +theorem allocatedJetSupport_budget (α : Type*) [Fintype α] + (O : Fin m → Type*) [∀ j, Fintype (O j)] {P R : ℝ} (hP : 0 ≤ P) + (hR : R ≤ Real.exp P) (j : Fin m) : + Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) * + kernelJetEntryAllowance (Fintype.card α) (j.val+1) * R ≤ + Real.exp (allocatedJetSupportLog (G := G) B α O P) := by + calc + _ ≤ Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) * + kernelJetEntryAllowance (Fintype.card α) (j.val+1) * Real.exp P := + mul_le_mul_of_nonneg_left hR (mul_nonneg (Nat.cast_nonneg _) (kernelJetEntryAllowance_pos _ _).le) + _ ≤ Real.exp ((Fintype.card + (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) + + (Fintype.card α : ℝ)*((j.val+1 : ℕ)+1)) * Real.exp P := + mul_le_mul_of_nonneg_right (nat_mul_kernelEntry_le_exp _ _ _) (Real.exp_pos _).le + _ = _ := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr ((allocatedJetSupportLog_bounds (G := G) B α O hP).2.2 j) + +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U basis S.value a) + (allocatedPrincipalSides B U basis S)) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] +variable (rows : ∀ j, O j → Finset α) + +local notation "grid" => allocatedGridAxis (I := I) U basis (LayerSamplerScale.value S) +local notation "input" => partitionedPrincipalInput grid (fun g a => (g, a)) +local notation "fixed" => Sum.elim (fun ga : G × Option α => (x (Prod.fst ga) (Prod.snd ga) : ℤ)) + (principalTupleIntegers u) + +theorem allocatedPartitionedJet_normalized_bound (j : Fin m) {H : ℝ} (hH : H ≠ 0) : + ∀ o d, |normalizedIntegerColumns (allocatedPartitionedJetMatrix B U basis S x u v rows j) + (fun d => H / monomialScale (layerSamplerBox B U basis S) d.val) (fun _ => H) o d| ≤ + kernelJetEntryAllowance (Fintype.card α) (j.val+1) := by + have hn := allocatedPartitionedInput_bound B U basis S x u v + simpa only [allocatedPartitionedJetMatrix, integerMappedJetMatrix, integerMappedCubeTuple] using + normalizedAffineMonomialJetMatrix_bound + (fun k => Sum.elim fixed (principalTupleIntegers v) (input k none)) + (fun a k => Sum.elim fixed (principalTupleIntegers v) (input k (some a))) + (fun d : BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1) => d.val) + (rows j) (layerSamplerBox B U basis S) (fun d => d.property) + (fun k => hn k none) (fun a k => hn k (some a)) hH + +theorem allocatedPartitionedJet_radius_bound (j : Fin m) (i : Fin (n j)) + {P : ℝ} (hP : 0 ≤ P) (hR0 : 0 ≤ R j) (hRP : R j ≤ Real.exp P) : + ‖matrixSupCLM (normalizedIntegerColumns (allocatedPartitionedJetMatrix B U basis S x u v rows j) + (allocatedIntegerProfileScales B U basis S j i) (fun _ => (basisAxisScale (basis j) i : ℝ)))‖ * R j ≤ + Real.exp (allocatedJetSupportLog (G := G) B α O P) := by + have hm := matrixSupCLM_norm_le _ (kernelJetEntryAllowance_pos (Fintype.card α) (j.val+1)).le + (allocatedPartitionedJet_normalized_bound B U basis S x u v rows j + (Nat.cast_ne_zero.mpr (basisAxisScale_pos (basis j) i).ne')) + exact (mul_le_mul_of_nonneg_right hm hR0).trans (allocatedJetSupport_budget (G := G) B α O hP hRP j) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedLayerQuarterSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedLayerQuarterSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..48aee8795009a60a3c62e2f4ac30e6b1d5e0a168 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedLayerQuarterSupport.lean @@ -0,0 +1,120 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedScalarLogBounds +import OAI.Combinatorics.Progressions.Estimates.MixedRealPoint + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule + +theorem mixedCoefficient_quarter_support {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) (o : OrthonormalBasis I ℝ W) + {C R : ℝ} (hC : 0 ≤ C) (hR : 0 ≤ R) + (hchart : ∀ x, ‖(normalizedOrthogonalChart W b).symm x‖ ≤ C * ‖x‖) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1/4) + (c w : I → ℝ) (hw : ∀ i, 0 < w i) (hcw : ∀ i, |c i| + w i ≤ R) + (p : Fin n → PMF ℤ) + (hp : ∀ i k, k ∈ (p i).support → |(k : ℝ) / basisAxisScale b i| ≤ R) + (x : (I → ℝ) × (Fin n → ℤ)) (hx : mixedCoefficientDensity c w p x ≠ 0) : + ∀ d, |normalizedLatticePoint W b (orthonormalMixedChart o x) d| ≤ 1/4 := by + obtain ⟨hu, hz⟩ := (mixedCoefficientDensity_support c w p x).mp hx + have hn := mixedRealPoint_norm_le W b o hC hR hchart x.1 + (fun i => (x.2 i : ℝ) / basisAxisScale b i) + (fun i => (affineProbabilityProfile_abs_le _ (hw i) (hu i)).trans (hcw i)) + (fun i => hp i _ (hz i)) + rw [mixedRealPoint_integer] at hn + have hquarter : ‖normalizedLatticePoint W b (orthonormalMixedChart o x)‖ ≤ 1/4 := + hn.trans (by simpa only [mul_assoc] using hsmall) + intro d + have hd : |normalizedLatticePoint W b (orthonormalMixedChart o x) d| ≤ + ‖normalizedLatticePoint W b (orthonormalMixedChart o x)‖ := by + simpa only [Real.norm_eq_abs] using + PiLp.norm_apply_le (normalizedLatticePoint W b (orthonormalMixedChart o x)) d + exact hd.trans hquarter + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module Submodule + +variable {D I J V : Type*} [Fintype D] [Fintype I] [Fintype J] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) +variable (Pz : Fin n → Finset J) (j₀ : J) (h L s : ℕ) (hh : 0 < h) (hL : 0 < L) +variable (T : V → ℝ) (hT : ∀ v, 1 ≤ T v) (hTL : ∀ v, T v ≤ L) +variable (e : J → V →₀ ℕ) (he : ∀ j, (e j).sum (fun _ n => n) ≤ s) +variable (R σ : ℝ) (hR : 0 < R) (hσ : 0 < σ) +variable (hgap : ∀ i, L ^ h < basisAxisScale b i → + (principalSamplingGapRatio (principalProfileSize R (Pz i).card) * L) ^ h ≤ basisAxisScale b i) +variable (hεL : 8 * (probabilityProfileLipschitz : ℝ) ≤ tailProfileSize R σ (Fintype.card J) * L) +variable (Pc : I → Finset J) + +local notation "intLaws" => allocatedProjectionPMFs W b Pz j₀ h L s hh hL T hT hTL e he R σ hR hσ hgap hεL + +theorem allocatedArrayColumns_quarter_support (o : OrthonormalBasis I ℝ W) + (hc₀ : ∀ i, j₀ ∉ Pc i) (hz₀ : ∀ i, j₀ ∉ Pz i) (he₀ : e j₀ = 0) (hσ1 : σ ≤ 1) + (hprincipal : ∀ i j, j ∈ Pz i → monomialScale T (e j) = + (integerAxisSideLength h (basisAxisScale b i) L (principalProfileSize R (Pz i).card) : ℝ) ^ h) + {C : ℝ} (hC : 0 ≤ C) + (hchart : ∀ v, ‖(normalizedOrthogonalChart W b).symm v‖ ≤ C * ‖v‖) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1 / 4) + (j : J) (x : (I → ℝ) × (Fin n → ℤ)) + (hx : mixedCoefficientDensity (fun i => allocatedArrayCenters e T Pc R i j) + (fun i => allocatedArrayWidths e T Pc j₀ R σ i j) (fun i => intLaws i j) x ≠ 0) : + ∀ d, |normalizedLatticePoint W b (orthonormalMixedChart o x) d| ≤ 1/4 := by + apply mixedCoefficient_quarter_support W b o hC hR.le hchart hsmall _ _ + (fun i => allocatedArrayWidths_pos e T (fun v => lt_of_lt_of_le zero_lt_one (hT v)) Pc j₀ hR hσ i j) + (fun i => allocatedArrayProfiles_bound e T hT Pc j₀ hc₀ hR hσ hσ1 i j) _ _ x hx + intro i k hk + apply scaledAbs_le_of_bound (one_le_monomialScale T hT (e j)) + exact (allocatedIntegerCoefficient_bound (Pz i) j₀ h (basisAxisScale b i) L s hh + (basisAxisScale_pos b i) hL T (fun v => lt_of_lt_of_le zero_lt_one (hT v)) hTL e he + R σ hR hσ hσ1 (hgap i) hεL (hz₀ i) he₀ (hprincipal i) j hk).trans (by linarith) + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +theorem allocatedLayerColumns_quarter_support (hσ1 : ∀ j, σ j ≤ 1) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hsmall : ∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1/4) + (j : Fin m) (d) (x) + (hx : mixedCoefficientDensity (fun i => allocatedLayerCenters B U b S j i d) + (fun i => allocatedLayerWidths B U b S j i d) + (fun i => allocatedLayerIntegerPMFs B U b hR hσ S j i d) x ≠ 0) : + ∀ a, |normalizedLatticePoint (euclideanSubspace (U j)) (b j) (orthonormalMixedChart (o j) x) a| ≤ 1/4 := by + exact allocatedArrayColumns_quarter_support (euclideanSubspace (U j)) (b j) (layerIntegerPrincipalSlots B j) + (constantCoefficientSlot _ _) (j.val + 1) S.value (layerTailDegree m) (Nat.zero_lt_succ _) S.positive + (layerSamplerBox B U b S) (layerSamplerBox_one_le B U b S) (layerSamplerBox_le B U b S) + Subtype.val (fun d => d.property.trans (layerDegree_le_tailDegree j)) + (R j) (σ j) (hR j) (hσ j) (S.gap j) (S.width j) + (layerContinuousPrincipalSlots B j) (o j) (layerContinuousPrincipalSlots_not_constant B j) + (layerIntegerPrincipalSlots_not_constant B j) rfl (hσ1 j) + (layerSamplerSides_integer_principal B U b R S.value j) (hC j) (hchart j) (hsmall j) d x hx + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedMaskedChartProduct.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedMaskedChartProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..4901ba0f073e9c6d66eb1c2ebf0d6002d58343a8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedMaskedChartProduct.lean @@ -0,0 +1,229 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCutoffMaskedIdeal + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] (r : ℝ≥0) (hr : 0 < r) (period : ℕ) + +local notation "single" => (fun _ : Fin m => Unit) +local notation "quarter" => (fun j (_ : Unit) => standardLatticeClosedQuarterBox (J j)) +local notation "chart" => mixedCoveredJetChart (O := single) U o b hb bW d +local notation "region" => mixedCoveredJetRegion (O := single) (E := E) U o b d quarter + +noncomputable def mixedCoveredSiteResidue (w : MixedCoveredJetSource I single E n d) : + (∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period) := + (fun j i => ((w.1 j).2 i () : ZMod period), fun j i => ((w.2 j () i).val : ZMod period)) + +noncomputable def allocatedMaskedSiteChartFactor + (label : (∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) + (f : (LayerSamplerAxis I n → ℝ) → ℂ) : EuclideanJetLayers U single → ℂ := + restrictedComplexChartDensity chart region 1 (fun w => + if mixedCoveredSiteResidue d period w = label then + allocatedBufferedMixedSiteFactor B U b S r hr f (fun j => mixedArrayRegroup _ _ _ (w.1 j) ()) + else 0) + +theorem allocatedMaskedSiteChartFactor_apply + (label : (∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) + (f : (LayerSamplerAxis I n → ℝ) → ℂ) + (w : MixedCoveredJetSource I single E n d) (hw : w ∈ region) : + allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label f (chart w) = + if mixedCoveredSiteResidue d period w = label then + allocatedBufferedSiteChartFactor B U b S o hb bW d r hr f (chart w) else 0 := by + have hinj := mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) + simp only [allocatedMaskedSiteChartFactor, allocatedBufferedSiteChartFactor, + restrictedComplexChartDensity_apply _ _ _ _ hinj hw, Complex.ofReal_one, one_mul] + +theorem allocatedMaskedSiteChartFactor_norm + (label : (∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) + (f : (LayerSamplerAxis I n → ℝ) → ℂ) (hf : ∀ v, ‖f v‖ ≤ 1) + (y : EuclideanJetLayers U single) : + ‖allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label f y‖ ≤ 1 := by + apply restrictedComplexChartDensity_norm_le chart region + (mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j))) _ zero_le_one + intro w + split_ifs + · exact allocatedBufferedMixedSiteFactor_norm_le B U b S r hr f hf _ + · simp only [norm_zero, zero_le_one] + +theorem allocatedMaskedSiteChartFactor_zero_of_cutoff_zero + (label : (∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) + (f : (LayerSamplerAxis I n → ℝ) → ℂ) (y : EuclideanJetLayers U single) + (hy : allocatedBufferedSiteChartFactor B U b S o hb bW d r hr (fun _ => 1) y = 0) : + allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label f y = 0 := by + by_cases hmem : y ∈ chart '' region + · obtain ⟨w, hw, rfl⟩ := hmem + rw [allocatedMaskedSiteChartFactor_apply B U b S o hb bW d r hr period label f w hw] + split_ifs + · exact allocatedBufferedSiteChartFactor_zero_of_cutoff_zero B U b S o hb bW d r hr f _ hy + · rfl + · unfold allocatedMaskedSiteChartFactor + exact restrictedComplexChartDensity_zero _ _ _ _ hmem + +omit [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] in +theorem mixedCoveredSiteResidue_measurable [NeZero period] : + Measurable (mixedCoveredSiteResidue (I := I) (E := E) (n := n) d period) := by + apply Measurable.prodMk + · apply Measurable.of_eval + intro j + apply Measurable.of_eval + intro i + exact (measurable_of_countable (fun z : ℤ => (z : ZMod period))).comp (by fun_prop) + · apply Measurable.of_eval + intro j + apply Measurable.of_eval + intro i + exact (measurable_of_countable (fun z : ZMod d => (z.val : ZMod period))).comp (by fun_prop) + +theorem allocatedMaskedSiteChartFactor_measurable [NeZero period] + (label : (∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) + (f : (LayerSamplerAxis I n → ℝ) → ℂ) {L : ℝ≥0} + (hf : LipschitzWith L f) (hf1 : ∀ v, ‖f v‖ ≤ 1) : + Measurable (allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label f) := by + apply mixedCoveredJet_restrictedComplexDensity_measurable U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) + (fun j _ => (standardLatticeClosedQuarterBox_isCompact (J j)).isClosed.measurableSet) + have hset : MeasurableSet {w : MixedCoveredJetSource I single E n d | mixedCoveredSiteResidue d period w = label} := + (mixedCoveredSiteResidue_measurable (I := I) (E := E) (n := n) d period) (measurableSet_singleton label) + have hbuf : Measurable (fun w : MixedCoveredJetSource I single E n d => + allocatedBufferedMixedSiteFactor B U b S r hr f (fun j => mixedArrayRegroup _ _ _ (w.1 j) ())) := by + let : ∀ j, BorelSpace ((I j → ℝ) × (Fin (n j) → ℤ)) := fun _ => inferInstance + let : BorelSpace (∀ j, (I j → ℝ) × (Fin (n j) → ℤ)) := Pi.borelSpace + apply (allocatedBufferedMixedSiteFactor_continuous B U b S r hr f hf hf1).measurable.comp + change Measurable (fun w : MixedCoveredJetSource I single E n d => + fun j => ((fun i => (w.1 j).1 i ()), (fun i => (w.1 j).2 i ()))) + fun_prop + exact hbuf.ite hset measurable_const + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] (r : ℝ≥0) (hr : 0 < r) (period : ℕ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "region" => mixedCoveredJetRegion (E := E) U o b d + (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr + +omit [Fintype α] [DecidableEq α] in +theorem allocatedProductMaskedIdealSiteFactor_zero + {K : Type*} (f : K → Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (label : Finset α → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period))) + (k : K) (s : Finset α) (w : MixedCoveredJetSource I (fun _ => Unit) E n d) + (hw : allocatedBufferedSiteChartFactor B U b S o hb bW d r hr (fun _ => 1) (chart w) = 0) : + allocatedProductMaskedIdealSiteFactor B U b S d period r hr hb o bW f label k s w = 0 := by + unfold allocatedProductMaskedIdealSiteFactor maskedSiteFactor + dsimp only + rw [allocatedBufferedSiteChartFactor_zero_of_cutoff_zero B U b S o hb bW d r hr (f k s) _ hw] + split_ifs <;> rfl + +theorem allocatedMaskedChartProduct_zero_of_cutoff_zero + (f : Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (label : Finset α → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period))) + (y : EuclideanJetLayers U rowTypes) (hy : cutoff y = 0) : + (∏ s, allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period (label s) (f s) + (coveredRowsSiteValue rowSets U y s)) = 0 := by + change (∏ s, allocatedBufferedSiteChartFactor B U b S o hb bW d r hr (fun _ => 1) + (coveredRowsSiteValue rowSets U y s)) = 0 at hy + obtain ⟨s, hs, hsite⟩ := Finset.prod_eq_zero_iff.mp hy + exact Finset.prod_eq_zero hs + (allocatedMaskedSiteChartFactor_zero_of_cutoff_zero B U b S o hb bW d r hr period (label s) (f s) _ hsite) + +theorem allocatedMaskedMixedProduct_zero_of_cutoff_zero + {K : Type*} (f : K → Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (label : Finset α → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period))) + (k : K) (z : MixedCoveredJetSource I rowTypes E n d) (hz : cutoff (chart z) = 0) : + (∏ s, allocatedProductMaskedIdealSiteFactor B U b S d period r hr hb o bW f label k s + (mixedCoveredRowsSiteValue rowSets d z s)) = 0 := by + change (∏ s, allocatedBufferedSiteChartFactor B U b S o hb bW d r hr (fun _ => 1) + (coveredRowsSiteValue rowSets U (chart z) s)) = 0 at hz + obtain ⟨s, hs, hsite⟩ := Finset.prod_eq_zero_iff.mp hz + refine Finset.prod_eq_zero hs (allocatedProductMaskedIdealSiteFactor_zero B U b S o hb bW d r hr period f label k s _ ?_) + simpa only [mixedCoveredRowsSiteValue_chart] using hsite + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset α) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)))) ≤ 1 / 4) + +include hR hC hchart hbudget in +theorem allocatedMaskedChartProduct_eq_mixed + {K : Type*} (f : K → Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (label : Finset α → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period))) + (k : K) (z : MixedCoveredJetSource I rowTypes E n d) (hz : z ∈ region) : + (∏ s, allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period (label s) (f k s) + (coveredRowsSiteValue rowSets U (chart z) s)) = + ∏ s, allocatedProductMaskedIdealSiteFactor B U b S d period r hr hb o bW f label k s + (mixedCoveredRowsSiteValue rowSets d z s) := by + by_cases hc : cutoff (chart z) = 0 + · rw [allocatedMaskedChartProduct_zero_of_cutoff_zero B U b S o hb bW d r hr period rowSets (f k) label _ hc, + allocatedMaskedMixedProduct_zero_of_cutoff_zero B U b S o hb bW d r hr period rowSets f label k z hc] + · have hsites := allocatedProductSiteCutoff_sites_quarter B U b S rowSets o hb bW d r hr + hR C hC hchart hbudget z hz hc + apply Finset.prod_congr rfl + intro s _ + rw [← mixedCoveredRowsSiteValue_chart rowSets U o b hb bW d z s, + allocatedMaskedSiteChartFactor_apply B U b S o hb bW d r hr period (label s) (f k s) _ (hsites s)] + simp only [mixedCoveredSiteResidue, allocatedProductMaskedIdealSiteFactor, maskedSiteFactor] + split_ifs with hlabel <;> simp_all + +include hR hC hchart hbudget in +theorem allocatedMaskedChartProduct_zero_outside + (f : Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (label : Finset α → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period))) + (y : EuclideanJetLayers U rowTypes) (hy : y ∉ chart '' region) : + (∏ s, allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period (label s) (f s) + (coveredRowsSiteValue rowSets U y s)) = 0 := by + apply allocatedMaskedChartProduct_zero_of_cutoff_zero B U b S o hb bW d r hr period rowSets f label y + apply allocatedProductSiteCutoff_zero_outside B U b S rowSets o hb bW d r hr hR C hC hchart _ y hy + intro j + have hn : 0 ≤ (Fintype.card (Finset α) : ℝ) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j))) := + mul_nonneg (Nat.cast_nonneg _) (mul_nonneg (hC j) + (mul_nonneg (by positivity) (mul_nonneg (by positivity) (hR j).le))) + have hb := hbudget j + nlinarith [Nat.cast_nonneg (α := ℝ) (rowSets j).card] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedMixedFixedSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedMixedFixedSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..62db5dfaafba3cf5864b729806f66f6c8d536be3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedMixedFixedSupport.lean @@ -0,0 +1,307 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedMixedSiteBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +universe uα + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) +variable (j : Fin m) (i : Fin (n j)) (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) + +local notation "degree" => Fin.val j + 1 +local notation "scale" => allocatedPrincipalGridScale (G := G) B U b (R := R) j i +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +include hq in +theorem exists_allocated_inactive_fixed_support_site_expansion + [Nonempty (B ⟨j, Sum.inr i⟩)] {D P p v ε E : ℝ} + (hD : AllocatedComparisonDimensions (G := G) B α (fun a => (rowSets a : Type _)) D) + (hα : Fintype.card α ≤ m + 1) (hP : 1 ≤ P) (hp : 0 ≤ p) (hv : 0 ≤ v) + (hPp : P ≤ Real.exp p) (hqv : (q : ℝ) ≤ Real.exp v) + (hε : 0 < ε) (hε1 : ε ≤ 1) (hE : 0 ≤ E) (hεE : ε⁻¹ ≤ Real.exp E) + (hsize : (Fintype.card α + 1) * q ≤ S.value) (hgamma : gamma ≤ 1) + (hsmall : basisAxisScale (b j) i ≤ S.value ^ degree) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (hgrid : allocatedGridAxis (I := I) U b S.value ⟨j, Sum.inr i⟩) + (hσ1 : σ j ≤ 1) (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) + (hprimitive : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hrows : ∀ t ∈ rowSets j, t.card ≤ degree) + (hB : uniformSpectrumBlockCount j.val (rowSets j).card (degree * (rowSets j).card) ≤ + Fintype.card (B ⟨j, Sum.inr i⟩)) : + let O := allocatedInactiveSiteOutputLog m D p v E + ∃ e : ScalarSiteExpansion.{uα,uα} (Finset α), + e.Bounds (Real.exp O) (Real.exp O) (Real.exp O) ⟨Real.exp O, Real.exp_nonneg _⟩ (Real.exp (allocatedInactiveSupportLog D)) ∧ + ∀ (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ), + (∀ t ∉ rowSets j, booleanCoefficient y t = 0) → + ‖(((scale : ℝ) ^ (rowSets j).card * + (allocatedSupportedPhysicalGridPMF B U b hR hσ S q r hcell j i (rowSets j) x + (fun t => booleanCoefficient y t)).toReal : ℝ) : ℂ) - e.integerEval scale y‖ ≤ 2 * ε := by + have hQ := (allocatedInactiveSiteBudgetLog_bounds m hD.nonneg hp hv hE).1 + obtain ⟨hHQ, hεQ, hLQ, hshortCap, hshortLip, herror⟩ := + allocatedInactiveSite_construction_bounds B rowSets hD hα hP hp hv hPp hε hε1 hE hεE q hqv ⟨j, i⟩ + obtain ⟨e, he, herr⟩ := exists_allocated_inactive_natural_site_expansion_all_cases + B U b S j i q hq r hR hσ (rowSets j) P ε hsize hgamma hsmall hcell hgrid hσ1 A hA + hprimitive hε hε1 hrows hB hε hQ hHQ hεQ hLQ hshortCap hshortLip herror + obtain ⟨hT, hperiod, hC, hL⟩ := allocatedInactiveSite_output_bounds B rowSets hD hα hP hp hv hPp + hε hε1 hE hεE ⟨j, i⟩ + refine ⟨e, he.mono hT hperiod hC ?_ (allocatedInactiveSiteRadius_exp_bound B rowSets hD ⟨j, i⟩), ?_⟩ + · exact_mod_cast hL + · intro x y hy + simpa only [two_mul] using herr x y hy + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +universe uα + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) +variable (j : Fin m) (i : Fin (n j)) (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) + +local notation "degree" => Fin.val j + 1 +local notation "scale" => allocatedPrincipalGridScale (G := G) B U b (R := R) j i +local notation "torus" => allocatedGridTorusFactor B α (Sigma.mk j i) +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +include hq in +theorem exists_allocated_active_fixed_support_site_expansion + {D P p ε E : ℝ} + (hD : AllocatedComparisonDimensions (G := G) B α (fun a => (rowSets a : Type _)) D) + (hα : Fintype.card α ≤ m + 1) (hP : 1 ≤ P) (hp : 0 ≤ p) (hPp : P ≤ Real.exp p) + (hε : 0 < ε) (hε1 : ε ≤ 1) (hE : 0 ≤ E) (hεE : ε⁻¹ ≤ Real.exp E) + (hactive : S.value ^ degree < basisAxisScale (b j) i) + (hsize : (Fintype.card α + 1) * q ≤ S.value) (hgamma : gamma ≤ S.value) + (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) + (hgrid : allocatedGridAxis (I := I) U b S.value ⟨j, Sum.inr i⟩) + (L : ℝ≥0) (hL : LipschitzWith L Real.smoothTransition) + (hcP : scalarCubePrimitiveEnvelope Empty L 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α L 1 0 q ≤ P) + (hrows : ∀ t ∈ rowSets j, t.card ≤ degree) + (hB : positiveModerateSpectrumBlockCount j.val (rowSets j).card + ((layerTailDegree m + 2) * (rowSets j).card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) : + let O := allocatedActiveSiteOutputLog m D p E + ∃ e : ScalarSiteExpansion.{uα,uα} (Finset α), + e.Bounds (Real.exp O) (Real.exp O) (Real.exp O) ⟨Real.exp O, Real.exp_nonneg _⟩ (Real.exp (allocatedInactiveSupportLog D)) ∧ + ∀ (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ), + (∀ t ∉ rowSets j, booleanCoefficient y t = 0) → + ‖(((scale : ℝ) ^ (rowSets j).card * + (allocatedSupportedPhysicalGridPMF B U b hR hσ S q r hcell j i (rowSets j) x + (fun t => booleanCoefficient y t)).toReal : ℝ) : ℂ) - e.integerEval scale y‖ ≤ 2 * ε := by + let M : ℕ := torus * scale + have htorus : 0 < torus := blockTorusFactor_pos _ _ _ _ + let : NeZero M := ⟨(Nat.mul_pos htorus (allocatedPrincipalGridScale_pos_of_radius B U b hR j i)).ne'⟩ + let Q := allocatedActiveSiteBudgetLog m D p E + obtain ⟨hQ, hcapQ, hspecQ, _⟩ := allocatedActiveSiteBudgetLog_bounds m hD.nonneg hp hE + obtain ⟨hHQ, hεQ, hLQ⟩ := allocatedActiveSite_construction_bounds B rowSets hD hα hP hp hPp hε hE hεE ⟨j, i⟩ + obtain ⟨e, he, herr⟩ := exists_allocated_scalar_site_expansion (M := M) B U b hR hσ S q r j i + hactive hq hsize (rowSets j) P ε hcell hgrid hgamma L hL hcP hsP rfl hrows hB hε hε1 hε hQ hHQ hεQ hLQ + have hcard := allocatedNaturalGridSpectrum_cover_card (M := M) B U b hR S j i hactive hgrid hgamma hP + (Nat.cast_nonneg torus) (by simp only [M, Nat.cast_mul]; exact le_rfl) (rowSets j) hε hε1 + have hs := allocatedActiveSpectrum_exp_bounds B rowSets hD hα hP hp hPp hε hE hεE ⟨j, i⟩ + have hspecQ' : allocatedActiveSpectrumLog m D p E ≤ Q := by + have hnonneg := hD.nonneg + linarith only [hspecQ, hnonneg] + have hcardQ := hcard.trans (hs.1.trans (Real.exp_le_exp.mpr hspecQ')) + have hperiodQ := hs.2.2.trans (Real.exp_le_exp.mpr hspecQ') + have hcap := allocatedActivePointCap_exp_bound B rowSets hD hα hP hp hPp ⟨j, i⟩ + have hcapQ' : allocatedGridPointCap B P ⟨j, i⟩ (rowSets j) ≤ Real.exp Q := + (le_trans (by linarith : allocatedGridPointCap B P ⟨j, i⟩ (rowSets j) ≤ + allocatedGridPointCap B P ⟨j, i⟩ (rowSets j) + 1) hcap).trans + (Real.exp_le_exp.mpr (by linarith only [hcapQ, hE])) + have hsites : Fintype.card (Finset α) ≤ 2 ^ (m + 1) := by + rw [Fintype.card_finset] + exact Nat.pow_le_pow_right (by norm_num) hα + obtain ⟨hT, hperiod, hC, hLip, _⟩ := siteExponentialOutput_bounds + (2 ^ (m + 1)) (Fintype.card (Finset α)) hsites hQ hcardQ hperiodQ hcapQ' + have hfixed : allocatedNaturalSiteRadius (G := G) B j i (rowSets j) + 1 / 4 ≤ + Real.exp (allocatedInactiveSupportLog D) := + (allocatedNaturalSiteRadius_exp_bound B rowSets hD j i).trans (Real.exp_le_exp.mpr (by + unfold allocatedNaturalSiteLog allocatedInactiveSupportLog + linarith)) + refine ⟨e, he.mono hT hperiod hC ?_ hfixed, ?_⟩ + · exact_mod_cast hLip + · intro x y hy + simpa only [two_mul] using herr x y hy + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +universe uα + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) +variable (q : ℕ) (hq : 0 < q) +variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable {A : Type*} [Fintype A] (selected : A → Σ j : Fin m, Fin (n j)) + +local notation "rows" => fun a : A => rowSets (Sigma.fst (selected a)) +local notation "axisN" => fun a : A => allocatedPrincipalGridScale (G := G) B U b (R := R) + (Sigma.fst (selected a)) (Sigma.snd (selected a)) + +include hq in +theorem exists_allocated_mixed_fixed_support_joint_site_expansion + {D P p v δ E : ℝ} + (hD : AllocatedComparisonDimensions (G := G) B α (fun j => (rowSets j : Type _)) D) + (hα : Fintype.card α ≤ m + 1) (hP : 1 ≤ P) (hp : 0 ≤ p) (hv : 0 ≤ v) + (hPp : P ≤ Real.exp p) (hqv : (q : ℝ) ≤ Real.exp v) + (hδ : 0 < δ) (hE : 0 ≤ E) (hδE : δ⁻¹ ≤ Real.exp E) + (hselected : Function.Injective selected) + (hsize : (Fintype.card α + 1) * q ≤ S.value) + (hgamma : ∀ a, principalProfileSize (R (selected a).1) + (Finset.card (layerIntegerPrincipalSlots (G := G) B (selected a).1 (selected a).2)) ≤ 1) + (hgrid : ∀ a, allocatedGridAxis (I := I) U b S.value ⟨(selected a).1, Sum.inr (selected a).2⟩) + (hσ1 : ∀ a, σ (selected a).1 ≤ 1) + (L : ℝ≥0) (hL : LipschitzWith L Real.smoothTransition) + (hcP : scalarCubePrimitiveEnvelope Empty L 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α L 1 0 q ≤ P) + (hrows : ∀ a t, t ∈ (rows) a → t.card ≤ (selected a).1.val + 1) + (hB : ∀ a, max + (positiveModerateSpectrumBlockCount (selected a).1.val ((rows) a).card + ((layerTailDegree m + 2) * ((rows) a).card)) + (uniformSpectrumBlockCount (selected a).1.val ((rows) a).card + (((selected a).1.val + 1) * ((rows) a).card)) ≤ + Fintype.card (B ⟨(selected a).1, Sum.inr (selected a).2⟩)) : + let O := allocatedMixedJointSiteLog m D p v E + ∃ e : A → ScalarSiteExpansion.{uα,uα} (Finset α), + (∀ a, (e a).Bounds (Real.exp O) (Real.exp O) (Real.exp O) + ⟨Real.exp O, Real.exp_nonneg _⟩ (Real.exp (allocatedInactiveSupportLog D))) ∧ + ∀ (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → A → ℤ), + (∀ a t, t ∉ (rows) a → booleanCoefficient (fun s => y s a) t = 0) → + ‖(((∏ a, ((axisN) a : ℝ) ^ ((rows) a).card) * + (allocatedSupportedPhysicalJointPMF B U b hR hσ S q r hcell selected (rows) x + (fun a t => booleanCoefficient (fun s => y s a) t)).toReal : ℝ) : ℂ) - + siteFamilyEval e y (fun s a => (y s a : ℝ) / (axisN) a)‖ ≤ δ := by + let C := Real.exp (allocatedMixedPointCapLog m D p v) + let τ := uniformProductAccuracy (Fintype.card A) C δ + let O := allocatedMixedJointSiteLog m D p v E + have hC : 0 ≤ C := (Real.exp_pos _).le + obtain ⟨hτ, hτ1, _⟩ := uniformProductAccuracy_spec (Fintype.card A) hC hδ + have hε : 0 < τ / 2 := half_pos hτ + have hε1 : τ / 2 ≤ 1 := by linarith only [hτ1] + have hcount : (Fintype.card A : ℝ) ≤ D := + (Nat.cast_le.mpr (Fintype.card_le_of_injective selected hselected)).trans + (allocatedIntegerAxes_card_le B rowSets hD) + obtain ⟨hcapLog, hcapA, hcapI⟩ := allocatedMixedPointCapLog_bounds m hD.nonneg hp hv + have hτinv := uniformProductAccuracy_inverse_exp_bound (Fintype.card A) hC hδ hD.nonneg hcapLog hE + hcount (le_refl C) hδE + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hεinv : (τ / 2)⁻¹ ≤ Real.exp (allocatedMixedAccuracyLog m D p v E) := by + rw [inv_div, div_eq_mul_inv] + have hb := (mul_le_mul htwo hτinv (inv_nonneg.mpr hτ.le) (Real.exp_pos _).le).trans_eq + (Real.exp_add _ _).symm + exact hb.trans_eq (by unfold allocatedMixedAccuracyLog; congr 1; ring) + have haccuracy := (allocatedMixedJointLogs_nonneg m hD.nonneg hp hv hE).1 + obtain ⟨_, houtA, houtI⟩ := allocatedMixedSiteOutputLog_bounds m hD.nonneg hp hv haccuracy + have hAout : Real.exp (allocatedActiveSiteOutputLog m D p (allocatedMixedAccuracyLog m D p v E)) ≤ + Real.exp O := Real.exp_le_exp.mpr houtA + have hIout : Real.exp (allocatedInactiveSiteOutputLog m D p v (allocatedMixedAccuracyLog m D p v E)) ≤ + Real.exp O := Real.exp_le_exp.mpr houtI + have hS1 : (1 : ℝ) ≤ S.value := by exact_mod_cast S.positive + have hBa (a : A) : positiveModerateSpectrumBlockCount (selected a).1.val ((rows) a).card + ((layerTailDegree m + 2) * ((rows) a).card) ≤ + Fintype.card (B ⟨(selected a).1, Sum.inr (selected a).2⟩) := + (le_max_left _ _).trans (hB a) + have hBi (a : A) : uniformSpectrumBlockCount (selected a).1.val ((rows) a).card + (((selected a).1.val + 1) * ((rows) a).card) ≤ + Fintype.card (B ⟨(selected a).1, Sum.inr (selected a).2⟩) := + (le_max_right _ _).trans (hB a) + have hnonempty (a : A) : Nonempty (B ⟨(selected a).1, Sum.inr (selected a).2⟩) := by + have hi := hBi a + unfold uniformSpectrumBlockCount at hi + exact Fintype.card_pos_iff.mp (by omega) + have heach (a : A) : ∃ e : ScalarSiteExpansion.{uα,uα} (Finset α), + e.Bounds (Real.exp O) (Real.exp O) (Real.exp O) ⟨Real.exp O, Real.exp_nonneg _⟩ (Real.exp (allocatedInactiveSupportLog D)) ∧ + ∀ (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ), + (∀ t ∉ (rows) a, booleanCoefficient y t = 0) → + ‖((((axisN) a : ℝ) ^ ((rows) a).card * + (allocatedSupportedPhysicalGridPMF B U b hR hσ S q r hcell (selected a).1 (selected a).2 + ((rows) a) x (fun t => booleanCoefficient y t)).toReal : ℝ) : ℂ) - + e.integerEval ((axisN) a) y‖ ≤ 2 * (τ / 2) := by + by_cases ha : S.value ^ ((selected a).1.val + 1) < basisAxisScale (b (selected a).1) (selected a).2 + · obtain ⟨e, he, herr⟩ := exists_allocated_active_fixed_support_site_expansion + B U b S hR hσ rowSets (selected a).1 (selected a).2 q hq r hD hα hP hp hPp + hε hε1 haccuracy hεinv ha hsize ((hgamma a).trans hS1) hcell (hgrid a) L hL hcP hsP + (hrows a) (hBa a) + exact ⟨e, he.mono hAout hAout hAout (by exact_mod_cast hAout) le_rfl, herr⟩ + · let : Nonempty (B ⟨(selected a).1, Sum.inr (selected a).2⟩) := hnonempty a + obtain ⟨e, he, herr⟩ := exists_allocated_inactive_fixed_support_site_expansion + B U b S hR hσ rowSets (selected a).1 (selected a).2 q hq r hD hα hP hp hv hPp hqv + hε hε1 haccuracy hεinv hsize (hgamma a) (le_of_not_gt ha) hcell (hgrid a) (hσ1 a) L hL hsP + (hrows a) (hBi a) + exact ⟨e, he.mono hIout hIout hIout (by exact_mod_cast hIout) le_rfl, herr⟩ + choose e hb he using heach + refine ⟨e, hb, ?_⟩ + apply allocatedJointGrid_site_approximation B U b hR hσ S q r hcell selected (rows) + hselected hgrid (axisN) e hC hδ + · intro a x z + by_cases ha : S.value ^ ((selected a).1.val + 1) < basisAxisScale (b (selected a).1) (selected a).2 + · exact (allocatedActiveGrid_norm_exp_bound B U b S hR hσ rowSets + (selected a).1 (selected a).2 q hq r hD hα hP hp hPp ha hsize ((hgamma a).trans hS1) + hcell (hgrid a) L hL hcP hsP (hrows a) (hBa a) x z).trans (Real.exp_le_exp.mpr hcapA) + · let : Nonempty (B ⟨(selected a).1, Sum.inr (selected a).2⟩) := hnonempty a + exact (allocatedInactiveGrid_norm_exp_bound B U b S hR hσ rowSets + (selected a).1 (selected a).2 q hq r hD hα hP hp hv hPp hqv hsize (hgamma a) (le_of_not_gt ha) + hcell (hgrid a) L hL hsP (hrows a) (hBi a) x z).trans (Real.exp_le_exp.mpr hcapI) + · intro a x y hy + have herr := he a x y hy + have hcancel : (2 : ℝ) * (τ / 2) = τ := by ring + simpa only [hcancel] using herr + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNarrowSpatialCanonicalComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNarrowSpatialCanonicalComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1b75d307fad58d031cb37b2f72fc4b33cdefe6f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNarrowSpatialCanonicalComparison.lean @@ -0,0 +1,635 @@ +import OAI.Combinatorics.Progressions.Estimates.SelectedSingletonSmoothTestQuadrature +import OAI.Combinatorics.Progressions.Probability.CanonicalZeroSpatialInputLaw + +namespace OAI + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped BigOperators Classical + +variable {X Zsp : Type*} [Fintype X] [Fintype Zsp] [DecidableEq Zsp] +variable (s : Empty ↪ Zsp) (root : Zsp → ℤ) (D : Matrix Empty Zsp ℤ) (W L : ℝ) + +omit [Fintype X] in +theorem canonicalZeroSpatialInputMap_apply (hW : 0 ≤ W) + (u : Option Zsp × X → ℝ) (x : X) : + canonicalZeroSpatialInputMap s root D W L u ⟨x, Sum.inl ()⟩ = + u (none, x) + (∑ j, (root j : ℝ) * u (some j, x)) / (1 + W) := by + have hsum := selectedColumn_sum s (fun j => (root j : ℝ) * u (some j, x)) + simp only [Fintype.sum_empty, zero_add] at hsum + unfold canonicalZeroSpatialInputMap canonicalSpatialKernelMap + simp only [Pi.add_apply, Matrix.mulVec, dotProduct, normalizedIntegerPivot_entry, + normalizedIntegerColumns_entry_div, Fintype.sum_sum_type, Fintype.sum_empty, + add_zero, Fintype.sum_unique, selectedSpatialPivot, rootDifferenceMatrix, Matrix.fromBlocks_apply₁₁, Matrix.one_apply_eq, + selectedSpatialFreeColumns, Matrix.of_apply, anisotropicSpatialScale, + physicalSpatialOutputScale, Sum.elim_inl, Int.cast_one, one_mul, + div_self (by linarith : (1 + W : ℝ) ≠ 0)] + congr 1 + rw [← hsum, Finset.sum_div] + apply Finset.sum_congr rfl + intro j _ + ring + +theorem canonicalZeroSpatialInputMap_lipschitz (hW : 0 ≤ W) + (hroot : (∑ j, |(root j : ℝ)|) ≤ W) : + LipschitzWith 2 (canonicalZeroSpatialInputMap (X := X) s root D W L) := by + apply LipschitzWith.of_dist_le_mul + intro u v + apply (dist_pi_le_iff (by positivity)).mpr + rintro ⟨x, a⟩ + cases a with + | inr e => exact Empty.elim e + | inl a => + cases a + rw [Real.dist_eq, canonicalZeroSpatialInputMap_apply s root D W L hW, + canonicalZeroSpatialInputMap_apply s root D W L hW] + have hsum : |∑ j, (root j : ℝ) * (u (some j, x) - v (some j, x))| ≤ + W * dist u v := by + calc + _ ≤ ∑ j, |(root j : ℝ) * (u (some j, x) - v (some j, x))| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ j, |(root j : ℝ)| * dist u v := by + apply Finset.sum_le_sum + intro j _ + rw [abs_mul] + exact mul_le_mul_of_nonneg_left + (show |u (some j, x) - v (some j, x)| ≤ dist u v from + (Real.dist_eq _ _).symm ▸ dist_le_pi_dist u v (some j, x)) + (abs_nonneg _) + _ = (∑ j, |(root j : ℝ)|) * dist u v := (Finset.sum_mul _ _ _).symm + _ ≤ W * dist u v := mul_le_mul_of_nonneg_right hroot dist_nonneg + have hden : 0 < 1 + W := by linarith + have hdiv : |(∑ j, (root j : ℝ) * (u (some j, x) - v (some j, x))) / + (1 + W)| ≤ dist u v := by + rw [abs_div, abs_of_pos hden] + apply (div_le_iff₀ hden).mpr + exact hsum.trans (by nlinarith [dist_nonneg (x := u) (y := v)]) + have heq : u (none, x) + (∑ j, (root j : ℝ) * u (some j, x)) / (1 + W) - + (v (none, x) + (∑ j, (root j : ℝ) * v (some j, x)) / (1 + W)) = + (u (none, x) - v (none, x)) + + (∑ j, (root j : ℝ) * (u (some j, x) - v (some j, x))) / (1 + W) := by + simp_rw [mul_sub] + rw [Finset.sum_sub_distrib] + ring + rw [heq] + have hcoord : |u (none, x) - v (none, x)| ≤ dist u v := + (Real.dist_eq _ _).symm ▸ dist_le_pi_dist u v (none, x) + exact (abs_add_le _ _).trans (by norm_num; linarith) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory + +variable {X G T : Type*} [Fintype X] [Fintype G] [DecidableEq G] [Fintype T] +variable (s : Empty ↪ G) (root : G → ℤ) (D : Matrix Empty G ℤ) (W L : ℝ) +variable (e : (Option G × X) ↪ T) + +theorem canonicalZeroSpatialInputProjection_law : + (unitCoefficientSource T).map + (fun u => canonicalZeroSpatialInputMap s root D W L (u ∘ e)) = + canonicalZeroSpatialLaw (X := X) s root D W L := by + change (unitCoefficientSource T).map + (canonicalZeroSpatialInputMap s root D W L ∘ (fun u => u ∘ e)) = _ + rw [← Measure.map_map (canonicalZeroSpatialInputMap_measurable s root D W L) + (unitCoefficientProjection_measurable e), unitCoefficientSource_marginal] + exact canonicalZeroSpatialInputMap_law s root D W L + +theorem canonicalZeroSpatialInputProjection_integral_complex + (φ : ((Σ _ : X, Unit ⊕ Empty) → ℝ) → ℂ) (hφ : Measurable φ) : + (∫ u, φ (canonicalZeroSpatialInputMap s root D W L (u ∘ e)) ∂unitCoefficientSource T) = + ∫ y, φ y ∂canonicalZeroSpatialLaw s root D W L := by + rw [← canonicalZeroSpatialInputProjection_law s root D W L e] + symm + exact integral_map_of_stronglyMeasurable + ((canonicalZeroSpatialInputMap_measurable s root D W L).comp + (unitCoefficientProjection_measurable e)) hφ.stronglyMeasurable + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped BigOperators Classical NNReal + +def canonicalZeroSpatialKernelEmbedding (G N X : Type*) : + Option G × X ↪ Option (G ⊕ N) × X where + toFun := fun p => (Option.map Sum.inl p.1, p.2) + inj' := by + rintro ⟨a, x⟩ ⟨b, y⟩ h + cases a <;> cases b <;> simp_all + +@[simp] theorem canonicalZeroSpatialKernelEmbedding_apply (G N X : Type*) + (p : Option G × X) : + canonicalZeroSpatialKernelEmbedding G N X p = (Option.map Sum.inl p.1, p.2) := rfl + +def canonicalZeroSpatialNarrowInput {G N X : Type*} (ξ : ℝ) + (u : Option (G ⊕ N) × X → ℝ) : Option (G ⊕ N) × X → ℝ := + fun a => match a.1 with + | some (.inr _) => ξ * u a + | _ => u a + +@[simp] theorem canonicalZeroSpatialNarrowInput_none {G N X : Type*} (ξ : ℝ) + (u : Option (G ⊕ N) × X → ℝ) (x : X) : + canonicalZeroSpatialNarrowInput ξ u (none, x) = u (none, x) := rfl + +@[simp] theorem canonicalZeroSpatialNarrowInput_inl {G N X : Type*} (ξ : ℝ) + (u : Option (G ⊕ N) × X → ℝ) (g : G) (x : X) : + canonicalZeroSpatialNarrowInput ξ u (some (.inl g), x) = u (some (.inl g), x) := rfl + +@[simp] theorem canonicalZeroSpatialNarrowInput_inr {G N X : Type*} (ξ : ℝ) + (u : Option (G ⊕ N) × X → ℝ) (n : N) (x : X) : + canonicalZeroSpatialNarrowInput ξ u (some (.inr n), x) = ξ * u (some (.inr n), x) := rfl + +theorem canonicalZeroSpatialNarrowInput_measurable {G N X : Type*} (ξ : ℝ) : + Measurable (canonicalZeroSpatialNarrowInput (G := G) (N := N) (X := X) ξ) := by + apply Measurable.of_eval + rintro ⟨a, x⟩ + rcases a with _ | (g | n) + · exact measurable_pi_apply (none, x) + · exact measurable_pi_apply (some (Sum.inl g : G ⊕ N), x) + · exact measurable_const.mul (measurable_pi_apply (some (Sum.inr n : G ⊕ N), x)) + +theorem canonicalZeroSpatialNarrowInput_kernel {G N X : Type*} (ξ : ℝ) + (u : Option (G ⊕ N) × X → ℝ) : + canonicalZeroSpatialNarrowInput ξ u ∘ canonicalZeroSpatialKernelEmbedding G N X = + u ∘ canonicalZeroSpatialKernelEmbedding G N X := by + funext a + rcases a with ⟨a, x⟩ + cases a <;> rfl + +variable {G N X : Type*} [Fintype G] [DecidableEq G] + [Fintype N] [DecidableEq N] [Fintype X] +variable (s : Empty ↪ G) (sf : Empty ↪ (G ⊕ N)) + (root : G → ℤ) (principal : N → ℤ) + (D : Matrix Empty G ℤ) (Df : Matrix Empty (G ⊕ N) ℤ) (W L : ℝ) + +omit [Fintype X] in +theorem canonicalZeroSpatialPrincipal_difference (hW : 0 ≤ W) + (u : Option (G ⊕ N) × X → ℝ) (x : X) : + canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L u ⟨x, .inl ()⟩ - + canonicalZeroSpatialInputMap s root D W L + (u ∘ canonicalZeroSpatialKernelEmbedding G N X) ⟨x, .inl ()⟩ = + (∑ n, (principal n : ℝ) * u (some (.inr n), x)) / (1 + W) := by + rw [canonicalZeroSpatialInputMap_apply sf _ Df W L hW, + canonicalZeroSpatialInputMap_apply s root D W L hW] + simp only [Fintype.sum_sum_type, Sum.elim_inl, Sum.elim_inr, + Function.comp_apply, canonicalZeroSpatialKernelEmbedding_apply, + Option.map_none, Option.map_some] + ring + +theorem canonicalZeroSpatialPrincipal_norm_le (hW : 0 ≤ W) + (u : Option (G ⊕ N) × X → ℝ) (hu : ‖u‖ ≤ 1) : + ‖canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L u - + canonicalZeroSpatialInputMap s root D W L + (u ∘ canonicalZeroSpatialKernelEmbedding G N X)‖ ≤ + (∑ n, |(principal n : ℝ)|) / (1 + W) := by + have hden : 0 < 1 + W := by linarith + have hbound : 0 ≤ (∑ n, |(principal n : ℝ)|) / (1 + W) := + div_nonneg (Finset.sum_nonneg fun _ _ => abs_nonneg _) hden.le + apply (pi_norm_le_iff_of_nonneg hbound).mpr + rintro ⟨x, a⟩ + cases a with + | inr e => exact Empty.elim e + | inl a => + cases a + rw [Pi.sub_apply, canonicalZeroSpatialPrincipal_difference s sf root principal D Df W L hW, + Real.norm_eq_abs, abs_div, abs_of_pos hden] + apply div_le_div_of_nonneg_right _ hden.le + calc + _ ≤ ∑ n, |(principal n : ℝ) * u (some (.inr n), x)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ n, |(principal n : ℝ)| := by + apply Finset.sum_le_sum + intro n _ + rw [abs_mul] + have hn : |u (some (.inr n), x)| ≤ 1 := + (Real.norm_eq_abs _).symm ▸ (norm_le_pi_norm u (some (.inr n), x)).trans hu + exact mul_le_of_le_one_right (abs_nonneg _) hn + +theorem canonicalZeroSpatialPrincipal_test_error (hW : 0 ≤ W) + (u : Option (G ⊕ N) × X → ℝ) (hu : ‖u‖ ≤ 1) + {A : ℝ≥0} (φ : ((Σ _ : X, Unit ⊕ Empty) → ℝ) → ℂ) + (hφ : LipschitzWith A φ) : + ‖φ (canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L u) - + φ (canonicalZeroSpatialInputMap s root D W L + (u ∘ canonicalZeroSpatialKernelEmbedding G N X))‖ ≤ + (A : ℝ) * ((∑ n, |(principal n : ℝ)|) / (1 + W)) := by + rw [← dist_eq_norm] + apply (hφ.dist_le_mul _ _).trans + rw [dist_eq_norm] + exact mul_le_mul_of_nonneg_left + (canonicalZeroSpatialPrincipal_norm_le s sf root principal D Df W L hW u hu) A.coe_nonneg + +omit [DecidableEq G] [DecidableEq N] in +theorem canonicalZeroSpatialNarrowInput_lipschitz (ξ : ℝ) (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) : + LipschitzWith 1 (canonicalZeroSpatialNarrowInput (G := G) (N := N) (X := X) ξ) := by + apply LipschitzWith.of_dist_le_mul + intro u v + simp only [NNReal.coe_one, one_mul] + apply (dist_pi_le_iff dist_nonneg).mpr + rintro ⟨a, x⟩ + rcases a with _ | (g | n) + · exact dist_le_pi_dist u v (none, x) + · exact dist_le_pi_dist u v (some (.inl g), x) + · simp only [canonicalZeroSpatialNarrowInput_inr, Real.dist_eq, ← mul_sub, + abs_mul, abs_of_nonneg hξ0] + exact (mul_le_mul_of_nonneg_left (show |u (some (.inr n), x) - + v (some (.inr n), x)| ≤ dist u v from + (Real.dist_eq _ _).symm ▸ dist_le_pi_dist u v (some (.inr n), x)) hξ0).trans + (mul_le_of_le_one_left dist_nonneg hξ1) + +omit [Fintype X] in +theorem canonicalZeroSpatialNarrowPrincipal_difference (hW : 0 ≤ W) (ξ : ℝ) + (u : Option (G ⊕ N) × X → ℝ) : + canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L + (canonicalZeroSpatialNarrowInput ξ u) - + canonicalZeroSpatialInputMap s root D W L + (u ∘ canonicalZeroSpatialKernelEmbedding G N X) = + ξ • (canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L u - + canonicalZeroSpatialInputMap s root D W L + (u ∘ canonicalZeroSpatialKernelEmbedding G N X)) := by + ext ⟨x, a⟩ + cases a with + | inr e => exact Empty.elim e + | inl a => + cases a + have h := canonicalZeroSpatialPrincipal_difference s sf root principal D Df W L hW + (canonicalZeroSpatialNarrowInput ξ u) x + rw [canonicalZeroSpatialNarrowInput_kernel] at h + simp only [Pi.sub_apply, Pi.smul_apply, smul_eq_mul] + rw [h, canonicalZeroSpatialPrincipal_difference s sf root principal D Df W L hW] + simp only [canonicalZeroSpatialNarrowInput_inr] + rw [← mul_div_assoc, Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro n _ + ring + +theorem canonicalZeroSpatialNarrowPrincipal_norm_le (hW : 0 ≤ W) (ξ : ℝ) (hξ0 : 0 ≤ ξ) + (u : Option (G ⊕ N) × X → ℝ) (hu : ‖u‖ ≤ 1) : + ‖canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L + (canonicalZeroSpatialNarrowInput ξ u) - + canonicalZeroSpatialInputMap s root D W L + (u ∘ canonicalZeroSpatialKernelEmbedding G N X)‖ ≤ + ξ * ((∑ n, |(principal n : ℝ)|) / (1 + W)) := by + rw [canonicalZeroSpatialNarrowPrincipal_difference s sf root principal D Df W L hW ξ, + norm_smul, Real.norm_eq_abs, abs_of_nonneg hξ0] + exact mul_le_mul_of_nonneg_left + (canonicalZeroSpatialPrincipal_norm_le s sf root principal D Df W L hW u hu) hξ0 + +theorem canonicalZeroSpatialNarrowPrincipal_test_error (hW : 0 ≤ W) (ξ : ℝ) (hξ0 : 0 ≤ ξ) + (u : Option (G ⊕ N) × X → ℝ) (hu : ‖u‖ ≤ 1) + {A : ℝ≥0} (φ : ((Σ _ : X, Unit ⊕ Empty) → ℝ) → ℂ) + (hφ : LipschitzWith A φ) : + ‖φ (canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L + (canonicalZeroSpatialNarrowInput ξ u)) - + φ (canonicalZeroSpatialInputMap s root D W L + (u ∘ canonicalZeroSpatialKernelEmbedding G N X))‖ ≤ + (A : ℝ) * (ξ * ((∑ n, |(principal n : ℝ)|) / (1 + W))) := by + rw [← dist_eq_norm] + apply (hφ.dist_le_mul _ _).trans + rw [dist_eq_norm] + exact mul_le_mul_of_nonneg_left + (canonicalZeroSpatialNarrowPrincipal_norm_le s sf root principal D Df W L hW ξ hξ0 u hu) + A.coe_nonneg + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory BooleanCubeKernel +open scoped BigOperators NNReal Classical + +variable {X G : Type*} [Fintype X] [Fintype G] [DecidableEq G] + +theorem selectedCanonicalZeroSpatial_complex_quadrature + (s : Empty ↪ G) (root : G → ℤ) (D : Matrix Empty G ℤ) (W L : ℝ) + (hW : 0 ≤ W) (hroot : (∑ j, |(root j : ℝ)|) ≤ W) + (modulus : X → ℕ) (hmodulus : ∀ x, 0 < modulus x) + (r : ColumnResiduePattern (Option G) X modulus) + (V : Option G × X → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus {r} V z) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (hmesh : ∀ z, (modulus z.2 : ℝ) / V z ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card (Option G × X) * + ((Fintype.card (Option G × X) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : ((Σ _ : X, Unit ⊕ Empty) → ℝ) → ℂ) + {A : ℝ≥0} (hLip : LipschitzWith A φ) (hφ : ∀ y, ‖φ y‖ ≤ 1) : + ‖(∑' z, ((selectedResidueSmoothPMF modulus {r} V hV hZ z).toReal : ℂ) * + φ (canonicalZeroSpatialInputMap s root D W L (fun k => (z k : ℝ) / V k))) - + ∫ y, φ y ∂canonicalZeroSpatialLaw s root D W L‖ ≤ + 4 * (4 : ℝ) ^ Fintype.card (Option G × X) * + (2 * (A : ℝ) + 2 * ((Fintype.card (Option G × X) : ℝ) * probabilityProfileLipschitz)) * δ := by + rw [canonicalZeroSpatialInputMap_integral_complex s root D W L φ hLip.continuous.measurable] + have he := selectedResidueSmoothPMF_singleton_complex_quadrature modulus hmodulus r V hV hZ + hδ hδ1 hmesh hsmall (φ ∘ canonicalZeroSpatialInputMap s root D W L) + (hLip.comp (canonicalZeroSpatialInputMap_lipschitz s root D W L hW hroot)) + (fun u => hφ _) + simpa only [Function.comp_apply, NNReal.coe_mul, NNReal.coe_ofNat, mul_comm (A : ℝ) 2] using he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped BigOperators + +theorem canonicalZeroSpatialInputMap_physicalSite + {X Zsp : Type*} [Fintype Zsp] [DecidableEq Zsp] + (s : Empty ↪ Zsp) (root : Zsp → ℤ) (D : Matrix Empty Zsp ℤ) + {W : ℝ} (hW : 0 ≤ W) (L τ : ℝ) (N : X → ℕ) + (z : Option Zsp × X → ℤ) (x : X) : + canonicalZeroSpatialInputMap s root D W L + (fun k => (z k : ℝ) / trimmedSpatialWidths W τ N k) ⟨x, Sum.inl ()⟩ = + (integerPhysicalSite root z x : ℝ) / (τ * (N x : ℝ) / 8) := by + have hb : (1 + W : ℝ) ≠ 0 := by linarith + have hn : trimmedSpatialWidths (K := Zsp) W τ N (none, x) = τ * (N x : ℝ) / 8 := by + simp only [trimmedSpatialWidths, centeredSpatialWidths] + ring + have hs (j : Zsp) : trimmedSpatialWidths W τ N (some j, x) = + (τ * (N x : ℝ) / 8) / (1 + W) := by + simp only [trimmedSpatialWidths, centeredSpatialWidths, one_mul, div_div] + ring + rw [canonicalZeroSpatialInputMap_apply s root D W L hW] + simp only [integerPhysicalSite, Int.cast_add, Int.cast_sum, Int.cast_mul, hn, hs, + add_div, Finset.sum_div] + congr 1 + apply Finset.sum_congr rfl + intro j _ + rw [div_div_eq_mul_div] + by_cases ht : τ * (N x : ℝ) / 8 = 0 + · simp only [ht, div_zero, mul_zero, zero_div] + · field_simp + +theorem canonicalZeroSpatialNarrowInput_normalized + {G J X : Type*} {ξ : ℝ} (hξ : ξ ≠ 0) (W τ : ℝ) (N : X → ℕ) + (z : Option (G ⊕ J) × X → ℤ) : + canonicalZeroSpatialNarrowInput ξ + (fun k => (z k : ℝ) / narrowTrimmedSpatialWidths W τ ξ N k) = + fun k => (z k : ℝ) / trimmedSpatialWidths W τ N k := by + funext k + rcases k with ⟨_ | (g | j), x⟩ + · rfl + · rfl + · simp only [canonicalZeroSpatialNarrowInput, narrowTrimmedSpatialWidths] + by_cases hw : trimmedSpatialWidths (K := G ⊕ J) W τ N (some (Sum.inr j), x) = 0 + · simp only [hw, mul_zero, div_zero] + · field_simp + +theorem canonicalZeroSpatialNarrowInputMap_physicalSite + {G J X : Type*} [Fintype G] [Fintype J] [DecidableEq G] [DecidableEq J] + (s : Empty ↪ (G ⊕ J)) (root : G ⊕ J → ℤ) (D : Matrix Empty (G ⊕ J) ℤ) + {W ξ : ℝ} (hW : 0 ≤ W) (hξ : ξ ≠ 0) (L τ : ℝ) (N : X → ℕ) + (z : Option (G ⊕ J) × X → ℤ) (x : X) : + canonicalZeroSpatialInputMap s root D W L + (canonicalZeroSpatialNarrowInput ξ + (fun k => (z k : ℝ) / narrowTrimmedSpatialWidths W τ ξ N k)) ⟨x, Sum.inl ()⟩ = + (integerPhysicalSite root z x : ℝ) / (τ * (N x : ℝ) / 8) := by + rw [canonicalZeroSpatialNarrowInput_normalized hξ W τ N z] + exact canonicalZeroSpatialInputMap_physicalSite s root D hW L τ N z x + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory BooleanCubeKernel +open scoped BigOperators NNReal Classical + +variable {G N X : Type*} [Fintype G] [DecidableEq G] + [Fintype N] [DecidableEq N] [Fintype X] +variable (s : Empty ↪ G) (sf : Empty ↪ (G ⊕ N)) + (root : G → ℤ) (principal : N → ℤ) + (D : Matrix Empty G ℤ) (Df : Matrix Empty (G ⊕ N) ℤ) (W L : ℝ) + +omit [DecidableEq G] [DecidableEq N] in +theorem canonicalZeroSpatialPrincipal_mass_ratio_le_one (hW : 0 ≤ W) + (hbudget : (∑ k : G ⊕ N, |((Sum.elim root principal k : ℤ) : ℝ)|) ≤ W) : + (∑ n, |(principal n : ℝ)|) / (1 + W) ≤ 1 := by + have hroot0 : 0 ≤ ∑ g, |(root g : ℝ)| := Finset.sum_nonneg (fun _ _ => abs_nonneg _) + simp only [Fintype.sum_sum_type, Sum.elim_inl, Sum.elim_inr] at hbudget + apply (div_le_iff₀ (by linarith : (0 : ℝ) < 1 + W)).mpr + linarith + +theorem canonicalZeroSpatialNarrow_integral_error + (hW : 0 ≤ W) (ξ : ℝ) (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + {A : ℝ≥0} (φ : ((Σ _ : X, Unit ⊕ Empty) → ℝ) → ℂ) + (hLip : LipschitzWith A φ) (hφ : ∀ y, ‖φ y‖ ≤ 1) : + ‖(∫ u, (smoothProductProfile (Option (G ⊕ N) × X) u : ℂ) * + φ (canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L + (canonicalZeroSpatialNarrowInput ξ u))) - + ∫ y, φ y ∂canonicalZeroSpatialLaw s root D W L‖ ≤ + (A : ℝ) * (ξ * ((∑ n, |(principal n : ℝ)|) / (1 + W))) := by + let μ := unitCoefficientSource (Option (G ⊕ N) × X) + let f := fun u : Option (G ⊕ N) × X → ℝ => + φ (canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L + (canonicalZeroSpatialNarrowInput ξ u)) + let g := fun u : Option (G ⊕ N) × X → ℝ => + φ (canonicalZeroSpatialInputMap s root D W L + (u ∘ canonicalZeroSpatialKernelEmbedding G N X)) + have hfmeas : Measurable f := hLip.continuous.measurable.comp + ((canonicalZeroSpatialInputMap_measurable sf (Sum.elim root principal) Df W L).comp + (canonicalZeroSpatialNarrowInput_lipschitz ξ hξ0 hξ1).continuous.measurable) + have hgmeas : Measurable g := hLip.continuous.measurable.comp + ((canonicalZeroSpatialInputMap_measurable s root D W L).comp + (unitCoefficientProjection_measurable (canonicalZeroSpatialKernelEmbedding G N X))) + have hf : Integrable f μ := ⟨hfmeas.aestronglyMeasurable, + HasFiniteIntegral.of_bounded (Filter.Eventually.of_forall (fun u => hφ _))⟩ + have hg : Integrable g μ := ⟨hgmeas.aestronglyMeasurable, + HasFiniteIntegral.of_bounded (Filter.Eventually.of_forall (fun u => hφ _))⟩ + have hfint : (∫ u, f u ∂μ) = ∫ u, + (smoothProductProfile (Option (G ⊕ N) × X) u : ℂ) * f u := + realDensityMeasure_integral_complex volume _ + (smoothProductProfile_contDiff _).continuous.measurable + (fun u => (smoothProductProfile_range _ u).1) f + have hgint : (∫ u, g u ∂μ) = ∫ y, φ y ∂canonicalZeroSpatialLaw s root D W L := + canonicalZeroSpatialInputProjection_integral_complex s root D W L + (canonicalZeroSpatialKernelEmbedding G N X) φ hLip.continuous.measurable + change ‖(∫ u, (smoothProductProfile (Option (G ⊕ N) × X) u : ℂ) * f u) - _‖ ≤ _ + rw [← hfint, ← hgint, ← integral_sub hf hg] + have he : ∀ᵐ u ∂μ, ‖f u - g u‖ ≤ + (A : ℝ) * (ξ * ((∑ n, |(principal n : ℝ)|) / (1 + W))) := by + filter_upwards [unitCoefficientSource_norm_le (Option (G ⊕ N) × X)] with u hu + exact canonicalZeroSpatialNarrowPrincipal_test_error s sf root principal D Df W L + hW ξ hξ0 u hu φ hLip + simpa only [probReal_univ, mul_one] using norm_integral_le_of_norm_le_const he + +theorem selectedCanonicalZeroSpatial_narrow_principal_comparison + (hW : 0 ≤ W) + (hbudget : (∑ k : G ⊕ N, |((Sum.elim root principal k : ℤ) : ℝ)|) ≤ W) + (ξ : ℝ) (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + (modulus : X → ℕ) (hmodulus : ∀ x, 0 < modulus x) + (r : ColumnResiduePattern (Option (G ⊕ N)) X modulus) + (V : Option (G ⊕ N) × X → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus {r} V z) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (hmesh : ∀ z, (modulus z.2 : ℝ) / V z ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card (Option (G ⊕ N) × X) * + ((Fintype.card (Option (G ⊕ N) × X) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : ((Σ _ : X, Unit ⊕ Empty) → ℝ) → ℂ) + {A : ℝ≥0} (hLip : LipschitzWith A φ) (hφ : ∀ y, ‖φ y‖ ≤ 1) : + ‖(∑' z, ((selectedResidueSmoothPMF modulus {r} V hV hZ z).toReal : ℂ) * + φ (canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L + (canonicalZeroSpatialNarrowInput ξ (fun k => (z k : ℝ) / V k)))) - + ∫ y, φ y ∂canonicalZeroSpatialLaw s root D W L‖ ≤ + 4 * (4 : ℝ) ^ Fintype.card (Option (G ⊕ N) × X) * + (2 * (A : ℝ) + 2 * ((Fintype.card (Option (G ⊕ N) × X) : ℝ) * probabilityProfileLipschitz)) * δ + + (A : ℝ) * ξ := by + let F := fun u : Option (G ⊕ N) × X → ℝ => + canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L + (canonicalZeroSpatialNarrowInput ξ u) + have hF : LipschitzWith 2 F := by + simpa only [F, Function.comp_def, mul_one] using + (canonicalZeroSpatialInputMap_lipschitz sf (Sum.elim root principal) Df W L hW hbudget).comp + (canonicalZeroSpatialNarrowInput_lipschitz ξ hξ0 hξ1) + have hquad := selectedResidueSmoothPMF_singleton_complex_quadrature modulus hmodulus r V hV hZ + hδ hδ1 hmesh hsmall (φ ∘ F) (hLip.comp hF) (fun u => hφ _) + simp only [Function.comp_apply, NNReal.coe_mul, NNReal.coe_ofNat, mul_comm (A : ℝ) 2] at hquad + have hpert := canonicalZeroSpatialNarrow_integral_error s sf root principal D Df W L + hW ξ hξ0 hξ1 φ hLip hφ + have hratio := canonicalZeroSpatialPrincipal_mass_ratio_le_one root principal W hW hbudget + have he : (A : ℝ) * (ξ * ((∑ n, |(principal n : ℝ)|) / (1 + W))) ≤ (A : ℝ) * ξ := by + calc + _ ≤ (A : ℝ) * (ξ * 1) := mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_left hratio hξ0) A.coe_nonneg + _ = _ := by rw [mul_one] + exact (norm_sub_le_norm_sub_add_norm_sub _ _ _).trans (add_le_add hquad (hpert.trans he)) + +theorem selectedNarrowPhysicalSpatial_canonical_comparison + (hW : 0 ≤ W) + (hbudget : (∑ k : G ⊕ N, |((Sum.elim root principal k : ℤ) : ℝ)|) ≤ W) + (τ ξ : ℝ) (hτ : 0 < τ) (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) + (box : X → ℕ) (hbox : ∀ x, 0 < box x) + (modulus : X → ℕ) (hmodulus : ∀ x, 0 < modulus x) + (r : ColumnResiduePattern (Option (G ⊕ N)) X modulus) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus {r} (narrowTrimmedSpatialWidths W τ ξ box) z) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (hmesh : ∀ z : Option (G ⊕ N) × X, + (modulus z.2 : ℝ) / narrowTrimmedSpatialWidths W τ ξ box z ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card (Option (G ⊕ N) × X) * + ((Fintype.card (Option (G ⊕ N) × X) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : ((Σ _ : X, Unit ⊕ Empty) → ℝ) → ℂ) + {A : ℝ≥0} (hLip : LipschitzWith A φ) (hφ : ∀ y, ‖φ y‖ ≤ 1) : + ‖(∑' z, ((selectedResidueSmoothPMF modulus {r} (narrowTrimmedSpatialWidths W τ ξ box) + (narrowTrimmedSpatialWidths_pos hW hτ hξ box hbox) hZ z).toReal : ℂ) * + φ (fun o : Σ _ : X, Unit ⊕ Empty => + (integerPhysicalSite (Sum.elim root principal) z o.1 : ℝ) / (τ * (box o.1 : ℝ) / 8))) - + ∫ y, φ y ∂canonicalZeroSpatialLaw s root D W L‖ ≤ + 4 * (4 : ℝ) ^ Fintype.card (Option (G ⊕ N) × X) * + (2 * (A : ℝ) + 2 * ((Fintype.card (Option (G ⊕ N) × X) : ℝ) * probabilityProfileLipschitz)) * δ + + (A : ℝ) * ξ := by + let sf : Empty ↪ (G ⊕ N) := ⟨Empty.elim, fun e => Empty.elim e⟩ + let Df : Matrix Empty (G ⊕ N) ℤ := fun e => Empty.elim e + have he (z : Option (G ⊕ N) × X → ℤ) : + canonicalZeroSpatialInputMap sf (Sum.elim root principal) Df W L + (canonicalZeroSpatialNarrowInput ξ + (fun k => (z k : ℝ) / narrowTrimmedSpatialWidths W τ ξ box k)) = + fun o : Σ _ : X, Unit ⊕ Empty => + (integerPhysicalSite (Sum.elim root principal) z o.1 : ℝ) / (τ * (box o.1 : ℝ) / 8) := by + funext o + rcases o with ⟨x, a⟩ + cases a with + | inr e => exact Empty.elim e + | inl a => + cases a + exact canonicalZeroSpatialNarrowInputMap_physicalSite sf (Sum.elim root principal) Df + hW hξ.ne' L τ box z x + have h := selectedCanonicalZeroSpatial_narrow_principal_comparison s sf root principal D Df W L + hW hbudget ξ hξ.le hξ1 modulus hmodulus r (narrowTrimmedSpatialWidths W τ ξ box) + (narrowTrimmedSpatialWidths_pos hW hτ hξ box hbox) hZ hδ hδ1 hmesh hsmall φ hLip hφ + simpa only [he] using h + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory BooleanCubeKernel +open scoped BigOperators NNReal Classical + +variable {m : ℕ} {G X : Type*} [Fintype G] [DecidableEq G] [Fintype X] +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 "principal" => PrincipalTupleIndex B (layerSamplerDegree I n) +local notation "vars" => LayerSamplerVariables G I n B +local notation "budget" => allocatedPhysicalRootBudget B U basis S (fun _ => 0) + +variable (s : Empty ↪ G) (x : G → IntegerScalarCubeBox Empty S.value) +variable (y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U basis S)) +variable (τ ξ : ℝ) (box : X → ℕ) + +local notation "widths" => narrowTrimmedSpatialWidths (G := G) (J := principal) budget τ ξ box +local notation "root" => allocatedPhysicalCubeRoot B U basis S (fun _ => 0) x y + +theorem allocatedNarrowPhysicalSpatial_canonical_comparison + (hτ : 0 < τ) (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) (hbox : ∀ t, 0 < box t) + (modulus : X → ℕ) (hmodulus : ∀ t, 0 < modulus t) + (r : ColumnResiduePattern (Option vars) X modulus) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus {r} widths z) + {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (hmesh : ∀ z : Option vars × X, (modulus z.2 : ℝ) / widths z ≤ δ) + (hsmall : (4 : ℝ) ^ Fintype.card (Option vars × X) * + ((Fintype.card (Option vars × X) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) + (φ : ((Σ _ : X, Unit ⊕ Empty) → ℝ) → ℂ) + {A : ℝ≥0} (hLip : LipschitzWith A φ) (hφ : ∀ z, ‖φ z‖ ≤ 1) : + ‖(∑' z, ((selectedResidueSmoothPMF modulus {r} widths + (narrowTrimmedSpatialWidths_pos (allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0)) + hτ hξ box hbox) hZ z).toReal : ℂ) * + φ (fun o : Σ _ : X, Unit ⊕ Empty => + (integerPhysicalSite root z o.1 : ℝ) / (τ * (box o.1 : ℝ) / 8))) - + ∫ z, φ z ∂canonicalZeroSpatialLaw s (fun g => (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) budget (S.value : ℝ)‖ ≤ + 4 * (4 : ℝ) ^ Fintype.card (Option vars × X) * + (2 * (A : ℝ) + 2 * ((Fintype.card (Option vars × X) : ℝ) * probabilityProfileLipschitz)) * δ + + (A : ℝ) * ξ := by + classical + have hr : root = Sum.elim (fun g => (x g none : ℤ)) (fun j => (y j none : ℤ)) := by + funext k + simp only [allocatedPhysicalCubeRoot, zero_add] + have hbudget : (∑ k : vars, + |((Sum.elim (fun g => (x g none : ℤ)) (fun j => (y j none : ℤ)) k : ℤ) : ℝ)|) ≤ budget := by + simpa only [hr] using allocatedPhysicalCube_root_sum B U basis S (fun _ => 0) x y + have he := selectedNarrowPhysicalSpatial_canonical_comparison s + (fun g => (x g none : ℤ)) (fun j => (y j none : ℤ)) + (scalarCubeDifferenceMatrix x) budget (S.value : ℝ) + (allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0)) hbudget + τ ξ hτ hξ hξ1 box hbox modulus hmodulus r hZ hδ hδ1 hmesh hsmall φ hLip hφ + simpa only [hr] using he + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNaturalAmbientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNaturalAmbientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..b884a093cdabe6c1cc8b94742c05a867b32bfaa2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNaturalAmbientCoordinates.lean @@ -0,0 +1,76 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedProbabilityGrid + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (basis : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {A : Type*} [Fintype A] (layer : A → Fin m) (axis : ∀ a, Fin (n (layer a))) +variable (hgrid : ∀ a, allocatedGridAxis (I := I) U basis S.value ⟨layer a, Sum.inr (axis a)⟩) + +noncomputable def allocatedNaturalGridAmbientCoordinates (z : JetAmbientIndex O J → ℝ) : + ∀ a : A, O (layer a) → ℝ := + fun a t => allocatedPrincipalChartRatio (G := G) B U basis (R := R) (layer a) (axis a) * + allocatedGridAmbientCoordinates B U basis S o z ⟨⟨layer a, Sum.inr (axis a)⟩, hgrid a⟩ t + +omit [Fintype A] [∀ j, Fintype (O j)] in +theorem allocatedNaturalGridAmbientCoordinates_point + (z : ∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) : + allocatedNaturalGridAmbientCoordinates B U basis S o layer axis hgrid + (mixedJetAmbientPoint U basis o z) = + fun a t => ((z (layer a)).2 (axis a) t : ℝ) / + allocatedPrincipalGridScale (G := G) B U basis (R := R) (layer a) (axis a) := by + funext a t + unfold allocatedNaturalGridAmbientCoordinates + rw [allocatedGridAmbientCoordinates_point] + change allocatedPrincipalChartRatio (G := G) B U basis (R := R) (layer a) (axis a) * + (((z (layer a)).2 (axis a) t : ℝ) / basisAxisScale (basis (layer a)) (axis a)) = _ + exact allocatedPrincipalChartRatio_coordinate B U basis (layer a) (axis a) _ + +theorem allocatedNaturalGridAmbientCoordinates_lipschitz + (hR : ∀ j, 0 < R j) (C : Fin m → ℝ≥0) + (hC : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ C j * ‖v‖) + (Q : ℝ≥0) + (hQ : ∀ a, 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B (layer a) (axis a)) : ℝ) + 1) / + R (layer a) ≤ Q) : + LipschitzWith (Q * ∑ j, C j * Fintype.card (J j)) + (allocatedNaturalGridAmbientCoordinates B U basis S (O := O) o layer axis hgrid) := by + apply LipschitzWith.of_dist_le_mul + intro z w + apply (dist_pi_le_iff (by positivity)).mpr + intro a + apply (dist_pi_le_iff (by positivity)).mpr + intro t + let g := allocatedGridAmbientCoordinates B U basis S (O := O) o + let k : {k // allocatedGridAxis (I := I) U basis S.value k} := + ⟨⟨layer a, Sum.inr (axis a)⟩, hgrid a⟩ + have hc : |g z k t - g w k t| ≤ + ((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w := by + have hi := (dist_le_pi_dist (g z k) (g w k) t).trans (dist_le_pi_dist (g z) (g w) k) + exact hi.trans ((allocatedGridAmbientCoordinates_lipschitz B U basis S o C hC).dist_le_mul z w) + change |allocatedPrincipalChartRatio (G := G) B U basis (R := R) (layer a) (axis a) * g z k t - + allocatedPrincipalChartRatio (G := G) B U basis (R := R) (layer a) (axis a) * g w k t| ≤ _ + rw [← mul_sub, abs_mul, abs_of_pos (allocatedPrincipalChartRatio_pos B U basis hR (layer a) (axis a))] + calc + _ ≤ (Q : ℝ) * (((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) * dist z w) := + mul_le_mul ((allocatedPrincipalChartRatio_le B U basis hR (layer a) (axis a)).trans (hQ a)) + hc (abs_nonneg _) Q.coe_nonneg + _ = _ := by rw [NNReal.coe_mul, mul_assoc] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNaturalChartScale.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNaturalChartScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ae8a8207402079dd9209fc5efe0fb852c42cf05 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNaturalChartScale.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Sampling.CeilGridScaleRatio +import OAI.Combinatorics.Progressions.Sampling.GridNormalizationTransport + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped Classical + +variable {m : ℕ} {G : Type*} +variable {I : Fin m → Type*} {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 → ℝ} (hR : ∀ j, 0 < R j) (j : Fin m) (i : Fin (n j)) + +local notation "scale" => allocatedPrincipalGridScale (G := G) B U basis (R := R) j i +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +include hR in +theorem allocatedPrincipalGridScale_pos_of_radius : 0 < scale := by + apply Nat.ceil_pos.mpr + exact mul_pos (principalProfileSize_pos (hR j) _) + (Nat.cast_pos.mpr (basisAxisScale_pos (basis j) i)) + +noncomputable def allocatedPrincipalChartRatio : ℝ := + (basisAxisScale (basis j) i : ℝ) / scale + +include hR in +theorem allocatedPrincipalChartRatio_pos : + 0 < allocatedPrincipalChartRatio (G := G) B U basis (R := R) j i := by + exact div_pos (Nat.cast_pos.mpr (basisAxisScale_pos (basis j) i)) + (Nat.cast_pos.mpr (allocatedPrincipalGridScale_pos_of_radius B U basis hR j i)) + +include hR in +theorem allocatedPrincipalChartRatio_le : + allocatedPrincipalChartRatio (G := G) B U basis (R := R) j i ≤ + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B j i) : ℝ) + 1) / R j := by + have hN : (0 : ℝ) < scale := + Nat.cast_pos.mpr (allocatedPrincipalGridScale_pos_of_radius B U basis hR j i) + have hg : 0 < gamma := principalProfileSize_pos (hR j) _ + have hlow : gamma * (basisAxisScale (basis j) i : ℝ) ≤ scale := Nat.le_ceil _ + calc + _ ≤ 1 / gamma := (div_le_div_iff₀ hN hg).mpr (by nlinarith) + _ = _ := by + unfold principalProfileSize + field_simp + +theorem allocatedPrincipalChartRatio_coordinate (z : ℝ) : + allocatedPrincipalChartRatio (G := G) B U basis (R := R) j i * + (z / basisAxisScale (basis j) i) = z / scale := + grid_rescale_coordinate (Nat.cast_ne_zero.mpr (basisAxisScale_pos (basis j) i).ne') _ _ + +include hR in +theorem allocatedPrincipalChartRatio_density_error (d : ℕ) (f g : ℂ) {ε : ℝ} + (he : ‖(scale : ℂ) ^ d * f - g‖ ≤ ε) : + ‖(basisAxisScale (basis j) i : ℂ) ^ d * f - + (allocatedPrincipalChartRatio (G := G) B U basis (R := R) j i : ℂ) ^ d * g‖ ≤ + allocatedPrincipalChartRatio (G := G) B U basis (R := R) j i ^ d * ε := by + exact grid_normalization_error (Nat.cast_nonneg _) + (Nat.cast_pos.mpr (allocatedPrincipalGridScale_pos_of_radius B U basis hR j i)) d f g he + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNormalizedSpatialApproximation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNormalizedSpatialApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..85499f897c3a6199d77c11b99814ee9ca3d07703 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedNormalizedSpatialApproximation.lean @@ -0,0 +1,324 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedFixedPositiveComparison +import OAI.Combinatorics.Progressions.Estimates.AllocatedTrimmedNormalization + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory +open scoped BigOperators Classical NNReal + +theorem exists_allocated_positive_spatial_approximation (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {G : Type*} [Fintype G] [DecidableEq G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + [DecidableEq (LayerSamplerVariables G I n B)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) + (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox (Fin q) S.value) + {P W κ : ℝ} (_hP : 0 ≤ P) (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) (_hW : 0 ≤ W) + (_hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (_hWP : W ≤ Real.exp P) (_hL : (S.value : ℝ) ≤ Real.exp P) + (selection : Fin q ↪ G) (_hκ : 0 < κ) {M : ℕ} + (_hx : GoodScalarKernelTuple selection κ M x) (_hMP : (M : ℝ) ≤ Real.exp P) + (_hκP : κ⁻¹ ≤ Real.exp P), + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ (y : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin q) (allocatedPrincipalSides B U basis S)) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ V j) + (_hσ1 : ∀ j, σ j ≤ 1) (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (_hmSize : (m : ℝ) ≤ P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (_hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)], + let density := allocatedCoefficientDensity B U basis hb o hR hσ S + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + let root := allocatedPhysicalCubeRoot B U basis S c x y + let dirs := allocatedPhysicalCubeDirections B U basis S x y + let F := euclideanCoefficientJetMap U root dirs + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) + let cover := 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 : ℝ) cap) ∧ Integrable f ξ ∧ + (∫ z, f z ∂ξ) = 1 ∧ + (realDensityMeasure μ (fun z => density (cover z))).map F = realDensityMeasure ξ f ∧ + ∀ {X : Type*} [Fintype X] [DecidableEq X] + (_hX : (Fintype.card X : ℝ) ≤ P) + (_hdim : (Fintype.card (Option (LayerSamplerVariables G I n B) × X) : ℝ) ≤ P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) (base : X → ℤ) + (stride : X → ℕ) (hs : ∀ d, 0 < stride d) (_hsP : ∀ d, (stride d : ℝ) ≤ Real.exp P) + {τ : ℝ} (_hτ : 0 < τ) (_hτP : τ⁻¹ ≤ Real.exp P) + (N : X → ℕ) (_hsize : ∀ d, Real.exp ((P + A) ^ A) ≤ (N d : ℝ)) + {rank : ℝ} (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun d => (N d : ℝ)) rank (U j) (p j)) + (_hRank : Real.exp ((P + A) ^ A) ≤ rank) + (test : Finset (Fin q) → (X → ℝ) → ℂ) (_htest : ∀ s v, ‖test s v‖ ≤ 1) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty) + {Z : ℝ} (_hZnorm : 0 < Z) (_hZi : Z⁻¹ ≤ Real.exp P), + let V := trimmedSpatialWidths (K := LayerSamplerVariables G I n B) W τ N + let root := allocatedPhysicalCubeRoot B U basis S c x y + let dirs := allocatedPhysicalCubeDirections B U basis S x y + let pa := fun j => translate (fun d => (base d : ℝ)) (p j) + let hma := fun j => coefficients_translate_mem (U j) (fun d => (base d : ℝ)) (p j) (hm j) + let sel := selection.trans (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B) + let out := fun d => physicalSpatialOutputScale (Fin q) + (trimmedSpatialRootScale τ N stride d) (trimmedSpatialSlopeScale W τ N stride d) S.value + ∃ (hV : ∀ z, 0 < V z) (hOut : ∀ d i, 0 < out d i) + (hpivot : ((physicalCubeCoefficient root dirs).submatrix id (physicalCubePivotIndex sel)).det ≠ 0) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight stride T V z), + ‖(∑' z, ((selectedResidueSmoothPMF stride T V hV hZ z).toReal : ℂ) * + (physicalCubeSiteTest test (physicalCubeRootDifferences root dirs base z) * + (density (affineSampleCoefficientTorus U pa hma (fun k d => (z (k, d) : ℝ))) : ℂ))) / (Z : ℂ) - + (∑ r : T, (selectedResidueCellWeight stride T V r : ℂ) * + ∫ v, (shiftedProductGridProxy (fun _ : X => physicalCubeCoefficient root dirs) + (fun _ => physicalCubePivotIndex sel) (fun _ => hpivot) + (residueProfileCenter (boundedColumnResidueRepresentative stride r.val) stride) + (residueProfileWidth stride V) out (residueProfileWidth_pos stride V hs hV) hOut v : ℂ) * + physicalCubePositiveTest U D p hm f test + (physicalResidueReconstruct root dirs base + (boundedColumnResidueRepresentative stride r.val) stride v) ∂Measure.count) / (Z : ℂ)‖ ≤ + Real.exp (-P) := by + classical + obtain ⟨A₀, _, hcomparison⟩ := exists_allocated_fixed_positive_comparison m q + obtain ⟨b, _, hbnd⟩ := exists_positiveComparisonDataBudget_bound m q + obtain ⟨A, hA, hbudget⟩ := exists_natPolynomial_eval_budget + (((Polynomial.X + Polynomial.C b) ^ b + Polynomial.C A₀) ^ A₀) + refine ⟨A, hA, ?_⟩ + intro G _ _ I _ n B _ _ J _ U basis R σ S c x P W κ hP hK hW hroot hWP hL + selection hκ M hx hMP hκP + let Q := positiveComparisonDataBudget m q P + have hbounds := positiveComparisonDataBudget_bounds m q hP + have hQ : 0 ≤ Q := hbounds.1 + have hPQ : P ≤ Q := hbounds.2.1 + have hExp := Real.exp_le_exp.mpr hPQ + have hcut : (Q + A₀) ^ A₀ ≤ (P + A) ^ A := by + have hbase : Q + (A₀ : ℝ) ≤ (P + b) ^ b + A₀ := by + have h := hbnd P hP + change Q ≤ (P + b) ^ b at h + linarith + calc + _ ≤ ((P + b) ^ b + A₀) ^ A₀ := + pow_le_pow_left₀ (add_nonneg hQ (Nat.cast_nonneg A₀)) hbase A₀ + _ ≤ _ := by simpa [Polynomial.eval₂_pow] using hbudget P hP + obtain ⟨D, hD, hDP, hfamily⟩ := hcomparison B U basis S c x hQ (hK.trans hPQ) hW hroot + (hWP.trans hExp) (hL.trans hExp) selection hκ hx (hMP.trans hExp) (hκP.trans hExp) + refine ⟨D, hD, hDP.trans (Real.exp_le_exp.mpr hcut), ?_⟩ + intro y _ _ _ _ _ _ hb o hR hσ C Vcap hC hVcap hσ1 Cinv hCinv hchart hsmallChart + hmSize hRP hσP hcount hI hn hJ hAP hCP hVP μ _ _ ν _ _ density cap root dirs Fmap cover ξ + obtain ⟨hcap, F, inst, frequency, coeff, hfreq, hcoeff, happ⟩ := + exists_allocated_positive_fourier_data B U basis hb o S C Vcap hC hVcap q + hR hσ hσ1 Cinv hCinv hchart hsmallChart hP hmSize hK hRP hσP hcount hI hn hJ hAP hL hCP hVP + let _ := inst + obtain ⟨f, hfc, hfb, hfi, hfmass, hflaw, hcomp⟩ := + hfamily y hb o hR hσ C Vcap hC hVcap hσ1 Cinv hCinv hchart hsmallChart μ ν + refine ⟨f, hfc, hfb, hfi, hfmass, hflaw, ?_⟩ + intro X _ _ hX hdim p hp hm base stride hs hsP τ hτ hτP N hsize rank hrank hRank test htest T hT Z hZnorm hZi + let bcap := allocatedFourierLogBudget m (2 * P + 4) + have hbcap : 0 ≤ bcap := allocatedFourierLogBudget_nonneg m (by linarith) + have hacc := positiveComparisonAccuracy_spec q P bcap + have hηQ : (positiveProjectionAccuracy P)⁻¹ ≤ Real.exp Q := by + rw [hacc.2.2.1] + exact Real.exp_le_exp.mpr hbounds.2.2.1 + have hεQ : (positiveSpatialAccuracy q P bcap)⁻¹ ≤ Real.exp Q := by + rw [hacc.2.2.2] + exact Real.exp_le_exp.mpr hbounds.2.2.2.2 + have herr := positiveComparison_error_budget q hP hbcap hX hK hcap hZnorm hZi + obtain ⟨hV, hOut, hpivot, hZ, he⟩ := hcomp (hX.trans hPQ) (hdim.trans hPQ) frequency hfreq coeff hcoeff + p hp hm base stride hs (fun d => (hsP d).trans hExp) hτ (hτP.trans hExp) + hacc.1 hηQ hacc.2.1 hεQ N (fun d => (Real.exp_le_exp.mpr hcut).trans (hsize d)) + herr.1 hrank ((Real.exp_le_exp.mpr hcut).trans hRank) test htest T hT hacc.1.le happ hZnorm + exact ⟨hV, hOut, hpivot, hZ, he.trans herr.2⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory +open scoped BigOperators Classical NNReal + +theorem exists_allocated_normalized_spatial_approximation (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {G : Type*} [Fintype G] [DecidableEq G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + [DecidableEq (LayerSamplerVariables G I n B)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) + (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox (Fin q) S.value) + {P W κ : ℝ} (_hP : 0 ≤ P) (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) (_hW : 0 ≤ W) + (_hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (_hWP : W ≤ Real.exp P) (_hL : (S.value : ℝ) ≤ Real.exp P) + (selection : Fin q ↪ G) (_hκ : 0 < κ) {M : ℕ} + (_hx : GoodScalarKernelTuple selection κ M x) (_hMP : (M : ℝ) ≤ Real.exp P) + (_hκP : κ⁻¹ ≤ Real.exp P), + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ (y : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin q) (allocatedPrincipalSides B U basis S)) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ V j) + (_hσ1 : ∀ j, σ j ≤ 1) (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (_hmSize : (m : ℝ) ≤ P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (_hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)], + let density := allocatedCoefficientDensity B U basis hb o hR hσ S + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + let root := allocatedPhysicalCubeRoot B U basis S c x y + let dirs := allocatedPhysicalCubeDirections B U basis S x y + let F := euclideanCoefficientJetMap U root dirs + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) + let cover := 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 : ℝ) cap) ∧ Integrable f ξ ∧ + (∫ z, f z ∂ξ) = 1 ∧ + (realDensityMeasure μ (fun z => density (cover z))).map F = realDensityMeasure ξ f ∧ + ∀ {X : Type*} [Fintype X] [DecidableEq X] + (_hX : (Fintype.card X : ℝ) ≤ P) + (_hdim : (Fintype.card (Option (LayerSamplerVariables G I n B) × X) : ℝ) ≤ P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) (base : X → ℤ) + (stride : X → ℕ) (hs : ∀ d, 0 < stride d) (_hsP : ∀ d, (stride d : ℝ) ≤ Real.exp P) + {τ : ℝ} (_hτ : 0 < τ) (_hτP : τ⁻¹ ≤ Real.exp P) + (N : X → ℕ) (_hsize : ∀ d, Real.exp ((P + A) ^ A) ≤ (N d : ℝ)) + {rank : ℝ} (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun d => (N d : ℝ)) rank (U j) (p j)) + (_hRank : Real.exp ((P + A) ^ A) ≤ rank) + (test : Finset (Fin q) → (X → ℝ) → ℂ) (_htest : ∀ s v, ‖test s v‖ ≤ 1) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty) + (bases : Finset (X → ℤ)) (_hbases : bases.Nonempty), + let V := trimmedSpatialWidths (K := LayerSamplerVariables G I n B) W τ N + let root := allocatedPhysicalCubeRoot B U basis S c x y + let dirs := allocatedPhysicalCubeDirections B U basis S x y + let pa := fun j => translate (fun d => (base d : ℝ)) (p j) + let hma := fun j => coefficients_translate_mem (U j) (fun d => (base d : ℝ)) (p j) (hm j) + let sel := selection.trans (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B) + let out := fun d => physicalSpatialOutputScale (Fin q) + (trimmedSpatialRootScale τ N stride d) (trimmedSpatialSlopeScale W τ N stride d) S.value + let baseDensity := fun (a : X → ℤ) z => density (affineSampleCoefficientTorus U + (fun j => translate (fun d => (a d : ℝ)) (p j)) + (fun j => coefficients_translate_mem (U j) (fun d => (a d : ℝ)) (p j) (hm j)) + (fun k d => (z (k, d) : ℝ))) + let Z := selectedJointDensityMass bases stride T V baseDensity + ∃ (hV : ∀ z, 0 < V z) (hOut : ∀ d i, 0 < out d i) + (hpivot : ((physicalCubeCoefficient root dirs).submatrix id (physicalCubePivotIndex sel)).det ≠ 0) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight stride T V z), + (|Z - 1| ≤ Real.exp (-P) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) ∧ + ‖(∑' z, ((selectedResidueSmoothPMF stride T V hV hZ z).toReal : ℂ) * + (physicalCubeSiteTest test (physicalCubeRootDifferences root dirs base z) * + (density (affineSampleCoefficientTorus U pa hma (fun k d => (z (k, d) : ℝ))) : ℂ))) / (Z : ℂ) - + (∑ r : T, (selectedResidueCellWeight stride T V r : ℂ) * + ∫ v, (shiftedProductGridProxy (fun _ : X => physicalCubeCoefficient root dirs) + (fun _ => physicalCubePivotIndex sel) (fun _ => hpivot) + (residueProfileCenter (boundedColumnResidueRepresentative stride r.val) stride) + (residueProfileWidth stride V) out (residueProfileWidth_pos stride V hs hV) hOut v : ℂ) * + physicalCubePositiveTest U D p hm f test + (physicalResidueReconstruct root dirs base + (boundedColumnResidueRepresentative stride r.val) stride v) ∂Measure.count) / (Z : ℂ)‖ ≤ + Real.exp (-P) := by + classical + obtain ⟨Ac, _, hcomparison⟩ := exists_allocated_positive_spatial_approximation m q + obtain ⟨An, _, hnormalization⟩ := exists_allocated_trimmed_normalization m + obtain ⟨A, hA, hbudget⟩ := exists_natPolynomial_eval_budget + ((Polynomial.X + Polynomial.C (2 + Ac)) ^ Ac + (Polynomial.X + Polynomial.C An) ^ An) + refine ⟨A, hA, ?_⟩ + intro G _ _ I _ n B _ _ J _ U basis R σ S c x P W κ hP hK hW hroot hWP hL + selection hκ M hx hMP hκP + have hP2 : 0 ≤ P + 2 := by linarith + have hPP2 : P ≤ P + 2 := by linarith + have hExp := Real.exp_le_exp.mpr hPP2 + have hsum : (P + 2 + Ac) ^ Ac + (P + An) ^ An ≤ (P + A) ^ A := by + have h := hbudget P hP + simpa [Polynomial.eval₂_pow, add_assoc] using h + have hcompCut : (P + 2 + Ac) ^ Ac ≤ (P + A) ^ A := by + linarith [pow_nonneg (add_nonneg hP (Nat.cast_nonneg An)) An] + have hnormCut : (P + An) ^ An ≤ (P + A) ^ A := by + linarith [pow_nonneg (add_nonneg hP2 (Nat.cast_nonneg Ac)) Ac] + obtain ⟨D, hD, hDP, hfamily⟩ := hcomparison B U basis S c x hP2 (hK.trans hPP2) hW hroot + (hWP.trans hExp) (hL.trans hExp) selection hκ hx (hMP.trans hExp) (hκP.trans hExp) + refine ⟨D, hD, hDP.trans (Real.exp_le_exp.mpr hcompCut), ?_⟩ + intro y _ _ _ _ _ _ hb o hR hσ C Vcap hC hVcap hσ1 Cinv hCinv hchart hsmall + hmSize hRP hσP hcount hI hn hJ hAP hCP hVP μ _ _ ν _ _ density cap root dirs Fmap cover ξ + obtain ⟨f, hfc, hfb, hfi, hfmass, hflaw, hcomp⟩ := + hfamily y hb o hR hσ C Vcap hC hVcap hσ1 Cinv hCinv hchart hsmall + (hmSize.trans hPP2) (fun j => (hRP j).trans hExp) (fun j => (hσP j).trans hExp) + (fun j => (hcount j).trans hPP2) (fun j => (hI j).trans hPP2) + (fun j => (hn j).trans hPP2) (fun j => (hJ j).trans hPP2) + (hAP.trans hExp) (fun j => (hCP j).trans hExp) (fun j => (hVP j).trans hExp) μ ν + refine ⟨f, hfc, hfb, hfi, hfmass, hflaw, ?_⟩ + intro X _ _ hX hdim p hp hm base stride hs hsP τ hτ hτP N hsize rank hrank hRank + test htest T hT bases hbases V root' dirs' pa hma sel out baseDensity Z + obtain ⟨_, _, _, hglobal⟩ := hnormalization B U basis S hb o μ ν + hR hσ hσ1 C Vcap hC hVcap Cinv hCinv hchart hsmall hP hmSize hK hX hdim + hRP hσP hcount hI hn hJ hAP hL hCP hVP p hp hm stride hs hsP hW hWP hτ hτP + N (fun d => (Real.exp_le_exp.mpr hnormCut).trans (hsize d)) hrank + ((Real.exp_le_exp.mpr hnormCut).trans hRank) T hT + have hnormal := hglobal bases hbases + change |Z - 1| ≤ Real.exp (-P) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ + 0 < Z ∧ Z⁻¹ ≤ 2 at hnormal + have hZi : Z⁻¹ ≤ Real.exp (P + 2) := + hnormal.2.2.2.trans (by linarith [Real.add_one_le_exp (P + 2)]) + obtain ⟨hV, hOut, hpivot, hZ, he⟩ := hcomp (hX.trans hPP2) (hdim.trans hPP2) + p hp hm base stride hs (fun d => (hsP d).trans hExp) hτ (hτP.trans hExp) + N (fun d => (Real.exp_le_exp.mpr hcompCut).trans (hsize d)) hrank + ((Real.exp_le_exp.mpr hcompCut).trans hRank) test htest T hT hnormal.2.2.1 hZi + exact ⟨hV, hOut, hpivot, hZ, hnormal, + he.trans (Real.exp_le_exp.mpr (by linarith))⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOneCubeCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOneCubeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..fce32eecd1d1440214edfbd35766edf4c5951c1e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOneCubeCoordinates.lean @@ -0,0 +1,174 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedCoveredComparison +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedEndpointIdentity +import OAI.Combinatorics.Progressions.Estimates.PhysicalActiveIdealSite + +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)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "hLayer" => layerSamplerDegree I n + +noncomputable def allocatedIdealSiteCoordinates + (z : AllocatedLongJetRows B U b S jets) : Finset α → LayerSamplerAxis I n → ℝ := + realSitesFromBoundedJets (fun a : LayerSamplerAxis I n => (a.1 : ℕ) + 1) (fun q => + if ha : ¬grid q.1 then + allocatedLongJetRealCoordinates B U b S z ⟨⟨q.1, ha⟩, q.2⟩ / R q.1.1 + else 0) + +theorem allocatedIdealSiteCoordinates_jet + (z : AllocatedLongJetRows B U b S jets) (a : {a // ¬grid a}) (r : jets a.val.1) : + booleanCoefficient (fun s => allocatedIdealSiteCoordinates B U b S z s a.val) r.val = + allocatedLongJetRealCoordinates B U b S z ⟨a, r⟩ / R a.val.1 := by + unfold allocatedIdealSiteCoordinates realSitesFromBoundedJets + rw [realBoundedSiteReconstruction_coefficient] + simp only [dite_eq_left a.property] + +theorem allocatedIdealSiteCoordinates_physical_jets (hR : ∀ j, 0 < R j) + (z : AllocatedLongJetRows B U b S jets) : + booleanSiteJets (fun a : {a // ¬grid a} => + (Subtype.val : jets a.val.1 → Finset α)) + (fun s a => R a.val.1 * allocatedIdealSiteCoordinates B U b S z s a.val) = + allocatedLongJetRealCoordinates B U b S z := by + funext q + change booleanCoefficient (fun s => R q.1.val.1 * allocatedIdealSiteCoordinates B U b S z s q.1.val) + q.2.val = _ + rw [booleanCoefficient_const_mul, allocatedIdealSiteCoordinates_jet] + field_simp [(hR q.1.val.1).ne'] + +theorem allocatedIdealSiteCoordinates_density (hR : ∀ j, 0 < R j) + (δ : ℝ≥0) (z : AllocatedLongJetRows B U b S jets) : + (∏ q : (Σ a : {a // ¬grid a}, jets a.val.1), R q.1.val.1) * + physicalActiveProfileIdeal (G := G) (B := B) (G × Option α) hLayer grid + (fun a => (Subtype.val : jets a.val.1 → Finset α)) + (fun a => R a.1) (fun a => hR a.1) δ (allocatedLongJetRealCoordinates B U b S z) = + activeAveragedProfileIdeal (G := G) (B := B) (G × Option α) hLayer grid + (fun a => (Subtype.val : jets a.val.1 → Finset α)) δ + (booleanSiteJets (fun a : {a // ¬grid a} => (Subtype.val : jets a.val.1 → Finset α)) + (fun s a => allocatedIdealSiteCoordinates B U b S z s a.val)) := by + have h := physicalActiveProfileIdeal_normalized_sites (G := G) (Z := G × Option α) (B := B) + (O := fun a : LayerSamplerAxis I n => jets a.1) + hLayer grid (fun a => (Subtype.val : jets a.val.1 → Finset α)) + (fun a => R a.1) (fun a => hR a.1) δ (allocatedIdealSiteCoordinates B U b S z) + rw [allocatedIdealSiteCoordinates_physical_jets B U b S hR z] at h + exact h + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "hLayer" => layerSamplerDegree I n + +theorem allocatedIdealSiteCoordinates_bound_of_ne_zero + (hR : ∀ j, 0 < R j) (δ : ℝ≥0) (hδ : 0 < δ) (hδ1 : δ ≤ 1) + (z : AllocatedLongJetRows B U b S jets) + (hne : physicalActiveProfileIdeal (G := G) (B := B) (G × Option α) hLayer grid + (fun a => (Subtype.val : jets a.val.1 → Finset α)) + (fun a => R a.1) (fun a => hR a.1) δ (allocatedLongJetRealCoordinates B U b S z) ≠ 0) + (s : Finset α) (a : LayerSamplerAxis I n) : + |allocatedIdealSiteCoordinates B U b S z s a| ≤ + (2 : ℝ) ^ Fintype.card α * (partitionedIdealRadius α m + 1) := by + let v : (Σ a : {a // ¬grid a}, jets a.val.1) → ℝ := + fun q => allocatedLongJetRealCoordinates B U b S z q / R q.1.val.1 + have hactive : activeAveragedProfileIdeal (G := G) (B := B) (G × Option α) hLayer grid + (fun a => (Subtype.val : jets a.val.1 → Finset α)) δ v ≠ 0 := by + intro hz + apply hne + rw [physicalActiveProfileIdeal_eq] + change _ * activeAveragedProfileIdeal (G := G) (B := B) (G × Option α) hLayer grid + (fun a => (Subtype.val : jets a.val.1 → Finset α)) δ v = 0 + rw [hz, mul_zero] + have hv : ‖v‖ ≤ partitionedIdealRadius α m + 1 := by + apply le_of_not_gt + intro hv + exact hactive (activeAveragedProfileIdeal_zero_outside (G × Option α) hLayer grid + (fun a => (Subtype.val : jets a.val.1 → Finset α)) + (fun a => Nat.succ_le_of_lt a.1.isLt) δ hδ hδ1 v hv) + have hrad : 0 ≤ partitionedIdealRadius α m + 1 := by + have h := partitionedIdealRadius_nonneg α m + linarith + unfold allocatedIdealSiteCoordinates + apply realSitesFromBoundedJets_bound (fun a : LayerSamplerAxis I n => (a.1 : ℕ) + 1) _ hrad + intro q + split_ifs with ha + · simpa only [abs_zero] using hrad + · have hcoord : |v ⟨⟨q.1, ha⟩, q.2⟩| ≤ ‖v‖ := by + simpa only [Real.norm_eq_abs] using norm_le_pi_norm v ⟨⟨q.1, ha⟩, q.2⟩ + exact hcoord.trans hv + +theorem allocatedIdealSiteCoordinates_zero_outside + (hR : ∀ j, 0 < R j) (δ : ℝ≥0) (hδ : 0 < δ) (hδ1 : δ ≤ 1) + (z : AllocatedLongJetRows B U b S jets) (s : Finset α) (a : LayerSamplerAxis I n) + (hlarge : (2 : ℝ) ^ Fintype.card α * (partitionedIdealRadius α m + 1) < + |allocatedIdealSiteCoordinates B U b S z s a|) : + physicalActiveProfileIdeal (G := G) (B := B) (G × Option α) hLayer grid + (fun a => (Subtype.val : jets a.val.1 → Finset α)) + (fun a => R a.1) (fun a => hR a.1) δ (allocatedLongJetRealCoordinates B U b S z) = 0 := by + by_contra hne + exact (not_lt_of_ge (allocatedIdealSiteCoordinates_bound_of_ne_zero B U b S hR δ hδ hδ1 z hne s a)) hlarge + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped 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)] (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 "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "jets" => (fun j : Fin m => BoundedBooleanJet (Fin 1) (Fin.val j + 1)) +local notation "Jet" => (Σ _a : {a // ¬grid a}, Finset (Fin 1)) + +noncomputable def allocatedOneCubeFullLongJets (z : AllocatedLongJetRows B U basis S jets) : Jet → ℝ := + fun q => allocatedLongJetRealCoordinates B U basis S z + ⟨q.1, oneCubeBoundedJetEquiv (q.1.val.1.val + 1) (Nat.le_add_left 1 _) q.2⟩ + +theorem allocatedOneCubeNormalizedSites_eq (z : AllocatedLongJetRows B U basis S jets) : + oneCubeNormalizedSites grid (fun a => R a.1) (allocatedOneCubeFullLongJets B U basis S z) = + allocatedIdealSiteCoordinates B U basis S z := by + exact oneCubeNormalizedSites_bounded_coordinates grid (fun a => R a.1) + (fun a : LayerSamplerAxis I n => a.1.val + 1) (fun a => Nat.le_add_left 1 _) + (allocatedLongJetRealCoordinates B U basis S z) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOriginalBoxInputs.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOriginalBoxInputs.lean new file mode 100644 index 0000000000000000000000000000000000000000..2fbb77ef9cc58642ff4fca949d1c55564f67a4a5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOriginalBoxInputs.lean @@ -0,0 +1,88 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCenteredJointSource + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (hx : ∀ g, (integerScalarCubeWeights (Fin dim) S.value S.positive).weight (x g) ≠ 0) +variable (X : Type*) [Fintype X] [DecidableEq X] (stride : X → ℕ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (N : X → ℕ) (hN : ∀ a, 0 < N a) +variable {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ : 0 < ξ) +variable (hξ1 : ξ ≤ 1) (hτ1 : τ ≤ 1 / 2) (hsize : ∀ a, 4 ≤ τ * (N a : ℝ)) +variable (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) +variable (base : X → ℤ) (hbase : base ∈ trimmedIntegerBox N (spatialTrimMargin τ N)) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) +local notation "widths" => narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N +local notation "hwidths" => narrowTrimmedSpatialWidths_pos hW hτ hξ N hN +local notation "whole" => principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S) +variable (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) +variable (test : Finset (Fin dim) → (X → ℝ) → ℂ) (Z : ℝ) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hmem : ∀ j e, coefficients (poly j) e ∈ U j) + +omit [DecidableEq G] in +include hx hξ1 hτ1 hsize hbudget hbase in +theorem allocatedOriginalTupleSource_box_extension : + allocatedOriginalTupleSource B U b hR hσ S x X stride hb o N hN hW hτ hξ base cells hmass + (physicalCubeSiteTest (fun s => integerBoxTestExtension N (test s))) Z poly hmem = + allocatedOriginalTupleSource B U b hR hσ S x X stride hb o N hN hW hτ hξ base cells hmass + (physicalCubeSiteTest test) Z poly hmem := by + dsimp only [allocatedOriginalTupleSource] + apply congrArg (fun z : ℂ => z / (Z : ℂ)) + apply (whole).complexMean_congr_support + intro y hy + apply tsum_congr + intro z + by_cases hz : z ∈ rectangularWeightIndices 0 widths 1 + · have heq := allocatedPhysicalCube_supported_testExtension B U b S (fun _ => 0) x y + hx hy hbudget hτ hξ1 N hN hτ1 hsize test (⟨base, hbase⟩, ⟨z, hz⟩) + rw [heq] + · simp only [selectedResidueSmoothPMF_toReal, + selectedResidueSmoothWeight_zero_off stride cells widths hwidths z hz, + zero_div, Complex.ofReal_zero, zero_mul] + +include hξ1 hτ1 hsize hbudget in +theorem allocatedOriginalTupleSource_box_extension_kernel_mean + (kernelLaw : FiniteProbabilityWeights (G → IntegerScalarCubeBox (Fin dim) S.value)) + (hkernel : ∀ x, kernelLaw.weight x ≠ 0 → + ∀ g, (integerScalarCubeWeights (Fin dim) S.value S.positive).weight (x g) ≠ 0) + (bases : Finset (X → ℤ)) + (hbases : ∀ base ∈ bases, base ∈ trimmedIntegerBox N (spatialTrimMargin τ N)) : + kernelLaw.complexMean (fun x => 𝔼 base ∈ bases, + allocatedOriginalTupleSource B U b hR hσ S x X stride hb o N hN hW hτ hξ base cells hmass + (physicalCubeSiteTest (fun s => integerBoxTestExtension N (test s))) Z poly hmem) = + kernelLaw.complexMean (fun x => 𝔼 base ∈ bases, + allocatedOriginalTupleSource B U b hR hσ S x X stride hb o N hN hW hτ hξ base cells hmass + (physicalCubeSiteTest test) Z poly hmem) := by + apply kernelLaw.complexMean_congr_support + intro x hx + apply Finset.expect_congr rfl + intro base hbase + exact allocatedOriginalTupleSource_box_extension B U b hR hσ S x (hkernel x hx) X stride hb o + N hN hW hτ hξ hξ1 hτ1 hsize hbudget base (hbases base hbase) cells hmass test Z poly hmem + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOriginalCoarseBoxSource.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOriginalCoarseBoxSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..01da393adc107da9b14ea5c102487f6a26c14222 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedOriginalCoarseBoxSource.lean @@ -0,0 +1,135 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedProductCoarseSourceAssembly +import OAI.Combinatorics.Progressions.Lattices.AllocatedCommonPrimitiveAffine + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set BooleanCubeKernel +open scoped BigOperators Classical NNReal + +universe uG uI uB uJ uQ uX + +attribute [local instance 2000] fullBooleanRowSetFintype activeAmbientAxisDecidableEq + +variable {m dim : ℕ} {G : Type uG} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type uI} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type uB) [∀ a, Fintype (B a)] +variable {J : Fin m → Type uJ} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {p cEarly cLate P e E : ℝ} + +local notation "Eraw" => (E + 2) + 4 + +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "accuracy" => allocatedOriginalCoverAccuracy P (E + 2) +local notation "pAccuracy" => allocatedCommonRefinedSourceLog m p cEarly P e 0 accuracy +local notation "pSampling" => allocatedCommonRefinedSourceLog m p cLate P e Eraw accuracy +local notation "S" => allocatedCommonScale (G := G) B U b hR hσ p cLate P e Eraw +local notation "maskLog" => allocatedSiteKernelMaskLog m P +local notation "profileLog" => allocatedIdealProfileLog m pAccuracy e +local notation "resourceLog" => allocatedFullGridPrimitiveResourceLog m pAccuracy maskLog profileLog accuracy +local notation "tolerance" => allocatedSitePrimitiveTolerance m pAccuracy maskLog profileLog accuracy + +local notation "D" => allocatedComparisonDimension m p +local notation "pNum" => allocatedCommonScaleNumeric m p cLate P Eraw +local notation "error" => allocatedReferenceIdealError m D P Eraw +local notation "lengthLog" => allocatedIdealScaleLog m D pNum e maskLog error +local notation "gainLog" => allocatedProfileGainLog m D P maskLog +local notation "Pbase" => allocatedIdealSourceBudget m D pNum e maskLog error +local notation "lateLog" => allocatedSpatialLateLog (G := G) B Pbase Pbase +local notation "rawFourier" => allocatedProfileFourierOutput (allocatedActualProfileInput m D pNum e gainLog lengthLog) +local notation "rowTypes" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) + +theorem exists_original_common_coarse_box_source + (hp : 0 ≤ p) (hcEarly : 0 ≤ cEarly) (hcLate : 0 ≤ cLate) (hEarlyLate : cEarly ≤ cLate) + (hP : 0 ≤ P) (he : 0 ≤ e) (hE : 0 ≤ E) + (hdimSmall : dim ≤ m + 1) (hmP : ((m + 2 : ℕ) : ℝ) ≤ P) (hpP : p ≤ P) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn : ∀ j, (n j : ℝ) ≤ p) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ 2 * p) + (hR1 : ∀ j, R j ≤ 1) (hσ1 : ∀ j, σ j ≤ 1) + (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp cEarly) (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp cLate) + (hBlocks : ∀ (j : Fin m) (i : Fin (n j)), max + (positiveModerateSpectrumBlockCount j.val (rowSets j).card + ((layerTailDegree m + 2) * (rowSets j).card)) + (uniformSpectrumBlockCount j.val (rowSets j).card ((j.val + 1) * (rowSets j).card)) ≤ + Fintype.card (B ⟨j, Sum.inr i⟩)) + {δ : ℝ≥0} (hδ : 0 < δ) (hδ1 : δ ≤ 1) (hδe : (δ : ℝ)⁻¹ ≤ Real.exp e) + {A T Kproj Kideal Ksite Knorm : ℕ} (hT : 1 ≤ T) (hKsite : 2 ≤ Ksite) + (hKnorm : 1 ≤ Knorm) + (hnorm : AllocatedSourceNarrowNormalization.{uG,uI,uB,uJ,uX} m Knorm) + (hSampling : AllocatedBooleanRowsSampling.{uX,uJ,uG,uI,uB,uQ} m dim Ksite rowTypes rows) + (hraw : AllocatedOriginalResidueWeightedMeshAtScale.{uG,uI,uB,uJ,uQ,uX} + (G := G) (dim := dim) B U b hR hσ D P (E + 2) e pNum δ A T Kproj Kideal) : + ∃ witnesses : (q : AllocatedRefinedPeriodIndex m P) → + (r : AllocatedPositiveResidue (dim := dim) B U b S (q.val : ℕ)) → + AllocatedFullGridResidueWitness (dim := dim) B U b S (q.val : ℕ) r.val, + (∀ q r a, ((witnesses q r).expansion a).Bounds + (Real.exp resourceLog) (Real.exp resourceLog) (Real.exp resourceLog) + ⟨Real.exp resourceLog, Real.exp_nonneg _⟩ + (Real.exp (allocatedInactiveSupportLog (allocatedComparisonDimension m pAccuracy)))) ∧ + (∀ q r, AllocatedFullGridResidueSampling.{uG,uI,uB,uJ,uQ,uX} + B U b hR hσ S (q.val : ℕ) (witnesses q r) tolerance) ∧ + ∀ (M Dwin : ℕ) (hM : 0 < M) (hDwin : 0 < Dwin) (η : ℝ) (hη : 0 < η), + AllocatedProductCoarseBoxAffineData.{uG,uI,uB,uJ,uQ,uX} + B U b hR hσ S P E e pNum Pbase + (allocatedSourceSamplingBudget m dim A Pbase (E + 2) lateLog rawFourier) + pAccuracy pSampling hP δ A (max T (max Kproj Kideal)) (max Ksite Knorm) witnesses + M Dwin hM hDwin η hη := by + let jets := fun j : Fin m => BoundedBooleanJet (Fin dim) (j.val + 1) + have hdimensions : AllocatedComparisonDimensions (G := G) B (Fin dim) jets D := + allocatedComparisonDimensions_of_primitive B + (fun j => (Subtype.val : jets j → Finset (Fin dim))) + (by simpa only [Fintype.card_fin] using hdimSmall) + (fun _ => Subtype.val_injective) hp hvars hI hn + have hEraw : 0 ≤ Eraw := by linarith only [hE] + obtain ⟨hNum, _, hcNum, hPNum, _⟩ := allocatedCommonScaleNumeric_bounds m hp hcLate hP hEraw + have hw : 0 ≤ maskLog := allocatedSiteKernelMaskLog_nonneg m hP + have herror : 0 ≤ error := allocatedReferenceIdealError_nonneg m hdimensions.nonneg hP hEraw + have hgain : 0 ≤ gainLog := allocatedProfileGainLog_nonneg m hdimensions.nonneg hP hw + have hlength : 0 ≤ lengthLog := by + have h := allocatedIdealScaleInput_bounds m hdimensions.nonneg hNum he hw herror + exact h.2.1.trans h.2.2.2.2.2 + have hF : 0 ≤ rawFourier := allocatedActualProfileFourier_nonneg m hdimensions.nonneg hNum he hgain hlength + obtain ⟨hBase1, _, hNumBase, _, _⟩ := + allocatedIdealSourceBudget_bounds m hdimensions.nonneg hNum he hw herror + have hBase0 : 0 ≤ Pbase := zero_le_one.trans hBase1 + have hPBase : P ≤ Pbase := hPNum.trans hNumBase + have hlate : Pbase ≤ lateLog := by + have hcap : 0 ≤ (Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) : ℝ) * + allocatedAmbientLog m Pbase := mul_nonneg (Nat.cast_nonneg _) (allocatedAmbientLog_nonneg m hBase0) + unfold allocatedSpatialLateLog + linarith only [hcap, hBase0] + have hnum : ∀ (_o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (C V : Fin m → ℝ≥0), (∀ j, (C j : ℝ) ≤ Real.exp pNum) → + (∀ j, (V j : ℝ) ≤ Real.exp pNum) → AllocatedSourceNumerics B U b S C V Pbase := by + intro o C V hCp hVp + exact allocatedIdealSource_numerics B U b o hdimensions hNum he hw herror hR hσ + (fun j => ((hRi j).trans (Real.exp_le_exp.mpr hEarlyLate)).trans (Real.exp_le_exp.mpr hcNum)) + (fun j => (hσi j).trans (Real.exp_le_exp.mpr hcNum)) C V hCp hVp + have hmNorm : ((m + 1 : ℕ) : ℝ) ≤ P := + (Nat.cast_le.mpr (show m + 1 ≤ m + 2 by omega)).trans hmP + have hdimNorm : ((dim + 1 : ℕ) : ℝ) ≤ P := + (Nat.cast_le.mpr (show dim + 1 ≤ m + 2 by omega)).trans hmP + have hG : (Fintype.card G : ℝ) ≤ P := + (Nat.cast_le.mpr (allocatedKernelVariables_card_le_variables (G := G) B)).trans (hvars.trans hpP) + obtain ⟨witnesses, hBounds, hWitnesses, hData⟩ := + exists_original_common_early_coarse_raw_cover B U b hR hσ hp hcEarly hcLate hEarlyLate hP he hE + hdimSmall hmP hpP hvars hI hn hJ hR1 hσ1 hRi hσi hBlocks hδ hδ1 hδe hKsite hSampling hraw + refine ⟨witnesses, hBounds, hWitnesses, ?_⟩ + intro M Dwin hM hDwin η hη + exact allocatedProductCoarseRawData_normalized_box_affine B U b hR hσ S hP hE hPBase hNumBase + hmNorm hdimNorm hG hlate hF hnum (hT.trans (le_max_left _ _)) (by omega) hKnorm hnorm + witnesses M Dwin hM hDwin η hη hData + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPaddedParameterBoxEarlyFreeze.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPaddedParameterBoxEarlyFreeze.lean new file mode 100644 index 0000000000000000000000000000000000000000..710b3363b0b6cf85b072184c2d167647c20932d8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPaddedParameterBoxEarlyFreeze.lean @@ -0,0 +1,193 @@ +import OAI.Combinatorics.Progressions.Dynamics.PreparedFreezingEarlyLogBudget +import OAI.Combinatorics.Progressions.Estimates.AllocatedPaddedRecoveredPreparedFreeze +import OAI.Combinatorics.Progressions.Lattices.LayerSamplerIntegerBox + +namespace OAI + +section + +namespace Erdos3.PolynomialPatch.LowestLayerModel +open VectorPolynomial Module Submodule BooleanCubeKernel +open scoped BigOperators TensorProduct Classical + +variable {m q s D E : ℕ} {X G : Type} [Fintype X] [Fintype G] +variable (L : RankPreparationFamily X (Fin D) m) (hmq : m ≤ q) +variable {I Deck : Fin q → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (Deck j)] +variable {n : Fin q → ℕ} (B : LayerSamplerAxis I n → Type) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ ((L.pad q j).Coord → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin q → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +local notation "Vars" => LayerSamplerVariables G I n B + +local notation "sides" => Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) + +include hmq in +omit [∀ j, Fintype (Deck j)] in +theorem exists_freeze_allocated_padded_parameter_box + {A : PolynomialPatch X s (D + E)} (F : A.LowestLayerModel m) + (ip : Fin D → MvPolynomial X ℤ) (hip : ∀ i, (ip i).totalDegree ≤ m) + (c₀ : Fin D → ℝ) (err : VectorPolynomial X ℝ (Fin D → ℝ)) + (hprepare : VectorPolynomial.ofCoordinates (Pi.basisFun ℝ (Fin D)) F.normalizedOrigin = + L.polynomial + integerCoordinates ip + (1 ⊗ₜ[ℝ] c₀) + err) + (hm : ∀ j d, coefficients (L.pad q j).poly d ∈ U j) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (L.pad q j).poly) + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin q → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (c : ∀ j, U j) (N : X → ℕ) (hN : ∀ x, 0 < N x) + {τ ξ : ℝ} (hτ : 0 < τ) (hτhalf : τ ≤ 1 / 2) (hξ1 : ξ ≤ 1) + (hsize : ∀ x, 4 ≤ τ * (N x : ℝ)) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ N) 1) + (sample : CoefficientSamplerArrays (K := Vars) I n) + (read : AllocatedActualCoefficientIndex G X I Deck n B → ℤ) + (hread : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ + (fun j => (L.pad q j).poly) hm c z.1.val z.2.val sample read) + {δ gain : ℝ} (hδ : 0 ≤ δ) (hgain : 0 < gain) + (hgain1 : gain ≤ 1) + (herr : ∀ x ∈ integerBox N, ∀ i, |eval (fun z => (x z : ℝ)) err i| ≤ δ) + (hδbudget : δ ≤ gain / (128 * ((D : ℝ) + 1) * (A.kernel.lip + 1))) + {Pearly : ℝ} + (hearly : ∀ C' : Fin q → ℝ, (∀ j, 0 ≤ C' j) → + (∀ j, C' j ≤ Real.exp Pearly) → + ∀ j, C' j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (hinflation : ∀ j, + (32 * ((D : ℝ) + 1) * (A.kernel.lip + 1) * ((q : ℝ) + 1) / gain) * + (Fintype.card (L.pad q j).Coord : ℝ) * C j ≤ Real.exp Pearly) + (score : integerBox (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S)) → ℝ) (hscoreBound : ∀ u, |score u| ≤ 1) + (hscore : gain / 2 ≤ 𝔼 u, score u * A.value + (fun x => (integerAffineMap (fun x k => jointIntegerFrame (z.1.val,z.2.val) (some k) x) + (jointIntegerFrame (z.1.val,z.2.val) none) u.val x : ℝ))) : + ∃ A' : PolynomialPatch Vars s E, + A'.kernel.lip = A.kernel.lip ∧ + (∀ i, A'.weight i = A.weight (i.natAdd D)) ∧ + 7 * gain / 16 ≤ 𝔼 u, score u * A'.value (fun k => (u.val k : ℝ)) := by + classical + have hLip : 0 ≤ (A.kernel.lip : ℝ) := NNReal.coe_nonneg _ + let C' : Fin q → ℝ := fun j => + (32 * ((D : ℝ) + 1) * (A.kernel.lip + 1) * ((q : ℝ) + 1) / gain) * + (Fintype.card (L.pad q j).Coord : ℝ) * C j + have hC' : ∀ j, 0 ≤ C' j := by + intro j + dsimp [C'] + exact mul_nonneg (mul_nonneg (div_nonneg (by positivity) hgain.le) + (Nat.cast_nonneg _)) (hC j) + have hbud := preparedFreezingRadiusBudget_of_inflated_chart + (fun j => Fintype.card (L.pad q j).Coord) (fun j => Fintype.card (I j)) C R + hLip hgain hgain1 (hearly C' hC' hinflation) hδbudget + have hbox : ∀ (u : integerBox sides) k, + |(u.val k : ℝ)| ≤ layerSamplerBox B U b S k := by + intro u k + have hu := (mem_integerBox sides u.val).mp u.property k + have h0 : (0 : ℝ) ≤ u.val k := by exact_mod_cast hu.1 + rw [abs_of_nonneg h0] + have hk : layerSamplerBox B U b S k = (sides k : ℝ) := by cases k <;> rfl + rw [hk] + exact_mod_cast hu.2.le + have hinside : ∀ u : integerBox sides, + integerAffineMap (fun x k => jointIntegerFrame (z.1.val,z.2.val) (some k) x) + (jointIntegerFrame (z.1.val,z.2.val) none) u.val ∈ (integerBox N : Set (X → ℤ)) := by + intro u + rw [integerAffineMap_jointIntegerFrame] + exact narrow_jointIntegerPhysicalSite_mem_box + (allocatedPhysicalRootBudget_nonneg B U b S (fun _ => 0)) hτ hτhalf hξ1 u.val + (allocatedParameterBox_root_bound B U b S u) N hN hsize z + apply F.exists_freeze_allocated_padded_recovered_sample L hmq B U b hb o S hR hσ ip hip c₀ err + hprepare hm hp hσ1 C hC hchart c z.1.val z.2.val sample read hread hδ hgain + (integerBox N) herr _ _ Subtype.val hbox hinside score hscoreBound hscore + · simpa only [mul_assoc] using hbud.1 + · simpa only [mul_assoc] using hbud.2 + +end Erdos3.PolynomialPatch.LowestLayerModel + +end + +section + +namespace Erdos3.PolynomialPatch.LowestLayerModel +open VectorPolynomial Module Submodule BooleanCubeKernel +open scoped BigOperators TensorProduct Classical + +variable {m q s D E : ℕ} {X G : Type} [Fintype X] [Fintype G] +variable (L : RankPreparationFamily X (Fin D) m) (hmq : m ≤ q) +variable {I Deck : Fin q → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (Deck j)] +variable {n : Fin q → ℕ} (B : LayerSamplerAxis I n → Type) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ ((L.pad q j).Coord → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin q → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +local notation "Vars" => LayerSamplerVariables G I n B + +local notation "sides" => Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) + +include hmq in +omit [∀ j, Fintype (Deck j)] in +theorem exists_freeze_allocated_padded_parameter_box_of_early_bounds + {A : PolynomialPatch X s (D + E)} (F : A.LowestLayerModel m) + (ip : Fin D → MvPolynomial X ℤ) (hip : ∀ i, (ip i).totalDegree ≤ m) + (c₀ : Fin D → ℝ) (err : VectorPolynomial X ℝ (Fin D → ℝ)) + (hprepare : VectorPolynomial.ofCoordinates (Pi.basisFun ℝ (Fin D)) F.normalizedOrigin = + L.polynomial + integerCoordinates ip + (1 ⊗ₜ[ℝ] c₀) + err) + (hm : ∀ j d, coefficients (L.pad q j).poly d ∈ U j) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (L.pad q j).poly) + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin q → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (c : ∀ j, U j) (N : X → ℕ) (hN : ∀ x, 0 < N x) + {τ ξ : ℝ} (hτ : 0 < τ) (hτhalf : τ ≤ 1 / 2) (hξ1 : ξ ≤ 1) + (hsize : ∀ x, 4 ≤ τ * (N x : ℝ)) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ N) 1) + (sample : CoefficientSamplerArrays (K := Vars) I n) + (read : AllocatedActualCoefficientIndex G X I Deck n B → ℤ) + (hread : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ + (fun j => (L.pad q j).poly) hm c z.1.val z.2.val sample read) + {δ gain : ℝ} (hδ : 0 ≤ δ) (hgain : 0 < gain) + (hgain1 : gain ≤ 1) + (herr : ∀ x ∈ integerBox N, ∀ i, |eval (fun z => (x z : ℝ)) err i| ≤ δ) + {p Pearly : ℝ} (hp0 : 0 ≤ p) + (hDlog : (D : ℝ) ≤ Real.exp p) (hqlog : (q : ℝ) ≤ Real.exp p) + (hLlog : (A.kernel.lip : ℝ) ≤ Real.exp p) + (hNlog : ∀ j, (Fintype.card (L.pad q j).Coord : ℝ) ≤ Real.exp p) + (hClog : ∀ j, C j ≤ Real.exp p) (hgainlog : Real.exp (-p) ≤ gain) + (hδearly : δ ≤ Real.exp (-(3 * p + 130))) + (hPearly : 6 * p + 35 ≤ Pearly) + (hearly : ∀ C' : Fin q → ℝ, (∀ j, 0 ≤ C' j) → + (∀ j, C' j ≤ Real.exp Pearly) → + ∀ j, C' j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (score : integerBox (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S)) → ℝ) (hscoreBound : ∀ u, |score u| ≤ 1) + (hscore : gain / 2 ≤ 𝔼 u, score u * A.value + (fun x => (integerAffineMap (fun x k => jointIntegerFrame (z.1.val,z.2.val) (some k) x) + (jointIntegerFrame (z.1.val,z.2.val) none) u.val x : ℝ))) : + ∃ A' : PolynomialPatch Vars s E, + A'.kernel.lip = A.kernel.lip ∧ + (∀ i, A'.weight i = A.weight (i.natAdd D)) ∧ + 7 * gain / 16 ≤ 𝔼 u, score u * A'.value (fun k => (u.val k : ℝ)) := by + have hδbudget := (preparedFreezingEarlyLogBudget (N := 0) (C := 0) + hp0 (NNReal.coe_nonneg A.kernel.lip) le_rfl hDlog hqlog hLlog + (by simpa only [Nat.cast_zero] using Real.exp_nonneg p) (Real.exp_nonneg p) hgainlog hδearly).2 + have hinflation : ∀ j, + (32 * ((D : ℝ) + 1) * ((A.kernel.lip : ℝ) + 1) * ((q : ℝ) + 1) / gain) * + (Fintype.card (L.pad q j).Coord : ℝ) * C j ≤ Real.exp Pearly := by + intro j + exact ((preparedFreezingEarlyLogBudget hp0 (NNReal.coe_nonneg A.kernel.lip) + (hC j) hDlog hqlog hLlog (hNlog j) (hClog j) hgainlog hδearly).1).trans + (Real.exp_le_exp.mpr hPearly) + exact F.exists_freeze_allocated_padded_parameter_box L hmq B U b hb o S hR hσ ip hip c₀ err + hprepare hm hp hσ1 C hC hchart c N hN hτ hτhalf hξ1 hsize z sample read hread + hδ hgain hgain1 herr hδbudget hearly hinflation score hscoreBound hscore + +end Erdos3.PolynomialPatch.LowestLayerModel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedParameterBoxEarlyFreeze.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedParameterBoxEarlyFreeze.lean new file mode 100644 index 0000000000000000000000000000000000000000..010cb9407de021457f1558fdeff67e76918ff3d9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedParameterBoxEarlyFreeze.lean @@ -0,0 +1,191 @@ +import OAI.Combinatorics.Progressions.Dynamics.PreparedFreezingEarlyLogBudget +import OAI.Combinatorics.Progressions.Geometry.CertifiedFullChartFrozenTerminal +import OAI.Combinatorics.Progressions.Lattices.LayerSamplerIntegerBox + +namespace OAI + +section + +namespace Erdos3.PolynomialPatch.LowestLayerModel +open VectorPolynomial Module Submodule BooleanCubeKernel +open scoped BigOperators TensorProduct Classical + +variable {m s D E : ℕ} {X G : Type} [Fintype X] [Fintype G] +variable (L : RankPreparationFamily X (Fin D) m) +variable {I Deck : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (Deck j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ ((L j).Coord → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +local notation "Vars" => LayerSamplerVariables G I n B + +local notation "sides" => Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) + +omit [∀ j, Fintype (Deck j)] in +theorem exists_freeze_allocated_parameter_box + {A : PolynomialPatch X s (D + E)} (F : A.LowestLayerModel m) + (ip : Fin D → MvPolynomial X ℤ) (hip : ∀ i, (ip i).totalDegree ≤ m) + (c₀ : Fin D → ℝ) (err : VectorPolynomial X ℝ (Fin D → ℝ)) + (hprepare : VectorPolynomial.ofCoordinates (Pi.basisFun ℝ (Fin D)) F.normalizedOrigin = + L.polynomial + integerCoordinates ip + (1 ⊗ₜ[ℝ] c₀) + err) + (hm : ∀ j d, coefficients (L j).poly d ∈ U j) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (L j).poly) + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (c : ∀ j, U j) (N : X → ℕ) (hN : ∀ x, 0 < N x) + {τ ξ : ℝ} (hτ : 0 < τ) (hτhalf : τ ≤ 1 / 2) (hξ1 : ξ ≤ 1) + (hsize : ∀ x, 4 ≤ τ * (N x : ℝ)) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ N) 1) + (sample : CoefficientSamplerArrays (K := Vars) I n) + (read : AllocatedActualCoefficientIndex G X I Deck n B → ℤ) + (hread : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ + (fun j => (L j).poly) hm c z.1.val z.2.val sample read) + {δ gain : ℝ} (hδ : 0 ≤ δ) (hgain : 0 < gain) + (hgain1 : gain ≤ 1) + (herr : ∀ x ∈ integerBox N, ∀ i, |eval (fun z => (x z : ℝ)) err i| ≤ δ) + (hδbudget : δ ≤ gain / (128 * ((D : ℝ) + 1) * (A.kernel.lip + 1))) + {Pearly : ℝ} + (hearly : ∀ C' : Fin m → ℝ, (∀ j, 0 ≤ C' j) → + (∀ j, C' j ≤ Real.exp Pearly) → + ∀ j, C' j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (hinflation : ∀ j, + (32 * ((D : ℝ) + 1) * (A.kernel.lip + 1) * ((m : ℝ) + 1) / gain) * + (Fintype.card (L j).Coord : ℝ) * C j ≤ Real.exp Pearly) + (score : integerBox (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S)) → ℝ) (hscoreBound : ∀ u, |score u| ≤ 1) + (hscore : gain / 2 ≤ 𝔼 u, score u * A.value + (fun x => (integerAffineMap (fun x k => jointIntegerFrame (z.1.val,z.2.val) (some k) x) + (jointIntegerFrame (z.1.val,z.2.val) none) u.val x : ℝ))) : + ∃ A' : PolynomialPatch Vars s E, + A'.kernel.lip = A.kernel.lip ∧ + (∀ i, A'.weight i = A.weight (i.natAdd D)) ∧ + 7 * gain / 16 ≤ 𝔼 u, score u * A'.value (fun k => (u.val k : ℝ)) := by + classical + have hLip : 0 ≤ (A.kernel.lip : ℝ) := NNReal.coe_nonneg _ + let C' : Fin m → ℝ := fun j => + (32 * ((D : ℝ) + 1) * (A.kernel.lip + 1) * ((m : ℝ) + 1) / gain) * + (Fintype.card (L j).Coord : ℝ) * C j + have hC' : ∀ j, 0 ≤ C' j := by + intro j + dsimp [C'] + exact mul_nonneg (mul_nonneg (div_nonneg (by positivity) hgain.le) + (Nat.cast_nonneg _)) (hC j) + have hbud := preparedFreezingRadiusBudget_of_inflated_chart + (fun j => Fintype.card (L j).Coord) (fun j => Fintype.card (I j)) C R + hLip hgain hgain1 (hearly C' hC' hinflation) hδbudget + have hbox : ∀ (u : integerBox sides) k, + |(u.val k : ℝ)| ≤ layerSamplerBox B U b S k := by + intro u k + have hu := (mem_integerBox sides u.val).mp u.property k + have h0 : (0 : ℝ) ≤ u.val k := by exact_mod_cast hu.1 + rw [abs_of_nonneg h0] + have hk : layerSamplerBox B U b S k = (sides k : ℝ) := by cases k <;> rfl + rw [hk] + exact_mod_cast hu.2.le + have hinside : ∀ u : integerBox sides, + integerAffineMap (fun x k => jointIntegerFrame (z.1.val,z.2.val) (some k) x) + (jointIntegerFrame (z.1.val,z.2.val) none) u.val ∈ (integerBox N : Set (X → ℤ)) := by + intro u + rw [integerAffineMap_jointIntegerFrame] + exact narrow_jointIntegerPhysicalSite_mem_box + (allocatedPhysicalRootBudget_nonneg B U b S (fun _ => 0)) hτ hτhalf hξ1 u.val + (allocatedParameterBox_root_bound B U b S u) N hN hsize z + apply F.exists_freeze_allocated_recovered_sample L B U b hb o S hR hσ ip hip c₀ err + hprepare hm hp hσ1 C hC hchart c z.1.val z.2.val sample read hread hδ hgain + (integerBox N) herr _ _ Subtype.val hbox hinside score hscoreBound hscore + · simpa only [mul_assoc] using hbud.1 + · simpa only [mul_assoc] using hbud.2 + +end Erdos3.PolynomialPatch.LowestLayerModel + +end + +section + +namespace Erdos3.PolynomialPatch.LowestLayerModel +open VectorPolynomial Module Submodule BooleanCubeKernel +open scoped BigOperators TensorProduct Classical + +variable {m s D E : ℕ} {X G : Type} [Fintype X] [Fintype G] +variable (L : RankPreparationFamily X (Fin D) m) +variable {I Deck : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (Deck j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ ((L j).Coord → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +local notation "Vars" => LayerSamplerVariables G I n B + +local notation "sides" => Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) + +omit [∀ j, Fintype (Deck j)] in +theorem exists_freeze_allocated_parameter_box_of_early_bounds + {A : PolynomialPatch X s (D + E)} (F : A.LowestLayerModel m) + (ip : Fin D → MvPolynomial X ℤ) (hip : ∀ i, (ip i).totalDegree ≤ m) + (c₀ : Fin D → ℝ) (err : VectorPolynomial X ℝ (Fin D → ℝ)) + (hprepare : VectorPolynomial.ofCoordinates (Pi.basisFun ℝ (Fin D)) F.normalizedOrigin = + L.polynomial + integerCoordinates ip + (1 ⊗ₜ[ℝ] c₀) + err) + (hm : ∀ j d, coefficients (L j).poly d ∈ U j) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (L j).poly) + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (c : ∀ j, U j) (N : X → ℕ) (hN : ∀ x, 0 < N x) + {τ ξ : ℝ} (hτ : 0 < τ) (hτhalf : τ ≤ 1 / 2) (hξ1 : ξ ≤ 1) + (hsize : ∀ x, 4 ≤ τ * (N x : ℝ)) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ N) 1) + (sample : CoefficientSamplerArrays (K := Vars) I n) + (read : AllocatedActualCoefficientIndex G X I Deck n B → ℤ) + (hread : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ + (fun j => (L j).poly) hm c z.1.val z.2.val sample read) + {δ gain : ℝ} (hδ : 0 ≤ δ) (hgain : 0 < gain) + (hgain1 : gain ≤ 1) + (herr : ∀ x ∈ integerBox N, ∀ i, |eval (fun z => (x z : ℝ)) err i| ≤ δ) + {p Pearly : ℝ} (hp0 : 0 ≤ p) + (hDlog : (D : ℝ) ≤ Real.exp p) (hmlog : (m : ℝ) ≤ Real.exp p) + (hLlog : (A.kernel.lip : ℝ) ≤ Real.exp p) + (hNlog : ∀ j, (Fintype.card (L j).Coord : ℝ) ≤ Real.exp p) + (hClog : ∀ j, C j ≤ Real.exp p) (hgainlog : Real.exp (-p) ≤ gain) + (hδearly : δ ≤ Real.exp (-(3 * p + 130))) + (hPearly : 6 * p + 35 ≤ Pearly) + (hearly : ∀ C' : Fin m → ℝ, (∀ j, 0 ≤ C' j) → + (∀ j, C' j ≤ Real.exp Pearly) → + ∀ j, C' j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + (score : integerBox (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S)) → ℝ) (hscoreBound : ∀ u, |score u| ≤ 1) + (hscore : gain / 2 ≤ 𝔼 u, score u * A.value + (fun x => (integerAffineMap (fun x k => jointIntegerFrame (z.1.val,z.2.val) (some k) x) + (jointIntegerFrame (z.1.val,z.2.val) none) u.val x : ℝ))) : + ∃ A' : PolynomialPatch Vars s E, + A'.kernel.lip = A.kernel.lip ∧ + (∀ i, A'.weight i = A.weight (i.natAdd D)) ∧ + 7 * gain / 16 ≤ 𝔼 u, score u * A'.value (fun k => (u.val k : ℝ)) := by + have hδbudget := (preparedFreezingEarlyLogBudget (N := 0) (C := 0) + hp0 (NNReal.coe_nonneg A.kernel.lip) le_rfl hDlog hmlog hLlog + (by simpa only [Nat.cast_zero] using Real.exp_nonneg p) (Real.exp_nonneg p) hgainlog hδearly).2 + have hinflation : ∀ j, + (32 * ((D : ℝ) + 1) * ((A.kernel.lip : ℝ) + 1) * ((m : ℝ) + 1) / gain) * + (Fintype.card (L j).Coord : ℝ) * C j ≤ Real.exp Pearly := by + intro j + exact ((preparedFreezingEarlyLogBudget hp0 (NNReal.coe_nonneg A.kernel.lip) + (hC j) hDlog hmlog hLlog (hNlog j) (hClog j) hgainlog hδearly).1).trans + (Real.exp_le_exp.mpr hPearly) + exact F.exists_freeze_allocated_parameter_box L B U b hb o S hR hσ ip hip c₀ err + hprepare hm hp hσ1 C hC hchart c N hN hτ hτhalf hξ1 hsize z sample read hread + hδ hgain hgain1 herr hδbudget hearly hinflation score hscoreBound hscore + +end Erdos3.PolynomialPatch.LowestLayerModel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPhysicalChartBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPhysicalChartBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..91eb49d0439f732cd46c2efddacdfef098811e9a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPhysicalChartBounds.lean @@ -0,0 +1,100 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedTrimmedVectorSite + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +noncomputable def allocatedPhysicalRootAllowance (c : LayerSamplerVariables G I n B → ℤ) : ℝ := + 1 + ∑ k, |(c k : ℝ)| / layerSamplerBox B U b S k + +theorem allocatedPhysicalRootAllowance_one_le (c : LayerSamplerVariables G I n B → ℤ) : + 1 ≤ allocatedPhysicalRootAllowance B U b S c := by + apply le_add_of_nonneg_right + exact Finset.sum_nonneg (fun k _ => div_nonneg (abs_nonneg _) (zero_le_one.trans (layerSamplerBox_one_le B U b S k))) + +theorem allocatedPhysicalRootAllowance_zero : + allocatedPhysicalRootAllowance B U b S (fun _ => 0) = 1 := by + simp [allocatedPhysicalRootAllowance] + +theorem allocatedPhysicalRootAllowance_le (c : LayerSamplerVariables G I n B → ℤ) : + allocatedPhysicalRootAllowance B U b S c ≤ 1 + ∑ k, |(c k : ℝ)| := by + unfold allocatedPhysicalRootAllowance + apply add_le_add le_rfl + apply Finset.sum_le_sum + intro k _ + exact div_le_self (abs_nonneg _) (layerSamplerBox_one_le B U b S k) + +theorem allocatedPhysicalRootAllowance_le_box (c : LayerSamplerVariables G I n B → ℤ) + (hc : ∀ k, |(c k : ℝ)| ≤ layerSamplerBox B U b S k) : + allocatedPhysicalRootAllowance B U b S c ≤ + 1 + Fintype.card (LayerSamplerVariables G I n B) := by + unfold allocatedPhysicalRootAllowance + apply add_le_add le_rfl + calc + _ ≤ ∑ _k : LayerSamplerVariables G I n B, (1 : ℝ) := by + apply Finset.sum_le_sum + intro k _ + exact (div_le_one (lt_of_lt_of_le zero_lt_one (layerSamplerBox_one_le B U b S k))).mpr (hc k) + _ = _ := by simp + +variable {α : Type*} (x : G → IntegerScalarCubeBox α S.value) +variable (y : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U b S)) + +theorem allocatedPhysicalCube_tuple_coordinate_bound (a : Option α) (k : LayerSamplerVariables G I n B) : + |((Sum.elim (fun g => (x g a : ℤ)) (fun j => (y j a : ℤ)) k : ℤ) : ℝ)| ≤ layerSamplerBox B U b S k := by + cases k with + | inl g => + have hx := Finset.mem_Ico.mp (x g a).property + change |((x g a : ℤ) : ℝ)| ≤ (S.value : ℝ) + exact_mod_cast abs_le.mpr ⟨hx.1, hx.2.le⟩ + | inr j => + have hy := Finset.mem_Ico.mp (y j a).property + change |((y j a : ℤ) : ℝ)| ≤ (allocatedPrincipalSides B U b S j : ℝ) + exact_mod_cast abs_le.mpr ⟨hy.1, hy.2.le⟩ + +theorem allocatedPhysicalCube_directions_normalized (i : α) (k : LayerSamplerVariables G I n B) : + |(allocatedPhysicalCubeDirections B U b S x y i k : ℝ) / layerSamplerBox B U b S k| ≤ 1 := by + have hT : 0 < layerSamplerBox B U b S k := lt_of_lt_of_le zero_lt_one (layerSamplerBox_one_le B U b S k) + rw [abs_div, abs_of_pos hT, div_le_one hT] + exact allocatedPhysicalCube_tuple_coordinate_bound B U b S x y (some i) k + +theorem allocatedPhysicalCube_root_normalized (c : LayerSamplerVariables G I n B → ℤ) + (k : LayerSamplerVariables G I n B) : + |(allocatedPhysicalCubeRoot B U b S c x y k : ℝ) / layerSamplerBox B U b S k| ≤ + allocatedPhysicalRootAllowance B U b S c := by + have hT : 0 < layerSamplerBox B U b S k := lt_of_lt_of_le zero_lt_one (layerSamplerBox_one_le B U b S k) + have hsum : |(c k : ℝ)| / layerSamplerBox B U b S k ≤ + ∑ k, |(c k : ℝ)| / layerSamplerBox B U b S k := + Finset.single_le_sum (fun v _ => div_nonneg (abs_nonneg (c v : ℝ)) + (zero_le_one.trans (layerSamplerBox_one_le B U b S v))) (Finset.mem_univ k) + have hx := allocatedPhysicalCube_tuple_coordinate_bound B U b S x y none k + rw [abs_div, abs_of_pos hT] + have hr : |(allocatedPhysicalCubeRoot B U b S c x y k : ℝ)| ≤ + |(c k : ℝ)| + layerSamplerBox B U b S k := by + unfold allocatedPhysicalCubeRoot + rw [Int.cast_add] + exact (abs_add_le _ _).trans (add_le_add le_rfl hx) + calc + _ ≤ (|(c k : ℝ)| + layerSamplerBox B U b S k) / layerSamplerBox B U b S k := + div_le_div_of_nonneg_right hr hT.le + _ = |(c k : ℝ)| / layerSamplerBox B U b S k + 1 := by rw [add_div, div_self hT.ne'] + _ ≤ allocatedPhysicalRootAllowance B U b S c := by + dsimp [allocatedPhysicalRootAllowance] + linarith + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPhysicalLongBoxVolume.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPhysicalLongBoxVolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..1129d54d62eab9b8aa803d2937111e3b825431d3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPhysicalLongBoxVolume.lean @@ -0,0 +1,188 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedActualProfileControl + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical ENNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (O : Fin m → Type*) [∀ j, Fintype (O j)] + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "reference" => allocatedLongJetReference B U b S O +local notation "output" => (Σ a : {a // ¬grid a}, O (Sigma.fst (Subtype.val a))) + +noncomputable def allocatedPhysicalLongJetRowBox (T : ℝ) : + ∀ a : {a // ¬grid a}, Set (CoefficientJetAxisRow O a.val) + | ⟨⟨j, .inl _⟩, _⟩ => (Metric.closedBall (0 : O j → ℝ) (T * R j) : Set (O j → ℝ)) + | ⟨⟨j, .inr i⟩, _⟩ => + (rectangularWeightIndices (fun _ => 0) + (fun _ : O j => R j * (basisAxisScale (b j) i : ℝ)) T : Set (O j → ℤ)) + +noncomputable def allocatedPhysicalLongJetBox (T : ℝ) : Set (AllocatedLongJetRows B U b S O) := + Set.univ.pi (allocatedPhysicalLongJetRowBox B U b S O T) + +theorem allocatedPhysicalLongJetRowBox_measurable (T : ℝ) (a : {a // ¬grid a}) : + MeasurableSet (allocatedPhysicalLongJetRowBox B U b S O T a) := by + rcases a with ⟨⟨j, i | i⟩, ha⟩ + · change MeasurableSet (Metric.closedBall (0 : O j → ℝ) (T * R j)) + exact measurableSet_closedBall + · change MeasurableSet (↑(rectangularWeightIndices (fun _ => 0) + (fun _ : O j => R j * (basisAxisScale (b j) i : ℝ)) T) : Set (O j → ℤ)) + exact Finset.measurableSet _ + +theorem allocatedPhysicalLongJetBox_measurable (T : ℝ) : + MeasurableSet (allocatedPhysicalLongJetBox B U b S O T) := + MeasurableSet.univ_pi (allocatedPhysicalLongJetRowBox_measurable B U b S O T) + +theorem allocatedPhysicalLongJetRowBox_measure_lt_top (T : ℝ) (a : {a // ¬grid a}) : + coefficientJetAxisReference O a.val (allocatedPhysicalLongJetRowBox B U b S O T a) < ∞ := by + rcases a with ⟨⟨j, i | i⟩, ha⟩ + · change MeasureTheory.volume (Metric.closedBall (0 : O j → ℝ) (T * R j)) < ∞ + exact (isCompact_closedBall (0 : O j → ℝ) (T * R j)).measure_lt_top + · change Measure.count (↑(rectangularWeightIndices (fun _ => 0) + (fun _ : O j => R j * (basisAxisScale (b j) i : ℝ)) T) : Set (O j → ℤ)) < ∞ + rw [Measure.count_apply_finset] + simp + +theorem allocatedPhysicalLongJetBox_measure_lt_top (T : ℝ) : + reference (allocatedPhysicalLongJetBox B U b S O T) < ∞ := by + unfold allocatedLongJetReference allocatedPhysicalLongJetBox + rw [Measure.pi_pi] + exact ENNReal.prod_lt_top (fun a _ => allocatedPhysicalLongJetRowBox_measure_lt_top B U b S O T a) + +theorem allocatedPhysicalLongJetBox_of_normalizedCoordinates + (hR : ∀ j, 0 < R j) {T : ℝ} (hT : 0 ≤ T) + (z : AllocatedLongJetRows B U b S O) + (hz : ‖fun q : output => allocatedLongJetRealCoordinates B U b S z q / R q.1.val.1‖ ≤ T) : + z ∈ allocatedPhysicalLongJetBox B U b S O T := by + apply Set.mem_univ_pi.mpr + intro a + rcases a with ⟨⟨j, i | i⟩, ha⟩ + · change ‖(fun o : O j => z ⟨⟨j, .inl i⟩, ha⟩ o) - 0‖ ≤ T * R j + rw [sub_zero] + apply (pi_norm_le_iff_of_nonneg (mul_nonneg hT (hR j).le)).mpr + intro o + have ho : |z ⟨⟨j, .inl i⟩, ha⟩ o / R j| ≤ T := + (norm_le_pi_norm (fun q : output => allocatedLongJetRealCoordinates B U b S z q / R q.1.val.1) + ⟨⟨⟨j, .inl i⟩, ha⟩, o⟩).trans hz + rw [abs_div, abs_of_pos (hR j)] at ho + exact (div_le_iff₀ (hR j)).mp ho + · change z ⟨⟨j, .inr i⟩, ha⟩ ∈ rectangularWeightIndices (fun _ => 0) + (fun _ : O j => R j * (basisAxisScale (b j) i : ℝ)) T + apply Fintype.mem_piFinset.mpr + intro o + have ho : |((z ⟨⟨j, .inr i⟩, ha⟩ o : ℝ) / (basisAxisScale (b j) i : ℝ)) / R j| ≤ T := + (norm_le_pi_norm (fun q : output => allocatedLongJetRealCoordinates B U b S z q / R q.1.val.1) + ⟨⟨⟨j, .inr i⟩, ha⟩, o⟩).trans hz + rw [div_div] at ho + have hh : (0 : ℝ) < basisAxisScale (b j) i := Nat.cast_pos.mpr (basisAxisScale_pos (b j) i) + obtain ⟨hlo, hhi⟩ := abs_le.mp ho + have hlo' := (le_div_iff₀ (mul_pos hh (hR j))).mp hlo + have hhi' := (div_le_iff₀ (mul_pos hh (hR j))).mp hhi + apply Finset.mem_Icc.mpr + exact ⟨Int.ceil_le.mpr (by nlinarith), Int.le_floor.mpr (by nlinarith)⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical ENNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (O : Fin m → Type*) [∀ j, Fintype (O j)] + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "reference" => allocatedLongJetReference B U b S O +local notation "output" => (Σ a : {a // ¬grid a}, O (Sigma.fst (Subtype.val a))) + +theorem allocatedActiveIntegerPhysicalScale_one_le + (hR : ∀ j, 0 < R j) (hσ1 : ∀ j, σ j ≤ 1) + (j : Fin m) (i : Fin (n j)) (ha : ¬grid ⟨j, .inr i⟩) : + 1 ≤ R j * (basisAxisScale (b j) i : ℝ) := by + have h := allocatedEnormous_constant_width B U b hR S j i (hσ1 j) (Nat.lt_of_not_ge ha) + have hp : (1 : ℝ) ≤ probabilityProfileLipschitz := probabilityProfileLipschitz_one_le + nlinarith + +theorem allocatedPhysicalLongJetRowBox_measure_bound + (hR : ∀ j, 0 < R j) (hσ1 : ∀ j, σ j ≤ 1) + {T : ℝ} (hT : 0 ≤ T) (a : {a // ¬grid a}) : + (coefficientJetAxisReference O a.val).real (allocatedPhysicalLongJetRowBox B U b S O T a) ≤ + (2 * T + 1) ^ Fintype.card (O a.val.1) * (R a.val.1) ^ Fintype.card (O a.val.1) * + allocatedLongJetOutputScale B U b S (O := O) a := by + rcases a with ⟨⟨j, i | i⟩, ha⟩ + · have hRj : 0 < R j := hR j + change MeasureTheory.volume.real (Metric.closedBall (0 : O j → ℝ) (T * R j)) ≤ + (2 * T + 1) ^ Fintype.card (O j) * (R j) ^ Fintype.card (O j) * 1 + rw [mul_one, measureReal_def, Real.volume_pi_closedBall 0 (mul_nonneg hT (hR j).le), + ENNReal.toReal_ofReal (by positivity), ← mul_pow] + exact pow_le_pow_left₀ (by positivity) (by nlinarith [hR j]) _ + · change (Measure.count : Measure (O j → ℤ)).real + (↑(rectangularWeightIndices (fun _ => 0) + (fun _ : O j => R j * (basisAxisScale (b j) i : ℝ)) T) : Set (O j → ℤ)) ≤ + (2 * T + 1) ^ Fintype.card (O j) * (R j) ^ Fintype.card (O j) * + (basisAxisScale (b j) i : ℝ) ^ Fintype.card (O j) + rw [measureReal_def, Measure.count_apply_finset, ENNReal.toReal_natCast] + have hscale := allocatedActiveIntegerPhysicalScale_one_le B U b S hR hσ1 j i ha + simpa only [Finset.prod_const, Finset.card_univ, mul_pow, mul_assoc] using + rectangularWeightIndices_card_le (fun _ : O j => 0) + (fun _ => R j * (basisAxisScale (b j) i : ℝ)) (fun _ => hscale) hT + +theorem allocatedPhysicalLongJetBox_measure_bound + (hR : ∀ j, 0 < R j) (hσ1 : ∀ j, σ j ≤ 1) {T : ℝ} (hT : 0 ≤ T) : + (reference).real (allocatedPhysicalLongJetBox B U b S O T) ≤ + (2 * T + 1) ^ Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) * + (∏ q : output, R q.1.val.1) * + ∏ a, allocatedLongJetOutputScale B U b S (O := O) a := by + have hc : Fintype.card output ≤ Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) := by + apply Fintype.card_le_of_injective + (fun q : output => (⟨q.1.val, q.2⟩ : Σ a : LayerSamplerAxis I n, O a.1)) + rintro ⟨⟨a, ha⟩, x⟩ ⟨⟨b, hb⟩, y⟩ h + cases h + rfl + have hs : (∑ a : {a // ¬grid a}, Fintype.card (O a.val.1)) ≤ + Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) := by + simpa only [Fintype.card_sigma] using hc + have hprod : (∏ a : {a // ¬grid a}, (R a.val.1) ^ Fintype.card (O a.val.1)) = + ∏ q : output, R q.1.val.1 := by + rw [Fintype.prod_sigma] + simp only [Finset.prod_const, Finset.card_univ] + calc + _ = ∏ a : {a // ¬grid a}, + (coefficientJetAxisReference O a.val).real (allocatedPhysicalLongJetRowBox B U b S O T a) := by + simp only [measureReal_def, allocatedLongJetReference, allocatedPhysicalLongJetBox, + Measure.pi_pi, ENNReal.toReal_prod] + _ ≤ ∏ a : {a // ¬grid a}, ((2 * T + 1) ^ Fintype.card (O a.val.1) * + (R a.val.1) ^ Fintype.card (O a.val.1) * allocatedLongJetOutputScale B U b S (O := O) a) := + Finset.prod_le_prod₀ (fun _ _ => ENNReal.toReal_nonneg) + (fun a _ => allocatedPhysicalLongJetRowBox_measure_bound B U b S O hR hσ1 hT a) + _ = (2 * T + 1) ^ (∑ a : {a // ¬grid a}, Fintype.card (O a.val.1)) * + (∏ q : output, R q.1.val.1) * ∏ a, allocatedLongJetOutputScale B U b S (O := O) a := by + rw [Finset.prod_mul_distrib, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum, hprod] + _ ≤ _ := mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by linarith) hs) + (Finset.prod_nonneg (fun q _ => (hR q.1.val.1).le))) + (Finset.prod_nonneg (fun a _ => (allocatedLongJetOutputScale_pos B U b S a).le)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPositiveSpatialComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPositiveSpatialComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d4d202530a4be21324617310360d6cd1f24aa9a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPositiveSpatialComparison.lean @@ -0,0 +1,543 @@ +import OAI.Combinatorics.Progressions.Lattices.CoveredResidueDensityComparison +import OAI.Combinatorics.Progressions.Linear.AllocatedFixedDensityProjection +import OAI.Combinatorics.Progressions.Linear.AllocatedSpatialProjectionBudget +import OAI.Combinatorics.Progressions.Linear.PositivePhysicalProjectionError +import OAI.Combinatorics.Progressions.Probability.PhysicalDensityNormalization + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) +variable [∀ a, Fintype (B a)] [DecidableEq (LayerSamplerVariables G I n B)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox α S.value) +variable (y : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U basis S)) +variable (selection : α ↪ G) +variable {X : Type*} (W τ : ℝ) (N q : X → ℕ) (d : X) +variable (r : ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q) + +local notation "vars" => LayerSamplerVariables G I n B +local notation "root" => allocatedPhysicalCubeRoot B U basis S c x y +local notation "dirs" => allocatedPhysicalCubeDirections B U basis S x y +local notation "sel" => selection.trans (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B) +local notation "A₀" => trimmedSpatialRootScale τ N q d +local notation "R₀" => trimmedSpatialSlopeScale W τ N q d +local notation "inp" => physicalSpatialInputScale (LayerSamplerVariables G I n B) A₀ R₀ +local notation "out" => physicalSpatialOutputScale α A₀ R₀ (LayerSamplerScale.value S) +local notation "center" => (fun k : Option (LayerSamplerVariables G I n B) => + residueProfileCenter (boundedColumnResidueRepresentative q r) q (k, d)) +local notation "C₀" => allocatedPhysicalEntryBudget B U basis S c + +theorem allocatedTrimmedSpatial_comparison {κ ρ : ℝ} {M : ℕ} + (hκ : 0 < κ) (hx : GoodScalarKernelTuple selection κ M x) + (hW : 0 ≤ W) (hτ : 0 < τ) (hN : 0 < N d) (hq : ∀ e, 0 < q e) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) (hρ : 1 ≤ ρ) + (hsize : 8 * (1 + W) * (q d : ℝ) * ρ ≤ τ * (N d : ℝ)) + (hmesh : physicalSpatialMeshCost sel C₀ 2 (affineProductProfileLip (Option vars) 1) ≤ ρ) : + ∃ (hi : ∀ k, 0 < inp k) (ho : ∀ i, 0 < out i) + (hp : ((physicalCubeCoefficient root dirs).submatrix id (physicalCubePivotIndex sel)).det ≠ 0) + (hZ : 0 < shiftedSmoothProductMass center inp), + ∀ v, |(∏ i, out i) * + (((shiftedSmoothProductPMF center inp hi hZ).map + (fun z => physicalCubeCoefficient root dirs *ᵥ z)) v).toReal - + coefficientImageMask (physicalCubeCoefficient root dirs) out + (Erdos3.selectedCoefficientDensity (physicalCubeCoefficient root dirs) (physicalCubePivotIndex sel) + hp inp out hi ho (shiftedUnitProfile center inp)) v| ≤ + physicalSpatialErrorConstant sel M κ C₀ 2 1 (affineProductProfileLip (Option vars) 1) / ρ := by + have hpos := trimmedSpatial_scales_pos hW hτ N q d hN (hq d) + have hρ0 : 0 < ρ := zero_lt_one.trans_le hρ + have hlow := trimmedSpatial_scale_lower hW hρ0.le N q d (hq d) hsize + have hL : (0 : ℝ) < S.value := Nat.cast_pos.mpr S.positive + have hr : ∀ k, |(root k : ℝ)| * R₀ ≤ A₀ := fun k => + trimmedSpatial_root_control hW hτ N q d hN (hq d) root + ((allocatedPhysicalCube_root_sum B U basis S c x y).trans hbudget) k + have hd := allocatedPhysicalCube_directions_bound B U basis S x y + have hkernel := allocatedPhysicalCube_good_kernel B U basis S x y selection hx + have hcenter : ∀ k, |center k| ≤ inp k := by + intro k + have hb := boundedColumnResidueRepresentative_bounds q hq r (k, d) + have hq0 : (0 : ℝ) < q d := by exact_mod_cast hq d + have hb0 : (0 : ℝ) ≤ boundedColumnResidueRepresentative q r (k, d) := by exact_mod_cast hb.1 + have ha : |center k| ≤ 1 := by + change |-(boundedColumnResidueRepresentative q r (k, d) : ℝ) / (q d : ℝ)| ≤ 1 + rw [abs_div, abs_neg, abs_of_pos hq0, abs_of_nonneg hb0] + apply (div_le_one hq0).mpr + exact_mod_cast hb.2.le + apply ha.trans (hρ.trans ?_) + cases k + · exact hlow.1 + · exact hlow.2 + have hctrl := physicalCube_pivot_control root dirs sel hpos.1 hpos.2 hL hκ hr hd hkernel.1 + obtain ⟨hZ, he⟩ := physicalCube_shifted_comparison root dirs sel hpos.1 hpos.2 hL hκ hρ0 + (allocatedPhysicalEntryBudget_one_le B U basis S c) hlow.1 hlow.2 hr hd + (allocatedPhysicalCube_root_entry_bound B U basis S c x y) + (allocatedPhysicalCube_direction_entry_bound B U basis S c x y) hkernel.1 hkernel.2 center hcenter hmesh + exact ⟨physicalSpatialInputScale_pos vars hpos.1 hpos.2, + physicalSpatialOutputScale_pos α hpos.1 hpos.2 hL, hctrl.1, hZ, he⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) +variable [∀ a, Fintype (B a)] [DecidableEq (LayerSamplerVariables G I n B)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox α S.value) +variable (y : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U basis S)) +variable (selection : α ↪ G) +variable {X : Type*} (W τ : ℝ) (N q : X → ℕ) (d : X) +variable (r : ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q) + +local notation "vars" => LayerSamplerVariables G I n B +local notation "root" => allocatedPhysicalCubeRoot B U basis S c x y +local notation "dirs" => allocatedPhysicalCubeDirections B U basis S x y +local notation "sel" => selection.trans (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B) +local notation "inp" => physicalSpatialInputScale (LayerSamplerVariables G I n B) + (trimmedSpatialRootScale τ N q d) (trimmedSpatialSlopeScale W τ N q d) +local notation "out" => physicalSpatialOutputScale α + (trimmedSpatialRootScale τ N q d) (trimmedSpatialSlopeScale W τ N q d) (LayerSamplerScale.value S) +local notation "center" => (fun k : Option (LayerSamplerVariables G I n B) => + residueProfileCenter (boundedColumnResidueRepresentative q r) q (k, d)) +local notation "C₀" => allocatedPhysicalEntryBudget B U basis S c + +omit [DecidableEq G] [DecidableEq (LayerSamplerVariables G I n B)] in +theorem allocatedPhysicalEntryBudget_le_exp {b : ℝ} (hb : 0 ≤ b) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (hW : W ≤ Real.exp b) (hL : (S.value : ℝ) ≤ Real.exp b) : + C₀ ≤ Real.exp (b + 2) := by + have hthree : (3 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + calc + _ ≤ 3 * Real.exp b := by + unfold allocatedPhysicalEntryBudget + linarith [Real.one_le_exp hb] + _ ≤ Real.exp b * Real.exp 2 := by nlinarith [Real.exp_nonneg b] + _ = _ := (Real.exp_add _ _).symm + +theorem allocatedTrimmedSpatial_tolerance {κ ε b : ℝ} {M : ℕ} + (hb : 0 ≤ b) (hκ : 0 < κ) (hε : 0 < ε) (hx : GoodScalarKernelTuple selection κ M x) + (hW : 0 ≤ W) (hτ : 0 < τ) (hq : ∀ e, 0 < q e) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (hWexp : W ≤ Real.exp b) (hLexp : (S.value : ℝ) ≤ Real.exp b) + (hMexp : (M : ℝ) ≤ Real.exp b) (hκexp : κ⁻¹ ≤ Real.exp b) + (hqexp : (q d : ℝ) ≤ Real.exp b) (hτexp : τ⁻¹ ≤ Real.exp b) (hεexp : ε⁻¹ ≤ Real.exp b) + (hsize : Real.exp (physicalSpatialLogAllowance sel (b + 2) + 4 * b + 12) ≤ (N d : ℝ)) : + ∃ (hi : ∀ k, 0 < inp k) (ho : ∀ i, 0 < out i) + (hp : ((physicalCubeCoefficient root dirs).submatrix id (physicalCubePivotIndex sel)).det ≠ 0) + (hZ : 0 < shiftedSmoothProductMass center inp), + ∀ v, |(∏ i, out i) * + (((shiftedSmoothProductPMF center inp hi hZ).map + (fun z => physicalCubeCoefficient root dirs *ᵥ z)) v).toReal - + coefficientImageMask (physicalCubeCoefficient root dirs) out + (Erdos3.selectedCoefficientDensity (physicalCubeCoefficient root dirs) (physicalCubePivotIndex sel) + hp inp out hi ho (shiftedUnitProfile center inp)) v| ≤ ε := by + let E := physicalSpatialLogAllowance sel (b + 2) + let ρ := Real.exp (E + b + 2) + have hb' : 0 ≤ b + 2 := by linarith + have hbb : Real.exp b ≤ Real.exp (b + 2) := Real.exp_le_exp.mpr (by linarith) + have hC := allocatedPhysicalEntryBudget_le_exp B U basis S c W hb hbudget hWexp hLexp + have hconstants := physicalSpatial_constants_le_exp sel hb' hκ + (zero_le_one.trans (allocatedPhysicalEntryBudget_one_le B U basis S c)) + (hMexp.trans hbb) (hκexp.trans hbb) hC + have hnumerics := physicalSpatial_tolerance_numerics hb + (physicalSpatialLogAllowance_nonneg sel hb') hW (Nat.cast_nonneg (q d)) + hτ hWexp hqexp hτexp hεexp hsize + have hρ : 0 < ρ := Real.exp_pos _ + have htolerance := enormousCoefficient_tolerance_arithmetic (Real.exp_nonneg E) hρ hε hnumerics.2.1 + have hN : 0 < N d := by + exact_mod_cast (Real.exp_pos (E + 4 * b + 12)).trans_le hsize + obtain ⟨hi, ho, hp, hZ, he⟩ := allocatedTrimmedSpatial_comparison B U basis S c x y selection + W τ N q d r hκ hx hW hτ hN hq hbudget hnumerics.1 hnumerics.2.2 + (hconstants.1.trans htolerance.1) + refine ⟨hi, ho, hp, hZ, fun v => (he v).trans ?_⟩ + exact (div_le_div_of_nonneg_right hconstants.2 hρ.le).trans htolerance.2 + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) +variable [∀ a, Fintype (B a)] [DecidableEq (LayerSamplerVariables G I n B)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox α S.value) +variable (y : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U basis S)) +variable (selection : α ↪ G) +variable {X : Type*} [Fintype X] (W τ : ℝ) (N q : X → ℕ) + +local notation "vars" => LayerSamplerVariables G I n B +local notation "root" => allocatedPhysicalCubeRoot B U basis S c x y +local notation "dirs" => allocatedPhysicalCubeDirections B U basis S x y +local notation "sel" => selection.trans (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B) +local notation "V" => trimmedSpatialWidths (K := vars) W τ N +local notation "width" => residueProfileWidth q V +local notation "out" => (fun d => physicalSpatialOutputScale α + (trimmedSpatialRootScale τ N q d) (trimmedSpatialSlopeScale W τ N q d) (LayerSamplerScale.value S)) +local notation "center" => (fun r => residueProfileCenter (boundedColumnResidueRepresentative q r) q) +local notation "mat" => physicalCubeCoefficient root dirs +local notation "pivot" => physicalCubePivotIndex sel + +theorem allocatedTrimmedSpatial_product_data {κ ε b : ℝ} {M : ℕ} + (hb : 0 ≤ b) (hκ : 0 < κ) (hε : 0 < ε) (hx : GoodScalarKernelTuple selection κ M x) + (hW : 0 ≤ W) (hτ : 0 < τ) (hq : ∀ d, 0 < q d) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (hWexp : W ≤ Real.exp b) (hLexp : (S.value : ℝ) ≤ Real.exp b) + (hMexp : (M : ℝ) ≤ Real.exp b) (hκexp : κ⁻¹ ≤ Real.exp b) + (hqexp : ∀ d, (q d : ℝ) ≤ Real.exp b) (hτexp : τ⁻¹ ≤ Real.exp b) (hεexp : ε⁻¹ ≤ Real.exp b) + (hsize : ∀ d, Real.exp (physicalSpatialLogAllowance sel (b + 2) + 4 * b + 12) ≤ (N d : ℝ)) : + ∃ (hV : ∀ z, 0 < V z) (hP : ∀ d i, 0 < out d i) (hp : ((mat).submatrix id pivot).det ≠ 0), + (∀ d i, 1 ≤ out d i) ∧ + (∀ r z, |center r z| ≤ width z) ∧ + (∀ d i k, |normalizedIntegerColumns mat (fun k => width (k, d)) (out d) i k| ≤ 1) ∧ + ∀ r, ∃ hc : 0 < shiftedSmoothProductMass (center r) width, + ∀ d v, |(∏ i, out d i) * + (((shiftedSmoothProductPMF (fun k => center r (k, d)) (fun k => width (k, d)) + (fun k => residueProfileWidth_pos q V hq hV (k, d)) + (shiftedSmoothProductMass_slice_pos (center r) width + (residueProfileWidth_pos q V hq hV) hc d)).map (fun z => mat *ᵥ z)) v).toReal - + coefficientImageMask mat (out d) + (Erdos3.selectedCoefficientDensity mat pivot hp (fun k => width (k, d)) (out d) + (fun k => residueProfileWidth_pos q V hq hV (k, d)) (hP d) + (shiftedUnitProfile (fun k => center r (k, d)) (fun k => width (k, d)))) v| ≤ ε := by + have hN (d) : 0 < N d := by + exact_mod_cast (Real.exp_pos _).trans_le (hsize d) + have hV := trimmedSpatialWidths_pos (K := vars) hW hτ N hN + have hscales (d) := trimmedSpatial_scales_pos hW hτ N q d (hN d) (hq d) + have hL : (0 : ℝ) < S.value := Nat.cast_pos.mpr S.positive + have hL1 : (1 : ℝ) ≤ S.value := by exact_mod_cast S.positive + have hP (d) := physicalSpatialOutputScale_pos α (hscales d).1 (hscales d).2 hL + have hroot (k) : |(root k : ℝ)| * 1 ≤ 1 + W := by + have h := (allocatedPhysicalCube_root_budget B U basis S c x y k).trans hbudget + linarith + have hp := (physicalCube_pivot_control root dirs sel (by linarith : 0 < 1 + W) zero_lt_one hL hκ + hroot (allocatedPhysicalCube_directions_bound B U basis S x y) + (allocatedPhysicalCube_good_kernel B U basis S x y selection hx).1).1 + have hlower (d) : 1 ≤ trimmedSpatialRootScale τ N q d ∧ 1 ≤ trimmedSpatialSlopeScale W τ N q d := by + have hn := physicalSpatial_tolerance_numerics hb + (physicalSpatialLogAllowance_nonneg sel (by linarith : 0 ≤ b + 2)) hW (Nat.cast_nonneg (q d)) + hτ hWexp (hqexp d) hτexp hεexp (hsize d) + have hl := trimmedSpatial_scale_lower hW (zero_le_one.trans hn.1) N q d (hq d) hn.2.2 + exact ⟨hn.1.trans hl.1, hn.1.trans hl.2⟩ + have hw1 (z : Option vars × X) : 1 ≤ width z := by + have he := congrFun (trimmedSpatial_residue_scale (K := vars) W τ N q z.2) z.1 + rw [he] + cases z.1 + · exact (hlower z.2).1 + · exact (hlower z.2).2 + have hlocal (r) (d) := allocatedTrimmedSpatial_tolerance B U basis S c x y selection W τ N q d r + hb hκ hε hx hW hτ hq hbudget hWexp hLexp hMexp hκexp (hqexp d) hτexp hεexp (hsize d) + refine ⟨hV, hP, hp, ?_, ?_, ?_, ?_⟩ + · intro d i + cases i + · exact (hlower d).1 + · exact one_le_mul_of_one_le_of_one_le hL1 (hlower d).2 + · intro r z + have hr := boundedColumnResidueRepresentative_bounds q hq r z + have hq0 : (0 : ℝ) < q z.2 := by exact_mod_cast hq z.2 + have hr0 : (0 : ℝ) ≤ boundedColumnResidueRepresentative q r z := by exact_mod_cast hr.1 + apply le_trans (b := 1) _ (hw1 z) + change |-(boundedColumnResidueRepresentative q r z : ℝ) / (q z.2 : ℝ)| ≤ 1 + rw [abs_div, abs_neg, abs_of_pos hq0, abs_of_nonneg hr0] + exact (div_le_one hq0).mpr (by exact_mod_cast hr.2.le) + · intro d i k + rw [trimmedSpatial_residue_scale] + exact physicalCube_normalized_entry_bound root dirs (hscales d).1 (hscales d).2 hL + (fun k => trimmedSpatial_root_control hW hτ N q d (hN d) (hq d) root + ((allocatedPhysicalCube_root_sum B U basis S c x y).trans hbudget) k) + (allocatedPhysicalCube_directions_bound B U basis S x y) i k + · intro r + have hc : 0 < shiftedSmoothProductMass (center r) width := by + rw [shiftedSmoothProductMass_grouped _ _ (residueProfileWidth_pos q V hq hV)] + apply Finset.prod_pos + intro d _ + obtain ⟨_, _, _, hz, _⟩ := hlocal r d + simpa only [trimmedSpatial_residue_scale] using hz + refine ⟨hc, ?_⟩ + intro d v + obtain ⟨hi, ho, hp', hz, he⟩ := hlocal r d + have hden : Erdos3.selectedCoefficientDensity mat pivot hp (fun k => width (k, d)) (out d) + (fun k => residueProfileWidth_pos q V hq hV (k, d)) (hP d) = + Erdos3.selectedCoefficientDensity mat pivot hp' + (physicalSpatialInputScale vars (trimmedSpatialRootScale τ N q d) + (trimmedSpatialSlopeScale W τ N q d)) (out d) hi ho := by + congr 1 + exact trimmedSpatial_residue_scale W τ N q d + rw [hden] + simp_rw [trimmedSpatial_residue_scale] + exact he v + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel MeasureTheory +open scoped BigOperators Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) +variable [∀ a, Fintype (B a)] [DecidableEq (LayerSamplerVariables G I n B)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox α S.value) +variable (y : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U basis S)) +variable (selection : α ↪ G) +variable {X : Type*} [Fintype X] (W τ : ℝ) (N q : X → ℕ) + +local notation "vars" => LayerSamplerVariables G I n B +local notation "root" => allocatedPhysicalCubeRoot B U basis S c x y +local notation "dirs" => allocatedPhysicalCubeDirections B U basis S x y +local notation "sel" => selection.trans (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B) +local notation "V" => trimmedSpatialWidths (K := vars) W τ N +local notation "width" => residueProfileWidth q V +local notation "out" => (fun d => physicalSpatialOutputScale α + (trimmedSpatialRootScale τ N q d) (trimmedSpatialSlopeScale W τ N q d) (LayerSamplerScale.value S)) +local notation "center" => (fun r => residueProfileCenter (boundedColumnResidueRepresentative q r) q) +local notation "mat" => physicalCubeCoefficient root dirs +local notation "pivot" => physicalCubePivotIndex sel + +theorem allocatedTrimmedSpatial_product_comparison {κ ε b : ℝ} {M : ℕ} + (hb : 0 ≤ b) (hκ : 0 < κ) (hε : 0 < ε) (hx : GoodScalarKernelTuple selection κ M x) + (hW : 0 ≤ W) (hτ : 0 < τ) (hq : ∀ d, 0 < q d) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (hWexp : W ≤ Real.exp b) (hLexp : (S.value : ℝ) ≤ Real.exp b) + (hMexp : (M : ℝ) ≤ Real.exp b) (hκexp : κ⁻¹ ≤ Real.exp b) + (hqexp : ∀ d, (q d : ℝ) ≤ Real.exp b) (hτexp : τ⁻¹ ≤ Real.exp b) (hεexp : ε⁻¹ ≤ Real.exp b) + (hsize : ∀ d, Real.exp (physicalSpatialLogAllowance sel (b + 2) + 4 * b + 12) ≤ (N d : ℝ)) + (T : Finset (ColumnResiduePattern (Option vars) X q)) (hT : T.Nonempty) + (base : X → ℤ) + (hsmall : (∑ _d : X, shiftedMatrixCountFactor (Unit ⊕ α) (Option vars) * ε) ≤ 1) + (φ : (X → (Unit ⊕ α) → ℤ) → ℂ) {C : ℝ} (hC : 0 ≤ C) (hφ : ∀ v, ‖φ v‖ ≤ C) : + ∃ (hV : ∀ z, 0 < V z) (hP : ∀ d i, 0 < out d i) + (hp : ((mat).submatrix id pivot).det ≠ 0) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight q T V z), + ‖(∑' z, ((selectedResidueSmoothPMF q T V hV hZ z).toReal : ℂ) * + φ (physicalCubeRootDifferences root dirs base z)) - + ∑ r : T, (selectedResidueCellWeight q T V r : ℂ) * + ∫ v, (shiftedProductGridProxy (fun _ : X => mat) (fun _ => pivot) (fun _ => hp) + (center r.val) width out (residueProfileWidth_pos q V hq hV) hP v : ℂ) * + φ (physicalResidueReconstruct root dirs base + (boundedColumnResidueRepresentative q r.val) q v) ∂Measure.count‖ ≤ + C * (2 * ∑ _d : X, shiftedMatrixCountFactor (Unit ⊕ α) (Option vars) * ε) := by + obtain ⟨hV, hP, hp, hP1, ha, hentry, hcells⟩ := + allocatedTrimmedSpatial_product_data B U basis S c x y selection W τ N q + hb hκ hε hx hW hτ hq hbudget hWexp hLexp hMexp hκexp hqexp hτexp hεexp hsize + choose hc he using hcells + have hmass (r : T) : 0 < ∑' z, + residueSmoothWeight (columnResidueRepresentative q r.val) q V z := by + rw [← residueSmoothWeight_mass _ q hq V hV, + residueSmoothMass_congr _ _ q hq V hV (boundedColumnResidueRepresentative_congr q r.val)] + exact hc r.val + have hZ := selectedResidueSmoothWeight_mass_pos q T hT V hV hmass + refine ⟨hV, hP, hp, hZ, ?_⟩ + have h := selectedResidue_physical_product_test_error root dirs base pivot hp q hq T V hV hZ + (fun r => hc r.val) out hP hP1 (fun r => ha r.val) hentry (fun _ _ => ε) + (fun r => he r.val) (fun _ => hsmall) φ hC hφ + simpa only [← Finset.sum_mul, selectedResidueCellWeight_sum q T V hV hZ, one_mul] using h + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel MeasureTheory +open scoped BigOperators + +theorem exists_allocated_positive_spatial_comparison (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {G : Type*} [Fintype G] [DecidableEq G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + [DecidableEq (LayerSamplerVariables G I n B)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) + (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox (Fin q) S.value) + {P W κ : ℝ} (_hP : 0 ≤ P) (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) (_hW : 0 ≤ W) + (_hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (_hWP : W ≤ Real.exp P) (_hL : (S.value : ℝ) ≤ Real.exp P) + (selection : Fin q ↪ G) (_hκ : 0 < κ) {M : ℕ} + (_hx : GoodScalarKernelTuple selection κ M x) (_hMP : (M : ℝ) ≤ Real.exp P) + (_hκP : κ⁻¹ ≤ Real.exp P) + (y : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin q) (allocatedPrincipalSides B U basis S)) + {X : Type*} [Fintype X] [DecidableEq X] + (_hX : (Fintype.card X : ℝ) ≤ P) + (_hdim : (Fintype.card (Option (LayerSamplerVariables G I n B) × X) : ℝ) ≤ P) + {F : Type*} [Fintype F] + (frequency : F → ∀ j, (LayerSamplerVariables G I n B →₀ ℕ) → J j → ℤ) + (_hfrequency : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ Real.exp P) + (coeff : F → ℂ) (_hcoeff : (∑ a, ‖coeff a‖) ≤ Real.exp P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) (base : X → ℤ) + (stride : X → ℕ) (hs : ∀ d, 0 < stride d) (_hsP : ∀ d, (stride d : ℝ) ≤ Real.exp P) + {τ δ ε : ℝ} (_hτ : 0 < τ) (_hτP : τ⁻¹ ≤ Real.exp P) + (_hδ : 0 < δ) (_hδP : δ⁻¹ ≤ Real.exp P) (_hε : 0 < ε) (_hεP : ε⁻¹ ≤ Real.exp P) + (N : X → ℕ) (_hsize : ∀ d, Real.exp ((P + A) ^ A) ≤ (N d : ℝ)) + (_hsmall : (∑ _d : X, shiftedMatrixCountFactor (Unit ⊕ Fin q) + (Option (LayerSamplerVariables G I n B)) * ε) ≤ 1) + {rank : ℝ} (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun d => (N d : ℝ)) rank (U j) (p j)) + (_hRank : Real.exp ((P + A) ^ A) ≤ rank) + (test : Finset (Fin q) → (X → ℝ) → ℂ) (_htest : ∀ s v, ‖test s v‖ ≤ 1) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty) + (density : CoefficientTorus (K := LayerSamplerVariables G I n B) U → ℝ) + (D : ℕ) (f : EuclideanJetLayers U (fun j : Fin m => BoundedBooleanJet (Fin q) (j.val + 1)) → ℝ) + {cap : ℝ} (_hcap : ∀ z, f z ∈ Set.Icc (0 : ℝ) cap) + {η : ℝ} (_hη : 0 ≤ η) + (_happrox : ∀ v, ‖(density v : ℂ) - coefficientTorusFourierSum U frequency coeff v‖ ≤ η) {Z : ℝ} (_hZnorm : 0 < Z), + let V := trimmedSpatialWidths (K := LayerSamplerVariables G I n B) W τ N + let root := allocatedPhysicalCubeRoot B U basis S c x y + let dirs := allocatedPhysicalCubeDirections B U basis S x y + let pa := fun j => translate (fun d => (base d : ℝ)) (p j) + let hma := fun j => coefficients_translate_mem (U j) (fun d => (base d : ℝ)) (p j) (hm j) + let sel := selection.trans (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B) + let out := fun d => physicalSpatialOutputScale (Fin q) + (trimmedSpatialRootScale τ N stride d) (trimmedSpatialSlopeScale W τ N stride d) S.value + ∀ (_hpositive : ∀ z : Option (LayerSamplerVariables G I n B) × X → ℤ, + ‖affineCubeFourierProjection U root dirs frequency pa coeff (fun k d => (z (k, d) : ℝ)) - + (f (euclideanCoefficientJetMap U root dirs + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) + (affineCoefficientCoverSample U pa hma D (fun k d => (z (k, d) : ℝ)))) : ℂ)‖ ≤ η), + ∃ (hV : ∀ z, 0 < V z) (hOut : ∀ d i, 0 < out d i) + (hpivot : ((physicalCubeCoefficient root dirs).submatrix id (physicalCubePivotIndex sel)).det ≠ 0) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight stride T V z), + ‖(∑' z, ((selectedResidueSmoothPMF stride T V hV hZ z).toReal : ℂ) * + (physicalCubeSiteTest test (physicalCubeRootDifferences root dirs base z) * + (density (affineSampleCoefficientTorus U pa hma (fun k d => (z (k, d) : ℝ))) : ℂ))) / (Z : ℂ) - + (∑ r : T, (selectedResidueCellWeight stride T V r : ℂ) * + ∫ v, (shiftedProductGridProxy (fun _ : X => physicalCubeCoefficient root dirs) + (fun _ => physicalCubePivotIndex sel) (fun _ => hpivot) + (residueProfileCenter (boundedColumnResidueRepresentative stride r.val) stride) + (residueProfileWidth stride V) out (residueProfileWidth_pos stride V hs hV) hOut v : ℂ) * + physicalCubePositiveTest U D p hm f test + (physicalResidueReconstruct root dirs base + (boundedColumnResidueRepresentative stride r.val) stride v) ∂Measure.count) / (Z : ℂ)‖ ≤ + (2 * η + δ + cap * (2 * ∑ _d : X, + shiftedMatrixCountFactor (Unit ⊕ Fin q) (Option (LayerSamplerVariables G I n B)) * ε)) / Z := by + classical + obtain ⟨A₀, _, hprojection⟩ := exists_affine_cube_fourier_projection m q + obtain ⟨A, hA, hbudget⟩ := exists_natPolynomial_eval_budget + ((4 * Polynomial.X + Polynomial.C (q + 130 + A₀)) ^ A₀ + spatialProjectionBudget q Polynomial.X) + refine ⟨A, hA, ?_⟩ + intro G _ _ I _ n B _ _ J _ U basis R σ S c x P W κ hP hK hW hroot hWP hL + selection hκ M hx hMP hκP y X _ _ hX hdim F _ frequency hfrequency + coeff hcoeff p hp hm base stride hs hsP τ δ ε hτ hτP hδ hδP hε hεP + N hsize hsmall rank hrank hRank test htest T hT density D f cap hcap η hη happrox Z hZnorm + V root dirs pa hma sel out hpositive + let Q := spatialSamplingBudget P + (q + 2 : ℕ) + have hPQ : P ≤ Q := by + dsimp [Q, spatialSamplingBudget] + linarith [Nat.cast_nonneg (α := ℝ) (q + 2)] + have hQ : 0 ≤ Q := hP.trans hPQ + have hsiteQ : P + (q + 2 : ℕ) ≤ Q := by dsimp [Q, spatialSamplingBudget]; linarith + have heval : Q + A₀ = 4 * P + (q + 130 + A₀ : ℕ) := by + dsimp [Q, spatialSamplingBudget] + push_cast + ring + have hsum : (Q + A₀) ^ A₀ + spatialProjectionBudget q P ≤ (P + A) ^ A := by + rw [heval] + simpa [spatialProjectionBudget, Polynomial.eval₂_pow] using hbudget P hP + have hprojcost : (Q + A₀) ^ A₀ ≤ (P + A) ^ A := by + linarith [spatialProjectionBudget_nonneg q hP] + have hspatialcost : spatialProjectionBudget q P ≤ (P + A) ^ A := by + linarith [pow_nonneg (add_nonneg hQ (Nat.cast_nonneg A₀)) A₀] + have hExp := Real.exp_le_exp.mpr hPQ + obtain ⟨a, ha, _, hperiod⟩ := hx.2 + have hlin : LinearIndependent ℝ (fun i k => (dirs i k : ℝ)) := + linearIndependent_of_fixed_kernel_period (scalarCubeDifferenceMatrix x) dirs Sum.inl + (fun _ _ => rfl) (by exact_mod_cast ha.ne') hperiod + have hpa (j) : DegreeLE (1 : X → ℕ) (j.val + 1) (pa j) := + degreeLE_translate (1 : X → ℕ) (fun _ => by norm_num) _ (p j) (hp j) + have hra (j) : HasLayerSamplingRank (j.val + 1) (fun d => (N d : ℝ)) rank (U j) (pa j) := + (hasLayerSamplingRank_translate_iff (fun d => (base d : ℝ)) (j.val + 1) + (fun d => (N d : ℝ)) rank (U j) (p j) (hp j)).mpr (hrank j) + have hN (d) : 0 < N d := by exact_mod_cast (Real.exp_pos _).trans_le (hsize d) + have hV : ∀ z, 0 < V z := trimmedSpatialWidths_pos hW hτ N hN + have hρP : 1 / spatialWidthFraction P τ ≤ Real.exp Q := + (spatialWidthFraction_inv_le hP hτ hτP).trans + (Real.exp_le_exp.mpr (le_add_of_nonneg_right (Nat.cast_nonneg _))) + obtain ⟨hZ, hraw⟩ := hprojection hQ (hX.trans hPQ) (hdim.trans hPQ) U root dirs hlin + (Real.exp_nonneg Q) (Real.exp_nonneg Q) le_rfl le_rfl + (fun s k => (allocatedPhysicalCube_site_le_exp B U basis S c x y (hroot.trans hWP) hL s k).trans + (Real.exp_le_exp.mpr hsiteQ)) frequency (fun a j d hd t => (hfrequency a j d hd t).trans hExp) + coeff (Real.exp_nonneg Q) le_rfl (hcoeff.trans hExp) pa hpa hma stride hs + (Real.exp_nonneg Q) le_rfl (spatialWidthFraction_pos P hτ) hδ hρP + (by simpa only [one_div] using hδP.trans hExp) (fun d => (hsP d).trans hExp) + (fun d => (N d : ℝ)) (fun d => (Real.exp_le_exp.mpr hprojcost).trans (hsize d)) hra + ((Real.exp_le_exp.mpr hprojcost).trans hRank) 0 (by simp) + (fun s u => test s ((fun d => (base d : ℝ)) + u)) (fun s u => htest s _) + T hT V hV (spatialWidthFraction_le_allocated_width hP hW hWP hτ.le N) + have hweight (z : Option (LayerSamplerVariables G I n B) × X → ℤ) : + layeredSiteWeight 0 (fun s => affineSite root dirs s) + (fun s u => test s ((fun d => (base d : ℝ)) + u)) (fun k d => (z (k, d) : ℝ)) = + physicalCubeSiteTest test (physicalCubeRootDifferences root dirs base z) := + layeredSiteWeight_physicalCube root dirs base test z + have hdirs : Matrix.of dirs = dirs := rfl + have hfirst := selectedResidue_positive_density_projection_error U root dirs D p hp hm + frequency coeff test htest base stride T V hV hZ density f hη happrox hpositive + (by simpa only [hweight, hdirs, pa] using hraw) + simp only [hdirs] at hfirst + have hspatial (d) : Real.exp (physicalSpatialLogAllowance sel (P + 2) + 4 * P + 12) ≤ (N d : ℝ) := + (Real.exp_le_exp.mpr ((physicalSpatialLogAllowance_le_projection_budget sel hP hK).trans + hspatialcost)).trans (hsize d) + have hcap0 : 0 ≤ cap := (hcap 0).1.trans (hcap 0).2 + obtain ⟨hV', hOut, hpivot, hZ', hsecond⟩ := + allocatedTrimmedSpatial_product_comparison B U basis S c x y selection W τ N stride + hP hκ hε hx hW hτ hs hroot hWP hL hMP hκP hsP hτP hεP hspatial T hT base hsmall + (physicalCubePositiveTest U D p hm f test) hcap0 + (fun v => physicalCubePositiveTest_norm_le U D p hm f hcap test htest v) + refine ⟨hV, hOut, hpivot, hZ, ?_⟩ + have h := (norm_sub_le_norm_sub_add_norm_sub _ + (∑' z, ((selectedResidueSmoothPMF stride T V hV hZ z).toReal : ℂ) * + physicalCubePositiveTest U D p hm f test (physicalCubeRootDifferences root dirs base z)) _).trans + (add_le_add hfirst hsecond) + rw [← sub_div, norm_div, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hZnorm] + exact div_le_div_of_nonneg_right h hZnorm.le + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPrescribedSpatialData.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPrescribedSpatialData.lean new file mode 100644 index 0000000000000000000000000000000000000000..445a82a60b2ae38ebfc531f557436ec58d4be62b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPrescribedSpatialData.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedProfileDimensions + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Matrix NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] +variable [∀ j : Fin m, DecidableEq (BoundedIntegerExponent G (j.val+1))] +variable [∀ j : Fin m, DecidableEq (AllocatedNonkernelCoefficient (G := G) B j)] +variable (rows : ∀ j, O j → Finset α) + +local notation "grid" => allocatedGridAxis (I := I) U b (LayerSamplerScale.value S) +local notation "sides" => allocatedPrincipalSides B U b S +local notation "lengths" => principalAxisLength (fun a => ¬grid a) sides + +theorem allocatedGoodKernel_prescribed_spatial_data {M : ℕ} (hM : 0 < M) + (selection : α ↪ G) (hx : GoodScalarKernelTuple selection (1/(M : ℝ)) M x) + (hq : Fintype.card α ≤ m+1) (hinj : ∀ j, Function.Injective (rows j)) + (hrows : ∀ j o, (rows j o).card ≤ j.val+1) (hσ1 : ∀ j, σ j ≤ 1) + {P E η : ℝ} (hP : 0 ≤ P) (hE : 0 ≤ E) (hη : 0 < η) (hη1 : η ≤ 1) + (hMP : (M : ℝ) ≤ Real.exp P) (hRP : ∀ j, R j ≤ Real.exp P) + (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ)+1 ≤ Real.exp P) + (hηE : η⁻¹ ≤ Real.exp E) + (hlarge : Real.exp (allocatedJointLengthLog (G := G) B α O P E) ≤ S.value) : + ∃ (modulus : ℕ) (hm : 0 < modulus), modulus ≤ M^(m+1) ∧ + (∀ root : G → ℤ, integerScalarLattice (Unit ⊕ α) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) ∧ + (∀ j, integerScalarLattice (O j) (modulus : ℤ) ≤ + (scalarKernelIntegerJet x (j.val+1) (rows j)).mulVecLin.range) ∧ + ∃ (s : ∀ j, O j ↪ BoundedIntegerExponent G (j.val+1)) + (hA : ∀ j, ((scalarKernelIntegerJet x (j.val+1) (rows j)).submatrix id (s j)).det ≠ 0), + (∀ j : Fin m, fixedKernelInverseBound S.positive x (j.val+1) (rows j) (s j) (hA j) (1/(M : ℝ))) ∧ + ∃ hsize : ∀ d, (Fintype.card α+1)*modulus ≤ lengths d, + ∀ (u : PrincipalAxisTuples (α := α) grid sides) + (r : PrincipalTupleIndex (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option α → ZMod modulus), + ∃ (reference : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) + (residue : ∀ j, Matrix (O j) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)), + principalResidueLabel modulus reference = r ∧ + (∀ v, (allocatedLongResidueWeights B U b S modulus hm r hsize).weight v ≠ 0 → ∀ j, + integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u rows j v) modulus = residue j) ∧ + ∀ z : AllocatedLongJetRows B U b S O, + |(allocatedLongResidueWeights B U b S modulus hm r hsize).mean + (fun v => (∏ a, allocatedLongJetOutputScale B U b S (O := O) a) * + allocatedLongJetDensity B U b hR hσ S x u v rows s hA hσ1 z) - + allocatedLongJetProxy B U b S x u rows s hA modulus residue z| ≤ η := by + obtain ⟨modulus, hm, hmod, hspatial, hperiod, s, hA, hi, hsize, hdata⟩ := + allocatedGoodKernel_prescribed_comparison B U b hR hσ S x rows hM selection hx + hq hinj hrows hσ1 hP hE hη hη1 hMP hRP hRi hσi hcount hηE hlarge + refine ⟨modulus, hm, hmod, hspatial, hperiod, s, hA, hi, hsize, ?_⟩ + intro u r + obtain ⟨reference, href⟩ := exists_allocatedLongResidueReference B U b S modulus hm r hsize + obtain ⟨residue, hr, he⟩ := hdata u r + exact ⟨reference, residue, href, hr, he⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPrescribedSpatialTest.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPrescribedSpatialTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f0e30a4f7f38d31bffb13812c733d292fe556ca --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedPrescribedSpatialTest.lean @@ -0,0 +1,127 @@ +import OAI.Combinatorics.Progressions.Polynomial.AllocatedPolynomialSpatialTest + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] [dG : DecidableEq 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)] (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 (A : ℕ) {p : ℝ} +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (x : G → IntegerScalarCubeBox α (allocatedComparisonScale (G := G) B U basis hR hσ ((p+2)^(A+3))).value) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] +variable [∀ j : Fin m, DecidableEq (BoundedIntegerExponent G (j.val+1))] +variable [∀ j : Fin m, DecidableEq (AllocatedNonkernelCoefficient (G := G) B j)] +variable (rows : ∀ j, O j → Finset α) + +local notation "P₀" => (p+2)^A +local notation "P" => (p+2)^(A+3) +local notation "S" => allocatedComparisonScale (G := G) B U basis hR hσ P +local notation "grid" => allocatedGridAxis (I := I) U basis (LayerSamplerScale.value S) +local notation "sides" => allocatedPrincipalSides B U basis S +local notation "lengths" => principalAxisLength (fun a => ¬grid a) sides +local notation "longWeight" => allocatedLongTupleWeights (α := α) B U basis S +local notation "source" => allocatedLongCoefficientSource B U basis hR hσ S +local notation "coefficientScale" => ∏ a, allocatedLongJetOutputScale B U basis S (O := O) a + +variable {D N : Type*} [Fintype D] [Fintype N] [DecidableEq N] +variable (c : D → N → ℤ) (index : D → N → PrincipalTupleIndex B (layerSamplerDegree I n)) +variable (root : G → ℤ) (selection : α ↪ G) +variable (hP : (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection).det ≠ 0) +variable (M : ℕ) {τ : ℝ} (hτ : 0 < τ) + +local notation "H" => allocatedSpatialHeight B U basis S c index selection M τ +local notation "ρ" => smoothJointResolution N (Fintype.card D) selection M (LayerSamplerScale.value S) (m+1) τ +local notation "ξ" => smoothJointWidth N (Fintype.card D) selection M (m+1) τ +local notation "mesh" => smoothJointRadius (Fintype.card D) selection M (m+1) τ +local notation "Q" => (fun (_ : D) (_ : N) => ρ) +local notation "hH" => allocatedSpatialHeight_pos B U basis S c index selection M τ hτ +local notation "hQ" => (fun (_ : D) (_ : N) => And.left (smoothJointParameters_spec D N selection M (LayerSamplerScale.value S) (m+1) hτ)) + +local notation "spatialScale" => (∏ d, ∏ _i : Unit ⊕ α, H d : ℝ) + +theorem allocatedGoodKernel_prescribed_spatial_test (hp : 0 ≤ p) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P₀) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P₀) (hn : ∀ j, (n j : ℝ) ≤ P₀) + (hM : 0 < M) (hx : GoodScalarKernelTuple selection (1/(M : ℝ)) M x) + (hq : Fintype.card α ≤ m+1) (hinj : ∀ j, Function.Injective (rows j)) + (hrows : ∀ j o, (rows j o).card ≤ j.val+1) (hσ1 : ∀ j, σ j ≤ 1) + (hτ1 : τ ≤ 1) + (hMP : (M : ℝ) ≤ Real.exp P₀) (hRP : ∀ j, R j ≤ Real.exp P₀) + (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P₀) (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P₀) + (hτP : τ⁻¹ ≤ Real.exp P₀) + (hroot : ∀ j, |root j| ≤ (LayerSamplerScale.value S : ℤ)) : + (LayerSamplerScale.value S : ℝ) ≤ Real.exp ((p+2)^allocatedComparisonExponent m (A+3)) ∧ + ∃ (modulus : ℕ) (hm : 0 < modulus), + letI : NeZero modulus := ⟨ne_of_gt hm⟩ + modulus ≤ M^(m+1) ∧ + (∀ root : G → ℤ, integerScalarLattice (Unit ⊕ α) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) ∧ + (∀ j, integerScalarLattice (O j) (modulus : ℤ) ≤ + (scalarKernelIntegerJet x (j.val+1) (rows j)).mulVecLin.range) ∧ + ∃ (s : ∀ j, O j ↪ BoundedIntegerExponent G (j.val+1)) + (hA : ∀ j, ((scalarKernelIntegerJet x (j.val+1) (rows j)).submatrix id (s j)).det ≠ 0), + (∀ j : Fin m, fixedKernelInverseBound (LayerSamplerScale.positive S) x (j.val+1) (rows j) (s j) (hA j) (1/(M : ℝ))) ∧ + ∃ hsize : ∀ d, (Fintype.card α+1)*modulus ≤ lengths d, + ∀ u : PrincipalAxisTuples (α := α) grid sides, + ∃ residue : (PrincipalTupleIndex (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option α → ZMod modulus) → + ∀ j, Matrix (O j) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus), + (∀ r y, (allocatedLongResidueWeights B U basis S modulus hm r hsize).weight y ≠ 0 → ∀ j, + integerResidueMatrix (allocatedNonkernelJetMatrix B U basis S x u rows j y) modulus = residue r j) ∧ + ∀ (tv : Finset (D → (Unit ⊕ α) → ℤ)), + (∀ v ∈ tv, ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ)/H d| ≤ 1) → + ∀ (φ : (D → (Unit ⊕ α) → ℤ) → AllocatedLongJetRows B U basis S O → ℂ), + (∀ v ∈ tv, Measurable (φ v)) → (∀ v ∈ tv, ∀ z, ‖φ v z‖ ≤ 1) → + ‖(∫ a, (longWeight).complexMean (fun y => ∑ v ∈ tv, + ((allocatedSpatialOutputLaw B U basis S u c index x root H Q hH hQ y v).toReal : ℂ)* + φ v (allocatedLongJetMap B U basis S x u y rows a)) ∂source) - + ((longWeight).fiberLaw (principalResidueLabel modulus)).complexMean (fun r => ∑ v ∈ tv, + (allocatedSpatialProxy B U basis S u c index x root selection hP H hH modulus r mesh v / + (spatialScale : ℂ))* + (∫ z, ((allocatedLongJetProxy B U basis S x u rows s hA modulus (residue r) z / + coefficientScale : ℝ) : ℂ)*φ v z ∂allocatedLongJetReference B U basis S O))‖ ≤ + τ := by + classical + cases Subsingleton.elim dG (Classical.decEq G) + have hBudget : P₀ ≤ P := by linarith [polynomialBudget_four_slack A hp] + have hExp : Real.exp P₀ ≤ Real.exp P := Real.exp_le_exp.mpr hBudget + obtain ⟨hrho, hlarge, hxi, hxi1, hr⟩ := + smoothJointParameters_spec D N selection M (LayerSamplerScale.value S) (m+1) hτ + have hc := allocatedSpatialHeight_spec B U basis S c index selection M τ hτ + obtain ⟨hS, modulus, hm, hmod, hspatial, hperiod, s, hA, hi, hsize, hcompare⟩ := + allocatedGoodKernel_polynomial_spatial_test B U basis hR hσ (A+3) x rows c index root selection + hP + H Q hH hQ hp (hK.trans hBudget) (fun j => (hI j).trans hBudget) (fun j => (hn j).trans hBudget) + hM hx hq hinj hrows hσ1 (show 0 < τ/4 by positivity) (show τ/4 ≤ 1 by linarith) + (hMP.trans hExp) (fun j => (hRP j).trans hExp) (fun j => (hRi j).trans hExp) + (fun j => (hσi j).trans hExp) (quarterAccuracy_polynomial_budget A hp hτP) hroot + hxi.le hxi1 hc.2.2.2 hrho hc.2.2.1 (fun _ _ => le_rfl) hlarge hr + refine ⟨hS, modulus, hm, ?_⟩ + let : NeZero modulus := ⟨ne_of_gt hm⟩ + refine ⟨hmod, hspatial, hperiod, s, hA, hi, hsize, ?_⟩ + intro u + obtain ⟨residue, hmatrix, htest⟩ := hcompare u + refine ⟨residue, hmatrix, ?_⟩ + intro tv hv φ hφ hb + have he := htest tv hv φ hφ hb + have ht := smoothSpatial_grid_tolerance (N := N) selection M (LayerSamplerScale.value S) (m+1) + hτ hτ1 hmod H (allocatedSpatialHeight_one_le B U basis S c index selection M τ hτ) tv hv + exact he.trans (by simpa only [smoothVectorSpatialError] using ht.2.2.2.2.2.2) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProductChartRadius.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProductChartRadius.lean new file mode 100644 index 0000000000000000000000000000000000000000..7858e34968d64a337599a0839b4ea746a7457888 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProductChartRadius.lean @@ -0,0 +1,196 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedProductRadiusBudget + +namespace OAI + +section + +namespace Erdos3 + +theorem finiteRowChartRadius_support_le_inv (rows dim : ℕ) {C T : ℝ} + (hC : 0 ≤ C) (hT : 0 ≤ T) : + T ≤ (finiteRowChartRadius rows dim C T)⁻¹ := by + simp only [finiteRowChartRadius, one_div, inv_inv] + calc + T ≤ 1 * 1 * 1 * 1 * (T + 1) := by linarith + _ ≤ 4 * ((rows : ℝ) + 1) * (C + 1) * ((dim : ℝ) + 1) * (T + 1) := by + gcongr <;> linarith [Nat.cast_nonneg (α := ℝ) rows, Nat.cast_nonneg (α := ℝ) dim] + +namespace VectorPolynomial + +def allocatedProductChartLog {A : Type*} [Semiring A] (m : ℕ) (D c : A) : A := + 4 * ((8 * allocatedIdealCoverInputLog m D c + 14) + 2 * D + 2) + 6 + +theorem allocatedProductChartLog_bounds (m : ℕ) {D c : ℝ} (hD : 0 ≤ D) (hc : 0 ≤ c) : + let H := 8 * allocatedIdealCoverInputLog m D c + 14 + let F := H + 2 * D + 2 + 0 ≤ H ∧ 0 ≤ F ∧ 2 * D ≤ F ∧ D ≤ F ∧ c ≤ F ∧ + H + 1 ≤ allocatedProductChartLog m D c ∧ 0 ≤ allocatedProductChartLog m D c := by + obtain ⟨hL, _, _, _, _, hcL⟩ := allocatedIdealCoverInputLog_bounds m hD hc + dsimp only [allocatedProductChartLog] + constructor + · linarith + constructor + · linarith + constructor + · linarith + constructor + · linarith + constructor + · linarith + constructor <;> linarith + +theorem allocatedProductChartLog_mono (m : ℕ) {D c D' c' : ℝ} + (hD : 0 ≤ D) (hDD : D ≤ D') (hcc : c ≤ c') : + allocatedProductChartLog m D c ≤ allocatedProductChartLog m D' c' := by + unfold allocatedProductChartLog allocatedIdealCoverInputLog allocatedSiteCoefficientLog + gcongr + +theorem exists_allocatedProductChartLog_bound (m : ℕ) : + ∃ a : ℕ, 2 ≤ a ∧ ∀ {D c : ℝ}, 0 ≤ D → 0 ≤ c → + allocatedProductChartLog m D c ≤ (D + c + a) ^ a := by + let poly : Polynomial ℕ := allocatedProductChartLog m Polynomial.X Polynomial.X + obtain ⟨a, ha, hb⟩ := exists_natPolynomial_eval_budget poly + refine ⟨a, ha, ?_⟩ + intro D c hD hc + apply (allocatedProductChartLog_mono m hD (by linarith : D ≤ D + c) + (by linarith : c ≤ D + c)).trans + simpa [poly, allocatedProductChartLog, allocatedIdealCoverInputLog, allocatedSiteCoefficientLog, + Polynomial.eval₂_pow] using hb (D + c) (add_nonneg hD hc) + +noncomputable def allocatedProductChartRadius (m : ℕ) (D c : ℝ) : ℝ := + Real.exp (-allocatedProductChartLog m D c) + +theorem allocatedProductChartRadius_bounds (m : ℕ) {D c : ℝ} (hD : 0 ≤ D) (hc : 0 ≤ c) : + 0 < allocatedProductChartRadius m D c ∧ allocatedProductChartRadius m D c ≤ 1 ∧ + (allocatedProductChartRadius m D c)⁻¹ = Real.exp (allocatedProductChartLog m D c) ∧ + allocatedProductChartRadius m D c ≤ + Real.exp (-(8 * allocatedIdealCoverInputLog m D c + 14 + 1)) := by + obtain ⟨_, _, _, _, _, hHQ, hQ⟩ := allocatedProductChartLog_bounds m hD hc + refine ⟨Real.exp_pos _, Real.exp_le_one_iff.mpr (neg_nonpos.mpr hQ), ?_, ?_⟩ + · simp only [allocatedProductChartRadius, Real.exp_neg, inv_inv] + · exact Real.exp_le_exp.mpr (neg_le_neg hHQ) + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +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 {α : Type*} [Fintype α] (rowSets : Fin m → Finset (Finset α)) +variable {D c : ℝ} +variable (hdim : AllocatedComparisonDimensions (G := G) B α (fun j => (rowSets j : Type _)) D) +variable (hc : 0 ≤ c) (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ D) (hn : ∀ j, (n j : ℝ) ≤ D) +variable (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) (hCc : ∀ j, C j ≤ Real.exp c) + +local notation "H" => 8 * allocatedIdealCoverInputLog m D c + 14 +local notation "F" => H + 2 * D + 2 + +include hdim hc hI hn hC hCc in +theorem allocatedProductIdealSiteRadius_exp_bound : + 2 * (allocatedProductIdealSiteRadius (G := G) B rowSets : ℝ) ≤ Real.exp F := by + have hD := hdim.nonneg + have hde : D ≤ Real.exp D := by linarith [Real.add_one_le_exp D] + have hH := (allocatedProductChartLog_bounds m hD hc).1 + have hsupport (j : Fin m) : allocatedIdealCoverSupport (G := G) B rowSets j ≤ Real.exp H := + (finiteRowChartRadius_support_le_inv (rowSets j).card (Fintype.card (I j)) + (hC j) (allocatedIdealCoverSupport_nonneg B rowSets j)).trans + (allocatedIdealCoverRadius_inverse_from_dimensions B rowSets hdim hc hI hn C hC hCc j) + have hrows (j : Fin m) : ((rowSets j).card : ℝ) ≤ D := by + simpa only [Fintype.card_coe] using hdim.rows j + have hsum : (∑ j : Fin m, (rowSets j).card * allocatedIdealCoverSupport (G := G) B rowSets j) ≤ + Real.exp (2 * D + H) := by + calc + _ ≤ ∑ _j : Fin m, D * Real.exp H := Finset.sum_le_sum (fun j _ => + mul_le_mul (hrows j) (hsupport j) (allocatedIdealCoverSupport_nonneg B rowSets j) hD) + _ = (m : ℝ) * (D * Real.exp H) := by simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + _ ≤ Real.exp D * (Real.exp D * Real.exp H) := + mul_le_mul (hdim.degree.trans hde) + (mul_le_mul_of_nonneg_right hde (Real.exp_pos _).le) + (mul_nonneg hD (Real.exp_pos _).le) (Real.exp_pos _).le + _ = _ := by simp only [← Real.exp_add]; congr 1; ring + have hradius : (allocatedProductIdealSiteRadius (G := G) B rowSets : ℝ) ≤ + Real.exp (2 * D + H + 1) := by + change 1 + ∑ j : Fin m, (rowSets j).card * allocatedIdealCoverSupport (G := G) B rowSets j ≤ _ + exact one_add_le_exp_succ (add_nonneg (mul_nonneg (by norm_num) hD) hH) hsum + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + _ ≤ Real.exp 1 * Real.exp (2 * D + H + 1) := + mul_le_mul htwo hradius (allocatedProductIdealSiteRadius (G := G) B rowSets).coe_nonneg (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +include hdim hc hI hn hC hCc in +theorem allocatedProductGridRadius_inv_exp_bound (j : Fin m) : + (allocatedProductGridRadius (G := G) B rowSets C j)⁻¹ ≤ + Real.exp (allocatedProductChartLog m D c) := by + obtain ⟨_, hF, h2DF, hDF, hcF, _, _⟩ := allocatedProductChartLog_bounds m hdim.nonneg hc + have hrows : ((rowSets j).card : ℝ) ≤ D := by + simpa only [Fintype.card_coe] using hdim.rows j + have hrowadd : ((rowSets j).card : ℝ) + 1 ≤ Real.exp D := by + linarith [Real.add_one_le_exp D] + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hsites : (Fintype.card (Finset α) : ℝ) ≤ Real.exp D := by + simpa only [Fintype.card_finset, Nat.cast_pow, Nat.cast_ofNat, mul_one] using + pow_le_exp_mul_of_le_exp (by norm_num : (0 : ℝ) ≤ 2) htwo + (by norm_num : (0 : ℝ) ≤ 1) (Fintype.card α) hdim.cube + have hrowcount : ((((rowSets j).card + 1) * Fintype.card (Finset α) : ℕ) : ℝ) ≤ Real.exp F := by + rw [Nat.cast_mul, Nat.cast_add, Nat.cast_one] + exact ((mul_le_mul hrowadd hsites (Nat.cast_nonneg _) (Real.exp_pos _).le).trans_eq + (show Real.exp D * Real.exp D = Real.exp (2 * D) by rw [← Real.exp_add]; congr 1; ring)).trans + (Real.exp_le_exp.mpr h2DF) + have hDexp : D ≤ Real.exp F := + (show D ≤ Real.exp D by linarith [Real.add_one_le_exp D]).trans (Real.exp_le_exp.mpr hDF) + exact finiteRowChartRadius_inv_le_exp + (((rowSets j).card + 1) * Fintype.card (Finset α)) (Fintype.card (I j)) + (hC j) (mul_nonneg (by norm_num) (allocatedProductIdealSiteRadius (G := G) B rowSets).coe_nonneg) + hF hrowcount ((hI j).trans hDexp) ((hCc j).trans (Real.exp_le_exp.mpr hcF)) + (allocatedProductIdealSiteRadius_exp_bound B rowSets hdim hc hI hn C hC hCc) + +include hdim hc hI hn hC hCc in +theorem allocatedProductChartRadius_le_charts (j : Fin m) : + allocatedProductChartRadius m D c ≤ allocatedProductGridRadius (G := G) B rowSets C j ∧ + allocatedProductChartRadius m D c ≤ allocatedPhysicalChartRadius (G := G) B α C 1 j ∧ + allocatedProductChartRadius m D c ≤ allocatedIdealCoverRadius (G := G) B rowSets C j := by + have hgrid := allocatedProductGridRadius_inv_exp_bound B rowSets hdim hc hI hn C hC hCc j + have hgridPos := allocatedProductGridRadius_pos (G := G) B rowSets C hC j + have hg := (inv_le_inv₀ (Real.exp_pos (allocatedProductChartLog m D c)) (inv_pos.mpr hgridPos)).2 hgrid + have hgridLe : allocatedProductChartRadius m D c ≤ allocatedProductGridRadius (G := G) B rowSets C j := by + simpa only [allocatedProductChartRadius, Real.exp_neg, inv_inv] using hg + have hcover := allocatedIdealCoverRadius_inverse_from_dimensions B rowSets hdim hc hI hn C hC hCc j + have hcoverPos := allocatedIdealCoverRadius_pos (G := G) B rowSets C hC j + have hcInv := (inv_le_inv₀ (Real.exp_pos H) (inv_pos.mpr hcoverPos)).2 hcover + have hcLe : Real.exp (-H) ≤ allocatedIdealCoverRadius (G := G) B rowSets C j := by + simpa only [Real.exp_neg, inv_inv] using hcInv + have hhalf : allocatedProductChartRadius m D c ≤ + allocatedIdealCoverRadius (G := G) B rowSets C j / 2 := by + apply ((allocatedProductChartRadius_bounds m hdim.nonneg hc).2.2.2).trans + apply le_trans _ (div_le_div_of_nonneg_right hcLe (by norm_num : (0 : ℝ) ≤ 2)) + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + _ ≤ Real.exp (-(H + 1)) * Real.exp 1 := mul_le_mul_of_nonneg_left htwo (Real.exp_pos _).le + _ = Real.exp (-H) := by rw [← Real.exp_add]; congr 1; ring + exact ⟨hgridLe, hhalf.trans (allocatedIdealCoverRadius_half_le_physical B rowSets C hC j), + hhalf.trans (by linarith)⟩ + +include hdim hc hI hn hC hCc in +theorem allocatedProductChartRadius_recovery_budget {R : Fin m → ℝ} + (hR : ∀ j, 0 ≤ R j) (hsmall : ∀ j, R j ≤ allocatedProductChartRadius m D c) (j : Fin m) : + ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset α) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * + (2 * (allocatedProductIdealSiteRadius (G := G) B rowSets : ℝ) * R j)))) ≤ 1 / 4 := by + exact allocatedProductGridRadius_recovery_budget B rowSets C hC hR + (fun k => (hsmall k).trans (allocatedProductChartRadius_le_charts B rowSets hdim hc hI hn C hC hCc k).1) j + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProductSiteSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProductSiteSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..bafb72e31cec4c091eaf97bca30f10cfebfbb11f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProductSiteSupport.lean @@ -0,0 +1,96 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedProductIdealCutoff + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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 (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] (r : ℝ≥0) (hr : 0 < r) +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "single" => (fun _ : Fin m => Unit) +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "siteChart" => mixedCoveredJetChart (O := single) U o b hb bW d +local notation "siteRegion" => mixedCoveredJetRegion (O := single) (E := E) U o b d + (fun j (_ : Unit) => standardLatticeClosedQuarterBox (J j)) +local notation "pointCap" => (fun j => C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j))) + +include hR hC hchart in +theorem allocatedProductSiteCutoff_small_representatives + (y : EuclideanJetLayers U rowTypes) + (hne : allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr y ≠ 0) : + ∃ w : Finset α → MixedCoveredJetSource I single E n d, + (∀ s, siteChart (w s) = coveredRowsSiteValue rowSets U y s) ∧ + (∀ s j, ‖normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (mixedCoveredJetCoordinates U o d (w s) j ()).1‖ ≤ pointCap j) := by + have hs (s : Finset α) : allocatedBufferedSiteChartFactor B U b S o hb bW d r hr (fun _ => 1) + (coveredRowsSiteValue rowSets U y s) ≠ 0 := by + intro he + apply hne + unfold allocatedProductSiteCutoff + exact Finset.prod_eq_zero (Finset.mem_univ s) he + have hex (s : Finset α) : ∃ w : MixedCoveredJetSource I single E n d, + siteChart w = coveredRowsSiteValue rowSets U y s ∧ + ∀ j, ‖normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (mixedCoveredJetCoordinates U o d w j ()).1‖ ≤ pointCap j := by + have hmem : coveredRowsSiteValue rowSets U y s ∈ siteChart '' siteRegion := by + by_contra he + apply hs s + unfold allocatedBufferedSiteChartFactor + exact restrictedComplexChartDensity_zero _ _ _ _ he + obtain ⟨w, hw, hwy⟩ := hmem + have hraw : allocatedBufferedMixedSiteFactor B U b S r hr (fun _ => 1) + (fun j => mixedArrayRegroup _ _ _ (w.1 j) ()) ≠ 0 := by + intro he + apply hs s + rw [← hwy, allocatedBufferedSiteChartFactor, restrictedComplexChartDensity_apply _ _ _ _ + (mixedCoveredJetChart_injOn U o b hb bW d + (fun j (_ : Unit) => standardLatticeClosedQuarterBox (J j)) + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j))) hw, + Complex.ofReal_one, one_mul, he] + refine ⟨w, hwy, ?_⟩ + intro j + exact allocatedBufferedMixedSiteFactor_nonzero_point_bound B U b S r hr (fun _ => 1) + hR o (fun j => mixedArrayRegroup _ _ _ (w.1 j) ()) hraw C hC hchart j + choose w hw hp using hex + exact ⟨w, hw, hp⟩ + +include hR hC hchart in +theorem allocatedProductSiteCutoff_sites_quarter + (hbudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset α) * pointCap j) ≤ 1 / 4) + (z : MixedCoveredJetSource I rowTypes E n d) + (hz : z ∈ mixedCoveredJetRegion (E := E) U o b d + (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j))) + (hne : allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr (chart z) ≠ 0) + (s : Finset α) : + mixedCoveredRowsSiteValue rowSets d z s ∈ siteRegion := by + obtain ⟨w, hw, hp⟩ := allocatedProductSiteCutoff_small_representatives B U b S rowSets o hb bW d r hr + hR C hC hchart (chart z) hne + apply mixedCoveredRowsOfSites_reconstructed_quarter rowSets d U o b hb bW z hz w hw pointCap _ hp hbudget s + intro j + exact mul_nonneg (hC j) (mul_nonneg (by positivity) (mul_nonneg (by positivity) (hR j).le)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProjectedSpatialComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProjectedSpatialComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..011d9dcc255a5948f54e59f5a5566dfd8f36a7b2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProjectedSpatialComparison.lean @@ -0,0 +1,442 @@ +import OAI.Combinatorics.Progressions.Dynamics.SharedWidthNormalizedTupleSideBudget +import OAI.Combinatorics.Progressions.Estimates.AllocatedProjectedNormalizedComparison + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + +noncomputable def allocatedSpatialLateLog (P Q : ℝ) : ℝ := + 2 * Q + 3 + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) * allocatedAmbientLog m P + +theorem allocatedSpatialLateInputBounds + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + (C V : Fin m → ℝ≥0) {P Q W : ℝ} (hP : 0 ≤ P) (hPQ : P ≤ Q) + (hm : (m : ℝ) ≤ P) (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hcount : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) ≤ P) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (hn : ∀ j, (n j : ℝ) ≤ P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hLP : (S.value : ℝ) ≤ Real.exp P) (hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) + (hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) (hW : 0 ≤ W) (hWQ : W ≤ Real.exp Q) : + let l := allocatedSpatialLateLog (G := G) B P Q + let C₀ := 1 + (S.value : ℝ) + W + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + 0 ≤ l ∧ Q ≤ l ∧ 1 ≤ C₀ ∧ (S.value : ℝ) ≤ C₀ ∧ W ≤ C₀ ∧ + C₀ ≤ Real.exp l ∧ cap ≤ Real.exp l ∧ + allocatedPhysicalEntryBudget B U b S (fun _ => 0) ≤ Real.exp l ∧ + W ≤ Real.exp l ∧ (probabilityProfileLipschitz : ℝ) ≤ Real.exp l := by + intro l C₀ cap + have hQ : 0 ≤ Q := hP.trans hPQ + let caplog := (Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) : ℝ) * allocatedAmbientLog m P + have hcaplog : 0 ≤ caplog := mul_nonneg (Nat.cast_nonneg _) (allocatedAmbientLog_nonneg m hP) + have hleq : l = 2 * Q + 3 + caplog := rfl + have hl : 0 ≤ l := by rw [hleq]; positivity + have hQl : Q ≤ l := by linarith + have hLQ := hLP.trans (Real.exp_le_exp.mpr hPQ) + have hcapbase := (allocatedAmbientConstants_exp_bounds B R σ S.value S.positive + (fun j => Fintype.card (J j)) C V hP hm hR hσ hRP hσP hcount hI hn hJ hAP hLP hCP hVP).1 + have hcap : cap ≤ Real.exp l := by + calc + _ ≤ (Real.exp (allocatedAmbientLog m P)) ^ Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) := by + dsimp [cap] + gcongr + _ = Real.exp caplog := by rw [← Real.exp_nat_mul] + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + have hC : C₀ ≤ Real.exp l := by + have h1 : 1 ≤ Real.exp Q := Real.one_le_exp hQ + calc + _ ≤ 3 * Real.exp Q := by dsimp [C₀]; linarith + _ ≤ Real.exp 2 * Real.exp Q := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (2 : ℝ)]) (Real.exp_pos _).le + _ = Real.exp (Q + 2) := by rw [← Real.exp_add, add_comm] + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + have hvsucc : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) + 1 ≤ Real.exp Q := by + linarith [Real.add_one_le_exp Q] + have hentryeq : allocatedPhysicalEntryBudget B U b S (fun _ => 0) = + 1 + ((Fintype.card (LayerSamplerVariables G I n B) : ℝ) + 1) * S.value := by + simp [allocatedPhysicalEntryBudget, allocatedPhysicalRootBudget] + ring + have hentry : allocatedPhysicalEntryBudget B U b S (fun _ => 0) ≤ Real.exp l := by + rw [hentryeq] + calc + _ ≤ 1 + Real.exp Q * Real.exp Q := add_le_add le_rfl + (mul_le_mul hvsucc hLQ (Nat.cast_nonneg _) (Real.exp_pos _).le) + _ = 1 + Real.exp (2 * Q) := by rw [← Real.exp_add, ← two_mul] + _ ≤ Real.exp (2 * Q + 1) := one_add_le_exp_succ (by positivity) le_rfl + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + refine ⟨hl, hQl, ?_, ?_, ?_, hC, hcap, hentry, + hWQ.trans (Real.exp_le_exp.mpr hQl), hAP.trans (Real.exp_le_exp.mpr (hPQ.trans hQl))⟩ + all_goals dsimp [C₀]; linarith [Nat.cast_nonneg (α := ℝ) S.value] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory Polynomial +open scoped BigOperators Classical NNReal + +universe uX + +def allocatedSpatiallyNormalizedTupleStatement (m dim : ℕ) (keepProjection : Bool := false) : Prop := + ∃ A Amass : ℕ, 2 ≤ A ∧ 2 ≤ Amass ∧ ∀ {G : Type*} [Fintype G] [DecidableEq G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + (x : G → IntegerScalarCubeBox (Fin dim) S.value) + {P : ℝ} (_hP : 0 ≤ P) (_hG : (Fintype.card G : ℝ) ≤ P) + (_hL : (S.value : ℝ) ≤ Real.exp P) + {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) + (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) (_hdim : dim ≤ m + 1), + ∃ (d : ℕ) (hd : 0 < d), let : NeZero d := ⟨hd.ne'⟩ + (d : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ + ∀ [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (SiteTorus (Finset (Fin dim)) U)] [BorelSpace (SiteTorus (Finset (Fin dim)) U)] + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (_hσ1 : ∀ j, σ j ≤ 1) (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, R j ≤ allocatedPhysicalChartRadius (G := G) B (Fin dim) Cinv 1 j) + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)], + let O := fun j : Fin m => BoundedBooleanJet (Fin dim) (j.val + 1) + let rows := fun j => (Subtype.val : O j → Finset (Fin dim)) + let density := allocatedCoefficientDensity B U b hb o hR hσ S + let cap := (allocatedAmbientFactorCap (G := G) B R σ S.value V : ℝ) ^ + Fintype.card (CoefficientSlot (LayerSamplerVariables G I n B) m) + let cover := quotientIntegerCover (coefficientIntegerLattice U) d + let ξ := Measure.pi (fun j => Measure.pi (fun _ : BoundedBooleanJet (Fin dim) (j.val + 1) => ν j)) + ∃ g : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S) → + EuclideanJetLayers U (fun j => BoundedBooleanJet (Fin dim) (j.val + 1)) → ℝ, + (∀ y, Continuous (g y)) ∧ (∀ y z, g y z ∈ Set.Icc (0 : ℝ) cap) ∧ + (∀ y, Integrable (g y) ξ) ∧ (∀ y, (∫ z, g y z ∂ξ) = 1) ∧ + (∀ y, (realDensityMeasure μ (fun z => density (cover z))).map + (euclideanCoefficientJetMap U (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) + (fun j => (Subtype.val : BoundedBooleanJet (Fin dim) (j.val + 1) → Finset (Fin dim)))) = + realDensityMeasure ξ (g y)) ∧ + ((if keepProjection then And + (∀ y, physicalDensityProjection.{_, _, uX, 0} U + (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) d density (g y)) + else id) <| + ∀ (_hm : (m : ℝ) ≤ P) + (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (_hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + {X : Type uX} [Fintype X] [DecidableEq X] + {p Etarget : ℝ} (_hp : 0 ≤ p) (_hEtarget : 0 ≤ Etarget) + (_hvarsp : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (_hIp : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (_hnp : ∀ j, (n j : ℝ) ≤ p) + (_hJp : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (_hXp : (Fintype.card X : ℝ) ≤ p) (_hCp : ∀ j, (C j : ℝ) ≤ Real.exp p) + (_hMp : (M : ℝ) ≤ Real.exp p) + (_hmsp : ((m + 2 : ℕ) : ℝ) ≤ p), + let ξ₀ := normalizedTupleNarrowWidth X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p Etarget + let hξ := normalizedTupleNarrowWidth_pos X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p Etarget + ∀ {D : ℝ} (_hD : D ≤ Real.exp p) + {Perr Pmass : ℝ} (_hPerr : P ≤ Perr) + (_hAccuracy : allocatedCoefficientAccuracyLog m p (Etarget + 3) ≤ Perr) + (_hQ : allocatedScalarSamplingBudget m dim A P Perr ≤ Pmass) + (_hnormdim : (Fintype.card (Option (LayerSamplerVariables G I n B) × X) : ℝ) ≤ Pmass) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j e, coefficients (poly j) e ∈ U j) + (N stride : X → ℕ) (_hs : ∀ t, 0 < stride t) + {Rrank W τ : ℝ} + (hW : 0 ≤ W) (hτ : 0 < τ), + let l := allocatedSpatialLateLog (G := G) B P Pmass + let δ := normalizedTupleRadius X selection M p Etarget W + let mesh := δ / 4 + ∀ (_hWScale : W ≤ D * S.value) (_hWP : W ≤ Real.exp Pmass) + (_hξP : ξ₀⁻¹ ≤ Real.exp Pmass) + (_hτP : 1 / τ ≤ Real.exp Pmass) (_hstride : ∀ t, (stride t : ℝ) ≤ Real.exp Pmass) + (_hsize : ∀ t, Real.exp ((Pmass + Amass) ^ Amass) ≤ (N t : ℝ)) + (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun t => (N t : ℝ)) Rrank (U j) (poly j)) + (_hRank : Real.exp ((Pmass + Amass) ^ Amass) ≤ Rrank) + (_hspatialSize : ∀ t, Real.exp (normalizedTupleSideLog X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection p Etarget l) ≤ (N t : ℝ)) + (_hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (base : X → ℤ) + (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) + (_hcells : cells.Nonempty) (bases : Finset (X → ℤ)) (_hbases : bases.Nonempty) + (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) (_htest : ∀ v, ‖test v‖ ≤ 1) + {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] + (bW : ∀ j, Basis (Kcov j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + {Pc T : ℝ} (_hPc : 0 ≤ Pc) (_hPcErr : Pc ≤ Perr) (_hT : 0 ≤ T) + (_hMP : (M : ℝ) ≤ Real.exp Pc) (_hRupper : ∀ j, R j ≤ Real.exp Pc) + (_hRi : ∀ j, (R j)⁻¹ ≤ Real.exp Pc) (_hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp Pc) + (_hcountc : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ)+1 ≤ Real.exp Pc) + (_hstridec : ∀ t, (stride t : ℝ) ≤ Real.exp T) + (_hlarge : Real.exp (allocatedRefinedJointLengthLog (G := G) B (Fin dim) O Pc + (allocatedCoefficientAccuracyLog m p (Etarget + 3)) + ((m+1 : ℕ)*Pc + Fintype.card X*T)) ≤ S.value), + let widths := narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ₀ N + let baseDensity := fun (a : X → ℤ) z => density (affineSampleCoefficientTorus U + (fun j => translate (fun t => (a t : ℝ)) (poly j)) + (fun j => coefficients_translate_mem (U j) (fun t => (a t : ℝ)) (poly j) (hmem j)) + (fun k t => (z (k, t) : ℝ))) + let Z := selectedJointDensityMass bases stride cells widths baseDensity + ∃ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells widths z), + (|Z - 1| ≤ Real.exp (-Pmass) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ + 0 < Z ∧ Z⁻¹ ≤ 2) ∧ + ∃ (hN : ∀ t, 0 < N t) (modulus : ℕ) (hmodulus : 0 < modulus), + let : NeZero modulus := ⟨hmodulus.ne'⟩ + modulus ≤ M^(m+1) ∧ + (∀ root : G → ℤ, integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) ∧ + (∀ j, integerScalarLattice (O j) (modulus : ℤ) ≤ + (scalarKernelIntegerJet x (j.val+1) (rows j)).mulVecLin.range) ∧ + ∃ (s : ∀ j, O j ↪ BoundedIntegerExponent G (j.val+1)) + (hA : ∀ j, ((scalarKernelIntegerJet x (j.val+1) (rows j)).submatrix id (s j)).det ≠ 0), + let refined := residueRefinedPeriod modulus stride + (∀ j : Fin m, fixedKernelInverseBound S.positive x (j.val+1) (rows j) (s j) (hA j) (1/(M : ℝ))) ∧ + ∃ hRefined : 0 < refined, + let : NeZero refined := ⟨hRefined.ne'⟩ + (∀ t, stride t * modulus ∣ refined) ∧ + (refined : ℝ) ≤ Real.exp ((m+1 : ℕ)*Pc + Fintype.card X*T) ∧ + ∃ hlengths : ∀ t, (Fintype.card (Fin dim)+1)*refined ≤ + principalAxisLength (fun a => ¬allocatedGridAxis (I := I) U b S.value a) (allocatedPrincipalSides B U b S) t, + ∃ (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod refined) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) + (residue : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod refined) → + ∀ j, Matrix (O j) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)), + (∀ u r, principalResidueLabel refined (reference u r) = r) ∧ + (∀ u r v, (allocatedLongResidueWeights B U b S refined hRefined r hlengths).weight v ≠ 0 → ∀ j, + integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u rows j v) modulus = residue u r j) ∧ + ‖allocatedRefinedTupleDifference B U b hR hσ S x rows X hM selection hx modulus s hA + stride reference residue hb o bW d g N hN hW hτ hξ mesh base cells hmass + (physicalCubeEuclideanSample U d poly hmem) test Z‖ ≤ Real.exp (-Etarget) + ) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory +open scoped BigOperators Classical NNReal + +theorem allocatedSpatiallyNormalizedTupleComparison (m dim : ℕ) : + allocatedSpatiallyNormalizedTupleStatement m dim := by + obtain ⟨A, Amass, hA, hAmass, hactual⟩ := allocatedActualNormalizedTupleComparison m dim + unfold allocatedSpatiallyNormalizedTupleStatement + refine ⟨A, Amass, hA, hAmass, ?_⟩ + intro G _ _ I _ _ n B _ _ J _ U b R σ S x P hP hG hL M hM selection hx hdim + obtain ⟨d, hd, hdb, hconstruct⟩ := hactual B U b S x hP hG hL hM selection hx hdim + let : NeZero d := ⟨hd.ne'⟩ + refine ⟨d, hd, hdb, ?_⟩ + intro _ _ _ _ _ hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ _ _ ν _ _ + O rows density cap cover ξ + obtain ⟨g, hgc, hgb, hgi, hgm, hglaw, hdata⟩ := + hconstruct hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ ν + refine ⟨g, hgc, hgb, hgi, hgm, hglaw, ?_⟩ + intro hm hvars hRP hσP hcount hI hn hJ hAP hCP hVP X _ _ p Etarget hp hEtarget + hvarsp hIp hnp hJp hXp hCp hMp hmsp ξ₀ hξ D hD Perr Pmass hPerr hAccuracy hQ + hnormdim poly hpoly hmem N stride hs Rrank W τ hW hτ l δ mesh + hWScale hWP hξP hτP hstride hsize hrank hRank hspatialSize + hbudget base cells hcells bases hbases + test htest Kcov _ bW Pc T hPc hPcErr hT hMP hRupper hRi hσi hcountc hstridec hlarge + widths baseDensity Z + let C₀ := 1 + (S.value : ℝ) + W + let ρ := normalizedTupleResolution X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p Etarget C₀ W cap (allocatedPhysicalEntryBudget B U b S (fun _ => 0)) + have hGp : (Fintype.card G : ℝ) ≤ p := + (Nat.cast_le.mpr (Fintype.card_le_of_embedding + (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B))).trans hvarsp + have hmsp' : ((m + 1 : ℕ) : ℝ) ≤ p := by push_cast at hmsp ⊢; linarith + have hdimsp : ((dim + 1 : ℕ) : ℝ) ≤ p := by + have h : ((dim + 1 : ℕ) : ℝ) ≤ ((m + 2 : ℕ) : ℝ) := by exact_mod_cast (by omega : dim + 1 ≤ m + 2) + exact h.trans hmsp + have hentry : 0 ≤ allocatedPhysicalEntryBudget B U b S (fun _ => 0) := + (by norm_num : (0 : ℝ) ≤ 1).trans (allocatedPhysicalEntryBudget_one_le B U b S (fun _ => 0)) + have hcap : 0 ≤ cap := by dsimp [cap]; positivity + obtain ⟨_, _, _, hPerrBudget⟩ := + allocatedScalarSamplingBudget_bounds m dim A hP (hP.trans hPerr) + have hPPmass : P ≤ Pmass := hPerr.trans (hPerrBudget.trans hQ) + obtain ⟨hl, hMassl, hC₀, hLC, hWC, hC₀l, hcapl, hentryl, hWl, hprofilel⟩ := + allocatedSpatialLateInputBounds B U b S C V hP hPPmass hm hvars hR hσ hRP hσP + hcount hI hn hJ hAP hL hCP hVP hW hWP + have hspatial (t : X) : 8 * (1 + W) * (stride t : ℝ) * ρ ≤ (ξ₀ * τ) * (N t : ℝ) := by + exact normalizedTupleSpatialSize X (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + hp hEtarget hl hM hmsp' hdimsp hGp hXp hMp (by linarith) hW hcap hentry + hC₀l hWl hcapl hentryl hprofilel (Nat.cast_nonneg _) + ((hstride t).trans (Real.exp_le_exp.mpr hMassl)) hτ + (by simpa only [one_div] using hτP.trans (Real.exp_le_exp.mpr hMassl)) (hspatialSize t) + obtain ⟨_, hξ1, _, hchoices⟩ := normalizedTupleSpatialChoices + (N := PrincipalTupleIndex B (layerSamplerDegree I n)) (X := X) (m := m) + selection hM hp hEtarget hmsp' hdimsp hGp hXp hMp + obtain ⟨hδ, _, hmesh, hρ, hmeshSize, hρ8, hρshift, hρmove, hboundary, hsite⟩ := + hchoices (C₀ := C₀) (W := W) (L := (S.value : ℝ)) (Cg := cap) + (Centry := allocatedPhysicalEntryBudget B U b S (fun _ => 0)) + (by linarith) hW (by exact_mod_cast S.positive) hcap hentry hD hWScale + have hρshift' : 2 * (Fintype.card (Option (LayerSamplerVariables G I n B)) * + (2 * allocatedPhysicalEntryBudget B U b S (fun _ => 0))) ≤ ρ := by + simpa only [mul_assoc] using hρshift + have hEplus : 0 ≤ Etarget + 2 := by linarith + have heq : (Etarget + 2) + 1 = Etarget + 3 := by ring + have hAccuracy' : allocatedCoefficientAccuracyLog m p ((Etarget + 2) + 1) ≤ Perr := by + simpa only [heq] using hAccuracy + have hlarge' := hlarge + rw [← heq] at hlarge' + obtain ⟨hmass, hnormal, hN, modulus, hmodulus, hrest⟩ := + hdata hm hvars hRP hσP hcount hI hn hJ hAP hCP hVP hp hEplus + hvarsp hIp hnp hJp hXp hCp hMp hD hPerr hAccuracy' hQ hnormdim + poly hpoly hmem N stride hs hW hτ hξ hξ1 hρ hWScale hWP hξP hτP hstride + hsize hrank hRank hspatial hρ8 hρshift' hbudget hC₀ hLC hWC hmeshSize + hδ.le hρmove hmesh base cells hcells bases hbases test htest bW + hPc hPcErr hT hMP hRupper hRi hσi hcountc hstridec hlarge' + let : NeZero modulus := ⟨hmodulus.ne'⟩ + obtain ⟨hmod, hspatialPeriod, hperiod, s, hsA, hi, hrest⟩ := hrest + obtain ⟨hRefined, hdiv, hbound, hlengths, reference, residue, href, hr, hcompare⟩ := hrest + let : NeZero (residueRefinedPeriod modulus stride) := ⟨hRefined.ne'⟩ + refine ⟨hmass, hnormal, hN, modulus, hmodulus, hmod, hspatialPeriod, hperiod, + s, hsA, hi, hRefined, hdiv, hbound, hlengths, reference, residue, href, hr, ?_⟩ + exact allocatedRefinedTupleDifference_exp_bound B U b hR hσ S x rows X hM selection hx + modulus s hsA stride reference residue hb o bW d g N hN hW hτ hξ C₀ ρ δ mesh + base cells hmass (physicalCubeEuclideanSample U d poly hmem) test cap Z + hnormal.2.1.1 hcompare hboundary (hsite modulus hmod) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory +open scoped BigOperators Classical NNReal + +theorem allocatedSpatiallyNormalizedTupleComparison_withProjection (m dim : ℕ) : + allocatedSpatiallyNormalizedTupleStatement m dim true := by + obtain ⟨A, Amass, hA, hAmass, hactual⟩ := allocatedActualNormalizedTupleComparison_withProjection m dim + unfold allocatedSpatiallyNormalizedTupleStatement + refine ⟨A, Amass, hA, hAmass, ?_⟩ + intro G _ _ I _ _ n B _ _ J _ U b R σ S x P hP hG hL M hM selection hx hdim + obtain ⟨d, hd, hdb, hconstruct⟩ := hactual B U b S x hP hG hL hM selection hx hdim + let : NeZero d := ⟨hd.ne'⟩ + refine ⟨d, hd, hdb, ?_⟩ + intro _ _ _ _ _ hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ _ _ ν _ _ + O rows density cap cover ξ + obtain ⟨g, hgc, hgb, hgi, hgm, hglaw, hprojection, hdata⟩ := + hconstruct hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ ν + refine ⟨g, hgc, hgb, hgi, hgm, hglaw, hprojection, ?_⟩ + intro hm hvars hRP hσP hcount hI hn hJ hAP hCP hVP X _ _ p Etarget hp hEtarget + hvarsp hIp hnp hJp hXp hCp hMp hmsp ξ₀ hξ D hD Perr Pmass hPerr hAccuracy hQ + hnormdim poly hpoly hmem N stride hs Rrank W τ hW hτ l δ mesh + hWScale hWP hξP hτP hstride hsize hrank hRank hspatialSize + hbudget base cells hcells bases hbases + test htest Kcov _ bW Pc T hPc hPcErr hT hMP hRupper hRi hσi hcountc hstridec hlarge + widths baseDensity Z + let C₀ := 1 + (S.value : ℝ) + W + let ρ := normalizedTupleResolution X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p Etarget C₀ W cap (allocatedPhysicalEntryBudget B U b S (fun _ => 0)) + have hGp : (Fintype.card G : ℝ) ≤ p := + (Nat.cast_le.mpr (Fintype.card_le_of_embedding + (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B))).trans hvarsp + have hmsp' : ((m + 1 : ℕ) : ℝ) ≤ p := by push_cast at hmsp ⊢; linarith + have hdimsp : ((dim + 1 : ℕ) : ℝ) ≤ p := by + have h : ((dim + 1 : ℕ) : ℝ) ≤ ((m + 2 : ℕ) : ℝ) := by exact_mod_cast (by omega : dim + 1 ≤ m + 2) + exact h.trans hmsp + have hentry : 0 ≤ allocatedPhysicalEntryBudget B U b S (fun _ => 0) := + (by norm_num : (0 : ℝ) ≤ 1).trans (allocatedPhysicalEntryBudget_one_le B U b S (fun _ => 0)) + have hcap : 0 ≤ cap := by dsimp [cap]; positivity + obtain ⟨_, _, _, hPerrBudget⟩ := + allocatedScalarSamplingBudget_bounds m dim A hP (hP.trans hPerr) + have hPPmass : P ≤ Pmass := hPerr.trans (hPerrBudget.trans hQ) + obtain ⟨hl, hMassl, hC₀, hLC, hWC, hC₀l, hcapl, hentryl, hWl, hprofilel⟩ := + allocatedSpatialLateInputBounds B U b S C V hP hPPmass hm hvars hR hσ hRP hσP + hcount hI hn hJ hAP hL hCP hVP hW hWP + have hspatial (t : X) : 8 * (1 + W) * (stride t : ℝ) * ρ ≤ (ξ₀ * τ) * (N t : ℝ) := by + exact normalizedTupleSpatialSize X (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + hp hEtarget hl hM hmsp' hdimsp hGp hXp hMp (by linarith) hW hcap hentry + hC₀l hWl hcapl hentryl hprofilel (Nat.cast_nonneg _) + ((hstride t).trans (Real.exp_le_exp.mpr hMassl)) hτ + (by simpa only [one_div] using hτP.trans (Real.exp_le_exp.mpr hMassl)) (hspatialSize t) + obtain ⟨_, hξ1, _, hchoices⟩ := normalizedTupleSpatialChoices + (N := PrincipalTupleIndex B (layerSamplerDegree I n)) (X := X) (m := m) + selection hM hp hEtarget hmsp' hdimsp hGp hXp hMp + obtain ⟨hδ, _, hmesh, hρ, hmeshSize, hρ8, hρshift, hρmove, hboundary, hsite⟩ := + hchoices (C₀ := C₀) (W := W) (L := (S.value : ℝ)) (Cg := cap) + (Centry := allocatedPhysicalEntryBudget B U b S (fun _ => 0)) + (by linarith) hW (by exact_mod_cast S.positive) hcap hentry hD hWScale + have hρshift' : 2 * (Fintype.card (Option (LayerSamplerVariables G I n B)) * + (2 * allocatedPhysicalEntryBudget B U b S (fun _ => 0))) ≤ ρ := by + simpa only [mul_assoc] using hρshift + have hEplus : 0 ≤ Etarget + 2 := by linarith + have heq : (Etarget + 2) + 1 = Etarget + 3 := by ring + have hAccuracy' : allocatedCoefficientAccuracyLog m p ((Etarget + 2) + 1) ≤ Perr := by + simpa only [heq] using hAccuracy + have hlarge' := hlarge + rw [← heq] at hlarge' + obtain ⟨hmass, hnormal, hN, modulus, hmodulus, hrest⟩ := + hdata hm hvars hRP hσP hcount hI hn hJ hAP hCP hVP hp hEplus + hvarsp hIp hnp hJp hXp hCp hMp hD hPerr hAccuracy' hQ hnormdim + poly hpoly hmem N stride hs hW hτ hξ hξ1 hρ hWScale hWP hξP hτP hstride + hsize hrank hRank hspatial hρ8 hρshift' hbudget hC₀ hLC hWC hmeshSize + hδ.le hρmove hmesh base cells hcells bases hbases test htest bW + hPc hPcErr hT hMP hRupper hRi hσi hcountc hstridec hlarge' + let : NeZero modulus := ⟨hmodulus.ne'⟩ + obtain ⟨hmod, hspatialPeriod, hperiod, s, hsA, hi, hrest⟩ := hrest + obtain ⟨hRefined, hdiv, hbound, hlengths, reference, residue, href, hr, hcompare⟩ := hrest + let : NeZero (residueRefinedPeriod modulus stride) := ⟨hRefined.ne'⟩ + refine ⟨hmass, hnormal, hN, modulus, hmodulus, hmod, hspatialPeriod, hperiod, + s, hsA, hi, hRefined, hdiv, hbound, hlengths, reference, residue, href, hr, ?_⟩ + exact allocatedRefinedTupleDifference_exp_bound B U b hR hσ S x rows X hM selection hx + modulus s hsA stride reference residue hb o bW d g N hN hW hτ hξ C₀ ρ δ mesh + base cells hmass (physicalCubeEuclideanSample U d poly hmem) test cap Z + hnormal.2.1.1 hcompare hboundary (hsite modulus hmod) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProxyOutputSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProxyOutputSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..93a693db1c2437725849f75370d18e8e9733add3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedProxyOutputSupport.lean @@ -0,0 +1,82 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedProxyOutputBounds +import OAI.Combinatorics.Progressions.Linear.AllocatedKernelSupport + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Matrix NNReal Classical + +variable {m : ℕ} {G : Type*} [Fintype G] [dG : DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 α] (x : G → IntegerScalarCubeBox α S.value) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] +variable (rows : ∀ j, O j → Finset α) +variable (s : ∀ j, O j ↪ BoundedIntegerExponent G (j.val + 1)) +variable (hA : ∀ j, ((scalarKernelIntegerJet x (j.val + 1) (rows j)).submatrix id (s j)).det ≠ 0) +variable {M : ℕ} (hM : 0 < M) +variable (hi : ∀ j : Fin m, + fixedKernelInverseBound S.positive x (j.val + 1) (rows j) (s j) (hA j) (1 / (M : ℝ))) +variable {P : ℝ} (hP : 0 ≤ P) (hMP : (M : ℝ) ≤ Real.exp P) +variable (hRP : ∀ j, R j ≤ Real.exp P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) +variable (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) +variable (hcount : ∀ j : Fin m, (Fintype.card + (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) + 1 ≤ Real.exp P) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S)) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "radius" => Real.exp (allocatedJetSupportLog (G := G) B α O P) +local notation "input" => PrincipalAxisParameter (B := B) (h := layerSamplerDegree I n) + (α := α) (fun a => ¬grid a) +local notation "output" => (Σ a : {a // ¬grid a}, O (Sigma.fst (Subtype.val a))) + +include hR hσ hM hi hP hMP hRP hRi hσi hcount + +theorem allocatedNormalizedLongJetFactor_zero_off_ball (hσ1 : ∀ j, σ j ≤ 1) + (y : input → ℝ) (hy : ‖y‖ ≤ 1) (a : {a // ¬grid a}) + (z : O a.val.1 → ℝ) (hz : radius < ‖z‖) : + allocatedNormalizedLongJetFactor B U basis S x u rows s hA y a z = 0 := by + cases Subsingleton.elim dG (Classical.decEq G) + rcases a with ⟨⟨j, a⟩, ha⟩ + cases a with + | inl i => + exact allocatedContinuousKernelDensity_zero_off_box B U basis hR hσ S x rows s hA + hM hi hP hMP hRP hRi hσi hcount u hσ1 j i y hy z hz + | inr i => + have hr := allocatedKernelRadius_bound B U basis hR hσ S x rows s hA + hM hi hP hMP hRP hRi hσi hcount j + (Nat.cast_pos.mpr (basisAxisScale_pos (basis j) i)) + exact allocatedIntegerKernelDensity_support_data B U basis hR hσ S j x u + (rows j) (s j) (hA j) i (hσ1 j) y hy z (hr.trans_lt hz) + +theorem allocatedNormalizedLongJetDensity_zero_off_ball (hσ1 : ∀ j, σ j ≤ 1) + (y : input → ℝ) (hy : ‖y‖ ≤ 1) (v : output → ℝ) (hv : radius < ‖v‖) : + allocatedNormalizedLongJetDensity B U basis S x u rows s hA y v = 0 := + sigmaAxisWeight_zero_outside _ (Real.exp_pos _).le + (allocatedNormalizedLongJetFactor_zero_off_ball B U basis hR hσ S x rows s hA + hM hi hP hMP hRP hRi hσi hcount u hσ1 y hy) v hv + +theorem allocatedContinuousLongJetProxy_zero_off_ball (hσ1 : ∀ j, σ j ≤ 1) + (v : output → ℝ) (hv : radius < ‖v‖) : + allocatedContinuousLongJetProxy B U basis S x u rows s hA v = 0 := by + apply integral_eq_zero_of_ae + filter_upwards [jointBooleanSource_ae_closedBall (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val)] with y hy + exact allocatedNormalizedLongJetDensity_zero_off_ball B U basis hR hσ S x rows s hA + hM hi hP hMP hRP hRi hσi hcount u hσ1 y + (by simpa only [Metric.mem_closedBall, dist_zero_right] using hy) v hv + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedQuotientSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedQuotientSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..26d38cfdc03ebd3f9a3d6516fb124458cb533eb7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedQuotientSupport.lean @@ -0,0 +1,103 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedShortAxis + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory Module Submodule + +variable {D I J V : Type*} [Fintype D] [Fintype I] [Fintype J] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) +variable (Pz : Fin n → Finset J) (j₀ : J) (h L s : ℕ) (hh : 0 < h) (hL : 0 < L) +variable (T : V → ℝ) (hT : ∀ v, 1 ≤ T v) (hTL : ∀ v, T v ≤ L) +variable (e : J → V →₀ ℕ) (he : ∀ j, (e j).sum (fun _ n => n) ≤ s) +variable (R σ : ℝ) (hR : 0 < R) (hσ : 0 < σ) +variable (hgap : ∀ i, L ^ h < basisAxisScale b i → + (principalSamplingGapRatio (principalProfileSize R (Pz i).card) * L) ^ h ≤ basisAxisScale b i) +variable (hεL : 8 * (probabilityProfileLipschitz : ℝ) ≤ tailProfileSize R σ (Fintype.card J) * L) +variable (Pc : I → Finset J) +variable (hb : span ℤ (Set.range b) = projectedIntegerLattice W) (o : OrthonormalBasis I ℝ W) + +local notation "intLaws" => allocatedProjectionPMFs W b Pz j₀ h L s hh hL T hT hTL e he R σ hR hσ hgap hεL +local notation "source" => allocatedMixedArrayLaw W b Pz j₀ h L s hh hL T hT hTL e he R σ hR hσ hgap hεL Pc + +noncomputable def allocatedQuotientDensity : + (J → W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup) → ℝ := + canonicalArrayDensity W b hb o (allocatedArrayCenters e T Pc R) + (allocatedArrayWidths e T Pc j₀ R σ) intLaws + +local notation "density" => allocatedQuotientDensity W b Pz j₀ h L s hh hL T hT hTL e he R σ hR hσ hgap hεL Pc hb o + +theorem allocatedQuotientDensity_measurable : Measurable density := + canonicalArrayDensity_measurable W b hb o _ _ _ + +theorem allocatedQuotientDensity_spec + [IsZLattice ℝ (latticeSection (standardEuclideanLattice D) W)] + (μ : Measure (W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup)) + [IsProbabilityMeasure μ] [μ.IsAddLeftInvariant] + (hc₀ : ∀ i, j₀ ∉ Pc i) (hz₀ : ∀ i, j₀ ∉ Pz i) (he₀ : e j₀ = 0) (hσ1 : σ ≤ 1) + (hprincipal : ∀ i j, j ∈ Pz i → monomialScale T (e j) = + (integerAxisSideLength h (basisAxisScale b i) L (principalProfileSize R (Pz i).card) : ℝ) ^ h) + {C : ℝ} (hC : 0 ≤ C) + (hchart : ∀ v, ‖(normalizedOrthogonalChart W b).symm v‖ ≤ C * ‖v‖) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1 / 4) : + Measurable density ∧ (∀ y, 0 ≤ density y) ∧ Integrable density (Measure.pi (fun _ : J => μ)) ∧ + (∫ y, density y ∂Measure.pi (fun _ : J => μ)) = 1 ∧ + Measure.map (mixedArrayQuotient W b hb o) source = realDensityMeasure (Measure.pi (fun _ : J => μ)) density := by + have hT0 : ∀ v, 0 < T v := fun v => lt_of_lt_of_le zero_lt_one (hT v) + have hw := allocatedArrayWidths_pos e T hT0 Pc j₀ hR hσ + have hs := allocatedArrayColumns_chart W b Pz j₀ h L s hh hL T hT hTL e he R σ hR hσ + hgap hεL Pc o hc₀ hz₀ he₀ hσ1 hprincipal hC hchart hsmall + have hm := canonicalArrayDensity_mass W b hb o μ (allocatedArrayCenters e T Pc R) + (allocatedArrayWidths e T Pc j₀ R σ) hw intLaws hs + refine ⟨canonicalArrayDensity_measurable W b hb o _ _ _, + canonicalArrayDensity_nonneg W b hb o _ _ hw _, hm.1, hm.2, ?_⟩ + unfold allocatedMixedArrayLaw + rw [allocatedArrayLaw_rows e T hT0 Pc j₀ hR hσ intLaws] + exact canonicalArrayDensity_law W b hb o μ _ _ hw intLaws hs + +theorem allocatedQuotientDensity_recover + (hc₀ : ∀ i, j₀ ∉ Pc i) (hz₀ : ∀ i, j₀ ∉ Pz i) (he₀ : e j₀ = 0) (hσ1 : σ ≤ 1) + (hprincipal : ∀ i j, j ∈ Pz i → monomialScale T (e j) = + (integerAxisSideLength h (basisAxisScale b i) L (principalProfileSize R (Pz i).card) : ℝ) ^ h) + {C : ℝ} (hC : 0 ≤ C) + (hchart : ∀ v, ‖(normalizedOrthogonalChart W b).symm v‖ ≤ C * ‖v‖) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1 / 4) + {y : J → W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup} (hy : density y ≠ 0) : + ∃! a : (I → J → ℝ) × (Fin n → J → ℤ), + (mixedArrayQuotient W b hb o a = y ∧ mixedArrayInChart W b o a ∧ + mixedArraySupported (allocatedArrayCenters e T Pc R) (allocatedArrayWidths e T Pc j₀ R σ) intLaws a) ∧ + ∀ x : V → ℝ, (∀ v, |x v| ≤ T v) → mixedPolynomialPoint W b o e a.1 a.2 x ∈ standardLatticeSmallBox D := by + obtain ⟨a, ha, hu⟩ := canonicalArrayDensity_recover_unique W b hb o + (allocatedArrayCenters e T Pc R) (allocatedArrayWidths e T Pc j₀ R σ) intLaws hy + refine ⟨a, ⟨ha, ?_⟩, fun z hz => hu z hz.1⟩ + exact allocatedArraySupported_polynomial_chart W b Pz j₀ h L s hh hL T hT hTL e he R σ hR hσ + hgap hεL Pc o hc₀ hz₀ he₀ hσ1 hprincipal hC hchart hsmall a ha.2.2 + +theorem allocatedQuotientDensity_nonzero_iff + [IsZLattice ℝ (latticeSection (standardEuclideanLattice D) W)] + (hc₀ : ∀ i, j₀ ∉ Pc i) (hz₀ : ∀ i, j₀ ∉ Pz i) (he₀ : e j₀ = 0) (hσ1 : σ ≤ 1) + (hprincipal : ∀ i j, j ∈ Pz i → monomialScale T (e j) = + (integerAxisSideLength h (basisAxisScale b i) L (principalProfileSize R (Pz i).card) : ℝ) ^ h) + {C : ℝ} (hC : 0 ≤ C) + (hchart : ∀ v, ‖(normalizedOrthogonalChart W b).symm v‖ ≤ C * ‖v‖) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1 / 4) + (y : J → W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup) : + density y ≠ 0 ↔ ∃ a : (I → J → ℝ) × (Fin n → J → ℤ), + (mixedArrayQuotient W b hb o a = y ∧ mixedArrayInChart W b o a ∧ + mixedArraySupported (allocatedArrayCenters e T Pc R) (allocatedArrayWidths e T Pc j₀ R σ) intLaws a) ∧ + ∀ x : V → ℝ, (∀ v, |x v| ≤ T v) → mixedPolynomialPoint W b o e a.1 a.2 x ∈ standardLatticeSmallBox D := by + constructor + · intro hy + exact (allocatedQuotientDensity_recover W b Pz j₀ h L s hh hL T hT hTL e he R σ hR hσ + hgap hεL Pc hb o hc₀ hz₀ he₀ hσ1 hprincipal hC hchart hsmall hy).exists + · rintro ⟨a, ha, _⟩ + exact (canonicalArrayDensity_nonzero_iff W b hb o _ _ intLaws y).mpr ⟨a, ha⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredChartSlow.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredChartSlow.lean new file mode 100644 index 0000000000000000000000000000000000000000..fac78af94441416396739c5f16ae7463720b3e87 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredChartSlow.lean @@ -0,0 +1,118 @@ +import OAI.Combinatorics.Progressions.Estimates.RealSymbolGradedCoefficientBound +import OAI.Combinatorics.Progressions.Probability.AllocatedRecoveredChartMass + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule BooleanCubeKernel _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {m : ℕ} {G : Type*} {X : Type} [Fintype G] {I E : Fin m → Type*} {J : Fin m → Type} +variable [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_pulled_slow + [Fintype X] + {L ι : Type} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (basis : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (basis '' {i | j ≤ ω i})) + (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (N : X → ℕ) (hN : ∀ x, 0 < N x) + {budget : ℝ} (hcontrol : NilpotentLieFiltration.FullChartControlledFactors F basis ω hF J poly N left right budget) + {τ ξ : ℝ} (hτ : 0 < τ) (hτ1 : τ ≤ 1) (hξ : ξ ≤ 1) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (hv : v ∈ rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ N) 1) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ C j * ‖x‖) + (hsmall : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ 1) + + : F.SymbolSlowBound basis ω hF (fun _ : LayerSamplerVariables G I n B => 1) + (layerSamplerBox B U b S) + (((s : ℝ) + 1) * ((Fintype.card (X ⊕ (Σ j, J j)) : ℝ) + 1) ^ s * + Real.exp budget * + (((m + 1 : ℕ) : ℝ) * ((Fintype.card (LayerSamplerVariables G I n B) + 1 : ℕ) : ℝ) ^ m) ^ s) + (F.realSymbolHomogeneousPullbackHom basis ω hF (fullTaggedVariableWeight (X := X) J) + (fun _ : LayerSamplerVariables G I n B => 1) + (fun z => homogeneousComponent (fullTaggedVariableWeight J z) + (integerSampledRealChart (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) z)) + (fun _ => weightedHomogeneousComponent_isWeightedHomogeneous _ _) left) := by + apply NilpotentLieFiltration.FullChartControlledFactors.homogeneousPullback_slow + F basis ω hF J poly N left right hcontrol + · intro k + exact lt_of_lt_of_le zero_lt_one (layerSamplerBox_one_le B U b S k) + · have hdim : (1 : ℝ) ≤ ((Fintype.card (LayerSamplerVariables G I n B) + 1 : ℕ) : ℝ) := by + exact_mod_cast Nat.succ_le_succ (Nat.zero_le _) + have hm : (1 : ℝ) ≤ ((m + 1 : ℕ) : ℝ) := by exact_mod_cast Nat.succ_pos m + simpa only [one_mul] using + mul_le_mul hm (one_le_pow₀ hdim (n := m)) (by norm_num : (0 : ℝ) ≤ 1) (by positivity) + · exact h.integerFullChart_normalized_top_mass B U b hb o S hR hσ poly hm hp c a N hN + hτ hτ1 hξ v hv sample read hσ1 C hC hchart hsmall + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_frozen_pulled_slow + [Fintype X] + {L ι : Type} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (basis : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (basis '' {i | j ≤ ω i})) + (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (N : X → ℕ) (hN : ∀ x, 0 < N x) + {budget : ℝ} (hcontrol : NilpotentLieFiltration.FullChartControlledFactors F basis ω hF J poly N left right budget) + {τ ξ : ℝ} (hτ : 0 < τ) (hτ1 : τ ≤ 1) (hξ : ξ ≤ 1) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (hv : v ∈ rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ N) 1) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ C j * ‖x‖) + (hsmall : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ 1) + + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) + : F.SymbolSlowBound basis ω hF (fun _ : {i : LayerSamplerVariables G I n B // keep i} => 1) + (fun i : {i // keep i} => layerSamplerBox B U b S i.val) + (((s : ℝ) + 1) * ((Fintype.card (X ⊕ (Σ j, J j)) : ℝ) + 1) ^ s * + Real.exp budget * + (((m + 1 : ℕ) : ℝ) * ((Fintype.card (LayerSamplerVariables G I n B) + 1 : ℕ) : ℝ) ^ m) ^ s) + (F.realSymbolHomogeneousPullbackHom basis ω hF (fullTaggedVariableWeight (X := X) J) + (fun _ : {i : LayerSamplerVariables G I n B // keep i} => 1) + (fun z => homogeneousComponent (fullTaggedVariableWeight J z) + (integerSampledRealChart (fun z => freezePolynomial keep fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample z)) z)) + (fun _ => weightedHomogeneousComponent_isWeightedHomogeneous _ _) left) := by + apply NilpotentLieFiltration.FullChartControlledFactors.homogeneousPullback_slow + F basis ω hF J poly N left right hcontrol + · intro k + exact lt_of_lt_of_le zero_lt_one (layerSamplerBox_one_le B U b S k.val) + · have hdim : (1 : ℝ) ≤ ((Fintype.card (LayerSamplerVariables G I n B) + 1 : ℕ) : ℝ) := by + exact_mod_cast Nat.succ_le_succ (Nat.zero_le _) + have hm : (1 : ℝ) ≤ ((m + 1 : ℕ) : ℝ) := by exact_mod_cast Nat.succ_pos m + simpa only [one_mul] using + mul_le_mul hm (one_le_pow₀ hdim (n := m)) (by norm_num : (0 : ℝ) ≤ 1) (by positivity) + · exact h.integerFullChart_frozen_normalized_top_mass B U b hb o S hR hσ poly hm hp c a N hN + hτ hτ1 hξ v hv sample read hσ1 C hC hchart hsmall keep fixed + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredNormalizedTopChart.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredNormalizedTopChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1014095eed86b2b31f0c1e8bf9ea3bf702bfe93 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredNormalizedTopChart.lean @@ -0,0 +1,203 @@ +import OAI.Combinatorics.Progressions.Estimates.HomogeneousComponentTopSubstitution +import OAI.Combinatorics.Progressions.Geometry.FullTaggedChartCoefficientRange +import OAI.Combinatorics.Progressions.Lattices.AllocatedRecoveredIntegerFullChart +import OAI.Combinatorics.Progressions.Lattices.IntegerFrozenChart + +namespace OAI + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial + +theorem aeval_frozen_integer_top {σ K : Type*} + (w : σ → ℕ) (β : σ → MvPolynomial K ℤ) + (hβ : ∀ z, MvPolynomial.map (Int.castRingHom ℝ) (β z) ∈ + weightedSupportLE (fun _ => 1) (w z)) + (keep : K → Prop) (fixed : {i // ¬keep i} → ℤ) + (p : MvPolynomial σ ℝ) : + aeval (fun z => homogeneousComponent (w z) + (MvPolynomial.map (Int.castRingHom ℝ) (freezePolynomial keep fixed (β z)))) p = + freezePolynomial keep (0 : {i // ¬keep i} → ℝ) + (aeval (fun z => homogeneousComponent (w z) + (MvPolynomial.map (Int.castRingHom ℝ) (β z))) p) := by + simp_rw [freezePolynomial_map, freezePolynomial_top keep _ + ((mem_weightedSupportLE_one_iff _ _).mp (hβ _))] + exact (MvPolynomial.comp_aeval_apply _ (freezePolynomial keep 0) p).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial + +theorem normalizedRealPolynomialChart_top_inr + {X Tags K : Type*} (weight : Tags → ℕ) (N : X → ℝ) + (poly : Tags → MvPolynomial X ℝ) + (hp : ∀ i, poly i ∈ weightedSupportLE (fun _ : X => 1) (weight i)) + (β : X ⊕ Tags → MvPolynomial K ℝ) + (hβ : ∀ z, β z ∈ weightedSupportLE (fun _ : K => 1) + (Sum.elim (fun _ : X => 1) weight z)) (i : Tags) : + aeval (fun z => homogeneousComponent (Sum.elim (fun _ : X => 1) weight z) (β z)) + (normalizedRealPolynomialChart N (fun i => homogeneousComponent (weight i) (poly i)) + (Sum.inr i)) = + homogeneousComponent (weight i) (β (Sum.inr i) - aeval (fun x => β (Sum.inl x)) (poly i)) := by + rw [normalizedRealPolynomialChart_inr, map_sub, aeval_X, aeval_rename, map_sub] + congr 1 + exact (weightedTop_aeval (fun _ : X => 1) (fun _ : K => 1) + (fun x => β (Sum.inl x)) (fun x => hβ (Sum.inl x)) (poly i) (weight i) (hp i)).symm + +end Erdos3 + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {m : ℕ} {G X : Type*} [Fintype G] {I E J : Fin m → Type*} +variable [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_polynomial_remainder + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (j : Fin m) (i : J j) : + aeval (fun x => integerSampledRealChart + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) (Sum.inl x)) + (coordinate (LinearMap.proj i : (J j → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom (poly j)) - + C ((c j).val i) = + mixedLiftPolynomial (euclideanSubspace (U j)) (b j) (o j) Subtype.val (sample j) i + + integerSampledRealChart + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) (Sum.inr ⟨j, i⟩) := by + apply MvPolynomial.funext + intro x + rw [map_sub, map_add, eval_C, mixedLiftPolynomial_eval] + change aeval x (aeval _ _) - _ = _ + rw [comp_aeval_apply] + simp only [aeval_eq_eval] + rw [← coordinate_eval₂] + have hspatial : (fun z => aeval x (integerSampledRealChart + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) (Sum.inl z))) = + (fun z => (jointIntegerFrame (a, v) none z : ℝ) + + ∑ k, (jointIntegerFrame (a, v) (some k) z : ℝ) * x k) := by + funext z + change aeval x (MvPolynomial.map (Int.castRingHom ℝ) + (affineFramePolynomial (jointIntegerFrame (a, v)) z)) = _ + rw [affineFramePolynomial_map, affineFramePolynomial_eval] + rfl + have hspatial' := hspatial + simp only [aeval_eq_eval] at hspatial' + rw [hspatial'] + have heval := eval₂_algebraMap (S := ℝ) + (fun z => (jointIntegerFrame (a, v) none z : ℝ) + + ∑ k, (jointIntegerFrame (a, v) (some k) z : ℝ) * x k) (poly j) + have heval' : eval₂ (fun z => (jointIntegerFrame (a, v) none z : ℝ) + + ∑ k, (jointIntegerFrame (a, v) (some k) z : ℝ) * x k) (poly j) = + eval (fun z => (jointIntegerFrame (a, v) none z : ℝ) + + ∑ k, (jointIntegerFrame (a, v) (some k) z : ℝ) * x k) (poly j) := by + simpa using heval + rw [heval'] + exact h.integerFullChart_remainder B U b hb o S hR hσ poly hm hp c a v sample read x j i + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_normalized_top_tag + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (N : X → ℝ) (j : Fin m) (i : J j) : + aeval (fun z => homogeneousComponent (fullTaggedVariableWeight J z) + (integerSampledRealChart + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) z)) + (normalizedRealPolynomialChart N (fullTaggedMajorTopCoordinates J poly) (Sum.inr ⟨j, i⟩)) = + -homogeneousComponent (j.val + 1) + (mixedLiftPolynomial (euclideanSubspace (U j)) (b j) (o j) Subtype.val (sample j) i) := by + have hdegree (z : Σ j, J j) : + coordinate (LinearMap.proj z.2 : (J z.1 → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom (poly z.1) ∈ + weightedSupportLE (fun _ : X => 1) (z.1.val + 1) := by + apply (mem_weightedSupportLE_iff _ _ _).mpr + apply (scalar_weightedDegree_le_iff _ _ _).mpr + intro α hα + rw [coeff_coordinate, hp z.1 α hα, map_zero] + change aeval (fun z => homogeneousComponent + (Sum.elim (fun _ : X => 1) (fun z : Σ j, J j => z.1.val + 1) z) + (integerSampledRealChart (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) z)) + (normalizedRealPolynomialChart N + (fun z : Σ j, J j => homogeneousComponent (z.1.val + 1) + (coordinate (LinearMap.proj z.2 : (J z.1 → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom (poly z.1))) + (Sum.inr ⟨j, i⟩)) = _ + rw [normalizedRealPolynomialChart_top_inr (fun z : Σ j, J j => z.1.val + 1) N + (fun z => coordinate (LinearMap.proj z.2 : (J z.1 → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom (poly z.1)) + hdegree _ (allocatedRecoveredIntegerFullChart_support B U b o poly hm c a v sample)] + have heq := h.integerFullChart_polynomial_remainder B U b hb o S hR hσ poly hm + hp c a v sample read j i + have hres : integerSampledRealChart + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) (Sum.inr ⟨j, i⟩) - + aeval (fun x => integerSampledRealChart + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) (Sum.inl x)) + (coordinate (LinearMap.proj i : (J j → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom (poly j)) = + -mixedLiftPolynomial (euclideanSubspace (U j)) (b j) (o j) Subtype.val (sample j) i - + C ((c j).val i) := by linear_combination -heq + rw [hres, map_sub, map_neg] + have hcenter : homogeneousComponent (j.val + 1) + (C ((c j).val i) : MvPolynomial (LayerSamplerVariables G I n B) ℝ) = 0 := by + apply homogeneousComponent_eq_zero + simp + rw [hcenter, sub_zero] + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_frozen_normalized_top_tag + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) + (N : X → ℝ) (j : Fin m) (i : J j) : + aeval (fun z => homogeneousComponent (fullTaggedVariableWeight J z) + (integerSampledRealChart + (fun z => freezePolynomial keep fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample z)) z)) + (normalizedRealPolynomialChart N (fullTaggedMajorTopCoordinates J poly) (Sum.inr ⟨j, i⟩)) = + -homogeneousComponent (j.val + 1) + (freezePolynomial keep (fun i => (fixed i : ℝ)) + (mixedLiftPolynomial (euclideanSubspace (U j)) (b j) (o j) Subtype.val (sample j) i)) := by + change aeval (fun z => homogeneousComponent (fullTaggedVariableWeight J z) + (MvPolynomial.map (Int.castRingHom ℝ) (freezePolynomial keep fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample z)))) _ = _ + rw [aeval_frozen_integer_top (fullTaggedVariableWeight J) + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) + (allocatedRecoveredIntegerFullChart_support B U b o poly hm c a v sample)] + have htop := h.integerFullChart_normalized_top_tag B U b hb o S hR hσ poly hm + hp c a v sample read N j i + simp only [integerSampledRealChart] at htop + rw [htop, map_neg] + have hdegree : (mixedLiftPolynomial (euclideanSubspace (U j)) (b j) (o j) + Subtype.val (sample j) i).totalDegree ≤ j.val + 1 := + mixedLiftPolynomial_degree (euclideanSubspace (U j)) (b j) (o j) Subtype.val + (sample j) (fun d => d.property) i + rw [freezePolynomial_top keep _ hdegree] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredSampleSiteChart.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredSampleSiteChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..c005e5f5f757773fc78350c928db71e696e119de --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRecoveredSampleSiteChart.lean @@ -0,0 +1,147 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedAnchoredRecoveredSource +import OAI.Combinatorics.Progressions.Estimates.AllocatedOriginalSampleCongruenceOutput + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule BooleanCubeKernel +open scoped Classical BigOperators Matrix + +variable {K X : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +theorem affineCoefficientCoverSample_emptyJet + (root : K → ℤ) (D : Matrix Empty K ℤ) (q : ℕ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hm : ∀ j a, coefficients (poly j) a ∈ U j) + (z : Option K × X → ℤ) : + euclideanCoefficientJetMap U root D (fun _ (_ : Unit) => ∅) + (affineCoefficientCoverSample U poly hm q (fun k x => (z (k,x) : ℝ))) = + physicalSingleSiteValue U q poly hm (physicalAffineSite root z) := by + let f : Option K → X → ℝ := fun k x => (z (k,x) : ℝ) + have hpoint : (fun x => MvPolynomial.aeval (fun k => (root k : ℝ)) + (affineParameterSubstitution f x)) = physicalAffineSite root z := by + funext x + rw [affineParameterSubstitution_eval] + simp [physicalAffineSite, integerSiteValue, Fintype.sum_option, Finset.sum_apply, + zsmul_eq_mul, mul_comm, f] + funext j t + cases t + let v := substitute (affineParameterSubstitution f) + (restrictCoefficients (U j) (poly j) (hm j)) + have hv : DegreeLE (1 : K → ℕ) (j.val + 1) v := + degreeLE_substitute_affine (affineParameterSubstitution f) + (affineParameterSubstitution_degree f) _ + (degreeLE_restrictCoefficients (U j) (poly j) (hm j) (hp j)) + have he := congrFun (siteEvaluation_bounded_coefficients (fun _ : Unit => root) v hv) () + change eval (fun k => (root k : ℝ)) v = + ∑ e, (boundedSiteMatrix (j.val + 1) (fun _ : Unit => root) () e : ℝ) • coefficients v e.val at he + dsimp only [v] at he + rw [eval_substitute, hpoint] at he + change (euclideanSubspaceTorusEquiv (U j)).symm + (arrayCoordinateTorus (U j) + (coefficientBooleanJetTorusMap U root D (fun _ (_ : Unit) => ∅) + (affineCoefficientCoverSample U poly hm q f) j) ()) = _ + rw [affineCoefficientCoverSample, coefficientBooleanJetTorusMap_mk, + arrayCoordinateTorus_mk] + apply congrArg (euclideanSubspaceTorusEquiv (U j)).symm + apply congrArg (QuotientAddGroup.mk' (subspaceArrayIntegerLattice Unit (U j))) + funext t + change (∑ e, (boundedCoefficientJetMatrix root D (j.val + 1) + (fun _ : Unit => ∅) () e : ℝ) • + ((q : ℝ)⁻¹ • coefficients v e.val)) = _ + simp_rw [boundedCoefficientJetMatrix_empty, smul_comm _ ((q : ℝ)⁻¹)] + rw [← Finset.smul_sum, ← he] + +section Allocated +variable {G : Type*} [Fintype G] +variable {I E : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +theorem allocatedRecoveredSample_site_chart + (q : ℕ) [NeZero q] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hm : ∀ j a, coefficients (poly j) a ∈ U j) + (noise : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (hbase : canonicalCoefficientSample U b hb o sample = + affineSampleCoefficientTorus U poly hm (fun k x => (noise (k,x) : ℝ))) + (hsmall : ∀ a, |coefficientSamplerAmbientPoint U b o sample a| < 1/2) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (hread : ∀ event : CoefficientChartResidues (LayerSamplerVariables G I n B) n E q → Prop, + coefficientDeckChartEvent U bW b hb o q event + (affineCoefficientCoverSample U poly hm q (fun k x => (noise (k,x) : ℝ))) ↔ + event (allocatedReadCoefficientChartResidues (fun i => (read i : ZMod q)))) + (x : G → IntegerScalarCubeBox Empty S.value) + (y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U b S)) + (j : Fin m) : + physicalSingleSiteValue U q poly hm + (fun z => (integerPhysicalSite (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) noise z : ℝ)) j () = + normalizedCoveredChart (euclideanSubspace (U j)) (b j) (hb j) (bW j) q + (orthonormalMixedChart (o j) (allocatedOriginalSamplePhysicalMixedValue B U b S sample x y j), + integerResidueMap (E j) q + (allocatedOriginalSampleDeckValue B U b S (allocatedReadDeck read) x y j)) := by + have hprojection : quotientIntegerCover (coefficientIntegerLattice U) q + (affineCoefficientCoverSample U poly hm q (fun k z => (noise (k,z) : ℝ))) = + canonicalCoefficientSample U b hb o sample := by + rw [affineCoefficientCoverSample_projection U poly hm q (NeZero.pos q)] + exact hbase.symm + have hjet := coefficientEventRead_jet_chart U bW b hb o + (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) (fun _ (_ : Unit) => ∅) q sample + (affineCoefficientCoverSample U poly hm q (fun k z => (noise (k,z) : ℝ))) + hprojection hsmall (allocatedReadCoefficientChartResidues (fun i => (read i : ZMod q))) hread + rw [affineCoefficientCoverSample_emptyJet U _ _ q poly hp hm noise] at hjet + have h := congrFun (congrFun hjet j) () + simp_rw [integerPhysicalSite_cast_apply] + change _ = normalizedCoveredChart (euclideanSubspace (U j)) (b j) (hb j) (bW j) q + (orthonormalMixedChart (o j) (allocatedOriginalSamplePhysicalMixedValue B U b S sample x y j), + integerResidueMap (E j) q (allocatedOriginalSampleDeckValue B U b S (allocatedReadDeck read) x y j)) + rw [← allocatedOriginalSampleDeckValue_residue B U b S (allocatedReadDeck read) q x y j] + exact h + +theorem allocatedRecoveredSample_site_chart_base + (q : ℕ) [NeZero q] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hm : ∀ j a, coefficients (poly j) a ∈ U j) + (base : X → ℤ) + (noise : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (hbase : canonicalCoefficientSample U b hb o sample = + affineSampleCoefficientTorus U poly hm (fun k x => ((integerBaseTranslation (K := LayerSamplerVariables G I n B) base + noise) (k,x) : ℝ))) + (hsmall : ∀ a, |coefficientSamplerAmbientPoint U b o sample a| < 1/2) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (hread : ∀ event : CoefficientChartResidues (LayerSamplerVariables G I n B) n E q → Prop, + coefficientDeckChartEvent U bW b hb o q event + (affineCoefficientCoverSample U poly hm q (fun k x => ((integerBaseTranslation (K := LayerSamplerVariables G I n B) base + noise) (k,x) : ℝ))) ↔ + event (allocatedReadCoefficientChartResidues (fun i => (read i : ZMod q)))) + (x : G → IntegerScalarCubeBox Empty S.value) + (y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U b S)) + (j : Fin m) : + physicalSingleSiteValue U q poly hm + (fun z => (base z + integerPhysicalSite (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) noise z : ℝ)) j () = + normalizedCoveredChart (euclideanSubspace (U j)) (b j) (hb j) (bW j) q + (orthonormalMixedChart (o j) (allocatedOriginalSamplePhysicalMixedValue B U b S sample x y j), + integerResidueMap (E j) q + (allocatedOriginalSampleDeckValue B U b S (allocatedReadDeck read) x y j)) := by + simpa only [integerPhysicalSite_baseTranslation_add, Pi.add_apply, Int.cast_add] using + allocatedRecoveredSample_site_chart U B bW b hb o S q poly hp hm + (integerBaseTranslation (K := LayerSamplerVariables G I n B) base + noise) sample hbase hsmall read hread x y j + +end Allocated +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedReferenceSpatialRemeshing.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedReferenceSpatialRemeshing.lean new file mode 100644 index 0000000000000000000000000000000000000000..e58be0b6a374350ea328b75c9491118da5d646cb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedReferenceSpatialRemeshing.lean @@ -0,0 +1,394 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCenteredJointSource +import OAI.Combinatorics.Progressions.Probability.FiniteSpatialReferenceMass + +namespace OAI + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped NNReal + +theorem canonicalSpatialSiteDensity_lipschitz_ratio {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (s : I ↪ J) (root : J → ℤ) (D : Matrix I J ℤ) + (hp : (selectedSpatialPivot root D s).det ≠ 0) + {W L κ : ℝ} (hW : 0 ≤ W) (hL : 0 < L) (hκ : 0 < κ) + (hr : ∀ j, |(root j : ℝ)| ≤ 1 + W) (hD : ∀ i j, |(D i j : ℝ)| ≤ L) + (hminor : κ ≤ |(Matrix.of (fun i j => (D i (s j) : ℝ) / L)).det|) + {Q : ℝ≥0} (hQ : 1 ≤ Q) (hratio : (1 + W) / L ≤ Q) : + LipschitzWith (Real.toNNReal (anisotropicSpatialDensityLip s κ) * Q) + (canonicalSpatialSiteDensity s root D hp W L hW hL) := by + have ha : 0 < 1 + W := by linarith + have h := anisotropicSpatialKernelDensity_bounds root D s ha zero_lt_one hL hκ + (fun j => by simpa only [mul_one] using hr j) hD hminor + have hlip : LipschitzWith (Real.toNNReal (anisotropicSpatialDensityLip s κ)) + (canonicalSpatialKernelDensity s root D hp W L hW hL) := h.2 + apply coordinateRescaledDensity_lipschitz _ _ hlip + intro i + cases i with + | inl i => + change |(1 + W) / (1 + W)| ≤ (Q : ℝ) + rw [div_self ha.ne', abs_one] + exact_mod_cast hQ + | inr i => + change |(1 + W) / (L * 1)| ≤ (Q : ℝ) + rw [mul_one, abs_of_pos (div_pos ha hL)] + exact hratio + +theorem canonicalSpatialSiteDensity_lipschitz_linear_width {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (s : I ↪ J) (root : J → ℤ) (D : Matrix I J ℤ) + (hp : (selectedSpatialPivot root D s).det ≠ 0) + (n : ℕ) {L κ : ℝ} (hL : 0 < L) (hL1 : 1 ≤ L) (hκ : 0 < κ) + (hr : ∀ j, |(root j : ℝ)| ≤ 1 + n * L) (hD : ∀ i j, |(D i j : ℝ)| ≤ L) + (hminor : κ ≤ |(Matrix.of (fun i j => (D i (s j) : ℝ) / L)).det|) : + LipschitzWith (Real.toNNReal (anisotropicSpatialDensityLip s κ) * (n + 1)) + (canonicalSpatialSiteDensity s root D hp (n * L) L (by positivity) hL) := by + apply canonicalSpatialSiteDensity_lipschitz_ratio s root D hp (by positivity) hL hκ hr hD hminor + · exact le_add_of_nonneg_left zero_le + · push_cast + apply (div_le_iff₀ hL).mpr + nlinarith + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory BooleanCubeKernel +open scoped BigOperators Matrix NNReal Classical + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] +variable [∀ j : Fin m, DecidableEq (BoundedIntegerExponent G (j.val+1))] +variable [∀ j : Fin m, DecidableEq (AllocatedNonkernelCoefficient (G := G) B j)] +variable (rows : ∀ j, O j → Finset (Fin dim)) + +local notation "grid" => allocatedGridAxis (I := I) U b (LayerSamplerScale.value S) +local notation "sides" => allocatedPrincipalSides B U b S +local notation "lengths" => principalAxisLength (fun a => ¬grid a) sides + +variable (X : Type*) [Fintype X] + +local notation "whole" => principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) sides (allocatedPrincipalSides_pos B U b S) +local notation "frozen" => allocatedFrozenTupleWeights (α := Fin dim) B U b S +local notation "long" => allocatedLongTupleWeights (α := Fin dim) B U b S + +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1/(M : ℝ)) M x) +variable (modulus : ℕ) [NeZero modulus] +variable (s : ∀ j, O j ↪ BoundedIntegerExponent G (j.val+1)) +variable (hA : ∀ j, ((scalarKernelIntegerJet x (j.val+1) (rows j)).submatrix id (s j)).det ≠ 0) +variable (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬(allocatedGridAxis (I := I) U b S.value) a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) +variable (residue : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬(allocatedGridAxis (I := I) U b S.value) a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + ∀ j, Matrix (O j) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Module.Basis (Kcov j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S) → EuclideanJetLayers U O → ℝ) +variable (N : X → ℕ) (hN : ∀ t, 0 < N t) +variable {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ : 0 < ξ) +variable (C₀ ρ δ mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) +variable (point : (X → (Unit ⊕ Fin dim) → ℤ) → EuclideanJetLayers U O) +variable (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) (Cg Z : ℝ) + +noncomputable def allocatedRefinedSpatialKernel := + let H := trimmedSpatialRootScale τ N q + let hp := goodScalarKernelTuple_spatial_det_ne_zero selection x (fun a => (0 : ℤ) + (x a none : ℤ)) + (one_div_pos.mpr (Nat.cast_pos.mpr hM)) hx + let f := canonicalSpatialSiteDensity selection (fun a => (0 : ℤ) + (x a none : ℤ)) (scalarCubeDifferenceMatrix x) hp W S.value + hW (Nat.cast_pos.mpr S.positive) + fun u r (v : X → (Unit ⊕ Fin dim) → ℤ) => ∏ t, + spatialSiteApprox (selectedSpatialPivot (fun a => (0 : ℤ) + (x a none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (Matrix.fromCols (selectedSpatialFreeColumns (fun a => (0 : ℤ) + (x a none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (liftResidueMatrix (integerResidueMatrix + (principalSpatialColumns (fun _ => (0 : ℤ)) id (principalAxisJoin grid u (reference u r))) modulus))) + modulus f (H t) 4 mesh (v t) + +noncomputable def allocatedRefinedReferenceReconstruction := + fun u r (a : cells) => physicalResidueReconstruction + (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (principalAxisJoin grid u (reference u r))) + (allocatedPhysicalCubeDirections B U b S x (principalAxisJoin grid u (reference u r))) base + (boundedColumnResidueRepresentative q a.val) q + +noncomputable def allocatedRefinedReferenceProfile := + let coefficientScale := ∏ a, allocatedLongJetOutputScale B U b S (O := O) a + let chart := mixedCoveredJetChart U o b hb bW d + let region := mixedCoveredJetRegion (O := O) (E := Kcov) U o b d + (fun j _ => standardLatticeClosedQuarterBox (J j)) + fun u r => restrictedChartDensity chart region 1 (fun z : MixedCoveredJetSource I O Kcov n d => + allocatedCoveredFixedFactor B U b hR hσ S x u (reference u r) rows Kcov d z.1 z.2 * + (allocatedLongJetProxy B U b S x u rows s hA modulus (residue u r) + (fun a => coefficientJetAxisEquiv O I n z.1 a.val) / coefficientScale)) + +noncomputable def allocatedRefinedReferenceSpatialMass : ℝ := + let coefficientScale := ∏ a, allocatedLongJetOutputScale B U b S (O := O) a + let chart := mixedCoveredJetChart U o b hb bW d + let region := mixedCoveredJetRegion (O := O) (E := Kcov) U o b d + (fun j _ => standardLatticeClosedQuarterBox (J j)) + let H := trimmedSpatialRootScale τ N q + let T := trimmedSpatialSlopeScale W τ N q + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let A := ∏ t, ∏ i, physicalSpatialOutputScale (Fin dim) (H t) (T t) S.value i + let window := spatialWindow H 4 + let F := fun u r (a : cells) => physicalResidueReconstruction + (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (principalAxisJoin grid u (reference u r))) + (allocatedPhysicalCubeDirections B U b S x (principalAxisJoin grid u (reference u r))) base + (boundedColumnResidueRepresentative q a.val) q + let proxy := fun u r => restrictedChartDensity chart region 1 (fun z : MixedCoveredJetSource I O Kcov n d => + allocatedCoveredFixedFactor B U b hR hσ S x u (reference u r) rows Kcov d z.1 z.2 * + (allocatedLongJetProxy B U b S x u rows s hA modulus (residue u r) + (fun a => coefficientJetAxisEquiv O I n z.1 a.val) / coefficientScale)) + let mass := fun u r => ∑ t : cells × window, + selectedResidueCellWeight q cells V t.1 * |proxy u r (point (F u r t.1 t.2.val))| / A + (frozen).mean (fun u => ((long).fiberLaw (principalResidueLabel (residueRefinedPeriod modulus q))).mean (mass u)) / Z + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory BooleanCubeKernel +open scoped BigOperators Matrix NNReal Classical + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] +variable (rows : ∀ j, O j → Finset (Fin dim)) + +local notation "grid" => allocatedGridAxis (I := I) U b (LayerSamplerScale.value S) +local notation "sides" => allocatedPrincipalSides B U b S +local notation "lengths" => principalAxisLength (fun a => ¬grid a) sides + +variable (X : Type*) [Fintype X] + +local notation "whole" => principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) sides (allocatedPrincipalSides_pos B U b S) +local notation "frozen" => allocatedFrozenTupleWeights (α := Fin dim) B U b S +local notation "long" => allocatedLongTupleWeights (α := Fin dim) B U b S + +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1/(M : ℝ)) M x) +variable (modulus : ℕ) [NeZero modulus] +variable (s : ∀ j, O j ↪ BoundedIntegerExponent G (j.val+1)) +variable (hA : ∀ j, ((scalarKernelIntegerJet x (j.val+1) (rows j)).submatrix id (s j)).det ≠ 0) +variable (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬(allocatedGridAxis (I := I) U b S.value) a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) +variable (residue : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬(allocatedGridAxis (I := I) U b S.value) a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + ∀ j, Matrix (O j) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Module.Basis (Kcov j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S) → EuclideanJetLayers U O → ℝ) +variable (N : X → ℕ) (hN : ∀ t, 0 < N t) +variable {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ : 0 < ξ) +variable (C₀ ρ δ mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) +variable (point : (X → (Unit ⊕ Fin dim) → ℤ) → EuclideanJetLayers U O) +variable (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) (Cg Z : ℝ) + +omit [DecidableEq G] [NeZero modulus] in +theorem allocatedRefinedReferenceSpatialMass_nonneg + (hvolume : 0 < ∏ t, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q t) (trimmedSpatialSlopeScale W τ N q t) S.value i) + (hZ : 0 < Z) : + 0 ≤ allocatedRefinedReferenceSpatialMass (τ := τ) (ξ := ξ) (W := W) + B U b hR hσ S x rows X modulus s hA q reference residue hb o bW d N base cells point Z := by + unfold allocatedRefinedReferenceSpatialMass + dsimp only + apply div_nonneg _ hZ.le + apply FiniteProbabilityWeights.mean_nonneg + intro u + apply FiniteProbabilityWeights.mean_nonneg + intro r + apply Finset.sum_nonneg + intro t _ + exact div_nonneg + (mul_nonneg (selectedResidueCellWeight_nonneg _ _ _ _) (abs_nonneg _)) hvolume.le + +theorem allocatedRefinedTupleReference_mesh_error (coarse E : ℝ) + (hvolume : 0 < ∏ t, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q t) (trimmedSpatialSlopeScale W τ N q t) S.value i) + (hZ : 0 < Z) (hE : 0 ≤ E) (htest : ∀ v, ‖test v‖ ≤ 1) + (hspatial : ∀ u r v, v ∈ spatialWindow (trimmedSpatialRootScale τ N q) 4 → + ‖allocatedRefinedSpatialKernel (τ := τ) B U b S x X hM selection hx modulus q reference N hW mesh u r v - + allocatedRefinedSpatialKernel (τ := τ) B U b S x X hM selection hx modulus q reference N hW coarse u r v‖ ≤ E) : + ‖allocatedRefinedTupleReference (τ := τ) (ξ := ξ) + B U b hR hσ S x rows X hM selection hx modulus s hA q reference residue hb o bW d + N hW mesh base cells point test Z - + allocatedRefinedTupleReference (τ := τ) (ξ := ξ) + B U b hR hσ S x rows X hM selection hx modulus s hA q reference residue hb o bW d + N hW coarse base cells point test Z‖ ≤ + E * allocatedRefinedReferenceSpatialMass (τ := τ) (ξ := ξ) (W := W) + B U b hR hσ S x rows X modulus s hA q reference residue hb o bW d N base cells point Z := by + classical + let H := trimmedSpatialRootScale τ N q + let T := trimmedSpatialSlopeScale W τ N q + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let A := ∏ t, ∏ i, physicalSpatialOutputScale (Fin dim) (H t) (T t) S.value i + let index := cells × spatialWindow (α := Fin dim) H 4 + let F := allocatedRefinedReferenceReconstruction B U b S x X modulus q reference base cells + let profile := allocatedRefinedReferenceProfile B U b hR hσ S x rows X modulus s hA q reference residue hb o bW d + let fineKernel := allocatedRefinedSpatialKernel (τ := τ) B U b S x X hM selection hx modulus q reference N hW mesh + let coarseKernel := allocatedRefinedSpatialKernel (τ := τ) B U b S x X hM selection hx modulus q reference N hW coarse + have h := norm_nested_spatial_reference_sub + (allocatedFrozenTupleWeights (α := Fin dim) B U b S) + ((allocatedLongTupleWeights (α := Fin dim) B U b S).fiberLaw + (principalResidueLabel (residueRefinedPeriod modulus q))) + (fun t : index => selectedResidueCellWeight q cells V t.1) + (fun u r (t : index) => profile u r (point (F u r t.1 t.2.val))) + (fun u r (t : index) => fineKernel u r t.2.val) + (fun u r (t : index) => coarseKernel u r t.2.val) + (fun u r (t : index) => test (F u r t.1 t.2.val)) + (A := A) hvolume hE hZ + (fun _ => selectedResidueCellWeight_nonneg _ _ _ _) + (fun _ _ _ => htest _) (fun u r t => hspatial u r t.2.val t.2.property) + exact h + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Matrix NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (X : Type*) [Fintype X] +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1/(M : ℝ)) M x) +variable (modulus : ℕ) [NeZero modulus] (q : X → ℕ) + +variable (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬(allocatedGridAxis (I := I) U b S.value) a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) + +variable (N : X → ℕ) (hN : ∀ t, 0 < N t) +variable {W τ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (mesh : ℝ) + +local notation "grid" => allocatedGridAxis (I := I) U b (LayerSamplerScale.value S) + +include hN hτ in +theorem allocatedRefinedSpatialKernel_remesh (Q : ℝ≥0) (hQ : 1 ≤ Q) + (hratio : (1 + W) / (S.value : ℝ) ≤ Q) + (hroot : ∀ g, |((x g none : ℤ) : ℝ)| ≤ 1 + W) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage + (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection)) + (hq : ∀ t, 0 < q t) (hmesh : 0 < mesh) (coarse : ℝ) (hcoarse : 0 < coarse) : + ∀ u r v, v ∈ spatialWindow (trimmedSpatialRootScale τ N q) 4 → + ‖allocatedRefinedSpatialKernel (τ := τ) B U b S x X hM selection hx modulus q reference N hW mesh u r v - + allocatedRefinedSpatialKernel (τ := τ) B U b S x X hM selection hx modulus q reference N hW coarse u r v‖ ≤ + Fintype.card X * + (4 * (modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) * + (anisotropicSpatialDensityLip selection (1 / (M : ℝ)) * Q) * (mesh + coarse)) * + (1 + (modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) * + anisotropicSpatialDensityCap selection (1 / (M : ℝ)))^Fintype.card X := by + intro u r v hv + let root := fun g => (0 : ℤ) + (x g none : ℤ) + let A := selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection + let C := Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection) + (liftResidueMatrix (integerResidueMatrix + (principalSpatialColumns (fun _ => (0 : ℤ)) id (principalAxisJoin grid u (reference u r))) modulus)) + have hκ : 0 < 1 / (M : ℝ) := one_div_pos.mpr (Nat.cast_pos.mpr hM) + let hp := goodScalarKernelTuple_spatial_det_ne_zero selection x root hκ hx + let f := canonicalSpatialSiteDensity selection root (scalarCubeDifferenceMatrix x) hp W S.value + hW (Nat.cast_pos.mpr S.positive) + have hL1 : (1 : ℝ) ≤ S.value := by exact_mod_cast S.positive + have hroot' : ∀ g, |(root g : ℝ)| ≤ 1 + W := by + intro g + simpa only [root, zero_add] using hroot g + have hD : ∀ i g, |(scalarCubeDifferenceMatrix x i g : ℝ)| ≤ S.value := by + intro i g + have hg := Finset.mem_Ico.mp (x g (some i)).property + change |((x g (some i) : ℤ) : ℝ)| ≤ S.value + exact_mod_cast abs_le.mpr ⟨hg.1, hg.2.le⟩ + have hminor : 1 / (M : ℝ) ≤ + |(Matrix.of (fun i j => (scalarCubeDifferenceMatrix x i (selection j) : ℝ) / (S.value : ℝ))).det| := by + change 1 / (M : ℝ) ≤ |(normalizedScalarCubePivot selection x).det| + rw [normalizedScalarCubePivot_det] + exact hx.1.le + have hf := canonicalSpatialSiteDensity_lipschitz_ratio selection root (scalarCubeDifferenceMatrix x) + hp hW (Nat.cast_pos.mpr S.positive) hκ hroot' hD hminor hQ hratio + have hcap := (canonicalSpatialSiteDensity_bounds selection root (scalarCubeDifferenceMatrix x) + hp hW (Nat.cast_pos.mpr S.positive) hL1 hκ hroot' hD hminor).1 + have hfull : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ pivotFullImage A C := by + dsimp only [A, C] + rw [pivotFullImage_split] + exact hperiod.trans le_sup_left + have hi : ((pivotFullImage A C).toAddSubgroup.index : ℝ) ≤ + (modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) := by + exact_mod_cast residueLatticeImage_index_le _ modulus hfull + have hH : ∀ t, 0 < trimmedSpatialRootScale τ N q t := + fun t => (trimmedSpatial_scales_pos hW hτ N q t (hN t) (hq t)).1 + have hv' := (mem_spatialWindow_scaled_iff (trimmedSpatialRootScale τ N q) hH 4 v).mp hv + have h := vectorSpatialSiteApprox_remesh A (fun _ : X => C) modulus (fun _ => hfull) + (fun _ => f) (fun _ => hf) (trimmedSpatialRootScale τ N q) (by positivity) + (anisotropicSpatialDensityCap_nonneg selection hκ.le) (fun _ => hi) (fun _ => hcap) + (by norm_num : (0 : ℝ) < 4) hmesh hcoarse v hv' + simpa only [allocatedRefinedSpatialKernel, f, A, C, root, hp, NNReal.coe_mul, + Real.coe_toNNReal _ (anisotropicSpatialDensityLip_nonneg selection hκ.le)] using h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRefinedSpatialData.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRefinedSpatialData.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0e5a66ff4530e8511bd6341a828845deeb274f2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRefinedSpatialData.lean @@ -0,0 +1,90 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedCoveredComparison + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Matrix NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] [∀ j, DecidableEq (O j)] +variable [∀ j : Fin m, DecidableEq (BoundedIntegerExponent G (j.val+1))] +variable [∀ j : Fin m, DecidableEq (AllocatedNonkernelCoefficient (G := G) B j)] +variable (rows : ∀ j, O j → Finset α) + +local notation "grid" => allocatedGridAxis (I := I) U b (LayerSamplerScale.value S) +local notation "sides" => allocatedPrincipalSides B U b S +local notation "lengths" => principalAxisLength (fun a => ¬grid a) sides + +theorem allocatedGoodKernel_refined_spatial_data {M : ℕ} (hM : 0 < M) + (selection : α ↪ G) (hx : GoodScalarKernelTuple selection (1/(M : ℝ)) M x) + (hq : Fintype.card α ≤ m+1) (hinj : ∀ j, Function.Injective (rows j)) + (hrows : ∀ j o, (rows j o).card ≤ j.val+1) (hσ1 : ∀ j, σ j ≤ 1) + {P E T η : ℝ} (hP : 0 ≤ P) (hE : 0 ≤ E) (hT : 0 ≤ T) (hη : 0 < η) (hη1 : η ≤ 1) + (hMP : (M : ℝ) ≤ Real.exp P) (hRP : ∀ j, R j ≤ Real.exp P) + (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ)+1 ≤ Real.exp P) + (hηE : η⁻¹ ≤ Real.exp E) + (hlarge : Real.exp (allocatedRefinedJointLengthLog (G := G) B α O P E T) ≤ S.value) : + ∃ (modulus : ℕ) (_hm : 0 < modulus), modulus ≤ M^(m+1) ∧ + (∀ root : G → ℤ, integerScalarLattice (Unit ⊕ α) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) ∧ + (∀ j, integerScalarLattice (O j) (modulus : ℤ) ≤ + (scalarKernelIntegerJet x (j.val+1) (rows j)).mulVecLin.range) ∧ + ∃ (s : ∀ j, O j ↪ BoundedIntegerExponent G (j.val+1)) + (hA : ∀ j, ((scalarKernelIntegerJet x (j.val+1) (rows j)).submatrix id (s j)).det ≠ 0), + (∀ j : Fin m, fixedKernelInverseBound S.positive x (j.val+1) (rows j) (s j) (hA j) (1/(M : ℝ))) ∧ + ∀ (refined : ℕ) (hRefined : 0 < refined), modulus ∣ refined → + (refined : ℝ) ≤ Real.exp T → + ∃ hsize : ∀ d, (Fintype.card α+1)*refined ≤ lengths d, + ∀ (u : PrincipalAxisTuples (α := α) grid sides) + (r : PrincipalTupleIndex (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option α → ZMod refined), + ∃ (reference : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) + (residue : ∀ j, Matrix (O j) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)), + principalResidueLabel refined reference = r ∧ + (∀ v, (allocatedLongResidueWeights B U b S refined hRefined r hsize).weight v ≠ 0 → ∀ j, + integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u rows j v) modulus = residue j) ∧ + ∀ z : AllocatedLongJetRows B U b S O, + |(allocatedLongResidueWeights B U b S refined hRefined r hsize).mean + (fun v => (∏ a, allocatedLongJetOutputScale B U b S (O := O) a) * + allocatedLongJetDensity B U b hR hσ S x u v rows s hA hσ1 z) - + allocatedLongJetProxy B U b S x u rows s hA modulus residue z| ≤ η := by + have hcoefficient : Real.exp (allocatedKernelReplacementLog (G := G) B α O P + (allocatedJointAccuracyLog (G := G) B α O P E)) ≤ S.value := + (Real.exp_le_exp.mpr (le_max_left _ _)).trans hlarge + obtain ⟨hε, _, hεe⟩ := allocatedJointAccuracy_spec (G := G) B α O hP hMP hη hη1 hηE + have he := allocatedJointAccuracyLog_nonneg (G := G) B α O hP hE + obtain ⟨modulus, hm, hmB, hspatial, hperiod, s, hA, hi, hcompare⟩ := + allocatedGoodKernel_refined_principal_comparison B U b hR hσ S x rows hM selection hx + hq hinj hrows hσ1 hP he hε hMP hRP hRi hσi hcount hεe hcoefficient + refine ⟨modulus, hm, hmB, hspatial, hperiod, s, hA, hi, ?_⟩ + intro refined hRefined hdiv hbound + have htuple := (allocatedRefinedJointLengthLog_spec (G := G) B α O + hP hE hT hbound hMP hη hηE hlarge).2 + obtain ⟨hsize, hsmall, herror⟩ := + allocatedRefinedJointTupleCutoff_spec B U b S O hP hM hη hη1 (le_refl refined) htuple + refine ⟨hsize, ?_⟩ + intro u r + obtain ⟨reference, href⟩ := exists_allocatedLongResidueReference B U b S refined hRefined r hsize + obtain ⟨residue, hr, he⟩ := hcompare refined hRefined hdiv u r hsize hsmall + exact ⟨reference, residue, href, hr, fun z => (he z).trans herror⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRowSlicedIdealCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRowSlicedIdealCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccc804fabd583de24edd3f1a7e6e4a9aff337d90 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedRowSlicedIdealCoordinates.lean @@ -0,0 +1,345 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedProductIdealCutoff + +namespace OAI + +section + +namespace Erdos3 +open MeasureTheory +open scoped NNReal BigOperators + + theorem coordinateAffine_norm_le_one {I : Type*} [Fintype I] + (center width : I → ℝ) (hw : ∀ i, |center i| + |width i| ≤ 1) + (x : I → ℝ) (hx : ‖x‖ ≤ 1) : ‖fun i => center i + width i * x i‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 1)).mpr + intro i + have hi : |x i| ≤ 1 := (norm_le_pi_norm x i).trans hx + calc + ‖center i + width i * x i‖ ≤ |center i| + |width i| * |x i| := by + simpa only [Real.norm_eq_abs, abs_mul] using norm_add_le (center i) (width i * x i) + _ ≤ |center i| + |width i| := add_le_add le_rfl + (by simpa using mul_le_mul_of_nonneg_left hi (abs_nonneg (width i))) + _ ≤ 1 := hw i + +variable {D G α : Type*} [Fintype D] [Fintype G] [Fintype α] [DecidableEq α] + (Z : Type*) [Fintype Z] {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (P : D → Prop) [DecidablePred P] + {O : {d // ¬P d} → Type*} [∀ d, Fintype (O d)] (sets : ∀ d, O d → Finset α) + + theorem partitionedSlicedRegularizedIdeal_zero_outside {degree : ℕ} + (hdegree : ∀ d, h d ≤ degree) (ρ : ℝ≥0) (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) + (center width : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) + (hw : ∀ i, |center i| + |width i| ≤ 1) + (z : PartitionedProfileNoiseIndex G Z α B h P → ℝ) (hz : ∀ j, |z j| ≤ 1) + (v : (Σ d, O d) → ℝ) (hv : partitionedIdealRadius α degree + 1 < ‖v‖) : + partitionedSlicedRegularizedIdeal h P sets ρ center width z v = 0 := by + apply regularizedImageDensity_support + (jointBooleanSource (fun d : {d // ¬P d} => h d.val)) + (fun x => partitionedIdealMap h P sets z (fun i => center i + width i * x i)) + ρ hρ (partitionedIdealRadius_nonneg α degree) + · filter_upwards [jointBooleanSource_ae_closedBall + (α := α) (fun d : {d // ¬P d} => B d.val) (fun d => h d.val)] with x hx + apply partitionedIdealMap_norm_le h P sets hdegree z hz + apply coordinateAffine_norm_le_one center width hw x + simpa only [Metric.mem_closedBall, dist_zero_right] using hx + · have hd : (ρ : ℝ) ≤ 1 := hρ1 + linarith + + theorem activeAveragedSlicedProfileIdeal_zero_outside {degree : ℕ} + (hdegree : ∀ d, h d ≤ degree) (ρ : ℝ≥0) (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) + (center width : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) + (hw : ∀ i, |center i| + |width i| ≤ 1) + (v : (Σ d, O d) → ℝ) (hv : partitionedIdealRadius α degree + 1 < ‖v‖) : + activeAveragedSlicedProfileIdeal (G := G) (B := B) Z h P sets ρ center width v = 0 := by + apply integral_eq_zero_of_ae + filter_upwards [unitCoefficientSource_abs_le (ActiveProfileCoefficientIndex G B h P)] with r hr + exact partitionedSlicedRegularizedIdeal_zero_outside Z h P sets hdegree ρ hρ hρ1 center width hw + (profileNoiseWithActive (Z := Z) h P (fun _ => 0) r) + (profileNoiseWithActive_abs_le h P (fun _ => 0) r (fun _ => by simp) hr) v hv + + theorem activeScaledSlicedIdeal_bounds (R : (Σ d, O d) → ℝ) {C : ℝ≥0} + (hR : ∀ i, |(R i)⁻¹| ≤ C) (ρ : ℝ≥0) (hρ : 0 < ρ) + (center width : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) : + (∀ v, |diagonalImageDensity R + (activeAveragedSlicedProfileIdeal (G := G) (B := B) Z h P sets ρ center width) v| ≤ + (∏ i, |R i|)⁻¹ * (ρ⁻¹ ^ Fintype.card (Σ d, O d) : ℝ≥0)) ∧ + LipschitzWith (‖(∏ i, |R i|)⁻¹‖₊ * (affineProductProfileLip (Σ d, O d) ρ * C)) + (diagonalImageDensity R (activeAveragedSlicedProfileIdeal (G := G) (B := B) Z h P sets ρ center width)) := by + have hs := activeAveragedSlicedProfileIdeal_spec (G := G) (B := B) Z h P sets ρ hρ center width + refine ⟨diagonalImageDensity_bound R _ (fun v => ?_), + diagonalImageDensity_lipschitz R _ hs.2.1 hR⟩ + rw [abs_of_nonneg (hs.1 v).1] + exact (hs.1 v).2 + + theorem activeScaledSlicedIdeal_zero_outside (R : (Σ d, O d) → ℝ) + (hR : ∀ i, R i ≠ 0) {C : ℝ} (hC : 0 ≤ C) (hRC : ∀ i, |R i| ≤ C) + {degree : ℕ} (hdegree : ∀ d, h d ≤ degree) + (ρ : ℝ≥0) (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) + (center width : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) + (hw : ∀ i, |center i| + |width i| ≤ 1) + (v : (Σ d, O d) → ℝ) (hv : C * (partitionedIdealRadius α degree + 1) < ‖v‖) : + diagonalImageDensity R (activeAveragedSlicedProfileIdeal (G := G) (B := B) Z h P sets ρ center width) v = 0 := + diagonalImageDensity_zero_outside R hR _ hC hRC + (activeAveragedSlicedProfileIdeal_zero_outside (G := G) (B := B) Z h P sets + hdegree ρ hρ hρ1 center width hw) v hv + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical NNReal + +variable {α : Type*} [Fintype α] [DecidableEq α] + +noncomputable def realRowsSiteValue (rows : Finset (Finset α)) + (v : rows → ℝ) (s : Finset α) : ℝ := + ∑ t : rows, v t * (if t.val ⊆ s then 1 else 0) + +omit [Fintype α] in +theorem realRowsSiteValue_coefficient (rows : Finset (Finset α)) + (v : rows → ℝ) (s : rows) : + booleanCoefficient (realRowsSiteValue rows v) s.val = v s := by + unfold realRowsSiteValue + rw [booleanCoefficient_sum] + simp only [booleanCoefficient_const_mul, booleanCoefficient_monomial] + rw [Finset.sum_eq_single s] + · simp + · intro t _ hts + have hst : s.val ≠ t.val := fun he => hts (Subtype.ext he.symm) + simp only [hst, ite_false, mul_zero] + · simp + +omit [Fintype α] in +theorem realRowsSiteValue_bound (rows : Finset (Finset α)) + (v : rows → ℝ) {T : ℝ} (hT : 0 ≤ T) (hv : ∀ t, |v t| ≤ T) (s : Finset α) : + |realRowsSiteValue rows v s| ≤ rows.card * T := by + simpa only [realRowsSiteValue, rowRestrictedSiteMatrix, booleanReconstructionMatrix, Int.cast_ite, Int.cast_one, Int.cast_zero, mul_comm] + using rowRestrictedSiteMatrix_real_bound rows v hT hv s + +namespace VectorPolynomial + +open Module + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "radius" => allocatedProductIdealSiteRadius (G := G) B rowSets + +noncomputable def allocatedRowIdealCoordinates (z : AllocatedLongJetRows B U b S rowTypes) : + Finset α → LayerSamplerAxis I n → ℝ := + fun s a => realRowsSiteValue (rowSets a.1) (fun t => + if ha : ¬grid a then allocatedLongJetRealCoordinates B U b S z ⟨⟨a, ha⟩, t⟩ / R a.1 + else 0) s + +omit [Fintype α] in +theorem allocatedRowIdealCoordinates_jet (z : AllocatedLongJetRows B U b S rowTypes) + (a : {a // ¬grid a}) (t : rowTypes a.val.1) : + booleanCoefficient (fun s => allocatedRowIdealCoordinates B U b S rowSets z s a.val) t.val = + allocatedLongJetRealCoordinates B U b S z ⟨a, t⟩ / R a.val.1 := by + unfold allocatedRowIdealCoordinates + rw [realRowsSiteValue_coefficient] + simp only [dite_eq_left a.property] + +omit [Fintype α] in +theorem allocatedRowIdealCoordinates_physical_jets (hR : ∀ j, 0 < R j) + (z : AllocatedLongJetRows B U b S rowTypes) : + booleanSiteJets (fun a : {a // ¬grid a} => (Subtype.val : rowTypes a.val.1 → Finset α)) + (fun s a => R a.val.1 * allocatedRowIdealCoordinates B U b S rowSets z s a.val) = + allocatedLongJetRealCoordinates B U b S z := by + funext q + change booleanCoefficient + (fun s => R q.1.val.1 * allocatedRowIdealCoordinates B U b S rowSets z s q.1.val) q.2.val = _ + rw [booleanCoefficient_const_mul, allocatedRowIdealCoordinates_jet] + field_simp [(hR q.1.val.1).ne'] + +theorem allocatedRowIdealCoordinates_density (hR : ∀ j, 0 < R j) + (δ : ℝ≥0) (z : AllocatedLongJetRows B U b S rowTypes) : + (∏ q : (Σ a : {a // ¬grid a}, rowTypes a.val.1), R q.1.val.1) * + allocatedPhysicalLongIdeal B U b hR S rowSets δ (allocatedLongJetRealCoordinates B U b S z) = + activeAveragedProfileIdeal (G := G) (B := B) (G × Option α) (layerSamplerDegree I n) grid + (fun a => (Subtype.val : rowTypes a.val.1 → Finset α)) δ + (booleanSiteJets (fun a : {a // ¬grid a} => (Subtype.val : rowTypes a.val.1 → Finset α)) + (fun s a => allocatedRowIdealCoordinates B U b S rowSets z s a.val)) := by + have h := physicalActiveProfileIdeal_normalized_sites (G := G) (Z := G × Option α) (B := B) + (O := fun a : LayerSamplerAxis I n => rowTypes a.1) + (layerSamplerDegree I n) grid (fun a => (Subtype.val : rowTypes a.val.1 → Finset α)) + (fun a => R a.1) (fun a => hR a.1) δ (allocatedRowIdealCoordinates B U b S rowSets z) + rw [allocatedRowIdealCoordinates_physical_jets B U b S rowSets hR z] at h + exact h + +theorem allocatedRowIdealCoordinates_bound (hR : ∀ j, 0 < R j) + (δ : ℝ≥0) (hδ : 0 < δ) (hδ1 : δ ≤ 1) (z : AllocatedLongJetRows B U b S rowTypes) + (hz : allocatedPhysicalLongIdeal B U b hR S rowSets δ (allocatedLongJetRealCoordinates B U b S z) ≠ 0) + (s : Finset α) (a : LayerSamplerAxis I n) : + |allocatedRowIdealCoordinates B U b S rowSets z s a| ≤ (radius : ℝ) := by + unfold allocatedRowIdealCoordinates + apply (realRowsSiteValue_bound (rowSets a.1) _ (allocatedIdealCoverSupport_nonneg B rowSets a.1) ?_ s).trans + (allocatedProductIdealSiteRadius_dominates B rowSets a.1) + intro t + by_cases ha : ¬grid a + · rw [dite_eq_left ha, abs_div, abs_of_pos (hR a.1)] + exact (div_le_iff₀ (hR a.1)).mpr + (allocatedPhysicalLongIdeal_cover_support B U b hR S rowSets δ hδ hδ1 _ hz ⟨a, ha⟩ t) + · rw [dite_eq_right ha, abs_zero] + exact allocatedIdealCoverSupport_nonneg B rowSets a.1 + +omit [Fintype α] in +theorem allocatedRowIdealCoordinates_mixed_value + {E : Fin m → Type*} [∀ j, Fintype (E j)] (d : ℕ) + (z : MixedCoveredJetSource I rowTypes E n d) (s : Finset α) : + allocatedRowIdealCoordinates B U b S rowSets ((coefficientJetAxisSplit rowTypes I n grid z.1).2) s = + allocatedNormalizedMixedSiteValue B U b S + (fun j => mixedArrayRegroup _ _ _ ((mixedCoveredRowsSiteValue rowSets d z s).1 j) ()) := by + funext a + rcases a with ⟨j, i | i⟩ + · change realRowsSiteValue (rowSets j) + (fun t => if _h : ¬grid ⟨j, Sum.inl i⟩ then (z.1 j).1 i t / R j else 0) s = + (if grid ⟨j, Sum.inl i⟩ then 0 else + (∑ t : rowTypes j, (rowRestrictedSiteMatrix (rowSets j) s t : ℝ) * (z.1 j).1 i t) / R j) + by_cases hg : grid ⟨j, Sum.inl i⟩ + · simp only [hg, not_true_eq_false, dite_false, ite_true, realRowsSiteValue, zero_mul, Finset.sum_const_zero] + · simp only [hg, not_false_eq_true, dite_true, ite_false, realRowsSiteValue, + rowRestrictedSiteMatrix, booleanReconstructionMatrix, Int.cast_ite, Int.cast_one, Int.cast_zero, + Finset.sum_div, mul_comm] + apply Finset.sum_congr rfl + intro t _ + ring + · change realRowsSiteValue (rowSets j) + (fun t => if _h : ¬grid ⟨j, Sum.inr i⟩ then + ((z.1 j).2 i t : ℝ) / (basisAxisScale (b j) i : ℝ) / R j else 0) s = + (if grid ⟨j, Sum.inr i⟩ then 0 else + ((∑ t : rowTypes j, rowRestrictedSiteMatrix (rowSets j) s t * (z.1 j).2 i t : ℤ) : ℝ) / + (basisAxisScale (b j) i : ℝ) / R j) + by_cases hg : grid ⟨j, Sum.inr i⟩ + · simp only [hg, not_true_eq_false, dite_false, ite_true, realRowsSiteValue, zero_mul, Finset.sum_const_zero] + · simp only [hg, not_false_eq_true, dite_true, ite_false, realRowsSiteValue, Int.cast_sum, Int.cast_mul, + rowRestrictedSiteMatrix, booleanReconstructionMatrix, Int.cast_ite, Int.cast_one, Int.cast_zero, + Finset.sum_div, mul_comm] + apply Finset.sum_congr rfl + intro t _ + ring + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) +local notation "jets" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "input" => PrincipalAxisParameter (B := B) (h := layerSamplerDegree I n) + (α := α) (fun a => ¬grid a) +local notation "output" => (Σ a : {a // ¬grid a}, jets (Sigma.fst (Subtype.val a))) + +noncomputable def allocatedRowSlicedIdeal (ρ : ℝ≥0) (center width : input → ℝ) : + (output → ℝ) → ℝ := + diagonalImageDensity (fun o : output => R o.1.val.1) + (activeAveragedSlicedProfileIdeal (G := G) (B := B) (G × Option α) + (layerSamplerDegree I n) grid (fun a : {a // ¬grid a} => (Subtype.val : jets a.val.1 → Finset α)) ρ center width) + +noncomputable def allocatedRowSlicedSiteRadius : ℝ≥0 := + ⟨1 + ∑ j : Fin m, (rowSets j).card * (partitionedIdealRadius α m + 1), by + have := partitionedIdealRadius_nonneg α m + positivity⟩ + +omit [DecidableEq α] in +theorem allocatedRowSlicedSiteRadius_one_le : 1 ≤ allocatedRowSlicedSiteRadius rowSets := by + change (1 : ℝ) ≤ 1 + ∑ j : Fin m, (rowSets j).card * (partitionedIdealRadius α m + 1) + have ht := partitionedIdealRadius_nonneg α m + exact le_add_of_nonneg_right (Finset.sum_nonneg (fun j _ => by positivity)) + +omit [DecidableEq α] in +theorem allocatedRowSlicedSiteRadius_pos : 0 < allocatedRowSlicedSiteRadius rowSets := by + change (0 : ℝ) < 1 + ∑ j : Fin m, (rowSets j).card * (partitionedIdealRadius α m + 1) + have := partitionedIdealRadius_nonneg α m + positivity + +omit [DecidableEq α] in +theorem allocatedRowSlicedSiteRadius_dominates (j : Fin m) : + (rowSets j).card * (partitionedIdealRadius α m + 1) ≤ allocatedRowSlicedSiteRadius rowSets := by + change _ ≤ 1 + ∑ k : Fin m, (rowSets k).card * (partitionedIdealRadius α m + 1) + have hT : 0 ≤ partitionedIdealRadius α m + 1 := by + have := partitionedIdealRadius_nonneg α m + positivity + exact (Finset.single_le_sum (f := fun k : Fin m => + (rowSets k).card * (partitionedIdealRadius α m + 1)) + (fun k _ => mul_nonneg (Nat.cast_nonneg _) hT) (Finset.mem_univ j)).trans + (le_add_of_nonneg_left zero_le_one) + +theorem allocatedRowSlicedIdealCoordinates_density (hR : ∀ j, 0 < R j) + (ρ : ℝ≥0) (center width : input → ℝ) (z : AllocatedLongJetRows B U b S jets) : + (∏ q : output, R q.1.val.1) * + allocatedRowSlicedIdeal B U b S rowSets ρ center width (allocatedLongJetRealCoordinates B U b S z) = + activeAveragedSlicedProfileIdeal (G := G) (B := B) (G × Option α) + (layerSamplerDegree I n) grid (fun a : {a // ¬grid a} => (Subtype.val : jets a.val.1 → Finset α)) ρ center width + (booleanSiteJets (fun a : {a // ¬grid a} => (Subtype.val : jets a.val.1 → Finset α)) + (fun s a => allocatedRowIdealCoordinates B U b S rowSets z s a.val)) := by + have hjet : booleanSiteJets (fun a : {a // ¬grid a} => (Subtype.val : jets a.val.1 → Finset α)) + (fun s a => allocatedRowIdealCoordinates B U b S rowSets z s a.val) = + (fun q : output => allocatedLongJetRealCoordinates B U b S z q / R q.1.val.1) := by + funext q + exact allocatedRowIdealCoordinates_jet B U b S rowSets z q.1 q.2 + rw [hjet] + unfold allocatedRowSlicedIdeal diagonalImageDensity + simp only [abs_of_pos (hR _)] + rw [← mul_assoc, mul_inv_cancel₀ (Finset.prod_ne_zero_iff.mpr (fun q _ => (hR q.1.val.1).ne')), one_mul] + +theorem allocatedRowSlicedIdealCoordinates_bound + (ρ : ℝ≥0) (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) + (center width : input → ℝ) (hw : ∀ i, |center i| + |width i| ≤ 1) + (z : AllocatedLongJetRows B U b S jets) + (hz : allocatedRowSlicedIdeal B U b S rowSets ρ center width + (allocatedLongJetRealCoordinates B U b S z) ≠ 0) + (s : Finset α) (a : LayerSamplerAxis I n) : + |allocatedRowIdealCoordinates B U b S rowSets z s a| ≤ + (allocatedRowSlicedSiteRadius rowSets : ℝ) := by + have hT : 0 ≤ partitionedIdealRadius α m + 1 := by + have := partitionedIdealRadius_nonneg α m + positivity + have hv : ‖fun q : output => allocatedLongJetRealCoordinates B U b S z q / R q.1.val.1‖ ≤ + partitionedIdealRadius α m + 1 := by + by_contra hn + apply hz + unfold allocatedRowSlicedIdeal diagonalImageDensity + rw [activeAveragedSlicedProfileIdeal_zero_outside (G := G) (B := B) (G × Option α) + (layerSamplerDegree I n) grid (fun a : {a // ¬grid a} => (Subtype.val : jets a.val.1 → Finset α)) + (fun a => Nat.succ_le_of_lt a.1.isLt) ρ hρ hρ1 center width hw _ (lt_of_not_ge hn), mul_zero] + unfold allocatedRowIdealCoordinates + apply (realRowsSiteValue_bound (rowSets a.1) _ hT ?_ s).trans + (allocatedRowSlicedSiteRadius_dominates rowSets a.1) + intro t + by_cases ha : ¬grid a + · rw [dite_eq_left ha] + exact (norm_le_pi_norm (fun q : output => + allocatedLongJetRealCoordinates B U b S z q / R q.1.val.1) ⟨⟨a, ha⟩, t⟩).trans hv + · rw [dite_eq_right ha, abs_zero] + exact hT + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSiteSpatialPrimitiveBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSiteSpatialPrimitiveBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..c84639ddd27c0f9f3ed514a67674fbaa738c2273 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSiteSpatialPrimitiveBudget.lean @@ -0,0 +1,165 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedReferenceIdealBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators NNReal + +def allocatedSiteSpatialMassLog {A : Type*} [Semiring A] (D w v : A) : A := + coefficientMajorantMassLog D + D * w + v + +theorem allocatedSiteSpatialMassLog_nonneg {D w v : ℝ} + (hD : 0 ≤ D) (hw : 0 ≤ w) (hv : 0 ≤ v) : + 0 ≤ allocatedSiteSpatialMassLog D w v := by + have hbase := coefficientMajorantMassLog_nonneg hD + unfold allocatedSiteSpatialMassLog + positivity + +theorem allocatedSiteSpatialMass_exp_bound {m : ℕ} (O Q J : Fin m → Type*) + [∀ j, Fintype (O j)] [∀ j, Fintype (Q j)] [∀ j, Fintype (J j)] + (C : Fin m → ℝ≥0) (period M N : ℕ) (CM Cf : ℝ≥0) + {D w v : ℝ} (hD : 0 ≤ D) (hw : 0 ≤ w) (hm : (m : ℝ) ≤ D) + (hO : ∀ j, (Fintype.card (O j) : ℝ) ≤ D) + (hQ : ∀ j, (Fintype.card (Q j) : ℝ) ≤ D) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ D) + (hM : (M : ℝ) ≤ D) (hN : (N : ℝ) ≤ D) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp D) + (hperiod : (period : ℝ) ≤ Real.exp (D ^ 2)) + (hCM : (CM : ℝ) ≤ Real.exp w) (hCf : (Cf : ℝ) ≤ Real.exp v) : + ((Real.toNNReal (coefficientDeckPeriodCap O Q period) * CM ^ M * Cf : ℝ≥0) : ℝ) * + (2 * (∑ j, (C j : ℝ) * ((Fintype.card (J j) : ℝ) + 1)) + 1) ^ N ≤ + Real.exp (allocatedSiteSpatialMassLog D w v) := by + have hbase := coefficientMajorantMassFactor_exp_bound O Q J C period N + hD hm hO hQ hJ hN hC hperiod + have hmask := pow_le_exp_mul_of_le_exp CM.coe_nonneg hCM hw M hM + simp only [NNReal.coe_mul, NNReal.coe_pow, + Real.coe_toNNReal _ (coefficientDeckPeriodCap_nonneg O Q period)] + calc + _ = (coefficientDeckPeriodCap O Q period * + (2 * (∑ j, (C j : ℝ) * ((Fintype.card (J j) : ℝ) + 1)) + 1) ^ N) * + (CM : ℝ) ^ M * Cf := by ring + _ ≤ Real.exp (coefficientMajorantMassLog D) * Real.exp (D * w) * Real.exp v := + mul_le_mul (mul_le_mul hbase hmask (pow_nonneg CM.coe_nonneg M) (Real.exp_pos _).le) + hCf Cf.coe_nonneg (mul_nonneg (Real.exp_pos _).le (Real.exp_pos _).le) + _ = Real.exp (allocatedSiteSpatialMassLog D w v) := by + rw [← Real.exp_add, ← Real.exp_add] + rfl + +theorem allocatedSiteSpatial_error_budget {H L E δ δFourier ε : ℝ} + (hH0 : 0 ≤ H) (hH : H ≤ Real.exp L) + (hδ : δ ≤ physicalIdealErrorShare E L) + (hδFourier : δFourier ≤ physicalIdealErrorShare E 1) + (hε : ε ≤ physicalIdealErrorShare E 1) : + δ * H + 2 * δFourier + ε ≤ Real.exp (-E) := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hhalf : (1 / 2 : ℝ) ≤ Real.exp 0 := by norm_num + have h := physicalIdeal_three_errors_le (a := H) (b := 2) (c := 1 / 2) + (V := L) (W := 1) (K := 0) hH0 (by norm_num) (by norm_num) hH htwo hhalf + hδ hδFourier (by simpa only [add_zero] using hε) + convert h using 1 + ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical NNReal + +noncomputable def allocatedSitePrimitiveTolerance (m : ℕ) (p w v E : ℝ) : ℝ := + physicalIdealErrorShare E (allocatedSiteSpatialMassLog (allocatedComparisonDimension m p) w v) + +theorem allocatedSitePrimitiveTolerance_pos (m : ℕ) (p w v E : ℝ) : + 0 < allocatedSitePrimitiveTolerance m p w v E := + physicalIdealErrorShare_pos _ _ + +theorem allocatedSitePrimitiveTolerance_le_one (m : ℕ) {p w v E : ℝ} + (hp : 0 ≤ p) (hw : 0 ≤ w) (hv : 0 ≤ v) (hE : 0 ≤ E) : + allocatedSitePrimitiveTolerance m p w v E ≤ 1 := + physicalIdealErrorShare_le_one hE + (allocatedSiteSpatialMassLog_nonneg (allocatedComparisonDimension_bounds m hp).1 hw hv) + +theorem allocatedSitePrimitiveTolerance_inv (m : ℕ) (p w v E : ℝ) : + (allocatedSitePrimitiveTolerance m p w v E)⁻¹ = + Real.exp (E + allocatedSiteSpatialMassLog (allocatedComparisonDimension m p) w v + 3) := + physicalIdealErrorShare_inv _ _ + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] + +theorem allocatedSiteSpatialMass_primitive_bound + {α : Type*} [Fintype α] (rows : ∀ j, O j → Finset α) + (hq : Fintype.card α ≤ m + 1) (hinj : ∀ j, Function.Injective (rows j)) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + {Q : Fin m → Type*} [∀ j, Fintype (Q j)] + (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (M period : ℕ) (hperiod : period ≤ M ^ (m + 1)) (CM Cf : ℝ≥0) (C : Fin m → ℝ≥0) + {p w v : ℝ} (hp : 0 ≤ p) (hw : 0 ≤ w) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn : ∀ j, (n j : ℝ) ≤ p) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hM : (M : ℝ) ≤ Real.exp p) (hC : ∀ j, (C j : ℝ) ≤ Real.exp p) + (hCM : (CM : ℝ) ≤ Real.exp w) (hCf : (Cf : ℝ) ≤ Real.exp v) : + ((Real.toNNReal (coefficientDeckPeriodCap O Q period) * + CM ^ Fintype.card (LayerSamplerAxis I n) * Cf : ℝ≥0) : ℝ) * + (2 * (∑ j, (C j : ℝ) * ((Fintype.card (J j) : ℝ) + 1)) + 1) ^ + Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) ≤ + Real.exp (allocatedSiteSpatialMassLog (allocatedComparisonDimension m p) w v) := by + let D := allocatedComparisonDimension m p + have hd := allocatedComparisonDimensions_of_primitive B rows hq hinj hp hvars hI hn + obtain ⟨hD, hmD, hpD, _⟩ := allocatedComparisonDimension_bounds m hp + have hQD (j : Fin m) : (Fintype.card (Q j) : ℝ) ≤ D := + (Nat.cast_le.mpr (coefficientLatticeBasis_card_le U b hb bW j)).trans ((hJ j).trans hpD) + have hper : (period : ℝ) ≤ Real.exp (D ^ 2) := by + calc + _ ≤ (M : ℝ) ^ (m + 1) := by exact_mod_cast hperiod + _ ≤ Real.exp p ^ (m + 1) := pow_le_pow_left₀ (Nat.cast_nonneg _) hM _ + _ = Real.exp ((m + 1 : ℕ) * p) := (Real.exp_nat_mul p (m + 1)).symm + _ ≤ _ := Real.exp_le_exp.mpr (by + simpa only [pow_two] using mul_le_mul hmD hpD hp hD) + exact allocatedSiteSpatialMass_exp_bound O Q J C period _ _ CM Cf hd.nonneg hw + hd.degree hd.rows hQD (fun j => (hJ j).trans hpD) hd.axes hd.outputs + (fun j => (hC j).trans (Real.exp_le_exp.mpr hpD)) hper hCM hCf + +theorem allocatedSiteSpatial_primitive_error_budget + {α : Type*} [Fintype α] (rows : ∀ j, O j → Finset α) + (hq : Fintype.card α ≤ m + 1) (hinj : ∀ j, Function.Injective (rows j)) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + {Q : Fin m → Type*} [∀ j, Fintype (Q j)] + (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + (M period : ℕ) (hperiod : period ≤ M ^ (m + 1)) (CM Cf : ℝ≥0) (C : Fin m → ℝ≥0) + {p w v E δ δFourier ε : ℝ} (hp : 0 ≤ p) (hw : 0 ≤ w) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ p) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ p) (hn : ∀ j, (n j : ℝ) ≤ p) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hM : (M : ℝ) ≤ Real.exp p) (hC : ∀ j, (C j : ℝ) ≤ Real.exp p) + (hCM : (CM : ℝ) ≤ Real.exp w) (hCf : (Cf : ℝ) ≤ Real.exp v) + (hδ : δ ≤ allocatedSitePrimitiveTolerance m p w v E) + (hδFourier : δFourier ≤ physicalIdealErrorShare E 1) + (hε : ε ≤ physicalIdealErrorShare E 1) : + δ * ((Real.toNNReal (coefficientDeckPeriodCap O Q period) * + CM ^ Fintype.card (LayerSamplerAxis I n) * Cf : ℝ≥0) : ℝ) * + (2 * (∑ j, (C j : ℝ) * ((Fintype.card (J j) : ℝ) + 1)) + 1) ^ + Fintype.card (Σ a : LayerSamplerAxis I n, O a.1) + 2 * δFourier + ε ≤ + Real.exp (-E) := by + have hmass := allocatedSiteSpatialMass_primitive_bound B U b rows hq hinj hb bW M period + hperiod CM Cf C hp hw hvars hI hn hJ hM hC hCM hCf + have herr := allocatedSiteSpatial_error_budget (by positivity) hmass hδ hδFourier hε + simpa only [mul_assoc] using herr + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSiteTermSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSiteTermSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..00589fbf497472925828445e130d87053c3f77c1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSiteTermSupport.lean @@ -0,0 +1,93 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSiteBufferLog +import OAI.Combinatorics.Progressions.Estimates.MixedCoveredSiteExtraction + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + +noncomputable def allocatedSiteJetSize (α : Type*) [Fintype α] (j : Fin m) : ℝ := + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ (j.val + 1)) + idealSiteEnvelopeRadius α m + +theorem allocatedSiteJetSize_nonneg (α : Type*) [Fintype α] (j : Fin m) : + 0 ≤ allocatedSiteJetSize (G := G) B α j := by + have h := (idealSiteEnvelopeRadius_pos α m).le + unfold allocatedSiteJetSize + positivity + +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) (allocatedPrincipalSides B U b S)) + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "rows" => (fun j : Fin m => (Subtype.val : jets j → Finset α)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit jets I n grid + +theorem allocatedSiteBox_mixed_coordinate_bounds (hσ1 : ∀ j, σ j ≤ 1) + (z : ∀ j, (I j → jets j → ℝ) × (Fin (n j) → jets j → ℤ)) + (hz : allocatedGridJetDensity B U b hR hσ S x u v rows + (fun a => coefficientJetAxisEquiv jets I n z a.val) ≠ 0) + (hsites : ∀ s a, |allocatedIdealSiteCoordinates B U b S (split z).2 s a| ≤ 2 * idealSiteBoxRadius α m) + (j : Fin m) (r : jets j) : + (∀ i, |(z j).1 i r| ≤ allocatedSiteJetSize (G := G) B α j * R j) ∧ + (∀ i, |((z j).2 i r : ℝ) / basisAxisScale (b j) i| ≤ allocatedSiteJetSize (G := G) B α j * R j) := by + have hnorm := allocatedIdealNormalizedJets_bound_of_sites B U b S (split z).2 + (mul_nonneg (by norm_num) (idealSiteBoxRadius_pos α m).le) hsites + have hactive (a : {a // ¬grid a}) (t : jets a.val.1) : + |allocatedLongJetRealCoordinates B U b S (split z).2 ⟨a, t⟩| ≤ + idealSiteEnvelopeRadius α m * R a.val.1 := by + have h := (norm_le_pi_norm (fun q : (Σ a : {a // ¬grid a}, jets a.val.1) => + allocatedLongJetRealCoordinates B U b S (split z).2 q / R q.1.val.1) ⟨a, t⟩).trans hnorm + rw [Real.norm_eq_abs, abs_div, abs_of_pos (hR a.val.1)] at h + exact (div_le_iff₀ (hR a.val.1)).mp h + have hlong : idealSiteEnvelopeRadius α m ≤ allocatedSiteJetSize (G := G) B α j := by + unfold allocatedSiteJetSize + exact le_add_of_nonneg_left (by positivity) + constructor + · intro i + exact (hactive ⟨⟨j, Sum.inl i⟩, by change ¬False; exact not_false⟩ r).trans + (mul_le_mul_of_nonneg_right hlong (hR j).le) + · intro i + by_cases hg : grid ⟨j, Sum.inr i⟩ + · have h := allocatedGridJetDensity_scaled_support_bound B U b hR hσ S x u v rows z hz j (hσ1 j) i hg r + apply h.trans + apply mul_le_mul_of_nonneg_right _ (hR j).le + exact le_add_of_nonneg_right (idealSiteEnvelopeRadius_pos α m).le + · exact (hactive ⟨⟨j, Sum.inr i⟩, hg⟩ r).trans + (mul_le_mul_of_nonneg_right hlong (hR j).le) + +theorem allocatedSiteBox_mixed_point_bound (hσ1 : ∀ j, σ j ≤ 1) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + {Q : Fin m → Type*} (d : ℕ) (z : MixedCoveredJetSource I jets Q n d) + (hz : allocatedGridJetDensity B U b hR hσ S x u v rows + (fun a => coefficientJetAxisEquiv jets I n z.1 a.val) ≠ 0) + (hsites : ∀ s a, |allocatedIdealSiteCoordinates B U b S (split z.1).2 s a| ≤ 2 * idealSiteBoxRadius α m) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (j : Fin m) (r : jets j) : + ‖normalizedLatticePoint (euclideanSubspace (U j)) (b j) (mixedCoveredJetCoordinates U o d z j r).1‖ ≤ + C j * (((Fintype.card (I j) : ℝ) + 1) * (allocatedSiteJetSize (G := G) B α j * R j)) := by + obtain ⟨hr, hi⟩ := allocatedSiteBox_mixed_coordinate_bounds B U b hR hσ S x u v hσ1 z.1 hz hsites j r + exact mixedRealPoint_norm_le (euclideanSubspace (U j)) (b j) (o j) (hC j) + (mul_nonneg (allocatedSiteJetSize_nonneg B α j) (hR j).le) (hchart j) + (fun i => (z.1 j).1 i r) (fun i => ((z.1 j).2 i r : ℝ) / basisAxisScale (b j) i) hr hi + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedIdealSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedIdealSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..306649a9f08d315e98309b2597fad255dab26d22 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedIdealSupport.lean @@ -0,0 +1,76 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedBooleanSite + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped Classical BigOperators NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (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)] (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 "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Coeff" => ActiveProfileCoefficientIndex G B degree grid +local notation "Row" => OneCubeActiveRow grid +local notation "axis" => (fun e : Row => Subtype.val (Prod.snd e)) + +local notation "Endpoint" => OneCubeActiveEndpoint (B := B) degree grid +local notation "Output" => (Σ _e : Row, Unit) + +omit [∀ index, DecidableEq (B index)] in +theorem allocatedSlicedNormalizedIdeal_norm_le [∀ index, DecidableEq (B index)] + (lower width : ∀ a : {a // ¬grid a}, B a.val × Fin (degree a.val) → ℝ) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + (r : Coeff → ℝ) (hr : ∀ j, |r j| ≤ 1) + (x : Endpoint → ℝ) (hx : ∀ j, |x j| ≤ 1) : + ‖allocatedSlicedNormalizedIdeal B U basis S lower width r x‖ ≤ 2 := by + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)).mpr + intro o + have hp := principalSliceValue_abs_le + (jointSlicedProfilePrincipal degree axis (unitProfilePrincipalSize (B := B)) (fun e j => r ⟨e.2,j⟩) o.1) + (lower o.1.2) (width o.1.2) (hwidth o.1.2) + (fun j => x ⟨o.1,j⟩) (fun j => hx _) + have hm := jointSlicedProfilePrincipal_unit_mass degree axis (fun e j => r ⟨e.2,j⟩) (fun e j => hr _) o.1 + have hc : |(1 / 4 : ℝ) * r ⟨o.1.2, constantCoefficientSlot _ _⟩| ≤ 1 / 4 := by + rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 4)] + exact mul_le_of_le_one_right (by norm_num) (hr _) + change |(1 / 4 : ℝ) * r ⟨o.1.2, constantCoefficientSlot _ _⟩ + + principalSliceValue _ _ _ _| ≤ 2 + exact (abs_add_le _ _).trans ((add_le_add hc (hp.trans hm)).trans (by norm_num)) + +theorem allocatedSlicedAveragedIdealDensity_zero_off_ball + (hB : ∀ a : {a // ¬grid a}, 4 ≤ Fintype.card (B a.val)) + (lower width : ∀ a : {a // ¬grid a}, B a.val × Fin (degree a.val) → ℝ) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ : ℝ} (ha : 0 < a) (hδ : 0 < δ) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (z : Output → ℝ) (hz : 2 < ‖z‖) : + allocatedSlicedAveragedIdealDensity B U basis S hB lower width z = 0 := by + have hd := allocatedSlicedAveragedIdealDensity_law_probability B U basis S hB lower width ha hδ hprincipal hw hl + have hb := allocatedSlicedAveragedIdealDensity_cap_lipschitz B U basis S hB lower width ha hδ hprincipal hw hl + have hm := allocatedSlicedNormalizedIdeal_measurable B U basis S lower width + apply continuousDensity_zero_off_closed volume _ hb.2.continuous hd.2.1 (S := Metric.closedBall 0 2) Metric.isClosed_closedBall ?_ z + (by simpa only [Metric.mem_closedBall, dist_zero_right, not_le] using hz) + rw [← hd.1] + apply (ae_map_iff hm.aemeasurable Metric.isClosed_closedBall.measurableSet).mpr + apply (Measure.ae_prod_iff_ae_ae (Metric.isClosed_closedBall.measurableSet.preimage hm)).mpr + filter_upwards [unitCoefficientSource_abs_le Coeff] with r hr + filter_upwards [unitBoxMeasure_ae] with x hx + rw [Metric.mem_closedBall, dist_zero_right] + exact allocatedSlicedNormalizedIdeal_norm_le B U basis S lower width hwidth r hr x + (fun j => by rw [abs_of_nonneg (hx j).1.le]; exact (hx j).2) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedOneCubeRowTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedOneCubeRowTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb76373bf3f72a1ca819de4ef50ec30b9a2ecdbc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedOneCubeRowTransport.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedProductPrefactorCap +import OAI.Combinatorics.Progressions.Estimates.AllocatedWholeProfileRowReindex + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set +open scoped Classical + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable (rowSets : Fin m → Finset (Finset (Fin 1))) (hrows : ∀ j t, t ∈ rowSets j) +variable (x : G → IntegerScalarCubeBox (Fin 1) S.value) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "rows" => (fun j : Fin m => {t : Finset (Fin 1) // t ∈ rowSets j}) +local notation "e" => (fun j => Equiv.symm (oneCubeRowsEquiv (rowSets j) (hrows j))) +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +omit [∀ a, DecidableEq (B a)] in +theorem allocatedWholeMaskedSlicedProfile_oneCube_rows + (w : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin 1) (allocatedPrincipalSides B U b S)) + (q : ℕ) (y : EuclideanJetLayers U (fun _ => Finset (Fin 1))) : + allocatedWholeMaskedCoveredProfile B U b hR hσ S x (fun j => (Subtype.val : rows j → Finset (Fin 1))) + hb o bW d w q (allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width) + (euclideanJetRowsReindex e U y) = + allocatedWholeMaskedCoveredProfile B U b hR hσ S x (fun _ => id) hb o bW d w q + (allocatedSlicedPhysicalJetIdeal B U b S hR hB lower width) y := + allocatedWholeMaskedCoveredProfile_reindex_rows B U b hR hσ S x e (fun _ => id) hb o bW d w q _ y + +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, SigmaFinite (ν j)] + +omit [∀ a, DecidableEq (B a)] in +theorem allocatedWholeMaskedSlicedProfile_oneCube_mean_integral + {A : Type*} [Fintype A] (p : FiniteProbabilityWeights A) + (w : A → PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin 1) (allocatedPrincipalSides B U b S)) + (q : ℕ) (F : EuclideanJetLayers U rows → ℂ) : + (∫ y, (p.mean (fun a => allocatedWholeMaskedCoveredProfile B U b hR hσ S x + (fun j => (Subtype.val : rows j → Finset (Fin 1))) hb o bW d (w a) q + (allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width) y) : ℂ) * F y + ∂Measure.pi (fun j => Measure.pi (fun _ : rows j => ν j))) = + ∫ y, (p.mean (fun a => allocatedWholeMaskedCoveredProfile B U b hR hσ S x (fun _ => id) + hb o bW d (w a) q (allocatedSlicedPhysicalJetIdeal B U b S hR hB lower width) y) : ℂ) * + F (euclideanJetRowsReindex e U y) + ∂Measure.pi (fun j => Measure.pi (fun _ : Finset (Fin 1) => ν j)) := + allocatedWholeMaskedCoveredProfile_reindex_mean_integral B U b hR hσ S x e (fun _ => id) + hb o bW d ν p w q _ F + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedRowIdealSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedRowIdealSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8a7e7649be4fa1f072d7c8afd8e8f33b0d8dc76 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedRowIdealSupport.lean @@ -0,0 +1,655 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedProductPrefactorCap + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (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)] (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 σ) +variable (x : G → IntegerScalarCubeBox (Fin 1) S.value) +variable (u : PrincipalAxisTuples (α := Fin 1) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S)) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Coeff" => ActiveProfileCoefficientIndex G B degree grid +local notation "Endpoint" => OneCubeActiveEndpoint (B := B) degree grid +local notation "Jet" => (Σ _a : {a // ¬grid a}, Finset (Fin 1)) + +local notation "Output" => (Σ _e : OneCubeActiveRow grid, Unit) + +variable (hR : ∀ j, 0 < R j) +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U basis S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U basis S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +theorem allocatedSlicedPhysicalJetIdeal_coordinate_support + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ : ℝ} (ha : 0 < a) (hδ : 0 < δ) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (z : Jet → ℝ) (hz : allocatedSlicedPhysicalJetIdeal B U basis S hR hB lower width z ≠ 0) + (a₀ : {a // ¬grid a}) (t : Finset (Fin 1)) : + |z ⟨a₀,t⟩| ≤ 4 * R a₀.val.1 := by + let e := oneCubeJetEndpointEquiv {a // ¬grid a} + let w : Output → ℝ := fun o => e z o / R o.1.2.val.1 + have hw0 : allocatedSlicedAveragedIdealDensity B U basis S hB lower width w ≠ 0 := by + intro he + apply hz + unfold allocatedSlicedPhysicalJetIdeal allocatedSlicedPhysicalEndpointIdeal + rw [diagonalDensityTransport_eq, oneCubeJointJetEndpoints_equiv] + change |∏ o : Output, R o.1.2.val.1|⁻¹ * allocatedSlicedAveragedIdealDensity B U basis S hB lower width w = 0 + rw [he, mul_zero] + have hw2 : ‖w‖ ≤ 2 := le_of_not_gt (fun h => hw0 + (allocatedSlicedAveragedIdealDensity_zero_off_ball B U basis S hB lower width hwidth ha hδ hprincipal hw hl w h)) + have hend (β : Bool) : |e z ⟨(β,a₀),()⟩| ≤ 2 * R a₀.val.1 := by + have he := (norm_le_pi_norm w (⟨(β,a₀),()⟩ : Output)).trans hw2 + change ‖e z ⟨(β,a₀),()⟩ / R a₀.val.1‖ ≤ 2 at he + rw [Real.norm_eq_abs, abs_div, abs_of_pos (hR _)] at he + exact (div_le_iff₀ (hR _)).mp he + have h₀ := hend false + have h₁ := hend true + simp only [e, oneCubeJetEndpointEquiv_apply, Bool.false_eq_true, ↓reduceIte] at h₀ h₁ + fin_cases t + · change |z ⟨a₀,∅⟩| ≤ _ + linarith only [h₀, hR a₀.val.1] + · change |z ⟨a₀,{0}⟩| ≤ _ + have hsub : |z ⟨a₀,{0}⟩| ≤ |z ⟨a₀,∅⟩ + z ⟨a₀,{0}⟩| + |z ⟨a₀,∅⟩| := by + have h := abs_sub_le (z ⟨a₀,∅⟩ + z ⟨a₀,{0}⟩) 0 (z ⟨a₀,∅⟩) + simpa only [add_sub_cancel_left, sub_zero, zero_sub, abs_neg] using h + linarith only [h₀, h₁, hsub] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module +open scoped BigOperators Classical Matrix + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (O : Fin m → Type*) [∀ j, Fintype (O j)] + +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {α : Type*} [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (rows : ∀ j, O j → Finset α) + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit O I n grid +local notation "gridRef" => allocatedFrozenJetReference B U b S O +local notation "longRef" => allocatedLongJetReference B U b S O +local notation "rawRef" => Measure.pi (fun j => mixedArrayReference (I j) (Fin (n j)) (O j)) +local notation "fg" => allocatedGridJetDensity B U b hR hσ S x u v rows + +theorem allocatedFrozenProfile_mixed_integral + (f : AllocatedLongJetRows B U b S O → ℝ) (hfm : Measurable f) + (hf : Integrable f longRef) + (φ : (∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) → ℂ) + (hφ : Measurable φ) {C : ℝ} (hbound : ∀ z, ‖φ z‖ ≤ C) : + (∫ a, ∫ z, (f z : ℂ) * φ (allocatedMixedJetReconstruct B U b S x u v rows a z) + ∂longRef ∂allocatedFrozenCoefficientSource B U b hR hσ S) = + ∫ z, ((fg ((split z).1) * f ((split z).2) : ℝ) : ℂ) * φ z ∂rawRef := by + let ψ := fun p : AllocatedFrozenJetRows B U b S O × AllocatedLongJetRows B U b S O => + (f p.2 : ℂ) * φ ((split).symm p) + have hψ : Measurable ψ := + (Complex.measurable_ofReal.comp (hfm.comp measurable_snd)).mul + (hφ.comp (split).symm.measurable) + have hint : Measurable (fun g => ∫ z, ψ (g, z) ∂longRef) := + hψ.stronglyMeasurable.integral_prod_right'.measurable + have hfg := (allocatedGridJetDensity_probability_data B U b S O hR hσ x u v rows).1 + have hprod : Integrable (fun p : AllocatedFrozenJetRows B U b S O × AllocatedLongJetRows B U b S O => + ((fg p.1 * f p.2 : ℝ) : ℂ) * φ ((split).symm p)) ((gridRef).prod longRef) := + (hfg.mul_prod hf).ofReal.mul_bdd (hφ.comp (split).symm.measurable).aestronglyMeasurable + (Filter.Eventually.of_forall (fun p => hbound _)) + calc + _ = ∫ g, (fg g : ℂ) * (∫ z, ψ (g, z) ∂longRef) ∂gridRef := by + change (∫ a, (fun g => ∫ z, ψ (g, z) ∂longRef) + (allocatedFrozenJetMap B U b S x u v rows a) + ∂allocatedFrozenCoefficientSource B U b hR hσ S) = _ + rw [← integral_map (allocatedFrozenJetMap_measurable B U b S x u v rows).aemeasurable + hint.aestronglyMeasurable, allocatedGridJetDensity_law B U b S O hR hσ x u v rows, + realDensityMeasure_integral_complex gridRef fg + (allocatedGridJetDensity_measurable B U b hR hσ S x u v rows) + (fun z => (allocatedGridJetDensity_mem_Icc B U b hR hσ S x u v rows z).1)] + _ = ∫ g, ∫ z, ((fg g * f z : ℝ) : ℂ) * φ ((split).symm (g, z)) ∂longRef ∂gridRef := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun g => by + calc + _ = ∫ z, (fg g : ℂ) * ψ (g, z) ∂longRef := + (integral_const_mul (fg g : ℂ) (fun z => ψ (g, z))).symm + _ = _ := integral_congr_ae (Filter.Eventually.of_forall + (fun z => by simp only [ψ, Complex.ofReal_mul, mul_assoc]))) + _ = ∫ p, ((fg p.1 * f p.2 : ℝ) : ℂ) * φ ((split).symm p) ∂(gridRef).prod longRef := + (integral_prod _ hprod).symm + _ = _ := by + have he := coefficientJetAxisSplit_measurePreserving O I n grid + have hh := he.integral_comp (split).measurableEmbedding + (fun p => ((fg p.1 * f p.2 : ℝ) : ℂ) * φ ((split).symm p)) + simpa only [allocatedFrozenJetReference, allocatedLongJetReference, + MeasurableEquiv.symm_apply_apply] using hh.symm + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule +open scoped Classical + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v₀ : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] +variable (rows : ∀ j, O j → Finset α) +variable (Q : Fin m → Type*) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit O I n grid +local notation "gridRef" => allocatedFrozenJetReference B U b S O +local notation "longRef" => allocatedLongJetReference B U b S O +local notation "mixedRef" => Measure.pi (fun j => mixedArrayReference (I j) (Fin (n j)) (O j)) +local notation "raw" => mixedCoveredJetRawReference (I := I) (O := O) (E := Q) (n := n) d +local notation "root" => allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (principalAxisJoin grid u v₀) +local notation "dirs" => allocatedPhysicalCubeDirections B U b S x (principalAxisJoin grid u v₀) +local notation "fg" => allocatedGridJetDensity B U b hR hσ S x u v₀ rows +local notation "fd" => coefficientDeckJetDensity (B := Q) root dirs rows d +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "deck" => PMF.uniformOfFintype (CoefficientDeckResidues (K := LayerSamplerVariables G I n B) Q d) + +omit [Fintype α] in +theorem allocatedCoveredDeck_density_test + (F : EuclideanJetLayers U O → ℂ) + (t : ∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) : + (∫ r, F (chart (t, coefficientDeckJetMap root dirs rows d r)) ∂(deck).toMeasure) = + ∫ r, (fd r : ℂ) * F (chart (t, r)) + ∂(PMF.uniformOfFintype (∀ j, O j → Q j → ZMod d)).toMeasure := by + have he := coefficientDeckJetDensity_integral + (K := LayerSamplerVariables G I n B) (O := O) (B := Q) + root dirs rows d (fun r => F (chart (t, r))) + convert he using 1 + apply congrArg (fun p : PMF (CoefficientDeckResidues (K := LayerSamplerVariables G I n B) Q d) => + ∫ r, F (chart (t, coefficientDeckJetMap root dirs rows d r)) ∂p.toMeasure) + exact congrArg (fun i : Fintype (CoefficientDeckResidues (K := LayerSamplerVariables G I n B) Q d) => + @PMF.uniformOfFintype (CoefficientDeckResidues (K := LayerSamplerVariables G I n B) Q d) i _) + (Subsingleton.elim _ _) + +omit [Fintype α] in +theorem allocatedCoveredProfile_raw_integral + (f : AllocatedLongJetRows B U b S O → ℝ) (hfm : Measurable f) + (hf : Integrable f longRef) + (F : EuclideanJetLayers U O → ℂ) (hF : Measurable F) + {C : ℝ} (hbound : ∀ z, ‖F z‖ ≤ C) : + (∫ a, ∫ z, (f z : ℂ) * + allocatedCoveredFixedTest B U b S x u v₀ rows Q hb o bW d (fun p => F p.2) a z + ∂longRef ∂allocatedFrozenCoefficientSource B U b hR hσ S) = + ∫ z, (allocatedGridlessWeightedKernel B U b S x u v₀ rows (Q := Q) d fg f z : ℂ) * + F (chart z) ∂raw := by + let φ := fun t : ∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ) => + ∫ r, F (chart (t, coefficientDeckJetMap root dirs rows d r)) ∂(deck).toMeasure + have hchart : Measurable chart := + (coveredJetChart_continuous (O := O) U b hb bW d).measurable.comp + (mixedCoveredJetCoordinates_measurable (O := O) (B := Q) (n := n) U o d) + have hφ : Measurable φ := finitePMF_integral_measurable deck _ + (fun r => hF.comp (hchart.comp (measurable_id.prodMk measurable_const))) + have hφb : ∀ t, ‖φ t‖ ≤ C := fun t => finitePMF_integral_norm_le deck _ (fun r => hbound _) + have hφeq (t) : φ t = ∫ r, (fd r : ℂ) * F (chart (t, r)) ∂(PMF.uniformOfFintype (∀ j, O j → Q j → ZMod d)).toMeasure := by + exact allocatedCoveredDeck_density_test B U b S x u v₀ rows Q hb o bW d F t + have hi := (allocatedGridlessWeightedKernel_mass_data B U b S x u v₀ rows (Q := Q) d fg f + (allocatedGridJetDensity_probability_data B U b S O hR hσ x u v₀ rows).1 hf).1 + have hprod : Integrable (fun z : MixedCoveredJetSource I O Q n d => + (allocatedGridlessWeightedKernel B U b S x u v₀ rows (Q := Q) d fg f z : ℂ) * + F (chart z)) raw := + hi.ofReal.mul_bdd (hF.comp hchart).aestronglyMeasurable + (Filter.Eventually.of_forall (fun z => hbound _)) + calc + _ = ∫ t, ((fg ((split t).1) * f ((split t).2) : ℝ) : ℂ) * φ t ∂mixedRef := + allocatedFrozenProfile_mixed_integral B U b S O hR hσ x u v₀ rows f hfm hf φ hφ hφb + _ = ∫ t, ∫ r, + (allocatedGridlessWeightedKernel B U b S x u v₀ rows (Q := Q) d fg f (t, r) : ℂ) * + F (chart (t, r)) ∂(PMF.uniformOfFintype (∀ j, O j → Q j → ZMod d)).toMeasure ∂mixedRef := by + apply integral_congr_ae + apply Filter.Eventually.of_forall + intro t + change ((fg ((split t).1) * f ((split t).2) : ℝ) : ℂ) * φ t = _ + rw [hφeq t] + rw [← integral_const_mul (((fg ((split t).1) * f ((split t).2) : ℝ) : ℂ))] + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun r => by + simp only [allocatedGridlessWeightedKernel, Complex.ofReal_mul, mul_assoc]) + _ = _ := (integral_prod _ hprod).symm + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] +variable (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) +variable (hΩm : ∀ j t, MeasurableSet (Ω j t)) +variable (hΩ : ∀ j t, Ω j t ⊆ standardLatticeSmallBox (J j)) + +omit [Fintype α] in +include hΩm hΩ in +theorem allocatedCoveredProfile_test_integral + (f : AllocatedLongJetRows B U b S O → ℝ) (hfm : Measurable f) + (hf : Integrable f longRef) (hf0 : ∀ z, 0 ≤ f z) + (hfs : ∀ z ∉ mixedCoveredJetRegion (E := Q) U o b d Ω, + allocatedGridlessWeightedKernel B U b S x u v₀ rows (Q := Q) d fg f z = 0) + (F : EuclideanJetLayers U O → ℂ) (hF : Measurable F) + {C : ℝ} (hbound : ∀ z, ‖F z‖ ≤ C) : + (∫ a, ∫ z, (f z : ℂ) * + allocatedCoveredFixedTest B U b S x u v₀ rows Q hb o bW d (fun p => F p.2) a z + ∂longRef ∂allocatedFrozenCoefficientSource B U b hR hσ S) = + ∫ y, (allocatedCoveredProfileDensity B U b hR hσ S x u v₀ rows hb o bW d Ω f y : ℂ) * + F y ∂Measure.pi (fun j => Measure.pi (fun _ : O j => ν j)) := by + rw [allocatedCoveredProfile_raw_integral B U b hR hσ S x u v₀ rows Q hb o bW d f hfm hf F hF hbound] + have hm := allocatedGridlessWeightedKernel_measurable B U b S x u v₀ rows (Q := Q) d fg f + (allocatedGridJetDensity_measurable B U b hR hσ S x u v₀ rows) hfm + have h0 (z : MixedCoveredJetSource I O Q n d) : + 0 ≤ allocatedGridlessWeightedKernel B U b S x u v₀ rows (Q := Q) d fg f z := + mul_nonneg (mul_nonneg + (allocatedGridJetDensity_mem_Icc B U b hR hσ S x u v₀ rows _).1 (hf0 _)) + (coefficientDeckJetDensity_nonneg root dirs rows d _) + have he := mixedCoveredJet_normalized_complex_integral U o b hb bW d ν Ω hΩm hΩ _ hm h0 hfs F hF + have hid : (fun z : MixedCoveredJetSource I O Q n d => + allocatedGridlessWeightedKernel B U b S x u v₀ rows (Q := Q) d fg f z / + coveredJetArrayScale (O := O) U) = + (fun z => allocatedCoveredFixedFactor B U b hR hσ S x u v₀ rows Q d z.1 z.2 * f ((split z.1).2)) := by + funext z + change fg ((split z.1).1) * f ((split z.1).2) * fd z.2 / coveredJetArrayScale (O := O) U = + (fg ((split z.1).1) * fd z.2 / coveredJetArrayScale (O := O) U) * f ((split z.1).2) + ring + rw [hid] at he + exact he + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule +open scoped Classical + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v₀ : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable {O : Fin m → Type*} [∀ j, Fintype (O j)] +variable (rows : ∀ j, O j → Finset α) +variable (Q : Fin m → Type*) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit O I n grid +local notation "gridRef" => allocatedFrozenJetReference B U b S O +local notation "longRef" => allocatedLongJetReference B U b S O +local notation "mixedRef" => Measure.pi (fun j => mixedArrayReference (I j) (Fin (n j)) (O j)) +local notation "raw" => mixedCoveredJetRawReference (I := I) (O := O) (E := Q) (n := n) d +local notation "root" => allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (principalAxisJoin grid u v₀) +local notation "dirs" => allocatedPhysicalCubeDirections B U b S x (principalAxisJoin grid u v₀) +local notation "fg" => allocatedGridJetDensity B U b hR hσ S x u v₀ rows +local notation "fd" => coefficientDeckJetDensity (B := Q) root dirs rows d +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "deck" => PMF.uniformOfFintype (CoefficientDeckResidues (K := LayerSamplerVariables G I n B) Q d) + +theorem allocatedGridlessWeightedKernel_quarter_support + (hσ1 : ∀ j, σ j ≤ 1) + (T : Fin m → ℝ) (hT : ∀ j, 0 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) + (f : AllocatedLongJetRows B U b S O → ℝ) + (hs : ∀ z, f z ≠ 0 → ∀ a : {a // ¬grid a}, ∀ t : O a.val.1, + |allocatedLongJetRealCoordinates B U b S z ⟨a, t⟩| ≤ T a.val.1 * R a.val.1) + (z : MixedCoveredJetSource I O Q n d) + (hz : allocatedGridlessWeightedKernel B U b S x u v₀ rows (Q := Q) d fg f z ≠ 0) : + z ∈ mixedCoveredJetRegion (E := Q) U o b d + (fun j (_ : O j) => standardLatticeClosedQuarterBox (J j)) := by + have hmul : fg ((split z.1).1) * f ((split z.1).2) ≠ 0 := + (mul_ne_zero_iff.mp hz).1 + have hg := (mul_ne_zero_iff.mp hmul).1 + have hl := hs _ (mul_ne_zero_iff.mp hmul).2 + have hr (j : Fin m) (t : O j) (i : I j) : |(z.1 j).1 i t| ≤ T j * R j := + hl ⟨⟨j, Sum.inl i⟩, by change ¬False; exact not_false⟩ t + have hi (j : Fin m) (t : O j) (i : Fin (n j)) : + |((z.1 j).2 i t : ℝ) / basisAxisScale (b j) i| ≤ T j * R j := by + by_cases ha : grid ⟨j, Sum.inr i⟩ + · exact (allocatedGridJetDensity_scaled_support_bound B U b hR hσ S x u v₀ rows z.1 hg j + (hσ1 j) i ha t).trans (mul_le_mul_of_nonneg_right (hsource j) (hR j).le) + · exact hl ⟨⟨j, Sum.inr i⟩, ha⟩ t + intro j _ t _ + refine ⟨?_, Set.mem_univ _⟩ + intro i + have hn : ‖normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (mixedCoveredJetCoordinates U o d z j t).1‖ ≤ 1 / 4 := + (mixedRealPoint_norm_le (euclideanSubspace (U j)) (b j) (o j) (hC j) + (mul_nonneg (hT j) (hR j).le) (hchart j) _ _ (hr j t) (hi j t)).trans (hbudget j) + have hc : |normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (mixedCoveredJetCoordinates U o d z j t).1 i| ≤ + ‖normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (mixedCoveredJetCoordinates U o d z j t).1‖ := by + simpa only [Real.norm_eq_abs] using PiLp.norm_apply_le + (normalizedLatticePoint (euclideanSubspace (U j)) (b j) + (mixedCoveredJetCoordinates U o d z j t).1) i + exact hc.trans hn + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule +open scoped Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (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)] (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 σ) +variable (x : G → IntegerScalarCubeBox (Fin 1) S.value) +variable (u : PrincipalAxisTuples (α := Fin 1) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S)) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Coeff" => ActiveProfileCoefficientIndex G B degree grid +local notation "Endpoint" => OneCubeActiveEndpoint (B := B) degree grid +local notation "Jet" => (Σ _a : {a // ¬grid a}, Finset (Fin 1)) + +local notation "Output" => (Σ _e : OneCubeActiveRow grid, Unit) + +variable (hR : ∀ j, 0 < R j) +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U basis S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U basis S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (hσ : ∀ j, 0 < σ j) +variable (v₀ : PrincipalAxisTuples (α := Fin 1) (fun a => ¬allocatedGridAxis (I := I) U basis S.value a) + (allocatedPrincipalSides B U basis S)) +variable (Q : Fin m → Type*) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +local notation "jetRows" => (fun _ : Fin m => Finset (Fin 1)) +local notation "ideal" => allocatedSlicedPhysicalJetIdeal B U basis S hR hB lower width +local notation "reference" => allocatedLongJetReference B U basis S jetRows + +theorem allocatedSlicedCoveredProfile_test_integral + (O : ℕ) (hO : Fintype.card (OneCubeActiveRow grid) ≤ O) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ P : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hP : 0 ≤ P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (hRbound : ∀ j, R j ≤ Real.exp P) (hInv : ∀ j, (R j)⁻¹ ≤ Real.exp P) + (modulus : ℕ) + (residue : ∀ j, Matrix (Finset (Fin 1)) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) + {Cmask : ℝ} (hCmask : 1 ≤ Cmask) + (hmask : ∀ j z, 0 ≤ allocatedIntegerKernelMask B U basis S x (fun _ => id) j modulus (residue j) z ∧ + allocatedIntegerKernelMask B U basis S x (fun _ => id) j modulus (residue j) z ≤ Cmask) + (hσ1 : ∀ j, σ j ≤ 1) + (T : Fin m → ℝ) (hT : ∀ j, 4 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin 1) * ((Fintype.card (Fin 1) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) + (F : EuclideanJetLayers U jetRows → ℂ) (hF : Measurable F) + {CF : ℝ} (hFb : ∀ z, ‖F z‖ ≤ CF) : + let f := allocatedLongProfileDensity B U basis S x (fun _ => id) modulus residue ideal + (∫ a₀, ∫ z, (f z : ℂ) * allocatedCoveredFixedTest B U basis S x u v₀ (fun _ => id) + Q hb o bW d (fun p => F p.2) a₀ z ∂reference ∂allocatedFrozenCoefficientSource B U basis hR hσ S) = + ∫ y, (allocatedCoveredProfileDensity B U basis hR hσ S x u v₀ (fun _ => id) hb o bW d + (fun j (_ : Finset (Fin 1)) => standardLatticeClosedQuarterBox (J j)) f y : ℂ) * F y + ∂Measure.pi (fun j => Measure.pi (fun _ : Finset (Fin 1) => ν j)) := by + intro f + have hfm : Measurable f := allocatedLongProfileDensity_measurable B U basis S x (fun _ => id) + modulus residue ideal (allocatedSlicedPhysicalJetIdeal_measurable B U basis S hR hB lower width) + have hfi : Integrable f reference := allocatedSlicedLongProfile_integrable B U basis S x hR hB lower width + O hO hwidth ha hδ hP haP hδP hprincipal hw hl hRbound hInv modulus residue hCmask hmask + have hf0 : ∀ z, 0 ≤ f z := allocatedLongProfileDensity_nonneg B U basis S x (fun _ => id) + modulus residue ideal + (allocatedSlicedPhysicalJetIdeal_probability B U basis S hR hB lower width ha hδ hprincipal hw hl).1 + (fun j z => (hmask j z).1) + apply allocatedCoveredProfile_test_integral B U basis hR hσ S x u v₀ (fun _ => id) Q hb o bW d ν + (fun j (_ : Finset (Fin 1)) => standardLatticeClosedQuarterBox (J j)) + (fun j _ => (standardLatticeClosedQuarterBox_isCompact (J j)).measurableSet) + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) f hfm hfi hf0 ?_ F hF hFb + intro z hz + by_contra hn + apply hz + apply allocatedGridlessWeightedKernel_quarter_support B U basis hR hσ S x u v₀ (fun _ => id) Q o d + hσ1 T (fun j => le_trans (by norm_num) (hT j)) hsource C hC hchart hbudget f ?_ z hn + intro w hwne a₀ t + have hi := allocatedLongProfileDensity_ne_zero B U basis S x (fun _ => id) modulus residue ideal w hwne + exact (allocatedSlicedPhysicalJetIdeal_coordinate_support B U basis S hR hB lower width + hwidth ha hδ hprincipal hw hl _ hi a₀ t).trans + (mul_le_mul_of_nonneg_right (hT _) (hR _).le) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule +open scoped Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (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)] (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 σ) +variable (x : G → IntegerScalarCubeBox (Fin 1) S.value) +variable (u : PrincipalAxisTuples (α := Fin 1) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S)) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Coeff" => ActiveProfileCoefficientIndex G B degree grid +local notation "Endpoint" => OneCubeActiveEndpoint (B := B) degree grid +local notation "Jet" => (Σ _a : {a // ¬grid a}, Finset (Fin 1)) + +local notation "Output" => (Σ _e : OneCubeActiveRow grid, Unit) + +variable (hR : ∀ j, 0 < R j) +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U basis S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U basis S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (hσ : ∀ j, 0 < σ j) +variable (v₀ : PrincipalAxisTuples (α := Fin 1) (fun a => ¬allocatedGridAxis (I := I) U basis S.value a) + (allocatedPrincipalSides B U basis S)) +variable (Q : Fin m → Type*) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +local notation "jetRows" => (fun _ : Fin m => Finset (Fin 1)) +local notation "ideal" => allocatedSlicedPhysicalJetIdeal B U basis S hR hB lower width +local notation "reference" => allocatedLongJetReference B U basis S jetRows + +theorem allocatedSlicedCoveredProfile_mean_test_integral + (O : ℕ) (hO : Fintype.card (OneCubeActiveRow grid) ≤ O) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ P : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hP : 0 ≤ P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (hRbound : ∀ j, R j ≤ Real.exp P) (hInv : ∀ j, (R j)⁻¹ ≤ Real.exp P) + (modulus : ℕ) + (weights : FiniteProbabilityWeights (PrincipalAxisTuples (α := Fin 1) + (allocatedGridAxis (I := I) U basis S.value) (allocatedPrincipalSides B U basis S))) + (residue : PrincipalAxisTuples (α := Fin 1) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S) → ∀ j, Matrix (Finset (Fin 1)) (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) + {Cmask : ℝ} (hCmask : 1 ≤ Cmask) + (hmask : ∀ u j z, 0 ≤ allocatedIntegerKernelMask B U basis S x (fun _ => id) j modulus (residue u j) z ∧ + allocatedIntegerKernelMask B U basis S x (fun _ => id) j modulus (residue u j) z ≤ Cmask) + (hσ1 : ∀ j, σ j ≤ 1) + (T : Fin m → ℝ) (hT : ∀ j, 4 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin 1) * ((Fintype.card (Fin 1) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) + (F : EuclideanJetLayers U jetRows → ℂ) (hF : Measurable F) + {CF : ℝ} (hFb : ∀ z, ‖F z‖ ≤ CF) : + + let f := fun u => allocatedLongProfileDensity B U basis S x (fun _ => id) modulus (residue u) ideal + weights.complexMean (fun u => ∫ a₀, ∫ z, (f u z : ℂ) * + allocatedCoveredFixedTest B U basis S x u v₀ (fun _ => id) Q hb o bW d + (fun p => F p.2) a₀ z ∂reference ∂allocatedFrozenCoefficientSource B U basis hR hσ S) = + ∫ y, (weights.mean (fun u => allocatedCoveredProfileDensity B U basis hR hσ S x u v₀ (fun _ => id) + hb o bW d (fun j (_ : Finset (Fin 1)) => standardLatticeClosedQuarterBox (J j)) (f u) y) : ℂ) * F y + ∂Measure.pi (fun j => Measure.pi (fun _ : Finset (Fin 1) => ν j)) := by + intro f + let profile := fun u => allocatedCoveredProfileDensity B U basis hR hσ S x u v₀ (fun _ => id) + hb o bW d (fun j (_ : Finset (Fin 1)) => standardLatticeClosedQuarterBox (J j)) (f u) + have hi u : Integrable (fun y => (profile u y : ℂ) * F y) + (Measure.pi (fun j => Measure.pi (fun _ : Finset (Fin 1) => ν j))) := by + have hfm : Measurable (f u) := allocatedLongProfileDensity_measurable B U basis S x (fun _ => id) + modulus (residue u) ideal (allocatedSlicedPhysicalJetIdeal_measurable B U basis S hR hB lower width) + have hfi : Integrable (f u) reference := allocatedSlicedLongProfile_integrable B U basis S x hR hB lower width + O hO hwidth ha hδ hP haP hδP hprincipal hw hl hRbound hInv modulus (residue u) hCmask (hmask u) + exact (allocatedCoveredProfileDensity_integrable B U basis hR hσ S x u v₀ (fun _ => id) hb o bW d + (fun j (_ : Finset (Fin 1)) => standardLatticeClosedQuarterBox (J j)) + (fun j _ => (standardLatticeClosedQuarterBox_isCompact (J j)).measurableSet) + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) ν (f u) hfm hfi).ofReal.mul_bdd + hF.aestronglyMeasurable (Filter.Eventually.of_forall hFb) + calc + _ = weights.complexMean (fun u => ∫ y, (profile u y : ℂ) * F y + ∂Measure.pi (fun j => Measure.pi (fun _ : Finset (Fin 1) => ν j))) := by + apply congrArg weights.complexMean + funext u + exact allocatedSlicedCoveredProfile_test_integral B U basis S x u hR hB lower width hσ v₀ Q hb o bW d ν + O hO hwidth ha hδ hP haP hδP hprincipal hw hl hRbound hInv modulus (residue u) hCmask (hmask u) + hσ1 T hT hsource C hC hchart hbudget F hF hFb + _ = ∫ y, weights.complexMean (fun u => (profile u y : ℂ) * F y) + ∂Measure.pi (fun j => Measure.pi (fun _ : Finset (Fin 1) => ν j)) := + (weights.integral_complexMean _ _ hi).symm + _ = _ := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun y => weights.complexMean_ofReal_mul _ _) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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 [∀ a, DecidableEq (B a)] [∀ j, DecidableEq (I j)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (rowSets : Fin m → Finset (Finset (Fin 1))) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset (Fin 1) // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowTypes j → Finset (Fin 1))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit rowTypes I n grid +local notation "baseVolume" => (allocatedFullGridNaturalVolume B U b S rowSets * + coveredJetArrayScale (O := rowTypes) U * ∏ a, allocatedLongJetOutputScale B U b S (O := rowTypes) a) + +variable (hR : ∀ j, 0 < R j) (hrows : ∀ j t, t ∈ rowSets j) +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +omit [∀ index, DecidableEq (I index)] in +theorem allocatedSlicedRowIdeal_coordinate_support + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ : ℝ} (ha : 0 < a) (hδ : 0 < δ) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (z : (Σ a : {a // ¬grid a}, rowTypes a.val.1) → ℝ) + (hz : allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width z ≠ 0) + (a₀ : {a // ¬grid a}) (t : rowTypes a₀.val.1) : + |z ⟨a₀,t⟩| ≤ 4 * R a₀.val.1 := + allocatedSlicedPhysicalJetIdeal_coordinate_support B U b S hR hB lower width hwidth ha hδ + hprincipal hw hl (fun q => z ⟨q.1, ⟨q.2, hrows q.1.val.1 q.2⟩⟩) hz a₀ t.val + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedSpatialToCoarse.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedSpatialToCoarse.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b4722c0761d143302789d1f33ca1cca86abbf58 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedSpatialToCoarse.lean @@ -0,0 +1,406 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedOriginalExponentialCover + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "sides" => allocatedPrincipalSides B U b S +local notation "fullTuple" => PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) sides + +variable (X : Type*) [Fintype X] (modulus : ℕ) (q : X → ℕ) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "labels" => (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod refined) + +variable (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable [NeZero modulus] {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ ξ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable {O : Fin m → Type*} +variable (point : (X → (Unit ⊕ Fin dim) → ℤ) → EuclideanJetLayers U O) +variable (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) + +local notation "window" => spatialWindow (α := Fin dim) (trimmedSpatialRootScale τ N q) 4 + +variable (hN : ∀ t, 0 < N t) (hq : ∀ t, 0 < q t) (hτ : 0 < τ) +variable {C₀ ρ δ : ℝ} (hρ : 0 < ρ) +variable (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) +variable (hC₀ : 1 ≤ C₀) (hLC : (S.value : ℝ) ≤ C₀) (hWC : W ≤ C₀) +variable (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) +variable (hsize : ∀ t, 8 * (1 + W) * (q t : ℝ) * ρ ≤ (ξ * τ) * (N t : ℝ)) +variable (hmesh : anisotropicSpatialMeshThreshold selection (PrincipalTupleIndex B (layerSamplerDegree I n)) C₀ ≤ ρ) +variable (hρ8 : 8 * (probabilityProfileLipschitz : ℝ) ≤ ρ) +variable (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection)) +variable (hδ : 0 ≤ δ) +variable (hρshift : 2 * (Fintype.card (Option (LayerSamplerVariables G I n B)) * + (2 * allocatedPhysicalEntryBudget B U b S (fun _ => 0))) ≤ ρ) +variable (hρmove : Fintype.card (PrincipalTupleIndex B (layerSamplerDegree I n)) * + (2 * allocatedPhysicalEntryBudget B U b S (fun _ => 0)) ≤ δ * ρ) +variable (hmeshpos : 0 < mesh) +variable (hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) +variable (htest : ∀ v, ‖test v‖ ≤ 1) + +local notation "spatialError" => allocatedTupleSpatialError (Fintype.card X) selection + (PrincipalTupleIndex B (layerSamplerDegree I n)) M modulus C₀ ρ ξ W δ mesh +local notation "boundaryError" => (24 * (probabilityProfileLipschitz : ℝ) * + Fintype.card (Option (LayerSamplerVariables G I n B) × X) / ρ) + +include hN hq hτ hρ hbudget hC₀ hLC hWC hξ hξ1 hsize hmesh hρ8 hperiod hδ hρshift hρmove hmeshpos htest in +omit [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] in +theorem allocatedNarrowTrimmed_recentered_profile_error + (profile : fullTuple → EuclideanJetLayers U O → ℂ) (y : fullTuple) + (hwhole : principalResidueLabel refined (wholeReference (principalResidueLabel refined y)) = + principalResidueLabel refined y) + {Cg Z : ℝ} (hCg : 0 ≤ Cg) (hcap : ∀ v, ‖profile y (point v)‖ ≤ Cg) (hZ : 0 < Z) : + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let hV := narrowTrimmedSpatialWidths_pos hW hτ hξ N hN + let root := allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y + let dirs := allocatedPhysicalCubeDirections B U b S x y + ‖(∑' z, ((selectedResidueSmoothPMF q cells V hV hmass z).toReal : ℂ) * + (test (physicalCubeRootDifferences root dirs base z) * + profile y (point (physicalCubeRootDifferences root dirs base z)))) / (Z : ℂ) - + allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile y / (Z : ℂ)‖ ≤ + Cg * boundaryError / Z + spatialError * allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile y / Z := by + intro V hV root dirs + have hκ : 0 < 1 / (M : ℝ) := one_div_pos.mpr (Nat.cast_pos.mpr hM) + have hE : 0 ≤ spatialError := by + have he := anisotropicSpatialError_nonneg selection (PrincipalTupleIndex B (layerSamplerDegree I n)) M + hκ.le (zero_le_one.trans hC₀) hρ.le hξ.le + have hl := anisotropicSpatialDensityLip_nonneg selection hκ.le + have hc := anisotropicSpatialDensityCap_nonneg selection hκ.le + unfold allocatedTupleSpatialError + dsimp only + positivity + have hA : 0 < ∏ t, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q t) (trimmedSpatialSlopeScale W τ N q t) S.value i := by + apply Finset.prod_pos + intro t _ + apply Finset.prod_pos + intro i _ + have hp := trimmedSpatial_scales_pos hW hτ N q t (hN t) (hq t) + exact physicalSpatialOutputScale_pos (Fin dim) hp.1 hp.2 (Nat.cast_pos.mpr S.positive) i + have he := allocatedNarrowTrimmed_whole_reference_mass_test B U b S (fun _ => 0) x y + (wholeReference (principalResidueLabel refined y)) selection N q hN hq hW hτ hκ hρ hx + hbudget hC₀ hLC hWC hξ hξ1 hsize hmesh hρ8 modulus hperiod refined + (stride_mul_dvd_residueRefinedPeriod modulus q) hwhole.symm hδ hρshift hρmove hmeshpos base cells hmass + (fun v => test v * profile y (point v)) hCg + (fun v => by rw [norm_mul]; exact (mul_le_mul_of_nonneg_right (htest v) (norm_nonneg _)).trans (by simpa using hcap v)) hZ + dsimp only at he + have hcoarse := principalResidueLabel_eq_of_dvd _ _ + (show modulus ∣ residueRefinedPeriod modulus q from ⟨∏ t, q t, rfl⟩) hwhole + let A := ∏ t, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q t) (trimmedSpatialSlopeScale W τ N q t) S.value i + let reconstruct := allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base + (principalResidueLabel refined y) + have hcompare : ‖(∑' z, ((selectedResidueSmoothPMF q cells V hV hmass z).toReal : ℂ) * + (test (physicalCubeRootDifferences root dirs base z) * + profile y (point (physicalCubeRootDifferences root dirs base z)))) / (Z : ℂ) - + allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile y / (Z : ℂ)‖ ≤ + Cg * boundaryError / Z + + (∑ a : cells, selectedResidueCellWeight q cells V a * ((spatialError / A) * + ∑ v ∈ window, ‖test (reconstruct a.val v) * profile y (point (reconstruct a.val v))‖)) / Z := by + simpa only [allocatedRecenteredProfileTerm, allocatedWholeResidueReconstruction, + allocatedResidueSpatialKernel, principalSpatialColumns_residue, hcoarse, + allocatedTupleSpatialError, mul_assoc, A, reconstruct] using he + refine hcompare.trans (add_le_add le_rfl ?_) + apply div_le_div_of_nonneg_right _ hZ.le + unfold allocatedRecenteredProfileMass + dsimp only + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro a _ + rw [mul_left_comm spatialError] + apply mul_le_mul_of_nonneg_left _ (selectedResidueCellWeight_nonneg _ _ _ _) + change spatialError / _ * _ ≤ spatialError * (_ / _) + rw [← mul_div_assoc, div_mul_eq_mul_div] + apply div_le_div_of_nonneg_right _ hA.le + apply mul_le_mul_of_nonneg_left _ hE + apply Finset.sum_le_sum + intro v _ + rw [norm_mul] + exact (mul_le_mul_of_nonneg_right (htest _) (norm_nonneg _)).trans_eq (one_mul _) + +include hN hq hτ hρ hbudget hC₀ hLC hWC hξ hξ1 hsize hmesh hρ8 hperiod hδ hρshift hρmove hmeshpos htest in +theorem allocatedNarrowTrimmed_recentered_profile_error_law + (law : FiniteProbabilityWeights fullTuple) + (hwhole : ∀ y, law.weight y ≠ 0 → + principalResidueLabel refined (wholeReference (principalResidueLabel refined y)) = principalResidueLabel refined y) + (profile : fullTuple → EuclideanJetLayers U O → ℂ) + {Cg Z : ℝ} (hCg : 0 ≤ Cg) + (hcap : ∀ y, law.weight y ≠ 0 → ∀ v, ‖profile y (point v)‖ ≤ Cg) (hZ : 0 < Z) : + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let hV := narrowTrimmedSpatialWidths_pos hW hτ hξ N hN + let projected := fun y => ∑' z, ((selectedResidueSmoothPMF q cells V hV hmass z).toReal : ℂ) * + (test (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) base z) * + profile y (point (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) base z))) + ‖law.complexMean projected / (Z : ℂ) - + law.complexMean (allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile) / (Z : ℂ)‖ ≤ + Cg * boundaryError / Z + spatialError * law.mean (allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile) / Z := by + intro V hV projected + let recentered := allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile + let mass := allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile + have he := law.norm_complexMean_sub_le (fun y => projected y / (Z : ℂ)) + (fun y => recentered y / (Z : ℂ)) (fun y => Cg * boundaryError / Z + spatialError * mass y / Z) + (fun y hy => allocatedNarrowTrimmed_recentered_profile_error B U b S X modulus q wholeReference + x hM selection hx N hW mesh base cells point test hN hq hτ hρ hbudget hC₀ hLC hWC hξ hξ1 + hsize hmesh hρ8 hperiod hδ hρshift hρmove hmeshpos hmass htest profile y (hwhole y hy) hCg (hcap y hy) hZ) + rw [FiniteProbabilityWeights.complexMean_div_const, FiniteProbabilityWeights.complexMean_div_const, + FiniteProbabilityWeights.mean_add, FiniteProbabilityWeights.mean_const] at he + have hm : law.mean (fun y => spatialError * mass y / Z) = spatialError * law.mean mass / Z := by + simp only [FiniteProbabilityWeights.mean, mul_div_assoc, Finset.sum_div] + rw [Finset.mul_sum] + congr 1 + funext y + ring + rw [hm] at he + exact he + +include hN hq hτ hξ hW hmass in +omit [DecidableEq G] [NeZero modulus] in +theorem allocatedRecenteredProfileMass_le_of_window_law + (law : FiniteProbabilityWeights fullTuple) + (profile : fullTuple → EuclideanJetLayers U O → ℂ) + (hwindow : ∀ y, law.weight y ≠ 0 → ∀ a : cells, + (∑ v ∈ window, ‖profile y (point (allocatedWholeResidueReconstruction B U b S X modulus q + wholeReference x base (principalResidueLabel refined y) a.val v))‖) ≤ + (4 * (30 / smoothProbabilityProfile 0) ^ Fintype.card (Option (Fin dim) × X)) * + (∏ t, ∏ _i : Unit ⊕ Fin dim, trimmedSpatialRootScale τ N q t)) : + law.mean (allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile) ≤ + coarseReferenceMassConstant dim X W S.value := by + rw [← law.mean_const (coarseReferenceMassConstant dim X W S.value)] + apply law.mean_mono_on_support + intro y hy + let y₀ := wholeReference (principalResidueLabel refined y) + have hA : 0 < ∏ t, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q t) (trimmedSpatialSlopeScale W τ N q t) S.value i := by + apply Finset.prod_pos + intro t _ + apply Finset.prod_pos + intro i _ + have hp := trimmedSpatial_scales_pos hW hτ N q t (hN t) (hq t) + exact physicalSpatialOutputScale_pos (Fin dim) hp.1 hp.2 (Nat.cast_pos.mpr S.positive) i + have he := coarse_reference_density_spatial_error q cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) + (narrowTrimmedSpatialWidths_pos hW hτ hξ N hN) hmass + (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y₀) + (allocatedPhysicalCubeDirections B U b S x y₀) base + (trimmedSpatialRootScale τ N q) (trimmedSpatialSlopeScale W τ N q) + (Nat.cast_pos.mpr S.positive).ne' (trimmedSpatial_scale_ratio hW N q) hA + point (fun z => ‖profile y z‖) (fun _ => norm_nonneg _) (fun _ => (1 : ℂ)) + (fun _ => by simp) (E := 1) (by norm_num) (hwindow y hy) + simpa only [allocatedRecenteredProfileMass, allocatedWholeResidueReconstruction, + norm_one, one_mul, one_div_mul_eq_div, y₀] using he + +include hN hq hτ hρ hbudget hC₀ hLC hWC hξ hξ1 hsize hmesh hρ8 hperiod hδ hρshift hρmove hmeshpos htest in +theorem allocatedNarrowTrimmed_recentered_source_law + (law : FiniteProbabilityWeights fullTuple) + (hwhole : ∀ y, law.weight y ≠ 0 → + principalResidueLabel refined (wholeReference (principalResidueLabel refined y)) = principalResidueLabel refined y) + (profile : fullTuple → EuclideanJetLayers U O → ℂ) + {Cg Z : ℝ} (hCg : 0 ≤ Cg) + (hcap : ∀ y, law.weight y ≠ 0 → ∀ v, ‖profile y (point v)‖ ≤ Cg) (hZ : 1 / 2 ≤ Z) {target κ : ℝ} + (hmassBound : law.mean (allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile) ≤ + coarseReferenceMassConstant dim X W S.value) + (hboundary : Cg * boundaryError ≤ normalizedSpatialShare target / 2) + (hsite : spatialError * coarseReferenceMassConstant dim X W S.value ≤ normalizedSpatialShare target / 2) : + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let hV := narrowTrimmedSpatialWidths_pos hW hτ hξ N hN + let projected := fun y => ∑' z, ((selectedResidueSmoothPMF q cells V hV hmass z).toReal : ℂ) * + (test (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) base z) * + profile y (point (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) base z))) + κ ≤ (law.complexMean projected / (Z : ℂ)).re → + Z * (κ - Real.exp (-target)) ≤ + (law.complexMean (allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile)).re := by + intro V hV projected hsource + have hZpos : 0 < Z := by linarith + have hκ : 0 < 1 / (M : ℝ) := one_div_pos.mpr (Nat.cast_pos.mpr hM) + have hE : 0 ≤ spatialError := by + have he := anisotropicSpatialError_nonneg selection (PrincipalTupleIndex B (layerSamplerDegree I n)) M + hκ.le (zero_le_one.trans hC₀) hρ.le hξ.le + have hl := anisotropicSpatialDensityLip_nonneg selection hκ.le + have hc := anisotropicSpatialDensityCap_nonneg selection hκ.le + unfold allocatedTupleSpatialError + dsimp only + positivity + have he := allocatedNarrowTrimmed_recentered_profile_error_law B U b S X modulus q wholeReference + x hM selection hx N hW mesh base cells point test hN hq hτ hρ hbudget hC₀ hLC hWC hξ hξ1 + hsize hmesh hρ8 hperiod hδ hρshift hρmove hmeshpos hmass htest law hwhole profile hCg hcap hZpos + have hb : Cg * boundaryError / Z ≤ normalizedSpatialShare target := by + apply (div_le_iff₀ hZpos).mpr + have hp : 0 < normalizedSpatialShare target := Real.exp_pos _ + nlinarith + have hs : spatialError * law.mean (allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile) / Z ≤ normalizedSpatialShare target := by + apply (div_le_iff₀ hZpos).mpr + have hp : 0 < normalizedSpatialShare target := Real.exp_pos _ + have hh := (mul_le_mul_of_nonneg_left hmassBound hE).trans hsite + nlinarith + have hsmall : 2 * normalizedSpatialShare target ≤ Real.exp (-target) := by + calc + _ ≤ Real.exp 2 * Real.exp (-(target + 2)) := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (2 : ℝ)]) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hnorm := he.trans (show _ ≤ Real.exp (-target) by linarith only [hb, hs, hsmall]) + have hre := (Complex.re_le_norm _).trans hnorm + rw [Complex.sub_re] at hre + have hout : κ - Real.exp (-target) ≤ + (law.complexMean (allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile) / (Z : ℂ)).re := by + linarith only [hsource, hre] + rw [Complex.div_ofReal_re] at hout + exact (mul_comm Z _).le.trans ((le_div_iff₀ hZpos).mp hout) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "sides" => allocatedPrincipalSides B U b S +local notation "fullTuple" => PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) sides + +variable (X : Type*) [Fintype X] (modulus : ℕ) (q : X → ℕ) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "labels" => (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod refined) + +variable (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable [NeZero modulus] {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ ξ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable {O : Fin m → Type*} +variable (point : (X → (Unit ⊕ Fin dim) → ℤ) → EuclideanJetLayers U O) +variable (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) + +local notation "window" => spatialWindow (α := Fin dim) (trimmedSpatialRootScale τ N q) 4 + +variable (hN : ∀ t, 0 < N t) (hq : ∀ t, 0 < q t) (hτ : 0 < τ) +variable {C₀ ρ δ : ℝ} (hρ : 0 < ρ) +variable (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) +variable (hC₀ : 1 ≤ C₀) (hLC : (S.value : ℝ) ≤ C₀) (hWC : W ≤ C₀) +variable (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) +variable (hsize : ∀ t, 8 * (1 + W) * (q t : ℝ) * ρ ≤ (ξ * τ) * (N t : ℝ)) +variable (hmesh : anisotropicSpatialMeshThreshold selection (PrincipalTupleIndex B (layerSamplerDegree I n)) C₀ ≤ ρ) +variable (hρ8 : 8 * (probabilityProfileLipschitz : ℝ) ≤ ρ) +variable (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection)) +variable (hδ : 0 ≤ δ) +variable (hρshift : 2 * (Fintype.card (Option (LayerSamplerVariables G I n B)) * + (2 * allocatedPhysicalEntryBudget B U b S (fun _ => 0))) ≤ ρ) +variable (hρmove : Fintype.card (PrincipalTupleIndex B (layerSamplerDegree I n)) * + (2 * allocatedPhysicalEntryBudget B U b S (fun _ => 0)) ≤ δ * ρ) +variable (hmeshpos : 0 < mesh) +variable (hmass : 0 < ∑' z, selectedResidueSmoothWeight q cells + (narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) z) +variable (htest : ∀ v, ‖test v‖ ≤ 1) + +local notation "spatialError" => allocatedTupleSpatialError (Fintype.card X) selection + (PrincipalTupleIndex B (layerSamplerDegree I n)) M modulus C₀ ρ ξ W δ mesh +local notation "boundaryError" => (24 * (probabilityProfileLipschitz : ℝ) * + Fintype.card (Option (LayerSamplerVariables G I n B) × X) / ρ) + +include hN hq hτ hρ hbudget hC₀ hLC hWC hξ hξ1 hsize hmesh hρ8 hperiod hδ hρshift hρmove hmeshpos htest in +theorem allocatedNarrowTrimmed_early_coarse_source_law + (law : FiniteProbabilityWeights fullTuple) + (hwhole : ∀ y, law.weight y ≠ 0 → + principalResidueLabel refined (wholeReference (principalResidueLabel refined y)) = principalResidueLabel refined y) + (profile : fullTuple → EuclideanJetLayers U O → ℂ) + {Cg Z : ℝ} (hCg : 0 ≤ Cg) + (hcap : ∀ y, law.weight y ≠ 0 → ∀ v, ‖profile y (point v)‖ ≤ Cg) (hZ : 1 / 2 ≤ Z) {target κ : ℝ} + (hmassBound : law.mean (allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile) ≤ + coarseReferenceMassConstant dim X W S.value) + (hboundary : Cg * boundaryError ≤ normalizedSpatialShare target / 2) + (hsite : spatialError * coarseReferenceMassConstant dim X W S.value ≤ normalizedSpatialShare target / 2) + {p E : ℝ} (hp : 0 ≤ p) (hE : 0 ≤ E) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hdim : ((dim + 1 : ℕ) : ℝ) ≤ p) + (hMP : (M : ℝ) ≤ Real.exp p) (hmodulus : modulus ≤ M ^ (m + 1)) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp p) + (hWscale : W ≤ Fintype.card (LayerSamplerVariables G I n B) * (S.value : ℝ)) + (hmeshCoarse : mesh ≤ allocatedEarlyRecenteredMesh X selection M modulus p E) : + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let hV := narrowTrimmedSpatialWidths_pos hW hτ hξ N hN + let projected := fun y => ∑' z, ((selectedResidueSmoothPMF q cells V hV hmass z).toReal : ℂ) * + (test (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) base z) * + profile y (point (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S (fun _ => 0) x y) + (allocatedPhysicalCubeDirections B U b S x y) base z))) + κ ≤ (law.complexMean projected / (Z : ℂ)).re → + Z * (κ - Real.exp (-target)) - Real.exp (-E) ≤ + (law.complexMean (allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW + (allocatedEarlyRecenteredMesh X selection M modulus p E) base cells point test profile)).re := by + intro V hV projected hsource + have hfine := allocatedNarrowTrimmed_recentered_source_law B U b S X modulus q wholeReference + x hM selection hx N hW mesh base cells point test hN hq hτ hρ hbudget hC₀ hLC hWC hξ hξ1 + hsize hmesh hρ8 hperiod hδ hρshift hρmove hmeshpos hmass htest law hwhole profile hCg hcap + hZ hmassBound hboundary hsite hsource + obtain ⟨_, _, _, _, htransfer⟩ := allocatedRecentered_early_coarse_source_law (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW base cells point hq hN hτ law profile + hp hE hG hX hdim hMP hmodulus hvars hbudget hWscale hperiod hmassBound + exact htransfer mesh hmeshpos hmeshCoarse test htest (Z * (κ - Real.exp (-target))) hfine + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedSupportedSite.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedSupportedSite.lean new file mode 100644 index 0000000000000000000000000000000000000000..006a9a986e93f1182a77f5ab9069928aef3a0f9f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSlicedSupportedSite.lean @@ -0,0 +1,86 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedBooleanSite +import OAI.Combinatorics.Progressions.Estimates.PreparedScalarStructuralBasePower + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped Classical BigOperators NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (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)] (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 "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Coeff" => ActiveProfileCoefficientIndex G B degree grid +local notation "Row" => OneCubeActiveRow grid +local notation "axis" => (fun e : Row => Subtype.val (Prod.snd e)) + +theorem exists_allocatedSlicedIdeal_supported_site_expansion + [∀ j, DecidableEq (I j)] + (O : ℕ) (hO : Fintype.card Row ≤ O) + (hB : ∀ a : {a // ¬grid a}, 4 ≤ Fintype.card (B a.val)) + (lower width : ∀ a : {a // ¬grid a}, B a.val × Fin (degree a.val) → ℝ) + {a δ P ε : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hP : 0 ≤ P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (radius : ℝ≥0) (hradius : 0 < radius) (hε : 0 < ε) + (hHP : 2 * (radius : ℝ) ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) : + let Q := slicedJointDensityLogBudget O m P + P + let C : ℝ≥0 := Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * radius) + ∃ χ : (LayerSamplerAxis I n → ℝ) → ℝ, + (∀ v, (∀ d, |v d| ≤ (radius : ℝ)) → χ v = 1) ∧ + ∃ z : ℕ, (z : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + ∃ (c : (Finset (Fin 1) × LayerSamplerAxis I n → Fin z) → ℂ) + (f : (Finset (Fin 1) × LayerSamplerAxis I n → Fin z) → Finset (Fin 1) → (LayerSamplerAxis I n → ℝ) → ℂ), + (∑ k, ‖c k‖) ≤ Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8) + Q) ∧ + (∀ k s x, ‖f k s x‖ ≤ 1) ∧ + (∀ k s, LipschitzWith (NNReal.mk (Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12)) (Real.exp_nonneg _) + C) (f k s)) ∧ + (∀ k s v, (∃ d, 2 * (radius : ℝ) < |v d|) → f k s v = 0) ∧ + ∀ x : Finset (Fin 1) → LayerSamplerAxis I n → ℝ, + ‖(∏ s, (χ (x s) : ℂ)) * (allocatedSlicedAveragedIdealDensity B U basis S hB lower width + (oneCubeSiteRestriction grid x) : ℂ) - ∑ k, c k * ∏ s, f k s (x s)‖ ≤ ε := by + intro Q C + obtain ⟨χ, _, _, hχ, hone, hsupport, hLip⟩ := + exists_normalized_site_cutoff (D := LayerSamplerAxis I n) radius hradius + have hχC : LipschitzWith C (fun v => (χ v : ℂ)) := by + simpa only [one_mul, Function.comp_def] using Complex.isometry_ofReal.lipschitzWith.comp hLip + have hχ1 (s : Finset (Fin 1)) (v) : ‖(χ v : ℂ)‖ ≤ 1 := by + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hχ v).1] using (hχ v).2 + obtain ⟨z, hz, c, f, hc, hf, hLf, herr⟩ := + exists_allocatedSlicedIdeal_boolean_site_expansion B U basis S O hO hB lower width + ha hδ hP haP hδP hprincipal hw hl (mul_pos (by norm_num) hradius) hε hHP hεP + let g := bufferedSiteFactor (fun (_ : Finset (Fin 1)) (v : LayerSamplerAxis I n → ℝ) => v) + (fun _ v => (χ v : ℂ)) f + refine ⟨χ, hone, z, hz, c, g, hc, ?_, ?_, ?_, ?_⟩ + · exact bufferedSiteFactor_bound _ _ f hχ1 hf + · intro k s + have he := bufferedSiteFactor_lipschitz _ _ f + (K := NNReal.mk (Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12)) (Real.exp_nonneg _)) + (L := 1) (C := C) (fun _ => LipschitzWith.id) (fun _ => hχC) hLf hχ1 hf k s + rw [mul_one] at he + convert he using 1 + rfl + · intro k s v hv + have hzero : χ v = 0 := by + by_contra hn + obtain ⟨d, hd⟩ := hv + exact (not_lt_of_ge (hsupport v hn d)) hd + simp only [g, bufferedSiteFactor, hzero, Complex.ofReal_zero, zero_mul] + · intro x + apply bufferedSiteExpansion_error _ _ _ c f hε.le hχ1 + (fun _ v hv d => hsupport v (by exact_mod_cast hv) d) herr x + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialIdealCoverExpansion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialIdealCoverExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..6bad1d8c97a72139a604ef6a23b32e2891e5e76f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialIdealCoverExpansion.lean @@ -0,0 +1,104 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedAmbientBoxTests +import OAI.Combinatorics.Progressions.Lattices.AllocatedPointwiseResidueCover + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical NNReal + +attribute [local instance] ScalarSiteExpansion.termFinite +attribute [local instance 2000] activeAmbientAxisDecidableEq fullBooleanRowSetFintype + +variable {m dim : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, 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 b R σ) +variable (X : Type*) [Fintype X] (modulus : ℕ) [NeZero modulus] (q : X → ℕ) +variable [NeZero (residueRefinedPeriod modulus q)] +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (coverWitness : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + AllocatedResidueSiteWitness (dim := dim) B U b S (residueRefinedPeriod modulus q) r.val) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Kcov : Fin m → Type*} [∀ j, Fintype (Kcov j)] +variable (bW : ∀ j, Basis (Kcov j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] +variable (g : (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) → + (∀ a, ((coverWitness r).expansion a).Term) → Finset (Fin dim) → (((Σ j, J j) → UnitAddCircle) → ℂ)) +variable (δ : ℝ≥0) (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (hm : ∀ j e, coefficients (p j) e ∈ U j) +variable (r : AllocatedPositiveResidue (dim := dim) B U b S (residueRefinedPeriod modulus q)) (a : cells) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "terms" => (X → SpatialSiteLabel (Fin dim) modulus 4 mesh) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin dim))) +local notation "point" => allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base r.val a.val +local notation "volume" => ∏ z, ∏ i, physicalSpatialOutputScale (Fin dim) + (trimmedSpatialRootScale τ N q z) (trimmedSpatialSlopeScale W τ N q z) S.value i +local notation "coeff" => allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh +local notation "twist" => allocatedRecenteredSpatialTwist (τ := τ) B U b S X modulus q wholeReference x N mesh base + +omit [NeZero (residueRefinedPeriod modulus q)] in +theorem allocatedRecenteredIdealCover_expansion + (hq : ∀ z, 0 < q z) (hmesh : 0 < mesh) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) (htest : ∀ s u, ‖test s u‖ ≤ 1) + (hg : ∀ k s u, ‖g r k s u‖ ≤ 1) : + let factor := fun (t : terms) (k : ∀ j, ((coverWitness r).expansion j).Term) + (s : Finset (Fin dim)) (u : X → ℤ) => + test s (fun z => (u z : ℝ)) * twist r.val a.val t s u * + g r k s (fun j => (((eval (fun z => (u z : ℝ)) (p j.1) j.2) / + commonSitePeriod (coverWitness r).expansion k : ℝ) : UnitAddCircle)) + (∀ t k s u, ‖factor t k s u‖ ≤ 1) ∧ + ∀ v : X → (Unit ⊕ Fin dim) → ℤ, + allocatedRecenteredResidueWeight (τ := τ) B U b S X modulus q wholeReference x hM selection hx + N hW mesh base cells (physicalCubeSiteTest test) r.val a v * + allocatedSupportedIdealCoverValue B U b hR hσ S refined coverWitness hb o bW d g δ x p hm + (point v) r.val = + ∑ t : terms, ∑ k : ∀ j, ((coverWitness r).expansion j).Term, + ((coeff (principalResidueLabel modulus (wholeReference r.val)) t / ((volume : ℝ) : ℂ)) * + coverSiteCoefficient (coverWitness r).expansion k) * + (allocatedGlobalWindowPrefactor B U b hR hσ S rowSets d x refined + (coverWitness r).representative (coverWitness r).positive hb o bW + (allocatedPhysicalLongIdeal B U b hR S rowSets δ) + (physicalCubeRowSample U d rows p hm (point v)) * + ∏ s, factor t k s (physicalCubeVertexValue (point v) s)) := by + dsimp only + constructor + · intro t k s u + rw [norm_mul, norm_mul] + have ht := allocatedRecenteredSpatialTwist_bound (τ := τ) B U b S X modulus q wholeReference x N mesh base + hmesh r.val a.val t s u + exact (mul_le_mul (mul_le_mul (htest s _) ht (norm_nonneg _) zero_le_one) + (hg k s _) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1 * 1)).trans_eq (by norm_num) + · intro v + rw [allocatedRecenteredResidueWeight_expansion B U b S X modulus q wholeReference x N mesh base + hM selection hx hW cells hq] + simp only [allocatedSupportedIdealCoverValue, dite_eq_left r.property] + simp_rw [Finset.sum_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + apply Finset.sum_congr rfl + intro k _ + simp only [Finset.prod_mul_distrib] + ring + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialProxyCap.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialProxyCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..504cf2cd2009d7c8324a3fb651fde900c58b4848 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialProxyCap.lean @@ -0,0 +1,523 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedReferenceWindowTest +import OAI.Combinatorics.Progressions.Probability.AllocatedNarrowSpatialLaw + +namespace OAI + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped BigOperators Classical + +variable {Ω R : Type*} [Fintype Ω] [DecidableEq Ω] [DecidableEq R] +variable (p : FiniteProbabilityWeights Ω) (label : Ω → R) + +noncomputable def supportedFiberReference (r : R) : Ω := + if h : 0 < p.mass (Finset.univ.filter (fun x => label x = r)) then + (p.condition _ h).exists_weight_pos.choose + else p.exists_weight_pos.choose + +theorem supportedFiberReference_positive (r : R) + (hr : 0 < p.mass (Finset.univ.filter (fun x => label x = r))) : + label (p.supportedFiberReference label r) = r ∧ p.weight (p.supportedFiberReference label r) ≠ 0 := by + unfold supportedFiberReference + rw [dite_eq_left hr] + have h := condition_weight_support p _ hr (p.condition _ hr).exists_weight_pos.choose + (p.condition _ hr).exists_weight_pos.choose_spec.ne' + exact ⟨(Finset.mem_filter.mp h.1).2, h.2⟩ + +theorem supportedFiberReference_weight (r : R) : + p.weight (p.supportedFiberReference label r) ≠ 0 := by + by_cases hr : 0 < p.mass (Finset.univ.filter (fun x => label x = r)) + · exact (p.supportedFiberReference_positive label r hr).2 + · simpa only [supportedFiberReference, dite_eq_right hr] using p.exists_weight_pos.choose_spec.ne' + +theorem supportedFiberReference_label (x : Ω) (hx : p.weight x ≠ 0) : + label (p.supportedFiberReference label (label x)) = label x := by + have hp : 0 < p.weight x := lt_of_le_of_ne (p.nonneg x) (Ne.symm hx) + have hm : 0 < p.mass (Finset.univ.filter (fun y => label y = label x)) := + hp.trans_le (p.weight_le_mass _ (Finset.mem_filter.mpr ⟨Finset.mem_univ x, rfl⟩)) + exact (p.supportedFiberReference_positive label (label x) hm).1 + +end Erdos3.FiniteProbabilityWeights + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel + +noncomputable def narrowTrimmedSpatialWidths {G J X : Type*} + (W τ ξ : ℝ) (N : X → ℕ) : Option (G ⊕ J) × X → ℝ := + fun z => match z.1 with + | some (.inr _) => ξ * trimmedSpatialWidths W τ N z + | _ => trimmedSpatialWidths W τ N z + +theorem narrowTrimmedSpatialWidths_pos {G J X : Type*} + {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ : 0 < ξ) + (N : X → ℕ) (hN : ∀ x, 0 < N x) (z : Option (G ⊕ J) × X) : + 0 < narrowTrimmedSpatialWidths W τ ξ N z := by + rcases z with ⟨_ | (g | j), x⟩ + · exact trimmedSpatialWidths_pos hW hτ N hN _ + · exact trimmedSpatialWidths_pos hW hτ N hN _ + · exact mul_pos hξ (trimmedSpatialWidths_pos hW hτ N hN _) + +theorem narrowTrimmedSpatialWidths_le {G J X : Type*} + {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ1 : ξ ≤ 1) + (N : X → ℕ) (hN : ∀ x, 0 < N x) (z : Option (G ⊕ J) × X) : + narrowTrimmedSpatialWidths W τ ξ N z ≤ trimmedSpatialWidths W τ N z := by + rcases z with ⟨_ | (g | j), x⟩ + · exact le_rfl + · exact le_rfl + · exact mul_le_of_le_one_left (trimmedSpatialWidths_pos hW hτ N hN _).le hξ1 + +theorem narrowTrimmedSpatialWidths_lower {G J X : Type*} + {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ1 : ξ ≤ 1) + (N : X → ℕ) (hN : ∀ x, 0 < N x) (z : Option (G ⊕ J) × X) : + trimmedSpatialWidths W (ξ * τ) N z ≤ narrowTrimmedSpatialWidths W τ ξ N z := by + have he : trimmedSpatialWidths W (ξ * τ) N z = ξ * trimmedSpatialWidths W τ N z := by + unfold trimmedSpatialWidths + ring + rw [he] + rcases z with ⟨_ | (g | j), x⟩ + · exact mul_le_of_le_one_left (trimmedSpatialWidths_pos hW hτ N hN _).le hξ1 + · exact mul_le_of_le_one_left (trimmedSpatialWidths_pos hW hτ N hN _).le hξ1 + · exact le_rfl + +theorem narrowTrimmedSpatial_residue_scale {G J X : Type*} + (W τ ξ : ℝ) (N q : X → ℕ) (x : X) : + (fun k => residueProfileWidth q (narrowTrimmedSpatialWidths (G := G) (J := J) W τ ξ N) (k,x)) = + splitPhysicalSpatialInputScale G J (trimmedSpatialRootScale τ N q x) + (trimmedSpatialSlopeScale W τ N q x) (fun _ => ξ * trimmedSpatialSlopeScale W τ N q x) := by + funext k + rcases k with _ | (g | j) <;> + simp only [residueProfileWidth, narrowTrimmedSpatialWidths, trimmedSpatialWidths, + centeredSpatialWidths, splitPhysicalSpatialInputScale, trimmedSpatialRootScale, + trimmedSpatialSlopeScale, one_mul] <;> ring + +theorem narrowTrimmedSpatial_scale_lower {X : Type*} + {W τ ξ ρ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ1 : ξ ≤ 1) (hρ : 0 ≤ ρ) + (N q : X → ℕ) (x : X) (hN : 0 < N x) (hq : 0 < q x) + (hsize : 8 * (1 + W) * (q x : ℝ) * ρ ≤ (ξ * τ) * (N x : ℝ)) : + ρ ≤ trimmedSpatialRootScale τ N q x ∧ + ρ ≤ trimmedSpatialSlopeScale W τ N q x ∧ + ρ ≤ ξ * trimmedSpatialSlopeScale W τ N q x := by + have h := trimmedSpatial_scale_lower hW hρ N q x hq hsize + have hH : trimmedSpatialRootScale (ξ * τ) N q x = ξ * trimmedSpatialRootScale τ N q x := by + unfold trimmedSpatialRootScale + ring + have hT : trimmedSpatialSlopeScale W (ξ * τ) N q x = ξ * trimmedSpatialSlopeScale W τ N q x := by + unfold trimmedSpatialSlopeScale + ring + rw [hH, hT] at h + have hp := trimmedSpatial_scales_pos hW hτ N q x hN hq + exact ⟨h.1.trans (mul_le_of_le_one_left hp.1.le hξ1), + h.2.trans (mul_le_of_le_one_left hp.2.le hξ1), h.2⟩ + +theorem narrowTrimmedSpatial_residue_width_lower {G J X : Type*} + {W τ ξ ρ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ1 : ξ ≤ 1) (hρ : 0 ≤ ρ) + (N q : X → ℕ) (hN : ∀ x, 0 < N x) (hq : ∀ x, 0 < q x) + (hsize : ∀ x, 8 * (1 + W) * (q x : ℝ) * ρ ≤ (ξ * τ) * (N x : ℝ)) + (z : Option (G ⊕ J) × X) : + ρ ≤ residueProfileWidth q (narrowTrimmedSpatialWidths W τ ξ N) z := by + apply (trimmedSpatial_residue_width_lower hW hρ N q hq hsize z).trans + exact div_le_div_of_nonneg_right (narrowTrimmedSpatialWidths_lower hW hτ hξ1 N hN z) + (Nat.cast_nonneg _) + +namespace BooleanCubeKernel + +theorem centeredPhysicalCubeWindow_mono {K X α : Type*} + [Fintype K] [Fintype X] [Fintype α] + (root : K → ℤ) (D : Matrix α K ℤ) {V W : Option K × X → ℝ} + (hVW : ∀ z, V z ≤ W z) : + centeredPhysicalCubeWindow root D V ⊆ centeredPhysicalCubeWindow root D W := by + classical + exact Finset.image_subset_image (rectangularWeightIndices_zero_mono hVW) + +theorem narrowTrimmedSpatial_window_subset {G J X α : Type*} + [Fintype G] [Fintype J] [Fintype X] [Fintype α] + (root : G ⊕ J → ℤ) (D : Matrix α (G ⊕ J) ℤ) + {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ1 : ξ ≤ 1) + (N q : X → ℕ) (hN : ∀ x, 0 < N x) : + centeredPhysicalCubeWindow root D (residueProfileWidth q (narrowTrimmedSpatialWidths W τ ξ N)) ⊆ + centeredPhysicalCubeWindow root D (residueProfileWidth q (trimmedSpatialWidths W τ N)) := by + apply centeredPhysicalCubeWindow_mono + intro z + exact div_le_div_of_nonneg_right (narrowTrimmedSpatialWidths_le hW hτ hξ1 N hN z) + (Nat.cast_nonneg _) + +end BooleanCubeKernel +end Erdos3 + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators Classical + +variable {G J X : Type*} [Fintype G] [Fintype J] [Fintype X] [DecidableEq X] +variable {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ1 : ξ ≤ 1) +variable (N : X → ℕ) (hN : ∀ x, 0 < N x) +variable (hτ1 : τ ≤ 1 / 2) (hsize : ∀ x, 4 ≤ τ * (N x : ℝ)) + +include hW hτ hξ1 hN hτ1 hsize in +theorem jointIntegerPhysicalSite_narrow_mem_box + (root : G ⊕ J → ℤ) (hroot : (∑ k, |(root k : ℝ)|) ≤ W) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 (narrowTrimmedSpatialWidths (G := G) (J := J) W τ ξ N) 1) : + jointIntegerPhysicalSite root (z.1.val, z.2.val) ∈ integerBox N := by + have hz : z.2.val ∈ rectangularWeightIndices 0 (trimmedSpatialWidths W τ N) 1 := + rectangularWeightIndices_zero_mono (narrowTrimmedSpatialWidths_le hW hτ hξ1 N hN) z.2.property + exact jointIntegerPhysicalSite_mem_box root N (spatialTrimMargin τ N) + (fun x => (spatialTrimMargin_proper hτ1 N hN hsize x).le) + (trimmedSpatialWidths W τ N) (spatialTrimMargin_fits hW hτ.le root hroot N) + (z.1, ⟨z.2.val, hz⟩) + +include hW hτ hξ1 hN hτ1 hsize in +theorem integerBoxTestExtension_joint_narrow + (root : G ⊕ J → ℤ) (hroot : (∑ k, |(root k : ℝ)|) ≤ W) + (test : (X → ℝ) → ℂ) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 (narrowTrimmedSpatialWidths (G := G) (J := J) W τ ξ N) 1) : + integerBoxTestExtension N test (fun x => (jointIntegerPhysicalSite root (z.1.val, z.2.val) x : ℝ)) = + test (fun x => (jointIntegerPhysicalSite root (z.1.val, z.2.val) x : ℝ)) := by + exact integerBoxTestExtension_of_mem N test _ + (jointIntegerPhysicalSite_narrow_mem_box hW hτ hξ1 N hN hτ1 hsize root hroot z) + +variable {dim : ℕ} (root : G ⊕ J → ℤ) (dirs : Matrix (Fin dim) (G ⊕ J) ℤ) +variable (hsite : ∀ s : Finset (Fin dim), (∑ k, |(integerAffineCube root dirs s k : ℝ)|) ≤ W) + +include hW hτ hξ1 hN hτ1 hsize hsite in +theorem physicalCubeSiteTest_narrow_extension + (test : Finset (Fin dim) → (X → ℝ) → ℂ) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 (narrowTrimmedSpatialWidths (G := G) (J := J) W τ ξ N) 1) : + physicalCubeSiteTest (fun s => integerBoxTestExtension N (test s)) + (physicalCubeRootDifferences root dirs z.1.val z.2.val) = + physicalCubeSiteTest test (physicalCubeRootDifferences root dirs z.1.val z.2.val) := by + unfold physicalCubeSiteTest + apply Finset.prod_congr rfl + intro s _ + rw [physicalCubeVertexValue_rootDifferences] + exact integerBoxTestExtension_joint_narrow hW hτ hξ1 N hN hτ1 hsize + (integerAffineCube root dirs s) (hsite s) (test s) z + +include hW hτ hξ1 hN hτ1 hsize hsite in +theorem physicalCubeSiteTest_narrow_extension_mean + (law : FiniteProbabilityWeights (trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 (narrowTrimmedSpatialWidths (G := G) (J := J) W τ ξ N) 1)) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) : + law.complexMean (fun z => physicalCubeSiteTest (fun s => integerBoxTestExtension N (test s)) + (physicalCubeRootDifferences root dirs z.1.val z.2.val)) = + law.complexMean (fun z => physicalCubeSiteTest test + (physicalCubeRootDifferences root dirs z.1.val z.2.val)) := by + apply congrArg law.complexMean + funext z + exact physicalCubeSiteTest_narrow_extension hW hτ hξ1 N hN hτ1 hsize root dirs hsite test z + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical + +variable {m dim : ℕ} {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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (c : LayerSamplerVariables G I n B → ℤ) +variable (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (y : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) +variable (hx : ∀ g, (integerScalarCubeWeights (Fin dim) S.value S.positive).weight (x g) ≠ 0) +variable (hy : (principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).weight y ≠ 0) + +include hx hy in +theorem allocatedPhysicalCube_supported_site_sum (s : Finset (Fin dim)) : + (∑ k, |(integerAffineCube (allocatedPhysicalCubeRoot B U b S c x y) + (allocatedPhysicalCubeDirections B U b S x y) s k : ℝ)|) ≤ + allocatedPhysicalRootBudget B U b S c := by + have hscalar {L : ℕ} (hL : 0 < L) (v : IntegerScalarCubeBox (Fin dim) L) + (hv : (integerScalarCubeWeights (Fin dim) L hL).weight v ≠ 0) : + |(integerScalarCubeValue (fun i => (v i : ℤ)) s : ℝ)| ≤ L := by + have hmem := (condition_weight_support (integerScalarCubeReference (Fin dim) L hL) + (integerScalarCubeSet (Fin dim) L) (integerScalarCubeReference_mass_pos (Fin dim) L hL) v hv).1 + have hs := ((mem_integerScalarCubeSet L v).mp hmem) s + have hbound : |integerScalarCubeValue (fun i => (v i : ℤ)) s| ≤ (L : ℤ) := by + rw [abs_of_nonneg hs.1] + exact hs.2.le + exact_mod_cast hbound + have hyp (j : PrincipalTupleIndex B (layerSamplerDegree I n)) : + (integerScalarCubeWeights (Fin dim) (allocatedPrincipalSides B U b S j) + (allocatedPrincipalSides_pos B U b S j)).weight (y j) ≠ 0 := by + change (∏ j, (integerScalarCubeWeights (Fin dim) (allocatedPrincipalSides B U b S j) + (allocatedPrincipalSides_pos B U b S j)).weight (y j)) ≠ 0 at hy + exact Finset.prod_ne_zero_iff.mp hy j (Finset.mem_univ j) + rw [allocatedPhysicalCube_vertex] + have hvalue (k : LayerSamplerVariables G I n B) : + |((Sum.elim (fun g => integerScalarCubeValue (fun i => (x g i : ℤ)) s) + (fun j => integerScalarCubeValue (fun i => (y j i : ℤ)) s) k : ℤ) : ℝ)| ≤ S.value := by + cases k with + | inl g => exact hscalar S.positive (x g) (hx g) + | inr j => + exact (hscalar (allocatedPrincipalSides_pos B U b S j) (y j) (hyp j)).trans + (Nat.cast_le.mpr (allocatedPrincipalSides_le_scale B U b S j)) + calc + _ ≤ ∑ k, (|(c k : ℝ)| + (S.value : ℝ)) := by + apply Finset.sum_le_sum + intro k _ + push_cast + exact (abs_add_le _ _).trans (add_le_add le_rfl (hvalue k)) + _ = _ := by simp [allocatedPhysicalRootBudget, Finset.sum_add_distrib] + +variable {X : Type*} [Fintype X] [DecidableEq X] +variable {W τ ξ : ℝ} (hbudget : allocatedPhysicalRootBudget B U b S c ≤ W) +variable (hτ : 0 < τ) (hξ1 : ξ ≤ 1) (N : X → ℕ) (hN : ∀ a, 0 < N a) +variable (hτ1 : τ ≤ 1 / 2) (hsize : ∀ a, 4 ≤ τ * (N a : ℝ)) + +include hx hy hbudget hτ hξ1 hN hτ1 hsize in +theorem allocatedPhysicalCube_supported_testExtension + (test : Finset (Fin dim) → (X → ℝ) → ℂ) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 (narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) 1) : + physicalCubeSiteTest (fun s => integerBoxTestExtension N (test s)) + (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S c x y) + (allocatedPhysicalCubeDirections B U b S x y) z.1.val z.2.val) = + physicalCubeSiteTest test (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S c x y) + (allocatedPhysicalCubeDirections B U b S x y) z.1.val z.2.val) := by + exact physicalCubeSiteTest_narrow_extension + ((allocatedPhysicalRootBudget_nonneg B U b S c).trans hbudget) hτ hξ1 N hN hτ1 hsize + (allocatedPhysicalCubeRoot B U b S c x y) (allocatedPhysicalCubeDirections B U b S x y) + (fun s => (allocatedPhysicalCube_supported_site_sum B U b S c x y hx hy s).trans hbudget) test z + +include hx hy hbudget hτ hξ1 hN hτ1 hsize in +theorem allocatedPhysicalCube_supported_testExtension_mean + (law : FiniteProbabilityWeights (trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 (narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N) 1)) + (test : Finset (Fin dim) → (X → ℝ) → ℂ) : + law.complexMean (fun z => physicalCubeSiteTest (fun s => integerBoxTestExtension N (test s)) + (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S c x y) + (allocatedPhysicalCubeDirections B U b S x y) z.1.val z.2.val)) = + law.complexMean (fun z => physicalCubeSiteTest test + (physicalCubeRootDifferences (allocatedPhysicalCubeRoot B U b S c x y) + (allocatedPhysicalCubeDirections B U b S x y) z.1.val z.2.val)) := by + apply congrArg law.complexMean + funext z + exact allocatedPhysicalCube_supported_testExtension B U b S c x y hx hy hbudget hτ hξ1 N hN hτ1 hsize test z + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (c : LayerSamplerVariables G I n B → ℤ) (x : G → IntegerScalarCubeBox α S.value) +variable (y y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U basis S)) + +local notation "vars" => LayerSamplerVariables G I n B +local notation "cols" => principalSpatialColumns (fun j => c (Sum.inr j)) id y +local notation "refcols" => principalSpatialColumns (fun j => c (Sum.inr j)) id y₀ +local notation "ker" => (fun g => c (Sum.inl g) + (x g none : ℤ)) +local notation "root" => allocatedPhysicalCubeRoot B U basis S c x y +local notation "dirs" => allocatedPhysicalCubeDirections B U basis S x y + +theorem allocatedNarrowTrimmed_kernel_error (selection : α ↪ G) {M : ℕ} + {X : Type*} (N q : X → ℕ) (d : X) (hN : ∀ a, 0 < N a) (hq : ∀ a, 0 < q a) + {W τ κ C₀ ρ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hκ : 0 < κ) (hρ : 0 < ρ) + (hx : GoodScalarKernelTuple selection κ M x) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (hC₀ : 1 ≤ C₀) (hLC : (S.value : ℝ) ≤ C₀) (hWC : W ≤ C₀) + (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) + (hsize : 8 * (1 + W) * (q d : ℝ) * ρ ≤ (ξ * τ) * (N d : ℝ)) + (hmesh : anisotropicSpatialMeshThreshold selection (PrincipalTupleIndex B (layerSamplerDegree I n)) C₀ ≤ ρ) : + let H := trimmedSpatialRootScale τ N q d + let T := trimmedSpatialSlopeScale W τ N q d + let hs := trimmedSpatial_scales_pos hW hτ N q d (hN d) (hq d) + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let hV := narrowTrimmedSpatialWidths_pos hW hτ hξ N hN + let hp := goodScalarKernelTuple_spatial_det_ne_zero selection x ker hκ hx + ∀ v, |(∏ i, physicalSpatialOutputScale α H T S.value i) * + (smoothMatrixImagePMF (physicalCubeCoefficient root dirs) + (fun k => residueProfileWidth q V (k, d)) + (fun k => residueProfileWidth_pos q V hq hV (k, d)) v).toReal - + maskedIntegerImageDensity (selectedSpatialPivot ker (scalarCubeDifferenceMatrix x) selection) + (Matrix.fromCols (selectedSpatialFreeColumns ker (scalarCubeDifferenceMatrix x) selection) cols) + (physicalSpatialOutputScale α H T S.value) + (anisotropicSpatialKernelDensity selection ker (scalarCubeDifferenceMatrix x) hp H T S.value + hs.1 hs.2 (Nat.cast_pos.mpr S.positive)) v| ≤ + anisotropicSpatialError selection (PrincipalTupleIndex B (layerSamplerDegree I n)) M κ C₀ ρ ξ := by + intro H T hs V hV hp + have hWT : W * T ≤ H := by + change W * T ≤ trimmedSpatialRootScale τ N q d + rw [trimmedSpatial_scale_ratio hW] + exact mul_le_mul_of_nonneg_right (by linarith) hs.2.le + have hscale := narrowTrimmedSpatial_scale_lower hW hτ hξ1 hρ.le N q d (hN d) (hq d) hsize + have h := allocatedPhysicalCube_narrow_error B U basis S c x y selection hs.1 hs.2 hκ hρ + hx hC₀ hLC hbudget hWT hWC hξ hξ1 hscale.1 hscale.2.2 hmesh + simpa only [H, T, V, ← narrowTrimmedSpatial_residue_scale W τ ξ N q d] using h + +theorem allocatedNarrowTrimmed_shifted_vector_site_error (selection : α ↪ G) {M : ℕ} + {X : Type*} [Fintype X] (N q : X → ℕ) (hN : ∀ d, 0 < N d) (hq : ∀ d, 0 < q d) + {W τ κ C₀ ρ ξ δ b r : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hκ : 0 < κ) (hρ : 0 < ρ) + (hx : GoodScalarKernelTuple selection κ M x) + (hbudget : allocatedPhysicalRootBudget B U basis S c ≤ W) + (hC₀ : 1 ≤ C₀) (hLC : (S.value : ℝ) ≤ C₀) (hWC : W ≤ C₀) + (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) + (hsize : ∀ d, 8 * (1 + W) * (q d : ℝ) * ρ ≤ (ξ * τ) * (N d : ℝ)) + (hmesh : anisotropicSpatialMeshThreshold selection (PrincipalTupleIndex B (layerSamplerDegree I n)) C₀ ≤ ρ) + (modulus : ℕ) [NeZero modulus] + (hperiod : integerScalarLattice (Unit ⊕ α) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot ker (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns ker (scalarCubeDifferenceMatrix x) selection)) + (residue : Option vars × X → ℤ) (hresidue : ∀ k d, |(residue (k,d) : ℝ)| ≤ q d) + (hCR : ∀ d, integerResidueMatrix cols (q d * modulus) = + integerResidueMatrix refcols (q d * modulus)) + (hδ : 0 ≤ δ) + (hmove : ∀ d i, (∑ j, |((cols i j - refcols i j : ℤ) : ℝ)|) ≤ + δ * trimmedSpatialRootScale τ N q d) + (hb : 0 < b) (hr : 0 < r) (v : X → (Unit ⊕ α) → ℤ) + (hv : ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ) / trimmedSpatialRootScale τ N q d| ≤ b) : + let H := fun d => trimmedSpatialRootScale τ N q d + let T := fun d => trimmedSpatialSlopeScale W τ N q d + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let hV := narrowTrimmedSpatialWidths_pos hW hτ hξ N hN + let Q := residueProfileWidth q V + let hQ := residueProfileWidth_pos q V hq hV + let hpivot := goodScalarKernelTuple_spatial_det_ne_zero selection x ker hκ hx + let f := canonicalSpatialSiteDensity selection ker (scalarCubeDifferenceMatrix x) hpivot W S.value + hW (Nat.cast_pos.mpr S.positive) + let E := anisotropicSpatialError selection (PrincipalTupleIndex B (layerSamplerDegree I n)) M κ C₀ ρ ξ + let G₀ := (modulus : ℝ) ^ Fintype.card (Unit ⊕ α) + let shift := physicalResidueOffsetShift root (allocatedPhysicalCubeRoot B U basis S c x y₀) + dirs (allocatedPhysicalCubeDirections B U basis S x y₀) residue q + let E' := E + G₀ * (anisotropicSpatialDensityLip selection κ * (1 + W)) * δ + ‖(((∏ d, ∏ i, physicalSpatialOutputScale α (H d) (T d) S.value i) * + (((smoothProductPMF Q hQ).map (fun z d => physicalCubeCoefficient root dirs *ᵥ + (fun k => z (k, d)))) (v - shift)).toReal : ℝ) : ℂ) - + ∏ d, spatialSiteApprox (selectedSpatialPivot ker (scalarCubeDifferenceMatrix x) selection) + (Matrix.fromCols (selectedSpatialFreeColumns ker (scalarCubeDifferenceMatrix x) selection) + (liftResidueMatrix (integerResidueMatrix refcols modulus))) modulus f (H d) b r (v d)‖ ≤ + Fintype.card X * (E' + 4 * G₀ * (anisotropicSpatialDensityLip selection κ * (1 + W)) * r) * + (1 + G₀ * anisotropicSpatialDensityCap selection κ + E') ^ Fintype.card X := by + classical + intro H T V hV Q hQ hpivot f E G₀ shift E' + have hH (d) : 0 < H d := (trimmedSpatial_scales_pos hW hτ N q d (hN d) (hq d)).1 + have hT (d) : 0 < T d := (trimmedSpatial_scales_pos hW hτ N q d (hN d) (hq d)).2 + have hroot (g : G) : |(ker g : ℝ)| ≤ 1 + W := by + have h : |(ker g : ℝ)| ≤ W := + (allocatedPhysicalCube_root_budget B U basis S c x y (.inl g)).trans hbudget + linarith + have hD (i : α) (g : G) : |(scalarCubeDifferenceMatrix x i g : ℝ)| ≤ S.value := + allocatedPhysicalCube_directions_bound B U basis S x y i (.inl g) + have hminor : κ ≤ |(Matrix.of (fun i j => (scalarCubeDifferenceMatrix x i (selection j) : ℝ) / + (S.value : ℝ))).det| := by + change κ ≤ |(normalizedScalarCubePivot selection x).det| + rw [normalizedScalarCubePivot_det] + exact hx.1.le + have hE : 0 ≤ E := anisotropicSpatialError_nonneg selection _ M hκ.le + (zero_le_one.trans hC₀) hρ.le hξ.le + have hpoint (d) := allocatedNarrowTrimmed_kernel_error B U basis S c x y selection N q d hN hq + hW hτ hκ hρ hx hbudget hC₀ hLC hWC hξ hξ1 (hsize d) hmesh + have hshift : shift = fun d => residueMatrixShift cols refcols (q d) + (fun j => residue (some (Sum.inr j), d)) := + allocatedPhysicalResidue_shift_principal B U basis S c x y y₀ residue q + rw [hshift, smoothProductPMF_matrix_image_scaled] + exact canonicalVectorSpatialSiteApprox_shift_error selection ker (scalarCubeDifferenceMatrix x) hpivot + (fun _ => cols) (fun _ => refcols) H T hH hT hW (Nat.cast_pos.mpr S.positive) + (by exact_mod_cast S.positive) hκ (fun d => trimmedSpatial_scale_ratio hW N q d) + hroot hD hminor modulus hperiod q hq (fun d j => residue (some (Sum.inr j), d)) + (fun d j => hresidue (some (Sum.inr j)) d) hCR hδ hmove _ hE hb hr hpoint v hv + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule +open scoped BigOperators Classical Matrix + +theorem allocatedReferenceSpatialProxy_bound {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + {α : Type*} [Fintype α] [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) + (y : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U b S)) + {M : ℕ} (hM : 0 < M) (selection : α ↪ G) + (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) + (period : ℕ) [NeZero period] + (hperiod : integerScalarLattice (Unit ⊕ α) (period : ℤ) ≤ + pivotFullImage (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) + (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection)) + {X : Type*} [Fintype X] (H : X → ℝ) (hH : ∀ t, 0 < H t) + {W : ℝ} (hW : 0 ≤ W) (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + {mesh : ℝ} (hmesh : 0 < mesh) : + let ker := fun g => (0 : ℤ) + (x g none : ℤ) + let hp := goodScalarKernelTuple_spatial_det_ne_zero selection x ker + (one_div_pos.mpr (Nat.cast_pos.mpr hM)) hx + let f := canonicalSpatialSiteDensity selection ker (scalarCubeDifferenceMatrix x) hp W S.value + hW (Nat.cast_pos.mpr S.positive) + ∀ w ∈ spatialWindow H 4, + ‖∏ t, spatialSiteApprox (selectedSpatialPivot ker (scalarCubeDifferenceMatrix x) selection) + (Matrix.fromCols (selectedSpatialFreeColumns ker (scalarCubeDifferenceMatrix x) selection) + (liftResidueMatrix (integerResidueMatrix (principalSpatialColumns (fun _ => (0 : ℤ)) id y) period))) + period f (H t) 4 mesh (w t)‖ ≤ + ((period : ℝ) ^ Fintype.card (Unit ⊕ α) * + anisotropicSpatialDensityCap selection (1 / (M : ℝ))) ^ Fintype.card X := by + intro ker hp f w hw + have hκ : 0 < 1 / (M : ℝ) := one_div_pos.mpr (Nat.cast_pos.mpr hM) + have hC := anisotropicSpatialDensityCap_nonneg selection hκ.le + have hroot (g : G) : |(ker g : ℝ)| ≤ 1 + W := by + have h := (allocatedPhysicalCube_root_budget B U b S (fun _ => 0) x y (.inl g)).trans hbudget + change |(ker g : ℝ)| ≤ W at h + linarith + have hD (i : α) (g : G) : |(scalarCubeDifferenceMatrix x i g : ℝ)| ≤ S.value := + allocatedPhysicalCube_directions_bound B U b S x y i (.inl g) + have hminor : 1 / (M : ℝ) ≤ + |(Matrix.of (fun i j => (scalarCubeDifferenceMatrix x i (selection j) : ℝ) / (S.value : ℝ))).det| := by + change 1 / (M : ℝ) ≤ |(normalizedScalarCubePivot selection x).det| + rw [normalizedScalarCubePivot_det] + exact hx.1.le + have hf := (canonicalSpatialSiteDensity_bounds selection ker (scalarCubeDifferenceMatrix x) hp + hW (Nat.cast_pos.mpr S.positive) (by exact_mod_cast S.positive) hκ hroot hD hminor).1 + apply residueSpatialSite_norm_le _ _ period hperiod (fun _ => f) H (by norm_num) hmesh hC + (fun _ => hf) (fun _ => integerResidueMatrix (principalSpatialColumns (fun _ => (0 : ℤ)) id y) period) w + exact (mem_spatialWindow_scaled_iff H hH 4 w).mp hw + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialTermSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialTermSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..8eb68e3b19cf684617fca1bd2e62dc9b220ec8d6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialTermSupport.lean @@ -0,0 +1,199 @@ +import OAI.Combinatorics.Progressions.Linear.AllocatedSpatialKernelShift + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Matrix NNReal Classical + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) + +omit [DecidableEq G] in +theorem allocatedKernel_coefficient_sum {W : ℝ} + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (c : Option (Fin dim)) : (∑ g, |((x g c : ℤ) : ℝ)|) ≤ W := by + have hcard : Fintype.card G ≤ Fintype.card (LayerSamplerVariables G I n B) := + Fintype.card_le_of_injective (Sum.inl : G → LayerSamplerVariables G I n B) Sum.inl_injective + have hwb : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) * (S.value : ℝ) ≤ W := by + simpa only [allocatedPhysicalRootBudget, Int.cast_zero, abs_zero, Finset.sum_const_zero, zero_add] using hbudget + have hsum : (∑ g, |((x g c : ℤ) : ℝ)|) ≤ (Fintype.card G : ℝ) * S.value := by + calc + _ ≤ ∑ _g : G, (S.value : ℝ) := by + apply Finset.sum_le_sum + intro g _ + have hg := Finset.mem_Ico.mp (x g c).property + exact_mod_cast abs_le.mpr ⟨hg.1, hg.2.le⟩ + _ = _ := by simp + exact hsum.trans ((mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hcard) (Nat.cast_nonneg S.value)).trans hwb) + +variable (X : Type*) [Fintype X] {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (modulus : ℕ) [NeZero modulus] (H : X → ℝ) {W : ℝ} (hW : 0 ≤ W) (mesh : ℝ) + +theorem allocatedResidueSpatialKernel_zero_outside + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hH : ∀ t, 0 < H t) (hmesh : 0 < mesh) + (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod modulus) + (v : X → (Unit ⊕ Fin dim) → ℤ) (hv : v ∉ spatialWindow H (3 + 2 * mesh)) : + allocatedResidueSpatialKernel B U b S x X hM selection hx modulus H hW mesh r v = 0 := by + have hcoords : ¬ ∀ t i, |((spatialStar (v t) i : ℤ) : ℝ) / H t| ≤ 3 + 2 * mesh := + fun h => hv ((mem_spatialWindow_scaled_iff H hH (3 + 2 * mesh) v).2 h) + push Not at hcoords + obtain ⟨t, i, hi⟩ := hcoords + let root := fun g => (0 : ℤ) + (x g none : ℤ) + let hp := goodScalarKernelTuple_spatial_det_ne_zero selection x root + (one_div_pos.mpr (Nat.cast_pos.mpr hM)) hx + have hroot : (∑ g, |(root g : ℝ)|) ≤ W := by + simpa only [root, zero_add] using allocatedKernel_coefficient_sum B U b S x hbudget none + have hD : ∀ i, (∑ g, |(scalarCubeDifferenceMatrix x i g : ℝ)|) ≤ 1 + W := by + intro i + have h := allocatedKernel_coefficient_sum B U b S x hbudget (some i) + change (∑ g, |((x g (some i) : ℤ) : ℝ)|) ≤ 1 + W + linarith + unfold allocatedResidueSpatialKernel + apply Finset.prod_eq_zero (Finset.mem_univ t) + apply spatialSiteApprox_zero_outside _ _ modulus _ (H t) 4 mesh 3 hmesh + · exact canonicalSpatialSiteDensity_zero_outside selection root (scalarCubeDifferenceMatrix x) + hp hW (Nat.cast_pos.mpr S.positive) hroot hD + · exact ⟨i, hi⟩ + +theorem allocatedResidueSpatialWindowWeight_eq_kernel + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hH : ∀ t, 0 < H t) (hmesh : 0 < mesh) (hmargin : 3 + 2 * mesh ≤ 4) + (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod modulus) + (v : X → (Unit ⊕ Fin dim) → ℤ) : + allocatedResidueSpatialWindowWeight B U b S x X hM selection hx modulus H hW mesh r v = + allocatedResidueSpatialKernel B U b S x X hM selection hx modulus H hW mesh r v := by + unfold allocatedResidueSpatialWindowWeight + split_ifs with hv + · rfl + · symm + apply allocatedResidueSpatialKernel_zero_outside B U b S x X hM selection hx modulus H hW mesh + hbudget hH hmesh r v + exact fun h => hv (spatialWindow_radius_mono H (fun t => (hH t).le) hmargin h) + +theorem allocatedResidueSpatialKernel_shift_global + (Q : ℝ≥0) (hQ : 1 ≤ Q) (hratio : (1 + W) / (S.value : ℝ) ≤ Q) + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage + (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection)) + (hH : ∀ t, 0 < H t) (hmesh : 0 < mesh) {ε : ℝ} (hε : 0 ≤ ε) + (hmargin : (3 + 2 * mesh) + 2 * ε ≤ 4) + (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod modulus) + (shift : X → (Unit ⊕ Fin dim) → ℤ) + (hshift : ∀ t, shift t ∈ integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ)) + (hsize : ∀ t, ‖fun i => (shift t i : ℝ) / H t‖ ≤ ε) : + ∀ v, ‖allocatedResidueSpatialKernel B U b S x X hM selection hx modulus H hW mesh r (v + shift) - + allocatedResidueSpatialKernel B U b S x X hM selection hx modulus H hW mesh r v‖ ≤ + Fintype.card X * + ((modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) * + (anisotropicSpatialDensityLip selection (1 / (M : ℝ)) * Q) * (8 * mesh + ε)) * + (1 + (modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) * + anisotropicSpatialDensityCap selection (1 / (M : ℝ)))^Fintype.card X := by + have hroot (g) : |((x g none : ℤ) : ℝ)| ≤ 1 + W := by + have h := (Finset.single_le_sum (fun j _ => abs_nonneg (((x j none : ℤ) : ℝ))) + (Finset.mem_univ g)).trans (allocatedKernel_coefficient_sum B U b S x hbudget none) + linarith + have hs : shift ∈ spatialWindow H (2 * ε) := by + apply spatialWindow_of_coordinate_bound H (fun t => (hH t).le) hε shift + intro t i + have h := (norm_le_pi_norm (fun i => (shift t i : ℝ) / H t) i).trans (hsize t) + rw [Real.norm_eq_abs, abs_div, abs_of_pos (hH t)] at h + have hd := (div_le_iff₀ (hH t)).mp h + simpa only [mul_comm] using hd + have hκ : 0 ≤ 1 / (M : ℝ) := one_div_nonneg.mpr (Nat.cast_nonneg M) + have hLip := anisotropicSpatialDensityLip_nonneg selection hκ + have hCap := anisotropicSpatialDensityCap_nonneg selection hκ + have hE : 0 ≤ Fintype.card X * + ((modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) * + (anisotropicSpatialDensityLip selection (1 / (M : ℝ)) * Q) * (8 * mesh + ε)) * + (1 + (modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) * + anisotropicSpatialDensityCap selection (1 / (M : ℝ)))^Fintype.card X := by positivity + apply spatialWeight_shift_global H (fun t => (hH t).le) + (allocatedResidueSpatialKernel B U b S x X hM selection hx modulus H hW mesh r) + (by positivity : 0 ≤ 2 * ε) hE hmargin + (allocatedResidueSpatialKernel_zero_outside B U b S x X hM selection hx modulus H hW mesh hbudget hH hmesh r) + shift hs + intro v hv hvs + exact allocatedResidueSpatialKernel_shift B U b S x X hM selection hx modulus H hW mesh + Q hQ hratio hroot hperiod hH hmesh hε r v shift hshift hsize hv hvs + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Matrix NNReal Classical + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) + +variable (X : Type*) [Fintype X] {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (modulus : ℕ) [NeZero modulus] (H : X → ℝ) {W : ℝ} (hW : 0 ≤ W) (mesh : ℝ) + +omit [NeZero modulus] in +theorem allocatedSpatialExpansionCoefficient_term_zero_outside + (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) + (hH : ∀ z, 0 < H z) (hmesh : 0 < mesh) (hmargin : 3 + 2 * mesh ≤ 4) + (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod modulus) + (t : X → SpatialSiteLabel (Fin dim) modulus 4 mesh) + (hc : allocatedSpatialExpansionCoefficient B U b S x X hM selection hx modulus hW mesh r t ≠ 0) + (v : X → (Unit ⊕ Fin dim) → ℤ) (hv : v ∉ spatialWindow H 4) : + (∏ i, vectorResidueSiteWeight 4 mesh H (fun z => (t z).1 i) (fun z => (t z).2 i) + (fun z => spatialStar (v z) i)) = 0 := by + have hcoords : ¬ ∀ z i, |((spatialStar (v z) i : ℤ) : ℝ) / H z| ≤ 4 := + fun h => hv ((mem_spatialWindow_scaled_iff H hH 4 v).2 h) + push Not at hcoords + obtain ⟨z, i, hi⟩ := hcoords + let root := fun g => (0 : ℤ) + (x g none : ℤ) + let hp := goodScalarKernelTuple_spatial_det_ne_zero selection x root + (one_div_pos.mpr (Nat.cast_pos.mpr hM)) hx + have hroot : (∑ g, |(root g : ℝ)|) ≤ W := by + simpa only [root, zero_add] using allocatedKernel_coefficient_sum B U b S x hbudget none + have hD : ∀ i, (∑ g, |(scalarCubeDifferenceMatrix x i g : ℝ)|) ≤ 1 + W := by + intro i + have h := allocatedKernel_coefficient_sum B U b S x hbudget (some i) + change (∑ g, |((x g (some i) : ℤ) : ℝ)|) ≤ 1 + W + linarith only [h] + let f := canonicalSpatialSiteDensity selection root (scalarCubeDifferenceMatrix x) hp W S.value + hW (Nat.cast_pos.mpr S.positive) + let A := selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection + let Bextra := Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection) + (liftResidueMatrix (principalSpatialResidueColumns modulus (fun _ => (0 : ℤ)) id r)) + have hcz : spatialSiteCoefficient A Bextra modulus f 4 mesh (t z) ≠ 0 := + (Finset.prod_ne_zero_iff.mp hc) z (Finset.mem_univ z) + have hz := spatialSiteTerm_zero_outside A Bextra modulus f (H z) 4 mesh 3 hmesh + (canonicalSpatialSiteDensity_zero_outside selection root (scalarCubeDifferenceMatrix x) + hp hW (Nat.cast_pos.mpr S.positive) hroot hD) (t z) (v z) ⟨i, hmargin.trans_lt hi⟩ + simp only [vectorResidueSiteWeight] + rw [Finset.prod_comm] + exact Finset.prod_eq_zero (Finset.mem_univ z) ((mul_eq_zero.mp hz).resolve_left hcz) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialWitnessComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialWitnessComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e5b065efc85e9e64e6b08cde2909f0ea82cf5fa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSpatialWitnessComparison.lean @@ -0,0 +1,265 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedSpatialResidueMaskedComparison +import OAI.Combinatorics.Progressions.Lattices.SelectedResidueMaskedTest +import OAI.Combinatorics.Progressions.Probability.AllocatedMaskedCoefficientHaarLaw + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule MeasureTheory +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type} [Fintype G] {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) [∀ a, Fintype (B a)] +variable {J E : Fin m → Type} [∀ j, Fintype (J j)] [∀ j, DecidableEq (J j)] [∀ j, Fintype (E j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +variable (C V : Fin m → ℝ≥0) +variable (hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) +variable (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + +include hC hV in + +theorem exists_allocated_spatial_chart_event_comparison + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hσ1 : ∀ j, σ j ≤ 1) + (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ Cinv j * ‖v‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1/4) + (q : ℕ) [NeZero q] (hq : 0 < q) + {P δ : ℝ} (hP : 0 ≤ P) (hmP : (m : ℝ) ≤ P) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) ≤ P) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (hn : ∀ j, (n j : ℝ) ≤ P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hLP : (S.value : ℝ) ≤ Real.exp P) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (hqP : (q : ℝ) ≤ Real.exp P) (hδ : 0 < δ) (hδP : δ⁻¹ ≤ Real.exp P) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + {X : Type} [Fintype X] [DecidableEq X] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hm : ∀ j e, coefficients (poly j) e ∈ U j) + {Ps ε ρ Rs Smax : ℝ} (hPs : 0 ≤ Ps) (hX : (Fintype.card X : ℝ) ≤ Ps) + (hframe : (Fintype.card (Option (LayerSamplerVariables G I n B) × X) : ℝ) ≤ Ps) + (hqPs : (q : ℝ) ≤ Real.exp Ps) + (hε : 0 < ε) (hρ : 0 < ρ) (hεPs : 1 / ε ≤ Real.exp Ps) (hρPs : 1 / ρ ≤ Real.exp Ps) + (stride : X → ℕ) (hstride : ∀ x, 0 < stride x) + (hSmax : 0 ≤ Smax) (hSmaxPs : Smax ≤ Real.exp Ps) (hstrideMax : ∀ x, ((stride x * q : ℕ) : ℝ) ≤ Smax) + (H : X → ℝ) + (hsize : ∀ x, Real.exp ((Ps + allocatedMaskedTiltedConstant m) ^ allocatedMaskedTiltedConstant m) ≤ H x) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) H Rs (U j) (poly j)) + (hRs : Real.exp ((Ps + allocatedMaskedTiltedConstant m) ^ allocatedMaskedTiltedConstant m) ≤ Rs) + (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) + (hcells : cells.Nonempty) + (event : ((Option (LayerSamplerVariables G I n B) × X) → ZMod q) → + CoefficientChartResidues (LayerSamplerVariables G I n B) n E q → Prop) + (width : Option (LayerSamplerVariables G I n B) × X → ℝ) (hwidth : ∀ z, 0 < width z) + (hwide : ∀ z, ρ * H z.2 ≤ width z) + (hfreqPs : (4 * allocatedFourierLogBudget m P + 2)^4 ≤ Ps) + (hmassPs : 4 * allocatedFourierLogBudget m P * (4 * allocatedFourierLogBudget m P + 2)^4 + + allocatedFourierLogBudget m P ≤ Ps) + (hsmallError : 2 * δ + ε ≤ 1 / 2) : + let Dphysical := fun z : Option (LayerSamplerVariables G I n B) × X → ℤ => + allocatedCoefficientDensity B U b hb o hR hσ S + (affineSampleCoefficientTorus U poly hm (fun k x => (z (k, x) : ℝ))) + let sample := fun z : Option (LayerSamplerVariables G I n B) × X → ℤ => + affineCoefficientCoverSample U poly hm q (fun k x => (z (k, x) : ℝ)) + ∃ hD0 : ∀ z, 0 ≤ Dphysical z, + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride cells width z, + ∃ hDpos : 0 < selectedResidueDensityMass stride cells width Dphysical, + |selectedResidueDensityMass stride cells width Dphysical - 1| ≤ 2 * δ + ε ∧ + 1 / 2 ≤ selectedResidueDensityMass stride cells width Dphysical ∧ + selectedResidueDensityMass stride cells width Dphysical ≤ 3 / 2 ∧ + |(∑' z, (selectedResidueDensityPMF stride cells width hwidth hZ Dphysical hD0 hDpos z).toReal * + (if coefficientDeckChartEvent U bW b hb o q (event (fun v => (z v : ZMod q))) (sample z) then 1 else 0)) - + ∑' z, (selectedResidueSmoothPMF stride cells width hwidth hZ z).toReal * + ∫ y, allocatedMaskedCoefficientDensity B U b o S q + (coefficientDeckResidueMask U bW b hb q + (fun a => if event (fun v => (z v : ZMod q)) a then 1 else 0)) y ∂μ| ≤ + 12 * (2 * δ + ε) := by + dsimp only + let mask := fun r => coefficientDeckResidueMask U bW b hb q + (fun a => if event r a then (1 : ℝ) else 0) + have hmask : ∀ r z, mask r z ∈ Set.Icc (0 : ℝ) 1 := by + intro r z + simp only [mask, coefficientDeckResidueMask] + split_ifs <;> constructor <;> norm_num + obtain ⟨hD0, hZ, hDpos, hmass, hlower, hupper, he⟩ := + exists_allocated_spatial_residue_masked_comparison B U b hb o S C V hC hV + hR hσ hσ1 Cinv hCinv hchart hsmall q hq hP hmP hK hRP hσP hcount hI hn hJ hAP hLP + hCP hVP hqP hδ hδP μ ν poly hp hm hPs hX hframe hqPs hε hρ hεPs hρPs stride hstride + hSmax hSmaxPs hstrideMax H hsize hrank hRs cells hcells mask hmask width hwidth hwide + hfreqPs hmassPs hsmallError + let D := allocatedCoefficientDensity B U b hb o hR hσ S + let Dc := fun x => D (quotientIntegerCover (coefficientIntegerLattice U) q x) + let A := fun r => allocatedMaskedCoefficientDensity B U b o S q (mask r) + let sample := fun z : Option (LayerSamplerVariables G I n B) × X → ℤ => + affineCoefficientCoverSample U poly hm q (fun k x => (z (k,x) : ℝ)) + let Dphysical := fun z : Option (LayerSamplerVariables G I n B) × X → ℤ => + D (affineSampleCoefficientTorus U poly hm (fun k x => (z (k,x) : ℝ))) + let ev := fun z => coefficientDeckChartEvent U bW b hb o q + (event (fun v => (z v : ZMod q))) (sample z) + have hdom (r) := allocatedMaskedCoefficientDensity_le_density B U b o S C V hC hV hb + hR hσ hσ1 Cinv hCinv hchart hsmall q (mask r) (hmask r) + have hmean := selectedResidueDensityPMF_mean_congr_density stride cells width hwidth hZ + Dphysical hD0 hDpos (fun z => if ev z then (1 : ℂ) else 0) + (fun z => dominatedDensityRatio Dc (A (fun v => (z v : ZMod q))) (sample z)) (by + intro z + have hd : Dc (sample z) = Dphysical z := + coefficientCover_density_sample U poly hm q hq D _ + rw [← hd, dominatedDensityRatio_mul Dc (A _) (fun x => (hdom _ x).1) (fun x => (hdom _ x).2)] + have hid := allocatedMaskedCoefficientDensity_event B U bW b hb o S hR hσ hσ1 + Cinv hCinv hchart hsmall C V hC hV q (event (fun v => (z v : ZMod q))) (sample z) + simpa only [Complex.ofReal_mul, apply_ite, Complex.ofReal_one, Complex.ofReal_zero] + using congrArg Complex.ofReal hid) + change ‖(∑' z, ((selectedResidueDensityPMF stride cells width hwidth hZ Dphysical hD0 hDpos z).toReal : ℂ) * + dominatedDensityRatio Dc (A (fun v => (z v : ZMod q))) (sample z)) - _‖ ≤ _ at he + rw [← hmean] at he + simp only [mask] at he + refine ⟨hD0, hZ, hDpos, hmass, hlower, hupper, ?_⟩ + have he' := he + rw [show (∑' z, ((selectedResidueDensityPMF stride cells width hwidth hZ Dphysical hD0 hDpos z).toReal : ℂ) * + (if ev z then (1 : ℂ) else 0)) = + ((∑' z, (selectedResidueDensityPMF stride cells width hwidth hZ Dphysical hD0 hDpos z).toReal * + (if ev z then (1 : ℝ) else 0) : ℝ) : ℂ) by + simp only [Complex.ofReal_tsum, Complex.ofReal_mul, apply_ite, Complex.ofReal_one, Complex.ofReal_zero]] at he' + simp only [integral_complex_ofReal, ← Complex.ofReal_mul, ← Complex.ofReal_tsum, + ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] at he' + exact he' + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule MeasureTheory +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type} [Fintype G] {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) [∀ a, Fintype (B a)] +variable {J E : Fin m → Type} [∀ j, Fintype (J j)] [∀ j, DecidableEq (J j)] [∀ j, Fintype (E j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +variable (C V : Fin m → ℝ≥0) +variable (hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) +variable (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + +include hC hV in + +theorem exists_allocated_spatial_witness_comparison + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hσ1 : ∀ j, σ j ≤ 1) + (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ Cinv j * ‖v‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1/4) + (q : ℕ) [NeZero q] (hq : 0 < q) + {P δ : ℝ} (hP : 0 ≤ P) (hmP : (m : ℝ) ≤ P) + (hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val+1)) : ℝ) ≤ P) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (hn : ∀ j, (n j : ℝ) ≤ P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hLP : (S.value : ℝ) ≤ Real.exp P) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (hqP : (q : ℝ) ≤ Real.exp P) (hδ : 0 < δ) (hδP : δ⁻¹ ≤ Real.exp P) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + {X : Type} [Fintype X] [DecidableEq X] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hm : ∀ j e, coefficients (poly j) e ∈ U j) + {Ps ε ρ Rs Smax : ℝ} (hPs : 0 ≤ Ps) (hX : (Fintype.card X : ℝ) ≤ Ps) + (hframe : (Fintype.card (Option (LayerSamplerVariables G I n B) × X) : ℝ) ≤ Ps) + (hqPs : (q : ℝ) ≤ Real.exp Ps) + (hε : 0 < ε) (hρ : 0 < ρ) (hεPs : 1 / ε ≤ Real.exp Ps) (hρPs : 1 / ρ ≤ Real.exp Ps) + (stride : X → ℕ) (hstride : ∀ x, 0 < stride x) + (hSmax : 0 ≤ Smax) (hSmaxPs : Smax ≤ Real.exp Ps) (hstrideMax : ∀ x, ((stride x * q : ℕ) : ℝ) ≤ Smax) + (H : X → ℝ) + (hsize : ∀ x, Real.exp ((Ps + allocatedMaskedTiltedConstant m) ^ allocatedMaskedTiltedConstant m) ≤ H x) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) H Rs (U j) (poly j)) + (hRs : Real.exp ((Ps + allocatedMaskedTiltedConstant m) ^ allocatedMaskedTiltedConstant m) ≤ Rs) + (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) + (hcells : cells.Nonempty) + (event : ((Option (LayerSamplerVariables G I n B) × X) → ZMod q) → + CoefficientChartResidues (LayerSamplerVariables G I n B) n E q → Prop) + (width : Option (LayerSamplerVariables G I n B) × X → ℝ) (hwidth : ∀ z, 0 < width z) + (hwide : ∀ z, ρ * H z.2 ≤ width z) + (hfreqPs : (4 * allocatedFourierLogBudget m P + 2)^4 ≤ Ps) + (hmassPs : 4 * allocatedFourierLogBudget m P * (4 * allocatedFourierLogBudget m P + 2)^4 + + allocatedFourierLogBudget m P ≤ Ps) + (hsmallError : 2 * δ + ε ≤ 1 / 2) : + let Dphysical := fun z : Option (LayerSamplerVariables G I n B) × X → ℤ => + allocatedCoefficientDensity B U b hb o hR hσ S + (affineSampleCoefficientTorus U poly hm (fun k x => (z (k, x) : ℝ))) + let sample := fun z : Option (LayerSamplerVariables G I n B) × X → ℤ => + affineCoefficientCoverSample U poly hm q (fun k x => (z (k, x) : ℝ)) + ∃ hD0 : ∀ z, 0 ≤ Dphysical z, + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride cells width z, + ∃ hDpos : 0 < selectedResidueDensityMass stride cells width Dphysical, + |selectedResidueDensityMass stride cells width Dphysical - 1| ≤ 2 * δ + ε ∧ + 1 / 2 ≤ selectedResidueDensityMass stride cells width Dphysical ∧ + selectedResidueDensityMass stride cells width Dphysical ≤ 3 / 2 ∧ + |(∑' z, (selectedResidueDensityPMF stride cells width hwidth hZ Dphysical hD0 hDpos z).toReal * + (if coefficientDeckChartEvent U bW b hb o q (event (fun v => (z v : ZMod q))) (sample z) then 1 else 0)) - + ∑' z, (selectedResidueSmoothPMF stride cells width hwidth hZ z).toReal * + ∫ p : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n × + CoefficientDeckResidues (K := LayerSamplerVariables G I n B) E q, + (if event (fun v => (z v : ZMod q)) (coefficientSamplerChartResidues q p.1 p.2) then (1 : ℝ) else 0) + ∂(allocatedCoefficientSource B U b hR hσ S).prod + (PMF.uniformOfFintype (CoefficientDeckResidues (K := LayerSamplerVariables G I n B) E q)).toMeasure| ≤ + 12 * (2 * δ + ε) := by + dsimp only + obtain ⟨hD0, hZ, hDpos, hmass, hlower, hupper, he⟩ := + exists_allocated_spatial_chart_event_comparison B U bW b hb o S C V hC hV + hR hσ hσ1 Cinv hCinv hchart hsmall q hq hP hmP hK hRP hσP hcount hI hn hJ hAP hLP + hCP hVP hqP hδ hδP μ ν poly hp hm hPs hX hframe hqPs hε hρ hεPs hρPs stride hstride + hSmax hSmaxPs hstrideMax H hsize hrank hRs cells hcells event width hwidth hwide + hfreqPs hmassPs hsmallError + have hhaar (r) := allocatedMaskedCoefficientDensity_haar_integral B U bW b hb o S C V hC hV μ ν + hR hσ hσ1 Cinv hCinv hchart hsmall q + (fun a => if event r a then (1 : ℝ) else 0) + (fun a => by split_ifs <;> constructor <;> norm_num) + simp_rw [hhaar] at he + exact ⟨hD0, hZ, hDpos, hmass, hlower, hupper, he⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedBufferedPhysicalFactorization.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedBufferedPhysicalFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..11c959bf3df61d28783502c77e4c245632bc4ed7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedBufferedPhysicalFactorization.lean @@ -0,0 +1,270 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedFullSiteRadiusBudget +import OAI.Combinatorics.Progressions.Estimates.AllocatedBufferedPhysicalFactorization +import OAI.Combinatorics.Progressions.Estimates.AllocatedCoveredSiteBuffer + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable (α : Type*) [Fintype α] + +noncomputable def allocatedBufferedPhysicalChartRadius (C : Fin m → ℝ) (j : Fin m) : ℝ := + min (allocatedPhysicalChartRadius (G := G) B α C (allocatedSiteRootAllowance α m) j) + (1 / (8 * (C j + 1) * ((Fintype.card (I j) : ℝ) + 1) * (allocatedFullSiteRadius (G := G) B α : ℝ))) + +theorem allocatedBufferedPhysicalChartRadius_pos (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) (j : Fin m) : + 0 < allocatedBufferedPhysicalChartRadius (G := G) B α C j := by + have hCj := hC j + have hr : (0 : ℝ) < allocatedFullSiteRadius (G := G) B α := allocatedFullSiteRadius_pos B α + exact lt_min (allocatedPhysicalChartRadius_pos B α C hC + (allocatedSiteRootAllowance_one_le α m) j) (by positivity) + +theorem allocatedBufferedPhysicalChartRadius_le_supported (C : Fin m → ℝ) (j : Fin m) : + allocatedBufferedPhysicalChartRadius (G := G) B α C j ≤ + allocatedPhysicalChartRadius (G := G) B α C (allocatedSiteRootAllowance α m) j := min_le_left _ _ + +theorem allocatedBufferedPhysicalChartRadius_le_original (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) (j : Fin m) : + allocatedBufferedPhysicalChartRadius (G := G) B α C j ≤ allocatedPhysicalChartRadius (G := G) B α C 1 j := + (allocatedBufferedPhysicalChartRadius_le_supported B α C j).trans (allocatedSiteChartRadius_le_original B α C hC j) + +theorem allocatedBufferedPhysicalChartRadius_budget (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + {R : Fin m → ℝ} (hR : ∀ j, 0 ≤ R j) + (hsmall : ∀ j, R j ≤ allocatedBufferedPhysicalChartRadius (G := G) B α C j) (j : Fin m) : + C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (allocatedFullSiteRadius (G := G) B α : ℝ) * R j)) ≤ 1 / 4 := by + have hCj := hC j + have hr : (0 : ℝ) < allocatedFullSiteRadius (G := G) B α := allocatedFullSiteRadius_pos B α + have hD : 0 < 8 * (C j + 1) * ((Fintype.card (I j) : ℝ) + 1) * (allocatedFullSiteRadius (G := G) B α : ℝ) := by positivity + have hs : R j ≤ 1 / (8 * (C j + 1) * ((Fintype.card (I j) : ℝ) + 1) * (allocatedFullSiteRadius (G := G) B α : ℝ)) := + (hsmall j).trans (min_le_right _ _) + have hDR := (le_div_iff₀ hD).mp hs + calc + _ ≤ (C j + 1) * (((Fintype.card (I j) : ℝ) + 1) * (2 * (allocatedFullSiteRadius (G := G) B α : ℝ) * R j)) := + mul_le_mul_of_nonneg_right (le_add_of_nonneg_right zero_le_one) + (mul_nonneg (by positivity) (mul_nonneg (by positivity) (hR j))) + _ = (R j * (8 * (C j + 1) * ((Fintype.card (I j) : ℝ) + 1) * (allocatedFullSiteRadius (G := G) B α : ℝ))) / 4 := by ring + _ ≤ 1 / 4 := div_le_div_of_nonneg_right hDR (by norm_num) + +theorem allocatedBufferedPhysicalChartRadius_inv_le_exp + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) {P : ℝ} (hP : 0 ≤ P) + (hm : (m : ℝ) ≤ Real.exp P) (hq : (Fintype.card α : ℝ) ≤ P) + (hallow : ((2 * m : ℕ) + 5) * (Fintype.card α : ℝ) + 5 ≤ P) + (hCP : ∀ j, C j ≤ Real.exp P) + (hNP : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp P) + (hIP : ∀ j, (Fintype.card (I j) : ℝ) ≤ Real.exp P) (j : Fin m) : + (allocatedBufferedPhysicalChartRadius (G := G) B α C j)⁻¹ ≤ + Real.exp (3 * (P + 1) + Fintype.card α + 2 + + (j.val + 1 : ℕ) * (P + Fintype.card α + 1) + (6 * P + 6)) := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hunit : 1 ≤ Real.exp P := Real.one_le_exp_iff.mpr hP + have hadd {a : ℝ} (ha : a ≤ Real.exp P) : a + 1 ≤ Real.exp (P + 1) := by + calc + _ ≤ 2 * Real.exp P := by linarith + _ ≤ Real.exp 1 * Real.exp P := mul_le_mul_of_nonneg_right htwo (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have h8 : (8 : ℝ) ≤ Real.exp 3 := by + calc + _ = (2 : ℝ) ^ 3 := by norm_num + _ ≤ (Real.exp 1) ^ 3 := pow_le_pow_left₀ (by norm_num) htwo 3 + _ = _ := by rw [← Real.exp_nat_mul]; norm_num + have hr := allocatedFullSiteRadius_le_exp B α hP hm hq + ((allocatedSiteRootAllowance_le_exp α m).trans (Real.exp_le_exp.mpr hallow)) hNP + have hCj := hC j + have hCp := hadd (hCP j) + have hIp := hadd (hIP j) + have hden : 8 * (C j + 1) * ((Fintype.card (I j) : ℝ) + 1) * (allocatedFullSiteRadius (G := G) B α : ℝ) ≤ + Real.exp (6 * P + 6) := by + calc + _ ≤ Real.exp 3 * Real.exp (P + 1) * Real.exp (P + 1) * Real.exp (4 * P + 1) := by gcongr + _ = _ := by simp only [← Real.exp_add]; congr 1; ring + have hold := allocatedSiteChartRadius_inv_le_exp B α C hC hP hallow hCP hNP hIP j + unfold allocatedBufferedPhysicalChartRadius + by_cases h : allocatedPhysicalChartRadius (G := G) B α C (allocatedSiteRootAllowance α m) j ≤ + 1 / (8 * (C j + 1) * ((Fintype.card (I j) : ℝ) + 1) * (allocatedFullSiteRadius (G := G) B α : ℝ)) + · rw [min_eq_left h] + exact hold.trans (Real.exp_le_exp.mpr (le_add_of_nonneg_right (by positivity))) + · rw [min_eq_right (le_of_not_ge h), one_div, inv_inv] + exact hden.trans (Real.exp_le_exp.mpr (le_add_of_nonneg_left (by positivity))) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set BooleanCubeKernel +open scoped Classical BigOperators NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "rows" => (fun j => (Subtype.val : jets j → Finset α)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit jets I n grid +local notation "quarter" => (fun j (_ : jets j) => standardLatticeClosedQuarterBox (J j)) +local notation "chart" => mixedCoveredJetChart (O := jets) U o b hb bW d +local notation "region" => mixedCoveredJetRegion (O := jets) (E := Q) U o b d quarter + +theorem allocatedCoveredSiteTerm_supported_buffered_factorization + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (hsmall : ∀ j, R j ≤ allocatedBufferedPhysicalChartRadius (G := G) B α C j) + (modulus : ℕ) + (residue : ∀ j : Fin m, Matrix (BoundedBooleanJet α (j.val + 1)) + (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) + (f : Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (hsupport : ∀ s w, (∃ a, 2 * idealSiteBoxRadius α m < |w a|) → f s w = 0) + (y : EuclideanJetLayers U jets) : + allocatedCoveredComplexProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedSiteTermDensity B U b S x modulus residue f) y = + (allocatedCoveredProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedMaskedSiteEnvelope B U b S x modulus residue) y : ℂ) * + ∏ s, allocatedBufferedSiteChartFactor B U b S o hb bW d (allocatedFullSiteRadius (G := G) B α) + (allocatedFullSiteRadius_pos B α) (f s) (coveredBooleanSiteValue U y s) := by + have hsmall' (j : Fin m) : R j ≤ allocatedPhysicalChartRadius (G := G) B α C (allocatedSiteRootAllowance α m) j := + (hsmall j).trans (allocatedBufferedPhysicalChartRadius_le_supported B α C j) + by_cases hy : y ∈ chart '' region + · obtain ⟨z, hz, rfl⟩ := hy + have hinj := mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) + rw [allocatedCoveredComplexProfileDensity, allocatedCoveredProfileDensity, + restrictedComplexChartDensity_apply _ _ _ _ hinj hz, + restrictedChartDensity_apply _ _ _ _ hinj hz, Complex.ofReal_one, one_mul, one_mul] + by_cases hg : allocatedGridJetDensity B U b hR hσ S x u v rows + (fun a => coefficientJetAxisEquiv jets I n z.1 a.val) = 0 + · simp only [allocatedCoveredFixedFactor, hg, zero_mul, zero_div, Complex.ofReal_zero] + · by_cases hs : ∀ s a, |allocatedIdealSiteCoordinates B U b S (split z.1).2 s a| ≤ 2 * idealSiteBoxRadius α m + · have hsites := mixedCoveredBooleanSiteValue_mem_quarter U o b d z + (fun j => C j * (((Fintype.card (I j) : ℝ) + 1) * (allocatedSiteJetSize (G := G) B α j * R j))) + (fun j => mul_nonneg (hC j) (mul_nonneg (by positivity) + (mul_nonneg (allocatedSiteJetSize_nonneg B α j) (hR j).le))) + (allocatedSiteBox_mixed_point_bound B U b hR hσ S x u v hσ1 o d z hg hs C hC hchart) + (allocatedSiteChartRadius_budget B α C hC (fun j => (hR j).le) hsmall') + have hbox := allocatedSiteBox_full_site_bound B U b hR hσ S x u v hσ1 z.1 hg hs + rw [allocatedBufferedSiteChartFactor_product B U b S o hb bW d + (allocatedFullSiteRadius (G := G) B α) (allocatedFullSiteRadius_pos B α) f z hsites hbox] + simp only [allocatedMaskedSiteEnvelope, allocatedIdealSiteEnvelope, ite_eq_left hs, + allocatedSiteTermDensity, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_inv] + ring + · obtain ⟨s, a, ha⟩ : ∃ s a, 2 * idealSiteBoxRadius α m < + |allocatedIdealSiteCoordinates B U b S (split z.1).2 s a| := by + simpa only [not_forall, not_le] using hs + have hp : (∏ s, f s (allocatedIdealSiteCoordinates B U b S (split z.1).2 s)) = 0 := + Finset.prod_eq_zero (Finset.mem_univ s) (hsupport s _ ⟨a, ha⟩) + simp only [allocatedSiteTermDensity, hp, zero_div, mul_zero, allocatedMaskedSiteEnvelope, + allocatedIdealSiteEnvelope, ite_eq_right hs, Complex.ofReal_zero, zero_mul] + · rw [allocatedCoveredComplexProfileDensity, allocatedCoveredProfileDensity, + restrictedComplexChartDensity_zero _ _ _ _ hy, restrictedChartDensity_zero _ _ _ _ hy, + Complex.ofReal_zero, zero_mul] + +theorem allocatedCoveredSiteTerm_supported_buffered_sum + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (hsmall : ∀ j, R j ≤ allocatedBufferedPhysicalChartRadius (G := G) B α C j) + (modulus : ℕ) + (residue : ∀ j : Fin m, Matrix (BoundedBooleanJet α (j.val + 1)) + (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) + {T : Type*} [Fintype T] (c : T → ℂ) + (f : T → Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (hsupport : ∀ i s w, (∃ a, 2 * idealSiteBoxRadius α m < |w a|) → f i s w = 0) + (y : EuclideanJetLayers U jets) : + (∑ i, c i * allocatedCoveredComplexProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedSiteTermDensity B U b S x modulus residue (f i)) y) = + (allocatedCoveredProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedMaskedSiteEnvelope B U b S x modulus residue) y : ℂ) * + ∑ i, c i * ∏ s, allocatedBufferedSiteChartFactor B U b S o hb bW d + (allocatedFullSiteRadius (G := G) B α) (allocatedFullSiteRadius_pos B α) + (f i s) (coveredBooleanSiteValue U y s) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [allocatedCoveredSiteTerm_supported_buffered_factorization B U b hR hσ S x u v hb o bW d + hσ1 C hC hchart hsmall modulus residue (f i) (hsupport i) y] + ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule _root_.Set _root_.OAI.Set VectorPolynomial +open scoped Classical BigOperators NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (u : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := Fin dim) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet (Fin dim) ((j : ℕ) + 1)) +local notation "rows" => (fun j => (Subtype.val : jets j → Finset (Fin dim))) +local notation "quarter" => (fun j (_ : jets j) => standardLatticeClosedQuarterBox (J j)) + +theorem allocatedCoveredSiteTerm_supported_buffered_physical_factorization + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (hsmall : ∀ j, R j ≤ allocatedBufferedPhysicalChartRadius (G := G) B (Fin dim) C j) + (modulus : ℕ) + (residue : ∀ j : Fin m, Matrix (BoundedBooleanJet (Fin dim) (j.val + 1)) + (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) + (f : Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + (hsupport : ∀ s w, (∃ a, 2 * idealSiteBoxRadius (Fin dim) m < |w a|) → f s w = 0) + {X : Type*} (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hm : ∀ j e, coefficients (p j) e ∈ U j) + (cube : X → (Unit ⊕ Fin dim) → ℤ) : + allocatedCoveredComplexProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedSiteTermDensity B U b S x modulus residue f) (physicalCubeEuclideanSample U d p hm cube) = + (allocatedCoveredProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedMaskedSiteEnvelope B U b S x modulus residue) (physicalCubeEuclideanSample U d p hm cube) : ℂ) * + ∏ s, allocatedBufferedSiteChartFactor B U b S o hb bW d (allocatedFullSiteRadius (G := G) B (Fin dim)) + (allocatedFullSiteRadius_pos B (Fin dim)) (f s) + (physicalSingleSiteValue U d p hm (fun a => (physicalCubeVertexValue cube s a : ℝ))) := by + have h := allocatedCoveredSiteTerm_supported_buffered_factorization B U b hR hσ S x u v hb o bW d + hσ1 C hC hchart hsmall modulus residue f hsupport (physicalCubeEuclideanSample U d p hm cube) + simpa only [coveredBooleanSiteValue_physical U d p hm hp cube] using h + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedMaskedAmbientFactor.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedMaskedAmbientFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..6aaf4dd3f2da356edb82eac3d4c2bd2fb7e0bed0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedMaskedAmbientFactor.lean @@ -0,0 +1,99 @@ +import OAI.Combinatorics.Progressions.Fourier.AllocatedNormalizedTorusCutoff +import OAI.Combinatorics.Progressions.Lattices.AllocatedResidueAmbientFactor + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set +open scoped Classical BigOperators NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] (r : ℝ≥0) (hr : 0 < r) (period : ℕ) [NeZero period] + +local notation "single" => (fun _ : Fin m => Unit) +local notation "ambient" => JetAmbientIndex single J +local notation "RI" => MaskedSiteResidueIndex n E +local notation "chart" => mixedCoveredJetChart (O := single) U o b hb bW d +local notation "region" => mixedCoveredJetRegion (O := single) (E := E) U o b d + (fun j (_ : Unit) => standardLatticeClosedQuarterBox (J j)) + +theorem exists_allocated_supported_masked_ambient_factor + (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) + (label : (∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) + (f : (LayerSamplerAxis I n → ℝ) → ℂ) {L : ℝ≥0} + (hf : LipschitzWith L f) (hf1 : ∀ z, ‖f z‖ ≤ 1) : + let Lcoord := K * ∑ j, Cforward j * Fintype.card (J j) + let Lcut := (Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * Lcoord + let Lout := Lcut + max (L * Lcoord) (2 * period) + ∃ g : (RI → UnitAddCircle) × (ambient → UnitAddCircle) → ℂ, + LipschitzWith Lout g ∧ (∀ z, ‖g z‖ ≤ 1) ∧ + (∀ z, (∃ i, 1 / 4 < ‖z.2 i‖) → g z = 0) ∧ + ∀ w : MixedCoveredJetSource I single E n d, w ∈ region → + g ((fun i => (((mixedCoveredSiteResidueIntegers d w i : ℝ) / period : ℝ) : UnitAddCircle)), + coveredJetAmbientTorus U d (chart w)) = + allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label f (chart w) / 4 := by + intro Lcoord Lcut Lout + let F := fun z => f (coordinateZeroProjection (allocatedGridAxis (I := I) U b S.value) z) + have hF : LipschitzWith L F := by + simpa only [F, Function.comp_def, mul_one] using hf.comp (coordinateZeroProjection_lipschitz (allocatedGridAxis (I := I) U b S.value)) + obtain ⟨g₀, hg₀, hgb, hgv⟩ := exists_allocated_residue_ambient_factor U b o hb bW d period + hR Cforward hforward K hK label F hF (fun z => hf1 _) + let χ := allocatedBufferedTorusCutoff (R := R) U b o r hr + have hχ := allocatedBufferedTorusCutoff_range U b o r hr hR C hC hchart hbudget + have hχL : LipschitzWith Lcut χ := + allocatedBufferedTorusCutoff_lipschitz U b o r hr hR C hC hchart hbudget Cforward hforward K hK + have hχCL : LipschitzWith Lcut (fun z : (RI → UnitAddCircle) × (ambient → UnitAddCircle) => (χ z.2 : ℂ)) := by + simpa only [one_mul, mul_one, Function.comp_def] using + Complex.isometry_ofReal.lipschitzWith.comp (hχL.comp LipschitzWith.prod_snd) + have hχb (z : (RI → UnitAddCircle) × (ambient → UnitAddCircle)) : ‖(χ z.2 : ℂ)‖ ≤ (1 : ℝ≥0) := by + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hχ z.2).1] + exact (hχ z.2).2 + refine ⟨fun z => (χ z.2 : ℂ) * g₀ z, ?_, ?_, ?_, ?_⟩ + · simpa only [one_mul, mul_one, add_comm] using + lipschitz_mul_of_bounds _ _ hχCL hg₀ (Bf := 1) (Bg := 1) hχb hgb + · intro z + rw [norm_mul] + exact (mul_le_mul (hχb z) (hgb z) (norm_nonneg _) zero_le_one).trans_eq (one_mul 1) + · intro z hz + have hzero := allocatedBufferedTorusCutoff_zero_outside_quarter U b o r hr hR C hC hchart hbudget z.2 hz + change (allocatedBufferedTorusCutoff U b o r hr z.2 : ℂ) * g₀ z = 0 + rw [hzero, Complex.ofReal_zero, zero_mul] + · intro w hw + dsimp only + rw [hgv w hw, allocatedMaskedSiteChartFactor_normalized B U b S o hb bW d r hr period label f w hw] + have hsmall : ∀ i, |mixedJetAmbientPoint U b o w.1 i| < 1 / 2 := by + rintro ⟨j, t, i⟩ + exact ((hw j (mem_univ j) t (mem_univ t)).1 i).trans_lt (by norm_num) + have hχv : χ (coveredJetAmbientTorus U d (chart w)) = + normalizedCoordinateCutoff (LayerSamplerAxis I n) r hr + (allocatedFullMixedSiteValue (R := R) U b + (fun j => mixedArrayRegroup _ _ _ ((Prod.fst w) j) ())) := by + dsimp only [χ] + rw [coveredJetAmbientTorus_chart U b hb o bW d w, + allocatedBufferedTorusCutoff_local U b o r hr hR C hC hchart hbudget _ hsmall] + exact congrArg _ (allocatedFullAmbientSiteCoordinates_point U b o w.1) + rw [hχv] + dsimp only [F, bufferedCoordinateProjection] + ring + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedPhysicalSiteFactorization.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedPhysicalSiteFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..00837102043c788aafc8afd6ebf4ed2d06c25896 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedPhysicalSiteFactorization.lean @@ -0,0 +1,147 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedBufferedPhysicalFactorization +import OAI.Combinatorics.Progressions.Estimates.AllocatedCoveredSiteBuffer + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set BooleanCubeKernel +open scoped Classical BigOperators + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] (x : G → IntegerScalarCubeBox α S.value) +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := α) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet α ((j : ℕ) + 1)) +local notation "rows" => (fun j => (Subtype.val : jets j → Finset α)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit jets I n grid +local notation "quarter" => (fun j (_ : jets j) => standardLatticeClosedQuarterBox (J j)) +local notation "chart" => mixedCoveredJetChart (O := jets) U o b hb bW d +local notation "region" => mixedCoveredJetRegion (O := jets) (E := Q) U o b d quarter + +theorem allocatedCoveredSiteTerm_supported_factorization + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (hsmall : ∀ j, R j ≤ allocatedPhysicalChartRadius (G := G) B α C (allocatedSiteRootAllowance α m) j) + (modulus : ℕ) + (residue : ∀ j : Fin m, Matrix (BoundedBooleanJet α (j.val + 1)) + (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) + (f : Finset α → (LayerSamplerAxis I n → ℝ) → ℂ) + (hsupport : ∀ s w, (∃ a, 2 * idealSiteBoxRadius α m < |w a|) → f s w = 0) + (y : EuclideanJetLayers U jets) : + allocatedCoveredComplexProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedSiteTermDensity B U b S x modulus residue f) y = + (allocatedCoveredProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedMaskedSiteEnvelope B U b S x modulus residue) y : ℂ) * + ∏ s, allocatedIdealSiteChartFactor B U b S o hb bW d (f s) (coveredBooleanSiteValue U y s) := by + by_cases hy : y ∈ chart '' region + · obtain ⟨z, hz, rfl⟩ := hy + have hinj := mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) + rw [allocatedCoveredComplexProfileDensity, allocatedCoveredProfileDensity, + restrictedComplexChartDensity_apply _ _ _ _ hinj hz, + restrictedChartDensity_apply _ _ _ _ hinj hz, Complex.ofReal_one, one_mul, one_mul] + by_cases hg : allocatedGridJetDensity B U b hR hσ S x u v rows + (fun a => coefficientJetAxisEquiv jets I n z.1 a.val) = 0 + · simp only [allocatedCoveredFixedFactor, hg, zero_mul, zero_div, Complex.ofReal_zero] + · by_cases hs : ∀ s a, |allocatedIdealSiteCoordinates B U b S (split z.1).2 s a| ≤ 2 * idealSiteBoxRadius α m + · have hsites := mixedCoveredBooleanSiteValue_mem_quarter U o b d z + (fun j => C j * (((Fintype.card (I j) : ℝ) + 1) * (allocatedSiteJetSize (G := G) B α j * R j))) + (fun j => mul_nonneg (hC j) (mul_nonneg (by positivity) + (mul_nonneg (allocatedSiteJetSize_nonneg B α j) (hR j).le))) + (allocatedSiteBox_mixed_point_bound B U b hR hσ S x u v hσ1 o d z hg hs C hC hchart) + (allocatedSiteChartRadius_budget B α C hC (fun j => (hR j).le) hsmall) + rw [allocatedIdealSiteChartFactor_product B U b S o hb bW d f z hsites] + simp only [allocatedMaskedSiteEnvelope, allocatedIdealSiteEnvelope, ite_eq_left hs, + allocatedSiteTermDensity, Complex.ofReal_mul, Complex.ofReal_div, Complex.ofReal_inv] + ring + · obtain ⟨s, a, ha⟩ : ∃ s a, 2 * idealSiteBoxRadius α m < + |allocatedIdealSiteCoordinates B U b S (split z.1).2 s a| := by + simpa only [not_forall, not_le] using hs + have hp : (∏ s, f s (allocatedIdealSiteCoordinates B U b S (split z.1).2 s)) = 0 := + Finset.prod_eq_zero (Finset.mem_univ s) (hsupport s _ ⟨a, ha⟩) + simp only [allocatedSiteTermDensity, hp, zero_div, mul_zero, allocatedMaskedSiteEnvelope, + allocatedIdealSiteEnvelope, ite_eq_right hs, Complex.ofReal_zero, zero_mul] + · rw [allocatedCoveredComplexProfileDensity, allocatedCoveredProfileDensity, + restrictedComplexChartDensity_zero _ _ _ _ hy, restrictedChartDensity_zero _ _ _ _ hy, + Complex.ofReal_zero, zero_mul] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule _root_.Set _root_.OAI.Set VectorPolynomial +open scoped Classical BigOperators + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, 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 b R σ) +variable {dim : ℕ} (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable (u : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S)) +variable (v : PrincipalAxisTuples (α := Fin dim) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {Q : Fin m → Type*} [∀ j, Fintype (Q j)] +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "jets" => (fun j : Fin m => BoundedBooleanJet (Fin dim) ((j : ℕ) + 1)) +local notation "rows" => (fun j => (Subtype.val : jets j → Finset (Fin dim))) +local notation "quarter" => (fun j (_ : jets j) => standardLatticeClosedQuarterBox (J j)) + +theorem allocatedCoveredSiteTerm_supported_physical_factorization + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j w, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ C j * ‖w‖) + (hsmall : ∀ j, R j ≤ allocatedPhysicalChartRadius (G := G) B (Fin dim) C + (allocatedSiteRootAllowance (Fin dim) m) j) + (modulus : ℕ) + (residue : ∀ j : Fin m, Matrix (BoundedBooleanJet (Fin dim) (j.val + 1)) + (AllocatedNonkernelCoefficient (G := G) B j) (ZMod modulus)) + (f : Finset (Fin dim) → (LayerSamplerAxis I n → ℝ) → ℂ) + (hsupport : ∀ s w, (∃ a, 2 * idealSiteBoxRadius (Fin dim) m < |w a|) → f s w = 0) + {X : Type*} (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hm : ∀ j e, coefficients (p j) e ∈ U j) + (cube : X → (Unit ⊕ Fin dim) → ℤ) : + allocatedCoveredComplexProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedSiteTermDensity B U b S x modulus residue f) (physicalCubeEuclideanSample U d p hm cube) = + (allocatedCoveredProfileDensity B U b hR hσ S x u v rows hb o bW d quarter + (allocatedMaskedSiteEnvelope B U b S x modulus residue) (physicalCubeEuclideanSample U d p hm cube) : ℂ) * + ∏ s, allocatedIdealSiteChartFactor B U b S o hb bW d (f s) + (physicalSingleSiteValue U d p hm (fun a => (physicalCubeVertexValue cube s a : ℝ))) := by + have h := allocatedCoveredSiteTerm_supported_factorization B U b hR hσ S x u v hb o bW d + hσ1 C hC hchart hsmall modulus residue f hsupport (physicalCubeEuclideanSample U d p hm cube) + simpa only [coveredBooleanSiteValue_physical U d p hm hp cube] using h + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedPointBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedPointBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..d75e5bc260059faff432d9095b46daff3dea7b17 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedPointBudget.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedActiveResiduePointMass + +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 hsize +local notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactive +local 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)] in +noncomputable def allocatedSupportedPointApproximation + (P ε : ℝ) (M : ℕ) [NeZero M] (rows : Finset (Finset α)) (shift z : rows → ℤ) : ℂ := + 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 + (positiveModerateRetainedBias j.val rows.card ((layerTailDegree m + 1) * rows.card) + P ((torus : ℝ) / (2 * gamma)) ((torus : ℝ) ^ rows.card) ε)) + +theorem allocatedSupportedPointApproximation_error + (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) + (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⟩)) + (hε : 0 < ε) (hε1 : ε ≤ 1) (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 : ℝ) : ℂ) - + allocatedSupportedPointApproximation B U basis hR S q r j i hactive hq hsize + P ε M rows shift z‖ ≤ ε := by + have hMK : (M : ℝ) ≤ (torus : ℝ) * basisAxisScale (basis j) i := by + simp only [hM, Nat.cast_mul, le_refl] + unfold allocatedSupportedPointApproximation + 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ε.le + exact allocatedSupportedResidueSpectrum_tail B U basis hR S j i hactive q hq r hsize + hgrid A hA P hcP hsP (Nat.cast_nonneg torus) (Nat.pos_of_ne_zero (NeZero.ne M)) + hMK rows hrows hB hε hε1 + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedRecentering.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedRecentering.lean new file mode 100644 index 0000000000000000000000000000000000000000..0041871ce7b32680cd8dcb28009f049667ade0bf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedRecentering.lean @@ -0,0 +1,191 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedCoarseSource + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq 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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "sides" => allocatedPrincipalSides B U b S +local notation "fullTuple" => PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) sides + +variable (X : Type*) [Fintype X] (modulus : ℕ) (q : X → ℕ) +variable (reference : PrincipalAxisTuples (α := Fin dim) (allocatedGridAxis (I := I) U b S.value) + (allocatedPrincipalSides B U b S) → + (PrincipalTupleIndex (fun a : {a // ¬allocatedGridAxis (I := I) U b S.value a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalAxisTuples (α := Fin dim) (fun a => ¬allocatedGridAxis (I := I) U b S.value a) + (allocatedPrincipalSides B U b S)) +variable (wholeReference : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod (residueRefinedPeriod modulus q)) → + PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) (allocatedPrincipalSides B U b S)) + +local notation "refined" => residueRefinedPeriod modulus q +local notation "labels" => (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod refined) + +variable (x : G → IntegerScalarCubeBox (Fin dim) S.value) +variable [NeZero modulus] {M : ℕ} (hM : 0 < M) (selection : Fin dim ↪ G) +variable (hx : GoodScalarKernelTuple selection (1 / (M : ℝ)) M x) +variable (N : X → ℕ) {W τ ξ : ℝ} (hW : 0 ≤ W) (mesh : ℝ) (base : X → ℤ) +variable (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X q)) +variable {O : Fin m → Type*} +variable (point : (X → (Unit ⊕ Fin dim) → ℤ) → EuclideanJetLayers U O) +variable (test : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) + +local notation "window" => spatialWindow (α := Fin dim) (trimmedSpatialRootScale τ N q) 4 + +variable (hq : ∀ t, 0 < q t) (hN : ∀ t, 0 < N t) (hτ : 0 < τ) +variable (href : ∀ u r, principalResidueLabel (residueRefinedPeriod modulus q) (reference u r) = r) +variable (Q : ℝ≥0) (hQ : 1 ≤ Q) (hratio : (1 + W) / (S.value : ℝ) ≤ Q) +variable (hbudget : allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ W) +variable (hperiod : integerScalarLattice (Unit ⊕ Fin dim) (modulus : ℤ) ≤ + pivotFullImage + (selectedSpatialPivot (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns (fun g => (0 : ℤ) + (x g none : ℤ)) (scalarCubeDifferenceMatrix x) selection)) +variable (hmesh : 0 < mesh) {ε : ℝ} (hε : 0 ≤ ε) (hmargin : (3 + 2 * mesh) + 2 * ε ≤ 4) +variable (hsize : ∀ t, Fintype.card (Option (LayerSamplerVariables G I n B)) * + (2 * allocatedPhysicalEntryBudget B U b S (fun _ => 0)) ≤ ε * trimmedSpatialRootScale τ N q t) +variable (htest : ∀ v, ‖test v‖ ≤ 1) + +local notation "shiftError" => Fintype.card X * + ((modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) * + (anisotropicSpatialDensityLip selection (1 / (M : ℝ)) * Q) * (8 * mesh + ε)) * + (1 + (modulus : ℝ)^Fintype.card (Unit ⊕ Fin dim) * + anisotropicSpatialDensityCap selection (1 / (M : ℝ)))^Fintype.card X + +include hq hN hτ href hQ hratio hbudget hperiod hmesh hε hmargin hsize htest in +omit [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] in +theorem allocatedTranslatedProfileTerm_recenter_error_at + (profile : fullTuple → EuclideanJetLayers U O → ℂ) (y : fullTuple) + (hwhole : principalResidueLabel refined (wholeReference (principalResidueLabel refined y)) = + principalResidueLabel refined y) : + ‖allocatedTranslatedProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q reference wholeReference x hM selection hx N hW mesh base cells point test profile y - + allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile y‖ ≤ + shiftError * allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile y := by + let H := trimmedSpatialRootScale τ N q + let A := ∏ t, ∏ i, physicalSpatialOutputScale (Fin dim) (H t) + (trimmedSpatialSlopeScale W τ N q t) S.value i + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let K := allocatedResidueSpatialKernel B U b S x X hM selection hx modulus H hW mesh (principalResidueLabel modulus y) + let recons := allocatedWholeResidueReconstruction B U b S X modulus q wholeReference x base (principalResidueLabel refined y) + let shift := fun a : cells => allocatedResidueReferenceShift B U b S X modulus q reference wholeReference x y a.val + have hH (t) : 0 < H t := (trimmedSpatial_scales_pos hW hτ N q t (hN t) (hq t)).1 + have hA : 0 < A := Finset.prod_pos (fun t _ => Finset.prod_pos (fun i _ => + physicalSpatialOutputScale_pos (Fin dim) (hH t) + (trimmedSpatial_scales_pos hW hτ N q t (hN t) (hq t)).2 (Nat.cast_pos.mpr S.positive) i)) + have hE : 0 ≤ shiftError := by + have hκ : 0 ≤ 1 / (M : ℝ) := one_div_nonneg.mpr (Nat.cast_nonneg M) + have hLip := anisotropicSpatialDensityLip_nonneg selection hκ + have hCap := anisotropicSpatialDensityCap_nonneg selection hκ + positivity + have hcell (a : cells) : + ‖(∑ v ∈ (window).image (fun w => w + shift a), (K (v - shift a) / (A : ℂ)) * + test (recons a.val v) * profile y (point (recons a.val v))) - + ∑ v ∈ window, (K v / (A : ℂ)) * test (recons a.val v) * profile y (point (recons a.val v))‖ ≤ + (shiftError * (∑ v ∈ window, ‖profile y (point (recons a.val v))‖)) / A := by + have hnormalized := allocatedResidueReferenceShift_normalized_at B U b S X modulus q reference wholeReference x + hq href H hH hε hsize y hwhole a.val + have hlattice := (allocatedResidueReferenceShift_spec_at B U b S X modulus q reference wholeReference x + hq href base y hwhole a.val).1 + have hs : shift a ∈ spatialWindow H (2 * ε) := by + apply spatialWindow_of_coordinate_bound H (fun t => (hH t).le) hε (shift a) + intro t i + have h := (norm_le_pi_norm _ i).trans (hnormalized t) + rw [Real.norm_eq_abs, abs_div, abs_of_pos (hH t)] at h + simpa only [mul_comm] using (div_le_iff₀ (hH t)).mp h + have hglobal := allocatedResidueSpatialKernel_shift_global B U b S x X hM selection hx modulus H hW mesh + Q hQ hratio hbudget hperiod hH hmesh hε hmargin (principalResidueLabel modulus y) + (shift a) hlattice hnormalized + have hsupp := allocatedResidueSpatialKernel_zero_outside B U b S x X hM selection hx modulus H hW mesh + hbudget hH hmesh (principalResidueLabel modulus y) + have hraw := spatialWeight_shifted_window_error H (fun t => (hH t).le) K + (fun v => test (recons a.val v) * profile y (point (recons a.val v))) + (by positivity : 0 ≤ 2 * ε) hmargin hsupp (shift a) hs hglobal + have hmass : (∑ v ∈ window, ‖test (recons a.val v) * profile y (point (recons a.val v))‖) ≤ + ∑ v ∈ window, ‖profile y (point (recons a.val v))‖ := by + apply Finset.sum_le_sum + intro v _ + rw [norm_mul] + exact (mul_le_mul_of_nonneg_right (htest _) (norm_nonneg _)).trans_eq (one_mul _) + have hd := div_le_div_of_nonneg_right (hraw.trans (mul_le_mul_of_nonneg_left hmass hE)) hA.le + simpa only [div_mul_eq_mul_div, ← Finset.sum_div, ← sub_div, norm_div, + Complex.norm_real, Real.norm_of_nonneg hA.le, mul_assoc] using hd + change ‖(∑ a : cells, (selectedResidueCellWeight q cells V a : ℂ) * + ∑ v ∈ (window).image (fun w => w + shift a), (K (v - shift a) / (A : ℂ)) * + test (recons a.val v) * profile y (point (recons a.val v))) - + (∑ a : cells, (selectedResidueCellWeight q cells V a : ℂ) * + ∑ v ∈ window, (K v / (A : ℂ)) * test (recons a.val v) * profile y (point (recons a.val v)))‖ ≤ + shiftError * ∑ a : cells, selectedResidueCellWeight q cells V a * + ((∑ v ∈ window, ‖profile y (point (recons a.val v))‖) / A) + rw [← Finset.sum_sub_distrib] + simp_rw [← mul_sub] + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ a : cells, selectedResidueCellWeight q cells V a * + ((shiftError * (∑ v ∈ window, ‖profile y (point (recons a.val v))‖)) / A) := by + apply Finset.sum_le_sum + intro a _ + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (selectedResidueCellWeight_nonneg q cells V a)] + exact mul_le_mul_of_nonneg_left (hcell a) (selectedResidueCellWeight_nonneg q cells V a) + _ = _ := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + ring + +local notation "whole" => principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S) + +include hq hN hτ href hQ hratio hbudget hperiod hmesh hε hmargin hsize htest in +theorem allocatedResidueWeightedReference_recenter_error_support + (hwhole : ∀ y : fullTuple, (whole).weight y ≠ 0 → + principalResidueLabel refined (wholeReference (principalResidueLabel refined y)) = + principalResidueLabel refined y) + (profile : fullTuple → EuclideanJetLayers U O → ℂ) (Z : ℝ) (hZ : 0 < Z) : + ‖(whole).complexMean + (allocatedResidueWeightedProfileTerm (τ := τ) (ξ := ξ) + B U b S x X hM selection hx modulus q reference N hW mesh base cells point test profile) / (Z : ℂ) - + (whole).complexMean + (allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile) / (Z : ℂ)‖ ≤ + shiftError * (whole).mean + (allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile) / Z := by + rw [← sub_div, norm_div, Complex.norm_real, Real.norm_of_nonneg hZ.le] + apply div_le_div_of_nonneg_right _ hZ.le + have h := (whole).norm_complexMean_sub_le + (allocatedResidueWeightedProfileTerm (τ := τ) (ξ := ξ) + B U b S x X hM selection hx modulus q reference N hW mesh base cells point test profile) + (allocatedRecenteredProfileTerm (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x hM selection hx N hW mesh base cells point test profile) + (fun y => shiftError * allocatedRecenteredProfileMass (W := W) (τ := τ) (ξ := ξ) + B U b S X modulus q wholeReference x N base cells point profile y) + (fun y hy => by + have hwy := hwhole y hy + rw [allocatedResidueWeightedProfileTerm_translate_at B U b S X modulus q reference wholeReference x + hM selection hx N hW mesh base cells point test hq href profile y hwy] + apply allocatedTranslatedProfileTerm_recenter_error_at <;> assumption) + simpa only [FiniteProbabilityWeights.mean_const_mul] using h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedReference.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cf6a6f0859ba4f35fcaf509a4a94a3cb9dfdfd7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedReference.lean @@ -0,0 +1,47 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedLocalResidueReconstruction + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped Classical + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable {dim : ℕ} + +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "sides" => allocatedPrincipalSides B U b S +local notation "fullTuple" => PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin dim) sides + +local notation "whole" => principalTupleWeights (α := Fin dim) B (layerSamplerDegree I n) + sides (allocatedPrincipalSides_pos B U b S) + +noncomputable def allocatedSupportedWholeReference (modulus : ℕ) : + (PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod modulus) → fullTuple := + (whole).supportedFiberReference (principalResidueLabel modulus) + +theorem allocatedSupportedWholeReference_label (modulus : ℕ) (y : fullTuple) + (hy : (whole).weight y ≠ 0) : + principalResidueLabel modulus (allocatedSupportedWholeReference B U b S modulus + (principalResidueLabel modulus y)) = principalResidueLabel modulus y := + (whole).supportedFiberReference_label (principalResidueLabel modulus) y hy + +theorem allocatedSupportedWholeReference_weight (modulus : ℕ) + (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin dim) → ZMod modulus) : + (whole).weight (allocatedSupportedWholeReference B U b S modulus r) ≠ 0 := + (whole).supportedFiberReference_weight (principalResidueLabel modulus) r + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSiteApproximation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSiteApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7330c8694139ff256a4af3e54c8403fc860d4b4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSiteApproximation.lean @@ -0,0 +1,402 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedPlateauSiteApproximation +import OAI.Combinatorics.Progressions.Estimates.SitePlateauCutoff + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators Classical + +theorem real_coordinate_support_add {J : Type*} (z center : J → ℤ) {H C K : ℝ} + (hz : ∀ j, |(z j : ℝ) - center j| ≤ H * K) + (hc : ∀ j, |(center j : ℝ)| ≤ C * K) : + ∀ j, |(z j : ℝ)| ≤ (H + C) * K := by + intro j + calc + _ = |((z j : ℝ) - center j) + center j| := by congr 1; ring + _ ≤ |(z j : ℝ) - center j| + |(center j : ℝ)| := abs_add_le _ _ + _ ≤ H * K + C * K := add_le_add (hz j) (hc j) + _ = _ := by ring + +theorem pmf_bind_zero_of_support {X Y : Type*} (p : PMF X) (q : X → PMF Y) (z : Y) + (hz : ∀ x ∈ p.support, q x z = 0) : p.bind q z = 0 := by + rw [PMF.bind_apply] + apply ENNReal.tsum_eq_zero.mpr + intro x + by_cases hx : p x = 0 + · rw [hx, zero_mul] + · rw [hz x hx, mul_zero] + +theorem pmf_integral_zero_of_support {X : Type*} + [MeasurableSpace X] [MeasurableSingletonClass X] + (p : PMF X) (f : X → ℂ) (hf : ∀ x ∈ p.support, f x = 0) : + (∫ x, f x ∂p.toMeasure) = 0 := by + calc + _ = ∫ x in p.support, f x ∂p.toMeasure := by rw [p.restrict_toMeasure_support] + _ = 0 := integral_eq_zero_of_ae + ((ae_restrict_mem p.support_countable.measurableSet).mono (fun x hx => hf x hx)) + +theorem weightedModeratePlateauApproximation_zero_off_window + {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] {n K M : ℕ} [NeZero M] + (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) + (offset : B → ℤ) (hK : 0 < K) (H C : ℝ) + (rows : Finset (Finset I)) (shift z : rows → ℤ) (F : Finset (rows → Fin M)) + (hshift : ∀ t, |(shift t : ℝ)| ≤ C * K) + (hz : ¬∀ t, |(z t : ℝ)| ≤ (H + 1 / 4 + C) * K) : + weightedModeratePlateauApproximation c s offset K H rows shift z F = 0 := by + have hχ : normalizedSupportPlateau H (fun t => ((z t : ℝ) - shift t) / K) = 0 := by + by_contra hχ + exact hz (real_coordinate_support_add z shift + (normalizedSupportPlateau_grid_support hK shift z hχ) hshift) + simp only [weightedModeratePlateauApproximation, hχ, Complex.ofReal_zero, zero_mul] + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +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)] + +noncomputable def allocatedNaturalConstantRadius (j : Fin m) (i : Fin (n j)) : ℝ := + 2 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B j i) : ℝ) + 1) + +noncomputable def allocatedNaturalSupportRadius (α : Type*) [Fintype α] + (j : Fin m) (i : Fin (n j)) : ℝ := + blockJetScaleBound (Fintype.card α) (j.val + 1) (Fintype.card (B ⟨j, Sum.inr i⟩)) 4 + + 1 / 4 + allocatedNaturalConstantRadius (G := G) B j i + +omit [Fintype G] [∀ j, Fintype (I j)] in +theorem allocatedNaturalSupportRadius_nonneg (α : Type*) [Fintype α] + (j : Fin m) (i : Fin (n j)) : 0 ≤ allocatedNaturalSupportRadius (G := G) B α j i := by + have h := blockJetScaleBound_nonneg (Fintype.card α) (j.val + 1) + (Fintype.card (B ⟨j, Sum.inr i⟩)) (by norm_num : (0 : ℝ) ≤ 4) + unfold allocatedNaturalSupportRadius allocatedNaturalConstantRadius + positivity + +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) (j : Fin m) (i : Fin (n j)) +variable (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i) + +local notation "scale" => allocatedPrincipalGridScale (G := G) B U basis (R := R) j i +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) +local notation "constantLaw" => allocatedLayerIntegerPMFs B U basis hR hσ S j i + (principalCoefficientChoice (G := G) (layerSamplerDegree I n) (Sigma.mk j (Sum.inr i)) none) +local notation "constantRadius" => allocatedNaturalConstantRadius (G := G) B j i + +include hactive in +theorem allocatedNaturalConstantLaw_bound (c : ℤ) (hc : c ∈ (constantLaw).support) : + |(c : ℝ)| ≤ constantRadius * scale := by + change c ∈ (allocatedLayerIntegerPMFs B U basis hR hσ S j i (constantCoefficientSlot _ _)).support at hc + rw [allocatedLayerIntegerPMFs_constant B U basis hR hσ S j i] at hc + have hk : (0 : ℝ) < basisAxisScale (basis j) i := Nat.cast_pos.mpr (basisAxisScale_pos (basis j) i) + have hb := constantIntegerPMF_support (basisAxisScale (basis j) i) (R j / 4) hk + (div_pos (hR j) (by norm_num)) hc + have hdiv : |(c : ℝ) / basisAxisScale (basis j) i| ≤ R j / 4 := by linarith [hR j] + rw [abs_div, abs_of_pos hk] at hdiv + have he : R j / 4 = constantRadius * gamma := by + unfold allocatedNaturalConstantRadius principalProfileSize + field_simp + ring + calc + |(c : ℝ)| ≤ (R j / 4) * basisAxisScale (basis j) i := (div_le_iff₀ hk).mp hdiv + _ = constantRadius * (gamma * basisAxisScale (basis j) i) := by rw [he]; ring + _ ≤ constantRadius * scale := mul_le_mul_of_nonneg_left + (allocatedPrincipalGridScale_bounds B U basis hR S j i hactive).1 + (by unfold allocatedNaturalConstantRadius; positivity) + +variable {α : Type*} [Fintype α] [DecidableEq α] + +omit [Fintype α] in +include hactive in +theorem allocatedNaturalConstantShift_bound (c : ℤ) (hc : c ∈ (constantLaw).support) + (t : Finset α) : + |((booleanCoefficient (fun _ : Finset α => c) t : ℤ) : ℝ)| ≤ constantRadius * scale := by + rw [booleanCoefficient_const] + split_ifs + · exact allocatedNaturalConstantLaw_bound B U basis hR hσ S j i hactive c hc + · simp only [Int.cast_zero, abs_zero] + unfold allocatedNaturalConstantRadius + positivity + +variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +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 hsize +local notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactive +local notation "radius" => allocatedNaturalSupportRadius (G := G) B α j i +local notation "principalRadius" => blockJetScaleBound (Fintype.card α) (j.val + 1) + (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 4 + +include hactive hq hsize in +theorem allocatedNaturalPhysicalPoint_zero_off_window + [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] + (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))) + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) + (x : G → IntegerScalarCubeBox α S.value) (z : rows → ℤ) + (hz : ¬∀ t, |(z t : ℝ)| ≤ radius * scale) : + allocatedSupportedPhysicalGridPMF B U basis hR hσ S q r hcell j i rows x z = 0 := by + unfold allocatedSupportedPhysicalGridPMF + rw [allocatedSupportedResidueJetPMF_constant_mixture B U basis hR hσ S q r hcell j i hgrid rows x] + apply pmf_bind_zero_of_support + intro c hc + apply weightedModeratePMF_zero_off_scaled_support (fun _ : B ⟨j, Sum.inr i⟩ => csource) + sources (fun _ => 0) (by norm_num : (0 : ℝ) ≤ 4) + (allocatedActiveResidueSources_natural_volume B U basis hR S q r j i hactive hq hsize) + rows hrows (fun t => booleanCoefficient (fun _ : Finset α => c) t) z + (allocatedSupportedResidueJetPMF B U basis hR hσ S q r hcell j i rows _) + (allocatedSupportedResidueJetPMF_source B U basis hR hσ S q r hcell j i hactive hq hsize rows _) + intro hrelative + apply hz + have hglobal := real_coordinate_support_add z (fun t => booleanCoefficient (fun _ : Finset α => c) t) + hrelative (fun t => allocatedNaturalConstantShift_bound B U basis hR hσ S j i hactive c hc (t : Finset α)) + intro t + apply (hglobal t).trans + change (principalRadius + constantRadius) * (scale : ℝ) ≤ + (principalRadius + 1 / 4 + constantRadius) * (scale : ℝ) + gcongr + norm_num + +theorem allocatedNaturalPlateau_zero_off_window + (M : ℕ) [NeZero M] (rows : Finset (Finset α)) (z : rows → ℤ) (F : Finset (rows → Fin M)) + (hz : ¬∀ t, |(z t : ℝ)| ≤ radius * scale) : + allocatedConstantPlateauApproximation B U basis hR hσ S q r j i hactive hq hsize M rows z F = 0 := by + unfold allocatedConstantPlateauApproximation + apply pmf_integral_zero_of_support + intro c hc + exact weightedModeratePlateauApproximation_zero_off_window + (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources (fun _ => 0) + (allocatedPrincipalGridScale_pos B U basis hR S j i hactive) principalRadius constantRadius + rows (fun t => booleanCoefficient (fun _ : Finset α => c) t) z F + (fun t => allocatedNaturalConstantShift_bound B U basis hR hσ S j i hactive c hc (t : Finset α)) hz + +theorem allocatedBudgetedPlateau_zero_off_window (P ε : ℝ) + (M : ℕ) [NeZero M] (rows : Finset (Finset α)) (z : rows → ℤ) + (hz : ¬∀ t, |(z t : ℝ)| ≤ radius * scale) : + allocatedBudgetedPlateauApproximation B U basis hR hσ S q r j i hactive hq hsize P ε M rows z = 0 := + allocatedNaturalPlateau_zero_off_window B U basis hR hσ S j i hactive q r hq hsize M rows z _ hz + +end Erdos3.VectorPolynomial + +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 {α : Type*} [Fintype α] [DecidableEq α] + +noncomputable def allocatedNaturalSiteRadius (j : Fin m) (i : Fin (n j)) + (rows : Finset (Finset α)) : ℝ := + rows.card * allocatedNaturalSupportRadius (G := G) B α j i + +omit [Fintype G] [∀ j, Fintype (I j)] [DecidableEq α] in +theorem allocatedNaturalSiteRadius_nonneg (j : Fin m) (i : Fin (n j)) + (rows : Finset (Finset α)) : 0 ≤ allocatedNaturalSiteRadius (G := G) B j i rows := + mul_nonneg (Nat.cast_nonneg _) (allocatedNaturalSupportRadius_nonneg B α j i) + +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 (j : Fin m) (i : Fin (n j)) +variable (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i) +variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hq : 0 < q) (hsize : (Fintype.card α + 1) * q ≤ S.value) + +local notation "scale" => allocatedPrincipalGridScale (G := G) B U basis (R := R) j i + +include hactive hq hsize in +theorem allocatedNaturalPhysicalSites_bound + [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] + (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))) + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) + (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ) + (hy : ∀ t ∉ rows, booleanCoefficient y t = 0) + (hmass : allocatedSupportedPhysicalGridPMF B U basis hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t) ≠ 0) : + ∀ s, |(y s : ℝ) / scale| ≤ allocatedNaturalSiteRadius (G := G) B j i rows := by + have hcoeff : ∀ t : rows, |((booleanCoefficient y t : ℤ) : ℝ)| ≤ + allocatedNaturalSupportRadius (G := G) B α j i * scale := by + by_contra hn + exact hmass (allocatedNaturalPhysicalPoint_zero_off_window B U basis hR hσ S j i hactive q r hq hsize + hcell hgrid rows hrows x (fun t => booleanCoefficient y t) hn) + intro s + exact integer_boolean_sites_bound y rows hy + (allocatedNaturalSupportRadius_nonneg B α j i) + (Nat.cast_pos.mpr (allocatedPrincipalGridScale_pos B U basis hR S j i hactive)) + (fun t ht => hcoeff ⟨t, ht⟩) s + +include hactive hq hsize in +theorem allocatedNaturalPhysicalSites_zero_off_box + [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] + (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))) + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) + (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ) + (hy : ∀ t ∉ rows, booleanCoefficient y t = 0) + (hlarge : ∃ s, allocatedNaturalSiteRadius (G := G) B j i rows < |(y s : ℝ) / scale|) : + allocatedSupportedPhysicalGridPMF B U basis hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t) = 0 := by + by_contra hmass + obtain ⟨s, hs⟩ := hlarge + exact (not_lt_of_ge (allocatedNaturalPhysicalSites_bound B U basis hR hσ S j i hactive q r hq hsize + hcell hgrid rows hrows x y hy hmass s)) hs + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +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 → ℝ} (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 (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) +variable {M : ℕ} [NeZero M] (rows : Finset (Finset α)) (P ε : ℝ) + +local notation "scale" => allocatedPrincipalGridScale (G := G) B U basis (R := R) j i +local notation "torus" => allocatedGridTorusFactor B α (Sigma.mk j i) +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) +local notation "bias" => positiveModerateRetainedBias j.val rows.card ((layerTailDegree m + 2) * rows.card) + P (torus : ℝ) ((2 * (torus : ℝ)) ^ rows.card) ε +local notation "spectrum" => positiveModerateSpectrumCover rows M j.val P (torus : ℝ) S.value bias +local notation "cap" => allocatedGridPointCap B P (Sigma.mk j i) rows +local notation "freq" => Real.toNNReal (positiveRetainedFrequencyBound j.val rows.card P (torus : ℝ) bias) +local notation "chartRatio" => allocatedPrincipalChartRatio (G := G) B U basis (R := R) j i +local notation "supportRadius" => allocatedNaturalSiteRadius (G := G) B j i rows + +include hactive hq hsize in +theorem exists_allocated_supported_site_approximation + [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] + (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))) + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + (hgamma : gamma ≤ S.value) (L : ℝ≥0) (hL : LipschitzWith L Real.smoothTransition) + (hcP : scalarCubePrimitiveEnvelope Empty L 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α L 1 0 q ≤ P) + (hM : M = torus * scale) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) + (hB : positiveModerateSpectrumBlockCount j.val rows.card ((layerTailDegree m + 2) * rows.card) ≤ + Fintype.card (B ⟨j, Sum.inr i⟩)) + (hε : 0 < ε) (hε1 : ε ≤ 1) + {δ Q : ℝ} (hδ : 0 < δ) (hQ : 0 ≤ Q) + (hHQ : supportRadius + 1 / 4 ≤ Real.exp Q) (hδQ : (δ / (cap + 1))⁻¹ ≤ Real.exp Q) + (hLQ : ((CircleFourier.characterLipConstant * (rows.card * freq) + 4) * + (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp Q) : + ∃ D : (rows → Fin M) → ℕ, (∀ k, 0 < D k) ∧ + (∀ k ∈ spectrum, (D k : ℝ) ≤ positiveRetainedDenominatorBound j.val rows.card + ((layerTailDegree m + 2) * rows.card) P (torus : ℝ) ((2 * (torus : ℝ)) ^ rows.card) bias) ∧ + ∃ N : spectrum → ℕ, (∀ k, (N k : ℝ) ≤ Real.exp (4 * Q + 8)) ∧ + (Fintype.card (PlateauSiteIndex α spectrum N) : ℝ) ≤ + (Finset.card spectrum) * Real.exp (Fintype.card (Finset α) * (4 * Q + 8)) ∧ + ∃ (β : PlateauSiteIndex α spectrum N → ℂ) + (f : (k : PlateauSiteIndex α spectrum N) → Finset α → ZMod (D k.1) → ℝ → ℂ), + (∑ k, ‖β k‖) ≤ cap * Real.exp (Fintype.card (Finset α) * (4 * Q + 8) + Q) ∧ + (∀ k u v z, ‖f k u v z‖ ≤ 1) ∧ + (∀ k u v, LipschitzWith (⟨Real.exp (1 + 6 * Q + 12), Real.exp_nonneg _⟩ + 4) (f k u v)) ∧ + (∀ k u v z, supportRadius + 1 / 4 ≤ |z| → f k u v z = 0) ∧ + ∀ (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ), + (∀ t ∉ rows, booleanCoefficient y t = 0) → + (‖(((scale : ℝ) ^ rows.card * + (allocatedSupportedPhysicalGridPMF B U basis hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t)).toReal : ℝ) : ℂ) - + ∑ k, β k * ∏ u, f k u (y u : ZMod (D k.1)) ((y u : ℝ) / scale)‖ ≤ ε + δ) ∧ + ‖(basisAxisScale (basis j) i : ℂ) ^ rows.card * + ((allocatedSupportedPhysicalGridPMF B U basis hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t)).toReal : ℂ) - + ∑ k, ((chartRatio : ℂ) ^ rows.card * β k) * ∏ u, + f k u (y u : ZMod (D k.1)) (chartRatio * ((y u : ℝ) / basisAxisScale (basis j) i))‖ ≤ + chartRatio ^ rows.card * (ε + δ) := by + have hr : 0 ≤ supportRadius := allocatedNaturalSiteRadius_nonneg B j i rows + obtain ⟨D, hD, hDb, N, hN, hcard, β, f, hβ, hf, hLf, he⟩ := + exists_allocated_physical_site_approximation B U basis hR hσ S q r j i hactive hq hsize rows P ε + hcell hgrid hgamma L hL hcP hsP hM hrows hB hε hε1 + (H := supportRadius + 1 / 4) (by positivity) hδ hQ hHQ hδQ hLQ + let g (k : PlateauSiteIndex α spectrum N) (u : Finset α) (v : ZMod (D k.1)) (z : ℝ) : ℂ := + scalarSupportPlateau supportRadius z * f k u v z + refine ⟨D, hD, hDb, N, hN, hcard, β, g, hβ, ?_, ?_, ?_, ?_⟩ + · intro k u v z + dsimp only [g] + rw [norm_mul] + exact (mul_le_mul (scalarSupportPlateau_norm _ _) (hf k u v z) + (norm_nonneg _) zero_le_one).trans_eq (one_mul 1) + · intro k u v + exact scalarSupportPlateau_mul_lipschitz supportRadius (f k u v) (hLf k u v) (hf k u v) + · intro k u v z hz + dsimp only [g] + rw [scalarSupportPlateau_zero hz, zero_mul] + · intro x y hy + have hkeep : + (((scale : ℝ) ^ rows.card * + (allocatedSupportedPhysicalGridPMF B U basis hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t)).toReal : ℝ) : ℂ) ≠ 0 → + ∀ u, scalarSupportPlateau supportRadius ((y u : ℝ) / scale) = 1 := by + intro htarget u + have hmass : allocatedSupportedPhysicalGridPMF B U basis hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t) ≠ 0 := by + intro hz + apply htarget + simp only [hz, ENNReal.toReal_zero, mul_zero, Complex.ofReal_zero] + exact scalarSupportPlateau_one hr + (allocatedNaturalPhysicalSites_bound B U basis hR hσ S j i hactive q r hq hsize + hcell hgrid rows hrows x y hy hmass u) + have herr := finite_site_cutoff_error _ β + (fun k u => f k u (y u : ZMod (D k.1)) ((y u : ℝ) / scale)) + (fun u => scalarSupportPlateau supportRadius ((y u : ℝ) / scale)) + (show 0 ≤ ε + δ by positivity) (fun u => scalarSupportPlateau_norm _ _) hkeep + (fun hcut => (he x y (fun u => (scalarSupportPlateau_support _ _ (hcut u)).le)).1) + refine ⟨herr, ?_⟩ + have ht := grid_site_normalization_error + (K := (basisAxisScale (basis j) i : ℝ)) (N := (scale : ℝ)) + (Nat.cast_pos.mpr (basisAxisScale_pos (basis j) i)) + (Nat.cast_pos.mpr (allocatedPrincipalGridScale_pos_of_radius B U basis hR j i)) rows.card + ((allocatedSupportedPhysicalGridPMF B U basis hR hσ S q r hcell j i rows x + (fun t => booleanCoefficient y t)).toReal : ℂ) + β (fun k u z => g k u (y u : ZMod (D k.1)) z) (fun u => (y u : ℝ)) + (by simpa only [g, Complex.ofReal_mul, Complex.ofReal_pow] using herr) + simpa only [Complex.ofReal_natCast, allocatedPrincipalChartRatio] using ht + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedAccurateSource.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedAccurateSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..881e8d8196be400250e74a962baa581d702956eb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedAccurateSource.lean @@ -0,0 +1,271 @@ +import OAI.Combinatorics.Progressions.Dynamics.AllocatedCanonicalBudget +import OAI.Combinatorics.Progressions.Linear.AllocatedSupportedSlicedGoodKernelSource + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +private theorem accurateOneCubeAllRows (m : ℕ) : + ∀ (j : Fin m) (t : Finset (Fin 1)), t ∈ boundedBooleanJetRows (Fin 1) (j.val + 1) := by + intro j t + rw [boundedBooleanJetRows_oneCube (j.val + 1) (by omega)] + exact Finset.mem_univ t + +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal +attribute [local instance] ScalarSiteExpansion.termFinite + +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 [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin 1) (Fin.val j + 1)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset (Fin 1) // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowTypes j → Finset (Fin 1))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit rowTypes I n grid +local notation "baseVolume" => (allocatedFullGridNaturalVolume B U b S rowSets * + coveredJetArrayScale (O := rowTypes) U * ∏ a, allocatedLongJetOutputScale B U b S (O := rowTypes) a) + +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (q d period : ℕ) [NeZero d] [NeZero period] +variable (r : ℝ≥0) (hr : 0 < r) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "region" => mixedCoveredJetRegion (E := E) U o b d + (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr +local notation "inverseNormalizer" => ((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹ + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j : Fin m, ((boundedBooleanJetRows (Fin 1) (j.val + 1)).card + 1 : ℝ) * (Fintype.card (Finset (Fin 1)) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)))) ≤ 1 / 4) + +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (hσ : ∀ j, 0 < σ j) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (label : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin 1) → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := Fin 1) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = label))) +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell grid +local notation "gridAxes" => {a // grid a} +local notation "ideal" => allocatedSlicedRowIdeal B U b S rowSets hR (accurateOneCubeAllRows m) hB lower width + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + +include hR hC hchart hbudget in +theorem exists_allocated_supported_sliced_accurate_source + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) + (Qgrid : ℝ≥0) (hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U b S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U b S a).1 (allocatedGridIntegerAxis B U b S a).2) : ℝ) + 1) ≤ Qgrid) + (hq : 0 < q) {δg : ℝ} (hδg : 0 < δg) + (hdenseg : ∀ tg, δg * allocatedPrincipalSides B U b S tg ≤ (H tg : ℝ)) + (Tg : ℕ) (hQTg : (((Fintype.card (Fin 1) + 1) * q : ℕ) : ℝ) / δg ≤ Tg) + (hstep : ∀ tg, 0 < step tg) + (Ag : ℝ≥0) (hAg : LipschitzWith Ag Real.smoothTransition) (Pg : ℝ) (hPg : 1 ≤ Pg) + (hcP : scalarCubePrimitiveEnvelope Empty Ag 16 (128 * probabilityProfileLipschitz) 1 ≤ Pg) + (hsP : scalarCubePrimitiveEnvelope (Fin 1) Ag 1 0 q ≤ Pg) + (hstride : ∀ tg, ((step tg * q : ℕ) : ℝ) ≤ Pg) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (rowSets j).card + ((layerTailDegree m + 1) * (rowSets j).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (rowSets j).card + ((j.val + 1) * (rowSets j).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg tg pg : ℝ} + (hDg : 0 ≤ Dg) (hvg : 0 ≤ vg) (hwg : 0 ≤ wg) (htg : 0 ≤ tg) (hpg : 0 ≤ pg) + (hcube : (Fintype.card (Fin 1) : ℝ) ≤ Dg) (hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (hrowsD : ∀ j, ((rowSets j).card : ℝ) ≤ Dg) + (htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (hRv : ∀ j, R j ≤ Real.exp vg) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (hδw : δg⁻¹ ≤ Real.exp wg) (hTg : (Tg : ℝ) ≤ Real.exp tg) + (hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (hPp₀ : Pg ≤ Real.exp pg) (haxes : (Fintype.card gridAxes : ℝ) ≤ Dg) + (hσgrid : ∀ j, σ j ≤ 1) + (T : Fin m → ℝ) (hT : ∀ j, 0 ≤ T j) (h4 : ∀ j, 4 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin 1) * ((Fintype.card (Fin 1) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (hradius : ∀ j, (rowSets j).card * T j ≤ (r : ℝ)) (hσ1 : ∀ j, σ j ≤ 1) + (O : ℕ) (hO : Fintype.card (OneCubeActiveRow grid) ≤ O) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ : ℝ} (ha : 0 < a) (hδ : 0 < δ) + {Pcap : ℝ} (hPcap : 0 ≤ Pcap) (haPcap : a⁻¹ ≤ Real.exp Pcap) (hδPcap : δ⁻¹ ≤ Real.exp Pcap) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + {Pnum Pk target : ℝ} (hPnum : 0 ≤ Pnum) (hPk : 0 ≤ Pk) (htarget : 0 ≤ target) + {Mk : ℕ} (hMk : 0 < Mk) (hMkPk : (Mk : ℝ) ≤ Real.exp Pk) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) (hn : ∀ j, (n j : ℝ) ≤ Pnum) + (hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Real.exp Pnum) : + let F := (m * (2 : ℝ) ^ Fintype.card (Fin 1)) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (E j) : ℝ) * (Fintype.card (rowTypes j) * ((m + 1 : ℕ) * Pk)) + let Eg := slicedJointDensityLogBudget O m Pcap + (target + F) + 1 + let _εgrid := Real.exp (-Eg) + let p := slicedGridGeometryLog Dg vg wg tg + pg + let L := fun j : Fin m => fun e : ℝ => slicedGridSiteLog j.val (rowSets j).card + ((layerTailDegree m + 1) * (rowSets j).card) ((j.val + 1) * (rowSets j).card) Dg p e + let Cp := ∑ j, (L j 0 + Dg * (vg + 1)) + let Eg' := uniformProductAccuracyLog Dg Cp Eg + Dg * (vg + 1) + 1 + let Op := ∑ j, (siteExponentialOutputLog (Fintype.card (Finset (Fin 1))) (L j Eg') + (Dg + 1) * (vg + 1)) + let Glog := Dg * max Op 0 + let ε := Real.exp (-(Glog + (target + F) + 1)) + let P := max Pcap (Glog + (target + F) + 2) + ∃ e : gridAxes → ScalarSiteExpansion.{0,0} (Finset (Fin 1)), + (∀ a, (e a).Bounds (Real.exp Op) (Real.exp Op) (Real.exp Op) + ⟨Real.exp Op, Real.exp_nonneg _⟩ (Real.exp (slicedGridGeometryLog Dg vg wg tg + (Dg + vg + 8)))) ∧ + ∀ (x : G → IntegerScalarCubeBox (Fin 1) S.value) + (selection : Fin 1 ↪ G) + (_hx : GoodScalarKernelTuple selection (1 / (Mk : ℝ)) Mk x), + ∃ candidate : Fin Mk, + let period := kernelPeriodCandidate (m + 1) candidate + (∀ root : G → ℤ, integerScalarLattice (Unit ⊕ Fin 1) (period : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) ∧ + ∀ (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin 1) (allocatedPrincipalSides B U b S)) + (d : ℕ) [NeZero d] (_hdiv : period ∣ d) (_hqperiod : period ∣ q) + (_hu₀ : (containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell + (allocatedGridAxis (I := I) U b S.value)).weight (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) ≠ 0) + (_hy₀ : ∀ j, IntegerScalarCube (allocatedPrincipalSides B U b S j) (fun a => (y₀ j a : ℤ))), + let cutoffLip : ℝ≥0 := Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / 4 + let Q := slicedJointDensityLogBudget O m P + P + let A := Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8) + Q) + let maskCap := (layerKernelIndexBound m Mk : ℝ) ^ Fintype.card (LayerSamplerAxis I n) * coefficientDeckPeriodCap rowTypes E period + ∃ k : ℕ, (k : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + (Fintype.card (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) : ℝ) ≤ + Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8)) ∧ + ∃ (a : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → ℂ) + (f : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → Finset (Fin 1) → (LayerSamplerAxis I n → ℝ) → ℂ), + (∑ i, ‖a i‖) ≤ A ∧ + (∀ i s v, ‖f i s v‖ ≤ 1) ∧ + (∀ i s, LipschitzWith (⟨Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12), Real.exp_nonneg _⟩ + cutoffLip) (f i s)) ∧ + (∀ i s v, (∃ j, (4 : ℝ) < |v j|) → f i s v = 0) ∧ + (∑ label : Finset (Fin 1) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)), ∑ i, + ‖allocatedProductMaskedIdealCoefficient B U b S rowSets x y₀ q d period a label i‖) ≤ + ‖inverseNormalizer‖ * ((Fintype.card ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) : ℝ) ^ Fintype.card (Finset (Fin 1)) * maskCap * A) ∧ + (∀ label i s y, + ‖allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s) y‖ ≤ 1) ∧ + (∀ label i s, Measurable (allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s))) ∧ + Measurable (allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f) ∧ + (∀ y : EuclideanJetLayers U rowTypes, + ‖allocatedProductFullGridPrefactor B U b S rowSets d r hr x hb o bW q y₀ + (allocatedSlicedRowIdeal B U b S rowSets hR (accurateOneCubeAllRows m) hB lower width) y - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y‖ ≤ + ‖inverseNormalizer‖ * maskCap * ε) ∧ + (∀ y : EuclideanJetLayers U rowTypes, + ‖((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q ideal y) : ℂ) - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y * + allocatedFullGridChartModel B U b S rowSets d hb o bW e y‖ ≤ + Real.exp (-target)) ∧ + (∀ (μ : Measure (EuclideanJetLayers U rowTypes)) [IsProbabilityMeasure μ] + (φ : EuclideanJetLayers U rowTypes → ℂ), Measurable φ → (∀ y, ‖φ y‖ ≤ 1) → + ‖(∫ y, ((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q ideal y) : ℂ) * φ y ∂μ) - + ∫ y, (allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y * + allocatedFullGridChartModel B U b S rowSets d hb o bW e y) * φ y ∂μ‖ ≤ Real.exp (-target)) ∧ + ∀ {X : Type*} (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hm : ∀ j e, coefficients (poly j) e ∈ U j), + let Lcoord : ℝ≥0 := K * ∑ j, Cforward j * Fintype.card (J j) + let Llong : ℝ≥0 := (Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * Lcoord + + max ((⟨Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12), Real.exp_nonneg _⟩ + cutoffLip) * Lcoord * (Mk ^ (m + 1) : ℝ≥0)) (4 * (Mk ^ (m + 1) : ℝ≥0)) + let Lprimitive : ℝ≥0 := ⟨Real.exp Op, Real.exp_nonneg Op⟩ + let Dcap : ℝ≥0 := ⟨Dg, hDg⟩ + let Lperiod : ℝ≥0 := ⟨Real.exp (Dg * max Op 0), Real.exp_nonneg _⟩ + let Lgrid : ℝ≥0 := max (((Dcap * Lprimitive) * Qgrid) * + Lcoord * Lperiod) (4 * Lperiod) + ∃ g : (Finset (Fin 1) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period))) → + (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → (∀ a, (e a).Term) → Finset (Fin 1) → + (((JetAmbientIndex (fun _ : Fin m => Unit) J → UnitAddCircle) × ((Σ j, J j) → UnitAddCircle)) × + ((Σ j, J j) → UnitAddCircle)) → ℂ, + (∀ label i kg t, LipschitzWith (Llong + Lgrid) (g label i kg t)) ∧ + (∀ label i kg t z, ‖g label i kg t z‖ ≤ 1) ∧ + AllocatedModelPhysicalExpansionIdentity B U b S x y₀ q d period r hr hb o bW e a f poly hm g := by + intro F Eg εgrid p L Cp E' Op Glog ε P + have hF : 0 ≤ F := by dsimp only [F]; positivity + have hEg : 0 ≤ Eg := by + have hcap := slicedJointDensityLogBudget_nonneg O m hPcap + dsimp only [Eg] + linarith + obtain ⟨hg0, _, hgi, hl0, _, hli, hP, haP, hδP, hfour, _⟩ := + slicedSourceErrorBudget_of_card_le (ι := gridAxes) O m (Op := Op) hDg haxes hPcap htarget hF + (C := 0) (by norm_num) (Real.exp_nonneg F) haPcap hδPcap + obtain ⟨e, heb, he⟩ := exists_allocated_supported_sliced_good_kernel_source + B U b S q r hr hb o bW hR C hC hchart hbudget hB lower width hσ H step c hH hsubset label hcell + Cforward hforward K hK Qgrid hQgrid hq hδg hdenseg Tg hQTg hstep Ag hAg Pg hPg hcP hsP + hstride hBa hBi hDg hvg hwg htg hpg hEg hcube hdegree hrowsD htail hblocks hRv hRi hδw hTg + hcoeff hPp₀ haxes hg0 hgi.le hσgrid T hT h4 hsource hradius hσ1 O hO hwidth ha hδ hP + haP hδP hPcap haPcap hδPcap hprincipal hw hl hl0 hfour hli + refine ⟨e, heb, ?_⟩ + intro x selection hx + obtain ⟨candidate, hspatial, hsourceModel⟩ := he x hMk selection hx + refine ⟨candidate, hspatial, ?_⟩ + intro y₀ d hd hdiv hqperiod hu₀ hy₀ + let period := kernelPeriodCandidate (m + 1) candidate + obtain ⟨k, hk, hcard, a₀, f, ha₀, hf, hLf, hs, hc, hfn, hfm, hmeas, hlong, herr, hphysical⟩ := + hsourceModel y₀ d hdiv hqperiod hu₀ hy₀ + have hpref := allocatedSlicedSourceEarlyPrefactor_le_exp B U b S rowSets E hR + hPnum hI hn hcoeffEarly hRiEarly hVEarly hMkPk + (kernelPeriodCandidate_le_exp hMkPk (m + 1) candidate) + obtain ⟨_, _, _, _, _, _, _, _, _, _, herror⟩ := + slicedSourceErrorBudget_of_card_le (ι := gridAxes) O m (Op := Op) hDg haxes hPcap htarget hF + (mul_nonneg (norm_nonneg _) (mul_nonneg (pow_nonneg (Nat.cast_nonneg _) _) + (coefficientDeckPeriodCap_nonneg rowTypes E period))) hpref haPcap hδPcap + have herrSmall := fun y => (herr y).trans herror + refine ⟨k, hk, hcard, a₀, f, ha₀, hf, hLf, hs, hc, hfn, hfm, hmeas, hlong, herrSmall, ?_, ?_⟩ + · intro μ hμ φ hφ hφb + have hsm := allocatedWholeMaskedSlicedProfile_mean_measurable B U b hR hσ S rowSets + (accurateOneCubeAllRows m) x hb o bW d hB lower width gridLaw + (fun u => principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q + exact (allocatedFiniteSourceModel_test_error B U b S rowSets x y₀ q d period r hr hb o bW + μ a₀ f hLf hf e heb _ hsm herrSmall φ hφ hφb).2 + + · intro X poly hp hm Lcoord Llong Lprimitive Dcap Lperiod Lgrid + obtain ⟨g, hg, hgb, hidentity⟩ := hphysical poly hp hm + refine ⟨g, ?_, hgb, hidentity⟩ + have hcardg : (Fintype.card gridAxes : ℝ≥0) ≤ Dcap := by exact_mod_cast haxes + have hperiodg : Lprimitive ^ Fintype.card gridAxes ≤ Lperiod := by + have hreal : (Real.exp Op) ^ Fintype.card gridAxes ≤ Real.exp (Dg * max Op 0) := by + rw [← 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 haxes (le_max_right _ _)) + exact_mod_cast hreal + intro label i kg site + apply (hg label i kg site).weaken + apply add_le_add le_rfl + apply max_le_max + · apply mul_le_mul _ hperiodg zero_le zero_le + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hcardg zero_le) zero_le) zero_le + · exact mul_le_mul_of_nonneg_left hperiodg zero_le + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedInactiveFixedCap.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedInactiveFixedCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..24e0d34fef526569d7b1fc7f8d0ebf3c28c9b8da --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedInactiveFixedCap.lean @@ -0,0 +1,234 @@ +import OAI.Combinatorics.Progressions.Fourier.AllocatedSupportedSlicedInactiveSpectrum +import OAI.Combinatorics.Progressions.Lattices.IntegerGridPointCap + +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (j : Fin m) (i : Fin (n j)) + +local notation "conditioned" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H step c (allocatedPrincipalSides_pos B U basis S) hH hsubset q r hcell + +variable (hsize : ∀ b v, (Fintype.card α + 1) * q ≤ H ⟨⟨j,Sum.inr i⟩,b,v⟩) + +local notation "height" => basisAxisScale (basis j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "side" => inactiveSideLength degree height denom +local notation "cost" => (denom : ℝ) * 2 ^ degree +local notation "sources" => principalSupportedAxisSources B (layerSamplerDegree I n) H hH q hq r + (Sigma.mk j (Sum.inr i)) hsize +local notation "lower" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin degree) (a : Option α) => + ite (a = none) (c (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) 0) +local notation "strides" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin degree) (_ : Option α) => + step (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) + +local notation "radius" => blockJetScaleBound (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 +local notation "torus" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 + +include hsubset in +theorem allocatedSupportedSlicedInactiveSource_support + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) (shift : rows → ℤ) + (x : ∀ b v, IntegerScalarCubeBox α ((sources) b v).length) + (hx : (weightedCubeIntegerSource sources).weight x ≠ 0) (t : rows) : + |(affineWeightedCubeIntegerSum sources lower strides rows shift x t : ℝ) - shift t| ≤ radius * height := by + let _ : ∀ index, DecidableEq (I index) := inferInstance + have hcoord (b : B ⟨j,Sum.inr i⟩) (v : Fin degree) (a : Option α) : + |affineIntegerCubeCoordinates (lower b v) (strides b v) (fun a => (x b v a : ℤ)) a| ≤ side := by + have hb : (FiniteProbabilityWeights.pi (fun v => ((sources) b v).source)).weight (x b) ≠ 0 := + (Finset.prod_ne_zero_iff.mp hx) b (Finset.mem_univ b) + have hprod : (∏ v, ((sources) b v).source.weight (x b v)) ≠ 0 := hb + have hv := (Finset.prod_ne_zero_iff.mp hprod) v (Finset.mem_univ v) + have he : allocatedPrincipalSides B U basis S ⟨⟨j,Sum.inr i⟩,b,v⟩ = side := by + rw [layerIntegerPrincipalSlots_card] + change integerAxisSideLength degree height S.value + (principalProfileSize (R j) (Fintype.card (B ⟨j,Sum.inr i⟩))) = _ + simp only [integerAxisSideLength, Nat.not_lt.mpr hsmall, ite_false] + have hbnd := containedProgressionCoordinate_bound (c ⟨⟨j,Sum.inr i⟩,b,v⟩) + (hsubset ⟨⟨j,Sum.inr i⟩,b,v⟩) (x b v) (((sources) b v).source_cube _ hv) a + rw [he] at hbnd + exact hbnd + have hvol : (side : ℝ) ^ degree ≤ 1 * (height : ℝ) := by + rw [one_mul] + exact_mod_cast (inactiveSideLength_power (Nat.zero_lt_succ _) hlarge).trans (Nat.div_le_self _ _) + exact affineWeightedCubeIntegerSum_box_bound sources lower strides side rows hrows + zero_le_one (Nat.cast_nonneg _) hvol shift x hcoord t + +theorem allocatedSupportedSlicedInactivePointApproximation_error + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + {δ : ℝ} (hδ : 0 < δ) + (hlength : ∀ b v, δ * side ≤ (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) + (hstep : ∀ b v, 0 < step ⟨⟨j,Sum.inr i⟩,b,v⟩) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) (hP : 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hstride : ∀ b v, ((step ⟨⟨j,Sum.inr i⟩,b,v⟩ * q : ℕ) : ℝ) ≤ P) + {ε : ℝ} {M : ℕ} [NeZero M] (hM : M = torus * height) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hB : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (hε : 0 < ε) (hε1 : ε ≤ 1) : + let V := (torus : ℝ) * cost / δ ^ degree + let t := degree * rows.card + let W := ((torus : ℝ) * cost) ^ rows.card / δ ^ t + let ζ := uniformBlockRetainedBias j.val rows.card t P V W ε + let F := uniformBlockSpectrumCover rows M j.val P V (δ * side) ζ + (F.card : ℝ) ≤ uniformSpectrumSizeConstant j.val rows.card t P V W / + ε ^ max (majorArcSpectrumExponent j.val rows.card) (majorArcLengthExponent j.val * t) ∧ + (∑ k, ‖∏ b, affineWeightedCubeGridCoefficient (sources b) + (fun v a => (lower b v a : ℝ)) (strides b) M rows k‖) ≤ + uniformSpectrumAbsoluteCap j.val rows.card t P V W ∧ + ∀ shift z : rows → ℤ, + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedSlicedResidueJetPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows shift z).toReal : ℝ) : ℂ) - + (normalizedSupportPlateau radius (fun t => ((z t : ℝ) - shift t) / height) : ℂ) * + integerGridApproximation (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) height M F z‖ ≤ + ε := by + intro V t W ζ F + have hMK : (M : ℝ) ≤ (torus : ℝ) * height := by simp only [hM, Nat.cast_mul, le_refl] + obtain ⟨hF, hcap, he⟩ := allocatedSupportedSlicedInactiveGridDensity_approximation B U basis hR hσ S q hq r H step c + hH hsubset hcell j i hsize hsmall hlarge hδ hlength hstep A hA P hP hsP hstride + (Nat.cast_nonneg torus) hMK rows hrows hB hε hε1 + refine ⟨hF, hcap, fun shift z => ?_⟩ + have hlaw := allocatedSupportedSlicedInactiveResidueJetPMF_source B U basis hR hσ S q hq r H step c + hH hsubset hcell j i hsmall hlarge hsize rows shift + have hd := integerGridDensity_eq_of_pmf_image (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) _ hlaw height M z + have hd' : integerGridDensity (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) height M z = + allocatedSupportedSlicedGridDensity B U basis hR hσ S q r H step c hH hsubset hcell j i M rows shift z := by + simpa only [allocatedSupportedSlicedGridDensity, Fintype.card_coe] using hd + have hscale : ((height : ℝ) / M) ^ rows.card ≤ 1 := by + rw [hM, Nat.cast_mul] + exact grid_scale_factor_le_one _ _ _ (blockTorusFactor_pos _ _ _ _) (basisAxisScale_pos (basis j) i) + have he' := (he shift z).trans (mul_le_of_le_one_left hε.le hscale) + rw [← hd'] at he' + have hp := integerGridDensity_plateau_transfer (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) shift z + (blockJetScaleBound_nonneg _ _ _ zero_le_one) (basisAxisScale_pos (basis j) i) hM + (fun x hx t => allocatedSupportedSlicedInactiveSource_support B U basis S q hq r H step c hH hsubset + j i hsize hsmall hlarge rows hrows shift x hx t) _ hε.le he' + simpa only [hlaw, Fintype.card_coe] using hp + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (j : Fin m) (i : Fin (n j)) + +local notation "conditioned" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H step c (allocatedPrincipalSides_pos B U basis S) hH hsubset q r hcell + +variable (hsize : ∀ b v, (Fintype.card α + 1) * q ≤ H ⟨⟨j,Sum.inr i⟩,b,v⟩) + +local notation "height" => basisAxisScale (basis j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "side" => inactiveSideLength degree height denom +local notation "cost" => (denom : ℝ) * 2 ^ degree +local notation "sources" => principalSupportedAxisSources B (layerSamplerDegree I n) H hH q hq r + (Sigma.mk j (Sum.inr i)) hsize +local notation "lower" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin degree) (a : Option α) => + ite (a = none) (c (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) 0) +local notation "strides" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin degree) (_ : Option α) => + step (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) + +local notation "radius" => blockJetScaleBound (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 +local notation "torus" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 + +include hq hsize in + +theorem allocatedSupportedSlicedInactiveResidueJetPMF_norm_le + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + {δ : ℝ} (hδ : 0 < δ) + (hlength : ∀ b v, δ * side ≤ (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) + (hstep : ∀ b v, 0 < step ⟨⟨j,Sum.inr i⟩,b,v⟩) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) (hP : 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hstride : ∀ b v, ((step ⟨⟨j,Sum.inr i⟩,b,v⟩ * q : ℕ) : ℝ) ≤ P) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hB : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (shift z : rows → ℤ) : + let V := (torus : ℝ) * cost / δ ^ degree + let t := degree * rows.card + let W := ((torus : ℝ) * cost) ^ rows.card / δ ^ t + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedSlicedResidueJetPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows shift z).toReal : ℝ) : ℂ)‖ ≤ + uniformSpectrumAbsoluteCap j.val rows.card t P V W := by + intro V t W + let M := torus * height + have hM : 0 < M := Nat.mul_pos (blockTorusFactor_pos _ _ _ _) (basisAxisScale_pos (basis j) i) + let _ : NeZero M := ⟨hM.ne'⟩ + have hMK : (M : ℝ) ≤ (torus : ℝ) * height := by simp only [M, Nat.cast_mul, le_refl] + have hKM : height ≤ M := Nat.le_mul_of_pos_left _ (blockTorusFactor_pos _ _ _ _) + obtain ⟨_,hcap,_⟩ := allocatedSupportedSlicedInactiveGridDensity_approximation B U basis hR hσ S q hq r H step c + hH hsubset hcell j i hsize hsmall hlarge hδ hlength hstep A hA P hP hsP hstride + (Nat.cast_nonneg torus) hMK rows hrows hB zero_lt_one le_rfl + have hcap0 : 0 ≤ uniformSpectrumAbsoluteCap j.val rows.card t P V W := + (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hcap + have hscale : ((height : ℝ) / M) ^ rows.card ≤ 1 := + pow_le_one₀ (by positivity) ((div_le_one (Nat.cast_pos.mpr hM)).mpr (Nat.cast_le.mpr hKM)) + have hp := integerPointDensity_norm_le_fourier_sum (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) height M z + rw [allocatedSupportedSlicedInactiveResidueJetPMF_source B U basis hR hσ S q hq r H step c hH hsubset hcell + j i hsmall hlarge hsize rows shift] at hp + have heq (k : rows → Fin M) := affineWeightedCubeIntegerSum_coefficient + sources lower strides M rows shift k + simp_rw [heq, norm_mul, rectangularGridCharacter_norm, one_mul] at hp + simp only [Fintype.card_coe] at hp + exact hp.trans ((mul_le_mul_of_nonneg_left hcap (by positivity)).trans + (mul_le_of_le_one_left hcap0 hscale)) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedInactiveSource.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedInactiveSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..62c069a0ef986937d974c48d191655805baf7006 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedInactiveSource.lean @@ -0,0 +1,75 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedInactiveResidueScale +import OAI.Combinatorics.Progressions.Lattices.AllocatedSupportedSlicedResidueJet + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (j : Fin m) (i : Fin (n j)) + +local notation "conditioned" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H step c (allocatedPrincipalSides_pos B U basis S) hH hsubset q r hcell + +theorem allocatedSupportedSlicedInactiveResidueJetPMF_source + (hsmall : basisAxisScale (basis j) i ≤ S.value ^ (j.val + 1)) + (hlarge : 2 * inactiveDenominator + (principalProfileSize (R j) (layerIntegerPrincipalSlots (G := G) B j i).card) ≤ basisAxisScale (basis j) i) + (hsize : ∀ b v, (Fintype.card α + 1) * q ≤ H ⟨⟨j,Sum.inr i⟩,b,v⟩) + (rows : Finset (Finset α)) (shift : rows → ℤ) : + let sources := principalSupportedAxisSources B (layerSamplerDegree I n) H hH q hq r ⟨j,Sum.inr i⟩ hsize + let lower := fun (b : B ⟨j,Sum.inr i⟩) (v : Fin (j.val + 1)) (a : Option α) => + if a = none then c ⟨⟨j,Sum.inr i⟩,b,v⟩ else 0 + let strides := fun (b : B ⟨j,Sum.inr i⟩) (v : Fin (j.val + 1)) (_ : Option α) => step ⟨⟨j,Sum.inr i⟩,b,v⟩ + (weightedCubeIntegerSource sources).toPMF.map (affineWeightedCubeIntegerSum sources lower strides rows shift) = + allocatedSupportedSlicedResidueJetPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows shift := by + intro sources lower strides + have hcoeff : (dependentProductPMF (fun a : B ⟨j, Sum.inr i⟩ => + allocatedLayerIntegerPMFs B U basis hR hσ S j i + (principalCoefficientSlot (G := G) (layerSamplerDegree I n) ⟨j, Sum.inr i⟩ a))) = + PMF.pure (fun _ : B ⟨j, Sum.inr i⟩ => (1 : ℤ)) := by + ext c + rw [dependentProductPMF_apply] + simp_rw [allocatedInactivePrincipalPMF B U basis S j i hR hσ hsmall, inactivePrincipal_large hlarge] + by_cases hc : c = fun _ => (1 : ℤ) + · subst c + simp + · obtain ⟨a, ha⟩ : ∃ a, c a ≠ 1 := by + by_contra hn + apply hc + funext a + exact not_not.mp (fun h => hn ⟨a, h⟩) + rw [PMF.pure_apply_of_ne _ _ hc] + exact Finset.prod_eq_zero (Finset.mem_univ a) (PMF.pure_apply_of_ne _ _ ha) + unfold allocatedSupportedSlicedResidueJetPMF + rw [hcoeff, PMF.pure_bind] + simp only [one_mul] + exact containedSupportedProgressionLaw_unit_block_law B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H step c (allocatedPrincipalSides_pos B U basis S) + hH hsubset q hq r hcell ⟨j,Sum.inr i⟩ hsize rows shift + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedNaturalCap.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedNaturalCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2484bb7a32bc8365b1d4b2ba07118486b2c91a3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedNaturalCap.lean @@ -0,0 +1,371 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedSlicedGridGeometryBudget +import OAI.Combinatorics.Progressions.Sampling.AllocatedSupportedSlicedInactiveGridSite + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).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 (hsize : ∀ b v, (Fintype.card α + 1) * q ≤ H ⟨⟨j,Sum.inr i⟩,b,v⟩) + +local notation "coeff" => (fun _ : B (Sigma.mk j (Sum.inr i)) => + allocatedPrincipalNormalizedSource B U basis hR S j i hactive) +local notation "sources" => principalSupportedAxisSources B (layerSamplerDegree I n) H hH q hq r + (Sigma.mk j (Sum.inr i)) hsize +local notation "lower" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin (Fin.val j + 1)) (a : Option α) => + ite (a = none) (c (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) 0) +local notation "strides" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin (Fin.val j + 1)) (_ : Option α) => + step (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +local notation "radius" => blockJetScaleBound (Fintype.card α) (Fin.val j + 1) + (Fintype.card (B (Sigma.mk j (Sum.inr i)))) (4 * gamma) +local notation "height" => basisAxisScale (basis j) i +local notation "torus" => blockTorusFactor (Fintype.card α) (Fin.val j + 1) + (Fintype.card (B (Sigma.mk j (Sum.inr i)))) (4 * gamma) + +local notation "conditioned" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H step c (allocatedPrincipalSides_pos B U basis S) hH hsubset q r hcell +local notation "constantLaw" => allocatedLayerIntegerPMFs B U basis hR hσ S j i + (principalCoefficientChoice (G := G) (layerSamplerDegree I n) (Sigma.mk j (Sum.inr i)) none) + +include hq hactive hsize in +theorem allocatedSupportedSlicedPhysicalGridPMF_norm_le + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + {δ : ℝ} (hδ : 0 < δ) + (hlength : ∀ b v, δ * S.value ≤ (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) + (hstep : ∀ b v, 0 < step ⟨⟨j,Sum.inr i⟩,b,v⟩) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) + (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hstride : ∀ b v, ((step ⟨⟨j,Sum.inr i⟩,b,v⟩ * q : ℕ) : ℝ) ≤ P) + {C : ℝ} {M : ℕ} [NeZero M] (hC : 0 ≤ C) + (hMK : (M : ℝ) ≤ C * basisAxisScale (basis j) i) + (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⟩)) + (hKM : height ≤ M) (x : G → IntegerScalarCubeBox α S.value) (z : rows → ℤ) : + let V := (C / (2 * gamma)) / δ ^ (j.val + 1) + let t := (layerTailDegree m + 1) * rows.card + let W := C ^ rows.card / δ ^ t + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedSlicedPhysicalGridPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows x z).toReal : ℝ) : ℂ)‖ ≤ + positiveModerateSpectrumCardBudget j.val rows.card t P V W 1 + 1 := by + intro V t W + have hcap := allocatedSupportedSlicedGridDensity_absolute_cap B U basis hR S q hq r H step c hH + j i hactive hsize hgrid hδ hlength hstep A hA P hcP hsP hstride hC hMK rows hrows hB + have hcap0 : 0 ≤ positiveModerateSpectrumCardBudget j.val rows.card t P V W 1 + 1 := + (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hcap + have hscale : ((height : ℝ) / M) ^ rows.card ≤ 1 := + pow_le_one₀ (by positivity) ((div_le_one (Nat.cast_pos.mpr (Nat.pos_of_ne_zero (NeZero.ne M)))).mpr + (Nat.cast_le.mpr hKM)) + have hpoint (shift : rows → ℤ) : + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedSlicedResidueJetPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows shift z).toReal : ℝ) : ℂ)‖ ≤ + positiveModerateSpectrumCardBudget j.val rows.card t P V W 1 + 1 := by + have hp := integerPointDensity_norm_le_fourier_sum (weightedModerateIntegerProductSource coeff sources) + (weightedAffineModerateIntegerJetSum coeff sources lower strides rows (fun _ => 0) shift) height M z + rw [allocatedSupportedSlicedResidueJetPMF_source B U basis hR hσ S q hq r H step c hH hsubset hcell + j i hactive hsize rows shift] at hp + have heq (k : rows → Fin M) := weightedAffineModerateIntegerJetSum_coefficient + coeff sources lower strides M rows (fun _ => 0) shift k + simp_rw [heq, norm_mul, rectangularGridCharacter_norm, one_mul] at hp + simp only [Fintype.card_coe, Int.cast_zero] at hp + exact hp.trans ((mul_le_mul_of_nonneg_left hcap (by positivity)).trans + (mul_le_of_le_one_left hcap0 hscale)) + unfold allocatedSupportedSlicedPhysicalGridPMF + rw [allocatedSupportedSlicedResidueJetPMF_constant_mixture B U basis hR hσ S q r H step c hH hsubset hcell + j i hgrid rows x] + exact pmf_bind_point_norm_le _ _ _ _ z (fun zeta => hpoint (fun t => booleanCoefficient (fun _ : Finset α => zeta) t)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (j : Fin m) (i : Fin (n j)) + +local notation "conditioned" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H step c (allocatedPrincipalSides_pos B U basis S) hH hsubset q r hcell + +variable (hsize : ∀ b v, (Fintype.card α + 1) * q ≤ H ⟨⟨j,Sum.inr i⟩,b,v⟩) + +local notation "height" => basisAxisScale (basis j) i +local notation "degree" => Fin.val j + 1 +local notation "denom" => inactiveDenominator + (principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))) +local notation "side" => inactiveSideLength degree height denom +local notation "cost" => (denom : ℝ) * 2 ^ degree +local notation "sources" => principalSupportedAxisSources B (layerSamplerDegree I n) H hH q hq r + (Sigma.mk j (Sum.inr i)) hsize +local notation "lower" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin degree) (a : Option α) => + ite (a = none) (c (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) 0) +local notation "strides" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin degree) (_ : Option α) => + step (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) + +local notation "radius" => blockJetScaleBound (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 +local notation "torus" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 + +local notation "constantLaw" => allocatedLayerIntegerPMFs B U basis hR hσ S j i + (principalCoefficientChoice (G := G) (layerSamplerDegree I n) (Sigma.mk j (Sum.inr i)) none) + +include hq hsize in +theorem allocatedSupportedSlicedInactivePhysicalGridPMF_norm_le + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j,Sum.inr i⟩) + (hsmall : height ≤ S.value ^ degree) (hlarge : 2 * denom ≤ height) + {δ : ℝ} (hδ : 0 < δ) + (hlength : ∀ b v, δ * side ≤ (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) + (hstep : ∀ b v, 0 < step ⟨⟨j,Sum.inr i⟩,b,v⟩) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) (hP : 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hstride : ∀ b v, ((step ⟨⟨j,Sum.inr i⟩,b,v⟩ * q : ℕ) : ℝ) ≤ P) + {C : ℝ} {M : ℕ} [NeZero M] (hC : 0 ≤ C) (hMK : (M : ℝ) ≤ C * height) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hB : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) + (hKM : height ≤ M) (x : G → IntegerScalarCubeBox α S.value) (z : rows → ℤ) : + let V := C * cost / δ ^ degree + let t := degree * rows.card + let W := (C * cost) ^ rows.card / δ ^ t + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedSlicedPhysicalGridPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows x z).toReal : ℝ) : ℂ)‖ ≤ + uniformSpectrumAbsoluteCap j.val rows.card t P V W := by + intro V t W + obtain ⟨_,hcap,_⟩ := allocatedSupportedSlicedInactiveGridDensity_approximation B U basis hR hσ S q hq r H step c + hH hsubset hcell j i hsize hsmall hlarge hδ hlength hstep A hA P hP hsP hstride hC hMK rows hrows hB + zero_lt_one le_rfl + have hcap0 : 0 ≤ uniformSpectrumAbsoluteCap j.val rows.card t P V W := + (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hcap + have hscale : ((height : ℝ) / M) ^ rows.card ≤ 1 := + pow_le_one₀ (by positivity) ((div_le_one (Nat.cast_pos.mpr (Nat.pos_of_ne_zero (NeZero.ne M)))).mpr + (Nat.cast_le.mpr hKM)) + have hpoint (shift : rows → ℤ) : + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedSlicedResidueJetPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows shift z).toReal : ℝ) : ℂ)‖ ≤ + uniformSpectrumAbsoluteCap j.val rows.card t P V W := by + have hp := integerPointDensity_norm_le_fourier_sum (weightedCubeIntegerSource sources) + (affineWeightedCubeIntegerSum sources lower strides rows shift) height M z + rw [allocatedSupportedSlicedInactiveResidueJetPMF_source B U basis hR hσ S q hq r H step c hH hsubset hcell + j i hsmall hlarge hsize rows shift] at hp + have heq (k : rows → Fin M) := affineWeightedCubeIntegerSum_coefficient + sources lower strides M rows shift k + simp_rw [heq, norm_mul, rectangularGridCharacter_norm, one_mul] at hp + simp only [Fintype.card_coe] at hp + exact hp.trans ((mul_le_mul_of_nonneg_left hcap (by positivity)).trans + (mul_le_of_le_one_left hcap0 hscale)) + unfold allocatedSupportedSlicedPhysicalGridPMF + rw [allocatedSupportedSlicedResidueJetPMF_constant_mixture B U basis hR hσ S q r H step c hH hsubset hcell + j i hgrid rows x] + exact pmf_bind_point_norm_le _ _ _ _ z (fun zeta => hpoint (fun t => booleanCoefficient (fun _ : Finset α => zeta) t)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (j : Fin m) (i : Fin (n j)) + +local notation "height" => basisAxisScale (basis j) i +local notation "degree" => Fin.val j + 1 +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) +local notation "denom" => inactiveDenominator gamma +local notation "side" => inactiveSideLength degree height denom +local notation "cost" => (denom : ℝ) * 2 ^ degree +local notation "torusA" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) (4 * gamma) +local notation "torusI" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 + +noncomputable def allocatedSlicedGridPointCap (δ P : ℝ) (T d : ℕ) : ℝ := + max 1 (max ((allocatedSlicedGridHeightCutoff (G := G) B (R := R) j i T : ℝ) ^ d) + (max + (positiveModerateSpectrumCardBudget j.val d ((layerTailDegree m + 1) * d) P + (((torusA : ℝ) / (2 * gamma)) / δ ^ degree) ((torusA : ℝ) ^ d / δ ^ ((layerTailDegree m + 1) * d)) 1 + 1) + (uniformSpectrumAbsoluteCap j.val d (degree * d) P + ((torusI : ℝ) * cost / δ ^ degree) (((torusI : ℝ) * cost) ^ d / δ ^ (degree * d))))) + +include hq in +theorem allocatedSupportedSlicedPhysicalGridPMF_uniform_norm_le + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j,Sum.inr i⟩) + {δ : ℝ} (hδ : 0 < δ) + (hdense : ∀ b v, δ * allocatedPrincipalSides B U basis S ⟨⟨j,Sum.inr i⟩,b,v⟩ ≤ + (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) + (T : ℕ) (hQT : (((Fintype.card α + 1) * q : ℕ) : ℝ) / δ ≤ T) + (hstep : ∀ b v, 0 < step ⟨⟨j,Sum.inr i⟩,b,v⟩) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) (hP : 1 ≤ P) + (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hstride : ∀ b v, ((step ⟨⟨j,Sum.inr i⟩,b,v⟩ * q : ℕ) : ℝ) ≤ P) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hBa : positiveModerateSpectrumBlockCount j.val rows.card + ((layerTailDegree m + 1) * rows.card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (x : G → IntegerScalarCubeBox α S.value) (z : rows → ℤ) : + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedSlicedPhysicalGridPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows x z).toReal : ℝ) : ℂ)‖ ≤ + allocatedSlicedGridPointCap (G := G) (α := α) B (R := R) j i δ P T rows.card := by + rcases allocatedSlicedGrid_cases B U basis S j i H hgrid hδ hdense + ((Fintype.card α + 1) * q) T hQT with hsmall | ⟨hsize, hcases⟩ + · have hprob : (allocatedSupportedSlicedPhysicalGridPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows x z).toReal ≤ 1 := + (ENNReal.toReal_mono ENNReal.one_ne_top (PMF.coe_le_one _ _)).trans_eq ENNReal.toReal_one + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by positivity)] + have hb := (mul_le_of_le_one_right (pow_nonneg (Nat.cast_nonneg _) _) hprob).trans + (pow_le_pow_left₀ (Nat.cast_nonneg _) (Nat.cast_le.mpr hsmall) rows.card) + exact hb.trans ((le_max_left _ _).trans (le_max_right _ _)) + · rcases hcases with ⟨ha, hlength⟩ | ⟨hi, hl, hlength⟩ + · let M := torusA * height + have hM : 0 < M := Nat.mul_pos (blockTorusFactor_pos _ _ _ _) (basisAxisScale_pos (basis j) i) + let : NeZero M := ⟨hM.ne'⟩ + have hMK : (M : ℝ) ≤ (torusA : ℝ) * height := by simp only [M, Nat.cast_mul, le_refl] + have hp := allocatedSupportedSlicedPhysicalGridPMF_norm_le B U basis hR hσ S q hq r H step c hH hsubset hcell + j i ha hsize hgrid hδ hlength hstep A hA P hcP hsP hstride (Nat.cast_nonneg torusA) hMK rows hrows hBa + (Nat.le_mul_of_pos_left _ (blockTorusFactor_pos _ _ _ _)) x z + exact hp.trans ((le_max_left _ _).trans ((le_max_right _ _).trans (le_max_right _ _))) + · let M := torusI * height + have hM : 0 < M := Nat.mul_pos (blockTorusFactor_pos _ _ _ _) (basisAxisScale_pos (basis j) i) + let : NeZero M := ⟨hM.ne'⟩ + have hMK : (M : ℝ) ≤ (torusI : ℝ) * height := by simp only [M, Nat.cast_mul, le_refl] + have hp := allocatedSupportedSlicedInactivePhysicalGridPMF_norm_le B U basis hR hσ S q hq r H step c hH hsubset hcell + j i hsize hgrid hi hl hδ hlength hstep A hA P hP hsP hstride (Nat.cast_nonneg torusI) hMK rows hrows hBi + (Nat.le_mul_of_pos_left _ (blockTorusFactor_pos _ _ _ _)) x z + exact hp.trans ((le_max_right _ _).trans ((le_max_right _ _).trans (le_max_right _ _))) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (j : Fin m) (i : Fin (n j)) + +local notation "height" => basisAxisScale (basis j) i +local notation "degree" => Fin.val j + 1 +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) +local notation "denom" => inactiveDenominator gamma +local notation "side" => inactiveSideLength degree height denom +local notation "cost" => (denom : ℝ) * 2 ^ degree +local notation "torusA" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) (4 * gamma) +local notation "torusI" => blockTorusFactor (Fintype.card α) degree (Fintype.card (B (Sigma.mk j (Sum.inr i)))) 1 + +include hq in +theorem allocatedSupportedSlicedPhysicalGridPMF_natural_norm_le + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j,Sum.inr i⟩) + {δ : ℝ} (hδ : 0 < δ) + (hdense : ∀ b v, δ * allocatedPrincipalSides B U basis S ⟨⟨j,Sum.inr i⟩,b,v⟩ ≤ + (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) + (T : ℕ) (hQT : (((Fintype.card α + 1) * q : ℕ) : ℝ) / δ ≤ T) + (hstep : ∀ b v, 0 < step ⟨⟨j,Sum.inr i⟩,b,v⟩) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) (hP : 1 ≤ P) + (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hstride : ∀ b v, ((step ⟨⟨j,Sum.inr i⟩,b,v⟩ * q : ℕ) : ℝ) ≤ P) + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ degree) + (hBa : positiveModerateSpectrumBlockCount j.val rows.card + ((layerTailDegree m + 1) * rows.card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : uniformSpectrumBlockCount j.val rows.card (degree * rows.card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (x : G → IntegerScalarCubeBox α S.value) (z : rows → ℤ) : + ‖(((allocatedPrincipalGridScale (G := G) B U basis (R := R) j i : ℝ) ^ rows.card * + (allocatedSupportedSlicedPhysicalGridPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows x z).toReal : ℝ) : ℂ)‖ ≤ + (gamma + 1) ^ rows.card * allocatedSlicedGridPointCap (G := G) (α := α) B (R := R) j i δ P T rows.card := by + have h := allocatedSupportedSlicedPhysicalGridPMF_uniform_norm_le + B U basis hR hσ S q hq r H step c hH hsubset hcell j i hgrid hδ hdense T hQT hstep + A hA P hP hcP hsP hstride rows hrows hBa hBi x z + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by positivity)] at h ⊢ + exact ceilGridScale_mass_bound height rows.card (basisAxisScale_pos (basis j) i) + (principalProfileSize_pos (hR j) _) ENNReal.toReal_nonneg + (le_trans zero_le_one (le_max_left _ _)) h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedNaturalSiteError.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedNaturalSiteError.lean new file mode 100644 index 0000000000000000000000000000000000000000..67dea50c9bb05caf8bb90dca9c478e6923acadcd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedNaturalSiteError.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Sampling.AllocatedClippedFullGridGlobal + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +universe uα + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "gridAxes" => {a // allocatedGridAxis (I := I) U b S.value a} +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "axisN" => allocatedGridNaturalScale B U b S +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset α)) + +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell grid +local notation "height" => (fun a : gridAxes => basisAxisScale (b (Sigma.fst (ig a))) (Sigma.snd (ig a))) + +theorem allocatedSupportedSlicedFullGridNaturalSite_error + (e : gridAxes → ScalarSiteExpansion.{uα,uα} (Finset α)) {C δ : ℝ} (hC : 0 ≤ C) (hδ : 0 < δ) + (hcap : ∀ a (x : G → IntegerScalarCubeBox α S.value) z, + ‖(((axisN a : ℝ) ^ (rowSets (ig a).1).card * + (allocatedSupportedSlicedPhysicalGridPMF B U b hR hσ S q r H step c hH hsubset hcell + (ig a).1 (ig a).2 (rowSets (ig a).1) x z).toReal : ℝ) : ℂ)‖ ≤ C) + (he : ∀ a (x : G → IntegerScalarCubeBox α S.value) (y : Finset α → ℤ), + (∀ t ∉ rowSets (ig a).1, booleanCoefficient y t = 0) → + ‖(((axisN a : ℝ) ^ (rowSets (ig a).1).card * + (allocatedSupportedSlicedPhysicalGridPMF B U b hR hσ S q r H step c hH hsubset hcell + (ig a).1 (ig a).2 (rowSets (ig a).1) x (fun t => booleanCoefficient y t)).toReal : ℝ) : ℂ) - + (e a).integerEval (axisN a) y‖ ≤ uniformProductAccuracy (Fintype.card gridAxes) C δ) + (x : G → IntegerScalarCubeBox α S.value) (z : AllocatedFrozenJetRows B U b S rowTypes) : + ‖(allocatedFullGridNaturalVolume B U b S rowSets : ℂ) * + (allocatedSupportedSlicedFullGridDensity B U b hR hσ S rowSets H step c hH hsubset q r hcell x z : ℂ) - + allocatedFullGridSiteApproximation B U b S rowSets e z‖ ≤ δ := by + let y := allocatedFullGridSiteValues B U b S rowSets z + have hc (a : gridAxes) (t : rowSets (ig a).1) : + booleanCoefficient (fun s => y s a) t.val = allocatedGridIntegerValues B U b S rowSets a (z a) t := + integerBooleanSitesFromRows_coefficient_mem _ _ t + have hy (a : gridAxes) (t : Finset α) (ht : t ∉ rowSets (ig a).1) : + booleanCoefficient (fun s => y s a) t = 0 := integerBooleanSitesFromRows_coefficient_outside _ _ t ht + have h := allocatedSupportedSlicedJointGrid_site_approximation B U b hR hσ S q r H step c hH hsubset hcell + ig (fun a => rowSets (ig a).1) (allocatedGridIntegerAxis_injective B U b S) + (allocatedGridIntegerAxis_grid B U b S) axisN e hC hδ hcap he x y hy + have hmass := allocatedSupportedSlicedPhysicalGrid_joint_mass B U b hR hσ S q r H step c hH hsubset hcell + ig (fun a => rowSets (ig a).1) x (allocatedGridIntegerAxis_injective B U b S) + (allocatedGridIntegerAxis_grid B U b S) (fun a t => booleanCoefficient (fun s => y s a) t) + have heq : (∏ a : gridAxes, (allocatedSupportedSlicedPhysicalGridPMF B U b hR hσ S q r H step c hH hsubset hcell + (ig a).1 (ig a).2 (rowSets (ig a).1) x (fun t => booleanCoefficient (fun s => y s a) t)).toReal) = + allocatedSupportedSlicedFullGridDensity B U b hR hσ S rowSets H step c hH hsubset q r hcell x z := by + apply Finset.prod_congr rfl + intro a _ + congr 2 + funext t + exact hc a t + rw [hmass, heq, Complex.ofReal_mul] at h + exact h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedPoint.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd02dd17a5a202b095416186130a82e938b48607 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedPoint.lean @@ -0,0 +1,137 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedSupportedSlicedResidueGrid + +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 : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ t, 0 < H t) +variable (hsubset : ∀ t, integerProgressionSupport (c t) (step t : ℤ) (H t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).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 (hsize : ∀ b v, (Fintype.card α + 1) * q ≤ H ⟨⟨j,Sum.inr i⟩,b,v⟩) + +local notation "coeff" => (fun _ : B (Sigma.mk j (Sum.inr i)) => + allocatedPrincipalNormalizedSource B U basis hR S j i hactive) +local notation "sources" => principalSupportedAxisSources B (layerSamplerDegree I n) H hH q hq r + (Sigma.mk j (Sum.inr i)) hsize +local notation "lower" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin (Fin.val j + 1)) (a : Option α) => + ite (a = none) (c (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) 0) +local notation "strides" => (fun (b : B (Sigma.mk j (Sum.inr i))) (v : Fin (Fin.val j + 1)) (_ : Option α) => + step (Sigma.mk (Sigma.mk j (Sum.inr i)) (Prod.mk b v))) +local notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + +local notation "radius" => blockJetScaleBound (Fintype.card α) (Fin.val j + 1) + (Fintype.card (B (Sigma.mk j (Sum.inr i)))) (4 * gamma) +local notation "height" => basisAxisScale (basis j) i +local notation "torus" => blockTorusFactor (Fintype.card α) (Fin.val j + 1) + (Fintype.card (B (Sigma.mk j (Sum.inr i)))) (4 * gamma) + +omit [∀ layer, DecidableEq (I layer)] in +include hsubset in +theorem allocatedSupportedSlicedSource_support + (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) + (shift : rows → ℤ) + (x : ∀ b, IntegerScalarCubeBox Empty (coeff b).length × + (∀ v, IntegerScalarCubeBox α ((sources) b v).length)) + (hx : (weightedModerateIntegerProductSource coeff sources).weight x ≠ 0) (t : rows) : + |(weightedAffineModerateIntegerJetSum coeff sources lower strides rows (fun _ => 0) shift x t : ℝ) - shift t| ≤ + radius * height := by + have hcoord (b : B ⟨j,Sum.inr i⟩) (v : Fin (j.val + 1)) (a : Option α) : + |affineIntegerCubeCoordinates (lower b v) (strides b v) (fun a => ((x b).2 v a : ℤ)) a| ≤ S.value := by + have hb : (weightedModerateIntegerSource (coeff b) (sources b)).weight (x b) ≠ 0 := + (Finset.prod_ne_zero_iff.mp hx) b (Finset.mem_univ b) + have hprod : (∏ v, ((sources) b v).source.weight ((x b).2 v)) ≠ 0 := + (mul_ne_zero_iff.mp hb).2 + have hv : ((sources) b v).source.weight ((x b).2 v) ≠ 0 := + (Finset.prod_ne_zero_iff.mp hprod) v (Finset.mem_univ v) + have he := allocatedPrincipalSides_active B U basis S j i hactive b v + have hbound := containedProgressionCoordinate_bound (c ⟨⟨j,Sum.inr i⟩,b,v⟩) + (hsubset ⟨⟨j,Sum.inr i⟩,b,v⟩) ((x b).2 v) (((sources) b v).source_cube _ hv) a + rw [he] at hbound + exact hbound + have hgamma := principalProfileSize_pos (hR j) + (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + exact weightedAffineModerateIntegerJetSum_box_bound coeff sources lower strides S.value rows hrows + (by positivity) (Nat.cast_nonneg _) (fun _ => + (allocatedPrincipalNormalizedSource_scale_bounds B U basis hR S j i hactive).2) shift x hcoord t + +theorem allocatedSupportedSlicedPointApproximation_error + (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) + {δ : ℝ} (hδ : 0 < δ) + (hlength : ∀ b v, δ * S.value ≤ (H ⟨⟨j,Sum.inr i⟩,b,v⟩ : ℝ)) + (hstep : ∀ b v, 0 < step ⟨⟨j,Sum.inr i⟩,b,v⟩) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) + (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) + (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) + (hstride : ∀ b v, ((step ⟨⟨j,Sum.inr i⟩,b,v⟩ * q : ℕ) : ℝ) ≤ P) + {ε : ℝ} {M : ℕ} [NeZero M] (hM : M = torus * height) + (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⟩)) + (hε : 0 < ε) (hε1 : ε ≤ 1) : + let V := ((torus : ℝ) / (2 * gamma)) / δ ^ (j.val + 1) + let t := (layerTailDegree m + 1) * rows.card + let W := (torus : ℝ) ^ rows.card / δ ^ t + let F := positiveModerateSpectrumCover rows M j.val P V (δ * S.value) + (positiveModerateRetainedBias j.val rows.card t P V W ε); + (F.card : ℝ) ≤ positiveModerateSpectrumCardBudget j.val rows.card t P V W ε ∧ + ∀ shift z : rows → ℤ, + ‖(((height : ℝ) ^ rows.card * + (allocatedSupportedSlicedResidueJetPMF B U basis hR hσ S q r H step c hH hsubset hcell j i rows shift z).toReal : ℝ) : ℂ) - + (normalizedSupportPlateau radius (fun t => ((z t : ℝ) - shift t) / height) : ℂ) * + weightedAffineModerateGridApproximation coeff sources lower strides height M rows + (fun _ => 0) shift z F‖ ≤ ε := by + intro V t W F + have hMK : (M : ℝ) ≤ (torus : ℝ) * height := by simp only [hM, Nat.cast_mul, le_refl] + obtain ⟨hF, he⟩ := allocatedSupportedSlicedGridDensity_approximation_on_cover + B U basis hR hσ S q hq r H step c hH hsubset hcell j i hactive hsize + hgrid hδ hlength hstep A hA P hcP hsP hstride (Nat.cast_nonneg torus) hMK rows hrows hB hε hε1 + refine ⟨hF, fun shift z => ?_⟩ + have hlaw := allocatedSupportedSlicedResidueJetPMF_source B U basis hR hσ S q hq r H step c + hH hsubset hcell j i hactive hsize rows shift + have hd := integerGridDensity_eq_of_pmf_image (weightedModerateIntegerProductSource coeff sources) + (weightedAffineModerateIntegerJetSum coeff sources lower strides rows (fun _ => 0) shift) + _ hlaw height M z + have hd' : integerGridDensity (weightedModerateIntegerProductSource coeff sources) + (weightedAffineModerateIntegerJetSum coeff sources lower strides rows (fun _ => 0) shift) height M z = + allocatedSupportedSlicedGridDensity B U basis hR hσ S q r H step c hH hsubset hcell j i M rows shift z := by + simpa only [allocatedSupportedSlicedGridDensity, Fintype.card_coe] using hd + have hscale : ((height : ℝ) / M) ^ rows.card ≤ 1 := by + rw [hM, Nat.cast_mul] + exact grid_scale_factor_le_one _ _ _ (blockTorusFactor_pos _ _ _ _) (basisAxisScale_pos (basis j) i) + have he' := (he shift z).trans (mul_le_of_le_one_left hε.le hscale) + rw [← hd'] at he' + have hgamma := principalProfileSize_pos (hR j) + (Finset.card (layerIntegerPrincipalSlots (G := G) B j i)) + have hp := integerGridDensity_plateau_transfer (weightedModerateIntegerProductSource coeff sources) + (weightedAffineModerateIntegerJetSum coeff sources lower strides rows (fun _ => 0) shift) + shift z (blockJetScaleBound_nonneg _ _ _ (by positivity)) (basisAxisScale_pos (basis j) i) hM + (fun x hx t => allocatedSupportedSlicedSource_support B U basis hR S q hq r H step c hH hsubset + j i hactive hsize rows hrows shift x hx t) _ hε.le he' + simpa only [hlaw, Fintype.card_coe] using hp + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedUniformPhysicalSource.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedUniformPhysicalSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe10f355e74b69c38d44f04ea7f2408610d6af14 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedSupportedSlicedUniformPhysicalSource.lean @@ -0,0 +1,1225 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedFiniteModelPhysicalExpansion +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedFiniteModelComparison +import OAI.Combinatorics.Progressions.Estimates.AllocatedSlicedIdealCutoff +import OAI.Combinatorics.Progressions.Probability.AllocatedPhysicalExpansionMass +import OAI.Combinatorics.Progressions.Sampling.AllocatedSupportedSlicedFullGridSite + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +universe uα + +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)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "gridAxes" => {a // allocatedGridAxis (I := I) U b S.value a} +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "axisN" => allocatedGridNaturalScale B U b S +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset α)) + +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell grid +local notation "height" => (fun a : gridAxes => basisAxisScale (b (Sigma.fst (ig a))) (Sigma.snd (ig a))) + +variable (x : G → IntegerScalarCubeBox α S.value) +variable (u₀ : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S)) +variable (hu₀ : ((containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell (allocatedGridAxis (I := I) U b S.value))).weight u₀ ≠ 0) +variable (v₀ : PrincipalAxisTuples (α := α) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) +variable (Q : Fin m → Type*) [∀ j, Fintype (Q j)] (d : ℕ) [NeZero d] +variable (hperiod : ∀ j, integerScalarLattice ((fun j : Fin m => {t : Finset α // t ∈ rowSets j}) j) (q : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) ((fun j => (Subtype.val : rowSets j → Finset α)) j)).mulVecLin.range) +local notation "root" u => allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (principalAxisJoin grid u v₀) +local notation "dirs" u => allocatedPhysicalCubeDirections B U b S x (principalAxisJoin grid u v₀) +local notation "residue" u:max => (fun j => integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u rows j v₀) q) + +include hu₀ hperiod in + +theorem allocatedSupportedSlicedDeck_density_constant + (u : PrincipalAxisTuples (α := α) grid (allocatedPrincipalSides B U b S)) + (hu : (gridLaw).weight u ≠ 0) (z : ∀ j, rowTypes j → Q j → ZMod d) : + coefficientDeckJetDensity (root u) (dirs u) rows d z = + coefficientDeckJetDensity (root u₀) (dirs u₀) rows d z := by + have he := allocatedSupportedSlicedDeck_law_constant B U b S x H step c hH hsubset q r hcell + u u₀ hu hu₀ v₀ rows Q hperiod d + unfold coefficientDeckJetDensity + convert congrArg (fun p : PMF (∀ j, rowTypes j → Q j → ZMod d) => + (Fintype.card (∀ j, rowTypes j → Q j → ZMod d) : ℝ) * (p z).toReal) he using 1 <;> congr! + +include hu₀ hperiod in + +theorem allocatedSupportedSlicedCoveredFactor_mean + (z : ∀ j, (I j → rowTypes j → ℝ) × (Fin (n j) → rowTypes j → ℤ)) + (deck : ∀ j, rowTypes j → Q j → ZMod d) : + (gridLaw).mean (fun u => allocatedCoveredFixedFactor B U b hR hσ S x u v₀ rows Q d z deck) = + allocatedSupportedSlicedFullGridDensity B U b hR hσ S rowSets H step c hH hsubset q r hcell x + (fun a => coefficientJetAxisEquiv rowTypes I n z a.val) * + coefficientDeckJetDensity (root u₀) (dirs u₀) rows d deck / coveredJetArrayScale (O := rowTypes) U := by + have he : (gridLaw).mean (fun u => allocatedCoveredFixedFactor B U b hR hσ S x u v₀ rows Q d z deck) = + (gridLaw).mean (fun u => allocatedGridJetDensity B U b hR hσ S x u v₀ rows + (fun a => coefficientJetAxisEquiv rowTypes I n z a.val) * + coefficientDeckJetDensity (root u₀) (dirs u₀) rows d deck / coveredJetArrayScale (O := rowTypes) U) := by + apply FiniteProbabilityWeights.mean_congr_on_support + intro u hu + unfold allocatedCoveredFixedFactor + rw [allocatedSupportedSlicedDeck_density_constant B U b S rowSets H step c hH hsubset q r hcell x u₀ hu₀ v₀ Q d hperiod u hu] + rw [he] + simp only [div_eq_mul_inv, FiniteProbabilityWeights.mean_mul_const] + rw [allocatedSupportedSlicedFullGridDensity_mean B U b hR hσ S rowSets H step c hH hsubset q r hcell x v₀] + +include hu₀ in + +theorem allocatedSupportedSlicedLongProfile_constant + (u : PrincipalAxisTuples (α := α) grid (allocatedPrincipalSides B U b S)) + (hu : (gridLaw).weight u ≠ 0) + (f : ((Σ a : {a // ¬grid a}, rowTypes a.val.1) → ℝ) → ℝ) + (z : AllocatedLongJetRows B U b S rowTypes) : + allocatedLongProfileDensity B U b S x rows q (residue u) f z = + allocatedLongProfileDensity B U b S x rows q (residue u₀) f z := by + have he : (residue u) = (residue u₀) := by + funext j + exact allocatedSupportedSlicedNonkernel_residue_constant B U b S x H step c hH hsubset q r hcell + u u₀ hu hu₀ v₀ rows j + rw [he] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical NNReal + +universe uα + +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)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "gridAxes" => {a // allocatedGridAxis (I := I) U b S.value a} +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "axisN" => allocatedGridNaturalScale B U b S +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset α)) + +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell grid +local notation "height" => (fun a : gridAxes => basisAxisScale (b (Sigma.fst (ig a))) (Sigma.snd (ig a))) + +variable (x : G → IntegerScalarCubeBox α S.value) +variable (u₀ : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S)) +variable (hu₀ : ((containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell (allocatedGridAxis (I := I) U b S.value))).weight u₀ ≠ 0) +variable (v₀ : PrincipalAxisTuples (α := α) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) +variable (Q : Fin m → Type*) [∀ j, Fintype (Q j)] (d : ℕ) [NeZero d] +variable (hperiod : ∀ j, integerScalarLattice ((fun j : Fin m => {t : Finset α // t ∈ rowSets j}) j) (q : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) ((fun j => (Subtype.val : rowSets j → Finset α)) j)).mulVecLin.range) +local notation "root" u => allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (principalAxisJoin grid u v₀) +local notation "dirs" u => allocatedPhysicalCubeDirections B U b S x (principalAxisJoin grid u v₀) +local notation "residue" u:max => (fun j => integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u rows j v₀) q) + +include hu₀ hperiod in + +theorem allocatedSupportedSlicedMaskedCoveredFactor_mean + (f : ((Σ a : {a // ¬grid a}, rowTypes a.val.1) → ℝ) → ℝ) + (z : ∀ j, (I j → rowTypes j → ℝ) × (Fin (n j) → rowTypes j → ℤ)) + (deck : ∀ j, rowTypes j → Q j → ZMod d) : + (gridLaw).mean (fun u => allocatedCoveredFixedFactor B U b hR hσ S x u v₀ rows Q d z deck * + allocatedLongProfileDensity B U b S x rows q (residue u) f + (fun a => coefficientJetAxisEquiv rowTypes I n z a.val)) = + (allocatedSupportedSlicedFullGridDensity B U b hR hσ S rowSets H step c hH hsubset q r hcell x + (fun a => coefficientJetAxisEquiv rowTypes I n z a.val) * + coefficientDeckJetDensity (root u₀) (dirs u₀) rows d deck / coveredJetArrayScale (O := rowTypes) U) * + allocatedLongProfileDensity B U b S x rows q (residue u₀) f + (fun a => coefficientJetAxisEquiv rowTypes I n z a.val) := by + have he : (gridLaw).mean (fun u => allocatedCoveredFixedFactor B U b hR hσ S x u v₀ rows Q d z deck * + allocatedLongProfileDensity B U b S x rows q (residue u) f + (fun a => coefficientJetAxisEquiv rowTypes I n z a.val)) = + (gridLaw).mean (fun u => allocatedCoveredFixedFactor B U b hR hσ S x u v₀ rows Q d z deck * + allocatedLongProfileDensity B U b S x rows q (residue u₀) f + (fun a => coefficientJetAxisEquiv rowTypes I n z a.val)) := by + apply FiniteProbabilityWeights.mean_congr_on_support + intro u hu + rw [allocatedSupportedSlicedLongProfile_constant B U b S rowSets H step c hH hsubset q r hcell x + u₀ hu₀ v₀ u hu] + rw [he, FiniteProbabilityWeights.mean_mul_const, + allocatedSupportedSlicedCoveredFactor_mean B U b hR hσ S rowSets H step c hH hsubset q r hcell x + u₀ hu₀ v₀ Q d hperiod] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +universe uα + +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)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "gridAxes" => {a // allocatedGridAxis (I := I) U b S.value a} +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "axisN" => allocatedGridNaturalScale B U b S +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset α)) + +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell grid +local notation "height" => (fun a : gridAxes => basisAxisScale (b (Sigma.fst (ig a))) (Sigma.snd (ig a))) + +variable (x : G → IntegerScalarCubeBox α S.value) +variable (u₀ : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S)) +variable (hu₀ : ((containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell (allocatedGridAxis (I := I) U b S.value))).weight u₀ ≠ 0) +variable (v₀ : PrincipalAxisTuples (α := α) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) +variable (Q : Fin m → Type*) [∀ j, Fintype (Q j)] (d : ℕ) [NeZero d] +variable (hperiod : ∀ j, integerScalarLattice ((fun j : Fin m => {t : Finset α // t ∈ rowSets j}) j) (q : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) ((fun j => (Subtype.val : rowSets j → Finset α)) j)).mulVecLin.range) +local notation "root" u => allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (principalAxisJoin grid u v₀) +local notation "dirs" u => allocatedPhysicalCubeDirections B U b S x (principalAxisJoin grid u v₀) +local notation "residue" u:max => (fun j => integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u rows j v₀) q) + +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "quarter" => (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "region" => mixedCoveredJetRegion (E := Q) U o b d quarter +local notation "y₀" => principalAxisJoin grid u₀ v₀ +local notation "gridDensity" => allocatedSupportedSlicedFullGridDensity B U b hR hσ S rowSets H step c hH hsubset q r hcell x + +include hu₀ hperiod in + +theorem allocatedSupportedSlicedMaskedProfile_chart_mean + (f : ((Σ a : {a // ¬grid a}, rowTypes a.val.1) → ℝ) → ℝ) + (z : MixedCoveredJetSource I rowTypes Q n d) (hz : z ∈ region) : + (gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u v₀) q f (chart z)) = + gridDensity (allocatedFullGridRowsOfMixed B U b S rowSets z.1) * + allocatedWholeMaskedGridlessProfile B U b S x y₀ rows hb o bW d q f (chart z) := by + have hinj := mixedCoveredJetChart_injOn U o b hb bW d quarter + (fun j _ => standardLatticeClosedQuarterBox_subset_smallBox (J j)) + simp only [allocatedWholeMaskedCoveredProfile, allocatedWholeMaskedGridlessProfile, + principalAxisRestrict_join_left, principalAxisRestrict_join_right, + allocatedCoveredProfileDensity, allocatedGridlessCoveredProfile, + restrictedChartDensity_apply _ _ _ _ hinj hz, one_mul] + have h := allocatedSupportedSlicedMaskedCoveredFactor_mean B U b hR hσ S rowSets + H step c hH hsubset q r hcell x u₀ hu₀ v₀ Q d hperiod f z.1 z.2 + convert h using 1 <;> try rfl + change gridDensity (fun a => coefficientJetAxisEquiv rowTypes I n z.1 a.val) * + (coefficientDeckJetDensity (root u₀) (dirs u₀) rows d z.2 / coveredJetArrayScale (O := rowTypes) U * + allocatedLongProfileDensity B U b S x rows q (residue u₀) f + (fun a => coefficientJetAxisEquiv rowTypes I n z.1 a.val)) = _ + ring + +include hu₀ in + +theorem allocatedSupportedSliced_referenceCell_pos + (hv₀ : ∀ j, IntegerScalarCube (principalAxisLength (fun a => ¬grid a) + (allocatedPrincipalSides B U b S) j) (fun a => (v₀ j a : ℤ))) : + 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = principalResidueLabel q y₀)) := by + have hu := containedSupportedProgressionAxisLaw_cube_support B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) + hH hsubset q r hcell grid u₀ hu₀ + exact principalResidueCell_pos_of_cube B (layerSamplerDegree I n) (allocatedPrincipalSides B U b S) + (allocatedPrincipalSides_pos B U b S) q y₀ + (principalAxisJoin_cube B (layerSamplerDegree I n) (allocatedPrincipalSides B U b S) grid u₀ v₀ hu hv₀) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +universe uα + +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)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ 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 b R σ) +variable {α : Type uα} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) + +local notation "gridAxes" => {a // allocatedGridAxis (I := I) U b S.value a} +local notation "ig" => allocatedGridIntegerAxis B U b S +local notation "axisN" => allocatedGridNaturalScale B U b S +local notation "rowTypes" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset α)) + +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell grid +local notation "height" => (fun a : gridAxes => basisAxisScale (b (Sigma.fst (ig a))) (Sigma.snd (ig a))) + +variable (x : G → IntegerScalarCubeBox α S.value) +variable (u₀ : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U b S.value) (allocatedPrincipalSides B U b S)) +variable (hu₀ : ((containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q r hcell (allocatedGridAxis (I := I) U b S.value))).weight u₀ ≠ 0) +variable (v₀ : PrincipalAxisTuples (α := α) (fun a => ¬(allocatedGridAxis (I := I) U b S.value) a) (allocatedPrincipalSides B U b S)) +variable (Q : Fin m → Type*) [∀ j, Fintype (Q j)] (d : ℕ) [NeZero d] +variable (hperiod : ∀ j, integerScalarLattice ((fun j : Fin m => {t : Finset α // t ∈ rowSets j}) j) (q : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) ((fun j => (Subtype.val : rowSets j → Finset α)) j)).mulVecLin.range) +local notation "root" u => allocatedPhysicalCubeRoot B U b S (fun _ => 0) x (principalAxisJoin grid u v₀) +local notation "dirs" u => allocatedPhysicalCubeDirections B U b S x (principalAxisJoin grid u v₀) +local notation "residue" u:max => (fun j => integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x u rows j v₀) q) + +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "quarter" => (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "region" => mixedCoveredJetRegion (E := Q) U o b d quarter +local notation "y₀" => principalAxisJoin grid u₀ v₀ +local notation "gridDensity" => allocatedSupportedSlicedFullGridDensity B U b hR hσ S rowSets H step c hH hsubset q r hcell x + +include hu₀ hperiod in + +theorem allocatedSupportedSlicedProductProfile_chart_error + (f : ((Σ a : {a // ¬grid a}, rowTypes a.val.1) → ℝ) → ℝ) + (hfullcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = principalResidueLabel q y₀))) + (rad : ℝ≥0) (hrad : 0 < rad) + (e : gridAxes → ScalarSiteExpansion.{uα,uα} (Finset α)) {ε : ℝ} + (z : MixedCoveredJetSource I rowTypes Q n d) (hz : z ∈ region) + (he : ‖(allocatedFullGridNaturalVolume B U b S rowSets : ℂ) * + (gridDensity (allocatedFullGridRowsOfMixed B U b S rowSets z.1) : ℂ) - + allocatedFullGridSiteApproximation B U b S rowSets e + (allocatedFullGridRowsOfMixed B U b S rowSets z.1)‖ ≤ ε) : + ‖allocatedProductSiteCutoff B U b S rowSets o hb bW d rad hrad (chart z) * + ((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u v₀) q f (chart z)) : ℂ) - + allocatedProductFullGridProfile B U b S rowSets d rad hrad x hb o bW q y₀ f hR hσ hfullcell e (chart z)‖ ≤ + ‖allocatedProductFullGridPrefactor B U b S rowSets d rad hrad x hb o bW q y₀ f (chart z)‖ * ε := by + rw [allocatedSupportedSlicedMaskedProfile_chart_mean B U b hR hσ S rowSets + H step c hH hsubset q r hcell x u₀ hu₀ v₀ Q d hperiod hb o bW f z hz, + allocatedProductFullGridProfile_mixed B U b S rowSets d rad hrad x hb o bW q y₀ f hR hσ hfullcell e z hz, + Complex.ofReal_mul] + let N : ℂ := (allocatedFullGridNaturalVolume B U b S rowSets : ℂ) + have hN : N ≠ 0 := Complex.ofReal_ne_zero.mpr (allocatedFullGridNaturalVolume_pos B U b hR S rowSets).ne' + have heq : + allocatedProductSiteCutoff B U b S rowSets o hb bW d rad hrad (chart z) * + ((gridDensity (allocatedFullGridRowsOfMixed B U b S rowSets z.1) : ℂ) * + (allocatedWholeMaskedGridlessProfile B U b S x y₀ rows hb o bW d q f (chart z) : ℂ)) - + allocatedProductFullGridPrefactor B U b S rowSets d rad hrad x hb o bW q y₀ f (chart z) * + allocatedFullGridSiteApproximation B U b S rowSets e (allocatedFullGridRowsOfMixed B U b S rowSets z.1) = + allocatedProductFullGridPrefactor B U b S rowSets d rad hrad x hb o bW q y₀ f (chart z) * + (N * (gridDensity (allocatedFullGridRowsOfMixed B U b S rowSets z.1) : ℂ) - + allocatedFullGridSiteApproximation B U b S rowSets e (allocatedFullGridRowsOfMixed B U b S rowSets z.1)) := by + unfold allocatedProductFullGridPrefactor + change _ - _ * (1 / N * _) * _ = (_ * (1 / N * _)) * (N * _ - _) + field_simp + rw [heq, norm_mul] + exact mul_le_mul_of_nonneg_left he (norm_nonneg _) + +include hu₀ hperiod in + +theorem allocatedSupportedSlicedProductProfile_error + (f : ((Σ a : {a // ¬grid a}, rowTypes a.val.1) → ℝ) → ℝ) + (hfullcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = principalResidueLabel q y₀))) + (rad : ℝ≥0) (hrad : 0 < rad) + (e : gridAxes → ScalarSiteExpansion.{uα,uα} (Finset α)) {ε : ℝ} + (he : ∀ z : AllocatedFrozenJetRows B U b S rowTypes, + ‖(allocatedFullGridNaturalVolume B U b S rowSets : ℂ) * (gridDensity z : ℂ) - + allocatedFullGridSiteApproximation B U b S rowSets e z‖ ≤ ε) + (y : EuclideanJetLayers U rowTypes) : + ‖allocatedProductSiteCutoff B U b S rowSets o hb bW d rad hrad y * + ((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u v₀) q f y) : ℂ) - + allocatedProductFullGridProfile B U b S rowSets d rad hrad x hb o bW q y₀ f hR hσ hfullcell e y‖ ≤ + ‖allocatedProductFullGridPrefactor B U b S rowSets d rad hrad x hb o bW q y₀ f y‖ * ε := by + by_cases hy : y ∈ chart '' region + · obtain ⟨z, hz, rfl⟩ := hy + exact allocatedSupportedSlicedProductProfile_chart_error B U b hR hσ S rowSets H step c hH hsubset q r hcell + x u₀ hu₀ v₀ Q d hperiod hb o bW f hfullcell rad hrad e z hz (he _) + · have hzero (u) : allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u v₀) q f y = 0 := by + unfold allocatedWholeMaskedCoveredProfile allocatedCoveredProfileDensity + exact restrictedChartDensity_zero _ _ _ _ hy + simp only [hzero, FiniteProbabilityWeights.mean_const, Complex.ofReal_zero, mul_zero, + allocatedProductFullGridProfile_zero B U b S rowSets d rad hrad x hb o bW q y₀ f hR hσ hfullcell e y hy, + allocatedProductFullGridPrefactor_zero B U b S rowSets d rad hrad x hb o bW q y₀ f y hy, + sub_zero, norm_zero, zero_mul, le_refl] + +include hu₀ hperiod in + +theorem allocatedSupportedSlicedProductProfile_combined_error + (f : ((Σ a : {a // ¬grid a}, rowTypes a.val.1) → ℝ) → ℝ) + (hfullcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = principalResidueLabel q y₀))) + (rad : ℝ≥0) (hrad : 0 < rad) + (e : gridAxes → ScalarSiteExpansion.{uα,uα} (Finset α)) {ε η : ℝ} + (he : ∀ z : AllocatedFrozenJetRows B U b S rowTypes, + ‖(allocatedFullGridNaturalVolume B U b S rowSets : ℂ) * (gridDensity z : ℂ) - + allocatedFullGridSiteApproximation B U b S rowSets e z‖ ≤ ε) + {Nt V Cc Hs : gridAxes → ℝ} {L : ℝ≥0} + (heb : ∀ a, (e a).Bounds (Nt a) (V a) (Cc a) L (Hs a)) + (F : EuclideanJetLayers U rowTypes → ℂ) (hη : 0 ≤ η) + (hF : ∀ y, ‖allocatedProductFullGridPrefactor B U b S rowSets d rad hrad x hb o bW q y₀ f y - F y‖ ≤ η) + (y : EuclideanJetLayers U rowTypes) : + ‖allocatedProductSiteCutoff B U b S rowSets o hb bW d rad hrad y * + ((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u v₀) q f y) : ℂ) - + F y * allocatedFullGridChartModel B U b S rowSets d hb o bW e y‖ ≤ + ‖allocatedProductFullGridPrefactor B U b S rowSets d rad hrad x hb o bW q y₀ f y‖ * ε + η * ∏ a, Cc a := by + have hg := allocatedSupportedSlicedProductProfile_error B U b hR hσ S rowSets H step c hH hsubset q r hcell + x u₀ hu₀ v₀ Q d hperiod hb o bW f hfullcell rad hrad e he y + have hl := allocatedProductFullGridProfile_prefactor_error B U b S rowSets d rad hrad x hb o bW q y₀ f + hR hσ hfullcell e heb F hη hF y + have ht := dist_triangle + (allocatedProductSiteCutoff B U b S rowSets o hb bW d rad hrad y * + ((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u v₀) q f y) : ℂ)) + (allocatedProductFullGridProfile B U b S rowSets d rad hrad x hb o bW q y₀ f hR hσ hfullcell e y) + (F y * allocatedFullGridChartModel B U b S rowSets d hb o bW e y) + simp only [dist_eq_norm] at ht + exact ht.trans (add_le_add hg hl) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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 [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (rowSets : Fin m → Finset (Finset (Fin 1))) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset (Fin 1) // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowTypes j → Finset (Fin 1))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit rowTypes I n grid +local notation "baseVolume" => (allocatedFullGridNaturalVolume B U b S rowSets * + coveredJetArrayScale (O := rowTypes) U * ∏ a, allocatedLongJetOutputScale B U b S (O := rowTypes) a) + +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (x : G → IntegerScalarCubeBox (Fin 1) S.value) +variable (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin 1) (allocatedPrincipalSides B U b S)) +variable (q d period : ℕ) [NeZero d] [NeZero period] +variable (r : ℝ≥0) (hr : 0 < r) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "region" => mixedCoveredJetRegion (E := E) U o b d + (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr +local notation "mask" => allocatedClippedPrefactorSiteMask B U b S rowSets x y₀ q d period +local notation "residue" => (fun j => integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict grid y₀) rows j (principalAxisRestrict (fun a => ¬grid a) y₀)) q) +local notation "inverseNormalizer" => ((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹ + +variable (hperiod : ∀ j, integerScalarLattice {t : Finset (Fin 1) // t ∈ rowSets j} (period : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))).mulVecLin.range) +variable {M : ℝ} (hM : 1 ≤ M) +variable (hm : ∀ j z, 0 ≤ allocatedIntegerKernelMask B U b S x + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j q + (integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j + (principalAxisRestrict (fun a => ¬allocatedGridAxis (I := I) U b S.value a) y₀)) q) z ∧ + allocatedIntegerKernelMask B U b S x + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j q + (integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j + (principalAxisRestrict (fun a => ¬allocatedGridAxis (I := I) U b S.value a) y₀)) q) z ≤ M) + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin 1)) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)))) ≤ 1 / 4) + +variable (hrows : ∀ j t, t ∈ rowSets j) +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (hσ : ∀ j, 0 < σ j) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (label : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin 1) → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := Fin 1) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = label))) +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell grid +variable (hu₀ : (containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell + (allocatedGridAxis (I := I) U b S.value)).weight (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) ≠ 0) +variable (hmodulus : ∀ j, integerScalarLattice {t : Finset (Fin 1) // t ∈ rowSets j} (q : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))).mulVecLin.range) +variable (hy₀ : ∀ j, IntegerScalarCube (allocatedPrincipalSides B U b S j) (fun a => (y₀ j a : ℤ))) +local notation "gridAxes" => {a // grid a} +local notation "gridDensity" => allocatedSupportedSlicedFullGridDensity B U b hR hσ S rowSets H step c hH hsubset q label hcell x +local notation "ideal" => allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width +local notation "prefactor" => allocatedProductFullGridPrefactor B U b S rowSets d r hr x hb o bW q y₀ ideal + +include hperiod hM hm hR hC hchart hbudget hu₀ hmodulus hy₀ in +theorem exists_allocated_supported_sliced_ideal_model + (e : gridAxes → ScalarSiteExpansion.{0,0} (Finset (Fin 1))) + {εgrid : ℝ} + (he : ∀ z : AllocatedFrozenJetRows B U b S rowTypes, + ‖(allocatedFullGridNaturalVolume B U b S rowSets : ℂ) * (gridDensity z : ℂ) - + allocatedFullGridSiteApproximation B U b S rowSets e z‖ ≤ εgrid) + {Nt V Cc Hs : gridAxes → ℝ} {Lg : ℝ≥0} + (heb : ∀ a, (e a).Bounds (Nt a) (V a) (Cc a) Lg (Hs a)) + (O : ℕ) (hO : Fintype.card (OneCubeActiveRow grid) ≤ O) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ P ε : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hP : 0 ≤ P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (hε : 0 < ε) (hHP : (4 : ℝ) ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) : + let cutoffLip : ℝ≥0 := Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / 4 + let Q := slicedJointDensityLogBudget O m P + P + let A := Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8) + Q) + let maskCap := M ^ Fintype.card (LayerSamplerAxis I n) * coefficientDeckPeriodCap rowTypes E period + ∃ k : ℕ, (k : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + (Fintype.card (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) : ℝ) ≤ + Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8)) ∧ + ∃ (a : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → ℂ) + (f : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → Finset (Fin 1) → (LayerSamplerAxis I n → ℝ) → ℂ), + (∑ i, ‖a i‖) ≤ A ∧ + (∀ i s v, ‖f i s v‖ ≤ 1) ∧ + (∀ i s, LipschitzWith (⟨Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12), Real.exp_nonneg _⟩ + cutoffLip) (f i s)) ∧ + (∀ i s v, (∃ j, (4 : ℝ) < |v j|) → f i s v = 0) ∧ + (∑ label : Finset (Fin 1) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)), ∑ i, + ‖allocatedProductMaskedIdealCoefficient B U b S rowSets x y₀ q d period a label i‖) ≤ + ‖inverseNormalizer‖ * ((Fintype.card ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) : ℝ) ^ Fintype.card (Finset (Fin 1)) * maskCap * A) ∧ + (∀ label i s y, + ‖allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s) y‖ ≤ 1) ∧ + (∀ label i s, Measurable (allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s))) ∧ + Measurable (allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f) ∧ + (∀ y : EuclideanJetLayers U rowTypes, + ‖allocatedProductFullGridPrefactor B U b S rowSets d r hr x hb o bW q y₀ + (allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width) y - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y‖ ≤ + ‖inverseNormalizer‖ * maskCap * ε) ∧ + ∀ y : EuclideanJetLayers U rowTypes, + ‖cutoff y * ((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q ideal y) : ℂ) - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y * + allocatedFullGridChartModel B U b S rowSets d hb o bW e y‖ ≤ + ‖prefactor y‖ * εgrid + (‖inverseNormalizer‖ * maskCap * ε) * ∏ a, Cc a := by + intro cutoffLip Q A maskCap + obtain ⟨k, hk, hcard, a, f, ha', hf, hLf, hs, hc, hfn, hfm, hmeas, herr⟩ := + exists_allocated_global_masked_sliced_approximation B U b S rowSets x y₀ q d period r hr hb o bW + hperiod hM hm hR C hC hchart hbudget hrows hB lower width O hO hwidth + ha hδ hP haP hδP hprincipal hw hl hε hHP hεP + refine ⟨k, hk, hcard, a, f, ha', hf, hLf, hs, hc, hfn, hfm, hmeas, herr, ?_⟩ + have hfullcell := principalResidueCell_pos_of_cube B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S) q y₀ hy₀ + have hjoin := principalAxisJoin_restrict grid y₀ + intro y + have hfullcell' : 0 < (principalTupleWeights (α := Fin 1) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = principalResidueLabel q + (principalAxisJoin grid (principalAxisRestrict grid y₀) (principalAxisRestrict (fun a => ¬grid a) y₀)))) := by + simpa only [hjoin] using hfullcell + have hlong : ∀ y, ‖allocatedProductFullGridPrefactor B U b S rowSets d r hr x hb o bW q + (principalAxisJoin grid (principalAxisRestrict grid y₀) (principalAxisRestrict (fun a => ¬grid a) y₀)) ideal y - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y‖ ≤ + ‖inverseNormalizer‖ * maskCap * ε := by simpa only [hjoin] using herr + have hη : 0 ≤ ‖inverseNormalizer‖ * maskCap * ε := by + have hmask : 0 ≤ maskCap := mul_nonneg (pow_nonneg (zero_le_one.trans hM) _) (coefficientDeckPeriodCap_nonneg rowTypes E period) + exact mul_nonneg (mul_nonneg (norm_nonneg _) hmask) hε.le + have h := allocatedSupportedSlicedProductProfile_combined_error B U b hR hσ S rowSets H step c hH hsubset q label hcell + x (principalAxisRestrict grid y₀) hu₀ (principalAxisRestrict (fun a => ¬grid a) y₀) E d hmodulus hb o bW + ideal hfullcell' r hr e he heb + (allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f) hη hlong y + simpa only [hjoin] using h + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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 [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (rowSets : Fin m → Finset (Finset (Fin 1))) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset (Fin 1) // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowTypes j → Finset (Fin 1))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit rowTypes I n grid +local notation "baseVolume" => (allocatedFullGridNaturalVolume B U b S rowSets * + coveredJetArrayScale (O := rowTypes) U * ∏ a, allocatedLongJetOutputScale B U b S (O := rowTypes) a) + +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (x : G → IntegerScalarCubeBox (Fin 1) S.value) +variable (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin 1) (allocatedPrincipalSides B U b S)) +variable (q d period : ℕ) [NeZero d] [NeZero period] +variable (r : ℝ≥0) (hr : 0 < r) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "region" => mixedCoveredJetRegion (E := E) U o b d + (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr +local notation "mask" => allocatedClippedPrefactorSiteMask B U b S rowSets x y₀ q d period +local notation "residue" => (fun j => integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict grid y₀) rows j (principalAxisRestrict (fun a => ¬grid a) y₀)) q) +local notation "inverseNormalizer" => ((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹ + +variable (hperiod : ∀ j, integerScalarLattice {t : Finset (Fin 1) // t ∈ rowSets j} (period : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))).mulVecLin.range) +variable {M : ℝ} (hM : 1 ≤ M) +variable (hm : ∀ j z, 0 ≤ allocatedIntegerKernelMask B U b S x + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j q + (integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j + (principalAxisRestrict (fun a => ¬allocatedGridAxis (I := I) U b S.value a) y₀)) q) z ∧ + allocatedIntegerKernelMask B U b S x + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j q + (integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j + (principalAxisRestrict (fun a => ¬allocatedGridAxis (I := I) U b S.value a) y₀)) q) z ≤ M) + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin 1)) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)))) ≤ 1 / 4) + +variable (hrows : ∀ j t, t ∈ rowSets j) +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (hσ : ∀ j, 0 < σ j) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (label : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin 1) → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := Fin 1) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = label))) +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell grid +variable (hu₀ : (containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell + (allocatedGridAxis (I := I) U b S.value)).weight (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) ≠ 0) +variable (hmodulus : ∀ j, integerScalarLattice {t : Finset (Fin 1) // t ∈ rowSets j} (q : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))).mulVecLin.range) +variable (hy₀ : ∀ j, IntegerScalarCube (allocatedPrincipalSides B U b S j) (fun a => (y₀ j a : ℤ))) +local notation "gridAxes" => {a // grid a} +local notation "gridDensity" => allocatedSupportedSlicedFullGridDensity B U b hR hσ S rowSets H step c hH hsubset q label hcell x +local notation "ideal" => allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width +local notation "prefactor" => allocatedProductFullGridPrefactor B U b S rowSets d r hr x hb o bW q y₀ ideal + +include hperiod hM hm hR hC hchart hbudget hu₀ hmodulus hy₀ in +theorem exists_allocated_supported_sliced_source_model + (T : Fin m → ℝ) (hT : ∀ j, 0 ≤ T j) (h4 : ∀ j, 4 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin 1) * ((Fintype.card (Fin 1) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (hradius : ∀ j, (rowSets j).card * T j ≤ (r : ℝ)) (hσ1 : ∀ j, σ j ≤ 1) + (e : gridAxes → ScalarSiteExpansion.{0,0} (Finset (Fin 1))) + {εgrid : ℝ} (hεgrid : 0 ≤ εgrid) + (he : ∀ z : AllocatedFrozenJetRows B U b S rowTypes, + ‖(allocatedFullGridNaturalVolume B U b S rowSets : ℂ) * (gridDensity z : ℂ) - + allocatedFullGridSiteApproximation B U b S rowSets e z‖ ≤ εgrid) + {Nt V Cc Hs : gridAxes → ℝ} {Lg : ℝ≥0} + (heb : ∀ a, (e a).Bounds (Nt a) (V a) (Cc a) Lg (Hs a)) + (O : ℕ) (hO : Fintype.card (OneCubeActiveRow grid) ≤ O) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ P ε : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hP : 0 ≤ P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + {Pcap : ℝ} (hPcap : 0 ≤ Pcap) (haPcap : a⁻¹ ≤ Real.exp Pcap) (hδPcap : δ⁻¹ ≤ Real.exp Pcap) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (hε : 0 < ε) (hHP : (4 : ℝ) ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) : + let cutoffLip : ℝ≥0 := Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / 4 + let Q := slicedJointDensityLogBudget O m P + P + let A := Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8) + Q) + let maskCap := M ^ Fintype.card (LayerSamplerAxis I n) * coefficientDeckPeriodCap rowTypes E period + ∃ k : ℕ, (k : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + (Fintype.card (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) : ℝ) ≤ + Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8)) ∧ + ∃ (a : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → ℂ) + (f : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → Finset (Fin 1) → (LayerSamplerAxis I n → ℝ) → ℂ), + (∑ i, ‖a i‖) ≤ A ∧ + (∀ i s v, ‖f i s v‖ ≤ 1) ∧ + (∀ i s, LipschitzWith (⟨Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12), Real.exp_nonneg _⟩ + cutoffLip) (f i s)) ∧ + (∀ i s v, (∃ j, (4 : ℝ) < |v j|) → f i s v = 0) ∧ + (∑ label : Finset (Fin 1) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)), ∑ i, + ‖allocatedProductMaskedIdealCoefficient B U b S rowSets x y₀ q d period a label i‖) ≤ + ‖inverseNormalizer‖ * ((Fintype.card ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) : ℝ) ^ Fintype.card (Finset (Fin 1)) * maskCap * A) ∧ + (∀ label i s y, + ‖allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s) y‖ ≤ 1) ∧ + (∀ label i s, Measurable (allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s))) ∧ + Measurable (allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f) ∧ + (∀ y : EuclideanJetLayers U rowTypes, + ‖allocatedProductFullGridPrefactor B U b S rowSets d r hr x hb o bW q y₀ + (allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width) y - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y‖ ≤ + ‖inverseNormalizer‖ * maskCap * ε) ∧ + ∀ y : EuclideanJetLayers U rowTypes, + ‖((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q ideal y) : ℂ) - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y * + allocatedFullGridChartModel B U b S rowSets d hb o bW e y‖ ≤ + ‖inverseNormalizer‖ * maskCap * + (Real.exp (slicedJointDensityLogBudget O m Pcap) * εgrid + ε * ∏ a, Cc a) := by + intro cutoffLip Q A maskCap + obtain ⟨k, hk, hcard, a, f, ha', hf, hLf, hs, hc, hfn, hfm, hmeas, hlong, herr⟩ := + exists_allocated_supported_sliced_ideal_model B U b S rowSets x y₀ q d period r hr hb o bW + hperiod hM hm hR C hC hchart hbudget hrows hB lower width hσ H step c hH hsubset label hcell + hu₀ hmodulus hy₀ e he heb O hO hwidth ha hδ hP haP hδP hprincipal hw hl hε hHP hεP + refine ⟨k, hk, hcard, a, f, ha', hf, hLf, hs, hc, hfn, hfm, hmeas, hlong, ?_⟩ + have hb0 (j : Fin m) : C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4 := by + have hb := hbudget j + have hcard : (Fintype.card (Finset (Fin 1)) : ℝ) = 2 := by norm_num + rw [hcard] at hb + have hn := Nat.cast_nonneg (α := ℝ) (rowSets j).card + have hp : 0 ≤ C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) := + mul_nonneg (hC j) (mul_nonneg (by positivity) (mul_nonneg (by positivity) (hR j).le)) + nlinarith only [hb, hn, hp] + intro y + have hfix := allocatedSlicedRowIdeal_cutoff_fixes_mean B U b S rowSets o hb bW d r hr hR hσ T hT hsource hradius C hC hchart hb0 + hσ1 h4 hrows hB lower width hwidth ha hδ hprincipal hw hl x gridLaw + (fun u => principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q y + have h := herr y + rw [hfix] at h + have hc := allocatedSlicedProductPrefactor_cap B U b S rowSets x y₀ q d period r hr hb o bW + hperiod hM hm hR C hC hchart hbudget hrows hB lower width O hO + ha hδ hPcap haPcap hδPcap hprincipal hw hl y + calc + _ ≤ ‖prefactor y‖ * εgrid + (‖inverseNormalizer‖ * maskCap * ε) * ∏ a, Cc a := h + _ ≤ (‖inverseNormalizer‖ * maskCap * Real.exp (slicedJointDensityLogBudget O m Pcap)) * εgrid + + (‖inverseNormalizer‖ * maskCap * ε) * ∏ a, Cc a := + add_le_add (mul_le_mul_of_nonneg_right hc hεgrid) le_rfl + _ = _ := by ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal + +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 [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (rowSets : Fin m → Finset (Finset (Fin 1))) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset (Fin 1) // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowTypes j → Finset (Fin 1))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit rowTypes I n grid +local notation "baseVolume" => (allocatedFullGridNaturalVolume B U b S rowSets * + coveredJetArrayScale (O := rowTypes) U * ∏ a, allocatedLongJetOutputScale B U b S (O := rowTypes) a) + +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (q d period : ℕ) [NeZero d] [NeZero period] +variable (r : ℝ≥0) (hr : 0 < r) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "region" => mixedCoveredJetRegion (E := E) U o b d + (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr +local notation "inverseNormalizer" => ((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹ + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin 1)) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)))) ≤ 1 / 4) + +variable (hrows : ∀ j t, t ∈ rowSets j) +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (hσ : ∀ j, 0 < σ j) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (label : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin 1) → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := Fin 1) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = label))) +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell grid +local notation "gridAxes" => {a // grid a} +local notation "ideal" => allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width + +include hR hC hchart hbudget in + +theorem exists_allocated_supported_sliced_uniform_source_model + (hq : 0 < q) {δg : ℝ} (hδg : 0 < δg) + (hdenseg : ∀ tg, δg * allocatedPrincipalSides B U b S tg ≤ (H tg : ℝ)) + (Tg : ℕ) (hQTg : (((Fintype.card (Fin 1) + 1) * q : ℕ) : ℝ) / δg ≤ Tg) + (hstep : ∀ tg, 0 < step tg) + (Ag : ℝ≥0) (hAg : LipschitzWith Ag Real.smoothTransition) (Pg : ℝ) (hPg : 1 ≤ Pg) + (hcP : scalarCubePrimitiveEnvelope Empty Ag 16 (128 * probabilityProfileLipschitz) 1 ≤ Pg) + (hsP : scalarCubePrimitiveEnvelope (Fin 1) Ag 1 0 q ≤ Pg) + (hstride : ∀ tg, ((step tg * q : ℕ) : ℝ) ≤ Pg) + (hrowDegree : ∀ j tg, tg ∈ rowSets j → tg.card ≤ j.val + 1) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (rowSets j).card + ((layerTailDegree m + 1) * (rowSets j).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (rowSets j).card + ((j.val + 1) * (rowSets j).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg tg pg Eg εgrid : ℝ} + (hDg : 0 ≤ Dg) (hvg : 0 ≤ vg) (hwg : 0 ≤ wg) (htg : 0 ≤ tg) (hpg : 0 ≤ pg) (hEg : 0 ≤ Eg) + (hcube : (Fintype.card (Fin 1) : ℝ) ≤ Dg) (hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (hrowsD : ∀ j, ((rowSets j).card : ℝ) ≤ Dg) + (htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (hRv : ∀ j, R j ≤ Real.exp vg) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (hδw : δg⁻¹ ≤ Real.exp wg) (hTg : (Tg : ℝ) ≤ Real.exp tg) + (hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (hPp₀ : Pg ≤ Real.exp pg) (haxes : (Fintype.card gridAxes : ℝ) ≤ Dg) + (hεgrid : 0 < εgrid) (hεgridEg : εgrid⁻¹ ≤ Real.exp Eg) (hσgrid : ∀ j, σ j ≤ 1) + (T : Fin m → ℝ) (hT : ∀ j, 0 ≤ T j) (h4 : ∀ j, 4 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin 1) * ((Fintype.card (Fin 1) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (hradius : ∀ j, (rowSets j).card * T j ≤ (r : ℝ)) (hσ1 : ∀ j, σ j ≤ 1) + (O : ℕ) (hO : Fintype.card (OneCubeActiveRow grid) ≤ O) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ P ε : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hP : 0 ≤ P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + {Pcap : ℝ} (hPcap : 0 ≤ Pcap) (haPcap : a⁻¹ ≤ Real.exp Pcap) (hδPcap : δ⁻¹ ≤ Real.exp Pcap) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (hε : 0 < ε) (hHP : (4 : ℝ) ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) : + let p := slicedGridGeometryLog Dg vg wg tg + pg + let L := fun j : Fin m => fun e : ℝ => slicedGridSiteLog j.val (rowSets j).card + ((layerTailDegree m + 1) * (rowSets j).card) ((j.val + 1) * (rowSets j).card) Dg p e + let Cp := ∑ j, (L j 0 + Dg * (vg + 1)) + let Eg' := uniformProductAccuracyLog Dg Cp Eg + Dg * (vg + 1) + 1 + let Op := ∑ j, (siteExponentialOutputLog (Fintype.card (Finset (Fin 1))) (L j Eg') + (Dg + 1) * (vg + 1)) + ∃ e : gridAxes → ScalarSiteExpansion.{0,0} (Finset (Fin 1)), + (∀ a, (e a).Bounds (Real.exp Op) (Real.exp Op) (Real.exp Op) + ⟨Real.exp Op, Real.exp_nonneg _⟩ (Real.exp (slicedGridGeometryLog Dg vg wg tg + (Dg + vg + 8)))) ∧ + ∀ (x : G → IntegerScalarCubeBox (Fin 1) S.value) + (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin 1) (allocatedPrincipalSides B U b S)) + (_hperiod : ∀ j, integerScalarLattice {t : Finset (Fin 1) // t ∈ rowSets j} (period : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))).mulVecLin.range) + {M : ℝ} (_hM : 1 ≤ M) + (_hm : ∀ j z, 0 ≤ allocatedIntegerKernelMask B U b S x + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j q + (integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j + (principalAxisRestrict (fun a => ¬allocatedGridAxis (I := I) U b S.value a) y₀)) q) z ∧ + allocatedIntegerKernelMask B U b S x + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j q + (integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j + (principalAxisRestrict (fun a => ¬allocatedGridAxis (I := I) U b S.value a) y₀)) q) z ≤ M) + + (_hu₀ : (containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell + (allocatedGridAxis (I := I) U b S.value)).weight (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) ≠ 0) + (_hmodulus : ∀ j, integerScalarLattice {t : Finset (Fin 1) // t ∈ rowSets j} (q : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))).mulVecLin.range) + (_hy₀ : ∀ j, IntegerScalarCube (allocatedPrincipalSides B U b S j) (fun a => (y₀ j a : ℤ))), + let cutoffLip : ℝ≥0 := Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / 4 + let Q := slicedJointDensityLogBudget O m P + P + let A := Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8) + Q) + let maskCap := M ^ Fintype.card (LayerSamplerAxis I n) * coefficientDeckPeriodCap rowTypes E period + ∃ k : ℕ, (k : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + (Fintype.card (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) : ℝ) ≤ + Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8)) ∧ + ∃ (a : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → ℂ) + (f : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → Finset (Fin 1) → (LayerSamplerAxis I n → ℝ) → ℂ), + (∑ i, ‖a i‖) ≤ A ∧ + (∀ i s v, ‖f i s v‖ ≤ 1) ∧ + (∀ i s, LipschitzWith (⟨Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12), Real.exp_nonneg _⟩ + cutoffLip) (f i s)) ∧ + (∀ i s v, (∃ j, (4 : ℝ) < |v j|) → f i s v = 0) ∧ + (∑ label : Finset (Fin 1) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)), ∑ i, + ‖allocatedProductMaskedIdealCoefficient B U b S rowSets x y₀ q d period a label i‖) ≤ + ‖inverseNormalizer‖ * ((Fintype.card ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) : ℝ) ^ Fintype.card (Finset (Fin 1)) * maskCap * A) ∧ + (∀ label i s y, + ‖allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s) y‖ ≤ 1) ∧ + (∀ label i s, Measurable (allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s))) ∧ + Measurable (allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f) ∧ + (∀ y : EuclideanJetLayers U rowTypes, + ‖allocatedProductFullGridPrefactor B U b S rowSets d r hr x hb o bW q y₀ + (allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width) y - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y‖ ≤ + ‖inverseNormalizer‖ * maskCap * ε) ∧ + (∀ y : EuclideanJetLayers U rowTypes, + ‖((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q ideal y) : ℂ) - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y * + allocatedFullGridChartModel B U b S rowSets d hb o bW e y‖ ≤ + ‖inverseNormalizer‖ * maskCap * + (Real.exp (slicedJointDensityLogBudget O m Pcap) * εgrid + ε * ∏ _a : gridAxes, Real.exp Op)) ∧ + ∀ (μ : Measure (EuclideanJetLayers U rowTypes)) [IsProbabilityMeasure μ] + (φ : EuclideanJetLayers U rowTypes → ℂ), Measurable φ → (∀ y, ‖φ y‖ ≤ 1) → + Integrable (fun y => ((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile + B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q + (allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width) y) : ℂ)) μ ∧ + ‖(∫ y, ((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile + B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q + (allocatedSlicedRowIdeal B U b S rowSets hR hrows hB lower width) y) : ℂ) * φ y ∂μ) - + ∫ y, (allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y * + allocatedFullGridChartModel B U b S rowSets d hb o bW e y) * φ y ∂μ‖ ≤ + ‖inverseNormalizer‖ * maskCap * + (Real.exp (slicedJointDensityLogBudget O m Pcap) * εgrid + + ε * ∏ _a : gridAxes, Real.exp Op) := by + intro p L Cp E' Op + obtain ⟨e, heb, he⟩ := exists_allocatedSupportedSliced_full_grid_site_expansion B U b hR hσ S + rowSets H step c hH hsubset q label hcell hq hδg hdenseg Tg hQTg hstep Ag hAg Pg hPg + hcP hsP hstride hrowDegree hBa hBi hDg hvg hwg htg hpg hEg hcube hdegree hrowsD htail hblocks + hRv hRi hδw hTg hcoeff hPp₀ haxes hεgrid hεgridEg hσgrid + refine ⟨e, heb, ?_⟩ + intro x y₀ hperiod M hM hm hu₀ hmodulus hy₀ + obtain ⟨k, hk, hcard, a₀, f, ha₀, hf, hLf, hs, hc, hfn, hfm, hmeas, hlong, herr⟩ := + exists_allocated_supported_sliced_source_model B U b S rowSets x y₀ q d period r hr hb o bW + hperiod hM hm hR C hC hchart hbudget hrows hB lower width hσ H step c hH hsubset label hcell + hu₀ hmodulus hy₀ T hT h4 hsource hradius hσ1 e hεgrid.le (he x) heb + O hO hwidth ha hδ hP haP hδP hPcap haPcap hδPcap hprincipal hw hl hε hHP hεP + + refine ⟨k, hk, hcard, a₀, f, ha₀, hf, hLf, hs, hc, hfn, hfm, hmeas, hlong, herr, ?_⟩ + intro μ hμ φ hφ hφb + exact allocatedFiniteSourceModel_test_error B U b S rowSets x y₀ q d period r hr hb o bW μ + a₀ f hLf hf e heb _ + (allocatedWholeMaskedSlicedProfile_mean_measurable B U b hR hσ S rowSets hrows x + hb o bW d hB lower width gridLaw + (fun u => principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q) + herr φ hφ hφb + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +private theorem oneCubeAllRows (m : ℕ) : + ∀ (j : Fin m) (t : Finset (Fin 1)), t ∈ boundedBooleanJetRows (Fin 1) (j.val + 1) := by + intro j t + rw [boundedBooleanJetRows_oneCube (j.val + 1) (by omega)] + exact Finset.mem_univ t + +open MeasureTheory Module Submodule _root_.Set _root_.OAI.Set +open scoped BigOperators Classical NNReal +attribute [local instance] ScalarSiteExpansion.termFinite + +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 [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin 1) (Fin.val j + 1)) + +local notation "rowTypes" => (fun j : Fin m => {t : Finset (Fin 1) // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowTypes j → Finset (Fin 1))) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "split" => coefficientJetAxisSplit rowTypes I n grid +local notation "baseVolume" => (allocatedFullGridNaturalVolume B U b S rowSets * + coveredJetArrayScale (O := rowTypes) U * ∏ a, allocatedLongJetOutputScale B U b S (O := rowTypes) a) + +variable {E : Fin m → Type*} [∀ j, Fintype (E j)] +variable (q d period : ℕ) [NeZero d] [NeZero period] +variable (r : ℝ≥0) (hr : 0 < r) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "chart" => mixedCoveredJetChart U o b hb bW d +local notation "region" => mixedCoveredJetRegion (E := E) U o b d + (fun j (_ : rowTypes j) => standardLatticeClosedQuarterBox (J j)) +local notation "cutoff" => allocatedProductSiteCutoff B U b S rowSets o hb bW d r hr +local notation "inverseNormalizer" => ((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹ + +variable (hR : ∀ j, 0 < R j) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) +variable (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) +variable (hbudget : ∀ j : Fin m, ((boundedBooleanJetRows (Fin 1) (j.val + 1)).card + 1 : ℝ) * (Fintype.card (Finset (Fin 1)) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)))) ≤ 1 / 4) + +variable (hB : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, 4 ≤ Fintype.card (B a.val)) +variable (lower width : ∀ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (hσ : ∀ j, 0 < σ j) +variable (H step : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U b S j : ℤ)) +variable (label : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin 1) → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := Fin 1) B (layerSamplerDegree I n) H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = label))) +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell grid +local notation "gridAxes" => {a // grid a} +local notation "ideal" => allocatedSlicedRowIdeal B U b S rowSets hR (oneCubeAllRows m) hB lower width + +include hR hC hchart hbudget in +theorem exists_allocated_supported_sliced_uniform_physical_source + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) (hK : ∀ j, (R j)⁻¹ ≤ K) + (Qgrid : ℝ≥0) (hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U b S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U b S a).1 (allocatedGridIntegerAxis B U b S a).2) : ℝ) + 1) ≤ Qgrid) + (hq : 0 < q) {δg : ℝ} (hδg : 0 < δg) + (hdenseg : ∀ tg, δg * allocatedPrincipalSides B U b S tg ≤ (H tg : ℝ)) + (Tg : ℕ) (hQTg : (((Fintype.card (Fin 1) + 1) * q : ℕ) : ℝ) / δg ≤ Tg) + (hstep : ∀ tg, 0 < step tg) + (Ag : ℝ≥0) (hAg : LipschitzWith Ag Real.smoothTransition) (Pg : ℝ) (hPg : 1 ≤ Pg) + (hcP : scalarCubePrimitiveEnvelope Empty Ag 16 (128 * probabilityProfileLipschitz) 1 ≤ Pg) + (hsP : scalarCubePrimitiveEnvelope (Fin 1) Ag 1 0 q ≤ Pg) + (hstride : ∀ tg, ((step tg * q : ℕ) : ℝ) ≤ Pg) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (rowSets j).card + ((layerTailDegree m + 1) * (rowSets j).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (rowSets j).card + ((j.val + 1) * (rowSets j).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg tg pg Eg εgrid : ℝ} + (hDg : 0 ≤ Dg) (hvg : 0 ≤ vg) (hwg : 0 ≤ wg) (htg : 0 ≤ tg) (hpg : 0 ≤ pg) (hEg : 0 ≤ Eg) + (hcube : (Fintype.card (Fin 1) : ℝ) ≤ Dg) (hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (hrowsD : ∀ j, ((rowSets j).card : ℝ) ≤ Dg) + (htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (hRv : ∀ j, R j ≤ Real.exp vg) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (hδw : δg⁻¹ ≤ Real.exp wg) (hTg : (Tg : ℝ) ≤ Real.exp tg) + (hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (hPp₀ : Pg ≤ Real.exp pg) (haxes : (Fintype.card gridAxes : ℝ) ≤ Dg) + (hεgrid : 0 < εgrid) (hεgridEg : εgrid⁻¹ ≤ Real.exp Eg) (hσgrid : ∀ j, σ j ≤ 1) + (T : Fin m → ℝ) (hT : ∀ j, 0 ≤ T j) (h4 : ∀ j, 4 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin 1) * ((Fintype.card (Fin 1) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (hradius : ∀ j, (rowSets j).card * T j ≤ (r : ℝ)) (hσ1 : ∀ j, σ j ≤ 1) + (O : ℕ) (hO : Fintype.card (OneCubeActiveRow grid) ≤ O) + (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) + {a δ P ε : ℝ} (ha : 0 < a) (hδ : 0 < δ) (hP : 0 ≤ P) + (haP : a⁻¹ ≤ Real.exp P) (hδP : δ⁻¹ ≤ Real.exp P) + {Pcap : ℝ} (hPcap : 0 ≤ Pcap) (haPcap : a⁻¹ ≤ Real.exp Pcap) (hδPcap : δ⁻¹ ≤ Real.exp Pcap) + (hprincipal : ∀ j : {a // ¬grid a}, a ≤ unitProfilePrincipalSize (B := B) j.val) + (hw : ∀ j p, δ ≤ width j p) (hl : ∀ j p, 0 ≤ lower j p) + (hε : 0 < ε) (hHP : (4 : ℝ) ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) : + let p := slicedGridGeometryLog Dg vg wg tg + pg + let L := fun j : Fin m => fun e : ℝ => slicedGridSiteLog j.val (rowSets j).card + ((layerTailDegree m + 1) * (rowSets j).card) ((j.val + 1) * (rowSets j).card) Dg p e + let Cp := ∑ j, (L j 0 + Dg * (vg + 1)) + let Eg' := uniformProductAccuracyLog Dg Cp Eg + Dg * (vg + 1) + 1 + let Op := ∑ j, (siteExponentialOutputLog (Fintype.card (Finset (Fin 1))) (L j Eg') + (Dg + 1) * (vg + 1)) + ∃ e : gridAxes → ScalarSiteExpansion.{0,0} (Finset (Fin 1)), + (∀ a, (e a).Bounds (Real.exp Op) (Real.exp Op) (Real.exp Op) + ⟨Real.exp Op, Real.exp_nonneg _⟩ (Real.exp (slicedGridGeometryLog Dg vg wg tg + (Dg + vg + 8)))) ∧ + ∀ (x : G → IntegerScalarCubeBox (Fin 1) S.value) + (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin 1) (allocatedPrincipalSides B U b S)) + (d period : ℕ) [NeZero d] [NeZero period] (_hdiv : period ∣ d) + (_hperiod : ∀ j, integerScalarLattice {t : Finset (Fin 1) // t ∈ rowSets j} (period : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))).mulVecLin.range) + {M : ℝ} (_hM : 1 ≤ M) + (_hm : ∀ j z, 0 ≤ allocatedIntegerKernelMask B U b S x + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j q + (integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j + (principalAxisRestrict (fun a => ¬allocatedGridAxis (I := I) U b S.value a) y₀)) q) z ∧ + allocatedIntegerKernelMask B U b S x + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j q + (integerResidueMatrix (allocatedNonkernelJetMatrix B U b S x + (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) + (fun j => (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))) j + (principalAxisRestrict (fun a => ¬allocatedGridAxis (I := I) U b S.value a) y₀)) q) z ≤ M) + + (_hu₀ : (containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) H step c (allocatedPrincipalSides_pos B U b S) hH hsubset q label hcell + (allocatedGridAxis (I := I) U b S.value)).weight (principalAxisRestrict (allocatedGridAxis (I := I) U b S.value) y₀) ≠ 0) + (_hmodulus : ∀ j, integerScalarLattice {t : Finset (Fin 1) // t ∈ rowSets j} (q : ℤ) ≤ + (scalarKernelIntegerJet x (j.val + 1) (Subtype.val : {t : Finset (Fin 1) // t ∈ rowSets j} → Finset (Fin 1))).mulVecLin.range) + (_hy₀ : ∀ j, IntegerScalarCube (allocatedPrincipalSides B U b S j) (fun a => (y₀ j a : ℤ))), + let cutoffLip : ℝ≥0 := Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / 4 + let Q := slicedJointDensityLogBudget O m P + P + let A := Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8) + Q) + let maskCap := M ^ Fintype.card (LayerSamplerAxis I n) * coefficientDeckPeriodCap rowTypes E period + ∃ k : ℕ, (k : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + (Fintype.card (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) : ℝ) ≤ + Real.exp ((2 * Fintype.card (LayerSamplerAxis I n) : ℕ) * (4 * Q + 8)) ∧ + ∃ (a : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → ℂ) + (f : (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → Finset (Fin 1) → (LayerSamplerAxis I n → ℝ) → ℂ), + (∑ i, ‖a i‖) ≤ A ∧ + (∀ i s v, ‖f i s v‖ ≤ 1) ∧ + (∀ i s, LipschitzWith (⟨Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12), Real.exp_nonneg _⟩ + cutoffLip) (f i s)) ∧ + (∀ i s v, (∃ j, (4 : ℝ) < |v j|) → f i s v = 0) ∧ + (∑ label : Finset (Fin 1) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)), ∑ i, + ‖allocatedProductMaskedIdealCoefficient B U b S rowSets x y₀ q d period a label i‖) ≤ + ‖inverseNormalizer‖ * ((Fintype.card ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period)) : ℝ) ^ Fintype.card (Finset (Fin 1)) * maskCap * A) ∧ + (∀ label i s y, + ‖allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s) y‖ ≤ 1) ∧ + (∀ label i s, Measurable (allocatedMaskedSiteChartFactor B U b S o hb bW d r hr period label (f i s))) ∧ + Measurable (allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f) ∧ + (∀ y : EuclideanJetLayers U rowTypes, + ‖allocatedProductFullGridPrefactor B U b S rowSets d r hr x hb o bW q y₀ + (allocatedSlicedRowIdeal B U b S rowSets hR (oneCubeAllRows m) hB lower width) y - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y‖ ≤ + ‖inverseNormalizer‖ * maskCap * ε) ∧ + (∀ y : EuclideanJetLayers U rowTypes, + ‖((gridLaw).mean (fun u => allocatedWholeMaskedCoveredProfile B U b hR hσ S x rows hb o bW d + (principalAxisJoin grid u (principalAxisRestrict (fun a => ¬grid a) y₀)) q ideal y) : ℂ) - + allocatedProductChartIdealApproximation B U b S rowSets x y₀ q d period r hr hb o bW a f y * + allocatedFullGridChartModel B U b S rowSets d hb o bW e y‖ ≤ + ‖inverseNormalizer‖ * maskCap * + (Real.exp (slicedJointDensityLogBudget O m Pcap) * εgrid + ε * ∏ _a : gridAxes, Real.exp Op)) ∧ + ∀ {X : Type*} (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (hm : ∀ j e, coefficients (poly j) e ∈ U j), + let Lcoord : ℝ≥0 := K * ∑ j, Cforward j * Fintype.card (J j) + let Llong : ℝ≥0 := (Fintype.card (LayerSamplerAxis I n) * normalizedSiteCutoffBound / (2 * r)) * Lcoord + + max ((⟨Real.exp (Fintype.card (LayerSamplerAxis I n) + 6 * Q + 12), Real.exp_nonneg _⟩ + cutoffLip) * Lcoord * period) (4 * period) + let Lprimitive : ℝ≥0 := ⟨Real.exp Op, Real.exp_nonneg Op⟩ + let Lgrid : ℝ≥0 := max ((((Fintype.card gridAxes : ℝ≥0) * Lprimitive) * Qgrid) * + Lcoord * Lprimitive ^ Fintype.card gridAxes) (4 * Lprimitive ^ Fintype.card gridAxes) + ∃ g : (Finset (Fin 1) → ((∀ j, Fin (n j) → ZMod period) × (∀ j, E j → ZMod period))) → + (Finset (Fin 1) × LayerSamplerAxis I n → Fin k) → (∀ a, (e a).Term) → Finset (Fin 1) → + (((JetAmbientIndex (fun _ : Fin m => Unit) J → UnitAddCircle) × ((Σ j, J j) → UnitAddCircle)) × + ((Σ j, J j) → UnitAddCircle)) → ℂ, + (∀ label i kg t, LipschitzWith (Llong + Lgrid) (g label i kg t)) ∧ + (∀ label i kg t z, ‖g label i kg t z‖ ≤ 1) ∧ + AllocatedModelPhysicalExpansionIdentity B U b S x y₀ q d period r hr hb o bW e a f poly hm g := by + intro p L Cp E' Op + have hrowDegree : ∀ (j : Fin m) (tg : Finset (Fin 1)), + tg ∈ boundedBooleanJetRows (Fin 1) (j.val + 1) → tg.card ≤ j.val + 1 := by + intro j tg htg + exact (mem_boundedBooleanJetRows (j.val + 1) tg).mp htg + obtain ⟨e, heb, he⟩ := exists_allocatedSupportedSliced_full_grid_site_expansion B U b hR hσ S + rowSets H step c hH hsubset q label hcell hq hδg hdenseg Tg hQTg hstep Ag hAg Pg hPg + hcP hsP hstride hrowDegree hBa hBi hDg hvg hwg htg hpg hEg hcube hdegree hrowsD htail hblocks + hRv hRi hδw hTg hcoeff hPp₀ haxes hεgrid hεgridEg hσgrid + refine ⟨e, heb, ?_⟩ + intro x y₀ d period hd hper hdiv hperiod M hM hm hu₀ hmodulus hy₀ + obtain ⟨k, hk, hcard, a₀, f, ha₀, hf, hLf, hs, hc, hfn, hfm, hmeas, hlong, herr⟩ := + exists_allocated_supported_sliced_source_model B U b S rowSets x y₀ q d period r hr hb o bW + hperiod hM hm hR C hC hchart hbudget (oneCubeAllRows m) hB lower width hσ H step c hH hsubset label hcell + hu₀ hmodulus hy₀ T hT h4 hsource hradius hσ1 e hεgrid.le (he x) heb + O hO hwidth ha hδ hP haP hδP hPcap haPcap hδPcap hprincipal hw hl hε hHP hεP + refine ⟨k, hk, hcard, a₀, f, ha₀, hf, hLf, hs, hc, hfn, hfm, hmeas, hlong, herr, ?_⟩ + intro X poly hp hm + exact exists_allocated_finite_model_uniform_physical_expansion B U b S x y₀ q d period r hr hb o bW e + hdiv hR C hC hchart hbudget Cforward hforward K hK a₀ f hLf hf heb Qgrid hQgrid poly hp hm + (period : ℝ≥0) ⟨Real.exp Op, Real.exp_nonneg Op⟩ le_rfl (fun _ => le_rfl) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedTestUniformSpatialComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedTestUniformSpatialComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..d909886719c60287f8ef34ad0067ae45e2d15434 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedTestUniformSpatialComparison.lean @@ -0,0 +1,97 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedTestUniformNormalizedComparison + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel Module Submodule MeasureTheory +open scoped BigOperators Classical NNReal + +theorem allocatedTestUniformSpatiallyNormalizedTupleComparison (m dim : ℕ) : + allocatedTestUniformSpatiallyNormalizedTupleStatement m dim true := by + obtain ⟨A, Amass, hA, hAmass, hactual⟩ := allocatedTestUniformActualNormalizedTupleComparison m dim + unfold allocatedTestUniformSpatiallyNormalizedTupleStatement + refine ⟨A, Amass, hA, hAmass, ?_⟩ + intro G _ _ I _ _ n B _ _ J _ U b R σ S x P hP hG hL M hM selection hx hdim + obtain ⟨d, hd, hdb, hconstruct⟩ := hactual B U b S x hP hG hL hM selection hx hdim + let : NeZero d := ⟨hd.ne'⟩ + refine ⟨d, hd, hdb, ?_⟩ + intro _ _ _ _ _ hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ _ _ ν _ _ + O rows density cap cover ξ + obtain ⟨g, hgc, hgb, hgi, hgm, hglaw, hprojection, hdata⟩ := + hconstruct hb o hR hσ C V hC hV hσ1 Cinv hCinv hchart hsmall μ ν + refine ⟨g, hgc, hgb, hgi, hgm, hglaw, hprojection, ?_⟩ + intro hm hvars hRP hσP hcount hI hn hJ hAP hCP hVP X _ _ p Etarget hp hEtarget + hvarsp hIp hnp hJp hXp hCp hMp hmsp ξ₀ hξ D hD Perr Pmass hPerr hAccuracy hQ + hnormdim poly hpoly hmem N stride hs Rrank W τ hW hτ l δ mesh + hWScale hWP hξP hτP hstride hsize hrank hRank hspatialSize + hbudget base cells hcells bases hbases + Kcov _ bW Pc T hPc hPcErr hT hMP hRupper hRi hσi hcountc hstridec hlarge + widths baseDensity Z + let C₀ := 1 + (S.value : ℝ) + W + let ρ := normalizedTupleResolution X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p Etarget C₀ W cap (allocatedPhysicalEntryBudget B U b S (fun _ => 0)) + have hGp : (Fintype.card G : ℝ) ≤ p := + (Nat.cast_le.mpr (Fintype.card_le_of_embedding + (Function.Embedding.inl : G ↪ LayerSamplerVariables G I n B))).trans hvarsp + have hmsp' : ((m + 1 : ℕ) : ℝ) ≤ p := by push_cast at hmsp ⊢; linarith + have hdimsp : ((dim + 1 : ℕ) : ℝ) ≤ p := by + have h : ((dim + 1 : ℕ) : ℝ) ≤ ((m + 2 : ℕ) : ℝ) := by exact_mod_cast (by omega : dim + 1 ≤ m + 2) + exact h.trans hmsp + have hentry : 0 ≤ allocatedPhysicalEntryBudget B U b S (fun _ => 0) := + (by norm_num : (0 : ℝ) ≤ 1).trans (allocatedPhysicalEntryBudget_one_le B U b S (fun _ => 0)) + have hcap : 0 ≤ cap := by dsimp [cap]; positivity + obtain ⟨_, _, _, hPerrBudget⟩ := + allocatedScalarSamplingBudget_bounds m dim A hP (hP.trans hPerr) + have hPPmass : P ≤ Pmass := hPerr.trans (hPerrBudget.trans hQ) + obtain ⟨hl, hMassl, hC₀, hLC, hWC, hC₀l, hcapl, hentryl, hWl, hprofilel⟩ := + allocatedSpatialLateInputBounds B U b S C V hP hPPmass hm hvars hR hσ hRP hσP + hcount hI hn hJ hAP hL hCP hVP hW hWP + have hspatial (t : X) : 8 * (1 + W) * (stride t : ℝ) * ρ ≤ (ξ₀ * τ) * (N t : ℝ) := by + exact normalizedTupleSpatialSize X (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + hp hEtarget hl hM hmsp' hdimsp hGp hXp hMp (by linarith) hW hcap hentry + hC₀l hWl hcapl hentryl hprofilel (Nat.cast_nonneg _) + ((hstride t).trans (Real.exp_le_exp.mpr hMassl)) hτ + (by simpa only [one_div] using hτP.trans (Real.exp_le_exp.mpr hMassl)) (hspatialSize t) + obtain ⟨_, hξ1, _, hchoices⟩ := normalizedTupleSpatialChoices + (N := PrincipalTupleIndex B (layerSamplerDegree I n)) (X := X) (m := m) + selection hM hp hEtarget hmsp' hdimsp hGp hXp hMp + obtain ⟨hδ, _, hmesh, hρ, hmeshSize, hρ8, hρshift, hρmove, hboundary, hsite⟩ := + hchoices (C₀ := C₀) (W := W) (L := (S.value : ℝ)) (Cg := cap) + (Centry := allocatedPhysicalEntryBudget B U b S (fun _ => 0)) + (by linarith) hW (by exact_mod_cast S.positive) hcap hentry hD hWScale + have hρshift' : 2 * (Fintype.card (Option (LayerSamplerVariables G I n B)) * + (2 * allocatedPhysicalEntryBudget B U b S (fun _ => 0))) ≤ ρ := by + simpa only [mul_assoc] using hρshift + have hEplus : 0 ≤ Etarget + 2 := by linarith + have heq : (Etarget + 2) + 1 = Etarget + 3 := by ring + have hAccuracy' : allocatedCoefficientAccuracyLog m p ((Etarget + 2) + 1) ≤ Perr := by + simpa only [heq] using hAccuracy + have hlarge' := hlarge + rw [← heq] at hlarge' + obtain ⟨hmass, hnormal, hN, modulus, hmodulus, hrest⟩ := + hdata hm hvars hRP hσP hcount hI hn hJ hAP hCP hVP hp hEplus + hvarsp hIp hnp hJp hXp hCp hMp hD hPerr hAccuracy' hQ hnormdim + poly hpoly hmem N stride hs hW hτ hξ hξ1 hρ hWScale hWP hξP hτP hstride + hsize hrank hRank hspatial hρ8 hρshift' hbudget hC₀ hLC hWC hmeshSize + hδ.le hρmove hmesh base cells hcells bases hbases bW + hPc hPcErr hT hMP hRupper hRi hσi hcountc hstridec hlarge' + let : NeZero modulus := ⟨hmodulus.ne'⟩ + obtain ⟨hmod, hspatialPeriod, hperiod, s, hsA, hi, hrest⟩ := hrest + obtain ⟨hRefined, hdiv, hbound, hlengths, reference, residue, href, hr, hcompare⟩ := hrest + let : NeZero (residueRefinedPeriod modulus stride) := ⟨hRefined.ne'⟩ + refine ⟨hmass, hnormal, hN, modulus, hmodulus, hmod, hspatialPeriod, hperiod, + s, hsA, hi, hRefined, hdiv, hbound, hlengths, reference, residue, href, hr, ?_⟩ + intro test htest + exact allocatedRefinedTupleDifference_exp_bound B U b hR hσ S x rows X hM selection hx + modulus s hsA stride reference residue hb o bW d g N hN hW hτ hξ C₀ ρ δ mesh + base cells hmass (physicalCubeEuclideanSample U d poly hmem) test cap Z + hnormal.2.1.1 (hcompare test htest) hboundary (hsite modulus hmod) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedWindowMixedSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedWindowMixedSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..75a90d2d9f2145e3dc07ea46a4eac59cc9aa56d4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedWindowMixedSupport.lean @@ -0,0 +1,111 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedWindowPrefactor + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical + +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 (b : ∀ j, 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 b R σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (rowSets : Fin m → Finset (Finset α)) +variable {E : Fin m → Type*} (d : ℕ) +variable (x : G → IntegerScalarCubeBox α S.value) (q : ℕ) +variable (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) α (allocatedPrincipalSides B U b S)) +variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) + (allocatedPrincipalSides B U b S) (allocatedPrincipalSides_pos B U b S)).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = principalResidueLabel q y₀))) + +local notation "O" => (fun j : Fin m => {t : Finset α // t ∈ rowSets j}) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset α)) +local notation "grid" => allocatedGridAxis (I := I) U b S.value +local notation "active" => allocatedActiveGrid B U b S +local notation "split" => coefficientJetAxisSplit O I n grid +local notation "laws" => allocatedSupportedGridJetPMF B U b hR hσ S x rows q (principalResidueLabel q y₀) hcell + +variable (T : Fin m → ℝ) +variable (hTi : ∀ j, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ (j.val + 1)) ≤ T j) +variable (hTw : ∀ j i, allocatedSiteCoefficientRadius (G := G) B rowSets ⟨j, i⟩ + 1 ≤ T j) + +include hTi hTw in +theorem allocatedWindowMixed_coordinate_bounds (hσ1 : ∀ j, σ j ≤ 1) + (z : MixedCoveredJetSource I O E n d) + (hw : allocatedActiveWindowCondition B U b S rowSets d z) + (hi : (∏ a : {a : {a // grid a} // ¬active a}, (laws a.val ((split z.1).1 a.val)).toReal) ≠ 0) + (hl : ∀ a : {a // ¬grid a}, ∀ t : O a.val.1, + |allocatedLongJetRealCoordinates B U b S ((split z.1).2) ⟨a, t⟩| ≤ T a.val.1 * R a.val.1) + (j : Fin m) (t : O j) : + (∀ i, |(z.1 j).1 i t| ≤ T j * R j) ∧ + (∀ i, |((z.1 j).2 i t : ℝ) / basisAxisScale (b j) i| ≤ T j * R j) := by + constructor + · intro i + exact hl ⟨⟨j, Sum.inl i⟩, by change ¬False; exact not_false⟩ t + · intro i + by_cases hg : grid ⟨j, Sum.inr i⟩ + · let a : {a // grid a} := ⟨⟨j, Sum.inr i⟩, hg⟩ + by_cases ha : active a + · have hwn := hw ⟨a, ha⟩ + change (z.1 j).2 i ∈ naturalScaleIntegerWindow (rowSets j) + (allocatedSiteCoefficientRadius (G := G) B rowSets ⟨j, i⟩) + (allocatedPrincipalGridScale (G := G) B U b (R := R) j i) at hwn + exact (allocatedActiveWindow_scaled_bound B U b hR S rowSets j i ha _ hwn t).trans + (mul_le_mul_of_nonneg_right (hTw j i) (hR j).le) + · have hp : (laws a ((split z.1).1 a)).toReal ≠ 0 := by + intro hzero + exact hi (Finset.prod_eq_zero (Finset.mem_univ ⟨a, ha⟩) hzero) + exact (allocatedSupportedGridJetPMF_scaled_support_bound B U b hR hσ S x rows q + (principalResidueLabel q y₀) hcell j (hσ1 j) i hg ((z.1 j).2 i) hp t).trans + (mul_le_mul_of_nonneg_right (hTi j) (hR j).le) + · exact hl ⟨⟨j, Sum.inr i⟩, hg⟩ t + +variable [∀ j, Fintype (E j)] [NeZero d] +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (f : ((Σ a : {a // ¬allocatedGridAxis (I := I) U b S.value a}, + {t : Finset α // t ∈ rowSets (Sigma.fst (Subtype.val a))}) → ℝ) → ℝ) + +include hTi hTw in +theorem allocatedActiveWindowPrefactor_sites_quarter + (hT : ∀ j, 0 ≤ T j) (hσ1 : ∀ j, σ j ≤ 1) + (hf : ∀ v, f v ≠ 0 → ∀ a : {a // ¬grid a}, ∀ t : O a.val.1, + |v ⟨a, t⟩| ≤ T a.val.1 * R a.val.1) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, (rowSets j).card * (C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j))) ≤ 1 / 4) + (z : MixedCoveredJetSource I O E n d) + (hz : z ∈ mixedCoveredJetRegion U o b d + (fun j (_ : O j) => standardLatticeClosedQuarterBox (J j))) + (hne : allocatedActiveWindowPrefactor B U b S rowSets d hR hσ x hb o bW q y₀ hcell f z ≠ 0) + (s : Finset α) : + mixedCoveredRowsSiteValue rowSets d z s ∈ mixedCoveredJetRegion U o b d + (fun j (_ : Unit) => standardLatticeClosedQuarterBox (J j)) := by + obtain ⟨hw, hi, hl⟩ := allocatedActiveWindowPrefactor_support B U b S rowSets d hR hσ + x hb o bW q y₀ hcell f z hz hne + apply mixedCoveredRowsSiteValue_mem_quarter rowSets U o b d z + (fun j => C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j))) + (fun j => mul_nonneg (hC j) (mul_nonneg (by positivity) (mul_nonneg (hT j) (hR j).le))) + _ hbudget s + intro j t + obtain ⟨hr, hz⟩ := allocatedWindowMixed_coordinate_bounds B U b hR hσ S rowSets d x q y₀ hcell + T hTi hTw hσ1 z hw hi (hf _ hl) j t + exact mixedRealPoint_norm_le (euclideanSubspace (U j)) (b j) (o j) (hC j) + (mul_nonneg (hT j) (hR j).le) (hchart j) _ _ hr hz + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedZeroLayerDetectionTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedZeroLayerDetectionTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..a633df6b8d451c419d84e847805093a12c76db26 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AllocatedZeroLayerDetectionTransport.lean @@ -0,0 +1,82 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedZeroLayerFixedCenterExcess + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical + +namespace AllocatedExternalCandidateSampler + +section + +variable {G X : Type*} [Fintype G] [Fintype X] + {I J : Fin 0 → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin 0 → ℕ} {B : LayerSamplerAxis I n → Type*} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin 0 → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ ξ' : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center center' : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + +theorem changeNarrow_zero_layers + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ stride cells center) (hξ' : 0 < ξ') : + AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ' stride cells center' := by + apply allocatedExternalCandidateSampler_zero_layers B U b S hb o hR hσ poly hm + center' N τ ξ' stride cells A.size_pos A.trim_pos hξ' A.stride_pos A.bases_nonempty + simpa only [allocatedExternalCandidateWidths_zero_layers] using A.smooth_mass_pos + +end + +variable {G X : Type} [Fintype G] [Fintype X] + {I J : Fin 0 → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin 0 → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin 0 → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ ξ' : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center center' : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + +variable [∀ j, IsZLattice ℝ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + +theorem nativeDetection_zero_layers_iff + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ stride cells center) + (A' : AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ' stride cells center') + (degree : ℕ) (pSlice pTest pNative α : ℝ) : + A.NativeDetection degree pSlice pTest pNative α ↔ + A'.NativeDetection degree pSlice pTest pNative α := by + unfold NativeDetection + simp only [law_zero_layers] + unfold physical Path Site sides + generalize_proofs hbox hbase hpos hmass hpos' hmass' + revert hpos hmass hpos' hmass' + rw [allocatedExternalCandidateWidths_zero_layers, allocatedExternalCandidateWidths_zero_layers] + intros + rfl + +end AllocatedExternalCandidateSampler +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AnisotropicSpatialCapBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AnisotropicSpatialCapBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..038c8bc5f3dd1b6bfae151215b3e8e5378aa6d3c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AnisotropicSpatialCapBudget.lean @@ -0,0 +1,209 @@ +import OAI.Combinatorics.Progressions.Probability.AnisotropicSpatialLaw + +namespace OAI + +section + +namespace Erdos3 + +open BooleanCubeKernel + +theorem normalizedIntegerColumns_variable_entry_bound {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (M : Matrix I J ℤ) (T : J → ℝ) (P : I → ℝ) {C : ℝ} + (hP : ∀ i, 0 < P i) (hT : ∀ j, 0 ≤ T j) + (hM : ∀ i j, |(M i j : ℝ)| * T j ≤ C * P i) : + ∀ i j, |normalizedIntegerColumns M T P i j| ≤ C := by + intro i j + rw [normalizedIntegerColumns_entry_div, abs_div, abs_mul, + abs_of_nonneg (hT j), abs_of_pos (hP i)] + exact (div_le_iff₀ (hP i)).mpr (hM i j) + +theorem normalizedIntegerColumns_variable_norm_bound {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (M : Matrix I J ℤ) (T : J → ℝ) (P : I → ℝ) {C : ℝ} + (hP : ∀ i, 0 < P i) (hC : 0 ≤ C) (hT : ∀ j, 0 ≤ T j) + (hM : ∀ i j, |(M i j : ℝ)| * T j ≤ C * P i) : + ‖matrixSupCLM (normalizedIntegerColumns M T P)‖ ≤ Fintype.card J * C := + matrixSupCLM_norm_le _ hC (normalizedIntegerColumns_variable_entry_bound M T P hP hT hM) + +theorem anisotropicSpatialPivot_control {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (root : J → ℤ) (D : Matrix I J ℤ) (s : I ↪ J) {A R L κ : ℝ} + (hA : 0 < A) (hR : 0 < R) (hL : 0 < L) (hκ : 0 < κ) + (hr : ∀ j, |(root j : ℝ)| * R ≤ A) (hD : ∀ i j, |(D i j : ℝ)| ≤ L) + (hminor : κ ≤ |(Matrix.of (fun i j => (D i (s j) : ℝ) / L)).det|) : + (selectedSpatialPivot root D s).det ≠ 0 ∧ + ‖(matrixSupCLM (normalizedIntegerPivot (selectedSpatialPivot root D s) + (anisotropicSpatialScale I A R) (physicalSpatialOutputScale I A R L))).inverse‖ ≤ + physicalSpatialInverseBound I κ := by + have h := physicalCube_pivot_control root D s hA hR hL hκ hr hD hminor + simpa only [physicalCubeCoefficient_pivot, anisotropicSpatialScale_physicalPivot, + physicalSpatialInverseBound] using h + +theorem anisotropicSpatialFree_scaled_bound {I J : Type*} + (root : J → ℤ) (D : Matrix I J ℤ) (s : I ↪ J) {A R L : ℝ} + (hR : 0 ≤ R) (hr : ∀ j, |(root j : ℝ)| * R ≤ A) + (hD : ∀ i j, |(D i j : ℝ)| ≤ L) : + ∀ i j, |(selectedSpatialFreeColumns root D s i j : ℝ)| * R ≤ + physicalSpatialOutputScale I A R L i := by + rintro (i | i) j + · exact hr j.val + · exact mul_le_mul_of_nonneg_right (hD i j.val) hR + +theorem anisotropicSpatial_free_norm_bound {I J N : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] [Fintype N] [DecidableEq N] + (root : J → ℤ) (D : Matrix I J ℤ) (s : I ↪ J) + (C : Matrix (Unit ⊕ I) N ℤ) (Q : N → ℝ) {A R L ξ : ℝ} + (hA : 0 < A) (hR : 0 < R) (hL : 0 < L) (hξ : ξ ≤ 1) + (hQ : ∀ j, 0 ≤ Q j) (hr : ∀ j, |(root j : ℝ)| * R ≤ A) + (hD : ∀ i j, |(D i j : ℝ)| ≤ L) + (hC : ∀ i j, |(C i j : ℝ)| * Q j ≤ ξ * physicalSpatialOutputScale I A R L i) : + ‖matrixSupCLM (normalizedIntegerColumns + (Matrix.fromCols (selectedSpatialFreeColumns root D s) C) + (Sum.elim (fun _ : UnselectedColumn s => R) Q) (physicalSpatialOutputScale I A R L))‖ ≤ + Fintype.card (UnselectedColumn s ⊕ N) := by + have hP := physicalSpatialOutputScale_pos I hA hR hL + have hscale : ∀ j, 0 ≤ Sum.elim (fun _ : UnselectedColumn s => R) Q j := by + rintro (j | j) + · exact hR.le + · exact hQ j + have hcolumns : ∀ i j, + |((Matrix.fromCols (selectedSpatialFreeColumns root D s) C) i j : ℝ)| * + Sum.elim (fun _ : UnselectedColumn s => R) Q j ≤ + 1 * physicalSpatialOutputScale I A R L i := by + intro i j + cases j with + | inl j => + change |(selectedSpatialFreeColumns root D s i j : ℝ)| * R ≤ + 1 * physicalSpatialOutputScale I A R L i + simpa only [one_mul] using anisotropicSpatialFree_scaled_bound root D s hR.le hr hD i j + | inr j => exact (hC i j).trans (mul_le_mul_of_nonneg_right hξ (hP i).le) + simpa only [mul_one] using normalizedIntegerColumns_variable_norm_bound _ _ _ hP zero_le_one hscale hcolumns + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped NNReal + +noncomputable def anisotropicSpatialDensityCap {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) (κ : ℝ) : ℝ := + (Fintype.card (Unit ⊕ I)).factorial * + (physicalSpatialInverseBound I κ) ^ Fintype.card (Unit ⊕ I) * 2 ^ Fintype.card (UnselectedColumn s) + +noncomputable def anisotropicSpatialDensityLip {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) (κ : ℝ) : ℝ := + anisotropicSpatialDensityCap s κ * + ((Fintype.card (UnselectedColumn s) + Fintype.card (Unit ⊕ I) : ℝ) * probabilityProfileLipschitz) * + physicalSpatialInverseBound I κ + +theorem anisotropicSpatialDensityCap_nonneg {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) {κ : ℝ} (hκ : 0 ≤ κ) : 0 ≤ anisotropicSpatialDensityCap s κ := by + unfold anisotropicSpatialDensityCap physicalSpatialInverseBound + positivity + +theorem anisotropicSpatialDensityLip_nonneg {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) {κ : ℝ} (hκ : 0 ≤ κ) : 0 ≤ anisotropicSpatialDensityLip s κ := by + unfold anisotropicSpatialDensityLip anisotropicSpatialDensityCap physicalSpatialInverseBound + positivity + +theorem anisotropicSpatialKernelDensity_bounds {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (root : J → ℤ) (D : Matrix I J ℤ) (s : I ↪ J) {A R L κ : ℝ} + (hA : 0 < A) (hR : 0 < R) (hL : 0 < L) (hκ : 0 < κ) + (hr : ∀ j, |(root j : ℝ)| * R ≤ A) (hD : ∀ i j, |(D i j : ℝ)| ≤ L) + (hminor : κ ≤ |(Matrix.of (fun i j => (D i (s j) : ℝ) / L)).det|) : + let hp := (anisotropicSpatialPivot_control root D s hA hR hL hκ hr hD hminor).1 + let f := anisotropicSpatialKernelDensity s root D hp A R L hA hR hL + (∀ y, |f y| ≤ anisotropicSpatialDensityCap s κ) ∧ + LipschitzWith (Real.toNNReal (anisotropicSpatialDensityLip s κ)) f := by + intro hp f + let M := selectedSpatialPivot root D s + let E := normalizedPivotEquiv M hp (anisotropicSpatialScale I A R) (physicalSpatialOutputScale I A R L) + (anisotropicSpatialScale_pos I hA hR) (physicalSpatialOutputScale_pos I hA hR hL) + have hi : ‖E.symm.toContinuousLinearMap‖ ≤ physicalSpatialInverseBound I κ := by + rw [show E = normalizedPivotEquiv M hp (anisotropicSpatialScale I A R) + (physicalSpatialOutputScale I A R L) (anisotropicSpatialScale_pos I hA hR) + (physicalSpatialOutputScale_pos I hA hR hL) from rfl, normalizedPivotEquiv_inverse_eq] + exact (anisotropicSpatialPivot_control root D s hA hR hL hκ hr hD hminor).2 + constructor + · intro y + have h := pivotOutputDensity_abs_le_uniform E + (matrixSupCLM (normalizedIntegerColumns (selectedSpatialFreeColumns root D s) + (fun _ => R) (physicalSpatialOutputScale I A R L))) + (smoothSplitProfile (UnselectedColumn s) (Unit ⊕ I)) zero_le_one zero_le_one + (smoothSplitProfile_zero_outside _ _) (smoothSplitProfile_norm_le _ _) hi y + simpa only [f, anisotropicSpatialKernelDensity, normalizedFiberDensity, + anisotropicSpatialDensityCap, E, M, mul_one] using h + · apply LipschitzWith.of_dist_le_mul + intro v w + rw [Real.dist_eq, Real.coe_toNNReal _ (anisotropicSpatialDensityLip_nonneg s hκ.le)] + have h := pivotOutputDensity_output_bound_uniform E + (matrixSupCLM (normalizedIntegerColumns (selectedSpatialFreeColumns root D s) + (fun _ => R) (physicalSpatialOutputScale I A R L))) + (smoothSplitProfile_lipschitz (UnselectedColumn s) (Unit ⊕ I)) zero_le_one + (smoothSplitProfile_zero_outside _ _) hi v w + simpa only [f, anisotropicSpatialKernelDensity, normalizedFiberDensity, + anisotropicSpatialDensityLip, anisotropicSpatialDensityCap, E, M, mul_one, + NNReal.coe_mul, NNReal.coe_add, NNReal.coe_natCast, dist_eq_norm, mul_assoc] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel + +def anisotropicSpatialCapLog {A : Type*} [Semiring A] (P : A) : A := + P ^ 3 + 3 * P ^ 2 + 2 * P + +theorem anisotropicSpatialCapLog_nonneg {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ anisotropicSpatialCapLog P := by + unfold anisotropicSpatialCapLog + positivity + +theorem anisotropicSpatialDensityCap_exp_bound {α G : Type*} [Fintype α] [Fintype G] + (selection : α ↪ G) {M : ℕ} {P : ℝ} (hP : 0 ≤ P) (hM : 0 < M) + (hMP : (M : ℝ) ≤ Real.exp P) + (hα : (Fintype.card (Unit ⊕ α) : ℝ) ≤ P) (hG : (Fintype.card G : ℝ) ≤ P) : + anisotropicSpatialDensityCap selection (1 / (M : ℝ)) ≤ Real.exp (anisotropicSpatialCapLog P) := by + let j := Fintype.card (Unit ⊕ α) + have hj2 : (j : ℝ) ^ 2 ≤ P ^ 2 := pow_le_pow_left₀ (Nat.cast_nonneg _) hα 2 + have hκ : 0 < 1 / (M : ℝ) := one_div_pos.mpr (Nat.cast_pos.mpr hM) + have hU : physicalSpatialInverseBound α (1 / (M : ℝ)) ≤ Real.exp (P ^ 2 + 2 * P) := + (physicalSpatialInverseBound_le_exp α hκ (by simpa only [one_div, inv_inv] using hMP)).trans + (Real.exp_le_exp.mpr (by change (j : ℝ) ^ 2 + j + P ≤ _; linarith)) + have hU0 : 0 ≤ physicalSpatialInverseBound α (1 / (M : ℝ)) := by + unfold physicalSpatialInverseBound + positivity + have hpower := pow_le_exp_mul_of_le_exp hU0 hU (by positivity) j hα + have hfact := (factorial_le_exp_sq j).trans (Real.exp_le_exp.mpr hj2) + have hfree : (Fintype.card (UnselectedColumn selection) : ℝ) ≤ P := by + have hc := selectedColumn_card selection + exact (Nat.cast_le.mpr (by omega)).trans hG + have htwo : (2 : ℝ) ^ Fintype.card (UnselectedColumn selection) ≤ Real.exp (2 * P) := by + simpa only [mul_comm P 2] using pow_le_exp_mul_of_le_exp (by norm_num : (0 : ℝ) ≤ 2) + (by linarith [Real.add_one_le_exp (2 : ℝ)]) (by norm_num : (0 : ℝ) ≤ 2) _ hfree + unfold anisotropicSpatialDensityCap + calc + _ ≤ Real.exp (P ^ 2) * Real.exp (P * (P ^ 2 + 2 * P)) * Real.exp (2 * P) := by gcongr + _ = _ := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + unfold anisotropicSpatialCapLog + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricBoxPrecision.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricBoxPrecision.lean new file mode 100644 index 0000000000000000000000000000000000000000..117c5d496cac139abd215c80f98f3737a2ca721b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricBoxPrecision.lean @@ -0,0 +1,137 @@ +import OAI.Combinatorics.Progressions.Estimates.AntisymmetricPartitionApproximation + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeAntisymmetricFrozenDescent.lie NativeAntisymmetricFrozenDescent.algebra + NativeAntisymmetricFrozenDescent.topology NativeAntisymmetricFrozenDescent.topologicalAdd + NativeAntisymmetricFrozenDescent.continuousSMul NativeAntisymmetricFrozenDescent.hausdorff + +theorem exists_antisymmetric_box_expansion (a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q b t : ℝ} + {W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p} + {N : ℕ} [NeZero N] {V : NativeAntisymmetricOrbitFactors W N p} + (R : NativeAntisymmetricFrozenDescent V q) (_L : NativeAntisymmetricLocalModels R b), + 0 ≤ t → q ≤ t → b ≤ t → ∀ {ρ : ℝ}, 0 < ρ → 1 / ρ ≤ Real.exp ((t + 2) ^ a) → + ∃ F : (Fin 4 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 4 => 1) 1 ((t + C) ^ C) F) ∧ + (𝔼 x : Fin 4 → ZMod N, + ‖W.antisymmetricBoxValue V.leftIndex V.rightIndex (fun i => ((x i).val : ℤ)) - + F (fun i => ((x i).val : ℤ))‖) ≤ Real.exp (t + 73) * (ρ + 1 / N) := by + obtain ⟨A, _, hpartition⟩ := exists_antisymmetric_partition_approximation a + obtain ⟨B, _, hweighted⟩ := exists_positive_weighted_expansion + let X : Polynomial ℕ := Polynomial.X + let Q := (X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((Q + 4 + Polynomial.C B) ^ B + Q) + refine ⟨C, hC, ?_⟩ + intro p q b t W N _ V R L ht hqt hbt ρ hρ hprec + classical + let : NeZero L.period := ⟨L.period_pos.ne'⟩ + obtain ⟨n, _, hcard, ψ, hψ, hsum, S, _hSo, hSc, herr⟩ := + hpartition R L ht hqt hbt hρ hprec + let r := (t + A) ^ A + have hr : 0 ≤ r := by dsimp [r]; positivity + have hr4 : (Fintype.card (Fin 4) : ℝ) ≤ r + 4 := by simpa using hr + have hcost : (r + 4 + B) ^ B + r ≤ (t + C) ^ C := by + simpa [Q, X, r, Polynomial.eval₂_pow] using hbudget t ht + have hfamily (j : Fin 4 → Fin n × ZMod L.period) : + ∃ g : (Fin 4 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 4 => 1) 1 ((r + 4 + B) ^ B) g) ∧ + ∀ x : Fin 4 → ZMod N, g (fun i => ((x i).val : ℤ)) = + (∏ i, (ψ (j i) (x i) : ℂ)) * (S j).evalCyclic N x := by + exact hweighted (S j) (by linarith) hr4 ((hSc j).mono (by dsimp [r]; linarith)) + (fun i => ψ (j i)) (fun i => (hψ (j i)).mono le_rfl (by dsimp [r]; linarith)) + choose g hE heval using hfamily + let E := fun j => Classical.choice (hE j) + let F := fun x : Fin 4 → ℤ => ∑ j, g j x + have hcoeff : (∑ _j : Fin 4 → Fin n × ZMod L.period, ‖(1 : ℂ)‖) ≤ Real.exp r := by + simpa using hcard + have hEF : NativeIntegerExpansion (fun _ : Fin 4 => 1) 1 ((t + C) ^ C) F := by + simpa only [F, one_mul] using + ((NativeIntegerExpansion.weightedSum E (fun _ => 1) hr hcard hcoeff).mono hcost) + have he (x : Fin 4 → ZMod N) : F (fun i => ((x i).val : ℤ)) = + ∑ j, ((∏ i, ψ (j i) (x i)) : ℝ) * (S j).evalCyclic N x := by + apply Finset.sum_congr rfl + intro j _ + simpa only [Complex.ofReal_prod] using heval j x + refine ⟨F, ⟨hEF⟩, ?_⟩ + simpa only [he] using herr + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + +theorem exists_antisymmetric_box_approximation : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q b t r : ℝ} + {W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p} + {N : ℕ} [NeZero N] {V : NativeAntisymmetricOrbitFactors W N p} + (R : NativeAntisymmetricFrozenDescent V q) (_L : NativeAntisymmetricLocalModels R b), + 0 ≤ t → 0 ≤ r → q ≤ t → b ≤ t → Real.exp ((t + r + C) ^ C) ≤ (N : ℝ) → + ∃ F : (Fin 4 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 4 => 1) 1 ((t + r + C) ^ C) F) ∧ + (𝔼 x : Fin 4 → ZMod N, + ‖W.antisymmetricBoxValue V.leftIndex V.rightIndex (fun i => ((x i).val : ℤ)) - + F (fun i => ((x i).val : ℤ))‖) ≤ Real.exp (-r) := by + obtain ⟨A, _, hexpand⟩ := exists_antisymmetric_box_expansion 2 + let X : Polynomial ℕ := Polynomial.X + let T := X + 100 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((T + Polynomial.C A) ^ A + 2 * T) + refine ⟨C, hC, ?_⟩ + intro p q b t r W N _ V R L ht hr hqt hbt hN + let u := t + r + 100 + have hu : 0 ≤ u := by dsimp [u]; linarith + have hsum : (u + A) ^ A + 2 * u ≤ (t + r + C) ^ C := by + simpa [T, X, u, Polynomial.eval₂_pow] using hbudget (t + r) (add_nonneg ht hr) + have hcost : (u + A) ^ A ≤ (t + r + C) ^ C := by linarith + have hscale : 2 * u ≤ (t + r + C) ^ C := by + have : 0 ≤ (u + A) ^ A := by positivity + linarith + let ρ := Real.exp (-(2 * u)) + have hρ : 0 < ρ := Real.exp_pos _ + have hprec : 1 / ρ ≤ Real.exp ((u + 2) ^ 2) := by + dsimp [ρ] + rw [one_div, ← Real.exp_neg] + apply Real.exp_le_exp.mpr + nlinarith [sq_nonneg u] + obtain ⟨F, ⟨E⟩, herr⟩ := hexpand R L hu (hqt.trans (by dsimp [u]; linarith)) + (hbt.trans (by dsimp [u]; linarith)) hρ hprec + have hrecip : 1 / (N : ℝ) ≤ ρ := by + have hh := one_div_le_one_div_of_le (Real.exp_pos (2 * u)) + ((Real.exp_le_exp.mpr hscale).trans hN) + simpa only [ρ, one_div, Real.exp_neg] using hh + refine ⟨F, ⟨E.mono hcost⟩, herr.trans ?_⟩ + calc + _ ≤ Real.exp (u + 73) * (2 * ρ) := + mul_le_mul_of_nonneg_left (by linarith) (Real.exp_nonneg _) + _ = 2 * Real.exp (73 - u) := by + dsimp [ρ] + rw [← mul_assoc, mul_comm (Real.exp (u + 73)) 2, mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ 2 * (Real.exp (-r) / 2) := by + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply (Real.exp_le_exp.mpr (show 73 - u ≤ -r - 1 by dsimp [u]; linarith)).trans + exact exp_sub_one_le_half_exp (-r) + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricBoxStepDrop.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricBoxStepDrop.lean new file mode 100644 index 0000000000000000000000000000000000000000..654dccc825e1ead8cb6cb550d78b5ce60834526d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricBoxStepDrop.lean @@ -0,0 +1,168 @@ +import OAI.Combinatorics.Progressions.Estimates.QuadraticPairStepDrop + +namespace OAI + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +structure NativeAntisymmetricBoxFactorization {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) (N : ℕ) (q : ℝ) where + leftIndex : Fin W.outputDim + rightIndex : Fin W.outputDim + nonnegative : 0 ≤ p + [topology : TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [topologicalAdd : IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [continuousSMul : ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [hausdorff : T2Space (ℝ ⊗[ℚ] (Fin 8 → W.L))] + basis : Basis (Fin (finrank ℚ (Fin 8 → W.L))) ℚ (Fin 8 → W.L) + weight : Fin (finrank ℚ (Fin 8 → W.L)) → ℕ + adapted : ∀ k, (pi (fun _ : Fin 8 => W.model)).filtration.layer k = + Submodule.span ℚ (basis '' {i | k ≤ weight i}) + height : ∀ i j, rationalLogHeight ((pi (fun _ : Fin 8 => W.model)).basis.repr (basis i) j) ≤ q + factorization : (pi (fun _ : Fin 8 => W.model)).filtration.ControlledSymbolFactorization + basis weight adapted (piFrequency W.antisymmetricBoxFrequencies) (fun _ : Fin 4 => (N : ℝ)) + ((W.antisymmetricBoxNiltest nonnegative leftIndex rightIndex).symbol basis weight adapted) q + +noncomputable def NativeAntisymmetricBoxFactorization.mono {p p' q q' : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p} + (V : NativeAntisymmetricBoxFactorization W N q) (hp : p ≤ p') (hq : q ≤ q') : + NativeAntisymmetricBoxFactorization (W.mono hp) N q' := by + letI := V.topology + letI := V.topologicalAdd + letI := V.continuousSMul + letI := V.hausdorff + letI : TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → (W.mono hp).L)) := V.topology + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → (W.mono hp).L)) := V.topologicalAdd + letI : ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → (W.mono hp).L)) := V.continuousSMul + letI : T2Space (ℝ ⊗[ℚ] (Fin 8 → (W.mono hp).L)) := V.hausdorff + have hfactor := NilpotentLieFiltration.ControlledSymbolFactorization.mono + (pi (fun _ : Fin 8 => W.model)).filtration V.basis V.weight V.adapted V.factorization hq + (fun _ => by exact_mod_cast NeZero.pos N) + have horbit : + ((W.mono hp).antisymmetricBoxNiltest (V.nonnegative.trans hp) V.leftIndex V.rightIndex).orbit = + (W.antisymmetricBoxNiltest V.nonnegative V.leftIndex V.rightIndex).orbit := by + apply congrArg (NilpotentLieFiltration.piRealOrbit (fun _ : Fin 8 => W.model.filtration)) + funext k + fin_cases k <;> rfl + have hsymbol : + ((W.mono hp).antisymmetricBoxNiltest (V.nonnegative.trans hp) V.leftIndex V.rightIndex).symbol + V.basis V.weight V.adapted = + (W.antisymmetricBoxNiltest V.nonnegative V.leftIndex V.rightIndex).symbol + V.basis V.weight V.adapted := by + unfold Niltest.symbol + apply congrArg ((pi (fun _ : Fin 8 => W.model)).filtration.realPolynomialSymbolHom + V.basis V.weight V.adapted (fun _ : Fin 4 => 1)) + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + exact congrArg (fun o : (pi (fun _ : Fin 8 => W.model)).filtration.realification.PolynomialOrbit + (fun _ : Fin 4 => 1) => o.log) horbit + have htransport := (congrArg (fun symbol => + (pi (fun _ : Fin 8 => W.model)).filtration.ControlledSymbolFactorization + V.basis V.weight V.adapted (piFrequency W.antisymmetricBoxFrequencies) + (fun _ : Fin 4 => (N : ℝ)) symbol q') hsymbol).mpr hfactor + exact { + leftIndex := V.leftIndex + rightIndex := V.rightIndex + nonnegative := V.nonnegative.trans hp + topology := V.topology + topologicalAdd := V.topologicalAdd + continuousSMul := V.continuousSMul + hausdorff := V.hausdorff + basis := V.basis + weight := V.weight + adapted := V.adapted + height := fun i j => (V.height i j).trans hq + factorization := htransport } + +theorem exists_antisymmetric_box_step_drop_indices : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ}, 0 ≤ p → + ∀ (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + {N : ℕ} [NeZero N] (i j : Fin W.outputDim), + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + Real.exp (-p) ≤ (finiteBoxCorrelation (fun x y : ZMod N => + star (W.evalCyclic N i (correlationInput x y)) * W.evalCyclic N j (correlationInput y x))).re → + ∃ V : NativeAntisymmetricBoxFactorization W N ((p + C) ^ C), + V.leftIndex = i ∧ V.rightIndex = j := by + obtain ⟨a, _, hstep⟩ := exists_intrinsic_step_drop (∑ k, mixedCorrelationDegree 1 k) + (by decide) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 8 + let R := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + 4 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (R + 1 + (R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro p hp W N _ i j hN hbox + let r := productNiltestBudget (p + 8) + p + 4 + have hprod : 0 ≤ productNiltestBudget (p + 8) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hpr : p ≤ r := by dsimp [r]; linarith + have h4r : 4 ≤ r := by dsimp [r]; linarith + have hTr : productNiltestBudget (p + 8) ≤ r := by dsimp [r]; linarith + have hr : 0 ≤ r := hp.trans hpr + have hcost : r + 1 + (r + a) ^ a ≤ (p + C) ^ C := by + simpa [X, Q, R, r, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget p hp + have hpow : 0 ≤ (r + a) ^ a := by positivity + have hheight : r + 1 ≤ (p + C) ^ C := by linarith + have hfactor : (r + a) ^ a ≤ (p + C) ^ C := by linarith + obtain ⟨τ, htA, htM, htT⟩ := exists_real_module_topology + (productFinBasis (fun _ : Fin 8 => W.model)) + let : TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → W.L)) := τ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → W.L)) := htA + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → W.L)) := htM + let : T2Space (ℝ ⊗[ℚ] (Fin 8 → W.L)) := htT + let D := pi (fun _ : Fin 8 => W.model) + let T := W.antisymmetricBoxNiltest hp i j + obtain ⟨e, ω, hF, he, hconstruct⟩ := hstep D hr T ((W.antisymmetricBoxNiltest_complexity hp i j).mono hTr) + have hbias : Real.exp (-r) ≤ ‖𝔼 n ∈ translatedIntegerBox 0 (fun _ : Fin 4 => N), T.eval n‖ := by + have hzero : translatedIntegerBox 0 (fun _ : Fin 4 => N) = integerBox (fun _ : Fin 4 => N) := by + ext n + simp only [mem_translatedIntegerBox, mem_integerBox, Pi.zero_apply, zero_add] + rw [hzero, show T = W.antisymmetricBoxNiltest hp i j from rfl, W.antisymmetricBoxNiltest_mean] + exact (Real.exp_le_exp.mpr (neg_le_neg hpr)).trans (hbox.trans (Complex.re_le_norm _)) + have hf := hconstruct (piFrequency W.antisymmetricBoxFrequencies) + (W.antisymmetricBoxNiltest_vertical hp i j) 0 (fun _ : Fin 4 => N) + (fun _ => NeZero.pos N) (by simpa using h4r) + (fun _ => (Real.exp_le_exp.mpr hfactor).trans hN) hbias + exact ⟨{ + leftIndex := i + rightIndex := j + nonnegative := hp + topology := τ + topologicalAdd := htA + continuousSMul := htM + hausdorff := htT + basis := e + weight := ω + adapted := hF + height := fun i j => (he i j).trans hheight + factorization := NilpotentLieFiltration.ControlledSymbolFactorization.mono + D.filtration e ω hF hf hfactor (fun _ => by exact_mod_cast NeZero.pos N) }, rfl, rfl⟩ + +theorem exists_antisymmetric_box_step_drop : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ}, 0 ≤ p → + ∀ (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + {N : ℕ} [NeZero N] (i j : Fin W.outputDim), + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + Real.exp (-p) ≤ (finiteBoxCorrelation (fun x y : ZMod N => + star (W.evalCyclic N i (correlationInput x y)) * W.evalCyclic N j (correlationInput y x))).re → + Nonempty (NativeAntisymmetricBoxFactorization W N ((p + C) ^ C)) := by + obtain ⟨C, hC, h⟩ := exists_antisymmetric_box_step_drop_indices + refine ⟨C, hC, ?_⟩ + intro p hp W N _ i j hN hbox + obtain ⟨V, _, _⟩ := h hp W i j hN hbox + exact ⟨V⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricPairCoordinateTest.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricPairCoordinateTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..32ec56fdc3515c78dc0b0864ec041660795b0364 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AntisymmetricPairCoordinateTest.lean @@ -0,0 +1,84 @@ +import OAI.Combinatorics.Progressions.Estimates.QuadraticPairStepDrop + +namespace OAI + +section + +namespace Erdos3.NativeSampleCorrelation + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +variable {p q : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p} {i j : Fin W.outputDim} + (V : NativeSampleCorrelation (fun _ : Fin 2 => 1) 1 q + Finset.univ (fun z : Fin 2 → ZMod N => fun k => ((z k).val : ℤ)) + (fun z => W.antisymmetricKernel i j ((z 0).val : ℤ) ((z 1).val : ℤ))) + +noncomputable def pairCoordinateTests (k : Fin 2) (out : Fin W.outputDim) : + ∀ l, (V.antisymmetricPairModels l).Niltest (fun _ : Fin 2 => 1) + | none => (V.test.raiseStep (by decide)).oneOnOrbit + | some l => + ![![W.pairComponent out 0 1, (W.pairComponent out 1 0).oneOnOrbit], + ![(W.pairComponent out 0 1).oneOnOrbit, W.pairComponent out 1 0]] k l + +theorem pairCoordinateTests_complexity (k : Fin 2) (out : Fin W.outputDim) (l : Option (Fin 2)) : + (V.pairCoordinateTests k out l).ComplexityLE (antisymmetricPairBudget p q) := by + have htwo : 2 ≤ antisymmetricPairBudget p q := + (by norm_num : (2 : ℝ) ≤ 4).trans V.antisymmetricPairBudget_four_le + cases l with + | none => exact Niltest.oneOnOrbit_complexity _ htwo (V.antisymmetricPairTests_complexity none).1 + | some l => + fin_cases k <;> fin_cases l + · exact V.antisymmetricPairTests_complexity (some 0) + · exact Niltest.oneOnOrbit_complexity _ htwo (V.antisymmetricPairTests_complexity (some 1)).1 + · exact Niltest.oneOnOrbit_complexity _ htwo (V.antisymmetricPairTests_complexity (some 0)).1 + · exact V.antisymmetricPairTests_complexity (some 1) + +variable [TopologicalSpace (ℝ ⊗[ℚ] V.AntisymmetricPairAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] V.AntisymmetricPairAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] V.AntisymmetricPairAlgebra)] + [T2Space (ℝ ⊗[ℚ] V.AntisymmetricPairAlgebra)] + +noncomputable def pairCoordinateNiltest (k : Fin 2) (out : Fin W.outputDim) : + (pi V.antisymmetricPairModels).Niltest (fun _ : Fin 2 => 1) := + piNiltest V.antisymmetricPairModels (V.pairCoordinateTests k out) + ((by norm_num : (0 : ℝ) ≤ 4).trans V.antisymmetricPairBudget_four_le) + (by simpa using (show (3 : ℝ) ≤ antisymmetricPairBudget p q from + (by norm_num : (3 : ℝ) ≤ 4).trans V.antisymmetricPairBudget_four_le)) + (V.pairCoordinateTests_complexity k out) + +theorem pairCoordinateNiltest_complexity (k : Fin 2) (out : Fin W.outputDim) : + (V.pairCoordinateNiltest k out).ComplexityLE + (productNiltestBudget (antisymmetricPairBudget p q)) := + piNiltest_complexity V.antisymmetricPairModels (V.pairCoordinateTests k out) _ _ _ + +theorem pairCoordinateNiltest_observable (k : Fin 2) (out : Fin W.outputDim) + (x : (pi V.antisymmetricPairModels).Space) : + (V.pairCoordinateNiltest k out).observable x = + W.vertical.observable out (productProjection V.antisymmetricPairModels (some k) x) := by + change (∏ l, (V.pairCoordinateTests k out l).observable + (productProjection V.antisymmetricPairModels l x)) = _ + rw [Fintype.prod_option, Fin.prod_univ_two] + fin_cases k + · change 1 * (W.vertical.observable out + (productProjection V.antisymmetricPairModels (some 0) x) * 1) = _ + simp only [one_mul, mul_one] + rfl + · change 1 * (1 * W.vertical.observable out + (productProjection V.antisymmetricPairModels (some 1) x)) = _ + simp only [one_mul] + rfl + +end Erdos3.NativeSampleCorrelation + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AtomSupportBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AtomSupportBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..66189d6e0564cd89c04096c52b77645d66bb0789 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AtomSupportBounds.lean @@ -0,0 +1,45 @@ +import OAI.Combinatorics.Progressions.Probability.CylinderJointMass + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + +theorem productFiberIndicator_sq_mean_le_one (μ : ∀ i, FiniteProbabilityWeights (X i)) + (I : Finset ι) (x : ∀ i, X i) : + (FiniteProbabilityWeights.pi μ).mean (fun z => productFiberIndicator I x z ^ 2) ≤ 1 := by + apply (FiniteProbabilityWeights.mean_mono _ (g := fun _ => (1 : ℝ)) _).trans_eq + (FiniteProbabilityWeights.mean_const _ 1) + intro z + unfold productFiberIndicator + split_ifs <;> norm_num + +theorem productCouplingPairing_atom_component_le_one + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) (I A : Finset ι) + (x : ∀ i, X i) (y : ∀ i, Y i) : + |productCouplingPairing c (productANOVA μ A (productFiberIndicator I x)) + (productANOVA ν A (productFiberIndicator I y))| ≤ 1 := by + have hx := (productANOVAEnergy_le_mean_sq μ {A} (productFiberIndicator I x)).trans + (productFiberIndicator_sq_mean_le_one μ I x) + have hy := (productANOVAEnergy_le_mean_sq ν {A} (productFiberIndicator I y)).trans + (productFiberIndicator_sq_mean_le_one ν I y) + simp only [productANOVAEnergy, Finset.sum_singleton] at hx hy + have hc := productCouplingPairing_sq_le c (productANOVA μ A (productFiberIndicator I x)) + (productANOVA ν A (productFiberIndicator I y)) + have hb := hc.trans ((mul_le_of_le_one_left + (FiniteProbabilityWeights.mean_nonneg _ (fun z => sq_nonneg (productANOVA ν A (productFiberIndicator I y) z))) hx).trans hy) + apply (sq_le_sq₀ (abs_nonneg _) (zero_le_one : (0 : ℝ) ≤ 1)).mp + simpa only [sq_abs, one_pow] using hb + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AuxiliaryBoxPartition.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AuxiliaryBoxPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..779af8cc595ddd01ae798e7112aa9d88ebfef5c4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AuxiliaryBoxPartition.lean @@ -0,0 +1,86 @@ +import OAI.Combinatorics.Progressions.Estimates.AuxiliaryIntervalCells + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +abbrev AuxiliaryBoxLabels {I : Type*} {N : I → ℕ} + (P : ∀ i, FiniteProgressionPartition (N i)) (M d : I → ℕ) (u : I → ℤ) := + ∀ i, (P i).Label × CompatibleAuxResidue (M i) (d i) (u i) + +noncomputable def boxAuxiliaryCell {I : Type*} (a : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (M d : I → ℕ) (hd : ∀ i, 0 < d i) + (u r b : I → ℤ) + (hbase : ∀ i (x : ℤ), x ≡ b i [ZMOD r i] → x ≡ u i [ZMOD (M i : ℤ)]) + (x : IntegerResidueBox a (fun i => a i + N i) r b) : AuxiliaryBoxLabels P M d u := + fun i => intervalAuxiliaryCell (a i) (P i) (M i) (d i) (hd i) (u i) (r i) (b i) (hbase i) (x i) + +noncomputable def boxAuxiliaryCellEquiv {I : Type*} [Fintype I] [DecidableEq I] + (a : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) + (hstep : ∀ i k, (P i).step k = 1) (hpos : ∀ i k, 0 < (P i).length k) + (M d : I → ℕ) (hd : ∀ i, 0 < d i) (u r b : I → ℤ) + (hbase : ∀ i (x : ℤ), x ≡ b i [ZMOD r i] → x ≡ u i [ZMOD (M i : ℤ)]) + (k : AuxiliaryBoxLabels P M d u) (R c : I → ℤ) + (hcombine : ∀ i (x : ℤ), + (x ≡ b i [ZMOD r i] ∧ x ≡ ((k i).2.val.val : ℤ) [ZMOD (d i : ℤ)]) ↔ x ≡ c i [ZMOD R i]) : + ↥(partitionCell (boxAuxiliaryCell a N P M d hd u r b hbase) k) ≃ + IntegerResidueBox (fun i => intervalCellLower (a i) (P i) (k i).1) + (fun i => intervalCellUpper (a i) (P i) (k i).1) R c := by + let e₁ : ↥(partitionCell (boxAuxiliaryCell a N P M d hd u r b hbase) k) ≃ + {x : IntegerResidueBox a (fun i => a i + N i) r b // + ∀ i, intervalAuxiliaryCell (a i) (P i) (M i) (d i) (hd i) + (u i) (r i) (b i) (hbase i) (x i) = k i} := + Equiv.subtypeEquivRight (fun x => by + simp only [mem_partitionCell, boxAuxiliaryCell, funext_iff]) + exact e₁.trans (Equiv.subtypePiEquivPi.trans (Equiv.piCongrRight (fun i => + intervalAuxiliaryCellEquiv (a i) (P i) (hstep i) (hpos i) (M i) (d i) (hd i) + (u i) (r i) (b i) (hbase i) (k i) (R i) (c i) (hcombine i)))) + +theorem boxAuxiliaryCell_card {I : Type*} [Fintype I] [DecidableEq I] + (a : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) + (hstep : ∀ i k, (P i).step k = 1) (hpos : ∀ i k, 0 < (P i).length k) + (M d : I → ℕ) (hd : ∀ i, 0 < d i) (u r b : I → ℤ) + (hbase : ∀ i (x : ℤ), x ≡ b i [ZMOD r i] → x ≡ u i [ZMOD (M i : ℤ)]) + (k : AuxiliaryBoxLabels P M d u) (R c : I → ℤ) + (hcombine : ∀ i (x : ℤ), + (x ≡ b i [ZMOD r i] ∧ x ≡ ((k i).2.val.val : ℤ) [ZMOD (d i : ℤ)]) ↔ x ≡ c i [ZMOD R i]) : + (partitionCell (boxAuxiliaryCell a N P M d hd u r b hbase) k).card = + rectangularResidueCount (fun i => intervalCellLower (a i) (P i) (k i).1) + (fun i => intervalCellUpper (a i) (P i) (k i).1) R c := by + have he := Fintype.card_congr (boxAuxiliaryCellEquiv a N P hstep hpos M d hd u r b hbase k R c hcombine) + calc + _ = Fintype.card (IntegerResidueBox (fun i => intervalCellLower (a i) (P i) (k i).1) + (fun i => intervalCellUpper (a i) (P i) (k i).1) R c) := by + simpa only [Fintype.card_coe] using he + _ = _ := (rectangularResidueCount_eq_card _ _ _ _).symm + +theorem boxAuxiliaryCell_mixture {I : Type*} [Fintype I] [DecidableEq I] + (a : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) + (hstep : ∀ i k, (P i).step k = 1) (hpos : ∀ i k, 0 < (P i).length k) + (M d : I → ℕ) (hd : ∀ i, 0 < d i) (u r b : I → ℤ) + (hbase : ∀ i (x : ℤ), x ≡ b i [ZMOD r i] → x ≡ u i [ZMOD (M i : ℤ)]) + (R : I → ℤ) (c : AuxiliaryBoxLabels P M d u → I → ℤ) + (hcombine : ∀ k i (x : ℤ), + (x ≡ b i [ZMOD r i] ∧ x ≡ ((k i).2.val.val : ℤ) [ZMOD (d i : ℤ)]) ↔ x ≡ c k i [ZMOD R i]) + (f : IntegerResidueBox a (fun i => a i + N i) r b → ℂ) : + (𝔼 x, f x) = ∑ k : AuxiliaryBoxLabels P M d u, + ((rectangularResidueCount (fun i => intervalCellLower (a i) (P i) (k i).1) + (fun i => intervalCellUpper (a i) (P i) (k i).1) R (c k) : ℝ) / + (∑ j : AuxiliaryBoxLabels P M d u, (rectangularResidueCount + (fun i => intervalCellLower (a i) (P i) (j i).1) + (fun i => intervalCellUpper (a i) (P i) (j i).1) R (c j) : ℝ)) : ℂ) * + (𝔼 x ∈ partitionCell (boxAuxiliaryCell a N P M d hd u r b hbase) k, f x) := by + have hcard (k : AuxiliaryBoxLabels P M d u) := + boxAuxiliaryCell_card a N P hstep hpos M d hd u r b hbase k R (c k) (hcombine k) + simpa only [hcard] using + complex_expect_partition_count_weights (boxAuxiliaryCell a N P M d hd u r b hbase) f + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/AveragedIdealSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/AveragedIdealSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4cec4a99393ce922785bb9263c7e04614e0fdb2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/AveragedIdealSupport.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Estimates.ActiveAveragedProfileComparison + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal BigOperators + +theorem regularizedAffineIdealDensity_support {D G α : Type*} + [Fintype D] [Fintype α] [DecidableEq α] + {B O C : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] [∀ d, Fintype (C d)] + (h : D → ℕ) (e : ∀ d, C d → SamplerTupleIndex G B h →₀ ℕ) + (index : ∀ d, B d → C d) (c w : ∀ d, C d → ℝ) + (sets : ∀ d, O d → Finset α) (δ : ℝ≥0) (hδ : 0 < δ) + (r : ∀ d, C d → ℝ) (hr : ∀ d j, |r d j| ≤ 1) + {Csum Wsum Ro : ℝ} (hRo : 0 ≤ Ro) + (hcsum : ∀ d, (∑ b, (|c d (index d b)|+|w d (index d b)|)) ≤ Csum) + (hwsum : ∀ d, (∑ j, (|c d j|+|w d j|)) ≤ Wsum) + (hbound : ∀ d o, Wsum+(2 : ℝ)^(sets d o).card*(Csum*((Fintype.card α : ℝ)+1)^h d) ≤ Ro) : + ∀ v, Ro+δ < ‖v‖ → regularizedAffineIdealDensity h e index c w sets δ r v = 0 := by + apply regularizedImageDensity_support (jointBooleanSource h) _ δ hδ hRo + filter_upwards [jointBooleanSource_ae_closedBall B h] with x hx + rw [Metric.mem_closedBall, dist_zero_right] at hx + apply (pi_norm_le_iff_of_nonneg hRo).mpr + intro o + have hc : |(monomialArrayPolynomial (e o.1) (fun j => c o.1 j+w o.1 j*r o.1 j)).coeff 0| ≤ Wsum := + (monomialArrayPolynomial_coeff_abs_le _ _ 0).trans + ((Finset.sum_le_sum (fun j _ => affineParameter_abs_upper _ _ _ (hr o.1 j))).trans (hwsum o.1)) + have hb : |booleanConstantJet sets + (fun d => (monomialArrayPolynomial (e d) (fun j => c d j+w d j*r d j)).coeff 0) o| ≤ Wsum := by + unfold booleanConstantJet + split_ifs + · exact hc + · simpa only [abs_zero] using (abs_nonneg _).trans hc + have hs := jointBooleanSampler_coordinate_abs_le h + (fun d b => c d (index d b)+w d (index d b)*r d (index d b)) sets x hx o + have hsum := (affinePrincipal_sum_le (index o.1) (c o.1) (w o.1) (r o.1) (hr o.1)).trans (hcsum o.1) + have hp : 0 ≤ ((Fintype.card α : ℝ)+1)^h o.1 := by positivity + have hs' := hs.trans (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hsum hp) (by positivity)) + rw [Real.norm_eq_abs] + exact (abs_add_le _ _).trans ((add_le_add hb hs').trans (hbound o.1 o.2)) + +theorem averagedRegularizedIdeal_support {D G α : Type*} + [Fintype D] [Fintype α] [DecidableEq α] + {B O J N : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] + [∀ d, Fintype (J d)] [∀ d, Fintype (N d)] + (h : D → ℕ) (e : ∀ d, J d ⊕ N d → SamplerTupleIndex G B h →₀ ℕ) + (index : ∀ d, B d → J d ⊕ N d) (c w : ∀ d, J d ⊕ N d → ℝ) + (sets : ∀ d, O d → Finset α) (δ : ℝ≥0) (hδ : 0 < δ) + {Csum Wsum Ro : ℝ} (hRo : 0 ≤ Ro) + (hcsum : ∀ d, (∑ b, (|c d (index d b)|+|w d (index d b)|)) ≤ Csum) + (hwsum : ∀ d, (∑ j, (|c d j|+|w d j|)) ≤ Wsum) + (hbound : ∀ d o, Wsum+(2 : ℝ)^(sets d o).card*(Csum*((Fintype.card α : ℝ)+1)^h d) ≤ Ro) : + ∀ v, Ro+δ < ‖v‖ → averagedRegularizedIdeal h e index c w sets δ v = 0 := by + intro v hv + apply integral_eq_zero_of_ae + filter_upwards [jointUnitCoefficientSource_abs_le J N] with r hr + exact regularizedAffineIdealDensity_support h e index c w sets δ hδ r hr hRo hcsum hwsum hbound v hv + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BinaryWordSupports.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BinaryWordSupports.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ce9b7177723a42e820644cb150ff30284b0d8b9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BinaryWordSupports.lean @@ -0,0 +1,52 @@ +import Mathlib.Data.Fintype.Powerset +import OAI.Combinatorics.Progressions.Estimates.BinaryTupleSorting + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def binaryWordSupport {n : ℕ} (v : Fin n → Fin 2) : Finset (Fin n) := + Finset.univ.filter (fun i => v i = 1) + +def binaryWordSupportEquiv (n : ℕ) : (Fin n → Fin 2) ≃ Finset (Fin n) where + toFun := binaryWordSupport + invFun S i := if i ∈ S then 1 else 0 + left_inv v := by + funext i + by_cases h : v i = 1 + · simp [binaryWordSupport, h] + · simpa only [binaryWordSupport, Finset.mem_filter, Finset.mem_univ, true_and, + ite_eq_right h] using (binary_eq_zero_of_ne_one (v i) h).symm + right_inv S := by + ext i + simp [binaryWordSupport] + +theorem binaryWordSupport_card {n : ℕ} (v : Fin n → Fin 2) : + (binaryWordSupport v).card = ∑ i, (v i).val := by + rw [binaryWordSupport, Finset.card_eq_sum_ones, Finset.sum_filter] + apply Finset.sum_congr rfl + intro i _ + by_cases h : v i = 1 + · simp [h] + · rw [ite_eq_right h, binary_eq_zero_of_ne_one (v i) h] + rfl + +theorem binaryWordSupport_zero (n : ℕ) : + binaryWordSupport (fun _ : Fin n => 0) = ∅ := by + ext i + simp [binaryWordSupport] + +theorem binaryWordSupport_one (n : ℕ) : + binaryWordSupport (fun _ : Fin n => 1) = Finset.univ := by + ext i + simp [binaryWordSupport] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BlockCubeCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BlockCubeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..09deacbf9df0e93c1c1ff076227318cdb56a32e1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BlockCubeCoordinates.lean @@ -0,0 +1,88 @@ +import OAI.Combinatorics.Progressions.Probability.ScaledCubeProductMeasure + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +noncomputable def blockCubeFlatten (B F α : Type*) [Fintype B] [Fintype F] [Fintype α] : + ((B × F) → Option α → ℝ) ≃L[ℝ] (BlockParameter B F α → ℝ) where + toLinearEquiv := + { toFun := fun x z => x (z.1, z.2.1) z.2.2 + invFun := fun a bf r => a (bf.1, bf.2, r) + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl } + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop + +theorem blockCubeFlatten_apply {B F α : Type*} [Fintype B] [Fintype F] [Fintype α] + (x : (B × F) → Option α → ℝ) (z : BlockParameter B F α) : + blockCubeFlatten B F α x z = x (z.1, z.2.1) z.2.2 := rfl + +theorem blockCubeFlatten_symm_apply {B F α : Type*} [Fintype B] [Fintype F] [Fintype α] + (a : BlockParameter B F α → ℝ) (bf : B × F) (r : Option α) : + (blockCubeFlatten B F α).symm a bf r = a (bf.1, bf.2, r) := rfl + +theorem blockCubeFlatten_norm_le_one (B F α : Type*) [Fintype B] [Fintype F] [Fintype α] : + ‖(blockCubeFlatten B F α).toContinuousLinearMap‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro x + rw [one_mul] + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro z + exact (norm_le_pi_norm (x (z.1, z.2.1)) z.2.2).trans (norm_le_pi_norm x (z.1, z.2.1)) + +theorem blockCubeFlatten_symm_norm_le_one (B F α : Type*) [Fintype B] [Fintype F] [Fintype α] : + ‖(blockCubeFlatten B F α).symm.toContinuousLinearMap‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro a + rw [one_mul] + apply (pi_norm_le_iff_of_nonneg (norm_nonneg a)).mpr + intro bf + apply (pi_norm_le_iff_of_nonneg (norm_nonneg a)).mpr + intro r + exact norm_le_pi_norm a (bf.1, bf.2, r) + +theorem blockCubeFlatten_measurePreserving (B F α : Type*) [Fintype B] [Fintype F] [Fintype α] : + MeasurePreserving (blockCubeFlatten B F α) volume volume := by + refine ⟨(blockCubeFlatten B F α).continuous.measurable, ?_⟩ + symm + apply Measure.pi_eq + intro s hs + rw [Measure.map_apply (blockCubeFlatten B F α).continuous.measurable (MeasurableSet.univ_pi hs)] + have he : blockCubeFlatten B F α ⁻¹' Set.univ.pi s = + Set.univ.pi (fun bf : B × F => Set.univ.pi (fun r => s (bf.1, bf.2, r))) := by + ext x + constructor + · intro hx bf _ r _ + exact hx (bf.1, bf.2, r) (Set.mem_univ _) + · intro hx z _ + exact hx (z.1, z.2.1) (Set.mem_univ _) z.2.2 (Set.mem_univ _) + rw [he, volume_pi_pi] + simp only [volume_pi_pi, Fintype.prod_prod_type] + +theorem blockCubeFlatten_symm_measurePreserving (B F α : Type*) [Fintype B] [Fintype F] + [Fintype α] : MeasurePreserving (blockCubeFlatten B F α).symm volume volume := + (blockCubeFlatten_measurePreserving B F α).symm + (blockCubeFlatten B F α).toHomeomorph.toMeasurableEquiv + +theorem blockCubeFlatten_symm_single {B F α : Type*} [Fintype B] [DecidableEq B] + [Fintype F] [DecidableEq F] [Fintype α] [DecidableEq α] + (b : B) (f : F) (r : Option α) : + (blockCubeFlatten B F α).symm (Pi.single (b, f, r) (1 : ℝ)) = + Pi.single (b, f) (Pi.single r 1) := by + ext bf r' + rcases bf with ⟨b', f'⟩ + by_cases hb : b' = b <;> by_cases hf : f' = f <;> by_cases hr : r' = r <;> + simp [blockCubeFlatten_symm_apply, hb, hf, hr] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoundedBooleanRowTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoundedBooleanRowTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..57dbfd0d8009ae72509ee128517b8a0ae4b2cbc7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoundedBooleanRowTransport.lean @@ -0,0 +1,39 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedBooleanSiteValues + +namespace OAI + +section + +namespace Erdos3 + +open scoped Classical + +theorem boundedBooleanJetRows_family_transport + {ι α : Type*} [Fintype α] (h : ι → ℕ) + (P : (O : ι → Type _) → [∀ i, Fintype (O i)] → + (∀ i, O i → Finset α) → Prop) + (hyp : P (fun i => BoundedBooleanJet α (h i)) (fun _ => Subtype.val)) + (inst : ∀ i, Fintype {s : Finset α // s ∈ boundedBooleanJetRows α (h i)}) : + @P (fun i => {s : Finset α // s ∈ boundedBooleanJetRows α (h i)}) inst + (fun _ => Subtype.val) := by + let inst0 : ∀ i, Fintype (BoundedBooleanJet α (h i)) := inferInstance + let Q (O : ι → Type _) (v : ∀ i, O i → Finset α) : Prop := + ∀ inst : ∀ i, Fintype (O i), @P O inst v + have hq : Q (fun i => BoundedBooleanJet α (h i)) (fun _ => Subtype.val) := by + intro inst + exact (congrArg (fun ft : ∀ i, Fintype (BoundedBooleanJet α (h i)) => + @P (fun i => BoundedBooleanJet α (h i)) ft (fun _ => Subtype.val)) + (Subsingleton.elim inst0 inst)).mp hyp + have he : (fun i (s : Finset α) => s.card ≤ h i) = + (fun i s => s ∈ boundedBooleanJetRows α (h i)) := by + funext i s + exact propext (mem_boundedBooleanJetRows (h i) s).symm + have hnew := (congrArg (fun R : ι → Finset α → Prop => + Q (fun i => {s // R i s}) (fun _ => Subtype.val)) he).mp hq + exact hnew inst + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoundedCertifiedFullChartMajorIteration.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoundedCertifiedFullChartMajorIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..045cfbe8a380c1565812aa3f44a59b4c7e28f07d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoundedCertifiedFullChartMajorIteration.lean @@ -0,0 +1,500 @@ +import OAI.Combinatorics.Progressions.Geometry.CertifiedFullChartDecompositionSource + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +variable {m : ℕ} {X : Type} {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + +structure CertifiedFullChartFiniteHistory + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (N : X → ℕ) (Bphase : ℝ) (n : ℕ) where + slow : ℕ → VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) + rat : ℕ → VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) + q : ℕ → ℕ + K : Set (X ⊕ (Σ j, J j) → ℝ) + certificate : RationalTaggedConstraintCertificate J Kinitial K Bphase + (n * (Fintype.card η * m)) + subset : K ⊆ Kinitial + dilation : ∀ t ∈ K, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight J i * t i) ∈ K + retained : ∀ t ∈ Kinitial, (∀ j, (fun a => t (Sum.inr ⟨j, a⟩)) ∈ Utag j) → t ∈ K + slow_bound : ∀ j < n, ∀ α i, |basis.coord i (coefficients (slow j) α)| ≤ Real.exp Bphase + q_pos : ∀ j < n, 0 < q j + q_bound : ∀ j < n, (q j : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * Bphase) + rat_grid : ∀ j < n, ∀ α, + (fun i => basis.coord i (coefficients (rat j) α)) ∈ realDenominatorGrid (q j) + invariant : + let outer := F.restrictedMajorOuterFactors b ω hF (fullTaggedVariableWeight J) fast lift + (fun j => realChartSubstitute (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly)) (slow j)) rat n + ∀ t ∈ K, ∀ j ≤ n, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (outer.1⁻¹ * Z * outer.2⁻¹).coord ∈ fast.baseChange ℝ + +namespace CertifiedFullChartFiniteHistory + +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (Bphase : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase + +noncomputable def outer {n : ℕ} (H : State n) : + F.RealPolynomialSymbolGroup wt × F.RealPolynomialSymbolGroup wt := + F.restrictedMajorOuterFactors b ω hF wt fast lift + (fun j => realChartSubstitute chart (H.slow j)) H.rat n + +noncomputable def initial + (hK : ∀ t ∈ Kinitial, ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ Kinitial) : + State 0 where + slow := fun _ => 0 + rat := fun _ => 0 + q := fun _ => 1 + K := Kinitial + certificate := by simpa using RationalTaggedConstraintCertificate.empty (J := J) Kinitial Bphase + subset := fun _ ht => ht + dilation := hK + retained := fun _ ht _ => ht + slow_bound := fun j hj => (Nat.not_lt_zero j hj).elim + q_pos := fun j hj => (Nat.not_lt_zero j hj).elim + q_bound := fun j hj => (Nat.not_lt_zero j hj).elim + rat_grid := fun j hj => (Nat.not_lt_zero j hj).elim + invariant := by + dsimp only + intro t ht j hj + have hj0 : j = 0 := Nat.eq_zero_of_le_zero hj + subst j + rw [F.realSymbolGradeEvaluation_zero] + exact Submodule.zero_mem _ + +variable {F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase} + +noncomputable def mono_bound {n : ℕ} (H : State n) {B' : ℝ} (hBB' : Bphase ≤ B') : + CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z Kinitial Utag poly N B' n where + slow := H.slow + rat := H.rat + q := H.q + K := H.K + certificate := H.certificate.monoB hBB' + subset := H.subset + dilation := H.dilation + retained := H.retained + slow_bound := fun j hj α i => (H.slow_bound j hj α i).trans (Real.exp_le_exp.mpr hBB') + q_pos := H.q_pos + q_bound := fun j hj => (H.q_bound j hj).trans + (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hBB' (Nat.cast_nonneg _))) + rat_grid := H.rat_grid + invariant := H.invariant + +theorem outer_mono_bound {n : ℕ} (H : State n) {B' : ℝ} (hBB' : Bphase ≤ B') : + (H.mono_bound hBB').outer = H.outer := by + dsimp only [outer, mono_bound] + +theorem mono_bound_K {n : ℕ} (H : State n) {B' : ℝ} (hBB' : Bphase ≤ B') : + (H.mono_bound hBB').K = H.K := rfl + +theorem invariant_outer {n : ℕ} (H : State n) : + ∀ t ∈ H.K, ∀ j ≤ n, + F.realSymbolGradeEvaluation b ω hF wt j t + (H.outer.1⁻¹ * Z * H.outer.2⁻¹).coord ∈ fast.baseChange ℝ := by + dsimp only [outer] + have h := H.invariant + dsimp only at h + with_reducible exact h + +noncomputable def toUncertified {n : ℕ} (H : State n) : + FullChartFiniteHistory F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase n where + slow := H.slow + rat := H.rat + q := H.q + K := H.K + subset := H.subset + dilation := H.dilation + retained := H.retained + slow_bound := H.slow_bound + q_pos := H.q_pos + q_bound := H.q_bound + rat_grid := H.rat_grid + invariant := H.invariant + +@[simp] theorem outer_toUncertified {n : ℕ} (H : State n) : + FullChartFiniteHistory.outer F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase + H.toUncertified = H.outer := by + dsimp only [FullChartFiniteHistory.outer, outer, toUncertified] + +@[simp] theorem toUncertified_K {n : ℕ} (H : State n) : H.toUncertified.K = H.K := rfl + +theorem exists_step {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) + (hdata : CertifiedFullChartGradeCorrectionData F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget) : + ∃ Hnext : State (n + 1), + (∀ j < n, Hnext.slow j = H.slow j ∧ Hnext.rat j = H.rat j ∧ Hnext.q j = H.q j) ∧ + Hnext.K ⊆ H.K := by + classical + unfold CertifiedFullChartGradeCorrectionData at hdata + obtain ⟨pS, pR, q, K', hq, hqB, hsub, hdilate, hretain, hcap, hgrid, hnext, _, hcert⟩ := hdata + let slow' := Function.update H.slow n pS + let rat' := Function.update H.rat n pR + let q' := Function.update H.q n q + have hslow (j : ℕ) (hj : j < n) : slow' j = H.slow j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hrat (j : ℕ) (hj : j < n) : rat' j = H.rat j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hqold (j : ℕ) (hj : j < n) : q' j = H.q j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hprefix : F.restrictedMajorOuterFactors b ω hF wt fast lift + (fun j => realChartSubstitute chart (slow' j)) rat' n = H.outer := by + apply F.restrictedMajorOuterFactors_congr + · intro j hj + rw [hslow j hj] + · exact hrat + have houter : F.restrictedMajorOuterFactors b ω hF wt fast lift + (fun j => realChartSubstitute chart (slow' j)) rat' (n + 1) = + (H.outer.1 * F.restrictedMajorCorrection b ω hF wt fast lift (n + 1) + (realChartSubstitute chart pS), + F.restrictedMajorCorrection b ω hF wt fast lift (n + 1) pR * H.outer.2) := by + rw [restrictedMajorOuterFactors, hprefix] + simp only [slow', rat', Function.update_self] + have hcapB : ∀ α i, |basis.coord i (coefficients pS α)| ≤ Real.exp Bphase := + fun α i => (hcap α i).trans (Real.exp_le_exp.mpr hbudget) + have hqBB : (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * Bphase) := + hqB.trans (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hbudget (Nat.cast_nonneg _))) + let Hnext : State (n + 1) := { + slow := slow' + rat := rat' + q := q' + K := K' + certificate := by + simpa only [Nat.succ_mul] using H.certificate.trans (hcert.monoB hbudget) + subset := fun t ht => H.subset (hsub ht) + dilation := hdilate + retained := fun t ht hU => hretain t (H.retained t ht hU) hU + slow_bound := by + intro j hj α i + by_cases hjn : j = n + · subst j + simpa only [slow', Function.update_self] using hcapB α i + · rw [hslow j (by omega)] + exact H.slow_bound j (by omega) α i + q_pos := by + intro j hj + by_cases hjn : j = n + · subst j + simpa only [q', Function.update_self] using hq + · rw [hqold j (by omega)] + exact H.q_pos j (by omega) + q_bound := by + intro j hj + by_cases hjn : j = n + · subst j + simpa only [q', Function.update_self] using hqBB + · rw [hqold j (by omega)] + exact H.q_bound j (by omega) + rat_grid := by + intro j hj α + by_cases hjn : j = n + · subst j + simpa only [rat', q', Function.update_self] using hgrid α + · rw [hrat j (by omega), hqold j (by omega)] + exact H.rat_grid j (by omega) α + invariant := by + dsimp only + rw [houter] + with_reducible exact hnext } + exact ⟨Hnext, fun j hj => ⟨hslow j hj, hrat j hj, hqold j hj⟩, hsub⟩ + +end CertifiedFullChartFiniteHistory +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct NNReal BigOperators + +theorem exists_certified_full_chart_grade_correction_of_major_correlation + (m k : ℕ) (hk : 0 < k) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L M ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] {s t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (_hsection : ∀ y, fast.mkQ (lift y) = y) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K₀) + (_hlower : ∀ t ∈ K₀, ∀ j < k, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + (D : RationalFilteredNilmanifold M t e) (_htk : t < k) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (p Rrank : ℝ), + FullChartMajorCorrelation F b ω hF J k fast basis Z left right D N poly U p Rrank C → + CertifiedFullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ U poly N ((p + C) ^ C) := by + obtain ⟨C, hC, hmatching⟩ := exists_full_restricted_grade_major_matching m k hk + refine ⟨C, hC, ?_⟩ + intro X L M ι η _ _ _ _ _ _ _ s t e _ _ _ _ F b ω hF J _ fast basis lift hfast hsection + Z left right K₀ hK₀ hlower D htk N poly U p Rrank hcorrelation + obtain ⟨periodCap, coverCap, Lip, W, R, Ψ, c, β, hpoly, hcoeff, hβ, + hp, hR, hRcap, hdim, hmod, hcover, hLip, hΨ, hN, hRrank, hrank, hcorr⟩ := hcorrelation + have hdetected := hmatching F b ω hF J fast basis lift hfast hsection + Z left right K₀ hK₀ hlower W D htk R N poly hpoly U hcoeff Ψ c β hβ + p Rrank hp hR hRcap hdim hmod hcover hLip hΨ hN hRrank hrank hcorr + have hchart := fullChartDetectedMajorGradeConclusion_of_fullTagged F b ω hF J k fast + basis lift Z left right K₀ U poly c N ((p + C) ^ C) hdetected + exact certifiedFullChartGradeCorrectionData_of_detected F b ω hF J k fast basis lift + Z left right K₀ U poly N ((p + C) ^ C) c hK₀ hchart + +attribute [local instance] FullChartMajorCorrelationWitness.lie + FullChartMajorCorrelationWitness.algebra FullChartMajorCorrelationWitness.topology + FullChartMajorCorrelationWitness.topologicalAdd FullChartMajorCorrelationWitness.continuousSMul + FullChartMajorCorrelationWitness.hausdorff + +theorem exists_certified_full_chart_grade_correction_of_major_correlation_witness + (m k : ℕ) (hk : 0 < k) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (_hsection : ∀ y, fast.mkQ (lift y) = y) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K₀) + (_hlower : ∀ t ∈ K₀, ∀ j < k, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (p Rrank : ℝ), + Nonempty (FullChartMajorCorrelationWitness F b ω hF J k fast basis + Z left right N poly U p Rrank C) → + CertifiedFullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ U poly N ((p + C) ^ C) := by + obtain ⟨C, hC, hstep⟩ := exists_certified_full_chart_grade_correction_of_major_correlation m k hk + refine ⟨C, hC, ?_⟩ + intro X L ι η _ _ _ _ _ s F b ω hF J _ fast basis lift hfast hsection + Z left right K₀ hK₀ hlower N poly U p Rrank hwitness + obtain ⟨witness⟩ := hwitness + exact hstep F b ω hF J fast basis lift hfast hsection Z left right K₀ hK₀ hlower + witness.model witness.lower N poly U p Rrank witness.correlation + +def CertifiedBundledFullChartControlledCorrelationSourceStages + {m : ℕ} {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (pPhase : ℕ → ℝ) (Rrank : ℝ) (Cphase : ℕ → ℕ) (controlBudget constraintBudget : ℕ → ℝ) : Prop := + ∀ n < s, + ∀ (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K : Set (X ⊕ (Σ j, J j) → ℝ)), + K ⊆ Kinitial → + (∀ t ∈ K, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K) → + (∀ t ∈ Kinitial, (∀ j, (fun i => t (Sum.inr ⟨j, i⟩)) ∈ Utag j) → t ∈ K) → + (∀ t ∈ K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) → + RationalTaggedConstraintCertificate J Kinitial K (constraintBudget n) + (n * (Fintype.card η * m)) → + FullChartControlledFactors F b ω hF J poly N left right (controlBudget n) → + Nonempty (FullChartMajorCorrelationWitness F b ω hF J (n + 1) fast basis + Z left right N poly Utag (pPhase n) Rrank (Cphase n)) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +theorem exists_bounded_certified_full_chart_major_iteration (m s a : ℕ) : + ∃ (Cphase : ℕ → ℕ) (Ccontrol : ℕ), (∀ n, 2 ≤ Cphase n) ∧ 2 ≤ Ccontrol ∧ + ∀ {X L ι Γ : Type} [Fintype X] [DecidableEq X] [Fintype ι] [Fintype Γ] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) (v : Γ → F.AssociatedGraded) + (_hspan : Submodule.span ℚ (Set.range v) = fast) + (H : ℕ) (_hHpos : 1 ≤ H) + (_hv : ∀ i j, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr (v j) i) H) + (p₀ : ℝ) (_hp₀ : 0 ≤ p₀) + (_hrows : (Fintype.card ι : ℝ) ≤ p₀) (_hcols : (Fintype.card Γ : ℝ) ≤ p₀) + (_hH : (H : ℝ) ≤ Real.exp p₀) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast), + ∃ d : ℕ, d ≤ Fintype.card ι ∧ + ∃ (eQ : Basis (Fin d) ℚ (F.AssociatedGraded ⧸ fast)) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) (qS : ℕ), + Function.RightInverse lift fast.mkQ ∧ + Function.RightInverse (lift.baseChange ℝ) (fast.mkQ.baseChange ℝ) ∧ + 0 < qS ∧ (qS : ℝ) ≤ Real.exp ((p₀ + 2) ^ 47) ∧ + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i| ≤ Real.exp ((p₀ + 2) ^ 45)) ∧ + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i) ∈ realDenominatorGrid qS) ∧ + (∀ j i, RationalHeightLE (((eQ.coord j).comp fast.mkQ) + (F.associatedGradedBasis b ω hF i)) ⌈Real.exp ((p₀ + 2) ^ 7)⌉₊) ∧ + ∀ (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hKinitial : ∀ t ∈ Kinitial, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ Kinitial) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (pPhase Bpast : ℕ → ℝ) (Rrank : ℝ) (_hBpast : ∀ n ≤ s, 0 ≤ Bpast n) + (_hBmono : Monotone Bpast) + (_hphaseBudget : ∀ n < s, (pPhase n + Cphase n) ^ Cphase n ≤ Bpast (n + 1)) + (Hcontrol : ℕ) (pControl : ℕ → ℝ), + 1 ≤ Hcontrol → (∀ n ≤ s, 0 ≤ pControl n) → + (∀ n ≤ s, (Fintype.card ι : ℝ) ≤ pControl n) → + (∀ n ≤ s, (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ pControl n) → + (∀ n ≤ s, (Hcontrol : ℝ) ≤ Real.exp (pControl n)) → + (∀ i j z, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr + ⁅F.associatedGradedBasis b ω hF i, F.associatedGradedBasis b ω hF j⁆ z) Hcontrol) → + (∀ n ≤ s, Real.exp ((p₀ + 2) ^ 47) * Real.exp ((s : ℝ) * d * Bpast n) ≤ + Real.exp (pControl n)) → + (∀ n ≤ s, (d : ℝ) * Real.exp ((p₀ + 2) ^ 45) * Real.exp (Bpast n) ≤ + Real.exp ((pControl n + 2) ^ a)) → + CertifiedBundledFullChartControlledCorrelationSourceStages F b ω hF J fast (eQ.baseChange ℝ) Z + Kinitial Utag poly N pPhase Rrank Cphase (fun n => (pControl n + Ccontrol) ^ Ccontrol) Bpast → + ∃ history : CertifiedFullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast s) s, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl s + Ccontrol) ^ Ccontrol) ∧ + ∀ t ∈ history.K, + eval₂ t (F.realGradedSymbolPolynomial b ω hF (fullTaggedVariableWeight J) + (history.outer.1⁻¹ * Z * history.outer.2⁻¹).coord) ∈ fast.baseChange ℝ := by + classical + choose Cphase hCphase hstep using + (fun n : ℕ => exists_certified_full_chart_grade_correction_of_major_correlation_witness + m (n + 1) (Nat.zero_lt_succ n)) + obtain ⟨Ccontrol, hCcontrol, hprefix⟩ := exists_restricted_chart_prefix_control s a + refine ⟨Cphase, Ccontrol, hCphase, hCcontrol, ?_⟩ + intro X L ι Γ _ _ _ _ _ _ F b ω hF J _ fast v hspan H hHpos hv + p₀ hp₀ hrows hcols hH hfast + obtain ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord⟩ := + exists_bounded_submodule_quotient_section_with_coordinates (F.associatedGradedBasis b ω hF) + fast v hspan hHpos hv hp₀ hrows hcols hH + refine ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord, ?_⟩ + intro Z Kinitial hKinitial Utag poly N pPhase Bpast Rrank + hBpast hBmono hphaseBudget Hcontrol pControl hHcontrol hpControl hι hσ hHexp hstructure + hdenbudget hcost hsource + have hcontrol : ∀ n ≤ s, + ∀ history : CertifiedFullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast n) n, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl n + Ccontrol) ^ Ccontrol) := by + intro n hn history + have hdenbudget' : (qS : ℝ) * + Real.exp ((s : ℝ) * (Fintype.card (Fin d) : ℝ) * Bpast n) ≤ Real.exp (pControl n) := by + simpa only [Fintype.card_fin] using + (mul_le_mul_of_nonneg_right hqSB (Real.exp_nonneg _)).trans (hdenbudget n hn) + have hcost' : (Fintype.card (Fin d) : ℝ) * Real.exp ((p₀ + 2) ^ 45) * + Real.exp (Bpast n) ≤ Real.exp ((pControl n + 2) ^ a) := by + simpa only [Fintype.card_fin] using hcost n hn + obtain ⟨q, hq, hqB, _hdiv, Echart, hE, hEbound, hRgrid⟩ := + hprefix F b ω hF (fullTaggedVariableWeight J) (fullTaggedVariableWeight_pos J) + Hcontrol (pControl n) hHcontrol (hpControl n hn) (hι n hn) (hσ n hn) (hHexp n hn) hstructure + fast lift (eQ.baseChange ℝ) (Real.exp ((p₀ + 2) ^ 45)) (Bpast n) qS (hBpast n hn) hqS + hdenbudget' hcost' hentry hgrid + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) (fullTaggedMajorTopCoordinates J poly)) + (fullTaggedMajorChart_homogeneous J poly (fun i => (N i : ℝ))) + history.slow history.rat history.q n hn history.q_pos history.q_bound + history.slow_bound history.rat_grid + unfold FullChartControlledFactors CertifiedFullChartFiniteHistory.outer + with_reducible exact ⟨q, hq, hqB, Echart, hE, hEbound, hRgrid⟩ + have hexists : ∀ n ≤ s, + Nonempty (CertifiedFullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast n) n) := by + intro n + induction n with + | zero => + intro _ + exact ⟨CertifiedFullChartFiniteHistory.initial F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast 0) hKinitial⟩ + | succ n ih => + intro hn + obtain ⟨history⟩ := ih (by omega) + have hlower : ∀ t ∈ history.K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (history.outer.1⁻¹ * Z * history.outer.2⁻¹).coord ∈ fast.baseChange ℝ := by + intro t ht j hj + with_reducible exact history.invariant_outer t ht j (by omega) + have hcorr := hsource n (by omega) history.outer.1 history.outer.2 history.K + history.subset history.dilation history.retained hlower history.certificate (hcontrol n (by omega) history) + have hdata := hstep n F b ω hF J fast (eQ.baseChange ℝ) lift hfast hsection + Z history.outer.1 history.outer.2 history.K history.dilation hlower + N poly Utag (pPhase n) Rrank hcorr + let larger := history.mono_bound (hBmono (Nat.le_succ n)) + have hdata' : CertifiedFullChartGradeCorrectionData F b ω hF J (n + 1) fast + (eQ.baseChange ℝ) lift Z larger.outer.1 larger.outer.2 larger.K Utag poly N + ((pPhase n + Cphase n) ^ Cphase n) := by + simpa only [larger, CertifiedFullChartFiniteHistory.outer_mono_bound, + CertifiedFullChartFiniteHistory.mono_bound_K] using hdata + obtain ⟨next, _⟩ := larger.exists_step ((pPhase n + Cphase n) ^ Cphase n) + (hphaseBudget n (by omega)) hdata' + exact ⟨next⟩ + obtain ⟨history⟩ := hexists s le_rfl + refine ⟨history, hcontrol s le_rfl history, ?_⟩ + intro t ht + apply (F.restricted_symbol_grade_terminal b ω hF (fullTaggedVariableWeight J) + fast hfast _ t).mpr + with_reducible exact history.invariant_outer t ht + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoundedDependentCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoundedDependentCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..10d6cb5697529660d1a933bb27d67546b1e7c683 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoundedDependentCoordinates.lean @@ -0,0 +1,72 @@ +import OAI.Combinatorics.Progressions.Linear.RankQuotientHeightBudget + +namespace OAI + +section + +namespace Erdos3 + +open Module + +noncomputable def dependentCoordinateBudget (p : ℝ) : ℝ := + preimageBasisBudget (p + sparseGeneratorBudget (4 * p + 1)) + +theorem dependentCoordinateBudget_nonneg {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ dependentCoordinateBudget p := by + apply preimageBasisBudget_nonneg + exact add_nonneg hp (sparseGeneratorBudget_nonneg (by positivity)) + +theorem exists_dependent_coordinate_basis + {ι κ : Type*} [Fintype ι] [Fintype κ] + (J : Submodule ℚ (Fin 4 → ι → ℚ)) (v : κ → Fin 4 → ι → ℚ) + (hv : Submodule.span ℚ (Set.range v) = J) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) + (hvH : ∀ a k i, rationalLogHeight (v a k i) ≤ p) : + ∃ b : Basis (Fin (finrank ℚ (fourDependentProjection J))) ℚ (fourDependentProjection J), + ∀ a i, rationalLogHeight ((b a : ι → ℚ) i) ≤ dependentCoordinateBudget p := by + classical + let q := 4 * p + 1 + have hq : 0 ≤ q := by dsimp only [q]; positivity + have hpq : p + 1 ≤ q := by dsimp only [q]; linarith + have hrows (S : Finset (Fin 4)) : (Fintype.card (Σ _ : S, ι) : ℝ) ≤ q := by + have hS : Fintype.card S ≤ 4 := by + simpa only [Fintype.card_coe, Fintype.card_fin] using S.card_le_univ + have hc : Fintype.card (Σ _ : S, ι) ≤ 4 * Fintype.card ι := by + simpa using Nat.mul_le_mul_right (Fintype.card ι) hS + calc + _ ≤ (4 : ℝ) * Fintype.card ι := by exact_mod_cast hc + _ ≤ 4 * p := mul_le_mul_of_nonneg_left hι (by norm_num) + _ ≤ q := by dsimp only [q]; linarith + have hκq : (Fintype.card κ : ℝ) ≤ q := hκ.trans ((by linarith : p ≤ p + 1).trans hpq) + have hHq : (⌈Real.exp p⌉₊ : ℝ) ≤ Real.exp q := + (ceil_exp_le_exp_add_one hp).trans (Real.exp_le_exp.mpr hpq) + obtain ⟨M, _, hM, u, hu, huH⟩ := exists_sparse_generators_exp_height J {1, 2} v hv + (one_le_ceil_exp p) (fun a k i => rationalHeightLE_ceil_exp (hvH a k i)) + hq (hrows {1, 2}) hκq hHq + obtain ⟨M', _, hM', u', hu', huH'⟩ := exists_sparse_generators_exp_height J {1, 3} v hv + (one_le_ceil_exp p) (fun a k i => rationalHeightLE_ceil_exp (hvH a k i)) + hq (hrows {1, 3}) hκq hHq + let t := p + sparseGeneratorBudget q + have hpt : p ≤ t := le_add_of_nonneg_right (sparseGeneratorBudget_nonneg hq) + have ht : 0 ≤ t := hp.trans hpt + have huB (a : κ) (i : ι) : rationalLogHeight (u a i) ≤ t := + (rationalLogHeight_le_of_height (huH a i) hM).trans (le_add_of_nonneg_left hp) + have huB' (a : κ) (i : ι) : rationalLogHeight (u' a i) ≤ t := + (rationalLogHeight_le_of_height (huH' a i) hM').trans (le_add_of_nonneg_left hp) + obtain ⟨b, hb⟩ := exists_preimage_basis_logHeight (Pi.basisFun ℚ ι) (Pi.basisFun ℚ ι) + (fourSparseFirstProjection J {1, 2}) (fourSparseFirstProjection J {1, 3}) + (LinearMap.id : (ι → ℚ) →ₗ[ℚ] (ι → ℚ)) u u' hu hu' ht + (hι.trans hpt) (hκ.trans hpt) (hκ.trans hpt) + (by simpa only [Pi.basisFun_repr] using huB) + (by simpa only [Pi.basisFun_repr] using huB') + (by simpa only [Pi.basisFun_repr, LinearMap.id_apply] using huB) + change Basis (Fin (finrank ℚ (fourDependentProjection J))) ℚ (fourDependentProjection J) at b + refine ⟨b, fun a i => ?_⟩ + exact hb a i + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoundedFullChartGradeMajorMatching.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoundedFullChartGradeMajorMatching.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c43c5029bbcd7d4d110d4bb799bd8e325e6f621 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoundedFullChartGradeMajorMatching.lean @@ -0,0 +1,187 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCandidateCommonFastGeometry +import OAI.Combinatorics.Progressions.Estimates.FullRestrictedGradeMajorMatching +import OAI.Combinatorics.Progressions.Geometry.FullChartHomogeneousCorrection + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct NNReal BigOperators + +theorem exists_bounded_full_chart_grade_major_matching (m k : ℕ) (hk : 0 < k) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L M ι Γ : Type} [Fintype X] [DecidableEq X] [Fintype ι] [Fintype Γ] + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] {s t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (v : Γ → F.AssociatedGraded) + (_hspan : Submodule.span ℚ (Set.range v) = fast) + (H : ℕ) (_hHpos : 1 ≤ H) + (_hv : ∀ i j, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr (v j) i) H) + (p₀ : ℝ) (_hp₀ : 0 ≤ p₀) + (_hrows : (Fintype.card ι : ℝ) ≤ p₀) (_hcols : (Fintype.card Γ : ℝ) ≤ p₀) + (_hH : (H : ℝ) ≤ Real.exp p₀) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast), + ∃ d : ℕ, d ≤ Fintype.card ι ∧ + ∃ (eQ : Basis (Fin d) ℚ (F.AssociatedGraded ⧸ fast)) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) (qS : ℕ), + Function.RightInverse lift fast.mkQ ∧ + Function.RightInverse (lift.baseChange ℝ) (fast.mkQ.baseChange ℝ) ∧ + 0 < qS ∧ (qS : ℝ) ≤ Real.exp ((p₀ + 2) ^ 47) ∧ + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i| ≤ Real.exp ((p₀ + 2) ^ 45)) ∧ + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i) ∈ realDenominatorGrid qS) ∧ + (∀ j i, RationalHeightLE (((eQ.coord j).comp fast.mkQ) + (F.associatedGradedBasis b ω hF i)) ⌈Real.exp ((p₀ + 2) ^ 7)⌉₊) ∧ + ∀ (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight J i * t i) ∈ K₀) + (_hlower : ∀ t ∈ K₀, ∀ j < k, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + {periodCap coverCap : ℝ} {Lip : ℝ≥0} + (W : Fin d → NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (D : RationalFilteredNilmanifold M t e) (_htk : t < k) + (R : Fin d → D.Niltest (fun _ : X => 1)) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (_hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (Ψ : PatchKernel (Fintype.card (LowTaggedIndex J k))) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (β : (X → ℤ) → Fin (Fintype.card (LowTaggedIndex J k)) → ℤ) + (_hβ : ∀ u ∈ integerBox N, ∀ i, + |MvPolynomial.eval (fun x => (u x : ℝ)) (lowTaggedPolynomial J k poly i) - + c i - (β u i : ℝ)| ≤ 1 / 2) + (p Rrank : ℝ), 0 ≤ p → (∀ j, (R j).ComplexityLE p) → + (∀ j, ((R j).normBound : ℝ) ≤ 1) → + ((Fintype.card X + Fintype.card (Σ j, J j) : ℕ) : ℝ) ≤ p → + (∀ j, ((W j).modulus : ℝ) ≤ Real.exp p) → + (∀ j, ((W j).cover : ℝ) ≤ Real.exp p) → + (Lip : ℝ) ≤ Real.exp p → (Ψ.lip : ℝ) ≤ Real.exp p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (N i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + (∀ j, Real.exp (-p) ≤ ‖𝔼 u ∈ integerBox N, + (W j).eval N poly u * majorPhaseSample J k poly Ψ c + (coordinate ((eQ.baseChange ℝ).coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight J) fast k (left⁻¹ * Z * right⁻¹).coord))) β (R j).eval u‖) → + FullChartDetectedMajorGradeConclusion (M := M) F b ω hF J k fast (eQ.baseChange ℝ) lift + Z left right K₀ U poly c N ((p + C) ^ C) := by + classical + obtain ⟨C, hC, hmatching⟩ := exists_full_restricted_grade_major_matching m k hk + refine ⟨C, hC, ?_⟩ + intro X L M ι Γ _ _ _ _ _ _ _ _ s t e _ _ _ _ F b ω hF J _ fast + v hspan H hHpos hv p₀ hp₀ hrows hcols hH hfast + obtain ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord⟩ := + exists_bounded_submodule_quotient_section_with_coordinates (F.associatedGradedBasis b ω hF) + fast v hspan hHpos hv hp₀ hrows hcols hH + refine ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord, ?_⟩ + intro Z left right K₀ hK₀ hlower periodCap coverCap Lip W D htk R N poly hpoly + U hcoeff Ψ c β hβ p Rrank hp hR hRcap hdim hmod hcover hLip hΨ hN hRrank hrank hcorr + have hstep := hmatching F b ω hF J fast (eQ.baseChange ℝ) lift hfast hsection + Z left right K₀ hK₀ hlower W D htk R N poly hpoly U hcoeff Ψ c β hβ p Rrank + hp hR hRcap hdim hmod hcover hLip hΨ hN hRrank hrank hcorr + exact fullChartDetectedMajorGradeConclusion_of_fullTagged F b ω hF J k fast + (eQ.baseChange ℝ) lift Z left right K₀ U poly c N ((p + C) ^ C) hstep + +theorem exists_bounded_full_chart_grade_major_family (m : ℕ) : + ∃ C : ℕ → ℕ, (∀ n, 2 ≤ C n) ∧ ∀ {X L M ι Γ : Type} [Fintype X] [DecidableEq X] [Fintype ι] [Fintype Γ] + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] {s t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (v : Γ → F.AssociatedGraded) + (_hspan : Submodule.span ℚ (Set.range v) = fast) + (H : ℕ) (_hHpos : 1 ≤ H) + (_hv : ∀ i j, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr (v j) i) H) + (p₀ : ℝ) (_hp₀ : 0 ≤ p₀) + (_hrows : (Fintype.card ι : ℝ) ≤ p₀) (_hcols : (Fintype.card Γ : ℝ) ≤ p₀) + (_hH : (H : ℝ) ≤ Real.exp p₀) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast), + ∃ d : ℕ, d ≤ Fintype.card ι ∧ + ∃ (eQ : Basis (Fin d) ℚ (F.AssociatedGraded ⧸ fast)) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) (qS : ℕ), + Function.RightInverse lift fast.mkQ ∧ + Function.RightInverse (lift.baseChange ℝ) (fast.mkQ.baseChange ℝ) ∧ + 0 < qS ∧ (qS : ℝ) ≤ Real.exp ((p₀ + 2) ^ 47) ∧ + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i| ≤ Real.exp ((p₀ + 2) ^ 45)) ∧ + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i) ∈ realDenominatorGrid qS) ∧ + (∀ j i, RationalHeightLE (((eQ.coord j).comp fast.mkQ) + (F.associatedGradedBasis b ω hF i)) ⌈Real.exp ((p₀ + 2) ^ 7)⌉₊) ∧ + ∀ (n : ℕ) (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight J i * t i) ∈ K₀) + (_hlower : ∀ t ∈ K₀, ∀ j < (n + 1), + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + {periodCap coverCap : ℝ} {Lip : ℝ≥0} + (W : Fin d → NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (D : RationalFilteredNilmanifold M t e) (_htk : t < (n + 1)) + (R : Fin d → D.Niltest (fun _ : X => 1)) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (_hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (Ψ : PatchKernel (Fintype.card (LowTaggedIndex J (n + 1)))) + (c : Fin (Fintype.card (LowTaggedIndex J (n + 1))) → ℝ) + (β : (X → ℤ) → Fin (Fintype.card (LowTaggedIndex J (n + 1))) → ℤ) + (_hβ : ∀ u ∈ integerBox N, ∀ i, + |MvPolynomial.eval (fun x => (u x : ℝ)) (lowTaggedPolynomial J (n + 1) poly i) - + c i - (β u i : ℝ)| ≤ 1 / 2) + (p Rrank : ℝ), 0 ≤ p → (∀ j, (R j).ComplexityLE p) → + (∀ j, ((R j).normBound : ℝ) ≤ 1) → + ((Fintype.card X + Fintype.card (Σ j, J j) : ℕ) : ℝ) ≤ p → + (∀ j, ((W j).modulus : ℝ) ≤ Real.exp p) → + (∀ j, ((W j).cover : ℝ) ≤ Real.exp p) → + (Lip : ℝ) ≤ Real.exp p → (Ψ.lip : ℝ) ≤ Real.exp p → + (∀ i, Real.exp ((p + C n) ^ C n) ≤ (N i : ℝ)) → + Real.exp ((p + C n) ^ C n) ≤ Rrank → + (∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + (∀ j, Real.exp (-p) ≤ ‖𝔼 u ∈ integerBox N, + (W j).eval N poly u * majorPhaseSample J (n + 1) poly Ψ c + (coordinate ((eQ.baseChange ℝ).coord j).toAddMonoidHom + (lowTaggedVectorRestrict J (n + 1) (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight J) fast (n + 1) (left⁻¹ * Z * right⁻¹).coord))) β (R j).eval u‖) → + FullChartDetectedMajorGradeConclusion (M := M) F b ω hF J (n + 1) fast (eQ.baseChange ℝ) lift + Z left right K₀ U poly c N ((p + C n) ^ C n) := by + classical + choose C hC hmatching using + (fun n : ℕ => exists_full_restricted_grade_major_matching m (n + 1) (Nat.zero_lt_succ n)) + refine ⟨C, hC, ?_⟩ + intro X L M ι Γ _ _ _ _ _ _ _ _ s t e _ _ _ _ F b ω hF J _ fast + v hspan H hHpos hv p₀ hp₀ hrows hcols hH hfast + obtain ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord⟩ := + exists_bounded_submodule_quotient_section_with_coordinates (F.associatedGradedBasis b ω hF) + fast v hspan hHpos hv hp₀ hrows hcols hH + refine ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord, ?_⟩ + intro n Z left right K₀ hK₀ hlower periodCap coverCap Lip W D htk R N poly hpoly + U hcoeff Ψ c β hβ p Rrank hp hR hRcap hdim hmod hcover hLip hΨ hN hRrank hrank hcorr + have hstep := hmatching n F b ω hF J fast (eQ.baseChange ℝ) lift hfast hsection + Z left right K₀ hK₀ hlower W D htk R N poly hpoly U hcoeff Ψ c β hβ p Rrank + hp hR hRcap hdim hmod hcover hLip hΨ hN hRrank hrank hcorr + exact fullChartDetectedMajorGradeConclusion_of_fullTagged F b ω hF J (n + 1) fast + (eQ.baseChange ℝ) lift Z left right K₀ U poly c N ((p + C n) ^ C n) hstep + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxBlockBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxBlockBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..65c1a59998eb1807a5df05add2765a4a9bd77856 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxBlockBudget.lean @@ -0,0 +1,399 @@ +import OAI.Combinatorics.Progressions.Estimates.ProgressionPartitionComposition +import OAI.Combinatorics.Progressions.Probability.ComplexPartitionMixture + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem expect_coordinate {ι : Type*} [Fintype ι] [DecidableEq ι] {X : ι → Type*} + [∀ i, Fintype (X i)] [∀ i, Nonempty (X i)] (i : ι) (f : X i → ℝ) : + (𝔼 x : (∀ j, X j), f (x i)) = 𝔼 a, f a := by + have h := Fintype.expect_equiv (Equiv.piSplitAt i X) + (fun x => f (x i)) (fun x => f x.1) (fun _ => rfl) + rw [h] + simpa using Finset.expect_product' (Finset.univ : Finset (X i)) + (Finset.univ : Finset (∀ j : {j // j ≠ i}, X j)) (fun a _ => f a) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def coordinateExceptional {ι X : Type*} [Fintype ι] [Fintype X] + (B : Finset X) : Finset (ι → X) := by + classical + exact Finset.univ.filter (fun x => ∃ i, x i ∈ B) + +theorem not_mem_coordinateExceptional {ι X : Type*} [Fintype ι] [Fintype X] + (B : Finset X) (x : ι → X) : x ∉ coordinateExceptional B ↔ ∀ i, x i ∉ B := by + classical + simp [coordinateExceptional] + +theorem coordinateExceptional_density_le {ι X : Type*} [Fintype ι] [DecidableEq ι] + [Fintype X] [Nonempty X] (B : Finset X) : + ((coordinateExceptional (ι := ι) B).card : ℝ) / Fintype.card (ι → X) ≤ + (Fintype.card ι : ℝ) * (B.card : ℝ) / Fintype.card X := by + classical + have hpoint (x : ι → X) : (if ∃ i, x i ∈ B then (1 : ℝ) else 0) ≤ + ∑ i, if x i ∈ B then (1 : ℝ) else 0 := by + by_cases h : ∃ i, x i ∈ B + · obtain ⟨i, hi⟩ := h + rw [ite_eq_left ⟨i, hi⟩] + calc + (1 : ℝ) = if x i ∈ B then 1 else 0 := by rw [ite_eq_left hi] + _ ≤ _ := Finset.single_le_sum + (f := fun j : ι => if x j ∈ B then (1 : ℝ) else 0) + (fun j _ => by split_ifs <;> norm_num) (Finset.mem_univ i) + · rw [ite_eq_right h] + exact Finset.sum_nonneg (fun j _ => by split_ifs <;> norm_num) + calc + _ = 𝔼 x : ι → X, if ∃ i, x i ∈ B then (1 : ℝ) else 0 := by + simp [coordinateExceptional, Fintype.expect_eq_sum_div_card] + congr 1 + ext x + simp + _ ≤ 𝔼 x : ι → X, ∑ i, if x i ∈ B then (1 : ℝ) else 0 := + Finset.expect_le_expect (fun x _ => hpoint x) + _ = ∑ i, 𝔼 x : ι → X, if x i ∈ B then (1 : ℝ) else 0 := Finset.expect_sum_comm _ _ _ + _ = ∑ _i : ι, (B.card : ℝ) / Fintype.card X := by + congr 1 + funext i + rw [expect_coordinate (X := fun _ : ι => X) i (fun x : X => if x ∈ B then (1 : ℝ) else 0)] + simp [Fintype.expect_eq_sum_div_card, Finset.sum_ite_mem] + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; ring + +end Erdos3 + +end + +section + +namespace Erdos3.BoxProgressionPartition + +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {N : ι → ℕ} + (P : ∀ i, FiniteProgressionPartition (N i)) + +def cell (x : ∀ i, Fin (N i)) : ∀ i, (P i).Label := fun i => (P i).cell (x i) + +def point (a : ∀ i, (P i).Label) (j : ∀ i, Fin ((P i).length (a i))) : ∀ i, Fin (N i) := + fun i => (P i).point (a i) (j i) + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem point_val (a : ∀ i, (P i).Label) (j : ∀ i, Fin ((P i).length (a i))) (i : ι) : + (point P a j i).val = (P i).start (a i) + (P i).step (a i) * (j i).val := + (P i).point_val _ _ + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem cell_point (a : ∀ i, (P i).Label) (j : ∀ i, Fin ((P i).length (a i))) : + cell P (point P a j) = a := by + funext i + exact (P i).cell_point _ _ + +noncomputable def pointEquiv (a : ∀ i, (P i).Label) : + (∀ i, Fin ((P i).length (a i))) ≃ ↥(partitionCell (cell P) a) := + (Equiv.piCongrRight (fun i => (P i).pointEquiv (a i))).trans + (Equiv.subtypePiEquivPi.symm.trans (Equiv.subtypeEquivRight (fun x => by + simp only [mem_partitionCell, cell, funext_iff]))) + +@[simp] theorem pointEquiv_val (a : ∀ i, (P i).Label) (j : ∀ i, Fin ((P i).length (a i))) : + (pointEquiv P a j).val = point P a j := rfl + +theorem card_cell (a : ∀ i, (P i).Label) : + (partitionCell (cell P) a).card = ∏ i, (P i).length (a i) := by + simpa only [Fintype.card_coe, Fintype.card_pi, Fintype.card_fin] using + (Fintype.card_congr (pointEquiv P a)).symm + +theorem expect_cell (a : ∀ i, (P i).Label) (f : (∀ i, Fin (N i)) → ℝ) : + (𝔼 x ∈ partitionCell (cell P) a, f x) = + 𝔼 j : (∀ i, Fin ((P i).length (a i))), f (point P a j) := by + have h := Fintype.expect_equiv (pointEquiv P a) + (fun j => f (point P a j)) (fun x => f x.val) (fun _ => rfl) + have hcoe : (𝔼 x : ↥(partitionCell (cell P) a), f x.val) = + 𝔼 x ∈ partitionCell (cell P) a, f x := by + rw [Fintype.expect_eq_sum_div_card, Finset.expect_eq_sum_div_card, Fintype.card_coe, + Finset.sum_coe_sort] + exact hcoe.symm.trans h.symm + +end Erdos3.BoxProgressionPartition + +end + +section + +namespace Erdos3.BoxProgressionPartition + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {N : ι → ℕ} + (P : ∀ i, FiniteProgressionPartition (N i)) + +noncomputable def normalizedPoint (x : ∀ i, Fin (N i)) : ι → ℝ := + fun i => (x i).val / (N i : ℝ) + +noncomputable def normalizedStart (a : ∀ i, (P i).Label) : ι → ℝ := + fun i => ((P i).start (a i) : ℝ) / N i + +omit [DecidableEq ι] in +theorem normalizedPoint_dist_start (hN : ∀ i, 0 < N i) {ρ : ℝ} (hρ : 0 ≤ ρ) + (a : ∀ i, (P i).Label) + (hwidth : ∀ i, ((P i).step (a i) : ℝ) * (P i).length (a i) ≤ ρ * N i) + (j : ∀ i, Fin ((P i).length (a i))) : + dist (normalizedPoint (point P a j)) (normalizedStart P a) ≤ ρ := by + apply (dist_pi_le_iff hρ).mpr + intro i + have hNi : (0 : ℝ) < N i := by exact_mod_cast hN i + have hj : ((j i).val : ℝ) ≤ (P i).length (a i) := by exact_mod_cast (j i).isLt.le + rw [Real.dist_eq] + change |((point P a j i).val : ℝ) / N i - ((P i).start (a i) : ℝ) / N i| ≤ ρ + rw [point_val, Nat.cast_add, Nat.cast_mul, ← sub_div, add_sub_cancel_left] + rw [abs_of_nonneg (by positivity)] + apply (div_le_iff₀ hNi).mpr + exact (mul_le_mul_of_nonneg_left hj (Nat.cast_nonneg _)).trans (hwidth i) + +omit [Fintype ι] [DecidableEq ι] in +theorem point_residue (a : ∀ i, (P i).Label) (j : ∀ i, Fin ((P i).length (a i))) + (q : ℕ) (hstep : ∀ i, q ∣ (P i).step (a i)) (i : ι) : + (point P a j i).val % q = (P i).start (a i) % q := by + rw [point_val, Nat.add_mod, Nat.mul_mod, Nat.mod_eq_zero_of_dvd (hstep i)] + simp + +omit [DecidableEq ι] in +theorem blocks_normalizedPoint_dist_start (q : ℕ) (H : ι → ℕ) + (hq : 0 < q) (hH : ∀ i, 0 < H i) (hN : ∀ i, 0 < N i) {ρ : ℝ} (hρ : 0 ≤ ρ) + (hfit : ∀ i, (q : ℝ) * H i ≤ ρ * N i) + (a : ∀ i, (FiniteProgressionPartition.blocks (N i) q (H i) hq (hH i)).Label) + (j : ∀ i, Fin ((FiniteProgressionPartition.blocks (N i) q (H i) hq (hH i)).length (a i))) : + dist (normalizedPoint (point (fun i => FiniteProgressionPartition.blocks (N i) q (H i) hq (hH i)) a j)) + (normalizedStart (fun i => FiniteProgressionPartition.blocks (N i) q (H i) hq (hH i)) a) ≤ ρ := by + apply normalizedPoint_dist_start _ hN hρ a _ j + intro i + have hlen : ((FiniteProgressionPartition.blocks (N i) q (H i) hq (hH i)).length (a i) : ℝ) ≤ H i := by + exact_mod_cast truncatedProgressionLength_le (N i) (progressionBlockStart (a i)) q (H i) + exact (mul_le_mul_of_nonneg_left hlen (Nat.cast_nonneg q)).trans (hfit i) + +end Erdos3.BoxProgressionPartition + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_partition_cell_norm_mean_le {X K : Type*} [Fintype X] [Nonempty X] + [Fintype K] (cell : X → K) (f : X → ℂ) : + ∃ k, (partitionCell cell k).Nonempty ∧ + ‖𝔼 x, f x‖ ≤ ‖𝔼 x ∈ partitionCell cell k, f x‖ := by + classical + obtain ⟨x, _, hx⟩ := Finset.univ.exists_max_image + (fun x : X => ‖𝔼 y ∈ partitionCell cell (cell x), f y‖) Finset.univ_nonempty + have hmax (k : K) : ‖𝔼 y ∈ partitionCell cell k, f y‖ ≤ + ‖𝔼 y ∈ partitionCell cell (cell x), f y‖ := by + by_cases hk : (partitionCell cell k).Nonempty + · obtain ⟨y, hy⟩ := hk + have h := hx y (Finset.mem_univ _) + simpa only [(mem_partitionCell cell k y).mp hy] using h + · rw [Finset.not_nonempty_iff_eq_empty.mp hk] + simp only [Finset.expect_empty, norm_zero] + exact norm_nonneg (𝔼 y ∈ partitionCell cell (cell x), f y) + refine ⟨cell x, ⟨x, (mem_partitionCell cell _ _).mpr rfl⟩, ?_⟩ + have hcard : (Fintype.card X : ℝ) ≠ 0 := by + exact_mod_cast (Fintype.card_ne_zero (α := X)) + rw [complex_expect_partition_count_weights cell f, card_partitionCell_sum] + calc + _ ≤ ∑ k, ‖(((partitionCell cell k).card : ℝ) / Fintype.card X : ℂ) * + (𝔼 y ∈ partitionCell cell k, f y)‖ := norm_sum_le _ _ + _ ≤ ∑ k, ((partitionCell cell k).card : ℝ) / Fintype.card X * + ‖𝔼 y ∈ partitionCell cell (cell x), f y‖ := by + apply Finset.sum_le_sum + intro k _ + simp only [norm_mul, norm_div, Complex.norm_real, norm_natCast] + exact mul_le_mul_of_nonneg_left (hmax k) (by positivity) + _ = ‖𝔼 y ∈ partitionCell cell (cell x), f y‖ := by + rw [← Finset.sum_mul, ← Finset.sum_div, card_partitionCell_sum, div_self hcard, + one_mul] + +namespace BoxProgressionPartition + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {N : ι → ℕ} + (P : ∀ i, FiniteProgressionPartition (N i)) + +theorem expect_cell_complex (a : ∀ i, (P i).Label) (f : (∀ i, Fin (N i)) → ℂ) : + (𝔼 x ∈ partitionCell (cell P) a, f x) = + 𝔼 j : (∀ i, Fin ((P i).length (a i))), f (point P a j) := by + have h := Fintype.expect_equiv (pointEquiv P a) + (fun j => f (point P a j)) (fun x => f x.val) (fun _ => rfl) + have hcoe : (𝔼 x : ↥(partitionCell (cell P) a), f x.val) = + 𝔼 x ∈ partitionCell (cell P) a, f x := by + rw [Fintype.expect_eq_sum_div_card, Finset.expect_eq_sum_div_card, Fintype.card_coe, + Finset.sum_coe_sort] + exact hcoe.symm.trans h.symm + +theorem exists_positive_box_norm_mean_le (hN : ∀ i, 0 < N i) (f : (ι → ℕ) → ℂ) : + ∃ a : ∀ i, (P i).Label, (∀ i, 0 < (P i).length (a i)) ∧ + ‖𝔼 x : (∀ i, Fin (N i)), f (fun i => (x i).val)‖ ≤ + ‖𝔼 j : (∀ i, Fin ((P i).length (a i))), + f (fun i => (P i).start (a i) + (P i).step (a i) * (j i).val)‖ := by + classical + let : Nonempty (∀ i, Fin (N i)) := ⟨fun i => ⟨0, hN i⟩⟩ + obtain ⟨a, ha, hmean⟩ := exists_partition_cell_norm_mean_le (cell P) + (fun x => f (fun i => (x i).val)) + refine ⟨a, ?_, ?_⟩ + · obtain ⟨x, hx⟩ := ha + let j := (pointEquiv P a).symm ⟨x, hx⟩ + exact fun i => Nat.zero_lt_of_lt (j i).isLt + · rw [expect_cell_complex] at hmean + simpa only [point_val] using hmean + +theorem exists_box_norm_mean_le (hN : ∀ i, 0 < N i) (f : (ι → ℕ) → ℂ) : + ∃ a : ∀ i, (P i).Label, + ‖𝔼 x : (∀ i, Fin (N i)), f (fun i => (x i).val)‖ ≤ + ‖𝔼 j : (∀ i, Fin ((P i).length (a i))), + f (fun i => (P i).start (a i) + (P i).step (a i) * (j i).val)‖ := by + obtain ⟨a, _, ha⟩ := exists_positive_box_norm_mean_le P hN f + exact ⟨a, ha⟩ + +end BoxProgressionPartition +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem short_progression_cell_mass_le {N : ℕ} (P : FiniteProgressionPartition N) + {L : ℝ} (hL : 0 ≤ L) : + (𝔼 n : Fin N, if ((P.length (P.cell n) : ℕ) : ℝ) < L then 1 else 0) ≤ + (Fintype.card P.Label : ℝ) * L / N := by + classical + let b : Fin N → ℝ := fun n => if (P.length (P.cell n) : ℝ) < L then 1 else 0 + have hcell (a : P.Label) : (∑ n ∈ partitionCell P.cell a, b n) ≤ L := by + have heq : (∑ n ∈ partitionCell P.cell a, b n) = + if (P.length a : ℝ) < L then (P.length a : ℝ) else 0 := by + calc + _ = ∑ _n ∈ partitionCell P.cell a, if (P.length a : ℝ) < L then (1 : ℝ) else 0 := by + apply Finset.sum_congr rfl + intro n hn + simp only [b, (mem_partitionCell _ _ _).mp hn] + _ = _ := by split_ifs <;> simp [P.card_cell] + rw [heq] + split_ifs with h + · exact h.le + · exact hL + have hsum := Finset.sum_le_sum (fun a (_ : a ∈ (Finset.univ : Finset P.Label)) => hcell a) + rw [sum_partitionCell] at hsum + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] at hsum + rw [Fintype.expect_eq_sum_div_card, Fintype.card_fin] + exact div_le_div_of_nonneg_right hsum (Nat.cast_nonneg N) + +theorem short_box_side_mass_le {ι : Type*} [Fintype ι] [DecidableEq ι] {N : ι → ℕ} + (P : ∀ i, FiniteProgressionPartition (N i)) (hN : ∀ i, 0 < N i) + (L : ι → ℝ) (hL : ∀ i, 0 ≤ L i) : + (𝔼 x : (∀ i, Fin (N i)), if (∀ i, L i ≤ ((P i).length ((P i).cell (x i)) : ℝ)) then 0 else 1) ≤ + ∑ i, (Fintype.card (P i).Label : ℝ) * L i / N i := by + classical + let : ∀ i, Nonempty (Fin (N i)) := fun i => ⟨⟨0, hN i⟩⟩ + have hpoint (x : ∀ i, Fin (N i)) : + (if (∀ i, L i ≤ ((P i).length ((P i).cell (x i)) : ℝ)) then (0 : ℝ) else 1) ≤ + ∑ i, if ((P i).length ((P i).cell (x i)) : ℝ) < L i then 1 else 0 := by + split_ifs with h + · exact Finset.sum_nonneg (fun _ _ => by split_ifs <;> norm_num) + · push Not at h + obtain ⟨i, hi⟩ := h + have hs := Finset.single_le_sum (s := Finset.univ) + (f := fun j => if ((P j).length ((P j).cell (x j)) : ℝ) < L j then (1 : ℝ) else 0) + (fun _ _ => by split_ifs <;> norm_num) (Finset.mem_univ i) + simpa only [hi, ite_true] using hs + apply (Finset.expect_le_expect (fun x _ => hpoint x)).trans + rw [Finset.expect_sum_comm] + apply Finset.sum_le_sum + intro i _ + rw [expect_coordinate (X := fun j => Fin (N j)) i + (fun n : Fin (N i) => if ((P i).length ((P i).cell n) : ℝ) < L i then (1 : ℝ) else 0)] + exact short_progression_cell_mass_le (P i) (hL i) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem progressionBlock_short_side_bound {N q H : ℕ} (hN : 0 < N) (hH : 0 < H) + (hfit : q * H ≤ N) {L : ℝ} (hL : 0 ≤ L) : + (Fintype.card (Fin q × Fin (N / q / H + 1)) : ℝ) * L / N ≤ 2 * L / H := by + have hNr : (0 : ℝ) < N := by exact_mod_cast hN + have hHr : (0 : ℝ) < H := by exact_mod_cast hH + apply (div_le_div_iff₀ hNr hHr).mpr + have hc : (Fintype.card (Fin q × Fin (N / q / H + 1)) : ℝ) * H ≤ 2 * N := by + exact_mod_cast progressionBlock_label_count_mul_le_twice hfit + nlinarith [mul_le_mul_of_nonneg_right hc hL] + +theorem boxBlock_short_side_budget {ι : Type*} [Fintype ι] (N H : ι → ℕ) (q : ℕ) + (hN : ∀ i, 0 < N i) (hH : ∀ i, 0 < H i) (hfit : ∀ i, q * H i ≤ N i) + {θ : ℝ} (hθ : 0 ≤ θ) : + (∑ i, (Fintype.card (Fin q × Fin (N i / q / H i + 1)) : ℝ) * + (θ * H i / (2 * (Fintype.card ι + 1))) / N i) ≤ θ := by + have hn : (0 : ℝ) < Fintype.card ι + 1 := by positivity + calc + _ ≤ ∑ i, 2 * (θ * H i / (2 * (Fintype.card ι + 1))) / H i := by + apply Finset.sum_le_sum + intro i _ + exact progressionBlock_short_side_bound (hN i) (hH i) (hfit i) (by positivity) + _ = ∑ _i : ι, θ / (Fintype.card ι + 1) := by + apply Finset.sum_congr rfl + intro i _ + have hHi : (H i : ℝ) ≠ 0 := by exact_mod_cast (hH i).ne' + field_simp + _ ≤ θ := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + rw [← mul_div_assoc] + apply (div_le_iff₀ hn).mpr + nlinarith + +theorem exists_box_block_mesh {ι : Type*} (N : ι → ℕ) (q : ℕ) (hq : 0 < q) + {ρ : ℝ} (hρ : 0 < ρ) (hρ1 : ρ ≤ 1) (hlarge : ∀ i, 2 * (q : ℝ) ≤ ρ * N i) : + ∃ H : ι → ℕ, (∀ i, 0 < H i) ∧ (∀ i, q * H i ≤ N i) ∧ + (∀ i, (q : ℝ) * H i ≤ ρ * N i) ∧ + (∀ i, ρ * N i / (2 * q) ≤ (H i : ℝ)) := by + let H : ι → ℕ := fun i => ⌊ρ * N i / q⌋₊ + have hqr : (0 : ℝ) < q := by exact_mod_cast hq + have hx (i) : 2 ≤ ρ * N i / q := (le_div_iff₀ hqr).mpr (hlarge i) + have hlo (i) : ρ * N i / q - 1 < (H i : ℝ) := Nat.sub_one_lt_floor _ + have hhi (i) : (H i : ℝ) ≤ ρ * N i / q := Nat.floor_le (by positivity) + have hH (i) : 0 < H i := by + have h : (0 : ℝ) < H i := by linarith [hlo i, hx i] + exact_mod_cast h + have hwidth (i) : (q : ℝ) * H i ≤ ρ * N i := by + have h := (le_div_iff₀ hqr).mp (hhi i) + simpa only [mul_comm] using h + refine ⟨H, hH, ?_, hwidth, ?_⟩ + · intro i + have h := (hwidth i).trans (mul_le_of_le_one_left (Nat.cast_nonneg (N i)) hρ1) + exact_mod_cast h + · intro i + have heq : ρ * N i / (2 * q) = (ρ * N i / q) / 2 := by ring + rw [heq] + linarith [hlo i, hx i] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxCertificate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxCertificate.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b7113540ad3e8f4d2dd627581e819721dfa58be --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxCertificate.lean @@ -0,0 +1,28 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3.BohrLattice.BoxCertificate + +open scoped BigOperators + +def realBox {n : ℕ} (r : Fin n → ℝ) : Set (Fin n → ℝ) := + Set.Icc (-r) r + +structure SuccessiveProductCertificate {n : ℕ} (Λ : AddSubgroup (Fin n → ℝ)) + (r : Fin n → ℝ) (B : ℝ) where + scale : Fin n → ℝ + point : Fin n → Fin n → ℝ + scale_nonneg : ∀ i, 0 ≤ scale i + point_mem : ∀ i, point i ∈ Λ + independent : LinearIndependent ℝ point + mem_scaledBox : ∀ i, point i ∈ realBox (scale i • r) + product_le : ∏ i, scale i ≤ B + +end Erdos3.BohrLattice.BoxCertificate + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxChartCutoff.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxChartCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..69b134ae3df81d652b51904f71417400980692af --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxChartCutoff.lean @@ -0,0 +1,160 @@ +import Mathlib.Analysis.Normed.Group.Constructions +import OAI.Combinatorics.Progressions.Estimates.SmoothSublevelCutoff +import OAI.Combinatorics.Progressions.Estimates.UniformProductAccuracy +import OAI.Combinatorics.Progressions.Geometry.ChartCutoff + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal ContDiff + +noncomputable def coordinateBoxCutoff {ι : Type*} [Fintype ι] + (χ : ℝ → ℝ) (r : ℝ) (v : ι → ℝ) : ℝ := ∏ i, χ (v i / r) + +theorem coordinateBoxCutoff_range {ι : Type*} [Fintype ι] (χ : ℝ → ℝ) + (hχ : ∀ x, 0 ≤ χ x ∧ χ x ≤ 1) (r : ℝ) (v : ι → ℝ) : + 0 ≤ coordinateBoxCutoff χ r v ∧ coordinateBoxCutoff χ r v ≤ 1 := by + exact ⟨Finset.prod_nonneg (fun i _ => (hχ _).1), + Finset.prod_le_one₀ (fun index _ => (hχ _).1) (fun index _ => (hχ _).2)⟩ + +theorem coordinateBoxCutoff_eq_one {ι : Type*} [Fintype ι] (χ : ℝ → ℝ) + (hχ : ∀ x, |x| ≤ 1 / 2 → χ x = 1) {r : ℝ} (hr : 0 < r) + (v : ι → ℝ) (hv : ∀ i, |v i| ≤ r / 2) : coordinateBoxCutoff χ r v = 1 := by + apply Finset.prod_eq_one + intro i _ + apply hχ + rw [abs_div, abs_of_pos hr] + apply (div_le_iff₀ hr).mpr + linarith [hv i] + +theorem coordinateBoxCutoff_eq_zero {ι : Type*} [Fintype ι] (χ : ℝ → ℝ) + (hχ : ∀ x, 3 / 4 ≤ |x| → χ x = 0) {r : ℝ} (hr : 0 < r) + (v : ι → ℝ) (hv : ∃ i, 3 * r / 4 ≤ |v i|) : coordinateBoxCutoff χ r v = 0 := by + classical + obtain ⟨i, hi⟩ := hv + apply Finset.prod_eq_zero (Finset.mem_univ i) + apply hχ + rw [abs_div, abs_of_pos hr] + apply (le_div_iff₀ hr).mpr + linarith + +theorem contDiff_coordinateBoxCutoff {ι : Type*} [Fintype ι] (χ : ℝ → ℝ) + (hχ : ContDiff ℝ ∞ χ) (r : ℝ) : ContDiff ℝ ∞ (coordinateBoxCutoff (ι := ι) χ r) := by + unfold coordinateBoxCutoff + apply contDiff_prod + intro i _ + exact hχ.comp ((ContinuousLinearMap.proj i : (ι → ℝ) →L[ℝ] ℝ).contDiff.div_const r) + +theorem hasCompactSupport_coordinateBoxCutoff {ι : Type*} [Fintype ι] (χ : ℝ → ℝ) + (hχ : ∀ x, 3 / 4 ≤ |x| → χ x = 0) {r : ℝ} (hr : 0 < r) : + HasCompactSupport (coordinateBoxCutoff (ι := ι) χ r) := by + apply HasCompactSupport.of_support_subset_isCompact + (isCompact_closedBall (0 : ι → ℝ) (3 * r / 4)) + intro v hv + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg (by positivity : 0 ≤ 3 * r / 4)).mpr + intro i + rw [Real.norm_eq_abs] + by_contra! hi + exact hv (coordinateBoxCutoff_eq_zero χ hχ hr v ⟨i, hi.le⟩) + +theorem lipschitz_coordinateBoxCutoff {ι : Type*} [Fintype ι] (χ : ℝ → ℝ) (A r : ℝ≥0) + (hr : 0 < r) (hχ : ∀ x, 0 ≤ χ x ∧ χ x ≤ 1) (hLip : LipschitzWith A χ) : + LipschitzWith (Fintype.card ι * A / r) (coordinateBoxCutoff (ι := ι) χ r) := by + apply LipschitzWith.of_dist_le_mul + intro v w + have hr' : (0 : ℝ) < r := hr + have hcoord (i) : |v i - w i| ≤ dist v w := by + simpa only [Real.dist_eq] using dist_le_pi_dist v w i + have hd (i) : |χ (v i / r) - χ (w i / r)| ≤ ((A : ℝ) / r) * dist v w := by + have h := hLip.dist_le_mul (v i / r) (w i / r) + rw [Real.dist_eq, Real.dist_eq, ← sub_div, abs_div, abs_of_pos hr'] at h + apply h.trans + calc + (A : ℝ) * (|v i - w i| / r) = ((A : ℝ) / r) * |v i - w i| := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left (hcoord i) (by positivity) + have hprod := abs_finset_prod_sub_prod_le Finset.univ (fun i => χ (v i / r)) + (fun i => χ (w i / r)) (B := 1) (δ := ((A : ℝ) / r) * dist v w) le_rfl (by positivity) + (fun i _ => by rw [abs_of_nonneg (hχ _).1]; exact (hχ _).2) + (fun i _ => by rw [abs_of_nonneg (hχ _).1]; exact (hχ _).2) (fun i _ => hd i) + rw [Real.dist_eq] + apply hprod.trans_eq + simp only [Finset.card_univ, one_pow, mul_one, NNReal.coe_div, NNReal.coe_mul, NNReal.coe_natCast] + ring + +theorem exists_smooth_box_cutoffs : + ∃ A : ℝ≥0, 1 ≤ A ∧ ∀ {ι : Type*} [Fintype ι] (r : ℝ≥0), 0 < r → + ∃ ψ : (ι → ℝ) → ℝ, ContDiff ℝ ∞ ψ ∧ HasCompactSupport ψ ∧ + (∀ v, 0 ≤ ψ v ∧ ψ v ≤ 1) ∧ + (∀ v, (∀ i, |v i| ≤ (r : ℝ) / 2) → ψ v = 1) ∧ + (∀ v, (∃ i, 3 * (r : ℝ) / 4 ≤ |v i|) → ψ v = 0) ∧ + LipschitzWith (Fintype.card ι * A / r) ψ := by + obtain ⟨A, hA, χ, hsmooth, hχ, hone, hzero, hLip⟩ := exists_smooth_scalar_cutoff + refine ⟨A, hA, ?_⟩ + intro ι _ r hr + exact ⟨coordinateBoxCutoff χ r, contDiff_coordinateBoxCutoff χ hsmooth r, + hasCompactSupport_coordinateBoxCutoff χ hzero hr, + coordinateBoxCutoff_range χ hχ r, coordinateBoxCutoff_eq_one χ hone hr, + coordinateBoxCutoff_eq_zero χ hzero hr, lipschitz_coordinateBoxCutoff χ A r hr hχ hLip⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Set + +theorem support_subset_box_of_cutoff {ι : Type*} [Fintype ι] (ψ : (ι → ℝ) → ℝ) + {r : ℝ} (hr : 0 < r) (hzero : ∀ v, (∃ i, 3 * r / 4 ≤ |v i|) → ψ v = 0) : + Function.support ψ ⊆ Metric.closedBall 0 (3 * r / 4) := by + intro v hv + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg (by positivity : 0 ≤ 3 * r / 4)).mpr + intro i + rw [Real.norm_eq_abs] + by_contra! hi + exact hv (hzero v ⟨i, hi.le⟩) + +theorem closedBox_subset_chart_source {ι X : Type*} [Fintype ι] [TopologicalSpace X] + (φ : OpenPartialHomeomorph (ι → ℝ) X) {r : ℝ} (hr : 0 < r) + (hsource : φ.source = {v | ∀ i, |v i| < r}) : + Metric.closedBall 0 (3 * r / 4) ⊆ φ.source := by + intro v hv + rw [hsource] + intro i + rw [Metric.mem_closedBall, dist_zero_right] at hv + have hi := (norm_le_pi_norm v i).trans hv + rw [Real.norm_eq_abs] at hi + linarith + +theorem boxChartCutoff_support {ι X : Type*} [Fintype ι] [TopologicalSpace X] [T2Space X] + (φ : OpenPartialHomeomorph (ι → ℝ) X) (ψ : (ι → ℝ) → ℝ) {r : ℝ} (hr : 0 < r) + (hsource : φ.source = {v | ∀ i, |v i| < r}) + (hzero : ∀ v, (∃ i, 3 * r / 4 ≤ |v i|) → ψ v = 0) : + HasCompactSupport (chartCutoff φ ψ) ∧ tsupport (chartCutoff φ ψ) ⊆ φ.target := by + have hS := closedBox_subset_chart_source φ hr hsource + have hsupport := support_subset_box_of_cutoff ψ hr hzero + refine ⟨hasCompactSupport_chartCutoff φ ψ (isCompact_closedBall _ _) hS hsupport, ?_⟩ + intro x hx + obtain ⟨v, hv, rfl⟩ := tsupport_chartCutoff_subset φ ψ (isCompact_closedBall _ _) hS hsupport hx + exact φ.map_source (hS hv) + +theorem boxChartCutoff_eq_one {ι X : Type*} [Fintype ι] [TopologicalSpace X] + (φ : OpenPartialHomeomorph (ι → ℝ) X) (ψ : (ι → ℝ) → ℝ) {r : ℝ} (hr : 0 < r) + (hsource : φ.source = {v | ∀ i, |v i| < r}) + (hone : ∀ v, (∀ i, |v i| ≤ r / 2) → ψ v = 1) (v : ι → ℝ) + (hv : ∀ i, |v i| ≤ r / 2) : chartCutoff φ ψ (φ v) = 1 := by + rw [chartCutoff_apply φ ψ (by rw [hsource]; intro i; linarith [hv i])] + exact hone v hv + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxCornerMean.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxCornerMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..654a2b9ba4de78b5afaf715453e5a1cd177530ff --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxCornerMean.lean @@ -0,0 +1,450 @@ +import OAI.Combinatorics.Progressions.Geometry.BoxDifferenceHom + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def MissesBoxCoordinate {n : ℕ} {X : Type*} (U : (Fin n → X) → ℂ) (i : Fin n) : Prop := + ∀ x a, U (Function.update x i a) = U x + +theorem missesBoxCoordinate_head {n : ℕ} {X : Type*} + {U : (Fin (n + 1) → X) → ℂ} (hU : MissesBoxCoordinate U 0) + (a b : X) (x : Fin n → X) : U (Fin.cons a x) = U (Fin.cons b x) := by + simpa only [Fin.update_cons_zero] using hU (Fin.cons b x) a + +noncomputable def boxTailPhase {n : ℕ} {X : Type*} + (F : (Fin (n + 1) → X) → ℂ) (a b : X) (x : Fin n → X) : ℂ := + F (Fin.cons a x) * star (F (Fin.cons b x)) + +noncomputable def boxTailTests {n : ℕ} {X : Type*} + (U : Fin (n + 1) → (Fin (n + 1) → X) → ℂ) (a b : X) + (i : Fin n) (x : Fin n → X) : ℂ := + U i.succ (Fin.cons a x) * star (U i.succ (Fin.cons b x)) + +theorem boxTailTests_misses {n : ℕ} {X : Type*} + (U : Fin (n + 1) → (Fin (n + 1) → X) → ℂ) + (hU : ∀ i, MissesBoxCoordinate (U i) i) (a b : X) (i : Fin n) : + MissesBoxCoordinate (boxTailTests U a b i) i := by + intro x c + simp only [boxTailTests, Fin.cons_update] + rw [hU i.succ (Fin.cons a x) c, hU i.succ (Fin.cons b x) c] + +theorem boxTailTests_norm {n : ℕ} {X : Type*} + (U : Fin (n + 1) → (Fin (n + 1) → X) → ℂ) + (hU : ∀ i x, ‖U i x‖ ≤ 1) (a b : X) (i : Fin n) (x : Fin n → X) : + ‖boxTailTests U a b i x‖ ≤ 1 := by + rw [boxTailTests, norm_mul, norm_star] + exact (mul_le_mul (hU _ _) (hU _ _) (norm_nonneg _) (by norm_num)).trans_eq (one_mul 1) + +noncomputable def boxTestCorrelation {n : ℕ} {X : Type*} [Fintype X] + (F : (Fin n → X) → ℂ) (U : Fin n → (Fin n → X) → ℂ) : ℂ := + 𝔼 x, F x * ∏ i, U i x + +theorem boxTestCorrelation_zero {X : Type*} [Fintype X] + (F : (Fin 0 → X) → ℂ) (U : Fin 0 → (Fin 0 → X) → ℂ) : + boxTestCorrelation F U = F (fun i => Fin.elim0 i) := by + simp only [boxTestCorrelation, Fin.prod_univ_zero, mul_one, expect_empty_tuple] + +noncomputable def boxPhaseMoment {X : Type*} [Fintype X] (n : ℕ) + (F : (Fin n → X) → ℂ) : ℂ := + 𝔼 u, 𝔼 v, iteratedBoxDifference n (fun x (_ : Unit) => F x) u v () + +theorem boxPhaseMoment_zero {X : Type*} [Fintype X] (F : (Fin 0 → X) → ℂ) : + boxPhaseMoment 0 F = F (fun i => Fin.elim0 i) := by + simp only [boxPhaseMoment, iteratedBoxDifference, Fintype.expect_const] + +theorem boxPhaseMoment_succ {X : Type*} [Fintype X] (n : ℕ) + (F : (Fin (n + 1) → X) → ℂ) : + boxPhaseMoment (n + 1) F = 𝔼 a, 𝔼 b, boxPhaseMoment n (boxTailPhase F a b) := by + rw [boxPhaseMoment, expect_two_dependent_fin_cons] + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def boxCorner {n : ℕ} {X : Type*} (u v : Fin n → X) (ω : Fin n → Bool) : Fin n → X := + fun i => if ω i then v i else u i + +def boxCornerProduct {n : ℕ} {X : Type*} (F : (Fin n → X) → ℂ) (u v : Fin n → X) : ℂ := + ∏ ω : Fin n → Bool, conjugationPower (booleanWeight ω) (F (boxCorner u v ω)) + +theorem conjugationPower_eq_if_mod (n : ℕ) (z : ℂ) : + conjugationPower n z = if n % 2 = 0 then z else star z := by + induction n with + | zero => simp [conjugationPower] + | succ n ih => + have hn : n % 2 = 0 ∨ n % 2 = 1 := by omega + rcases hn with hn | hn <;> + simp [conjugationPower, ih, Nat.add_mod, hn] + +theorem boxCorner_cons_false {n : ℕ} {X : Type*} (u v : Fin (n + 1) → X) (ω : Fin n → Bool) : + boxCorner u v (Fin.cons false ω) = Fin.cons (u 0) (boxCorner (Fin.tail u) (Fin.tail v) ω) := by + funext i + refine Fin.cases ?_ (fun j => ?_) i <;> rfl + +theorem boxCorner_cons_true {n : ℕ} {X : Type*} (u v : Fin (n + 1) → X) (ω : Fin n → Bool) : + boxCorner u v (Fin.cons true ω) = Fin.cons (v 0) (boxCorner (Fin.tail u) (Fin.tail v) ω) := by + funext i + refine Fin.cases ?_ (fun j => ?_) i <;> rfl + +theorem boxCornerProduct_mul {n : ℕ} {X : Type*} (F G : (Fin n → X) → ℂ) (u v : Fin n → X) : + boxCornerProduct (fun x => F x * G x) u v = boxCornerProduct F u v * boxCornerProduct G u v := by + simp only [boxCornerProduct, map_mul, Finset.prod_mul_distrib] + +theorem boxCornerProduct_star {n : ℕ} {X : Type*} (F : (Fin n → X) → ℂ) (u v : Fin n → X) : + boxCornerProduct (fun x => star (F x)) u v = star (boxCornerProduct F u v) := by + simp only [boxCornerProduct, conjugationPower_star, star_prod] + +theorem boxCornerProduct_succ {n : ℕ} {X : Type*} (F : (Fin (n + 1) → X) → ℂ) + (u v : Fin (n + 1) → X) : + boxCornerProduct F u v = + boxCornerProduct (fun x => F (Fin.cons (u 0) x)) (Fin.tail u) (Fin.tail v) * + star (boxCornerProduct (fun x => F (Fin.cons (v 0) x)) (Fin.tail u) (Fin.tail v)) := by + simp only [boxCornerProduct] + rw [prod_bool_tuple_succ] + simp only [booleanWeight_cons_false, booleanWeight_cons_true, boxCorner_cons_false, + boxCorner_cons_true, conjugationPower, RingHom.comp_apply, starRingEnd_apply, star_prod] + +theorem iteratedBoxDifference_eq_cornerProduct {X Z : Type*} (n : ℕ) + (F : (Fin n → X) → Z → ℂ) (u v : Fin n → X) (z : Z) : + iteratedBoxDifference n F u v z = boxCornerProduct (fun x => F x z) u v := by + induction n with + | zero => + rw [boxCornerProduct, Fintype.prod_subsingleton _ (default : Fin 0 → Bool)] + simp only [booleanWeight, Fin.sum_univ_zero, conjugationPower, RingHom.id_apply, iteratedBoxDifference] + congr 1 + funext i + exact Fin.elim0 i + | succ n ih => + rw [iteratedBoxDifference, ih, boxCornerProduct_mul, boxCornerProduct_star, boxCornerProduct_succ] + +theorem boxPhaseMoment_eq_expect_cornerProduct {n : ℕ} {X : Type*} [Fintype X] + (F : (Fin n → X) → ℂ) : + boxPhaseMoment n F = 𝔼 u, 𝔼 v, boxCornerProduct F u v := by + simp only [boxPhaseMoment, iteratedBoxDifference_eq_cornerProduct] + +theorem boxCorner_pair {n : ℕ} {X : Type*} (x : (Fin n × Bool) → X) (ω : Fin n → Bool) : + boxCorner (fun i => x (i, false)) (fun i => x (i, true)) ω = fun i => x (i, ω i) := by + funext i + cases h : ω i <;> simp [boxCorner, h] + +theorem boxCornerProduct_map {n : ℕ} {X Y : Type*} (φ : X → Y) + (F : (Fin n → Y) → ℂ) (u v : Fin n → X) : + boxCornerProduct (fun x => F (fun i => φ (x i))) u v = + boxCornerProduct F (fun i => φ (u i)) (fun i => φ (v i)) := by + unfold boxCornerProduct + apply Finset.prod_congr rfl + intro ω _ + apply congrArg (conjugationPower (booleanWeight ω)) + change F (fun i => φ (boxCorner u v ω i)) = + F (boxCorner (fun i => φ (u i)) (fun i => φ (v i)) ω) + apply congrArg F + funext i + cases h : ω i <;> simp [boxCorner, h] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def boxTailAmplitude {n : ℕ} {X : Type*} + (F : (Fin (n + 1) → X) → ℂ) (U : Fin (n + 1) → (Fin (n + 1) → X) → ℂ) + (a : X) (x : Fin n → X) : ℂ := + F (Fin.cons a x) * ∏ i : Fin n, U i.succ (Fin.cons a x) + +theorem boxTailAmplitude_cross {n : ℕ} {X : Type*} + (F : (Fin (n + 1) → X) → ℂ) (U : Fin (n + 1) → (Fin (n + 1) → X) → ℂ) + (a b : X) (x : Fin n → X) : + boxTailAmplitude F U a x * star (boxTailAmplitude F U b x) = + boxTailPhase F a b x * ∏ i, boxTailTests U a b i x := by + simp only [boxTailAmplitude, boxTailPhase, boxTailTests, star_mul, star_prod, + Finset.prod_mul_distrib] + ring + +theorem boxTestCorrelation_head {n : ℕ} {X : Type*} [Fintype X] + (F : (Fin (n + 1) → X) → ℂ) (U : Fin (n + 1) → (Fin (n + 1) → X) → ℂ) + (hU : MissesBoxCoordinate (U 0) 0) (base : X) : + boxTestCorrelation F U = + 𝔼 x : Fin n → X, U 0 (Fin.cons base x) * (𝔼 a, boxTailAmplitude F U a x) := by + rw [boxTestCorrelation, expect_dependent_fin_cons, Finset.expect_comm] + apply Finset.expect_congr rfl + intro x _ + rw [Finset.mul_expect] + apply Finset.expect_congr rfl + intro a _ + rw [Fin.prod_univ_succ, missesBoxCoordinate_head hU a base x] + unfold boxTailAmplitude + ring + +theorem boxTestCorrelation_square_le {n : ℕ} {X : Type*} [Fintype X] [Nonempty X] + (F : (Fin (n + 1) → X) → ℂ) (U : Fin (n + 1) → (Fin (n + 1) → X) → ℂ) + (hU : ∀ x, ‖U 0 x‖ ≤ 1) (hmiss : MissesBoxCoordinate (U 0) 0) : + ‖boxTestCorrelation F U‖ ^ 2 ≤ + (𝔼 a, 𝔼 b, boxTestCorrelation (boxTailPhase F a b) (boxTailTests U a b)).re := by + let base : X := Classical.choice inferInstance + have h := finite_family_cauchy_schwarz_re + (fun x : Fin n → X => U 0 (Fin.cons base x)) (boxTailAmplitude F U) + (fun x => hU (Fin.cons base x)) + rw [← boxTestCorrelation_head F U hmiss base] at h + simp only [one_pow, one_mul] at h + simp_rw [boxTailAmplitude_cross] at h + exact h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def boxCornerAnchor {n : ℕ} {X : Type*} + (F : (Fin n → X) → ℂ) (a z : Fin n → X) : ℂ := by + classical + exact ∏ ω ∈ (Finset.univ.erase (fun _ : Fin n => false)), + conjugationPower (booleanWeight ω) (F (boxCorner z a ω)) + +theorem boxCornerProduct_eq_mul_anchor {n : ℕ} {X : Type*} + (F : (Fin n → X) → ℂ) (z a : Fin n → X) : + boxCornerProduct F z a = F z * boxCornerAnchor F a z := by + classical + have h := (Finset.mul_prod_erase Finset.univ + (fun ω => conjugationPower (booleanWeight ω) (F (boxCorner z a ω))) + (Finset.mem_univ (fun _ : Fin n => false))).symm + have hz : boxCorner z a (fun _ => false) = z := rfl + simpa [boxCornerProduct, boxCornerAnchor, booleanWeight, hz, conjugationPower] using h + +theorem boxCornerAnchor_norm_le_one {n : ℕ} {X : Type*} + (F : (Fin n → X) → ℂ) (hF : ∀ z, ‖F z‖ ≤ 1) (a z : Fin n → X) : + ‖boxCornerAnchor F a z‖ ≤ 1 := by + classical + unfold boxCornerAnchor + rw [norm_prod] + apply Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) + intro ω _ + rw [conjugationPower_eq_if_mod] + split_ifs <;> simpa only [norm_star] using hF (boxCorner z a ω) + +theorem boxCornerAnchor_map {n : ℕ} {X Y : Type*} (φ : X → Y) + (F : (Fin n → Y) → ℂ) (a z : Fin n → X) : + boxCornerAnchor (fun x => F (fun i => φ (x i))) a z = + boxCornerAnchor F (fun i => φ (a i)) (fun i => φ (z i)) := by + classical + unfold boxCornerAnchor + apply Finset.prod_congr rfl + intro ω _ + apply congrArg (conjugationPower (booleanWeight ω)) + apply congrArg F + funext i + cases h : ω i <;> simp [boxCorner, h] + +theorem boxCornerAnchor_prod_equiv {n m : ℕ} {X : Type*} + (e : Fin m ≃ (Finset.univ.erase (fun _ : Fin n => false))) + (F : (Fin n → X) → ℂ) (a z : Fin n → X) : + (∏ l, conjugationPower (booleanWeight (e l).val) (F (boxCorner z a (e l).val))) = + boxCornerAnchor F a z := by + classical + calc + _ = ∏ ω : (Finset.univ.erase (fun _ : Fin n => false)), + conjugationPower (booleanWeight ω.val) (F (boxCorner z a ω.val)) := + Fintype.prod_equiv e _ _ (fun _ => rfl) + _ = _ := by + unfold boxCornerAnchor + exact Finset.prod_coe_sort (Finset.univ.erase (fun _ : Fin n => false)) + (fun ω : Fin n → Bool => conjugationPower (booleanWeight ω) (F (boxCorner z a ω))) + +theorem exists_box_corner_anchor_correlation {n : ℕ} {X : Type*} + [Fintype X] [Nonempty X] (F : (Fin n → X) → ℂ) : + ∃ a : Fin n → X, (boxPhaseMoment n F).re ≤ + ‖𝔼 z : Fin n → X, F z * boxCornerAnchor F a z‖ := by + have hm : boxPhaseMoment n F = + 𝔼 a : Fin n → X, 𝔼 z : Fin n → X, F z * boxCornerAnchor F a z := by + rw [boxPhaseMoment_eq_expect_cornerProduct, Finset.expect_comm] + simp_rw [boxCornerProduct_eq_mul_anchor] + have hmean : (boxPhaseMoment n F).re = + 𝔼 a : Fin n → X, (𝔼 z : Fin n → X, F z * boxCornerAnchor F a z).re := by + rw [hm, expect_re] + obtain ⟨a, _, ha⟩ := Finset.exists_le_of_le_expect Finset.univ_nonempty hmean.le + exact ⟨a, ha.trans (Complex.re_le_norm _)⟩ + +theorem exists_true_of_ne_false {n : ℕ} {ω : Fin n → Bool} + (h : ω ≠ fun _ => false) : ∃ k, ω k = true := by + obtain ⟨k, hk⟩ := Function.ne_iff.mp h + refine ⟨k, ?_⟩ + cases he : ω k <;> simp_all + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem boxTest_cauchySchwarz {X : Type*} [Fintype X] [Nonempty X] (n : ℕ) : + ∀ (F : (Fin (n + 1) → X) → ℂ) (U : Fin (n + 1) → (Fin (n + 1) → X) → ℂ), + (∀ i x, ‖U i x‖ ≤ 1) → (∀ i, MissesBoxCoordinate (U i) i) → + ‖boxTestCorrelation F U‖ ^ (2 ^ (n + 1)) ≤ (boxPhaseMoment (n + 1) F).re := by + induction n with + | zero => + intro F U hU hmiss + simpa only [Nat.zero_add, pow_one, boxPhaseMoment_succ, + boxPhaseMoment_zero, boxTestCorrelation_zero] using + boxTestCorrelation_square_le F U (hU 0) (hmiss 0) + | succ n ih => + intro F U hU hmiss + have hr : (𝔼 a, 𝔼 b, boxTestCorrelation (boxTailPhase F a b) (boxTailTests U a b)).re ≤ + 𝔼 a, 𝔼 b, ‖boxTestCorrelation (boxTailPhase F a b) (boxTailTests U a b)‖ := by + simp only [expect_re] + apply Finset.expect_le_expect + intro a _ + apply Finset.expect_le_expect + intro b _ + exact Complex.re_le_norm _ + have hcs := (boxTestCorrelation_square_le F U (hU 0) (hmiss 0)).trans hr + calc + _ = (‖boxTestCorrelation F U‖ ^ 2) ^ (2 ^ (n + 1)) := by + rw [← pow_mul, pow_succ] + congr 1 + omega + _ ≤ (𝔼 a, 𝔼 b, ‖boxTestCorrelation (boxTailPhase F a b) (boxTailTests U a b)‖) ^ + (2 ^ (n + 1)) := pow_le_pow_left₀ (sq_nonneg _) hcs _ + _ ≤ 𝔼 a, 𝔼 b, ‖boxTestCorrelation (boxTailPhase F a b) (boxTailTests U a b)‖ ^ + (2 ^ (n + 1)) := expect_double_pow_two_pow_le (n + 1) _ (fun _ _ => norm_nonneg _) + _ ≤ 𝔼 a, 𝔼 b, (boxPhaseMoment (n + 1) (boxTailPhase F a b)).re := by + apply Finset.expect_le_expect + intro a _ + apply Finset.expect_le_expect + intro b _ + exact ih _ _ (boxTailTests_norm U hU a b) (boxTailTests_misses U hmiss a b) + _ = _ := by rw [boxPhaseMoment_succ]; simp only [expect_re] + +theorem boxTest_cauchySchwarz_of_pos {X : Type*} [Fintype X] [Nonempty X] {h : ℕ} + (hh : 0 < h) (F : (Fin h → X) → ℂ) (U : Fin h → (Fin h → X) → ℂ) + (hU : ∀ i x, ‖U i x‖ ≤ 1) (hmiss : ∀ i, MissesBoxCoordinate (U i) i) : + ‖boxTestCorrelation F U‖ ^ (2 ^ h) ≤ (boxPhaseMoment h F).re := by + obtain ⟨n, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hh) + exact boxTest_cauchySchwarz n F U hU hmiss + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def assignedBoxTest {n : ℕ} {S X : Type*} [Fintype S] + (assignment : S → Fin n) (U : S → (Fin n → X) → ℂ) + (i : Fin n) (x : Fin n → X) : ℂ := + ∏ s, if assignment s = i then U s x else 1 + +theorem assignedBoxTest_prod {n : ℕ} {S X : Type*} [Fintype S] + (assignment : S → Fin n) (U : S → (Fin n → X) → ℂ) (x : Fin n → X) : + (∏ i, assignedBoxTest assignment U i x) = ∏ s, U s x := by + unfold assignedBoxTest + rw [Finset.prod_comm] + apply Finset.prod_congr rfl + intro s _ + simp + +theorem assignedBoxTest_norm {n : ℕ} {S X : Type*} [Fintype S] + (assignment : S → Fin n) (U : S → (Fin n → X) → ℂ) + (hU : ∀ s x, ‖U s x‖ ≤ 1) (i : Fin n) (x : Fin n → X) : + ‖assignedBoxTest assignment U i x‖ ≤ 1 := by + rw [assignedBoxTest, norm_prod] + apply Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) + intro s _ + split_ifs + · exact hU s x + · simp only [norm_one, le_refl] + +theorem assignedBoxTest_misses {n : ℕ} {S X : Type*} [Fintype S] + (assignment : S → Fin n) (U : S → (Fin n → X) → ℂ) + (hU : ∀ s, MissesBoxCoordinate (U s) (assignment s)) (i : Fin n) : + MissesBoxCoordinate (assignedBoxTest assignment U i) i := by + intro x a + apply Finset.prod_congr rfl + intro s _ + by_cases hs : assignment s = i + · simp only [hs, ite_true] + simpa only [hs] using hU s x a + · simp only [hs, ite_false] + +theorem assigned_site_cauchySchwarz {h : ℕ} {S X : Type*} + [Fintype S] [Fintype X] [Nonempty X] (hh : 0 < h) + (F : (Fin h → X) → ℂ) (assignment : S → Fin h) + (U : S → (Fin h → X) → ℂ) (hU : ∀ s x, ‖U s x‖ ≤ 1) + (hmiss : ∀ s, MissesBoxCoordinate (U s) (assignment s)) : + ‖𝔼 x, F x * ∏ s, U s x‖ ^ (2 ^ h) ≤ (boxPhaseMoment h F).re := by + have hc := boxTest_cauchySchwarz_of_pos hh F (assignedBoxTest assignment U) + (assignedBoxTest_norm assignment U hU) (assignedBoxTest_misses assignment U hmiss) + simpa only [boxTestCorrelation, assignedBoxTest_prod] using hc + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def boxPairEquiv (n : ℕ) (X : Type*) : + ((Fin n × Bool) → X) ≃ ((Fin n → X) × (Fin n → X)) where + toFun x := (fun i => x (i, false), fun i => x (i, true)) + invFun u := fun p => if p.2 then u.2 p.1 else u.1 p.1 + left_inv x := by + funext p + rcases p with ⟨i, b⟩ + cases b <;> rfl + right_inv u := by + rcases u with ⟨u, v⟩ + rfl + +theorem integerBox_cornerProduct_mean (n N : ℕ) [NeZero N] (F : (Fin n → ℤ) → ℂ) : + (𝔼 x ∈ integerBox (fun _ : Fin n × Bool => N), + boxCornerProduct F (fun i => x (i, false)) (fun i => x (i, true))) = + boxPhaseMoment n (fun x : Fin n → ZMod N => F (fun i => (x i).val)) := by + rw [integerBox_expect_eq_zmod, boxPhaseMoment_eq_expect_cornerProduct] + have hmap (u v : Fin n → ZMod N) : + boxCornerProduct (fun x => F (fun i => ((x i).val : ℤ))) u v = + boxCornerProduct F (fun i => ((u i).val : ℤ)) (fun i => ((v i).val : ℤ)) := + boxCornerProduct_map (fun z : ZMod N => (z.val : ℤ)) F u v + simp_rw [hmap] + calc + _ = 𝔼 u : (Fin n → ZMod N) × (Fin n → ZMod N), + boxCornerProduct F (fun i => (u.1 i).val) (fun i => (u.2 i).val) := by + apply Fintype.expect_equiv (boxPairEquiv n (ZMod N)) + intro x + rfl + _ = _ := expect_prod_split _ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxCyclicEncoding.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxCyclicEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9b63edf08df5d2322d51ad5c09eaeae3d5c712b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxCyclicEncoding.lean @@ -0,0 +1,105 @@ +import OAI.Combinatorics.Progressions.Lattices.IntegerRadixCoding +import OAI.Combinatorics.Progressions.Lattices.PhysicalSubboxResidueSlice + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def boxCodeModulus {n : ℕ} (T : Fin n → ℕ) : ℕ := ∏ i, 4 * T i + +def boxIntegerCode {n : ℕ} (T : Fin n → ℕ) : (Fin n → ℤ) →+ ℤ := + integerRadixHom (fun i => 4 * T i) + +def boxCyclicCode {n : ℕ} (T : Fin n → ℕ) : (Fin n → ℤ) →+ ZMod (boxCodeModulus T) := + (Int.castAddHom (ZMod (boxCodeModulus T))).comp (boxIntegerCode T) + +theorem boxCodeModulus_pos {n : ℕ} (T : Fin n → ℕ) [∀ i, NeZero (T i)] : + 0 < boxCodeModulus T := + Finset.prod_pos (fun i _ => Nat.mul_pos (by norm_num) (NeZero.pos (T i))) + +instance boxCodeModulus_neZero {n : ℕ} (T : Fin n → ℕ) [∀ i, NeZero (T i)] : + NeZero (boxCodeModulus T) := ⟨(boxCodeModulus_pos T).ne'⟩ + +theorem boxCodeModulus_eq {n : ℕ} (T : Fin n → ℕ) : + boxCodeModulus T = 4 ^ n * ∏ i, T i := by + simp [boxCodeModulus, Finset.prod_mul_distrib] + +theorem boxIntegerCode_bounds {n : ℕ} (T : Fin n → ℕ) (x : Fin n → ℤ) + (hx : x ∈ integerBox T) : + 0 ≤ boxIntegerCode T x ∧ boxIntegerCode T x < (boxCodeModulus T : ℤ) := by + apply integerRadixValue_bounds + intro i + have h := (mem_integerBox T x).mp hx i + constructor + · exact h.1 + · push_cast + omega + +theorem boxCyclicCode_reflectsPairSums {n : ℕ} (T : Fin n → ℕ) : + ReflectsPairSums (boxCyclicCode T) (integerBox T : Set (Fin n → ℤ)) := by + intro a ha b hb c hc d hd he + have hab : ∀ i, 0 ≤ (a + b) i ∧ (a + b) i < ((4 * T i : ℕ) : ℤ) := by + intro i + have h1 := (mem_integerBox T a).mp ha i + have h2 := (mem_integerBox T b).mp hb i + simp only [Pi.add_apply, Nat.cast_mul, Nat.cast_ofNat] + constructor <;> omega + have hcd : ∀ i, 0 ≤ (c + d) i ∧ (c + d) i < ((4 * T i : ℕ) : ℤ) := by + intro i + have h1 := (mem_integerBox T c).mp hc i + have h2 := (mem_integerBox T d).mp hd i + simp only [Pi.add_apply, Nat.cast_mul, Nat.cast_ofNat] + constructor <;> omega + have he' : ((boxIntegerCode T (a + b) : ℤ) : ZMod (boxCodeModulus T)) = + ((boxIntegerCode T (c + d) : ℤ) : ZMod (boxCodeModulus T)) := by + change ((boxIntegerCode T a : ℤ) : ZMod (boxCodeModulus T)) + + ((boxIntegerCode T b : ℤ) : ZMod (boxCodeModulus T)) = + ((boxIntegerCode T c : ℤ) : ZMod (boxCodeModulus T)) + + ((boxIntegerCode T d : ℤ) : ZMod (boxCodeModulus T)) at he + simpa only [map_add, Int.cast_add] using he + have hh := int_eq_of_zmod_eq_of_bounds + (integerRadixValue_bounds (fun i => 4 * T i) (a + b) hab) + (integerRadixValue_bounds (fun i => 4 * T i) (c + d) hcd) he' + exact integerRadixValue_injective_on_digits (fun i => 4 * T i) (a + b) (c + d) hab hcd hh + +theorem boxCyclicCode_injOn {n : ℕ} (T : Fin n → ℕ) : + Set.InjOn (boxCyclicCode T) (integerBox T : Set (Fin n → ℤ)) := + (boxCyclicCode_reflectsPairSums T).injOn + +theorem boxCyclicCode_representative {n : ℕ} (T : Fin n → ℕ) [∀ i, NeZero (T i)] + (x : Fin n → ℤ) (hx : x ∈ integerBox T) : + ((boxCyclicCode T x).val : ℤ) = boxIntegerCode T x := by + change (((boxIntegerCode T x : ℤ) : ZMod (boxCodeModulus T)).val : ℤ) = _ + rw [ZMod.val_intCast] + exact Int.emod_eq_of_lt (boxIntegerCode_bounds T x hx).1 (boxIntegerCode_bounds T x hx).2 + +theorem boxCode_density {n : ℕ} (T : Fin n → ℕ) [∀ i, NeZero (T i)] : + ((integerBox T).card : ℝ) / (boxCodeModulus T : ℝ) = ((4 : ℝ) ^ n)⁻¹ := by + have hprod : ((∏ i, T i : ℕ) : ℝ) ≠ 0 := + Nat.cast_ne_zero.mpr (Finset.prod_ne_zero_iff.mpr (fun i _ => NeZero.ne (T i))) + rw [card_integerBox, boxCodeModulus_eq, Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat] + field_simp [hprod] + +theorem boxCode_density_lower {n : ℕ} (T : Fin n → ℕ) [∀ i, NeZero (T i)] : + Real.exp (-(4 * (n : ℝ))) ≤ ((integerBox T).card : ℝ) / (boxCodeModulus T : ℝ) := by + have h4 : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + have hpow : (4 : ℝ) ^ n ≤ Real.exp (4 * (n : ℝ)) := by + have h := pow_le_pow_left₀ (by norm_num : (0 : ℝ) ≤ 4) h4 n + rw [← Real.exp_nat_mul] at h + simpa only [mul_comm] using h + rw [boxCode_density, ← one_div] + apply (le_div_iff₀ (by positivity : (0 : ℝ) < 4 ^ n)).mpr + calc + _ ≤ Real.exp (-(4 * (n : ℝ))) * Real.exp (4 * (n : ℝ)) := + mul_le_mul_of_nonneg_left hpow (Real.exp_nonneg _) + _ = 1 := by rw [← Real.exp_add, neg_add_cancel, Real.exp_zero] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxDetectionExponents.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxDetectionExponents.lean new file mode 100644 index 0000000000000000000000000000000000000000..81600b46d8996209f056d8dcab6749bb00bdd5fc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxDetectionExponents.lean @@ -0,0 +1,160 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialDensityBudget + +namespace OAI + +section + +namespace Erdos3 + +def boxModeBudget (a : ℕ) (p : ℝ) : ℝ := p + (p + 1 + a) ^ a + 2 + +def boxInductionInputBudget (a b : ℕ) (p : ℝ) : ℝ := + (p + 1 + b) ^ b + 2 * boxModeBudget a p + 2 * p + 3 + +def boxRetainedBudget (a : ℕ) (p : ℝ) : ℝ := 2 * boxModeBudget a p + 2 * p + 6 + +def boxDetectionStepBudget (s a b c : ℕ) (p : ℝ) : ℝ := + ((s + 2) ^ (s + 2) : ℕ) * p + (s + 1 : ℕ) * (boxRetainedBudget a p + p) + + (2 ^ (s + 1) : ℕ) * (boxInductionInputBudget a b p + c) ^ c + boxRetainedBudget a p + +theorem boxModeBudget_nonneg (a : ℕ) {p : ℝ} (hp : 0 ≤ p) : 0 ≤ boxModeBudget a p := by + unfold boxModeBudget + positivity + +theorem le_boxModeBudget (a : ℕ) {p : ℝ} (hp : 0 ≤ p) : p + 1 ≤ boxModeBudget a p := by + have h : 0 ≤ (p + 1 + a) ^ a := by positivity + unfold boxModeBudget + linarith + +theorem boxInductionInputBudget_bounds (a b : ℕ) {p : ℝ} (hp : 0 ≤ p) : + (p + 1 + b) ^ b ≤ boxInductionInputBudget a b p ∧ + 2 * boxModeBudget a p + 1 ≤ boxInductionInputBudget a b p ∧ + p ≤ boxInductionInputBudget a b p := by + have hmode := boxModeBudget_nonneg a hp + have hpow : 0 ≤ (p + 1 + b) ^ b := by positivity + unfold boxInductionInputBudget + constructor + · linarith + constructor <;> linarith + +theorem boxDetectionStepBudget_nonneg (s a b c : ℕ) {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ boxDetectionStepBudget s a b c p := by + unfold boxDetectionStepBudget boxRetainedBudget boxInductionInputBudget boxModeBudget + positivity + +theorem exists_boxDetectionStepBudget_bound (s a b c : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → boxDetectionStepBudget s a b c p ≤ (p + C) ^ C := by + let X : Polynomial ℕ := Polynomial.X + let R := X + (X + 1 + Polynomial.C a) ^ a + 2 + let K := (X + 1 + Polynomial.C b) ^ b + 2 * R + 2 * X + 3 + let V := 2 * R + 2 * X + 6 + let P := Polynomial.C ((s + 2) ^ (s + 2)) * X + Polynomial.C (s + 1) * (V + X) + + Polynomial.C (2 ^ (s + 1)) * (K + Polynomial.C c) ^ c + V + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget P + refine ⟨C, hC, fun p hp => ?_⟩ + simpa [P, V, K, R, X, Polynomial.eval₂_pow, boxDetectionStepBudget, + boxRetainedBudget, boxInductionInputBudget, boxModeBudget] using hbound p hp + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem exp_sub_one_le_half_exp (x : ℝ) : Real.exp (x - 1) ≤ Real.exp x / 2 := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + calc + _ ≤ Real.exp (x - 1) * Real.exp 1 := mul_le_mul_of_nonneg_left htwo (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem two_pow_le_exp_of_le (d : ℕ) {p : ℝ} (hd : (d : ℝ) ≤ p) : + (2 : ℝ) ^ d ≤ Real.exp p := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + _ ≤ (Real.exp 1) ^ d := pow_le_pow_left₀ (by norm_num) htwo d + _ = Real.exp d := by rw [← Real.exp_nat_mul, mul_one] + _ ≤ _ := Real.exp_le_exp.mpr hd + +theorem exp_neg_nat_mul_le_inverse_pow (N d : ℕ) (hN : 0 < N) {p : ℝ} (hd : (d : ℝ) ≤ p) : + Real.exp (-(N : ℝ) * p) ≤ ((1 : ℝ) / N) ^ d := by + have hbase : (N : ℝ) ≤ Real.exp N := by linarith [Real.add_one_le_exp (N : ℝ)] + have hpow : (N : ℝ) ^ d ≤ Real.exp ((N : ℝ) * p) := by + calc + _ ≤ (Real.exp N) ^ d := pow_le_pow_left₀ (Nat.cast_nonneg N) hbase d + _ = Real.exp ((d : ℝ) * N) := (Real.exp_nat_mul _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [show (0 : ℝ) ≤ N from Nat.cast_nonneg N]) + have hn : (0 : ℝ) < N := by exact_mod_cast hN + have hi := one_div_le_one_div_of_le (pow_pos hn d) hpow + simpa only [div_pow, one_pow, neg_mul, Real.exp_neg, one_div, inv_pow] using hi + +theorem retained_exponential_weight (d : ℕ) {p r : ℝ} (hd : (d : ℝ) ≤ p) : + let L := 2 * r + 2 * p + 6 + Real.exp (-L) ≤ Real.exp (-r) ^ 2 / (2 * Real.exp (p + 1) ^ 2) - + (2 : ℝ) ^ d * Real.exp (-(L + p)) := by + let L := 2 * r + 2 * p + 6 + have hloss : (2 : ℝ) ^ d * Real.exp (-(L + p)) ≤ Real.exp (-L) := by + calc + _ ≤ Real.exp p * Real.exp (-(L + p)) := + mul_le_mul_of_nonneg_right (two_pow_le_exp_of_le d hd) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have he : Real.exp (-r) ^ 2 / (2 * Real.exp (p + 1) ^ 2) = + Real.exp 4 / 2 * Real.exp (-L) := by + calc + _ = (Real.exp (-r) ^ 2 / Real.exp (p + 1) ^ 2) / 2 := by ring + _ = Real.exp (2 * (-r) - 2 * (p + 1)) / 2 := by + rw [← Real.exp_nat_mul, ← Real.exp_nat_mul, ← Real.exp_sub] + norm_num + _ = (Real.exp 4 * Real.exp (-L)) / 2 := by + rw [← Real.exp_add] + congr 2 + dsimp [L] + ring + _ = _ := by ring + have hfour : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + change Real.exp (-L) ≤ _ + rw [he] + nlinarith [Real.exp_pos (-L)] + +theorem exp_neg_le_of_pow {x P : ℝ} {n : ℕ} (hx : 0 ≤ x) (hP : 0 ≤ P) (hn : n ≠ 0) + (h : Real.exp (-P) ≤ x ^ n) : Real.exp (-P) ≤ x := by + have ht : Real.exp (-P) ≤ 1 := Real.exp_le_one_iff.mpr (by linarith) + have hp : ∀ k : ℕ, Real.exp (-P) ^ (k + 1) ≤ Real.exp (-P) := by + intro k + induction k with + | zero => simp + | succ k ih => + rw [pow_succ] + exact (mul_le_mul ih ht (Real.exp_nonneg _) (Real.exp_nonneg _)).trans_eq (mul_one _) + cases n with + | zero => exact False.elim (hn rfl) + | succ k => exact le_of_pow_le_pow_left₀ (Nat.succ_ne_zero k) hx ((hp k).trans h) + +theorem box_detection_exponential_product (s a b c d : ℕ) {p : ℝ} (hd : (d : ℝ) ≤ p) : + Real.exp (-boxDetectionStepBudget s a b c p) ≤ + ((1 : ℝ) / ((s : ℝ) + 2) ^ (s + 2)) ^ d * + Real.exp (-(boxRetainedBudget a p + p)) ^ (s + 1) * + Real.exp (-((boxInductionInputBudget a b p + c) ^ c)) ^ (2 ^ (s + 1)) * + Real.exp (-boxRetainedBudget a p) := by + have hc : Real.exp (-(((s + 2) ^ (s + 2) : ℕ) : ℝ) * p) ≤ + ((1 : ℝ) / ((s : ℝ) + 2) ^ (s + 2)) ^ d := by + simpa only [Nat.cast_pow, Nat.cast_add, Nat.cast_ofNat] using + exp_neg_nat_mul_le_inverse_pow ((s + 2) ^ (s + 2)) d (by positivity) hd + calc + _ = Real.exp (-(((s + 2) ^ (s + 2) : ℕ) : ℝ) * p) * + Real.exp (-(boxRetainedBudget a p + p)) ^ (s + 1) * + Real.exp (-((boxInductionInputBudget a b p + c) ^ c)) ^ (2 ^ (s + 1)) * + Real.exp (-boxRetainedBudget a p) := by + simp only [← Real.exp_nat_mul, ← Real.exp_add] + congr 1 + unfold boxDetectionStepBudget + ring + _ ≤ _ := by gcongr + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxDifferenceHom.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxDifferenceHom.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1ca13ade0b7495d0fb4611e10c9640644c8ea4a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxDifferenceHom.lean @@ -0,0 +1,529 @@ +import OAI.Combinatorics.Progressions.Estimates.DenseProductApproximation +import OAI.Combinatorics.Progressions.Polynomial.PhasePreservingCauchySchwarz +import OAI.Combinatorics.Progressions.Probability.FiniteMassErrorSelection + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem expect_prod_split {X Y M : Type*} [Fintype X] [Fintype Y] + [AddCommMonoid M] [Module ℚ≥0 M] (F : X × Y → M) : + (𝔼 p, F p) = 𝔼 x, 𝔼 y, F (x,y) := by + simpa using (Finset.expect_product' (Finset.univ : Finset X) + (Finset.univ : Finset Y) (fun x y => F (x,y))) + +theorem expect_empty_tuple {X : Fin 0 → Type*} [∀ i, Fintype (X i)] + {M : Type*} [AddCommMonoid M] [Module ℚ≥0 M] (F : (∀ i, X i) → M) : + (𝔼 x, F x) = F (fun i => Fin.elim0 i) := by + calc + (𝔼 x, F x) = 𝔼 _x : ∀ i, X i, F (fun i => Fin.elim0 i) := by + apply Finset.expect_congr rfl + intro x _ + congr 1 + exact Subsingleton.elim _ _ + _ = _ := Fintype.expect_const _ + +theorem expect_two_dependent_fin_cons {n : ℕ} {X : Fin (n+1) → Type*} + [∀ i, Fintype (X i)] {M : Type*} [AddCommMonoid M] [Module ℚ≥0 M] + (F : (∀ i, X i) → (∀ i, X i) → M) : + (𝔼 x, 𝔼 y, F x y) = + 𝔼 a : X 0, 𝔼 b : X 0, 𝔼 u : ∀ i : Fin n, X i.succ, + 𝔼 v : ∀ i : Fin n, X i.succ, F (Fin.cons a u) (Fin.cons b v) := by + rw [expect_dependent_fin_cons] + apply Finset.expect_congr rfl + intro a _ + simp_rw [expect_dependent_fin_cons] + exact Finset.expect_comm _ _ _ + +theorem expect_pow_two_pow_le {X : Type*} [Fintype X] [Nonempty X] + (n : ℕ) (f : X → ℝ) (hf : ∀ x, 0 ≤ f x) : + (𝔼 x, f x)^(2^n) ≤ 𝔼 x, (f x)^(2^n) := by + induction n with + | zero => simp + | succ n ih => + simp only [pow_succ, pow_mul] + calc + ((𝔼 x, f x)^(2^n))^2 ≤ (𝔼 x, (f x)^(2^n))^2 := + pow_le_pow_left₀ (pow_nonneg (Finset.expect_nonneg (fun x _ => hf x)) _) ih 2 + _ ≤ 𝔼 x, ((f x)^(2^n))^2 := expect_square_le _ + +theorem expect_double_pow_two_pow_le {X Y : Type*} + [Fintype X] [Nonempty X] [Fintype Y] [Nonempty Y] + (n : ℕ) (f : X → Y → ℝ) (hf : ∀ x y, 0 ≤ f x y) : + (𝔼 x, 𝔼 y, f x y)^(2^n) ≤ 𝔼 x, 𝔼 y, (f x y)^(2^n) := by + apply (expect_pow_two_pow_le n (fun x => 𝔼 y, f x y) + (fun x => Finset.expect_nonneg (fun y _ => hf x y))).trans + exact Finset.expect_le_expect (fun x _ => expect_pow_two_pow_le n (f x) (hf x)) + +theorem norm_mean_first_difference {X Y : Type*} + [Fintype X] [Fintype Y] [Nonempty Y] (F : X → Y → ℂ) : + ‖𝔼 x, 𝔼 y, F x y‖^2 ≤ 𝔼 x, 𝔼 x', ‖𝔼 y, F x y * star (F x' y)‖ := by + have h := finite_family_cauchy_schwarz (fun _ : Y => (1 : ℂ)) F + (show ∀ _ : Y, ‖(1 : ℂ)‖ ≤ (1 : ℝ) by intro; norm_num) + simpa only [one_mul, one_pow, Finset.expect_comm (Finset.univ : Finset Y) + (Finset.univ : Finset X)] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def finiteBoxCorrelation {X Y : Type*} [Fintype X] [Fintype Y] + (F : X → Y → ℂ) : ℂ := + 𝔼 x, 𝔼 x', 𝔼 y, 𝔼 y', + F x y * star (F x' y) * star (F x y') * F x' y' + +theorem finiteBoxCorrelation_re_eq_mean_square {X Y : Type*} [Fintype X] [Fintype Y] + (F : X → Y → ℂ) : + (finiteBoxCorrelation F).re = 𝔼 x, 𝔼 x', ‖𝔼 y, F x y * star (F x' y)‖ ^ 2 := by + unfold finiteBoxCorrelation + simp_rw [square_norm_mean_eq_cross_re, ← expect_re] + congr 1 + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro x' _ + apply Finset.expect_congr rfl + intro y _ + apply Finset.expect_congr rfl + intro y' _ + simp only [star_mul, star_star] + ring + +theorem finiteBoxCorrelation_re_nonneg {X Y : Type*} [Fintype X] [Fintype Y] + (F : X → Y → ℂ) : 0 ≤ (finiteBoxCorrelation F).re := by + rw [finiteBoxCorrelation_re_eq_mean_square] + exact Finset.expect_nonneg (fun _ _ => Finset.expect_nonneg (fun _ _ => sq_nonneg _)) + +theorem norm_weighted_expect_sq_le {X : Type*} [Fintype X] [Nonempty X] + (a f : X → ℂ) (ha : ∀ x, ‖a x‖ ≤ 1) : + ‖𝔼 x, a x * f x‖ ^ 2 ≤ 𝔼 x, ‖f x‖ ^ 2 := by + have hcs := norm_expect_mul_star_sq_le a (fun x => star (f x)) + simp only [star_star, norm_star] at hcs + have ha2 : (𝔼 x, ‖a x‖ ^ 2) ≤ 1 := by + exact (Finset.expect_le_expect (fun x _ => + pow_le_pow_left₀ (norm_nonneg _) (ha x) 2)).trans_eq (by simp) + exact hcs.trans ((mul_le_mul_of_nonneg_right ha2 + (Finset.expect_nonneg (fun _ _ => sq_nonneg _))).trans_eq (one_mul _)) + +theorem norm_weighted_pair_mean_pow_four_le_box {X Y : Type*} + [Fintype X] [Fintype Y] [Nonempty X] [Nonempty Y] + (F : X → Y → ℂ) (a : X → ℂ) (b : Y → ℂ) + (ha : ∀ x, ‖a x‖ ≤ 1) (hb : ∀ y, ‖b y‖ ≤ 1) : + ‖𝔼 x, 𝔼 y, F x y * a x * b y‖ ^ 4 ≤ (finiteBoxCorrelation F).re := by + let m : ℂ := 𝔼 x, 𝔼 x', a x * star (a x') * (𝔼 y, F x y * star (F x' y)) + have hleft : (𝔼 y, b y * (𝔼 x, F x y * a x)) = 𝔼 x, 𝔼 y, F x y * a x * b y := by + simp_rw [Finset.mul_expect] + rw [Finset.expect_comm] + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro y _ + ring + have hright : (𝔼 x, 𝔼 x', 𝔼 y, (F x y * a x) * star (F x' y * a x')) = m := by + dsimp [m] + simp_rw [Finset.mul_expect] + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro x' _ + apply Finset.expect_congr rfl + intro y _ + rw [map_mul] + ring + have hfirst : ‖𝔼 x, 𝔼 y, F x y * a x * b y‖ ^ 2 ≤ m.re := by + simpa only [hleft, hright, one_pow, one_mul] using + finite_family_cauchy_schwarz_re b (fun x y => F x y * a x) hb + have hsecond : ‖m‖ ^ 2 ≤ 𝔼 x, 𝔼 x', ‖𝔼 y, F x y * star (F x' y)‖ ^ 2 := by + have hh := norm_weighted_expect_sq_le + (fun u : X × X => a u.1 * star (a u.2)) + (fun u : X × X => 𝔼 y, F u.1 y * star (F u.2 y)) (fun u => by + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (ha _)).trans (ha _)) + simpa only [← Finset.univ_product_univ, Finset.expect_product, m] using hh + have hm : 0 ≤ m.re := (sq_nonneg _).trans hfirst + calc + _ = (‖𝔼 x, 𝔼 y, F x y * a x * b y‖ ^ 2) ^ 2 := by ring + _ ≤ m.re ^ 2 := pow_le_pow_left₀ (sq_nonneg _) hfirst 2 + _ ≤ ‖m‖ ^ 2 := pow_le_pow_left₀ hm (Complex.re_le_norm m) 2 + _ ≤ _ := hsecond.trans_eq (finiteBoxCorrelation_re_eq_mean_square F).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def iteratedBoxDifference {Z : Type*} : + (n : ℕ) → {X : Fin n → Type*} → ((∀ i, X i) → Z → ℂ) → + (∀ i, X i) → (∀ i, X i) → Z → ℂ + | 0, _, F, _, _, z => F (fun i => Fin.elim0 i) z + | n+1, _, F, u, v, z => iteratedBoxDifference n + (fun x z => F (Fin.cons (u 0) x) z * star (F (Fin.cons (v 0) x) z)) + (Fin.tail u) (Fin.tail v) z + +theorem iterated_box_cauchy_schwarz (n : ℕ) {X : Fin n → Type*} + [∀ i, Fintype (X i)] [∀ i, Nonempty (X i)] + {Z : Type*} [Fintype Z] [Nonempty Z] (F : (∀ i, X i) → Z → ℂ) : + ‖𝔼 x, 𝔼 z, F x z‖^(2^n) ≤ + 𝔼 u, 𝔼 v, ‖𝔼 z, iteratedBoxDifference n F u v z‖ := by + induction n with + | zero => simp only [pow_zero, pow_one, expect_empty_tuple, iteratedBoxDifference, le_refl] + | succ n ih => + let G := fun a b (x : ∀ i : Fin n, X i.succ) z => + F (Fin.cons a x) z * star (F (Fin.cons b x) z) + have hcs : ‖𝔼 x, 𝔼 z, F x z‖^2 ≤ + 𝔼 a : X 0, 𝔼 b : X 0, ‖𝔼 x : ∀ i : Fin n, X i.succ, 𝔼 z, G a b x z‖ := by + rw [expect_dependent_fin_cons] + have h := norm_mean_first_difference + (fun (a : X 0) (p : (∀ i : Fin n, X i.succ) × Z) => F (Fin.cons a p.1) p.2) + simpa only [expect_prod_split] using h + calc + _ = (‖𝔼 x, 𝔼 z, F x z‖^2)^(2^n) := by rw [← pow_mul, pow_succ]; congr 1; omega + _ ≤ (𝔼 a : X 0, 𝔼 b : X 0, + ‖𝔼 x : ∀ i : Fin n, X i.succ, 𝔼 z, G a b x z‖)^(2^n) := + pow_le_pow_left₀ (sq_nonneg _) hcs _ + _ ≤ 𝔼 a : X 0, 𝔼 b : X 0, + ‖𝔼 x : ∀ i : Fin n, X i.succ, 𝔼 z, G a b x z‖^(2^n) := + expect_double_pow_two_pow_le n _ (fun _ _ => norm_nonneg _) + _ ≤ 𝔼 a : X 0, 𝔼 b : X 0, 𝔼 u : ∀ i : Fin n, X i.succ, + 𝔼 v : ∀ i : Fin n, X i.succ, ‖𝔼 z, iteratedBoxDifference n (G a b) u v z‖ := by + apply Finset.expect_le_expect + intro a _ + apply Finset.expect_le_expect + intro b _ + exact ih (G a b) + _ = _ := by + rw [expect_two_dependent_fin_cons] + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def boxSlice {X : Type*} (a z : Fin 2 → X) : Fin 4 → X := ![z 0, a 0, z 1, a 1] + +def boxSliceEquiv (X : Type*) : ((Fin 2 → X) × (Fin 2 → X)) ≃ (Fin 4 → X) where + toFun p := boxSlice p.1 p.2 + invFun x := (![x 1, x 3], ![x 0, x 2]) + left_inv p := by + apply Prod.ext <;> funext i <;> fin_cases i <;> rfl + right_inv x := by + funext i + fin_cases i <;> rfl + +theorem expect_boxSlice {X M : Type*} [Fintype X] [AddCommMonoid M] [Module ℚ≥0 M] + (F : (Fin 4 → X) → M) : + (𝔼 x, F x) = 𝔼 a : Fin 2 → X, 𝔼 z : Fin 2 → X, F (boxSlice a z) := by + calc + _ = 𝔼 p : (Fin 2 → X) × (Fin 2 → X), F (boxSlice p.1 p.2) := + (Fintype.expect_equiv (boxSliceEquiv X) _ F (fun _ => rfl)).symm + _ = _ := by + simpa using (Finset.expect_product' Finset.univ Finset.univ + (fun a z => F (boxSlice a z))) + +noncomputable def boxKernel {X : Type*} (K : X → X → ℂ) (x : Fin 4 → X) : ℂ := + K (x 0) (x 2) * star (K (x 1) (x 2)) * star (K (x 0) (x 3)) * K (x 1) (x 3) + +noncomputable def boxAnchorFactor {X : Type*} (K : X → X → ℂ) + (a z : Fin 2 → X) : ℂ := + star (K (a 0) (z 1)) * star (K (z 0) (a 1)) * K (a 0) (a 1) + +theorem boxKernel_slice {X : Type*} (K : X → X → ℂ) (a z : Fin 2 → X) : + boxKernel K (boxSlice a z) = K (z 0) (z 1) * boxAnchorFactor K a z := by + simp [boxKernel, boxSlice, boxAnchorFactor, mul_assoc] + +theorem boxKernel_mean {X : Type*} [Fintype X] (K : X → X → ℂ) : + (𝔼 x : Fin 4 → X, boxKernel K x) = finiteBoxCorrelation K := by + simp_rw [expect_fin_cons] + unfold finiteBoxCorrelation + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro a _ + apply Finset.expect_congr rfl + intro y _ + apply Finset.expect_congr rfl + intro b _ + change (𝔼 _ : Fin 0 → X, K x y * star (K a y) * star (K x b) * K a b) = _ + rw [Fintype.expect_const] + +theorem boxAnchorFactor_norm_le_one {X : Type*} (K : X → X → ℂ) + (hK : ∀ x y, ‖K x y‖ ≤ 1) (a z : Fin 2 → X) : ‖boxAnchorFactor K a z‖ ≤ 1 := by + simp only [boxAnchorFactor, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) + ((mul_le_of_le_one_left (norm_nonneg _) (hK _ _)).trans (hK _ _))).trans (hK _ _) + +theorem boxAnchorFactor_mean_square {X : Type*} [Fintype X] [Nonempty X] + (K : X → X → ℂ) (hK : ∀ x y, ‖K x y‖ ≤ 1) {δ : ℝ} (hδ : 0 ≤ δ) + (hbias : δ ≤ (finiteBoxCorrelation K).re) : + δ ^ 2 ≤ 𝔼 a : Fin 2 → X, 𝔼 z : Fin 2 → X, ‖boxAnchorFactor K a z‖ ^ 2 := by + calc + _ ≤ ‖finiteBoxCorrelation K‖ ^ 2 := + pow_le_pow_left₀ hδ (hbias.trans (Complex.re_le_norm _)) 2 + _ ≤ 𝔼 x : Fin 4 → X, ‖boxKernel K x‖ ^ 2 := by + rw [← boxKernel_mean] + exact norm_expect_sq_le_expect_norm_sq _ + _ = 𝔼 a : Fin 2 → X, 𝔼 z : Fin 2 → X, ‖boxKernel K (boxSlice a z)‖ ^ 2 := + expect_boxSlice _ + _ ≤ _ := by + apply Finset.expect_le_expect + intro a _ + apply Finset.expect_le_expect + intro z _ + apply pow_le_pow_left₀ (norm_nonneg _) + rw [boxKernel_slice, norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (hK _ _) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def finiteTripleBoxCorrelation {X Y Z : Type*} + [Fintype X] [Fintype Y] [Fintype Z] (F : X → Y → Z → ℂ) : ℂ := + 𝔼 x, 𝔼 x', finiteBoxCorrelation (fun y z => F x y z * star (F x' y z)) + +theorem finiteTripleBoxCorrelation_re_nonneg {X Y Z : Type*} + [Fintype X] [Fintype Y] [Fintype Z] (F : X → Y → Z → ℂ) : + 0 ≤ (finiteTripleBoxCorrelation F).re := by + simp only [finiteTripleBoxCorrelation, expect_re] + exact Finset.expect_nonneg (fun _ _ => Finset.expect_nonneg (fun _ _ => + finiteBoxCorrelation_re_nonneg _)) + +theorem norm_pairwise_weighted_mean_pow_eight_le_box {X Y Z : Type*} + [Fintype X] [Fintype Y] [Fintype Z] [Nonempty X] [Nonempty Y] [Nonempty Z] + (F : X → Y → Z → ℂ) (A : X → Y → ℂ) (B : Y → Z → ℂ) (D : X → Z → ℂ) + (hA : ∀ x y, ‖A x y‖ ≤ 1) (hB : ∀ y z, ‖B y z‖ ≤ 1) + (hD : ∀ x z, ‖D x z‖ ≤ 1) : + ‖𝔼 x, 𝔼 y, 𝔼 z, F x y z * A x y * B y z * D x z‖ ^ 8 ≤ + (finiteTripleBoxCorrelation F).re := by + let v (x : X) (u : Y × Z) := F x u.1 u.2 * A x u.1 * D x u.2 + let G (x x' : X) (y : Y) (z : Z) := F x y z * star (F x' y z) + let A₂ (x x' : X) (y : Y) := A x y * star (A x' y) + let D₂ (x x' : X) (z : Z) := D x z * star (D x' z) + let M (x x' : X) := 𝔼 y, 𝔼 z, G x x' y z * A₂ x x' y * D₂ x x' z + let m : ℂ := 𝔼 x, 𝔼 x', M x x' + have hleft : (𝔼 u : Y × Z, B u.1 u.2 * (𝔼 x, v x u)) = + 𝔼 x, 𝔼 y, 𝔼 z, F x y z * A x y * B y z * D x z := by + simp_rw [Finset.mul_expect] + rw [Finset.expect_comm] + simp_rw [expect_prod_split] + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro y _ + apply Finset.expect_congr rfl + intro z _ + dsimp only [v] + ring + have hright : (𝔼 x, 𝔼 x', 𝔼 u : Y × Z, v x u * star (v x' u)) = m := by + dsimp only [m, M] + simp_rw [expect_prod_split] + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro x' _ + apply Finset.expect_congr rfl + intro y _ + apply Finset.expect_congr rfl + intro z _ + simp only [v, G, A₂, D₂, star_mul] + ring + have hfirst : ‖𝔼 x, 𝔼 y, 𝔼 z, F x y z * A x y * B y z * D x z‖ ^ 2 ≤ m.re := by + simpa only [hleft, hright, one_pow, one_mul] using + finite_family_cauchy_schwarz_re (fun u : Y × Z => B u.1 u.2) v (fun u => hB u.1 u.2) + have hnorm : ‖m‖ ≤ 𝔼 x, 𝔼 x', ‖M x x'‖ := by + apply (RCLike.norm_expect_le (K := ℂ)).trans + exact Finset.expect_le_expect (fun x _ => RCLike.norm_expect_le (K := ℂ)) + have hpower : ‖m‖ ^ 4 ≤ 𝔼 x, 𝔼 x', ‖M x x'‖ ^ 4 := by + exact (pow_le_pow_left₀ (norm_nonneg _) hnorm 4).trans + (expect_double_pow_two_pow_le 2 (fun x x' => ‖M x x'‖) (fun _ _ => norm_nonneg _)) + have hpair (x x' : X) : ‖M x x'‖ ^ 4 ≤ (finiteBoxCorrelation (G x x')).re := by + exact norm_weighted_pair_mean_pow_four_le_box (G x x') (A₂ x x') (D₂ x x') + (fun y => by + simp only [A₂, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hA x y)).trans (hA x' y)) + (fun z => by + simp only [D₂, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hD x z)).trans (hD x' z)) + calc + _ = (‖𝔼 x, 𝔼 y, 𝔼 z, F x y z * A x y * B y z * D x z‖ ^ 2) ^ 4 := by ring + _ ≤ ‖m‖ ^ 4 := pow_le_pow_left₀ (sq_nonneg _) (hfirst.trans (Complex.re_le_norm m)) 4 + _ ≤ 𝔼 x, 𝔼 x', ‖M x x'‖ ^ 4 := hpower + _ ≤ _ := by + simp only [finiteTripleBoxCorrelation, expect_re] + exact Finset.expect_le_expect (fun x _ => Finset.expect_le_expect (fun x' _ => hpair x x')) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def additiveBoxDifference {Z R : Type*} [AddGroup R] : + (n : ℕ) → {X : Fin n → Type*} → ((∀ i, X i) → Z → R) → + (∀ i, X i) → (∀ i, X i) → Z → R + | 0, _, F, _, _, z => F (fun i => Fin.elim0 i) z + | n+1, _, F, u, v, z => additiveBoxDifference n + (fun x z => F (Fin.cons (u 0) x) z - F (Fin.cons (v 0) x) z) + (Fin.tail u) (Fin.tail v) z + +theorem additiveBoxDifference_sum {Z R J : Type*} [AddCommGroup R] + (n : ℕ) {X : Fin n → Type*} (S : Finset J) + (F : J → (∀ i, X i) → Z → R) (u v : ∀ i, X i) (z : Z) : + additiveBoxDifference n (fun x z => ∑ j ∈ S, F j x z) u v z = + ∑ j ∈ S, additiveBoxDifference n (F j) u v z := by + induction n with + | zero => rfl + | succ n ih => + simp only [additiveBoxDifference, ← Finset.sum_sub_distrib] + exact ih (fun j x z => F j (Fin.cons (u 0) x) z - F j (Fin.cons (v 0) x) z) + (Fin.tail u) (Fin.tail v) + +theorem additiveBoxDifference_product {Z R : Type*} [CommRing R] + (n : ℕ) {X : Fin n → Type*} (a : Z → R) (f : ∀ i, X i → R) + (u v : ∀ i, X i) (z : Z) : + additiveBoxDifference n (fun x z => a z * ∏ i, f i (x i)) u v z = + a z * ∏ i, (f i (u i)-f i (v i)) := by + induction n generalizing a with + | zero => rfl + | succ n ih => + simp only [additiveBoxDifference] + have he : (fun x z => + a z * ∏ i, f i (Fin.cons (u 0) x i) - a z * ∏ i, f i (Fin.cons (v 0) x i)) = + (fun (x : ∀ i : Fin n, X i.succ) z => + (a z*(f 0 (u 0)-f 0 (v 0))) * ∏ i, f i.succ (x i)) := by + funext x z + simp only [Fin.prod_univ_succ, Fin.cons_zero, Fin.cons_succ] + ring + rw [he, ih] + simp only [Fin.prod_univ_succ, Fin.tail_def] + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_box_anchor_approximation {X : Type*} [Fintype X] [Nonempty X] + (K : X → X → ℂ) (hK : ∀ x y, ‖K x y‖ ≤ 1) (F : (Fin 4 → X) → ℂ) + {δ ε : ℝ} (hδ : 0 < δ) (hε : 0 < ε) + (hbias : δ ≤ (finiteBoxCorrelation K).re) + (herr : (𝔼 x : Fin 4 → X, ‖boxKernel K x - F x‖) ≤ ε) : + ∃ a : Fin 2 → X, + δ ^ 2 / 2 ≤ (𝔼 z : Fin 2 → X, ‖boxAnchorFactor K a z‖ ^ 2) ∧ + δ ^ 2 / 2 ≤ (𝔼 z : Fin 2 → X, ‖K (z 0) (z 1) * boxAnchorFactor K a z‖ ^ 2) ∧ + (𝔼 z : Fin 2 → X, + ‖K (z 0) (z 1) * boxAnchorFactor K a z - F (boxSlice a z)‖) ≤ 2 * ε / δ ^ 2 := by + let A := fun a : Fin 2 → X => + 𝔼 z : Fin 2 → X, ‖K (z 0) (z 1) * boxAnchorFactor K a z‖ ^ 2 + let B := fun a : Fin 2 → X => 𝔼 z : Fin 2 → X, ‖boxKernel K (boxSlice a z) - F (boxSlice a z)‖ + have hA : ∀ a, A a ≤ 1 := by + intro a + have hnorm (z : Fin 2 → X) : ‖K (z 0) (z 1) * boxAnchorFactor K a z‖ ≤ 1 := by + rw [norm_mul] + exact (mul_le_of_le_one_left (norm_nonneg _) (hK _ _)).trans + (boxAnchorFactor_norm_le_one K hK a z) + exact (Finset.expect_le_expect (fun z _ => + pow_le_pow_left₀ (norm_nonneg _) (hnorm z) 2)).trans_eq (by simp) + have hB : ∀ a, 0 ≤ B a := fun a => Finset.expect_nonneg (fun z _ => norm_nonneg _) + have hmass : δ ^ 2 ≤ 𝔼 a, A a := by + calc + _ ≤ ‖finiteBoxCorrelation K‖ ^ 2 := + pow_le_pow_left₀ hδ.le (hbias.trans (Complex.re_le_norm _)) 2 + _ ≤ 𝔼 x : Fin 4 → X, ‖boxKernel K x‖ ^ 2 := by + rw [← boxKernel_mean] + exact norm_expect_sq_le_expect_norm_sq _ + _ = _ := by simpa only [A, boxKernel_slice] using expect_boxSlice (fun x => ‖boxKernel K x‖ ^ 2) + have herror : (𝔼 a, B a) ≤ ε := by + rw [expect_boxSlice] at herr + exact herr + obtain ⟨a, ha, he⟩ := exists_mass_error_point A B (sq_pos_of_pos hδ) hε hA hB hmass herror + refine ⟨a, ha.trans ?_, ha, by simpa only [B, boxKernel_slice] using he⟩ + apply Finset.expect_le_expect + intro z _ + apply pow_le_pow_left₀ (norm_nonneg _) + rw [norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (hK _ _) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_box_anchor_correlation {X : Type*} [Fintype X] [Nonempty X] + (K : X → X → ℂ) : + ∃ a : Fin 2 → X, (finiteBoxCorrelation K).re ≤ + ‖𝔼 z : Fin 2 → X, K (z 0) (z 1) * boxAnchorFactor K a z‖ := by + have hmean : (finiteBoxCorrelation K).re = + 𝔼 a : Fin 2 → X, (𝔼 z : Fin 2 → X, + K (z 0) (z 1) * boxAnchorFactor K a z).re := by + rw [← boxKernel_mean, expect_boxSlice, expect_re] + simp_rw [boxKernel_slice] + obtain ⟨a, _, ha⟩ := Finset.exists_le_of_le_expect Finset.univ_nonempty hmean.le + exact ⟨a, ha.trans (Complex.re_le_norm _)⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem additiveBoxDifference_hom {Z R S : Type*} [AddGroup R] [AddGroup S] + (L : R →+ S) (n : ℕ) {X : Fin n → Type*} + (F : (∀ i, X i) → Z → R) (u v : ∀ i, X i) (z : Z) : + additiveBoxDifference n (fun x t => L (F x t)) u v z = + L (additiveBoxDifference n F u v z) := by + induction n with + | zero => rfl + | succ n ih => + simp only [additiveBoxDifference, ← map_sub] + exact ih (fun x t => F (Fin.cons (u 0) x) t - F (Fin.cons (v 0) x) t) + (Fin.tail u) (Fin.tail v) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxDifferenceSubstitution.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxDifferenceSubstitution.lean new file mode 100644 index 0000000000000000000000000000000000000000..799612fa73773ad996de56500d3b3969dfb1efab --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxDifferenceSubstitution.lean @@ -0,0 +1,38 @@ +import OAI.Combinatorics.Progressions.Geometry.BoxDifferenceHom + +namespace OAI + +section + +namespace Erdos3 + +theorem additiveBoxDifference_map {X Y Z R : Type*} [AddGroup R] (n : ℕ) : + ∀ (f : Fin n → X → Y) (F : (Fin n → Y) → Z → R) + (u v : Fin n → X) (z : Z), + additiveBoxDifference n (fun x t => F (fun i => f i (x i)) t) u v z = + additiveBoxDifference n F (fun i => f i (u i)) (fun i => f i (v i)) z := by + induction n with + | zero => + intro f F u v z + simp only [additiveBoxDifference] + congr 1 + funext i + exact Fin.elim0 i + | succ n ih => + intro f F u v z + have hcons (a : X) (x : Fin n → X) : + (fun i => f i ((Fin.cons a x : Fin (n + 1) → X) i)) = + (Fin.cons (f 0 a) (fun i : Fin n => f i.succ (x i)) : Fin (n + 1) → Y) := by + funext i + cases i using Fin.cases <;> rfl + simp only [additiveBoxDifference] + simp_rw [hcons] + exact ih (fun i => f i.succ) + (fun y t => F (Fin.cons (f 0 (u 0)) y) t - F (Fin.cons (f 0 (v 0)) y) t) + (Fin.tail u) (Fin.tail v) z + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxImageComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxImageComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..abb2863f33496f719d342a35a83f836bce6dd98d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxImageComparison.lean @@ -0,0 +1,52 @@ +import OAI.Combinatorics.Progressions.Estimates.SmoothedImageTest + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +variable {Ω ι : Type*} [MeasurableSpace Ω] [Fintype ι] + +def ImageTranslationBound (μ : Measure Ω) (U : Ω → (ι → ℝ)) (H : ℝ≥0) : Prop := + ∀ (φ : (ι → ℝ) → ℝ), Measurable φ → (∀ x, ‖φ x‖ ≤ 1) → ∀ z, + |mappedTest μ U (fun x => φ (x + z)) - mappedTest μ U φ| ≤ H * dist z 0 + +theorem box_image_comparison [DecidableEq ι] (μ : Measure Ω) [IsFiniteMeasure μ] + (hmass : μ.real Set.univ ≤ 1) (U V : Ω → (ι → ℝ)) (hU : Measurable U) (hV : Measurable V) + (H_U H_V : ℝ≥0) (hTU : ImageTranslationBound μ U H_U) (hTV : ImageTranslationBound μ V H_V) + {ε : ℝ} (hε : 0 ≤ ε) (hclose : ∀ᵐ a ∂μ, dist (U a) (V a) ≤ ε) + (δ : ℝ) (hδ : 0 < δ) (φ : (ι → ℝ) → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + |mappedTest μ U φ - mappedTest μ V φ| ≤ + ((H_U : ℝ) + H_V) * δ + 2 * (Fintype.card ι : ℝ) * ε / δ := by + have hu := mappedTest_box_error μ U hU δ hδ H_U φ hφ hbound (hTU φ hφ hbound) + have hv := mappedTest_box_error μ V hV δ hδ H_V φ hφ hbound (hTV φ hφ hbound) + have hLip := boxTestAverage_lipschitz δ hδ φ hφ hbound + have hmid := coupled_mappedTest_difference μ hmass U V hU hV hε hclose + (boxTestAverage δ φ) hLip.continuous.measurable (boxTestAverage_norm_le δ hδ φ hbound) + (boxTestLipschitz (ι := ι) δ hδ) hLip + have hu' : |mappedTest μ U φ - mappedTest μ U (boxTestAverage δ φ)| ≤ (H_U : ℝ) * δ := by + rw [abs_sub_comm] + exact hu + calc + |mappedTest μ U φ - mappedTest μ V φ| ≤ + |mappedTest μ U φ - mappedTest μ U (boxTestAverage δ φ)| + + |mappedTest μ U (boxTestAverage δ φ) - mappedTest μ V φ| := abs_sub_le _ _ _ + _ ≤ |mappedTest μ U φ - mappedTest μ U (boxTestAverage δ φ)| + + (|mappedTest μ U (boxTestAverage δ φ) - mappedTest μ V (boxTestAverage δ φ)| + + |mappedTest μ V (boxTestAverage δ φ) - mappedTest μ V φ|) := + add_le_add le_rfl (abs_sub_le _ _ _) + _ ≤ (H_U : ℝ) * δ + ((boxTestLipschitz (ι := ι) δ hδ : ℝ) * ε + (H_V : ℝ) * δ) := + add_le_add hu' (add_le_add hmid hv) + _ = ((H_U : ℝ) + H_V) * δ + 2 * (Fintype.card ι : ℝ) * ε / δ := by + rw [boxTestLipschitz_coe] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxNormalizationComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxNormalizationComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..7122dff680ea5d75d83168b9af3938fe2483a2e9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxNormalizationComparison.lean @@ -0,0 +1,74 @@ +import OAI.Combinatorics.Progressions.Lattices.PhysicalSubboxResidueSlice + +namespace OAI + +section + +open scoped BigOperators + +namespace Erdos3 + +theorem root_ratio_comparison {S C V K r : ℝ} (hS : 0 ≤ S) (hC : 0 < C) (hV : 0 < V) + (hCV : C ≤ V) (hVC : V ≤ K * C) (hK : 1 ≤ K) (hr : 0 ≤ r) (hr1 : r ≤ 1) : + (S / V) ^ r ≤ (S / C) ^ r ∧ (S / C) ^ r ≤ K * (S / V) ^ r := by + constructor + · exact Real.rpow_le_rpow (div_nonneg hS hV.le) + (div_le_div_of_nonneg_left hS hC hCV) hr + · have hratio : S / C ≤ K * (S / V) := by + rw [← mul_div_assoc] + apply (div_le_div_iff₀ hC hV).mpr + nlinarith [mul_le_mul_of_nonneg_left hVC hS] + calc + _ ≤ (K * (S / V)) ^ r := Real.rpow_le_rpow (div_nonneg hS hC.le) hratio hr + _ = K ^ r * (S / V) ^ r := Real.mul_rpow (by linarith) (div_nonneg hS hV.le) + _ ≤ _ := mul_le_mul_of_nonneg_right (Real.rpow_le_self_of_one_le hK hr1) + (Real.rpow_nonneg (div_nonneg hS hV.le) _) + +variable {A : Type*} [AddCommGroup A] + +noncomputable def volumeGowersNorm (j : ℕ) (Q : Finset A) (f : A → ℂ) : ℝ := + ((supportedCubeSum j (Q : Set A) (fun _ ↦ f)).re / (Q.card : ℝ) ^ (j + 1)) ^ + (((2 ^ j : ℕ) : ℝ)⁻¹) + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] +variable (T : ι → ℕ) [∀ i, NeZero (T i)] + +theorem integerBox_normalization_comparison (a : ι → ℤ) (j : ℕ) (f : (ι → ℤ) → ℂ) : + volumeGowersNorm (j + 1) (translatedIntegerBox a T) f ≤ + finiteSupportGowersNorm (j + 1) (translatedIntegerBox a T) f ∧ + finiteSupportGowersNorm (j + 1) (translatedIntegerBox a T) f ≤ + (((j + 2 : ℕ) : ℝ) ^ (Fintype.card ι * (j + 2))) * + volumeGowersNorm (j + 1) (translatedIntegerBox a T) f := by + let Q := translatedIntegerBox a T + have hQ := translatedIntegerBox_nonempty T a + have hφ := translatedIntegerBox_reflectsPairSums T a + have hN : 0 ≤ finiteSupportGowersNorm (j + 1) Q f := by + rw [finiteSupportGowersNorm_eq_restricted hφ] + exact restrictedGowersNorm_nonneg j _ _ + have hS : 0 ≤ (supportedCubeSum (j + 1) (Q : Set (ι → ℤ)) (fun _ ↦ f)).re := by + rw [← finiteSupportGowersNorm_pow_mul_count hφ hQ j f] + exact mul_nonneg (Nat.cast_nonneg _) (pow_nonneg hN _) + have hC : (0 : ℝ) < Nat.card (SupportedCube (j + 1) (Q : Set (ι → ℤ))) := by + exact_mod_cast card_supportedCube_pos (j + 1) hQ + have hV : (0 : ℝ) < (Q.card : ℝ) ^ (j + 2) := + pow_pos (by exact_mod_cast hQ.card_pos) _ + have hCV : (Nat.card (SupportedCube (j + 1) (Q : Set (ι → ℤ))) : ℝ) ≤ + (Q.card : ℝ) ^ (j + 2) := by exact_mod_cast card_supportedCube_le (j + 1) Q + have hVC : (Q.card : ℝ) ^ (j + 2) ≤ + (((j + 2 : ℕ) : ℝ) ^ (Fintype.card ι * (j + 2))) * + Nat.card (SupportedCube (j + 1) (Q : Set (ι → ℤ))) := by + dsimp [Q, translatedIntegerBox] + rw [card_translateSupport, card_supportedCube_translate] + exact_mod_cast integerBoxCubeCount_lower T (j + 1) + have hK : (1 : ℝ) ≤ (((j + 2 : ℕ) : ℝ) ^ (Fintype.card ι * (j + 2))) := + one_le_pow₀ (by exact_mod_cast (show 1 ≤ j + 2 by omega)) + have hp : (1 : ℝ) ≤ ((2 ^ (j + 1) : ℕ) : ℝ) := by + exact_mod_cast (Nat.one_le_pow _ _ (by omega : 1 ≤ 2)) + exact root_ratio_comparison hS hC hV hCV hVC hK (by positivity) + ((inv_le_one₀ (by positivity)).mpr hp) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxOverlapSize.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxOverlapSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9c24268d6c2ae0e583567661577bc33521e219d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxOverlapSize.lean @@ -0,0 +1,194 @@ +import OAI.Combinatorics.Progressions.Estimates.OverlapCubeWeights + +namespace OAI + +section + +open scoped BigOperators + +namespace Erdos3 + +theorem weight_correlating_large_overlaps {A : Type*} [AddCommGroup A] [DecidableEq A] + {Q : Finset A} (hQ : Q.Nonempty) (f u : A → ℂ) {ρ B δ : ℝ} + (hρ : 0 ≤ ρ) (hB : 0 < B) (hδ : 0 ≤ δ) + (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) (hu : ∀ x ∈ Q, ‖u x‖ ≤ B) + (hcorr : ρ ≤ ‖finiteCorrelation Q f u‖) : + ρ ^ 2 / (2 * B ^ 2) - δ * (cubeDifferenceSupport Q).card / Q.card ≤ + ∑ h ∈ cubeDifferenceSupport Q, (((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) * + (if ρ ^ 2 / 2 ≤ ‖finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h)‖ ∧ + δ * Q.card < ((derivativeSupport Q h).card : ℝ) then (1 : ℝ) else 0) := by + classical + let I := cubeDifferenceSupport Q + let w := fun h => ((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2 + let good := fun h => ρ ^ 2 / 2 ≤ ‖finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h)‖ + let small := fun h => ((derivativeSupport Q h).card : ℝ) ≤ δ * Q.card + have hw (h : A) : 0 ≤ w h := by dsimp [w]; positivity + have hpoint (h : A) : w h * (if good h then (1 : ℝ) else 0) ≤ + w h * (if good h ∧ ¬small h then (1 : ℝ) else 0) + (if small h then w h else 0) := by + by_cases hg : good h <;> by_cases hs : small h <;> simp [hg, hs, hw] + have hsplit := Finset.sum_le_sum (fun h (_ : h ∈ I) => hpoint h) + rw [Finset.sum_add_distrib] at hsplit + have hgood := weight_correlating_overlaps hQ f u hρ hB hf hu hcorr + change ρ ^ 2 / (2 * B ^ 2) ≤ ∑ h ∈ I, w h * (if good h then (1 : ℝ) else 0) at hgood + have hsmall : (∑ h ∈ I, if small h then w h else 0) ≤ δ * I.card / Q.card := by + rw [← Finset.sum_filter] + exact weight_small_overlaps hQ hδ + have hresult : ρ ^ 2 / (2 * B ^ 2) - δ * I.card / Q.card ≤ + ∑ h ∈ I, w h * (if good h ∧ ¬small h then (1 : ℝ) else 0) := by linarith + simpa only [I, w, good, small, not_le] using hresult + +theorem weight_correlating_large_box_overlaps {ι : Type*} [Fintype ι] [DecidableEq ι] + (a : ι → ℤ) (T : ι → ℕ) [∀ i, NeZero (T i)] (f u : (ι → ℤ) → ℂ) + {ρ B δ : ℝ} (hρ : 0 ≤ ρ) (hB : 0 < B) (hδ : 0 ≤ δ) + (hf : ∀ x ∈ translatedIntegerBox a T, ‖f x‖ ≤ 1) + (hu : ∀ x ∈ translatedIntegerBox a T, ‖u x‖ ≤ B) + (hcorr : ρ ≤ ‖finiteCorrelation (translatedIntegerBox a T) f u‖) : + let Q := translatedIntegerBox a T + ρ ^ 2 / (2 * B ^ 2) - 2 ^ Fintype.card ι * δ ≤ + ∑ h ∈ cubeDifferenceSupport Q, (((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) * + (if ρ ^ 2 / 2 ≤ ‖finiteCorrelation (derivativeSupport Q h) + (multiplicativeDerivative f h) (multiplicativeDerivative u h)‖ ∧ + δ * Q.card < ((derivativeSupport Q h).card : ℝ) then (1 : ℝ) else 0) := by + let Q := translatedIntegerBox a T + have hQ : Q.Nonempty := translatedIntegerBox_nonempty T a + have hq : (0 : ℝ) < Q.card := by exact_mod_cast hQ.card_pos + have hd : ((cubeDifferenceSupport Q).card : ℝ) ≤ (2 : ℝ) ^ Fintype.card ι * Q.card := by + exact_mod_cast card_box_differenceSupport_le a T + have hloss : δ * (cubeDifferenceSupport Q).card / Q.card ≤ 2 ^ Fintype.card ι * δ := by + apply (div_le_iff₀ hq).mpr + nlinarith [mul_le_mul_of_nonneg_left hd hδ] + exact le_trans (by linarith) (weight_correlating_large_overlaps hQ f u hρ hB hδ hf hu hcorr) + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +theorem box_gowers_lower_bound_of_overlaps {ι : Type*} [Fintype ι] [DecidableEq ι] + (a : ι → ℤ) (T : ι → ℕ) [∀ i, NeZero (T i)] (j : ℕ) + (f : (ι → ℤ) → ℂ) (P : (ι → ℤ) → Prop) [DecidablePred P] + {δ η μ : ℝ} (hδ : 0 ≤ δ) (hη : 0 ≤ η) + (hμ : μ ≤ ∑ h ∈ cubeDifferenceSupport (translatedIntegerBox a T), + (((derivativeSupport (translatedIntegerBox a T) h).card : ℝ) / + ((translatedIntegerBox a T).card : ℝ) ^ 2) * (if P h then (1 : ℝ) else 0)) + (hretained : ∀ h ∈ cubeDifferenceSupport (translatedIntegerBox a T), P h → + δ * (translatedIntegerBox a T).card ≤ + ((derivativeSupport (translatedIntegerBox a T) h).card : ℝ) ∧ + η ≤ finiteSupportGowersNorm (j + 1) (derivativeSupport (translatedIntegerBox a T) h) + (multiplicativeDerivative f h)) : + ((1 : ℝ) / ((j : ℝ) + 2) ^ (j + 2)) ^ Fintype.card ι * δ ^ (j + 1) * + η ^ (2 ^ (j + 1)) * μ ≤ + finiteSupportGowersNorm (j + 2) (translatedIntegerBox a T) f ^ (2 ^ (j + 2)) := by + let Q := translatedIntegerBox a T + let c := ((1 : ℝ) / ((j : ℝ) + 2) ^ (j + 2)) ^ Fintype.card ι + let K := c * δ ^ (j + 1) * η ^ (2 ^ (j + 1)) + let W := fun h => ((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2 + let V := fun h => (Nat.card (SupportedCube (j + 1) (derivativeSupport Q h : Set (ι → ℤ))) : ℝ) / + Nat.card (SupportedCube (j + 2) (Q : Set (ι → ℤ))) + let N := fun h => finiteSupportGowersNorm (j + 1) (derivativeSupport Q h) (multiplicativeDerivative f h) + have hc : 0 ≤ c := by dsimp [c]; positivity + have hK : 0 ≤ K := by dsimp [K]; positivity + have hN (h : ι → ℤ) : 0 ≤ N h := by + have hφ := (translatedIntegerBox_reflectsPairSums T a).mono + (fun _ hx => (Finset.mem_filter.mp hx).1 : + (derivativeSupport Q h : Set (ι → ℤ)) ⊆ (Q : Set (ι → ℤ))) + dsimp [N] + rw [finiteSupportGowersNorm_eq_restricted hφ] + exact restrictedGowersNorm_nonneg j _ _ + have hpoint (h : ι → ℤ) (hh : h ∈ cubeDifferenceSupport Q) : + K * (W h * (if P h then (1 : ℝ) else 0)) ≤ V h * N h ^ (2 ^ (j + 1)) := by + by_cases hp : P h + · simp only [ite_eq_left hp, mul_one] + have hw : c * δ ^ (j + 1) * W h ≤ V h := + box_overlap_cube_weight a T j hh hδ (hretained h hh hp).1 + have hn : η ^ (2 ^ (j + 1)) ≤ N h ^ (2 ^ (j + 1)) := + pow_le_pow_left₀ hη (hretained h hh hp).2 _ + calc + _ = (c * δ ^ (j + 1) * W h) * η ^ (2 ^ (j + 1)) := by dsimp [K]; ring + _ ≤ _ := mul_le_mul hw hn (pow_nonneg hη _) (by dsimp [V]; positivity) + · simp only [ite_eq_right hp, mul_zero] + exact mul_nonneg (by dsimp [V]; positivity) (pow_nonneg (hN h) _) + calc + _ ≤ K * (∑ h ∈ cubeDifferenceSupport Q, W h * (if P h then (1 : ℝ) else 0)) := + mul_le_mul_of_nonneg_left hμ hK + _ = ∑ h ∈ cubeDifferenceSupport Q, K * (W h * (if P h then (1 : ℝ) else 0)) := + Finset.mul_sum _ _ _ + _ ≤ ∑ h ∈ cubeDifferenceSupport Q, V h * N h ^ (2 ^ (j + 1)) := Finset.sum_le_sum hpoint + _ = _ := (finiteSupportGowersNorm_derivative (translatedIntegerBox_reflectsPairSums T a) + (translatedIntegerBox_nonempty T a) j f).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem side_gt_of_prod_gt {ι : Type*} [Fintype ι] [DecidableEq ι] + (S T : ι → ℝ) (hS : ∀ i, 0 ≤ S i) (hT : ∀ i, 0 < T i) + (hST : ∀ i, S i ≤ T i) {δ : ℝ} + (hprod : δ * ∏ i, T i < ∏ i, S i) (i : ι) : δ * T i < S i := by + have hrest : (∏ j ∈ Finset.univ.erase i, S j) ≤ ∏ j ∈ Finset.univ.erase i, T j := + Finset.prod_le_prod₀ (fun j _ => hS j) (fun j _ => hST j) + have hrestpos : 0 < ∏ j ∈ Finset.univ.erase i, T j := Finset.prod_pos (fun j _ => hT j) + have hbound : (∏ j, S j) ≤ S i * ∏ j ∈ Finset.univ.erase i, T j := by + rw [← Finset.mul_prod_erase Finset.univ S (Finset.mem_univ i)] + exact mul_le_mul_of_nonneg_left hrest (hS i) + have hlt := hprod.trans_le hbound + rw [← Finset.mul_prod_erase Finset.univ T (Finset.mem_univ i), ← mul_assoc] at hlt + exact (mul_lt_mul_iff_left₀ hrestpos).mp hlt + +theorem box_overlap_side_gt_of_card_gt {ι : Type*} [Fintype ι] [DecidableEq ι] + (a : ι → ℤ) (T : ι → ℕ) (hT : ∀ i, 0 < T i) (h : ι → ℤ) {δ : ℝ} + (hcard : δ * (translatedIntegerBox a T).card < + ((derivativeSupport (translatedIntegerBox a T) h).card : ℝ)) (i : ι) : + δ * T i < (((T i : ℤ) - |h i|).toNat : ℝ) := by + have hlen (j : ι) : ((T j : ℤ) - |h j|).toNat ≤ T j := by + have ha := abs_nonneg (h j) + omega + apply side_gt_of_prod_gt (fun j => (((T j : ℤ) - |h j|).toNat : ℝ)) + (fun j => (T j : ℝ)) (fun j => Nat.cast_nonneg _) (fun j => by exact_mod_cast hT j) + (fun j => by exact_mod_cast hlen j) _ i + rw [derivativeSupport_translatedIntegerBox] at hcard + simpa only [translatedIntegerBox, card_translateSupport, card_integerBox, Nat.cast_prod] using hcard + +theorem cardinality_ge_overlap_weight {A : Type*} [AddCommGroup A] [DecidableEq A] + {Q : Finset A} (hQ : Q.Nonempty) (I : Finset A) (P : A → Prop) [DecidablePred P] + {μ : ℝ} + (hweight : μ ≤ ∑ h ∈ I, (((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) * + (if P h then (1 : ℝ) else 0)) : + μ * Q.card ≤ ((I.filter P).card : ℝ) := by + have hq : (0 : ℝ) < Q.card := by exact_mod_cast hQ.card_pos + have hbound (h : A) : ((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2 ≤ + 1 / Q.card := by + have hc : ((derivativeSupport Q h).card : ℝ) ≤ Q.card := by + exact_mod_cast Finset.card_filter_le Q (fun x => x + h ∈ Q) + apply (div_le_div_iff₀ (sq_pos_of_pos hq) hq).mpr + nlinarith + have hsum : (∑ h ∈ I, (((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2) * + (if P h then (1 : ℝ) else 0)) ≤ ((I.filter P).card : ℝ) / Q.card := by + calc + _ = ∑ h ∈ I.filter P, ((derivativeSupport Q h).card : ℝ) / (Q.card : ℝ) ^ 2 := by + rw [Finset.sum_filter] + apply Finset.sum_congr rfl + intro h _ + split_ifs <;> simp + _ ≤ ∑ _h ∈ I.filter P, 1 / (Q.card : ℝ) := Finset.sum_le_sum (fun h _ => hbound h) + _ = _ := by simp only [Finset.sum_const, nsmul_eq_mul, mul_one_div] + exact (le_div_iff₀ hq).mp (hweight.trans hsum) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxPairCorrelation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxPairCorrelation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b829ffb0454d36bc10c40bcbd6c0b3a3430882e7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxPairCorrelation.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Estimates.SmoothPairErrorLogBounds + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem box_smooth_pair_correlation {J I A B : Type*} + [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] + [Fintype A] [DecidableEq A] [Fintype B] [DecidableEq B] + (t u : J → ℤ) (k : J) (hne : u k - t k ≠ 0) + (H : I → ℝ) {L C κ δ : ℝ} (Q : ℕ) (hH : ∀ i, 0 < H i) + (hL : 1 ≤ L) (hC : 1 ≤ C) (hκ : 0 < κ) (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) + (ht : ∀ j, |(t j : ℝ) / L| ≤ C) (hu : ∀ j, |(u j : ℝ) / L| ≤ C) + (hgap : κ ≤ |((u k - t k : ℤ) : ℝ) / L|) + (hQ : affinePairModulus t u ≤ Q) + (hmesh : ∀ i, ((u k - t k).natAbs : ℝ) * L / H i ≤ δ) + (hsmall : (4 : ℝ) ^ (2 + Fintype.card {j : J // j ≠ k}) * smoothPairRowLipschitz k * δ ≤ 1 / 2) + (b : Option J × I → ℤ) + (hZ : 0 < shiftedSmoothProductMass (fun z => (b z : ℝ)) + (fun z : Option J × I => smoothPairCoefficientScale (H z.2) L z.1)) + (loT hiT loU hiU : I → ℤ) + (hlenT : ∀ i, loT i < hiT i) (hlenU : ∀ i, loU i < hiU i) + (hwidthT : ∀ i, (affinePairModulus t u : ℝ) ≤ ((hiT i - loT i : ℤ) : ℝ)) + (hwidthU : ∀ i, (affinePairModulus t u : ℝ) ≤ ((hiU i - loU i : ℤ) : ℝ)) + (T U : Finset (I → ℤ)) [Nonempty T] [Nonempty U] + (hT : T = Fintype.piFinset (fun i => Finset.Ico (loT i) (hiT i))) + (hU : U = Fintype.piFinset (fun i => Finset.Ico (loU i) (hiU i))) + (e d : (I → ℤ) → ℝ) (heoff : ∀ x ∉ T, e x = 0) (hdoff : ∀ y ∉ U, d y = 0) + (P : T → A) (R : U → B) (cell : A → B → (I → ZMod (affinePairModulus t u)) → ℝ) + {alpha beta cap zeta : ℝ} (halpha : 0 ≤ alpha) (hcap : 0 ≤ cap) (hzeta : 0 ≤ zeta) + (he : ∀ c r, |finiteCellResidueMean (FiniteProbabilityWeights.uniform T) P + (fun x => integerVectorResidue (affinePairModulus t u) x.val) (fun x => e x.val) c r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform T) P).weight c * alpha / + (affinePairModulus t u : ℝ) ^ Fintype.card I) + (hd : ∀ c r, |finiteCellResidueMean (FiniteProbabilityWeights.uniform U) R + (fun y => integerVectorResidue (affinePairModulus t u) y.val) (fun y => d y.val) c r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform U) R).weight c * beta / + (affinePairModulus t u : ℝ) ^ Fintype.card I) + (hcell : ∀ c c' r, |cell c c' r| ≤ cap) + (hgrid : ∀ x : T, ∀ y : U, + integerVectorResidue (affinePairModulus t u) x.val = integerVectorResidue (affinePairModulus t u) y.val → + |shiftedPairLocationKernel t u k hne H L hH (zero_lt_one.trans_le hL) b x.val y.val - + cell (P x) (R y) (integerVectorResidue (affinePairModulus t u) x.val)| ≤ zeta) : + |(smoothSourceFiniteWeights (fun z => (b z : ℝ)) + (fun z : Option J × I => smoothPairCoefficientScale (H z.2) L z.1) + (fun z => smoothPairCoefficientScale_pos (hH z.2) (zero_lt_one.trans_le hL) z.1) hZ).mean + (fun z => e (smoothAffineSample t z.val) * d (smoothAffineSample u z.val))| ≤ + ((T.card : ℝ) * U.card / ∏ i, H i ^ 2) * + (cap * alpha * beta + (fullSmoothPairError (Fintype.card I) k Q C κ δ + zeta) * ((2 : ℝ) ^ Fintype.card I / 2 * + ((FiniteProbabilityWeights.uniform T).mean (fun x => e x.val ^ 2) + + (FiniteProbabilityWeights.uniform U).mean (fun y => d y.val ^ 2)))) := by + subst T + subst U + refine canonical_smooth_pair_correlation t u k hne H Q hH hL hC hκ hδ hδ1 + ht hu hgap hQ hmesh hsmall b hZ _ _ e d heoff hdoff P R cell halpha hcap hzeta + ?_ ?_ he hd hcell hgrid + · exact uniform_interval_box_residue_bound loT hiT hlenT (affinePairModulus t u) + (affinePairModulus_pos t u k hne) hwidthT + · exact uniform_interval_box_residue_bound loU hiU hlenU (affinePairModulus t u) + (affinePairModulus_pos t u k hne) hwidthU + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxPairDivisibility.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxPairDivisibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c9eeed33a78e4382edfd9090730d5d2f4d216eb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxPairDivisibility.lean @@ -0,0 +1,64 @@ +import OAI.Combinatorics.Progressions.Probability.IntervalDivisorProbability + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def integerBoxUniformWeights {J : Type*} [Fintype J] [DecidableEq J] + (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) : + FiniteProbabilityWeights (∀ j, Finset.Ico (lo j) (hi j)) := + FiniteProbabilityWeights.pi (fun j => intervalUniformWeights (lo j) (hi j) (hlen j)) + +theorem integer_box_divisor_probability {J : Type*} [Fintype J] [DecidableEq J] + (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (m : ℤ) (hm : 0 < m) (v : J → ℤ) : + (integerBoxUniformWeights lo hi hlen).eventProbability + (fun y => ∀ j, m ∣ (y j : ℤ) - v j) ≤ + ∏ j, (1 / (m : ℝ) + 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)) => m ∣ (y : ℤ) - v j)] + apply Finset.prod_le_prod₀ + · intro j _ + exact FiniteProbabilityWeights.eventProbability_nonneg _ _ + · intro j _ + exact interval_divisor_probability (lo j) (hi j) m (v j) (hlen j) hm + +theorem integer_box_pair_divisor_probability {J : Type*} [Fintype J] [DecidableEq J] + (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (m : ℤ) (hm : 0 < m) : + ((integerBoxUniformWeights lo hi hlen).prod (integerBoxUniformWeights lo hi hlen)).eventProbability + (fun xy => ∀ j, m ∣ (xy.2 j : ℤ) - (xy.1 j : ℤ)) ≤ + ∏ j, (1 / (m : ℝ) + 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_divisor_probability lo hi hlen m hm (fun j => (x j : ℤ)) + +theorem integer_box_pair_divisor_probability_of_lengths {J : Type*} + [Fintype J] [DecidableEq J] (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) + (m : ℤ) (hm : 0 < m) {L : ℝ} (hL : 0 < L) + (hside : ∀ j, L ≤ ((hi j - lo j : ℤ) : ℝ)) : + ((integerBoxUniformWeights lo hi hlen).prod (integerBoxUniformWeights lo hi hlen)).eventProbability + (fun xy => ∀ j, m ∣ (xy.2 j : ℤ) - (xy.1 j : ℤ)) ≤ + (1 / (m : ℝ) + 1 / L) ^ Fintype.card J := by + apply (integer_box_pair_divisor_probability lo hi hlen m hm).trans + calc + _ ≤ ∏ _j : J, (1 / (m : ℝ) + 1 / L) := by + apply Finset.prod_le_prod₀ + · intro j _ + have hmR : (0 : ℝ) < m := by exact_mod_cast hm + have hj : (0 : ℝ) < ((hi j - lo j : ℤ) : ℝ) := hL.trans_le (hside j) + positivity + · intro j _ + exact add_le_add le_rfl (one_div_le_one_div_of_le hL (hside j)) + _ = _ := by simp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxTestSmoothing.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxTestSmoothing.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ce851cce804e69827ba09b898736b8cb9f11757 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxTestSmoothing.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Lattices.AffineBoxTest + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal + +variable {ι : Type*} [Fintype ι] + +noncomputable def boxTestAverage (δ : ℝ) (φ : (ι → ℝ) → ℝ) : (ι → ℝ) → ℝ := + kernelAverage volume (boxProbabilityWindow (fun _ => δ)) φ + +theorem boxTestAverage_translate (δ : ℝ) (φ : (ι → ℝ) → ℝ) (x : ι → ℝ) : + boxTestAverage δ φ x = ∫ u, boxProbabilityWindow (fun _ => δ) 0 u * φ (x + u) := by + rw [boxTestAverage, boxAverage_eq_translate] + simp only [add_comm] + +noncomputable def boxTestLipschitz (δ : ℝ) (hδ : 0 < δ) : ℝ≥0 := + boxWindowTranslationBound (fun _ : ι => δ) (fun _ => hδ) + +theorem boxTestLipschitz_coe (δ : ℝ) (hδ : 0 < δ) : + (boxTestLipschitz (ι := ι) δ hδ : ℝ) = 2 * Fintype.card ι / δ := by + change (∑ _ : ι, 2 / δ) = _ + rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + ring + +theorem boxTestAverage_lipschitz [DecidableEq ι] (δ : ℝ) (hδ : 0 < δ) + (φ : (ι → ℝ) → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + LipschitzWith (boxTestLipschitz (ι := ι) δ hδ) (boxTestAverage δ φ) := by + have h := boxAverage_lipschitz (fun _ : ι => δ) (fun _ => hδ) φ 1 + hφ.aestronglyMeasurable hbound + simp only [one_mul] at h + exact h + +theorem boxTestAverage_norm_le (δ : ℝ) (hδ : 0 < δ) (φ : (ι → ℝ) → ℝ) + (hbound : ∀ x, ‖φ x‖ ≤ 1) (x : ι → ℝ) : ‖boxTestAverage δ φ x‖ ≤ 1 := by + have hp (t : ι → ℝ) : ‖boxProbabilityWindow (fun _ => δ) x t * φ t‖ ≤ + boxProbabilityWindow (fun _ => δ) x t := by + rw [norm_mul, Real.norm_of_nonneg (boxProbabilityWindow_nonneg _ (fun _ => hδ) _ _)] + exact (mul_le_mul_of_nonneg_left (hbound t) + (boxProbabilityWindow_nonneg _ (fun _ => hδ) _ _)).trans_eq (mul_one _) + have h := norm_integral_le_of_norm_le (boxProbabilityWindow_integrable (fun _ => δ) x) + (Filter.Eventually.of_forall hp) + exact h.trans_eq (boxProbabilityWindow_mass _ (fun _ => hδ) x) + +theorem boxProbabilityWindow_support_dist (δ : ℝ) (hδ : 0 < δ) (u : ι → ℝ) + (hu : boxProbabilityWindow (fun _ => δ) 0 u ≠ 0) : dist u 0 ≤ δ := by + apply (dist_pi_le_iff hδ.le).mpr + intro i + have hi : normalizedIntervalWindow δ 0 (u i) ≠ 0 := + Finset.prod_ne_zero_iff.mp hu i (Finset.mem_univ i) + have hui : u i ∈ Set.Ioc (0 : ℝ) δ := by + by_contra hnot + apply hi + simp only [normalizedIntervalWindow, intervalWindow, zero_add, Set.indicator_of_notMem hnot, zero_div] + simpa only [Pi.zero_apply, Real.dist_eq, sub_zero, abs_of_pos hui.1] using hui.2 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BoxWindowAveraging.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BoxWindowAveraging.lean new file mode 100644 index 0000000000000000000000000000000000000000..c01908d32fa98107b0ff9a2163ebcadaedaff7ee --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BoxWindowAveraging.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Estimates.NormalizedIntervalWindow +import OAI.Combinatorics.Progressions.Linear.KernelMixtureControl +import OAI.Combinatorics.Progressions.Probability.SampledWeightCellLaw + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators NNReal + +variable {ι : Type*} [Fintype ι] + +noncomputable def boxProbabilityWindow (ℓ x t : ι → ℝ) : ℝ := + ∏ i, normalizedIntervalWindow (ℓ i) (x i) (t i) + +noncomputable def boxWindowTranslationBound (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) : ℝ≥0 := + ⟨∑ i, 2 / ℓ i, Finset.sum_nonneg (fun i _ => div_nonneg (by norm_num) (hℓ i).le)⟩ + +theorem boxProbabilityWindow_nonneg (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) (x t : ι → ℝ) : + 0 ≤ boxProbabilityWindow ℓ x t := + Finset.prod_nonneg (fun i _ => normalizedIntervalWindow_nonneg (hℓ i) _ _) + +theorem boxProbabilityWindow_integrable (ℓ x : ι → ℝ) : + Integrable (boxProbabilityWindow ℓ x) := + Integrable.fintype_prod (fun i => normalizedIntervalWindow_integrable (ℓ i) (x i)) + +theorem boxProbabilityWindow_measurable (ℓ x : ι → ℝ) : Measurable (boxProbabilityWindow ℓ x) := by + apply Finset.measurable_prod + intro i _ + exact (normalizedIntervalWindow_measurable _ _).comp (measurable_pi_apply i) + +theorem boxProbabilityWindow_mass (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) (x : ι → ℝ) : + (∫ t, boxProbabilityWindow ℓ x t) = 1 := by + unfold boxProbabilityWindow + rw [integral_fintype_prod_volume_eq_prod] + simp only [normalizedIntervalWindow_mass (hℓ _), Finset.prod_const_one] + +theorem boxProbabilityWindow_cap (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) (x t : ι → ℝ) : + boxProbabilityWindow ℓ x t ≤ ∏ i, 1 / ℓ i := + Finset.prod_le_prod₀ (fun i _ => normalizedIntervalWindow_nonneg (hℓ i) _ _) + (fun i _ => normalizedIntervalWindow_le (hℓ i) _ _) + +theorem boxProbabilityWindow_translation_le [DecidableEq ι] + (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) (x y : ι → ℝ) : + (∫ t, |boxProbabilityWindow ℓ x t - boxProbabilityWindow ℓ y t|) ≤ + (boxWindowTranslationBound ℓ hℓ : ℝ) * dist x y := by + have h := product_density_l1_le_sum + (fun i => normalizedIntervalWindow (ℓ i) (x i)) (fun i => normalizedIntervalWindow (ℓ i) (y i)) + (fun i => normalizedIntervalWindow_integrable _ _) (fun i => normalizedIntervalWindow_integrable _ _) + (fun i => normalizedIntervalWindow_nonneg (hℓ i) _) (fun i => normalizedIntervalWindow_nonneg (hℓ i) _) + (fun i => normalizedIntervalWindow_mass (hℓ i) _) (fun i => normalizedIntervalWindow_mass (hℓ i) _) + apply h.trans + change (∑ i, ∫ t, |normalizedIntervalWindow (ℓ i) (x i) t - normalizedIntervalWindow (ℓ i) (y i) t|) ≤ + (∑ i, 2 / ℓ i) * dist x y + rw [Finset.sum_mul] + apply Finset.sum_le_sum + intro i _ + apply (normalizedIntervalWindow_translation_le (hℓ i) (x i) (y i)).trans + apply mul_le_mul_of_nonneg_left _ (div_nonneg (by norm_num) (hℓ i).le) + simpa only [Real.dist_eq] using dist_le_pi_dist x y i + +theorem boxAverage_lipschitz [DecidableEq ι] (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (g : (ι → ℝ) → ℝ) (C : ℝ≥0) (hg : AEStronglyMeasurable g volume) + (hbound : ∀ t, ‖g t‖ ≤ C) : + LipschitzWith (C * boxWindowTranslationBound ℓ hℓ) + (kernelAverage volume (boxProbabilityWindow ℓ) g) := + kernelAverage_lipschitz volume (boxProbabilityWindow ℓ) g C (boxWindowTranslationBound ℓ hℓ) + (boxProbabilityWindow_integrable ℓ) hg hbound (boxProbabilityWindow_translation_le ℓ hℓ) + +theorem boxAverage_mem_Icc (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (g : (ι → ℝ) → ℝ) {C : ℝ} (hg : AEStronglyMeasurable g volume) + (hbound : ∀ t, g t ∈ Set.Icc (0 : ℝ) C) (x : ι → ℝ) : + kernelAverage volume (boxProbabilityWindow ℓ) g x ∈ Set.Icc (0 : ℝ) C := + ⟨kernelAverage_nonneg volume _ g (boxProbabilityWindow_nonneg ℓ hℓ) (fun t => (hbound t).1) x, + kernelAverage_cap volume _ g (boxProbabilityWindow_integrable ℓ) (boxProbabilityWindow_nonneg ℓ hℓ) + (boxProbabilityWindow_mass ℓ hℓ) hg hbound x⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BufferedActiveIdealSiteSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BufferedActiveIdealSiteSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0f61b5bf326c92ffd4fa0d513f4b4854ca88414 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BufferedActiveIdealSiteSupport.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalActiveIdealSite + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem exists_supported_buffered_active_ideal_site_approximation + {D G Z α U : Type*} [Fintype D] [Fintype G] [Fintype α] [DecidableEq α] + [PseudoMetricSpace U] {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] + (h : D → ℕ) (P : D → Prop) [DecidablePred P] + (sets : ∀ d : {d // ¬P d}, O d.val → Finset α) + (δ : ℝ≥0) (hδ : 0 < δ) + {R ε p : ℝ} (hR : 0 < R) (hε : 0 < ε) (hp : 0 ≤ p) + (hRp : R ≤ Real.exp p) (hεp : ε⁻¹ ≤ Real.exp p) (hδp : (δ : ℝ)⁻¹ ≤ Real.exp p) + (y : Finset α → U → D → ℝ) (χ : Finset α → U → ℂ) {L C : ℝ≥0} + (hy : ∀ s, LipschitzWith L (y s)) (hχ : ∀ s, LipschitzWith C (χ s)) + (hχ1 : ∀ s u, ‖χ s u‖ ≤ 1) (hsupport : ∀ s u, χ s u ≠ 0 → ∀ d, |y s u d| ≤ R) : + let Q := idealSiteLogBudget (Fintype.card (Σ d, O d)) (Fintype.card α) p + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + ∃ (a : (Finset α × D → Fin n) → ℂ) (f : (Finset α × D → Fin n) → Finset α → U → ℂ), + (∑ k, ‖a k‖) ≤ Real.exp ((Fintype.card (Finset α) * Fintype.card D : ℕ) * (4 * Q + 8) + Q) ∧ + (∀ k s u, ‖f k s u‖ ≤ 1) ∧ + (∀ k s, LipschitzWith (⟨Real.exp (Fintype.card D + 6 * Q + 12), Real.exp_nonneg _⟩ * L + C) (f k s)) ∧ + (∀ k s u, χ s u = 0 → f k s u = 0) ∧ + ∀ u : Finset α → U, + ‖(∏ s, χ s (u s)) * (activeAveragedProfileIdeal (G := G) (B := B) Z h P sets δ + (booleanSiteJets sets (fun s d => y s (u s) d.val)) : ℂ) - + ∑ k, a k * ∏ s, f k s (u s)‖ ≤ ε := by + obtain ⟨n, hn, a, f, ha, hf, hLip, herr⟩ := + exists_active_ideal_site_approximation (G := G) (Z := Z) (B := B) h P sets δ hδ hR hε hp hRp hεp hδp + dsimp only + refine ⟨n, hn, a, bufferedSiteFactor y χ f, ha, ?_, ?_, ?_, ?_⟩ + · exact bufferedSiteFactor_bound y χ f hχ1 hf + · exact bufferedSiteFactor_lipschitz y χ f hy hχ hLip hχ1 hf + · intro k s u hu + simp only [bufferedSiteFactor, hu, zero_mul] + · intro u + exact bufferedSiteExpansion_error y χ + (activeAveragedIdealSiteFunction (G := G) (Z := Z) (B := B) h P sets δ) + a f hε.le hχ1 hsupport herr u + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/BufferedActiveSlicedIdealSiteSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/BufferedActiveSlicedIdealSiteSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..6797d31c6397e3101215801b2aec2221f2697e14 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/BufferedActiveSlicedIdealSiteSupport.lean @@ -0,0 +1,51 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedTailProfileIdentity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem exists_supported_buffered_active_sliced_ideal_site_approximation + {D G Z α U : Type*} [Fintype D] [Fintype G] [Fintype Z] [Fintype α] [DecidableEq α] + [PseudoMetricSpace U] {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] + (h : D → ℕ) (P : D → Prop) [DecidablePred P] + (sets : ∀ d : {d // ¬P d}, O d.val → Finset α) + (center width : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) + (δ : ℝ≥0) (hδ : 0 < δ) + {R ε p : ℝ} (hR : 0 < R) (hε : 0 < ε) (hp : 0 ≤ p) + (hRp : R ≤ Real.exp p) (hεp : ε⁻¹ ≤ Real.exp p) (hδp : (δ : ℝ)⁻¹ ≤ Real.exp p) + (y : Finset α → U → D → ℝ) (χ : Finset α → U → ℂ) {L C : ℝ≥0} + (hy : ∀ s, LipschitzWith L (y s)) (hχ : ∀ s, LipschitzWith C (χ s)) + (hχ1 : ∀ s u, ‖χ s u‖ ≤ 1) (hsupport : ∀ s u, χ s u ≠ 0 → ∀ d, |y s u d| ≤ R) : + let Q := idealSiteLogBudget (Fintype.card (Σ d, O d)) (Fintype.card α) p + ∃ n : ℕ, (n : ℝ) ≤ Real.exp (4 * Q + 8) ∧ + ∃ (a : (Finset α × D → Fin n) → ℂ) (f : (Finset α × D → Fin n) → Finset α → U → ℂ), + (∑ k, ‖a k‖) ≤ Real.exp ((Fintype.card (Finset α) * Fintype.card D : ℕ) * (4 * Q + 8) + Q) ∧ + (∀ k s u, ‖f k s u‖ ≤ 1) ∧ + (∀ k s, LipschitzWith (⟨Real.exp (Fintype.card D + 6 * Q + 12), Real.exp_nonneg _⟩ * L + C) (f k s)) ∧ + (∀ k s u, χ s u = 0 → f k s u = 0) ∧ + ∀ u : Finset α → U, + ‖(∏ s, χ s (u s)) * (activeAveragedSlicedProfileIdeal (G := G) (B := B) Z h P sets δ center width + (booleanSiteJets sets (fun s d => y s (u s) d.val)) : ℂ) - + ∑ k, a k * ∏ s, f k s (u s)‖ ≤ ε := by + obtain ⟨n, hn, a, f, ha, hf, hLip, herr⟩ := + exists_active_sliced_ideal_site_approximation (G := G) (Z := Z) (B := B) h P sets center width δ hδ hR hε hp hRp hεp hδp + dsimp only + refine ⟨n, hn, a, bufferedSiteFactor y χ f, ha, ?_, ?_, ?_, ?_⟩ + · exact bufferedSiteFactor_bound y χ f hχ1 hf + · exact bufferedSiteFactor_lipschitz y χ f hy hχ hLip hχ1 hf + · intro k s u hu + simp only [bufferedSiteFactor, hu, zero_mul] + · intro u + exact bufferedSiteExpansion_error y χ + (activeAveragedSlicedIdealSiteFunction (G := G) (Z := Z) (B := B) h P sets center width δ) + a f hε.le hχ1 hsupport herr u + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalScalarFullBoxDiscrepancy.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalScalarFullBoxDiscrepancy.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbf5ac3a49d731469d7591635e187026c435948c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalScalarFullBoxDiscrepancy.lean @@ -0,0 +1,51 @@ +import OAI.Combinatorics.Progressions.Estimates.UnconditionedTrimmedSliceFamily + +namespace OAI + +section + +namespace Erdos3 +open scoped Classical + +theorem rectangularScalarDiscrepancy_fullBox {I J : Type*} + [Fintype I] [Fintype J] [decJ : DecidableEq J] + (parent : I → ℤ) (H : I → ℕ) (h g : (I → ℤ) → ℂ) + (epsilon level : ℝ) (parameters : J → ℕ) + (hparam : ∀ j, (0 : ℤ) < parameters j) (z : Option J × I → ℤ) : + rectangularScalarDiscrepancy parent H h g epsilon level 1 + 0 0 (fun j => (parameters j : ℤ)) hparam z = + (integerBoxUniformWeights (fun _ : J => (0 : ℤ)) + (fun j => (parameters j : ℤ)) hparam).mean + (fun t => realZeroExtendFinset (translatedIntegerBox parent H) (fun x => (h x).re) + (smoothAffineSample (fun j => (t j).val) z) - + (1 + epsilon) * level * + realZeroExtendFinset (translatedIntegerBox parent H) (fun x => (g x).re) + (smoothAffineSample (fun j => (t j).val) z)) := by + cases Subsingleton.elim decJ (Classical.typeDecidableEq J) + simp only [rectangularScalarDiscrepancy, Nat.cast_one, one_mul, Pi.zero_apply, zero_add] + rfl + +theorem canonicalScalarFullBox_transfer {Ω I J : Type*} + [Fintype Ω] [Fintype I] [Fintype J] [decJ : DecidableEq J] + (outer : FiniteProbabilityWeights Ω) (source : Ω → Option J × I → ℤ) + (parent : I → ℤ) (H : I → ℕ) (h g : (I → ℤ) → ℂ) + (epsilon level : ℝ) (parameters : J → ℕ) + (hparam : ∀ j, (0 : ℤ) < parameters j) (target : ℝ) + (hplain : outer.eventProbability (fun z => Real.exp (-target) < + (integerBoxUniformWeights (fun _ : J => (0 : ℤ)) + (fun j => (parameters j : ℤ)) hparam).mean + (fun t => realZeroExtendFinset (translatedIntegerBox parent H) (fun x => (h x).re) + (smoothAffineSample (fun j => (t j).val) (source z)) - + (1 + epsilon) * level * + realZeroExtendFinset (translatedIntegerBox parent H) (fun x => (g x).re) + (smoothAffineSample (fun j => (t j).val) (source z)))) ≤ Real.exp (-target)) : + outer.eventProbability (fun z => Real.exp (-target) < + rectangularScalarDiscrepancy parent H h g epsilon level 1 + 0 0 (fun j => (parameters j : ℤ)) hparam (source z)) ≤ Real.exp (-target) := by + simpa only [rectangularScalarDiscrepancy_fullBox] using hplain + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalScalarParameterBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalScalarParameterBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..0bc03517afabd21ffbbee549c3e64e2f000656c8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalScalarParameterBox.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Linear.CanonicalJointFrameGeometry + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel +open scoped BigOperators Classical + +noncomputable def canonicalScalarParameterRadius (L : ℝ) : ℕ := ⌈2 * L⌉₊ + +theorem canonicalScalarParameterRadius_bounds {L : ℝ} (hL : 1 ≤ L) : + 0 < canonicalScalarParameterRadius L ∧ + 2 * L ≤ (canonicalScalarParameterRadius L : ℝ) ∧ + (canonicalScalarParameterRadius L : ℝ) ≤ 3 * L := by + have hceil : 2 * L ≤ (⌈2 * L⌉₊ : ℝ) := Nat.le_ceil _ + have hupper := Nat.ceil_lt_add_one (show 0 ≤ 2 * L by linarith) + refine ⟨?_, hceil, ?_⟩ + · have : (0 : ℝ) < canonicalScalarParameterRadius L := + (by linarith : 0 < 2 * L).trans_le hceil + exact_mod_cast this + · change (⌈2 * L⌉₊ : ℝ) ≤ 3 * L + linarith + +theorem canonicalScalarParameterSite_bounds {d : ℕ} (hd : 2 ≤ d) + {L : ℝ} (_hL : 1 ≤ L) (P : Fin d → ℕ) + (hlo : ∀ j, L ≤ (P j : ℝ)) (hhi : ∀ j, (P j : ℝ) ≤ 2 * L) : + 0 ≤ (∑ j, (P j : ℝ)) ∧ L ≤ (∑ j, (P j : ℝ)) ∧ + (∑ j, (P j : ℝ)) ≤ 2 * (d : ℝ) * L := by + refine ⟨Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _), ?_, ?_⟩ + · let j : Fin d := ⟨0, by omega⟩ + exact (hlo j).trans (Finset.single_le_sum + (fun _ _ => Nat.cast_nonneg (α := ℝ) _) (Finset.mem_univ j)) + · have h := Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => hhi j) + simpa only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, + nsmul_eq_mul, mul_left_comm (d : ℝ) 2 L, mul_assoc] using h + +theorem canonicalScalarParameterBox_bounds {d : ℕ} (hd : 2 ≤ d) + {L : ℝ} (hL : 1 ≤ L) (P : Fin d → ℕ) + (hlo : ∀ j, L ≤ (P j : ℝ)) (hhi : ∀ j, (P j : ℝ) ≤ 2 * L) : + (∀ j, (0 : ℤ) < (P j : ℤ)) ∧ + 0 < L ∧ + (∀ j, L ≤ (((P j : ℤ) - 0 : ℤ) : ℝ)) ∧ + (∀ j, (P j : ℤ) - 0 ≤ (canonicalScalarParameterRadius L : ℤ)) ∧ + (canonicalScalarParameterRadius L : ℝ) ≤ 3 * L ∧ + 1 * L ≤ L ∧ + |(0 : ℝ) / L| ≤ 2 ∧ + (∀ j, |(((P j : ℤ) : ℝ)) / L| ≤ 2) ∧ + 0 ≤ (∑ j, (P j : ℝ)) ∧ L ≤ (∑ j, (P j : ℝ)) ∧ + (∑ j, (P j : ℝ)) ≤ 2 * (d : ℝ) * L := by + have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL + have hrad := canonicalScalarParameterRadius_bounds hL + refine ⟨?_, hLp, ?_, ?_, hrad.2.2, by simp, by norm_num, ?_, + canonicalScalarParameterSite_bounds hd hL P hlo hhi⟩ + · intro j + exact_mod_cast hLp.trans_le (hlo j) + · simpa only [sub_zero, Int.cast_natCast] using hlo + · intro j + have h := (hhi j).trans hrad.2.1 + rw [sub_zero] + exact_mod_cast h + · intro j + rw [Int.cast_natCast, abs_div, abs_of_nonneg (Nat.cast_nonneg _), abs_of_pos hLp] + exact (div_le_iff₀ hLp).mpr (hhi j) + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalSpatialSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalSpatialSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..168e651a6335a1e7c1cd9f631a97c79b440a4c1e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalSpatialSupport.lean @@ -0,0 +1,185 @@ +import OAI.Combinatorics.Progressions.Probability.AnisotropicCanonicalDensity + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped Matrix BigOperators + +variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + +theorem normalizedFiber_output_row + (A : Matrix I I ℤ) (hA : A.det ≠ 0) (B : Matrix I J ℤ) + (S P : I → ℝ) (T : J → ℝ) (hS : ∀ i, 0 < S i) (hP : ∀ i, 0 < P i) + (z : I → ℝ) (y : J → ℝ) (i : I) : + P i * ((normalizedPivotEquiv A hA S P hS hP z) i + + (matrixSupCLM (normalizedIntegerColumns B T P) y) i) = + (∑ j, (A i j : ℝ) * S j * z j) + ∑ j, (B i j : ℝ) * T j * y j := by + change P i * (((normalizedPivotEquiv A hA S P hS hP).toContinuousLinearMap z) i + _) = _ + rw [normalizedPivotEquiv_coe, matrixSupCLM_apply, matrixSupCLM_apply] + simp only [Matrix.mulVec, dotProduct, normalizedIntegerPivot_entry, normalizedIntegerColumns_entry_div] + rw [mul_add, Finset.mul_sum, Finset.mul_sum] + congr 1 <;> apply Finset.sum_congr rfl <;> intro j _ <;> field_simp [(hP i).ne'] + +theorem normalizedFiberDensity_zero_of_row + (A : Matrix I I ℤ) (hA : A.det ≠ 0) (B : Matrix I J ℤ) + (S P : I → ℝ) (T : J → ℝ) (hS : ∀ i, 0 < S i) (hP : ∀ i, 0 < P i) + (hT : ∀ j, 0 ≤ T j) (f : (J → ℝ) × (I → ℝ) → ℝ) + (hsupport : ∀ p, 1 < ‖p‖ → f p = 0) (v : I → ℝ) (i : I) + (hfar : (∑ j, |(A i j : ℝ)| * S j) + (∑ j, |(B i j : ℝ)| * T j) < |P i * v i|) : + normalizedFiberDensity A hA B S P T hS hP f v = 0 := by + let E := normalizedPivotEquiv A hA S P hS hP + let C := matrixSupCLM (normalizedIntegerColumns B T P) + have hzero (y : J → ℝ) : f (y, E.symm (v - C y)) = 0 := by + by_contra hn + let z := E.symm (v - C y) + have hnorm : ‖(y, z)‖ ≤ 1 := le_of_not_gt (fun h => hn (hsupport _ h)) + have hy (j) : |y j| ≤ 1 := by + exact (show |y j| ≤ ‖y‖ by simpa only [Real.norm_eq_abs] using norm_le_pi_norm y j).trans + ((norm_fst_le (y,z)).trans hnorm) + have hz (j) : |z j| ≤ 1 := by + exact (show |z j| ≤ ‖z‖ by simpa only [Real.norm_eq_abs] using norm_le_pi_norm z j).trans + ((norm_snd_le (y,z)).trans hnorm) + have heq : (E z) i + (C y) i = v i := by + dsimp only [z] + rw [E.apply_symm_apply] + simp only [Pi.sub_apply, sub_add_cancel] + have hrow := normalizedFiber_output_row A hA B S P T hS hP z y i + change P i * ((E z) i + (C y) i) = _ at hrow + rw [heq] at hrow + have hbound : |P i * v i| ≤ + (∑ j, |(A i j : ℝ)| * S j) + ∑ j, |(B i j : ℝ)| * T j := by + rw [hrow] + apply (abs_add_le _ _).trans + apply add_le_add + · apply (Finset.abs_sum_le_sum_abs _ _).trans + apply Finset.sum_le_sum + intro j _ + rw [abs_mul, abs_mul, abs_of_pos (hS j)] + exact (mul_le_mul_of_nonneg_left (hz j) (mul_nonneg (abs_nonneg _) (hS j).le)).trans_eq (mul_one _) + · apply (Finset.abs_sum_le_sum_abs _ _).trans + apply Finset.sum_le_sum + intro j _ + rw [abs_mul, abs_mul, abs_of_nonneg (hT j)] + exact (mul_le_mul_of_nonneg_left (hy j) (mul_nonneg (abs_nonneg _) (hT j))).trans_eq (mul_one _) + exact (not_le_of_gt hfar) hbound + change pivotOutputDensity E C f v = 0 + rw [pivotOutputDensity_formula] + simp only [hzero, integral_zero, mul_zero] + +theorem normalizedFiberDensity_row_bound + (A : Matrix I I ℤ) (hA : A.det ≠ 0) (B : Matrix I J ℤ) + (S P : I → ℝ) (T : J → ℝ) (hS : ∀ i, 0 < S i) (hP : ∀ i, 0 < P i) + (hT : ∀ j, 0 ≤ T j) (f : (J → ℝ) × (I → ℝ) → ℝ) + (hsupport : ∀ p, 1 < ‖p‖ → f p = 0) (v : I → ℝ) + (hne : normalizedFiberDensity A hA B S P T hS hP f v ≠ 0) (i : I) : + |P i * v i| ≤ (∑ j, |(A i j : ℝ)| * S j) + ∑ j, |(B i j : ℝ)| * T j := by + by_contra h + exact hne (normalizedFiberDensity_zero_of_row A hA B S P T hS hP hT f hsupport v i (lt_of_not_ge h)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped BigOperators Matrix + +variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + +omit [DecidableEq I] [DecidableEq J] in +theorem selectedColumn_sum (s : I ↪ J) (f : J → ℝ) : + (∑ i, f (s i)) + (∑ j : UnselectedColumn s, f j.val) = ∑ j, f j := by + calc + _ = ∑ j : I ⊕ UnselectedColumn s, f (selectedColumnEquiv s j) := by + rw [Fintype.sum_sum_type] + rfl + _ = _ := Equiv.sum_comp (selectedColumnEquiv s) f + +omit [DecidableEq I] [DecidableEq J] in +theorem selectedSpatial_root_row_mass (s : I ↪ J) (root : J → ℤ) (D : Matrix I J ℤ) (H : ℝ) : + (∑ j, |((selectedSpatialPivot root D s (.inl ()) j : ℤ) : ℝ)| * anisotropicSpatialScale I H 1 j) + + (∑ j : UnselectedColumn s, |((selectedSpatialFreeColumns root D s (.inl ()) j : ℤ) : ℝ)| * 1) = + H + ∑ j, |(root j : ℝ)| := by + simpa [selectedSpatialPivot, rootDifferenceMatrix, selectedSpatialFreeColumns, + anisotropicSpatialScale, Fintype.sum_sum_type, add_assoc] using + congrArg (fun t : ℝ => H + t) (selectedColumn_sum s (fun j => |(root j : ℝ)|)) + +omit [DecidableEq I] [DecidableEq J] in +theorem selectedSpatial_slope_row_mass (s : I ↪ J) (root : J → ℤ) (D : Matrix I J ℤ) (H : ℝ) (i : I) : + (∑ j, |((selectedSpatialPivot root D s (.inr i) j : ℤ) : ℝ)| * anisotropicSpatialScale I H 1 j) + + (∑ j : UnselectedColumn s, |((selectedSpatialFreeColumns root D s (.inr i) j : ℤ) : ℝ)| * 1) = + ∑ j, |(D i j : ℝ)| := by + simpa [selectedSpatialPivot, rootDifferenceMatrix, selectedSpatialFreeColumns, + anisotropicSpatialScale, Fintype.sum_sum_type] using + selectedColumn_sum s (fun j => |(D i j : ℝ)|) + +theorem canonicalSpatialSiteDensity_star_bound (s : I ↪ J) (root : J → ℤ) (D : Matrix I J ℤ) + (hp : (selectedSpatialPivot root D s).det ≠ 0) + {W L : ℝ} (hW : 0 ≤ W) (hL : 0 < L) + (hroot : (∑ j, |(root j : ℝ)|) ≤ W) + (hD : ∀ i, (∑ j, |(D i j : ℝ)|) ≤ 1 + W) + (v : (Unit ⊕ I) → ℝ) (hne : canonicalSpatialSiteDensity s root D hp W L hW hL v ≠ 0) : + ∀ i, |spatialStar v i| ≤ 3 := by + let H := 1 + W + have hH : 0 < H := by dsimp only [H]; linarith + let P := physicalSpatialOutputScale I H 1 L + have hP : ∀ i, 0 < P i := physicalSpatialOutputScale_pos I hH zero_lt_one hL + let w := fun i => H / P i * v i + have hn : normalizedFiberDensity (selectedSpatialPivot root D s) hp + (selectedSpatialFreeColumns root D s) (anisotropicSpatialScale I H 1) P (fun _ => 1) + (anisotropicSpatialScale_pos I hH zero_lt_one) hP + (smoothSplitProfile (UnselectedColumn s) (Unit ⊕ I)) w ≠ 0 := hne + have hrow := normalizedFiberDensity_row_bound (selectedSpatialPivot root D s) hp + (selectedSpatialFreeColumns root D s) (anisotropicSpatialScale I H 1) P (fun _ => 1) + (anisotropicSpatialScale_pos I hH zero_lt_one) hP (fun _ => zero_le_one) + (smoothSplitProfile (UnselectedColumn s) (Unit ⊕ I)) + (smoothSplitProfile_zero_outside (UnselectedColumn s) (Unit ⊕ I)) w hn + have hscale (i) : P i * w i = H * v i := by + dsimp only [w] + field_simp [(hP i).ne'] + have hr : |H * v (.inl ())| ≤ H + W := by + have h := hrow (.inl ()) + rw [hscale, selectedSpatial_root_row_mass] at h + exact h.trans (add_le_add le_rfl hroot) + have hd (i) : |H * v (.inr i)| ≤ H := by + have h := hrow (.inr i) + rw [hscale, selectedSpatial_slope_row_mass] at h + exact h.trans (hD i) + have hvroot : |v (.inl ())| ≤ 2 := by + rw [abs_mul, abs_of_pos hH] at hr + dsimp only [H] at hr hH + nlinarith + have hvdiff (i) : |v (.inr i)| ≤ 1 := by + have h := hd i + rw [abs_mul, abs_of_pos hH] at h + nlinarith + intro i + cases i with + | inl i => exact hvroot.trans (by norm_num) + | inr i => + change |v (.inl ()) + v (.inr i)| ≤ 3 + exact (abs_add_le _ _).trans (by linarith [hvdiff i]) + +theorem canonicalSpatialSiteDensity_zero_outside (s : I ↪ J) (root : J → ℤ) (D : Matrix I J ℤ) + (hp : (selectedSpatialPivot root D s).det ≠ 0) + {W L : ℝ} (hW : 0 ≤ W) (hL : 0 < L) + (hroot : (∑ j, |(root j : ℝ)|) ≤ W) + (hD : ∀ i, (∑ j, |(D i j : ℝ)|) ≤ 1 + W) + (v : (Unit ⊕ I) → ℝ) (hv : ∃ i, 3 < |spatialStar v i|) : + canonicalSpatialSiteDensity s root D hp W L hW hL v = 0 := by + by_contra hn + obtain ⟨i, hi⟩ := hv + exact (not_lt_of_ge (canonicalSpatialSiteDensity_star_bound s root D hp hW hL hroot hD v hn i)) hi + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalSpatialSupportTwo.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalSpatialSupportTwo.lean new file mode 100644 index 0000000000000000000000000000000000000000..df2b438c9b6d402bf5e8a033deb7f37a9c45d6c9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CanonicalSpatialSupportTwo.lean @@ -0,0 +1,65 @@ +import OAI.Combinatorics.Progressions.Probability.CanonicalZeroSpatialDensity + +namespace OAI + +section + +namespace Erdos3 +open BooleanCubeKernel +open scoped BigOperators Matrix + +theorem canonicalSpatialSiteDensity_root_bound_two + {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + (s : I ↪ J) (root : J → ℤ) (D : Matrix I J ℤ) + (hp : (selectedSpatialPivot root D s).det ≠ 0) + {W L : ℝ} (hW : 0 ≤ W) (hL : 0 < L) + (hroot : (∑ j, |(root j : ℝ)|) ≤ W) + (v : (Unit ⊕ I) → ℝ) + (hne : canonicalSpatialSiteDensity s root D hp W L hW hL v ≠ 0) : + |v (.inl ())| ≤ 2 := by + let H := 1 + W + have hH : 0 < H := by dsimp [H]; linarith + let P := physicalSpatialOutputScale I H 1 L + have hP : ∀ i, 0 < P i := physicalSpatialOutputScale_pos I hH zero_lt_one hL + let w := fun i => H / P i * v i + have hn : normalizedFiberDensity (selectedSpatialPivot root D s) hp + (selectedSpatialFreeColumns root D s) (anisotropicSpatialScale I H 1) P (fun _ => 1) + (anisotropicSpatialScale_pos I hH zero_lt_one) hP + (smoothSplitProfile (UnselectedColumn s) (Unit ⊕ I)) w ≠ 0 := hne + have hrow := normalizedFiberDensity_row_bound (selectedSpatialPivot root D s) hp + (selectedSpatialFreeColumns root D s) (anisotropicSpatialScale I H 1) P (fun _ => 1) + (anisotropicSpatialScale_pos I hH zero_lt_one) hP (fun _ => zero_le_one) + (smoothSplitProfile (UnselectedColumn s) (Unit ⊕ I)) + (smoothSplitProfile_zero_outside (UnselectedColumn s) (Unit ⊕ I)) w hn + have hscale (i) : P i * w i = H * v i := by + dsimp only [w] + field_simp [(hP i).ne'] + have hr : |H * v (.inl ())| ≤ H + W := by + have h := hrow (.inl ()) + rw [hscale, selectedSpatial_root_row_mass] at h + exact h.trans (add_le_add le_rfl hroot) + rw [abs_mul, abs_of_pos hH] at hr + dsimp only [H] at hr hH + nlinarith + +theorem canonicalZeroSpatialJointDensity_coordinate_bound_two + {J X : Type*} [Fintype J] [DecidableEq J] [Fintype X] + (s : Empty ↪ J) (root : J → ℤ) (D : Matrix Empty J ℤ) + (hp : (selectedSpatialPivot root D s).det ≠ 0) + {W L : ℝ} (hW : 0 ≤ W) (hL : 0 < L) + (hroot : (∑ j, |(root j : ℝ)|) ≤ W) + (v : (Σ _ : X, Unit ⊕ Empty) → ℝ) + (hne : canonicalZeroSpatialJointDensity s root D hp hW hL v ≠ 0) : + ∀ i : X, |v ⟨i, .inl ()⟩| ≤ 2 := by + intro i + apply canonicalSpatialSiteDensity_root_bound_two s root D hp hW hL hroot + (fun a => v ⟨i, a⟩) + change (∏ j : X, canonicalSpatialSiteDensity s root D hp W L hW hL + (fun a => v ⟨j, a⟩)) ≠ 0 at hne + exact (Finset.prod_ne_zero_iff.mp hne) i (Finset.mem_univ _) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CenteredCoefficientDeckChartMeasurable.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CenteredCoefficientDeckChartMeasurable.lean new file mode 100644 index 0000000000000000000000000000000000000000..e994792c7f5f3e42b2735c1c997c905f4e066fb7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CenteredCoefficientDeckChartMeasurable.lean @@ -0,0 +1,256 @@ +import Mathlib.MeasureTheory.Constructions.Polish.Basic +import OAI.Combinatorics.Progressions.Estimates.ConstantCenterUniformLifts +import OAI.Combinatorics.Progressions.Lattices.CoefficientDeckResidueMask +import OAI.Combinatorics.Progressions.Linear.JointFrameCoefficientCoverSample + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule +attribute [local irreducible] coefficientDeckKernelEquiv canonicalCoefficientDeckSample coefficientSamplerAmbientPoint + +variable {K : Type*} [Fintype K] {m : ℕ} {J I E : Fin m → Type*} +variable [∀ j, Fintype (J j)] [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +def coefficientDeckChartEvent (q : ℕ) [NeZero q] + (event : CoefficientChartResidues K n E q → Prop) (y : CoefficientTorus (K := K) U) : Prop := + ∃ x : CoefficientSamplerArrays (K := K) I n, ∃ r : CoefficientDeckResidues (K := K) E q, + (∀ a, |coefficientSamplerAmbientPoint U b o x a| < 1/2) ∧ + canonicalCoefficientDeckSample U bW b hb o q (NeZero.pos q) x r = y ∧ + event (coefficientSamplerChartResidues q x r) + +omit [Fintype K] in +theorem coefficientDeckChartEvent_sample_iff (q : ℕ) [NeZero q] + (event : CoefficientChartResidues K n E q → Prop) + (x : CoefficientSamplerArrays (K := K) I n) + (hx : ∀ a, |coefficientSamplerAmbientPoint U b o x a| < 1/2) + (r : CoefficientDeckResidues (K := K) E q) : + coefficientDeckChartEvent U bW b hb o q event + (canonicalCoefficientDeckSample U bW b hb o q (NeZero.pos q) x r) ↔ + event (coefficientSamplerChartResidues q x r) := by + constructor + · rintro ⟨x', r', hx', he, hp⟩ + have h : (x', r') = (x, r) := canonicalCoefficientDeckSample_injOn_smallAmbient U bW b hb o q (NeZero.pos q) + (x₁ := (x', r')) (x₂ := (x, r)) hx' hx (by exact he) + obtain ⟨rfl, rfl⟩ := Prod.mk.inj h + exact hp + · intro he + exact ⟨x, r, hx, rfl, he⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule MeasureTheory +open scoped Classical + +variable {K : Type*} [Fintype K] {m : ℕ} {J I E : Fin m → Type*} +variable [∀ j, Fintype (J j)] [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +omit [Fintype K] in + +theorem coefficientSamplerAmbientPoint_measurable (a : CoefficientAmbientIndex K J) : + Measurable (fun x : CoefficientSamplerArrays (K := K) I n => + coefficientSamplerAmbientPoint U b o x a) := by + exact (PiLp.continuous_apply 2 (fun _ : J a.1.1 => ℝ) a.2).measurable.comp + ((normalizedLatticePoint_continuous (euclideanSubspace (U a.1.1)) (b a.1.1)).measurable.comp + ((orthonormalMixedChart (o a.1.1)).measurable.comp + ((measurable_pi_apply a.1.2).comp + ((mixedArrayRegroup _ _ _).measurable.comp (measurable_pi_apply a.1.1))))) + +variable [CompactSpace (CoefficientTorus (K := K) U)] +variable [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + +theorem coefficientDeckChartEvent_measurableSet (q : ℕ) [NeZero q] + (event : CoefficientChartResidues K n E q → Prop) : + MeasurableSet {y | coefficientDeckChartEvent U bW b hb o q event y} := by + let T := CoefficientSamplerArrays (K := K) I n × CoefficientDeckResidues (K := K) E q + let chart : Set T := {z | (∀ a, |coefficientSamplerAmbientPoint U b o z.1 a| < 1/2) ∧ + event (coefficientSamplerChartResidues q z.1 z.2)} + have hsmall : MeasurableSet {z : T | ∀ a, + |coefficientSamplerAmbientPoint U b o z.1 a| < 1/2} := by + simp only [Set.ofPred_forall] + apply MeasurableSet.iInter + intro a + exact measurableSet_lt ((coefficientSamplerAmbientPoint_measurable U b o a).comp measurable_fst).abs + measurable_const + have hread : Measurable (fun z : T => coefficientSamplerChartResidues q z.1 z.2) := by + apply Measurable.of_eval + intro j + apply Measurable.of_eval + intro e + apply Measurable.of_eval + intro i + cases i with + | inl i => + exact (measurable_of_countable (fun v : ℤ => (v : ZMod q))).comp + ((measurable_pi_apply e).comp ((measurable_pi_apply i).comp + (measurable_snd.comp ((measurable_pi_apply j).comp measurable_fst)))) + | inr i => + exact (measurable_pi_apply i).comp ((measurable_pi_apply e).comp + ((measurable_pi_apply j).comp measurable_snd)) + have hchart : MeasurableSet chart := hsmall.inter + (hread (Set.toFinite {r | event r}).measurableSet) + have instS : StandardBorelSpace (CoefficientSamplerArrays (K := K) I n) := by infer_instance + have instR : StandardBorelSpace (CoefficientDeckResidues (K := K) E q) := by infer_instance + let : StandardBorelSpace T := @StandardBorelSpace.prod _ _ _ _ instS instR + have himage := hchart.image_of_measurable_injOn + (canonicalCoefficientDeckSample_measurable U bW b hb o q) + ((canonicalCoefficientDeckSample_injOn_smallAmbient U bW b hb o q (NeZero.pos q)).mono + (fun _ hz => hz.1)) + convert himage using 1 + ext y + constructor + · rintro ⟨x, r, hs, hy, he⟩ + exact ⟨(x,r), ⟨hs,he⟩, hy⟩ + · rintro ⟨⟨x,r⟩, ⟨hs,he⟩, hy⟩ + exact ⟨x,r,hs,hy,he⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule +open scoped Classical +variable {K : Type*} [Fintype K] {m : ℕ} {J I E : Fin m → Type*} +variable [∀ j, Fintype (J j)] [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +omit [Fintype K] in +theorem coefficientEventRead_chart_identity (q : ℕ) [NeZero q] + (sample : CoefficientSamplerArrays (K := K) I n) (y : CoefficientTorus (K := K) U) + (hbase : quotientIntegerCover (coefficientIntegerLattice U) q y = + canonicalCoefficientSample U b hb o sample) + (hsmall : ∀ a, |coefficientSamplerAmbientPoint U b o sample a| < 1/2) + (read : CoefficientChartResidues K n E q) + (hread : ∀ event : CoefficientChartResidues K n E q → Prop, + coefficientDeckChartEvent U bW b hb o q event y ↔ event read) : + canonicalCoefficientDeckSample U bW b hb o q (NeZero.pos q) sample + (fun j a i => read j a (.inr i)) = y := by + obtain ⟨r, hr, _⟩ := canonicalCoefficientDeckSample_existsUnique_residue + U bW b hb o q (NeZero.pos q) sample y hbase + have hevent := (hread (fun r => r = read)).mpr rfl + rw [← hr, coefficientDeckChartEvent_sample_iff U bW b hb o q _ sample hsmall r] at hevent + have he : r = (fun j a i => read j a (.inr i)) := by + funext j a i + exact congrFun (congrFun (congrFun hevent j) a) (.inr i) + simpa only [he] using hr + +variable {α : Type*} [Fintype α] [DecidableEq α] +variable {O : Fin m → Type*} + +theorem coefficientEventRead_jet_chart (root : K → ℤ) (D : Matrix α K ℤ) + (rows : ∀ j, O j → Finset α) (q : ℕ) [NeZero q] + (sample : CoefficientSamplerArrays (K := K) I n) (y : CoefficientTorus (K := K) U) + (hbase : quotientIntegerCover (coefficientIntegerLattice U) q y = + canonicalCoefficientSample U b hb o sample) + (hsmall : ∀ a, |coefficientSamplerAmbientPoint U b o sample a| < 1/2) + (read : CoefficientChartResidues K n E q) + (hread : ∀ event : CoefficientChartResidues K n E q → Prop, + coefficientDeckChartEvent U bW b hb o q event y ↔ event read) : + euclideanCoefficientJetMap U root D rows y = + coveredJetChart U b hb bW q (mixedCoveredJetCoordinates U o q + (canonicalCoefficientJetArrays root D rows sample, + coefficientDeckJetMap root D rows q (fun j a i => read j a (.inr i)))) := by + rw [← coefficientEventRead_chart_identity U bW b hb o q sample y hbase hsmall read hread] + exact canonicalCoefficientDeckSample_chart U o root D rows b hb bW q sample _ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule MeasureTheory BooleanCubeKernel +open scoped Classical + +variable {K X : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} +variable [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + +theorem affineCoefficientCoverSample_center_measurable {C : Type*} [MeasurableSpace C] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) + (c : C → ∀ j, U j) (hc : Measurable c) (a : X → ℤ) + (z : Option K × X → ℤ) (q : ℕ) : + Measurable (fun center => affineCoefficientCoverSample U + (fun j => translate (fun x => (a x : ℝ)) (subtractConstant (c center j).val (poly j))) + (fun j => coefficients_translate_mem (U j) (fun x => (a x : ℝ)) _ + (coefficients_subtractConstant_mem (U j) (c center j) (poly j) (hm j))) + q (fun k x => (z (k,x) : ℝ))) := by + have hcarray : Measurable (fun center => constantCoefficientArray (K := K) U + (fun s => c center s.1)) := by + apply Measurable.of_eval + intro s + by_cases hs : s.2.val = 0 + · simpa only [constantCoefficientArray, LinearMap.coe_mk, AddHom.coe_mk, hs, ite_true, Function.comp_def] using + (measurable_pi_apply s.1).comp hc + · simpa only [constantCoefficientArray, LinearMap.coe_mk, AddHom.coe_mk, hs, ite_false] using + (measurable_const : Measurable (fun _ : C => (0 : U s.1))) + have hcentered : Measurable (fun center => centeredAffineCoefficientArray U poly hm (c center) + (fun k x => (jointIntegerFrame (a,z) k x : ℝ))) := + measurable_const.sub hcarray + have hq := (show Continuous (QuotientAddGroup.mk' (coefficientIntegerLattice (K := K) U)) from + QuotientAddGroup.continuous_mk).measurable.comp (hcentered.const_smul (q : ℝ)⁻¹) + convert hq using 1 + funext center + apply congrArg (fun v : CoefficientArray (K := K) U => + QuotientAddGroup.mk' (coefficientIntegerLattice U) ((q : ℝ)⁻¹ • v)) + exact (affineSampleCoefficientArray_joint_frame U + (fun j => subtractConstant (c center j).val (poly j)) + (fun j => coefficients_subtractConstant_mem (U j) (c center j) (poly j) (hm j)) a z).trans + (affineSampleCoefficientArray_subtractConstant U poly hm (c center) _) + +variable {I E : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] {n : Fin m → ℕ} +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable [CompactSpace (CoefficientTorus (K := K) U)] + +theorem coefficientDeckChartEvent_center_measurableSet {C : Type*} [MeasurableSpace C] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ U j) + (c : C → ∀ j, U j) (hc : Measurable c) (a : X → ℤ) + (z : Option K × X → ℤ) (q : ℕ) [NeZero q] + (event : CoefficientChartResidues K n E q → Prop) : + MeasurableSet {center | coefficientDeckChartEvent U bW b hb o q event + (affineCoefficientCoverSample U + (fun j => translate (fun x => (a x : ℝ)) (subtractConstant (c center j).val (poly j))) + (fun j => coefficients_translate_mem (U j) (fun x => (a x : ℝ)) _ + (coefficients_subtractConstant_mem (U j) (c center j) (poly j) (hm j))) + q (fun k x => (z (k,x) : ℝ)))} := + (coefficientDeckChartEvent_measurableSet U bW b hb o q event).preimage + (affineCoefficientCoverSample_center_measurable U poly hm c hc a z q) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CenteredFiniteEventSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CenteredFiniteEventSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fcb12f7b8673e7ff5160712225973c38e6cb265 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CenteredFiniteEventSupport.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Probability.JointProductiveMeasure + +namespace OAI + +section + +namespace Erdos3 +open MeasureTheory +open scoped BigOperators Classical + +variable {C Ω : Type*} [MeasurableSpace C] [Fintype Ω] +variable [MeasurableSpace Ω] [MeasurableSingletonClass Ω] +variable (μ : Measure C) (law : C → FiniteProbabilityWeights Ω) +variable (hweight : ∀ x, Measurable (fun c => (law c).weight x)) + +theorem centeredFinite_event_measurableSet (event : Set (C × Ω)) + (hevent : ∀ x, MeasurableSet {c | (c,x) ∈ event}) : MeasurableSet event := by + have hm : Measurable (fun z : C × Ω => if z ∈ event then (1 : ℝ) else 0) := + measurable_from_prod_countable_left + (fun x => measurable_const.ite (hevent x) measurable_const) + have he : event = (fun z : C × Ω => if z ∈ event then (1 : ℝ) else 0) ⁻¹' {1} := by + ext z + by_cases hz : z ∈ event <;> simp [hz] + rw [he] + exact hm (measurableSet_singleton 1) + +include hweight in + +theorem centeredFiniteProbabilityMeasure_real_event_of_support [IsProbabilityMeasure μ] + (event test : Set (C × Ω)) (htest : MeasurableSet test) + (heq : ∀ c x, 0 < (law c).weight x → ((c,x) ∈ event ↔ (c,x) ∈ test)) : + (centeredFiniteProbabilityMeasure μ law).real event = + ∫ c, (law c).mean (fun x => if (c,x) ∈ event then 1 else 0) ∂μ := by + have hae : event =ᵐ[centeredFiniteProbabilityMeasure μ law] test := + (centeredFiniteProbabilityMeasure_ae_positive_weight μ law hweight).mono + (fun z hz => propext (heq z.1 z.2 hz)) + rw [measureReal_def, measure_congr hae, ← measureReal_def, + centeredFiniteProbabilityMeasure_real_event μ law hweight test htest] + apply integral_congr_ae + apply ae_of_all + intro c + unfold FiniteProbabilityWeights.mean + apply Finset.sum_congr rfl + intro x _ + by_cases hx : (law c).weight x = 0 + · simp only [hx, zero_mul] + · have hpos := lt_of_le_of_ne ((law c).nonneg x) (Ne.symm hx) + simp only [heq c x hpos] + +include hweight in + +theorem centeredFiniteProbabilityMeasure_real_event_le_of_support [IsProbabilityMeasure μ] + (event test : Set (C × Ω)) (htest : MeasurableSet test) + (heq : ∀ c x, 0 < (law c).weight x → ((c,x) ∈ event ↔ (c,x) ∈ test)) + {ε : ℝ} (hbound : ∀ c, (law c).mean (fun x => if (c,x) ∈ event then 1 else 0) ≤ ε) : + (centeredFiniteProbabilityMeasure μ law).real event ≤ ε := by + rw [centeredFiniteProbabilityMeasure_real_event_of_support μ law hweight event test htest heq] + calc + _ ≤ ∫ _ : C, ε ∂μ := by + apply integral_mono_of_nonneg + · exact ae_of_all μ (fun c => (law c).mean_nonneg (fun _ => by split_ifs <;> norm_num)) + · exact integrable_const ε + · exact ae_of_all μ hbound + _ = ε := by simp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CenteredFiniteSpatialModularGoodSet.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CenteredFiniteSpatialModularGoodSet.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbccc2ddf8b3c49cb4bf24750ab502fb1411d367 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CenteredFiniteSpatialModularGoodSet.lean @@ -0,0 +1,58 @@ +import OAI.Combinatorics.Progressions.Linear.SpatialMatrixBlockWideProbability + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped Classical + +theorem centeredFinite_spatial_modular_good_set + {C Ω G P : Type*} [MeasurableSpace C] [Fintype Ω] + [MeasurableSpace Ω] [MeasurableSingletonClass Ω] {n : ℕ} + (μ : Measure C) [IsProbabilityMeasure μ] + (law : C → FiniteProbabilityWeights Ω) + (hweight : ∀ x, Measurable (fun c => (law c).weight x)) + (noise : Ω → (Option (G ⊕ P) × Fin n → ℤ)) + (V : Option (G ⊕ P) × Fin n → ℝ) + (e : Fin 2 × Fin n ↪ G) (κ : ℝ) + (modularBad : Set (C × Ω)) (hmeas : MeasurableSet modularBad) + {εmod εsp : ℝ} + (hmodmass : (centeredFiniteProbabilityMeasure μ law).real modularBad ≤ εmod) + (hspmass : (centeredFiniteProbabilityMeasure μ law).real + {z | spatialMatrixBlockBad e V (κ / 2) (noise z.2)} ≤ εsp) + (charge : C × Ω → ℕ) (cutoff : ℕ) + (hmodular : ∀ c x, 0 < (law c).weight x → + ((c, x) ∈ modularBad ↔ cutoff < charge (c, x))) + (recovered : C × Ω → Prop) + (hae : ∀ᵐ z ∂centeredFiniteProbabilityMeasure μ law, recovered z) : + let bad := modularBad ∪ {z | spatialMatrixBlockBad e V (κ / 2) (noise z.2)} + MeasurableSet bad ∧ + (centeredFiniteProbabilityMeasure μ law).real bad ≤ εmod + εsp ∧ + ∀ᵐ z ∂centeredFiniteProbabilityMeasure μ law, + z ∉ bad → recovered z ∧ charge z ≤ cutoff ∧ + ∀ block : Fin 2, κ / 2 < |Matrix.det (fun i j : Fin n => + spatialMatrixNormalizedEntries e V (noise z.2) (block, j, i))| := by + have hspmeas : MeasurableSet + {z : C × Ω | spatialMatrixBlockBad e V (κ / 2) (noise z.2)} := + (Set.toFinite {x : Ω | spatialMatrixBlockBad e V (κ / 2) (noise x)}).measurableSet.preimage + measurable_snd + refine ⟨hmeas.union hspmeas, ?_, ?_⟩ + · exact (measureReal_union_le _ _).trans (add_le_add hmodmass hspmass) + · filter_upwards [centeredFiniteProbabilityMeasure_ae_positive_weight μ law hweight, hae] + with z hz hrec + intro hgood + have hmod : z ∉ modularBad := fun h => hgood (Or.inl h) + have hsp : ¬spatialMatrixBlockBad e V (κ / 2) (noise z.2) := + fun h => hgood (Or.inr h) + refine ⟨hrec, le_of_not_gt (fun h => hmod ((hmodular z.1 z.2 hz).mpr h)), ?_⟩ + intro block + exact lt_of_not_ge (fun h => hsp ⟨block, h⟩) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CentralOrbitMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CentralOrbitMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed666ba8f2a0a6b5b682bdf2bb978a761496b56f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CentralOrbitMetric.lean @@ -0,0 +1,58 @@ +import OAI.Combinatorics.Progressions.Fourier.LogCharacterBudget + +namespace OAI + +section + +namespace Erdos3.NilpotentLieBCHGroup + +open Module +open scoped NNReal ENNReal + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] [LieAlgebra ℝ L] + [IsScalarTower ℚ ℝ L] [TopologicalSpace L] [IsTopologicalAddGroup L] + [ContinuousSMul ℝ L] [T2Space L] + {s H : ℕ} {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + +theorem central_logCharacter_coset_dist_le (e : Basis ι ℝ L) (c : ι → ι → ι → ℚ) + (hstructure : ∀ i j k, algebraMap ℚ ℝ (c i j k) = e.repr ⁅e i, e j⁆ k) + (hc : ∀ i j k, RationalHeightLE (c i j k) H) + (Γ T : Subgroup (NilpotentLieBCHGroup L s hnil)) + (hΓ : IsClosed (Γ : Set (NilpotentLieBCHGroup L s hnil))) + (hT : ∀ z ∈ T, ∀ v : L, ⁅z.coord, v⁆ = 0) + (η : L →ₗ[ℝ] ℝ) (A : ℝ≥0) (hη : ∀ x, |η x| ≤ A * ‖e.equivFun x‖) + (hint : ∀ γ ∈ Γ, ∃ n : ℤ, η γ.coord = n) (x y : T) : + letI := quotientMetricSpace e Γ hΓ + dist (logCharacter η x.val) (logCharacter η y.val) ≤ + logCharacterMetricConstant s (Fintype.card ι) H A * + dist (QuotientGroup.mk x.val : _ ⧸ Γ) (QuotientGroup.mk y.val) := by + let := rightMetricSpace (hnil := hnil) e + let := rightMetricSpace_isIsometricSMul (hnil := hnil) e + let := quotientMetricSpace e Γ hΓ + let K := logCharacterMetricConstant s (Fintype.card ι) H A + have hdist (γ : Γ) : dist (logCharacter η x.val) (logCharacter η y.val) ≤ + K * dist x.val (y.val * γ.val) := by + rw [dist_eq_norm, logCharacter_norm_sub_eq_relative η x.val y.val γ.val + (hT x.val x.property) (hT y.val y.property) (logCharacter_of_integral η γ.val (hint γ.val γ.property))] + have h := logCharacter_dist_one_le e c hstructure hc η A hη (y.val * γ.val * x.val⁻¹) + have heq : dist (1 : NilpotentLieBCHGroup L s hnil) (y.val * γ.val * x.val⁻¹) = + dist x.val (y.val * γ.val) := by + simpa only [mul_inv_cancel] using dist_mul_right x.val (y.val * γ.val) x.val⁻¹ + exact h.trans_eq (congrArg (fun r : ℝ => (K : ℝ) * r) heq) + have he : edist (logCharacter η x.val) (logCharacter η y.val) ≤ + (K : ℝ≥0∞) * edist (QuotientGroup.mk x.val : _ ⧸ Γ) (QuotientGroup.mk y.val) := by + rw [quotientMetricSpace_edist_mk, ENNReal.mul_iInf (by simp)] + apply le_iInf + intro γ + simpa only [edist_dist, ENNReal.ofReal_mul K.coe_nonneg, ENNReal.ofReal_coe_nnreal] using + ENNReal.ofReal_le_ofReal (hdist γ) + have h := ENNReal.toReal_mono + (ENNReal.mul_ne_top ENNReal.coe_ne_top (edist_ne_top _ _)) he + simpa only [ENNReal.toReal_mul, ENNReal.coe_toReal, edist_dist, + ENNReal.toReal_ofReal dist_nonneg] using h + +end Erdos3.NilpotentLieBCHGroup + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ada621f50b2339cc9293a348fd5262c8d9e714c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeBounds.lean @@ -0,0 +1,913 @@ +import OAI.Combinatorics.Progressions.Dynamics.CeilingExponentialTreeBudget +import OAI.Combinatorics.Progressions.Estimates.FiniteClassifiedRepresentatives +import OAI.Combinatorics.Progressions.Estimates.FiniteGradedBranchPrefixLog +import OAI.Combinatorics.Progressions.Geometry.TerminalChartSlowEvaluation + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeQuotientPolynomial realSymbolGradeEvaluation restrictedMajorCorrection + fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (budget : ℝ) + +local notation "Point" => (X ⊕ (Σ j, J j) → ℝ) +local notation "VP" => VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) +local notation "Good" => FullChartAdmissibleStageCorrection F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget + +private theorem stage_branch_numeric {p budget : ℝ} {r a : ℕ} + (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) (hb : budget ≤ p) (ha : 254 ≤ a) : + (r : ℝ) * budget ≤ (p + a) ^ a ∧ budget ≤ (p + a) ^ a := by + have ha2 : (2 : ℝ) ≤ (a : ℝ) := by exact_mod_cast (show 2 ≤ a by omega) + have hbase : 1 ≤ p + a := by linarith + have hshift : p ≤ p + a := le_add_of_nonneg_right (Nat.cast_nonneg a) + have hpower : p ^ 2 ≤ (p + a) ^ a := + (pow_le_pow_left₀ hp hshift 2).trans (pow_le_pow_right₀ hbase (by omega)) + have hprod : (r : ℝ) * budget ≤ p * p := + (mul_le_mul_of_nonneg_left hb (Nat.cast_nonneg r)).trans + (mul_le_mul_of_nonneg_right hr hp) + refine ⟨hprod.trans (by simpa only [pow_two] using hpower), ?_⟩ + exact hb.trans (hshift.trans (by simpa only [pow_one] using + (pow_le_pow_right₀ hbase (show 1 ≤ a by omega)))) + +private theorem exists_full_chart_optional_stage_branch + (q : ℕ) (K' : Set Point) (p : ℝ) (blocks a : ℕ) (ha : 254 ≤ a) + (hcert : RationalTaggedConstraintCertificate J Set.univ K' p blocks) + (hp : 0 ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) (hblocks : (blocks : ℝ) ≤ p) + (hretained : ∀ point, (∀ j, (fun i => point (Sum.inr ⟨j, i⟩)) ∈ Utag j) → point ∈ K₀) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) (hq : 0 < q) + (hqcap : (q : ℝ) ≤ Real.exp ((p + a) ^ a)) (hbudget : budget ≤ (p + a) ^ a) : + ∃ c : ℕ, (c : ℝ) ≤ Real.exp + ((p + fullChartStageCountConstant k a) ^ fullChartStageCountConstant k a) ∧ + ∃ candidate : Fin c → VP × VP, (∀ j, Good q K' (candidate j)) ∧ + ∀ pair, Good q K' pair → ∃ j, ∀ t ∈ K', + eval₂ t (candidate j).1 = eval₂ t pair.1 ∧ + eval₂ t (candidate j).2 = eval₂ t pair.2 ∧ + eval₂ t (realChartSubstitute chart (candidate j).1) = + eval₂ t (realChartSubstitute chart pair.1) := by + by_cases hex : ∃ pair, Good q K' pair + · obtain ⟨pair, hpair⟩ := hex + have hret : ∀ point, (∀ j, (fun z => point (Sum.inr ⟨j, z⟩)) ∈ Utag j) → + point ∈ K' := by + unfold FullChartAdmissibleStageCorrection at hpair + rcases hpair with ⟨_, _, _, _, _, _, _, _, hretain, _⟩ + intro point hpoint + exact hretain point (hretained point hpoint) hpoint + exact exists_full_chart_finite_stage_representatives F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget q K' p blocks a ha hcert hp hX hJ hη hblocks + hret hpoly hN hq hqcap hbudget + · refine ⟨0, by simpa using Real.exp_nonneg _, Fin.elim0, ?_, ?_⟩ + · intro j; exact Fin.elim0 j + · intro pair hpair; exact (hex ⟨pair, hpair⟩).elim + +theorem exists_full_chart_finite_stage_branches + {past p : ℝ} {blocks : ℕ} + (a : ℕ) (ha : 254 ≤ a) + (hprevious : RationalTaggedConstraintCertificate J Set.univ K₀ past blocks) + (hp : 0 ≤ p) (hpast : past ≤ p) (hbudget : budget ≤ p) + (hX : (Fintype.card X : ℝ) ≤ p) (hm : (m : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) + (hblocks : ((blocks + Fintype.card η * m : ℕ) : ℝ) ≤ p) + (hretained : ∀ point, (∀ j, (fun i => point (Sum.inr ⟨j, i⟩)) ∈ Utag j) → point ∈ K₀) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + ∃ count : ℕ, (count : ℝ) ≤ Real.exp + ((Fintype.card η : ℝ) * budget + (p + 8) ^ 8 + + (p + fullChartStageCountConstant k a) ^ fullChartStageCountConstant k a) ∧ + ∃ candidate : Fin count → (ℕ × Set Point) × (VP × VP), + (∀ i, Good (candidate i).1.1 (candidate i).1.2 (candidate i).2) ∧ + ∀ q K' pair, Good q K' pair → ∃ i, + (candidate i).1 = (q, K') ∧ ∀ t ∈ K', + eval₂ t (candidate i).2.1 = eval₂ t pair.1 ∧ + eval₂ t (candidate i).2.2 = eval₂ t pair.2 ∧ + eval₂ t (realChartSubstitute chart (candidate i).2.1) = + eval₂ t (realChartSubstitute chart pair.1) := by + obtain ⟨n, hn, branches, hbranches, hcover⟩ := + exists_fullChart_admissible_stage_branches F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget hprevious hp hpast hbudget hm hJ hblocks + let validLabel := fun (l : ℕ × Set Point) (pair : VP × VP) => Good l.1 l.2 pair + let relLabel := fun (l : ℕ × Set Point) (pair pair' : VP × VP) => ∀ t ∈ l.2, + eval₂ t pair.1 = eval₂ t pair'.1 ∧ eval₂ t pair.2 = eval₂ t pair'.2 ∧ + eval₂ t (realChartSubstitute chart pair.1) = eval₂ t (realChartSubstitute chart pair'.1) + let valid := fun i => validLabel (branches i) + let rel := fun i => relLabel (branches i) + have hnum := stage_branch_numeric hp hη hbudget ha + have hbranch : ∀ i : Fin n, ∃ c : ℕ, + (c : ℝ) ≤ Real.exp ((p + fullChartStageCountConstant k a) ^ fullChartStageCountConstant k a) ∧ + ∃ candidate : Fin c → VP × VP, (∀ j, valid i (candidate j)) ∧ + ∀ pair, valid i pair → ∃ j, rel i (candidate j) pair := by + intro i + dsimp only [valid, rel, validLabel, relLabel] + exact exists_full_chart_optional_stage_branch F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget (branches i).1 (branches i).2 + p (blocks + Fintype.card η * m) a ha (hbranches i).2.2 hp hX hJ hη hblocks + hretained hpoly hN (hbranches i).1 + (((Nat.cast_le.mpr (hbranches i).2.1).trans (Nat.floor_le (Real.exp_nonneg _))).trans + (Real.exp_le_exp.mpr hnum.1)) hnum.2 + obtain ⟨count, hcount, candidate, hvalid, hcomplete⟩ := + exists_finite_classified_representatives branches validLabel relLabel + (fun l pair => hcover l.1 l.2 pair) hbranch + refine ⟨count, ?_, candidate, hvalid, fun q K' pair => hcomplete (q, K') pair⟩ + exact (hcount.trans (mul_le_mul_of_nonneg_right hn (Real.exp_nonneg _))).trans_eq + (Real.exp_add _ _).symm + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def finiteStageTreeLogBound (depth : ℕ) (Cstage : ℕ → ℕ) (p : ℝ) : ℝ := + p ^ 2 + (p + 8) ^ 8 + + ∑ n ∈ Finset.range depth, (p + Cstage (n + 1)) ^ Cstage (n + 1) + +theorem finiteStageTreeLogBound_nonneg (depth : ℕ) (Cstage : ℕ → ℕ) + {p : ℝ} (hp : 0 ≤ p) : 0 ≤ finiteStageTreeLogBound depth Cstage p := by + unfold finiteStageTreeLogBound + exact add_nonneg (add_nonneg (sq_nonneg _) (by positivity)) + (Finset.sum_nonneg (fun _ _ => pow_nonneg (by positivity) _)) + +theorem finiteStageTree_stage_log_le (depth : ℕ) (Cstage : ℕ → ℕ) + {p budget : ℝ} {r n : ℕ} (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) + (hbudget : budget ≤ p) (hn : n < depth) : + (r : ℝ) * budget + (p + 8) ^ 8 + + (p + Cstage (n + 1)) ^ Cstage (n + 1) ≤ + finiteStageTreeLogBound depth Cstage p := by + have hprod : (r : ℝ) * budget ≤ p ^ 2 := by + simpa only [pow_two] using + (mul_le_mul_of_nonneg_left hbudget (Nat.cast_nonneg r)).trans + (mul_le_mul_of_nonneg_right hr hp) + have hterm : (p + Cstage (n + 1)) ^ Cstage (n + 1) ≤ + ∑ j ∈ Finset.range depth, (p + Cstage (j + 1)) ^ Cstage (j + 1) := + Finset.single_le_sum (f := fun j => (p + Cstage (j + 1)) ^ Cstage (j + 1)) + (fun _ _ => pow_nonneg (by positivity) _) (Finset.mem_range.mpr hn) + exact add_le_add (add_le_add hprod le_rfl) hterm + +theorem exists_finite_stage_tree_budget (depth : ℕ) (Cstage : ℕ → ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → + finiteStageTreeLogBound depth Cstage p ≤ (p + C) ^ C ∧ + ((((depth + 1) * (max 1 ⌈Real.exp (finiteStageTreeLogBound depth Cstage p)⌉₊) ^ depth : ℕ) : ℝ)) ≤ + Real.exp ((p + C) ^ C) := by + let X : Polynomial ℕ := Polynomial.X + let P := X ^ 2 + (X + 8) ^ 8 + + ∑ n ∈ Finset.range depth, + (X + Polynomial.C (Cstage (n + 1))) ^ Cstage (n + 1) + let Q := P + Polynomial.C (depth + 1) + Polynomial.C depth * (P + 1) + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget Q + refine ⟨C, hC, ?_⟩ + intro p hp + let b := finiteStageTreeLogBound depth Cstage p + have hb : 0 ≤ b := finiteStageTreeLogBound_nonneg depth Cstage hp + have hsum : b + ((depth : ℝ) + 1) + (depth : ℝ) * (b + 1) ≤ (p + C) ^ C := by + simpa [Q, P, X, b, finiteStageTreeLogBound, Polynomial.eval₂_pow, Polynomial.eval₂_finsetSum] using hbudget p hp + have hrest : 0 ≤ ((depth : ℝ) + 1) + (depth : ℝ) * (b + 1) := by positivity + refine ⟨by dsimp only [b] at *; linarith, ?_⟩ + exact (ceiling_exp_tree_vertices_le depth hb).trans + (Real.exp_le_exp.mpr (by linarith)) + +namespace NilpotentLieFiltration + +noncomputable def fullChartFiniteTreeLogBound (depth : ℕ) (p : ℝ) : ℝ := + finiteStageTreeLogBound depth (fun k => fullChartStageCountConstant k 254) p + +noncomputable def fullChartFiniteTreeBranching (depth : ℕ) (p : ℝ) : ℕ := + ⌈Real.exp (fullChartFiniteTreeLogBound depth p)⌉₊ + +theorem fullChartFiniteTree_branch_count_le (depth : ℕ) + {p budget : ℝ} {r n count : ℕ} + (hp : 0 ≤ p) (hr : (r : ℝ) ≤ p) (hbudget : budget ≤ p) (hn : n < depth) + (hcount : (count : ℝ) ≤ Real.exp + ((r : ℝ) * budget + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254)) : + count ≤ fullChartFiniteTreeBranching depth p := by + apply ceil_exp_branch_count + exact hcount.trans (Real.exp_le_exp.mpr + (finiteStageTree_stage_log_le depth (fun k => fullChartStageCountConstant k 254) + hp hr hbudget hn)) + +theorem exists_fullChartFiniteTree_budget (depth : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → + fullChartFiniteTreeLogBound depth p ≤ (p + C) ^ C ∧ + ((((depth + 1) * (max 1 (fullChartFiniteTreeBranching depth p)) ^ depth : ℕ) : ℝ)) ≤ + Real.exp ((p + C) ^ C) := + exists_finite_stage_tree_budget depth (fun k => fullChartStageCountConstant k 254) + +end NilpotentLieFiltration + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (Bphase : ℝ) + +local notation "Point" => (X ⊕ (Σ j, J j) → ℝ) +local notation "VP" => VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +def AdmissibleChild {n : ℕ} (H : State n) (Hnext : State (n + 1)) : Prop := + FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N Bphase (Hnext.q n) Hnext.K + (Hnext.slow n, Hnext.rat n) ∧ + ∀ j < n, Hnext.slow j = H.slow j ∧ Hnext.rat j = H.rat j ∧ Hnext.q j = H.q j + +def RepresentsCorrection {n : ℕ} (Hnext : State (n + 1)) (q : ℕ) + (K' : Set Point) (pair : VP × VP) : Prop := + Hnext.q n = q ∧ Hnext.K = K' ∧ ∀ t ∈ K', + eval₂ t (Hnext.slow n) = eval₂ t pair.1 ∧ + eval₂ t (Hnext.rat n) = eval₂ t pair.2 ∧ + eval₂ t (realChartSubstitute chart (Hnext.slow n)) = + eval₂ t (realChartSubstitute chart pair.1) + +variable {F b ω hF J fast basis lift Z Utag poly N Bphase} + +omit [Fintype X] in +theorem append_admissible_is_child {n : ℕ} (H : State n) (q : ℕ) + (K' : Set Point) (pair : VP × VP) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N Bphase q K' pair) : + AdmissibleChild F b ω hF J fast basis lift Z Utag poly N Bphase H + (H.append_admissible Bphase le_rfl q K' pair hpair) := by + refine ⟨?_, fun j hj => append_admissible_prefix H Bphase le_rfl q K' pair hpair j hj⟩ + rw [append_admissible_K, (append_admissible_entry H Bphase le_rfl q K' pair hpair).1, + (append_admissible_entry H Bphase le_rfl q K' pair hpair).2.1, + (append_admissible_entry H Bphase le_rfl q K' pair hpair).2.2] + exact hpair + +theorem exists_finite_children {n : ℕ} (H : State n) + {p : ℝ} (hp : 0 ≤ p) (hbudget : Bphase ≤ p) + (hX : (Fintype.card X : ℝ) ≤ p) (hm : (m : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) + (hblocks : (((n + 1) * (Fintype.card η * m) : ℕ) : ℝ) ≤ p) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + ∃ children : Finset (State (n + 1)), + (children.card : ℝ) ≤ Real.exp + ((Fintype.card η : ℝ) * Bphase + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254) ∧ + (∀ Hnext ∈ children, AdmissibleChild F b ω hF J fast basis lift Z + Utag poly N Bphase H Hnext) ∧ + ∀ q K' pair, FullChartAdmissibleStageCorrection F b ω hF J (n + 1) + fast basis lift Z H.outer.1 H.outer.2 H.K Utag poly N Bphase q K' pair → + ∃ Hnext ∈ children, RepresentsCorrection F b ω hF J fast basis lift Z + Utag poly N Bphase Hnext q K' pair := by + obtain ⟨count, hcount, candidate, hgood, hcover⟩ := + exists_full_chart_finite_stage_branches F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N Bphase 254 (by omega) + H.certificate hp hbudget hbudget hX hm hJ hη + (by simpa only [Nat.succ_mul] using hblocks) + (fun point hpoint => H.retained point (Set.mem_univ _) hpoint) hpoly hN + let next (i : Fin count) : State (n + 1) := + H.append_admissible Bphase le_rfl (candidate i).1.1 (candidate i).1.2 + (candidate i).2 (hgood i) + refine ⟨Finset.univ.image next, ?_, ?_, ?_⟩ + · exact (Nat.cast_le.mpr ((Finset.card_image_le).trans_eq + (Finset.card_fin count))).trans hcount + · intro Hnext hmem + obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hmem + exact append_admissible_is_child H _ _ _ (hgood i) + · intro q K' pair hpair + obtain ⟨i, hlabel, heval⟩ := hcover q K' pair hpair + refine ⟨next i, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩, ?_⟩ + have hentry := append_admissible_entry H Bphase le_rfl + (candidate i).1.1 (candidate i).1.2 (candidate i).2 (hgood i) + refine ⟨hentry.2.2.trans (congrArg Prod.fst hlabel), ?_, ?_⟩ + · exact (append_admissible_K H Bphase le_rfl _ _ _ (hgood i)).trans + (congrArg Prod.snd hlabel) + · intro t ht + change eval₂ t ((next i).slow n) = _ ∧ _ + dsimp only [next] + rw [hentry.1, hentry.2.1] + with_reducible exact heval t ht + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (Bphase : ℝ) + +local notation "Point" => (X ⊕ (Σ j, J j) → ℝ) +local notation "VP" => VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +structure FiniteBranchTree (depth : ℕ) (p : ℝ) where + children : ∀ n, State n → Finset (State (n + 1)) + card : ∀ n, n < depth → ∀ H, (children n H).card ≤ + ⌈Real.exp ((Fintype.card η : ℝ) * Bphase + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254)⌉₊ + admissible : ∀ n, n < depth → ∀ H Hnext, Hnext ∈ children n H → + AdmissibleChild F b ω hF J fast basis lift Z Utag poly N Bphase H Hnext + complete : ∀ n, n < depth → ∀ H q K' pair, + FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N Bphase q K' pair → + ∃ Hnext ∈ children n H, RepresentsCorrection F b ω hF J fast basis lift Z + Utag poly N Bphase Hnext q K' pair + +variable {F b ω hF J fast basis lift Z Utag poly N Bphase} + +theorem exists_finite_branch_tree (depth : ℕ) + {p : ℝ} (hp : 0 ≤ p) (hbudget : Bphase ≤ p) + (hX : (Fintype.card X : ℝ) ≤ p) (hm : (m : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) + (hblocks : ((depth * (Fintype.card η * m) : ℕ) : ℝ) ≤ p) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + Nonempty (FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) := by + have hstage (n : ℕ) (hn : n < depth) (H : State n) := + exists_finite_children H hp hbudget hX hm hJ hη + ((Nat.cast_le.mpr (Nat.mul_le_mul_right (Fintype.card η * m) + (Nat.succ_le_of_lt hn))).trans hblocks) hpoly hN + let children : ∀ n, State n → Finset (State (n + 1)) := fun n H => + if hn : n < depth then Classical.choose (hstage n hn H) else ∅ + refine ⟨{ children := children, card := ?_, admissible := ?_, complete := ?_ }⟩ + · intro n hn H + dsimp only [children] + rw [dite_eq_left hn] + exact_mod_cast (Classical.choose_spec (hstage n hn H)).1.trans (Nat.le_ceil _) + · intro n hn H Hnext hmem + have hm' : Hnext ∈ Classical.choose (hstage n hn H) := by + simpa only [children, dite_eq_left hn] using hmem + exact (Classical.choose_spec (hstage n hn H)).2.1 Hnext hm' + · intro n hn H q K' pair hpair + obtain ⟨Hnext, hmem, hrep⟩ := (Classical.choose_spec (hstage n hn H)).2.2 q K' pair hpair + exact ⟨Hnext, by simpa only [children, dite_eq_left hn] using hmem, hrep⟩ + +variable (F b ω hF J fast basis lift Z Utag poly N Bphase) + +noncomputable def univInitialHistory : State 0 := + initial F b ω hF J fast basis lift Z Set.univ Utag poly N Bphase + (fun _ _ _ => Set.mem_univ _) + +variable {F b ω hF J fast basis lift Z Utag poly N Bphase} +variable {depth : ℕ} {p : ℝ} + +noncomputable def FiniteBranchTree.level + (T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) + (n : ℕ) : Finset (State n) := + finiteGradedBranchLevel (univInitialHistory F b ω hF J fast basis lift Z Utag poly N Bphase) + T.children n + +noncomputable def FiniteBranchTree.vertices + (T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) : + Finset (Σ n : Fin (depth + 1), State n.val) := + finiteGradedBranchVertices (univInitialHistory F b ω hF J fast basis lift Z Utag poly N Bphase) + T.children depth + +noncomputable def fullChartTreeBranchCap (depth : ℕ) (dim : ℕ) (Bphase p : ℝ) : ℕ := + (Finset.range depth).sup (fun n => + ⌈Real.exp ((dim : ℝ) * Bphase + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254)⌉₊) + +omit [Fintype X] in +theorem FiniteBranchTree.card_children_le + (T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) + (n : ℕ) (hn : n < depth) (H : State n) : + (T.children n H).card ≤ fullChartTreeBranchCap depth (Fintype.card η) Bphase p := +by + apply (T.card n hn H).trans + exact Finset.le_sup (f := fun n => ⌈Real.exp ((Fintype.card η : ℝ) * Bphase + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254)⌉₊) (Finset.mem_range.mpr hn) + +omit [Fintype X] in +theorem FiniteBranchTree.card_level_le + (T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) + (n : ℕ) (hn : n ≤ depth) : + (T.level n).card ≤ (fullChartTreeBranchCap depth (Fintype.card η) Bphase p) ^ n := + finiteGradedBranchLevel_card_le_pow _ T.children depth _ + (fun n hn H _ => T.card_children_le n hn H) n hn + +omit [Fintype X] in +theorem FiniteBranchTree.card_vertices_le + (T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) : + T.vertices.card ≤ (depth + 1) * + (max 1 (fullChartTreeBranchCap depth (Fintype.card η) Bphase p)) ^ depth := + finiteGradedBranchVertices_card_le _ T.children depth _ + (fun n hn H _ => T.card_children_le n hn H) + +omit [Fintype X] in + +theorem FiniteBranchTree.exists_representative_child + (T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) + {n : ℕ} (hn : n < depth) {H : State n} (hH : H ∈ T.level n) + (q : ℕ) (K' : Set Point) (pair : VP × VP) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N Bphase q K' pair) : + ∃ Hnext ∈ T.level (n + 1), + AdmissibleChild F b ω hF J fast basis lift Z Utag poly N Bphase H Hnext ∧ + RepresentsCorrection F b ω hF J fast basis lift Z Utag poly N Bphase Hnext q K' pair := by + obtain ⟨Hnext, hmem, hrep⟩ := T.complete n hn H q K' pair hpair + exact ⟨Hnext, finiteGradedBranchLevel_child_mem _ T.children hH hmem, + T.admissible n hn H Hnext hmem, hrep⟩ + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (Bphase : ℝ) + +local notation "Point" => (X ⊕ (Σ j, J j) → ℝ) +local notation "VP" => VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +def AdmissibleChildAt (budget : ℝ) {n : ℕ} (H : State n) (Hnext : State (n + 1)) : Prop := + FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget (Hnext.q n) Hnext.K + (Hnext.slow n, Hnext.rat n) ∧ + ∀ j < n, Hnext.slow j = H.slow j ∧ Hnext.rat j = H.rat j ∧ Hnext.q j = H.q j + +variable {F b ω hF J fast basis lift Z Utag poly N Bphase} + +omit [Fintype X] in +theorem append_admissible_is_child_at {n : ℕ} (H : State n) + (budget : ℝ) (hcap : budget ≤ Bphase) (q : ℕ) + (K' : Set Point) (pair : VP × VP) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) : + AdmissibleChildAt F b ω hF J fast basis lift Z Utag poly N Bphase budget H + (H.append_admissible budget hcap q K' pair hpair) := by + refine ⟨?_, fun j hj => append_admissible_prefix H budget hcap q K' pair hpair j hj⟩ + rw [append_admissible_K, (append_admissible_entry H budget hcap q K' pair hpair).1, + (append_admissible_entry H budget hcap q K' pair hpair).2.1, + (append_admissible_entry H budget hcap q K' pair hpair).2.2] + exact hpair + +theorem exists_finite_children_at_budget {n : ℕ} (H : State n) + (budget : ℝ) (hcap : budget ≤ Bphase) + {p : ℝ} (hp : 0 ≤ p) (hpast : Bphase ≤ p) (hbudget : budget ≤ p) + (hX : (Fintype.card X : ℝ) ≤ p) (hm : (m : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) + (hblocks : (((n + 1) * (Fintype.card η * m) : ℕ) : ℝ) ≤ p) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + ∃ children : Finset (State (n + 1)), + (children.card : ℝ) ≤ Real.exp + ((Fintype.card η : ℝ) * budget + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254) ∧ + (∀ Hnext ∈ children, AdmissibleChildAt F b ω hF J fast basis lift Z + Utag poly N Bphase budget H Hnext) ∧ + ∀ q K' pair, FullChartAdmissibleStageCorrection F b ω hF J (n + 1) + fast basis lift Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair → + ∃ Hnext ∈ children, RepresentsCorrection F b ω hF J fast basis lift Z + Utag poly N Bphase Hnext q K' pair := by + obtain ⟨count, hcount, candidate, hgood, hcover⟩ := + exists_full_chart_finite_stage_branches F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget 254 (by omega) + H.certificate hp hpast hbudget hX hm hJ hη + (by simpa only [Nat.succ_mul] using hblocks) + (fun point hpoint => H.retained point (Set.mem_univ _) hpoint) hpoly hN + let next (i : Fin count) : State (n + 1) := + H.append_admissible budget hcap (candidate i).1.1 (candidate i).1.2 + (candidate i).2 (hgood i) + refine ⟨Finset.univ.image next, ?_, ?_, ?_⟩ + · exact (Nat.cast_le.mpr ((Finset.card_image_le).trans_eq + (Finset.card_fin count))).trans hcount + · intro Hnext hmem + obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hmem + exact append_admissible_is_child_at H budget hcap _ _ _ (hgood i) + · intro q K' pair hpair + obtain ⟨i, hlabel, heval⟩ := hcover q K' pair hpair + refine ⟨next i, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩, ?_⟩ + have hentry := append_admissible_entry H budget hcap + (candidate i).1.1 (candidate i).1.2 (candidate i).2 (hgood i) + refine ⟨hentry.2.2.trans (congrArg Prod.fst hlabel), ?_, ?_⟩ + · exact (append_admissible_K H budget hcap _ _ _ (hgood i)).trans + (congrArg Prod.snd hlabel) + · intro t ht + change eval₂ t ((next i).slow n) = _ ∧ _ + dsimp only [next] + rw [hentry.1, hentry.2.1] + with_reducible exact heval t ht + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (Bphase : ℝ) + +local notation "Point" => (X ⊕ (Σ j, J j) → ℝ) +local notation "VP" => VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +noncomputable def fullChartTreeExponent (depth : ℕ) : ℕ := + Classical.choose (exists_fullChartFiniteTree_budget depth) + +theorem fullChartTreeExponent_ge_two (depth : ℕ) : 2 ≤ fullChartTreeExponent depth := + (Classical.choose_spec (exists_fullChartFiniteTree_budget depth)).1 + +variable {F b ω hF J fast basis lift Z Utag poly N Bphase} +variable {depth : ℕ} {p : ℝ} + +omit [Fintype X] in +theorem FiniteBranchTree.card_children_le_uniform + (T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) + (hp : 0 ≤ p) (hη : (Fintype.card η : ℝ) ≤ p) (hbudget : Bphase ≤ p) + (n : ℕ) (hn : n < depth) (H : State n) : + (T.children n H).card ≤ fullChartFiniteTreeBranching depth p := by + apply (T.card n hn H).trans + apply Nat.ceil_mono + exact Real.exp_le_exp.mpr (finiteStageTree_stage_log_le depth + (fun k => fullChartStageCountConstant k 254) hp hη hbudget hn) + +omit [Fintype X] in +theorem FiniteBranchTree.card_vertices_le_exp + (T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p) + (hp : 0 ≤ p) (hη : (Fintype.card η : ℝ) ≤ p) (hbudget : Bphase ≤ p) : + (T.vertices.card : ℝ) ≤ Real.exp ((p + fullChartTreeExponent depth) ^ fullChartTreeExponent depth) := by + have hcard := finiteGradedBranchVertices_card_le + (univInitialHistory F b ω hF J fast basis lift Z Utag poly N Bphase) + T.children depth (fullChartFiniteTreeBranching depth p) + (fun n hn H _ => T.card_children_le_uniform hp hη hbudget n hn H) + exact (Nat.cast_le.mpr hcard).trans + ((Classical.choose_spec (exists_fullChartFiniteTree_budget depth)).2 p hp).2 + +theorem exists_bounded_finite_branch_tree (depth : ℕ) + {p : ℝ} (hp : 0 ≤ p) (hbudget : Bphase ≤ p) + (hX : (Fintype.card X : ℝ) ≤ p) (hm : (m : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) + (hblocks : ((depth * (Fintype.card η * m) : ℕ) : ℝ) ≤ p) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + ∃ T : FiniteBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase depth p, + (T.vertices.card : ℝ) ≤ + Real.exp ((p + fullChartTreeExponent depth) ^ fullChartTreeExponent depth) := by + obtain ⟨T⟩ := exists_finite_branch_tree (F := F) (b := b) (ω := ω) (hF := hF) + (J := J) (fast := fast) (basis := basis) (lift := lift) (Z := Z) + depth hp hbudget hX hm hJ hη hblocks hpoly hN + exact ⟨T, T.card_vertices_le_exp hp hη hbudget⟩ + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer + +theorem exists_reached_child_of_major_correlation_witness (m n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded), + BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast → + (∀ y, fast.mkQ (lift y) = y) → + ∀ (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (Bphase pTree pPhase Rrank : ℝ) (depth : ℕ) + (T : FiniteBranchTree F b ω hF J fast basis lift Z U poly N Bphase depth pTree) + (H : CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ U poly N Bphase n), + n < depth → H ∈ T.level n → (pPhase + C) ^ C ≤ Bphase → + Nonempty (FullChartMajorCorrelationWitness F b ω hF J (n + 1) fast basis + Z H.outer.1 H.outer.2 N poly U pPhase Rrank C) → + ∃ (q : ℕ) (K : Set ((X ⊕ (Σ j, J j)) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))), + FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K U poly N ((pPhase + C) ^ C) q K pair ∧ + ∃ Hnext ∈ T.level (n + 1), + AdmissibleChild F b ω hF J fast basis lift Z U poly N Bphase H Hnext ∧ + RepresentsCorrection F b ω hF J fast basis lift Z U poly N Bphase Hnext q K pair := by + obtain ⟨C, hC, hsource⟩ := + exists_certified_full_chart_decomposition_of_major_correlation_witness m (n + 1) (by omega) + refine ⟨C, hC, ?_⟩ + intro X L ι η _ _ _ _ _ s F b ω hF J _ fast basis lift hfast hsection + Z U poly N Bphase pTree pPhase Rrank depth T H hn hH hbudget hcorrelation + have hlower : ∀ t ∈ H.K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (H.outer.1⁻¹ * Z * H.outer.2⁻¹).coord ∈ fast.baseChange ℝ := by + intro t ht j hj + exact H.invariant_outer t ht j (by omega) + have hdecomposition := hsource F b ω hF J fast basis lift hfast hsection + Z H.outer.1 H.outer.2 H.K H.dilation hlower N poly U pPhase Rrank hcorrelation + obtain ⟨q, K, pair, hpair⟩ := + CertifiedFullChartDetectedDecomposition.exists_admissible_stage + F b ω hF J (n + 1) fast basis lift Z H.outer.1 H.outer.2 H.K U poly N + ((pPhase + C) ^ C) hdecomposition + refine ⟨q, K, pair, hpair, ?_⟩ + have hpairB := FullChartAdmissibleStageCorrection.mono_budget hpair hbudget + exact T.exists_representative_child hn hH q K pair hpairB + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (Bphase : ℝ) + +local notation "Point" => (X ⊕ (Σ j, J j) → ℝ) +local notation "VP" => VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +variable (stageBudget : ℕ → ℝ) + +structure BudgetedBranchTree (depth : ℕ) (p : ℝ) where + children : ∀ n, State n → Finset (State (n + 1)) + card : ∀ n, n < depth → ∀ H, (children n H).card ≤ + ⌈Real.exp ((Fintype.card η : ℝ) * stageBudget n + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254)⌉₊ + admissible : ∀ n, n < depth → ∀ H Hnext, Hnext ∈ children n H → + AdmissibleChildAt F b ω hF J fast basis lift Z Utag poly N Bphase (stageBudget n) H Hnext + complete : ∀ n, n < depth → ∀ H q K' pair, + FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N (stageBudget n) q K' pair → + ∃ Hnext ∈ children n H, RepresentsCorrection F b ω hF J fast basis lift Z + Utag poly N Bphase Hnext q K' pair + +variable {F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget} + +theorem exists_budgeted_branch_tree (depth : ℕ) + (hcaps : ∀ n, n < depth → stageBudget n ≤ Bphase) + {p : ℝ} (hp : 0 ≤ p) (hbudget : Bphase ≤ p) + (hX : (Fintype.card X : ℝ) ≤ p) (hm : (m : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) + (hblocks : ((depth * (Fintype.card η * m) : ℕ) : ℝ) ≤ p) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + Nonempty (BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p) := by + have hstage (n : ℕ) (hn : n < depth) (H : State n) := + exists_finite_children_at_budget H (stageBudget n) (hcaps n hn) hp hbudget + ((hcaps n hn).trans hbudget) hX hm hJ hη + ((Nat.cast_le.mpr (Nat.mul_le_mul_right (Fintype.card η * m) + (Nat.succ_le_of_lt hn))).trans hblocks) hpoly hN + let children : ∀ n, State n → Finset (State (n + 1)) := fun n H => + if hn : n < depth then Classical.choose (hstage n hn H) else ∅ + refine ⟨{ children := children, card := ?_, admissible := ?_, complete := ?_ }⟩ + · intro n hn H + dsimp only [children] + rw [dite_eq_left hn] + exact_mod_cast (Classical.choose_spec (hstage n hn H)).1.trans (Nat.le_ceil _) + · intro n hn H Hnext hmem + have hm' : Hnext ∈ Classical.choose (hstage n hn H) := by + simpa only [children, dite_eq_left hn] using hmem + exact (Classical.choose_spec (hstage n hn H)).2.1 Hnext hm' + · intro n hn H q K' pair hpair + obtain ⟨Hnext, hmem, hrep⟩ := (Classical.choose_spec (hstage n hn H)).2.2 q K' pair hpair + exact ⟨Hnext, by simpa only [children, dite_eq_left hn] using hmem, hrep⟩ + +variable {depth : ℕ} {p : ℝ} + +noncomputable def BudgetedBranchTree.level + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p) + (n : ℕ) : Finset (State n) := + finiteGradedBranchLevel (univInitialHistory F b ω hF J fast basis lift Z Utag poly N Bphase) + T.children n + +noncomputable def BudgetedBranchTree.vertices + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p) : + Finset (Σ n : Fin (depth + 1), State n.val) := + finiteGradedBranchVertices (univInitialHistory F b ω hF J fast basis lift Z Utag poly N Bphase) + T.children depth + +omit [Fintype X] in + +theorem BudgetedBranchTree.exists_representative_child + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p) + {n : ℕ} (hn : n < depth) {H : State n} (hH : H ∈ T.level n) + (q : ℕ) (K' : Set Point) (pair : VP × VP) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N (stageBudget n) q K' pair) : + ∃ Hnext ∈ T.level (n + 1), + AdmissibleChildAt F b ω hF J fast basis lift Z Utag poly N Bphase (stageBudget n) H Hnext ∧ + RepresentsCorrection F b ω hF J fast basis lift Z Utag poly N Bphase Hnext q K' pair := by + obtain ⟨Hnext, hmem, hrep⟩ := T.complete n hn H q K' pair hpair + exact ⟨Hnext, finiteGradedBranchLevel_child_mem _ T.children hH hmem, + T.admissible n hn H Hnext hmem, hrep⟩ + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (Bphase : ℝ) + +local notation "Point" => (X ⊕ (Σ j, J j) → ℝ) +local notation "VP" => VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +variable {F b ω hF J fast basis lift Z Utag poly N Bphase} +variable {stageBudget cumulative : ℕ → ℝ} {depth : ℕ} {p : ℝ} + +omit [Fintype X] in + +theorem BudgetedBranchTree.stage_bounds + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p) + (hmono : ∀ n < depth, cumulative n ≤ cumulative (n + 1)) + (hcap : ∀ n < depth, stageBudget n ≤ cumulative (n + 1)) : + ∀ n, n ≤ depth → ∀ H ∈ T.level n, StageBounds stageBudget cumulative H := by + apply finiteGradedBranchLevel_all_valid + (univInitialHistory F b ω hF J fast basis lift Z Utag poly N Bphase) + T.children depth (fun _ H => StageBounds stageBudget cumulative H) + · unfold univInitialHistory + exact StageBounds.initial stageBudget cumulative (fun _ _ _ => Set.mem_univ _) + · intro n hn H _ hH Hnext hnext + have hadmissible := T.admissible n hn H Hnext hnext + exact hH.of_admissible_child Hnext hadmissible.2 hadmissible.1 + (hmono n hn) (hcap n hn) + +omit [Fintype X] in + +theorem BudgetedBranchTree.exists_reached_smaller_budget + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p) + (hmono : ∀ n < depth, cumulative n ≤ cumulative (n + 1)) + (hcap : ∀ n < depth, stageBudget n ≤ cumulative (n + 1)) + {n : ℕ} (hn : n ≤ depth) {H : State n} (hH : H ∈ T.level n) + (hprefix : ∀ j < n, stageBudget j ≤ cumulative n) : + ∃ Hsmall : CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N (cumulative n) n, + Hsmall.K = H.K ∧ + outer F b ω hF J fast basis lift Z Set.univ Utag poly N (cumulative n) Hsmall = H.outer := by + have hbounds := T.stage_bounds hmono hcap n hn H hH + exact ⟨hbounds.to_budget hprefix, hbounds.to_budget_K hprefix, hbounds.to_budget_outer hprefix⟩ + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..6241f78f955b7b1299af6179d38bb92b6ec7ddb4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeBudget.lean @@ -0,0 +1,84 @@ +import OAI.Combinatorics.Progressions.Geometry.CertifiedFullChartBudgetedTreeBounds + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (Bphase : ℝ) + +local notation "Point" => (X ⊕ (Σ j, J j) → ℝ) +local notation "VP" => VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +variable {F b ω hF J fast basis lift Z Utag poly N Bphase} +variable {stageBudget : ℕ → ℝ} +variable {depth : ℕ} {p : ℝ} + +omit [Fintype X] in +theorem BudgetedBranchTree.card_children_le_uniform + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p) + (hp : 0 ≤ p) (hη : (Fintype.card η : ℝ) ≤ p) + (hcaps : ∀ n, n < depth → stageBudget n ≤ p) + (n : ℕ) (hn : n < depth) (H : State n) : + (T.children n H).card ≤ fullChartFiniteTreeBranching depth p := by + apply (T.card n hn H).trans + apply Nat.ceil_mono + exact Real.exp_le_exp.mpr (finiteStageTree_stage_log_le depth + (fun k => fullChartStageCountConstant k 254) hp hη (hcaps n hn) hn) + +omit [Fintype X] in +theorem BudgetedBranchTree.card_vertices_le_exp + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p) + (hp : 0 ≤ p) (hη : (Fintype.card η : ℝ) ≤ p) + (hcaps : ∀ n, n < depth → stageBudget n ≤ p) : + (T.vertices.card : ℝ) ≤ Real.exp ((p + fullChartTreeExponent depth) ^ fullChartTreeExponent depth) := by + have hcard := finiteGradedBranchVertices_card_le + (univInitialHistory F b ω hF J fast basis lift Z Utag poly N Bphase) + T.children depth (fullChartFiniteTreeBranching depth p) + (fun n hn H _ => T.card_children_le_uniform hp hη hcaps n hn H) + exact (Nat.cast_le.mpr hcard).trans + ((Classical.choose_spec (exists_fullChartFiniteTree_budget depth)).2 p hp).2 + +theorem exists_bounded_budgeted_branch_tree (depth : ℕ) + (hcaps : ∀ n, n < depth → stageBudget n ≤ Bphase) + {p : ℝ} (hp : 0 ≤ p) (hbudget : Bphase ≤ p) + (hX : (Fintype.card X : ℝ) ≤ p) (hm : (m : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) + (hblocks : ((depth * (Fintype.card η * m) : ℕ) : ℝ) ≤ p) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + ∃ T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase stageBudget depth p, + (T.vertices.card : ℝ) ≤ + Real.exp ((p + fullChartTreeExponent depth) ^ fullChartTreeExponent depth) := by + obtain ⟨T⟩ := exists_budgeted_branch_tree (F := F) (b := b) (ω := ω) (hF := hF) + (J := J) (fast := fast) (basis := basis) (lift := lift) (Z := Z) + depth hcaps hp hbudget hX hm hJ hη hblocks hpoly hN + exact ⟨T, T.card_vertices_le_exp hp hη (fun n hn => (hcaps n hn).trans hbudget)⟩ + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeTerminal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..67b025301bc0809d2a687c8eb702db42907e1502 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartBudgetedTreeTerminal.lean @@ -0,0 +1,183 @@ +import OAI.Combinatorics.Progressions.Geometry.CertifiedFullChartBudgetedTreeBounds + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer + +theorem exists_budgeted_reached_child_of_major_correlation_witness (m n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded), + BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast → + (∀ y, fast.mkQ (lift y) = y) → + ∀ (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (Bphase pTree pPhase Rrank : ℝ) (stageBudget : ℕ → ℝ) (depth : ℕ) + (T : BudgetedBranchTree F b ω hF J fast basis lift Z U poly N Bphase stageBudget depth pTree) + (H : CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ U poly N Bphase n), + n < depth → H ∈ T.level n → (pPhase + C) ^ C ≤ stageBudget n → + Nonempty (FullChartMajorCorrelationWitness F b ω hF J (n + 1) fast basis + Z H.outer.1 H.outer.2 N poly U pPhase Rrank C) → + ∃ (q : ℕ) (K : Set ((X ⊕ (Σ j, J j)) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))), + FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K U poly N ((pPhase + C) ^ C) q K pair ∧ + ∃ Hnext ∈ T.level (n + 1), + AdmissibleChildAt F b ω hF J fast basis lift Z U poly N Bphase (stageBudget n) H Hnext ∧ + RepresentsCorrection F b ω hF J fast basis lift Z U poly N Bphase Hnext q K pair := by + obtain ⟨C, hC, hsource⟩ := + exists_certified_full_chart_decomposition_of_major_correlation_witness m (n + 1) (by omega) + refine ⟨C, hC, ?_⟩ + intro X L ι η _ _ _ _ _ s F b ω hF J _ fast basis lift hfast hsection + Z U poly N Bphase pTree pPhase Rrank stageBudget depth T H hn hH hbudget hcorrelation + have hlower : ∀ t ∈ H.K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (H.outer.1⁻¹ * Z * H.outer.2⁻¹).coord ∈ fast.baseChange ℝ := by + intro t ht j hj + exact H.invariant_outer t ht j (by omega) + have hdecomposition := hsource F b ω hF J fast basis lift hfast hsection + Z H.outer.1 H.outer.2 H.K H.dilation hlower N poly U pPhase Rrank hcorrelation + obtain ⟨q, K, pair, hpair⟩ := + CertifiedFullChartDetectedDecomposition.exists_admissible_stage + F b ω hF J (n + 1) fast basis lift Z H.outer.1 H.outer.2 H.K U poly N + ((pPhase + C) ^ C) hdecomposition + refine ⟨q, K, pair, hpair, ?_⟩ + have hpairB := FullChartAdmissibleStageCorrection.mono_budget hpair hbudget + exact T.exists_representative_child hn hH q K pair hpairB + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection + CertifiedFullChartFiniteHistory.outer + +theorem exists_certified_budgeted_tree_terminal_constants (s m a : ℕ) : + ∃ Ccontrol : ℕ, 2 ≤ Ccontrol ∧ ∃ Cphase : ℕ → ℕ, + (∀ n, 2 ≤ Cphase n) ∧ + ∀ {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype ι] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded), + BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast → + (∀ y, fast.mkQ (lift y) = y) → + ∀ (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (Bphase B pTree Rrank : ℝ) (H qS : ℕ) + (cap cumulative pControl pPhase : ℕ → ℝ) + (T : CertifiedFullChartFiniteHistory.BudgetedBranchTree F b ω hF J fast basis lift + Z Utag poly N Bphase cap s pTree), + 1 ≤ H → 0 < qS → + (∀ n ≤ s, 0 ≤ pControl n) → + (∀ n ≤ s, 0 ≤ cumulative n) → + (∀ n < s, cumulative n ≤ cumulative (n + 1)) → + (∀ n < s, cap n ≤ cumulative (n + 1)) → + (∀ n ≤ s, ∀ j < n, cap j ≤ cumulative n) → + (∀ n < s, (pPhase n + Cphase n) ^ Cphase n ≤ cap n) → + (∀ n ≤ s, (Fintype.card ι : ℝ) ≤ pControl n) → + (∀ n ≤ s, (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ pControl n) → + (∀ n ≤ s, (H : ℝ) ≤ Real.exp (pControl n)) → + (∀ i j z, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr + ⁅F.associatedGradedBasis b ω hF i, F.associatedGradedBasis b ω hF j⁆ z) H) → + (∀ n ≤ s, (qS : ℝ) * Real.exp ((s : ℝ) * (Fintype.card η : ℝ) * cumulative n) ≤ + Real.exp (pControl n)) → + (∀ n ≤ s, (Fintype.card η : ℝ) * B * Real.exp (cumulative n) ≤ + Real.exp ((pControl n + 2) ^ a)) → + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ (basis j)) i| ≤ B) → + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ (basis j)) i) ∈ realDenominatorGrid qS) → + (∀ n, n ≤ s → ∀ history ∈ T.level n, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl n + Ccontrol) ^ Ccontrol)) ∧ + ((∀ n, n < s → ∀ history ∈ T.level n, + Nonempty (FullChartMajorCorrelationWitness F b ω hF J (n + 1) fast basis + Z history.outer.1 history.outer.2 N poly Utag (pPhase n) Rrank (Cphase n))) → + ∃ history ∈ T.level s, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl s + Ccontrol) ^ Ccontrol) ∧ + RationalTaggedConstraintCertificate J Set.univ history.K (cumulative s) + (s * (Fintype.card η * m)) ∧ + ∀ point ∈ history.K, + eval₂ point (F.realGradedSymbolPolynomial b ω hF (fullTaggedVariableWeight J) + (history.outer.1⁻¹ * Z * history.outer.2⁻¹).coord) ∈ fast.baseChange ℝ) := by + obtain ⟨Ccontrol, hCcontrol, hcontrol⟩ := exists_certified_full_chart_history_control s a + let Cphase : ℕ → ℕ := fun n => Classical.choose + (CertifiedFullChartFiniteHistory.exists_budgeted_reached_child_of_major_correlation_witness m n) + have hphase (n : ℕ) := Classical.choose_spec + (CertifiedFullChartFiniteHistory.exists_budgeted_reached_child_of_major_correlation_witness m n) + refine ⟨Ccontrol, hCcontrol, Cphase, fun n => (hphase n).1, ?_⟩ + intro X L ι η _ _ _ _ _ _ F b ω hF J _ fast basis lift hfast hsection + Z Utag poly N Bphase B pTree Rrank H qS cap cumulative pControl pPhase T hH hqS + hp hcumulative hmono hcap hprefix hdetect hι hσ hHp hstructure hden hcost hentry hgrid + have hbounds := T.stage_bounds hmono hcap + have hcontrolled (n : ℕ) (hn : n ≤ s) + (history : CertifiedFullChartFiniteHistory F b ω hF J fast basis lift + Z Set.univ Utag poly N Bphase n) (hmem : history ∈ T.level n) : + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl n + Ccontrol) ^ Ccontrol) := by + let hsmall := (hbounds n hn history hmem).to_budget (hprefix n hn) + have hactual := hcontrol F b ω hF J fast basis lift Z Set.univ Utag poly N + (cumulative n) B (pControl n) H qS n hH (hp n hn) (hcumulative n hn) hqS hn + (hι n hn) (hσ n hn) (hHp n hn) hstructure (hden n hn) (hcost n hn) + hentry hgrid hsmall + dsimp only [hsmall] at hactual + rw [(hbounds n hn history hmem).to_budget_outer (hprefix n hn)] at hactual + exact hactual + refine ⟨hcontrolled, ?_⟩ + intro hsource + have hreached : ∀ n, n ≤ s → (T.level n).Nonempty := by + intro n + induction n with + | zero => + intro _ + exact ⟨CertifiedFullChartFiniteHistory.univInitialHistory F b ω hF J fast basis lift + Z Utag poly N Bphase, by + change _ ∈ finiteGradedBranchLevel _ _ 0 + exact (finiteGradedBranchLevel_mem_zero _ _ _).mpr rfl⟩ + | succ n ih => + intro hn + have hns : n < s := Nat.lt_of_succ_le hn + obtain ⟨history, hmem⟩ := ih (Nat.le_of_succ_le hn) + have hcorr := hsource n hns history hmem + obtain ⟨q, K, pair, _, next, hnext, _, _⟩ := (hphase n).2 + F b ω hF J fast basis lift hfast hsection Z Utag poly N Bphase pTree + (pPhase n) Rrank cap s T history hns hmem (hdetect n hns) hcorr + exact ⟨next, hnext⟩ + obtain ⟨history, hmem⟩ := hreached s le_rfl + exact ⟨history, hmem, hcontrolled s le_rfl history hmem, + (hbounds s le_rfl history hmem).certificate, history.terminal_mem_fast hfast⟩ + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartDecompositionSource.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartDecompositionSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..6cbaad12f9c3581b4b4d7e0e254a2b356b55c911 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartDecompositionSource.lean @@ -0,0 +1,691 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCandidateCommonFastGeometry +import OAI.Combinatorics.Progressions.Estimates.FullRestrictedGradeMajorMatching +import OAI.Combinatorics.Progressions.Geometry.FullChartHomogeneousCorrection + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct NNReal BigOperators + +def FullChartMajorCorrelation + {m : ℕ} {X L M ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] {s t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (D : RationalFilteredNilmanifold M t e) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (p Rrank : ℝ) (C : ℕ) : Prop := + ∃ (periodCap coverCap : ℝ) (Lip : ℝ≥0) + (W : η → NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (R : η → D.Niltest (fun _ : X => 1)) + (Ψ : PatchKernel (Fintype.card (LowTaggedIndex J k))) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (β : (X → ℤ) → Fin (Fintype.card (LowTaggedIndex J k)) → ℤ), + (∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) ∧ + (∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) ∧ + (∀ u ∈ integerBox N, ∀ i, + |MvPolynomial.eval (fun x => (u x : ℝ)) (lowTaggedPolynomial J k poly i) - + c i - (β u i : ℝ)| ≤ 1 / 2) ∧ + 0 ≤ p ∧ (∀ j, (R j).ComplexityLE p) ∧ + (∀ j, ((R j).normBound : ℝ) ≤ 1) ∧ + ((Fintype.card X + Fintype.card (Σ j, J j) : ℕ) : ℝ) ≤ p ∧ + (∀ j, ((W j).modulus : ℝ) ≤ Real.exp p) ∧ + (∀ j, ((W j).cover : ℝ) ≤ Real.exp p) ∧ + (Lip : ℝ) ≤ Real.exp p ∧ (Ψ.lip : ℝ) ≤ Real.exp p ∧ + (∀ i, Real.exp ((p + C) ^ C) ≤ (N i : ℝ)) ∧ + Real.exp ((p + C) ^ C) ≤ Rrank ∧ + (∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) ∧ + (∀ j, Real.exp (-p) ≤ ‖𝔼 u ∈ integerBox N, + (W j).eval N poly u * majorPhaseSample J k poly Ψ c + (coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k (left⁻¹ * Z * right⁻¹).coord))) β (R j).eval u‖) + +theorem exists_full_chart_grade_correction_of_major_correlation + (m k : ℕ) (hk : 0 < k) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L M ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] {s t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (_hsection : ∀ y, fast.mkQ (lift y) = y) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K₀) + (_hlower : ∀ t ∈ K₀, ∀ j < k, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + (D : RationalFilteredNilmanifold M t e) (_htk : t < k) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (p Rrank : ℝ), + FullChartMajorCorrelation F b ω hF J k fast basis Z left right D N poly U p Rrank C → + FullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ U poly N ((p + C) ^ C) := by + obtain ⟨C, hC, hmatching⟩ := exists_full_restricted_grade_major_matching m k hk + refine ⟨C, hC, ?_⟩ + intro X L M ι η _ _ _ _ _ _ _ s t e _ _ _ _ F b ω hF J _ fast basis lift hfast hsection + Z left right K₀ hK₀ hlower D htk N poly U p Rrank hcorrelation + obtain ⟨periodCap, coverCap, Lip, W, R, Ψ, c, β, hpoly, hcoeff, hβ, + hp, hR, hRcap, hdim, hmod, hcover, hLip, hΨ, hN, hRrank, hrank, hcorr⟩ := hcorrelation + have hdetected := hmatching F b ω hF J fast basis lift hfast hsection + Z left right K₀ hK₀ hlower W D htk R N poly hpoly U hcoeff Ψ c β hβ + p Rrank hp hR hRcap hdim hmod hcover hLip hΨ hN hRrank hrank hcorr + have hchart := fullChartDetectedMajorGradeConclusion_of_fullTagged F b ω hF J k fast + basis lift Z left right K₀ U poly c N ((p + C) ^ C) hdetected + exact fullChartGradeCorrectionData_of_detected F b ω hF J k fast basis lift + Z left right K₀ U poly N ((p + C) ^ C) c hK₀ hchart + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +def FullChartControlledFactors + {m : ℕ} {X L ι : Type} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (budget : ℝ) : Prop := + ∃ q : ℕ, 0 < q ∧ (q : ℝ) ≤ Real.exp budget ∧ + ∃ Echart : PolynomialGroup (X ⊕ (Σ j, J j)) + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot, + F.realGradedSymbolPolynomialHom b ω hF (fullTaggedVariableWeight (X := X) J) left = + realPolynomialChartSubstitution + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly)) Echart ∧ + CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) (fun _ => 1) + (Real.exp budget) Echart.coord ∧ + CoefficientGrid ((F.associatedGradedBasis b ω hF).baseChange ℝ) q + (F.realGradedSymbolPolynomialHom b ω hF + (fullTaggedVariableWeight (X := X) J) right).coord + +theorem FullChartControlledFactors.mono + {m : ℕ} {X L ι : Type} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + {budget budget' : ℝ} (h : FullChartControlledFactors F b ω hF J poly N left right budget) + (hle : budget ≤ budget') : + FullChartControlledFactors F b ω hF J poly N left right budget' := by + obtain ⟨q, hq, hqB, Echart, hchart, hslow, hgrid⟩ := h + refine ⟨q, hq, hqB.trans (Real.exp_le_exp.mpr hle), Echart, hchart, ?_, hgrid⟩ + exact CoefficientBound.mono _ _ (fun _ => zero_lt_one) hslow (Real.exp_le_exp.mpr hle) + +def FullChartControlledCorrelationSource + {m : ℕ} {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + {M : ℕ → Type} [∀ n, LieRing (M n)] [∀ n, LieAlgebra ℚ (M n)] {edim : ℕ → ℕ} + [∀ n, TopologicalSpace (ℝ ⊗[ℚ] M n)] + [∀ n, IsTopologicalAddGroup (ℝ ⊗[ℚ] M n)] + [∀ n, ContinuousSMul ℝ (ℝ ⊗[ℚ] M n)] [∀ n, T2Space (ℝ ⊗[ℚ] M n)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (D : ∀ n, RationalFilteredNilmanifold (M n) n (edim n)) + (pPhase Rrank : ℝ) (Cphase : ℕ → ℕ) (controlBudget : ℝ) : Prop := + ∀ n < s, + ∀ (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K : Set (X ⊕ (Σ j, J j) → ℝ)), + K ⊆ Kinitial → + (∀ t ∈ K, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K) → + (∀ t ∈ Kinitial, (∀ j, (fun i => t (Sum.inr ⟨j, i⟩)) ∈ Utag j) → t ∈ K) → + (∀ t ∈ K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) → + FullChartControlledFactors F b ω hF J poly N left right controlBudget → + FullChartMajorCorrelation F b ω hF J (n + 1) fast basis Z left right + (D n) N poly Utag pPhase Rrank (Cphase n) + +def FullChartControlledCorrelationSourceStages + {m : ℕ} {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + {M : ℕ → Type} [∀ n, LieRing (M n)] [∀ n, LieAlgebra ℚ (M n)] {edim : ℕ → ℕ} + [∀ n, TopologicalSpace (ℝ ⊗[ℚ] M n)] + [∀ n, IsTopologicalAddGroup (ℝ ⊗[ℚ] M n)] + [∀ n, ContinuousSMul ℝ (ℝ ⊗[ℚ] M n)] [∀ n, T2Space (ℝ ⊗[ℚ] M n)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (D : ∀ n, RationalFilteredNilmanifold (M n) n (edim n)) + (pPhase : ℕ → ℝ) (Rrank : ℝ) (Cphase : ℕ → ℕ) (controlBudget : ℕ → ℝ) : Prop := + ∀ n < s, + ∀ (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K : Set (X ⊕ (Σ j, J j) → ℝ)), + K ⊆ Kinitial → + (∀ t ∈ K, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K) → + (∀ t ∈ Kinitial, (∀ j, (fun i => t (Sum.inr ⟨j, i⟩)) ∈ Utag j) → t ∈ K) → + (∀ t ∈ K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) → + FullChartControlledFactors F b ω hF J poly N left right (controlBudget n) → + FullChartMajorCorrelation F b ω hF J (n + 1) fast basis Z left right + (D n) N poly Utag (pPhase n) Rrank (Cphase n) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +theorem exists_bounded_full_chart_major_iteration (m s a : ℕ) : + ∃ (Cphase : ℕ → ℕ) (Ccontrol : ℕ), (∀ n, 2 ≤ Cphase n) ∧ 2 ≤ Ccontrol ∧ + ∀ {X L ι Γ : Type} [Fintype X] [DecidableEq X] [Fintype ι] [Fintype Γ] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) (v : Γ → F.AssociatedGraded) + (_hspan : Submodule.span ℚ (Set.range v) = fast) + (H : ℕ) (_hHpos : 1 ≤ H) + (_hv : ∀ i j, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr (v j) i) H) + (p₀ : ℝ) (_hp₀ : 0 ≤ p₀) + (_hrows : (Fintype.card ι : ℝ) ≤ p₀) (_hcols : (Fintype.card Γ : ℝ) ≤ p₀) + (_hH : (H : ℝ) ≤ Real.exp p₀) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast), + ∃ d : ℕ, d ≤ Fintype.card ι ∧ + ∃ (eQ : Basis (Fin d) ℚ (F.AssociatedGraded ⧸ fast)) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) (qS : ℕ), + Function.RightInverse lift fast.mkQ ∧ + Function.RightInverse (lift.baseChange ℝ) (fast.mkQ.baseChange ℝ) ∧ + 0 < qS ∧ (qS : ℝ) ≤ Real.exp ((p₀ + 2) ^ 47) ∧ + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i| ≤ Real.exp ((p₀ + 2) ^ 45)) ∧ + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i) ∈ realDenominatorGrid qS) ∧ + (∀ j i, RationalHeightLE (((eQ.coord j).comp fast.mkQ) + (F.associatedGradedBasis b ω hF i)) ⌈Real.exp ((p₀ + 2) ^ 7)⌉₊) ∧ + ∀ {M : ℕ → Type} [∀ n, LieRing (M n)] [∀ n, LieAlgebra ℚ (M n)] + [∀ n, TopologicalSpace (ℝ ⊗[ℚ] M n)] [∀ n, IsTopologicalAddGroup (ℝ ⊗[ℚ] M n)] + [∀ n, ContinuousSMul ℝ (ℝ ⊗[ℚ] M n)] [∀ n, T2Space (ℝ ⊗[ℚ] M n)] + (edim : ℕ → ℕ) (D : ∀ n, RationalFilteredNilmanifold (M n) n (edim n)) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hKinitial : ∀ t ∈ Kinitial, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ Kinitial) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (pPhase Bpast : ℕ → ℝ) (Rrank : ℝ) (_hBpast : ∀ n ≤ s, 0 ≤ Bpast n) + (_hBmono : Monotone Bpast) + (_hphaseBudget : ∀ n < s, (pPhase n + Cphase n) ^ Cphase n ≤ Bpast (n + 1)) + (Hcontrol : ℕ) (pControl : ℕ → ℝ), + 1 ≤ Hcontrol → (∀ n ≤ s, 0 ≤ pControl n) → + (∀ n ≤ s, (Fintype.card ι : ℝ) ≤ pControl n) → + (∀ n ≤ s, (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ pControl n) → + (∀ n ≤ s, (Hcontrol : ℝ) ≤ Real.exp (pControl n)) → + (∀ i j z, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr + ⁅F.associatedGradedBasis b ω hF i, F.associatedGradedBasis b ω hF j⁆ z) Hcontrol) → + (∀ n ≤ s, Real.exp ((p₀ + 2) ^ 47) * Real.exp ((s : ℝ) * d * Bpast n) ≤ + Real.exp (pControl n)) → + (∀ n ≤ s, (d : ℝ) * Real.exp ((p₀ + 2) ^ 45) * Real.exp (Bpast n) ≤ + Real.exp ((pControl n + 2) ^ a)) → + FullChartControlledCorrelationSourceStages F b ω hF J fast (eQ.baseChange ℝ) Z + Kinitial Utag poly N D pPhase Rrank Cphase (fun n => (pControl n + Ccontrol) ^ Ccontrol) → + ∃ history : FullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast s) s, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl s + Ccontrol) ^ Ccontrol) ∧ + ∀ t ∈ history.K, + eval₂ t (F.realGradedSymbolPolynomial b ω hF (fullTaggedVariableWeight J) + (history.outer.1⁻¹ * Z * history.outer.2⁻¹).coord) ∈ fast.baseChange ℝ := by + classical + choose Cphase hCphase hstep using + (fun n : ℕ => exists_full_chart_grade_correction_of_major_correlation + m (n + 1) (Nat.zero_lt_succ n)) + obtain ⟨Ccontrol, hCcontrol, hprefix⟩ := exists_restricted_chart_prefix_control s a + refine ⟨Cphase, Ccontrol, hCphase, hCcontrol, ?_⟩ + intro X L ι Γ _ _ _ _ _ _ F b ω hF J _ fast v hspan H hHpos hv + p₀ hp₀ hrows hcols hH hfast + obtain ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord⟩ := + exists_bounded_submodule_quotient_section_with_coordinates (F.associatedGradedBasis b ω hF) + fast v hspan hHpos hv hp₀ hrows hcols hH + refine ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord, ?_⟩ + intro M _ _ _ _ _ _ edim D Z Kinitial hKinitial Utag poly N pPhase Bpast Rrank + hBpast hBmono hphaseBudget Hcontrol pControl hHcontrol hpControl hι hσ hHexp hstructure + hdenbudget hcost hsource + have hcontrol : ∀ n ≤ s, + ∀ history : FullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast n) n, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl n + Ccontrol) ^ Ccontrol) := by + intro n hn history + have hdenbudget' : (qS : ℝ) * + Real.exp ((s : ℝ) * (Fintype.card (Fin d) : ℝ) * Bpast n) ≤ Real.exp (pControl n) := by + simpa only [Fintype.card_fin] using + (mul_le_mul_of_nonneg_right hqSB (Real.exp_nonneg _)).trans (hdenbudget n hn) + have hcost' : (Fintype.card (Fin d) : ℝ) * Real.exp ((p₀ + 2) ^ 45) * + Real.exp (Bpast n) ≤ Real.exp ((pControl n + 2) ^ a) := by + simpa only [Fintype.card_fin] using hcost n hn + obtain ⟨q, hq, hqB, _hdiv, Echart, hE, hEbound, hRgrid⟩ := + hprefix F b ω hF (fullTaggedVariableWeight J) (fullTaggedVariableWeight_pos J) + Hcontrol (pControl n) hHcontrol (hpControl n hn) (hι n hn) (hσ n hn) (hHexp n hn) hstructure + fast lift (eQ.baseChange ℝ) (Real.exp ((p₀ + 2) ^ 45)) (Bpast n) qS (hBpast n hn) hqS + hdenbudget' hcost' hentry hgrid + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) (fullTaggedMajorTopCoordinates J poly)) + (fullTaggedMajorChart_homogeneous J poly (fun i => (N i : ℝ))) + history.slow history.rat history.q n hn history.q_pos history.q_bound + history.slow_bound history.rat_grid + unfold FullChartControlledFactors FullChartFiniteHistory.outer + with_reducible exact ⟨q, hq, hqB, Echart, hE, hEbound, hRgrid⟩ + have hexists : ∀ n ≤ s, + Nonempty (FullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast n) n) := by + intro n + induction n with + | zero => + intro _ + exact ⟨FullChartFiniteHistory.initial F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast 0) hKinitial⟩ + | succ n ih => + intro hn + obtain ⟨history⟩ := ih (by omega) + have hlower : ∀ t ∈ history.K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (history.outer.1⁻¹ * Z * history.outer.2⁻¹).coord ∈ fast.baseChange ℝ := by + intro t ht j hj + with_reducible exact history.invariant_outer t ht j (by omega) + have hcorr := hsource n (by omega) history.outer.1 history.outer.2 history.K + history.subset history.dilation history.retained hlower (hcontrol n (by omega) history) + have hdata := hstep n F b ω hF J fast (eQ.baseChange ℝ) lift hfast hsection + Z history.outer.1 history.outer.2 history.K history.dilation hlower + (D n) (Nat.lt_succ_self n) N poly Utag (pPhase n) Rrank hcorr + let larger := history.mono_bound (hBmono (Nat.le_succ n)) + have hdata' : FullChartGradeCorrectionData F b ω hF J (n + 1) fast + (eQ.baseChange ℝ) lift Z larger.outer.1 larger.outer.2 larger.K Utag poly N + ((pPhase n + Cphase n) ^ Cphase n) := by + simpa only [larger, FullChartFiniteHistory.outer_mono_bound, + FullChartFiniteHistory.mono_bound_K] using hdata + obtain ⟨next, _⟩ := larger.exists_step ((pPhase n + Cphase n) ^ Cphase n) + (hphaseBudget n (by omega)) hdata' + exact ⟨next⟩ + obtain ⟨history⟩ := hexists s le_rfl + refine ⟨history, hcontrol s le_rfl history, ?_⟩ + intro t ht + apply (F.restricted_symbol_grade_terminal b ω hF (fullTaggedVariableWeight J) + fast hfast _ t).mpr + with_reducible exact history.invariant_outer t ht + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct + +structure FullChartMajorCorrelationWitness + {m : ℕ} {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (p Rrank : ℝ) (C : ℕ) where + L : Type + [lie : LieRing L] + [algebra : LieAlgebra ℚ L] + step : ℕ + dim : ℕ + [topology : TopologicalSpace (ℝ ⊗[ℚ] L)] + [topologicalAdd : IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [continuousSMul : ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] + [hausdorff : T2Space (ℝ ⊗[ℚ] L)] + model : RationalFilteredNilmanifold L step dim + lower : step < k + correlation : FullChartMajorCorrelation F b ω hF J k fast basis + Z left right model N poly U p Rrank C + +attribute [local instance] FullChartMajorCorrelationWitness.lie + FullChartMajorCorrelationWitness.algebra FullChartMajorCorrelationWitness.topology + FullChartMajorCorrelationWitness.topologicalAdd FullChartMajorCorrelationWitness.continuousSMul + FullChartMajorCorrelationWitness.hausdorff + +theorem exists_full_chart_grade_correction_of_major_correlation_witness + (m k : ℕ) (hk : 0 < k) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (_hsection : ∀ y, fast.mkQ (lift y) = y) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K₀) + (_hlower : ∀ t ∈ K₀, ∀ j < k, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (p Rrank : ℝ), + Nonempty (FullChartMajorCorrelationWitness F b ω hF J k fast basis + Z left right N poly U p Rrank C) → + FullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ U poly N ((p + C) ^ C) := by + obtain ⟨C, hC, hstep⟩ := exists_full_chart_grade_correction_of_major_correlation m k hk + refine ⟨C, hC, ?_⟩ + intro X L ι η _ _ _ _ _ s F b ω hF J _ fast basis lift hfast hsection + Z left right K₀ hK₀ hlower N poly U p Rrank hwitness + obtain ⟨witness⟩ := hwitness + exact hstep F b ω hF J fast basis lift hfast hsection Z left right K₀ hK₀ hlower + witness.model witness.lower N poly U p Rrank witness.correlation + +def BundledFullChartControlledCorrelationSourceStages + {m : ℕ} {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (pPhase : ℕ → ℝ) (Rrank : ℝ) (Cphase : ℕ → ℕ) (controlBudget : ℕ → ℝ) : Prop := + ∀ n < s, + ∀ (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K : Set (X ⊕ (Σ j, J j) → ℝ)), + K ⊆ Kinitial → + (∀ t ∈ K, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K) → + (∀ t ∈ Kinitial, (∀ j, (fun i => t (Sum.inr ⟨j, i⟩)) ∈ Utag j) → t ∈ K) → + (∀ t ∈ K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) → + FullChartControlledFactors F b ω hF J poly N left right (controlBudget n) → + Nonempty (FullChartMajorCorrelationWitness F b ω hF J (n + 1) fast basis + Z left right N poly Utag (pPhase n) Rrank (Cphase n)) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +theorem exists_bounded_bundled_full_chart_major_iteration (m s a : ℕ) : + ∃ (Cphase : ℕ → ℕ) (Ccontrol : ℕ), (∀ n, 2 ≤ Cphase n) ∧ 2 ≤ Ccontrol ∧ + ∀ {X L ι Γ : Type} [Fintype X] [DecidableEq X] [Fintype ι] [Fintype Γ] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) (v : Γ → F.AssociatedGraded) + (_hspan : Submodule.span ℚ (Set.range v) = fast) + (H : ℕ) (_hHpos : 1 ≤ H) + (_hv : ∀ i j, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr (v j) i) H) + (p₀ : ℝ) (_hp₀ : 0 ≤ p₀) + (_hrows : (Fintype.card ι : ℝ) ≤ p₀) (_hcols : (Fintype.card Γ : ℝ) ≤ p₀) + (_hH : (H : ℝ) ≤ Real.exp p₀) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast), + ∃ d : ℕ, d ≤ Fintype.card ι ∧ + ∃ (eQ : Basis (Fin d) ℚ (F.AssociatedGraded ⧸ fast)) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) (qS : ℕ), + Function.RightInverse lift fast.mkQ ∧ + Function.RightInverse (lift.baseChange ℝ) (fast.mkQ.baseChange ℝ) ∧ + 0 < qS ∧ (qS : ℝ) ≤ Real.exp ((p₀ + 2) ^ 47) ∧ + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i| ≤ Real.exp ((p₀ + 2) ^ 45)) ∧ + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ ((eQ.baseChange ℝ) j)) i) ∈ realDenominatorGrid qS) ∧ + (∀ j i, RationalHeightLE (((eQ.coord j).comp fast.mkQ) + (F.associatedGradedBasis b ω hF i)) ⌈Real.exp ((p₀ + 2) ^ 7)⌉₊) ∧ + ∀ (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hKinitial : ∀ t ∈ Kinitial, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ Kinitial) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (pPhase Bpast : ℕ → ℝ) (Rrank : ℝ) (_hBpast : ∀ n ≤ s, 0 ≤ Bpast n) + (_hBmono : Monotone Bpast) + (_hphaseBudget : ∀ n < s, (pPhase n + Cphase n) ^ Cphase n ≤ Bpast (n + 1)) + (Hcontrol : ℕ) (pControl : ℕ → ℝ), + 1 ≤ Hcontrol → (∀ n ≤ s, 0 ≤ pControl n) → + (∀ n ≤ s, (Fintype.card ι : ℝ) ≤ pControl n) → + (∀ n ≤ s, (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ pControl n) → + (∀ n ≤ s, (Hcontrol : ℝ) ≤ Real.exp (pControl n)) → + (∀ i j z, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr + ⁅F.associatedGradedBasis b ω hF i, F.associatedGradedBasis b ω hF j⁆ z) Hcontrol) → + (∀ n ≤ s, Real.exp ((p₀ + 2) ^ 47) * Real.exp ((s : ℝ) * d * Bpast n) ≤ + Real.exp (pControl n)) → + (∀ n ≤ s, (d : ℝ) * Real.exp ((p₀ + 2) ^ 45) * Real.exp (Bpast n) ≤ + Real.exp ((pControl n + 2) ^ a)) → + BundledFullChartControlledCorrelationSourceStages F b ω hF J fast (eQ.baseChange ℝ) Z + Kinitial Utag poly N pPhase Rrank Cphase (fun n => (pControl n + Ccontrol) ^ Ccontrol) → + ∃ history : FullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast s) s, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl s + Ccontrol) ^ Ccontrol) ∧ + ∀ t ∈ history.K, + eval₂ t (F.realGradedSymbolPolynomial b ω hF (fullTaggedVariableWeight J) + (history.outer.1⁻¹ * Z * history.outer.2⁻¹).coord) ∈ fast.baseChange ℝ := by + classical + choose Cphase hCphase hstep using + (fun n : ℕ => exists_full_chart_grade_correction_of_major_correlation_witness + m (n + 1) (Nat.zero_lt_succ n)) + obtain ⟨Ccontrol, hCcontrol, hprefix⟩ := exists_restricted_chart_prefix_control s a + refine ⟨Cphase, Ccontrol, hCphase, hCcontrol, ?_⟩ + intro X L ι Γ _ _ _ _ _ _ F b ω hF J _ fast v hspan H hHpos hv + p₀ hp₀ hrows hcols hH hfast + obtain ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord⟩ := + exists_bounded_submodule_quotient_section_with_coordinates (F.associatedGradedBasis b ω hF) + fast v hspan hHpos hv hp₀ hrows hcols hH + refine ⟨d, hd, eQ, lift, qS, hsection, hsectionR, hqS, hqSB, hentry, hgrid, hcoord, ?_⟩ + intro Z Kinitial hKinitial Utag poly N pPhase Bpast Rrank + hBpast hBmono hphaseBudget Hcontrol pControl hHcontrol hpControl hι hσ hHexp hstructure + hdenbudget hcost hsource + have hcontrol : ∀ n ≤ s, + ∀ history : FullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast n) n, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((pControl n + Ccontrol) ^ Ccontrol) := by + intro n hn history + have hdenbudget' : (qS : ℝ) * + Real.exp ((s : ℝ) * (Fintype.card (Fin d) : ℝ) * Bpast n) ≤ Real.exp (pControl n) := by + simpa only [Fintype.card_fin] using + (mul_le_mul_of_nonneg_right hqSB (Real.exp_nonneg _)).trans (hdenbudget n hn) + have hcost' : (Fintype.card (Fin d) : ℝ) * Real.exp ((p₀ + 2) ^ 45) * + Real.exp (Bpast n) ≤ Real.exp ((pControl n + 2) ^ a) := by + simpa only [Fintype.card_fin] using hcost n hn + obtain ⟨q, hq, hqB, _hdiv, Echart, hE, hEbound, hRgrid⟩ := + hprefix F b ω hF (fullTaggedVariableWeight J) (fullTaggedVariableWeight_pos J) + Hcontrol (pControl n) hHcontrol (hpControl n hn) (hι n hn) (hσ n hn) (hHexp n hn) hstructure + fast lift (eQ.baseChange ℝ) (Real.exp ((p₀ + 2) ^ 45)) (Bpast n) qS (hBpast n hn) hqS + hdenbudget' hcost' hentry hgrid + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) (fullTaggedMajorTopCoordinates J poly)) + (fullTaggedMajorChart_homogeneous J poly (fun i => (N i : ℝ))) + history.slow history.rat history.q n hn history.q_pos history.q_bound + history.slow_bound history.rat_grid + unfold FullChartControlledFactors FullChartFiniteHistory.outer + with_reducible exact ⟨q, hq, hqB, Echart, hE, hEbound, hRgrid⟩ + have hexists : ∀ n ≤ s, + Nonempty (FullChartFiniteHistory F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast n) n) := by + intro n + induction n with + | zero => + intro _ + exact ⟨FullChartFiniteHistory.initial F b ω hF J fast (eQ.baseChange ℝ) lift + Z Kinitial Utag poly N (Bpast 0) hKinitial⟩ + | succ n ih => + intro hn + obtain ⟨history⟩ := ih (by omega) + have hlower : ∀ t ∈ history.K, ∀ j < n + 1, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (history.outer.1⁻¹ * Z * history.outer.2⁻¹).coord ∈ fast.baseChange ℝ := by + intro t ht j hj + with_reducible exact history.invariant_outer t ht j (by omega) + have hcorr := hsource n (by omega) history.outer.1 history.outer.2 history.K + history.subset history.dilation history.retained hlower (hcontrol n (by omega) history) + have hdata := hstep n F b ω hF J fast (eQ.baseChange ℝ) lift hfast hsection + Z history.outer.1 history.outer.2 history.K history.dilation hlower + N poly Utag (pPhase n) Rrank hcorr + let larger := history.mono_bound (hBmono (Nat.le_succ n)) + have hdata' : FullChartGradeCorrectionData F b ω hF J (n + 1) fast + (eQ.baseChange ℝ) lift Z larger.outer.1 larger.outer.2 larger.K Utag poly N + ((pPhase n + Cphase n) ^ Cphase n) := by + simpa only [larger, FullChartFiniteHistory.outer_mono_bound, + FullChartFiniteHistory.mono_bound_K] using hdata + obtain ⟨next, _⟩ := larger.exists_step ((pPhase n + Cphase n) ^ Cphase n) + (hphaseBudget n (by omega)) hdata' + exact ⟨next⟩ + obtain ⟨history⟩ := hexists s le_rfl + refine ⟨history, hcontrol s le_rfl history, ?_⟩ + intro t ht + apply (F.restricted_symbol_grade_terminal b ω hF (fullTaggedVariableWeight J) + fast hfast _ t).mpr + with_reducible exact history.invariant_outer t ht + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct NNReal BigOperators + +theorem exists_certified_full_chart_decomposition_of_major_correlation + (m k : ℕ) (hk : 0 < k) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L M ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] {s t e : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (_hsection : ∀ y, fast.mkQ (lift y) = y) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K₀) + (_hlower : ∀ t ∈ K₀, ∀ j < k, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + (D : RationalFilteredNilmanifold M t e) (_htk : t < k) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (p Rrank : ℝ), + FullChartMajorCorrelation F b ω hF J k fast basis Z left right D N poly U p Rrank C → + CertifiedFullChartDetectedDecomposition F b ω hF J k fast basis lift + Z left right K₀ U poly N ((p + C) ^ C) := by + obtain ⟨C, hC, hdetect⟩ := exists_full_restricted_grade_vector_major_detection m k hk + refine ⟨C, hC, ?_⟩ + intro X L M ι η _ _ _ _ _ _ _ s t e _ _ _ _ F b ω hF J _ fast basis lift hfast hsection + Z left right K₀ hK₀ hlower D htk N poly U p Rrank hcorrelation + obtain ⟨periodCap, coverCap, Lip, W, R, Ψ, c, β, hpoly, hcoeff, hβ, + hp, hR, hRcap, hdim, hmod, hcover, hLip, hΨ, hN, hRrank, hrank, hcorr⟩ := hcorrelation + have hdetected := hdetect F b ω hF J fast basis (left⁻¹ * Z * right⁻¹).coord + W D htk R N poly hpoly U hcoeff Ψ c β hβ + p Rrank hp hR hRcap hdim hmod hcover hLip hΨ hN hRrank hrank hcorr + exact certifiedFullChartDetectedDecomposition_of_vector_detection F b ω hF J k fast + basis lift Z left right K₀ U poly N ((p + C) ^ C) c hfast hsection hK₀ hlower hdetected.1 + +attribute [local instance] FullChartMajorCorrelationWitness.lie + FullChartMajorCorrelationWitness.algebra FullChartMajorCorrelationWitness.topology + FullChartMajorCorrelationWitness.topologicalAdd FullChartMajorCorrelationWitness.continuousSMul + FullChartMajorCorrelationWitness.hausdorff + +theorem exists_certified_full_chart_decomposition_of_major_correlation_witness + (m k : ℕ) (hk : 0 < k) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (_hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (_hsection : ∀ y, fast.mkQ (lift y) = y) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (_hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight (X := X) J i * t i) ∈ K₀) + (_hlower : ∀ t ∈ K₀, ∀ j < k, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight (X := X) J) j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) (p Rrank : ℝ), + Nonempty (FullChartMajorCorrelationWitness F b ω hF J k fast basis + Z left right N poly U p Rrank C) → + CertifiedFullChartDetectedDecomposition F b ω hF J k fast basis lift + Z left right K₀ U poly N ((p + C) ^ C) := by + obtain ⟨C, hC, hstep⟩ := exists_certified_full_chart_decomposition_of_major_correlation m k hk + refine ⟨C, hC, ?_⟩ + intro X L ι η _ _ _ _ _ s F b ω hF J _ fast basis lift hfast hsection + Z left right K₀ hK₀ hlower N poly U p Rrank hwitness + obtain ⟨witness⟩ := hwitness + exact hstep F b ω hF J fast basis lift hfast hsection Z left right K₀ hK₀ hlower + witness.model witness.lower N poly U p Rrank witness.correlation + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartForwardEarlyTree.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartForwardEarlyTree.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f01bb895ce30c630f857b19b3e496432c18cb06 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartForwardEarlyTree.lean @@ -0,0 +1,417 @@ +import OAI.Combinatorics.Progressions.Geometry.CertifiedFullChartBudgetedTreeBounds + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {J : Fin m → Type} [∀ j, Fintype (J j)] + {fast : Submodule ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))} + {lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded} + {Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {Utag : ∀ j, Submodule ℝ (J j → ℝ)} + {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} {N : X → ℕ} {Bphase : ℝ} + +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase + +theorem exists_finite_children_of_stage_bounds {n : ℕ} (H : State n) + {cap cumulative : ℕ → ℝ} (hH : StageBounds cap cumulative H) + (hcap : cap n ≤ Bphase) + {p : ℝ} (hp : 0 ≤ p) (hpast : cumulative n ≤ p) (hbudget : cap n ≤ p) + (hX : (Fintype.card X : ℝ) ≤ p) (hm : (m : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) + (hblocks : (((n + 1) * (Fintype.card η * m) : ℕ) : ℝ) ≤ p) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + ∃ children : Finset (State (n + 1)), + (children.card : ℝ) ≤ Real.exp + ((Fintype.card η : ℝ) * cap n + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254) ∧ + (∀ Hnext ∈ children, AdmissibleChildAt F b ω hF J fast basis lift Z + Utag poly N Bphase (cap n) H Hnext) ∧ + ∀ q K' pair, FullChartAdmissibleStageCorrection F b ω hF J (n + 1) + fast basis lift Z H.outer.1 H.outer.2 H.K Utag poly N (cap n) q K' pair → + ∃ Hnext ∈ children, RepresentsCorrection F b ω hF J fast basis lift Z + Utag poly N Bphase Hnext q K' pair := by + obtain ⟨count, hcount, candidate, hgood, hcover⟩ := + exists_full_chart_finite_stage_branches F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N (cap n) 254 (by omega) + hH.certificate hp hpast hbudget hX hm hJ hη + (by simpa only [Nat.succ_mul] using hblocks) + (fun point hpoint => H.retained point (Set.mem_univ _) hpoint) hpoly hN + let next (i : Fin count) : State (n + 1) := + H.append_admissible (cap n) hcap (candidate i).1.1 (candidate i).1.2 + (candidate i).2 (hgood i) + refine ⟨Finset.univ.image next, ?_, ?_, ?_⟩ + · exact (Nat.cast_le.mpr ((Finset.card_image_le).trans_eq + (Finset.card_fin count))).trans hcount + · intro Hnext hmem + obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hmem + exact append_admissible_is_child_at H (cap n) hcap _ _ _ (hgood i) + · intro q K' pair hpair + obtain ⟨i, hlabel, heval⟩ := hcover q K' pair hpair + refine ⟨next i, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩, ?_⟩ + have hentry := append_admissible_entry H (cap n) hcap + (candidate i).1.1 (candidate i).1.2 (candidate i).2 (hgood i) + refine ⟨hentry.2.2.trans (congrArg Prod.fst hlabel), ?_, ?_⟩ + · exact (append_admissible_K H (cap n) hcap _ _ _ (hgood i)).trans + (congrArg Prod.snd hlabel) + · intro t ht + change eval₂ t ((next i).slow n) = _ ∧ _ + dsimp only [next] + rw [hentry.1, hentry.2.1] + with_reducible exact heval t ht + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical BigOperators + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +noncomputable def stageBranchLog (dim n : ℕ) (cap p : ℝ) : ℝ := + (dim : ℝ) * cap + (p + 8) ^ 8 + + (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254 + +theorem stageBranchLog_mono (dim n : ℕ) (cap : ℝ) {p q : ℝ} + (hp : 0 ≤ p) (hpq : p ≤ q) : stageBranchLog dim n cap p ≤ stageBranchLog dim n cap q := by + unfold stageBranchLog + have hfirst : (p + 8) ^ 8 ≤ (q + 8) ^ 8 := by gcongr + have hlast : (p + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254 ≤ + (q + fullChartStageCountConstant (n + 1) 254) ^ + fullChartStageCountConstant (n + 1) 254 := by gcongr + exact add_le_add (add_le_add le_rfl hfirst) hlast + +theorem stageBranchLog_nonneg (dim n : ℕ) {cap p : ℝ} + (hcap : 0 ≤ cap) (hp : 0 ≤ p) : 0 ≤ stageBranchLog dim n cap p := by + unfold stageBranchLog + positivity + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {J : Fin m → Type} [∀ j, Fintype (J j)] + {fast : Submodule ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))} + {lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded} + {Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {Utag : ∀ j, Submodule ℝ (J j → ℝ)} + {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} {N : X → ℕ} {Bphase : ℝ} + +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z + Set.univ Utag poly N Bphase + +theorem exists_prefix_counted_budgeted_branch_tree (depth : ℕ) + (cap cumulative pCount : ℕ → ℝ) (pTree : ℝ) + (hpTree : 0 ≤ pTree) (hstorage : Bphase ≤ pTree) + (hcaps : ∀ n < depth, cap n ≤ Bphase) + (hmono : ∀ n < depth, cumulative n ≤ cumulative (n + 1)) + (hcap : ∀ n < depth, cap n ≤ cumulative (n + 1)) + (hcount : ∀ n < depth, 0 ≤ pCount n) + (hpast : ∀ n < depth, cumulative n ≤ pCount n) + (hbudget : ∀ n < depth, cap n ≤ pCount n) + (hcountTree : ∀ n < depth, pCount n ≤ pTree) + (hX : (Fintype.card X : ℝ) ≤ pTree) (hm : (m : ℝ) ≤ pTree) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ pTree) + (hη : (Fintype.card η : ℝ) ≤ pTree) + (hblocks : ((depth * (Fintype.card η * m) : ℕ) : ℝ) ≤ pTree) + (hXlocal : ∀ n < depth, (Fintype.card X : ℝ) ≤ pCount n) + (hmlocal : ∀ n < depth, (m : ℝ) ≤ pCount n) + (hJlocal : ∀ n < depth, (Fintype.card (Σ j, J j) : ℝ) ≤ pCount n) + (hηlocal : ∀ n < depth, (Fintype.card η : ℝ) ≤ pCount n) + (hblockslocal : ∀ n < depth, (((n + 1) * (Fintype.card η * m) : ℕ) : ℝ) ≤ pCount n) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) : + ∃ T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase cap depth pTree, + ∀ n, n < depth → ∀ history ∈ T.level n, + ((T.children n history).card : ℝ) ≤ + Real.exp (stageBranchLog (Fintype.card η) n (cap n) (pCount n)) := by + have hchildren (n : ℕ) (hn : n < depth) (history : State n) : + ∃ children : Finset (State (n + 1)), + (children.card : ℝ) ≤ Real.exp (stageBranchLog (Fintype.card η) n (cap n) pTree) ∧ + (∀ next ∈ children, AdmissibleChildAt F b ω hF J fast basis lift Z + Utag poly N Bphase (cap n) history next) ∧ + (∀ q K pair, FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z history.outer.1 history.outer.2 history.K Utag poly N (cap n) q K pair → + ∃ next ∈ children, RepresentsCorrection F b ω hF J fast basis lift Z + Utag poly N Bphase next q K pair) ∧ + (StageBounds cap cumulative history → (children.card : ℝ) ≤ + Real.exp (stageBranchLog (Fintype.card η) n (cap n) (pCount n))) := by + by_cases hvalid : StageBounds cap cumulative history + · obtain ⟨children, hcard, hadmissible, hcomplete⟩ := + exists_finite_children_of_stage_bounds history hvalid (hcaps n hn) + (hcount n hn) (hpast n hn) (hbudget n hn) (hXlocal n hn) (hmlocal n hn) + (hJlocal n hn) (hηlocal n hn) (hblockslocal n hn) hpoly hN + refine ⟨children, ?_, hadmissible, hcomplete, fun _ => hcard⟩ + exact hcard.trans (Real.exp_le_exp.mpr + (stageBranchLog_mono _ _ _ (hcount n hn) (hcountTree n hn))) + · obtain ⟨children, hcard, hadmissible, hcomplete⟩ := + exists_finite_children_at_budget history (cap n) (hcaps n hn) hpTree hstorage + ((hcaps n hn).trans hstorage) hX hm hJ hη + ((Nat.cast_le.mpr (Nat.mul_le_mul_right (Fintype.card η * m) + (Nat.succ_le_of_lt hn))).trans hblocks) hpoly hN + exact ⟨children, hcard, hadmissible, hcomplete, fun h => (hvalid h).elim⟩ + let children : ∀ n, State n → Finset (State (n + 1)) := fun n history => + if hn : n < depth then Classical.choose (hchildren n hn history) else ∅ + let T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase cap depth pTree := { + children := children + card := by + intro n hn history + dsimp only [children] + rw [dite_eq_left hn] + exact_mod_cast (Classical.choose_spec (hchildren n hn history)).1.trans (Nat.le_ceil _) + admissible := by + intro n hn history next hmem + have hm' : next ∈ Classical.choose (hchildren n hn history) := by + simpa only [children, dite_eq_left hn] using hmem + exact (Classical.choose_spec (hchildren n hn history)).2.1 next hm' + complete := by + intro n hn history q K pair hpair + obtain ⟨next, hmem, hrep⟩ := + (Classical.choose_spec (hchildren n hn history)).2.2.1 q K pair hpair + exact ⟨next, by simpa only [children, dite_eq_left hn] using hmem, hrep⟩ } + refine ⟨T, ?_⟩ + intro n hn history hmem + have hvalid := T.stage_bounds hmono hcap n (Nat.le_of_lt hn) history hmem + have hsharp := (Classical.choose_spec (hchildren n hn history)).2.2.2 hvalid + simpa only [T, children, dite_eq_left hn] using hsharp + +omit [Fintype X] in + +theorem BudgetedBranchTree.card_level_le_prefix_exp + {cap : ℕ → ℝ} {depth : ℕ} {pTree : ℝ} + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase cap depth pTree) + (pCount : ℕ → ℝ) + (hsharp : ∀ n, n < depth → ∀ history ∈ T.level n, + ((T.children n history).card : ℝ) ≤ + Real.exp (stageBranchLog (Fintype.card η) n (cap n) (pCount n))) + (n : ℕ) (hn : n ≤ depth) : + ((T.level n).card : ℝ) ≤ Real.exp + (∑ j ∈ Finset.range n, stageBranchLog (Fintype.card η) j (cap j) (pCount j)) := + finiteGradedBranchLevel_card_le_exp_sum _ T.children depth + (fun j => stageBranchLog (Fintype.card η) j (cap j) (pCount j)) hsharp n hn + +omit [Fintype X] in + +theorem BudgetedBranchTree.card_vertices_le_prefix_exp + {cap : ℕ → ℝ} {depth : ℕ} {pTree : ℝ} + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase cap depth pTree) + (pCount : ℕ → ℝ) + (hsharp : ∀ n, n < depth → ∀ history ∈ T.level n, + ((T.children n history).card : ℝ) ≤ + Real.exp (stageBranchLog (Fintype.card η) n (cap n) (pCount n))) + (hcap : ∀ j < depth, 0 ≤ cap j) (hp : ∀ j < depth, 0 ≤ pCount j) : + (T.vertices.card : ℝ) ≤ ((depth + 1 : ℕ) : ℝ) * Real.exp + (∑ j ∈ Finset.range depth, stageBranchLog (Fintype.card η) j (cap j) (pCount j)) := + finiteGradedBranchVertices_card_le_mul_exp_sum _ T.children depth + (fun j => stageBranchLog (Fintype.card η) j (cap j) (pCount j)) hsharp + (fun j hj => stageBranchLog_nonneg _ _ (hcap j hj) (hp j hj)) depth le_rfl + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical BigOperators + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {J : Fin m → Type} [∀ j, Fintype (J j)] + {fast : Submodule ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))} + {lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded} + {Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {Utag : ∀ j, Submodule ℝ (J j → ℝ)} + {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} {N : X → ℕ} {Bphase : ℝ} + {depth : ℕ} {pTree : ℝ} + +local notation "Cstage" => fun n => fullChartStageCountConstant (n + 1) 254 + +theorem BudgetedBranchTree.card_level_le_forward_prefix + (A : ℕ) {x : ℝ} (hx : 0 ≤ x) (hd : (Fintype.card η : ℝ) ≤ x) + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase + (fun n => preparedFiniteForwardCap A Cstage n x) depth pTree) + (hsharp : ∀ n, n < depth → ∀ history ∈ T.level n, + ((T.children n history).card : ℝ) ≤ Real.exp + (stageBranchLog (Fintype.card η) n (preparedFiniteForwardCap A Cstage n x) + (preparedFiniteForwardCount A Cstage n x))) + (n : ℕ) (hn : n ≤ depth) : + ((T.level n).card : ℝ) ≤ Real.exp (preparedFiniteForwardPrefixLog A Cstage n x) := by + apply (T.card_level_le_prefix_exp + (fun j => preparedFiniteForwardCount A Cstage j x) hsharp n hn).trans + apply Real.exp_le_exp.mpr + exact Finset.sum_le_sum (fun j _ => + preparedFiniteForward_branch_count_log A Cstage j hx hd) + +theorem BudgetedBranchTree.card_reached_type_le_forward_prefix + (A : ℕ) {x : ℝ} (hx : 0 ≤ x) (hd : (Fintype.card η : ℝ) ≤ x) + (T : BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N Bphase + (fun n => preparedFiniteForwardCap A Cstage n x) depth pTree) + (hsharp : ∀ n, n < depth → ∀ history ∈ T.level n, + ((T.children n history).card : ℝ) ≤ Real.exp + (stageBranchLog (Fintype.card η) n (preparedFiniteForwardCap A Cstage n x) + (preparedFiniteForwardCount A Cstage n x))) + (n : ℕ) (hn : n ≤ depth) : + (Fintype.card {history // history ∈ T.level n} : ℝ) ≤ + Real.exp (preparedFiniteForwardPrefixLog A Cstage n x) := by + simpa only [Fintype.card_coe] using T.card_level_le_forward_prefix A hx hd hsharp n hn + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory +open Module VectorPolynomial +open scoped TensorProduct Classical BigOperators + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeEvaluation restrictedMajorCorrection outer fullChartStageCountConstant + +variable {m : ℕ} {X : Type} [Fintype X] {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + +local notation "countConstants" => (fun n => fullChartStageCountConstant (n + 1) 254) + +variable (depth scheduleExponent : ℕ) (x : ℝ) + (hx : 0 ≤ x) + (hX : (Fintype.card X : ℝ) ≤ x) (hm : (m : ℝ) ≤ x) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ x) + (hη : (Fintype.card η : ℝ) ≤ x) + (hblocks : ((depth * (Fintype.card η * m) : ℕ) : ℝ) ≤ x) + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) + +local notation "cap" => fun n => preparedFiniteForwardCap scheduleExponent countConstants n x +local notation "cumulative" => fun n => preparedFiniteForwardCumulative scheduleExponent countConstants n x +local notation "count" => fun n => preparedFiniteForwardCount scheduleExponent countConstants n x +local notation "storage" => preparedFiniteForwardParameter scheduleExponent countConstants depth x +local notation "Tree" => BudgetedBranchTree F b ω hF J fast basis lift Z Utag poly N + (cumulative depth) cap depth storage + +include hx hX hm hJ hη hblocks hpoly hN + +theorem exists_early_forward_branch_tree : + ∃ T : Tree, + (∀ n, n < depth → ∀ history ∈ T.level n, + ((T.children n history).card : ℝ) ≤ + Real.exp (stageBranchLog (Fintype.card η) n (cap n) (count n))) ∧ + (∀ n, n ≤ depth → ((T.level n).card : ℝ) ≤ + Real.exp (preparedFiniteForwardPrefixLog scheduleExponent countConstants n x)) := by + have hstorage0 := preparedFiniteForwardParameter_nonneg scheduleExponent countConstants depth hx + have hstorage := (preparedFiniteForward_prefix_bounds scheduleExponent countConstants depth hx).1.2 + have hxtoStorage := le_preparedFiniteForwardParameter scheduleExponent countConstants depth hx + have hxtoCount (n : ℕ) : x ≤ count n := + le_preparedFiniteForwardCount scheduleExponent countConstants n hx + have hcountTree (n : ℕ) (hn : n < depth) : count n ≤ storage := + preparedFiniteForwardCount_le_parameter scheduleExponent countConstants hx hn + obtain ⟨T, hsharp⟩ := exists_prefix_counted_budgeted_branch_tree + (F := F) (b := b) (ω := ω) (hF := hF) (J := J) + (fast := fast) (basis := basis) (lift := lift) (Z := Z) + depth cap cumulative count storage hstorage0 hstorage + (fun _ hn => preparedFiniteForwardCap_le_cumulative scheduleExponent countConstants hx hn) + (fun n _ => preparedFiniteForwardCumulative_le_succ scheduleExponent countConstants n hx) + (fun n _ => preparedFiniteForwardCap_le_cumulative_succ scheduleExponent countConstants n hx) + (fun n _ => preparedFiniteForwardCount_nonneg scheduleExponent countConstants n hx) + (fun n _ => ((preparedFiniteForward_prefix_bounds scheduleExponent countConstants n hx).1.2).trans + (preparedFiniteForwardParameter_le_count scheduleExponent countConstants n hx)) + (fun n _ => preparedFiniteForwardCap_le_count scheduleExponent countConstants n hx) + hcountTree (hX.trans hxtoStorage) (hm.trans hxtoStorage) (hJ.trans hxtoStorage) + (hη.trans hxtoStorage) (hblocks.trans hxtoStorage) + (fun n _ => hX.trans (hxtoCount n)) (fun n _ => hm.trans (hxtoCount n)) + (fun n _ => hJ.trans (hxtoCount n)) (fun n _ => hη.trans (hxtoCount n)) + (fun n hn => (Nat.cast_le.mpr (Nat.mul_le_mul_right (Fintype.card η * m) + (Nat.succ_le_of_lt hn))).trans (hblocks.trans (hxtoCount n))) hpoly hN + exact ⟨T, hsharp, fun n hn => + T.card_level_le_forward_prefix scheduleExponent hx hη hsharp n hn⟩ + +noncomputable def earlyForwardBranchTree : Tree := + Classical.choose (exists_early_forward_branch_tree F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN) + +local notation "earlyTree" => earlyForwardBranchTree F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN + +theorem earlyForwardBranchTree_sharp (n : ℕ) (hn : n < depth) + (history) (hmem : history ∈ (earlyTree).level n) : + (((earlyTree).children n history).card : ℝ) ≤ + Real.exp (stageBranchLog (Fintype.card η) n (cap n) (count n)) := + (Classical.choose_spec (exists_early_forward_branch_tree F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN)).1 n hn history hmem + +theorem earlyForwardBranchTree_card_level (n : ℕ) (hn : n ≤ depth) : + (((earlyTree).level n).card : ℝ) ≤ + Real.exp (preparedFiniteForwardPrefixLog scheduleExponent countConstants n x) := + (Classical.choose_spec (exists_early_forward_branch_tree F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN)).2 n hn + +noncomputable abbrev earlyForwardReached (n : ℕ) := + {history // history ∈ (earlyTree).level n} + +theorem earlyForwardReached_card (n : ℕ) (hn : n ≤ depth) : + (Fintype.card (earlyForwardReached F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN n) : ℝ) ≤ + Real.exp (preparedFiniteForwardPrefixLog scheduleExponent countConstants n x) := by + simpa only [earlyForwardReached, Fintype.card_coe] using + earlyForwardBranchTree_card_level F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN n hn + +noncomputable abbrev earlyForwardBranches (stage : Fin (depth + 1)) := + earlyForwardReached F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN stage.val + +theorem earlyForwardBranches_card (stage : Fin (depth + 1)) : + (Fintype.card (earlyForwardBranches F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN stage) : ℝ) ≤ + Real.exp (preparedFiniteForwardPrefixLog scheduleExponent countConstants stage.val x) := + earlyForwardReached_card F b ω hF J fast basis lift Z Utag poly N + depth scheduleExponent x hx hX hm hJ hη hblocks hpoly hN stage.val + (Nat.le_of_lt_succ stage.isLt) + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartFrozenTerminal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartFrozenTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f87f8756b3c9e36150a6ff363cb8456e3dc82d54 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartFrozenTerminal.lean @@ -0,0 +1,622 @@ +import OAI.Combinatorics.Progressions.Estimates.DenseCommonStrideCardRatio +import OAI.Combinatorics.Progressions.Geometry.TerminalChartSlowEvaluation +import OAI.Combinatorics.Progressions.Lattices.AllocatedRecoveredIntegerFullChart +import OAI.Combinatorics.Progressions.Lattices.IntegerFrozenChart +import OAI.Combinatorics.Progressions.Sampling.JointMeasureProductiveNarrowSampler + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical + +variable {m : ℕ} {G : Type*} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +local notation "sides" => Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) + +theorem allocatedParameterBox_coordinate_bound (t : integerBox sides) + (k : LayerSamplerVariables G I n B) : |(t.val k : ℝ)| ≤ S.value := by + have ht := (mem_integerBox sides t.val).mp t.property k + have hside : sides k ≤ S.value := by + cases k with + | inl g => exact le_rfl + | inr j => exact allocatedPrincipalSides_le_scale B U b S j + have ht0 : (0 : ℝ) ≤ t.val k := by exact_mod_cast ht.1 + rw [abs_of_nonneg ht0] + exact (by exact_mod_cast ht.2.le : (t.val k : ℝ) ≤ sides k).trans (Nat.cast_le.mpr hside) + +theorem allocatedParameterBox_root_bound (t : integerBox sides) : + (∑ k, |(t.val k : ℝ)|) ≤ allocatedPhysicalRootBudget B U b S (fun _ => 0) := by + have hsum := Finset.sum_le_sum (fun k (_ : k ∈ Finset.univ) => + allocatedParameterBox_coordinate_bound B U b S t k) + simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, + allocatedPhysicalRootBudget, Int.cast_zero, abs_zero, Finset.sum_const_zero, mul_zero, zero_add] using hsum + +theorem allocatedParameterBox_slice_cost {p : ℝ} {A : Finset (integerBox sides)} + (hA : IsDenseCommonStrideBox sides p (A.image Subtype.val)) : + (Fintype.card (integerBox sides) : ℝ) / A.card ≤ + Real.exp (p * Fintype.card (LayerSamplerVariables G I n B)) := by + exact dense_commonStride_slice_card_ratio Subtype.val Subtype.val_injective + (by ext t; simp) hA + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped 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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +local notation "sides" => Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) + +theorem allocatedParameterBox_side_eq (i : LayerSamplerVariables G I n B) : + layerSamplerBox B U b S i = (sides i : ℝ) := by + cases i <;> rfl + +theorem allocatedFrozenParameterBox_mem + (keep : LayerSamplerVariables G I n B → Prop) [DecidablePred keep] + (fixed : {i // ¬keep i} → ℤ) + (hfixed : ∀ i, 0 ≤ fixed i ∧ fixed i < sides i.val) + (u : {i // keep i} → ℤ) + (hu : u ∈ integerBox (fun i : {i // keep i} => sides i.val)) : + finiteSplitPoint keep u fixed ∈ integerBox sides := by + apply (mem_integerBox sides _).mpr + intro i + by_cases hi : keep i + · simpa only [finiteSplitPoint, dite_eq_left hi] using + (mem_integerBox _ u).mp hu ⟨i, hi⟩ + · simpa only [finiteSplitPoint, dite_eq_right hi] using hfixed ⟨i, hi⟩ + +theorem allocatedFrozenParameterBox_bound + (keep : LayerSamplerVariables G I n B → Prop) [DecidablePred keep] + (fixed : {i // ¬keep i} → ℤ) + (hfixed : ∀ i, 0 ≤ fixed i ∧ fixed i < sides i.val) + (u : {i // keep i} → ℤ) + (hu : u ∈ integerBox (fun i : {i // keep i} => sides i.val)) : + ∀ i, |((finiteSplitPoint keep u fixed i : ℤ) : ℝ)| ≤ layerSamplerBox B U b S i := by + intro i + have hi := (mem_integerBox sides _).mp + (allocatedFrozenParameterBox_mem B U b S keep fixed hfixed u hu) i + have hnonneg : (0 : ℝ) ≤ (finiteSplitPoint keep u fixed i : ℤ) := by exact_mod_cast hi.1 + rw [abs_of_nonneg hnonneg, allocatedParameterBox_side_eq B U b S] + exact_mod_cast hi.2.le + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open BooleanCubeKernel +open scoped BigOperators Classical + +variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +local notation "Vars" => LayerSamplerVariables G I n B +local notation "sides" => Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) + +theorem allocatedParameterBox_physical_input + (N : X → ℕ) (hN : ∀ x, 0 < N x) + {τ ξ : ℝ} (hτ : 0 < τ) (hτhalf : τ ≤ 1/2) (hξ1 : ξ ≤ 1) + (hsize : ∀ x, 4 ≤ τ * (N x : ℝ)) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 + (narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + (allocatedPhysicalRootBudget B U b S (fun _ => 0)) τ ξ N) 1) + {k : ℕ} (hk : 2 ≤ k) + (f : (X → ℤ) → ℝ) + (hf : ∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) + (hfree : IntegerVectorAPFree {x | x ∈ integerBox N ∧ f x ≠ 0} k) + (hinj : Function.Injective (fun t : integerBox sides => + jointIntegerPhysicalSite t.val (z.1.val,z.2.val))) : + (∀ t ∈ integerBox sides, + jointIntegerPhysicalSite t (z.1.val,z.2.val) ∈ integerBox N) ∧ + (∀ t ∈ integerBox sides, + f (jointIntegerPhysicalSite t (z.1.val,z.2.val)) ∈ Set.Icc (0 : ℝ) 1) ∧ + IntegerVectorAPFree {t | t ∈ integerBox sides ∧ + f (jointIntegerPhysicalSite t (z.1.val,z.2.val)) ≠ 0} k := by + have hinside (t : Vars → ℤ) (ht : t ∈ integerBox sides) : + jointIntegerPhysicalSite t (z.1.val,z.2.val) ∈ integerBox N := + narrow_jointIntegerPhysicalSite_mem_box + (allocatedPhysicalRootBudget_nonneg B U b S (fun _ => 0)) hτ hτhalf hξ1 t + (allocatedParameterBox_root_bound B U b S ⟨t,ht⟩) N hN hsize z + refine ⟨hinside, fun t ht => hf _ (hinside t ht), ?_⟩ + have hset : Set.InjOn (fun t => jointIntegerPhysicalSite t (z.1.val,z.2.val)) + (integerBox sides : Set (Vars → ℤ)) := by + intro u hu v hv huv + exact congrArg Subtype.val (hinj (a₁ := ⟨u,hu⟩) (a₂ := ⟨v,hv⟩) huv) + apply (joint_sample_progression_free hfree hk (z.1.val,z.2.val) + (integerBox sides) hset).mono + intro t ht + exact ⟨ht.1, hinside t ht.1, ht.2⟩ + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule MeasureTheory BooleanCubeKernel +open scoped BigOperators Classical NNReal + +theorem exists_allocated_fullBox_normalized_approximation (m : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {X G : Type*} [Fintype X] [DecidableEq X] [Fintype G] [DecidableEq G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (_hσ1 : ∀ j, σ j ≤ 1) + (C V : Fin m → ℝ≥0) + (_hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ C j * ‖z‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ V j) + (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm z‖ ≤ Cinv j * ‖z‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + {P E : ℝ} (_hP : 0 ≤ P) (_hmSize : (m : ℝ) ≤ P) + (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hX : (Fintype.card X : ℝ) ≤ P) + (_hdim : (Fintype.card (Option (LayerSamplerVariables G I n B) × X) : ℝ) ≤ P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (_hcount : ∀ j : Fin m, + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) (_hLP : (S.value : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) + (stride : X → ℕ) (_hs : ∀ d, 0 < stride d) (_hsP : ∀ d, (stride d : ℝ) ≤ Real.exp P) + {W τ ξ : ℝ} (_hW : 0 ≤ W) (_hWP : W ≤ Real.exp P) + (hRootBudget : allocatedPhysicalRootBudget B U basis S (fun _ => 0) ≤ W) + (_hτ : 0 < τ) (_hτP : τ⁻¹ ≤ Real.exp P) + (_hτhalf : τ ≤ 1 / 2) (_hτdim : (Fintype.card X : ℝ) * τ ≤ 1 / 2) + (_hξ : 0 < ξ) (_hξ1 : ξ ≤ 1) (_hξP : ξ⁻¹ ≤ Real.exp P) + (N : X → ℕ) (_hsize : ∀ d, Real.exp ((max P E + A) ^ A) ≤ (N d : ℝ)) + {rank : ℝ} (_hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun d => (N d : ℝ)) rank (U j) (p j)) + (_hRank : Real.exp ((max P E + A) ^ A) ≤ rank) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty), + let widths := narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let density := allocatedJointBaseDensity B U basis hb o hR hσ S X p hm + let Z := selectedJointDensityMass bases stride T widths density + ∃ (hN : ∀ x, 0 < N x) (hbases : bases.Nonempty) (hbox : (integerBox N).Nonempty) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride T widths z), + ∃ hnormalizer : |Z - 1| ≤ Real.exp (-E) ∧ + Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2, + ∃ hmargin : ∀ x, 2 * spatialTrimMargin τ N x ≤ N x, + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let root : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + let hrootSum := fun t => (allocatedParameterBox_root_bound B U basis S t).trans hRootBudget + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S X p hm N hN _hW _hτ _hξ + stride T hmass bases hbases hnormalizer.2.2.1 + let physical := narrowPhysicalSiteMap (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) + _hW _hτ _hξ1 N hN hmargin root hrootSum + let Ctail := 4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (V j) + ∀ {Tests : (bases × rectangularWeightIndices 0 widths 1) → Type*} + [∀ z, Nonempty (Tests z)] + (slices : ∀ z, Tests z → Finset Sites) (tests : ∀ z, Tests z → Sites → ℂ) + (w : X → ℕ) (degree : ℕ) {u pModel budget pSlice : ℝ} + (_hu : 0 ≤ u) (_hpModel : 0 ≤ pModel) (_hbudget : 0 ≤ budget) + (_hSliceLog : pSlice * Fintype.card (LayerSamplerVariables G I n B) ≤ pModel) + (_hCtail : Ctail ≤ Real.exp pModel) + (_hDense : ∀ z j, IsDenseCommonStrideBox sides pSlice ((slices z j).image root)) + (_htests : ∀ z j t, ‖tests z j t‖ ≤ 1) + {periodCap coverCap : ℝ} {lip : ℝ≥0}, + let K := Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) + u + 2 * pModel + budget + 30 ≤ E → + (∀ signal : (X → ℤ) → ℂ, (∀ t, ‖signal t‖ ≤ 1) → + (∀ t, t ∉ integerBox N → signal t = 0) → + allocatedModelUnitThreshold u pModel K Ctail ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (root t) (z.1.val, z.2.val)) slices tests signal → + ∃ (twist : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap lip) + (F : integerBox N → ℂ), + Nonempty (NativeSampleModel w degree budget (fun t : integerBox N => t.val) F) ∧ + Real.exp (-budget) ≤ ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation + (fun t => signal t.val) (fun t => star (twist.eval N p t.val) * F t)‖) → + ∀ (input : integerBox N → ℂ), (∀ t, ‖input t‖ ≤ Real.exp pModel) → + ∃ (nterms : ℕ) (_ : 0 < nterms) + (Q : Fin nterms → (integerBox N → ℂ)) + (coeff : Fin nterms → ℝ) (err : integerBox N → ℂ), + (∀ i, Q i ∈ twistedNativeSampleFunctions w degree budget + (fun t : integerBox N => t.val) + (fun (twist : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap lip) + (t : integerBox N) => twist.eval N p t.val)) ∧ + input = (∑ i, coeff i • Q i) + err ∧ + (∑ i, |coeff i|) ≤ Real.exp (budget + 2) ∧ + sampledSliceSeminorm pathLaw physical slices tests err ≤ Real.exp (-u) ∧ + (nterms : ℝ) ≤ Real.exp (2 * budget + 2 * u + 4 * pModel + 30) := by + obtain ⟨A, hA, hmodel⟩ := exists_allocated_narrow_normalized_approximation m + refine ⟨A, hA, ?_⟩ + intro X G _ _ _ _ I _ _ n B _ _ J _ U basis R σ S hb o _ _ _ _ μ _ _ ν _ _ + hR hσ hσ1 C V hC hV Cinv hCinv hchart hsmall P E hP hmSize hK hX hdim + hRP hσP hcount hI hn hJ hAP hLP hCP hVP p hp hm stride hs hsP W τ ξ + hW hWP hRootBudget hτ hτP hτhalf hτdim hξ hξ1 hξP N hsize rank hrank hRank T hT widths bases density Z + obtain ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, hmodel⟩ := + hmodel B U basis S hb o μ ν hR hσ hσ1 C V hC hV Cinv hCinv hchart hsmall + hP hmSize hK hX hdim hRP hσP hcount hI hn hJ hAP hLP hCP hVP p hp hm stride hs hsP + hW hWP hτ hτP hτhalf hτdim hξ hξ1 hξP N hsize hrank hRank T hT + refine ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩ + intro sides Sites root hrootSum pathLaw physical Ctail Tests _ slices tests + w degree u pModel budget pSlice hu hpModel hbudget hSliceLog hCtail hDense htests + periodCap coverCap lip K htail hdetect input hinput + have hsides (k : LayerSamplerVariables G I n B) : 0 < sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U basis S j + let : ∀ k, NeZero (sides k) := fun k => ⟨(hsides k).ne'⟩ + let : Nonempty Sites := (integerBox_nonempty sides).to_subtype + have hroot (t : Sites) (k) : |(root t k : ℝ)| ≤ Real.exp P := + (allocatedParameterBox_coordinate_bound B U basis S t k).trans hLP + have hsizeModel (z) (j) : (Fintype.card Sites : ℝ) / (slices z j).card ≤ K := + allocatedParameterBox_slice_cost B U basis S (hDense z j) + exact hmodel root hroot hrootSum slices tests w degree hu hpModel hbudget + (Real.exp_nonneg _) (Real.exp_le_exp.mpr hSliceLog) hCtail hsizeModel htests + htail hdetect input hinput + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule _root_.MvPolynomial _root_.OAI.MvPolynomial BooleanCubeKernel +open scoped BigOperators Classical + +theorem integerSampledRealChart_freeze {A V : Type*} + (β : A → MvPolynomial V ℤ) (keep : V → Prop) + (fixed : {i // ¬keep i} → ℤ) (i : A) : + integerSampledRealChart (fun z => freezePolynomial keep fixed (β z)) i = + freezePolynomial keep (fun i => (fixed i : ℝ)) (integerSampledRealChart β i) := + freezePolynomial_map (Int.castRingHom ℝ) keep fixed (β i) + +theorem integerSampledSpatial_freeze {m : ℕ} {X V : Type*} {J : Fin m → Type*} + (β : X ⊕ (Σ j, J j) → MvPolynomial V ℤ) (keep : V → Prop) + (fixed : {i // ¬keep i} → ℤ) (u : {i // keep i} → ℤ) : + integerSampledSpatial (fun z => freezePolynomial keep fixed (β z)) u = + integerSampledSpatial β (finiteSplitPoint keep u fixed) := by + funext i + exact freezePolynomial_eval keep fixed (β (Sum.inl i)) u + +theorem integerSampledLowTags_freeze {m : ℕ} {X V : Type*} + (J : Fin m → Type*) [∀ j, Fintype (J j)] (k : ℕ) + (β : X ⊕ (Σ j, J j) → MvPolynomial V ℤ) (keep : V → Prop) + (fixed : {i // ¬keep i} → ℤ) (u : {i // keep i} → ℤ) : + integerSampledLowTags J k (fun z => freezePolynomial keep fixed (β z)) u = + integerSampledLowTags J k β (finiteSplitPoint keep u fixed) := by + funext i + exact freezePolynomial_eval keep fixed (β (Sum.inr (lowTaggedIndex J k i))) u + +variable {m : ℕ} {G X : Type*} [Fintype G] {I E J : Fin m → Type*} +variable [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +noncomputable def allocatedFrozenIntegerFullChart + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) : + X ⊕ (Σ j, J j) → MvPolynomial {i // keep i} ℤ := + fun z => freezePolynomial keep fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample z) + +theorem allocatedFrozenIntegerFullChart_support + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) : + ∀ i, integerSampledRealChart + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) i ∈ + weightedSupportLE (fun _ : {i // keep i} => 1) (fullTaggedVariableWeight J i) := by + intro i + change integerSampledRealChart (fun z => freezePolynomial keep fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample z)) i ∈ _ + rw [integerSampledRealChart_freeze] + exact freezePolynomial_support keep _ + (allocatedRecoveredIntegerFullChart_support B U b o poly hm c a v sample i) + +theorem allocatedFrozenIntegerFullChart_spatial + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) + (u : {i // keep i} → ℤ) : + integerSampledSpatial + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) u = + jointIntegerPhysicalSite (finiteSplitPoint keep u fixed) (a, v) := by + change integerSampledSpatial (fun z => freezePolynomial keep fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample z)) u = _ + rw [integerSampledSpatial_freeze, allocatedRecoveredIntegerFullChart_spatial] + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFrozenFullChart_low_residual + (hσ1 : ∀ j, σ j ≤ 1) (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm v‖ ≤ C j * ‖v‖) + (hsmall : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ 1 / 8) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (poly j)) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) + (hfixed : ∀ i, 0 ≤ fixed i ∧ fixed i < + Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) i.val) + (k : ℕ) (u : {i // keep i} → ℤ) + (hu : u ∈ integerBox (fun i : {i // keep i} => + Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) i.val)) + (i : Fin (Fintype.card (LowTaggedIndex J k))) : + |MvPolynomial.eval + (fun z => (integerSampledSpatial + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) u z : ℝ)) + (lowTaggedPolynomial J k poly i) - (c (lowTaggedIndex J k i).1).val (lowTaggedIndex J k i).2 - + (integerSampledLowTags J k + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) u i : ℝ)| ≤ 1 / 8 := by + have hs := integerSampledSpatial_freeze + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) keep fixed u + have ht := integerSampledLowTags_freeze J k + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) keep fixed u + change integerSampledSpatial + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) u = _ at hs + change integerSampledLowTags J k + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) u = _ at ht + rw [hs, ht] + exact h.integerFullChart_low_residual B U b hb o S hR hσ poly hm hσ1 C hC hchart hsmall hp + c a v sample read k (finiteSplitPoint keep u fixed) + (allocatedFrozenParameterBox_bound B U b S keep fixed hfixed u hu) i + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module Submodule VectorPolynomial +open scoped TensorProduct + +variable {A V L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +attribute [local irreducible] realChartSubstitute weightedAdaptedRealChartLie weightedAdaptedRealChartHom + +theorem weightedAdaptedRealChartHom_integer_freeze + (w : A → ℕ) (β : A → MvPolynomial V ℤ) + (keep : V → Prop) (fixed : {i // ¬keep i} → ℤ) + (hβ : ∀ i, integerSampledRealChart β i ∈ weightedSupportLE (fun _ : V => 1) (w i)) + (hfreeze : ∀ i, integerSampledRealChart (fun z => freezePolynomial keep fixed (β z)) i ∈ + weightedSupportLE (fun _ : {i // keep i} => 1) (w i)) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + F.weightedAdaptedRealChartHom w (fun _ : {i // keep i} => 1) + (integerSampledRealChart (fun z => freezePolynomial keep fixed (β z))) hfreeze g = + F.weightedAdaptedRealChartHom (fun _ : V => 1) (fun _ : {i // keep i} => 1) + (frozenCoordinate keep (fun i => (fixed i : ℝ))) + (frozenCoordinate_support keep (fun i => (fixed i : ℝ))) + (F.weightedAdaptedRealChartHom w (fun _ : V => 1) (integerSampledRealChart β) hβ g) := by + have hchart : integerSampledRealChart (fun z => freezePolynomial keep fixed (β z)) = + fun i => MvPolynomial.aeval (frozenCoordinate keep (fun j => (fixed j : ℝ))) + (integerSampledRealChart β i) := by + funext i + exact integerSampledRealChart_freeze β keep fixed i + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + simp only [weightedAdaptedRealChartHom_coord] + rw [hchart] + exact (realChartSubstitute_comp (integerSampledRealChart β) + (frozenCoordinate keep (fun i => (fixed i : ℝ))) _).symm + +variable {m : ℕ} {G X : Type*} [Fintype G] {I J : Fin m → Type*} +variable [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +theorem weightedAdaptedRealChartHom_allocatedFrozenIntegerFullChart + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) + (g : (F.realification.adaptedPolynomialFiltration + (fullTaggedVariableWeight (X := X) J)).Group) : + F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) (fun _ : {i // keep i} => 1) + (integerSampledRealChart + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed)) + (allocatedFrozenIntegerFullChart_support B U b o poly hm c a v sample keep fixed) g = + F.weightedAdaptedRealChartHom (fun _ : LayerSamplerVariables G I n B => 1) + (fun _ : {i // keep i} => 1) + (frozenCoordinate keep (fun i => (fixed i : ℝ))) + (frozenCoordinate_support keep (fun i => (fixed i : ℝ))) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : LayerSamplerVariables G I n B => 1) + (integerSampledRealChart (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample)) + (allocatedRecoveredIntegerFullChart_support B U b o poly hm c a v sample) g) := by + exact F.weightedAdaptedRealChartHom_integer_freeze (fullTaggedVariableWeight J) + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample) keep fixed + (allocatedRecoveredIntegerFullChart_support B U b o poly hm c a v sample) + (allocatedFrozenIntegerFullChart_support B U b o poly hm c a v sample keep fixed) g + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped TensorProduct + +attribute [local irreducible] weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom + +namespace CertifiedFullChartFiniteHistory + +variable {m s : ℕ} {G X ι η L : Type} [Fintype G] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {I J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) [∀ k, Fintype (B k)] + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (btag : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (Utag j))ᗮ) + (otag : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (Utag j))) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ Utag j) + {fast : Submodule ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))} + {lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded} + {Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)} {N : X → ℕ} {Bphase : ℝ} + +theorem allocatedFrozen_terminal_mem_fast + (history : CertifiedFullChartFiniteHistory F b ω hF J fast basis lift + Z Kinitial Utag poly N Bphase s) + (hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (c : ∀ j, Utag j) (origin : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) + (g : (F.realification.adaptedPolynomialFiltration + (fullTaggedVariableWeight (X := X) J)).Group) + (hZ : F.realPolynomialSymbolHom b ω hF (fullTaggedVariableWeight J) g = Z) + (htop : ∀ u : {i // keep i} → ℝ, + (fun z => MvPolynomial.eval u (homogeneousComponent (fullTaggedVariableWeight J z) + (integerSampledRealChart + (allocatedFrozenIntegerFullChart B Utag btag otag poly hm + c origin v sample keep fixed) z))) ∈ history.K) : + let β := allocatedFrozenIntegerFullChart B Utag btag otag poly hm + c origin v sample keep fixed + let pull := F.realSymbolHomogeneousPullbackHom b ω hF (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) + (fun z => homogeneousComponent (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + (fun z => sampledTopPhase_coordinate_homogeneous + (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + ∀ u : {i // keep i} → ℝ, + eval₂ u (F.realGradedSymbolPolynomial b ω hF (fun _ : {i // keep i} => 1) + ((pull history.outer.1)⁻¹ * + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) (integerSampledRealChart β) + (allocatedFrozenIntegerFullChart_support B Utag btag otag poly hm + c origin v sample keep fixed) g) * + (pull history.outer.2)⁻¹).coord) ∈ fast.baseChange ℝ := by + intro β pull u + have hactual : F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) (integerSampledRealChart β) + (allocatedFrozenIntegerFullChart_support B Utag btag otag poly hm + c origin v sample keep fixed) g) = pull Z := by + rw [F.realPolynomialSymbolHom_weightedAdaptedRealChart b ω hF + (fullTaggedVariableWeight J) (fun _ : {i // keep i} => 1) + (integerSampledRealChart β) + (allocatedFrozenIntegerFullChart_support B Utag btag otag poly hm + c origin v sample keep fixed) g, hZ] + rfl + rw [hactual, ← map_inv, ← map_inv, ← map_mul, ← map_mul] + simp only [pull, F.realSymbolHomogeneousPullbackHom_coord] + rw [F.realGradedSymbolPolynomial_homogeneousPullback b ω hF + (fullTaggedVariableWeight J) (fun _ : {i // keep i} => 1) + (fun z => homogeneousComponent (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + (fun z => sampledTopPhase_coordinate_homogeneous + (fullTaggedVariableWeight J z) (integerSampledRealChart β z)), eval₂_realChartSubstitute] + exact history.terminal_mem_fast hfast _ (htop u) + +theorem allocatedFrozen_terminal_mem_symbolPointwiseSubalgebra + (W : LieSubalgebra ℚ F.AssociatedGraded) + {basisW : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ W.toSubmodule))} + {liftW : (F.AssociatedGraded ⧸ W.toSubmodule) →ₗ[ℚ] F.AssociatedGraded} + (history : CertifiedFullChartFiniteHistory F b ω hF J W.toSubmodule basisW liftW + Z Kinitial Utag poly N Bphase s) + (hW : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule) + (c : ∀ j, Utag j) (origin : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (keep : LayerSamplerVariables G I n B → Prop) (fixed : {i // ¬keep i} → ℤ) + (g : (F.realification.adaptedPolynomialFiltration + (fullTaggedVariableWeight (X := X) J)).Group) + (hZ : F.realPolynomialSymbolHom b ω hF (fullTaggedVariableWeight J) g = Z) + (htop : ∀ u : {i // keep i} → ℝ, + (fun z => MvPolynomial.eval u (homogeneousComponent (fullTaggedVariableWeight J z) + (integerSampledRealChart + (allocatedFrozenIntegerFullChart B Utag btag otag poly hm + c origin v sample keep fixed) z))) ∈ history.K) : + let β := allocatedFrozenIntegerFullChart B Utag btag otag poly hm + c origin v sample keep fixed + let pull := F.realSymbolHomogeneousPullbackHom b ω hF (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) + (fun z => homogeneousComponent (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + (fun z => sampledTopPhase_coordinate_homogeneous + (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + ((pull history.outer.1)⁻¹ * + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) (integerSampledRealChart β) + (allocatedFrozenIntegerFullChart_support B Utag btag otag poly hm + c origin v sample keep fixed) g) * + (pull history.outer.2)⁻¹).coord ∈ realificationLieSubalgebra + (F.symbolPointwiseSubalgebra b ω hF (fun _ : {i // keep i} => 1) W) := by + intro β pull + apply (F.mem_real_symbolPointwiseSubalgebra_iff_values b ω hF + (fun _ : {i // keep i} => 1) W _).mpr + exact history.allocatedFrozen_terminal_mem_fast B Utag btag otag poly hm hW + c origin v sample keep fixed g hZ htop + +end CertifiedFullChartFiniteHistory +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartRationalTerminal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartRationalTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8e8f401f1916d40185a822923ce1d6e3c691ec6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartRationalTerminal.lean @@ -0,0 +1,80 @@ +import OAI.Combinatorics.Progressions.Estimates.FullTaggedRationalRetraction + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped TensorProduct + +namespace CertifiedFullChartFiniteHistory + +variable {m s : ℕ} {X ι η L : Type} [Fintype ι] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {J : Fin m → Type} [∀ j, Fintype (J j)] + {W : LieSubalgebra ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ W.toSubmodule))} + {lift : (F.AssociatedGraded ⧸ W.toSubmodule) →ₗ[ℚ] F.AssociatedGraded} + {Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {Utag : ∀ j, Submodule ℝ (J j → ℝ)} + {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} {N : X → ℕ} {Bphase : ℝ} + +local notation "wt" => fullTaggedVariableWeight (X := X) J + +theorem exists_rational_affine_globalMarkedNativeFactors + (history : CertifiedFullChartFiniteHistory F b ω hF J W.toSubmodule basis lift + Z Set.univ Utag poly N Bphase s) + (hW : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule) + (g : (F.realification.adaptedPolynomialFiltration wt).Group) + (hZ : F.realPolynomialSymbolHom b ω hF wt g = Z) + {p : ℝ} {blocks : ℕ} + (hcert : RationalTaggedConstraintCertificate J Set.univ history.K p blocks) + (hp : 0 ≤ p) (hdim : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hblocks : (blocks : ℝ) ≤ p) : + let q := p + ((p + 2) ^ 2 + 2) ^ 63 + ∃ (V : ∀ j, Submodule ℚ (J j → ℚ)) + (P : ∀ j, Matrix (J j) (J j) ℚ) (D : Fin m → ℕ), + history.K = {t | ∀ j, (fun i => t (Sum.inr ⟨j, i⟩)) ∈ + realRationalCoordinateSpan (V j)} ∧ + (∀ j, + LinearMap.range (fullTaggedRealMatrixProjection J P j) = realRationalCoordinateSpan (V j) ∧ + (∀ x ∈ realRationalCoordinateSpan (V j), fullTaggedRealMatrixProjection J P j x = x) ∧ + (∀ i a, rationalLogHeight (P j i a) ≤ (q + 2) ^ 8) ∧ + 0 < D j ∧ (D j : ℝ) ≤ Real.exp ((q + 2) ^ 10) ∧ + (∀ i a, ∃ z : ℤ, (D j : ℝ) * (P j i a : ℝ) = (z : ℝ)) ∧ + ∀ (l : ℕ) (x : J j → ℝ), x ∈ realDenominatorGrid l → + fullTaggedRealMatrixProjection J P j x ∈ realDenominatorGrid (D j * l)) ∧ + ∀ c : ∀ j, J j → ℝ, + let β := fullTaggedAffineMapChart (X := X) J (fullTaggedRealMatrixProjection J P) c + let pull := F.realSymbolHomogeneousPullbackHom b ω hF wt wt + (fun i => weightedHomogeneousComponent wt (wt i) (β i)) + (fun _i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) + Nonempty (GlobalMarkedNativeFactors F b ω hF wt W + (F.weightedAdaptedRealChartHom wt wt β + (fullTaggedAffineMapChart_support J _ c) g) + (pull history.outer.1) (pull history.outer.2)) := by + intro q + obtain ⟨V, P, D, hK, hP⟩ := hcert.exists_bounded_rational_retractions J hp hdim hblocks + refine ⟨V, P, D, hK, hP, ?_⟩ + intro c + apply history.nonempty_globalMarkedNativeFactors hW _ _ g hZ + intro t + apply fullTaggedAffineMapChart_top_mem_set J (fullTaggedRealMatrixProjection J P) c + (fun j => realRationalCoordinateSpan (V j)) + · intro j x + rw [← (hP j).1] + exact ⟨x, rfl⟩ + · intro y hy + rw [hK] + exact hy + +end CertifiedFullChartFiniteHistory +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartRecoveredTerminal.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartRecoveredTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad34ff64a925dd103a594e8339458cdc27ef3b13 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CertifiedFullChartRecoveredTerminal.lean @@ -0,0 +1,494 @@ +import OAI.Combinatorics.Progressions.Estimates.Separation +import OAI.Combinatorics.Progressions.Geometry.CertifiedFullChartFrozenTerminal +import OAI.Combinatorics.Progressions.Polynomial.FrozenPolynomialAffineRange + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +theorem canonicalCoefficientSample_floor_coeff_sum + (sample : CoefficientSamplerArrays (K := K) I n) (c : CoefficientArray (K := K) U) + (hc : canonicalCoefficientSample U b hb o sample = QuotientAddGroup.mk' (coefficientIntegerLattice U) c) + (j : Fin m) (d : BoundedCoefficientExponent K (j.val + 1)) : + (fun i => mixedLiftCoefficient (euclideanSubspace (U j)) (b j) (o j) (sample j) d i) + + (fun i => (((coefficientIntegerFloorPolynomial U b o sample c j i).coeff d.val : ℤ) : ℝ)) = + (c ⟨j, d⟩).val := by + funext i + have h := congrArg (fun polynomial : MvPolynomial K ℝ => polynomial.coeff d.val) + (canonicalCoefficientSample_floor_polynomial_remainder U b hb o sample c hc j i).1 + simp only [coefficientRowPolynomial, monomialArrayPolynomial_coeff _ Subtype.val_injective, + AddMonoidAlgebra.coeff_add, Finsupp.add_apply, + mixedLiftPolynomial_coeff _ _ _ _ Subtype.val_injective, coeff_map, + Int.coe_castRingHom] at h + exact h.symm + +theorem canonicalCoefficientSample_floor_coeff_separate + (sample : CoefficientSamplerArrays (K := K) I n) (c : CoefficientArray (K := K) U) + (hc : canonicalCoefficientSample U b hb o sample = QuotientAddGroup.mk' (coefficientIntegerLattice U) c) + (j : Fin m) (d : BoundedCoefficientExponent K (j.val + 1)) + {T : Type*} (Q : (J j → ℝ) →ₗ[ℝ] (T → ℝ)) + (hQU : U j ≤ LinearMap.ker Q) {D : ℝ} (hD : 0 < D) + (hgrid : ∀ z : J j → ℤ, ∀ t, ∃ a : ℤ, D * Q (fun i => (z i : ℝ)) t = a) + (hsmall : ∀ t, |Q (fun i => mixedLiftCoefficient (euclideanSubspace (U j)) + (b j) (o j) (sample j) d i) t| < 1 / D) : + Q (fun i => (((coefficientIntegerFloorPolynomial U b o sample c j i).coeff d.val : ℤ) : ℝ)) = 0 := by + apply (separate_kernel Q _ _ hD ?_ (hgrid _) hsmall).2 + rw [canonicalCoefficientSample_floor_coeff_sum U b hb o sample c hc j d] + exact hQU (c ⟨j, d⟩).property + +end Erdos3.VectorPolynomial + +namespace Erdos3 + +theorem monomialScale_mapDomain_embedding {A B : Type*} + (f : A ↪ B) (T : B → ℝ) (α : A →₀ ℕ) : + monomialScale T (α.mapDomain f) = monomialScale (fun i => T (f i)) α := by + exact Finsupp.prod_mapDomain_index_inj f.injective + +end Erdos3 + +namespace Erdos3.VectorPolynomial +open Module Submodule _root_.MvPolynomial _root_.OAI.MvPolynomial BooleanCubeKernel +open scoped BigOperators + +variable {m : ℕ} {G X : Type*} [Fintype G] {I E J : Fin m → Type*} +variable [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_long_coeff + (hσ1 : ∀ j, σ j ≤ 1) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (j : Fin m) {T Long : Type*} + (keep : Long ↪ LayerSamplerVariables G I n B) + (Q : (J j → ℝ) →ₗ[ℝ] (T → ℝ)) (hQU : U j ≤ LinearMap.ker Q) + {C CQ D H : ℝ} (hC : 0 ≤ C) (hCQ : 0 ≤ CQ) (hD : 0 < D) (hH : 1 ≤ H) + (hchart : ∀ x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ C * ‖x‖) + (hQ : ∀ x t, |Q x t| ≤ CQ * ‖x‖) + (hgrid : ∀ z : J j → ℤ, ∀ t, ∃ a : ℤ, D * Q (fun i => (z i : ℝ)) t = a) + (hlong : ∀ i, H ≤ layerSamplerBox B U b S (keep i)) + (hthreshold : CQ * (C * (((Fintype.card (I j) : ℝ) + 1) * R j)) * D < H) + (α : Long →₀ ℕ) (hα : α ≠ 0) (hdegree : α.degree ≤ j.val + 1) : + Q (fun i => (((allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample + (Sum.inr ⟨j, i⟩)).coeff (α.mapDomain keep) : ℤ) : ℝ)) = 0 := by + let frame : Option (LayerSamplerVariables G I n B) → X → ℝ := + fun k z => (jointIntegerFrame (a, v) k z : ℝ) + let d : BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1) := + ⟨α.mapDomain keep, by simpa only [Finsupp.degree_mapDomain] using hdegree⟩ + have hc : canonicalCoefficientSample U b hb o sample = + QuotientAddGroup.mk' (coefficientIntegerLattice U) + (centeredAffineCoefficientArray U poly hm c frame) := + h.2.1.trans (affineSampleCoefficientTorus_subtractConstant U poly hm c frame) + change Q (fun i => (((coefficientIntegerFloorPolynomial U b o sample + (centeredAffineCoefficientArray U poly hm c frame) j i).coeff d.val : ℤ) : ℝ)) = 0 + apply canonicalCoefficientSample_floor_coeff_separate U b hb o sample _ hc j d Q hQU hD hgrid + let M : ℝ := C * (((Fintype.card (I j) : ℝ) + 1) * R j) + let scale : ℝ := monomialScale (layerSamplerBox B U b S) d.val + have hscale : 0 < scale := monomialScale_pos _ + (fun i => lt_of_lt_of_le zero_lt_one (layerSamplerBox_one_le B U b S i)) d.val + have hM : 0 ≤ M := mul_nonneg hC (mul_nonneg (by positivity) (hR j).le) + have hnorm : ‖fun i => mixedLiftCoefficient (euclideanSubspace (U j)) + (b j) (o j) (sample j) d i‖ ≤ M / scale := by + apply (pi_norm_le_iff_of_nonneg (div_nonneg hM hscale.le)).mpr + intro i + simpa only [Real.norm_eq_abs] using + allocatedLayerLiftCoefficient_radius_bound B U b hR hσ S hσ1 o j hC hchart + (sample j) (h.2.2.1 j).2 d i + have hscaleH : H ≤ scale := by + change H ≤ monomialScale (layerSamplerBox B U b S) (α.mapDomain keep) + rw [monomialScale_mapDomain_embedding] + exact le_monomialScale_of_ne_zero _ hH hlong hα + intro t + calc + _ ≤ CQ * ‖fun i => mixedLiftCoefficient (euclideanSubspace (U j)) + (b j) (o j) (sample j) d i‖ := hQ _ t + _ ≤ CQ * (M / scale) := mul_le_mul_of_nonneg_left hnorm hCQ + _ = (CQ * M) / scale := (mul_div_assoc CQ M scale).symm + _ < 1 / D := (div_lt_div_iff₀ hscale hD).mpr (by + simpa only [one_mul] using hthreshold.trans_le hscaleH) + +theorem allocatedRecoveredIntegerFullChart_tag_degree + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (j : Fin m) (i : J j) : + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample + (Sum.inr ⟨j, i⟩)).totalDegree ≤ j.val + 1 := + coefficientIntegerFloorPolynomial_degree U b o sample _ j i + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_frozen_top_range + (hσ1 : ∀ j, σ j ≤ 1) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (j : Fin m) {T : Type*} + (keep : LayerSamplerVariables G I n B → Prop) + (Q : (J j → ℝ) →ₗ[ℝ] (T → ℝ)) (hQU : U j ≤ LinearMap.ker Q) + (Ktarget : Submodule ℝ (J j → ℝ)) (hker : LinearMap.ker Q ≤ Ktarget) + {C CQ D H : ℝ} (hC : 0 ≤ C) (hCQ : 0 ≤ CQ) (hD : 0 < D) (hH : 1 ≤ H) + (hchart : ∀ x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ C * ‖x‖) + (hQ : ∀ x t, |Q x t| ≤ CQ * ‖x‖) + (hgrid : ∀ z : J j → ℤ, ∀ t, ∃ a : ℤ, D * Q (fun i => (z i : ℝ)) t = a) + (hlong : ∀ i, keep i → H ≤ layerSamplerBox B U b S i) + (hthreshold : CQ * (C * (((Fintype.card (I j) : ℝ) + 1) * R j)) * D < H) + (fixed : {i // ¬ keep i} → ℤ) (x : {i // keep i} → ℝ) : + (fun i => MvPolynomial.eval x (homogeneousComponent (j.val + 1) + (MvPolynomial.map (Int.castRingHom ℝ) (freezePolynomial keep fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample + (Sum.inr ⟨j, i⟩)))))) ∈ Ktarget := by + apply longChart_frozen_top_eval_mem + (fun i => allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample + (Sum.inr ⟨j, i⟩)) keep fixed (j.val + 1) + (allocatedRecoveredIntegerFullChart_tag_degree B U b o poly hm c a v sample j) + intro α hdegree + apply hker + apply h.integerFullChart_long_coeff B U b hb o S hR hσ poly hm hσ1 c a v sample read j + ⟨Subtype.val, Subtype.val_injective⟩ Q hQU hC hCQ hD hH hchart hQ hgrid + (fun i => hlong i.val i.property) hthreshold α _ hdegree.le + intro hz + simp [hz] at hdegree + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule _root_.MvPolynomial _root_.OAI.MvPolynomial BooleanCubeKernel +open scoped BigOperators + +variable {m : ℕ} {G X : Type*} [Fintype G] {I E J : Fin m → Type*} +variable [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFullChart_certified_frozen_top_range + (hσ1 : ∀ j, σ j ≤ 1) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (K : Set ((X ⊕ (Σ j, J j)) → ℝ)) {Bstage p M H : ℝ} {blocks : ℕ} + (hcertificate : RationalTaggedConstraintCertificate J Set.univ K Bstage blocks) + (hretained : ∀ t, (∀ j, (fun i => t (Sum.inr ⟨j, i⟩)) ∈ U j) → t ∈ K) + (hp : 0 ≤ p) (hBp : Bstage ≤ p) (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ C j * ‖x‖) + (hM : 0 ≤ M) (hcap : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ M) + (keep : LayerSamplerVariables G I n B → Prop) (hH : 1 ≤ H) + (hlong : ∀ i, keep i → H ≤ layerSamplerBox B U b S i) + (hthreshold : Real.exp ((p + 2) ^ 9) ^ 2 * M < H) + (fixed : {i // ¬ keep i} → ℤ) (x : {i // keep i} → ℝ) : + (fun i => MvPolynomial.eval x (homogeneousComponent (fullTaggedVariableWeight J i) + (integerSampledRealChart + (fun z => freezePolynomial keep fixed + (allocatedRecoveredIntegerFullChart B U b o poly hm c a v sample z)) i))) ∈ K := by + obtain ⟨cs, _, hbudget, hK⟩ := hcertificate + rw [hK] + refine ⟨Set.mem_univ _, ?_⟩ + intro constraint hc + have hspan : U constraint.tag ≤ + span ℝ (Set.range (fun q i => (constraint.generators q i : ℝ))) := by + apply constraint.retained_le_span U hretained + intro point hpoint + rw [hK] at hpoint + exact hpoint.2 constraint hc + obtain ⟨d, _, Q, hker, hQ, D, hD, hDbound, hgrid⟩ := + exists_rationalTaggedSpanProjection constraint.generators hp (hJ constraint.tag) + ((hbudget constraint hc).1.trans hBp) + (fun q i => ((hbudget constraint hc).2 q i).trans hBp) + have hQU : U constraint.tag ≤ LinearMap.ker Q := by + rw [hker] + exact hspan + have hgrid' : ∀ z : J constraint.tag → ℤ, ∀ t, + ∃ a : ℤ, (D : ℝ) * Q (fun i => (z i : ℝ)) t = a := by + intro z t + obtain ⟨w, hw⟩ := hgrid z + exact ⟨w t, (hw t).symm⟩ + have hnumeric : Real.exp ((p + 2) ^ 9) * + (C constraint.tag * (((Fintype.card (I constraint.tag) : ℝ) + 1) * R constraint.tag)) * + (D : ℝ) < H := by + have hE := Real.exp_nonneg ((p + 2) ^ 9) + calc + _ ≤ Real.exp ((p + 2) ^ 9) * M * (D : ℝ) := + mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (hcap constraint.tag) hE) + (Nat.cast_nonneg D) + _ ≤ Real.exp ((p + 2) ^ 9) * M * Real.exp ((p + 2) ^ 9) := + mul_le_mul_of_nonneg_left hDbound (mul_nonneg hE hM) + _ = Real.exp ((p + 2) ^ 9) ^ 2 * M := by ring + _ < H := hthreshold + exact h.integerFullChart_frozen_top_range B U b hb o S hR hσ poly hm hσ1 c a v sample read + constraint.tag keep Q hQU _ (le_of_eq hker) (hC constraint.tag) + (Real.exp_nonneg _) (by exact_mod_cast hD) hH (hchart constraint.tag) hQ hgrid' + hlong hnumeric fixed x + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule _root_.MvPolynomial _root_.OAI.MvPolynomial BooleanCubeKernel +open scoped BigOperators + +variable {m : ℕ} {G X : Type*} [Fintype G] {I E J : Fin m → Type*} +variable [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ k, Fintype (B k)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (hm : ∀ j d, coefficients (poly j) d ∈ U j) + +theorem AllocatedCenteredFramedRecoveredSampleAt.integerFrozenFullChart_certified_top_range + (hσ1 : ∀ j, σ j ≤ 1) + (c : ∀ j, U j) (a : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (h : AllocatedCenteredFramedRecoveredSampleAt B U b hb o S hR hσ poly hm c a v sample read) + (K : Set ((X ⊕ (Σ j, J j)) → ℝ)) {Bstage p M H : ℝ} {blocks : ℕ} + (hcertificate : RationalTaggedConstraintCertificate J Set.univ K Bstage blocks) + (hretained : ∀ t, (∀ j, (fun i => t (Sum.inr ⟨j, i⟩)) ∈ U j) → t ∈ K) + (hp : 0 ≤ p) (hBp : Bstage ≤ p) (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ C j * ‖x‖) + (hM : 0 ≤ M) (hcap : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ M) + (keep : LayerSamplerVariables G I n B → Prop) (hH : 1 ≤ H) + (hlong : ∀ i, keep i → H ≤ layerSamplerBox B U b S i) + (hthreshold : Real.exp ((p + 2) ^ 9) ^ 2 * M < H) + (fixed : {i // ¬ keep i} → ℤ) (x : {i // keep i} → ℝ) : + (fun i => MvPolynomial.eval x (homogeneousComponent (fullTaggedVariableWeight J i) + (integerSampledRealChart + (allocatedFrozenIntegerFullChart B U b o poly hm c a v sample keep fixed) i))) ∈ K := by + exact h.integerFullChart_certified_frozen_top_range B U b hb o S hR hσ poly hm + hσ1 c a v sample read K hcertificate hretained hp hBp hJ C hC hchart hM hcap + keep hH hlong hthreshold fixed x + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped TensorProduct + +attribute [local irreducible] weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom + +namespace CertifiedFullChartFiniteHistory + +variable {m s : ℕ} {G X ι η L : Type} [Fintype G] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {I E J : Fin m → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) [∀ k, Fintype (B k)] + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (btag : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (Utag j))ᗮ) + (hbtag : ∀ j, Submodule.span ℤ (Set.range (btag j)) = + projectedIntegerLattice (euclideanSubspace (Utag j))) + (otag : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (Utag j))) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B Utag btag R σ) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j d, coefficients (poly j) d ∈ Utag j) + {fast : Submodule ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))} + {lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded} + {Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {N : X → ℕ} {Bphase Bcertificate p M H : ℝ} + +theorem allocatedRecovered_terminal_mem_fast_of_certificate + (history : CertifiedFullChartFiniteHistory F b ω hF J fast basis lift + Z Set.univ Utag poly N Bphase s) + (hcertificate : RationalTaggedConstraintCertificate J Set.univ history.K Bcertificate + (s * (Fintype.card η * m))) + (hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (hσ1 : ∀ j, σ j ≤ 1) + (c : ∀ j, Utag j) (origin : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (hrecovered : AllocatedCenteredFramedRecoveredSampleAt B Utag btag hbtag otag + S hR hσ poly hm c origin v sample read) + (hp : 0 ≤ p) (hBp : Bcertificate ≤ p) (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j x, + ‖(normalizedOrthogonalChart (euclideanSubspace (Utag j)) (btag j)).symm x‖ ≤ C j * ‖x‖) + (hM : 0 ≤ M) (hcap : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ M) + (keep : LayerSamplerVariables G I n B → Prop) (hH : 1 ≤ H) + (hlong : ∀ i, keep i → H ≤ layerSamplerBox B Utag btag S i) + (hthreshold : Real.exp ((p + 2) ^ 9) ^ 2 * M < H) + (fixed : {i // ¬keep i} → ℤ) + (g : (F.realification.adaptedPolynomialFiltration + (fullTaggedVariableWeight (X := X) J)).Group) + (hZ : F.realPolynomialSymbolHom b ω hF (fullTaggedVariableWeight J) g = Z) : + let β := allocatedFrozenIntegerFullChart B Utag btag otag poly hm + c origin v sample keep fixed + let pull := F.realSymbolHomogeneousPullbackHom b ω hF (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) + (fun z => homogeneousComponent (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + (fun z => sampledTopPhase_coordinate_homogeneous + (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + ∀ u : {i // keep i} → ℝ, + eval₂ u (F.realGradedSymbolPolynomial b ω hF (fun _ : {i // keep i} => 1) + ((pull history.outer.1)⁻¹ * + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) (integerSampledRealChart β) + (allocatedFrozenIntegerFullChart_support B Utag btag otag poly hm + c origin v sample keep fixed) g) * + (pull history.outer.2)⁻¹).coord) ∈ fast.baseChange ℝ := by + apply history.allocatedFrozen_terminal_mem_fast B Utag btag otag poly hm hfast + c origin v sample keep fixed g hZ + intro u + exact hrecovered.integerFrozenFullChart_certified_top_range B Utag btag hbtag otag + S hR hσ poly hm hσ1 c origin v sample read history.K hcertificate + (fun t ht => history.retained t (Set.mem_univ _) ht) hp hBp hJ C hC hchart hM hcap + keep hH hlong hthreshold fixed u + +theorem allocatedRecovered_terminal_mem_symbolPointwiseSubalgebra_of_certificate + (W : LieSubalgebra ℚ F.AssociatedGraded) + {basisW : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ W.toSubmodule))} + {liftW : (F.AssociatedGraded ⧸ W.toSubmodule) →ₗ[ℚ] F.AssociatedGraded} + (history : CertifiedFullChartFiniteHistory F b ω hF J W.toSubmodule basisW liftW + Z Set.univ Utag poly N Bphase s) + (hcertificate : RationalTaggedConstraintCertificate J Set.univ history.K Bcertificate + (s * (Fintype.card η * m))) + (hW : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule) + (hσ1 : ∀ j, σ j ≤ 1) + (c : ∀ j, Utag j) (origin : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (hrecovered : AllocatedCenteredFramedRecoveredSampleAt B Utag btag hbtag otag + S hR hσ poly hm c origin v sample read) + (hp : 0 ≤ p) (hBp : Bcertificate ≤ p) (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j x, + ‖(normalizedOrthogonalChart (euclideanSubspace (Utag j)) (btag j)).symm x‖ ≤ C j * ‖x‖) + (hM : 0 ≤ M) (hcap : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ M) + (keep : LayerSamplerVariables G I n B → Prop) (hH : 1 ≤ H) + (hlong : ∀ i, keep i → H ≤ layerSamplerBox B Utag btag S i) + (hthreshold : Real.exp ((p + 2) ^ 9) ^ 2 * M < H) + (fixed : {i // ¬keep i} → ℤ) + (g : (F.realification.adaptedPolynomialFiltration + (fullTaggedVariableWeight (X := X) J)).Group) + (hZ : F.realPolynomialSymbolHom b ω hF (fullTaggedVariableWeight J) g = Z) : + let β := allocatedFrozenIntegerFullChart B Utag btag otag poly hm + c origin v sample keep fixed + let pull := F.realSymbolHomogeneousPullbackHom b ω hF (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) + (fun z => homogeneousComponent (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + (fun z => sampledTopPhase_coordinate_homogeneous + (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + ((pull history.outer.1)⁻¹ * + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) (integerSampledRealChart β) + (allocatedFrozenIntegerFullChart_support B Utag btag otag poly hm + c origin v sample keep fixed) g) * + (pull history.outer.2)⁻¹).coord ∈ realificationLieSubalgebra + (F.symbolPointwiseSubalgebra b ω hF (fun _ : {i // keep i} => 1) W) := by + intro β pull + apply (F.mem_real_symbolPointwiseSubalgebra_iff_values b ω hF + (fun _ : {i // keep i} => 1) W _).mpr + exact history.allocatedRecovered_terminal_mem_fast_of_certificate B Utag btag hbtag otag S hR hσ + poly hm hcertificate hW hσ1 c origin v sample read hrecovered hp hBp hJ C hC hchart hM hcap + keep hH hlong hthreshold fixed g hZ + +theorem StageBounds.allocatedRecovered_terminal_mem_symbolPointwiseSubalgebra + {cap cumulative : ℕ → ℝ} + (W : LieSubalgebra ℚ F.AssociatedGraded) + {basisW : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ W.toSubmodule))} + {liftW : (F.AssociatedGraded ⧸ W.toSubmodule) →ₗ[ℚ] F.AssociatedGraded} + (history : CertifiedFullChartFiniteHistory F b ω hF J W.toSubmodule basisW liftW + Z Set.univ Utag poly N Bphase s) + (hstage : StageBounds cap cumulative history) + (hW : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule) + (hσ1 : ∀ j, σ j ≤ 1) + (c : ∀ j, Utag j) (origin : X → ℤ) + (v : Option (LayerSamplerVariables G I n B) × X → ℤ) + (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (read : AllocatedActualCoefficientIndex G X I E n B → ℤ) + (hrecovered : AllocatedCenteredFramedRecoveredSampleAt B Utag btag hbtag otag + S hR hσ poly hm c origin v sample read) + (hp : 0 ≤ p) (hBp : cumulative s ≤ p) (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j x, + ‖(normalizedOrthogonalChart (euclideanSubspace (Utag j)) (btag j)).symm x‖ ≤ C j * ‖x‖) + (hM : 0 ≤ M) (hcap : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * R j) ≤ M) + (keep : LayerSamplerVariables G I n B → Prop) (hH : 1 ≤ H) + (hlong : ∀ i, keep i → H ≤ layerSamplerBox B Utag btag S i) + (hthreshold : Real.exp ((p + 2) ^ 9) ^ 2 * M < H) + (fixed : {i // ¬keep i} → ℤ) + (g : (F.realification.adaptedPolynomialFiltration + (fullTaggedVariableWeight (X := X) J)).Group) + (hZ : F.realPolynomialSymbolHom b ω hF (fullTaggedVariableWeight J) g = Z) : + let β := allocatedFrozenIntegerFullChart B Utag btag otag poly hm + c origin v sample keep fixed + let pull := F.realSymbolHomogeneousPullbackHom b ω hF (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) + (fun z => homogeneousComponent (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + (fun z => sampledTopPhase_coordinate_homogeneous + (fullTaggedVariableWeight J z) (integerSampledRealChart β z)) + ((pull history.outer.1)⁻¹ * + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight J) + (fun _ : {i // keep i} => 1) (integerSampledRealChart β) + (allocatedFrozenIntegerFullChart_support B Utag btag otag poly hm + c origin v sample keep fixed) g) * + (pull history.outer.2)⁻¹).coord ∈ realificationLieSubalgebra + (F.symbolPointwiseSubalgebra b ω hF (fun _ : {i // keep i} => 1) W) := by + exact history.allocatedRecovered_terminal_mem_symbolPointwiseSubalgebra_of_certificate + B Utag btag hbtag otag S hR hσ poly hm W hstage.certificate hW hσ1 + c origin v sample read hrecovered hp hBp hJ C hC hchart hM hcap + keep hH hlong hthreshold fixed g hZ + +end CertifiedFullChartFiniteHistory +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ChartCutoff.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ChartCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..11ff28f25a1210296e59fe6a9ff97a1832b57ddf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ChartCutoff.lean @@ -0,0 +1,96 @@ +import Mathlib.Topology.Algebra.Support +import Mathlib.Topology.MetricSpace.Lipschitz +import Mathlib.Topology.OpenPartialHomeomorph.Basic + +namespace OAI + +section + +namespace Erdos3 + +open Set +open scoped NNReal + +noncomputable def chartCutoff {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] + (e : OpenPartialHomeomorph E X) (ψ : E → ℝ) (x : X) : ℝ := by + classical + exact if x ∈ e.target then ψ (e.symm x) else 0 + +theorem chartCutoff_apply {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] + (e : OpenPartialHomeomorph E X) (ψ : E → ℝ) {v : E} (hv : v ∈ e.source) : + chartCutoff e ψ (e v) = ψ v := by + simp only [chartCutoff, ite_eq_left (e.map_source hv), e.left_inv hv] + +theorem chartCutoff_range {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] + (e : OpenPartialHomeomorph E X) (ψ : E → ℝ) (hψ : ∀ v, 0 ≤ ψ v ∧ ψ v ≤ 1) (x : X) : + 0 ≤ chartCutoff e ψ x ∧ chartCutoff e ψ x ≤ 1 := by + classical + by_cases hx : x ∈ e.target + · simpa only [chartCutoff, ite_eq_left hx] using hψ (e.symm x) + · simp only [chartCutoff, ite_eq_right hx, le_refl, zero_le_one, and_self] + +theorem tsupport_chartCutoff_subset {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] + [T2Space X] (e : OpenPartialHomeomorph E X) (ψ : E → ℝ) {S : Set E} + (hS : IsCompact S) (hsource : S ⊆ e.source) (hsupport : Function.support ψ ⊆ S) : + tsupport (chartCutoff e ψ) ⊆ e '' S := by + classical + apply closure_minimal ?_ (hS.image_of_continuousOn (e.continuousOn.mono hsource)).isClosed + intro x hx + have hxt : x ∈ e.target := by + by_contra h + exact hx (by simp only [chartCutoff, ite_eq_right h]) + refine ⟨e.symm x, hsupport ?_, e.right_inv hxt⟩ + simpa only [Function.mem_support, chartCutoff, ite_eq_left hxt] using hx + +theorem hasCompactSupport_chartCutoff {E X : Type*} [TopologicalSpace E] [TopologicalSpace X] + [T2Space X] (e : OpenPartialHomeomorph E X) (ψ : E → ℝ) {S : Set E} + (hS : IsCompact S) (hsource : S ⊆ e.source) (hsupport : Function.support ψ ⊆ S) : + HasCompactSupport (chartCutoff e ψ) := + (hS.image_of_continuousOn (e.continuousOn.mono hsource)).of_isClosed_subset + isClosed_closure (tsupport_chartCutoff_subset e ψ hS hsource hsupport) + +theorem lipschitz_chartCutoff {E X : Type*} [MetricSpace E] [MetricSpace X] + (e : OpenPartialHomeomorph E X) (ψ : E → ℝ) (A K δ : ℝ≥0) (hδ : 0 < δ) + (hψ : ∀ v, 0 ≤ ψ v ∧ ψ v ≤ 1) (hLip : LipschitzWith A ψ) + (hInv : LipschitzOnWith K e.symm e.target) + (hgap : ∀ x ∈ e.target, ψ (e.symm x) ≠ 0 → ∀ y ∉ e.target, (δ : ℝ) ≤ dist x y) : + LipschitzWith (A * K + 1 / δ) (chartCutoff e ψ) := by + classical + have hδ' : (0 : ℝ) < δ := hδ + have hcross (x) (hx : x ∈ e.target) (y) (hy : y ∉ e.target) : + dist (ψ (e.symm x)) 0 ≤ ((A * K + 1 / δ : ℝ≥0) : ℝ) * dist x y := by + by_cases hz : ψ (e.symm x) = 0 + · rw [hz, dist_self] + positivity + · have hd := hgap x hx hz y hy + calc + _ = ψ (e.symm x) := by rw [Real.dist_eq, sub_zero, abs_of_nonneg (hψ _).1] + _ ≤ 1 := (hψ _).2 + _ ≤ (1 / (δ : ℝ)) * dist x y := by + have hd' := (div_le_div_iff_of_pos_right hδ').mpr hd + simpa only [div_self (ne_of_gt hδ'), one_div_mul_eq_div] using hd' + _ ≤ _ := by + apply mul_le_mul_of_nonneg_right ?_ dist_nonneg + simp only [NNReal.coe_add, NNReal.coe_mul, NNReal.coe_div, NNReal.coe_one] + exact le_add_of_nonneg_left (mul_nonneg A.coe_nonneg K.coe_nonneg) + apply LipschitzWith.of_dist_le_mul + intro x y + by_cases hx : x ∈ e.target <;> by_cases hy : y ∈ e.target + · simp only [chartCutoff, ite_eq_left hx, ite_eq_left hy] + calc + _ ≤ (A : ℝ) * dist (e.symm x) (e.symm y) := hLip.dist_le_mul _ _ + _ ≤ (A : ℝ) * ((K : ℝ) * dist x y) := + mul_le_mul_of_nonneg_left (hInv.dist_le_mul x hx y hy) A.coe_nonneg + _ ≤ _ := by + simp only [NNReal.coe_add, NNReal.coe_mul, NNReal.coe_div, NNReal.coe_one] + nlinarith [mul_nonneg (one_div_nonneg.mpr δ.coe_nonneg) (dist_nonneg (x := x) (y := y))] + · simpa only [chartCutoff, ite_eq_left hx, ite_eq_right hy] using hcross x hx y hy + · simpa only [chartCutoff, ite_eq_right hx, ite_eq_left hy, dist_comm] using hcross y hy x hx + · simp only [chartCutoff, ite_eq_right hx, ite_eq_right hy, dist_self] + positivity + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ChordBoxCutoff.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ChordBoxCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..f439e5470a874f8da1b0a0a6b589d0952845acc0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ChordBoxCutoff.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Estimates.LinearCutoff +import OAI.Combinatorics.Progressions.Estimates.UniformProductAccuracy + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +variable {ι : Type*} [Fintype ι] + +noncomputable def chordBoxCutoff (a : ℝ) (h : ℝ≥0) (z : ι → ℂ) : ℝ := + ∏ i, linearCutoff a h ‖1 - z i‖ + +theorem chordBoxCutoff_range (a : ℝ) (h : ℝ≥0) (z : ι → ℂ) : + 0 ≤ chordBoxCutoff a h z ∧ chordBoxCutoff a h z ≤ 1 := by + exact ⟨Finset.prod_nonneg (fun i _ => (linearCutoff_range a h _).1), + Finset.prod_le_one₀ (fun i _ => (linearCutoff_range a h _).1) + (fun i _ => (linearCutoff_range a h _).2)⟩ + +theorem chordBoxCutoff_eq_one (a : ℝ) (h : ℝ≥0) (hh : 0 < h) + (z : ι → ℂ) (hz : ∀ i, ‖1 - z i‖ ≤ a) : chordBoxCutoff a h z = 1 := by + exact Finset.prod_eq_one (fun i _ => linearCutoff_eq_one a h hh (hz i)) + +theorem chordBoxCutoff_eq_zero (a : ℝ) (h : ℝ≥0) (z : ι → ℂ) + (hz : ∃ i, a + (h : ℝ) ≤ ‖1 - z i‖) : chordBoxCutoff a h z = 0 := by + classical + obtain ⟨i, hi⟩ := hz + exact Finset.prod_eq_zero (Finset.mem_univ i) (linearCutoff_eq_zero a h hi) + +theorem chordBoxCutoff_mono_center {a b : ℝ} (hab : a ≤ b) (h : ℝ≥0) (z : ι → ℂ) : + chordBoxCutoff a h z ≤ chordBoxCutoff b h z := by + exact Finset.prod_le_prod₀ (fun i _ => (linearCutoff_range a h _).1) + (fun i _ => linearCutoff_mono_center hab h _) + +theorem chordBoxCutoff_lipschitz (a : ℝ) (h : ℝ≥0) (hh : 0 < h) : + LipschitzWith (Fintype.card ι * h⁻¹) (chordBoxCutoff (ι := ι) a h) := by + have hsingle : LipschitzWith h⁻¹ (fun z : ℂ => linearCutoff a h ‖1 - z‖) := by + simpa only [Function.comp_def, mul_one, dist_eq_norm] using + (linearCutoff_lipschitz a h hh).comp (LipschitzWith.dist_right (1 : ℂ)) + apply LipschitzWith.of_dist_le_mul + intro z w + have hcoord (i : ι) : + |linearCutoff a h ‖1 - z i‖ - linearCutoff a h ‖1 - w i‖| ≤ + (h⁻¹ : ℝ≥0) * dist z w := by + have hi := hsingle.dist_le_mul (z i) (w i) + rw [Real.dist_eq] at hi + exact hi.trans (mul_le_mul_of_nonneg_left (dist_le_pi_dist z w i) (by positivity)) + have hprod := abs_finset_prod_sub_prod_le Finset.univ + (fun i => linearCutoff a h ‖1 - z i‖) (fun i => linearCutoff a h ‖1 - w i‖) + (B := 1) (δ := (h⁻¹ : ℝ≥0) * dist z w) le_rfl (by positivity) + (fun i _ => by rw [abs_of_nonneg (linearCutoff_range a h _).1]; exact (linearCutoff_range a h _).2) + (fun i _ => by rw [abs_of_nonneg (linearCutoff_range a h _).1]; exact (linearCutoff_range a h _).2) + (fun i _ => hcoord i) + rw [Real.dist_eq] + apply hprod.trans_eq + simp only [Finset.card_univ, one_pow, mul_one, NNReal.coe_mul, NNReal.coe_natCast] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoarseSpatialPartitionBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoarseSpatialPartitionBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..d074ff30fbbb257df4394ea984f9b07d84afe210 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoarseSpatialPartitionBudget.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Geometry.SpatialNumericEnvelopeFunctoriality + +namespace OAI + +section + +namespace Erdos3 + +def coarseSpatialReciprocalLog {A : Type*} [Semiring A] (P : A) : A := + 2 * (P + spatialTupleToleranceLog P) + 8 + +def coarseSpatialPartitionLog {A : Type*} [Semiring A] (P : A) : A := + let R := P + coarseSpatialReciprocalLog P + 4 + R * ((3 * R + 4) * R + 2 * R) + +theorem coarseSpatialLogs_nonneg {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ coarseSpatialReciprocalLog P ∧ 0 ≤ coarseSpatialPartitionLog P := by + have ht := spatialTupleToleranceLog_nonneg hP + have hL : 0 ≤ coarseSpatialReciprocalLog P := by unfold coarseSpatialReciprocalLog; positivity + exact ⟨hL, by unfold coarseSpatialPartitionLog; positivity⟩ + +theorem spatialTupleCoarseMesh_inv_bound (d : ℕ) {G V K ε P : ℝ} + (hG : 0 ≤ G) (hV : 0 ≤ V) (hK : 0 ≤ K) (hε : 0 < ε) (hP : 0 ≤ P) + (hd : (d : ℝ) ≤ P) (hGP : G ≤ Real.exp P) (hVP : V ≤ Real.exp P) + (hKP : K ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) : + (spatialTupleCoarseMesh d G V K ε)⁻¹ ≤ Real.exp (coarseSpatialReciprocalLog P) := by + have hwidth := spatialTupleEarlyWidth_inv_bound d hG hV hK hε hP hd hGP hVP hKP hεP + have ht := (spatialTupleTolerance_spec d hG hV hε).1 + have hw := (twoTermErrorWidth_spec hK ht).1 + have hfour : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + unfold spatialTupleCoarseMesh + rw [inv_div, div_eq_mul_inv] + calc + _ ≤ Real.exp 4 * Real.exp (2 * (P + spatialTupleToleranceLog P) + 4) := + mul_le_mul hfour hwidth (inv_nonneg.mpr hw.le) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; unfold coarseSpatialReciprocalLog; ring + +theorem spatialTupleCoarseMesh_partition_budget (d n : ℕ) {G V K ε μ C P : ℝ} + (hG : 0 ≤ G) (hV : 0 ≤ V) (hK : 0 ≤ K) (hμ : 0 ≤ μ) (hC : 0 ≤ C) + (hε : 0 < ε) (hP : 0 ≤ P) (hd : (d : ℝ) ≤ P) (hn : (n : ℝ) ≤ P) + (hGP : G ≤ Real.exp P) (hVP : V ≤ Real.exp P) (hKP : K ≤ Real.exp P) + (hεP : ε⁻¹ ≤ Real.exp P) (hμP : μ ≤ Real.exp P) + (hΓP : μ ^ n ≤ Real.exp P) (hCP : C ≤ Real.exp P) : + let r := spatialTupleCoarseMesh d G V K ε + r⁻¹ ≤ Real.exp (coarseSpatialReciprocalLog P) ∧ + (μ ^ n * (intervalSiteCount 4 r : ℝ) ^ n * (μ ^ n * C)) ^ d ≤ + Real.exp (coarseSpatialPartitionLog P) := by + intro r + have hri := spatialTupleCoarseMesh_inv_bound d hG hV hK hε hP hd hGP hVP hKP hεP + refine ⟨hri, ?_⟩ + have hr : 0 < r := (spatialTupleCoarseMesh_spec d hG hV hK hε).1 + have hL := (coarseSpatialLogs_nonneg hP).1 + let R := P + coarseSpatialReciprocalLog P + 4 + have hR : 0 ≤ R := by dsimp [R]; positivity + have hPR : P ≤ R := by dsimp [R]; linarith + have hLR : coarseSpatialReciprocalLog P ≤ R := by dsimp [R]; linarith + have hfour : (4 : ℝ) ≤ Real.exp R := by + have hR4 : 4 ≤ R := by dsimp [R]; linarith + linarith [Real.add_one_le_exp R] + have hcount := intervalSiteCount_le_exp (by norm_num : (0 : ℝ) ≤ 4) hr hR hfour + (by simpa only [one_div] using hri.trans (Real.exp_le_exp.mpr hLR)) + have he := Real.exp_le_exp.mpr hPR + have hbase := siteCoefficientAllowance_le_exp n hμ (Nat.cast_nonneg _) (pow_nonneg hμ _) hC + (hμP.trans he) hcount (hΓP.trans he) (hCP.trans he) + have hpower := vectorSiteAllowance_le_exp d (by positivity) hbase + apply hpower.trans + apply Real.exp_le_exp.mpr + change (d : ℝ) * ((3 * R + 4) * n + 2 * R) ≤ R * ((3 * R + 4) * R + 2 * R) + gcongr + · exact hd.trans hPR + · exact hn.trans hPR + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientAmbientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientAmbientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..f70b988b88169b22b071ef9f2523157505acf5e6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientAmbientCoordinates.lean @@ -0,0 +1,54 @@ +import OAI.Combinatorics.Progressions.Fourier.CanonicalDensityFourier + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators NNReal + +variable {K : Type*} {m : ℕ} {J : Fin m → Type*} + +abbrev CoefficientAmbientIndex (K : Type*) {m : ℕ} (J : Fin m → Type*) := + Σ s : CoefficientSlot K m, J s.1 + +def coefficientAmbientSlice (s : CoefficientSlot K m) + (v : CoefficientAmbientIndex K J → UnitAddCircle) : J s.1 → UnitAddCircle := + fun i => v ⟨s, i⟩ + +noncomputable def coefficientAmbientTorus (U : ∀ j, Submodule ℝ (J j → ℝ)) + (x : CoefficientTorus (K := K) U) : CoefficientAmbientIndex K J → UnitAddCircle := + fun t => subspaceAmbientTorus (U t.1.1) (coefficientCoordinateTorus U x t.1) t.2 + +theorem coefficientAmbientTorus_mk (U : ∀ j, Submodule ℝ (J j → ℝ)) + (x : CoefficientArray (K := K) U) (t : CoefficientAmbientIndex K J) : + coefficientAmbientTorus U (QuotientAddGroup.mk' (coefficientIntegerLattice U) x) t = + ((x t.1).val t.2 : UnitAddCircle) := rfl + +variable [Fintype K] [∀ j, Fintype (J j)] + +theorem coefficientAmbientSlice_lipschitz (s : CoefficientSlot K m) : + LipschitzWith 1 (coefficientAmbientSlice (J := J) s) := 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 i + exact dist_le_pi_dist x y ⟨s, i⟩ + +theorem coefficientAmbientTorus_character (U : ∀ j, Submodule ℝ (J j → ℝ)) + (frequency : CoefficientAmbientIndex K J → ℤ) (x : CoefficientTorus (K := K) U) : + (∏ t, CircleFourier.character (frequency t • coefficientAmbientTorus U x t)) = + coefficientTorusCharacter U (coefficientSlotFrequency (fun s i => frequency ⟨s, i⟩)) x := by + rw [coefficientTorusCharacter_slot_product, Fintype.prod_sigma] + apply Finset.prod_congr rfl + intro s _ + exact subspaceAmbientTorus_character (U s.1) (fun i => frequency ⟨s, i⟩) + (coefficientCoordinateTorus U x s) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientCoordinateEquiv.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientCoordinateEquiv.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f9590ca7a4b349f841ca740e1f48263a4f273e1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientCoordinateEquiv.lean @@ -0,0 +1,34 @@ +import OAI.Combinatorics.Progressions.Fourier.EuclideanJetTorus + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +variable {K : Type*} {m : ℕ} {J : Fin m → Type*} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +theorem coefficientCoordinateTorus_injective : + Function.Injective (coefficientCoordinateTorus (K := K) U) := by + intro x y h + obtain ⟨a, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + obtain ⟨b, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) y + apply QuotientAddGroup.eq_iff_sub_mem.mpr + intro s i + have hs := QuotientAddGroup.eq_iff_sub_mem.mp (congrFun h s) + exact hs () i + +noncomputable def coefficientCoordinateEquiv : + CoefficientTorus (K := K) U ≃+ CoefficientCoordinateTori (K := K) U := + AddEquiv.ofBijective (coefficientCoordinateTorus U) + ⟨coefficientCoordinateTorus_injective U, coefficientCoordinateTorus_surjective U⟩ + +theorem coefficientCoordinateEquiv_apply (x : CoefficientTorus (K := K) U) : + coefficientCoordinateEquiv U x = coefficientCoordinateTorus U x := rfl + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientDeckChartRecovery.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientDeckChartRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..90b01515091f40d6c79b380e921204658bfc66b3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientDeckChartRecovery.lean @@ -0,0 +1,244 @@ +import OAI.Combinatorics.Progressions.Estimates.CoefficientDeckImageCongruence + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule + +variable {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) +variable (bW : Basis I ℤ (latticeSection (standardEuclideanLattice D) W)) +variable (b : Basis (Fin n) ℝ Wᗮ) +variable (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + +noncomputable def latticeDeckInteger (z : Fin n → ℤ) (w : I → ℤ) : D → ℤ := + (standardLatticeCoordinates W bW b hb).symm (Sum.elim z w) + +theorem latticeDeckInteger_coordinates (z : Fin n → ℤ) (w : I → ℤ) : + standardLatticeCoordinates W bW b hb (latticeDeckInteger W bW b hb z w) = + Sum.elim z w := LinearEquiv.apply_symm_apply _ _ + +theorem latticeDeckInteger_reconstruction (z : Fin n → ℤ) (w : I → ℤ) : + (standardEuclideanPoint D (latticeDeckInteger W bW b hb z w)).val + + (standardLatticeIntegerLift W b hb z).val = + (bW.equivFun.symm w).val.val := by + have h := standardLatticeCoordinates_reconstruction W bW b hb + (latticeDeckInteger W bW b hb z w) + simpa only [latticeDeckInteger_coordinates, Sum.elim_inl, Sum.elim_inr] using h + +theorem latticeDeckInteger_sum_zsmul {S : Type*} (s : Finset S) (a : S → ℤ) + (z : S → Fin n → ℤ) (w : S → I → ℤ) : + latticeDeckInteger W bW b hb (∑ i ∈ s, a i • z i) (∑ i ∈ s, a i • w i) = + ∑ i ∈ s, a i • latticeDeckInteger W bW b hb (z i) (w i) := by + apply (standardLatticeCoordinates W bW b hb).injective + simp only [latticeDeckInteger_coordinates, map_sum, map_zsmul] + funext i + cases i <;> simp only [Sum.elim_inl, Sum.elim_inr, Finset.sum_apply, Pi.smul_apply] + +theorem normalizedLatticePoint_linear_lift (x : W × (Fin n → ℤ)) : + normalizedLatticePoint W b x = x.1.val + + (Wᗮ.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb x.2).val).val := by + rw [normalizedLatticePoint_eq_sheet W b hb, standardLatticeIntegerLift_projection] + unfold latticeSheetPoint + rw [latticeBasisEquiv_synthesis] + +theorem normalizedDeckPoint_identity (x : W × (Fin n → ℤ)) (w : I → ℤ) : + (normalizedLatticeRepresentative W b hb x + (bW.equivFun.symm w).val).val = + normalizedLatticePoint W b x + + (standardEuclideanPoint D (latticeDeckInteger W bW b hb x.2 w)).val := by + have hβ := latticeDeckInteger_reconstruction W bW b hb x.2 w + have hs := W.starProjection_add_starProjection_orthogonal + (standardLatticeIntegerLift W b hb x.2).val + change (W.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb x.2).val).val + + (Wᗮ.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb x.2).val).val = _ at hs + rw [normalizedLatticePoint_linear_lift W b hb] + change x.1.val - (W.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb x.2).val).val + + (bW.equivFun.symm w).val.val = _ + rw [← hs] at hβ + rw [← hβ] + abel + +theorem normalizedCoverLift_add_deck (d : ℕ) (hd : 0 < d) + (x : W × (Fin n → ℤ)) (w : I → ℤ) : + normalizedCoverLift W b hb d x + + (coverKernelBasisEquiv (latticeSection (standardEuclideanLattice D) W).toAddSubgroup + bW d hd (integerResidueMap I d w)).val = + QuotientAddGroup.mk' _ ((d : ℝ)⁻¹ • + (normalizedLatticeRepresentative W b hb x + (bW.equivFun.symm w).val)) := by + have hr : integerResidueMap I d w = + latticeBasisResidue (latticeSection (standardEuclideanLattice D) W).toAddSubgroup + bW d (bW.equivFun.symm w) := by + change integerResidueMap I d w = integerResidueMap I d (bW.equivFun (bW.equivFun.symm w)) + rw [LinearEquiv.apply_symm_apply] + rw [hr, coverKernelBasisEquiv_residue, coverLatticePoint_val, smul_add, map_add] + rfl + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule + +variable {K : Type*} [Fintype K] {m : ℕ} {J I E : Fin m → Type*} +variable [∀ j, Fintype (J j)] [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +noncomputable def coefficientSamplerAmbientPoint + (x : CoefficientSamplerArrays (K := K) I n) : CoefficientAmbientIndex K J → ℝ := + fun a => normalizedLatticePoint (euclideanSubspace (U a.1.1)) (b a.1.1) + (orthonormalMixedChart (o a.1.1) (mixedArrayRegroup _ _ _ (x a.1.1) a.1.2)) a.2 + +noncomputable def coefficientSamplerDeckInteger + (x : CoefficientSamplerArrays (K := K) I n) + (w : ∀ j, BoundedCoefficientExponent K (j.val + 1) → E j → ℤ) : + CoefficientAmbientIndex K J → ℤ := + fun a => latticeDeckInteger (euclideanSubspace (U a.1.1)) (bW a.1.1) (b a.1.1) (hb a.1.1) + (fun i => (x a.1.1).2 i a.1.2) (w a.1.1 a.1.2) a.2 + +omit [Fintype K] in +theorem canonicalCoefficientDeckSample_ambient_integer_chart + (q : ℕ) (hq : 0 < q) (x : CoefficientSamplerArrays (K := K) I n) + (w : ∀ j, BoundedCoefficientExponent K (j.val + 1) → E j → ℤ) : + coefficientAmbientTorus U (canonicalCoefficientDeckSample U bW b hb o q hq x + (fun j e => integerResidueMap (E j) q (w j e))) = + fun a => (((coefficientSamplerAmbientPoint U b o x a + + (coefficientSamplerDeckInteger U bW b hb x w a : ℝ)) / q : ℝ) : UnitAddCircle) := by + funext a + have he := canonicalCoefficientDeckSample_coordinate U bW b hb o q hq x + (fun j e => integerResidueMap (E j) q (w j e)) a.1.1 a.1.2 + rw [normalizedCoverLift_add_deck] at he + have he' := congrArg (euclideanSubspaceTorusEquiv (U a.1.1)) he + rw [euclideanCoefficientEquiv_apply, AddEquiv.apply_symm_apply, + euclideanSubspaceTorusEquiv_mk] at he' + change subspaceAmbientTorus (U a.1.1) _ a.2 = _ + rw [he', subspaceAmbientTorus_mk] + change (((q : ℝ)⁻¹ * _ : ℝ) : UnitAddCircle) = _ + apply congrArg (fun r : ℝ => (r : UnitAddCircle)) + rw [div_eq_inv_mul] + congr 1 + exact congrArg (fun v : EuclideanSpace ℝ (J a.1.1) => v a.2) + (normalizedDeckPoint_identity (euclideanSubspace (U a.1.1)) (bW a.1.1) + (b a.1.1) (hb a.1.1) _ (w a.1.1 a.1.2)) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule +open scoped Classical +attribute [local irreducible] coefficientDeckKernelEquiv + +variable {K : Type*} {m : ℕ} {J I E : Fin m → Type*} +variable [∀ j, Fintype (J j)] [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +theorem canonicalCoefficientDeckSample_residue_injective (q : ℕ) (hq : 0 < q) + (x : CoefficientSamplerArrays (K := K) I n) : + Function.Injective (canonicalCoefficientDeckSample U bW b hb o q hq x) := by + intro r s h + apply (coefficientDeckKernelEquiv U bW q hq).injective + apply Subtype.ext + exact add_left_cancel h + +theorem canonicalCoefficientDeckSample_existsUnique_residue (q : ℕ) (hq : 0 < q) + (x : CoefficientSamplerArrays (K := K) I n) (y : CoefficientTorus (K := K) U) + (hy : quotientIntegerCover (coefficientIntegerLattice (K := K) U) q y = + canonicalCoefficientSample U b hb o x) : + ∃! r : CoefficientDeckResidues (K := K) E q, + canonicalCoefficientDeckSample U bW b hb o q hq x r = y := by + let z : (quotientIntegerCover (coefficientIntegerLattice (K := K) U) q).ker := + ⟨y - canonicalCoefficientCoverLift U b hb o q x, by + change quotientIntegerCover (coefficientIntegerLattice (K := K) U) q + (y - canonicalCoefficientCoverLift U b hb o q x) = 0 + rw [map_sub, hy, canonicalCoefficientCoverLift_projection U b hb o q hq, sub_self]⟩ + let r := (coefficientDeckKernelEquiv U bW q hq).symm z + have hr : canonicalCoefficientDeckSample U bW b hb o q hq x r = y := by + unfold canonicalCoefficientDeckSample + change canonicalCoefficientCoverLift U b hb o q x + + (coefficientDeckKernelEquiv U bW q hq ((coefficientDeckKernelEquiv U bW q hq).symm z)).val = y + rw [AddEquiv.apply_symm_apply] + change canonicalCoefficientCoverLift U b hb o q x + + (y - canonicalCoefficientCoverLift U b hb o q x) = y + abel + exact ⟨r, hr, fun s hs => canonicalCoefficientDeckSample_residue_injective + U bW b hb o q hq x (hs.trans hr.symm)⟩ + +theorem canonicalCoefficientSample_injOn_chart : + Set.InjOn (canonicalCoefficientSample (K := K) U b hb o) + {x | ∀ j, mixedArrayInChart (euclideanSubspace (U j)) (b j) (o j) (x j)} := by + intro x hx y hy h + have h' := congrArg (euclideanCoefficientEquiv U) h + simp only [canonicalCoefficientSample, AddEquiv.apply_symm_apply] at h' + funext j + exact mixedArrayQuotient_injOn_chart (euclideanSubspace (U j)) (b j) (hb j) (o j) + (hx j) (hy j) (congrFun h' j) + +theorem canonicalCoefficientDeckSample_injOn_chart (q : ℕ) (hq : 0 < q) : + Set.InjOn (fun z : CoefficientSamplerArrays (K := K) I n × CoefficientDeckResidues (K := K) E q => + canonicalCoefficientDeckSample U bW b hb o q hq z.1 z.2) + {z | ∀ j, mixedArrayInChart (euclideanSubspace (U j)) (b j) (o j) (z.1 j)} := by + rintro ⟨x, r⟩ hx ⟨y, s⟩ hy h + have hp := congrArg (quotientIntegerCover (coefficientIntegerLattice (K := K) U) q) h + simp only [canonicalCoefficientDeckSample_projection] at hp + have hxy := canonicalCoefficientSample_injOn_chart U b hb o hx hy hp + change x = y at hxy + subst y + have hrs := canonicalCoefficientDeckSample_residue_injective U bW b hb o q hq x h + change r = s at hrs + subst s + rfl + +theorem canonicalCoefficientDeckSample_injOn_smallAmbient (q : ℕ) (hq : 0 < q) : + Set.InjOn (fun z : CoefficientSamplerArrays (K := K) I n × CoefficientDeckResidues (K := K) E q => + canonicalCoefficientDeckSample U bW b hb o q hq z.1 z.2) + {z | ∀ a, |coefficientSamplerAmbientPoint U b o z.1 a| < 1/2} := by + intro x hx y hy h + apply canonicalCoefficientDeckSample_injOn_chart U bW b hb o q hq _ _ h + · intro j e i + exact hx ⟨⟨j, e⟩, i⟩ + · intro j e i + exact hy ⟨⟨j, e⟩, i⟩ + +variable [Fintype K] + +theorem canonicalCoefficientDeckSample_recover_nonzero + (c w : ∀ j : Fin m, I j → BoundedCoefficientExponent K (j.val + 1) → ℝ) + (p : ∀ j : Fin m, Fin (n j) → BoundedCoefficientExponent K (j.val + 1) → PMF ℤ) + (q : ℕ) (hq : 0 < q) (y : CoefficientTorus (K := K) U) + (hy : canonicalCoefficientDensity U b hb o c w p + (quotientIntegerCover (coefficientIntegerLattice (K := K) U) q y) ≠ 0) : + ∃! z : CoefficientSamplerArrays (K := K) I n × CoefficientDeckResidues (K := K) E q, + canonicalCoefficientDeckSample U bW b hb o q hq z.1 z.2 = y ∧ + ∀ j, mixedArrayInChart (euclideanSubspace (U j)) (b j) (o j) (z.1 j) ∧ + mixedArraySupported (c j) (w j) (p j) (z.1 j) := by + obtain ⟨x, hx, _⟩ := canonicalCoefficientDensity_recover_unique U b hb o c w p hy + obtain ⟨r, hr, _⟩ := canonicalCoefficientDeckSample_existsUnique_residue U bW b hb o q hq x y hx.1.symm + refine ⟨⟨x, r⟩, ⟨hr, hx.2⟩, ?_⟩ + intro z hz + exact canonicalCoefficientDeckSample_injOn_chart U bW b hb o q hq + (fun j => (hz.2 j).1) (fun j => (hx.2 j).1) (hz.1.trans hr.symm) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientDeckCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientDeckCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..614cf98d34ccaa0dc343d5a2958771c857414403 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientDeckCoordinates.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Fourier.EuclideanCoefficientTorus +import OAI.Combinatorics.Progressions.Lattices.CoverBasisResidues +import OAI.Combinatorics.Progressions.Lattices.IntegerKernelCoordinates + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule + +variable {K : Type*} {m : ℕ} {J B : Fin m → Type*} +variable [∀ j, Fintype (J j)] [∀ j, Fintype (B j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) + +abbrev CoefficientDeckResidues (B : Fin m → Type*) (d : ℕ) := + ∀ j : Fin m, BoundedCoefficientExponent K (j.val + 1) → B j → ZMod d + +noncomputable def coefficientKernelCoordinates (d : ℕ) : + (quotientIntegerCover (coefficientIntegerLattice (K := K) U) d).ker ≃+ + ∀ j : Fin m, BoundedCoefficientExponent K (j.val + 1) → + (quotientIntegerCover + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup d).ker := + (nsmulKernelCongr (G := CoefficientTorus (K := K) U) + (H := EuclideanCoefficientLayers (K := K) U) (euclideanCoefficientEquiv (K := K) U) d).trans + ((nsmulKernelPiEquiv (fun j : Fin m => BoundedCoefficientExponent K (j.val + 1) → + euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) d).trans + (AddEquiv.piCongrRight fun j => nsmulKernelPiEquiv + (fun _ : BoundedCoefficientExponent K (j.val + 1) => euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) d)) + +theorem coefficientKernelCoordinates_val (d : ℕ) + (x : (quotientIntegerCover (coefficientIntegerLattice (K := K) U) d).ker) + (j : Fin m) (e : BoundedCoefficientExponent K (j.val + 1)) : + (coefficientKernelCoordinates U d x j e).val = euclideanCoefficientEquiv U x.val j e := rfl + +variable (bW : ∀ j, Basis (B j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +noncomputable def coefficientDeckKernelEquiv (d : ℕ) (hd : 0 < d) : + CoefficientDeckResidues (K := K) B d ≃+ + (quotientIntegerCover (coefficientIntegerLattice (K := K) U) d).ker := + (AddEquiv.piCongrRight fun j : Fin m => AddEquiv.piCongrRight + fun _ : BoundedCoefficientExponent K (j.val + 1) => + coverKernelBasisEquiv + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup + (bW j) d hd).trans (coefficientKernelCoordinates U d).symm + +theorem coefficientDeckKernelEquiv_coordinate (d : ℕ) (hd : 0 < d) + (r : CoefficientDeckResidues (K := K) B d) + (j : Fin m) (e : BoundedCoefficientExponent K (j.val + 1)) : + euclideanCoefficientEquiv U (coefficientDeckKernelEquiv U bW d hd r).val j e = + (coverKernelBasisEquiv + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup + (bW j) d hd (r j e)).val := by + change euclideanCoefficientEquiv U ((euclideanCoefficientEquiv U).symm _) j e = _ + rw [AddEquiv.apply_symm_apply] + rfl + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientJetChartHaar.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientJetChartHaar.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf91f92410e0084c5327c058225e801d2b90f2cd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientJetChartHaar.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedBooleanSiteValues + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule +open scoped BigOperators + +theorem coefficientJet_normalized_chart_mass {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] {m : ℕ} {O J : Fin m → Type*} + [∀ j, Fintype (O j)] [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + [CompactSpace (CoefficientTorus (K := K) U)] + [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {n : Fin m → ℕ} (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (root : K → ℤ) (D : Matrix α K ℤ) (a : ℤ) (ha : a ≠ 0) + (hperiod : integerScalarLattice α a ≤ D.mulVecLin.range) + (rows : ∀ j, O j → Finset α) (hinj : ∀ j, Function.Injective (rows j)) + (hdegree : ∀ j o, (rows j o).card ≤ j.val + 1) + (μ : 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)] + (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) + (hΩm : ∀ j o, MeasurableSet (Ω j o)) + (hΩ : ∀ j o, Ω j o ⊆ standardLatticeSmallBox (J j)) : + μ {x | ∀ j o, euclideanCoefficientJetMap U root D rows x j o ∈ + latticeSmallLiftRegion (standardEuclideanLattice (J j)) (euclideanSubspace (U j)) (Ω j o)} = + ∏ j, ∏ o, (∑' z : Fin (n j) → ℤ, volume {u : euclideanSubspace (U j) | + (normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm + (u, fun i => (z i : ℝ) / (basisAxisScale (b j) i : ℝ)) ∈ Ω j o}) / + ENNReal.ofReal (ZLattice.covolume + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) := by + let R := fun j o => latticeSmallLiftRegion (standardEuclideanLattice (J j)) + (euclideanSubspace (U j)) (Ω j o) + let A := Set.pi Set.univ (fun j => Set.pi Set.univ (R j)) + have hA : MeasurableSet A := MeasurableSet.univ_pi (fun j => + MeasurableSet.univ_pi (fun o => smallLiftRegion_measurable _ (hΩm j o) (hΩ j o))) + have hp := euclideanCoefficientJetMap_measurePreserving U root D a ha hperiod rows hinj hdegree μ ν + have he := congrArg (fun ρ => ρ A) hp.map_eq + rw [Measure.map_apply hp.measurable hA, Measure.pi_pi] at he + simp_rw [Measure.pi_pi] at he + have hpre : (euclideanCoefficientJetMap U root D rows) ⁻¹' A = + {x | ∀ j o, euclideanCoefficientJetMap U root D rows x j o ∈ R j o} := by + ext x + simp [A] + rw [hpre] at he + exact he.trans (Finset.prod_congr rfl (fun j _ => Finset.prod_congr rfl (fun o _ => + normalized_smallLift_haar_formula (euclideanSubspace (U j)) (b j) (hb j) (ν j) (hΩm j o) (hΩ j o)))) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientJetCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientJetCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..f96e1cbc0dc1e400662b3833bcde1b8847278b11 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientJetCoordinates.lean @@ -0,0 +1,73 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedBooleanSiteValues +import OAI.Combinatorics.Progressions.Fourier.EuclideanCoefficientTorus + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem arrayCoordinateTorus_integerMatrix {I S J : Type*} [Fintype I] + (U : Submodule ℝ (J → ℝ)) (A : Matrix S I ℤ) (x : SubspaceArrayTorus I U) (s : S) : + arrayCoordinateTorus U (integerMatrixTorusMap U A x) s = + ∑ i, A s i • arrayCoordinateTorus U x i := by + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (subspaceArrayIntegerLattice I U) x + simp only [integerMatrixTorusMap_mk, arrayCoordinateTorus_mk] + let a : S → I → ℤ := A + let q := QuotientAddGroup.mk' (subspaceArrayIntegerLattice Unit U) + change q (fun _ => matrixModuleAction (fun s i => (a s i : ℝ)) v s) = + ∑ i, a s i • q (fun _ => v i) + have he : (fun _ : Unit => matrixModuleAction (fun s i => (a s i : ℝ)) v s) = + ∑ i, a s i • (fun _ : Unit => v i) := by + funext u + simp only [Finset.sum_apply, Pi.smul_apply] + change (∑ i, (a s i : ℝ) • v i) = ∑ i, a s i • v i + exact Finset.sum_congr rfl (fun i _ => Int.cast_smul_eq_zsmul ℝ (a s i) (v i)) + rw [he, map_sum] + exact Finset.sum_congr rfl (fun i _ => map_zsmul q _ _) + +namespace VectorPolynomial + +theorem arrayCoordinateTorus_coefficientLayer {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (x : CoefficientTorus (K := K) U) + (j : Fin m) (e : BoundedCoefficientExponent K (j.val + 1)) : + arrayCoordinateTorus (U j) (coefficientLayerTorus U j x) e = + coefficientCoordinateTorus U x ⟨j, e⟩ := by + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + rfl + +theorem coefficientBooleanJetTorusMap_layer {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] {m : ℕ} {O J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (D : Matrix α K ℤ) + (rows : ∀ j, O j → Finset α) (x : CoefficientTorus (K := K) U) (j : Fin m) : + coefficientBooleanJetTorusMap U root D rows x j = + integerMatrixTorusMap (U j) (boundedCoefficientJetMatrix root D (j.val + 1) (rows j)) + (coefficientLayerTorus U j x) := by + obtain ⟨v, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + rw [coefficientBooleanJetTorusMap_mk] + rfl + +theorem euclideanCoefficientJetMap_apply {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] {m : ℕ} {O J : Fin m → Type*} + [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (root : K → ℤ) (D : Matrix α K ℤ) (rows : ∀ j, O j → Finset α) + (x : CoefficientTorus (K := K) U) (j : Fin m) (o : O j) : + euclideanCoefficientJetMap U root D rows x j o = + ∑ e, boundedCoefficientJetMatrix root D (j.val + 1) (rows j) o e • + euclideanCoefficientEquiv U x j e := by + change (euclideanSubspaceTorusEquiv (U j)).symm + (arrayCoordinateTorus (U j) (coefficientBooleanJetTorusMap U root D rows x j) o) = _ + rw [coefficientBooleanJetTorusMap_layer, arrayCoordinateTorus_integerMatrix, map_sum] + apply Finset.sum_congr rfl + intro e _ + rw [map_zsmul, arrayCoordinateTorus_coefficientLayer] + rfl + +end VectorPolynomial +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientSquareSpatialBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientSquareSpatialBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..e883b85e93d543ccee9ea202e51e31bfc6529dc2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoefficientSquareSpatialBudget.lean @@ -0,0 +1,174 @@ +import OAI.Combinatorics.Progressions.Probability.AllocatedReferenceJetMass +import OAI.Combinatorics.Progressions.Sampling.SquareSamplingAccuracy + +namespace OAI + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped BigOperators + +def coefficientErrorVolumeLog {A : Type*} [Semiring A] (P : A) : A := P ^ 2 * (P + 61) + +def coefficientErrorSpatialLog {A : Type*} [Semiring A] (P : A) : A := + P * (P ^ 3 + anisotropicSpatialCapLog P) + coefficientErrorVolumeLog P + +theorem coefficientErrorSpatialLog_nonneg {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ coefficientErrorSpatialLog P := by + have h := anisotropicSpatialCapLog_nonneg hP + unfold coefficientErrorSpatialLog coefficientErrorVolumeLog + positivity + +theorem coefficientErrorPeriod_exp_sq {m M period : ℕ} {P : ℝ} (hP : 0 ≤ P) + (hm : ((m + 1 : ℕ) : ℝ) ≤ P) (hM : (M : ℝ) ≤ Real.exp P) + (hperiod : period ≤ M ^ (m + 1)) : (period : ℝ) ≤ Real.exp (P ^ 2) := by + have hcast : (period : ℝ) ≤ (M : ℝ) ^ (m + 1) := by exact_mod_cast hperiod + exact hcast.trans (by + simpa only [pow_two] using pow_le_exp_mul_of_le_exp (Nat.cast_nonneg _) hM hP (m + 1) hm) + +theorem referenceErrorVolumeFactor_exp_bound (q : ℕ) (X : Type*) [Fintype X] + {P D W L : ℝ} (hP : 0 ≤ P) (hq : ((q + 1 : ℕ) : ℝ) ≤ P) + (hX : (Fintype.card X : ℝ) ≤ P) (hL : 1 ≤ L) (hW : 0 ≤ W) + (hD : D ≤ Real.exp P) (hWL : W ≤ D * L) : + (30 / smoothProbabilityProfile 0) ^ Fintype.card (Option (Fin q) × X) * + (((1 + W) / L) ^ q) ^ Fintype.card X ≤ Real.exp (coefficientErrorVolumeLog P) := by + have hL0 : 0 < L := lt_of_lt_of_le zero_lt_one hL + have hq' : (q : ℝ) + 1 ≤ P := by simpa only [Nat.cast_add, Nat.cast_one] using hq + have hcount : (Fintype.card (Option (Fin q) × X) : ℝ) ≤ P ^ 2 := by + simp only [Fintype.card_prod, Fintype.card_option, Fintype.card_fin, + Nat.cast_mul, Nat.cast_add, Nat.cast_one] + exact (mul_le_mul hq' hX (Nat.cast_nonneg _) hP).trans_eq (pow_two P).symm + have hprofile0 := smoothProbabilityProfile_pos_zero + have hprofile : 30 / smoothProbabilityProfile 0 ≤ Real.exp 60 := by + have hi := smoothProbabilityProfile_inner_lower 0 (by norm_num) + apply le_trans (show 30 / smoothProbabilityProfile 0 ≤ 60 from + (div_le_iff₀ hprofile0).mpr (by linarith)) + linarith [Real.add_one_le_exp (60 : ℝ)] + have hprofilePower := pow_le_exp_mul_of_le_exp (by positivity) hprofile + (by norm_num : (0 : ℝ) ≤ 60) _ hcount + have hratio0 : 0 ≤ (1 + W) / L := by positivity + have hratio : (1 + W) / L ≤ Real.exp (P + 1) := by + apply (show (1 + W) / L ≤ 1 + D from (div_le_iff₀ hL0).mpr (by nlinarith)).trans + exact one_add_le_exp_succ hP hD + have hqPower := pow_le_exp_mul_of_le_exp hratio0 hratio (by positivity : 0 ≤ P + 1) + q (by linarith : (q : ℝ) ≤ P) + have hXPower := pow_le_exp_mul_of_le_exp (pow_nonneg hratio0 q) hqPower + (by positivity : 0 ≤ P * (P + 1)) _ hX + calc + _ ≤ Real.exp (P ^ 2 * 60) * Real.exp (P * (P * (P + 1))) := by gcongr + _ = _ := by rw [← Real.exp_add]; congr 1; unfold coefficientErrorVolumeLog; ring + +theorem coarseReferenceMassConstant_exp_bound (q : ℕ) (X : Type*) [Fintype X] + {P D W L : ℝ} (hP : 0 ≤ P) (hq : ((q + 1 : ℕ) : ℝ) ≤ P) + (hX : (Fintype.card X : ℝ) ≤ P) (hL : 1 ≤ L) (hW : 0 ≤ W) + (hD : D ≤ Real.exp P) (hWL : W ≤ D * L) : + coarseReferenceMassConstant q X W L ≤ Real.exp (coefficientErrorVolumeLog P + 4) := by + have h := referenceErrorVolumeFactor_exp_bound q X hP hq hX hL hW hD hWL + have hprofile0 := smoothProbabilityProfile_pos_zero + unfold coarseReferenceMassConstant + rw [mul_assoc] + calc + _ ≤ Real.exp 4 * Real.exp (coefficientErrorVolumeLog P) := mul_le_mul + (by linarith [Real.add_one_le_exp (4 : ℝ)]) h (by positivity) (by positivity) + _ = _ := by rw [← Real.exp_add, add_comm] + +theorem coefficientErrorSpatialFactor_exp_bound {G : Type*} [Fintype G] (q : ℕ) + (X : Type*) [Fintype X] (selection : Fin q ↪ G) {M period : ℕ} {P D W L : ℝ} + (hP : 0 ≤ P) (hM : 0 < M) (hMP : (M : ℝ) ≤ Real.exp P) + (hperiod : (period : ℝ) ≤ Real.exp (P ^ 2)) + (hq : ((q + 1 : ℕ) : ℝ) ≤ P) (hG : (Fintype.card G : ℝ) ≤ P) + (hX : (Fintype.card X : ℝ) ≤ P) (hL : 1 ≤ L) (hW : 0 ≤ W) + (hD : D ≤ Real.exp P) (hWL : W ≤ D * L) : + let Cψ := ((period : ℝ) ^ Fintype.card (Unit ⊕ Fin q) * + anisotropicSpatialDensityCap selection (1 / (M : ℝ))) ^ Fintype.card X + let Vsp := (30 / smoothProbabilityProfile 0) ^ Fintype.card (Option (Fin q) × X) * + (((1 + W) / L) ^ q) ^ Fintype.card X + 0 ≤ Cψ * Vsp ∧ Cψ * Vsp ≤ Real.exp (coefficientErrorSpatialLog P) := by + intro Cψ Vsp + have hj : (Fintype.card (Unit ⊕ Fin q) : ℝ) ≤ P := by + simpa [Nat.add_comm] using hq + have hc := anisotropicSpatialDensityCap_exp_bound selection hP hM hMP hj hG + have hc0 := anisotropicSpatialDensityCap_nonneg selection (by positivity : 0 ≤ 1 / (M : ℝ)) + have hh : (period : ℝ) ^ Fintype.card (Unit ⊕ Fin q) ≤ Real.exp (P ^ 3) := + (pow_le_exp_mul_of_le_exp (Nat.cast_nonneg _) hperiod (sq_nonneg P) _ hj).trans_eq + (congrArg Real.exp (by ring)) + have hb : (period : ℝ) ^ Fintype.card (Unit ⊕ Fin q) * + anisotropicSpatialDensityCap selection (1 / (M : ℝ)) ≤ + Real.exp (P ^ 3 + anisotropicSpatialCapLog P) := by + calc + _ ≤ Real.exp (P ^ 3) * Real.exp (anisotropicSpatialCapLog P) := by gcongr + _ = _ := (Real.exp_add _ _).symm + have hcapLog := anisotropicSpatialCapLog_nonneg hP + have hψ : Cψ ≤ Real.exp (P * (P ^ 3 + anisotropicSpatialCapLog P)) := + pow_le_exp_mul_of_le_exp (by positivity) hb (by positivity) _ hX + have hvol : Vsp ≤ Real.exp (coefficientErrorVolumeLog P) := + referenceErrorVolumeFactor_exp_bound q X hP hq hX hL hW hD hWL + have hprofile0 := smoothProbabilityProfile_pos_zero + refine ⟨by dsimp [Cψ, Vsp]; positivity, ?_⟩ + calc + _ ≤ Real.exp (P * (P ^ 3 + anisotropicSpatialCapLog P)) * + Real.exp (coefficientErrorVolumeLog P) := by gcongr + _ = _ := by rw [← Real.exp_add]; rfl + +end Erdos3 + +end + +section + +namespace Erdos3 +open BooleanCubeKernel +open scoped BigOperators + +theorem spatialWindowFactor_le_referenceFactor (q : ℕ) (X : Type*) [Fintype X] + {W L : ℝ} (hW : 0 ≤ W) (hL : 0 < L) : + (9 : ℝ) ^ Fintype.card (X × (Unit ⊕ Fin q)) * (((1 + W) / L) ^ q) ^ Fintype.card X ≤ + (30 / smoothProbabilityProfile 0) ^ Fintype.card (Option (Fin q) × X) * + (((1 + W) / L) ^ q) ^ Fintype.card X := by + have hb : (9 : ℝ) ≤ 30 / smoothProbabilityProfile 0 := + (le_div_iff₀ smoothProbabilityProfile_pos_zero).mpr (by + nlinarith [(smoothProbabilityProfile_range 0).2]) + have hc : Fintype.card (X × (Unit ⊕ Fin q)) = Fintype.card (Option (Fin q) × X) := by + simp [Nat.mul_comm, Nat.add_comm] + rw [hc] + exact mul_le_mul_of_nonneg_right (pow_le_pow_left₀ (by norm_num) hb _) (by positivity) + +theorem coefficientSquareSpatial_cost {G : Type*} [Fintype G] (q : ℕ) + (X : Type*) [Fintype X] (selection : Fin q ↪ G) {M period : ℕ} {P D W L Q E : ℝ} + (hP : 0 ≤ P) (hM : 0 < M) (hMP : (M : ℝ) ≤ Real.exp P) + (hperiod : (period : ℝ) ≤ Real.exp (P ^ 2)) + (hq : ((q + 1 : ℕ) : ℝ) ≤ P) (hG : (Fintype.card G : ℝ) ≤ P) + (hX : (Fintype.card X : ℝ) ≤ P) (hL : 1 ≤ L) (hW : 0 ≤ W) + (hD : D ≤ Real.exp P) (hWL : W ≤ D * L) (hE0 : 0 ≤ E) + (hE : E ≤ Real.exp (-(2 * Q + 2 * coefficientErrorSpatialLog P + 4))) : + let Cψ := ((period : ℝ) ^ Fintype.card (Unit ⊕ Fin q) * + anisotropicSpatialDensityCap selection (1 / (M : ℝ))) ^ Fintype.card X + let Vsp := (30 / smoothProbabilityProfile 0) ^ Fintype.card (Option (Fin q) × X) * + (((1 + W) / L) ^ q) ^ Fintype.card X + let Wsp := (9 : ℝ) ^ Fintype.card (X × (Unit ⊕ Fin q)) * + (((1 + W) / L) ^ q) ^ Fintype.card X + (Cψ * Wsp) * (Cψ * (Vsp * E)) ≤ (Real.exp (-Q) / 2) ^ 2 := by + intro Cψ Vsp Wsp + have hfactor := coefficientErrorSpatialFactor_exp_bound q X selection hP hM hMP hperiod + hq hG hX hL hW hD hWL + have hc : 0 ≤ Cψ := pow_nonneg (mul_nonneg (pow_nonneg (Nat.cast_nonneg _) _) + (anisotropicSpatialDensityCap_nonneg selection (by positivity))) _ + have hw : Wsp ≤ Vsp := spatialWindowFactor_le_referenceFactor q X hW (lt_of_lt_of_le zero_lt_one hL) + have hm : Cψ * Wsp ≤ Real.exp (coefficientErrorSpatialLog P) := + (mul_le_mul_of_nonneg_left hw hc).trans hfactor.2 + have ht := sourceSquareAccuracy_cost (M := Cψ * Wsp) (C := 1) (V := Cψ * Vsp) + (W := coefficientErrorSpatialLog P) (B := 0) (D := coefficientErrorSpatialLog P) + zero_le_one hfactor.1 hE0 hm (by simp) hfactor.2 + (show E ≤ Real.exp (-(2 * Q + coefficientErrorSpatialLog P + 0 + coefficientErrorSpatialLog P + 4)) by + convert hE using 1 + congr 1 + ring) + simpa only [one_mul, mul_assoc] using ht + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CommonMarkedDirectionCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CommonMarkedDirectionCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cdba5704ca304cff6ce3684d9f36a47747dbfad --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CommonMarkedDirectionCoordinates.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Estimates.ControlledMarkedDirectionModel + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +theorem exists_native_marked_common_direction_coordinates (s : ℕ) (hs : 1 ≤ s) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {r N : ℕ} [NeZero N] {b p q P M : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} + (D : R.CommonData P) (B : D.CoefficientBases M) (t : ℕ) (x : Fin t → ℚ) (l : ℕ), + 0 ≤ M → b ≤ M → (t : ℝ) ≤ M → (∀ i, rationalLogHeight (x i) ≤ M) → + 0 < l → (l : ℝ) ≤ Real.exp M → + ∃ d : ℕ, + ∃ E : RationalFilteredNilmanifold + (MarkedShiftQuotient D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t) (s + 1) d, + ∃ T : E.MultidegreeStructure (mixedCorrelationDegree s), + ∃ ξ : MarkedShiftQuotient D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t →ₗ[ℚ] ℚ, + T.filtration = D.markedQuotientMultidegree t ∧ + T.ComplexityLE ((M + C) ^ C) ∧ l ∣ E.grid ∧ + bchSubgroupCoordinates E.basis E.lattice = scaledIntegerGrid E.grid ∧ + (∀ i j, rationalLogHeight + (E.basis.repr (markedQuotientDirection D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t (RationalTorus.basis t i)) j) ≤ + (M + C) ^ C) ∧ + (∀ i, rationalLogHeight (ξ (E.basis i)) ≤ (M + C) ^ C) ∧ + (∀ z ∈ markedShiftPolynomialSubmodule D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t s 1 r, + ξ (lieQuotientMap (markedShiftSecondIdeal D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t) z) = + B.freeFrequency D (markedShiftEval D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t x z)) ∧ + ∀ z : E.filtration.Group, z ∈ E.lattice → ∃ n : ℤ, ξ z.coord = n := by + obtain ⟨a, _, hsource⟩ := exists_common_marked_source_basis s hs + obtain ⟨c, _, hmodel⟩ := exists_markedFrequencyModel_budget s + let Q : Polynomial ℕ := Polynomial.X + (Polynomial.X + Polynomial.C a) ^ a + 1 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((Q + Polynomial.C c) ^ c) + refine ⟨C, hC, ?_⟩ + intro r N _ b p q P M W out H R D B t x l hM hbM ht hx hl hlM + let U := (M + a) ^ a + let V := M + U + 1 + have hU : 0 ≤ U := by dsimp [U]; positivity + have hMV : M ≤ V := by dsimp [V]; linarith only [hU] + have hUV : U ≤ V := by dsimp [V]; linarith only [hM] + have hU1V : U + 1 ≤ V := by dsimp [V]; linarith only [hM] + have hM1V : M + 1 ≤ V := by dsimp [V]; linarith only [hU] + have hV : 0 ≤ V := hM.trans hMV + have hbound : markedFrequencyModelBudget s V ≤ (M + C) ^ C := by + apply (hmodel V hV).trans + simpa [Q, U, V, Polynomial.eval₂_pow] using hbudget M hM + obtain ⟨e, ω, hF, hω, hdim, hstructure, hgen, hfreq⟩ := hsource D B hM hbM + obtain ⟨d, _, E, T, ξ, hTF, hT, hdiv, hcoords, hdirection, hξ, hpreserve, hintegral⟩ := + exists_markedShift_direction_model_with_budget D.coefficientFreeFiltration e ω hF hω + D.coefficientFreeGenerator D.coefficientWeight D.coefficientIsDependent + D.coefficientWeight_pos D.coefficientFreeGenerator_mem_layer (one_le_ceil_exp U) + (fun i j k => rationalHeightLE_ceil_exp (hstructure i j k)) + (fun z i => rationalHeightLE_ceil_exp (hgen z i)) t (B.freeFrequency D) + (fun i => rationalHeightLE_ceil_exp (hfreq i)) x (one_le_ceil_exp M) + (fun i => rationalHeightLE_ceil_exp (hx i)) s 1 r (B.markedShift_top_inter_le_ker D t x) + l hl hV (by simpa only [Fintype.card_fin] using hdim.trans hUV) (ht.trans hMV) + ((ceil_exp_le_exp_add_one hU).trans (Real.exp_le_exp.mpr hU1V)) + ((ceil_exp_le_exp_add_one hU).trans (Real.exp_le_exp.mpr hU1V)) + ((ceil_exp_le_exp_add_one hM).trans (Real.exp_le_exp.mpr hM1V)) + (hlM.trans (Real.exp_le_exp.mpr hMV)) + exact ⟨d, E, T, ξ, hTF, hT.mono T hbound, hdiv, hcoords, + (fun i j => (hdirection i j).trans hbound), (fun i => (hξ i).trans hbound), hpreserve, hintegral⟩ + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CommonNativeCoordinateCorrections.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CommonNativeCoordinateCorrections.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d2d893699bffe34e2c5337fc661b35d9d4b8bf5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CommonNativeCoordinateCorrections.lean @@ -0,0 +1,272 @@ +import OAI.Combinatorics.Progressions.Estimates.CommonUniformCoefficientCorrections +import OAI.Combinatorics.Progressions.Linear.RankHorizontalRepresentatives +import OAI.Combinatorics.Progressions.Linear.RankNativeCoordinates + +namespace OAI + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module RationalFilteredNilmanifold + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {κ : Type*} [Fintype κ] {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + +theorem spaces_le_fourHorizontalLayer (d : Fin (s + 1)) : + D.spaces d ≤ W.rank.filtration.fourHorizontalLayer d.val := by + obtain ⟨t, ht⟩ := D.nonempty + rw [← D.projection t ht d] + let I := R.interval ⟨t, D.subset ht⟩ + let V : I.SunflowerWitness P := D.witness t ht + change I.refilteredProjectionImage V.index V.subalgebra d.val ≤ _ + intro x hx + obtain ⟨y, hy, rfl⟩ := hx + exact (W.rank.filtration.mem_fourHorizontalLayer d.val _).mpr + (I.rankProjection_mem_refiltered V.index V.subalgebra d.val y hy) + +noncomputable def coordinateSpace (d : Fin (s + 1)) + (f : Basis κ ℚ (W.L ⧸ W.rank.filtration.layer d.val 2)) : + Submodule ℚ (Fin 4 → κ → ℚ) := + (D.horizontal d).map (W.rank.filtration.fourHorizontalCoordinates d.val f) + +theorem coordinateSpace_eq_map (d : Fin (s + 1)) + (f : Basis κ ℚ (W.L ⧸ W.rank.filtration.layer d.val 2)) : + D.coordinateSpace d f = (D.spaces d).map (W.rank.filtration.fourAmbientCoordinates d.val f) := + W.rank.filtration.horizontalImage_coordinates d.val f (D.spaces d) (D.spaces_le_fourHorizontalLayer d) + +theorem exists_coordinate_generators (hP : 0 ≤ P) (d : Fin (s + 1)) + (f : Basis κ ℚ (W.L ⧸ W.rank.filtration.layer d.val 2)) {K : ℕ} + (hf : ∀ i j, RationalHeightLE + (f.repr ((W.rank.filtration.layer d.val 2).mkQ (W.model.basis j)) i) K) : + ∃ v : Fin (Fintype.card (Σ _ : Fin 4, Fin W.dim)) → (Fin 4 → κ → ℚ), + Submodule.span ℚ (Set.range v) = D.coordinateSpace d f ∧ + ∀ a k i, RationalHeightLE (v a k i) + ((W.dim + 1) * (⌈Real.exp (refiltrationCoordinateBudget P)⌉₊ * K) ^ W.dim) := by + obtain ⟨v, hspan, hv⟩ := (mem_heightBoundedSubspaces W.fourRankBasis _ _ _).mp + (D.spaces_mem_candidates hP d) + let φ := W.rank.filtration.fourAmbientCoordinates d.val f + refine ⟨fun a => φ (v a), ?_, ?_⟩ + · rw [D.coordinateSpace_eq_map, ← hspan, Submodule.map_span, ← Set.range_comp] + rfl + · intro a k i + have hv' (j : Fin 4) (l : Fin W.dim) : + RationalHeightLE (W.model.basis.repr (v a j) l) + ⌈Real.exp (refiltrationCoordinateBudget P)⌉₊ := by + simpa only [NativeDegreeRankFamily.fourRankBasis, Pi.basis_repr] using hv a ⟨j, l⟩ + simpa only [Fintype.card_fin] using W.rank.filtration.fourAmbientCoordinates_height + d.val f W.model.basis hf (v a) hv' k i + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module RationalFilteredNilmanifold + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} + +theorem exists_bounded_coordinate_generators (D : R.CommonData P) (hP : 0 ≤ P) (hbP : b ≤ P) + (d : Fin (s + 1)) (hd : 1 ≤ d.val) : + ∃ m : ℕ, m ≤ W.dim ∧ ∃ f : Basis (Fin m) ℚ (W.L ⧸ W.rank.filtration.layer d.val 2), + (∀ i j, rationalLogHeight (f.repr ((W.rank.filtration.layer d.val 2).mkQ (W.model.basis j)) i) ≤ + (P + 3) ^ 7) ∧ + ∃ v : Fin (Fintype.card (Σ _ : Fin 4, Fin W.dim)) → (Fin 4 → Fin m → ℚ), + Submodule.span ℚ (Set.range v) = D.coordinateSpace d f ∧ + ∀ a k i, rationalLogHeight (v a k i) ≤ horizontalCoordinateBudget P := by + obtain ⟨K, hK, hKp, m, hm, f, hf⟩ := + W.rank.exists_horizontal_ambient_basis d hd hP (W.complexity.mono W.rank hbP) + obtain ⟨v, hv, hheight⟩ := D.exists_coordinate_generators hP d f hf + have hdim : (W.dim : ℝ) ≤ P := W.complexity.1.1.trans hbP + have hbound := horizontalCoordinateHeight_bound hP W.dim + ⌈Real.exp (refiltrationCoordinateBudget P)⌉₊ K hdim + (ceil_exp_le_exp_add_one (refiltrationCoordinateBudget_nonneg hP)) hKp + refine ⟨m, hm, f, (fun i j => rationalLogHeight_le_of_height (hf i j) hKp), v, hv, ?_⟩ + intro a k i + exact rationalLogHeight_le_of_height (hheight a k i) hbound + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module RationalFilteredNilmanifold + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {κ : Type*} [Fintype κ] {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + (d : Fin (s + 1)) (f : Basis κ ℚ (W.L ⧸ W.rank.filtration.layer d.val 2)) + +noncomputable def realCoordinateSpace : Submodule ℝ ((Σ _ : Fin 4, κ) → ℝ) := + ((D.coordinateSpace d f).baseChange ℝ).map + (DegreeRankLieFiltration.realFourCoordinateEquiv (ι := κ)).toLinearMap + +theorem realCoordinateSpace_eq_image : + D.realCoordinateSpace d f = + ((D.horizontal d).baseChange ℝ).map (W.rank.filtration.realFourHorizontalCoordinates d.val f) := + (W.rank.filtration.realFourHorizontalCoordinates_image d.val f (D.horizontal d)).symm + +theorem realCoordinateSpace_mem + (x : (W.rank.filtration.fourHorizontalLayer d.val).baseChange ℝ) + (hx : W.rank.filtration.realFourHorizontalMap d.val x ∈ (D.horizontal d).baseChange ℝ) : + W.rank.filtration.realFourAmbientCoordinates d.val f x.val ∈ D.realCoordinateSpace d f := by + rw [D.realCoordinateSpace_eq_image, ← W.rank.filtration.realFourHorizontalCoordinates_map d.val f x] + exact ⟨_, hx, rfl⟩ + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module RationalFilteredNilmanifold + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {κ : Type*} [Fintype κ] {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} + +theorem exists_coordinate_corrections (D : R.CommonData P) (hs : 1 ≤ s) (hP : 0 ≤ P) + (t : ZMod N × ZMod N × ZMod N) (ht : t ∈ D.quadruples) + (α : Unit →₀ ℕ) (hα : Finsupp.weight (fun _ : Unit => 1) α ≤ s) + (f : Basis κ ℚ (W.L ⧸ W.rank.filtration.layer (Finsupp.weight (fun _ : Unit => 1) α) 2)) + {K : ℕ} (hf : ∀ i j, RationalHeightLE + (f.repr ((W.rank.filtration.layer (Finsupp.weight (fun _ : Unit => 1) α) 2).mkQ (W.model.basis j)) i) K) : + let I := R.interval ⟨t, D.subset ht⟩ + let V : I.SunflowerWitness P := D.witness t ht + ∃ E Q : (Σ _ : Fin 4, κ) → ℝ, + (∀ j, |E j| ≤ ((W.dim : ℝ) + 1) * (K + 1) * + (Real.exp ((P + 3) ^ 2) / monomialScale (fun _ : Unit => (I.length : ℝ)) α)) ∧ + Q ∈ realDenominatorGrid (matrixDenominator (quotientCoordinateMatrix W.model.basis f) * V.projectedDenominator) ∧ + W.rank.filtration.realFourAmbientCoordinates (Finsupp.weight (fun _ : Unit => 1) α) f + (V.projectedOrbitCoefficient α).val - E - Q ∈ + D.realCoordinateSpace ⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hα⟩ f := by + intro I V + obtain ⟨E, Q, hE, hQ, hres⟩ := D.exists_bounded_coefficient_corrections hs hP t ht + let φ := W.rank.filtration.realFourAmbientCoordinates (Finsupp.weight (fun _ : Unit => 1) α) f + refine ⟨φ (E α).val, φ (Q α).val, ?_, ?_, ?_⟩ + · intro j + have hscale := monomialScale_pos (fun _ : Unit => (I.length : ℝ)) + (fun _ => by exact_mod_cast I.length_pos) α + have hbound := W.rank.filtration.realFourAmbientCoordinates_bound + (Finsupp.weight (fun _ : Unit => 1) α) f W.model.basis hf (E α).val + (div_nonneg (Real.exp_pos _).le hscale.le) (hE α) j.1 j.2 + simpa only [Fintype.card_fin] using hbound + · exact W.rank.filtration.realFourAmbientCoordinates_grid + (Finsupp.weight (fun _ : Unit => 1) α) f W.model.basis V.projectedDenominator (Q α).val (hQ α) + · have h := D.realCoordinateSpace_mem + ⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hα⟩ f + (V.projectedOrbitCoefficient α - E α - Q α) (hres α hα) + change φ ((V.projectedOrbitCoefficient α).val - (E α).val - (Q α).val) ∈ _ at h + simpa only [map_sub] using h + +end Erdos3.NativeRankRelation.CommonData + +end + +section + +namespace Erdos3.NativeRankRelation.CommonData + +open Module RationalFilteredNilmanifold + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +variable {ι κ : Type*} [Fintype ι] {s r N : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} + +theorem exists_uniform_native_coordinate_corrections + (D : R.CommonData P) (hs : 1 ≤ s) (hP : 0 ≤ P) + (c : Basis κ ℚ W.L) (τ : κ → ℕ) + (hG : ∀ j, W.rank.filtration.associatedDegree.layer j = Submodule.span ℚ (c '' {i | j ≤ τ i})) : + let B := (P + 2) ^ 3 + 2 * P + ∃ (C : R.CommonData B) (l : ℕ), C.quadruples ⊆ D.quadruples ∧ C.spaces = D.spaces ∧ + 0 < l ∧ (l : ℝ) ≤ Real.exp ((P + 2) ^ 3 + P) ∧ + ∀ (α : Unit →₀ ℕ) (hα : Finsupp.weight (fun _ : Unit => 1) α ≤ s) + (f : Basis ι ℚ (W.L ⧸ W.rank.filtration.layer (Finsupp.weight (fun _ : Unit => 1) α) 2)) + (K : ℕ), + (∀ i j, RationalHeightLE + (f.repr ((W.rank.filtration.layer (Finsupp.weight (fun _ : Unit => 1) α) 2).mkQ + (W.model.basis j)) i) K) → + ∀ t (ht : t ∈ C.quadruples), + let I := R.interval ⟨t, C.subset ht⟩ + ∃ E Q : (Σ _ : Fin 4, ι) → ℝ, + (∀ j, |E j| ≤ ((W.dim : ℝ) + 1) * (K + 1) * + (Real.exp ((B + 3) ^ 2) / monomialScale (fun _ : Unit => (I.length : ℝ)) α)) ∧ + Q ∈ realDenominatorGrid (matrixDenominator (quotientCoordinateMatrix W.model.basis f) * l) ∧ + ((fun j : Σ _ : Fin 4, ι => (f.baseChange ℝ).repr + ((W.rank.filtration.higherHorizontalAmbient (Finsupp.weight (fun _ : Unit => 1) α)).baseChange ℝ + (W.horizontalCoefficient hs c τ hG α + (rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) j.1)))) j.2) - E - Q) ∈ + realFourCoordinateSpan + (C.coordinateSpace ⟨Finsupp.weight (fun _ : Unit => 1) α, Nat.lt_succ_of_le hα⟩ f) := by + intro B + obtain ⟨C, l, hCD, hspaces, hl, hlp, hdenom⟩ := D.exists_common_projected_denominator hP + have hB : 0 ≤ B := by dsimp only [B]; positivity + refine ⟨C, l, hCD, hspaces, hl, hlp, ?_⟩ + intro α hα f K hf t ht I + obtain ⟨E, Q, hE, hQ, hres⟩ := C.exists_coordinate_corrections hs hB t ht α hα f hf + refine ⟨E, Q, hE, ?_, ?_⟩ + · change Q ∈ realDenominatorGrid + (matrixDenominator (quotientCoordinateMatrix W.model.basis f) * (C.witness t ht).projectedDenominator) at hQ + simpa only [hdenom t ht] using hQ + · have hcoeff : W.rank.filtration.realFourAmbientCoordinates + (Finsupp.weight (fun _ : Unit => 1) α) f ((C.witness t ht).projectedOrbitCoefficient α).val = + (fun j : Σ _ : Fin 4, ι => (f.baseChange ℝ).repr + ((W.rank.filtration.higherHorizontalAmbient (Finsupp.weight (fun _ : Unit => 1) α)).baseChange ℝ + (W.horizontalCoefficient hs c τ hG α + (rankQuadrupleParameters t ((![1, 2, 0, 3] : Fin 4 → Fin 4) j.1)))) j.2) := by + funext j + exact (C.witness t ht).projectedOrbitCoefficient_native_coordinates hs c τ hG α f j.1 j.2 + rw [hcoeff] at hres + exact hres + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CommonRationalModelCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CommonRationalModelCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..fec34d4f1397b4faeb17513ef60c71a52353053c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CommonRationalModelCoordinates.lean @@ -0,0 +1,68 @@ +import OAI.Combinatorics.Progressions.Dynamics.RationalConstraintCountBudget +import OAI.Combinatorics.Progressions.Estimates.NativeModelOrbit + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module + +theorem exists_common_rational_model_coordinates + {G : Type*} {L : G → Type*} [∀ h, LieRing (L h)] [∀ h, LieAlgebra ℚ (L h)] + {s d : ℕ} (D : ∀ h, RationalFilteredNilmanifold (L h) s d) + (H : Finset G) (hH : H.Nonempty) {p : ℝ} (hp : 0 ≤ p) + (hD : ∀ h ∈ H, (D h).GeometryComplexityLE p) : + ∃ h₀ ∈ H, ∃ H' : Finset G, H' ⊆ H ∧ h₀ ∈ H' ∧ + (∀ h ∈ H', (D h).rationalModelCoordinates = (D h₀).rationalModelCoordinates) ∧ + Real.exp (-(3 * (d ^ 3 + (s + 1) * d ^ 2 : ℕ) * (p + 2))) * H.card ≤ (H'.card : ℝ) := by + let S : Set (RationalModelCoordinateIndex s d → ℚ) := + {c | ∀ z, rationalLogHeight (c z) ≤ p} + obtain ⟨hfinite, hcount⟩ := finite_card_bounded_height_arrays S ⌈Real.exp p⌉₊ + (fun _ hc z => rationalHeightLE_ceil_exp (hc z)) + have hcount' : (S.ncard : ℝ) ≤ Real.exp (3 * (d ^ 3 + (s + 1) * d ^ 2 : ℕ) * (p + 2)) := by + have hh := (Nat.cast_le.mpr hcount).trans + (rational_log_height_count_exp_bound (Fintype.card (RationalModelCoordinateIndex s d)) hp) + have hdim : Fintype.card (RationalModelCoordinateIndex s d) = d ^ 3 + (s + 1) * d ^ 2 := by + simp only [RationalModelCoordinateIndex, Fintype.card_sum, Fintype.card_prod, Fintype.card_fin] + ring + simpa only [hdim] using hh + obtain ⟨c, _, H', hsub, hnonempty, hcode, hlarge⟩ := + exists_exponential_constant_fiber H hH (fun h => (D h).rationalModelCoordinates) + S hfinite (fun h hh => (D h).rationalModelCoordinates_height hp (hD h hh)) hcount' + obtain ⟨h₀, hh₀⟩ := hnonempty + exact ⟨h₀, hsub hh₀, H', hsub, hh₀, + (fun h hh => (hcode h hh).trans (hcode h₀ hh₀).symm), hlarge⟩ + +theorem exists_common_rational_model_power (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {G : Type*} {L : G → Type*} + [∀ h, LieRing (L h)] [∀ h, LieAlgebra ℚ (L h)] {d : ℕ} + (D : ∀ h, RationalFilteredNilmanifold (L h) s d) (H : Finset G), H.Nonempty → + ∀ {p : ℝ}, 0 ≤ p → (∀ h ∈ H, (D h).GeometryComplexityLE p) → + ∃ h₀ ∈ H, ∃ H' : Finset G, H' ⊆ H ∧ h₀ ∈ H' ∧ + (∀ h ∈ H', (D h).rationalModelCoordinates = (D h₀).rationalModelCoordinates) ∧ + Real.exp (-((p + C) ^ C)) * H.card ≤ (H'.card : ℝ) := by + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (3 * (X ^ 3 + Polynomial.C (s + 1) * X ^ 2) * (X + 2)) + refine ⟨C, hC, ?_⟩ + intro G L _ _ d D H hH p hp hD + obtain ⟨h₀, hh₀, H', hsub, hh₀', heq, hlarge⟩ := + exists_common_rational_model_coordinates D H hH hp hD + have hd := (hD h₀ hh₀).1 + have hb : 3 * (d ^ 3 + (s + 1) * d ^ 2 : ℕ) * (p + 2) ≤ (p + C) ^ C := by + have hb' : 3 * (p ^ 3 + (s + 1 : ℕ) * p ^ 2) * (p + 2) ≤ (p + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget p hp + apply le_trans _ hb' + push_cast + gcongr + exact ⟨h₀, hh₀, H', hsub, hh₀', heq, + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hb)) + (Nat.cast_nonneg _)).trans hlarge⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CommonRefilteredFactorsSymbolTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CommonRefilteredFactorsSymbolTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..a751756d81918391a57873007bd18751c8f0612d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CommonRefilteredFactorsSymbolTransport.lean @@ -0,0 +1,408 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialCoordinateFreezeBounds + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial + +variable {σ τ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +attribute [local irreducible] weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom + +theorem realPolynomialSymbolHom_frozenChart_independent + (w : σ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE (fun _ : τ => 1) (w i)) + (keep : τ → Prop) (fixed fixed' : {i // ¬keep i} → ℝ) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom w (fun _ : {i // keep i} => 1) + (fun i => freezePolynomial keep fixed (β i)) + (fun i => freezePolynomial_support keep fixed (hβ i)) g) = + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom w (fun _ : {i // keep i} => 1) + (fun i => freezePolynomial keep fixed' (β i)) + (fun i => freezePolynomial_support keep fixed' (hβ i)) g) := by + rw [F.realPolynomialSymbolHom_weightedAdaptedRealChart, + F.realPolynomialSymbolHom_weightedAdaptedRealChart] + have htop : (fun i => weightedHomogeneousComponent (fun _ : {i // keep i} => 1) (w i) + (freezePolynomial keep fixed (β i))) = + (fun i => weightedHomogeneousComponent (fun _ : {i // keep i} => 1) (w i) + (freezePolynomial keep fixed' (β i))) := by + funext i + exact freezePolynomial_top_independent keep fixed fixed' + ((mem_weightedSupportLE_one_iff _ _).mp (hβ i)) + congr 1 + congr 1 + +theorem realSymbolFactorization_frozenChart_change_fiber + (w : σ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE (fun _ : τ => 1) (w i)) + (keep : τ → Prop) (fixed fixed' : {i // ¬keep i} → ℝ) + (g : (F.realification.adaptedPolynomialFiltration w).Group) + (E P R : F.RealPolynomialSymbolGroup (fun _ : {i // keep i} => 1)) + (hfactor : E * P * R = F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom w (fun _ : {i // keep i} => 1) + (fun i => freezePolynomial keep fixed (β i)) + (fun i => freezePolynomial_support keep fixed (hβ i)) g)) : + E * P * R = F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (F.weightedAdaptedRealChartHom w (fun _ : {i // keep i} => 1) + (fun i => freezePolynomial keep fixed' (β i)) + (fun i => freezePolynomial_support keep fixed' (hβ i)) g) := + hfactor.trans (F.realPolynomialSymbolHom_frozenChart_independent b ω hF w β hβ keep fixed fixed' g) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped Classical + +variable {σ R : Type*} [CommRing R] + +noncomputable def nestedFrozenCoordinate + (keepLong keepLater : σ → Prop) + (fixed : {i : {i // keepLong i} // ¬keepLater i.val} → R) + (i : {i // keepLong i}) : MvPolynomial {i // keepLater i} R := + if hi : keepLater i.val then X ⟨i.val, hi⟩ else C (fixed ⟨i, hi⟩) + +theorem nestedFrozenCoordinate_support + (keepLong keepLater : σ → Prop) + (fixed : {i : {i // keepLong i} // ¬keepLater i.val} → R) + (i : {i // keepLong i}) : + nestedFrozenCoordinate keepLong keepLater fixed i ∈ weightedSupportLE (fun _ : {i : σ // keepLater i} => 1) 1 := by + by_cases hi : keepLater i.val + · simp only [nestedFrozenCoordinate, dite_eq_left hi] + exact weightedSupportLE_X (R := R) (fun _ : {i : σ // keepLater i} => 1) ⟨i.val, hi⟩ + · simp only [nestedFrozenCoordinate, dite_eq_right hi] + exact weightedSupportLE_C (fun _ : {i : σ // keepLater i} => 1) 1 (fixed ⟨i, hi⟩) + +def nestedFrozenVariableEquiv + (keepLong keepLater : σ → Prop) (hsub : ∀ i, keepLater i → keepLong i) : + {i // keepLater i} ≃ {i : {i // keepLong i} // keepLater i.val} where + toFun i := ⟨⟨i.val, hsub i.val i.property⟩, i.property⟩ + invFun i := ⟨i.val.val, i.property⟩ + left_inv _ := rfl + right_inv _ := rfl + +theorem nestedFrozenCoordinate_eq_freeze_reindex + (keepLong keepLater : σ → Prop) (hsub : ∀ i, keepLater i → keepLong i) + (fixed : {i : {i // keepLong i} // ¬keepLater i.val} → R) : + (fun i => aeval + (fun j => X ((nestedFrozenVariableEquiv keepLong keepLater hsub).symm j)) + (frozenCoordinate (fun i : {i // keepLong i} => keepLater i.val) fixed i)) = + nestedFrozenCoordinate keepLong keepLater fixed := by + funext i + by_cases hi : keepLater i.val <;> + simp [frozenCoordinate, nestedFrozenCoordinate, nestedFrozenVariableEquiv, hi] + +theorem frozenCoordinate_zero_comp_nested + (keepLong keepLater : σ → Prop) (hsub : ∀ i, keepLater i → keepLong i) : + (fun i => aeval (nestedFrozenCoordinate keepLong keepLater (0 : {i : {i // keepLong i} // ¬keepLater i.val} → R)) + (frozenCoordinate keepLong (0 : {i // ¬keepLong i} → R) i)) = + frozenCoordinate keepLater (0 : {i // ¬keepLater i} → R) := by + funext i + by_cases hlater : keepLater i + · have hlong := hsub i hlater + simp [frozenCoordinate, nestedFrozenCoordinate, hlater, hlong] + · by_cases hlong : keepLong i <;> + simp [frozenCoordinate, nestedFrozenCoordinate, hlater, hlong] + +theorem nestedFrozenCoordinate_top_independent + (keepOriginal keepLater : σ → Prop) + (fixed fixed' : {i : {i // keepOriginal i} // ¬keepLater i.val} → R) + (i : {i // keepOriginal i}) : + weightedHomogeneousComponent (fun _ : {i // keepLater i} => 1) 1 + (nestedFrozenCoordinate keepOriginal keepLater fixed i) = + weightedHomogeneousComponent (fun _ : {i // keepLater i} => 1) 1 + (nestedFrozenCoordinate keepOriginal keepLater fixed' i) := by + by_cases hi : keepLater i.val + · simp only [nestedFrozenCoordinate, dite_eq_left hi] + · simp only [nestedFrozenCoordinate, dite_eq_right hi] + rw [weightedHomogeneousComponent_of_mem (isWeightedHomogeneous_C (R := R) _ _), + weightedHomogeneousComponent_of_mem (isWeightedHomogeneous_C (R := R) _ _)] + norm_num + +theorem nestedFrozenCoordinate_zero_comp + (keepOriginal keepLong keepLater : σ → Prop) + (hsub : ∀ i, keepLater i → keepLong i) : + (fun i => aeval + (nestedFrozenCoordinate keepLong keepLater + (0 : {i : {i // keepLong i} // ¬keepLater i.val} → R)) + (nestedFrozenCoordinate keepOriginal keepLong + (0 : {i : {i // keepOriginal i} // ¬keepLong i.val} → R) i)) = + nestedFrozenCoordinate keepOriginal keepLater + (0 : {i : {i // keepOriginal i} // ¬keepLater i.val} → R) := by + funext i + by_cases hlater : keepLater i.val + · have hlong := hsub i.val hlater + simp [nestedFrozenCoordinate, hlater, hlong] + · by_cases hlong : keepLong i.val <;> + simp [nestedFrozenCoordinate, hlater, hlong] + +namespace NilpotentLieFiltration + +open Module VectorPolynomial + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +attribute [local irreducible] weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom + +theorem weightedAdaptedRealChartHom_nested_zero + (keepLong keepLater : σ → Prop) (hsub : ∀ i, keepLater i → keepLong i) + (g : (F.realification.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) : + F.weightedAdaptedRealChartHom (fun _ : σ => 1) (fun _ : {i // keepLater i} => 1) + (frozenCoordinate keepLater 0) (frozenCoordinate_support keepLater 0) g = + F.weightedAdaptedRealChartHom (fun _ : {i // keepLong i} => 1) + (fun _ : {i // keepLater i} => 1) (nestedFrozenCoordinate keepLong keepLater 0) + (nestedFrozenCoordinate_support keepLong keepLater 0) + (F.weightedAdaptedRealChartHom (fun _ : σ => 1) (fun _ : {i // keepLong i} => 1) + (frozenCoordinate keepLong 0) (frozenCoordinate_support keepLong 0) g) := by + have hcomp := F.weightedAdaptedRealChartHom_comp + (fun _ : σ => 1) (fun _ : {i // keepLong i} => 1) (fun _ : {i // keepLater i} => 1) + (frozenCoordinate keepLong 0) (nestedFrozenCoordinate keepLong keepLater 0) + (frozenCoordinate_support keepLong 0) (nestedFrozenCoordinate_support keepLong keepLater 0) + (weightedRealChart_comp_support _ _ _ _ _ + (frozenCoordinate_support keepLong 0) (nestedFrozenCoordinate_support keepLong keepLater 0)) g + simpa only [frozenCoordinate_zero_comp_nested keepLong keepLater hsub] using hcomp + +theorem realPolynomialSymbolHom_nested_frozenCoordinate + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (keepLong keepLater : σ → Prop) (hsub : ∀ i, keepLater i → keepLong i) + (fixed : {i // ¬keepLater i} → ℝ) + (g : (F.realification.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) : + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keepLater i} => 1) + (F.weightedAdaptedRealChartHom (fun _ : σ => 1) (fun _ : {i // keepLater i} => 1) + (frozenCoordinate keepLater fixed) (frozenCoordinate_support keepLater fixed) g) = + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keepLater i} => 1) + (F.weightedAdaptedRealChartHom (fun _ : {i // keepLong i} => 1) + (fun _ : {i // keepLater i} => 1) (nestedFrozenCoordinate keepLong keepLater 0) + (nestedFrozenCoordinate_support keepLong keepLater 0) + (F.weightedAdaptedRealChartHom (fun _ : σ => 1) (fun _ : {i // keepLong i} => 1) + (frozenCoordinate keepLong 0) (frozenCoordinate_support keepLong 0) g)) := by + rw [← F.weightedAdaptedRealChartHom_nested_zero keepLong keepLater hsub g] + simpa only [freezePolynomial, aeval_X] using + F.realPolynomialSymbolHom_frozenChart_independent b ω hF (fun _ : σ => 1) + (fun i => X i) (fun i => weightedSupportLE_X (R := ℝ) (fun _ : σ => 1) i) + keepLater fixed 0 g + +theorem weightedAdaptedRealChartHom_nested_nested_zero + (keepOriginal keepLong keepLater : σ → Prop) + (hsub : ∀ i, keepLater i → keepLong i) + (g : (F.realification.adaptedPolynomialFiltration + (fun _ : {i // keepOriginal i} => 1)).Group) : + F.weightedAdaptedRealChartHom (fun _ : {i // keepOriginal i} => 1) + (fun _ : {i // keepLater i} => 1) + (nestedFrozenCoordinate keepOriginal keepLater 0) + (nestedFrozenCoordinate_support keepOriginal keepLater 0) g = + F.weightedAdaptedRealChartHom (fun _ : {i // keepLong i} => 1) + (fun _ : {i // keepLater i} => 1) (nestedFrozenCoordinate keepLong keepLater 0) + (nestedFrozenCoordinate_support keepLong keepLater 0) + (F.weightedAdaptedRealChartHom (fun _ : {i // keepOriginal i} => 1) + (fun _ : {i // keepLong i} => 1) (nestedFrozenCoordinate keepOriginal keepLong 0) + (nestedFrozenCoordinate_support keepOriginal keepLong 0) g) := by + have hcomp := F.weightedAdaptedRealChartHom_comp + (fun _ : {i // keepOriginal i} => 1) (fun _ : {i // keepLong i} => 1) + (fun _ : {i // keepLater i} => 1) + (nestedFrozenCoordinate keepOriginal keepLong 0) + (nestedFrozenCoordinate keepLong keepLater 0) + (nestedFrozenCoordinate_support keepOriginal keepLong 0) + (nestedFrozenCoordinate_support keepLong keepLater 0) + (weightedRealChart_comp_support _ _ _ _ _ + (nestedFrozenCoordinate_support keepOriginal keepLong 0) + (nestedFrozenCoordinate_support keepLong keepLater 0)) g + simpa only [nestedFrozenCoordinate_zero_comp keepOriginal keepLong keepLater hsub] using hcomp + +theorem realPolynomialSymbolHom_nested_frozenCoordinate_independent + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (keepOriginal keepLater : σ → Prop) + (fixed fixed' : {i : {i // keepOriginal i} // ¬keepLater i.val} → ℝ) + (g : (F.realification.adaptedPolynomialFiltration + (fun _ : {i // keepOriginal i} => 1)).Group) : + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keepLater i} => 1) + (F.weightedAdaptedRealChartHom (fun _ : {i // keepOriginal i} => 1) + (fun _ : {i // keepLater i} => 1) + (nestedFrozenCoordinate keepOriginal keepLater fixed) + (nestedFrozenCoordinate_support keepOriginal keepLater fixed) g) = + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keepLater i} => 1) + (F.weightedAdaptedRealChartHom (fun _ : {i // keepOriginal i} => 1) + (fun _ : {i // keepLater i} => 1) + (nestedFrozenCoordinate keepOriginal keepLater fixed') + (nestedFrozenCoordinate_support keepOriginal keepLater fixed') g) := by + rw [F.realPolynomialSymbolHom_weightedAdaptedRealChart, + F.realPolynomialSymbolHom_weightedAdaptedRealChart] + have htop : + (fun i => weightedHomogeneousComponent (fun _ : {i // keepLater i} => 1) 1 + (nestedFrozenCoordinate keepOriginal keepLater fixed i)) = + (fun i => weightedHomogeneousComponent (fun _ : {i // keepLater i} => 1) 1 + (nestedFrozenCoordinate keepOriginal keepLater fixed' i)) := by + funext i + exact nestedFrozenCoordinate_top_independent keepOriginal keepLater fixed fixed' i + congr 1 + congr 1 + +theorem realPolynomialSymbolHom_nested_nested_frozenCoordinate + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (keepOriginal keepLong keepLater : σ → Prop) + (hsub : ∀ i, keepLater i → keepLong i) + (fixed : {i : {i // keepOriginal i} // ¬keepLater i.val} → ℝ) + (g : (F.realification.adaptedPolynomialFiltration + (fun _ : {i // keepOriginal i} => 1)).Group) : + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keepLater i} => 1) + (F.weightedAdaptedRealChartHom (fun _ : {i // keepOriginal i} => 1) + (fun _ : {i // keepLater i} => 1) + (nestedFrozenCoordinate keepOriginal keepLater fixed) + (nestedFrozenCoordinate_support keepOriginal keepLater fixed) g) = + F.realPolynomialSymbolHom b ω hF (fun _ : {i // keepLater i} => 1) + (F.weightedAdaptedRealChartHom (fun _ : {i // keepLong i} => 1) + (fun _ : {i // keepLater i} => 1) (nestedFrozenCoordinate keepLong keepLater 0) + (nestedFrozenCoordinate_support keepLong keepLater 0) + (F.weightedAdaptedRealChartHom (fun _ : {i // keepOriginal i} => 1) + (fun _ : {i // keepLong i} => 1) (nestedFrozenCoordinate keepOriginal keepLong 0) + (nestedFrozenCoordinate_support keepOriginal keepLong 0) g)) := by + rw [← F.weightedAdaptedRealChartHom_nested_nested_zero keepOriginal keepLong keepLater hsub g] + exact F.realPolynomialSymbolHom_nested_frozenCoordinate_independent + b ω hF keepOriginal keepLater fixed 0 g + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped TensorProduct + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +attribute [local irreducible] weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom + +theorem HasCommonRefilteredOrbitFactors.freeze + (keep : σ → Prop) [DecidablePred keep] + (fixed : {i // ¬keep i} → ℝ) (side : σ → ℝ) (q : ℝ) (l : ℕ) + (W : LieSubalgebra ℚ F.AssociatedGraded) + (g : (F.realification.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) + (h : F.HasCommonRefilteredOrbitFactors b ω hF side q l W g) : + F.HasCommonRefilteredOrbitFactors b ω hF (fun i : {i // keep i} => side i.val) + q l W (F.weightedAdaptedRealChartHom (fun _ : σ => 1) + (fun _ : {i // keep i} => 1) (frozenCoordinate keep fixed) + (frozenCoordinate_support keep fixed) g) := by + classical + obtain ⟨left, middle, right, hprod, hmid, hleft, hright, hleft0, hright0, _⟩ := h + let pull := F.polynomialCoordinateFreezeZeroHom keep + let actual := F.weightedAdaptedRealChartHom (fun _ : σ => 1) + (fun _ : {i // keep i} => 1) (frozenCoordinate keep fixed) + (frozenCoordinate_support keep fixed) g + let adjusted := (pull left)⁻¹ * actual * (pull right)⁻¹ + let symbol := F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + have hfiber : symbol actual = symbol (pull g) := by + symm + simpa only [symbol, actual, pull, polynomialCoordinateFreezeZeroHom, + freezePolynomial, aeval_X] using + F.realPolynomialSymbolHom_frozenChart_independent b ω hF (fun _ : σ => 1) + (fun i => X i) (fun i => weightedSupportLE_X (R := ℝ) (fun _ : σ => 1) i) + keep 0 fixed g + have hcancel : (pull left)⁻¹ * pull g * (pull right)⁻¹ = pull middle := by + rw [← hprod, map_mul, map_mul] + group + have hadjusted : symbol adjusted = symbol (pull middle) := by + calc + _ = symbol ((pull left)⁻¹ * pull g * (pull right)⁻¹) := by + simp only [adjusted, map_mul, map_inv, hfiber] + _ = _ := congrArg symbol hcancel + have hactual : pull left * adjusted * pull right = actual := by + dsimp only [adjusted] + group + have he0 := F.polynomialCoordinateFreezeZeroHom_zero_constant keep b left hleft0 + have hr0 := F.polynomialCoordinateFreezeZeroHom_zero_constant keep b right hright0 + refine ⟨pull left, adjusted, pull right, hactual, ?_, + F.polynomialSlowBound_freeze_zero keep b side left hleft, + F.polynomialRationalGrid_freeze_zero keep b l right hright, he0, hr0, ?_⟩ + · change ∀ t, VectorPolynomial.eval₂ t (F.realGradedSymbolPolynomial b ω hF + (fun _ : {i // keep i} => 1) (symbol adjusted).coord) ∈ _ + rw [hadjusted] + apply (F.mem_real_symbolPointwiseSubalgebra_iff_values b ω hF + (fun _ : {i // keep i} => 1) W _).mp + have hsymbol := F.realPolynomialSymbolHom_homogeneousChart b ω hF + (fun _ : σ => 1) (fun _ : {i // keep i} => 1) (frozenCoordinate keep 0) + (frozenCoordinate_zero_homogeneous keep) middle (pull middle) + (F.polynomialCoordinateFreezeZeroHom_coord keep middle) + change (F.realPolynomialSymbolHom b ω hF (fun _ : {i // keep i} => 1) + (pull middle)).coord ∈ _ + rw [hsymbol] + apply F.realSymbolHomogeneousPullback_mem_pointwise b ω hF + exact (F.mem_real_symbolPointwiseSubalgebra_iff_values b ω hF + (fun _ : σ => 1) W _).mpr hmid + · exact F.realification.polynomial_factor_middle_constant + (fun _ : {i // keep i} => 1) actual (pull left) adjusted (pull right) + hactual he0 hr0 + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +attribute [local irreducible] realPolynomialSymbolHom + +theorem HasCommonRefilteredOrbitFactors.of_symbol_eq + (side : σ → ℝ) (q : ℝ) (l : ℕ) (W : LieSubalgebra ℚ F.AssociatedGraded) + (g actual : (F.realification.adaptedPolynomialFiltration (fun _ : σ => 1)).Group) + (h : F.HasCommonRefilteredOrbitFactors b ω hF side q l W g) + (hsymbol : F.realPolynomialSymbolHom b ω hF (fun _ : σ => 1) actual = + F.realPolynomialSymbolHom b ω hF (fun _ : σ => 1) g) : + F.HasCommonRefilteredOrbitFactors b ω hF side q l W actual := by + obtain ⟨left, middle, right, hprod, hmid, hleft, hright, hleft0, hright0, _⟩ := h + let adjusted := left⁻¹ * actual * right⁻¹ + let symbol := F.realPolynomialSymbolHom b ω hF (fun _ : σ => 1) + have hcancel : left⁻¹ * g * right⁻¹ = middle := by + rw [← hprod] + group + have hadjusted : symbol adjusted = symbol middle := by + calc + _ = symbol (left⁻¹ * g * right⁻¹) := by + simp only [adjusted, map_mul, map_inv, show symbol actual = symbol g from hsymbol] + _ = _ := congrArg symbol hcancel + have hactual : left * adjusted * right = actual := by + dsimp only [adjusted] + group + refine ⟨left, adjusted, right, hactual, ?_, hleft, hright, hleft0, hright0, ?_⟩ + · change ∀ t, eval₂ t (F.realGradedSymbolPolynomial b ω hF + (fun _ : σ => 1) (symbol adjusted).coord) ∈ _ + rw [hadjusted] + exact hmid + · exact F.realification.polynomial_factor_middle_constant + (fun _ : σ => 1) actual left adjusted right hactual hleft0 hright0 + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CommonStrideCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CommonStrideCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ffc05ce289b4d107abc93eee9705d3c554a06fa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CommonStrideCoordinates.lean @@ -0,0 +1,86 @@ +import OAI.Combinatorics.Progressions.Estimates.DenseProgressionInnerFamily +import OAI.Combinatorics.Progressions.Lattices.IntegerAffineSubstitution + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def commonStrideBox {I : Type*} [Fintype I] [DecidableEq I] + (c : I → ℤ) (m : ℕ) (H : I → ℕ) : Finset (I → ℤ) := + Fintype.piFinset (fun i => integerProgressionSupport (c i) m (H i)) + +theorem commonStrideBox_card {I : Type*} [Fintype I] [DecidableEq I] + (c : I → ℤ) {m : ℕ} (hm : 0 < m) (H : I → ℕ) : + (commonStrideBox c m H).card = ∏ i, H i := by + simp only [commonStrideBox, Fintype.card_piFinset, card_integerProgressionSupport _ _ _ hm] + +theorem commonStrideBox_nonempty {I : Type*} [Fintype I] [DecidableEq I] + (c : I → ℤ) {m : ℕ} (hm : 0 < m) (H : I → ℕ) (hH : ∀ i, 0 < H i) : + (commonStrideBox c m H).Nonempty := by + apply Fintype.piFinset_nonempty.mpr + intro i + apply Finset.card_pos.mp + simpa only [card_integerProgressionSupport _ _ _ hm] using hH i + +theorem affine_interval_eq_progression (r m a b : ℕ) : + (Finset.Ico (a : ℤ) (b : ℤ)).image (fun x => (r : ℤ) + m * x) = + integerProgressionSupport ((r : ℤ) + m * a) m (b - a) := by + by_cases hab : a ≤ b + · have he : (a : ℤ) + (b - a : ℕ) = b := by omega + rw [integerProgressionSupport_reindex, he] + · have hi : Finset.Ico (a : ℤ) (b : ℤ) = ∅ := Finset.Ico_eq_empty_of_le (by omega) + simp [Nat.sub_eq_zero_of_le (by omega : b ≤ a), hi, integerProgressionSupport, translateSupport] + +theorem commonStrideBox_eq_image {I : Type*} [Fintype I] [DecidableEq I] + (c : I → ℤ) (m : ℕ) (H : I → ℕ) : + commonStrideBox c m H = (integerBox H).image (fun x i => c i + (m : ℤ) * x i) := by + simp only [commonStrideBox, integerProgressionSupport, translateSupport, Finset.image_image] + exact Fintype.piFinset_image (fun i x => c i + (m : ℤ) * x) (fun i => Finset.Ico (0 : ℤ) (H i)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def commonStridePoint {I : Type*} (c : I → ℤ) (m : ℕ) (x : I → ℤ) : I → ℤ := + fun i => c i + (m : ℤ) * x i + +def commonStrideIndex {I : Type*} (c : I → ℤ) (m : ℕ) (y : I → ℤ) : I → ℤ := + fun i => (y i - c i) / (m : ℤ) + +theorem commonStrideIndex_point {I : Type*} (c : I → ℤ) {m : ℕ} (hm : 0 < m) (x : I → ℤ) : + commonStrideIndex c m (commonStridePoint c m x) = x := by + funext i + simp only [commonStrideIndex, commonStridePoint, add_sub_cancel_left] + exact Int.mul_ediv_cancel_left _ (by exact_mod_cast hm.ne' : (m : ℤ) ≠ 0) + +theorem commonStridePoint_injective {I : Type*} (c : I → ℤ) {m : ℕ} (hm : 0 < m) : + Function.Injective (commonStridePoint c m) := + Function.LeftInverse.injective (commonStrideIndex_point c hm) + +theorem commonStridePoint_mem {I : Type*} [Fintype I] [DecidableEq I] + (c : I → ℤ) (m : ℕ) (H : I → ℕ) {x : I → ℤ} (hx : x ∈ integerBox H) : + commonStridePoint c m x ∈ commonStrideBox c m H := by + rw [commonStrideBox_eq_image] + exact Finset.mem_image.mpr ⟨x, hx, rfl⟩ + +theorem integerAffineMap_diagonal {I : Type*} [Fintype I] [DecidableEq I] + (a s x : I → ℤ) : + integerAffineMap (fun i j => if i = j then s i else 0) a x = fun i => a i + s i * x i := by + funext i + simp [integerAffineMap, ite_mul] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CommonSupportRadius.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CommonSupportRadius.lean new file mode 100644 index 0000000000000000000000000000000000000000..4929a0535beacd161fbfb7cb749a497ac5df1534 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CommonSupportRadius.lean @@ -0,0 +1,42 @@ +import OAI.Combinatorics.Progressions.Lattices.AffineBlockScale + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def commonSupportRadius {D : Type*} [Fintype D] (H : D → ℝ) : ℕ := + ⌈∑ d, H d⌉₊ + +theorem commonSupportRadius_le {D : Type*} [Fintype D] (H : D → ℝ) + (hH : ∀ d, 0 ≤ H d) (d : D) : H d ≤ (commonSupportRadius H : ℝ) := by + classical + exact (Finset.single_le_sum (fun i _ => hH i) (Finset.mem_univ d)).trans (Nat.le_ceil _) + +theorem commonSupportRadius_upper {D : Type*} [Fintype D] (H : D → ℝ) + (hH : ∀ d, 0 ≤ H d) : (commonSupportRadius H : ℝ) ≤ (∑ d, H d) + 1 := + (Nat.ceil_lt_add_one (Finset.sum_nonneg (fun d _ => hH d))).le + +theorem commonSupportRadius_uniform {D : Type*} [Fintype D] (H : D → ℝ) + {C : ℝ} (hH : ∀ d, 0 ≤ H d) (hC : ∀ d, H d ≤ C) : + (commonSupportRadius H : ℝ) ≤ Fintype.card D * C + 1 := by + apply (commonSupportRadius_upper H hH).trans + have hh := Finset.sum_le_sum (fun d (_ : d ∈ (Finset.univ : Finset D)) => hC d) + simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] using add_le_add hh le_rfl + +theorem commonSupport_fundamental_boxes {D : Type*} [Fintype D] {J : D → Type*} + (H : D → ℝ) (K : D → ℕ) (center y : ∀ d, J d → ℤ) + (hH : ∀ d, 0 ≤ H d) (hK : ∀ d, 0 < K d) + (hy : ∀ d j, |(y d j : ℝ) - center d j| ≤ H d * K d) : + ∀ d, centeredFundamentalBox (commonSupportRadius H) (K d) (center d) (y d) := by + intro d + exact centeredFundamentalBox_of_support (center d) (y d) (hK d) (commonSupportRadius_le H hH d) (hy d) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CompactBoxIntegral.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CompactBoxIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..9fee9c12444bf4863f03104b1eed4536d8827939 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CompactBoxIntegral.lean @@ -0,0 +1,49 @@ +import Mathlib.MeasureTheory.Function.LocallyIntegrable +import OAI.Combinatorics.Progressions.Lattices.RectangularLatticeCells + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +variable {J : Type*} [Fintype J] + +theorem compactBox_integrable (f : (J → ℝ) → ℝ) (hf : Continuous f) (R : ℝ) + (hsupport : ∀ x, R < ‖x‖ → f x = 0) : Integrable f := by + apply hf.integrable_of_hasCompactSupport + apply HasCompactSupport.of_support_subset_isCompact (isCompact_closedBall (0 : J → ℝ) R) + intro x hx + rw [Metric.mem_closedBall, dist_zero_right] + by_contra! h + exact hx (hsupport x h) + +theorem integral_norm_le_box (f : (J → ℝ) → ℝ) {R C : ℝ} (hR : 0 ≤ R) + (hzero : ∀ x, R < ‖x‖ → f x = 0) (hbound : ∀ x, ‖x‖ ≤ R → ‖f x‖ ≤ C) : + (∫ x, ‖f x‖) ≤ C * (2 * R) ^ Fintype.card J := by + let s := Metric.closedBall (0 : J → ℝ) R + have hs : MeasurableSet s := measurableSet_closedBall + have hi : Integrable (s.indicator (fun _ : J → ℝ => C)) := + (integrableOn_const ((isCompact_closedBall (0 : J → ℝ) R).measure_lt_top.ne)).integrable_indicator hs + have hb : ∀ x, ‖f x‖ ≤ s.indicator (fun _ : J → ℝ => C) x := by + intro x + by_cases hx : x ∈ s + · have hx' : ‖x‖ ≤ R := by simpa only [s, Metric.mem_closedBall, dist_zero_right] using hx + simpa only [Set.indicator_of_mem hx] using hbound x hx' + · have hx' : R < ‖x‖ := by simpa only [s, Metric.mem_closedBall, dist_zero_right, not_le] using hx + simp only [hzero x hx', norm_zero, Set.indicator_of_notMem hx, le_refl] + have hv : volume.real s = (2 * R) ^ Fintype.card J := by + rw [measureReal_def, Real.volume_pi_closedBall 0 hR, ENNReal.toReal_ofReal (by positivity)] + calc + _ ≤ ∫ x, s.indicator (fun _ : J → ℝ => C) x := + integral_mono_of_nonneg (Filter.Eventually.of_forall (fun x => norm_nonneg (f x))) hi + (Filter.Eventually.of_forall hb) + _ = _ := by rw [integral_indicator_const C hs, hv, smul_eq_mul]; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ComparableScalarSliceParameterBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ComparableScalarSliceParameterBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ba467d542c2258464f1bd362789ca4f1d4d2bc2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ComparableScalarSliceParameterBox.lean @@ -0,0 +1,46 @@ +import OAI.Combinatorics.Progressions.Lattices.DenseResidueScalarRectangleGeometry + +namespace OAI + +section + +namespace Erdos3.ResidueBoxSlice + +variable {J : Type*} {P : J → ℕ} {q : ℕ} + +theorem comparableScalarSliceParameterBox_bounds (S : ResidueBoxSlice P q) (hq : 0 < q) + {L density ratio : ℝ} (hL : 1 ≤ L) (hdensity : 0 < density) + (hratio : 1 ≤ ratio) (hlong : 4 ≤ density * L) + (hP : ∀ j, (P j : ℝ) ≤ ratio * L) + (hlen : ∀ j, density * L / 2 ≤ (S.length j : ℝ)) : + (∀ j, (0 : ℤ) < (S.length j : ℤ)) ∧ + 0 < density * L / 2 ∧ + (∀ j, density * L / 2 ≤ (((S.length j : ℤ) - 0 : ℤ) : ℝ)) ∧ + (∀ j, (S.length j : ℤ) - 0 ≤ (⌈ratio * L⌉₊ : ℤ)) ∧ + (⌈ratio * L⌉₊ : ℝ) ≤ (4 * ratio / density) * (density * L / 2) ∧ + (density / 2) * L ≤ density * L / 2 ∧ + (∀ j, |(((S.start j : ℤ) + (q : ℤ) * 0 : ℤ) : ℝ) / L| ≤ 2 * ratio) ∧ + (∀ j, |(((S.start j : ℤ) + (q : ℤ) * (S.length j : ℤ) : ℤ) : ℝ) / L| ≤ + 2 * ratio) := by + obtain ⟨hlen2, hwidth, hwidthRatio, hleft, hright⟩ := + S.scalarRectangle_geometry hq hL hdensity hratio hlong hP hlen + refine ⟨?_, by positivity, ?_, ?_, hwidthRatio, ?_, ?_, ?_⟩ + · intro j + exact_mod_cast (show 0 < S.length j by have := hlen2 j; omega) + · intro j + simpa only [sub_zero, Int.cast_natCast] using hlen j + · intro j + simpa only [sub_zero] using (show (S.length j : ℤ) ≤ (⌈ratio * L⌉₊ : ℤ) by + exact_mod_cast hwidth j) + · apply le_of_eq + ring + · intro j + simpa only [mul_zero, add_zero, Int.cast_natCast] using hleft j + · intro j + simpa only [Int.cast_add, Int.cast_mul, Int.cast_natCast] using hright j + +end Erdos3.ResidueBoxSlice + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ComparisonProductMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ComparisonProductMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..b92e40ff2378983bdc33c7447c160f4e26adb260 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ComparisonProductMetric.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Estimates.SymmetricSquarefreeMonotonicity + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open scoped TensorProduct NNReal + +variable {σ : Type} {L I : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] [Fintype I] + {s d r : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (M : D.MultidegreeStructure bound) {p q v : ℝ} + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [T2Space (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + (V : D.UnitVerticalObservable (D.filtration.realification.subgroup s) I v) + (U : M.SymmetricSquarefreeUnitData p V.frequency q) + (E : RationalFilteredNilmanifold + (M.filtration.comparisonSubalgebra (fun j : ReplicatedIndex bound => j.1)) + (max s (Fintype.card (ReplicatedIndex bound))) r) + (hEL : E.lattice = M.comparisonLattice p U.grid U.grid_pos U.stable) + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.comparisonSubalgebra (fun j : ReplicatedIndex bound => j.1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.comparisonSubalgebra (fun j : ReplicatedIndex bound => j.1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.comparisonSubalgebra (fun j : ReplicatedIndex bound => j.1))] + [T2Space (ℝ ⊗[ℚ] M.filtration.comparisonSubalgebra (fun j : ReplicatedIndex bound => j.1))] + +theorem comparisonVerticalProduct_lipschitz {R : ℝ} (hR : 0 ≤ R) + (hD : D.GeometryComplexityLE R) + (hQ : (M.squarefreeModel p U.grid U.grid_pos U.stable).GeometryComplexityLE R) + (hE : E.GeometryComplexityLE R) + (hfirst : ∀ j k, rationalLogHeight (D.basis.repr (E.basis j).val.1 k) ≤ R) + (hsecond : ∀ j k, rationalLogHeight ((M.squarefreeFinBasis p).repr (E.basis j).val.2 k) ≤ R) + (ε : D.RealGroup) (A : ℝ≥0) + (hε : letI := D.metricSpace; LipschitzWith A (fun x : D.Space => ε • x)) + (a : Fin (multidegreeFactorial bound) → I) + (k : SymmetricEvaluationIndex (Fintype.card (ReplicatedPermutation bound)) (Fin U.coordinateCount)) : + letI := E.metricSpace + let P : ℝ≥0 := ⟨Real.exp ((R + 3) ^ 2), (Real.exp_pos _).le⟩ + LipschitzWith ((V.tensorPower (multidegreeFactorial bound)).lipBound * (A * P) + + U.observable.lipBound * P) (M.comparisonVerticalProduct V U E hEL ε a k) := by + let := D.metricSpace + let := (M.squarefreeModel p U.grid U.grid_pos U.stable).metricSpace + let := E.metricSpace + have h₁ := ((V.tensorPower (multidegreeFactorial bound)).lipschitz a).comp + (hε.comp (M.comparisonFirstSpace_lipschitz p U.grid U.grid_pos U.stable E hEL hR hD hE hfirst)) + have h₂ := (U.observable.lipschitz k).comp + (M.comparisonSecondSpace_lipschitz p U.grid U.grid_pos U.stable E hEL hR hQ hE hsecond) + have h := lipschitz_mul_star_of_bounds + (fun x => (V.tensorPower (multidegreeFactorial bound)).observable a + (ε • M.comparisonFirstSpace p U.grid U.grid_pos U.stable E hEL x)) + (fun x => U.observable.observable k (M.comparisonSecondSpace p U.grid U.grid_pos U.stable E hEL x)) + (Bf := 1) (Bg := 1) h₁ h₂ + (fun x => (V.tensorPower (multidegreeFactorial bound)).norm a _) (fun x => U.observable.norm k _) + simp only [one_mul] at h + rw [add_comm] at h + convert h using 1 + rfl + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ConjugationCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ConjugationCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..7bee584275190eb1c7cf52800d58367fa547566b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ConjugationCoordinates.lean @@ -0,0 +1,104 @@ +import OAI.Combinatorics.Progressions.Nilpotent.BCHOuterGridChangeBasis +import OAI.Combinatorics.Progressions.Nilpotent.BCHUniformQuotientCharts + +namespace OAI + +section + +namespace Erdos3 + +open Module MvPolynomial + +def conjugationInput {ι : Type*} (a b : ι → ℚ) : Fin 3 × ι → ℚ := + fun ji => ![a ji.2, b ji.2, -a ji.2] ji.1 + +theorem conjugationInput_mem_denominatorGrid {ι : Type*} (a b : ι → ℚ) (q : ℕ) + (ha : a ∈ denominatorGrid q) (hb : b ∈ denominatorGrid q) : + conjugationInput a b ∈ denominatorGrid q := by + obtain ⟨za, hza⟩ := ha + obtain ⟨zb, hzb⟩ := hb + refine ⟨fun ji => ![za ji.2, zb ji.2, -za ji.2] ji.1, ?_⟩ + rintro ⟨j, i⟩ + have hai : (q : ℚ) * a i = (za i : ℚ) := hza i + have hbi : (q : ℚ) * b i = (zb i : ℚ) := hzb i + fin_cases j <;> simp [conjugationInput, Pi.smul_apply, smul_eq_mul, hai, hbi] + +theorem scaledIntegerGrid_mem_denominatorGrid {ι : Type*} (m q : ℕ) {b : ι → ℚ} + (hb : b ∈ scaledIntegerGrid m) : b ∈ denominatorGrid q := by + obtain ⟨z, rfl⟩ := hb + refine ⟨fun i => (q : ℤ) * m * z i, ?_⟩ + intro i + simp [Pi.smul_apply, smul_eq_mul, mul_assoc] + +theorem conjugationInput_sub_mem_scaledGrid {ι : Type*} (a b : ι → ℚ) (m : ℕ) + (hb : b ∈ scaledIntegerGrid m) : + conjugationInput a b - conjugationInput a 0 ∈ scaledIntegerGrid m := by + obtain ⟨z, hz⟩ := hb + refine ⟨fun ji => ![0, z ji.2, 0] ji.1, ?_⟩ + funext ⟨j, i⟩ + have hi := congrFun hz i + change b i = (m : ℚ) * (z i : ℚ) at hi + fin_cases j <;> simp [conjugationInput, Pi.smul_apply, smul_eq_mul, hi] + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + +noncomputable def conjugationCoordinatePolynomial (e : Basis ι ℚ L) (s : ℕ) (i : ι) : + MvPolynomial (Fin 3 × ι) ℚ := + bchProductCoordinatePolynomial (lieStructureConstants e) s [0, 1, 2] i + +theorem conjugationCoordinatePolynomial_degree (e : Basis ι ℚ L) (s : ℕ) (i : ι) : + (conjugationCoordinatePolynomial e s i).totalDegree ≤ s := + bchProductCoordinatePolynomial_totalDegree _ _ _ _ + +theorem conjugationCoordinatePolynomial_eval (e : Basis ι ℚ L) {s : ℕ} + (hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥) + (z g : NilpotentLieBCHGroup L s hnil) (i : ι) : + eval (conjugationInput (e.equivFun z.coord) (e.equivFun g.coord)) + (conjugationCoordinatePolynomial e s i) = e.repr (z * g * z⁻¹).coord i := by + let f : Fin 3 → NilpotentLieBCHGroup L s hnil := ![z, g, z⁻¹] + have he := bchProductCoordinatePolynomial_eval e s hnil (fun j => (f j).coord) [0, 1, 2] i + have hp := lieBCHList_group_prod s hnil (fun j => (f j).coord) [0, 1, 2] + rw [← hp] at he + have hmap : ([0, 1, 2].map (fun j => (⟨(f j).coord⟩ : NilpotentLieBCHGroup L s hnil))) = + [z, g, z⁻¹] := by simp [f]; rfl + rw [hmap] at he + simp only [List.prod_cons, List.prod_nil, mul_one] at he + have hi : (fun ji : Fin 3 × ι => e.repr (f ji.1).coord ji.2) = + conjugationInput (e.equivFun z.coord) (e.equivFun g.coord) := by + funext ⟨j, k⟩ + fin_cases j <;> simp [f, conjugationInput] + change eval (fun ji : Fin 3 × ι => e.repr (f ji.1).coord ji.2) + (conjugationCoordinatePolynomial e s i) = _ at he + rw [hi] at he + simpa only [mul_assoc] using he + +theorem conjugationCoordinatePolynomial_zero (e : Basis ι ℚ L) {s : ℕ} + (hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥) + (z : NilpotentLieBCHGroup L s hnil) (i : ι) : + eval (conjugationInput (e.equivFun z.coord) 0) (conjugationCoordinatePolynomial e s i) = 0 := by + simpa using conjugationCoordinatePolynomial_eval e hnil z 1 i + +theorem conjugation_preserves_inner_grid (e : Basis ι ℚ L) {s : ℕ} + (hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥) (q l : ℕ) (hq : 0 < q) + (z g : NilpotentLieBCHGroup L s hnil) + (hz : e.equivFun z.coord ∈ denominatorGrid q) + (hg : e.equivFun g.coord ∈ scaledIntegerGrid + (l * polynomialFamilyDenominator (conjugationCoordinatePolynomial e s) * q ^ s)) : + e.equivFun (z * g * z⁻¹).coord ∈ scaledIntegerGrid l := by + have hb := scaledIntegerGrid_mem_denominatorGrid _ q hg + have hzero : (0 : ι → ℚ) ∈ denominatorGrid q := ⟨0, by simp⟩ + have h := rational_polynomial_family_eval_sub_mem_grid + (conjugationCoordinatePolynomial e s) q s l hq (conjugationCoordinatePolynomial_degree e s) + (conjugationInput (e.equivFun z.coord) (e.equivFun g.coord)) + (conjugationInput (e.equivFun z.coord) 0) + (conjugationInput_mem_denominatorGrid _ _ q hz hb) + (conjugationInput_mem_denominatorGrid _ _ q hz hzero) + (conjugationInput_sub_mem_scaledGrid _ _ _ hg) + simpa only [conjugationCoordinatePolynomial_eval, conjugationCoordinatePolynomial_zero, + sub_zero, ← Basis.equivFun_apply] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ContainedSupportedProgressionReference.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ContainedSupportedProgressionReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea4496aad2feb0e07f4d2e13a48d44d82843e52c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ContainedSupportedProgressionReference.lean @@ -0,0 +1,64 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedSupportedSlicedResidue + +namespace OAI + +section + +namespace Erdos3 +open scoped Classical BigOperators + +private theorem fiberLaw_weight_pos_of_pos {X Y : Type*} [Fintype X] [Fintype Y] + (p : FiniteProbabilityWeights X) (f : X → Y) (x : X) (hx : 0 < p.weight x) : + 0 < (p.fiberLaw f).weight (f x) := by + change 0 < ∑ y, p.weight y * (if f y = f x then (1 : ℝ) else 0) + apply Finset.sum_pos' + · intro y _ + exact mul_nonneg (p.nonneg y) (by split_ifs <;> norm_num) + · exact ⟨x, Finset.mem_univ _, by simpa using hx⟩ + +variable {D α : Type*} [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] +variable (B : D → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] (h : D → ℕ) +variable (L H step : PrincipalTupleIndex B h → ℕ) (c : PrincipalTupleIndex B h → ℤ) +variable (hL : ∀ j, 0 < L j) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ Finset.Ico (0 : ℤ) (L j : ℤ)) +variable (q : ℕ) (r : PrincipalTupleIndex B h → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B h H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +local notation "law" => containedSupportedProgressionLaw B h L H step c hL hH hsubset q r hcell + +theorem containedSupportedProgressionLaw_restrict_weight_pos + (y : PrincipalIntegerTuples B h α L) (hy : 0 < (law).weight y) (P : D → Prop) : + 0 < (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).weight + (principalAxisRestrict P y) := by + rw [← containedSupportedProgressionAxisLaw_fiberLaw B h L H step c hL hH hsubset q r hcell P] + exact fiberLaw_weight_pos_of_pos (law) (principalAxisRestrict P) y hy + +theorem containedSupportedProgressionLaw_cube_support + (y : PrincipalIntegerTuples B h α L) (hy : (law).weight y ≠ 0) + (j : PrincipalTupleIndex B h) : IntegerScalarCube (L j) (fun a => (y j a : ℤ)) := by + apply FiniteProbabilityWeights.fiberLaw_support _ + (containedProgressionTupleMap B h L H step c hL hsubset) + (fun y => IntegerScalarCube (L j) (fun a => (y j a : ℤ))) _ y hy + intro z _ + exact containedProgressionCubeMap_cube α _ _ _ _ _ _ (z j) + +theorem exists_containedSupportedProgressionReference : + ∃ y₀ : PrincipalIntegerTuples B h α L, + 0 < (law).weight y₀ ∧ + (∀ j, IntegerScalarCube (L j) (fun a => (y₀ j a : ℤ))) ∧ + (∀ P : D → Prop, + 0 < (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).weight + (principalAxisRestrict P y₀)) ∧ + (∀ y, (law).weight y ≠ 0 → principalResidueLabel q y = principalResidueLabel q y₀) := by + obtain ⟨y₀, hy₀⟩ := (law).exists_weight_pos + refine ⟨y₀, hy₀, ?_, ?_, ?_⟩ + · exact containedSupportedProgressionLaw_cube_support B h L H step c hL hH hsubset q r hcell y₀ hy₀.ne' + · exact containedSupportedProgressionLaw_restrict_weight_pos B h L H step c hL hH hsubset q r hcell y₀ hy₀ + · intro y hy + exact containedSupportedProgressionLaw_residue_eq B h L H step c hL hH hsubset q r hcell y y₀ hy hy₀.ne' + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ContinuousOutputBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ContinuousOutputBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f523474e030aaaa18bbed40dc85cb47079a3c49 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ContinuousOutputBox.lean @@ -0,0 +1,65 @@ +import Mathlib.MeasureTheory.Integral.Prod +import Mathlib.MeasureTheory.Measure.Lebesgue.Basic +import Mathlib.MeasureTheory.Measure.Real + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +def continuousOutputBox (I : Type*) (R : ℝ≥0) : Set (I → ℝ) := + Set.Icc (fun _ => -(R : ℝ)) (fun _ => (R : ℝ)) + +noncomputable def continuousOutputBoxMeasure (I : Type*) [Fintype I] (R : ℝ≥0) : Measure (I → ℝ) := + volume.restrict (continuousOutputBox I R) + +instance continuousOutputBoxMeasure_finite (I : Type*) [Fintype I] (R : ℝ≥0) : + IsFiniteMeasure (continuousOutputBoxMeasure I R) := by + apply isFiniteMeasure_restrict.mpr + rw [continuousOutputBox, Real.volume_Icc_pi] + exact ENNReal.prod_ne_top (fun _ _ => ENNReal.ofReal_ne_top) + +theorem continuousOutputBoxMeasure_le (I : Type*) [Fintype I] (R : ℝ≥0) : + continuousOutputBoxMeasure I R ≤ volume := Measure.restrict_le_self + +theorem continuousOutputBox_mem_iff {I : Type*} [Fintype I] (R : ℝ≥0) (x : I → ℝ) : + x ∈ continuousOutputBox I R ↔ ‖x‖ ≤ (R : ℝ) := by + constructor + · intro hx + apply (pi_norm_le_iff_of_nonneg R.coe_nonneg).mpr + intro i + exact (Real.norm_eq_abs _).trans_le (abs_le.mpr ⟨hx.1 i, hx.2 i⟩) + · intro hx + have hi (i) : |x i| ≤ (R : ℝ) := + (Real.norm_eq_abs _).symm.trans_le ((norm_le_pi_norm x i).trans hx) + exact ⟨fun i => (abs_le.mp (hi i)).1, fun i => (abs_le.mp (hi i)).2⟩ + +theorem continuousOutputBoxMeasure_mass (I : Type*) [Fintype I] (R : ℝ≥0) : + (continuousOutputBoxMeasure I R).real Set.univ = (2*(R : ℝ))^Fintype.card I := by + rw [measureReal_def, continuousOutputBoxMeasure, Measure.restrict_apply_univ] + have horder : (fun _ : I => -(R : ℝ)) ≤ (fun _ => (R : ℝ)) := fun _ => neg_le_self R.coe_nonneg + simp only [continuousOutputBox, Real.volume_Icc_pi_toReal horder, sub_neg_eq_add, + ← two_mul, Finset.prod_const, Finset.card_univ] + +theorem continuousOutputBoxMeasure_prod {W I : Type*} [MeasurableSpace W] [Fintype I] + (μ : Measure W) [SFinite μ] (R : ℝ≥0) : + μ.prod (continuousOutputBoxMeasure I R) = + (μ.prod volume).restrict (Set.univ ×ˢ continuousOutputBox I R) := by + simpa only [Measure.restrict_univ, continuousOutputBoxMeasure] using + (Measure.prod_restrict (μ := μ) (ν := (volume : Measure (I → ℝ))) Set.univ (continuousOutputBox I R)) + +theorem continuousOutputBoxMeasure_prod_mass {W I : Type*} [MeasurableSpace W] [Fintype I] + (μ : Measure W) [IsProbabilityMeasure μ] (R : ℝ≥0) : + (μ.prod (continuousOutputBoxMeasure I R)).real Set.univ = (2*(R : ℝ))^Fintype.card I := by + simpa only [Set.univ_prod_univ, probReal_univ, one_mul, continuousOutputBoxMeasure_mass] using + (measureReal_prod_prod (μ := μ) (ν := continuousOutputBoxMeasure I R) Set.univ Set.univ) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ControlledCoordinateLifts.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledCoordinateLifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..2042e1f0cd5c2d0d9ad9d6f22c2574068b5c8cb5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledCoordinateLifts.lean @@ -0,0 +1,89 @@ +import OAI.Combinatorics.Progressions.Estimates.RealGeneratorCombinations +import OAI.Combinatorics.Progressions.Linear.RationalTaggedSpanProjection + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct Matrix NNReal + +theorem exists_controlled_coordinate_lifts + {μ ι κ σ V : Type*} [Fintype μ] [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℚ V] + (b : Basis μ ℚ V) (U : Submodule ℚ V) (v : κ → V) + (hv : Submodule.span ℚ (Set.range v) = U) (φ : V →ₗ[ℚ] (ι → ℚ)) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hvH : ∀ j i, RationalHeightLE (b.repr (v j) i) H) + (hφH : ∀ j i, RationalHeightLE (φ (v j) i) H) + {p : ℝ} (hp : 0 ≤ p) (hμ : (Fintype.card μ : ℝ) ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) (hκ : (Fintype.card κ : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) : + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp (p + ((p + 2) ^ 3 + (p + 2) ^ 36)) ∧ l ∣ m ∧ + ∀ (α : σ →₀ ℕ), α ≠ 0 → ∀ (a q : ι → ℝ), + a + q ∈ realRationalCoordinateSpan (U.map φ) → + ‖a‖ ≤ Real.exp p / monomialScale T α → q ∈ realDenominatorGrid l → + ∃ E Q : ℝ ⊗[ℚ] V, E ∈ U.baseChange ℝ ∧ Q ∈ U.baseChange ℝ ∧ + realRationalCoordinateEquiv (φ.baseChange ℝ E) = a ∧ + realRationalCoordinateEquiv (φ.baseChange ℝ Q) = q ∧ + ‖(b.baseChange ℝ).equivFun E‖ ≤ + Real.exp ((p + 2) ^ 3 + (p + 2) ^ 18 + p) / monomialScale T α ∧ + (b.baseChange ℝ).equivFun Q ∈ realDenominatorGrid m := by + let A : Matrix ι κ ℚ := fun i j => φ (v j) i + let B : Matrix μ κ ℚ := fun i j => b.repr (v j) i + have hvφ : Submodule.span ℚ (Set.range (fun j => φ (v j))) = U.map φ := by + rw [← hv, Submodule.map_span, ← Set.range_comp] + rfl + have hspan := realRationalCoordinateSpan_eq_image (U.map φ) (fun j => φ (v j)) hvφ + have hvU (j : κ) : v j ∈ U := hv ▸ Submodule.subset_span (Set.mem_range_self j) + obtain ⟨S, m, hm, hmp, hsolve⟩ := exists_controlled_linear_splitting A hH hl + (fun i j => hφH j i) hp hι hκ hHp hlp T hT + have hHp' : (H : ℝ) ≤ Real.exp ((p + 2) ^ 1) := hHp.trans (Real.exp_le_exp.mpr (by simp)) + have hden : (matrixDenominator B : ℝ) ≤ Real.exp ((p + 2) ^ 3) := + matrixDenominator_le_exp_power B hp 1 hμ hκ + (fun i j => (Nat.cast_le.mpr (hvH j i).2).trans hHp') + have hfac : ((Fintype.card κ : ℝ) + 1) * (H + 1) ≤ Real.exp ((p + 2) ^ 3) := by + apply le_trans _ (matrix_weighted_factor_le_exp_power (Fintype.card κ) hp hκ 1 (by decide)) + exact mul_le_mul_of_nonneg_left (add_le_add hHp' le_rfl) (by positivity) + have hnorm (x : κ → ℝ) : + ‖(fun i j => (B i j : ℝ)) *ᵥ x‖ ≤ Real.exp ((p + 2) ^ 3) * ‖x‖ := + (norm_matrix_mulVec_le _ (H : ℝ≥0) (fun i j => (hvH j i).abs_real_le) x).trans + (mul_le_mul_of_nonneg_right hfac (norm_nonneg x)) + have hBm : 0 < matrixDenominator B * m := Nat.mul_pos (matrixDenominator_pos B) hm + have hBmp : ((matrixDenominator B * m : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 3 + (p + 2) ^ 36) := by + rw [Nat.cast_mul] + exact (mul_le_mul hden hmp (Nat.cast_nonneg _) (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + refine ⟨l * (matrixDenominator B * m), Nat.mul_pos hl hBm, ?_, dvd_mul_right _ _, ?_⟩ + · rw [Nat.cast_mul] + exact (mul_le_mul hlp hBmp (Nat.cast_nonneg _) (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + · intro α hα a q hsum ha hq + rw [hspan] at hsum + obtain ⟨x, hx⟩ := hsum + obtain ⟨hSa, hSq, hslow, hgrid, _⟩ := hsolve α hα a q x ha hq hx + let ca := (fun i j => (S i j : ℝ)) *ᵥ a + let cq := (fun i j => (S i j : ℝ)) *ᵥ q + refine ⟨realGeneratorCombination v ca, realGeneratorCombination v cq, + realGeneratorCombination_mem U v hvU ca, realGeneratorCombination_mem U v hvU cq, + ?_, ?_, ?_, ?_⟩ + · rw [realGeneratorCombination_map_coordinates] + exact hSa + · rw [realGeneratorCombination_map_coordinates] + exact hSq + · rw [realGeneratorCombination_coordinates] + calc + ‖(fun i j => (b.repr (v j) i : ℝ)) *ᵥ ca‖ ≤ Real.exp ((p + 2) ^ 3) * ‖ca‖ := hnorm ca + _ ≤ Real.exp ((p + 2) ^ 3) * (Real.exp ((p + 2) ^ 18 + p) / monomialScale T α) := + mul_le_mul_of_nonneg_left hslow (Real.exp_pos _).le + _ = _ := by rw [← mul_div_assoc, ← Real.exp_add]; congr 2; ring + · rw [realGeneratorCombination_coordinates] + exact realDenominatorGrid_subset_of_dvd hBm (dvd_mul_left _ _) + (real_matrix_denominator_grid B m cq hgrid) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ControlledGradedBaseCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledGradedBaseCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..f17c6ba1653833e163e52a5687d3135488f15446 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledGradedBaseCoordinates.lean @@ -0,0 +1,241 @@ +import OAI.Combinatorics.Progressions.Estimates.WeightedTranslationBaseGrading + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open Module + +variable {σ : Type*} [fintypeSigma : Fintype σ] + +noncomputable def weightedBaseLinear (w : σ → ℕ) (d : ℕ) : + weightedSubalgebra w d →ₗ[ℚ] (σ → ℚ) := + baseLinear.comp (weightedSubalgebra w d).subtype + +@[simp] theorem weightedBaseLinear_apply (w : σ → ℕ) (d : ℕ) + (x : weightedSubalgebra w d) : weightedBaseLinear w d x = x.val.base := rfl + +theorem base_gradeProjection (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + (j : ℕ) (x : weightedSubalgebra w d) : + weightedBaseLinear w d + (basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j x) = + basisGradeProjection (Pi.basisFun ℚ σ) w j (weightedBaseLinear w d x) := by + funext i + rw [weightedBaseLinear_apply, weightedBasis_projection_base] + have h := basisGradeProjection_repr (Pi.basisFun ℚ σ) w j x.val.base i + simpa only [Pi.basisFun_repr, weightedBaseLinear_apply] using h.symm + +theorem basisGradedSubmodule_base_image (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (U : Submodule ℚ (weightedSubalgebra w d)) + (hU : BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) U) : + BasisGradedSubmodule (Pi.basisFun ℚ σ) w (U.map (weightedBaseLinear w d)) := by + intro j b hb + obtain ⟨x, hx, rfl⟩ := hb + exact ⟨_, hU j x hx, base_gradeProjection w d hw j x⟩ + +theorem basisGradedSubmodule_ambient_base_image (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (U : Submodule ℚ (PolynomialTranslationLie σ)) + (hU : U ≤ (weightedSubalgebra w d).toSubmodule) + (hgraded : BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) + (U.comap (weightedSubalgebra w d).subtype)) : + BasisGradedSubmodule (Pi.basisFun ℚ σ) w (U.map baseLinear) := by + intro j b hb + obtain ⟨x, hx, rfl⟩ := hb + let y : weightedSubalgebra w d := ⟨x, hU hx⟩ + let z := basisGradeProjection (weightedBasis w d hw) (weightedBasisGrade w d) j y + have hz : z.val ∈ U := hgraded j y hx + refine ⟨z.val, hz, ?_⟩ + exact base_gradeProjection w d hw j y + +noncomputable def submoduleBasisCoordinates {τ : Type*} [Fintype τ] + (K : Submodule ℚ (σ → ℚ)) (b : Basis τ ℚ K) : (τ → ℚ) →ₗ[ℚ] (σ → ℚ) := + K.subtype.comp b.equivFun.symm.toLinearMap + +omit fintypeSigma in +theorem submoduleBasisCoordinates_injective [Fintype σ] {τ : Type*} [Fintype τ] + (K : Submodule ℚ (σ → ℚ)) (b : Basis τ ℚ K) : + Function.Injective (submoduleBasisCoordinates K b) := + Subtype.val_injective.comp b.equivFun.symm.injective + +omit fintypeSigma in +@[simp] theorem submoduleBasisCoordinates_range [Fintype σ] {τ : Type*} [Fintype τ] + (K : Submodule ℚ (σ → ℚ)) (b : Basis τ ℚ K) : + (submoduleBasisCoordinates K b).range = K := by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact (b.equivFun.symm z).property + · intro hx + refine ⟨b.equivFun ⟨x, hx⟩, ?_⟩ + change (b.equivFun.symm (b.equivFun ⟨x, hx⟩)).val = x + rw [b.equivFun.symm_apply_apply] + +omit fintypeSigma in +@[simp] theorem submoduleBasisCoordinates_single [Fintype σ] {τ : Type*} + [Fintype τ] [DecidableEq τ] + (K : Submodule ℚ (σ → ℚ)) (b : Basis τ ℚ K) (j : τ) : + submoduleBasisCoordinates K b (Pi.single j 1) = (b j).val := by + change (b.equivFun.symm (Pi.single j 1)).val = _ + rw [b.equivFun_symm_apply] + simp [Pi.single_apply] + +theorem exists_graded_base_coordinates (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (K : Submodule ℚ (σ → ℚ)) + (hK : BasisGradedSubmodule (Pi.basisFun ℚ σ) w K) : + ∃ (n : ℕ) (v : Fin n → ℕ) (A : (Fin n → ℚ) →ₗ[ℚ] (σ → ℚ)), + n ≤ Fintype.card σ ∧ (∀ j, 0 < v j) ∧ (∀ j, v j ≤ d) ∧ + Function.Injective A ∧ A.range = K ∧ + ∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0 := by + obtain ⟨n, v, b, hv, hvd, hb⟩ := + exists_basisGraded_coordinate_basis_bounded w K hK hw hwd + refine ⟨n, v, submoduleBasisCoordinates K b, ?_, hv, hvd, + submoduleBasisCoordinates_injective K b, submoduleBasisCoordinates_range K b, ?_⟩ + · have hn : Module.finrank ℚ K = n := by + simpa only [Fintype.card_fin] using Module.finrank_eq_card_basis b + rw [← hn] + simpa only [Module.finrank_pi] using Submodule.finrank_le K + · intro j i hji + rw [submoduleBasisCoordinates_single] + exact hb j i hji + +theorem exists_weighted_translation_base_coordinates (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (U : Submodule ℚ (weightedSubalgebra w d)) + (hU : BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) U) : + ∃ (n : ℕ) (v : Fin n → ℕ) (A : (Fin n → ℚ) →ₗ[ℚ] (σ → ℚ)), + n ≤ Fintype.card σ ∧ (∀ j, 0 < v j) ∧ (∀ j, v j ≤ d) ∧ + Function.Injective A ∧ A.range = U.map (weightedBaseLinear w d) ∧ + ∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0 := + exists_graded_base_coordinates w d hw hwd _ (basisGradedSubmodule_base_image w d hw U hU) + +theorem exists_ambient_translation_base_coordinates (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (U : Submodule ℚ (PolynomialTranslationLie σ)) + (hU : U ≤ (weightedSubalgebra w d).toSubmodule) + (hgraded : BasisGradedSubmodule (weightedBasis w d hw) (weightedBasisGrade w d) + (U.comap (weightedSubalgebra w d).subtype)) : + ∃ (n : ℕ) (v : Fin n → ℕ) (A : (Fin n → ℚ) →ₗ[ℚ] (σ → ℚ)), + n ≤ Fintype.card σ ∧ (∀ j, 0 < v j) ∧ (∀ j, v j ≤ d) ∧ + Function.Injective A ∧ A.range = U.map baseLinear ∧ + ∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0 := + exists_graded_base_coordinates w d hw hwd _ + (basisGradedSubmodule_ambient_base_image w d hw U hU hgraded) + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3 + +open Module +open scoped BigOperators + +variable {σ J : Type*} [Fintype σ] + +theorem exists_controlled_basisGraded_coordinate_basis (w : σ → ℕ) + (K : Submodule ℚ (σ → ℚ)) + (hK : BasisGradedSubmodule (Pi.basisFun ℚ σ) w K) + (g : J → (σ → ℚ)) (hspan : Submodule.span ℚ (Set.range g) = K) + {H : ℕ} (hH : 1 ≤ H) (hentries : ∀ j i, RationalHeightLE (g j i) H) : + ∃ (n : ℕ) (v : Fin n → ℕ) (b : Basis (Fin n) ℚ K), + (∀ j, v j ∈ Set.range w) ∧ + (∀ j i, v j ≠ w i → (b j).val i = 0) ∧ + (∀ j i, RationalHeightLE ((b j).val i) H) ∧ + ∀ j, ∃ a : J, (b j).val = + basisGradeProjection (Pi.basisFun ℚ σ) w (v j) (g a) := by + classical + have hgm : ∀ a, g a ∈ K := by + intro a + rw [← hspan] + exact Submodule.subset_span ⟨a, rfl⟩ + let S : Set K := {x | ∃ a : J, ∃ j ∈ Set.range w, + x.val = basisGradeProjection (Pi.basisFun ℚ σ) w j (g a)} + have hspanK : Submodule.span ℚ (Set.range (fun a => (⟨g a, hgm a⟩ : K))) = ⊤ := + (Submodule.span_range_subtype_eq_top_iff K hgm).mpr hspan + have hS : ⊤ ≤ Submodule.span ℚ S := by + rw [← hspanK] + apply Submodule.span_le.mpr + rintro _ ⟨a, rfl⟩ + let y (j : ℕ) : K := ⟨basisGradeProjection (Pi.basisFun ℚ σ) w j (g a), + hK j (g a) (hgm a)⟩ + have hsum : ∑ j ∈ Finset.univ.image w, y j = (⟨g a, hgm a⟩ : K) := by + apply Subtype.ext + simpa only [Submodule.coe_sum] using sum_basisGradeProjection_pi w (g a) + change (⟨g a, hgm a⟩ : K) ∈ Submodule.span ℚ S + rw [← hsum] + apply Submodule.sum_mem + intro j hj + apply Submodule.subset_span + refine ⟨a, j, ?_, rfl⟩ + obtain ⟨i, _, hi⟩ := Finset.mem_image.mp hj + exact ⟨i, hi⟩ + let B := Basis.ofSpan hS + let := FiniteDimensional.fintypeBasisIndex B + let b := B.reindex (Fintype.equivFin _) + have hb : ∀ j, b j ∈ S := by + intro j + dsimp only [b] + rw [Basis.reindex_apply] + exact Basis.ofSpan_subset hS ⟨_, rfl⟩ + choose a v hv hproj using hb + refine ⟨_, v, b, hv, ?_, ?_, fun j => ⟨a j, hproj j⟩⟩ + · intro j i hji + rw [hproj j, basisGradeProjection_pi_apply, ite_eq_right (Ne.symm hji)] + · intro j i + rw [hproj j, basisGradeProjection_pi_apply] + split_ifs + · exact hentries (a j) i + · simpa [RationalHeightLE] using hH + +namespace PolynomialTranslationLie + +theorem exists_controlled_graded_base_coordinates (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (K : Submodule ℚ (σ → ℚ)) + (hK : BasisGradedSubmodule (Pi.basisFun ℚ σ) w K) + (g : J → (σ → ℚ)) (hspan : Submodule.span ℚ (Set.range g) = K) + {H : ℕ} (hH : 1 ≤ H) (hentries : ∀ j i, RationalHeightLE (g j i) H) : + ∃ (n : ℕ) (v : Fin n → ℕ) (A : (Fin n → ℚ) →ₗ[ℚ] (σ → ℚ)), + n ≤ Fintype.card σ ∧ (∀ j, 0 < v j) ∧ (∀ j, v j ≤ d) ∧ + Function.Injective A ∧ A.range = K ∧ + (∀ j i, v j ≠ w i → A (Pi.single j 1) i = 0) ∧ + (∀ j i, RationalHeightLE (A (Pi.single j 1) i) H) ∧ + ∀ j, ∃ a : J, A (Pi.single j 1) = + basisGradeProjection (Pi.basisFun ℚ σ) w (v j) (g a) := by + obtain ⟨n, v, b, hv, hcoord, hheight, hselected⟩ := + exists_controlled_basisGraded_coordinate_basis w K hK g hspan hH hentries + refine ⟨n, v, submoduleBasisCoordinates K b, ?_, ?_, ?_, + submoduleBasisCoordinates_injective K b, submoduleBasisCoordinates_range K b, + ?_, ?_, ?_⟩ + · have hn : Module.finrank ℚ K = n := by + simpa only [Fintype.card_fin] using Module.finrank_eq_card_basis b + rw [← hn] + simpa only [Module.finrank_pi] using Submodule.finrank_le K + · intro j + obtain ⟨i, hi⟩ := hv j + simpa only [← hi] using hw i + · intro j + obtain ⟨i, hi⟩ := hv j + simpa only [← hi] using hwd i + · intro j i hji + rw [submoduleBasisCoordinates_single] + exact hcoord j i hji + · intro j i + rw [submoduleBasisCoordinates_single] + exact hheight j i + · intro j + rw [submoduleBasisCoordinates_single] + exact hselected j + +end PolynomialTranslationLie + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ControlledIntegralCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledIntegralCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c1f0c6c29e12bcb5eed30e0f22bce4202dc1f13 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledIntegralCoordinates.lean @@ -0,0 +1,283 @@ +import OAI.Combinatorics.Progressions.Estimates.ImageRepresentatives +import OAI.Combinatorics.Progressions.Linear.RealOrderedBasisProduct +import OAI.Combinatorics.Progressions.Sampling.IntegralGridBudget + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {d s : ℕ} + (e : Basis (Fin d) ℚ L) (hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥) + +noncomputable def integralOrderedBasisProduct (B : ℕ) (z : Fin d → ℤ) : + NilpotentLieBCHGroup L s hnil := + orderedBasisProduct e hnil (fun j => (B : ℚ) * (z j : ℚ)) + +theorem integralOrderedBasisProduct_eq_zpowProduct (B : ℕ) (z : Fin d → ℤ) : + integralOrderedBasisProduct e hnil B z = orderedZpowProduct + (fun j => (⟨(B : ℚ) • e j⟩ : NilpotentLieBCHGroup L s hnil)) z := by + unfold integralOrderedBasisProduct orderedBasisProduct orderedBasisTailProduct + orderedZpowProduct orderedGroupProduct orderedGroupTailProduct + apply congrArg List.prod + apply List.map_congr_left + intro j _ + apply NilpotentLieBCHGroup.ext + rw [NilpotentLieBCHGroup.coord_zpow, ← Int.cast_smul_eq_zsmul ℚ, smul_smul] + change ((B : ℚ) * (z j : ℚ)) • e j = ((z j : ℚ) * (B : ℚ)) • e j + rw [mul_comm (B : ℚ) (z j : ℚ)] + +theorem integral_basis_factor_mem (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) (j : Fin d) (n : ℤ) : + (⟨((B : ℚ) * (n : ℚ)) • e j⟩ : NilpotentLieBCHGroup L s hnil) ∈ Λ := by + apply (bchSubgroupCoordinates_repr e Λ _).mp + rw [hgrid] + have h := (coordinateGridModule e B).smul_mem n (scaled_basis_mem_coordinateGridModule e B j) + rw [← Int.cast_smul_eq_zsmul ℚ, smul_smul, mul_comm (n : ℚ) (B : ℚ)] at h + exact h + +theorem integralOrderedBasisProduct_mem (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) (z : Fin d → ℤ) : + integralOrderedBasisProduct e hnil B z ∈ Λ := by + apply list_prod_mem + intro g hg + obtain ⟨j, _, rfl⟩ := List.mem_map.mp hg + exact integral_basis_factor_mem e hnil Λ B hgrid j (z j) + +namespace IsCentralLieBasis + +variable {e} (he : IsCentralLieBasis e) +include he + +theorem integralOrderedBasisProduct_injective (B : ℕ) (hB : 0 < B) : + Function.Injective (integralOrderedBasisProduct e hnil B) := by + intro z w hzw + have h := he.orderedBasisProduct_injective hnil hzw + funext j + apply Int.cast_injective (α := ℚ) + exact mul_left_cancel₀ (show (B : ℚ) ≠ 0 by exact_mod_cast hB.ne') (congrFun h j) + +theorem exists_integralOrderedBasisProduct + (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) + (g : NilpotentLieBCHGroup L s hnil) (hg : g ∈ Λ) : + ∃ z : Fin d → ℤ, integralOrderedBasisProduct e hnil B z = g := by + classical + have hfactor (k i : ℕ) (hik : i + k = d) + (g : NilpotentLieBCHGroup L s hnil) (hg : g ∈ Λ) (hgt : g.coord ∈ basisTail e i) : + ∃ z : Fin d → ℤ, + orderedBasisTailProduct e hnil i (fun j => (B : ℚ) * (z j : ℚ)) = g := by + induction k generalizing i g with + | zero => + have hi : i = d := by omega + subst i + refine ⟨fun _ => 0, ?_⟩ + rw [orderedBasisTailProduct_terminal e hnil le_rfl] + apply NilpotentLieBCHGroup.ext + have hz : g.coord = 0 := by + simpa only [basisTail_terminal, Submodule.mem_bot] using hgt + exact hz.symm + | succ k ih => + have hi : i < d := by omega + let j : Fin d := ⟨i, hi⟩ + have hcoord := (bchSubgroupCoordinates_repr e Λ g).mpr hg + rw [hgrid] at hcoord + obtain ⟨v, hv⟩ := hcoord + have hvj : e.repr g.coord j = (B : ℚ) * (v j : ℚ) := congrFun hv j + let a : NilpotentLieBCHGroup L s hnil := ⟨((B : ℚ) * (v j : ℚ)) • e j⟩ + have ha : a ∈ Λ := integral_basis_factor_mem e hnil Λ B hgrid j (v j) + let r := a⁻¹ * g + have hr : r ∈ Λ := Λ.mul_mem (Λ.inv_mem ha) hg + have hrt : r.coord ∈ basisTail e (i + 1) := by + simpa only [hvj] using he.peel_mem_tail hnil j g hgt + obtain ⟨z, hz⟩ := ih (i + 1) (by omega) r hr hrt + let u := Function.update z j (v j) + have huj : u j = v j := by simp [u] + have hu : orderedBasisTailProduct e hnil (i + 1) (fun l => (B : ℚ) * (u l : ℚ)) = + orderedBasisTailProduct e hnil (i + 1) (fun l => (B : ℚ) * (z l : ℚ)) := by + apply orderedBasisTailProduct_congr + intro l hl + have hlj : l ≠ j := by + intro h + subst l + change i + 1 ≤ i at hl + omega + simp only [u, Function.update_of_ne hlj] + refine ⟨u, ?_⟩ + change orderedBasisTailProduct e hnil j.val _ = g + rw [orderedBasisTailProduct_step, huj] + change a * orderedBasisTailProduct e hnil (i + 1) _ = g + rw [hu, hz] + exact mul_inv_cancel_left a g + exact hfactor d 0 (by omega) g hg (by simp [basisTail_zero]) + +noncomputable def integralOrderedBasisEquiv + (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) (hB : 0 < B) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) : (Fin d → ℤ) ≃ Λ := + Equiv.ofBijective + (fun z => ⟨integralOrderedBasisProduct e hnil B z, integralOrderedBasisProduct_mem e hnil Λ B hgrid z⟩) + ⟨fun _ _ h => he.integralOrderedBasisProduct_injective hnil B hB (congrArg Subtype.val h), by + intro g + obtain ⟨z, hz⟩ := he.exists_integralOrderedBasisProduct hnil Λ B hgrid g g.property + exact ⟨z, Subtype.ext hz⟩⟩ + +theorem exists_unique_integralOrderedBasisProduct + (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) (hB : 0 < B) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) + (g : NilpotentLieBCHGroup L s hnil) (hg : g ∈ Λ) : + ∃! z : Fin d → ℤ, integralOrderedBasisProduct e hnil B z = g := by + obtain ⟨z, hz⟩ := he.exists_integralOrderedBasisProduct hnil Λ B hgrid g hg + exact ⟨z, hz, fun w hw => he.integralOrderedBasisProduct_injective hnil B hB (hw.trans hz.symm)⟩ + +end IsCentralLieBasis +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {d s : ℕ} + (e : Basis (Fin d) ℚ L) (hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥) + +noncomputable def realIntegralOrderedBasisProduct (B : ℕ) (z : Fin d → ℤ) : + NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s (realification_lowerCentralSeries_eq_bot hnil) := + realOrderedBasisProduct (e.baseChange ℝ) (realification_lowerCentralSeries_eq_bot hnil) + (fun j => (B : ℝ) * (z j : ℝ)) + +theorem realification_integralOrderedBasisProduct (B : ℕ) (z : Fin d → ℤ) : + realificationHom (integralOrderedBasisProduct e hnil B z) = + realIntegralOrderedBasisProduct e hnil B z := by + unfold integralOrderedBasisProduct orderedBasisProduct orderedBasisTailProduct + realIntegralOrderedBasisProduct realOrderedBasisProduct realOrderedBasisTailProduct + rw [map_list_prod, List.map_map] + apply congrArg List.prod + apply List.map_congr_left + intro j _ + apply NilpotentLieBCHGroup.ext + change rationalLieInclusion (((B : ℚ) * (z j : ℚ)) • e j) = + ((B : ℝ) * (z j : ℝ)) • (e.baseChange ℝ) j + rw [map_smul, Basis.baseChange_apply] + simp only [rationalLieInclusion_apply, ← Rat.cast_smul_eq_qsmul ℝ, + Rat.cast_mul, Rat.cast_natCast, Rat.cast_intCast] + +theorem realIntegralOrderedBasisProduct_mem + (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) (z : Fin d → ℤ) : + realIntegralOrderedBasisProduct e hnil B z ∈ Λ.map realificationHom := by + exact Subgroup.mem_map.mpr ⟨integralOrderedBasisProduct e hnil B z, + integralOrderedBasisProduct_mem e hnil Λ B hgrid z, + realification_integralOrderedBasisProduct e hnil B z⟩ + +namespace IsCentralLieBasis + +variable {e} (he : IsCentralLieBasis e) +include he + +theorem realIntegralOrderedBasisProduct_injective (B : ℕ) (hB : 0 < B) : + Function.Injective (realIntegralOrderedBasisProduct e hnil B) := by + intro z w h + apply he.integralOrderedBasisProduct_injective hnil B hB + apply realificationHom_injective e + simpa only [realification_integralOrderedBasisProduct] using h + +theorem exists_realIntegralOrderedBasisProduct + (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) + (g : NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s (realification_lowerCentralSeries_eq_bot hnil)) + (hg : g ∈ Λ.map realificationHom) : + ∃ z : Fin d → ℤ, realIntegralOrderedBasisProduct e hnil B z = g := by + obtain ⟨a, ha, rfl⟩ := Subgroup.mem_map.mp hg + obtain ⟨z, hz⟩ := he.exists_integralOrderedBasisProduct hnil Λ B hgrid a ha + exact ⟨z, (realification_integralOrderedBasisProduct e hnil B z).symm.trans + (congrArg realificationHom hz)⟩ + +theorem exists_unique_realIntegralOrderedBasisProduct + (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) (hB : 0 < B) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) + (g : NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s (realification_lowerCentralSeries_eq_bot hnil)) + (hg : g ∈ Λ.map realificationHom) : + ∃! z : Fin d → ℤ, realIntegralOrderedBasisProduct e hnil B z = g := by + obtain ⟨z, hz⟩ := he.exists_realIntegralOrderedBasisProduct hnil Λ B hgrid g hg + exact ⟨z, hz, fun w hw => + he.realIntegralOrderedBasisProduct_injective hnil B hB (hw.trans hz.symm)⟩ + +noncomputable def realIntegralOrderedBasisEquiv + (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) (B : ℕ) (hB : 0 < B) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) : + (Fin d → ℤ) ≃ Λ.map realificationHom := + Equiv.ofBijective + (fun z => ⟨realIntegralOrderedBasisProduct e hnil B z, + realIntegralOrderedBasisProduct_mem e hnil Λ B hgrid z⟩) + ⟨fun _ _ h => he.realIntegralOrderedBasisProduct_injective hnil B hB + (congrArg Subtype.val h), by + intro g + obtain ⟨z, hz⟩ := he.exists_realIntegralOrderedBasisProduct hnil Λ B hgrid g g.property + exact ⟨z, Subtype.ext hz⟩⟩ + +theorem mul_realIntegralOrderedBasisProduct_coordinate (B : ℕ) (z : Fin d → ℤ) + (a : NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s (realification_lowerCentralSeries_eq_bot hnil)) + (j : Fin d) : + (e.baseChange ℝ).repr (a * realIntegralOrderedBasisProduct e hnil B z).coord j = + (e.baseChange ℝ).repr (a * realOrderedBasisPrefixProduct (e.baseChange ℝ) + (realification_lowerCentralSeries_eq_bot hnil) j.val + (fun k => (B : ℝ) * (z k : ℝ))).coord j + (B : ℝ) * (z j : ℝ) := + he.real_baseChange.mul_realOrderedBasisProduct_coordinate + (realification_lowerCentralSeries_eq_bot hnil) a _ j + +end IsCentralLieBasis +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module + +theorem exists_controlled_integral_coordinates (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L : Type*} [LieRing L] [LieAlgebra ℚ L] {d : ℕ} + (e : Basis (Fin d) ℚ L) (_he : IsCentralLieBasis e) + (hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥) + (Γ : Subgroup (NilpotentLieBCHGroup L s hnil)) (l H : ℕ) (p : ℝ), + 0 < l → (∀ i j k, RationalHeightLE (lieStructureConstants e i j k) H) → + scaledIntegerGrid l ⊆ bchSubgroupCoordinates e Γ → + bchSubgroupCoordinates e Γ ⊆ denominatorGrid l → + 0 ≤ p → (d : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + ∃ (B : ℕ) (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)), + 0 < B ∧ l ∣ B ∧ (B : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + Λ ≤ Γ ∧ (Λ.subgroupOf Γ).FiniteIndex ∧ + bchSubgroupCoordinates e Λ = scaledIntegerGrid B ∧ + ∀ g ∈ Λ, ∃! z : Fin d → ℤ, integralOrderedBasisProduct e hnil B z = g := by + obtain ⟨C, hC, hgrid⟩ := exists_integral_grid_subgroup_exp s + obtain ⟨I, _, hindex⟩ := exists_subgroup_index_exp_bound s + refine ⟨C, hC, ?_⟩ + intro L _ _ d e he hnil Γ l H p hl hc hinner houter hp hd hH hlp + obtain ⟨B, Λ, hB, hdiv, hbound, hΛ, hcoords⟩ := + hgrid e hnil Γ l H p hl hc hinner hp (by simpa only [Fintype.card_fin] using hd) hH hlp + have hpq : p ≤ (p + C) ^ C := by + calc + p ≤ p + C := le_add_of_nonneg_right (Nat.cast_nonneg C) + _ ≤ (p + C) ^ C := by + simpa only [pow_one] using pow_le_pow_right₀ (show (1 : ℝ) ≤ p + C by + have : (2 : ℝ) ≤ C := by exact_mod_cast hC + linarith) (show 1 ≤ C by omega) + have hfinite := (hindex e hnil Γ Λ l B H ((p + C) ^ C) hΛ hl hB houter + (by rw [hcoords]) hc (hp.trans hpq) (by simpa only [Fintype.card_fin] using hd.trans hpq) + (hH.trans (Real.exp_le_exp.mpr hpq)) (hlp.trans (Real.exp_le_exp.mpr hpq)) hbound).1 + exact ⟨B, Λ, hB, hdiv, hbound, hΛ, hfinite, hcoords, + he.exists_unique_integralOrderedBasisProduct hnil Λ B hB hcoords⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ControlledLayerOneCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledLayerOneCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..065dc5046512174bcb33618700a66ff34f5a3783 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledLayerOneCoordinates.lean @@ -0,0 +1,95 @@ +import OAI.Combinatorics.Progressions.Estimates.ReindexedFastCoefficientSection + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct + +variable {σ ι L : Type*} [Fintype ι] + [LieRing L] [LieAlgebra ℚ L] {s a d : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (w : σ → ℕ) (hw : ∀ i, 0 < w i) + (U : Submodule ℚ (F.squareFiltration.quotientTop.PolynomialSymbol w)) + (b : Basis (Fin d) ℝ (F.RealFirstCoefficientModule w ⧸ + F.realFirstCoefficientFastSubmodule w hw U)) + (ha : a ≤ d) (η : (Fin a → ℝ) ≃ₗ[ℝ] (ℝ ⊗[ℚ] (L ⧸ F.layer 2))) + (hη : ∀ x, η (fun i => b.equivFun x (Fin.castLE ha i)) = F.realFastCoefficientHorizontal w hw U x) + +include hη + +omit [Fintype ι] in +theorem layerOne_equiv_symm_coordinates (x : ℝ ⊗[ℚ] (L ⧸ F.layer 2)) : + η.symm x = fun i => b.equivFun ((F.realFirstCoefficientFastSubmodule w hw U).mkQ + (F.realFirstCoefficientHorizontalSection w x)) (Fin.castLE ha i) := by + apply η.injective + rw [LinearEquiv.apply_symm_apply, hη] + exact (F.realFirstCoefficientHorizontal_section w x).symm + +omit [Fintype ι] in +theorem layerOne_equiv_representative + (R : (Fin d → ℝ) →ₗ[ℝ] F.RealFirstCoefficientModule w) + (hR : ∀ y, (F.realFirstCoefficientFastSubmodule w hw U).mkQ (R y) = b.equivFun.symm y) + (x : Fin a → ℝ) : + η x = F.realFirstCoefficientHorizontal w (R (extendInitialCoordinates x)) := by + have h := hη (b.equivFun.symm (extendInitialCoordinates x)) + simp only [LinearEquiv.apply_symm_apply, extendInitialCoordinates_castLE] at h + rw [← hR] at h + exact h + +theorem layerOne_equiv_grid (l m : ℕ) + (R : (Fin d → ℝ) →ₗ[ℝ] F.RealFirstCoefficientModule w) + (hR : ∀ y, (F.realFirstCoefficientFastSubmodule w hw U).mkQ (R y) = b.equivFun.symm y) + (hgrid : ∀ y, y ∈ realDenominatorGrid l → F.FirstCoefficientGrid e ω hF w m (R y)) + (x : Fin a → ℝ) (hx : x ∈ realDenominatorGrid l) : + ((F.layerOneBasis e ω hF).baseChange ℝ).equivFun (η x) ∈ realDenominatorGrid m := by + rw [F.layerOne_equiv_representative w hw U b ha η hη R hR x] + exact F.realFirstCoefficientHorizontal_grid e ω hF w m _ + (hgrid _ (extendInitialCoordinates_grid l x hx)) + +theorem layerOne_equiv_symm_grid (l m : ℕ) + (hgrid : ∀ x, F.FirstCoefficientGrid e ω hF w l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule w hw U).mkQ x) ∈ realDenominatorGrid m) + (x : ℝ ⊗[ℚ] (L ⧸ F.layer 2)) + (hx : ((F.layerOneBasis e ω hF).baseChange ℝ).equivFun x ∈ realDenominatorGrid l) : + η.symm x ∈ realDenominatorGrid m := by + rw [F.layerOne_equiv_symm_coordinates w hw U b ha η hη x] + exact realDenominatorGrid_comp m _ + (hgrid _ (F.realHorizontalSection_grid e ω hF w l x hx)) (Fin.castLE ha) + +theorem layerOne_equiv_norm (C : ℝ) (hC : 0 ≤ C) + (R : (Fin d → ℝ) →ₗ[ℝ] F.RealFirstCoefficientModule w) + (hR : ∀ y, (F.realFirstCoefficientFastSubmodule w hw U).mkQ (R y) = b.equivFun.symm y) + (hbound : ∀ (y : Fin d → ℝ) (M : ℝ), 0 ≤ M → (∀ j, |y j| ≤ M) → + F.FirstCoefficientSlowBound e ω hF w (fun _ => 1) (C * M) (R y)) + (x : Fin a → ℝ) : + ‖((F.layerOneBasis e ω hF).baseChange ℝ).equivFun (η x)‖ ≤ C * ‖x‖ := by + rw [F.layerOne_equiv_representative w hw U b ha η hη R hR x] + apply F.realFirstCoefficientHorizontal_bound e ω hF w (fun _ => 1) + (mul_nonneg hC (norm_nonneg _)) + apply hbound _ ‖x‖ (norm_nonneg x) + intro j + exact (norm_le_pi_norm (extendInitialCoordinates x : Fin d → ℝ) j).trans + (norm_extendInitialCoordinates_le x) + +theorem layerOne_equiv_symm_norm (C : ℝ) (hC : 0 ≤ C) + (hbound : ∀ (x : F.RealFirstCoefficientModule w) (M : ℝ), 0 ≤ M → + F.FirstCoefficientSlowBound e ω hF w (fun _ => 1) M x → ∀ j, + |b.equivFun ((F.realFirstCoefficientFastSubmodule w hw U).mkQ x) j| ≤ C * M) + (x : ℝ ⊗[ℚ] (L ⧸ F.layer 2)) : + ‖η.symm x‖ ≤ C * ‖((F.layerOneBasis e ω hF).baseChange ℝ).equivFun x‖ := by + rw [F.layerOne_equiv_symm_coordinates w hw U b ha η hη x] + apply (pi_norm_le_iff_of_nonneg (mul_nonneg hC (norm_nonneg _))).mpr + intro i + exact hbound _ _ (norm_nonneg _) (F.realHorizontalSection_slow_bound e ω hF w + (fun _ => 1) (by intro i; norm_num) x (norm_nonneg _) le_rfl) (Fin.castLE ha i) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ControlledSumCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledSumCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..069ad848822171cead39f5ead79b722fad8fbe48 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ControlledSumCoordinates.lean @@ -0,0 +1,115 @@ +import Mathlib.Data.Matrix.ColumnRowPartitioned +import OAI.Combinatorics.Progressions.Estimates.CocycleHorizontalNormalization +import OAI.Combinatorics.Progressions.Linear.SortedBasisTriangular + +namespace OAI + +section + +namespace Erdos3 + +open scoped Matrix + +theorem real_column_span_fromCols {ι κ ν : Type*} + (A : Matrix ι κ ℚ) (B : Matrix ι ν ℚ) : + Submodule.span ℝ (Set.range ((Matrix.fromCols A B).map (Rat.castHom ℝ)).col) = + Submodule.span ℝ (Set.range (A.map (Rat.castHom ℝ)).col) ⊔ + Submodule.span ℝ (Set.range (B.map (Rat.castHom ℝ)).col) := by + rw [Matrix.fromCols_map] + have hr : Set.range (Matrix.fromCols (A.map (Rat.castHom ℝ)) (B.map (Rat.castHom ℝ))).col = + Set.range (A.map (Rat.castHom ℝ)).col ∪ Set.range (B.map (Rat.castHom ℝ)).col := by + ext x + constructor + · rintro ⟨j, rfl⟩ + cases j with + | inl j => exact Or.inl ⟨j, rfl⟩ + | inr j => exact Or.inr ⟨j, rfl⟩ + · rintro (⟨j, rfl⟩ | ⟨j, rfl⟩) + · exact ⟨Sum.inl j, rfl⟩ + · exact ⟨Sum.inr j, rfl⟩ + rw [hr, Submodule.span_union] + +theorem exists_rational_sum_coordinates {ι κ ν : Type*} + [Fintype ι] [Fintype κ] [Fintype ν] + (A : Matrix ι κ ℚ) (B : Matrix ι ν ℚ) {H : ℕ} (hH : 1 ≤ H) + (hA : ∀ i j, RationalHeightLE (A i j) H) (hB : ∀ i j, RationalHeightLE (B i j) H) : + ∃ S : Matrix (κ ⊕ ν) ι ℚ, + (∀ i j, RationalHeightLE (S i j) (rationalKernelHeight (Fintype.card ι) H)) ∧ + ∀ x, x ∈ Submodule.span ℝ (Set.range (A.map (Rat.castHom ℝ)).col) ⊔ + Submodule.span ℝ (Set.range (B.map (Rat.castHom ℝ)).col) → + A.map (Rat.castHom ℝ) *ᵥ ((S.map (Rat.castHom ℝ) *ᵥ x) ∘ Sum.inl) + + B.map (Rat.castHom ℝ) *ᵥ ((S.map (Rat.castHom ℝ) *ᵥ x) ∘ Sum.inr) = x := by + let C := Matrix.fromCols A B + have hC : ∀ i j, RationalHeightLE (C i j) H := by + intro i j + cases j with + | inl j => exact hA i j + | inr j => exact hB i j + obtain ⟨S, hS, hSH⟩ := exists_bounded_rational_image_section C hH hC + refine ⟨S, hSH, fun x hx => ?_⟩ + have hx' : x ∈ LinearMap.range (C.map (Rat.castHom ℝ)).mulVecLin := by + apply (real_column_span_mem_iff C x).mp + change x ∈ Submodule.span ℝ (Set.range ((Matrix.fromCols A B).map (Rat.castHom ℝ)).col) + rw [real_column_span_fromCols] + exact hx + have he := real_matrix_image_section_apply C S hS x hx' + change C.map (Rat.castHom ℝ) *ᵥ (S.map (Rat.castHom ℝ) *ᵥ x) = x at he + dsimp only [C] at he + rw [Matrix.fromCols_map, Matrix.fromCols_mulVec] at he + exact he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped Matrix + +theorem pi_norm_restriction_le {ι κ : Type*} [Fintype ι] [Fintype κ] + (x : ι → ℝ) (f : κ → ι) : ‖x ∘ f‖ ≤ ‖x‖ := by + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro i + exact norm_le_pi_norm x (f i) + +theorem exists_controlled_sum_coordinates {ι κ ν : Type*} + [Fintype ι] [Fintype κ] [Fintype ν] + (A : Matrix ι κ ℚ) (B : Matrix ι ν ℚ) {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hA : ∀ i j, RationalHeightLE (A i j) H) (hB : ∀ i j, RationalHeightLE (B i j) H) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hcols : (Fintype.card (κ ⊕ ν) : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) : + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + 2) ^ 36) ∧ + ∃ u : (ι → ℝ) →ₗ[ℝ] (κ → ℝ), ∃ v : (ι → ℝ) →ₗ[ℝ] (ν → ℝ), + (∀ x, x ∈ Submodule.span ℝ (Set.range (A.map (Rat.castHom ℝ)).col) ⊔ + Submodule.span ℝ (Set.range (B.map (Rat.castHom ℝ)).col) → + A.map (Rat.castHom ℝ) *ᵥ u x + B.map (Rat.castHom ℝ) *ᵥ v x = x) ∧ + (∀ x, ‖u x‖ ≤ Real.exp ((p + 2) ^ 18) * ‖x‖ ∧ + ‖v x‖ ≤ Real.exp ((p + 2) ^ 18) * ‖x‖) ∧ + ∀ x, x ∈ realDenominatorGrid l → + u x ∈ realDenominatorGrid m ∧ v x ∈ realDenominatorGrid m := by + classical + obtain ⟨S, hS, hdecomp⟩ := exists_rational_sum_coordinates A B hH hA hB + let m := matrixDenominator S * l + let u : (ι → ℝ) →ₗ[ℝ] (κ → ℝ) := + (LinearMap.funLeft ℝ ℝ Sum.inl).comp (S.map (Rat.castHom ℝ)).mulVecLin + let v : (ι → ℝ) →ₗ[ℝ] (ν → ℝ) := + (LinearMap.funLeft ℝ ℝ Sum.inr).comp (S.map (Rat.castHom ℝ)).mulVecLin + have hnorm (x : ι → ℝ) := real_image_section_norm_bound S H hS hp hι hcols hHp x + have hgrid (x : ι → ℝ) (hx : x ∈ realDenominatorGrid l) := real_matrix_denominator_grid S l x hx + refine ⟨m, Nat.mul_pos (matrixDenominator_pos S) hl, + real_image_section_denominator_bound S H l hS hp hι hcols hHp hlp, u, v, hdecomp, ?_, ?_⟩ + · intro x + exact ⟨(pi_norm_restriction_le (S.map (Rat.castHom ℝ) *ᵥ x) Sum.inl).trans (hnorm x), + (pi_norm_restriction_le (S.map (Rat.castHom ℝ) *ᵥ x) Sum.inr).trans (hnorm x)⟩ + · intro x hx + exact ⟨realDenominatorGrid_comp m _ (hgrid x hx) Sum.inl, + realDenominatorGrid_comp m _ (hgrid x hx) Sum.inr⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateConstantDecomposition.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateConstantDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..72d1b9a6862b5752cfb78a484719a5b837e5d9fb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateConstantDecomposition.lean @@ -0,0 +1,212 @@ +import Mathlib.MeasureTheory.Constructions.Pi +import OAI.Combinatorics.Progressions.Fourier.EuclideanJetTorus + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +noncomputable def coordinateSiteValue {K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) + (x : CoefficientCoordinateTori (K := K) U) : SiteTorus Unit U := + fun j => ∑ d : BoundedCoefficientExponent K (j.val + 1), + boundedSiteMatrix (j.val + 1) (fun _ : Unit => t) () d • x ⟨j, d⟩ + +theorem coordinateSiteValue_continuous {K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) : + Continuous (coordinateSiteValue U t) := by + apply continuous_pi + intro j + apply continuous_finsetSum + intro d _ + exact (show Continuous (fun x : CoefficientCoordinateTori (K := K) U => x ⟨j, d⟩) from + continuous_apply _).zsmul _ + +theorem coordinateSiteValue_add {K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) + (x y : CoefficientCoordinateTori (K := K) U) : + coordinateSiteValue U t (x + y) = coordinateSiteValue U t x + coordinateSiteValue U t y := by + funext j + let X : BoundedCoefficientExponent K (j.val + 1) → SubspaceArrayTorus Unit (U j) := fun d => x ⟨j, d⟩ + let Y : BoundedCoefficientExponent K (j.val + 1) → SubspaceArrayTorus Unit (U j) := fun d => y ⟨j, d⟩ + let w : BoundedCoefficientExponent K (j.val + 1) → ℤ := + fun d => boundedSiteMatrix (j.val + 1) (fun _ : Unit => t) () d + change (∑ d, w d • (X d + Y d)) = (∑ d, w d • X d) + ∑ d, w d • Y d + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro d _ + exact zsmul_add (X d) (Y d) _ + +theorem coordinateSiteValue_coefficientCoordinates {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) + (x : CoefficientTorus (K := K) U) : + coordinateSiteValue U t (coefficientCoordinateTorus U x) = + coefficientSiteTorusMap U (fun _ : Unit => t) x := by + classical + obtain ⟨y, rfl⟩ := QuotientAddGroup.mk'_surjective (coefficientIntegerLattice U) x + funext j + let π : (Unit → U j) →+ SubspaceArrayTorus Unit (U j) := + QuotientAddGroup.mk' (subspaceArrayIntegerLattice Unit (U j)) + let w : BoundedCoefficientExponent K (j.val + 1) → ℤ := + fun d => boundedSiteMatrix (j.val + 1) (fun _ : Unit => t) () d + let v : BoundedCoefficientExponent K (j.val + 1) → U j := fun d => y ⟨j, d⟩ + have hsum (s : Finset (BoundedCoefficientExponent K (j.val + 1))) : + (∑ d ∈ s, π (w d • (fun _ : Unit => v d))) = π (∑ d ∈ s, w d • (fun _ : Unit => v d)) := by + induction s using Finset.induction_on with + | empty => rfl + | @insert a s ha ih => + simp only [Finset.sum_insert ha] + exact (congrArg (fun z => π (w a • (fun _ : Unit => v a)) + z) ih).trans + (π.map_add' _ _).symm + change (∑ d, w d • π (fun _ => v d)) = π (fun _ => ∑ d, (w d : ℝ) • v d) + calc + _ = ∑ d, π (w d • (fun _ : Unit => v d)) := by + apply Finset.sum_congr rfl + intro d _ + exact (map_zsmul π _ _).symm + _ = π (∑ d, w d • (fun _ : Unit => v d)) := hsum Finset.univ + _ = _ := by + apply congrArg π + funext u + simp only [Finset.sum_apply, Pi.smul_apply] + apply Finset.sum_congr rfl + intro d _ + exact (Int.cast_smul_eq_zsmul ℝ (w d) (v d)).symm + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory + +abbrev ConstantCoefficientSlot (K : Type*) (m : ℕ) := + {s : CoefficientSlot K m // s.2.val = 0} + +abbrev NonconstantCoefficientSlot (K : Type*) (m : ℕ) := + {s : CoefficientSlot K m // s.2.val ≠ 0} + +noncomputable instance constantCoefficientSlotFintype (K : Type*) [Fintype K] (m : ℕ) : + Fintype (ConstantCoefficientSlot K m) := Fintype.ofFinite _ + +noncomputable instance nonconstantCoefficientSlotFintype (K : Type*) [Fintype K] (m : ℕ) : + Fintype (NonconstantCoefficientSlot K m) := Fintype.ofFinite _ + +def constantCoefficientSlotEquiv (K : Type*) (m : ℕ) : Fin m ≃ ConstantCoefficientSlot K m where + toFun j := ⟨⟨j, zeroCoefficientExponent K (j.val + 1)⟩, rfl⟩ + invFun s := s.val.1 + left_inv _ := rfl + right_inv := by + rintro ⟨⟨j, ⟨d, hd⟩⟩, he⟩ + cases he + rfl + +abbrev NonconstantCoordinateTori {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) := + ∀ s : NonconstantCoefficientSlot K m, SubspaceArrayTorus Unit (U s.val.1) + +def coefficientConstantCoordinates {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (x : CoefficientCoordinateTori (K := K) U) : SiteTorus Unit U := + fun j => x (constantCoefficientSlotEquiv K m j).val + +def coefficientCoordinateSplit {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (x : CoefficientCoordinateTori (K := K) U) : + NonconstantCoordinateTori (K := K) U × SiteTorus Unit U := + (fun s => x s.val, coefficientConstantCoordinates U x) + +theorem coefficientCoordinateSplit_measurePreserving {K : Type*} [Fintype K] {m : ℕ} + {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) + [∀ j, MeasurableSpace (SubspaceArrayTorus Unit (U j))] + (ν : ∀ s : CoefficientSlot K m, Measure (SubspaceArrayTorus Unit (U s.1))) + [∀ s, SigmaFinite (ν s)] : + MeasurePreserving (coefficientCoordinateSplit U) (Measure.pi ν) + ((Measure.pi (fun s : NonconstantCoefficientSlot K m => ν s.val)).prod + (Measure.pi (fun j => ν (constantCoefficientSlotEquiv K m j).val))) := by + classical + have hs := measurePreserving_piEquivPiSubtypeProd ν (fun s => s.2.val = 0) + have eC : Subtype.fintype (fun s : CoefficientSlot K m => s.2.val = 0) = + constantCoefficientSlotFintype K m := Subsingleton.elim _ _ + have eN : Subtype.fintype (fun s : CoefficientSlot K m => ¬s.2.val = 0) = + nonconstantCoefficientSlotFintype K m := Subsingleton.elim _ _ + rw [eC, eN] at hs + have hc := (measurePreserving_piCongrLeft + (fun s : ConstantCoefficientSlot K m => ν s.val) (constantCoefficientSlotEquiv K m)).symm + have hp := ((MeasurePreserving.id _).prod hc).comp (Measure.measurePreserving_swap.comp hs) + exact hp + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +noncomputable def constantCoordinateExtension {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (c : SiteTorus Unit U) : CoefficientCoordinateTori (K := K) U := + fun s => if s.2.val = 0 then c s.1 else 0 + +noncomputable def nonconstantCoordinateExtension {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (r : NonconstantCoordinateTori (K := K) U) : + CoefficientCoordinateTori (K := K) U := fun s => if h : s.2.val = 0 then 0 else r ⟨s, h⟩ + +theorem nonconstantCoordinateExtension_continuous {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) : Continuous (nonconstantCoordinateExtension (K := K) U) := by + apply continuous_pi + intro s + by_cases hs : s.2.val = 0 + · simpa only [nonconstantCoordinateExtension, dite_eq_left hs] using + (continuous_const : Continuous (fun _ : NonconstantCoordinateTori (K := K) U => (0 : SubspaceArrayTorus Unit (U s.1)))) + · simpa only [nonconstantCoordinateExtension, dite_eq_right hs] using + (continuous_apply (⟨s, hs⟩ : NonconstantCoefficientSlot K m)) + +theorem coordinate_constant_decomposition {K : Type*} {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (x : CoefficientCoordinateTori (K := K) U) : + x = constantCoordinateExtension U (coefficientCoordinateSplit U x).2 + + nonconstantCoordinateExtension U (coefficientCoordinateSplit U x).1 := by + funext s + rcases s with ⟨j, ⟨d, hd⟩⟩ + by_cases hz : d = 0 + · subst d + simp [constantCoordinateExtension, nonconstantCoordinateExtension, coefficientCoordinateSplit, + coefficientConstantCoordinates, constantCoefficientSlotEquiv, zeroCoefficientExponent] + rfl + · simp [constantCoordinateExtension, nonconstantCoordinateExtension, coefficientCoordinateSplit, hz] + +theorem coordinateSiteValue_constant {K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) (c : SiteTorus Unit U) : + coordinateSiteValue U t (constantCoordinateExtension U c) = c := by + funext j + change (∑ d : BoundedCoefficientExponent K (j.val + 1), + boundedSiteMatrix (j.val + 1) (fun _ : Unit => t) () d • + (if d.val = 0 then c j else 0)) = c j + rw [Finset.sum_eq_single (zeroCoefficientExponent K (j.val + 1))] + · simp [boundedSiteMatrix, zeroCoefficientExponent] + · intro d _ hd + have hz : d.val ≠ 0 := fun he => hd (Subtype.ext he) + simp [hz] + · simp + +theorem coordinateSiteValue_split {K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} + (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) (x : CoefficientCoordinateTori (K := K) U) : + coordinateSiteValue U t x = (coefficientCoordinateSplit U x).2 + + coordinateSiteValue U t (nonconstantCoordinateExtension U (coefficientCoordinateSplit U x).1) := by + calc + _ = coordinateSiteValue U t (constantCoordinateExtension U (coefficientCoordinateSplit U x).2 + + nonconstantCoordinateExtension U (coefficientCoordinateSplit U x).1) := + congrArg (coordinateSiteValue U t) (coordinate_constant_decomposition U x) + _ = _ := by rw [coordinateSiteValue_add, coordinateSiteValue_constant] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateCopySum.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateCopySum.lean new file mode 100644 index 0000000000000000000000000000000000000000..e61eec815a8ac8d6c87a4d63a8871d9620c94be5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateCopySum.lean @@ -0,0 +1,79 @@ +import OAI.Combinatorics.Progressions.Estimates.CopiedLayerSpace + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def coordinateCopySum {C J R : Type*} [Fintype C] + [DecidableEq J] [CommRing R] (label : C → J) : (C → R) →ₗ[R] (J → R) where + toFun x j := ∑ c, if label c = j then x c else 0 + map_add' x y := by + ext j + simp only [Pi.add_apply, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp + map_smul' r x := by + ext j + simp only [Pi.smul_apply, smul_eq_mul, RingHom.id_apply, Finset.mul_sum] + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp + +@[simp] theorem coordinateCopySum_apply {C J R : Type*} [Fintype C] + [DecidableEq J] [CommRing R] (label : C → J) (x : C → R) (j : J) : + coordinateCopySum label x j = ∑ c, if label c = j then x c else 0 := rfl + +theorem coordinateCopySum_sum {C D J R : Type*} [Fintype C] [Fintype D] + [DecidableEq J] [CommRing R] (a : C → J) (b : D → J) (x : C → R) (y : D → R) : + coordinateCopySum (Sum.elim a b) (Sum.elim x y) = + coordinateCopySum a x + coordinateCopySum b y := by + ext j + simp only [coordinateCopySum_apply, Fintype.sum_sum_type, Sum.elim_inl, Sum.elim_inr, + Pi.add_apply] + rfl + +theorem coordinateCopySum_abs_le {C J : Type*} [Fintype C] [DecidableEq J] + (label : C → J) {x : C → ℝ} {δ : ℝ} (hδ : 0 ≤ δ) (hx : ∀ c, |x c| ≤ δ) (j : J) : + |coordinateCopySum label x j| ≤ Fintype.card C * δ := by + apply (Finset.abs_sum_le_sum_abs _ _).trans + calc + (∑ c, |if label c = j then x c else 0|) ≤ ∑ _c : C, δ := by + apply Finset.sum_le_sum + intro c _ + split_ifs <;> simp_all + _ = _ := by simp + +theorem coordinateCopySum_intCast {C J : Type*} [Fintype C] [DecidableEq J] + (label : C → J) (x : C → ℤ) (j : J) : + coordinateCopySum label (fun c => (x c : ℝ)) j = + ((coordinateCopySum (R := ℤ) label x j : ℤ) : ℝ) := by + simp only [coordinateCopySum_apply, Int.cast_sum, Int.cast_ite, Int.cast_zero] + +theorem coordinateCopySum_map {C J R S : Type*} [Fintype C] [DecidableEq J] + [CommRing R] [CommRing S] (label : C → J) (f : R →+* S) (x : C → R) (j : J) : + f (coordinateCopySum label x j) = coordinateCopySum label (fun c => f (x c)) j := by + simp only [coordinateCopySum_apply, map_sum] + apply Finset.sum_congr rfl + intro c _ + split_ifs <;> simp + +theorem coordinateCopySum_polynomial_degree {C J I R : Type*} [Fintype C] [DecidableEq J] + [CommRing R] (label : C → J) (p : C → MvPolynomial I R) {d : ℕ} + (hp : ∀ c, (p c).totalDegree ≤ d) (j : J) : + (coordinateCopySum label p j).totalDegree ≤ d := by + apply MvPolynomial.totalDegree_finsetSum_le + intro c _ + split_ifs + · exact hp c + · simp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateDerivativeBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateDerivativeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..defb6195e52063aca3039046ffe48dfcf63c3234 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateDerivativeBounds.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Estimates.RealFirstCoefficientHorizontal + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +variable {σ L : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + +theorem directionalDerivative_single_coordinate (f : L →ₗ[ℚ] ℝ) + (p : VectorPolynomial σ ℚ L) (i : σ) (α : σ →₀ ℕ) : + f (coefficients (directionalDerivative (Pi.single i 1) p) α) = + (α i + 1 : ℝ) * f (coefficients p (α + Finsupp.single i 1)) := by + rw [directionalDerivative_coordinate] + rw [Finset.sum_eq_single i] + · simp + · intro j _ hji + simp [hji] + · simp + +theorem directionalDerivative_single_scaled_bound + (f : L →ₗ[ℚ] ℝ) (p : VectorPolynomial σ ℚ L) + (d : ℕ) (hdegree : ∀ (β : σ →₀ ℕ) (i : σ), d < β i → f (coefficients p β) = 0) + (T : σ → ℝ) (hT : ∀ i, 0 < T i) (M : ℝ) (hM : 0 ≤ M) + (hp : ∀ β, |f (coefficients p β)| ≤ M / monomialScale T β) (i : σ) (α : σ →₀ ℕ) : + |f (coefficients (directionalDerivative (Pi.single i 1) p) α)| ≤ + ((d : ℝ) * M / T i) / monomialScale T α := by + rw [directionalDerivative_single_coordinate] + by_cases hd : d < α i + 1 + · rw [hdegree _ i (by simpa using hd), mul_zero, abs_zero] + exact div_nonneg (div_nonneg (mul_nonneg (Nat.cast_nonneg d) hM) (hT i).le) + (monomialScale_pos T hT α).le + · have hdi : (α i + 1 : ℝ) ≤ d := by exact_mod_cast Nat.le_of_not_gt hd + have hscale : monomialScale T (α + Finsupp.single i 1) = monomialScale T α * T i := by + rw [monomialScale_add] + simp [monomialScale] + have hcoef := hp (α + Finsupp.single i 1) + rw [hscale] at hcoef + rw [abs_mul, abs_of_nonneg (by positivity : (0 : ℝ) ≤ α i + 1)] + calc + _ ≤ (d : ℝ) * (M / (monomialScale T α * T i)) := + mul_le_mul hdi hcoef (abs_nonneg _) (Nat.cast_nonneg d) + _ = _ := by ring + +end Erdos3.VectorPolynomial + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +theorem realAdaptedDirectionalDerivative_single_bound + {σ ι L : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (T : σ → ℝ) (hT : ∀ i, 0 < T i) {M : ℝ} (hM : 0 ≤ M) + (x : ℝ ⊗[ℚ] F.adaptedLieSubalgebra (fun _ : σ => 1)) + (hx : F.RealAdaptedCoefficientBound b ω hF (fun _ => 1) T M x) (i : σ) : + F.RealAdaptedCoefficientBound b ω hF (fun _ => 1) T ((s : ℝ) * M / T i) + (F.realAdaptedDirectionalDerivative (Pi.single i 1) x) := by + have hp := (F.realAdaptedCoefficientBound_polynomial_iff b ω hF (fun _ => 1) T hT hM + (⟨x⟩ : F.RealAdaptedPolynomialGroup (fun _ => 1))).mp hx + intro z + rw [← F.realAdaptedPolynomialTensor_coordinates (fun _ => 1) b ω hF, + F.realAdaptedDirectionalDerivative_polynomial] + let f := ((b.baseChange ℝ).coord z.val.2).restrictScalars ℚ + have hdegree : ∀ (β : σ →₀ ℕ) (j : σ), s < β j → + f (coefficients (F.realAdaptedPolynomialMap (fun _ => 1) x) β) = 0 := by + intro β j hj + have hβ := Finsupp.le_weight (fun _ : σ => 1) (s := j) (by decide) β + have hi := F.adaptedBasis_weight_le_step b ω hF z.val.2 + have hni : ¬Finsupp.weight (fun _ : σ => 1) β ≤ ω z.val.2 := by omega + exact (F.real_mem_layer_iff_basis_coordinates b ω hF _ _).mp + ((F.realification.adapted_iff_coefficients (fun _ => 1) _).mp + (F.realAdaptedPolynomialMap_adapted (fun _ => 1) x) β) z.val.2 hni + exact directionalDerivative_single_scaled_bound f + (F.realAdaptedPolynomialMap (fun _ => 1) x) s hdegree T hT M hM + (fun β => hp β z.val.2) i z.val.1 + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateDeterminant.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateDeterminant.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8104958aa31e7ffe6c2baa772352bbf4328e16c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateDeterminant.lean @@ -0,0 +1,74 @@ +import Mathlib.Analysis.Calculus.MeanValue +import OAI.Combinatorics.Progressions.Polynomial.PolynomialDeterminantDegree +import OAI.Combinatorics.Progressions.Polynomial.PolynomialDeterminantDerivativeBound + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def coordinateMatrixPolynomial {I X : Type*} (index : I → I → X) : + Matrix I I (MvPolynomial X ℝ) := fun i j => MvPolynomial.X (index i j) + +theorem coordinateMatrixPolynomial_eval {I X : Type*} [Fintype I] [DecidableEq I] + (index : I → I → X) (x : X → ℝ) : + MvPolynomial.eval x (coordinateMatrixPolynomial index).det = + Matrix.det (fun i j => x (index i j)) := by + rw [(MvPolynomial.eval x).map_det] + congr 1 + ext i j + change MvPolynomial.eval x (MvPolynomial.X (index i j) : MvPolynomial X ℝ) = x (index i j) + simp only [MvPolynomial.eval_X] + +theorem coordinateMatrixPolynomial_degree {I X : Type*} [Fintype I] [DecidableEq I] + [DecidableEq X] (index : I → I → X) (j : X) : + (coordinateMatrixPolynomial index).det.degreeOf j ≤ Fintype.card I := by + apply (polynomial_det_degreeOf_le _ j 1 ?_).trans_eq (Nat.mul_one _) + intro a b + simp only [coordinateMatrixPolynomial, MvPolynomial.degreeOf_X] + split_ifs <;> omega + +noncomputable def coordinateDeterminantVariation (I X : Type*) [Fintype I] [Fintype X] : ℝ := + Fintype.card X * ((Fintype.card I).factorial * Fintype.card I) + +theorem coordinateDeterminantVariation_nonneg (I X : Type*) [Fintype I] [Fintype X] : + 0 ≤ coordinateDeterminantVariation I X := by + unfold coordinateDeterminantVariation + positivity + +theorem coordinateMatrixPolynomial_derivative {I X : Type*} + [Fintype I] [DecidableEq I] [Fintype X] [DecidableEq X] + (index : I → I → X) (x : X → ℝ) (hx : ∀ j, |x j| ≤ 1) : + ‖fderiv ℝ (fun x => MvPolynomial.eval x (coordinateMatrixPolynomial index).det) x‖ ≤ + coordinateDeterminantVariation I X := by + have h := polynomial_det_fderiv_norm_le (coordinateMatrixPolynomial index) x + (by norm_num : (1 : ℝ) ≤ 1) (by norm_num : (0 : ℝ) ≤ 1) + (fun a b => by simpa only [coordinateMatrixPolynomial, MvPolynomial.eval_X] using hx (index a b)) + (fun a b j => by + simp only [coordinateMatrixPolynomial, MvPolynomial.pderiv_X, Pi.single_apply] + split_ifs <;> norm_num) + rw [polynomial_det_eval_function] at h + simpa only [one_pow, mul_one, coordinateDeterminantVariation] using h + +theorem coordinateMatrixPolynomial_variation {I X : Type*} + [Fintype I] [DecidableEq I] [Fintype X] [DecidableEq X] + (index : I → I → X) (x y : X → ℝ) (hx : ∀ j, |x j| ≤ 1) (hy : ∀ j, |y j| ≤ 1) : + |MvPolynomial.eval x (coordinateMatrixPolynomial index).det - + MvPolynomial.eval y (coordinateMatrixPolynomial index).det| ≤ + coordinateDeterminantVariation I X * ‖x - y‖ := by + let S : Set (X → ℝ) := Set.Icc (fun _ => -1) (fun _ => 1) + have hmem (z : X → ℝ) : z ∈ S ↔ ∀ j, |z j| ≤ 1 := by + simp only [S, Set.mem_Icc, Pi.le_def, abs_le, forall_and] + have h := Convex.norm_image_sub_le_of_norm_fderiv_le + (fun z (_ : z ∈ S) => (mvPolynomial_contDiff_eval (coordinateMatrixPolynomial index).det).differentiable + (by norm_num) z) + (fun z hz => coordinateMatrixPolynomial_derivative index z ((hmem z).mp hz)) + (convex_Icc _ _) ((hmem y).mpr hy) ((hmem x).mpr hx) + simpa only [Real.norm_eq_abs] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateExceptionUnion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateExceptionUnion.lean new file mode 100644 index 0000000000000000000000000000000000000000..c56ea19ed8de338b27d95102e08761e8cc08c391 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateExceptionUnion.lean @@ -0,0 +1,36 @@ +import OAI.Combinatorics.Progressions.Probability.ConditionalCoordinateExceptions + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_coordinate_exception_union {I G : Type*} [Fintype I] [DecidableEq I] + [AddGroup G] [Fintype G] [DecidableEq G] + (E : I → (I → G) → Finset G) {delta : ℝ} + (hE : ∀ i t, ((E i t).card : ℝ) ≤ delta * Fintype.card G) + (hindependent : ∀ i t a, E i (Function.update t i a) = E i t) : + ∃ S : Finset (I → G), + (S.card : ℝ) ≤ (Fintype.card I : ℝ) * delta * Fintype.card (I → G) ∧ + ∀ t, t ∉ S → ∀ i, -(t i) ∉ E i t := by + classical + let S : Finset (I → G) := Finset.univ.filter (fun t => ∃ i, -(t i) ∈ E i t) + have hmean := finite_union_indicator_mean_le (fun i t => -(t i) ∈ E i t) + (fun i => conditional_neg_coordinate_bad_mean i (E i) (hE i) (hindependent i)) + have hid : (𝔼 t : I → G, if ∃ i, -(t i) ∈ E i t then (1 : ℝ) else 0) = + (S.card : ℝ) / Fintype.card (I → G) := by + simp [Fintype.expect_eq_sum_div_card, S] + rw [hid] at hmean + refine ⟨S, ?_, ?_⟩ + · exact (div_le_iff₀ (by exact_mod_cast Fintype.card_pos : (0 : ℝ) < Fintype.card (I → G))).mp hmean + · intro t ht i hi + exact ht (Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨i, hi⟩⟩) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateFiberPatch.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateFiberPatch.lean new file mode 100644 index 0000000000000000000000000000000000000000..e97cfd19a602f2ded9564c89fc77449857d95c3d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateFiberPatch.lean @@ -0,0 +1,188 @@ +import Mathlib.Logic.Equiv.Prod +import OAI.Combinatorics.Progressions.Estimates.RelativeFiberSlicePatch +import OAI.Combinatorics.Progressions.Estimates.SmoothWindowChange + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def integerIntervalCenter {I : Type*} (lo hi : I → ℤ) : I → ℝ := + fun i => ((lo i : ℝ) + hi i) / 2 + +noncomputable def integerIntervalWidth {I : Type*} (lo hi : I → ℤ) : I → ℝ := + fun i => ((hi i - lo i : ℤ) : ℝ) + +theorem integerIntervalWidth_pos {I : Type*} (lo hi : I → ℤ) + (hlen : ∀ i, lo i < hi i) (i : I) : 0 < integerIntervalWidth lo hi i := by + unfold integerIntervalWidth + exact_mod_cast sub_pos.mpr (hlen i) + +theorem integer_interval_box_inner {I : Type*} [Fintype I] [DecidableEq I] + (lo hi : I → ℤ) (z : I → ℤ) + (hz : z ∈ Fintype.piFinset (fun i => Finset.Ico (lo i) (hi i))) (i : I) : + |(z i : ℝ) - integerIntervalCenter lo hi i| ≤ integerIntervalWidth lo hi i / 2 := by + have h := Finset.mem_Ico.mp (Fintype.mem_piFinset.mp hz i) + have hlo : (lo i : ℝ) ≤ z i := by exact_mod_cast h.1 + have hhi : (z i : ℝ) < hi i := by exact_mod_cast h.2 + simp only [integerIntervalCenter, integerIntervalWidth, Int.cast_sub] + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +theorem integer_interval_box_card {I : Type*} [Fintype I] [DecidableEq I] + (lo hi : I → ℤ) (hlen : ∀ i, lo i < hi i) : + ((Fintype.piFinset (fun i => Finset.Ico (lo i) (hi i))).card : ℝ) = + ∏ i, integerIntervalWidth lo hi i := by + rw [Fintype.card_piFinset, Nat.cast_prod] + apply Finset.prod_congr rfl + intro i _ + rw [Int.card_Ico] + simp only [integerIntervalWidth] + exact_mod_cast Int.toNat_of_nonneg (sub_nonneg.mpr (hlen i).le) + +theorem smooth_interval_box_change {I : Type*} [Fintype I] [DecidableEq I] + (lo hi : I → ℤ) (hlen : ∀ i, lo i < hi i) + (hscale : ∀ i, 8 * (probabilityProfileLipschitz : ℝ) ≤ integerIntervalWidth lo hi i) + (hZ : 0 < shiftedSmoothProductMass (integerIntervalCenter lo hi) (integerIntervalWidth lo hi)) : + ∃ w : rectangularWeightIndices (integerIntervalCenter lo hi) (integerIntervalWidth lo hi) 1 → ℝ, + (∀ z, 0 ≤ w z ∧ w z ≤ 1) ∧ + ∀ f : (I → ℤ) → ℝ, + (𝔼 z ∈ Fintype.piFinset (fun i => Finset.Ico (lo i) (hi i)), f z) = + (3 : ℝ) ^ Fintype.card I * + (smoothSourceFiniteWeights (integerIntervalCenter lo hi) (integerIntervalWidth lo hi) + (integerIntervalWidth_pos lo hi hlen) hZ).mean (fun z => w z * f z.val) := by + have hp : (∏ i, integerIntervalWidth lo hi i) ≠ 0 := + ne_of_gt (Finset.prod_pos (fun i _ => integerIntervalWidth_pos lo hi hlen i)) + obtain ⟨w, hw, he⟩ := smooth_window_change_of_measure (integerIntervalCenter lo hi) + (integerIntervalWidth lo hi) (integerIntervalWidth_pos lo hi hlen) hZ hscale + (Fintype.piFinset (fun i => Finset.Ico (lo i) (hi i))) + (fun z hz i => integer_interval_box_inner lo hi z hz i) + refine ⟨w, hw, fun f => ?_⟩ + have h := he f + rw [integer_interval_box_card lo hi hlen, mul_div_cancel_right₀ _ hp] at h + exact h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def finiteBoxPointsEquiv {I : Type*} [Fintype I] [DecidableEq I] + (S : I → Finset ℤ) : (∀ i, S i) ≃ Fintype.piFinset S where + toFun x := ⟨fun i => (x i).val, Fintype.mem_piFinset.mpr (fun i => (x i).property)⟩ + invFun x i := ⟨x.val i, Fintype.mem_piFinset.mp x.property i⟩ + left_inv x := by funext i; rfl + right_inv x := by apply Subtype.ext; rfl + +theorem finiteBoxPoints_expect {I : Type*} [Fintype I] [DecidableEq I] + (S : I → Finset ℤ) (f : (I → ℤ) → ℝ) : + (𝔼 x : Fintype.piFinset S, f x.val) = 𝔼 x : (∀ i, S i), f (fun i => (x i).val) := + (Fintype.expect_equiv (finiteBoxPointsEquiv S) + (fun x => f (fun i => (x i).val)) (fun x => f x.val) (fun _ => rfl)).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators Classical + +variable {I : Type*} [Fintype I] [DecidableEq I] + +noncomputable def coordinateFiberParameters (keep : I → Prop) (fixed : {i // ¬keep i} → ℤ) + (i : I) : MvPolynomial {i // keep i} ℝ := + if hi : keep i then X ⟨i, hi⟩ else C (fixed ⟨i, hi⟩ : ℝ) + +omit [Fintype I] [DecidableEq I] in +theorem coordinateFiberParameters_degree (keep : I → Prop) (fixed : {i // ¬keep i} → ℤ) + (i : I) : coordinateFiberParameters keep fixed i ∈ weightedSupportLE (fun _ => 1) 1 := by + by_cases hi : keep i + · simp only [coordinateFiberParameters, dite_eq_left hi] + exact weightedSupportLE_X _ _ + · simp only [coordinateFiberParameters, dite_eq_right hi] + exact weightedSupportLE_C _ _ _ + +noncomputable def PolynomialPatch.coordinateFiber {s d : ℕ} (A : PolynomialPatch I s d) + (keep : I → Prop) (fixed : {i // ¬keep i} → ℤ) : PolynomialPatch {i // keep i} s d := + A.reparam (coordinateFiberParameters keep fixed) (coordinateFiberParameters_degree keep fixed) + +theorem PolynomialPatch.coordinateFiber_value {s d : ℕ} (A : PolynomialPatch I s d) + (keep : I → Prop) (fixed : {i // ¬keep i} → ℤ) (x : {i // keep i} → ℤ) : + (A.coordinateFiber keep fixed).value (fun i => (x i : ℝ)) = + A.value (fun i => ((finiteSplitPoint keep x fixed i : ℤ) : ℝ)) := by + let _ : Fintype I := inferInstance + let _ : DecidableEq I := inferInstance + rw [coordinateFiber, reparam_value] + congr 1 + funext i + by_cases hi : keep i <;> simp [coordinateFiberParameters, finiteSplitPoint, hi] + +theorem finiteBoxPoints_expect_finset (S : I → Finset ℤ) (f : (I → ℤ) → ℝ) : + (𝔼 x ∈ Fintype.piFinset S, f x) = 𝔼 x : (∀ i, S i), f (fun i => (x i).val) := by + simpa only [Finset.expect_eq_sum_div_card, Finset.card_univ, Finset.sum_coe_sort, + Fintype.card_coe] using finiteBoxPoints_expect S f + +theorem exists_integerBox_coordinate_fiber (N : I → ℕ) (hN : ∀ i, 0 < N i) + (keep : I → Prop) (f : (I → ℤ) → ℝ) {a : ℝ} + (hmean : a ≤ 𝔼 x ∈ integerBox N, f x) : + ∃ fixed : {i // ¬keep i} → ℤ, + (∀ i, 0 ≤ fixed i ∧ fixed i < N i) ∧ + a ≤ 𝔼 x ∈ integerBox (fun i : {i // keep i} => N i), f (finiteSplitPoint keep x fixed) := by + let X := fun i => Finset.Ico (0 : ℤ) (N i) + let e := Equiv.piEquivPiSubtypeProd keep (fun i => X i) + have hn (i : I) : Nonempty (X i) := + ⟨⟨0, Finset.mem_Ico.mpr ⟨le_rfl, by exact_mod_cast hN i⟩⟩⟩ + let : ∀ i, Nonempty (X i) := hn + have hsplit : (𝔼 x : (∀ i, X i), f (fun i => (x i).val)) = + 𝔼 v : (∀ i : {i // ¬keep i}, X i), + 𝔼 u : (∀ i : {i // keep i}, X i), + f (finiteSplitPoint keep (fun i => (u i).val) (fun i => (v i).val)) := by + calc + _ = 𝔼 uv : (∀ i : {i // keep i}, X i) × (∀ i : {i // ¬keep i}, X i), + f (finiteSplitPoint keep (fun i => (uv.1 i).val) (fun i => (uv.2 i).val)) := by + apply Fintype.expect_equiv e + intro x + change f (fun i => (x i).val) = + f (finiteSplitPoint keep (fun i => (x i.val).val) (fun i => (x i.val).val)) + exact congrArg f (finiteSplitPoint_restrict keep (fun i => (x i).val)).symm + _ = _ := by + rw [← Finset.univ_product_univ, Finset.expect_product, Finset.expect_comm] + have hfull : a ≤ 𝔼 x : (∀ i, X i), f (fun i => (x i).val) := by + rw [← finiteBoxPoints_expect_finset X f] + exact hmean + rw [hsplit] at hfull + obtain ⟨v, _, hv⟩ := Finset.exists_le_of_le_expect Finset.univ_nonempty hfull + refine ⟨fun i => (v i).val, fun i => Finset.mem_Ico.mp (v i).property, ?_⟩ + rw [← finiteBoxPoints_expect_finset (fun i : {i // keep i} => X i) + (fun x => f (finiteSplitPoint keep x (fun i => (v i).val)))] at hv + exact hv + +theorem PolynomialPatch.exists_coordinate_fiber_score {s d : ℕ} (A : PolynomialPatch I s d) + (N : I → ℕ) (hN : ∀ i, 0 < N i) (keep : I → Prop) + (score : (I → ℤ) → ℝ) {a : ℝ} + (hmean : a ≤ 𝔼 x ∈ integerBox N, score x * A.value (fun i => (x i : ℝ))) : + ∃ fixed : {i // ¬keep i} → ℤ, + (∀ i, 0 ≤ fixed i ∧ fixed i < N i) ∧ + a ≤ 𝔼 x ∈ integerBox (fun i : {i // keep i} => N i), + score (finiteSplitPoint keep x fixed) * + (A.coordinateFiber keep fixed).value (fun i => (x i : ℝ)) := by + obtain ⟨fixed, hfixed, hscore⟩ := exists_integerBox_coordinate_fiber N hN keep + (fun x => score x * A.value (fun i => (x i : ℝ))) hmean + exact ⟨fixed, hfixed, by simpa only [coordinateFiber_value] using hscore⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateInjection.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateInjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa10a83876888751713db99a3064afedc06bb8d6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateInjection.lean @@ -0,0 +1,66 @@ +import Mathlib.Analysis.Normed.Module.FiniteDimension +import Mathlib.Tactic +import Mathlib.Topology.Algebra.Module.ContinuousLinearMap.PiProd + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def coordinateInjection {ι κ : Type*} [Fintype ι] [DecidableEq κ] + (f : ι → κ) : (ι → ℝ) →L[ℝ] (κ → ℝ) := + ∑ i, (ContinuousLinearMap.single ℝ (fun _ : κ => ℝ) (f i)).comp (ContinuousLinearMap.proj i) + +theorem coordinateInjection_apply {ι κ : Type*} [Fintype ι] [DecidableEq κ] + (f : ι → κ) (x : ι → ℝ) : + coordinateInjection f x = ∑ i, Pi.single (f i) (x i) := by + simp only [coordinateInjection, sum_apply, ContinuousLinearMap.comp_apply, + ContinuousLinearMap.single_apply, ContinuousLinearMap.proj_apply] + +theorem coordinateInjection_at_image {ι κ : Type*} [Fintype ι] [DecidableEq κ] + (f : ι → κ) (hf : Function.Injective f) (x : ι → ℝ) (i : ι) : + coordinateInjection f x (f i) = x i := by + classical + simp only [coordinateInjection_apply, Finset.sum_apply, Pi.single_apply] + simp [hf.eq_iff] + +theorem coordinateInjection_off_image {ι κ : Type*} [Fintype ι] [DecidableEq κ] + (f : ι → κ) (x : ι → ℝ) (j : κ) (hj : ∀ i, f i ≠ j) : + coordinateInjection f x j = 0 := by + have hji : ∀ i, j ≠ f i := fun i => (hj i).symm + simp only [coordinateInjection_apply, Finset.sum_apply, Pi.single_apply, hji, ite_false, + Finset.sum_const_zero] + +theorem coordinateInjection_norm_le {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq κ] + (f : ι → κ) (hf : Function.Injective f) : ‖coordinateInjection f‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro x + rw [one_mul] + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro j + by_cases hj : ∃ i, f i = j + · obtain ⟨i, rfl⟩ := hj + rw [coordinateInjection_at_image f hf] + exact norm_le_pi_norm x i + · rw [coordinateInjection_off_image f x j (not_exists.mp hj), norm_zero] + exact norm_nonneg x + +theorem coordinateInjection_single {ι κ : Type*} [Fintype ι] [DecidableEq ι] [DecidableEq κ] + (f : ι → κ) (i : ι) : + coordinateInjection f (Pi.single i 1) = Pi.single (f i) 1 := by + rw [coordinateInjection_apply] + rw [Finset.sum_eq_single i] + · simp + · intro j _ hji + simp [hji] + · intro hi + exact False.elim (hi (Finset.mem_univ i)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateLeafCount.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateLeafCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccd771e2243c4f39c9123fdaac1e7ef6a202bd06 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateLeafCount.lean @@ -0,0 +1,246 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalPairAccuracyLogBounds + +namespace OAI + +section + +namespace Erdos3.CoordinateDecisionTree + +universe u v + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} + +theorem trace_eq_of_agree (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input other : ∀ i, Value i) + (hagree : ∀ i ∈ (trace tree I base input).1, other i = input i) : + trace tree I base other = trace tree I base input := by + induction tree generalizing I base with + | leaf => rfl + | split i children ih => + have hi : i ∈ (trace (children (input i)) (insert i I) (Function.update base i (input i)) input).1 := + trace_contains _ _ _ _ (Finset.mem_insert_self _ _) + have he : other i = input i := hagree i hi + simp only [trace, he] + exact ih (input i) (insert i I) (Function.update base i (input i)) hagree + +theorem trace_outside (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input : ∀ i, Value i) (j : ι) (hj : j ∉ (trace tree I base input).1) : + (trace tree I base input).2 j = base j := by + induction tree generalizing I base with + | leaf => rfl + | split i children ih => + have hji : j ≠ i := by + intro he + subst j + exact hj (trace_contains (children (input i)) (insert i I) + (Function.update base i (input i)) input (Finset.mem_insert_self _ _)) + exact (ih (input i) (insert i I) (Function.update base i (input i)) hj).trans + (Function.update_of_ne hji _ _) + +def traceCylinder (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input : ∀ i, Value i) : ProductCylinder Value := + ProductCylinder.ofAssignment (trace tree I base input).1 (trace tree I base input).2 + +theorem traceCylinder_assignment (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input : ∀ i, Value i) : + (traceCylinder tree I base input).assignment base = (trace tree I base input).2 := by + funext i + by_cases hi : i ∈ (trace tree I base input).1 + · exact ProductCylinder.assignment_mem _ base i hi + · change (if h : i ∈ (trace tree I base input).1 then _ else base i) = _ + rw [dite_eq_right hi] + exact (trace_outside tree I base input i hi).symm + +theorem traceCylinder_contains (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input : ∀ i, Value i) (hinput : ∀ i ∈ I, input i = base i) : + (traceCylinder tree I base input).Contains input := by + intro i + exact (trace_agrees tree I base input (fun j hj => (hinput j hj).symm) i i.property).symm + +theorem traceCylinder_contains_iff (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input other : ∀ i, Value i) (hinput : ∀ i ∈ I, input i = base i) : + (traceCylinder tree I base input).Contains other ↔ + (∀ i ∈ I, other i = base i) ∧ traceCylinder tree I base other = traceCylinder tree I base input := by + have htrace := trace_agrees tree I base input (fun i hi => (hinput i hi).symm) + constructor + · intro h + have hagree : ∀ i ∈ (trace tree I base input).1, other i = input i := by + intro i hi + exact (h ⟨i, hi⟩).trans (htrace i hi) + have heq := trace_eq_of_agree tree I base input other hagree + refine ⟨fun i hi => (hagree i (trace_contains tree I base input hi)).trans (hinput i hi), ?_⟩ + unfold traceCylinder + rw [heq] + · rintro ⟨hother, heq⟩ + rw [← heq] + exact traceCylinder_contains tree I base other hother + +end Erdos3.CoordinateDecisionTree + +end + +section + +namespace Erdos3.CoordinateDecisionTree + +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {Value : ι → Type*} + [∀ i, Fintype (Value i)] + +noncomputable def leafCylinders (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base : ∀ i, Value i) : Finset (ProductCylinder Value) := + (Finset.univ.filter (fun input : ∀ i, Value i => ∀ i ∈ I, input i = base i)).image + (traceCylinder tree I base) + +theorem mem_leafCylinders (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base : ∀ i, Value i) (c : ProductCylinder Value) : + c ∈ leafCylinders tree I base ↔ + ∃ input, (∀ i ∈ I, input i = base i) ∧ traceCylinder tree I base input = c := by + simp only [leafCylinders, Finset.mem_image, Finset.mem_filter, Finset.mem_univ, true_and] + +theorem leafCylinders_contains_iff (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input : ∀ i, Value i) (c : ProductCylinder Value) (hc : c ∈ leafCylinders tree I base) : + c.Contains input ↔ (∀ i ∈ I, input i = base i) ∧ traceCylinder tree I base input = c := by + obtain ⟨source, hs, rfl⟩ := (mem_leafCylinders tree I base c).mp hc + exact traceCylinder_contains_iff tree I base source input hs + +theorem leafCylinders_unique (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input : ∀ i, Value i) (c d : ProductCylinder Value) + (hc : c ∈ leafCylinders tree I base) (hd : d ∈ leafCylinders tree I base) + (hci : c.Contains input) (hdi : d.Contains input) : c = d := + ((leafCylinders_contains_iff tree I base input c hc).mp hci).2.symm.trans + ((leafCylinders_contains_iff tree I base input d hd).mp hdi).2 + +theorem leafCylinders_indicator_sum (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base input : ∀ i, Value i) : + (∑ c ∈ leafCylinders tree I base, productFiberIndicator c.1 (c.assignment base) input) = + productFiberIndicator I base input := by + have he (c : ProductCylinder Value) (hc : c ∈ leafCylinders tree I base) : + productFiberIndicator c.1 (c.assignment base) input = + if (∀ i ∈ I, input i = base i) ∧ traceCylinder tree I base input = c then 1 else 0 := by + simp only [productFiberIndicator, ← ProductCylinder.contains_iff, + leafCylinders_contains_iff tree I base input c hc] + calc + _ = ∑ c ∈ leafCylinders tree I base, + if (∀ i ∈ I, input i = base i) ∧ traceCylinder tree I base input = c then (1 : ℝ) else 0 := + Finset.sum_congr rfl he + _ = _ := by + by_cases hi : ∀ i ∈ I, input i = base i + · have hc : traceCylinder tree I base input ∈ leafCylinders tree I base := + (mem_leafCylinders tree I base _).mpr ⟨input, hi, rfl⟩ + have hvalue : productFiberIndicator I base input = 1 := by + unfold productFiberIndicator + exact ite_eq_left hi + rw [hvalue, Finset.sum_eq_single (traceCylinder tree I base input)] + · exact ite_eq_left ⟨hi, rfl⟩ + · intro c _ hne + exact ite_eq_right (fun h => hne h.2.symm) + · exact fun hn => False.elim (hn hc) + · have hvalue : productFiberIndicator I base input = 0 := by + unfold productFiberIndicator + exact ite_eq_right hi + rw [hvalue] + apply Finset.sum_eq_zero + intro c _ + exact ite_eq_right (fun h => hi h.1) + +theorem leafCylinders_partition (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base : ∀ i, Value i) (f : (∀ i, Value i) → ℝ) (input : ∀ i, Value i) : + (∑ c ∈ leafCylinders tree I base, productFiberIndicator c.1 (c.assignment base) input * f input) = + productFiberIndicator I base input * f input := by + rw [← Finset.sum_mul, leafCylinders_indicator_sum] + +theorem leafCylinders_partition_empty (tree : CoordinateDecisionTree ι Value) + (base : ∀ i, Value i) (f : (∀ i, Value i) → ℝ) (input : ∀ i, Value i) : + (∑ c ∈ leafCylinders tree ∅ base, productFiberIndicator c.1 (c.assignment base) input * f input) = f input := by + simpa [productFiberIndicator] using leafCylinders_partition tree ∅ base f input + +theorem leafCylinders_mass_sum (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (base : ∀ i, Value i) (w : (∀ i, Value i) → ℝ) : + (∑ c ∈ leafCylinders tree I base, productFiberMass w c.1 (c.assignment base)) = + productFiberMass w I base := by + unfold productFiberMass + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum, leafCylinders_indicator_sum] + +end Erdos3.CoordinateDecisionTree + +end + +section + +namespace Erdos3.CoordinateDecisionTree + +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {Y : ι → Type*} + [∀ i, Fintype (Y i)] + {Good : Finset ι → (∀ i, Y i) → Prop} + {tree : CoordinateDecisionTree ι Y} {I : Finset ι} {base : ∀ i, Y i} {d : ℕ} + +theorem Valid.leaf_good (h : Valid Good I base tree d) + (c : ProductCylinder Y) (hc : c ∈ leafCylinders tree I base) : + Good c.1 (c.assignment base) := by + obtain ⟨input, _, rfl⟩ := (mem_leafCylinders tree I base c).mp hc + rw [traceCylinder_assignment] + exact h.trace_good input + +theorem Valid.leaf_card_le (h : Valid Good I base tree d) + (c : ProductCylinder Y) (hc : c ∈ leafCylinders tree I base) : c.1.card ≤ I.card + d := by + obtain ⟨input, _, rfl⟩ := (mem_leafCylinders tree I base c).mp hc + exact h.trace_card_le input + +theorem Valid.leafCylinders_subset_bounded (h : Valid Good I base tree d) + {A : ℕ} (hA : I.card + d ≤ A) : + leafCylinders tree I base ⊆ ProductCylinder.bounded (X := Y) A := by + intro c hc + exact (ProductCylinder.mem_bounded A c).mpr ((h.leaf_card_le c hc).trans hA) + +theorem Valid.leafCylinders_card_le_exp (h : Valid Good I base tree d) + {A : ℕ} (hA : I.card + d ≤ A) {P W : ℝ} (hP : 0 ≤ P) (hW : 0 ≤ W) + (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) + (hY : ∀ i, (Fintype.card (Y i) : ℝ) ≤ Real.exp W) : + ((leafCylinders tree I base).card : ℝ) ≤ Real.exp ((A : ℝ) * (P + W + 1)) := + (Nat.cast_le.mpr (Finset.card_le_card (h.leafCylinders_subset_bounded hA))).trans + (ProductCylinder.bounded_card_le_exp hP hW hcount hY A) + +noncomputable def leafSourceAssignments (X : ι → Type*) [∀ i, Fintype (X i)] + (tree : CoordinateDecisionTree ι Y) (I : Finset ι) (base : ∀ i, Y i) : + Finset (Σ c : ProductCylinder Y, ∀ i : c.1, X i.val) := + (leafCylinders tree I base).sigma (fun _c => Finset.univ) + +theorem mem_leafSourceAssignments (X : ι → Type*) [∀ i, Fintype (X i)] + (tree : CoordinateDecisionTree ι Y) (I : Finset ι) (base : ∀ i, Y i) + (z : Σ c : ProductCylinder Y, ∀ i : c.1, X i.val) : + z ∈ leafSourceAssignments X tree I base ↔ z.1 ∈ leafCylinders tree I base := by + simp only [leafSourceAssignments, Finset.mem_sigma, Finset.mem_univ, and_true] + +theorem Valid.leafSourceAssignments_card_le_exp (h : Valid Good I base tree d) + (X : ι → Type*) [∀ i, Fintype (X i)] {A : ℕ} (hA : I.card + d ≤ A) + {P V W : ℝ} (hP : 0 ≤ P) (hV : 0 ≤ V) (hW : 0 ≤ W) + (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) + (hX : ∀ i, (Fintype.card (X i) : ℝ) ≤ Real.exp V) + (hY : ∀ i, (Fintype.card (Y i) : ℝ) ≤ Real.exp W) : + ((leafSourceAssignments X tree I base).card : ℝ) ≤ + Real.exp ((A : ℝ) * (P + V + W + 1)) := by + have hleaves := h.leafCylinders_card_le_exp hA hP hW hcount hY + have hcard : ((leafSourceAssignments X tree I base).card : ℝ) = + ∑ c ∈ leafCylinders tree I base, (Fintype.card (∀ i : c.1, X i.val) : ℝ) := by + simp only [leafSourceAssignments, Finset.card_sigma, Finset.card_univ, Nat.cast_sum] + rw [hcard] + calc + _ ≤ ∑ _c ∈ leafCylinders tree I base, Real.exp ((A : ℝ) * V) := by + apply Finset.sum_le_sum + intro c hc + exact partial_assignment_card_le_exp hV hX c.1 ((h.leaf_card_le c hc).trans hA) + _ = ((leafCylinders tree I base).card : ℝ) * Real.exp ((A : ℝ) * V) := by simp + _ ≤ Real.exp ((A : ℝ) * (P + W + 1)) * Real.exp ((A : ℝ) * V) := + mul_le_mul_of_nonneg_right hleaves (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +end Erdos3.CoordinateDecisionTree + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateMinorCovolume.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateMinorCovolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7e8b27c58e1a4490e9aeea98a3052be232fc296 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateMinorCovolume.lean @@ -0,0 +1,84 @@ +import Mathlib.Analysis.InnerProductSpace.ExteriorPower +import OAI.Combinatorics.Progressions.Lattices.LatticeSheetHaar + +namespace OAI + +section + +namespace Erdos3 + +open RealInnerProductSpace + +theorem exterior_norm_eq_sqrt_gram {r : ℕ} {E : Type*} + [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] + (v : Fin r → E) : + ‖exteriorPower.ιMulti ℝ r v‖ = Real.sqrt (Matrix.gram ℝ v).det := by + have hs : ‖exteriorPower.ιMulti ℝ r v‖ ^ 2 = (Matrix.gram ℝ v).det := by + rw [← real_inner_self_eq_norm_sq] + exact exteriorPower.inner_ιMulti_self v + rw [← hs, Real.sqrt_sq (norm_nonneg _)] + +theorem abs_coordinate_det_le_sqrt_gram {r : ℕ} {ι : Type*} [Fintype ι] + (v : Fin r → EuclideanSpace ℝ ι) (p : Fin r → ι) (hp : Function.Injective p) : + |(Matrix.of (fun i j => v i (p j))).det| ≤ Real.sqrt (Matrix.gram ℝ v).det := by + classical + let e : Fin r → EuclideanSpace ℝ ι := fun i => EuclideanSpace.single (p i) 1 + let u := exteriorPower.ιMulti ℝ r e + let w := exteriorPower.ιMulti ℝ r v + have he : Orthonormal ℝ e := EuclideanSpace.orthonormal_single.comp p hp + have hgram : Matrix.gram ℝ e = 1 := Matrix.gram_eq_one_iff_orthonormal.mpr he + have hu : ‖u‖ = 1 := by + have hs : ‖u‖ ^ 2 = 1 := by + rw [← real_inner_self_eq_norm_sq] + change inner ℝ (exteriorPower.ιMulti ℝ r e) (exteriorPower.ιMulti ℝ r e) = 1 + rw [exteriorPower.inner_ιMulti_self, hgram, Matrix.det_one] + nlinarith [norm_nonneg u] + have hi : inner ℝ u w = (Matrix.of (fun i j => v i (p j))).det := by + change inner ℝ (exteriorPower.ιMulti ℝ r e) (exteriorPower.ιMulti ℝ r v) = _ + rw [exteriorPower.inner_ιMulti_ιMulti] + congr 1 + ext i j + simp [e, EuclideanSpace.inner_single_left] + have h := abs_real_inner_le_norm u w + rw [hi, hu, one_mul] at h + exact h.trans_eq (exterior_norm_eq_sqrt_gram v) + +theorem abs_lattice_basis_coordinate_det_le_covolume {r : ℕ} {ι : Type*} [Fintype ι] + (Z : Submodule ℝ (EuclideanSpace ℝ ι)) + (Λ : Submodule ℤ Z) [DiscreteTopology Λ] [IsZLattice ℝ Λ] + (b : Module.Basis (Fin r) ℤ Λ) (p : Fin r → ι) (hp : Function.Injective p) : + |(Matrix.of (fun i j => (b i).val.val (p j))).det| ≤ ZLattice.covolume Λ := by + have hs : ZLattice.covolume Λ ^ 2 = + (Matrix.gram ℝ (fun i : Fin r => (b i).val.val)).det := by + rw [lattice_covolume_sq_eq_gram Λ b] + congr 1 + ext i j + simp only [Matrix.gram_apply, Module.Basis.ofZLatticeBasis_apply] + rfl + have h := abs_coordinate_det_le_sqrt_gram (fun i : Fin r => (b i).val.val) p hp + rw [← hs, Real.sqrt_sq (ZLattice.covolume_pos Λ MeasureTheory.volume).le] at h + exact h + +theorem abs_isometric_lattice_basis_det_le_covolume {r : ℕ} {ι E : Type*} [Fintype ι] + [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + [MeasurableSpace E] [BorelSpace E] + (Λ : Submodule ℤ E) [DiscreteTopology Λ] [IsZLattice ℝ Λ] + (b : Module.Basis (Fin r) ℤ Λ) (f : E →ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (p : Fin r → ι) (hp : Function.Injective p) : + |(Matrix.of (fun i j => f (b i).val (p j))).det| ≤ ZLattice.covolume Λ := by + have hs : ZLattice.covolume Λ ^ 2 = + (Matrix.gram ℝ (fun i : Fin r => f (b i).val)).det := by + rw [lattice_covolume_sq_eq_gram Λ b] + congr 1 + ext i j + simp only [Matrix.gram_apply, Module.Basis.ofZLatticeBasis_apply, LinearIsometry.inner_map_map] + have h := abs_coordinate_det_le_sqrt_gram (fun i : Fin r => f (b i).val) p hp + rw [← hs, Real.sqrt_sq (ZLattice.covolume_pos Λ MeasureTheory.volume).le] at h + exact h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateProductCap.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateProductCap.lean new file mode 100644 index 0000000000000000000000000000000000000000..3df31c15a36169206d15f3b098b96556a433c442 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateProductCap.lean @@ -0,0 +1,82 @@ +import Mathlib.Data.Fintype.BigOperators +import OAI.Combinatorics.Progressions.Estimates.ShiftedSmoothSelectedMarginal + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def coordinateJoin {D X : Type*} [DecidableEq D] (j : D) + (tail : {d : D // d ≠ j} → X) (x : X) : D → X := + fun d => if h : d = j then x else tail ⟨d,h⟩ + +@[simp] theorem coordinateJoin_pivot {D X : Type*} [DecidableEq D] (j : D) + (tail : {d : D // d ≠ j} → X) (x : X) : coordinateJoin j tail x j = x := by + simp [coordinateJoin] + +@[simp] theorem coordinateJoin_other {D X : Type*} [DecidableEq D] (j : D) + (tail : {d : D // d ≠ j} → X) (x : X) (d : {d : D // d ≠ j}) : + coordinateJoin j tail x d.val = tail d := by + simp [coordinateJoin, d.property] + +theorem coordinateJoin_eta {D X : Type*} [DecidableEq D] (j : D) (z : D → X) : + coordinateJoin j (fun d => z d.val) (z j) = z := by + funext d + by_cases h : d = j <;> simp [coordinateJoin, h] + +theorem coordinateJoin_injective {D X : Type*} [DecidableEq D] (j : D) + (tail : {d : D // d ≠ j} → X) : Function.Injective (coordinateJoin j tail) := by + intro x y h + simpa only [coordinateJoin_pivot] using congrFun h j + +theorem independentProductPMF_coordinate_split {D X : Type*} [Fintype D] [DecidableEq D] + [Countable X] [MeasurableSpace X] [MeasurableSingletonClass X] + (p : D → PMF X) (j : D) : + independentProductPMF p = + (independentProductPMF (fun d : {d : D // d ≠ j} => p d.val)).bind + (fun tail => (p j).map (coordinateJoin j tail)) := by + ext z + let tail := fun d : {d : D // d ≠ j} => z d.val + have hz : coordinateJoin j tail (z j) = z := coordinateJoin_eta j z + rw [← hz, PMF.bind_apply, tsum_eq_single tail] + · rw [pmf_map_injective_at _ _ (coordinateJoin_injective j tail)] + simp only [independentProductPMF_apply] + rw [Fintype.prod_eq_mul_prod_subtype_ne _ j] + simp only [coordinateJoin_pivot, coordinateJoin_other] + exact mul_comm _ _ + · intro other hother + have hr : coordinateJoin j tail (z j) ∉ Set.range (coordinateJoin j other) := by + rintro ⟨x, he⟩ + apply hother + funext d + simpa only [coordinateJoin_other] using congrFun he d.val + rw [pmf_map_zero_off_range _ _ _ hr, mul_zero] + +theorem independentProductPMF_coordinate_cap {D X Y : Type*} [Fintype D] [DecidableEq D] + [Countable X] [MeasurableSpace X] [MeasurableSingletonClass X] + (p : D → PMF X) (j : D) (f : (D → X) → Y) + (hf : ∀ tail, Function.Injective (fun x => f (coordinateJoin j tail x))) + {C : ℝ} (hC : 0 ≤ C) (hp : ∀ x, (p j x).toReal ≤ C) (y : Y) : + ((independentProductPMF p).map f y).toReal ≤ C := by + rw [independentProductPMF_coordinate_split p j, PMF.map_bind] + simp_rw [PMF.map_comp] + exact pmf_bind_injective_toReal_cap _ _ _ hf hC hp y + +theorem shiftedSmoothProductPMF_coordinate_cap {D Y : Type*} [Fintype D] [DecidableEq D] + (a S : D → ℝ) (hS : ∀ d, 0 < S d) (hZ : 0 < shiftedSmoothProductMass a S) + (j : D) (f : (D → ℤ) → Y) + (hf : ∀ tail, Function.Injective (fun x => f (coordinateJoin j tail x))) + (hscale : 8*(probabilityProfileLipschitz : ℝ) ≤ S j) (y : Y) : + ((shiftedSmoothProductPMF a S hS hZ).map f y).toReal ≤ 2/S j := by + rw [shiftedSmoothProductPMF_eq_independent] + exact independentProductPMF_coordinate_cap _ j f hf (div_nonneg (by norm_num) (hS j).le) + (fun x => shiftedSmoothCoefficientPMF_le (a j) hscale x) y + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateQuotientModel.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateQuotientModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1f1ee15abd90aa3370b0c1854fcd557b48cf545 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateQuotientModel.lean @@ -0,0 +1,64 @@ +import OAI.Combinatorics.Progressions.Nilpotent.AdaptedBasisNilmanifold +import OAI.Combinatorics.Progressions.Sampling.SupportedQuotientExactGrid + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {L ι : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype ι] {s t : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (w : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + (I : LieIdeal ℚ L) (hI : F.layer (t + 1) ≤ I.toSubmodule) + (S : Set ι) [DecidablePred (· ∈ S)] + (hspan : I.toSubmodule = Submodule.span ℚ (b '' S)) + +noncomputable def quotientFinBasis : + Basis (Fin (Fintype.card {i // i ∉ S})) ℚ (L ⧸ I) := + (supportedQuotientBasis b I.toSubmodule S hspan).reindex (Fintype.equivFin _) + +noncomputable def quotientFinWeight : Fin (Fintype.card {i // i ∉ S}) → ℕ := + fun i => w ((Fintype.equivFin {i // i ∉ S}).symm i) + +include hlayers in +theorem quotientFinBasis_layers (j : ℕ) : + (F.quotientLie I hI).layer j = Submodule.span ℚ + (quotientFinBasis b I S hspan '' {i | j ≤ quotientFinWeight w S i}) := by + rw [F.supportedQuotientBasis_layers b w hlayers I hI S hspan] + exact (basis_reindex_span_weights (L := L ⧸ I) + (supportedQuotientBasis b I.toSubmodule S hspan) (Fintype.equivFin _) + (fun i => w i) j).symm + +noncomputable def coordinateQuotientModel (Γ : Subgroup F.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates b Γ) + (hout : bchSubgroupCoordinates b Γ ⊆ denominatorGrid N) : + RationalFilteredNilmanifold (L ⧸ I) t (Fintype.card {i // i ∉ S}) := + (F.quotientLie I hI).ofAdaptedBasis (quotientFinBasis b I S hspan) + (quotientFinWeight w S) (F.quotientFinBasis_layers b w hlayers I hI S hspan) + (Γ.map (F.quotientStepHom I hI)) N hN + (bchSubgroup_inner_grid_reindex _ (Fintype.equivFin _) _ + (F.quotientStep_inner_grid_supported b I hI S hspan Γ hin)) + (bchSubgroup_outer_grid_reindex _ (Fintype.equivFin _) _ + (F.quotientStep_outer_grid_supported b I hI S hspan Γ hout)) + +theorem coordinateQuotientModel_geometry (Γ : Subgroup F.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates b Γ) + (hout : bchSubgroupCoordinates b Γ ⊆ denominatorGrid N) + {p : ℝ} (hp : 0 ≤ p) (hd : (Fintype.card ι : ℝ) ≤ p) (hNp : (N : ℝ) ≤ Real.exp p) + (hc : ∀ i j k, rationalLogHeight (lieStructureConstants b i j k) ≤ p) : + (F.coordinateQuotientModel b w hlayers I hI S hspan Γ N hN hin hout).GeometryComplexityLE p := by + apply (F.quotientLie I hI).ofAdaptedBasis_geometry _ _ _ _ _ _ _ _ hp + · exact (Nat.cast_le.mpr (Fintype.card_subtype_le (fun i => i ∉ S))).trans hd + · exact hNp + · intro i j k + simp only [quotientFinBasis, lieStructureConstants_reindex, supportedQuotientBasis_lieStructure] + exact hc _ _ _ + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateSubstitutionAlgebra.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateSubstitutionAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..41f612c614ed55b916eae327773c9eee200fdf62 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateSubstitutionAlgebra.lean @@ -0,0 +1,45 @@ +import OAI.Combinatorics.Progressions.Polynomial.AdaptedPolynomialSubstitution + +namespace OAI + +section + +namespace Erdos3 + +variable {σ R S : Type*} [DecidableEq σ] [CommRing R] [CommRing S] [Algebra R S] + +theorem aeval_monomial_update (f : σ → S) (i : σ) (u : S) (a : σ →₀ ℕ) : + MvPolynomial.aeval (R := R) (Function.update f i u) (MvPolynomial.monomial a 1) = + u ^ a i * (a.erase i).prod (fun j n => f j ^ n) := by + rw [MvPolynomial.aeval_monomial, map_one, one_mul, + ← Finsupp.mul_prod_erase' a i (fun j n => Function.update f i u j ^ n) (fun _ => pow_zero _)] + rw [Function.update_self] + congr 1 + apply Finsupp.prod_congr + intro j hj + have hji : j ≠ i := by + intro h + subst j + simp only [Finsupp.mem_support_iff, Finsupp.erase_same, ne_eq, not_true_eq_false] at hj + rw [Function.update_of_ne hji] + +theorem aeval_monomial_update_eq_of_zero (f : σ → S) (i : σ) (u v : S) + (a : σ →₀ ℕ) (ha : a i = 0) : + MvPolynomial.aeval (R := R) (Function.update f i u) (MvPolynomial.monomial a 1) = + MvPolynomial.aeval (R := R) (Function.update f i v) (MvPolynomial.monomial a 1) := by + simp only [aeval_monomial_update, ha, pow_zero] + +theorem aeval_monomial_update_add (f : σ → S) (i : σ) (u v : S) + (a : σ →₀ ℕ) (ha : a i ≤ 1) : + MvPolynomial.aeval (R := R) (Function.update f i (u + v)) (MvPolynomial.monomial a 1) = + MvPolynomial.aeval (R := R) (Function.update f i u) (MvPolynomial.monomial a 1) + + MvPolynomial.aeval (R := R) (Function.update f i v) (MvPolynomial.monomial a 1) - + MvPolynomial.aeval (R := R) (Function.update f i 0) (MvPolynomial.monomial a 1) := by + rcases Nat.le_one_iff_eq_zero_or_eq_one.mp ha with h | h <;> + simp only [aeval_monomial_update, h, pow_zero, pow_one] <;> ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateSupNorm.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateSupNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..4cd2826998b9d5ac8f017845350fb12a18bac8d1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateSupNorm.lean @@ -0,0 +1,129 @@ +import Mathlib.Algebra.Order.BigOperators.Ring.Finset +import Mathlib.Analysis.Normed.Group.Constructions +import Mathlib.Analysis.Normed.Operator.Banach +import Mathlib.Analysis.Real.Sqrt +import Mathlib.LinearAlgebra.Pi +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +variable {ι κ : Type*} [Fintype ι] [Fintype κ] + +noncomputable def coordinateL2Norm (v : ι → ℝ) : ℝ := Real.sqrt (∑ i, v i ^ 2) + +theorem coordinateL2Norm_nonneg (v : ι → ℝ) : 0 ≤ coordinateL2Norm v := Real.sqrt_nonneg _ + +theorem coordinateL2Norm_le_card_bound (v : ι → ℝ) {B : ℝ} (hB : 0 ≤ B) + (hv : ∀ i, |v i| ≤ B) : coordinateL2Norm v ≤ (Fintype.card ι + 1) * B := by + unfold coordinateL2Norm + apply Real.sqrt_le_iff.mpr + refine ⟨by positivity, ?_⟩ + have hsum : (∑ i, v i ^ 2) ≤ (Fintype.card ι : ℝ) * B ^ 2 := by + calc + _ ≤ ∑ _i : ι, B ^ 2 := Finset.sum_le_sum fun i _ => + sq_le_sq.mpr ((hv i).trans_eq (abs_of_nonneg hB).symm) + _ = _ := by simp + apply hsum.trans + rw [mul_pow] + apply mul_le_mul_of_nonneg_right _ (sq_nonneg B) + nlinarith [Nat.cast_nonneg (α := ℝ) (Fintype.card ι), sq_nonneg (Fintype.card ι : ℝ)] + +theorem coordinateL2Norm_matrix_le (A : κ → ι → ℝ) (v : ι → ℝ) : + coordinateL2Norm (fun k => ∑ i, A k i * v i) ≤ + Real.sqrt (∑ k, ∑ i, A k i ^ 2) * coordinateL2Norm v := by + have h : (∑ k, (∑ i, A k i * v i) ^ 2) ≤ + (∑ k, ∑ i, A k i ^ 2) * ∑ i, v i ^ 2 := by + rw [Finset.sum_mul] + exact Finset.sum_le_sum (fun k _ => Finset.sum_mul_sq_le_sq_mul_sq Finset.univ (A k) v) + exact (Real.sqrt_le_sqrt h).trans_eq (Real.sqrt_mul + (Finset.sum_nonneg (fun _ _ => Finset.sum_nonneg (fun _ _ => sq_nonneg _))) _) + +theorem coordinateL2Norm_matrix_entry_bound (A : κ → ι → ℝ) (B : ℝ) + (hB : 0 ≤ B) (hA : ∀ k i, |A k i| ≤ B) (v : ι → ℝ) : + coordinateL2Norm (fun k => ∑ i, A k i * v i) ≤ + ((Fintype.card κ : ℝ) + Fintype.card ι + 1) * (B + 1) * coordinateL2Norm v := by + have hsum : (∑ k, ∑ i, A k i ^ 2) ≤ + (Fintype.card κ : ℝ) * Fintype.card ι * B ^ 2 := by + calc + (∑ k, ∑ i, A k i ^ 2) ≤ ∑ _k : κ, ∑ _i : ι, B ^ 2 := by + apply Finset.sum_le_sum + intro k _ + apply Finset.sum_le_sum + intro i _ + exact sq_le_sq.mpr ((hA k i).trans_eq (abs_of_nonneg hB).symm) + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; ring + have hn : 0 ≤ (Fintype.card ι : ℝ) := Nat.cast_nonneg _ + have hm : 0 ≤ (Fintype.card κ : ℝ) := Nat.cast_nonneg _ + have hdim : (Fintype.card κ : ℝ) * Fintype.card ι ≤ + ((Fintype.card κ : ℝ) + Fintype.card ι + 1) ^ 2 := by nlinarith [sq_nonneg ((Fintype.card κ : ℝ) - Fintype.card ι)] + have hsq : B ^ 2 ≤ (B + 1) ^ 2 := by nlinarith + have hroot : Real.sqrt (∑ k, ∑ i, A k i ^ 2) ≤ + ((Fintype.card κ : ℝ) + Fintype.card ι + 1) * (B + 1) := by + apply Real.sqrt_le_iff.mpr + refine ⟨by positivity, hsum.trans ?_⟩ + rw [mul_pow] + exact mul_le_mul hdim hsq (sq_nonneg _) (sq_nonneg _) + exact (coordinateL2Norm_matrix_le A v).trans + (mul_le_mul_of_nonneg_right hroot (coordinateL2Norm_nonneg v)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] + +omit [Fintype κ] in +theorem coordinateLinearMap_apply_sum (A : (ι → ℝ) →L[ℝ] (κ → ℝ)) (v : ι → ℝ) (k : κ) : + A v k = ∑ i, A (Pi.single i 1) k * v i := by + have hv : v = ∑ i, v i • Pi.single i (1 : ℝ) := by + simp only [← Pi.single_smul, smul_eq_mul, mul_one, LinearMap.sum_single_apply] + calc + A v k = A (∑ i, v i • Pi.single i (1 : ℝ)) k := congrArg (fun w => A w k) hv + _ = _ := by simp only [map_sum, map_smul, Finset.sum_apply, Pi.smul_apply, smul_eq_mul, mul_comm] + +theorem coordinateLinearMap_L2_bound (A : (ι → ℝ) →L[ℝ] (κ → ℝ)) (B : ℝ) + (hB : 0 ≤ B) (hA : ∀ k i, |A (Pi.single i 1) k| ≤ B) (v : ι → ℝ) : + coordinateL2Norm (A v) ≤ + ((Fintype.card κ : ℝ) + Fintype.card ι + 1) * (B + 1) * coordinateL2Norm v := by + have heq : A v = fun k => ∑ i, A (Pi.single i 1) k * v i := + funext (coordinateLinearMap_apply_sum A v) + rw [heq] + exact coordinateL2Norm_matrix_entry_bound (fun k i => A (Pi.single i 1) k) B hB hA v + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem abs_coordinate_le_coordinateL2Norm {ι : Type*} [Fintype ι] (v : ι → ℝ) (i : ι) : + |v i| ≤ coordinateL2Norm v := by + have hsq : (v i) ^ 2 ≤ ∑ j, (v j) ^ 2 := + Finset.single_le_sum (fun j _ => sq_nonneg (v j)) (Finset.mem_univ i) + have hsum : 0 ≤ ∑ j, (v j) ^ 2 := Finset.sum_nonneg fun j _ => sq_nonneg (v j) + have hroot := Real.sq_sqrt hsum + have hnonneg := coordinateL2Norm_nonneg v + unfold coordinateL2Norm at * + nlinarith [sq_abs (v i), abs_nonneg (v i)] + +theorem norm_le_coordinateL2Norm {ι : Type*} [Fintype ι] (v : ι → ℝ) : + ‖v‖ ≤ coordinateL2Norm v := by + apply (pi_norm_le_iff_of_nonneg (coordinateL2Norm_nonneg v)).mpr + intro i + simpa only [Real.norm_eq_abs] using abs_coordinate_le_coordinateL2Norm v i + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeBatch.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeBatch.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb2de8e92cfd2768dc076400aeaee76655ffb4f1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeBatch.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Linear.RankedCoordinateDecisionTree + +namespace OAI + +section + +namespace Erdos3.CoordinateDecisionTree + +universe u v + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} + +theorem exists_query_batch + (Good : Finset ι → (∀ i, Value i) → Prop) (batch : Finset ι) (d : ℕ) : + ∀ (I : Finset ι) (x : ∀ i, Value i), Disjoint I batch → + (∀ y : ∀ i, Value i, (∀ i ∈ I, y i = x i) → + ∃ tree : CoordinateDecisionTree ι Value, Valid Good (I ∪ batch) y tree d) → + ∃ tree : CoordinateDecisionTree ι Value, Valid Good I x tree (batch.card + d) := by + classical + induction batch using Finset.induction_on with + | empty => + intro I x hdisjoint continuation + simpa only [Finset.union_empty, Finset.card_empty, Nat.zero_add] using + continuation x (fun _ _ => rfl) + | @insert i batch fresh ih => + intro I x hdisjoint continuation + have hi : i ∉ I := by + intro hi + exact Finset.disjoint_left.mp hdisjoint hi (Finset.mem_insert_self _ _) + have hIB : Disjoint (insert i I) batch := by + apply Finset.disjoint_left.mpr + intro j hj hbatch + rcases Finset.mem_insert.mp hj with rfl | hj + · exact fresh hbatch + · exact Finset.disjoint_left.mp hdisjoint hj (Finset.mem_insert_of_mem hbatch) + have hchildren : ∀ value : Value i, ∃ tree : CoordinateDecisionTree ι Value, + Valid Good (insert i I) (Function.update x i value) tree (batch.card + d) := by + intro value + apply ih (insert i I) (Function.update x i value) hIB + intro y hy + have hbase : ∀ j ∈ I, y j = x j := by + intro j hj + have hji : j ≠ i := by intro h; subst j; exact hi hj + have h := hy j (Finset.mem_insert_of_mem hj) + simpa only [Function.update_of_ne hji] using h + have hunion : insert i I ∪ batch = I ∪ insert i batch := by ext j; simp only [Finset.mem_union, Finset.mem_insert]; tauto + simpa only [hunion] using continuation y hbase + choose children hchildren using hchildren + have hcard : (insert i batch).card + d = (batch.card + d) + 1 := by + rw [Finset.card_insert_of_notMem fresh] + omega + rw [hcard] + exact ⟨.split i children, .split hi hchildren⟩ + +end Erdos3.CoordinateDecisionTree + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeCardBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeCardBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..c06fa2c1667a1aea306a039e23a95a2c966dc439 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeCardBudget.lean @@ -0,0 +1,30 @@ +import OAI.Combinatorics.Progressions.Linear.RankedCoordinateDecisionTree + +namespace OAI + +section + +namespace Erdos3.CoordinateDecisionTree + +universe u v + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} + +theorem Valid.with_card_budget {Good : Finset ι → (∀ i, Value i) → Prop} + {I : Finset ι} {x : ∀ i, Value i} {tree : CoordinateDecisionTree ι Value} {d : ℕ} + (h : Valid Good I x tree d) (B : ℕ) (hB : I.card + d ≤ B) : + Valid (fun J y => Good J y ∧ J.card ≤ B) I x tree d := by + induction h with + | leaf good => exact .leaf ⟨good, by omega⟩ + | @split I x i children d fresh branches ih => + apply Valid.split fresh + intro value + apply ih value + rw [Finset.card_insert_of_notMem fresh] + omega + +end Erdos3.CoordinateDecisionTree + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeOutside.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeOutside.lean new file mode 100644 index 0000000000000000000000000000000000000000..240b81a2a8d8e455b68c7cdc2392e2ffe4ffefef --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeOutside.lean @@ -0,0 +1,64 @@ +import OAI.Combinatorics.Progressions.Linear.RankedCoordinateDecisionTree + +namespace OAI + +section + +namespace Erdos3.CoordinateDecisionTree + +universe u v + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} + +def outsideAssignment (K : Finset ι) (base : ∀ i, Value i) + (x : ∀ i : {i // i ∉ K}, Value i.val) : ∀ i, Value i := + fun i => if h : i ∈ K then base i else x ⟨i, h⟩ + +theorem outsideAssignment_update (K : Finset ι) (base : ∀ i, Value i) + (x : ∀ i : {i // i ∉ K}, Value i.val) (i : {i // i ∉ K}) (v : Value i.val) : + outsideAssignment K base (Function.update x i v) = + Function.update (outsideAssignment K base x) i.val v := by + funext j + by_cases h : j = i.val + · subst j + simp only [outsideAssignment, i.property, dite_false, Function.update_self] + · by_cases hj : j ∈ K + · simp only [outsideAssignment, hj, dite_true, Function.update_of_ne h] + · have hji : (⟨j, hj⟩ : {i // i ∉ K}) ≠ i := fun heq => h (congrArg Subtype.val heq) + simp only [outsideAssignment, hj, dite_false, Function.update_of_ne h, Function.update_of_ne hji] + +def liftOutside (K : Finset ι) : + CoordinateDecisionTree {i // i ∉ K} (fun i => Value i.val) → CoordinateDecisionTree ι Value + | .leaf => .leaf + | .split i children => .split i.val (fun v => liftOutside K (children v)) + +theorem Valid.liftOutside (K : Finset ι) (base : ∀ i, Value i) + {Good : Finset {i // i ∉ K} → (∀ i : {i // i ∉ K}, Value i.val) → Prop} + {Better : Finset ι → (∀ i, Value i) → Prop} + (transfer : ∀ J y, Good J y → Better (K ∪ J.image Subtype.val) (outsideAssignment K base y)) + {I : Finset {i // i ∉ K}} {x : ∀ i : {i // i ∉ K}, Value i.val} + {tree : CoordinateDecisionTree {i // i ∉ K} (fun i => Value i.val)} {d : ℕ} + (h : Valid Good I x tree d) : + Valid Better (K ∪ I.image Subtype.val) (outsideAssignment K base x) (tree.liftOutside K) d := by + classical + induction h with + | leaf good => exact .leaf (transfer _ _ good) + | @split I x i children d fresh branches ih => + have hfresh : i.val ∉ K ∪ I.image Subtype.val := by + simp only [Finset.mem_union, Finset.mem_image] + rintro (hK | ⟨j, hj, heq⟩) + · exact i.property hK + · exact fresh ((Subtype.ext heq : j = i) ▸ hj) + apply Valid.split hfresh + intro v + have hsets : K ∪ (insert i I).image Subtype.val = insert i.val (K ∪ I.image Subtype.val) := by + ext j + simp only [Finset.mem_union, Finset.mem_image, Finset.mem_insert] + aesop + simpa only [hsets, outsideAssignment_update] using ih v + +end Erdos3.CoordinateDecisionTree + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeRelabel.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeRelabel.lean new file mode 100644 index 0000000000000000000000000000000000000000..51f0ab1bd24a752155e87f940077cf6377749d69 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeRelabel.lean @@ -0,0 +1,53 @@ +import OAI.Combinatorics.Progressions.Linear.RankedCoordinateDecisionTree + +namespace OAI + +section + +namespace Erdos3.CoordinateDecisionTree + +universe u v w + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} {Other : ι → Type w} + +def relabelAssignment (e : ∀ i, Value i ≃ Other i) (x : ∀ i, Value i) : ∀ i, Other i := + fun i => e i (x i) + +theorem relabelAssignment_update (e : ∀ i, Value i ≃ Other i) + (x : ∀ i, Value i) (i : ι) (v : Value i) : + relabelAssignment e (Function.update x i v) = + Function.update (relabelAssignment e x) i (e i v) := by + funext j + by_cases h : j = i + · subst j; simp only [relabelAssignment, Function.update_self] + · simp only [relabelAssignment, Function.update_of_ne h] + +omit [DecidableEq ι] in +theorem relabelAssignment_inverse (e : ∀ i, Value i ≃ Other i) (x : ∀ i, Value i) : + relabelAssignment (fun i => (e i).symm) (relabelAssignment e x) = x := by + funext i + exact (e i).symm_apply_apply (x i) + +def relabel (e : ∀ i, Value i ≃ Other i) : + CoordinateDecisionTree ι Value → CoordinateDecisionTree ι Other + | .leaf => .leaf + | .split i children => .split i (fun v => relabel e (children ((e i).symm v))) + +theorem Valid.relabel {Good : Finset ι → (∀ i, Value i) → Prop} + {I : Finset ι} {x : ∀ i, Value i} {tree : CoordinateDecisionTree ι Value} {d : ℕ} + (h : Valid Good I x tree d) (e : ∀ i, Value i ≃ Other i) : + Valid (fun J y => Good J (relabelAssignment (fun i => (e i).symm) y)) + I (relabelAssignment e x) (tree.relabel e) d := by + induction h with + | leaf good => + exact .leaf (by simpa only [relabelAssignment_inverse] using good) + | @split I x i children d fresh branches ih => + apply Valid.split fresh + intro v + simpa only [relabelAssignment_update, Equiv.apply_symm_apply] using ih ((e i).symm v) + +end Erdos3.CoordinateDecisionTree + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeTrace.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeTrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..94f5a6c12568e82ba1e05b810ce4bd74e83224fd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinateTreeTrace.lean @@ -0,0 +1,162 @@ +import Mathlib.Data.Finset.Card +import Mathlib.Logic.Function.Defs + +namespace OAI + +section + +namespace Erdos3 + +universe u v + +inductive CoordinateDecisionTree (ι : Type u) (Value : ι → Type v) : Type (max u v) + | leaf : CoordinateDecisionTree ι Value + | split (i : ι) (children : Value i → CoordinateDecisionTree ι Value) : CoordinateDecisionTree ι Value + +namespace CoordinateDecisionTree + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} + +inductive Valid (Good : Finset ι → (∀ i, Value i) → Prop) : + Finset ι → (∀ i, Value i) → CoordinateDecisionTree ι Value → ℕ → Prop + | leaf {I : Finset ι} {x : ∀ i, Value i} {d : ℕ} (good : Good I x) : Valid Good I x .leaf d + | split {I : Finset ι} {x : ∀ i, Value i} {i : ι} + {children : Value i → CoordinateDecisionTree ι Value} {d : ℕ} + (fresh : i ∉ I) + (branches : ∀ value, Valid Good (insert i I) (Function.update x i value) (children value) d) : + Valid Good I x (.split i children) (d + 1) + +theorem Valid.weaken {Good : Finset ι → (∀ i, Value i) → Prop} + {I : Finset ι} {x : ∀ i, Value i} {tree : CoordinateDecisionTree ι Value} {d : ℕ} + (h : Valid Good I x tree d) (extra : ℕ) : Valid Good I x tree (d + extra) := by + induction h with + | leaf good => exact .leaf good + | @split I x i children d fresh branches ih => + have hsum : d + 1 + extra = d + extra + 1 := by omega + rw [hsum] + exact .split fresh ih + +theorem Valid.mono {Good : Finset ι → (∀ i, Value i) → Prop} + {I : Finset ι} {x : ∀ i, Value i} {tree : CoordinateDecisionTree ι Value} {d e : ℕ} + (h : Valid Good I x tree d) (hde : d ≤ e) : Valid Good I x tree e := by + have he : d + (e - d) = e := Nat.add_sub_of_le hde + simpa only [he] using h.weaken (e - d) + +end CoordinateDecisionTree + +end Erdos3 + +end + +section + +namespace Erdos3.CoordinateDecisionTree + +universe u v + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} + +theorem Valid.congr_assignment {Good : Finset ι → (∀ i, Value i) → Prop} + (hlocal : ∀ I x y, (∀ i ∈ I, x i = y i) → Good I x → Good I y) + {I : Finset ι} {x : ∀ i, Value i} {tree : CoordinateDecisionTree ι Value} {d : ℕ} + (h : Valid Good I x tree d) (y : ∀ i, Value i) (hxy : ∀ i ∈ I, x i = y i) : + Valid Good I y tree d := by + induction h generalizing y with + | leaf good => exact .leaf (hlocal _ _ _ hxy good) + | @split I x i children d fresh branches ih => + apply Valid.split fresh + intro value + apply ih value (Function.update y i value) + intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · simp only [Function.update_self] + · have hji : j ≠ i := by intro heq; subst j; exact fresh hj + simpa only [Function.update_of_ne hji] using hxy j hj + +end Erdos3.CoordinateDecisionTree + +end + +section + +namespace Erdos3.CoordinateDecisionTree + +universe u v + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} + +theorem Valid.preserve_subset {Good : Finset ι → (∀ i, Value i) → Prop} + {I M : Finset ι} {x : ∀ i, Value i} {tree : CoordinateDecisionTree ι Value} {d : ℕ} + (h : Valid Good I x tree d) (hMI : M ⊆ I) : + Valid (fun J y => M ⊆ J ∧ Good J y) I x tree d := by + revert hMI + induction h with + | leaf good => intro hMI; exact .leaf ⟨hMI, good⟩ + | @split I x i children d fresh branches ih => + intro hMI + exact .split fresh (fun value => ih value (hMI.trans (Finset.subset_insert i I))) + +end Erdos3.CoordinateDecisionTree + +end + +section + +namespace Erdos3.CoordinateDecisionTree + +universe u v + +variable {ι : Type u} [DecidableEq ι] {Value : ι → Type v} + +def trace : CoordinateDecisionTree ι Value → Finset ι → (∀ i, Value i) → (∀ i, Value i) → + Finset ι × (∀ i, Value i) + | .leaf, I, x, _ => (I, x) + | .split i children, I, x, input => + trace (children (input i)) (insert i I) (Function.update x i (input i)) input + +theorem trace_contains (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (x input : ∀ i, Value i) : I ⊆ (trace tree I x input).1 := by + induction tree generalizing I x with + | leaf => exact Finset.Subset.refl I + | split i children ih => + exact (Finset.subset_insert i I).trans (ih (input i) (insert i I) (Function.update x i (input i))) + +theorem trace_agrees (tree : CoordinateDecisionTree ι Value) (I : Finset ι) + (x input : ∀ i, Value i) (hagree : ∀ i ∈ I, x i = input i) : + ∀ i ∈ (trace tree I x input).1, (trace tree I x input).2 i = input i := by + induction tree generalizing I x with + | leaf => exact hagree + | split i children ih => + apply ih (input i) (insert i I) (Function.update x i (input i)) + intro j hj + by_cases hji : j = i + · subst j + exact Function.update_self _ _ _ + · rw [Function.update_of_ne hji] + exact hagree j (Finset.mem_of_mem_insert_of_ne hj hji) + +theorem Valid.trace_good {Good : Finset ι → (∀ i, Value i) → Prop} + {I : Finset ι} {x : ∀ i, Value i} {tree : CoordinateDecisionTree ι Value} {d : ℕ} + (h : Valid Good I x tree d) (input : ∀ i, Value i) : + Good (trace tree I x input).1 (trace tree I x input).2 := by + induction h generalizing input with + | leaf good => exact good + | @split I x i children d fresh branches ih => exact ih (input i) input + +theorem Valid.trace_card_le {Good : Finset ι → (∀ i, Value i) → Prop} + {I : Finset ι} {x : ∀ i, Value i} {tree : CoordinateDecisionTree ι Value} {d : ℕ} + (h : Valid Good I x tree d) (input : ∀ i, Value i) : + (trace tree I x input).1.card ≤ I.card + d := by + induction h generalizing input with + | leaf good => simp only [trace]; omega + | @split I x i children d fresh branches ih => + have hchild := ih (input i) input + have hcard := Finset.card_insert_of_notMem fresh + change (trace (children (input i)) (insert i I) (Function.update x i (input i)) input).1.card ≤ _ + omega + +end Erdos3.CoordinateDecisionTree + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinatedMatchingScale.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinatedMatchingScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..a601c916a90d0cdaa5ec518842b848b84673a2f8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinatedMatchingScale.lean @@ -0,0 +1,103 @@ +import OAI.Combinatorics.Progressions.Dynamics.UnbalancedWidthBudget + +namespace OAI + +section + +namespace Erdos3.CellRefinement + +open LocalConvolution +open scoped NNReal + +noncomputable def coordinatedMatchingScale (rank : ℕ) (M delta c : ℝ) + (kappa : ℝ≥0) : ℝ≥0 := + min (kappa / 2) (min (controlledLocalMomentScale rank M delta) + (localizedAverageScale rank (M ^ 2) (c / 32) / 2)) + +theorem coordinatedMatchingScale_spec (rank : ℕ) {M delta c : ℝ} {kappa : ℝ≥0} + (hM : 0 ≤ M) (hdelta : 0 < delta) (hc : 0 < c) (hkappa : 0 < kappa) : + 0 < coordinatedMatchingScale rank M delta c kappa ∧ + coordinatedMatchingScale rank M delta c kappa ≤ kappa / 2 ∧ + coordinatedMatchingScale rank M delta c kappa ≤ controlledLocalMomentScale rank M delta ∧ + coordinatedMatchingScale rank M delta c kappa + coordinatedMatchingScale rank M delta c kappa ≤ + 1 / (100 * (2 * max rank 1 : ℕ) : ℝ≥0) ∧ + M ^ 2 * (400 * (max rank 1 : ℕ) * + ((coordinatedMatchingScale rank M delta c kappa + coordinatedMatchingScale rank M delta c kappa : ℝ≥0) : ℝ)) ≤ + c / 32 := by + obtain ⟨hmoment, _, _⟩ := controlledLocalMomentScale_spec rank hM hdelta + obtain ⟨hboundary, hsmall, herror⟩ := localizedAverageScale_spec rank (sq_nonneg M) + (show 0 < c / 32 by positivity) + have hleft : coordinatedMatchingScale rank M delta c kappa ≤ kappa / 2 := min_le_left _ _ + have hmomentBound : coordinatedMatchingScale rank M delta c kappa ≤ + controlledLocalMomentScale rank M delta := (min_le_right _ _).trans (min_le_left _ _) + have hboundaryBound : coordinatedMatchingScale rank M delta c kappa ≤ + localizedAverageScale rank (M ^ 2) (c / 32) / 2 := + (min_le_right _ _).trans (min_le_right _ _) + have hsum : coordinatedMatchingScale rank M delta c kappa + coordinatedMatchingScale rank M delta c kappa ≤ + localizedAverageScale rank (M ^ 2) (c / 32) := by + simpa only [add_halves] using add_le_add hboundaryBound hboundaryBound + refine ⟨lt_min (div_pos hkappa (by norm_num)) (lt_min hmoment (div_pos hboundary (by norm_num))), + hleft, hmomentBound, hsum.trans hsmall, ?_⟩ + have hsumR : ((coordinatedMatchingScale rank M delta c kappa + coordinatedMatchingScale rank M delta c kappa : ℝ≥0) : ℝ) ≤ + localizedAverageScale rank (M ^ 2) (c / 32) := by exact_mod_cast hsum + apply le_trans _ herror + gcongr + +noncomputable def coordinatedMatchingScaleLoss (rank : ℕ) (P K delta c : ℝ) : ℝ := + K + rank + 2 * P + localMomentErrorBudget delta + unbalancedErrorBudget c + 1604 + +theorem coordinatedMatchingScale_exp_lower (rank : ℕ) + {M P K delta c : ℝ} {kappa : ℝ≥0} + (hM : 0 ≤ M) (hcap : M ≤ Real.exp P) (hP : 0 ≤ P) (hK : 0 ≤ K) + (hdelta : 0 < delta) (hc : 0 < c) (hc1 : c ≤ 1) + (hkappa : Real.exp (-K) ≤ (kappa : ℝ)) : + Real.exp (-coordinatedMatchingScaleLoss rank P K delta c) ≤ + (coordinatedMatchingScale rank M delta c kappa : ℝ) := by + have hEd := (localMomentErrorBudget_spec hdelta).1 + obtain ⟨hEc, hEceq⟩ := unbalancedErrorBudget_spec hc hc1 + have hmoment := controlledLocalMomentScale_exp_lower rank hM hcap hP hdelta + have hMtwo : M ^ 2 ≤ Real.exp (2 * P) := by + calc + _ ≤ (Real.exp P) ^ 2 := pow_le_pow_left₀ hM hcap 2 + _ = _ := by rw [← Real.exp_nat_mul]; norm_num + have hboundary := localizedAverageScale_exp_lower_of_error rank (sq_nonneg M) hMtwo + (show 0 ≤ 2 * P by positivity) hEc + (show Real.exp (-unbalancedErrorBudget c) / 2 ≤ c / 32 by rw [hEceq]; linarith) + have htwo : Real.exp (-2 : ℝ) ≤ 1 / 2 := by + have h : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp 2] + simpa only [Real.exp_neg, one_div] using one_div_le_one_div_of_le (by norm_num) h + have hhalf {a : ℝ} {r : ℝ≥0} (ha : Real.exp (-a) ≤ (r : ℝ)) : + Real.exp (-(a + 2)) ≤ ((r / 2 : ℝ≥0) : ℝ) := by + calc + _ = Real.exp (-a) * Real.exp (-2) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ (r : ℝ) * (1 / 2) := mul_le_mul ha htwo (Real.exp_nonneg _) r.coe_nonneg + _ = _ := by change _ = (r : ℝ) / 2; ring + have hrank : (0 : ℝ) ≤ rank := Nat.cast_nonneg rank + have houter : Real.exp (-coordinatedMatchingScaleLoss rank P K delta c) ≤ + ((kappa / 2 : ℝ≥0) : ℝ) := by + apply le_trans _ (hhalf hkappa) + apply Real.exp_le_exp.mpr + unfold coordinatedMatchingScaleLoss + linarith + have hmom : Real.exp (-coordinatedMatchingScaleLoss rank P K delta c) ≤ + (controlledLocalMomentScale rank M delta : ℝ) := by + apply le_trans _ hmoment + apply Real.exp_le_exp.mpr + unfold coordinatedMatchingScaleLoss + linarith + have hbound : Real.exp (-coordinatedMatchingScaleLoss rank P K delta c) ≤ + ((localizedAverageScale rank (M ^ 2) (c / 32) / 2 : ℝ≥0) : ℝ) := by + apply le_trans _ (hhalf hboundary) + apply Real.exp_le_exp.mpr + unfold coordinatedMatchingScaleLoss + linarith + change _ ≤ min ((kappa / 2 : ℝ≥0) : ℝ) + (min (controlledLocalMomentScale rank M delta : ℝ) + ((localizedAverageScale rank (M ^ 2) (c / 32) / 2 : ℝ≥0) : ℝ)) + exact le_min houter (le_min hmom hbound) + +end Erdos3.CellRefinement + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoordinatewiseLipschitz.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinatewiseLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..c760f058c50b4938bfddbcad95dc7c70c7bb8cfe --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoordinatewiseLipschitz.lean @@ -0,0 +1,79 @@ +import Mathlib.Tactic +import Mathlib.Topology.MetricSpace.IsometricSMul +import Mathlib.Topology.MetricSpace.Lipschitz + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem lipschitzWith_of_coordinatewise {ι : Type*} [Fintype ι] [DecidableEq ι] + {X : ι → Type*} [∀ i, PseudoMetricSpace (X i)] {Y : Type*} [PseudoMetricSpace Y] + (f : (∀ i, X i) → Y) (C : ι → ℝ≥0) + (h : ∀ i x, LipschitzWith (C i) (fun a => f (Function.update x i a))) : + LipschitzWith (∑ i, C i) f := by + apply LipschitzWith.of_dist_le_mul + intro x y + let z (S : Finset ι) : ∀ i, X i := fun i => if i ∈ S then x i else y i + have hbound (S : Finset ι) : dist (f (z S)) (f y) ≤ ∑ i ∈ S, (C i : ℝ) * dist (x i) (y i) := by + induction S using Finset.induction_on with + | empty => simp only [z, Finset.notMem_empty, ite_false, Finset.sum_empty, dist_self, le_refl] + | @insert i S hi ih => + have heq : z (insert i S) = Function.update (z S) i (x i) := by + funext j + by_cases hji : j = i + · subst j + simp only [z, Finset.mem_insert_self, ite_true, Function.update_self] + · simp only [z, Finset.mem_insert, hji, false_or, Function.update_of_ne hji] + have hold : z S = Function.update (z S) i (y i) := by + funext j + by_cases hji : j = i + · subst j + simp only [z, hi, ite_false, Function.update_self] + · rw [Function.update_of_ne hji] + have hstep : dist (f (z (insert i S))) (f (z S)) ≤ (C i : ℝ) * dist (x i) (y i) := by + calc + _ = dist (f (Function.update (z S) i (x i))) (f (Function.update (z S) i (y i))) := by + rw [heq] + exact congrArg (fun v => dist (f (Function.update (z S) i (x i))) (f v)) hold + _ ≤ _ := (h i (z S)).dist_le_mul _ _ + have htri : dist (f (z (insert i S))) (f y) ≤ + (C i : ℝ) * dist (x i) (y i) + ∑ j ∈ S, (C j : ℝ) * dist (x j) (y j) := + (dist_triangle _ _ _).trans (add_le_add hstep ih) + simpa only [Finset.sum_insert hi] using htri + have htotal : dist (f x) (f y) ≤ ∑ i, (C i : ℝ) * dist (x i) (y i) := by + simpa only [z, Finset.mem_univ, ite_true] using hbound Finset.univ + calc + _ ≤ ∑ i, (C i : ℝ) * dist (x i) (y i) := htotal + _ ≤ ∑ i, (C i : ℝ) * dist x y := Finset.sum_le_sum + (fun i _ => mul_le_mul_of_nonneg_left (dist_le_pi_dist x y i) (C i).coe_nonneg) + _ = ((∑ i, C i : ℝ≥0) : ℝ) * dist x y := by rw [NNReal.coe_sum, Finset.sum_mul] + +theorem lipschitzWith_pi_hom_of_single {ι : Type*} [Fintype ι] [DecidableEq ι] + {G : ι → Type*} [∀ i, Group (G i)] [∀ i, PseudoMetricSpace (G i)] + {H : Type*} [Group H] [PseudoMetricSpace H] [IsIsometricSMul Hᵐᵒᵖ H] + (φ : (∀ i, G i) →* H) (C : ι → ℝ≥0) + (h : ∀ i, LipschitzWith (C i) (fun a => φ (Pi.mulSingle i a))) : + LipschitzWith (∑ i, C i) φ := by + apply lipschitzWith_of_coordinatewise φ C + intro i x + apply LipschitzWith.of_dist_le_mul + intro a b + have heq (a : G i) : Function.update x i a = + Pi.mulSingle i a * Function.update x i 1 := by + funext j + by_cases hji : j = i + · subst j + simp only [Function.update_self, Pi.mul_apply, Pi.mulSingle_eq_same, mul_one] + · simp only [Function.update_of_ne hji, Pi.mul_apply, Pi.mulSingle_eq_of_ne hji, one_mul] + rw [heq a, heq b, map_mul, map_mul, dist_mul_right] + exact (h i).dist_le_mul a b + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CoveredJetChart.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CoveredJetChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0d6dc50bcad8d2fca5cf3162eb9bcc6ce91eb93 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CoveredJetChart.lean @@ -0,0 +1,104 @@ +import OAI.Combinatorics.Progressions.Probability.NormalizedCoveredDensity + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule +open scoped Classical + +variable {m : ℕ} {O J B : Fin m → Type*} [∀ j, Fintype (J j)] [∀ j, Fintype (B j)] +variable {n : Fin m → ℕ} (U : ∀ j, Submodule ℝ (J j → ℝ)) + +abbrev CoveredJetChartSource (O B : Fin m → Type*) (n : Fin m → ℕ) (d : ℕ) := + ∀ j, O j → (euclideanSubspace (U j) × (Fin (n j) → ℤ)) × (B j → ZMod d) + +instance coveredJetChartSource_borel [∀ j, Fintype (O j)] (d : ℕ) [NeZero d] : + BorelSpace (CoveredJetChartSource U O B n d) := by + let : ∀ j, BorelSpace ((euclideanSubspace (U j) × (Fin (n j) → ℤ)) × (B j → ZMod d)) := + fun _ => inferInstance + let : ∀ j, BorelSpace (O j → (euclideanSubspace (U j) × (Fin (n j) → ℤ)) × (B j → ZMod d)) := + fun _ => Pi.borelSpace + exact Pi.borelSpace + +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (B j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +noncomputable def coveredJetChart : CoveredJetChartSource U O B n d → EuclideanJetLayers U O := + fun x j t => normalizedCoveredChart (euclideanSubspace (U j)) (b j) (hb j) (bW j) d (x j t) + +def coveredJetSourceRegion (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) : + Set (CoveredJetChartSource U O B n d) := + Set.univ.pi (fun j => Set.univ.pi (fun t => + (normalizedLatticePoint (euclideanSubspace (U j)) (b j) ⁻¹' Ω j t) ×ˢ Set.univ)) + +def coveredJetTargetRegion (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) : + Set (EuclideanJetLayers U O) := + Set.univ.pi (fun j => Set.univ.pi (fun t => + quotientIntegerCover + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup d ⁻¹' + normalizedChartRegion (euclideanSubspace (U j)) (b j) (hb j) (Ω j t))) + +theorem coveredJetChart_continuous : Continuous (coveredJetChart (O := O) U b hb bW d) := by + apply continuous_pi + intro j + apply continuous_pi + intro t + exact (normalizedCoveredChart_continuous _ (b j) (hb j) (bW j) d).comp + ((continuous_apply t).comp (continuous_apply j)) + +theorem coveredJetChart_injOn (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) + (hΩ : ∀ j t, Ω j t ⊆ standardLatticeSmallBox (J j)) : + Set.InjOn (coveredJetChart U b hb bW d) (coveredJetSourceRegion U b d Ω) := by + intro x hx y hy he + funext j t + exact normalizedCoveredChart_injOn _ (b j) (hb j) (bW j) d (hΩ j t) + (hx j (Set.mem_univ j) t (Set.mem_univ t)) (hy j (Set.mem_univ j) t (Set.mem_univ t)) + (congrFun (congrFun he j) t) + +theorem coveredJetChart_image (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) : + coveredJetChart U b hb bW d '' coveredJetSourceRegion U b d Ω = + coveredJetTargetRegion U b hb d Ω := by + unfold coveredJetChart coveredJetSourceRegion coveredJetTargetRegion + change Pi.map (fun j => Pi.map (fun _ : O j => + normalizedCoveredChart (euclideanSubspace (U j)) (b j) (hb j) (bW j) d)) '' _ = _ + rw [Set.piMap_image_univ_pi] + simp_rw [Set.piMap_image_univ_pi, normalizedCoveredChart_image] + +variable [∀ j, Fintype (O j)] + +omit [∀ j, Fintype (B j)] [NeZero d] in +theorem coveredJetSourceRegion_measurable (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) + (hΩm : ∀ j t, MeasurableSet (Ω j t)) : + MeasurableSet (coveredJetSourceRegion (B := B) U b d Ω) := by + apply MeasurableSet.univ_pi + intro j + apply MeasurableSet.univ_pi + intro t + exact ((hΩm j t).preimage (normalizedLatticePoint_continuous _ (b j)).measurable).prod + MeasurableSet.univ + +theorem coveredJetChart_embedding (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) + (hΩm : ∀ j t, MeasurableSet (Ω j t)) + (hΩ : ∀ j t, Ω j t ⊆ standardLatticeSmallBox (J j)) : + MeasurableEmbedding (fun x : coveredJetSourceRegion (B := B) U b d Ω => + coveredJetChart U b hb bW d x.val) := by + let : ∀ j, PolishSpace ((euclideanSubspace (U j) × (Fin (n j) → ℤ)) × (B j → ZMod d)) := + fun _ => inferInstance + let : ∀ j, PolishSpace (O j → (euclideanSubspace (U j) × (Fin (n j) → ℤ)) × (B j → ZMod d)) := + fun _ => by constructor + let : PolishSpace (CoveredJetChartSource U O B n d) := by constructor + exact ContinuousOn.measurableEmbedding (coveredJetSourceRegion_measurable U b d Ω hΩm) + (coveredJetChart_continuous U b hb bW d).continuousOn + (coveredJetChart_injOn U b hb bW d Ω hΩ) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CubeSignalCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CubeSignalCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a4ac9fd98e0ddbbcd024a80d641f02d61414743 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CubeSignalCoordinates.lean @@ -0,0 +1,108 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeRetainedTargetCubeIntervals + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def fullCubeSignal {G : Type*} [AddCommGroup G] {d : ℕ} + (f : G → ℂ) (x : Fin (d + 3) → G) : ℂ := + cubeProduct f (List.ofFn (fun j => x ((1 : Fin (d + 3)).succAbove j))) (x 1) + +theorem booleanWeight_true (d : ℕ) : booleanWeight (fun _ : Fin d => true) = d := by + simp [booleanWeight] + +theorem cubeShift_true {G : Type*} [AddCommGroup G] {d : ℕ} (k : Fin d → G) : + cubeShift k (fun _ => true) = ∑ i, k i := by simp [cubeShift] + +theorem exists_false_of_ne_true {d : ℕ} {ω : Fin d → Bool} + (h : ω ≠ fun _ => true) : ∃ j, ω j = false := by + obtain ⟨j, hj⟩ := Function.ne_iff.mp h + refine ⟨j, ?_⟩ + cases he : ω j <;> simp_all + +theorem cubeShift_congr_selected {G : Type*} [AddCommGroup G] {d : ℕ} + (k l : Fin d → G) (ω : Fin d → Bool) (h : ∀ i, ω i = true → k i = l i) : + cubeShift k ω = cubeShift l ω := by + unfold cubeShift + apply Finset.sum_congr rfl + intro i _ + cases hi : ω i with + | false => simp only [Bool.false_eq_true, ite_false] + | true => simp only [ite_true]; exact h i hi + +theorem fullCube_input_independent {G : Type*} [AddCommGroup G] {d : ℕ} + (ω : Fin (d + 2) → Bool) (j : Fin (d + 2)) (hj : ω j = false) + (x y : Fin (d + 3) → G) + (hxy : ∀ k, k ≠ (1 : Fin (d + 3)).succAbove j → x k = y k) : + x 1 + cubeShift (fun k => x ((1 : Fin (d + 3)).succAbove k)) ω = + y 1 + cubeShift (fun k => y ((1 : Fin (d + 3)).succAbove k)) ω := by + rw [hxy 1 (Fin.ne_succAbove 1 j)] + congr 1 + apply cubeShift_congr_selected + intro k hk + apply hxy + intro heq + have hkj : k = j := Fin.succAbove_right_injective heq + subst k + simp only [hj, Bool.false_eq_true] at hk + +theorem mixedCubeInput_independent {d : ℕ} (ω : Fin d → Bool) (j : Fin d) (hj : ω j = false) + (x y : Fin (d + 2) → ℤ) (hxy : ∀ k, k ≠ j.succ.succ → x k = y k) : + mixedCubeInput ω x = mixedCubeInput ω y := by + have hzero : (0 : Fin (d + 2)) ≠ j.succ.succ := (Fin.succ_ne_zero j.succ).symm + have hone : (1 : Fin (d + 2)) ≠ j.succ.succ := by + intro heq + have h : (0 : Fin (d + 1)) = j.succ := Fin.succ_inj.mp heq + exact (Fin.succ_ne_zero j).symm h + unfold mixedCubeInput + rw [hxy 0 hzero, hxy 1 hone] + congr 2 + apply cubeShift_congr_selected + intro k hk + apply hxy + intro heq + have hkj : k = j := Fin.succ_inj.mp (Fin.succ_inj.mp heq) + subst k + simp only [hj, Bool.false_eq_true] at hk + +theorem mixedCubeInput_true {d : ℕ} (x : Fin (d + 2) → ℤ) : + mixedCubeInput (fun _ => true) x = correlationInput (x 0) (∑ j : Fin (d + 1), x j.succ) := by + unfold mixedCubeInput + rw [cubeShift_true] + exact congrArg (correlationInput (x 0)) (Fin.sum_univ_succ (fun j : Fin (d + 1) => x j.succ)).symm + +theorem fullCubeSignal_profile {d N : ℕ} [NeZero N] (f : ZMod N → ℂ) + (t : (Fin (d + 1) → ZMod N) × ZMod N) (n : ℤ) : + fullCubeSignal (fun z : ℤ => f (z : ZMod N)) (mixedDifferencePoint t n) = + cubeProduct f (t.2 :: List.ofFn t.1) (n : ZMod N) := by + have htuple : (fun j => ((mixedDifferencePoint t n ((1 : Fin (d + 3)).succAbove j) : ℤ) : ZMod N)) = + Fin.cons (t.1 0) (mixedDifferenceShifts t) := by + funext j + refine Fin.cases ?_ (fun j => ?_) j + · simp [mixedDifferencePoint] + · simp [Fin.one_succAbove_succ, mixedDifferencePoint] + have hbase : mixedDifferencePoint t n 1 = n := rfl + have hlist : List.ofFn t.1 = t.1 0 :: List.ofFn (Fin.tail t.1) := by + rw [List.ofFn_succ] + rfl + unfold fullCubeSignal + have hmap := cubeProduct_comp_addHom (Int.castAddHom (ZMod N)) f + (List.ofFn (fun j => mixedDifferencePoint t n ((1 : Fin (d + 3)).succAbove j))) + (mixedDifferencePoint t n 1) + simp only [Int.coe_castAddHom] at hmap + rw [hmap, List.map_ofFn] + change cubeProduct f + (List.ofFn (fun j => ((mixedDifferencePoint t n ((1 : Fin (d + 3)).succAbove j) : ℤ) : ZMod N))) + ((mixedDifferencePoint t n 1 : ℤ) : ZMod N) = _ + rw [htuple, hbase, List.ofFn_cons, mixedDifferenceShifts, List.ofFn_cons, hlist] + exact cubeProduct_swap_head f (t.1 0) t.2 _ _ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxFactorizationTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxFactorizationTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..90e780fc2ce6ca08932e58e93ddcbd6f246b9baf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxFactorizationTransport.lean @@ -0,0 +1,64 @@ +import OAI.Combinatorics.Progressions.Polynomial.CubicBoxPolynomial + +namespace OAI + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +noncomputable def NativeCubicBoxFactorization.mono {p p' q q' : ℝ} {N : ℕ} [NeZero N] + {V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p} + (R : NativeCubicBoxFactorization V N q) (hp : p ≤ p') (hq : q ≤ q') : + NativeCubicBoxFactorization (V.mono hp) N q' := by + letI := R.topology + letI := R.topologicalAdd + letI := R.continuousSMul + letI := R.hausdorff + letI : TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → (V.mono hp).L)) := R.topology + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → (V.mono hp).L)) := R.topologicalAdd + letI : ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → (V.mono hp).L)) := R.continuousSMul + letI : T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → (V.mono hp).L)) := R.hausdorff + have hfactor := NilpotentLieFiltration.ControlledSymbolFactorization.mono + (pi (fun _ : Fin 8 × Fin 4 => V.model)).filtration R.basis R.weight R.adapted R.factorization hq + (fun _ => by exact_mod_cast NeZero.pos N) + have hsymbol : + ((V.mono hp).cubicAntisymmetricBoxNiltest (R.nonnegative.trans hp) R.leftIndex R.rightIndex + (-(if R.branch then (N : ℤ) else 0))).symbol R.basis R.weight R.adapted = + (V.cubicAntisymmetricBoxNiltest R.nonnegative R.leftIndex R.rightIndex + (-(if R.branch then (N : ℤ) else 0))).symbol R.basis R.weight R.adapted := by + exact congrArg + ((pi (fun _ : Fin 8 × Fin 4 => V.model)).filtration.realPolynomialSymbolHom + R.basis R.weight R.adapted (fun _ : Fin 6 => 1)) + (V.cubicAntisymmetricBoxPolynomial_mono hp R.leftIndex R.rightIndex + (-(if R.branch then (N : ℤ) else 0))) + have htransport := (congrArg (fun symbol => + (pi (fun _ : Fin 8 × Fin 4 => V.model)).filtration.ControlledSymbolFactorization + R.basis R.weight R.adapted (piFrequency V.cubicAntisymmetricBoxFrequencies) + (fun _ : Fin 6 => (N : ℝ)) symbol q') hsymbol).mpr hfactor + exact { + leftIndex := R.leftIndex + rightIndex := R.rightIndex + branch := R.branch + nonnegative := R.nonnegative.trans hp + topology := R.topology + topologicalAdd := R.topologicalAdd + continuousSMul := R.continuousSMul + hausdorff := R.hausdorff + basis := R.basis + weight := R.weight + adapted := R.adapted + height := fun i j => (R.height i j).trans hq + factorization := htransport } + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxGlobalExpansion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxGlobalExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9e2a89a6cf4218201ee81815ecc77a7953feb9c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxGlobalExpansion.lean @@ -0,0 +1,421 @@ +import OAI.Combinatorics.Progressions.Estimates.CubicFrozenMiddleExpansion +import OAI.Combinatorics.Progressions.Estimates.NativeSixVariablePatchExpansion + +namespace OAI + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +namespace NativeMultidegreeNilcharacter + +variable {p : ℝ} (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + +theorem cubicAntisymmetricBoxFactors_normBound (i j : Fin V.outputDim × Fin V.outputDim) + (shift : ℤ) (a : Fin 8 × Fin 4) : + (V.cubicAntisymmetricBoxFactors i j shift a).normBound = 1 := by + rcases a with ⟨c, k⟩ + unfold cubicAntisymmetricBoxFactors + split_ifs <;> fin_cases k <;> rfl + +theorem cubicAntisymmetricBoxNiltest_norm + [TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + (hp : 0 ≤ p) (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) + (x : (pi (fun _ : Fin 8 × Fin 4 => V.model)).Space) : + ‖(V.cubicAntisymmetricBoxNiltest hp i j shift).observable x‖ ≤ 1 := by + change ‖∏ a, (V.cubicAntisymmetricBoxFactors i j shift a).observable + (productProjection (fun _ : Fin 8 × Fin 4 => V.model) a x)‖ ≤ 1 + rw [norm_prod] + apply Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) + intro a _ + simpa only [V.cubicAntisymmetricBoxFactors_normBound, NNReal.coe_one] using + (V.cubicAntisymmetricBoxFactors i j shift a).norm_le + (productProjection (fun _ : Fin 8 × Fin 4 => V.model) a x) + +end NativeMultidegreeNilcharacter + +theorem exists_cubic_frozen_middle_expansion_of_bounds : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q u : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + (hp : 0 ≤ p) {N : ℕ} [NeZero N] (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) + (R : NativePolynomialOrbitFactors (pi (fun _ : Fin 8 × Fin 4 => V.model)) + (V.cubicAntisymmetricBoxPolynomial i j shift) + (piFrequency V.cubicAntisymmetricBoxFrequencies) (fun _ : Fin 6 => (N : ℝ)) q), + 0 ≤ q → 0 ≤ u → ∀ m : ℕ, 0 < m → (m : ℝ) ≤ Real.exp u → + ∀ a r : (pi (fun _ : Fin 8 × Fin 4 => V.model)).RealGroup, + (∀ k, |((pi (fun _ : Fin 8 × Fin 4 => V.model)).basis.baseChange ℝ).repr a.coord k| ≤ Real.exp u) → + ((pi (fun _ : Fin 8 × Fin 4 => V.model)).basis.baseChange ℝ).equivFun r.coord ∈ realDenominatorGrid m → + Nonempty (NativeIntegerExpansion (fun _ : Fin 6 => 1) 2 ((p + q + u + C) ^ C) + (fun x => (V.cubicAntisymmetricBoxNiltest hp i j shift).observable + (QuotientGroup.mk (R.frozenMiddleValue a r x)))) := by + obtain ⟨c, _, hdesc⟩ := exists_native_frozen_middle_expansion 2 + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let T := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + 6 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((T + Polynomial.C c) ^ c) + refine ⟨C, hC, ?_⟩ + intro p q u V _ _ _ _ hp N _ i j shift R hq hu m hm hmb a r ha hrat + let v := p + q + u + let t := productNiltestBudget (v + 32) + v + 6 + have hv : 0 ≤ v := by dsimp only [v]; positivity + have hpv : p ≤ v := by dsimp only [v]; linarith only [hq, hu] + have hqv : q ≤ v := by dsimp only [v]; linarith only [hp, hu] + have huv : u ≤ v := le_add_of_nonneg_left (add_nonneg hp hq) + have hprod : 0 ≤ productNiltestBudget (v + 32) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hvt : v ≤ t := by dsimp only [t]; linarith only [hprod] + have ht : 0 ≤ t := hv.trans hvt + have hut : u ≤ t := huv.trans hvt + have htest : productNiltestBudget (p + 32) ≤ t := by + have hmono : productNiltestBudget (p + 32) ≤ productNiltestBudget (v + 32) := by + unfold productNiltestBudget productObservableLipBudget + gcongr + exact hmono.trans (by dsimp only [t]; linarith only [hv]) + let R' := R.mono (hqv.trans hvt) (fun _ => by exact_mod_cast NeZero.pos N) + let S := V.cubicAntisymmetricBoxNiltest hp i j shift + obtain ⟨E⟩ := hdesc (pi (fun _ : Fin 8 × Fin 4 => V.model)) R' S ht + ((V.cubicAntisymmetricBoxNiltest_complexity hp i j shift).mono htest) + (cubic_box_top_layer_invariant V i j shift R' hp) m hm + (hmb.trans (Real.exp_le_exp.mpr hut)) a r + (fun k => (ha k).trans (Real.exp_le_exp.mpr hut)) hrat + have hcost : (t + c) ^ c ≤ (p + q + u + C) ^ C := by + simpa [X, Q, T, t, v, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget v hv + exact ⟨E.mono hcost⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold NilpotentLieBCHGroup +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_cubic_box_outer_control : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + {N : ℕ} [NeZero N] (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) + (R : NativePolynomialOrbitFactors (pi (fun _ : Fin 8 × Fin 4 => V.model)) + (V.cubicAntisymmetricBoxPolynomial i j shift) + (piFrequency V.cubicAntisymmetricBoxFrequencies) (fun _ : Fin 6 => (N : ℝ)) q), + 0 ≤ q → R.HasOuterValueControl ((p + q + C) ^ C) ∧ + ∃ P : ℕ, 0 < P ∧ (P : ℝ) ≤ Real.exp ((p + q + C) ^ C) ∧ + (∀ x y : Fin 6 → ℤ, (∀ k, (P : ℤ) ∣ x k - y k) → + ((QuotientGroup.mk (R.rationalValue x) : + (pi (fun _ : Fin 8 × Fin 4 => V.model)).Space) = + QuotientGroup.mk (R.rationalValue y))) ∧ + (letI := rightMetricSpace + (hnil := (pi (fun _ : Fin 8 × Fin 4 => V.model)).filtration.realification.lowerCentralSeries_eq_bot) + ((pi (fun _ : Fin 8 × Fin 4 => V.model)).basis.baseChange ℝ) + ∀ (x y : Fin 6 → ℤ) (δ : ℝ), 0 ≤ δ → + (∀ k, |(x k : ℝ)| ≤ (N : ℝ)) → (∀ k, |(y k : ℝ)| ≤ (N : ℝ)) → + (∀ k, |(x k : ℝ) - (y k : ℝ)| ≤ (N : ℝ) * δ) → + dist (R.slowValue x) (R.slowValue y) ≤ Real.exp ((p + q + C) ^ C) * δ) := by + obtain ⟨a, _, houter⟩ := exists_native_orbit_outer_control (∑ _ : CubicReplicatedIndex, 1) 6 + obtain ⟨b, _, hlocal⟩ := exists_native_orbit_local_control (∑ _ : CubicReplicatedIndex, 1) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let T := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + 6 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((T + Polynomial.C a) ^ a + (T + Polynomial.C b) ^ b) + refine ⟨C, hC, ?_⟩ + intro p q V _ _ _ _ N _ i j shift R hq + have hp : 0 ≤ p := (Nat.cast_nonneg V.dim).trans V.complexity.1.1 + let v := p + q + let t := productNiltestBudget (v + 32) + v + 6 + have hv : 0 ≤ v := add_nonneg hp hq + have hpv : p ≤ v := le_add_of_nonneg_right hq + have hqv : q ≤ v := le_add_of_nonneg_left hp + have hprod : 0 ≤ productNiltestBudget (v + 32) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hvt : v ≤ t := by dsimp only [t]; linarith only [hprod] + have ht : 0 ≤ t := hv.trans hvt + have hqt : q ≤ t := hqv.trans hvt + have hcard : (Fintype.card (Fin 6) : ℝ) ≤ t := by + norm_num + dsimp only [t] + linarith only [hprod, hv] + have htest : productNiltestBudget (p + 32) ≤ t := by + have hmono : productNiltestBudget (p + 32) ≤ productNiltestBudget (v + 32) := by + unfold productNiltestBudget productObservableLipBudget + gcongr + exact hmono.trans (by dsimp only [t]; linarith only [hv]) + let D := pi (fun _ : Fin 8 × Fin 4 => V.model) + have hD : D.GeometryComplexityLE t := + (V.cubicAntisymmetricBoxNiltest_complexity hp i j shift).1.mono D htest + have hN : ∀ _k : Fin 6, (0 : ℝ) < N := fun _ => Nat.cast_pos.mpr (NeZero.pos N) + have hcost : (t + a) ^ a + (t + b) ^ b ≤ (p + q + C) ^ C := by + simpa [X, Q, T, t, v, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget v hv + have haC : (t + a) ^ a ≤ (p + q + C) ^ C := + (le_add_of_nonneg_right (by positivity)).trans hcost + have hbC : (t + b) ^ b ≤ (p + q + C) ^ C := + (le_add_of_nonneg_left (by positivity)).trans hcost + have hout : R.HasOuterValueControl ((t + a) ^ a) := + houter (R.mono hqt hN) ht hD hN (by simp) + refine ⟨R.hasOuterValueControl_mono hout haC, ?_⟩ + obtain ⟨P, hP, hPb, hcosets, hmotion⟩ := hlocal (R.mono hqt hN) ht hD hcard hN + refine ⟨P, hP, hPb.trans (Real.exp_le_exp.mpr hbC), fun x y hxy => (hcosets x y hxy).1, ?_⟩ + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + intro x y δ hδ hx hy hxy + exact (hmotion x y δ hδ hx hy hxy).trans + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hbC) hδ) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold NilpotentLieBCHGroup +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem cubic_box_frozen_error {p q : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + (hp : 0 ≤ p) {N : ℕ} (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) + (R : NativePolynomialOrbitFactors (pi (fun _ : Fin 8 × Fin 4 => V.model)) + (V.cubicAntisymmetricBoxPolynomial i j shift) + (piFrequency V.cubicAntisymmetricBoxFrequencies) (fun _ : Fin 6 => (N : ℝ)) q) + (x y : Fin 6 → ℤ) + (hcoset : (QuotientGroup.mk (R.rationalValue x) : + (pi (fun _ : Fin 8 × Fin 4 => V.model)).Space) = QuotientGroup.mk (R.rationalValue y)) : + letI := rightMetricSpace + (hnil := (pi (fun _ : Fin 8 × Fin 4 => V.model)).filtration.realification.lowerCentralSeries_eq_bot) + ((pi (fun _ : Fin 8 × Fin 4 => V.model)).basis.baseChange ℝ) + ‖V.cubicAntisymmetricBoxValue i j shift x - + (V.cubicAntisymmetricBoxNiltest hp i j shift).observable + (QuotientGroup.mk (R.frozenMiddleValue (R.slowValue y) (R.rationalValue y) x))‖ ≤ + Real.exp (productNiltestBudget (p + 32)) * dist (R.slowValue x) (R.slowValue y) := by + let D := pi (fun _ : Fin 8 × Fin 4 => V.model) + let S := V.cubicAntisymmetricBoxNiltest hp i j shift + let middle := D.filtration.adaptedPolynomialRealValueHom + (fun _ : Fin 6 => 1) (fun k => (x k : ℝ)) R.middle + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + have hright := D.observable_frozen_right_eq S.observable (R.slowValue x) middle + (R.rationalValue x) (R.rationalValue y) hcoset + have hchange := D.frozen_observable_change_left S.observable S.lipschitz + (R.slowValue x) (R.slowValue y) middle (R.rationalValue y) + rw [← hright] at hchange + have hlip : (S.lipBound : ℝ) ≤ Real.exp (productNiltestBudget (p + 32)) := by + have h := S.observable_budget (V.cubicAntisymmetricBoxNiltest_complexity hp i j shift) + linarith [S.normBound.coe_nonneg] + rw [cubic_box_eval_factors V i j shift R hp x] + exact hchange.trans (mul_le_mul_of_nonneg_right hlip dist_nonneg) + +theorem exists_cubic_box_local_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + {N : ℕ} [NeZero N] (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) + (_R : NativePolynomialOrbitFactors (pi (fun _ : Fin 8 × Fin 4 => V.model)) + (V.cubicAntisymmetricBoxPolynomial i j shift) + (piFrequency V.cubicAntisymmetricBoxFrequencies) (fun _ : Fin 6 => (N : ℝ)) q), + 0 ≤ q → ∃ P : ℕ, 0 < P ∧ (P : ℝ) ≤ Real.exp ((p + q + C) ^ C) ∧ + ∀ y : Fin 6 → ℤ, (∀ k, |(y k : ℝ)| ≤ (N : ℝ)) → + ∃ F : (Fin 6 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 6 => 1) 2 ((p + q + C) ^ C) F) ∧ + (∀ x, ‖F x‖ ≤ 1) ∧ + ∀ (x : Fin 6 → ℤ) (δ : ℝ), 0 ≤ δ → + (∀ k, |(x k : ℝ)| ≤ (N : ℝ)) → (∀ k, (P : ℤ) ∣ x k - y k) → + (∀ k, |(x k : ℝ) - (y k : ℝ)| ≤ (N : ℝ) * δ) → + ‖V.cubicAntisymmetricBoxValue i j shift x - F x‖ ≤ + Real.exp ((p + q + C) ^ C) * δ := by + obtain ⟨a, _, houter⟩ := exists_cubic_box_outer_control + obtain ⟨b, _, hfrozen⟩ := exists_cubic_frozen_middle_expansion_of_bounds + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let T := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + let U := (X + Polynomial.C a) ^ a + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (U + T + (X + U + Polynomial.C b) ^ b) + refine ⟨C, hC, ?_⟩ + intro p q V _ _ _ _ N _ i j shift R hq + have hp : 0 ≤ p := (Nat.cast_nonneg V.dim).trans V.complexity.1.1 + let v := p + q + let u := (v + a) ^ a + let t := productNiltestBudget (v + 32) + have hv : 0 ≤ v := add_nonneg hp hq + have hu : 0 ≤ u := by dsimp only [u]; positivity + have ht : 0 ≤ t := by unfold t productNiltestBudget productObservableLipBudget; positivity + have hsum : u + t + (v + u + b) ^ b ≤ (p + q + C) ^ C := by + simpa [X, Q, T, U, t, u, v, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget v hv + have hpow : 0 ≤ (v + u + b) ^ b := by positivity + have huC : u ≤ (p + q + C) ^ C := by linarith only [hsum, ht, hpow] + have herror : t + u ≤ (p + q + C) ^ C := by linarith only [hsum, hpow] + have hexpand : (v + u + b) ^ b ≤ (p + q + C) ^ C := by linarith only [hsum, hu, ht] + have htest : productNiltestBudget (p + 32) ≤ t := by + have hpv : p ≤ v := le_add_of_nonneg_right hq + unfold t productNiltestBudget productObservableLipBudget + gcongr + obtain ⟨⟨m, hm, hmb, hrat, hslow⟩, P, hP, hPb, hcosets, hmotion⟩ := houter V i j shift R hq + refine ⟨P, hP, hPb.trans (Real.exp_le_exp.mpr huC), ?_⟩ + intro y hy + let F := fun x => (V.cubicAntisymmetricBoxNiltest hp i j shift).observable + (QuotientGroup.mk (R.frozenMiddleValue (R.slowValue y) (R.rationalValue y) x)) + obtain ⟨E⟩ := hfrozen V hp i j shift R hq hu m hm hmb + (R.slowValue y) (R.rationalValue y) (hslow y hy) (hrat y) + refine ⟨F, ⟨E.mono hexpand⟩, fun x => V.cubicAntisymmetricBoxNiltest_norm hp i j shift _, ?_⟩ + intro x δ hδ hx hres hnear + let D := pi (fun _ : Fin 8 × Fin 4 => V.model) + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + have herr := cubic_box_frozen_error V hp i j shift R x y (hcosets x y hres) + have hdist := hmotion x y δ hδ hx hy hnear + apply herr.trans + calc + _ ≤ Real.exp t * (Real.exp u * δ) := + mul_le_mul (Real.exp_le_exp.mpr htest) hdist dist_nonneg (Real.exp_nonneg t) + _ = Real.exp (t + u) * δ := by rw [← mul_assoc, ← Real.exp_add] + _ ≤ _ := mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr herror) hδ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_cubic_box_global_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q r : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + {N : ℕ} [NeZero N] (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) + (_R : NativePolynomialOrbitFactors (pi (fun _ : Fin 8 × Fin 4 => V.model)) + (V.cubicAntisymmetricBoxPolynomial i j shift) + (piFrequency V.cubicAntisymmetricBoxFrequencies) (fun _ : Fin 6 => (N : ℝ)) q), + 0 ≤ q → 0 ≤ r → Real.exp ((p + q + r + C) ^ C) ≤ (N : ℝ) → + ∃ F : (Fin 6 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 6 => 1) 2 ((p + q + r + C) ^ C) F) ∧ + (∀ x : Fin 6 → ZMod N, ‖F (fun k => ((x k).val : ℤ))‖ ≤ 1) ∧ + (𝔼 x : Fin 6 → ZMod N, + ‖V.cubicAntisymmetricBoxValue i j shift (fun k => ((x k).val : ℤ)) - + F (fun k => ((x k).val : ℤ))‖) ≤ Real.exp (-r) := by + obtain ⟨A, _, hlocal⟩ := exists_cubic_box_local_expansion + obtain ⟨B, _, hpatch⟩ := exists_six_variable_patch_expansion 2 + let X : Polynomial ℕ := Polynomial.X + let U := (X + Polynomial.C A) ^ A + let T := U + X + 200 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((T + Polynomial.C B) ^ B + 2 * T) + refine ⟨C, hC, ?_⟩ + intro p q r V _ _ _ _ N _ i j shift R hq hr hN + have hp : 0 ≤ p := (Nat.cast_nonneg V.dim).trans V.complexity.1.1 + let w := p + q + r + let b := (w + A) ^ A + let t := b + w + 200 + have hw : 0 ≤ w := by dsimp only [w]; positivity + have hb : 0 ≤ b := by dsimp only [b]; positivity + have ht : 0 ≤ t := by dsimp only [t]; positivity + have hlocalt : (p + q + A) ^ A ≤ t := by + have hmono : (p + q + A) ^ A ≤ b := by + dsimp only [b] + apply pow_le_pow_left₀ (by positivity) + dsimp only [w] + linarith only [hr] + exact hmono.trans (by dsimp only [t]; linarith only [hw]) + have hsum : (t + B) ^ B + 2 * t ≤ (p + q + r + C) ^ C := by + simpa [X, U, T, b, w, t, Polynomial.eval₂_pow] using hbudget w hw + have hcost : (t + B) ^ B ≤ (p + q + r + C) ^ C := by linarith only [hsum, ht] + have hscale : 2 * t ≤ (p + q + r + C) ^ C := by + have hpow : 0 ≤ (t + B) ^ B := by positivity + linarith only [hsum, hpow] + let ρ := Real.exp (-(2 * t)) + have hρ : 0 < ρ := Real.exp_pos _ + have hprec : 1 / ρ ≤ Real.exp ((t + 2) ^ 2) := by + dsimp only [ρ] + rw [one_div, ← Real.exp_neg] + apply Real.exp_le_exp.mpr + nlinarith [sq_nonneg t] + obtain ⟨P, hP, hPb, hmodels⟩ := hlocal V i j shift R hq + let : NeZero P := ⟨hP.ne'⟩ + have hunit (x : Fin 6 → ℤ) : ‖V.cubicAntisymmetricBoxValue i j shift x‖ ≤ 1 := by + rw [← V.cubicAntisymmetricBoxNiltest_eval hp] + exact V.cubicAntisymmetricBoxNiltest_norm hp i j shift _ + obtain ⟨F, ⟨E⟩, hFnorm, herr⟩ := hpatch (s := 2) (N := N) (P := P) + (by norm_num) ht (hPb.trans (Real.exp_le_exp.mpr hlocalt)) hρ hprec + (V.cubicAntisymmetricBoxValue i j shift) hunit (by + intro y hy + obtain ⟨G, ⟨EG⟩, hGnorm, hGerror⟩ := hmodels y hy + refine ⟨G, ⟨EG.mono hlocalt⟩, hGnorm, ?_⟩ + intro x δ hδ hx hres hnear + exact (hGerror x δ hδ hx hres hnear).trans + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hlocalt) hδ)) + have hrecip : 1 / (N : ℝ) ≤ ρ := by + have hh := one_div_le_one_div_of_le (Real.exp_pos (2 * t)) + ((Real.exp_le_exp.mpr hscale).trans hN) + simpa only [ρ, one_div, Real.exp_neg] using hh + refine ⟨F, ⟨E.mono hcost⟩, hFnorm, herr.trans ?_⟩ + calc + _ ≤ Real.exp (t + 110) * (2 * ρ) := + mul_le_mul_of_nonneg_left (by linarith only [hrecip]) (Real.exp_nonneg _) + _ = 2 * Real.exp (110 - t) := by + dsimp only [ρ] + rw [← mul_assoc, mul_comm (Real.exp (t + 110)) 2, mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ 2 * (Real.exp (-r) / 2) := by + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply (Real.exp_le_exp.mpr (show 110 - t ≤ -r - 1 by + dsimp only [t, w] + linarith only [hb, hp, hq])).trans + exact exp_sub_one_le_half_exp (-r) + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxOrbitFactors.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxOrbitFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..7368c93341caaa10cf7e97164ea322684827d7f0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxOrbitFactors.lean @@ -0,0 +1,69 @@ +import OAI.Combinatorics.Progressions.Estimates.CubicFactoredModel + +namespace OAI + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_cubic_box_orbit_factors : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + {N : ℕ} [NeZero N] (F : NativeCubicBoxFactorization V N p), + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + Nonempty (NativePolynomialOrbitFactors (pi (fun _ : Fin 8 × Fin 4 => V.model)) + (V.cubicAntisymmetricBoxPolynomial F.leftIndex F.rightIndex (-(if F.branch then (N : ℤ) else 0))) + (piFrequency V.cubicAntisymmetricBoxFrequencies) (fun _ : Fin 6 => (N : ℝ)) ((p + C) ^ C)) := by + obtain ⟨a, _, horbit⟩ := exists_native_polynomial_orbit_factors (∑ _ : CubicReplicatedIndex, 1) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let R := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + 6 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (R + (R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro p V N _ F hN + have hp := F.nonnegative + let := F.topology + let := F.topologicalAdd + let := F.continuousSMul + let := F.hausdorff + let D := pi (fun _ : Fin 8 × Fin 4 => V.model) + let g := V.cubicAntisymmetricBoxPolynomial F.leftIndex F.rightIndex (-(if F.branch then (N : ℤ) else 0)) + let r := productNiltestBudget (p + 32) + p + 6 + have hprod : 0 ≤ productNiltestBudget (p + 32) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hpr : p ≤ r := by dsimp only [r]; linarith only [hprod] + have h6r : 6 ≤ r := by dsimp only [r]; linarith only [hprod, hp] + have hTr : productNiltestBudget (p + 32) ≤ r := by dsimp only [r]; linarith only [hp] + have hr : 0 ≤ r := hp.trans hpr + have hcost : r + (r + a) ^ a ≤ (p + C) ^ C := by + simpa [X, Q, R, r, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget p hp + have hfinal : (r + a) ^ a ≤ (p + C) ^ C := by linarith only [hcost, hr] + have hgeom : D.GeometryComplexityLE r := + (V.cubicAntisymmetricBoxNiltest_complexity hp F.leftIndex F.rightIndex + (-(if F.branch then (N : ℤ) else 0))).1.mono D hTr + have hfactor : D.filtration.ControlledSymbolFactorization F.basis F.weight F.adapted + (piFrequency V.cubicAntisymmetricBoxFrequencies) (fun _ : Fin 6 => (N : ℝ)) + (D.filtration.realPolynomialSymbolHom F.basis F.weight F.adapted (fun _ => 1) g) r := by + have h := F.factorization + rw [V.cubicAntisymmetricBoxNiltest_symbol] at h + exact NilpotentLieFiltration.ControlledSymbolFactorization.mono D.filtration + F.basis F.weight F.adapted h hpr (fun _ => by exact_mod_cast NeZero.pos N) + obtain ⟨U⟩ := horbit D F.basis F.weight F.adapted hr hgeom (by simpa using h6r) + (fun i j => (F.height i j).trans hpr) g (piFrequency V.cubicAntisymmetricBoxFrequencies) + (fun _ : Fin 6 => (N : ℝ)) (fun _ => (Real.exp_le_exp.mpr hfinal).trans hN) hfactor + exact ⟨U.mono hfinal (fun _ => by exact_mod_cast NeZero.pos N)⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxStepDrop.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxStepDrop.lean new file mode 100644 index 0000000000000000000000000000000000000000..7219ee242d38ac5355fac99d63a444f2bf26048a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CubicBoxStepDrop.lean @@ -0,0 +1,461 @@ +import OAI.Combinatorics.Progressions.Estimates.CubicAntisymmetricModel + +namespace OAI + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {p : ℝ} (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + +noncomputable def cubicBoxComponent (out : Fin V.outputDim) (h y k : Fin 6) (shift : ℤ) : + V.model.Niltest (fun _ : Fin 6 => 1) := + (V.component out).affinePullback + (fun j l => if l = (if j.1 = 0 then h else if j.2.val = 0 then y else k) then 1 else 0) + (fun j => if j.1 = 0 then 0 else if j.2.val = 0 then 0 else shift) + +theorem cubicBoxComponent_eval (out : Fin V.outputDim) (h y k : Fin 6) (shift : ℤ) (n : Fin 6 → ℤ) : + (V.cubicBoxComponent out h y k shift).eval n = + V.eval out (cubicTrilinearInput (n h) (n y) (n k + shift)) := by + rw [cubicBoxComponent, Niltest.eval_affinePullback, component_eval] + apply congrArg (V.eval out) + funext j + rcases j with ⟨j, a⟩ + fin_cases j <;> fin_cases a <;> + simp [integerAffineMap, cubicTrilinearInput, ite_mul, add_comm] + +theorem cubicBoxComponent_vertical (out : Fin V.outputDim) (h y k : Fin 6) (shift : ℤ) + (z : V.model.RealGroup) + (hz : z ∈ V.model.filtration.realification.subgroup (∑ _ : CubicReplicatedIndex, 1)) + (x : V.model.Space) : + (V.cubicBoxComponent out h y k shift).observable (z • x) = + CircleFourier.character + ((realifyFunctional V.vertical.frequency z.coord : ℝ) : CircleFourier.Circle) * + (V.cubicBoxComponent out h y k shift).observable x := by + exact V.vertical.vertical out z (by rwa [V.multi.realSubgroup_top]) x + +noncomputable def cubicKernelFactors (i j : Fin V.outputDim × Fin V.outputDim) + (h y k : Fin 6) (shift : ℤ) : Fin 4 → V.model.Niltest (fun _ : Fin 6 => 1) := + ![(V.cubicBoxComponent i.1 h y k shift).conjugate, V.cubicBoxComponent j.1 y h k shift, + (V.cubicBoxComponent i.2 h y k shift).conjugate, V.cubicBoxComponent j.2 y h k shift] + +noncomputable def cubicKernelFrequencies : Fin 4 → (V.L →ₗ[ℚ] ℚ) := + ![-V.vertical.frequency, V.vertical.frequency, -V.vertical.frequency, V.vertical.frequency] + +theorem cubicKernelFactors_complexity (i j : Fin V.outputDim × Fin V.outputDim) + (h y k : Fin 6) (shift : ℤ) (a : Fin 4) : + (V.cubicKernelFactors i j h y k shift a).ComplexityLE (p + 32) := by + have hi₁ := (V.component_complexity i.1).mono (by linarith : p + 4 ≤ p + 32) + have hj₁ := (V.component_complexity j.1).mono (by linarith : p + 4 ≤ p + 32) + have hi₂ := (V.component_complexity i.2).mono (by linarith : p + 4 ≤ p + 32) + have hj₂ := (V.component_complexity j.2).mono (by linarith : p + 4 ≤ p + 32) + fin_cases a + · exact hi₁ + · exact hj₁ + · exact hi₂ + · exact hj₂ + +theorem cubicKernelFactors_eval (i j : Fin V.outputDim × Fin V.outputDim) + (h y k : Fin 6) (shift : ℤ) (n : Fin 6 → ℤ) : + (∏ a, (V.cubicKernelFactors i j h y k shift a).eval n) = + V.cubicAntisymmetricPair i j (n h) (n y) (n k + shift) := by + simp [cubicKernelFactors, Fin.prod_univ_succ, cubicBoxComponent_eval, + cubicAntisymmetricPair, mul_assoc] + +theorem cubicKernelFactors_vertical (i j : Fin V.outputDim × Fin V.outputDim) + (h y k : Fin 6) (shift : ℤ) (a : Fin 4) (z : V.model.RealGroup) + (hz : z ∈ V.model.filtration.realification.subgroup (∑ _ : CubicReplicatedIndex, 1)) + (x : V.model.Space) : + (V.cubicKernelFactors i j h y k shift a).observable (z • x) = + CircleFourier.character + ((realifyFunctional (V.cubicKernelFrequencies a) z.coord : ℝ) : CircleFourier.Circle) * + (V.cubicKernelFactors i j h y k shift a).observable x := by + fin_cases a + · exact Niltest.conjugate_vertical _ _ (V.cubicBoxComponent_vertical i.1 h y k shift) z hz x + · exact V.cubicBoxComponent_vertical j.1 y h k shift z hz x + · exact Niltest.conjugate_vertical _ _ (V.cubicBoxComponent_vertical i.2 h y k shift) z hz x + · exact V.cubicBoxComponent_vertical j.2 y h k shift z hz x + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +def cubicBoxCorner : Fin 8 → Fin 3 → Fin 6 := + ![![2, 4, 0], ![2, 4, 1], ![3, 4, 0], ![3, 4, 1], + ![2, 5, 0], ![2, 5, 1], ![3, 5, 0], ![3, 5, 1]] + +def cubicBoxConjugated : Fin 8 → Bool := + ![false, true, true, false, true, false, false, true] + +variable {p : ℝ} (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + +noncomputable def cubicAntisymmetricBoxValue (i j : Fin V.outputDim × Fin V.outputDim) + (shift : ℤ) (n : Fin 6 → ℤ) : ℂ := + let F := fun k h y => V.cubicAntisymmetricPair i j h y (k + shift) + let G := fun h y => F (n 0) h y * star (F (n 1) h y) + G (n 2) (n 4) * star (G (n 3) (n 4)) * star (G (n 2) (n 5)) * G (n 3) (n 5) + +noncomputable def cubicAntisymmetricBoxFactors (i j : Fin V.outputDim × Fin V.outputDim) + (shift : ℤ) (a : Fin 8 × Fin 4) : V.model.Niltest (fun _ : Fin 6 => 1) := + let T := V.cubicKernelFactors i j (cubicBoxCorner a.1 0) (cubicBoxCorner a.1 1) + (cubicBoxCorner a.1 2) shift a.2 + if cubicBoxConjugated a.1 then T.conjugate else T + +noncomputable def cubicAntisymmetricBoxFrequencies (a : Fin 8 × Fin 4) : V.L →ₗ[ℚ] ℚ := + if cubicBoxConjugated a.1 then -V.cubicKernelFrequencies a.2 else V.cubicKernelFrequencies a.2 + +theorem cubicAntisymmetricBoxFactors_complexity (i j : Fin V.outputDim × Fin V.outputDim) + (shift : ℤ) (a : Fin 8 × Fin 4) : + (V.cubicAntisymmetricBoxFactors i j shift a).ComplexityLE (p + 32) := by + unfold cubicAntisymmetricBoxFactors + split <;> exact V.cubicKernelFactors_complexity i j _ _ _ shift a.2 + +theorem cubicAntisymmetricBoxFactors_eval (i j : Fin V.outputDim × Fin V.outputDim) + (shift : ℤ) (n : Fin 6 → ℤ) : + (∏ a, (V.cubicAntisymmetricBoxFactors i j shift a).eval n) = + V.cubicAntisymmetricBoxValue i j shift n := by + have hrow (c : Fin 8) : (∏ a : Fin 4, (V.cubicAntisymmetricBoxFactors i j shift (c, a)).eval n) = + if cubicBoxConjugated c then + star (V.cubicAntisymmetricPair i j (n (cubicBoxCorner c 0)) (n (cubicBoxCorner c 1)) + (n (cubicBoxCorner c 2) + shift)) else + V.cubicAntisymmetricPair i j (n (cubicBoxCorner c 0)) (n (cubicBoxCorner c 1)) + (n (cubicBoxCorner c 2) + shift) := by + cases hsign : cubicBoxConjugated c with + | false => + simpa only [cubicAntisymmetricBoxFactors, hsign, Bool.false_eq_true, ite_false] using + V.cubicKernelFactors_eval i j (cubicBoxCorner c 0) (cubicBoxCorner c 1) + (cubicBoxCorner c 2) shift n + | true => + simpa only [cubicAntisymmetricBoxFactors, hsign, ite_true, Niltest.eval_conjugate, + star_prod] using congrArg star + (V.cubicKernelFactors_eval i j (cubicBoxCorner c 0) (cubicBoxCorner c 1) + (cubicBoxCorner c 2) shift n) + rw [Fintype.prod_prod_type] + simp_rw [hrow] + simp [Fin.prod_univ_succ, cubicBoxCorner, cubicBoxConjugated, + cubicAntisymmetricBoxValue, star_mul, mul_comm, mul_left_comm] + +theorem cubicAntisymmetricBoxFactors_vertical (i j : Fin V.outputDim × Fin V.outputDim) + (shift : ℤ) (a : Fin 8 × Fin 4) (z : V.model.RealGroup) + (hz : z ∈ V.model.filtration.realification.subgroup (∑ _ : CubicReplicatedIndex, 1)) + (x : V.model.Space) : + (V.cubicAntisymmetricBoxFactors i j shift a).observable (z • x) = + CircleFourier.character + ((realifyFunctional (V.cubicAntisymmetricBoxFrequencies a) z.coord : ℝ) : CircleFourier.Circle) * + (V.cubicAntisymmetricBoxFactors i j shift a).observable x := by + unfold cubicAntisymmetricBoxFactors cubicAntisymmetricBoxFrequencies + split_ifs + · exact Niltest.conjugate_vertical _ _ (V.cubicKernelFactors_vertical i j _ _ _ shift a.2) z hz x + · exact V.cubicKernelFactors_vertical i j _ _ _ shift a.2 z hz x + +variable [TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + +noncomputable def cubicAntisymmetricBoxNiltest (hp : 0 ≤ p) + (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) : + (pi (fun _ : Fin 8 × Fin 4 => V.model)).Niltest (fun _ : Fin 6 => 1) := + piNiltest (fun _ : Fin 8 × Fin 4 => V.model) (V.cubicAntisymmetricBoxFactors i j shift) + (by linarith) (by simpa using (show (32 : ℝ) ≤ p + 32 by linarith)) + (V.cubicAntisymmetricBoxFactors_complexity i j shift) + +theorem cubicAntisymmetricBoxNiltest_complexity (hp : 0 ≤ p) + (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) : + (V.cubicAntisymmetricBoxNiltest hp i j shift).ComplexityLE (productNiltestBudget (p + 32)) := + piNiltest_complexity (fun _ : Fin 8 × Fin 4 => V.model) (V.cubicAntisymmetricBoxFactors i j shift) + (by linarith) (by simpa using (show (32 : ℝ) ≤ p + 32 by linarith)) + (V.cubicAntisymmetricBoxFactors_complexity i j shift) + +theorem cubicAntisymmetricBoxNiltest_eval (hp : 0 ≤ p) + (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) (n : Fin 6 → ℤ) : + (V.cubicAntisymmetricBoxNiltest hp i j shift).eval n = V.cubicAntisymmetricBoxValue i j shift n := by + rw [cubicAntisymmetricBoxNiltest, piNiltest_eval] + exact V.cubicAntisymmetricBoxFactors_eval i j shift n + +theorem cubicAntisymmetricBoxNiltest_vertical (hp : 0 ≤ p) + (i j : Fin V.outputDim × Fin V.outputDim) (shift : ℤ) + (z : (pi (fun _ : Fin 8 × Fin 4 => V.model)).RealGroup) + (hz : z ∈ (pi (fun _ : Fin 8 × Fin 4 => V.model)).filtration.realification.subgroup + (∑ _ : CubicReplicatedIndex, 1)) + (x : (pi (fun _ : Fin 8 × Fin 4 => V.model)).Space) : + (V.cubicAntisymmetricBoxNiltest hp i j shift).observable (z • x) = + CircleFourier.character + ((realifyFunctional (piFrequency V.cubicAntisymmetricBoxFrequencies) z.coord : ℝ) : + CircleFourier.Circle) * (V.cubicAntisymmetricBoxNiltest hp i j shift).observable x := + piNiltest_vertical (fun _ : Fin 8 × Fin 4 => V.model) (V.cubicAntisymmetricBoxFactors i j shift) + V.cubicAntisymmetricBoxFrequencies (by linarith) + (by simpa using (show (32 : ℝ) ≤ p + 32 by linarith)) + (V.cubicAntisymmetricBoxFactors_complexity i j shift) + (V.cubicAntisymmetricBoxFactors_vertical i j shift) z hz x + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_cubic_antisymmetric_box : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 4 f → + ∃ H : Finset (ZMod N), H.Nonempty ∧ Real.exp (-((p + C) ^ C)) * N ≤ (H.card : ℝ) ∧ + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 2) ((p + C) ^ C), + ∃ V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) ((p + C) ^ C), + V.dim ≤ 8 * M.dim ∧ + (∀ (e : ReplicatedPermutation (mixedCorrelationDegree 2)) k x, + V.eval k (fun j => x ((replicatedPermutation (mixedCorrelationDegree 2) e).symm j)) = + V.eval k x) ∧ + NativeIntegerVectorEquivalence 2 ((p + C) ^ C) + M.eval (fun k x => V.eval k (fun j => x j.1)) ∧ + NativeIntegerVectorEquivalence 2 ((p + C) ^ C) + M.cubicMixedDerivative V.cubicTrilinearTriple ∧ + ∃ i : Fin M.outputDim, ∃ χ : ZMod N → AddChar (ZMod N) ℂ, + (∀ h ∈ H, Real.exp (-((p + C) ^ C)) ≤ ‖finiteFourierCoeff + (fun n => multiplicativeDerivative f h n * star (M.evalCyclic N i (correlationInput h n))) (χ h)‖) ∧ + ∃ (branch : Bool) (i' j' : Fin V.outputDim × Fin V.outputDim), + Real.exp (-((p + C) ^ C)) ≤ + (finiteTripleBoxCorrelation (fun k h y : ZMod N => + V.cubicAntisymmetricPair i' j' h.val y.val (cyclicBranchOffset k branch))).re := by + obtain ⟨a, _, hanti⟩ := exists_cubic_antisymmetric_model + let Q : Polynomial ℕ := (Polynomial.X + Polynomial.C a) ^ a + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (8 * Q + 2) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hGowers + let q := (p + a) ^ a + have hq : 0 ≤ q := by dsimp only [q]; positivity + have hsum : 8 * q + 2 ≤ (p + C) ^ C := by + simpa [Q, q, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := by linarith only [hq, hsum] + have hcost : 8 * q ≤ (p + C) ^ C := by linarith only [hsum] + obtain ⟨H, hH, hHdense, M, V, hdim, hsymm, hdiag, E, i, χ, hcorr, + branch, i', j', A, B, D, hA, hB, hD, hanti⟩ := + hanti hp ((Real.exp_le_exp.mpr hqC).trans hN) f hf hGowers + let F (k h y : ZMod N) := V.cubicAntisymmetricPair i' j' h.val y.val (cyclicBranchOffset k branch) + have heq (k h y : ZMod N) : + F k h y * A h.val (cyclicBranchOffset k branch) * D h.val y.val * B y.val (cyclicBranchOffset k branch) = + F k h y * A h.val (cyclicBranchOffset k branch) * B y.val (cyclicBranchOffset k branch) * D h.val y.val := by + ring + have hbox := norm_pairwise_weighted_mean_pow_eight_le_box F + (fun k h => A h.val (cyclicBranchOffset k branch)) (fun h y => D h.val y.val) + (fun k y => B y.val (cyclicBranchOffset k branch)) + (fun k h => hA _ _) (fun h y => hD _ _) (fun k y => hB _ _) + simp only [heq] at hbox + have hbound := (pow_le_pow_left₀ (Real.exp_nonneg (-q)) hanti 8).trans hbox + have hpower : Real.exp (-q) ^ 8 = Real.exp (-(8 * q)) := by + rw [← Real.exp_nat_mul] + congr 1 + norm_num + rw [hpower] at hbound + have heval : (fun k h y : ZMod N => (V.mono hqC).cubicAntisymmetricPair i' j' + h.val y.val (cyclicBranchOffset k branch)) = F := by + funext k h y + simp only [F, NativeMultidegreeNilcharacter.cubicAntisymmetricPair, + NativeMultidegreeNilcharacter.mono_eval] + refine ⟨H, hH, ?_, M.mono hqC, V.mono hqC, ?_, hsymm, hdiag.mono hqC, + E.mono hqC, i, χ, ?_, branch, i', j', ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hqC)) + (Nat.cast_nonneg _)).trans hHdense + · change V.dim ≤ 8 * M.dim + exact hdim + · intro h hh + exact (Real.exp_le_exp.mpr (neg_le_neg hqC)).trans (hcorr h hh) + · rw [heval] + exact (Real.exp_le_exp.mpr (neg_le_neg hcost)).trans hbound + +end Erdos3 + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {p : ℝ} (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + +theorem cubicAntisymmetricBoxValue_mean (N : ℕ) [NeZero N] (branch : Bool) + (i j : Fin V.outputDim × Fin V.outputDim) : + (𝔼 n ∈ integerBox (fun _ : Fin 6 => N), + V.cubicAntisymmetricBoxValue i j (-(if branch then (N : ℤ) else 0)) n) = + finiteTripleBoxCorrelation (fun k h y : ZMod N => + V.cubicAntisymmetricPair i j h.val y.val (cyclicBranchOffset k branch)) := by + rw [integerBox_expect_eq_zmod] + simp_rw [expect_fin_cons] + unfold finiteTripleBoxCorrelation finiteBoxCorrelation + apply Finset.expect_congr rfl + intro k _ + apply Finset.expect_congr rfl + intro k' _ + apply Finset.expect_congr rfl + intro h _ + apply Finset.expect_congr rfl + intro h' _ + apply Finset.expect_congr rfl + intro y _ + apply Finset.expect_congr rfl + intro y' _ + change (𝔼 _ : Fin 0 → ZMod N, + V.cubicAntisymmetricBoxValue i j (-(if branch then (N : ℤ) else 0)) + ![(k.val : ℤ), (k'.val : ℤ), (h.val : ℤ), (h'.val : ℤ), (y.val : ℤ), (y'.val : ℤ)]) = _ + rw [Fintype.expect_const] + simp only [cubicAntisymmetricBoxValue, cyclicBranchOffset, sub_eq_add_neg, + show (5 : Fin 6) = (4 : Fin 5).succ by rfl, Matrix.cons_val_succ, + Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, + Matrix.cons_val_three, Matrix.cons_val_four, Matrix.head_cons, Matrix.tail_cons] + +variable [TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + +theorem cubicAntisymmetricBoxNiltest_mean (hp : 0 ≤ p) (N : ℕ) [NeZero N] (branch : Bool) + (i j : Fin V.outputDim × Fin V.outputDim) : + (𝔼 n ∈ integerBox (fun _ : Fin 6 => N), + (V.cubicAntisymmetricBoxNiltest hp i j (-(if branch then (N : ℤ) else 0))).eval n) = + finiteTripleBoxCorrelation (fun k h y : ZMod N => + V.cubicAntisymmetricPair i j h.val y.val (cyclicBranchOffset k branch)) := by + simp_rw [V.cubicAntisymmetricBoxNiltest_eval hp] + exact V.cubicAntisymmetricBoxValue_mean N branch i j + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +structure NativeCubicBoxFactorization {p : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) (N : ℕ) (q : ℝ) where + leftIndex : Fin V.outputDim × Fin V.outputDim + rightIndex : Fin V.outputDim × Fin V.outputDim + branch : Bool + nonnegative : 0 ≤ p + [topology : TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [topologicalAdd : IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [continuousSMul : ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + [hausdorff : T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L))] + basis : Basis (Fin (finrank ℚ ((Fin 8 × Fin 4) → V.L))) ℚ ((Fin 8 × Fin 4) → V.L) + weight : Fin (finrank ℚ ((Fin 8 × Fin 4) → V.L)) → ℕ + adapted : ∀ k, (pi (fun _ : Fin 8 × Fin 4 => V.model)).filtration.layer k = + Submodule.span ℚ (basis '' {i | k ≤ weight i}) + height : ∀ i j, rationalLogHeight + ((pi (fun _ : Fin 8 × Fin 4 => V.model)).basis.repr (basis i) j) ≤ q + factorization : (pi (fun _ : Fin 8 × Fin 4 => V.model)).filtration.ControlledSymbolFactorization + basis weight adapted (piFrequency V.cubicAntisymmetricBoxFrequencies) (fun _ : Fin 6 => (N : ℝ)) + ((V.cubicAntisymmetricBoxNiltest nonnegative leftIndex rightIndex + (-(if branch then (N : ℤ) else 0))).symbol basis weight adapted) q + +theorem exists_cubic_box_step_drop_indices : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ}, 0 ≤ p → + ∀ (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + {N : ℕ} [NeZero N] (branch : Bool) (i j : Fin V.outputDim × Fin V.outputDim), + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + Real.exp (-p) ≤ (finiteTripleBoxCorrelation (fun k h y : ZMod N => + V.cubicAntisymmetricPair i j h.val y.val (cyclicBranchOffset k branch))).re → + ∃ R : NativeCubicBoxFactorization V N ((p + C) ^ C), + R.leftIndex = i ∧ R.rightIndex = j ∧ R.branch = branch := by + have hdegree : (∑ _ : CubicReplicatedIndex, (1 : ℕ)) = 3 := by + have hc : Fintype.card CubicReplicatedIndex = 3 := by + calc + _ = ∑ i : Fin 2, mixedCorrelationDegree 2 i := replicatedIndex_card _ + _ = 3 := by rw [Fin.sum_univ_two]; rfl + simpa using hc + obtain ⟨a, _, hstep⟩ := exists_intrinsic_step_drop (∑ _ : CubicReplicatedIndex, 1) (by omega) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let R := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + 6 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (R + 1 + (R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro p hp V N _ branch i j hN hbox + let r := productNiltestBudget (p + 32) + p + 6 + have hprod : 0 ≤ productNiltestBudget (p + 32) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hpr : p ≤ r := by dsimp only [r]; linarith only [hprod] + have h6r : 6 ≤ r := by dsimp only [r]; linarith only [hprod, hp] + have hTr : productNiltestBudget (p + 32) ≤ r := by dsimp only [r]; linarith only [hp] + have hr : 0 ≤ r := hp.trans hpr + have hcost : r + 1 + (r + a) ^ a ≤ (p + C) ^ C := by + simpa [X, Q, R, r, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget p hp + have hpow : 0 ≤ (r + a) ^ a := by positivity + have hheight : r + 1 ≤ (p + C) ^ C := by linarith only [hcost, hpow] + have hfactor : (r + a) ^ a ≤ (p + C) ^ C := by linarith only [hcost, hr] + obtain ⟨τ, htA, htM, htT⟩ := exists_real_module_topology + (productFinBasis (fun _ : Fin 8 × Fin 4 => V.model)) + let : TopologicalSpace (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L)) := τ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L)) := htA + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L)) := htM + let : T2Space (ℝ ⊗[ℚ] ((Fin 8 × Fin 4) → V.L)) := htT + let D := pi (fun _ : Fin 8 × Fin 4 => V.model) + let T := V.cubicAntisymmetricBoxNiltest hp i j (-(if branch then (N : ℤ) else 0)) + obtain ⟨e, ω, hF, he, hconstruct⟩ := hstep D hr T + ((V.cubicAntisymmetricBoxNiltest_complexity hp i j _).mono hTr) + have hbias : Real.exp (-r) ≤ ‖𝔼 n ∈ translatedIntegerBox 0 (fun _ : Fin 6 => N), T.eval n‖ := by + have hzero : translatedIntegerBox 0 (fun _ : Fin 6 => N) = integerBox (fun _ : Fin 6 => N) := by + ext n + simp only [mem_translatedIntegerBox, mem_integerBox, Pi.zero_apply, zero_add] + rw [hzero, show T = V.cubicAntisymmetricBoxNiltest hp i j (-(if branch then (N : ℤ) else 0)) from rfl, + V.cubicAntisymmetricBoxNiltest_mean] + exact (Real.exp_le_exp.mpr (neg_le_neg hpr)).trans (hbox.trans (Complex.re_le_norm _)) + have hf := hconstruct (piFrequency V.cubicAntisymmetricBoxFrequencies) + (V.cubicAntisymmetricBoxNiltest_vertical hp i j _) 0 (fun _ : Fin 6 => N) + (fun _ => NeZero.pos N) (by simpa using h6r) + (fun _ => (Real.exp_le_exp.mpr hfactor).trans hN) hbias + exact ⟨{ + leftIndex := i + rightIndex := j + branch := branch + nonnegative := hp + topology := τ + topologicalAdd := htA + continuousSMul := htM + hausdorff := htT + basis := e + weight := ω + adapted := hF + height := fun i j => (he i j).trans hheight + factorization := NilpotentLieFiltration.ControlledSymbolFactorization.mono + D.filtration e ω hF hf hfactor (fun _ => by exact_mod_cast NeZero.pos N) }, rfl, rfl, rfl⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CubicCoordinateSlices.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CubicCoordinateSlices.lean new file mode 100644 index 0000000000000000000000000000000000000000..642d07588f3fb9ed30005cb0063dbb78d5c08db8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CubicCoordinateSlices.lean @@ -0,0 +1,156 @@ +import OAI.Combinatorics.Progressions.Estimates.CubicAntisymmetricTransfer + +namespace OAI + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open Module +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_cubic_frozen_affine_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + (d : CubicReplicatedIndex) (A : CubicReplicatedIndex → Fin 3 → ℤ) + (b : CubicReplicatedIndex → ℤ) (out : Fin V.outputDim), + (∀ k, A d k = 0) → + Nonempty (NativeIntegerExpansion (fun _ : Fin 3 => 1) 2 ((p + C) ^ C) + (fun x => V.eval out (integerAffineMap A b x))) := by + obtain ⟨C, hC, hfreeze⟩ := exists_freezing_niltest (fun _ : CubicReplicatedIndex => 1) + refine ⟨C, hC, ?_⟩ + intro p V d A b out hA + classical + let S : Finset CubicReplicatedIndex := Finset.univ.erase d + have hcard : Fintype.card CubicReplicatedIndex = 3 := by + calc + _ = ∑ j : Fin 2, mixedCorrelationDegree 2 j := replicatedIndex_card _ + _ = 3 := by rw [Fin.sum_univ_two]; rfl + have hdegree : (∑ j ∈ S, (1 : ℕ)) = 2 := by simp [S, hcard] + obtain ⟨t, n, ht, _hn, D, hD⟩ := hfreeze V S b out + have ht2 : t = 2 := ht.trans hdegree + rcases ht2 with rfl + let K := V.multi.filtration.weightedSubalgebra (retainedCoordinateWeight S) + let := moduleTopology ℝ (ℝ ⊗[ℚ] K) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] K) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] K) := realification_moduleTopology_t2 D.basis + obtain ⟨T, _hTnorm, hT, _hzero, heval⟩ := hD + let U := T.affinePullback (fun j k => A j.val k) (fun j => b j.val) + have hU : U.ComplexityLE ((p + C) ^ C) := hT + have hvalue (x : Fin 3 → ℤ) : U.eval x = V.eval out (integerAffineMap A b x) := by + rw [RationalFilteredNilmanifold.Niltest.eval_affinePullback, heval] + apply congrArg (V.eval out) + funext j + by_cases hj : j ∈ S + · simp [freezeCoordinates, hj, integerAffineMap] + · have hjd : j = d := by simpa [S] using hj + subst j + simp [freezeCoordinates, hj, integerAffineMap, hA] + let E : NativeIntegerExpansion (fun _ : Fin 3 => 1) 2 ((p + C) ^ C) U.eval := + NativeIntegerExpansion.ofTest U hU (fun _ => rfl) + have heq : U.eval = (fun x => V.eval out (integerAffineMap A b x)) := funext hvalue + exact ⟨heq ▸ E⟩ + +theorem exists_cubic_scalar_coordinate_slice : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + (out : Fin V.outputDim) (d : Fin 3) (c shift : ℤ), + Nonempty (NativeIntegerExpansion (fun _ : Fin 3 => 1) 2 ((p + C) ^ C) + (fun x => let z := Function.update x d c + V.eval out (cubicTrilinearInput (z 1) (z 2) (z 0 + shift)))) := by + obtain ⟨C, hC, hfreeze⟩ := exists_cubic_frozen_affine_expansion + refine ⟨C, hC, ?_⟩ + intro p V out d c shift + let coord : CubicReplicatedIndex → Fin 3 := fun j => + if j.1 = 0 then 1 else if j.2.val = 0 then 2 else 0 + let index : Fin 3 → CubicReplicatedIndex := + ![cubicRightReplica, ⟨0, ⟨0, by decide⟩⟩, cubicLeftReplica] + have hindex (k : Fin 3) : coord (index k) = k := by fin_cases k <;> rfl + let A : CubicReplicatedIndex → Fin 3 → ℤ := fun j k => + if coord j = d then 0 else if k = coord j then 1 else 0 + let b : CubicReplicatedIndex → ℤ := fun j => + (if coord j = d then c else 0) + (if coord j = 0 then shift else 0) + obtain ⟨E⟩ := hfreeze V (index d) A b out (by intro k; simp [A, hindex]) + have hmap (x : Fin 3 → ℤ) (j : CubicReplicatedIndex) : + integerAffineMap A b x j = (Function.update x d c) (coord j) + + (if coord j = 0 then shift else 0) := by + by_cases hj : coord j = d + · simp [integerAffineMap, A, b, hj] + · simp [integerAffineMap, A, b, hj, ite_mul] + abel + have heq (x : Fin 3 → ℤ) : integerAffineMap A b x = + cubicTrilinearInput ((Function.update x d c) 1) ((Function.update x d c) 2) + ((Function.update x d c) 0 + shift) := by + funext j + rw [hmap] + by_cases hj : j.1 = 0 + · simp [coord, cubicTrilinearInput, hj] + · by_cases hk : j.2.val = 0 <;> simp [coord, cubicTrilinearInput, hj, hk] + exact ⟨by simpa only [heq] using E⟩ + +theorem exists_cubic_kernel_coordinate_slice : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + (i j : Fin V.outputDim × Fin V.outputDim) (d : Fin 3) (c shift : ℤ), + Nonempty (NativeIntegerExpansion (fun _ : Fin 3 => 1) 2 ((p + C) ^ C) + (fun x => let z := Function.update x d c + V.cubicAntisymmetricPair i j (z 1) (z 2) (z 0 + shift))) := by + obtain ⟨A, _, hscalar⟩ := exists_cubic_scalar_coordinate_slice + obtain ⟨B, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let Q := (X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (((Q + Polynomial.C B) ^ B + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p V i j d c shift + have hp : 0 ≤ p := (Nat.cast_nonneg V.dim).trans V.complexity.1.1 + let q := (p + A) ^ A + have hq : 0 ≤ q := by dsimp only [q]; positivity + let e : Fin 3 → Fin 3 := ![0, 2, 1] + have he0 : e 0 = 0 := rfl + have he1 : e 1 = 2 := rfl + have he2 : e 2 = 1 := rfl + have hswap (x : Fin 3 → ℤ) : Function.update (fun k => x (e k)) (e d) c = + fun k => (Function.update x d c) (e k) := by + funext k + fin_cases d <;> fin_cases k <;> rfl + have hright (out : Fin V.outputDim) : + Nonempty (NativeIntegerExpansion (fun _ : Fin 3 => 1) 2 q + (fun x => let z := Function.update x d c + V.eval out (cubicTrilinearInput (z 2) (z 1) (z 0 + shift)))) := by + obtain ⟨E⟩ := hscalar V out (e d) c shift + have E' : NativeIntegerExpansion (fun _ : Fin 3 => 1) 2 q + (fun x => let z := Function.update (fun k => x (e k)) (e d) c + V.eval out (cubicTrilinearInput (z 1) (z 2) (z 0 + shift))) := + E.linearPullbackHom (fun k => ⟨⟨fun x => x (e k), rfl⟩, fun _ _ => rfl⟩) + exact ⟨by simpa only [hswap, he0, he1, he2] using E'⟩ + obtain ⟨L₁⟩ := hscalar V i.1 d c shift + obtain ⟨L₂⟩ := hscalar V i.2 d c shift + obtain ⟨R₁⟩ := hright j.1 + obtain ⟨R₂⟩ := hright j.2 + obtain ⟨F₁⟩ := hmul hq L₁.conjugate R₁ + obtain ⟨F₂⟩ := hmul hq L₂.conjugate R₂ + obtain ⟨F⟩ := hmul (by positivity : 0 ≤ (q + B) ^ B) F₁ F₂ + have hcost : ((q + B) ^ B + B) ^ B ≤ (p + C) ^ C := by + simpa [X, Q, q, Polynomial.eval₂_pow] using hbudget p hp + exact ⟨F.mono hcost⟩ + +theorem cubicAntisymmetricPair_norm {p : ℝ} + (V : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p) + (i j : Fin V.outputDim × Fin V.outputDim) (h y k : ℤ) : + ‖V.cubicAntisymmetricPair i j h y k‖ ≤ 1 := by + simp only [cubicAntisymmetricPair, norm_mul, norm_star] + exact (mul_le_of_le_one_left (mul_nonneg (norm_nonneg _) (norm_nonneg _)) + ((mul_le_of_le_one_left (norm_nonneg _) (V.norm_eval _ _)).trans + (V.norm_eval _ _))).trans + ((mul_le_of_le_one_left (norm_nonneg _) (V.norm_eval _ _)).trans (V.norm_eval _ _)) + +end Erdos3.NativeMultidegreeNilcharacter + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CubicPairCoordinateTest.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CubicPairCoordinateTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb0d61d52e88773131c26f9d272b9c87367700ea --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CubicPairCoordinateTest.lean @@ -0,0 +1,106 @@ +import OAI.Combinatorics.Progressions.Estimates.CubicPairFactoredModel + +namespace OAI + +section + +namespace Erdos3.NativeSampleCorrelation + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +variable {p q : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (fun _ : CubicReplicatedIndex => 1) p} {i j : Fin W.outputDim × Fin W.outputDim} {shift : ℤ} + (V : NativeSampleCorrelation (fun _ : Fin 3 => 1) 2 q + Finset.univ (fun z : Fin 3 → ZMod N => fun k => ((z k).val : ℤ)) + (fun z => W.cubicAntisymmetricPair i j (z 1).val (z 2).val (((z 0).val : ℤ) + shift))) + +noncomputable def cubicPairCoordinateTests (k : Fin 2) (out : Fin W.outputDim) : + ∀ l, (V.cubicPairModels l).Niltest (fun _ : Fin 3 => 1) + | none => (V.test.raiseStep (by decide)).oneOnOrbit + | some l => + ![![W.cubicOriginalComponent out 1 2 0 shift, (W.cubicOriginalComponent out 2 1 0 shift).oneOnOrbit], + ![(W.cubicOriginalComponent out 1 2 0 shift).oneOnOrbit, W.cubicOriginalComponent out 2 1 0 shift]] k l + +theorem cubicPairCoordinateTests_complexity (k : Fin 2) (out : Fin W.outputDim) (l : Option (Fin 2)) : + (V.cubicPairCoordinateTests k out l).ComplexityLE (cubicPairBudget p q) := by + have htwo : 2 ≤ cubicPairBudget p q := + (by norm_num : (2 : ℝ) ≤ 6).trans V.cubicPairBudget_six_le + cases l with + | none => exact Niltest.oneOnOrbit_complexity _ htwo (V.cubicPairTests_complexity none).1 + | some l => + fin_cases k <;> fin_cases l + · exact (W.cubicOriginalComponent_complexity out 1 2 0 shift).mono V.cubicOriginalComponent_cost + · exact Niltest.oneOnOrbit_complexity _ htwo (V.cubicPairTests_complexity (some 1)).1 + · exact Niltest.oneOnOrbit_complexity _ htwo (V.cubicPairTests_complexity (some 0)).1 + · exact (W.cubicOriginalComponent_complexity out 2 1 0 shift).mono V.cubicOriginalComponent_cost + +variable [TopologicalSpace (ℝ ⊗[ℚ] V.CubicPairAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] V.CubicPairAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] V.CubicPairAlgebra)] + [T2Space (ℝ ⊗[ℚ] V.CubicPairAlgebra)] + +noncomputable def cubicPairCoordinateNiltest (k : Fin 2) (out : Fin W.outputDim) : + (pi V.cubicPairModels).Niltest (fun _ : Fin 3 => 1) := + piNiltest V.cubicPairModels (V.cubicPairCoordinateTests k out) + ((by norm_num : (0 : ℝ) ≤ 6).trans V.cubicPairBudget_six_le) + (by simpa using (show (3 : ℝ) ≤ cubicPairBudget p q from + (by norm_num : (3 : ℝ) ≤ 6).trans V.cubicPairBudget_six_le)) + (V.cubicPairCoordinateTests_complexity k out) + +theorem cubicPairCoordinateNiltest_complexity (k : Fin 2) (out : Fin W.outputDim) : + (V.cubicPairCoordinateNiltest k out).ComplexityLE + (productNiltestBudget (cubicPairBudget p q)) := + piNiltest_complexity V.cubicPairModels (V.cubicPairCoordinateTests k out) _ _ _ + +theorem cubicPairCoordinateNiltest_observable (k : Fin 2) (out : Fin W.outputDim) + (x : (pi V.cubicPairModels).Space) : + (V.cubicPairCoordinateNiltest k out).observable x = + W.vertical.observable out (productProjection V.cubicPairModels (some k) x) := by + change (∏ l, (V.cubicPairCoordinateTests k out l).observable + (productProjection V.cubicPairModels l x)) = _ + rw [Fintype.prod_option, Fin.prod_univ_two] + fin_cases k + · change 1 * (W.vertical.observable out + (productProjection V.cubicPairModels (some 0) x) * 1) = _ + simp only [one_mul, mul_one] + rfl + · change 1 * (1 * W.vertical.observable out + (productProjection V.cubicPairModels (some 1) x)) = _ + simp only [one_mul] + rfl + +theorem cubicPairCoordinateNiltest_orbit (k : Fin 2) (out : Fin W.outputDim) : + (V.cubicPairCoordinateNiltest k out).orbit = V.cubicPairNiltest.orbit := by + change NilpotentLieFiltration.piRealOrbit _ _ = NilpotentLieFiltration.piRealOrbit _ _ + apply congrArg (NilpotentLieFiltration.piRealOrbit + (fun l => (V.cubicPairModels l).filtration)) + funext l + cases l with + | none => rfl + | some l => fin_cases k <;> fin_cases l <;> rfl + +theorem cubicPairCoordinateNiltest_eval (k : Fin 2) (out : Fin W.outputDim) (n : Fin 3 → ℤ) : + (V.cubicPairCoordinateNiltest k out).eval n = + W.eval out (cubicTrilinearInput (n k.succ) (n k.rev.succ) (n 0 + shift)) := by + rw [cubicPairCoordinateNiltest, piNiltest_eval, Fintype.prod_option, Fin.prod_univ_two] + fin_cases k + · change 1 * ((W.cubicOriginalComponent out 1 2 0 shift).eval n * 1) = _ + rw [one_mul, mul_one, W.cubicOriginalComponent_eval] + rfl + · change 1 * (1 * (W.cubicOriginalComponent out 2 1 0 shift).eval n) = _ + rw [one_mul, one_mul, W.cubicOriginalComponent_eval] + rfl + +end Erdos3.NativeSampleCorrelation + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CutoffBoxImageComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CutoffBoxImageComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..f679eec16fdfc8023e7893900d813ba8ddf7a2e1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CutoffBoxImageComparison.lean @@ -0,0 +1,91 @@ +import OAI.Combinatorics.Progressions.Estimates.CutoffImageTest + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +variable {Ω ι : Type*} [MeasurableSpace Ω] [Fintype ι] [DecidableEq ι] + +theorem cutoff_box_image_comparison (μ : Measure Ω) [IsProbabilityMeasure μ] + (w : Ω → ℝ) (hw : Measurable w) (hw01 : ∀ a, w a ∈ Set.Icc (0 : ℝ) 1) + (U V : Ω → (ι → ℝ)) (hU : Measurable U) (hV : Measurable V) + (H_U H_V : ℝ≥0) (hTU : ImageTranslationBound (realDensityMeasure μ w) U H_U) + (hTV : ImageTranslationBound (realDensityMeasure μ w) V H_V) + {ε η : ℝ} (hε : 0 ≤ ε) (hcut : (∫ a, 1 - w a ∂μ) ≤ η) + (hclose : ∀ᵐ a ∂realDensityMeasure μ w, dist (U a) (V a) ≤ ε) + (δ : ℝ) (hδ : 0 < δ) (φ : (ι → ℝ) → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + |mappedTest μ U φ - mappedTest μ V φ| ≤ + 2 * η + ((H_U : ℝ) + H_V) * δ + 2 * (Fintype.card ι : ℝ) * ε / δ := by + let : IsFiniteMeasure (realDensityMeasure μ w) := + realDensityMeasure_finite μ w (cutoff_integrable μ w hw hw01) (fun a => (hw01 a).1) + have hsmall := box_image_comparison (realDensityMeasure μ w) (cutoffMeasure_mass_le_one μ w hw hw01) + U V hU hV H_U H_V hTU hTV hε hclose δ hδ φ hφ hbound + have hu := (mappedTest_cutoff_error μ w hw hw01 U hU φ hφ hbound).trans hcut + have hv := (mappedTest_cutoff_error μ w hw hw01 V hV φ hφ hbound).trans hcut + have hv' : |mappedTest (realDensityMeasure μ w) V φ - mappedTest μ V φ| ≤ η := by + rw [abs_sub_comm] + exact hv + calc + |mappedTest μ U φ - mappedTest μ V φ| ≤ + |mappedTest μ U φ - mappedTest (realDensityMeasure μ w) U φ| + + |mappedTest (realDensityMeasure μ w) U φ - mappedTest μ V φ| := abs_sub_le _ _ _ + _ ≤ |mappedTest μ U φ - mappedTest (realDensityMeasure μ w) U φ| + + (|mappedTest (realDensityMeasure μ w) U φ - mappedTest (realDensityMeasure μ w) V φ| + + |mappedTest (realDensityMeasure μ w) V φ - mappedTest μ V φ|) := + add_le_add le_rfl (abs_sub_le _ _ _) + _ ≤ η + ((((H_U : ℝ) + H_V) * δ + 2 * (Fintype.card ι : ℝ) * ε / δ) + η) := + add_le_add hu (add_le_add hsmall hv') + _ = 2 * η + ((H_U : ℝ) + H_V) * δ + 2 * (Fintype.card ι : ℝ) * ε / δ := by ring + +theorem sqrt_smoothing_balance {b ε : ℝ} (hb : 0 < b) (hε : 0 < ε) : + b * Real.sqrt (ε / b) + ε / Real.sqrt (ε / b) = 2 * Real.sqrt (b * ε) := by + let d := Real.sqrt (ε / b) + have hd : 0 < d := Real.sqrt_pos.mpr (div_pos hε hb) + have hsq : d ^ 2 = ε / b := Real.sq_sqrt (div_nonneg hε.le hb.le) + have hbd : b * d ^ 2 = ε := by + rw [hsq] + field_simp + have hdiv : ε / d = b * d := (div_eq_iff hd.ne').mpr (by nlinarith [hbd]) + have hprod : (b * d) ^ 2 = b * ε := by + calc + (b * d) ^ 2 = b * (b * d ^ 2) := by ring + _ = b * ε := by rw [hbd] + have hroot : b * d = Real.sqrt (b * ε) := by + nlinarith [Real.sq_sqrt (mul_pos hb hε).le, Real.sqrt_nonneg (b * ε), mul_pos hb hd] + change b * d + ε / d = _ + rw [hdiv, hroot] + ring + +theorem cutoff_box_image_comparison_sqrt (μ : Measure Ω) [IsProbabilityMeasure μ] + (w : Ω → ℝ) (hw : Measurable w) (hw01 : ∀ a, w a ∈ Set.Icc (0 : ℝ) 1) + (U V : Ω → (ι → ℝ)) (hU : Measurable U) (hV : Measurable V) + (B : ℝ≥0) (hB : 0 < (B : ℝ)) + (hTU : ImageTranslationBound (realDensityMeasure μ w) U ((Fintype.card ι : ℝ≥0) * B)) + (hTV : ImageTranslationBound (realDensityMeasure μ w) V ((Fintype.card ι : ℝ≥0) * B)) + {ε η : ℝ} (hε : 0 < ε) (hcut : (∫ a, 1 - w a ∂μ) ≤ η) + (hclose : ∀ᵐ a ∂realDensityMeasure μ w, dist (U a) (V a) ≤ ε) + (φ : (ι → ℝ) → ℝ) (hφ : Measurable φ) (hbound : ∀ x, ‖φ x‖ ≤ 1) : + |mappedTest μ U φ - mappedTest μ V φ| ≤ + 2 * η + 4 * (Fintype.card ι : ℝ) * Real.sqrt ((B : ℝ) * ε) := by + have h := cutoff_box_image_comparison μ w hw hw01 U V hU hV _ _ hTU hTV hε.le hcut hclose + (Real.sqrt (ε / (B : ℝ))) (Real.sqrt_pos.mpr (div_pos hε hB)) φ hφ hbound + apply h.trans_eq + have hbal := sqrt_smoothing_balance hB hε + push_cast + calc + 2 * η + ((Fintype.card ι : ℝ) * B + (Fintype.card ι : ℝ) * B) * Real.sqrt (ε / (B : ℝ)) + + 2 * (Fintype.card ι : ℝ) * ε / Real.sqrt (ε / (B : ℝ)) = + 2 * η + 2 * (Fintype.card ι : ℝ) * + ((B : ℝ) * Real.sqrt (ε / (B : ℝ)) + ε / Real.sqrt (ε / (B : ℝ))) := by ring + _ = 2 * η + 4 * (Fintype.card ι : ℝ) * Real.sqrt ((B : ℝ) * ε) := by rw [hbal]; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/CyclicProgressionCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/CyclicProgressionCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f16ec12954959c5eb91d1772aeda5a283d5520d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/CyclicProgressionCoordinates.lean @@ -0,0 +1,145 @@ +import OAI.Combinatorics.Progressions.Fourier.QuarticBohrProgression + +namespace OAI + +section + +open scoped BigOperators + +namespace Erdos3.BohrProgression + +namespace CyclicCenteredGAP + +variable {N : ℕ} + +def minParam (Q : CyclicCenteredGAP N) : Q.Param := fun _ => 0 + +def unitParam (Q : CyclicCenteredGAP N) (i : Fin Q.rank) + (hi : 0 < Q.radius i) : Q.Param := fun j => + if hji : j = i then ⟨1, by subst j; omega⟩ else 0 + +def predParam (Q : CyclicCenteredGAP N) (x : Q.Param) + (i : Fin Q.rank) (hi : 0 < (x i : ℕ)) : Q.Param := fun j => + if hji : j = i then + ⟨(x i : ℕ) - 1, by + subst j + have hx := (x i).isLt + omega⟩ + else x j + +@[simp] lemma minParam_apply (Q : CyclicCenteredGAP N) (i : Fin Q.rank) : + (Q.minParam i : ℕ) = 0 := rfl + +@[simp] lemma unitParam_apply_self (Q : CyclicCenteredGAP N) + (i : Fin Q.rank) (hi : 0 < Q.radius i) : + (Q.unitParam i hi i : ℕ) = 1 := by + simp [unitParam] + +@[simp] lemma unitParam_apply_ne (Q : CyclicCenteredGAP N) + (i j : Fin Q.rank) (hi : 0 < Q.radius i) (hji : j ≠ i) : + (Q.unitParam i hi j : ℕ) = 0 := by + simp [unitParam, hji] + +@[simp] lemma predParam_apply_self (Q : CyclicCenteredGAP N) + (x : Q.Param) (i : Fin Q.rank) (hi : 0 < (x i : ℕ)) : + (Q.predParam x i hi i : ℕ) = (x i : ℕ) - 1 := by + simp [predParam] + +@[simp] lemma predParam_apply_ne (Q : CyclicCenteredGAP N) + (x : Q.Param) (i j : Fin Q.rank) (hi : 0 < (x i : ℕ)) + (hji : j ≠ i) : + (Q.predParam x i hi j : ℕ) = x j := by + simp [predParam, hji] + +lemma eval_eq_eval_minParam_add_sum {N : ℕ} [NeZero N] + (Q : CyclicCenteredGAP N) (x : Q.Param) : + Q.eval x = Q.eval Q.minParam + + ∑ i, (x i : ZMod N) * Q.step i := by + simp only [eval, coeff, minParam, Fin.val_zero, + Nat.cast_zero, Int.cast_sub, Int.cast_natCast, + zero_sub] + rw [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i hi + rw [Int.cast_neg, Int.cast_natCast] + ring + +lemma eval_unitParam {N : ℕ} [NeZero N] + (Q : CyclicCenteredGAP N) (i : Fin Q.rank) (hi : 0 < Q.radius i) : + Q.eval (Q.unitParam i hi) = Q.eval Q.minParam + Q.step i := by + rw [Q.eval_eq_eval_minParam_add_sum] + congr 1 + rw [← Finset.sum_erase_add (Finset.univ) _ (Finset.mem_univ i)] + simp only [unitParam_apply_self, Nat.cast_one, one_mul] + have hzero : ∑ j ∈ Finset.univ.erase i, + ((Q.unitParam i hi j : ℕ) : ZMod N) * Q.step j = 0 := by + apply Finset.sum_eq_zero + intro j hj + have hji : j ≠ i := by + exact Finset.ne_of_mem_erase hj + simp [Q.unitParam_apply_ne i j hi hji] + rw [hzero, zero_add] + +lemma eval_predParam_add_eval_unitParam {N : ℕ} [NeZero N] + (Q : CyclicCenteredGAP N) (x : Q.Param) + (i : Fin Q.rank) (hi : 0 < (x i : ℕ)) + (hradius : 0 < Q.radius i) : + Q.eval (Q.predParam x i hi) + Q.eval (Q.unitParam i hradius) = + Q.eval x + Q.eval Q.minParam := by + have hpred := Q.eval_eq_eval_minParam_add_sum (Q.predParam x i hi) + have hunit := Q.eval_unitParam i hradius + have hx := Q.eval_eq_eval_minParam_add_sum x + rw [hpred, hunit, hx] + have hsum : + (∑ j, ((Q.predParam x i hi j : ℕ) : ZMod N) * Q.step j) + + Q.step i = + ∑ j, (x j : ZMod N) * Q.step j := by + rw [← Finset.sum_erase_add (Finset.univ) _ (Finset.mem_univ i)] + rw [← Finset.sum_erase_add (Finset.univ) + (fun j => (x j : ZMod N) * Q.step j) (Finset.mem_univ i)] + have hrest : ∑ j ∈ Finset.univ.erase i, + ((Q.predParam x i hi j : ℕ) : ZMod N) * Q.step j = + ∑ j ∈ Finset.univ.erase i, (x j : ZMod N) * Q.step j := by + apply Finset.sum_congr rfl + intro j hj + have hji : j ≠ i := Finset.ne_of_mem_erase hj + rw [Q.predParam_apply_ne x i j hi hji] + rw [hrest, Q.predParam_apply_self] + have hxi : (x i : ℕ) - 1 + 1 = x i := Nat.sub_add_cancel hi + rw [← hxi] + push_cast + ring + calc + Q.eval Q.minParam + + (∑ j, ((Q.predParam x i hi j : ℕ) : ZMod N) * Q.step j) + + (Q.eval Q.minParam + Q.step i) = + Q.eval Q.minParam + Q.eval Q.minParam + + ((∑ j, ((Q.predParam x i hi j : ℕ) : ZMod N) * Q.step j) + + Q.step i) := by abel + _ = Q.eval Q.minParam + Q.eval Q.minParam + + ∑ j, (x j : ZMod N) * Q.step j := by rw [hsum] + _ = Q.eval Q.minParam + (∑ j, (x j : ZMod N) * Q.step j) + + Q.eval Q.minParam := by abel + +lemma sum_predParam_add_one (Q : CyclicCenteredGAP N) (x : Q.Param) + (i : Fin Q.rank) (hi : 0 < (x i : ℕ)) : + (∑ j, (Q.predParam x i hi j : ℕ)) + 1 = ∑ j, (x j : ℕ) := by + rw [← Finset.sum_erase_add (Finset.univ) _ (Finset.mem_univ i)] + rw [← Finset.sum_erase_add (Finset.univ) + (fun j => (x j : ℕ)) (Finset.mem_univ i)] + have hrest : ∑ j ∈ Finset.univ.erase i, + (Q.predParam x i hi j : ℕ) = + ∑ j ∈ Finset.univ.erase i, (x j : ℕ) := by + apply Finset.sum_congr rfl + intro j hj + exact Q.predParam_apply_ne x i j hi (Finset.ne_of_mem_erase hj) + rw [hrest, Q.predParam_apply_self] + omega + +end CyclicCenteredGAP + +end Erdos3.BohrProgression + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DenseRealBoxCell.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DenseRealBoxCell.lean new file mode 100644 index 0000000000000000000000000000000000000000..61b0ab1133fea9bdaec44ed627b5d3de77279c7f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DenseRealBoxCell.lean @@ -0,0 +1,178 @@ +import Mathlib +import Mathlib.Algebra.Order.Floor.Ring + +namespace OAI + +section + +namespace Erdos3.FreimanModel + +open scoped Pointwise + +theorem card_image_eq_of_same_fibers {α β γ : Type*} [Nonempty α] + [DecidableEq β] [DecidableEq γ] (A : Finset α) (f : α → β) (g : α → γ) + (hrel : ∀ x ∈ A, ∀ y ∈ A, f x = f y ↔ g x = g y) : + (A.image f).card = (A.image g).card := by + classical + let r := Function.invFunOn f (A : Set α) + have hr {y : β} (hy : y ∈ A.image f) : r y ∈ A ∧ f (r y) = y := + Function.invFunOn_pos (Finset.mem_image.mp hy) + have hinj : Set.InjOn (g ∘ r) (A.image f : Set β) := by + intro y hy z hz h + have he := (hrel (r y) (hr hy).1 (r z) (hr hz).1).mpr h + simpa only [(hr hy).2, (hr hz).2] using he + have himage : (A.image f).image (g ∘ r) = A.image g := by + ext z + constructor + · intro hz + obtain ⟨y, hy, rfl⟩ := Finset.mem_image.mp hz + exact Finset.mem_image.mpr ⟨r y, (hr hy).1, rfl⟩ + · intro hz + obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp hz + have hfx : f x ∈ A.image f := Finset.mem_image.mpr ⟨x, hx, rfl⟩ + exact Finset.mem_image.mpr ⟨f x, hfx, + (hrel (r (f x)) (hr hfx).1 x hx).mp (hr hfx).2⟩ + rw [← himage, Finset.card_image_of_injOn hinj] + +theorem card_difference_image_of_freiman {G H : Type*} + [AddCommGroup G] [AddCommGroup H] [DecidableEq G] [DecidableEq H] + (A : Finset G) (f : G → H) + (hf : IsAddFreimanIso 2 (A : Set G) (A.image f : Set H) f) : + ((A.image f - A.image f).card : ℕ) = (A - A).card := by + have hrel : ∀ x ∈ A ×ˢ A, ∀ y ∈ A ×ˢ A, + x.1 - x.2 = y.1 - y.2 ↔ f x.1 - f x.2 = f y.1 - f y.2 := by + intro x hx y hy + obtain ⟨hx1, hx2⟩ := Finset.mem_product.mp hx + obtain ⟨hy1, hy2⟩ := Finset.mem_product.mp hy + rw [sub_eq_sub_iff_add_eq_add, sub_eq_sub_iff_add_eq_add] + exact (hf.add_eq_add hx1 hy2 hy1 hx2).symm + have hcard := card_image_eq_of_same_fibers (A ×ˢ A) + (fun x => x.1 - x.2) (fun x => f x.1 - f x.2) hrel + have hout : (A ×ˢ A).image (fun x => f x.1 - f x.2) = A.image f - A.image f := by + ext z + constructor + · intro hz + obtain ⟨⟨x, y⟩, hxy, rfl⟩ := Finset.mem_image.mp hz + obtain ⟨hx, hy⟩ := Finset.mem_product.mp hxy + exact Finset.mem_sub.mpr ⟨f x, Finset.mem_image.mpr ⟨x, hx, rfl⟩, + f y, Finset.mem_image.mpr ⟨y, hy, rfl⟩, rfl⟩ + · intro hz + obtain ⟨u, hu, v, hv, huv⟩ := Finset.mem_sub.mp hz + obtain ⟨x, hx, hxu⟩ := Finset.mem_image.mp hu + obtain ⟨y, hy, hyv⟩ := Finset.mem_image.mp hv + exact Finset.mem_image.mpr ⟨(x, y), Finset.mem_product.mpr ⟨hx, hy⟩, + by change f x - f y = z; rw [hxu, hyv]; exact huv⟩ + simpa only [hout, Finset.image_sub_product] using hcard.symm + +theorem exists_nonempty_large_fiber {α β : Type*} [Fintype β] [Nonempty β] [DecidableEq β] + (A : Finset α) (hA : A.Nonempty) (f : α → β) : + ∃ b : β, (A.filter fun x => f x = b).Nonempty ∧ + A.card ≤ Fintype.card β * (A.filter fun x => f x = b).card := by + classical + let k := Fintype.card β + have hk : 0 < k := Fintype.card_pos + let n := (A.card - 1) / k + have hApos := hA.card_pos + have hkn : k * n < A.card := by + have hle : k * n ≤ A.card - 1 := Nat.mul_div_le (A.card - 1) k + omega + obtain ⟨b, _, hcard⟩ := + Finset.exists_lt_card_fiber_of_mul_lt_card_of_maps_to + (s := A) (t := Finset.univ) (f := f) (fun _ _ => Finset.mem_univ _) + (by simpa only [Finset.card_univ] using hkn) + refine ⟨b, Finset.card_pos.mp ((Nat.zero_le n).trans_lt hcard), ?_⟩ + have hceil : A.card - 1 < k * (n + 1) := Nat.lt_mul_div_succ (A.card - 1) hk + have hmul : k * (n + 1) ≤ k * (A.filter fun x => f x = b).card := + Nat.mul_le_mul_left k (by omega) + change A.card ≤ k * (A.filter fun x => f x = b).card + omega + +end Erdos3.FreimanModel + +end + +section + +namespace Erdos3 + +noncomputable def realBoxCellCount (C : ℝ) (q : ℕ) : ℕ := ⌊2 * q * C⌋₊ + 1 + +theorem realBoxCellCount_pos (C : ℝ) (q : ℕ) : 0 < realBoxCellCount C q := by + unfold realBoxCellCount + omega + +theorem realBoxCellCount_le {C : ℝ} (hC : 0 ≤ C) (q : ℕ) : + (realBoxCellCount C q : ℝ) ≤ 2 * q * C + 1 := by + unfold realBoxCellCount + push_cast + exact add_le_add (Nat.floor_le (by positivity)) (le_refl 1) + +theorem realBoxCell_floor_lt {C : ℝ} (q : ℕ) (y : ℝ) (hy : |y| ≤ C) : + ⌊(q : ℝ) * (y + C)⌋₊ < realBoxCellCount C q := by + have hupper : (q : ℝ) * (y + C) ≤ 2 * q * C := by + have h := mul_le_mul_of_nonneg_left (abs_le.mp hy).2 (Nat.cast_nonneg (α := ℝ) q) + nlinarith + exact Nat.lt_succ_of_le (Nat.floor_mono hupper) + +noncomputable def realBoxCellCenter (C : ℝ) (q n : ℕ) : ℝ := + ((n : ℝ) + 1 / 2) / q - C + +theorem realBoxCell_offset {C : ℝ} (q : ℕ) (hq : 0 < q) (y : ℝ) (hy : |y| ≤ C) : + |y - realBoxCellCenter C q ⌊(q : ℝ) * (y + C)⌋₊| ≤ (1 / 2 : ℝ) / q := by + have hqR : (0 : ℝ) < q := by exact_mod_cast hq + have hnonneg : 0 ≤ (q : ℝ) * (y + C) := by + exact mul_nonneg hqR.le (by linarith [(abs_le.mp hy).1]) + have hlo := Nat.floor_le hnonneg + have hhi := Nat.lt_floor_add_one ((q : ℝ) * (y + C)) + have he : (q : ℝ) * (y - realBoxCellCenter C q ⌊(q : ℝ) * (y + C)⌋₊) = + (q : ℝ) * (y + C) - (⌊(q : ℝ) * (y + C)⌋₊ + (1 / 2 : ℝ)) := by + unfold realBoxCellCenter + field_simp + ring + apply (le_div_iff₀ hqR).mpr + calc + _ = |(q : ℝ) * (y - realBoxCellCenter C q ⌊(q : ℝ) * (y + C)⌋₊)| := by + rw [abs_mul, abs_of_pos hqR] + ring + _ ≤ _ := by rw [he]; apply abs_le.mpr; constructor <;> linarith + +theorem exists_dense_real_box_cell {ι α : Type} [Fintype ι] + (S : Finset α) (hS : S.Nonempty) (y : α → ι → ℝ) + {C : ℝ} (hbound : ∀ a ∈ S, ∀ i, |y a i| ≤ C) + (q : ℕ) (hq : 0 < q) : + ∃ T ⊆ S, T.Nonempty ∧ S.card ≤ realBoxCellCount C q ^ Fintype.card ι * T.card ∧ + ∃ c : ι → ℝ, (∀ i, |c i| ≤ C + (1 / 2 : ℝ) / q) ∧ + ∀ a ∈ T, ∀ i, |y a i - c i| ≤ (1 / 2 : ℝ) / q := by + classical + let m := realBoxCellCount C q + have hm : 0 < m := realBoxCellCount_pos C q + let : NeZero m := ⟨hm.ne'⟩ + let label (a : α) (i : ι) : Fin m := + ⟨⌊(q : ℝ) * (y a i + C)⌋₊ % m, Nat.mod_lt _ hm⟩ + obtain ⟨b, hT, hcard⟩ := FreimanModel.exists_nonempty_large_fiber S hS label + let T := S.filter (fun a => label a = b) + let c : ι → ℝ := fun i => realBoxCellCenter C q (b i).val + have hclose : ∀ a ∈ T, ∀ i, |y a i - c i| ≤ (1 / 2 : ℝ) / q := by + intro a ha i + have haS := (Finset.mem_filter.mp ha).1 + have he := congrArg Fin.val (congrFun (Finset.mem_filter.mp ha).2 i) + change ⌊(q : ℝ) * (y a i + C)⌋₊ % m = (b i).val at he + rw [Nat.mod_eq_of_lt (realBoxCell_floor_lt q (y a i) (hbound a haS i))] at he + dsimp only [c] + rw [← he] + exact realBoxCell_offset q hq (y a i) (hbound a haS i) + refine ⟨T, Finset.filter_subset _ _, hT, ?_, c, ?_, hclose⟩ + · simpa only [Fintype.card_fun, Fintype.card_fin] using hcard + · obtain ⟨a, ha⟩ := hT + intro i + calc + |c i| = |y a i - (y a i - c i)| := by congr 1; ring + _ ≤ |y a i| + |y a i - c i| := abs_sub _ _ + _ ≤ C + (1 / 2 : ℝ) / q := add_le_add + (hbound a (Finset.mem_filter.mp ha).1 i) (hclose a ha i) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DependentCoordinateCorrections.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DependentCoordinateCorrections.lean new file mode 100644 index 0000000000000000000000000000000000000000..49439c0c66003a048f78a0246a7a9f1e57e5b7fe --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DependentCoordinateCorrections.lean @@ -0,0 +1,96 @@ +import OAI.Combinatorics.Progressions.Dynamics.SparseGeneratorBudget +import OAI.Combinatorics.Progressions.Estimates.RealSubspaceIntersectionCorrections +import OAI.Combinatorics.Progressions.Linear.RealSparseFourProjection + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_coordinate_intersection_corrections + {ι κ ν σ : Type*} [Fintype ι] [Fintype κ] [Fintype ν] + (U V : Submodule ℚ (ι → ℚ)) (v : κ → ι → ℚ) (w : ν → ι → ℚ) + (hv : Submodule.span ℚ (Set.range v) = U) (hw : Submodule.span ℚ (Set.range w) = V) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hvH : ∀ a i, RationalHeightLE (v a i) H) (hwH : ∀ a i, RationalHeightLE (w a i) H) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hcols : (Fintype.card (κ ⊕ ν) : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) : + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp (p + ((p + 2) ^ 3 + (p + 2) ^ 36)) ∧ + l ∣ m ∧ ∀ (α : σ →₀ ℕ), α ≠ 0 → ∀ (β e₁ e₂ q₁ q₂ : ι → ℝ), + β - e₁ - q₁ ∈ realRationalCoordinateSpan U → + β - e₂ - q₂ ∈ realRationalCoordinateSpan V → + ‖e₁‖ ≤ Real.exp p / monomialScale T α → + ‖e₂ - e₁‖ ≤ Real.exp p / monomialScale T α → + q₁ ∈ realDenominatorGrid l → q₂ ∈ realDenominatorGrid l → + ∃ e q : ι → ℝ, + ‖e‖ ≤ (Real.exp p + Real.exp ((p + 2) ^ 3 + (p + 2) ^ 18 + p)) / + monomialScale T α ∧ q ∈ realDenominatorGrid m ∧ + β - e - q ∈ realRationalCoordinateSpan (U ⊓ V) := by + simpa only [realRationalCoordinateSpan_inf, realRationalCoordinateSpan_eq_image U v hv, + realRationalCoordinateSpan_eq_image V w hw] using + exists_common_intersection_corrections (fun i a => v a i) (fun i a => w a i) + hH hl (fun i a => hvH a i) (fun i a => hwH a i) hp hι hcols hHp hlp T hT + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem exists_dependent_coordinate_corrections + {ι κ σ : Type*} [Fintype ι] [Fintype κ] + (J : Submodule ℚ (Fin 4 → ι → ℚ)) (v : κ → Fin 4 → ι → ℚ) + (hv : Submodule.span ℚ (Set.range v) = J) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) (hvH : ∀ a k i, RationalHeightLE (v a k i) H) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (h₁₂ : (Fintype.card (Σ _ : ({1, 2} : Finset (Fin 4)), ι) : ℝ) ≤ p) + (h₁₃ : (Fintype.card (Σ _ : ({1, 3} : Finset (Fin 4)), ι) : ℝ) ≤ p) + (hcols : (Fintype.card (κ ⊕ κ) : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) + (T : σ → ℝ) + (hT : ∀ i, Real.exp (separationBudget (p + sparseGeneratorBudget p)) ≤ T i) : + let P := p + sparseGeneratorBudget p + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp (P + ((P + 2) ^ 3 + (P + 2) ^ 36)) ∧ + l ∣ m ∧ ∀ (α : σ →₀ ℕ), α ≠ 0 → ∀ (β e₁ e₂ q₁ q₂ : ι → ℝ), + β - e₁ - q₁ ∈ realRationalCoordinateSpan (fourSparseFirstProjection J {1, 2}) → + β - e₂ - q₂ ∈ realRationalCoordinateSpan (fourSparseFirstProjection J {1, 3}) → + ‖e₁‖ ≤ Real.exp P / monomialScale T α → + ‖e₂ - e₁‖ ≤ Real.exp P / monomialScale T α → + q₁ ∈ realDenominatorGrid l → q₂ ∈ realDenominatorGrid l → + ∃ e q : ι → ℝ, + ‖e‖ ≤ (Real.exp P + Real.exp ((P + 2) ^ 3 + (P + 2) ^ 18 + P)) / + monomialScale T α ∧ q ∈ realDenominatorGrid m ∧ + β - e - q ∈ realRationalCoordinateSpan (fourDependentProjection J) := by + intro P + have hκ : (Fintype.card κ : ℝ) ≤ p := by + rw [Fintype.card_sum, Nat.cast_add] at hcols + linarith [Nat.cast_nonneg (α := ℝ) (Fintype.card κ)] + have hpP : p ≤ P := le_add_of_nonneg_right (sparseGeneratorBudget_nonneg hp) + have hP : 0 ≤ P := hp.trans hpP + obtain ⟨M₁, hM₁, hM₁p, w₁, hw₁, hw₁H⟩ := + exists_sparse_generators_exp_height J {1, 2} v hv hH hvH hp h₁₂ hκ hHp + obtain ⟨M₂, hM₂, hM₂p, w₂, hw₂, hw₂H⟩ := + exists_sparse_generators_exp_height J {1, 3} v hv hH hvH hp h₁₃ hκ hHp + have hMP : ((max M₁ M₂ : ℕ) : ℝ) ≤ Real.exp P := by + rw [Nat.cast_max] + apply (max_le hM₁p hM₂p).trans + apply Real.exp_le_exp.mpr + exact le_add_of_nonneg_left hp + exact exists_coordinate_intersection_corrections + (fourSparseFirstProjection J {1, 2}) (fourSparseFirstProjection J {1, 3}) + w₁ w₂ hw₁ hw₂ (hM₁.trans (le_max_left _ _)) hl + (fun a i => (hw₁H a i).mono (le_max_left _ _)) + (fun a i => (hw₂H a i).mono (le_max_right _ _)) + hP (hι.trans hpP) (hcols.trans hpP) hMP + (hlp.trans (Real.exp_le_exp.mpr hpP)) T hT + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DerivativeVerticalCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DerivativeVerticalCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..f28075aef82fb0199fc7935d52569c0069131aee --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DerivativeVerticalCoordinates.lean @@ -0,0 +1,63 @@ +import OAI.Combinatorics.Progressions.Estimates.EuclideanGraphResidual +import OAI.Combinatorics.Progressions.Estimates.SymbolAbsorptionBounds + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def euclideanVerticalMap {σ κ : Type*} + (scale : κ → ℝ) (hscale : ∀ j, scale j ≠ 0) + (A : (κ → ℝ) ≃ₗ[ℝ] (κ → ℝ)) : + (κ → ℝ) →ₗ[ℝ] EuclideanSpace ℝ (σ ⊕ κ) := + productEuclideanEquiv.toLinearMap.comp ((LinearMap.inr ℝ (σ → ℝ) (κ → ℝ)).comp + ((coordinateScaleEquiv scale hscale).toLinearMap.comp A.toLinearMap)) + +@[simp] theorem euclideanVerticalMap_apply_inl {σ κ : Type*} + (scale : κ → ℝ) (hscale : ∀ j, scale j ≠ 0) + (A : (κ → ℝ) ≃ₗ[ℝ] (κ → ℝ)) (x : κ → ℝ) (i : σ) : + euclideanVerticalMap (σ := σ) scale hscale A x (Sum.inl i) = 0 := rfl + +@[simp] theorem euclideanVerticalMap_apply_inr {σ κ : Type*} + (scale : κ → ℝ) (hscale : ∀ j, scale j ≠ 0) + (A : (κ → ℝ) ≃ₗ[ℝ] (κ → ℝ)) (x : κ → ℝ) (j : κ) : + euclideanVerticalMap (σ := σ) scale hscale A x (Sum.inr j) = scale j * A x j := rfl + +theorem euclideanDerivative_vertical_grid_coordinates + {σ κ : Type*} [Fintype σ] [Fintype κ] [DecidableEq κ] + (T : σ → ℝ) (hT : ∀ i, T i ≠ 0) (scale : κ → ℝ) (hscale : ∀ j, scale j ≠ 0) + (Y : (σ → ℝ) →ₗ[ℝ] (κ → ℝ)) (A : (κ → ℝ) ≃ₗ[ℝ] (κ → ℝ)) + (l : ℕ) (hl : 0 < l) (v : EuclideanSpace ℝ (σ ⊕ κ)) + (hv : v ∈ euclideanDerivativeLattice T hT scale hscale Y A l hl) + (hzero : euclideanDerivativeShiftMap T hT v = 0) : + ∃ r : κ → ℝ, r ∈ realDenominatorGrid l ∧ v = euclideanVerticalMap scale hscale A r := by + have hv' := (euclideanDerivativeLattice_mem_iff T hT scale hscale Y A l hl v).mp hv + rw [← SetLike.mem_coe, derivativeLattice_carrier] at hv' + obtain ⟨h, r, hr, he⟩ := hv' + have hh : h = 0 := by + funext i + have hi := congrFun hzero i + change T i * (productEuclideanEquiv.symm v).1 i = 0 at hi + rw [he] at hi + change T i * ((h i : ℝ) / T i) = 0 at hi + rw [mul_div_cancel₀ _ (hT i)] at hi + exact_mod_cast hi + subst h + refine ⟨-r, realDenominatorGrid_neg l hr, ?_⟩ + apply productEuclideanEquiv.symm.injective + rw [he] + change derivativeGridPoint T scale Y (LinearMap.toMatrix' A.toLinearMap) 0 r = + (0, fun j => scale j * A (-r) j) + simp only [derivativeGridPoint, LinearMap.toMatrix'_mulVec, LinearEquiv.coe_coe, + Pi.zero_apply, Int.cast_zero] + change ((fun i : σ => (0 : ℝ) / T i), + fun j => scale j * (Y (0 : σ → ℝ) - A r) j) = (0, fun j => scale j * A (-r) j) + simp only [map_zero, zero_sub, map_neg, Pi.neg_apply, zero_div] + rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationCoordinateBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationCoordinateBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff6ca2d2a9cee40d13225bcc4df4cbcbb18259fa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationCoordinateBudget.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Estimates.RationalPowerHeight + +namespace OAI + +section + +namespace Erdos3 + +theorem detectedTranslationCoordinate_denominator_le_exp (n k m q : ℕ) {p : ℝ} + (hp : 0 ≤ p) (hn : (n : ℝ) ≤ p) (hk : (k : ℝ) ≤ p) + (hm : (m : ℝ) ≤ Real.exp p) + (hq : q ≤ ⌈Real.exp p⌉₊ ^ (n * k) * m) : + (q : ℝ) ≤ Real.exp ((p + 3) ^ 3) := by + have hnk : (n : ℝ) * k ≤ p * p := + mul_le_mul hn hk (Nat.cast_nonneg _) hp + have hnk' := mul_le_mul_of_nonneg_right hnk (show 0 ≤ p + 1 by positivity) + have hlog : ((n * k : ℕ) : ℝ) * (p + 1) + p ≤ (p + 3) ^ 3 := by + rw [Nat.cast_mul] + nlinarith [sq_nonneg p] + calc + (q : ℝ) ≤ ((⌈Real.exp p⌉₊ ^ (n * k) * m : ℕ) : ℝ) := Nat.cast_le.mpr hq + _ ≤ Real.exp (((n * k : ℕ) : ℝ) * (p + 1)) * Real.exp p := by + rw [Nat.cast_mul] + exact mul_le_mul (ceil_exp_power_le_exp hp (n * k)) hm + (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = Real.exp (((n * k : ℕ) : ℝ) * (p + 1) + p) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr hlog + +theorem detectedTranslationCoordinate_slow_factor_le_exp (k : ℕ) {p : ℝ} + (hp : 0 ≤ p) (hk : (k : ℝ) ≤ p) : + (k : ℝ) * (⌈Real.exp p⌉₊ : ℝ) * Real.exp p ≤ Real.exp ((p + 3) ^ 3) := by + have hkexp : (k : ℝ) ≤ Real.exp p := + hk.trans ((le_add_of_nonneg_right zero_le_one).trans (Real.add_one_le_exp p)) + calc + _ ≤ Real.exp p * Real.exp (p + 1) * Real.exp p := + mul_le_mul_of_nonneg_right + (mul_le_mul hkexp (ceil_exp_le_exp_add_one hp) (Nat.cast_nonneg _) (Real.exp_nonneg _)) + (Real.exp_nonneg _) + _ = Real.exp (3 * p + 1) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [sq_nonneg p, pow_nonneg hp 3]) + +theorem detectedTranslationCoordinate_bounds (n k m q : ℕ) {p : ℝ} + (hp : 0 ≤ p) (hn : (n : ℝ) ≤ p) (hk : (k : ℝ) ≤ p) + (hm : (m : ℝ) ≤ Real.exp p) + (hq : q ≤ ⌈Real.exp p⌉₊ ^ (n * k) * m) : + (q : ℝ) ≤ Real.exp ((p + 3) ^ 3) ∧ + (k : ℝ) * (⌈Real.exp p⌉₊ : ℝ) * Real.exp p ≤ Real.exp ((p + 3) ^ 3) := + ⟨detectedTranslationCoordinate_denominator_le_exp n k m q hp hn hk hm hq, + detectedTranslationCoordinate_slow_factor_le_exp k hp hk⟩ + +theorem detectedTranslationCoordinate_logcost {p : ℝ} (hp : 0 ≤ p) : + p + (p + 3) ^ 3 ≤ (p + 3) ^ 4 := by + have hp3 : p ≤ (p + 3) ^ 3 := by + have h := le_power_budget (show 0 ≤ p + 1 by positivity) (by decide : 1 ≤ 3) + have he : p + 1 + 2 = p + 3 := by ring + rw [he] at h + linarith + calc + _ ≤ 2 * (p + 3) ^ 3 := by linarith + _ ≤ (p + 3) * (p + 3) ^ 3 := + mul_le_mul_of_nonneg_right (by linarith) (by positivity) + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationCoordinateZero.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationCoordinateZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..e17cceadb20d7e24e1d60d564a944f11bc89c0e9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationCoordinateZero.lean @@ -0,0 +1,80 @@ +import OAI.Combinatorics.Progressions.Polynomial.DetectedTranslationPhaseDegree + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module RationalFilteredNilmanifold + +variable {B L : Type} {U : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + +@[simp] theorem detectedTranslationBaseCoordinatePolynomial_constantCoeff + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (i : B) : + constantCoeff (detectedTranslationBaseCoordinatePolynomial w d hw hwd M hM D E i) = 0 := by + rw [detectedTranslationBaseCoordinatePolynomial_eq_logCoordinate] + exact detectedTranslationLogCoordinate_constant w d hw hwd M hM D E (Sum.inl i) + +@[simp] theorem detectedTranslationGroupEval_zero + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) : + detectedTranslationGroupEval w d hw hwd M hM D (0 : U → ℝ) E = 1 := by + let g := detectedTranslationSymbolLift w d hw hwd M hM D E + have hlog : VectorPolynomial.coefficients g.log 0 = 0 := by + dsimp only [g] + rw [detectedTranslationSymbolLift_log] + exact (weightedFiltration w d hwd).realSymbolRepresentative_constant + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) _ _ + have hval : (weightedFiltration w d hwd).realification.polynomialOrbitRealEval + (fun _ : U => 1) (0 : U → ℝ) g = 1 := by + apply NilpotentLieBCHGroup.ext + change VectorPolynomial.eval₂ (0 : U → ℝ) g.log = 0 + have h := VectorPolynomial.eval₂_algebraMap (S := ℝ) (0 : U → ℚ) g.log + simp only [Pi.zero_apply, map_zero] at h + change VectorPolynomial.eval₂ (fun _ : U => (0 : ℝ)) g.log = 0 + rw [h] + change VectorPolynomial.eval (fun _ : U => (0 : ℚ)) g.log = 0 + rw [VectorPolynomial.eval_zero_eq_coefficient, hlog] + change bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).realification.polynomialOrbitRealEval + (fun _ : U => 1) (0 : U → ℝ) g) = 1 + rw [hval, map_one] + +@[simp] theorem detectedTranslationPhasePolynomial_specialize_zero + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) : + aeval (Sum.elim (fun _ : U => (0 : MvPolynomial B ℝ)) X) + (detectedTranslationPhasePolynomial w d hw hwd M hM D E) = 0 := by + have h := detectedTranslationPhasePolynomial_specialize w d hw hwd M hM D E (0 : U → ℝ) + simpa only [Pi.zero_apply, map_zero, detectedTranslationGroupEval_zero, + PolynomialTranslationGroupOver.polynomial_one] using h + +@[simp] theorem detectedTranslationPhasePolynomial_eval_zero + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (a : B → ℝ) : + eval (Sum.elim (0 : U → ℝ) a) + (detectedTranslationPhasePolynomial w d hw hwd M hM D E) = 0 := by + rw [detectedTranslationPhasePolynomial_eval, detectedTranslationGroupEval_zero, + PolynomialTranslationGroupOver.polynomial_one, map_zero] + +@[simp] theorem detectedTranslationPhasePolynomial_coeff_zero_parameters + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (β : B →₀ ℕ) : + (detectedTranslationPhasePolynomial w d hw hwd M hM D E).coeff + ((0 : U →₀ ℕ).sumElim β) = 0 := by + rw [detectedTranslationPhasePolynomial_coeff] + have h := congrArg (fun group : PolynomialTranslationGroupOver ℝ B => group.polynomial.coeff β) + (detectedTranslationGroupPolynomial_specialize w d hw hwd M hM D E (0 : U → ℝ)) + simpa only [PolynomialTranslationGroupOver.map_polynomial, coeff_map, + detectedTranslationGroupEval_zero, PolynomialTranslationGroupOver.polynomial_one, + AddMonoidAlgebra.coeff_zero, Finsupp.zero_apply, eval_zero, constantCoeff_eq] using h + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationLogCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationLogCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..161aead2cd32c7a297e9eb026be6a585ce15944b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationLogCoordinates.lean @@ -0,0 +1,549 @@ +import Mathlib.Algebra.MvPolynomial.Funext +import OAI.Combinatorics.Progressions.Estimates.TranslationMajorCorrelationIdentity +import OAI.Combinatorics.Progressions.Polynomial.TranslationLogCoordinatePolynomials + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) + +noncomputable def realSymbolCoordinate (x : F.RealPolynomialSymbol w) (i : ι) : + MvPolynomial σ ℝ := + coordinate ((b.baseChange ℝ).coord i).toAddMonoidHom + (F.realSymbolRepresentative b ω hlayers w x) + +@[simp] theorem coeff_realSymbolCoordinate (x : F.RealPolynomialSymbol w) + (α : σ →₀ ℕ) (i : ι) : + (F.realSymbolCoordinate b ω hlayers w x i).coeff α = + (b.baseChange ℝ).repr + (coefficients (F.realSymbolRepresentative b ω hlayers w x) α) i := by + simp only [realSymbolCoordinate, coeff_coordinate, LinearMap.toAddMonoidHom_coe, + Basis.coord_apply] + +theorem realSymbolCoordinate_coeff_of_ne (x : F.RealPolynomialSymbol w) + (α : σ →₀ ℕ) (i : ι) (h : Finsupp.weight w α ≠ ω i) : + (F.realSymbolCoordinate b ω hlayers w x i).coeff α = 0 := by + rw [F.coeff_realSymbolCoordinate] + exact F.realSymbolRepresentative_coefficient_of_ne b ω hlayers w x α i h + +@[simp] theorem realSymbolCoordinate_coeff_symbol (x : F.RealPolynomialSymbol w) + (z : SymbolBasisIndex w ω) : + (F.realSymbolCoordinate b ω hlayers w x z.val.2).coeff z.val.1 = + ((F.polynomialSymbolBasis b ω hlayers w).baseChange ℝ).repr x z := by + rw [F.coeff_realSymbolCoordinate] + exact F.realSymbolRepresentative_coefficient b ω hlayers w x z + +theorem realSymbolCoordinate_isWeightedHomogeneous (x : F.RealPolynomialSymbol w) + (i : ι) : + (F.realSymbolCoordinate b ω hlayers w x i).IsWeightedHomogeneous w (ω i) := by + intro α hα + by_contra h + exact hα (F.realSymbolCoordinate_coeff_of_ne b ω hlayers w x α i h) + +@[simp] theorem realSymbolCoordinate_coeff_zero (x : F.RealPolynomialSymbol w) (i : ι) : + (F.realSymbolCoordinate b ω hlayers w x i).coeff 0 = 0 := by + rw [F.coeff_realSymbolCoordinate, F.realSymbolRepresentative_constant b ω hlayers w x, + map_zero, Finsupp.zero_apply] + +@[simp] theorem realSymbolCoordinate_constantCoeff (x : F.RealPolynomialSymbol w) (i : ι) : + MvPolynomial.constantCoeff (F.realSymbolCoordinate b ω hlayers w x i) = 0 := by + exact F.realSymbolCoordinate_coeff_zero b ω hlayers w x i + +theorem realSymbolCoordinate_slow_coefficients (T : σ → ℝ) + (hT : ∀ i, 0 < T i) {M : ℝ} (hM : 0 ≤ M) + (g : F.RealPolynomialSymbolGroup w) (hg : F.SymbolSlowBound b ω hlayers w T M g) + (α : σ →₀ ℕ) (i : ι) : + |(F.realSymbolCoordinate b ω hlayers w g.coord i).coeff α| ≤ + M / monomialScale T α := by + rw [F.coeff_realSymbolCoordinate] + exact F.realSymbolRepresentative_slow_coefficients b ω hlayers w T hT hM g hg α i + +theorem realSymbolCoordinate_rational_coefficients (l : ℕ) + (g : F.RealPolynomialSymbolGroup w) (hg : F.SymbolRationalGrid b ω hlayers w l g) : + (fun z : (σ →₀ ℕ) × ι => + (F.realSymbolCoordinate b ω hlayers w g.coord z.2).coeff z.1) + ∈ realDenominatorGrid l := by + simpa only [F.coeff_realSymbolCoordinate] using + F.realSymbolRepresentative_rational_coefficients b ω hlayers w l g hg + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open Module _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators TensorProduct + +variable {U B κ : Type*} [Fintype B] [Fintype κ] + +noncomputable def nativeTranslationLogCoordinate (w : B → ℕ) (d : ℕ) + (b : Basis κ ℚ (weightedSubalgebra w d)) + (p : VectorPolynomial U ℚ (ℝ ⊗[ℚ] weightedSubalgebra w d)) (k : κ) : + MvPolynomial U ℝ := + VectorPolynomial.coordinate ((b.baseChange ℝ).coord k).toAddMonoidHom p + +omit [Fintype κ] in +@[simp] theorem nativeTranslationLogCoordinate_coeff (w : B → ℕ) (d : ℕ) + (b : Basis κ ℚ (weightedSubalgebra w d)) + (p : VectorPolynomial U ℚ (ℝ ⊗[ℚ] weightedSubalgebra w d)) + (k : κ) (α : U →₀ ℕ) : + (nativeTranslationLogCoordinate w d b p k).coeff α = + (b.baseChange ℝ).repr (VectorPolynomial.coefficients p α) k := + VectorPolynomial.coeff_coordinate _ _ _ + +theorem nativeTranslationLogCoordinate_eval (w : B → ℕ) (d : ℕ) + (b : Basis κ ℚ (weightedSubalgebra w d)) + (p : VectorPolynomial U ℚ (ℝ ⊗[ℚ] weightedSubalgebra w d)) (u : U → ℝ) : + VectorPolynomial.eval₂ u p = + ∑ k, (eval u (nativeTranslationLogCoordinate w d b p k)) ⊗ₜ[ℚ] b k := by + calc + VectorPolynomial.eval₂ u p = + ∑ k, (b.baseChange ℝ).repr (VectorPolynomial.eval₂ u p) k • + (b.baseChange ℝ) k := ((b.baseChange ℝ).sum_repr _).symm + _ = _ := by + apply Finset.sum_congr rfl + intro k _ + change ((b.baseChange ℝ).coord k) (VectorPolynomial.eval₂ u p) • + (b.baseChange ℝ) k = _ + rw [VectorPolynomial.coordinate_eval₂, Basis.baseChange_apply] + simp only [nativeTranslationLogCoordinate, TensorProduct.smul_tmul', smul_eq_mul, mul_one] + +noncomputable def nativeTranslationGroupPolynomial (w : B → ℕ) (d : ℕ) + (b : Basis κ ℚ (weightedSubalgebra w d)) + (p : VectorPolynomial U ℚ (ℝ ⊗[ℚ] weightedSubalgebra w d)) : + PolynomialTranslationGroupOver (MvPolynomial U ℝ) B := + translationLogGroupPolynomial w d b (nativeTranslationLogCoordinate w d b p) + +theorem nativeTranslationGroupPolynomial_specialize (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (p : VectorPolynomial U ℚ (ℝ ⊗[ℚ] weightedSubalgebra w d)) (u : U → ℝ) : + PolynomialTranslationGroupOver.map (eval u) (nativeTranslationGroupPolynomial w d b p) = + bchRealTranslationHom w d hwd ⟨VectorPolynomial.eval₂ u p⟩ := by + rw [nativeTranslationGroupPolynomial, translationLogGroupPolynomial_specialize, + ← nativeTranslationLogCoordinate_eval] + +theorem nativeTranslationGroupPolynomial_orbit (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (v : U → ℕ) (g : (weightedFiltration w d hwd).realification.PolynomialOrbit v) + (u : U → ℝ) : + PolynomialTranslationGroupOver.map (eval u) (nativeTranslationGroupPolynomial w d b g.log) = + bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).realification.polynomialOrbitRealEval v u g) := + nativeTranslationGroupPolynomial_specialize w d hwd b g.log u + +theorem nativeTranslationGroupPolynomial_native (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (v : U → ℕ) + (g : ((weightedFiltration w d hwd).realification.adaptedPolynomialFiltration v).Group) + (u : U → ℝ) : + PolynomialTranslationGroupOver.map (eval u) + (nativeTranslationGroupPolynomial w d b g.coord.val) = + bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).adaptedPolynomialRealValueHom v u g) := + nativeTranslationGroupPolynomial_specialize w d hwd b g.coord.val u + +omit [Fintype κ] in + +theorem nativeTranslationLogCoordinate_degree (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (ω : κ → ℕ) + (hb : ∀ j, (weightedFiltration w d hwd).layer j = + Submodule.span ℚ (b '' {k | j ≤ ω k})) + (v : U → ℕ) + (g : ((weightedFiltration w d hwd).realification.adaptedPolynomialFiltration v).Group) + (k : κ) : + nativeTranslationLogCoordinate w d b g.coord.val k ∈ weightedSupportLE v (ω k) := + (weightedFiltration w d hwd).real_adapted_coordinate_degree b ω hb + ((weightedFiltration w d hwd).realification.adaptedBCHToOrbit v g) k + +omit [Fintype κ] in + +theorem nativeTranslationLogCoordinate_constant (w : B → ℕ) (d : ℕ) + (b : Basis κ ℚ (weightedSubalgebra w d)) + (p : VectorPolynomial U ℚ (ℝ ⊗[ℚ] weightedSubalgebra w d)) + (hp : VectorPolynomial.coefficients p 0 = 0) (k : κ) : + (nativeTranslationLogCoordinate w d b p k).coeff 0 = 0 := by + rw [nativeTranslationLogCoordinate_coeff, hp, map_zero, Finsupp.zero_apply] + +theorem nativeTranslationGroupPolynomial_realified (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (v : U → ℕ) (g : (weightedFiltration w d hwd).RealAdaptedPolynomialGroup v) + (u : U → ℝ) : + PolynomialTranslationGroupOver.map (eval u) + (nativeTranslationGroupPolynomial w d b + ((weightedFiltration w d hwd).realAdaptedPolynomialMap v g.coord)) = + bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).adaptedPolynomialRealValueHom v u + ((weightedFiltration w d hwd).realAdaptedPolynomialGroupHom v g)) := + nativeTranslationGroupPolynomial_native w d hwd b v + ((weightedFiltration w d hwd).realAdaptedPolynomialGroupHom v g) u + +omit [Fintype κ] in +@[simp] theorem nativeTranslationLogCoordinate_symbol (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (ω : κ → ℕ) + (hb : ∀ j, (weightedFiltration w d hwd).layer j = + Submodule.span ℚ (b '' {k | j ≤ ω k})) + (v : U → ℕ) (g : (weightedFiltration w d hwd).RealPolynomialSymbolGroup v) + (k : κ) : + nativeTranslationLogCoordinate w d b + ((weightedFiltration w d hwd).realPolynomialSymbolLift b ω hb v g).coord.val k = + (weightedFiltration w d hwd).realSymbolCoordinate b ω hb v g.coord k := rfl + +theorem nativeTranslationGroupPolynomial_symbol (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (ω : κ → ℕ) + (hb : ∀ j, (weightedFiltration w d hwd).layer j = + Submodule.span ℚ (b '' {k | j ≤ ω k})) + (v : U → ℕ) (g : (weightedFiltration w d hwd).RealPolynomialSymbolGroup v) + (u : U → ℝ) : + PolynomialTranslationGroupOver.map (eval u) + (nativeTranslationGroupPolynomial w d b + ((weightedFiltration w d hwd).realSymbolRepresentative b ω hb v g.coord)) = + bchRealTranslationHom w d hwd + ((weightedFiltration w d hwd).adaptedPolynomialRealValueHom v u + ((weightedFiltration w d hwd).realPolynomialSymbolLift b ω hb v g)) := + nativeTranslationGroupPolynomial_native w d hwd b v + ((weightedFiltration w d hwd).realPolynomialSymbolLift b ω hb v g) u + +omit [Fintype B] in +private theorem translationPolynomial_ext_eval + (g h : PolynomialTranslationGroupOver (MvPolynomial U ℝ) B) + (hgh : ∀ u : U → ℝ, + PolynomialTranslationGroupOver.map (eval u) g = + PolynomialTranslationGroupOver.map (eval u) h) : g = h := by + apply PolynomialTranslationGroupOver.ext + · funext i + apply MvPolynomial.funext + intro u + exact congrArg (fun a => a.base i) (hgh u) + · apply MvPolynomial.ext + intro α + apply MvPolynomial.funext + intro u + have he := congrArg (fun element => element.polynomial.coeff α) (hgh u) + simpa only [PolynomialTranslationGroupOver.map_polynomial, coeff_map] using he + +theorem nativeTranslationGroupPolynomial_mul (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (v : U → ℕ) + (g h : ((weightedFiltration w d hwd).realification.adaptedPolynomialFiltration v).Group) : + nativeTranslationGroupPolynomial w d b (g * h).coord.val = + nativeTranslationGroupPolynomial w d b g.coord.val * + nativeTranslationGroupPolynomial w d b h.coord.val := by + apply translationPolynomial_ext_eval + intro u + rw [map_mul, nativeTranslationGroupPolynomial_native, + nativeTranslationGroupPolynomial_native, nativeTranslationGroupPolynomial_native, + map_mul, map_mul] + +theorem nativeTranslationGroupPolynomial_factorization (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (b : Basis κ ℚ (weightedSubalgebra w d)) + (v : U → ℕ) + (e p r g : ((weightedFiltration w d hwd).realification.adaptedPolynomialFiltration v).Group) + (hprod : e * p * r = g) : + nativeTranslationGroupPolynomial w d b e.coord.val * + nativeTranslationGroupPolynomial w d b p.coord.val * + nativeTranslationGroupPolynomial w d b r.coord.val = + nativeTranslationGroupPolynomial w d b g.coord.val := by + rw [← nativeTranslationGroupPolynomial_mul w d hwd b v, + ← nativeTranslationGroupPolynomial_mul w d hwd b v, hprod] + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3 + +open Module VectorPolynomial +open scoped TensorProduct BigOperators + +theorem realifyFunctional_basis_coord {ι V : Type*} [AddCommGroup V] [Module ℚ V] + (b : Basis ι ℚ V) (i : ι) : + realifyFunctional (b.coord i) = (b.baseChange ℝ).coord i := by + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul a x => + rw [realifyFunctional_tmul] + change a * (b.repr x i : ℝ) = (b.baseChange ℝ).repr (a ⊗ₜ[ℚ] x) i + rw [Basis.baseChange_repr_tmul] + simp only [Rat.smul_def, mul_comm] + | add x y hx hy => simp only [map_add, hx, hy] + +namespace NilpotentLieFiltration + +theorem scalarSymbolPolynomial_eq_sum_realSymbolCoordinates + {σ ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (θ : F.AssociatedGraded →ₗ[ℚ] ℚ) + (g : F.RealPolynomialSymbolGroup w) : + F.scalarSymbolPolynomial b ω hF w θ g = + ∑ i, MvPolynomial.C (θ (F.associatedGradedBasis b ω hF i) : ℝ) * + F.realSymbolCoordinate b ω hF w g.coord i := by + classical + ext α + rw [F.coeff_scalarSymbolPolynomial, + realifyFunctional_eq_sum_basis (F.associatedGradedBasis b ω hF)] + simp only [MvPolynomial.coeff_sum, MvPolynomial.coeff_C_mul, F.coeff_realSymbolCoordinate] + apply Finset.sum_congr rfl + intro i _ + by_cases h : Finsupp.weight w α = ω i + · rw [F.realGradedSymbolPolynomial_coordinate b ω hF w g.coord ⟨(α, i), h⟩, + F.realSymbolRepresentative_coefficient b ω hF w g.coord ⟨(α, i), h⟩, + mul_comm] + · rw [F.realGradedSymbolPolynomial_coordinate_of_ne b ω hF w g.coord α i h, + F.realSymbolRepresentative_coefficient_of_ne b ω hF w g.coord α i h, + zero_mul, mul_zero] + +theorem scalarSymbolPolynomial_joint_grid + {σ ι κ L : Type*} [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (θ : κ → F.AssociatedGraded →ₗ[ℚ] ℚ) (m : ℕ) + (g : F.RealPolynomialSymbolGroup w) (hg : F.SymbolRationalGrid b ω hF w m g) : + (fun z : (σ →₀ ℕ) × κ => + (F.scalarSymbolPolynomial b ω hF w (θ z.2) g).coeff z.1) ∈ + realDenominatorGrid (matrixDenominator (fun k i => θ k (F.associatedGradedBasis b ω hF i)) * m) := by + classical + let ℓ : F.AssociatedGraded →ₗ[ℚ] (κ → ℚ) := LinearMap.pi θ + have hval (α : σ →₀ ℕ) : + realifyCoordinateMap ℓ + (coefficients (F.realGradedSymbolPolynomial b ω hF w g.coord) α) = + fun k => (F.scalarSymbolPolynomial b ω hF w (θ k) g).coeff α := by + funext k + rw [F.coeff_scalarSymbolPolynomial] + rfl + have hgrid (α : σ →₀ ℕ) : + (fun k => (F.scalarSymbolPolynomial b ω hF w (θ k) g).coeff α) ∈ + realDenominatorGrid (matrixDenominator (fun k i => θ k (F.associatedGradedBasis b ω hF i)) * m) := by + have h := realifyCoordinateMap_grid (F.associatedGradedBasis b ω hF) ℓ m _ + (F.realGradedSymbolPolynomial_rational_coordinates b ω hF w m g hg α) + rw [hval] at h + exact h + choose a ha using hgrid + refine ⟨fun z => a z.1 z.2, ?_⟩ + funext z + exact congrFun (ha z.1) z.2 + +end NilpotentLieFiltration + +namespace PolynomialTranslationLie + +open RationalFilteredNilmanifold + +variable {B L : Type} {U ι : Type*} [Fintype B] [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + +noncomputable def detectedTranslationLogCoordinatePolynomial + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (k : WeightedBasisIndex w d) : MvPolynomial U ℝ := + coordinate (((weightedBasis w d hw).baseChange ℝ).coord k).toAddMonoidHom + (detectedTranslationSymbolLift w d hw hwd M hM D E).log + +theorem detectedTranslationLogCoordinate_eq_canonical + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (k : WeightedBasisIndex w d) : + detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k = + (weightedFiltration w d hwd).realSymbolCoordinate (weightedBasis w d hw) + (weightedBasisGrade w d) (weightedFiltration_layer_eq_span w d hw hwd) + (fun _ : U => 1) (detectedTranslationSymbolProjection w d hw hwd M hM D E).coord k := by + simp only [detectedTranslationLogCoordinatePolynomial, detectedTranslationSymbolLift_log, + NilpotentLieFiltration.realSymbolCoordinate, detectedTranslationSymbolProjection_coord] + +theorem detectedTranslationLogCoordinate_homogeneous + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (k : WeightedBasisIndex w d) : + (detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k).IsWeightedHomogeneous + (fun _ : U => 1) (weightedBasisGrade w d k) := by + rw [detectedTranslationLogCoordinate_eq_canonical] + exact (weightedFiltration w d hwd).realSymbolCoordinate_isWeightedHomogeneous + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) _ _ k + +@[simp] theorem detectedTranslationLogCoordinate_constant + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (k : WeightedBasisIndex w d) : + (detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k).coeff 0 = 0 := by + rw [detectedTranslationLogCoordinate_eq_canonical] + exact (weightedFiltration w d hwd).realSymbolCoordinate_coeff_zero + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) _ _ k + +noncomputable def detectedTranslationLogFunctional (k : WeightedBasisIndex w d) : + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.AssociatedGraded →ₗ[ℚ] ℚ := + ((weightedBasis w d hw).coord k).comp + (weightedTranslationGradedProjection + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration + w d hw hwd (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).toLinearMap + +variable (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = + Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem detectedTranslationLogCoordinate_eq_scalar + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (k : WeightedBasisIndex w d) : + detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k = + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.scalarSymbolPolynomial + b ω hN (fun _ : U => 1) (detectedTranslationLogFunctional w d hw hwd M hM D k) E := by + rw [detectedTranslationLogCoordinatePolynomial, detectedTranslationSymbolLift_log] + have h := (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.homogeneousProjected_scalar_coordinate + (weightedFiltration w d hwd) b ω hN + (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) + (weightedBasis_homogeneous_brackets w d hw) + (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) + (fun _ : U => 1) ((weightedBasis w d hw).coord k) E.coord + rw [realifyFunctional_basis_coord] at h + change (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.scalarSymbolPolynomial + b ω hN (fun _ : U => 1) (detectedTranslationLogFunctional w d hw hwd M hM D k) E = _ at h + convert h.symm using 1 + +noncomputable def detectedTranslationLogProjectionMatrix : Matrix (WeightedBasisIndex w d) ι ℚ := + fun k i => if ω i = weightedBasisGrade w d k then (weightedBasis w d hw).repr (b i true) k else 0 + +theorem detectedTranslationLogFunctional_basis (k : WeightedBasisIndex w d) (i : ι) : + detectedTranslationLogFunctional w d hw hwd M hM D k + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.associatedGradedBasis b ω hN i) = + detectedTranslationLogProjectionMatrix w d hw b ω k i := by + exact (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.homogeneousGradedProjection_basis_repr + (weightedFiltration w d hwd) (weightedBasis w d hw) (weightedBasisGrade w d) + (weightedFiltration_layer_eq_span w d hw hwd) (weightedBasis_homogeneous_brackets w d hw) + (liePiEval (R := ℚ) true) + (pairFirstProjection_filtered (weightedTranslationResidueNilmanifold w d hw hwd M hM) D) + b ω hN i k + +theorem detectedTranslationLogCoordinate_eq_sum [Fintype ι] + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (k : WeightedBasisIndex w d) : + detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k = + ∑ i, MvPolynomial.C (detectedTranslationLogProjectionMatrix w d hw b ω k i : ℝ) * + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.realSymbolCoordinate + b ω hN (fun _ : U => 1) E.coord i := by + rw [detectedTranslationLogCoordinate_eq_scalar w d hw hwd M hM D b ω hN] + rw [NilpotentLieFiltration.scalarSymbolPolynomial_eq_sum_realSymbolCoordinates] + simp only [detectedTranslationLogFunctional_basis w d hw hwd M hM D b ω hN] + +theorem detectedTranslationLogCoordinate_slow_coefficients [Fintype ι] + (T : U → ℝ) (hT : ∀ i, 0 < T i) {A H : ℝ} (hA : 0 ≤ A) (hH : 0 ≤ H) + (k : WeightedBasisIndex w d) + (hproj : ∀ i, |(detectedTranslationLogProjectionMatrix w d hw b ω k i : ℝ)| ≤ H) + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hE : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolSlowBound + b ω hN (fun _ : U => 1) T A E) (α : U →₀ ℕ) : + |(detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k).coeff α| ≤ + (Fintype.card ι : ℝ) * H * A / monomialScale T α := by + rw [detectedTranslationLogCoordinate_eq_scalar w d hw hwd M hM D b ω hN] + apply NilpotentLieFiltration.scalarSymbolPolynomial_slow_coefficients + _ b ω hN _ _ T hT hA hH _ E hE α + intro i + simpa only [detectedTranslationLogFunctional_basis w d hw hwd M hM D b ω hN] using hproj i + +theorem detectedTranslationLogCoordinate_joint_grid [Fintype ι] + (m : ℕ) + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hE : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolRationalGrid + b ω hN (fun _ : U => 1) m E) : + (fun z : (U →₀ ℕ) × WeightedBasisIndex w d => + (detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E z.2).coeff z.1) + ∈ realDenominatorGrid (matrixDenominator (detectedTranslationLogProjectionMatrix w d hw b ω) * m) := by + have h := (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.scalarSymbolPolynomial_joint_grid + b ω hN (fun _ : U => 1) (detectedTranslationLogFunctional w d hw hwd M hM D) m E hE + simpa only [detectedTranslationLogFunctional_basis w d hw hwd M hM D b ω hN, + ← detectedTranslationLogCoordinate_eq_scalar w d hw hwd M hM D b ω hN] using h + +theorem detectedTranslationLogCoordinate_rational_coefficients [Fintype ι] + (m : ℕ) + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hE : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolRationalGrid + b ω hN (fun _ : U => 1) m E) (k : WeightedBasisIndex w d) : + realPolynomialCoefficientGrid + (matrixDenominator (fun (_ : Unit) i => detectedTranslationLogProjectionMatrix w d hw b ω k i) * m) + (detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k) := by + rw [detectedTranslationLogCoordinate_eq_scalar w d hw hwd M hM D b ω hN] + have h := (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.scalarSymbolPolynomial_rational_coefficients + b ω hN (fun _ : U => 1) (detectedTranslationLogFunctional w d hw hwd M hM D k) m E hE + simpa only [detectedTranslationLogFunctional_basis w d hw hwd M hM D b ω hN] using h + +theorem detectedTranslationLogCoordinate_exists_coefficient_grid [Fintype ι] + (k : WeightedBasisIndex w d) {H : ℕ} + (hproj : ∀ i, RationalHeightLE (detectedTranslationLogProjectionMatrix w d hw b ω k i) H) + (m : ℕ) (hm : 0 < m) + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hE : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolRationalGrid + b ω hN (fun _ : U => 1) m E) : + ∃ q : ℕ, 0 < q ∧ q ≤ H ^ Fintype.card ι * m ∧ + realPolynomialCoefficientGrid q (detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k) := by + rw [detectedTranslationLogCoordinate_eq_scalar w d hw hwd M hM D b ω hN] + apply NilpotentLieFiltration.scalarSymbolPolynomial_exists_coefficient_grid + _ b ω hN _ _ _ m hm E hE + intro i + simpa only [detectedTranslationLogFunctional_basis w d hw hwd M hM D b ω hN] using hproj i + +theorem detectedTranslationLogCoordinate_common_coefficient_grid [Fintype ι] + (m : ℕ) + (E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hE : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolRationalGrid + b ω hN (fun _ : U => 1) m E) (k : WeightedBasisIndex w d) : + realPolynomialCoefficientGrid + (matrixDenominator (detectedTranslationLogProjectionMatrix w d hw b ω) * m) + (detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k) := by + obtain ⟨a, ha⟩ := detectedTranslationLogCoordinate_joint_grid w d hw hwd M hM D b ω hN m E hE + refine ⟨fun α => a (α, k), ?_⟩ + funext α + exact congrFun ha (α, k) + +theorem exists_detectedTranslationLogCoordinate_common_grid [Fintype ι] + {H : ℕ} + (hproj : ∀ k i, RationalHeightLE (detectedTranslationLogProjectionMatrix w d hw b ω k i) H) + (m : ℕ) (hm : 0 < m) : + ∃ q : ℕ, 0 < q ∧ + q ≤ H ^ (Fintype.card (WeightedBasisIndex w d) * Fintype.card ι) * m ∧ + ∀ E : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1), + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolRationalGrid + b ω hN (fun _ : U => 1) m E → + ∀ k, realPolynomialCoefficientGrid q + (detectedTranslationLogCoordinatePolynomial w d hw hwd M hM D E k) := by + refine ⟨matrixDenominator (detectedTranslationLogProjectionMatrix w d hw b ω) * m, + Nat.mul_pos (matrixDenominator_pos _) hm, + Nat.mul_le_mul_right m (matrixDenominator_le _ hproj), ?_⟩ + intro E hE k + exact detectedTranslationLogCoordinate_common_coefficient_grid w d hw hwd M hM D b ω hN m E hE k + +omit [Fintype (WeightedBasisIndex w d)] in +theorem detectedTranslationLogProjectionMatrix_height {H : ℕ} (hH : 1 ≤ H) + (hproj : ∀ k i, RationalHeightLE ((weightedBasis w d hw).repr (b i true) k) H) + (k : WeightedBasisIndex w d) (i : ι) : + RationalHeightLE (detectedTranslationLogProjectionMatrix w d hw b ω k i) H := by + classical + unfold detectedTranslationLogProjectionMatrix + split_ifs + · exact hproj k i + · exact rationalHeightLE_zero hH + +end PolynomialTranslationLie +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationUniformCoordinateBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationUniformCoordinateBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1d1171f1c307670e2d9525af93ec1c81ffebefc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DetectedTranslationUniformCoordinateBounds.lean @@ -0,0 +1,86 @@ +import OAI.Combinatorics.Progressions.Linear.DetectedTranslationLogProjectionHeight +import OAI.Combinatorics.Progressions.Polynomial.DetectedTranslationPhaseBudget +import OAI.Combinatorics.Progressions.Polynomial.DetectedTranslationPhaseDegree + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def detectedTranslationCoordinateConstant (d : ℕ) : ℕ := + (exists_detectedTranslationPhase_budget d).choose + +theorem detectedTranslationCoordinateConstant_ge_two (d : ℕ) : + 2 ≤ detectedTranslationCoordinateConstant d := + (exists_detectedTranslationPhase_budget d).choose_spec.1 + +namespace PolynomialTranslationLie +open _root_.MvPolynomial _root_.OAI.MvPolynomial Module RationalFilteredNilmanifold +variable {B L : Type} {U ι : Type*} [Fintype B] [Fintype U] [Fintype ι] + [LieRing L] [LieAlgebra ℚ L] + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + [Fintype (WeightedBasisIndex w d)] (M : ℕ) (hM : 0 < M) + {e : ℕ} (D : RationalFilteredNilmanifold L d e) + (b : Basis ι ℚ (PairAlgebra (weightedSubalgebra w d) L)) (ω : ι → ℕ) + (hN : ∀ j, + (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.layer j = + Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem detectedTranslationGroupCoordinates_uniform_bounds + {p : ℝ} (hp : 0 ≤ p) + (hU : (Fintype.card U : ℝ) ≤ p) (hB : (Fintype.card B : ℝ) ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) + (hb : ∀ i j, rationalLogHeight + ((pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).basis.repr (b i) j) ≤ p) + (T : U → ℝ) (hT : ∀ i, 0 < T i) + (E Q : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.RealPolynomialSymbolGroup (fun _ : U => 1)) + (hE : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolSlowBound + b ω hN (fun _ : U => 1) T (Real.exp p) E) + (m : ℕ) (hm : 0 < m) (hmp : (m : ℝ) ≤ Real.exp p) + (hQ : (pi (pairModels (weightedTranslationResidueNilmanifold w d hw hwd M hM) D)).filtration.SymbolRationalGrid + b ω hN (fun _ : U => 1) m Q) : + let C := detectedTranslationCoordinateConstant d + ∃ q : ℕ, 0 < q ∧ (q : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + realPolynomialMass (scaleMvPolynomialAxes (Sum.elim T (fun _ : B => 1)) + (detectedTranslationPhasePolynomial w d hw hwd M hM D E)) ≤ Real.exp ((p + C) ^ C) ∧ + (∀ i, realPolynomialMass (scaleMvPolynomialAxes T + (detectedTranslationBaseCoordinatePolynomial w d hw hwd M hM D E i)) ≤ Real.exp ((p + C) ^ C)) ∧ + realPolynomialCoefficientGrid q (detectedTranslationPhasePolynomial w d hw hwd M hM D Q) ∧ + (∀ i, realPolynomialCoefficientGrid q + (detectedTranslationBaseCoordinatePolynomial w d hw hwd M hM D Q i)) := by + have hκ : (Fintype.card (WeightedBasisIndex w d) : ℝ) ≤ p := + (Nat.cast_le.mpr (weightedBasisIndex_card_le_pair_basis w d hw b)).trans hι + have hproj : ∀ k i, |(detectedTranslationLogProjectionMatrix w d hw b ω k i : ℝ)| ≤ Real.exp p := by + intro k i + exact (rational_abs_real_le_numerator _).trans + ((rationalLogHeight_le_iff _ p).mp + (detectedTranslationLogProjectionMatrix_logHeight w d hw hwd M hM D b ω hp hb k i)).1 + obtain ⟨q₀, hq₀, hq₀bound, hq₀grid⟩ := + exists_detectedTranslationLogCoordinate_grid_of_basis_height w d hw hwd M hM D b ω hN hp hb m hm + have hbudget := (exists_detectedTranslationPhase_budget d).choose_spec.2 + (Fintype.card U) (Fintype.card (WeightedBasisIndex w d)) (Fintype.card ι) + (Fintype.card B) m q₀ p (Real.exp p) (Real.exp p) hp hU hκ hι hB + (Real.exp_pos p).le le_rfl (Real.exp_pos p).le le_rfl hmp hq₀bound + obtain ⟨hbase, hphase, hden⟩ := hbudget + refine ⟨d.factorial * q₀ ^ (d + 1), by positivity, hden, ?_, ?_, ?_, ?_⟩ + · have h := detectedTranslationPhasePolynomial_mass_of_slow w d hw hwd M hM D b ω hN T hT + (Real.exp_pos p).le (Real.exp_pos p).le hproj E hE + exact h.trans (by simpa only [mul_assoc, detectedTranslationCoordinateConstant] using hphase) + · intro i + have h := detectedTranslationBaseCoordinatePolynomial_mass_of_slow w d hw hwd M hM D b ω hN T hT + (Real.exp_pos p).le (Real.exp_pos p).le hproj E hE i + exact h.trans (by simpa only [mul_assoc, detectedTranslationCoordinateConstant] using hbase) + · exact detectedTranslationPhasePolynomial_coefficientGrid w d hw hwd M hM D Q (hq₀grid Q hQ) + · intro i + apply realPolynomialCoefficientGrid_mono (show q₀ ∣ d.factorial * q₀ ^ (d + 1) from + dvd_mul_of_dvd_right (dvd_pow_self q₀ (by omega : d + 1 ≠ 0)) _) + rw [detectedTranslationBaseCoordinatePolynomial_eq_logCoordinate] + exact hq₀grid Q hQ (Sum.inl i) + +end PolynomialTranslationLie +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DifferenceEventSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DifferenceEventSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6cfdcae1c0773019cf6d71241d752fd060bbb37 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DifferenceEventSupport.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Probability.DifferenceEventProbability + +namespace OAI + +section + +namespace Erdos3.CyclicCrootSisask + +open scoped BigOperators Pointwise + +variable {N : ℕ} + +theorem differenceEventProbability_self_zero (A : Finset (ZMod N)) (hA : A.Nonempty) : + differenceEventProbability A A (A - A) 0 = 1 := by + unfold differenceEventProbability + have hone : ∀ a ∈ A, ∀ b ∈ A, realSetIndicator (A - A) (a - b + 0) = 1 := by + intro a ha b hb + simp only [add_zero, realSetIndicator, ite_eq_left (Finset.mem_sub.mpr ⟨a, ha, b, hb, rfl⟩)] + calc + (𝔼 a ∈ A, 𝔼 b ∈ A, realSetIndicator (A - A) (a - b + 0)) = + 𝔼 _a ∈ A, 𝔼 _b ∈ A, (1 : ℝ) := by + apply Finset.expect_congr rfl + intro a ha + apply Finset.expect_congr rfl + intro b hb + exact hone a ha b hb + _ = 1 := by rw [Finset.expect_const hA, Finset.expect_const hA] + +theorem exists_difference_event_of_probability_pos + (A₁ A₂ K : Finset (ZMod N)) (t : ZMod N) + (h : 0 < differenceEventProbability A₁ A₂ K t) : + ∃ a ∈ A₁, ∃ b ∈ A₂, a - b + t ∈ K := by + classical + by_contra hnone + push Not at hnone + have hz : differenceEventProbability A₁ A₂ K t = 0 := by + unfold differenceEventProbability + calc + (𝔼 a ∈ A₁, 𝔼 b ∈ A₂, realSetIndicator K (a - b + t)) = + 𝔼 _a ∈ A₁, 𝔼 _b ∈ A₂, (0 : ℝ) := by + apply Finset.expect_congr rfl + intro a ha + apply Finset.expect_congr rfl + intro b hb + simp only [realSetIndicator, ite_eq_right (hnone a ha b hb)] + _ = 0 := by simp + linarith + +theorem mem_fourfold_difference_of_probability_pos (A : Finset (ZMod N)) (t : ZMod N) + (h : 0 < differenceEventProbability A A (A - A) t) : t ∈ 2 • A - 2 • A := by + obtain ⟨a, ha, b, hb, hab⟩ := exists_difference_event_of_probability_pos A A (A - A) t h + obtain ⟨c, hc, d, hd, hcd⟩ := Finset.mem_sub.mp hab + have htwo : 2 • A = A + A := two_nsmul A + rw [htwo] + apply Finset.mem_sub.mpr + refine ⟨c + b, Finset.mem_add.mpr ⟨c, hc, b, hb, rfl⟩, + d + a, Finset.mem_add.mpr ⟨d, hd, a, ha, rfl⟩, ?_⟩ + calc + (c + b) - (d + a) = (c - d) - (a - b) := by abel + _ = (a - b + t) - (a - b) := by rw [hcd] + _ = t := by abel + +end Erdos3.CyclicCrootSisask + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DilationPairCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DilationPairCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..efff1d44a1c037d4753f8fa2bcdcb375821c77ca --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DilationPairCoordinates.lean @@ -0,0 +1,70 @@ +import Mathlib.Algebra.Module.Rat +import Mathlib.LinearAlgebra.Prod +import Mathlib.Tactic.Abel + +namespace OAI + +section + +namespace Erdos3 + +variable {L : Type*} [AddCommGroup L] [Module ℚ L] + +def scaledPairDifference (q : ℚ) : (L × L) →ₗ[ℚ] L := + LinearMap.fst ℚ L L - q • LinearMap.snd ℚ L L + +@[simp] theorem scaledPairDifference_apply (q : ℚ) (x : L × L) : + scaledPairDifference q x = x.1 - q • x.2 := rfl + +def scaledPairAssemble (q : ℚ) (u v : L) : L × L := (u + q • v, v) + +@[simp] theorem scaledPairDifference_assemble (q : ℚ) (u v : L) : + scaledPairDifference q (scaledPairAssemble q u v) = u := by + simp [scaledPairAssemble] + +theorem scaledPairAssemble_decompose (q : ℚ) (x : L × L) : + scaledPairAssemble q (scaledPairDifference q x) x.2 = x := by + apply Prod.ext <;> simp [scaledPairAssemble] + +def scaledPairLayer (P Q : Submodule ℚ L) (q : ℚ) : Submodule ℚ (L × L) where + carrier := {x | x.1 ∈ P ∧ x.2 ∈ P ∧ scaledPairDifference q x ∈ Q} + zero_mem' := ⟨P.zero_mem, P.zero_mem, by simp⟩ + add_mem' hx hy := ⟨P.add_mem hx.1 hy.1, P.add_mem hx.2.1 hy.2.1, + by simpa only [map_add] using Q.add_mem hx.2.2 hy.2.2⟩ + smul_mem' a x hx := ⟨P.smul_mem a hx.1, P.smul_mem a hx.2.1, + by simpa only [map_smul] using Q.smul_mem a hx.2.2⟩ + +@[simp] theorem mem_scaledPairLayer (P Q : Submodule ℚ L) (q : ℚ) (x : L × L) : + x ∈ scaledPairLayer P Q q ↔ x.1 ∈ P ∧ x.2 ∈ P ∧ x.1 - q • x.2 ∈ Q := Iff.rfl + +def scaledPairLayerEquiv (P Q : Submodule ℚ L) (hQP : Q ≤ P) (q : ℚ) : + (Q × P) ≃ₗ[ℚ] scaledPairLayer P Q q where + toFun x := ⟨scaledPairAssemble q x.1 x.2, + ⟨P.add_mem (hQP x.1.property) (P.smul_mem q x.2.property), x.2.property, + by + rw [scaledPairDifference_assemble] + exact x.1.property⟩⟩ + invFun x := (⟨scaledPairDifference q x.val, x.property.2.2⟩, ⟨x.val.2, x.property.2.1⟩) + left_inv x := by + apply Prod.ext + · exact Subtype.ext (scaledPairDifference_assemble q (x.1 : L) (x.2 : L)) + · rfl + right_inv x := Subtype.ext (scaledPairAssemble_decompose q x.val) + map_add' x y := by + apply Subtype.ext + apply Prod.ext + · simp only [scaledPairAssemble, Prod.fst_add, Prod.snd_add, Submodule.coe_add, smul_add] + abel + · rfl + map_smul' a x := by + apply Subtype.ext + apply Prod.ext + · change a • (x.1 : L) + q • (a • (x.2 : L)) = a • ((x.1 : L) + q • (x.2 : L)) + rw [smul_add, smul_comm q a] + · rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/DivergenceSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/DivergenceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..765b299f0d6e94a074773d6f855192bdb0a923c9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/DivergenceSupport.lean @@ -0,0 +1,121 @@ +import Mathlib.Analysis.Calculus.ContDiff.Operations +import Mathlib.Analysis.Calculus.LineDeriv.IntegrationByParts +import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem continuousLinearMap_coordinate_sum (L : (ι → ℝ) →L[ℝ] ℝ) (v : ι → ℝ) : + L v = ∑ i, v i * L (Pi.single i 1) := by + have hv : (∑ i, v i • Pi.single i (1 : ℝ)) = v := by + ext j + simp [Pi.single_apply] + calc + L v = L (∑ i, v i • Pi.single i (1 : ℝ)) := congrArg L hv.symm + _ = ∑ i, v i * L (Pi.single i 1) := by simp only [map_sum, map_smul, smul_eq_mul] + +noncomputable def coordinateDivergence (Q : ι → (ι → ℝ) → ℝ) (x : ι → ℝ) : ℝ := + ∑ i, fderiv ℝ (Q i) x (Pi.single i 1) + +theorem coordinateDivergence_continuous (Q : ι → (ι → ℝ) → ℝ) + (hQ : ∀ i, ContDiff ℝ 1 (Q i)) : Continuous (coordinateDivergence Q) := by + apply continuous_finsetSum + intro i _ + exact ((hQ i).continuous_fderiv (by norm_num)).clm_apply continuous_const + +theorem coordinateDivergence_hasCompactSupport (Q : ι → (ι → ℝ) → ℝ) + (hQ : ∀ i, HasCompactSupport (Q i)) : HasCompactSupport (coordinateDivergence Q) := by + have h := HasCompactSupport.finset_sum (s := Finset.univ) + (fun i _ => (hQ i).fderiv_apply ℝ (Pi.single i 1)) + have heq : (∑ i, fun x => fderiv ℝ (Q i) x (Pi.single i 1)) = coordinateDivergence Q := by + ext x + simp [coordinateDivergence] + rw [heq] at h + exact h + +theorem coordinate_vectorField_integration_by_parts (Q : ι → (ι → ℝ) → ℝ) + (hQ : ∀ i, ContDiff ℝ 1 (Q i)) (hs : ∀ i, HasCompactSupport (Q i)) + (ψ : (ι → ℝ) → ℝ) (hψ : ContDiff ℝ 1 ψ) : + (∫ x, fderiv ℝ ψ x (fun i => Q i x)) = - ∫ x, coordinateDivergence Q x * ψ x := by + have hDQ (i : ι) : Continuous (fun x => fderiv ℝ (Q i) x (Pi.single i 1)) := + ((hQ i).continuous_fderiv (by norm_num)).clm_apply continuous_const + have hDψ (i : ι) : Continuous (fun x => fderiv ℝ ψ x (Pi.single i 1)) := + (hψ.continuous_fderiv (by norm_num)).clm_apply continuous_const + have hleft (i : ι) : Integrable (fun x => Q i x * fderiv ℝ ψ x (Pi.single i 1)) := + ((hQ i).continuous.mul (hDψ i)).integrable_of_hasCompactSupport ((hs i).mul_right) + have hright (i : ι) : Integrable (fun x => fderiv ℝ (Q i) x (Pi.single i 1) * ψ x) := + ((hDQ i).mul hψ.continuous).integrable_of_hasCompactSupport + (((hs i).fderiv_apply ℝ (Pi.single i 1)).mul_right) + have hprod (i : ι) : Integrable (fun x => Q i x * ψ x) := + ((hQ i).continuous.mul hψ.continuous).integrable_of_hasCompactSupport ((hs i).mul_right) + have hibp (i : ι) : (∫ x, Q i x * fderiv ℝ ψ x (Pi.single i 1)) = + -∫ x, fderiv ℝ (Q i) x (Pi.single i 1) * ψ x := + integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable (hright i) (hleft i) (hprod i) + (fun x _ => (hQ i).differentiable (by norm_num) x) + (fun x _ => hψ.differentiable (by norm_num) x) + calc + (∫ x, fderiv ℝ ψ x (fun i => Q i x)) = + ∫ x, ∑ i, Q i x * fderiv ℝ ψ x (Pi.single i 1) := by + apply integral_congr_ae + filter_upwards [] with x + exact continuousLinearMap_coordinate_sum _ _ + _ = ∑ i, ∫ x, Q i x * fderiv ℝ ψ x (Pi.single i 1) := + integral_finsetSum _ (fun i _ => hleft i) + _ = -(∑ i, ∫ x, fderiv ℝ (Q i) x (Pi.single i 1) * ψ x) := by + simp only [hibp, Finset.sum_neg_distrib] + _ = -(∫ x, ∑ i, fderiv ℝ (Q i) x (Pi.single i 1) * ψ x) := by + rw [integral_finsetSum _ (fun i _ => hright i)] + _ = -∫ x, coordinateDivergence Q x * ψ x := by + simp only [coordinateDivergence, Finset.sum_mul] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem coordinateDivergence_tsupport_subset + (Q : ι → (ι → ℝ) → ℝ) {K : Set (ι → ℝ)} (hK : IsClosed K) + (hQ : ∀ i, tsupport (Q i) ⊆ K) : tsupport (coordinateDivergence Q) ⊆ K := by + apply closure_minimal _ hK + intro x hx + by_contra hxK + have hzero : coordinateDivergence Q x = 0 := by + apply Finset.sum_eq_zero + intro i _ + have hnot : x ∉ tsupport (fun y => fderiv ℝ (Q i) y (Pi.single i 1)) := + fun h => hxK (hQ i ((tsupport_fderiv_apply_subset ℝ (Pi.single i 1)) h)) + exact image_eq_zero_of_notMem_tsupport + (f := fun y => fderiv ℝ (Q i) y (Pi.single i 1)) (x := x) hnot + exact hx hzero + +theorem integral_abs_divergence_eq_setIntegral + (Q : ι → (ι → ℝ) → ℝ) (w : (ι → ℝ) → ℝ) (hQ : ∀ i, tsupport (Q i) ⊆ tsupport w) + {s : Set (ι → ℝ)} (hs : tsupport w ⊆ s) : + (∫ x, |coordinateDivergence Q x|) = ∫ x in s, |coordinateDivergence Q x| := by + symm + apply setIntegral_eq_integral_of_forall_compl_eq_zero + intro x hx + rw [image_eq_zero_of_notMem_tsupport (fun h => + hx (hs (coordinateDivergence_tsupport_subset Q (isClosed_tsupport w) hQ h))), abs_zero] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/EmbeddingCoordinateHeight.lean b/lean/OAI/Combinatorics/Progressions/Geometry/EmbeddingCoordinateHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..69c977dbbc7effe41dcbb57a655151bb7f991c40 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/EmbeddingCoordinateHeight.lean @@ -0,0 +1,54 @@ +import OAI.Combinatorics.Progressions.Estimates.RationalPowerHeight + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped Matrix + +theorem embedding_basis_coordinate_height {ι κ L M : Type*} [Fintype ι] [Fintype κ] + [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + (b : Basis κ ℚ M) (e : Basis ι ℚ L) (φ : M →ₗ[ℚ] L) (hφ : Function.Injective φ) + {H : ℕ} (hH : 1 ≤ H) (hB : ∀ i j, RationalHeightLE (e.repr (φ (b j)) i) H) + (x : M) {K : ℕ} (hx : ∀ i, RationalHeightLE (e.repr (φ x) i) K) (j : κ) : + RationalHeightLE (b.repr x j) + ((Fintype.card ι + 1) * (rationalSolveHeight (Fintype.card κ) H * K) ^ Fintype.card ι) := by + classical + let B := LinearMap.toMatrix b e φ + obtain ⟨P, hPB, hP⟩ := exists_bounded_rational_left_inverse B + (Matrix.mulVec_injective_iff.mp (basisMatrix_injective b e φ hφ)) hH + (by simpa only [B, LinearMap.toMatrix_apply] using hB) + have hretract : P *ᵥ e.repr (φ x) = b.repr x := by + rw [← LinearMap.toMatrix_mulVec_repr b e φ x, Matrix.mulVec_mulVec, hPB, Matrix.one_mulVec] + rw [← congrFun hretract j] + exact rationalHeightLE_sum (fun i => P j i * e.repr (φ x) i) + (fun i => (hP j i).mul (hx i)) + +theorem embedding_coordinate_height_budget (n d H K : ℕ) {p : ℝ} (hp : 0 ≤ p) + (hn : (n : ℝ) ≤ p) (hd : (d : ℝ) ≤ p) + (hH : (H : ℝ) ≤ Real.exp p) (hK : (K : ℝ) ≤ Real.exp p) : + (((n + 1) * (rationalSolveHeight d H * K) ^ n : ℕ) : ℝ) ≤ + Real.exp ((p + 2) ^ 8) := by + have hproduct : ((rationalSolveHeight d H * K : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 6) := by + rw [Nat.cast_mul] + calc + _ ≤ Real.exp ((p + 2) ^ 5) * Real.exp p := + mul_le_mul (rationalSolveHeight_le_budget d H hp hd hH) hK (Nat.cast_nonneg _) (Real.exp_pos _).le + _ = Real.exp ((p + 2) ^ 5 + p) := (Real.exp_add _ _).symm + _ ≤ _ := by + apply Real.exp_le_exp.mpr + have hpp : p ≤ (p + 2) ^ 5 := le_power_budget hp (by decide) + calc + _ ≤ 2 * (p + 2) ^ 5 := by linarith + _ ≤ (p + 2) * (p + 2) ^ 5 := by gcongr; linarith + _ = (p + 2) ^ 6 := by ring + exact rational_sum_cost_le_exp n _ hp 6 1 hproduct (by simpa only [pow_one] using hn.trans (by linarith)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/EmptyCubeCoordinate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/EmptyCubeCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..f933f742a408ce5e036eb9465561ab3595af0ef1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/EmptyCubeCoordinate.lean @@ -0,0 +1,30 @@ +import OAI.Combinatorics.Progressions.Estimates.ComplexFiniteMeans + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def emptyCubeCoordinateEquiv (X : Type*) : (Option Empty → X) ≃ X where + toFun x := x none + invFun x := fun _ => x + left_inv x := by + funext i + cases i with + | none => rfl + | some a => exact a.elim + right_inv _ := rfl + +theorem expect_emptyCubeCoordinate {X M : Type*} [Fintype X] + [AddCommMonoid M] [Module ℚ≥0 M] (F : X → M) : + (𝔼 x : Option Empty → X, F (x none)) = 𝔼 x : X, F x := + Fintype.expect_equiv (emptyCubeCoordinateEquiv X) _ _ (fun _ => rfl) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/EmptyLayerChartBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/EmptyLayerChartBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9ee90fec67f8ac90983177be654a2947d0d5b5e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/EmptyLayerChartBounds.lean @@ -0,0 +1,103 @@ +import OAI.Combinatorics.Progressions.Linear.NormalizedBasisBounds +import OAI.Combinatorics.Progressions.Linear.OrthogonalBasisChart +import OAI.Combinatorics.Progressions.Sampling.SamplingRankProjectedContainment + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule MeasureTheory +open scoped BigOperators + +variable {E : Type*} {n : ℕ} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] + +noncomputable def normalizedOrthogonalChart (W : Submodule ℝ E) (b : Basis (Fin n) ℝ Wᗮ) : + E ≃L[ℝ] W × (Fin n → ℝ) := orthogonalBasisChart W (normalizedAxisBasis b) + +theorem normalizedOrthogonalChart_apply (W : Submodule ℝ E) (b : Basis (Fin n) ℝ Wᗮ) (x : E) : + normalizedOrthogonalChart W b x = (W.orthogonalProjectionOnto x, + fun i => b.equivFun (Wᗮ.orthogonalProjectionOnto x) i / (basisAxisScale b i : ℝ)) := by + rw [normalizedOrthogonalChart, orthogonalBasisChart_apply] + refine Prod.ext rfl ?_ + funext i + exact normalizedAxisBasis_coordinates b _ i + +theorem normalizedOrthogonalChart_integer_coordinates (W : Submodule ℝ E) + (b : Basis (Fin n) ℝ Wᗮ) (x : E) + (hx : Wᗮ.orthogonalProjectionOnto x ∈ span ℤ (Set.range b)) : + ∃ z : Fin n → ℤ, ∀ i, + (normalizedOrthogonalChart W b x).2 i = (z i : ℝ) / (basisAxisScale b i : ℝ) := by + have h := (b.mem_span_iff_repr_mem ℤ _).mp hx + choose z hz using h + refine ⟨z, ?_⟩ + intro i + rw [normalizedOrthogonalChart_apply] + change b.repr (Wᗮ.orthogonalProjectionOnto x) i / (basisAxisScale b i : ℝ) = _ + rw [← hz i] + simp + +variable [MeasurableSpace E] [BorelSpace E] + +theorem normalizedOrthogonalChart_norm_le (W : Submodule ℝ E) (b : Basis (Fin n) ℝ Wᗮ) + (o : OrthonormalBasis (Fin n) ℝ Wᗮ) {B D : ℝ} (hB : 0 ≤ B) (hD : 0 < D) + (hb : ∀ i, ‖b i‖ ≤ B) + (hprod : (∏ i, ‖b i‖) ≤ D * ZLattice.covolume (span ℤ (Set.range b))) (x : E) : + ‖normalizedOrthogonalChart W b x‖ ≤ + (1 + (n : ℝ) * n.factorial * (B + 1) ^ (n - 1) * D) * ‖x‖ := by + apply orthogonalBasisChart_norm_le W (normalizedAxisBasis b) (by positivity) + exact normalizedAxisBasis_coordinates_bound o b hB hD hb hprod + +omit [MeasurableSpace E] [BorelSpace E] in +theorem normalizedOrthogonalChart_symm_norm_le (W : Submodule ℝ E) (b : Basis (Fin n) ℝ Wᗮ) + {B : ℝ} (hB : 0 ≤ B) (hb : ∀ i, ‖b i‖ ≤ B) (p : W × (Fin n → ℝ)) : + ‖(normalizedOrthogonalChart W b).symm p‖ ≤ (1 + (n : ℝ) * (B + 1)) * ‖p‖ := by + apply orthogonalBasisChart_symm_norm_le W (normalizedAxisBasis b) (by positivity) + exact normalizedAxisBasis_synthesis_bound b hb + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module + +variable {D : Type*} [Fintype D] [IsEmpty D] {n : ℕ} + +theorem normalizedOrthogonalChart_norm_le_zero_of_isEmpty + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) + (x : EuclideanSpace ℝ D) : + ‖normalizedOrthogonalChart W b x‖ ≤ 0 * ‖x‖ := by + have hx : x = 0 := Subsingleton.elim _ _ + simp [hx] + +theorem normalizedOrthogonalChart_symm_norm_le_zero_of_isEmpty + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) + (x : W × (Fin n → ℝ)) : + ‖(normalizedOrthogonalChart W b).symm x‖ ≤ 0 * ‖x‖ := by + have hx : (normalizedOrthogonalChart W b).symm x = 0 := Subsingleton.elim _ _ + simp [hx] + +theorem hasLayerSamplingRank_of_isEmpty {I J : Type*} [Fintype J] [IsEmpty J] + (h : ℕ) (T : I → ℝ) (R : ℝ) (W : Submodule ℝ (J → ℝ)) + (p : VectorPolynomial I ℝ (J → ℝ)) : HasLayerSamplingRank h T R W p := by + intro a ha hw + obtain ⟨w, hw⟩ := hw + simp at hw + +theorem VectorPolynomial.degreeLE_of_subsingleton + {σ R V : Type*} [CommRing R] [AddCommGroup V] [Module R V] [Subsingleton V] + (w : σ → ℕ) (d : ℕ) (p : VectorPolynomial σ R V) : DegreeLE w d p := by + intro α hα + exact Subsingleton.elim _ _ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/Erdos3AllocatedZeroLayerDetectionTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/Erdos3AllocatedZeroLayerDetectionTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf23c849564dec51a531ed548f8c1dd8c4ebd966 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/Erdos3AllocatedZeroLayerDetectionTransport.lean @@ -0,0 +1,62 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedZeroLayerFixedCenterExcess + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule BooleanCubeKernel +open scoped BigOperators Classical + +variable {G X : Type} [Fintype G] [Fintype X] + {I J : Fin 0 → Type} [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] + {n : Fin 0 → ℕ} {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin 0 → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} + {hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {N : X → ℕ} {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} + {hm : ∀ j e, coefficients (poly j) e ∈ U j} + {τ ξ ξ' : ℝ} {stride : X → ℕ} + {cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)} + {center center' : CoefficientTorus (K := LayerSamplerVariables G I n B) U} + +namespace AllocatedExternalCandidateSampler + +theorem changeNarrow_zero_layers_typeZero + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ stride cells center) (hξ' : 0 < ξ') : + AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ' stride cells center' := by + apply allocatedExternalCandidateSampler_zero_layers B U b S hb o hR hσ poly hm + center' N τ ξ' stride cells A.size_pos A.trim_pos hξ' A.stride_pos A.bases_nonempty + simpa only [allocatedExternalCandidateWidths_zero_layers] using A.smooth_mass_pos + +variable [∀ j, IsZLattice ℝ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + +theorem nativeDetection_zero_layers_typeZero_iff + (A : AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ stride cells center) + (A' : AllocatedExternalCandidateSampler B U b S hb o hR hσ + N poly hm τ ξ' stride cells center') + (degree : ℕ) (pSlice pTest pNative α : ℝ) : + A.NativeDetection degree pSlice pTest pNative α ↔ + A'.NativeDetection degree pSlice pTest pNative α := by + unfold NativeDetection + simp only [law_zero_layers] + unfold physical Path Site sides + generalize_proofs hbox hbase hpos hmass hpos' hmass' + revert hpos hmass hpos' hmass' + rw [allocatedExternalCandidateWidths_zero_layers, allocatedExternalCandidateWidths_zero_layers] + intros + rfl + +end AllocatedExternalCandidateSampler +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ExplicitMixedUniformBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ExplicitMixedUniformBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e5f999dc65939127b82d3f48333f9a553eb3a9a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ExplicitMixedUniformBox.lean @@ -0,0 +1,221 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedSelectedOneSite + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule MeasureTheory VectorPolynomial +open scoped BigOperators NNReal + +theorem exists_mixed_selected_sampler_uniform_box_law (m : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {X G : Type*} [Fintype X] [DecidableEq X] [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (R σ : Fin m → ℝ) (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (_hσ1 : ∀ j, σ j ≤ 1) + (C V : Fin m → ℝ≥0) + (_hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ)+1) * R j ≤ 1/4) + (L₀ : ℕ) {P δ : ℝ} (_hP : 0 ≤ P) (_hδ : 0 < δ) (_hδsmall : δ ≤ 1/6) + (_hδP : δ⁻¹ ≤ Real.exp P) (_hX : (Fintype.card X : ℝ) ≤ P) + (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) (_hL₀P : (L₀ : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (root : LayerSamplerVariables G I n B → ℤ) (_hroot : ∀ k, |(root k : ℝ)| ≤ Real.exp P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val+1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) + (stride : X → ℕ) (_hs : ∀ k, 0 < stride k) + {Rrank S ρ : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) + (_hρ : 0 < ρ) (_hρP : 1/ρ ≤ Real.exp P) + (H : X → ℝ) (_hsize : ∀ k, Real.exp ((P+A)^A) ≤ H k) + (_hrank : ∀ j, HasLayerSamplingRank (j.val+1) H Rrank (U j) (p j)) + (_hRrank : Real.exp ((P+A)^A) ≤ Rrank) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty) + (W : Option (LayerSamplerVariables G I n B) × X → ℝ) (hW : ∀ z, 0 < W z) + (_hwidth : ∀ z, ρ * H z.2 ≤ W z) + (N margin : X → ℕ) (_hmargin : ∀ i, 2 * margin i < N i) + (_hfit : ∀ i, physicalSiteWidth root W i ≤ (margin i : ℝ)), + let pa := fun (a : X → ℤ) j => translate (fun i => (a i : ℝ)) (p j) + let hma := fun (a : X → ℤ) j => coefficients_translate_mem (U j) (fun i => (a i : ℝ)) (p j) (hm j) + let D := fun a center => translatedSelectedPhysicalDensity (G := G) B U b hb o R σ hR hσ L₀ + (coefficientConstantCenter U center) (pa a) (hma a) + let Z := fun a center => selectedResidueDensityMass stride T W (D a center) + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride T W z, + ∃ hD : ∀ a center, 0 < Z a center, + (∀ a center, |Z a center-1| ≤ 3*δ ∧ 1/2 ≤ Z a center ∧ Z a center ≤ 3/2) ∧ + ∀ φ : (X → ℝ) → ℂ, (∀ v, ‖φ v‖ ≤ 1) → + ‖(𝔼 a ∈ trimmedIntegerBox N margin, + ∫ center, ∑' z, ((selectedResidueDensityPMF stride T W hW hZ (D a center) + (translatedSelectedPhysicalDensity_nonneg (G := G) B U b hb o R σ hR hσ L₀ + (coefficientConstantCenter U center) (pa a) (hma a)) (hD a center) z).toReal : ℂ) * + φ ((fun i => (a i : ℝ)) + physicalAffineSite root z) ∂μ) - + (𝔼 x ∈ integerBox N, φ (fun i => (x i : ℝ)))‖ ≤ + 6*δ + 2 * ∑ i, 2 * (margin i : ℝ) / N i := by + obtain ⟨A, hA, hlaw⟩ := exists_mixed_center_selected_sampler_oneSite_law m + refine ⟨A, hA, ?_⟩ + intro X G _ _ _ I _ n B _ J _ U b hb o _ _ _ _ μ _ _ ν _ _ + R σ hR hσ hσ1 C V hC hV Cinv hCinv hchart hsmall L₀ P δ hP hδ hδsmall hδP + hX hK hI hn hJ hAP hL₀P hCP hVP hRP hσP root hroot p hp hm stride hs Rrank S ρ + hS hSP hstride hρ hρP H hsize hrank hRrank T hT W hW hwidth N margin hmargin hfit + let pa := fun (a : X → ℤ) j => translate (fun i => (a i : ℝ)) (p j) + let hma := fun (a : X → ℤ) j => coefficients_translate_mem (U j) (fun i => (a i : ℝ)) (p j) (hm j) + have hlocal (a : X → ℤ) := hlaw B U b hb o μ ν R σ hR hσ hσ1 C V hC hV + Cinv hCinv hchart hsmall L₀ hP hδ hδsmall hδP hX hK hI hn hJ hAP hL₀P hCP hVP hRP hσP + root hroot (pa a) + (fun j => degreeLE_translate (1 : X → ℕ) (fun _ => by norm_num) _ (p j) (hp j)) + (hma a) stride hs hS hSP hstride hρ hρP H hsize + (fun j => (hasLayerSamplingRank_translate_iff _ _ H Rrank (U j) (p j) (hp j)).mpr (hrank j)) + hRrank T hT W hW hwidth + choose hZ hD hrest using hlocal + refine ⟨hZ 0, hD, fun a => (hrest a).1, ?_⟩ + intro φ hφ + refine selectedResidue_trimmed_comparison_transfer root N margin hmargin stride T W hW (hZ 0) + hfit (fun x => φ (fun i => (x i : ℝ))) (fun x _ => hφ _) _ ?_ + intro a _ + have h := (hrest a).2 (fun v => φ ((fun i => (a i : ℝ)) + v)) (fun v => hφ _) + have hcast (z : Option (LayerSamplerVariables G I n B) × X → ℤ) : + (fun i => ((a + integerPhysicalSite root z) i : ℝ)) = + (fun i => (a i : ℝ)) + physicalAffineSite root z := by + funext i + simp only [Pi.add_apply, Int.cast_add, integerPhysicalSite_cast_apply] + simpa only [hcast] using h + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule MeasureTheory VectorPolynomial +open scoped BigOperators NNReal + +theorem exists_explicit_mixed_uniform_box_sampler (m : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {X G : Type*} [Fintype X] [DecidableEq X] [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (R σ : Fin m → ℝ) (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (_hσ1 : ∀ j, σ j ≤ 1) + (C V : Fin m → ℝ≥0) + (_hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ)+1) * R j ≤ 1/4) + (L₀ : ℕ) {P δ : ℝ} (_hP : 0 ≤ P) (_hδ : 0 < δ) (_hδsmall : δ ≤ 1/6) + (_hδP : δ⁻¹ ≤ Real.exp P) (_hX : (Fintype.card X : ℝ) ≤ P) + (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) (_hL₀P : (L₀ : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (root : LayerSamplerVariables G I n B → ℤ) (_hroot : ∀ k, |(root k : ℝ)| ≤ Real.exp P) + (τ : ℝ) (_hτ : 0 < τ) (_hτhalf : τ ≤ 1/2) (_hτP : τ⁻¹ ≤ Real.exp P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val+1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) + (stride : X → ℕ) (_hs : ∀ k, 0 < stride k) + {Rrank S : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) + (N : X → ℕ) (_hsize : ∀ k, Real.exp ((P+A)^A) ≤ (N k : ℝ)) + (_hrank : ∀ j, HasLayerSamplingRank (j.val+1) (fun i => (N i : ℝ)) Rrank (U j) (p j)) + (_hRrank : Real.exp ((P+A)^A) ≤ Rrank) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty), + let W := trimmedSpatialWidths (K := LayerSamplerVariables G I n B) (Real.exp (2*P)) τ N + let margin := spatialTrimMargin τ N + let pa := fun (a : X → ℤ) j => translate (fun i => (a i : ℝ)) (p j) + let hma := fun (a : X → ℤ) j => coefficients_translate_mem (U j) (fun i => (a i : ℝ)) (p j) (hm j) + let D := fun a center => translatedSelectedPhysicalDensity (G := G) B U b hb o R σ hR hσ L₀ + (coefficientConstantCenter U center) (pa a) (hma a) + let Z := fun a center => selectedResidueDensityMass stride T W (D a center) + ∃ hW : ∀ z, 0 < W z, + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride T W z, + ∃ hD : ∀ a center, 0 < Z a center, + (∀ a center, |Z a center-1| ≤ 3*δ ∧ 1/2 ≤ Z a center ∧ Z a center ≤ 3/2) ∧ + ∀ φ : (X → ℝ) → ℂ, (∀ v, ‖φ v‖ ≤ 1) → + ‖(𝔼 a ∈ trimmedIntegerBox N margin, + ∫ center, ∑' z, ((selectedResidueDensityPMF stride T W hW hZ (D a center) + (translatedSelectedPhysicalDensity_nonneg (G := G) B U b hb o R σ hR hσ L₀ + (coefficientConstantCenter U center) (pa a) (hma a)) (hD a center) z).toReal : ℂ) * + φ ((fun i => (a i : ℝ)) + physicalAffineSite root z) ∂μ) - + (𝔼 x ∈ integerBox N, φ (fun i => (x i : ℝ)))‖ ≤ + 6*δ + 2 * (Fintype.card X : ℝ) * τ := by + obtain ⟨A₀, _, hlaw⟩ := exists_mixed_selected_sampler_uniform_box_law m + let A := 2*A₀+256 + have hA : 256 ≤ A := by dsimp [A]; omega + refine ⟨A, by omega, ?_⟩ + intro X G _ _ _ I _ n B _ J _ U b hb o _ _ _ _ μ _ _ ν _ _ + R σ hR hσ hσ1 C V hC hV Cinv hCinv hchart hsmall L₀ P δ hP hδ hδsmall hδP + hX hK hI hn hJ hAP hL₀P hCP hVP hRP hσP root hroot τ hτ hτhalf hτP p hp hm + stride hs Rrank S hS hSP hstride N hsize hrank hRrank T hT + have hPQ := le_spatialSamplingBudget hP + have he := Real.exp_le_exp.mpr hPQ + have hthreshold := spatial_threshold_dominates hP hA (show 2*A₀ ≤ A by dsimp [A]; omega) + have hN (i) : 0 < N i := by + have := four_le_of_spatial_threshold hP hA (N i) (hsize i) + omega + have hmarginSize (i) : 4 ≤ τ * (N i : ℝ) := + spatialTrimMargin_size_of_exp_size hP hτ hτP + ((spatial_threshold_large hP hA).trans (hsize i)) + let W := trimmedSpatialWidths (K := LayerSamplerVariables G I n B) (Real.exp (2*P)) τ N + have hW : ∀ z, 0 < W z := trimmedSpatialWidths_pos (Real.exp_pos _).le hτ N hN + have hrootSum := root_sum_le_spatial_budget hK root hroot + obtain ⟨hZ, hD, hclose, htest⟩ := + hlaw B U b hb o μ ν R σ hR hσ hσ1 C V hC hV + Cinv hCinv hchart hsmall L₀ (hP.trans hPQ) hδ hδsmall (hδP.trans he) + (hX.trans hPQ) (hK.trans hPQ) + (fun j => (hI j).trans hPQ) (fun j => (hn j).trans hPQ) (fun j => (hJ j).trans hPQ) + (hAP.trans he) (hL₀P.trans he) (fun j => (hCP j).trans he) (fun j => (hVP j).trans he) + (fun j => (hRP j).trans he) (fun j => (hσP j).trans he) + root (fun k => (hroot k).trans he) p hp hm stride hs hS (hSP.trans he) hstride + (spatialWidthFraction_pos P hτ) (spatialWidthFraction_inv_le hP hτ hτP) + (fun i => (N i : ℝ)) (fun i => hthreshold.trans (hsize i)) hrank (hthreshold.trans hRrank) + T hT W hW (spatialWidthFraction_le_trimmed_width P hτ.le N) + N (spatialTrimMargin τ N) (spatialTrimMargin_proper hτhalf N hN hmarginSize) + (spatialTrimMargin_fits (Real.exp_pos _).le hτ.le root hrootSum N) + refine ⟨hW, hZ, hD, hclose, ?_⟩ + intro φ hφ + exact (htest φ hφ).trans (add_le_add (le_refl (6*δ)) + (spatialTrimMargin_error_bound N hN hmarginSize)) + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FastCoefficientDerivativeCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FastCoefficientDerivativeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..532b13006c8071af031f43e48075a66d013d71ad --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FastCoefficientDerivativeCoordinates.lean @@ -0,0 +1,341 @@ +import OAI.Combinatorics.Progressions.Dynamics.FastCoefficientDimensionBudget +import OAI.Combinatorics.Progressions.Estimates.ControlledRealFastCoefficientAction + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix + +theorem exists_controlled_real_fast_coefficient_coordinates + {σ ι κ L : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype κ] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) (w : σ → ℕ) + [Fintype (ReducedSquareSymbolIndex s w ω)] [Fintype (QuotientTopSymbolIndex s w ω)] + [Fintype (FirstCoefficientIndex w ω)] [DecidableEq (FirstCoefficientIndex w ω)] + (hw : ∀ i, 0 < w i) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol w)) + (hU : BasisBlockInvariant (F.reducedSquareSymbolBasis e ω hF w) (fun i => i.val.1) U.toSubmodule) + (v : κ → F.squareFiltration.quotientTop.PolynomialSymbol w) + (hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) {H : ℕ} (hH : 1 ≤ H) + (hv : ∀ i j, RationalHeightLE ((F.reducedSquareSymbolBasis e ω hF w).repr (v i) j) H) + {p : ℝ} (hp : 0 ≤ p) + (hn : (Fintype.card (ReducedSquareSymbolIndex s w ω) : ℝ) ≤ p) + (hm : (Fintype.card κ : ℝ) ≤ p) + (hq : (Fintype.card (QuotientTopSymbolIndex s w ω) : ℝ) ≤ p) + (hd : (Fintype.card (FirstCoefficientIndex w ω) : ℝ) ≤ p) + (hdm : ((Fintype.card (FirstCoefficientIndex w ω) * Fintype.card κ : ℕ) : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) + (l : ℕ) (hl : 0 < l) (hlp : (l : ℝ) ≤ Real.exp p) : + ∃ d : ℕ, d ≤ Fintype.card (FirstCoefficientIndex w ω) ∧ + ∃ rows : Fin d → FirstCoefficientIndex w ω, Function.Injective rows ∧ + ∃ b : Basis (Fin d) ℝ (F.RealFirstCoefficientModule w ⧸ + F.realFirstCoefficientFastSubmodule w hw (F.reducedSquareFastRelativeSubmodule w U)), + ∃ R : (Fin d → ℝ) →ₗ[ℝ] F.RealFirstCoefficientModule w, + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + 2) ^ 2958) ∧ l ∣ m ∧ + (∀ x, F.FirstCoefficientGrid e ω hF w l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ x) ∈ realDenominatorGrid m) ∧ + (∀ y : Fin d → ℝ, y ∈ realDenominatorGrid l → + F.FirstCoefficientGrid e ω hF w m (R y)) ∧ + (∀ y : Fin d → ℝ, (F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ (R y) = b.equivFun.symm y) ∧ + (∀ (T : σ → ℝ), (∀ i, 0 < T i) → ∀ M : ℝ, 0 ≤ M → + (∀ x, F.FirstCoefficientSlowBound e ω hF w T M x → ∀ i, + |b.equivFun ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ x) i| ≤ + Real.exp ((p + 2) ^ 2958) * M / monomialScale T (rows i).val.1) ∧ + (∀ y : Fin d → ℝ, (∀ i, |y i| ≤ M / monomialScale T (rows i).val.1) → + F.FirstCoefficientSlowBound e ω hF w T (Real.exp ((p + 2) ^ 2958) * M) (R y))) ∧ + (∀ i j, (rows j).val.1 ≠ i.val.1 → + b.repr ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ + (F.realFirstCoefficientBasis e ω hF w i)) j = 0) ∧ + ∀ (g : F.RealAdaptedPolynomialGroup w) + (hg : (F.adaptedReducedRealSymbolHom w g).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra w U)) + (a c : Fin d), ω (rows a).val.2 ≤ ω (rows c).val.2 → + LinearMap.toMatrix b b (F.realFastCoefficientAdjoint w hw U g hg).toLinearMap a c = + (1 : Matrix (Fin d) (Fin d) ℝ) a c := by + have hb := F.exists_real_fast_coefficient_unitriangular_basis e ω hF w hw U hU + v hspan hH hv hp hn hm hq hd hdm hHp + obtain ⟨d, hdim, rows, hinj, b, D, S, hD, hDS, hDb, hSb, hDh, hSh, _, haction⟩ := hb + have hDh' : ∀ i j, ((D i j).num.natAbs : ℝ) ≤ Real.exp ((p + 2) ^ 2954) ∧ + ((D i j).den : ℝ) ≤ Real.exp ((p + 2) ^ 2954) := by + have hpow : Real.exp ((p + 2) ^ 420) ≤ Real.exp ((p + 2) ^ 2954) := + Real.exp_le_exp.mpr (pow_le_pow_right₀ (by linarith) (by decide)) + exact fun i j => ⟨(hDh i j).1.trans hpow, (hDh i j).2.trans hpow⟩ + have hd' : (Fintype.card (Fin d) : ℝ) ≤ p := by + rw [Fintype.card_fin] + exact (Nat.cast_le.mpr hdim).trans hd + have hc := controlled_weighted_quotient_coordinates (F.realFirstCoefficientBasis e ω hF w) b + (F.realFirstCoefficientFastSubmodule w hw (F.reducedSquareFastRelativeSubmodule w U)).mkQ + (fun i => i.val.1) (fun i => (rows i).val.1) D S hD hDS hDb hSb hp hd hd' + 2954 (by decide) hDh' hSh l hl hlp + obtain ⟨m, hmpos, hmbound, hlm, hgrid, hRgrid, hR, hweighted⟩ := hc + refine ⟨d, hdim, rows, hinj, b, rationalCoordinateSection (F.realFirstCoefficientBasis e ω hF w) S, + m, hmpos, hmbound, hlm, hgrid, hRgrid, hR, ?_, ?_, haction⟩ + · intro T hT M hM + exact hweighted (monomialScale T) (monomialScale_pos T hT) M hM + · intro i j hij + have h := congrArg (fun A => A j i) hD + simpa only [LinearMap.toMatrix_apply, Matrix.map_apply, hDb j i hij, map_zero] using h + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix + +def FastCoefficientCoordinateSpec (s C : ℕ) : Prop := + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) (w : σ → ℕ) + (hw : ∀ i, 0 < w i) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol w)) + (_hU : BasisBlockInvariant (F.reducedSquareSymbolBasis e ω hF w) (fun i => i.val.1) U.toSubmodule) + (v : κ → F.squareFiltration.quotientTop.PolynomialSymbol w) + (_hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) {H : ℕ} (_hH : 1 ≤ H) + (_hv : ∀ i j, RationalHeightLE ((F.reducedSquareSymbolBasis e ω hF w).repr (v i) j) H) + {p : ℝ} (_hp : 0 ≤ p) + (_hι : (Fintype.card ι : ℝ) ≤ p) (_hσ : (Fintype.card σ : ℝ) ≤ p) + (_hκ : (Fintype.card κ : ℝ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p) + (l : ℕ) (_hl : 0 < l) (_hlp : (l : ℝ) ≤ Real.exp p), + ∃ d : ℕ, d ≤ Fintype.card ι * (s + 2) * (Fintype.card σ + 1) ^ (s + 1) ∧ + ∃ rows : Fin d → FirstCoefficientIndex w ω, Function.Injective rows ∧ + ∃ b : Basis (Fin d) ℝ (F.RealFirstCoefficientModule w ⧸ + F.realFirstCoefficientFastSubmodule w hw (F.reducedSquareFastRelativeSubmodule w U)), + ∃ R : (Fin d → ℝ) →ₗ[ℝ] F.RealFirstCoefficientModule w, + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + (∀ x, F.FirstCoefficientGrid e ω hF w l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ x) ∈ realDenominatorGrid m) ∧ + (∀ y : Fin d → ℝ, y ∈ realDenominatorGrid l → + F.FirstCoefficientGrid e ω hF w m (R y)) ∧ + (∀ y : Fin d → ℝ, (F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ (R y) = b.equivFun.symm y) ∧ + (∀ (T : σ → ℝ), (∀ i, 0 < T i) → ∀ M : ℝ, 0 ≤ M → + (∀ x, F.FirstCoefficientSlowBound e ω hF w T M x → ∀ i, + |b.equivFun ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ x) i| ≤ + Real.exp ((p + C) ^ C) * M / monomialScale T (rows i).val.1) ∧ + (∀ y : Fin d → ℝ, (∀ i, |y i| ≤ M / monomialScale T (rows i).val.1) → + F.FirstCoefficientSlowBound e ω hF w T (Real.exp ((p + C) ^ C) * M) (R y))) ∧ + (∀ i j, (rows j).val.1 ≠ i.val.1 → + b.repr ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ + (F.realFirstCoefficientBasis e ω hF w i)) j = 0) ∧ + ∀ (g : F.RealAdaptedPolynomialGroup w) + (hg : (F.adaptedReducedRealSymbolHom w g).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra w U)) + (a c : Fin d), ω (rows a).val.2 ≤ ω (rows c).val.2 → + LinearMap.toMatrix b b (F.realFastCoefficientAdjoint w hw U g hg).toLinearMap a c = + (1 : Matrix (Fin d) (Fin d) ℝ) a c + +theorem exists_fast_coefficient_coordinate_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ FastCoefficientCoordinateSpec s C := by + let Q : Polynomial ℕ := + 3 * (Polynomial.X + Polynomial.C (s + 2)) ^ (s + 2) * (Polynomial.X + 1) + + 2 * Polynomial.X + 2 + + (Polynomial.X + Polynomial.C (s + 3)) ^ (s + 3) * (Polynomial.X + 1) + Polynomial.X + 2 + let B : Polynomial ℕ := (Q + 2) ^ 2958 + have hexists := exists_natPolynomial_eval_budget B + obtain ⟨C, hC, hbound⟩ := hexists + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F e ω hF w hw U hU v hspan H hH hv p hp hι hσ hκ hHp l hl hlp + classical + let : Finite (ReducedSquareSymbolIndex s w ω) := F.reducedSquareSymbolIndex_finite e ω hF w hw + let : Fintype (ReducedSquareSymbolIndex s w ω) := Fintype.ofFinite _ + let : Finite (QuotientTopSymbolIndex s w ω) := F.quotientTopSymbolIndex_finite e ω hF w hw + let : Fintype (QuotientTopSymbolIndex s w ω) := Fintype.ofFinite _ + let : Fintype (FirstCoefficientIndex w ω) := + firstCoefficientIndexFintype w ω (s + 1) hw (F.adaptedBasis_weight_le_step e ω hF) + let q := fastCoefficientMatrixParameter s p + have hq : 0 ≤ q := fastCoefficientMatrixParameter_nonneg s hp + have hpq : p ≤ q := le_fastCoefficientMatrixParameter s hp + have hdims := F.fastCoefficient_matrix_dimensions e ω hF w hw hp hι hσ hκ + have hfinal : (q + 2) ^ 2958 ≤ (p + C) ^ C := by + simpa [B, Q, q, fastCoefficientMatrixParameter, reducedMatrixParameter, Polynomial.eval₂_pow] + using hbound p hp + have hraw := F.exists_controlled_real_fast_coefficient_coordinates e ω hF w hw U hU + v hspan hH hv hq hdims.1 (hκ.trans hpq) hdims.2.1 hdims.2.2.1 hdims.2.2.2 + (hHp.trans (Real.exp_le_exp.mpr hpq)) l hl (hlp.trans (Real.exp_le_exp.mpr hpq)) + obtain ⟨d, hdim, rows, hinj, b, R, m, hm, hmp, hlm, hgrid, hRgrid, hR, hweighted, hblock, haction⟩ := hraw + have hdim' : d ≤ Fintype.card ι * (s + 2) * (Fintype.card σ + 1) ^ (s + 1) := by + exact hdim.trans (firstCoefficientIndex_card_le w ω (s + 1) hw + (F.adaptedBasis_weight_le_step e ω hF)) + have hbudget : Real.exp ((q + 2) ^ 2958) ≤ Real.exp ((p + C) ^ C) := Real.exp_le_exp.mpr hfinal + refine ⟨d, hdim', rows, hinj, b, R, m, hm, hmp.trans hbudget, hlm, + hgrid, hRgrid, hR, ?_, hblock, haction⟩ + intro T hT M hM + obtain ⟨hproj, hlift⟩ := hweighted T hT M hM + constructor + · intro x hx i + exact (hproj x hx i).trans (div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_right hbudget hM) (monomialScale_pos T hT _).le) + · intro y hy i + exact (hlift y hy i).trans (div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_right hbudget hM) (monomialScale_pos T hT _).le) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix + +theorem exists_uniform_real_fast_coefficient_coordinates + {σ ι κ L : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype κ] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) (w : σ → ℕ) + [Fintype (ReducedSquareSymbolIndex s w ω)] [Fintype (QuotientTopSymbolIndex s w ω)] + [Fintype (FirstCoefficientIndex w ω)] [DecidableEq (FirstCoefficientIndex w ω)] + (hw : ∀ i, 0 < w i) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol w)) + (hU : BasisBlockInvariant (F.reducedSquareSymbolBasis e ω hF w) (fun i => i.val.1) U.toSubmodule) + (v : κ → F.squareFiltration.quotientTop.PolynomialSymbol w) + (hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) {H : ℕ} (hH : 1 ≤ H) + (hv : ∀ i j, RationalHeightLE ((F.reducedSquareSymbolBasis e ω hF w).repr (v i) j) H) + {p : ℝ} (hp : 0 ≤ p) + (hn : (Fintype.card (ReducedSquareSymbolIndex s w ω) : ℝ) ≤ p) + (hm : (Fintype.card κ : ℝ) ≤ p) + (hq : (Fintype.card (QuotientTopSymbolIndex s w ω) : ℝ) ≤ p) + (hd : (Fintype.card (FirstCoefficientIndex w ω) : ℝ) ≤ p) + (hdm : ((Fintype.card (FirstCoefficientIndex w ω) * Fintype.card κ : ℕ) : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) : + ∃ d : ℕ, d ≤ Fintype.card (FirstCoefficientIndex w ω) ∧ + ∃ rows : Fin d → FirstCoefficientIndex w ω, Function.Injective rows ∧ + ∃ b : Basis (Fin d) ℝ (F.RealFirstCoefficientModule w ⧸ + F.realFirstCoefficientFastSubmodule w hw (F.reducedSquareFastRelativeSubmodule w U)), + ∃ R : (Fin d → ℝ) →ₗ[ℝ] F.RealFirstCoefficientModule w, + ∃ δ : ℕ, 0 < δ ∧ (δ : ℝ) ≤ Real.exp ((p + 2) ^ 2958) ∧ + (∀ l : ℕ, ∀ x, F.FirstCoefficientGrid e ω hF w l x → + b.equivFun ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ x) ∈ realDenominatorGrid (δ * l)) ∧ + (∀ l : ℕ, ∀ y : Fin d → ℝ, y ∈ realDenominatorGrid l → + F.FirstCoefficientGrid e ω hF w (δ * l) (R y)) ∧ + (∀ y : Fin d → ℝ, (F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ (R y) = b.equivFun.symm y) ∧ + (∀ (T : σ → ℝ), (∀ i, 0 < T i) → ∀ M : ℝ, 0 ≤ M → + (∀ x, F.FirstCoefficientSlowBound e ω hF w T M x → ∀ i, + |b.equivFun ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ x) i| ≤ + Real.exp ((p + 2) ^ 2958) * M / monomialScale T (rows i).val.1) ∧ + (∀ y : Fin d → ℝ, (∀ i, |y i| ≤ M / monomialScale T (rows i).val.1) → + F.FirstCoefficientSlowBound e ω hF w T (Real.exp ((p + 2) ^ 2958) * M) (R y))) ∧ + (∀ i j, (rows j).val.1 ≠ i.val.1 → + b.repr ((F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ + (F.realFirstCoefficientBasis e ω hF w i)) j = 0) ∧ + ∀ (g : F.RealAdaptedPolynomialGroup w) + (hg : (F.adaptedReducedRealSymbolHom w g).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra w U)) + (a c : Fin d), ω (rows a).val.2 ≤ ω (rows c).val.2 → + LinearMap.toMatrix b b (F.realFastCoefficientAdjoint w hw U g hg).toLinearMap a c = + (1 : Matrix (Fin d) (Fin d) ℝ) a c := by + have hOne : ((1 : ℕ) : ℝ) ≤ Real.exp p := by simpa only [Nat.cast_one] using Real.one_le_exp hp + have hraw := F.exists_controlled_real_fast_coefficient_coordinates e ω hF w hw U hU + v hspan hH hv hp hn hm hq hd hdm hHp 1 (by decide) hOne + obtain ⟨d, hdim, rows, hinj, b, R, δ, hδ, hδp, _, hproj, hlift, hright, hweighted, hblock, haction⟩ := hraw + refine ⟨d, hdim, rows, hinj, b, R, δ, hδ, hδp, ?_, ?_, hright, hweighted, hblock, haction⟩ + · intro l x hx + exact linearMap_grid_of_integer (F.realFirstCoefficientBasis e ω hF w).equivFun.toLinearMap + (b.equivFun.toLinearMap.comp (F.realFirstCoefficientFastSubmodule w hw + (F.reducedSquareFastRelativeSubmodule w U)).mkQ) δ hproj l x hx + · intro l y hy + exact linearMap_grid_of_integer (LinearMap.id : (Fin d → ℝ) →ₗ[ℝ] (Fin d → ℝ)) + ((F.realFirstCoefficientBasis e ω hF w).equivFun.toLinearMap.comp R) δ hlift l y hy + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix + +variable {σ κ L : Type*} [Fintype σ] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol (fun _ : σ => 1))) + (b : Basis κ ℝ (F.RealFirstCoefficientModule (fun _ : σ => 1) ⧸ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U))) + +noncomputable def fastCoefficientDirectionCoordinates + (B : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) : (σ → ℝ) →ₗ[ℝ] (κ → ℝ) := + b.equivFun.toLinearMap.comp + ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ.comp + (F.realFirstCoefficientDirectionMap B.coord)) + +theorem fastCoefficientDirectionCoordinates_apply + (B : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) (h : σ → ℝ) : + F.fastCoefficientDirectionCoordinates U b B h = + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ + (F.realFirstCoefficientDirectionMap B.coord h)) := rfl + +omit [Fintype σ] in +theorem fastCoefficientAdjoint_coordinates [DecidableEq κ] + (B : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) + (hB : (F.adaptedReducedRealSymbolHom (fun _ => 1) B).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra (fun _ => 1) U)) + (x : F.RealFirstCoefficientModule (fun _ : σ => 1)) : + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ + (F.realFirstCoefficientAdjoint (fun _ => 1) B x)) = + LinearMap.toMatrix b b (F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB).toLinearMap *ᵥ + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) := by + have h := LinearMap.toMatrix_mulVec_repr b b + (F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB).toLinearMap + ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ x) + exact (congrArg b.equivFun (F.realFastCoefficientAdjoint_mk (fun _ => 1) (by simp) U B hB x)).symm.trans + h.symm + +theorem fastCoefficientDerivative_coordinates [DecidableEq κ] + (B : F.RealAdaptedPolynomialGroup (fun _ : σ => 1)) + (hB : (F.adaptedReducedRealSymbolHom (fun _ => 1) B).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra (fun _ => 1) U)) + (h : σ → ℝ) (S R : F.RealFirstCoefficientModule (fun _ : σ => 1)) + (heq : F.realFirstCoefficientDirectionMap B.coord h - + (S + F.realFirstCoefficientAdjoint (fun _ => 1) B R) ∈ + F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)) : + F.fastCoefficientDirectionCoordinates U b B h = + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ S) + + LinearMap.toMatrix b b (F.realFastCoefficientAdjoint (fun _ => 1) (by simp) U B hB).toLinearMap *ᵥ + b.equivFun ((F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ R) := by + have hq := (Submodule.Quotient.eq + (F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U))).mpr heq + let q := (F.realFirstCoefficientFastSubmodule (fun _ => 1) (by simp) + (F.reducedSquareFastRelativeSubmodule (fun _ => 1) U)).mkQ + have hadd := (b.equivFun.toLinearMap.comp q).map_add S (F.realFirstCoefficientAdjoint (fun _ => 1) B R) + have hadj := F.fastCoefficientAdjoint_coordinates U b B hB R + exact (congrArg b.equivFun hq).trans (hadd.trans (congrArg₂ (· + ·) rfl hadj)) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FilteredSubalgebraCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FilteredSubalgebraCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ada6bb1dd12008b6ae32b3c54e4e6f7e14f436c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FilteredSubalgebraCoordinates.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Estimates.PetalComparisonTree + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +variable {ι κ L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + +noncomputable def subalgebraLayerFamily (e : Basis ι ℚ L) (v : κ → L) + (ω : ι → ℕ) (j : ℕ) : κ ⊕ ι → L := + Sum.elim v (fun i => if j ≤ ω i then e i else 0) + +omit [Fintype ι] in +theorem subalgebraLayerFamily_height (e : Basis ι ℚ L) (v : κ → L) + (ω : ι → ℕ) (j : ℕ) {H : ℕ} (hH : 1 ≤ H) + (hv : ∀ z i, RationalHeightLE (e.repr (v z) i) H) (z : κ ⊕ ι) (i : ι) : + RationalHeightLE (e.repr (subalgebraLayerFamily e v ω j z) i) H := by + classical + cases z with + | inl z => exact hv z i + | inr z => + by_cases h : j ≤ ω z + · by_cases he : z = i + · subst i + simpa [subalgebraLayerFamily, h] using rationalHeightLE_one hH + · simpa [subalgebraLayerFamily, h, he] using rationalHeightLE_zero hH + · simpa [subalgebraLayerFamily, h] using rationalHeightLE_zero hH + +namespace NilpotentLieFiltration + +variable {s : ℕ} (F : NilpotentLieFiltration L s) + +omit [Fintype ι] in +theorem real_subalgebra_layer_eq_span (e : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ L) (v : κ → L) + (hv : Submodule.span ℚ (Set.range v) = U.toSubmodule) (j : ℕ) : + (realificationLieSubalgebra U).toSubmodule ⊔ (F.realLayer j).toSubmodule = + Submodule.span ℝ (Set.range (fun z => rationalLieInclusion (subalgebraLayerFamily e v ω j z))) := by + have hlayer : Submodule.span ℚ (Set.range (fun i => if j ≤ ω i then e i else 0)) = F.layer j := + (span_conditional_basis e {i | j ≤ ω i}).trans (hlayers j).symm + rw [subalgebraLayerFamily, real_span_sum_family, + real_span_rational_family U.toSubmodule v hv, + real_span_rational_family (F.layer j) _ hlayer] + rfl + +theorem real_subalgebra_layer_mem_iff_coordinates (e : Basis ι ℚ L) (ω : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ L) (v : κ → L) + (hv : Submodule.span ℚ (Set.range v) = U.toSubmodule) (j : ℕ) (x : ℝ ⊗[ℚ] L) : + x ∈ (realLieSubalgebraOverRat (realificationLieSubalgebra U)).toSubmodule ⊔ F.realification.layer j ↔ + (e.baseChange ℝ).equivFun x ∈ Submodule.span ℝ + (Set.range (fun z i => (e.repr (subalgebraLayerFamily e v ω j z) i : ℝ))) := by + change x ∈ (realificationLieSubalgebra U).toSubmodule.restrictScalars ℚ ⊔ + (F.realLayer j).toSubmodule.restrictScalars ℚ ↔ _ + rw [← Submodule.restrictScalars_sup] + change x ∈ (realificationLieSubalgebra U).toSubmodule ⊔ (F.realLayer j).toSubmodule ↔ _ + rw [F.real_subalgebra_layer_eq_span e ω hlayers U v hv j] + exact real_span_family_mem_iff_coordinates e _ x + +end NilpotentLieFiltration +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FilteredSymbolMapCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FilteredSymbolMapCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..815b00534b81c5b0ccca143fd6c7365b67cfabf2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FilteredSymbolMapCoordinates.lean @@ -0,0 +1,56 @@ +import OAI.Combinatorics.Progressions.Polynomial.RealAdaptedPolynomialGroup + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] + [LieRing M] [LieAlgebra ℚ M] {s t : ℕ} + (F : NilpotentLieFiltration L s) (G : NilpotentLieFiltration M t) + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (f : Basis κ ℚ M) (ν : κ → ℕ) + (hG : ∀ j, G.layer j = Submodule.span ℚ (f '' {i | j ≤ ν i})) + (φ : L →ₗ⁅ℚ⁆ M) (hφ : ∀ j, ∀ x ∈ F.layer j, φ x ∈ G.layer j) (w : σ → ℕ) + +theorem filteredPolynomialSymbolMap_basis_repr [DecidableEq σ] + (a : SymbolBasisIndex w ω) (b : SymbolBasisIndex w ν) : + (G.polynomialSymbolBasis f ν hG w).repr + (F.filteredPolynomialSymbolMap G φ hφ w (F.polynomialSymbolBasis e ω hF w a)) b = + if a.val.1 = b.val.1 then f.repr (φ (e a.val.2)) b.val.2 else 0 := by + rw [F.polynomialSymbolBasis_apply, F.filteredPolynomialSymbolMap_symbol, + G.polynomialSymbolBasis_repr_map, F.filteredPolynomialMap_coefficient, + F.adaptedMonomialBasis_coe, coefficients_monomial] + by_cases hab : a.val.1 = b.val.1 + · simp only [hab, Finsupp.single_eq_same, ite_true] + · rw [Finsupp.single_eq_of_ne (Ne.symm hab), map_zero, map_zero, Finsupp.zero_apply, + ite_eq_right hab] + +theorem filteredPolynomialSymbolMap_monomial_blocks + (a : SymbolBasisIndex w ω) (b : SymbolBasisIndex w ν) (hab : b.val.1 ≠ a.val.1) : + (G.polynomialSymbolBasis f ν hG w).repr + (F.filteredPolynomialSymbolMap G φ hφ w (F.polynomialSymbolBasis e ω hF w a)) b = 0 := by + classical + rw [F.filteredPolynomialSymbolMap_basis_repr G e ω hF f ν hG φ hφ w a b, + ite_eq_right (Ne.symm hab)] + +theorem filteredPolynomialSymbolMap_basis_height {H : ℕ} (hH : 1 ≤ H) + (hentries : ∀ i j, RationalHeightLE (f.repr (φ (e j)) i) H) + (a : SymbolBasisIndex w ω) (b : SymbolBasisIndex w ν) : + RationalHeightLE ((G.polynomialSymbolBasis f ν hG w).repr + (F.filteredPolynomialSymbolMap G φ hφ w (F.polynomialSymbolBasis e ω hF w a)) b) H := by + classical + rw [F.filteredPolynomialSymbolMap_basis_repr G e ω hF f ν hG φ hφ w a b] + split_ifs + · exact hentries b.val.2 a.val.2 + · exact rationalHeightLE_zero hH + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteChoiceLeafCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteChoiceLeafCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb6f62deb2cb433234d28cb897a37c5fb6c305a8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteChoiceLeafCoordinates.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeBinaryAssignments + +namespace OAI + +section + +namespace Erdos3 + +variable {σ : Type*} [DecidableEq σ] {n : ℕ} + +theorem finiteChoiceLeafInput_of_not_mem (l : List σ) : + ∀ (v : Fin l.length → Fin (n + 1)) (x : (Fin (n + 1) × σ) → ℤ) (j : σ), + j ∉ l → finiteChoiceLeafInput l v x j = x (0, j) := by + induction l with + | nil => intro v x j _; rfl + | cons i l ih => + intro v x j hj + simp only [List.mem_cons, not_or] at hj + rw [finiteChoiceLeafInput, ih (Fin.tail v) (finiteChoiceReplaceInput i (v 0) x) j hj.2] + simp [finiteChoiceReplaceInput, finiteChoiceReplaceIndex, hj.1] + +theorem finiteChoiceLeafInput_get (l : List σ) : + l.Nodup → ∀ (v : Fin l.length → Fin (n + 1)) (x : (Fin (n + 1) × σ) → ℤ) + (j : Fin l.length), finiteChoiceLeafInput l v x (l.get j) = x (v j, l.get j) := by + induction l with + | nil => intro _ v x j; exact Fin.elim0 j + | cons i l ih => + intro hl v x j + obtain ⟨hi, hl⟩ := List.nodup_cons.mp hl + refine Fin.cases ?_ (fun k => ?_) j + · change finiteChoiceLeafInput l (Fin.tail v) (finiteChoiceReplaceInput i (v 0) x) i = + x (v 0, i) + rw [finiteChoiceLeafInput_of_not_mem l (Fin.tail v) (finiteChoiceReplaceInput i (v 0) x) i hi] + simp [finiteChoiceReplaceInput, finiteChoiceReplaceIndex] + · change finiteChoiceLeafInput l (Fin.tail v) (finiteChoiceReplaceInput i (v 0) x) (l.get k) = + x (v k.succ, l.get k) + rw [ih hl (Fin.tail v) (finiteChoiceReplaceInput i (v 0) x) k] + have hki : l.get k ≠ i := by + intro heq + apply hi + rw [← heq] + exact List.get_mem l k + change x (if (v k.succ, l.get k) = (0, i) then (v 0, i) else (v k.succ, l.get k)) = _ + rw [ite_eq_right (fun h => hki (congrArg Prod.snd h))] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteCoordinateSlice.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteCoordinateSlice.lean new file mode 100644 index 0000000000000000000000000000000000000000..df78a4de3b8c221295567945f6015b6b0a952603 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteCoordinateSlice.lean @@ -0,0 +1,35 @@ +import Mathlib.Logic.Equiv.Prod +import OAI.Combinatorics.Progressions.Estimates.ComplexFiniteMeans + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem expect_le_of_coordinate_slices {I X : Type*} [Fintype I] [DecidableEq I] + [Fintype X] [Nonempty X] (i : I) (f : (I → X) → ℝ) (C : ℝ) + (hslice : ∀ x : I → X, (𝔼 a : X, f (Function.update x i a)) ≤ C) : + (𝔼 x : I → X, f x) ≤ C := by + classical + let e := Equiv.funSplitAt 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 : I → X := e.symm (Classical.choice inferInstance, r) + have hupdate (a : X) : e.symm (a, r) = Function.update x i a := by + funext j + by_cases hj : j = i + · subst j + simp [e, Equiv.funSplitAt, Equiv.piSplitAt] + · simp [e, x, Equiv.funSplitAt, Equiv.piSplitAt, hj] + simpa only [hupdate] using hslice x + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteGoodSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteGoodSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcc5ec3b48a53c92554e0b71418bd2b69de0664d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteGoodSupport.lean @@ -0,0 +1,145 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteGoodPartTransfer +import OAI.Combinatorics.Progressions.Probability.ObservedProductDensity + +namespace OAI + +section + +namespace Erdos3.FiniteProbabilityWeights + +variable {X : Type*} [Fintype X] (p : FiniteProbabilityWeights X) + +theorem mean_congr_on_support {f g : X → ℝ} + (h : ∀ x, p.weight x ≠ 0 → f x = g x) : p.mean f = p.mean g := + le_antisymm (p.mean_mono_on_support (fun x hx => (h x hx).le)) + (p.mean_mono_on_support (fun x hx => (h x hx).ge)) + +end Erdos3.FiniteProbabilityWeights + +end + +section + +namespace Erdos3 + +variable {X Y : Type*} (q : X → Y) (S : Set X) (hinj : Set.InjOn q S) + +include hinj + +theorem restrictedChartDensity_eq_of_values (g : Y → ℝ) (f : X → ℝ) + (hvalue : ∀ x ∈ S, g (q x) = f x) (hzero : ∀ y ∉ q '' S, g y = 0) : + g = restrictedChartDensity q S 1 f := by + funext y + by_cases hy : y ∈ q '' S + · obtain ⟨x, hx, rfl⟩ := hy + rw [restrictedChartDensity_apply q S 1 f hinj hx, one_mul, hvalue x hx] + · rw [hzero y hy, restrictedChartDensity_zero q S 1 f hy] + +theorem restrictedChartDensity_pointwise_comparison (g : Y → ℝ) (f e : X → ℝ) + (hbound : ∀ x ∈ S, |g (q x) - f x| ≤ e x) + (hzero : ∀ y ∉ q '' S, g y = 0) (y : Y) : + |g y - restrictedChartDensity q S 1 f y| ≤ restrictedChartDensity q S 1 e y := by + by_cases hy : y ∈ q '' S + · obtain ⟨x, hx, rfl⟩ := hy + simpa only [restrictedChartDensity_apply q S 1 f hinj hx, + restrictedChartDensity_apply q S 1 e hinj hx, one_mul] using hbound x hx + · rw [hzero y hy, restrictedChartDensity_zero q S 1 f hy, + restrictedChartDensity_zero q S 1 e hy, sub_self, abs_zero] + +theorem restrictedChartDensity_bound (f : X → ℝ) {C : ℝ} (hC : 0 ≤ C) + (hf : ∀ x ∈ S, f x ≤ C) (y : Y) : restrictedChartDensity q S 1 f y ≤ C := by + by_cases hy : y ∈ q '' S + · obtain ⟨x, hx, rfl⟩ := hy + simpa only [restrictedChartDensity_apply q S 1 f hinj hx, one_mul] using hf x hx + · rw [restrictedChartDensity_zero q S 1 f hy] + exact hC + +theorem restrictedChartDensity_mean_comparison {A : Type*} [Fintype A] + (weights : FiniteProbabilityWeights A) (g : A → Y → ℝ) (f e : X → ℝ) + (hbound : ∀ x ∈ S, |weights.mean (fun a => g a (q x)) - f x| ≤ e x) + (hzero : ∀ a y, y ∉ q '' S → g a y = 0) (y : Y) : + |weights.mean (fun a => g a y) - restrictedChartDensity q S 1 f y| ≤ + restrictedChartDensity q S 1 e y := by + apply restrictedChartDensity_pointwise_comparison q S hinj _ f e hbound _ y + intro y hy + simp only [hzero _ y hy, weights.mean_const] + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {X Y : Type*} (q : X → Y) (S : Set X) (hinj : Set.InjOn q S) + +include hinj + +theorem restrictedChartDensity_sub (f g : X → ℝ) : + (fun y => restrictedChartDensity q S 1 f y - restrictedChartDensity q S 1 g y) = + restrictedChartDensity q S 1 (fun x => f x - g x) := by + apply restrictedChartDensity_eq_of_values q S hinj + · intro x hx + simp only [restrictedChartDensity_apply q S 1 _ hinj hx, one_mul] + · intro y hy + rw [restrictedChartDensity_zero q S 1 f hy, restrictedChartDensity_zero q S 1 g hy, sub_self] + +theorem restrictedChartDensity_abs (f : X → ℝ) : + (fun y => |restrictedChartDensity q S 1 f y|) = + restrictedChartDensity q S 1 (fun x => |f x|) := by + apply restrictedChartDensity_eq_of_values q S hinj + · intro x hx + simp only [restrictedChartDensity_apply q S 1 _ hinj hx, one_mul] + · intro y hy + rw [restrictedChartDensity_zero q S 1 f hy, abs_zero] + +theorem restrictedChartDensity_abs_sub (f g : X → ℝ) : + (fun y => |restrictedChartDensity q S 1 f y - restrictedChartDensity q S 1 g y|) = + restrictedChartDensity q S 1 (fun x => |f x - g x|) := by + have hs := restrictedChartDensity_sub q S hinj f g + simpa only [← hs] using restrictedChartDensity_abs q S hinj (fun x => f x - g x) + +end Erdos3 + +end + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped Classical + +theorem exists_supported_good_of_bad_lt_one {X : Type*} [Fintype X] + (p : FiniteProbabilityWeights X) (Good : X → Prop) + (hbad : p.eventProbability (fun x => ¬Good x) < 1) : + ∃ x, p.weight x ≠ 0 ∧ Good x := by + by_contra hnone + have hn (x) (hx : p.weight x ≠ 0) : ¬Good x := fun hg => hnone ⟨x, hx, hg⟩ + have hone : p.eventProbability (fun x => ¬Good x) = 1 := by + calc + _ = p.mean (fun _ => 1) := p.mean_congr_on_support (fun x hx => ite_eq_left (hn x hx)) + _ = 1 := p.mean_const 1 + linarith + +theorem complexMean_goodPart_exp_error {X : Type*} [Fintype X] + (p : FiniteProbabilityWeights X) (Good : X → Prop) + (f : X → ℂ) (g : ∀ x, Good x → ℂ) {E : ℝ} + (hbad : p.eventProbability (fun x => ¬Good x) ≤ Real.exp (-(E + 1))) + (hf : ∀ x, ‖f x‖ ≤ 1) + (hgood : ∀ x (hx : Good x), ‖f x - g x hx‖ ≤ Real.exp (-(E + 1))) : + ‖p.complexMean f - p.complexMean (fun x => if hx : Good x then g x hx else 0)‖ ≤ + Real.exp (-E) := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + _ ≤ Real.exp (-(E + 1)) + p.eventProbability (fun x => ¬Good x) := + p.complexMean_goodPart_comparison Good f g (Real.exp_pos _).le hf hgood + _ ≤ 2 * Real.exp (-(E + 1)) := by linarith + _ ≤ Real.exp 1 * Real.exp (-(E + 1)) := mul_le_mul_of_nonneg_right htwo (Real.exp_pos _).le + _ = Real.exp (-E) := by rw [← Real.exp_add]; congr 1; ring + +end Erdos3.FiniteProbabilityWeights + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteImageSupportTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteImageSupportTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..fdabee8f32c66bf682d2d61607a885b2c3a91469 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteImageSupportTransport.lean @@ -0,0 +1,53 @@ +import OAI.Combinatorics.Progressions.Probability.WeightedSliceFamilyLaw + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem weight_le_finiteImageMass {X Z : Type*} [Fintype X] [DecidableEq Z] + (p : FiniteProbabilityWeights X) (F : X → Z) (x : X) : + p.weight x ≤ finiteImageMass p F (F x) := by + classical + unfold finiteImageMass FiniteProbabilityWeights.mean + have h := Finset.single_le_sum + (f := fun y => p.weight y * if F y = F x then (1 : ℝ) else 0) + (s := Finset.univ) (fun y _ => mul_nonneg (p.nonneg y) (by split_ifs <;> norm_num)) (Finset.mem_univ x) + simpa only [ite_true, mul_one] using h + +theorem finiteImageMass_eq_zero_of_no_preimage {X Z : Type*} [Fintype X] [DecidableEq Z] + (p : FiniteProbabilityWeights X) (F : X → Z) (z : Z) + (h : ∀ x, p.weight x ≠ 0 → F x ≠ z) : finiteImageMass p F z = 0 := by + unfold finiteImageMass FiniteProbabilityWeights.mean + apply Finset.sum_eq_zero + intro x _ + dsimp only + by_cases hx : p.weight x = 0 + · simp only [hx, zero_mul] + · rw [ite_eq_right (h x hx), mul_zero] + +theorem finiteImageMass_support_transport {X Y Z : Type*} [Fintype X] [Fintype Y] [DecidableEq Z] + (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) (F : X → Z) (G : Y → Z) + (hmass : ∀ z, finiteImageMass p F z = finiteImageMass q G z) + (P : Z → Prop) (hP : ∀ x, p.weight x ≠ 0 → P (F x)) + (y : Y) (hy : q.weight y ≠ 0) : P (G y) := by + by_contra hn + have he : finiteImageMass p F (G y) = 0 := by + apply finiteImageMass_eq_zero_of_no_preimage + intro x hx hxy + apply hn + rw [← hxy] + exact hP x hx + rw [hmass] at he + have hle := weight_le_finiteImageMass q G y + rw [he] at hle + exact hy (le_antisymm hle (q.nonneg y)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteNormalizedChartCorrection.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteNormalizedChartCorrection.lean new file mode 100644 index 0000000000000000000000000000000000000000..58b06902f5ae7a93a69fd748cbb685304e7aaf26 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteNormalizedChartCorrection.lean @@ -0,0 +1,268 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteEnumerationFilter +import OAI.Combinatorics.Progressions.Linear.FiniteRankTriangularFinset +import OAI.Combinatorics.Progressions.Polynomial.FiniteSupportedPolynomialSubstitution +import OAI.Combinatorics.Progressions.Polynomial.MajorWeightedDegreeTools + +namespace OAI + +section + +namespace Erdos3 +open MvPolynomial +open scoped BigOperators Classical + +variable {U B : Type*} + +noncomputable def normalizedChartTagWeight : U ⊕ B → ℕ := + Sum.elim (fun _ => 0) (fun _ => 1) + +private theorem normalizedChart_spatial_support (P : MvPolynomial U ℝ) : + rename (Sum.inl : U → U ⊕ B) P ∈ weightedSupportLE normalizedChartTagWeight 0 := by + rw [rename_eq_aeval] + apply weightedSupportLE_aeval (fun _ : U => 0) normalizedChartTagWeight + · intro i + exact weightedSupportLE_X _ (Sum.inl i) + · intro α _ + simp [Finsupp.weight_apply] + +theorem normalizedRealPolynomialChart_tag_support + (H : U → ℝ) (A : B → MvPolynomial U ℝ) (i : U ⊕ B) : + normalizedRealPolynomialChart H A i ∈ + weightedSupportLE normalizedChartTagWeight (normalizedChartTagWeight i) := by + cases i with + | inl i => + change C ((H i)⁻¹) * X (Sum.inl i) ∈ weightedSupportLE + (normalizedChartTagWeight (U := U) (B := B)) 0 + exact weightedSupportLE_mul + (w := normalizedChartTagWeight (U := U) (B := B)) (d := 0) (e := 0) + (weightedSupportLE_C _ 0 ((H i)⁻¹)) (weightedSupportLE_X _ (Sum.inl i)) + | inr i => + change X (Sum.inr i) - rename Sum.inl (A i) ∈ weightedSupportLE + (normalizedChartTagWeight (U := U) (B := B)) 1 + exact (weightedSupportLE (normalizedChartTagWeight (U := U) (B := B)) 1).sub_mem + (weightedSupportLE_X _ (Sum.inr i)) + (weightedSupportLE_mono (Nat.zero_le 1) (normalizedChart_spatial_support (A i))) + +theorem normalizedRealPolynomialChart_tag_coordinate_difference + (H : U → ℝ) (A : B → MvPolynomial U ℝ) (i : U ⊕ B) : + normalizedRealPolynomialChart H A i - + normalizedRealPolynomialChart H (fun _ => 0) i ∈ + weightedSupportLT normalizedChartTagWeight (normalizedChartTagWeight i) := by + cases i with + | inl i => + simp only [normalizedRealPolynomialChart_inl, sub_self] + exact Submodule.zero_mem _ + | inr i => + change (X (Sum.inr i) - rename Sum.inl (A i)) - + (X (Sum.inr i) - rename Sum.inl (0 : MvPolynomial U ℝ)) ∈ + weightedSupportLT (normalizedChartTagWeight (U := U) (B := B)) 1 + rw [map_zero, sub_zero, sub_sub_cancel_left] + exact (weightedSupportLT (normalizedChartTagWeight (U := U) (B := B)) 1).neg_mem + (weightedSupportLE_lt_succ (normalizedChart_spatial_support (A i))) + +private theorem normalizedChart_hom_tag_support + (H : U → ℝ) (A : B → MvPolynomial U ℝ) (i : U ⊕ B) : + (aeval (R := ℝ) (normalizedRealPolynomialChart H A)) (X i) ∈ + weightedSupportLE normalizedChartTagWeight (normalizedChartTagWeight i) := by + rw [aeval_X] + exact normalizedRealPolynomialChart_tag_support H A i + +private theorem normalizedChart_hom_tag_difference + (H : U → ℝ) (A : B → MvPolynomial U ℝ) (i : U ⊕ B) : + (aeval (R := ℝ) (normalizedRealPolynomialChart H A)) (X i) - + (aeval (R := ℝ) (normalizedRealPolynomialChart H (fun _ => 0))) (X i) ∈ + weightedSupportLT normalizedChartTagWeight (normalizedChartTagWeight i) := by + rw [aeval_X, aeval_X] + exact normalizedRealPolynomialChart_tag_coordinate_difference H A i + +theorem normalizedRealPolynomialChart_tag_difference + (H : U → ℝ) (A : B → MvPolynomial U ℝ) (α : (U ⊕ B) →₀ ℕ) : + aeval (R := ℝ) (normalizedRealPolynomialChart H A) (monomial α 1) - + aeval (R := ℝ) (normalizedRealPolynomialChart H (fun _ => 0)) (monomial α 1) ∈ + weightedSupportLT normalizedChartTagWeight (Finsupp.weight normalizedChartTagWeight α) := + weightedComparison_monomial_one + (normalizedChartTagWeight (U := U) (B := B)) normalizedChartTagWeight + (aeval (R := ℝ) (normalizedRealPolynomialChart H A)) + (aeval (R := ℝ) (normalizedRealPolynomialChart H (fun _ => 0))) + (normalizedChart_hom_tag_support H A) + (normalizedChart_hom_tag_support H (fun _ => 0)) + (normalizedChart_hom_tag_difference H A) α + +theorem aeval_coordinate_scaling_monomial {I : Type*} + (c : I → ℝ) (α : I →₀ ℕ) : + aeval (R := ℝ) (fun i => C (c i) * X i) (monomial α 1) = + monomial α (α.prod (fun i n => c i ^ n)) := by + classical + rw [aeval_monomial] + simp only [map_one, one_mul, Finsupp.prod, + mul_pow, Finset.prod_mul_distrib, ← map_pow, ← map_prod, monomial_eq] + +noncomputable def normalizedChartDiagonal (H : U → ℝ) (α : (U ⊕ B) →₀ ℕ) : ℝ := + α.prod (fun i n => (Sum.elim (fun u => (H u)⁻¹) (fun _ : B => 1) i) ^ n) + +theorem normalizedChart_zero_monomial (H : U → ℝ) (α : (U ⊕ B) →₀ ℕ) : + aeval (R := ℝ) (normalizedRealPolynomialChart H (fun _ : B => 0)) (monomial α 1) = + monomial α (normalizedChartDiagonal H α) := by + have h : normalizedRealPolynomialChart H (fun _ : B => 0) = + fun i => C (Sum.elim (fun u => (H u)⁻¹) (fun _ : B => 1) i) * X i := by + funext i + cases i <;> simp [normalizedRealPolynomialChart] + rw [h] + exact aeval_coordinate_scaling_monomial _ α + +theorem normalizedChart_coeff_of_tag_le (H : U → ℝ) (A : B → MvPolynomial U ℝ) + (α β : (U ⊕ B) →₀ ℕ) + (h : Finsupp.weight normalizedChartTagWeight α ≤ Finsupp.weight normalizedChartTagWeight β) : + (aeval (R := ℝ) (normalizedRealPolynomialChart H A) (monomial α 1)).coeff β = + if α = β then normalizedChartDiagonal H α else 0 := by + classical + have hd := normalizedRealPolynomialChart_tag_difference H A α + have hz : (aeval (R := ℝ) (normalizedRealPolynomialChart H A) (monomial α 1) - + aeval (R := ℝ) (normalizedRealPolynomialChart H (fun _ => 0)) (monomial α 1)).coeff β = 0 := by + by_contra hn + exact (not_lt_of_ge h) (hd (mem_support_iff.mpr hn)) + rw [coeff_sub, normalizedChart_zero_monomial, coeff_monomial] at hz + exact sub_eq_zero.mp hz + +theorem normalizedChartDiagonal_pos_le_one (H : U → ℝ) (hH : ∀ i, 1 ≤ H i) + (α : (U ⊕ B) →₀ ℕ) : + 0 < normalizedChartDiagonal H α ∧ normalizedChartDiagonal H α ≤ 1 := by + classical + have hscale (i : U ⊕ B) : + 0 < Sum.elim (fun u => (H u)⁻¹) (fun _ : B => (1 : ℝ)) i ∧ + Sum.elim (fun u => (H u)⁻¹) (fun _ : B => (1 : ℝ)) i ≤ 1 := by + cases i with + | inl i => exact ⟨inv_pos.mpr (lt_of_lt_of_le zero_lt_one (hH i)), + inv_le_one_of_one_le₀ (hH i)⟩ + | inr i => exact ⟨zero_lt_one, le_rfl⟩ + unfold normalizedChartDiagonal Finsupp.prod + refine ⟨Finset.prod_pos (fun i _ => pow_pos (hscale i).1 _), ?_⟩ + exact Finset.prod_le_one₀ (fun i _ => pow_nonneg (hscale i).1.le _) + (fun i _ => pow_le_one₀ (hscale i).1.le (hscale i).2) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +variable {U V : Type*} + +def normalizedChartCorrectionSolutions + (H : U → ℝ) (A : V → MvPolynomial U ℝ) + (S : Finset ((U ⊕ V) →₀ ℕ)) (P : MvPolynomial (U ⊕ V) ℝ) (B : ℝ) (q : ℕ) : + Set (MvPolynomial (U ⊕ V) ℝ × MvPolynomial (U ⊕ V) ℚ) := + {sr | sr.1.support ⊆ S ∧ sr.2.support ⊆ S ∧ + (∀ α, |sr.1.coeff α| ≤ B) ∧ + (∀ α, ∃ z : ℤ, sr.2.coeff α = (z : ℚ) / q) ∧ + P = aeval (R := ℝ) (normalizedRealPolynomialChart H A) sr.1 + + MvPolynomial.map (Rat.castHom ℝ) sr.2} + +noncomputable def normalizedChartCoefficientMatrix + (H : U → ℝ) (A : V → MvPolynomial U ℝ) + (S : Finset ((U ⊕ V) →₀ ℕ)) : Matrix S S ℝ := + fun β α => + (aeval (R := ℝ) (normalizedRealPolynomialChart H A) (monomial α.val 1)).coeff β.val + +theorem normalizedChartCoefficientMatrix_triangular + (H : U → ℝ) (A : V → MvPolynomial U ℝ) + (S : Finset ((U ⊕ V) →₀ ℕ)) (α β : S) + (h : Finsupp.weight normalizedChartTagWeight β.val ≤ + Finsupp.weight normalizedChartTagWeight α.val) (hne : β ≠ α) : + normalizedChartCoefficientMatrix H A S α β = 0 := by + classical + have hval : β.val ≠ α.val := fun he => hne (Subtype.ext he) + simp only [normalizedChartCoefficientMatrix, normalizedChart_coeff_of_tag_le H A β.val α.val h, + hval, ite_false] + +theorem normalizedChartCoefficientMatrix_diagonal + (H : U → ℝ) (hH : ∀ i, 1 ≤ H i) (A : V → MvPolynomial U ℝ) + (S : Finset ((U ⊕ V) →₀ ℕ)) (α : S) : + normalizedChartCoefficientMatrix H A S α α ≠ 0 ∧ + |normalizedChartCoefficientMatrix H A S α α| ≤ 1 := by + classical + rw [normalizedChartCoefficientMatrix, + normalizedChart_coeff_of_tag_le H A α.val α.val le_rfl] + simp only [ite_true] + obtain ⟨hpos, hle⟩ := normalizedChartDiagonal_pos_le_one H hH α.val + exact ⟨hpos.ne', (abs_of_pos hpos).trans_le hle⟩ + +theorem normalizedChartCoefficientMatrix_coeff_aeval + (H : U → ℝ) (A : V → MvPolynomial U ℝ) + (S : Finset ((U ⊕ V) →₀ ℕ)) (slow : MvPolynomial (U ⊕ V) ℝ) + (hsupport : slow.support ⊆ S) (β : S) : + (aeval (R := ℝ) (normalizedRealPolynomialChart H A) slow).coeff β.val = + ∑ α : S, normalizedChartCoefficientMatrix H A S β α * slow.coeff α.val := by + classical + unfold normalizedChartCoefficientMatrix + conv_lhs => rw [← polynomialOfFiniteCoefficientVector_reconstruct S slow hsupport] + rw [polynomialOfFiniteCoefficientVector, map_sum, coeff_sum] + apply Finset.sum_congr rfl + intro α _ + simp only [aeval_monomial, MvPolynomial.algebraMap_eq, map_one, one_mul, coeff_C_mul] + exact mul_comm _ _ + +private theorem normalizedChartCorrectionSolutions_coefficients + (H : U → ℝ) (A : V → MvPolynomial U ℝ) + (S : Finset ((U ⊕ V) →₀ ℕ)) (P : MvPolynomial (U ⊕ V) ℝ) (B : ℝ) (q : ℕ) + (sr : MvPolynomial (U ⊕ V) ℝ × MvPolynomial (U ⊕ V) ℚ) + (hsr : sr ∈ normalizedChartCorrectionSolutions H A S P B q) : + ((fun α : S => sr.1.coeff α.val), (fun α : S => sr.2.coeff α.val)) ∈ + finiteRankCorrectionSolutions (normalizedChartCoefficientMatrix H A S) + (fun α : S => P.coeff α.val) B q := by + classical + rcases hsr with ⟨hslow, _, hbound, hgrid, hidentity⟩ + refine ⟨fun α => hbound α.val, fun α => hgrid α.val, ?_⟩ + intro β + have heq := congrArg (fun polynomial : MvPolynomial (U ⊕ V) ℝ => polynomial.coeff β.val) hidentity + rw [AddMonoidAlgebra.coeff_add, Finsupp.add_apply, coeff_map, + normalizedChartCoefficientMatrix_coeff_aeval H A S sr.1 hslow β] at heq + exact heq + +theorem exists_finite_normalized_chart_corrections + (H : U → ℝ) (hH : ∀ i, 1 ≤ H i) (A : V → MvPolynomial U ℝ) + (S : Finset ((U ⊕ V) →₀ ℕ)) (P : MvPolynomial (U ⊕ V) ℝ) + (B : ℝ) (hB : 0 ≤ B) (q : ℕ) (hq : 0 < q) : + ∃ m : ℕ, m ≤ (2 * ⌈(q : ℝ) * B⌉₊ + 3) ^ S.card ∧ + ∃ candidate : Fin m → (MvPolynomial (U ⊕ V) ℝ × MvPolynomial (U ⊕ V) ℚ), + (∀ j, candidate j ∈ normalizedChartCorrectionSolutions H A S P B q) ∧ + ∀ sr, sr ∈ normalizedChartCorrectionSolutions H A S P B q → + ∃ j, candidate j = sr := by + classical + let rank := fun α : S => Finsupp.weight normalizedChartTagWeight α.val + obtain ⟨n, hn, vectors, _, hcover⟩ := + exists_finite_rank_triangular_correction_enumeration q hq B hB rank + (normalizedChartCoefficientMatrix H A S) (fun α : S => P.coeff α.val) + (normalizedChartCoefficientMatrix_triangular H A S) + (fun α => (normalizedChartCoefficientMatrix_diagonal H hH A S α).1) + (fun α => (normalizedChartCoefficientMatrix_diagonal H hH A S α).2) + let polynomials := fun j : Fin n => + (polynomialOfFiniteCoefficientVector S (vectors j).1, + polynomialOfFiniteCoefficientVector S (vectors j).2) + have hpolynomials (sr) (hsr : sr ∈ normalizedChartCorrectionSolutions H A S P B q) : + ∃ j, polynomials j = sr := by + obtain ⟨j, hj⟩ := hcover _ + (normalizedChartCorrectionSolutions_coefficients H A S P B q sr hsr) + refine ⟨j, ?_⟩ + dsimp only [polynomials] + rw [hj] + exact Prod.ext (polynomialOfFiniteCoefficientVector_reconstruct S sr.1 hsr.1) + (polynomialOfFiniteCoefficientVector_reconstruct S sr.2 hsr.2.1) + obtain ⟨m, hm, candidate, hvalid, _, hcomplete⟩ := + exists_filtered_finite_enumeration polynomials + (fun sr => sr ∈ normalizedChartCorrectionSolutions H A S P B q) + refine ⟨m, ?_, candidate, hvalid, ?_⟩ + · exact hm.trans (by simpa only [Fintype.card_coe] using hn) + · intro sr hsr + exact hcomplete sr hsr (hpolynomials sr hsr) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteRowChartRadiusBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteRowChartRadiusBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b3be2a17df95433cb9da024c93cb8e1da5e2253 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteRowChartRadiusBudget.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedCoveredSiteExtraction + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def finiteRowChartRadius (rows dim : ℕ) (C T : ℝ) : ℝ := + 1 / (4 * ((rows : ℝ) + 1) * (C + 1) * ((dim : ℝ) + 1) * (T + 1)) + +theorem finiteRowChartRadius_pos (rows dim : ℕ) {C T : ℝ} (hC : 0 ≤ C) (hT : 0 ≤ T) : + 0 < finiteRowChartRadius rows dim C T := by + unfold finiteRowChartRadius + positivity + +theorem finiteRowChartRadius_budget (rows dim : ℕ) {C T R : ℝ} + (hC : 0 ≤ C) (hT : 0 ≤ T) (hR : 0 ≤ R) + (hsmall : R ≤ finiteRowChartRadius rows dim C T) : + (rows : ℝ) * (C * (((dim : ℝ) + 1) * (T * R))) ≤ 1 / 4 := by + have hd : 0 < 4 * ((rows : ℝ) + 1) * (C + 1) * ((dim : ℝ) + 1) * (T + 1) := by positivity + have hr := (le_div_iff₀ hd).mp hsmall + have hb : (rows : ℝ) * C * ((dim : ℝ) + 1) * T ≤ + ((rows : ℝ) + 1) * (C + 1) * ((dim : ℝ) + 1) * (T + 1) := by gcongr <;> linarith + have hm := mul_le_mul_of_nonneg_right hb hR + nlinarith only [hr, hm] + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem finiteRowChartRadius_inv_le_exp (rows dim : ℕ) {C T P : ℝ} + (hC : 0 ≤ C) (hT : 0 ≤ T) (hP : 0 ≤ P) + (hr : (rows : ℝ) ≤ Real.exp P) (hd : (dim : ℝ) ≤ Real.exp P) + (hCP : C ≤ Real.exp P) (hTP : T ≤ Real.exp P) : + (finiteRowChartRadius rows dim C T)⁻¹ ≤ Real.exp (4 * P + 6) := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hunit : 1 ≤ Real.exp P := Real.one_le_exp_iff.mpr hP + have hadd {a : ℝ} (ha : a ≤ Real.exp P) : a + 1 ≤ Real.exp (P + 1) := by + calc + _ ≤ 2 * Real.exp P := by linarith + _ ≤ Real.exp P * Real.exp 1 := by nlinarith [Real.exp_pos P] + _ = _ := (Real.exp_add _ _).symm + have hfour : (4 : ℝ) ≤ Real.exp 2 := by + calc + _ = (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 + simp only [finiteRowChartRadius, one_div, inv_inv] + calc + _ ≤ Real.exp 2 * Real.exp (P + 1) * Real.exp (P + 1) * Real.exp (P + 1) * Real.exp (P + 1) := by + gcongr + · exact hadd hr + · exact hadd hCP + · exact hadd hd + · exact hadd hTP + _ = _ := by simp only [← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSumCoordinate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSumCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f7f5536f67d440943907e58cbd9f8a3e34bbb06 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSumCoordinate.lean @@ -0,0 +1,100 @@ +import OAI.Combinatorics.Progressions.Polynomial.WeightedPolynomialRestriction + +namespace OAI + +section + +namespace Erdos3 + +variable {σ : Type*} [DecidableEq σ] + +def coordinateAdditionInputs (i : σ) (x : Option σ → ℤ) : Fin 3 → σ → ℤ := + ![Function.update (fun j => x (some j)) i (x (some i) + x none), + fun j => x (some j), Function.update (fun j => x (some j)) i (x none)] + +@[simp] theorem coordinateAdditionInputs_sum (i : σ) (x : Option σ → ℤ) : + coordinateAdditionInputs i x 0 = + Function.update (fun j => x (some j)) i (x (some i) + x none) := rfl + +@[simp] theorem coordinateAdditionInputs_left (i : σ) (x : Option σ → ℤ) : + coordinateAdditionInputs i x 1 = (fun j => x (some j)) := rfl + +@[simp] theorem coordinateAdditionInputs_right (i : σ) (x : Option σ → ℤ) : + coordinateAdditionInputs i x 2 = Function.update (fun j => x (some j)) i (x none) := rfl + +noncomputable def coordinateAdditionProduct {I : Type*} (f : I → (σ → ℤ) → ℂ) + (a : Fin 3 → I) (i : σ) (x : Option σ → ℤ) : ℂ := + f (a 0) (coordinateAdditionInputs i x 0) * star (f (a 1) (coordinateAdditionInputs i x 1)) * + star (f (a 2) (coordinateAdditionInputs i x 2)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {σ : Type*} [DecidableEq σ] + +def coordinateConstantInput (i : σ) (h n : ℤ) : σ → ℤ := + Function.update (fun _ => n) i h + +def coordinatePairInput (i : σ) (a b n : ℤ) : Option σ → ℤ + | none => b + | some j => coordinateConstantInput i a n j + +theorem coordinatePairInput_sum (i : σ) (a b n : ℤ) : + coordinateAdditionInputs i (coordinatePairInput i a b n) 0 = + coordinateConstantInput i (a + b) n := by + simp [coordinateAdditionInputs, coordinatePairInput, coordinateConstantInput] + +theorem coordinatePairInput_left (i : σ) (a b n : ℤ) : + coordinateAdditionInputs i (coordinatePairInput i a b n) 1 = coordinateConstantInput i a n := rfl + +theorem coordinatePairInput_right (i : σ) (a b n : ℤ) : + coordinateAdditionInputs i (coordinatePairInput i a b n) 2 = coordinateConstantInput i b n := by + simp [coordinateAdditionInputs, coordinatePairInput, coordinateConstantInput] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {σ : Type*} [DecidableEq σ] {n : ℕ} + +def finiteSumCoordinateInput (i : σ) (x : (σ ⊕ Fin n) → ℤ) : σ → ℤ := + Function.update (fun j => x (Sum.inl j)) i (∑ a : Fin n, x (Sum.inr a)) + +def finiteTermCoordinateInput (i : σ) (a : Fin n) (x : (σ ⊕ Fin n) → ℤ) : σ → ℤ := + Function.update (fun j => x (Sum.inl j)) i (x (Sum.inr a)) + +def finiteSumCoordinateHom (i j : σ) : (((σ ⊕ Fin n) → ℤ) →+ ℤ) where + toFun x := finiteSumCoordinateInput i x j + map_zero' := by simp [finiteSumCoordinateInput] + map_add' x y := by + simp only [finiteSumCoordinateInput, Function.update_apply, Pi.add_apply, + Finset.sum_add_distrib] + split_ifs <;> rfl + +def finiteTermCoordinateHom (i : σ) (a : Fin n) (j : σ) : (((σ ⊕ Fin n) → ℤ) →+ ℤ) where + toFun x := finiteTermCoordinateInput i a x j + map_zero' := by simp [finiteTermCoordinateInput] + map_add' x y := by + simp only [finiteTermCoordinateInput, Function.update_apply, Pi.add_apply] + split_ifs <;> rfl + +theorem finiteSumCoordinateInput_one (i : σ) (x : (σ ⊕ Fin 1) → ℤ) : + finiteSumCoordinateInput i x = finiteTermCoordinateInput i 0 x := by + simp only [finiteSumCoordinateInput, finiteTermCoordinateInput, Fin.sum_univ_one] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportApproximation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..4956221ff9d8df2232295f9170aeb5fed74f86fa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportApproximation.lean @@ -0,0 +1,34 @@ +import OAI.Combinatorics.Progressions.Probability.FiniteDensityMassBound + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem normalized_finite_weight_approximation {X : Type*} + (v : X → ℝ) (S : Finset X) (hv0 : ∀ x, 0 ≤ v x) + (hv : ∀ x ∉ S, v x = 0) (hZ : 0 < ∑' x, v x) + (w f g : X → ℂ) {η : ℝ} (hη : 0 ≤ η) + (hw : ∀ x ∈ S, ‖w x‖ ≤ 1) (he : ∀ x ∈ S, ‖f x - g x‖ ≤ η) : + ‖(∑' x, ((v x / (∑' y, v y) : ℝ) : ℂ) * (w x * f x)) - + ∑' x, ((v x / (∑' y, v y) : ℝ) : ℂ) * (w x * g x)‖ ≤ η := by + let p := finiteSupportProbability v S hv0 hv hZ + have hm : p.mean (fun x => ‖w x.val‖) ≤ 1 := + (p.mean_mono (fun x => hw x.val x.property)).trans_eq (p.mean_const 1) + have h := (p.norm_weighted_complexMean_sub_le_mean_norm (fun x => w x.val) + (fun x => f x.val) (fun x => g x.val) (fun x _ => he x.val x.property)).trans + ((mul_le_mul_of_nonneg_left hm hη).trans_eq (mul_one η)) + change ‖(finiteSupportProbability v S hv0 hv hZ).complexMean (fun x => w x.val * f x.val) - + (finiteSupportProbability v S hv0 hv hZ).complexMean (fun x => w x.val * g x.val)‖ ≤ η at h + rw [finiteSupportProbability_complexMean v S hv0 hv hZ (fun x => w x * f x), + finiteSupportProbability_complexMean v S hv0 hv hZ (fun x => w x * g x)] at h + exact h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportCutoffTransfer.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportCutoffTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0da1391914bc6bdb3874f804c58ac4c8943d80c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportCutoffTransfer.lean @@ -0,0 +1,94 @@ +import OAI.Combinatorics.Progressions.Estimates.CyclicCutNeighborhood +import OAI.Combinatorics.Progressions.Estimates.ImageExtensionInverseBounds + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {A H : Type*} [AddCommGroup A] [AddCommGroup H] [DecidableEq H] + +theorem imageExtension_subset_indicator (φ : A →+ H) (P Q : Finset A) + (hφ : Set.InjOn φ (P : Set A)) (hQP : Q ⊆ P) (f : A → ℂ) (y : H) : + imageExtension φ Q f y = imageExtension φ P f y * finiteIndicator (Q.image φ) y := by + classical + by_cases hy : y ∈ Q.image φ + · obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp hy + rw [imageExtension_apply (hφ.mono hQP) f hx, imageExtension_apply hφ f (hQP hx)] + simp only [finiteIndicator, ite_eq_left (Finset.mem_image.mpr ⟨x, hx, rfl⟩), mul_one] + · rw [imageExtension_eq_zero f (by simpa using hy)] + simp only [finiteIndicator, ite_eq_right hy, mul_zero] + +variable [Fintype H] + +theorem density_mul_finiteSupportGowersNorm_le (j : ℕ) (φ : A →+ H) (Q : Finset A) + (hQ : Q.Nonempty) (hφ : ReflectsPairSums φ (Q : Set A)) (f : A → ℂ) : + ((Q.card : ℝ) / Fintype.card H) * finiteSupportGowersNorm (j + 1) Q f ≤ + gowersNorm (j + 1) (imageExtension φ Q f) := by + have hd := gowersNorm_restrict_one_pos j (hQ.image φ) + have hden := norm_expect_le_gowersNorm j (restrictTo (Q.image φ) (fun _ => (1 : ℂ))) + rw [norm_expect_restrict_one, Finset.card_image_of_injOn hφ.injOn] at hden + rw [finiteSupportGowersNorm_eq_restricted hφ j, restrictedGowersNorm, + restrictTo_imageExtension] + calc + _ ≤ gowersNorm (j + 1) (restrictTo (Q.image φ) (fun _ => (1 : ℂ))) * + (gowersNorm (j + 1) (imageExtension φ Q f) / + gowersNorm (j + 1) (restrictTo (Q.image φ) (fun _ => (1 : ℂ)))) := + mul_le_mul_of_nonneg_right hden (div_nonneg (gowersNorm_nonneg j _) hd.le) + _ = _ := mul_div_cancel₀ _ hd.ne' + +theorem gowersNorm_imageExtension_le_finiteSupport (j : ℕ) (φ : A →+ H) (Q : Finset A) + (hQ : Q.Nonempty) (hφ : ReflectsPairSums φ (Q : Set A)) (f : A → ℂ) : + gowersNorm (j + 1) (imageExtension φ Q f) ≤ finiteSupportGowersNorm (j + 1) Q f := by + have hd := gowersNorm_restrict_one_pos j (hQ.image φ) + have hden : gowersNorm (j + 1) (restrictTo (Q.image φ) (fun _ => (1 : ℂ))) ≤ 1 := + gowersNorm_le_one j _ (by intro x; simp [restrictTo]; split_ifs <;> norm_num) + rw [finiteSupportGowersNorm_eq_restricted hφ j, restrictedGowersNorm, + restrictTo_imageExtension] + exact (le_div_iff₀ hd).mpr (mul_le_of_le_one_right (gowersNorm_nonneg j _) hden) + +variable {I : Type*} [Fintype I] [DecidableEq I] +variable (N : I → ℕ) [∀ i, NeZero (N i)] + +theorem finiteSupport_product_fiber_transfer + {K : Type*} [AddCommGroup K] [Fintype K] [DecidableEq K] + (j : ℕ) (φ : A →+ (∀ i, ZMod (N i))) (P Q : Finset A) + (hQ : Q.Nonempty) (hQP : Q ⊆ P) (hφ : ReflectsPairSums φ (P : Set A)) + (ρ : (∀ i, ZMod (N i)) →+ K) (r : K) + (a : ∀ i, ZMod (N i)) (L : I → ℕ) + (himage : ∀ y, y ∈ Q.image φ ↔ + y ∈ cyclicProductBox N a L ∧ ρ y = r) + (f : A → ℂ) (hf : ∀ x ∈ P, ‖f x‖ ≤ 1) + {η : ℝ} (hη : 0 < η) (hη1 : η ≤ 1) + (hlarge : η ≤ ((Q.card : ℝ) / Fintype.card (∀ i, ZMod (N i))) * + finiteSupportGowersNorm (j + 2) Q f) : + (η / 2) ^ (2 ^ (j + 2) * Fintype.card I + 1) / + (4 * (Fintype.card I + 1)) ^ Fintype.card I ≤ finiteSupportGowersNorm (j + 2) P f := by + let g := imageExtension φ P f + have hg (y) : ‖g y‖ ≤ 1 := imageExtension_norm_le_one φ P f hφ.injOn hf y + have hmask (y) : imageExtension φ Q f y = + (g y * finiteIndicator {r} (ρ y)) * finiteIndicator (cyclicProductBox N a L) y := by + rw [imageExtension_subset_indicator φ P Q hφ.injOn hQP f] + by_cases hb : y ∈ cyclicProductBox N a L <;> by_cases hr : ρ y = r <;> + simp [finiteIndicator, himage, hb, hr, g] + have hcut : η ≤ gowersNorm (j + 2) (fun y => + (g y * finiteIndicator {r} (ρ y)) * finiteIndicator (cyclicProductBox N a L) y) := by + have hlocal := hlarge.trans + (density_mul_finiteSupportGowersNorm_le (j + 1) φ Q hQ (hφ.mono hQP) f) + rw [funext hmask] at hlocal + exact hlocal + have hgf (y) : ‖g y * finiteIndicator {r} (ρ y)‖ ≤ 1 := by + simpa only [norm_mul, one_mul] using mul_le_mul (hg y) + (finiteIndicator_norm_le_one {r} (ρ y)) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) + exact (gowersNorm_transfer_cyclicProductBox N j _ hgf a L hη hη1 hcut).trans + ((gowersNorm_mul_fiber j ρ r g).trans + (gowersNorm_imageExtension_le_finiteSupport (j + 1) φ P (hQ.mono hQP) hφ f)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportTranslation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportTranslation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0adbe240eae58dcf2befd0e1d1a437ce3030fbb7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteSupportTranslation.lean @@ -0,0 +1,45 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem translation_difference_zero_off {G : Type*} [AddCommGroup G] [DecidableEq G] + (w : G → ℝ) (S : Finset G) (hw : ∀ x ∉ S, w x = 0) (v x : G) + (hx : x ∉ S ∪ S.image (fun y => y + v)) : w (x - v) - w x = 0 := by + have hxS : x ∉ S := fun h => hx (Finset.mem_union_left _ h) + have hyS : x - v ∉ S := by + intro h + apply hx + exact Finset.mem_union_right _ (Finset.mem_image.mpr ⟨x - v, h, sub_add_cancel x v⟩) + rw [hw _ hyS, hw _ hxS, sub_self] + +theorem finiteSupport_translation_l1_bound {G : Type*} [AddCommGroup G] + (w : G → ℝ) (S : Finset G) (hw : ∀ x ∉ S, w x = 0) (v : G) + {B : ℝ} (hB : 0 ≤ B) (hstep : ∀ x, |w (x - v) - w x| ≤ B) : + (∑' x, |w (x - v) - w x|) ≤ 2 * (S.card : ℝ) * B := by + classical + let U := S ∪ S.image (fun y => y + v) + have hz (x : G) (hx : x ∉ U) : |w (x - v) - w x| = 0 := by + rw [translation_difference_zero_off w S hw v x hx, abs_zero] + have hc : (U.card : ℝ) ≤ 2 * (S.card : ℝ) := by + have hn : U.card ≤ S.card + S.card := + (Finset.card_union_le S (S.image (fun y => y + v))).trans + (Nat.add_le_add_left Finset.card_image_le _) + exact_mod_cast (show U.card ≤ 2 * S.card by omega) + calc + (∑' x, |w (x - v) - w x|) = ∑ x ∈ U, |w (x - v) - w x| := + (hasSum_sum_of_ne_finset_zero hz).tsum_eq + _ ≤ ∑ _x ∈ U, B := Finset.sum_le_sum (fun x _ => hstep x) + _ = (U.card : ℝ) * B := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right hc hB + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteUniformCoordinateRefresh.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteUniformCoordinateRefresh.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e50289640b6e9758485a287da6495b2678c10b5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteUniformCoordinateRefresh.lean @@ -0,0 +1,99 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialDifferencePermanentIndependence + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {I J X : Type*} + +noncomputable def coordinateResamplingEquiv (f : J → I) (hf : Function.Injective f) : + ((I → X) × (J → X)) ≃ ((I → X) × (J → X)) where + toFun p := (Function.extend f p.2 p.1, p.1 ∘ f) + invFun p := (Function.extend f p.2 p.1, p.1 ∘ f) + left_inv p := by + apply Prod.ext + · funext i + by_cases hi : i ∈ Set.range f + · obtain ⟨j, rfl⟩ := hi + exact hf.extend_apply _ _ j + · change Function.extend f (p.1 ∘ f) (Function.extend f p.2 p.1) i = p.1 i + rw [Function.extend_apply' _ _ _ hi, Function.extend_apply' _ _ _ hi] + · funext j + exact hf.extend_apply _ _ j + right_inv p := by + apply Prod.ext + · funext i + by_cases hi : i ∈ Set.range f + · obtain ⟨j, rfl⟩ := hi + exact hf.extend_apply _ _ j + · change Function.extend f (p.1 ∘ f) (Function.extend f p.2 p.1) i = p.1 i + rw [Function.extend_apply' _ _ _ hi, Function.extend_apply' _ _ _ hi] + · funext j + exact hf.extend_apply _ _ j + +theorem expect_coordinate_resampling [Fintype I] [Fintype J] + [DecidableEq I] [DecidableEq J] [Fintype X] [Nonempty X] + (f : J → I) (hf : Function.Injective f) (F : (I → X) → ℝ) : + (𝔼 v : I → X, 𝔼 y : J → X, F (Function.extend f y v)) = 𝔼 v : I → X, F v := by + have he := Fintype.expect_equiv (coordinateResamplingEquiv (X := X) f hf) + (fun p => F (Function.extend f p.2 p.1)) (fun p => F p.1) (fun _ => rfl) + simpa only [← Finset.univ_product_univ, Finset.expect_product, Fintype.expect_const] using he + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem expect_uniform_coordinate_refresh {B X : Type*} + [Fintype B] [DecidableEq B] [Fintype X] [Nonempty X] + (b : B) (F : (B → X) → ℝ) : + (𝔼 c : B → X, 𝔼 d : X, F (Function.update c b d)) = 𝔼 c : B → X, F c := by + let f : Unit → B := fun _ => b + have hf : Function.Injective f := fun _ _ _ => Subsingleton.elim _ _ + have he (c : B → X) (d : Unit → X) : + Function.extend f d c = Function.update c b (d ()) := by + funext i + by_cases hi : i = b + · subst i + rw [show Function.extend f d c b = d () from hf.extend_apply d c ()] + simp + · have hni : i ∉ Set.range f := by + rintro ⟨j, hj⟩ + exact hi hj.symm + rw [Function.extend_apply' d c i hni] + simp [hi] + have hx (c : B → X) : (𝔼 d : X, F (Function.update c b d)) = + 𝔼 d : Unit → X, F (Function.extend f d c) := by + apply Fintype.expect_equiv (Equiv.funUnique Unit X).symm + intro d + rw [he] + rfl + simp_rw [hx] + exact expect_coordinate_resampling f hf F + +theorem expect_uniform_coordinate {B : Type*} [Fintype B] [DecidableEq B] + {X : B → Type*} [∀ b, Fintype (X b)] [∀ b, Nonempty (X b)] + (b : B) (F : X b → ℝ) : + (𝔼 c : ∀ j, X j, F (c b)) = 𝔼 d : X b, F d := by + have h := uniform_expect_coordinate_pullback (X := X) (fun _ : Unit => b) + (fun _ _ _ => Subsingleton.elim _ _) (fun y => F (y ())) + calc + _ = 𝔼 y : Unit → X b, F (y ()) := h + _ = _ := by + apply Fintype.expect_equiv (Equiv.funUnique Unit (X b)) + intro y + rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FiniteUnitCoordinate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteUnitCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..75eafc655ac16083c77838a5d400875a8c36d4a6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FiniteUnitCoordinate.lean @@ -0,0 +1,36 @@ +import OAI.Combinatorics.Progressions.Linear.FiniteNormalizedFrame + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_large_unit_coordinate {I : Type*} [Fintype I] (v : I → ℂ) + (hv : ∑ i, ‖v i‖ ^ 2 = 1) : + ∃ i, 1 / (Fintype.card I + 1 : ℝ) ≤ ‖v i‖ := by + classical + have hpos : (0 : ℝ) < Fintype.card I + 1 := by positivity + by_contra h + push Not at h + have hn : ‖v‖ < 1 / (Fintype.card I + 1 : ℝ) := + (pi_norm_lt_iff (by positivity)).mpr h + let V : EuclideanSpace ℂ I := WithLp.toLp 2 v + have hV : ‖V‖ = 1 := by + have hs : ‖V‖ ^ 2 = 1 := by + rw [EuclideanSpace.norm_sq_eq] + exact hv + nlinarith [norm_nonneg V] + have hbound := euclidean_norm_le_card_add_one_mul V (norm_nonneg v) + (fun i => norm_le_pi_norm v i) + rw [hV] at hbound + have hsmall := (lt_div_iff₀ hpos).mp hn + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FixedCenterBoxDomination.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FixedCenterBoxDomination.lean new file mode 100644 index 0000000000000000000000000000000000000000..b73626d6e35b4d5e659d5d3cb9bb0d5a279f5f2e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FixedCenterBoxDomination.lean @@ -0,0 +1,114 @@ +import OAI.Combinatorics.Progressions.Sampling.TranslatedSamplerDomination + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule MeasureTheory VectorPolynomial +open scoped BigOperators NNReal + +theorem exists_fixed_center_selected_sampler_box_domination (m : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {X G : Type*} [Fintype X] [DecidableEq X] [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) + (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (R σ : Fin m → ℝ) (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (_hσ1 : ∀ j, σ j ≤ 1) + (C V : Fin m → ℝ≥0) + (_hC : ∀ j x, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) x‖ ≤ C j * ‖x‖) + (_hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) + (Cinv : Fin m → ℝ) (_hCinv : ∀ j, 0 ≤ Cinv j) + (_hchart : ∀ j x, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm x‖ ≤ Cinv j * ‖x‖) + (_hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ)+1) * R j ≤ 1/4) + (L₀ : ℕ) {P δ : ℝ} (_hP : 0 ≤ P) (_hδ : 0 < δ) (_hδsmall : δ ≤ 1/6) + (_hδP : δ⁻¹ ≤ Real.exp P) (_hX : (Fintype.card X : ℝ) ≤ P) + (_hK : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ P) (_hn : ∀ j, (n j : ℝ) ≤ P) + (_hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (_hAP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) (_hL₀P : (L₀ : ℝ) ≤ Real.exp P) + (_hCP : ∀ j, (C j : ℝ) ≤ Real.exp P) (_hVP : ∀ j, (V j : ℝ) ≤ Real.exp P) + (_hRP : ∀ j, (R j)⁻¹ ≤ Real.exp P) (_hσP : ∀ j, (σ j)⁻¹ ≤ Real.exp P) + (root : LayerSamplerVariables G I n B → ℤ) (_hroot : ∀ k, |(root k : ℝ)| ≤ Real.exp P) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val+1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) + (stride : X → ℕ) (_hs : ∀ k, 0 < stride k) + {Rrank S ρ : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) + (_hρ : 0 < ρ) (_hρP : 1/ρ ≤ Real.exp P) + (H : X → ℝ) (_hsize : ∀ k, Real.exp ((P+A)^A) ≤ H k) + (_hrank : ∀ j, HasLayerSamplingRank (j.val+1) H Rrank (U j) (p j)) + (_hRrank : Real.exp ((P+A)^A) ≤ Rrank) + (T : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride)) (_hT : T.Nonempty) + (W : Option (LayerSamplerVariables G I n B) × X → ℝ) (hW : ∀ z, 0 < W z) + (_hwidth : ∀ z, ρ * H z.2 ≤ W z) + (N margin : X → ℕ) (_hmargin : ∀ i, 2 * margin i < N i) + (_hfit : ∀ i, physicalSiteWidth root W i ≤ (margin i : ℝ)) + (_hloss : (∑ i, 2 * (margin i : ℝ) / N i) ≤ 1/2), + let pa := fun (a : X → ℤ) j => translate (fun i => (a i : ℝ)) (p j) + let hma := fun (a : X → ℤ) j => coefficients_translate_mem (U j) (fun i => (a i : ℝ)) (p j) (hm j) + let D := fun a center => translatedSelectedPhysicalDensity (G := G) B U b hb o R σ hR hσ L₀ + center (pa a) (hma a) + let Z := fun a center => selectedResidueDensityMass stride T W (D a center) + let M := ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (V j) + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride T W z, + ∃ hD : ∀ a center, 0 < Z a center, + (∀ a center, |Z a center-1| ≤ 3*δ ∧ 1/2 ≤ Z a center ∧ Z a center ≤ 3/2) ∧ + ∀ center (φ : (X → ℝ) → ℝ), (∀ v, φ v ∈ Set.Icc (0 : ℝ) 1) → + (𝔼 a ∈ trimmedIntegerBox N margin, + ∑' z, (selectedResidueDensityPMF stride T W hW hZ (D a center) + (translatedSelectedPhysicalDensity_nonneg (G := G) B U b hb o R σ hR hσ L₀ + center (pa a) (hma a)) (hD a center) z).toReal * + φ ((fun i => (a i : ℝ)) + physicalAffineSite root z)) ≤ + 2*M*(𝔼 x ∈ integerBox N, φ (fun i => (x i : ℝ))) + 6*δ := by + obtain ⟨A, hA, hlaw⟩ := exists_translated_selected_sampler_oneSite_domination m + refine ⟨A, hA, ?_⟩ + intro X G _ _ _ I _ n B _ J _ U b hb o _ _ _ _ μ _ _ ν _ _ + R σ hR hσ hσ1 C V hC hV Cinv hCinv hchart hsmall L₀ P δ hP hδ hδsmall hδP + hX hK hI hn hJ hAP hL₀P hCP hVP hRP hσP root hroot p hp hm stride hs Rrank S ρ + hS hSP hstride hρ hρP H hsize hrank hRrank T hT W hW hwidth N margin hmargin hfit hloss + let pa := fun (a : X → ℤ) j => translate (fun i => (a i : ℝ)) (p j) + let hma := fun (a : X → ℤ) j => coefficients_translate_mem (U j) (fun i => (a i : ℝ)) (p j) (hm j) + have hlocal (a : X → ℤ) := hlaw B U b hb o μ ν R σ hR hσ hσ1 C V hC hV + Cinv hCinv hchart hsmall L₀ hP hδ hδsmall hδP hX hK hI hn hJ hAP hL₀P hCP hVP hRP hσP + root hroot (pa a) + (fun j => degreeLE_translate (1 : X → ℕ) (fun _ => by norm_num) _ (p j) (hp j)) + (hma a) stride hs hS hSP hstride hρ hρP H hsize + (fun j => (hasLayerSamplingRank_translate_iff _ _ H Rrank (U j) (p j) (hp j)).mpr (hrank j)) + hRrank T hT W hW hwidth + choose hZ hcenters using hlocal + choose hD hrest using fun a center => hcenters a center + refine ⟨hZ 0, hD, fun a center => ⟨(hrest a center).1, (hrest a center).2.1, + (hrest a center).2.2.1⟩, ?_⟩ + intro center φ hφ + have hM : 0 ≤ ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (V j) := + Finset.prod_nonneg (fun j _ => earlyConstantDensityCap_nonneg _ _ (hR j) (V j).coe_nonneg) + refine selectedResidue_trimmed_domination_transfer root N margin hmargin hloss stride T W hW (hZ 0) + hfit (fun x => φ (fun i => (x i : ℝ))) (fun x _ => (hφ _).1) _ hM ?_ + intro a _ + have h := (hrest a center).2.2.2 (fun v => φ ((fun i => (a i : ℝ)) + v)) (fun v => hφ _) + have hcast (z : Option (LayerSamplerVariables G I n B) × X → ℤ) : + (fun i => ((a + integerPhysicalSite root z) i : ℝ)) = + (fun i => (a i : ℝ)) + physicalAffineSite root z := by + funext i + simp only [Pi.add_apply, Int.cast_add, integerPhysicalSite_cast_apply] + simpa only [hcast] using h + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialEmptyCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialEmptyCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..95ffd0d7b6a22a6eff5872ced16ed98d930febdb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialEmptyCoordinates.lean @@ -0,0 +1,124 @@ +import Mathlib.MeasureTheory.Integral.Pi +import OAI.Combinatorics.Progressions.Probability.DensityMixtureAELaw + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +variable {X : Type*} + +def fixedSpatialEmptyIndex : (Σ _ : X, Unit ⊕ Empty) ≃ X where + toFun a := a.1 + invFun x := ⟨x, .inl ()⟩ + left_inv a := by + rcases a with ⟨x, u | e⟩ + · cases u + rfl + · exact isEmptyElim e + right_inv _ := rfl + +variable [Fintype X] + +noncomputable def fixedSpatialEmptyCoordinates : + (X → ℝ) ≃ₗᵢ[ℝ] ((Σ _ : X, Unit ⊕ Empty) → ℝ) where + toFun u a := u a.1 + invFun v x := v ⟨x, .inl ()⟩ + left_inv _ := rfl + right_inv v := by + funext a + rcases a with ⟨x, u | e⟩ + · cases u + rfl + · exact isEmptyElim e + map_add' _ _ := rfl + map_smul' _ _ := rfl + norm_map' u := by + apply le_antisymm + · apply (pi_norm_le_iff_of_nonneg (norm_nonneg u)).mpr + intro a + exact norm_le_pi_norm u a.1 + · apply (pi_norm_le_iff_of_nonneg (norm_nonneg (fun a : Σ _ : X, Unit ⊕ Empty => u a.1))).mpr + intro x + exact norm_le_pi_norm (fun a : Σ _ : X, Unit ⊕ Empty => u a.1) ⟨x, .inl ()⟩ + +theorem fixedSpatialEmptyCoordinates_apply (u : X → ℝ) (a : Σ _ : X, Unit ⊕ Empty) : + fixedSpatialEmptyCoordinates u a = u a.1 := rfl + +theorem fixedSpatialEmptyCoordinates_symm_apply + (v : (Σ _ : X, Unit ⊕ Empty) → ℝ) (x : X) : + fixedSpatialEmptyCoordinates.symm v x = v ⟨x, .inl ()⟩ := rfl + +theorem fixedSpatialEmptyCoordinates_measurePreserving : + MeasurePreserving (fixedSpatialEmptyCoordinates (X := X)) volume volume := by + have hp := volume_measurePreserving_piCongrLeft (fun _ : Σ _ : X, Unit ⊕ Empty => ℝ) + (fixedSpatialEmptyIndex (X := X)).symm + convert hp using 1 + funext u a + rcases a with ⟨x, v | e⟩ + · cases v + rfl + · exact isEmptyElim e + +theorem fixedSpatialEmptyCoordinates_symm_measurePreserving : + MeasurePreserving (fixedSpatialEmptyCoordinates (X := X)).symm volume volume := + fixedSpatialEmptyCoordinates_measurePreserving.symm + (fixedSpatialEmptyCoordinates (X := X)).toHomeomorph.toMeasurableEquiv + +noncomputable def fixedSpatialEmptyDensity (f : (X → ℝ) → ℝ) + (v : (Σ _ : X, Unit ⊕ Empty) → ℝ) : ℝ := + f (fixedSpatialEmptyCoordinates.symm v) + +theorem fixedSpatialEmptyDensity_image_law (f : (X → ℝ) → ℝ) : + Measure.map fixedSpatialEmptyCoordinates (realDensityMeasure volume f) = + realDensityMeasure volume (fixedSpatialEmptyDensity f) := by + have h := realDensityMeasure_map_equiv + (fixedSpatialEmptyCoordinates (X := X)).toHomeomorph.toMeasurableEquiv volume f + change Measure.map (fixedSpatialEmptyCoordinates (X := X)) (realDensityMeasure volume f) = + realDensityMeasure (Measure.map (fixedSpatialEmptyCoordinates (X := X)) volume) + (fixedSpatialEmptyDensity f) at h + rw [fixedSpatialEmptyCoordinates_measurePreserving.map_eq] at h + exact h + +theorem fixedSpatialEmptyDensity_probability_data (f : (X → ℝ) → ℝ) + (hf0 : ∀ x, 0 ≤ f x) (hfi : Integrable f) (hfm : (∫ x, f x) = 1) : + (∀ v, 0 ≤ fixedSpatialEmptyDensity f v) ∧ + Integrable (fixedSpatialEmptyDensity f) ∧ + (∫ v, fixedSpatialEmptyDensity f v) = 1 := by + refine ⟨fun v => hf0 _, + fixedSpatialEmptyCoordinates_symm_measurePreserving.integrable_comp_of_integrable hfi, ?_⟩ + exact (fixedSpatialEmptyCoordinates_symm_measurePreserving.integral_comp + (fixedSpatialEmptyCoordinates (X := X)).symm.toHomeomorph.toMeasurableEquiv.measurableEmbedding f).trans hfm + +theorem fixedSpatialEmptyDensity_bounds (f : (X → ℝ) → ℝ) {C : ℝ} {L : ℝ≥0} + (hC : ∀ x, f x ∈ Set.Icc (0 : ℝ) C) (hL : LipschitzWith L f) : + (∀ v, fixedSpatialEmptyDensity f v ∈ Set.Icc (0 : ℝ) C) ∧ + LipschitzWith L (fixedSpatialEmptyDensity f) := by + refine ⟨fun v => hC _, ?_⟩ + have hi : LipschitzWith 1 (fun v : (Σ _ : X, Unit ⊕ Empty) → ℝ => + (fixedSpatialEmptyCoordinates (X := X)).symm v) := by + apply LipschitzWith.of_dist_le_mul + intro v w + simp only [NNReal.coe_one, one_mul] + exact le_of_eq ((fixedSpatialEmptyCoordinates (X := X)).symm.isometry.dist_eq v w) + apply LipschitzWith.of_dist_le_mul + intro v w + exact (hL.dist_le_mul _ _).trans (mul_le_mul_of_nonneg_left + (by simpa only [NNReal.coe_one, one_mul] using hi.dist_le_mul v w) (NNReal.coe_nonneg L)) + +theorem fixedSpatialEmptyDensity_zero_outside (f : (X → ℝ) → ℝ) {R : ℝ} + (hf : ∀ x, R < ‖x‖ → f x = 0) + (v : (Σ _ : X, Unit ⊕ Empty) → ℝ) (hv : R < ‖v‖) : + fixedSpatialEmptyDensity f v = 0 := by + apply hf + simpa only [LinearIsometryEquiv.norm_map] using hv + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialNativeAmbientComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialNativeAmbientComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..4048812fdaa373627aad78c0168c605b7c072ee4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialNativeAmbientComparison.lean @@ -0,0 +1,157 @@ +import OAI.Combinatorics.Progressions.Linear.FixedSpatialKernelNativeHaarJointMean +import OAI.Combinatorics.Progressions.Sampling.ForecastLawPhysicalAmbientHaarComparison + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory BooleanCubeKernel +open scoped Classical BigOperators NNReal + +variable {m : ℕ} {G : Type*} {X : Type} [Fintype G] [Fintype X] +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 → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (S : LayerSamplerScale (G := G) B U basis R σ) +local notation "short" => allocatedShortAxis (I := I) U basis S.value +local notation "Active" => {a : LayerSamplerAxis I n // ¬short a} +local notation "degree" => layerSamplerDegree I n +local notation "Principal" => PrincipalIntegerTuples B degree Empty (allocatedPrincipalSides B U basis S) +local notation "law" => principalTupleWeights (α := Empty) B degree + (allocatedPrincipalSides B U basis S) (allocatedPrincipalSides_pos B U basis S) +local notation "selected" => allocatedShortIntegerSelection U basis S.value +local notation "lowerSlice" => (fun (a : Active) (_p : B (Subtype.val a) × Fin (degree (Subtype.val a))) => (0 : ℝ)) +local notation "widthSlice" => (fun (a : Active) (_p : B (Subtype.val a) × Fin (degree (Subtype.val a))) => + ((S.value : ℝ) - 1) / S.value) + +variable (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) +variable (xref : G → IntegerScalarCubeBox Empty S.value) +variable {Ω : Type*} [Fintype Ω] {Eout : Fin m → Type*} [∀ j, Fintype (Eout j)] +local notation "Out" => Sigma (AllocatedCongruenceRankOutput X Eout short) +variable (active : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty + (allocatedPrincipalSides B U basis S) → FiniteProbabilityWeights Ω) +variable (Y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty + (allocatedPrincipalSides B U basis S) → Ω → Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U basis S.value)) → ℤ) +variable (N : ℕ) [NeZero N] (gridVolume : ℝ) +variable (base : X → ℤ) (physicalN : X → ℕ) (τ : ℝ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (basis j)) = + projectedIntegerLattice (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable {pw cw : ℝ} {Lw : ℝ≥0} +variable (Wtest : NormalizedPolynomialTwist X (Σ j, J j) pw cw Lw) +variable [hlattice : ∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) + (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] +variable [hcompact : CompactSpace (EuclideanJetLayers U (fun _ : Fin m => Unit))] +variable {Tgeo : Type*} [Fintype Tgeo] +variable (e : G ≃ X ⊕ (X ⊕ Tgeo)) (rootBudget rootLength : ℝ) (z : Option G × X → ℝ) +variable (h0 : (fixedSpatialKernelBlock e rootBudget rootLength z false).det ≠ 0) +variable (h1 : (fixedSpatialKernelBlock e rootBudget rootLength z true).det ≠ 0) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis (I := I) U basis S.value a}, + 4 ≤ Fintype.card (B a.val)) +local notation "density" => fixedSpatialKernelOriginalForecastDensity B U basis S e rootBudget + rootLength z h0 h1 hB lowerSlice widthSlice sample +local notation "κ" => ((forecastGeometricJacobian (X := X) (I := I) U basis R S.value gridVolume τ : ℝ) : ℂ) + +include hR hσ ν hcompact hlattice in +theorem fixedSpatialNativeAmbientMean_comparison + (hs : ∀ j, mixedArraySupported (allocatedLayerCenters B U basis S j) + (allocatedLayerWidths B U basis S j) + (allocatedLayerIntegerPMFs B U basis hR hσ S j) (sample j)) + (hS : 2 ≤ S.value) + (hσ1 : ∀ a : AllocatedShortIntegerAxis U basis S.value, σ a.val.1 ≤ 1) + (r : ℝ≥0) (hr : 0 < r) (hr3 : (3 : ℝ) ≤ r) + (hradius : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ r) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ + C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + (hW : 0 ≤ rootBudget) (hL : 0 ≤ rootLength) + (hsize : (Fintype.card G : ℝ) * rootLength ≤ rootBudget) (hz : ∀ a, |z a| ≤ 1) + (hτ : 0 < τ) (hmargin : ∀ i, 2 * spatialTrimMargin τ physicalN i ≤ physicalN i) + (hbase : base ∈ trimmedIntegerBox physicalN (spatialTrimMargin τ physicalN)) + (q : ℕ) [NeZero q] (hq : q ∣ N) (hm : 0 < m) + (hperiod : Wtest.modulus ∣ q) (hcover : Wtest.cover ∣ q) (hV : 0 < gridVolume) + {Findex : Type} [Fintype Findex] {pf cf : ℝ} {Lf : ℝ≥0} + (F : Findex → NormalizedPolynomialTwist X (Σ j, J j) pf cf Lf) + (c : Findex → ℂ) (δ : ℝ) + (happrox : ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hmem : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖κ * forecastDensityPhysicalTarget B U basis S density selected sample xref + active Y N gridVolume base physicalN τ o hb bW poly hmem u - + ∑ i, c i * (F i).eval physicalN poly u‖ ≤ δ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (hmem : ∀ j d, coefficients (poly j) d ∈ U j) + {P E Rrank M : ℝ} (hP : 0 ≤ P) (hE : 0 ≤ E) + (hX : (Fintype.card X : ℝ) ≤ P) (hdim : (Fintype.card (Σ j, J j) : ℝ) ≤ P) + (hLip : ((Lw * max 1 (Real.toNNReal cf) + Lf * max 1 (Real.toNNReal cw) : ℝ≥0) : ℝ) ≤ Real.exp P) + (hcoverF : ∀ i, ((Wtest.cover * (F i).cover : ℕ) : ℝ) ≤ Real.exp P) + (hmodF : ∀ i, ((Wtest.modulus * (F i).modulus : ℕ) : ℝ) ≤ Real.exp P) + (hmass : ∑ i, ‖c i‖ ≤ M) + (hlarge : ∀ i, Real.exp ((max P E + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ (physicalN i : ℝ)) + (hRrank : Real.exp ((max P E + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (physicalN i : ℝ)) + Rrank (U j) (poly j)) : + ‖(𝔼 u ∈ integerBox physicalN, Wtest.eval physicalN poly u * + (κ * forecastDensityPhysicalTarget B U basis S density selected sample xref + active Y N gridVolume base physicalN τ o hb bW poly hmem u)) - + forecastJointOriginalGridMean U basis S.value hm law active + (forecastInactiveFixedOutput B U basis S selected + (allocatedOriginalSampleInactiveCoefficients B selected sample) xref) + Y N q hq gridVolume density + (Wtest.forecastShortGridTest U basis S.value hb o bW R q hm hperiod hcover + (fun a => (base a : ℝ) / physicalN a) τ) + (fun j => (forecastJointGridCenter U basis S.value base j : ℝ)) + (forecastJointGridScale U basis R S.value physicalN τ)‖ ≤ + 2 * δ + M * Real.exp (-E) := by + have hhalf : (0 : ℝ) < 1 / 2 := by norm_num + have hSpos : (0 : ℝ) < S.value := by exact_mod_cast S.positive + have hSreal : (2 : ℝ) ≤ S.value := by exact_mod_cast hS + have hw : (1 / 2 : ℝ) ≤ ((S.value : ℝ) - 1) / S.value := by + apply (le_div_iff₀ hSpos).mpr + linarith + have hwidth : ∀ a p, |lowerSlice a p| + |widthSlice a p| ≤ 1 := by + intro a p + rw [abs_zero, zero_add, abs_of_nonneg (le_trans (by norm_num) hw)] + apply (div_le_one hSpos).mpr + linarith + have hdensity := (fixedSpatialKernelOriginalForecastDensity_bounds B U basis hR hσ S + e rootBudget rootLength z h0 h1 hB lowerSlice widthSlice hhalf + (fun _ _ => hw) (fun _ _ => le_rfl) sample hs).2.continuous.measurable + have hN (i : X) : 0 < physicalN i := by + exact_mod_cast (Real.exp_pos _).trans_le (hlarge i) + have hhaar := fixedSpatialKernelNativeHaarMean_eq_jointMean + (B := B) (U := U) (basis := basis) (S := S) (sample := sample) (x := xref) + (active := active) (Y := Y) (N := N) (volume := gridVolume) (base := base) + (physicalN := physicalN) (τ := τ) (o := o) (hb := hb) (bW := bW) + (Wtest := Wtest) (e := e) (Wgeo := rootBudget) (Lgeo := rootLength) (z := z) + (h0 := h0) (h1 := h1) (hB := hB) (lower := lowerSlice) (width := widthSlice) (ν := ν) + hR hσ hs hσ1 r hr hr3 hradius C hC hchart hbudget hhalf + (fun _ _ => hw) (fun _ _ => le_rfl) hwidth hW hL hsize hz + hN hτ hmargin hbase q hq hm hperiod hcover hV + have h := forecastDensityPhysicalTarget_ambientHaarComparison B U basis S density selected sample xref + active Y N gridVolume base physicalN τ o hb bW ν hdensity Wtest F c κ δ + (dvd_trans hcover hq) happrox poly hp hmem hP hE hX hdim hLip hcoverF hmodF hmass + hlarge hRrank hrank + simp_rw [mul_assoc, integral_const_mul] at h + rw [← Finset.mul_expect, hhaar] at h + exact h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialNativeRawSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialNativeRawSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..b00b38397f4f56cb2dc0c853f14e0211601d82fc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialNativeRawSupport.lean @@ -0,0 +1,131 @@ +import OAI.Combinatorics.Progressions.Sampling.ForecastNativeRawSpatialFamily + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module +open scoped BigOperators Classical NNReal + +variable {m : ℕ} {G X T : Type*} [Fintype G] [Fintype X] [DecidableEq X] [Fintype T] +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, 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 σ) + +local notation "short" => allocatedShortAxis (I := I) U basis S.value +local notation "Active" => {a : LayerSamplerAxis I n // ¬short a} +local notation "Input" => (Σ a : Active, B (Subtype.val a) × Fin (layerSamplerDegree I n (Subtype.val a))) +local notation "Output" => (Σ _a : Active, Unit) +local notation "Sample" => CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n +local notation "Domain" => (((Σ _ : X, Unit ⊕ Empty) → ℝ) × (Output → ℝ)) +local notation "noise" => allocatedSampleRestrictedProfileNoise B U basis S short +local notation "hamin" => unitProfilePrincipalLowerBound_pos B + +variable (e : G ≃ X ⊕ (X ⊕ T)) (W L : ℝ) (z : Option G × X → ℝ) +variable (h0 : (fixedSpatialKernelBlock e W L z false).det ≠ 0) + (h1 : (fixedSpatialKernelBlock e W L z true).det ≠ 0) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis (I := I) U basis S.value a}, + 4 ≤ Fintype.card (B a.val)) + (lower width : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis (I := I) U basis S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +local notation "density" => fixedSpatialKernelOriginalForecastDensity B U basis S e W L z h0 h1 hB lower width + +variable {δ : ℝ} (hδ : 0 < δ) + (hw : ∀ a p, δ ≤ width a p) (hl : ∀ a p, 0 ≤ lower a p) +variable (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) + (hs : ∀ j, mixedArraySupported (allocatedLayerCenters B U basis S j) + (allocatedLayerWidths B U basis S j) + (allocatedLayerIntegerPMFs B U basis hR hσ S j) (sample j)) + +variable (hwidth : ∀ a p, |lower a p| + |width a p| ≤ 1) +variable (hW : 0 ≤ W) (hL : 0 ≤ L) (hsize : (Fintype.card G : ℝ) * L ≤ W) +variable (hz : ∀ a, |z a| ≤ 1) +include hR hσ hδ hw hl hs hwidth hW hL hsize hz + +theorem fixedSpatialKernelOriginalForecastDensity_nonzero_norm_le_two + (y : Domain) (hy : density sample y ≠ 0) : ‖y‖ ≤ 2 := by + apply le_of_not_gt + intro h + exact hy (fixedSpatialKernelOriginalForecastDensity_zero_of_norm_gt_two + B U basis hR hσ S e W L z h0 h1 hB lower width hδ hw hl sample hs + hwidth hW hL hsize hz y h) + +theorem fixedSpatialKernelOriginalForecastDensity_nonzero_spatial_bounds + (y : Domain) (hy : density sample y ≠ 0) (i : X) : + |y.1 ⟨i, .inl ()⟩| ≤ 2 := by + have hn := fixedSpatialKernelOriginalForecastDensity_nonzero_norm_le_two + B U basis hR hσ S e W L z h0 h1 hB lower width hδ hw hl sample hs + hwidth hW hL hsize hz y hy + exact (Real.norm_eq_abs _).symm ▸ + (norm_le_pi_norm y.1 ⟨i, .inl ()⟩).trans ((le_max_left _ _).trans hn) + +theorem fixedSpatialKernelOriginalForecastDensity_nonzero_active_bounds + (y : Domain) (hy : density sample y ≠ 0) (a : Output) : + |y.2 a| ≤ 2 := by + have hn := fixedSpatialKernelOriginalForecastDensity_nonzero_norm_le_two + B U basis hR hσ S e W L z h0 h1 hB lower width hδ hw hl sample hs + hwidth hW hL hsize hz y hy + exact (Real.norm_eq_abs _).symm ▸ + (norm_le_pi_norm y.2 a).trans ((le_max_right _ _).trans hn) + +theorem fixedSpatialKernelOriginalForecastDensity_active_bound_three : + ∀ y, density sample y ≠ 0 → ∀ a, |y.2 a| ≤ 3 := by + intro y hy a + exact (fixedSpatialKernelOriginalForecastDensity_nonzero_active_bounds + B U basis hR hσ S e W L z h0 h1 hB lower width hδ hw hl sample hs + hwidth hW hL hsize hz y hy a).trans (by norm_num) + +variable (physicalN : X → ℕ) (hN : ∀ i, 0 < physicalN i) +variable {τ : ℝ} (hτ : 0 < τ) +variable (hmargin : ∀ i, 2 * spatialTrimMargin τ physicalN i ≤ physicalN i) +variable (base : X → ℤ) (hbase : base ∈ trimmedIntegerBox physicalN (spatialTrimMargin τ physicalN)) +include hN hτ hmargin hbase + +theorem fixedSpatialKernelOriginalForecastDensity_zero_outside_integerBox + (u : X → ℤ) (a : Output → ℝ) (hu : u ∉ integerBox physicalN) : + density sample ((fun i => ((u i.1 : ℝ) - base i.1) / (τ * physicalN i.1 / 8)), a) = 0 := + translatedForecastDensity_zero_outside_integerBox (density sample) + (fixedSpatialKernelOriginalForecastDensity_nonzero_spatial_bounds + B U basis hR hσ S e W L z h0 h1 hB lower width hδ hw hl sample hs + hwidth hW hL hsize hz) + physicalN hN hτ hmargin base hbase u a hu + +variable (xref : G → IntegerScalarCubeBox Empty S.value) +variable {Ω : Type*} [Fintype Ω] {Eout : Fin m → Type*} [∀ j, Fintype (Eout j)] +variable (active : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty + (allocatedPrincipalSides B U basis S) → FiniteProbabilityWeights Ω) +variable (Y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty + (allocatedPrincipalSides B U basis S) → Ω → + Sigma (AllocatedCongruenceRankOutput X Eout (allocatedShortAxis (I := I) U basis S.value)) → ℤ) +variable (N : ℕ) [NeZero N] (volume : ℝ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (basis j)) = + projectedIntegerLattice (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable {pw cw : ℝ} {Lw : ℝ≥0} +variable (Wtest : NormalizedPolynomialTwist X (Σ j, J j) pw cw Lw) + +theorem forecastNativeRawSpatialFamily_fixedSpatial_zero_outside + (u : X → ℤ) (hu : u ∉ integerBox physicalN) + (a : MixedCoveredJetSource I (fun _ => Unit) Eout n N) : + forecastNativeRawSpatialFamily B U basis S (density sample) sample xref active Y N volume + base physicalN τ o hb bW Wtest u a = 0 := by + unfold forecastNativeRawSpatialFamily forecastDensityPhysicalChartSource + forecastDensityPhysicalDeckSource + rw [fixedSpatialKernelOriginalForecastDensity_zero_outside_integerBox + B U basis hR hσ S e W L z h0 h1 hB lower width hδ hw hl sample hs + hwidth hW hL hsize hz physicalN hN hτ hmargin base hbase u _ hu, + Complex.ofReal_zero, zero_mul, zero_mul] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialSliceNativeAmbientRationalComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialSliceNativeAmbientRationalComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..13c9ce5cd6761f7da1d16150643526859f767f11 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSpatialSliceNativeAmbientRationalComparison.lean @@ -0,0 +1,317 @@ +import OAI.Combinatorics.Progressions.Sampling.ForecastLawOriginalNativeHaarJointMean +import OAI.Combinatorics.Progressions.Sampling.ForecastLawPhysicalAmbientHaarComparison + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory BooleanCubeKernel +open scoped Classical BigOperators NNReal + +variable {m : ℕ} {G : Type*} {X : Type} [Fintype G] [Fintype X] +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 → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (S : LayerSamplerScale (G := G) B U basis R σ) +local notation "short" => allocatedShortAxis (I := I) U basis S.value +local notation "Active" => {a : LayerSamplerAxis I n // ¬short a} +local notation "degree" => layerSamplerDegree I n +local notation "Principal" => PrincipalIntegerTuples B degree Empty (allocatedPrincipalSides B U basis S) +variable (law : FiniteProbabilityWeights + (PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U basis S))) +local notation "selected" => allocatedShortIntegerSelection U basis S.value +variable (lowerSlice widthSlice : ∀ a : {a : LayerSamplerAxis I n // + ¬allocatedShortAxis (I := I) U basis S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) +variable (xref : G → IntegerScalarCubeBox Empty S.value) +variable {Ω : Type*} [Fintype Ω] {Eout : Fin m → Type*} [∀ j, Fintype (Eout j)] +local notation "Out" => Sigma (AllocatedCongruenceRankOutput X Eout short) +variable (active : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty + (allocatedPrincipalSides B U basis S) → FiniteProbabilityWeights Ω) +variable (Y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty + (allocatedPrincipalSides B U basis S) → Ω → Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U basis S.value)) → ℤ) +variable (N : ℕ) [NeZero N] (gridVolume : ℝ) +variable (base : X → ℤ) (physicalN : X → ℕ) (τ : ℝ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (basis j)) = + projectedIntegerLattice (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable {pw cw : ℝ} {Lw : ℝ≥0} +variable (Wtest : NormalizedPolynomialTwist X (Σ j, J j) pw cw Lw) +variable [hlattice : ∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) + (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] +variable [hcompact : CompactSpace (EuclideanJetLayers U (fun _ : Fin m => Unit))] +variable {Tgeo : Type*} [Fintype Tgeo] +variable (e : G ≃ X ⊕ (X ⊕ Tgeo)) (rootBudget rootLength : ℝ) (z : Option G × X → ℝ) +variable (lowerG widthG : G → ℝ) +variable (hwGne : ∀ g, widthG g ≠ 0) +variable (h0 : (fixedSpatialKernelBlock e rootBudget rootLength z false).det ≠ 0) +variable (h1 : (fixedSpatialKernelBlock e rootBudget rootLength z true).det ≠ 0) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis (I := I) U basis S.value a}, + 4 ≤ Fintype.card (B a.val)) +local notation "density" => fixedSpatialKernelSliceOriginalForecastDensity B U basis S e rootBudget + rootLength z lowerG widthG h0 h1 hwGne hB lowerSlice widthSlice sample +local notation "κ" => ((forecastGeometricJacobian (X := X) (I := I) U basis R S.value gridVolume τ : ℝ) : ℂ) + +include hR hσ ν hcompact hlattice in +theorem fixedSpatialSliceNativeAmbientMean_comparison + (hs : ∀ j, mixedArraySupported (allocatedLayerCenters B U basis S j) + (allocatedLayerWidths B U basis S j) + (allocatedLayerIntegerPMFs B U basis hR hσ S j) (sample j)) + {δP : ℝ} (hδP : 0 < δP) + (hwP : ∀ a p, δP ≤ widthSlice a p) (hlP : ∀ a p, 0 ≤ lowerSlice a p) + (hwidthP : ∀ a p, |lowerSlice a p| + |widthSlice a p| ≤ 1) + (hlG : ∀ g, 0 ≤ lowerG g) (hwG : ∀ g, 0 ≤ widthG g) + (hcontainedG : ∀ g, lowerG g + widthG g ≤ 1) + (hσ1 : ∀ a : AllocatedShortIntegerAxis U basis S.value, σ a.val.1 ≤ 1) + (r : ℝ≥0) (hr : 0 < r) (hr3 : (3 : ℝ) ≤ r) + (hradius : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ r) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ + C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + (hW : 0 ≤ rootBudget) (hL : 0 ≤ rootLength) + (hsize : (Fintype.card G : ℝ) * rootLength ≤ rootBudget) (hz : ∀ a, |z a| ≤ 1) + (hτ : 0 < τ) (hmargin : ∀ i, 2 * spatialTrimMargin τ physicalN i ≤ physicalN i) + (hbase : base ∈ trimmedIntegerBox physicalN (spatialTrimMargin τ physicalN)) + (q : ℕ) [NeZero q] (hq : q ∣ N) (hm : 0 < m) + (hperiod : Wtest.modulus ∣ q) (hcover : Wtest.cover ∣ q) (hV : 0 < gridVolume) + {Findex : Type} [Fintype Findex] {pf cf : ℝ} {Lf : ℝ≥0} + (F : Findex → NormalizedPolynomialTwist X (Σ j, J j) pf cf Lf) + (c : Findex → ℂ) (δ : ℝ) + (happrox : ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hmem : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖κ * forecastLawDensityPhysicalTarget B U basis S law density selected sample xref + active Y N gridVolume base physicalN τ o hb bW poly hmem u - + ∑ i, c i * (F i).eval physicalN poly u‖ ≤ δ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (hmem : ∀ j d, coefficients (poly j) d ∈ U j) + {P E Rrank M : ℝ} (hP : 0 ≤ P) (hE : 0 ≤ E) + (hX : (Fintype.card X : ℝ) ≤ P) (hdim : (Fintype.card (Σ j, J j) : ℝ) ≤ P) + (hLip : ((Lw * max 1 (Real.toNNReal cf) + Lf * max 1 (Real.toNNReal cw) : ℝ≥0) : ℝ) ≤ Real.exp P) + (hcoverF : ∀ i, ((Wtest.cover * (F i).cover : ℕ) : ℝ) ≤ Real.exp P) + (hmodF : ∀ i, ((Wtest.modulus * (F i).modulus : ℕ) : ℝ) ≤ Real.exp P) + (hmass : ∑ i, ‖c i‖ ≤ M) + (hlarge : ∀ i, Real.exp ((max P E + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ (physicalN i : ℝ)) + (hRrank : Real.exp ((max P E + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (physicalN i : ℝ)) + Rrank (U j) (poly j)) : + ‖(𝔼 u ∈ integerBox physicalN, Wtest.eval physicalN poly u * + (κ * forecastLawDensityPhysicalTarget B U basis S law density selected sample xref + active Y N gridVolume base physicalN τ o hb bW poly hmem u)) - + forecastJointOriginalGridMean U basis S.value hm law active + (forecastInactiveFixedOutput B U basis S selected + (allocatedOriginalSampleInactiveCoefficients B selected sample) xref) + Y N q hq gridVolume density + (Wtest.forecastShortGridTest U basis S.value hb o bW R q hm hperiod hcover + (fun a => (base a : ℝ) / physicalN a) τ) + (fun j => (forecastJointGridCenter U basis S.value base j : ℝ)) + (forecastJointGridScale U basis R S.value physicalN τ)‖ ≤ + 2 * δ + M * Real.exp (-E) := by + have hdensity := (fixedSpatialKernelSliceOriginalForecastDensity_bounds B U basis hR hσ S + e rootBudget rootLength z lowerG widthG h0 h1 hwGne hB lowerSlice widthSlice + hδP hwP hlP sample hs).2.continuous + have hN (i : X) : 0 < physicalN i := by + exact_mod_cast (Real.exp_pos _).trans_le (hlarge i) + have hsupport := fixedSpatialKernelSliceOriginalForecastDensity_zero_of_norm_gt_two + B U basis hR hσ S e rootBudget rootLength z lowerG widthG h0 h1 hwGne hB + lowerSlice widthSlice hδP hwP hlP sample hs hwidthP hW hL hsize hz hlG hwG hcontainedG + have hhaar := forecastLawNativeHaarMean_eq_jointMean B U basis S law density sample xref + active Y N gridVolume base physicalN τ o hb bW Wtest ν hR hσ hs hσ1 + r hr hr3 hradius C hC hchart hbudget hdensity hsupport hN hτ hmargin hbase + q hq hm hperiod hcover hV + have h := forecastLawDensityPhysicalTarget_ambientHaarComparison B U basis S law density selected sample xref + active Y N gridVolume base physicalN τ o hb bW ν hdensity.measurable Wtest F c κ δ + (dvd_trans hcover hq) happrox poly hp hmem hP hE hX hdim hLip hcoverF hmodF hmass + hlarge hRrank hrank + simp_rw [mul_assoc, integral_const_mul] at h + rw [← Finset.mul_expect, hhaar] at h + exact h + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory BooleanCubeKernel +open scoped Classical BigOperators NNReal + +variable {m : ℕ} {G : Type*} {X : Type} [Fintype G] [Fintype X] +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 → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable (S : LayerSamplerScale (G := G) B U basis R σ) +local notation "short" => allocatedShortAxis (I := I) U basis S.value +local notation "Active" => {a : LayerSamplerAxis I n // ¬short a} +local notation "degree" => layerSamplerDegree I n +local notation "Principal" => PrincipalIntegerTuples B degree Empty (allocatedPrincipalSides B U basis S) +variable (law : FiniteProbabilityWeights + (PrincipalIntegerTuples B (layerSamplerDegree I n) Empty (allocatedPrincipalSides B U basis S))) +local notation "selected" => allocatedShortIntegerSelection U basis S.value +variable (lowerSlice widthSlice : ∀ a : {a : LayerSamplerAxis I n // + ¬allocatedShortAxis (I := I) U basis S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + +variable (sample : CoefficientSamplerArrays (K := LayerSamplerVariables G I n B) I n) +variable (xref : G → IntegerScalarCubeBox Empty S.value) +variable {Ω : Type*} [Fintype Ω] {Eout : Fin m → Type*} [∀ j, Fintype (Eout j)] +local notation "Out" => Sigma (AllocatedCongruenceRankOutput X Eout short) +variable (active : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty + (allocatedPrincipalSides B U basis S) → FiniteProbabilityWeights Ω) +variable (Y : PrincipalIntegerTuples B (layerSamplerDegree I n) Empty + (allocatedPrincipalSides B U basis S) → Ω → Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U basis S.value)) → ℤ) +variable (N : ℕ) [NeZero N] (gridVolume : ℝ) +variable (base : X → ℤ) (physicalN : X → ℕ) (τ : ℝ) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (hb : ∀ j, Submodule.span ℤ (Set.range (basis j)) = + projectedIntegerLattice (euclideanSubspace (U j))) +variable (bW : ∀ j, Module.Basis (Eout j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable {pw cw : ℝ} {Lw : ℝ≥0} +variable (Wtest : NormalizedPolynomialTwist X (Σ j, J j) pw cw Lw) +variable [hlattice : ∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) + (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] +variable [hcompact : CompactSpace (EuclideanJetLayers U (fun _ : Fin m => Unit))] +variable {Tgeo : Type*} [Fintype Tgeo] +variable (e : G ≃ X ⊕ (X ⊕ Tgeo)) (rootBudget rootLength : ℝ) (z : Option G × X → ℝ) +variable (lowerG widthG : G → ℝ) +variable (hwGne : ∀ g, widthG g ≠ 0) +variable (h0 : (fixedSpatialKernelBlock e rootBudget rootLength z false).det ≠ 0) +variable (h1 : (fixedSpatialKernelBlock e rootBudget rootLength z true).det ≠ 0) +variable (hB : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis (I := I) U basis S.value a}, + 4 ≤ Fintype.card (B a.val)) +local notation "density" => fixedSpatialKernelSliceOriginalForecastDensity B U basis S e rootBudget + rootLength z lowerG widthG h0 h1 hwGne hB lowerSlice widthSlice sample +local notation "κ" => ((forecastGeometricJacobian (X := X) (I := I) U basis R S.value gridVolume τ : ℝ) : ℂ) + +include hR hσ ν hcompact hlattice in +theorem fixedSpatialSliceNativeAmbientRationalMean_comparison + (hs : ∀ j, mixedArraySupported (allocatedLayerCenters B U basis S j) + (allocatedLayerWidths B U basis S j) + (allocatedLayerIntegerPMFs B U basis hR hσ S j) (sample j)) + {δP : ℝ} (hδP : 0 < δP) + (hwP : ∀ a p, δP ≤ widthSlice a p) (hlP : ∀ a p, 0 ≤ lowerSlice a p) + (hwidthP : ∀ a p, |lowerSlice a p| + |widthSlice a p| ≤ 1) + (hlG : ∀ g, 0 ≤ lowerG g) (hwG : ∀ g, 0 ≤ widthG g) + (hcontainedG : ∀ g, lowerG g + widthG g ≤ 1) + (hσ1 : ∀ a : AllocatedShortIntegerAxis U basis S.value, σ a.val.1 ≤ 1) + (r : ℝ≥0) (hr : 0 < r) (hr3 : (3 : ℝ) ≤ r) + (hradius : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ r) + (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ + C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (r : ℝ) * R j)) ≤ 1 / 4) + (hW : 0 ≤ rootBudget) (hL : 0 ≤ rootLength) + (hsize : (Fintype.card G : ℝ) * rootLength ≤ rootBudget) (hz : ∀ a, |z a| ≤ 1) + (hτ : 0 < τ) (hmargin : ∀ i, 2 * spatialTrimMargin τ physicalN i ≤ physicalN i) + (hbase : base ∈ trimmedIntegerBox physicalN (spatialTrimMargin τ physicalN)) + (q : ℕ) [NeZero q] (hq : q ∣ N) (hm : 0 < m) + (hperiod : Wtest.modulus ∣ q) (hcover : Wtest.cover ∣ q) (hV : 0 < gridVolume) + {Findex : Type} [Fintype Findex] {pf cf : ℝ} {Lf : ℝ≥0} + (F : Findex → NormalizedPolynomialTwist X (Σ j, J j) pf cf Lf) + (c : Findex → ℂ) (δ : ℝ) + (happrox : ∀ (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hmem : ∀ j d, coefficients (poly j) d ∈ U j) (u : X → ℤ), + ‖κ * forecastLawDensityPhysicalTarget B U basis S law density selected sample xref + active Y N gridVolume base physicalN τ o hb bW poly hmem u - + ∑ i, c i * (F i).eval physicalN poly u‖ ≤ δ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (hmem : ∀ j d, coefficients (poly j) d ∈ U j) + {P E Rrank M : ℝ} (hP : 0 ≤ P) (hE : 0 ≤ E) + (hX : (Fintype.card X : ℝ) ≤ P) (hdim : (Fintype.card (Σ j, J j) : ℝ) ≤ P) + (hLip : ((Lw * max 1 (Real.toNNReal cf) + Lf * max 1 (Real.toNNReal cw) : ℝ≥0) : ℝ) ≤ Real.exp P) + (hcoverF : ∀ i, ((Wtest.cover * (F i).cover : ℕ) : ℝ) ≤ Real.exp P) + (hmodF : ∀ i, ((Wtest.modulus * (F i).modulus : ℕ) : ℝ) ≤ Real.exp P) + (hmass : ∑ i, ‖c i‖ ≤ M) + (hlarge : ∀ i, Real.exp ((max P E + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ (physicalN i : ℝ)) + (hRrank : Real.exp ((max P E + nativeForecastAmbientExponent m) ^ + nativeForecastAmbientExponent m) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (physicalN i : ℝ)) + Rrank (U j) (poly j)) + (cutoff : ℕ) (hcutoff : 0 < cutoff) + {D Pdecay δgrid : ℝ} (hD : 0 ≤ D) + (hPdecay : ((Fintype.card Out + 2 : ℕ) : ℝ) ≤ Pdecay) + (hdecay : ∀ i (χ : AddChar (Out → ZMod N) ℂ), + ‖finiteImageCharacteristic (active i) (fun x j => (Y i x j : ZMod N)) χ‖ ≤ + D * (orderOf χ : ℝ) ^ (-Pdecay)) + (hδgrid : 0 ≤ δgrid) (hδgrid1 : δgrid ≤ 1) + (hmesh : ∀ j, ((q * cutoff : ℕ) : ℝ) / + forecastJointGridScale U basis R S.value physicalN τ j ≤ δgrid) : + let frame := fixedSpatialKernelSliceFrame rootBudget rootLength z lowerG widthG + let h0slice := fixedSpatialKernelBlock_slice_det_ne_zero e rootBudget rootLength z + lowerG widthG false h0 hwGne + let h1slice := fixedSpatialKernelBlock_slice_det_ne_zero e rootBudget rootLength z + lowerG widthG true h1 hwGne + let Cgrid := fixedSpatialOriginalForecastCap B + (fixedSpatialKernelBlockEquiv e rootBudget rootLength frame true h1slice) hδP + let Lgrid := fixedSpatialOriginalForecastLip B + (fixedSpatialKernelBlockEquiv e rootBudget rootLength frame false h0slice) + (fixedSpatialKernelBlockEquiv e rootBudget rootLength frame true h1slice) hδP + let Kgrid := Lw * max ‖τ / 8‖₊ (forecastNativeAmbientLip U basis o R) + let grid := forecastInactiveFixedOutput B U basis S selected + (allocatedOriginalSampleInactiveCoefficients B selected sample) xref + let test := Wtest.forecastShortGridTest U basis S.value hb o bW R q hm hperiod hcover + (fun a => (base a : ℝ) / physicalN a) τ + ‖(𝔼 u ∈ integerBox physicalN, Wtest.eval physicalN poly u * + (κ * forecastLawDensityPhysicalTarget B U basis S law density selected sample xref + active Y N gridVolume base physicalN τ o hb bW poly hmem u)) - + (∑' g, 𝔼 r : Out → ZMod N, + ((rationalInactiveForecast law active grid Y N gridVolume g r / gridVolume : ℝ) : ℂ) * + ∫ y, test g (fun a => ZMod.castHom hq (ZMod q) (r a)) y + ∂realDensityMeasure volume density)‖ ≤ + (2 * δ + M * Real.exp (-E)) + + forecastJointGridError (Fintype.card Out) + (Fintype.card (X ⊕ AllocatedActiveIntegerAxis U basis S.value)) + (Fintype.card (Σ j, I j)) cutoff D Lgrid Cgrid Kgrid δgrid := by + intro frame h0slice h1slice Cgrid Lgrid Kgrid grid test + have hamb := fixedSpatialSliceNativeAmbientMean_comparison B U basis hR hσ S law + lowerSlice widthSlice sample xref active Y N gridVolume base physicalN τ o hb bW + Wtest ν e rootBudget rootLength z lowerG widthG hwGne h0 h1 hB + hs hδP hwP hlP hwidthP hlG hwG hcontainedG hσ1 r hr hr3 hradius + C hC hchart hbudget hW hL hsize hz hτ hmargin hbase q hq hm hperiod hcover hV + F c δ happrox poly hp hmem hP hE hX hdim hLip hcoverF hmodF hmass + hlarge hRrank hrank + have hN (i : X) : 0 < physicalN i := by + exact_mod_cast (Real.exp_pos _).trans_le (hlarge i) + have hgrid := fixedSpatialSliceNativeJointGridMean_comparison B U basis hR hσ S + hb o bW Wtest e rootBudget rootLength z h0 h1 lowerG widthG hwGne + hlG hwG hcontainedG hB lowerSlice widthSlice hδP hwP hlP hwidthP + hW hL hsize hz sample hs hm τ base physicalN xref law active Y N q hq hperiod hcover + gridVolume hV.ne' (fun j => (forecastJointGridCenter U basis S.value base j : ℝ)) + (forecastJointGridScale U basis R S.value physicalN τ) + (forecastJointGridScale_pos U basis hR S.value physicalN hN hτ) + cutoff hcutoff hD hPdecay hdecay hδgrid hδgrid1 hmesh + exact (norm_sub_le_norm_sub_add_norm_sub _ _ _).trans (add_le_add hamb hgrid) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FixedSupportRawArray.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSupportRawArray.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f934b6aa178639df4d371647c776ffe9f9012aa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FixedSupportRawArray.lean @@ -0,0 +1,84 @@ +import OAI.Combinatorics.Progressions.Polynomial.RawPolynomialReconstruction + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def fixedNonprincipalExponents {K J : Type*} [Fintype J] + (S : Finset (K →₀ ℕ)) (principal : J → K →₀ ℕ) : Finset (K →₀ ℕ) := by + classical + exact S \ insert 0 (Finset.univ.image principal) + +theorem monomialArrayPolynomial_support_subset {J K : Type*} [Fintype J] + (e : J → K →₀ ℕ) (a : J → ℝ) : + ∀ ⦃m⦄, m ∈ (monomialArrayPolynomial e a).support → m ∈ Set.range e := by + intro m hm + by_contra hn + have hz := monomialArrayPolynomial_coeff_zero_of_not_mem e a m + (fun j hj => hn ⟨j, hj⟩) + exact (MvPolynomial.mem_support_iff.mp hm) hz + +theorem polynomial_coefficient_split_principal_on {K J : Type*} [Fintype J] + (p : MvPolynomial K ℝ) (S : Finset (K →₀ ℕ)) (hS : p.support ⊆ S) + (principal : J → K →₀ ℕ) (hinj : Function.Injective principal) (hzero : ∀ j, principal j ≠ 0) : + p = MvPolynomial.C (p.coeff 0) + + (∑ j, MvPolynomial.monomial (principal j) (p.coeff (principal j))) + + ∑ n ∈ fixedNonprincipalExponents S principal, MvPolynomial.monomial n (p.coeff n) := by + classical + unfold fixedNonprincipalExponents + have hsub : nonprincipalSupport p principal ⊆ S \ insert 0 (Finset.univ.image principal) := + Finset.sdiff_subset_sdiff hS (Finset.Subset.refl _) + have hsum : (∑ n ∈ nonprincipalSupport p principal, MvPolynomial.monomial n (p.coeff n)) = + ∑ n ∈ S \ insert 0 (Finset.univ.image principal), MvPolynomial.monomial n (p.coeff n) := by + apply Finset.sum_subset hsub + intro n hn hnot + have hns : n ∉ p.support := by + intro hp + exact hnot (Finset.mem_sdiff.mpr ⟨hp, (Finset.mem_sdiff.mp hn).2⟩) + simp only [MvPolynomial.notMem_support_iff.mp hns, map_zero] + rw [← hsum] + exact polynomial_coefficient_split_principal p principal hinj hzero + +theorem rawProductArrayPolynomial_of_support {D K : Type*} + {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (p : D → MvPolynomial K ℝ) (S : D → Finset (K →₀ ℕ)) (hS : ∀ d, (p d).support ⊆ S d) + (principal : ∀ d, B d → Fin (h d) → K) + (hinj : ∀ d, Function.Injective (fun b => productBlockExponent (principal d b))) + (hzero : ∀ d b, productBlockExponent (principal d b) ≠ 0) (d : D) : + rawProductArrayPolynomial h + (fun d => fixedNonprincipalExponents (S d) (fun b => productBlockExponent (principal d b))) + (fun _ n => n) principal + (fun d b => (p d).coeff (productBlockExponent (principal d b))) + (fun d n => (p d).coeff n) (fun d => (p d).coeff 0) d = p d := by + classical + simpa only [rawProductArrayPolynomial, productBlockExponent_monomial] using + (polynomial_coefficient_split_principal_on (p d) (S d) (hS d) + (fun b => productBlockExponent (principal d b)) (hinj d) (hzero d)).symm + +theorem canonicalRawJet_of_support {D G α : Type*} [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) (hh : ∀ d, 0 < h d) + (p : D → MvPolynomial (SamplerTupleIndex G B h) ℝ) + (S : D → Finset (SamplerTupleIndex G B h →₀ ℕ)) (hS : ∀ d, (p d).support ⊆ S d) + (sets : ∀ d, O d → Finset α) (Q : D → ℝ) + (tuple : Finset α → SamplerTupleIndex G B h → ℝ) (o : Σ d, O d) : + rawProductArrayJet h sets + (fun d => fixedNonprincipalExponents (S d) (canonicalPrincipalExponent h d)) + (fun _ n => n) (fun d b v => .inr ⟨d, b, v⟩) + (fun d b => (p d).coeff (canonicalPrincipalExponent h d b)) + (fun d n => (p d).coeff n) (fun d => (p d).coeff 0) Q tuple o = + booleanCoefficient (fun vertex => MvPolynomial.eval (tuple vertex) (p o.1)) (sets o.1 o.2)/Q o.1 := by + rw [rawProductArrayJet_polynomial] + exact congrArg (fun f => booleanCoefficient (fun vertex => MvPolynomial.eval (tuple vertex) f) + (sets o.1 o.2)/Q o.1) (rawProductArrayPolynomial_of_support h p S hS _ + (fun d => canonicalPrincipalExponent_injective h d (hh d)) + (fun d => canonicalPrincipalExponent_ne_zero h d (hh d)) o.1) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FullChartHomogeneousCorrection.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FullChartHomogeneousCorrection.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c9025a1964e16b0e71b59989745737363559fe1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FullChartHomogeneousCorrection.lean @@ -0,0 +1,930 @@ +import OAI.Combinatorics.Progressions.Estimates.RestrictedMajorCorrectionOnSet +import OAI.Combinatorics.Progressions.Geometry.FullTaggedChartCoefficientRange + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct + +variable {m : ℕ} {X M : Type} [LieRing M] [LieAlgebra ℚ M] +variable {ι L η : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + +variable (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) (N : X → ℕ) (budget : ℝ) + +def FullChartDetectedMajorGradeConclusion + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (_c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) (N : X → ℕ) (budget : ℝ) : Prop := + + ∃ (detectedfast : η → LieSubalgebra ℚ (weightedSubalgebra (lowTaggedWeight J k) k)) + (gen : η → Fin (finrank ℚ (PairAlgebra (weightedSubalgebra (lowTaggedWeight J k) k) M)) → weightedSubalgebra (lowTaggedWeight J k) k) + (slow rat : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) (q : ℕ), + (∀ i, (finrank ℚ (PairAlgebra (weightedSubalgebra (lowTaggedWeight J k) k) M) : ℝ) ≤ budget ∧ + Submodule.span ℚ (Set.range (gen i)) = (detectedfast i).toSubmodule ∧ + BasisGradedSubmodule (weightedBasis (lowTaggedWeight J k) k (lowTaggedWeight_pos J k)) + (weightedBasisGrade (lowTaggedWeight J k) k) (detectedfast i).toSubmodule ∧ + ∀ j a, rationalLogHeight + ((weightedBasis (lowTaggedWeight J k) k (lowTaggedWeight_pos J k)).repr (gen i j) a) ≤ budget) ∧ + (∀ i, BasisGradedSubmodule (Pi.basisFun ℝ (Fin (Fintype.card (LowTaggedIndex J k)))) (lowTaggedWeight J k) + (majorPhaseDetectedRealBase J k (detectedfast i))) ∧ + (∀ i h, lowTaggedRetained J k Utag h ≤ majorPhaseDetectedRealBase J k (detectedfast i)) ∧ + (∀ i α, |basis.coord i (coefficients slow α)| ≤ Real.exp budget) ∧ + 0 < q ∧ (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * budget) ∧ + (∀ i, realPolynomialCoefficientGrid q (coordinate (basis.coord i).toAddMonoidHom rat)) ∧ + RestrictedMajorGradeCorrectionConclusion (σ := X ⊕ (Σ j, J j)) F b ω hF (fullTaggedVariableWeight (X := X) J) fast lift k Z left right + (fullTaggedGradedBaseIntersection J k K₀ (fun i => majorPhaseDetectedRealBase J k (detectedfast i))) + (realChartSubstitute (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly)) (lowTaggedVectorExtend J k slow)) (lowTaggedVectorExtend J k rat) + +theorem fullChartDetectedMajorGradeConclusion_of_fullTagged + (h : FullTaggedDetectedMajorGradeConclusion (M := M) + F b ω hF J k fast basis lift Z left right K₀ Utag poly c N budget) : + FullChartDetectedMajorGradeConclusion (M := M) + F b ω hF J k fast basis lift Z left right K₀ Utag poly c N budget := by + unfold FullTaggedDetectedMajorGradeConclusion at h + obtain ⟨detectedfast, gen, slow, rat, q, hgen, hgrade, hretain, hcoeff, + hq, hqB, hgrid, hstep⟩ := h + rw [lowTaggedVectorExtend_majorChart] at hstep + unfold FullChartDetectedMajorGradeConclusion + refine ⟨detectedfast, gen, slow, rat, q, hgen, hgrade, hretain, hcoeff, + hq, hqB, hgrid, ?_⟩ + with_reducible exact hstep + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct + +variable {m : ℕ} {X M : Type} [LieRing M] [LieAlgebra ℚ M] +variable {ι L η : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (budget : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "quotientReal" => ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast) +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +def FullChartGradeCorrectionData : Prop := + ∃ (pS pR : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal) + (q : ℕ) (K' : Set (X ⊕ (Σ j, J j) → ℝ)), + 0 < q ∧ (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * budget) ∧ + K' ⊆ K₀ ∧ + (∀ t ∈ K', ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K') ∧ + (∀ t ∈ K₀, (∀ j, (fun a => t (Sum.inr ⟨j, a⟩)) ∈ Utag j) → t ∈ K') ∧ + (∀ α i, |basis.coord i (coefficients pS α)| ≤ Real.exp budget) ∧ + (∀ α, (fun i => basis.coord i (coefficients pR α)) ∈ realDenominatorGrid q) ∧ + (∀ t ∈ K', ∀ j ≤ k, + F.realSymbolGradeEvaluation b ω hF wt j t + ((left * F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart pS))⁻¹ * Z * + (F.restrictedMajorCorrection b ω hF wt fast lift k pR * right)⁻¹).coord ∈ + fast.baseChange ℝ) ∧ + ∃ (detectedfast : η → LieSubalgebra ℚ (weightedSubalgebra (lowTaggedWeight J k) k)) + (slow rat : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ quotientReal), + pS = lowTaggedVectorExtend J k slow ∧ pR = lowTaggedVectorExtend J k rat ∧ + K' = fullTaggedGradedBaseIntersection J k K₀ + (fun i => majorPhaseDetectedRealBase J k (detectedfast i)) + +theorem fullChartGradeCorrectionData_of_detected + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K₀) + (h : FullChartDetectedMajorGradeConclusion (M := M) + F b ω hF J k fast basis lift Z left right K₀ Utag poly c N budget) : + FullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget := by + unfold FullChartDetectedMajorGradeConclusion at h + obtain ⟨detectedfast, gen, slow, rat, q, hgen, hgrade, hretain, hcoeff, + hq, hqB, hgrid, hstep⟩ := h + let K := fun i => majorPhaseDetectedRealBase J k (detectedfast i) + have hcap := lowTaggedVectorExtend_coordinate_coefficient_bound J k + (fun i => (basis.coord i).toAddMonoidHom) slow (Real.exp budget) + (Real.exp_pos budget).le hcoeff + have hden := lowTaggedVectorExtend_coefficients_grid J k + (fun i => (basis.coord i).toAddMonoidHom) rat q hgrid + unfold RestrictedMajorGradeCorrectionConclusion at hstep + obtain ⟨A, D, hA, hD, _, _, _, _, hnext⟩ := hstep + have hAc : A = F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart (lowTaggedVectorExtend J k slow)) := by + apply NilpotentLieBCHGroup.ext + dsimp only [restrictedMajorCorrection] + with_reducible exact hA + have hDc : D = F.restrictedMajorCorrection b ω hF wt fast lift k + (lowTaggedVectorExtend J k rat) := by + apply NilpotentLieBCHGroup.ext + dsimp only [restrictedMajorCorrection] + with_reducible exact hD + rw [hAc, hDc] at hnext + unfold FullChartGradeCorrectionData + refine ⟨lowTaggedVectorExtend J k slow, lowTaggedVectorExtend J k rat, q, + fullTaggedGradedBaseIntersection J k K₀ K, hq, hqB, + fullTaggedGradedBaseIntersection_subset J k K₀ K, + fullTaggedGradedBaseIntersection_rat_dilation J k K₀ K hgrade hK₀, + ?_, hcap, hden, ?_, ?_⟩ + · intro t ht hU + refine ⟨ht, ?_⟩ + intro i + change lowTaggedCoordinates J k (fun j a => t (Sum.inr ⟨j, a⟩)) ∈ K i + apply (lowTaggedCoordinates_mem_iff J k (K i) (hgrade i) _).mpr + intro j + exact le_lowTaggedSubspaceFamily J k Utag (K i) (hretain i) j (hU j) + · with_reducible exact hnext + · exact ⟨detectedfast, slow, rat, rfl, rfl, rfl⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct + +variable {m : ℕ} {X M : Type} [LieRing M] [LieAlgebra ℚ M] +variable {ι L η : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (budget : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "quotientReal" => ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast) +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +def CertifiedFullChartGradeCorrectionData : Prop := + ∃ (pS pR : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal) + (q : ℕ) (K' : Set (X ⊕ (Σ j, J j) → ℝ)), + 0 < q ∧ (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * budget) ∧ + K' ⊆ K₀ ∧ + (∀ t ∈ K', ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K') ∧ + (∀ t ∈ K₀, (∀ j, (fun a => t (Sum.inr ⟨j, a⟩)) ∈ Utag j) → t ∈ K') ∧ + (∀ α i, |basis.coord i (coefficients pS α)| ≤ Real.exp budget) ∧ + (∀ α, (fun i => basis.coord i (coefficients pR α)) ∈ realDenominatorGrid q) ∧ + (∀ t ∈ K', ∀ j ≤ k, + F.realSymbolGradeEvaluation b ω hF wt j t + ((left * F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart pS))⁻¹ * Z * + (F.restrictedMajorCorrection b ω hF wt fast lift k pR * right)⁻¹).coord ∈ + fast.baseChange ℝ) ∧ + (∃ (detectedfast : η → LieSubalgebra ℚ (weightedSubalgebra (lowTaggedWeight J k) k)) + (slow rat : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ quotientReal), + pS = lowTaggedVectorExtend J k slow ∧ pR = lowTaggedVectorExtend J k rat ∧ + K' = fullTaggedGradedBaseIntersection J k K₀ + (fun i => majorPhaseDetectedRealBase J k (detectedfast i))) ∧ + RationalTaggedConstraintCertificate J K₀ K' budget (Fintype.card η * m) + +theorem certifiedFullChartGradeCorrectionData_of_detected + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K₀) + (h : FullChartDetectedMajorGradeConclusion (M := M) + F b ω hF J k fast basis lift Z left right K₀ Utag poly c N budget) : + CertifiedFullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget := by + unfold FullChartDetectedMajorGradeConclusion at h + obtain ⟨detectedfast, gen, slow, rat, q, hgen, hgrade, hretain, hcoeff, + hq, hqB, hgrid, hstep⟩ := h + let K := fun i => majorPhaseDetectedRealBase J k (detectedfast i) + have hcap := lowTaggedVectorExtend_coordinate_coefficient_bound J k + (fun i => (basis.coord i).toAddMonoidHom) slow (Real.exp budget) + (Real.exp_pos budget).le hcoeff + have hden := lowTaggedVectorExtend_coefficients_grid J k + (fun i => (basis.coord i).toAddMonoidHom) rat q hgrid + unfold RestrictedMajorGradeCorrectionConclusion at hstep + obtain ⟨A, D, hA, hD, _, _, _, _, hnext⟩ := hstep + have hAc : A = F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart (lowTaggedVectorExtend J k slow)) := by + apply NilpotentLieBCHGroup.ext + dsimp only [restrictedMajorCorrection] + with_reducible exact hA + have hDc : D = F.restrictedMajorCorrection b ω hF wt fast lift k + (lowTaggedVectorExtend J k rat) := by + apply NilpotentLieBCHGroup.ext + dsimp only [restrictedMajorCorrection] + with_reducible exact hD + rw [hAc, hDc] at hnext + have hcertificate := majorPhase_rationalTaggedConstraintCertificate J k + detectedfast gen K₀ budget hgen + unfold CertifiedFullChartGradeCorrectionData + refine ⟨lowTaggedVectorExtend J k slow, lowTaggedVectorExtend J k rat, q, + fullTaggedGradedBaseIntersection J k K₀ K, hq, hqB, + fullTaggedGradedBaseIntersection_subset J k K₀ K, + fullTaggedGradedBaseIntersection_rat_dilation J k K₀ K hgrade hK₀, + ?_, hcap, hden, ?_, ?_, hcertificate⟩ + · intro t ht hU + refine ⟨ht, ?_⟩ + intro i + change lowTaggedCoordinates J k (fun j a => t (Sum.inr ⟨j, a⟩)) ∈ K i + apply (lowTaggedCoordinates_mem_iff J k (K i) (hgrade i) _).mpr + intro j + exact le_lowTaggedSubspaceFamily J k Utag (K i) (hretain i) j (hU j) + · with_reducible exact hnext + · exact ⟨detectedfast, slow, rat, rfl, rfl, rfl⟩ + +theorem CertifiedFullChartGradeCorrectionData.to_uncertified + (h : CertifiedFullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget) : + FullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget := by + obtain ⟨pS, pR, q, K', hq, hqB, hsub, hdilate, hretain, hcap, hgrid, + hnext, horigin, _⟩ := h + refine ⟨pS, pR, q, K', hq, hqB, hsub, hdilate, hretain, hcap, hgrid, + ?_, horigin⟩ + with_reducible exact hnext + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +variable {m : ℕ} {X : Type} {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + +structure FullChartFiniteHistory + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (N : X → ℕ) (Bphase : ℝ) (n : ℕ) where + slow : ℕ → VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) + rat : ℕ → VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) + q : ℕ → ℕ + K : Set (X ⊕ (Σ j, J j) → ℝ) + subset : K ⊆ Kinitial + dilation : ∀ t ∈ K, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight J i * t i) ∈ K + retained : ∀ t ∈ Kinitial, (∀ j, (fun a => t (Sum.inr ⟨j, a⟩)) ∈ Utag j) → t ∈ K + slow_bound : ∀ j < n, ∀ α i, |basis.coord i (coefficients (slow j) α)| ≤ Real.exp Bphase + q_pos : ∀ j < n, 0 < q j + q_bound : ∀ j < n, (q j : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * Bphase) + rat_grid : ∀ j < n, ∀ α, + (fun i => basis.coord i (coefficients (rat j) α)) ∈ realDenominatorGrid (q j) + invariant : + let outer := F.restrictedMajorOuterFactors b ω hF (fullTaggedVariableWeight J) fast lift + (fun j => realChartSubstitute (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly)) (slow j)) rat n + ∀ t ∈ K, ∀ j ≤ n, + F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) j t + (outer.1⁻¹ * Z * outer.2⁻¹).coord ∈ fast.baseChange ℝ + +namespace FullChartFiniteHistory + +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (Bphase : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) +local notation "State" => FullChartFiniteHistory F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase + +noncomputable def outer {n : ℕ} (H : State n) : + F.RealPolynomialSymbolGroup wt × F.RealPolynomialSymbolGroup wt := + F.restrictedMajorOuterFactors b ω hF wt fast lift + (fun j => realChartSubstitute chart (H.slow j)) H.rat n + +noncomputable def initial + (hK : ∀ t ∈ Kinitial, ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ Kinitial) : + State 0 where + slow := fun _ => 0 + rat := fun _ => 0 + q := fun _ => 1 + K := Kinitial + subset := fun _ ht => ht + dilation := hK + retained := fun _ ht _ => ht + slow_bound := fun j hj => (Nat.not_lt_zero j hj).elim + q_pos := fun j hj => (Nat.not_lt_zero j hj).elim + q_bound := fun j hj => (Nat.not_lt_zero j hj).elim + rat_grid := fun j hj => (Nat.not_lt_zero j hj).elim + invariant := by + dsimp only + intro t ht j hj + have hj0 : j = 0 := Nat.eq_zero_of_le_zero hj + subst j + rw [F.realSymbolGradeEvaluation_zero] + exact Submodule.zero_mem _ + +variable {F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase} + +noncomputable def mono_bound {n : ℕ} (H : State n) {B' : ℝ} (hBB' : Bphase ≤ B') : + FullChartFiniteHistory F b ω hF J fast basis lift Z Kinitial Utag poly N B' n where + slow := H.slow + rat := H.rat + q := H.q + K := H.K + subset := H.subset + dilation := H.dilation + retained := H.retained + slow_bound := fun j hj α i => (H.slow_bound j hj α i).trans (Real.exp_le_exp.mpr hBB') + q_pos := H.q_pos + q_bound := fun j hj => (H.q_bound j hj).trans + (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hBB' (Nat.cast_nonneg _))) + rat_grid := H.rat_grid + invariant := H.invariant + +theorem outer_mono_bound {n : ℕ} (H : State n) {B' : ℝ} (hBB' : Bphase ≤ B') : + (H.mono_bound hBB').outer = H.outer := by + dsimp only [outer, mono_bound] + +theorem mono_bound_K {n : ℕ} (H : State n) {B' : ℝ} (hBB' : Bphase ≤ B') : + (H.mono_bound hBB').K = H.K := rfl + +theorem invariant_outer {n : ℕ} (H : State n) : + ∀ t ∈ H.K, ∀ j ≤ n, + F.realSymbolGradeEvaluation b ω hF wt j t + (H.outer.1⁻¹ * Z * H.outer.2⁻¹).coord ∈ fast.baseChange ℝ := by + dsimp only [outer] + have h := H.invariant + dsimp only at h + with_reducible exact h + +theorem exists_step {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) + (hdata : FullChartGradeCorrectionData F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget) : + ∃ Hnext : State (n + 1), + (∀ j < n, Hnext.slow j = H.slow j ∧ Hnext.rat j = H.rat j ∧ Hnext.q j = H.q j) ∧ + Hnext.K ⊆ H.K := by + classical + unfold FullChartGradeCorrectionData at hdata + obtain ⟨pS, pR, q, K', hq, hqB, hsub, hdilate, hretain, hcap, hgrid, hnext, _⟩ := hdata + let slow' := Function.update H.slow n pS + let rat' := Function.update H.rat n pR + let q' := Function.update H.q n q + have hslow (j : ℕ) (hj : j < n) : slow' j = H.slow j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hrat (j : ℕ) (hj : j < n) : rat' j = H.rat j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hqold (j : ℕ) (hj : j < n) : q' j = H.q j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hprefix : F.restrictedMajorOuterFactors b ω hF wt fast lift + (fun j => realChartSubstitute chart (slow' j)) rat' n = H.outer := by + apply F.restrictedMajorOuterFactors_congr + · intro j hj + rw [hslow j hj] + · exact hrat + have houter : F.restrictedMajorOuterFactors b ω hF wt fast lift + (fun j => realChartSubstitute chart (slow' j)) rat' (n + 1) = + (H.outer.1 * F.restrictedMajorCorrection b ω hF wt fast lift (n + 1) + (realChartSubstitute chart pS), + F.restrictedMajorCorrection b ω hF wt fast lift (n + 1) pR * H.outer.2) := by + rw [restrictedMajorOuterFactors, hprefix] + simp only [slow', rat', Function.update_self] + have hcapB : ∀ α i, |basis.coord i (coefficients pS α)| ≤ Real.exp Bphase := + fun α i => (hcap α i).trans (Real.exp_le_exp.mpr hbudget) + have hqBB : (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * Bphase) := + hqB.trans (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hbudget (Nat.cast_nonneg _))) + let Hnext : State (n + 1) := { + slow := slow' + rat := rat' + q := q' + K := K' + subset := fun t ht => H.subset (hsub ht) + dilation := hdilate + retained := fun t ht hU => hretain t (H.retained t ht hU) hU + slow_bound := by + intro j hj α i + by_cases hjn : j = n + · subst j + simpa only [slow', Function.update_self] using hcapB α i + · rw [hslow j (by omega)] + exact H.slow_bound j (by omega) α i + q_pos := by + intro j hj + by_cases hjn : j = n + · subst j + simpa only [q', Function.update_self] using hq + · rw [hqold j (by omega)] + exact H.q_pos j (by omega) + q_bound := by + intro j hj + by_cases hjn : j = n + · subst j + simpa only [q', Function.update_self] using hqBB + · rw [hqold j (by omega)] + exact H.q_bound j (by omega) + rat_grid := by + intro j hj α + by_cases hjn : j = n + · subst j + simpa only [rat', q', Function.update_self] using hgrid α + · rw [hrat j (by omega), hqold j (by omega)] + exact H.rat_grid j (by omega) α + invariant := by + dsimp only + rw [houter] + with_reducible exact hnext } + exact ⟨Hnext, fun j hj => ⟨hslow j hj, hrat j hj, hqold j hj⟩, hsub⟩ + +end FullChartFiniteHistory +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct + +variable {m : ℕ} {X : Type} +variable {ι L η : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (budget : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "quotientReal" => ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast) +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +theorem certifiedFullChartGradeCorrectionData_of_representative + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pS pR qS qR : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal) + (q : ℕ) (hq : 0 < q) (hqB : (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * budget)) + (hsub : K' ⊆ K₀) + (hdilate : ∀ t ∈ K', ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K') + (hretain : ∀ t ∈ K₀, (∀ j, (fun a => t (Sum.inr ⟨j, a⟩)) ∈ Utag j) → t ∈ K') + (hcap : ∀ α i, |basis.coord i (coefficients qS α)| ≤ Real.exp budget) + (hgrid : ∀ α, (fun i => basis.coord i (coefficients qR α)) ∈ realDenominatorGrid q) + (horigin : ∃ (detectedfast : η → LieSubalgebra ℚ (weightedSubalgebra (lowTaggedWeight J k) k)) + (slow rat : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ quotientReal), + qS = lowTaggedVectorExtend J k slow ∧ qR = lowTaggedVectorExtend J k rat ∧ + K' = fullTaggedGradedBaseIntersection J k K₀ + (fun i => majorPhaseDetectedRealBase J k (detectedfast i))) + (hcertificate : RationalTaggedConstraintCertificate J K₀ K' budget (Fintype.card η * m)) + (hslowEq : ∀ t ∈ K', eval₂ t (realChartSubstitute chart pS) = + eval₂ t (realChartSubstitute chart qS)) + (hratEq : ∀ t ∈ K', eval₂ t pR = eval₂ t qR) + (hnext : ∀ t ∈ K', ∀ j ≤ k, + F.realSymbolGradeEvaluation b ω hF wt j t + ((left * F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart pS))⁻¹ * Z * + (F.restrictedMajorCorrection b ω hF wt fast lift k pR * right)⁻¹).coord ∈ + fast.baseChange ℝ) : + CertifiedFullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget := by + refine ⟨qS, qR, q, K', hq, hqB, hsub, hdilate, hretain, hcap, hgrid, ?_, + horigin, hcertificate⟩ + intro t ht j hj + have heq := F.restrictedMajorCorrection_residual_grades_congr_on b ω hF wt fast lift + k Z left right K' hdilate (realChartSubstitute chart pS) pR + (realChartSubstitute chart qS) qR hslowEq hratEq t ht j hj + rw [← heq] + exact hnext t ht j hj + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct + +variable {m : ℕ} {X M : Type} [LieRing M] [LieAlgebra ℚ M] +variable {ι L η : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (budget : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "quotientReal" => ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast) +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +def CertifiedFullChartDetectedDecomposition : Prop := + ∃ (pS pR : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal) + (q : ℕ) (K' : Set (X ⊕ (Σ j, J j) → ℝ)), + 0 < q ∧ (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * budget) ∧ + K' ⊆ K₀ ∧ + (∀ t ∈ K', ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K') ∧ + (∀ t ∈ K₀, (∀ j, (fun a => t (Sum.inr ⟨j, a⟩)) ∈ Utag j) → t ∈ K') ∧ + (∀ α i, |basis.coord i (coefficients pS α)| ≤ Real.exp budget) ∧ + (∀ α, (fun i => basis.coord i (coefficients pR α)) ∈ realDenominatorGrid q) ∧ + (∀ t ∈ K', ∀ j ≤ k, + F.realSymbolGradeEvaluation b ω hF wt j t + ((left * F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart pS))⁻¹ * Z * + (F.restrictedMajorCorrection b ω hF wt fast lift k pR * right)⁻¹).coord ∈ + fast.baseChange ℝ) ∧ + (∃ (detectedfast : η → LieSubalgebra ℚ (weightedSubalgebra (lowTaggedWeight J k) k)) + (slow rat : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ quotientReal), + pS = lowTaggedVectorExtend J k slow ∧ pR = lowTaggedVectorExtend J k rat ∧ + K' = fullTaggedGradedBaseIntersection J k K₀ + (fun i => majorPhaseDetectedRealBase J k (detectedfast i))) ∧ + RationalTaggedConstraintCertificate J K₀ K' budget (Fintype.card η * m) ∧ + ∀ t ∈ K', fast.mkQ.baseChange ℝ + (F.realSymbolGradeEvaluation b ω hF wt k t (left⁻¹ * Z * right⁻¹).coord) = + eval₂ t (realChartSubstitute chart pS) + eval₂ t pR + +omit [Fintype η] in + +theorem fullChart_grade_quotient_of_low_value + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (K : η → Submodule ℝ (Fin (Fintype.card (LowTaggedIndex J k)) → ℝ)) + (slow rat : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ quotientReal) + (hvalue : ∀ (u : X → ℝ) (z : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ), + (∀ i, z ∈ K i) → + eval₂ (Sum.elim u z) (lowTaggedVectorRestrict J k + (F.realSymbolGradeQuotientPolynomial b ω hF wt fast k (left⁻¹ * Z * right⁻¹).coord)) = + eval₂ (Sum.elim u z) (realChartSubstitute + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (majorTranslationTopCoordinates (lowTaggedWeight J k) + (fun i => lowTaggedPolynomial J k poly i - MvPolynomial.C (c i)))) slow) + + eval₂ (Sum.elim u z) rat) : + ∀ t ∈ fullTaggedGradedBaseIntersection J k K₀ K, + fast.mkQ.baseChange ℝ + (F.realSymbolGradeEvaluation b ω hF wt k t (left⁻¹ * Z * right⁻¹).coord) = + eval₂ t (realChartSubstitute chart (lowTaggedVectorExtend J k slow)) + + eval₂ t (lowTaggedVectorExtend J k rat) := by + let P := F.realSymbolGradeQuotientPolynomial b ω hF wt fast k (left⁻¹ * Z * right⁻¹).coord + let lowchart := normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (majorTranslationTopCoordinates (lowTaggedWeight J k) + (fun i => lowTaggedPolynomial J k poly i - MvPolynomial.C (c i))) + have hP : DegreeLE wt k P := by + rw [degreeLE_iff] + intro α hα + by_contra hle + have hz := F.realSymbolGradeQuotientPolynomial_homogeneous b ω hF wt fast k + (left⁻¹ * Z * right⁻¹).coord α (ne_of_gt (Nat.lt_of_not_ge hle)) + exact Finsupp.mem_support_iff.mp hα hz + have hquotLow : ∀ t ∈ fullTaggedGradedBaseIntersection J k K₀ K, + fast.mkQ.baseChange ℝ + (F.realSymbolGradeEvaluation b ω hF wt k t (left⁻¹ * Z * right⁻¹).coord) = + eval₂ t (lowTaggedVectorExtend J k (realChartSubstitute lowchart slow)) + + eval₂ t (lowTaggedVectorExtend J k rat) := by + intro t ht + have h := hvalue (fun i => t (Sum.inl i)) + (fun b => t (lowTaggedVariableEmbedding J k (Sum.inr b))) ht.2 + have hsplit : Sum.elim (fun i => t (Sum.inl i)) + (fun b => t (lowTaggedVariableEmbedding J k (Sum.inr b))) = + t ∘ lowTaggedVariableEmbedding J k := by + funext i + cases i <;> rfl + rw [hsplit] at h + rw [← F.realSymbolGradeQuotientPolynomial_eval, + lowTaggedVectorRestrict_eval₂ J k _ hP, lowTaggedVectorExtend_eval₂, + lowTaggedVectorExtend_eval₂] + with_reducible exact h + intro t ht + have h := hquotLow t ht + dsimp only [lowchart] at h + simp only [lowTaggedVectorExtend_majorChart J k poly c (fun i => (N i : ℝ)) slow] at h + with_reducible exact h + +theorem certifiedFullChartDetectedDecomposition_of_vector_detection + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) + (hsection : ∀ y, fast.mkQ (lift y) = y) + (hK₀ : ∀ t ∈ K₀, ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K₀) + (hlower : ∀ t ∈ K₀, ∀ j < k, + F.realSymbolGradeEvaluation b ω hF wt j t + (left⁻¹ * Z * right⁻¹).coord ∈ fast.baseChange ℝ) + (hdetected : MajorPhaseVectorDetectedConclusion (L := M) J k Utag poly c N budget basis + (lowTaggedVectorRestrict J k + (F.realSymbolGradeQuotientPolynomial b ω hF wt fast k (left⁻¹ * Z * right⁻¹).coord))) : + CertifiedFullChartDetectedDecomposition F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget := by + obtain ⟨detectedfast, gen, slow, rat, q, hgen, hgrade, hretain, _, hcoeff, + hq, hqB, hgrid, _, _, hvalue⟩ := hdetected + let K := fun i => majorPhaseDetectedRealBase J k (detectedfast i) + have hquot := fullChart_grade_quotient_of_low_value F b ω hF J k fast + Z left right K₀ poly N c K slow rat (by with_reducible exact hvalue) + have hstep := F.restricted_symbol_major_grade_step b ω hF wt fast hfast lift hsection + k Z left right K₀ (fullTaggedGradedBaseIntersection J k K₀ K) + (fullTaggedGradedBaseIntersection_subset J k K₀ K) + (fullTaggedGradedBaseIntersection_rat_dilation J k K₀ K hgrade hK₀) + (realChartSubstitute chart (lowTaggedVectorExtend J k slow)) + (lowTaggedVectorExtend J k rat) hlower (by with_reducible exact hquot) + have hcap := lowTaggedVectorExtend_coordinate_coefficient_bound J k + (fun i => (basis.coord i).toAddMonoidHom) slow (Real.exp budget) + (Real.exp_pos budget).le hcoeff + have hden := lowTaggedVectorExtend_coefficients_grid J k + (fun i => (basis.coord i).toAddMonoidHom) rat q hgrid + obtain ⟨A, D, hA, hD, _, _, _, _, hnext⟩ := hstep + have hAc : A = F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart (lowTaggedVectorExtend J k slow)) := by + apply NilpotentLieBCHGroup.ext + dsimp only [restrictedMajorCorrection] + with_reducible exact hA + have hDc : D = F.restrictedMajorCorrection b ω hF wt fast lift k + (lowTaggedVectorExtend J k rat) := by + apply NilpotentLieBCHGroup.ext + dsimp only [restrictedMajorCorrection] + with_reducible exact hD + rw [hAc, hDc] at hnext + have hcertificate := majorPhase_rationalTaggedConstraintCertificate J k + detectedfast gen K₀ budget hgen + unfold CertifiedFullChartDetectedDecomposition + refine ⟨lowTaggedVectorExtend J k slow, lowTaggedVectorExtend J k rat, q, + fullTaggedGradedBaseIntersection J k K₀ K, hq, hqB, + fullTaggedGradedBaseIntersection_subset J k K₀ K, + fullTaggedGradedBaseIntersection_rat_dilation J k K₀ K hgrade hK₀, + ?_, hcap, hden, ?_, ?_, hcertificate, ?_⟩ + · intro t ht hU + refine ⟨ht, ?_⟩ + intro i + change lowTaggedCoordinates J k (fun j a => t (Sum.inr ⟨j, a⟩)) ∈ K i + apply (lowTaggedCoordinates_mem_iff J k (K i) (hgrade i) _).mpr + intro j + exact le_lowTaggedSubspaceFamily J k Utag (K i) (hretain i) j (hU j) + · with_reducible exact hnext + · exact ⟨detectedfast, slow, rat, rfl, rfl, rfl⟩ + · with_reducible exact hquot + +theorem CertifiedFullChartDetectedDecomposition.to_correctionData + (h : CertifiedFullChartDetectedDecomposition F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget) : + CertifiedFullChartGradeCorrectionData F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget := by + obtain ⟨pS, pR, q, K', hq, hqB, hsub, hdilate, hretain, hcap, hgrid, + hnext, horigin, hcertificate, _⟩ := h + refine ⟨pS, pR, q, K', hq, hqB, hsub, hdilate, hretain, hcap, hgrid, + ?_, horigin, hcertificate⟩ + with_reducible exact hnext + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +theorem weightedHomogeneousComponent_totalDegree_le_of_positive + {σ R : Type*} [CommRing R] (w : σ → ℕ) (hw : ∀ i, 0 < w i) + (k : ℕ) (p : MvPolynomial σ R) : + (MvPolynomial.weightedHomogeneousComponent w k p).totalDegree ≤ k := by + classical + unfold MvPolynomial.totalDegree + apply Finset.sup_le + intro α hα + rw [MvPolynomial.support_weightedHomogeneousComponent] at hα + exact (exponentSum_le_positive_weight w hw α).trans (Finset.mem_filter.mp hα).2.le + +namespace VectorPolynomial + +variable {σ R V η : Type*} [CommRing R] [AddCommGroup V] [Module R V] + +theorem weightedHomogeneousPart_idempotent (w : σ → ℕ) (k : ℕ) + (p : VectorPolynomial σ R V) : + weightedHomogeneousPart w k (weightedHomogeneousPart w k p) = + weightedHomogeneousPart w k p := + weightedHomogeneousPart_eq_self (weightedHomogeneousPart_homogeneous w k p) + +theorem weightedHomogeneousPart_coordinate_bound (w : σ → ℕ) (k : ℕ) + (f : η → V →+ ℝ) (p : VectorPolynomial σ R V) {C : ℝ} (hC : 0 ≤ C) + (hp : ∀ α i, |f i (coefficients p α)| ≤ C) : + ∀ α i, |f i (coefficients (weightedHomogeneousPart w k p) α)| ≤ C := by + intro α i + rw [coefficients_weightedHomogeneousPart] + split_ifs + · exact hp α i + · simpa only [map_zero, abs_zero] using hC + +theorem weightedHomogeneousPart_coefficients_grid (w : σ → ℕ) (k : ℕ) + (f : η → V →+ ℝ) (p : VectorPolynomial σ R V) (q : ℕ) + (hp : ∀ α, (fun i => f i (coefficients p α)) ∈ realDenominatorGrid q) : + ∀ α, (fun i => f i (coefficients (weightedHomogeneousPart w k p) α)) ∈ + realDenominatorGrid q := by + intro α + simp only [coefficients_weightedHomogeneousPart] + split_ifs + · exact hp α + · refine ⟨fun _ => 0, ?_⟩ + ext i + simp + +theorem weightedHomogeneousPart_coordinate_totalDegree_le + (w : σ → ℕ) (hw : ∀ i, 0 < w i) (k : ℕ) (f : V →+ ℝ) + (p : VectorPolynomial σ R V) : + (coordinate f (weightedHomogeneousPart w k p)).totalDegree ≤ k := by + rw [coordinate_weightedHomogeneousPart] + exact weightedHomogeneousComponent_totalDegree_le_of_positive w hw k _ + +end VectorPolynomial + +namespace NilpotentLieFiltration + +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (fast : Submodule ℚ F.AssociatedGraded) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + +theorem restrictedMajorCorrection_weightedHomogeneousPart (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) : + F.restrictedMajorCorrection b ω hF w fast lift k (weightedHomogeneousPart w k p) = + F.restrictedMajorCorrection b ω hF w fast lift k p := by + simp only [restrictedMajorCorrection, weightedHomogeneousPart_idempotent] + +variable {m : ℕ} {X : Type} (J : Fin m → Type) + +theorem restrictedMajorCorrection_fullChart_homogeneous (k : ℕ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (H : X → ℝ) + (p : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) : + F.restrictedMajorCorrection b ω hF (fullTaggedVariableWeight J) fast lift k + (realChartSubstitute (normalizedRealPolynomialChart H (fullTaggedMajorTopCoordinates J poly)) + (weightedHomogeneousPart (fullTaggedVariableWeight J) k p)) = + F.restrictedMajorCorrection b ω hF (fullTaggedVariableWeight J) fast lift k + (realChartSubstitute (normalizedRealPolynomialChart H (fullTaggedMajorTopCoordinates J poly)) p) := by + rw [realChartSubstitute_weightedHomogeneousPart _ _ _ + (fullTaggedMajorChart_homogeneous J poly H), + restrictedMajorCorrection_weightedHomogeneousPart] + +theorem fullChart_quotient_identity_homogeneous (k : ℕ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (H : X → ℝ) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight J)) + (K : Set (X ⊕ (Σ j, J j) → ℝ)) + (hK : ∀ t ∈ K, ∀ r : ℚ, + (fun i => (r : ℝ) ^ fullTaggedVariableWeight J i * t i) ∈ K) + (pS pR : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hquot : ∀ t ∈ K, fast.mkQ.baseChange ℝ + (F.realSymbolGradeEvaluation b ω hF (fullTaggedVariableWeight J) k t + (left⁻¹ * Z * right⁻¹).coord) = + eval₂ t (realChartSubstitute + (normalizedRealPolynomialChart H (fullTaggedMajorTopCoordinates J poly)) pS) + eval₂ t pR) : + ∀ t ∈ K, eval₂ t + (F.realSymbolGradeQuotientPolynomial b ω hF (fullTaggedVariableWeight J) fast k + (left⁻¹ * Z * right⁻¹).coord) = + eval₂ t (realChartSubstitute + (normalizedRealPolynomialChart H (fullTaggedMajorTopCoordinates J poly)) + (weightedHomogeneousPart (fullTaggedVariableWeight J) k pS)) + + eval₂ t (weightedHomogeneousPart (fullTaggedVariableWeight J) k pR) := by + intro t ht + rw [realChartSubstitute_weightedHomogeneousPart _ _ _ + (fullTaggedMajorChart_homogeneous J poly H)] + apply eval₂_weightedHomogeneousPart_decomposition_on _ _ _ _ K hK k + (F.realSymbolGradeQuotientPolynomial_homogeneous b ω hF _ fast k _) _ t ht + intro x hx + rw [realSymbolGradeQuotientPolynomial_eval] + exact hquot x hx + +section Certified + +variable {η : Type*} [Fintype η] [∀ j, Fintype (J j)] (k : ℕ) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (budget : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "quotientReal" => ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast) +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +theorem CertifiedFullChartDetectedDecomposition.exists_homogeneous + (h : CertifiedFullChartDetectedDecomposition F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget) : + ∃ (pS pR : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal) + (q : ℕ) (K' : Set (X ⊕ (Σ j, J j) → ℝ)), + (∀ α, Finsupp.weight wt α ≠ k → coefficients pS α = 0) ∧ + (∀ α, Finsupp.weight wt α ≠ k → coefficients pR α = 0) ∧ + (∀ i, (coordinate (basis.coord i).toAddMonoidHom pS).totalDegree ≤ k) ∧ + (∀ i, (coordinate (basis.coord i).toAddMonoidHom pR).totalDegree ≤ k) ∧ + 0 < q ∧ (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * budget) ∧ + K' ⊆ K₀ ∧ + (∀ t ∈ K', ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K') ∧ + (∀ t ∈ K₀, (∀ j, (fun a => t (Sum.inr ⟨j, a⟩)) ∈ Utag j) → t ∈ K') ∧ + (∀ α i, |basis.coord i (coefficients pS α)| ≤ Real.exp budget) ∧ + (∀ α, (fun i => basis.coord i (coefficients pR α)) ∈ realDenominatorGrid q) ∧ + (∀ t ∈ K', ∀ j ≤ k, + F.realSymbolGradeEvaluation b ω hF wt j t + ((left * F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart pS))⁻¹ * Z * + (F.restrictedMajorCorrection b ω hF wt fast lift k pR * right)⁻¹).coord ∈ + fast.baseChange ℝ) ∧ + (∃ (detectedfast : η → LieSubalgebra ℚ (weightedSubalgebra (lowTaggedWeight J k) k)) + (slow rat : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ quotientReal), + pS = lowTaggedVectorExtend J k slow ∧ pR = lowTaggedVectorExtend J k rat ∧ + K' = fullTaggedGradedBaseIntersection J k K₀ + (fun i => majorPhaseDetectedRealBase J k (detectedfast i))) ∧ + RationalTaggedConstraintCertificate J K₀ K' budget (Fintype.card η * m) ∧ + ∀ t ∈ K', eval₂ t + (F.realSymbolGradeQuotientPolynomial b ω hF wt fast k (left⁻¹ * Z * right⁻¹).coord) = + eval₂ t (realChartSubstitute chart pS) + eval₂ t pR := by + obtain ⟨pS, pR, q, K', hq, hqB, hsub, hdilate, hretain, hcap, hgrid, + hnext, horigin, hcertificate, hquot⟩ := h + refine ⟨weightedHomogeneousPart wt k pS, weightedHomogeneousPart wt k pR, q, K', + weightedHomogeneousPart_homogeneous wt k pS, + weightedHomogeneousPart_homogeneous wt k pR, + (fun i => weightedHomogeneousPart_coordinate_totalDegree_le wt + (fullTaggedVariableWeight_pos J) k (basis.coord i).toAddMonoidHom pS), + (fun i => weightedHomogeneousPart_coordinate_totalDegree_le wt + (fullTaggedVariableWeight_pos J) k (basis.coord i).toAddMonoidHom pR), + hq, hqB, hsub, hdilate, hretain, + weightedHomogeneousPart_coordinate_bound wt k (fun i => (basis.coord i).toAddMonoidHom) + pS (Real.exp_nonneg budget) hcap, + weightedHomogeneousPart_coefficients_grid wt k (fun i => (basis.coord i).toAddMonoidHom) + pR q hgrid, ?_, ?_, hcertificate, ?_⟩ + · intro t ht j hj + rw [restrictedMajorCorrection_fullChart_homogeneous, + restrictedMajorCorrection_weightedHomogeneousPart] + with_reducible exact hnext t ht j hj + · obtain ⟨detectedfast, slow, rat, hs, hr, hK⟩ := horigin + refine ⟨detectedfast, weightedHomogeneousPart (lowTaggedVariableWeight J k) k slow, + weightedHomogeneousPart (lowTaggedVariableWeight J k) k rat, ?_, ?_, hK⟩ + · rw [hs, lowTaggedVectorExtend_weightedHomogeneousPart] + · rw [hr, lowTaggedVectorExtend_weightedHomogeneousPart] + · with_reducible + exact fullChart_quotient_identity_homogeneous F b ω hF fast J k poly + (fun i => (N i : ℝ)) Z left right K' hdilate pS pR (by with_reducible exact hquot) + +end Certified + +end NilpotentLieFiltration +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FullFastCoefficientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FullFastCoefficientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b5f435e1eab0e8f7c3e18a00c3023d3c13b49e6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FullFastCoefficientCoordinates.lean @@ -0,0 +1,116 @@ +import OAI.Combinatorics.Progressions.Estimates.GradedUnitEvaluation +import OAI.Combinatorics.Progressions.Estimates.UniformFastCoefficientSpec + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped Matrix + +def FullFastCoefficientCoordinateSpec (s C : ℕ) : Prop := + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) (w : σ → ℕ) + (hw : ∀ i, 0 < w i) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) + (_hW : BasisGradedSubmodule + (F.squareFiltration.quotientTop.associatedGradedBasis (F.reducedSquareBasis e ω hF) + (fun a : ReducedSquareBasisIndex s ω => squareBasisWeight ω a.val) + (F.reducedSquareBasis_layers e ω hF)) + (fun a : ReducedSquareBasisIndex s ω => squareBasisWeight ω a.val) W.toSubmodule) + (v : κ → F.squareFiltration.quotientTop.AssociatedGraded) + (_hspan : Submodule.span ℚ (Set.range v) = W.toSubmodule) + {H : ℕ} (_hH : 1 ≤ H) + (_hv : ∀ j i, RationalHeightLE + ((F.squareFiltration.quotientTop.associatedGradedBasis (F.reducedSquareBasis e ω hF) + (fun a : ReducedSquareBasisIndex s ω => squareBasisWeight ω a.val) + (F.reducedSquareBasis_layers e ω hF)).repr (v j) i) H) + {p : ℝ} (_hp : 0 ≤ p) (_hι : (Fintype.card ι : ℝ) ≤ p) + (_hσ : (Fintype.card σ : ℝ) ≤ p) (_hκ : (Fintype.card κ : ℝ) ≤ p) + (_hHp : (H : ℝ) ≤ Real.exp p), + let U := F.fastPointwiseSquare e ω hF w W + let J := F.realFirstCoefficientFastSubmodule w hw (F.reducedSquareFastRelativeSubmodule w U) + ∃ d : ℕ, d ≤ Fintype.card ι * (s + 2) * (Fintype.card σ + 1) ^ (s + 1) ∧ + ∃ rows : Fin d → FirstCoefficientIndex w ω, Function.Injective rows ∧ + ∃ b : Basis (Fin d) ℝ (F.RealFirstCoefficientModule w ⧸ J), + ∃ R : (Fin d → ℝ) →ₗ[ℝ] F.RealFirstCoefficientModule w, + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + (∀ l x, F.FirstCoefficientGrid e ω hF w l x → + b.equivFun (J.mkQ x) ∈ realDenominatorGrid (m * l)) ∧ + (∀ l (y : Fin d → ℝ), y ∈ realDenominatorGrid l → + F.FirstCoefficientGrid e ω hF w (m * l) (R y)) ∧ + (∀ y : Fin d → ℝ, J.mkQ (R y) = b.equivFun.symm y) ∧ + (∀ (T : σ → ℝ), (∀ i, 0 < T i) → ∀ M : ℝ, 0 ≤ M → + (∀ x, F.FirstCoefficientSlowBound e ω hF w T M x → ∀ i, + |b.equivFun (J.mkQ x) i| ≤ + Real.exp ((p + C) ^ C) * M / monomialScale T (rows i).val.1) ∧ + (∀ y : Fin d → ℝ, (∀ i, |y i| ≤ M / monomialScale T (rows i).val.1) → + F.FirstCoefficientSlowBound e ω hF w T (Real.exp ((p + C) ^ C) * M) (R y))) ∧ + (∀ i j, (rows j).val.1 ≠ i.val.1 → + b.repr (J.mkQ (F.realFirstCoefficientBasis e ω hF w i)) j = 0) ∧ + ∀ (g : F.RealAdaptedPolynomialGroup w) + (hg : (F.adaptedReducedRealSymbolHom w g).coord ∈ + realificationLieSubalgebra (F.reducedSquareFastDiagonalSubalgebra w U)) + (a c : Fin d), ω (rows a).val.2 ≤ ω (rows c).val.2 → + LinearMap.toMatrix b b (F.realFastCoefficientAdjoint w hw U g hg).toLinearMap a c = + (1 : Matrix (Fin d) (Fin d) ℝ) a c + +theorem exists_fullFast_coefficient_coordinate_bound (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ FullFastCoefficientCoordinateSpec s C := by + have hex := exists_uniform_fast_coefficient_coordinate_bound s + obtain ⟨c, _, hcoords⟩ := hex + let Q : Polynomial ℕ := 3 * (Polynomial.X + Polynomial.C (s + 2)) ^ (s + 2) * + (Polynomial.X + 1) + 2 * Polynomial.X + 2 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((Q + Polynomial.C c) ^ c) + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F e ω hF w hw W hW v hspan H hH hv p hp hι hσ hκ hHp U J + classical + let : Finite (ReducedSquareSymbolIndex s w ω) := F.reducedSquareSymbolIndex_finite e ω hF w hw + let : Fintype (ReducedSquareSymbolIndex s w ω) := Fintype.ofFinite _ + let : Finite (QuotientTopSymbolIndex s w ω) := F.quotientTopSymbolIndex_finite e ω hF w hw + let : Fintype (QuotientTopSymbolIndex s w ω) := Fintype.ofFinite _ + let bW := F.reducedSquareBasis e ω hF + let ωW := fun a : ReducedSquareBasisIndex s ω => squareBasisWeight ω a.val + let v' := F.squareFiltration.quotientTop.pointwiseSymbolSpanningFamily bW ωW + (F.reducedSquareBasis_layers e ω hF) w v + have hU : BasisBlockInvariant (F.reducedSquareSymbolBasis e ω hF w) + (fun i => i.val.1) U.toSubmodule := + F.squareFiltration.quotientTop.symbolPointwiseSubalgebra_blockInvariant bW ωW + (F.reducedSquareBasis_layers e ω hF) w W + have hspan' : Submodule.span ℚ (Set.range v') = U.toSubmodule := + F.squareFiltration.quotientTop.pointwiseSymbolSpanningFamily_span bW ωW + (F.reducedSquareBasis_layers e ω hF) w W hW v hspan + have hv' : ∀ j i, RationalHeightLE ((F.reducedSquareSymbolBasis e ω hF w).repr (v' j) i) H := + F.squareFiltration.quotientTop.pointwiseSymbolSpanningFamily_height bW ωW + (F.reducedSquareBasis_layers e ω hF) w v hH hv + let q := reducedMatrixParameter s p + have hq : 0 ≤ q := reducedMatrixParameter_nonneg s hp + have hpq : p ≤ q := le_reducedMatrixParameter s hp + have hdims := F.reduced_lift_matrix_dimensions e ω hF w hw hp hι hσ hκ + have hcount : (Fintype.card (ReducedSquareSymbolIndex s w ω × κ) : ℝ) ≤ q := by + simpa only [Fintype.card_prod] using hdims.2.2 + have hfinal : (q + c) ^ c ≤ (p + C) ^ C := by + simpa [Q, q, reducedMatrixParameter, Polynomial.eval₂_pow] using hbudget p hp + have hraw := hcoords F e ω hF w hw U hU v' hspan' hH hv' hq + (hι.trans hpq) (hσ.trans hpq) hcount (hHp.trans (Real.exp_le_exp.mpr hpq)) + obtain ⟨d, hdim, rows, hinj, b, R, m, hm, hmp, hproj, hlift, hright, hweighted, hblock, haction⟩ := hraw + have hexp : Real.exp ((q + c) ^ c) ≤ Real.exp ((p + C) ^ C) := Real.exp_le_exp.mpr hfinal + refine ⟨d, hdim, rows, hinj, b, R, m, hm, hmp.trans hexp, hproj, hlift, hright, ?_, hblock, haction⟩ + intro T hT M hM + obtain ⟨hproj', hlift'⟩ := hweighted T hT M hM + constructor + · intro x hx i + exact (hproj' x hx i).trans (div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_right hexp hM) (monomialScale_pos T hT _).le) + · intro y hy i + exact (hlift' y hy i).trans (div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_right hexp hM) (monomialScale_pos T hT _).le) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FullTaggedChartCoefficientRange.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FullTaggedChartCoefficientRange.lean new file mode 100644 index 0000000000000000000000000000000000000000..515131819fcde8c957c469ce34c7421082aa646a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FullTaggedChartCoefficientRange.lean @@ -0,0 +1,504 @@ +import Mathlib.Algebra.MvPolynomial.Funext +import OAI.Combinatorics.Progressions.Estimates.RationalTaggedConstraintHistory + +namespace OAI + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {U B I : Type*} [Fintype I] + +noncomputable def polynomialTagLinearEmbedding (E : B → I → ℝ) : + U ⊕ B → MvPolynomial (U ⊕ I) ℝ := + Sum.elim (fun u => X (Sum.inl u)) + (fun b => ∑ i, C (E b i) * X (Sum.inr i)) + +@[simp] theorem polynomialTagLinearEmbedding_inl (E : B → I → ℝ) (u : U) : + polynomialTagLinearEmbedding E (Sum.inl u) = X (Sum.inl u) := rfl + +@[simp] theorem polynomialTagLinearEmbedding_inr (E : B → I → ℝ) (b : B) : + polynomialTagLinearEmbedding (U := U) E (Sum.inr b) = + ∑ i, C (E b i) * X (Sum.inr i) := rfl + +theorem polynomialTagLinearEmbedding_rename (E : B → I → ℝ) + (p : MvPolynomial U ℝ) : + aeval (R := ℝ) (polynomialTagLinearEmbedding E) + (rename (Sum.inl : U → U ⊕ B) p) = rename (Sum.inl : U → U ⊕ I) p := by + rw [aeval_rename, rename_eq_aeval] + rfl + +theorem normalizedRealPolynomialChart_linear_restriction_coordinate + (H : U → ℝ) (A : B → MvPolynomial U ℝ) (A' : I → MvPolynomial U ℝ) + (E : B → I → ℝ) (hA : ∀ b, A b = ∑ i, C (E b i) * A' i) + (j : U ⊕ B) : + aeval (R := ℝ) (polynomialTagLinearEmbedding E) + (normalizedRealPolynomialChart H A j) = + aeval (R := ℝ) (normalizedRealPolynomialChart H A') + (polynomialTagLinearEmbedding E j) := by + classical + cases j with + | inl u => simp + | inr b => + simp only [normalizedRealPolynomialChart_inr, map_sub, aeval_X, + polynomialTagLinearEmbedding_inr, polynomialTagLinearEmbedding_rename, + map_sum, map_mul, aeval_C, MvPolynomial.algebraMap_eq] + rw [hA b] + simp only [map_sum, map_mul, rename_C] + simp only [mul_sub, Finset.sum_sub_distrib] + +theorem normalizedRealPolynomialChart_linear_restriction + (H : U → ℝ) (A : B → MvPolynomial U ℝ) (A' : I → MvPolynomial U ℝ) + (E : B → I → ℝ) (hA : ∀ b, A b = ∑ i, C (E b i) * A' i) + (p : MvPolynomial (U ⊕ B) ℝ) : + aeval (R := ℝ) (polynomialTagLinearEmbedding E) + (aeval (R := ℝ) (normalizedRealPolynomialChart H A) p) = + aeval (R := ℝ) (normalizedRealPolynomialChart H A') + (aeval (R := ℝ) (polynomialTagLinearEmbedding E) p) := by + have h : (aeval (R := ℝ) (polynomialTagLinearEmbedding E)).comp + (aeval (R := ℝ) (normalizedRealPolynomialChart H A)) = + (aeval (R := ℝ) (normalizedRealPolynomialChart H A')).comp + (aeval (R := ℝ) (polynomialTagLinearEmbedding E)) := by + ext j : 1 + simpa only [AlgHom.comp_apply, aeval_X] using + normalizedRealPolynomialChart_linear_restriction_coordinate H A A' E hA j + exact AlgHom.congr_fun h p + +theorem polynomialTagLinearEmbedding_eval (E : B → I → ℝ) + (u : U → ℝ) (v : I → ℝ) (p : MvPolynomial (U ⊕ B) ℝ) : + eval (Sum.elim u v) (aeval (R := ℝ) (polynomialTagLinearEmbedding E) p) = + eval (Sum.elim u (fun b => ∑ i, E b i * v i)) p := by + change aeval (R := ℝ) (Sum.elim u v) + (aeval (R := ℝ) (polynomialTagLinearEmbedding E) p) = + aeval (R := ℝ) (Sum.elim u (fun b => ∑ i, E b i * v i)) p + rw [comp_aeval_apply] + congr 1 + ext j : 1 + cases j <;> simp [polynomialTagLinearEmbedding] + +theorem normalizedChart_decomposition_linear_restriction + (H : U → ℝ) (A : B → MvPolynomial U ℝ) (A' : I → MvPolynomial U ℝ) + (E : B → I → ℝ) (hA : ∀ b, A b = ∑ i, C (E b i) * A' i) + (p slow rat : MvPolynomial (U ⊕ B) ℝ) + (h : p = aeval (R := ℝ) (normalizedRealPolynomialChart H A) slow + rat) : + aeval (R := ℝ) (polynomialTagLinearEmbedding E) p = + aeval (R := ℝ) (normalizedRealPolynomialChart H A') + (aeval (R := ℝ) (polynomialTagLinearEmbedding E) slow) + + aeval (R := ℝ) (polynomialTagLinearEmbedding E) rat := by + rw [h, map_add, normalizedRealPolynomialChart_linear_restriction H A A' E hA] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module VectorPolynomial +open scoped BigOperators + +variable {B I U : Type*} [Fintype B] [Fintype I] + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (A : B → MvPolynomial U ℝ) + (hA : ∀ α, (fun b => (A b).coeff α) ∈ K) + +include hA + +private theorem normalizedChart_coefficients_mem (α : U →₀ ℕ) : + coefficients (ofCoordinates (R := ℝ) (Pi.basisFun ℝ B) A) α ∈ K := by + have heq : coefficients (ofCoordinates (R := ℝ) (Pi.basisFun ℝ B) A) α = + fun b => (A b).coeff α := by + funext b + exact coefficients_ofCoordinates_basisFun A α b + rw [heq] + exact hA α + +noncomputable def normalizedChartSubspaceCoordinates : I → MvPolynomial U ℝ := + fun i => coordinate (e.coord i).toAddMonoidHom + (restrictCoefficients K (ofCoordinates (R := ℝ) (Pi.basisFun ℝ B) A) + (normalizedChart_coefficients_mem K A hA)) + +omit [Fintype I] in +theorem normalizedChartSubspaceCoordinates_coeff (α : U →₀ ℕ) (i : I) : + (normalizedChartSubspaceCoordinates K e A hA i).coeff α = + e.repr ⟨fun b => (A b).coeff α, hA α⟩ i := by + unfold normalizedChartSubspaceCoordinates + rw [coeff_coordinate] + change e.repr (coefficients + (restrictCoefficients K (ofCoordinates (R := ℝ) (Pi.basisFun ℝ B) A) + (normalizedChart_coefficients_mem K A hA)) α) i = _ + congr 1 + apply congrArg e.repr + apply Subtype.ext + rw [coefficients_restrictCoefficients] + funext b + exact coefficients_ofCoordinates_basisFun A α b + +theorem normalizedChartSubspaceCoordinates_reconstruct (b : B) : + A b = ∑ i, (e i : B → ℝ) b • normalizedChartSubspaceCoordinates K e A hA i := by + classical + ext α + simp only [MvPolynomial.coeff_sum, MvPolynomial.coeff_smul, + normalizedChartSubspaceCoordinates_coeff, smul_eq_mul] + have heq := congrArg (fun z : K => (z : B → ℝ) b) + (e.sum_repr ⟨fun c => (A c).coeff α, hA α⟩) + simpa only [Submodule.coe_sum, Finset.sum_apply, Submodule.coe_smul, + Pi.smul_apply, smul_eq_mul, mul_comm] using heq.symm + +theorem normalizedChartSubspaceCoordinates_eval_mem (x : U → ℝ) : + (fun b => MvPolynomial.eval x (A b)) ∈ K := by + let P := ofCoordinates (R := ℝ) (Pi.basisFun ℝ B) A + let Q := restrictCoefficients K P (normalizedChart_coefficients_mem K A hA) + have heval : (eval (V := K) x Q : B → ℝ) = eval x P := + eval_restrictCoefficients K P (normalizedChart_coefficients_mem K A hA) x + have hcoord : eval x P = fun b => MvPolynomial.eval x (A b) := by + have h := eval₂_ofCoordinates (R := ℝ) (Pi.basisFun ℝ B) A x + have he : eval₂ x P = eval x P := by + simpa using (eval₂_algebraMap (S := ℝ) x P) + rw [he] at h + simpa only [Pi.basisFun_equivFun, LinearEquiv.refl_symm, LinearEquiv.refl_apply] + using h + rw [← hcoord, ← heval] + exact (eval (V := K) x Q).property + +theorem exists_normalizedChartSubspaceCoordinates : + ∃ A' : I → MvPolynomial U ℝ, + (∀ b, A b = ∑ i, (e i : B → ℝ) b • A' i) ∧ + ∀ x : U → ℝ, (fun b => MvPolynomial.eval x (A b)) ∈ K := + ⟨normalizedChartSubspaceCoordinates K e A hA, + normalizedChartSubspaceCoordinates_reconstruct K e A hA, + normalizedChartSubspaceCoordinates_eval_mem K A hA⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 +open Module _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators + +variable {U B I : Type*} [Fintype B] [Fintype I] + +noncomputable def polynomialSubspaceRestriction (K : Submodule ℝ (B → ℝ)) + (e : Basis I ℝ K) : MvPolynomial (U ⊕ B) ℝ →ₐ[ℝ] MvPolynomial (U ⊕ I) ℝ := + aeval (R := ℝ) (polynomialTagLinearEmbedding (fun b i => (e i : B → ℝ) b)) + +omit [Fintype B] in +theorem polynomialSubspaceRestriction_eval (K : Submodule ℝ (B → ℝ)) + (e : Basis I ℝ K) (p : MvPolynomial (U ⊕ B) ℝ) (u : U → ℝ) (v : I → ℝ) : + eval (Sum.elim u v) (polynomialSubspaceRestriction K e p) = + eval (Sum.elim u (fun b => ∑ i, (e i : B → ℝ) b * v i)) p := + polynomialTagLinearEmbedding_eval _ u v p + +omit [Fintype B] in +theorem polynomialSubspaceRestriction_eq_of_eval (K : Submodule ℝ (B → ℝ)) + (e : Basis I ℝ K) (p q : MvPolynomial (U ⊕ B) ℝ) + (h : ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval (Sum.elim u b) p = eval (Sum.elim u b) q) : + polynomialSubspaceRestriction K e p = polynomialSubspaceRestriction K e q := by + classical + apply MvPolynomial.funext + intro x + let u : U → ℝ := fun a => x (Sum.inl a) + let v : I → ℝ := fun a => x (Sum.inr a) + have hx : x = Sum.elim u v := by funext a; cases a <;> rfl + rw [hx, polynomialSubspaceRestriction_eval, polynomialSubspaceRestriction_eval] + apply h + have he : (fun b => ∑ i, (e i : B → ℝ) b * v i) = + ((∑ i, v i • e i : K) : B → ℝ) := by + ext b + simp [mul_comm] + rw [he] + exact (∑ i, v i • e i : K).property + +omit [Fintype B] in +theorem polynomialSubspaceRestriction_eval_basis (K : Submodule ℝ (B → ℝ)) + (e : Basis I ℝ K) (p : MvPolynomial (U ⊕ B) ℝ) (u : U → ℝ) (b : K) : + eval (Sum.elim u (fun i => e.repr b i)) (polynomialSubspaceRestriction K e p) = + eval (Sum.elim u (b : B → ℝ)) p := by + rw [polynomialSubspaceRestriction_eval] + have he : (fun c => ∑ i, (e i : B → ℝ) c * e.repr b i) = (b : B → ℝ) := by + funext c + have h := congrArg (fun z : K => (z : B → ℝ) c) (e.sum_repr b) + simpa only [Submodule.coe_sum, Finset.sum_apply, Submodule.coe_smul, + Pi.smul_apply, smul_eq_mul, mul_comm] using h + rw [he] + +omit [Fintype B] in +theorem polynomialSubspaceRestriction_eval_eq (K : Submodule ℝ (B → ℝ)) + (e : Basis I ℝ K) (p q : MvPolynomial (U ⊕ B) ℝ) + (h : polynomialSubspaceRestriction K e p = polynomialSubspaceRestriction K e q) + (u : U → ℝ) (b : B → ℝ) (hb : b ∈ K) : + eval (Sum.elim u b) p = eval (Sum.elim u b) q := by + rw [← polynomialSubspaceRestriction_eval_basis K e p u ⟨b, hb⟩, h, + polynomialSubspaceRestriction_eval_basis] + +theorem normalizedChartSubspaceCoordinates_reconstruct_C + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (A : B → MvPolynomial U ℝ) + (hA : ∀ α, (fun b => (A b).coeff α) ∈ K) (b : B) : + A b = ∑ i, C ((e i : B → ℝ) b) * normalizedChartSubspaceCoordinates K e A hA i := by + simpa only [MvPolynomial.smul_eq_C_mul] using + normalizedChartSubspaceCoordinates_reconstruct K e A hA b + +theorem polynomialSubspaceRestriction_normalizedChart + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (H : U → ℝ) (A : B → MvPolynomial U ℝ) + (hA : ∀ α, (fun b => (A b).coeff α) ∈ K) + (p : MvPolynomial (U ⊕ B) ℝ) : + polynomialSubspaceRestriction K e + (aeval (R := ℝ) (normalizedRealPolynomialChart H A) p) = + aeval (R := ℝ) (normalizedRealPolynomialChart H + (normalizedChartSubspaceCoordinates K e A hA)) + (polynomialSubspaceRestriction K e p) := + normalizedRealPolynomialChart_linear_restriction H A _ _ + (normalizedChartSubspaceCoordinates_reconstruct_C K e A hA) p + +theorem polynomialSubspaceRestriction_normalizedChart_eval_eq + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (H : U → ℝ) (A : B → MvPolynomial U ℝ) + (hA : ∀ α, (fun b => (A b).coeff α) ∈ K) + (p q : MvPolynomial (U ⊕ B) ℝ) + (h : polynomialSubspaceRestriction K e p = polynomialSubspaceRestriction K e q) + (u : U → ℝ) (b : B → ℝ) (hb : b ∈ K) : + eval (Sum.elim u b) (aeval (R := ℝ) (normalizedRealPolynomialChart H A) p) = + eval (Sum.elim u b) (aeval (R := ℝ) (normalizedRealPolynomialChart H A) q) := by + apply polynomialSubspaceRestriction_eval_eq K e _ _ _ u b hb + rw [polynomialSubspaceRestriction_normalizedChart K e H A hA, + polynomialSubspaceRestriction_normalizedChart K e H A hA, h] + +theorem normalizedChart_subspace_decomposition + (K : Submodule ℝ (B → ℝ)) (e : Basis I ℝ K) + (H : U → ℝ) (A : B → MvPolynomial U ℝ) + (hA : ∀ α, (fun b => (A b).coeff α) ∈ K) + (p slow rat : MvPolynomial (U ⊕ B) ℝ) + (h : ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → + eval (Sum.elim u b) p = + eval (Sum.elim (fun i => u i / H i) + (fun i => b i - eval u (A i))) slow + eval (Sum.elim u b) rat) : + polynomialSubspaceRestriction K e p = + aeval (R := ℝ) (normalizedRealPolynomialChart H + (normalizedChartSubspaceCoordinates K e A hA)) + (polynomialSubspaceRestriction K e slow) + + polynomialSubspaceRestriction K e rat := by + have he : polynomialSubspaceRestriction K e p = + polynomialSubspaceRestriction K e + (aeval (R := ℝ) (normalizedRealPolynomialChart H A) slow + rat) := by + apply polynomialSubspaceRestriction_eq_of_eval + intro u b hb + rw [map_add] + exact (h u b hb).trans (by + congr 1 + exact (eval_normalizedRealPolynomialChart_substitution H A u b slow).symm) + rw [he, map_add, polynomialSubspaceRestriction_normalizedChart] + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open _root_.MvPolynomial _root_.OAI.MvPolynomial + +variable {m : ℕ} {X : Type*} (J : Fin m → Type*) [∀ j, Fintype (J j)] + +noncomputable def fullTaggedMajorTopCoordinates + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (a : Σ j, J j) : MvPolynomial X ℝ := + homogeneousComponent (a.1.val + 1) + (coordinate (LinearMap.proj a.2 : (J a.1 → ℝ) →ₗ[ℝ] ℝ).toAddMonoidHom (poly a.1)) + +theorem majorTranslationTopCoordinates_lowTagged_eq (k : ℕ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (i : Fin (Fintype.card (LowTaggedIndex J k))) : + majorTranslationTopCoordinates (lowTaggedWeight J k) + (fun i => lowTaggedPolynomial J k poly i - C (c i)) i = + fullTaggedMajorTopCoordinates J poly (lowTaggedIndex J k i) := by + have hc : homogeneousComponent (lowTaggedWeight J k i) + (C (c i) : MvPolynomial X ℝ) = 0 := by + apply homogeneousComponent_eq_zero + simpa using lowTaggedWeight_pos J k i + change homogeneousComponent (lowTaggedWeight J k i) + (lowTaggedPolynomial J k poly i - C (c i)) = + homogeneousComponent (lowTaggedWeight J k i) (lowTaggedPolynomial J k poly i) + rw [map_sub, hc, sub_zero] + +theorem lowTaggedMajorChart_rename (k : ℕ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) (H : X → ℝ) + (i : X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) : + rename (lowTaggedVariableEmbedding J k) + (normalizedRealPolynomialChart H + (majorTranslationTopCoordinates (lowTaggedWeight J k) + (fun i => lowTaggedPolynomial J k poly i - C (c i))) i) = + normalizedRealPolynomialChart H (fullTaggedMajorTopCoordinates J poly) + (lowTaggedVariableEmbedding J k i) := by + cases i with + | inl i => simp only [normalizedRealPolynomialChart_inl, lowTaggedVariableEmbedding_inl, + map_mul, rename_C, rename_X] + | inr i => + simp only [normalizedRealPolynomialChart_inr, lowTaggedVariableEmbedding_inr, + map_sub, rename_X, rename_rename, majorTranslationTopCoordinates_lowTagged_eq] + rfl + +omit [∀ j, Fintype (J j)] in + +theorem fullTaggedMajorChart_homogeneous + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (H : X → ℝ) + (i : X ⊕ (Σ j, J j)) : + (normalizedRealPolynomialChart H (fullTaggedMajorTopCoordinates J poly) i).IsWeightedHomogeneous + (fullTaggedVariableWeight J) (fullTaggedVariableWeight J i) := by + cases i with + | inl x => + exact (isWeightedHomogeneous_X (R := ℝ) (fullTaggedVariableWeight J) (Sum.inl x)).C_mul _ + | inr a => + apply (isWeightedHomogeneous_X (R := ℝ) (fullTaggedVariableWeight J) (Sum.inr a)).sub + apply majorParameterRename_homogeneous (fun _ : X => 1) + (fun a : Σ j, J j => a.1.val + 1) + exact weightedHomogeneousComponent_isWeightedHomogeneous _ _ + +variable {V : Type*} [AddCommGroup V] [Module ℚ V] [Module ℝ V] [IsScalarTower ℚ ℝ V] + +theorem lowTaggedVectorExtend_majorChart (k : ℕ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) (H : X → ℝ) + (slow : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ V) : + lowTaggedVectorExtend J k + (realChartSubstitute (normalizedRealPolynomialChart H + (majorTranslationTopCoordinates (lowTaggedWeight J k) + (fun i => lowTaggedPolynomial J k poly i - C (c i)))) slow) = + realChartSubstitute (normalizedRealPolynomialChart H (fullTaggedMajorTopCoordinates J poly)) + (lowTaggedVectorExtend J k slow) := by + apply sub_eq_zero.mp + apply eq_zero_of_eval₂_zero (K := ℝ) + intro x + rw [map_sub, lowTaggedVectorExtend_eval₂, eval₂_realChartSubstitute, + eval₂_realChartSubstitute, lowTaggedVectorExtend_eval₂] + apply sub_eq_zero.mpr + apply congrArg (fun t => eval₂ t slow) + funext i + change MvPolynomial.eval (x ∘ lowTaggedVariableEmbedding J k) _ = + MvPolynomial.eval x _ + rw [← MvPolynomial.eval_rename, lowTaggedMajorChart_rename] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module _root_.MvPolynomial _root_.OAI.MvPolynomial + +variable {m : ℕ} {X : Type*} (J : Fin m → Type*) [∀ j, Fintype (J j)] + +omit [∀ j, Fintype (J j)] in +theorem fullTaggedMajorTopCoordinates_coefficients_mem_of_all + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j ex, coefficients (poly j) ex ∈ U j) : + ∀ ex j, (fun i => (fullTaggedMajorTopCoordinates J poly ⟨j, i⟩).coeff ex) ∈ U j := by + intro ex j + classical + simp only [fullTaggedMajorTopCoordinates, coeff_homogeneousComponent] + split_ifs with h + · simpa only [coeff_coordinate, LinearMap.toAddMonoidHom_coe, LinearMap.proj_apply] using hm j ex + · exact (U j).zero_mem + +theorem RationalTaggedConstraintCertificate.exists_actual_normalized_chart_coordinates + {K : Set ((X ⊕ (Σ j, J j)) → ℝ)} {p : ℝ} {blocks : ℕ} + (hcert : RationalTaggedConstraintCertificate J Set.univ K p blocks) + (hp : 0 ≤ p) (hdim : ∀ j, (Fintype.card (J j) : ℝ) ≤ p) + (hblocks : (blocks : ℝ) ≤ p) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (hret : ∀ point, (∀ j, (fun i => point (Sum.inr ⟨j, i⟩)) ∈ U j) → point ∈ K) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hm : ∀ j ex, coefficients (poly j) ex ∈ U j) : + ∃ (n : Fin m → ℕ) (Ktag : Submodule ℝ ((Σ j, J j) → ℝ)) + (b : Basis (Σ j, Fin (n j)) ℝ Ktag) + (matrix : (Σ j, Fin (n j)) → (Σ j, J j) → ℚ) + (A' : (Σ j, Fin (n j)) → MvPolynomial X ℝ), + (∀ j, n j ≤ Fintype.card (J j)) ∧ + (∀ a x, (b a : (Σ j, J j) → ℝ) x = (matrix a x : ℝ)) ∧ + (∀ a x, x.1 ≠ a.1 → matrix a x = 0) ∧ + (∀ a x, rationalLogHeight (matrix a x) ≤ ((p + 2) ^ 2 + 2) ^ 63) ∧ + K = {point | (fun x => point (Sum.inr x)) ∈ Ktag} ∧ + (∀ ex, (fun x => (fullTaggedMajorTopCoordinates J poly x).coeff ex) ∈ Ktag) ∧ + ∀ (H : X → ℝ) (P : MvPolynomial (X ⊕ (Σ j, J j)) ℝ), + polynomialSubspaceRestriction Ktag b + (aeval (R := ℝ) (normalizedRealPolynomialChart H (fullTaggedMajorTopCoordinates J poly)) P) = + aeval (R := ℝ) (normalizedRealPolynomialChart H A') + (polynomialSubspaceRestriction Ktag b P) := by + obtain ⟨n, Ktag, b, matrix, hn, hb, hzero, hheight, hK, _⟩ := + hcert.exists_bounded_chart_tag_basis hp hdim hblocks + have hA : ∀ ex, (fun x => (fullTaggedMajorTopCoordinates J poly x).coeff ex) ∈ Ktag := + retained_tag_polynomial_coefficients_mem K Ktag hK U hret + (fullTaggedMajorTopCoordinates J poly) (fullTaggedMajorTopCoordinates_coefficients_mem_of_all J U poly hm) + refine ⟨n, Ktag, b, matrix, + normalizedChartSubspaceCoordinates Ktag b (fullTaggedMajorTopCoordinates J poly) hA, + hn, hb, hzero, hheight, hK, hA, ?_⟩ + intro H P + exact polynomialSubspaceRestriction_normalizedChart Ktag b H + (fullTaggedMajorTopCoordinates J poly) hA P + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +theorem fullTaggedMajorTopCoordinates_coefficients_mem_tag + {m : ℕ} {X : Type*} (J : Fin m → Type*) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (α : X →₀ ℕ) (j : Fin m) : + (fun i => (fullTaggedMajorTopCoordinates J poly ⟨j, i⟩).coeff α) ∈ U j := by + classical + by_cases hα : α.degree = j.val + 1 + · have hne : α ≠ 0 := by + intro hz + simp [hz] at hα + have heq : (fun i => (fullTaggedMajorTopCoordinates J poly ⟨j, i⟩).coeff α) = + coefficients (poly j) α := by + funext i + rw [fullTaggedMajorTopCoordinates, MvPolynomial.coeff_homogeneousComponent, + ite_eq_left hα, coeff_coordinate] + rfl + rw [heq] + exact hcoeff j α hne + · have heq : (fun i => (fullTaggedMajorTopCoordinates J poly ⟨j, i⟩).coeff α) = 0 := by + funext i + rw [fullTaggedMajorTopCoordinates, MvPolynomial.coeff_homogeneousComponent, ite_eq_right hα] + rfl + rw [heq] + exact (U j).zero_mem + +theorem fullTaggedMajorTopCoordinates_coefficients_mem + {m : ℕ} {X : Type*} (J : Fin m → Type*) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (K : Submodule ℝ ((Σ j, J j) → ℝ)) + (hU : ∀ x, (∀ j, (fun i => x ⟨j, i⟩) ∈ U j) → x ∈ K) + (α : X →₀ ℕ) : + (fun a => (fullTaggedMajorTopCoordinates J poly a).coeff α) ∈ K := by + apply hU + exact fun j => fullTaggedMajorTopCoordinates_coefficients_mem_tag J poly U hcoeff α j + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/FullTaggedSlowChartCenterDependence.lean b/lean/OAI/Combinatorics/Progressions/Geometry/FullTaggedSlowChartCenterDependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c15381eb15b0db92a669a80b08c592f7045bcdb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/FullTaggedSlowChartCenterDependence.lean @@ -0,0 +1,47 @@ +import OAI.Combinatorics.Progressions.Linear.ActualCandidateSlowProjectionMass + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open _root_.MvPolynomial _root_.OAI.MvPolynomial + +variable {m : ℕ} {X : Type*} (J : Fin m → Type*) [∀ j, Fintype (J j)] + (P : ∀ j, (J j → ℝ) →ₗ[ℝ] (J j → ℝ)) (N : X → ℝ) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + +theorem fullTaggedSlowProjectionChart_center_change + (c c' : ∀ j, J j → ℝ) (j : Fin m) (i : J j) : + fullTaggedSlowProjectionChart J P N poly c' (Sum.inr ⟨j, i⟩) = + fullTaggedSlowProjectionChart J P N poly c (Sum.inr ⟨j, i⟩) + + C (c' j i - c j i) := by + simp only [fullTaggedSlowProjectionChart_inr, fullTaggedCenteredCoordinates, + map_sub, rename_C] + ring + +theorem fullTaggedSlowProjectionChart_center_injective : + Function.Injective (fullTaggedSlowProjectionChart J P N poly) := by + intro c c' h + funext j i + have htag := congrFun h (Sum.inr ⟨j, i⟩) + rw [fullTaggedSlowProjectionChart_center_change J P N poly c c' j i] at htag + have hz : C (c' j i - c j i) = (0 : MvPolynomial (X ⊕ (Σ j, J j)) ℝ) := by + apply add_left_cancel (a := fullTaggedSlowProjectionChart J P N poly c (Sum.inr ⟨j, i⟩)) + simpa only [add_zero] using htag.symm + have hzero : c' j i - c j i = 0 := by + simpa using congrArg (constantCoeff : MvPolynomial (X ⊕ (Σ j, J j)) ℝ →+* ℝ) hz + exact (sub_eq_zero.mp hzero).symm + +theorem fullTaggedSlowProjectionChart_eq_iff_center_eq + (c c' : ∀ j, J j → ℝ) : + fullTaggedSlowProjectionChart J P N poly c = + fullTaggedSlowProjectionChart J P N poly c' ↔ c = c' := + (fullTaggedSlowProjectionChart_center_injective J P N poly).eq_iff + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/GeometricLocalizationThreshold.lean b/lean/OAI/Combinatorics/Progressions/Geometry/GeometricLocalizationThreshold.lean new file mode 100644 index 0000000000000000000000000000000000000000..bfed9e949305383715e6d25063ba794f58c109c9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/GeometricLocalizationThreshold.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Polynomial.LocalizationPolynomialScales + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def localizationThreshold (U ζ : ℝ) (i : ℕ) : ℝ := ζ / (2 * U ^ 2) ^ i + +theorem localizationThreshold_pos {U ζ : ℝ} (hU : 1 ≤ U) (hζ : 0 < ζ) (i : ℕ) : + 0 < localizationThreshold U ζ i := by unfold localizationThreshold; positivity + +theorem localizationThreshold_zero (U ζ : ℝ) : localizationThreshold U ζ 0 = ζ := by + simp only [localizationThreshold, pow_zero, div_one] + +theorem localizationThreshold_antitone {U ζ : ℝ} (hU : 1 ≤ U) (hζ : 0 ≤ ζ) + {i j : ℕ} (hij : i ≤ j) : localizationThreshold U ζ j ≤ localizationThreshold U ζ i := by + have hC : 1 ≤ 2 * U ^ 2 := by nlinarith [one_le_pow₀ hU (n := 2)] + apply div_le_div_of_nonneg_left hζ (by positivity) + exact pow_le_pow_right₀ hC hij + +theorem localizationThreshold_le_one {U ζ : ℝ} (hU : 1 ≤ U) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (i : ℕ) : + localizationThreshold U ζ i ≤ 1 := by + have h := localizationThreshold_antitone hU hζ.le (Nat.zero_le i) + rw [localizationThreshold_zero] at h + exact h.trans hζ1 + +theorem localizationThreshold_step {U ζ : ℝ} (hU : 1 ≤ U) (hζ : 0 < ζ) + {i m : ℕ} (hi : i + 1 ≤ m) : + localizationThreshold U ζ m + U ^ 2 * localizationThreshold U ζ (i + 1) ≤ + localizationThreshold U ζ i := by + have hε := localizationThreshold_antitone hU hζ.le hi + have hη := localizationThreshold_pos hU hζ (i + 1) + have hp : 1 ≤ U ^ 2 := one_le_pow₀ hU + have he : localizationThreshold U ζ i = + 2 * U ^ 2 * localizationThreshold U ζ (i + 1) := by + have hC : 2 * U ^ 2 ≠ 0 := by positivity + unfold localizationThreshold + rw [pow_succ] + field_simp + exact pow_succ' _ _ + rw [he] + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/GeometricRetainedCommonCover.lean b/lean/OAI/Combinatorics/Progressions/Geometry/GeometricRetainedCommonCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..260e5da50f5a4675679241e35a89bf3268293e8d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/GeometricRetainedCommonCover.lean @@ -0,0 +1,187 @@ +import OAI.Combinatorics.Progressions.Estimates.CoefficientRowEvaluation +import OAI.Combinatorics.Progressions.Lattices.RetainedAffineCommonCover + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +def geometricSiteBudget (m q : ℕ) (P : ℝ) : ℝ := + ((m : ℝ) + 1) * (P + 1) ^ (m + 1) + 2 ^ q + +theorem geometricSiteBudget_nonneg (m q : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ geometricSiteBudget m q P := by + unfold geometricSiteBudget + positivity + +theorem le_geometricSiteBudget (m q : ℕ) {P : ℝ} (hP : 0 ≤ P) : + P ≤ geometricSiteBudget m q P := by + have hp : P + 1 ≤ (P + 1) ^ (m + 1) := by + simpa using pow_le_pow_right₀ (by linarith : 1 ≤ P + 1) (show 1 ≤ m + 1 by omega) + unfold geometricSiteBudget + have hn : (0 : ℝ) ≤ m := Nat.cast_nonneg _ + have ht : (0 : ℝ) ≤ 2 ^ q := by positivity + nlinarith + +theorem degree_mul_le_geometricSiteBudget (m q : ℕ) {P : ℝ} (hP : 0 ≤ P) : + (m : ℝ) * (P + 1) ≤ geometricSiteBudget m q P := by + have hp : P + 1 ≤ (P + 1) ^ (m + 1) := by + simpa using pow_le_pow_right₀ (by linarith : 1 ≤ P + 1) (show 1 ≤ m + 1 by omega) + calc + _ ≤ ((m : ℝ) + 1) * (P + 1) ^ (m + 1) := + mul_le_mul (by linarith) hp (by linarith) (by positivity) + _ ≤ geometricSiteBudget m q P := le_add_of_nonneg_right (by positivity) + +theorem boundedCoefficientExponent_card_le_geometricSiteBudget {K : Type*} [Fintype K] + (m q : ℕ) {h : ℕ} (hh : h ≤ m) {P : ℝ} (hP : 0 ≤ P) + (hK : (Fintype.card K : ℝ) ≤ P) : + (Fintype.card (BoundedCoefficientExponent K h) : ℝ) ≤ geometricSiteBudget m q P := by + have hc : (Fintype.card (BoundedCoefficientExponent K h) : ℝ) ≤ + ((h : ℝ) + 1) * ((Fintype.card K : ℝ) + 1) ^ h := by + exact_mod_cast boundedCoefficientExponent_card_le (K := K) h + apply hc.trans + calc + _ ≤ ((m : ℝ) + 1) * (P + 1) ^ (m + 1) := by + apply mul_le_mul (by exact_mod_cast Nat.add_le_add_right hh 1) + · exact (pow_le_pow_left₀ (by positivity) (by linarith) h).trans + (pow_le_pow_right₀ (by linarith) (by omega)) + · positivity + · positivity + _ ≤ geometricSiteBudget m q P := le_add_of_nonneg_right (by positivity) + +theorem cubeSites_card_le_geometricSiteBudget (m q : ℕ) {P : ℝ} (hP : 0 ≤ P) : + (Fintype.card (Finset (Fin q)) : ℝ) ≤ geometricSiteBudget m q P := by + simp only [Fintype.card_finset, Fintype.card_fin, Nat.cast_pow, Nat.cast_ofNat] + exact le_add_of_nonneg_left (by positivity) + +noncomputable def exponentialSiteHeight (m : ℕ) (P : ℝ) : ℕ := ⌈Real.exp P⌉₊ ^ m + +theorem exponentialSiteHeight_pos (m : ℕ) (P : ℝ) : 0 < exponentialSiteHeight m P := by + exact pow_pos (Nat.ceil_pos.mpr (Real.exp_pos _)) _ + +theorem exponentialSiteHeight_le (m : ℕ) {P : ℝ} (hP : 0 ≤ P) : + (exponentialSiteHeight m P : ℝ) ≤ Real.exp ((m : ℝ) * (P + 1)) := by + have hceil : (⌈Real.exp P⌉₊ : ℝ) ≤ Real.exp (P + 1) := by + calc + _ ≤ Real.exp P + 1 := (Nat.ceil_lt_add_one (Real.exp_pos P).le).le + _ ≤ Real.exp P * 2 := by linarith [Real.one_le_exp hP] + _ ≤ Real.exp P * Real.exp 1 := + mul_le_mul_of_nonneg_left (by linarith [Real.add_one_le_exp (1 : ℝ)]) (Real.exp_pos P).le + _ = Real.exp (P + 1) := (Real.exp_add _ _).symm + simpa only [exponentialSiteHeight, Nat.cast_pow, Real.exp_nat_mul] using + pow_le_pow_left₀ (Nat.cast_nonneg _) hceil m + +theorem boundedSiteMatrix_height_of_exp {K S : Type*} (m : ℕ) {h : ℕ} (hh : h ≤ m) + (site : S → K → ℤ) {P : ℝ} + (hsite : ∀ s k, |(site s k : ℝ)| ≤ Real.exp P) + (s : S) (d : BoundedCoefficientExponent K h) : + RationalHeightLE (boundedSiteMatrix h site s d : ℚ) (exponentialSiteHeight m P) := by + have hceil : 1 ≤ ⌈Real.exp P⌉₊ := Nat.ceil_pos.mpr (Real.exp_pos _) + have hb : ∀ s k, (site s k).natAbs ≤ ⌈Real.exp P⌉₊ := by + intro s k + have he : ((site s k).natAbs : ℝ) ≤ (⌈Real.exp P⌉₊ : ℝ) := by + simpa using (hsite s k).trans (Nat.le_ceil (Real.exp P)) + exact_mod_cast he + exact (boundedSiteMatrix_height h site hceil hb s d).mono + (Nat.pow_le_pow_right hceil hh) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Polynomial + +theorem exists_geometricSiteBudget_absorption (m q a : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ P : ℝ, 0 ≤ P → + (geometricSiteBudget m q P + a) ^ a ≤ (P + A) ^ A := by + obtain ⟨A, hA, hb⟩ := exists_natPolynomial_eval_budget + ((C (m + 1) * (X + 1) ^ (m + 1) + C (2 ^ q) + C a) ^ a) + refine ⟨A, hA, ?_⟩ + intro P hP + simpa [geometricSiteBudget, Polynomial.eval₂_pow] using hb P hP + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open Polynomial + +theorem exists_geometric_positive_cover_budget (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ P : ℝ, 0 ≤ P → + (m : ℝ) * (geometricSiteBudget m q P + 2) ^ 36 ≤ (P + A) ^ A := by + obtain ⟨A, hA, h⟩ := exists_natPolynomial_eval_budget + (C m * (C (m + 1) * (X + 1) ^ (m + 1) + C (2 ^ q) + 2) ^ 36) + refine ⟨A, hA, ?_⟩ + intro P hP + simpa [geometricSiteBudget, Polynomial.eval₂_pow, Nat.cast_add] using h P hP + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open VectorPolynomial + +theorem exists_geometric_retained_common_cover (m q : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {K : Type*} [Fintype K] + (root : K → ℤ) (difference : Fin q → K → ℤ) + {P : ℝ} (_hP : 0 ≤ P) (_hK : (Fintype.card K : ℝ) ≤ P) + (_hsite : ∀ (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 → ℝ)) + (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) + (_hfrequency : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, + |(frequency j d a : ℝ)| ≤ Real.exp P) + (_hretained : affineCubeModeFactors U root difference frequency), + ∃ b : ∀ j, Matrix (Finset (Fin q)) (J j) ℤ, + (∀ j s a, |(b j s a : ℝ)| ≤ Real.exp ((P + A) ^ A)) ∧ + ∀ (j : Fin m) (p : VectorPolynomial K ℝ (U j)), + DegreeLE (1 : K → ℕ) (j.val + 1) p → + CircleFourier.character + (coefficientFunctional (fun d a => (frequency j d a : ℝ)) + (map (U j).subtype p) : 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) : ℤ) : ℝ)) p)) := by + obtain ⟨A₀, _, hc⟩ := exists_retained_affine_common_cover m + obtain ⟨A, hA, hb⟩ := exists_geometricSiteBudget_absorption m q A₀ + refine ⟨A, hA, ?_⟩ + intro K _ root difference P hP hK hsite + have hbudget := hb P hP + have hPP := le_geometricSiteBudget m q hP + obtain ⟨D, hD, hDP, hrows⟩ := hc root difference + (exponentialSiteHeight_pos m P) + (fun j s d => boundedSiteMatrix_height_of_exp m (Nat.succ_le_of_lt j.isLt) + (fun s k => affineSite root difference s (some k)) hsite s d) + (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) + ((exponentialSiteHeight_le m hP).trans + (Real.exp_le_exp.mpr (degree_mul_le_geometricSiteBudget m q hP))) + refine ⟨D, hD, hDP.trans (Real.exp_le_exp.mpr hbudget), ?_⟩ + intro J _ U frequency hfrequency hretained + obtain ⟨b, hbnd, hchar⟩ := hrows U frequency (Real.exp_pos P).le + (Real.exp_le_exp.mpr hPP) hfrequency hretained + exact ⟨b, fun j s a => (hbnd j s a).trans (Real.exp_le_exp.mpr hbudget), hchar⟩ + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/GeometricSpectralBudgets.lean b/lean/OAI/Combinatorics/Progressions/Geometry/GeometricSpectralBudgets.lean new file mode 100644 index 0000000000000000000000000000000000000000..faac7b304b7f383e06f275bfa415808db11ef153 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/GeometricSpectralBudgets.lean @@ -0,0 +1,57 @@ +import OAI.Combinatorics.Progressions.Dynamics.SpectralLogBudget + +namespace OAI + +section + +namespace Erdos3 + +theorem geometric_tail_after_cutoff {ε P κ B : ℝ} {r : ℕ} + (hε : 0 < ε) (hκ0 : 0 ≤ κ) (hκhalf : κ ≤ 1 / 2) + (hB0 : 0 ≤ B) (hB : B ≤ Real.exp P) + (hr : CyclicCrootSisask.spectralIterations ε P ≤ r) : + κ ^ r * B ≤ ε / 16 := by + have hp : κ ^ r ≤ (1 / 2 : ℝ) ^ CyclicCrootSisask.spectralIterations ε P := + (pow_le_pow_left₀ hκ0 hκhalf r).trans + (pow_le_pow_of_le_one (by norm_num) (by norm_num) hr) + exact (mul_le_mul hp hB hB0 (by positivity)).trans + (CyclicCrootSisask.half_pow_spectralIterations_mul_exp_le hε) + +theorem geometric_shell_after_cutoff {ε P κ B : ℝ} {i j b : ℕ} + (hε : 0 < ε) (hκ0 : 0 ≤ κ) (hκhalf : κ ≤ 1 / 2) + (hB0 : 0 ≤ B) (hB : B ≤ Real.exp P) (hij : i ≤ j) + (hb : j + CyclicCrootSisask.spectralIterations ε P ≤ b) : + κ ^ (b - i) * B ≤ ε / 16 := by + apply geometric_tail_after_cutoff hε hκ0 hκhalf hB0 hB + omega + +theorem inverse_power_low_level_bound {t κ A B L : ℝ} {d e : ℕ} + (ht : 2 ≤ t) (hL : 0 ≤ L) + (hAB : A ^ 2 * B ^ 2 ≤ L * t ^ d) (hκ : κ ≤ (t ^ (d + e))⁻¹) : + κ * A ^ 2 * B ^ 2 ≤ (1 / 2 : ℝ) ^ e * L := by + have ht0 : 0 < t := by linarith + have hi : t⁻¹ ≤ (1 / 2 : ℝ) := by + simpa only [one_div] using one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 2) ht + calc + κ * A ^ 2 * B ^ 2 = κ * (A ^ 2 * B ^ 2) := by ring + _ ≤ (t ^ (d + e))⁻¹ * (L * t ^ d) := + mul_le_mul hκ hAB (mul_nonneg (sq_nonneg _) (sq_nonneg _)) (by positivity) + _ = L * ((t ^ d)⁻¹ * t ^ d) * (t ^ e)⁻¹ := by rw [pow_add, mul_inv_rev]; ring + _ = L * (t⁻¹) ^ e := by rw [inv_mul_cancel₀ (pow_ne_zero _ ht0.ne'), mul_one, inv_pow] + _ ≤ L * (1 / 2 : ℝ) ^ e := + mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (inv_nonneg.mpr ht0.le) hi e) hL + _ = (1 / 2 : ℝ) ^ e * L := mul_comm _ _ + +theorem low_level_after_power_cutoff {ε P t κ A B L : ℝ} {d e : ℕ} + (hε : 0 < ε) (ht : 2 ≤ t) (hL0 : 0 ≤ L) (hL : L ≤ Real.exp P) + (hAB : A ^ 2 * B ^ 2 ≤ L * t ^ d) (hκ : κ ≤ (t ^ (d + e))⁻¹) + (he : CyclicCrootSisask.spectralIterations ε P ≤ e) : + κ * A ^ 2 * B ^ 2 ≤ ε / 16 := by + exact (inverse_power_low_level_bound ht hL0 hAB hκ).trans + (geometric_tail_after_cutoff hε (by norm_num) (by norm_num) hL0 hL he) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/GlobalChartNativeFactorization.lean b/lean/OAI/Combinatorics/Progressions/Geometry/GlobalChartNativeFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..2214580c5de1d107011e9fc4694ced24a80a6efa --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/GlobalChartNativeFactorization.lean @@ -0,0 +1,530 @@ +import OAI.Combinatorics.Progressions.Estimates.FullMarkedNativeFactorization +import OAI.Combinatorics.Progressions.Lattices.IntegerHomogeneousSymbolPullbackGrid +import OAI.Combinatorics.Progressions.Polynomial.HomogeneousRealSymbolPolynomial + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +variable {σ τ R : Type*} [CommRing R] + +theorem weightedTop_aeval_monomial (w : σ → ℕ) (v : τ → ℕ) + (β : σ → MvPolynomial τ R) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) (γ : σ →₀ ℕ) (r : R) : + weightedHomogeneousComponent v (Finsupp.weight w γ) (aeval β (monomial γ r)) = + aeval (fun i => weightedHomogeneousComponent v (w i) (β i)) (monomial γ r) := by + apply weightedHomogeneousComponent_eq_of_sub_lower + · apply weightedComparison_monomial w v (aeval β) + (aeval (fun i => weightedHomogeneousComponent v (w i) (β i))) + · intro i + simpa only [aeval_X] using hβ i + · intro i + simpa only [aeval_X] using weightedTopPart_preserves_degree v v (w i) (hβ i) + · intro i + simpa only [aeval_X] using weightedTopPart_remainder_lt v (hβ i) + · exact isWeightedHomogeneous_aeval_monomial w v _ + (fun i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) γ r + +theorem coeff_aeval_monomial_eq_top (w : σ → ℕ) (v : τ → ℕ) + (β : σ → MvPolynomial τ R) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) (γ : σ →₀ ℕ) (r : R) + (α : τ →₀ ℕ) (hweight : Finsupp.weight v α = Finsupp.weight w γ) : + (aeval β (monomial γ r)).coeff α = + (aeval (fun i => weightedHomogeneousComponent v (w i) (β i)) + (monomial γ r)).coeff α := by + have h := congrArg (fun polynomial : MvPolynomial τ R => polynomial.coeff α) + (weightedTop_aeval_monomial w v β hβ γ r) + simpa only [coeff_weightedHomogeneousComponent, ite_eq_left hweight] using h + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial +open scoped TensorProduct + +variable {σ τ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem adapted_realChartSubstitute_homogeneous + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + {p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)} (hp : F.realification.Adapted w p) : + F.realification.Adapted v (realChartSubstitute β p) := by + classical + apply (F.realification.adapted_iff_coefficients v _).mpr + intro α + rw [coefficients_realChartSubstitute] + apply Submodule.sum_mem + intro γ _ + by_cases hweight : Finsupp.weight v α = Finsupp.weight w γ + · have hc := (F.realification.adapted_iff_coefficients w p).mp hp γ + change _ ∈ (F.realLayer (Finsupp.weight v α)).toSubmodule + rw [hweight] + exact (F.realLayer _).toSubmodule.smul_mem _ hc + · rw [(isWeightedHomogeneous_aeval_monomial w v β hβ γ (1 : ℝ)).coeff_eq_zero _ hweight, + zero_smul] + exact Submodule.zero_mem _ + +attribute [local irreducible] realChartSubstitute + +noncomputable def homogeneousAdaptedRealChartLie + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) : + F.realification.adaptedLieSubalgebra w →ₗ⁅ℚ⁆ F.realification.adaptedLieSubalgebra v where + toLinearMap := ((realChartSubstitute β).comp + (F.realification.adaptedLieSubalgebra w).incl.toLinearMap).codRestrict + (F.realification.adaptedSubmodule v) (fun p => + (F.realification.mem_adaptedSubmodule v _).mpr + (F.adapted_realChartSubstitute_homogeneous w v β hβ + ((F.realification.mem_adaptedSubmodule w _).mp p.property))) + map_lie' := by + intro p q + apply Subtype.ext + exact realChartSubstitute_lie β (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (q : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + +@[simp] theorem homogeneousAdaptedRealChartLie_coe + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (p : F.realification.adaptedLieSubalgebra w) : + (F.homogeneousAdaptedRealChartLie w v β hβ p : VectorPolynomial τ ℚ (ℝ ⊗[ℚ] L)) = + realChartSubstitute β (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) := rfl + +noncomputable def homogeneousAdaptedRealChartHom + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) : + (F.realification.adaptedPolynomialFiltration w).Group →* + (F.realification.adaptedPolynomialFiltration v).Group := + NilpotentLieBCHGroup.map (F.homogeneousAdaptedRealChartLie w v β hβ) + +@[simp] theorem homogeneousAdaptedRealChartHom_coord + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + ((F.homogeneousAdaptedRealChartHom w v β hβ g).coord : + VectorPolynomial τ ℚ (ℝ ⊗[ℚ] L)) = + realChartSubstitute β (g.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) := rfl + +theorem realPolynomialSymbolHom_homogeneousAdaptedRealChart + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + F.realPolynomialSymbolHom b ω hF v (F.homogeneousAdaptedRealChartHom w v β hβ g) = + F.realSymbolHomogeneousPullbackHom b ω hF w v β hβ + (F.realPolynomialSymbolHom b ω hF w g) := + F.realPolynomialSymbolHom_homogeneousChart b ω hF w v β hβ g _ + (F.homogeneousAdaptedRealChartHom_coord w v β hβ g) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial MvPolynomial +open scoped TensorProduct + +variable {σ τ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem adapted_realChartSubstitute_weightedSupport + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + {p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)} (hp : F.realification.Adapted w p) : + F.realification.Adapted v (realChartSubstitute β p) := by + classical + apply (F.realification.adapted_iff_coefficients v _).mpr + intro α + rw [coefficients_realChartSubstitute] + apply Submodule.sum_mem + intro γ _ + by_cases hc : (aeval β (monomial γ (1 : ℝ))).coeff α = 0 + · rw [hc, zero_smul] + exact Submodule.zero_mem _ + · change _ ∈ (F.realLayer (Finsupp.weight v α)).toSubmodule + apply (F.realLayer _).toSubmodule.smul_mem + exact F.realLayer_antitone + (aeval_monomial_weightedSupport β w v hβ γ (mem_support_iff.mpr hc)) + ((F.realification.adapted_iff_coefficients w p).mp hp γ) + +attribute [local irreducible] realChartSubstitute + +noncomputable def weightedAdaptedRealChartLie + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) : + F.realification.adaptedLieSubalgebra w →ₗ⁅ℚ⁆ F.realification.adaptedLieSubalgebra v where + toLinearMap := ((realChartSubstitute β).comp + (F.realification.adaptedLieSubalgebra w).incl.toLinearMap).codRestrict + (F.realification.adaptedSubmodule v) (fun p => + (F.realification.mem_adaptedSubmodule v _).mpr + (F.adapted_realChartSubstitute_weightedSupport w v β hβ + ((F.realification.mem_adaptedSubmodule w _).mp p.property))) + map_lie' := by + intro p q + apply Subtype.ext + exact realChartSubstitute_lie β (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + (q : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) + +@[simp] theorem weightedAdaptedRealChartLie_coe + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (p : F.realification.adaptedLieSubalgebra w) : + (F.weightedAdaptedRealChartLie w v β hβ p : VectorPolynomial τ ℚ (ℝ ⊗[ℚ] L)) = + realChartSubstitute β (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) := rfl + +noncomputable def weightedAdaptedRealChartHom + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) : + (F.realification.adaptedPolynomialFiltration w).Group →* + (F.realification.adaptedPolynomialFiltration v).Group := + NilpotentLieBCHGroup.map (F.weightedAdaptedRealChartLie w v β hβ) + +@[simp] theorem weightedAdaptedRealChartHom_coord + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + ((F.weightedAdaptedRealChartHom w v β hβ g).coord : + VectorPolynomial τ ℚ (ℝ ⊗[ℚ] L)) = + realChartSubstitute β (g.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) := rfl + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial MvPolynomial +open scoped TensorProduct BigOperators + +variable {σ τ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +attribute [local irreducible] realChartSubstitute realSymbolOfPolynomial + +theorem realSymbolOfPolynomial_chart_eq_top + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) (hp : F.realification.Adapted w p) : + F.realSymbolOfPolynomial b ω hF v (realChartSubstitute β p) = + F.realSymbolOfPolynomial b ω hF v + (realChartSubstitute (fun i => weightedHomogeneousComponent v (w i) (β i)) p) := by + classical + apply ((F.polynomialSymbolBasis b ω hF v).baseChange ℝ).repr.injective + ext z + rw [F.realSymbolOfPolynomial_coordinate, F.realSymbolOfPolynomial_coordinate, + coefficients_realChartSubstitute, coefficients_realChartSubstitute] + simp only [map_sum, Finsupp.finsetSum_apply, map_smul, Finsupp.smul_apply, smul_eq_mul] + apply Finset.sum_congr rfl + intro γ _ + rcases lt_trichotomy (Finsupp.weight w γ) (ω z.val.2) with hlt | heq | hgt + · have hzero : (aeval β (monomial γ (1 : ℝ))).coeff z.val.1 = 0 := by + by_contra hc + have hle := aeval_monomial_weightedSupport β w v hβ γ (mem_support_iff.mpr hc) + have hz := z.property + omega + have htop : (aeval (fun i => weightedHomogeneousComponent v (w i) (β i)) + (monomial γ (1 : ℝ))).IsWeightedHomogeneous v (Finsupp.weight w γ) := + isWeightedHomogeneous_aeval_monomial w v _ + (fun _i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) γ 1 + rw [hzero, htop.coeff_eq_zero _ (by have hz := z.property; omega)] + · rw [coeff_aeval_monomial_eq_top w v β hβ γ 1 z.val.1 + (z.property.trans heq.symm)] + · have hzero := (F.real_mem_layer_iff_basis_coordinates b ω hF _ _).mp + ((F.realification.adapted_iff_coefficients w p).mp hp γ) z.val.2 (by omega) + rw [hzero, mul_zero, mul_zero] + +theorem realSymbolOfPolynomial_inhomogeneousChart + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) (hp : F.realification.Adapted w p) : + F.realSymbolOfPolynomial b ω hF v (realChartSubstitute β p) = + F.realSymbolHomogeneousPullback b ω hF w v + (fun i => weightedHomogeneousComponent v (w i) (β i)) + (F.realSymbolOfPolynomial b ω hF w p) := by + rw [F.realSymbolOfPolynomial_chart_eq_top b ω hF w v β hβ p hp] + exact F.realSymbolOfPolynomial_homogeneousChart b ω hF w v _ + (fun _i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) p + +theorem realPolynomialSymbolHom_weightedAdaptedRealChart + (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + F.realPolynomialSymbolHom b ω hF v (F.weightedAdaptedRealChartHom w v β hβ g) = + F.realSymbolHomogeneousPullbackHom b ω hF w v + (fun i => weightedHomogeneousComponent v (w i) (β i)) + (fun _i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) + (F.realPolynomialSymbolHom b ω hF w g) := by + apply NilpotentLieBCHGroup.ext + change F.realSymbolOfPolynomial b ω hF v + ((F.weightedAdaptedRealChartHom w v β hβ g).coord : + VectorPolynomial τ ℚ (ℝ ⊗[ℚ] L)) = _ + rw [F.weightedAdaptedRealChartHom_coord] + exact F.realSymbolOfPolynomial_inhomogeneousChart b ω hF w v β hβ _ + ((F.realification.mem_adaptedSubmodule w _).mp g.coord.property) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +theorem weightedRealChart_comp_support + {σ τ υ : Type*} (w : σ → ℕ) (v : τ → ℕ) (u : υ → ℕ) + (β : σ → MvPolynomial τ ℝ) (γ : τ → MvPolynomial υ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (hγ : ∀ i, γ i ∈ weightedSupportLE u (v i)) : + ∀ i, MvPolynomial.aeval γ (β i) ∈ weightedSupportLE u (w i) := + fun i => weightedSupportLE_aeval v u γ hγ (hβ i) + +namespace NilpotentLieFiltration +open VectorPolynomial +open scoped TensorProduct + +variable {σ τ υ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +attribute [local irreducible] realChartSubstitute weightedAdaptedRealChartLie weightedAdaptedRealChartHom + +theorem weightedAdaptedRealChartLie_comp + (w : σ → ℕ) (v : τ → ℕ) (u : υ → ℕ) + (β : σ → MvPolynomial τ ℝ) (γ : τ → MvPolynomial υ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (hγ : ∀ i, γ i ∈ weightedSupportLE u (v i)) + (hcomp : ∀ i, MvPolynomial.aeval γ (β i) ∈ weightedSupportLE u (w i)) + (p : F.realification.adaptedLieSubalgebra w) : + F.weightedAdaptedRealChartLie w u (fun i => MvPolynomial.aeval γ (β i)) hcomp p = + F.weightedAdaptedRealChartLie v u γ hγ (F.weightedAdaptedRealChartLie w v β hβ p) := by + apply Subtype.ext + simp only [weightedAdaptedRealChartLie_coe] + exact (realChartSubstitute_comp β γ _).symm + +theorem weightedAdaptedRealChartHom_comp + (w : σ → ℕ) (v : τ → ℕ) (u : υ → ℕ) + (β : σ → MvPolynomial τ ℝ) (γ : τ → MvPolynomial υ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (hγ : ∀ i, γ i ∈ weightedSupportLE u (v i)) + (hcomp : ∀ i, MvPolynomial.aeval γ (β i) ∈ weightedSupportLE u (w i)) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + F.weightedAdaptedRealChartHom w u (fun i => MvPolynomial.aeval γ (β i)) hcomp g = + F.weightedAdaptedRealChartHom v u γ hγ (F.weightedAdaptedRealChartHom w v β hβ g) := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + simp only [weightedAdaptedRealChartHom_coord] + exact (realChartSubstitute_comp β γ _).symm + +theorem weightedAdaptedRealChartHom_comp_eq + (w : σ → ℕ) (v : τ → ℕ) (u : υ → ℕ) + (β : σ → MvPolynomial τ ℝ) (γ : τ → MvPolynomial υ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (hγ : ∀ i, γ i ∈ weightedSupportLE u (v i)) : + F.weightedAdaptedRealChartHom w u (fun i => MvPolynomial.aeval γ (β i)) + (weightedRealChart_comp_support w v u β γ hβ hγ) = + (F.weightedAdaptedRealChartHom v u γ hγ).comp + (F.weightedAdaptedRealChartHom w v β hβ) := by + apply MonoidHom.ext + intro g + exact F.weightedAdaptedRealChartHom_comp w v u β γ hβ hγ _ g + +end NilpotentLieFiltration +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial MvPolynomial + +variable {σ τ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem realSymbolHomogeneousPullback_mem_pointwise + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (U : LieSubalgebra ℚ F.AssociatedGraded) (P : F.RealPolynomialSymbolGroup w) + (hP : P.coord ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w U)) : + (F.realSymbolHomogeneousPullbackHom b ω hF w v β hβ P).coord ∈ + realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF v U) := by + apply (F.mem_real_symbolPointwiseSubalgebra_iff_values b ω hF v U _).mpr + intro t + rw [F.realSymbolHomogeneousPullbackHom_coord, + F.realGradedSymbolPolynomial_homogeneousPullback b ω hF w v β hβ, + eval₂_realChartSubstitute] + exact (F.mem_real_symbolPointwiseSubalgebra_iff_values b ω hF w U P.coord).mp hP _ + +theorem realSymbolFactorization_weightedChart + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (U : LieSubalgebra ℚ F.AssociatedGraded) + (g : (F.realification.adaptedPolynomialFiltration w).Group) + (E P R : F.RealPolynomialSymbolGroup w) + (hfactor : E * P * R = F.realPolynomialSymbolHom b ω hF w g) + (hP : P.coord ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w U)) : + let pull := F.realSymbolHomogeneousPullbackHom b ω hF w v + (fun i => weightedHomogeneousComponent v (w i) (β i)) + (fun _i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) + pull E * pull P * pull R = F.realPolynomialSymbolHom b ω hF v + (F.weightedAdaptedRealChartHom w v β hβ g) ∧ + (pull P).coord ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF v U) := by + dsimp only + constructor + · rw [F.realPolynomialSymbolHom_weightedAdaptedRealChart b ω hF w v β hβ g, + ← map_mul, ← map_mul, hfactor] + · exact F.realSymbolHomogeneousPullback_mem_pointwise b ω hF w v _ _ U P hP + +theorem realSymbolFactorization_integerChart + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℤ) + (hβ : ∀ i, MvPolynomial.map (Int.castRingHom ℝ) (β i) ∈ weightedSupportLE v (w i)) + (U : LieSubalgebra ℚ F.AssociatedGraded) + (g : (F.realification.adaptedPolynomialFiltration w).Group) + (E P R : F.RealPolynomialSymbolGroup w) + (hfactor : E * P * R = F.realPolynomialSymbolHom b ω hF w g) + (hP : P.coord ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w U)) + (q : ℕ) (hR : F.SymbolRationalGrid b ω hF w q R) : + let pull := F.realSymbolHomogeneousPullbackHom b ω hF w v + (fun i => weightedHomogeneousComponent v (w i) (MvPolynomial.map (Int.castRingHom ℝ) (β i))) + (fun _i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) + pull E * pull P * pull R = F.realPolynomialSymbolHom b ω hF v + (F.weightedAdaptedRealChartHom w v (fun i => MvPolynomial.map (Int.castRingHom ℝ) (β i)) hβ g) ∧ + (pull P).coord ∈ realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF v U) ∧ + F.SymbolRationalGrid b ω hF v q (pull R) := by + obtain ⟨hprod, hmid⟩ := F.realSymbolFactorization_weightedChart b ω hF w v + (fun i => MvPolynomial.map (Int.castRingHom ℝ) (β i)) hβ U g E P R hfactor hP + exact ⟨hprod, hmid, F.symbolRationalGrid_integerTopPullback b ω hF w v β q R hR⟩ + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial MvPolynomial +open scoped TensorProduct + +attribute [local irreducible] weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom realPolynomialSymbolLift + +variable {σ τ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem adaptedPolynomialRealValueHom_weightedChart + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (g : (F.realification.adaptedPolynomialFiltration w).Group) (t : τ → ℝ) : + F.adaptedPolynomialRealValueHom v t (F.weightedAdaptedRealChartHom w v β hβ g) = + F.adaptedPolynomialRealValueHom w (fun i => MvPolynomial.eval t (β i)) g := by + apply NilpotentLieBCHGroup.ext + rw [F.adaptedPolynomialRealValueHom_coord, F.weightedAdaptedRealChartHom_coord, + eval₂_realChartSubstitute, F.adaptedPolynomialRealValueHom_coord] + +theorem adaptedPolynomialRealValueHom_weightedChart_eq_of_fixed + (w : σ → ℕ) (β : σ → MvPolynomial σ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE w (w i)) + (g : (F.realification.adaptedPolynomialFiltration w).Group) (t : σ → ℝ) + (ht : ∀ i, MvPolynomial.eval t (β i) = t i) : + F.adaptedPolynomialRealValueHom w t (F.weightedAdaptedRealChartHom w w β hβ g) = + F.adaptedPolynomialRealValueHom w t g := by + rw [F.adaptedPolynomialRealValueHom_weightedChart, funext ht] + +variable (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem realSymbolHomogeneousPullback_mem_of_range + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (W : LieSubalgebra ℚ F.AssociatedGraded) + (K : Set (σ → ℝ)) (P : F.RealPolynomialSymbolGroup w) + (hP : ∀ t ∈ K, eval₂ t (F.realGradedSymbolPolynomial b ω hF w P.coord) ∈ + W.toSubmodule.baseChange ℝ) + (hK : ∀ t : τ → ℝ, (fun i => MvPolynomial.eval t (β i)) ∈ K) : + (F.realSymbolHomogeneousPullbackHom b ω hF w v β hβ P).coord ∈ + realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF v W) := by + apply (F.mem_real_symbolPointwiseSubalgebra_iff_values b ω hF v W _).mpr + intro t + rw [F.realSymbolHomogeneousPullbackHom_coord, + F.realGradedSymbolPolynomial_homogeneousPullback b ω hF w v β hβ, + eval₂_realChartSubstitute] + exact hP _ (hK t) + +theorem exists_global_native_factors_of_symbol [Fintype ι] + (w : σ → ℕ) (hw : ∀ i, 0 < w i) + (W : LieSubalgebra ℚ F.AssociatedGraded) + (g : (F.realification.adaptedPolynomialFiltration w).Group) + (E R : F.RealPolynomialSymbolGroup w) + (hfast : (E⁻¹ * F.realPolynomialSymbolHom b ω hF w g * R⁻¹).coord ∈ + realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w W)) : + ∃ (a : ℝ ⊗[ℚ] L) (v : L) + (e middle r : (F.realification.adaptedPolynomialFiltration w).Group) + (q : (F.gradedRefiltration W).realification.PolynomialOrbit w), + (∀ i, 0 ≤ (b.baseChange ℝ).repr a i ∧ (b.baseChange ℝ).repr a i < 1) ∧ + (∀ i, ∃ z : ℤ, b.repr v i = z) ∧ + e = F.realPolynomialSymbolLift b ω hF w E * + F.realification.adaptedConstantGroupHom w ⟨a⟩ ∧ + r = F.realification.adaptedConstantGroupHom w ⟨(1 : ℝ) ⊗ₜ[ℚ] v⟩ * + F.realPolynomialSymbolLift b ω hF w R ∧ + e * middle * r = g ∧ + F.realPolynomialSymbolHom b ω hF w e = E ∧ + F.realPolynomialSymbolHom b ω hF w r = R ∧ + coefficients (middle.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) 0 ∈ + F.realification.layer 2 ∧ + VectorPolynomial.map + (realLieHomToRat (realificationLieHom (F.gradedRefiltrationSubalgebra W).incl)).toLinearMap + q.log = (middle.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) ∧ + ∀ t : σ → ℝ, NilpotentLieBCHGroup.realificationMap + (hnil := (F.gradedRefiltration W).lowerCentralSeries_eq_bot) + (hM := F.lowerCentralSeries_eq_bot) (F.gradedRefiltrationSubalgebra W).incl + ((F.gradedRefiltration W).realification.polynomialOrbitRealEval w t q) = + F.adaptedPolynomialRealValueHom w t middle := by + let e₀ := F.realPolynomialSymbolLift b ω hF w E + let r₀ := F.realPolynomialSymbolLift b ω hF w R + let p₀ := e₀⁻¹ * g * r₀⁻¹ + have hsym : F.realPolynomialSymbolHom b ω hF w p₀ = + E⁻¹ * F.realPolynomialSymbolHom b ω hF w g * R⁻¹ := by + simp only [p₀, map_mul, map_inv, e₀, r₀, F.realPolynomialSymbolHom_lift] + obtain ⟨a, v, e, middle, r, ha, hv, he, hr, hprod, hesym, hp, hrsym, hconstant⟩ := + F.exists_fractional_integral_polynomial_normalization b ω hF w e₀ p₀ r₀ + have hprod' : e * middle * r = g := hprod.trans (by dsimp only [p₀]; group) + have hfirst : coefficients (middle.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) 0 ∈ + F.realGradedRefiltrationLayer W 1 := + Submodule.baseChange_mono ℝ (F.layer_succ_le_gradedRefiltrationLayer W 1) hconstant + have hpfast : (F.realPolynomialSymbolHom b ω hF w middle).coord ∈ + realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w W) := by + rw [hp, hsym] + exact hfast + rw [F.realPolynomialSymbolHom_coord] at hpfast + obtain ⟨q, hq, hvalues⟩ := F.exists_native_pointwise_refiltered_orbit_of_constant W + b ω hF w hw middle.coord hfirst + ((F.mem_real_symbolPointwiseSubalgebra_iff_values b ω hF w W _).mp hpfast) + refine ⟨a, v, e, middle, r, q, ha, hv, he, hr, hprod', ?_, ?_, hconstant, hq, hvalues⟩ + · exact hesym.trans (F.realPolynomialSymbolHom_lift b ω hF w E) + · exact hrsym.trans (F.realPolynomialSymbolHom_lift b ω hF w R) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/GlobalMarkedChartwiseNormalization.lean b/lean/OAI/Combinatorics/Progressions/Geometry/GlobalMarkedChartwiseNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..20e51de1752cb065b5a91c6ee00309c5e2301460 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/GlobalMarkedChartwiseNormalization.lean @@ -0,0 +1,118 @@ +import OAI.Combinatorics.Progressions.Estimates.GlobalMarkedOuterNormalization + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial MvPolynomial +open scoped TensorProduct + +attribute [local irreducible] weightedAdaptedRealChartHom realChartSubstitute + +variable {σ τ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem weightedAdaptedRealChartHom_constant + (w : σ → ℕ) (v : τ → ℕ) (γ : σ → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (w i)) (a : F.realification.Group) : + F.weightedAdaptedRealChartHom w v γ hγ (F.realification.adaptedConstantGroupHom w a) = + F.realification.adaptedConstantGroupHom v a := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + rw [F.weightedAdaptedRealChartHom_coord, F.realification.adaptedConstantGroupHom_log, + F.realification.adaptedConstantGroupHom_log] + apply sub_eq_zero.mp + apply eq_zero_of_eval₂_zero (K := ℝ) + intro t + simp only [map_sub, eval₂_realChartSubstitute, VectorPolynomial.eval₂_monomial, + Finsupp.prod_zero_index, one_smul, sub_self] + +theorem exists_chartwise_controlled_globalMarkedNativeFactors (s a : ℕ) : + ∃ Ce Cr : ℕ, 2 ≤ Ce ∧ 2 ≤ Cr ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H l : ℕ) (p : ℝ), 1 ≤ H → 0 < l → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → (l : ℝ) ≤ Real.exp p → + (∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) → + ∃ n : ℕ, 0 < n ∧ (n : ℝ) ≤ Real.exp ((p + Cr) ^ Cr) ∧ l ∣ n ∧ + ∀ (W : LieSubalgebra ℚ F.AssociatedGraded) + (g e₀ r₀ : (F.realification.adaptedPolynomialFiltration w).Group) + (E R : F.RealPolynomialSymbolGroup w), + F.realPolynomialSymbolHom b ω hF w e₀ = E → + F.realPolynomialSymbolHom b ω hF w r₀ = R → + (E⁻¹ * F.realPolynomialSymbolHom b ω hF w g * R⁻¹).coord ∈ + realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w W) → + F.PolynomialRationalGrid b w l r₀ → + ∃ A : GlobalMarkedNativeFactors F b ω hF w W g E R, + F.PolynomialRationalGrid b w n A.right ∧ + ∀ {τ : Type*} [Fintype τ] (v : τ → ℕ), (∀ i, 0 < v i) → + (Fintype.card τ : ℝ) ≤ p → + ∀ (γ : σ → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (w i)) + (T : τ → ℝ), (∀ i, 0 < T i) → + F.PolynomialSlowBound b v T (Real.exp ((p + 2) ^ a)) + (F.weightedAdaptedRealChartHom w v γ hγ e₀) → + F.PolynomialSlowBound b v T (Real.exp ((p + Ce) ^ Ce)) + (F.weightedAdaptedRealChartHom w v γ hγ A.left) := by + obtain ⟨Ce, hCe, hslow⟩ := exists_polynomial_slow_product_bound s a 2 + obtain ⟨Cr, hCr, hrat⟩ := exists_polynomial_rational_product_bound s 2 + refine ⟨Ce, Cr, hCe, hCr, ?_⟩ + intro σ ι L _ _ _ _ F b ω hF w hw H l p hH hl hp hι hσ hHp hlp hbracket + obtain ⟨n, hn, hnp, hln, hproduct⟩ := + hrat F b ω hF w hw H p hH hp hι hσ hHp hbracket l hl hlp + refine ⟨n, hn, hnp, hln, ?_⟩ + intro W g e₀ r₀ E R he hr hfast hrGrid + obtain ⟨u, z, A, hu, hz, hleft, hright⟩ := + F.exists_globalMarkedNativeFactors_of_outer_lifts b ω hF w W hw g e₀ r₀ E R he hr hfast + have hzGrid : (fun i => (b.baseChange ℝ).repr ((1 : ℝ) ⊗ₜ[ℚ] z) i) ∈ + realDenominatorGrid 1 := by + classical + choose k hk using hz + refine ⟨k, ?_⟩ + funext i + change (k i : ℝ) = (1 : ℕ) * (b.baseChange ℝ).repr ((1 : ℝ) ⊗ₜ[ℚ] z) i + rw [Basis.baseChange_repr_tmul (S := ℝ), hk] + simp only [Rat.smul_def, Rat.cast_intCast, mul_one, Nat.cast_one, one_mul] + have hzPolynomial := F.polynomialRationalGrid_constant b w 1 + (⟨(1 : ℝ) ⊗ₜ[ℚ] z⟩ : F.realification.Group) hzGrid + have hzPolynomial' := F.polynomialRationalGrid_of_dvd b w + (by decide : 0 < 1) (one_dvd l) _ hzPolynomial + have hrFinal := hproduct + [F.realification.adaptedConstantGroupHom w ⟨(1 : ℝ) ⊗ₜ[ℚ] z⟩, r₀] (by simp) + (by + intro t ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl + · exact hzPolynomial' + · exact hrGrid) + refine ⟨A, ?_, ?_⟩ + · simpa only [List.prod_cons, List.prod_nil, mul_one, ← hright] using hrFinal + · intro τ _ v hv hτ γ hγ T hT heSlow + have huBound : ∀ i, |(b.baseChange ℝ).repr u i| ≤ Real.exp ((p + 2) ^ a) := by + intro i + rw [abs_of_nonneg (hu i).1] + exact (hu i).2.le.trans (Real.one_le_exp (by positivity)) + have huSlow := F.polynomialSlowBound_constant b v T hT (Real.exp_nonneg _) + (⟨u⟩ : F.realification.Group) huBound + have heFinal := hslow F b ω hF v hv H p hH hp hι hτ hHp hbracket T hT + [F.weightedAdaptedRealChartHom w v γ hγ e₀, + F.realification.adaptedConstantGroupHom v ⟨u⟩] (by simp) + (by + intro t ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl + · exact heSlow + · exact huSlow) + rw [hleft, map_mul, F.weightedAdaptedRealChartHom_constant] + simpa only [List.prod_cons, List.prod_nil, mul_one] using heFinal + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/GlobalMarkedNativeChartResetConditions.lean b/lean/OAI/Combinatorics/Progressions/Geometry/GlobalMarkedNativeChartResetConditions.lean new file mode 100644 index 0000000000000000000000000000000000000000..b99e9b346f1a9a491f0461d7368f68d17484cc40 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/GlobalMarkedNativeChartResetConditions.lean @@ -0,0 +1,214 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeRefilteredSymbolConditions +import OAI.Combinatorics.Progressions.Lattices.CertifiedFullChartAffineTerminal + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped TensorProduct + +attribute [local irreducible] realChartSubstitute weightedAdaptedRealChartHom + polynomialOrbitRealChart + +variable {m s : ℕ} {X τ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) + (J : Fin m → Type*) [∀ j, Fintype (J j)] + (Ktag : ∀ j, Submodule ℝ (J j → ℝ)) (c : ∀ j, J j → ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J + +theorem weightedAdaptedRealChartHom_affineRetraction_eq + (v : τ → ℕ) (γ : X ⊕ (Σ j, J j) → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (wt i)) + (hretained : ∀ t : τ → ℝ, ∀ j, + (fun i => MvPolynomial.eval t (γ (Sum.inr ⟨j, i⟩))) - c j ∈ Ktag j) + (g : (F.realification.adaptedPolynomialFiltration wt).Group) : + F.weightedAdaptedRealChartHom wt v γ hγ + (F.weightedAdaptedRealChartHom wt wt (fullTaggedAffineRetraction J Ktag c) + (fullTaggedAffineRetraction_support J Ktag c) g) = + F.weightedAdaptedRealChartHom wt v γ hγ g := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + simp only [F.weightedAdaptedRealChartHom_coord] + apply sub_eq_zero.mp + apply eq_zero_of_eval₂_zero (K := ℝ) + intro t + rw [map_sub, eval₂_realChartSubstitute, eval₂_realChartSubstitute, + eval₂_realChartSubstitute, + fullTaggedAffineRetraction_eval_eq J Ktag c _ (hretained t), sub_self] + +theorem weightedAdaptedRealChartHom_affineMap_eq + (P : ∀ j, (J j → ℝ) →ₗ[ℝ] (J j → ℝ)) + (hP : ∀ j x, x ∈ Ktag j → P j x = x) + (v : τ → ℕ) (γ : X ⊕ (Σ j, J j) → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (wt i)) + (hretained : ∀ t : τ → ℝ, ∀ j, + (fun i => MvPolynomial.eval t (γ (Sum.inr ⟨j, i⟩))) - c j ∈ Ktag j) + (g : (F.realification.adaptedPolynomialFiltration wt).Group) : + F.weightedAdaptedRealChartHom wt v γ hγ + (F.weightedAdaptedRealChartHom wt wt (fullTaggedAffineMapChart J P c) + (fullTaggedAffineMapChart_support J P c) g) = + F.weightedAdaptedRealChartHom wt v γ hγ g := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + simp only [F.weightedAdaptedRealChartHom_coord] + apply sub_eq_zero.mp + apply eq_zero_of_eval₂_zero (K := ℝ) + intro t + rw [map_sub, eval₂_realChartSubstitute, eval₂_realChartSubstitute, + eval₂_realChartSubstitute, + fullTaggedAffineMapChart_eval_eq J P c Ktag hP _ (hretained t), sub_self] + +namespace GlobalMarkedNativeFactors + +variable {F J Ktag c} + {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {W : LieSubalgebra ℚ F.AssociatedGraded} + +theorem affine_chart_product + {g : (F.realification.adaptedPolynomialFiltration wt).Group} + {E R : F.RealPolynomialSymbolGroup wt} + (A : GlobalMarkedNativeFactors F b ω hF wt W + (F.weightedAdaptedRealChartHom wt wt (fullTaggedAffineRetraction J Ktag c) + (fullTaggedAffineRetraction_support J Ktag c) g) E R) + (v : τ → ℕ) (γ : X ⊕ (Σ j, J j) → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (wt i)) + (hretained : ∀ t : τ → ℝ, ∀ j, + (fun i => MvPolynomial.eval t (γ (Sum.inr ⟨j, i⟩))) - c j ∈ Ktag j) : + F.weightedAdaptedRealChartHom wt v γ hγ A.left * + F.weightedAdaptedRealChartHom wt v γ hγ A.middle * + F.weightedAdaptedRealChartHom wt v γ hγ A.right = + F.weightedAdaptedRealChartHom wt v γ hγ g := by + rw [← map_mul, ← map_mul, A.product, + F.weightedAdaptedRealChartHom_affineRetraction_eq J Ktag c v γ hγ hretained g] + +theorem affine_map_chart_product + (P : ∀ j, (J j → ℝ) →ₗ[ℝ] (J j → ℝ)) + (hP : ∀ j x, x ∈ Ktag j → P j x = x) + {g : (F.realification.adaptedPolynomialFiltration wt).Group} + {E R : F.RealPolynomialSymbolGroup wt} + (A : GlobalMarkedNativeFactors F b ω hF wt W + (F.weightedAdaptedRealChartHom wt wt (fullTaggedAffineMapChart J P c) + (fullTaggedAffineMapChart_support J P c) g) E R) + (v : τ → ℕ) (γ : X ⊕ (Σ j, J j) → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (wt i)) + (hretained : ∀ t : τ → ℝ, ∀ j, + (fun i => MvPolynomial.eval t (γ (Sum.inr ⟨j, i⟩))) - c j ∈ Ktag j) : + F.weightedAdaptedRealChartHom wt v γ hγ A.left * + F.weightedAdaptedRealChartHom wt v γ hγ A.middle * + F.weightedAdaptedRealChartHom wt v γ hγ A.right = + F.weightedAdaptedRealChartHom wt v γ hγ g := by + rw [← map_mul, ← map_mul, A.product, + F.weightedAdaptedRealChartHom_affineMap_eq J Ktag c P hP v γ hγ hretained g] + +variable {σ : Type*} {w : σ → ℕ} + {g : (F.realification.adaptedPolynomialFiltration w).Group} + {E R : F.RealPolynomialSymbolGroup w} + +theorem chart_middle_log + (A : GlobalMarkedNativeFactors F b ω hF w W g E R) + (v : τ → ℕ) (γ : σ → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (w i)) : + VectorPolynomial.map + (realLieHomToRat (realificationLieHom (F.gradedRefiltrationSubalgebra W).incl)).toLinearMap + ((F.gradedRefiltration W).polynomialOrbitRealChart w v γ hγ A.markedMiddle).log = + (F.weightedAdaptedRealChartHom w v γ hγ A.middle).coord.val := by + rw [polynomialOrbitRealChart_log, F.weightedAdaptedRealChartHom_coord, ← A.middle_log] + exact (realChartSubstitute_map γ + (realificationLieHom (F.gradedRefiltrationSubalgebra W).incl).toLinearMap A.markedMiddle.log).symm + +end GlobalMarkedNativeFactors +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped TensorProduct + +attribute [local irreducible] weightedAdaptedRealChartHom realChartSubstitute + realPolynomialSymbolHom polynomialOrbitRealChart + +variable {α σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +theorem weightedAdaptedRealChartHom_eq_of_fixed_chart + (w : α → ℕ) (v : σ → ℕ) (β : α → MvPolynomial α ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE w (w i)) + (γ : α → MvPolynomial σ ℝ) (hγ : ∀ i, γ i ∈ weightedSupportLE v (w i)) + (hfixed : ∀ t : σ → ℝ, + (fun i => MvPolynomial.eval (fun j => MvPolynomial.eval t (γ j)) (β i)) = + (fun i => MvPolynomial.eval t (γ i))) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + F.weightedAdaptedRealChartHom w v γ hγ + (F.weightedAdaptedRealChartHom w w β hβ g) = + F.weightedAdaptedRealChartHom w v γ hγ g := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + simp only [F.weightedAdaptedRealChartHom_coord] + apply sub_eq_zero.mp + apply eq_zero_of_eval₂_zero (K := ℝ) + intro t + rw [map_sub, eval₂_realChartSubstitute, eval₂_realChartSubstitute, + eval₂_realChartSubstitute, hfixed t, sub_self] + +namespace GlobalMarkedNativeFactors + +variable {F} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {w : α → ℕ} {v : σ → ℕ} + {W : LieSubalgebra ℚ F.AssociatedGraded} + {β : α → MvPolynomial α ℝ} + {hβ : ∀ i, β i ∈ weightedSupportLE w (w i)} + {g : (F.realification.adaptedPolynomialFiltration w).Group} + {E R : F.RealPolynomialSymbolGroup w} + (A : GlobalMarkedNativeFactors F b ω hF w W + (F.weightedAdaptedRealChartHom w w β hβ g) E R) + (γ : α → MvPolynomial σ ℝ) (hγ : ∀ i, γ i ∈ weightedSupportLE v (w i)) + (hfixed : ∀ t : σ → ℝ, + (fun i => MvPolynomial.eval (fun j => MvPolynomial.eval t (γ j)) (β i)) = + (fun i => MvPolynomial.eval t (γ i))) + +include hfixed + +theorem fixed_chart_residual_eq : + (F.weightedAdaptedRealChartHom w v γ hγ A.left)⁻¹ * + F.weightedAdaptedRealChartHom w v γ hγ g * + (F.weightedAdaptedRealChartHom w v γ hγ A.right)⁻¹ = + F.weightedAdaptedRealChartHom w v γ hγ A.middle := by + have hprod : F.weightedAdaptedRealChartHom w v γ hγ A.left * + F.weightedAdaptedRealChartHom w v γ hγ A.middle * + F.weightedAdaptedRealChartHom w v γ hγ A.right = + F.weightedAdaptedRealChartHom w v γ hγ g := by + rw [← map_mul, ← map_mul, A.product, + F.weightedAdaptedRealChartHom_eq_of_fixed_chart w v β hβ γ hγ hfixed] + rw [← hprod] + group + +theorem fixed_chart_native_conditions : + let residual := (F.weightedAdaptedRealChartHom w v γ hγ A.left)⁻¹ * + F.weightedAdaptedRealChartHom w v γ hγ g * + (F.weightedAdaptedRealChartHom w v γ hγ A.right)⁻¹ + (F.realPolynomialSymbolHom b ω hF v residual).coord ∈ + realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF v W) ∧ + coefficients (residual.coord : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) 0 ∈ + F.realGradedRefiltrationLayer W 1 := by + dsimp only + rw [A.fixed_chart_residual_eq γ hγ hfixed] + exact F.native_refiltered_symbol_conditions W b ω hF v + ((F.gradedRefiltration W).polynomialOrbitRealChart w v γ hγ A.markedMiddle) + (F.weightedAdaptedRealChartHom w v γ hγ A.middle) (A.chart_middle_log v γ hγ) + +end GlobalMarkedNativeFactors +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/GoodPartSpatialAverage.lean b/lean/OAI/Combinatorics/Progressions/Geometry/GoodPartSpatialAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..54363b4f09819304c5c9bfa1c3521ae8d49ba0b4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/GoodPartSpatialAverage.lean @@ -0,0 +1,90 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteGoodPartTransfer + +namespace OAI + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped BigOperators Classical + +variable {X Y : Type*} [Fintype X] [Fintype Y] + +theorem mean_norm_complexMean_le (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) + (f : X → Y → ℂ) : + q.mean (fun y => ‖p.complexMean (fun x => f x y)‖) ≤ + p.mean (fun x => q.mean (fun y => ‖f x y‖)) := by + apply (q.mean_mono (fun y => p.norm_complexMean_le_mean_norm (fun x => f x y))).trans_eq + simp only [mean, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + ring + +theorem mean_norm_goodPart_le (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) + (Good : X → Prop) (f : ∀ x, Good x → Y → ℂ) {ε : ℝ} (hε : 0 ≤ ε) + (h : ∀ x hx, q.mean (fun y => ‖f x hx y‖) ≤ ε) : + q.mean (fun y => ‖p.complexMean (fun x => if hx : Good x then f x hx y else 0)‖) ≤ ε := by + apply (p.mean_norm_complexMean_le q (fun x y => if hx : Good x then f x hx y else 0)).trans + apply (p.mean_mono (fun x => ?_)).trans_eq (p.mean_const ε) + by_cases hx : Good x + · simpa only [hx, dite_true] using h x hx + · simpa only [hx, dite_false, norm_zero, q.mean_const] using hε + +theorem complexMean_goodPart_test_le (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) + (Good : X → Prop) (f : ∀ x, Good x → Y → ℂ) {ε : ℝ} (hε : 0 ≤ ε) + (h : ∀ x hx, q.mean (fun y => ‖f x hx y‖) ≤ ε) + (φ : Y → ℂ) (hφ : ∀ y, ‖φ y‖ ≤ 1) : + ‖q.complexMean (fun y => + p.complexMean (fun x => if hx : Good x then f x hx y else 0) * φ y)‖ ≤ ε := by + apply (q.norm_complexMean_le_mean_norm _).trans + apply le_trans (q.mean_mono (fun y => ?_)) (p.mean_norm_goodPart_le q Good f hε h) + rw [norm_mul] + exact mul_le_of_le_one_right (norm_nonneg _) (hφ y) + +end Erdos3.FiniteProbabilityWeights + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {X K I : Type*} [Fintype X] [Fintype K] [Fintype I] +variable (p : FiniteProbabilityWeights X) (Good : X → Prop) +variable (stride : I → ℕ) (cells : Finset (ColumnResiduePattern K I stride)) +variable (W : K × I → ℝ) (hW : ∀ z, 0 < W z) +variable (hZ : 0 < ∑' z, selectedResidueSmoothWeight stride cells W z) +variable (f : ∀ x, Good x → (K × I → ℤ) → ℂ) + +include hW hZ in +theorem selectedResidue_goodPart_error {ε : ℝ} (hε : 0 ≤ ε) + (h : ∀ x hx, selectedResidueDensityMass stride cells W (fun z => ‖f x hx z‖) ≤ ε) : + selectedResidueDensityMass stride cells W + (fun z => ‖p.complexMean (fun x => if hx : Good x then f x hx z else 0)‖) ≤ ε := by + have ht := p.mean_norm_goodPart_le (selectedResidueFiniteLaw stride cells W hW hZ) Good + (fun x hx z => f x hx z.val) hε (fun x hx => by + rw [selectedResidueFiniteLaw_densityMass stride cells W hW hZ (fun z => ‖f x hx z‖)] + exact h x hx) + rw [selectedResidueFiniteLaw_densityMass stride cells W hW hZ + (fun z => ‖p.complexMean (fun x => if hx : Good x then f x hx z else 0)‖)] at ht + exact ht + +theorem selectedResidue_goodPart_test_error {ε : ℝ} (hε : 0 ≤ ε) + (h : ∀ x hx, selectedResidueDensityMass stride cells W (fun z => ‖f x hx z‖) ≤ ε) + (φ : (K × I → ℤ) → ℂ) (hφ : ∀ z, ‖φ z‖ ≤ 1) : + ‖∑' z, ((selectedResidueSmoothPMF stride cells W hW hZ z).toReal : ℂ) * + (p.complexMean (fun x => if hx : Good x then f x hx z else 0) * φ z)‖ ≤ ε := by + have ht := p.complexMean_goodPart_test_le (selectedResidueFiniteLaw stride cells W hW hZ) Good + (fun x hx z => f x hx z.val) hε (fun x hx => by + rw [selectedResidueFiniteLaw_densityMass stride cells W hW hZ (fun z => ‖f x hx z‖)] + exact h x hx) (fun z => φ z.val) (fun z => hφ z.val) + rw [selectedResidueFiniteLaw_complexMean stride cells W hW hZ + (fun z => p.complexMean (fun x => if hx : Good x then f x hx z else 0) * φ z)] at ht + exact ht + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/GradedTopCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/GradedTopCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d1539af0c32bccae04ceb31e6e8f7ea2650269a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/GradedTopCoordinates.lean @@ -0,0 +1,106 @@ +import OAI.Combinatorics.Progressions.Estimates.GradedUnitEvaluation + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + +local notation "ωQ" => (fun i : QuotientTopBasisIndex s ω => ω (Subtype.val i)) +local notation "bQ" => F.quotientTop.associatedGradedBasis + (F.quotientTopBasis e ω hF) ωQ (F.quotientTopBasis_layers e ω hF) +local notation "ωW" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "bW" => F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis e ω hF) ωW (F.reducedSquareBasis_layers e ω hF) + +theorem quotientTopGradedMap_coordinate (x : F.AssociatedGraded) (i : QuotientTopBasisIndex s ω) : + (bQ).repr (F.quotientTopGradedMap x) i = (F.associatedGradedBasis e ω hF).repr x i.val := by + classical + have he : ((bQ).coord i).comp F.quotientTopGradedMap.toLinearMap = + (F.associatedGradedBasis e ω hF).coord i.val := by + apply (F.associatedGradedBasis e ω hF).ext + intro j + change (bQ).repr (F.associatedGradedMap F.quotientTop (lieQuotientMap (F.layerIdeal (s + 1))) + (fun _ _ hx => F.quotientLie_mem _ le_rfl hx) (F.associatedGradedBasis e ω hF j)) i = + (F.associatedGradedBasis e ω hF).repr (F.associatedGradedBasis e ω hF j) i.val + rw [F.associatedGradedMap_basis_repr F.quotientTop e ω hF + (F.quotientTopBasis e ω hF) ωQ (F.quotientTopBasis_layers e ω hF) + (lieQuotientMap (F.layerIdeal (s + 1))) (fun _ _ hx => F.quotientLie_mem _ le_rfl hx), + F.quotientTopBasis_repr_mk, Basis.repr_self, Basis.repr_self] + by_cases hj : j = i.val <;> simp [hj] + exact DFunLike.congr_fun he x + +noncomputable def quotientTopGradedSection : F.quotientTop.AssociatedGraded →ₗ[ℚ] F.AssociatedGraded := + (bQ).constr ℚ (fun i => F.associatedGradedBasis e ω hF i.val) + +@[simp] theorem quotientTopGradedSection_basis (i : QuotientTopBasisIndex s ω) : + F.quotientTopGradedSection e ω hF ((bQ) i) = F.associatedGradedBasis e ω hF i.val := + Basis.constr_basis _ _ _ i + +theorem quotientTopGradedSection_coordinate (x : F.quotientTop.AssociatedGraded) + (i : QuotientTopBasisIndex s ω) : + (F.associatedGradedBasis e ω hF).repr (F.quotientTopGradedSection e ω hF x) i.val = (bQ).repr x i := by + classical + have he : ((F.associatedGradedBasis e ω hF).coord i.val).comp (F.quotientTopGradedSection e ω hF) = + (bQ).coord i := by + apply (bQ).ext + intro j + change (F.associatedGradedBasis e ω hF).repr (F.quotientTopGradedSection e ω hF ((bQ) j)) i.val = + (bQ).repr ((bQ) j) i + rw [F.quotientTopGradedSection_basis, Basis.repr_self, Basis.repr_self] + simp [Finsupp.single_apply, Subtype.ext_iff] + exact DFunLike.congr_fun he x + +theorem quotientTopGradedSection_coordinate_zero (x : F.quotientTop.AssociatedGraded) + (i : ι) (hi : s + 1 ≤ ω i) : + (F.associatedGradedBasis e ω hF).repr (F.quotientTopGradedSection e ω hF x) i = 0 := by + classical + have he : ((F.associatedGradedBasis e ω hF).coord i).comp (F.quotientTopGradedSection e ω hF) = 0 := by + apply (bQ).ext + intro j + change (F.associatedGradedBasis e ω hF).repr (F.quotientTopGradedSection e ω hF ((bQ) j)) i = 0 + rw [F.quotientTopGradedSection_basis, Basis.repr_self] + apply Finsupp.single_eq_of_ne + exact fun hij => j.property (hij ▸ hi) + exact DFunLike.congr_fun he x + +theorem quotientTopGradedSection_rightInverse (x : F.quotientTop.AssociatedGraded) : + F.quotientTopGradedMap (F.quotientTopGradedSection e ω hF x) = x := by + apply (bQ).repr.injective + ext i + rw [F.quotientTopGradedMap_coordinate, F.quotientTopGradedSection_coordinate] + +theorem quotientTopGradedMap_kernel : + LinearMap.ker F.quotientTopGradedMap.toLinearMap = + Submodule.span ℚ (F.associatedGradedBasis e ω hF '' {i | s + 1 ≤ ω i}) := by + ext x + rw [basis_mem_span_image_iff] + constructor + · intro hx i hi + have he := congrArg (fun y => (bQ).repr y ⟨i, hi⟩) (show F.quotientTopGradedMap x = 0 from hx) + simpa only [F.quotientTopGradedMap_coordinate, map_zero, Finsupp.zero_apply] using he + · intro hx + change F.quotientTopGradedMap x = 0 + apply (bQ).repr.injective + ext i + rw [F.quotientTopGradedMap_coordinate, map_zero, Finsupp.zero_apply] + exact hx i.val i.property + +theorem reducedSquareGradedSndMap_coordinate (x : F.squareFiltration.quotientTop.AssociatedGraded) + (i : QuotientTopBasisIndex s ω) : + (bQ).repr (F.reducedSquareGradedSndMap x) i = (bW).repr x (reducedSquareDiagonalIndex s ω i) := by + rw [F.quotientTop.associatedGradedBasis_repr, F.squareFiltration.quotientTop.associatedGradedBasis_repr] + exact F.reducedSquareSndSymbolMap_repr e ω hF (fun _ : Unit => 1) x + ⟨(unitMonomial (ω i.val), i), weight_unitMonomial (ω i.val)⟩ + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/HorizontalCoordinateBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/HorizontalCoordinateBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f8eda42be28d9d3dbf689f15ef810a13f7695e2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/HorizontalCoordinateBounds.lean @@ -0,0 +1,552 @@ +import OAI.Combinatorics.Progressions.Estimates.HorizontalAmbientQuotient +import OAI.Combinatorics.Progressions.Estimates.RealProjectedCoefficientLift +import OAI.Combinatorics.Progressions.Nilpotent.AmbientBracketCorrectionPolynomials + +namespace OAI + +section + +namespace Erdos3.DegreeRankLieFiltration + +variable {L M : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s r : ℕ} (F : DegreeRankLieFiltration L s r) + +def horizontalImageOfSubmodule (B : Submodule ℚ (Fin 4 → L)) (d : ℕ) : + Submodule ℚ (Fin 4 → F.HigherHorizontal d) := + (B.comap (F.fourHorizontalLayer d).subtype).map (F.fourHorizontalMap d) + +theorem layerHorizontalImage_eq_of_submodule (A : ℕ → Submodule ℚ M) + (φ : M →ₗ⁅ℚ⁆ (Fin 4 → L)) + (hφ : ∀ d x, x ∈ A d → ∀ k, φ x k ∈ F.layer d 1) (d : ℕ) : + F.layerHorizontalImage A φ hφ d = + F.horizontalImageOfSubmodule ((A d).map φ.toLinearMap) d := by + ext v + constructor + · rintro ⟨x, rfl⟩ + refine ⟨⟨φ x.val, (F.mem_fourHorizontalLayer d _).mpr (hφ d x.val x.property)⟩, ?_, rfl⟩ + exact ⟨x.val, x.property, rfl⟩ + · rintro ⟨y, hy, rfl⟩ + obtain ⟨x, hx, hxy⟩ := hy + refine ⟨⟨x, hx⟩, ?_⟩ + apply congrArg (F.fourHorizontalMap d) + exact Subtype.ext hxy + +theorem layerHorizontalImage_eq_of_map_eq {M' : Type*} [LieRing M'] [LieAlgebra ℚ M'] + (A : ℕ → Submodule ℚ M) (A' : ℕ → Submodule ℚ M') + (φ : M →ₗ⁅ℚ⁆ (Fin 4 → L)) (ψ : M' →ₗ⁅ℚ⁆ (Fin 4 → L)) + (hφ : ∀ d x, x ∈ A d → ∀ k, φ x k ∈ F.layer d 1) + (hψ : ∀ d x, x ∈ A' d → ∀ k, ψ x k ∈ F.layer d 1) + (d : ℕ) (heq : (A d).map φ.toLinearMap = (A' d).map ψ.toLinearMap) : + F.layerHorizontalImage A φ hφ d = F.layerHorizontalImage A' ψ hψ d := by + rw [F.layerHorizontalImage_eq_of_submodule, F.layerHorizontalImage_eq_of_submodule, heq] + +end Erdos3.DegreeRankLieFiltration + +end + +section + +namespace Erdos3.DegreeRankLieFiltration + +open Module + +variable {ι μ L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (d : ℕ) (f : Basis ι ℚ (L ⧸ F.layer d 2)) + +noncomputable def higherHorizontalCoordinates : F.HigherHorizontal d →ₗ[ℚ] (ι → ℚ) := + f.equivFun.toLinearMap.comp (F.higherHorizontalAmbient d) + +noncomputable def ambientHorizontalCoordinates : L →ₗ[ℚ] (ι → ℚ) := + f.equivFun.toLinearMap.comp (F.layer d 2).mkQ + +theorem higherHorizontalCoordinates_injective : Function.Injective (F.higherHorizontalCoordinates d f) := + f.equivFun.injective.comp (F.higherHorizontalAmbient_injective d) + +noncomputable def fourHorizontalCoordinates : + (Fin 4 → F.HigherHorizontal d) →ₗ[ℚ] (Fin 4 → ι → ℚ) := + LinearMap.pi (fun k => (F.higherHorizontalCoordinates d f).comp (LinearMap.proj k)) + +noncomputable def fourAmbientCoordinates : (Fin 4 → L) →ₗ[ℚ] (Fin 4 → ι → ℚ) := + LinearMap.pi (fun k => (F.ambientHorizontalCoordinates d f).comp (LinearMap.proj k)) + +theorem fourHorizontalCoordinates_injective : Function.Injective (F.fourHorizontalCoordinates d f) := by + intro x y h + funext k + exact F.higherHorizontalCoordinates_injective d f (congrFun h k) + +theorem fourHorizontalCoordinates_map (x : F.fourHorizontalLayer d) : + F.fourHorizontalCoordinates d f (F.fourHorizontalMap d x) = + F.fourAmbientCoordinates d f x.val := by + ext k i + rfl + +theorem horizontalImage_coordinates (B : Submodule ℚ (Fin 4 → L)) + (hB : B ≤ F.fourHorizontalLayer d) : + (F.horizontalImageOfSubmodule B d).map (F.fourHorizontalCoordinates d f) = + B.map (F.fourAmbientCoordinates d f) := by + ext v + constructor + · rintro ⟨y, hy, rfl⟩ + obtain ⟨x, hx, rfl⟩ := hy + exact ⟨x.val, hx, (F.fourHorizontalCoordinates_map d f x).symm⟩ + · rintro ⟨x, hx, rfl⟩ + let y : F.fourHorizontalLayer d := ⟨x, hB hx⟩ + exact ⟨F.fourHorizontalMap d y, ⟨y, hx, rfl⟩, F.fourHorizontalCoordinates_map d f y⟩ + +theorem fourAmbientCoordinates_height [Fintype μ] (b : Basis μ ℚ L) {H K : ℕ} + (hf : ∀ i j, RationalHeightLE (f.repr ((F.layer d 2).mkQ (b j)) i) H) + (x : Fin 4 → L) (hx : ∀ k j, RationalHeightLE (b.repr (x k) j) K) + (k : Fin 4) (i : ι) : + RationalHeightLE (F.fourAmbientCoordinates d f x k i) + ((Fintype.card μ + 1) * (K * H) ^ Fintype.card μ) := + linearMap_coordinate_height b f (F.layer d 2).mkQ (fun j i => hf i j) (x k) (hx k) i + +end Erdos3.DegreeRankLieFiltration + +end + +section + +namespace Erdos3.DegreeRankLieFiltration + +open Module +open scoped TensorProduct + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (d : ℕ) (f : Basis ι ℚ (L ⧸ F.layer d 2)) + +noncomputable def realFourCoordinateEquiv : + (ℝ ⊗[ℚ] (Fin 4 → ι → ℚ)) ≃ₗ[ℝ] ((Σ _ : Fin 4, ι) → ℝ) := + ((Pi.basis (fun _ : Fin 4 => Pi.basisFun ℚ ι)).baseChange ℝ).equivFun + +noncomputable def realFourHorizontalCoordinates : + (ℝ ⊗[ℚ] (Fin 4 → F.HigherHorizontal d)) →ₗ[ℝ] ((Σ _ : Fin 4, ι) → ℝ) := + (realFourCoordinateEquiv (ι := ι)).toLinearMap.comp + ((F.fourHorizontalCoordinates d f).baseChange ℝ) + +noncomputable def realFourAmbientCoordinates : + (ℝ ⊗[ℚ] (Fin 4 → L)) →ₗ[ℝ] ((Σ _ : Fin 4, ι) → ℝ) := + (realFourCoordinateEquiv (ι := ι)).toLinearMap.comp + ((F.fourAmbientCoordinates d f).baseChange ℝ) + +theorem realFourHorizontalCoordinates_injective : + Function.Injective (F.realFourHorizontalCoordinates d f) := by + let : Module.Free ℚ ℝ := Module.Free.of_divisionRing ℚ ℝ + exact (realFourCoordinateEquiv (ι := ι)).injective.comp + (Module.Flat.lTensor_preserves_injective_linearMap (M := ℝ) + (F.fourHorizontalCoordinates d f) (F.fourHorizontalCoordinates_injective d f)) + +theorem realFourHorizontalCoordinates_tensor_map (x : ℝ ⊗[ℚ] F.fourHorizontalLayer d) : + F.realFourHorizontalCoordinates d f ((F.fourHorizontalMap d).baseChange ℝ x) = + F.realFourAmbientCoordinates d f ((F.fourHorizontalLayer d).subtype.baseChange ℝ x) := by + induction x using TensorProduct.inductionOn with + | tmul a x => + change realFourCoordinateEquiv + ((F.fourHorizontalCoordinates d f).baseChange ℝ ((F.fourHorizontalMap d).baseChange ℝ (a ⊗ₜ[ℚ] x))) = + realFourCoordinateEquiv + ((F.fourAmbientCoordinates d f).baseChange ℝ + ((F.fourHorizontalLayer d).subtype.baseChange ℝ (a ⊗ₜ[ℚ] x))) + simp only [LinearMap.baseChange_tmul, F.fourHorizontalCoordinates_map] + rfl + | add x y hx hy => simp only [map_add, hx, hy] + +theorem realFourHorizontalCoordinates_map (x : (F.fourHorizontalLayer d).baseChange ℝ) : + F.realFourHorizontalCoordinates d f (F.realFourHorizontalMap d x) = + F.realFourAmbientCoordinates d f x.val := by + obtain ⟨v, rfl⟩ := (realificationSubmoduleEquiv (F.fourHorizontalLayer d)).surjective x + rw [F.realFourHorizontalMap_baseChange] + exact F.realFourHorizontalCoordinates_tensor_map d f v + +theorem realFourHorizontalCoordinates_image (J : Submodule ℚ (Fin 4 → F.HigherHorizontal d)) : + (J.baseChange ℝ).map (F.realFourHorizontalCoordinates d f) = + ((J.map (F.fourHorizontalCoordinates d f)).baseChange ℝ).map + (realFourCoordinateEquiv (ι := ι)).toLinearMap := by + rw [realification_map] + ext v + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨(F.fourHorizontalCoordinates d f).baseChange ℝ x, ⟨x, hx, rfl⟩, rfl⟩ + · rintro ⟨y, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨x, hx, rfl⟩ + +theorem realFourAmbientCoordinates_component (x : ℝ ⊗[ℚ] (Fin 4 → L)) (k : Fin 4) (i : ι) : + F.realFourAmbientCoordinates d f x ⟨k, i⟩ = + (f.baseChange ℝ).repr ((F.layer d 2).mkQ.baseChange ℝ ((LinearMap.proj k).baseChange ℝ x)) i := by + induction x using TensorProduct.inductionOn with + | tmul a x => + change ((Pi.basis (fun _ : Fin 4 => Pi.basisFun ℚ ι)).baseChange ℝ).repr + (a ⊗ₜ[ℚ] F.fourAmbientCoordinates d f x) ⟨k, i⟩ = + (f.baseChange ℝ).repr (a ⊗ₜ[ℚ] (F.layer d 2).mkQ (x k)) i + rw [Basis.baseChange_repr_tmul, Basis.baseChange_repr_tmul, Pi.basis_repr] + rfl + | add x y hx hy => simp only [map_add, Pi.add_apply, Finsupp.add_apply, hx, hy] + +theorem realFourHorizontalCoordinates_component + (x : ℝ ⊗[ℚ] (Fin 4 → F.HigherHorizontal d)) (k : Fin 4) (i : ι) : + F.realFourHorizontalCoordinates d f x ⟨k, i⟩ = + (f.baseChange ℝ).repr + ((F.higherHorizontalAmbient d).baseChange ℝ ((LinearMap.proj k).baseChange ℝ x)) i := by + induction x using TensorProduct.inductionOn with + | tmul a x => + change ((Pi.basis (fun _ : Fin 4 => Pi.basisFun ℚ ι)).baseChange ℝ).repr + (a ⊗ₜ[ℚ] F.fourHorizontalCoordinates d f x) ⟨k, i⟩ = + (f.baseChange ℝ).repr (a ⊗ₜ[ℚ] F.higherHorizontalAmbient d (x k)) i + rw [Basis.baseChange_repr_tmul, Basis.baseChange_repr_tmul, Pi.basis_repr] + rfl + | add x y hx hy => simp only [map_add, Pi.add_apply, Finsupp.add_apply, hx, hy] + +end Erdos3.DegreeRankLieFiltration + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +variable {ι κ : Type*} [Fintype ι] + +noncomputable def realRationalCoordinateEquiv : (ℝ ⊗[ℚ] (ι → ℚ)) ≃ₗ[ℝ] (ι → ℝ) := + ((Pi.basisFun ℚ ι).baseChange ℝ).equivFun + +theorem realRationalCoordinateEquiv_tmul (a : ℝ) (x : ι → ℚ) (i : ι) : + realRationalCoordinateEquiv (a ⊗ₜ[ℚ] x) i = a * (x i : ℝ) := by + change ((Pi.basisFun ℚ ι).baseChange ℝ).repr (a ⊗ₜ[ℚ] x) i = _ + rw [Basis.baseChange_repr_tmul] + change (x i) • a = _ + simp only [Rat.smul_def, mul_comm] + +theorem realFourCoordinateEquiv_tmul (a : ℝ) (x : Fin 4 → ι → ℚ) (j : Σ _ : Fin 4, ι) : + DegreeRankLieFiltration.realFourCoordinateEquiv (a ⊗ₜ[ℚ] x) j = a * (x j.1 j.2 : ℝ) := by + change ((Pi.basis (fun _ : Fin 4 => Pi.basisFun ℚ ι)).baseChange ℝ).repr + (a ⊗ₜ[ℚ] x) j = _ + rw [Basis.baseChange_repr_tmul, Pi.basis_repr] + change (x j.1 j.2) • a = _ + simp only [Rat.smul_def, mul_comm] + +noncomputable def realRationalCoordinateSpan (U : Submodule ℚ (ι → ℚ)) : Submodule ℝ (ι → ℝ) := + (U.baseChange ℝ).map realRationalCoordinateEquiv.toLinearMap + +noncomputable def realFourCoordinateSpan (J : Submodule ℚ (Fin 4 → ι → ℚ)) : + Submodule ℝ ((Σ _ : Fin 4, ι) → ℝ) := + (J.baseChange ℝ).map DegreeRankLieFiltration.realFourCoordinateEquiv.toLinearMap + +theorem realCoordinate_projection (x : ℝ ⊗[ℚ] (Fin 4 → ι → ℚ)) (k : Fin 4) (i : ι) : + realRationalCoordinateEquiv ((LinearMap.proj k).baseChange ℝ x) i = + DegreeRankLieFiltration.realFourCoordinateEquiv x ⟨k, i⟩ := by + induction x using TensorProduct.inductionOn with + | tmul a x => + rw [LinearMap.baseChange_tmul, realRationalCoordinateEquiv_tmul, realFourCoordinateEquiv_tmul] + rfl + | add x y hx hy => simp only [map_add, Pi.add_apply, hx, hy] + +theorem realFourCoordinateSpan_span (v : κ → Fin 4 → ι → ℚ) : + realFourCoordinateSpan (Submodule.span ℚ (Set.range v)) = + Submodule.span ℝ (Set.range (fun a (j : Σ _ : Fin 4, ι) => (v a j.1 j.2 : ℝ))) := by + unfold realFourCoordinateSpan + rw [Submodule.baseChange_span, Submodule.map_span, Set.image_image] + apply congrArg (Submodule.span ℝ) + ext x + constructor + · rintro ⟨y, ⟨a, rfl⟩, rfl⟩ + refine ⟨a, ?_⟩ + funext j + change (v a j.1 j.2 : ℝ) = + DegreeRankLieFiltration.realFourCoordinateEquiv (1 ⊗ₜ[ℚ] v a) j + simpa only [one_mul] using (realFourCoordinateEquiv_tmul (1 : ℝ) (v a) j).symm + · rintro ⟨a, rfl⟩ + refine ⟨v a, ⟨a, rfl⟩, ?_⟩ + funext j + change DegreeRankLieFiltration.realFourCoordinateEquiv (1 ⊗ₜ[ℚ] v a) j = + (v a j.1 j.2 : ℝ) + simpa only [one_mul] using realFourCoordinateEquiv_tmul (1 : ℝ) (v a) j + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped Matrix TensorProduct NNReal + +variable {L ι μ ν : Type*} [LieRing L] [LieAlgebra ℚ L] + {E V : Submodule ℚ L} + +noncomputable def realQuotientCoordinateMap (f : Basis ι ℚ (L ⧸ V)) : + (ℝ ⊗[ℚ] L) →ₗ[ℝ] (ι → ℝ) := + LinearMap.pi (fun i => ((f.baseChange ℝ).coord i).comp (V.mkQ.baseChange ℝ)) + +@[simp] theorem realQuotientCoordinateMap_apply (f : Basis ι ℚ (L ⧸ V)) + (x : ℝ ⊗[ℚ] L) (i : ι) : + realQuotientCoordinateMap f x i = (f.baseChange ℝ).repr (V.mkQ.baseChange ℝ x) i := rfl + +theorem realQuotientCoordinateMap_tmul_one (f : Basis ι ℚ (L ⧸ V)) (x : L) (i : ι) : + realQuotientCoordinateMap f ((1 : ℝ) ⊗ₜ[ℚ] x) i = (f.repr (V.mkQ x) i : ℝ) := by + rw [realQuotientCoordinateMap_apply, LinearMap.baseChange_tmul, Basis.baseChange_repr_tmul] + simp [Algebra.smul_def] + +theorem realQuotientCoordinateMap_eq_zero_iff (f : Basis ι ℚ (L ⧸ V)) (x : ℝ ⊗[ℚ] L) : + realQuotientCoordinateMap f x = 0 ↔ x ∈ V.baseChange ℝ := by + rw [← realification_mkQ_eq_zero_iff] + constructor + · intro h + apply (f.baseChange ℝ).repr.injective + ext i + simpa only [realQuotientCoordinateMap_apply, map_zero, Finsupp.zero_apply, Pi.zero_apply] + using congrFun h i + · intro h + funext i + simp only [realQuotientCoordinateMap_apply, h, map_zero, Finsupp.zero_apply, Pi.zero_apply] + +noncomputable def subspaceQuotientMatrix (e : Basis ν ℚ E) (f : Basis ι ℚ (L ⧸ V)) : + Matrix ι ν ℚ := fun i n => f.repr (V.mkQ (e n : L)) i + +theorem subspaceQuotientMatrix_real_apply [Fintype ν] + (e : Basis ν ℚ E) (f : Basis ι ℚ (L ⧸ V)) (x : ν → ℝ) : + (fun i n => (subspaceQuotientMatrix e f i n : ℝ)) *ᵥ x = + realQuotientCoordinateMap f (bracketSystemLift e x) := by + classical + have h : Matrix.mulVecLin (fun i n => (subspaceQuotientMatrix e f i n : ℝ)) = + (realQuotientCoordinateMap f).comp (bracketSystemLift e) := by + apply (Pi.basisFun ℝ ν).ext + intro n + change Matrix.of (fun i t => (subspaceQuotientMatrix e f i t : ℝ)) *ᵥ Pi.single n 1 = + realQuotientCoordinateMap f (bracketSystemLift e (Pi.single n 1)) + rw [Matrix.mulVec_single_one, bracketSystemLift_single] + funext i + exact (realQuotientCoordinateMap_tmul_one f (e n : L) i).symm + exact DFunLike.congr_fun h x + +theorem exists_subspace_basis_coordinates [Fintype ν] (e : Basis ν ℚ E) + (x : ℝ ⊗[ℚ] L) (hx : x ∈ E.baseChange ℝ) : + ∃ v : ν → ℝ, bracketSystemLift e v = x := by + obtain ⟨y, rfl⟩ := hx + refine ⟨(e.baseChange ℝ).equivFun y, ?_⟩ + simp only [bracketSystemLift, LinearMap.comp_apply, LinearEquiv.coe_coe, + LinearEquiv.symm_apply_apply] + +theorem subspaceQuotientMatrix_height [Fintype μ] (b : Basis μ ℚ L) + (e : Basis ν ℚ E) (f : Basis ι ℚ (L ⧸ V)) {H J : ℕ} + (hq : ∀ i n, RationalHeightLE (f.repr (V.mkQ (b i)) n) H) + (he : ∀ n i, RationalHeightLE (b.repr (e n : L) i) J) (i : ι) (n : ν) : + RationalHeightLE (subspaceQuotientMatrix e f i n) + ((Fintype.card μ + 1) * (J * H) ^ Fintype.card μ) := + linearMap_coordinate_height b f V.mkQ hq (e n : L) (he n) i + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct + +variable {ι κ : Type*} [Fintype ι] + +theorem realRationalCoordinateSpan_span (v : κ → ι → ℚ) : + realRationalCoordinateSpan (Submodule.span ℚ (Set.range v)) = + Submodule.span ℝ (Set.range (fun a i => (v a i : ℝ))) := by + unfold realRationalCoordinateSpan + rw [Submodule.baseChange_span, Submodule.map_span, Set.image_image] + apply congrArg (Submodule.span ℝ) + ext x + constructor + · rintro ⟨y, ⟨a, rfl⟩, rfl⟩ + refine ⟨a, ?_⟩ + funext i + change (v a i : ℝ) = realRationalCoordinateEquiv (1 ⊗ₜ[ℚ] v a) i + simpa only [one_mul] using (realRationalCoordinateEquiv_tmul (1 : ℝ) (v a) i).symm + · rintro ⟨a, rfl⟩ + refine ⟨v a, ⟨a, rfl⟩, ?_⟩ + funext i + change realRationalCoordinateEquiv (1 ⊗ₜ[ℚ] v a) i = (v a i : ℝ) + simpa only [one_mul] using realRationalCoordinateEquiv_tmul (1 : ℝ) (v a) i + +theorem realRationalCoordinateSpan_eq_image [Fintype κ] + (U : Submodule ℚ (ι → ℚ)) (v : κ → ι → ℚ) + (hv : Submodule.span ℚ (Set.range v) = U) : + realRationalCoordinateSpan U = + LinearMap.range (Matrix.mulVecLin (fun i a => (v a i : ℝ))) := by + rw [← hv, realRationalCoordinateSpan_span] + ext x + exact real_column_span_mem_iff (fun i a => v a i) x + +end Erdos3 + +end + +section + +namespace Erdos3.DegreeRankLieFiltration + +open Module +open scoped TensorProduct + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (d : ℕ) (f : Basis ι ℚ (L ⧸ F.layer d 2)) + +noncomputable def realHigherHorizontalCoordinates : (ℝ ⊗[ℚ] F.HigherHorizontal d) →ₗ[ℝ] (ι → ℝ) := + realRationalCoordinateEquiv.toLinearMap.comp ((F.higherHorizontalCoordinates d f).baseChange ℝ) + +theorem realHigherHorizontalCoordinates_component (x : ℝ ⊗[ℚ] F.HigherHorizontal d) (i : ι) : + F.realHigherHorizontalCoordinates d f x i = + (f.baseChange ℝ).repr ((F.higherHorizontalAmbient d).baseChange ℝ x) i := by + induction x using TensorProduct.inductionOn with + | tmul a x => + change ((Pi.basisFun ℚ ι).baseChange ℝ).repr + (a ⊗ₜ[ℚ] F.higherHorizontalCoordinates d f x) i = + (f.baseChange ℝ).repr (a ⊗ₜ[ℚ] F.higherHorizontalAmbient d x) i + rw [Basis.baseChange_repr_tmul, Basis.baseChange_repr_tmul] + rfl + | add x y hx hy => simp only [map_add, Pi.add_apply, Finsupp.add_apply, hx, hy] + +theorem realHigherHorizontalCoordinates_injective : + Function.Injective (F.realHigherHorizontalCoordinates d f) := by + let : Module.Free ℚ ℝ := Module.Free.of_divisionRing ℚ ℝ + exact realRationalCoordinateEquiv.injective.comp + (Module.Flat.lTensor_preserves_injective_linearMap (M := ℝ) + (F.higherHorizontalCoordinates d f) (F.higherHorizontalCoordinates_injective d f)) + +theorem realHigherHorizontalCoordinates_image (U : Submodule ℚ (F.HigherHorizontal d)) : + (U.baseChange ℝ).map (F.realHigherHorizontalCoordinates d f) = + realRationalCoordinateSpan (U.map (F.higherHorizontalCoordinates d f)) := by + unfold realRationalCoordinateSpan + rw [realification_map] + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨(F.higherHorizontalCoordinates d f).baseChange ℝ x, ⟨x, hx, rfl⟩, rfl⟩ + · rintro ⟨z, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨x, hx, rfl⟩ + +end Erdos3.DegreeRankLieFiltration + +end + +section + +namespace Erdos3 + +open Module +open scoped Matrix TensorProduct NNReal + +variable {L ι μ : Type*} [LieRing L] [LieAlgebra ℚ L] + [Fintype ι] [Fintype μ] {V : Submodule ℚ L} + +noncomputable def quotientCoordinateMatrix (b : Basis μ ℚ L) (f : Basis ι ℚ (L ⧸ V)) : + Matrix ι μ ℚ := fun i j => f.repr (V.mkQ (b j)) i + +omit [Fintype ι] in +theorem realQuotientCoordinateMap_eq_matrix (b : Basis μ ℚ L) (f : Basis ι ℚ (L ⧸ V)) + (x : ℝ ⊗[ℚ] L) : + realQuotientCoordinateMap f x = + (fun i j => (quotientCoordinateMatrix b f i j : ℝ)) *ᵥ (b.baseChange ℝ).equivFun x := by + classical + have h : (realQuotientCoordinateMap f).comp + (b.baseChange ℝ).equivFun.symm.toLinearMap = + Matrix.mulVecLin (fun i j => (quotientCoordinateMatrix b f i j : ℝ)) := by + apply (Pi.basisFun ℝ μ).ext + intro j + change realQuotientCoordinateMap f ((b.baseChange ℝ).equivFun.symm (Pi.single j 1)) = + Matrix.of (fun i n => (quotientCoordinateMatrix b f i n : ℝ)) *ᵥ Pi.single j 1 + rw [Basis.equivFun_symm_single, Matrix.mulVec_single_one, Basis.baseChange_apply] + funext i + exact realQuotientCoordinateMap_tmul_one f (b j) i + have hx := DFunLike.congr_fun h ((b.baseChange ℝ).equivFun x) + simp only [LinearMap.comp_apply, LinearEquiv.coe_coe, LinearEquiv.symm_apply_apply] at hx + exact hx.trans (Matrix.mulVecLin_apply _ _) + +theorem realQuotientCoordinateMap_norm_bound (b : Basis μ ℚ L) (f : Basis ι ℚ (L ⧸ V)) + {H : ℕ} (hf : ∀ i j, RationalHeightLE (f.repr (V.mkQ (b j)) i) H) + (x : ℝ ⊗[ℚ] L) : + ‖realQuotientCoordinateMap f x‖ ≤ + ((Fintype.card μ : ℝ) + 1) * (H + 1) * ‖(b.baseChange ℝ).equivFun x‖ := by + rw [realQuotientCoordinateMap_eq_matrix b f x] + exact norm_matrix_mulVec_le _ (H : ℝ≥0) (fun i j => (hf i j).abs_real_le) _ + +theorem realQuotientCoordinateMap_grid (b : Basis μ ℚ L) (f : Basis ι ℚ (L ⧸ V)) + (l : ℕ) (x : ℝ ⊗[ℚ] L) (hx : (b.baseChange ℝ).equivFun x ∈ realDenominatorGrid l) : + realQuotientCoordinateMap f x ∈ + realDenominatorGrid (matrixDenominator (quotientCoordinateMatrix b f) * l) := by + rw [realQuotientCoordinateMap_eq_matrix b f x] + exact real_matrix_denominator_grid (quotientCoordinateMatrix b f) l _ hx + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +theorem real_pi_projection_coordinates {μ L : Type*} [LieRing L] [LieAlgebra ℚ L] + (b : Basis μ ℚ L) (x : ℝ ⊗[ℚ] (Fin 4 → L)) (k : Fin 4) (i : μ) : + (b.baseChange ℝ).repr ((LinearMap.proj k).baseChange ℝ x) i = + ((Pi.basis (fun _ : Fin 4 => b)).baseChange ℝ).repr x ⟨k, i⟩ := + (realification_pi_basis_repr (fun _ : Fin 4 => b) x k i).symm + +namespace DegreeRankLieFiltration + +variable {ι μ L : Type*} [Fintype ι] [Fintype μ] [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (d : ℕ) (f : Basis ι ℚ (L ⧸ F.layer d 2)) + (b : Basis μ ℚ L) + +theorem realFourAmbientCoordinates_bound {H : ℕ} + (hf : ∀ i j, RationalHeightLE (f.repr ((F.layer d 2).mkQ (b j)) i) H) + (x : ℝ ⊗[ℚ] (Fin 4 → L)) {B : ℝ} (hB : 0 ≤ B) + (hx : ∀ j, |((Pi.basis (fun _ : Fin 4 => b)).baseChange ℝ).repr x j| ≤ B) + (k : Fin 4) (i : ι) : + |F.realFourAmbientCoordinates d f x ⟨k, i⟩| ≤ + ((Fintype.card μ : ℝ) + 1) * (H + 1) * B := by + let y := (LinearMap.proj k).baseChange ℝ x + have hy : ‖(b.baseChange ℝ).equivFun y‖ ≤ B := by + apply (pi_norm_le_iff_of_nonneg hB).mpr + intro j + rw [Real.norm_eq_abs] + change |(b.baseChange ℝ).repr ((LinearMap.proj k).baseChange ℝ x) j| ≤ B + rw [real_pi_projection_coordinates] + exact hx ⟨k, j⟩ + rw [F.realFourAmbientCoordinates_component] + calc + _ = ‖realQuotientCoordinateMap f y i‖ := (Real.norm_eq_abs _).symm + _ ≤ ‖realQuotientCoordinateMap f y‖ := norm_le_pi_norm _ i + _ ≤ ((Fintype.card μ : ℝ) + 1) * (H + 1) * ‖(b.baseChange ℝ).equivFun y‖ := + realQuotientCoordinateMap_norm_bound b f hf y + _ ≤ _ := mul_le_mul_of_nonneg_left hy (by positivity) + +theorem realFourAmbientCoordinates_grid (l : ℕ) (x : ℝ ⊗[ℚ] (Fin 4 → L)) + (hx : (fun j => ((Pi.basis (fun _ : Fin 4 => b)).baseChange ℝ).repr x j) ∈ realDenominatorGrid l) : + F.realFourAmbientCoordinates d f x ∈ + realDenominatorGrid (matrixDenominator (quotientCoordinateMatrix b f) * l) := by + obtain ⟨z, hz⟩ := hx + have hsource (k : Fin 4) : + (b.baseChange ℝ).equivFun ((LinearMap.proj k).baseChange ℝ x) ∈ realDenominatorGrid l := by + refine ⟨fun i => z ⟨k, i⟩, ?_⟩ + funext i + exact (congrFun hz ⟨k, i⟩).trans + (congrArg (fun y : ℝ => (l : ℝ) * y) (real_pi_projection_coordinates b x k i).symm) + choose a ha using fun k => realQuotientCoordinateMap_grid b f l + ((LinearMap.proj k).baseChange ℝ x) (hsource k) + refine ⟨fun j => a j.1 j.2, ?_⟩ + funext j + exact (congrFun (ha j.1) j.2).trans + (congrArg (fun y : ℝ => ((matrixDenominator (quotientCoordinateMatrix b f) * l : ℕ) : ℝ) * y) + (F.realFourAmbientCoordinates_component d f x j.1 j.2).symm) + +end DegreeRankLieFiltration + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/HorizontalSeparationTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/HorizontalSeparationTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..99e86e7c2af11299d02b904e906131cbcc6805b9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/HorizontalSeparationTransport.lean @@ -0,0 +1,52 @@ +import OAI.Combinatorics.Progressions.Linear.ControlledKernelSplitTransport + +namespace OAI + +section + +namespace Erdos3 + +theorem horizontal_parts_separation_equiv {H ι κ ν σ : Type*} + [AddCommGroup H] [Module ℝ H] [Fintype ι] [Fintype κ] [Fintype ν] + (e : H ≃ₗ[ℝ] (ι → ℝ)) (U K : Submodule ℝ H) + (A : Matrix ι κ ℚ) (B : Matrix ι ν ℚ) + (hAspan : Submodule.span ℝ (Set.range (A.map (Rat.castHom ℝ)).col) = U.map e.toLinearMap) + (hBspan : Submodule.span ℝ (Set.range (B.map (Rat.castHom ℝ)).col) = K.map e.toLinearMap) + {J l : ℕ} (hJ : 1 ≤ J) (hl : 0 < l) + (hA : ∀ i j, RationalHeightLE (A i j) J) (hB : ∀ i j, RationalHeightLE (B i j) J) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hcols : (Fintype.card (κ ⊕ ν) : ℝ) ≤ p) + (hJp : (J : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) (i : σ) + (y small rational : H) (k : K) (hsystem : y = small + rational + k.val) + (hy : y ∈ U) (hs : ‖e small‖ ≤ Real.exp p / T i) + (hr : e rational ∈ realDenominatorGrid l) : + small ∈ U ⊔ K ∧ rational ∈ U ⊔ K := by + classical + let M := Matrix.fromCols A B + have hM : ∀ i j, RationalHeightLE (M i j) J := by + intro i j + cases j with + | inl j => exact hA i j + | inr j => exact hB i j + have hspan : Submodule.span ℝ (Set.range (fun j i => (M i j : ℝ))) = + U.map e.toLinearMap ⊔ K.map e.toLinearMap := by + change Submodule.span ℝ (Set.range ((Matrix.fromCols A B).map (Rat.castHom ℝ)).col) = _ + rw [real_column_span_fromCols, hAspan, hBspan] + have heq : e y = e small + e rational + e k.val := by rw [hsystem, map_add, map_add] + have hs' : ‖e small‖ ≤ Real.exp p / monomialScale T (Finsupp.single i 1) := by + simpa [monomialScale] using hs + have hparts := horizontal_parts_separation (U.map e.toLinearMap) (K.map e.toLinearMap) + M hspan hJ hl hM hp hι hcols hJp hlp T hT + (show (Finsupp.single i 1 : σ →₀ ℕ) ≠ 0 by simp) (e y) (e small) (e rational) (e k.val) + heq ⟨y, hy, rfl⟩ ⟨k.val, k.property, rfl⟩ hs' hr + have hmem (x : H) (hx : e x ∈ U.map e.toLinearMap ⊔ K.map e.toLinearMap) : x ∈ U ⊔ K := by + rw [← Submodule.map_sup, Submodule.mem_map_equiv, LinearEquiv.symm_apply_apply] at hx + exact hx + exact ⟨hmem small hparts.1, hmem rational hparts.2⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/IdealSiteBoxRadius.lean b/lean/OAI/Combinatorics/Progressions/Geometry/IdealSiteBoxRadius.lean new file mode 100644 index 0000000000000000000000000000000000000000..49c4db1c3d8940786ba3c26ad64e25946bf106d3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/IdealSiteBoxRadius.lean @@ -0,0 +1,42 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalActiveIdealSite + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def idealSiteBoxRadius (α : Type*) [Fintype α] (degree : ℕ) : ℝ := + (2 : ℝ) ^ Fintype.card α * (partitionedIdealRadius α degree + 1) + +theorem idealSiteBoxRadius_pos (α : Type*) [Fintype α] (degree : ℕ) : + 0 < idealSiteBoxRadius α degree := by + have h := partitionedIdealRadius_nonneg α degree + unfold idealSiteBoxRadius + positivity + +theorem idealSiteBoxRadius_buffer_le_exp (α : Type*) [Fintype α] (degree : ℕ) : + 2 * idealSiteBoxRadius α degree ≤ + Real.exp (((degree : ℝ) + 2) * Fintype.card α + 3) := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hp : (2 : ℝ) ^ Fintype.card α ≤ Real.exp (Fintype.card α : ℝ) := by + calc + _ ≤ (Real.exp 1) ^ Fintype.card α := pow_le_pow_left₀ (by norm_num) htwo _ + _ = _ := by rw [← Real.exp_nat_mul]; simp only [mul_one] + unfold idealSiteBoxRadius + calc + _ ≤ Real.exp 1 * (Real.exp (Fintype.card α : ℝ) * + Real.exp (((degree : ℝ) + 1) * Fintype.card α + 2)) := by + have hr0 : 0 ≤ partitionedIdealRadius α degree + 1 := by + have h := partitionedIdealRadius_nonneg α degree + linarith + exact mul_le_mul htwo + (mul_le_mul hp (partitionedIdealRadius_add_one_le_exp α degree) hr0 (Real.exp_pos _).le) + (mul_nonneg (by positivity) hr0) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ImageCoordinateDerivative.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ImageCoordinateDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..720ba956f2c21e522394fc68d8c20c1bed1d290d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ImageCoordinateDerivative.lean @@ -0,0 +1,65 @@ +import OAI.Combinatorics.Progressions.Estimates.WeightedImageDerivative + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ContDiff NNReal BigOperators + +variable {Ω ι : Type*} [MeasurableSpace Ω] [Fintype ι] + +theorem smooth_image_derivative_integrable (μ : Measure Ω) [IsFiniteMeasure μ] + (U : Ω → (ι → ℝ)) (hU : Measurable U) + (φ : (ι → ℝ) → ℝ) (hφ : ContDiff ℝ ∞ φ) (hs : HasCompactSupport φ) (z : ι → ℝ) : + Integrable (fun a => fderiv ℝ φ (U a) z) μ := by + have hc := hφ.continuous_fderiv (by simp) + obtain ⟨K, hK⟩ := (hs.fderiv ℝ).exists_bound_of_continuous hc + apply (integrable_const (K * ‖z‖)).mono' + (((hc.clm_apply continuous_const).measurable.comp hU).aestronglyMeasurable) + filter_upwards [] with a + exact ((fderiv ℝ φ (U a)).le_opNorm z).trans + (mul_le_mul_of_nonneg_right (hK _) (norm_nonneg _)) + +theorem imageTranslationBound_of_coordinate_derivatives [DecidableEq ι] + (μ : Measure Ω) [IsFiniteMeasure μ] + (U : Ω → (ι → ℝ)) (hU : Measurable U) (B : ι → ℝ≥0) + (hweak : ∀ (φ : (ι → ℝ) → ℝ), ContDiff ℝ ∞ φ → HasCompactSupport φ → + (∀ x, ‖φ x‖ ≤ 1) → ∀ i, + |∫ a, fderiv ℝ φ (U a) (Pi.single i 1) ∂μ| ≤ B i) : + ImageTranslationBound μ U (∑ i, B i) := by + apply imageTranslationBound_of_smooth_derivative μ U hU + intro φ hc hs hb z + have hi (i : ι) := smooth_image_derivative_integrable μ U hU φ hc hs (Pi.single i 1) + have heq : (∫ a, fderiv ℝ φ (U a) z ∂μ) = + ∑ i, z i * ∫ a, fderiv ℝ φ (U a) (Pi.single i 1) ∂μ := by + calc + (∫ a, fderiv ℝ φ (U a) z ∂μ) = + ∫ a, ∑ i, z i * fderiv ℝ φ (U a) (Pi.single i 1) ∂μ := by + apply integral_congr_ae + filter_upwards [] with a + exact continuousLinearMap_coordinate_sum _ _ + _ = ∑ i, z i * ∫ a, fderiv ℝ φ (U a) (Pi.single i 1) ∂μ := by + rw [integral_finsetSum _ (fun i _ => (hi i).const_mul (z i))] + simp only [integral_const_mul] + rw [heq, ← Real.norm_eq_abs] + apply (norm_sum_le _ _).trans + rw [NNReal.coe_sum, Finset.sum_mul, dist_eq_norm, sub_zero] + apply Finset.sum_le_sum + intro i _ + rw [norm_mul] + have hbi : ‖∫ a, fderiv ℝ φ (U a) (Pi.single i 1) ∂μ‖ ≤ (B i : ℝ) := hweak φ hc hs hb i + calc + ‖z i‖ * ‖∫ a, fderiv ℝ φ (U a) (Pi.single i 1) ∂μ‖ ≤ ‖z i‖ * (B i : ℝ) := + mul_le_mul_of_nonneg_left hbi (norm_nonneg _) + _ ≤ (B i : ℝ) * ‖z‖ := by + rw [mul_comm] + exact mul_le_mul_of_nonneg_left (norm_le_pi_norm z i) (B i).coe_nonneg + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/IndependentProductTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/IndependentProductTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..8278c169aa2c49079ccb168f5566e54e728c52c1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/IndependentProductTransport.lean @@ -0,0 +1,103 @@ +import OAI.Combinatorics.Progressions.Estimates.ProductPMFMap +import OAI.Combinatorics.Progressions.Estimates.RealWeightPMF + +namespace OAI + +section + +namespace Erdos3 + +theorem pmf_map_injective_at {X Y : Type*} (p : PMF X) (f : X → Y) + (hf : Function.Injective f) (x : X) : p.map f (f x) = p x := by + classical + rw [PMF.map_apply, tsum_eq_single x] + · simp + · intro y hy + have hne : f x ≠ f y := fun h => hy (hf h).symm + simp only [hne, ite_false] + +theorem pmf_map_zero_off_range {X Y : Type*} (p : PMF X) (f : X → Y) (y : Y) + (hy : y ∉ Set.range f) : p.map f y = 0 := by + classical + have hne (x) : y ≠ f x := fun h => hy ⟨x, h.symm⟩ + simp only [PMF.map_apply, hne, ite_false, tsum_zero] + +theorem pmf_map_injective_expectation {X Y : Type*} (p : PMF X) (f : X → Y) + (hf : Function.Injective f) (φ : Y → ℂ) : + (∑' y, ((p.map f y).toReal : ℂ) * φ y) = + ∑' x, ((p x).toReal : ℂ) * φ (f x) := by + have hs : Function.support (fun y => ((p.map f y).toReal : ℂ) * φ y) ⊆ Set.range f := by + intro y hy + by_contra hn + have hz := pmf_map_zero_off_range p f y hn + exact hy (by simp only [hz, ENNReal.toReal_zero, Complex.ofReal_zero, zero_mul]) + have he := hf.tsum_eq hs + simpa only [pmf_map_injective_at p f hf] using he.symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem independentProductPMF_map {D X Y : Type*} [Fintype D] + [Countable X] [MeasurableSpace X] [MeasurableSingletonClass X] + [Countable Y] [MeasurableSpace Y] [MeasurableSingletonClass Y] + (p : D → PMF X) (f : D → X → Y) : + (independentProductPMF p).map (fun x i => f i (x i)) = + independentProductPMF (fun i => (p i).map (f i)) := by + apply PMF.toMeasure_injective + rw [← PMF.toMeasure_map (fun (x : D → X) i => f i (x i)) _ (measurable_of_countable _)] + simp only [independentProductPMF, Measure.toPMF_toMeasure] + rw [Measure.pi_map_pi (fun i => (measurable_of_countable (f i)).aemeasurable)] + congr 1 + funext i + exact PMF.toMeasure_map (f i) (p i) (measurable_of_countable _) + +def independentArrayRows {J I X : Type*} (z : J × I → X) : I → J → X := + fun i j => z (j, i) + +theorem independentArrayRows_injective {J I X : Type*} : + Function.Injective (independentArrayRows (J := J) (I := I) (X := X)) := by + intro x y h + funext ji + exact congrFun (congrFun h ji.2) ji.1 + +theorem independentProductPMF_rows {J I X : Type*} [Fintype J] [Fintype I] + [Countable X] [MeasurableSpace X] [MeasurableSingletonClass X] + (p : J × I → PMF X) : + (independentProductPMF p).map independentArrayRows = + independentProductPMF (fun i => independentProductPMF (fun j => p (j, i))) := by + ext y + let z : J × I → X := fun ji => y ji.2 ji.1 + change (independentProductPMF p).map independentArrayRows (independentArrayRows z) = _ + rw [pmf_map_injective_at _ _ independentArrayRows_injective] + simp only [independentProductPMF_apply, Fintype.prod_prod_type, z] + exact Finset.prod_comm + +theorem independentProductPMF_reindex {D E X : Type*} [Fintype D] [Fintype E] + [Countable X] [MeasurableSpace X] [MeasurableSingletonClass X] + (e : D ≃ E) (p : E → PMF X) : + (independentProductPMF p).map (fun x d => x (e d)) = + independentProductPMF (fun d => p (e d)) := by + have hinj : Function.Injective (fun (x : E → X) d => x (e d)) := by + intro x y h + funext a + simpa using congrFun h (e.symm a) + ext y + let z : E → X := fun a => y (e.symm a) + have hz : (fun d => z (e d)) = y := by funext d; simp [z] + rw [← hz, pmf_map_injective_at _ _ hinj] + simp only [independentProductPMF_apply] + exact (e.prod_comp (fun a => p a (z a))).symm + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/IndexedComparableScalarParameterBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/IndexedComparableScalarParameterBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..f374384c11f6cbdeda24368dfebc6950be6bfd80 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/IndexedComparableScalarParameterBox.lean @@ -0,0 +1,123 @@ +import OAI.Combinatorics.Progressions.Linear.CanonicalJointFrameGeometry + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel +open scoped BigOperators Classical + +noncomputable def comparableScalarParameterRadius (r L : ℝ) : ℕ := ⌈r * L⌉₊ + +theorem comparableScalarParameterRadius_bounds {r L : ℝ} (hr : 2 ≤ r) (hL : 1 ≤ L) : + 0 < comparableScalarParameterRadius r L ∧ + r * L ≤ (comparableScalarParameterRadius r L : ℝ) ∧ + (comparableScalarParameterRadius r L : ℝ) ≤ (r + 1) * L := by + have hceil : r * L ≤ (⌈r * L⌉₊ : ℝ) := Nat.le_ceil _ + have hupper := Nat.ceil_lt_add_one (show 0 ≤ r * L by positivity) + refine ⟨?_, hceil, ?_⟩ + · have : (0 : ℝ) < comparableScalarParameterRadius r L := + (by positivity : 0 < r * L).trans_le hceil + exact_mod_cast this + · change (⌈r * L⌉₊ : ℝ) ≤ (r + 1) * L + nlinarith + +theorem comparableScalarParameterSite_bounds {d : ℕ} (hd : 2 ≤ d) + {r L : ℝ} (_hr : 2 ≤ r) (_hL : 1 ≤ L) (P : Fin d → ℕ) + (hlo : ∀ j, L ≤ (P j : ℝ)) (hhi : ∀ j, (P j : ℝ) ≤ r * L) : + 0 ≤ (∑ j, (P j : ℝ)) ∧ L ≤ (∑ j, (P j : ℝ)) ∧ + (∑ j, (P j : ℝ)) ≤ r * (d : ℝ) * L := by + refine ⟨Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _), ?_, ?_⟩ + · let j : Fin d := ⟨0, by omega⟩ + exact (hlo j).trans (Finset.single_le_sum + (fun _ _ => Nat.cast_nonneg (α := ℝ) _) (Finset.mem_univ j)) + · have h := Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => hhi j) + simpa only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, + nsmul_eq_mul, mul_left_comm (d : ℝ) r L, mul_assoc] using h + +theorem comparableScalarParameterBox_bounds {d : ℕ} (hd : 2 ≤ d) + {r L : ℝ} (hr : 2 ≤ r) (hL : 1 ≤ L) (P : Fin d → ℕ) + (hlo : ∀ j, L ≤ (P j : ℝ)) (hhi : ∀ j, (P j : ℝ) ≤ r * L) : + (∀ j, (0 : ℤ) < (P j : ℤ)) ∧ + 0 < L ∧ + (∀ j, L ≤ (((P j : ℤ) - 0 : ℤ) : ℝ)) ∧ + (∀ j, (P j : ℤ) - 0 ≤ (comparableScalarParameterRadius r L : ℤ)) ∧ + (comparableScalarParameterRadius r L : ℝ) ≤ (r + 1) * L ∧ + 1 * L ≤ L ∧ + |(0 : ℝ) / L| ≤ r ∧ + (∀ j, |(((P j : ℤ) : ℝ)) / L| ≤ r) ∧ + 0 ≤ (∑ j, (P j : ℝ)) ∧ L ≤ (∑ j, (P j : ℝ)) ∧ + (∑ j, (P j : ℝ)) ≤ r * (d : ℝ) * L := by + have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL + have hrad := comparableScalarParameterRadius_bounds hr hL + refine ⟨?_, hLp, ?_, ?_, hrad.2.2, by simp, by simpa using (by linarith : (0 : ℝ) ≤ r), ?_, + comparableScalarParameterSite_bounds hd hr hL P hlo hhi⟩ + · intro j + exact_mod_cast hLp.trans_le (hlo j) + · simpa only [sub_zero, Int.cast_natCast] using hlo + · intro j + have h := (hhi j).trans hrad.2.1 + rw [sub_zero] + exact_mod_cast h + · intro j + rw [Int.cast_natCast, abs_div, abs_of_nonneg (Nat.cast_nonneg _), abs_of_pos hLp] + exact (div_le_iff₀ hLp).mpr (hhi j) + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel +open scoped BigOperators Classical + +theorem indexedComparableScalarParameterSite_bounds {d : ℕ} (hd : 2 ≤ d) + {K : Type*} [Fintype K] (hK : Fintype.card K = d) + {r L : ℝ} (_hr : 2 ≤ r) (_hL : 1 ≤ L) (P : K → ℕ) + (hlo : ∀ j, L ≤ (P j : ℝ)) (hhi : ∀ j, (P j : ℝ) ≤ r * L) : + 0 ≤ (∑ j, (P j : ℝ)) ∧ L ≤ (∑ j, (P j : ℝ)) ∧ + (∑ j, (P j : ℝ)) ≤ r * (d : ℝ) * L := by + refine ⟨Finset.sum_nonneg (fun _ _ => Nat.cast_nonneg _), ?_, ?_⟩ + · have hnonempty : Nonempty K := Fintype.card_pos_iff.mp (by omega) + let j : K := Classical.choice hnonempty + exact (hlo j).trans (Finset.single_le_sum + (fun _ _ => Nat.cast_nonneg (α := ℝ) _) (Finset.mem_univ j)) + · have h := Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => hhi j) + simpa only [Finset.sum_const, Finset.card_univ, hK, + nsmul_eq_mul, mul_left_comm (d : ℝ) r L, mul_assoc] using h + +theorem indexedComparableScalarParameterBox_bounds {d : ℕ} (hd : 2 ≤ d) + {K : Type*} [Fintype K] (hK : Fintype.card K = d) + {r L : ℝ} (hr : 2 ≤ r) (hL : 1 ≤ L) (P : K → ℕ) + (hlo : ∀ j, L ≤ (P j : ℝ)) (hhi : ∀ j, (P j : ℝ) ≤ r * L) : + (∀ j, (0 : ℤ) < (P j : ℤ)) ∧ + 0 < L ∧ + (∀ j, L ≤ (((P j : ℤ) - 0 : ℤ) : ℝ)) ∧ + (∀ j, (P j : ℤ) - 0 ≤ (comparableScalarParameterRadius r L : ℤ)) ∧ + (comparableScalarParameterRadius r L : ℝ) ≤ (r + 1) * L ∧ + 1 * L ≤ L ∧ + |(0 : ℝ) / L| ≤ r ∧ + (∀ j, |(((P j : ℤ) : ℝ)) / L| ≤ r) ∧ + 0 ≤ (∑ j, (P j : ℝ)) ∧ L ≤ (∑ j, (P j : ℝ)) ∧ + (∑ j, (P j : ℝ)) ≤ r * (d : ℝ) * L := by + have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL + have hrad := comparableScalarParameterRadius_bounds hr hL + refine ⟨?_, hLp, ?_, ?_, hrad.2.2, by simp, by simpa using (by linarith : (0 : ℝ) ≤ r), ?_, + indexedComparableScalarParameterSite_bounds hd hK hr hL P hlo hhi⟩ + · intro j + exact_mod_cast hLp.trans_le (hlo j) + · simpa only [sub_zero, Int.cast_natCast] using hlo + · intro j + have h := (hhi j).trans hrad.2.1 + rw [sub_zero] + exact_mod_cast h + · intro j + rw [Int.cast_natCast, abs_div, abs_of_nonneg (Nat.cast_nonneg _), abs_of_pos hLp] + exact (div_le_iff₀ hLp).mpr (hhi j) + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/InhomogeneousFullChartLift.lean b/lean/OAI/Combinatorics/Progressions/Geometry/InhomogeneousFullChartLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..842551d4c6f151946c30a5b666fe74ed1cdab617 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/InhomogeneousFullChartLift.lean @@ -0,0 +1,344 @@ +import OAI.Combinatorics.Progressions.Polynomial.FullChartPolynomialLiftControl + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +variable {σ τ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +noncomputable def gradedPolynomialProjection (w : σ → ℕ) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) : + VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded) := + F.realGradedSymbolPolynomial b ω hF w (F.realSymbolOfGradedPolynomial b ω hF w P) + +attribute [local irreducible] realChartSubstitute realGradedSymbolPolynomial + realSymbolOfGradedPolynomial realSymbolHomogeneousPullback gradedPolynomialProjection + +theorem coefficients_gradedPolynomialProjection (w : σ → ℕ) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) (α : σ →₀ ℕ) : + coefficients (F.gradedPolynomialProjection b ω hF w P) α = + basisGradeProjection ((F.associatedGradedBasis b ω hF).baseChange ℝ) ω + (Finsupp.weight w α) (coefficients P α) := by + apply ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr.injective + ext i + rw [basisGradeProjection_repr, gradedPolynomialProjection] + by_cases hi : Finsupp.weight w α = ω i + · rw [ite_eq_left hi.symm, + F.realGradedSymbolPolynomial_coordinate b ω hF w _ ⟨(α, i), hi⟩, + F.realSymbolOfGradedPolynomial_coordinate] + · rw [ite_eq_right (Ne.symm hi), + F.realGradedSymbolPolynomial_coordinate_of_ne b ω hF w _ α i hi] + +theorem gradedPolynomialProjection_mem (w : σ → ℕ) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) : + F.gradedPolynomialProjection b ω hF w P ∈ + gradedPolynomialSubmodule ((F.associatedGradedBasis b ω hF).baseChange ℝ) ω w := by + rw [gradedPolynomialProjection] + exact F.realGradedSymbolPolynomial_mem_gradedPolynomialSubmodule b ω hF w _ + +theorem gradedPolynomialProjection_eq_self (w : σ → ℕ) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) + (hP : P ∈ gradedPolynomialSubmodule + ((F.associatedGradedBasis b ω hF).baseChange ℝ) ω w) : + F.gradedPolynomialProjection b ω hF w P = P := by + rw [gradedPolynomialProjection] + exact F.realGradedSymbolPolynomial_ofGradedPolynomial b ω hF w P hP + +theorem gradedPolynomialProjection_degreeLE (w u : σ → ℕ) (d : ℕ) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) + (hP : DegreeLE u d P) : + DegreeLE u d (F.gradedPolynomialProjection b ω hF w P) := by + intro α hα + rw [F.coefficients_gradedPolynomialProjection, hP α hα, map_zero] + +theorem gradedPolynomialProjection_coefficientBound (w : σ → ℕ) + (T : σ → ℝ) (hT : ∀ i, 0 < T i) {M : ℝ} (hM : 0 ≤ M) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) + (hP : CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) T M P) : + CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) T M + (F.gradedPolynomialProjection b ω hF w P) := by + intro α i + rw [F.coefficients_gradedPolynomialProjection, basisGradeProjection_repr] + split_ifs + · exact hP α i + · rw [abs_zero] + exact div_nonneg hM (monomialScale_pos T hT α).le + +theorem realSymbolOfGradedPolynomial_homogeneousChart + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) : + F.realSymbolOfGradedPolynomial b ω hF v (realChartSubstitute β p) = + F.realSymbolHomogeneousPullback b ω hF w v β + (F.realSymbolOfGradedPolynomial b ω hF w p) := by + classical + apply ((F.polynomialSymbolBasis b ω hF v).baseChange ℝ).repr.injective + ext z + rw [F.realSymbolOfGradedPolynomial_coordinate, realSymbolHomogeneousPullback, + F.realSymbolOfGradedPolynomial_coordinate] + rw [coefficients_realChartSubstitute, coefficients_realChartSubstitute] + simp only [map_sum, Finsupp.finsetSum_apply, map_smul, Finsupp.smul_apply, smul_eq_mul] + apply Finset.sum_congr_of_eq_on_inter + · intro γ hγ hγ' + have hz : coefficients (F.realGradedSymbolPolynomial b ω hF w + (F.realSymbolOfGradedPolynomial b ω hF w p)) γ = 0 := Finsupp.notMem_support_iff.mp hγ' + by_cases h : Finsupp.weight w γ = ω z.val.2 + · have he := F.realGradedSymbolPolynomial_coordinate b ω hF w + (F.realSymbolOfGradedPolynomial b ω hF w p) ⟨(γ, z.val.2), h⟩ + rw [hz, map_zero, Finsupp.zero_apply, F.realSymbolOfGradedPolynomial_coordinate] at he + rw [← he, mul_zero] + · rw [(isWeightedHomogeneous_aeval_monomial w v β hβ γ (1 : ℝ)).coeff_eq_zero _ + (fun he => h (he.symm.trans z.property)), zero_mul] + · intro γ hγ hγ' + have hz : coefficients p γ = 0 := Finsupp.notMem_support_iff.mp hγ' + by_cases h : Finsupp.weight w γ = ω z.val.2 + · rw [F.realGradedSymbolPolynomial_coordinate b ω hF w _ ⟨(γ, z.val.2), h⟩, + F.realSymbolOfGradedPolynomial_coordinate, hz, map_zero, Finsupp.zero_apply, mul_zero] + · rw [F.realGradedSymbolPolynomial_coordinate_of_ne b ω hF w _ γ z.val.2 h, mul_zero] + · intro γ hγ hγ' + have hz := z.property + by_cases h : Finsupp.weight w γ = ω z.val.2 + · rw [F.realGradedSymbolPolynomial_coordinate b ω hF w _ ⟨(γ, z.val.2), h⟩, + F.realSymbolOfGradedPolynomial_coordinate] + · have ha : Finsupp.weight v z.val.1 ≠ Finsupp.weight w γ := + fun he => h (he.symm.trans hz) + rw [(isWeightedHomogeneous_aeval_monomial w v β hβ γ (1 : ℝ)).coeff_eq_zero _ ha] + simp only [zero_mul] + +theorem gradedPolynomialProjection_realChartSubstitute + (w : σ → ℕ) (v : τ → ℕ) (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) : + F.gradedPolynomialProjection b ω hF v (realChartSubstitute β P) = + realChartSubstitute β (F.gradedPolynomialProjection b ω hF w P) := by + rw [gradedPolynomialProjection, gradedPolynomialProjection, + F.realSymbolOfGradedPolynomial_homogeneousChart b ω hF w v β hβ] + exact F.realGradedSymbolPolynomial_homogeneousPullback b ω hF w v β hβ _ + +theorem FullChartControlledFactors.exists_graded_degree_bounded_chart + {m : ℕ} {X L ι : Type} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + {budget : ℝ} (h : FullChartControlledFactors F b ω hF J poly N left right budget) : + ∃ q : ℕ, 0 < q ∧ (q : ℝ) ≤ Real.exp budget ∧ + ∃ Echart : PolynomialGroup (X ⊕ (Σ j, J j)) + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot, + F.realGradedSymbolPolynomialHom b ω hF (fullTaggedVariableWeight (X := X) J) left = + realPolynomialChartSubstitution + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly)) Echart ∧ + CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) (fun _ => 1) + (Real.exp budget) Echart.coord ∧ + Echart.coord ∈ gradedPolynomialSubmodule + ((F.associatedGradedBasis b ω hF).baseChange ℝ) ω + (fullTaggedVariableWeight (X := X) J) ∧ + DegreeLE (fullTaggedVariableWeight (X := X) J) s Echart.coord ∧ + DegreeLE (fun _ => 1) s Echart.coord ∧ + CoefficientGrid ((F.associatedGradedBasis b ω hF).baseChange ℝ) q + (F.realGradedSymbolPolynomialHom b ω hF + (fullTaggedVariableWeight (X := X) J) right).coord := by + obtain ⟨q, hq, hqB, E, hchart, hbound, hweighted, hdegree, hgrid⟩ := + FullChartControlledFactors.exists_degree_bounded_chart F b ω hF J poly N left right h + let w := fullTaggedVariableWeight (X := X) J + let E' : PolynomialGroup (X ⊕ (Σ j, J j)) + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot := + ⟨F.gradedPolynomialProjection b ω hF w E.coord⟩ + refine ⟨q, hq, hqB, E', ?_, ?_, F.gradedPolynomialProjection_mem b ω hF w E.coord, + F.gradedPolynomialProjection_degreeLE b ω hF w w s E.coord hweighted, + F.gradedPolynomialProjection_degreeLE b ω hF w (fun _ => 1) s E.coord hdegree, hgrid⟩ + · apply NilpotentLieBCHGroup.ext + have he := congrArg NilpotentLieBCHGroup.coord hchart + rw [realPolynomialChartSubstitution_coord] at he + change F.realGradedSymbolPolynomial b ω hF w left.coord = + realChartSubstitute + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly)) + (F.gradedPolynomialProjection b ω hF w E.coord) + have hgraded := F.realGradedSymbolPolynomial_mem_gradedPolynomialSubmodule + b ω hF w left.coord + rw [← F.gradedPolynomialProjection_realChartSubstitute b ω hF w w _ + (fullTaggedMajorChart_homogeneous J poly (fun i => (N i : ℝ))) E.coord, + ← he] + exact (F.gradedPolynomialProjection_eq_self b ω hF w _ hgraded).symm + · exact F.gradedPolynomialProjection_coefficientBound b ω hF w _ + (fun _ => zero_lt_one) (Real.exp_pos budget).le E.coord hbound + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup RationalFilteredNilmanifold +open scoped TensorProduct + +variable {σ τ : Type*} {ι L : Type} [Fintype σ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +attribute [local irreducible] realChartSubstitute realSymbolOfGradedPolynomial + realGradedSymbolPolynomial realSymbolHomogeneousPullback + +omit [Fintype σ] in + +theorem exists_inhomogeneous_chart_lift_algebraic + (w : σ → ℕ) (v : τ → ℕ) (E : F.RealPolynomialSymbolGroup w) + (f : σ → MvPolynomial σ ℝ) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) + (hgraded : P ∈ gradedPolynomialSubmodule + ((F.associatedGradedBasis b ω hF).baseChange ℝ) ω w) + (hchart : (F.realGradedSymbolPolynomialHom b ω hF w E).coord = + realChartSubstitute f P) + (β δ : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (hδ : ∀ i, δ i ∈ weightedSupportLE v (w i)) + (htop : ∀ i, MvPolynomial.weightedHomogeneousComponent v (w i) (δ i) = + MvPolynomial.aeval β (f i)) : + ∃ e : (F.realification.adaptedPolynomialFiltration v).Group, + e.coord.val = realChartSubstitute δ (VectorPolynomial.map + (((F.gradedBasisSplitting b ω hF).toLinearMap.baseChange ℝ).restrictScalars ℚ) P) ∧ + F.realPolynomialSymbolHom b ω hF v e = + F.realSymbolHomogeneousPullbackHom b ω hF w v β hβ E := by + let Y : F.RealPolynomialSymbolGroup w := ⟨F.realSymbolOfGradedPolynomial b ω hF w P⟩ + have hY : F.realGradedSymbolPolynomial b ω hF w Y.coord = P := + F.realGradedSymbolPolynomial_ofGradedPolynomial b ω hF w P hgraded + let S := (F.gradedBasisSplitting b ω hF).toLinearMap.baseChange ℝ + have hlog : (F.realPolynomialSymbolLift b ω hF w Y).coord.val = + VectorPolynomial.map (S.restrictScalars ℚ) P := by + rw [F.realPolynomialSymbolLift_log, F.realSymbolRepresentative_eq_map, hY] + let e := F.weightedAdaptedRealChartHom w v δ hδ + (F.realPolynomialSymbolLift b ω hF w Y) + have he : e.coord.val = realChartSubstitute δ + (VectorPolynomial.map (S.restrictScalars ℚ) P) := by + change realChartSubstitute δ (F.realPolynomialSymbolLift b ω hF w Y).coord.val = _ + rw [hlog] + refine ⟨e, he, ?_⟩ + rw [F.realPolynomialSymbolHom_weightedAdaptedRealChart, + F.realPolynomialSymbolHom_lift] + apply F.realGradedSymbolPolynomialHom_injective b ω hF v + apply NilpotentLieBCHGroup.ext + change F.realGradedSymbolPolynomial b ω hF v + (F.realSymbolHomogeneousPullback b ω hF w v _ Y.coord) = + F.realGradedSymbolPolynomial b ω hF v + (F.realSymbolHomogeneousPullback b ω hF w v β E.coord) + rw [F.realGradedSymbolPolynomial_homogeneousPullback b ω hF w v _ + (fun _ => MvPolynomial.weightedHomogeneousComponent_isWeightedHomogeneous _ _), + F.realGradedSymbolPolynomial_homogeneousPullback b ω hF w v β hβ, hY] + change realChartSubstitute _ P = + realChartSubstitute β (F.realGradedSymbolPolynomialHom b ω hF w E).coord + rw [hchart, realChartSubstitute_comp] + exact congrArg (fun z => realChartSubstitute z P) (funext htop) + +theorem polynomialSlowBound_inhomogeneous_chart_lift + {υ : Type*} (v : τ → ℕ) (u : υ → ℕ) + (e : (F.realification.adaptedPolynomialFiltration v).Group) + (δ : σ → MvPolynomial τ ℝ) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) + (he : e.coord.val = realChartSubstitute δ (VectorPolynomial.map + (((F.gradedBasisSplitting b ω hF).toLinearMap.baseChange ℝ).restrictScalars ℚ) P)) + (γ : τ → MvPolynomial υ ℝ) (hγ : ∀ i, γ i ∈ weightedSupportLE u (v i)) + (T : υ → ℝ) (hT : ∀ i, 0 < T i) {A B : ℝ} {d : ℕ} + (hbound : CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) + (fun _ => 1) A P) (hA : 0 ≤ A) (hB : 1 ≤ B) + (hdegree : DegreeLE (fun _ : σ => 1) d P) + (hmass : ∀ i, realPolynomialMass + (scaleMvPolynomialAxes T (MvPolynomial.aeval γ (δ i))) ≤ B) : + F.PolynomialSlowBound b u T + (((Fintype.card σ : ℝ) + 1) ^ d * A * B ^ d) + (F.weightedAdaptedRealChartHom v u γ hγ e) := by + change CoefficientBound (b.baseChange ℝ) T _ (realChartSubstitute γ e.coord.val) + rw [he, realChartSubstitute_comp] + exact CoefficientBound.realChartSubstitute_sharp (b.baseChange ℝ) T hT _ + ((F.coefficientBound_gradedBasisSplitting b ω hF _ _ P).mpr hbound) + hA hB (hdegree.map _) hmass + +theorem exists_inhomogeneous_chart_lift + (w : σ → ℕ) (v : τ → ℕ) (E : F.RealPolynomialSymbolGroup w) + (f : σ → MvPolynomial σ ℝ) + (P : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) + (hgraded : P ∈ gradedPolynomialSubmodule + ((F.associatedGradedBasis b ω hF).baseChange ℝ) ω w) + (hchart : (F.realGradedSymbolPolynomialHom b ω hF w E).coord = + realChartSubstitute f P) + (β δ : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v (w i)) + (hδ : ∀ i, δ i ∈ weightedSupportLE v (w i)) + (htop : ∀ i, MvPolynomial.weightedHomogeneousComponent v (w i) (δ i) = + MvPolynomial.aeval β (f i)) + (T : τ → ℝ) (hT : ∀ i, 0 < T i) {A B : ℝ} {d : ℕ} + (hbound : CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) + (fun _ => 1) A P) (hA : 0 ≤ A) (hB : 1 ≤ B) + (hdegree : DegreeLE (fun _ : σ => 1) d P) + (hmass : ∀ i, realPolynomialMass (scaleMvPolynomialAxes T (δ i)) ≤ B) : + ∃ e : (F.realification.adaptedPolynomialFiltration v).Group, + e.coord.val = realChartSubstitute δ (VectorPolynomial.map + (((F.gradedBasisSplitting b ω hF).toLinearMap.baseChange ℝ).restrictScalars ℚ) P) ∧ + F.realPolynomialSymbolHom b ω hF v e = + F.realSymbolHomogeneousPullbackHom b ω hF w v β hβ E ∧ + F.PolynomialSlowBound b v T + (((Fintype.card σ : ℝ) + 1) ^ d * A * B ^ d) e := by + obtain ⟨e, he, hsymbol⟩ := F.exists_inhomogeneous_chart_lift_algebraic b ω hF + w v E f P hgraded hchart β δ hβ hδ htop + refine ⟨e, he, hsymbol, ?_⟩ + change CoefficientBound (b.baseChange ℝ) T _ e.coord.val + rw [he] + exact CoefficientBound.realChartSubstitute_sharp (b.baseChange ℝ) T hT δ + ((F.coefficientBound_gradedBasisSplitting b ω hF _ _ P).mpr hbound) + hA hB (hdegree.map _) hmass + +theorem FullChartControlledFactors.exists_inhomogeneous_left_lift + {m : ℕ} {X : Type} [Fintype X] + (J : Fin m → Type) [∀ j, Fintype (J j)] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (left right : F.RealPolynomialSymbolGroup + (fullTaggedVariableWeight (X := X) J)) + {budget : ℝ} (h : FullChartControlledFactors F b ω hF J poly N left right budget) + (v : τ → ℕ) (β δ : (X ⊕ (Σ j, J j)) → MvPolynomial τ ℝ) + (hβ : ∀ i, (β i).IsWeightedHomogeneous v + (fullTaggedVariableWeight (X := X) J i)) + (hδ : ∀ i, δ i ∈ weightedSupportLE v + (fullTaggedVariableWeight (X := X) J i)) + (htop : ∀ i, MvPolynomial.weightedHomogeneousComponent v + (fullTaggedVariableWeight (X := X) J i) (δ i) = + MvPolynomial.aeval β (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) i)) : + ∃ (P : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] F.AssociatedGraded)) + (e : (F.realification.adaptedPolynomialFiltration v).Group), + CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) + (fun _ => 1) (Real.exp budget) P ∧ + P ∈ gradedPolynomialSubmodule ((F.associatedGradedBasis b ω hF).baseChange ℝ) ω + (fullTaggedVariableWeight (X := X) J) ∧ + DegreeLE (fullTaggedVariableWeight (X := X) J) s P ∧ + DegreeLE (fun _ => 1) s P ∧ + e.coord.val = realChartSubstitute δ (VectorPolynomial.map + (((F.gradedBasisSplitting b ω hF).toLinearMap.baseChange ℝ).restrictScalars ℚ) P) ∧ + F.realPolynomialSymbolHom b ω hF v e = F.realSymbolHomogeneousPullbackHom b ω hF + (fullTaggedVariableWeight (X := X) J) v β hβ left := by + obtain ⟨q, hq, hqB, E, hchart, hbound, hgraded, hweighted, hdegree, hgrid⟩ := + FullChartControlledFactors.exists_graded_degree_bounded_chart + F b ω hF J poly N left right h + have hc := congrArg NilpotentLieBCHGroup.coord hchart + rw [realPolynomialChartSubstitution_coord] at hc + obtain ⟨e, he, hsymbol⟩ := F.exists_inhomogeneous_chart_lift_algebraic b ω hF + _ v left _ E.coord hgraded hc β δ hβ hδ htop + exact ⟨E.coord, e, hbound, hgraded, hweighted, hdegree, he, hsymbol⟩ + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/IntervalBoxDifference.lean b/lean/OAI/Combinatorics/Progressions/Geometry/IntervalBoxDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..2992c3ded30632c7c9d9de3367ed48d1243dd4cf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/IntervalBoxDifference.lean @@ -0,0 +1,117 @@ +import OAI.Combinatorics.Progressions.Estimates.SymmetricIntervalDilation +import OAI.Combinatorics.Progressions.Probability.DenseProductDensity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +abbrev SymmetricIntegerInterval (N : ℕ) := + ↥(Finset.Icc (-(N : ℤ)) (N : ℤ)) + +instance symmetricIntegerInterval_inhabited (N : ℕ) : Inhabited (SymmetricIntegerInterval N) := + ⟨⟨0, Finset.mem_Icc.mpr ⟨by omega, by omega⟩⟩⟩ + +theorem symmetricIntegerInterval_card (N : ℕ) : + Fintype.card (SymmetricIntegerInterval N) = 2*N+1 := by + simpa only [Fintype.card_coe] using symmetricInterval_card N + +theorem symmetricIntegerInterval_abs_le (N : ℕ) (x : SymmetricIntegerInterval N) : + |(x : ℤ)| ≤ (N : ℤ) := + abs_le.mpr (Finset.mem_Icc.mp x.property) + +theorem dense_product_signed_box (e : ℕ) (N : Fin e → ℕ) + {η θ ε : ℝ} (hη : 0 < η) (hη1 : η ≤ 1) + (hN : ∀ i, denseProductDensityBudget e η ≤ N i) + (hε : 0 ≤ ε) (hsmall : ε ≤ 1/denseProductDensityBudget e η) + (hdensity : η ≤ nearIntegerDensity + (fun x : ∀ i, SymmetricIntegerInterval (N i) => θ * ∏ i, ((x i : ℤ) : ℝ)) ε) : + ∃ q : ℕ, 0 < q ∧ (q : ℝ) ≤ denseProductDensityBudget e η ∧ + NearInteger (denseProductDensityBudget e η*ε / ∏ i, (N i : ℝ)) ((q : ℝ)*θ) := by + apply dense_product_approximation_density e (X := fun i => SymmetricIntegerInterval (N i)) + (fun _ x => (x : ℤ)) + (fun _ => Subtype.val_injective) N hη hη1 hN + · intro i + rw [symmetricIntegerInterval_card] + omega + · exact fun i => symmetricIntegerInterval_abs_le (N i) + · exact hε + · exact hsmall + · exact hdensity + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def intervalDifference (N : ℕ) (y x : Fin N) : SymmetricIntegerInterval N := + ⟨(x.val : ℤ)-y.val, Finset.mem_Icc.mpr ⟨by omega, by omega⟩⟩ + +theorem intervalDifference_injective (N : ℕ) (y : Fin N) : + Function.Injective (intervalDifference N y) := by + intro x x' h + have he := congrArg Subtype.val h + dsimp [intervalDifference] at he + apply Fin.ext + omega + +def intervalBoxDifference {ι : Type*} (N : ι → ℕ) + (y x : ∀ i, Fin (N i)) : ∀ i, SymmetricIntegerInterval (N i) := + fun i => intervalDifference (N i) (y i) (x i) + +theorem intervalBoxDifference_injective {ι : Type*} (N : ι → ℕ) + (y : ∀ i, Fin (N i)) : Function.Injective (intervalBoxDifference N y) := by + intro x x' h + funext i + exact intervalDifference_injective (N i) (y i) (congrFun h i) + +theorem intervalBox_card_ratio {ι : Type*} [Fintype ι] [DecidableEq ι] + (N : ι → ℕ) (hN : ∀ i, 0 < N i) : + (1 : ℝ)/3^Fintype.card ι ≤ + (Fintype.card (∀ i, Fin (N i)) : ℝ) / + Fintype.card (∀ i, SymmetricIntegerInterval (N i)) := by + have hden : (0 : ℝ) < Fintype.card (∀ i, SymmetricIntegerInterval (N i)) := by + exact_mod_cast Fintype.card_pos + apply (div_le_div_iff₀ (by positivity) hden).mpr + simp only [Fintype.card_pi, Fintype.card_fin, symmetricIntegerInterval_card, + Nat.cast_prod, one_mul] + calc + (∏ i, ((2*N i+1 : ℕ) : ℝ)) ≤ ∏ i, (N i : ℝ)*3 := by + apply Finset.prod_le_prod₀ + · intro i _ + positivity + · intro i _ + have hi : (1 : ℝ) ≤ N i := by exact_mod_cast hN i + push_cast + linarith + _ = (∏ i, (N i : ℝ))*3^Fintype.card ι := by + rw [Finset.prod_mul_distrib] + simp + +theorem nearIntegerDensity_interval_differences {ι : Type*} [Fintype ι] [DecidableEq ι] + (N : ι → ℕ) (hN : ∀ i, 0 < N i) + (a : (∀ i, SymmetricIntegerInterval (N i)) → ℝ) (ε : ℝ) + {η : ℝ} (hη : 0 ≤ η) + (hdensity : η ≤ 𝔼 y : ∀ i, Fin (N i), + nearIntegerDensity (fun x => a (intervalBoxDifference N y x)) ε) : + η/3^Fintype.card ι ≤ nearIntegerDensity a ε := by + let : ∀ i, Nonempty (Fin (N i)) := fun i => ⟨⟨0, hN i⟩⟩ + have hd := nearIntegerDensity_fiber_injections a ε (intervalBoxDifference N) + (intervalBoxDifference_injective N) hdensity + have hr := mul_le_mul_of_nonneg_left (intervalBox_card_ratio N hN) hη + apply (le_trans ?_ hd) + simpa only [← mul_div_assoc, mul_one] using hr + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/JetAxisCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/JetAxisCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..16e2ff0eed96402c0cec074d5d1abddcd8a1a5ed --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/JetAxisCoordinates.lean @@ -0,0 +1,37 @@ +import OAI.Combinatorics.Progressions.Estimates.CoefficientJetScalar +import OAI.Combinatorics.Progressions.Estimates.CoveredMixedArrayImage + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +variable {m : ℕ} (O I : Fin m → Type*) (n : Fin m → ℕ) + +def coefficientJetAxisEquiv : + (∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) ≃ᵐ + (∀ a : LayerSamplerAxis I n, CoefficientJetAxisRow O a) := + (MeasurableEquiv.piCongrRight (fun j => + (MeasurableEquiv.sumPiEquivProdPi (fun a : I j ⊕ Fin (n j) => CoefficientJetAxisRow O ⟨j, a⟩)).symm)).trans + (MeasurableEquiv.piCurry (fun j (a : I j ⊕ Fin (n j)) => CoefficientJetAxisRow O ⟨j, a⟩)).symm + +theorem coefficientJetAxisEquiv_real (x) (j : Fin m) (i : I j) : + coefficientJetAxisEquiv O I n x ⟨j, Sum.inl i⟩ = (x j).1 i := rfl + +theorem coefficientJetAxisEquiv_integer (x) (j : Fin m) (i : Fin (n j)) : + coefficientJetAxisEquiv O I n x ⟨j, Sum.inr i⟩ = (x j).2 i := rfl + +theorem canonicalCoefficientJetArrays_axis {α K : Type*} [DecidableEq α] [Fintype K] + (root : K → ℤ) (A : Matrix α K ℤ) (rows : ∀ j, O j → Finset α) + (x : CoefficientSamplerArrays (K := K) I n) (a : LayerSamplerAxis I n) : + coefficientJetAxisEquiv O I n (canonicalCoefficientJetArrays root A rows x) a = + coefficientJetAxisMap (fun j => boundedCoefficientJetMatrix root A (j.val + 1) (rows j)) a + (coefficientAxisEquiv K I n x a) := by + rcases a with ⟨j, i | i⟩ <;> rfl + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/JointExceptionalSpatialWidthBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/JointExceptionalSpatialWidthBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa04ee0e053e73ce9cd975b9c52d9d6292f39617 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/JointExceptionalSpatialWidthBudget.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Linear.SpatialMatrixBlockWideProbability +import OAI.Combinatorics.Progressions.Sampling.JointMeasureProductiveNarrowSampler + +namespace OAI + +section + +namespace Erdos3 + +theorem narrow_sampler_residue_width_exp {G J X : Type*} {P W τ ξ : ℝ} + (hP : 0 ≤ P) (hW : 0 ≤ W) (hWP : W ≤ Real.exp P) + (hτ : 0 < τ) (hτP : τ⁻¹ ≤ Real.exp P) + (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) (hξP : ξ⁻¹ ≤ Real.exp P) + (N q : X → ℕ) (hq : ∀ i, 0 < q i) (hqP : ∀ i, (q i : ℝ) ≤ Real.exp P) + (hsize : ∀ i, Real.exp (10*P+128) ≤ (N i : ℝ)) : + ∀ z : Option (G ⊕ J) × X, Real.exp P ≤ + residueProfileWidth q (narrowTrimmedSpatialWidths W τ ξ N) z := by + have hN (i) : 0 < N i := by exact_mod_cast (Real.exp_pos _).trans_le (hsize i) + obtain ⟨hf, hfInv, hfWidth⟩ := narrow_sampler_width_bounds (G := G) (J := J) + hP hW hWP hτ hτP hξ hξ1 hξP N hN + intro z + have hproduct : Real.exp P * (q z.2 : ℝ) / + spatialWidthFraction (2*P) (ξ*τ) ≤ (N z.2 : ℝ) := by + calc + _ = Real.exp P * (q z.2 : ℝ) * + (1 / spatialWidthFraction (2*P) (ξ*τ)) := by ring + _ ≤ Real.exp P * Real.exp P * Real.exp (spatialSamplingBudget (2*P)) := by + gcongr + exact hqP z.2 + _ = Real.exp (10*P+128) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + unfold spatialSamplingBudget + ring + _ ≤ _ := hsize z.2 + apply (le_div_iff₀ (show (0 : ℝ) < q z.2 by exact_mod_cast hq z.2)).mpr + exact ((div_le_iff₀ hf).mp hproduct).trans + (by simpa only [mul_comm] using hfWidth z) + +theorem jointExceptionalSpatialSize_polynomial {P : ℝ} (hP : 0 ≤ P) : + 10*P+128 ≤ (P+4)^4 := by + nlinarith only [hP, pow_nonneg hP 2, pow_nonneg hP 3, pow_nonneg hP 4] + +theorem jointExceptionalSpatialWidthBudget {G J X : Type*} {P W τ ξ logwide : ℝ} + (hP : 0 ≤ P) (hW : 0 ≤ W) (hWP : W ≤ Real.exp P) + (hτ : 0 < τ) (hτP : τ⁻¹ ≤ Real.exp P) + (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) (hξP : ξ⁻¹ ≤ Real.exp P) + (N q : X → ℕ) (hq : ∀ i, 0 < q i) (hqP : ∀ i, (q i : ℝ) ≤ Real.exp P) + (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hlog : logwide ≤ P) + (hsize : ∀ i, Real.exp ((P+4)^4) ≤ (N i : ℝ)) + (e : Fin 2 × X ↪ G) : + (∀ z : Option (G ⊕ J) × X, 8*(probabilityProfileLipschitz : ℝ) ≤ + residueProfileWidth q (narrowTrimmedSpatialWidths W τ ξ N) z) ∧ + ∀ i, Real.exp logwide ≤ spatialMatrixIndexWidth e q + (narrowTrimmedSpatialWidths (J := J) W τ ξ N) i := by + have hsize' (i) : Real.exp (10*P+128) ≤ (N i : ℝ) := + (Real.exp_le_exp.mpr (jointExceptionalSpatialSize_polynomial hP)).trans (hsize i) + refine ⟨narrow_sampler_residue_scale hP hW hWP hτ hτP hξ hξ1 hξP + N q hq hqP hprofile hsize', ?_⟩ + intro i + exact (Real.exp_le_exp.mpr hlog).trans + (narrow_sampler_residue_width_exp hP hW hWP hτ hτP hξ hξ1 hξP + N q hq hqP hsize' (spatialMatrixBlockSlot e i)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LayerOneTransportBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LayerOneTransportBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..8af428508ea75fe3c9cf2716c935c510db0a116d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LayerOneTransportBudget.lean @@ -0,0 +1,46 @@ +import OAI.Combinatorics.Progressions.Estimates.RationalPowerHeight + +namespace OAI + +section + +namespace Erdos3 + +theorem layerOne_basis_transport_height_le_exp (a m J : ℕ) (C p : ℝ) + (hp : 0 ≤ p) (ha : (a : ℝ) ≤ p) (hm : (m : ℝ) ≤ Real.exp p) + (hC0 : 0 ≤ C) (hC : C ≤ Real.exp p) (hJ : (J : ℝ) ≤ Real.exp p) : + (((a + 1) * (max m (Nat.ceil ((m : ℝ) * C)) * J) ^ a : ℕ) : ℝ) ≤ + Real.exp ((p + 2) ^ 3) := by + have hprod : (m : ℝ) * C ≤ Real.exp (2 * p) := by + calc + _ ≤ Real.exp p * Real.exp p := mul_le_mul hm hC hC0 (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hheight : ((max m (Nat.ceil ((m : ℝ) * C)) : ℕ) : ℝ) ≤ Real.exp (2 * p + 1) := by + rw [Nat.cast_max] + apply max_le + · exact hm.trans (Real.exp_le_exp.mpr (by linarith)) + · calc + _ ≤ (Nat.ceil (Real.exp (2 * p)) : ℝ) := Nat.cast_le.mpr (Nat.ceil_mono hprod) + _ ≤ _ := ceil_exp_le_exp_add_one (by positivity) + have hHJ : ((max m (Nat.ceil ((m : ℝ) * C)) : ℕ) : ℝ) * J ≤ Real.exp (3 * p + 1) := by + calc + _ ≤ Real.exp (2 * p + 1) * Real.exp p := + mul_le_mul hheight hJ (Nat.cast_nonneg J) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hpow := pow_le_pow_left₀ (mul_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg J)) hHJ a + rw [← Real.exp_nat_mul] at hpow + rw [Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_pow, Nat.cast_mul] + calc + _ ≤ Real.exp a * Real.exp ((a : ℝ) * (3 * p + 1)) := + mul_le_mul (Real.add_one_le_exp a) hpow (by positivity) (Real.exp_nonneg _) + _ = Real.exp ((a : ℝ) * (3 * p + 2)) := by + rw [← Real.exp_add]; congr 1; ring + _ ≤ Real.exp (p * (3 * p + 2)) := + Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right ha (by positivity)) + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [mul_nonneg hp (sq_nonneg p)]) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateHeight.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..06f85290757a8381f4657827100ae9ec5f49e579 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateHeight.lean @@ -0,0 +1,108 @@ +import OAI.Combinatorics.Progressions.Polynomial.LieCoordinatePolynomials + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +def lieCoordinateHeight (d H n : ℕ) : ℕ := + (d ^ 2 + H + 2) ^ ((2 * d ^ 2 + 2) ^ n) + +theorem lieCoordinateHeight_pos (d H n : ℕ) : 0 < lieCoordinateHeight d H n := by + unfold lieCoordinateHeight + positivity + +theorem lieCoordinateHeight_mono_length (d H : ℕ) : Monotone (lieCoordinateHeight d H) := by + intro m n hmn + unfold lieCoordinateHeight + exact Nat.pow_le_pow_right (by omega) + (Nat.pow_le_pow_right (by omega) hmn) + +theorem lieCoordinateHeight_step (d H n : ℕ) : + (d ^ 2 + 1) * (H * lieCoordinateHeight d H n) ^ (d ^ 2) ≤ + lieCoordinateHeight d H (n + 1) := by + let A := d ^ 2 + H + 2 + let N := d ^ 2 + let E := (2 * N + 2) ^ n + have hA : 1 ≤ A := by dsimp [A]; omega + have hE : 1 ≤ E := Nat.one_le_pow _ _ (by dsimp [N]; omega) + have hH : H ≤ A := by dsimp [A]; omega + have hN : N + 1 ≤ A := by dsimp [A, N]; omega + change (N + 1) * (H * A ^ E) ^ N ≤ A ^ ((2 * N + 2) ^ (n + 1)) + calc + (N + 1) * (H * A ^ E) ^ N ≤ A * (A * A ^ E) ^ N := + Nat.mul_le_mul hN (Nat.pow_le_pow_left (Nat.mul_le_mul_right _ hH) _) + _ = A ^ (1 + (1 + E) * N) := by + rw [← pow_succ', ← pow_mul, ← pow_succ'] + congr 1 + ring + _ ≤ A ^ ((2 * N + 2) ^ (n + 1)) := by + apply Nat.pow_le_pow_right hA + rw [pow_succ] + change 1 + (1 + E) * N ≤ E * (2 * N + 2) + nlinarith + +variable {ι X : Type*} [Fintype ι] + +theorem coordinateRightBracket_height (c : ι → ι → ι → ℚ) {H K : ℕ} + (hc : ∀ i j k, RationalHeightLE (c i j k) H) (x : X) + (p : ι → MvPolynomial (X × ι) ℚ) + (hp : ∀ i, RationalPolynomialHeightLE (p i) K) (k : ι) : + RationalPolynomialHeightLE (coordinateRightBracket c x p k) + ((Fintype.card ι ^ 2 + 1) * (H * K) ^ (Fintype.card ι ^ 2)) := by + have h := RationalPolynomialHeightLE.sum + (fun ij : ι × ι => C (c ij.1 ij.2 k) * p ij.1 * MvPolynomial.X (x, ij.2)) + (fun ij => (RationalPolynomialHeightLE.C_mul (hc ij.1 ij.2 k) (hp ij.1)).mul_X (x, ij.2)) + simpa only [coordinateRightBracket, Fintype.card_prod, pow_two] using h + +theorem coordinateBracketList_height (c : ι → ι → ι → ℚ) {H : ℕ} + (hc : ∀ i j k, RationalHeightLE (c i j k) H) (xs : List X) + (p : ι → MvPolynomial (X × ι) ℚ) {n : ℕ} + (hp : ∀ i, RationalPolynomialHeightLE (p i) (lieCoordinateHeight (Fintype.card ι) H n)) + (k : ι) : + RationalPolynomialHeightLE (coordinateBracketList c xs p k) + (lieCoordinateHeight (Fintype.card ι) H (n + xs.length)) := by + induction xs generalizing p n with + | nil => exact hp k + | cons x xs ih => + have hstep : ∀ i, RationalPolynomialHeightLE (coordinateRightBracket c x p i) + (lieCoordinateHeight (Fintype.card ι) H (n + 1)) := fun i => + (coordinateRightBracket_height c hc x p hp i).mono (lieCoordinateHeight_step _ _ _) + simpa only [coordinateBracketList, List.length_cons, Nat.add_assoc, + Nat.add_comm 1 xs.length] using ih (coordinateRightBracket c x p) hstep + +theorem dynkinCoordinatePolynomial_height (c : ι → ι → ι → ℚ) {H : ℕ} + (hc : ∀ i j k, RationalHeightLE (c i j k) H) (w : FreeSemigroup X) (k : ι) : + RationalPolynomialHeightLE (dynkinCoordinatePolynomial c w k) + (lieCoordinateHeight (Fintype.card ι) H w.length) := by + have h := coordinateBracketList_height c hc w.tail + (fun i => MvPolynomial.X (w.head, i)) (n := 0) + (fun i => (RationalPolynomialHeightLE.X (w.head, i)).mono + (lieCoordinateHeight_pos (Fintype.card ι) H 0)) k + apply h.mono + apply lieCoordinateHeight_mono_length + change 0 + w.tail.length ≤ w.tail.length + 1 + omega + +noncomputable def bchCoordinateHeight (s d H : ℕ) : ℕ := + ((bchBracketSupport s).card + 1) * + (bchCoefficientHeight s * lieCoordinateHeight d H s) ^ (bchBracketSupport s).card + +theorem bchCoordinatePolynomial_height (c : ι → ι → ι → ℚ) {H : ℕ} + (hc : ∀ i j k, RationalHeightLE (c i j k) H) (s : ℕ) (k : ι) : + RationalPolynomialHeightLE (bchCoordinatePolynomial c s k) + (bchCoordinateHeight s (Fintype.card ι) H) := by + apply RationalPolynomialHeightLE.sum_finset + intro w hw + exact RationalPolynomialHeightLE.C_mul (bchBracketCoefficient_height s hw) + ((dynkinCoordinatePolynomial_height c hc w k).mono + (lieCoordinateHeight_mono_length _ _ (bchBracketSupport_length s hw))) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateScalarExtension.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateScalarExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..c430eacf077f7085507e318062595f4a838eebed --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateScalarExtension.lean @@ -0,0 +1,106 @@ +import OAI.Combinatorics.Progressions.Nilpotent.BCHDenominatorBudget + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial Module + +variable {ι X R L : Type*} [Fintype ι] [CommRing R] [Algebra ℚ R] + [LieRing L] [LieAlgebra R L] + +theorem lie_coordinate_formula_over (e : Basis ι R L) (c : ι → ι → ι → ℚ) + (hc : ∀ i j k, algebraMap ℚ R (c i j k) = e.repr ⁅e i, e j⁆ k) + (a b : L) (k : ι) : + e.repr ⁅a, b⁆ k = + ∑ ij : ι × ι, algebraMap ℚ R (c ij.1 ij.2 k) * e.repr a ij.1 * e.repr b ij.2 := by + classical + conv_lhs => rw [← e.sum_repr a, ← e.sum_repr b] + simp only [sum_lie, lie_sum, smul_lie, lie_smul, map_sum, map_smul, + Finsupp.coe_finsetSum, Finset.sum_apply, Finsupp.smul_apply, smul_eq_mul, + Fintype.sum_prod_type, hc, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +theorem coordinateRightBracket_eval_over (e : Basis ι R L) (c : ι → ι → ι → ℚ) + (hc : ∀ i j k, algebraMap ℚ R (c i j k) = e.repr ⁅e i, e j⁆ k) + (f : X → L) (p : ι → MvPolynomial (X × ι) ℚ) (a : L) + (hp : ∀ i, aeval (fun xi : X × ι => e.repr (f xi.1) xi.2) (p i) = e.repr a i) + (x : X) (k : ι) : + aeval (fun xi : X × ι => e.repr (f xi.1) xi.2) + (coordinateRightBracket c x p k) = e.repr ⁅a, f x⁆ k := by + simp only [coordinateRightBracket, map_sum, map_mul, aeval_C, aeval_X, hp] + exact (lie_coordinate_formula_over e c hc a (f x) k).symm + +variable [LieAlgebra ℚ L] + +theorem coordinateBracketList_eval_over (e : Basis ι R L) (c : ι → ι → ι → ℚ) + (hc : ∀ i j k, algebraMap ℚ R (c i j k) = e.repr ⁅e i, e j⁆ k) + (f : X → L) (xs : List X) (p : ι → MvPolynomial (X × ι) ℚ) (a : L) + (hp : ∀ i, aeval (fun xi : X × ι => e.repr (f xi.1) xi.2) (p i) = e.repr a i) + (k : ι) : + aeval (fun xi : X × ι => e.repr (f xi.1) xi.2) + (coordinateBracketList c xs p k) = e.repr (rightBracketList f xs a) k := by + induction xs generalizing p a with + | nil => exact hp k + | cons x xs ih => + exact ih (coordinateRightBracket c x p) ⁅a, f x⁆ + (coordinateRightBracket_eval_over e c hc f p a hp x) + +theorem dynkinCoordinatePolynomial_eval_over (e : Basis ι R L) (c : ι → ι → ι → ℚ) + (hc : ∀ i j k, algebraMap ℚ R (c i j k) = e.repr ⁅e i, e j⁆ k) + (f : X → L) (w : FreeSemigroup X) (k : ι) : + aeval (fun xi : X × ι => e.repr (f xi.1) xi.2) (dynkinCoordinatePolynomial c w k) = + e.repr (dynkinWord f w) k := by + apply coordinateBracketList_eval_over e c hc + intro i + simp only [aeval_X] + +variable [IsScalarTower ℚ R L] + +theorem bchCoordinatePolynomial_eval_over (e : Basis ι R L) (c : ι → ι → ι → ℚ) + (hc : ∀ i j k, algebraMap ℚ R (c i j k) = e.repr ⁅e i, e j⁆ k) + (s : ℕ) (a b : L) (k : ι) : + aeval (fun xi : Fin 2 × ι => e.repr (![a, b] xi.1) xi.2) + (bchCoordinatePolynomial c s k) = e.repr (lieBCH s a b) k := by + change _ = e.coord k (lieBCH s a b) + rw [lieBCH_bracket_formula] + simp only [bchCoordinatePolynomial, map_sum, map_mul, aeval_C, + dynkinCoordinatePolynomial_eval_over e c hc, + LinearMap.map_smul_of_tower, Algebra.smul_def, Basis.coord_apply] + +theorem exists_bch_coordinate_polynomials_over_exp_height (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ (e : Basis ι R L) (c : ι → ι → ι → ℚ) (H : ℕ) (p : ℝ), + (∀ i j k, algebraMap ℚ R (c i j k) = e.repr ⁅e i, e j⁆ k) → + 0 ≤ p → (Fintype.card ι : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → + (∀ i j k, RationalHeightLE (c i j k) H) → + ∃ P : ι → MvPolynomial (Fin 2 × ι) ℚ, + (∀ (a b : L) k, + aeval (fun xi : Fin 2 × ι => e.repr (![a, b] xi.1) xi.2) (P k) = + e.repr (lieBCH s a b) k) ∧ + (∀ k, (P k).totalDegree ≤ s) ∧ + ∀ k m, (((P k).coeff m).num.natAbs : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + (((P k).coeff m).den : ℝ) ≤ Real.exp ((p + C) ^ C) := by + obtain ⟨C, hC, hbudget⟩ := exists_bchCoordinateHeight_exp_budget s + refine ⟨C, hC, ?_⟩ + intro e c H p hstructure hp hd hH hc + refine ⟨bchCoordinatePolynomial c s, + bchCoordinatePolynomial_eval_over e c hstructure s, bchCoordinatePolynomial_totalDegree c s, ?_⟩ + intro k m + have hheight := bchCoordinatePolynomial_height c hc s k m + have hbound := hbudget (Fintype.card ι) H p hp hd hH + constructor + · exact (Nat.cast_le.mpr hheight.1).trans hbound + · exact (Nat.cast_le.mpr hheight.2).trans hbound + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateSmooth.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateSmooth.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4acbb94b5d8b1ec3f83e22667424ae267cc6e58 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LieCoordinateSmooth.lean @@ -0,0 +1,96 @@ +import Mathlib.Analysis.Calculus.ContDiff.Operations +import Mathlib.LinearAlgebra.Basis.Defs +import OAI.Combinatorics.Progressions.Nilpotent.LieBCHContinuity + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped ContDiff + +variable {ι X E L : Type*} [Fintype ι] [NormedAddCommGroup E] [NormedSpace ℝ E] + [LieRing L] [LieAlgebra ℝ L] {n : ℕ∞ω} + +theorem lie_coordinate_formula_real (e : Basis ι ℝ L) (a b : L) (k : ι) : + e.repr ⁅a, b⁆ k = + ∑ i, ∑ j, e.repr a i * e.repr b j * e.repr ⁅e i, e j⁆ k := by + classical + conv_lhs => rw [← e.sum_repr a, ← e.sum_repr b] + simp only [sum_lie, lie_sum, smul_lie, lie_smul, map_sum, map_smul, + Finsupp.coe_finsetSum, Finset.sum_apply, Finsupp.smul_apply, + smul_eq_mul, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +theorem contDiff_lie_coordinates (e : Basis ι ℝ L) (f g : E → L) + (hf : ∀ i, ContDiff ℝ n (fun x => e.repr (f x) i)) + (hg : ∀ i, ContDiff ℝ n (fun x => e.repr (g x) i)) (k : ι) : + ContDiff ℝ n (fun x => e.repr ⁅f x, g x⁆ k) := by + have heq : (fun x => e.repr ⁅f x, g x⁆ k) = + (fun x => ∑ i, ∑ j, e.repr (f x) i * e.repr (g x) j * e.repr ⁅e i, e j⁆ k) := + funext (fun x => lie_coordinate_formula_real e (f x) (g x) k) + rw [heq] + exact ContDiff.sum (fun i _ => ContDiff.sum (fun j _ => + ((hf i).mul (hg j)).mul contDiff_const)) + +variable [LieAlgebra ℚ L] + +theorem contDiff_rightBracketList_coordinates (e : Basis ι ℝ L) (f : X → E → L) + (hf : ∀ x i, ContDiff ℝ n (fun y => e.repr (f x y) i)) (xs : List X) + (a : E → L) (ha : ∀ i, ContDiff ℝ n (fun y => e.repr (a y) i)) (k : ι) : + ContDiff ℝ n (fun y => e.repr (rightBracketList (fun x => f x y) xs (a y)) k) := by + induction xs generalizing a with + | nil => exact ha k + | cons x xs ih => + exact ih (fun y => ⁅a y, f x y⁆) (contDiff_lie_coordinates e a (f x) ha (hf x)) + +theorem contDiff_dynkinWord_coordinates (e : Basis ι ℝ L) (f : X → E → L) + (hf : ∀ x i, ContDiff ℝ n (fun y => e.repr (f x y) i)) + (w : FreeSemigroup X) (k : ι) : + ContDiff ℝ n (fun y => e.repr (dynkinWord (fun x => f x y) w) k) := + contDiff_rightBracketList_coordinates e f hf w.tail (f w.head) (hf w.head) k + +variable [IsScalarTower ℚ ℝ L] + +theorem contDiff_lieBCH_coordinates (e : Basis ι ℝ L) (s : ℕ) (f g : E → L) + (hf : ∀ i, ContDiff ℝ n (fun x => e.repr (f x) i)) + (hg : ∀ i, ContDiff ℝ n (fun x => e.repr (g x) i)) (k : ι) : + ContDiff ℝ n (fun x => e.repr (lieBCH s (f x) (g x)) k) := by + change ContDiff ℝ n (fun x => e.coord k (lieBCH s (f x) (g x))) + simp only [lieBCH_bracket_formula, map_sum, LinearMap.map_smul_of_tower, + Algebra.smul_def, Basis.coord_apply] + apply ContDiff.sum + intro w _ + apply contDiff_const.mul + exact contDiff_dynkinWord_coordinates e (fun i x => ![f x, g x] i) + (by intro i k; fin_cases i; exact hf k; exact hg k) w k + +theorem contDiff_coordinateBCH (e : Basis ι ℝ L) (s : ℕ) : + ContDiff ℝ n (fun z : (ι → ℝ) × (ι → ℝ) => + e.equivFun (lieBCH s (e.equivFun.symm z.1) (e.equivFun.symm z.2))) := by + apply contDiff_pi.mpr + intro k + apply contDiff_lieBCH_coordinates e s + · intro i + change ContDiff ℝ n (fun z : (ι → ℝ) × (ι → ℝ) => + e.equivFun (e.equivFun.symm z.1) i) + simp only [LinearEquiv.apply_symm_apply] + exact (contDiff_apply ℝ ℝ i).comp contDiff_fst + · intro i + change ContDiff ℝ n (fun z : (ι → ℝ) × (ι → ℝ) => + e.equivFun (e.equivFun.symm z.2) i) + simp only [LinearEquiv.apply_symm_apply] + exact (contDiff_apply ℝ ℝ i).comp contDiff_snd + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LieStructureTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LieStructureTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..e171dadde7c481a102aaf0665de1fd4fc4782832 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LieStructureTransport.lean @@ -0,0 +1,129 @@ +import Mathlib.LinearAlgebra.Matrix.ToLin +import OAI.Combinatorics.Progressions.Polynomial.LieCoordinatePolynomials + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped Matrix + +variable {ι κ : Type*} [Fintype ι] [Fintype κ] + +noncomputable def transportedLieConstants (c : ι → ι → ι → ℚ) + (P : Matrix κ ι ℚ) (S : Matrix ι κ ℚ) (i j k : κ) : ℚ := + ∑ abc : ι × (ι × ι), P k abc.1 * c abc.2.1 abc.2.2 abc.1 * S abc.2.1 i * S abc.2.2 j + +omit [Fintype κ] in +theorem transportedLieConstants_height (c : ι → ι → ι → ℚ) + (P : Matrix κ ι ℚ) (S : Matrix ι κ ℚ) {Hc HP HS : ℕ} + (hc : ∀ i j k, RationalHeightLE (c i j k) Hc) + (hP : ∀ i j, RationalHeightLE (P i j) HP) + (hS : ∀ i j, RationalHeightLE (S i j) HS) (i j k : κ) : + RationalHeightLE (transportedLieConstants c P S i j k) + ((Fintype.card ι ^ 3 + 1) * (HP * Hc * HS * HS) ^ (Fintype.card ι ^ 3)) := by + classical + have h := rationalHeightLE_sum + (fun abc : ι × (ι × ι) => P k abc.1 * c abc.2.1 abc.2.2 abc.1 * S abc.2.1 i * S abc.2.2 j) + (fun abc => (((hP k abc.1).mul (hc abc.2.1 abc.2.2 abc.1)).mul (hS abc.2.1 i)).mul (hS abc.2.2 j)) + simpa only [transportedLieConstants, Fintype.card_prod, pow_succ, pow_zero, one_mul, mul_assoc] using h + +variable {L M : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + +omit [Fintype κ] in +theorem transportedLieConstants_formula (e : Basis ι ℚ L) (P : Matrix κ ι ℚ) + (S : Matrix ι κ ℚ) (a b : L) (i j k : κ) + (ha : ∀ u, e.repr a u = S u i) (hb : ∀ u, e.repr b u = S u j) : + (P *ᵥ e.repr ⁅a, b⁆) k = transportedLieConstants (lieStructureConstants e) P S i j k := by + classical + simp only [Matrix.mulVec, dotProduct, transportedLieConstants, lie_coordinate_formula, + ha, hb, Finset.mul_sum, Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro w _ + apply Finset.sum_congr rfl + intro u _ + apply Finset.sum_congr rfl + intro v _ + ring + +variable [DecidableEq ι] [DecidableEq κ] + +omit [DecidableEq ι] in +theorem basisMatrix_mulVec (b : Basis κ ℚ M) (e : Basis ι ℚ L) (φ : M →ₗ[ℚ] L) + (x : κ → ℚ) : + LinearMap.toMatrix b e φ *ᵥ x = e.equivFun (φ (b.equivFun.symm x)) := by + have h := LinearMap.toMatrix_mulVec_repr b e φ (b.equivFun.symm x) + simpa only [← b.equivFun_apply, LinearEquiv.apply_symm_apply, ← e.equivFun_apply] using h + +omit [DecidableEq ι] in +theorem basisMatrix_injective (b : Basis κ ℚ M) (e : Basis ι ℚ L) (φ : M →ₗ[ℚ] L) + (hφ : Function.Injective φ) : Function.Injective (LinearMap.toMatrix b e φ).mulVec := by + intro x y hxy + rw [basisMatrix_mulVec, basisMatrix_mulVec] at hxy + exact b.equivFun.symm.injective (hφ (e.equivFun.injective hxy)) + +omit [DecidableEq ι] in +theorem basisMatrix_surjective (b : Basis κ ℚ M) (e : Basis ι ℚ L) (φ : M →ₗ[ℚ] L) + (hφ : Function.Surjective φ) : Function.Surjective (LinearMap.toMatrix b e φ).mulVec := by + intro y + obtain ⟨x, hx⟩ := hφ (e.equivFun.symm y) + refine ⟨b.equivFun x, ?_⟩ + rw [basisMatrix_mulVec, LinearEquiv.symm_apply_apply, hx, LinearEquiv.apply_symm_apply] + +omit [DecidableEq ι] in + +theorem lieStructureConstants_embedding (b : Basis κ ℚ M) (e : Basis ι ℚ L) + (φ : M →ₗ⁅ℚ⁆ L) (P : Matrix κ ι ℚ) + (hP : P * LinearMap.toMatrix b e φ.toLinearMap = 1) (i j k : κ) : + lieStructureConstants b i j k = transportedLieConstants (lieStructureConstants e) + P (LinearMap.toMatrix b e φ.toLinearMap) i j k := by + have hretract (x : M) : P *ᵥ e.repr (φ x) = b.repr x := by + change P *ᵥ e.repr (φ.toLinearMap x) = b.repr x + rw [← LinearMap.toMatrix_mulVec_repr b e φ.toLinearMap x, Matrix.mulVec_mulVec, + hP, Matrix.one_mulVec] + rw [lieStructureConstants, ← congrFun (hretract ⁅b i, b j⁆) k, LieHom.map_lie] + apply transportedLieConstants_formula + · intro u + exact (LinearMap.toMatrix_apply b e φ.toLinearMap u i).symm + · intro u + exact (LinearMap.toMatrix_apply b e φ.toLinearMap u j).symm + +theorem lieStructureConstants_section (e : Basis ι ℚ L) (b : Basis κ ℚ M) + (φ : L →ₗ⁅ℚ⁆ M) (σ : M →ₗ[ℚ] L) (hσ : ∀ x, φ (σ x) = x) (i j k : κ) : + lieStructureConstants b i j k = transportedLieConstants (lieStructureConstants e) + (LinearMap.toMatrix e b φ.toLinearMap) (LinearMap.toMatrix b e σ) i j k := by + have hbracket : ⁅b i, b j⁆ = φ ⁅σ (b i), σ (b j)⁆ := by rw [LieHom.map_lie, hσ, hσ] + rw [lieStructureConstants, hbracket] + change (b.repr (φ.toLinearMap ⁅σ (b i), σ (b j)⁆)) k = _ + rw [← congrFun (LinearMap.toMatrix_mulVec_repr e b φ.toLinearMap ⁅σ (b i), σ (b j)⁆) k] + apply transportedLieConstants_formula + · intro u + exact (LinearMap.toMatrix_apply b e σ u i).symm + · intro u + exact (LinearMap.toMatrix_apply b e σ u j).symm + +theorem basisMatrix_section (e : Basis ι ℚ L) (b : Basis κ ℚ M) + (φ : L →ₗ[ℚ] M) (S : Matrix ι κ ℚ) + (hS : LinearMap.toMatrix e b φ * S = 1) (x : M) : + φ (Matrix.toLin b e S x) = x := by + apply b.equivFun.injective + change (b.repr (φ (Matrix.toLin b e S x)) : κ → ℚ) = b.repr x + rw [← LinearMap.toMatrix_mulVec_repr e b φ, Matrix.repr_toLin, + Matrix.mulVec_mulVec, hS, Matrix.one_mulVec] + +theorem lieStructureConstants_quotient_matrix (e : Basis ι ℚ L) (b : Basis κ ℚ M) + (φ : L →ₗ⁅ℚ⁆ M) (S : Matrix ι κ ℚ) + (hS : LinearMap.toMatrix e b φ.toLinearMap * S = 1) (i j k : κ) : + lieStructureConstants b i j k = transportedLieConstants (lieStructureConstants e) + (LinearMap.toMatrix e b φ.toLinearMap) S i j k := by + simpa only [LinearMap.toMatrix_toLin] using + lieStructureConstants_section e b φ (Matrix.toLin b e S) + (basisMatrix_section e b φ.toLinearMap S hS) i j k + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LieTreeSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LieTreeSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..760ea4f0016f6c3ec96c2826680cc2d0ca7a49f8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LieTreeSupport.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Estimates.LieFiniteProduct + +namespace OAI + +section + +namespace Erdos3 + +variable {I J L : Type*} [LieRing L] + +def lieTreeSupport : FreeMagma I → Set I + | .of i => {i} + | .mul a b => lieTreeSupport a ∪ lieTreeSupport b + +theorem lieTreeEval_congr_on (v w : I → L) (a : FreeMagma I) + (h : ∀ i ∈ lieTreeSupport a, v i = w i) : lieTreeEval v a = lieTreeEval w a := by + induction a using FreeMagma.rec with + | of i => exact h i (Set.mem_singleton i) + | mul a b ha hb => + exact congrArg₂ (fun x y : L => ⁅x, y⁆) + (ha (fun i hi => h i (Or.inl hi))) (hb (fun i hi => h i (Or.inr hi))) + +theorem lieTreeEval_eq_zero_of_leaf (v : I → L) (a : FreeMagma I) {i : I} + (hi : i ∈ lieTreeSupport a) (hv : v i = 0) : lieTreeEval v a = 0 := by + induction a using FreeMagma.rec with + | of j => + have hij : i = j := hi + simpa only [lieTreeEval, ← hij] using hv + | mul a b ha hb => + rcases hi with hi | hi + · change ⁅lieTreeEval v a, lieTreeEval v b⁆ = 0 + rw [ha hi, zero_lie] + · change ⁅lieTreeEval v a, lieTreeEval v b⁆ = 0 + rw [hb hi, lie_zero] + +theorem lieTreeEval_pi (v : I → J → L) (a : FreeMagma I) (j : J) : + lieTreeEval v a j = lieTreeEval (fun i => v i j) a := by + induction a using FreeMagma.rec with + | of i => rfl + | mul a b ha hb => + change ⁅lieTreeEval v a j, lieTreeEval v b j⁆ = + ⁅lieTreeEval (fun i => v i j) a, lieTreeEval (fun i => v i j) b⁆ + rw [ha, hb] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LinearMapCoordinateHeight.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LinearMapCoordinateHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c6e7f4ee717964d6e8bc89bdd4725fd29cbcb65 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LinearMapCoordinateHeight.lean @@ -0,0 +1,31 @@ +import Mathlib.LinearAlgebra.Basis.Defs +import OAI.Combinatorics.Progressions.Estimates.RationalRowReduction + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {V W ι κ : Type*} [AddCommGroup V] [Module ℚ V] + [AddCommGroup W] [Module ℚ W] [Fintype ι] + +theorem linearMap_coordinate_height (e : Basis ι ℚ V) (f : Basis κ ℚ W) + (T : V →ₗ[ℚ] W) {H K : ℕ} + (hT : ∀ i j, RationalHeightLE (f.repr (T (e i)) j) H) + (x : V) (hx : ∀ i, RationalHeightLE (e.repr x i) K) (j : κ) : + RationalHeightLE (f.repr (T x) j) ((Fintype.card ι + 1) * (K * H) ^ Fintype.card ι) := by + classical + have he : f.repr (T x) j = ∑ i, e.repr x i * f.repr (T (e i)) j := by + conv_lhs => rw [← e.sum_repr x] + simp only [map_sum, map_smul, Finsupp.finsetSum_apply, Finsupp.smul_apply, smul_eq_mul] + rw [he] + exact rationalHeightLE_sum _ (fun i => (hx i).mul (hT i j)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LocalCoordinateDivergence.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LocalCoordinateDivergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..b623dede006acc398852cfde31356e39cb202d3b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LocalCoordinateDivergence.lean @@ -0,0 +1,57 @@ +import OAI.Combinatorics.Progressions.Estimates.LocalProductContinuity +import OAI.Combinatorics.Progressions.Geometry.DivergenceSupport + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem local_coordinate_vectorField_integration_by_parts + {ι : Type*} [Fintype ι] [DecidableEq ι] + (Q : ι → (ι → ℝ) → ℝ) (hQ : ∀ i, ContDiff ℝ 1 (Q i)) + (hs : ∀ i, HasCompactSupport (Q i)) (ψ : (ι → ℝ) → ℝ) + (hψ : ∀ i x, x ∈ tsupport (Q i) → ContDiffAt ℝ 1 ψ x) : + (∫ x, fderiv ℝ ψ x (fun i => Q i x)) = -∫ x, coordinateDivergence Q x * ψ x := by + have hDQ (i : ι) : Continuous (fun x => fderiv ℝ (Q i) x (Pi.single i 1)) := + ((hQ i).continuous_fderiv (by norm_num)).clm_apply continuous_const + have hleft (i : ι) : Integrable (fun x => Q i x * fderiv ℝ ψ x (Pi.single i 1)) := by + apply (continuous_mul_of_local_right (hQ i).continuous ?_).integrable_of_hasCompactSupport + ((hs i).mul_right) + intro x hx + exact ((hψ i x hx).continuousAt_fderiv (by norm_num)).clm_apply continuousAt_const + have hright (i : ι) : Integrable (fun x => fderiv ℝ (Q i) x (Pi.single i 1) * ψ x) := by + apply (continuous_mul_of_local_right (hDQ i) ?_).integrable_of_hasCompactSupport + (((hs i).fderiv_apply ℝ (Pi.single i 1)).mul_right) + intro x hx + exact (hψ i x ((tsupport_fderiv_apply_subset ℝ (Pi.single i 1)) hx)).continuousAt + have hprod (i : ι) : Integrable (fun x => Q i x * ψ x) := + (continuous_mul_of_local_right (hQ i).continuous (fun x hx => (hψ i x hx).continuousAt)).integrable_of_hasCompactSupport + ((hs i).mul_right) + have hibp (i : ι) : (∫ x, Q i x * fderiv ℝ ψ x (Pi.single i 1)) = + -∫ x, fderiv ℝ (Q i) x (Pi.single i 1) * ψ x := + integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable (hright i) (hleft i) (hprod i) + (fun x _ => (hQ i).differentiable (by norm_num) x) + (fun x hx => (hψ i x hx).differentiableAt (by norm_num)) + calc + (∫ x, fderiv ℝ ψ x (fun i => Q i x)) = + ∫ x, ∑ i, Q i x * fderiv ℝ ψ x (Pi.single i 1) := by + apply integral_congr_ae + filter_upwards [] with x + exact continuousLinearMap_coordinate_sum _ _ + _ = ∑ i, ∫ x, Q i x * fderiv ℝ ψ x (Pi.single i 1) := + integral_finsetSum _ (fun i _ => hleft i) + _ = -(∑ i, ∫ x, fderiv ℝ (Q i) x (Pi.single i 1) * ψ x) := by + simp only [hibp, Finset.sum_neg_distrib] + _ = -(∫ x, ∑ i, fderiv ℝ (Q i) x (Pi.single i 1) * ψ x) := by + rw [integral_finsetSum _ (fun i _ => hright i)] + _ = -∫ x, coordinateDivergence Q x * ψ x := by simp only [coordinateDivergence, Finset.sum_mul] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/LowTaggedCoordinateRestriction.lean b/lean/OAI/Combinatorics/Progressions/Geometry/LowTaggedCoordinateRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b6784d3513d6bd8a84894c91502634bedfa1a6c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/LowTaggedCoordinateRestriction.lean @@ -0,0 +1,256 @@ +import Mathlib.LinearAlgebra.StdBasis +import OAI.Combinatorics.Progressions.Polynomial.LowTaggedPolynomialCoordinates + +namespace OAI + +section + +namespace Erdos3 +open Module +open scoped BigOperators + +variable {B R : Type*} [Fintype B] [Field R] + +theorem pi_basisGradeProjection_apply (w : B → ℕ) (h : ℕ) (x : B → R) (i : B) : + basisGradeProjection (Pi.basisFun R B) w h x i = if w i = h then x i else 0 := by + simpa only [Pi.basisFun_repr] using + basisGradeProjection_repr (Pi.basisFun R B) w h x i + +theorem sum_positive_coordinate_grades + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (x : B → R) : + (∑ h : Fin d, basisGradeProjection (Pi.basisFun R B) w (h.val + 1) x) = x := by + classical + funext i + rw [Finset.sum_apply] + simp_rw [pi_basisGradeProjection_apply] + let hi : Fin d := ⟨w i - 1, by have := hw i; have := hwd i; omega⟩ + have he (h : Fin d) : w i = h.val + 1 ↔ h = hi := by + dsimp only [hi] + have := hw i + constructor + · intro hh + apply Fin.ext + change h.val = w i - 1 + omega + · intro hh + subst h + change w i = (w i - 1) + 1 + omega + simp_rw [he] + simp + +noncomputable def coordinateWeightLayer (w : B → ℕ) (K : Submodule R (B → R)) + (h : ℕ) : Submodule R (B → R) := + K.map (basisGradeProjection (Pi.basisFun R B) w h) + +theorem coordinateWeightLayer_le (w : B → ℕ) (K : Submodule R (B → R)) + (hK : BasisGradedSubmodule (Pi.basisFun R B) w K) (h : ℕ) : + coordinateWeightLayer w K h ≤ K := by + rintro y ⟨x, hx, rfl⟩ + exact hK h x hx + +theorem iSup_coordinateWeightLayer_eq + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (K : Submodule R (B → R)) (hK : BasisGradedSubmodule (Pi.basisFun R B) w K) : + (⨆ h : Fin d, coordinateWeightLayer w K (h.val + 1)) = K := by + apply le_antisymm + · exact iSup_le fun h => coordinateWeightLayer_le w K hK (h.val + 1) + · intro x hx + rw [← sum_positive_coordinate_grades w d hw hwd x] + apply Submodule.sum_mem + intro h _ + exact (le_iSup (fun h : Fin d => coordinateWeightLayer w K (h.val + 1)) h) + ⟨x, hx, rfl⟩ + +theorem coordinateWeightLayer_span {J : Type*} + (w : B → ℕ) (g : J → B → R) (h : ℕ) : + coordinateWeightLayer w (Submodule.span R (Set.range g)) h = + Submodule.span R (Set.range (fun j i => if w i = h then g j i else 0)) := by + rw [coordinateWeightLayer, Submodule.map_span, ← Set.range_comp] + apply congrArg (Submodule.span R) + congr 1 + funext j i + exact pi_basisGradeProjection_apply w h (g j) i + +theorem le_coordinateWeightLayer_of_supported + (w : B → ℕ) (K W : Submodule R (B → R)) (h : ℕ) (hWK : W ≤ K) + (hsupport : ∀ x ∈ W, ∀ i, w i ≠ h → x i = 0) : + W ≤ coordinateWeightLayer w K h := by + intro x hx + refine ⟨x, hWK hx, ?_⟩ + funext i + rw [pi_basisGradeProjection_apply] + by_cases hi : w i = h + · simp only [ite_eq_left hi] + · simp only [ite_eq_right hi, hsupport x hx i hi] + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +variable {m : ℕ} (J : Fin m → Type*) [∀ j, Fintype (J j)] + +noncomputable def lowTaggedSlot (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) + (k : J j) : Fin (Fintype.card (LowTaggedIndex J d)) := + Fintype.equivFin (LowTaggedIndex J d) ⟨⟨j, k⟩, hj⟩ + +@[simp] theorem lowTaggedIndex_slot (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) + (k : J j) : lowTaggedIndex J d (lowTaggedSlot J d j hj k) = ⟨j, k⟩ := by + simp [lowTaggedIndex, lowTaggedSlot] + +theorem lowTaggedSlot_injective (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) : + Function.Injective (lowTaggedSlot J d j hj) := by + intro k l h + have he := congrArg (lowTaggedIndex J d) h + simpa using he + +theorem lowTaggedSlot_eq_of_tag (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) + (i : Fin (Fintype.card (LowTaggedIndex J d))) + (hi : (lowTaggedIndex J d i).1 = j) : + ∃ k : J j, lowTaggedSlot J d j hj k = i := by + let q := (Fintype.equivFin (LowTaggedIndex J d)).symm i + have hq : q.val.1 = j := hi + have hqi : Fintype.equivFin (LowTaggedIndex J d) q = i := + (Fintype.equivFin (LowTaggedIndex J d)).apply_symm_apply i + obtain ⟨⟨j', k⟩, h⟩ := q + dsimp at hq + subst j' + exact ⟨k, hqi⟩ + +noncomputable def lowTaggedEmbedding (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) : + (J j → ℝ) →ₗ[ℝ] (Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) := by + classical + exact ∑ k : J j, + (LinearMap.single ℝ (fun _ : Fin (Fintype.card (LowTaggedIndex J d)) => ℝ) + (lowTaggedSlot J d j hj k)).comp (LinearMap.proj k) + +theorem lowTaggedEmbedding_apply (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) + (v : J j → ℝ) (i : Fin (Fintype.card (LowTaggedIndex J d))) : + lowTaggedEmbedding J d j hj v i = + ∑ k : J j, (Pi.single (lowTaggedSlot J d j hj k) (v k) : + Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) i := by + classical + simp [lowTaggedEmbedding, LinearMap.sum_apply, Finset.sum_apply] + +@[simp] theorem lowTaggedEmbedding_apply_slot (d : ℕ) (j : Fin m) + (hj : j.val + 1 ≤ d) (v : J j → ℝ) (k : J j) : + lowTaggedEmbedding J d j hj v (lowTaggedSlot J d j hj k) = v k := by + classical + rw [lowTaggedEmbedding_apply] + rw [Finset.sum_eq_single k] + · simp + · intro l _ hl + exact Pi.single_eq_of_ne (fun he => hl + ((lowTaggedSlot_injective J d j hj) he.symm)) _ + · simp + +theorem lowTaggedEmbedding_injective (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) : + Function.Injective (lowTaggedEmbedding J d j hj) := by + intro v w h + funext k + have hk := congrFun h (lowTaggedSlot J d j hj k) + simpa only [lowTaggedEmbedding_apply_slot] using hk + +theorem lowTaggedEmbedding_apply_of_ne (d : ℕ) (j : Fin m) + (hj : j.val + 1 ≤ d) (v : J j → ℝ) + (i : Fin (Fintype.card (LowTaggedIndex J d))) + (hi : (lowTaggedIndex J d i).1 ≠ j) : + lowTaggedEmbedding J d j hj v i = 0 := by + classical + rw [lowTaggedEmbedding_apply] + apply Finset.sum_eq_zero + intro k _ + apply Pi.single_eq_of_ne + intro he + apply hi + rw [he, lowTaggedIndex_slot] + +theorem lowTaggedEmbedding_pairing (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) + (a : Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) (v : J j → ℝ) : + (∑ i, a i * lowTaggedEmbedding J d j hj v i) = + ∑ k : J j, a (lowTaggedSlot J d j hj k) * v k := by + classical + simp only [lowTaggedEmbedding, LinearMap.sum_apply, Finset.sum_apply, + LinearMap.comp_apply, LinearMap.single_apply, LinearMap.proj_apply, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + simp [Pi.single_apply] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +variable {m : ℕ} (J : Fin m → Type*) [∀ j, Fintype (J j)] + +noncomputable def lowTaggedRestriction (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) : + (Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) →ₗ[ℝ] (J j → ℝ) := + LinearMap.pi fun k => LinearMap.proj (lowTaggedSlot J d j hj k) + +@[simp] theorem lowTaggedRestriction_apply (d : ℕ) (j : Fin m) + (hj : j.val + 1 ≤ d) (z : Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) + (k : J j) : + lowTaggedRestriction J d j hj z k = z (lowTaggedSlot J d j hj k) := rfl + +@[simp] theorem lowTaggedRestriction_embedding (d : ℕ) (j : Fin m) + (hj : j.val + 1 ≤ d) (v : J j → ℝ) : + lowTaggedRestriction J d j hj (lowTaggedEmbedding J d j hj v) = v := by + funext k + exact lowTaggedEmbedding_apply_slot J d j hj v k + +theorem lowTaggedEmbedding_restriction (d : ℕ) (j : Fin m) + (hj : j.val + 1 ≤ d) (z : Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) : + lowTaggedEmbedding J d j hj (lowTaggedRestriction J d j hj z) = + basisGradeProjection (Pi.basisFun ℝ _) (lowTaggedWeight J d) (j.val + 1) z := by + classical + funext i + rw [pi_basisGradeProjection_apply] + by_cases hi : (lowTaggedIndex J d i).1 = j + · obtain ⟨k, rfl⟩ := lowTaggedSlot_eq_of_tag J d j hj i hi + simp [lowTaggedWeight] + · have hw : lowTaggedWeight J d i ≠ j.val + 1 := by + intro hw + apply hi + apply Fin.ext + exact Nat.add_right_cancel hw + rw [lowTaggedEmbedding_apply_of_ne J d j hj _ i hi, ite_eq_right hw] + +theorem lowTagged_comap_eq_map (d : ℕ) (j : Fin m) (hj : j.val + 1 ≤ d) + (K : Submodule ℝ (Fin (Fintype.card (LowTaggedIndex J d)) → ℝ)) + (hK : BasisGradedSubmodule (Pi.basisFun ℝ _) (lowTaggedWeight J d) K) : + K.comap (lowTaggedEmbedding J d j hj) = K.map (lowTaggedRestriction J d j hj) := by + apply le_antisymm + · intro v hv + exact ⟨lowTaggedEmbedding J d j hj v, hv, + lowTaggedRestriction_embedding J d j hj v⟩ + · rintro v ⟨z, hz, rfl⟩ + change lowTaggedEmbedding J d j hj (lowTaggedRestriction J d j hj z) ∈ K + rw [lowTaggedEmbedding_restriction] + exact hK (j.val + 1) z hz + +theorem lowTagged_comap_span_eq {A : Type*} (d : ℕ) (j : Fin m) + (hj : j.val + 1 ≤ d) + (g : A → Fin (Fintype.card (LowTaggedIndex J d)) → ℝ) + (hg : BasisGradedSubmodule (Pi.basisFun ℝ _) (lowTaggedWeight J d) + (Submodule.span ℝ (Set.range g))) : + (Submodule.span ℝ (Set.range g)).comap (lowTaggedEmbedding J d j hj) = + Submodule.span ℝ (Set.range (fun a k => g a (lowTaggedSlot J d j hj k))) := by + rw [lowTagged_comap_eq_map J d j hj _ hg, Submodule.map_span, ← Set.range_comp] + rfl + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MajorTranslationBaseCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MajorTranslationBaseCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0668fe1a9d9e9185d507630b9da25dc4a32c089 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MajorTranslationBaseCoordinates.lean @@ -0,0 +1,58 @@ +import Mathlib.Algebra.MvPolynomial.Funext +import OAI.Combinatorics.Progressions.Polynomial.MajorTranslationDegreeSymbol + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module +open scoped TensorProduct + +variable {U B : Type*} [Fintype B] + +theorem bchRealTranslationHom_base_coordinate + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (g : (weightedFiltration w d hwd).realification.Group) (i : B) : + (bchRealTranslationHom w d hwd g).base i = + ((weightedBasis w d hw).baseChange ℝ).repr g.coord (Sum.inl i) := by + obtain ⟨b, P, hb, _⟩ := realShearEmbedding_shape w d g.coord + have hact := congrArg (fun f : MvPolynomial (B ⊕ Unit) ℝ ≃ₐ[ℝ] + MvPolynomial (B ⊕ Unit) ℝ => f (X (Sum.inl i))) + (bchRealTranslationHom_action w d hwd g) + change PolynomialTranslationGroupOver.actionHom (bchRealTranslationHom w d hwd g) + (X (Sum.inl i)) = polynomialShearExp (realShearEmbedding w d g.coord) + (X (Sum.inl i)) at hact + rw [PolynomialTranslationGroupOver.actionHom_X_inl, + polynomialShearExp_X_of_derivation_eq_C _ _ _ (hb i)] at hact + have hbase : (bchRealTranslationHom w d hwd g).base i = b i := by + simpa using congrArg (fun polynomial : MvPolynomial (B ⊕ Unit) ℝ => polynomial.coeff 0) hact + have hcoord := realShearEmbedding_base_coeff w d hw g.coord i + rw [hb i] at hcoord + exact hbase.trans (by simpa using hcoord) + +theorem majorTranslationPolynomialOrbit_base_coordinate + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (D : MvPolynomial (U ⊕ B) ℝ) + (hD : D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) + (A : B → MvPolynomial U ℝ) (hA : ∀ i, (A i).totalDegree ≤ w i) (i : B) : + VectorPolynomial.coordinate + (((weightedBasis w d hw).baseChange ℝ).coord (Sum.inl i)).toAddMonoidHom + (majorTranslationPolynomialOrbit w d hw hwd D hD A hA).log = A i := by + apply MvPolynomial.funext + intro u + rw [← VectorPolynomial.coordinate_eval₂] + change ((weightedBasis w d hw).baseChange ℝ).repr + ((weightedFiltration w d hwd).realification.polynomialOrbitRealEval + (fun _ : U => 1) u (majorTranslationPolynomialOrbit w d hw hwd D hD A hA)).coord + (Sum.inl i) = eval u (A i) + rw [← bchRealTranslationHom_base_coordinate w d hw hwd, + majorTranslationPolynomialOrbit_realEval] + rfl + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MarkedDirectionCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MarkedDirectionCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9028672949fff026d0ed4d1f512f0e1e9fa49d2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MarkedDirectionCoordinates.lean @@ -0,0 +1,95 @@ +import OAI.Combinatorics.Progressions.Linear.MarkedProjectionBounds + +namespace OAI + +section + +namespace Erdos3 + +open Module VectorPolynomial + +variable {I ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (v : I → L) (w : I → ℕ) (marked : I → Bool) + (t : ℕ) + +noncomputable def markedShiftDirectionLinear : + RationalTorus.Algebra t →ₗ[ℚ] markedShiftSubalgebra F v w marked t where + toFun := markedShiftDirection F v w marked t + map_add' h k := by + apply Subtype.ext + apply LieAlgebra.SemiDirectSum.ext + · apply Subtype.ext + exact (zero_add (0 : VectorPolynomial (Fin t) ℚ L)).symm + · rfl + map_smul' a h := by + apply Subtype.ext + apply LieAlgebra.SemiDirectSum.ext + · apply Subtype.ext + exact (smul_zero a).symm + · rfl + +noncomputable def markedQuotientDirectionLinear : + RationalTorus.Algebra t →ₗ[ℚ] MarkedShiftQuotient F v w marked t := + (lieQuotientMap (markedShiftSecondIdeal F v w marked t)).toLinearMap.comp + (markedShiftDirectionLinear F v w marked t) + +variable (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.associatedDegree.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +omit [Fintype ι] in +theorem markedShiftDirection_ambient_height (i : Fin t) + (j : NilpotentLieFiltration.AdaptedBasisIndex (fun _ : Fin t => 1) ω ⊕ Fin t) : + RationalHeightLE ((F.associatedDegree.polynomialShiftBasis b ω hF t).repr + (markedShiftDirection F v w marked t (RationalTorus.basis t i)).val j) 1 := by + rcases j with z | j + · rw [F.associatedDegree.polynomialShiftBasis_repr_inl] + change RationalHeightLE (b.repr (coefficients (0 : VectorPolynomial (Fin t) ℚ L) z.val.1) z.val.2) 1 + simp only [map_zero, Finsupp.zero_apply] + exact rationalHeightLE_zero le_rfl + · rw [F.associatedDegree.polynomialShiftBasis_repr_inr] + exact basis_repr_height_one (RationalTorus.basis t) i j + +theorem markedShiftDirection_coordinate_height (hω : ∀ i, ω i ≤ s) {H : ℕ} (hH : 1 ≤ H) + (e : Basis (Fin (finrank ℚ (markedShiftSubalgebra F v w marked t))) ℚ + (markedShiftSubalgebra F v w marked t)) + (he : ∀ i j, RationalHeightLE ((F.associatedDegree.polynomialShiftBasis b ω hF t).repr + (e i).val j) H) (i : Fin t) (j : Fin (finrank ℚ (markedShiftSubalgebra F v w marked t))) : + RationalHeightLE (e.repr (markedShiftDirection F v w marked t (RationalTorus.basis t i)) j) + ((finrank ℚ (F.associatedDegree.PolynomialShiftAlgebra t) + 1) * + (rationalSolveHeight (finrank ℚ (markedShiftSubalgebra F v w marked t)) H * H) ^ + finrank ℚ (F.associatedDegree.PolynomialShiftAlgebra t)) := by + classical + let _ : Fintype (NilpotentLieFiltration.AdaptedBasisIndex (fun _ : Fin t => 1) ω) := + NilpotentLieFiltration.adaptedBasisIndexFintype (fun _ : Fin t => 1) ω s (by simp) hω + have hb := embedding_basis_coordinate_height e (F.associatedDegree.polynomialShiftBasis b ω hF t) + (markedShiftSubalgebra F v w marked t).incl.toLinearMap + (fun _ _ h => Subtype.ext h) hH (fun j i => he i j) + (markedShiftDirection F v w marked t (RationalTorus.basis t i)) + (fun j => (markedShiftDirection_ambient_height F v w marked t b ω hF i j).mono hH) j + simpa only [Fintype.card_fin, + ← finrank_eq_card_basis (F.associatedDegree.polynomialShiftBasis b ω hF t)] using hb + +theorem markedQuotientDirection_coordinate_height (hω : ∀ i, ω i ≤ s) {H Q q : ℕ} (hH : 1 ≤ H) + (e : Basis (Fin (finrank ℚ (markedShiftSubalgebra F v w marked t))) ℚ + (markedShiftSubalgebra F v w marked t)) + (he : ∀ i j, RationalHeightLE ((F.associatedDegree.polynomialShiftBasis b ω hF t).repr + (e i).val j) H) (f : Basis (Fin q) ℚ (MarkedShiftQuotient F v w marked t)) + (hf : ∀ i j, RationalHeightLE + (f.repr (lieQuotientMap (markedShiftSecondIdeal F v w marked t) (e j)) i) Q) + (i : Fin t) (j : Fin q) : + let a := finrank ℚ (F.associatedDegree.PolynomialShiftAlgebra t) + let d := finrank ℚ (markedShiftSubalgebra F v w marked t) + let B := (a + 1) * (rationalSolveHeight d H * H) ^ a + RationalHeightLE (f.repr (markedQuotientDirection F v w marked t (RationalTorus.basis t i)) j) + ((d + 1) * (B * Q) ^ d) := by + have hb := linearMap_coordinate_height e f (lieQuotientMap (markedShiftSecondIdeal F v w marked t)).toLinearMap + (fun j i => hf i j) (markedShiftDirection F v w marked t (RationalTorus.basis t i)) + (markedShiftDirection_coordinate_height F v w marked t b ω hF hω hH e he i) j + simp only [Fintype.card_fin] at hb + exact hb + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MarkedLocalObservableMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MarkedLocalObservableMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..8676cb036abbf90433dce4df6a2d3a140caa9abd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MarkedLocalObservableMetric.lean @@ -0,0 +1,286 @@ +import OAI.Combinatorics.Progressions.Estimates.MarkedLocalCoefficientValue +import OAI.Combinatorics.Progressions.Nilpotent.BCHPairCoordinateMetric + +namespace OAI + +section + +namespace Erdos3 + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +variable {I L : Type*} [LieRing L] [LieAlgebra ℚ L] {s r d : ℕ} + (F : DegreeRankLieFiltration L s r) (v : I → L) (w : I → ℕ) (marked : I → Bool) + (t m : ℕ) (e : Basis (Fin d) ℚ (MarkedShiftQuotient F v w marked t)) + +theorem realMarkedParameterDirection_coordinate_norm_le {p : ℝ} + (ht : (t : ℝ) ≤ p) + (hdir : ∀ i j, rationalLogHeight + (e.repr (markedQuotientDirection F v w marked t (RationalTorus.basis t i)) j) ≤ p) + (a : Fin t → ℝ) : + ‖(e.baseChange ℝ).equivFun (realMarkedParameterDirection F v w marked t a)‖ ≤ + Real.exp (2 * p) * ‖a‖ := by + have hentries (i : Fin t) (j : Fin d) : + |(e.repr (markedQuotientDirection F v w marked t (Pi.single i 1)) j : ℝ)| ≤ Real.exp p := by + have hi : (RationalTorus.basis t i : Fin t → ℚ) = Pi.single i 1 := Pi.basisFun_apply ℚ (Fin t) i + have h := hdir i j + rw [hi] at h + exact (rational_abs_real_le_numerator _).trans ((rationalLogHeight_le_iff _ _).mp h).1 + have hnorm : ‖(e.baseChange ℝ).equivFun (realMarkedParameterDirection F v w marked t a)‖ ≤ + (t : ℝ) * ‖a‖ * Real.exp p := by + apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr + intro j + exact realMarkedParameterDirection_coordinate_le F v w marked t e a (norm_nonneg _) + (fun i => by simpa only [Real.norm_eq_abs] using norm_le_pi_norm a i) hentries j + apply hnorm.trans + have ht' : (t : ℝ) ≤ Real.exp p := ht.trans (by linarith [Real.add_one_le_exp p]) + calc + (t : ℝ) * ‖a‖ * Real.exp p ≤ Real.exp p * ‖a‖ * Real.exp p := by gcongr + _ = Real.exp (2 * p) * ‖a‖ := by rw [show 2 * p = p + p by ring, Real.exp_add]; ring + +theorem normalizedMarkedPhase_coordinate_norm_le {p : ℝ} + (hd : (d : ℝ) ≤ p) + (hphase : ∀ i j, rationalLogHeight (normalizedMarkedPhase F v w marked t m (e j) i) ≤ p) + (x : ℝ ⊗[ℚ] MarkedShiftQuotient F v w marked t) : + ‖torusPhaseLinear (normalizedMarkedPhase F v w marked t m) x‖ ≤ + Real.exp (2 * p) * ‖(e.baseChange ℝ).equivFun x‖ := by + exact scalarExtension_coordinate_norm_le e (RationalTorus.basis t) + (normalizedMarkedPhase F v w marked t m).toLinearMap + (by simpa only [Fintype.card_fin] using hd) + (fun i j => by + change rationalLogHeight (normalizedMarkedPhase F v w marked t m (e j) i) ≤ p + exact hphase i j) x + +noncomputable def markedPhaseRemovalLinear : + (ℝ ⊗[ℚ] MarkedShiftQuotient F v w marked t) →ₗ[ℝ] + (ℝ ⊗[ℚ] MarkedShiftQuotient F v w marked t) := + (realMarkedParameterDirection F v w marked t).comp + ((m : ℝ) • (-torusPhaseLinear (normalizedMarkedPhase F v w marked t m))) + +theorem markedPhaseRemovalLinear_apply (x : ℝ ⊗[ℚ] MarkedShiftQuotient F v w marked t) : + markedPhaseRemovalLinear F v w marked t m x = + realMarkedParameterDirection F v w marked t + ((m : ℝ) • -(torusPhaseLinear (normalizedMarkedPhase F v w marked t m) x)) := rfl + +theorem markedPhaseRemovalLinear_coordinate_norm_le {p : ℝ} + (hd : (d : ℝ) ≤ p) (ht : (t : ℝ) ≤ p) (hm : (m : ℝ) ≤ Real.exp p) + (hdir : ∀ i j, rationalLogHeight + (e.repr (markedQuotientDirection F v w marked t (RationalTorus.basis t i)) j) ≤ p) + (hphase : ∀ i j, rationalLogHeight (normalizedMarkedPhase F v w marked t m (e j) i) ≤ p) + (x : ℝ ⊗[ℚ] MarkedShiftQuotient F v w marked t) : + ‖(e.baseChange ℝ).equivFun (markedPhaseRemovalLinear F v w marked t m x)‖ ≤ + Real.exp (5 * p) * ‖(e.baseChange ℝ).equivFun x‖ := by + rw [markedPhaseRemovalLinear_apply] + apply (realMarkedParameterDirection_coordinate_norm_le F v w marked t e ht hdir _).trans + rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (Nat.cast_nonneg m), norm_neg] + calc + Real.exp (2 * p) * ((m : ℝ) * ‖torusPhaseLinear (normalizedMarkedPhase F v w marked t m) x‖) ≤ + Real.exp (2 * p) * (Real.exp p * (Real.exp (2 * p) * ‖(e.baseChange ℝ).equivFun x‖)) := by + gcongr + exact normalizedMarkedPhase_coordinate_norm_le F v w marked t m e hd hphase x + _ = _ := by + rw [← mul_assoc, ← mul_assoc, ← Real.exp_add, ← Real.exp_add] + congr 2 + ring + +theorem markedPhaseRemovalLinear_coordinate_dist_le {p : ℝ} + (hd : (d : ℝ) ≤ p) (ht : (t : ℝ) ≤ p) (hm : (m : ℝ) ≤ Real.exp p) + (hdir : ∀ i j, rationalLogHeight + (e.repr (markedQuotientDirection F v w marked t (RationalTorus.basis t i)) j) ≤ p) + (hphase : ∀ i j, rationalLogHeight (normalizedMarkedPhase F v w marked t m (e j) i) ≤ p) + (x y : ℝ ⊗[ℚ] MarkedShiftQuotient F v w marked t) : + dist ((e.baseChange ℝ).equivFun (markedPhaseRemovalLinear F v w marked t m x)) + ((e.baseChange ℝ).equivFun (markedPhaseRemovalLinear F v w marked t m y)) ≤ + Real.exp (5 * p) * dist ((e.baseChange ℝ).equivFun x) ((e.baseChange ℝ).equivFun y) := by + simpa only [map_sub, ← dist_eq_norm] using + markedPhaseRemovalLinear_coordinate_norm_le F v w marked t m e hd ht hm hdir hphase (x - y) + +variable (hw : ∀ i, 0 < w i) (hv : ∀ i, v i ∈ F.layer (w i) 1) + (D : RationalFilteredNilmanifold (MarkedShiftQuotient F v w marked t) (s + 1) d) + +theorem normalizedMarkedRetraction_coord (g : D.RealGroup) : + (normalizedMarkedRetraction F v w marked hw hv t m D g).coord = + lieBCH (s + 1) (markedPhaseRemovalLinear F v w marked t m g.coord) g.coord := rfl + +theorem normalizedMarkedRetraction_coordinate_dist_le {p B : ℝ} {H : ℕ} + (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) (ht : (t : ℝ) ≤ p) (hm : (m : ℝ) ≤ Real.exp p) + (hdir : ∀ i j, rationalLogHeight + (D.basis.repr (markedQuotientDirection F v w marked t (RationalTorus.basis t i)) j) ≤ p) + (hphase : ∀ i j, rationalLogHeight (normalizedMarkedPhase F v w marked t m (D.basis j) i) ≤ p) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants D.basis i j k) H) + (hB : 1 ≤ B) (g h : D.RealGroup) + (hg : ‖(D.basis.baseChange ℝ).equivFun g.coord‖ ≤ B) + (hh : ‖(D.basis.baseChange ℝ).equivFun h.coord‖ ≤ B) : + dist ((D.basis.baseChange ℝ).equivFun (normalizedMarkedRetraction F v w marked hw hv t m D g).coord) + ((D.basis.baseChange ℝ).equivFun (normalizedMarkedRetraction F v w marked hw hv t m D h).coord) ≤ + (bchBoxCoordinateBound (s + 1) d H (Real.exp (5 * p) * B) * Real.exp (5 * p)) * + dist ((D.basis.baseChange ℝ).equivFun g.coord) ((D.basis.baseChange ℝ).equivFun h.coord) := by + let A := Real.exp (5 * p) + have hA : 1 ≤ A := Real.one_le_exp (by positivity) + have hBA : B ≤ A * B := by nlinarith + have hbox (x : D.RealGroup) (hx : ‖(D.basis.baseChange ℝ).equivFun x.coord‖ ≤ B) : + ‖(D.basis.baseChange ℝ).equivFun (markedPhaseRemovalLinear F v w marked t m x.coord)‖ ≤ A * B := + (markedPhaseRemovalLinear_coordinate_norm_le F v w marked t m D.basis hd ht hm hdir hphase x.coord).trans + (mul_le_mul_of_nonneg_left hx (Real.exp_nonneg _)) + rw [normalizedMarkedRetraction_coord, normalizedMarkedRetraction_coord, mul_assoc] + have hbch := lieBCH_pair_coordinate_dist_le (s := s + 1) + (D.basis.baseChange ℝ) (lieStructureConstants D.basis) + (fun i j k => (realLieBasis_structure D.basis i j k).symm) hc + _ _ _ _ (hB.trans hBA) (by positivity) + (hbox g hg) (hg.trans hBA) (hbox h hh) (hh.trans hBA) + (markedPhaseRemovalLinear_coordinate_dist_le F v w marked t m D.basis hd ht hm hdir hphase _ _) + (le_mul_of_one_le_left dist_nonneg hA) + simpa only [Fintype.card_fin] using hbch + +theorem normalizedMarkedRetraction_coordinate_norm_le {p B : ℝ} {H : ℕ} + (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) (ht : (t : ℝ) ≤ p) (hm : (m : ℝ) ≤ Real.exp p) + (hdir : ∀ i j, rationalLogHeight + (D.basis.repr (markedQuotientDirection F v w marked t (RationalTorus.basis t i)) j) ≤ p) + (hphase : ∀ i j, rationalLogHeight (normalizedMarkedPhase F v w marked t m (D.basis j) i) ≤ p) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants D.basis i j k) H) + (hB : 1 ≤ B) (g : D.RealGroup) + (hg : ‖(D.basis.baseChange ℝ).equivFun g.coord‖ ≤ B) : + ‖(D.basis.baseChange ℝ).equivFun (normalizedMarkedRetraction F v w marked hw hv t m D g).coord‖ ≤ + (bchBoxCoordinateBound (s + 1) d H (Real.exp (5 * p) * B) * Real.exp (5 * p)) * B := by + have hzero : normalizedMarkedRetraction F v w marked hw hv t m D 1 = 1 := by + apply NilpotentLieBCHGroup.ext + rw [normalizedMarkedRetraction_coord, coord_one, map_zero, + lieBCH_zero_left D.filtration.realification.lowerCentralSeries_eq_bot] + have h := normalizedMarkedRetraction_coordinate_dist_le F v w marked t m hw hv D + hp hd ht hm hdir hphase hc hB g 1 hg (by simpa using (show (0 : ℝ) ≤ B by linarith)) + rw [hzero, coord_one, map_zero, dist_zero_right, dist_zero_right] at h + exact h.trans (mul_le_mul_of_nonneg_left hg (mul_nonneg + (bchBoxCoordinateBound_nonneg _ _ _ (mul_nonneg (Real.exp_nonneg _) (by linarith))) (Real.exp_nonneg _))) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +noncomputable def markedRetractionBoxConstant (s d H : ℕ) (p : ℝ) (B : ℝ≥0) : ℝ≥0 := + ⟨bchBoxCoordinateBound (s + 1) d H (Real.exp (5 * p) * B) * Real.exp (5 * p), + mul_nonneg (bchBoxCoordinateBound_nonneg _ _ _ (mul_nonneg (Real.exp_nonneg _) B.coe_nonneg)) + (Real.exp_nonneg _)⟩ + +noncomputable def markedEvaluationBoxRadius (s d H : ℕ) (p : ℝ) (B : ℝ≥0) : ℝ≥0 := + ⟨Real.exp (2 * p), Real.exp_nonneg _⟩ * markedRetractionBoxConstant s d H p B * B + 1 + +noncomputable def markedLocalBoxConstant (s d H u e Ht : ℕ) (p : ℝ) (B ℓ : ℝ≥0) : ℝ≥0 := + ℓ * bchBoxMetricConstant u e Ht (markedEvaluationBoxRadius s d H p B) * + ⟨Real.exp (2 * p), Real.exp_nonneg _⟩ * markedRetractionBoxConstant s d H p B + +variable {I L : Type*} [LieRing L] [LieAlgebra ℚ L] {s r d e u : ℕ} + (F : DegreeRankLieFiltration L s r) (v : I → L) (w : I → ℕ) (marked : I → Bool) + (hw : ∀ i, 0 < w i) (hv : ∀ i, v i ∈ F.layer (w i) 1) (t m : ℕ) (hm : 0 < m) + (D : RationalFilteredNilmanifold (MarkedShiftQuotient F v w marked t) (s + 1) d) + (J : LieIdeal ℚ L) (hJ : markedLieSpan v w marked 0 2 0 ≤ J.toSubmodule) + (E : RationalFilteredNilmanifold (L ⧸ J) u e) + (hmap : ∀ z : D.RealGroup, z ∈ D.realLattice → + (⟨(markedBaseEvaluation F v w marked t J hJ 0).baseChange ℝ z.coord⟩ : E.RealGroup) ∈ E.realLattice) + +theorem markedLocalCoefficientValue_norm_le (V : E.Space → ℂ) (hV : ∀ x, ‖V x‖ ≤ 1) (g : D.RealGroup) : + ‖markedLocalCoefficientValue F v w marked hw hv t m hm D J hJ E hmap V g‖ ≤ 1 := hV _ + +variable [TopologicalSpace (ℝ ⊗[ℚ] (L ⧸ J))] [IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ J))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (L ⧸ J))] [T2Space (ℝ ⊗[ℚ] (L ⧸ J))] + +theorem markedLocalCoefficientValue_coordinate_dist_le {p : ℝ} {H Ht : ℕ} + (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) (ht : (t : ℝ) ≤ p) (hmp : (m : ℝ) ≤ Real.exp p) + (hdir : ∀ i j, rationalLogHeight + (D.basis.repr (markedQuotientDirection F v w marked t (RationalTorus.basis t i)) j) ≤ p) + (hphase : ∀ i j, rationalLogHeight (normalizedMarkedPhase F v w marked t m (D.basis j) i) ≤ p) + (heval : ∀ i j, rationalLogHeight (E.basis.repr + (markedBaseEvaluation F v w marked t J hJ 0 (D.basis j)) i) ≤ p) + (hc : ∀ i j k, RationalHeightLE (lieStructureConstants D.basis i j k) H) + (hct : ∀ i j k, RationalHeightLE (lieStructureConstants E.basis i j k) Ht) + (B ℓ : ℝ≥0) (hB : 1 ≤ B) (V : E.Space → ℂ) + (hV : letI := E.metricSpace; LipschitzWith ℓ V) + (g h : D.RealGroup) + (hg : ‖(D.basis.baseChange ℝ).equivFun g.coord‖ ≤ B) + (hh : ‖(D.basis.baseChange ℝ).equivFun h.coord‖ ≤ B) : + dist (markedLocalCoefficientValue F v w marked hw hv t m hm D J hJ E hmap V g) + (markedLocalCoefficientValue F v w marked hw hv t m hm D J hJ E hmap V h) ≤ + markedLocalBoxConstant s d H u e Ht p B ℓ * + dist ((D.basis.baseChange ℝ).equivFun g.coord) ((D.basis.baseChange ℝ).equivFun h.coord) := by + let := rightMetricSpace (hnil := E.filtration.realification.lowerCentralSeries_eq_bot) (E.basis.baseChange ℝ) + let := E.metricSpace + let q := markedBaseEvaluation F v w marked t J hJ 0 + let a (x : D.RealGroup) : E.RealGroup := + ⟨q.baseChange ℝ (normalizedMarkedRetraction F v w marked hw hv t m D x).coord⟩ + let R := markedRetractionBoxConstant s d H p B + let T := markedEvaluationBoxRadius s d H p B + let Δ := dist ((D.basis.baseChange ℝ).equivFun g.coord) ((D.basis.baseChange ℝ).equivFun h.coord) + have hT : 1 ≤ T := by + dsimp only [T, markedEvaluationBoxRadius] + exact le_add_of_nonneg_left (by positivity) + have hB' : (1 : ℝ) ≤ B := hB + have hnorm (x : D.RealGroup) (hx : ‖(D.basis.baseChange ℝ).equivFun x.coord‖ ≤ B) : + ‖(E.basis.baseChange ℝ).equivFun (a x).coord‖ ≤ T := by + have hr := normalizedMarkedRetraction_coordinate_norm_le F v w marked t m hw hv D + hp hd ht hmp hdir hphase hc hB' x hx + have he := scalarExtension_coordinate_norm_le D.basis E.basis q + (by simpa only [Fintype.card_fin] using hd) heval + (normalizedMarkedRetraction F v w marked hw hv t m D x).coord + change ‖(E.basis.baseChange ℝ).equivFun (a x).coord‖ ≤ + Real.exp (2 * p) * (R : ℝ) * B + 1 + calc + _ ≤ Real.exp (2 * p) * ‖(D.basis.baseChange ℝ).equivFun + (normalizedMarkedRetraction F v w marked hw hv t m D x).coord‖ := he + _ ≤ Real.exp (2 * p) * ((R : ℝ) * B) := mul_le_mul_of_nonneg_left hr (Real.exp_nonneg _) + _ ≤ _ := by ring_nf; linarith + have hevaldist : dist ((E.basis.baseChange ℝ).equivFun (a g).coord) + ((E.basis.baseChange ℝ).equivFun (a h).coord) ≤ Real.exp (2 * p) * (R : ℝ) * Δ := by + have hr := normalizedMarkedRetraction_coordinate_dist_le F v w marked t m hw hv D + hp hd ht hmp hdir hphase hc hB' g h hg hh + have he := scalarExtension_coordinate_dist_le D.basis E.basis q + (by simpa only [Fintype.card_fin] using hd) heval + (normalizedMarkedRetraction F v w marked hw hv t m D g).coord + (normalizedMarkedRetraction F v w marked hw hv t m D h).coord + exact he.trans ((mul_le_mul_of_nonneg_left hr (Real.exp_nonneg _)).trans_eq (mul_assoc _ _ _).symm) + have hgroup : dist (a g) (a h) ≤ bchBoxMetricConstant u e Ht T * (Real.exp (2 * p) * (R : ℝ) * Δ) := by + have hb := dist_le_bchBoxMetricConstant (E.basis.baseChange ℝ) (lieStructureConstants E.basis) + (fun i j k => (realLieBasis_structure E.basis i j k).symm) hct T hT + (show 0 ≤ Real.exp (2 * p) * (R : ℝ) * Δ by dsimp [Δ]; positivity) (a g) (a h) + (fun i => by + calc + _ ≤ ‖(E.basis.baseChange ℝ).equivFun (a g).coord‖ := by + simpa only [Real.norm_eq_abs, Basis.equivFun_apply] using + norm_le_pi_norm ((E.basis.baseChange ℝ).equivFun (a g).coord) i + _ ≤ T := hnorm g hg) + (fun i => by + calc + _ ≤ ‖(E.basis.baseChange ℝ).equivFun (a h).coord‖ := by + simpa only [Real.norm_eq_abs, Basis.equivFun_apply] using + norm_le_pi_norm ((E.basis.baseChange ℝ).equivFun (a h).coord) i + _ ≤ T := hnorm h hh) + (fun i => by + calc + _ ≤ dist ((E.basis.baseChange ℝ).equivFun (a g).coord) + ((E.basis.baseChange ℝ).equivFun (a h).coord) := by + simpa only [Real.dist_eq, Basis.equivFun_apply] using + dist_le_pi_dist ((E.basis.baseChange ℝ).equivFun (a g).coord) + ((E.basis.baseChange ℝ).equivFun (a h).coord) i + _ ≤ _ := hevaldist) + simpa only [Fintype.card_fin] using hb + have hproj := quotientMetricSpace_lipschitz_mk (E.basis.baseChange ℝ) E.realLattice E.realLattice_closed_discrete.1 + have hvalue := (hV.comp hproj).dist_le_mul (a g) (a h) + simp only [Function.comp_apply, mul_one] at hvalue + change dist (V (QuotientGroup.mk (a g))) (V (QuotientGroup.mk (a h))) ≤ _ + apply hvalue.trans + apply (mul_le_mul_of_nonneg_left hgroup ℓ.coe_nonneg).trans_eq + change (ℓ : ℝ) * ((bchBoxMetricConstant u e Ht T : ℝ) * (Real.exp (2 * p) * (R : ℝ) * Δ)) = + (((ℓ : ℝ) * (bchBoxMetricConstant u e Ht T : ℝ) * Real.exp (2 * p)) * (R : ℝ)) * Δ + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MetricOpenCharts.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MetricOpenCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..97c6d6c8211e9568fb59f1d607f55227d6baead5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MetricOpenCharts.lean @@ -0,0 +1,36 @@ +import Mathlib.Topology.MetricSpace.Lipschitz +import Mathlib.Topology.OpenPartialHomeomorph.Basic + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_openPartialHomeomorph_of_metric_bounds + {X Y : Type*} [MetricSpace X] [MetricSpace Y] [Nonempty X] + (f : X → Y) (hf : Continuous f) (ho : IsOpenMap f) (U : Set X) (hU : IsOpen U) (K : ℝ≥0) + (hupper : ∀ x ∈ U, ∀ y ∈ U, dist (f x) (f y) ≤ K * dist x y) + (hlower : ∀ x ∈ U, ∀ y ∈ U, dist x y ≤ K * dist (f x) (f y)) : + ∃ e : OpenPartialHomeomorph X Y, (∀ x, e x = f x) ∧ e.source = U ∧ e.target = f '' U ∧ + LipschitzOnWith K e e.source ∧ LipschitzOnWith K e.symm e.target := by + have hinj : Set.InjOn f U := by + intro x hx y hy hxy + apply dist_eq_zero.mp + exact le_antisymm (by simpa only [hxy, dist_self, mul_zero] using hlower x hx y hy) dist_nonneg + let e := OpenPartialHomeomorph.ofContinuousOpen (hinj.toPartialEquiv f U) hf.continuousOn ho hU + refine ⟨e, fun _ => rfl, rfl, rfl, ?_, ?_⟩ + · exact LipschitzOnWith.of_dist_le_mul hupper + · apply LipschitzOnWith.of_dist_le_mul + intro x hx y hy + have h := hlower (e.symm x) (e.map_target hx) (e.symm y) (e.map_target hy) + change dist (e.symm x) (e.symm y) ≤ K * dist (e (e.symm x)) (e (e.symm y)) at h + simpa only [e.right_inv hx, e.right_inv hy] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MinkowskiSecondBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MinkowskiSecondBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..b25b74f826e6d26fc670f1f99853193e58dd3f59 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MinkowskiSecondBox.lean @@ -0,0 +1,316 @@ +import Mathlib.Algebra.Module.ZLattice.Covolume +import OAI.Combinatorics.Progressions.Estimates.PrimitiveExtension +import OAI.Combinatorics.Progressions.Geometry.BoxCertificate + +namespace OAI + +section + +namespace Erdos3.BohrLattice.MinkowskiSecondBox + +open scoped BigOperators Matrix +open Erdos3.BohrLattice.BoxCertificate Set Module Submodule + +noncomputable def minkowskiSecondConstant (n : ℕ) : ℝ := + (2 : ℝ) ^ (n * (n - 1) / 2) + +@[simp] theorem minkowskiSecondConstant_zero : minkowskiSecondConstant 0 = 1 := by + simp [minkowskiSecondConstant] + +@[simp] theorem minkowskiSecondConstant_one : minkowskiSecondConstant 1 = 1 := by + simp [minkowskiSecondConstant] + +theorem minkowskiSecondConstant_nonneg (n : ℕ) : + 0 ≤ minkowskiSecondConstant n := by + exact pow_nonneg (by norm_num) _ + +theorem exists_shortest_nonzero_of_basis {n : ℕ} + (b : Basis (Fin (n + 1)) ℝ (Fin (n + 1) → ℝ)) : + ∃ v : Fin (n + 1) → ℝ, + v ∈ Submodule.span ℤ (Set.range b) ∧ v ≠ 0 ∧ + ∀ x ∈ Submodule.span ℤ (Set.range b), x ≠ 0 → ‖v‖ ≤ ‖x‖ := by + classical + let e : Fin (n + 1) := 0 + have hbe_mem : b e ∈ Submodule.span ℤ (Set.range b) := + Submodule.subset_span ⟨e, rfl⟩ + have hbe_ne : b e ≠ 0 := b.ne_zero e + let S : Set (Fin (n + 1) → ℝ) := + Metric.closedBall 0 ‖b e‖ ∩ Submodule.span ℤ (Set.range b) + have hSfin : S.Finite := by + exact ZSpan.setFinite_inter b Metric.isBounded_closedBall + let T : Set (Fin (n + 1) → ℝ) := {x ∈ S | x ≠ 0} + have hTfin : T.Finite := hSfin.subset (by intro x hx; exact hx.1) + have hbeS : b e ∈ S := by + refine ⟨?_, hbe_mem⟩ + simp + have hTne : T.Nonempty := ⟨b e, hbeS, hbe_ne⟩ + obtain ⟨v, hvT, hvmin⟩ := Set.exists_min_image T norm hTfin hTne + refine ⟨v, hvT.1.2, hvT.2, ?_⟩ + intro x hxL hx0 + by_cases hxle : ‖x‖ ≤ ‖b e‖ + · exact hvmin x ⟨⟨by simpa [Metric.mem_closedBall] using hxle, hxL⟩, hx0⟩ + · have hvle : ‖v‖ ≤ ‖b e‖ := by + simpa only [Metric.mem_closedBall, dist_zero_right] using hvT.1.1 + exact hvle.trans (le_of_not_ge hxle) + +theorem abs_det_zspan_basis_eq {n : ℕ} + (b : Basis (Fin n) ℝ (Fin n → ℝ)) + (B : Basis (Fin n) ℤ (span ℤ (Set.range b))) : + |(Matrix.of (((↑) : span ℤ (Set.range b) → (Fin n → ℝ)) ∘ B)).det| = + |(Matrix.of b).det| := by + let L : Submodule ℤ (Fin n → ℝ) := span ℤ (Set.range b) + have hB := ZLattice.covolume_eq_det L B + have hb := ZLattice.covolume_eq_det L + (Erdos3.BohrLattice.PrimitiveExtension.zspanBasis b) + calc + |(Matrix.of (((↑) : L → (Fin n → ℝ)) ∘ B)).det| = + ZLattice.covolume L := hB.symm + _ = |(Matrix.of (((↑) : L → (Fin n → ℝ)) ∘ + Erdos3.BohrLattice.PrimitiveExtension.zspanBasis b)).det| := hb + _ = |(Matrix.of b).det| := by + congr 2 + ext i j + simp [L] + +def intCastVec {n : ℕ} (z : Fin n → ℤ) : Fin n → ℝ := + fun i ↦ (z i : ℝ) + +@[simp] theorem intCastVec_zero {n : ℕ} : + intCastVec (0 : Fin n → ℤ) = 0 := by + funext i + simp [intCastVec] + +@[simp] theorem intCastVec_add {n : ℕ} (z w : Fin n → ℤ) : + intCastVec (z + w) = intCastVec z + intCastVec w := by + funext i + simp [intCastVec] + +@[simp] theorem intCastVec_smul {n : ℕ} (a : ℤ) (z : Fin n → ℤ) : + intCastVec (a • z) = (a : ℝ) • intCastVec z := by + funext i + simp [intCastVec] + +theorem mem_realBox_const_iff_norm_le {n : ℕ} {s : ℝ} (hs : 0 ≤ s) + (x : Fin n → ℝ) : + x ∈ realBox (fun _ ↦ s) ↔ ‖x‖ ≤ s := by + rw [pi_norm_le_iff_of_nonneg hs] + constructor + · intro hx i + rw [Real.norm_eq_abs, abs_le] + exact ⟨hx.1 i, hx.2 i⟩ + · intro hx + constructor <;> intro i + · have hi := hx i + rw [Real.norm_eq_abs, abs_le] at hi + exact hi.1 + · have hi := hx i + rw [Real.norm_eq_abs, abs_le] at hi + exact hi.2 + +theorem reducedLift_norm_le_two {n : ℕ} (v w : Fin n → ℝ) (a : ℝ) + (ha : |a| ≤ (1 : ℝ) / 2) (hshort : ‖v‖ ≤ ‖w + a • v‖) : + ‖w + a • v‖ ≤ 2 * ‖w‖ := by + have htri : ‖w + a • v‖ ≤ ‖w‖ + |a| * ‖v‖ := by + simpa [norm_smul, Real.norm_eq_abs] using norm_add_le w (a • v) + have hav : |a| * ‖v‖ ≤ ((1 : ℝ) / 2) * ‖v‖ := + mul_le_mul_of_nonneg_right ha (norm_nonneg v) + have hvw : ‖v‖ ≤ 2 * ‖w‖ := by linarith + calc + ‖w + a • v‖ ≤ ‖w‖ + |a| * ‖v‖ := htri + _ ≤ ‖w‖ + ((1 : ℝ) / 2) * ‖v‖ := by linarith + _ ≤ 2 * ‖w‖ := by linarith + +theorem shortest_le_two_projection {n : ℕ} (v w : Fin n → ℝ) (a : ℝ) + (ha : |a| ≤ (1 : ℝ) / 2) (hshort : ‖v‖ ≤ ‖w + a • v‖) : + ‖v‖ ≤ 2 * ‖w‖ := by + exact hshort.trans (reducedLift_norm_le_two v w a ha hshort) + +noncomputable def roundedCoefficient (a : ℝ) : ℤ := round a + +theorem abs_sub_roundedCoefficient_le_half (a : ℝ) : + |a - (roundedCoefficient a : ℝ)| ≤ (1 : ℝ) / 2 := by + simpa [roundedCoefficient] using abs_sub_round a + +noncomputable def deleteProjection {n : ℕ} (h : Fin (n + 1)) + (v x : Fin (n + 1) → ℝ) : Fin n → ℝ := + fun i ↦ x (h.succAbove i) - (x h / v h) * v (h.succAbove i) + +noncomputable def deleteProjectionLinear {n : ℕ} (h : Fin (n + 1)) + (v : Fin (n + 1) → ℝ) : + (Fin (n + 1) → ℝ) →ₗ[ℝ] (Fin n → ℝ) where + toFun := deleteProjection h v + map_add' x y := by + funext i + simp only [deleteProjection, Pi.add_apply] + ring + map_smul' a x := by + funext i + simp [deleteProjection] + ring + +@[simp] theorem deleteProjectionLinear_apply {n : ℕ} (h : Fin (n + 1)) + (v x : Fin (n + 1) → ℝ) : + deleteProjectionLinear h v x = deleteProjection h v x := rfl + +theorem deleteProjection_add_smul {n : ℕ} (h : Fin (n + 1)) + (v x : Fin (n + 1) → ℝ) (a : ℝ) (hvh : v h ≠ 0) : + deleteProjection h v (x + a • v) = deleteProjection h v x := by + funext i + simp only [deleteProjection, Pi.add_apply, Pi.smul_apply, smul_eq_mul] + field_simp + ring + +theorem deleteProjection_self {n : ℕ} (h : Fin (n + 1)) + (v : Fin (n + 1) → ℝ) (hvh : v h ≠ 0) : + deleteProjection h v v = 0 := by + funext i + simp [deleteProjection, hvh] + +theorem abs_apply_le_norm {n : ℕ} (x : Fin n → ℝ) (i : Fin n) : + |x i| ≤ ‖x‖ := by + have hi := (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mp (le_refl ‖x‖) i + simpa only [Real.norm_eq_abs] using hi + +theorem reducedLift_apply_le {n : ℕ} (h : Fin (n + 1)) + (v x : Fin (n + 1) → ℝ) (t a : ℝ) + (hh : |v h| = ‖v‖) (hvh : v h ≠ 0) + (ha : |x h / v h + a| ≤ (1 : ℝ) / 2) + (hx : ‖deleteProjection h v x‖ ≤ t) : + ‖x + a • v‖ ≤ t + ‖v‖ / 2 := by + have ht : 0 ≤ t := (norm_nonneg _).trans hx + rw [pi_norm_le_iff_of_nonneg (add_nonneg ht (by positivity))] + rw [h.forall_iff_succAbove] + constructor + · simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Real.norm_eq_abs] + have heq : x h + a * v h = (x h / v h + a) * v h := by + field_simp + rw [heq, abs_mul, hh] + calc + |x h / v h + a| * ‖v‖ ≤ ((1 : ℝ) / 2) * ‖v‖ := + mul_le_mul_of_nonneg_right ha (norm_nonneg v) + _ ≤ t + ‖v‖ / 2 := by linarith + · intro j + have hproj : |deleteProjection h v x j| ≤ t := by + simpa only [Real.norm_eq_abs] using + (abs_apply_le_norm (deleteProjection h v x) j).trans hx + have hv : |v (h.succAbove j)| ≤ ‖v‖ := + abs_apply_le_norm v (h.succAbove j) + simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Real.norm_eq_abs] + have hdecomp : x (h.succAbove j) + a * v (h.succAbove j) = + deleteProjection h v x j + + (x h / v h + a) * v (h.succAbove j) := by + rw [deleteProjection] + ring + rw [hdecomp] + calc + |deleteProjection h v x j + (x h / v h + a) * v (h.succAbove j)| ≤ + |deleteProjection h v x j| + + |x h / v h + a| * |v (h.succAbove j)| := by + simpa only [abs_mul] using + abs_add_le (deleteProjection h v x j) + ((x h / v h + a) * v (h.succAbove j)) + _ ≤ t + ((1 : ℝ) / 2) * ‖v‖ := by + exact add_le_add hproj + (mul_le_mul ha hv (abs_nonneg _) (by norm_num)) + _ = t + ‖v‖ / 2 := by ring + +noncomputable def tailShear {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) : + Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ := + fun i j ↦ + if j = 0 then (if i = 0 then 1 else 0) + else if i = 0 then -(B h j / B h 0) + else if i = j then 1 else 0 + +@[simp] theorem tailShear_apply_zero_zero {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) : + tailShear h B 0 0 = 1 := by simp [tailShear] + +@[simp] theorem tailShear_apply_succ_zero {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (i : Fin n) : + tailShear h B i.succ 0 = 0 := by simp [tailShear] + +@[simp] theorem tailShear_apply_zero_succ {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (j : Fin n) : + tailShear h B 0 j.succ = -(B h j.succ / B h 0) := by simp [tailShear] + +@[simp] theorem tailShear_apply_succ_succ {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (i j : Fin n) : + tailShear h B i.succ j.succ = if i = j then 1 else 0 := by + simp [tailShear] + +theorem tailShear_det {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) : + (tailShear h B).det = 1 := by + rw [Matrix.det_of_isUpperTriangular] + · apply Finset.prod_eq_one + intro i _ + by_cases hi : i = 0 + · subst i + simp [tailShear] + · simp [tailShear, hi] + · intro i j hji + have hi0 : i ≠ 0 := by + intro hi + subst i + exact (not_lt_of_ge (Fin.zero_le j)) hji + have hij : i ≠ j := ne_of_gt hji + simp [tailShear, hi0, hij] + +noncomputable def projectedTail {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) : Matrix (Fin n) (Fin n) ℝ := + fun i j ↦ B (h.succAbove i) j.succ - + (B h j.succ / B h 0) * B (h.succAbove i) 0 + +theorem mul_tailShear_apply_zero {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (i : Fin (n + 1)) : + (B * tailShear h B) i 0 = B i 0 := by + simp [Matrix.mul_apply, tailShear] + +theorem mul_tailShear_apply_succ {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (i : Fin (n + 1)) + (j : Fin n) : + (B * tailShear h B) i j.succ = + B i j.succ - (B h j.succ / B h 0) * B i 0 := by + simp [Matrix.mul_apply, Fin.sum_univ_succ, tailShear] + ring + +theorem mul_tailShear_pivot_succ {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (hB : B h 0 ≠ 0) + (j : Fin n) : + (B * tailShear h B) h j.succ = 0 := by + rw [mul_tailShear_apply_succ] + field_simp + ring + +theorem mul_tailShear_minor {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) : + (B * tailShear h B).submatrix h.succAbove Fin.succ = projectedTail h B := by + ext i j + simp [projectedTail, mul_tailShear_apply_succ] + +theorem abs_det_eq_abs_pivot_mul_abs_det_projectedTail {n : ℕ} + (h : Fin (n + 1)) (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) + (hB : B h 0 ≠ 0) : + |B.det| = |B h 0| * |(projectedTail h B).det| := by + have hdetC : (B * tailShear h B).det = B.det := by + simp [Matrix.det_mul, tailShear_det] + have hminor : + (B * tailShear h B).submatrix h.succAbove (Fin.succAbove 0) = + projectedTail h B := by + simpa using mul_tailShear_minor h B + have hLaplace := Matrix.det_succ_row (B * tailShear h B) h + rw [Fin.sum_univ_succ] at hLaplace + rw [mul_tailShear_apply_zero] at hLaplace + simp_rw [mul_tailShear_pivot_succ h B hB] at hLaplace + simp only [mul_zero, zero_mul, Finset.sum_const_zero, add_zero] at hLaplace + rw [hdetC] at hLaplace + rw [hminor] at hLaplace + rw [hLaplace, abs_mul, abs_mul] + simp only [abs_pow, abs_neg, abs_one, one_pow, one_mul] + +end Erdos3.BohrLattice.MinkowskiSecondBox + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MinkowskiSecondBoxGlue.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MinkowskiSecondBoxGlue.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ffd74955f2e247ca1117093d82295b41a785818 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MinkowskiSecondBoxGlue.lean @@ -0,0 +1,429 @@ +import OAI.Combinatorics.Progressions.Linear.MinkowskiSecondBoxBasis + +namespace OAI + +section + +namespace Erdos3.BohrLattice.MinkowskiSecondBox + +open scoped BigOperators Matrix +open Erdos3.BohrLattice.BoxCertificate Set Module Submodule + +def rawTailLift {n : ℕ} (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) + (z : Fin n → ℤ) : Fin (n + 1) → ℝ := + Matrix.mulVec B (Fin.cons 0 (intCastVec z)) + +theorem deleteProjection_rawTailLift {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (z : Fin n → ℤ) : + deleteProjection h (fun i ↦ B i 0) (rawTailLift B z) = + Matrix.mulVec (projectedTail h B) (intCastVec z) := by + funext i + simp only [deleteProjection, rawTailLift, Matrix.mulVec, dotProduct, + projectedTail] + simp only [Fin.sum_univ_succ, Fin.cons_zero, Fin.cons_succ, mul_zero, + zero_add] + simp_rw [sub_mul] + rw [Finset.sum_sub_distrib] + congr 1 + simp only [div_eq_mul_inv] + rw [Finset.sum_mul, Finset.sum_mul] + apply Finset.sum_congr rfl + intro j _ + ring + +noncomputable def matrixBasis {n : ℕ} (D : Matrix (Fin n) (Fin n) ℝ) + (hD : D.det ≠ 0) : Module.Basis (Fin n) ℝ (Fin n → ℝ) := + (Pi.basisFun ℝ (Fin n)).map + (D.toLinearEquiv' (D.invertibleOfIsUnitDet (isUnit_iff_ne_zero.mpr hD))) + +@[simp] theorem matrixBasis_apply {n : ℕ} (D : Matrix (Fin n) (Fin n) ℝ) + (hD : D.det ≠ 0) (j : Fin n) : + matrixBasis D hD j = fun i ↦ D i j := by + ext i + rw [matrixBasis, Module.Basis.map_apply, Pi.basisFun_apply] + change Matrix.mulVec D (Pi.single j 1) i = D i j + simp [Matrix.mulVec] + +theorem matrix_mulVec_intCastVec_mem_span {n : ℕ} + (D : Matrix (Fin n) (Fin n) ℝ) (hD : D.det ≠ 0) + (z : Fin n → ℤ) : + Matrix.mulVec D (intCastVec z) ∈ + Submodule.span ℤ (Set.range (matrixBasis D hD)) := by + rw [Submodule.mem_span_range_iff_exists_fun] + refine ⟨z, ?_⟩ + ext i + simp [Matrix.mulVec, dotProduct, intCastVec, mul_comm] + +theorem minkowskiSecondConstant_succ (n : ℕ) : + minkowskiSecondConstant (n + 1) = + (2 : ℝ) ^ n * minkowskiSecondConstant n := by + unfold minkowskiSecondConstant + have he : (n + 1) * ((n + 1) - 1) / 2 = n + n * (n - 1) / 2 := by + rw [← Nat.choose_two_right, ← Nat.choose_two_right] + simp [Nat.choose_succ_succ] + rw [he, pow_add] + +theorem exists_abs_apply_eq_norm {n : ℕ} (x : Fin (n + 1) → ℝ) : + ∃ h, |x h| = ‖x‖ := by + classical + obtain ⟨h, -, hh⟩ := Finset.exists_max_image Finset.univ (fun i => |x i|) + Finset.univ_nonempty + refine ⟨h, le_antisymm (abs_apply_le_norm x h) ?_⟩ + rw [pi_norm_le_iff_of_nonneg (abs_nonneg (x h))] + intro i + simpa only [Real.norm_eq_abs] using hh i (Finset.mem_univ i) + +theorem realBox_smul_one_eq_const {n : ℕ} (s : ℝ) : + realBox (s • (fun _ : Fin n ↦ (1 : ℝ))) = realBox (fun _ ↦ s) := by + congr 1 + funext i + simp + +theorem cube_has_successiveProductCertificate : + ∀ {n : ℕ} (b : Basis (Fin n) ℝ (Fin n → ℝ)), + Nonempty (SuccessiveProductCertificate + (span ℤ (Set.range b)).toAddSubgroup (fun _ ↦ 1) + (minkowskiSecondConstant n * |(Matrix.of b).det|)) := by + intro n + induction n with + | zero => + intro b + refine ⟨{ + scale := fun i ↦ Fin.elim0 i + point := fun i ↦ Fin.elim0 i + scale_nonneg := fun i ↦ Fin.elim0 i + point_mem := fun i ↦ Fin.elim0 i + independent := linearIndependent_empty_type + mem_scaledBox := fun i ↦ Fin.elim0 i + product_le := ?_ }⟩ + simp [minkowskiSecondConstant] + | succ n ih => + intro b + classical + let L : Submodule ℤ (Fin (n + 1) → ℝ) := span ℤ (Set.range b) + obtain ⟨v, hvL, hv0, hvmin⟩ := exists_shortest_nonzero_of_basis b + let vL : L := ⟨v, hvL⟩ + have hvL0 : vL ≠ 0 := by + intro h + apply hv0 + exact congrArg Subtype.val h + have hμpos : ∀ x : L, x ≠ 0 → 0 < ‖(x : Fin (n + 1) → ℝ)‖ := by + intro x hx + exact norm_pos_iff.mpr (by + intro h + apply hx + exact Subtype.ext h) + have hμhom : ∀ (c : ℤ), 0 < c → ∀ x : L, + ‖((c • x : L) : Fin (n + 1) → ℝ)‖ = + (c : ℝ) * ‖(x : Fin (n + 1) → ℝ)‖ := by + intro c hc x + have hcast : (((c • x : L) : Fin (n + 1) → ℝ)) = + (c : ℝ) • (x : Fin (n + 1) → ℝ) := by + ext i + simp + rw [hcast] + rw [norm_smul, Real.norm_eq_abs, abs_of_pos] + exact_mod_cast hc + have hμmin : ∀ x : L, x ≠ 0 → + ‖(vL : Fin (n + 1) → ℝ)‖ ≤ ‖(x : Fin (n + 1) → ℝ)‖ := by + intro x hx + exact hvmin x x.property (by + intro h + apply hx + exact Subtype.ext h) + obtain ⟨-, Bz, hBz0⟩ := + Erdos3.BohrLattice.PrimitiveExtension.shortest_zspan_vector_primitive_and_extends + (Nat.succ_pos n) b vL hvL0 + (fun x : L ↦ ‖(x : Fin (n + 1) → ℝ)‖) hμpos hμhom hμmin + let b' : Basis (Fin (n + 1)) ℝ (Fin (n + 1) → ℝ) := + Bz.ofZLatticeBasis ℝ L + have hb'0 : b' 0 = v := by + rw [show b' 0 = ((Bz 0 : L) : Fin (n + 1) → ℝ) by + exact Basis.ofZLatticeBasis_apply ℝ L Bz 0] + exact congrArg Subtype.val (by simpa using hBz0) + have hb'span : span ℤ (Set.range b') = L := by + exact Bz.ofZLatticeBasis_span ℝ L + let M : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ := (Matrix.of b')ᵀ + have hMdet : M.det ≠ 0 := by + have hbdet : (Pi.basisFun ℝ (Fin (n + 1))).det b' ≠ 0 := + (AlternatingMap.map_basis_ne_zero_iff b' + (Pi.basisFun ℝ (Fin (n + 1))).det).mpr + (Pi.basisFun ℝ (Fin (n + 1))).det_ne_zero + rw [Pi.basisFun_det_apply] at hbdet + simpa [M] using hbdet + obtain ⟨h, hh⟩ := exists_abs_apply_eq_norm v + have hvh : v h ≠ 0 := by + intro hz + have : ‖v‖ = 0 := by simpa [hz] using hh.symm + exact hv0 (norm_eq_zero.mp this) + have hMh0 : M h 0 ≠ 0 := by + simpa [M, Matrix.of_apply, hb'0] using hvh + let Q : Matrix (Fin n) (Fin n) ℝ := projectedTail h M + have hQdet : Q.det ≠ 0 := projectedTail_det_ne_zero h M hMdet hMh0 + let qB : Basis (Fin n) ℝ (Fin n → ℝ) := projectedTailBasis h M hMdet hMh0 + obtain ⟨cq⟩ := ih qB + have hQpoint : ∀ j, ∃ z : Fin n → ℤ, + Matrix.mulVec Q (intCastVec z) = cq.point j := by + intro j + have hm := cq.point_mem j + change cq.point j ∈ span ℤ (Set.range qB) at hm + rw [Submodule.mem_span_range_iff_exists_fun] at hm + obtain ⟨z, hz⟩ := hm + refine ⟨z, ?_⟩ + rw [← hz] + ext i + simp [Q, qB, Matrix.mulVec, dotProduct, intCastVec, mul_comm] + choose z hz using hQpoint + let raw : Fin n → Fin (n + 1) → ℝ := fun j ↦ rawTailLift M (z j) + let a : Fin n → ℤ := fun j ↦ -roundedCoefficient (raw j h / v h) + let lift : Fin n → Fin (n + 1) → ℝ := + fun j ↦ raw j + (a j) • v + let scale : Fin (n + 1) → ℝ := Fin.cons ‖v‖ (fun j ↦ 2 * cq.scale j) + let point : Fin (n + 1) → Fin (n + 1) → ℝ := Fin.cons v lift + have hraw_eq : ∀ j, raw j = ∑ k, (z j k) • b' k.succ := by + intro j + ext i + simp [raw, rawTailLift, M, Matrix.mulVec, dotProduct, intCastVec, + Fin.sum_univ_succ, mul_comm] + have hrawL : ∀ j, raw j ∈ L := by + intro j + rw [hraw_eq] + rw [← hb'span] + apply sum_mem + intro k hk + exact smul_mem _ _ (subset_span (Set.mem_range_self k.succ)) + have hliftL : ∀ j, lift j ∈ L := by + intro j + change raw j + (a j) • v ∈ L + exact add_mem (hrawL j) (smul_mem L (a j) hvL) + have hcol0 : (fun i ↦ M i 0) = v := by + funext i + simp [M, Matrix.of_apply, hb'0] + have hproj_raw : ∀ j, deleteProjection h v (raw j) = cq.point j := by + intro j + rw [← hcol0] + rw [deleteProjection_rawTailLift] + exact hz j + have hproj_lift : ∀ j, deleteProjection h v (lift j) = cq.point j := by + intro j + change deleteProjection h v (raw j + (a j) • v) = cq.point j + have hcast : (a j) • v = (a j : ℝ) • v := by + ext i + simp + rw [hcast, deleteProjection_add_smul h v (raw j) (a j : ℝ) hvh] + exact hproj_raw j + have hqnorm : ∀ j, ‖cq.point j‖ ≤ cq.scale j := by + intro j + apply (mem_realBox_const_iff_norm_le (cq.scale_nonneg j) _).mp + rw [← realBox_smul_one_eq_const] + exact cq.mem_scaledBox j + have ha : ∀ j, |raw j h / v h + (a j : ℝ)| ≤ (1 : ℝ) / 2 := by + intro j + simpa [a, sub_eq_add_neg] using + abs_sub_roundedCoefficient_le_half (raw j h / v h) + have hlift_upper : ∀ j, ‖lift j‖ ≤ cq.scale j + ‖v‖ / 2 := by + intro j + have hcast : (a j) • v = (a j : ℝ) • v := by + ext i + simp + change ‖raw j + (a j) • v‖ ≤ cq.scale j + ‖v‖ / 2 + rw [hcast] + exact reducedLift_apply_le h v (raw j) (cq.scale j) (a j : ℝ) + hh hvh (ha j) ((congrArg norm (hproj_raw j)).le.trans (hqnorm j)) + have hlift0 : ∀ j, lift j ≠ 0 := by + intro j hj + apply cq.independent.ne_zero j + rw [← hproj_lift j, hj] + ext i + simp [deleteProjection] + have hshortlift : ∀ j, ‖v‖ ≤ ‖lift j‖ := by + intro j + exact hvmin (lift j) (hliftL j) (hlift0 j) + have hliftnorm : ∀ j, ‖lift j‖ ≤ 2 * cq.scale j := by + intro j + have hu := hlift_upper j + have hs := hshortlift j + linarith + have hind : LinearIndependent ℝ point := by + rw [Fintype.linearIndependent_iff] + intro g hg i + have hprojrel : ∑ j, g j.succ • cq.point j = 0 := by + have hm := congrArg (deleteProjectionLinear h v) hg + rw [map_sum] at hm + rw [Fin.sum_univ_succ] at hm + simp only [point, Fin.cons_zero, Fin.cons_succ] at hm + rw [map_smul, deleteProjectionLinear_apply, + deleteProjection_self h v hvh, smul_zero, zero_add] at hm + simp only [map_smul, deleteProjectionLinear_apply, map_zero] at hm + simp_rw [hproj_lift] at hm + exact hm + have htail : ∀ j : Fin n, g j.succ = 0 := + (Fintype.linearIndependent_iff.mp cq.independent) _ hprojrel + refine Fin.cases ?_ htail i + rw [Fin.sum_univ_succ] at hg + simp only [point, Fin.cons_zero, Fin.cons_succ] at hg + simp_rw [htail] at hg + simp only [zero_smul, Finset.sum_const_zero, add_zero] at hg + exact (smul_eq_zero.mp hg).resolve_right hv0 + have hqdet : |(Matrix.of qB).det| = |Q.det| := by + have hmat : Matrix.of qB = Qᵀ := by + ext i j + simp [qB, Q, Matrix.of_apply, Matrix.col] + rw [hmat, Matrix.det_transpose] + have hMabs : |M.det| = |(Matrix.of b).det| := by + have hchange := abs_det_zspan_basis_eq b Bz + have hmat : Matrix.of (((↑) : L → (Fin (n + 1) → ℝ)) ∘ Bz) = + Matrix.of b' := by + ext i j + simp [b', Matrix.of_apply] + rw [hmat] at hchange + simpa [M] using hchange + have hfactor : |(Matrix.of b).det| = ‖v‖ * |Q.det| := by + rw [← hMabs] + have hd := abs_det_eq_abs_pivot_mul_abs_det_projectedTail h M hMh0 + have hentry : M h 0 = v h := congrFun hcol0 h + rw [hentry, hh] at hd + simpa [Q] using hd + refine ⟨{ + scale := scale + point := point + scale_nonneg := ?_ + point_mem := ?_ + independent := hind + mem_scaledBox := ?_ + product_le := ?_ }⟩ + · intro i + refine Fin.cases (norm_nonneg v) (fun j ↦ ?_) i + exact mul_nonneg (by norm_num) (cq.scale_nonneg j) + · intro i + refine Fin.cases hvL (fun j ↦ hliftL j) i + · intro i + refine Fin.cases ?_ (fun j ↦ ?_) i + · rw [realBox_smul_one_eq_const] + apply (mem_realBox_const_iff_norm_le (norm_nonneg v) v).mpr + simp + · have hm := (mem_realBox_const_iff_norm_le + (mul_nonneg (by norm_num) (cq.scale_nonneg j)) (lift j)).mpr + (hliftnorm j) + rw [realBox_smul_one_eq_const] + simpa [scale, point] using hm + · have hcq : ∏ j, cq.scale j ≤ minkowskiSecondConstant n * |Q.det| := by + simpa [hqdet] using cq.product_le + calc + ∏ i, scale i = ‖v‖ * ((2 : ℝ) ^ n * ∏ j, cq.scale j) := by + simp [scale, Fin.prod_univ_succ, Finset.prod_mul_distrib, + Finset.prod_const] + _ ≤ ‖v‖ * ((2 : ℝ) ^ n * + (minkowskiSecondConstant n * |Q.det|)) := by + gcongr + _ = minkowskiSecondConstant (n + 1) * |(Matrix.of b).det| := by + rw [minkowskiSecondConstant_succ, hfactor] + ring + +noncomputable def roundedTailLift {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (z : Fin n → ℤ) : + Fin (n + 1) → ℝ := + rawTailLift B z - + (roundedCoefficient ((rawTailLift B z) h / B h 0) : ℝ) • + (fun i ↦ B i 0) + +theorem deleteProjection_roundedTailLift {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (hB : B h 0 ≠ 0) + (z : Fin n → ℤ) : + deleteProjection h (fun i ↦ B i 0) (roundedTailLift h B z) = + Matrix.mulVec (projectedTail h B) (intCastVec z) := by + rw [roundedTailLift, sub_eq_add_neg, ← neg_smul] + rw [deleteProjection_add_smul h (fun i ↦ B i 0) (rawTailLift B z) + (-(roundedCoefficient ((rawTailLift B z) h / B h 0) : ℝ)) hB] + exact deleteProjection_rawTailLift h B z + +theorem roundedTailLift_norm_le_two {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (z : Fin n → ℤ) + (hh : |B h 0| = ‖(fun i ↦ B i 0)‖) (hB : B h 0 ≠ 0) + (hshort : ‖(fun i ↦ B i 0)‖ ≤ ‖roundedTailLift h B z‖) : + ‖roundedTailLift h B z‖ ≤ + 2 * ‖Matrix.mulVec (projectedTail h B) (intCastVec z)‖ := by + let x := rawTailLift B z + let v : Fin (n + 1) → ℝ := fun i ↦ B i 0 + let a : ℝ := -(roundedCoefficient (x h / v h) : ℝ) + have ha : |x h / v h + a| ≤ (1 : ℝ) / 2 := by + change |x h / v h - (round (x h / v h) : ℝ)| ≤ (1 : ℝ) / 2 + simpa only [sub_eq_add_neg] using abs_sub_round (x h / v h) + have hproj : ‖deleteProjection h v x‖ ≤ + ‖Matrix.mulVec (projectedTail h B) (intCastVec z)‖ := by + rw [deleteProjection_rawTailLift] + have hu := reducedLift_apply_le h v x + ‖Matrix.mulVec (projectedTail h B) (intCastVec z)‖ a hh hB ha hproj + have hlift : x + a • v = roundedTailLift h B z := by + simp [x, v, a, roundedTailLift, sub_eq_add_neg] + rw [hlift] at hu + have hhalf : ‖(fun i ↦ B i 0)‖ / 2 ≤ + ‖Matrix.mulVec (projectedTail h B) (intCastVec z)‖ := by + linarith + linarith + +theorem rawTailLift_mem_of_columns_mem {n : ℕ} + (L : Submodule ℤ (Fin (n + 1) → ℝ)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) + (hcol : ∀ j, (fun i ↦ B i j) ∈ L) (z : Fin n → ℤ) : + rawTailLift B z ∈ L := by + have heq : rawTailLift B z = + ∑ j : Fin n, z j • (fun i ↦ B i j.succ) := by + ext i + rw [rawTailLift, Matrix.mulVec, dotProduct, Fin.sum_univ_succ] + simp only [Fin.cons_zero, Fin.cons_succ, intCastVec, mul_zero, zero_add, + Finset.sum_apply, Pi.smul_apply] + apply Finset.sum_congr rfl + intro j _ + rw [mul_comm] + simpa only [smul_eq_mul] using + Int.cast_smul_eq_zsmul ℝ (z j) (B i j.succ) + rw [heq] + apply Submodule.sum_mem + intro j _ + exact L.smul_mem (z j) (hcol j.succ) + +theorem roundedTailLift_mem_of_columns_mem {n : ℕ} (h : Fin (n + 1)) + (L : Submodule ℤ (Fin (n + 1) → ℝ)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) + (hcol : ∀ j, (fun i ↦ B i j) ∈ L) (z : Fin n → ℤ) : + roundedTailLift h B z ∈ L := by + apply L.sub_mem (rawTailLift_mem_of_columns_mem L B hcol z) + simpa only [Int.cast_smul_eq_zsmul] using + L.smul_mem (roundedCoefficient ((rawTailLift B z) h / B h 0)) (hcol 0) + +theorem roundedTailLift_linearIndependent {n : ℕ} (h : Fin (n + 1)) + (B : Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ) (hB : B h 0 ≠ 0) + (z : Fin n → Fin n → ℤ) + (hli : LinearIndependent ℝ (fun j ↦ + Matrix.mulVec (projectedTail h B) (intCastVec (z j)))) : + LinearIndependent ℝ (Fin.cons (fun i ↦ B i 0) + (fun j ↦ roundedTailLift h B (z j))) := by + rw [Fintype.linearIndependent_iff] at hli ⊢ + intro c hc i + have hp := congrArg (deleteProjectionLinear h (fun i ↦ B i 0)) hc + simp only [map_sum, map_smul, map_zero] at hp + rw [Fin.sum_univ_succ] at hp + simp only [Fin.cons_zero, Fin.cons_succ, + deleteProjectionLinear_apply] at hp + rw [deleteProjection_self h (fun i ↦ B i 0) hB] at hp + simp_rw [deleteProjection_roundedTailLift h B hB] at hp + simp only [smul_zero, zero_add] at hp + have htail : ∀ j : Fin n, c j.succ = 0 := by + exact fun j ↦ hli (fun j ↦ c j.succ) hp j + have hc' := hc + rw [Fin.sum_univ_succ] at hc' + simp only [Fin.cons_zero, Fin.cons_succ] at hc' + simp_rw [htail, zero_smul] at hc' + simp only [Finset.sum_const_zero, add_zero] at hc' + have hc0 : c 0 = 0 := by + have hh := congrFun hc' h + simp only [Pi.smul_apply, smul_eq_mul, Pi.zero_apply] at hh + exact (mul_eq_zero.mp hh).resolve_right hB + exact Fin.cases hc0 htail i + +end Erdos3.BohrLattice.MinkowskiSecondBox + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateDownsets.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateDownsets.lean new file mode 100644 index 0000000000000000000000000000000000000000..a410d97bb9f23f2b086c69b3cd76235694573282 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateDownsets.lean @@ -0,0 +1,61 @@ +import Mathlib.Order.UpperLower.Basic +import OAI.Combinatorics.Progressions.Polynomial.TotalDegreeSplitDownsets + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def missingCoordinateBound (s : ℕ) (i j : Fin (s + 1)) : ℕ := + if j = i then 0 else s + +def missingCoordinateDownset (s : ℕ) (i : Fin (s + 1)) : Set (Fin (s + 1) →₀ ℕ) := + {a | ∀ j, a j ≤ missingCoordinateBound s i j} + +theorem missingCoordinateBound_le (s : ℕ) (i : Fin (s + 1)) : + missingCoordinateBound s i ≤ fun _ => s := by + intro j + by_cases h : j = i <;> simp [missingCoordinateBound, h] + +theorem missingCoordinateDownset_lower (s : ℕ) (i : Fin (s + 1)) : + IsLowerSet (missingCoordinateDownset s i) := + fun _ _ hab hb j => (hab j).trans (hb j) + +theorem missingCoordinateDownset_covers (s : ℕ) (a : Fin (s + 1) →₀ ℕ) + (ha : (∑ j, a j) ≤ s) : ∃ i, a ∈ missingCoordinateDownset s i := by + classical + have hall (j : Fin (s + 1)) : a j ≤ s := + (Finset.single_le_sum (fun k _ => Nat.zero_le (a k)) (Finset.mem_univ j)).trans ha + have hz : ∃ i, a i = 0 := by + by_contra hn + push Not at hn + have hsum : s + 1 ≤ ∑ i, a i := by + calc + _ = ∑ _i : Fin (s + 1), 1 := by simp + _ ≤ _ := Finset.sum_le_sum fun i _ => Nat.one_le_iff_ne_zero.mpr (hn i) + omega + obtain ⟨i, hi⟩ := hz + refine ⟨i, fun j => ?_⟩ + by_cases hji : j = i + · subst j + simp [missingCoordinateBound, hi] + · simpa [missingCoordinateBound, hji] using hall j + +theorem missingCoordinateDownset_terminal {L : Type*} [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} (F : NilpotentLieFiltration L s) (a : Fin (s + 1) →₀ ℕ) + (ha : ∀ i, a ∉ missingCoordinateDownset s i) : + (F.totalDegreeMultifiltration (Fin (s + 1))).layer (fun j => a j) = ⊥ := by + apply F.layer_eq_bot_above_step + apply Nat.lt_of_not_ge + intro h + obtain ⟨i, hi⟩ := missingCoordinateDownset_covers s a h + exact ha i hi + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateErrorAbsorption.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateErrorAbsorption.lean new file mode 100644 index 0000000000000000000000000000000000000000..8521363111af9e34c3e219721ac4b2366581348b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateErrorAbsorption.lean @@ -0,0 +1,107 @@ +import OAI.Combinatorics.Progressions.Nilpotent.MissingCoordinateNiltestApproximation + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +theorem exists_absorb_missing_coordinate_error (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L : Type} [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} {D : RationalFilteredNilmanifold L s d} {p : ℝ} + (T : D.Niltest (fun _ : Fin (s + 1) => 1)), T.ComplexityLE p → + ∀ {G X : Type*} (H : Finset G), H.Nonempty → + ∀ (S : G → Finset X), (∀ h ∈ H, (S h).Nonempty) → + ∀ (sample : G → X → Fin (s + 1) → ℤ) (f : G → X → ℂ), + (∀ h ∈ H, ∀ x ∈ S h, ‖f h x‖ ≤ 1) → + (∀ h ∈ H, Real.exp (-p) ≤ ‖𝔼 x ∈ S h, f h x * star (T.eval (sample h x))‖) → + ∃ A : Fin (s + 1) → (Fin (s + 1) → ℤ) → ℂ, + (∀ i x, ‖A i x‖ ≤ 1) ∧ + (∀ i x y, (∀ k, k ≠ i → x k = y k) → A i x = A i y) ∧ + ∃ H' : Finset G, H' ⊆ H ∧ H'.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * (H.card : ℝ) ≤ (H'.card : ℝ) ∧ + ∀ h ∈ H', Real.exp (-((p + C) ^ C)) ≤ + ‖𝔼 x ∈ S h, f h x * ∏ i, A i (sample h x)‖ := by + obtain ⟨a, _, hsplit⟩ := exists_missing_coordinate_niltest_approximation s 2 + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (2 * X + (X + Polynomial.C a) ^ a + 2) + refine ⟨C, hC, ?_⟩ + intro L _ _ _ _ _ _ d D p T hT G Ω H hH S hS sample f hf hcorr + classical + have hp : 0 ≤ p := (Nat.cast_nonneg d).trans hT.1.1 + let U := T.expNormalize p + let epsilon := Real.exp (-(2 * p + 1)) + let q := (p + a) ^ a + have hq : 0 ≤ q := by dsimp [q]; positivity + have hcost : 2 * p + q + 2 ≤ (p + C) ^ C := by + simpa [X, q, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := by linarith only [hp, hcost] + have hscale : 1 / epsilon ≤ Real.exp ((p + 2) ^ 2) := by + dsimp [epsilon] + rw [one_div, ← Real.exp_neg] + apply Real.exp_le_exp.mpr + nlinarith only [sq_nonneg p, hp] + obtain ⟨m, _, hm, c, V, hc, hV, hindependent, happ⟩ := + hsplit U (T.expNormalize_complexity hT) (T.expNormalize_norm hT) + epsilon (Real.exp_pos _) hscale + have hepsilon : epsilon ≤ Real.exp (-(2 * p)) / 2 := by + simpa only [epsilon, show -(2 * p + 1) = -(2 * p) - 1 by ring] using + exp_sub_one_le_half_exp (-(2 * p)) + have hsmall : Real.exp (-(2 * p + q + 2)) ≤ Real.exp (-(2 * p)) / (2 * Real.exp q * 2) := by + calc + _ = Real.exp (-(2 * p + q) - 1 - 1) := by congr 1; ring + _ ≤ Real.exp (-(2 * p + q) - 1) / 2 := exp_sub_one_le_half_exp _ + _ ≤ (Real.exp (-(2 * p + q)) / 2) / 2 := + div_le_div_of_nonneg_right (exp_sub_one_le_half_exp _) (by norm_num) + _ = _ := by rw [show -(2 * p + q) = -(2 * p) - q by ring, Real.exp_sub]; ring + let R (h : G) (_ : Unit) (j : Fin m) : Prop := + Real.exp (-(2 * p + q + 2)) ≤ + ‖𝔼 x ∈ S h, f h x * star (∏ i, V i j (sample h x))‖ + have hchoice : ∀ h ∈ H, ∀ u, ∃ j, R h u j := by + intro h hh _ + have hmean : (𝔼 x ∈ S h, f h x * star (U.eval (sample h x))) = + (Real.exp (-p) : ℂ) * (𝔼 x ∈ S h, f h x * star (T.eval (sample h x))) := by + rw [Finset.mul_expect] + apply Finset.expect_congr rfl + intro x _ + simp only [U, RationalFilteredNilmanifold.Niltest.expNormalize_eval, + star_mul, Complex.star_def, Complex.conj_ofReal] + ring + have hnorm : Real.exp (-(2 * p)) ≤ ‖finiteCorrelation (S h) (f h) + (fun x => U.eval (sample h x))‖ := by + unfold finiteCorrelation + rw [hmean, norm_mul, Complex.norm_real, Real.norm_of_nonneg (Real.exp_nonneg _)] + calc + _ = Real.exp (-p) * Real.exp (-p) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := mul_le_mul_of_nonneg_left (hcorr h hh) (Real.exp_nonneg _) + obtain ⟨j, hj⟩ := exists_correlating_weighted_summand (hS h hh) (f h) + (fun x => U.eval (sample h x)) (fun j x => ∏ i, V i j (sample h x)) c + (Real.exp_pos (-(2 * p))) (Real.exp_pos q) (by norm_num : (0 : ℝ) < 2) + (by simpa only [Fintype.card_fin] using hm) hc (hf h hh) + (fun x _ => by rw [norm_sub_rev]; exact (happ (sample h x)).trans hepsilon) hnorm + exact ⟨j, hsmall.trans hj⟩ + obtain ⟨j, H', hsub, hH', hdense, hfixed⟩ := exists_large_fixed_choices H hH R hchoice + (by simpa only [Fintype.card_fin] using hm) + refine ⟨(fun i x => star (V i (j ()) x)), ?_, ?_, H', hsub, hH', ?_, ?_⟩ + · intro i x + simpa only [norm_star] using hV i (j ()) x + · intro i x y hxy + exact congrArg star (hindependent i (j ()) x y hxy) + · have hdense' : Real.exp (-q) * (H.card : ℝ) ≤ (H'.card : ℝ) := by + simpa only [Fintype.card_unit, Nat.cast_one, mul_one] using hdense + exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hqC)) + (Nat.cast_nonneg _)).trans hdense' + · intro h hh + simpa only [star_prod] using + (Real.exp_le_exp.mpr (neg_le_neg hcost)).trans (hfixed h hh ()) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateProducts.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a5324593f00dd8ae435d886a01e858827740e50 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MissingCoordinateProducts.lean @@ -0,0 +1,59 @@ +import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import Mathlib.Analysis.Complex.Basic + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def missingCoordinateProduct {I K α : Type*} [Fintype I] + (coordinate : I → K) (f : I → (K → α) → ℂ) (k : K) (x : K → α) : ℂ := by + classical + exact ∏ i ∈ Finset.univ with coordinate i = k, f i x + +theorem missingCoordinateProduct_prod {I K α : Type*} [Fintype I] [Fintype K] + (coordinate : I → K) (f : I → (K → α) → ℂ) (x : K → α) : + (∏ k, missingCoordinateProduct coordinate f k x) = ∏ i, f i x := by + classical + exact Finset.prod_fiberwise Finset.univ coordinate (fun i => f i x) + +theorem missingCoordinateProduct_norm {I K α : Type*} [Fintype I] + (coordinate : I → K) (f : I → (K → α) → ℂ) (hf : ∀ i x, ‖f i x‖ ≤ 1) + (k : K) (x : K → α) : ‖missingCoordinateProduct coordinate f k x‖ ≤ 1 := by + classical + unfold missingCoordinateProduct + rw [norm_prod] + exact Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) (fun i _ => hf i x) + +theorem missingCoordinateProduct_independent {I K α : Type*} [Fintype I] + (coordinate : I → K) (f : I → (K → α) → ℂ) + (hf : ∀ i x y, (∀ k, k ≠ coordinate i → x k = y k) → f i x = f i y) + (k : K) (x y : K → α) (hxy : ∀ l, l ≠ k → x l = y l) : + missingCoordinateProduct coordinate f k x = missingCoordinateProduct coordinate f k y := by + classical + apply Finset.prod_congr rfl + intro i hi + have heq : coordinate i = k := (Finset.mem_filter.mp hi).2 + apply hf i x y + simpa only [heq] using hxy + +theorem exists_missing_coordinate_product_factors {I K α : Type*} [Fintype I] [Fintype K] + (f : I → (K → α) → ℂ) (hf : ∀ i x, ‖f i x‖ ≤ 1) + (hind : ∀ i, ∃ k, ∀ x y, (∀ l, l ≠ k → x l = y l) → f i x = f i y) : + ∃ A : K → (K → α) → ℂ, + (∀ k x, ‖A k x‖ ≤ 1) ∧ + (∀ k x y, (∀ l, l ≠ k → x l = y l) → A k x = A k y) ∧ + ∀ x, (∏ k, A k x) = ∏ i, f i x := by + classical + choose coordinate homit using hind + exact ⟨missingCoordinateProduct coordinate f, missingCoordinateProduct_norm coordinate f hf, + missingCoordinateProduct_independent coordinate f homit, missingCoordinateProduct_prod coordinate f⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedAntisymmetricBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedAntisymmetricBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..08a4677b6d66e95d27fe6499e60ec117b94a1ec8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedAntisymmetricBox.lean @@ -0,0 +1,84 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeMixedReflectionBridge + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem expect_mixed_tuple {n : ℕ} {X : Type*} [Fintype X] + (F : (Fin (n + 2) → X) → ℂ) : + (𝔼 x, F x) = 𝔼 u : Fin n → X, 𝔼 h, 𝔼 m, F (Fin.cons h (Fin.cons m u)) := by + simp_rw [expect_dependent_fin_cons] + calc + _ = 𝔼 h, 𝔼 u : Fin n → X, 𝔼 m, F (Fin.cons h (Fin.cons m u)) := + Finset.expect_congr rfl (fun _ _ => Finset.expect_comm _ _ _) + _ = _ := Finset.expect_comm _ _ _ + +namespace NativeMultidegreeNilcharacter + +theorem exists_mixed_sum_antisymmetric_box (n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) + {N : ℕ} [NeZero N] (f : ZMod N → ℂ), (∀ x, ‖f x‖ ≤ 1) → + ∀ (i : Fin W.outputDim) (A : Fin (n + 2) → (Fin (n + 2) → ZMod N) → ℂ), + (∀ j x, ‖A j x‖ ≤ 1) → (∀ j, MissesBoxCoordinate (A j) j) → + Real.exp (-p) ≤ ‖𝔼 u : Fin n → ZMod N, 𝔼 m : ZMod N, 𝔼 h : ZMod N, + f (m + h + ∑ j, u j) * star (W.eval i (mixedSlotInput (h.val : ℤ) m.val (fun j => (u j).val))) * + ∏ j, A j (Fin.cons h (Fin.cons m u))‖ → + ∃ j k : Fin W.outputDim, Real.exp (-((p + C) ^ C)) ≤ + (boxPhaseMoment (n + 2) (fun x : Fin (n + 2) → ZMod N => + W.mixedAntisymmetric j k (fun l => (x l).val))).re := by + obtain ⟨a, _, hcorr⟩ := exists_mixed_sum_antisymmetric_correlation n + let Q : Polynomial ℕ := (Polynomial.X + Polynomial.C a) ^ a + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (Polynomial.C (2 ^ (n + 2)) * Q) + refine ⟨C, hC, ?_⟩ + intro p W N _ f hf i A hA hmiss hinput + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + obtain ⟨j, k, B, hB, hBind, hpositive⟩ := hcorr W f hf i A hA hmiss hinput + let F (x : Fin (n + 2) → ZMod N) := W.mixedAntisymmetric j k (fun l => (x l).val) + let U (l : Fin (n + 2)) (x : Fin (n + 2) → ZMod N) := B l (fun l => (x l).val) + have hvals (h m : ZMod N) (u : Fin n → ZMod N) : + (fun l => (((Fin.cons h (Fin.cons m u) : Fin (n + 2) → ZMod N) l).val : ℤ)) = + Fin.cons (h.val : ℤ) (Fin.cons (m.val : ℤ) (fun l => (u l).val)) := by + funext l + refine Fin.cases ?_ (fun l => ?_) l + · rfl + · refine Fin.cases ?_ (fun l => ?_) l <;> rfl + have hmean : boxTestCorrelation F U = + 𝔼 u : Fin n → ZMod N, 𝔼 h : ZMod N, 𝔼 h' : ZMod N, + W.mixedAntisymmetric j k (Fin.cons (h.val : ℤ) (Fin.cons (h'.val : ℤ) (fun l => (u l).val))) * + ∏ l, B l (Fin.cons (h.val : ℤ) (Fin.cons (h'.val : ℤ) (fun j => (u j).val))) := by + rw [boxTestCorrelation, expect_mixed_tuple] + simp only [F, U, hvals] + have hU : ∀ l, MissesBoxCoordinate (U l) l := by + intro l x v + apply hBind l + intro m hml + change (((Function.update x l v) m).val : ℤ) = ((x m).val : ℤ) + rw [Function.update_of_ne hml] + have hbox := boxTest_cauchySchwarz (n + 1) F U (fun l x => hB l _) hU + have hscore : Real.exp (-((2 ^ (n + 2) : ℕ) : ℝ) * ((p + a) ^ a)) ≤ + (boxPhaseMoment (n + 2) F).re := by + have hpower : Real.exp (-((2 ^ (n + 2) : ℕ) : ℝ) * ((p + a) ^ a)) = + Real.exp (-((p + a) ^ a)) ^ (2 ^ (n + 2)) := by + rw [← Real.exp_nat_mul] + congr 1 + ring + rw [hpower] + apply (pow_le_pow_left₀ (Real.exp_nonneg _) ?_ _).trans hbox + rwa [hmean] + have hcost : ((2 ^ (n + 2) : ℕ) : ℝ) * ((p + a) ^ a) ≤ (p + C) ^ C := by + simpa [Q, Polynomial.eval₂_pow] using hbudget p hp + refine ⟨j, k, ?_⟩ + exact (Real.exp_le_exp.mpr (by linarith)).trans hscore + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedArrayImageSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedArrayImageSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ecdbec6ac6a19e13b3a464b50d0055989c2f04e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedArrayImageSupport.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Lattices.MixedArrayIntegerImage + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory Module Submodule +open scoped BigOperators Matrix + +theorem mixedArrayIntegerImage_inChart {D I J O : Type*} + [Fintype D] [Fintype I] [Fintype J] {n : ℕ} + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) + (o : OrthonormalBasis I ℝ W) (A : Matrix O J ℤ) + {C R : ℝ} (hC : 0 ≤ C) (hR : 0 ≤ R) + (hchart : ∀ v, ‖(normalizedOrthogonalChart W b).symm v‖ ≤ C * ‖v‖) + (hsmall : ∀ t, C * ((Fintype.card I : ℝ) + 1) * (∑ j, |(A t j : ℝ)| * R) ≤ 1 / 4) + (c w : I → J → ℝ) (hw : ∀ i j, 0 < w i j) + (hcw : ∀ i j, |c i j| + w i j ≤ R) (p : Fin n → J → PMF ℤ) + (hp : ∀ z j k, k ∈ (p z j).support → |(k : ℝ) / basisAxisScale b z| ≤ R) + (x : (I → J → ℝ) × (Fin n → J → ℤ)) (hx : mixedArraySupported c w p x) : + mixedArrayInChart W b o (mixedArrayIntegerImage A x) := by + have hs (j) := (mixedCoefficientDensity_support (fun i => c i j) (fun i => w i j) + (fun z => p z j) (mixedArrayRegroup I (Fin n) J x j)).mp (hx j) + have hbound (t) (v : J → ℝ) (hv : ∀ j, |v j| ≤ R) : + |∑ j, (A t j : ℝ) * v j| ≤ ∑ j, |(A t j : ℝ)| * R := by + refine (Finset.abs_sum_le_sum_abs _ _).trans (Finset.sum_le_sum fun j _ => ?_) + rw [abs_mul] + exact mul_le_mul_of_nonneg_left (hv j) (abs_nonneg _) + intro t + apply normalizedMixedPoint_small W b o hC + (Finset.sum_nonneg (fun j _ => mul_nonneg (abs_nonneg _) hR)) hchart (hsmall t) + · intro i + exact hbound t (x.1 i) (fun j => + (affineProbabilityProfile_abs_le _ (hw i j) ((hs j).1 i)).trans (hcw i j)) + · intro z + change |(((A *ᵥ x.2 z) t : ℤ) : ℝ) / basisAxisScale b z| ≤ _ + have he : (((A *ᵥ x.2 z) t : ℤ) : ℝ) / basisAxisScale b z = + ∑ j, (A t j : ℝ) * ((x.2 z j : ℝ) / basisAxisScale b z) := by + simp only [Matrix.mulVec, dotProduct, Int.cast_sum, Int.cast_mul, Finset.sum_div, mul_div_assoc] + rw [he] + exact hbound t _ (fun j => hp z j _ ((hs j).2 z)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedArraySourceSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedArraySourceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..744400caf3c41f3dfe1be8e481d9fdfc9f0f777a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedArraySourceSupport.lean @@ -0,0 +1,91 @@ +import OAI.Combinatorics.Progressions.Probability.ScaledArrayLaw + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule Set +open scoped BigOperators + +def mixedArraySupported {I Z J : Type*} [Fintype I] [Fintype Z] + (c w : I → J → ℝ) (p : Z → J → PMF ℤ) (x : (I → J → ℝ) × (Z → J → ℤ)) : Prop := + ∀ j, mixedCoefficientDensity (fun i => c i j) (fun i => w i j) (fun z => p z j) + (mixedArrayRegroup I Z J x j) ≠ 0 + +theorem mixedArraySupported_iff_rows {I Z J : Type*} [Fintype I] [Fintype Z] [Fintype J] + (c w : I → J → ℝ) (p : Z → J → PMF ℤ) (x : (I → J → ℝ) × (Z → J → ℤ)) : + mixedArraySupported c w p x ↔ + (∀ i, affineProductProfile (c i) (w i) (x.1 i) ≠ 0) ∧ + (∀ z j, x.2 z j ∈ (p z j).support) := by + classical + constructor + · intro hx + have hs (j) := (mixedCoefficientDensity_support (fun i => c i j) (fun i => w i j) + (fun z => p z j) (mixedArrayRegroup I Z J x j)).mp (hx j) + refine ⟨?_, fun z j => (hs j).2 z⟩ + intro i + apply Finset.prod_ne_zero_iff.mpr + intro j _ + exact (hs j).1 i + · rintro ⟨hc, hp⟩ j + apply (mixedCoefficientDensity_support _ _ _ _).mpr + refine ⟨?_, fun z => hp z j⟩ + intro i + exact (Finset.prod_ne_zero_iff.mp (hc i)) j (Finset.mem_univ j) + +def mixedArrayInChart {D I J : Type*} [Fintype D] [Fintype I] {n : ℕ} + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) + (o : OrthonormalBasis I ℝ W) (x : (I → J → ℝ) × (Fin n → J → ℤ)) : Prop := + ∀ j, normalizedLatticePoint W b (orthonormalMixedChart o (mixedArrayRegroup I (Fin n) J x j)) ∈ + standardLatticeSmallBox D + +theorem mixedArrayQuotient_injOn_chart {D I J : Type*} [Fintype D] [Fintype I] {n : ℕ} + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) + (hb : span ℤ (Set.range b) = projectedIntegerLattice W) (o : OrthonormalBasis I ℝ W) : + Set.InjOn (mixedArrayQuotient (J := J) W b hb o) {x | mixedArrayInChart W b o x} := by + intro x hx y hy he + apply (mixedArrayRegroup I (Fin n) J).injective + funext j + apply (orthonormalMixedChart o).injective + exact normalizedLatticeQuotient_injOn W b hb (Subset.rfl) (hx j) (hy j) (congrFun he j) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +theorem mixedScalarArrayLaw_support {I Z J : Type*} [Fintype I] [Fintype Z] [Fintype J] + (c w : I → J → ℝ) (hw : ∀ i j, 0 < w i j) (p : Z → J → PMF ℤ) : + ∀ᵐ x ∂mixedScalarArrayLaw c w p, mixedArraySupported c w p x := by + let μ := fun j => mixedCoefficientLaw (fun i => c i j) (fun i => w i j) (fun z => p z j) + let : ∀ j, IsProbabilityMeasure (μ j) := fun j => + mixedCoefficientLaw_probability _ _ (fun i => hw i j) _ + have h (j) : ∀ᵐ x ∂μ j, + mixedCoefficientDensity (fun i => c i j) (fun i => w i j) (fun z => p z j) x ≠ 0 := by + dsimp only [μ] + rw [mixedCoefficientLaw_density _ _ (fun i => hw i j)] + apply realDensityMeasure_ae_of_support + · exact ((affineProductProfile_contDiff (fun i => c i j) + (fun i => w i j)).continuous.measurable.comp measurable_fst).mul + ((measurable_of_countable (fun z : Z → ℤ => ∏ i, (p i j (z i)).toReal)).comp measurable_snd) + · exact fun _ hx => hx + have hall : ∀ᵐ x ∂Measure.pi μ, ∀ j, + mixedCoefficientDensity (fun i => c i j) (fun i => w i j) (fun z => p z j) (x j) ≠ 0 := + ae_all_iff.mpr (fun j => (Measure.quasiMeasurePreserving_eval μ j).ae (h j)) + rw [show Measure.pi μ = (mixedScalarArrayLaw c w p).map (mixedArrayRegroup I Z J) from + (mixedScalarArrayLaw_regroup c w hw p).symm] at hall + exact ae_of_ae_map (mixedArrayRegroup I Z J).measurable.aemeasurable hall + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxFactorizationTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxFactorizationTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccb5d21df310f0300da06968e926968da67ba1e8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxFactorizationTransport.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Polynomial.MixedBoxPolynomial + +namespace OAI + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +noncomputable def NativeMixedBoxFactorization.mono {n : ℕ} {p p' q q' : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p} + (R : NativeMixedBoxFactorization W N q) (hp : p ≤ p') (hq : q ≤ q') : + NativeMixedBoxFactorization (W.mono hp) N q' := by + letI := R.topology + letI := R.topologicalAdd + letI := R.continuousSMul + letI := R.hausdorff + letI : TopologicalSpace (ℝ ⊗[ℚ] (MixedBoxFactor n → (W.mono hp).L)) := R.topology + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] (MixedBoxFactor n → (W.mono hp).L)) := R.topologicalAdd + letI : ContinuousSMul ℝ (ℝ ⊗[ℚ] (MixedBoxFactor n → (W.mono hp).L)) := R.continuousSMul + letI : T2Space (ℝ ⊗[ℚ] (MixedBoxFactor n → (W.mono hp).L)) := R.hausdorff + have hfactor := NilpotentLieFiltration.ControlledSymbolFactorization.mono + (pi (fun _ : MixedBoxFactor n => W.model)).filtration R.basis R.weight R.adapted R.factorization hq + (fun _ => by exact_mod_cast NeZero.pos N) + have hsymbol : + ((W.mono hp).mixedAntisymmetricBoxNiltest (R.nonnegative.trans hp) R.leftIndex R.rightIndex).symbol + R.basis R.weight R.adapted = + (W.mixedAntisymmetricBoxNiltest R.nonnegative R.leftIndex R.rightIndex).symbol + R.basis R.weight R.adapted := by + rw [(W.mono hp).mixedAntisymmetricBoxNiltest_symbol + (R.nonnegative.trans hp) R.leftIndex R.rightIndex R.basis R.weight R.adapted] + rw [W.mixedAntisymmetricBoxNiltest_symbol + R.nonnegative R.leftIndex R.rightIndex R.basis R.weight R.adapted] + have hhom : + (pi (fun _ : MixedBoxFactor n => (W.mono hp).model)).filtration.realPolynomialSymbolHom + R.basis R.weight R.adapted (fun _ : MixedBoxIndex n => 1) = + (pi (fun _ : MixedBoxFactor n => W.model)).filtration.realPolynomialSymbolHom + R.basis R.weight R.adapted (fun _ : MixedBoxIndex n => 1) := by + rfl + rw [hhom, W.mixedAntisymmetricBoxPolynomial_mono hp R.leftIndex R.rightIndex] + cases W + rfl + have htransport := (congrArg (fun symbol => + (pi (fun _ : MixedBoxFactor n => W.model)).filtration.ControlledSymbolFactorization + R.basis R.weight R.adapted (piFrequency W.mixedAntisymmetricBoxFrequencies) + (fun _ : MixedBoxIndex n => (N : ℝ)) symbol q') hsymbol).mpr hfactor + exact { + leftIndex := R.leftIndex + rightIndex := R.rightIndex + nonnegative := R.nonnegative.trans hp + topology := R.topology + topologicalAdd := R.topologicalAdd + continuousSMul := R.continuousSMul + hausdorff := R.hausdorff + basis := R.basis + weight := R.weight + adapted := R.adapted + height := fun i j => (R.height i j).trans hq + factorization := htransport } + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxOrbitFactors.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxOrbitFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..0340592bd773f85a360468e63e46a17b0dd8e7b7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxOrbitFactors.lean @@ -0,0 +1,83 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedPairComparison +import OAI.Combinatorics.Progressions.Polynomial.MixedBoxPolynomial + +namespace OAI + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_mixed_box_orbit_factors (n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ}, 0 ≤ q → + ∀ (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) + {N : ℕ} [NeZero N] (F : NativeMixedBoxFactorization W N q), + Real.exp ((p + q + C) ^ C) ≤ (N : ℝ) → + Nonempty (NativePolynomialOrbitFactors (pi (fun _ : MixedBoxFactor n => W.model)) + (W.mixedAntisymmetricBoxPolynomial F.leftIndex F.rightIndex) + (piFrequency W.mixedAntisymmetricBoxFrequencies) (fun _ : MixedBoxIndex n => (N : ℝ)) + ((p + q + C) ^ C)) := by + obtain ⟨a, _, horbit⟩ := exists_native_polynomial_orbit_factors (∑ _ : MixedReplicatedIndex (n + 1), 1) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 4 + Polynomial.C (2 ^ (n + 3)) + let R := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + Polynomial.C (2 * (n + 2)) + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (R + (R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro p q hq W N _ F hN + have hp := F.nonnegative + let := F.topology + let := F.topologicalAdd + let := F.continuousSMul + let := F.hausdorff + let D := pi (fun _ : MixedBoxFactor n => W.model) + let g := W.mixedAntisymmetricBoxPolynomial F.leftIndex F.rightIndex + let w := p + q + let r := productNiltestBudget (mixedBoxBudget n w) + w + ((2 * (n + 2) : ℕ) : ℝ) + have hw : 0 ≤ w := by dsimp only [w]; positivity + have hprod : 0 ≤ productNiltestBudget (mixedBoxBudget n w) := by + unfold productNiltestBudget productObservableLipBudget mixedBoxBudget + positivity + have hdim : (0 : ℝ) ≤ ((2 * (n + 2) : ℕ) : ℝ) := Nat.cast_nonneg _ + have hwr : w ≤ r := by + dsimp only [r] + linarith only [hprod, hdim] + have hqr : q ≤ r := (by dsimp only [w]; linarith : q ≤ w).trans hwr + have hdimr : ((2 * (n + 2) : ℕ) : ℝ) ≤ r := by dsimp only [r]; linarith only [hprod, hw] + have hmono : productNiltestBudget (mixedBoxBudget n p) ≤ productNiltestBudget (mixedBoxBudget n w) := + productNiltestBudget_mono (by dsimp only [mixedBoxBudget]; positivity) + (by dsimp only [mixedBoxBudget, w]; linarith) + have hTr : productNiltestBudget (mixedBoxBudget n p) ≤ r := + hmono.trans (by dsimp only [r]; linarith only [hw, hdim]) + have hr : 0 ≤ r := hw.trans hwr + have hcost : r + (r + a) ^ a ≤ (p + q + C) ^ C := by + simpa [X, Q, R, r, w, mixedBoxBudget, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget w hw + have hfinal : (r + a) ^ a ≤ (p + q + C) ^ C := by linarith only [hcost, hr] + have hgeom : D.GeometryComplexityLE r := + (W.mixedAntisymmetricBoxNiltest_complexity hp F.leftIndex F.rightIndex).1.mono D hTr + have hfactor : D.filtration.ControlledSymbolFactorization F.basis F.weight F.adapted + (piFrequency W.mixedAntisymmetricBoxFrequencies) (fun _ : MixedBoxIndex n => (N : ℝ)) + (D.filtration.realPolynomialSymbolHom F.basis F.weight F.adapted (fun _ => 1) g) r := by + have h := F.factorization + rw [W.mixedAntisymmetricBoxNiltest_symbol] at h + have hNpos : ∀ _ : MixedBoxIndex n, (0 : ℝ) < N := fun _ => Nat.cast_pos.mpr (NeZero.pos N) + have H := NilpotentLieFiltration.ControlledSymbolFactorization.mono + (pi (fun _ : MixedBoxFactor n => W.model)).filtration F.basis F.weight F.adapted h hqr hNpos + dsimp only [D, g] + exact H + obtain ⟨U⟩ := horbit D F.basis F.weight F.adapted hr hgeom (by simpa [MixedBoxIndex, Nat.mul_comm] using hdimr) + (fun i j => (F.height i j).trans hqr) g (piFrequency W.mixedAntisymmetricBoxFrequencies) + (fun _ : MixedBoxIndex n => (N : ℝ)) (fun _ => (Real.exp_le_exp.mpr hfinal).trans hN) hfactor + exact ⟨U.mono hfinal (fun _ => by exact_mod_cast NeZero.pos N)⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxStepDrop.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxStepDrop.lean new file mode 100644 index 0000000000000000000000000000000000000000..e798c470d2ad9518f4307cb73acedf9fd3927661 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedBoxStepDrop.lean @@ -0,0 +1,378 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeMixedReflectionBridge +import OAI.Combinatorics.Progressions.Estimates.QuadraticPairStepDrop + +namespace OAI + +section + +namespace Erdos3 + +abbrev MixedBoxIndex (n : ℕ) := Fin (n + 2) × Bool + +namespace NativeMultidegreeNilcharacter + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {n : ℕ} {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) + +noncomputable def mixedBoxComponent (out : Fin W.outputDim) (v : Fin (n + 2) → MixedBoxIndex n) : + W.model.Niltest (fun _ : MixedBoxIndex n => 1) := + (W.component out).linearPullbackHom (fun j => + { toFun := fun x => x (mixedSlotInput (v 0) (v 1) (fun l => v l.succ.succ) j) + map_zero' := rfl + map_add' := fun _ _ => rfl }) + +theorem mixedBoxComponent_eval (out : Fin W.outputDim) (v : Fin (n + 2) → MixedBoxIndex n) + (x : MixedBoxIndex n → ℤ) : + (W.mixedBoxComponent out v).eval x = + W.eval out (mixedSlotInput (x (v 0)) (x (v 1)) (fun l => x (v l.succ.succ))) := by + rw [mixedBoxComponent, Niltest.eval_linearPullbackHom, component_eval] + apply congrArg (W.eval out) + funext j + rcases mixedReplicated_cases j with rfl | ⟨l, rfl⟩ + · rfl + · refine Fin.cases ?_ (fun l => ?_) l <;> rfl + +theorem mixedBoxComponent_vertical (out : Fin W.outputDim) (v : Fin (n + 2) → MixedBoxIndex n) + (z : W.model.RealGroup) + (hz : z ∈ W.model.filtration.realification.subgroup (∑ _ : MixedReplicatedIndex (n + 1), 1)) + (x : W.model.Space) : + (W.mixedBoxComponent out v).observable (z • x) = + CircleFourier.character + ((realifyFunctional W.vertical.frequency z.coord : ℝ) : CircleFourier.Circle) * + (W.mixedBoxComponent out v).observable x := by + exact W.vertical.vertical out z (by rwa [W.multi.realSubgroup_top]) x + +noncomputable def mixedKernelFactors (i j : Fin W.outputDim) (v : Fin (n + 2) → MixedBoxIndex n) : + Fin 2 → W.model.Niltest (fun _ : MixedBoxIndex n => 1) := + ![W.mixedBoxComponent i v, + (W.mixedBoxComponent j (fun l => v (mixedExchangeCoordinate n l))).conjugate] + +noncomputable def mixedKernelFrequencies : Fin 2 → (W.L →ₗ[ℚ] ℚ) := + ![W.vertical.frequency, -W.vertical.frequency] + +theorem mixedKernelFactors_complexity (i j : Fin W.outputDim) (v : Fin (n + 2) → MixedBoxIndex n) + (a : Fin 2) : (W.mixedKernelFactors i j v a).ComplexityLE (p + 4) := by + fin_cases a + · exact W.component_complexity i + · exact W.component_complexity j + +theorem mixedKernelFactors_normBound (i j : Fin W.outputDim) (v : Fin (n + 2) → MixedBoxIndex n) + (a : Fin 2) : (W.mixedKernelFactors i j v a).normBound = 1 := by + fin_cases a <;> rfl + +theorem mixedKernelFactors_eval (i j : Fin W.outputDim) (v : Fin (n + 2) → MixedBoxIndex n) + (x : MixedBoxIndex n → ℤ) : + (∏ a, (W.mixedKernelFactors i j v a).eval x) = + W.mixedAntisymmetric i j (fun l => x (v l)) := by + simp only [Fin.prod_univ_two, mixedKernelFactors, Matrix.cons_val_zero, Matrix.cons_val_one, + Niltest.eval_conjugate, mixedBoxComponent_eval, mixedAntisymmetric] + rfl + +theorem mixedKernelFactors_vertical (i j : Fin W.outputDim) (v : Fin (n + 2) → MixedBoxIndex n) + (a : Fin 2) (z : W.model.RealGroup) + (hz : z ∈ W.model.filtration.realification.subgroup (∑ _ : MixedReplicatedIndex (n + 1), 1)) + (x : W.model.Space) : + (W.mixedKernelFactors i j v a).observable (z • x) = + CircleFourier.character + ((realifyFunctional (W.mixedKernelFrequencies a) z.coord : ℝ) : CircleFourier.Circle) * + (W.mixedKernelFactors i j v a).observable x := by + fin_cases a + · exact W.mixedBoxComponent_vertical i v z hz x + · exact Niltest.conjugate_vertical _ _ (W.mixedBoxComponent_vertical j _) z hz x + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3 + +abbrev MixedBoxFactor (n : ℕ) := (Fin (n + 2) → Bool) × Fin 2 + +theorem mixedBoxFactor_card (n : ℕ) : Fintype.card (MixedBoxFactor n) = 2 ^ (n + 3) := by + simp only [MixedBoxFactor, Fintype.card_prod, Fintype.card_fun, + Fintype.card_bool, Fintype.card_fin] + exact (pow_succ 2 (n + 2)).symm + +def mixedBoxBudget (n : ℕ) (p : ℝ) : ℝ := p + 4 + ((2 ^ (n + 3) : ℕ) : ℝ) + +theorem mixedBoxFactor_card_le_budget (n : ℕ) {p : ℝ} (hp : 0 ≤ p) : + (Fintype.card (MixedBoxFactor n) : ℝ) ≤ mixedBoxBudget n p := by + rw [mixedBoxFactor_card] + dsimp only [mixedBoxBudget] + linarith + +def mixedBoxCorner {n : ℕ} (ω : Fin (n + 2) → Bool) : Fin (n + 2) → MixedBoxIndex n := fun i => (i, ω i) + +namespace NativeMultidegreeNilcharacter + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {n : ℕ} {p : ℝ} (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) + +noncomputable def mixedAntisymmetricBoxValue (i j : Fin W.outputDim) (x : MixedBoxIndex n → ℤ) : ℂ := + boxCornerProduct (W.mixedAntisymmetric i j) (fun a => x (a, false)) (fun a => x (a, true)) + +noncomputable def mixedAntisymmetricBoxFactors (i j : Fin W.outputDim) (a : MixedBoxFactor n) : + W.model.Niltest (fun _ : MixedBoxIndex n => 1) := + let T := W.mixedKernelFactors i j (mixedBoxCorner a.1) a.2 + if booleanWeight a.1 % 2 = 0 then T else T.conjugate + +noncomputable def mixedAntisymmetricBoxFrequencies (a : MixedBoxFactor n) : W.L →ₗ[ℚ] ℚ := + if booleanWeight a.1 % 2 = 0 then W.mixedKernelFrequencies a.2 else -W.mixedKernelFrequencies a.2 + +theorem mixedAntisymmetricBoxFactors_complexity (i j : Fin W.outputDim) (a : MixedBoxFactor n) : + (W.mixedAntisymmetricBoxFactors i j a).ComplexityLE (mixedBoxBudget n p) := by + have hbound : p + 4 ≤ mixedBoxBudget n p := le_add_of_nonneg_right (Nat.cast_nonneg _) + unfold mixedAntisymmetricBoxFactors + split <;> exact (W.mixedKernelFactors_complexity i j _ a.2).mono hbound + +theorem mixedAntisymmetricBoxFactors_normBound (i j : Fin W.outputDim) (a : MixedBoxFactor n) : + (W.mixedAntisymmetricBoxFactors i j a).normBound = 1 := by + unfold mixedAntisymmetricBoxFactors + split <;> exact W.mixedKernelFactors_normBound i j _ a.2 + +theorem mixedAntisymmetricBoxFactors_eval (i j : Fin W.outputDim) (x : MixedBoxIndex n → ℤ) : + (∏ a, (W.mixedAntisymmetricBoxFactors i j a).eval x) = W.mixedAntisymmetricBoxValue i j x := by + have hrow (ω : Fin (n + 2) → Bool) : + (∏ b : Fin 2, (W.mixedAntisymmetricBoxFactors i j (ω, b)).eval x) = + conjugationPower (booleanWeight ω) (W.mixedAntisymmetric i j (fun a => x (a, ω a))) := by + rw [conjugationPower_eq_if_mod] + by_cases hω : booleanWeight ω % 2 = 0 + · simpa only [mixedAntisymmetricBoxFactors, hω, ite_true, mixedBoxCorner] using + W.mixedKernelFactors_eval i j (mixedBoxCorner ω) x + · simpa only [mixedAntisymmetricBoxFactors, hω, ite_false, Niltest.eval_conjugate, + star_prod, mixedBoxCorner] using + congrArg star (W.mixedKernelFactors_eval i j (mixedBoxCorner ω) x) + rw [Fintype.prod_prod_type] + simp_rw [hrow] + simp only [mixedAntisymmetricBoxValue, boxCornerProduct, boxCorner_pair] + +theorem mixedAntisymmetricBoxValue_norm (i j : Fin W.outputDim) (x : MixedBoxIndex n → ℤ) : + ‖W.mixedAntisymmetricBoxValue i j x‖ ≤ 1 := by + rw [← W.mixedAntisymmetricBoxFactors_eval i j x, norm_prod] + apply Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) + intro a _ + exact ((W.mixedAntisymmetricBoxFactors i j a).norm_eval_le x).trans_eq + (by rw [W.mixedAntisymmetricBoxFactors_normBound i j a]; rfl) + +theorem mixedAntisymmetricBoxFactors_vertical (i j : Fin W.outputDim) (a : MixedBoxFactor n) + (z : W.model.RealGroup) + (hz : z ∈ W.model.filtration.realification.subgroup (∑ _ : MixedReplicatedIndex (n + 1), 1)) + (x : W.model.Space) : + (W.mixedAntisymmetricBoxFactors i j a).observable (z • x) = + CircleFourier.character + ((realifyFunctional (W.mixedAntisymmetricBoxFrequencies a) z.coord : ℝ) : CircleFourier.Circle) * + (W.mixedAntisymmetricBoxFactors i j a).observable x := by + unfold mixedAntisymmetricBoxFactors mixedAntisymmetricBoxFrequencies + split_ifs + · exact W.mixedKernelFactors_vertical i j _ a.2 z hz x + · exact Niltest.conjugate_vertical _ _ (W.mixedKernelFactors_vertical i j _ a.2) z hz x + +variable [TopologicalSpace (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [T2Space (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + +noncomputable def mixedAntisymmetricBoxNiltest (hp : 0 ≤ p) (i j : Fin W.outputDim) : + (pi (fun _ : MixedBoxFactor n => W.model)).Niltest (fun _ : MixedBoxIndex n => 1) := + piNiltest (fun _ : MixedBoxFactor n => W.model) (W.mixedAntisymmetricBoxFactors i j) + (by dsimp only [mixedBoxBudget]; positivity) + (mixedBoxFactor_card_le_budget n hp) + (W.mixedAntisymmetricBoxFactors_complexity i j) + +theorem mixedAntisymmetricBoxNiltest_complexity (hp : 0 ≤ p) (i j : Fin W.outputDim) : + (W.mixedAntisymmetricBoxNiltest hp i j).ComplexityLE (productNiltestBudget (mixedBoxBudget n p)) := + piNiltest_complexity (fun _ : MixedBoxFactor n => W.model) (W.mixedAntisymmetricBoxFactors i j) + (by dsimp only [mixedBoxBudget]; positivity) + (mixedBoxFactor_card_le_budget n hp) + (W.mixedAntisymmetricBoxFactors_complexity i j) + +theorem mixedAntisymmetricBoxNiltest_eval (hp : 0 ≤ p) (i j : Fin W.outputDim) + (x : MixedBoxIndex n → ℤ) : + (W.mixedAntisymmetricBoxNiltest hp i j).eval x = W.mixedAntisymmetricBoxValue i j x := by + rw [mixedAntisymmetricBoxNiltest, piNiltest_eval] + exact W.mixedAntisymmetricBoxFactors_eval i j x + +theorem mixedAntisymmetricBoxNiltest_vertical (hp : 0 ≤ p) (i j : Fin W.outputDim) + (z : (pi (fun _ : MixedBoxFactor n => W.model)).RealGroup) + (hz : z ∈ (pi (fun _ : MixedBoxFactor n => W.model)).filtration.realification.subgroup + (∑ _ : MixedReplicatedIndex (n + 1), 1)) + (x : (pi (fun _ : MixedBoxFactor n => W.model)).Space) : + (W.mixedAntisymmetricBoxNiltest hp i j).observable (z • x) = + CircleFourier.character + ((realifyFunctional (piFrequency W.mixedAntisymmetricBoxFrequencies) z.coord : ℝ) : + CircleFourier.Circle) * (W.mixedAntisymmetricBoxNiltest hp i j).observable x := + piNiltest_vertical (fun _ : MixedBoxFactor n => W.model) (W.mixedAntisymmetricBoxFactors i j) + W.mixedAntisymmetricBoxFrequencies (by dsimp only [mixedBoxBudget]; positivity) + (mixedBoxFactor_card_le_budget n hp) + (W.mixedAntisymmetricBoxFactors_complexity i j) + (W.mixedAntisymmetricBoxFactors_vertical i j) z hz x + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {n : ℕ} {p : ℝ} (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) + +theorem mixedAntisymmetricBoxValue_mean (N : ℕ) [NeZero N] (i j : Fin W.outputDim) : + (𝔼 x ∈ integerBox (fun _ : MixedBoxIndex n => N), W.mixedAntisymmetricBoxValue i j x) = + boxPhaseMoment (n + 2) (fun x : Fin (n + 2) → ZMod N => W.mixedAntisymmetric i j (fun a => (x a).val)) := by + exact integerBox_cornerProduct_mean (n + 2) N (W.mixedAntisymmetric i j) + +variable [TopologicalSpace (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [T2Space (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + +theorem mixedAntisymmetricBoxNiltest_mean (hp : 0 ≤ p) (N : ℕ) [NeZero N] + (i j : Fin W.outputDim) : + (𝔼 x ∈ integerBox (fun _ : MixedBoxIndex n => N), (W.mixedAntisymmetricBoxNiltest hp i j).eval x) = + boxPhaseMoment (n + 2) (fun x : Fin (n + 2) → ZMod N => W.mixedAntisymmetric i j (fun a => (x a).val)) := by + simp_rw [W.mixedAntisymmetricBoxNiltest_eval hp] + exact W.mixedAntisymmetricBoxValue_mean N i j + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +structure NativeMixedBoxFactorization {n : ℕ} {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) (N : ℕ) (q : ℝ) where + leftIndex : Fin W.outputDim + rightIndex : Fin W.outputDim + nonnegative : 0 ≤ p + [topology : TopologicalSpace (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [topologicalAdd : IsTopologicalAddGroup (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [continuousSMul : ContinuousSMul ℝ (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + [hausdorff : T2Space (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L))] + basis : Basis (Fin (finrank ℚ (MixedBoxFactor n → W.L))) ℚ (MixedBoxFactor n → W.L) + weight : Fin (finrank ℚ (MixedBoxFactor n → W.L)) → ℕ + adapted : ∀ k, (pi (fun _ : MixedBoxFactor n => W.model)).filtration.layer k = + Submodule.span ℚ (basis '' {i | k ≤ weight i}) + height : ∀ i j, rationalLogHeight + ((pi (fun _ : MixedBoxFactor n => W.model)).basis.repr (basis i) j) ≤ q + factorization : (pi (fun _ : MixedBoxFactor n => W.model)).filtration.ControlledSymbolFactorization + basis weight adapted (piFrequency W.mixedAntisymmetricBoxFrequencies) + (fun _ : MixedBoxIndex n => (N : ℝ)) + ((W.mixedAntisymmetricBoxNiltest nonnegative leftIndex rightIndex).symbol basis weight adapted) q + +theorem exists_mixed_box_step_drop_indices (n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ}, 0 ≤ p → + ∀ (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) + {N : ℕ} [NeZero N] (i j : Fin W.outputDim), + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + Real.exp (-p) ≤ (boxPhaseMoment (n + 2) (fun x : Fin (n + 2) → ZMod N => + W.mixedAntisymmetric i j (fun a => (x a).val))).re → + ∃ R : NativeMixedBoxFactorization W N ((p + C) ^ C), + R.leftIndex = i ∧ R.rightIndex = j := by + have hdegree : (∑ _ : MixedReplicatedIndex (n + 1), (1 : ℕ)) = n + 2 := by + have hc : Fintype.card (MixedReplicatedIndex (n + 1)) = n + 2 := replicatedMixed_card (n + 1) + rw [Finset.sum_const, Finset.card_univ, hc] + simp + obtain ⟨a, _, hstep⟩ := exists_intrinsic_step_drop (∑ _ : MixedReplicatedIndex (n + 1), 1) (by omega) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 4 + Polynomial.C (2 ^ (n + 3)) + let R := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + Polynomial.C (2 * (n + 2)) + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (R + 1 + (R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro p hp W N _ i j hN hbox + let r := productNiltestBudget (mixedBoxBudget n p) + p + ((2 * (n + 2) : ℕ) : ℝ) + have hprod : 0 ≤ productNiltestBudget (mixedBoxBudget n p) := by + unfold productNiltestBudget productObservableLipBudget mixedBoxBudget + positivity + have hdim : (0 : ℝ) ≤ ((2 * (n + 2) : ℕ) : ℝ) := Nat.cast_nonneg _ + have hpr : p ≤ r := by + dsimp only [r] + linarith only [hprod, hdim] + have hdimr : ((2 * (n + 2) : ℕ) : ℝ) ≤ r := by dsimp only [r]; linarith only [hprod, hp] + have hTr : productNiltestBudget (mixedBoxBudget n p) ≤ r := by + dsimp only [r] + linarith only [hp, hdim] + have hr : 0 ≤ r := hp.trans hpr + have hcost : r + 1 + (r + a) ^ a ≤ (p + C) ^ C := by + simpa [X, Q, R, r, mixedBoxBudget, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget p hp + have hpow : 0 ≤ (r + a) ^ a := by positivity + have hheight : r + 1 ≤ (p + C) ^ C := by linarith only [hcost, hpow] + have hfactor : (r + a) ^ a ≤ (p + C) ^ C := by linarith only [hcost, hr] + obtain ⟨τ, htA, htM, htT⟩ := exists_real_module_topology + (productFinBasis (fun _ : MixedBoxFactor n => W.model)) + let : TopologicalSpace (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L)) := τ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L)) := htA + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L)) := htM + let : T2Space (ℝ ⊗[ℚ] (MixedBoxFactor n → W.L)) := htT + let D := pi (fun _ : MixedBoxFactor n => W.model) + let T := W.mixedAntisymmetricBoxNiltest hp i j + obtain ⟨e, ω, hF, he, hconstruct⟩ := hstep D hr T + ((W.mixedAntisymmetricBoxNiltest_complexity hp i j).mono hTr) + have hbias : Real.exp (-r) ≤ + ‖𝔼 x ∈ translatedIntegerBox 0 (fun _ : MixedBoxIndex n => N), T.eval x‖ := by + have hzero : translatedIntegerBox 0 (fun _ : MixedBoxIndex n => N) = + integerBox (fun _ : MixedBoxIndex n => N) := by + ext x + simp only [mem_translatedIntegerBox, mem_integerBox, Pi.zero_apply, zero_add] + rw [hzero, show T = W.mixedAntisymmetricBoxNiltest hp i j from rfl, + W.mixedAntisymmetricBoxNiltest_mean] + exact (Real.exp_le_exp.mpr (neg_le_neg hpr)).trans (hbox.trans (Complex.re_le_norm _)) + have hf := hconstruct (piFrequency W.mixedAntisymmetricBoxFrequencies) + (W.mixedAntisymmetricBoxNiltest_vertical hp i j) 0 (fun _ : MixedBoxIndex n => N) + (fun _ => NeZero.pos N) (by simpa [MixedBoxIndex, Nat.mul_comm] using hdimr) + (fun _ => (Real.exp_le_exp.mpr hfactor).trans hN) hbias + exact ⟨{ + leftIndex := i + rightIndex := j + nonnegative := hp + topology := τ + topologicalAdd := htA + continuousSMul := htM + hausdorff := htT + basis := e + weight := ω + adapted := hF + height := fun i j => (he i j).trans hheight + factorization := NilpotentLieFiltration.ControlledSymbolFactorization.mono + D.filtration e ω hF hf hfactor (fun _ => by exact_mod_cast NeZero.pos N) }, rfl, rfl⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoefficientSmallSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoefficientSmallSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc8765bd63c110011a47bdbf6977c4fb36558a23 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoefficientSmallSupport.lean @@ -0,0 +1,481 @@ +import Mathlib.MeasureTheory.Measure.Prod +import OAI.Combinatorics.Progressions.Estimates.LinearLiftSheetCompatibility +import OAI.Combinatorics.Progressions.Estimates.NormalizedSmallLiftHaar +import OAI.Combinatorics.Progressions.Probability.OrthonormalMixedLaw + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory Module Set +open scoped ENNReal + +variable {E T I : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + [MeasurableSpace T] [MeasurableSingletonClass T] [Countable T] [Fintype I] + +noncomputable def translatedQuotientChart (Λ : Submodule ℤ E) (v : T → E) + (x : E × T) : E ⧸ Λ.toAddSubgroup := QuotientAddGroup.mk (x.1 - v x.2) + +theorem translatedQuotientChart_measurable (Λ : Submodule ℤ E) (v : T → E) : + Measurable (translatedQuotientChart Λ v) := by + have hq : Measurable (QuotientAddGroup.mk : E → E ⧸ Λ.toAddSubgroup) := measurable_quotient_mk'' + exact hq.comp (measurable_fst.sub ((measurable_of_countable v).comp measurable_snd)) + +omit [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + [MeasurableSpace T] [MeasurableSingletonClass T] [Countable T] in +theorem translatedQuotientChart_image (Λ : Submodule ℤ E) (v : T → E) (S : Set (E × T)) : + translatedQuotientChart Λ v '' S = + ⋃ t, (fun x => (QuotientAddGroup.mk (x - v t) : E ⧸ Λ.toAddSubgroup)) '' + ((fun x => (x, t)) ⁻¹' S) := by + ext q + constructor + · rintro ⟨⟨x, t⟩, hx, rfl⟩ + exact mem_iUnion.mpr ⟨t, x, hx, rfl⟩ + · intro h + obtain ⟨t, x, hx, rfl⟩ := mem_iUnion.mp h + exact ⟨(x,t), hx, rfl⟩ + +omit [MeasurableSingletonClass T] in +theorem translatedQuotientChart_measurable_image (Λ : Submodule ℤ E) [DiscreteTopology Λ] + (v : T → E) {S : Set (E × T)} (hS : MeasurableSet S) + (hinj : InjOn (translatedQuotientChart Λ v) S) : + MeasurableSet (translatedQuotientChart Λ v '' S) := by + let : IsClosed (Λ.toAddSubgroup : Set E) := AddSubgroup.isClosed_of_discreteTopology + rw [translatedQuotientChart_image] + apply MeasurableSet.iUnion + intro t + have hq : Continuous (fun x : E => (QuotientAddGroup.mk (x - v t) : E ⧸ Λ.toAddSubgroup)) := + continuous_quotient_mk'.comp (continuous_id.sub continuous_const) + apply (hS.preimage (measurable_id.prodMk measurable_const)).image_of_continuousOn_injOn + hq.continuousOn + intro x hx y hy he + exact congrArg Prod.fst (hinj hx hy he) + +theorem translatedQuotientChart_haar_image (Λ : Submodule ℤ E) [DiscreteTopology Λ] + [IsZLattice ℝ Λ] (b : Basis I ℤ Λ) + (μ : Measure (E ⧸ Λ.toAddSubgroup)) [IsProbabilityMeasure μ] [μ.IsAddLeftInvariant] + (v : T → E) {S : Set (E × T)} (hS : MeasurableSet S) + (hinj : InjOn (translatedQuotientChart Λ v) S) : + μ (translatedQuotientChart Λ v '' S) = + (volume.prod (Measure.count : Measure T)) S / ENNReal.ofReal (ZLattice.covolume Λ) := by + rw [translatedQuotientChart_image, Measure.prod_apply_symm hS, lintegral_count] + apply lattice_quotient_haar_countable_sheets Λ b μ v + · intro t + exact hS.preimage (measurable_id.prodMk measurable_const) + · intro t x hx y hy he + exact congrArg Prod.fst (hinj hx hy he) + · intro s t hst + apply Set.disjoint_left.mpr + rintro q ⟨x, hx, rfl⟩ ⟨y, hy, he⟩ + exact hst (congrArg Prod.snd (hinj hx hy he.symm)) + +theorem translatedQuotientChart_map_restrict (Λ : Submodule ℤ E) [DiscreteTopology Λ] + [IsZLattice ℝ Λ] (b : Basis I ℤ Λ) + (μ : Measure (E ⧸ Λ.toAddSubgroup)) [IsProbabilityMeasure μ] [μ.IsAddLeftInvariant] + (v : T → E) {S : Set (E × T)} (hS : MeasurableSet S) + (hinj : InjOn (translatedQuotientChart Λ v) S) : + Measure.map (translatedQuotientChart Λ v) ((volume.prod (Measure.count : Measure T)).restrict S) = + ENNReal.ofReal (ZLattice.covolume Λ) • μ.restrict (translatedQuotientChart Λ v '' S) := by + have hq := translatedQuotientChart_measurable Λ v + ext B hB + rw [Measure.map_apply hq hB, Measure.restrict_apply (hB.preimage hq), + Measure.smul_apply, Measure.restrict_apply hB, smul_eq_mul] + have hm := (hB.preimage hq).inter hS + have hi := hinj.mono (inter_subset_right : (translatedQuotientChart Λ v ⁻¹' B ∩ S) ⊆ S) + have he := translatedQuotientChart_haar_image Λ b μ v hm hi + have hs : translatedQuotientChart Λ v '' (translatedQuotientChart Λ v ⁻¹' B ∩ S) = + B ∩ translatedQuotientChart Λ v '' S := by + ext q + constructor + · rintro ⟨x, ⟨hx, hxs⟩, rfl⟩ + exact ⟨hx, x, hxs, rfl⟩ + · rintro ⟨hqB, x, hxS, rfl⟩ + exact ⟨x, ⟨hqB, hxS⟩, rfl⟩ + have hc : ENNReal.ofReal (ZLattice.covolume Λ) ≠ 0 := + (ENNReal.ofReal_pos.mpr (ZLattice.covolume_pos Λ volume)).ne' + have hx := (ENNReal.eq_div_iff hc ENNReal.ofReal_ne_top).mp he + rw [hs] at hx + exact hx.symm + +theorem translatedQuotientChart_embedding (Λ : Submodule ℤ E) [DiscreteTopology Λ] + (v : T → E) {S : Set (E × T)} (hS : MeasurableSet S) + (hinj : InjOn (translatedQuotientChart Λ v) S) : + MeasurableEmbedding (fun x : S => translatedQuotientChart Λ v x.val) := by + refine ⟨fun x y he => Subtype.ext (hinj x.property y.property he), + (translatedQuotientChart_measurable Λ v).comp measurable_subtype_coe, ?_⟩ + intro A hA + have hm := (MeasurableEmbedding.subtype_coe hS).measurableSet_image' hA + have hi := hinj.mono (show ((↑) : S → E × T) '' A ⊆ S by rintro x ⟨y, hy, rfl⟩; exact y.property) + have he := translatedQuotientChart_measurable_image Λ v hm hi + simpa only [image_image] using he + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory Module Submodule Set + +variable {D : Type*} [Fintype D] {n : ℕ} + +noncomputable def normalizedLatticePoint (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) (x : W × (Fin n → ℤ)) : EuclideanSpace ℝ D := + (normalizedOrthogonalChart W b).symm (x.1, fun i => (x.2 i : ℝ) / (basisAxisScale b i : ℝ)) + +theorem normalizedLatticePoint_continuous (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) : Continuous (normalizedLatticePoint W b) := by + unfold normalizedLatticePoint + fun_prop + +noncomputable def normalizedLatticeQuotient (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) (hb : span ℤ (Set.range b) = projectedIntegerLattice W) : + W × (Fin n → ℤ) → W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup := + translatedQuotientChart (latticeSection (standardEuclideanLattice D) W) + (fun z => projectedLatticeShift (standardEuclideanLattice D) W + (latticeBasisEquiv (projectedIntegerLattice W) b hb z)) + +theorem normalizedLatticeQuotient_measurable (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) (hb : span ℤ (Set.range b) = projectedIntegerLattice W) : + Measurable (normalizedLatticeQuotient W b hb) := translatedQuotientChart_measurable _ _ + +theorem normalizedLatticePoint_eq_sheet (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + (x : W × (Fin n → ℤ)) : normalizedLatticePoint W b x = + latticeSheetPoint W (latticeBasisEquiv (projectedIntegerLattice W) b hb x.2).val x.1 := + (normalizedLatticeSheet_point W (projectedIntegerLattice W) b hb x.2 x.1).symm + +theorem normalizedLatticeQuotient_injOn (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + {Ω : Set (EuclideanSpace ℝ D)} (hΩ : Ω ⊆ standardLatticeSmallBox D) : + Set.InjOn (normalizedLatticeQuotient W b hb) (normalizedLatticePoint W b ⁻¹' Ω) := by + intro x hx y hy he + have hx' : latticeSheetPoint W (latticeBasisEquiv (projectedIntegerLattice W) b hb x.2).val x.1 ∈ Ω := by + rw [← normalizedLatticePoint_eq_sheet W b hb] + exact hx + have hy' : latticeSheetPoint W (latticeBasisEquiv (projectedIntegerLattice W) b hb y.2).val y.1 ∈ Ω := by + rw [← normalizedLatticePoint_eq_sheet W b hb] + exact hy + have h := latticeSheetQuotient_injective_on_region (standardEuclideanLattice D) W + (fun a ha c hc hac => standardLatticeSmallBox_separates D (hΩ ha) (hΩ hc) hac) hx' hy' he + exact Prod.ext h.2 ((latticeBasisEquiv (projectedIntegerLattice W) b hb).injective h.1) + +theorem normalizedLatticeQuotient_embedding (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + {Ω : Set (EuclideanSpace ℝ D)} (hΩm : MeasurableSet Ω) (hΩ : Ω ⊆ standardLatticeSmallBox D) : + MeasurableEmbedding + (fun x : normalizedLatticePoint W b ⁻¹' Ω => normalizedLatticeQuotient W b hb x.val) := + translatedQuotientChart_embedding _ _ (hΩm.preimage (normalizedLatticePoint_continuous W b).measurable) + (normalizedLatticeQuotient_injOn W b hb hΩ) + +theorem normalizedLatticeQuotient_map_restrict (W : Submodule ℝ (EuclideanSpace ℝ D)) + [IsZLattice ℝ (latticeSection (standardEuclideanLattice D) W)] + (b : Basis (Fin n) ℝ Wᗮ) (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + (μ : Measure (W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup)) + [IsProbabilityMeasure μ] [μ.IsAddLeftInvariant] + {Ω : Set (EuclideanSpace ℝ D)} (hΩm : MeasurableSet Ω) (hΩ : Ω ⊆ standardLatticeSmallBox D) : + Measure.map (normalizedLatticeQuotient W b hb) + ((volume.prod (Measure.count : Measure (Fin n → ℤ))).restrict + (normalizedLatticePoint W b ⁻¹' Ω)) = + ENNReal.ofReal (ZLattice.covolume (latticeSection (standardEuclideanLattice D) W)) • + μ.restrict (normalizedLatticeQuotient W b hb '' (normalizedLatticePoint W b ⁻¹' Ω)) := + translatedQuotientChart_map_restrict _ (Free.chooseBasis ℤ _) μ _ + (hΩm.preimage (normalizedLatticePoint_continuous W b).measurable) + (normalizedLatticeQuotient_injOn W b hb hΩ) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module Submodule Set + +variable {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} + +theorem basisAxisScale_cast_pos {E J : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (b : Basis J ℝ E) (j : J) : (0 : ℝ) < basisAxisScale b j := + Nat.cast_pos.mpr (basisAxisScale_pos b j) + +noncomputable def latticeConstantMass (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) (δ : Fin n → ℝ) (hδ : ∀ j, 0 < δ j) : Fin n → PMF ℤ := + fun j => constantIntegerPMF (basisAxisScale b j) (δ j) (basisAxisScale_cast_pos b j) (hδ j) + +theorem constantCoefficient_chart_support (W : Submodule ℝ (EuclideanSpace ℝ D)) + (b : Basis (Fin n) ℝ Wᗮ) (e : OrthonormalBasis I ℝ W) + (w : I → ℝ) (hw : ∀ i, 0 < w i) (δ : Fin n → ℝ) (hδ : ∀ j, 0 < δ j) + {C R : ℝ} (hC : 0 ≤ C) (hR : 0 ≤ R) + (hchart : ∀ p, ‖(normalizedOrthogonalChart W b).symm p‖ ≤ C * ‖p‖) + (hwR : ∀ i, w i ≤ R) (hδR : ∀ j, δ j ≤ R) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1 / 4) + {x : (I → ℝ) × (Fin n → ℤ)} + (hx : mixedCoefficientDensity (fun _ => 0) w (latticeConstantMass W b δ hδ) x ≠ 0) : + normalizedLatticePoint W b (orthonormalMixedChart e x) ∈ standardLatticeSmallBox D := by + have h := constantCoefficientDensity_buffer w hw (fun j => (basisAxisScale b j : ℝ)) δ + (basisAxisScale_cast_pos b) hδ hR hwR hδR hx + have hu : ‖x.1‖ ≤ R := h.1.trans (by linarith) + have hz : ‖fun j => (x.2 j : ℝ) / (basisAxisScale b j : ℝ)‖ ≤ R := h.2.trans (by linarith) + have he : ‖orthonormalChart e x.1‖ ≤ (Fintype.card I : ℝ) * R := + (orthonormalChart_norm_le e x.1).trans (mul_le_mul_of_nonneg_left hu (Nat.cast_nonneg _)) + have hp : ‖(orthonormalChart e x.1, fun j => (x.2 j : ℝ) / (basisAxisScale b j : ℝ))‖ ≤ + ((Fintype.card I : ℝ) + 1) * R := by + rw [Prod.norm_def] + apply max_le + · nlinarith + · have ha : (0 : ℝ) ≤ Fintype.card I := Nat.cast_nonneg _ + nlinarith + have hn : ‖normalizedLatticePoint W b (orthonormalMixedChart e x)‖ ≤ 1 / 4 := by + change ‖(normalizedOrthogonalChart W b).symm + (orthonormalChart e x.1, fun j => (x.2 j : ℝ) / (basisAxisScale b j : ℝ))‖ ≤ _ + calc + _ ≤ C * ‖(orthonormalChart e x.1, fun j => (x.2 j : ℝ) / (basisAxisScale b j : ℝ))‖ := hchart _ + _ ≤ C * (((Fintype.card I : ℝ) + 1) * R) := mul_le_mul_of_nonneg_left hp hC + _ ≤ 1 / 4 := by simpa only [mul_assoc] using hsmall + intro j + have hj := PiLp.norm_apply_le (normalizedLatticePoint W b (orthonormalMixedChart e x)) j + rw [Real.norm_eq_abs] at hj + exact (hj.trans hn).trans_lt (by norm_num) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory Module Submodule + +variable {D : Type*} [Fintype D] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) + +noncomputable def normalizedChartReference (Ω : Set (EuclideanSpace ℝ D)) : + Measure (W × (Fin n → ℤ)) := + (ENNReal.ofReal (ZLattice.covolume (latticeSection (standardEuclideanLattice D) W)))⁻¹ • + (volume.prod (Measure.count : Measure (Fin n → ℤ))).restrict + (normalizedLatticePoint W b ⁻¹' Ω) + +def normalizedChartRegion (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + (Ω : Set (EuclideanSpace ℝ D)) : + Set (W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup) := + normalizedLatticeQuotient W b hb '' (normalizedLatticePoint W b ⁻¹' Ω) + +theorem normalizedChartRegion_measurable + (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + {Ω : Set (EuclideanSpace ℝ D)} (hΩm : MeasurableSet Ω) + (hΩ : Ω ⊆ standardLatticeSmallBox D) : + MeasurableSet (normalizedChartRegion W b hb Ω) := by + have he := normalizedLatticeQuotient_embedding W b hb hΩm hΩ + have hr : Set.range (fun x : normalizedLatticePoint W b ⁻¹' Ω => + normalizedLatticeQuotient W b hb x.val) = normalizedChartRegion W b hb Ω := by + ext y + constructor + · rintro ⟨x, rfl⟩ + exact ⟨x.val, x.property, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + rw [← hr] + exact he.measurableSet_range + +variable [IsZLattice ℝ (latticeSection (standardEuclideanLattice D) W)] +variable (hb : span ℤ (Set.range b) = projectedIntegerLattice W) +variable (μ : Measure (W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup)) +variable [IsProbabilityMeasure μ] [μ.IsAddLeftInvariant] + +theorem normalizedChartReference_map + {Ω : Set (EuclideanSpace ℝ D)} (hΩm : MeasurableSet Ω) + (hΩ : Ω ⊆ standardLatticeSmallBox D) : + (normalizedChartReference W b Ω).map (normalizedLatticeQuotient W b hb) = + μ.restrict (normalizedChartRegion W b hb Ω) := by + have hc : ENNReal.ofReal (ZLattice.covolume + (latticeSection (standardEuclideanLattice D) W)) ≠ 0 := + (ENNReal.ofReal_pos.mpr (ZLattice.covolume_pos _ volume)).ne' + rw [normalizedChartReference, + Measure.map_smul _ (normalizedLatticeQuotient_measurable W b hb).aemeasurable, + normalizedLatticeQuotient_map_restrict W b hb μ hΩm hΩ, smul_smul, + ENNReal.inv_mul_cancel hc ENNReal.ofReal_ne_top, one_smul] + rfl + +include hb μ in +theorem normalizedChartReference_finite + {Ω : Set (EuclideanSpace ℝ D)} (hΩm : MeasurableSet Ω) + (hΩ : Ω ⊆ standardLatticeSmallBox D) : + IsFiniteMeasure (normalizedChartReference W b Ω) := by + have : IsFiniteMeasure ((normalizedChartReference W b Ω).map + (normalizedLatticeQuotient W b hb)) := by + rw [normalizedChartReference_map W b hb μ hΩm hΩ] + infer_instance + exact Measure.isFiniteMeasure_of_map (normalizedLatticeQuotient_measurable W b hb).aemeasurable + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module Submodule +open scoped BigOperators + +variable {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) +variable (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + +theorem normalizedLatticeQuotient_linear_lift (x : W × (Fin n → ℤ)) : + normalizedLatticeQuotient W b hb x = + QuotientAddGroup.mk (x.1 - W.orthogonalProjectionOnto + (standardLatticeIntegerLift W b hb x.2).val) := + standardLatticeIntegerLift_sheet W b hb x.2 x.1 + +noncomputable def normalizedLatticeQuotientHom : + W × (Fin n → ℤ) →+ + W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup where + toFun := normalizedLatticeQuotient W b hb + map_zero' := by + rw [normalizedLatticeQuotient_linear_lift] + simp + map_add' x y := by + simp only [normalizedLatticeQuotient_linear_lift, Prod.fst_add, Prod.snd_add, + map_add, Submodule.coe_add] + change QuotientAddGroup.mk' _ (x.1 + y.1 - + (W.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb x.2).val + + W.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb y.2).val)) = _ + rw [show x.1 + y.1 - + (W.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb x.2).val + + W.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb y.2).val) = + (x.1 - W.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb x.2).val) + + (y.1 - W.orthogonalProjectionOnto (standardLatticeIntegerLift W b hb y.2).val) by abel, + map_add] + rfl + +theorem normalizedLatticeQuotient_sum_zsmul {S : Type*} (s : Finset S) + (a : S → ℤ) (x : S → W × (Fin n → ℤ)) : + normalizedLatticeQuotient W b hb (∑ i ∈ s, a i • x i) = + ∑ i ∈ s, a i • normalizedLatticeQuotient W b hb (x i) := by + change normalizedLatticeQuotientHom W b hb _ = _ + simp only [map_sum, map_zsmul, normalizedLatticeQuotientHom, AddMonoidHom.coe_mk, + ZeroHom.coe_mk] + +noncomputable def normalizedLatticePointHom : + W × (Fin n → ℤ) →+ EuclideanSpace ℝ D where + toFun := normalizedLatticePoint W b + map_zero' := by + simp [normalizedLatticePoint] + rfl + map_add' x y := by + unfold normalizedLatticePoint + rw [← map_add] + congr 1 + ext i + · rfl + · simp [add_div] + +theorem normalizedLatticePoint_sum_zsmul {S : Type*} (s : Finset S) + (a : S → ℤ) (x : S → W × (Fin n → ℤ)) : + normalizedLatticePoint W b (∑ i ∈ s, a i • x i) = + ∑ i ∈ s, a i • normalizedLatticePoint W b (x i) := by + change normalizedLatticePointHom W b _ = _ + simp only [map_sum, map_zsmul, normalizedLatticePointHom, AddMonoidHom.coe_mk, + ZeroHom.coe_mk] + +noncomputable def orthonormalMixedChartHom (o : OrthonormalBasis I ℝ W) : + ((I → ℝ) × (Fin n → ℤ)) →+ (W × (Fin n → ℤ)) where + toFun := orthonormalMixedChart o + map_zero' := by + change (orthonormalChart o 0, (0 : Fin n → ℤ)) = 0 + simp + map_add' x y := by + change (orthonormalChart o (x.1 + y.1), x.2 + y.2) = + (orthonormalChart o x.1, x.2) + (orthonormalChart o y.1, y.2) + simp only [map_add, Prod.mk_add_mk] + +theorem orthonormalMixedChart_sum_zsmul (o : OrthonormalBasis I ℝ W) + {S : Type*} (s : Finset S) (a : S → ℤ) + (x : S → (I → ℝ) × (Fin n → ℤ)) : + orthonormalMixedChart o (∑ i ∈ s, a i • x i) = + ∑ i ∈ s, a i • orthonormalMixedChart o (x i) := by + change orthonormalMixedChartHom W o _ = _ + simp only [map_sum, map_zsmul, orthonormalMixedChartHom, AddMonoidHom.coe_mk, + ZeroHom.coe_mk] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module Submodule +open scoped BigOperators + +theorem affineProbabilityProfile_abs_le (c : ℝ) {w x : ℝ} (hw : 0 < w) + (hx : affineProbabilityProfile c w x ≠ 0) : |x| ≤ |c| + w := by + have hb := affineProbabilityProfile_support c hw hx + have ht := abs_add_le (x - c) c + rw [sub_add_cancel] at ht + linarith + +theorem normalizedMixedPoint_small {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) (o : OrthonormalBasis I ℝ W) + {C R : ℝ} (hC : 0 ≤ C) (hR : 0 ≤ R) + (hchart : ∀ p, ‖(normalizedOrthogonalChart W b).symm p‖ ≤ C * ‖p‖) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1 / 4) + (x : (I → ℝ) × (Fin n → ℤ)) + (hu : ∀ i, |x.1 i| ≤ R) (hz : ∀ i, |(x.2 i : ℝ) / basisAxisScale b i| ≤ R) : + normalizedLatticePoint W b (orthonormalMixedChart o x) ∈ standardLatticeSmallBox D := by + have hu' : ‖x.1‖ ≤ R := (pi_norm_le_iff_of_nonneg hR).mpr (by simpa only [Real.norm_eq_abs] using hu) + have hz' : ‖fun i => (x.2 i : ℝ) / basisAxisScale b i‖ ≤ R := + (pi_norm_le_iff_of_nonneg hR).mpr (by simpa only [Real.norm_eq_abs] using hz) + have ho : ‖orthonormalChart o x.1‖ ≤ (Fintype.card I : ℝ) * R := + (orthonormalChart_norm_le o x.1).trans (mul_le_mul_of_nonneg_left hu' (Nat.cast_nonneg _)) + have hp : ‖(orthonormalChart o x.1, fun i => (x.2 i : ℝ) / basisAxisScale b i)‖ ≤ + ((Fintype.card I : ℝ) + 1) * R := by + rw [Prod.norm_def] + apply max_le <;> nlinarith [Nat.cast_nonneg (α := ℝ) (Fintype.card I)] + have hn : ‖normalizedLatticePoint W b (orthonormalMixedChart o x)‖ ≤ 1 / 4 := by + apply (hchart _).trans + exact (mul_le_mul_of_nonneg_left hp hC).trans (by simpa only [mul_assoc] using hsmall) + intro d + have hd := PiLp.norm_apply_le (normalizedLatticePoint W b (orthonormalMixedChart o x)) d + rw [Real.norm_eq_abs] at hd + exact (hd.trans hn).trans_lt (by norm_num) + +theorem mixedCoefficient_small_support {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) (o : OrthonormalBasis I ℝ W) + {C R : ℝ} (hC : 0 ≤ C) (hR : 0 ≤ R) + (hchart : ∀ p, ‖(normalizedOrthogonalChart W b).symm p‖ ≤ C * ‖p‖) + (hsmall : C * ((Fintype.card I : ℝ) + 1) * R ≤ 1 / 4) + (c w : I → ℝ) (hw : ∀ i, 0 < w i) (hcw : ∀ i, |c i| + w i ≤ R) (p : Fin n → PMF ℤ) + (hp : ∀ i k, k ∈ (p i).support → |(k : ℝ) / basisAxisScale b i| ≤ R) + (x : (I → ℝ) × (Fin n → ℤ)) (hx : mixedCoefficientDensity c w p x ≠ 0) : + normalizedLatticePoint W b (orthonormalMixedChart o x) ∈ standardLatticeSmallBox D := by + have hs := (mixedCoefficientDensity_support c w p x).mp hx + exact normalizedMixedPoint_small W b o hC hR hchart hsmall x + (fun i => (affineProbabilityProfile_abs_le _ (hw i) (hs.1 i)).trans (hcw i)) + (fun i => hp i _ (hs.2 i)) + +theorem mixedCoefficientDensity_width_cap {I Z : Type*} [Fintype I] [Fintype Z] + (c w : I → ℝ) (hw : ∀ i, 0 < w i) (p : Z → PMF ℤ) (x : (I → ℝ) × (Z → ℤ)) : + mixedCoefficientDensity c w p x ≤ profileWidthFactor w := by + have hprod : (∏ z, (p z (x.2 z)).toReal) ≤ 1 := by + apply Finset.prod_le_one₀ (fun _ _ => ENNReal.toReal_nonneg) + intro z _ + simpa only [ENNReal.toReal_one] using ENNReal.toReal_mono ENNReal.one_ne_top ((p z).coe_le_one (x.2 z)) + have hf : affineProductProfile c w x.1 ≤ profileWidthFactor w := + (le_abs_self _).trans (affineProductProfile_norm_le c w hw x.1) + exact (mul_le_of_le_one_right (affineProductProfile_nonneg c w hw x.1) hprod).trans hf + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoordinateTransfer.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoordinateTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..be592d719f7f3d703a99ff6296223a55fcbd9b14 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoordinateTransfer.lean @@ -0,0 +1,382 @@ +import OAI.Combinatorics.Progressions.Estimates.ComplexExchangeTransfer +import OAI.Combinatorics.Progressions.Fourier.NiltestConjugateFrequency +import OAI.Combinatorics.Progressions.Lattices.NativeFrozenAffineExpansion +import OAI.Combinatorics.Progressions.Lattices.NativeIntegerSelfEquivalence +import OAI.Combinatorics.Progressions.Nilpotent.NativeMultidegreeNiltest + +namespace OAI + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + +noncomputable def boxComponent (out : Fin W.outputDim) (a b : Fin 4) : + W.model.Niltest (fun _ : Fin 4 => 1) := + (W.component out).linearPullbackHom + ![{ toFun := fun n => n a, map_zero' := rfl, map_add' := fun _ _ => rfl }, + { toFun := fun n => n b, map_zero' := rfl, map_add' := fun _ _ => rfl }] + +theorem boxComponent_eval (out : Fin W.outputDim) (a b : Fin 4) (n : Fin 4 → ℤ) : + (W.boxComponent out a b).eval n = W.eval out (correlationInput (n a) (n b)) := by + rw [boxComponent, Niltest.eval_linearPullbackHom, component_eval] + apply congrArg (W.eval out) + funext k + fin_cases k <;> rfl + +theorem boxComponent_vertical (out : Fin W.outputDim) (a b : Fin 4) + (z : W.model.RealGroup) + (hz : z ∈ W.model.filtration.realification.subgroup (∑ k, mixedCorrelationDegree 1 k)) + (x : W.model.Space) : + (W.boxComponent out a b).observable (z • x) = + CircleFourier.character + ((realifyFunctional W.vertical.frequency z.coord : ℝ) : CircleFourier.Circle) * + (W.boxComponent out a b).observable x := by + exact W.vertical.vertical out z (by rwa [W.multi.realSubgroup_top]) x + +noncomputable def antisymmetricBoxValue (i j : Fin W.outputDim) (n : Fin 4 → ℤ) : ℂ := + let K := fun x y => star (W.eval i (correlationInput x y)) * W.eval j (correlationInput y x) + K (n 0) (n 2) * star (K (n 1) (n 2)) * star (K (n 0) (n 3)) * K (n 1) (n 3) + +noncomputable def antisymmetricBoxFactors (i j : Fin W.outputDim) : + Fin 8 → W.model.Niltest (fun _ : Fin 4 => 1) := + ![(W.boxComponent i 0 2).conjugate, W.boxComponent j 2 0, + W.boxComponent i 1 2, (W.boxComponent j 2 1).conjugate, + W.boxComponent i 0 3, (W.boxComponent j 3 0).conjugate, + (W.boxComponent i 1 3).conjugate, W.boxComponent j 3 1] + +noncomputable def antisymmetricBoxFrequencies : Fin 8 → (W.L →ₗ[ℚ] ℚ) := + ![-W.vertical.frequency, W.vertical.frequency, W.vertical.frequency, -W.vertical.frequency, + W.vertical.frequency, -W.vertical.frequency, -W.vertical.frequency, W.vertical.frequency] + +theorem antisymmetricBoxFactors_complexity (i j : Fin W.outputDim) (k : Fin 8) : + (W.antisymmetricBoxFactors i j k).ComplexityLE (p + 8) := by + have hi := (W.component_complexity i).mono (by linarith : p + 4 ≤ p + 8) + have hj := (W.component_complexity j).mono (by linarith : p + 4 ≤ p + 8) + fin_cases k + · exact hi + · exact hj + · exact hi + · exact hj + · exact hi + · exact hj + · exact hi + · exact hj + +theorem antisymmetricBoxFactors_eval (i j : Fin W.outputDim) (n : Fin 4 → ℤ) : + (∏ k, (W.antisymmetricBoxFactors i j k).eval n) = W.antisymmetricBoxValue i j n := by + simp [antisymmetricBoxFactors, antisymmetricBoxValue, Fin.prod_univ_succ, + boxComponent_eval, star_mul, mul_comm, mul_left_comm] + +theorem antisymmetricBoxFactors_vertical (i j : Fin W.outputDim) (k : Fin 8) + (z : W.model.RealGroup) + (hz : z ∈ W.model.filtration.realification.subgroup (∑ k, mixedCorrelationDegree 1 k)) + (x : W.model.Space) : + (W.antisymmetricBoxFactors i j k).observable (z • x) = + CircleFourier.character + ((realifyFunctional (W.antisymmetricBoxFrequencies k) z.coord : ℝ) : CircleFourier.Circle) * + (W.antisymmetricBoxFactors i j k).observable x := by + fin_cases k + · exact Niltest.conjugate_vertical _ _ (W.boxComponent_vertical i 0 2) z hz x + · exact W.boxComponent_vertical j 2 0 z hz x + · exact W.boxComponent_vertical i 1 2 z hz x + · exact Niltest.conjugate_vertical _ _ (W.boxComponent_vertical j 2 1) z hz x + · exact W.boxComponent_vertical i 0 3 z hz x + · exact Niltest.conjugate_vertical _ _ (W.boxComponent_vertical j 3 0) z hz x + · exact Niltest.conjugate_vertical _ _ (W.boxComponent_vertical i 1 3) z hz x + · exact W.boxComponent_vertical j 3 1 z hz x + +variable [TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → W.L))] [T2Space (ℝ ⊗[ℚ] (Fin 8 → W.L))] + +noncomputable def antisymmetricBoxNiltest (hp : 0 ≤ p) (i j : Fin W.outputDim) : + (pi (fun _ : Fin 8 => W.model)).Niltest (fun _ : Fin 4 => 1) := + piNiltest (fun _ : Fin 8 => W.model) (W.antisymmetricBoxFactors i j) + (by linarith) (by simpa using hp) (W.antisymmetricBoxFactors_complexity i j) + +theorem antisymmetricBoxNiltest_complexity (hp : 0 ≤ p) (i j : Fin W.outputDim) : + (W.antisymmetricBoxNiltest hp i j).ComplexityLE (productNiltestBudget (p + 8)) := + piNiltest_complexity (fun _ : Fin 8 => W.model) (W.antisymmetricBoxFactors i j) + (by linarith) (by simpa using hp) (W.antisymmetricBoxFactors_complexity i j) + +theorem antisymmetricBoxNiltest_eval (hp : 0 ≤ p) (i j : Fin W.outputDim) (n : Fin 4 → ℤ) : + (W.antisymmetricBoxNiltest hp i j).eval n = W.antisymmetricBoxValue i j n := by + rw [antisymmetricBoxNiltest, piNiltest_eval] + exact W.antisymmetricBoxFactors_eval i j n + +theorem antisymmetricBoxNiltest_vertical (hp : 0 ≤ p) (i j : Fin W.outputDim) + (z : (pi (fun _ : Fin 8 => W.model)).RealGroup) + (hz : z ∈ (pi (fun _ : Fin 8 => W.model)).filtration.realification.subgroup + (∑ k, mixedCorrelationDegree 1 k)) + (x : (pi (fun _ : Fin 8 => W.model)).Space) : + (W.antisymmetricBoxNiltest hp i j).observable (z • x) = + CircleFourier.character + ((realifyFunctional (piFrequency W.antisymmetricBoxFrequencies) z.coord : ℝ) : + CircleFourier.Circle) * (W.antisymmetricBoxNiltest hp i j).observable x := + piNiltest_vertical (fun _ : Fin 8 => W.model) (W.antisymmetricBoxFactors i j) + W.antisymmetricBoxFrequencies (by linarith) (by simpa using hp) + (W.antisymmetricBoxFactors_complexity i j) (W.antisymmetricBoxFactors_vertical i j) z hz x + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + +theorem antisymmetricBoxValue_mean (N : ℕ) [NeZero N] (i j : Fin W.outputDim) : + (𝔼 n ∈ integerBox (fun _ : Fin 4 => N), W.antisymmetricBoxValue i j n) = + finiteBoxCorrelation (fun x y : ZMod N => + star (W.evalCyclic N i (correlationInput x y)) * W.evalCyclic N j (correlationInput y x)) := by + have heval (k : Fin W.outputDim) (x y : ZMod N) : + W.eval k (correlationInput (x.val : ℤ) (y.val : ℤ)) = + W.evalCyclic N k (correlationInput x y) := by + apply congrArg (W.eval k) + funext l + exact Fin.cases rfl (fun _ => rfl) l + rw [integerBox_expect_eq_zmod] + simp_rw [expect_fin_cons] + unfold finiteBoxCorrelation + apply Finset.expect_congr rfl + intro x _ + apply Finset.expect_congr rfl + intro x' _ + apply Finset.expect_congr rfl + intro y _ + apply Finset.expect_congr rfl + intro y' _ + change (𝔼 _ : Fin 0 → ZMod N, + W.antisymmetricBoxValue i j ![(x.val : ℤ), (x'.val : ℤ), (y.val : ℤ), (y'.val : ℤ)]) = _ + rw [Fintype.expect_const] + change + (star (W.eval i (correlationInput (x.val : ℤ) (y.val : ℤ))) * + W.eval j (correlationInput (y.val : ℤ) (x.val : ℤ))) * + star (star (W.eval i (correlationInput (x'.val : ℤ) (y.val : ℤ))) * + W.eval j (correlationInput (y.val : ℤ) (x'.val : ℤ))) * + star (star (W.eval i (correlationInput (x.val : ℤ) (y'.val : ℤ))) * + W.eval j (correlationInput (y'.val : ℤ) (x.val : ℤ))) * + (star (W.eval i (correlationInput (x'.val : ℤ) (y'.val : ℤ))) * + W.eval j (correlationInput (y'.val : ℤ) (x'.val : ℤ))) = _ + simp only [heval] + +variable [TopologicalSpace (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (Fin 8 → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (Fin 8 → W.L))] [T2Space (ℝ ⊗[ℚ] (Fin 8 → W.L))] + +theorem antisymmetricBoxNiltest_mean (hp : 0 ≤ p) (N : ℕ) [NeZero N] + (i j : Fin W.outputDim) : + (𝔼 n ∈ integerBox (fun _ : Fin 4 => N), (W.antisymmetricBoxNiltest hp i j).eval n) = + finiteBoxCorrelation (fun x y : ZMod N => + star (W.evalCyclic N i (correlationInput x y)) * W.evalCyclic N j (correlationInput y x)) := by + simp_rw [W.antisymmetricBoxNiltest_eval hp] + exact W.antisymmetricBoxValue_mean N i j + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators + +noncomputable def antisymmetricKernel {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j : Fin W.outputDim) (x y : ℤ) : ℂ := + star (W.eval i (correlationInput x y)) * W.eval j (correlationInput y x) + +theorem antisymmetricKernel_norm {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j : Fin W.outputDim) (x y : ℤ) : ‖W.antisymmetricKernel i j x y‖ ≤ 1 := by + rw [antisymmetricKernel, norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (W.norm_eval i _)).trans + (W.norm_eval j _) + +theorem antisymmetricKernel_cyclic {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (N : ℕ) [NeZero N] (i j : Fin W.outputDim) (x y : ZMod N) : + W.antisymmetricKernel i j (x.val : ℤ) (y.val : ℤ) = + star (W.evalCyclic N i (correlationInput x y)) * W.evalCyclic N j (correlationInput y x) := by + have he (k : Fin W.outputDim) (x y : ZMod N) : + W.eval k (correlationInput (x.val : ℤ) (y.val : ℤ)) = + W.evalCyclic N k (correlationInput x y) := by + apply congrArg (W.eval k) + funext l + fin_cases l <;> rfl + simp only [antisymmetricKernel, he] + +theorem antisymmetricKernel_box {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j : Fin W.outputDim) (x : Fin 4 → ℤ) : + boxKernel (W.antisymmetricKernel i j) x = W.antisymmetricBoxValue i j x := rfl + +theorem exists_mixed_coordinate_slice : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (d : Fin 2) (c : ℤ) (k : Fin W.outputDim), + Nonempty (NativeIntegerExpansion (fun _ : Unit => 1) 1 ((p + C) ^ C) + (fun x => W.eval k (Function.update (fun _ => c) d (x ())))) := by + obtain ⟨C, hC, hfreeze⟩ := exists_frozen_affine_expansion (mixedCorrelationDegree 1) + refine ⟨C, hC, ?_⟩ + intro p W d c k + classical + let A : Fin 2 → ℤ := fun j => if j = d then 1 else 0 + let b : Fin 2 → ℤ := fun j => if j = d then 0 else c + obtain ⟨E, _⟩ := hfreeze W {d} A b k (by + intro j hj + simp only [Finset.mem_singleton] at hj + simp [A, hj]) + have hdegree : (∑ j ∈ ({d} : Finset (Fin 2)), mixedCorrelationDegree 1 j) = 1 := by + simp only [Finset.sum_singleton] + fin_cases d <;> rfl + have heq : (fun x : Unit → ℤ => W.eval k (fun j => b j + A j * x ())) = + (fun x => W.eval k (Function.update (fun _ => c) d (x ()))) := by + funext x + apply congrArg (W.eval k) + funext j + by_cases hj : j = d + · subst j + simp [A, b] + · simp [A, b, hj] + exact ⟨by simpa only [hdegree, heq] using E⟩ + +theorem exists_antisymmetric_coordinate_slice : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j : Fin W.outputDim) (d : Fin 2) (c : ℤ), + Nonempty (NativeIntegerExpansion (fun _ : Unit => 1) 1 ((p + C) ^ C) + (fun x => let z := Function.update (fun _ => c) d (x ()) + W.antisymmetricKernel i j (z 0) (z 1))) := by + obtain ⟨A, _, hslice⟩ := exists_mixed_coordinate_slice + obtain ⟨B, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (((X + Polynomial.C A) ^ A + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p W i j d c + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + obtain ⟨E⟩ := hslice W d c i + obtain ⟨F⟩ := hslice W d.rev c j + obtain ⟨G⟩ := hmul (by positivity : 0 ≤ (p + A) ^ A) E.conjugate F + have hcost : ((p + A) ^ A + B) ^ B ≤ (p + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget p hp + have heq : (fun x : Unit → ℤ => star (W.eval i (Function.update (fun _ => c) d (x ()))) * + W.eval j (Function.update (fun _ => c) d.rev (x ()))) = + (fun x => let z := Function.update (fun _ => c) d (x ()) + W.antisymmetricKernel i j (z 0) (z 1)) := by + funext x + unfold antisymmetricKernel + congr 1 + · congr 1 + apply congrArg (W.eval i) + funext l + fin_cases l <;> rfl + · apply congrArg (W.eval j) + funext l + fin_cases d <;> fin_cases l <;> rfl + exact ⟨by simpa only [heq] using G.mono hcost⟩ + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators + +theorem exists_mixed_self_equivalence : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p), + NativeIntegerVectorEquivalence 1 ((p + C) ^ C) W.eval W.eval := by + have hbound : mixedCorrelationDegree 1 = (fun _ : Fin 2 => 1) := by + funext i + fin_cases i <;> rfl + rw [hbound] + simpa using (exists_integer_self_equivalence (σ := Fin 2)) + +noncomputable def coordinateTransfer {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j k l : Fin W.outputDim) (x : Fin 2 → ℤ) : ℂ := + exchangeTransfer (fun r => W.eval r x) (fun r => W.eval r (fun h => x h.rev)) i j k l + +theorem antisymmetricKernel_tuple {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j : Fin W.outputDim) (x : Fin 2 → ℤ) : + W.antisymmetricKernel i j (x 0) (x 1) = + star (W.eval i x) * W.eval j (fun h => x h.rev) := by + have hxy : correlationInput (x 0) (x 1) = x := by + funext h + fin_cases h <;> rfl + have hyx : correlationInput (x 1) (x 0) = (fun h : Fin 2 => x h.rev) := by + funext h + fin_cases h <;> rfl + simp only [antisymmetricKernel, hxy, hyx] + +theorem coordinateTransfer_diagonal {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j : Fin W.outputDim) (x : Fin 2 → ℤ) : + W.coordinateTransfer i j i j x = (‖W.antisymmetricKernel i j (x 0) (x 1)‖ ^ 2 : ℝ) := by + rw [coordinateTransfer, exchange_transfer_diagonal, W.antisymmetricKernel_tuple] + +theorem coordinateTransfer_matrix_error {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j : Fin W.outputDim) (x : Fin 2 → ℤ) (w : ℝ) (g : ℂ) : + Real.sqrt (∑ k, ∑ l, + ‖W.antisymmetricKernel k l (x 0) (x 1) * + (w * ‖W.antisymmetricKernel i j (x 0) (x 1)‖ ^ 2 : ℝ) - + g * W.coordinateTransfer i j k l x‖ ^ 2) ≤ + ‖W.antisymmetricKernel i j (x 0) (x 1) * (w : ℂ) - g‖ := by + simpa only [W.antisymmetricKernel_tuple, coordinateTransfer] using + exchange_matrix_error_le (fun r => W.eval r x) (fun r => W.eval r (fun h => x h.rev)) + (W.unit_eval x) (W.unit_eval (fun h => x h.rev)) i j + (W.norm_eval i x) (W.norm_eval j (fun h => x h.rev)) w g + +theorem exists_coordinate_transfer_expansions : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) p) + (i j k l : Fin W.outputDim), + Nonempty (NativeIntegerExpansion (fun _ : Fin 2 => 1) 1 ((p + C) ^ C) + (W.coordinateTransfer i j k l)) := by + obtain ⟨A, _, hself⟩ := exists_mixed_self_equivalence + obtain ⟨B, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (((X + Polynomial.C A) ^ A + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p W i j k l + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + obtain ⟨E⟩ := (hself W).expansion i k + obtain ⟨F⟩ := (hself W).expansion l j + let F' := F.linearPullbackHom (fun h : Fin 2 => + { toFun := fun x : Fin 2 → ℤ => x h.rev, map_zero' := rfl, map_add' := fun _ _ => rfl }) + obtain ⟨G⟩ := hmul (by positivity : 0 ≤ (p + A) ^ A) E F' + have hcost : ((p + A) ^ A + B) ^ B ≤ (p + C) ^ C := by + simpa [X, Polynomial.eval₂_pow] using hbudget p hp + exact ⟨G.mono hcost⟩ + +end Erdos3.NativeMultidegreeNilcharacter + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoveredChart.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoveredChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..5352803b712076bc591a4bd849ee8bf9f30bb079 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoveredChart.lean @@ -0,0 +1,83 @@ +import OAI.Combinatorics.Progressions.Sampling.CoveredJetSampler + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped Classical + +abbrev MixedCoveredJetSource {m : ℕ} (I O E : Fin m → Type*) (n : Fin m → ℕ) (d : ℕ) := + (∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) × (∀ j, O j → E j → ZMod d) + +variable {m : ℕ} {I O J E : Fin m → Type*} +variable [∀ j, Fintype (J j)] [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + +noncomputable def mixedCoveredJetCoordinatesEquiv (d : ℕ) : + MixedCoveredJetSource I O E n d ≃ CoveredJetChartSource U O E n d where + toFun := mixedCoveredJetCoordinates U o d + invFun z := (fun j => (mixedArrayRegroup (I j) (Fin (n j)) (O j)).symm + (fun t => (orthonormalMixedChart (o j)).symm (z j t).1), fun j t => (z j t).2) + left_inv z := by + apply Prod.ext + · funext j + simp only [mixedCoveredJetCoordinates, MeasurableEquiv.symm_apply_apply] + · rfl + right_inv z := by + funext j t + simp only [mixedCoveredJetCoordinates, MeasurableEquiv.apply_symm_apply] + +variable [∀ j, Fintype (E j)] +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +noncomputable def mixedCoveredJetChart : MixedCoveredJetSource I O E n d → EuclideanJetLayers U O := + fun z => coveredJetChart U b hb bW d (mixedCoveredJetCoordinates U o d z) + +def mixedCoveredJetRegion (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) : + Set (MixedCoveredJetSource I O E n d) := + mixedCoveredJetCoordinates U o d ⁻¹' coveredJetSourceRegion U b d Ω + +theorem mixedCoveredJetChart_injOn (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) + (hΩ : ∀ j t, Ω j t ⊆ standardLatticeSmallBox (J j)) : + Set.InjOn (mixedCoveredJetChart U o b hb bW d) (mixedCoveredJetRegion U o b d Ω) := by + intro z hz w hw he + apply (mixedCoveredJetCoordinatesEquiv U o d).injective + exact coveredJetChart_injOn U b hb bW d Ω hΩ hz hw he + +theorem mixedCoveredJetChart_image (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) : + mixedCoveredJetChart U o b hb bW d '' mixedCoveredJetRegion U o b d Ω = + coveredJetChart U b hb bW d '' coveredJetSourceRegion U b d Ω := by + ext y + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨mixedCoveredJetCoordinates U o d z, hz, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + obtain ⟨w, hw⟩ := (mixedCoveredJetCoordinatesEquiv (O := O) (E := E) (n := n) U o d).surjective z + refine ⟨w, ?_, ?_⟩ + · change mixedCoveredJetCoordinates U o d w ∈ coveredJetSourceRegion U b d Ω + change mixedCoveredJetCoordinates U o d w = z at hw + rwa [hw] + · change coveredJetChart U b hb bW d (mixedCoveredJetCoordinates U o d w) = _ + exact congrArg (coveredJetChart U b hb bW d) hw + +omit [∀ j, Fintype (E j)] [NeZero d] in +theorem mixedCoveredJetRegion_mono + {Ω Ω' : ∀ j, O j → Set (EuclideanSpace ℝ (J j))} + (hΩ : ∀ j t, Ω j t ⊆ Ω' j t) : + mixedCoveredJetRegion (E := E) U o b d Ω ⊆ mixedCoveredJetRegion U o b d Ω' := by + intro z hz j hj t ht + exact ⟨hΩ j t (hz j hj t ht).1, (hz j hj t ht).2⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoveredChartCompact.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoveredChartCompact.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef3b41f3ab44736888e991d27106fdc5be76032a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedCoveredChartCompact.lean @@ -0,0 +1,134 @@ +import Mathlib.Topology.Algebra.GroupWithZero +import OAI.Combinatorics.Progressions.Probability.MixedCoveredDensityMass + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule MeasureTheory +open scoped Classical + +theorem normalizedLatticePoint_isClosedEmbedding {D : Type*} [Fintype D] {n : ℕ} + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) : + Topology.IsClosedEmbedding (normalizedLatticePoint W b) := by + have hi (i : Fin n) : Topology.IsClosedEmbedding (fun z : ℤ => (z : ℝ) / basisAxisScale b i) := by + have hbi : (basisAxisScale b i : ℝ) ≠ 0 := by exact_mod_cast (basisAxisScale_pos b i).ne' + simpa only [Function.comp_def, Homeomorph.coe_mulRight₀, div_eq_mul_inv] using + (Homeomorph.mulRight₀ (basisAxisScale b i : ℝ)⁻¹ (inv_ne_zero hbi)).isClosedEmbedding.comp + Real.isClosedEmbedding_intCast + have hp := Topology.IsClosedEmbedding.prodMap (Homeomorph.refl W).isClosedEmbedding + (Topology.IsClosedEmbedding.piMap hi) + exact (normalizedOrthogonalChart W b).symm.toHomeomorph.isClosedEmbedding.comp hp + +theorem normalizedLatticePoint_preimage_compact {D : Type*} [Fintype D] {n : ℕ} + (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) + {S : Set (EuclideanSpace ℝ D)} (hS : IsCompact S) : + IsCompact (normalizedLatticePoint W b ⁻¹' S) := + (normalizedLatticePoint_isClosedEmbedding W b).isCompact_preimage hS + +namespace VectorPolynomial + +variable {m : ℕ} {O J B : Fin m → Type*} +variable [∀ j, Fintype (O j)] [∀ j, Fintype (J j)] [∀ j, Fintype (B j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + +omit [∀ j, Fintype (O j)] [∀ j, Fintype (B j)] in +theorem coveredJetSourceRegion_isCompact (d : ℕ) [NeZero d] + (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) (hΩ : ∀ j t, IsCompact (Ω j t)) : + IsCompact (coveredJetSourceRegion (B := B) U b d Ω) := + isCompact_univ_pi (fun j => isCompact_univ_pi (fun t => + (normalizedLatticePoint_preimage_compact _ (b j) (hΩ j t)).prod isCompact_univ)) + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory Module Submodule +open scoped Classical + +variable {m : ℕ} {I O J E : Fin m → Type*} +variable [∀ j, Fintype (J j)] [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + + theorem mixedCoveredJetCoordinatesEquiv_symm_continuous (d : ℕ) : + Continuous (mixedCoveredJetCoordinatesEquiv (O := O) (E := E) (n := n) U o d).symm := by + change Continuous (fun z : CoveredJetChartSource U O E n d => + (fun j => (fun i t => (orthonormalChart (o j)).symm (z j t).1.1 i, + fun i t => (z j t).1.2 i), fun j t => (z j t).2)) + fun_prop + +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + + theorem mixedCoveredJetRegion_isCompact (d : ℕ) [NeZero d] + (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) + (hΩ : ∀ j t, IsCompact (Ω j t)) : + IsCompact (mixedCoveredJetRegion (E := E) U o b d Ω) := by + have h := (coveredJetSourceRegion_isCompact (B := E) U b d Ω hΩ).image + (mixedCoveredJetCoordinatesEquiv_symm_continuous U o d) + convert h using 1 + ext z + constructor + · intro hz + exact ⟨mixedCoveredJetCoordinates U o d z, hz, + (mixedCoveredJetCoordinatesEquiv U o d).symm_apply_apply z⟩ + · rintro ⟨w, hw, rfl⟩ + change mixedCoveredJetCoordinates U o d + ((mixedCoveredJetCoordinatesEquiv U o d).symm w) ∈ coveredJetSourceRegion U b d Ω + change (mixedCoveredJetCoordinatesEquiv U o d) + ((mixedCoveredJetCoordinatesEquiv U o d).symm w) ∈ coveredJetSourceRegion U b d Ω + rwa [Equiv.apply_symm_apply] + +variable [∀ j, Fintype (O j)] [∀ j, Fintype (E j)] + +instance mixedCoveredJetRawReference_isFiniteMeasureOnCompacts (d : ℕ) [NeZero d] : + IsFiniteMeasureOnCompacts + (mixedCoveredJetRawReference (I := I) (O := O) (E := E) (n := n) d) := by + let hc : ∀ j, IsFiniteMeasureOnCompacts + (Measure.count : Measure (Fin (n j) → O j → ℤ)) := fun j => by + constructor + intro K hK + exact Measure.count_apply_lt_top.mpr hK.finite_of_discrete + let hm : ∀ j, IsFiniteMeasureOnCompacts + (mixedArrayReference (I j) (Fin (n j)) (O j)) := fun j => by + unfold mixedArrayReference + infer_instance + unfold mixedCoveredJetRawReference + infer_instance + + theorem mixedCoveredJetRawReference_integrable_of_continuous_of_support + (d : ℕ) [NeZero d] + (Ω : ∀ j, O j → Set (EuclideanSpace ℝ (J j))) + (hΩ : ∀ j t, IsCompact (Ω j t)) + (f : MixedCoveredJetSource I O E n d → ℂ) (hf : Continuous f) + (hs : Function.support f ⊆ mixedCoveredJetRegion U o b d Ω) : + Integrable f (mixedCoveredJetRawReference d) := by + let : ∀ j, BorelSpace (O j → ℝ) := fun j => Pi.borelSpace + let : ∀ j, BorelSpace (I j → O j → ℝ) := fun j => Pi.borelSpace + let : ∀ j, BorelSpace (O j → ℤ) := fun j => Pi.borelSpace + let : ∀ j, BorelSpace (Fin (n j) → O j → ℤ) := fun j => Pi.borelSpace + let : ∀ j, BorelSpace ((I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) := + fun j => Prod.borelSpace + let : ∀ j, BorelSpace (E j → ZMod d) := fun j => Pi.borelSpace + let : ∀ j, BorelSpace (O j → E j → ZMod d) := fun j => Pi.borelSpace + let : BorelSpace (∀ j, O j → E j → ZMod d) := Pi.borelSpace + let : BorelSpace (∀ j, (I j → O j → ℝ) × (Fin (n j) → O j → ℤ)) := Pi.borelSpace + let : BorelSpace (MixedCoveredJetSource I O E n d) := Prod.borelSpace + apply hf.integrable_of_hasCompactSupport + exact (mixedCoveredJetRegion_isCompact U o b d Ω hΩ).of_isClosed_subset + isClosed_closure (closure_minimal hs + (mixedCoveredJetRegion_isCompact U o b d Ω hΩ).isClosed) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedEvaluationCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedEvaluationCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..d6267ddf01ae3843c44dbd648045531efbda80e8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedEvaluationCoordinates.lean @@ -0,0 +1,44 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeBinaryAssignments + +namespace OAI + +section + +namespace Erdos3 + +def mixedEvaluationEmbedding (s : ℕ) : Fin s ↪ ReplicatedIndex (mixedCorrelationDegree s) where + toFun k := ⟨1, k⟩ + inj' := by + intro i j hij + exact Fin.ext (congrArg (fun z : ReplicatedIndex (mixedCorrelationDegree s) => z.2.val) hij) + +def mixedEvaluationCoordinates (s : ℕ) : Finset (ReplicatedIndex (mixedCorrelationDegree s)) := + Finset.univ.map (mixedEvaluationEmbedding s) + +@[simp] theorem mem_mixedEvaluationCoordinates (s : ℕ) (j : ReplicatedIndex (mixedCorrelationDegree s)) : + j ∈ mixedEvaluationCoordinates s ↔ j.1 = 1 := by + constructor + · intro hj + obtain ⟨k, _, rfl⟩ := Finset.mem_map.mp hj + rfl + · intro hj + rcases j with ⟨j, k⟩ + dsimp only at hj + subst j + exact Finset.mem_map.mpr ⟨k, Finset.mem_univ _, rfl⟩ + +@[simp] theorem mixedEvaluationCoordinates_card (s : ℕ) : + (mixedEvaluationCoordinates s).card = s := by + simp only [mixedEvaluationCoordinates, Finset.card_map, Finset.card_univ, Fintype.card_fin] + +theorem mixedEvaluationCoordinates_erase_card (s : ℕ) + (i : ReplicatedIndex (mixedCorrelationDegree s)) (hi : i.1 = 1) : + ((mixedEvaluationCoordinates s).erase i).card = s - 1 := by + rw [Finset.card_erase_of_mem ((mem_mixedEvaluationCoordinates s i).mpr hi), + mixedEvaluationCoordinates_card] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedPairCoordinateTest.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedPairCoordinateTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c9878852ac1f0b756d4e4821332b6816982a058 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedPairCoordinateTest.lean @@ -0,0 +1,108 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedPairFrozenEquivalence + +namespace OAI + +section + +namespace Erdos3.NativeSampleCorrelation + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +variable {n m : ℕ} {p q : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p} {i j : Fin (W.tensorPower m).outputDim} + (V : NativeSampleCorrelation (fun _ : Fin (n + 2) => 1) (n + 1) q + Finset.univ (fun z : Fin (n + 2) → ZMod N => fun k => ((z k).val : ℤ)) + (fun z => (W.tensorPower m).mixedAntisymmetric i j (fun k => ((z k).val : ℤ)))) + +noncomputable def mixedPairCoordinateTests (k : Fin 2) (out : Fin W.outputDim) : + ∀ l, (V.mixedPairModels l).Niltest (fun _ : Fin (n + 2) => 1) + | none => (V.test.raiseStep (by rw [mixedReplicated_totalDegree]; omega : + n + 1 ≤ ∑ _ : MixedReplicatedIndex (n + 1), 1)).oneOnOrbit + | some l => + ![![W.mixedPairComponent out id, (W.mixedPairComponent out (mixedExchangeCoordinate n)).oneOnOrbit], + ![(W.mixedPairComponent out id).oneOnOrbit, W.mixedPairComponent out (mixedExchangeCoordinate n)]] k l + +theorem mixedPairCoordinateTests_complexity (k : Fin 2) (out : Fin W.outputDim) (l : Option (Fin 2)) : + (V.mixedPairCoordinateTests k out l).ComplexityLE (mixedPairBudget (tensorPowerBudget m p) q) := by + have htwo : 2 ≤ mixedPairBudget (tensorPowerBudget m p) q := + (by norm_num : (2 : ℝ) ≤ 6).trans V.mixedPairBudget_six_le + cases l with + | none => exact Niltest.oneOnOrbit_complexity _ htwo (V.mixedPairTests_complexity none).1 + | some l => + fin_cases k <;> fin_cases l + · exact (W.mixedPairComponent_complexity out id).mono V.mixedOriginalPairComparison_component_cost + · exact Niltest.oneOnOrbit_complexity _ htwo (V.mixedPairTests_complexity (some 1)).1 + · exact Niltest.oneOnOrbit_complexity _ htwo (V.mixedPairTests_complexity (some 0)).1 + · exact (W.mixedPairComponent_complexity out (mixedExchangeCoordinate n)).mono V.mixedOriginalPairComparison_component_cost + +variable [TopologicalSpace (ℝ ⊗[ℚ] V.MixedPairAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] V.MixedPairAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] V.MixedPairAlgebra)] + [T2Space (ℝ ⊗[ℚ] V.MixedPairAlgebra)] + +noncomputable def mixedPairCoordinateNiltest (k : Fin 2) (out : Fin W.outputDim) : + (pi V.mixedPairModels).Niltest (fun _ : Fin (n + 2) => 1) := + piNiltest V.mixedPairModels (V.mixedPairCoordinateTests k out) + ((by norm_num : (0 : ℝ) ≤ 6).trans V.mixedPairBudget_six_le) + (by simpa using (show (3 : ℝ) ≤ mixedPairBudget (tensorPowerBudget m p) q from + (by norm_num : (3 : ℝ) ≤ 6).trans V.mixedPairBudget_six_le)) + (V.mixedPairCoordinateTests_complexity k out) + +theorem mixedPairCoordinateNiltest_complexity (k : Fin 2) (out : Fin W.outputDim) : + (V.mixedPairCoordinateNiltest k out).ComplexityLE + (productNiltestBudget (mixedPairBudget (tensorPowerBudget m p) q)) := + piNiltest_complexity V.mixedPairModels (V.mixedPairCoordinateTests k out) _ _ _ + +theorem mixedPairCoordinateNiltest_observable (k : Fin 2) (out : Fin W.outputDim) + (x : (pi V.mixedPairModels).Space) : + (V.mixedPairCoordinateNiltest k out).observable x = + W.vertical.observable out (productProjection V.mixedPairModels (some k) x) := by + change (∏ l, (V.mixedPairCoordinateTests k out l).observable + (productProjection V.mixedPairModels l x)) = _ + rw [Fintype.prod_option, Fin.prod_univ_two] + fin_cases k + · change 1 * (W.vertical.observable out + (productProjection V.mixedPairModels (some 0) x) * 1) = _ + simp only [one_mul, mul_one] + rfl + · change 1 * (1 * W.vertical.observable out + (productProjection V.mixedPairModels (some 1) x)) = _ + simp only [one_mul] + rfl + +theorem mixedPairCoordinateNiltest_orbit (k : Fin 2) (out : Fin W.outputDim) : + (V.mixedPairCoordinateNiltest k out).orbit = V.mixedPairNiltest.orbit := by + change NilpotentLieFiltration.piRealOrbit _ _ = NilpotentLieFiltration.piRealOrbit _ _ + apply congrArg (NilpotentLieFiltration.piRealOrbit + (fun l => (V.mixedPairModels l).filtration)) + funext l + cases l with + | none => rfl + | some l => fin_cases k <;> fin_cases l <;> rfl + +theorem mixedPairCoordinateNiltest_eval (k : Fin 2) (out : Fin W.outputDim) (x : Fin (n + 2) → ℤ) : + (V.mixedPairCoordinateNiltest k out).eval x = + W.eval out (mixedSlotInput (x (![0, 1] k)) (x (![1, 0] k)) + (fun j => x j.succ.succ)) := by + rw [mixedPairCoordinateNiltest, piNiltest_eval, Fintype.prod_option, Fin.prod_univ_two] + fin_cases k + · change 1 * ((W.mixedPairComponent out id).eval x * 1) = _ + rw [one_mul, mul_one, W.mixedPairComponent_eval] + rfl + · change 1 * (1 * (W.mixedPairComponent out (mixedExchangeCoordinate n)).eval x) = _ + rw [one_mul, one_mul, W.mixedPairComponent_eval] + rfl + +end Erdos3.NativeSampleCorrelation + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedProfileCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedProfileCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..60a519584f2bf9263ee09aa0ad821826906154bb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedProfileCoordinates.lean @@ -0,0 +1,101 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeRetainedTargetCubeIntervals + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def mixedProfileFromCoordinates {d : ℕ} {α : Type*} (x : Fin (d + 3) → α) : + (Fin (d + 1) → α) × α := + (Fin.cons (x 0) (fun j => x j.succ.succ.succ), x 2) + +def mixedProfileEquiv (d : ℕ) (α : Type*) : + (((Fin (d + 1) → α) × α) × α) ≃ (Fin (d + 3) → α) where + toFun t := Fin.cons (t.1.1 0) (Fin.cons t.2 (Fin.cons t.1.2 (Fin.tail t.1.1))) + invFun x := (mixedProfileFromCoordinates x, x 1) + left_inv := by + rintro ⟨⟨t, u⟩, n⟩ + apply Prod.ext + · apply Prod.ext + · funext i + exact Fin.cases rfl (fun _ => rfl) i + · rfl + · rfl + right_inv := by + intro x + funext i + refine Fin.cases rfl (fun j => ?_) i + refine Fin.cases rfl (fun k => ?_) j + exact Fin.cases rfl (fun _ => rfl) k + +theorem mixedProfileFromCoordinates_independent {d : ℕ} {α : Type*} + (x y : Fin (d + 3) → α) (h : ∀ k, k ≠ 1 → x k = y k) : + mixedProfileFromCoordinates x = mixedProfileFromCoordinates y := by + have h1 : (1 : Fin (d + 3)).val = 1 := Fin.val_one (d + 1) + have h2 : (2 : Fin (d + 3)).val = 2 := by + change 2 % (d + 3) = 2 + exact Nat.mod_eq_of_lt (by omega) + apply Prod.ext + · funext i + refine Fin.cases ?_ (fun j => ?_) i + · exact h 0 (by + intro e + have he := congrArg Fin.val e + norm_num only [Fin.val_zero, h1] at he) + · exact h j.succ.succ.succ (by + intro e + have he := congrArg Fin.val e + simp only [Fin.val_succ, h1] at he + omega) + · exact h 2 (by + intro e + have he := congrArg Fin.val e + norm_num only [h2, h1] at he) + +theorem mixedProfileFromCoordinates_point {d N : ℕ} [NeZero N] + (t : (Fin (d + 1) → ZMod N) × ZMod N) (n : ℤ) : + mixedProfileFromCoordinates (fun i => (mixedDifferencePoint t n i : ZMod N)) = t := by + apply Prod.ext + · funext i + refine Fin.cases ?_ (fun j => ?_) i <;> + simp [mixedProfileFromCoordinates, mixedDifferencePoint, mixedDifferenceShifts] + · change ((t.2.val : ℤ) : ZMod N) = t.2 + simp only [Int.cast_natCast, ZMod.natCast_zmod_val] + +theorem mixedProfileEquiv_point {d N : ℕ} + (t : (Fin (d + 1) → ZMod N) × ZMod N) (n : ZMod N) : + (fun i => ((mixedProfileEquiv d (ZMod N) (t, n) i).val : ℤ)) = + mixedDifferencePoint t (n.val : ℤ) := by + funext i + refine Fin.cases rfl (fun j => ?_) i + refine Fin.cases rfl (fun k => ?_) j + exact Fin.cases rfl (fun _ => rfl) k + +theorem mixedProfile_sum_cast {d N : ℕ} [NeZero N] + (t : (Fin (d + 1) → ZMod N) × ZMod N) (n : ZMod N) : + ((∑ i, mixedDifferencePoint t (n.val : ℤ) i : ℤ) : ZMod N) = + ∑ i, mixedProfileEquiv d (ZMod N) (t, n) i := by + rw [← mixedProfileEquiv_point] + simp only [Int.cast_sum, Int.cast_natCast, ZMod.natCast_zmod_val] + +theorem mixedProfile_average {d : ℕ} {α : Type*} [Fintype α] + (F : (Fin (d + 3) → α) → ℂ) : + (𝔼 x, F x) = 𝔼 t : (Fin (d + 1) → α) × α, 𝔼 n : α, + F (mixedProfileEquiv d α (t, n)) := by + calc + _ = 𝔼 t : ((Fin (d + 1) → α) × α) × α, F (mixedProfileEquiv d α t) := + (Fintype.expect_equiv (mixedProfileEquiv d α) _ F (fun _ => rfl)).symm + _ = _ := expect_prod_split _ + +theorem mixedProfile_card (d N : ℕ) [NeZero N] : + Fintype.card ((Fin (d + 1) → ZMod N) × ZMod N) = N ^ (d + 2) := by + simp only [Fintype.card_prod, Fintype.card_fun, Fintype.card_fin, ZMod.card, pow_succ] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedRealCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedRealCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9158de3fb87be28ccde31a3a6ef5f7ea087c71b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedRealCoordinates.lean @@ -0,0 +1,63 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedRealPoint + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule +open scoped NNReal + +variable {D I : Type*} [Fintype D] [Fintype I] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) +variable (o : OrthonormalBasis I ℝ W) + +noncomputable def mixedRealCoordinates : + EuclideanSpace ℝ D →ₗ[ℝ] ((I → ℝ) × (Fin n → ℝ)) := + ((orthonormalChart o).symm.toLinearMap.prodMap LinearMap.id).comp + (normalizedOrthogonalChart W b).toLinearMap + +theorem mixedRealCoordinates_point (x : (I → ℝ) × (Fin n → ℝ)) : + mixedRealCoordinates W b o (mixedRealPoint W b o x) = x := by + change ((orthonormalChart o).symm + ((normalizedOrthogonalChart W b) ((normalizedOrthogonalChart W b).symm + ((orthonormalChart o) x.1, x.2))).1, + ((normalizedOrthogonalChart W b) ((normalizedOrthogonalChart W b).symm + ((orthonormalChart o) x.1, x.2))).2) = x + simp only [ContinuousLinearEquiv.apply_symm_apply, ContinuousLinearEquiv.symm_apply_apply] + +theorem mixedRealPoint_coordinates (x : EuclideanSpace ℝ D) : + mixedRealPoint W b o (mixedRealCoordinates W b o x) = x := by + change (normalizedOrthogonalChart W b).symm + ((orthonormalChart o) ((orthonormalChart o).symm ((normalizedOrthogonalChart W b) x).1), + ((normalizedOrthogonalChart W b) x).2) = x + simp only [ContinuousLinearEquiv.apply_symm_apply, Prod.mk.eta, + ContinuousLinearEquiv.symm_apply_apply] + +theorem mixedRealCoordinates_integer (u : I → ℝ) (z : Fin n → ℤ) : + mixedRealCoordinates W b o (normalizedLatticePoint W b (orthonormalMixedChart o (u, z))) = + (u, fun i => (z i : ℝ) / basisAxisScale b i) := by + rw [← mixedRealPoint_integer W b o] + exact mixedRealCoordinates_point W b o _ + +theorem mixedRealCoordinates_norm_le (x : EuclideanSpace ℝ D) : + ‖mixedRealCoordinates W b o x‖ ≤ ‖normalizedOrthogonalChart W b x‖ := by + change ‖((orthonormalChart o).symm ((normalizedOrthogonalChart W b) x).1, + ((normalizedOrthogonalChart W b) x).2)‖ ≤ _ + rw [Prod.norm_def, Prod.norm_def] + exact max_le_max (orthonormalChart_symm_norm_le o _) le_rfl + +theorem mixedRealCoordinates_lipschitz {C : ℝ≥0} + (hC : ∀ x, ‖normalizedOrthogonalChart W b x‖ ≤ C * ‖x‖) : + LipschitzWith C (mixedRealCoordinates W b o) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [dist_eq_norm, ← map_sub, dist_eq_norm] + exact (mixedRealCoordinates_norm_le W b o _).trans (hC _) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedReplicatedCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedReplicatedCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..f72c7d1227c7701fdfebc6c3c7cf41a3a9713c75 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedReplicatedCoordinates.lean @@ -0,0 +1,81 @@ +import Mathlib.Data.List.OfFn +import OAI.Combinatorics.Progressions.Estimates.NativeBinaryAssignments + +namespace OAI + +section + +namespace Erdos3 + +abbrev MixedReplicatedIndex (s : ℕ) := ReplicatedIndex (mixedCorrelationDegree s) + +def mixedHead (s : ℕ) : MixedReplicatedIndex s := ⟨0, ⟨0, by change 0 < 1; omega⟩⟩ + +def mixedReplica {s : ℕ} (j : Fin s) : MixedReplicatedIndex s := ⟨1, ⟨j.val, j.isLt⟩⟩ + +theorem mixedReplica_injective (s : ℕ) : Function.Injective (mixedReplica (s := s)) := by + intro i j h + exact Fin.ext (congrArg (fun a : MixedReplicatedIndex s => a.2.val) h) + +theorem mixedReplicated_cases {s : ℕ} (j : MixedReplicatedIndex s) : + j = mixedHead s ∨ ∃ i : Fin s, j = mixedReplica i := by + rcases j with ⟨b, j⟩ + fin_cases b + · left + change Fin 1 at j + have hj : j = 0 := Subsingleton.elim _ _ + subst j + rfl + · exact Or.inr ⟨⟨j.val, j.isLt⟩, rfl⟩ + +def mixedRepeatedCoordinates (s : ℕ) : List (MixedReplicatedIndex s) := + List.ofFn (mixedReplica (s := s)) + +theorem mixedRepeatedCoordinates_length (s : ℕ) : (mixedRepeatedCoordinates s).length = s := by + simp only [mixedRepeatedCoordinates, List.length_ofFn] + +theorem mixedRepeatedCoordinates_nodup (s : ℕ) : (mixedRepeatedCoordinates s).Nodup := + List.nodup_ofFn.mpr (mixedReplica_injective s) + +theorem mixedRepeatedCoordinates_get (s : ℕ) (j : Fin (mixedRepeatedCoordinates s).length) : + (mixedRepeatedCoordinates s).get j = mixedReplica (Fin.cast (mixedRepeatedCoordinates_length s) j) := by + exact List.get_ofFn (mixedReplica (s := s)) j + +theorem mem_mixedRepeatedCoordinates (s : ℕ) (j : MixedReplicatedIndex s) : + j ∈ mixedRepeatedCoordinates s ↔ j.1 = 1 := by + change j ∈ List.ofFn (mixedReplica (s := s)) ↔ j.1 = 1 + constructor + · intro h + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp h + rfl + · intro h + rcases mixedReplicated_cases j with rfl | ⟨i, rfl⟩ + · norm_num [mixedHead] at h + · exact List.mem_ofFn.mpr ⟨i, rfl⟩ + +def mixedReplicatedInput {s : ℕ} {α : Type*} (h : α) (v : Fin s → α) + (j : MixedReplicatedIndex s) : α := + if hj : j.1 = 1 then v ⟨j.2.val, by + have hs : mixedCorrelationDegree s j.1 = s := by rw [hj]; rfl + simpa only [hs] using j.2.isLt⟩ + else h + +theorem mixedReplicatedInput_head {s : ℕ} {α : Type*} (h : α) (v : Fin s → α) : + mixedReplicatedInput h v (mixedHead s) = h := rfl + +theorem mixedReplicatedInput_replica {s : ℕ} {α : Type*} (h : α) (v : Fin s → α) (j : Fin s) : + mixedReplicatedInput h v (mixedReplica j) = v j := rfl + +theorem mixedReplicatedInput_diagonal {s : ℕ} {α : Type*} (h n : α) : + mixedReplicatedInput h (fun _ : Fin s => n) = + fun j : MixedReplicatedIndex s => correlationInput h n j.1 := by + funext j + rcases mixedReplicated_cases j with rfl | ⟨i, rfl⟩ + · rfl + · rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MixedShiftCoordinate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MixedShiftCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7b36f2931d3261ea9428a3261b47ac530d42e3c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MixedShiftCoordinate.lean @@ -0,0 +1,47 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeBinaryAssignments + +namespace OAI + +section + +namespace Erdos3 + +def mixedShiftCoordinate (s : ℕ) : ReplicatedIndex (mixedCorrelationDegree s) := + ⟨0, ⟨0, by change 0 < 1; omega⟩⟩ + +theorem mixedShiftCoordinate_unique (s : ℕ) (j : ReplicatedIndex (mixedCorrelationDegree s)) + (hj : j.1 = 0) : j = mixedShiftCoordinate s := by + rcases j with ⟨j, k⟩ + dsimp only at hj + subst j + dsimp only [mixedShiftCoordinate] + apply congrArg (fun t : Fin (mixedCorrelationDegree s 0) => + (⟨0, t⟩ : ReplicatedIndex (mixedCorrelationDegree s))) + apply Fin.ext + have hk := k.isLt + change k.val < 1 at hk + change k.val = 0 + omega + +theorem mixed_input_eq_coordinateConstant (s : ℕ) (h n : ℤ) : + (fun j : ReplicatedIndex (mixedCorrelationDegree s) => correlationInput h n j.1) = + coordinateConstantInput (mixedShiftCoordinate s) h n := by + funext j + by_cases hj : j = mixedShiftCoordinate s + · subst j + simp [coordinateConstantInput, mixedShiftCoordinate, correlationInput] + · have hj₀ : j.1 ≠ 0 := fun h => hj (mixedShiftCoordinate_unique s j h) + have hj₁ : j.1 = 1 := by + apply Fin.ext + have hlt := j.1.isLt + have hne : j.1.val ≠ 0 := fun h => hj₀ (Fin.ext h) + change j.1.val = 1 + omega + rw [hj₁, coordinateConstantInput, Function.update_of_ne hj] + rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ModerateSliceGeometricApproximation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ModerateSliceGeometricApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e699a182a805c3082486649dae68aa20f9689041 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ModerateSliceGeometricApproximation.lean @@ -0,0 +1,150 @@ +import OAI.Combinatorics.Progressions.Lattices.AffineModerateGeometricApproximation + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem cubeRootOffset_relative_bound {I : Type*} {O : ℝ} (hO : 0 ≤ O) + (c : ℤ) (L : ℕ) (hc : |(c : ℝ)| ≤ O * L) (i : Option I) : + |(cubeRootOffset c i : ℝ)| + ((1 : ℕ) : ℝ) * L ≤ (O + 1) * L := by + cases i with + | none => + simp only [cubeRootOffset, Nat.cast_one, one_mul] + nlinarith + | some i => + simp only [cubeRootOffset, Int.cast_zero, abs_zero, Nat.cast_one, one_mul, zero_add] + have he := mul_nonneg hO (Nat.cast_nonneg (α := ℝ) L) + nlinarith + +theorem weightedSlice_geometric_approximation {b n q K : ℕ} [NeZero b] [NeZero K] + (s : Fin b → Fin (n + 1) → NormalizedScalarCubeSource (Fin q)) (root : Fin b → Fin (n + 1) → ℤ) + (A W T : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (M : ℕ) + (hM : ∀ a j, (s a j).modulusBound ≤ M) (hW : ∀ a j, (s a j).weightBound ≤ W) + (hT : ∀ a j, (s a j).weightLipschitz ≤ T) {O F D E ε : ℝ} + (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hroot : ∀ a j, |(root a j : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ∏ j, ((s a j).length : ℝ)) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : + let U := affinePrimitiveEnvelope (Fin q) A W T M 1 + let Q := affineTorusRadius (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) 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)) ∧ + (∀ center : J → ℤ, (∑ k, ‖integerGridCoefficient (weightedSliceIntegerSource s root) + (weightedSliceIntegerSum s root J center) (R * K) 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 (weightedSliceIntegerSource s root) + (weightedSliceIntegerSum s root J center) z : ℝ) : ℂ) - + integerGridApproximation (weightedSliceIntegerSource s root) + (weightedSliceIntegerSum s root J center) K (R * K) S z‖ ≤ ε := by + let u (a : Fin b) (j : Fin (n + 1)) := cubeRootOffset (root a j) (I := Fin q) + let R := affineTorusFactor (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + have he := affineCube_geometric_approximation s u (fun _ _ _ => 1) A W T hA M 1 hM hW hT + (fun _ _ _ => by omega) (fun _ _ _ => le_rfl) (by linarith : 0 ≤ O + 1) hD hE hε hε1 + (fun a j i => cubeRootOffset_relative_bound hO (root a j) (s a j).length (hroot a j) i) + hupper hlower p hpower J hJ (by simpa only [Fintype.card_fin] using hB) + dsimp only at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS, ?_, hchar, ?_⟩ + · intro center + apply le_trans ?_ hcap + apply Finset.sum_le_sum + intro k _ + have heq := weightedSliceIntegerSum_coefficient s root J center (R * K) k + rw [affineWeightedCubeIntegerSum_coefficient] at heq + have hn := congrArg norm heq + simpa only [norm_mul, rectangularGridCharacter_norm, one_mul] using hn.symm.le + · intro center z hz + simpa only [u, weightedSliceIntegerSum_mass, weightedSliceIntegerSum_approximation] using happ center z hz + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem moderateSlice_geometric_approximation {b n q K : ℕ} [NeZero b] [NeZero K] + (c : Fin b → NormalizedScalarCubeSource Empty) + (s : Fin b → Fin n → NormalizedScalarCubeSource (Fin q)) + (offset : Fin b → ℤ) (stride : Fin b → ℕ) (root : Fin b → Fin n → ℤ) + (A W T : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (M V : ℕ) (hV : 1 ≤ V) + (hcM : ∀ a, (c a).modulusBound ≤ M) (hcW : ∀ a, (c a).weightBound ≤ W) + (hcT : ∀ a, (c a).weightLipschitz ≤ T) + (hM : ∀ a j, (s a j).modulusBound ≤ M) (hW : ∀ a j, (s a j).weightBound ≤ W) + (hT : ∀ a j, (s a j).weightLipschitz ≤ T) (ht : ∀ a, 0 < stride a) (htV : ∀ a, stride a ≤ V) + {O F D E ε : ℝ} (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hroot : ∀ a j, |(root a j : ℝ)| ≤ O * (s a j).length) + (hupper : ∀ a, (|(offset a : ℝ)| + (stride a : ℝ) * (c a).length) * + (∏ j, ((s a j).length : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ((c a).length * ∏ j, ((s a j).length : ℝ))) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((s a j).length : ℝ) ^ p) + (hcpower : ∀ a, (K : ℝ) ≤ E * ((c a).length : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n) + (hB : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : + let U := affinePrimitiveEnvelope (Fin q) A W T M V + let Q := affineTorusRadius (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) 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)) ∧ + (∀ center : J → ℤ, (∑ k, ‖integerGridCoefficient (moderateSliceIntegerSource c s root) + (moderateSliceIntegerSum c s offset stride root J center) (R * K) 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 (moderateSliceIntegerSource c s root) + (moderateSliceIntegerSum c s offset stride root J center) z : ℝ) : ℂ) - + integerGridApproximation (moderateSliceIntegerSource c s root) + (moderateSliceIntegerSum c s offset stride root J center) K (R * K) S z‖ ≤ ε := by + let u (a : Fin b) (j : Fin n) := cubeRootOffset (root a j) (I := Fin q) + let R := affineTorusFactor (Fintype.card (Fin q)) n (Fintype.card (Fin b)) (O + 1) F + have he := affineModerate_geometric_approximation c s offset stride u (fun _ _ _ => 1) A W T hA M V + hcM hcW hcT hM hW hT (fun _ _ _ => by omega) (fun _ _ _ => hV) ht htV + (by linarith : 0 ≤ O + 1) hD hE hε hε1 + (fun a j i => cubeRootOffset_relative_bound hO (root a j) (s a j).length (hroot a j) i) + hupper hlower p hpower hcpower J hJ (by simpa only [Fintype.card_fin] using hB) + dsimp only at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS, ?_, hchar, ?_⟩ + · intro center + apply le_trans ?_ hcap + apply Finset.sum_le_sum + intro k _ + have heq := moderateSliceIntegerSum_coefficient c s offset stride root J center (R * K) k + rw [affineWeightedModerateIntegerSum_coefficient] at heq + have hn := congrArg norm heq + simpa only [norm_mul, rectangularGridCharacter_norm, one_mul] using hn.symm.le + · intro center z hz + simpa only [u, moderateSliceIntegerSum_mass, moderateSliceIntegerSum_approximation] using happ center z hz + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeCoordinateFreezing.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeCoordinateFreezing.lean new file mode 100644 index 0000000000000000000000000000000000000000..2602d396b62230dd34dfe15f315ec71b9c9c3eaf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeCoordinateFreezing.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Estimates.WeightedOrbitNormalization + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {σ : Type*} [DecidableEq σ] + +def retainedCoordinateWeight (S : Finset σ) (i : σ) : ℕ := if i ∈ S then 1 else 0 + +def freezeCoordinates (S : Finset σ) (b : σ → ℤ) (x : S → ℤ) (i : σ) : ℤ := + if h : i ∈ S then x ⟨i, h⟩ else b i + +noncomputable def freezingPolynomial (S : Finset σ) (b : σ → ℤ) (i : σ) : + MvPolynomial S ℚ := + if h : i ∈ S then MvPolynomial.X ⟨i, h⟩ else MvPolynomial.C (b i : ℚ) + +theorem freezingPolynomial_support (S : Finset σ) (b : σ → ℤ) (i : σ) : + freezingPolynomial S b i ∈ weightedSupportLE (fun _ : S => 1) (retainedCoordinateWeight S i) := by + by_cases hi : i ∈ S + · simp only [freezingPolynomial, retainedCoordinateWeight, dite_eq_left hi, ite_eq_left hi] + simpa only [MvPolynomial.X, Finsupp.weight_single, smul_eq_mul, mul_one] using + weightedSupportLE_monomial (fun _ : S => 1) (Finsupp.single (⟨i, hi⟩ : S) 1) (1 : ℚ) + · simp only [freezingPolynomial, retainedCoordinateWeight, dite_eq_right hi, ite_eq_right hi] + exact weightedSupportLE_C _ _ _ + +theorem freezingPolynomial_eval (S : Finset σ) (b : σ → ℤ) (x : S → ℤ) (i : σ) : + MvPolynomial.aeval (R := ℚ) (fun j => (x j : ℚ)) (freezingPolynomial S b i) = + (freezeCoordinates S b x i : ℚ) := by + by_cases hi : i ∈ S <;> simp [freezingPolynomial, freezeCoordinates, hi] + +theorem retainedCoordinate_degree [Fintype σ] (S : Finset σ) (bound : σ → ℕ) : + multidegreeWeight (retainedCoordinateWeight S) bound = ∑ i ∈ S, bound i := by + simp [multidegreeWeight, retainedCoordinateWeight] + +namespace MultidegreeLieFiltration + +open VectorPolynomial + +variable {L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + +theorem exists_normalized_frozen_orbit (S : Finset σ) (b : σ → ℤ) + (p : F.PolynomialOrbit) (a γ : F.Group) + (hzero : F.polynomialOrbitEval (freezeCoordinates S b 0) p = a * γ) : + ∃ q : (F.weightedFiltration (retainedCoordinateWeight S)).PolynomialOrbit (fun _ : S => 1), + (F.weightedFiltration (retainedCoordinateWeight S)).polynomialOrbitEval _ 0 q = 1 ∧ + ∀ x : S → ℤ, F.weightedGroupInclusion (retainedCoordinateWeight S) + ((F.weightedFiltration (retainedCoordinateWeight S)).polynomialOrbitEval _ x q) = + a⁻¹ * F.polynomialOrbitEval (freezeCoordinates S b x) p * γ⁻¹ := by + let r := VectorPolynomial.substitute (freezingPolynomial S b) (p.log F) + have hr : F.WeightedAdapted (retainedCoordinateWeight S) (fun _ : S => 1) r := + F.weightedAdapted_substitute _ _ _ (freezingPolynomial_support S b) (p.adapted F) + have heval (x : S → ℤ) : (⟨eval (fun i => (x i : ℚ)) r⟩ : F.Group) = + F.polynomialOrbitEval (freezeCoordinates S b x) p := by + apply NilpotentLieBCHGroup.ext + change eval (fun i => (x i : ℚ)) r = _ + simp only [r, eval_substitute, freezingPolynomial_eval, F.polynomialOrbitEval_coord] + have hz : (⟨eval (fun _ => 0) r⟩ : F.Group) = a * γ := by + simpa only [Pi.zero_apply, Int.cast_zero] using (heval 0).trans hzero + refine ⟨F.normalizedWeightedOrbit _ _ (fun _ => by decide) r hr a γ hz, + F.normalizedWeightedOrbit_zero _ _ (fun _ => by decide) r hr a γ hz, ?_⟩ + intro x + rw [F.normalizedWeightedOrbit_eval, heval] + +theorem exists_frozen_orbit (S : Finset σ) (b : σ → ℤ) (p : F.PolynomialOrbit) : + ∃ q : (F.weightedFiltration (retainedCoordinateWeight S)).PolynomialOrbit (fun _ : S => 1), + (F.weightedFiltration (retainedCoordinateWeight S)).polynomialOrbitEval _ 0 q = 1 ∧ + ∀ x : S → ℤ, F.weightedGroupInclusion (retainedCoordinateWeight S) + ((F.weightedFiltration (retainedCoordinateWeight S)).polynomialOrbitEval _ x q) = + (F.polynomialOrbitEval (freezeCoordinates S b 0) p)⁻¹ * + F.polynomialOrbitEval (freezeCoordinates S b x) p := by + obtain ⟨q, hq, hval⟩ := F.exists_normalized_frozen_orbit S b p + (F.polynomialOrbitEval (freezeCoordinates S b 0) p) 1 (by rw [mul_one]) + exact ⟨q, hq, fun x => by simpa only [inv_one, mul_one] using hval x⟩ + +end MultidegreeLieFiltration + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeCoordinateSplit.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeCoordinateSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..1362c9feaae0a1b300bd3a41d6edd09596b1cb9b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeCoordinateSplit.lean @@ -0,0 +1,81 @@ +import OAI.Combinatorics.Progressions.Polynomial.WeightedPolynomialRestriction + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open VectorPolynomial + +variable {σ L : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + +omit [DecidableEq σ] in +theorem adapted_coefficient_zero_of_coordinate (i : σ) (hi : bound i ≤ 1) + {p : VectorPolynomial σ ℚ L} (hp : F.Adapted p) (a : σ →₀ ℕ) (ha : 1 < a i) : + coefficients p a = 0 := by + have hn : ¬(fun j => a j) ≤ bound := by + intro h + exact (not_le_of_gt (hi.trans_lt ha)) (h i) + have h := hp a + simpa only [F.terminal _ hn, Submodule.mem_bot] using h + +theorem adapted_coefficient_mem_coordinate (i : σ) {p : VectorPolynomial σ ℚ L} + (hp : F.Adapted p) (a : σ →₀ ℕ) (ha : 0 < a i) : + coefficients p a ∈ F.layer (Pi.single i 1) := by + apply F.antitone (show Pi.single i 1 ≤ fun j => a j from ?_) (hp a) + intro j + by_cases hj : j = i + · subst j + simpa only [Pi.single_eq_same] using (Nat.succ_le_of_lt ha) + · simp [hj] + +theorem split_substitution_add (i : σ) (hi : bound i ≤ 1) + (u v : MvPolynomial (Option σ) ℚ) {p : VectorPolynomial σ ℚ L} (hp : F.Adapted p) : + VectorPolynomial.substitute (splitCoordinatePolynomial i (u + v)) p = + VectorPolynomial.substitute (splitCoordinatePolynomial i u) p + + VectorPolynomial.substitute (splitCoordinatePolynomial i v) p - + VectorPolynomial.substitute (splitCoordinatePolynomial i 0) p := + substitute_update_add _ i u v p (F.adapted_coefficient_zero_of_coordinate i hi hp) + +theorem split_substitution_sub_mem_coordinate (i : σ) + (u v : MvPolynomial (Option σ) ℚ) {p : VectorPolynomial σ ℚ L} (hp : F.Adapted p) + (a : Option σ →₀ ℕ) : + coefficients (VectorPolynomial.substitute (splitCoordinatePolynomial i u) p - + VectorPolynomial.substitute (splitCoordinatePolynomial i v) p) a ∈ F.layer (Pi.single i 1) := + coefficients_substitute_update_sub_mem (F.layer (Pi.single i 1)) _ i u v p + (F.adapted_coefficient_mem_coordinate i hp) a + +theorem split_substitution_adapted (i : σ) (u : MvPolynomial (Option σ) ℚ) + (hu : u ∈ weightedSupportLE (fun _ : Option σ => 1) 1) + {p : VectorPolynomial σ ℚ L} (hp : F.Adapted p) : + F.ordinary.Adapted (fun _ : Option σ => 1) + (VectorPolynomial.substitute (splitCoordinatePolynomial i u) p) := + F.ordinary.adapted_substitute (fun _ => 1) (fun _ => 1) _ + (splitCoordinatePolynomial_support i u hu) (F.adapted_ordinary hp) + +theorem split_substitution_zero_weighted (i : σ) + {p : VectorPolynomial σ ℚ L} (hp : F.Adapted p) : + F.WeightedAdapted (omittedCoordinateWeight i) (fun _ : Option σ => 1) + (VectorPolynomial.substitute (splitCoordinatePolynomial i 0) p) := + F.weightedAdapted_substitute _ _ _ (splitCoordinatePolynomial_zero_support i) hp + +theorem split_substitution_sub_mem_active (i : σ) + (u : MvPolynomial (Option σ) ℚ) (hu : u ∈ weightedSupportLE (fun _ : Option σ => 1) 1) + {p : VectorPolynomial σ ℚ L} (hp : F.Adapted p) (a : Option σ →₀ ℕ) : + coefficients (VectorPolynomial.substitute (splitCoordinatePolynomial i u) p - + VectorPolynomial.substitute (splitCoordinatePolynomial i 0) p) a ∈ + F.coordinateActiveLayer i (Finsupp.weight (fun _ : Option σ => 1) a) := by + refine ⟨F.split_substitution_sub_mem_coordinate i u 0 hp a, ?_⟩ + rw [map_sub, Finsupp.sub_apply] + exact (F.ordinary.layer _).sub_mem + ((F.ordinary.adapted_iff_coefficients _ _).mp (F.split_substitution_adapted i u hu hp) a) + ((F.ordinary.adapted_iff_coefficients _ _).mp + (F.split_substitution_adapted i 0 (Submodule.zero_mem _) hp) a) + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeOrbitTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeOrbitTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..248a3be985227db3ed48f0aa5c0cd414c0dbddc6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MultidegreeOrbitTransport.lean @@ -0,0 +1,26 @@ +import OAI.Combinatorics.Progressions.Polynomial.WeightedPolynomialRestriction + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) + {G : MultidegreeLieFiltration σ L s bound} + +noncomputable def orbitEquivOfEq (h : F = G) : F.PolynomialOrbit ≃* G.PolynomialOrbit := by + subst G + exact MulEquiv.refl _ + +theorem orbitEquivOfEq_eval (h : F = G) (p : F.PolynomialOrbit) (x : σ → ℤ) : + G.polynomialOrbitEval x (F.orbitEquivOfEq h p) = F.polynomialOrbitEval x p := by + subst G + rfl + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MultilinearBoxInverse.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MultilinearBoxInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..3070bd86e0e1996c896a68b90536e6bcb4578ce0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MultilinearBoxInverse.lean @@ -0,0 +1,135 @@ +import OAI.Combinatorics.Progressions.Estimates.StrideProductBounds +import OAI.Combinatorics.Progressions.Linear.MatrixCoordinateSlice + +namespace OAI + +section + +namespace Erdos3 + +open scoped Classical + +def stridedMatrixPoint {H I : Type*} {N : I → ℕ} + (b : H → I → ℝ) (s : I → ℕ) (x : H → ∀ k, Fin (N k)) : H → I → ℝ := + fun i k => b i k + (s k : ℝ) * ((x i k).val : ℝ) + +noncomputable def stridedMatrixSliceBase {H I : Type*} [DecidableEq I] {N : I → ℕ} + (b : H → I → ℝ) (s : I → ℕ) (x : H → ∀ k, Fin (N k)) (j : H → I) : H → I → ℝ := + fun i => Function.update (stridedMatrixPoint b s x i) (j i) (b i (j i)) + +theorem stridedMatrixPoint_update {H I : Type*} [DecidableEq I] {N : I → ℕ} + (b : H → I → ℝ) (s : I → ℕ) (y : H → ∀ k, Fin (N k)) (j : H → I) + (x : ∀ i, Fin (N (j i))) : + stridedMatrixPoint b s (fun i => Function.update (y i) (j i) (x i)) = + fun i => stridedMatrixSliceBase b s y j i + + ((s (j i) : ℝ) * ((x i).val : ℝ)) • Pi.single (j i) (1 : ℝ) := by + funext i k + by_cases hk : k = j i + · subst k + simp [stridedMatrixPoint, stridedMatrixSliceBase] + · simp [stridedMatrixPoint, stridedMatrixSliceBase, hk] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped BigOperators Classical + +theorem multilinear_box_biased_slice {I : Type*} [Fintype I] [DecidableEq I] {h : ℕ} + (F : MultilinearMap ℝ (fun _ : Fin h => I → ℝ) ℝ) + (N s : I → ℕ) (hN : ∀ k, 0 < N k) (b : Fin h → I → ℝ) + (j : Fin h → I) {ζ : ℝ} + (hbias : ζ ≤ ‖𝔼 x : Fin h → ∀ k, Fin (N k), + character ((F (stridedMatrixPoint b s x) : ℝ) : CircleFourier.Circle)‖) : + ∃ c : Fin h → I → ℝ, ζ ≤ ‖𝔼 x : ∀ i, Fin (N (j i)), + character ((F (fun i => c i + ((s (j i) : ℝ) * ((x i).val : ℝ)) • + Pi.single (j i) (1 : ℝ)) : ℝ) : CircleFourier.Circle)‖ := by + let : ∀ k, Nonempty (Fin (N k)) := fun k => ⟨⟨0, hN k⟩⟩ + obtain ⟨y, hy⟩ := exists_biased_matrix_coordinate_slice (H := Fin h) (I := I) + (fun k => Fin (N k)) j + (fun x : Fin h → ∀ k, Fin (N k) => + character ((F (stridedMatrixPoint b s x) : ℝ) : CircleFourier.Circle)) + (δ := ζ) hbias + refine ⟨stridedMatrixSliceBase b s y j, ?_⟩ + have he : (𝔼 x : ∀ i, Fin (N (j i)), + character ((F (stridedMatrixPoint b s (fun i => Function.update (y i) (j i) (x i))) : ℝ) : + CircleFourier.Circle)) = + 𝔼 x : ∀ i, Fin (N (j i)), + character ((F (fun i => stridedMatrixSliceBase b s y j i + + ((s (j i) : ℝ) * ((x i).val : ℝ)) • Pi.single (j i) (1 : ℝ)) : ℝ) : + CircleFourier.Circle) := by + apply Finset.expect_congr rfl + intro x _ + exact congrArg (fun v : Fin h → I → ℝ => character ((F v : ℝ) : CircleFourier.Circle)) + (stridedMatrixPoint_update b s y j x) + exact hy.trans_eq (congrArg norm he) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open CircleFourier +open scoped BigOperators Classical + +theorem multilinear_box_coordinate_approximation {I : Type*} [Fintype I] [DecidableEq I] {n : ℕ} + (F : MultilinearMap ℝ (fun _ : Fin (n + 1) => I → ℝ) ℝ) + (N s : I → ℕ) (hs : ∀ k, 0 < s k) (b : Fin (n + 1) → I → ℝ) + {ζ : ℝ} (hζ : 0 < ζ) (hN : ∀ k, multiaffineBiasBudget n ζ ≤ N k) + (hbias : ζ ≤ ‖𝔼 x : Fin (n + 1) → ∀ k, Fin (N k), + character ((F (stridedMatrixPoint b s x) : ℝ) : CircleFourier.Circle)‖) + (j : Fin (n + 1) → I) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * ∏ i, (s (j i) : ℝ) ∧ + ∃ m : ℤ, |F (fun i => Pi.single (j i) (1 : ℝ)) - (m : ℝ) / D| ≤ + multiaffineBiasBudget n ζ / ∏ i, ((s (j i) : ℝ) * (N (j i) : ℝ)) := by + have hNp (k : I) : 0 < N k := by + exact_mod_cast (multiaffineBiasBudget_pos n hζ).trans_le (hN k) + obtain ⟨c, hc⟩ := multilinear_box_biased_slice F N s hNp b j hbias + apply multilinear_slice_bias_approximation F c + (fun i => Pi.single (j i) (1 : ℝ)) (fun i => N (j i)) (fun i => s (j i)) + (fun i => hs (j i)) (fun _ => 0) hζ (fun i => hN (j i)) + simpa only [zero_add] using hc + +theorem paired_multilinear_box_coordinate_approximation {I : Type*} [Fintype I] [DecidableEq I] {n : ℕ} + (F : MultilinearMap ℝ (fun _ : Fin (n + 1) => I → ℝ) ℝ) + (N s : I → ℕ) (hs : ∀ k, 0 < s k) {ζ : ℝ} (hζ : 0 < ζ) + (hN : ∀ k, multiaffineBiasBudget n ζ ≤ N k) + (hbias : ζ ≤ ‖𝔼 x : Fin (n + 1) → ∀ k, Fin (N k), + 𝔼 y : Fin (n + 1) → ∀ k, Fin (N k), + character ((F (fun i k => (s k : ℝ) * ((x i k).val : ℝ) - + (s k : ℝ) * ((y i k).val : ℝ)) : ℝ) : CircleFourier.Circle)‖) + (j : Fin (n + 1) → I) : + ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ multiaffineBiasBudget n ζ * ∏ i, (s (j i) : ℝ) ∧ + ∃ m : ℤ, |F (fun i => Pi.single (j i) (1 : ℝ)) - (m : ℝ) / D| ≤ + multiaffineBiasBudget n ζ / ∏ i, ((s (j i) : ℝ) * (N (j i) : ℝ)) := by + have hNp (k : I) : 0 < N k := by + exact_mod_cast (multiaffineBiasBudget_pos n hζ).trans_le (hN k) + let : ∀ k, Nonempty (Fin (N k)) := fun k => ⟨⟨0, hNp k⟩⟩ + rw [Finset.expect_comm] at hbias + obtain ⟨y, hy⟩ := exists_biased_finite_slice + (fun y x : Fin (n + 1) → ∀ k, Fin (N k) => + character ((F (fun i k => (s k : ℝ) * ((x i k).val : ℝ) - + (s k : ℝ) * ((y i k).val : ℝ)) : ℝ) : CircleFourier.Circle)) hbias + let b : Fin (n + 1) → I → ℝ := fun i k => -((s k : ℝ) * ((y i k).val : ℝ)) + have he (x : Fin (n + 1) → ∀ k, Fin (N k)) : + stridedMatrixPoint b s x = fun i k => (s k : ℝ) * ((x i k).val : ℝ) - + (s k : ℝ) * ((y i k).val : ℝ) := by + funext i k + dsimp [stridedMatrixPoint, b] + ring + apply multilinear_box_coordinate_approximation F N s hs b hζ hN _ j + simpa only [he] using hy + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/MultilinearCoordinateExpansion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/MultilinearCoordinateExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..5718b5fd22c2e1957c4f3a8096935fd02cff5847 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/MultilinearCoordinateExpansion.lean @@ -0,0 +1,38 @@ +import Mathlib.LinearAlgebra.Multilinear.Basic +import Mathlib.LinearAlgebra.Pi + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem multilinear_coordinate_expansion {H I R : Type*} [Fintype H] [Fintype I] + [DecidableEq H] [DecidableEq I] [CommRing R] + (F : MultilinearMap R (fun _ : H => I → R) R) (u : H → I → R) : + F u = ∑ j : H → I, F (fun i => Pi.single (j i) (1 : R)) * ∏ i, u i (j i) := by + have hu : u = fun h => ∑ i, u h i • Pi.single i (1 : R) := by + funext h i + simp [Pi.single_apply] + calc + F u = F (fun h => ∑ i, u h i • Pi.single i (1 : R)) := congrArg F hu + _ = ∑ j : H → I, F (fun h => u h (j h) • Pi.single (j h) (1 : R)) := + F.map_sum (fun h i => u h i • Pi.single i (1 : R)) + _ = _ := by + apply Finset.sum_congr rfl + intro j _ + rw [F.map_smul_univ, smul_eq_mul, mul_comm] + +theorem multilinear_diagonal_expansion {H I R : Type*} [Fintype H] [Fintype I] + [DecidableEq H] [DecidableEq I] [CommRing R] + (F : MultilinearMap R (fun _ : H => I → R) R) (w : I → R) : + F (fun _ => w) = ∑ j : H → I, F (fun i => Pi.single (j i) (1 : R)) * ∏ i, w (j i) := + multilinear_coordinate_expansion F (fun _ => w) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NarrowSpatialSiteVariation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NarrowSpatialSiteVariation.lean new file mode 100644 index 0000000000000000000000000000000000000000..5505d45c31cec320ce7e2a3c94394f644d7bd494 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NarrowSpatialSiteVariation.lean @@ -0,0 +1,95 @@ +import OAI.Combinatorics.Progressions.Linear.SpatialFrameSlopeBudget + +namespace OAI + +section + +namespace Erdos3 +open BooleanCubeKernel +open scoped BigOperators + +theorem jointIntegerPhysicalSite_normalized_dist_of_slope_sum + {K X : Type*} [Fintype K] [Fintype X] + (N : X → ℕ) (T : K → ℝ) (a : X → ℤ) (frame : Option K × X → ℤ) + (u v : K → ℤ) {C δ : ℝ} (hC : 0 ≤ C) (hδ : 0 ≤ δ) + (hslope : ∀ x, (∑ k, |(frame (some k, x) : ℝ) / N x| * T k) ≤ C) + (hcell : ∀ k, |(u k : ℝ) - (v k : ℝ)| ≤ T k * δ) : + dist (fun x => (jointIntegerPhysicalSite u (a, frame) x : ℝ) / N x) + (fun x => (jointIntegerPhysicalSite v (a, frame) x : ℝ) / N x) ≤ C * δ := by + apply (dist_pi_le_iff (mul_nonneg hC hδ)).mpr + intro x + rw [Real.dist_eq] + have hraw : (jointIntegerPhysicalSite u (a, frame) x : ℝ) - + (jointIntegerPhysicalSite v (a, frame) x : ℝ) = + ∑ k, ((u k : ℝ) - (v k : ℝ)) * (frame (some k, x) : ℝ) := by + calc + _ = (∑ k, (u k : ℝ) * (frame (some k, x) : ℝ)) - + ∑ k, (v k : ℝ) * (frame (some k, x) : ℝ) := by + simp only [jointIntegerPhysicalSite, Pi.add_apply, integerPhysicalSite, + Int.cast_add, Int.cast_sum, Int.cast_mul] + ring + _ = _ := by + rw [← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro k _ + ring + have heq : (jointIntegerPhysicalSite u (a, frame) x : ℝ) / N x - + (jointIntegerPhysicalSite v (a, frame) x : ℝ) / N x = + ∑ k, ((u k : ℝ) - (v k : ℝ)) * ((frame (some k, x) : ℝ) / N x) := by + rw [← sub_div, hraw, Finset.sum_div] + apply Finset.sum_congr rfl + intro k _ + ring + rw [heq] + calc + _ ≤ ∑ k, |((u k : ℝ) - (v k : ℝ)) * ((frame (some k, x) : ℝ) / N x)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ k, (T k * δ) * |(frame (some k, x) : ℝ) / N x| := by + apply Finset.sum_le_sum + intro k _ + rw [abs_mul] + exact mul_le_mul_of_nonneg_right (hcell k) (abs_nonneg _) + _ = (∑ k, |(frame (some k, x) : ℝ) / N x| * T k) * δ := by + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro k _ + ring + _ ≤ _ := mul_le_mul_of_nonneg_right (hslope x) hδ + +theorem narrowSpatial_jointPhysicalSite_normalized_dist + {G J X : Type*} [Fintype G] [Fintype J] [Fintype X] + {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hξ : ξ ≤ 1) + (N : X → ℕ) (hN : ∀ x, 0 < N x) + (T : G ⊕ J → ℝ) (hT : ∀ k, 0 ≤ T k) (hsum : ∑ k, T k ≤ W) + (a : X → ℤ) (frame : Option (G ⊕ J) × X → ℤ) + (hframe : frame ∈ rectangularWeightIndices 0 (narrowTrimmedSpatialWidths W τ ξ N) 1) + (u v : G ⊕ J → ℤ) {δ : ℝ} (hδ : 0 ≤ δ) + (hcell : ∀ k, |(u k : ℝ) - (v k : ℝ)| ≤ T k * δ) : + dist (fun x => (jointIntegerPhysicalSite u (a, frame) x : ℝ) / N x) + (fun x => (jointIntegerPhysicalSite v (a, frame) x : ℝ) / N x) ≤ τ * δ / 8 := by + have h := jointIntegerPhysicalSite_normalized_dist_of_slope_sum N T a frame u v + (by positivity : 0 ≤ τ / 8) hδ + (narrowSpatial_frame_normalized_slope_sum hW hτ hξ N hN T hT hsum frame hframe) hcell + simpa only [div_mul_eq_mul_div] using h + +theorem narrowSpatial_jointPhysicalSite_normalized_dist_le_cell + {G J X : Type*} [Fintype G] [Fintype J] [Fintype X] + {W τ ξ : ℝ} (hW : 0 ≤ W) (hτ : 0 < τ) (hτ1 : τ ≤ 1) (hξ : ξ ≤ 1) + (N : X → ℕ) (hN : ∀ x, 0 < N x) + (T : G ⊕ J → ℝ) (hT : ∀ k, 0 ≤ T k) (hsum : ∑ k, T k ≤ W) + (a : X → ℤ) (frame : Option (G ⊕ J) × X → ℤ) + (hframe : frame ∈ rectangularWeightIndices 0 (narrowTrimmedSpatialWidths W τ ξ N) 1) + (u v : G ⊕ J → ℤ) {δ : ℝ} (hδ : 0 ≤ δ) + (hcell : ∀ k, |(u k : ℝ) - (v k : ℝ)| ≤ T k * δ) : + dist (fun x => (jointIntegerPhysicalSite u (a, frame) x : ℝ) / N x) + (fun x => (jointIntegerPhysicalSite v (a, frame) x : ℝ) / N x) ≤ δ := by + apply (narrowSpatial_jointPhysicalSite_normalized_dist hW hτ hξ N hN T hT hsum + a frame hframe u v hδ hcell).trans + have h := mul_le_mul_of_nonneg_right hτ1 hδ + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeChartPairSymbolCompatibility.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeChartPairSymbolCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..489da787947afc944a51f52c37f7e8f4d8641905 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeChartPairSymbolCompatibility.lean @@ -0,0 +1,91 @@ +import OAI.Combinatorics.Progressions.Nilpotent.NativeIntegerChartNiltest + +namespace OAI + +universe universeLevel + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module VectorPolynomial NilpotentLieFiltration +open scoped TensorProduct + +variable {L M : Type universeLevel} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s d e : ℕ} (D : RationalFilteredNilmanifold L s d) + (E : RationalFilteredNilmanifold M s e) + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] + {σ₀ σ τ ι κ : Type*} {w₀ : σ₀ → ℕ} {w : σ → ℕ} + +theorem pairOrbitSymbol_withOrbit_integerChartPullback_eq + (v : τ → ℕ) (β : σ → MvPolynomial τ ℤ) + (hβ : ∀ i, integerSampledRealChart β i ∈ weightedSupportLE v (w i)) + (reference : D.Niltest w₀) (p : D.filtration.realification.PolynomialOrbit v) + (selected ambient : E.Niltest w) (horbit : selected.orbit = ambient.orbit) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) : + pairOrbitSymbol D E (reference.withOrbit p).orbit + (selected.integerChartPullback v β hβ).orbit b ω hF = + pairOrbitSymbol D E p (ambient.integerChartPullback v β hβ).orbit b ω hF := by + change pairOrbitSymbol D E p (selected.integerChartPullback v β hβ).orbit b ω hF = _ + rw [selected.integerChartPullback_orbit_eq_of_orbit_eq v β hβ ambient horbit] + +theorem pairOrbitSymbol_withOrbit_integerChartPullback + (v : τ → ℕ) (β : σ → MvPolynomial τ ℤ) + (hβ : ∀ i, integerSampledRealChart β i ∈ weightedSupportLE v (w i)) + (reference : D.Niltest w₀) (p : D.filtration.realification.PolynomialOrbit v) + (selected ambient : E.Niltest w) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) : + pairOrbitSymbol D E (reference.withOrbit p).orbit + ((selected.withOrbit ambient.orbit).integerChartPullback v β hβ).orbit b ω hF = + pairOrbitSymbol D E p (ambient.integerChartPullback v β hβ).orbit b ω hF := rfl + +theorem pairOrbitSymbol_withOrbit_frozen_integerChartPullback_eq + (β : σ → MvPolynomial τ ℤ) + (hβ : ∀ i, integerSampledRealChart β i ∈ weightedSupportLE (fun _ : τ => 1) (w i)) + (keep : τ → Prop) (fixed fixed' : {i // ¬keep i} → ℤ) + (hfreeze : ∀ i, integerSampledRealChart (fun z => freezePolynomial keep fixed (β z)) i ∈ + weightedSupportLE (fun _ : {i // keep i} => 1) (w i)) + (hfreeze' : ∀ i, integerSampledRealChart (fun z => freezePolynomial keep fixed' (β z)) i ∈ + weightedSupportLE (fun _ : {i // keep i} => 1) (w i)) + (reference : D.Niltest w₀) + (p : D.filtration.realification.PolynomialOrbit (fun _ : {i // keep i} => 1)) + (selected ambient : E.Niltest w) (horbit : selected.orbit = ambient.orbit) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) + (c : Basis κ ℚ M) (ν : κ → ℕ) + (hE : ∀ k, E.filtration.layer k = Submodule.span ℚ (c '' {i | k ≤ ν i})) : + pairOrbitSymbol D E (reference.withOrbit p).orbit + (selected.integerChartPullback (fun _ : {i // keep i} => 1) + (fun z => freezePolynomial keep fixed (β z)) hfreeze).orbit b ω hF = + pairOrbitSymbol D E p + (ambient.integerChartPullback (fun _ : {i // keep i} => 1) + (fun z => freezePolynomial keep fixed' (β z)) hfreeze').orbit b ω hF := by + rw [pairOrbitSymbol_withOrbit_integerChartPullback_eq D E + (fun _ : {i // keep i} => 1) (fun z => freezePolynomial keep fixed (β z)) + hfreeze reference p selected ambient horbit b ω hF] + have lift (Q Q' : E.Niltest (fun _ : {i // keep i} => 1)) + (heq : Q.symbol c ν hE = Q'.symbol c ν hE) : + pairOrbitSymbol D E p Q.orbit b ω hF = pairOrbitSymbol D E p Q'.orbit b ω hF := by + apply pairOrbitSymbol_eq_of_right_symbol_eq D E b ω hF c ν hE + exact heq + exact lift + (ambient.integerChartPullback (fun _ : {i // keep i} => 1) + (fun z => freezePolynomial keep fixed (β z)) hfreeze) + (ambient.integerChartPullback (fun _ : {i // keep i} => 1) + (fun z => freezePolynomial keep fixed' (β z)) hfreeze') + (ambient.integerChartPullback_frozen_symbol_independent + β hβ keep fixed fixed' hfreeze hfreeze' c ν hE) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeChartPartition.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeChartPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..d94cfbcfbbd59351be4b9108a4fb6ba0dfd15993 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeChartPartition.lean @@ -0,0 +1,62 @@ +import OAI.Combinatorics.Progressions.Nilpotent.RealifiedBCHSmoothPartition +import OAI.Combinatorics.Progressions.Polynomial.PolynomialShearParameterBudget + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module +open scoped TensorProduct NNReal + +theorem exists_native_chart_partition (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {L : Type*} [LieRing L] [LieAlgebra ℚ L] {d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L s d) {p : ℝ}, 0 ≤ p → D.GeometryComplexityLE p → + letI := D.metricSpace + ∃ r : ℝ≥0, 0 < r ∧ r ≤ 1 ∧ 1 / (r : ℝ) ≤ Real.exp ((p + 2) ^ C) ∧ + ∃ n : ℕ, 0 < n ∧ (n : ℝ) ≤ Real.exp ((p + 2) ^ C) ∧ + ∃ centers : Fin n → D.RealGroup, + ∃ phi : Fin n → OpenPartialHomeomorph (Fin d → ℝ) D.Space, + (∀ j i, |(D.basis.baseChange ℝ).repr (centers j).coord i| ≤ Real.exp ((p + 2) ^ C)) ∧ + (∀ j v, phi j v = QuotientGroup.mk + (centers j * (NilpotentLieBCHGroup.basisHomeomorph (D.basis.baseChange ℝ)).symm v)) ∧ + (∀ j, (phi j).source = {v | ∀ i, |v i| < (r : ℝ)}) ∧ + ∃ P : ℝ≥0, (P : ℝ) ≤ Real.exp ((p + 2) ^ C) ∧ + ∃ f : Fin n → D.Space → ℝ, + (∀ j x, 0 ≤ f j x ∧ f j x ≤ 1) ∧ (∀ x, ∑ j, f j x = 1) ∧ + (∀ j, HasCompactSupport (f j) ∧ tsupport (f j) ⊆ (phi j).target) ∧ + (∀ j, LipschitzWith P (f j)) ∧ + (∀ j, tsupport (f j) ⊆ phi j '' Metric.closedBall 0 (3 * (r : ℝ) / 4)) ∧ + ∃ K : ℝ≥0, (K : ℝ) ≤ Real.exp ((p + 2) ^ C) ∧ + ∀ j, LipschitzOnWith K (phi j) (phi j).source := by + obtain ⟨A, _, hpartition⟩ := exists_realification_smooth_partition_exp_bound s + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_fixed_power_budget + ((Polynomial.X + 1 + Polynomial.C A) ^ A) + refine ⟨C, hC, ?_⟩ + intro L _ _ d _ _ _ _ D p hp hD + let := D.metricSpace + let H := ⌈Real.exp p⌉₊ + have hc (i j k) : RationalHeightLE (lieStructureConstants D.basis i j k) H := + rationalHeightLE_ceil_exp (hD.2.2.1 i j k) + obtain ⟨r, hr, hr1, hri, n, hn, hnb, centers, phi, hcenters, hphi, hsource, _, + P, hP, f, hfrange, hfsum, hfsupport, _, hfLip, hfInner, K, hK, hForward⟩ := + hpartition D.basis D.filtration.lowerCentralSeries_eq_bot D.lattice D.grid H (p + 1) + D.grid_pos D.inner_grid D.outer_grid hc (by linarith) + (by simpa only [Fintype.card_fin] using hD.1.trans (show p ≤ p + 1 by linarith)) + (ceil_exp_le_exp_add_one hp) + (hD.2.1.trans (Real.exp_le_exp.mpr (by linarith))) + have hb : (p + 1 + A) ^ A ≤ (p + 2) ^ C := by + simpa [Polynomial.eval₂_pow] using hbudget p hp + have heb := Real.exp_le_exp.mpr hb + exact ⟨r, hr, hr1, hri.trans heb, n, hn, hnb.trans heb, centers, phi, + fun j i => (hcenters j i).trans heb, hphi, hsource, P, hP.trans heb, + f, hfrange, hfsum, hfsupport, hfLip, hfInner, K, hK.trans heb, hForward⟩ + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateDerivativeSystem.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateDerivativeSystem.lean new file mode 100644 index 0000000000000000000000000000000000000000..841d2455976734cd04f4863d70d89428ce4f5b15 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateDerivativeSystem.lean @@ -0,0 +1,145 @@ +import OAI.Combinatorics.Progressions.Estimates.FastHorizontalFactorization +import OAI.Combinatorics.Progressions.Linear.LayerOneProjectionMatrixBounds + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct + +variable {σ ι L : Type*} [Fintype σ] [DecidableEq σ] [Fintype ι] + [LieRing L] [LieAlgebra ℚ L] {s a d : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (U : LieSubalgebra ℚ (F.squareFiltration.quotientTop.PolynomialSymbol (fun _ : σ => 1))) + +local notation "Uf" => F.reducedSquareFastRelativeSubmodule (fun _ : σ => 1) U +local notation "J" => F.realFirstCoefficientFastSubmodule (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf +local notation "E" => F.RealFirstCoefficientModule (fun _ : σ => 1) +local notation "Q" => (E ⧸ J) +local notation "Hq" => F.realFastCoefficientHorizontal (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) Uf +local notation "cH" => Basis.equivFun (Basis.baseChange ℝ (F.layerOneBasis e ω hF)) +local notation "ρ" => F.realFastCoefficientAction (fun _ : σ => 1) (fun _ => Nat.zero_lt_one) U + +def NativeCoordinateDerivativeSpec : Prop := + ∀ (b : Basis (Fin d) ℝ Q) (rows : Fin d → FirstCoefficientIndex (fun _ : σ => 1) ω) + (ha : a ≤ d) (η : (Fin a → ℝ) ≃ₗ[ℝ] (ℝ ⊗[ℚ] (L ⧸ F.layer 2))) + (_hη : ∀ x, η (fun i => b.equivFun x (Fin.castLE ha i)) = Hq x) + (sectionMap : (Fin d → ℝ) →ₗ[ℝ] E) + (_hsection : ∀ y, (J).mkQ (sectionMap y) = b.equivFun.symm y) + (Cscale : ℝ) (_hC : 0 ≤ Cscale) + (_hweighted : ∀ (T : σ → ℝ), (∀ i, 0 < T i) → ∀ M : ℝ, 0 ≤ M → + (∀ x, F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T M x → ∀ i, + |b.equivFun ((J).mkQ x) i| ≤ Cscale * M / monomialScale T (rows i).val.1) ∧ + (∀ y, (∀ i, |y i| ≤ M / monomialScale T (rows i).val.1) → + F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) T (Cscale * M) (sectionMap y))) + (m : ℕ) (_hm : 0 < m) + (_hgrid : ∀ y, y ∈ realDenominatorGrid 1 → F.FirstCoefficientGrid e ω hF (fun _ : σ => 1) m (sectionMap y)) + (T : σ → ℝ) (_hT : ∀ i, 0 < T i) + (g : F.realFastDiagonalSubgroup (fun _ : σ => 1) U) + (bound : ℝ) (_hbound : 0 ≤ bound) + (D : CoordinateDerivativeSystem ha T (b.equivFun.toLinearMap.comp (F.realFastCoefficientDirectionMap U g.val)) + (b.equivFun.symm.trans ((ρ g).trans b.equivFun)) + (fun i => monomialScale T (rows i).val.1) bound) + (p : ℝ) (_hp : 0 ≤ p) (_hap : (a : ℝ) ≤ p) (_hmp : (m : ℝ) ≤ Real.exp p) + (_hCp : Cscale ≤ Real.exp p) (_hDp : (D.heightBound : ℝ) ≤ Real.exp p), + D.k ≤ a ∧ ∃ (K : Submodule ℚ (L ⧸ F.layer 2)) (bK : Basis (Fin D.k) ℚ K), + ∃ H : ℕ, 1 ≤ H ∧ (H : ℝ) ≤ Real.exp ((p + 2) ^ 3) ∧ + (∀ i j, RationalHeightLE ((F.layerOneBasis e ω hF).repr (bK j : L ⧸ F.layer 2) i) H) ∧ + ∃ l : ℕ, 0 < l ∧ (l : ℝ) ≤ bound ^ 2 ∧ + ∃ S R : (K.baseChange ℝ) →ₗ[ℝ] Q, + S = (ρ g).toLinearMap.comp R ∧ (Hq).comp S = (K.baseChange ℝ).subtype ∧ + (Hq).comp R = (K.baseChange ℝ).subtype ∧ + (∀ x, ‖basisWeightedCoordinates b (fun i => monomialScale T (rows i).val.1) (S x)‖ ≤ + (bound * Cscale) * ‖cH x.val‖) ∧ + (∀ j, b.equivFun (R (realSubmoduleBasis K bK j)) ∈ realDenominatorGrid l) ∧ + ∃ (small rational : σ → Q) (k : σ → K.baseChange ℝ), + (∀ i, F.realFastCoefficientDirectionMap U g.val (Pi.single i 1) = + small i + ρ g (rational i) + S (k i)) ∧ + (∀ i, b.equivFun (rational i) ∈ realDenominatorGrid l) ∧ + (∀ i, ‖basisWeightedCoordinates b (fun j => monomialScale T (rows j).val.1) (small i)‖ ≤ + bound / T i) ∧ + (∀ i, ‖cH (Hq (small i))‖ ≤ (Cscale * bound) / T i) + +theorem exists_native_coordinate_derivative_system : + F.NativeCoordinateDerivativeSpec (σ := σ) (a := a) (d := d) e ω hF U := by + intro b rows ha η hη sectionMap hsection Cscale hC hweighted m hm hgrid + T hT g bound hbound D p hp hap hmp hCp hDp + have hone (α : σ →₀ ℕ) : monomialScale (fun _ : σ => (1 : ℝ)) α = 1 := by + simp [monomialScale] + have hsectionOne (y : Fin d → ℝ) (M : ℝ) (hM : 0 ≤ M) (hy : ∀ j, |y j| ≤ M) : + F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) (fun _ => 1) (Cscale * M) (sectionMap y) := by + apply (hweighted (fun _ => 1) (fun _ => by norm_num) M hM).2 y + intro j + simpa only [hone, div_one] using hy j + have hprojOne (x : E) (M : ℝ) (hM : 0 ≤ M) + (hx : F.FirstCoefficientSlowBound e ω hF (fun _ : σ => 1) (fun _ => 1) M x) (j : Fin d) : + |b.equivFun ((J).mkQ x) j| ≤ Cscale * M := by + simpa only [hone, div_one] using + (hweighted (fun _ => 1) (fun _ => by norm_num) M hM).1 x hx j + have hraw := F.layerOne_rational_kernel_basis e ω hF (fun _ => 1) (fun _ => Nat.zero_lt_one) + Uf b ha η hη sectionMap hsection 1 m hm Cscale hC hgrid hsectionOne + D.K D.basisMatrix D.span_eq D.independent_real D.basis_height + obtain ⟨v, hv, hspan, hli, hheight⟩ := hraw + let K := Submodule.span ℚ (Set.range v) + let bK : Basis (Fin D.k) ℚ K := Basis.span hli + have hbK (j : Fin D.k) : (bK j : L ⧸ F.layer 2) = v j := + Basis.coe_span_apply hli j + have hbasis (j : Fin D.k) : (1 : ℝ) ⊗ₜ[ℚ] (bK j : L ⧸ F.layer 2) = + η ((D.basisMatrix.map (Rat.castHom ℝ)).col j) := by + exact (congrArg (fun z : L ⧸ F.layer 2 => (1 : ℝ) ⊗ₜ[ℚ] z) (hbK j)).trans (hv j) + have htransport := transport_coordinate_derivatives_to_rational_span ha b η Hq hη T + (F.realFastCoefficientDirectionMap U g.val) (ρ g) + (fun i => monomialScale T (rows i).val.1) bound D K bK hspan hbasis + obtain ⟨S, R, hSR, hS, hR, hSnorm, hRgrid, small, rational, k, hsystem, hrgrid, hsmall⟩ := htransport + let H₀ := (a + 1) * (max m (Nat.ceil ((m : ℝ) * Cscale)) * D.heightBound) ^ a + have hH₀ : (H₀ : ℝ) ≤ Real.exp ((p + 2) ^ 3) := + layerOne_basis_transport_height_le_exp a m D.heightBound Cscale p hp hap hmp hC hCp hDp + have hH : ((max 1 H₀ : ℕ) : ℝ) ≤ Real.exp ((p + 2) ^ 3) := by + rw [Nat.cast_max, Nat.cast_one] + exact max_le (Real.one_le_exp (by positivity)) hH₀ + let l := D.liftDenominator * D.derivativeDenominator + have hl : 0 < l := Nat.mul_pos D.liftDenominator_pos D.derivativeDenominator_pos + have hlb : (l : ℝ) ≤ bound ^ 2 := by + rw [Nat.cast_mul, pow_two] + exact mul_le_mul D.liftDenominator_le D.derivativeDenominator_le (Nat.cast_nonneg _) hbound + have hk : D.k ≤ a := by + simpa using D.independent_real.fintype_card_le_finrank + refine ⟨hk, K, bK, max 1 H₀, le_max_left _ _, hH, ?_, l, hl, hlb, + S, R, hSR, hS, hR, ?_, ?_, small, rational, k, ?_, ?_, hsmall, ?_⟩ + · intro i j + exact (congrArg (fun z : L ⧸ F.layer 2 => + RationalHeightLE ((F.layerOneBasis e ω hF).repr z i) (max 1 H₀)) (hbK j)).mpr + ((hheight i j).mono (le_max_right 1 H₀)) + · intro x + have hx := F.layerOne_equiv_symm_norm e ω hF (fun _ => 1) (fun _ => Nat.zero_lt_one) + Uf b ha η hη Cscale hC hprojOne x.val + calc + _ ≤ bound * ‖η.symm x.val‖ := hSnorm x + _ ≤ bound * (Cscale * ‖cH x.val‖) := mul_le_mul_of_nonneg_left hx hbound + _ = (bound * Cscale) * ‖cH x.val‖ := (mul_assoc _ _ _).symm + · intro j + exact realDenominatorGrid_subset_of_dvd D.liftDenominator_pos + (dvd_mul_right D.liftDenominator D.derivativeDenominator) (hRgrid j) + · intro i + exact hsystem i + · intro i + exact realDenominatorGrid_subset_of_dvd D.derivativeDenominator_pos + (dvd_mul_left D.derivativeDenominator D.liftDenominator) (hrgrid i) + · intro i + have hx := F.realFastCoefficientHorizontal_section_norm_bound e ω hF (fun _ => 1) + (fun _ => Nat.zero_lt_one) Uf b sectionMap hsection rows T hT Cscale hC + (fun M hM => (hweighted T hT M hM).2) (small i) + calc + _ ≤ Cscale * ‖basisWeightedCoordinates b (fun j => monomialScale T (rows j).val.1) (small i)‖ := hx + _ ≤ Cscale * (bound / T i) := mul_le_mul_of_nonneg_left (hsmall i) hC + _ = (Cscale * bound) / T i := (mul_div_assoc _ _ _).symm + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateErrorReduction.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateErrorReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..37070eec33faf981f23f26ec678e6adddf9dfa77 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateErrorReduction.lean @@ -0,0 +1,142 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeLocalPivotVerticalPartners +import OAI.Combinatorics.Progressions.Nilpotent.CoordinateNiltestSplitting + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_coordinate_reduction_budget (a b : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ p : ℝ, 0 ≤ p → + (p + a) ^ a ≤ (p + C) ^ C ∧ + ((p + a) ^ a + b) ^ b ≤ (p + C) ^ C ∧ + 3 * p + (p + a) ^ a + 1 ≤ (p + C) ^ C := by + let X : Polynomial ℕ := Polynomial.X + let Y := (X + Polynomial.C a) ^ a + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (3 * X + Y + (Y + Polynomial.C b) ^ b + 2) + refine ⟨C, hC, fun p hp => ?_⟩ + have hY : 0 ≤ (p + a) ^ a := by positivity + have hZ : 0 ≤ ((p + a) ^ a + b) ^ b := by positivity + have hb : 3 * p + (p + a) ^ a + ((p + a) ^ a + b) ^ b + 2 ≤ (p + C) ^ C := by + simpa [X, Y, Polynomial.eval₂_pow] using hbudget p hp + constructor + · linarith only [hp, hY, hZ, hb] + constructor <;> linarith only [hp, hY, hZ, hb] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +def CoordinateErrorReductionStatement (σ : Type) [Fintype σ] [DecidableEq σ] (s C : ℕ) : Prop := + ∀ (i : σ) {L : Type} [LieRing L] [LieAlgebra ℚ L] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + {d : ℕ} {D : RationalFilteredNilmanifold L s d} {p : ℝ} + (T : D.Niltest (fun _ : σ => 1)), 2 ≤ p → T.ComplexityLE p → + ∀ {G X : Type} (H : Finset G), H.Nonempty → + ∀ (S : G → Finset X) (b : G → σ → ℤ) (n : G → X → ℤ) (f : G → X → ℂ), + (∀ h ∈ H, (S h).Nonempty) → (∀ h ∈ H, ∀ x ∈ S h, ‖f h x‖ ≤ Real.exp p) → + (∀ h ∈ H, Real.exp (-p) ≤ + ‖𝔼 x ∈ S h, f h x * T.eval (Function.update (b h) i (n h x))‖) → + ∃ (weight : ℤ → ℂ) (Q : Finset G), (∀ z, ‖weight z‖ ≤ 1) ∧ Q ⊆ H ∧ Q.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * (H.card : ℝ) ≤ (Q.card : ℝ) ∧ + ∀ h ∈ Q, ∃ v : ℤ → ℂ, + (∀ z, ‖v z‖ ≤ 1) ∧ + Nonempty (NativeIntegerExpansion (fun _ : Unit => 1) (s - 1) ((p + C) ^ C) + (fun x => v (x ()))) ∧ + Real.exp (-((p + C) ^ C)) ≤ + ‖𝔼 x ∈ S h, f h x * weight (n h x) * v (n h x)‖ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeCoordinateSplit.lie NativeCoordinateSplit.algebra + NativeCoordinateSplit.topology NativeCoordinateSplit.topologicalAdd + NativeCoordinateSplit.continuousSMul NativeCoordinateSplit.hausdorff + +theorem exists_coordinate_error_reduction (σ : Type) [Fintype σ] [DecidableEq σ] [Nonempty σ] + (s : ℕ) : ∃ C : ℕ, 2 ≤ C ∧ CoordinateErrorReductionStatement σ s C := by + obtain ⟨a, _, hsplit⟩ := exists_coordinate_niltest_splitting σ s 2 + obtain ⟨b, _, hfreeze⟩ := NativeCoordinateSplit.exists_second_expansion_budget σ s + obtain ⟨C, hC, hbudget⟩ := exists_coordinate_reduction_budget a b + refine ⟨C, hC, ?_⟩ + intro i L _ _ _ _ _ _ d D p T hp hT G X H hH S z n f hS hf hcorr + have hp0 : 0 ≤ p := le_trans (by norm_num) hp + let U := T.conjugate.expNormalize p + let epsilon := Real.exp (-(3 * p + 1)) + have hscale : 1 / epsilon ≤ Real.exp ((p + 2) ^ 2) := by + dsimp [epsilon] + rw [one_div, ← Real.exp_neg] + apply Real.exp_le_exp.mpr + nlinarith only [hp0, sq_nonneg p] + obtain ⟨R⟩ := hsplit i U (T.conjugate.expNormalize_complexity hT) + (T.conjugate.expNormalize_norm hT) epsilon (Real.exp_pos _) hscale + let sample (h : G) (x : X) := Function.update (z h) i (n h x) + let f₀ (h : G) (x : X) := (Real.exp (-p) : ℂ) * f h x + have hf₀ : ∀ h ∈ H, ∀ x ∈ S h, ‖f₀ h x‖ ≤ 1 := + fun h hh x hx => exp_scaled_norm_le_one (hf h hh x hx) + have hc₀ : ∀ h ∈ H, Real.exp (-(3 * p)) ≤ + ‖𝔼 x ∈ S h, f₀ h x * star (U.eval (sample h x))‖ := by + intro h hh + have hc := finite_double_normalization (S h) (f h) (fun x => T.eval (sample h x)) p (hcorr h hh) + simpa only [f₀, U, RationalFilteredNilmanifold.Niltest.expNormalize_eval, + RationalFilteredNilmanifold.Niltest.eval_conjugate, star_mul, + Complex.star_def, Complex.conj_ofReal, Complex.conj_conj, mul_assoc, mul_left_comm, mul_comm] using hc + have hepsilon : epsilon ≤ Real.exp (-(3 * p)) / 2 := by + simpa only [epsilon, show -(3 * p + 1) = -(3 * p) - 1 by ring] using + exp_sub_one_le_half_exp (-(3 * p)) + obtain ⟨j, Q, hQH, hQ, hsize, hterm⟩ := R.exists_fixed_correlating_term + H hH S hS sample f₀ (Real.exp_pos _) hepsilon hf₀ hc₀ + let weight (x : ℤ) := star (R.firstFactor j x) + have hweight (x : ℤ) : ‖weight x‖ ≤ 1 := by + simpa only [weight, norm_star] using R.firstFactor_norm j x + have hfirst (h : G) (x : X) : (R.test false j).eval (sample h x) = R.firstFactor j (n h x) := by + simpa only [sample, Function.update_self] using R.first_eval_firstFactor j (sample h x) + have hsmall : Real.exp (-(3 * p + (p + a) ^ a + 1)) ≤ + Real.exp (-(3 * p)) / (2 * Real.exp ((p + a) ^ a)) := by + calc + _ = Real.exp (-(3 * p + (p + a) ^ a) - 1) := by congr 1; ring + _ ≤ Real.exp (-(3 * p + (p + a) ^ a)) / 2 := exp_sub_one_le_half_exp _ + _ = _ := by + rw [show -(3 * p + (p + a) ^ a) = -(3 * p) - (p + a) ^ a by ring, Real.exp_sub] + ring + refine ⟨weight, Q, hweight, hQH, hQ, ?_, ?_⟩ + · exact (mul_le_mul_of_nonneg_right + (Real.exp_le_exp.mpr (neg_le_neg (hbudget p hp0).1)) (Nat.cast_nonneg H.card)).trans hsize + · intro h hh + let v (x : ℤ) := star ((R.test true j).eval (Function.update (z h) i x)) + obtain ⟨E, _⟩ := hfreeze R j (z h) + refine ⟨v, ?_, ⟨E.conjugate.mono (hbudget p hp0).2.1⟩, ?_⟩ + · intro x + simpa only [v, norm_star] using ((R.test true j).norm_eval_le (Function.update (z h) i x)).trans + (show ((R.test true j).normBound : ℝ) ≤ 1 from R.test_norm true j) + · have hc : Real.exp (-(3 * p)) / (2 * Real.exp ((p + a) ^ a)) ≤ + ‖𝔼 x ∈ S h, ((Real.exp (-p) : ℂ) * f h x) * (weight (n h x) * v (n h x))‖ := by + simpa only [f₀, hfirst, weight, v, sample, star_mul, + mul_assoc, mul_left_comm, mul_comm] using hterm h hh + have hout := finite_remove_normalization (S h) (f h) + (fun x => weight (n h x) * v (n h x)) hp0 hc + have hthreshold := (Real.exp_le_exp.mpr (neg_le_neg (hbudget p hp0).2.2)).trans + (hsmall.trans hout) + simpa only [mul_assoc] using hthreshold + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateEstimates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateEstimates.lean new file mode 100644 index 0000000000000000000000000000000000000000..315cd125fddf4aab3bd0d3f614f01d65373b3e7d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateEstimates.lean @@ -0,0 +1,261 @@ +import OAI.Combinatorics.Progressions.Linear.FixedAdaptedSymbolFactorizationBasis +import OAI.Combinatorics.Progressions.Linear.RankDependentInputBudget +import OAI.Combinatorics.Progressions.Linear.RefiltrationLayerBasis + +namespace OAI + +section + +namespace Erdos3 + +def refiltrationCoordinateBudget (p : ℝ) : ℝ := + ((p + 1 + (p + 3) ^ 7 + 2) ^ 9 + p + 4) ^ 4 + +theorem refiltrationCoordinateBudget_nonneg {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ refiltrationCoordinateBudget p := by + unfold refiltrationCoordinateBudget + positivity + +namespace NilpotentLieFiltration + +open Module + +theorem exists_refiltration_bases_in_coordinates + {ι κ ν L : Type*} [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (b : Basis ν ℚ L) (U : LieSubalgebra ℚ F.AssociatedGraded) + (v : κ → F.AssociatedGraded) (hspan : Submodule.span ℚ (Set.range v) = U.toSubmodule) + {p : ℝ} (hp : 0 ≤ p) (hd : (Fintype.card ι : ℝ) ≤ p) (hκ : (Fintype.card κ : ℝ) ≤ p) + (hv : ∀ i j, rationalLogHeight ((F.associatedGradedBasis e ω hF).repr (v i) j) ≤ p) + (he : ∀ i j, rationalLogHeight (b.repr (e i) j) ≤ p) : + ∀ d, ∃ a : Basis (Fin (finrank ℚ (F.gradedRefiltrationLayer U d))) ℚ + (F.gradedRefiltrationLayer U d), + ∀ i j, rationalLogHeight (b.repr (a i : L) j) ≤ refiltrationCoordinateBudget p := by + let H := ⌈Real.exp p⌉₊ + have hHp : (H : ℝ) ≤ Real.exp (p + 1) := ceil_exp_le_exp_add_one hp + obtain ⟨B, _, hB, hbasis⟩ := F.exists_uniform_refiltration_layer_bases e ω hF U v hspan + (one_le_ceil_exp p) (fun i j => rationalHeightLE_ceil_exp (hv i j)) + (by linarith : 0 ≤ p + 1) (hd.trans (by linarith)) (hκ.trans (by linarith)) hHp + let r := (p + 1 + (p + 3) ^ 7 + 2) ^ 9 + have hBr : (B : ℝ) ≤ Real.exp r := by + simpa only [r, show p + 1 + 2 = p + 3 by ring] using hB + let t := r + p + 2 + have hr : 0 ≤ r := by dsimp [r]; positivity + have ht : 0 ≤ t := by dsimp [t]; positivity + have hpt : p ≤ t := by dsimp [t]; linarith + have hrt : r ≤ t := by dsimp [t]; linarith + have hHt : (H : ℝ) ≤ Real.exp t := + hHp.trans (Real.exp_le_exp.mpr (by dsimp [t]; linarith)) + intro d + obtain ⟨a, ha⟩ := hbasis d + refine ⟨a, ?_⟩ + intro i j + have hx : ∀ k, rationalLogHeight (e.repr (a i : L) k) ≤ t := fun k => + (rationalLogHeight_le_of_height (ha i k) hBr).trans hrt + have h := rational_basis_coordinates_logHeight e b ht (hd.trans hpt) hHt + (fun i j => rationalHeightLE_ceil_exp (he i j)) (a i : L) hx j + have hshape : t + 2 = r + p + 4 := by dsimp [t]; ring + rw [hshape] at h + exact h + +end NilpotentLieFiltration + +end Erdos3 + +end + +section + +namespace Erdos3 + +def horizontalCoordinateBudget (p : ℝ) : ℝ := + p + p * (refiltrationCoordinateBudget p + 1 + (p + 3) ^ 7) + +theorem horizontalCoordinateBudget_nonneg {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ horizontalCoordinateBudget p := by + have h := refiltrationCoordinateBudget_nonneg hp + unfold horizontalCoordinateBudget + positivity + +theorem horizontalCoordinateHeight_bound {p : ℝ} (hp : 0 ≤ p) + (n H K : ℕ) (hn : (n : ℝ) ≤ p) + (hH : (H : ℝ) ≤ Real.exp (refiltrationCoordinateBudget p + 1)) + (hK : (K : ℝ) ≤ Real.exp ((p + 3) ^ 7)) : + (((n + 1) * (H * K) ^ n : ℕ) : ℝ) ≤ Real.exp (horizontalCoordinateBudget p) := by + have hcount : (n : ℝ) + 1 ≤ Real.exp p := by + linarith [Real.add_one_le_exp p] + have hsum : 0 ≤ refiltrationCoordinateBudget p + 1 + (p + 3) ^ 7 := by + have h := refiltrationCoordinateBudget_nonneg hp + positivity + calc + _ ≤ Real.exp p * (Real.exp (refiltrationCoordinateBudget p + 1) * + Real.exp ((p + 3) ^ 7)) ^ n := by + push_cast + gcongr + _ = Real.exp (p + (n : ℝ) * (refiltrationCoordinateBudget p + 1 + (p + 3) ^ 7)) := by + rw [← Real.exp_add, ← Real.exp_nat_mul, ← Real.exp_add] + _ ≤ _ := Real.exp_le_exp.mpr (add_le_add le_rfl (mul_le_mul_of_nonneg_right hn hsum)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +def nativeCoordinateBaseBudget (s : ℕ) (P : ℝ) : ℝ := + 4 * P + (P + 3) ^ 7 + horizontalCoordinateBudget P + + (s : ℝ) * P + (P + 3) ^ 2 + 4 + +def nativeCoordinateInputBudget (s : ℕ) (P : ℝ) : ℝ := + nativeCoordinateBaseBudget s P + (nativeCoordinateBaseBudget s P + 2) ^ 3 + P + 2 + +noncomputable def nativeDependentBudget (s : ℕ) (P : ℝ) : ℝ := + let Z := rankDependentInputBudget (nativeCoordinateInputBudget s P) + Z + sparseGeneratorBudget Z + +noncomputable def nativeCoordinateSeparationBudget (s : ℕ) (P : ℝ) : ℝ := + separationBudget (nativeCoordinateInputBudget s P) + separationBudget (nativeDependentBudget s P) + +noncomputable def nativeDependentDenominatorBudget (s : ℕ) (P : ℝ) : ℝ := + nativeDependentBudget s P + (nativeDependentBudget s P + 2) ^ 3 + + (nativeDependentBudget s P + 2) ^ 36 + +noncomputable def nativeDependentSlowBudget (s : ℕ) (P : ℝ) : ℝ := + (nativeDependentBudget s P + 2) ^ 3 + (nativeDependentBudget s P + 2) ^ 18 + + nativeDependentBudget s P + 1 + +theorem nativeCoordinateBaseBudget_bounds (s : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ nativeCoordinateBaseBudget s P ∧ 4 * P ≤ nativeCoordinateBaseBudget s P ∧ + P ≤ nativeCoordinateBaseBudget s P ∧ (P + 3) ^ 7 + 1 ≤ nativeCoordinateBaseBudget s P ∧ + horizontalCoordinateBudget P + 1 ≤ nativeCoordinateBaseBudget s P ∧ + (P + 3) ^ 2 + (s : ℝ) * P ≤ nativeCoordinateBaseBudget s P := by + have hH := horizontalCoordinateBudget_nonneg hP + have h₇ : 0 ≤ (P + 3) ^ 7 := by positivity + have h₂ : 0 ≤ (P + 3) ^ 2 := sq_nonneg _ + have hs : 0 ≤ (s : ℝ) * P := mul_nonneg (Nat.cast_nonneg s) hP + unfold nativeCoordinateBaseBudget + constructor + · linarith + constructor + · linarith + constructor + · linarith + constructor + · linarith + constructor <;> linarith + +theorem nativeCoordinateInputBudget_bounds (s : ℕ) {P : ℝ} (hP : 0 ≤ P) : + nativeCoordinateBaseBudget s P ≤ nativeCoordinateInputBudget s P ∧ + (nativeCoordinateBaseBudget s P + 2) ^ 3 + P ≤ nativeCoordinateInputBudget s P ∧ + 1 + (nativeCoordinateBaseBudget s P + 2) ^ 3 + nativeCoordinateBaseBudget s P ≤ + nativeCoordinateInputBudget s P := by + have hU := (nativeCoordinateBaseBudget_bounds s hP).1 + have hc : 0 ≤ (nativeCoordinateBaseBudget s P + 2) ^ 3 := by positivity + unfold nativeCoordinateInputBudget + constructor + · linarith + constructor <;> linarith + +theorem nativeCoordinateInputBudget_nonneg (s : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ nativeCoordinateInputBudget s P := + (nativeCoordinateBaseBudget_bounds s hP).1.trans (nativeCoordinateInputBudget_bounds s hP).1 + +theorem nativeDependentBudget_nonneg (s : ℕ) {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ nativeDependentBudget s P := by + have hZ := (rankDependentInputBudget_bounds (nativeCoordinateInputBudget_nonneg s hP)).1 + exact add_nonneg hZ (sparseGeneratorBudget_nonneg hZ) + +theorem nativeCoordinateSeparationBudget_cutoffs (s : ℕ) {P N : ℝ} (hP : 0 ≤ P) + (hN : Real.exp (nativeCoordinateSeparationBudget s P) ≤ N) : + Real.exp (separationBudget (nativeCoordinateInputBudget s P)) ≤ N ∧ + Real.exp (separationBudget (nativeDependentBudget s P)) ≤ N := by + have h₁ := separationBudget_nonneg (nativeCoordinateInputBudget_nonneg s hP) + have h₂ := separationBudget_nonneg (nativeDependentBudget_nonneg s hP) + constructor + · exact (Real.exp_le_exp.mpr (le_add_of_nonneg_right h₂)).trans hN + · exact (Real.exp_le_exp.mpr (le_add_of_nonneg_left h₁)).trans hN + +theorem nativeDependentSlowBudget_bound (s : ℕ) {P : ℝ} (hP : 0 ≤ P) : + Real.exp (nativeDependentBudget s P) + + Real.exp ((nativeDependentBudget s P + 2) ^ 3 + (nativeDependentBudget s P + 2) ^ 18 + + nativeDependentBudget s P) ≤ Real.exp (nativeDependentSlowBudget s P) := by + let Q := nativeDependentBudget s P + let L := (Q + 2) ^ 3 + (Q + 2) ^ 18 + Q + have hQ : 0 ≤ Q := nativeDependentBudget_nonneg s hP + have hQL : Q ≤ L := by + have h₁ : 0 ≤ (Q + 2) ^ 3 := by positivity + have h₂ : 0 ≤ (Q + 2) ^ 18 := by positivity + dsimp only [L] + linarith + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + Real.exp Q + Real.exp L ≤ 2 * Real.exp L := by linarith [Real.exp_le_exp.mpr hQL] + _ ≤ Real.exp 1 * Real.exp L := mul_le_mul_of_nonneg_right htwo (Real.exp_pos _).le + _ = Real.exp (L + 1) := (mul_comm _ _).trans (Real.exp_add L 1).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem nativeCoordinate_denominator_bound + {ι κ : Type*} [Fintype ι] [Fintype κ] (s : ℕ) {P : ℝ} (hP : 0 ≤ P) + (A : Matrix ι κ ℚ) (l : ℕ) (hl : (l : ℝ) ≤ Real.exp P) + (hrows : (Fintype.card ι : ℝ) ≤ P) (hcols : (Fintype.card κ : ℝ) ≤ P) + (hA : ∀ i j, rationalLogHeight (A i j) ≤ (P + 3) ^ 7) : + ((matrixDenominator A * l : ℕ) : ℝ) ≤ Real.exp (nativeCoordinateInputBudget s P) := by + obtain ⟨hU, _, hPU, hFU, _, _⟩ := nativeCoordinateBaseBudget_bounds s hP + have hden : (matrixDenominator A : ℝ) ≤ Real.exp ((nativeCoordinateBaseBudget s P + 2) ^ 3) := + matrixDenominator_le_exp_power A hU 1 (hrows.trans hPU) (hcols.trans hPU) (by + intro i j + apply ((rationalLogHeight_le_iff (A i j) _).mp (hA i j)).2.trans + apply Real.exp_le_exp.mpr + simp only [pow_one] + linarith) + rw [Nat.cast_mul] + calc + (matrixDenominator A : ℝ) * l ≤ + Real.exp ((nativeCoordinateBaseBudget s P + 2) ^ 3) * Real.exp P := + mul_le_mul hden hl (Nat.cast_nonneg _) (Real.exp_pos _).le + _ = Real.exp ((nativeCoordinateBaseBudget s P + 2) ^ 3 + P) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (nativeCoordinateInputBudget_bounds s hP).2.1 + +theorem nativeCoordinate_slow_bound (s : ℕ) {P p : ℝ} (hP : 0 ≤ P) (hpP : p ≤ P) + (n K : ℕ) (hn : (n : ℝ) ≤ P) (hK : (K : ℝ) ≤ Real.exp ((P + 3) ^ 7 + 1)) : + 2 * (((n : ℝ) + 1) * (K + 1) * Real.exp ((P + 3) ^ 2 + (s : ℝ) * p)) ≤ + Real.exp (nativeCoordinateInputBudget s P) := by + obtain ⟨hU, _, hPU, hFU, _, hSU⟩ := nativeCoordinateBaseBudget_bounds s hP + let U := nativeCoordinateBaseBudget s P + have hKU : (K : ℝ) ≤ Real.exp ((U + 2) ^ 1) := by + apply hK.trans + apply Real.exp_le_exp.mpr + simp only [pow_one] + linarith + have hfac : ((n : ℝ) + 1) * (K + 1) ≤ Real.exp ((U + 2) ^ 3) := by + apply le_trans _ (matrix_weighted_factor_le_exp_power n hU (hn.trans hPU) 1 (by decide)) + exact mul_le_mul_of_nonneg_left (add_le_add hKU le_rfl) (by positivity) + have hSU' : (P + 3) ^ 2 + (s : ℝ) * p ≤ U := + (add_le_add le_rfl (mul_le_mul_of_nonneg_left hpP (Nat.cast_nonneg s))).trans hSU + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + calc + 2 * (((n : ℝ) + 1) * (K + 1) * Real.exp ((P + 3) ^ 2 + (s : ℝ) * p)) ≤ + Real.exp 1 * (Real.exp ((U + 2) ^ 3) * Real.exp U) := + mul_le_mul htwo (mul_le_mul hfac (Real.exp_le_exp.mpr hSU') + (Real.exp_pos _).le (Real.exp_pos _).le) (by positivity) (Real.exp_pos _).le + _ = Real.exp (1 + (U + 2) ^ 3 + U) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr (nativeCoordinateInputBudget_bounds s hP).2.2 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateFiber.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateFiber.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2f71b0c3c9030bd7808097b7d425ba9a38b7692 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateFiber.lean @@ -0,0 +1,37 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeCrossFactorization + +namespace OAI + +section + +namespace Erdos3.NativeVectorCorrelation + +theorem exists_fixed_coordinate {G I : Type*} [Fintype I] + {degree N : ℕ} [NeZero N] {p q : ℝ} + (H : Finset G) (hH : H.Nonempty) (f : G → I → ZMod N → ℂ) + (hI : (Fintype.card I : ℝ) ≤ Real.exp q) + (hcorr : ∀ h ∈ H, Nonempty (NativeVectorCorrelation degree N p (f h))) : + ∃ i : I, ∃ H' : Finset G, H' ⊆ H ∧ H'.Nonempty ∧ + Real.exp (-q) * H.card ≤ (H'.card : ℝ) ∧ + ∀ h ∈ H', Nonempty (NativeVectorCorrelation degree N p (fun _ : Unit => f h i)) := by + classical + let W (h : {h // h ∈ H}) := Classical.choice (hcorr h.val h.property) + obtain ⟨h₀, hh₀⟩ := hH + let code (h : G) := if hh : h ∈ H then (W ⟨h, hh⟩).coordinate else (W ⟨h₀, hh₀⟩).coordinate + obtain ⟨i, _, H', hsub, hH', hfixed, hdense⟩ := exists_exponential_constant_fiber + H ⟨h₀, hh₀⟩ code Set.univ (Set.toFinite _) (fun _ _ => Set.mem_univ _) + (by simpa only [Set.ncard_univ, Nat.card_eq_fintype_card] using hI) + refine ⟨i, H', hsub, hH', hdense, ?_⟩ + intro h hh + let Wh := W ⟨h, hsub hh⟩ + have hi : Wh.coordinate = i := by + simpa only [code, dite_eq_left (hsub hh)] using hfixed h hh + exact ⟨{ Wh with + coordinate := () + correlation := by simpa only [hi] using Wh.correlation }⟩ + +end Erdos3.NativeVectorCorrelation + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinatePairs.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinatePairs.lean new file mode 100644 index 0000000000000000000000000000000000000000..90e8627a9116c5c4127829d5c11c75599f5af795 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinatePairs.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeMultilinearityCorrelation + +namespace OAI + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators + +theorem exists_coordinate_sum_equivalence {σ : Type*} [Fintype σ] [DecidableEq σ] + (bound : σ → ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} (W : NativeMultidegreeNilcharacter bound p) + (i : σ), bound i = 1 → ∀ {τ : Type*} [Fintype τ] (a b n : (τ → ℤ) →+ ℤ), + NativeIntegerVectorEquivalence ((∑ j, bound j) - 1) ((p + C) ^ C) + (fun k x => W.eval k (coordinateConstantInput i (a x + b x) (n x))) + (fun k : Fin W.outputDim × Fin W.outputDim => fun x => + W.eval k.1 (coordinateConstantInput i (a x) (n x)) * + W.eval k.2 (coordinateConstantInput i (b x) (n x))) := by + obtain ⟨C, hC, hadd⟩ := exists_addition_equivalence bound + refine ⟨C, hC, ?_⟩ + intro p W i hi τ _ a b n + let A : Option σ → ((τ → ℤ) →+ ℤ) := fun j => match j with + | none => b + | some j => if j = i then a else n + have hinput (x : τ → ℤ) : (fun j => A j x) = coordinatePairInput i (a x) (b x) (n x) := by + funext j + cases j with + | none => rfl + | some j => + by_cases hji : j = i <;> simp [A, coordinatePairInput, coordinateConstantInput, hji] + have E := (hadd W i hi).linearPullbackHom A + simpa only [coordinateSumVector, coordinateTensorVector, hinput, + coordinatePairInput_sum, coordinatePairInput_left, coordinatePairInput_right] using E + +theorem exists_coordinate_parallelogram_equivalence {σ : Type*} [Fintype σ] [DecidableEq σ] + (bound : σ → ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} (W : NativeMultidegreeNilcharacter bound p) + (i : σ), bound i = 1 → ∀ {τ : Type*} [Fintype τ] (u v w n : (τ → ℤ) →+ ℤ), + NativeIntegerVectorEquivalence ((∑ j, bound j) - 1) ((p + C) ^ C) + (fun k : Fin W.outputDim × Fin W.outputDim => fun x => + W.eval k.1 (coordinateConstantInput i (v x) (n x)) * + W.eval k.2 (coordinateConstantInput i (w x) (n x))) + (fun k : Fin W.outputDim × Fin W.outputDim => fun x => + W.eval k.1 (coordinateConstantInput i (u x) (n x)) * + W.eval k.2 (coordinateConstantInput i (v x + w x - u x) (n x))) := by + obtain ⟨a, _, hadd⟩ := exists_coordinate_sum_equivalence bound + obtain ⟨c, _, htrans⟩ := NativeIntegerVectorEquivalence.exists_trans_budget + let X : Polynomial ℕ := Polynomial.X + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (((X + Polynomial.C a) ^ a + Polynomial.C c) ^ c) + refine ⟨C, hC, ?_⟩ + intro p W i hi τ _ u v w n + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let q := (p + a) ^ a + have hq : 0 ≤ q := by dsimp [q]; positivity + let u₄ := v + w - u + have hu₄ (x : τ → ℤ) : u₄ x = v x + w x - u x := rfl + have hsum (x : τ → ℤ) : u x + u₄ x = v x + w x := by rw [hu₄]; ring + have E₁ := hadd W i hi u u₄ n + have E₂ := hadd W i hi v w n + have E₁' : NativeIntegerVectorEquivalence ((∑ j, bound j) - 1) q + (fun k x => W.eval k (coordinateConstantInput i (v x + w x) (n x))) + (fun k : Fin W.outputDim × Fin W.outputDim => fun x => + W.eval k.1 (coordinateConstantInput i (u x) (n x)) * + W.eval k.2 (coordinateConstantInput i (u₄ x) (n x))) := by + simpa only [hsum] using E₁ + have R := htrans hq E₂.symm E₁' (fun x => W.unit_eval _) + have hcost : (q + c) ^ c ≤ (p + C) ^ C := by + simpa [X, q, Polynomial.eval₂_pow] using hbudget p hp + simpa only [hu₄] using R.mono hcost + +end Erdos3.NativeMultidegreeNilcharacter + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateSplitFreezing.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateSplitFreezing.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa2c617de611b0ae753ae6b11f68a5f0123e8249 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCoordinateSplitFreezing.lean @@ -0,0 +1,309 @@ +import Mathlib.Order.UpperLower.Basic +import OAI.Combinatorics.Progressions.Estimates.NativeTwoVariableSplitFreezing + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +namespace VectorPolynomial + +theorem eval_eq_of_support_agreement {σ R V : Type*} [CommRing R] + [AddCommGroup V] [Module R V] (p : VectorPolynomial σ R V) (x y : σ → R) + (hxy : ∀ a, coefficients p a ≠ 0 → ∀ i, a i ≠ 0 → x i = y i) : + eval x p = eval y p := by + classical + conv_lhs => rw [← sum_monomial_coefficients p] + conv_rhs => rw [← sum_monomial_coefficients p] + simp only [Finsupp.sum, map_sum, eval_monomial, Finsupp.prod] + apply Finset.sum_congr rfl + intro a ha + congr 1 + apply Finset.prod_congr rfl + intro i hi + rw [hxy a (Finsupp.mem_support_iff.mp ha) i (Finsupp.mem_support_iff.mp hi)] + +end VectorPolynomial + +namespace MultidegreeLieFiltration + +open VectorPolynomial + +theorem polynomialOrbitEval_eq_on_active_coordinates {σ L : Type*} [Fintype σ] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} {bound : σ → ℕ} + (F : MultidegreeLieFiltration σ L s bound) (g : F.PolynomialOrbit) + (x y : σ → ℤ) (hxy : ∀ i, bound i ≠ 0 → x i = y i) : + F.polynomialOrbitEval x g = F.polynomialOrbitEval y g := by + apply NilpotentLieBCHGroup.ext + apply VectorPolynomial.eval_eq_of_support_agreement (g.log F) + intro a ha i hi + have hle : (fun j => a j) ≤ bound := by + by_contra hn + have hc := g.adapted F a + exact ha (by simpa only [F.terminal _ hn, Submodule.mem_bot] using hc) + have hb : bound i ≠ 0 := by + intro hz + exact hi (Nat.eq_zero_of_le_zero (by simpa only [hz] using hle i)) + exact congrArg (fun z : ℤ => (z : ℚ)) (hxy i hb) + +end MultidegreeLieFiltration + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {σ : Type*} [DecidableEq σ] + +def coordinateSplitBound (s : ℕ) (i : σ) (b : Bool) (j : σ) : ℕ := + if b then (if j = i then s - 1 else s) else (if j = i then s else 0) + +def coordinateSplitDownset (s : ℕ) (i : σ) (b : Bool) : Set (σ →₀ ℕ) := + {a | ∀ j, a j ≤ coordinateSplitBound s i b j} + +theorem coordinateSplitBound_le (s : ℕ) (i : σ) (b : Bool) : + coordinateSplitBound s i b ≤ fun _ => s := by + intro j + cases b <;> by_cases h : j = i <;> simp [coordinateSplitBound, h] + +theorem coordinateSplitDownset_lower (s : ℕ) (i : σ) (b : Bool) : + IsLowerSet (coordinateSplitDownset s i b) := + fun _ _ hab hb j => (hab j).trans (hb j) + +theorem coordinateSplitDownset_covers [Fintype σ] (s : ℕ) (i : σ) (a : σ →₀ ℕ) + (ha : (∑ j, a j) ≤ s) : + a ∈ coordinateSplitDownset s i false ∪ coordinateSplitDownset s i true := by + have hall (j : σ) : a j ≤ s := + (Finset.single_le_sum (fun k _ => Nat.zero_le (a k)) (Finset.mem_univ j)).trans ha + by_cases hi : a i ≤ s - 1 + · right + intro j + by_cases hj : j = i + · subst j + simpa [coordinateSplitBound] using hi + · simpa [coordinateSplitBound, hj] using hall j + · left + intro j + by_cases hj : j = i + · subst j + simpa [coordinateSplitBound] using hall i + · have htwo : a i + a j ≤ ∑ k, a k := by + calc + a i + a j = ∑ k ∈ ({i, j} : Finset σ), a k := by simp [Ne.symm hj] + _ ≤ ∑ k, a k := Finset.sum_le_sum_of_subset (Finset.subset_univ _) + have hz : a j = 0 := by omega + simp [coordinateSplitBound, hj, hz] + +theorem coordinateSplitDownset_terminal [Fintype σ] [Nonempty σ] + {L : Type*} [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} (F : NilpotentLieFiltration L s) (i : σ) (a : σ →₀ ℕ) + (ha : a ∉ coordinateSplitDownset s i false ∪ coordinateSplitDownset s i true) : + (F.totalDegreeMultifiltration σ).layer (fun j => a j) = ⊥ := by + apply F.layer_eq_bot_above_step + exact Nat.lt_of_not_ge (fun h => ha (coordinateSplitDownset_covers s i a h)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +structure NativeCoordinateSplit {σ : Type} [Fintype σ] [DecidableEq σ] [Nonempty σ] + (i : σ) (s d : ℕ) (p epsilon : ℝ) (f : (σ → ℤ) → ℂ) where + count : ℕ + count_pos : 0 < count + count_bound : (count : ℝ) ≤ Real.exp p + L : Bool → Type + [lie : ∀ b, LieRing (L b)] + [algebra : ∀ b, LieAlgebra ℚ (L b)] + dim : Bool → ℕ + [topology : ∀ b, TopologicalSpace (ℝ ⊗[ℚ] L b)] + [topologicalAdd : ∀ b, IsTopologicalAddGroup (ℝ ⊗[ℚ] L b)] + [continuousSMul : ∀ b, ContinuousSMul ℝ (ℝ ⊗[ℚ] L b)] + [hausdorff : ∀ b, T2Space (ℝ ⊗[ℚ] L b)] + model : ∀ b, RationalFilteredNilmanifold (L b) (∑ _ : σ, s) (dim b) + multi : ∀ b, (model b).MultidegreeStructure (coordinateSplitBound s i b) + complexity : ∀ b, (multi b).ComplexityLE p + dimension_bound : ∀ b, dim b ≤ 2 ^ (Fintype.card σ * s) * d + orbit : ∀ b, (multi b).filtration.realification.PolynomialOrbit + test : ∀ b, Fin count → (model b).Niltest (fun _ : σ => 1) + test_norm : ∀ b j, (test b j).normBound ≤ 1 + test_complexity : ∀ b j, (test b j).ComplexityLE p + test_orbit : ∀ b j, (test b j).orbit = (multi b).orbitToOrdinary (orbit b) + approximation : ∀ x, ‖f x - ∑ j, (test false j).eval x * (test true j).eval x‖ ≤ epsilon + +end Erdos3 + +end + +section + +namespace Erdos3.NativeCoordinateSplit + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeCoordinateSplit.lie NativeCoordinateSplit.algebra + NativeCoordinateSplit.topology NativeCoordinateSplit.topologicalAdd + NativeCoordinateSplit.continuousSMul NativeCoordinateSplit.hausdorff + +theorem exists_fixed_correlating_term {σ : Type} [Fintype σ] [DecidableEq σ] [Nonempty σ] + {i : σ} {G X : Type*} {s d : ℕ} {p epsilon rho : ℝ} {u : (σ → ℤ) → ℂ} + (R : NativeCoordinateSplit i s d p epsilon u) (H : Finset G) (hH : H.Nonempty) + (S : G → Finset X) (hS : ∀ h ∈ H, (S h).Nonempty) + (sample : G → X → σ → ℤ) (f : G → X → ℂ) + (hrho : 0 < rho) (hepsilon : epsilon ≤ rho / 2) + (hf : ∀ h ∈ H, ∀ x ∈ S h, ‖f h x‖ ≤ 1) + (hcorr : ∀ h ∈ H, rho ≤ ‖𝔼 x ∈ S h, f h x * star (u (sample h x))‖) : + ∃ (j : Fin R.count) (Q : Finset G), Q ⊆ H ∧ Q.Nonempty ∧ + Real.exp (-p) * (H.card : ℝ) ≤ (Q.card : ℝ) ∧ + ∀ h ∈ Q, rho / (2 * Real.exp p) ≤ + ‖𝔼 x ∈ S h, f h x * star ((R.test false j).eval (sample h x) * + (R.test true j).eval (sample h x))‖ := by + classical + let rel (h : G) (_ : Unit) (j : Fin R.count) : Prop := + rho / (2 * Real.exp p) ≤ + ‖𝔼 x ∈ S h, f h x * star ((R.test false j).eval (sample h x) * + (R.test true j).eval (sample h x))‖ + have hcount : (Fintype.card (Fin R.count) : ℝ) ≤ Real.exp p := by + simpa only [Fintype.card_fin] using R.count_bound + have hchoice : ∀ h ∈ H, ∀ b, ∃ j, rel h b j := by + intro h hh _ + apply exists_correlating_summand (J := Fin R.count) (hS h hh) + (f h) (fun x => u (sample h x)) + (fun j x => (R.test false j).eval (sample h x) * (R.test true j).eval (sample h x)) + hrho (Real.exp_pos p) hcount (hf h hh) _ (hcorr h hh) + intro x _ + rw [norm_sub_rev] + exact (R.approximation (sample h x)).trans hepsilon + obtain ⟨j, Q, hsub, hQ, hsize, hfixed⟩ := + exists_large_fixed_choices H hH rel hchoice hcount + refine ⟨j (), Q, hsub, hQ, ?_, fun h hh => hfixed h hh ()⟩ + simpa only [Fintype.card_unit, Nat.cast_one, mul_one] using hsize + +end Erdos3.NativeCoordinateSplit + +end + +section + +namespace Erdos3.NativeCoordinateSplit + +open scoped TensorProduct + +attribute [local instance] NativeCoordinateSplit.lie NativeCoordinateSplit.algebra + NativeCoordinateSplit.topology NativeCoordinateSplit.topologicalAdd + NativeCoordinateSplit.continuousSMul NativeCoordinateSplit.hausdorff + +variable {σ : Type} [Fintype σ] [DecidableEq σ] [Nonempty σ] {i : σ} {s d : ℕ} + {p epsilon : ℝ} {f : (σ → ℤ) → ℂ} (R : NativeCoordinateSplit i s d p epsilon f) + +theorem first_eval_eq (j : Fin R.count) (x y : σ → ℤ) (hxy : x i = y i) : + (R.test false j).eval x = (R.test false j).eval y := by + unfold RationalFilteredNilmanifold.Niltest.eval + rw [R.test_orbit false j, (R.multi false).orbitToOrdinary_eval, + (R.multi false).orbitToOrdinary_eval] + apply congrArg (R.test false j).observable + apply congrArg QuotientGroup.mk + apply (R.multi false).filtration.realification.polynomialOrbitEval_eq_on_active_coordinates + intro k hk + have hki : k = i := by + by_contra hn + exact hk (by simp [coordinateSplitBound, hn]) + subst k + exact hxy + +noncomputable def firstFactor (j : Fin R.count) (n : ℤ) : ℂ := + (R.test false j).eval (fun _ => n) + +theorem first_eval_firstFactor (j : Fin R.count) (x : σ → ℤ) : + (R.test false j).eval x = R.firstFactor j (x i) := + R.first_eval_eq j x (fun _ => x i) rfl + +theorem firstFactor_norm (j : Fin R.count) (n : ℤ) : ‖R.firstFactor j n‖ ≤ 1 := + ((R.test false j).norm_eval_le _).trans + (show ((R.test false j).normBound : ℝ) ≤ 1 from R.test_norm false j) + +end Erdos3.NativeCoordinateSplit + +end + +section + +namespace Erdos3.NativeCoordinateSplit + +open Module RationalFilteredNilmanifold.MultidegreeStructure +open scoped TensorProduct BigOperators + +attribute [local instance] NativeCoordinateSplit.lie NativeCoordinateSplit.algebra + NativeCoordinateSplit.topology NativeCoordinateSplit.topologicalAdd + NativeCoordinateSplit.continuousSMul NativeCoordinateSplit.hausdorff + +theorem exists_second_expansion_budget (σ : Type) [Fintype σ] [DecidableEq σ] [Nonempty σ] + (s : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {i : σ} {d : ℕ} {p epsilon : ℝ} {f : (σ → ℤ) → ℂ} + (R : NativeCoordinateSplit i s d p epsilon f) (j : Fin R.count) (b : σ → ℤ), + ∃ E : NativeIntegerExpansion (fun _ : Unit => 1) (s - 1) ((p + C) ^ C) + (fun x => (R.test true j).eval (Function.update b i (x ()))), E.count = 1 := by + obtain ⟨C, hC, hfreeze⟩ := exists_controlled_frozen_niltest (∑ _ : σ, s) + refine ⟨C, hC, ?_⟩ + intro i d p epsilon f R j b + classical + let S : Finset σ := {i} + have hp : 0 ≤ p := (Nat.cast_nonneg (R.dim true)).trans (R.complexity true).1.1 + have hlip : ((R.test true j).lipBound : ℝ) ≤ Real.exp p := by + have hb := (R.test true j).observable_budget (R.test_complexity true j) + have hn := (R.test true j).normBound.coe_nonneg + linarith + have hub : ∀ x, ‖(R.test true j).observable x‖ ≤ (1 : ℝ) := fun x => + ((R.test true j).norm_le x).trans + (show ((R.test true j).normBound : ℝ) ≤ 1 from R.test_norm true j) + obtain ⟨E, _, _, hE⟩ := hfreeze (R.model true) (R.multi true) S b + (R.orbit true) (R.test true j).observable (R.test true j).lipBound 1 + (R.test true j).lipschitz hub (R.complexity true) hlip + (by simpa only [NNReal.coe_one] using Real.one_le_exp hp) + let K := (R.multi true).filtration.weightedSubalgebra (retainedCoordinateWeight S) + let := moduleTopology ℝ (ℝ ⊗[ℚ] K) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] K) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] K) := realification_moduleTopology_t2 E.basis + obtain ⟨T, _, hT, _, hTeval⟩ := hE + let U := T.affinePullback (fun _ (_ : Unit) => (1 : ℤ)) 0 + have hU : U.ComplexityLE ((p + C) ^ C) := hT + have hval (x : Unit → ℤ) : U.eval x = (R.test true j).eval (Function.update b i (x ())) := by + rw [RationalFilteredNilmanifold.Niltest.eval_affinePullback, hTeval] + unfold RationalFilteredNilmanifold.Niltest.eval + rw [R.test_orbit true j, (R.multi true).orbitToOrdinary_eval] + congr 2 + apply congrArg (fun z => (R.multi true).filtration.realification.polynomialOrbitEval z + (R.orbit true)) + funext k + by_cases hk : k = i + · subst k + simp [S, freezeCoordinates, integerAffineMap] + · simp [S, freezeCoordinates, hk] + have hdegree : multidegreeWeight (retainedCoordinateWeight S) (coordinateSplitBound s i true) = + s - 1 := by + rw [retainedCoordinate_degree] + simp [S, coordinateSplitBound] + have hresult : ∃ Q : NativeIntegerExpansion (fun _ : Unit => 1) + (multidegreeWeight (retainedCoordinateWeight S) (coordinateSplitBound s i true)) + ((p + C) ^ C) (fun x => (R.test true j).eval (Function.update b i (x ()))), Q.count = 1 := + ⟨NativeIntegerExpansion.ofTest U hU (fun x => (hval x).symm), rfl⟩ + exact hdegree ▸ hresult + +end Erdos3.NativeCoordinateSplit + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeCorrelationCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCorrelationCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e6ebc36851b0ec2c7531e2bc408f8650969f43c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeCorrelationCoordinates.lean @@ -0,0 +1,63 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeCrossFactorization + +namespace OAI + +section + +namespace Erdos3.NativeVectorCorrelation + +open scoped TensorProduct BigOperators + +attribute [local instance] lie algebra topology topologicalAdd continuousSMul hausdorff + +noncomputable def mapCoordinates {I J : Type*} {degree N : ℕ} [NeZero N] {p : ℝ} + {f : I → ZMod N → ℂ} (W : NativeVectorCorrelation degree N p f) + (g : J → ZMod N → ℂ) (e : I → J) (he : ∀ i x, g (e i) x = f i x) : + NativeVectorCorrelation degree N p g := + { W with coordinate := e W.coordinate + correlation := by simpa only [he] using W.correlation } + +noncomputable def scaleSignal {I : Type*} {degree N : ℕ} [NeZero N] {p q : ℝ} + {f : I → ZMod N → ℂ} (W : NativeVectorCorrelation degree N p f) + (c : ℂ) (hq : 0 ≤ q) (hc : Real.exp (-q) ≤ ‖c‖) : + NativeVectorCorrelation degree N (p + q) (fun i x => c * f i x) := + { W with + complexity := W.complexity.mono (le_add_of_nonneg_right hq) + correlation := by + have he : (𝔼 x, (c * f W.coordinate x) * star (W.test.evalCyclic N (fun _ => x))) = + c * (𝔼 x, f W.coordinate x * star (W.test.evalCyclic N (fun _ => x))) := by + simp only [mul_assoc, Finset.mul_expect] + rw [he, norm_mul, show -(p + q) = -q + -p by ring, Real.exp_add] + exact mul_le_mul hc W.correlation (Real.exp_nonneg _) (norm_nonneg _) } + +theorem exists_half_signal {I : Type*} {degree N : ℕ} [NeZero N] {p : ℝ} + {f : I → ZMod N → ℂ} (W : NativeVectorCorrelation degree N p f) : + Nonempty (NativeVectorCorrelation degree N (p + 1) (fun i x => f i x / 2)) := by + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hc : Real.exp (-1) ≤ ‖(1 / 2 : ℂ)‖ := by + norm_num only [norm_div, norm_one, Complex.norm_ofNat] + rw [Real.exp_neg, one_div] + exact (inv_le_inv₀ (Real.exp_pos 1) (by norm_num : (0 : ℝ) < 2)).mpr htwo + have h := W.scaleSignal (1 / 2) (by norm_num : (0 : ℝ) ≤ 1) hc + refine ⟨h.mapCoordinates _ id ?_⟩ + intro i x + simp only [id_eq, div_eq_mul_inv, one_mul, mul_comm] + +theorem exists_independent_product_correlation {A I J K : Type*} + {degree N : ℕ} [NeZero N] {p : ℝ} + (f : ZMod N → ℂ) (v : A → ZMod N → ℂ) (g : J → ZMod N → ℂ) + (a : I → ZMod N → ℂ) (b : K → ZMod N → ℂ) (j : K → J) + (W : NativeVectorCorrelation degree N p (fun z : A × (I × K) => fun x => + f x * star (v z.1 x) * star (g (j z.2.2) x) * star (a z.2.1 x) * star (b z.2.2 x))) : + Nonempty (NativeVectorCorrelation degree N p (fun z : (A × J) × (I × K) => fun x => + f x * star (v z.1.1 x * g z.1.2 x) * star (a z.2.1 x * b z.2.2 x))) := by + refine ⟨W.mapCoordinates _ (fun z => ((z.1, j z.2.2), z.2)) ?_⟩ + intro z x + simp only [star_mul] + ring + +end Erdos3.NativeVectorCorrelation + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeDilationObservableMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeDilationObservableMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d23e6ed82f3491b189b5542d0e8924a79a43bed --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeDilationObservableMetric.lean @@ -0,0 +1,69 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeDilationObservable + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem lipschitz_signed_tensor_cross_product {X : Type*} [PseudoMetricSpace X] + (m : ℤ) (f₀ : X → ℂ) (f : Fin m.natAbs → X → ℂ) {K : ℝ≥0} + (hf₀ : LipschitzWith K f₀) (hf : ∀ j, LipschitzWith K (f j)) + (h₀ : ∀ x, ‖f₀ x‖ ≤ 1) (hbound : ∀ j x, ‖f j x‖ ≤ 1) : + LipschitzWith ((m.natAbs + 1 : ℝ≥0) * K) + (fun x => f₀ x * star (signedTensorProduct m (fun j => f j x))) := by + have h := lipschitz_mul_star_of_bounds f₀ (fun x => signedTensorProduct m (fun j => f j x)) + (Bf := 1) (Bg := 1) hf₀ (signedTensorProduct_lipschitz m f hf hbound) + h₀ (fun x => signedTensorProduct_norm_le m _ (fun j => hbound j x)) + convert h using 1 + ring + +namespace RationalFilteredNilmanifold.MultidegreeStructure + +open scoped TensorProduct + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d r : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (M : D.MultidegreeStructure bound) + +theorem dilationObservable_lipschitz (q : ℚ) + (E : RationalFilteredNilmanifold (M.filtration.ordinary.dilationPairSubalgebra q) s r) + (hEL : E.lattice = M.dilationPairLattice q) + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.ordinary.dilationPairSubalgebra q)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.ordinary.dilationPairSubalgebra q)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.ordinary.dilationPairSubalgebra q)] + [T2Space (ℝ ⊗[ℚ] M.filtration.ordinary.dilationPairSubalgebra q)] + {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) (hE : E.GeometryComplexityLE p) + (hheight : ∀ j a k, rationalLogHeight + (D.basis.repr (M.filtration.ordinary.dilationPairProjection q j (E.basis a)) k) ≤ p) + (m : ℤ) (ε : D.RealGroup) (u₀ : D.Space → ℂ) (u : Fin m.natAbs → D.Space → ℂ) + (K A : ℝ≥0) (h₀ : ∀ x, ‖u₀ x‖ ≤ 1) (hu : ∀ j x, ‖u j x‖ ≤ 1) + (hLip₀ : letI := D.metricSpace; LipschitzWith K u₀) + (hLip : letI := D.metricSpace; ∀ j, LipschitzWith K (u j)) + (hε : letI := D.metricSpace; LipschitzWith A (fun x : D.Space => ε • x)) : + letI := E.metricSpace + LipschitzWith ((m.natAbs + 1 : ℝ≥0) * + (K * (A * ⟨Real.exp ((p + 3) ^ 2), (Real.exp_pos _).le⟩))) + (M.dilationObservable q E hEL m ε u₀ u) := by + let := E.metricSpace + let := D.metricSpace + apply lipschitz_signed_tensor_cross_product m + (fun x => u₀ (ε • M.dilationSpaceProjection q E hEL 0 x)) + (fun j x => u j (ε • M.dilationSpaceProjection q E hEL 1 x)) + · exact hLip₀.comp (hε.comp (M.dilationSpaceProjection_lipschitz q E hEL 0 hp hD hE (hheight 0))) + · exact fun j => (hLip j).comp + (hε.comp (M.dilationSpaceProjection_lipschitz q E hEL 1 hp hD hE (hheight 1))) + · exact fun x => h₀ _ + · exact fun j x => hu j _ + +end RationalFilteredNilmanifold.MultidegreeStructure + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeEquivalenceCoordinateMaps.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeEquivalenceCoordinateMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bbf488e5b40763f714917438fc9f48c83355e60 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeEquivalenceCoordinateMaps.lean @@ -0,0 +1,29 @@ +import OAI.Combinatorics.Progressions.Lattices.NativeIntegerAffinePullbackHom + +namespace OAI + +section + +namespace Erdos3.NativeIntegerVectorEquivalence + +theorem of_coordinate_maps {σ I J K L : Type*} [Fintype I] [Fintype J] [Fintype K] [Fintype L] + {s : ℕ} {p r : ℝ} {f : I → (σ → ℤ) → ℂ} {g : J → (σ → ℤ) → ℂ} + (E : NativeIntegerVectorEquivalence s p f g) + (f' : K → (σ → ℤ) → ℂ) (g' : L → (σ → ℤ) → ℂ) + (a : K → I) (b : L → J) + (hf : ∀ k x, f' k x = f (a k) x) (hg : ∀ l x, g' l x = g (b l) x) + (hK : (Fintype.card K : ℝ) ≤ Real.exp r) (hL : (Fintype.card L : ℝ) ≤ Real.exp r) + (hpr : p ≤ r) : NativeIntegerVectorEquivalence s r f' g' := by + refine ⟨hK, hL, fun k l => ?_⟩ + obtain ⟨R⟩ := E.expansion (a k) (b l) + have heq : (fun x => f (a k) x * star (g (b l) x)) = + (fun x => f' k x * star (g' l x)) := by + funext x + rw [hf, hg] + exact ⟨heq ▸ R.mono hpr⟩ + +end Erdos3.NativeIntegerVectorEquivalence + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeFiniteSumCoordinate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeFiniteSumCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe5e315285523b2a2a57ba69478b4069e20b4056 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeFiniteSumCoordinate.lean @@ -0,0 +1,139 @@ +import OAI.Combinatorics.Progressions.Lattices.NativeIntegerSelfEquivalence + +namespace OAI + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators + +theorem exists_finite_sum_coordinate_equivalence {σ : Type*} + [Fintype σ] [DecidableEq σ] [Nonempty σ] (n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} (W : NativeMultidegreeNilcharacter (fun _ : σ => 1) p) + (i : σ), NativeIntegerVectorEquivalence (Fintype.card σ - 1) ((p + C) ^ C) + (fun k (x : (σ ⊕ Fin (n + 1)) → ℤ) => W.eval k (finiteSumCoordinateInput i x)) + (fun a : Fin (n + 1) → Fin W.outputDim => fun x => + ∏ j, W.eval (a j) (finiteTermCoordinateInput i j x)) := by + induction n with + | zero => + obtain ⟨C, hC, hself⟩ := exists_integer_self_equivalence (σ := σ) + refine ⟨C, hC, ?_⟩ + intro p W i + have E := (hself W).linearPullbackHom (finiteTermCoordinateHom i (0 : Fin 1)) + apply E.of_coordinate_maps _ _ id (fun a => a 0) _ _ E.left_dimension _ le_rfl + · intro k x + rw [finiteSumCoordinateInput_one] + rfl + · intro a x + rw [Fin.prod_univ_one] + rfl + · simpa only [Fintype.card_fun, Fintype.card_fin, Nat.zero_add, pow_one] using E.right_dimension + | succ n ih => + obtain ⟨A, _, hprevious⟩ := ih + obtain ⟨B, _, hadd⟩ := exists_multilinearity_equivalence (σ := σ) + obtain ⟨D, _, hself⟩ := exists_integer_self_equivalence (σ := σ) + obtain ⟨F, _, htensor⟩ := NativeIntegerVectorEquivalence.exists_tensor_budget + obtain ⟨G, _, htrans⟩ := NativeIntegerVectorEquivalence.exists_trans_budget + let X : Polynomial ℕ := Polynomial.X + let R := (X + Polynomial.C A) ^ A + (X + Polynomial.C B) ^ B + + (X + Polynomial.C D) ^ D + let Q := (R + (R + Polynomial.C F) ^ F + Polynomial.C G) ^ G + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (Q + Polynomial.C (n + 2) * X + X) + refine ⟨C, hC, ?_⟩ + intro p W i + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let r := (p + A) ^ A + (p + B) ^ B + (p + D) ^ D + let t := (r + F) ^ F + let q := (r + t + G) ^ G + have hA : 0 ≤ (p + A) ^ A := by positivity + have hB : 0 ≤ (p + B) ^ B := by positivity + have hD : 0 ≤ (p + D) ^ D := by positivity + have hr : 0 ≤ r := by dsimp [r]; linarith + have ht : 0 ≤ t := by dsimp [t]; positivity + have hq : 0 ≤ q := by dsimp [q]; positivity + have hAr : (p + A) ^ A ≤ r := by dsimp [r]; linarith + have hBr : (p + B) ^ B ≤ r := by dsimp [r]; linarith + have hDr : (p + D) ^ D ≤ r := by dsimp [r]; linarith + have hsum : q + (n + 2 : ℕ) * p + p ≤ (p + C) ^ C := by + simpa [X, R, Q, r, t, q, Polynomial.eval₂_pow] using hbudget p hp + have hnp : 0 ≤ (n + 2 : ℕ) * p := mul_nonneg (Nat.cast_nonneg _) hp + have hqC : q ≤ (p + C) ^ C := by linarith + have hpC : p ≤ (p + C) ^ C := by linarith + have hnC : (n + 2 : ℕ) * p ≤ (p + C) ^ C := by linarith + let tailMap : (σ ⊕ Fin (n + 1)) → (((σ ⊕ Fin (n + 2)) → ℤ) →+ ℤ) := fun j => + match j with + | Sum.inl j => + { toFun := fun x => x (Sum.inl j) + map_zero' := rfl + map_add' := fun _ _ => rfl } + | Sum.inr a => + { toFun := fun x => x (Sum.inr a.succ) + map_zero' := rfl + map_add' := fun _ _ => rfl } + let addMap : Option σ → (((σ ⊕ Fin (n + 2)) → ℤ) →+ ℤ) := fun j => + match j with + | none => + { toFun := fun x => ∑ a : Fin (n + 1), x (Sum.inr a.succ) + map_zero' := by simp + map_add' := fun x y => by + simp only [Pi.add_apply, Finset.sum_add_distrib] } + | some j => finiteTermCoordinateHom i 0 j + have hleft (x : (σ ⊕ Fin (n + 2)) → ℤ) : + coordinateAdditionInputs i (fun j => addMap j x) 0 = finiteSumCoordinateInput i x := by + rw [coordinateAdditionInputs_sum] + change Function.update (finiteTermCoordinateInput i 0 x) i + (finiteTermCoordinateInput i 0 x i + ∑ a : Fin (n + 1), x (Sum.inr a.succ)) = _ + simp only [finiteTermCoordinateInput, finiteSumCoordinateInput, + Function.update_self, Function.update_idem] + congr 1 + exact (Fin.sum_univ_succ (fun a : Fin (n + 2) => x (Sum.inr a))).symm + have hfirst (x : (σ ⊕ Fin (n + 2)) → ℤ) : + coordinateAdditionInputs i (fun j => addMap j x) 1 = finiteTermCoordinateInput i 0 x := rfl + have htail (x : (σ ⊕ Fin (n + 2)) → ℤ) : + coordinateAdditionInputs i (fun j => addMap j x) 2 = + finiteSumCoordinateInput i (fun j => tailMap j x) := by + rw [coordinateAdditionInputs_right] + change Function.update (finiteTermCoordinateInput i 0 x) i + (∑ a : Fin (n + 1), x (Sum.inr a.succ)) = _ + simp only [finiteTermCoordinateInput, finiteSumCoordinateInput, Function.update_idem] + rfl + have E₀ : NativeIntegerVectorEquivalence (Fintype.card σ - 1) r + (fun k x => W.eval k (finiteSumCoordinateInput i x)) + (fun a : Fin W.outputDim × Fin W.outputDim => fun x => + W.eval a.1 (finiteTermCoordinateInput i 0 x) * + W.eval a.2 (finiteSumCoordinateInput i (fun j => tailMap j x))) := by + have E := ((hadd W i).linearPullbackHom addMap).mono hBr + simpa only [coordinateSumVector, coordinateTensorVector, hleft, hfirst, htail] using E + have Efirst := ((hself W).linearPullbackHom + (finiteTermCoordinateHom i (0 : Fin (n + 2)))).mono hDr + have Etail := ((hprevious W i).linearPullbackHom tailMap).mono hAr + have E₂ := htensor hr Efirst Etail + have hunit (x : (σ ⊕ Fin (n + 2)) → ℤ) : + ∑ a : Fin W.outputDim × Fin W.outputDim, + ‖W.eval a.1 (finiteTermCoordinateInput i 0 x) * + W.eval a.2 (finiteSumCoordinateInput i (fun j => tailMap j x))‖ ^ 2 = 1 := by + simp only [Fintype.sum_prod_type, norm_mul, mul_pow, ← Finset.mul_sum, + W.unit_eval, mul_one] + have H := htrans (add_nonneg hr ht) (E₀.mono (le_add_of_nonneg_right ht)) + (E₂.mono (le_add_of_nonneg_left hr)) hunit + have hdim : (Fintype.card (Fin (n + 2) → Fin W.outputDim) : ℝ) ≤ + Real.exp ((p + C) ^ C) := by + simp only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] + calc + _ ≤ Real.exp p ^ (n + 2) := pow_le_pow_left₀ (Nat.cast_nonneg _) W.output_bound _ + _ = Real.exp ((n + 2 : ℕ) * p) := (Real.exp_nat_mul p (n + 2)).symm + _ ≤ _ := Real.exp_le_exp.mpr hnC + apply H.of_coordinate_maps _ _ id (fun a => (a 0, fun j => a j.succ)) + (fun _ _ => rfl) _ _ hdim hqC + · intro a x + rw [Fin.prod_univ_succ] + rfl + · simpa only [Fintype.card_fin] using W.output_bound.trans (Real.exp_le_exp.mpr hpC) + +end Erdos3.NativeMultidegreeNilcharacter + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeIntervalCoordinate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeIntervalCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a3c17f3207abda6dbdcdabdcb2aa5841051da52 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeIntervalCoordinate.lean @@ -0,0 +1,35 @@ +import OAI.Combinatorics.Progressions.Fourier.BohrNiltestBudget + +namespace OAI + +section + +namespace Erdos3.RationalTorus + +open scoped TensorProduct NNReal + +noncomputable def intervalOrbit (N : ℕ) : + (nilmanifold 1).filtration.realification.PolynomialOrbit (fun _ : Unit => 1) := + affineOrbit 1 (fun _ => 0) (fun _ : Unit => fun _ => 1 / (N : ℝ)) + +theorem intervalOrbit_phase (N : ℕ) [NeZero N] (x : ZMod N) : + phaseProjection 1 ((nilmanifold 1).cyclicOrbitPoint (intervalOrbit N) N (fun _ : Unit => x)) 0 = + ZMod.toAddCircle x := by + unfold RationalFilteredNilmanifold.cyclicOrbitPoint intervalOrbit + rw [phaseProjection_mk, affineOrbit_phases] + simp [ZMod.toAddCircle_apply, div_eq_mul_inv] + +theorem intervalCoordinate_lipschitz : + letI := (nilmanifold 1).metricSpace + LipschitzWith 1 (fun z => phaseProjection 1 z 0) := by + let := (nilmanifold 1).metricSpace + apply LipschitzWith.of_dist_le_mul + intro x y + exact (dist_le_pi_dist (phaseProjection 1 x) (phaseProjection 1 y) 0).trans + ((phaseProjection_lipschitz 1).dist_le_mul x y) + +end Erdos3.RationalTorus + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeMixedCoordinateSlices.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeMixedCoordinateSlices.lean new file mode 100644 index 0000000000000000000000000000000000000000..5eb0d9a62a90a1a07c8b638aa53952926134ba79 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeMixedCoordinateSlices.lean @@ -0,0 +1,178 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeMixedReflectionBridge + +namespace OAI + +section + +namespace Erdos3 + +def mixedInputCoordinate (n : ℕ) : MixedReplicatedIndex (n + 1) → Fin (n + 2) := + mixedSlotInput 0 1 (fun j => j.succ.succ) + +def mixedCoordinateIndex (n : ℕ) : Fin (n + 2) → MixedReplicatedIndex (n + 1) := + Fin.cases (mixedHead (n + 1)) (fun j => mixedReplica j) + +theorem mixedInputCoordinate_index (n : ℕ) (k : Fin (n + 2)) : + mixedInputCoordinate n (mixedCoordinateIndex n k) = k := by + refine Fin.cases ?_ (fun k => ?_) k + · rfl + · refine Fin.cases ?_ (fun k => ?_) k <;> rfl + +theorem mixedInputCoordinate_eval (n : ℕ) {α : Type*} (x : Fin (n + 2) → α) : + (fun j => x (mixedInputCoordinate n j)) = + mixedSlotInput (x 0) (x 1) (fun j => x j.succ.succ) := by + funext j + rcases mixedReplicated_cases j with rfl | ⟨k, rfl⟩ + · rfl + · refine Fin.cases ?_ (fun k => ?_) k <;> rfl + +theorem mixedExchangeCoordinate_involutive (n : ℕ) : + Function.Involutive (mixedExchangeCoordinate n) := by + intro k + refine Fin.cases ?_ (fun k => ?_) k + · rfl + · refine Fin.cases ?_ (fun k => ?_) k <;> rfl + +theorem mixedExchangeCoordinate_update (n : ℕ) {α : Type*} + (x : Fin (n + 2) → α) (d : Fin (n + 2)) (c : α) : + Function.update (fun k => x (mixedExchangeCoordinate n k)) (mixedExchangeCoordinate n d) c = + fun k => (Function.update x d c) (mixedExchangeCoordinate n k) := by + funext k + have hi (k : Fin (n + 2)) : + mixedExchangeCoordinate n (mixedExchangeCoordinate n k) = k := + mixedExchangeCoordinate_involutive n k + by_cases h : k = mixedExchangeCoordinate n d + · subst k + simp only [Function.update_self, hi] + · have hk : mixedExchangeCoordinate n k ≠ d := by + intro heq + apply h + have h' := congrArg (mixedExchangeCoordinate n) heq + simpa only [hi] using h' + simp only [Function.update_of_ne h, Function.update_of_ne hk] + +end Erdos3 + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open Module +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_mixed_frozen_affine_expansion (n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : (MixedReplicatedIndex (n + 1)) => 1) p) + (d : (MixedReplicatedIndex (n + 1))) (A : (MixedReplicatedIndex (n + 1)) → Fin (n + 2) → ℤ) + (b : (MixedReplicatedIndex (n + 1)) → ℤ) (out : Fin W.outputDim), + (∀ k, A d k = 0) → + Nonempty (NativeIntegerExpansion (fun _ : Fin (n + 2) => 1) (n + 1) ((p + C) ^ C) + (fun x => W.eval out (integerAffineMap A b x))) := by + obtain ⟨C, hC, hfreeze⟩ := exists_freezing_niltest (fun _ : (MixedReplicatedIndex (n + 1)) => 1) + refine ⟨C, hC, ?_⟩ + intro p W d A b out hA + classical + let S : Finset (MixedReplicatedIndex (n + 1)) := Finset.univ.erase d + have hcard : Fintype.card (MixedReplicatedIndex (n + 1)) = n + 2 := + replicatedMixed_card (n + 1) + have hdegree : (∑ j ∈ S, (1 : ℕ)) = n + 1 := by simp [S, hcard] + obtain ⟨t, dim, ht, _hdim, D, hD⟩ := hfreeze W S b out + have ht3 : t = n + 1 := ht.trans hdegree + rcases ht3 with rfl + let K := W.multi.filtration.weightedSubalgebra (retainedCoordinateWeight S) + let := moduleTopology ℝ (ℝ ⊗[ℚ] K) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] K) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] K) := realification_moduleTopology_t2 D.basis + obtain ⟨T, _hTnorm, hT, _hzero, heval⟩ := hD + let U := T.affinePullback (fun j k => A j.val k) (fun j => b j.val) + have hU : U.ComplexityLE ((p + C) ^ C) := hT + have hvalue (x : Fin (n + 2) → ℤ) : U.eval x = W.eval out (integerAffineMap A b x) := by + rw [RationalFilteredNilmanifold.Niltest.eval_affinePullback, heval] + apply congrArg (W.eval out) + funext j + by_cases hj : j ∈ S + · simp [freezeCoordinates, hj, integerAffineMap] + · have hjd : j = d := by simpa [S] using hj + subst j + simp [freezeCoordinates, hj, integerAffineMap, hA] + let E : NativeIntegerExpansion (fun _ : Fin (n + 2) => 1) (n + 1) ((p + C) ^ C) U.eval := + NativeIntegerExpansion.ofTest U hU (fun _ => rfl) + have heq : U.eval = (fun x => W.eval out (integerAffineMap A b x)) := funext hvalue + exact ⟨heq ▸ E⟩ + +theorem exists_mixed_scalar_coordinate_slice (n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) + (out : Fin W.outputDim) (d : Fin (n + 2)) (c : ℤ), + Nonempty (NativeIntegerExpansion (fun _ : Fin (n + 2) => 1) (n + 1) ((p + C) ^ C) + (fun x => let z := Function.update x d c + W.eval out (mixedSlotInput (z 0) (z 1) (fun l => z l.succ.succ)))) := by + obtain ⟨C, hC, hfreeze⟩ := exists_mixed_frozen_affine_expansion n + refine ⟨C, hC, ?_⟩ + intro p W out d c + let coord := mixedInputCoordinate n + let index := mixedCoordinateIndex n + have hindex (k : Fin (n + 2)) : coord (index k) = k := mixedInputCoordinate_index n k + let A : MixedReplicatedIndex (n + 1) → Fin (n + 2) → ℤ := fun j k => + if coord j = d then 0 else if k = coord j then 1 else 0 + let b : MixedReplicatedIndex (n + 1) → ℤ := fun j => if coord j = d then c else 0 + obtain ⟨E⟩ := hfreeze W (index d) A b out (by intro k; simp [A, hindex]) + have hmap (x : Fin (n + 2) → ℤ) (j : MixedReplicatedIndex (n + 1)) : + integerAffineMap A b x j = (Function.update x d c) (coord j) := by + by_cases hj : coord j = d <;> simp [integerAffineMap, A, b, hj, ite_mul] + have heq (x : Fin (n + 2) → ℤ) : integerAffineMap A b x = + mixedSlotInput ((Function.update x d c) 0) ((Function.update x d c) 1) + (fun l => (Function.update x d c) l.succ.succ) := by + funext j + rw [hmap] + exact congrFun (mixedInputCoordinate_eval n (Function.update x d c)) j + exact ⟨by simpa only [heq] using E⟩ + +theorem exists_mixed_kernel_coordinate_slice (n : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : MixedReplicatedIndex (n + 1) => 1) p) + (i j : Fin W.outputDim) (d : Fin (n + 2)) (c : ℤ), + Nonempty (NativeIntegerExpansion (fun _ : Fin (n + 2) => 1) (n + 1) ((p + C) ^ C) + (fun x => W.mixedAntisymmetric i j (Function.update x d c))) := by + obtain ⟨A, _, hscalar⟩ := exists_mixed_scalar_coordinate_slice n + obtain ⟨B, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let Q := (X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((Q + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p W i j d c + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let q := (p + A) ^ A + have hq : 0 ≤ q := by dsimp only [q]; positivity + let e := mixedExchangeCoordinate n + have he0 : e 0 = 1 := rfl + have he1 : e 1 = 0 := rfl + have hetail (l : Fin n) : e l.succ.succ = l.succ.succ := rfl + have hswap (x : Fin (n + 2) → ℤ) : Function.update (fun k => x (e k)) (e d) c = + fun k => (Function.update x d c) (e k) := mixedExchangeCoordinate_update n x d c + obtain ⟨L⟩ := hscalar W i d c + obtain ⟨R⟩ := hscalar W j (e d) c + have R' : NativeIntegerExpansion (fun _ : Fin (n + 2) => 1) (n + 1) q + (fun x => let z := Function.update x d c + W.eval j (mixedSlotInput (z 1) (z 0) (fun l => z l.succ.succ))) := by + have E : NativeIntegerExpansion (fun _ : Fin (n + 2) => 1) (n + 1) q + (fun x => let z := Function.update (fun k => x (e k)) (e d) c + W.eval j (mixedSlotInput (z 0) (z 1) (fun l => z l.succ.succ))) := + R.linearPullbackHom (fun k => ⟨⟨fun x => x (e k), rfl⟩, fun _ _ => rfl⟩) + simpa only [hswap, he0, he1, hetail] using E + obtain ⟨F⟩ := hmul hq L R'.conjugate + have hcost : (q + B) ^ B ≤ (p + C) ^ C := by + simpa [X, Q, q, Polynomial.eval₂_pow] using hbudget p hp + exact ⟨F.mono hcost⟩ + +end Erdos3.NativeMultidegreeNilcharacter + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativePairChartSymbol.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativePairChartSymbol.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d2b94a98ef7664301e2b642238e1af8bc5d233f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativePairChartSymbol.lean @@ -0,0 +1,134 @@ +import OAI.Combinatorics.Progressions.Lattices.IntegerFrozenChart + +namespace OAI + +universe universeLevel + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module VectorPolynomial NilpotentLieFiltration +open scoped TensorProduct BigOperators + +attribute [local instance_reducible] BoolLieFamily + +variable {L M : Type universeLevel} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + {s d e : ℕ} (D : RationalFilteredNilmanifold L s d) + (E : RationalFilteredNilmanifold M s e) + {σ τ ι : Type*} {w : σ → ℕ} {v : τ → ℕ} + +attribute [local irreducible] realChartSubstitute polynomialOrbitRealChart + weightedAdaptedRealChartHom realPolynomialSymbolHom realSymbolHomogeneousPullbackHom + +theorem pairOrbit_polynomialOrbitRealChart_log + (p : D.filtration.realification.PolynomialOrbit w) + (q : E.filtration.realification.PolynomialOrbit w) + (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) : + (pairOrbit D E (D.filtration.polynomialOrbitRealChart w v β hβ p) + (E.filtration.polynomialOrbitRealChart w v β hβ q)).log = + realChartSubstitute β (pairOrbit D E p q).log := by + simp only [pairOrbit, piRealOrbit, PolynomialOrbit.log, polynomialOrbitOfLog, map_sum] + apply Finset.sum_congr rfl + intro i _ + cases i + · change VectorPolynomial.map + ((realProductSingle (L := BoolLieFamily L M) false).restrictScalars ℚ) + (E.filtration.polynomialOrbitRealChart w v β hβ q).log = + realChartSubstitute β (VectorPolynomial.map + ((realProductSingle (L := BoolLieFamily L M) false).restrictScalars ℚ) q.log) + rw [polynomialOrbitRealChart_log] + exact (realChartSubstitute_map β + (realProductSingle (L := BoolLieFamily L M) false) q.log).symm + · change VectorPolynomial.map + ((realProductSingle (L := BoolLieFamily L M) true).restrictScalars ℚ) + (D.filtration.polynomialOrbitRealChart w v β hβ p).log = + realChartSubstitute β (VectorPolynomial.map + ((realProductSingle (L := BoolLieFamily L M) true).restrictScalars ℚ) p.log) + rw [polynomialOrbitRealChart_log] + exact (realChartSubstitute_map β + (realProductSingle (L := BoolLieFamily L M) true) p.log).symm + +attribute [local irreducible] pairOrbit + +theorem pairOrbitSymbol_polynomialOrbitRealChart + (p : D.filtration.realification.PolynomialOrbit w) + (q : E.filtration.realification.PolynomialOrbit w) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) + (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) : + pairOrbitSymbol D E (D.filtration.polynomialOrbitRealChart w v β hβ p) + (E.filtration.polynomialOrbitRealChart w v β hβ q) b ω hF = + (pi (pairModels D E)).filtration.realPolynomialSymbolHom b ω hF v + ((pi (pairModels D E)).filtration.weightedAdaptedRealChartHom w v β hβ + ⟨⟨(pairOrbit D E p q).log, (pairOrbit D E p q).property⟩⟩) := by + unfold pairOrbitSymbol + apply congrArg ((pi (pairModels D E)).filtration.realPolynomialSymbolHom b ω hF v) + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + exact (pairOrbit_polynomialOrbitRealChart_log D E p q β hβ).trans + ((pi (pairModels D E)).filtration.weightedAdaptedRealChartHom_coord + w v β hβ ⟨⟨(pairOrbit D E p q).log, (pairOrbit D E p q).property⟩⟩).symm + +theorem pairOrbitSymbol_chart_eq_of_homogeneous_eq + (p : D.filtration.realification.PolynomialOrbit w) + (q : E.filtration.realification.PolynomialOrbit w) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) + (β : σ → MvPolynomial τ ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE v (w i)) + (β' : σ → MvPolynomial τ ℝ) + (hβ' : ∀ i, β' i ∈ weightedSupportLE v (w i)) + (htop : (fun i => MvPolynomial.weightedHomogeneousComponent v (w i) (β i)) = + (fun i => MvPolynomial.weightedHomogeneousComponent v (w i) (β' i))) : + pairOrbitSymbol D E (D.filtration.polynomialOrbitRealChart w v β hβ p) + (E.filtration.polynomialOrbitRealChart w v β hβ q) b ω hF = + pairOrbitSymbol D E (D.filtration.polynomialOrbitRealChart w v β' hβ' p) + (E.filtration.polynomialOrbitRealChart w v β' hβ' q) b ω hF := by + rw [pairOrbitSymbol_polynomialOrbitRealChart, pairOrbitSymbol_polynomialOrbitRealChart, + realPolynomialSymbolHom_weightedAdaptedRealChart, + realPolynomialSymbolHom_weightedAdaptedRealChart] + congr 1 + congr 1 + +theorem pairOrbitSymbol_frozenCoordinate_independent + (p : D.filtration.realification.PolynomialOrbit (fun _ : σ => 1)) + (q : E.filtration.realification.PolynomialOrbit (fun _ : σ => 1)) + (keep : σ → Prop) (fixed fixed' : {i // ¬keep i} → ℝ) + (b : Basis ι ℚ (PairAlgebra L M)) (ω : ι → ℕ) + (hF : ∀ k, (pi (pairModels D E)).filtration.layer k = + Submodule.span ℚ (b '' {i | k ≤ ω i})) : + pairOrbitSymbol D E + (D.filtration.polynomialOrbitRealChart (fun _ : σ => 1) + (fun _ : {i // keep i} => 1) (frozenCoordinate keep fixed) + (frozenCoordinate_support keep fixed) p) + (E.filtration.polynomialOrbitRealChart (fun _ : σ => 1) + (fun _ : {i // keep i} => 1) (frozenCoordinate keep fixed) + (frozenCoordinate_support keep fixed) q) b ω hF = + pairOrbitSymbol D E + (D.filtration.polynomialOrbitRealChart (fun _ : σ => 1) + (fun _ : {i // keep i} => 1) (frozenCoordinate keep fixed') + (frozenCoordinate_support keep fixed') p) + (E.filtration.polynomialOrbitRealChart (fun _ : σ => 1) + (fun _ : {i // keep i} => 1) (frozenCoordinate keep fixed') + (frozenCoordinate_support keep fixed') q) b ω hF := by + apply pairOrbitSymbol_chart_eq_of_homogeneous_eq D E p q b ω hF + (frozenCoordinate keep fixed) (frozenCoordinate_support keep fixed) + (frozenCoordinate keep fixed') (frozenCoordinate_support keep fixed') + funext i + change MvPolynomial.homogeneousComponent 1 (frozenCoordinate keep fixed i) = + MvPolynomial.homogeneousComponent 1 (frozenCoordinate keep fixed' i) + simpa only [freezePolynomial, MvPolynomial.aeval_X] using + (freezePolynomial_top_independent keep fixed fixed' + (P := MvPolynomial.X i) (d := 1) + (by simp only [MvPolynomial.totalDegree_X, le_refl])) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeProductOrbitMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeProductOrbitMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..0df6caf6bd9498627af62e01067a93883acb506c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeProductOrbitMetric.lean @@ -0,0 +1,303 @@ +import OAI.Combinatorics.Progressions.Estimates.RealProductInclusion +import OAI.Combinatorics.Progressions.Geometry.CoordinatewiseLipschitz + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup +open scoped TensorProduct NNReal BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +noncomputable def productMetricBound (d : ι → ℕ) : ℝ≥0 := + ∑ i, coordinateLipschitzBound (Fintype.card (Σ i, Fin (d i))) (d i) 1 + +variable {L : ι → Type*} [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] + {s : ℕ} {d : ι → ℕ} (D : ∀ i, RationalFilteredNilmanifold (L i) s (d i)) + [∀ i, TopologicalSpace (ℝ ⊗[ℚ] L i)] [∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] L i)] + [∀ i, ContinuousSMul ℝ (ℝ ⊗[ℚ] L i)] [∀ i, T2Space (ℝ ⊗[ℚ] L i)] + [TopologicalSpace (ℝ ⊗[ℚ] (∀ i, L i))] [IsTopologicalAddGroup (ℝ ⊗[ℚ] (∀ i, L i))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (∀ i, L i))] [T2Space (ℝ ⊗[ℚ] (∀ i, L i))] + +theorem productInclusionHom_lipschitz (i : ι) : + letI := rightMetricSpace (hnil := (D i).filtration.realification.lowerCentralSeries_eq_bot) + ((D i).basis.baseChange ℝ) + letI := rightMetricSpace (hnil := (pi D).filtration.realification.lowerCentralSeries_eq_bot) + ((pi D).basis.baseChange ℝ) + LipschitzWith (coordinateLipschitzBound (Fintype.card (Σ i, Fin (d i))) (d i) 1) + (productInclusionHom D i) := by + unfold productInclusionHom + simpa only [Fintype.card_fin, Nat.cast_one] using + (lipschitz_realificationMap (hnil := (D i).filtration.lowerCentralSeries_eq_bot) + (hM := (pi D).filtration.lowerCentralSeries_eq_bot) + (D i).basis (pi D).basis (liePiSingle i) 1 (fun k j => productInclusion_matrix_height D i j k)) + +theorem productSpaceEquiv_symm_coordinate_lipschitz (i : ι) (y : ∀ j, (D j).Space) : + letI := (D i).metricSpace + letI := (pi D).metricSpace + LipschitzWith (coordinateLipschitzBound (Fintype.card (Σ j, Fin (d j))) (d i) 1) + (fun a => (productSpaceEquiv D).symm (Function.update y i a)) := by + let : FiniteDimensional ℝ (ℝ ⊗[ℚ] L i) := ((D i).basis.baseChange ℝ).finiteDimensional_of_finite + let : FiniteDimensional ℝ (ℝ ⊗[ℚ] (∀ j, L j)) := ((pi D).basis.baseChange ℝ).finiteDimensional_of_finite + let := rightMetricSpace (hnil := (D i).filtration.realification.lowerCentralSeries_eq_bot) + ((D i).basis.baseChange ℝ) + let := rightMetricSpace (hnil := (pi D).filtration.realification.lowerCentralSeries_eq_bot) + ((pi D).basis.baseChange ℝ) + let := rightMetricSpace_isIsometricSMul (hnil := (D i).filtration.realification.lowerCentralSeries_eq_bot) + ((D i).basis.baseChange ℝ) + let := rightMetricSpace_isIsometricSMul (hnil := (pi D).filtration.realification.lowerCentralSeries_eq_bot) + ((pi D).basis.baseChange ℝ) + let := (pi D).metricSpace + let g : ∀ j, (D j).RealGroup := fun j => (y j).out + let e := realBCHPiEquiv (fun j => (D j).filtration) + let u : (pi D).RealGroup := e.symm (Function.update g i 1) + have hbase : (fun j => (QuotientGroup.mk (g j) : (D j).Space)) = y := + funext (fun j => Quotient.out_eq (y j)) + have heval (a : (D i).RealGroup) : + (productSpaceEquiv D).symm (Function.update y i (QuotientGroup.mk a)) = + QuotientGroup.mk (productInclusionHom D i a * u) := by + rw [← hbase, productSpaceEquiv_symm_update_mk] + have hup : Function.update g i a = Pi.mulSingle i a * Function.update g i 1 := by + funext j + by_cases hji : j = i + · subst j + simp only [Function.update_self, Pi.mul_apply, Pi.mulSingle_eq_same, mul_one] + · simp only [Function.update_of_ne hji, Pi.mul_apply, Pi.mulSingle_eq_of_ne hji, one_mul] + rw [hup, map_mul, realBCHPiEquiv_symm_single] + have hm : LipschitzWith 1 (QuotientGroup.mk : (pi D).RealGroup → (pi D).Space) := + quotientMetricSpace_lipschitz_mk ((pi D).basis.baseChange ℝ) (pi D).realLattice + (pi D).realLattice_closed_discrete.1 + have hf := hm.comp ((isometry_mul_right u).lipschitzWith.comp (productInclusionHom_lipschitz D i)) + have hf' : LipschitzWith (coordinateLipschitzBound (Fintype.card (Σ j, Fin (d j))) (d i) 1) + (fun a : (D i).RealGroup => (productSpaceEquiv D).symm (Function.update y i (QuotientGroup.mk a))) := by + simpa only [Function.comp_def, one_mul, heval] using hf + exact rightCosetMetricSpace_lipschitz_lift (D i).realLattice (D i).realLattice_closed_discrete.1 _ hf' + +theorem productSpaceEquiv_symm_lipschitz : + letI : ∀ i, MetricSpace (D i).Space := fun i => (D i).metricSpace + letI := (pi D).metricSpace + LipschitzWith (productMetricBound d) (productSpaceEquiv D).symm := by + let : ∀ i, MetricSpace (D i).Space := fun i => (D i).metricSpace + let := (pi D).metricSpace + exact lipschitzWith_of_coordinatewise _ _ (fun i y => productSpaceEquiv_symm_coordinate_lipschitz D i y) + +theorem productSpaceEquiv_lipschitz : + letI : ∀ i, MetricSpace (D i).Space := fun i => (D i).metricSpace + letI := (pi D).metricSpace + LipschitzWith (productMetricBound d) (productSpaceEquiv D) := by + let : ∀ i, MetricSpace (D i).Space := fun i => (D i).metricSpace + let := (pi D).metricSpace + apply LipschitzWith.of_dist_le_mul + intro x y + apply (dist_pi_le_iff (mul_nonneg (productMetricBound d).coe_nonneg dist_nonneg)).mpr + intro i + have hc : coordinateLipschitzBound (d i) (Fintype.card (Σ j, Fin (d j))) 1 ≤ productMetricBound d := by + have heq : coordinateLipschitzBound (d i) (Fintype.card (Σ j, Fin (d j))) 1 = + coordinateLipschitzBound (Fintype.card (Σ j, Fin (d j))) (d i) 1 := by + unfold coordinateLipschitzBound + congr 1 + ring + rw [heq] + unfold productMetricBound + exact Finset.single_le_sum + (f := fun j : ι => coordinateLipschitzBound (Fintype.card (Σ k, Fin (d k))) (d j) 1) + (s := Finset.univ) (fun _ _ => zero_le) (Finset.mem_univ i) + exact ((productProjection_lipschitz D i).dist_le_mul x y).trans + (mul_le_mul_of_nonneg_right (show (coordinateLipschitzBound (d i) (Fintype.card (Σ j, Fin (d j))) 1 : ℝ) ≤ + productMetricBound d from hc) dist_nonneg) + +end Erdos3.RationalFilteredNilmanifold + +namespace Erdos3.RationalFilteredNilmanifold + +open scoped NNReal BigOperators + +theorem productMetricBound_le {ι : Type*} [Fintype ι] [DecidableEq ι] (d : ι → ℕ) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) (hd : ∀ i, (d i : ℝ) ≤ p) : + (productMetricBound d : ℝ) ≤ 2 * p * (p ^ 2 + p + 1) := by + have hdim : (Fintype.card (Σ i, Fin (d i)) : ℝ) ≤ p ^ 2 := + sigma_card_le_budget hp hι (fun i => by simpa only [Fintype.card_fin] using hd i) + have hC (i : ι) : (coordinateLipschitzBound (Fintype.card (Σ j, Fin (d j))) (d i) 1 : ℝ) ≤ + 2 * (p ^ 2 + p + 1) := by + change ((Fintype.card (Σ j, Fin (d j)) : ℝ) + (d i : ℝ) + 1) * (1 + 1) ≤ _ + nlinarith [hd i] + unfold productMetricBound + rw [NNReal.coe_sum] + calc + _ ≤ ∑ _ : ι, 2 * (p ^ 2 + p + 1) := Finset.sum_le_sum (fun i _ => hC i) + _ = (Fintype.card ι : ℝ) * (2 * (p ^ 2 + p + 1)) := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + _ ≤ p * (2 * (p ^ 2 + p + 1)) := mul_le_mul_of_nonneg_right hι (by positivity) + _ = _ := by ring + +theorem productMetricBound_le_exp {ι : Type*} [Fintype ι] [DecidableEq ι] (d : ι → ℕ) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) (hd : ∀ i, (d i : ℝ) ≤ p) : + (productMetricBound d : ℝ) ≤ Real.exp ((p + 4) ^ 4) := by + have hpoly : 2 * p * (p ^ 2 + p + 1) ≤ (p + 4) ^ 4 := by + nlinarith [sq_nonneg (p ^ 2), mul_nonneg hp (sq_nonneg p)] + apply (productMetricBound_le d hp hι hd).trans + exact hpoly.trans (by linarith [Real.add_one_le_exp ((p + 4) ^ 4)]) + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {L : ι → Type*} [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] + {s : ℕ} {d : ι → ℕ} (D : ∀ i, RationalFilteredNilmanifold (L i) s (d i)) + [∀ i, TopologicalSpace (ℝ ⊗[ℚ] L i)] [∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] L i)] + [∀ i, ContinuousSMul ℝ (ℝ ⊗[ℚ] L i)] [∀ i, T2Space (ℝ ⊗[ℚ] L i)] + [TopologicalSpace (ℝ ⊗[ℚ] (∀ i, L i))] [IsTopologicalAddGroup (ℝ ⊗[ℚ] (∀ i, L i))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (∀ i, L i))] [T2Space (ℝ ⊗[ℚ] (∀ i, L i))] + +theorem realBCHPiEquiv_symm_lipschitz : + letI : ∀ i, MetricSpace (D i).RealGroup := fun i => + rightMetricSpace (hnil := (D i).filtration.realification.lowerCentralSeries_eq_bot) + ((D i).basis.baseChange ℝ) + letI := rightMetricSpace (hnil := (pi D).filtration.realification.lowerCentralSeries_eq_bot) + ((pi D).basis.baseChange ℝ) + LipschitzWith (productMetricBound d) (realBCHPiEquiv (fun i => (D i).filtration)).symm := by + let : ∀ i, MetricSpace (D i).RealGroup := fun i => + rightMetricSpace (hnil := (D i).filtration.realification.lowerCentralSeries_eq_bot) + ((D i).basis.baseChange ℝ) + let : FiniteDimensional ℝ (ℝ ⊗[ℚ] (∀ i, L i)) := ((pi D).basis.baseChange ℝ).finiteDimensional_of_finite + let := rightMetricSpace (hnil := (pi D).filtration.realification.lowerCentralSeries_eq_bot) + ((pi D).basis.baseChange ℝ) + let := rightMetricSpace_isIsometricSMul (hnil := (pi D).filtration.realification.lowerCentralSeries_eq_bot) + ((pi D).basis.baseChange ℝ) + apply lipschitzWith_of_coordinatewise + intro i y + let e := realBCHPiEquiv (fun j => (D j).filtration) + let u : (pi D).RealGroup := e.symm (Function.update y i 1) + have heval (a : (D i).RealGroup) : + e.symm (Function.update y i a) = productInclusionHom D i a * u := by + have hup : Function.update y i a = Pi.mulSingle i a * Function.update y i 1 := by + funext j + by_cases hji : j = i + · subst j + simp only [Function.update_self, Pi.mul_apply, Pi.mulSingle_eq_same, mul_one] + · simp only [Function.update_of_ne hji, Pi.mul_apply, Pi.mulSingle_eq_of_ne hji, one_mul] + rw [hup, map_mul, realBCHPiEquiv_symm_single] + have h := (isometry_mul_right u).lipschitzWith.comp (productInclusionHom_lipschitz D i) + change LipschitzWith (coordinateLipschitzBound (Fintype.card (Σ j, Fin (d j))) (d i) 1) + (fun a => e.symm (Function.update y i a)) + simpa only [Function.comp_def, heval, one_mul] using h + +theorem native_product_group_dist_le (a b : (pi D).RealGroup) {ρ : ℝ} (hρ : 0 ≤ ρ) + (h : ∀ i, + letI := rightMetricSpace (hnil := (D i).filtration.realification.lowerCentralSeries_eq_bot) + ((D i).basis.baseChange ℝ) + dist (productProjectionHom D i a) (productProjectionHom D i b) ≤ ρ) : + letI := rightMetricSpace (hnil := (pi D).filtration.realification.lowerCentralSeries_eq_bot) + ((pi D).basis.baseChange ℝ) + dist a b ≤ (productMetricBound d : ℝ) * ρ := by + let : ∀ i, MetricSpace (D i).RealGroup := fun i => + rightMetricSpace (hnil := (D i).filtration.realification.lowerCentralSeries_eq_bot) + ((D i).basis.baseChange ℝ) + let := rightMetricSpace (hnil := (pi D).filtration.realification.lowerCentralSeries_eq_bot) + ((pi D).basis.baseChange ℝ) + let e := realBCHPiEquiv (fun i => (D i).filtration) + have hpi : dist (e a) (e b) ≤ ρ := (dist_pi_le_iff hρ).mpr h + have hdist := (realBCHPiEquiv_symm_lipschitz D).dist_le_mul (e a) (e b) + change dist (e.symm (e a)) (e.symm (e b)) ≤ + (productMetricBound d : ℝ) * dist (e a) (e b) at hdist + simp only [MulEquiv.symm_apply_apply] at hdist + exact hdist.trans (mul_le_mul_of_nonneg_left hpi (productMetricBound d).coe_nonneg) + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open scoped TensorProduct + +variable {ι σ : Type*} [Fintype ι] + {L : ι → Type*} [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] + {s : ℕ} {d : ι → ℕ} (D : ∀ i, RationalFilteredNilmanifold (L i) s (d i)) + {w : σ → ℕ} (g : ∀ i, (D i).filtration.realification.PolynomialOrbit w) + (N : ℕ) [NeZero N] + +theorem productProjection_cyclicOrbitPoint (x : σ → ZMod N) (i : ι) : + productProjection D i ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N x) = + (D i).cyclicOrbitPoint (g i) N x := + congrArg (fun z : (D i).RealGroup => (QuotientGroup.mk z : (D i).Space)) + (NilpotentLieFiltration.piRealOrbit_eval (fun j => (D j).filtration) g + (fun j => ((x j).val : ℤ)) i) + +variable [DecidableEq ι] + +theorem productSpaceEquiv_cyclicOrbitPoint (x : σ → ZMod N) : + productSpaceEquiv D ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N x) = + fun i => (D i).cyclicOrbitPoint (g i) N x := + funext (productProjection_cyclicOrbitPoint D g N x) + +variable [∀ i, TopologicalSpace (ℝ ⊗[ℚ] L i)] [∀ i, IsTopologicalAddGroup (ℝ ⊗[ℚ] L i)] + [∀ i, ContinuousSMul ℝ (ℝ ⊗[ℚ] L i)] [∀ i, T2Space (ℝ ⊗[ℚ] L i)] + [TopologicalSpace (ℝ ⊗[ℚ] (∀ i, L i))] [IsTopologicalAddGroup (ℝ ⊗[ℚ] (∀ i, L i))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (∀ i, L i))] [T2Space (ℝ ⊗[ℚ] (∀ i, L i))] + +theorem pi_cyclicOrbitPoint_dist_le (x y : σ → ZMod N) {ρ : ℝ} (hρ : 0 ≤ ρ) : + letI : ∀ i, MetricSpace (D i).Space := fun i => (D i).metricSpace + letI := (pi D).metricSpace + (∀ i, dist ((D i).cyclicOrbitPoint (g i) N x) + ((D i).cyclicOrbitPoint (g i) N y) ≤ ρ) → + dist ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N x) + ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N y) ≤ + (productMetricBound d : ℝ) * ρ := by + let : ∀ i, MetricSpace (D i).Space := fun i => (D i).metricSpace + let := (pi D).metricSpace + intro hxy + have hc : dist + (productSpaceEquiv D ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N x)) + (productSpaceEquiv D ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N y)) ≤ ρ := by + simp only [productSpaceEquiv_cyclicOrbitPoint] + exact (dist_pi_le_iff hρ).mpr hxy + have h := (productSpaceEquiv_symm_lipschitz D).dist_le_mul + (productSpaceEquiv D ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N x)) + (productSpaceEquiv D ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N y)) + simp only [Equiv.symm_apply_apply] at h + exact h.trans (mul_le_mul_of_nonneg_left hc (productMetricBound d).coe_nonneg) + +theorem pi_cyclicOrbitPoint_dist_le_exp (x y : σ → ZMod N) {p ρ : ℝ} + (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) (hd : ∀ i, (d i : ℝ) ≤ p) (hρ : 0 ≤ ρ) : + letI : ∀ i, MetricSpace (D i).Space := fun i => (D i).metricSpace + letI := (pi D).metricSpace + (∀ i, dist ((D i).cyclicOrbitPoint (g i) N x) + ((D i).cyclicOrbitPoint (g i) N y) ≤ ρ) → + dist ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N x) + ((pi D).cyclicOrbitPoint + (NilpotentLieFiltration.piRealOrbit (fun j => (D j).filtration) g) N y) ≤ + Real.exp ((p + 4) ^ 4) * ρ := by + let : ∀ i, MetricSpace (D i).Space := fun i => (D i).metricSpace + let := (pi D).metricSpace + intro hxy + exact (pi_cyclicOrbitPoint_dist_le D g N x y hρ hxy).trans + (mul_le_mul_of_nonneg_right (productMetricBound_le_exp d hp hι hd) hρ) + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeQuadrupleCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeQuadrupleCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..44c1b6f5a9f78cfa0e084110c97c452d55f63de5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeQuadrupleCoordinates.lean @@ -0,0 +1,76 @@ +import OAI.Combinatorics.Progressions.Dynamics.NativeCorrelationQuadrupleBudget + +namespace OAI + +section + +namespace Erdos3 + +def additiveQuadrupleShift {G : Type*} [AddGroup G] (a h k : G) (i : Bool × Bool) : G := + (if i.1 then k else h) - (if i.2 then a else 0) + +namespace NativeCorrelationStructure + +open scoped BigOperators + +variable {s r N : ℕ} [NeZero N] {p : ℝ} {f : ZMod N → ℂ} + (W : NativeCorrelationStructure s r N p f) + +theorem selectedCoordinate_card_bound : + (Fintype.card (Fin W.mixed.outputDim × Fin W.family.outputDim) : ℝ) ≤ Real.exp (2 * p) := by + simp only [Fintype.card_prod, Fintype.card_fin, Nat.cast_mul] + calc + _ ≤ Real.exp p * Real.exp p := mul_le_mul W.mixed.output_bound W.family.output_bound + (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem exists_fixed_coordinate_quadruples (hf : ∀ x, ‖f x‖ ≤ 1) : + ∃ (coordinate : Bool × Bool → Fin W.mixed.outputDim × Fin W.family.outputDim) + (Q : Finset (ZMod N × ZMod N × ZMod N)), Q.Nonempty ∧ + Real.exp (-((p + 3) ^ 3 + 8 * p)) * (Fintype.card (ZMod N) : ℝ) ^ 3 ≤ (Q.card : ℝ) ∧ + (∀ t ∈ Q, ∀ i : Bool × Bool, + ∃ hi : additiveQuadrupleShift t.1 t.2.1 t.2.2 i ∈ W.shifts, + (W.selectedWitness ⟨additiveQuadrupleShift t.1 t.2.1 t.2.2 i, hi⟩).coordinate = coordinate i) ∧ + ∀ t ∈ Q, Real.exp (-((p + 3) ^ 3)) ≤ + additiveQuadrupleCorrelation W.selectedCorrelator t.1 t.2.1 t.2.2 := by + classical + obtain ⟨Q, hQ, hdense, hcorr⟩ := W.exists_selected_correlator_quadruples_budget hf + have hmem (t) (ht : t ∈ Q) (i : Bool × Bool) : + additiveQuadrupleShift t.1 t.2.1 t.2.2 i ∈ W.shifts := by + obtain ⟨h₁, h₂, h₃, h₄, _⟩ := hcorr t ht + rcases i with ⟨b, c⟩ + cases b <;> cases c + · simpa only [additiveQuadrupleShift, Bool.false_eq_true, ite_false, sub_zero] using h₁ + · simpa only [additiveQuadrupleShift, Bool.false_eq_true, ite_false, ite_true] using h₂ + · simpa only [additiveQuadrupleShift, Bool.false_eq_true, ite_false, ite_true, sub_zero] using h₃ + · simpa only [additiveQuadrupleShift, ite_true] using h₄ + let rel (t : ZMod N × ZMod N × ZMod N) (i : Bool × Bool) + (j : Fin W.mixed.outputDim × Fin W.family.outputDim) : Prop := + ∃ hi : additiveQuadrupleShift t.1 t.2.1 t.2.2 i ∈ W.shifts, + (W.selectedWitness ⟨additiveQuadrupleShift t.1 t.2.1 t.2.2 i, hi⟩).coordinate = j + have hchoice : ∀ t ∈ Q, ∀ i, ∃ j, rel t i j := by + intro t ht i + exact ⟨_, hmem t ht i, rfl⟩ + obtain ⟨coordinate, S, hsub, hS, hsize, hfixed⟩ := exists_large_fixed_choices Q hQ rel hchoice + W.selectedCoordinate_card_bound + have hsize' : Real.exp (-(8 * p)) * (Q.card : ℝ) ≤ (S.card : ℝ) := by + have hcard : (Fintype.card (Bool × Bool) : ℝ) = 4 := by norm_num + rw [hcard, show -(2 * p) * 4 = -(8 * p) by ring] at hsize + exact hsize + refine ⟨coordinate, S, hS, ?_, hfixed, fun t ht => (hcorr t (hsub ht)).2.2.2.2⟩ + calc + _ = Real.exp (-(8 * p)) * (Real.exp (-((p + 3) ^ 3)) * (Fintype.card (ZMod N) : ℝ) ^ 3) := by + rw [← mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ Real.exp (-(8 * p)) * (Q.card : ℝ) := + mul_le_mul_of_nonneg_left hdense (Real.exp_nonneg _) + _ ≤ _ := hsize' + +end NativeCorrelationStructure + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeSampleSliceChartVerticalPartners.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeSampleSliceChartVerticalPartners.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbd4136599d44fe1bf4bda75ebc4e4d7f28f8cf6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeSampleSliceChartVerticalPartners.lean @@ -0,0 +1,113 @@ +import OAI.Combinatorics.Progressions.Probability.NativeSliceLawVerticalPartners + +namespace OAI + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold VectorPolynomial CircleFourier +open scoped TensorProduct BigOperators Classical + +attribute [local instance] NativeSampleModel.lie NativeSampleModel.algebra + NativeSampleModel.topology NativeSampleModel.topologicalAdd + NativeSampleModel.continuousSMul NativeSampleModel.hausdorff + +theorem exists_nativeSample_slice_chart_vertical_partners + {Ω Pivot K σ X LG : Type*} [Fintype Ω] [Fintype Pivot] [Fintype K] [DecidableEq K] + [LieRing LG] [LieAlgebra ℚ LG] + [TopologicalSpace (ℝ ⊗[ℚ] LG)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] LG)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] LG)] [T2Space (ℝ ⊗[ℚ] LG)] + {s d : ℕ} (D : RationalFilteredNilmanifold LG s d) + {w : σ → ℕ} {pNative : ℝ} (sample : X → σ → ℤ) + (nativeValue : Pivot → X → ℂ) + (native : ∀ j, NativeSampleModel w s pNative sample (nativeValue j)) + (P : Ω → Pivot → D.Niltest (fun _ : K => 1)) + (outer : FiniteProbabilityWeights Ω) (H : Finset Ω) (hH : 0 < outer.mass H) + {N : K → ℕ} (stride : Ω → Pivot → ℕ) + (S : ∀ a j, ResidueBoxSlice N (stride a j)) + (hstride : ∀ a ∈ H, ∀ j, 0 < stride a j) + (hlen : ∀ a j i, 0 < (S a j).length i) + (physical : Ω → integerBox N → X) + (β : Ω → σ → MvPolynomial K ℤ) + (hβ : ∀ a i, integerSampledRealChart (β a) i ∈ + weightedSupportLE (fun _ : K => 1) (w i)) + (hsample : ∀ a ∈ H, ∀ j (t : integerBox N), t.val ∈ (S a j).integerPoints → + sample (physical a t) = fun i => MvPolynomial.eval t.val (β a i)) + (twist : Ω → Pivot → integerBox N → ℂ) + {pLocal r q : ℝ} (hpLocal : 0 ≤ pLocal) (hr : 0 ≤ r) (hpq : pNative ≤ q) + (hprecision : pLocal + r + 1 ≤ q) + (hP : ∀ a ∈ H, ∀ j, (P a j).ComplexityLE pLocal) + (htwist : ∀ a ∈ H, ∀ j t, ‖twist a j t‖ ≤ 1) + (hcorr : ∀ a ∈ H, ∀ j, Real.exp (-r) ≤ + ‖((S a j).fullSliceLaw (hlen a j)).complexMean (fun t => + (star (twist a j t) * nativeValue j (physical a t)) * (P a j).eval t.val)‖) : + ∃ (freq : ∀ j, (native j).L →ₗ[ℚ] ℚ) + (V : ∀ j, (native j).model.Niltest w) (retained : Finset Ω), + retained ⊆ H ∧ 0 < outer.mass retained ∧ + Real.exp (-verticalDecompositionBudget q * Fintype.card Pivot) * outer.mass H ≤ + outer.mass retained ∧ + (∀ j, (V j).orbit = (native j).test.orbit ∧ + (V j).ComplexityLE pNative ∧ (V j).normBound ≤ 1) ∧ + (∀ j i, rationalLogHeight (freq j ((native j).model.basis i)) ≤ + verticalDecompositionBudget q) ∧ + (∀ j z, z ∈ (native j).model.filtration.realification.subgroup s → ∀ x, + (V j).observable (z • x) = character + ((realifyFunctional (freq j) z.coord : ℝ) : CircleFourier.Circle) * (V j).observable x) ∧ + ∀ a ∈ retained, ∀ j, + let W := (V j).integerChartPullback (fun _ : K => 1) (β a) (hβ a) + W.orbit = ((native j).test.integerChartPullback + (fun _ : K => 1) (β a) (hβ a)).orbit ∧ + W.ComplexityLE pNative ∧ W.normBound ≤ 1 ∧ + (Real.exp (-r) / (2 * Real.exp (verticalDecompositionBudget q)) ≤ + ‖((S a j).fullSliceLaw (hlen a j)).complexMean (fun t => + (star (twist a j t) * (V j).eval (sample (physical a t))) * + (P a j).eval t.val)‖) ∧ + Real.exp (-r) / (2 * Real.exp (verticalDecompositionBudget q)) ≤ + ‖((S a j).fullSliceLaw (hlen a j)).complexMean (fun t => + star (twist a j t) * ((P a j).eval t.val * W.eval t.val))‖ := by + have hnativeCorr (a : Ω) (ha : a ∈ H) (j : Pivot) : + Real.exp (-r) ≤ ‖((S a j).fullSliceLaw (hlen a j)).complexMean (fun t => + ((P a j).eval t.val * star (twist a j t)) * + (native j).test.eval (sample (physical a t)))‖ := by + convert hcorr a ha j using 2 + congr 1 + funext t + rw [(native j).eval] + ring + obtain ⟨freq, V, retained, hsub, hpos, hmass, hcert, hheight, hvert, _hint, + _hpres, hselected⟩ := exists_sliceLaw_localPivot_weighted_native_vertical_partners + (fun j => (native j).model) (fun _ _ => D) (fun j => (native j).test) P + outer H hH stride S hstride hlen (fun a t => sample (physical a t)) (fun _ _ t => t.val) + (fun a j t => star (twist a j t)) hpLocal hr hpq hprecision + (fun j => (native j).complexity) (fun j => by exact_mod_cast (native j).norm) + hP (fun a ha j t => by simpa only [norm_star] using htwist a ha j t) hnativeCorr + refine ⟨freq, V, retained, hsub, hpos, hmass, ?_, hheight, hvert, ?_⟩ + · intro j + exact ⟨(hcert j).2.1, (hcert j).1, by exact_mod_cast (hcert j).2.2.2.2⟩ + · intro a ha j + dsimp only + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · simp only [RationalFilteredNilmanifold.Niltest.integerChartPullback, + RationalFilteredNilmanifold.Niltest.withOrbit, (hcert j).2.1] + · exact (V j).integerChartPullback_complexity_of (fun _ : K => 1) (β a) (hβ a) (hcert j).1 + · exact (show (V j).normBound ≤ 1 by exact_mod_cast (hcert j).2.2.2.2) + · convert hselected a ha j using 2 + congr 1 + funext t + ring + · have hsel := hselected a ha j + rw [(S a j).fullSliceLaw_complexMean (hlen a j)] at hsel ⊢ + convert hsel using 2 + apply Finset.expect_congr rfl + intro t _ht + rw [(V j).integerChartPullback_eval] + rw [hsample a (hsub ha) j ((S a j).fullSlicePointInIntegerBox t) + (Finset.mem_image.mpr ⟨t, Finset.mem_univ _, rfl⟩)] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeTernaryCoordinate.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeTernaryCoordinate.lean new file mode 100644 index 0000000000000000000000000000000000000000..613b12641d592ba7c6e293d5cff2ce3d9fea3572 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeTernaryCoordinate.lean @@ -0,0 +1,295 @@ +import OAI.Combinatorics.Progressions.Lattices.NativeIntegerSelfEquivalence + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def BinaryTensorIndex (I : Type*) : ℕ → Type _ + | 0 => I + | n + 1 => BinaryTensorIndex I n × BinaryTensorIndex I n + +instance BinaryTensorIndex.fintype (I : Type*) [Fintype I] (n : ℕ) : Fintype (BinaryTensorIndex I n) := by + induction n with + | zero => exact inferInstanceAs (Fintype I) + | succ n ih => + letI := ih + exact inferInstanceAs (Fintype (BinaryTensorIndex I n × BinaryTensorIndex I n)) + +variable {σ I : Type*} [DecidableEq σ] + +def coordinateTranslatedInput (l : List σ) (x : Option σ → ℤ) (i : σ) : ℤ := + x (some i) + if i ∈ l then x none else 0 + +def coordinateTranslationHom (l : List σ) (j : Option σ) : ((Option σ → ℤ) →+ ℤ) where + toFun x := match j with + | none => x none + | some i => coordinateTranslatedInput l x i + map_zero' := by cases j <;> simp [coordinateTranslatedInput] + map_add' x y := by + cases j with + | none => rfl + | some i => + simp only [coordinateTranslatedInput, Pi.add_apply] + split_ifs <;> ring + +def coordinateReplaceIndex (i : σ) (j : Option σ) : Option σ := + if j = some i then none else j + +def coordinateReplaceInput (i : σ) (x : Option σ → ℤ) : Option σ → ℤ := + fun j => x (coordinateReplaceIndex i j) + +theorem coordinateTranslation_sum (l : List σ) (i : σ) (hi : i ∉ l) (x : Option σ → ℤ) : + coordinateAdditionInputs i (fun j => coordinateTranslationHom l j x) 0 = + coordinateTranslatedInput (i :: l) x := by + funext j + by_cases hj : j = i + · subst j + simp [coordinateAdditionInputs, coordinateTranslationHom, coordinateTranslatedInput, hi] + · simp [coordinateAdditionInputs, coordinateTranslationHom, coordinateTranslatedInput, hj] + +theorem coordinateTranslation_left (l : List σ) (i : σ) (x : Option σ → ℤ) : + coordinateAdditionInputs i (fun j => coordinateTranslationHom l j x) 1 = + coordinateTranslatedInput l x := rfl + +theorem coordinateTranslation_right (l : List σ) (i : σ) (hi : i ∉ l) (x : Option σ → ℤ) : + coordinateAdditionInputs i (fun j => coordinateTranslationHom l j x) 2 = + coordinateTranslatedInput l (coordinateReplaceInput i x) := by + funext j + by_cases hj : j = i + · subst j + simp [coordinateAdditionInputs, coordinateTranslationHom, coordinateTranslatedInput, + coordinateReplaceInput, coordinateReplaceIndex, hi] + · simp [coordinateAdditionInputs, coordinateTranslationHom, coordinateTranslatedInput, + coordinateReplaceInput, coordinateReplaceIndex, hj] + +noncomputable def coordinateTranslationExpansion (f : I → (σ → ℤ) → ℂ) : + (l : List σ) → BinaryTensorIndex I l.length → (Option σ → ℤ) → ℂ + | [], a, x => f a (fun j => x (some j)) + | i :: l, a, x => coordinateTranslationExpansion f l a.1 x * + coordinateTranslationExpansion f l a.2 (coordinateReplaceInput i x) + +theorem coordinateTranslationExpansion_unit [Fintype I] (f : I → (σ → ℤ) → ℂ) + (hunit : ∀ x, ∑ i, ‖f i x‖ ^ 2 = 1) (l : List σ) (x : Option σ → ℤ) : + ∑ a : BinaryTensorIndex I l.length, ‖coordinateTranslationExpansion f l a x‖ ^ 2 = 1 := by + induction l generalizing x with + | nil => exact hunit _ + | cons i l ih => + change (∑ a : BinaryTensorIndex I l.length × BinaryTensorIndex I l.length, + ‖coordinateTranslationExpansion f l a.1 x * + coordinateTranslationExpansion f l a.2 (coordinateReplaceInput i x)‖ ^ 2) = 1 + simp only [Fintype.sum_prod_type, norm_mul, mul_pow, ← Finset.mul_sum, ih, mul_one] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def TernaryTensorIndex (I : Type*) : ℕ → Type _ + | 0 => I + | n + 1 => TernaryTensorIndex I n × (TernaryTensorIndex I n × TernaryTensorIndex I n) + +instance TernaryTensorIndex.fintype (I : Type*) [Fintype I] (n : ℕ) : Fintype (TernaryTensorIndex I n) := by + induction n with + | zero => exact inferInstanceAs (Fintype I) + | succ n ih => + letI := ih + exact inferInstanceAs (Fintype (TernaryTensorIndex I n × + (TernaryTensorIndex I n × TernaryTensorIndex I n))) + +variable {σ I : Type*} [DecidableEq σ] + +def ternaryCoordinateInput (l : List σ) (x : (Fin 3 × σ) → ℤ) (j : σ) : ℤ := + if j ∈ l then ∑ a : Fin 3, x (a, j) else x (0, j) + +def ternaryCoordinateHom (l : List σ) (j : σ) : (((Fin 3 × σ) → ℤ) →+ ℤ) where + toFun x := ternaryCoordinateInput l x j + map_zero' := by simp [ternaryCoordinateInput] + map_add' x y := by + simp only [ternaryCoordinateInput, Pi.add_apply, Finset.sum_add_distrib] + split_ifs <;> rfl + +def ternaryReplaceIndex (i : σ) (a : Fin 3) (j : Fin 3 × σ) : Fin 3 × σ := + if j = (0, i) then (a, i) else j + +def ternaryReplaceInput (i : σ) (a : Fin 3) (x : (Fin 3 × σ) → ℤ) : (Fin 3 × σ) → ℤ := + fun j => x (ternaryReplaceIndex i a j) + +theorem ternaryCoordinateInput_replace (l : List σ) (i : σ) (hi : i ∉ l) + (a : Fin 3) (x : (Fin 3 × σ) → ℤ) : + ternaryCoordinateInput l (ternaryReplaceInput i a x) = + Function.update (ternaryCoordinateInput l x) i (x (a, i)) := by + funext j + by_cases hj : j = i + · subst j + simp [ternaryCoordinateInput, ternaryReplaceInput, ternaryReplaceIndex, hi] + · simp [ternaryCoordinateInput, ternaryReplaceInput, ternaryReplaceIndex, hj] + +theorem ternaryCoordinateInput_cons (l : List σ) (i : σ) + (x : (Fin 3 × σ) → ℤ) : + ternaryCoordinateInput (i :: l) x = Function.update (ternaryCoordinateInput l x) i + (x (0, i) + (x (1, i) + x (2, i))) := by + funext j + by_cases hj : j = i + · subst j + simp [ternaryCoordinateInput, Fin.sum_univ_three, add_assoc] + · simp [ternaryCoordinateInput, hj] + +noncomputable def ternaryCoordinateExpansion (f : I → (σ → ℤ) → ℂ) : + (l : List σ) → TernaryTensorIndex I l.length → (((Fin 3 × σ) → ℤ) → ℂ) + | [], a, x => f a (fun j => x (0, j)) + | i :: l, a, x => ternaryCoordinateExpansion f l a.1 x * + (ternaryCoordinateExpansion f l a.2.1 (ternaryReplaceInput i 1 x) * + ternaryCoordinateExpansion f l a.2.2 (ternaryReplaceInput i 2 x)) + +theorem ternaryCoordinateExpansion_unit [Fintype I] (f : I → (σ → ℤ) → ℂ) + (hf : ∀ x, ∑ a, ‖f a x‖ ^ 2 = 1) (l : List σ) (x : (Fin 3 × σ) → ℤ) : + ∑ a : TernaryTensorIndex I l.length, ‖ternaryCoordinateExpansion f l a x‖ ^ 2 = 1 := by + induction l generalizing x with + | nil => exact hf _ + | cons i l ih => + change (∑ a : TernaryTensorIndex I l.length × + (TernaryTensorIndex I l.length × TernaryTensorIndex I l.length), + ‖ternaryCoordinateExpansion f l a.1 x * + (ternaryCoordinateExpansion f l a.2.1 (ternaryReplaceInput i 1 x) * + ternaryCoordinateExpansion f l a.2.2 (ternaryReplaceInput i 2 x))‖ ^ 2) = 1 + simp only [Fintype.sum_prod_type, norm_mul, mul_pow, ← Finset.mul_sum, ih, mul_one] + +end Erdos3 + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +theorem exists_coordinate_translation_equivalence {σ : Type*} [Fintype σ] [DecidableEq σ] : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} (W : NativeMultidegreeNilcharacter (fun _ : σ => 1) p) + (l : List σ) (i : σ), i ∉ l → + NativeIntegerVectorEquivalence (Fintype.card σ - 1) ((p + C) ^ C) + (fun k x => W.eval k (coordinateTranslatedInput (i :: l) x)) + (fun k : Fin W.outputDim × Fin W.outputDim => fun x => + W.eval k.1 (coordinateTranslatedInput l x) * + W.eval k.2 (coordinateTranslatedInput l (coordinateReplaceInput i x))) := by + obtain ⟨C, hC, hadd⟩ := exists_multilinearity_equivalence (σ := σ) + refine ⟨C, hC, ?_⟩ + intro p W l i hi + have E := (hadd W i).linearPullbackHom (coordinateTranslationHom l) + simpa only [coordinateSumVector, coordinateTensorVector, + coordinateTranslation_sum l i hi, coordinateTranslation_left, + coordinateTranslation_right l i hi] using E + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped BigOperators + +theorem exists_ternary_coordinate_equivalence {σ : Type*} + [Fintype σ] [DecidableEq σ] [Nonempty σ] : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} (W : NativeMultidegreeNilcharacter (fun _ : σ => 1) p) + (l : List σ) (i : σ), i ∉ l → + NativeIntegerVectorEquivalence (Fintype.card σ - 1) ((p + C) ^ C) + (fun j x => W.eval j (ternaryCoordinateInput (i :: l) x)) + (fun a : Fin W.outputDim × (Fin W.outputDim × Fin W.outputDim) => fun x => + W.eval a.1 (ternaryCoordinateInput l x) * + (W.eval a.2.1 (ternaryCoordinateInput l (ternaryReplaceInput i 1 x)) * + W.eval a.2.2 (ternaryCoordinateInput l (ternaryReplaceInput i 2 x)))) := by + obtain ⟨A, _, hadd⟩ := exists_multilinearity_equivalence (σ := σ) + obtain ⟨B, _, hself⟩ := exists_integer_self_equivalence (σ := σ) + obtain ⟨D, _, htensor⟩ := NativeIntegerVectorEquivalence.exists_tensor_budget + obtain ⟨F, _, htrans⟩ := NativeIntegerVectorEquivalence.exists_trans_budget + let X : Polynomial ℕ := Polynomial.X + let U := (X + Polynomial.C A) ^ A + (X + Polynomial.C B) ^ B + let V := (U + Polynomial.C D) ^ D + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((U + V + Polynomial.C F) ^ F) + refine ⟨C, hC, ?_⟩ + intro p W l i hi + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let u := (p + A) ^ A + (p + B) ^ B + let v := (u + D) ^ D + have hu : 0 ≤ u := by dsimp [u]; positivity + have hv : 0 ≤ v := by dsimp [v]; positivity + have hAu : (p + A) ^ A ≤ u := le_add_of_nonneg_right (by positivity) + have hBu : (p + B) ^ B ≤ u := le_add_of_nonneg_left (by positivity) + let leftMap : Option σ → (((Fin 3 × σ) → ℤ) →+ ℤ) := fun j => match j with + | none => { toFun := fun x => x (1, i) + x (2, i) + map_zero' := by simp + map_add' := fun x y => by simp only [Pi.add_apply]; ring } + | some j => ternaryCoordinateHom l j + let rightMap : Option σ → (((Fin 3 × σ) → ℤ) →+ ℤ) := fun j => match j with + | none => { toFun := fun x => x (2, i), map_zero' := rfl, map_add' := fun _ _ => rfl } + | some j => if j = i then + { toFun := fun x => x (1, i), map_zero' := rfl, map_add' := fun _ _ => rfl } + else ternaryCoordinateHom l j + let middle (x : (Fin 3 × σ) → ℤ) := + Function.update (ternaryCoordinateInput l x) i (x (1, i) + x (2, i)) + have hleft0 (x : (Fin 3 × σ) → ℤ) : + coordinateAdditionInputs i (fun j => leftMap j x) 0 = ternaryCoordinateInput (i :: l) x := by + rw [ternaryCoordinateInput_cons l i] + change Function.update (ternaryCoordinateInput l x) i + (ternaryCoordinateInput l x i + (x (1, i) + x (2, i))) = _ + simp only [ternaryCoordinateInput, ite_eq_right hi] + have hleft1 (x : (Fin 3 × σ) → ℤ) : + coordinateAdditionInputs i (fun j => leftMap j x) 1 = ternaryCoordinateInput l x := rfl + have hleft2 (x : (Fin 3 × σ) → ℤ) : + coordinateAdditionInputs i (fun j => leftMap j x) 2 = middle x := rfl + have hrightBase (x : (Fin 3 × σ) → ℤ) : + (fun j => rightMap (some j) x) = Function.update (ternaryCoordinateInput l x) i (x (1, i)) := by + funext j + by_cases hj : j = i <;> simp [rightMap, hj, ternaryCoordinateHom] + have hright0 (x : (Fin 3 × σ) → ℤ) : + coordinateAdditionInputs i (fun j => rightMap j x) 0 = middle x := by + rw [coordinateAdditionInputs_sum, hrightBase] + simp [rightMap, middle] + have hright1 (x : (Fin 3 × σ) → ℤ) : + coordinateAdditionInputs i (fun j => rightMap j x) 1 = + ternaryCoordinateInput l (ternaryReplaceInput i 1 x) := by + rw [coordinateAdditionInputs_left, hrightBase, ternaryCoordinateInput_replace l i hi] + have hright2 (x : (Fin 3 × σ) → ℤ) : + coordinateAdditionInputs i (fun j => rightMap j x) 2 = + ternaryCoordinateInput l (ternaryReplaceInput i 2 x) := by + rw [coordinateAdditionInputs_right, hrightBase, ternaryCoordinateInput_replace l i hi] + simp [rightMap] + have E₀ : NativeIntegerVectorEquivalence (Fintype.card σ - 1) u + (fun j x => W.eval j (ternaryCoordinateInput (i :: l) x)) + (fun a : Fin W.outputDim × Fin W.outputDim => fun x => + W.eval a.1 (ternaryCoordinateInput l x) * W.eval a.2 (middle x)) := by + have E := ((hadd W i).linearPullbackHom leftMap).mono hAu + simpa only [coordinateSumVector, coordinateTensorVector, hleft0, hleft1, hleft2] using E + have E₁ : NativeIntegerVectorEquivalence (Fintype.card σ - 1) u + (fun j x => W.eval j (middle x)) + (fun a : Fin W.outputDim × Fin W.outputDim => fun x => + W.eval a.1 (ternaryCoordinateInput l (ternaryReplaceInput i 1 x)) * + W.eval a.2 (ternaryCoordinateInput l (ternaryReplaceInput i 2 x))) := by + have E := ((hadd W i).linearPullbackHom rightMap).mono hAu + simpa only [coordinateSumVector, coordinateTensorVector, hright0, hright1, hright2] using E + have Eself := ((hself W).linearPullbackHom (ternaryCoordinateHom l)).mono hBu + have E₂ := htensor hu Eself E₁ + have Emid (x : (Fin 3 × σ) → ℤ) : + ∑ a : Fin W.outputDim × Fin W.outputDim, + ‖W.eval a.1 (ternaryCoordinateInput l x) * W.eval a.2 (middle x)‖ ^ 2 = 1 := by + simp only [Fintype.sum_prod_type, norm_mul, mul_pow, ← Finset.mul_sum, W.unit_eval, mul_one] + have E := htrans (add_nonneg hu hv) (E₀.mono (le_add_of_nonneg_right hv)) + (E₂.mono (le_add_of_nonneg_left hu)) Emid + have hcost : (u + v + F) ^ F ≤ (p + C) ^ C := by + simpa [X, U, V, u, v, Polynomial.eval₂_pow] using hbudget p hp + exact E.mono hcost + +end Erdos3.NativeMultidegreeNilcharacter + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeTopQuotientMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeTopQuotientMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..623da0deb11d443bb63ca46c0f444130524b9c32 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeTopQuotientMetric.lean @@ -0,0 +1,88 @@ +import OAI.Combinatorics.Progressions.Linear.NativeRankQuotientOrbit + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (b : Basis (Fin d) ℚ L) (w : Fin d → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + (Γ : Subgroup F.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates b Γ) + (hout : bchSubgroupCoordinates b Γ ⊆ denominatorGrid N) + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] (L ⧸ F.layerIdeal (s + 1)))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (L ⧸ F.layerIdeal (s + 1)))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (L ⧸ F.layerIdeal (s + 1)))] + [T2Space (ℝ ⊗[ℚ] (L ⧸ F.layerIdeal (s + 1)))] + +local notation "V" => F.ofAdaptedBasis b w hF Γ N hN hin hout +local notation "Q" => F.topQuotientModel b w hF Γ N hN hin hout + +theorem topQuotientModel_dist_le {p : ℝ} (hp : 0 ≤ p) (hgeom : (V).GeometryComplexityLE p) + (u v : F.realification.Group) : + letI := (V).metricSpace + letI := (Q).metricSpace + dist (QuotientGroup.mk (F.realQuotientStepHom (F.layerIdeal (s + 1)) le_rfl u) : (Q).Space) + (QuotientGroup.mk (F.realQuotientStepHom (F.layerIdeal (s + 1)) le_rfl v)) ≤ + Real.exp ((p + 2) ^ 2) * dist (QuotientGroup.mk u : (V).Space) (QuotientGroup.mk v) := by + let := (V).metricSpace + let := (Q).metricSpace + let := realificationQuotientMetricSpace b Γ N hN hout + let := realificationQuotientMetricSpace (Q).basis (Q).lattice N hN (Q).outer_grid + have hQ := F.topQuotientModel_geometry b w hF Γ N hN hin hout hp hgeom + have hmap : Γ ≤ (Q).lattice.comap (mapOfSteps (lieQuotientMap (F.layerIdeal (s + 1)))) := by + intro g hg + exact ⟨g, hg, rfl⟩ + have hheight : ∀ i j, RationalHeightLE + ((Q).basis.repr (lieQuotientMap (F.layerIdeal (s + 1)) (b j)) i) 1 := by + intro i j + exact quotientFinBasis_projection_height b (F.layerIdeal (s + 1)) + {i | s + 1 ≤ w i} (hF (s + 1)) j i + obtain ⟨K, _, hK, hLip⟩ := exists_realificationMap_quotient_lipschitz_exp_bound + b (Q).basis (lieQuotientMap (F.layerIdeal (s + 1))) Γ (Q).lattice hmap + N N hN hN hout (Q).outer_grid 1 hp + (by simpa only [Fintype.card_fin] using hgeom.1) + (by simpa only [Fintype.card_fin] using hQ.1) + (by simpa only [Nat.cast_one] using Real.one_le_exp hp) hheight + have hd := hLip.dist_le_mul (QuotientGroup.mk u) (QuotientGroup.mk v) + change dist (QuotientGroup.mk (F.realQuotientStepHom (F.layerIdeal (s + 1)) le_rfl u) : (Q).Space) + (QuotientGroup.mk (F.realQuotientStepHom (F.layerIdeal (s + 1)) le_rfl v)) ≤ + (K : ℝ) * dist (QuotientGroup.mk u : (V).Space) (QuotientGroup.mk v) at hd + exact hd.trans (mul_le_mul_of_nonneg_right hK dist_nonneg) + +theorem topQuotientModel_orbit_dist_le {σ : Type*} {ω : σ → ℕ} + {p : ℝ} (hp : 0 ≤ p) (hgeom : (V).GeometryComplexityLE p) + (g : F.realification.PolynomialOrbit ω) (x y : σ → ℤ) : + letI := (V).metricSpace + letI := (Q).metricSpace + dist (QuotientGroup.mk (F.quotientTop.realification.polynomialOrbitEval ω x + (F.realQuotientPolynomialOrbit (F.layerIdeal (s + 1)) le_rfl g)) : (Q).Space) + (QuotientGroup.mk (F.quotientTop.realification.polynomialOrbitEval ω y + (F.realQuotientPolynomialOrbit (F.layerIdeal (s + 1)) le_rfl g))) ≤ + Real.exp ((p + 2) ^ 2) * + dist (QuotientGroup.mk (F.realification.polynomialOrbitEval ω x g) : (V).Space) + (QuotientGroup.mk (F.realification.polynomialOrbitEval ω y g)) := by + let := (V).metricSpace + let := (Q).metricSpace + have heval (z : σ → ℤ) : + (QuotientGroup.mk (F.quotientTop.realification.polynomialOrbitEval ω z + (F.realQuotientPolynomialOrbit (F.layerIdeal (s + 1)) le_rfl g)) : (Q).Space) = + QuotientGroup.mk (F.realQuotientStepHom (F.layerIdeal (s + 1)) le_rfl + (F.realification.polynomialOrbitEval ω z g)) := + congrArg (fun a : (Q).RealGroup => (QuotientGroup.mk a : (Q).Space)) + (F.realQuotientPolynomialOrbit_eval (F.layerIdeal (s + 1)) (t := s) le_rfl g z) + exact (congrArg₂ (fun a b : (Q).Space => dist a b) (heval x) (heval y)).trans_le + (F.topQuotientModel_dist_le b w hF Γ N hN hin hout hp hgeom _ _) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeTranslatedBoxInverse.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeTranslatedBoxInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..3814ea2b837a9f61dcf7a3f293f0b4db6cb6060b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeTranslatedBoxInverse.lean @@ -0,0 +1,78 @@ +import OAI.Combinatorics.Progressions.Lattices.NativeIntegerBoxInverse + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +noncomputable def NativeSampleCorrelation.translateInput {σ : Type*} [Fintype σ] [DecidableEq σ] + {s : ℕ} {p : ℝ} {Q : Finset (σ → ℤ)} {f : (σ → ℤ) → ℂ} + (a : σ → ℤ) (V : NativeSampleCorrelation (fun _ : σ => 1) s p Q id (fun x => f (a + x))) : + NativeSampleCorrelation (fun _ : σ => 1) s p (translateSupport a Q) id f where + L := V.L + dim := V.dim + model := V.model + test := V.test.translate (fun _ => by decide) (-a) + complexity := V.complexity + correlation := by + change Real.exp (-p) ≤ ‖𝔼 x ∈ Q.image (fun y => a + y), + f x * star ((V.test.translate (fun _ => by decide) (-a)).eval x)‖ + have hinj : Set.InjOn (fun x : σ → ℤ => a + x) (Q : Set (σ → ℤ)) := + fun _ _ _ _ h => add_left_cancel h + rw [Finset.expect_image hinj] + have heq (x : σ → ℤ) : a + x + -a = x := by abel + simpa only [RationalFilteredNilmanifold.Niltest.eval_translate, heq, id_eq] using V.correlation + +theorem NativeSampleCorrelation.translateInput_norm {σ : Type*} [Fintype σ] [DecidableEq σ] + {s : ℕ} {p : ℝ} {Q : Finset (σ → ℤ)} {f : (σ → ℤ) → ℂ} + (a : σ → ℤ) (V : NativeSampleCorrelation (fun _ : σ => 1) s p Q id (fun x => f (a + x))) : + (V.translateInput a).test.normBound = V.test.normBound := rfl + +theorem exists_native_translated_box_inverse (s : ℕ) (hs : 1 ≤ s) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {n : ℕ} (a : Fin n → ℤ) (T : Fin n → ℕ) [∀ i, NeZero (T i)] + {p : ℝ}, 2 ≤ p → ∀ f : (Fin n → ℤ) → ℂ, + (∀ x ∈ translatedIntegerBox a T, ‖f x‖ ≤ 1) → + Real.exp (-p) ≤ finiteSupportGowersNorm (s + 1) (translatedIntegerBox a T) f → + ∃ V : NativeSampleCorrelation (fun _ : Fin n => 1) s ((p + n + C) ^ C) + (translatedIntegerBox a T) id f, V.test.normBound ≤ 1 := by + obtain ⟨C, hC, hinverse⟩ := exists_native_integer_box_inverse s hs + refine ⟨C, hC, ?_⟩ + intro n a T _ p hp f hf hGowers + have hshift : ∀ x ∈ integerBox T, ‖f (a + x)‖ ≤ 1 := by + intro x hx + apply hf + exact Finset.mem_image.mpr ⟨x, hx, rfl⟩ + rw [translatedIntegerBox_norm_eq] at hGowers + obtain ⟨V, hV⟩ := hinverse T hp (fun x => f (a + x)) hshift hGowers + exact ⟨V.translateInput a, hV⟩ + +theorem exists_native_translated_box_inverse_bounded_dimension (s : ℕ) (hs : 1 ≤ s) (D : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {n : ℕ} (a : Fin n → ℤ) (T : Fin n → ℕ) [∀ i, NeZero (T i)] + {p : ℝ}, 2 ≤ p → (n : ℝ) ≤ (p + D) ^ D → ∀ f : (Fin n → ℤ) → ℂ, + (∀ x ∈ translatedIntegerBox a T, ‖f x‖ ≤ 1) → + Real.exp (-p) ≤ finiteSupportGowersNorm (s + 1) (translatedIntegerBox a T) f → + ∃ V : NativeSampleCorrelation (fun _ : Fin n => 1) s ((p + C) ^ C) + (translatedIntegerBox a T) id f, V.test.normBound ≤ 1 := by + obtain ⟨C, hC, hinverse⟩ := exists_native_integer_box_inverse_bounded_dimension s hs D + refine ⟨C, hC, ?_⟩ + intro n a T _ p hp hn f hf hGowers + have hshift : ∀ x ∈ integerBox T, ‖f (a + x)‖ ≤ 1 := by + intro x hx + apply hf + exact Finset.mem_image.mpr ⟨x, hx, rfl⟩ + rw [translatedIntegerBox_norm_eq] at hGowers + obtain ⟨V, hV⟩ := hinverse T hp hn (fun x => f (a + x)) hshift hGowers + exact ⟨V.translateInput a, hV⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NativeTripleObservableMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NativeTripleObservableMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca01b90dac6ca753bb12565679d9fd09711b6dbd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NativeTripleObservableMetric.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeDilationDescent + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem lipschitz_three_conjugates_of_bounds {X : Type*} [PseudoMetricSpace X] + (f : Fin 3 → X → ℂ) {K : ℝ≥0} (hf : ∀ j, LipschitzWith K (f j)) + (hbound : ∀ j x, ‖f j x‖ ≤ 1) : + LipschitzWith (3 * K) (fun x => f 0 x * star (f 1 x) * star (f 2 x)) := by + have h01 := lipschitz_mul_star_of_bounds (f 0) (f 1) + (Bf := 1) (Bg := 1) (hf 0) (hf 1) (hbound 0) (hbound 1) + have hb01 (x : X) : ‖f 0 x * star (f 1 x)‖ ≤ 1 := by + simpa only [norm_mul, norm_star, mul_one] using + mul_le_mul (hbound 0 x) (hbound 1 x) (norm_nonneg _) (by norm_num : (0 : ℝ) ≤ 1) + have h := lipschitz_mul_star_of_bounds (fun x => f 0 x * star (f 1 x)) (f 2) + (Bf := 1) (Bg := 1) h01 (hf 2) hb01 (hbound 2) + convert h using 1 + ring + +namespace RationalFilteredNilmanifold.MultidegreeStructure + +open scoped TensorProduct + +variable {σ L : Type*} [Fintype σ] [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] + {s d r : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (M : D.MultidegreeStructure bound) + +theorem tripleObservable_lipschitz (i : σ) (hi : bound i ≤ 1) + (c : σ → ℕ) (hc : ∀ j, c j ≤ 1) + (E : RationalFilteredNilmanifold (M.filtration.additiveTripleSubalgebra i hi c hc) s r) + (hEL : E.lattice = M.additiveTripleLattice i hi c hc) + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.additiveTripleSubalgebra i hi c hc)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.additiveTripleSubalgebra i hi c hc)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.additiveTripleSubalgebra i hi c hc)] + [T2Space (ℝ ⊗[ℚ] M.filtration.additiveTripleSubalgebra i hi c hc)] + {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) (hE : E.GeometryComplexityLE p) + (hheight : ∀ j a k, rationalLogHeight + (D.basis.repr (M.filtration.additiveTripleProjection i hi c hc j (E.basis a)) k) ≤ p) + (ε : D.RealGroup) (u : Fin 3 → D.Space → ℂ) (K A : ℝ≥0) + (hu : ∀ j x, ‖u j x‖ ≤ 1) + (hLip : letI := D.metricSpace; ∀ j, LipschitzWith K (u j)) + (hε : letI := D.metricSpace; LipschitzWith A (fun x : D.Space => ε • x)) : + letI := E.metricSpace + LipschitzWith (3 * (K * (A * ⟨Real.exp ((p + 3) ^ 2), (Real.exp_pos _).le⟩))) + (M.tripleObservable i hi c hc E hEL ε u) := by + let := E.metricSpace + let := D.metricSpace + apply lipschitz_three_conjugates_of_bounds + (fun j x => u j (ε • M.tripleSpaceProjection i hi c hc E hEL j x)) + · intro j + exact (hLip j).comp (hε.comp + (M.tripleSpaceProjection_lipschitz i hi c hc E hEL j hp hD hE (hheight j))) + · exact fun j x => hu j _ + +end RationalFilteredNilmanifold.MultidegreeStructure +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NaturalWindowCoordinateBound.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NaturalWindowCoordinateBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4971882937b1836b954efd59efdada6dbe6d1b6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NaturalWindowCoordinateBound.lean @@ -0,0 +1,24 @@ +import OAI.Combinatorics.Progressions.Lattices.NaturalScaleIntegerWindow + +namespace OAI + +section + +namespace Erdos3 + +theorem naturalScaleIntegerWindow_coordinate_bound {J : Type*} [Fintype J] + {H : ℝ} (hH : 0 ≤ H) {N : ℕ} (hN : 0 < N) + {z : J → ℤ} (hz : z ∈ naturalScaleIntegerWindow J H N) (j : J) : + |(z j : ℝ)| ≤ (H + 1) * N := by + classical + have hc := (mem_centeredIntegerBox _ _).mp hz j + have hc' : |(z j : ℝ)| ≤ (⌈H * (N : ℝ)⌉₊ : ℝ) := by exact_mod_cast hc + have hr := Nat.ceil_lt_add_one (mul_nonneg hH (Nat.cast_nonneg N)) + have hN' : (1 : ℝ) ≤ N := by exact_mod_cast hN + nlinarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NestedBoxReindex.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NestedBoxReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..456de6b7ceb08360c6a7d231345ea46e7d6a040f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NestedBoxReindex.lean @@ -0,0 +1,32 @@ +import OAI.Combinatorics.Progressions.Estimates.NestedProgressionReindex +import OAI.Combinatorics.Progressions.Probability.ProductSliceAxisDensity + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_nested_box_affine {I : Type*} [Fintype I] [DecidableEq I] + (c b : I → ℤ) {m d : ℕ} (hm : 0 < m) (hd : 0 < d) + (H L : I → ℕ) (hL : ∀ i, 0 < L i) + (hsub : commonStrideBox b d L ⊆ commonStrideBox c m H) : + ∃ (A : I → I → ℤ) (a : I → ℤ), ∀ x ∈ integerBox L, + integerAffineMap A a x ∈ integerBox H ∧ + commonStridePoint b d x = commonStridePoint c m (integerAffineMap A a x) := by + have haxis (i : I) : (integerProgressionSupport (b i) d (L i)).Nonempty := + Finset.card_pos.mp (by simpa only [card_integerProgressionSupport _ _ _ hd] using hL i) + have hcoord (i : I) := piFinset_axis_subset _ _ haxis hsub i + choose a s ha using fun i => exists_nested_progression_affine (c i) (b i) hm hd (hL i) (hcoord i) + refine ⟨(fun i j => if i = j then s i else 0), a, fun x hx => ?_⟩ + rw [integerAffineMap_diagonal] + have hb (i : I) := ha i (x i) ((mem_integerBox L x).mp hx i).1 ((mem_integerBox L x).mp hx i).2 + refine ⟨(mem_integerBox H _).mpr (fun i => ⟨(hb i).1, (hb i).2.1⟩), ?_⟩ + funext i + exact (hb i).2.2 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedChartLift.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedChartLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..e014c52747d70d982738f0825c655a6fdfe81155 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedChartLift.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Estimates.NormalizedCoefficientRemainder + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule + +variable {D : Type*} [Fintype D] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) +variable (hb : span ℤ (Set.range b) = projectedIntegerLattice W) + +theorem normalizedLatticeQuotient_eq_of_sub_mem (u : W) (x : W × (Fin n → ℤ)) + (hx : u.val - normalizedLatticePoint W b x ∈ standardEuclideanLattice D) : + QuotientAddGroup.mk' (latticeSection (standardEuclideanLattice D) W).toAddSubgroup u = + normalizedLatticeQuotient W b hb x := by + let z := latticeBasisEquiv (projectedIntegerLattice W) b hb x.2 + let v : W := x.1 - projectedLatticeShift (standardEuclideanLattice D) W z + have hv : QuotientAddGroup.mk' + (latticeSection (standardEuclideanLattice D) W).toAddSubgroup v = + normalizedLatticeQuotient W b hb x := rfl + have hdiff := normalizedLatticePoint_sub_mem_of_mk_eq W b hb v x hv + have hm : (u - v).val ∈ standardEuclideanLattice D := by + convert (standardEuclideanLattice D).sub_mem hx hdiff using 1 + simp only [Submodule.coe_sub] + abel + exact (QuotientAddGroup.eq_iff_sub_mem.mpr hm).trans hv + +theorem exists_normalized_chart_lift (u : W) (v : EuclideanSpace ℝ D) + (hv : u.val - v ∈ standardEuclideanLattice D) : + ∃ x : W × (Fin n → ℤ), normalizedLatticePoint W b x = v ∧ + normalizedLatticeQuotient W b hb x = + QuotientAddGroup.mk' (latticeSection (standardEuclideanLattice D) W).toAddSubgroup u := by + have hproj : Wᗮ.orthogonalProjectionOnto v ∈ span ℤ (Set.range b) := by + rw [hb] + apply (projectedIntegerLattice W).neg_mem_iff.mp + change -(Wᗮ.orthogonalProjectionOnto v) ∈ + (standardEuclideanLattice D).map (Wᗮ.orthogonalProjectionOnto.toLinearMap.restrictScalars ℤ) + refine ⟨u.val - v, hv, ?_⟩ + change Wᗮ.orthogonalProjectionOnto (u.val - v) = -Wᗮ.orthogonalProjectionOnto v + rw [map_sub, Wᗮ.orthogonalProjectionOnto_eq_zero_iff.mpr (by simp), zero_sub] + obtain ⟨z, hz⟩ := normalizedOrthogonalChart_integer_coordinates W b v hproj + let x : W × (Fin n → ℤ) := ((normalizedOrthogonalChart W b v).1, z) + have hx : normalizedLatticePoint W b x = v := by + apply (normalizedOrthogonalChart W b).injective + change (normalizedOrthogonalChart W b) ((normalizedOrthogonalChart W b).symm + ((normalizedOrthogonalChart W b v).1, fun i => (z i : ℝ) / basisAxisScale b i)) = _ + rw [ContinuousLinearEquiv.apply_symm_apply] + exact Prod.ext rfl (funext (fun i => (hz i).symm)) + refine ⟨x, hx, (normalizedLatticeQuotient_eq_of_sub_mem W b hb u x ?_).symm⟩ + rwa [hx] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedCoordinateCutoff.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedCoordinateCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..410b8b69342e940e909fd9d99622fb71b2f2104a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedCoordinateCutoff.lean @@ -0,0 +1,30 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedScalarStructuralBasePower + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal ContDiff + +noncomputable def normalizedCoordinateCutoff (D : Type*) [Fintype D] + (r : ℝ≥0) (hr : 0 < r) : (D → ℝ) → ℝ := + Classical.choose (exists_normalized_site_cutoff (D := D) r hr) + +theorem normalizedCoordinateCutoff_spec (D : Type*) [Fintype D] + (r : ℝ≥0) (hr : 0 < r) : + ContDiff ℝ ∞ (normalizedCoordinateCutoff D r hr) ∧ + HasCompactSupport (normalizedCoordinateCutoff D r hr) ∧ + (∀ v, 0 ≤ normalizedCoordinateCutoff D r hr v ∧ normalizedCoordinateCutoff D r hr v ≤ 1) ∧ + (∀ v, (∀ d, |v d| ≤ (r : ℝ)) → normalizedCoordinateCutoff D r hr v = 1) ∧ + (∀ v, normalizedCoordinateCutoff D r hr v ≠ 0 → ∀ d, |v d| ≤ 2 * (r : ℝ)) ∧ + LipschitzWith (Fintype.card D * normalizedSiteCutoffBound / (2 * r)) + (normalizedCoordinateCutoff D r hr) := + Classical.choose_spec (exists_normalized_site_cutoff (D := D) r hr) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedCoveredChart.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedCoveredChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..849df08941ef7e96b7633e9ae267b1f949c74a01 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedCoveredChart.lean @@ -0,0 +1,69 @@ +import OAI.Combinatorics.Progressions.Estimates.CanonicalCoefficientCoverLift +import OAI.Combinatorics.Progressions.Linear.KernelLiftChart + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule MeasureTheory +open scoped Classical + +variable {D R : Type*} [Fintype D] [Fintype R] {n : ℕ} +variable (W : Submodule ℝ (EuclideanSpace ℝ D)) (b : Basis (Fin n) ℝ Wᗮ) +variable (hb : span ℤ (Set.range b) = projectedIntegerLattice W) +variable (bW : Basis R ℤ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup) +variable (d : ℕ) [NeZero d] + +noncomputable def normalizedCoveredChart (p : (W × (Fin n → ℤ)) × (R → ZMod d)) : + W ⧸ (latticeSection (standardEuclideanLattice D) W).toAddSubgroup := + normalizedCoverLift W b hb d p.1 + + (coverKernelBasisEquiv (latticeSection (standardEuclideanLattice D) W).toAddSubgroup + bW d (Nat.pos_of_ne_zero (NeZero.ne d)) p.2).val + +theorem normalizedCoveredChart_continuous : + Continuous (normalizedCoveredChart W b hb bW d) := by + have hk : Continuous (fun r : R → ZMod d => + (coverKernelBasisEquiv (latticeSection (standardEuclideanLattice D) W).toAddSubgroup + bW d (Nat.pos_of_ne_zero (NeZero.ne d)) r).val) := continuous_of_discreteTopology + exact ((normalizedCoverLift_continuous W b hb d).comp continuous_fst).add + (hk.comp continuous_snd) + +theorem normalizedCoveredChart_injOn + {Ω : Set (EuclideanSpace ℝ D)} (hΩ : Ω ⊆ standardLatticeSmallBox D) : + Set.InjOn (normalizedCoveredChart W b hb bW d) + ((normalizedLatticePoint W b ⁻¹' Ω) ×ˢ Set.univ) := + kernelLiftChart_relabel_injOn _ _ _ + (coverKernelBasisEquiv _ bW d (Nat.pos_of_ne_zero (NeZero.ne d))).toEquiv + (normalizedCoverLift_projection W b hb d (Nat.pos_of_ne_zero (NeZero.ne d))) + (normalizedLatticeQuotient_injOn W b hb hΩ) + +theorem normalizedCoveredChart_image (Ω : Set (EuclideanSpace ℝ D)) : + normalizedCoveredChart W b hb bW d '' + ((normalizedLatticePoint W b ⁻¹' Ω) ×ˢ Set.univ) = + quotientIntegerCover (latticeSection (standardEuclideanLattice D) W).toAddSubgroup d ⁻¹' + normalizedChartRegion W b hb Ω := + kernelLiftChart_relabel_image _ _ _ + (coverKernelBasisEquiv _ bW d (Nat.pos_of_ne_zero (NeZero.ne d))).toEquiv + (normalizedCoverLift_projection W b hb d (Nat.pos_of_ne_zero (NeZero.ne d))) _ + +theorem normalizedCoveredChart_embedding + {Ω : Set (EuclideanSpace ℝ D)} (hΩm : MeasurableSet Ω) + (hΩ : Ω ⊆ standardLatticeSmallBox D) : + MeasurableEmbedding (fun p : (normalizedLatticePoint W b ⁻¹' Ω) ×ˢ + (Set.univ : Set (R → ZMod d)) => normalizedCoveredChart W b hb bW d p.val) := by + let Λ := latticeSection (standardEuclideanLattice D) W + let : DiscreteTopology Λ.toAddSubgroup := latticeSection_discrete (standardEuclideanLattice D) W + let : IsClosed (Λ.toAddSubgroup : Set W) := AddSubgroup.isClosed_of_discreteTopology + let : BorelSpace (W ⧸ Λ.toAddSubgroup) := QuotientAddGroup.borelSpace + exact ContinuousOn.measurableEmbedding + ((hΩm.preimage (normalizedLatticePoint_continuous W b).measurable).prod MeasurableSet.univ) + (normalizedCoveredChart_continuous W b hb bW d).continuousOn + (normalizedCoveredChart_injOn W b hb bW d hΩ) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedMarkedChart.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedMarkedChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..a48f99f83799fdbce27511d0dd4fdf971275ce80 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedMarkedChart.lean @@ -0,0 +1,143 @@ +import OAI.Combinatorics.Progressions.Lattices.LocalMarkedLatticeCorrection +import OAI.Combinatorics.Progressions.Polynomial.LocalPhaseMarkedObservable + +namespace OAI + +section + +namespace Erdos3 + +open NilpotentLieBCHGroup +open scoped TensorProduct BigOperators + +variable {I L : Type*} [LieRing L] [LieAlgebra ℚ L] {s r : ℕ} + (F : DegreeRankLieFiltration L s r) (v : I → L) (w : I → ℕ) (marked : I → Bool) (t m : ℕ) + +theorem normalizedMarkedPhase_real_parameter (a : Fin t → ℝ) : + torusPhaseLinear (normalizedMarkedPhase F v w marked t m) + (realMarkedParameterDirection F v w marked t a) = fun i => (m : ℝ)⁻¹ * a i := by + classical + have hsingle (j i : Fin t) : + torusPhaseLinear (normalizedMarkedPhase F v w marked t m) + (realMarkedDirection F v w marked t (Pi.single j 1)) i = + (m : ℝ)⁻¹ * (if j = i then 1 else 0) := by + change torusPhaseLinear (normalizedMarkedPhase F v w marked t m) + ((1 : ℝ) ⊗ₜ[ℚ] markedQuotientDirection F v w marked t (Pi.single j 1)) i = _ + rw [torusPhaseLinear_tmul, _root_.one_mul, normalizedMarkedPhase_apply, + markedQuotientPhase_direction] + change (((m : ℚ)⁻¹ * (Pi.single j (1 : ℚ) : Fin t → ℚ) i : ℚ) : ℝ) = _ + by_cases hji : j = i + · subst j + simp + · have hij : i ≠ j := Ne.symm hji + simp [hji, hij] + rw [realMarkedParameterDirection_apply, map_sum] + funext i + simp only [Finset.sum_apply, map_smul, Pi.smul_apply, smul_eq_mul, hsingle] + simp [mul_comm] + +theorem normalizedMarkedPhase_real_scaled_parameter (hm : 0 < m) (a : Fin t → ℝ) : + torusPhaseLinear (normalizedMarkedPhase F v w marked t m) + (realMarkedParameterDirection F v w marked t ((m : ℝ) • a)) = a := by + rw [normalizedMarkedPhase_real_parameter] + funext i + simp only [Pi.smul_apply, smul_eq_mul, ← mul_assoc, + inv_mul_cancel₀ (by exact_mod_cast hm.ne' : (m : ℝ) ≠ 0), _root_.one_mul] + +theorem normalizedMarkedPhase_real_pure + (z : ℝ ⊗[ℚ] MarkedShiftQuotient F v w marked t) + (hz : z ∈ (markedQuotientPolynomialAlgebra F v w marked t).toSubmodule.baseChange ℝ) : + torusPhaseLinear (normalizedMarkedPhase F v w marked t m) z = 0 := by + have hker : (markedQuotientPolynomialAlgebra F v w marked t).toSubmodule ≤ + LinearMap.ker (normalizedMarkedPhase F v w marked t m).toLinearMap := by + intro x hx + change markedQuotientPhase F v w marked t x = 0 at hx + change normalizedMarkedPhase F v w marked t m x = 0 + rw [normalizedMarkedPhase_apply, hx, smul_zero] + have h := Submodule.baseChange_mono ℝ hker hz + rw [realification_ker, LinearMap.mem_ker] at h + change ((RationalTorus.basis t).baseChange ℝ).equivFun + ((normalizedMarkedPhase F v w marked t m).toLinearMap.baseChange ℝ z) = 0 + rw [h, map_zero] + +end Erdos3 + +namespace Erdos3.NativeRankRelation.CommonData + +open NilpotentLieBCHGroup +open scoped TensorProduct + +attribute [local instance] NativeDegreeRankFamily.lie NativeDegreeRankFamily.algebra + NativeDegreeRankFamily.topology NativeDegreeRankFamily.topologicalAdd + NativeDegreeRankFamily.continuousSMul NativeDegreeRankFamily.hausdorff + NativeIntegerExpansion.lie NativeIntegerExpansion.algebra + NativeIntegerExpansion.topology NativeIntegerExpansion.topologicalAdd + NativeIntegerExpansion.continuousSMul NativeIntegerExpansion.hausdorff + +theorem localPhaseMarkedOrbit_centered_phase + {s r N d : ℕ} [NeZero N] {b p q P : ℝ} + {W : NativeDegreeRankFamily s r (ZMod N) b} {out : Fin W.outputDim} + {H : Finset (ZMod N)} {R : NativeRankRelation W out H p q} (D : R.CommonData P) + (t : ℕ) (x : ∀ j : Fin s, (D.coefficientFreeSpan j).baseChange ℝ) + (y : ∀ j : Fin s, Fin t → (D.dependentFreeSpan j).baseChange ℝ) + (u c : Fin t → ℝ) (h₀ : ZMod N) (m : ℕ) (hm : 0 < m) (hs : 1 ≤ s) + (E : RationalFilteredNilmanifold + (MarkedShiftQuotient D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t) (s + 1) d) + (hphase : ∀ z : E.filtration.Group, z ∈ E.lattice → + IntegralVector (normalizedMarkedPhase D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t m z.coord)) + (hdir : ∀ a : Fin t → ℤ, + (⟨(m : ℚ) • markedQuotientDirection D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t (fun i => (a i : ℚ))⟩ : + E.filtration.Group) ∈ E.lattice) + (h : ZMod N) (hsmall : ∀ i, |affineCyclicTorusLocalLift u c h₀ h i| ≤ 1 / 4) (n : ℤ) : + nativeTorusLocalLift E + (normalizedMarkedPhase D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t m) hphase + (QuotientGroup.mk ((D.markedQuotientMultidegree t).realification.polynomialOrbitEval + (correlationInput (h.val : ℤ) n) (D.localPhaseMarkedOrbit t x y u c h₀ m))) = + fun i => -affineCyclicTorusLocalLift u c h₀ h i := by + let φ := normalizedMarkedPhase D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t m + let g : E.RealGroup := (D.markedQuotientMultidegree t).realification.polynomialOrbitEval + (correlationInput (h.val : ℤ) n) (D.localPhaseMarkedOrbit t x y u c h₀ m) + let γ : E.RealGroup := D.scaledLocalAffineCorrectingElement t u c h₀ m h + let ε : E.RealGroup := D.localPhaseMarkedSmallElement t u c h₀ m h + let z : E.RealGroup := + ⟨(lieQuotientMap (markedShiftSecondIdeal D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t)).toLinearMap.baseChange ℝ + (D.localPhaseMarkedLift t x y u c h₀ m h n)⟩ + have hγ : γ ∈ E.realLattice := D.scaledLocalAffineCorrectingElement_mem_realLattice + t u c h₀ m E hdir h + have hcoset : (QuotientGroup.mk g : E.Space) = QuotientGroup.mk (ε * z) := by + calc + _ = QuotientGroup.mk (g * γ⁻¹) := + (quotient_mk_mul_mem E.realLattice g ⟨γ⁻¹, E.realLattice.inv_mem hγ⟩).symm + _ = _ := congrArg QuotientGroup.mk (D.localPhaseMarkedOrbit_lift_factorization t x y u c h₀ m hs h n) + have hz : torusPhaseLinear φ z.coord = 0 := normalizedMarkedPhase_real_pure + D.coefficientFreeFiltration D.coefficientFreeGenerator D.coefficientWeight D.coefficientIsDependent + t m z.coord (D.localPhaseMarkedLift_pure t x y u c h₀ m h n) + have hε : torusPhaseLinear φ ε.coord = fun i => -affineCyclicTorusLocalLift u c h₀ h i := by + change torusPhaseLinear φ + (realMarkedParameterDirection D.coefficientFreeFiltration D.coefficientFreeGenerator + D.coefficientWeight D.coefficientIsDependent t + (fun i => -(m : ℝ) * affineCyclicTorusLocalLift u c h₀ h i)) = _ + rw [normalizedMarkedPhase_real_parameter] + funext i + field_simp [show (m : ℝ) ≠ 0 by exact_mod_cast hm.ne'] + have htotal : torusPhaseLinear φ (ε * z).coord = + fun i => -affineCyclicTorusLocalLift u c h₀ h i := by + rw [torusPhaseLinear_mul E φ, hz, add_zero, hε] + change nativeTorusLocalLift E φ hphase (QuotientGroup.mk g) = _ + rw [hcoset] + apply (nativeTorusLocalLift_mk E φ hphase (ε * z) ?_).trans htotal + intro i + rw [htotal] + simpa only [abs_neg] using hsmall i + +end Erdos3.NativeRankRelation.CommonData + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedMinorCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedMinorCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8010318085a11e2deb075b1c52d85e4e9f1f9ae --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedMinorCoordinates.lean @@ -0,0 +1,45 @@ +import OAI.Combinatorics.Progressions.Estimates.LowerTriangularMinor + +namespace OAI + +section + +namespace Erdos3 + +open scoped Matrix + +theorem row_normalization_entry {K ι : Type*} [Field K] {k : ℕ} + (H : Matrix ι (Fin k) K) (p : Fin k → ι) (hp : (H.submatrix p id).det ≠ 0) + (i : ι) (j : Fin k) : + (H * (H.submatrix p id)⁻¹) i j = + (H.submatrix (Function.update p j i) id).det / (H.submatrix p id).det := by + have h := row_minor_update_det H p (H * (H.submatrix p id)⁻¹) + (Matrix.nonsing_inv_mul_cancel_right (H.submatrix p id) H (isUnit_iff_ne_zero.mpr hp)) i j + exact (eq_div_iff hp).mpr h.symm + +theorem row_normalization_submatrix {K ι : Type*} [Field K] {k : ℕ} + (H : Matrix ι (Fin k) K) (p : Fin k → ι) (hp : (H.submatrix p id).det ≠ 0) : + (H * (H.submatrix p id)⁻¹).submatrix p id = 1 := by + rw [Matrix.submatrix_mul H (H.submatrix p id)⁻¹ p id id Function.bijective_id, + Matrix.submatrix_id_id] + exact Matrix.mul_nonsing_inv _ (isUnit_iff_ne_zero.mpr hp) + +theorem row_normalization_col_span {K ι : Type*} [Field K] {k : ℕ} + (H : Matrix ι (Fin k) K) (p : Fin k → ι) (hp : (H.submatrix p id).det ≠ 0) : + Submodule.span K (Set.range (H * (H.submatrix p id)⁻¹).col) = + Submodule.span K (Set.range H.col) := by + let B := H.submatrix p id + have hsurj : Function.Surjective B⁻¹.mulVecLin := by + intro x + refine ⟨B *ᵥ x, ?_⟩ + change B⁻¹ *ᵥ (B *ᵥ x) = x + rw [Matrix.mulVec_mulVec, Matrix.nonsing_inv_mul B (isUnit_iff_ne_zero.mpr hp), + Matrix.one_mulVec] + rw [← Matrix.range_mulVecLin, ← Matrix.range_mulVecLin, Matrix.mulVecLin_mul] + exact LinearMap.range_comp_of_range_eq_top _ (LinearMap.range_eq_top.mpr hsurj) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedRestrictionTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedRestrictionTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..36c4719012187cd6c3cf7c3e78d5897b60d9950e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedRestrictionTransport.lean @@ -0,0 +1,35 @@ +import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar +import Mathlib.MeasureTheory.Measure.Restrict + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ENNReal + +theorem normalizedRestriction_map_equiv {X Y : Type*} + [MeasurableSpace X] [MeasurableSpace Y] (e : X ≃ᵐ Y) + (μ : Measure X) (ν : Measure Y) {c : ℝ≥0∞} (hc : c ≠ 0) (hcfin : c ≠ ⊤) + (hmap : μ.map e = c • ν) (s : Set X) : + ((μ s)⁻¹ • μ.restrict s).map e = + (ν (e '' s))⁻¹ • ν.restrict (e '' s) := by + have hm : μ s = c * ν (e '' s) := by + have h := congrArg (fun m : Measure Y => m (e '' s)) hmap + simpa only [e.map_apply, Set.preimage_image_eq _ e.injective, + Measure.smul_apply, smul_eq_mul] using h + have hr : (μ.restrict s).map e = c • ν.restrict (e '' s) := by + have h := e.restrict_map μ (e '' s) + rw [hmap, Measure.restrict_smul, Set.preimage_image_eq _ e.injective] at h + exact h.symm + rw [Measure.map_smul _ e.measurable.aemeasurable, hr, hm, smul_smul, + ENNReal.mul_inv (Or.inl hc) (Or.inl hcfin), mul_right_comm, + ENNReal.inv_mul_cancel hc hcfin, one_mul] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialAmplitudeShift.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialAmplitudeShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..e521655d83f10ed6705d7aaf8ecf5735ab15d6d5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialAmplitudeShift.lean @@ -0,0 +1,52 @@ +import Mathlib.Analysis.Complex.Basic +import OAI.Combinatorics.Progressions.Estimates.PartialComplexScaledQuadrature + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem rectangularLatticePoint_add_displacement {I : Type*} [Fintype I] + (a S : I → ℝ) (x v : I → ℤ) : + rectangularLatticePoint a S (x + v) - rectangularLatticePoint a S x = + rectangularLatticePoint 0 S v := by + funext i + simp only [rectangularLatticePoint, Pi.sub_apply, Pi.add_apply, Pi.zero_apply, + Int.cast_add] + ring + +theorem normalizedSpatialAmplitude_shift_le {I E : Type*} [Fintype I] + [NormedAddCommGroup E] (F : (I → ℝ) → E) {L : ℝ≥0} + (hF : LipschitzWith L F) (a S : I → ℝ) (x v : I → ℤ) : + ‖F (rectangularLatticePoint a S (x + v)) - F (rectangularLatticePoint a S x)‖ ≤ + L * ‖rectangularLatticePoint 0 S v‖ := by + have h := hF.norm_sub_le (rectangularLatticePoint a S (x + v)) + (rectangularLatticePoint a S x) + rwa [rectangularLatticePoint_add_displacement] at h + +theorem normalizedSpatialAmplitude_shift_le_of_norm_le {I E : Type*} [Fintype I] + [NormedAddCommGroup E] (F : (I → ℝ) → E) {L : ℝ≥0} + (hF : LipschitzWith L F) (a S : I → ℝ) (x v : I → ℤ) + {r : ℝ} (hv : ‖rectangularLatticePoint 0 S v‖ ≤ r) : + ‖F (rectangularLatticePoint a S (x + v)) - F (rectangularLatticePoint a S x)‖ ≤ + L * r := + (normalizedSpatialAmplitude_shift_le F hF a S x v).trans + (mul_le_mul_of_nonneg_left hv L.coe_nonneg) + +theorem normalizedSpatialRealAmplitude_cast_shift_le {I : Type*} [Fintype I] + (F : (I → ℝ) → ℝ) {L : ℝ≥0} (hF : LipschitzWith L F) + (a S : I → ℝ) (x v : I → ℤ) {r : ℝ} + (hv : ‖rectangularLatticePoint 0 S v‖ ≤ r) : + ‖(F (rectangularLatticePoint a S (x + v)) : ℂ) - + (F (rectangularLatticePoint a S x) : ℂ)‖ ≤ L * r := by + rw [← Complex.ofReal_sub, Complex.norm_real] + exact normalizedSpatialAmplitude_shift_le_of_norm_le F hF a S x v hv + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialChoiceBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialChoiceBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..396c09c7b9f5c464298e9053de7b8c339e517bf2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialChoiceBudget.lean @@ -0,0 +1,197 @@ +import OAI.Combinatorics.Progressions.Dynamics.VectorSiteBudget + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def normalizedSpatialShare (E : ℝ) : ℝ := Real.exp (-(E + 2)) + +noncomputable def normalizedSpatialSiteAccuracy (V E : ℝ) : ℝ := + normalizedSpatialShare E / (2 * (1 + V)) + +noncomputable def normalizedSpatialPointAccuracy (n : ℕ) (G C V E : ℝ) : ℝ := + vectorSpatialAccuracy n (2 + G * C) (normalizedSpatialSiteAccuracy V E) + +noncomputable def normalizedSpatialResolution (threshold A movement boundary eta radius share : ℝ) : ℝ := + twoTermErrorResolution (threshold + movement / radius + 2 * boundary / share) A (eta / 2) + +theorem normalizedSpatial_error_choices (n : ℕ) {G C K V E threshold A B movement boundary : ℝ} + (hG : 0 ≤ G) (hC : 0 ≤ C) (hK : 0 ≤ K) (hV : 0 ≤ V) (hE : 0 ≤ E) + (hthreshold : 0 ≤ threshold) (hA : 0 ≤ A) (hB : 0 ≤ B) + (hmovement : 0 ≤ movement) (hboundary : 0 ≤ boundary) : + let share := normalizedSpatialShare E + let eta := normalizedSpatialPointAccuracy n G C V E + let radius := spatialSiteRadius G K eta + let xi := twoTermErrorWidth B (eta / 2) + let rho := normalizedSpatialResolution threshold A movement boundary eta radius share + 0 < eta ∧ 0 < radius ∧ 0 < xi ∧ xi ≤ 1 ∧ 0 < rho ∧ threshold ≤ rho ∧ movement ≤ radius * rho ∧ + ∀ gamma volume Z : ℝ, 0 ≤ gamma → gamma ≤ G → 0 ≤ volume → volume ≤ V → 1 / 2 ≤ Z → + let Eone := A / rho + B * xi + gamma * K * radius + let Esite := (n : ℝ) * (Eone + 4 * gamma * K * radius) * (1 + gamma * C + Eone) ^ n + boundary / rho / Z + Esite * volume / Z + share ≤ Real.exp (-E) := by + intro share eta radius xi rho + have hshare : 0 < share := Real.exp_pos _ + have hshare1 : share ≤ 1 := Real.exp_le_one_iff.mpr (by linarith) + have hacc : 0 < normalizedSpatialSiteAccuracy V E := div_pos hshare (by positivity) + have haccShare : normalizedSpatialSiteAccuracy V E ≤ share / 2 := by + unfold normalizedSpatialSiteAccuracy + apply (div_le_iff₀ (by positivity : 0 < 2 * (1 + V))).mpr + dsimp only [share] + nlinarith [mul_nonneg hshare.le hV] + have hacc1 : normalizedSpatialSiteAccuracy V E ≤ 1 := by linarith + have heta : 0 < eta := vectorSpatialAccuracy_pos n (by positivity) hacc + have hradius : 0 < radius := spatialSiteRadius_pos hG hK heta + have hT : 0 ≤ threshold + movement / radius + 2 * boundary / share := by positivity + obtain ⟨hrho, hTrho, hxi, hxi1, hsmall⟩ := twoTermErrorChoices_spec hT hA hB (half_pos heta) + change 0 < rho at hrho + change threshold + movement / radius + 2 * boundary / share ≤ rho at hTrho + change 0 < xi at hxi + change xi ≤ 1 at hxi1 + change A / rho + B * xi ≤ eta / 2 at hsmall + have hthresholdRho : threshold ≤ rho := by + have hm : 0 ≤ movement / radius := div_nonneg hmovement hradius.le + have hb : 0 ≤ 2 * boundary / share := by positivity + linarith + have hmoveRho : movement / radius ≤ rho := by + have hb : 0 ≤ 2 * boundary / share := by positivity + linarith + have hmove : movement ≤ radius * rho := by + have hh := (div_le_iff₀ hradius).mp hmoveRho + nlinarith + have hboundaryRho : 2 * boundary / share ≤ rho := by + have hm : 0 ≤ movement / radius := div_nonneg hmovement hradius.le + linarith + have hbhalf : boundary / rho ≤ share / 2 := by + have hh := (div_le_iff₀ hshare).mp hboundaryRho + apply (div_le_iff₀ hrho).mpr + nlinarith + refine ⟨heta, hradius, hxi, hxi1, hrho, hthresholdRho, hmove, ?_⟩ + intro gamma volume Z hgamma hgammaG hvolume hvolumeV hZ Eone Esite + have hZpos : 0 < Z := by linarith + have hEzero : 0 ≤ A / rho + B * xi := by positivity + have hrad : 4 * G * K * radius ≤ eta := spatialSiteRadius_error hG hK heta.le + have hEbig : 0 ≤ A / rho + B * xi + G * K * radius := by positivity + have hEbigSmall : A / rho + B * xi + G * K * radius ≤ eta := by linarith + have hEone : 0 ≤ Eone := by dsimp only [Eone]; positivity + have hEoneBig : Eone ≤ A / rho + B * xi + G * K * radius := by + dsimp only [Eone] + gcongr + have hsite : Esite ≤ normalizedSpatialSiteAccuracy V E := by + apply le_trans _ (vectorSpatialSiteError_le n hG hC hK hEbig hacc hacc1 hEbigSmall) + dsimp only [Esite] + gcongr + exact le_rfl + have hsite0 : 0 ≤ Esite := by dsimp only [Esite]; positivity + have hsiteVolume : Esite * volume ≤ share / 2 := by + apply (mul_le_mul hsite hvolumeV hvolume (by positivity)).trans + have hden : 0 < 2 * (1 + V) := by positivity + change (normalizedSpatialShare E / (2 * (1 + V))) * V ≤ share / 2 + rw [div_mul_eq_mul_div] + apply (div_le_iff₀ hden).mpr + change normalizedSpatialShare E * V ≤ _ + dsimp only [share] + nlinarith [Real.exp_pos (-(E + 2))] + have hb : boundary / rho / Z ≤ share := by + apply (div_le_iff₀ hZpos).mpr + nlinarith + have hs : Esite * volume / Z ≤ share := by + apply (div_le_iff₀ hZpos).mpr + nlinarith + have hthree : 3 * share ≤ Real.exp (-E) := by + calc + _ ≤ Real.exp 2 * share := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (2 : ℝ)]) hshare.le + _ = _ := by + dsimp only [share, normalizedSpatialShare] + rw [← Real.exp_add] + congr 1 + ring + linarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +def normalizedSpatialPointLog {A : Type*} [Semiring A] (P E : A) : A := + (P + 1) * (3 * P + E + 8) + P + 1 + +theorem normalizedSpatialPointLog_nonneg {P E : ℝ} (hP : 0 ≤ P) (hE : 0 ≤ E) : + 0 ≤ normalizedSpatialPointLog P E := by + unfold normalizedSpatialPointLog + positivity + +theorem normalizedSpatialSiteAccuracy_inv_exp {V P E : ℝ} + (hV : 0 ≤ V) (hP : 0 ≤ P) (hVP : V ≤ Real.exp P) : + (normalizedSpatialSiteAccuracy V E)⁻¹ ≤ Real.exp (P + E + 4) := by + have hplus := one_add_le_exp_succ hP hVP + have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + unfold normalizedSpatialSiteAccuracy normalizedSpatialShare + rw [inv_div, div_eq_mul_inv, ← Real.exp_neg, neg_neg] + calc + _ ≤ (Real.exp 1 * Real.exp (P + 1)) * Real.exp (E + 2) := by gcongr + _ = _ := by simp only [← Real.exp_add]; congr 1; ring + +theorem normalizedSpatialPointAccuracy_inv_exp (n : ℕ) {G C V P E : ℝ} + (hG : 0 ≤ G) (hC : 0 ≤ C) (hV : 0 ≤ V) (hP : 0 ≤ P) (hE : 0 ≤ E) + (hn : (n : ℝ) ≤ P) (hGP : G ≤ Real.exp P) (hCP : C ≤ Real.exp P) (hVP : V ≤ Real.exp P) : + (normalizedSpatialPointAccuracy n G C V E)⁻¹ ≤ Real.exp (normalizedSpatialPointLog P E) := by + have hGC : G * C ≤ Real.exp (2 * P) := by + calc + _ ≤ Real.exp P * Real.exp P := mul_le_mul hGP hCP hC (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hbase : 2 + G * C ≤ Real.exp (2 * P + 2) := by + have hone : 1 ≤ Real.exp (2 * P) := Real.one_le_exp (by positivity) + have hthree : (3 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + calc + _ ≤ 3 * Real.exp (2 * P) := by linarith + _ ≤ Real.exp 2 * Real.exp (2 * P) := mul_le_mul_of_nonneg_right hthree (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hacc : 0 < normalizedSpatialSiteAccuracy V E := by + unfold normalizedSpatialSiteAccuracy normalizedSpatialShare + positivity + have hcommon : 0 ≤ 3 * P + E + 8 := by positivity + have h := vectorSpatialAccuracy_inverse_le_exp n (by positivity : 0 < 2 + G * C) hacc + (hbase.trans (Real.exp_le_exp.mpr (by linarith : 2 * P + 2 ≤ 3 * P + E + 8))) + ((normalizedSpatialSiteAccuracy_inv_exp hV hP hVP).trans + (Real.exp_le_exp.mpr (by linarith : P + E + 4 ≤ 3 * P + E + 8))) + apply h.trans + apply Real.exp_le_exp.mpr + unfold normalizedSpatialPointLog + nlinarith [mul_le_mul_of_nonneg_right hn hcommon] + +theorem normalizedSpatial_narrow_width_inv_exp (n : ℕ) {G C V B P E : ℝ} + (hG : 0 ≤ G) (hC : 0 ≤ C) (hV : 0 ≤ V) (hB : 0 ≤ B) (hP : 0 ≤ P) (hE : 0 ≤ E) + (hn : (n : ℝ) ≤ P) (hGP : G ≤ Real.exp P) (hCP : C ≤ Real.exp P) + (hVP : V ≤ Real.exp P) (hBP : B ≤ Real.exp P) : + (twoTermErrorWidth B (normalizedSpatialPointAccuracy n G C V E / 2))⁻¹ ≤ + Real.exp (2 * (normalizedSpatialPointLog P E + P + 2) + 4) := by + let eta := normalizedSpatialPointAccuracy n G C V E + have heta : 0 < eta := by + apply vectorSpatialAccuracy_pos n (by positivity) + unfold normalizedSpatialSiteAccuracy normalizedSpatialShare + positivity + have hlog := normalizedSpatialPointLog_nonneg hP hE + have hi := normalizedSpatialPointAccuracy_inv_exp n hG hC hV hP hE hn hGP hCP hVP + have hhalf : (eta / 2)⁻¹ ≤ Real.exp (normalizedSpatialPointLog P E + P + 2) := by + rw [inv_div, div_eq_mul_inv] + calc + _ ≤ Real.exp 2 * Real.exp (normalizedSpatialPointLog P E) := by + apply mul_le_mul (by linarith [Real.add_one_le_exp (2 : ℝ)]) hi (le_of_lt (inv_pos.mpr heta)) (Real.exp_pos _).le + _ = Real.exp (normalizedSpatialPointLog P E + 2) := by rw [← Real.exp_add, add_comm] + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + exact (twoTermErrorChoices_log_bounds (le_refl (0 : ℝ)) hB (half_pos heta) + (by positivity : 0 ≤ normalizedSpatialPointLog P E + P + 2) + (T := 0) (by positivity) (by positivity) + (hBP.trans (Real.exp_le_exp.mpr (by linarith))) hhalf).2 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialReplacement.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialReplacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..867a9d5df184e2c3b41f8e5730d676b469f703c2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSpatialReplacement.lean @@ -0,0 +1,132 @@ +import OAI.Combinatorics.Progressions.Estimates.NormalizedImageMask +import OAI.Combinatorics.Progressions.Estimates.PeelingDecomposition +import OAI.Combinatorics.Progressions.Probability.NormalizedJetDensitySupport + +namespace OAI + + +namespace Erdos3 + +open scoped BigOperators + +theorem norm_weighted_density_mean_sub_le {X : Type*} (s : Finset X) + (D a b : X → ℝ) (φ : X → ℂ) {ε : ℝ} + (hD : ∀ x ∈ s, 0 ≤ D x) (hφ : ∀ x ∈ s, ‖φ x‖ ≤ 1) + (hab : ∀ x ∈ s, |a x - b x| ≤ ε) : + ‖(𝔼 x ∈ s, ((D x * a x : ℝ) : ℂ) * φ x) - + (𝔼 x ∈ s, ((D x * b x : ℝ) : ℂ) * φ x)‖ ≤ ε * (𝔼 x ∈ s, D x) := by + rw [← Finset.expect_sub_distrib] + apply (RCLike.norm_expect_le (K := ℂ)).trans + calc + _ ≤ 𝔼 x ∈ s, ε * D x := by + apply Finset.expect_le_expect + intro x hx + have heq : ((D x * a x : ℝ) : ℂ) * φ x - ((D x * b x : ℝ) : ℂ) * φ x = + ((D x * (a x - b x) : ℝ) : ℂ) * φ x := by push_cast; ring + rw [heq, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_mul, abs_of_nonneg (hD x hx)] + calc + _ ≤ D x * |a x - b x| * 1 := + mul_le_mul_of_nonneg_left (hφ x hx) (mul_nonneg (hD x hx) (abs_nonneg _)) + _ ≤ ε * D x := by + rw [mul_one, mul_comm ε] + exact mul_le_mul_of_nonneg_left (hab x hx) (hD x hx) + _ = _ := (Finset.mul_expect s D ε).symm + +theorem norm_weighted_density_mean_sub_le_of_mass {X : Type*} (s : Finset X) + (D a b : X → ℝ) (φ : X → ℂ) {ε M : ℝ} (hε : 0 ≤ ε) + (hD : ∀ x ∈ s, 0 ≤ D x) (hφ : ∀ x ∈ s, ‖φ x‖ ≤ 1) + (hab : ∀ x ∈ s, |a x - b x| ≤ ε) (hM : (𝔼 x ∈ s, D x) ≤ M) : + ‖(𝔼 x ∈ s, ((D x * a x : ℝ) : ℂ) * φ x) - + (𝔼 x ∈ s, ((D x * b x : ℝ) : ℂ) * φ x)‖ ≤ ε * M := + (norm_weighted_density_mean_sub_le s D a b φ hD hφ hab).trans + (mul_le_mul_of_nonneg_left hM hε) + +theorem masked_density_replacement_error {X : Type*} (s : Finset X) + (D m a b : X → ℝ) (φ : X → ℂ) {ε G : ℝ} (hG : 0 ≤ G) + (hD : ∀ x ∈ s, 0 ≤ D x) (hm : ∀ x ∈ s, |m x| ≤ G) + (hφ : ∀ x ∈ s, ‖φ x‖ ≤ 1) (hab : ∀ x ∈ s, |a x - b x| ≤ ε) : + ‖(𝔼 x ∈ s, ((D x * (m x * a x) : ℝ) : ℂ) * φ x) - + (𝔼 x ∈ s, ((D x * (m x * b x) : ℝ) : ℂ) * φ x)‖ ≤ + (G * ε) * (𝔼 x ∈ s, D x) := by + apply norm_weighted_density_mean_sub_le s D _ _ φ hD hφ + intro x hx + rw [← mul_sub, abs_mul] + exact mul_le_mul (hm x hx) (hab x hx) (abs_nonneg _) hG + +end Erdos3 + + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal BigOperators + +theorem normalizedSpatial_probability_comparison {I J N : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] [Fintype N] [DecidableEq N] + (A : Matrix I I ℤ) (hA : A.det ≠ 0) (B : Matrix I J ℤ) (C : Matrix I N ℤ) + (S P : I → ℝ) (T : J → ℝ) (Q : N → ℝ) + (hS : ∀ i, 0 < S i) (hP : ∀ i, 0 < P i) (hFree : ∀ j, 0 < Sum.elim T Q j) + (f : (J → ℝ) × (I → ℝ) → ℝ) (g : (N → ℝ) → ℝ) + (hf0 : ∀ p, 0 ≤ f p) (hg0 : ∀ n, 0 ≤ g n) + {K Kfull : ℝ≥0} (hf : LipschitzWith K f) (hg : Continuous g) + (hfull : LipschitzWith Kfull (splitFreeProfile f g)) + {R Rn δ G U V D L ρ H : ℝ} (h : ℕ) + (hR : 0 ≤ R) (hδ : 0 ≤ δ) (hρ : 0 < ρ) (hH : 0 ≤ H) + (hscaleS : ∀ i, ρ ≤ S i) (hscaleFree : ∀ j, ρ ≤ Sum.elim T Q j) + (hsmall : (A.det.natAbs : ℝ) ≤ ρ) (hcoeff : ∀ i j, |(A i j : ℝ)| ≤ D * L ^ h) + (hfs : ∀ p, R < ‖p‖ → f p = 0) (hgs : ∀ n, Rn < ‖n‖ → g n = 0) + (hfmass : (∫ p, f p) = 1) (hgmass : (∫ n, g n) = 1) + (hsmallMass : (2 * max R Rn + 2) ^ (Fintype.card I + Fintype.card (J ⊕ N)) * Kfull * + ((A.det.natAbs : ℝ) / ρ) ≤ 1 / 2) + (hbound : ∀ p, ‖splitFreeProfile f g p‖ ≤ H) + (hindex : ((pivotFullImage A (Matrix.fromCols B C)).toAddSubgroup.index : ℝ) ≤ G) + (hinv : ‖(normalizedPivotEquiv A hA S P hS hP).symm.toContinuousLinearMap‖ ≤ U) + (hcol : ‖matrixSupCLM (normalizedIntegerColumns (Matrix.fromCols B C) (Sum.elim T Q) P)‖ ≤ V) + (hmove : ∀ n, g n ≠ 0 → ‖matrixSupCLM (normalizedIntegerColumns C Q P) n‖ ≤ δ) : + ∃ hM : 0 < scaledInputMass (splitFreeProfile f g) S (Sum.elim T Q), + let p := integerImagePMF A (Matrix.fromCols B C) (splitFreeProfile f g) + (splitFreeProfile_nonneg hf0 hg0) S (Sum.elim T Q) hS hFree + (splitFreeProfile_zero_outside hfs hgs) hM + let w := maskedIntegerImageDensity A (Matrix.fromCols B C) P + (normalizedFiberDensity A hA B S P T hS hP f) + let E := (normalizedFiberErrorConstant (Fintype.card I) (Fintype.card (J ⊕ N)) + G U V (max R Rn) H Kfull * ((Fintype.card I).factorial * D ^ Fintype.card I)) * + L ^ (h * Fintype.card I) / ρ + + G * (spatialKernelErrorConstant (Fintype.card I) (Fintype.card J) U R K * δ) + (∀ v, |(∏ i, P i) * (p v).toReal - w v| ≤ E) ∧ + (∀ (s : Finset (I → ℤ)) (weight : (I → ℤ) → ℝ) (φ : (I → ℤ) → ℂ), + (∀ v ∈ s, 0 ≤ weight v) → (∀ v ∈ s, ‖φ v‖ ≤ 1) → + ‖(𝔼 v ∈ s, ((weight v * ((∏ i, P i) * (p v).toReal) : ℝ) : ℂ) * φ v) - + (𝔼 v ∈ s, ((weight v * w v : ℝ) : ℂ) * φ v)‖ ≤ E * (𝔼 v ∈ s, weight v)) := by + have hmass : (∫ p, splitFreeProfile f g p) = 1 := by + rw [splitFreeProfile_integral hf.continuous hg hfs hgs, hfmass, hgmass, one_mul] + obtain ⟨hM, hdiscrete⟩ := normalizedIntegerImage_polynomial_error A hA (Matrix.fromCols B C) + S P (Sum.elim T Q) hS hP hFree (splitFreeProfile f g) (splitFreeProfile_nonneg hf0 hg0) + hfull h (hR.trans (le_max_left _ _)) hρ hH hscaleS hscaleFree hsmall hcoeff + (splitFreeProfile_zero_outside hfs hgs) hmass hsmallMass hbound hindex hinv hcol + refine ⟨hM, ?_⟩ + dsimp only + have hU : 0 ≤ U := (norm_nonneg _).trans hinv + have hreal := normalizedSplitDensity_displacement A hA B C S P T Q hS hP + hf hg hR hδ hfs hgs hg0 hgmass hinv hmove + have hmasked := maskedIntegerImageDensity_error A (Matrix.fromCols B C) P + (normalizedFiberDensity A hA (Matrix.fromCols B C) S P (Sum.elim T Q) hS hP (splitFreeProfile f g)) + (normalizedFiberDensity A hA B S P T hS hP f) + (mul_nonneg (spatialKernelErrorConstant_nonneg _ _ K hU hR) hδ) hindex hreal + have hpoint (v : I → ℤ) := (abs_sub_le + ((∏ i, P i) * (integerImagePMF A (Matrix.fromCols B C) (splitFreeProfile f g) + (splitFreeProfile_nonneg hf0 hg0) S (Sum.elim T Q) hS hFree + (splitFreeProfile_zero_outside hfs hgs) hM v).toReal) + (maskedIntegerImageDensity A (Matrix.fromCols B C) P + (normalizedFiberDensity A hA (Matrix.fromCols B C) S P (Sum.elim T Q) hS hP + (splitFreeProfile f g)) v) + (maskedIntegerImageDensity A (Matrix.fromCols B C) P + (normalizedFiberDensity A hA B S P T hS hP f) v)).trans + (add_le_add (hdiscrete v) (hmasked v)) + refine ⟨hpoint, ?_⟩ + intro s weight φ hw hφ + exact norm_weighted_density_mean_sub_le s weight _ _ φ hw hφ (fun v _ => hpoint v) + +end Erdos3 + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSupportPlateau.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSupportPlateau.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc4e7d3495b0f8b60d2c8d2ed6fa862feee23fe8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedSupportPlateau.lean @@ -0,0 +1,68 @@ +import Mathlib.Analysis.Normed.Group.Basic +import OAI.Combinatorics.Progressions.Estimates.LinearCutoff + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +variable {J : Type*} [Fintype J] + +noncomputable def normalizedSupportPlateau (H : ℝ) (x : J → ℝ) : ℝ := + linearCutoff H (1 / 4) ‖x‖ + +theorem normalizedSupportPlateau_range (H : ℝ) (x : J → ℝ) : + 0 ≤ normalizedSupportPlateau H x ∧ normalizedSupportPlateau H x ≤ 1 := + linearCutoff_range _ _ _ + +theorem normalizedSupportPlateau_one {H : ℝ} (hH : 0 ≤ H) (x : J → ℝ) + (hx : ∀ j, |x j| ≤ H) : normalizedSupportPlateau H x = 1 := by + apply linearCutoff_eq_one _ _ (by norm_num) + exact (pi_norm_le_iff_of_nonneg hH).mpr (by simpa only [Real.norm_eq_abs] using hx) + +theorem normalizedSupportPlateau_support {H : ℝ} (x : J → ℝ) + (hx : normalizedSupportPlateau H x ≠ 0) : ∀ j, |x j| < H + 1 / 4 := by + have hn : ‖x‖ < H + 1 / 4 := by + apply lt_of_not_ge + intro h + apply hx + exact linearCutoff_eq_zero H (1 / 4) (by simpa using h) + intro j + have hj : |x j| ≤ ‖x‖ := by simpa only [Real.norm_eq_abs] using norm_le_pi_norm x j + exact hj.trans_lt hn + +theorem normalizedSupportPlateau_lipschitz (H : ℝ) : + LipschitzWith 4 (normalizedSupportPlateau (J := J) H) := by + apply LipschitzWith.of_dist_le_mul + intro x y + have h := (linearCutoff_lipschitz H (1 / 4) (by norm_num)).dist_le_mul ‖x‖ ‖y‖ + norm_num only [NNReal.coe_inv, NNReal.coe_div, NNReal.coe_one, NNReal.coe_ofNat, + one_div, inv_inv] at h + exact h.trans (mul_le_mul_of_nonneg_left (dist_norm_norm_le x y) (by norm_num)) + +theorem normalizedSupportPlateau_grid_one {H : ℝ} (hH : 0 ≤ H) {K : ℕ} (hK : 0 < K) + (center z : J → ℤ) (hz : ∀ j, |(z j : ℝ) - center j| ≤ H * K) : + normalizedSupportPlateau H (fun j => ((z j : ℝ) - center j) / K) = 1 := by + apply normalizedSupportPlateau_one hH + intro j + rw [abs_div, abs_of_pos (show (0 : ℝ) < K by exact_mod_cast hK)] + exact (div_le_iff₀ (show (0 : ℝ) < K by exact_mod_cast hK)).mpr (hz j) + +theorem normalizedSupportPlateau_grid_support {H : ℝ} {K : ℕ} (hK : 0 < K) + (center z : J → ℤ) + (hz : normalizedSupportPlateau H (fun j => ((z j : ℝ) - center j) / K) ≠ 0) : + ∀ j, |(z j : ℝ) - center j| ≤ (H + 1 / 4) * K := by + have h := normalizedSupportPlateau_support _ hz + intro j + have hj := h j + rw [abs_div, abs_of_pos (show (0 : ℝ) < K by exact_mod_cast hK)] at hj + exact ((div_lt_iff₀ (show (0 : ℝ) < K by exact_mod_cast hK)).mp hj).le + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistSpatialPartition.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistSpatialPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f1af72c925979099efaf27c4c5623bff3b1e299 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistSpatialPartition.lean @@ -0,0 +1,222 @@ +import OAI.Combinatorics.Progressions.Polynomial.MeasureDegreeZeroTwistTransfer + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial.NormalizedPolynomialTwist +open scoped NNReal + +variable {X Y : Type*} [Fintype X] [Fintype Y] +variable {periodCap coverCap : ℝ} {L : ℝ≥0} + +noncomputable def frozenTorus + (W : NormalizedPolynomialTwist X Y periodCap coverCap L) + (residue : X → ZMod W.modulus) (center : X → ℝ) (y : Y → UnitAddCircle) : ℂ := + W.mask residue * W.smooth (center, y) + +theorem norm_frozenTorus_le + (W : NormalizedPolynomialTwist X Y periodCap coverCap L) + (residue : X → ZMod W.modulus) (center : X → ℝ) (y : Y → UnitAddCircle) : + ‖W.frozenTorus residue center y‖ ≤ 1 := by + rw [frozenTorus, norm_mul] + exact (mul_le_mul (W.mask_bound _) (W.smooth_bound _) (norm_nonneg _) zero_le_one).trans_eq + (mul_one 1) + +theorem frozenTorus_lipschitz + (W : NormalizedPolynomialTwist X Y periodCap coverCap L) + (residue : X → ZMod W.modulus) (center : X → ℝ) : + LipschitzWith L (W.frozenTorus residue center) := by + apply LipschitzWith.of_dist_le_mul + intro y z + have h := W.smooth_lipschitz.dist_le_mul (center, y) (center, z) + simp only [Prod.dist_eq, dist_self, max_eq_right (dist_nonneg)] at h + calc + _ = ‖W.mask residue‖ * dist (W.smooth (center, y)) (W.smooth (center, z)) := by + simp only [frozenTorus, dist_eq_norm, ← mul_sub, norm_mul] + _ ≤ 1 * ((L : ℝ) * dist y z) := + mul_le_mul (W.mask_bound _) h dist_nonneg zero_le_one + _ = _ := one_mul _ + +theorem frozenTorus_spatial_error + (W : NormalizedPolynomialTwist X Y periodCap coverCap L) + (residue : X → ZMod W.modulus) (x center : X → ℝ) (y : Y → UnitAddCircle) : + ‖W.mask residue * W.smooth (x, y) - W.frozenTorus residue center y‖ ≤ + (L : ℝ) * dist x center := by + have h := W.smooth_lipschitz.dist_le_mul (x, y) (center, y) + simp only [Prod.dist_eq, dist_self, max_eq_left (dist_nonneg)] at h + calc + _ = ‖W.mask residue‖ * dist (W.smooth (x, y)) (W.smooth (center, y)) := by + simp only [frozenTorus, dist_eq_norm, ← mul_sub, norm_mul] + _ ≤ 1 * ((L : ℝ) * dist x center) := + mul_le_mul (W.mask_bound _) h dist_nonneg zero_le_one + _ = _ := one_mul _ + +variable {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + +noncomputable def frozenSpatialEval + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (center : X → ℝ) (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (u : X → ℤ) : ℂ := + W.frozenTorus (fun i => (u i : ZMod W.modulus)) center + (physicalGridFactorInput W.cover p (fun i => (u i : ℝ))) + +theorem eval_sub_frozenSpatialEval + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (N : X → ℕ) (center : X → ℝ) (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (u : X → ℤ) : + ‖W.eval N p u - W.frozenSpatialEval center p u‖ ≤ + (L : ℝ) * dist (fun i => (u i : ℝ) / N i) center := + W.frozenTorus_spatial_error _ _ _ _ + +end Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped BigOperators Classical NNReal + +noncomputable def normalizedVertexRadius {X : Type*} [Fintype X] {q : ℕ} + (N : X → ℕ) (V : Option (Fin q) × X → ℝ) (s : Finset (Fin q)) : ℝ := + ‖fun x => (V (none, x) + ∑ a ∈ s, V (some a, x)) / N x‖ + +theorem normalizedVertexRadius_nonneg {X : Type*} [Fintype X] {q : ℕ} + (N : X → ℕ) (V : Option (Fin q) × X → ℝ) (s : Finset (Fin q)) : + 0 ≤ normalizedVertexRadius N V s := norm_nonneg _ + +theorem normalized_physicalVertex_norm_le {X : Type*} [Fintype X] {q : ℕ} + (N : X → ℕ) (V : Option (Fin q) × X → ℝ) (s : Finset (Fin q)) + {z : Option (Fin q) × X → ℤ} (hz : z ∈ rectangularWeightIndices 0 V 1) : + ‖fun x => (physicalCubeVertexValue (standardPhysicalCubeOutput z) s x : ℝ) / N x‖ ≤ + normalizedVertexRadius N V s := by + apply (pi_norm_le_iff_of_nonneg (normalizedVertexRadius_nonneg N V s)).mpr + intro x + have hcoord (k : Option (Fin q)) : |(z (k, x) : ℝ)| ≤ V (k, x) := + rectangularWeightIndices_zero_bound V hz (k, x) + have hvertex : |(physicalCubeVertexValue (standardPhysicalCubeOutput z) s x : ℝ)| ≤ + V (none, x) + ∑ a ∈ s, V (some a, x) := by + simp only [physicalCubeVertexValue, standardPhysicalCubeOutput, Sum.elim_inl, + Sum.elim_inr, Int.cast_add, Int.cast_sum] + exact (abs_add_le _ _).trans (add_le_add (hcoord none) + ((Finset.abs_sum_le_sum_abs _ _).trans + (Finset.sum_le_sum (fun a _ => hcoord (some a))))) + calc + _ = |(physicalCubeVertexValue (standardPhysicalCubeOutput z) s x : ℝ)| / N x := by + rw [Real.norm_eq_abs, abs_div, abs_of_nonneg (Nat.cast_nonneg (N x) : (0 : ℝ) ≤ N x)] + _ ≤ (V (none, x) + ∑ a ∈ s, V (some a, x)) / N x := + div_le_div_of_nonneg_right hvertex (Nat.cast_nonneg _) + _ ≤ |(V (none, x) + ∑ a ∈ s, V (some a, x)) / N x| := le_abs_self _ + _ ≤ normalizedVertexRadius N V s := by + simpa only [Real.norm_eq_abs, normalizedVertexRadius] using + norm_le_pi_norm (fun x => (V (none, x) + ∑ a ∈ s, V (some a, x)) / (N x : ℝ)) x + +namespace NormalizedPolynomialTwist + +variable {X : Type*} [Fintype X] {m q : ℕ} + {J : Fin m → Type*} [∀ j, Fintype (J j)] + {periodCap coverCap : ℝ} {L : ℝ≥0} + +theorem selected_eval_sub_frozenSpatialEval + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (N : X → ℕ) (center : X → ℝ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (modulus : X → ℕ) (cells : Finset (ColumnResiduePattern (Option (Fin q)) X modulus)) + (s : Finset (Fin q)) (V : Option (Fin q) × X → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus cells V z) : + ‖(∑' z : Option (Fin q) × X → ℤ, + ((selectedResidueSmoothPMF modulus cells V hV hZ z).toReal : ℂ) * + W.eval N poly (physicalCubeVertexValue (standardPhysicalCubeOutput z) s)) - + ∑' z : Option (Fin q) × X → ℤ, + ((selectedResidueSmoothPMF modulus cells V hV hZ z).toReal : ℂ) * + W.frozenSpatialEval center poly (physicalCubeVertexValue (standardPhysicalCubeOutput z) s)‖ ≤ + (L : ℝ) * (normalizedVertexRadius N V s + ‖center‖) := by + have h := selectedResidueSmoothPMF_approximation modulus cells V hV hZ (fun _ => 1) + (fun z => W.eval N poly (physicalCubeVertexValue (standardPhysicalCubeOutput z) s)) + (fun z => W.frozenSpatialEval center poly (physicalCubeVertexValue (standardPhysicalCubeOutput z) s)) + (mul_nonneg L.coe_nonneg (add_nonneg (normalizedVertexRadius_nonneg N V s) (norm_nonneg center))) + (fun _ _ => by simp) ?_ + · simpa only [one_mul] using h + intro z hz + apply (W.eval_sub_frozenSpatialEval N center poly _).trans + apply mul_le_mul_of_nonneg_left _ L.coe_nonneg + rw [dist_eq_norm] + exact (norm_sub_le _ _).trans + (add_le_add (normalized_physicalVertex_norm_le N V s hz) le_rfl) + +theorem selected_eval_sub_frozenSpatialEval_zero + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (modulus : X → ℕ) (cells : Finset (ColumnResiduePattern (Option (Fin q)) X modulus)) + (s : Finset (Fin q)) (V : Option (Fin q) × X → ℝ) (hV : ∀ z, 0 < V z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus cells V z) : + ‖(∑' z : Option (Fin q) × X → ℤ, + ((selectedResidueSmoothPMF modulus cells V hV hZ z).toReal : ℂ) * + W.eval N poly (physicalCubeVertexValue (standardPhysicalCubeOutput z) s)) - + ∑' z : Option (Fin q) × X → ℤ, + ((selectedResidueSmoothPMF modulus cells V hV hZ z).toReal : ℂ) * + W.frozenSpatialEval 0 poly (physicalCubeVertexValue (standardPhysicalCubeOutput z) s)‖ ≤ + (L : ℝ) * normalizedVertexRadius N V s := by + simpa only [norm_zero, add_zero] using + W.selected_eval_sub_frozenSpatialEval N 0 poly modulus cells s V hV hZ + +end NormalizedPolynomialTwist +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial.NormalizedPolynomialTwist +open scoped NNReal BigOperators Classical + +variable {X Y : Type*} [Fintype X] [Fintype Y] +variable {periodCap coverCap : ℝ} {L : ℝ≥0} + +noncomputable def spatialPartitionLaw {b r : ℝ} (hb : 0 < b) (hr : 0 < r) + (x : X → ℝ) (hx : ∀ i, |x i| ≤ b) : + FiniteProbabilityWeights (X → Fin (intervalSiteCount b r)) where + weight k := ∏ i, intervalSiteWeight b r (k i) (x i) + nonneg _ := Finset.prod_nonneg (fun i _ => (intervalSiteWeight_range b hr _ _).1) + total := by + rw [← Fintype.prod_sum (fun i (k : Fin (intervalSiteCount b r)) => + intervalSiteWeight b r k (x i))] + simp only [intervalSiteWeight_sum hb hr _ (hx _), Finset.prod_const_one] + +theorem spatialPartitionLaw_near {b r : ℝ} (hb : 0 < b) (hr : 0 < r) + (x : X → ℝ) (hx : ∀ i, |x i| ≤ b) (k : X → Fin (intervalSiteCount b r)) + (hk : (spatialPartitionLaw hb hr x hx).weight k ≠ 0) : + dist x (fun i => intervalSiteCenter b r (k i)) ≤ 2 * r := by + apply (dist_pi_le_iff (by positivity : 0 ≤ 2 * r)).mpr + intro i + have hi : intervalSiteWeight b r (k i) (x i) ≠ 0 := + Finset.prod_ne_zero_iff.mp hk i (Finset.mem_univ i) + exact (intervalSiteWeight_near b r (k i) (x i) + (lt_of_le_of_ne (intervalSiteWeight_range b hr _ _).1 (Ne.symm hi))).le + +theorem spatialPartition_error + (W : NormalizedPolynomialTwist X Y periodCap coverCap L) + {b r : ℝ} (hb : 0 < b) (hr : 0 < r) + (residue : X → ZMod W.modulus) (x : X → ℝ) (hx : ∀ i, |x i| ≤ b) + (y : Y → UnitAddCircle) : + ‖W.mask residue * W.smooth (x, y) - + ∑ k : X → Fin (intervalSiteCount b r), vectorIntervalSiteWeight b r k x * + W.frozenTorus residue (fun i => intervalSiteCenter b r (k i)) y‖ ≤ + 2 * (L : ℝ) * r := by + let law := spatialPartitionLaw hb hr x hx + have he := law.norm_complexMean_sub_le + (fun _ => W.mask residue * W.smooth (x, y)) + (fun k => W.frozenTorus residue (fun i => intervalSiteCenter b r (k i)) y) + (fun _ => 2 * (L : ℝ) * r) (fun k hk => + (W.frozenTorus_spatial_error residue x _ y).trans + ((mul_le_mul_of_nonneg_left (spatialPartitionLaw_near hb hr x hx k hk) L.coe_nonneg).trans_eq + (by ring))) + rw [law.complexMean_const, law.mean_const] at he + simpa only [FiniteProbabilityWeights.complexMean, law, spatialPartitionLaw, + Complex.ofReal_prod, vectorIntervalSiteWeight] using he + +end Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistUniformBoxHaar.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistUniformBoxHaar.lean new file mode 100644 index 0000000000000000000000000000000000000000..a75883442cf6b6ca2139f9c72527a997ffa3d05c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistUniformBoxHaar.lean @@ -0,0 +1,118 @@ +import OAI.Combinatorics.Progressions.Fourier.MajorPhaseLowFourierExtraction +import OAI.Combinatorics.Progressions.Fourier.NormalizedTwistSingleSiteFourierHaar + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical NNReal + +theorem exists_normalizedTwist_uniform_progression_haar_comparison (m : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {X : Type} [Fintype X] [DecidableEq X] + {J : Fin m → Type} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)), + (∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) → + (∀ j α, coefficients (poly j) α ∈ U j) → + ∀ {periodCap coverCap : ℝ} {L : ℝ≥0} + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (residue : X → ZMod W.modulus) (center : X → ℝ) + {η Q p Rrank : ℝ}, 0 < η → 0 ≤ Q → + (Fintype.card (Σ j, J j) : ℝ) ≤ Q → + (L : ℝ) ≤ Real.exp Q → η⁻¹ ≤ Real.exp Q → + 2 ≤ p → (2 * Q + 2) ^ 4 ≤ p → + (W.cover : ℝ) ≤ Real.exp p → + ∀ (q : ℕ), 0 < q → (q : ℝ) ≤ Real.exp p → + ∀ (start : X → ℤ) (K : ℝ), 1 ≤ K → K ≤ Real.exp p → + ∀ (N : X → ℝ), (∀ i, 0 < N i) → + ∀ (origin : X → ℤ) (lengths : X → ℕ), (∀ i, 0 < lengths i) → + (∀ i, N i ≤ K * (q : ℝ) * (lengths i : ℝ)) → + (Fintype.card X : ℝ) ≤ p → + (∀ i, Real.exp ((p + C) ^ C) ≤ (lengths i : ℝ)) → + Real.exp ((p + C) ^ C) ≤ Rrank → + (∀ j, HasLayerSamplingRank (j.val + 1) N Rrank (U j) (poly j)) → + ‖(𝔼 x ∈ translatedIntegerBox origin lengths, + W.frozenTorus residue center (physicalGridFactorInput W.cover poly + (fun i => (start i : ℝ) + (q : ℝ) * (x i : ℝ)))) - + W.frozenSingleSiteHaarReference U ν residue center‖ ≤ + 2 * η + Real.exp (2 * Q * (2 * Q + 2) ^ 4 - p) := by + obtain ⟨C, hC, hfourier⟩ := exists_normalizedTwist_uniform_box_fourier_comparison m + refine ⟨C, hC, ?_⟩ + intro X _ _ J _ U ν _ _ poly hp hm periodCap coverCap L W residue center + η Q p Rrank hη hQ hdim hL hηQ hp2 hfreq hcover q hq hqp start K hK hKp N hN + origin lengths hlengths hNL hX hlarge hRrank hrank + obtain ⟨F, inst, frequency, coeff, _, hfreqB, hmass, herr⟩ := + exists_ambient_torus_fourier_approximation (W.frozenTorus residue center) L 1 + (W.frozenTorus_lipschitz residue center) (W.norm_frozenTorus_le residue center) + hη hQ hdim hL hηQ + let := inst + let : ∀ i, NeZero (lengths i) := fun i => ⟨(hlengths i).ne'⟩ + let μ := Measure.pi (fun j => Measure.pi (fun _ : Unit => ν j)) + let chart : EuclideanJetLayers U (fun _ => Unit) → (Σ j, J j) → UnitAddCircle := + fun y a => coveredJetAmbientTorus U 1 y ⟨a.1, (), a.2⟩ + let f := W.frozenTorus residue center + let g : ((Σ j, J j) → UnitAddCircle) → ℂ := + fun y => ∑ b, coeff b * ambientIntegerCharacter (frequency b) y + let point (x : X → ℤ) := physicalGridFactorInput W.cover poly + (fun i => (start i : ℝ) + (q : ℝ) * (x i : ℝ)) + have hfg (y) : ‖f y - g y‖ ≤ η := herr y + have hmean : ‖(𝔼 x ∈ translatedIntegerBox origin lengths, f (point x)) - + (𝔼 x ∈ translatedIntegerBox origin lengths, g (point x))‖ ≤ η := by + rw [← Finset.expect_sub_distrib] + exact (RCLike.norm_expect_le (K := ℂ)).trans + (Finset.expect_le (translatedIntegerBox_nonempty lengths origin) (fun x _ => hfg _)) + have hf : Integrable (fun y => f (chart y)) μ := + W.frozenSingleSiteHaarReference_integrable U ν residue center + have hgi (b : F) : Integrable (fun y => coeff b * ambientIntegerCharacter (frequency b) (chart y)) μ := + (singleSiteHaar_ambientIntegerCharacter_integrable U ν (frequency b)).const_mul _ + have hg : Integrable (fun y => g (chart y)) μ := integrable_finsetSum _ (fun b _ => hgi b) + have hint : ‖(∫ y, g (chart y) ∂μ) - ∫ y, f (chart y) ∂μ‖ ≤ η := + probability_integral_approximation μ _ _ hg hf (fun y => by + simpa only [norm_sub_rev] using hfg (chart y)) + have hge : (∫ y, g (chart y) ∂μ) = + ∑ b, coeff b * (if ∀ j, U j ≤ LinearMap.ker + (integerRowLinear (fun i => frequency b ⟨j, i⟩)) then 1 else 0) := by + rw [show (fun y => g (chart y)) = + (fun y => ∑ b, coeff b * ambientIntegerCharacter (frequency b) (chart y)) from rfl, + integral_finsetSum _ (fun b _ => hgi b)] + apply Finset.sum_congr rfl + intro b _ + rw [integral_const_mul] + exact congrArg (coeff b * ·) (singleSiteHaar_ambientIntegerCharacter_integral U ν (frequency b)) + have hcomp := hfourier W.cover W.cover_pos frequency coeff poly hp U hm p Rrank hp2 hcover + (fun b i => (hfreqB b i).trans (Real.exp_le_exp.mpr hfreq)) q hq hqp start K hK hKp + N hN origin lengths hlengths hNL hX hlarge hRrank hrank + have hgpoint (x) : g (point x) = ∑ b, coeff b * + (Real.fourierChar (MvPolynomial.eval + (fun i => (start i : ℝ) + (q : ℝ) * (x i : ℝ)) + (normalizedTwistFrequencyPolynomial W.cover (frequency b) poly)) : ℂ) := by + simp only [g, point, ambientIntegerCharacter, physicalGrid_character_eq_polynomial_phase] + rw [← hge] at hcomp + simp_rw [← hgpoint] at hcomp + have hmass' : (∑ b, ‖coeff b‖) * Real.exp (-p) ≤ + Real.exp (2 * Q * (2 * Q + 2) ^ 4 - p) := by + calc + _ ≤ Real.exp (2 * Q * (2 * Q + 2) ^ 4) * Real.exp (-p) := + mul_le_mul_of_nonneg_right (by simpa using hmass) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; rfl + have ht := norm_sub_le_norm_sub_add_norm_sub + (𝔼 x ∈ translatedIntegerBox origin lengths, f (point x)) + (𝔼 x ∈ translatedIntegerBox origin lengths, g (point x)) (∫ y, f (chart y) ∂μ) + have ht' := norm_sub_le_norm_sub_add_norm_sub + (𝔼 x ∈ translatedIntegerBox origin lengths, g (point x)) + (∫ y, g (chart y) ∂μ) (∫ y, f (chart y) ∂μ) + change ‖(𝔼 x ∈ translatedIntegerBox origin lengths, f (point x)) - + ∫ y, f (chart y) ∂μ‖ ≤ _ + linarith [hcomp.trans hmass'] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistUniformSpatialHaar.lean b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistUniformSpatialHaar.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b43f4886271acdae6bb95b133d4c8dea1345c60 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/NormalizedTwistUniformSpatialHaar.lean @@ -0,0 +1,81 @@ +import OAI.Combinatorics.Progressions.Dynamics.NormalizedTwistUniformAmbientBudget +import OAI.Combinatorics.Progressions.Lattices.NormalizedResidueSpatialHaarBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory +open scoped BigOperators Classical NNReal + +theorem exists_normalizedTwist_uniform_spatial_haar_comparison (m : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ {X : Type} [Fintype X] [DecidableEq X] + {J : Fin m → Type} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)), + (∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) → + (∀ j α, coefficients (poly j) α ∈ U j) → + ∀ {periodCap coverCap : ℝ} {L : ℝ≥0} + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) [NeZero W.modulus] + {P E Rrank : ℝ}, 0 ≤ P → 0 ≤ E → + (Fintype.card X : ℝ) ≤ P → (Fintype.card (Σ j, J j) : ℝ) ≤ P → + (L : ℝ) ≤ Real.exp P → (W.cover : ℝ) ≤ Real.exp P → (W.modulus : ℝ) ≤ Real.exp P → + ∀ (N : X → ℕ), + (∀ i, Real.exp ((max P E + A) ^ A) ≤ (N i : ℝ)) → + Real.exp ((max P E + A) ^ A) ≤ Rrank → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + ‖(𝔼 x ∈ integerBox N, W.eval N poly x) - + (𝔼 r : X → ZMod W.modulus, ∫ x, W.frozenSingleSiteHaarReference U ν r x + ∂unitBoxMeasure X)‖ ≤ + Real.exp (-E) := by + obtain ⟨C, hC, hcomp⟩ := exists_normalizedTwist_uniform_ambient_haar_budget m + let B : Polynomial ℕ := (Polynomial.X + 2 + Polynomial.C C) ^ C + 4 * Polynomial.X + 22 + obtain ⟨A, hA, hbudget⟩ := exists_natPolynomial_eval_budget B + refine ⟨A, hA, ?_⟩ + intro X _ _ J _ U ν _ _ poly hp hm periodCap coverCap L W _ P E Rrank + hP hE hX hdim hL hcover hmod N hlarge hRrank hrank + let z := max P E + have hz : 0 ≤ z := hP.trans (le_max_left _ _) + have hPE : max P (E + 2) ≤ z + 2 := by + apply max_le + · linarith [le_max_left P E] + · dsimp [z]; linarith [le_max_right P E] + have hbudget' : (z + 2 + C) ^ C + 4 * z + 22 ≤ (z + A) ^ A := by + simpa [B, Polynomial.eval₂_pow] using hbudget z hz + have hpow : (max P (E + 2) + C) ^ C ≤ (z + A) ^ A := by + apply (pow_le_pow_left₀ (by positivity) (show max P (E + 2) + (C : ℝ) ≤ z + 2 + C by linarith) C).trans + linarith + have hmesh : 3 * P + (E + 2) + 20 ≤ (z + A) ^ A := by + have hnonneg : 0 ≤ (z + 2 + C) ^ C := by positivity + have hPz : P ≤ z := le_max_left _ _ + have hEz : E ≤ z := le_max_right _ _ + linarith + have hfirst := hcomp U ν poly hp hm W hP (by linarith : 0 ≤ E + 2) + hX hdim hL hcover hmod N + (fun i => (Real.exp_le_exp.mpr hpow).trans (hlarge i)) + ((Real.exp_le_exp.mpr hpow).trans hRrank) hrank + have hlast := W.integerBox_frozenSingleSiteHaarReference_riemann_budget U ν + hP (by linarith : 0 ≤ E + 2) hX hL hmod N + (fun i => (Real.exp_le_exp.mpr hmesh).trans (hlarge i)) + have ht := norm_sub_le_norm_sub_add_norm_sub + (𝔼 x ∈ integerBox N, W.eval N poly x) + (𝔼 x ∈ integerBox N, W.frozenSingleSiteHaarReference U ν + (fun i => (x i : ZMod W.modulus)) (fun i => (x i : ℝ) / N i)) + (𝔼 r : X → ZMod W.modulus, ∫ x, W.frozenSingleSiteHaarReference U ν r x + ∂unitBoxMeasure X) + have he : 2 * Real.exp (-(E + 2)) ≤ Real.exp (-E) := by + calc + _ ≤ Real.exp 2 * Real.exp (-(E + 2)) := + mul_le_mul_of_nonneg_right (by linarith [Real.add_one_le_exp (2 : ℝ)]) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + linarith + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/OneCubeSliceSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/OneCubeSliceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..05ce9dfbb5ec997d949baed0356aefdaee5ad06f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/OneCubeSliceSupport.lean @@ -0,0 +1,47 @@ +import OAI.Combinatorics.Progressions.Probability.OneCubeSlicedSourceLaw + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +variable {D : Type*} [Fintype D] {B : D → Type*} [∀ d, Fintype (B d)] +variable (h : D → ℕ) (P : D → Prop) [DecidablePred P] + +theorem oneCubeSlicedParameter_norm_le + (lower width : ∀ d : {d // ¬P d}, B d.val × Fin (h d.val) → ℝ) + (hw : ∀ d p, |lower d p| + |width d p| ≤ 1) + (x : OneCubeActiveEndpoint (B := B) h P → ℝ) (hx : ∀ j, x j ∈ Set.Icc (0 : ℝ) 1) : + ‖oneCubeSlicedParameter h P lower width x‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro j + rcases j with ⟨d,b,i,r⟩ + have hx₀ := hx ⟨(false,d),b,i⟩ + have hx₁ := hx ⟨(true,d),b,i⟩ + have hxabs : |x ⟨(false,d),b,i⟩| ≤ 1 := by rw [abs_of_nonneg hx₀.1]; exact hx₀.2 + have hdiff : |x ⟨(true,d),b,i⟩ - x ⟨(false,d),b,i⟩| ≤ 1 := abs_le.mpr ⟨by linarith [hx₀.2, hx₁.1], by linarith [hx₀.1, hx₁.2]⟩ + cases r with + | none => + simp only [oneCubeSlicedParameter, Real.norm_eq_abs] + exact (abs_add_le _ _).trans ((add_le_add le_rfl + (by simpa only [abs_mul, mul_one] using mul_le_mul_of_nonneg_left hxabs (abs_nonneg (width d (b,i))))).trans (hw d (b,i))) + | some r => + simp only [oneCubeSlicedParameter, Real.norm_eq_abs, abs_mul] + exact (mul_le_mul_of_nonneg_left hdiff (abs_nonneg _)).trans (by linarith [hw d (b,i), abs_nonneg (lower d (b,i))]) + +theorem oneCubeSlicedParameter_ae_norm_le + (lower width : ∀ d : {d // ¬P d}, B d.val × Fin (h d.val) → ℝ) + (hw : ∀ d p, |lower d p| + |width d p| ≤ 1) : + ∀ᵐ x ∂unitBoxMeasure (OneCubeActiveEndpoint (B := B) h P), + ‖oneCubeSlicedParameter h P lower width x‖ ≤ 1 := by + filter_upwards [unitBoxMeasure_ae] with x hx + exact oneCubeSlicedParameter_norm_le h P lower width hw x (fun j => ⟨(hx j).1.le, (hx j).2⟩) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/OneDimensionalBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/OneDimensionalBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a4bbf3f3eab73481756fab15988fac068afa647 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/OneDimensionalBox.lean @@ -0,0 +1,60 @@ +import OAI.Combinatorics.Progressions.Lattices.PhysicalSubboxResidueSlice + +namespace OAI + +section + +namespace Erdos3 + +def scalarPiOneEquiv (A : Type*) [AddCommGroup A] : A ≃+ (Fin 1 → A) where + toFun a _ := a + invFun f := f 0 + left_inv _ := rfl + right_inv f := by + funext i + exact congrArg f (Subsingleton.elim _ _) + map_add' _ _ := rfl + +theorem oneDimensionalBox_eq_image (a : ℤ) (L : ℕ) : + translatedIntegerBox (fun _ : Fin 1 => a) (fun _ => L) = + (Finset.Ico a (a + L)).image (scalarPiOneEquiv ℤ) := by + ext x + rw [mem_translatedIntegerBox, Finset.mem_image] + constructor + · intro hx + refine ⟨x 0, Finset.mem_Ico.mpr (hx 0), ?_⟩ + exact (scalarPiOneEquiv ℤ).apply_symm_apply x + · rintro ⟨y, hy, rfl⟩ i + exact Finset.mem_Ico.mp hy + +theorem oneDimensionalBox_norm (j : ℕ) (a : ℤ) (L : ℕ) (f : (Fin 1 → ℤ) → ℂ) : + finiteSupportGowersNorm j (translatedIntegerBox (fun _ : Fin 1 => a) (fun _ => L)) f = + finiteSupportGowersNorm j (Finset.Ico a (a + L)) (fun x => f (fun _ => x)) := by + rw [oneDimensionalBox_eq_image] + exact finiteSupportGowersNorm_addEquiv (scalarPiOneEquiv ℤ) j _ f + +theorem oneDimensionalBox_correlation (a : ℤ) (L : ℕ) (f g : (Fin 1 → ℤ) → ℂ) : + finiteCorrelation (translatedIntegerBox (fun _ : Fin 1 => a) (fun _ => L)) f g = + finiteCorrelation (Finset.Ico a (a + L)) (fun x => f (fun _ => x)) (fun x => g (fun _ => x)) := by + rw [oneDimensionalBox_eq_image] + exact finiteCorrelation_addEquiv (scalarPiOneEquiv ℤ) _ f g + +theorem integerInterval_cubeCount_bounds (a : ℤ) (L : ℕ) [NeZero L] (j : ℕ) : + ((1 : ℝ) / ((j : ℝ) + 1) ^ (j + 1)) * (L : ℝ) ^ (j + 1) ≤ + Nat.card (SupportedCube j (Finset.Ico a (a + L) : Set ℤ)) ∧ + (Nat.card (SupportedCube j (Finset.Ico a (a + L) : Set ℤ)) : ℝ) ≤ (L : ℝ) ^ (j + 1) := by + have h := translatedIntegerBox_cubeCount_bounds (fun _ : Fin 1 => L) (fun _ => a) j + rw [oneDimensionalBox_eq_image] at h + have he := reflectsPairSums_of_addEquiv (scalarPiOneEquiv ℤ) (Finset.Ico a (a + L) : Set ℤ) + have hcount : Nat.card (SupportedCube j + (((Finset.Ico a (a + L)).image (scalarPiOneEquiv ℤ)) : Set (Fin 1 → ℤ))) = + Nat.card (SupportedCube j (Finset.Ico a (a + L) : Set ℤ)) := + card_supportedCube_image_eq he j + rw [hcount, Finset.card_image_of_injective _ (scalarPiOneEquiv ℤ).injective] at h + simpa only [Fintype.card_fin, pow_one, Int.card_Ico, add_sub_cancel_left, Int.toNat_natCast] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/OperatorCoordinateBound.lean b/lean/OAI/Combinatorics/Progressions/Geometry/OperatorCoordinateBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fc2a59ba486f810dac190ca457774e48734284e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/OperatorCoordinateBound.lean @@ -0,0 +1,54 @@ +import Mathlib.Analysis.Normed.Module.FiniteDimension +import Mathlib.Tactic + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem clm_norm_le_card_mul_of_basis {I E : Type*} [Fintype I] [DecidableEq I] + [NormedAddCommGroup E] [NormedSpace ℝ E] (A : (I → ℝ) →L[ℝ] E) + {M : ℝ} (hM : 0 ≤ M) (hA : ∀ i, ‖A (Pi.single i 1)‖ ≤ M) : + ‖A‖ ≤ Fintype.card I * M := by + apply ContinuousLinearMap.opNorm_le_bound _ (by positivity) + intro x + have hsum : A x = ∑ i, (x i) • A (Pi.single i 1) := by + calc + A x = A (∑ i, Pi.single i (x i)) := + congrArg A (LinearMap.sum_single_apply (fun _ : I => ℝ) x).symm + _ = ∑ i, A (Pi.single i (x i)) := map_sum A _ _ + _ = _ := by + apply Finset.sum_congr rfl + intro i _ + have hs : Pi.single i (x i) = (x i) • (Pi.single i (1 : ℝ) : I → ℝ) := by + rw [← Pi.single_smul] + simp + rw [hs, map_smul] + rw [hsum] + calc + _ ≤ ∑ i, ‖(x i) • A (Pi.single i 1)‖ := norm_sum_le _ _ + _ ≤ ∑ _i : I, ‖x‖ * M := by + apply Finset.sum_le_sum + intro i _ + rw [norm_smul] + exact mul_le_mul (norm_le_pi_norm x i) (hA i) (norm_nonneg _) (norm_nonneg x) + _ = _ := by simp [mul_comm, mul_left_comm, mul_assoc] + +theorem clm_norm_le_card_mul_of_entries {I O : Type*} + [Fintype I] [DecidableEq I] [Fintype O] + (A : (I → ℝ) →L[ℝ] (O → ℝ)) {M : ℝ} (hM : 0 ≤ M) + (hA : ∀ i o, |A (Pi.single i 1) o| ≤ M) : ‖A‖ ≤ Fintype.card I * M := by + apply clm_norm_le_card_mul_of_basis A hM + intro i + apply (pi_norm_le_iff_of_nonneg hM).mpr + intro o + simpa only [Real.norm_eq_abs] using hA i o + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/OptionProductMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/OptionProductMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..50a9cb4d9277eb4bcd89e87c48892a40ddb8b795 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/OptionProductMetric.lean @@ -0,0 +1,36 @@ +import Mathlib.Logic.Equiv.Basic +import Mathlib.Topology.MetricSpace.Isometry +import Mathlib.Topology.MetricSpace.Pseudo.Pi + +namespace OAI + +section + +namespace Erdos3 + +theorem piOptionEquivProd_isometry {ι : Type*} [Fintype ι] {X : Option ι → Type*} + [∀ i, PseudoMetricSpace (X i)] : + Isometry (Equiv.piOptionEquivProd : (∀ i, X i) → X none × (∀ i, X (some i))) := by + apply Isometry.of_dist_eq + intro x y + change dist (x none, fun i => x (some i)) (y none, fun i => y (some i)) = dist x y + rw [Prod.dist_eq] + apply le_antisymm + · apply max_le (dist_le_pi_dist x y none) + exact (dist_pi_le_iff dist_nonneg).mpr (fun i => dist_le_pi_dist x y (some i)) + · apply (dist_pi_le_iff (le_trans dist_nonneg (le_max_left _ _))).mpr + intro i + cases i with + | none => exact le_max_left _ _ + | some i => exact (dist_le_pi_dist (fun i => x (some i)) (fun i => y (some i)) i).trans (le_max_right _ _) + +noncomputable def optionPiIsometryEquiv {ι : Type*} [Fintype ι] {X : Option ι → Type*} + [∀ i, PseudoMetricSpace (X i)] : (∀ i, X i) ≃ᵢ X none × (∀ i, X (some i)) where + toEquiv := Equiv.piOptionEquivProd + isometry_toFun := piOptionEquivProd_isometry + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/OutsideProductTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/OutsideProductTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..490e66c9b0ac1c44d1ba444b63610a75cf3a0758 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/OutsideProductTransport.lean @@ -0,0 +1,89 @@ +import OAI.Combinatorics.Progressions.Estimates.ScaledConditionedComparison + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem conditioningCoreSupports_map_outside {ι : Type*} [Fintype ι] [DecidableEq ι] + (K : Finset ι) (B : ℕ) : + conditioningCoreSupports K B = + (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)).map + (Finset.mapEmbedding (Function.Embedding.subtype (fun i => i ∉ K))).toEmbedding := by + classical + ext S + constructor + · intro hS + have hs : S ⊆ Kᶜ ∧ S.card ≤ B - K.card := by + simpa only [conditioningCoreSupports, Finset.mem_filter, Finset.mem_powerset] using hS + let U := S.subtype (fun i => i ∉ K) + have hu : U.map (Function.Embedding.subtype (fun i => i ∉ K)) = S := + Finset.subtype_map_of_mem (fun i hi => Finset.mem_compl.mp (hs.1 hi)) + have hc : U.card = S.card := by rw [← hu, Finset.card_map] + apply Finset.mem_map.mpr + refine ⟨U, (mem_lowDegreeCoordinateSets _ _ U).mpr (by rw [hc]; exact hs.2), ?_⟩ + exact hu + · intro hS + obtain ⟨U, hU, rfl⟩ := Finset.mem_map.mp hS + change U.map (Function.Embedding.subtype (fun i => i ∉ K)) ∈ conditioningCoreSupports K B + simp only [conditioningCoreSupports, Finset.mem_filter, Finset.mem_powerset, Finset.card_map] + refine ⟨?_, (mem_lowDegreeCoordinateSets _ _ U).mp hU⟩ + intro i hi + obtain ⟨j, _, rfl⟩ := Finset.mem_map.mp hi + exact Finset.mem_compl.mpr j.property + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem lowDegreeCoordinateSets_filter_outside {ι : Type*} [Fintype ι] [DecidableEq ι] + (K : Finset ι) (b : ℕ) : + (lowDegreeCoordinateSets ι b).filter (fun S => S ⊆ Kᶜ) = conditioningCoreSupports K (b + K.card) := by + ext S + have hb : b + K.card - K.card = b := by omega + simp only [Finset.mem_filter, mem_lowDegreeCoordinateSets, conditioningCoreSupports, + Finset.mem_powerset, hb] + exact and_comm + +theorem productANOVAEnergy_outside {ι : Type*} [Fintype ι] [DecidableEq ι] + {X : ι → Type*} [∀ i, Fintype (X i)] (μ : ∀ i, FiniteProbabilityWeights (X i)) + (K : Finset ι) (base : ∀ i, X i) (b : ℕ) (f : (∀ i : {i // i ∉ K}, X i.val) → ℝ) : + productANOVAEnergy μ (lowDegreeCoordinateSets ι b) (fun x => f (fun i => x i.val)) = + productANOVAEnergy (fun i : {i // i ∉ K} => μ i.val) + (lowDegreeCoordinateSets {i // i ∉ K} b) f := by + have hd : ProductDependsOn Kᶜ (fun x => f (fun i : {i // i ∉ K} => x i.val)) := by + intro x y hxy + exact congrArg f (funext (fun i => hxy i.val (Finset.mem_compl.mpr i.property))) + rw [productANOVAEnergy_of_depends_filter μ Kᶜ _ hd, lowDegreeCoordinateSets_filter_outside, + conditioningCoreSupports_map_outside] + have hb : b + K.card - K.card = b := by omega + rw [hb] + exact productANOVAEnergy_embedding μ (Function.Embedding.subtype (fun i => i ∉ K)) base _ f + +theorem productTruncatedPairing_outside_core {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + {μ : ∀ i, FiniteProbabilityWeights (X i)} {ν : ∀ i, FiniteProbabilityWeights (Y i)} + (c : ∀ i, FiniteProbabilityCoupling (μ i) (ν i)) (K : Finset ι) + (baseX : ∀ i, X i) (baseY : ∀ i, Y i) (B : ℕ) + (f : (∀ i : {i // i ∉ K}, X i.val) → ℝ) (g : (∀ i : {i // i ∉ K}, Y i.val) → ℝ) : + productTruncatedPairing c (conditioningCoreSupports K B) + (fun x => f (fun i => x i.val)) (fun y => g (fun i => y i.val)) = + productTruncatedPairing (fun i : {i // i ∉ K} => c i.val) + (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)) f g := by + rw [conditioningCoreSupports_map_outside] + exact productTruncatedPairing_embedding c (Function.Embedding.subtype (fun i => i ∉ K)) baseX baseY _ f g + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PMFSupportedMean.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PMFSupportedMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..1abb73d42c8cdf35bdadad783225a530a26bfed2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PMFSupportedMean.lean @@ -0,0 +1,42 @@ +import OAI.Combinatorics.Progressions.Estimates.ShiftedSmoothSelectedMarginal + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem pmf_image_supported_real_mean {X Y : Type*} [DecidableEq Y] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (T : Finset Y) (f : Y → ℝ) (hf : ∀ y ∉ T, f y = 0) : + (∑' x, (p x).toReal * f (F x)) = ∑ y ∈ T, (p.map F y).toReal * f y := by + let U := T ∪ S.image F + have hU : ∀ x ∈ S, F x ∈ U := + fun x hx => Finset.mem_union_right _ (Finset.mem_image.mpr ⟨x, hx, rfl⟩) + rw [pmf_image_finite_real_mean p S hp F U hU f] + symm + apply Finset.sum_subset Finset.subset_union_left + intro y _ hy + rw [hf y hy, mul_zero] + +theorem pmf_pair_supported_real_mean {X Y Z : Type*} [DecidableEq Y] [DecidableEq Z] + (p : PMF X) (S : Finset X) (hp : ∀ x ∉ S, (p x).toReal = 0) + (F : X → Y) (G : X → Z) (T : Finset Y) (U : Finset Z) + (e : Y → ℝ) (d : Z → ℝ) (he : ∀ y ∉ T, e y = 0) (hd : ∀ z ∉ U, d z = 0) : + (∑' x, (p x).toReal * (e (F x) * d (G x))) = + ∑ y ∈ T, ∑ z ∈ U, (p.map (fun x => (F x, G x)) (y, z)).toReal * (e y * d z) := by + have hoff (yz : Y × Z) (h : yz ∉ T ×ˢ U) : e yz.1 * d yz.2 = 0 := by + by_cases hy : yz.1 ∈ T + · have hz : yz.2 ∉ U := fun hz => h (Finset.mem_product.mpr ⟨hy, hz⟩) + rw [hd _ hz, mul_zero] + · rw [he _ hy, zero_mul] + rw [pmf_image_supported_real_mean p S hp (fun x => (F x, G x)) (T ×ˢ U) + (fun yz => e yz.1 * d yz.2) hoff, Finset.sum_product] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PartitionedIdealSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PartitionedIdealSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..aefeec1cb274820709d407016feb9256f78a4ff6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PartitionedIdealSupport.lean @@ -0,0 +1,84 @@ +import OAI.Combinatorics.Progressions.Estimates.ActiveProfileNoise + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal BigOperators + +noncomputable def partitionedIdealRadius (α : Type*) [Fintype α] (degree : ℕ) : ℝ := + 1 / 4 + 2 ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ degree + +theorem partitionedIdealRadius_nonneg (α : Type*) [Fintype α] (degree : ℕ) : + 0 ≤ partitionedIdealRadius α degree := by + unfold partitionedIdealRadius + positivity + +theorem partitionedIdealMap_norm_le {D G Z α : Type*} + [Fintype D] [Fintype G] [Fintype Z] [Fintype α] [DecidableEq α] + {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (P : D → Prop) [DecidablePred P] + {O : {d // ¬P d} → Type*} [∀ d, Fintype (O d)] (sets : ∀ d, O d → Finset α) + {degree : ℕ} (hdegree : ∀ d, h d ≤ degree) + (y : PartitionedProfileNoiseIndex G Z α B h P → ℝ) (hy : ∀ j, |y j| ≤ 1) + (x : PrincipalAxisParameter (B := B) (h := h) (α := α) (fun d => ¬P d) → ℝ) + (hx : ‖x‖ ≤ 1) : + ‖partitionedIdealMap h P sets y x‖ ≤ partitionedIdealRadius α degree := by + apply (pi_norm_le_iff_of_nonneg (partitionedIdealRadius_nonneg α degree)).mpr + intro o + have hs := partitionedProfilePrincipal_unit_sum h P y hy o.1 + have hp := jointBooleanSampler_coordinate_abs_le (fun d : {d // ¬P d} => h d.val) + (partitionedProfilePrincipal h P (unitProfilePrincipalSize (B := B)) y) sets x hx o + have hb : |jointBooleanSampler (fun d : {d // ¬P d} => h d.val) + (partitionedProfilePrincipal h P (unitProfilePrincipalSize (B := B)) y) sets x o| ≤ + (2 : ℝ) ^ Fintype.card α * ((Fintype.card α : ℝ) + 1) ^ degree := by + apply hp.trans + have hpow : (2 : ℝ) ^ (sets o.1 o.2).card ≤ 2 ^ Fintype.card α := + pow_le_pow_right₀ (by norm_num) (Finset.card_le_univ (sets o.1 o.2)) + have hdp : ((Fintype.card α : ℝ) + 1) ^ h o.1.val ≤ + ((Fintype.card α : ℝ) + 1) ^ degree := + pow_le_pow_right₀ (by linarith [Nat.cast_nonneg (α := ℝ) (Fintype.card α)]) (hdegree o.1.val) + have hinner := mul_le_mul hs hdp (by positivity) (by norm_num : (0 : ℝ) ≤ 1) + simpa only [one_mul] using mul_le_mul hpow hinner (by positivity) (by positivity) + have hc : |booleanConstantJet sets (partitionedProfileConstant h P (fun _ => 1 / 4) y) o| ≤ 1 / 4 := by + unfold booleanConstantJet + split_ifs + · dsimp only [partitionedProfileConstant] + rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 4)] + exact mul_le_of_le_one_right (by norm_num) (hy _) + · norm_num + rw [Real.norm_eq_abs] + change |booleanConstantJet sets (partitionedProfileConstant h P (fun _ => 1 / 4) y) o + + jointBooleanSampler (fun d : {d // ¬P d} => h d.val) + (partitionedProfilePrincipal h P (unitProfilePrincipalSize (B := B)) y) sets x o| ≤ _ + exact (abs_add_le _ _).trans (add_le_add hc hb) + +theorem partitionedRegularizedIdeal_zero_outside {D G Z α : Type*} + [Fintype D] [Fintype G] [Fintype Z] [Fintype α] [DecidableEq α] + {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (P : D → Prop) [DecidablePred P] + {O : {d // ¬P d} → Type*} [∀ d, Fintype (O d)] (sets : ∀ d, O d → Finset α) + {degree : ℕ} (hdegree : ∀ d, h d ≤ degree) + (δ : ℝ≥0) (hδ : 0 < δ) (hδ1 : δ ≤ 1) + (y : PartitionedProfileNoiseIndex G Z α B h P → ℝ) (hy : ∀ j, |y j| ≤ 1) + (v : (Σ d, O d) → ℝ) (hv : partitionedIdealRadius α degree + 1 < ‖v‖) : + partitionedRegularizedIdeal h P sets δ y v = 0 := by + have hs := regularizedImageDensity_support + (jointBooleanSource (fun d : {d // ¬P d} => h d.val)) + (partitionedIdealMap h P sets y) δ hδ (partitionedIdealRadius_nonneg α degree) + apply hs + · filter_upwards [jointBooleanSource_ae_closedBall + (α := α) (fun d : {d // ¬P d} => B d.val) (fun d => h d.val)] with x hx + exact partitionedIdealMap_norm_le h P sets hdegree y hy x + (by simpa only [Metric.mem_closedBall, dist_zero_right] using hx) + · have hd : (δ : ℝ) ≤ 1 := hδ1 + linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalActiveProfileRelativeSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalActiveProfileRelativeSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd959b0500c4cd3693143820961bc59db85c4a42 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalActiveProfileRelativeSupport.lean @@ -0,0 +1,44 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalActiveIdealSite + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal BigOperators + +variable {D G α : Type*} [Fintype D] [Fintype G] [Fintype α] [DecidableEq α] + (Z : Type*) [Fintype Z] {B : D → Type*} [∀ d, Fintype (B d)] (h : D → ℕ) + (P : D → Prop) [DecidablePred P] + {O : {d // ¬P d} → Type*} [∀ d, Fintype (O d)] (sets : ∀ d, O d → Finset α) + (R : D → ℝ) (hR : ∀ d, 0 < R d) + +theorem physicalActiveProfileIdeal_normalized_support {degree : ℕ} + (hdegree : ∀ d, h d ≤ degree) (δ : ℝ≥0) (hδ : 0 < δ) (hδ1 : δ ≤ 1) + (v : (Σ d, O d) → ℝ) + (hv : physicalActiveProfileIdeal (G := G) (B := B) Z h P sets R hR δ v ≠ 0) : + ‖fun o : Σ d, O d => v o / R o.1.val‖ ≤ partitionedIdealRadius α degree + 1 := by + apply le_of_not_gt + intro hlarge + apply hv + rw [physicalActiveProfileIdeal_eq, + activeAveragedProfileIdeal_zero_outside Z h P sets hdegree δ hδ hδ1 _ hlarge, + mul_zero] + +theorem physicalActiveProfileIdeal_relative_support {degree : ℕ} + (hdegree : ∀ d, h d ≤ degree) (δ : ℝ≥0) (hδ : 0 < δ) (hδ1 : δ ≤ 1) + (v : (Σ d, O d) → ℝ) + (hv : physicalActiveProfileIdeal (G := G) (B := B) Z h P sets R hR δ v ≠ 0) + (o : Σ d, O d) : + |v o| ≤ (partitionedIdealRadius α degree + 1) * R o.1.val := by + have hs := physicalActiveProfileIdeal_normalized_support Z h P sets R hR hdegree δ hδ hδ1 v hv + have hc := (norm_le_pi_norm (fun q : Σ d, O d => v q / R q.1.val) o).trans hs + rw [Real.norm_eq_abs, abs_div, abs_of_pos (hR o.1.val)] at hc + exact (div_le_iff₀ (hR o.1.val)).mp hc + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalBoxControl.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalBoxControl.lean new file mode 100644 index 0000000000000000000000000000000000000000..b671f7afa27fd356c5ac8499a27885799bd51769 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalBoxControl.lean @@ -0,0 +1,148 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalCellResidual + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {I ι : Type*} [Fintype I] [DecidableEq I] [Fintype ι] [DecidableEq ι] + +noncomputable def physicalBoxTruncation (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (hpos : ∀ i c, 0 < (P i).length c) + (q : ι → ℕ) [∀ j, NeZero (q j)] (b : ℕ) (f : (I → ℤ) → ℝ) (x : I → ℤ) : ℝ := + if hx : x ∈ translatedIntegerBox lo N then + let c := physicalBoxCell lo N P ⟨x, hx⟩ + residuePhysicalTruncation (fun i => intervalCellLower (lo i) (P i) (c i)) + (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hpos c) q b f x + else 0 + +noncomputable def physicalBoxResidual (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (hpos : ∀ i c, 0 < (P i).length c) + (q : ι → ℕ) [∀ j, NeZero (q j)] (b : ℕ) (f : (I → ℤ) → ℝ) (x : I → ℤ) : ℝ := + if x ∈ translatedIntegerBox lo N then f x - physicalBoxTruncation lo N P hpos q b f x else 0 + +theorem physicalBoxResidual_zero_off (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (hpos : ∀ i c, 0 < (P i).length c) + (q : ι → ℕ) [∀ j, NeZero (q j)] (b : ℕ) (f : (I → ℤ) → ℝ) + (x : I → ℤ) (hx : x ∉ translatedIntegerBox lo N) : + physicalBoxResidual lo N P hpos q b f x = 0 := by + simp only [physicalBoxResidual, ite_eq_right hx] + +theorem physicalBoxResidual_eq_sub (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (hpos : ∀ i c, 0 < (P i).length c) + (q : ι → ℕ) [∀ j, NeZero (q j)] (b : ℕ) (f : (I → ℤ) → ℝ) + (hf : ∀ x ∉ translatedIntegerBox lo N, f x = 0) (x : I → ℤ) : + physicalBoxResidual lo N P hpos q b f x = f x - physicalBoxTruncation lo N P hpos q b f x := by + by_cases hx : x ∈ translatedIntegerBox lo N + · simp only [physicalBoxResidual, ite_eq_left hx] + · simp only [physicalBoxResidual, physicalBoxTruncation, ite_eq_right hx, dite_eq_right hx, hf x hx, sub_zero] + +theorem physicalBoxResidual_on_cell (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (hpos : ∀ i c, 0 < (P i).length c) + (q : ι → ℕ) [∀ j, NeZero (q j)] (b : ℕ) (f : (I → ℤ) → ℝ) + (c : ∀ i, (P i).Label) (x : {x : translatedIntegerBox lo N // physicalBoxCell lo N P x = c}) : + physicalBoxResidual lo N P hpos q b f x.val.val = f x.val.val - + residuePhysicalTruncation (fun i => intervalCellLower (lo i) (P i) (c i)) + (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hpos c) q b f x.val.val := by + simp only [physicalBoxResidual, ite_eq_left x.val.property, + physicalBoxTruncation, dite_eq_left x.val.property] + rw [x.property] + +theorem physicalBoxResidual_cell_energy (lo : I → ℤ) (N : I → ℕ) + [Nonempty (translatedIntegerBox lo N)] + (P : ∀ i, FiniteProgressionPartition (N i)) (hstep : ∀ i c, (P i).step c = 1) + (hpos : ∀ i c, 0 < (P i).length c) (q : ι → ℕ) [∀ j, NeZero (q j)] + (b : ℕ) (f : (I → ℤ) → ℝ) (eta : ℝ) (c : ∀ i, (P i).Label) + (hc : ResiduePhysicalTruncationControl (fun i => intervalCellLower (lo i) (P i) (c i)) + (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hpos c) q b f eta) : + finiteCellMean (FiniteProbabilityWeights.uniform (translatedIntegerBox lo N)) (physicalBoxCell lo N P) + (fun x => physicalBoxResidual lo N P hpos q b f x.val ^ 2) c ≤ + (1 + eta * residueTruncationCap ι b eta ^ 2) * + (finiteCellWeights (FiniteProbabilityWeights.uniform (translatedIntegerBox lo N)) (physicalBoxCell lo N P)).weight c := by + exact physical_cell_residual_energy (physicalBoxCell lo N P) c + (fun x => physicalBoxResidual lo N P hpos q b f x.val) _ _ 1 (fun _ => 0) + (physicalBoxCell_nonempty lo N P hpos c) q b f eta hc (physicalBoxCellEquiv lo N P hstep hpos c) + (physicalBoxResidual_on_cell lo N P hpos q b f c) + +theorem physicalBoxResidual_energy (lo : I → ℤ) (N : I → ℕ) + [Nonempty (translatedIntegerBox lo N)] + (P : ∀ i, FiniteProgressionPartition (N i)) (hstep : ∀ i c, (P i).step c = 1) + (hpos : ∀ i c, 0 < (P i).length c) (q : ι → ℕ) [∀ j, NeZero (q j)] + (b : ℕ) (f : (I → ℤ) → ℝ) (eta : ℝ) + (hc : ∀ c : (∀ i, (P i).Label), ResiduePhysicalTruncationControl (fun i => intervalCellLower (lo i) (P i) (c i)) + (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hpos c) q b f eta) : + (FiniteProbabilityWeights.uniform (translatedIntegerBox lo N)).mean + (fun x => physicalBoxResidual lo N P hpos q b f x.val ^ 2) ≤ + 1 + eta * residueTruncationCap ι b eta ^ 2 := by + exact finite_cell_energy_aggregate (FiniteProbabilityWeights.uniform (translatedIntegerBox lo N)) + (physicalBoxCell lo N P) (fun x => physicalBoxResidual lo N P hpos q b f x.val) + (fun c => physicalBoxResidual_cell_energy lo N P hstep hpos q b f eta c (hc c)) + +theorem physicalBoxResidual_cell_residue (lo : I → ℤ) (N : I → ℕ) + [Nonempty (translatedIntegerBox lo N)] + (P : ∀ i, FiniteProgressionPartition (N i)) (hstep : ∀ i c, (P i).step c = 1) + (hpos : ∀ i c, 0 < (P i).length c) (q : ι → ℕ) [∀ j, NeZero (q j)] + (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (b : ℕ) (f : (I → ℤ) → ℝ) (eta : ℝ) (c : ∀ i, (P i).Label) + (hc : ResiduePhysicalTruncationControl (fun i => intervalCellLower (lo i) (P i) (c i)) + (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hpos c) q b f eta) + (J : Finset ι) (hJ : J.card ≤ b) (m : ℕ) [NeZero m] (hm : m ∣ ∏ j ∈ J, q j) (r : I → ZMod m) : + |finiteCellResidueMean (FiniteProbabilityWeights.uniform (translatedIntegerBox lo N)) (physicalBoxCell lo N P) + (fun x => integerVectorResidue m x.val) (fun x => physicalBoxResidual lo N P hpos q b f x.val) c r| ≤ + (finiteCellWeights (FiniteProbabilityWeights.uniform (translatedIntegerBox lo N)) (physicalBoxCell lo N P)).weight c * + (eta * residueTruncationCap ι b eta / (m : ℝ) ^ Fintype.card I) := by + have h := physical_cell_residual_residue (physicalBoxCell lo N P) c + (fun x => physicalBoxResidual lo N P hpos q b f x.val) _ _ 1 (fun _ => 0) + (physicalBoxCell_nonempty lo N P hpos c) q hpair b f eta hc (physicalBoxCellEquiv lo N P hstep hpos c) + (physicalBoxResidual_on_cell lo N P hpos q b f c) J hJ m hm + (fun x => integerVectorResidue m x.val) (fun _ => rfl) r + simpa only [integerVectorResidue_card, Nat.cast_pow] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem residueIndexLength_one_zero (a : ℤ) (N : ℕ) : + residueIndexLength a (a + N) 1 0 = N := by + rw [residueIndexLength_eq_card a (a + N) 1 0 (by norm_num)] + simp [Int.modEq_one] + +theorem residueTruncationCap_nonneg (ι : Type*) [Fintype ι] [DecidableEq ι] + (b : ℕ) {eta : ℝ} (heta : 0 ≤ eta) : 0 ≤ residueTruncationCap ι b eta := by + unfold residueTruncationCap + positivity + +theorem physicalBoxResidual_control_of_lengths {I ι : Type*} + [Fintype I] [DecidableEq I] [Fintype ι] [DecidableEq ι] + (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) + (q : ι → ℕ) [∀ j, NeZero (q j)] (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (b : ℕ) (f : (I → ℤ) → ℝ) (hf : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ f x ∧ f x ≤ 1) + (modLog dimLog accLog eta : ℝ) (hmodLog : 0 ≤ modLog) (heta : eta ≤ 1) + (hacc : Real.exp (-accLog) ≤ eta) (hmoduli : ∀ j, (q j : ℝ) ≤ Real.exp modLog) + (hdim : (Fintype.card I : ℝ) ≤ Real.exp dimLog) + (hlength : ∀ i c, Real.exp (modLog * (2 * b : ℕ) + accLog + dimLog + 1) ≤ ((P i).length c : ℝ)) + (c : ∀ i, (P i).Label) : + ResiduePhysicalTruncationControl (fun i => intervalCellLower (lo i) (P i) (c i)) + (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hpos c) q b f eta := by + apply residuePhysicalTruncation_control_of_lengths _ _ 1 (fun _ => 0) + (physicalBoxCell_nonempty lo N P hpos c) q b f + (fun x hx => hf x (physicalBoxCell_subset lo N P hstep hpos c hx)) + (by decide) (by simp) hpair modLog dimLog accLog eta hmodLog heta hacc hmoduli hdim + intro i + simpa only [Nat.cast_one, residueIndexLength_one_zero] using hlength i (c i) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalBoxPartition.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalBoxPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e4e45930c4d2e56939745a24a8687ac6d2fdf6f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalBoxPartition.lean @@ -0,0 +1,162 @@ +import OAI.Combinatorics.Progressions.Lattices.PhysicalSubboxResidueSlice + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def comparableBoxPartitions {I : Type*} (N H : I → ℕ) + (hH : ∀ i, 0 < H i) (hHN : ∀ i, H i ≤ N i) : ∀ i, FiniteProgressionPartition (N i) := + fun i => FiniteProgressionPartition.mergedIntervals (N i) (H i) (hH i) (hHN i) + +theorem comparableBoxPartitions_step {I : Type*} (N H : I → ℕ) + (hH : ∀ i, 0 < H i) (hHN : ∀ i, H i ≤ N i) (i : I) + (k : (comparableBoxPartitions N H hH hHN i).Label) : + (comparableBoxPartitions N H hH hHN i).step k = 1 := rfl + +theorem comparableBoxPartitions_length {I : Type*} (N H : I → ℕ) + (hH : ∀ i, 0 < H i) (hHN : ∀ i, H i ≤ N i) (i : I) + (k : (comparableBoxPartitions N H hH hHN i).Label) : + H i ≤ (comparableBoxPartitions N H hH hHN i).length k ∧ + (comparableBoxPartitions N H hH hHN i).length k < 2 * H i := + FiniteProgressionPartition.mergedIntervals_length_bounds (N i) (H i) (hH i) (hHN i) k + +theorem comparableBoxPartitions_nonempty {I : Type*} (N H : I → ℕ) + (hH : ∀ i, 0 < H i) (hHN : ∀ i, H i ≤ N i) : + Nonempty (∀ i, (comparableBoxPartitions N H hH hHN i).Label) := + ⟨fun i => ⟨0, Nat.div_pos (hHN i) (hH i)⟩⟩ + +theorem comparableBoxPartitions_card {I : Type*} [Fintype I] [DecidableEq I] + (N H : I → ℕ) (hH : ∀ i, 0 < H i) (hHN : ∀ i, H i ≤ N i) : + Fintype.card (∀ i, (comparableBoxPartitions N H hH hHN i).Label) = ∏ i, N i / H i := by + rw [Fintype.card_pi] + apply Finset.prod_congr rfl + intro i _ + exact FiniteProgressionPartition.mergedIntervals_card (N i) (H i) (hH i) (hHN i) + +theorem intervalCell_width (a : ℤ) {N : ℕ} (P : FiniteProgressionPartition N) (k : P.Label) : + intervalCellUpper a P k - intervalCellLower a P k = P.length k := by + dsimp only [intervalCellLower, intervalCellUpper] + omega + +theorem comparableBoxPartitions_ratio_le {I : Type*} [Fintype I] + (a : I → ℤ) (N H : I → ℕ) (hH : ∀ i, 0 < H i) (hHN : ∀ i, H i ≤ N i) + (r : I → ℤ) (hr : ∀ i, 0 ≤ r i) + (k : ∀ i, (comparableBoxPartitions N H hH hHN i).Label) : + (∑ i, (r i : ℝ) / + ((intervalCellUpper (a i) (comparableBoxPartitions N H hH hHN i) (k i) - + intervalCellLower (a i) (comparableBoxPartitions N H hH hHN i) (k i) : ℤ) : ℝ)) ≤ + ∑ i, (r i : ℝ) / (H i : ℝ) := by + apply Finset.sum_le_sum + intro i _ + rw [intervalCell_width] + have hlen : (H i : ℝ) ≤ (comparableBoxPartitions N H hH hHN i).length (k i) := by + exact_mod_cast (comparableBoxPartitions_length N H hH hHN i (k i)).1 + simp only [Int.cast_natCast] + exact div_le_div_of_nonneg_left (by exact_mod_cast hr i) (by exact_mod_cast hH i) hlen + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {I : Type*} [Fintype I] [DecidableEq I] + +theorem translatedIntegerBox_eq_piFinset (lo : I → ℤ) (N : I → ℕ) : + translatedIntegerBox lo N = Fintype.piFinset (fun i => Finset.Ico (lo i) (lo i + N i)) := by + ext x + simp only [mem_translatedIntegerBox, Fintype.mem_piFinset, Finset.mem_Ico] + +noncomputable def physicalBoxUnitResidueEquiv (lo : I → ℤ) (N : I → ℕ) : + translatedIntegerBox lo N ≃ IntegerResidueBox lo (fun i => lo i + N i) (fun _ => 1) (fun _ => 0) where + toFun x i := ⟨x.val i, Finset.mem_filter.mpr + ⟨Finset.mem_Ico.mpr ((mem_translatedIntegerBox lo N x.val).mp x.property i), Int.modEq_one⟩⟩ + invFun x := ⟨fun i => (x i).val, (mem_translatedIntegerBox lo N _).mpr + (fun i => Finset.mem_Ico.mp (Finset.mem_filter.mp (x i).property).1)⟩ + left_inv _ := rfl + right_inv _ := rfl + +noncomputable def physicalBoxCell (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (x : translatedIntegerBox lo N) : ∀ i, (P i).Label := + boxIntervalResidueCell lo N P (fun _ => 1) (fun _ => 0) (physicalBoxUnitResidueEquiv lo N x) + +theorem physicalBoxCell_eq_iff (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (hstep : ∀ i c, (P i).step c = 1) + (x : translatedIntegerBox lo N) (c : ∀ i, (P i).Label) : + physicalBoxCell lo N P x = c ↔ ∀ i, + intervalCellLower (lo i) (P i) (c i) ≤ x.val i ∧ x.val i < intervalCellUpper (lo i) (P i) (c i) := by + change (fun i => intervalResidueCell (lo i) (P i) 1 0 ((physicalBoxUnitResidueEquiv lo N x) i)) = c ↔ _ + rw [funext_iff] + exact forall_congr' (fun i => intervalResidueCell_eq_iff (lo i) (P i) (hstep i) 1 0 _ (c i)) + +noncomputable def physicalBoxCellEquiv (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) (c : ∀ i, (P i).Label) : + {x : translatedIntegerBox lo N // physicalBoxCell lo N P x = c} ≃ + IntegerResidueBox (fun i => intervalCellLower (lo i) (P i) (c i)) + (fun i => intervalCellLower (lo i) (P i) (c i) + (P i).length (c i)) + (fun _ => 1) (fun _ => 0) := by + let e : {x : translatedIntegerBox lo N // physicalBoxCell lo N P x = c} ≃ + ↥(partitionCell (boxIntervalResidueCell lo N P (fun _ => 1) (fun _ => 0)) c) := + (physicalBoxUnitResidueEquiv lo N).subtypeEquiv (fun x => + (mem_partitionCell (boxIntervalResidueCell lo N P (fun _ => 1) (fun _ => 0)) c + (physicalBoxUnitResidueEquiv lo N x)).symm) + exact e.trans (boxIntervalResidueCellEquiv lo N P hstep hpos (fun _ => 1) (fun _ => 0) c) + +theorem physicalBoxCellEquiv_val (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) (c : ∀ i, (P i).Label) + (x : {x : translatedIntegerBox lo N // physicalBoxCell lo N P x = c}) (i : I) : + (physicalBoxCellEquiv lo N P hstep hpos c x i).val = x.val.val i := rfl + +omit [Fintype I] [DecidableEq I] in +theorem physicalBoxCell_nonempty (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (hpos : ∀ i c, 0 < (P i).length c) + (c : ∀ i, (P i).Label) : + Nonempty (IntegerResidueBox (fun i => intervalCellLower (lo i) (P i) (c i)) + (fun i => intervalCellLower (lo i) (P i) (c i) + (P i).length (c i)) + (fun _ => 1) (fun _ => 0)) := by + refine ⟨fun i => ⟨intervalCellLower (lo i) (P i) (c i), Finset.mem_filter.mpr ⟨?_, Int.modEq_one⟩⟩⟩ + exact Finset.mem_Ico.mpr ⟨le_rfl, lt_add_of_pos_right _ (by exact_mod_cast hpos i (c i))⟩ + +theorem physicalBoxCell_subset (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) (c : ∀ i, (P i).Label) : + translatedIntegerBox (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) ⊆ + translatedIntegerBox lo N := by + intro x hx + apply (mem_translatedIntegerBox lo N x).mpr + intro i + have hi := (mem_translatedIntegerBox _ _ x).mp hx i + have hend : ((P i).start (c i) : ℤ) + (P i).length (c i) ≤ N i := by + exact_mod_cast (P i).end_le_of_step_one (hstep i) (c i) (hpos i (c i)) + have hstart : (0 : ℤ) ≤ (P i).start (c i) := Int.natCast_nonneg _ + dsimp only [intervalCellLower] at hi + constructor <;> omega + +theorem physicalBoxCell_distance_lower (lo : I → ℤ) (N : I → ℕ) + (P : ∀ i, FiniteProgressionPartition (N i)) (hstep : ∀ i c, (P i).step c = 1) + (x : translatedIntegerBox lo N) (i : I) : + |(x.val i : ℝ) - (intervalCellLower (lo i) (P i) (physicalBoxCell lo N P x i) : ℝ)| ≤ + ((P i).length (physicalBoxCell lo N P x i) : ℝ) := by + have hi := (physicalBoxCell_eq_iff lo N P hstep x _).mp rfl i + have hlo : (intervalCellLower (lo i) (P i) (physicalBoxCell lo N P x i) : ℝ) ≤ x.val i := by + exact_mod_cast hi.1 + have hhi : (x.val i : ℝ) < (intervalCellLower (lo i) (P i) (physicalBoxCell lo N P x i) : ℝ) + + ((P i).length (physicalBoxCell lo N P x i) : ℝ) := by exact_mod_cast hi.2 + rw [abs_of_nonneg (sub_nonneg.mpr hlo)] + linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalChartRadiusBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalChartRadiusBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..087bb18cff23232c1ec816190d58a19bd214bb53 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalChartRadiusBudget.lean @@ -0,0 +1,116 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedJetRootAllowance + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable (α : Type*) [Fintype α] + +noncomputable def allocatedPhysicalChartRadius (C : Fin m → ℝ) (H : ℝ) (j : Fin m) : ℝ := + 1 / (4 * (((Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) + 1) * + ((2 : ℝ) ^ Fintype.card α * (H + Fintype.card α) ^ (j.val + 1)) * + ((C j + 1) * ((Fintype.card (I j) : ℝ) + 1)))) + +theorem allocatedPhysicalChartRadius_pos (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + {H : ℝ} (hH : 1 ≤ H) (j : Fin m) : + 0 < allocatedPhysicalChartRadius (G := G) B α C H j := by + have hH0 : 0 < H := zero_lt_one.trans_le hH + have hC0 := hC j + unfold allocatedPhysicalChartRadius + positivity + +theorem allocatedPhysicalChartRadius_bound (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + {H : ℝ} (hH : 1 ≤ H) {R : Fin m → ℝ} (hR : ∀ j, 0 ≤ R j) + (hsmall : ∀ j, R j ≤ allocatedPhysicalChartRadius (G := G) B α C H j) + {H' : ℝ} (hH' : 1 ≤ H') (hHH : H' ≤ H) (j : Fin m) : + (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card α * (H' + Fintype.card α) ^ (j.val + 1)) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * R j)) ≤ 1 / 4 := by + let N := (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) + let M := (2 : ℝ) ^ Fintype.card α * (H + Fintype.card α) ^ (j.val + 1) + let D := (N + 1) * M * ((C j + 1) * ((Fintype.card (I j) : ℝ) + 1)) + have hH0 : 0 < H := zero_lt_one.trans_le hH + have hH'0 : 0 ≤ H' := zero_le_one.trans hH' + have hC0 := hC j + have hD : 0 < D := by dsimp [D, N, M]; positivity + have hcoef : N * ((2 : ℝ) ^ Fintype.card α * (H' + Fintype.card α) ^ (j.val + 1)) * + (C j * ((Fintype.card (I j) : ℝ) + 1)) ≤ D := by + dsimp [D, N, M] + gcongr <;> linarith + calc + _ = (N * ((2 : ℝ) ^ Fintype.card α * (H' + Fintype.card α) ^ (j.val + 1)) * + (C j * ((Fintype.card (I j) : ℝ) + 1))) * R j := by ring + _ ≤ D * R j := mul_le_mul_of_nonneg_right hcoef (hR j) + _ ≤ D * (1 / (4 * D)) := mul_le_mul_of_nonneg_left (hsmall j) hD.le + _ = 1 / 4 := by field_simp [hD.ne'] + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable (α : Type*) [Fintype α] + +theorem allocatedPhysicalChartRadius_inv_le_exp (C : Fin m → ℝ) (hC : ∀ j, 0 ≤ C j) + {H P : ℝ} (hH : 1 ≤ H) (hP : 0 ≤ P) (hHP : H ≤ Real.exp P) + (hCP : ∀ j, C j ≤ Real.exp P) + (hNP : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp P) + (hIP : ∀ j, (Fintype.card (I j) : ℝ) ≤ Real.exp P) (j : Fin m) : + (allocatedPhysicalChartRadius (G := G) B α C H j)⁻¹ ≤ + Real.exp (3 * (P + 1) + Fintype.card α + 2 + + (j.val + 1 : ℕ) * (P + Fintype.card α + 1)) := by + have h1 : 1 ≤ Real.exp P := Real.one_le_exp_iff.mpr hP + have h2 : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have hadd {a : ℝ} (ha : a ≤ Real.exp P) : a + 1 ≤ Real.exp (P + 1) := by + calc + _ ≤ Real.exp P + Real.exp P := add_le_add ha h1 + _ = 2 * Real.exp P := by ring + _ ≤ Real.exp 1 * Real.exp P := mul_le_mul_of_nonneg_right h2 (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have h4 : (4 : ℝ) ≤ Real.exp 2 := by + calc + _ = (2 : ℝ) ^ 2 := by norm_num + _ ≤ (Real.exp 1) ^ 2 := pow_le_pow_left₀ (by norm_num) h2 2 + _ = _ := by rw [← Real.exp_nat_mul]; norm_num + have hq : H + Fintype.card α ≤ Real.exp (P + Fintype.card α + 1) := by + have hq1 : (Fintype.card α : ℝ) + 1 ≤ Real.exp (Fintype.card α + 1) := by + linarith [Real.add_one_le_exp ((Fintype.card α : ℝ) + 1)] + calc + _ ≤ Real.exp P + (Fintype.card α : ℝ) * Real.exp P := + add_le_add hHP (by simpa using mul_le_mul_of_nonneg_left h1 (Nat.cast_nonneg (Fintype.card α))) + _ = ((Fintype.card α : ℝ) + 1) * Real.exp P := by ring + _ ≤ Real.exp (Fintype.card α + 1) * Real.exp P := + mul_le_mul_of_nonneg_right hq1 (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hN := hadd (hNP j) + have hCj := hadd (hCP j) + have hI := hadd (hIP j) + have hC0 := hC j + have hH0 : 0 ≤ H := zero_le_one.trans hH + simp only [allocatedPhysicalChartRadius, one_div, inv_inv] + calc + _ ≤ Real.exp 2 * (Real.exp (P + 1) * + ((Real.exp 1) ^ Fintype.card α * (Real.exp (P + Fintype.card α + 1)) ^ (j.val + 1)) * + (Real.exp (P + 1) * Real.exp (P + 1))) := by gcongr + _ = _ := by + simp only [← Real.exp_nat_mul, ← Real.exp_add] + congr 1 + push_cast + ring + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalFactorCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalFactorCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa89d5a9b5f0af4c95134f9eaa362c685314f0a7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalFactorCoordinates.lean @@ -0,0 +1,25 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalSingleSiteAmbient + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +variable {X : Type*} {m : ℕ} {J : Fin m → Type*} + +noncomputable def physicalMaskedFactorInput (period : ℕ) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (t : X → ℝ) : + (JetAmbientIndex (fun _ : Fin m => Unit) J → UnitAddCircle) × ((Σ j, J j) → UnitAddCircle) := + ((fun a => (eval t (p a.1) a.2.2 : UnitAddCircle)), + (fun a => ((eval t (p a.1) a.2 / period : ℝ) : UnitAddCircle))) + +noncomputable def physicalGridFactorInput (period : ℕ) + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (t : X → ℝ) : + (Σ j, J j) → UnitAddCircle := + fun a => ((eval t (p a.1) a.2 / period : ℝ) : UnitAddCircle) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalNormalizedSpatialFactor.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalNormalizedSpatialFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..22d55f86fcd35b3ba5073a4888f5c418cef8f065 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalNormalizedSpatialFactor.lean @@ -0,0 +1,109 @@ +import OAI.Combinatorics.Progressions.Lattices.PhysicalSpatialResidueSupport + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators Classical NNReal + +variable {K X α : Type*} [Fintype K] [Fintype X] [Fintype α] +variable (root : K → ℤ) (D : Matrix α K ℤ) (base : X → ℤ) +variable (residue : Option K × X → ℤ) (q : X → ℕ) +variable (b : ℝ) (r : ℝ≥0) (H N : X → ℝ) {m : ℕ} +variable (t : X → SpatialSiteLabel α m b r) (s : Finset α) + +local notation "offset" => (fun i : Unit ⊕ α => + physicalCubeVertexValue (physicalCubeRootDifferences root D base residue) (spatialStarVertex i)) + +noncomputable def physicalResidueSpatialMask (u : X → ℤ) : ℂ := + starVertexSiteFactor (fun i u => ∏ x, + (residueSiteIndicator (m := q x * m) + ((offset i x + (q x : ℤ) * (((t x).1 i).val : ℤ) : ℤ) : ZMod (q x * m)) (u x) : ℂ)) s u + +noncomputable def physicalResidueSpatialSmooth (y : X → ℝ) : ℂ := + starVertexSiteFactor (fun i y => vectorIntervalSiteWeight b r (fun x => (t x).2 i) + (fun x => (N x * y x - offset i x) / ((q x : ℝ) * H x))) s y + +theorem physicalResidueSpatialSiteFactor_normalized (hN : ∀ x, N x ≠ 0) (u : X → ℤ) : + physicalResidueSpatialSiteFactor root D base residue q b r H t s u = + physicalResidueSpatialMask root D base residue q b r t s u * + physicalResidueSpatialSmooth root D base residue q b r H N t s (fun x => (u x : ℝ) / N x) := by + unfold physicalResidueSpatialSiteFactor physicalResidueSpatialMask physicalResidueSpatialSmooth + unfold starVertexSiteFactor + rw [← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro i _ + by_cases hi : spatialStarVertex i = s + · simp only [hi, ite_true, physicalResidueStarFactor] + rw [affineVectorResidueSiteWeight_factorization] + congr 1 + apply congrArg (vectorIntervalSiteWeight b r (fun x => (t x).2 i)) + funext x + congr 1 + field_simp [hN x] + · simp only [hi, ite_false, mul_one] + +theorem physicalResidueSpatialSmooth_bounds (hr : 0 < r) {L : ℝ≥0} + (hscale : ∀ x, |N x / ((q x : ℝ) * H x)| ≤ L) : + (∀ y, ‖physicalResidueSpatialSmooth root D base residue q b r H N t s y‖ ≤ 1) ∧ + LipschitzWith (Fintype.card (Unit ⊕ α) * + ((Fintype.card X * ((2 * intervalSiteCount b r + 1) / r)) * L)) + (physicalResidueSpatialSmooth root D base residue q b r H N t s) := by + let f := fun (i : Unit ⊕ α) (y : X → ℝ) => + if spatialStarVertex i = s then vectorIntervalSiteWeight b r (fun x => (t x).2 i) + (fun x => (N x * y x - offset i x) / ((q x : ℝ) * H x)) else 1 + have hn (i : Unit ⊕ α) (y : X → ℝ) : ‖f i y‖ ≤ (1 : ℝ≥0) := by + dsimp only [f] + split_ifs + · exact vectorIntervalSiteWeight_bound b (show (0 : ℝ) < r from hr) _ _ + · simp + have hl (i : Unit ⊕ α) : + LipschitzWith ((Fintype.card X * ((2 * intervalSiteCount b r + 1) / r)) * L) (f i) := by + by_cases hi : spatialStarVertex i = s + · simpa only [f, hi, ite_true] using + affineVectorInterval_normalized_lipschitz b hr (fun x => (t x).2 i) H N q (offset i) hscale + · simpa only [f, hi, ite_false] using + (LipschitzWith.const (α := X → ℝ) (1 : ℂ)).weaken (show 0 ≤ _ from zero_le) + have hp := bounded_lipschitz_fintype_prod f (B := 1) (le_refl _) hl hn + refine ⟨?_, ?_⟩ + · intro y + simpa only [physicalResidueSpatialSmooth, starVertexSiteFactor, f, one_pow, NNReal.coe_one] using hp.1 y + · apply LipschitzWith.of_dist_le_mul + intro y z + simpa only [physicalResidueSpatialSmooth, starVertexSiteFactor, f, one_pow, mul_one] using hp.2.dist_le_mul y z + +theorem physicalResidueSpatialSmooth_pre_lipschitz (hr : 0 < r) {L : ℝ≥0} + (hscale : ∀ x, |N x / ((q x : ℝ) * H x)| ≤ L) + {P EX ES EL : ℝ} (hP : 0 ≤ P) (hb : 0 ≤ b) + (hbox : b ≤ Real.exp P) (hrinv : 1 / (r : ℝ) ≤ Real.exp P) + (hX : (Fintype.card X : ℝ) ≤ Real.exp EX) + (hS : (Fintype.card (Unit ⊕ α) : ℝ) ≤ Real.exp ES) (hL : (L : ℝ) ≤ Real.exp EL) : + LipschitzWith ⟨Real.exp (ES + EX + (3 * P + 6) + EL), Real.exp_nonneg _⟩ + (physicalResidueSpatialSmooth root D base residue q b r H N t s) := by + apply (physicalResidueSpatialSmooth_bounds root D base residue q b r H N t s hr hscale).2.weaken + apply NNReal.coe_le_coe.mp + change (Fintype.card (Unit ⊕ α) : ℝ) * + ((Fintype.card X : ℝ) * ((2 * (intervalSiteCount b r : ℝ) + 1) / (r : ℝ)) * L) ≤ _ + have hi := intervalSiteLipschitz_le_exp hb (show (0 : ℝ) < r from hr) hP hbox hrinv + have hxi := mul_le_mul hX hi (by positivity) (Real.exp_pos EX).le + have hxl := mul_le_mul hxi hL L.coe_nonneg (by positivity) + apply (mul_le_mul hS hxl (by positivity) (Real.exp_pos ES).le).trans_eq + rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + +theorem trimmedSpatialRootScale_normalized_ratio {X : Type*} + (N q : X → ℕ) {τ : ℝ} (hτ : 0 < τ) (hN : ∀ x, 0 < N x) (hq : ∀ x, 0 < q x) (x : X) : + (N x : ℝ) / ((q x : ℝ) * trimmedSpatialRootScale τ N q x) = 8 / τ := by + have hn : (N x : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (hN x).ne' + have hq' : (q x : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (hq x).ne' + unfold trimmedSpatialRootScale + field_simp [hn, hq', hτ.ne'] + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalRowChartMatching.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalRowChartMatching.lean new file mode 100644 index 0000000000000000000000000000000000000000..c67df6ebaec3282b2d28ef9eeddb879b112f4cad --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalRowChartMatching.lean @@ -0,0 +1,56 @@ +import OAI.Combinatorics.Progressions.Linear.PhysicalSiteProjection + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open Module Submodule VectorPolynomial +open scoped Classical + +variable {X : Type*} {m dim : ℕ} {I J E : Fin m → Type*} {n : Fin m → ℕ} +variable [∀ j, Fintype (I j)] [∀ j, Fintype (J j)] [∀ j, Fintype (E j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (E j) ℤ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) +variable (d : ℕ) [NeZero d] + +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin dim) (Fin.val j + 1)) +local notation "O" => (fun j : Fin m => {t : Finset (Fin dim) // t ∈ rowSets j}) + +theorem physicalRowChart_base_matching + (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hm : ∀ j e, coefficients (p j) e ∈ U j) + (v : X → (Unit ⊕ Fin dim) → ℤ) (z : MixedCoveredJetSource I O E n d) + (hz : mixedCoveredJetChart U o b hb bW d z = + physicalCubeRowSample U d (fun _ => Subtype.val) p hm v) + (s : Finset (Fin dim)) (j : Fin m) : + (QuotientAddGroup.mk (physicalEuclideanSitePoint U p hm + (fun x => (physicalCubeVertexValue v s x : ℝ)) j) : euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup) = + normalizedLatticeQuotient (euclideanSubspace (U j)) (b j) (hb j) + (mixedCoveredJetCoordinates U o d (mixedCoveredRowsSiteValue rowSets d z s) j ()).1 := by + have hs : mixedCoveredJetChart U o b hb bW d (mixedCoveredRowsSiteValue rowSets d z s) = + physicalSingleSiteValue U d p hm (fun x => (physicalCubeVertexValue v s x : ℝ)) := by + rw [mixedCoveredRowsSiteValue_chart, hz] + exact coveredRowsSiteValue_physical U d p hm hp v s + have h := congrArg (fun y : EuclideanJetLayers U (fun _ => Unit) => + quotientIntegerCover + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup d + (y j ())) hs + rw [physicalSingleSiteValue_projection] at h + change quotientIntegerCover _ d (normalizedCoveredChart (euclideanSubspace (U j)) + (b j) (hb j) (bW j) d (mixedCoveredJetCoordinates U o d + (mixedCoveredRowsSiteValue rowSets d z s) j ())) = _ at h + rw [normalizedCoveredChart_projection] at h + exact h.symm + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalRowsStandardCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalRowsStandardCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfc28d6c4fcdd1ad346dfdb51944145d8505d4d9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalRowsStandardCoordinates.lean @@ -0,0 +1,83 @@ +import OAI.Combinatorics.Progressions.Estimates.NativePhysicalHaarExpansion + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel +open MeasureTheory VectorPolynomial +open scoped Classical + +variable {m q : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +local notation "Row" => (fun j : Fin m => {s : Finset (Fin q) // s ∈ boundedBooleanJetRows (Fin q) (Fin.val j + 1)}) + +noncomputable def physicalRowsToStandard + (z : EuclideanJetLayers U Row) : + EuclideanJetLayers U (fun j => BoundedBooleanJet (Fin q) (j.val + 1)) := + fun j s => z j ((boundedBooleanJetRowsEquiv (Fin q) (j.val + 1)).symm s) + +theorem physicalRowsToStandard_continuous : + Continuous (physicalRowsToStandard (q := q) U) := by + apply continuous_pi + intro j + apply continuous_pi + intro s + exact (continuous_apply _).comp (continuous_apply j) + +theorem physicalRowsToStandard_coefficient {K : Type*} [Fintype K] + (root : K → ℤ) (D : Matrix (Fin q) K ℤ) (z : CoefficientTorus (K := K) U) : + physicalRowsToStandard U + (euclideanCoefficientJetMap U root D (fun j => (Subtype.val : Row j → Finset (Fin q))) z) = + euclideanCoefficientJetMap U root D + (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) z := by + funext j s + unfold physicalRowsToStandard + simp only [euclideanCoefficientJetMap_apply] + rfl + +theorem physicalRowsToStandard_sample {X : Type*} + (d : ℕ) (p : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : X → ℕ) (j.val + 1) (p j)) + (hm : ∀ j e, coefficients (p j) e ∈ U j) (v : X → (Unit ⊕ Fin q) → ℤ) : + physicalRowsToStandard U (physicalCubeRowSample U d (fun j => (Subtype.val : Row j → Finset (Fin q))) p hm v) = + physicalCubeEuclideanSample U d p hm v := by + rw [← coefficientCoverSample_physicalRows U d p hp hm, physicalRowsToStandard_coefficient] + exact (physicalCubeEuclideanSample_frame U d p hp hm v).symm + +variable [CompactSpace (CoefficientTorus (K := Fin q) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin q) U)] +variable [BorelSpace (CoefficientTorus (K := Fin q) U)] +variable (μ : Measure (CoefficientTorus (K := Fin q) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +include μ in +theorem physicalRowsToStandard_measurePreserving : + MeasurePreserving (physicalRowsToStandard (q := q) U) + (Measure.pi (fun j => Measure.pi (fun _ : Row j => ν j))) + (Measure.pi (fun j => Measure.pi (fun _ : BoundedBooleanJet (Fin q) (j.val + 1) => ν j))) := by + have hr := physicalRowsCoefficient_measurePreserving U μ ν 1 zero_lt_one + have hs := standardPhysicalJetMap_measurePreserving U μ ν + have hc := (physicalRowsToStandard_continuous (q := q) U).measurable + refine ⟨hc, ?_⟩ + rw [← hr.map_eq, Measure.map_map hc hr.measurable] + have he : (physicalRowsToStandard U ∘ (fun z => + euclideanCoefficientJetMap U (fun _ => 0) (1 : Matrix (Fin q) (Fin q) ℤ) + (fun j => (Subtype.val : Row j → Finset (Fin q))) + (quotientIntegerCover (coefficientIntegerLattice U) 1 z))) = standardPhysicalJetMap U := by + funext z + simp only [Function.comp_apply, physicalRowsToStandard_coefficient] + congr 1 + change (1 : ℕ) • z = z + exact one_nsmul z + rw [he] + exact hs.map_eq + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSpatialAnalyticFactor.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSpatialAnalyticFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f8d9425942e36cb7a0c82491133f11c0bea0937 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSpatialAnalyticFactor.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedNormalizedSiteTwist + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel +open scoped BigOperators Classical NNReal + +variable {K X α : Type*} [Fintype K] [Fintype X] [Fintype α] +variable (root : K → ℤ) (D : Matrix α K ℤ) (base : X → ℤ) +variable (residue : Option K × X → ℤ) (stride N : X → ℕ) +variable {τ : ℝ} (mesh : ℝ≥0) {modulus period : ℕ} +variable (t : X → SpatialSiteLabel α modulus 4 mesh) (site : Finset α) +variable {Y : Type*} (F : Y → ℂ) + +local notation "smooth" => physicalResidueSpatialSmooth root D base residue stride 4 mesh + (trimmedSpatialRootScale τ N stride) (fun x => (N x : ℝ)) t site + +noncomputable def physicalSpatialAnalyticContinuous (v : (X → ℝ) × Y) : ℂ := + smooth v.1 * F v.2 + +theorem physicalSpatialAnalytic_normalized [PseudoMetricSpace Y] + (hN : ∀ x, 0 < N x) (hperiod : ∀ x, stride x * modulus ∣ period) + (u : X → ℤ) (y : Y) : + physicalResidueSpatialSiteFactor root D base residue stride 4 mesh + (trimmedSpatialRootScale τ N stride) t site u * F y = + physicalResidueSpatialMaskMod root D base residue stride 4 mesh hperiod t site + (fun x => (u x : ZMod period)) * + physicalSpatialAnalyticContinuous (τ := τ) root D base residue stride N mesh t site F + (fun x => (u x : ℝ) / N x, y) := by + rw [physicalResidueSpatialMaskMod_eval, + physicalResidueSpatialSiteFactor_normalized root D base residue stride 4 mesh + (trimmedSpatialRootScale τ N stride) (fun x => (N x : ℝ)) t site + (fun x => Nat.cast_ne_zero.mpr (hN x).ne')] + exact mul_assoc _ _ _ + +theorem physicalSpatialAnalyticContinuous_bounds [PseudoMetricSpace Y] + (hN : ∀ x, 0 < N x) (hstride : ∀ x, 0 < stride x) (hτ : 0 < τ) (hmesh : 0 < mesh) + {L : ℝ≥0} (hF : LipschitzWith L F) (hFb : ∀ y, ‖F y‖ ≤ 1) + {P EX ES Eτ : ℝ} (hP : 0 ≤ P) + (hbox : (4 : ℝ) ≤ Real.exp P) (hinv : 1 / (mesh : ℝ) ≤ Real.exp P) + (hX : (Fintype.card X : ℝ) ≤ Real.exp EX) + (hα : (Fintype.card (Unit ⊕ α) : ℝ) ≤ Real.exp ES) + (hτexp : 1 / τ ≤ Real.exp Eτ) : + (∀ v, ‖physicalSpatialAnalyticContinuous (τ := τ) root D base residue stride N mesh t site F v‖ ≤ 1) ∧ + LipschitzWith (⟨Real.exp (ES + EX + (3 * P + 6) + (Eτ + 8)), Real.exp_nonneg _⟩ + L) + (physicalSpatialAnalyticContinuous (τ := τ) root D base residue stride N mesh t site F) := by + let Lscale : ℝ≥0 := ⟨8 / τ, div_nonneg (by norm_num) hτ.le⟩ + have hscale (x : X) : |(N x : ℝ) / ((stride x : ℝ) * trimmedSpatialRootScale τ N stride x)| ≤ Lscale := by + rw [trimmedSpatialRootScale_normalized_ratio N stride hτ hN hstride x] + exact (abs_of_nonneg (div_nonneg (by norm_num) hτ.le)).le + have hscaleExp : (Lscale : ℝ) ≤ Real.exp (Eτ + 8) := by + calc + _ = 8 * (1 / τ) := by change 8 / τ = 8 * (1 / τ); ring + _ ≤ Real.exp 8 * Real.exp Eτ := mul_le_mul + (by linarith [Real.add_one_le_exp (8 : ℝ)] : (8 : ℝ) ≤ Real.exp 8) + hτexp (div_nonneg zero_le_one hτ.le) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, add_comm] + have hsp := physicalResidueSpatialSmooth_bounds root D base residue stride 4 mesh + (trimmedSpatialRootScale τ N stride) (fun x => (N x : ℝ)) t site hmesh hscale + have hspLip := physicalResidueSpatialSmooth_pre_lipschitz root D base residue stride 4 mesh + (trimmedSpatialRootScale τ N stride) (fun x => (N x : ℝ)) t site hmesh hscale hP + (by norm_num) hbox hinv hX hα hscaleExp + exact VectorPolynomial.normalizedSiteTwistProduct_bounds smooth F hspLip hF hsp.1 hFb + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSpatialScales.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSpatialScales.lean new file mode 100644 index 0000000000000000000000000000000000000000..99cabaebea7384402d4814afdef71d32e7ee4844 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSpatialScales.lean @@ -0,0 +1,486 @@ +import OAI.Combinatorics.Progressions.Linear.PhysicalCubeMatrix + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +def physicalCubeOptionEquiv (K : Type*) : (Unit ⊕ K) ≃ Option K where + toFun := Sum.elim (fun _ => none) some + invFun := Option.elim' (.inl ()) Sum.inr + left_inv x := by cases x with | inl x => cases x; rfl | inr x => rfl + right_inv x := by cases x <;> rfl + +def physicalCubePivotIndex {α K : Type*} (s : α ↪ K) : (Unit ⊕ α) ↪ Option K where + toFun := Sum.elim (fun _ => none) (fun i => some (s i)) + inj' := by + intro i j h + cases i with + | inl i => cases j with + | inl j => cases i; cases j; rfl + | inr j => cases h + | inr i => cases j with + | inl j => cases h + | inr j => exact congrArg Sum.inr (s.injective (Option.some.inj h)) + +theorem physicalCubePivotIndex_inl {α K : Type*} (s : α ↪ K) (i : Unit) : + physicalCubePivotIndex s (.inl i) = none := rfl + +theorem physicalCubePivotIndex_inr {α K : Type*} (s : α ↪ K) (i : α) : + physicalCubePivotIndex s (.inr i) = some (s i) := rfl + +theorem physicalCubeCoefficient_reindex {α K : Type*} + (root : K → ℤ) (D : Matrix α K ℤ) : + (physicalCubeCoefficient root D).submatrix id (physicalCubeOptionEquiv K) = + rootDifferenceMatrix root D := by + ext i j + cases i <;> cases j <;> rfl + +theorem physicalCubeCoefficient_pivot {α K : Type*} + (root : K → ℤ) (D : Matrix α K ℤ) (s : α ↪ K) : + (physicalCubeCoefficient root D).submatrix id (physicalCubePivotIndex s) = + selectedSpatialPivot root D s := by + ext i j + cases i <;> cases j <;> rfl + +noncomputable def physicalSpatialInputScale (K : Type*) (A R : ℝ) : Option K → ℝ := + Option.elim' A (fun _ => R) + +noncomputable def physicalSpatialOutputScale (α : Type*) (A R L : ℝ) : (Unit ⊕ α) → ℝ := + Sum.elim (fun _ => A) (fun _ => L * R) + +theorem physicalSpatialInputScale_pos (K : Type*) {A R : ℝ} (hA : 0 < A) (hR : 0 < R) : + ∀ k, 0 < physicalSpatialInputScale K A R k := by + intro k + cases k + · exact hA + · exact hR + +theorem physicalSpatialOutputScale_pos (α : Type*) {A R L : ℝ} + (hA : 0 < A) (hR : 0 < R) (hL : 0 < L) : + ∀ i, 0 < physicalSpatialOutputScale α A R L i := by + intro i + cases i + · exact hA + · exact mul_pos hL hR + +theorem physicalCube_normalized_columns {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] [DecidableEq K] + (root : K → ℤ) (D : Matrix α K ℤ) {A R L : ℝ} + (hA : A ≠ 0) (hR : R ≠ 0) (hL : L ≠ 0) : + normalizedIntegerColumns (physicalCubeCoefficient root D) + (physicalSpatialInputScale K A R) (physicalSpatialOutputScale α A R L) = + fun i k => match i, k with + | .inl _, none => 1 + | .inl _, some k => (root k : ℝ) * R / A + | .inr _, none => 0 + | .inr i, some k => (D i k : ℝ) / L := by + ext i k + rw [normalizedIntegerColumns_entry_div] + cases i <;> cases k <;> + simp [physicalCubeCoefficient, physicalSpatialInputScale, physicalSpatialOutputScale, hA] + field_simp + +theorem physicalCube_normalized_pivot {α K : Type*} + [Fintype α] [DecidableEq α] + (root : K → ℤ) (D : Matrix α K ℤ) (s : α ↪ K) {A R L : ℝ} + (hA : A ≠ 0) (hR : R ≠ 0) (hL : L ≠ 0) : + normalizedIntegerPivot ((physicalCubeCoefficient root D).submatrix id (physicalCubePivotIndex s)) + (fun i => physicalSpatialInputScale K A R (physicalCubePivotIndex s i)) + (physicalSpatialOutputScale α A R L) = + rootDifferenceMatrix (fun i => (root (s i) : ℝ) * R / A) + (Matrix.of (fun i j => (D i (s j) : ℝ) / L)) := by + ext i j + rw [normalizedIntegerPivot_entry] + cases i <;> cases j <;> + simp [physicalCubePivotIndex_inl, physicalCubePivotIndex_inr, + physicalCubeCoefficient, physicalSpatialInputScale, + physicalSpatialOutputScale, rootDifferenceMatrix, Matrix.fromBlocks, hA] + field_simp + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +theorem physicalCube_coefficient_bound {α K : Type*} + (root : K → ℤ) (D : Matrix α K ℤ) {C : ℝ} (hC : 1 ≤ C) + (hr : ∀ k, |(root k : ℝ)| ≤ C) (hD : ∀ i k, |(D i k : ℝ)| ≤ C) : + ∀ i k, |(physicalCubeCoefficient root D i k : ℝ)| ≤ C := by + rintro (i | i) (k | k) + · simpa [physicalCubeCoefficient] using hC + · exact hr k + · simpa [physicalCubeCoefficient] using (zero_le_one.trans hC) + · exact hD i k + +theorem physicalCube_normalized_entry_bound {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] [DecidableEq K] + (root : K → ℤ) (D : Matrix α K ℤ) {A R L : ℝ} + (hA : 0 < A) (hR : 0 < R) (hL : 0 < L) + (hr : ∀ k, |(root k : ℝ)| * R ≤ A) (hD : ∀ i k, |(D i k : ℝ)| ≤ L) : + ∀ i k, |normalizedIntegerColumns (physicalCubeCoefficient root D) + (physicalSpatialInputScale K A R) (physicalSpatialOutputScale α A R L) i k| ≤ 1 := by + rw [physicalCube_normalized_columns root D hA.ne' hR.ne' hL.ne'] + rintro (i | i) (k | k) + · norm_num + · dsimp + rw [abs_div, abs_mul, abs_of_pos hA, abs_of_pos hR] + exact (div_le_one hA).mpr (hr k) + · norm_num + · dsimp + rw [abs_div, abs_of_pos hL] + exact (div_le_one hL).mpr (hD i k) + +theorem physicalCube_pivot_control {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] [DecidableEq K] + (root : K → ℤ) (D : Matrix α K ℤ) (s : α ↪ K) {A R L κ : ℝ} + (hA : 0 < A) (hR : 0 < R) (hL : 0 < L) (hκ : 0 < κ) + (hr : ∀ k, |(root k : ℝ)| * R ≤ A) (hD : ∀ i k, |(D i k : ℝ)| ≤ L) + (hminor : κ ≤ |(Matrix.of (fun i j => (D i (s j) : ℝ) / L)).det|) : + ((physicalCubeCoefficient root D).submatrix id (physicalCubePivotIndex s)).det ≠ 0 ∧ + ‖(matrixSupCLM (normalizedIntegerPivot + ((physicalCubeCoefficient root D).submatrix id (physicalCubePivotIndex s)) + (fun i => physicalSpatialInputScale K A R (physicalCubePivotIndex s i)) + (physicalSpatialOutputScale α A R L))).inverse‖ ≤ + (Fintype.card (Unit ⊕ α) : ℝ) * (Fintype.card (Unit ⊕ α)).factorial / κ := by + let M := (physicalCubeCoefficient root D).submatrix id (physicalCubePivotIndex s) + let S := fun i => physicalSpatialInputScale K A R (physicalCubePivotIndex s i) + let P := physicalSpatialOutputScale α A R L + have hS : ∀ i, 0 < S i := fun i => physicalSpatialInputScale_pos K hA hR _ + have hP : ∀ i, 0 < P i := physicalSpatialOutputScale_pos α hA hR hL + have he : normalizedIntegerPivot M S P = + rootDifferenceMatrix (fun i => (root (s i) : ℝ) * R / A) + (Matrix.of (fun i j => (D i (s j) : ℝ) / L)) := + physicalCube_normalized_pivot root D s hA.ne' hR.ne' hL.ne' + have hd : κ ≤ |(normalizedIntegerPivot M S P).det| := by + rw [he, rootDifferenceMatrix_det (fun i => (root (s i) : ℝ) * R / A) + (Matrix.of (fun i j => (D i (s j) : ℝ) / L))] + exact hminor + have hb : ∀ i j, |normalizedIntegerPivot M S P i j| ≤ 1 := by + intro i j + have h := physicalCube_normalized_entry_bound root D hA hR hL hr hD i (physicalCubePivotIndex s j) + simpa only [M, S, P, normalizedIntegerPivot_entry, normalizedIntegerColumns_entry_div, + Matrix.submatrix_apply, id_eq] using h + have hn : M.det ≠ 0 := by + intro hz + have hdet := normalizedIntegerPivot_abs_det M S P hS hP + rw [hz, Int.natAbs_zero, Nat.cast_zero, zero_mul, zero_div] at hdet + rw [hdet] at hd + exact (not_le_of_gt hκ) hd + refine ⟨hn, ?_⟩ + have h := (matrixSupCLM_inverse_norm_le (normalizedIntegerPivot M S P) zero_le_one hb hκ hd).2 + simpa only [one_pow, mul_one, mul_div_assoc] using h + +theorem physicalCubeCoefficient_range {α K : Type*} [Fintype K] + (root : K → ℤ) (D : Matrix α K ℤ) : + (physicalCubeCoefficient root D).mulVecLin.range = (rootDifferenceMatrix root D).mulVecLin.range := by + rw [← integerColumnEquiv_range (physicalCubeCoefficient root D) (physicalCubeOptionEquiv K), + physicalCubeCoefficient_reindex] + +theorem physicalCubeCoefficient_index {α K : Type*} [Fintype α] [Fintype K] + (root : K → ℤ) (D : Matrix α K ℤ) {B : ℕ} + (hperiod : HasBoundedScalarPeriod D.mulVecLin.range B) : + (physicalCubeCoefficient root D).mulVecLin.range.toAddSubgroup.index ≤ B ^ (Fintype.card α + 1) := by + rw [physicalCubeCoefficient_range] + exact rootDifferenceMatrix_index_le root D hperiod + +theorem physicalCube_remaining_norm {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] [DecidableEq K] + (root : K → ℤ) (D : Matrix α K ℤ) (s : α ↪ K) {A R L : ℝ} + (hA : 0 < A) (hR : 0 < R) (hL : 0 < L) + (hr : ∀ k, |(root k : ℝ)| * R ≤ A) (hD : ∀ i k, |(D i k : ℝ)| ≤ L) : + ‖matrixSupCLM (normalizedIntegerColumns + (remainingMatrixColumns (physicalCubeCoefficient root D) (physicalCubePivotIndex s)) + (fun j => physicalSpatialInputScale K A R j.val) (physicalSpatialOutputScale α A R L))‖ ≤ + Fintype.card (UnselectedColumn (physicalCubePivotIndex s)) := by + simpa only [mul_one] using normalized_remainingMatrixColumns_norm + (physicalCubeCoefficient root D) (physicalCubePivotIndex s) + (physicalSpatialInputScale K A R) (physicalSpatialOutputScale α A R L) zero_le_one + (physicalCube_normalized_entry_bound root D hA hR hL hr hD) + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open MeasureTheory +open scoped BigOperators NNReal + +noncomputable def physicalSpatialInverseBound (α : Type*) [Fintype α] (κ : ℝ) : ℝ := + (Fintype.card (Unit ⊕ α) : ℝ) * (Fintype.card (Unit ⊕ α)).factorial / κ + +noncomputable def physicalSpatialMeshCost {α K : Type*} [Fintype α] [Fintype K] + (s : α ↪ K) (C r : ℝ) (lip : ℝ≥0) : ℝ := + 2 * (1 + (2 * r + 2) ^ (Fintype.card (Unit ⊕ α) + + Fintype.card (UnselectedColumn (physicalCubePivotIndex s))) * lip) * + ((Fintype.card (Unit ⊕ α)).factorial * C ^ Fintype.card (Unit ⊕ α)) + +noncomputable def physicalSpatialErrorConstant {α K : Type*} [Fintype α] [Fintype K] + (s : α ↪ K) (B : ℕ) (κ C r cap : ℝ) (lip : ℝ≥0) : ℝ := + normalizedFiberErrorConstant (Fintype.card (Unit ⊕ α)) + (Fintype.card (UnselectedColumn (physicalCubePivotIndex s))) + ((B : ℝ) ^ (Fintype.card α + 1)) (physicalSpatialInverseBound α κ) + (Fintype.card (UnselectedColumn (physicalCubePivotIndex s))) r cap lip * + ((Fintype.card (Unit ⊕ α)).factorial * C ^ Fintype.card (Unit ⊕ α)) + +theorem physicalCube_full_comparison {α K : Type*} + [Fintype α] [DecidableEq α] [Fintype K] [DecidableEq K] + (root : K → ℤ) (D : Matrix α K ℤ) (s : α ↪ K) {A R L κ ρ C : ℝ} {B : ℕ} + (hA : 0 < A) (hR : 0 < R) (hL : 0 < L) (hκ : 0 < κ) (hρ : 0 < ρ) + (hC : 1 ≤ C) (hρA : ρ ≤ A) (hρR : ρ ≤ R) + (hr : ∀ k, |(root k : ℝ)| * R ≤ A) (hD : ∀ i k, |(D i k : ℝ)| ≤ L) + (hrC : ∀ k, |(root k : ℝ)| ≤ C) (hDC : ∀ i k, |(D i k : ℝ)| ≤ C) + (hminor : κ ≤ |(Matrix.of (fun i j => (D i (s j) : ℝ) / L)).det|) + (hperiod : HasBoundedScalarPeriod D.mulVecLin.range B) + (f : (Option K → ℝ) → ℝ) (hf0 : ∀ x, 0 ≤ f x) {lip : ℝ≥0} (hf : LipschitzWith lip f) + {r cap : ℝ} (hr0 : 0 ≤ r) (hcap : 0 ≤ cap) + (hsupport : ∀ x, r < ‖x‖ → f x = 0) (hmass : (∫ x, f x) = 1) + (hbound : ∀ x, ‖f x‖ ≤ cap) (hmesh : physicalSpatialMeshCost s C r lip ≤ ρ) : + let hp := (physicalCube_pivot_control root D s hA hR hL hκ hr hD hminor).1 + ∃ hZ : 0 < coefficientWeightSum f (physicalSpatialInputScale K A R), ∀ v, + |(∏ i, physicalSpatialOutputScale α A R L i) * + (coefficientImagePMF (physicalCubeCoefficient root D) f hf0 + (physicalSpatialInputScale K A R) (physicalSpatialInputScale_pos K hA hR) hsupport hZ v).toReal - + coefficientImageMask (physicalCubeCoefficient root D) (physicalSpatialOutputScale α A R L) + (selectedCoefficientDensity (physicalCubeCoefficient root D) (physicalCubePivotIndex s) hp + (physicalSpatialInputScale K A R) (physicalSpatialOutputScale α A R L) + (physicalSpatialInputScale_pos K hA hR) (physicalSpatialOutputScale_pos α hA hR hL) f) v| ≤ + physicalSpatialErrorConstant s B κ C r cap lip / ρ := by + let M := physicalCubeCoefficient root D + let sel := physicalCubePivotIndex s + let S := physicalSpatialInputScale K A R + let P := physicalSpatialOutputScale α A R L + have hctrl := physicalCube_pivot_control root D s hA hR hL hκ hr hD hminor + have hc : ∀ i j, |(M i (sel j) : ℝ)| ≤ C * (1 : ℝ) ^ 0 := by + intro i j + simpa only [pow_zero, mul_one] using physicalCube_coefficient_bound root D hC hrC hDC i (sel j) + have hdet : (((M.submatrix id sel).det.natAbs : ℝ)) ≤ + (Fintype.card (Unit ⊕ α)).factorial * C ^ Fintype.card (Unit ⊕ α) := by + simpa only [one_pow, mul_one] using integerPivot_polynomial_period_bound (M.submatrix id sel) 0 hc + have hm := enormousCoefficient_mesh_conditions (j := Fintype.card (Unit ⊕ α)) (h := 0) + (D := (Fintype.card (Unit ⊕ α)).factorial * C ^ Fintype.card (Unit ⊕ α)) + (Z := (2 * r + 2) ^ (Fintype.card (Unit ⊕ α) + Fintype.card (UnselectedColumn sel)) * lip) + (L := 1) (H := ρ) (by positivity) (by positivity) (by norm_num) hρ + (by simpa only [physicalSpatialMeshCost, one_pow, mul_one] using hmesh) + simp only [one_pow, mul_one, div_one] at hm + have hsmall : (2 * r + 2) ^ (Fintype.card (Unit ⊕ α) + Fintype.card (UnselectedColumn sel)) * lip * + (((M.submatrix id sel).det.natAbs : ℝ) / ρ) ≤ 1 / 2 := by + apply le_trans _ hm.2 + exact mul_le_mul_of_nonneg_left (div_le_div_of_nonneg_right hdet hρ.le) (by positivity) + have hindex : (M.mulVecLin.range.toAddSubgroup.index : ℝ) ≤ (B : ℝ) ^ (Fintype.card α + 1) := by + exact_mod_cast physicalCubeCoefficient_index root D hperiod + have hscale : ∀ k, ρ ≤ S k := by + intro k + cases k + · exact hρA + · exact hρR + have he := coefficientImage_polynomial_error M sel hctrl.1 S P + (physicalSpatialInputScale_pos K hA hR) (physicalSpatialOutputScale_pos α hA hR hL) + f hf0 hf 0 hr0 hρ hcap hscale (hdet.trans hm.1) hc hsupport hmass hsmall hbound hindex hctrl.2 + (physicalCube_remaining_norm root D s hA hR hL hr hD) + simpa only [physicalSpatialErrorConstant, physicalSpatialInverseBound, one_pow, mul_one] using he + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +noncomputable def physicalSpatialCommonBudget (j d n : ℕ) (b : ℝ) : ℝ := + (j : ℝ) * b + (j : ℝ) ^ 2 + j + b + d + affineProfileLogBound n 0 + 2 + +theorem physicalSpatialCommonBudget_bounds (j d n : ℕ) {b : ℝ} (hb : 0 ≤ b) : + b ≤ physicalSpatialCommonBudget j d n b ∧ + (j : ℝ) * b ≤ physicalSpatialCommonBudget j d n b ∧ + (j : ℝ) ^ 2 + j + b ≤ physicalSpatialCommonBudget j d n b ∧ + (d : ℝ) ≤ physicalSpatialCommonBudget j d n b ∧ + affineProfileLogBound n 0 ≤ physicalSpatialCommonBudget j d n b ∧ + 2 ≤ physicalSpatialCommonBudget j d n b := by + have hj := Nat.cast_nonneg (α := ℝ) j + have hd := Nat.cast_nonneg (α := ℝ) d + have hf := affineProfileLogBound_nonneg n (by norm_num : (0 : ℝ) ≤ 0) + have hm := mul_nonneg hj hb + have hs := sq_nonneg (j : ℝ) + unfold physicalSpatialCommonBudget + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ <;> linarith + +noncomputable def physicalSpatialLogAllowance {α K : Type*} [Fintype α] [Fintype K] + (s : α ↪ K) (b : ℝ) : ℝ := + let j := Fintype.card (Unit ⊕ α) + let d := Fintype.card (UnselectedColumn (physicalCubePivotIndex s)) + coefficientLogAllowance j d (physicalSpatialCommonBudget j d (Fintype.card (Option K)) b) + +theorem physicalSpatialLogAllowance_nonneg {α K : Type*} [Fintype α] [Fintype K] + (s : α ↪ K) {b : ℝ} (hb : 0 ≤ b) : 0 ≤ physicalSpatialLogAllowance s b := by + have hc := hb.trans (physicalSpatialCommonBudget_bounds (Fintype.card (Unit ⊕ α)) + (Fintype.card (UnselectedColumn (physicalCubePivotIndex s))) (Fintype.card (Option K)) hb).1 + unfold physicalSpatialLogAllowance coefficientLogAllowance + positivity + +theorem physicalSpatialInverseBound_le_exp (α : Type*) [Fintype α] {κ b : ℝ} + (hκ : 0 < κ) (hi : κ⁻¹ ≤ Real.exp b) : + physicalSpatialInverseBound α κ ≤ + Real.exp ((Fintype.card (Unit ⊕ α) : ℝ) ^ 2 + Fintype.card (Unit ⊕ α) + b) := by + let j := Fintype.card (Unit ⊕ α) + have hj : (j : ℝ) ≤ Real.exp (j : ℝ) := by linarith [Real.add_one_le_exp (j : ℝ)] + change (j : ℝ) * j.factorial / κ ≤ _ + calc + _ ≤ Real.exp (j : ℝ) * Real.exp ((j : ℝ) ^ 2) * Real.exp b := by + rw [div_eq_mul_inv] + gcongr + exact factorial_le_exp_sq j + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + +theorem physicalSpatial_constants_le_exp {α K : Type*} [Fintype α] [Fintype K] + (s : α ↪ K) {M : ℕ} {κ C b : ℝ} (hb : 0 ≤ b) (hκ : 0 < κ) (hC0 : 0 ≤ C) + (hM : (M : ℝ) ≤ Real.exp b) (hi : κ⁻¹ ≤ Real.exp b) (hC : C ≤ Real.exp b) : + physicalSpatialMeshCost s C 2 (affineProductProfileLip (Option K) 1) ≤ + Real.exp (physicalSpatialLogAllowance s b) ∧ + physicalSpatialErrorConstant s M κ C 2 1 (affineProductProfileLip (Option K) 1) ≤ + Real.exp (physicalSpatialLogAllowance s b) := by + let j := Fintype.card (Unit ⊕ α) + let d := Fintype.card (UnselectedColumn (physicalCubePivotIndex s)) + let B := physicalSpatialCommonBudget j d (Fintype.card (Option K)) b + have hs := physicalSpatialCommonBudget_bounds j d (Fintype.card (Option K)) hb + have hB : 0 ≤ B := hb.trans hs.1 + have hC' : C ≤ Real.exp B := hC.trans (Real.exp_le_exp.mpr hs.1) + have hM' : (M : ℝ) ^ (Fintype.card α + 1) ≤ Real.exp B := by + have hj : Fintype.card α + 1 = j := by simp [j, Nat.add_comm] + calc + _ ≤ (Real.exp b) ^ (Fintype.card α + 1) := by gcongr + _ = Real.exp ((j : ℝ) * b) := by rw [← Real.exp_nat_mul, hj] + _ ≤ _ := Real.exp_le_exp.mpr hs.2.1 + have hU : physicalSpatialInverseBound α κ ≤ Real.exp B := + (physicalSpatialInverseBound_le_exp α hκ hi).trans (Real.exp_le_exp.mpr hs.2.2.1) + have hd : (d : ℝ) ≤ Real.exp B := by + have : (d : ℝ) ≤ Real.exp (d : ℝ) := by linarith [Real.add_one_le_exp (d : ℝ)] + exact this.trans (Real.exp_le_exp.mpr hs.2.2.2.1) + have hR : (2 : ℝ) ≤ Real.exp B := by + have : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + exact this.trans (Real.exp_le_exp.mpr hs.2.2.2.2.2) + have hH : (1 : ℝ) ≤ Real.exp B := Real.one_le_exp hB + have hK : (affineProductProfileLip (Option K) 1 : ℝ) ≤ Real.exp B := + (affineProductProfileLip_le_exp (Option K) (δ := 1) (t := 0) (by norm_num)).trans + (Real.exp_le_exp.mpr hs.2.2.2.2.1) + constructor + · exact coefficientMeshConstant_le_exp j d _ hB (by norm_num) hC0 hR hC' hK + · exact coefficientComparisonConstant_le_exp j d _ hB (by positivity) + (by unfold physicalSpatialInverseBound; positivity) (by positivity) + (by norm_num) (by norm_num) hC0 hM' hU hd hR hH hK hC' + +theorem physicalSpatial_tolerance_numerics {b E W q τ N ε : ℝ} + (hb : 0 ≤ b) (hE : 0 ≤ E) (hW : 0 ≤ W) (hq : 0 ≤ q) + (hτ : 0 < τ) + (hWexp : W ≤ Real.exp b) (hqexp : q ≤ Real.exp b) + (hτexp : τ⁻¹ ≤ Real.exp b) (hεexp : ε⁻¹ ≤ Real.exp b) + (hN : Real.exp (E + 4 * b + 12) ≤ N) : + let ρ := Real.exp (E + b + 2) + 1 ≤ ρ ∧ Real.exp E * (1 + ε⁻¹) ≤ ρ ∧ 8 * (1 + W) * q * ρ ≤ τ * N := by + have hplus (a : ℝ) (ha : a ≤ Real.exp b) : 1 + a ≤ Real.exp (b + 2) := by + have htwo : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + calc + _ ≤ Real.exp b * 2 := by linarith [Real.one_le_exp hb] + _ ≤ Real.exp b * Real.exp 2 := mul_le_mul_of_nonneg_left htwo (Real.exp_nonneg b) + _ = _ := (Real.exp_add _ _).symm + dsimp only + refine ⟨Real.one_le_exp (by linarith), ?_, ?_⟩ + · calc + _ ≤ Real.exp E * Real.exp (b + 2) := + mul_le_mul_of_nonneg_left (hplus ε⁻¹ hεexp) (Real.exp_nonneg E) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + · have hside : 8 * (1 + W) * q * Real.exp (E + b + 2) * τ⁻¹ ≤ N := by + calc + _ ≤ Real.exp 8 * Real.exp (b + 2) * Real.exp b * Real.exp (E + b + 2) * Real.exp b := by + gcongr + · linarith [Real.add_one_le_exp (8 : ℝ)] + · exact hplus W hWexp + _ = Real.exp (E + 4 * b + 12) := by + simp only [← Real.exp_add] + congr 1 + ring + _ ≤ N := hN + have hdiv : (8 * (1 + W) * q * Real.exp (E + b + 2)) / τ ≤ N := by + simpa only [div_eq_mul_inv] using hside + simpa only [mul_comm N τ] using (div_le_iff₀ hτ).mp hdiv + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators + +noncomputable def trimmedSpatialRootScale {X : Type*} (τ : ℝ) (N modulus : X → ℕ) (x : X) : ℝ := + τ * (N x : ℝ) / 8 / modulus x + +noncomputable def trimmedSpatialSlopeScale {X : Type*} (B τ : ℝ) (N modulus : X → ℕ) (x : X) : ℝ := + τ * (N x : ℝ) / (8 * (1 + B)) / modulus x + +theorem trimmedSpatial_residue_scale {K X : Type*} (B τ : ℝ) (N modulus : X → ℕ) (x : X) : + (fun k => residueProfileWidth modulus (trimmedSpatialWidths (K := K) B τ N) (k, x)) = + physicalSpatialInputScale K (trimmedSpatialRootScale τ N modulus x) + (trimmedSpatialSlopeScale B τ N modulus x) := by + funext k + cases k <;> simp only [residueProfileWidth, trimmedSpatialWidths, centeredSpatialWidths, + physicalSpatialInputScale, Option.elim', trimmedSpatialRootScale, trimmedSpatialSlopeScale, one_mul] <;> ring + +theorem trimmedSpatial_scales_pos {X : Type*} {B τ : ℝ} (hB : 0 ≤ B) (hτ : 0 < τ) + (N modulus : X → ℕ) (x : X) (hN : 0 < N x) (hq : 0 < modulus x) : + 0 < trimmedSpatialRootScale τ N modulus x ∧ 0 < trimmedSpatialSlopeScale B τ N modulus x := by + have hn : (0 : ℝ) < N x := by exact_mod_cast hN + have hq' : (0 : ℝ) < modulus x := by exact_mod_cast hq + unfold trimmedSpatialRootScale trimmedSpatialSlopeScale + constructor <;> positivity + +theorem trimmedSpatial_scale_ratio {X : Type*} {B τ : ℝ} (hB : 0 ≤ B) + (N modulus : X → ℕ) (x : X) : + trimmedSpatialRootScale τ N modulus x = + (1 + B) * trimmedSpatialSlopeScale B τ N modulus x := by + have hb : 1 + B ≠ 0 := ne_of_gt (by linarith) + unfold trimmedSpatialRootScale trimmedSpatialSlopeScale + field_simp + +theorem trimmedSpatial_root_control {K X : Type*} [Fintype K] {B τ : ℝ} + (hB : 0 ≤ B) (hτ : 0 < τ) (N modulus : X → ℕ) (x : X) + (hN : 0 < N x) (hq : 0 < modulus x) (root : K → ℤ) + (hroot : (∑ k, |(root k : ℝ)|) ≤ B) (k : K) : + |(root k : ℝ)| * trimmedSpatialSlopeScale B τ N modulus x ≤ trimmedSpatialRootScale τ N modulus x := by + have hr : |(root k : ℝ)| ≤ B := + (Finset.single_le_sum (fun j _ => abs_nonneg (root j : ℝ)) (Finset.mem_univ k)).trans hroot + rw [trimmedSpatial_scale_ratio hB] + exact mul_le_mul_of_nonneg_right (by linarith) (trimmedSpatial_scales_pos hB hτ N modulus x hN hq).2.le + +theorem trimmedSpatial_scale_lower {X : Type*} {B τ ρ : ℝ} + (hB : 0 ≤ B) (hρ : 0 ≤ ρ) (N modulus : X → ℕ) (x : X) (hq : 0 < modulus x) + (hlarge : 8 * (1 + B) * (modulus x : ℝ) * ρ ≤ τ * (N x : ℝ)) : + ρ ≤ trimmedSpatialRootScale τ N modulus x ∧ ρ ≤ trimmedSpatialSlopeScale B τ N modulus x := by + have hq' : (0 : ℝ) < modulus x := by exact_mod_cast hq + have hb : (0 : ℝ) < 8 * (1 + B) := by positivity + have hs : ρ ≤ trimmedSpatialSlopeScale B τ N modulus x := by + unfold trimmedSpatialSlopeScale + apply (le_div_iff₀ hq').mpr + apply (le_div_iff₀ hb).mpr + nlinarith [hlarge] + refine ⟨?_, hs⟩ + unfold trimmedSpatialRootScale + apply (le_div_iff₀ hq').mpr + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 8)).mpr + nlinarith [mul_nonneg hB (mul_nonneg hq'.le hρ)] + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSupportedCubes.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSupportedCubes.lean new file mode 100644 index 0000000000000000000000000000000000000000..87f3ee227bb1a3db6820e408a844d202f4a27866 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PhysicalSupportedCubes.lean @@ -0,0 +1,111 @@ +import OAI.Combinatorics.Progressions.Estimates.PhysicalRowsSiteReconstruction + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators + +def physicalCubeParametersEquiv (X : Type*) (dim : ℕ) : + (X → (Unit ⊕ Fin dim) → ℤ) ≃ (Fin dim → X → ℤ) × (X → ℤ) where + toFun v := (fun i x => v x (.inr i), fun x => v x (.inl ())) + invFun p := fun x => Sum.elim (fun _ => p.2 x) (fun i => p.1 i x) + left_inv v := by + funext x i + cases i with + | inl i => cases i; rfl + | inr i => rfl + right_inv p := rfl + +theorem physicalCubeParametersEquiv_vertex {X : Type*} (dim : ℕ) + (v : X → (Unit ⊕ Fin dim) → ℤ) (ω : Fin dim → Bool) : + physicalCubeVertexValue v (Finset.univ.filter (fun i => ω i)) = + (physicalCubeParametersEquiv X dim v).2 + + cubeShift (physicalCubeParametersEquiv X dim v).1 ω := by + funext x + change v x (.inl ()) + ∑ i ∈ Finset.univ.filter (fun i => ω i), v x (.inr i) = + v x (.inl ()) + (∑ i, if ω i then (fun x => v x (.inr i)) else 0) x + simp only [Finset.sum_filter, Finset.sum_apply] + apply congrArg (fun z : ℤ => v x (.inl ()) + z) + apply Finset.sum_congr rfl + intro i _ + split_ifs <;> rfl + +theorem physicalCubeParametersEquiv_support_iff {X : Type*} (dim : ℕ) + (Q : Set (X → ℤ)) (v : X → (Unit ⊕ Fin dim) → ℤ) : + (∀ s : Finset (Fin dim), physicalCubeVertexValue v s ∈ Q) ↔ + ∀ ω : Fin dim → Bool, (physicalCubeParametersEquiv X dim v).2 + + cubeShift (physicalCubeParametersEquiv X dim v).1 ω ∈ Q := by + classical + constructor + · intro hv ω + rw [← physicalCubeParametersEquiv_vertex] + exact hv _ + · intro hv s + have h := hv (fun i => decide (i ∈ s)) + rw [← physicalCubeParametersEquiv_vertex] at h + simpa using h + +def physicalSupportedCubeEquiv (X : Type*) (dim : ℕ) (Q : Set (X → ℤ)) : + {v : X → (Unit ⊕ Fin dim) → ℤ // ∀ s, physicalCubeVertexValue v s ∈ Q} ≃ + SupportedCube dim Q where + toFun v := ⟨physicalCubeParametersEquiv X dim v.val, + (physicalCubeParametersEquiv_support_iff dim Q v.val).mp v.property⟩ + invFun p := ⟨(physicalCubeParametersEquiv X dim).symm p.val, + (physicalCubeParametersEquiv_support_iff dim Q _).mpr (by + simpa only [Equiv.apply_symm_apply] using p.property)⟩ + left_inv v := by apply Subtype.ext; exact Equiv.symm_apply_apply _ _ + right_inv p := by apply Subtype.ext; exact Equiv.apply_symm_apply _ _ + +noncomputable def physicalIntegerBoxCubes {X : Type*} [Fintype X] [DecidableEq X] + (N : X → ℕ) (dim : ℕ) : Finset (X → (Unit ⊕ Fin dim) → ℤ) := + Finset.univ.image (fun p : SupportedCube dim (integerBox N : Set (X → ℤ)) => + (physicalCubeParametersEquiv X dim).symm p.val) + +theorem mem_physicalIntegerBoxCubes {X : Type*} [Fintype X] [DecidableEq X] + (N : X → ℕ) (dim : ℕ) (v : X → (Unit ⊕ Fin dim) → ℤ) : + v ∈ physicalIntegerBoxCubes N dim ↔ ∀ s, physicalCubeVertexValue v s ∈ integerBox N := by + classical + constructor + · intro hv + obtain ⟨p, _, rfl⟩ := Finset.mem_image.mp hv + exact ((physicalSupportedCubeEquiv X dim (integerBox N : Set (X → ℤ))).symm p).property + · intro hv + let p := physicalSupportedCubeEquiv X dim (integerBox N : Set (X → ℤ)) ⟨v, hv⟩ + exact Finset.mem_image.mpr ⟨p, Finset.mem_univ _, Equiv.symm_apply_apply _ _⟩ + +theorem physicalIntegerBoxCubes_card {X : Type*} [Fintype X] [DecidableEq X] + (N : X → ℕ) (dim : ℕ) : + (physicalIntegerBoxCubes N dim).card = integerBoxCubeCount N dim := by + classical + rw [physicalIntegerBoxCubes, Finset.card_image_of_injective] + · simp only [Finset.card_univ, integerBoxCubeCount, Nat.card_eq_fintype_card] + · exact (physicalCubeParametersEquiv X dim).symm.injective.comp Subtype.val_injective + +theorem physicalIntegerBoxCubes_sum {X : Type*} [Fintype X] [DecidableEq X] + (N : X → ℕ) (dim : ℕ) (φ : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) : + (∑ v ∈ physicalIntegerBoxCubes N dim, φ v) = + ∑ p : SupportedCube dim (integerBox N : Set (X → ℤ)), + φ ((physicalCubeParametersEquiv X dim).symm p.val) := by + classical + rw [physicalIntegerBoxCubes, Finset.sum_image] + intro p _ t _ h + exact Subtype.ext ((physicalCubeParametersEquiv X dim).symm.injective h) + +theorem physicalIntegerBoxCubes_sum_eq_count_mul_mean {X : Type*} + [Fintype X] [DecidableEq X] (N : X → ℕ) (dim : ℕ) + (φ : (X → (Unit ⊕ Fin dim) → ℤ) → ℂ) : + (∑ v ∈ physicalIntegerBoxCubes N dim, φ v) = + (integerBoxCubeCount N dim : ℂ) * + 𝔼 p : SupportedCube dim (integerBox N : Set (X → ℤ)), + φ ((physicalCubeParametersEquiv X dim).symm p.val) := by + rw [physicalIntegerBoxCubes_sum, integerBoxCubeCount, Nat.card_eq_fintype_card, + ← nsmul_eq_mul, Fintype.card_smul_expect] + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PivotCoordinateChange.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PivotCoordinateChange.lean new file mode 100644 index 0000000000000000000000000000000000000000..a13ded17d5bc950958b77d739430c7ff62d7522c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PivotCoordinateChange.lean @@ -0,0 +1,93 @@ +import Mathlib.MeasureTheory.Group.Prod +import OAI.Combinatorics.Progressions.Probability.DiagonalDensityTransport + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ENNReal + +variable {I J : Type*} [Fintype I] [Fintype J] + +noncomputable def pivotCoordinateChange (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) : + ((J → ℝ) × (I → ℝ)) ≃ₜ ((J → ℝ) × (I → ℝ)) where + toFun p := (p.1, A p.2 + B p.1) + invFun p := (p.1, A.symm (p.2 - B p.1)) + left_inv p := by simp + right_inv p := by simp + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop + +theorem pivotCoordinateChange_inverse_map (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) : + Measure.map (pivotCoordinateChange A B).symm volume = + ENNReal.ofReal ((inverseJacobian A)⁻¹) • volume := by + have hs (y : J → ℝ) : + Measure.map (fun x => A.symm (x - B y)) volume = + ENNReal.ofReal ((inverseJacobian A)⁻¹) • volume := by + have ht : Measure.map (fun x : I → ℝ => x - B y) volume = volume := by + simpa only [sub_eq_add_neg] using (measurePreserving_add_right volume (-B y)).map_eq + rw [show (fun x => A.symm (x - B y)) = A.symm ∘ (fun x => x - B y) from rfl, + ← Measure.map_map A.symm.continuous.measurable (by fun_prop), ht] + exact inverse_map_volume A + have hp := (MeasurePreserving.id (volume : Measure (J → ℝ))).skew_product + (g := fun y x => A.symm (x - B y)) (by fun_prop) (Filter.Eventually.of_forall hs) + change Measure.map (fun p : (J → ℝ) × (I → ℝ) => (p.1, A.symm (p.2 - B p.1))) + (volume.prod volume) = _ + simpa only [id_eq, Measure.prod_smul_right, Measure.volume_eq_prod] using hp.map_eq + +theorem integral_comp_inverse_pivot (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) (f : (J → ℝ) × (I → ℝ) → ℝ) : + (∫ p, f ((pivotCoordinateChange A B).symm p)) = + (inverseJacobian A)⁻¹ * ∫ p, f p := by + have h := (pivotCoordinateChange A B).symm.measurableEmbedding.integral_map + (μ := volume) f + rw [pivotCoordinateChange_inverse_map, integral_smul_measure, + ENNReal.toReal_ofReal (inv_nonneg.mpr (inverseJacobian_pos A).le)] at h + exact h.symm + +noncomputable def pivotDensityPullback (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) (f : (J → ℝ) × (I → ℝ) → ℝ) + (p : (J → ℝ) × (I → ℝ)) : ℝ := + inverseJacobian A * f ((pivotCoordinateChange A B).symm p) + +theorem pivotDensityPullback_measurable (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) {f : (J → ℝ) × (I → ℝ) → ℝ} + (hf : Measurable f) : Measurable (pivotDensityPullback A B f) := + measurable_const.mul (hf.comp (pivotCoordinateChange A B).symm.continuous.measurable) + +theorem pivotDensityPullback_integrable (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) {f : (J → ℝ) × (I → ℝ) → ℝ} + (hf : Integrable f) : Integrable (pivotDensityPullback A B f) := by + have hm : Integrable f (Measure.map (pivotCoordinateChange A B).symm volume) := by + rw [pivotCoordinateChange_inverse_map] + exact hf.smul_measure ENNReal.ofReal_ne_top + exact ((pivotCoordinateChange A B).symm.measurableEmbedding.integrable_map_iff.mp hm).const_mul _ + +theorem pivotDensityPullback_integral (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) (f : (J → ℝ) × (I → ℝ) → ℝ) : + (∫ p, pivotDensityPullback A B f p) = ∫ p, f p := by + unfold pivotDensityPullback + rw [integral_const_mul, integral_comp_inverse_pivot, ← mul_assoc, + mul_inv_cancel₀ (inverseJacobian_pos A).ne', one_mul] + +theorem pivotDensityPullback_test_integral (A : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (B : (J → ℝ) →L[ℝ] (I → ℝ)) (f φ : (J → ℝ) × (I → ℝ) → ℝ) : + (∫ p, pivotDensityPullback A B f p * φ p) = + ∫ p, f p * φ ((pivotCoordinateChange A B) p) := by + have heq (p : (J → ℝ) × (I → ℝ)) : + pivotDensityPullback A B f p * φ p = + pivotDensityPullback A B (fun q => f q * φ (pivotCoordinateChange A B q)) p := by + simp only [pivotDensityPullback, Homeomorph.apply_symm_apply, mul_assoc] + simp_rw [heq] + exact pivotDensityPullback_integral A B _ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PolarizedCoefficientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PolarizedCoefficientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bab26022cc08939988ae28935360e2f966c1266 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PolarizedCoefficientCoordinates.lean @@ -0,0 +1,52 @@ +import OAI.Combinatorics.Progressions.Polynomial.RealPolarizedPolynomialOrbit + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open VectorPolynomial + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem polarizedCoefficient_self (p : F.adaptedLieSubalgebra) (a : SquarefreeIndex ι) + (ha : a.val ≠ 0) : + squarefreePolynomialEquiv (F.polarizedCoefficient π p a).val a = + (multidegreeFactorial (blockDegree π a.val) : ℚ) • + coefficients p.val (blockExponent π a.val) := by + rw [F.polarizedCoefficient_coe π p a ha, map_smul, Pi.smul_apply, + squarefreePolynomialEquiv_monomial_self] + +theorem polarizedCoefficient_ne (p : F.adaptedLieSubalgebra) (a c : SquarefreeIndex ι) + (hac : a ≠ c) : squarefreePolynomialEquiv (F.polarizedCoefficient π p a).val c = 0 := by + by_cases ha : a.val = 0 + · rw [F.polarizedCoefficient_zero π p a ha] + exact congrFun (map_zero squarefreePolynomialEquiv) c + · rw [F.polarizedCoefficient_coe π p a ha, map_smul, Pi.smul_apply, + squarefreePolynomialEquiv_monomial_ne a c hac, smul_zero] + +theorem polarizedLog_eval_coefficient (p : F.adaptedLieSubalgebra) + (x : ι → ℚ) (c : SquarefreeIndex ι) : + squarefreePolynomialEquiv (eval x (F.polarizedLog π p)).val c = + (c.val.prod fun i n => x i ^ n) • + squarefreePolynomialEquiv (F.polarizedCoefficient π p c).val c := by + classical + let C : F.SquarefreeAlgebra π →ₗ[ℚ] L := (LinearMap.proj c).comp + (squarefreePolynomialEquiv.toLinearMap.comp (F.squarefreeAdaptedSubalgebra π).incl.toLinearMap) + change C (eval x (F.polarizedLog π p)) = _ + rw [F.polarizedLog_eval, map_sum] + simp only [map_smul] + rw [Finset.sum_eq_single c] + · rfl + · intro a _ hac + have hz : C (F.polarizedCoefficient π p a) = 0 := F.polarizedCoefficient_ne π p a c hac + rw [hz, smul_zero] + · simp + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PositiveCyclicCoordinateProduct.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PositiveCyclicCoordinateProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cd10cf9db1cce6bec986af63a56c13af0214b56 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PositiveCyclicCoordinateProduct.lean @@ -0,0 +1,90 @@ +import OAI.Combinatorics.Progressions.Estimates.CommonPositivePartitionRefinement +import OAI.Combinatorics.Progressions.Lattices.NativeIntegerAffinePullbackHom + +namespace OAI + +section + +universe u + +namespace Erdos3.PositiveCyclicModel + +open scoped TensorProduct + +attribute [local instance] PositiveCyclicModel.lie PositiveCyclicModel.algebra + PositiveCyclicModel.topology PositiveCyclicModel.topologicalAdd + PositiveCyclicModel.continuousSMul PositiveCyclicModel.hausdorff + +variable {s N : ℕ} [NeZero N] {p : ℝ} {f : ZMod N → ℝ} + (R : PositiveCyclicModel.{u} s N p f) {σ : Type*} [Fintype σ] + +noncomputable def coordinateTest (i : σ) : R.model.Niltest (fun _ : σ => 1) := + R.test.linearPullbackHom (fun _ : Unit => + { toFun := fun x => x i, map_zero' := rfl, map_add' := fun _ _ => rfl }) + +theorem coordinateTest_eval (i : σ) (x : σ → ℤ) : + (R.coordinateTest i).eval x = R.test.eval (fun _ => x i) := by + exact R.test.eval_linearPullbackHom _ x + +theorem coordinateTest_complexity (i : σ) : + (R.coordinateTest i).ComplexityLE p := R.complexity + +theorem coordinateTest_evalCyclic (i : σ) (x : σ → ZMod N) : + (R.coordinateTest i).evalCyclic N x = (f (x i) : ℂ) := by + change (R.coordinateTest i).eval (fun j => ((x j).val : ℤ)) = _ + rw [R.coordinateTest_eval] + apply Complex.ext + · exact (R.eval (x i)).symm + · simpa only [Complex.ofReal_im] using + (R.test.unit_interval_eval R.positive (fun _ => ((x i).val : ℤ))).1 + +end Erdos3.PositiveCyclicModel + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] PositiveCyclicModel.lie PositiveCyclicModel.algebra + PositiveCyclicModel.topology PositiveCyclicModel.topologicalAdd + PositiveCyclicModel.continuousSMul PositiveCyclicModel.hausdorff + +theorem exists_positive_coordinate_product {σ : Type} [Fintype σ] + {s N : ℕ} [NeZero N] {p : ℝ} {f : σ → ZMod N → ℝ} + (hp : 0 ≤ p) (hσ : (Fintype.card σ : ℝ) ≤ p) + (hf : ∀ i, PositiveCyclicNiltest.{0} s N p (f i)) : + ∃ g : (σ → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : σ => 1) s + (productNiltestBudget (raisedNiltestBudget p)) g) ∧ + ∀ x : σ → ZMod N, g (fun i => ((x i).val : ℤ)) = ∏ i, (f i (x i) : ℂ) := by + classical + let R := fun i => Classical.choice ((hf i).model_nonempty hp) + let D := fun i => (R i).model + let T := fun i => (R i).coordinateTest i + let : FiniteDimensional ℚ (∀ i, (R i).L) := (productFinBasis D).finiteDimensional_of_finite + let := moduleTopology ℝ (ℝ ⊗[ℚ] (∀ i, (R i).L)) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (∀ i, (R i).L)) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] (∀ i, (R i).L)) := realification_moduleTopology_t2 (productFinBasis D) + have hp' : 0 ≤ raisedNiltestBudget p := hp.trans (le_raisedNiltestBudget p) + have hσ' : (Fintype.card σ : ℝ) ≤ raisedNiltestBudget p := hσ.trans (le_raisedNiltestBudget p) + have hT : ∀ i, (T i).ComplexityLE (raisedNiltestBudget p) := + fun i => (R i).coordinateTest_complexity i + let S := piNiltest D T hp' hσ' hT + refine ⟨S.eval, ⟨NativeIntegerExpansion.ofTest S + (piNiltest_complexity D T hp' hσ' hT) (fun _ => rfl)⟩, ?_⟩ + intro x + change (piNiltest D T hp' hσ' hT).eval _ = _ + rw [piNiltest_eval] + apply Finset.prod_congr rfl + intro i _ + exact (R i).coordinateTest_evalCyclic i x + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedBadProductSpatialBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedBadProductSpatialBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..53a7b041e534694c05a5dac4242bb24f802f22ad --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedBadProductSpatialBudget.lean @@ -0,0 +1,37 @@ +import OAI.Combinatorics.Progressions.Fourier.AllocatedMaskedCoefficientFourier + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +theorem exists_preparedBadProductSpatialBudget (m A : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ B : ℝ, 0 ≤ B → + let P := (B + A) ^ A + let Ps := (B + C) ^ C + let Q := allocatedFourierLogBudget m P + P ≤ Ps ∧ 2 * P + 7 * B + 24 ≤ Ps ∧ + allocatedMaskedFourierBudget m P ≤ Ps ∧ + (4 * Q + 2) ^ 4 ≤ Ps ∧ 4 * Q * (4 * Q + 2) ^ 4 + Q ≤ Ps := by + obtain ⟨a, _, ha⟩ := exists_allocatedMaskedFourierBudget_bound m 2 + let p : Polynomial ℕ := (Polynomial.X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget + (2 * p + 7 * Polynomial.X + 24 + (p + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro B hB P Ps Q + have hP : 0 ≤ P := by dsimp only [P]; positivity + have hF : 0 ≤ (P + a) ^ a := by positivity + have htotal : 2 * P + 7 * B + 24 + (P + a) ^ a ≤ Ps := by + simpa [p, P, Ps, Polynomial.eval₂_pow] using hbound B hB + have hmask : allocatedMaskedFourierBudget m P ≤ Ps := + (ha P hP).1.trans (by linarith) + have hcomponents := allocatedMaskedFourierBudget_bounds m hP + exact ⟨by linarith, by linarith, hmask, + hcomponents.2.2.1.trans hmask, hcomponents.2.2.2.trans hmask⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedDeterminingCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedDeterminingCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..c41f7366cf4eae980b644f200359423f034ec0b2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedDeterminingCoordinates.lean @@ -0,0 +1,97 @@ +import OAI.Combinatorics.Progressions.Linear.RankPreparationProjectedAxisBudget + +namespace OAI + +section + +namespace Erdos3.RankPreparationFamily + +open Module Submodule VectorPolynomial +open scoped BigOperators + +variable {X J : Type} {m : ℕ} + +abbrev DeterminingIndex (_L : RankPreparationFamily X J m) (E : Fin m → Type) := + Sigma E + +abbrev PreparedCoordinate (L : RankPreparationFamily X J m) := + (u : Fin m) × (L u).Coord + +variable (L : RankPreparationFamily X J m) (E : Fin m → Type) + +def determiningWeight (a : L.DeterminingIndex E) : ℕ := a.1.val + 1 + +theorem determiningWeight_pos (a : L.DeterminingIndex E) : + 1 ≤ L.determiningWeight E a := Nat.le_add_left 1 _ + +theorem determiningWeight_le (a : L.DeterminingIndex E) : + L.determiningWeight E a ≤ m := Nat.succ_le_of_lt a.1.isLt + +variable {E} [∀ u, Fintype (E u)] +variable [∀ u, IsZLattice ℝ + (latticeSection (standardEuclideanLattice (L u).Coord) (euclideanSubspace (L u).space))] +variable (bW : ∀ u, Basis (E u) ℤ + (latticeSection (standardEuclideanLattice (L u).Coord) (euclideanSubspace (L u).space))) +variable (hmem : ∀ u α, coefficients (L u).poly α ∈ (L u).space) + +noncomputable def determiningPolynomial (a : L.DeterminingIndex E) : MvPolynomial X ℝ := + integralBasisPolynomialCoordinates (L a.1).space + ((L a.1).integralCoordinateBasis (bW a.1)) (L a.1).poly (hmem a.1) a.2 + +noncomputable def determiningMatrix + (r : L.PreparedCoordinate) (a : L.DeterminingIndex E) : ℤ := + if h : a.1 = r.1 then (L r.1).integralCoordinateMatrix (bW r.1) r.2 (h ▸ a.2) + else 0 + +omit [∀ u, Fintype (E u)] in +theorem determiningMatrix_same (u : Fin m) (i : (L u).Coord) (e : E u) : + L.determiningMatrix bW ⟨u, i⟩ ⟨u, e⟩ = + (L u).integralCoordinateMatrix (bW u) i e := by + simp [determiningMatrix] + +omit [∀ u, Fintype (E u)] in +theorem determiningMatrix_weight (r : L.PreparedCoordinate) (a : L.DeterminingIndex E) + (hne : L.determiningMatrix bW r a ≠ 0) : + L.determiningWeight E a = r.1.val + 1 := by + classical + by_cases h : a.1 = r.1 + · simp only [determiningWeight, h] + · simp [determiningMatrix, h] at hne + +omit [∀ u, Fintype (E u)] in +theorem determiningPolynomial_degree + (hdegree : ∀ u, DegreeLE (fun _ => 1) (u.val + 1) (L u).poly) + (a : L.DeterminingIndex E) : + (L.determiningPolynomial bW hmem a).totalDegree ≤ L.determiningWeight E a := + integralBasisPolynomialCoordinates_totalDegree _ _ _ _ (hdegree a.1) a.2 + +theorem determiningPolynomial_reconstruction (x : X → ℝ) (r : L.PreparedCoordinate) : + eval x (L r.1).poly r.2 = ∑ a : L.DeterminingIndex E, + (L.determiningMatrix bW r a : ℝ) * + MvPolynomial.eval x (L.determiningPolynomial bW hmem a) := by + classical + rw [Fintype.sum_sigma] + have heq (u : Fin m) : + (∑ e : E u, (L.determiningMatrix bW r ⟨u, e⟩ : ℝ) * + MvPolynomial.eval x (L.determiningPolynomial bW hmem ⟨u, e⟩)) = + if h : u = r.1 then + ∑ e : E r.1, ((L r.1).integralCoordinateMatrix (bW r.1) r.2 e : ℝ) * + MvPolynomial.eval x (L.determiningPolynomial bW hmem ⟨r.1, e⟩) + else 0 := by + by_cases h : u = r.1 + · subst u + simp [determiningMatrix] + · simp [determiningMatrix, h] + simp_rw [heq] + rw [Fintype.sum_dite_eq'] + exact eval_integralBasisPolynomialCoordinates (L r.1).space + ((L r.1).integralCoordinateBasis (bW r.1)) + ((L r.1).integralCoordinateMatrix (bW r.1)) + ((L r.1).integralCoordinateMatrix_cast (bW r.1)) + (L r.1).poly (hmem r.1) x r.2 + +end Erdos3.RankPreparationFamily + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedEarlySpatialWidth.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedEarlySpatialWidth.lean new file mode 100644 index 0000000000000000000000000000000000000000..e90fed6836dad281eace1e92121c6c357a4d8535 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedEarlySpatialWidth.lean @@ -0,0 +1,47 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedModularProductivityPrecision + +namespace OAI + +section + +namespace Erdos3 + +theorem preparedEarlySpatialWidth (d : ℕ) {gainLog : ℝ} (hg : 0 ≤ gainLog) : + let Pτ := gainLog + (d : ℝ) + 8 + let τ := Real.exp (-Pτ) + 0 ≤ Pτ ∧ 0 < τ ∧ τ ≤ 1 / 2 ∧ (d : ℝ) * τ ≤ 1 / 2 ∧ + τ⁻¹ = Real.exp Pτ ∧ + (∀ Pmaster : ℝ, Pτ ≤ Pmaster → τ⁻¹ ≤ Real.exp Pmaster) ∧ + (∀ Pprod gain : ℝ, gainLog + 8 ≤ Pprod → Real.exp (-gainLog) ≤ gain → + Real.exp (-Pprod) ≤ gain / 16 ∧ + 12 * positiveProjectionAccuracy Pprod + 2 * (d : ℝ) * τ ≤ gain / 8) := by + dsimp only + have hnonneg : 0 ≤ gainLog + (d : ℝ) + 8 := by positivity + have hexp : Real.exp (-gainLog) ≤ 1 := Real.exp_le_one_iff.mpr (neg_nonpos.mpr hg) + have hprecision := preparedModularProductivity_precision d hg + (Pprod := gainLog + 8) (Pphysical := gainLog + (d : ℝ) + 8) + (gain := Real.exp (-gainLog)) le_rfl le_rfl le_rfl + have hτhalf : Real.exp (-(gainLog + (d : ℝ) + 8)) ≤ 1 / 2 := by + calc + _ ≤ Real.exp (-1 : ℝ) := Real.exp_le_exp.mpr (by have := Nat.cast_nonneg (α := ℝ) d; linarith) + _ ≤ 1 / 2 := by + rw [Real.exp_neg, ← one_div] + exact div_le_div_of_nonneg_left (by norm_num) (by norm_num) + (by linarith [Real.add_one_le_exp (1 : ℝ)]) + have hτdim : (d : ℝ) * Real.exp (-(gainLog + (d : ℝ) + 8)) ≤ 1 / 2 := by + have ha : 0 ≤ positiveProjectionAccuracy (gainLog + 8) := Real.exp_nonneg _ + linarith only [hprecision.2, hexp, ha] + have hinv : (Real.exp (-(gainLog + (d : ℝ) + 8)))⁻¹ = + Real.exp (gainLog + (d : ℝ) + 8) := by rw [Real.exp_neg, inv_inv] + refine ⟨hnonneg, Real.exp_pos _, hτhalf, hτdim, hinv, ?_, ?_⟩ + · intro Pmaster hmaster + rw [hinv] + exact Real.exp_le_exp.mpr hmaster + · intro Pprod gain hprod hgain + exact preparedModularProductivity_precision d hg hprod le_rfl hgain + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedFullChartNativeDetection.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedFullChartNativeDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..0652255a906598274b89b5307f157e8595be16f2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedFullChartNativeDetection.lean @@ -0,0 +1,624 @@ +import OAI.Combinatorics.Progressions.Estimates.NativeMajorCorrelationFamily +import OAI.Combinatorics.Progressions.Estimates.PreparedCenteredModelMarginalData +import OAI.Combinatorics.Progressions.Estimates.ProductiveFrozenLocalMajorFamily + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct NNReal BigOperators + +attribute [local instance] NativeSampleModelFamily.lie NativeSampleModelFamily.algebra + NativeSampleModelFamily.topology NativeSampleModelFamily.topologicalAdd + NativeSampleModelFamily.continuousSMul NativeSampleModelFamily.hausdorff + +theorem exists_full_chart_major_correlation_witness_of_native_detections + {m k t : ℕ} {X L ι η : Type} [Fintype X] [DecidableEq X] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (htk : t < k) + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (Ψ : PatchKernel (Fintype.card (LowTaggedIndex J k))) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (β : (X → ℤ) → Fin (Fintype.card (LowTaggedIndex J k)) → ℤ) + (hβ : ∀ u ∈ integerBox N, ∀ i, + |MvPolynomial.eval (fun x => (u x : ℝ)) (lowTaggedPolynomial J k poly i) - + c i - (β u i : ℝ)| ≤ 1 / 2) + {periodCap coverCap : ℝ} {Lip : ℝ≥0} + (pNative pMajor Rrank : ℝ) (C : ℕ) + (hpNative : 2 ≤ pNative) (hη : (Fintype.card η : ℝ) ≤ pNative) + (hNativeMajor : pNative ≤ pMajor) (hproduct : productNiltestBudget pNative ≤ pMajor) + (hdim : ((Fintype.card X + Fintype.card (Σ j, J j) : ℕ) : ℝ) ≤ pMajor) + (hperiod : periodCap ≤ Real.exp pMajor) (hcover : coverCap ≤ Real.exp pMajor) + (hLip : (Lip : ℝ) ≤ Real.exp pMajor) (hΨ : (Ψ.lip : ℝ) ≤ Real.exp pMajor) + (hN : ∀ i, Real.exp ((pMajor + C) ^ C) ≤ (N i : ℝ)) + (hRrank : Real.exp ((pMajor + C) ^ C) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) + (hdetected : ∀ j, + ∃ (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap Lip) + (g : integerBox N → ℂ), + Nonempty (NativeSampleModel (fun _ : X => 1) t pNative + (fun u : integerBox N => u.val) g) ∧ + Real.exp (-pNative) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation + (fun u => majorPhaseSample J k poly Ψ c + (coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k + (left⁻¹ * Z * right⁻¹).coord))) β (fun _ => 1) u.val) + (fun u => star (W.eval N poly u.val) * g u)‖) : + Nonempty (FullChartMajorCorrelationWitness F b ω hF J k fast basis + Z left right N poly U pMajor Rrank C) := by + obtain ⟨W, g, common, hcorr⟩ := exists_native_major_correlation_family_of_detections + J N hbox poly Ψ c + (fun j => coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k (left⁻¹ * Z * right⁻¹).coord))) + β pNative hpNative hη hdetected + refine ⟨{ + L := common.L + step := t + dim := common.dim + model := common.model + lower := htk + correlation := ?_ }⟩ + unfold FullChartMajorCorrelation + refine ⟨periodCap, coverCap, Lip, W, (fun j => (common.test j).conjugate), + Ψ, c, β, hpoly, hcoeff, hβ, ?_, ?_, ?_, hdim, ?_, ?_, hLip, hΨ, + hN, hRrank, hrank, ?_⟩ + · linarith + · intro j + exact ((common.test j).conjugate_complexityLE pMajor).mpr + ((common.complexity j).mono hproduct) + · intro j + exact_mod_cast common.norm j + · exact fun j => (W j).modulus_bound.trans hperiod + · exact fun j => (W j).cover_bound.trans hcover + · intro j + exact (Real.exp_le_exp.mpr (neg_le_neg hNativeMajor)).trans (hcorr j) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped TensorProduct NNReal + +def SampledSliceNativeDetection + {m : ℕ} {X Ω T : Type} [Fintype X] [DecidableEq X] [Fintype Ω] [Fintype T] + {Tests : Ω → Type} (J : Fin m → Type) [∀ j, Fintype (J j)] + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (pathLaw : FiniteProbabilityWeights Ω) (physical : Ω → T → X → ℤ) + (slices : ∀ z, Tests z → Finset T) (weight : ∀ z, Tests z → T → ℂ) + (degree : ℕ) (pNative α : ℝ) : Prop := + ∀ signal : (X → ℤ) → ℂ, + (∀ u, ‖signal u‖ ≤ 1) → + (∀ u, u ∉ integerBox N → signal u = 0) → + α ≤ sampledSliceSeminorm pathLaw physical slices weight signal → + ∃ (W : NormalizedPolynomialTwist X (Σ j, J j) + (Real.exp pNative) (Real.exp pNative) ⟨Real.exp pNative, Real.exp_nonneg _⟩) + (g : integerBox N → ℂ), + Nonempty (NativeSampleModel (fun _ : X => 1) degree pNative + (fun u : integerBox N => u.val) g) ∧ + Real.exp (-pNative) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation + (fun u => signal u.val) (fun u => star (W.eval N poly u.val) * g u)‖ + +noncomputable def majorPhasePlateauBoxSignal + {m : ℕ} {X : Type} [Fintype X] [DecidableEq X] (J : Fin m → Type) [∀ j, Fintype (J j)] + (k : ℕ) (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (P : MvPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℝ) : + (X → ℤ) → ℂ := + (integerBox N : Set (X → ℤ)).indicator (majorPhasePlateauSignal J k poly c P) + +theorem majorPhasePlateauBoxSignal_inside + {m : ℕ} {X : Type} [Fintype X] [DecidableEq X] (J : Fin m → Type) [∀ j, Fintype (J j)] + (k : ℕ) (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (P : MvPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℝ) + (u : X → ℤ) (hu : u ∈ integerBox N) : + majorPhasePlateauBoxSignal J k N poly c P u = majorPhasePlateauSignal J k poly c P u := + Set.indicator_of_mem hu _ + +theorem majorPhasePlateauBoxSignal_outside + {m : ℕ} {X : Type} [Fintype X] [DecidableEq X] (J : Fin m → Type) [∀ j, Fintype (J j)] + (k : ℕ) (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (P : MvPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℝ) + (u : X → ℤ) (hu : u ∉ integerBox N) : + majorPhasePlateauBoxSignal J k N poly c P u = 0 := + Set.indicator_of_notMem hu _ + +theorem majorPhasePlateauBoxSignal_norm_le_one + {m : ℕ} {X : Type} [Fintype X] [DecidableEq X] (J : Fin m → Type) [∀ j, Fintype (J j)] + (k : ℕ) (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (P : MvPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℝ) + (u : X → ℤ) : ‖majorPhasePlateauBoxSignal J k N poly c P u‖ ≤ 1 := by + classical + by_cases hu : u ∈ integerBox N + · rw [majorPhasePlateauBoxSignal_inside J k N poly c P u hu] + exact majorPhasePlateauSignal_norm_le_one J k poly c P u + · rw [majorPhasePlateauBoxSignal_outside J k N poly c P u hu, norm_zero] + exact zero_le_one + +end Erdos3.VectorPolynomial + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct NNReal + +theorem exists_full_chart_major_correlation_witness_of_prepared_detection + {m k t : ℕ} {X L ι η Ω T : Type} + [Fintype X] [DecidableEq X] [Fintype η] [Fintype Ω] [Fintype T] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (htk : t < k) + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (pNative pMajor Rrank : ℝ) (C : ℕ) + (hpNative : 2 ≤ pNative) (hη : (Fintype.card η : ℝ) ≤ pNative) + (hNativeMajor : pNative ≤ pMajor) (hproduct : productNiltestBudget pNative ≤ pMajor) + (hdim : ((Fintype.card X + Fintype.card (Σ j, J j) : ℕ) : ℝ) ≤ pMajor) + (hN : ∀ i, Real.exp ((pMajor + C) ^ C) ≤ (N i : ℝ)) + (hRrank : Real.exp ((pMajor + C) ^ C) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) + {Tests : Ω → Type} (pathLaw : FiniteProbabilityWeights Ω) + (physical : Ω → T → X → ℤ) (slices : ∀ z, Tests z → Finset T) + (weight : ∀ z, Tests z → T → ℂ) (α : ℝ) + (hdirect : SampledSliceNativeDetection J N hbox poly pathLaw physical slices weight t pNative α) + (hlarge : ∀ j, α ≤ sampledSliceSeminorm pathLaw physical slices weight + (majorPhasePlateauBoxSignal J k N poly c + (coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k (left⁻¹ * Z * right⁻¹).coord))))) : + Nonempty (FullChartMajorCorrelationWitness F b ω hF J k fast basis + Z left right N poly U pMajor Rrank C) := by + have hNative0 : 0 ≤ pNative := by linarith + have hseven : 7 ≤ pMajor := by + have h := (productNiltestBudget_geometry hNative0).trans hproduct + nlinarith + have hkernel : ((majorPhasePlateauKernel (Fintype.card (LowTaggedIndex J k))).lip : ℝ) ≤ + Real.exp pMajor := by + change (8 : ℝ) ≤ Real.exp pMajor + linarith [Real.add_one_le_exp pMajor] + have hexp := Real.exp_le_exp.mpr hNativeMajor + apply exists_full_chart_major_correlation_witness_of_native_detections + (Lip := ⟨Real.exp pNative, Real.exp_nonneg _⟩) + F b ω hF J fast basis Z left right htk N hbox poly hpoly U hcoeff + (majorPhasePlateauKernel _) c (majorPhaseNearestLift J k poly c) + (fun u _ i => majorPhaseNearestLift_close J k poly c u i) + pNative pMajor Rrank C hpNative hη hNativeMajor hproduct hdim + hexp hexp hexp hkernel hN hRrank hrank + intro j + let P := coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k (left⁻¹ * Z * right⁻¹).coord)) + obtain ⟨W, g, hmodel, hcorr⟩ := hdirect (majorPhasePlateauBoxSignal J k N poly c P) + (majorPhasePlateauBoxSignal_norm_le_one J k N poly c P) + (majorPhasePlateauBoxSignal_outside J k N poly c P) (hlarge j) + refine ⟨W, g, hmodel, ?_⟩ + have heq : (fun u : integerBox N => majorPhasePlateauBoxSignal J k N poly c P u.val) = + fun u : integerBox N => majorPhasePlateauSignal J k poly c P u.val := by + funext u + exact majorPhasePlateauBoxSignal_inside J k N poly c P u.val u.property + rw [heq] at hcorr + exact hcorr + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct NNReal BigOperators + +theorem exists_full_chart_major_correlation_witness_of_productive_local_tests + {m k t : ℕ} {X L ι η Ω I : Type} + [Fintype X] [DecidableEq X] [Fintype η] [Fintype Ω] [Fintype I] [DecidableEq I] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight t)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight t)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight t)] + [T2Space (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight t)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (htk : t < k) + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (pNative pMajor Rrank : ℝ) (C : ℕ) + (hpNative : 2 ≤ pNative) (hη : (Fintype.card η : ℝ) ≤ pNative) + (hNativeMajor : pNative ≤ pMajor) (hproduct : productNiltestBudget pNative ≤ pMajor) + (hdim : ((Fintype.card X + Fintype.card (Σ j, J j) : ℕ) : ℝ) ≤ pMajor) + (hN : ∀ i, Real.exp ((pMajor + C) ^ C) ≤ (N i : ℝ)) + (hRrank : Real.exp ((pMajor + C) ^ C) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) + (pathLaw : FiniteProbabilityWeights Ω) (good : η → Finset Ω) + (localN : I → ℕ) (hlocalN : ∀ i, 0 < localN i) + (cost : ℝ) (hcost : 0 ≤ cost) + (physical : Ω → (I → ℤ) → X → ℤ) + (hphysical : ∀ j z, z ∈ good j → ∀ x, + x ∈ integerBox localN → physical z x ∈ integerBox N) + (α : ℝ) (hmass : ∀ j, α ≤ (9 / 10 : ℝ) * pathLaw.mass (good j)) + (hdirect : ∀ chosen : Ω → Option η → + LocalMajorSliceTest (OrdinaryPolynomialPhase.nilmanifold t) localN cost + (OrdinaryPolynomialPhase.budget t), + SampledSliceNativeDetection J N hbox poly pathLaw + (fun z (x : integerBox localN) => physical z x.val) + (fun z a => (chosen z a).slice.subtypeSites) + (fun z a (x : integerBox localN) => (chosen z a).weight x.val) t pNative α) + (hlocal : ∀ j z, z ∈ good j → + ∃ A : LocalMajorSliceTest (OrdinaryPolynomialPhase.nilmanifold t) localN cost + (OrdinaryPolynomialPhase.budget t), + (9 / 10 : ℝ) ≤ ‖𝔼 x ∈ A.slice.integerPoints, + majorPhasePlateauSignal J k poly c + (coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k (left⁻¹ * Z * right⁻¹).coord))) + (physical z x) * A.weight x‖) : + Nonempty (FullChartMajorCorrelationWitness F b ω hF J k fast basis + Z left right N poly U pMajor Rrank C) := by + let phase := fun j => coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k (left⁻¹ * Z * right⁻¹).coord)) + let signal := fun j => majorPhasePlateauBoxSignal J k N poly c (phase j) + have hlocalBox : ∀ j z, z ∈ good j → + ∃ A : LocalMajorSliceTest (OrdinaryPolynomialPhase.nilmanifold t) localN cost + (OrdinaryPolynomialPhase.budget t), + (9 / 10 : ℝ) ≤ ‖𝔼 x ∈ A.slice.integerPoints, + signal j (physical z x) * A.weight x‖ := by + intro j z hz + obtain ⟨A, hA⟩ := hlocal j z hz + refine ⟨A, ?_⟩ + have heq : (𝔼 x ∈ A.slice.integerPoints, signal j (physical z x) * A.weight x) = + 𝔼 x ∈ A.slice.integerPoints, + majorPhasePlateauSignal J k poly c (phase j) (physical z x) * A.weight x := by + apply Finset.expect_congr rfl + intro x hx + rw [show signal j (physical z x) = + majorPhasePlateauSignal J k poly c (phase j) (physical z x) from + majorPhasePlateauBoxSignal_inside J k N poly c (phase j) (physical z x) + (hphysical j z hz x (A.slice.integerPoints_subset_integerBox hx))] + rw [heq] + exact hA + obtain ⟨chosen, _, hlarge⟩ := exists_productive_localMajorSlice_coordinate_family + (OrdinaryPolynomialPhase.nilmanifold t) pathLaw good localN hlocalN cost + (OrdinaryPolynomialPhase.budget t) (9 / 10) + (OrdinaryPolynomialPhase.zeroLocalMajorSlice localN hlocalN cost hcost) + physical signal hlocalBox + apply exists_full_chart_major_correlation_witness_of_prepared_detection + F b ω hF J fast basis Z left right htk N hbox poly hpoly U hcoeff c + pNative pMajor Rrank C hpNative hη hNativeMajor hproduct hdim hN hRrank hrank + pathLaw (fun z (x : integerBox localN) => physical z x.val) + (fun z a => (chosen z a).slice.subtypeSites) + (fun z a (x : integerBox localN) => (chosen z a).weight x.val) + α (hdirect chosen) + intro j + exact (hmass j).trans (hlarge j) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial RationalFilteredNilmanifold +open scoped TensorProduct NNReal BigOperators Classical + +theorem exists_full_chart_major_correlation_witness_of_frozen_productive_local_tests + {m k t : ℕ} {X L ι η Ω I : Type} + [Fintype X] [DecidableEq X] [Fintype η] [Fintype Ω] [Fintype I] [DecidableEq I] + [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight t)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight t)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight t)] + [T2Space (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight t)] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (htk : t < k) + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (hpoly : ∀ j, DegreeLE (fun _ => 1) (j.val + 1) (poly j)) + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (hcoeff : ∀ j α, α ≠ 0 → coefficients (poly j) α ∈ U j) + (c : Fin (Fintype.card (LowTaggedIndex J k)) → ℝ) + (pNative pMajor Rrank : ℝ) (C : ℕ) + (hpNative : 2 ≤ pNative) (hη : (Fintype.card η : ℝ) ≤ pNative) + (hNativeMajor : pNative ≤ pMajor) (hproduct : productNiltestBudget pNative ≤ pMajor) + (hdim : ((Fintype.card X + Fintype.card (Σ j, J j) : ℕ) : ℝ) ≤ pMajor) + (hN : ∀ i, Real.exp ((pMajor + C) ^ C) ≤ (N i : ℝ)) + (hRrank : Real.exp ((pMajor + C) ^ C) ≤ Rrank) + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) + (fun i => (N i : ℝ)) Rrank (U j) (poly j)) + (pathLaw : FiniteProbabilityWeights Ω) (good : η → Finset Ω) + (localN : I → ℕ) (hlocalN : ∀ i, 0 < localN i) + (keep : I → Prop) (cost Bshort : ℝ) (hcost : 0 ≤ cost) + (hBshort : 1 ≤ Bshort) (hshort : ∀ i, ¬keep i → (localN i : ℝ) ≤ Bshort) + (physical : Ω → (I → ℤ) → X → ℤ) + (hphysical : ∀ j z, z ∈ good j → ∀ x, + x ∈ integerBox localN → physical z x ∈ integerBox N) + (α : ℝ) (hmass : ∀ j, α ≤ (9 / 10 : ℝ) * pathLaw.mass (good j)) + (hdirect : ∀ chosen : Ω → Option η → + LocalMajorSliceTest (OrdinaryPolynomialPhase.nilmanifold t) localN (max cost (Real.log Bshort)) + (OrdinaryPolynomialPhase.budget t), + SampledSliceNativeDetection J N hbox poly pathLaw + (fun z (x : integerBox localN) => physical z x.val) + (fun z a => (chosen z a).slice.subtypeSites) + (fun z a (x : integerBox localN) => (chosen z a).weight x.val) t pNative α) + (hlocal : ∀ j z, z ∈ good j → + ∃ fixed : {i // ¬keep i} → ℤ, + (∀ i, 0 ≤ fixed i ∧ fixed i < localN i.val) ∧ + ∃ A : LocalMajorSliceTest (OrdinaryPolynomialPhase.nilmanifold t) + (fun i : {i // keep i} => localN i.val) cost (OrdinaryPolynomialPhase.budget t), + (9 / 10 : ℝ) ≤ ‖𝔼 x ∈ A.slice.integerPoints, + majorPhasePlateauSignal J k poly c + (coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k (left⁻¹ * Z * right⁻¹).coord))) + (physical z (finiteSplitPoint keep x fixed)) * A.weight x‖) : + Nonempty (FullChartMajorCorrelationWitness F b ω hF J k fast basis + Z left right N poly U pMajor Rrank C) := by + apply exists_full_chart_major_correlation_witness_of_productive_local_tests + F b ω hF J fast basis Z left right htk N hbox poly hpoly U hcoeff c + pNative pMajor Rrank C hpNative hη hNativeMajor hproduct hdim hN hRrank hrank + pathLaw good localN hlocalN (max cost (Real.log Bshort)) + (hcost.trans (le_max_left _ _)) physical hphysical α hmass hdirect + intro j z hz + obtain ⟨fixed, hfixed, A, hA⟩ := hlocal j z hz + let starts := frozenShortStarts keep fixed + have hstarts := frozenShortStarts_inside keep fixed hfixed + refine ⟨A.freezeShort keep starts hstarts hBshort hshort, ?_⟩ + rw [A.expect_freezeShort keep starts hstarts hBshort hshort + (fun x => majorPhasePlateauSignal J k poly c + (coordinate (basis.coord j).toAddMonoidHom + (lowTaggedVectorRestrict J k (F.realSymbolGradeQuotientPolynomial b ω hF + (fullTaggedVariableWeight (X := X) J) fast k (left⁻¹ * Z * right⁻¹).coord))) + (physical z x))] + simpa only [starts, frozenLongExtension_shortStarts keep fixed (fun i => (hfixed i).1)] using hA + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +section Consumer + +variable {m s : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +variable (α τ : ℝ) +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [TopologicalSpace (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight s)] +variable [IsTopologicalAddGroup (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight s)] +variable [ContinuousSMul ℝ (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight s)] +variable [T2Space (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight s)] + +include μ hR hσ hb o in + +theorem preparedFullChartNativeDetection + (Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ) + (hDirect : PreparedModularGeneralDirectDetectionFreeTrimPreparedInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α / 2) (τ := τ) (hb := hb) (o := o) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget) + (hα : 0 < α) + (hcount : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ + Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect) + (hbudget : OrdinaryPolynomialPhase.budget s ≤ + Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect) : + ∀ (_hstride : ∀ i, 0 < stride i) (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (_hC : ∀ j, 0 ≤ C j) (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (_hForward : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pchart) + (_hVtail : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pchart) + (_hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (_hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pchart) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pchart), + ∀ (hτSpatial : 0 < τ), τ⁻¹ ≤ Real.exp Pphysical → + τ ≤ 1 / 2 → (nX : ℝ) * τ ≤ 1 / 2 → + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + let ξn := normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2)) + Pphysical coarseTarget + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + {Rrank : ℝ}, + (∀ i, Real.exp r.required ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp r.required ≤ Rrank → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let hξn := normalizedTupleNarrowWidth_pos (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2)) Pphysical coarseTarget + let Z := selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem) + ∃ (hN : ∀ i, 0 < N i) (hbases : bases.Nonempty) (hbox : (integerBox N).Nonempty) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z) + (_hnormalizer : |Z - 1| ≤ Real.exp (-r.E) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) + (_hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i), + let Path := bases × rectangularWeightIndices 0 V 1 + ∃ hcenter : ∀ center : CoefficientTorus (K := LayerSamplerVariables G I n B) U, + 0 < selectedJointDensityMass bases stride cells V + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center), + let centeredLaw := fun center => selectedJointFiniteLaw bases hbases stride cells V + (narrowTrimmedSpatialWidths_pos hW hτSpatial hξn N hN) hmass + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S poly hmem center) (hcenter center) + ∃ hweight : ∀ z, Measurable (fun center => (centeredLaw center).weight z), + let pathLaw := centeredFiniteMarginal μ centeredLaw hweight + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + ∀ {η : Type}, + ∀ chosen : Path → Option η → LocalMajorSliceTest + (OrdinaryPolynomialPhase.nilmanifold s) sides pSlice + (OrdinaryPolynomialPhase.budget s), + SampledSliceNativeDetection J N hbox poly pathLaw + (fun z (x : Sites) => jointIntegerPhysicalSite x.val (z.1.val, z.2.val)) + (fun z a => (chosen z a).slice.subtypeSites) + (fun z a (x : Sites) => (chosen z a).weight x.val) s r.nativeBudget α := by + intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff hτSpatial hτInv hτHalf hτDim + r W ξn hW cells poly hp hmem Rrank hsize hrank hRank V hCells bases hξn Z + have hcentered := preparedModularGeneralCenteredDetectionFreeTrim_of_direct + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α) (τ := τ) (hb := hb) (o := o) (μ := μ) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget hDirect + obtain ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, htail⟩ := + hcentered hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff hτSpatial hτInv hτHalf hτDim + cells poly hp hmem hsize hrank hRank hCells + refine ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩ + intro Path + obtain ⟨hcenter, hweight, hdetect⟩ := htail + refine ⟨hcenter, hweight, ?_⟩ + intro pathLaw sides Sites η chosen + have hfamily := hdetect (fun _ _ => OrdinaryPolynomialPhase.nilmanifold s) + (fun z a => (chosen z a).test) + (fun z a => (chosen z a).slice.subtypeSites) + (fun z a i => ((chosen z a).slice.start i : ℤ)) + (fun z a => (chosen z a).stride) + (fun z a => (chosen z a).slice.length) + (fun z a => (chosen z a).stride_pos) + (fun z a => ((chosen z a).slice.subtypeSites_image_val).trans + (chosen z a).slice.integerPoints_eq_commonStrideBox) + (fun z a => (chosen z a).slice.subtypeSites_dense (chosen z a).dense) + hcount + (fun z a => (chosen z a).complexity.mono hbudget) + (fun z a => (chosen z a).norm) + intro signal hsignal hsupp hlarge + exact hfamily signal hα hsignal hsupp hlarge + +end Consumer +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedGeometryDecidableTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedGeometryDecidableTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a4aea69d38d344ec456628ece9e868cf6d1e447 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedGeometryDecidableTransport.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedFiniteScheduleCandidateDetection + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule +open scoped Classical NNReal + +theorem preparedUniformDegreeGeometryAt_decidableTransport + {m : ℕ} {G : Type} [fG : Fintype G] + {I : Fin m → Type} [fI : ∀ j, Fintype (I j)] {n : Fin m → ℕ} + {B : LayerSamplerAxis I n → Type} [fB : ∀ a, Fintype (B a)] + {J : Fin m → Type} [fJ : ∀ j, Fintype (J j)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U basis R σ} + {s Cdetect nX : ℕ} + {Bstruct Pscale D target Pk Prho Qstride pDetect pRadius aDetect gainLog : ℝ} + {dG dG' : DecidableEq G} + {dB dB' : ∀ a, DecidableEq (B a)} + (h : @PreparedUniformDegreeGeometryAt m G fG dG I fI n B fB dB J fJ + U basis R σ S s Cdetect nX Bstruct Pscale D target Pk Prho Qstride + pDetect pRadius aDetect gainLog) : + @PreparedUniformDegreeGeometryAt m G fG dG' I fI n B fB dB' J fJ + U basis R σ S s Cdetect nX Bstruct Pscale D target Pk Prho Qstride + pDetect pRadius aDetect gainLog := by + cases Subsingleton.elim dG dG' + cases Subsingleton.elim dB dB' + exact h + +theorem preparedScheduledDirectSourceAvailability_decidableTransport + {m s : ℕ} {G : Type} [Fintype G] + {I : Fin m → Type} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + {B : LayerSamplerAxis I n → Type} [∀ a, Fintype (B a)] + {J : Fin m → Type} [∀ j, Fintype (J j)] + {U : ∀ j, Submodule ℝ (J j → ℝ)} + {basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} + {R σ : Fin m → ℝ} {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} + {S : LayerSamplerScale (G := G) B U basis R σ} {nX : ℕ} + {selection : Fin (s + 1) ↪ G} {stride N : Fin nX → ℕ} + {Pdetect : Polynomial ℕ} {sourceU pModel pSlice : ℝ} {Vtail : Fin m → ℝ≥0} + {τ : ℝ} + {hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))} + {o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))} + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + {Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ} + {dG dG' : DecidableEq G} + (h : letI := dG + PreparedScheduledDirectSourceAvailability + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (sourceU := sourceU) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (τ := τ) (hb := hb) (o := o) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget) : + letI := dG' + PreparedScheduledDirectSourceAvailability + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (sourceU := sourceU) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (τ := τ) (hb := hb) (o := o) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget := by + cases Subsingleton.elim dG dG' + exact h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorFullBoxConsumer.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorFullBoxConsumer.lean new file mode 100644 index 0000000000000000000000000000000000000000..385d3552c16016bccf5b049a4986bdf934a92395 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorFullBoxConsumer.lean @@ -0,0 +1,442 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedDetectedCanonicalNativeSource + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +variable {m : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (0 + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (0 + 1)))) +variable (selection : Fin (0 + 1) ↪ G) (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +local notation "α" => allocatedModelUnitThreshold u pModel Kslice Ctail +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (0 + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (0 + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (0 + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (0 + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (0 + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (0 + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + +def PreparedModularCanonicalDetectorFullBoxResult + (Pchart _D target Pk Prho Qstride : ℝ) (K : ℝ≥0) : Prop := + ∀ (_hMkP : ((allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp P) + (_hMkPk : ((allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pk) + (_hQstride : 0 ≤ Qstride) + (_hstride : ∀ i, 0 < stride i) + (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) + (_hC : ∀ j, 0 ≤ C j) + (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + {Pbox Vlog Nlog Mlog baseAmbient : ℝ} + (_hPbox : 0 ≤ Pbox) + (_hVlog : 0 ≤ Vlog) + (_hNlog : 0 ≤ Nlog) + (_hMlog : 0 ≤ Mlog) + (_hbox : 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp Pbox) + (_hvolume : allocatedFullGridNaturalVolume B U basis S rowSets ≤ Real.exp Vlog) + (_hnormalizer : ‖((allocatedProductIdealNormalizer B U basis S rowSets : ℝ) : ℂ)⁻¹‖ ≤ Real.exp Nlog) + (_hmaskLog : (Fintype.card (LayerSamplerAxis I n) : ℝ) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * (((m + 1 : ℕ) : ℝ) * Pk)) ≤ Mlog) + (_hbaseAmbient : 0 ≤ baseAmbient) + (_hvbase : Vlog ≤ baseAmbient) + (_hnbase : Nlog ≤ baseAmbient) + (_hmbase : Mlog ≤ baseAmbient) + (_hsites : (Fintype.card (Finset (Fin (0 + 1))) : ℝ) ≤ baseAmbient) + (_haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ baseAmbient) + (_hlabelLog : (∑ j, (n j : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk)) + + ∑ j, (Fintype.card (Q j) : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk) ≤ baseAmbient) + (_hKbase : (K : ℝ) ≤ Real.exp baseAmbient) + (_hcoords : ((∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp baseAmbient) + (_hperiodLog : ((m + 1 : ℕ) : ℝ) * Pk ≤ baseAmbient) + (_hrowsAmbient : ((∑ j : Fin m, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (_houtputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ baseAmbient) + (_hheight : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ Real.exp baseAmbient) + (Qgrid : ℝ≥0) + (_hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U basis S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U basis S a).1 (allocatedGridIntegerAxis B U basis S a).2) : ℝ) + 1) ≤ Qgrid) + (Ag : ℝ≥0) + (_hAg : LipschitzWith Ag Real.smoothTransition) + (_hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (_hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg : ℝ} + (_hDg : 0 ≤ Dg) + (_hvg : 0 ≤ vg) + (_hwg : 0 ≤ wg) + (_hcube : (Fintype.card (Fin (0 + 1)) : ℝ) ≤ Dg) + (_hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (_hrowsD : ∀ j : Fin m, ((boundedBooleanJetRows (Fin (0 + 1)) (j.val + 1)).card : ℝ) ≤ Dg) + (_htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (_hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (_hRv : ∀ j, R j ≤ Real.exp vg) + (_hRiGrid : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (_hδw : pDetect + 1 ≤ wg) + (_hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (_haxesGrid : (Fintype.card {a // grid a} : ℝ) ≤ Dg) + (_hfullAxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ Dg) + (_hfullOutputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ Dg) + (_hambientCount : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ Dg) + (_hprofileBudget : (probabilityProfileLipschitz : ℝ) ≤ Dg) + {Banalytic : ℝ} + (_hBanalytic : 0 ≤ Banalytic) + (_hDanalytic : Dg ≤ Banalytic) + (_hcutoffAnalytic : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Banalytic) + (_hcoordAnalytic : ((K * ∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp Banalytic) + (_hgridAnalytic : (Qgrid : ℝ) ≤ Real.exp Banalytic) + {Pnum : ℝ} + (_hPnum : 0 ≤ Pnum) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) + (_hn : ∀ j, (n j : ℝ) ≤ Pnum) + (_hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (_hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (_hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Real.exp Pnum) + {Pproj coarseTarget Ecoarse pGain : ℝ}, + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (0 + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + let ξn := normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) +, + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (0 + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,0,0} m (0 + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (0 + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (0 + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (_hPhysicalNonneg : 0 ≤ Pphysical) → (_hMkPhysicalBound : ((allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pphysical) → + (_hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (_hCoarseNonneg : 0 ≤ coarseTarget) → + (_hDimPhysicalBound : (((0 + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (_hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (_hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (0 + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (0 + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (0 + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let Cgrid := Classical.choose (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (0 + 1) Ag) + let Qlog := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let tg := ((0 + 1 : ℕ) : ℝ) + Qlog + (pDetect + 1) + 1 + let pg := (Cgrid : ℝ) + (((0 + 1) + 1 : ℕ) : ℝ) * Qlog + (pDetect + 1) + 4 + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ (allocatedDetectedZeroGain (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2 → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (0 + 1)) + let coverLog := (Pproj + ((0 + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (0 + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (0 + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,0,0,max 0 0 0} m (0 + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (0 + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (0 + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vtail j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (0 + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ≤ (N i : ℝ)) → + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + ∀ (hbases : bases.Nonempty), + let hξn := normalizedTupleNarrowWidth_pos (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + (htotal : 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem)) → + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW hτSpatial hξn stride cells hmass bases hbases htotal + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) 0 (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + (0 + 1) * (0 + 3) ≤ Fintype.card G → (allocatedDetectedZeroKernelCutoff G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) ≤ S.value → + let Cbudget := Classical.choose (exists_canonicalSlicedNative_input_budget m (0 + 1) Amass Aanalytic) + let Bbudget := (Pnative + Cbudget) ^ Cbudget + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{0,0,0,0,0,0} m (0 + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} 0) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + 0 ≤ u → 0 ≤ pModel → 0 ≤ budget → + pSlice ≤ pModel → pSlice * Fintype.card (LayerSamplerVariables G I n B) ≤ pModel → + Ctail ≤ Real.exp pModel → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp pModel → + (∀ j, σ j ≤ 1) → + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + τ ≤ 1 / 2 → (Fintype.card (Fin nX) : ℝ) * τ ≤ 1 / 2 → (hξone : ξn ≤ 1) → + ∀ {Efull : ℝ}, + let Afull := Classical.choose (exists_allocated_fullBox_normalized_approximation.{0,0,0,0,0,0} m) + (∀ i, Real.exp ((max Pproj Efull + Afull) ^ Afull) ≤ (N i : ℝ)) → + Real.exp ((max Pproj Efull + Afull) ^ Afull) ≤ Rrank → + u + 2 * pModel + budget + 30 ≤ Efull → + ∃ hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i, + let hrootSum := fun t : Sites => allocatedParameterBox_root_bound B U basis S t + let physical := narrowPhysicalSiteMap (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) hW hτSpatial + hξone N (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) + hmargin e hrootSum + ∀ (input : integerBox N → ℂ), (∀ t, ‖input t‖ ≤ Real.exp pModel) → + ∃ (nterms : ℕ) (_ : 0 < nterms) + (Qmodel : Fin nterms → (integerBox N → ℂ)) + (coeff : Fin nterms → ℝ) (err : integerBox N → ℂ), + (∀ i, Qmodel i ∈ twistedNativeSampleFunctions (fun _ : Fin nX => 1) 0 budget + (fun t : integerBox N => t.val) + (fun (twist : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩) + (t : integerBox N) => twist.eval N poly t.val)) ∧ + input = (∑ i, coeff i • Qmodel i) + err ∧ + (∑ i, |coeff i|) ≤ Real.exp (budget + 2) ∧ + sampledSliceSeminorm pathLaw physical slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) err ≤ Real.exp (-u) ∧ + (nterms : ℝ) ≤ Real.exp (2 * budget + 2 * u + 4 * pModel + 30) + +include hb o μ ν hR hσ in +omit [CompactSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [MeasurableSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [BorelSpace (CoefficientTorus (K := Fin (0 + 1)) U)] + [MeasurableSpace (SiteTorus (Finset (Fin (0 + 1))) U)] + [BorelSpace (SiteTorus (Finset (Fin (0 + 1))) U)] in +theorem preparedModularCanonicalDetectorFullBoxConsumer + (Pchart D target Pk Prho Qstride : ℝ) (K : ℝ≥0) + (hNative : AllocatedPreparedNativeInterface (B := B) (U := U) (basis := basis) + (hR := hR) (hσ := hσ) (S := S) (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) («pDetect» := pDetect) («qDetect» := qDetect) («α» := α) + (Q := Q) (hb := hb) (o := o) Pchart P D target Pk Prho Qstride K) : + PreparedModularCanonicalDetectorFullBoxResult + (B := B) (U := U) (basis := basis) (hR := hR) (hσ := hσ) (S := S) + (selection := selection) (stride := stride) (N := N) (Pdetect := Pdetect) + (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) + (P := P) (Q := Q) (hb := hb) (o := o) Pchart D target Pk Prho Qstride K := by + unfold PreparedModularCanonicalDetectorFullBoxResult + intro hMkP hMkPk hQstride hstride hstrideBound C hC hCbound hchart Cforward hforward Pbox Vlog Nlog Mlog baseAmbient hPbox hVlog hNlog hMlog hbox hvolume hnormalizer hmaskLog hbaseAmbient hvbase hnbase hmbase hsites haxes hlabelLog hKbase hcoords hcutoff hperiodLog hrowsAmbient houtputs hheight Qgrid hQgrid Ag hAg hBa hBi Dg vg wg hDg hvg hwg hcube hdegree hrowsD htailDegree hblocks hRv hRiGrid hδw hcoeff haxesGrid hfullAxes hfullOutputs hambientCount hprofileBudget Banalytic hBanalytic hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic Pnum hPnum hI hn hcoeffEarly hRiEarly hVEarly Pproj coarseTarget Ecoarse pGain + ambientQ ambientBudget τ Pphysical W ξn hW cells poly hp hmem + lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel Cgrid Qlog tg pg p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual hXmass hframeMass hstrideMass hτMass + AmassWindow hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj Aproj hSizeProj hRankProj + Pside hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hξn hmass htotal Path pathLaw + sides Sites e Tests _ Ldetect _ _ dims _ _ _ _ Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hdenseSlice hdimensionDetect hcomplexity hcap + hGdetect hkernel + Cbudget Bbudget Anorm Anative Abudget budget hu hpModel hbudget hpSliceModel hSliceLog hCtail hcountModel + hσfull hsmallfull hτhalf hτdim hξone Efull Afull hsizeFull hRankFull htail + have hCtail0 : 0 ≤ 4 * ∏ j, + earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j) := by + apply mul_nonneg (by norm_num) + exact Finset.prod_nonneg (fun j _ => + earlyConstantDensityCap_nonneg _ _ (hR j) (Vtail j).coe_nonneg) + obtain ⟨hpDetect, hα, hαone, haDetect, hαlower, hmeshDetect, hthreshold⟩ := + preparedModularCanonicalDetectorThreshold_parameters + (Fintype.card (LayerSamplerVariables G I n B)) hu hpModel + (Real.exp_nonneg _) hCtail0 (Real.exp_le_exp.mpr hSliceLog) hCtail hcountModel + have hpSliceDetect : pSlice ≤ pDetect := by + dsimp only [allocatedModelTestLog] + linarith only [hpSliceModel, hu, hpModel] + have hdenseDetect z j := (hdenseSlice z j).mono_parameter hpSliceDetect + have htests z j t : ‖star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))‖ ≤ 1 := by + simpa only [norm_star] using + ((Vdetect z j).norm_eval_le _).trans (hcap z j) + have hsides (k : LayerSamplerVariables G I n B) : 0 < sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U basis S j + let : ∀ k, NeZero (sides k) := fun k => ⟨(hsides k).ne'⟩ + let : Nonempty Sites := (integerBox_nonempty sides).to_subtype + have hfull := (Classical.choose_spec + (exists_allocated_fullBox_normalized_approximation.{0,0,0,0,0,0} m)).2 + (X := Fin nX) (G := G) B U basis S hb o μ ν hR hσ hσfull + Cproj Vtail hCactual hVactual C hC hchart hsmallfull + (P := Pproj) (E := Efull) ((by norm_num : (0 : ℝ) ≤ 1).trans hPproj) hmProj hKproj hXproj hFrameProj + hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hLproj hCproj hVproj + poly hp hmem stride hstridepos hStrideProj hW hWproj le_rfl + hτ hτProj hτhalf hτdim hξn hξone hξProj N hsizeFull hrank hRankFull cells hCells + obtain ⟨hNfull, hbasesFull, hboxFull, hmassFull, hnormalizerFull, hmargin, hmodel⟩ := hfull + refine ⟨hmargin, ?_⟩ + intro hrootSum physical input hinput + apply hmodel slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) + (fun _ : Fin nX => 1) 0 hu hpModel hbudget hSliceLog hCtail hdenseSlice htests + htail ?_ input hinput + intro signal hsignal hzero hdetected + have hnative := hNative hMkP hMkPk hQstride hstride hstrideBound C hC hCbound hchart + Cforward hforward hPbox hVlog hNlog hMlog hbox hvolume hnormalizer hmaskLog + hbaseAmbient hvbase hnbase hmbase hsites haxes hlabelLog hKbase hcoords hcutoff hperiodLog + hrowsAmbient houtputs hheight Qgrid hQgrid Ag hAg hBa hBi hDg hvg hwg hcube hdegree + hrowsD htailDegree hblocks hRv hRiGrid hδw hcoeff haxesGrid hfullAxes hfullOutputs hambientCount + hprofileBudget hBanalytic hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic + hPnum hI hn hcoeffEarly hRiEarly hVEarly + (Pproj := Pproj) (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + (τ := τ) (Pphysical := Pphysical) + have hnative := hnative (Pnative := Pnative) cells poly hp hmem signal + (fun t _ => hsignal t) hzero + (lossTarget := lossTarget) (Psample := Psample) (Rrank := Rrank) + (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision + have hnative := hnative (Pside := Pside) + hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vtail hcoverAmbient hcoverSample hmassSample hCactual hVactual + hXmass hframeMass hstrideMass hτMass hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj + hProfileProj hCproj hVproj hXproj hFrameProj hStrideProj hτProj hξProj hSizeProj hRankProj + exact hnative hProjSide hCapSide hpSide htargetSide hside hCells _ hbases + hmass htotal e Subtype.val_injective Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hpDetect hpDetect hdenseDetect hdimensionDetect hcomplexity hcap + hα hαone hmeshDetect hthreshold hdetected hGdetect hkernel + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorFullBoxConsumerGeneral.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorFullBoxConsumerGeneral.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f0ffaedad9498af30623c43ec2c1a40c90cb831 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorFullBoxConsumerGeneral.lean @@ -0,0 +1,444 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedModularGeneralProductivityEarlyGain + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +variable {m : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {s nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +local notation "α" => allocatedModelUnitThreshold u pModel Kslice Ctail +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +def PreparedModularCanonicalDetectorFullBoxResultGeneral + (Pchart _D target Pk Prho Qstride : ℝ) (K : ℝ≥0) : Prop := + ∀ (_hMkP : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp P) + (_hMkPk : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pk) + (_hQstride : 0 ≤ Qstride) + (_hstride : ∀ i, 0 < stride i) + (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) + (_hC : ∀ j, 0 ≤ C j) + (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + {Pbox Vlog Nlog Mlog baseAmbient : ℝ} + (_hPbox : 0 ≤ Pbox) + (_hVlog : 0 ≤ Vlog) + (_hNlog : 0 ≤ Nlog) + (_hMlog : 0 ≤ Mlog) + (_hbox : 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp Pbox) + (_hvolume : allocatedFullGridNaturalVolume B U basis S rowSets ≤ Real.exp Vlog) + (_hnormalizer : ‖((allocatedProductIdealNormalizer B U basis S rowSets : ℝ) : ℂ)⁻¹‖ ≤ Real.exp Nlog) + (_hmaskLog : (Fintype.card (LayerSamplerAxis I n) : ℝ) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * (((m + 1 : ℕ) : ℝ) * Pk)) ≤ Mlog) + (_hbaseAmbient : 0 ≤ baseAmbient) + (_hvbase : Vlog ≤ baseAmbient) + (_hnbase : Nlog ≤ baseAmbient) + (_hmbase : Mlog ≤ baseAmbient) + (_hsites : (Fintype.card (Finset (Fin (s + 1))) : ℝ) ≤ baseAmbient) + (_haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ baseAmbient) + (_hlabelLog : (∑ j, (n j : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk)) + + ∑ j, (Fintype.card (Q j) : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk) ≤ baseAmbient) + (_hKbase : (K : ℝ) ≤ Real.exp baseAmbient) + (_hcoords : ((∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp baseAmbient) + (_hperiodLog : ((m + 1 : ℕ) : ℝ) * Pk ≤ baseAmbient) + (_hrowsAmbient : ((∑ j : Fin m, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (_houtputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ baseAmbient) + (_hheight : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ Real.exp baseAmbient) + (Qgrid : ℝ≥0) + (_hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U basis S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U basis S a).1 (allocatedGridIntegerAxis B U basis S a).2) : ℝ) + 1) ≤ Qgrid) + (Ag : ℝ≥0) + (_hAg : LipschitzWith Ag Real.smoothTransition) + (_hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (_hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg : ℝ} + (_hDg : 0 ≤ Dg) + (_hvg : 0 ≤ vg) + (_hwg : 0 ≤ wg) + (_hcube : (Fintype.card (Fin (s + 1)) : ℝ) ≤ Dg) + (_hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (_hrowsD : ∀ j : Fin m, ((boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card : ℝ) ≤ Dg) + (_htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (_hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (_hRv : ∀ j, R j ≤ Real.exp vg) + (_hRiGrid : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (_hδw : pDetect + 1 ≤ wg) + (_hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (_haxesGrid : (Fintype.card {a // grid a} : ℝ) ≤ Dg) + (_hfullAxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ Dg) + (_hfullOutputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ Dg) + (_hambientCount : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ Dg) + (_hprofileBudget : (probabilityProfileLipschitz : ℝ) ≤ Dg) + {Banalytic : ℝ} + (_hBanalytic : 0 ≤ Banalytic) + (_hDanalytic : Dg ≤ Banalytic) + (_hcutoffAnalytic : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Banalytic) + (_hcoordAnalytic : ((K * ∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp Banalytic) + (_hgridAnalytic : (Qgrid : ℝ) ≤ Real.exp Banalytic) + {Pnum : ℝ} + (_hPnum : 0 ≤ Pnum) + (_hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) + (_hn : ∀ j, (n j : ℝ) ≤ Pnum) + (_hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (_hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (_hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Real.exp Pnum) + {Pproj coarseTarget Ecoarse pGain : ℝ}, + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (s + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + let ξn := normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) +, + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (s + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,0,0} m (s + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (_hPhysicalNonneg : 0 ≤ Pphysical) → (_hMkPhysicalBound : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pphysical) → + (_hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (_hCoarseNonneg : 0 ≤ coarseTarget) → + (_hDimPhysicalBound : (((s + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (_hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (_hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (s + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (s + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (s + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let Cgrid := Classical.choose (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (s + 1) Ag) + let Qlog := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let tg := ((s + 1 : ℕ) : ℝ) + Qlog + (pDetect + 1) + 1 + let pg := (Cgrid : ℝ) + (((s + 1) + 1 : ℕ) : ℝ) * Qlog + (pDetect + 1) + 4 + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ (allocatedDetectedGain s (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2 → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1)) + let coverLog := (Pproj + ((s + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (s + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (s + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,0,0,max 0 0 0} m (s + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vtail j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ≤ (N i : ℝ)) → + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + ∀ (hbases : bases.Nonempty), + let hξn := normalizedTupleNarrowWidth_pos (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + (htotal : 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem)) → + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW hτSpatial hξn stride cells hmass bases hbases htotal + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + let e : Sites → LayerSamplerVariables G I n B → ℤ := Subtype.val + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Sites) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pSlice ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + (s + 1) * (s + 3) ≤ Fintype.card G → (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) ≤ S.value → + let Cbudget := Classical.choose (exists_canonicalSlicedNative_input_budget m (s + 1) Amass Aanalytic) + let Bbudget := (Pnative + Cbudget) ^ Cbudget + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{0,0,0,0,0,0} m (s + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + 0 ≤ u → 0 ≤ pModel → 0 ≤ budget → + pSlice ≤ pModel → pSlice * Fintype.card (LayerSamplerVariables G I n B) ≤ pModel → + Ctail ≤ Real.exp pModel → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp pModel → + (∀ j, σ j ≤ 1) → + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + τ ≤ 1 / 2 → (Fintype.card (Fin nX) : ℝ) * τ ≤ 1 / 2 → (hξone : ξn ≤ 1) → + ∀ {Efull : ℝ}, + let Afull := Classical.choose (exists_allocated_fullBox_normalized_approximation.{0,0,0,0,0,0} m) + (∀ i, Real.exp ((max Pproj Efull + Afull) ^ Afull) ≤ (N i : ℝ)) → + Real.exp ((max Pproj Efull + Afull) ^ Afull) ≤ Rrank → + u + 2 * pModel + budget + 30 ≤ Efull → + ∃ hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i, + let hrootSum := fun t : Sites => allocatedParameterBox_root_bound B U basis S t + let physical := narrowPhysicalSiteMap (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) hW hτSpatial + hξone N (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) + hmargin e hrootSum + ∀ (input : integerBox N → ℂ), (∀ t, ‖input t‖ ≤ Real.exp pModel) → + ∃ (nterms : ℕ) (_ : 0 < nterms) + (Qmodel : Fin nterms → (integerBox N → ℂ)) + (coeff : Fin nterms → ℝ) (err : integerBox N → ℂ), + (∀ i, Qmodel i ∈ twistedNativeSampleFunctions (fun _ : Fin nX => 1) s budget + (fun t : integerBox N => t.val) + (fun (twist : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩) + (t : integerBox N) => twist.eval N poly t.val)) ∧ + input = (∑ i, coeff i • Qmodel i) + err ∧ + (∑ i, |coeff i|) ≤ Real.exp (budget + 2) ∧ + sampledSliceSeminorm pathLaw physical slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) err ≤ Real.exp (-u) ∧ + (nterms : ℝ) ≤ Real.exp (2 * budget + 2 * u + 4 * pModel + 30) + +omit [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] + [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] + [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] + [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] + [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] in +include hb o μ ν hR hσ in + +theorem preparedModularCanonicalDetectorFullBoxConsumerGeneral + (_hsm : s ≤ m) + (Pchart D target Pk Prho Qstride : ℝ) (K : ℝ≥0) + (hNative : AllocatedPreparedNativeInterfaceGeneral (B := B) (U := U) (basis := basis) + (hR := hR) (hσ := hσ) (S := S) (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) («pDetect» := pDetect) («qDetect» := qDetect) («α» := α) + (Q := Q) (hb := hb) (o := o) Pchart P D target Pk Prho Qstride K) : + PreparedModularCanonicalDetectorFullBoxResultGeneral + (B := B) (U := U) (basis := basis) (hR := hR) (hσ := hσ) (S := S) + (selection := selection) (stride := stride) (N := N) (Pdetect := Pdetect) + (u := u) (pModel := pModel) (pSlice := pSlice) (Vtail := Vtail) + (P := P) (Q := Q) (hb := hb) (o := o) Pchart D target Pk Prho Qstride K := by + unfold PreparedModularCanonicalDetectorFullBoxResultGeneral + intro hMkP hMkPk hQstride hstride hstrideBound C hC hCbound hchart Cforward hforward Pbox Vlog Nlog Mlog baseAmbient hPbox hVlog hNlog hMlog hbox hvolume hnormalizer hmaskLog hbaseAmbient hvbase hnbase hmbase hsites haxes hlabelLog hKbase hcoords hcutoff hperiodLog hrowsAmbient houtputs hheight Qgrid hQgrid Ag hAg hBa hBi Dg vg wg hDg hvg hwg hcube hdegree hrowsD htailDegree hblocks hRv hRiGrid hδw hcoeff haxesGrid hfullAxes hfullOutputs hambientCount hprofileBudget Banalytic hBanalytic hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic Pnum hPnum hI hn hcoeffEarly hRiEarly hVEarly Pproj coarseTarget Ecoarse pGain + ambientQ ambientBudget τ Pphysical W ξn hW cells poly hp hmem + lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel Cgrid Qlog tg pg p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual hXmass hframeMass hstrideMass hτMass + AmassWindow hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj Aproj hSizeProj hRankProj + Pside hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hξn hmass htotal Path pathLaw + sides Sites e Tests _ Ldetect _ _ dims _ _ _ _ Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hdenseSlice hdimensionDetect hcomplexity hcap + hGdetect hkernel + Cbudget Bbudget Anorm Anative Abudget budget hu hpModel hbudget hpSliceModel hSliceLog hCtail hcountModel + hσfull hsmallfull hτhalf hτdim hξone Efull Afull hsizeFull hRankFull htail + have hCtail0 : 0 ≤ 4 * ∏ j, + earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j) := by + apply mul_nonneg (by norm_num) + exact Finset.prod_nonneg (fun j _ => + earlyConstantDensityCap_nonneg _ _ (hR j) (Vtail j).coe_nonneg) + obtain ⟨hpDetect, hα, hαone, haDetect, hαlower, hmeshDetect, hthreshold⟩ := + preparedModularCanonicalDetectorThreshold_parameters + (Fintype.card (LayerSamplerVariables G I n B)) hu hpModel + (Real.exp_nonneg _) hCtail0 (Real.exp_le_exp.mpr hSliceLog) hCtail hcountModel + have hpSliceDetect : pSlice ≤ pDetect := by + dsimp only [allocatedModelTestLog] + linarith only [hpSliceModel, hu, hpModel] + have hdenseDetect z j := (hdenseSlice z j).mono_parameter hpSliceDetect + have htests z j t : ‖star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))‖ ≤ 1 := by + simpa only [norm_star] using + ((Vdetect z j).norm_eval_le _).trans (hcap z j) + have hsides (k : LayerSamplerVariables G I n B) : 0 < sides k := by + cases k with + | inl g => exact S.positive + | inr j => exact allocatedPrincipalSides_pos B U basis S j + let : ∀ k, NeZero (sides k) := fun k => ⟨(hsides k).ne'⟩ + let : Nonempty Sites := (integerBox_nonempty sides).to_subtype + have hfull := (Classical.choose_spec + (exists_allocated_fullBox_normalized_approximation.{0,0,0,0,0,0} m)).2 + (X := Fin nX) (G := G) B U basis S hb o μ ν hR hσ hσfull + Cproj Vtail hCactual hVactual C hC hchart hsmallfull + (P := Pproj) (E := Efull) ((by norm_num : (0 : ℝ) ≤ 1).trans hPproj) hmProj hKproj hXproj hFrameProj + hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hLproj hCproj hVproj + poly hp hmem stride hstridepos hStrideProj hW hWproj le_rfl + hτ hτProj hτhalf hτdim hξn hξone hξProj N hsizeFull hrank hRankFull cells hCells + obtain ⟨hNfull, hbasesFull, hboxFull, hmassFull, hnormalizerFull, hmargin, hmodel⟩ := hfull + refine ⟨hmargin, ?_⟩ + intro hrootSum physical input hinput + apply hmodel slices + (fun z j t => star ((Vdetect z j).eval + (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) + (fun _ : Fin nX => 1) s hu hpModel hbudget hSliceLog hCtail hdenseSlice htests + htail ?_ input hinput + intro signal hsignal hzero hdetected + have hnative := hNative hMkP hMkPk hQstride hstride hstrideBound C hC hCbound hchart + Cforward hforward hPbox hVlog hNlog hMlog hbox hvolume hnormalizer hmaskLog + hbaseAmbient hvbase hnbase hmbase hsites haxes hlabelLog hKbase hcoords hcutoff hperiodLog + hrowsAmbient houtputs hheight Qgrid hQgrid Ag hAg hBa hBi hDg hvg hwg hcube hdegree + hrowsD htailDegree hblocks hRv hRiGrid hδw hcoeff haxesGrid hfullAxes hfullOutputs hambientCount + hprofileBudget hBanalytic hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic + hPnum hI hn hcoeffEarly hRiEarly hVEarly + (Pproj := Pproj) (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + (τ := τ) (Pphysical := Pphysical) + have hnative := hnative (Pnative := Pnative) cells poly hp hmem signal + (fun t _ => hsignal t) hzero + (lossTarget := lossTarget) (Psample := Psample) (Rrank := Rrank) + (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision + have hnative := hnative (Pside := Pside) + hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vtail hcoverAmbient hcoverSample hmassSample hCactual hVactual + hXmass hframeMass hstrideMass hτMass hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj + hProfileProj hCproj hVproj hXproj hFrameProj hStrideProj hτProj hξProj hSizeProj hRankProj + exact hnative hProjSide hCapSide hpSide htargetSide hside hCells _ hbases + hmass htotal e Subtype.val_injective Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hpDetect hpDetect hdenseDetect hdimensionDetect hcomplexity hcap + hα hαone hmeshDetect hthreshold hdetected hGdetect hkernel + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorGeometricBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorGeometricBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e4cf9acb4d3d39b270039e65a7a40c9ceceaa32 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorGeometricBounds.lean @@ -0,0 +1,232 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedAffineSourceAccuracy + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical NNReal + +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 (rowSets : Fin m → Finset (Finset (Fin 1))) + +local notation "rowTypes" => (fun j : Fin m => (rowSets j : Type)) + +theorem preparedModularDetector_variable_count {D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) : + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ 2 * D := by + change ((Fintype.card (G ⊕ PrincipalTupleIndex B (layerSamplerDegree I n))) : ℝ) ≤ _ + rw [Fintype.card_sum, Nat.cast_add] + linarith [hdim.kernel_variables, hdim.tuples] + +theorem preparedModularDetector_layer_axes {D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) : + (∀ j, (Fintype.card (I j) : ℝ) ≤ D) ∧ (∀ j, (n j : ℝ) ≤ D) := by + constructor + · intro j + have hcard : Fintype.card (I j) ≤ Fintype.card (LayerSamplerAxis I n) := + Fintype.card_le_of_injective (fun i : I j => (⟨j, Sum.inl i⟩ : LayerSamplerAxis I n)) + (by intro x y h; exact Sum.inl_injective (eq_of_heq (Sigma.mk.inj_iff.mp h).2)) + exact (Nat.cast_le.mpr hcard).trans hdim.axes + + · intro j + have hcard : Fintype.card (Fin (n j)) ≤ Fintype.card (LayerSamplerAxis I n) := + Fintype.card_le_of_injective (fun i : Fin (n j) => (⟨j, Sum.inr i⟩ : LayerSamplerAxis I n)) + (by intro x y h; exact Sum.inr_injective (eq_of_heq (Sigma.mk.inj_iff.mp h).2)) + rw [Fintype.card_fin] at hcard + exact (Nat.cast_le.mpr hcard).trans hdim.axes + +theorem preparedModularDetector_block_card (a : LayerSamplerAxis I n) : + Fintype.card (B a) ≤ Fintype.card (LayerSamplerVariables G I n B) := by + let f : B a → LayerSamplerVariables G I n B := fun x => + Sum.inr ⟨a, x, ⟨0, by simp [layerSamplerDegree]⟩⟩ + apply Fintype.card_le_of_injective f + intro x y h + have hpair := eq_of_heq (Sigma.mk.inj_iff.mp (Sum.inr_injective h)).2 + exact congrArg Prod.fst hpair + +theorem preparedModularDetector_blocks {D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) + (a : LayerSamplerAxis I n) : + (Fintype.card (B a) : ℝ) ≤ 2 * D := + (Nat.cast_le.mpr (preparedModularDetector_block_card (G := G) B a)).trans + (preparedModularDetector_variable_count B rowSets hdim) + +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +theorem preparedModularDetector_grid_axes {D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) : + (Fintype.card {a // allocatedGridAxis (I := I) U b S.value a} : ℝ) ≤ D := + (Nat.cast_le.mpr (Fintype.card_subtype_le _)).trans hdim.axes + +theorem preparedModularDetector_natural_volume {P D : ℝ} + (hP : 0 ≤ P) (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) + (hDP : D ≤ P) (hR : ∀ j, 0 < R j) (hRone : ∀ j, R j ≤ 1) + (hS : (S.value : ℝ) ≤ Real.exp P) : + allocatedFullGridNaturalVolume B U b S rowSets ≤ + Real.exp (P ^ 2 * (((layerTailDegree m + 1 : ℕ) : ℝ) * P + 1)) := by + have hrow (j : Fin m) : ((rowSets j).card : ℝ) ≤ P := by + have hr : ((rowSets j).card : ℝ) ≤ D := by + simpa only [Fintype.card_coe] using hdim.rows j + exact hr.trans hDP + have hvol := allocatedFullGridNaturalVolume_le_exp B U b S rowSets hR + (P := 0) (L := P) (D := P) (by norm_num) hP hP + (fun j => by simpa only [Real.exp_zero] using hRone j) hS hrow + apply hvol.trans (Real.exp_le_exp.mpr ?_) + have hgrid := (preparedModularDetector_grid_axes B rowSets U b S hdim).trans hDP + calc + _ ≤ P * (P * (0 + ((layerTailDegree m + 1 : ℕ) : ℝ) * P + 1)) := + mul_le_mul_of_nonneg_right hgrid (by positivity) + _ = _ := by ring + +theorem preparedModularDetector_principal_slots {P D : ℝ} + (hP : 0 ≤ P) (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) + (hDP : D ≤ P) (j : Fin m) (i : Fin (n j)) : + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B j i) : ℝ) + 1) ≤ + Real.exp (P + 8) := by + have hc : (Finset.card (layerIntegerPrincipalSlots (G := G) B j i) : ℝ) ≤ P := + (Nat.cast_le.mpr (Finset.card_le_univ _)).trans ((hdim.coefficients j).trans hDP) + have h8 : (8 : ℝ) ≤ Real.exp 8 := by linarith [Real.add_one_le_exp (8 : ℝ)] + calc + _ ≤ 8 * (P + 1) := by linarith + _ ≤ Real.exp 8 * Real.exp P := mul_le_mul h8 (Real.add_one_le_exp P) + (by linarith) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem preparedModularDetector_grid_slot_cap {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) (hDP : D ≤ P) : + let Qgrid := Real.toNNReal (8 * (D + 1)) + (∀ a : {a // allocatedGridAxis (I := I) U b S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U b S a).1 (allocatedGridIntegerAxis B U b S a).2) : ℝ) + 1) ≤ + (Qgrid : ℝ)) ∧ (Qgrid : ℝ) ≤ Real.exp (P + 8) := by + have hnonneg : 0 ≤ 8 * (D + 1) := by linarith [hdim.nonneg] + dsimp only + rw [Real.coe_toNNReal _ hnonneg] + constructor + · intro a + have hc := (Nat.cast_le.mpr (Finset.card_le_univ + (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U b S a).1 (allocatedGridIntegerAxis B U b S a).2))).trans + (hdim.coefficients (allocatedGridIntegerAxis B U b S a).1) + linarith + · have hP := hdim.nonneg.trans hDP + have h8 : (8 : ℝ) ≤ Real.exp 8 := by linarith [Real.add_one_le_exp (8 : ℝ)] + calc + _ ≤ 8 * (P + 1) := by linarith + _ ≤ Real.exp 8 * Real.exp P := + mul_le_mul h8 (Real.add_one_le_exp P) (by linarith) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem preparedModularDetector_ambient_count {P : ℝ} + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) : + ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ (m : ℝ) * P := by + rw [Nat.cast_sum] + calc + _ ≤ ∑ _j : Fin m, P := Finset.sum_le_sum (fun j _ => hJ j) + _ = _ := by simp + +theorem preparedModularDetector_physical_root {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) + (hDP : D ≤ P) (hS : (S.value : ℝ) ≤ Real.exp P) : + allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ Real.exp (2 * P + 8) := by + have hP : 0 ≤ P := hdim.nonneg.trans hDP + have hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ 2 * P := + (preparedModularDetector_variable_count B rowSets hdim).trans (by linarith) + have hvarsExp : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp (P + 8) := by + calc + _ ≤ 2 * P := hvars + _ ≤ Real.exp 8 * Real.exp P := mul_le_mul + (by linarith [Real.add_one_le_exp (8 : ℝ)]) + (by linarith [Real.add_one_le_exp P]) hP (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + rw [allocatedPhysicalRootBudget_zero] + calc + _ ≤ Real.exp (P + 8) * Real.exp P := + mul_le_mul hvarsExp hS (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem preparedModularDetector_site_radius {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) + (hDP : D ≤ P) : + 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp (2 * P + 8) := by + apply (allocatedRowSlicedSiteRadius_buffer_le_exp rowSets).trans + apply Real.exp_le_exp.mpr + simp only [Fintype.card_fin, Nat.cast_one, mul_one] + linarith [hdim.degree] + +theorem preparedModularDetector_source_numerics (C V : Fin m → ℝ≥0) {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) + (hDP : D ≤ P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) + (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) (hS : (S.value : ℝ) ≤ Real.exp P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp P) (hV : ∀ j, (V j : ℝ) ≤ Real.exp P) : + AllocatedSourceNumerics B U b S C V (2 * P + 8) := by + have hP : 0 ≤ P := hdim.nonneg.trans hDP + have hPQ : P ≤ 2 * P + 8 := by linarith + have hDQ := hDP.trans hPQ + have hExp : Real.exp P ≤ Real.exp (2 * P + 8) := Real.exp_le_exp.mpr hPQ + obtain ⟨hI, hn⟩ := preparedModularDetector_layer_axes B rowSets hdim + exact { + nonneg := by linarith + degree := hdim.degree.trans hDQ + variable_count := (preparedModularDetector_variable_count B rowSets hdim).trans (by linarith) + length := hS.trans hExp + radius_inv := fun j => (hRi j).trans hExp + width_inv := fun j => (hσi j).trans hExp + coefficients := fun j => (hdim.coefficients j).trans hDQ + real_axes := fun j => (hI j).trans hDQ + integer_axes := fun j => (hn j).trans hDQ + ambient_axes := fun j => (hJ j).trans hPQ + profile := hdim.profile.trans (hDQ.trans (by linarith [Real.add_one_le_exp (2 * P + 8)])) + chart := fun j => (hC j).trans hExp + covolume := fun j => (hV j).trans hExp + root := preparedModularDetector_physical_root B rowSets U b S hdim hDP hS } + +theorem preparedModularDetector_chart_sum (C : Fin m → ℝ≥0) {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) + (hDP : D ≤ P) (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp P) : + ((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp (3 * P) := by + have hP : 0 ≤ P := hdim.nonneg.trans hDP + have hPexp : P ≤ Real.exp P := by linarith [Real.add_one_le_exp P] + have hmexp : (m : ℝ) ≤ Real.exp P := hdim.degree.trans (hDP.trans hPexp) + push_cast + calc + _ ≤ ∑ _j : Fin m, Real.exp P * P := by + apply Finset.sum_le_sum + intro j _ + exact mul_le_mul (hC j) (hJ j) (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = (m : ℝ) * (Real.exp P * P) := by simp + _ ≤ Real.exp P * (Real.exp P * Real.exp P) := mul_le_mul hmexp + (mul_le_mul_of_nonneg_left hPexp (Real.exp_nonneg _)) (by positivity) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + +theorem preparedModularDetector_inverse_normalizer (C V : Fin m → ℝ≥0) {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin 1) rowTypes D) + (hDP : D ≤ P) (hR : ∀ j, 0 < R j) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) + (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) (hS : (S.value : ℝ) ≤ Real.exp P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp P) (hV : ∀ j, (V j : ℝ) ≤ Real.exp P) + (hvolume : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) : + ‖((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹‖ ≤ + Real.exp ((m * (2 : ℝ)) * (2 * P + 16) * (1 + 4 * (2 * P + 8))) := by + have hnum := preparedModularDetector_source_numerics B rowSets U b S C V + hdim hDP hRi hσi hS hJ hC hV + have h := allocatedProductIdealNormalizer_source_budget B U b S rowSets hR C V hnum hvolume + simpa only [Fintype.card_fin, pow_one, add_assoc, show (8 : ℝ) + 8 = 16 by norm_num] using h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorGeometricBoundsGeneral.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorGeometricBoundsGeneral.lean new file mode 100644 index 0000000000000000000000000000000000000000..81e5769d6c1a652ed8c959bface4e37d0f4d8ab0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorGeometricBoundsGeneral.lean @@ -0,0 +1,235 @@ +import OAI.Combinatorics.Progressions.Lattices.AllocatedAffineSourceAccuracy + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule +open scoped BigOperators Classical NNReal + +variable {m dim : ℕ} {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 (rowSets : Fin m → Finset (Finset (Fin dim))) + +local notation "rowTypes" => (fun j : Fin m => (rowSets j : Type)) + +theorem preparedModularGeneralDetector_variable_count {D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) : + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ 2 * D := by + change ((Fintype.card (G ⊕ PrincipalTupleIndex B (layerSamplerDegree I n))) : ℝ) ≤ _ + rw [Fintype.card_sum, Nat.cast_add] + linarith [hdim.kernel_variables, hdim.tuples] + +theorem preparedModularGeneralDetector_layer_axes {D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) : + (∀ j, (Fintype.card (I j) : ℝ) ≤ D) ∧ (∀ j, (n j : ℝ) ≤ D) := by + constructor + · intro j + have hcard : Fintype.card (I j) ≤ Fintype.card (LayerSamplerAxis I n) := + Fintype.card_le_of_injective (fun i : I j => (⟨j, Sum.inl i⟩ : LayerSamplerAxis I n)) + (by intro x y h; exact Sum.inl_injective (eq_of_heq (Sigma.mk.inj_iff.mp h).2)) + exact (Nat.cast_le.mpr hcard).trans hdim.axes + + · intro j + have hcard : Fintype.card (Fin (n j)) ≤ Fintype.card (LayerSamplerAxis I n) := + Fintype.card_le_of_injective (fun i : Fin (n j) => (⟨j, Sum.inr i⟩ : LayerSamplerAxis I n)) + (by intro x y h; exact Sum.inr_injective (eq_of_heq (Sigma.mk.inj_iff.mp h).2)) + rw [Fintype.card_fin] at hcard + exact (Nat.cast_le.mpr hcard).trans hdim.axes + +theorem preparedModularGeneralDetector_block_card (a : LayerSamplerAxis I n) : + Fintype.card (B a) ≤ Fintype.card (LayerSamplerVariables G I n B) := by + let f : B a → LayerSamplerVariables G I n B := fun x => + Sum.inr ⟨a, x, ⟨0, by simp [layerSamplerDegree]⟩⟩ + apply Fintype.card_le_of_injective f + intro x y h + have hpair := eq_of_heq (Sigma.mk.inj_iff.mp (Sum.inr_injective h)).2 + exact congrArg Prod.fst hpair + +theorem preparedModularGeneralDetector_blocks {D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) + (a : LayerSamplerAxis I n) : + (Fintype.card (B a) : ℝ) ≤ 2 * D := + (Nat.cast_le.mpr (preparedModularGeneralDetector_block_card (G := G) B a)).trans + (preparedModularGeneralDetector_variable_count B rowSets hdim) + +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] +variable (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) + +theorem preparedModularGeneralDetector_grid_axes {D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) : + (Fintype.card {a // allocatedGridAxis (I := I) U b S.value a} : ℝ) ≤ D := + (Nat.cast_le.mpr (Fintype.card_subtype_le _)).trans hdim.axes + +theorem preparedModularGeneralDetector_natural_volume {P D : ℝ} + (hP : 0 ≤ P) (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) + (hDP : D ≤ P) (hR : ∀ j, 0 < R j) (hRone : ∀ j, R j ≤ 1) + (hS : (S.value : ℝ) ≤ Real.exp P) : + allocatedFullGridNaturalVolume B U b S rowSets ≤ + Real.exp (P ^ 2 * (((layerTailDegree m + 1 : ℕ) : ℝ) * P + 1)) := by + have hrow (j : Fin m) : ((rowSets j).card : ℝ) ≤ P := by + have hr : ((rowSets j).card : ℝ) ≤ D := by + simpa only [Fintype.card_coe] using hdim.rows j + exact hr.trans hDP + have hvol := allocatedFullGridNaturalVolume_le_exp B U b S rowSets hR + (P := 0) (L := P) (D := P) (by norm_num) hP hP + (fun j => by simpa only [Real.exp_zero] using hRone j) hS hrow + apply hvol.trans (Real.exp_le_exp.mpr ?_) + have hgrid := (preparedModularGeneralDetector_grid_axes B rowSets U b S hdim).trans hDP + calc + _ ≤ P * (P * (0 + ((layerTailDegree m + 1 : ℕ) : ℝ) * P + 1)) := + mul_le_mul_of_nonneg_right hgrid (by positivity) + _ = _ := by ring + +theorem preparedModularGeneralDetector_principal_slots {P D : ℝ} + (hP : 0 ≤ P) (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) + (hDP : D ≤ P) (j : Fin m) (i : Fin (n j)) : + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B j i) : ℝ) + 1) ≤ + Real.exp (P + 8) := by + have hc : (Finset.card (layerIntegerPrincipalSlots (G := G) B j i) : ℝ) ≤ P := + (Nat.cast_le.mpr (Finset.card_le_univ _)).trans ((hdim.coefficients j).trans hDP) + have h8 : (8 : ℝ) ≤ Real.exp 8 := by linarith [Real.add_one_le_exp (8 : ℝ)] + calc + _ ≤ 8 * (P + 1) := by linarith + _ ≤ Real.exp 8 * Real.exp P := mul_le_mul h8 (Real.add_one_le_exp P) + (by linarith) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem preparedModularGeneralDetector_grid_slot_cap {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) (hDP : D ≤ P) : + let Qgrid := Real.toNNReal (8 * (D + 1)) + (∀ a : {a // allocatedGridAxis (I := I) U b S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U b S a).1 (allocatedGridIntegerAxis B U b S a).2) : ℝ) + 1) ≤ + (Qgrid : ℝ)) ∧ (Qgrid : ℝ) ≤ Real.exp (P + 8) := by + have hnonneg : 0 ≤ 8 * (D + 1) := by linarith [hdim.nonneg] + dsimp only + rw [Real.coe_toNNReal _ hnonneg] + constructor + · intro a + have hc := (Nat.cast_le.mpr (Finset.card_le_univ + (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U b S a).1 (allocatedGridIntegerAxis B U b S a).2))).trans + (hdim.coefficients (allocatedGridIntegerAxis B U b S a).1) + linarith + · have hP := hdim.nonneg.trans hDP + have h8 : (8 : ℝ) ≤ Real.exp 8 := by linarith [Real.add_one_le_exp (8 : ℝ)] + calc + _ ≤ 8 * (P + 1) := by linarith + _ ≤ Real.exp 8 * Real.exp P := + mul_le_mul h8 (Real.add_one_le_exp P) (by linarith) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem preparedModularGeneralDetector_ambient_count {P : ℝ} + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) : + ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ (m : ℝ) * P := by + rw [Nat.cast_sum] + calc + _ ≤ ∑ _j : Fin m, P := Finset.sum_le_sum (fun j _ => hJ j) + _ = _ := by simp + +theorem preparedModularGeneralDetector_physical_root {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) + (hDP : D ≤ P) (hS : (S.value : ℝ) ≤ Real.exp P) : + allocatedPhysicalRootBudget B U b S (fun _ => 0) ≤ Real.exp (2 * P + 8) := by + have hP : 0 ≤ P := hdim.nonneg.trans hDP + have hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ 2 * P := + (preparedModularGeneralDetector_variable_count B rowSets hdim).trans (by linarith) + have hvarsExp : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp (P + 8) := by + calc + _ ≤ 2 * P := hvars + _ ≤ Real.exp 8 * Real.exp P := mul_le_mul + (by linarith [Real.add_one_le_exp (8 : ℝ)]) + (by linarith [Real.add_one_le_exp P]) hP (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + rw [allocatedPhysicalRootBudget_zero] + calc + _ ≤ Real.exp (P + 8) * Real.exp P := + mul_le_mul hvarsExp hS (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem preparedModularGeneralDetector_site_radius {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) + (hDP : D ≤ P) : + 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp (2 * P ^ 2 + 8) := by + apply (allocatedRowSlicedSiteRadius_buffer_le_exp rowSets).trans + apply Real.exp_le_exp.mpr + simp only [Fintype.card_fin] + have hmP : (m : ℝ) ≤ P := hdim.degree.trans hDP + have hdP : (dim : ℝ) ≤ P := by simpa only [Fintype.card_fin] using hdim.cube.trans hDP + have hprod := mul_le_mul hmP hdP (Nat.cast_nonneg dim) (hdim.nonneg.trans hDP) + nlinarith only [hprod, hmP, hdP, sq_nonneg (P - 3 / 2)] + +theorem preparedModularGeneralDetector_source_numerics (C V : Fin m → ℝ≥0) {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) + (hDP : D ≤ P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) + (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) (hS : (S.value : ℝ) ≤ Real.exp P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp P) (hV : ∀ j, (V j : ℝ) ≤ Real.exp P) : + AllocatedSourceNumerics B U b S C V (2 * P + 8) := by + have hP : 0 ≤ P := hdim.nonneg.trans hDP + have hPQ : P ≤ 2 * P + 8 := by linarith + have hDQ := hDP.trans hPQ + have hExp : Real.exp P ≤ Real.exp (2 * P + 8) := Real.exp_le_exp.mpr hPQ + obtain ⟨hI, hn⟩ := preparedModularGeneralDetector_layer_axes B rowSets hdim + exact { + nonneg := by linarith + degree := hdim.degree.trans hDQ + variable_count := (preparedModularGeneralDetector_variable_count B rowSets hdim).trans (by linarith) + length := hS.trans hExp + radius_inv := fun j => (hRi j).trans hExp + width_inv := fun j => (hσi j).trans hExp + coefficients := fun j => (hdim.coefficients j).trans hDQ + real_axes := fun j => (hI j).trans hDQ + integer_axes := fun j => (hn j).trans hDQ + ambient_axes := fun j => (hJ j).trans hPQ + profile := hdim.profile.trans (hDQ.trans (by linarith [Real.add_one_le_exp (2 * P + 8)])) + chart := fun j => (hC j).trans hExp + covolume := fun j => (hV j).trans hExp + root := preparedModularGeneralDetector_physical_root B rowSets U b S hdim hDP hS } + +theorem preparedModularGeneralDetector_chart_sum (C : Fin m → ℝ≥0) {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) + (hDP : D ≤ P) (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp P) : + ((∑ j, C j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp (3 * P) := by + have hP : 0 ≤ P := hdim.nonneg.trans hDP + have hPexp : P ≤ Real.exp P := by linarith [Real.add_one_le_exp P] + have hmexp : (m : ℝ) ≤ Real.exp P := hdim.degree.trans (hDP.trans hPexp) + push_cast + calc + _ ≤ ∑ _j : Fin m, Real.exp P * P := by + apply Finset.sum_le_sum + intro j _ + exact mul_le_mul (hC j) (hJ j) (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = (m : ℝ) * (Real.exp P * P) := by simp + _ ≤ Real.exp P * (Real.exp P * Real.exp P) := mul_le_mul hmexp + (mul_le_mul_of_nonneg_left hPexp (Real.exp_nonneg _)) (by positivity) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + +theorem preparedModularGeneralDetector_inverse_normalizer (C V : Fin m → ℝ≥0) {P D : ℝ} + (hdim : AllocatedComparisonDimensions (G := G) B (Fin dim) rowTypes D) + (hDP : D ≤ P) (hR : ∀ j, 0 < R j) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) + (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) (hS : (S.value : ℝ) ≤ Real.exp P) + (hJ : ∀ j, (Fintype.card (J j) : ℝ) ≤ P) + (hC : ∀ j, (C j : ℝ) ≤ Real.exp P) (hV : ∀ j, (V j : ℝ) ≤ Real.exp P) + (hvolume : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ V j) : + ‖((allocatedProductIdealNormalizer B U b S rowSets : ℝ) : ℂ)⁻¹‖ ≤ + Real.exp ((m * (2 : ℝ) ^ dim) * (2 * P + 16) * (1 + 4 * (2 * P + 8))) := by + have hnum := preparedModularGeneralDetector_source_numerics B rowSets U b S C V + hdim hDP hRi hσi hS hJ hC hV + have h := allocatedProductIdealNormalizer_source_budget B U b S rowSets hR C V hnum hvolume + simpa only [Fintype.card_fin, add_assoc, show (8 : ℝ) + 8 = 16 by norm_num] using h + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorSpatialBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorSpatialBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..eddff382ae93c1641e45cb71d95e04fed61d6eaf --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularCanonicalDetectorSpatialBounds.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Estimates.NormalizedTupleParameterBounds + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators + +variable {m : ℕ} {G : Type*} [Fintype G] +variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} +variable (B : LayerSamplerAxis I n → Type*) [∀ b, Fintype (B b)] + +theorem preparedModularDetector_narrow_width {q Mk nX : ℕ} (selection : Fin q ↪ G) + {Pphysical coarseTarget : ℝ} (hp : 0 ≤ Pphysical) (htarget : 0 ≤ coarseTarget) + (hMk : (Mk : ℝ) ≤ Real.exp Pphysical) (hq : ((q + 1 : ℕ) : ℝ) ≤ Pphysical) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pphysical) + (hnX : (nX : ℝ) ≤ Pphysical) : + let R := spatialPrimitiveEnvelope Pphysical coarseTarget 0 + let ξLog := 2 * (R + spatialTupleToleranceLog R) + 4 + 0 ≤ ξLog ∧ + (normalizedTupleNarrowWidth (Fin nX) (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection Mk Pphysical coarseTarget)⁻¹ ≤ Real.exp ξLog := by + intro R ξLog + have hG := (Nat.cast_le.mpr (allocatedKernelVariables_card_le_variables (G := G) B)).trans hvars + have hN := (Nat.cast_le.mpr (allocatedPrincipalIndex_card_le_variables (G := G) B)).trans hvars + have hX : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical := by simpa only [Fintype.card_fin] using hnX + have hR : 0 ≤ R := (spatialPrimitiveEnvelope_bounds hp htarget (le_refl 0)).1 + have ht := spatialTupleToleranceLog_nonneg hR + refine ⟨by dsimp only [ξLog]; positivity, ?_⟩ + exact (normalizedTupleEarlyParameters_bound + (N := PrincipalTupleIndex B (layerSamplerDegree I n)) (X := Fin nX) + selection hp htarget (le_refl 0) hMk hq hG hN hX).2 + +theorem preparedModularDetector_physical_root_of_variables + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) + {P : ℝ} (_hP : 0 ≤ P) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ P) + (hS : (S.value : ℝ) ≤ Real.exp P) : + allocatedPhysicalRootBudget B U basis S (fun _ => 0) ≤ Real.exp (2 * P + 8) := by + have hvarsExp : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp P := + hvars.trans (by linarith [Real.add_one_le_exp P]) + rw [allocatedPhysicalRootBudget_zero] + calc + _ ≤ Real.exp P * Real.exp P := + mul_le_mul hvarsExp hS (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = Real.exp (2 * P) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + +theorem preparedModularDetector_projection_budget + {K : Type*} [Fintype K] {nX : ℕ} {P Pphysical ξLog W : ℝ} + (hP : 0 ≤ P) (hphysical : Pphysical ≤ P) (hξLog : ξLog ≤ P) + (hvars : (Fintype.card K : ℝ) ≤ P) (hnX : (nX : ℝ) ≤ P) + (hroot : W ≤ Real.exp (2 * P + 8)) : + let Pproj := 4 * (P + 8) ^ 2 + 0 ≤ Pproj ∧ P ≤ Pproj ∧ Pphysical ≤ Pproj ∧ ξLog ≤ Pproj ∧ + 2 * P + 8 ≤ Pproj ∧ (Fintype.card (Option K × Fin nX) : ℝ) ≤ Pproj ∧ + W ≤ Real.exp Pproj := by + intro Pproj + have hPQ : P ≤ Pproj := by dsimp only [Pproj]; nlinarith [sq_nonneg P] + have hrootQ : 2 * P + 8 ≤ Pproj := by dsimp only [Pproj]; nlinarith [sq_nonneg P] + have hcard : (Fintype.card (Option K × Fin nX) : ℝ) ≤ (P + 1) * P := by + simp only [Fintype.card_prod, Fintype.card_option, Fintype.card_fin, + Nat.cast_mul, Nat.cast_add, Nat.cast_one] + exact mul_le_mul (add_le_add hvars (le_refl 1)) hnX (Nat.cast_nonneg _) (by linarith) + have hprod : (P + 1) * P ≤ Pproj := by dsimp only [Pproj]; nlinarith [sq_nonneg P] + exact ⟨hP.trans hPQ, hPQ, hphysical.trans hPQ, hξLog.trans hPQ, + hrootQ, hcard.trans hprod, hroot.trans (Real.exp_le_exp.mpr hrootQ)⟩ + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularGeneralDetectorFreeSpatialBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularGeneralDetectorFreeSpatialBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7ccfa238d7ea1d678677d4e9536c07fb52f4657 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularGeneralDetectorFreeSpatialBounds.lean @@ -0,0 +1,79 @@ +import OAI.Combinatorics.Progressions.Sampling.PreparedModularGeneralDetectorSamplingBounds + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +structure PreparedModularGeneralDetectorFreeSpatialBounds + (r : PreparedModularCanonicalDetectorResources ℝ) (τ : ℝ) : Prop where + tau_pos : 0 < τ + tau_sample : 1 / τ ≤ Real.exp r.Psample + tau_mass : 1 / τ ≤ Real.exp r.Pmass + tau_projection : τ⁻¹ ≤ Real.exp r.Pproj + tau_native : τ⁻¹ ≤ Real.exp r.Pnative + tau_side : τ⁻¹ ≤ Real.exp r.Pside + +theorem PreparedModularGeneralDetectorSamplingBounds.free_spatial + {m dim nX : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] + {T : Type*} [Fintype T] {stride : Fin nX → ℕ} + {r : PreparedModularCanonicalDetectorResources ℝ} + {P L target Pphysical Qstride Pk τ : ℝ} + (sampling : PreparedModularGeneralDetectorSamplingBounds + (dim := dim) (J := J) (T := T) stride r P L target Pphysical Qstride Pk) + (hτ : 0 < τ) (hτinv : τ⁻¹ ≤ Real.exp Pphysical) + (hnative : Pphysical ≤ r.Pnative) : + PreparedModularGeneralDetectorFreeSpatialBounds r τ := by + have hsample : Real.exp Pphysical ≤ Real.exp r.Psample := by + simpa only [one_div, Real.exp_neg, inv_inv] using sampling.tau_sample + have hmass : Real.exp Pphysical ≤ Real.exp r.Pmass := by + simpa only [one_div, Real.exp_neg, inv_inv] using sampling.tau_mass + have hprojection : Real.exp Pphysical ≤ Real.exp r.Pproj := by + simpa only [Real.exp_neg, inv_inv] using sampling.tau_projection + exact { + tau_pos := hτ + tau_sample := by simpa only [one_div] using hτinv.trans hsample + tau_mass := by simpa only [one_div] using hτinv.trans hmass + tau_projection := hτinv.trans hprojection + tau_native := hτinv.trans (Real.exp_le_exp.mpr hnative) + tau_side := hτinv.trans (Real.exp_le_exp.mpr sampling.physical_side) } + +theorem preparedModularGeneralDetector_free_spatial_bounds + (K : PreparedModularCanonicalDetectorResourceConstants) (dim : ℕ) + {P L Pphysical τ : ℝ} (hP : 0 ≤ P) (hPL : P ≤ L) + (hAsample : 2 ≤ K.Asample) (hphysical : Pphysical ≤ P) + (hτ : 0 < τ) (hτinv : τ⁻¹ ≤ Real.exp Pphysical) : + PreparedModularGeneralDetectorFreeSpatialBounds + (preparedModularGeneralDetectorResources K dim P L) τ := by + let r := preparedModularGeneralDetectorResources K dim P L + obtain ⟨_, _, hPnative, _, _, _, hprojSample, _, hLSide, _⟩ := + preparedModularGeneralDetectorResources_primitive_domination K dim hP hPL + have hL : 0 ≤ L := hP.trans hPL + have hproj : r.Pproj = 4 * (L + 8)^2 := rfl + have hproj1 : 1 ≤ r.Pproj := by nlinarith only [hproj, hL, sq_nonneg L] + have hPproj : P ≤ r.Pproj := by nlinarith only [hproj, hL, hPL, sq_nonneg L] + have hprojMass : r.Pproj ≤ r.Pmass := by + change r.Pproj ≤ (r.Pproj + K.Asample)^K.Asample + have hAs : (0 : ℝ) ≤ K.Asample := Nat.cast_nonneg _ + have hsq : r.Pproj ≤ r.Pproj^2 := by nlinarith only [hproj1] + exact hsq.trans ((pow_le_pow_left₀ (by linarith only [hproj1]) + (le_add_of_nonneg_right hAs) 2).trans + (pow_le_pow_right₀ (by linarith only [hproj1, hAs]) hAsample)) + have hprojection : τ⁻¹ ≤ Real.exp r.Pproj := + hτinv.trans (Real.exp_le_exp.mpr (hphysical.trans hPproj)) + exact { + tau_pos := hτ + tau_sample := by simpa only [one_div] using + hprojection.trans (Real.exp_le_exp.mpr hprojSample) + tau_mass := by simpa only [one_div] using + hprojection.trans (Real.exp_le_exp.mpr hprojMass) + tau_projection := hprojection + tau_native := hτinv.trans (Real.exp_le_exp.mpr (hphysical.trans hPnative)) + tau_side := hτinv.trans (Real.exp_le_exp.mpr (hphysical.trans (hPL.trans hLSide))) } + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularGeneralProductivityFreeSpatialBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularGeneralProductivityFreeSpatialBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..e03643cf4aab7f8ecbe443ec636180639859a952 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedModularGeneralProductivityFreeSpatialBounds.lean @@ -0,0 +1,149 @@ +import OAI.Combinatorics.Progressions.Estimates.PreparedModularGeneralDetectorProductive + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open Module Submodule MeasureTheory BooleanCubeKernel +open scoped BigOperators Classical NNReal + +variable {m s : ℕ} {G : Type} [Fintype G] [DecidableEq 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, Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ) + +theorem preparedModularGeneral_productivity_early_spatial_bounds + (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) + (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) + [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] + [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] + (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) + [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] + (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) + [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) (hσ1 : ∀ j, σ j ≤ 1) + (C V : Fin m → ℝ≥0) + (hC : ∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ C j * ‖z‖) + (hV : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ V j) + (Cinv : Fin m → ℝ) (hCinv : ∀ j, 0 ≤ Cinv j) + (hchart : ∀ j z, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm z‖ ≤ Cinv j * ‖z‖) + (hsmall : ∀ j, Cinv j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) + {Pmaster Plate Pprod D : ℝ} (hMaster : 0 ≤ Pmaster) (hLate : Pmaster ≤ Plate) + (hProd : 4 * (Plate + 8) ^ 2 ≤ Pprod) + (hd : AllocatedComparisonDimensions (G := G) B (Fin (s + 1)) + (fun j : Fin m => (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1) : Type)) D) + (hD : D ≤ Pmaster) {nX : ℕ} (hnXpos : 0 < nX) (hnX : (nX : ℝ) ≤ Pmaster) + (hRP : ∀ j, (R j)⁻¹ ≤ Real.exp Pmaster) + (hσLate : ∀ j, (σ j)⁻¹ ≤ Real.exp Plate) + (hLLate : (S.value : ℝ) ≤ Real.exp Plate) + (hCP : ∀ j, (C j : ℝ) ≤ Real.exp Pmaster) + (hVP : ∀ j, (V j : ℝ) ≤ Real.exp Pmaster) + (p : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (hp : ∀ j, DegreeLE (1 : Fin nX → ℕ) (j.val + 1) (p j)) + (hm : ∀ j d, coefficients (p j) d ∈ U j) + (stride : Fin nX → ℕ) (hs : ∀ d, 0 < stride d) + (hsP : ∀ d, (stride d : ℝ) ≤ Real.exp Pmaster) + {gainLog ξ : ℝ} (hg : 0 ≤ gainLog) + (hGainMaster : gainLog + (nX : ℝ) + 8 ≤ Pmaster) + (hξ : 0 < ξ) (hξ1 : ξ ≤ 1) (hξLate : ξ⁻¹ ≤ Real.exp Plate) + (N : Fin nX → ℕ) {rank : ℝ} + (hrank : ∀ j, HasLayerSamplingRank (j.val + 1) (fun d => (N d : ℝ)) rank (U j) (p j)) + (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (hCells : cells.Nonempty) : + (∀ d, Real.exp ((Pprod + preparedModularGeneralProductivityExponent m) ^ + preparedModularGeneralProductivityExponent m) ≤ (N d : ℝ)) → + Real.exp ((Pprod + preparedModularGeneralProductivityExponent m) ^ + preparedModularGeneralProductivityExponent m) ≤ rank → + let τ := Real.exp (-(gainLog + (nX : ℝ) + 8)) + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + let widths := narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let density := allocatedCenteredJointDensity B U basis hb o hR hσ S p hm + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + ∃ (hN : ∀ i, 0 < N i) (hwidths : ∀ z, 0 < widths z) + (hmargin : ∀ i, 2 * spatialTrimMargin τ N i < N i) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells widths z) + (hD : ∀ center, 0 < selectedJointDensityMass bases stride cells widths (density center)), + let law := fun center => selectedJointFiniteLaw bases + (trimmedIntegerBox_nonempty N _ hmargin) stride cells widths hwidths hmass + (density center) (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S p hm center) + (hD center) + (∀ center, + let Z := selectedJointDensityMass bases stride cells widths (density center) + |Z - 1| ≤ Real.exp (-Pprod) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ Z⁻¹ ≤ 2) ∧ + (∀ (center : CoefficientTorus (K := LayerSamplerVariables G I n B) U) + (c : ∀ j, U j), + coefficientConstantCenter U center = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun a => c a.1))) → + ∃ htotal : 0 < selectedJointDensityMass bases stride cells widths + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) + (fun j => subtractConstant (c j).val (p j)) + (fun j => coefficients_subtractConstant_mem (U j) (c j) (p j) (hm j))), + allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) + (fun j => subtractConstant (c j).val (p j)) + (fun j => coefficients_subtractConstant_mem (U j) (c j) (p j) (hm j)) + N hN (allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0)) + (Real.exp_pos _) hξ stride cells hmass bases + (trimmedIntegerBox_nonempty N _ hmargin) htotal = law center) ∧ + ∀ (test : (Fin nX → ℝ) → ℝ), (∀ x, |test x| ≤ 1) → + ∀ gain : ℝ, Real.exp (-gainLog) ≤ gain → + gain ≤ (𝔼 x ∈ integerBox N, test (fun i => (x i : ℝ))) → + let productive := Finset.univ.filter (fun z : bases × rectangularWeightIndices 0 widths 1 => + Function.Injective (fun q : Sites => jointIntegerPhysicalSite q.val (z.1.val,z.2.val)) ∧ + gain / 2 ≤ 𝔼 q : Sites, test + (fun i => (jointIntegerPhysicalSite q.val (z.1.val,z.2.val) i : ℝ))) + let joint := centeredFiniteProbabilityMeasure μ law + IsProbabilityMeasure joint ∧ + MeasurableSet {z : CoefficientTorus (K := LayerSamplerVariables G I n B) U × + (bases × rectangularWeightIndices 0 widths 1) | z.2 ∈ productive} ∧ + gain / 4 ≤ joint.real {z | z.2 ∈ productive} ∧ + (∀ᵐ z ∂joint, ∃ c : ∀ j, U j, + coefficientConstantCenter U z.1 = + -(QuotientAddGroup.mk' (coefficientIntegerLattice U) + (constantCoefficientArray U (fun s => c s.1))) ∧ + allocatedAffineDensity B U basis hb o hR hσ S p hm c + (fun k v => (jointIntegerFrame (z.2.1.val,z.2.2.val) k v : ℝ)) ≠ 0) ∧ + ∀ z : bases × rectangularWeightIndices 0 widths 1, ∀ q : Sites, + jointIntegerPhysicalSite q.val (z.1.val,z.2.val) ∈ integerBox N := by + intro hSize hRank τ W widths bases density sides Sites + obtain ⟨hPτ, hτ, hτhalf, hτdim, hτeq, hτcap, hprecision⟩ := + preparedEarlySpatialWidth nX hg + have hτP : τ⁻¹ ≤ Real.exp Pmaster := hτcap Pmaster hGainMaster + have hPlate : 0 ≤ Plate := hMaster.trans hLate + have hGainProd : gainLog + 8 ≤ Pprod := by + have hnX0 : (0 : ℝ) ≤ nX := Nat.cast_nonneg _ + nlinarith only [hGainMaster, hLate, hProd, hPlate, hnX0, sq_nonneg Plate] + obtain ⟨hN, hwidths, hmargin, hmass, hDens, hnormal, htests⟩ := + preparedModularGeneral_productivity_bounds B U basis S hb o μ ν hR hσ hσ1 + C V hC hV Cinv hCinv hchart hsmall hMaster hLate hProd hd hD hnXpos hnX + hRP hσLate hLLate hCP hVP p hp hm stride hs hsP + hτ hτP hτhalf hξ hξ1 hξLate N hrank cells hCells hSize hRank + refine ⟨hN, hwidths, hmargin, hmass, hDens, ?_⟩ + intro law + refine ⟨hnormal, ?_, ?_⟩ + · intro center c hc + exact preparedModularGeneralCenteredLaw B U basis hb o hR hσ S p hm N hN + (allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0)) hτ hξ + stride cells hmass bases (trimmedIntegerBox_nonempty N _ hmargin) + center c hc (hDens center) + · intro test htest gain hgain hscore + obtain ⟨hcollision, herr⟩ := hprecision Pprod gain hGainProd hgain + exact htests test htest gain ((Real.exp_pos _).trans_le hgain) hcollision herr hscore + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedScalarSpatialWidthPower.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedScalarSpatialWidthPower.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5b3ba469d6365a0b9706bcbf620059e7991d458 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedScalarSpatialWidthPower.lean @@ -0,0 +1,73 @@ +import OAI.Combinatorics.Progressions.Estimates.CanonicalEmptyLayerGeometry +import OAI.Combinatorics.Progressions.Estimates.IndexedComparableScalarGeometryData + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +theorem exists_preparedScalarSpatialWidthPower (s latePower : ℕ) : + ∃ widthExponent : ℕ, 2 ≤ widthExponent ∧ + ∀ p : ℝ, 2 ≤ p → ∀ nX : ℕ, (nX : ℝ) ≤ p → + ∀ S : ℕ, (S : ℝ) ≤ Real.exp ((p + 2) ^ latePower) → + unconditionedSpatialWidthCutoff ((scalarNativeDimension s : ℝ) * S) + (unconditionedSpatialTrimFraction nX (Real.exp (-p))) 1 ≤ + Real.exp ((p + 2) ^ widthExponent) := by + obtain ⟨c, hc⟩ := exists_nat_ge (probabilityProfileLipschitz : ℝ) + let Q : Polynomial ℕ := Polynomial.C (scalarNativeDimension s) + + (Polynomial.X + 2) ^ latePower + + 2 * (2 * Polynomial.X + 33 + Polynomial.C c) + 16 + obtain ⟨widthExponent, hwidthExponent, hbudget⟩ := + exists_natPolynomial_fixed_power_budget Q + refine ⟨widthExponent, hwidthExponent, ?_⟩ + intro p hp nX hnX S hS + let t := (p + 2) ^ latePower + let P : ℝ := 2 * p + 33 + c + have hp0 : 0 ≤ p := by linarith + have ht : 0 ≤ t := by dsimp only [t]; positivity + have hP : 0 ≤ P := by dsimp only [P]; positivity + have hdim : (scalarNativeDimension s : ℝ) ≤ + Real.exp (scalarNativeDimension s : ℝ) := + le_trans (by linarith) (Real.add_one_le_exp _) + have hW : (scalarNativeDimension s : ℝ) * S ≤ + Real.exp ((scalarNativeDimension s : ℝ) + t) := by + calc + _ ≤ Real.exp (scalarNativeDimension s : ℝ) * Real.exp t := + mul_le_mul hdim hS (Nat.cast_nonneg _) (Real.exp_pos _).le + _ = _ := (Real.exp_add _ _).symm + have hτ : 0 < unconditionedSpatialTrimFraction nX (Real.exp (-p)) := by + unfold unconditionedSpatialTrimFraction + positivity + have hτP : (unconditionedSpatialTrimFraction nX (Real.exp (-p)))⁻¹ ≤ + Real.exp P := by + have h32 : (32 : ℝ) ≤ Real.exp 32 := by + linarith [Real.add_one_le_exp (32 : ℝ)] + have hnExp : (nX : ℝ) + 1 ≤ Real.exp (p + 1) := by + linarith [Real.add_one_le_exp (p + 1)] + calc + _ = 32 * ((nX : ℝ) + 1) * Real.exp p := by + simp [unconditionedSpatialTrimFraction, Real.exp_neg] + _ ≤ Real.exp 32 * Real.exp (p + 1) * Real.exp p := by gcongr + _ = Real.exp (2 * p + 33) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ Real.exp P := Real.exp_le_exp.mpr + (by dsimp only [P]; linarith [Nat.cast_nonneg (α := ℝ) c]) + have hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P := by + have hcExp : (c : ℝ) ≤ Real.exp c := + le_trans (by linarith) (Real.add_one_le_exp _) + exact (hc.trans hcExp).trans + (Real.exp_le_exp.mpr (by dsimp only [P]; linarith)) + apply (unconditionedSpatialWidthCutoff_le_exp hP + (show 0 ≤ (scalarNativeDimension s : ℝ) + t by positivity) + hW hτ hτP hprofile).trans + apply Real.exp_le_exp.mpr + simpa [Q, P, t, Polynomial.eval₂_pow] using hbudget p hp0 + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PreparedSpatialWitnessWidth.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedSpatialWitnessWidth.lean new file mode 100644 index 0000000000000000000000000000000000000000..26c851703fedc68bed5bcf50bc881a5c1386a49a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PreparedSpatialWitnessWidth.lean @@ -0,0 +1,73 @@ +import OAI.Combinatorics.Progressions.Dynamics.PhysicalBadProductErrorBudget + +namespace OAI + +section + +namespace Erdos3 + +private theorem witness_width_power_lower {P : ℝ} (hP : 0 ≤ P) {C : ℕ} (hC : 2 ≤ C) : + 4 * P + 3 ≤ (P + C) ^ C := by + have hC' : (2 : ℝ) ≤ C := by exact_mod_cast hC + have hbase : 1 ≤ P + C := by linarith + calc + _ ≤ (P + 2) ^ 2 := by nlinarith [sq_nonneg P] + _ ≤ (P + C) ^ 2 := pow_le_pow_left₀ (by positivity) (by linarith) _ + _ ≤ _ := pow_le_pow_right₀ hbase hC + +private theorem eight_le_exp_three : (8 : ℝ) ≤ Real.exp 3 := by + have h1 : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + have h3 := pow_le_pow_left₀ (by norm_num : (0 : ℝ) ≤ 2) h1 3 + have he : Real.exp (3 : ℝ) = Real.exp (1 : ℝ) ^ 3 := by + simp + rw [he] + norm_num at h3 ⊢ + exact h3 + +theorem spatial_witness_width_of_exp_size + {P ρ H V d W : ℝ} {C : ℕ} (hP : 0 ≤ P) (hC : 2 ≤ C) + (hρ : 0 < ρ) (hρinv : 1 / ρ ≤ Real.exp P) + (hH : Real.exp ((P + C) ^ C) ≤ H) (hV : ρ * H ≤ V) + (hd : 0 < d) (hdexp : d ≤ Real.exp P) + (hLip : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hW : 0 ≤ W) (hWexp : W ≤ Real.exp P) : + 8 * (probabilityProfileLipschitz : ℝ) * W ≤ V / d := by + have hquot : (8 * (probabilityProfileLipschitz : ℝ) * W * d) / ρ ≤ H := by + calc + _ = 8 * (probabilityProfileLipschitz : ℝ) * W * d * (1 / ρ) := by ring + _ ≤ 8 * Real.exp P * Real.exp P * Real.exp P * Real.exp P := by + gcongr + _ = 8 * Real.exp (4 * P) := by + have he : Real.exp (4 * P) = Real.exp P ^ 4 := by + simpa using Real.exp_nat_mul P 4 + rw [he] + ring + _ ≤ Real.exp 3 * Real.exp (4 * P) := + mul_le_mul_of_nonneg_right eight_le_exp_three (Real.exp_nonneg _) + _ = Real.exp (4 * P + 3) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ Real.exp ((P + C) ^ C) := Real.exp_le_exp.mpr (witness_width_power_lower hP hC) + _ ≤ H := hH + apply (le_div_iff₀ hd).mpr + calc + _ ≤ H * ρ := (div_le_iff₀ hρ).mp hquot + _ = ρ * H := mul_comm _ _ + _ ≤ V := hV + +theorem residueProfileWidth_witness_floor_of_exp_size {K X : Type*} + (stride : X → ℕ) (hstride : ∀ x, 0 < stride x) (V : K × X → ℝ) + {P ρ H W : ℝ} {C : ℕ} (hP : 0 ≤ P) (hC : 2 ≤ C) + (hρ : 0 < ρ) (hρinv : 1 / ρ ≤ Real.exp P) + (hH : Real.exp ((P + C) ^ C) ≤ H) (hV : ∀ z, ρ * H ≤ V z) + (hstrideExp : ∀ x, (stride x : ℝ) ≤ Real.exp P) + (hLip : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hW : 0 ≤ W) (hWexp : W ≤ Real.exp P) : + ∀ z, 8 * (probabilityProfileLipschitz : ℝ) * W ≤ residueProfileWidth stride V z := by + intro z + exact spatial_witness_width_of_exp_size hP hC hρ hρinv hH (hV z) + (by exact_mod_cast hstride z.2) (hstrideExp z.2) hLip hW hWexp + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCoefficientPositiveSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCoefficientPositiveSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..db199d1c198a3b4df2dfeddb0afa0b1dd0384864 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCoefficientPositiveSupport.lean @@ -0,0 +1,56 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedScalarLogBounds + +namespace OAI + +section + +namespace Erdos3 + +theorem principalNormalizedSource_positive_support {K T γ : ℝ} + (hK : 0 < K) (hT : 0 < T) (hγ : 0 < γ) + (hlarge : 8 * (probabilityProfileLipschitz : ℝ) ≤ (γ / 2) * (K / T)) + (z : IntegerScalarCubeBox Empty (principalNormalizedSource hK hT hγ hlarge).length) + (hz : (principalNormalizedSource hK hT hγ hlarge).source.weight z ≠ 0) : + ((principalNormalizedSource hK hT hγ hlarge).length : ℝ) / 4 ≤ (z none : ℝ) := by + have hsupport : z ∈ (principalNormalizedSource hK hT hγ hlarge).source.toPMF.support := by + intro hzero + apply hz + rw [← FiniteProbabilityWeights.toPMF_toReal, hzero] + rfl + have hmap : (z none : ℤ) ∈ + ((principalNormalizedSource hK hT hγ hlarge).source.toPMF.map + (fun x => (x none : ℤ))).support := + (PMF.mem_support_map_iff _ _ _).mpr ⟨z, hsupport, rfl⟩ + rw [principalNormalizedSource_law] at hmap + have hb := (principalIntegerPMF_support hK hT hγ hlarge hmap).1 + have he : T * (z none : ℝ) / K = (z none : ℝ) / (K / T) := by field_simp + rw [he] at hb + have hlo := (lt_div_iff₀ (div_pos hK hT)).mp hb + have hlength := (principalIntervalLength_bounds hK hT hγ hlarge).2 + change (principalIntervalLength K T γ : ℝ) / 4 ≤ _ + linarith + +namespace VectorPolynomial + +theorem allocatedPrincipalNormalizedSource_positive_support {m : ℕ} {G : Type*} [Fintype G] + {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ} + (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] + {J : Fin m → Type*} [∀ j, Fintype (J j)] + (U : ∀ j, Submodule ℝ (J j → ℝ)) + (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) + {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) + (S : LayerSamplerScale (G := G) B U basis R σ) (j : Fin m) (i : Fin (n j)) + (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i) + (z : IntegerScalarCubeBox Empty (allocatedPrincipalNormalizedSource B U basis hR S j i hactive).length) + (hz : (allocatedPrincipalNormalizedSource B U basis hR S j i hactive).source.weight z ≠ 0) : + ((allocatedPrincipalNormalizedSource B U basis hR S j i hactive).length : ℝ) / 4 ≤ + (z none : ℝ) := + principalNormalizedSource_positive_support _ _ _ _ z hz + +end VectorPolynomial + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCoordinatePartition.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCoordinatePartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5712745f52b33a376f5c1548f16dff9655e8766 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCoordinatePartition.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedEnormousProfiles + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators +variable {D α : Type*} {B : D → Type*} {h : D → ℕ} +variable [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] +variable [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] + +theorem principalCoordinateWeights_partition_weight (P : D → Prop) [DecidablePred P] + (L : PrincipalTupleIndex B h → ℕ) (p : ∀ j, FiniteProbabilityWeights (IntegerScalarCubeBox α (L j))) (y : PrincipalIntegerTuples B h α L) : + (FiniteProbabilityWeights.pi p).weight y = + (FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex (fun d : {d // P d} => B d.val) (fun d => h d.val) => p ⟨j.1.val,j.2⟩)).weight (principalAxisRestrict P y) * + (FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex (fun d : {d // ¬P d} => B d.val) (fun d => h d.val) => p ⟨j.1.val,j.2⟩)).weight + (principalAxisRestrict (fun d => ¬P d) y) := by + simp only [FiniteProbabilityWeights.pi, principalAxisRestrict, Fintype.prod_sigma] + exact (Fintype.prod_subtype_mul_prod_subtype P + (fun d => ∏ j : B d × Fin (h d), + (p ⟨d,j⟩).weight (y ⟨d, j⟩))).symm + +theorem principalCoordinateWeights_partition (P : D → Prop) [DecidablePred P] + (L : PrincipalTupleIndex B h → ℕ) (p : ∀ j, FiniteProbabilityWeights (IntegerScalarCubeBox α (L j))) (f : PrincipalIntegerTuples B h α L → ℂ) : + (FiniteProbabilityWeights.pi p).complexMean f = + (FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex (fun d : {d // P d} => B d.val) (fun d => h d.val) => p ⟨j.1.val,j.2⟩)).complexMean (fun u => + (FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex (fun d : {d // ¬P d} => B d.val) (fun d => h d.val) => p ⟨j.1.val,j.2⟩)).complexMean + (fun v => f (principalAxisJoin P u v))) := by + let pL := FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex + (fun d : {d // P d} => B d.val) (fun d => h d.val) => p ⟨j.1.val,j.2⟩) + let pR := FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex + (fun d : {d // ¬P d} => B d.val) (fun d => h d.val) => p ⟨j.1.val,j.2⟩) + calc + _ = ∑ z : PrincipalAxisTuples (α := α) P L × PrincipalAxisTuples (α := α) (fun d => ¬P d) L, + ((pL.weight z.1 * pR.weight z.2 : ℝ) : ℂ) * f (principalAxisJoin P z.1 z.2) := by + apply Fintype.sum_equiv (principalAxisPartitionEquiv P L) + intro y + simp only [principalAxisPartitionEquiv, Equiv.coe_fn_mk, principalAxisJoin_restrict] + rw [principalCoordinateWeights_partition_weight P L p y] + _ = _ := by + simp only [FiniteProbabilityWeights.complexMean, Fintype.sum_prod_type, + Complex.ofReal_mul, Finset.mul_sum, mul_assoc, pL, pR] + rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCubeSupportedCell.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCubeSupportedCell.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fc2bda129cf5b175862265136e258ecc5919187 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalCubeSupportedCell.lean @@ -0,0 +1,307 @@ +import OAI.Combinatorics.Progressions.Lattices.ContainedFullIntervalResidueIdentity +import OAI.Combinatorics.Progressions.Linear.ContainedSupportedProgressionKernels + +namespace OAI + +section + +namespace Erdos3 +open scoped Classical + +variable {D α : Type*} [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] +variable (B : D → Type*) [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] (h : D → ℕ) +variable (L H step : PrincipalTupleIndex B h → ℕ) (c : PrincipalTupleIndex B h → ℤ) +variable (hL : ∀ j, 0 < L j) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (L j : ℤ)) +variable (q : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B h → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B h H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (P : D → Prop) [DecidablePred P] + +local notation "BP" => (fun a : {a // P a} => B (Subtype.val a)) +local notation "hP" => (fun a : {a // P a} => h (Subtype.val a)) +local notation "embed" => (fun j : PrincipalTupleIndex BP hP => (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j) : PrincipalTupleIndex B h)) +local notation "rP" => (fun j : PrincipalTupleIndex BP hP => r (embed j)) +local notation "hHP" => (fun j : PrincipalTupleIndex BP hP => hH (embed j)) +local notation "conditioned" => FiniteProbabilityWeights.condition (principalTupleWeights B h H hH) + (Finset.univ.filter (fun y => principalResidueLabel q y = r)) hcell + +include hq in +theorem principalSupportedResidue_restrict + (hsize : ∀ j : PrincipalTupleIndex BP hP, (Fintype.card α + 1) * q ≤ H (embed j)) : + (conditioned).toPMF.map (principalAxisRestrict P) = + (principalResidueWeights BP hP (principalAxisLength P H) hHP q hq rP hsize).toPMF := by + have hinj : Function.Injective embed := by + intro a b hab + rcases a with ⟨⟨a, ha⟩, av⟩ + rcases b with ⟨⟨b, hb⟩, bv⟩ + cases hab + rfl + have hm := FiniteProbabilityWeights.pi_condition_positive_fiber_marginal + (fun j => integerScalarCubeWeights α (H j) (hH j)) + (fun j (z : IntegerScalarCubeBox α (H j)) a => ((z a : ℤ) : ZMod q)) r hcell embed hinj + have hres := principalResidueWeights_eq_condition BP hP (principalAxisLength P H) hHP q hq rP hsize + have hcond := principalSupportedResidueWeights_eq_pi BP hP (principalAxisLength P H) hHP q rP + (principalResidueCell_mass_pos BP hP (principalAxisLength P H) hHP q hq rP hsize) + have hpmf := congrArg (fun p : FiniteProbabilityWeights + (PrincipalIntegerTuples BP hP α (principalAxisLength P H)) => p.toPMF) (hres.trans hcond) + have hpi := FiniteProbabilityWeights.toPMF_pi (principalSupportedCoordinateWeights BP hP + (principalAxisLength P H) hHP q rP (principalResidueCell_mass_pos BP hP (principalAxisLength P H) hHP q hq rP hsize)) + exact hm.trans (hpmf.trans hpi).symm + +include hq in +theorem containedSupportedProgressionLaw_restrict + (hsize : ∀ j : PrincipalTupleIndex BP hP, (Fintype.card α + 1) * q ≤ H (embed j)) : + (containedSupportedProgressionLaw B h L H step c hL hH hsubset q r hcell).toPMF.map + (principalAxisRestrict P) = + (containedProgressionResidueLaw BP hP (principalAxisLength P L) (principalAxisLength P H) + (principalAxisLength P step) (fun j => c (embed j)) (fun j => hL (embed j)) hHP + (fun j => hsubset (embed j)) q hq rP hsize).toPMF := by + have hm := congrArg (fun p => p.map (containedProgressionTupleMap BP hP + (principalAxisLength P L) (principalAxisLength P H) (principalAxisLength P step) + (fun j => c (embed j)) (fun j => hL (embed j)) (fun j => hsubset (embed j)))) + (principalSupportedResidue_restrict B h H hH q hq r hcell P hsize) + rw [PMF.map_comp] at hm + simp only [containedSupportedProgressionLaw, containedProgressionResidueLaw, + FiniteProbabilityWeights.toPMF_fiberLaw, PMF.map_comp] + refine Eq.trans ?_ hm + apply congrArg (fun f : PrincipalIntegerTuples B h α H → PrincipalAxisTuples (α := α) P L => + (conditioned).toPMF.map f) + funext y j + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped Classical BigOperators + +variable {D α : Type*} [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] +variable (B : D → Type*) [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] (h : D → ℕ) +variable (L H step : PrincipalTupleIndex B h → ℕ) (c : PrincipalTupleIndex B h → ℤ) +variable (hL : ∀ j, 0 < L j) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (L j : ℤ)) +variable (q : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B h → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B h H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (P : D → Prop) [DecidablePred P] + +local notation "BP" => (fun a : {a // P a} => B (Subtype.val a)) +local notation "hP" => (fun a : {a // P a} => h (Subtype.val a)) +local notation "embed" => (fun j : PrincipalTupleIndex BP hP => (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j) : PrincipalTupleIndex B h)) +local notation "rP" => (fun j : PrincipalTupleIndex BP hP => r (embed j)) +local notation "hHP" => (fun j : PrincipalTupleIndex BP hP => hH (embed j)) +local notation "conditioned" => FiniteProbabilityWeights.condition (principalTupleWeights B h H hH) + (Finset.univ.filter (fun y => principalResidueLabel q y = r)) hcell + +noncomputable def containedSupportedProgressionAxisLaw : + FiniteProbabilityWeights (PrincipalAxisTuples (α := α) P L) := + (FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex BP hP => + principalSupportedCoordinateWeights B h H hH q r hcell (embed j))).fiberLaw + (containedProgressionTupleMap BP hP (principalAxisLength P L) (principalAxisLength P H) + (principalAxisLength P step) (fun j => c (embed j)) (fun j => hL (embed j)) (fun j => hsubset (embed j))) + +theorem containedSupportedProgressionLaw_partition (f : PrincipalIntegerTuples B h α L → ℂ) : + (containedSupportedProgressionLaw B h L H step c hL hH hsubset q r hcell).complexMean f = + (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).complexMean (fun u => + (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell (fun a => ¬P a)).complexMean + (fun v => f (principalAxisJoin P u v))) := by + let w := principalSupportedCoordinateWeights B h H hH q r hcell + let map := containedProgressionTupleMap (α := α) B h L H step c hL hsubset + let wL := FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex BP hP => w (embed j)) + let wR := FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex + (fun a : {a // ¬P a} => B a.val) (fun a => h a.val) => w ⟨j.1.val,j.2⟩) + let mapL := containedProgressionTupleMap (α := α) BP hP (principalAxisLength P L) (principalAxisLength P H) + (principalAxisLength P step) (fun j => c (embed j)) (fun j => hL (embed j)) (fun j => hsubset (embed j)) + let mapR := containedProgressionTupleMap (α := α) (fun a : {a // ¬P a} => B a.val) (fun a => h a.val) + (principalAxisLength (fun a => ¬P a) L) (principalAxisLength (fun a => ¬P a) H) + (principalAxisLength (fun a => ¬P a) step) (fun j => c ⟨j.1.val,j.2⟩) + (fun j => hL ⟨j.1.val,j.2⟩) (fun j => hsubset ⟨j.1.val,j.2⟩) + have hjoin (u : PrincipalAxisTuples (α := α) P H) (v : PrincipalAxisTuples (α := α) (fun a => ¬P a) H) : + map (principalAxisJoin P u v) = principalAxisJoin P (mapL u) (mapR v) := by + funext j + rcases j with ⟨a, bv⟩ + by_cases ha : P a <;> + simp only [map, mapL, mapR, containedProgressionTupleMap, principalAxisJoin, ha, ↓reduceDIte] <;> rfl + have hpart := principalCoordinateWeights_partition P H w (fun y => f (map y)) + have hpart' := hpart.trans (congrArg (fun g => wL.complexMean g) (funext (fun u => + congrArg (fun g => wR.complexMean g) (funext (fun v => congrArg f (hjoin u v)))))) + have hleft := (conditioned).fiberLaw_complexMean map f + have hright := wL.fiberLaw_complexMean mapL (fun u => + (wR.fiberLaw mapR).complexMean (fun v => f (principalAxisJoin P u v))) + have hinner (u : PrincipalAxisTuples (α := α) P L) := + wR.fiberLaw_complexMean mapR (fun v => f (principalAxisJoin P u v)) + have hright' := hright.trans (congrArg (fun g => wL.complexMean g) + (funext (fun u => hinner (mapL u)))) + exact hleft.trans ((congrArg (fun p => p.complexMean (fun y => f (map y))) + (principalSupportedResidueWeights_eq_pi B h H hH q r hcell)).trans (hpart'.trans hright'.symm)) + +include hq in +theorem containedSupportedProgressionAxisLaw_eq_of_size + (hsize : ∀ j : PrincipalTupleIndex BP hP, (Fintype.card α + 1) * q ≤ H (embed j)) : + containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P = + containedProgressionResidueLaw BP hP (principalAxisLength P L) (principalAxisLength P H) + (principalAxisLength P step) (fun j => c (embed j)) (fun j => hL (embed j)) hHP + (fun j => hsubset (embed j)) q hq rP hsize := by + have hres := principalResidueWeights_eq_condition BP hP (principalAxisLength P H) hHP q hq rP hsize + have hcond := principalSupportedResidueWeights_eq_pi BP hP (principalAxisLength P H) hHP q rP + (principalResidueCell_mass_pos BP hP (principalAxisLength P H) hHP q hq rP hsize) + exact congrArg (fun w => w.fiberLaw (containedProgressionTupleMap BP hP + (principalAxisLength P L) (principalAxisLength P H) (principalAxisLength P step) + (fun j => c (embed j)) (fun j => hL (embed j)) (fun j => hsubset (embed j)))) (hres.trans hcond).symm + +theorem containedSupportedProgressionAxisLaw_cube_support + (u : PrincipalAxisTuples (α := α) P L) + (hu : (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).weight u ≠ 0) + (j : PrincipalTupleIndex BP hP) : + IntegerScalarCube (principalAxisLength P L j) (fun a => (u j a : ℤ)) := by + apply FiniteProbabilityWeights.fiberLaw_support _ _ + (fun u => IntegerScalarCube (principalAxisLength P L j) (fun a => (u j a : ℤ))) _ u hu + intro z _ + exact containedProgressionCubeMap_cube α _ _ _ _ _ _ (z j) + +theorem containedSupportedProgressionLaw_partition_comparison + (f : PrincipalIntegerTuples B h α L → ℂ) (g : PrincipalAxisTuples (α := α) P L → ℂ) {E : ℝ} + (hpoint : ∀ u, + (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).weight u ≠ 0 → + ‖(containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell (fun a => ¬P a)).complexMean + (fun v => f (principalAxisJoin P u v)) - g u‖ ≤ E) : + ‖(containedSupportedProgressionLaw B h L H step c hL hH hsubset q r hcell).complexMean f - + (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).complexMean g‖ ≤ E := by + rw [containedSupportedProgressionLaw_partition B h L H step c hL hH hsubset q r hcell P f] + exact ((containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).norm_complexMean_sub_le + _ _ (fun _ => E) hpoint).trans_eq (FiniteProbabilityWeights.mean_const _ E) + +theorem containedSupportedProgressionLaw_axis_marginal : + (containedSupportedProgressionLaw B h L H step c hL hH hsubset q r hcell).toPMF.map + (principalAxisRestrict P) = + (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).toPMF := by + let w := principalSupportedCoordinateWeights B h H hH q r hcell + have hinj : Function.Injective embed := by + intro a b hab + rcases a with ⟨⟨a, ha⟩, av⟩ + rcases b with ⟨⟨b, hb⟩, bv⟩ + cases hab + rfl + have hraw := FiniteProbabilityWeights.pi_condition_positive_fiber_marginal + (fun j => integerScalarCubeWeights α (H j) (hH j)) + (fun j (z : IntegerScalarCubeBox α (H j)) a => ((z a : ℤ) : ZMod q)) r hcell embed hinj + have hpi := FiniteProbabilityWeights.toPMF_pi (fun j : PrincipalTupleIndex BP hP => w (embed j)) + have hraw' : (conditioned).toPMF.map (principalAxisRestrict P) = + (FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex BP hP => w (embed j))).toPMF := hraw.trans hpi.symm + have hm := congrArg (fun p => p.map (containedProgressionTupleMap BP hP + (principalAxisLength P L) (principalAxisLength P H) (principalAxisLength P step) + (fun j => c (embed j)) (fun j => hL (embed j)) (fun j => hsubset (embed j)))) hraw' + rw [PMF.map_comp] at hm + have hout := FiniteProbabilityWeights.toPMF_fiberLaw + (FiniteProbabilityWeights.pi (fun j : PrincipalTupleIndex BP hP => w (embed j))) + (containedProgressionTupleMap BP hP (principalAxisLength P L) (principalAxisLength P H) + (principalAxisLength P step) (fun j => c (embed j)) (fun j => hL (embed j)) (fun j => hsubset (embed j))) + simp only [containedSupportedProgressionLaw, containedSupportedProgressionAxisLaw, + FiniteProbabilityWeights.toPMF_fiberLaw, PMF.map_comp] + refine Eq.trans ?_ (hm.trans hout.symm) + apply congrArg (fun f : PrincipalIntegerTuples B h α H → PrincipalAxisTuples (α := α) P L => + (conditioned).toPMF.map f) + funext y j + rfl + +end Erdos3 + +end + +section + +namespace Erdos3 +open MeasureTheory +open scoped Classical BigOperators + +variable {D α : Type*} [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] +variable (B : D → Type*) [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] (h : D → ℕ) +variable (L H step : PrincipalTupleIndex B h → ℕ) (c : PrincipalTupleIndex B h → ℤ) +variable (hL : ∀ j, 0 < L j) (hH : ∀ j, 0 < H j) +variable (hsubset : ∀ j, integerProgressionSupport (c j) (step j : ℤ) (H j) ⊆ + Finset.Ico (0 : ℤ) (L j : ℤ)) +variable (q : ℕ) (hq : 0 < q) (r : PrincipalTupleIndex B h → Option α → ZMod q) +variable (hcell : 0 < (principalTupleWeights (α := α) B h H hH).mass + (Finset.univ.filter (fun y => principalResidueLabel q y = r))) +variable (P : D → Prop) [DecidablePred P] + +local notation "BP" => (fun a : {a // P a} => B (Subtype.val a)) +local notation "hP" => (fun a : {a // P a} => h (Subtype.val a)) +local notation "embed" => (fun j : PrincipalTupleIndex BP hP => (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j) : PrincipalTupleIndex B h)) +local notation "rP" => (fun j : PrincipalTupleIndex BP hP => r (embed j)) +local notation "hHP" => (fun j : PrincipalTupleIndex BP hP => hH (embed j)) +local notation "conditioned" => FiniteProbabilityWeights.condition (principalTupleWeights B h H hH) + (Finset.univ.filter (fun y => principalResidueLabel q y = r)) hcell + +theorem containedSupportedProgressionLaw_integral_comparison + {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) + (f : Ω → PrincipalIntegerTuples B h α L → ℂ) (hf : ∀ y, Integrable (fun p => f p y) μ) + (g : PrincipalAxisTuples (α := α) P L → ℂ) {E : ℝ} + (hpoint : ∀ u, + (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).weight u ≠ 0 → + ‖(∫ p, (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell (fun a => ¬P a)).complexMean + (fun v => f p (principalAxisJoin P u v)) ∂μ) - g u‖ ≤ E) : + ‖(∫ p, (containedSupportedProgressionLaw B h L H step c hL hH hsubset q r hcell).complexMean (f p) ∂μ) - + (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell P).complexMean g‖ ≤ E := by + rw [FiniteProbabilityWeights.integral_complexMean _ μ f hf] + apply containedSupportedProgressionLaw_partition_comparison B h L H step c hL hH hsubset q r hcell P + intro u hu + have he := (containedSupportedProgressionAxisLaw B h L H step c hL hH hsubset q r hcell (fun a => ¬P a)).integral_complexMean + μ (fun p v => f p (principalAxisJoin P u v)) (fun v => hf (principalAxisJoin P u v)) + exact he ▸ hpoint u hu + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped Classical BigOperators + +variable {D α : Type*} [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] +variable (B : D → Type*) [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] (h : D → ℕ) +variable (L : PrincipalTupleIndex B h → ℕ) (hL : ∀ j, 0 < L j) + +theorem principalTupleWeights_weight_pos_of_cube (y : PrincipalIntegerTuples B h α L) + (hy : ∀ j, IntegerScalarCube (L j) (fun a => (y j a : ℤ))) : + 0 < (principalTupleWeights B h L hL).weight y := by + apply Finset.prod_pos + intro j _ + apply (FiniteProbabilityWeights.condition_weight_pos_iff _ _ _ (y j)).mpr + refine ⟨(mem_integerScalarCubeSet (L j) (y j)).mpr (hy j), ?_⟩ + let : Nonempty (IntegerScalarCubeBox α (L j)) := ⟨y j⟩ + change 0 < (Fintype.card (IntegerScalarCubeBox α (L j)) : ℝ)⁻¹ + positivity + +theorem principalResidueCell_pos_of_cube (q : ℕ) (y : PrincipalIntegerTuples B h α L) + (hy : ∀ j, IntegerScalarCube (L j) (fun a => (y j a : ℤ))) : + 0 < (principalTupleWeights B h L hL).mass + (Finset.univ.filter (fun z => principalResidueLabel q z = principalResidueLabel q y)) := by + apply lt_of_lt_of_le (principalTupleWeights_weight_pos_of_cube B h L hL y hy) + exact Finset.single_le_sum (fun z _ => (principalTupleWeights B h L hL).nonneg z) + (by simp : y ∈ Finset.univ.filter (fun z => principalResidueLabel q z = principalResidueLabel q y)) + +omit [Fintype D] [DecidableEq D] [DecidableEq α] + [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)] in +theorem principalAxisJoin_cube (P : D → Prop) [DecidablePred P] + (u : PrincipalAxisTuples (α := α) P L) (v : PrincipalAxisTuples (α := α) (fun a => ¬P a) L) + (hu : ∀ j, IntegerScalarCube (principalAxisLength P L j) (fun a => (u j a : ℤ))) + (hv : ∀ j, IntegerScalarCube (principalAxisLength (fun a => ¬P a) L j) (fun a => (v j a : ℤ))) : + ∀ j, IntegerScalarCube (L j) (fun a => (principalAxisJoin P u v j a : ℤ)) := by + rintro ⟨a, bv⟩ + by_cases ha : P a + · simpa only [principalAxisJoin, ha, ↓reduceDIte, principalAxisLength] using hu ⟨⟨a, ha⟩, bv⟩ + · simpa only [principalAxisJoin, ha, ↓reduceDIte, principalAxisLength] using hv ⟨⟨a, ha⟩, bv⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialJointTest.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialJointTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..c535bd1703612d596b27bb34cdffde40a10d2f7e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialJointTest.lean @@ -0,0 +1,94 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedEnormousProfiles + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem principalSpatial_joint_test {D A α J N W : Type*} + [Fintype D] [DecidableEq D] [Fintype A] [Fintype α] [DecidableEq α] + [Fintype J] [DecidableEq J] [Fintype N] [DecidableEq N] + (B : D → Type*) [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] (h : D → ℕ) + (L : PrincipalTupleIndex B h → ℕ) (hL : ∀ j, 0 < L j) + {ℓ M : ℕ} {ρ ξ r ε : ℝ} (s : α ↪ J) + (x : J → IntegerScalarCubeBox α ℓ) (root : J → ℤ) + (hM : 0 < M) (hℓ : 0 < ℓ) (hx : GoodScalarKernelTuple s (1/(M : ℝ)) M x) + (hroot : ∀ j, |root j| ≤ (ℓ : ℤ)) (m : ℕ) [NeZero m] (hm : 0 < m) + (hsize : ∀ j, (Fintype.card α+1)*m ≤ L j) + (hp : integerScalarLattice (Unit ⊕ α) (m : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s)) + (c : A → N → ℤ) (index : A → N → PrincipalTupleIndex B h) + (H : A → ℝ) (Q : A → N → ℝ) (hH : ∀ a, 0 < H a) (hQ : ∀ a n, 0 < Q a n) + (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + (hwidth : ∀ a n, ((|c a n| : ℤ)+(L (index a n) : ℤ) : ℝ)*Q a n ≤ ξ*H a) + (hρ : 0 < ρ) (hscale : ∀ a, ρ ≤ H a/ℓ) (hscaleQ : ∀ a n, ρ ≤ Q a n) + (hlarge : smoothSpatialMeshThreshold α J N ℓ ≤ ρ) (hr : 0 < r) (hε : 0 ≤ ε) + (tv : Finset (A → (Unit ⊕ α) → ℤ)) (tw : Finset W) + (coeff : PrincipalIntegerTuples B h α L → W → ℝ) + (target : (PrincipalTupleIndex B h → Option α → ZMod m) → (W → ℂ) → ℂ) + (hcoeff0 : ∀ y, (principalTupleWeights (α := α) B h L hL).weight y ≠ 0 → + ∀ w ∈ tw, 0 ≤ coeff y w) + (hmass : ∀ y, (principalTupleWeights (α := α) B h L hL).weight y ≠ 0 → + (∑ w ∈ tw, coeff y w) ≤ 1) + (hbox : ∀ v ∈ tv, ∀ a i, |((spatialStar (v a) i : ℤ) : ℝ)/H a| ≤ 1) + (hcoeff : ∀ rr ψ, (∀ w ∈ tw, ‖ψ w‖ ≤ 1) → + ‖(principalResidueWeights B h L hL m hm rr hsize).complexMean + (fun y => ∑ w ∈ tw, (coeff y w : ℂ) * ψ w) - target rr ψ‖ ≤ ε) + (φ : (A → (Unit ⊕ α) → ℤ) → W → ℂ) + (hφ : ∀ v ∈ tv, ∀ w ∈ tw, ‖φ v w‖ ≤ 1) : + let P := selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s + let F := selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s + let hP := goodScalarKernelTuple_spatial_det_ne_zero s x root + (one_div_pos.mpr (by exact_mod_cast hM)) hx + let f := fun a => smoothSpatialKernelDensity s root (scalarCubeDifferenceMatrix x) hP + (H a) ℓ (hH a) (by exact_mod_cast hℓ) + let G := (m : ℝ)^Fintype.card (Unit ⊕ α) + let E := smoothSpatialError N s M ℓ ρ ξ + let scale := ∏ a, ∏ _i : Unit ⊕ α, H a + let error := Fintype.card A * (E + 4 * G * smoothSpatialDensityLip s M * r) * + (1 + G * smoothSpatialDensityCap s M + E)^Fintype.card A + let Δ := error / scale * tv.card + let source := principalTupleWeights (α := α) B h L hL + let residues := source.fiberLaw (principalResidueLabel m) + let site := fun rr v => ∏ a, spatialSiteApprox P + (Matrix.fromCols F (liftResidueMatrix (principalSpatialResidueColumns m (c a) (index a) rr))) + m (f a) (H a) 1 r (v a) + ‖source.complexMean (fun y => ∑ v ∈ tv, + ((smoothVectorSpatialOutputLaw root (scalarCubeDifferenceMatrix x) + (fun a => principalSpatialColumns (c a) (index a) y) H ℓ Q hH + (by exact_mod_cast hℓ) hQ v).toReal : ℂ) * + (∑ w ∈ tw, (coeff y w : ℂ) * φ v w)) - + residues.complexMean (fun rr => ∑ v ∈ tv, (site rr v / (scale : ℂ)) * target rr (φ v))‖ ≤ + Δ + (1 + Δ) * ε := by + dsimp only + let scale := ∏ a, ∏ _i : Unit ⊕ α, H a + have hscale0 : 0 < scale := Finset.prod_pos (fun a _ => Finset.prod_pos (fun _ _ => hH a)) + have hscaleC : (scale : ℂ) ≠ 0 := by exact_mod_cast hscale0.ne' + have hE := smoothSpatialError_nonneg N s M ℓ hρ.le hξ0 + have hC := smoothSpatialDensityCap_nonneg s M + have hK := smoothSpatialDensityLip_nonneg s M + apply principalRetained_test_comparison B h L hL m hm hsize tv tw + (fun y => smoothVectorSpatialOutputLaw root (scalarCubeDifferenceMatrix x) + (fun a => principalSpatialColumns (c a) (index a) y) H ℓ Q hH + (by exact_mod_cast hℓ) hQ) _ coeff target (by positivity) hε hcoeff0 hmass + _ hcoeff φ hφ + intro y _ v hv + have he := principalVectorSpatial_site_error s x root hM hℓ hx hroot m hp c index H Q hH hQ + hξ0 hξ1 hwidth hρ hscale hscaleQ hlarge hr y v (hbox v hv) + have he' := div_le_div_of_nonneg_right he hscale0.le + have hid (z : ℝ) (b : ℂ) : (z : ℂ) - b / (scale : ℂ) = + (((scale * z : ℝ) : ℂ) - b) / (scale : ℂ) := by + push_cast + field_simp + rw [hid, norm_div, Complex.norm_real, Real.norm_of_nonneg hscale0.le] + exact he' + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialL1Comparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialL1Comparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..8dd97e15e84b289aa982737962838d70aa4f4003 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialL1Comparison.lean @@ -0,0 +1,131 @@ +import OAI.Combinatorics.Progressions.Estimates.PrincipalJointL1Comparison +import OAI.Combinatorics.Progressions.Sampling.PrincipalGridMixture + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal BigOperators + +theorem principalJointCoefficient_spatial_comparison {Q Z K D α : Type*} + [Fintype Q] [DecidableEq Q] [Fintype D] [DecidableEq D] [Fintype α] [DecidableEq α] + {I J N : Q → Type*} [∀ q, Fintype (I q)] [∀ q, DecidableEq (I q)] + [∀ q, Fintype (J q)] [∀ q, DecidableEq (J q)] [∀ q, Fintype (N q)] [∀ q, DecidableEq (N q)] + (B : D → Type*) [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] (h : D → ℕ) + (A : ∀ q, Matrix (I q) (J q) ℤ) (s : ∀ q, I q ↪ J q) + (hA : ∀ q, ((A q).submatrix id (s q)).det ≠ 0) + (S : ∀ q, J q → ℝ) (hS : ∀ q j, 0 < S q j) (H ℓ C U : Q → ℝ) (G : ℝ) + (hH : ∀ q, 0 < H q) (hH1 : ∀ q, 1 ≤ H q) (hℓ : ∀ q, 0 < ℓ q) + (hC0 : ∀ q, 0 ≤ C q) (hU0 : ∀ q, 0 ≤ U q) (hG0 : 0 ≤ G) + (e : ∀ q, N q → K →₀ ℕ) (input : K → Option α → Z ⊕ JointBlockParameter B h α) + (zi : Z → ℤ) (zr : Z → ℝ) (hz : ∀ j, |zr j| ≤ 1) (T : K → ℝ) (hT : ∀ k, 0 < T k) + (rows : ∀ q, I q → Finset α) (degree : Q → ℕ) + (hd : ∀ q n, (e q n).sum (fun _ k => k) ≤ degree q) + (c w : ∀ q, J q ⊕ N q → ℝ) (hw : ∀ q j, 0 < w q j) (δ R : Q → ℝ≥0) + (hδ : ∀ q, 0 < δ q) (hwidth : ∀ q j, (δ q : ℝ) ≤ w q j) + (hsupport : ∀ q j, |c q j| + w q j ≤ R q) + (L : PrincipalTupleIndex B h → ℕ) (hL : ∀ j, 0 < L j) + (m : ℕ) [NeZero m] (hm : 0 < m) + (hsize : ∀ j, (Fintype.card α+1)*m ≤ L j) + (hsmall : ∀ j, scalarCubeGridBoundaryConstant α * ((m : ℝ)/L j) < volume.real (scalarCubeDomain α)) + (hn : ∀ (y : PrincipalIntegerTuples B h α L) k a, + ((Sum.elim zi (principalTupleIntegers y) (input k a) : ℤ) : ℝ)/T k = + Sum.elim zr (principalTupleNormalized L y) (input k a)) + (ctrl : ∀ q y, (principalTupleWeights (α := α) B h L hL).weight y ≠ 0 → + CoefficientFiberControl + (Matrix.fromCols (A q) (integerMappedJetMatrix (e q) input zi (rows q) (principalTupleIntegers y))) + ((s q).trans Function.Embedding.inl) (Sum.elim (S q) (fun n => H q/monomialScale T (e q n))) + (H q) (ℓ q) (degree q) (C q) (U q) G) + (hperiod : ∀ q, integerScalarLattice (I q) (m : ℤ) ≤ (A q).mulVecLin.range) + (b t ε : Q → ℝ) (hb : ∀ q, 0 ≤ b q) (ht : ∀ q, 0 ≤ t q) (hε : ∀ q, 0 < ε q) + (hG : ∀ q, G ≤ Real.exp (b q)) (hU : ∀ q, U q ≤ Real.exp (b q)) + (hC : ∀ q, C q ≤ Real.exp (b q)) (hR : ∀ q, (R q : ℝ) ≤ Real.exp (b q)) + (hi : ∀ q, (δ q : ℝ)⁻¹ ≤ Real.exp (t q)) + (hlarge : ∀ q, coefficientGridReplacementScale (J := J q ⊕ N q) + ((s q).trans Function.Embedding.inl) (C q) (R q) (b q) (t q) (ε q) (ℓ q) (degree q) ≤ H q) + (hεsum : (∑ q, ε q) ≤ 1) + (Cap Lip Ro : ℝ≥0) (hCap : 1 ≤ Cap) {mesh : ℝ} + (hmesh0 : 0 ≤ mesh) (hmesh1 : mesh ≤ 1) (hmesh : ∀ q, 1 / H q ≤ mesh) + (grid : Finset ((Σ q, I q) → ℤ)) + (spatial : PrincipalIntegerTuples B h α L → ((Σ q, I q) → ℤ) → ℂ) + (sites : (PrincipalTupleIndex B h → Option α → ZMod m) → ((Σ q, I q) → ℤ) → ℂ) + (Msite : (PrincipalTupleIndex B h → Option α → ZMod m) → ℝ) + (hMsite : ∀ rr, 0 < Msite rr) (hsites : ∀ rr v, v ∈ grid → ‖sites rr v‖ ≤ Msite rr) + {spatialError : ℝ} (hspatialError : 0 ≤ spatialError) + (hspatial : ∀ y, (principalTupleWeights (α := α) B h L hL).weight y ≠ 0 → + ∀ v ∈ grid, ‖spatial y v - sites (principalResidueLabel m y) v‖ ≤ spatialError) + (φ : ((Σ q, I q) → ℤ) → ℂ) + (hφ : ∀ v ∈ grid, ‖φ v‖ ≤ 1) : + let E := fun q => normalizedPivotEquiv ((A q).submatrix id (s q)) (hA q) + (fun i => S q (s q i)) (fun _ => H q) (fun i => hS q (s q i)) (fun _ => hH q) + let F := fun q => matrixSupCLM (normalizedIntegerColumns (remainingMatrixColumns (A q) (s q)) + (fun j => S q j.val) (fun _ => H q)) + let mask := fun (rr : PrincipalTupleIndex B h → Option α → ZMod m) q => + coefficientResidueMultiplier (A q) + (integerResidueMatrix (integerMappedJetMatrix (e q) input zi (rows q) (principalResidueLift m rr)) m) + let ρ := fun x => jointAffineJetDensity s E F e input zr rows c w x ∘ sigmaAxisCoordinates I + let KT := ∑ q, affineJetL1Cost (JointBlockParameter B h α) α (J q) (N q) (E q) (degree q) (δ q) (R q) + let KO := Fintype.card Q * Lip * Cap^Fintype.card Q + let ET := (2 * scalarCubeGridBoundaryConstant α / volume.real (scalarCubeDomain α) + KT) * + ∑ j, (m : ℝ)/L j + let Err := 2 * ∑ q, ε q + G^Fintype.card Q * + (ET + (2 * (Ro : ℝ) + 2)^Fintype.card (Σ q, I q) * ((KO : ℝ) + KO) * mesh) + let source := principalTupleWeights (α := α) B h L hL + let residues := source.fiberLaw (principalResidueLabel m) + (∀ q, pivotKernelCap (UnselectedColumn (s q)) (E q) (R q) ((δ q)⁻¹^Fintype.card (J q)) ≤ Cap) → + (∀ q, pivotKernelLip (UnselectedColumn (s q)) (E q) (R q) (affineProductProfileLip (J q) (δ q)) ≤ Lip) → + (∀ q, normalizedJetOutputRadius α (N q) (E q) (F q) (degree q) (R q) (R q) ≤ Ro) → + ∃ hZ : ∀ q, 0 < coefficientWeightSum (affineProductProfile (c q) (w q)) + (Sum.elim (S q) (fun n => H q/monomialScale T (e q n))), + ‖source.complexMean (fun y => ∑ v ∈ grid, ((∏ q, + (coefficientImagePMF + (Matrix.fromCols (A q) (integerMappedJetMatrix (e q) input zi (rows q) (principalTupleIntegers y))) + (affineProductProfile (c q) (w q)) (affineProductProfile_nonneg (c q) (w q) (hw q)) + (Sum.elim (S q) (fun n => H q/monomialScale T (e q n))) + (Sum.rec (hS q) (fun n => div_pos (hH q) (monomialScale_pos T hT (e q n)))) + (affineProductProfile_zero_outside (c q) (w q) (hw q) (R q).coe_nonneg (hsupport q)) + (hZ q) (fun i => v ⟨q, i⟩)).toReal : ℝ) : ℂ) * spatial y v * φ v) - + residues.complexMean (fun rr => gridDensityTest (densityMixture (jointBooleanSource h) ρ) + 0 (fun j => H j.1) grid (fun v => ∏ q, mask rr q (fun i => v ⟨q, i⟩)) + (fun v => sites rr v * φ v))‖ ≤ + spatialError + residues.mean (fun rr => Msite rr * Err) := by + dsimp only + intro hcap hlip hRo + let E := fun q => normalizedPivotEquiv ((A q).submatrix id (s q)) (hA q) + (fun i => S q (s q i)) (fun _ => H q) (fun i => hS q (s q i)) (fun _ => hH q) + let F := fun q => matrixSupCLM (normalizedIntegerColumns (remainingMatrixColumns (A q) (s q)) + (fun j => S q j.val) (fun _ => H q)) + let ρ := fun x => jointAffineJetDensity s E F e input zr rows c w x ∘ sigmaAxisCoordinates I + have hcomp (rr : PrincipalTupleIndex B h → Option α → ZMod m) + (ψ : ((Σ q, I q) → ℤ) → ℂ) (hψ : ∀ v ∈ grid, ‖ψ v‖ ≤ 1) := + principalJointCoefficient_grid_comparison B h A s hA S hS H ℓ C U G hH hH1 hℓ hC0 hU0 hG0 + e input zi zr hz T hT rows degree hd c w hw δ R hδ hwidth hsupport L hL m hm rr hsize hsmall hn + (fun q y hy => ctrl q y (principalResidueWeights_nonzero_source B h L hL m hm rr hsize y hy)) + hperiod (principalResidueLift m rr) (principalResidueLift_spec m rr) + b t ε hb ht hε hG hU hC hR hi hlarge hεsum Cap Lip Ro hCap hmesh0 hmesh1 hmesh + grid ψ hψ hcap hlip hRo + obtain ⟨hZ, _⟩ := hcomp 0 (fun _ => 0) (fun _ _ => by simp) + let P : PrincipalIntegerTuples B h α L → ∀ q, PMF (I q → ℤ) := fun y q => coefficientImagePMF + (Matrix.fromCols (A q) (integerMappedJetMatrix (e q) input zi (rows q) (principalTupleIntegers y))) + (affineProductProfile (c q) (w q)) (affineProductProfile_nonneg (c q) (w q) (hw q)) + (Sum.elim (S q) (fun n => H q/monomialScale T (e q n))) + (Sum.rec (hS q) (fun n => div_pos (hH q) (monomialScale_pos T hT (e q n)))) + (affineProductProfile_zero_outside (c q) (w q) (hw q) (R q).coe_nonneg (hsupport q)) (hZ q) + refine ⟨hZ, ?_⟩ + refine principal_jointPMF_grid_mixture B h L hL m hm hsize I P grid spatial sites + (fun _ => densityMixture (jointBooleanSource h) ρ) 0 (fun j => H j.1) + (fun rr v => ∏ q, coefficientResidueMultiplier (A q) + (integerResidueMatrix (integerMappedJetMatrix (e q) input zi (rows q) (principalResidueLift m rr)) m) + (fun i => v ⟨q, i⟩)) Msite _ hMsite hsites hspatialError hspatial ?_ φ hφ + intro rr ψ hψ + obtain ⟨_, he⟩ := hcomp rr ψ hψ + exact he + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialMixedComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialMixedComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..7089be51aa3f10f23fdeefd0dfae1840d90f811f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialMixedComparison.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Estimates.PrincipalMixedComparison + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem principalSpatial_mixed_comparison {D A α J N V : Type*} + [Fintype D] [DecidableEq D] [Fintype A] [Fintype α] [DecidableEq α] + [Fintype J] [DecidableEq J] [Fintype N] [DecidableEq N] + (B : D → Type*) [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] (h : D → ℕ) + (L : PrincipalTupleIndex B h → ℕ) (hL : ∀ j, 0 < L j) + {ℓ M : ℕ} {ρ ξ r ε : ℝ} (s : α ↪ J) + (x : J → IntegerScalarCubeBox α ℓ) (root : J → ℤ) + (hM : 0 < M) (hℓ : 0 < ℓ) (hx : GoodScalarKernelTuple s (1/(M : ℝ)) M x) + (hroot : ∀ j, |root j| ≤ (ℓ : ℤ)) (m : ℕ) [NeZero m] (hm : 0 < m) + (hsize : ∀ j, (Fintype.card α+1)*m ≤ L j) + (hp : integerScalarLattice (Unit ⊕ α) (m : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s)) + (c : A → N → ℤ) (index : A → N → PrincipalTupleIndex B h) + (H : A → ℝ) (Q : A → N → ℝ) (hH : ∀ a, 0 < H a) (hQ : ∀ a n, 0 < Q a n) + (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + (hwidth : ∀ a n, ((|c a n| : ℤ)+(L (index a n) : ℤ) : ℝ)*Q a n ≤ ξ*H a) + (hρ : 0 < ρ) (hscale : ∀ a, ρ ≤ H a/ℓ) (hscaleQ : ∀ a n, ρ ≤ Q a n) + (hlarge : smoothSpatialMeshThreshold α J N ℓ ≤ ρ) (hr : 0 < r) + (t : Finset V) (out : V → A → (Unit ⊕ α) → ℤ) + (W : PrincipalIntegerTuples B h α L → V → ℝ) + (target : (PrincipalTupleIndex B h → Option α → ZMod m) → V → ℝ) (φ : V → ℂ) + (hW : ∀ y, (principalTupleWeights (α := α) B h L hL).weight y ≠ 0 → ∀ v ∈ t, 0 ≤ W y v) + (hφ : ∀ v ∈ t, ‖φ v‖ ≤ 1) + (hbox : ∀ v ∈ t, ∀ a i, |((spatialStar (out v a) i : ℤ) : ℝ)/H a| ≤ 1) + (hcoeff : ∀ rr v, v ∈ t → + |(principalResidueWeights B h L hL m hm rr hsize).mean (fun y => W y v)-target rr v| ≤ ε) : + let P := selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s + let F := selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s + let hP := goodScalarKernelTuple_spatial_det_ne_zero s x root + (one_div_pos.mpr (by exact_mod_cast hM)) hx + let f := fun a => smoothSpatialKernelDensity s root (scalarCubeDifferenceMatrix x) hP + (H a) ℓ (hH a) (by exact_mod_cast hℓ) + let G := (m : ℝ)^Fintype.card (Unit ⊕ α) + let E := smoothSpatialError N s M ℓ ρ ξ + let source := principalTupleWeights (α := α) B h L hL + let residues := source.fiberLaw (principalResidueLabel m) + let site := fun rr v => ∏ a, spatialSiteApprox P + (Matrix.fromCols F (liftResidueMatrix (principalSpatialResidueColumns m (c a) (index a) rr))) + m (f a) (H a) 1 r (out v a) + ‖source.complexMean (fun y => 𝔼 v ∈ t, (W y v : ℂ)* + (((∏ a, ∏ _i : Unit ⊕ α, H a)* + (smoothVectorSpatialOutputLaw root (scalarCubeDifferenceMatrix x) + (fun a => principalSpatialColumns (c a) (index a) y) H ℓ Q hH + (by exact_mod_cast hℓ) hQ (out v)).toReal : ℝ) : ℂ)*φ v) - + (∑ rr, 𝔼 v ∈ t, ((residues.weight rr*target rr v : ℝ) : ℂ)*site rr v*φ v)‖ ≤ + (Fintype.card A*(E+4*G*smoothSpatialDensityLip s M*r)*(1+G*smoothSpatialDensityCap s M+E)^Fintype.card A)* + source.mean (fun y => 𝔼 v ∈ t, W y v) + + ε*residues.mean (fun rr => 𝔼 v ∈ t, ‖site rr v‖) := by + dsimp only + refine principal_mixed_comparison B h L hL m hm hsize t W target _ _ φ hW hφ ?_ hcoeff + intro y _ v hv + exact principalVectorSpatial_site_error s x root hM hℓ hx hroot m hp c index H Q hH hQ + hξ0 hξ1 hwidth hρ hscale hscaleQ hlarge hr y (out v) (hbox v hv) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialSiteComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialSiteComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..990008f545b57cbb33e8c036f3b4435d878e7aec --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialSiteComparison.lean @@ -0,0 +1,296 @@ +import OAI.Combinatorics.Progressions.Lattices.SpatialSiteResidueIdentity +import OAI.Combinatorics.Progressions.Lattices.TupleResidueConditioning +import OAI.Combinatorics.Progressions.Probability.SmoothVectorSpatialLaw + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Matrix + +theorem rootDifferenceMatrix_vertex {I J : Type*} [Fintype J] + (root : J → ℤ) (D : Matrix I J ℤ) (a : ℤ) (v : J → ℤ) (t : Finset I) : + a + ∑ j, integerAffineCube root D t j * v j = + (rootDifferenceMatrix root D *ᵥ Sum.elim (fun _ : Unit => a) v) (Sum.inl ()) + + ∑ i ∈ t, (rootDifferenceMatrix root D *ᵥ Sum.elim (fun _ : Unit => a) v) (Sum.inr i) := by + rw [rootDifferenceMatrix_mulVec] + have hs : (∑ j, ∑ i ∈ t, D i j * v j) = ∑ i ∈ t, ∑ j, D i j * v j := Finset.sum_comm + simp only [integerAffineCube, add_mul, Finset.sum_add_distrib, Finset.sum_mul, + Sum.elim_inl, Sum.elim_inr, Matrix.mulVec, dotProduct] + rw [hs] + ring + +theorem integerAffineCube_shifted_scalar {I J : Type*} [Fintype I] {L : ℕ} + (x : J → IntegerScalarCubeBox I L) (c : J → ℤ) (t : Finset I) : + integerAffineCube (fun j => c j + (x j none : ℤ)) (scalarCubeDifferenceMatrix x) t = + fun j => c j + integerScalarCubeValue (fun i => (x j i : ℤ)) t := by + funext j + change (c j + (x j none : ℤ)) + ∑ i ∈ t, (x j (some i) : ℤ) = + c j + ((x j none : ℤ) + ∑ i ∈ t, (x j (some i) : ℤ)) + ring + +theorem scalarCubeWindow_root_bound {I : Type*} [Fintype I] {L K : ℕ} + (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) (x : IntegerScalarCubeBox I L) (c : ℤ) + (hc : 0 ≤ c) (hcK : c + K ≤ L) (hx : x ∈ scalarCubeWindowResidueSet I L K m r) : + |c + (x none : ℤ)| ≤ (L : ℤ) := by + have h := ((mem_scalarCubeWindowResidueSet L K m r x).mp hx).1 ∅ + simp only [integerScalarCubeValue, Finset.sum_empty, add_zero] at h + apply abs_le.mpr + constructor <;> omega + +theorem affineScalarCubeWindowWeights_root_bound {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) + (hc : 0 ≤ c) (hcK : c + K ≤ L) + (hx : (affineScalarCubeWindowWeights I L K M D c hL hKL hDK m r hm hmM hsize).weight x ≠ 0) : + |c + (x none : ℤ)| ≤ (L : ℤ) := by + classical + apply scalarCubeWindow_root_bound m (shiftScalarCubeResidues c m r) x c hc hcK + by_contra hnot + apply hx + simp only [affineScalarCubeWindowWeights, scalarCubeWindowWeights, FiniteProbabilityWeights.condition, + hnot, ite_false, zero_div] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped Matrix BigOperators + +def scalarTupleColumn {I : Type*} (c : ℤ) (x : Option I → ℤ) : (Unit ⊕ I) → ℤ := + Sum.elim (fun _ => c + x none) (fun i => x (some i)) + +def scalarTupleSpatialColumns {I N : Type*} (T : N → ℕ) (c : N → ℤ) + (x : ∀ j, IntegerScalarCubeBox I (T j)) : Matrix (Unit ⊕ I) N ℤ := + tupleColumnMatrix (fun j x => scalarTupleColumn (c j) (fun i => (x i : ℤ))) x + +theorem scalarTupleColumn_residue_iff {I : Type*} (c : ℤ) (x : Option I → ℤ) + (m : ℕ) (r : (Unit ⊕ I) → ZMod m) : + integerResidueMap (Unit ⊕ I) m (scalarTupleColumn c x) = r ↔ + ((c + x none : ℤ) : ZMod m) = r (.inl ()) ∧ + ∀ i, (x (some i) : ZMod m) = r (.inr i) := by + constructor + · intro h + exact ⟨congrFun h (.inl ()), fun i => congrFun h (.inr i)⟩ + · rintro ⟨hroot, hdiff⟩ + funext i + cases i with + | inl i => cases i; exact hroot + | inr i => exact hdiff i + +theorem scalarTupleColumn_bound {I : Type*} {T : ℕ} (c : ℤ) + (x : IntegerScalarCubeBox I T) (i : Unit ⊕ I) : + |scalarTupleColumn c (fun k => (x k : ℤ)) i| ≤ |c| + (T : ℤ) := by + have hx (k : Option I) : |(x k : ℤ)| ≤ (T : ℤ) := by + have h := Finset.mem_Ico.mp (x k).property + exact abs_le.mpr ⟨h.1, h.2.le⟩ + cases i with + | inl i => exact (abs_add_le c (x none)).trans (add_le_add le_rfl (hx none)) + | inr i => exact (hx (some i)).trans (le_add_of_nonneg_left (abs_nonneg c)) + +theorem scalarTupleSpatialColumns_scaled_bound {I N : Type*} + (T : N → ℕ) (c : N → ℤ) (Q : N → ℝ) (hQ : ∀ j, 0 ≤ Q j) {ξ H : ℝ} + (hwidth : ∀ j, ((|c j| : ℤ) + (T j : ℤ) : ℝ) * Q j ≤ ξ * H) + (x : ∀ j, IntegerScalarCubeBox I (T j)) (i : Unit ⊕ I) (j : N) : + |(scalarTupleSpatialColumns T c x i j : ℝ)| * Q j ≤ ξ * H := by + have h : |(scalarTupleSpatialColumns T c x i j : ℝ)| ≤ ((|c j| : ℤ) + (T j : ℤ) : ℝ) := by + exact_mod_cast scalarTupleColumn_bound (c j) (x j) i + exact (mul_le_mul_of_nonneg_right h (hQ j)).trans (hwidth j) + +theorem scalarTupleSpatialColumns_vertex {I N : Type*} [Fintype I] [Fintype N] + (T : N → ℕ) (c : N → ℤ) (x : ∀ j, IntegerScalarCubeBox I (T j)) + (v : N → ℤ) (t : Finset I) : + (scalarTupleSpatialColumns T c x *ᵥ v) (.inl ()) + + ∑ i ∈ t, (scalarTupleSpatialColumns T c x *ᵥ v) (.inr i) = + ∑ j, (c j + integerScalarCubeValue (fun i => (x j i : ℤ)) t) * v j := by + have hs : (∑ i ∈ t, ∑ j, (x j (some i) : ℤ) * v j) = + ∑ j, ∑ i ∈ t, (x j (some i) : ℤ) * v j := Finset.sum_comm + simp only [scalarTupleSpatialColumns, tupleColumnMatrix, scalarTupleColumn, + Matrix.mulVec, dotProduct, Matrix.of_apply, Sum.elim_inl, Sum.elim_inr, + integerScalarCubeValue, add_mul, Finset.sum_add_distrib, Finset.sum_mul] + rw [hs] + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Matrix + +def principalSpatialColumns {D α N : Type*} {B : D → Type*} {h : D → ℕ} + {L : PrincipalTupleIndex B h → ℕ} (c : N → ℤ) (index : N → PrincipalTupleIndex B h) + (y : PrincipalIntegerTuples B h α L) : Matrix (Unit ⊕ α) N ℤ := + scalarTupleSpatialColumns (fun n => L (index n)) c (fun n => y (index n)) + +def principalSpatialResidueColumns {D α N : Type*} {B : D → Type*} {h : D → ℕ} + (m : ℕ) (c : N → ℤ) (index : N → PrincipalTupleIndex B h) + (r : PrincipalTupleIndex B h → Option α → ZMod m) : Matrix (Unit ⊕ α) N (ZMod m) := + fun i n => Sum.elim (fun _ => (c n : ZMod m)+r (index n) none) + (fun j => r (index n) (some j)) i + +theorem principalSpatialColumns_residue {D α N : Type*} {B : D → Type*} {h : D → ℕ} + {L : PrincipalTupleIndex B h → ℕ} (m : ℕ) (c : N → ℤ) (index : N → PrincipalTupleIndex B h) + (y : PrincipalIntegerTuples B h α L) : + integerResidueMatrix (principalSpatialColumns c index y) m = + principalSpatialResidueColumns m c index (principalResidueLabel m y) := by + ext i n + cases i <;> simp [integerResidueMatrix, principalSpatialColumns, scalarTupleSpatialColumns, + tupleColumnMatrix, scalarTupleColumn, principalSpatialResidueColumns, principalResidueLabel] + +theorem principalSpatialColumns_scaled_bound {D α N : Type*} {B : D → Type*} {h : D → ℕ} + {L : PrincipalTupleIndex B h → ℕ} (c : N → ℤ) (index : N → PrincipalTupleIndex B h) + (Q : N → ℝ) (hQ : ∀ n, 0 ≤ Q n) {ξ H : ℝ} + (hwidth : ∀ n, ((|c n| : ℤ)+(L (index n) : ℤ) : ℝ)*Q n ≤ ξ*H) + (y : PrincipalIntegerTuples B h α L) (i : Unit ⊕ α) (n : N) : + |(principalSpatialColumns c index y i n : ℝ)| * Q n ≤ ξ*H := + scalarTupleSpatialColumns_scaled_bound (fun n => L (index n)) c Q hQ hwidth (fun n => y (index n)) i n + +theorem principalSpatialColumns_vertex {D α N : Type*} [Fintype α] [Fintype N] + {B : D → Type*} {h : D → ℕ} {L : PrincipalTupleIndex B h → ℕ} + (c : N → ℤ) (index : N → PrincipalTupleIndex B h) (y : PrincipalIntegerTuples B h α L) + (v : N → ℤ) (t : Finset α) : + (principalSpatialColumns c index y *ᵥ v) (.inl ()) + + ∑ i ∈ t, (principalSpatialColumns c index y *ᵥ v) (.inr i) = + ∑ n, (c n+integerScalarCubeValue (fun i => (y (index n) i : ℤ)) t)*v n := + scalarTupleSpatialColumns_vertex (fun n => L (index n)) c (fun n => y (index n)) v t + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem smoothVectorSpatial_site_error {D I J N : Type*} + [Fintype D] [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] + [Fintype N] [DecidableEq N] + {L B : ℕ} {ρ ξ r : ℝ} (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) + (hB : 0 < B) (hL : 0 < L) (hx : GoodScalarKernelTuple s (1 / (B : ℝ)) B x) + (hroot : ∀ j, |root j| ≤ (L : ℤ)) (m : ℕ) [NeZero m] + (hp : integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s)) + (C : D → Matrix (Unit ⊕ I) N ℤ) (H : D → ℝ) (Q : D → N → ℝ) + (hH : ∀ d, 0 < H d) (hQ : ∀ d j, 0 < Q d j) (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + (hC : ∀ d i j, |(C d i j : ℝ)| * Q d j ≤ ξ * H d) + (hρ : 0 < ρ) (hscale : ∀ d, ρ ≤ H d / L) (hscaleQ : ∀ d j, ρ ≤ Q d j) + (hlarge : smoothSpatialMeshThreshold I J N L ≤ ρ) (hr : 0 < r) + (v : D → (Unit ⊕ I) → ℤ) + (hv : ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ) / H d| ≤ 1) : + let A := selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s + let A' := selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s + let hA := goodScalarKernelTuple_spatial_det_ne_zero s x root + (one_div_pos.mpr (by exact_mod_cast hB)) hx + let f := fun d => smoothSpatialKernelDensity s root (scalarCubeDifferenceMatrix x) hA + (H d) L (hH d) (by exact_mod_cast hL) + let G := (m : ℝ)^Fintype.card (Unit ⊕ I) + let E := smoothSpatialError N s B L ρ ξ + ‖(((∏ d, ∏ _i : Unit ⊕ I, H d) * + (smoothVectorSpatialOutputLaw root (scalarCubeDifferenceMatrix x) C H L Q hH + (by exact_mod_cast hL) hQ v).toReal : ℝ) : ℂ) - + ∏ d, spatialSiteApprox A (Matrix.fromCols A' (liftResidueMatrix (integerResidueMatrix (C d) m))) + m (f d) (H d) 1 r (v d)‖ ≤ + Fintype.card D * (E + 4*G*smoothSpatialDensityLip s B*r) * + (1 + G*smoothSpatialDensityCap s B + E)^Fintype.card D := by + dsimp only + rw [smoothVectorSpatialOutputLaw_scaled] + have hpfull (d : D) : integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s) (C d)) := by + rw [pivotFullImage_split] + exact hp.trans le_sup_left + have hi (d : D) : + ((pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s) (C d))).toAddSubgroup.index : ℝ) + ≤ (m : ℝ)^Fintype.card (Unit ⊕ I) := by + exact_mod_cast residueLatticeImage_index_le _ m (hpfull d) + have h := vectorSpatialSiteApprox_error _ _ m hpfull _ + (fun d => (smoothSpatialKernelDensity_bounds s x root hB hL (hH d) hx hroot).2) + H _ (by positivity) (smoothSpatialDensityCap_nonneg s B) + (smoothSpatialError_nonneg N s B L hρ.le hξ0) zero_lt_one hr hi + (fun d => (smoothSpatialKernelDensity_bounds s x root hB hL (hH d) hx hroot).1) + (fun d => smoothSpatial_original_error s x root hB hL (hH d) hx hroot (C d) (Q d) (hQ d) + hξ0 hξ1 (hC d) hρ (hscale d) (hscaleQ d) hlarge) v hv + rw [Real.coe_toNNReal _ (smoothSpatialDensityLip_nonneg s B)] at h + have hid (d : D) := congrFun (spatialSiteApprox_eq_residue + (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s) (C d) m hp + (smoothSpatialKernelDensity s root (scalarCubeDifferenceMatrix x) + (goodScalarKernelTuple_spatial_det_ne_zero s x root + (one_div_pos.mpr (by exact_mod_cast hB)) hx) (H d) L (hH d) (by exact_mod_cast hL)) + (H d) 1 r) (v d) + simpa only [← hid] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem principalVectorSpatial_site_error {D A α J N : Type*} + [Fintype A] [Fintype α] [DecidableEq α] [Fintype J] [DecidableEq J] + [Fintype N] [DecidableEq N] {B : D → Type*} {h : D → ℕ} + {L : PrincipalTupleIndex B h → ℕ} {ℓ M : ℕ} {ρ ξ r : ℝ} + (s : α ↪ J) (x : J → IntegerScalarCubeBox α ℓ) (root : J → ℤ) + (hM : 0 < M) (hℓ : 0 < ℓ) (hx : GoodScalarKernelTuple s (1/(M : ℝ)) M x) + (hroot : ∀ j, |root j| ≤ (ℓ : ℤ)) (m : ℕ) [NeZero m] + (hp : integerScalarLattice (Unit ⊕ α) (m : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s)) + (c : A → N → ℤ) (index : A → N → PrincipalTupleIndex B h) + (H : A → ℝ) (Q : A → N → ℝ) (hH : ∀ a, 0 < H a) (hQ : ∀ a n, 0 < Q a n) + (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + (hwidth : ∀ a n, ((|c a n| : ℤ)+(L (index a n) : ℤ) : ℝ)*Q a n ≤ ξ*H a) + (hρ : 0 < ρ) (hscale : ∀ a, ρ ≤ H a/ℓ) (hscaleQ : ∀ a n, ρ ≤ Q a n) + (hlarge : smoothSpatialMeshThreshold α J N ℓ ≤ ρ) (hr : 0 < r) + (y : PrincipalIntegerTuples B h α L) (v : A → (Unit ⊕ α) → ℤ) + (hv : ∀ a i, |((spatialStar (v a) i : ℤ) : ℝ)/H a| ≤ 1) : + let P := selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s + let F := selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s + let hP := goodScalarKernelTuple_spatial_det_ne_zero s x root + (one_div_pos.mpr (by exact_mod_cast hM)) hx + let f := fun a => smoothSpatialKernelDensity s root (scalarCubeDifferenceMatrix x) hP + (H a) ℓ (hH a) (by exact_mod_cast hℓ) + let G := (m : ℝ)^Fintype.card (Unit ⊕ α) + let E := smoothSpatialError N s M ℓ ρ ξ + ‖(((∏ a, ∏ _i : Unit ⊕ α, H a)* + (smoothVectorSpatialOutputLaw root (scalarCubeDifferenceMatrix x) + (fun a => principalSpatialColumns (c a) (index a) y) H ℓ Q hH + (by exact_mod_cast hℓ) hQ v).toReal : ℝ) : ℂ) - + ∏ a, spatialSiteApprox P + (Matrix.fromCols F (liftResidueMatrix + (principalSpatialResidueColumns m (c a) (index a) (principalResidueLabel m y)))) + m (f a) (H a) 1 r (v a)‖ ≤ + Fintype.card A*(E+4*G*smoothSpatialDensityLip s M*r)* + (1+G*smoothSpatialDensityCap s M+E)^Fintype.card A := by + dsimp only + have he := smoothVectorSpatial_site_error s x root hM hℓ hx hroot m hp + (fun a => principalSpatialColumns (c a) (index a) y) H Q hH hQ hξ0 hξ1 + (fun a i n => principalSpatialColumns_scaled_bound (c a) (index a) (Q a) + (fun n => (hQ a n).le) (hwidth a) y i n) + hρ hscale hscaleQ hlarge hr v hv + simpa only [principalSpatialColumns_residue] using he + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialTestComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialTestComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8f8496b9f8a096b1e7f696165140cc06b9a0d0b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/PrincipalSpatialTestComparison.lean @@ -0,0 +1,97 @@ +import OAI.Combinatorics.Progressions.Probability.PrincipalTestMixture + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem principalSpatial_mixed_test_comparison {D A α J N V : Type*} + [Fintype D] [DecidableEq D] [Fintype A] [Fintype α] [DecidableEq α] + [Fintype J] [DecidableEq J] [Fintype N] [DecidableEq N] + (B : D → Type*) [∀ d, Fintype (B d)] [∀ d, DecidableEq (B d)] (h : D → ℕ) + (L : PrincipalTupleIndex B h → ℕ) (hL : ∀ j, 0 < L j) + {ℓ M : ℕ} {ρ ξ r ε : ℝ} (s : α ↪ J) + (x : J → IntegerScalarCubeBox α ℓ) (root : J → ℤ) + (hM : 0 < M) (hℓ : 0 < ℓ) (hx : GoodScalarKernelTuple s (1/(M : ℝ)) M x) + (hroot : ∀ j, |root j| ≤ (ℓ : ℤ)) (m : ℕ) [NeZero m] (hm : 0 < m) + (hsize : ∀ j, (Fintype.card α+1)*m ≤ L j) + (hp : integerScalarLattice (Unit ⊕ α) (m : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s)) + (c : A → N → ℤ) (index : A → N → PrincipalTupleIndex B h) + (H : A → ℝ) (Q : A → N → ℝ) (hH : ∀ a, 0 < H a) (hQ : ∀ a n, 0 < Q a n) + (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + (hwidth : ∀ a n, ((|c a n| : ℤ)+(L (index a n) : ℤ) : ℝ)*Q a n ≤ ξ*H a) + (hρ : 0 < ρ) (hscale : ∀ a, ρ ≤ H a/ℓ) (hscaleQ : ∀ a n, ρ ≤ Q a n) + (hlarge : smoothSpatialMeshThreshold α J N ℓ ≤ ρ) (hr : 0 < r) + (t : Finset V) (out : V → A → (Unit ⊕ α) → ℤ) + (W : PrincipalIntegerTuples B h α L → V → ℝ) + (T : (PrincipalTupleIndex B h → Option α → ZMod m) → (V → ℂ) → ℂ) + (hT : ∀ rr z ψ, T rr (fun v => z * ψ v) = z * T rr ψ) + (hW : ∀ y, (principalTupleWeights (α := α) B h L hL).weight y ≠ 0 → ∀ v ∈ t, 0 ≤ W y v) + (hmass : ∀ y, (principalTupleWeights (α := α) B h L hL).weight y ≠ 0 → (∑ v ∈ t, W y v) ≤ 1) + (hbox : ∀ v ∈ t, ∀ a i, |((spatialStar (out v a) i : ℤ) : ℝ)/H a| ≤ 1) + (hcoeff : ∀ rr ψ, (∀ v ∈ t, ‖ψ v‖ ≤ 1) → + ‖(principalResidueWeights B h L hL m hm rr hsize).complexMean + (fun y => ∑ v ∈ t, (W y v : ℂ) * ψ v) - T rr ψ‖ ≤ ε) + (φ : V → ℂ) (hφ : ∀ v ∈ t, ‖φ v‖ ≤ 1) : + let P := selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s + let F := selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s + let hP := goodScalarKernelTuple_spatial_det_ne_zero s x root + (one_div_pos.mpr (by exact_mod_cast hM)) hx + let f := fun a => smoothSpatialKernelDensity s root (scalarCubeDifferenceMatrix x) hP + (H a) ℓ (hH a) (by exact_mod_cast hℓ) + let G := (m : ℝ)^Fintype.card (Unit ⊕ α) + let E := smoothSpatialError N s M ℓ ρ ξ + let source := principalTupleWeights (α := α) B h L hL + let residues := source.fiberLaw (principalResidueLabel m) + let site := fun rr v => ∏ a, spatialSiteApprox P + (Matrix.fromCols F (liftResidueMatrix (principalSpatialResidueColumns m (c a) (index a) rr))) + m (f a) (H a) 1 r (out v a) + ‖source.complexMean (fun y => ∑ v ∈ t, (W y v : ℂ) * + (((∏ a, ∏ _i : Unit ⊕ α, H a) * + (smoothVectorSpatialOutputLaw root (scalarCubeDifferenceMatrix x) + (fun a => principalSpatialColumns (c a) (index a) y) H ℓ Q hH + (by exact_mod_cast hℓ) hQ (out v)).toReal : ℝ) : ℂ) * φ v) - + residues.complexMean (fun rr => T rr (fun v => site rr v * φ v))‖ ≤ + Fintype.card A * (E + 4 * G * smoothSpatialDensityLip s M * r) * + (1 + G * smoothSpatialDensityCap s M + E)^Fintype.card A + + (1 + (G * smoothSpatialDensityCap s M)^Fintype.card A) * ε := by + dsimp only + have hE := smoothSpatialError_nonneg N s M ℓ hρ.le hξ0 + have hC := smoothSpatialDensityCap_nonneg s M + have hK := smoothSpatialDensityLip_nonneg s M + let Csite := ((m : ℝ)^Fintype.card (Unit ⊕ α) * smoothSpatialDensityCap s M)^Fintype.card A + have hCsite : 0 ≤ Csite := by dsimp [Csite]; positivity + have hcap (rr) (v) (hv : v ∈ t) := residueSpatialSite_norm_le + (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s) m hp + (fun a => smoothSpatialKernelDensity s root (scalarCubeDifferenceMatrix x) + (goodScalarKernelTuple_spatial_det_ne_zero s x root (one_div_pos.mpr (by exact_mod_cast hM)) hx) + (H a) ℓ (hH a) (by exact_mod_cast hℓ)) H zero_lt_one hr hC + (fun a => (smoothSpatialKernelDensity_bounds s x root hM hℓ (hH a) hx hroot).1) + (fun a => principalSpatialResidueColumns m (c a) (index a) rr) (out v) (hbox v hv) + have he := principal_mixed_test_comparison B h L hL m hm hsize t W + (fun y v => (((∏ a, ∏ _i : Unit ⊕ α, H a) * + (smoothVectorSpatialOutputLaw root (scalarCubeDifferenceMatrix x) + (fun a => principalSpatialColumns (c a) (index a) y) H ℓ Q hH + (by exact_mod_cast hℓ) hQ (out v)).toReal : ℝ) : ℂ)) + _ T hT (fun _ => 1 + Csite) (fun _ => ε) (fun _ => by positivity) + (fun rr v hv => (hcap rr v hv).trans (le_add_of_nonneg_left zero_le_one)) + (δ := Fintype.card A * (smoothSpatialError N s M ℓ ρ ξ + + 4 * (m : ℝ)^Fintype.card (Unit ⊕ α) * smoothSpatialDensityLip s M * r) * + (1 + (m : ℝ)^Fintype.card (Unit ⊕ α) * smoothSpatialDensityCap s M + + smoothSpatialError N s M ℓ ρ ξ)^Fintype.card A) + (by positivity) hW hmass + (fun y _ v hv => principalVectorSpatial_site_error s x root hM hℓ hx hroot m hp c index H Q hH hQ + hξ0 hξ1 hwidth hρ hscale hscaleQ hlarge hr y (out v) (hbox v hv)) hcoeff φ hφ + simpa only [FiniteProbabilityWeights.mean_const] using he + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProductChartReference.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProductChartReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..9dff21f16398e96b71c6172ec55d0aed980573df --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProductChartReference.lean @@ -0,0 +1,45 @@ +import Mathlib.MeasureTheory.Constructions.Pi + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ENNReal + +theorem ennreal_smul_sigmaFinite {X : Type*} [MeasurableSpace X] + (μ : Measure X) [SigmaFinite μ] (c : ℝ≥0∞) (hc : c ≠ ∞) : SigmaFinite (c • μ) where + out' := ⟨{ + set := spanningSets μ + set_mem := fun _ => trivial + finite := by + intro i + rw [Measure.smul_apply, smul_eq_mul] + exact ENNReal.mul_lt_top hc.lt_top (measure_spanningSets_lt_top μ i) + spanning := iUnion_spanningSets μ }⟩ + +theorem piChart_reference_map {I : Type*} [Fintype I] {X Y : I → Type*} + [∀ i, MeasurableSpace (X i)] [∀ i, MeasurableSpace (Y i)] + (μ : ∀ i, Measure (X i)) [∀ i, SigmaFinite (μ i)] + (ν : ∀ i, Measure (Y i)) [∀ i, SigmaFinite (ν i)] + (q : ∀ i, X i → Y i) (hq : ∀ i, Measurable (q i)) (S : ∀ i, Set (X i)) + (hmap : ∀ i, ((μ i).restrict (S i)).map (q i) = (ν i).restrict (q i '' S i)) : + ((Measure.pi μ).restrict (Set.univ.pi S)).map (fun x i => q i (x i)) = + (Measure.pi ν).restrict ((fun x i => q i (x i)) '' Set.univ.pi S) := by + let : ∀ i, SigmaFinite (((μ i).restrict (S i)).map (q i)) := by + intro i + rw [hmap i] + infer_instance + rw [Measure.restrict_pi_pi, Measure.pi_map_pi (fun i => (hq i).aemeasurable)] + simp_rw [hmap] + rw [← Measure.restrict_pi_pi] + congr 1 + exact (Set.piMap_image_univ_pi q S).symm + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProductComponentCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProductComponentCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..06ccd1ae28bdba24da55145c9d91fb1a53c15f85 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProductComponentCoordinates.lean @@ -0,0 +1,36 @@ +import OAI.Combinatorics.Progressions.Linear.TripleProductBasisBounds + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module + +variable {ι : Type*} [Fintype ι] {L : ι → Type*} + [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] {s : ℕ} {d : ι → ℕ} + (D : ∀ i, RationalFilteredNilmanifold (L i) s (d i)) + +theorem productFinBasis_repr_component (x : ∀ i, L i) (a : ι) (k : Fin (d a)) : + (D a).basis.repr (x a) k = + (pi D).basis.repr x (Fintype.equivFin (Σ i, Fin (d i)) ⟨a, k⟩) := by + symm + exact (productFinBasis_repr D x _).trans + (congrArg (fun z : Σ i, Fin (d i) => (D z.1).basis.repr (x z.1) z.2) + (Equiv.symm_apply_apply _ _)) + +theorem product_componentMap_logHeight {H κ : Type*} [LieRing H] [LieAlgebra ℚ H] + (b : Basis κ ℚ H) (φ : H →ₗ⁅ℚ⁆ (∀ i, L i)) {p : ℝ} + (hφ : ∀ i j, rationalLogHeight ((pi D).basis.repr (φ (b j)) i) ≤ p) : + ∀ a i j, rationalLogHeight ((D a).basis.repr (((liePiEval a).comp φ) (b j)) i) ≤ p := by + intro a i j + change rationalLogHeight ((D a).basis.repr ((φ (b j)) a) i) ≤ p + rw [productFinBasis_repr_component D] + exact hφ _ j + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProductEquivTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProductEquivTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a6877c3bbe1389107a6a3c13a0f2dbc457bf1a2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProductEquivTransport.lean @@ -0,0 +1,173 @@ +import OAI.Combinatorics.Progressions.Estimates.ObservedSourceEquivalence +import OAI.Combinatorics.Progressions.Linear.ProductANOVAEnergyOrder + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + +omit [DecidableEq ι] [∀ i, Fintype (Y i)] in +theorem productCoordinate_indicator (x y : ∀ i, Y i) : + (if x = y then (1 : ℝ) else 0) = ∏ i, if x i = y i then (1 : ℝ) else 0 := by + classical + by_cases h : x = y + · subst y + simp + · rw [ite_eq_right h] + obtain ⟨i, hi⟩ : ∃ i, x i ≠ y i := by + by_contra hn + push Not at hn + exact h (funext hn) + exact (Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hi])).symm + +theorem productMean_coordinate_transport (p : ∀ i, FiniteProbabilityWeights (X i)) + (q : ∀ i, FiniteProbabilityWeights (Y i)) (F : ∀ i, X i → Y i) + (hF : ∀ i (f : Y i → ℝ), (p i).mean (fun x => f (F i x)) = (q i).mean f) + (f : (∀ i, Y i) → ℝ) : + (FiniteProbabilityWeights.pi p).mean (fun x => f (fun i => F i (x i))) = + (FiniteProbabilityWeights.pi q).mean f := by + classical + have he (x : ∀ i, X i) : f (fun i => F i (x i)) = + ∑ y : ∀ i, Y i, f y * ∏ i, if F i (x i) = y i then (1 : ℝ) else 0 := by + simp_rw [← productCoordinate_indicator] + simp + have hi (i : ι) (y : Y i) : (p i).mean (fun z => if F i z = y then (1 : ℝ) else 0) = + (q i).weight y := by + rw [hF i (fun z => if z = y then (1 : ℝ) else 0)] + simp [FiniteProbabilityWeights.mean] + have hp (y : ∀ i, Y i) : (FiniteProbabilityWeights.pi p).mean + (fun x => ∏ i, if F i (x i) = y i then (1 : ℝ) else 0) = ∏ i, (q i).weight (y i) := by + rw [FiniteProbabilityWeights.mean_pi_product p (fun i z => if F i z = y i then (1 : ℝ) else 0)] + exact Finset.prod_congr rfl (fun i _ => hi i (y i)) + simp_rw [he, FiniteProbabilityWeights.mean_sum, FiniteProbabilityWeights.mean_const_mul, hp] + unfold FiniteProbabilityWeights.mean + apply Finset.sum_congr rfl + intro y _ + change f y * (∏ i, (q i).weight (y i)) = (∏ i, (q i).weight (y i)) * f y + ring + +omit [Fintype ι] [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] in +theorem productCoordinateMix_map (F : ∀ i, X i → Y i) (S : Finset ι) (x y : ∀ i, X i) : + (fun i => F i (productCoordinateMix S x y i)) = + productCoordinateMix S (fun i => F i (x i)) (fun i => F i (y i)) := by + funext i + by_cases hi : i ∈ S <;> simp [productCoordinateMix, hi] + +theorem productConditionalMean_coordinate_transport (p : ∀ i, FiniteProbabilityWeights (X i)) + (q : ∀ i, FiniteProbabilityWeights (Y i)) (F : ∀ i, X i → Y i) + (hF : ∀ i (f : Y i → ℝ), (p i).mean (fun x => f (F i x)) = (q i).mean f) + (S : Finset ι) (f : (∀ i, Y i) → ℝ) (x : ∀ i, X i) : + productConditionalMean p S (fun y => f (fun i => F i (y i))) x = + productConditionalMean q S f (fun i => F i (x i)) := by + simp only [productConditionalMean, productCoordinateMix_map] + exact productMean_coordinate_transport p q F hF + (fun y => f (productCoordinateMix S (fun i => F i (x i)) y)) + +theorem productANOVA_coordinate_transport (p : ∀ i, FiniteProbabilityWeights (X i)) + (q : ∀ i, FiniteProbabilityWeights (Y i)) (F : ∀ i, X i → Y i) + (hF : ∀ i (f : Y i → ℝ), (p i).mean (fun x => f (F i x)) = (q i).mean f) + (S : Finset ι) (f : (∀ i, Y i) → ℝ) (x : ∀ i, X i) : + productANOVA p S (fun y => f (fun i => F i (y i))) x = + productANOVA q S f (fun i => F i (x i)) := by + simp only [productANOVA, productConditionalMean_coordinate_transport p q F hF] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + (μ : ∀ i, FiniteProbabilityWeights (X i)) (ν : ∀ i, FiniteProbabilityWeights (Y i)) + +theorem productANOVATruncation_coordinate_transport (F : ∀ i, X i → Y i) + (hF : ∀ i (f : Y i → ℝ), (μ i).mean (fun x => f (F i x)) = (ν i).mean f) + (D : Finset (Finset ι)) (f : (∀ i, Y i) → ℝ) (x : ∀ i, X i) : + productANOVATruncation μ D (fun y => f (fun i => F i (y i))) x = + productANOVATruncation ν D f (fun i => F i (x i)) := by + simp only [productANOVATruncation, productANOVA_coordinate_transport μ ν F hF] + +theorem productANOVAEnergy_coordinate_transport (F : ∀ i, X i → Y i) + (hF : ∀ i (f : Y i → ℝ), (μ i).mean (fun x => f (F i x)) = (ν i).mean f) + (D : Finset (Finset ι)) (f : (∀ i, Y i) → ℝ) : + productANOVAEnergy μ D (fun x => f (fun i => F i (x i))) = productANOVAEnergy ν D f := by + unfold productANOVAEnergy + apply Finset.sum_congr rfl + intro S _ + simp only [productANOVA_coordinate_transport μ ν F hF] + exact productMean_coordinate_transport μ ν F hF (fun y => productANOVA ν S f y ^ 2) + +theorem productSectionAverage_coordinate_transport (F : ∀ i, X i → Y i) + (hF : ∀ i (f : Y i → ℝ), (μ i).mean (fun x => f (F i x)) = (ν i).mean f) + (T A : Finset ι) (z : ∀ i, X i) (f : (∀ i, Y i) → ℝ) (x : ∀ i, X i) : + productSectionAverage μ T A z (fun y => f (fun i => F i (y i))) x = + productSectionAverage ν T A (fun i => F i (z i)) f (fun i => F i (x i)) := by + simp only [productSectionAverage, productCoordinateMix_map] + exact productMean_coordinate_transport μ ν F hF + (fun y => f (productCoordinateMix T (productCoordinateMix A (fun i => F i (z i)) y) + (fun i => F i (x i)))) + +theorem productWeight_coordinate_equiv (e : ∀ i, X i ≃ Y i) + (hweight : ∀ i x, (ν i).weight (e i x) = (μ i).weight x) (x : ∀ i, X i) : + (FiniteProbabilityWeights.pi ν).weight (fun i => e i (x i)) = + (FiniteProbabilityWeights.pi μ).weight x := by + exact Finset.prod_congr rfl (fun i _ => hweight i (x i)) + +theorem observedProductDensity_coordinate_equiv {Ω : Type*} [Fintype Ω] + (e : ∀ i, X i ≃ Y i) (hweight : ∀ i x, (ν i).weight (e i x) = (μ i).weight x) + (p : FiniteProbabilityWeights Ω) (F : Ω → ∀ i, X i) (w : Ω → ℝ) (x : ∀ i, X i) : + observedProductDensity ν p (fun z i => e i (F z i)) w (fun i => e i (x i)) = + observedProductDensity μ p F w x := by + unfold observedProductDensity finiteWeightDensity + rw [productWeight_coordinate_equiv μ ν e hweight] + congr 1 + exact p.fiberMean_equiv (Equiv.piCongrRight e) F w x + +theorem observedProductDensity_coordinate_energy {Ω : Type*} [Fintype Ω] + (e : ∀ i, X i ≃ Y i) (hweight : ∀ i x, (ν i).weight (e i x) = (μ i).weight x) + (p : FiniteProbabilityWeights Ω) (F : Ω → ∀ i, X i) (w : Ω → ℝ) (D : Finset (Finset ι)) : + productANOVAEnergy μ D (observedProductDensity μ p F w) = + productANOVAEnergy ν D (observedProductDensity ν p (fun z i => e i (F z i)) w) := by + rw [← productANOVAEnergy_coordinate_transport μ ν (fun i => e i) + (fun i => (μ i).mean_equiv (ν i) (e i) (hweight i))] + congr 1 + funext x + exact (observedProductDensity_coordinate_equiv μ ν e hweight p F w x).symm + +theorem productMarginalsClose_coordinate_equiv_iff (e : ∀ i, X i ≃ Y i) + (hweight : ∀ i x, (ν i).weight (e i x) = (μ i).weight x) + (f : (∀ i, Y i) → ℝ) (η : ℝ) (r : ℕ) : + ProductMarginalsClose ν f η r ↔ ProductMarginalsClose μ (fun x => f (fun i => e i (x i))) η r := by + have hmean := fun i => (μ i).mean_equiv (ν i) (e i) (hweight i) + constructor + · intro h S hS x hx + rw [productConditionalMean_coordinate_transport μ ν (fun i => e i) hmean] + apply h S hS + rw [productWeight_coordinate_equiv μ ν e hweight] + exact hx + · intro h S hS y hy + let x : ∀ i, X i := fun i => (e i).symm (y i) + have he : (fun i => e i (x i)) = y := by funext i; exact (e i).apply_symm_apply (y i) + have hx : (FiniteProbabilityWeights.pi μ).weight x ≠ 0 := by + rw [← productWeight_coordinate_equiv μ ν e hweight x, he] + exact hy + have hh := h S hS x hx + rw [productConditionalMean_coordinate_transport μ ν (fun i => e i) hmean, he] at hh + exact hh + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProductEuclideanCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProductEuclideanCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..78c3eda9d3286341ab9ee36372edeaa5245f48dd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProductEuclideanCoordinates.lean @@ -0,0 +1,66 @@ +import Mathlib.Algebra.Order.BigOperators.Ring.Finset +import Mathlib.Analysis.InnerProductSpace.PiL2 +import Mathlib.LinearAlgebra.Pi + +namespace OAI + +section + +namespace Erdos3 + +theorem euclidean_norm_le_sum_abs {ι : Type*} [Fintype ι] (x : EuclideanSpace ℝ ι) : + ‖x‖ ≤ ∑ i, |x i| := by + have hsq := Finset.sum_sq_le_sq_sum_of_nonneg + (s := Finset.univ) (f := fun i => ‖x i‖) (fun i _ => norm_nonneg (x i)) + have he := PiLp.norm_sq_eq_of_L2 (fun _ : ι => ℝ) x + have hn := Finset.sum_nonneg (fun i (_ : i ∈ Finset.univ) => norm_nonneg (x i)) + have h : ‖x‖ ≤ ∑ i, ‖x i‖ := by nlinarith [norm_nonneg x] + simpa only [Real.norm_eq_abs] using h + +variable {σ κ : Type*} [Fintype σ] [Fintype κ] + +noncomputable def productEuclideanEquiv : + ((σ → ℝ) × (κ → ℝ)) ≃ₗ[ℝ] EuclideanSpace ℝ (σ ⊕ κ) := + (LinearEquiv.sumArrowLequivProdArrow σ κ ℝ ℝ).symm.trans + (EuclideanSpace.equiv (σ ⊕ κ) ℝ).symm.toLinearEquiv + +omit [Fintype σ] [Fintype κ] in +@[simp] theorem productEuclideanEquiv_apply_inl (x : (σ → ℝ) × (κ → ℝ)) (i : σ) : + productEuclideanEquiv x (Sum.inl i) = x.1 i := rfl + +omit [Fintype σ] [Fintype κ] in +@[simp] theorem productEuclideanEquiv_apply_inr (x : (σ → ℝ) × (κ → ℝ)) (j : κ) : + productEuclideanEquiv x (Sum.inr j) = x.2 j := rfl + +theorem productEuclideanEquiv_norm_le (x : (σ → ℝ) × (κ → ℝ)) : + ‖productEuclideanEquiv x‖ ≤ ((Fintype.card σ + Fintype.card κ : ℕ) : ℝ) * ‖x‖ := by + calc + _ ≤ ∑ i : σ ⊕ κ, |productEuclideanEquiv x i| := euclidean_norm_le_sum_abs _ + _ ≤ ∑ _i : σ ⊕ κ, ‖x‖ := by + apply Finset.sum_le_sum + intro i _ + cases i with + | inl i => + simpa only [productEuclideanEquiv_apply_inl, ← Real.norm_eq_abs] using + (norm_le_pi_norm x.1 i).trans (norm_fst_le x) + | inr j => + simpa only [productEuclideanEquiv_apply_inr, ← Real.norm_eq_abs] using + (norm_le_pi_norm x.2 j).trans (norm_snd_le x) + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, Fintype.card_sum, nsmul_eq_mul] + +theorem norm_le_productEuclideanEquiv (x : (σ → ℝ) × (κ → ℝ)) : + ‖x‖ ≤ ‖productEuclideanEquiv x‖ := by + rw [Prod.norm_def] + apply max_le + · apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr + intro i + exact PiLp.norm_apply_le (productEuclideanEquiv x) (Sum.inl i) + · apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr + intro j + exact PiLp.norm_apply_le (productEuclideanEquiv x) (Sum.inr j) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProductMarginalSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProductMarginalSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0a20fdb76fab0fa8a6e44bdeb3a6f9188a7ada3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProductMarginalSupport.lean @@ -0,0 +1,43 @@ +import OAI.Combinatorics.Progressions.Probability.ObservedProductDensity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {I : Type*} [Fintype I] [DecidableEq I] {X : I → Type*} + [∀ i, Fintype (X i)] (μ : ∀ i, FiniteProbabilityWeights (X i)) + +theorem productLaw_supported_of_singleton_marginals (w : (∀ i, X i) → ℝ) + (hw : ∀ x, 0 ≤ w x) {η : ℝ} + (he : ∀ i x, + |productFiberMass w {i} x - productFiberMass (FiniteProbabilityWeights.pi μ).weight {i} x| ≤ + η * productFiberMass (FiniteProbabilityWeights.pi μ).weight {i} x) : + ∀ x, (FiniteProbabilityWeights.pi μ).weight x = 0 → w x = 0 := by + intro x hx + change (∏ i, (μ i).weight (x i)) = 0 at hx + obtain ⟨i, _, hi⟩ := Finset.prod_eq_zero_iff.mp hx + have hbase : productFiberMass (FiniteProbabilityWeights.pi μ).weight {i} x = 0 := by + unfold productFiberMass + apply Finset.sum_eq_zero + intro y _ + by_cases hy : ∀ j ∈ ({i} : Finset I), y j = x j + · have hp : (FiniteProbabilityWeights.pi μ).weight y = 0 := by + change (∏ j, (μ j).weight (y j)) = 0 + apply Finset.prod_eq_zero (Finset.mem_univ i) + rw [hy i (Finset.mem_singleton_self i), hi] + rw [hp, zero_mul] + · simp only [productFiberIndicator, hy, ite_false, mul_zero] + have h := he i x + rw [hbase, sub_zero, mul_zero] at h + exact le_antisymm ((weight_le_productFiberMass w hw {i} x).trans + ((le_abs_self _).trans h)) (hw x) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProductSectionSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProductSectionSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b078982657cb47d0d0b23a91d5ea8a08f4b9a34 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProductSectionSupport.lean @@ -0,0 +1,94 @@ +import OAI.Combinatorics.Progressions.Estimates.CorrelationDerivative + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {I : Type*} [DecidableEq I] {X : I → Type*} + +def productCoordinateMix (S : Finset I) (x y : ∀ i, X i) : ∀ i, X i := + fun i => if i ∈ S then x i else y i + +theorem productCoordinateMix_self (S : Finset I) (x : ∀ i, X i) : + productCoordinateMix S x x = x := by + funext i + simp [productCoordinateMix] + +theorem productCoordinateMix_empty (x y : ∀ i, X i) : + productCoordinateMix ∅ x y = y := by + funext i + simp [productCoordinateMix] + +theorem productCoordinateMix_univ [Fintype I] (x y : ∀ i, X i) : + productCoordinateMix Finset.univ x y = x := by + funext i + simp [productCoordinateMix] + +theorem productCoordinateMix_swap (S : Finset I) (x y : ∀ i, X i) : + productCoordinateMix S (productCoordinateMix S x y) (productCoordinateMix S y x) = x := by + funext i + by_cases hi : i ∈ S <;> simp [productCoordinateMix, hi] + +theorem productCoordinateMix_comp (S T : Finset I) (x y z : ∀ i, X i) : + productCoordinateMix T (productCoordinateMix S x y) z = + productCoordinateMix (S ∩ T) x (productCoordinateMix T y z) := by + funext i + by_cases hs : i ∈ S <;> by_cases ht : i ∈ T <;> + simp [productCoordinateMix, hs, ht] + +theorem productCoordinateMix_left (S : Finset I) (x y z : ∀ i, X i) : + productCoordinateMix S (productCoordinateMix S x y) z = productCoordinateMix S x z := by + funext i + by_cases hi : i ∈ S <;> simp [productCoordinateMix, hi] + +def productCoordinateSwap (S : Finset I) : ((∀ i, X i) × (∀ i, X i)) ≃ + ((∀ i, X i) × (∀ i, X i)) where + toFun p := (productCoordinateMix S p.1 p.2, productCoordinateMix S p.2 p.1) + invFun p := (productCoordinateMix S p.1 p.2, productCoordinateMix S p.2 p.1) + left_inv p := by simp [productCoordinateMix_swap] + right_inv p := by simp [productCoordinateMix_swap] + +variable [Fintype I] [∀ i, Fintype (X i)] + +theorem productCoordinateMix_weight (μ : ∀ i, FiniteProbabilityWeights (X i)) + (S : Finset I) (x y : ∀ i, X i) : + (FiniteProbabilityWeights.pi μ).weight (productCoordinateMix S x y) * + (FiniteProbabilityWeights.pi μ).weight (productCoordinateMix S y x) = + (FiniteProbabilityWeights.pi μ).weight x * (FiniteProbabilityWeights.pi μ).weight y := by + change (∏ i, (μ i).weight (productCoordinateMix S x y i)) * + (∏ i, (μ i).weight (productCoordinateMix S y x i)) = + (∏ i, (μ i).weight (x i)) * (∏ i, (μ i).weight (y i)) + rw [← Finset.prod_mul_distrib, ← Finset.prod_mul_distrib] + apply Finset.prod_congr rfl + intro i _ + by_cases hi : i ∈ S <;> simp [productCoordinateMix, hi, mul_comm] + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {I : Type*} [Fintype I] [DecidableEq I] {X : I → Type*} + [∀ i, Fintype (X i)] + +theorem productCoordinateMix_weight_ne_zero (μ : ∀ i, FiniteProbabilityWeights (X i)) + (T : Finset I) (z x : ∀ i, X i) + (hz : (FiniteProbabilityWeights.pi μ).weight z ≠ 0) + (hx : (FiniteProbabilityWeights.pi μ).weight x ≠ 0) : + (FiniteProbabilityWeights.pi μ).weight (productCoordinateMix T z x) ≠ 0 := by + have h := mul_ne_zero hz hx + rw [← productCoordinateMix_weight μ T z x] at h + exact (mul_ne_zero_iff.mp h).1 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProductTupleSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProductTupleSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..95545ee41bad82d5efdfa9c72a6c146d089f12d8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProductTupleSupport.lean @@ -0,0 +1,46 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteGoodPartTransfer +import OAI.Combinatorics.Progressions.Estimates.ProductMeanPullback + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {I J : Type*} [Fintype I] [Fintype J] [DecidableEq I] [DecidableEq J] + {X : I → Type*} [∀ i, Fintype (X i)] + +theorem productTuplePoint_weight_ne_zero (μ : ∀ i, FiniteProbabilityWeights (X i)) + (a : J → I) (ha : Function.Injective a) (v : ∀ j, X (a j)) (base : ∀ i, X i) + (hb : (FiniteProbabilityWeights.pi μ).weight base ≠ 0) + (hv : (FiniteProbabilityWeights.pi (fun j => μ (a j))).weight v ≠ 0) : + (FiniteProbabilityWeights.pi μ).weight (productTuplePoint a ha v base) ≠ 0 := by + change (∏ i, (μ i).weight (base i)) ≠ 0 at hb + change (∏ j, (μ (a j)).weight (v j)) ≠ 0 at hv + change (∏ i, (μ i).weight (productTuplePoint a ha v base i)) ≠ 0 + apply Finset.prod_ne_zero_iff.mpr + intro i _ + by_cases hi : i ∈ Finset.univ.image a + · obtain ⟨j, _, rfl⟩ := Finset.mem_image.mp hi + rw [productTuplePoint_apply] + exact Finset.prod_ne_zero_iff.mp hv j (Finset.mem_univ j) + · have he : productTuplePoint a ha v base i = base i := by + simp only [productTuplePoint, productSubtypePoint, hi, dite_false] + rw [he] + exact Finset.prod_ne_zero_iff.mp hb i (Finset.mem_univ i) + +theorem exists_positive_productTuplePoint (μ : ∀ i, FiniteProbabilityWeights (X i)) + (a : J → I) (ha : Function.Injective a) (v : ∀ j, X (a j)) + (hv : (FiniteProbabilityWeights.pi (fun j => μ (a j))).weight v ≠ 0) : + ∃ x : ∀ i, X i, (FiniteProbabilityWeights.pi μ).weight x ≠ 0 ∧ ∀ j, x (a j) = v j := by + obtain ⟨base, hb⟩ := (FiniteProbabilityWeights.pi μ).exists_weight_ne_zero + exact ⟨productTuplePoint a ha v base, productTuplePoint_weight_ne_zero μ a ha v base hb hv, + productTuplePoint_apply a ha v base⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionCoordinateResampling.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionCoordinateResampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..056c1d4ae2a55ff8f86339d8bd4447e40217418b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionCoordinateResampling.lean @@ -0,0 +1,111 @@ +import OAI.Combinatorics.Progressions.Estimates.ComplexFiniteMeans + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {G R : Type*} [DecidableEq R] {X : G → R → Type*} + +def resampleGroupCoordinates (label : G → R) (c : ∀ g r, X g r) + (t : ∀ g, X g (label g)) : ∀ g r, X g r := + fun g => Function.update (c g) (label g) (t g) + +@[simp] theorem resampleGroupCoordinates_selected (label : G → R) + (c : ∀ g r, X g r) (t : ∀ g, X g (label g)) (g : G) : + resampleGroupCoordinates label c t g (label g) = t g := by + simp only [resampleGroupCoordinates, Function.update_self] + +def groupCoordinateResamplingEquiv (label : G → R) : + ((∀ g r, X g r) × (∀ g, X g (label g))) ≃ + ((∀ g r, X g r) × (∀ g, X g (label g))) where + toFun p := (resampleGroupCoordinates label p.1 p.2, fun g => p.1 g (label g)) + invFun p := (resampleGroupCoordinates label p.1 p.2, fun g => p.1 g (label g)) + left_inv p := by + apply Prod.ext + · funext g r + by_cases hr : r = label g + · subst r + simp only [resampleGroupCoordinates, Function.update_self] + · simp only [resampleGroupCoordinates, Function.update_of_ne hr] + · funext g + exact resampleGroupCoordinates_selected label p.1 p.2 g + right_inv p := by + apply Prod.ext + · funext g r + by_cases hr : r = label g + · subst r + simp only [resampleGroupCoordinates, Function.update_self] + · simp only [resampleGroupCoordinates, Function.update_of_ne hr] + · funext g + exact resampleGroupCoordinates_selected label p.1 p.2 g + +theorem expect_resampleGroupCoordinates [Fintype G] [DecidableEq G] [Fintype R] + [∀ g r, Fintype (X g r)] [∀ g r, Nonempty (X g r)] + (label : G → R) (F : (∀ g r, X g r) → ℂ) : + (𝔼 c : ∀ g r, X g r, 𝔼 t : ∀ g, X g (label g), + F (resampleGroupCoordinates label c t)) = 𝔼 c : ∀ g r, X g r, F c := by + have he := Fintype.expect_equiv (groupCoordinateResamplingEquiv (X := X) label) + (fun p => F (resampleGroupCoordinates label p.1 p.2)) (fun p => F p.1) + (fun _ => rfl) + simpa only [← Finset.univ_product_univ, Finset.expect_product, Fintype.expect_const] using he + +theorem exists_frozen_group_bias [Fintype G] [DecidableEq G] [Fintype R] + [∀ g r, Fintype (X g r)] [∀ g r, Nonempty (X g r)] + (label : G → R) (F : (∀ g r, X g r) → ℂ) {ζ : ℝ} + (hζ : ζ ≤ ‖𝔼 c : ∀ g r, X g r, F c‖) : + ∃ c : ∀ g r, X g r, + ζ ≤ ‖𝔼 t : ∀ g, X g (label g), F (resampleGroupCoordinates label c t)‖ := by + rw [← expect_resampleGroupCoordinates label F] at hζ + have h := hζ.trans (RCLike.norm_expect_le (K := ℂ)) + obtain ⟨c, _, hc⟩ := Finset.exists_le_of_le_expect Finset.univ_nonempty h + exact ⟨c, hc⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem intervalCoordinates_resample {G R : Type*} [DecidableEq R] + (N : G → R → ℕ) (u : G → R → ℝ) (label : G → R) + (c : ∀ g r, Fin (N g r)) (t : ∀ g, Fin (N g (label g))) : + resampleGroupCoordinates label (fun g r => u g r+((c g r).val : ℝ)) + (fun g => u g (label g)+((t g).val : ℝ)) = + (fun g r => u g r+((resampleGroupCoordinates label c t g r).val : ℝ)) := by + funext g r + by_cases hr : r = label g + · subst r + simp [resampleGroupCoordinates] + · simp [resampleGroupCoordinates, hr] + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem progressionCoordinates_resample {G R : Type*} [DecidableEq R] + (N : G → R → ℕ) (u v : G → R → ℝ) (label : G → R) + (c : ∀ g r, Fin (N g r)) (t : ∀ g, Fin (N g (label g))) : + resampleGroupCoordinates label (fun g r => u g r+v g r*((c g r).val : ℝ)) + (fun g => u g (label g)+v g (label g)*((t g).val : ℝ)) = + (fun g r => u g r+v g r*((resampleGroupCoordinates label c t g r).val : ℝ)) := by + funext g r + by_cases hr : r = label g + · subst r + simp [resampleGroupCoordinates] + · simp [resampleGroupCoordinates, hr] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionEndpointUnitBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionEndpointUnitBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..08fb9cb97e945b8c96f24f52a86c0eefbc16c0e5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionEndpointUnitBox.lean @@ -0,0 +1,33 @@ +import OAI.Combinatorics.Progressions.Estimates.DenseProgressionInnerFamily + +namespace OAI + +section + +namespace Erdos3 + +theorem progression_slice_endpoint_unit_box {S step H : ℕ} (c : ℤ) + (hS : 0 < S) (hstep : 0 < step) (hH : 0 < H) + (hcontained : integerProgressionSupport c (step : ℤ) H ⊆ + Finset.Ico (0 : ℤ) (S : ℤ)) : + 0 ≤ (c : ℝ) / S ∧ + 0 ≤ (step : ℝ) * ((H - 1 : ℕ) : ℝ) / S ∧ + (c : ℝ) / S + (step : ℝ) * ((H - 1 : ℕ) : ℝ) / S ≤ 1 := by + have hfirst := hcontained (integerProgressionSupport_point c step H hstep 0 hH) + have hlast := hcontained (integerProgressionSupport_point c step H hstep + (H - 1) (by omega)) + have hc : (0 : ℝ) ≤ c := by + have he : (0 : ℤ) ≤ c := by simpa using (Finset.mem_Ico.mp hfirst).1 + exact_mod_cast he + have hend : (c : ℝ) + (step : ℝ) * ((H - 1 : ℕ) : ℝ) < S := by + exact_mod_cast (Finset.mem_Ico.mp hlast).2 + have hSreal : (0 : ℝ) < S := by exact_mod_cast hS + refine ⟨div_nonneg hc hSreal.le, by positivity, ?_⟩ + rw [← add_div] + exact (div_le_one hSreal).mpr hend.le + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionGeometricApproximation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionGeometricApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a67d43472ea0f359e7497b33badae9809061373 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionGeometricApproximation.lean @@ -0,0 +1,84 @@ +import OAI.Combinatorics.Progressions.Lattices.AffineModerateGeometricApproximation + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem progressionCube_geometric_approximation {b n K : ℕ} [NeZero b] [NeZero K] (q : ℕ) + (m H : Fin b → Fin (n + 1) → ℕ) (c : Fin b → Fin (n + 1) → ℤ) + (hL : ∀ a j, 0 < m a j * H a j) (hm : ∀ a j, 0 < m a j) + (hsize : ∀ a j, (q + 1) * m a j ≤ m a j * H a j) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (M : ℕ) (hM : ∀ a j, m a j ≤ M) + {O F D E ε : ℝ} (hO : 0 ≤ O) (hD : 0 ≤ D) (hE : 0 ≤ E) (hε : 0 < ε) (hε1 : ε ≤ 1) + (hc : ∀ a j, |(c a j : ℝ)| ≤ O * (m a j * H a j : ℕ)) + (hupper : ∀ a, (∏ j, ((m a j * H a j : ℕ) : ℝ)) ≤ F * K) + (hlower : ∀ a, (K : ℝ) ≤ D * ∏ j, ((m a j * H a j : ℕ) : ℝ)) + (p : ℕ) (hpower : ∀ a j, (K : ℝ) ≤ E * ((m a j * H a j : ℕ) : ℝ) ^ p) + (J : Finset (Finset (Fin q))) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (hB : uniformSpectrumBlockCount n J.card (p * J.card) ≤ b) : + let U := affinePrimitiveEnvelope (Fin q) A 1 0 M 1 + let Q := affineTorusRadius (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + let R := affineTorusFactor (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) 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)) ∧ + (∀ center : J → ℤ, (∑ k, ‖integerGridCoefficient (progressionCubeBlockWeights q m H c hL hm) + (progressionCubeIntegerSum q m H c J center) (R * K) 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 (progressionCubeBlockWeights q m H c hL hm) + (progressionCubeIntegerSum q m H c J center) z : ℝ) : ℂ) - + integerGridApproximation (progressionCubeBlockWeights q m H c hL hm) + (progressionCubeIntegerSum q m H c J center) K (R * K) S z‖ ≤ ε := by + let s := progressionCubeSources q m H c hL hm hsize + let u (a : Fin b) (j : Fin (n + 1)) := cubeRootOffset (c a j) (I := Fin q) + let R := affineTorusFactor (Fintype.card (Fin q)) (n + 1) (Fintype.card (Fin b)) (O + 1) F + have hcoord (a : Fin b) (j : Fin (n + 1)) (i : Option (Fin q)) : + |(u a j i : ℝ)| + ((1 : ℕ) : ℝ) * (s a j).length ≤ (O + 1) * (s a j).length := by + have hlength : (s a j).length = m a j * H a j := rfl + rw [hlength] + cases i with + | none => + change |(c a j : ℝ)| + ((1 : ℕ) : ℝ) * (m a j * H a j : ℕ) ≤ _ + push_cast + have he := hc a j + push_cast at he + nlinarith + | some i => + have he : 0 ≤ O * ((m a j * H a j : ℕ) : ℝ) := mul_nonneg hO (Nat.cast_nonneg _) + simp only [u, cubeRootOffset, Int.cast_zero, abs_zero, Nat.cast_one, zero_add, one_mul] + nlinarith + have he := affineCube_geometric_approximation s u (fun _ _ _ => 1) A 1 0 hA M 1 hM + (fun _ _ => le_rfl) (fun _ _ => le_rfl) (fun _ _ _ => by omega) (fun _ _ _ => le_rfl) + (by linarith : 0 ≤ O + 1) hD hE hε hε1 hcoord hupper hlower p hpower J hJ + (by simpa only [Fintype.card_fin] using hB) + dsimp only at he + obtain ⟨S, hS, hcap, hchar, happ⟩ := he + refine ⟨S, hS, ?_, hchar, ?_⟩ + · intro center + apply le_trans ?_ hcap + apply Finset.sum_le_sum + intro k _ + have heq := progressionCubeIntegerSum_coefficient q m H c hL hm hsize J center (R * K) k + rw [affineWeightedCubeIntegerSum_coefficient] at heq + have hn := congrArg norm heq + simpa only [norm_mul, rectangularGridCharacter_norm, one_mul] using hn.symm.le + · intro center z hz + simpa only [s, u, progressionCubeIntegerSum_mass, progressionCubeIntegerSum_approximation] using happ center z hz + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionTupleSliceSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionTupleSliceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..12ba10cdad26da8f8fbcd7c9258797ddc252137f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ProgressionTupleSliceSupport.lean @@ -0,0 +1,98 @@ +import OAI.Combinatorics.Progressions.Estimates.ProgressionTupleSliceRiemann + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +namespace FiniteProbabilityWeights + +theorem condition_weight_pos_iff {Ω : Type*} [Fintype Ω] [DecidableEq Ω] + (p : FiniteProbabilityWeights Ω) (S : Finset Ω) (hS : 0 < p.mass S) (x : Ω) : + 0 < (p.condition S hS).weight x ↔ x ∈ S ∧ 0 < p.weight x := by + change 0 < (if x ∈ S then p.weight x else 0) / p.mass S ↔ _ + rw [lt_div_iff₀ hS, zero_mul] + by_cases hx : x ∈ S <;> simp [hx] + +theorem pi_weight_pos_component {J : Type*} [Fintype J] [DecidableEq J] + {Ω : J → Type*} [∀ j, Fintype (Ω j)] (p : ∀ j, FiniteProbabilityWeights (Ω j)) + (x : ∀ j, Ω j) (hx : 0 < (pi p).weight x) (j : J) : 0 < (p j).weight (x j) := by + apply lt_of_le_of_ne ((p j).nonneg (x j)) + intro he + have hz : (pi p).weight x = 0 := by + exact Finset.prod_eq_zero (Finset.mem_univ j) he.symm + linarith + +end FiniteProbabilityWeights + +theorem scalarCubeResidueWeights_cube_support (I : Type*) [Fintype I] [DecidableEq I] + (H M : ℕ) (hH : 0 < H) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) + (hm : ∀ i, 0 < m i) (hmM : ∀ i, m i ≤ M) + (hsize : (Fintype.card I + 1) * M ≤ H) (z : IntegerScalarCubeBox I H) + (hz : 0 < (scalarCubeResidueWeights I H M hH m r hm hmM hsize).weight z) : + IntegerScalarCube H (fun i => (z i : ℤ)) := by + have h1 := (FiniteProbabilityWeights.condition_weight_pos_iff _ _ _ z).mp hz + have h2 := (FiniteProbabilityWeights.condition_weight_pos_iff _ _ _ z).mp h1.2 + exact (mem_integerScalarCubeSet H z).mp h2.1 + +theorem integerScalarCube_endpoint_normalized_norm_le {I : Type*} [Fintype I] [DecidableEq I] + {H : ℕ} (hH : 2 ≤ H) (z : Option I → ℤ) (hz : IntegerScalarCube H z) : + ‖fun i => (z i : ℝ) / ((H : ℝ) - 1)‖ ≤ 1 := by + have hH2 : (2 : ℝ) ≤ H := by exact_mod_cast hH + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro i + have hi := integerScalarCube_coordinates hz i + have hzi : -(H : ℤ) + 1 ≤ z i ∧ z i ≤ (H : ℤ) - 1 := by omega + have hr : |(z i : ℝ)| ≤ (H : ℝ) - 1 := by + apply abs_le.mpr + have hl : -(H : ℝ) + 1 ≤ (z i : ℝ) := by exact_mod_cast hzi.1 + have hu : (z i : ℝ) ≤ (H : ℝ) - 1 := by exact_mod_cast hzi.2 + constructor <;> linarith + rw [Real.norm_eq_abs, abs_div, abs_of_pos (by linarith : 0 < (H : ℝ) - 1)] + exact (div_le_one (by linarith)).mpr hr + +theorem affineCubeTuple_norm_le {J I : Type*} [Fintype J] [Fintype I] + (lower width : J → ℝ) (hw : ∀ j, |lower j| + |width j| ≤ 1) + (x : J → Option I → ℝ) (hx : ‖x‖ ≤ 1) : ‖affineCubeTuple lower width x‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro j + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro i + have hxi : |x j i| ≤ 1 := + (norm_le_pi_norm (x j) i).trans ((norm_le_pi_norm x j).trans hx) + have hc : |if i = none then lower j else 0| ≤ |lower j| := by + split_ifs <;> simp + exact (abs_add_le _ _).trans ((add_le_add hc + ((abs_mul _ _).le.trans (mul_le_mul_of_nonneg_left hxi (abs_nonneg _)))).trans + (by simpa using hw j)) + +theorem progressionTuple_norm_le {J I : Type*} [Fintype J] [Fintype I] [DecidableEq I] + (L step H : J → ℕ) (c : J → ℤ) (hH : ∀ j, 2 ≤ H j) + (hw : ∀ j, |(c j : ℝ) / L j| + |(step j : ℝ) * ((H j : ℝ) - 1) / L j| ≤ 1) + (z : ∀ j, IntegerScalarCubeBox I (H j)) + (hz : ∀ j, IntegerScalarCube (H j) (fun i => (z j i : ℤ))) : + ‖fun j i => ((if i = none then (c j : ℝ) else 0) + (step j : ℝ) * (z j i : ℝ)) / L j‖ ≤ 1 := by + have hn : ‖fun j i => (z j i : ℝ) / ((H j : ℝ) - 1)‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro j + exact integerScalarCube_endpoint_normalized_norm_le (hH j) _ (hz j) + have he := affineCubeTuple_norm_le (fun j => (c j : ℝ) / L j) + (fun j => (step j : ℝ) * ((H j : ℝ) - 1) / L j) hw _ hn + convert he using 2 + funext j i + have hd : (H j : ℝ) - 1 ≠ 0 := by + have : (2 : ℝ) ≤ H j := by exact_mod_cast hH j + linarith + dsimp only [affineCubeTuple] + split_ifs <;> field_simp + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticAntisymmetricBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticAntisymmetricBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec568cdd61353d2c590681df9587bc037d7b0e76 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticAntisymmetricBox.lean @@ -0,0 +1,58 @@ +import OAI.Combinatorics.Progressions.Estimates.QuadraticCyclicAntisymmetric + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_quadratic_antisymmetric_box : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 3 f → + ∃ H : Finset (ZMod N), H.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * N ≤ (H.card : ℝ) ∧ + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) ((p + C) ^ C), + ∃ i : Fin M.outputDim, + (∀ h ∈ H, Real.exp (-((p + C) ^ C)) ≤ + ‖𝔼 n : ZMod N, multiplicativeDerivative f h n * + star (M.evalCyclic N i (correlationInput h n))‖) ∧ + ∃ i' j' : Fin M.outputDim, + Real.exp (-((p + C) ^ C)) ≤ + (finiteBoxCorrelation (fun x y : ZMod N => + star (M.evalCyclic N i' (correlationInput x y)) * + M.evalCyclic N j' (correlationInput y x))).re := by + obtain ⟨A, _, hanti⟩ := exists_quadratic_cyclic_antisymmetric + let Q : Polynomial ℕ := (Polynomial.X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (4 * Q) + refine ⟨C, hC, ?_⟩ + intro N _ p hp f hf hG + let q := (p + A) ^ A + have hq : 0 ≤ q := by dsimp [q]; positivity + have hcost : 4 * q ≤ (p + C) ^ C := by + simpa [Q, q, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := by linarith + obtain ⟨H, hH, hdense, M, i, hcorr, i', j', a, b, ha, hb, hpair⟩ := hanti hp f hf hG + let K (x y : ZMod N) := + star (M.evalCyclic N i' (correlationInput x y)) * M.evalCyclic N j' (correlationInput y x) + have hbox : Real.exp (-q) ^ 4 ≤ (finiteBoxCorrelation K).re := + (pow_le_pow_left₀ (Real.exp_nonneg _) hpair 4).trans + (norm_weighted_pair_mean_pow_four_le_box K a b ha hb) + have hpower : Real.exp (-q) ^ 4 = Real.exp (-(4 * q)) := by + rw [← Real.exp_nat_mul] + congr 1 + norm_num + rw [hpower] at hbox + refine ⟨H, hH, ?_, M.mono hqC, i, ?_, i', j', ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hqC)) + (Nat.cast_nonneg _)).trans hdense + · intro h hh + exact (Real.exp_le_exp.mpr (neg_le_neg hqC)).trans (hcorr h hh) + · exact (Real.exp_le_exp.mpr (neg_le_neg hcost)).trans hbox + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticBoxExpansion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticBoxExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..d000b7372be0e93d9cd152bee9a7ff85385c64f7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticBoxExpansion.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Estimates.QuadraticAntisymmetricOrbit + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_quadratic_box_expansion (k : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 3 f → + ∃ q : ℝ, 0 ≤ q ∧ q ≤ (p + C) ^ C ∧ + ∃ H : Finset (ZMod N), H.Nonempty ∧ Real.exp (-q) * N ≤ (H.card : ℝ) ∧ + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) q, + ∃ i : Fin M.outputDim, + (∀ h ∈ H, Real.exp (-q) ≤ + ‖𝔼 n : ZMod N, multiplicativeDerivative f h n * + star (M.evalCyclic N i (correlationInput h n))‖) ∧ + ∃ V : NativeAntisymmetricOrbitFactors M N q, + Real.exp (-q) ≤ (finiteBoxCorrelation (fun x y : ZMod N => + star (M.evalCyclic N V.leftIndex (correlationInput x y)) * + M.evalCyclic N V.rightIndex (correlationInput y x))).re ∧ + ∃ F : (Fin 4 → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : Fin 4 => 1) 1 ((p + C) ^ C) F) ∧ + (𝔼 x : Fin 4 → ZMod N, + ‖M.antisymmetricBoxValue V.leftIndex V.rightIndex + (fun j => ((x j).val : ℤ)) - + F (fun j => ((x j).val : ℤ))‖) ≤ Real.exp (-(4 * q + (p + 2) ^ k)) := by + obtain ⟨A, _, hbiased⟩ := exists_quadratic_biased_orbit + obtain ⟨B, _, hprecise⟩ := exists_antisymmetric_orbit_approximation + let X : Polynomial ℕ := Polynomial.X + let Q := (X + Polynomial.C A) ^ A + let E := 4 * Q + (X + 2) ^ k + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (Q + (Q + E + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hG + let a := (p + A) ^ A + let e := 4 * a + (p + 2) ^ k + have ha : 0 ≤ a := by dsimp [a]; positivity + have he : 0 ≤ e := by dsimp [e]; positivity + have hsum : a + (a + e + B) ^ B ≤ (p + C) ^ C := by + simpa [Q, E, X, a, e, Polynomial.eval₂_pow] using hbudget p hp + have haC : a ≤ (p + C) ^ C := (le_add_of_nonneg_right (by positivity)).trans hsum + have hBC : (a + e + B) ^ B ≤ (p + C) ^ C := (le_add_of_nonneg_left ha).trans hsum + obtain ⟨H, hH, hdense, M, i, hcorr, V, hbox⟩ := + hbiased hp ((Real.exp_le_exp.mpr haC).trans hN) f hf hG + obtain ⟨F, ⟨EF⟩, herr⟩ := hprecise M V ha he + ((Real.exp_le_exp.mpr hBC).trans hN) + exact ⟨a, ha, haC, H, hH, hdense, M, i, hcorr, V, hbox, F, ⟨EF.mono hBC⟩, herr⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticLocalBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticLocalBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f129984542d7543505be62e3fa63d3063d397e9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuadraticLocalBox.lean @@ -0,0 +1,117 @@ +import OAI.Combinatorics.Progressions.Estimates.QuadraticAntisymmetricOrbit + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +attribute [local instance] NativeAntisymmetricFrozenDescent.lie NativeAntisymmetricFrozenDescent.algebra + NativeAntisymmetricFrozenDescent.topology NativeAntisymmetricFrozenDescent.topologicalAdd + NativeAntisymmetricFrozenDescent.continuousSMul NativeAntisymmetricFrozenDescent.hausdorff + +theorem exists_quadratic_antisymmetric_frozen_descent : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 3 f → + ∃ H : Finset (ZMod N), H.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * N ≤ (H.card : ℝ) ∧ + ∃ q : ℝ, 0 ≤ q ∧ q ≤ (p + C) ^ C ∧ + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) q, + ∃ i : Fin M.outputDim, + (∀ h ∈ H, Real.exp (-((p + C) ^ C)) ≤ + ‖𝔼 n : ZMod N, multiplicativeDerivative f h n * + star (M.evalCyclic N i (correlationInput h n))‖) ∧ + ∃ V : NativeAntisymmetricOrbitFactors M N q, + Nonempty (NativeAntisymmetricFrozenDescent V ((p + C) ^ C)) := by + obtain ⟨A, _, horbit⟩ := exists_quadratic_antisymmetric_orbit_factors + obtain ⟨B, _, hdescent⟩ := exists_antisymmetric_frozen_descent + let P : Polynomial ℕ := (Polynomial.X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (P + (P + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hG + let q := (p + A) ^ A + have hq : 0 ≤ q := by dsimp [q]; positivity + have hsum : q + (q + B) ^ B ≤ (p + C) ^ C := by + simpa [P, q, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := (le_add_of_nonneg_right (by positivity)).trans hsum + have hBC : (q + B) ^ B ≤ (p + C) ^ C := (le_add_of_nonneg_left hq).trans hsum + obtain ⟨H, hH, hdense, M, i, hcorr, V⟩ := + horbit hp ((Real.exp_le_exp.mpr hqC).trans hN) f hf hG + obtain ⟨V⟩ := V + obtain ⟨R⟩ := hdescent M V hq + refine ⟨H, hH, ?_, q, hq, hqC, M, i, ?_, V, ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg hqC)) + (Nat.cast_nonneg _)).trans hdense + · intro h hh + exact (Real.exp_le_exp.mpr (neg_le_neg hqC)).trans (hcorr h hh) + · exact ⟨R.mono hBC⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_quadratic_local_box_models : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ x, ‖f x‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 3 f → + ∃ H : Finset (ZMod N), H.Nonempty ∧ + Real.exp (-((p + C) ^ C)) * N ≤ (H.card : ℝ) ∧ + ∃ q : ℝ, 0 ≤ q ∧ q ≤ (p + C) ^ C ∧ + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 1) q, + ∃ i : Fin M.outputDim, + (∀ h ∈ H, Real.exp (-((p + C) ^ C)) ≤ + ‖𝔼 n : ZMod N, multiplicativeDerivative f h n * + star (M.evalCyclic N i (correlationInput h n))‖) ∧ + ∃ V : NativeAntisymmetricOrbitFactors M N q, + ∃ R : NativeAntisymmetricFrozenDescent V ((p + C) ^ C), + Nonempty (NativeAntisymmetricLocalModels R ((p + C) ^ C)) := by + obtain ⟨A, _, hfrozen⟩ := exists_quadratic_antisymmetric_frozen_descent + obtain ⟨B, _, hlocal⟩ := exists_antisymmetric_local_models + let P : Polynomial ℕ := (Polynomial.X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (P + (P + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hG + let a := (p + A) ^ A + have ha : 0 ≤ a := by dsimp [a]; positivity + have hsum : a + (a + B) ^ B ≤ (p + C) ^ C := by + simpa [P, a, Polynomial.eval₂_pow] using hbudget p hp + have haC : a ≤ (p + C) ^ C := (le_add_of_nonneg_right (by positivity)).trans hsum + have hBC : (a + B) ^ B ≤ (p + C) ^ C := (le_add_of_nonneg_left ha).trans hsum + obtain ⟨H, hH, hdense, q, hq, hqa, M, i, hcorr, V, R⟩ := + hfrozen hp ((Real.exp_le_exp.mpr haC).trans hN) f hf hG + obtain ⟨R⟩ := R + let R' := R.mono haC + obtain ⟨P, hP, hPb, hmodels⟩ := hlocal R' + have hqC : (q + B) ^ B ≤ (p + C) ^ C := + (pow_le_pow_left₀ (by positivity) (by linarith : q + B ≤ a + B) B).trans hBC + refine ⟨H, hH, ?_, q, hq, hqa.trans haC, M, i, ?_, V, R', ?_⟩ + · exact (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (neg_le_neg haC)) + (Nat.cast_nonneg _)).trans hdense + · intro h hh + exact (Real.exp_le_exp.mpr (neg_le_neg haC)).trans (hcorr h hh) + · refine ⟨{ + period := P + period_pos := hP + period_bound := hPb.trans (Real.exp_le_exp.mpr hqC) + local_model := ?_ }⟩ + intro y hy + obtain ⟨S, hSo, hSc, hSe⟩ := hmodels y hy + refine ⟨S, hSo, hSc, ?_⟩ + intro x δ hδ hx hres hnear + exact (hSe x δ hδ hx hres hnear).trans + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hqC) hδ) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuantitativeMetricPartition.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuantitativeMetricPartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d2c48d8f85fd5c3be28cb02165fedc251bf4d96 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuantitativeMetricPartition.lean @@ -0,0 +1,355 @@ +import Mathlib.Data.Fintype.EquivFin +import Mathlib.Topology.MetricSpace.Lipschitz +import OAI.Combinatorics.Progressions.Dynamics.CandidateFrontSourceLossBudget +import OAI.Combinatorics.Progressions.Estimates.NormalizedCutoffs +import OAI.Combinatorics.Progressions.Sampling.NormalizedRealBoxHalfGrid + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +variable {ι X : Type*} [Fintype ι] [PseudoMetricSpace X] + +theorem metric_cover_of_box_grid (f : (ι → ℝ) → X) {K : ℝ≥0} {B : ℝ} (hB : 0 < B) + (hLip : LipschitzOnWith K f {v | ∀ i, |v i| ≤ B}) + (hcover : ∀ x, ∃ v, (∀ i, |v i| ≤ B) ∧ f v = x) (N : ℕ) (hN : 0 < N) : + ∀ x, ∃ k : ι → Fin (N + 1), + dist x (f (uniformBoxGrid B N k)) ≤ K * (2 * B / N) := by + intro x + obtain ⟨v, hv, rfl⟩ := hcover x + obtain ⟨k, hk⟩ := exists_uniformBoxGrid_approx hB hN v hv + refine ⟨k, ?_⟩ + exact (hLip.dist_le_mul v hv _ (uniformBoxGrid_mem hB.le hN k)).trans + (mul_le_mul_of_nonneg_left hk K.coe_nonneg) + +noncomputable def boxCoverMeshCount (B : ℝ) (K : ℝ≥0) (ε : ℝ) : ℕ := + ⌈2 * B * K / ε⌉₊ + 1 + +theorem boxCoverMeshCount_pos (B : ℝ) (K : ℝ≥0) (ε : ℝ) : 0 < boxCoverMeshCount B K ε := by + unfold boxCoverMeshCount + omega + +theorem boxCoverMeshCount_error {B ε : ℝ} (K : ℝ≥0) (hε : 0 < ε) : + K * (2 * B / boxCoverMeshCount B K ε) ≤ ε := by + have hN : (0 : ℝ) < boxCoverMeshCount B K ε := by exact_mod_cast boxCoverMeshCount_pos B K ε + have hceil : 2 * B * K / ε ≤ (boxCoverMeshCount B K ε : ℝ) := by + exact (Nat.le_ceil _).trans (by unfold boxCoverMeshCount; push_cast; linarith) + have hm := (div_le_iff₀ hε).mp hceil + rw [← mul_div_assoc, div_le_iff₀ hN] + nlinarith + +theorem exists_finite_metric_cover_of_box (f : (ι → ℝ) → X) {K : ℝ≥0} {B ε : ℝ} + (hB : 0 < B) (hε : 0 < ε) (hLip : LipschitzOnWith K f {v | ∀ i, |v i| ≤ B}) + (hcover : ∀ x, ∃ v, (∀ i, |v i| ≤ B) ∧ f v = x) : + ∃ c : (ι → Fin (boxCoverMeshCount B K ε + 1)) → X, + ∀ x, ∃ i, dist x (c i) ≤ ε := by + refine ⟨fun i => f (uniformBoxGrid B (boxCoverMeshCount B K ε) i), ?_⟩ + intro x + obtain ⟨i, hi⟩ := metric_cover_of_box_grid f hB hLip hcover _ (boxCoverMeshCount_pos B K ε) x + exact ⟨i, hi.trans (boxCoverMeshCount_error K hε)⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +variable {X : Type*} [PseudoMetricSpace X] + +noncomputable def metricTent (c : X) (r : ℝ) (x : X) : ℝ := max 0 (2 * r - dist x c) + +theorem metricTent_nonneg (c : X) (r : ℝ) (x : X) : 0 ≤ metricTent c r x := le_max_left _ _ + +theorem metricTent_le (c : X) {r : ℝ} (hr : 0 ≤ r) (x : X) : metricTent c r x ≤ 2 * r := + max_le (by linarith) (by linarith [dist_nonneg (x := x) (y := c)]) + +theorem metricTent_zero_of_far (c x : X) {r : ℝ} (hx : 2 * r ≤ dist x c) : metricTent c r x = 0 := by + exact max_eq_left (by linarith) + +theorem abs_metricTent_sub_le (c : X) (r : ℝ) (x y : X) : + |metricTent c r x - metricTent c r y| ≤ dist x y := by + calc + _ = |max (2 * r - dist x c) 0 - max (2 * r - dist y c) 0| := by + simp only [metricTent, max_comm] + _ ≤ |(2 * r - dist x c) - (2 * r - dist y c)| := abs_max_sub_max_le_abs _ _ _ + _ = |dist x c - dist y c| := by + rw [show (2 * r - dist x c) - (2 * r - dist y c) = -(dist x c - dist y c) by ring, abs_neg] + _ ≤ dist x y := abs_dist_sub_le x y c + +theorem lipschitz_metricTent (c : X) (r : ℝ) : LipschitzWith 1 (metricTent c r) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [Real.dist_eq, NNReal.coe_one, one_mul] using abs_metricTent_sub_le c r x y + +variable {ι : Type*} [Fintype ι] + +noncomputable def metricTentSum (c : ι → X) (r : ℝ) (x : X) : ℝ := ∑ i, metricTent (c i) r x + +theorem metricTentSum_ge (c : ι → X) {r : ℝ} (hcover : ∀ x, ∃ i, dist x (c i) ≤ r) (x : X) : + r ≤ metricTentSum c r x := by + obtain ⟨i, hi⟩ := hcover x + calc + r ≤ metricTent (c i) r x := (by linarith : r ≤ 2 * r - dist x (c i)).trans (le_max_right _ _) + _ ≤ metricTentSum c r x := Finset.single_le_sum (fun j _ => metricTent_nonneg (c j) r x) (Finset.mem_univ i) + +theorem abs_metricTentSum_sub_le (c : ι → X) (r : ℝ) (x y : X) : + |metricTentSum c r x - metricTentSum c r y| ≤ Fintype.card ι * dist x y := by + unfold metricTentSum + rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ i, |metricTent (c i) r x - metricTent (c i) r y| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i : ι, dist x y := Finset.sum_le_sum fun i _ => abs_metricTent_sub_le (c i) r x y + _ = _ := by simp + +noncomputable def metricTentPartition (c : ι → X) (r : ℝ) (i : ι) (x : X) : ℝ := + metricTent (c i) r x / metricTentSum c r x + +theorem metricTentPartition_nonneg (c : ι → X) (r : ℝ) (i : ι) (x : X) : + 0 ≤ metricTentPartition c r i x := + div_nonneg (metricTent_nonneg _ _ _) (Finset.sum_nonneg fun j _ => metricTent_nonneg (c j) r x) + +theorem sum_metricTentPartition (c : ι → X) {r : ℝ} (hr : 0 < r) + (hcover : ∀ x, ∃ i, dist x (c i) ≤ r) (x : X) : ∑ i, metricTentPartition c r i x = 1 := by + simp only [metricTentPartition, ← Finset.sum_div] + exact div_self (hr.trans_le (metricTentSum_ge c hcover x)).ne' + +theorem metricTentPartition_le_one (c : ι → X) {r : ℝ} (hr : 0 < r) + (hcover : ∀ x, ∃ i, dist x (c i) ≤ r) (i : ι) (x : X) : metricTentPartition c r i x ≤ 1 := by + rw [← sum_metricTentPartition c hr hcover x] + exact Finset.single_le_sum (fun j _ => metricTentPartition_nonneg c r j x) (Finset.mem_univ i) + +theorem metricTentPartition_zero_of_far (c : ι → X) (r : ℝ) (i : ι) (x : X) + (hx : 2 * r ≤ dist x (c i)) : metricTentPartition c r i x = 0 := by + simp only [metricTentPartition, metricTent_zero_of_far (c i) x hx, zero_div] + +theorem abs_metricTentPartition_sub_le (c : ι → X) {r : ℝ} (hr : 0 < r) + (hcover : ∀ x, ∃ i, dist x (c i) ≤ r) (i : ι) (x y : X) : + |metricTentPartition c r i x - metricTentPartition c r i y| ≤ + ((2 * Fintype.card ι + 1) / r) * dist x y := by + have h := abs_div_sub_div_bound hr (metricTentSum_ge c hcover x) (metricTentSum_ge c hcover y) + dist_nonneg (by positivity : 0 ≤ 2 * r) (by positivity : 0 ≤ (Fintype.card ι : ℝ) * dist x y) + (abs_metricTent_sub_le (c i) r x y) + (by simpa only [abs_of_nonneg (metricTent_nonneg _ _ _)] using metricTent_le (c i) hr.le y) + (abs_metricTentSum_sub_le c r x y) + apply h.trans_eq + field_simp + ring + +theorem lipschitz_metricTentPartition (c : ι → X) {r : ℝ≥0} (hr : 0 < r) + (hcover : ∀ x, ∃ i, dist x (c i) ≤ r) (i : ι) : + LipschitzWith ((2 * Fintype.card ι + 1) / r) (metricTentPartition c r i) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [Real.dist_eq, NNReal.coe_div, NNReal.coe_add, NNReal.coe_mul, NNReal.coe_natCast, NNReal.coe_one, + NNReal.coe_ofNat] using abs_metricTentPartition_sub_le c (show (0 : ℝ) < r from hr) hcover i x y + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem boxCoverMeshCount_add_one_le_exp {B ε p : ℝ} (K : ℝ≥0) + (hB0 : 0 ≤ B) (hε : 0 < ε) (hp : 0 ≤ p) + (hB : B ≤ Real.exp p) (hK : (K : ℝ) ≤ Real.exp p) (hεinv : 1 / ε ≤ Real.exp p) : + ((boxCoverMeshCount B K ε + 1 : ℕ) : ℝ) ≤ Real.exp (3 * p + 4) := by + have hprod : 2 * B * K / ε ≤ 2 * Real.exp (3 * p) := by + calc + _ = 2 * (B * K * (1 / ε)) := by ring + _ ≤ 2 * (Real.exp p * Real.exp p * Real.exp p) := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 2; ring + have hceil := (Nat.ceil_lt_add_one (by positivity : 0 ≤ 2 * B * K / ε)).le + have hone : 1 ≤ Real.exp (3 * p) := Real.one_le_exp (by linarith) + have hfive : (5 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + calc + _ ≤ 5 * Real.exp (3 * p) := by + unfold boxCoverMeshCount + push_cast + linarith + _ ≤ Real.exp 4 * Real.exp (3 * p) := mul_le_mul_of_nonneg_right hfive (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem boxCoverCount_le_exp (C d : ℕ) (hC : 2 ≤ C) (K : ℝ≥0) {B ε p : ℝ} + (hB0 : 0 ≤ B) (hε : 0 < ε) (hp : 0 ≤ p) (hd : (d : ℝ) ≤ p) + (hB : B ≤ Real.exp ((p + C) ^ C)) (hK : (K : ℝ) ≤ Real.exp ((p + C) ^ C)) + (hεinv : 1 / ε ≤ Real.exp ((p + C) ^ C)) : + (((boxCoverMeshCount B K ε + 1) ^ d : ℕ) : ℝ) ≤ + Real.exp ((p + (C + 5)) ^ (C + 5)) := by + let t : ℝ := p + (C + 5 : ℕ) + have ht : 5 ≤ t := by dsimp [t]; push_cast; linarith [Nat.cast_nonneg (α := ℝ) C] + have ht1 : 1 ≤ t := by linarith + have hpt : p ≤ t := by dsimp [t]; push_cast; linarith [Nat.cast_nonneg (α := ℝ) C] + have hq : (p + C) ^ C ≤ t ^ C := + pow_le_pow_left₀ (by positivity) (by dsimp [t]; push_cast; linarith) C + have hfactor : 3 * (p + C) ^ C + 4 ≤ t ^ (C + 2) := by + have hpow : 1 ≤ t ^ C := one_le_pow₀ ht1 + have hsquare : 7 ≤ t ^ 2 := by nlinarith + calc + _ ≤ 7 * t ^ C := by linarith + _ ≤ t ^ 2 * t ^ C := mul_le_mul_of_nonneg_right hsquare (by positivity) + _ = _ := by rw [pow_add]; ring + have hmesh := boxCoverMeshCount_add_one_le_exp K hB0 hε (by positivity) hB hK hεinv + rw [Nat.cast_pow] + calc + _ ≤ (Real.exp (3 * (p + C) ^ C + 4)) ^ d := pow_le_pow_left₀ (by positivity) hmesh d + _ = Real.exp ((d : ℝ) * (3 * (p + C) ^ C + 4)) := (Real.exp_nat_mul _ _).symm + _ ≤ Real.exp (t * t ^ (C + 2)) := Real.exp_le_exp.mpr + (mul_le_mul (hd.trans hpt) hfactor (by positivity) (by linarith)) + _ = Real.exp (t ^ (C + 3)) := by rw [show C + 3 = (C + 2) + 1 by omega, pow_succ' t (C + 2)] + _ ≤ Real.exp (t ^ (C + 5)) := Real.exp_le_exp.mpr (pow_le_pow_right₀ ht1 (by omega)) + _ = _ := by simp [t] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_metric_partition_of_box {ι X : Type*} [Fintype ι] [PseudoMetricSpace X] + (f : (ι → ℝ) → X) {K : ℝ≥0} {B : ℝ} (hB : 0 < B) + (hLip : LipschitzOnWith K f {v | ∀ i, |v i| ≤ B}) + (hcover : ∀ x, ∃ v, (∀ i, |v i| ≤ B) ∧ f v = x) (r : ℝ≥0) (hr : 0 < r) : + let n := (boxCoverMeshCount B K r + 1) ^ Fintype.card ι + ∃ c : Fin n → X, ∃ ψ : Fin n → X → ℝ, + (∀ i x, 0 ≤ ψ i x ∧ ψ i x ≤ 1) ∧ + (∀ x, ∑ i, ψ i x = 1) ∧ + (∀ i x, 2 * (r : ℝ) ≤ dist x (c i) → ψ i x = 0) ∧ + (∀ i, LipschitzWith ((2 * n + 1 : ℝ≥0) / r) (ψ i)) := by + classical + let N := boxCoverMeshCount B K r + let n := (N + 1) ^ Fintype.card ι + let I := ι → Fin (N + 1) + have hcard : Fintype.card I = n := by simp [I, n] + let e : I ≃ Fin n := Fintype.equivFinOfCardEq hcard + obtain ⟨c, hc⟩ := exists_finite_metric_cover_of_box f hB (show (0 : ℝ) < r from hr) hLip hcover + let centers : Fin n → X := fun i => c (e.symm i) + have hcenters (x : X) : ∃ i, dist x (centers i) ≤ r := by + obtain ⟨i, hi⟩ := hc x + refine ⟨e i, ?_⟩ + simpa only [centers, Equiv.symm_apply_apply] using hi + refine ⟨centers, metricTentPartition centers r, ?_, ?_, ?_, ?_⟩ + · intro i x + exact ⟨metricTentPartition_nonneg centers r i x, metricTentPartition_le_one centers hr hcenters i x⟩ + · exact sum_metricTentPartition centers hr hcenters + · exact metricTentPartition_zero_of_far centers r + · intro i + simpa only [Fintype.card_fin] using lipschitz_metricTentPartition centers hr hcenters i + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem shifted_power_self_mono {p : ℝ} (hp : 0 ≤ p) {C D : ℕ} (hC : 1 ≤ C) (hCD : C ≤ D) : + (p + C) ^ C ≤ (p + D) ^ D := by + have hD : (1 : ℝ) ≤ D := by exact_mod_cast hC.trans hCD + apply (pow_le_pow_left₀ (by positivity) (add_le_add le_rfl (Nat.cast_le.mpr hCD)) C).trans + exact pow_le_pow_right₀ (by linarith) hCD + +theorem metricPartition_constant_le_exp (n : ℕ) (r : ℝ≥0) {p : ℝ} + (hp : 0 ≤ p) (hn : (n : ℝ) ≤ Real.exp p) (hr : 1 / (r : ℝ) ≤ Real.exp p) : + (((2 * n + 1 : ℝ≥0) / r : ℝ≥0) : ℝ) ≤ Real.exp (2 * p + 2) := by + have hnum : 2 * (n : ℝ) + 1 ≤ 3 * Real.exp p := by + linarith [Real.one_le_exp_iff.mpr hp] + have hthree : (3 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + change (2 * (n : ℝ) + 1) / r ≤ _ + calc + _ = (2 * (n : ℝ) + 1) * (1 / r) := by ring + _ ≤ (3 * Real.exp p) * Real.exp p := + mul_le_mul hnum hr (by positivity) (by positivity) + _ = 3 * Real.exp (2 * p) := by rw [mul_assoc, ← Real.exp_add]; congr 2; ring + _ ≤ Real.exp 2 * Real.exp (2 * p) := mul_le_mul_of_nonneg_right hthree (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem metricPartition_constant_power_budget (C n : ℕ) (hC : 2 ≤ C) (r : ℝ≥0) {p : ℝ} + (hp : 0 ≤ p) (hn : (n : ℝ) ≤ Real.exp ((p + C) ^ C)) + (hr : 1 / (r : ℝ) ≤ Real.exp ((p + C) ^ C)) : + (((2 * n + 1 : ℝ≥0) / r : ℝ≥0) : ℝ) ≤ Real.exp ((p + (C + 3)) ^ (C + 3)) := by + apply (metricPartition_constant_le_exp n r (by positivity) hn hr).trans + apply Real.exp_le_exp.mpr + let t : ℝ := p + (C + 3 : ℕ) + have ht : 5 ≤ t := by + have hC' : (2 : ℝ) ≤ C := by exact_mod_cast hC + dsimp [t] + push_cast + linarith + have hpow : 1 ≤ t ^ C := one_le_pow₀ (by linarith) + have hq : (p + C) ^ C ≤ t ^ C := + pow_le_pow_left₀ (by positivity) (by dsimp [t]; push_cast; linarith) C + calc + _ ≤ 4 * t ^ C := by linarith + _ ≤ t * t ^ C := mul_le_mul_of_nonneg_right (by linarith) (by positivity) + _ = t ^ (C + 1) := (pow_succ' t C).symm + _ ≤ t ^ (C + 3) := pow_le_pow_right₀ (by linarith) (by omega) + _ = _ := by simp [t] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_metric_partition_exp_bound {ι X : Type*} [Fintype ι] [PseudoMetricSpace X] + (f : (ι → ℝ) → X) {K : ℝ≥0} {B p : ℝ} (hB : 0 < B) + (hLip : LipschitzOnWith K f {v | ∀ i, |v i| ≤ B}) + (hcover : ∀ x, ∃ v, (∀ i, |v i| ≤ B) ∧ f v = x) + (r : ℝ≥0) (hr : 0 < r) (C : ℕ) (hC : 2 ≤ C) + (hp : 0 ≤ p) (hd : (Fintype.card ι : ℝ) ≤ p) + (hBp : B ≤ Real.exp ((p + C) ^ C)) (hKp : (K : ℝ) ≤ Real.exp ((p + C) ^ C)) + (hrp : 1 / (r : ℝ) ≤ Real.exp ((p + C) ^ C)) : + ∃ n : ℕ, 0 < n ∧ (n : ℝ) ≤ Real.exp ((p + (C + 8)) ^ (C + 8)) ∧ + ∃ L : ℝ≥0, (L : ℝ) ≤ Real.exp ((p + (C + 8)) ^ (C + 8)) ∧ + ∃ c : Fin n → X, ∃ ψ : Fin n → X → ℝ, + (∀ i x, 0 ≤ ψ i x ∧ ψ i x ≤ 1) ∧ + (∀ x, ∑ i, ψ i x = 1) ∧ + (∀ i x, 2 * (r : ℝ) ≤ dist x (c i) → ψ i x = 0) ∧ + (∀ i, LipschitzWith L (ψ i)) := by + let n := (boxCoverMeshCount B K r + 1) ^ Fintype.card ι + obtain ⟨c, ψ, hψ, hsum, hsupport, hψLip⟩ := exists_metric_partition_of_box f hB hLip hcover r hr + have hn : (n : ℝ) ≤ Real.exp ((p + (C + 5)) ^ (C + 5)) := + boxCoverCount_le_exp C (Fintype.card ι) hC K hB.le hr hp hd hBp hKp hrp + have hC5 := shifted_power_self_mono (C := C) (D := C + 5) hp (by omega) (by omega) + have hrp' : 1 / (r : ℝ) ≤ Real.exp ((p + (C + 5)) ^ (C + 5)) := + hrp.trans (Real.exp_le_exp.mpr (by simpa only [Nat.cast_add, Nat.cast_ofNat] using hC5)) + have hL := metricPartition_constant_power_budget (C + 5) n (by omega) r hp + (by simpa only [Nat.cast_add, Nat.cast_ofNat] using hn) + (by simpa only [Nat.cast_add, Nat.cast_ofNat] using hrp') + refine ⟨n, by dsimp [n]; positivity, ?_, (2 * n + 1 : ℝ≥0) / r, ?_, c, ψ, + hψ, hsum, hsupport, hψLip⟩ + · apply hn.trans + apply Real.exp_le_exp.mpr + simpa only [Nat.cast_add, Nat.cast_ofNat] using + shifted_power_self_mono (C := C + 5) (D := C + 8) hp (by omega) (by omega) + · simpa only [Nat.cast_add, Nat.cast_ofNat, Nat.add_assoc, Nat.reduceAdd, + add_assoc, show (5 : ℝ) + 3 = 8 by norm_num] using hL + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuantitativeProjectedChart.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuantitativeProjectedChart.lean new file mode 100644 index 0000000000000000000000000000000000000000..39a8c66c615457cd6db2651f2009dfc8f99eb2fd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuantitativeProjectedChart.lean @@ -0,0 +1,209 @@ +import OAI.Combinatorics.Progressions.Dynamics.ProjectedAxisBudgets +import OAI.Combinatorics.Progressions.Fourier.QuarticBohrProgression + +namespace OAI + +section + +namespace Erdos3 + +open Module Submodule MeasureTheory +open scoped BigOperators + +theorem exists_normalized_projected_chart {J : Type*} [Fintype J] + (W : Submodule ℝ (EuclideanSpace ℝ J)) + [IsZLattice ℝ (latticeSection (standardEuclideanLattice J) W)] : + let n := finrank ℝ Wᗮ + let B := projectedAxisNormBudget n + let D := projectedAxisDefectBudget n + ∃ b : Basis (Fin n) ℝ Wᗮ, + span ℤ (Set.range b) = projectedIntegerLattice W ∧ + (∀ i, 0 < basisAxisScale b i) ∧ + (∀ i, 1 ≤ ‖normalizedAxisBasis b i‖ ∧ ‖normalizedAxisBasis b i‖ ≤ B + 1) ∧ + (∀ x, ‖normalizedOrthogonalChart W b x‖ ≤ + (1 + (n : ℝ) * n.factorial * (B + 1) ^ (n - 1) * D) * ‖x‖) ∧ + (∀ p, ‖(normalizedOrthogonalChart W b).symm p‖ ≤ (1 + (n : ℝ) * (B + 1)) * ‖p‖) ∧ + 1 / ((n.factorial : ℝ) * (B + 1) ^ n) ≤ + ZLattice.covolume (latticeSection (standardEuclideanLattice J) W) / + (∏ i, (basisAxisScale b i : ℝ)) ∧ + ZLattice.covolume (latticeSection (standardEuclideanLattice J) W) / + (∏ i, (basisAxisScale b i : ℝ)) ≤ D := by + let n := finrank ℝ Wᗮ + let o := stdOrthonormalBasis ℝ Wᗮ + obtain ⟨b, hspan, hprod, hnorm⟩ := exists_projected_basis_with_axis_budgets W + have hprod' : (∏ i, ‖b i‖) ≤ projectedAxisDefectBudget n * + ZLattice.covolume (span ℤ (Set.range b)) := by + rw [hspan] + exact hprod + have hpair : ZLattice.covolume (latticeSection (standardEuclideanLattice J) W) * + ZLattice.covolume (span ℤ (Set.range b)) = 1 := by + rw [hspan] + exact projectedIntegerLattice_covolume W + refine ⟨b, hspan, basisAxisScale_pos b, normalizedAxisBasis_norm_bounds b hnorm, + ?_, ?_, ?_⟩ + · exact normalizedOrthogonalChart_norm_le W b o (projectedAxisNormBudget_pos n).le + (projectedAxisDefectBudget_pos n) hnorm hprod' + · exact normalizedOrthogonalChart_symm_norm_le W b (projectedAxisNormBudget_pos n).le hnorm + · exact normalizedAxisBasis_covolume_ratio_bounds o b (projectedAxisDefectBudget_pos n) + hnorm hprod' hpair + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem projectedAxisNormBudget_le_exp (n : ℕ) : + projectedAxisNormBudget n ≤ Real.exp (4 * ((n : ℝ) + 1) ^ 2) := by + have hn := Real.add_one_le_exp (n : ℝ) + have hf := factorial_le_exp_sq n + have hm := BohrProgression.minkowskiSecondConstant_le_exp n + have hm0 := BohrLattice.MinkowskiSecondBox.minkowskiSecondConstant_nonneg n + unfold projectedAxisNormBudget + calc + _ ≤ Real.exp n * Real.exp ((n : ℝ) ^ 2) * Real.exp (2 * (n : ℝ) ^ 2) := by + gcongr + _ = Real.exp ((n : ℝ) + (n : ℝ) ^ 2 + 2 * (n : ℝ) ^ 2) := by + rw [← Real.exp_add, ← Real.exp_add] + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [Nat.cast_nonneg (α := ℝ) n]) + +theorem projectedAxisDefectBudget_le_exp (n : ℕ) : + projectedAxisDefectBudget n ≤ Real.exp (4 * ((n : ℝ) + 1) ^ 2) := by + have hn := Real.add_one_le_exp (n : ℝ) + have hm := BohrProgression.minkowskiSecondConstant_le_exp n + have hm0 := BohrLattice.MinkowskiSecondBox.minkowskiSecondConstant_nonneg n + unfold projectedAxisDefectBudget + calc + _ ≤ (Real.exp n) ^ n * Real.exp (2 * (n : ℝ) ^ 2) := by gcongr + _ = Real.exp ((n : ℝ) * n + 2 * (n : ℝ) ^ 2) := by + rw [← Real.exp_nat_mul, ← Real.exp_add] + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [Nat.cast_nonneg (α := ℝ) n]) + +theorem projectedAxisNormBudget_add_one_le_exp (n : ℕ) : + projectedAxisNormBudget n + 1 ≤ Real.exp (5 * ((n : ℝ) + 1) ^ 2) := by + have h := one_add_le_exp_succ (by positivity : 0 ≤ 4 * ((n : ℝ) + 1) ^ 2) + (projectedAxisNormBudget_le_exp n) + calc + _ ≤ Real.exp (4 * ((n : ℝ) + 1) ^ 2 + 1) := by simpa only [add_comm] using h + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [Nat.cast_nonneg (α := ℝ) n]) + +theorem projectedChart_forwardBudget_le_exp (n : ℕ) : + 1 + (n : ℝ) * n.factorial * (projectedAxisNormBudget n + 1) ^ (n - 1) * + projectedAxisDefectBudget n ≤ Real.exp (20 * ((n : ℝ) + 1) ^ 3) := by + have hn : (n : ℝ) ≤ Real.exp n := by linarith [Real.add_one_le_exp (n : ℝ)] + have hf := factorial_le_exp_sq n + have hb := projectedAxisNormBudget_add_one_le_exp n + have hd := projectedAxisDefectBudget_le_exp n + have hd0 := (projectedAxisDefectBudget_pos n).le + have hb0 := (projectedAxisNormBudget_pos n).le + have hp : (projectedAxisNormBudget n + 1) ^ (n - 1) ≤ + (projectedAxisNormBudget n + 1) ^ n := + pow_le_pow_right₀ (by linarith) (Nat.sub_le _ _) + have hterm : (n : ℝ) * n.factorial * (projectedAxisNormBudget n + 1) ^ (n - 1) * + projectedAxisDefectBudget n ≤ + Real.exp ((n : ℝ) + (n : ℝ) ^ 2 + n * (5 * ((n : ℝ) + 1) ^ 2) + + 4 * ((n : ℝ) + 1) ^ 2) := by + calc + _ ≤ (n : ℝ) * n.factorial * (projectedAxisNormBudget n + 1) ^ n * + projectedAxisDefectBudget n := by gcongr + _ ≤ Real.exp n * Real.exp ((n : ℝ) ^ 2) * + (Real.exp (5 * ((n : ℝ) + 1) ^ 2)) ^ n * + Real.exp (4 * ((n : ℝ) + 1) ^ 2) := by gcongr + _ = _ := by rw [← Real.exp_nat_mul, ← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + apply (one_add_le_exp_succ (by positivity) hterm).trans + apply Real.exp_le_exp.mpr + have hn0 := Nat.cast_nonneg (α := ℝ) n + have hn3 : 0 ≤ (n : ℝ) ^ 3 := by positivity + nlinarith + +theorem projectedChart_inverseBudget_le_exp (n : ℕ) : + 1 + (n : ℝ) * (projectedAxisNormBudget n + 1) ≤ + Real.exp (20 * ((n : ℝ) + 1) ^ 3) := by + have hn : (n : ℝ) ≤ Real.exp n := by linarith [Real.add_one_le_exp (n : ℝ)] + have hb := projectedAxisNormBudget_add_one_le_exp n + have hb0 := (projectedAxisNormBudget_pos n).le + have hterm : (n : ℝ) * (projectedAxisNormBudget n + 1) ≤ + Real.exp ((n : ℝ) + 5 * ((n : ℝ) + 1) ^ 2) := by + calc + _ ≤ Real.exp n * Real.exp (5 * ((n : ℝ) + 1) ^ 2) := by gcongr + _ = _ := (Real.exp_add _ _).symm + apply (one_add_le_exp_succ (by positivity) hterm).trans + apply Real.exp_le_exp.mpr + have hn0 := Nat.cast_nonneg (α := ℝ) n + have hn3 : 0 ≤ (n : ℝ) ^ 3 := by positivity + nlinarith + +theorem projectedChart_volumeBudget_le_exp (n : ℕ) : + (n.factorial : ℝ) * (projectedAxisNormBudget n + 1) ^ n ≤ + Real.exp (20 * ((n : ℝ) + 1) ^ 3) := by + have hf := factorial_le_exp_sq n + have hb := projectedAxisNormBudget_add_one_le_exp n + have hb0 := (projectedAxisNormBudget_pos n).le + calc + _ ≤ Real.exp ((n : ℝ) ^ 2) * (Real.exp (5 * ((n : ℝ) + 1) ^ 2)) ^ n := by gcongr + _ = Real.exp ((n : ℝ) ^ 2 + n * (5 * ((n : ℝ) + 1) ^ 2)) := by + rw [← Real.exp_nat_mul, ← Real.exp_add] + _ ≤ _ := by + apply Real.exp_le_exp.mpr + have hn0 := Nat.cast_nonneg (α := ℝ) n + have hn3 : 0 ≤ (n : ℝ) ^ 3 := by positivity + nlinarith + +theorem projectedChart_defectBudget_le_exp (n : ℕ) : + projectedAxisDefectBudget n ≤ Real.exp (20 * ((n : ℝ) + 1) ^ 3) := by + apply (projectedAxisDefectBudget_le_exp n).trans + apply Real.exp_le_exp.mpr + have hn0 := Nat.cast_nonneg (α := ℝ) n + have hn3 : 0 ≤ (n : ℝ) ^ 3 := by positivity + nlinarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module Submodule MeasureTheory +open scoped BigOperators + +theorem exists_quantitative_projected_chart {J : Type*} [Fintype J] + (W : Submodule ℝ (EuclideanSpace ℝ J)) + [IsZLattice ℝ (latticeSection (standardEuclideanLattice J) W)] : + let n := finrank ℝ Wᗮ + let C : ℝ := 20 * ((n : ℝ) + 1) ^ 3 + ∃ b : Basis (Fin n) ℝ Wᗮ, + span ℤ (Set.range b) = projectedIntegerLattice W ∧ + (∀ i, 0 < basisAxisScale b i) ∧ + (∀ x, ‖normalizedOrthogonalChart W b x‖ ≤ Real.exp C * ‖x‖) ∧ + (∀ p, ‖(normalizedOrthogonalChart W b).symm p‖ ≤ Real.exp C * ‖p‖) ∧ + Real.exp (-C) ≤ + ZLattice.covolume (latticeSection (standardEuclideanLattice J) W) / + (∏ i, (basisAxisScale b i : ℝ)) ∧ + ZLattice.covolume (latticeSection (standardEuclideanLattice J) W) / + (∏ i, (basisAxisScale b i : ℝ)) ≤ Real.exp C := by + let n := finrank ℝ Wᗮ + obtain ⟨b, hspan, hK, _, hf, hi, hvlo, hvhi⟩ := exists_normalized_projected_chart W + refine ⟨b, hspan, hK, ?_, ?_, ?_, ?_⟩ + · intro x + exact (hf x).trans (mul_le_mul_of_nonneg_right (projectedChart_forwardBudget_le_exp n) + (norm_nonneg x)) + · intro p + exact (hi p).trans (mul_le_mul_of_nonneg_right (projectedChart_inverseBudget_le_exp n) + (norm_nonneg p)) + · apply le_trans _ hvlo + rw [Real.exp_neg, one_div] + apply (inv_le_inv₀ (Real.exp_pos _) _).2 + · exact projectedChart_volumeBudget_le_exp n + · have hB := projectedAxisNormBudget_pos n + positivity + · exact hvhi.trans (projectedChart_defectBudget_le_exp n) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuarticAntisymmetricBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticAntisymmetricBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..016f7205e5f1d99cbe4ffadaab01a11d736d579f --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticAntisymmetricBox.lean @@ -0,0 +1,111 @@ +import OAI.Combinatorics.Progressions.Estimates.QuarticAntisymmetricModel + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_quartic_antisymmetric_box_with_mixed : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ n, ‖f n‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 5 f → + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 3) ((p + C) ^ C), + M.HasMixedCorrelation f ∧ + ∃ W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) ((p + C) ^ C), + W.dim ≤ 16 * M.dim ∧ + (∀ (e : ReplicatedPermutation (mixedCorrelationDegree 3)) k x, + W.eval k (fun j => x ((replicatedPermutation (mixedCorrelationDegree 3) e).symm j)) = W.eval k x) ∧ + NativeIntegerVectorEquivalence 3 ((p + C) ^ C) M.eval + (fun i x => W.eval i (quarticInput (x 0) (fun _ => x 1))) ∧ + NativeIntegerVectorEquivalence 3 ((p + C) ^ C) (M.mixedSecondDifferenceWithShift 0) + (quarticSixFactorVector W.eval) ∧ + ∃ i j : Fin (W.outputDim ^ 6), + Real.exp (-((p + C) ^ C)) ≤ + (boxPhaseMoment 4 (fun x : Fin 4 → ZMod N => + (W.tensorPower 6).quarticAntisymmetric i j (fun a => (x a).val))).re := by + obtain ⟨a, _, hanti⟩ := exists_quartic_antisymmetric_model_with_mixed + let Q : Polynomial ℕ := (Polynomial.X + Polynomial.C a) ^ a + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (16 * Q + 2) + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hGowers + let q := (p + a) ^ a + have hq : 0 ≤ q := by dsimp only [q]; positivity + have hsum : 16 * q + 2 ≤ (p + C) ^ C := by + simpa [Q, q, Polynomial.eval₂_pow] using hbudget p hp + have hqC : q ≤ (p + C) ^ C := by linarith + have hcost : 16 * q ≤ (p + C) ^ C := by linarith + obtain ⟨M, hret, W, hdim, hsymm, hdiag, E, i, j, A, hA, hAind, hcorr⟩ := + hanti hp ((Real.exp_le_exp.mpr hqC).trans hN) f hf hGowers + let F (x : Fin 4 → ZMod N) := (W.tensorPower 6).quarticAntisymmetric i j (fun a => (x a).val) + let U (a : Fin 4) (x : Fin 4 → ZMod N) := A a (fun b => (x b).val) + let e : (Fin 4 → ZMod N) ≃ ((ZMod N × ZMod N) × (ZMod N × ZMod N)) := + { toFun := fun x => ((x 2, x 3), (x 0, x 1)) + invFun := fun t => ![t.2.1, t.2.2, t.1.1, t.1.2] + left_inv := by intro x; funext a; fin_cases a <;> rfl + right_inv := by rintro ⟨⟨_, _⟩, ⟨_, _⟩⟩; rfl } + have havg : boxTestCorrelation F U = + 𝔼 t : (ZMod N × ZMod N) × (ZMod N × ZMod N), + (W.tensorPower 6).quarticAntisymmetric i j + ![(t.2.1.val : ℤ), (t.2.2.val : ℤ), (t.1.1.val : ℤ), (t.1.2.val : ℤ)] * + ∏ k, A k ![(t.2.1.val : ℤ), (t.2.2.val : ℤ), (t.1.1.val : ℤ), (t.1.2.val : ℤ)] := by + unfold boxTestCorrelation + apply Fintype.expect_equiv e + intro x + have hv : ![((x 0).val : ℤ), ((x 1).val : ℤ), ((x 2).val : ℤ), ((x 3).val : ℤ)] = + fun a => ((x a).val : ℤ) := by + funext a + fin_cases a <;> rfl + change F x * ∏ k, U k x = (W.tensorPower 6).quarticAntisymmetric i j + ![((x 0).val : ℤ), ((x 1).val : ℤ), ((x 2).val : ℤ), ((x 3).val : ℤ)] * + ∏ k, A k ![((x 0).val : ℤ), ((x 1).val : ℤ), ((x 2).val : ℤ), ((x 3).val : ℤ)] + rw [hv] + have hmiss : ∀ a, MissesBoxCoordinate (U a) a := by + intro a x v + apply hAind + intro b hba + change (((Function.update x a v) b).val : ℤ) = ((x b).val : ℤ) + rw [Function.update_of_ne hba] + have hbox : ‖boxTestCorrelation F U‖ ^ 16 ≤ (boxPhaseMoment 4 F).re := + boxTest_cauchySchwarz 3 F U (fun a x => hA a _) hmiss + have hscore : Real.exp (-(16 * q)) ≤ (boxPhaseMoment 4 F).re := by + have hc : Real.exp (-q) ≤ ‖boxTestCorrelation F U‖ := by rwa [havg] + have hpow : Real.exp (-(16 * q)) = (Real.exp (-q)) ^ 16 := by + rw [← Real.exp_nat_mul] + congr 1 + ring + rw [hpow] + exact (pow_le_pow_left₀ (Real.exp_nonneg _) hc 16).trans hbox + refine ⟨M.mono hqC, hret.mono hqC, W.mono hqC, hdim, hsymm, hdiag.mono hqC, E.mono hqC, i, j, ?_⟩ + exact (Real.exp_le_exp.mpr (neg_le_neg hcost)).trans hscore + +theorem exists_quartic_antisymmetric_box : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {N : ℕ} [NeZero N] {p : ℝ}, 0 ≤ p → + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + ∀ f : ZMod N → ℂ, (∀ n, ‖f n‖ ≤ 1) → Real.exp (-p) ≤ gowersNorm 5 f → + ∃ M : NativeMultidegreeNilcharacter (mixedCorrelationDegree 3) ((p + C) ^ C), + ∃ W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) ((p + C) ^ C), + W.dim ≤ 16 * M.dim ∧ + (∀ (e : ReplicatedPermutation (mixedCorrelationDegree 3)) k x, + W.eval k (fun j => x ((replicatedPermutation (mixedCorrelationDegree 3) e).symm j)) = W.eval k x) ∧ + NativeIntegerVectorEquivalence 3 ((p + C) ^ C) M.eval + (fun i x => W.eval i (quarticInput (x 0) (fun _ => x 1))) ∧ + NativeIntegerVectorEquivalence 3 ((p + C) ^ C) (M.mixedSecondDifferenceWithShift 0) + (quarticSixFactorVector W.eval) ∧ + ∃ i j : Fin (W.outputDim ^ 6), + Real.exp (-((p + C) ^ C)) ≤ + (boxPhaseMoment 4 (fun x : Fin 4 → ZMod N => + (W.tensorPower 6).quarticAntisymmetric i j (fun a => (x a).val))).re := by + obtain ⟨C, hC, h⟩ := exists_quartic_antisymmetric_box_with_mixed + refine ⟨C, hC, ?_⟩ + intro N _ p hp hN f hf hGowers + obtain ⟨M, _hret, hM⟩ := h hp hN f hf hGowers + exact ⟨M, hM⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxFactorizationTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxFactorizationTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..4404ad14c15b50a8e10030c28ea6b1c4f93308d7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxFactorizationTransport.lean @@ -0,0 +1,81 @@ +import OAI.Combinatorics.Progressions.Polynomial.QuarticBoxPolynomial + +namespace OAI + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem tensorPowerBudget_mono (n : ℕ) {p q : ℝ} (hpq : p ≤ q) : + tensorPowerBudget n p ≤ tensorPowerBudget n q := by + unfold tensorPowerBudget + exact mul_le_mul_of_nonneg_left (by linarith : p + 1 ≤ q + 1) (by positivity) + +theorem NativeMultidegreeNilcharacter.tensorPower_mono {σ : Type*} [Fintype σ] + {bound : σ → ℕ} {p q : ℝ} (W : NativeMultidegreeNilcharacter bound p) (hpq : p ≤ q) (n : ℕ) : + (W.mono hpq).tensorPower n = (W.tensorPower n).mono (tensorPowerBudget_mono n hpq) := by + rfl + +noncomputable def NativeQuarticBoxFactorization.mono {p p' q q' : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p} + (R : NativeQuarticBoxFactorization W N q) (hp : p ≤ p') (hq : q ≤ q') : + NativeQuarticBoxFactorization (W.mono hp) N q' := by + letI := R.topology + letI := R.topologicalAdd + letI := R.continuousSMul + letI := R.hausdorff + letI : TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → (W.mono hp).L)) := R.topology + letI : IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → (W.mono hp).L)) := R.topologicalAdd + letI : ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → (W.mono hp).L)) := R.continuousSMul + letI : T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → (W.mono hp).L)) := R.hausdorff + have hfactor := NilpotentLieFiltration.ControlledSymbolFactorization.mono + (pi (fun _ : QuarticBoxFactor => W.model)).filtration R.basis R.weight R.adapted R.factorization hq + (fun _ => by exact_mod_cast NeZero.pos N) + have hsymbol : + ((W.mono hp).quarticAntisymmetricBoxNiltest (R.nonnegative.trans hp) R.leftIndex R.rightIndex).symbol + R.basis R.weight R.adapted = + (W.quarticAntisymmetricBoxNiltest R.nonnegative R.leftIndex R.rightIndex).symbol + R.basis R.weight R.adapted := by + rw [(W.mono hp).quarticAntisymmetricBoxNiltest_symbol + (R.nonnegative.trans hp) R.leftIndex R.rightIndex R.basis R.weight R.adapted] + rw [W.quarticAntisymmetricBoxNiltest_symbol + R.nonnegative R.leftIndex R.rightIndex R.basis R.weight R.adapted] + have hhom : + (pi (fun _ : QuarticBoxFactor => (W.mono hp).model)).filtration.realPolynomialSymbolHom + R.basis R.weight R.adapted (fun _ : QuarticBoxIndex => 1) = + (pi (fun _ : QuarticBoxFactor => W.model)).filtration.realPolynomialSymbolHom + R.basis R.weight R.adapted (fun _ : QuarticBoxIndex => 1) := by + rfl + rw [hhom, W.quarticAntisymmetricBoxPolynomial_mono hp R.leftIndex R.rightIndex] + cases W + rfl + have htransport := (congrArg (fun symbol => + (pi (fun _ : QuarticBoxFactor => W.model)).filtration.ControlledSymbolFactorization + R.basis R.weight R.adapted (piFrequency W.quarticAntisymmetricBoxFrequencies) + (fun _ : QuarticBoxIndex => (N : ℝ)) symbol q') hsymbol).mpr hfactor + exact { + leftIndex := R.leftIndex + rightIndex := R.rightIndex + nonnegative := R.nonnegative.trans hp + topology := R.topology + topologicalAdd := R.topologicalAdd + continuousSMul := R.continuousSMul + hausdorff := R.hausdorff + basis := R.basis + weight := R.weight + adapted := R.adapted + height := fun i j => (R.height i j).trans hq + factorization := htransport } + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxGlobalExpansion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxGlobalExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..69ff54fd0167f7b8b506ff0d7be6e3deb1b5909a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxGlobalExpansion.lean @@ -0,0 +1,320 @@ +import OAI.Combinatorics.Progressions.Estimates.QuarticFrozenMiddleExpansion + +namespace OAI + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold NilpotentLieBCHGroup +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_quartic_box_outer_control : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + {N : ℕ} [NeZero N] (i j : Fin W.outputDim) + (R : NativePolynomialOrbitFactors (pi (fun _ : QuarticBoxFactor => W.model)) + (W.quarticAntisymmetricBoxPolynomial i j) + (piFrequency W.quarticAntisymmetricBoxFrequencies) (fun _ : QuarticBoxIndex => (N : ℝ)) q), + 0 ≤ q → R.HasOuterValueControl ((p + q + C) ^ C) ∧ + ∃ P : ℕ, 0 < P ∧ (P : ℝ) ≤ Real.exp ((p + q + C) ^ C) ∧ + (∀ x y : QuarticBoxIndex → ℤ, (∀ k, (P : ℤ) ∣ x k - y k) → + ((QuotientGroup.mk (R.rationalValue x) : + (pi (fun _ : QuarticBoxFactor => W.model)).Space) = + QuotientGroup.mk (R.rationalValue y))) ∧ + (letI := rightMetricSpace + (hnil := (pi (fun _ : QuarticBoxFactor => W.model)).filtration.realification.lowerCentralSeries_eq_bot) + ((pi (fun _ : QuarticBoxFactor => W.model)).basis.baseChange ℝ) + ∀ (x y : QuarticBoxIndex → ℤ) (δ : ℝ), 0 ≤ δ → + (∀ k, |(x k : ℝ)| ≤ (N : ℝ)) → (∀ k, |(y k : ℝ)| ≤ (N : ℝ)) → + (∀ k, |(x k : ℝ) - (y k : ℝ)| ≤ (N : ℝ) * δ) → + dist (R.slowValue x) (R.slowValue y) ≤ Real.exp ((p + q + C) ^ C) * δ) := by + obtain ⟨a, _, houter⟩ := exists_native_orbit_outer_control (∑ _ : QuarticReplicatedIndex, 1) 8 + obtain ⟨b, _, hlocal⟩ := exists_native_orbit_local_control (∑ _ : QuarticReplicatedIndex, 1) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let T := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + 8 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + ((T + Polynomial.C a) ^ a + (T + Polynomial.C b) ^ b) + refine ⟨C, hC, ?_⟩ + intro p q W _ _ _ _ N _ i j R hq + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let v := p + q + let t := productNiltestBudget (v + 32) + v + 8 + have hv : 0 ≤ v := add_nonneg hp hq + have hpv : p ≤ v := le_add_of_nonneg_right hq + have hqv : q ≤ v := le_add_of_nonneg_left hp + have hprod : 0 ≤ productNiltestBudget (v + 32) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hvt : v ≤ t := by dsimp only [t]; linarith only [hprod] + have ht : 0 ≤ t := hv.trans hvt + have hqt : q ≤ t := hqv.trans hvt + have hcard : (Fintype.card QuarticBoxIndex : ℝ) ≤ t := by + norm_num [QuarticBoxIndex] + dsimp only [t] + linarith only [hprod, hv] + have hmono : productNiltestBudget (p + 32) ≤ productNiltestBudget (v + 32) := + productNiltestBudget_mono (by positivity) (by linarith only [hpv]) + have htest : productNiltestBudget (p + 32) ≤ t := by + dsimp only [t] + linarith only [hmono, hv] + let D := pi (fun _ : QuarticBoxFactor => W.model) + have hD : D.GeometryComplexityLE t := + (W.quarticAntisymmetricBoxNiltest_complexity hp i j).1.mono D htest + have hN : ∀ _k : QuarticBoxIndex, (0 : ℝ) < N := fun _ => Nat.cast_pos.mpr (NeZero.pos N) + have hcost : (t + a) ^ a + (t + b) ^ b ≤ (p + q + C) ^ C := by + simpa [X, Q, T, t, v, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget v hv + have haC : (t + a) ^ a ≤ (p + q + C) ^ C := + (le_add_of_nonneg_right (by positivity)).trans hcost + have hbC : (t + b) ^ b ≤ (p + q + C) ^ C := + (le_add_of_nonneg_left (by positivity)).trans hcost + have hout : R.HasOuterValueControl ((t + a) ^ a) := + houter (R.mono hqt hN) ht hD hN (by simp [QuarticBoxIndex]) + refine ⟨R.hasOuterValueControl_mono hout haC, ?_⟩ + obtain ⟨P, hP, hPb, hcosets, hmotion⟩ := hlocal (R.mono hqt hN) ht hD hcard hN + refine ⟨P, hP, hPb.trans (Real.exp_le_exp.mpr hbC), fun x y hxy => (hcosets x y hxy).1, ?_⟩ + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + intro x y δ hδ hx hy hxy + exact (hmotion x y δ hδ hx hy hxy).trans + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hbC) hδ) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold NilpotentLieBCHGroup +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem quartic_box_frozen_error {p q : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + (hp : 0 ≤ p) {N : ℕ} (i j : Fin W.outputDim) + (R : NativePolynomialOrbitFactors (pi (fun _ : QuarticBoxFactor => W.model)) + (W.quarticAntisymmetricBoxPolynomial i j) + (piFrequency W.quarticAntisymmetricBoxFrequencies) (fun _ : QuarticBoxIndex => (N : ℝ)) q) + (x y : QuarticBoxIndex → ℤ) + (hcoset : (QuotientGroup.mk (R.rationalValue x) : + (pi (fun _ : QuarticBoxFactor => W.model)).Space) = QuotientGroup.mk (R.rationalValue y)) : + letI := rightMetricSpace + (hnil := (pi (fun _ : QuarticBoxFactor => W.model)).filtration.realification.lowerCentralSeries_eq_bot) + ((pi (fun _ : QuarticBoxFactor => W.model)).basis.baseChange ℝ) + ‖W.quarticAntisymmetricBoxValue i j x - + (W.quarticAntisymmetricBoxNiltest hp i j).observable + (QuotientGroup.mk (R.frozenMiddleValue (R.slowValue y) (R.rationalValue y) x))‖ ≤ + Real.exp (productNiltestBudget (p + 32)) * dist (R.slowValue x) (R.slowValue y) := by + let D := pi (fun _ : QuarticBoxFactor => W.model) + let S := W.quarticAntisymmetricBoxNiltest hp i j + let middle := D.filtration.adaptedPolynomialRealValueHom + (fun _ : QuarticBoxIndex => 1) (fun k => (x k : ℝ)) R.middle + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + have hright := D.observable_frozen_right_eq S.observable (R.slowValue x) middle + (R.rationalValue x) (R.rationalValue y) hcoset + have hchange := D.frozen_observable_change_left S.observable S.lipschitz + (R.slowValue x) (R.slowValue y) middle (R.rationalValue y) + rw [← hright] at hchange + have hlip : (S.lipBound : ℝ) ≤ Real.exp (productNiltestBudget (p + 32)) := by + have h := S.observable_budget (W.quarticAntisymmetricBoxNiltest_complexity hp i j) + linarith [S.normBound.coe_nonneg] + rw [quartic_box_eval_factors W i j R hp x] + exact hchange.trans (mul_le_mul_of_nonneg_right hlip dist_nonneg) + +theorem exists_quartic_box_local_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + {N : ℕ} [NeZero N] (i j : Fin W.outputDim) + (_R : NativePolynomialOrbitFactors (pi (fun _ : QuarticBoxFactor => W.model)) + (W.quarticAntisymmetricBoxPolynomial i j) + (piFrequency W.quarticAntisymmetricBoxFrequencies) (fun _ : QuarticBoxIndex => (N : ℝ)) q), + 0 ≤ q → ∃ P : ℕ, 0 < P ∧ (P : ℝ) ≤ Real.exp ((p + q + C) ^ C) ∧ + ∀ y : QuarticBoxIndex → ℤ, (∀ k, |(y k : ℝ)| ≤ (N : ℝ)) → + ∃ F : (QuarticBoxIndex → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : QuarticBoxIndex => 1) 3 ((p + q + C) ^ C) F) ∧ + (∀ x, ‖F x‖ ≤ 1) ∧ + ∀ (x : QuarticBoxIndex → ℤ) (δ : ℝ), 0 ≤ δ → + (∀ k, |(x k : ℝ)| ≤ (N : ℝ)) → (∀ k, (P : ℤ) ∣ x k - y k) → + (∀ k, |(x k : ℝ) - (y k : ℝ)| ≤ (N : ℝ) * δ) → + ‖W.quarticAntisymmetricBoxValue i j x - F x‖ ≤ + Real.exp ((p + q + C) ^ C) * δ := by + obtain ⟨a, _, houter⟩ := exists_quartic_box_outer_control + obtain ⟨b, _, hfrozen⟩ := exists_quartic_frozen_middle_expansion_of_bounds + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let T := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + let U := (X + Polynomial.C a) ^ a + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget + (U + T + (X + U + Polynomial.C b) ^ b) + refine ⟨C, hC, ?_⟩ + intro p q W _ _ _ _ N _ i j R hq + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let v := p + q + let u := (v + a) ^ a + let t := productNiltestBudget (v + 32) + have hv : 0 ≤ v := add_nonneg hp hq + have hu : 0 ≤ u := by dsimp only [u]; positivity + have ht : 0 ≤ t := by unfold t productNiltestBudget productObservableLipBudget; positivity + have hsum : u + t + (v + u + b) ^ b ≤ (p + q + C) ^ C := by + simpa [X, Q, T, U, t, u, v, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget v hv + have hpow : 0 ≤ (v + u + b) ^ b := by positivity + have huC : u ≤ (p + q + C) ^ C := by linarith only [hsum, ht, hpow] + have herror : t + u ≤ (p + q + C) ^ C := by linarith only [hsum, hpow] + have hexpand : (v + u + b) ^ b ≤ (p + q + C) ^ C := by linarith only [hsum, hu, ht] + have htest : productNiltestBudget (p + 32) ≤ t := by + have hpv : p ≤ v := le_add_of_nonneg_right hq + exact productNiltestBudget_mono (by positivity) (by linarith only [hpv]) + obtain ⟨⟨m, hm, hmb, hrat, hslow⟩, P, hP, hPb, hcosets, hmotion⟩ := houter W i j R hq + refine ⟨P, hP, hPb.trans (Real.exp_le_exp.mpr huC), ?_⟩ + intro y hy + let F := fun x => (W.quarticAntisymmetricBoxNiltest hp i j).observable + (QuotientGroup.mk (R.frozenMiddleValue (R.slowValue y) (R.rationalValue y) x)) + obtain ⟨E⟩ := hfrozen W hp i j R hq hu m hm hmb + (R.slowValue y) (R.rationalValue y) (hslow y hy) (hrat y) + refine ⟨F, ⟨E.mono hexpand⟩, fun x => W.quarticAntisymmetricBoxNiltest_norm i j hp _, ?_⟩ + intro x δ hδ hx hres hnear + let D := pi (fun _ : QuarticBoxFactor => W.model) + let := rightMetricSpace (hnil := D.filtration.realification.lowerCentralSeries_eq_bot) + (D.basis.baseChange ℝ) + have herr := quartic_box_frozen_error W hp i j R x y (hcosets x y hres) + have hdist := hmotion x y δ hδ hx hy hnear + apply herr.trans + calc + _ ≤ Real.exp t * (Real.exp u * δ) := + mul_le_mul (Real.exp_le_exp.mpr htest) hdist dist_nonneg (Real.exp_nonneg t) + _ = Real.exp (t + u) * δ := by rw [← mul_assoc, ← Real.exp_add] + _ ≤ _ := mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr herror) hδ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_quartic_box_global_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q r : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + [TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + {N : ℕ} [NeZero N] (i j : Fin W.outputDim) + (_R : NativePolynomialOrbitFactors (pi (fun _ : QuarticBoxFactor => W.model)) + (W.quarticAntisymmetricBoxPolynomial i j) + (piFrequency W.quarticAntisymmetricBoxFrequencies) (fun _ : QuarticBoxIndex => (N : ℝ)) q), + 0 ≤ q → 0 ≤ r → Real.exp ((p + q + r + C) ^ C) ≤ (N : ℝ) → + ∃ F : (QuarticBoxIndex → ℤ) → ℂ, + Nonempty (NativeIntegerExpansion (fun _ : QuarticBoxIndex => 1) 3 ((p + q + r + C) ^ C) F) ∧ + (∀ x : QuarticBoxIndex → ZMod N, ‖F (fun k => ((x k).val : ℤ))‖ ≤ 1) ∧ + (𝔼 x : QuarticBoxIndex → ZMod N, + ‖W.quarticAntisymmetricBoxValue i j (fun k => ((x k).val : ℤ)) - + F (fun k => ((x k).val : ℤ))‖) ≤ Real.exp (-r) := by + obtain ⟨A, _, hlocal⟩ := exists_quartic_box_local_expansion + obtain ⟨B, _, hpatch⟩ := exists_bounded_variable_patch_expansion 8 2 (by norm_num) + let X : Polynomial ℕ := Polynomial.X + let U := (X + Polynomial.C A) ^ A + let T := U + X + 300 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((T + Polynomial.C B) ^ B + 2 * T) + refine ⟨C, hC, ?_⟩ + intro p q r W _ _ _ _ N _ i j R hq hr hN + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let w := p + q + r + let b := (w + A) ^ A + let t := b + w + 300 + have hw : 0 ≤ w := by dsimp only [w]; positivity + have hb : 0 ≤ b := by dsimp only [b]; positivity + have ht : 0 ≤ t := by dsimp only [t]; positivity + have hlocalt : (p + q + A) ^ A ≤ t := by + have hmono : (p + q + A) ^ A ≤ b := by + dsimp only [b] + apply pow_le_pow_left₀ (by positivity) + dsimp only [w] + linarith only [hr] + exact hmono.trans (by dsimp only [t]; linarith only [hw]) + have hsum : (t + B) ^ B + 2 * t ≤ (p + q + r + C) ^ C := by + simpa [X, U, T, b, w, t, Polynomial.eval₂_pow] using hbudget w hw + have hcost : (t + B) ^ B ≤ (p + q + r + C) ^ C := by linarith only [hsum, ht] + have hscale : 2 * t ≤ (p + q + r + C) ^ C := by + have hpow : 0 ≤ (t + B) ^ B := by positivity + linarith only [hsum, hpow] + let ρ := Real.exp (-(2 * t)) + have hρ : 0 < ρ := Real.exp_pos _ + have hprec : 1 / ρ ≤ Real.exp ((t + 2) ^ 2) := by + dsimp only [ρ] + rw [one_div, ← Real.exp_neg] + apply Real.exp_le_exp.mpr + nlinarith [sq_nonneg t] + obtain ⟨P, hP, hPb, hmodels⟩ := hlocal W i j R hq + let : NeZero P := ⟨hP.ne'⟩ + have hunit (x : QuarticBoxIndex → ℤ) : ‖W.quarticAntisymmetricBoxValue i j x‖ ≤ 1 := + W.quarticAntisymmetricBoxValue_norm i j x + obtain ⟨F, ⟨E⟩, hFnorm, herr⟩ := hpatch (s := 3) (N := N) (P := P) + (by simp [QuarticBoxIndex]) (by norm_num) ht (hPb.trans (Real.exp_le_exp.mpr hlocalt)) hρ hprec + (W.quarticAntisymmetricBoxValue i j) hunit (by + intro y hy + obtain ⟨G, ⟨EG⟩, hGnorm, hGerror⟩ := hmodels y hy + refine ⟨G, ⟨EG.mono hlocalt⟩, hGnorm, ?_⟩ + intro x δ hδ hx hres hnear + exact (hGerror x δ hδ hx hres hnear).trans + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr hlocalt) hδ)) + rw [show (18 : ℝ) * (8 : ℕ) + 2 = 146 by norm_num] at herr + have hrecip : 1 / (N : ℝ) ≤ ρ := by + have hh := one_div_le_one_div_of_le (Real.exp_pos (2 * t)) + ((Real.exp_le_exp.mpr hscale).trans hN) + simpa only [ρ, one_div, Real.exp_neg] using hh + refine ⟨F, ⟨E.mono hcost⟩, hFnorm, herr.trans ?_⟩ + calc + _ ≤ Real.exp (t + 146) * (2 * ρ) := + mul_le_mul_of_nonneg_left (by linarith only [hrecip]) (Real.exp_nonneg _) + _ = 2 * Real.exp (146 - t) := by + dsimp only [ρ] + rw [← mul_assoc, mul_comm (Real.exp (t + 146)) 2, mul_assoc, ← Real.exp_add] + congr 2 + ring + _ ≤ 2 * (Real.exp (-r) / 2) := by + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply (Real.exp_le_exp.mpr (show 146 - t ≤ -r - 1 by + dsimp only [t, w] + linarith only [hb, hp, hq])).trans + exact exp_sub_one_le_half_exp (-r) + _ = _ := by ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxOrbitFactors.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxOrbitFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc3f9282f834a888fc43282ff3bcfe896b7d66fc --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxOrbitFactors.lean @@ -0,0 +1,78 @@ +import OAI.Combinatorics.Progressions.Estimates.MixedPairComparison +import OAI.Combinatorics.Progressions.Polynomial.QuarticBoxPolynomial + +namespace OAI + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_quartic_box_orbit_factors : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p q : ℝ}, 0 ≤ q → + ∀ (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + {N : ℕ} [NeZero N] (F : NativeQuarticBoxFactorization W N q), + Real.exp ((p + q + C) ^ C) ≤ (N : ℝ) → + Nonempty (NativePolynomialOrbitFactors (pi (fun _ : QuarticBoxFactor => W.model)) + (W.quarticAntisymmetricBoxPolynomial F.leftIndex F.rightIndex) + (piFrequency W.quarticAntisymmetricBoxFrequencies) (fun _ : QuarticBoxIndex => (N : ℝ)) + ((p + q + C) ^ C)) := by + obtain ⟨a, _, horbit⟩ := exists_native_polynomial_orbit_factors (∑ _ : QuarticReplicatedIndex, 1) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let R := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + 8 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (R + (R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro p q hq W N _ F hN + have hp := F.nonnegative + let := F.topology + let := F.topologicalAdd + let := F.continuousSMul + let := F.hausdorff + let D := pi (fun _ : QuarticBoxFactor => W.model) + let g := W.quarticAntisymmetricBoxPolynomial F.leftIndex F.rightIndex + let w := p + q + let r := productNiltestBudget (w + 32) + w + 8 + have hw : 0 ≤ w := by dsimp only [w]; positivity + have hprod : 0 ≤ productNiltestBudget (w + 32) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hwr : w ≤ r := by dsimp only [r]; linarith only [hprod] + have hqr : q ≤ r := (by dsimp only [w]; linarith : q ≤ w).trans hwr + have h8r : 8 ≤ r := by dsimp only [r]; linarith only [hprod, hw] + have hmono : productNiltestBudget (p + 32) ≤ productNiltestBudget (w + 32) := + productNiltestBudget_mono (by positivity) (by dsimp only [w]; linarith) + have hTr : productNiltestBudget (p + 32) ≤ r := hmono.trans (by dsimp only [r]; linarith only [hw]) + have hr : 0 ≤ r := hw.trans hwr + have hcost : r + (r + a) ^ a ≤ (p + q + C) ^ C := by + simpa [X, Q, R, r, w, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget w hw + have hfinal : (r + a) ^ a ≤ (p + q + C) ^ C := by linarith only [hcost, hr] + have hgeom : D.GeometryComplexityLE r := + (W.quarticAntisymmetricBoxNiltest_complexity hp F.leftIndex F.rightIndex).1.mono D hTr + have hfactor : D.filtration.ControlledSymbolFactorization F.basis F.weight F.adapted + (piFrequency W.quarticAntisymmetricBoxFrequencies) (fun _ : QuarticBoxIndex => (N : ℝ)) + (D.filtration.realPolynomialSymbolHom F.basis F.weight F.adapted (fun _ => 1) g) r := by + have h := F.factorization + rw [W.quarticAntisymmetricBoxNiltest_symbol] at h + have hNpos : ∀ _ : QuarticBoxIndex, (0 : ℝ) < N := fun _ => Nat.cast_pos.mpr (NeZero.pos N) + have H := NilpotentLieFiltration.ControlledSymbolFactorization.mono + (pi (fun _ : QuarticBoxFactor => W.model)).filtration F.basis F.weight F.adapted h hqr hNpos + dsimp only [D, g] + exact H + obtain ⟨U⟩ := horbit D F.basis F.weight F.adapted hr hgeom (by simpa [QuarticBoxIndex] using h8r) + (fun i j => (F.height i j).trans hqr) g (piFrequency W.quarticAntisymmetricBoxFrequencies) + (fun _ : QuarticBoxIndex => (N : ℝ)) (fun _ => (Real.exp_le_exp.mpr hfinal).trans hN) hfactor + exact ⟨U.mono hfinal (fun _ => by exact_mod_cast NeZero.pos N)⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxStepDrop.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxStepDrop.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fadf595e9221d6d8cd6accd8acfab5db350ef14 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticBoxStepDrop.lean @@ -0,0 +1,358 @@ +import OAI.Combinatorics.Progressions.Estimates.QuadraticPairStepDrop +import OAI.Combinatorics.Progressions.Estimates.QuarticAntisymmetricTransfer + +namespace OAI + +section + +namespace Erdos3 + +abbrev QuarticBoxIndex := Fin 4 × Bool + +namespace NativeMultidegreeNilcharacter + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + +noncomputable def quarticBoxComponent (out : Fin W.outputDim) (v : Fin 4 → QuarticBoxIndex) : + W.model.Niltest (fun _ : QuarticBoxIndex => 1) := + (W.component out).affinePullback + (fun j a => if a = (if j.1 = 0 then v 0 else if j.2.val = 0 then v 1 + else if j.2.val = 1 then v 2 else v 3) then 1 else 0) (fun _ => 0) + +theorem quarticBoxComponent_eval (out : Fin W.outputDim) (v : Fin 4 → QuarticBoxIndex) + (n : QuarticBoxIndex → ℤ) : + (W.quarticBoxComponent out v).eval n = + W.eval out (quarticInput (n (v 0)) ![n (v 1), n (v 2), n (v 3)]) := by + rw [quarticBoxComponent, Niltest.eval_affinePullback, component_eval] + apply congrArg (W.eval out) + funext j + rcases j with ⟨j, a⟩ + fin_cases j <;> fin_cases a <;> + simp [integerAffineMap, quarticInput, ite_mul] + +theorem quarticBoxComponent_vertical (out : Fin W.outputDim) (v : Fin 4 → QuarticBoxIndex) + (z : W.model.RealGroup) + (hz : z ∈ W.model.filtration.realification.subgroup (∑ _ : QuarticReplicatedIndex, 1)) + (x : W.model.Space) : + (W.quarticBoxComponent out v).observable (z • x) = + CircleFourier.character + ((realifyFunctional W.vertical.frequency z.coord : ℝ) : CircleFourier.Circle) * + (W.quarticBoxComponent out v).observable x := by + exact W.vertical.vertical out z (by rwa [W.multi.realSubgroup_top]) x + +noncomputable def quarticKernelFactors (i j : Fin W.outputDim) (v : Fin 4 → QuarticBoxIndex) : + Fin 2 → W.model.Niltest (fun _ : QuarticBoxIndex => 1) := + ![W.quarticBoxComponent i v, (W.quarticBoxComponent j ![v 1, v 0, v 2, v 3]).conjugate] + +noncomputable def quarticKernelFrequencies : Fin 2 → (W.L →ₗ[ℚ] ℚ) := + ![W.vertical.frequency, -W.vertical.frequency] + +theorem quarticKernelFactors_complexity (i j : Fin W.outputDim) (v : Fin 4 → QuarticBoxIndex) + (a : Fin 2) : (W.quarticKernelFactors i j v a).ComplexityLE (p + 32) := by + have hi := (W.component_complexity i).mono (by linarith : p + 4 ≤ p + 32) + have hj := (W.component_complexity j).mono (by linarith : p + 4 ≤ p + 32) + fin_cases a + · exact hi + · exact hj + +theorem quarticKernelFactors_normBound (i j : Fin W.outputDim) (v : Fin 4 → QuarticBoxIndex) + (a : Fin 2) : (W.quarticKernelFactors i j v a).normBound = 1 := by + fin_cases a <;> rfl + +theorem quarticKernelFactors_eval (i j : Fin W.outputDim) (v : Fin 4 → QuarticBoxIndex) + (n : QuarticBoxIndex → ℤ) : + (∏ a, (W.quarticKernelFactors i j v a).eval n) = + W.quarticAntisymmetric i j (fun a => n (v a)) := by + simp [quarticKernelFactors, Fin.prod_univ_two, quarticBoxComponent_eval, quarticAntisymmetric] + +theorem quarticKernelFactors_vertical (i j : Fin W.outputDim) (v : Fin 4 → QuarticBoxIndex) + (a : Fin 2) (z : W.model.RealGroup) + (hz : z ∈ W.model.filtration.realification.subgroup (∑ _ : QuarticReplicatedIndex, 1)) + (x : W.model.Space) : + (W.quarticKernelFactors i j v a).observable (z • x) = + CircleFourier.character + ((realifyFunctional (W.quarticKernelFrequencies a) z.coord : ℝ) : CircleFourier.Circle) * + (W.quarticKernelFactors i j v a).observable x := by + fin_cases a + · exact W.quarticBoxComponent_vertical i v z hz x + · exact Niltest.conjugate_vertical _ _ (W.quarticBoxComponent_vertical j _) z hz x + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3 + +abbrev QuarticBoxFactor := (Fin 4 → Bool) × Fin 2 + +theorem quarticBoxFactor_card : Fintype.card QuarticBoxFactor = 32 := by decide + +def quarticBoxCorner (ω : Fin 4 → Bool) : Fin 4 → QuarticBoxIndex := fun i => (i, ω i) + +namespace NativeMultidegreeNilcharacter + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + +noncomputable def quarticAntisymmetricBoxValue (i j : Fin W.outputDim) (n : QuarticBoxIndex → ℤ) : ℂ := + boxCornerProduct (W.quarticAntisymmetric i j) (fun a => n (a, false)) (fun a => n (a, true)) + +noncomputable def quarticAntisymmetricBoxFactors (i j : Fin W.outputDim) (a : QuarticBoxFactor) : + W.model.Niltest (fun _ : QuarticBoxIndex => 1) := + let T := W.quarticKernelFactors i j (quarticBoxCorner a.1) a.2 + if booleanWeight a.1 % 2 = 0 then T else T.conjugate + +noncomputable def quarticAntisymmetricBoxFrequencies (a : QuarticBoxFactor) : W.L →ₗ[ℚ] ℚ := + if booleanWeight a.1 % 2 = 0 then W.quarticKernelFrequencies a.2 else -W.quarticKernelFrequencies a.2 + +theorem quarticAntisymmetricBoxFactors_complexity (i j : Fin W.outputDim) (a : QuarticBoxFactor) : + (W.quarticAntisymmetricBoxFactors i j a).ComplexityLE (p + 32) := by + unfold quarticAntisymmetricBoxFactors + split <;> exact W.quarticKernelFactors_complexity i j _ a.2 + +theorem quarticAntisymmetricBoxFactors_normBound (i j : Fin W.outputDim) (a : QuarticBoxFactor) : + (W.quarticAntisymmetricBoxFactors i j a).normBound = 1 := by + unfold quarticAntisymmetricBoxFactors + split <;> exact W.quarticKernelFactors_normBound i j _ a.2 + +theorem quarticAntisymmetricBoxFactors_eval (i j : Fin W.outputDim) (n : QuarticBoxIndex → ℤ) : + (∏ a, (W.quarticAntisymmetricBoxFactors i j a).eval n) = W.quarticAntisymmetricBoxValue i j n := by + have hrow (ω : Fin 4 → Bool) : + (∏ b : Fin 2, (W.quarticAntisymmetricBoxFactors i j (ω, b)).eval n) = + conjugationPower (booleanWeight ω) (W.quarticAntisymmetric i j (fun a => n (a, ω a))) := by + rw [conjugationPower_eq_if_mod] + by_cases hω : booleanWeight ω % 2 = 0 + · simpa only [quarticAntisymmetricBoxFactors, hω, ite_true, quarticBoxCorner] using + W.quarticKernelFactors_eval i j (quarticBoxCorner ω) n + · simpa only [quarticAntisymmetricBoxFactors, hω, ite_false, Niltest.eval_conjugate, + star_prod, quarticBoxCorner] using + congrArg star (W.quarticKernelFactors_eval i j (quarticBoxCorner ω) n) + rw [Fintype.prod_prod_type] + simp_rw [hrow] + simp only [quarticAntisymmetricBoxValue, boxCornerProduct, boxCorner_pair] + +theorem quarticAntisymmetricBoxValue_norm (i j : Fin W.outputDim) (n : QuarticBoxIndex → ℤ) : + ‖W.quarticAntisymmetricBoxValue i j n‖ ≤ 1 := by + rw [← W.quarticAntisymmetricBoxFactors_eval i j n, norm_prod] + apply Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) + intro a _ + exact ((W.quarticAntisymmetricBoxFactors i j a).norm_eval_le n).trans_eq + (by rw [W.quarticAntisymmetricBoxFactors_normBound i j a]; rfl) + +theorem quarticAntisymmetricBoxFactors_vertical (i j : Fin W.outputDim) (a : QuarticBoxFactor) + (z : W.model.RealGroup) + (hz : z ∈ W.model.filtration.realification.subgroup (∑ _ : QuarticReplicatedIndex, 1)) + (x : W.model.Space) : + (W.quarticAntisymmetricBoxFactors i j a).observable (z • x) = + CircleFourier.character + ((realifyFunctional (W.quarticAntisymmetricBoxFrequencies a) z.coord : ℝ) : CircleFourier.Circle) * + (W.quarticAntisymmetricBoxFactors i j a).observable x := by + unfold quarticAntisymmetricBoxFactors quarticAntisymmetricBoxFrequencies + split_ifs + · exact W.quarticKernelFactors_vertical i j _ a.2 z hz x + · exact Niltest.conjugate_vertical _ _ (W.quarticKernelFactors_vertical i j _ a.2) z hz x + +variable [TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + +noncomputable def quarticAntisymmetricBoxNiltest (hp : 0 ≤ p) (i j : Fin W.outputDim) : + (pi (fun _ : QuarticBoxFactor => W.model)).Niltest (fun _ : QuarticBoxIndex => 1) := + piNiltest (fun _ : QuarticBoxFactor => W.model) (W.quarticAntisymmetricBoxFactors i j) + (by linarith) + (by simpa only [quarticBoxFactor_card, Nat.cast_ofNat] using (show (32 : ℝ) ≤ p + 32 by linarith)) + (W.quarticAntisymmetricBoxFactors_complexity i j) + +theorem quarticAntisymmetricBoxNiltest_complexity (hp : 0 ≤ p) (i j : Fin W.outputDim) : + (W.quarticAntisymmetricBoxNiltest hp i j).ComplexityLE (productNiltestBudget (p + 32)) := + piNiltest_complexity (fun _ : QuarticBoxFactor => W.model) (W.quarticAntisymmetricBoxFactors i j) + (by linarith) + (by simpa only [quarticBoxFactor_card, Nat.cast_ofNat] using (show (32 : ℝ) ≤ p + 32 by linarith)) + (W.quarticAntisymmetricBoxFactors_complexity i j) + +theorem quarticAntisymmetricBoxNiltest_eval (hp : 0 ≤ p) (i j : Fin W.outputDim) + (n : QuarticBoxIndex → ℤ) : + (W.quarticAntisymmetricBoxNiltest hp i j).eval n = W.quarticAntisymmetricBoxValue i j n := by + rw [quarticAntisymmetricBoxNiltest, piNiltest_eval] + exact W.quarticAntisymmetricBoxFactors_eval i j n + +theorem quarticAntisymmetricBoxNiltest_vertical (hp : 0 ≤ p) (i j : Fin W.outputDim) + (z : (pi (fun _ : QuarticBoxFactor => W.model)).RealGroup) + (hz : z ∈ (pi (fun _ : QuarticBoxFactor => W.model)).filtration.realification.subgroup + (∑ _ : QuarticReplicatedIndex, 1)) + (x : (pi (fun _ : QuarticBoxFactor => W.model)).Space) : + (W.quarticAntisymmetricBoxNiltest hp i j).observable (z • x) = + CircleFourier.character + ((realifyFunctional (piFrequency W.quarticAntisymmetricBoxFrequencies) z.coord : ℝ) : + CircleFourier.Circle) * (W.quarticAntisymmetricBoxNiltest hp i j).observable x := + piNiltest_vertical (fun _ : QuarticBoxFactor => W.model) (W.quarticAntisymmetricBoxFactors i j) + W.quarticAntisymmetricBoxFrequencies (by linarith) + (by simpa only [quarticBoxFactor_card, Nat.cast_ofNat] using (show (32 : ℝ) ≤ p + 32 by linarith)) + (W.quarticAntisymmetricBoxFactors_complexity i j) + (W.quarticAntisymmetricBoxFactors_vertical i j) z hz x + +end NativeMultidegreeNilcharacter + +end Erdos3 + +end + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +variable {p : ℝ} (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + +theorem quarticAntisymmetricBoxValue_mean (N : ℕ) [NeZero N] (i j : Fin W.outputDim) : + (𝔼 n ∈ integerBox (fun _ : QuarticBoxIndex => N), W.quarticAntisymmetricBoxValue i j n) = + boxPhaseMoment 4 (fun x : Fin 4 → ZMod N => W.quarticAntisymmetric i j (fun a => (x a).val)) := by + exact integerBox_cornerProduct_mean 4 N (W.quarticAntisymmetric i j) + +variable [TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + +theorem quarticAntisymmetricBoxNiltest_mean (hp : 0 ≤ p) (N : ℕ) [NeZero N] + (i j : Fin W.outputDim) : + (𝔼 n ∈ integerBox (fun _ : QuarticBoxIndex => N), (W.quarticAntisymmetricBoxNiltest hp i j).eval n) = + boxPhaseMoment 4 (fun x : Fin 4 → ZMod N => W.quarticAntisymmetric i j (fun a => (x a).val)) := by + simp_rw [W.quarticAntisymmetricBoxNiltest_eval hp] + exact W.quarticAntisymmetricBoxValue_mean N i j + +end Erdos3.NativeMultidegreeNilcharacter + +end + +section + +namespace Erdos3 + +open Module RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +structure NativeQuarticBoxFactorization {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) (N : ℕ) (q : ℝ) where + leftIndex : Fin W.outputDim + rightIndex : Fin W.outputDim + nonnegative : 0 ≤ p + [topology : TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [topologicalAdd : IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [continuousSMul : ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + [hausdorff : T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L))] + basis : Basis (Fin (finrank ℚ (QuarticBoxFactor → W.L))) ℚ (QuarticBoxFactor → W.L) + weight : Fin (finrank ℚ (QuarticBoxFactor → W.L)) → ℕ + adapted : ∀ k, (pi (fun _ : QuarticBoxFactor => W.model)).filtration.layer k = + Submodule.span ℚ (basis '' {i | k ≤ weight i}) + height : ∀ i j, rationalLogHeight + ((pi (fun _ : QuarticBoxFactor => W.model)).basis.repr (basis i) j) ≤ q + factorization : (pi (fun _ : QuarticBoxFactor => W.model)).filtration.ControlledSymbolFactorization + basis weight adapted (piFrequency W.quarticAntisymmetricBoxFrequencies) + (fun _ : QuarticBoxIndex => (N : ℝ)) + ((W.quarticAntisymmetricBoxNiltest nonnegative leftIndex rightIndex).symbol basis weight adapted) q + +theorem exists_quartic_box_step_drop_indices : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ}, 0 ≤ p → + ∀ (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + {N : ℕ} [NeZero N] (i j : Fin W.outputDim), + Real.exp ((p + C) ^ C) ≤ (N : ℝ) → + Real.exp (-p) ≤ (boxPhaseMoment 4 (fun x : Fin 4 → ZMod N => + W.quarticAntisymmetric i j (fun a => (x a).val))).re → + ∃ R : NativeQuarticBoxFactorization W N ((p + C) ^ C), + R.leftIndex = i ∧ R.rightIndex = j := by + have hdegree : (∑ _ : QuarticReplicatedIndex, (1 : ℕ)) = 4 := by + have hc : Fintype.card QuarticReplicatedIndex = 4 := replicatedMixed_card 3 + rw [Finset.sum_const, Finset.card_univ, hc] + rfl + obtain ⟨a, _, hstep⟩ := exists_intrinsic_step_drop (∑ _ : QuarticReplicatedIndex, 1) (by omega) + let X : Polynomial ℕ := Polynomial.X + let Q := X + 32 + let R := (Q + 2) ^ 2 + Q + (Q + (Q ^ 2 + Q + 3) ^ 2) + Q ^ 2 + 4 + X + 8 + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget (R + 1 + (R + Polynomial.C a) ^ a) + refine ⟨C, hC, ?_⟩ + intro p hp W N _ i j hN hbox + let r := productNiltestBudget (p + 32) + p + 8 + have hprod : 0 ≤ productNiltestBudget (p + 32) := by + unfold productNiltestBudget productObservableLipBudget + positivity + have hpr : p ≤ r := by dsimp only [r]; linarith only [hprod] + have h8r : 8 ≤ r := by dsimp only [r]; linarith only [hprod, hp] + have hTr : productNiltestBudget (p + 32) ≤ r := by dsimp only [r]; linarith only [hp] + have hr : 0 ≤ r := hp.trans hpr + have hcost : r + 1 + (r + a) ^ a ≤ (p + C) ^ C := by + simpa [X, Q, R, r, productNiltestBudget, productObservableLipBudget, Polynomial.eval₂_pow] + using hbudget p hp + have hpow : 0 ≤ (r + a) ^ a := by positivity + have hheight : r + 1 ≤ (p + C) ^ C := by linarith only [hcost, hpow] + have hfactor : (r + a) ^ a ≤ (p + C) ^ C := by linarith only [hcost, hr] + obtain ⟨τ, htA, htM, htT⟩ := exists_real_module_topology + (productFinBasis (fun _ : QuarticBoxFactor => W.model)) + let : TopologicalSpace (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L)) := τ + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L)) := htA + let : ContinuousSMul ℝ (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L)) := htM + let : T2Space (ℝ ⊗[ℚ] (QuarticBoxFactor → W.L)) := htT + let D := pi (fun _ : QuarticBoxFactor => W.model) + let T := W.quarticAntisymmetricBoxNiltest hp i j + obtain ⟨e, ω, hF, he, hconstruct⟩ := hstep D hr T + ((W.quarticAntisymmetricBoxNiltest_complexity hp i j).mono hTr) + have hbias : Real.exp (-r) ≤ + ‖𝔼 n ∈ translatedIntegerBox 0 (fun _ : QuarticBoxIndex => N), T.eval n‖ := by + have hzero : translatedIntegerBox 0 (fun _ : QuarticBoxIndex => N) = + integerBox (fun _ : QuarticBoxIndex => N) := by + ext n + simp only [mem_translatedIntegerBox, mem_integerBox, Pi.zero_apply, zero_add] + rw [hzero, show T = W.quarticAntisymmetricBoxNiltest hp i j from rfl, + W.quarticAntisymmetricBoxNiltest_mean] + exact (Real.exp_le_exp.mpr (neg_le_neg hpr)).trans (hbox.trans (Complex.re_le_norm _)) + have hf := hconstruct (piFrequency W.quarticAntisymmetricBoxFrequencies) + (W.quarticAntisymmetricBoxNiltest_vertical hp i j) 0 (fun _ : QuarticBoxIndex => N) + (fun _ => NeZero.pos N) (by simpa [QuarticBoxIndex] using h8r) + (fun _ => (Real.exp_le_exp.mpr hfactor).trans hN) hbias + exact ⟨{ + leftIndex := i + rightIndex := j + nonnegative := hp + topology := τ + topologicalAdd := htA + continuousSMul := htM + hausdorff := htT + basis := e + weight := ω + adapted := hF + height := fun i j => (he i j).trans hheight + factorization := NilpotentLieFiltration.ControlledSymbolFactorization.mono + D.filtration e ω hF hf hfactor (fun _ => by exact_mod_cast NeZero.pos N) }, rfl, rfl⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuarticCoordinateSlices.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticCoordinateSlices.lean new file mode 100644 index 0000000000000000000000000000000000000000..e59e84995323c31767de87f9df699b1903dffd44 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticCoordinateSlices.lean @@ -0,0 +1,137 @@ +import OAI.Combinatorics.Progressions.Estimates.QuarticAntisymmetricTransfer + +namespace OAI + +section + +namespace Erdos3.NativeMultidegreeNilcharacter + +open Module +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + +theorem exists_quartic_frozen_affine_expansion : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + (d : QuarticReplicatedIndex) (A : QuarticReplicatedIndex → Fin 4 → ℤ) + (b : QuarticReplicatedIndex → ℤ) (out : Fin W.outputDim), + (∀ k, A d k = 0) → + Nonempty (NativeIntegerExpansion (fun _ : Fin 4 => 1) 3 ((p + C) ^ C) + (fun x => W.eval out (integerAffineMap A b x))) := by + obtain ⟨C, hC, hfreeze⟩ := exists_freezing_niltest (fun _ : QuarticReplicatedIndex => 1) + refine ⟨C, hC, ?_⟩ + intro p W d A b out hA + classical + let S : Finset QuarticReplicatedIndex := Finset.univ.erase d + have hcard : Fintype.card QuarticReplicatedIndex = 4 := by + calc + _ = ∑ j : Fin 2, mixedCorrelationDegree 3 j := replicatedIndex_card _ + _ = 4 := by rw [Fin.sum_univ_two]; rfl + have hdegree : (∑ j ∈ S, (1 : ℕ)) = 3 := by simp [S, hcard] + obtain ⟨t, n, ht, _hn, D, hD⟩ := hfreeze W S b out + have ht3 : t = 3 := ht.trans hdegree + rcases ht3 with rfl + let K := W.multi.filtration.weightedSubalgebra (retainedCoordinateWeight S) + let := moduleTopology ℝ (ℝ ⊗[ℚ] K) + let : IsTopologicalAddGroup (ℝ ⊗[ℚ] K) := IsModuleTopology.isTopologicalAddGroup ℝ _ + let : T2Space (ℝ ⊗[ℚ] K) := realification_moduleTopology_t2 D.basis + obtain ⟨T, _hTnorm, hT, _hzero, heval⟩ := hD + let U := T.affinePullback (fun j k => A j.val k) (fun j => b j.val) + have hU : U.ComplexityLE ((p + C) ^ C) := hT + have hvalue (x : Fin 4 → ℤ) : U.eval x = W.eval out (integerAffineMap A b x) := by + rw [RationalFilteredNilmanifold.Niltest.eval_affinePullback, heval] + apply congrArg (W.eval out) + funext j + by_cases hj : j ∈ S + · simp [freezeCoordinates, hj, integerAffineMap] + · have hjd : j = d := by simpa [S] using hj + subst j + simp [freezeCoordinates, hj, integerAffineMap, hA] + let E : NativeIntegerExpansion (fun _ : Fin 4 => 1) 3 ((p + C) ^ C) U.eval := + NativeIntegerExpansion.ofTest U hU (fun _ => rfl) + have heq : U.eval = (fun x => W.eval out (integerAffineMap A b x)) := funext hvalue + exact ⟨heq ▸ E⟩ + +theorem exists_quartic_scalar_coordinate_slice : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + (out : Fin W.outputDim) (d : Fin 4) (c : ℤ), + Nonempty (NativeIntegerExpansion (fun _ : Fin 4 => 1) 3 ((p + C) ^ C) + (fun x => let z := Function.update x d c + W.eval out (quarticInput (z 0) ![z 1, z 2, z 3]))) := by + obtain ⟨C, hC, hfreeze⟩ := exists_quartic_frozen_affine_expansion + refine ⟨C, hC, ?_⟩ + intro p W out d c + let coord : QuarticReplicatedIndex → Fin 4 := fun j => + if j.1 = 0 then 0 else if j.2.val = 0 then 1 else if j.2.val = 1 then 2 else 3 + let index : Fin 4 → QuarticReplicatedIndex := + ![⟨0, ⟨0, by decide⟩⟩, quarticReplica 0, quarticReplica 1, quarticReplica 2] + have hindex (k : Fin 4) : coord (index k) = k := by fin_cases k <;> rfl + let A : QuarticReplicatedIndex → Fin 4 → ℤ := fun j k => + if coord j = d then 0 else if k = coord j then 1 else 0 + let b : QuarticReplicatedIndex → ℤ := fun j => if coord j = d then c else 0 + obtain ⟨E⟩ := hfreeze W (index d) A b out (by intro k; simp [A, hindex]) + have hmap (x : Fin 4 → ℤ) (j : QuarticReplicatedIndex) : + integerAffineMap A b x j = (Function.update x d c) (coord j) := by + by_cases hj : coord j = d <;> simp [integerAffineMap, A, b, hj, ite_mul] + have heq (x : Fin 4 → ℤ) : integerAffineMap A b x = + quarticInput ((Function.update x d c) 0) + ![(Function.update x d c) 1, (Function.update x d c) 2, + (Function.update x d c) 3] := by + funext j + rw [hmap] + by_cases hj : j.1 = 0 + · simp [coord, quarticInput, hj] + · by_cases hk : j.2.val = 0 + · simp [coord, quarticInput, hj, hk] + · by_cases hl : j.2.val = 1 <;> simp [coord, quarticInput, hj, hk, hl] + exact ⟨by simpa only [heq] using E⟩ + +theorem exists_quartic_kernel_coordinate_slice : + ∃ C : ℕ, 2 ≤ C ∧ ∀ {p : ℝ} + (W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p) + (i j : Fin W.outputDim) (d : Fin 4) (c : ℤ), + Nonempty (NativeIntegerExpansion (fun _ : Fin 4 => 1) 3 ((p + C) ^ C) + (fun x => W.quarticAntisymmetric i j (Function.update x d c))) := by + obtain ⟨A, _, hscalar⟩ := exists_quartic_scalar_coordinate_slice + obtain ⟨B, _, hmul⟩ := NativeIntegerExpansion.exists_mul_budget + let X : Polynomial ℕ := Polynomial.X + let Q := (X + Polynomial.C A) ^ A + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget ((Q + Polynomial.C B) ^ B) + refine ⟨C, hC, ?_⟩ + intro p W i j d c + have hp : 0 ≤ p := (Nat.cast_nonneg W.dim).trans W.complexity.1.1 + let q := (p + A) ^ A + have hq : 0 ≤ q := by dsimp only [q]; positivity + let e : Fin 4 → Fin 4 := ![1, 0, 2, 3] + have he0 : e 0 = 1 := rfl + have he1 : e 1 = 0 := rfl + have he2 : e 2 = 2 := rfl + have he3 : e 3 = 3 := rfl + have hswap (x : Fin 4 → ℤ) : Function.update (fun k => x (e k)) (e d) c = + fun k => (Function.update x d c) (e k) := by + funext k + fin_cases d <;> fin_cases k <;> rfl + obtain ⟨L⟩ := hscalar W i d c + obtain ⟨R⟩ := hscalar W j (e d) c + have R' : NativeIntegerExpansion (fun _ : Fin 4 => 1) 3 q + (fun x => let z := Function.update x d c + W.eval j (quarticInput (z 1) ![z 0, z 2, z 3])) := by + have E : NativeIntegerExpansion (fun _ : Fin 4 => 1) 3 q + (fun x => let z := Function.update (fun k => x (e k)) (e d) c + W.eval j (quarticInput (z 0) ![z 1, z 2, z 3])) := + R.linearPullbackHom (fun k => ⟨⟨fun x => x (e k), rfl⟩, fun _ _ => rfl⟩) + simpa only [hswap, he0, he1, he2, he3] using E + obtain ⟨F⟩ := hmul hq L R'.conjugate + have hcost : (q + B) ^ B ≤ (p + C) ^ C := by + simpa [X, Q, q, Polynomial.eval₂_pow] using hbudget p hp + exact ⟨F.mono hcost⟩ + +end Erdos3.NativeMultidegreeNilcharacter + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuarticPairCoordinateTest.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticPairCoordinateTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..e198c202d3d272b1971f076a0792038151622651 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuarticPairCoordinateTest.lean @@ -0,0 +1,106 @@ +import OAI.Combinatorics.Progressions.Estimates.QuarticPairFrozenEquivalence + +namespace OAI + +section + +namespace Erdos3.NativeSampleCorrelation + +open RationalFilteredNilmanifold +open scoped TensorProduct BigOperators + +attribute [local instance] NativeMultidegreeNilcharacter.lie NativeMultidegreeNilcharacter.algebra + NativeMultidegreeNilcharacter.topology NativeMultidegreeNilcharacter.topologicalAdd + NativeMultidegreeNilcharacter.continuousSMul NativeMultidegreeNilcharacter.hausdorff + NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +variable {p q : ℝ} {N : ℕ} [NeZero N] + {W : NativeMultidegreeNilcharacter (fun _ : QuarticReplicatedIndex => 1) p} {i j : Fin (W.tensorPower 6).outputDim} + (V : NativeSampleCorrelation (fun _ : Fin 4 => 1) 3 q + Finset.univ (fun z : Fin 4 → ZMod N => fun k => ((z k).val : ℤ)) + (fun z => (W.tensorPower 6).quarticAntisymmetric i j (fun k => ((z k).val : ℤ)))) + +noncomputable def quarticPairCoordinateTests (k : Fin 2) (out : Fin W.outputDim) : + ∀ l, (V.quarticPairModels l).Niltest (fun _ : Fin 4 => 1) + | none => (V.test.raiseStep (by decide)).oneOnOrbit + | some l => + ![![W.quarticPairComponent out id, (W.quarticPairComponent out ![1, 0, 2, 3]).oneOnOrbit], + ![(W.quarticPairComponent out id).oneOnOrbit, W.quarticPairComponent out ![1, 0, 2, 3]]] k l + +theorem quarticPairCoordinateTests_complexity (k : Fin 2) (out : Fin W.outputDim) (l : Option (Fin 2)) : + (V.quarticPairCoordinateTests k out l).ComplexityLE (quarticPairBudget (tensorPowerBudget 6 p) q) := by + have htwo : 2 ≤ quarticPairBudget (tensorPowerBudget 6 p) q := + (by norm_num : (2 : ℝ) ≤ 6).trans V.quarticPairBudget_six_le + cases l with + | none => exact Niltest.oneOnOrbit_complexity _ htwo (V.quarticPairTests_complexity none).1 + | some l => + fin_cases k <;> fin_cases l + · exact (W.quarticPairComponent_complexity out id).mono V.quarticOriginalPairComparison_component_cost + · exact Niltest.oneOnOrbit_complexity _ htwo (V.quarticPairTests_complexity (some 1)).1 + · exact Niltest.oneOnOrbit_complexity _ htwo (V.quarticPairTests_complexity (some 0)).1 + · exact (W.quarticPairComponent_complexity out ![1, 0, 2, 3]).mono V.quarticOriginalPairComparison_component_cost + +variable [TopologicalSpace (ℝ ⊗[ℚ] V.QuarticPairAlgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] V.QuarticPairAlgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] V.QuarticPairAlgebra)] + [T2Space (ℝ ⊗[ℚ] V.QuarticPairAlgebra)] + +noncomputable def quarticPairCoordinateNiltest (k : Fin 2) (out : Fin W.outputDim) : + (pi V.quarticPairModels).Niltest (fun _ : Fin 4 => 1) := + piNiltest V.quarticPairModels (V.quarticPairCoordinateTests k out) + ((by norm_num : (0 : ℝ) ≤ 6).trans V.quarticPairBudget_six_le) + (by simpa using (show (3 : ℝ) ≤ quarticPairBudget (tensorPowerBudget 6 p) q from + (by norm_num : (3 : ℝ) ≤ 6).trans V.quarticPairBudget_six_le)) + (V.quarticPairCoordinateTests_complexity k out) + +theorem quarticPairCoordinateNiltest_complexity (k : Fin 2) (out : Fin W.outputDim) : + (V.quarticPairCoordinateNiltest k out).ComplexityLE + (productNiltestBudget (quarticPairBudget (tensorPowerBudget 6 p) q)) := + piNiltest_complexity V.quarticPairModels (V.quarticPairCoordinateTests k out) _ _ _ + +theorem quarticPairCoordinateNiltest_observable (k : Fin 2) (out : Fin W.outputDim) + (x : (pi V.quarticPairModels).Space) : + (V.quarticPairCoordinateNiltest k out).observable x = + W.vertical.observable out (productProjection V.quarticPairModels (some k) x) := by + change (∏ l, (V.quarticPairCoordinateTests k out l).observable + (productProjection V.quarticPairModels l x)) = _ + rw [Fintype.prod_option, Fin.prod_univ_two] + fin_cases k + · change 1 * (W.vertical.observable out + (productProjection V.quarticPairModels (some 0) x) * 1) = _ + simp only [one_mul, mul_one] + rfl + · change 1 * (1 * W.vertical.observable out + (productProjection V.quarticPairModels (some 1) x)) = _ + simp only [one_mul] + rfl + +theorem quarticPairCoordinateNiltest_orbit (k : Fin 2) (out : Fin W.outputDim) : + (V.quarticPairCoordinateNiltest k out).orbit = V.quarticPairNiltest.orbit := by + change NilpotentLieFiltration.piRealOrbit _ _ = NilpotentLieFiltration.piRealOrbit _ _ + apply congrArg (NilpotentLieFiltration.piRealOrbit + (fun l => (V.quarticPairModels l).filtration)) + funext l + cases l with + | none => rfl + | some l => fin_cases k <;> fin_cases l <;> rfl + +theorem quarticPairCoordinateNiltest_eval (k : Fin 2) (out : Fin W.outputDim) (n : Fin 4 → ℤ) : + (V.quarticPairCoordinateNiltest k out).eval n = + W.eval out (quarticInput (n (![0, 1] k)) ![n (![1, 0] k), n 2, n 3]) := by + rw [quarticPairCoordinateNiltest, piNiltest_eval, Fintype.prod_option, Fin.prod_univ_two] + fin_cases k + · change 1 * ((W.quarticPairComponent out id).eval n * 1) = _ + rw [one_mul, mul_one, W.quarticPairComponent_eval] + rfl + · change 1 * (1 * (W.quarticPairComponent out ![1, 0, 2, 3]).eval n) = _ + rw [one_mul, one_mul, W.quarticPairComponent_eval] + rfl + +end Erdos3.NativeSampleCorrelation + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuotientCoordinateRadius.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuotientCoordinateRadius.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ce4946964fc16ed7ad3ad7158ac72a95dc9fa32 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuotientCoordinateRadius.lean @@ -0,0 +1,125 @@ +import OAI.Combinatorics.Progressions.Lattices.LatticeMetricGapBudget + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def quotientCoordinateRadius (δ K : ℝ) (d : ℕ) : ℝ := + δ / (δ + 4 * K ^ 2 * (d + 1)) + +theorem quotientCoordinateRadius_pos {δ K : ℝ} (hδ : 0 < δ) (d : ℕ) : + 0 < quotientCoordinateRadius δ K d := by + unfold quotientCoordinateRadius + positivity + +theorem quotientCoordinateRadius_le_one {δ K : ℝ} (hδ : 0 < δ) (d : ℕ) : + quotientCoordinateRadius δ K d ≤ 1 := by + unfold quotientCoordinateRadius + apply (div_le_one (by positivity)).mpr + nlinarith [sq_nonneg K, Nat.cast_nonneg (α := ℝ) d, + mul_nonneg (sq_nonneg K) (show (0 : ℝ) ≤ d + 1 by positivity)] + +theorem quotientCoordinateRadius_small {δ K : ℝ} (hδ : 0 < δ) (d : ℕ) : + 4 * K ^ 2 * (d + 1) * quotientCoordinateRadius δ K d ≤ δ := by + unfold quotientCoordinateRadius + rw [← mul_div_assoc] + apply (div_le_iff₀ (by positivity)).mpr + nlinarith [sq_nonneg δ] + +theorem quotientCoordinateRadius_inverse {δ K : ℝ} (hδ : 0 < δ) (d : ℕ) : + 1 / quotientCoordinateRadius δ K d = 1 + 4 * K ^ 2 * (d + 1) * (1 / δ) := by + unfold quotientCoordinateRadius + field_simp + +theorem quotientCoordinateRadius_inverse_power_budget (A B : ℕ) (hA : 2 ≤ A) (hB : 2 ≤ B) + {δ K p : ℝ} (hδ : 0 < δ) (hK : 0 ≤ K) (hp : 0 ≤ p) (d : ℕ) (hd : (d : ℝ) ≤ p) + (hδp : 1 / δ ≤ Real.exp ((p + A) ^ A)) (hKp : K ≤ Real.exp ((p + B) ^ B)) : + 1 / quotientCoordinateRadius δ K d ≤ Real.exp ((p + (A + B + 3 : ℕ)) ^ (A + B + 3)) := by + let C := A + B + let q := (p + C) ^ C + have hC : 2 ≤ C := by dsimp [C]; omega + have hq : 0 ≤ q := by dsimp [q]; positivity + have hqδ : 1 / δ ≤ Real.exp q := hδp.trans (Real.exp_le_exp.mpr + (shifted_power_self_mono (C := A) (D := C) hp (by omega) (by dsimp [C]; omega))) + have hqK : K ≤ Real.exp q := hKp.trans (Real.exp_le_exp.mpr + (shifted_power_self_mono (C := B) (D := C) hp (by omega) (by dsimp [C]; omega))) + have hpq : p + 1 ≤ q := by + simpa only [Nat.cast_one, pow_one] using + shifted_power_self_mono (C := 1) (D := C) hp le_rfl (by omega) + have hdim : (d : ℝ) + 1 ≤ Real.exp q := by linarith [Real.add_one_le_exp q] + have hproduct : K ^ 2 * ((d : ℝ) + 1) * (1 / δ) ≤ Real.exp (4 * q) := by + calc + _ ≤ (Real.exp q) ^ 2 * Real.exp q * Real.exp q := by gcongr + _ = (Real.exp q) ^ 4 := by ring + _ = _ := (Real.exp_nat_mul q 4).symm + have hfive : (5 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + have hbasic : 1 / quotientCoordinateRadius δ K d ≤ Real.exp (4 * q + 4) := by + rw [quotientCoordinateRadius_inverse hδ] + calc + _ ≤ 5 * Real.exp (4 * q) := by nlinarith [Real.one_le_exp (show 0 ≤ 4 * q by positivity)] + _ ≤ Real.exp 4 * Real.exp (4 * q) := mul_le_mul_of_nonneg_right hfive (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + apply hbasic.trans + apply Real.exp_le_exp.mpr + let t : ℝ := p + (C + 3 : ℕ) + have ht : 5 ≤ t := by + have hC' : (2 : ℝ) ≤ C := by exact_mod_cast hC + dsimp [t] + push_cast + linarith + have hpow : 1 ≤ t ^ C := one_le_pow₀ (by linarith) + have hqt : q ≤ t ^ C := by + apply pow_le_pow_left₀ (by positivity) + dsimp [t] + push_cast + linarith + calc + 4 * q + 4 ≤ 8 * t ^ C := by linarith + _ ≤ t ^ 2 * t ^ C := mul_le_mul_of_nonneg_right (by nlinarith) (by positivity) + _ = t ^ (C + 2) := by rw [← pow_add, Nat.add_comm] + _ ≤ t ^ (C + 3) := pow_le_pow_right₀ (by linarith) (by omega) + +theorem product_two_power_bounds (A : ℕ) (hA : 2 ≤ A) {x y p : ℝ} + (hy : 0 ≤ y) (hp : 0 ≤ p) + (hx : x ≤ Real.exp ((p + A) ^ A)) (hyb : y ≤ Real.exp ((p + A) ^ A)) : + x * y ≤ Real.exp ((p + (A + 5 : ℕ)) ^ (A + 5)) := by + calc + x * y ≤ Real.exp ((p + A) ^ A) * Real.exp ((p + A) ^ A) := + mul_le_mul hx hyb hy (Real.exp_nonneg _) + _ = Real.exp (2 * (p + A) ^ A) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ Real.exp (2 * (p + A) ^ A + 16) := Real.exp_le_exp.mpr (by linarith) + _ ≤ _ := Real.exp_le_exp.mpr (enlarged_power_dominates_twice_add_sixteen hp A hA) + +theorem quotient_chart_parameter_budget (A B E F : ℕ) + (hA : 2 ≤ A) (hB : 2 ≤ B) (hE : 2 ≤ E) (hF : 2 ≤ F) + {δ C U V p : ℝ} (hδ : 0 < δ) (hC : 0 ≤ C) (hU : 0 ≤ U) + (hp : 0 ≤ p) (d : ℕ) (hd : (d : ℝ) ≤ p) + (hδp : 1 / δ ≤ Real.exp ((p + A) ^ A)) (hCp : C ≤ Real.exp ((p + B) ^ B)) + (hUp : U ≤ Real.exp ((p + E) ^ E)) (hVp : V ≤ Real.exp ((p + F) ^ F)) : + let D := A + B + E + F + 10 + 1 / quotientCoordinateRadius δ C d ≤ Real.exp ((p + D) ^ D) ∧ + C * U ≤ Real.exp ((p + D) ^ D) ∧ V * C ≤ Real.exp ((p + D) ^ D) := by + let T := A + B + E + F + 5 + have hT : 2 ≤ T := by dsimp [T]; omega + have hshift {N : ℕ} (hN : 1 ≤ N) (hNT : N ≤ T) : + Real.exp ((p + N) ^ N) ≤ Real.exp ((p + T) ^ T) := + Real.exp_le_exp.mpr (shifted_power_self_mono hp hN hNT) + have hCq := hCp.trans (hshift (by omega) (by dsimp [T]; omega)) + have hUq := hUp.trans (hshift (by omega) (by dsimp [T]; omega)) + have hVq := hVp.trans (hshift (by omega) (by dsimp [T]; omega)) + have hCU := product_two_power_bounds T hT hU hp hCq hUq + have hVC := product_two_power_bounds T hT hC hp hVq hCq + have hr := quotientCoordinateRadius_inverse_power_budget A B hA hB hδ hC hp d hd hδp hCp + have hr' : 1 / quotientCoordinateRadius δ C d ≤ Real.exp ((p + (T + 5 : ℕ)) ^ (T + 5)) := + hr.trans (Real.exp_le_exp.mpr (shifted_power_self_mono (C := A + B + 3) (D := T + 5) + hp (by omega) (by dsimp [T]; omega))) + have heq : T + 5 = A + B + E + F + 10 := rfl + simpa only [heq] using And.intro hr' (And.intro hCU hVC) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/QuotientSubgroupCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/QuotientSubgroupCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..66bebec3c2afe496809cbeab0a83a8598c333f48 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/QuotientSubgroupCoordinates.lean @@ -0,0 +1,37 @@ +import OAI.Combinatorics.Progressions.Nilpotent.BCHSubgroupGridExistence + +namespace OAI + +section + +namespace Erdos3.NilpotentLieBCHGroup + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + {hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥} + +theorem quotient_mem_map_subgroup_iff (I : LieIdeal ℚ L) (U : LieSubalgebra ℚ L) + (g : NilpotentLieBCHGroup L s hnil) : + quotientHom I g ∈ (subgroup (hnil := hnil) U).map (quotientHom (hnil := hnil) I) ↔ + g.coord ∈ U.toSubmodule ⊔ I.toSubmodule := by + constructor + · intro hg + obtain ⟨u, hu, heq⟩ := Subgroup.mem_map.mp hg + have hdiff : g.coord - u.coord ∈ I := by + apply (lieQuotientMap_eq_zero I _).mp + rw [map_sub] + exact sub_eq_zero.mpr (congrArg coord heq).symm + apply Submodule.mem_sup.mpr + exact ⟨u.coord, hu, g.coord - u.coord, hdiff, by abel⟩ + · intro hg + obtain ⟨u, hu, v, hv, heq⟩ := Submodule.mem_sup.mp hg + apply Subgroup.mem_map.mpr + refine ⟨⟨u⟩, hu, ?_⟩ + apply ext + change lieQuotientMap I u = lieQuotientMap I g.coord + rw [← heq, map_add, (lieQuotientMap_eq_zero I v).mpr hv, add_zero] + +end Erdos3.NilpotentLieBCHGroup + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RationalModelCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RationalModelCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..88e4a42943510f0df8225fbda8c78649c4d8a57b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RationalModelCoordinates.lean @@ -0,0 +1,73 @@ +import OAI.Combinatorics.Progressions.Estimates.RationalPowerHeight + +namespace OAI + +section + +namespace Erdos3 + +open Module + +abbrev RationalModelCoordinateIndex (s d : ℕ) := + (Fin d × Fin d × Fin d) ⊕ (Fin (s + 1) × Fin d × Fin d) + +namespace RationalFilteredNilmanifold + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (D : RationalFilteredNilmanifold L s d) + +noncomputable def paddedLayerVector (i : Fin (s + 1)) (k : Fin d) : L := + if h : k.val < finrank ℚ (D.filtration.layer (i.val + 1)) then + (D.layerBasis i ⟨k.val, h⟩ : L) else 0 + +theorem paddedLayerVector_span (i : Fin (s + 1)) : + Submodule.span ℚ (Set.range (D.paddedLayerVector i)) = D.filtration.layer (i.val + 1) := by + classical + let : FiniteDimensional ℚ L := D.basis.finiteDimensional_of_finite + have hd : finrank ℚ (D.filtration.layer (i.val + 1)) ≤ d := by + simpa only [finrank_eq_card_basis D.basis, Fintype.card_fin] using + (D.filtration.layer (i.val + 1)).finrank_le + apply le_antisymm + · apply Submodule.span_le.mpr + rintro _ ⟨k, rfl⟩ + dsimp only [paddedLayerVector] + split_ifs + · exact (D.layerBasis i _).property + · exact Submodule.zero_mem _ + · intro x hx + have hb (k : Fin (finrank ℚ (D.filtration.layer (i.val + 1)))) : + (D.layerBasis i k : L) ∈ Submodule.span ℚ (Set.range (D.paddedLayerVector i)) := by + apply Submodule.subset_span + refine ⟨⟨k.val, k.isLt.trans_le hd⟩, ?_⟩ + simp only [paddedLayerVector, k.isLt, dite_true] + have heq : (∑ k, (D.layerBasis i).repr ⟨x, hx⟩ k • (D.layerBasis i k : L)) = x := by + simpa only [Submodule.coe_sum, Submodule.coe_smul] using + congrArg Subtype.val ((D.layerBasis i).sum_repr ⟨x, hx⟩) + rw [← heq] + exact Submodule.sum_mem _ (fun k _ => Submodule.smul_mem _ _ (hb k)) + +theorem paddedLayerVector_height {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) + (i : Fin (s + 1)) (j k : Fin d) : + rationalLogHeight (D.basis.repr (D.paddedLayerVector i j) k) ≤ p := by + dsimp only [paddedLayerVector] + split_ifs + · exact hD.2.2.2 i _ k + · simpa [rationalLogHeight] using hp + +noncomputable def rationalModelCoordinates : RationalModelCoordinateIndex s d → ℚ + | .inl z => lieStructureConstants D.basis z.1 z.2.1 z.2.2 + | .inr z => D.basis.repr (D.paddedLayerVector z.1 z.2.1) z.2.2 + +theorem rationalModelCoordinates_height {p : ℝ} (hp : 0 ≤ p) + (hD : D.GeometryComplexityLE p) (z : RationalModelCoordinateIndex s d) : + rationalLogHeight (D.rationalModelCoordinates z) ≤ p := by + rcases z with z | z + · exact hD.2.2.1 z.1 z.2.1 z.2.2 + · exact D.paddedLayerVector_height hp hD z.1 z.2.1 z.2.2 + +end RationalFilteredNilmanifold +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealChartReindexCoefficients.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealChartReindexCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd1d7e140c55d811510c22e775a3b6d75fb7c54d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealChartReindexCoefficients.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Polynomial.RealPolynomialChartSubstitution + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped TensorProduct + +variable {σ τ R V : Type*} [CommRing R] [AddCommGroup V] [Module R V] + +theorem coefficients_substitute_reindex (e : τ ≃ σ) + (P : VectorPolynomial σ R V) (α : τ →₀ ℕ) : + coefficients (substitute (fun i => MvPolynomial.X (e.symm i)) P) α = + coefficients P (α.mapDomain e) := by + have hα : (α.mapDomain e).mapDomain e.symm = α := by + ext i + simp only [Finsupp.mapDomain_equiv_apply, Equiv.symm_symm, Equiv.symm_apply_apply] + induction P using TensorProduct.inductionOn with + | tmul p v => + simp only [substitute_tmul, coefficients_tmul] + change (MvPolynomial.aeval (MvPolynomial.X ∘ e.symm) p).coeff α • v = _ + rw [← MvPolynomial.rename_eq_aeval] + exact congrArg (fun c : R => c • v) + (by simpa only [hα] using + MvPolynomial.coeff_rename_mapDomain e.symm e.symm.injective p (α.mapDomain e)) + | add p q hp hq => simp only [map_add, Finsupp.add_apply, hp, hq] + +variable [Module ℚ V] [Module ℝ V] [IsScalarTower ℚ ℝ V] + +theorem coefficients_realChartSubstitute_reindex (e : τ ≃ σ) + (P : VectorPolynomial σ ℚ V) (α : τ →₀ ℕ) : + coefficients (realChartSubstitute (fun i => MvPolynomial.X (e.symm i)) P) α = + coefficients P (α.mapDomain e) := by + simp only [realChartSubstitute, LinearMap.comp_apply, LinearEquiv.coe_coe, + LinearMap.restrictScalars_apply, coefficients_realCoefficientEquiv_symm, + coefficients_substitute_reindex, coefficients_realCoefficientEquiv] + +@[simp] theorem coefficients_zero_realChartSubstitute_reindex (e : τ ≃ σ) + (P : VectorPolynomial σ ℚ V) : + coefficients (realChartSubstitute (fun i => MvPolynomial.X (e.symm i)) P) 0 = + coefficients P 0 := by + simp only [coefficients_realChartSubstitute_reindex, Finsupp.mapDomain_zero] + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealCoordinateFunctionals.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealCoordinateFunctionals.lean new file mode 100644 index 0000000000000000000000000000000000000000..6002e543f449b6e3d23e1b44e0efa56fbba4e320 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealCoordinateFunctionals.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Fourier.JoinedFrequencyQuotientInjectivity + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped Matrix TensorProduct NNReal + +variable {V I J : Type*} [AddCommGroup V] [Module ℚ V] + +noncomputable def realifyCoordinateMap (ℓ : V →ₗ[ℚ] (J → ℚ)) : + (ℝ ⊗[ℚ] V) →ₗ[ℝ] (J → ℝ) := + LinearMap.pi (fun j => realifyFunctional ((LinearMap.proj j).comp ℓ)) + +noncomputable def coordinateFunctionalMatrix (b : Basis I ℚ V) + (ℓ : V →ₗ[ℚ] (J → ℚ)) : Matrix J I ℚ := fun j i => ℓ (b i) j + +theorem realifyCoordinateMap_tmul (ℓ : V →ₗ[ℚ] (J → ℚ)) (a : ℝ) (v : V) (j : J) : + realifyCoordinateMap ℓ (a ⊗ₜ[ℚ] v) j = a * (ℓ v j : ℝ) := + realifyFunctional_tmul ((LinearMap.proj j).comp ℓ) a v + +theorem realifyCoordinateMap_comp {W : Type*} [AddCommGroup W] [Module ℚ W] + (ℓ : W →ₗ[ℚ] (J → ℚ)) (f : V →ₗ[ℚ] W) (x : ℝ ⊗[ℚ] V) : + realifyCoordinateMap (ℓ.comp f) x = realifyCoordinateMap ℓ (f.baseChange ℝ x) := by + funext j + exact realifyFunctional_comp ((LinearMap.proj j).comp ℓ) f x + +theorem realifyCoordinateMap_eq_matrix [Fintype I] (b : Basis I ℚ V) + (ℓ : V →ₗ[ℚ] (J → ℚ)) (x : ℝ ⊗[ℚ] V) : + realifyCoordinateMap ℓ x = + (fun j i => (coordinateFunctionalMatrix b ℓ j i : ℝ)) *ᵥ + (b.baseChange ℝ).equivFun x := by + classical + have h : (realifyCoordinateMap ℓ).comp (b.baseChange ℝ).equivFun.symm.toLinearMap = + Matrix.mulVecLin (fun j i => (coordinateFunctionalMatrix b ℓ j i : ℝ)) := by + apply (Pi.basisFun ℝ I).ext + intro i + change realifyCoordinateMap ℓ ((b.baseChange ℝ).equivFun.symm (Pi.single i 1)) = + Matrix.of (fun j k => (coordinateFunctionalMatrix b ℓ j k : ℝ)) *ᵥ Pi.single i 1 + rw [Basis.equivFun_symm_single, Matrix.mulVec_single_one, Basis.baseChange_apply] + funext j + rw [realifyCoordinateMap_tmul, one_mul] + rfl + have hx := DFunLike.congr_fun h ((b.baseChange ℝ).equivFun x) + simp only [LinearMap.comp_apply, LinearEquiv.coe_coe, LinearEquiv.symm_apply_apply] at hx + exact hx.trans (Matrix.mulVecLin_apply _ _) + +theorem realifyCoordinateMap_norm_bound [Fintype I] [Fintype J] + (b : Basis I ℚ V) (ℓ : V →ₗ[ℚ] (J → ℚ)) {H : ℕ} + (hℓ : ∀ j i, RationalHeightLE (ℓ (b i) j) H) (x : ℝ ⊗[ℚ] V) : + ‖realifyCoordinateMap ℓ x‖ ≤ + ((Fintype.card I : ℝ) + 1) * (H + 1) * ‖(b.baseChange ℝ).equivFun x‖ := by + rw [realifyCoordinateMap_eq_matrix b ℓ x] + exact norm_matrix_mulVec_le _ (H : ℝ≥0) (fun j i => (hℓ j i).abs_real_le) _ + +theorem realifyCoordinateMap_grid [Fintype I] [Fintype J] + (b : Basis I ℚ V) (ℓ : V →ₗ[ℚ] (J → ℚ)) (l : ℕ) (x : ℝ ⊗[ℚ] V) + (hx : (b.baseChange ℝ).equivFun x ∈ realDenominatorGrid l) : + realifyCoordinateMap ℓ x ∈ + realDenominatorGrid (matrixDenominator (coordinateFunctionalMatrix b ℓ) * l) := by + rw [realifyCoordinateMap_eq_matrix b ℓ x] + exact real_matrix_denominator_grid (coordinateFunctionalMatrix b ℓ) l _ hx + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealFastCoefficientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealFastCoefficientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..f166ef48c270cb681b695ae903b665955b1b8982 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealFastCoefficientCoordinates.lean @@ -0,0 +1,452 @@ +import OAI.Combinatorics.Progressions.Estimates.ReducedNativeFactorization +import OAI.Combinatorics.Progressions.Geometry.RealSubspaceCoordinateRetraction +import OAI.Combinatorics.Progressions.Linear.BaseChangeCoordinateProjection +import OAI.Combinatorics.Progressions.Linear.RealFirstCoefficientBasis + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {K E H : Type*} [Field K] [AddCommGroup E] [Module K E] + [AddCommGroup H] [Module K H] {a d : ℕ} + +def extendInitialCoordinates : (Fin a → K) →ₗ[K] (Fin d → K) where + toFun x j := if h : j.val < a then x ⟨j.val, h⟩ else 0 + map_add' x y := by funext j; by_cases h : j.val < a <;> simp [h] + map_smul' c x := by funext j; by_cases h : j.val < a <;> simp [h] + +@[simp] theorem extendInitialCoordinates_castLE (ha : a ≤ d) (x : Fin a → K) (i : Fin a) : + extendInitialCoordinates x (Fin.castLE ha i) = x i := by + simp [extendInitialCoordinates, i.isLt] + +noncomputable def initialHorizontalEquiv (ha : a ≤ d) (b : Basis (Fin d) K E) + (P : E →ₗ[K] H) (S : H →ₗ[K] E) + (hsection : ∀ x, P (S x) = x) + (hproj : ∀ x j, b.equivFun (S (P x)) j = + if j.val < a then b.equivFun x j else 0) : (Fin a → K) ≃ₗ[K] H where + toFun y := P (b.equivFun.symm (extendInitialCoordinates y)) + invFun x i := b.equivFun (S x) (Fin.castLE ha i) + left_inv y := by + funext i + change b.equivFun (S (P (b.equivFun.symm (extendInitialCoordinates y)))) + (Fin.castLE ha i) = y i + rw [hproj] + simp only [LinearEquiv.apply_symm_apply, Fin.val_castLE, i.isLt, ite_true, + extendInitialCoordinates_castLE] + right_inv x := by + have he : b.equivFun.symm + (extendInitialCoordinates (fun i => b.equivFun (S x) (Fin.castLE ha i))) = S x := by + apply b.equivFun.injective + funext j + rw [LinearEquiv.apply_symm_apply] + change (if h : j.val < a then + b.equivFun (S x) (Fin.castLE ha ⟨j.val, h⟩) else 0) = b.equivFun (S x) j + split_ifs with hj + · rfl + · have h := hproj (S x) j + simpa only [hsection, hj, ite_false] using h.symm + change P (b.equivFun.symm + (extendInitialCoordinates (fun i => b.equivFun (S x) (Fin.castLE ha i)))) = x + rw [he, hsection] + map_add' x y := by simp only [map_add] + map_smul' c x := by simp only [map_smul, RingHom.id_apply] + +theorem initialHorizontalEquiv_symm_projection (ha : a ≤ d) (b : Basis (Fin d) K E) + (P : E →ₗ[K] H) (S : H →ₗ[K] E) + (hsection : ∀ x, P (S x) = x) + (hproj : ∀ x j, b.equivFun (S (P x)) j = + if j.val < a then b.equivFun x j else 0) (x : E) : + (initialHorizontalEquiv ha b P S hsection hproj).symm (P x) = + fun i => b.equivFun x (Fin.castLE ha i) := by + funext i + change b.equivFun (S (P x)) (Fin.castLE ha i) = _ + rw [hproj] + simp only [Fin.val_castLE, i.isLt, ite_true] + +theorem initialHorizontalEquiv_projection (ha : a ≤ d) (b : Basis (Fin d) K E) + (P : E →ₗ[K] H) (S : H →ₗ[K] E) + (hsection : ∀ x, P (S x) = x) + (hproj : ∀ x j, b.equivFun (S (P x)) j = + if j.val < a then b.equivFun x j else 0) (x : E) : + initialHorizontalEquiv ha b P S hsection hproj + (fun i => b.equivFun x (Fin.castLE ha i)) = P x := by + rw [← initialHorizontalEquiv_symm_projection ha b P S hsection hproj x, + LinearEquiv.apply_symm_apply] + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem realDenominatorGrid_single {ι : Type*} [DecidableEq ι] (l : ℕ) (i : ι) : + Pi.single i (1 : ℝ) ∈ realDenominatorGrid l := by + refine ⟨Pi.single i (l : ℤ), ?_⟩ + funext j + change ((Pi.single i (l : ℤ) : ι → ℤ) j : ℝ) = + (l : ℝ) * (Pi.single i (1 : ℝ) : ι → ℝ) j + by_cases h : j = i <;> simp [h] + +theorem extendInitialCoordinates_grid {a d : ℕ} (l : ℕ) (x : Fin a → ℝ) + (hx : x ∈ realDenominatorGrid l) : + (extendInitialCoordinates x : Fin d → ℝ) ∈ realDenominatorGrid l := by + obtain ⟨z, hz⟩ := hx + refine ⟨fun i => if hi : i.val < a then z ⟨i.val, hi⟩ else 0, ?_⟩ + funext i + change ((if hi : i.val < a then z ⟨i.val, hi⟩ else 0 : ℤ) : ℝ) = + (l : ℝ) * (if hi : i.val < a then x ⟨i.val, hi⟩ else 0) + by_cases hi : i.val < a + · simpa only [hi, dite_true, Pi.smul_apply, smul_eq_mul] using congrFun hz ⟨i.val, hi⟩ + · simp only [hi, dite_false, Int.cast_zero, mul_zero] + +theorem norm_extendInitialCoordinates_le {a d : ℕ} (x : Fin a → ℝ) : + ‖(extendInitialCoordinates x : Fin d → ℝ)‖ ≤ ‖x‖ := by + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro i + change ‖if hi : i.val < a then x ⟨i.val, hi⟩ else 0‖ ≤ ‖x‖ + split_ifs with hi + · exact norm_le_pi_norm x ⟨i.val, hi⟩ + · simpa only [norm_zero] using norm_nonneg x + +theorem norm_extendInitialCoordinates {a d : ℕ} (ha : a ≤ d) (x : Fin a → ℝ) : + ‖(extendInitialCoordinates x : Fin d → ℝ)‖ = ‖x‖ := by + apply le_antisymm (norm_extendInitialCoordinates_le x) + apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr + intro i + have h := norm_le_pi_norm (extendInitialCoordinates x : Fin d → ℝ) (Fin.castLE ha i) + simpa only [extendInitialCoordinates_castLE] using h + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι L : Type*} [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (w : σ → ℕ) + +theorem firstCoefficientHorizontal_projector_repr + (x : F.FirstCoefficientModule w) (z : FirstCoefficientIndex w ω) : + (F.firstCoefficientBasis b ω hF w).repr + (F.firstCoefficientHorizontalSection w (F.firstCoefficientHorizontal w x)) z = + if z.val.1 = 0 then (F.firstCoefficientBasis b ω hF w).repr x z else 0 := by + classical + obtain ⟨p, rfl⟩ := F.firstCoefficientMap_surjective w x + rw [F.firstCoefficientHorizontal_map, F.firstCoefficientHorizontalSection_mk] + change (F.firstCoefficientBasis b ω hF w).repr + (F.firstCoefficientMap w ⟨F.adaptedConstant w (coefficients p.val.val 0), _⟩) z = _ + rw [F.firstCoefficientBasis_repr_map, F.firstCoefficientBasis_repr_map] + change b.repr (coefficients (monomial 0 (coefficients p.val.val 0)) z.val.1) z.val.2 = _ + by_cases hz : z.val.1 = 0 + · simp [hz, coefficients_monomial] + · simp [hz, coefficients_monomial, Finsupp.single_eq_of_ne hz] + +theorem firstCoefficientHorizontal_projector (x : F.FirstCoefficientModule w) : + F.firstCoefficientHorizontalSection w (F.firstCoefficientHorizontal w x) = + basisCoordinateProjection (F.firstCoefficientBasis b ω hF w) {z | z.val.1 = 0} x := by + classical + apply (F.firstCoefficientBasis b ω hF w).repr.injective + ext z + rw [F.firstCoefficientHorizontal_projector_repr, basisCoordinateProjection_repr] + rfl + +theorem firstCoefficientHorizontal_eq_zero_iff + (x : F.FirstCoefficientModule w) : + F.firstCoefficientHorizontal w x = 0 ↔ + ∀ z : FirstCoefficientIndex w ω, z.val.1 = 0 → + (F.firstCoefficientBasis b ω hF w).repr x z = 0 := by + classical + constructor + · intro hx z hz + have h := F.firstCoefficientHorizontal_projector_repr b ω hF w x z + simpa only [hx, map_zero, Finsupp.zero_apply, hz, ite_true] using h.symm + · intro hx + have hp : F.firstCoefficientHorizontalSection w (F.firstCoefficientHorizontal w x) = 0 := by + apply (F.firstCoefficientBasis b ω hF w).repr.injective + ext z + rw [F.firstCoefficientHorizontal_projector_repr, map_zero, Finsupp.zero_apply] + split_ifs with hz + · exact hx z hz + · rfl + have h := congrArg (F.firstCoefficientHorizontal w) hp + simpa only [F.firstCoefficientHorizontal_section, map_zero] using h + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (w : σ → ℕ) + +theorem firstCoefficientRealEquiv_coordinates (x : ℝ ⊗[ℚ] F.FirstCoefficientModule w) + (z : FirstCoefficientIndex w ω) : + (F.realFirstCoefficientBasis b ω hF w).repr (F.firstCoefficientRealEquiv w x) z = + ((F.firstCoefficientBasis b ω hF w).baseChange ℝ).repr x z := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy] + | tmul r x => + obtain ⟨p, rfl⟩ := F.firstCoefficientMap_surjective w x + have ht : r ⊗ₜ[ℚ] F.firstCoefficientMap w p = + (F.firstCoefficientMap w).baseChange ℝ (r ⊗ₜ[ℚ] p) := rfl + rw [ht, F.firstCoefficientRealEquiv_map] + let q : F.realShiftedCoefficientSubmodule w 1 := + ⟨r ⊗ₜ[ℚ] p.val, Submodule.tmul_mem_baseChange_of_mem r p.property⟩ + change (F.realFirstCoefficientBasis b ω hF w).repr (F.realFirstCoefficientMap w q) z = + ((F.firstCoefficientBasis b ω hF w).baseChange ℝ).repr (r ⊗ₜ[ℚ] F.firstCoefficientMap w p) z + rw [F.realFirstCoefficientBasis_repr_map] + change ((F.adaptedMonomialBasis b ω hF w).baseChange ℝ).repr (r ⊗ₜ[ℚ] p.val) + ((firstCoefficientSurvivorEquiv w ω).symm z).val.val = + ((F.firstCoefficientBasis b ω hF w).baseChange ℝ).repr (r ⊗ₜ[ℚ] F.firstCoefficientMap w p) z + rw [Basis.baseChange_repr_tmul, Basis.baseChange_repr_tmul, + F.adaptedMonomialBasis_repr, F.firstCoefficientBasis_repr_map] + rfl + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct + +variable {σ ι L : Type*} [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (w : σ → ℕ) + +theorem realFirstCoefficientHorizontal_projector_repr + (x : F.RealFirstCoefficientModule w) (z : FirstCoefficientIndex w ω) : + (F.realFirstCoefficientBasis b ω hF w).repr + (F.realFirstCoefficientHorizontalSection w (F.realFirstCoefficientHorizontal w x)) z = + if z.val.1 = 0 then (F.realFirstCoefficientBasis b ω hF w).repr x z else 0 := by + classical + obtain ⟨x, rfl⟩ := (F.firstCoefficientRealEquiv w).surjective x + change (F.realFirstCoefficientBasis b ω hF w).repr + (F.firstCoefficientRealEquiv w ((F.firstCoefficientHorizontalSection w).baseChange ℝ + ((F.firstCoefficientHorizontal w).baseChange ℝ + ((F.firstCoefficientRealEquiv w).symm (F.firstCoefficientRealEquiv w x))))) z = _ + rw [LinearEquiv.symm_apply_apply, F.firstCoefficientRealEquiv_coordinates, + F.firstCoefficientRealEquiv_coordinates] + exact baseChange_coordinate_projector_repr (F.firstCoefficientBasis b ω hF w) + (F.firstCoefficientHorizontal w) (F.firstCoefficientHorizontalSection w) + (fun z => z.val.1 = 0) (F.firstCoefficientHorizontal_projector_repr b ω hF w) x z + +theorem realFirstCoefficientHorizontal_projector (x : F.RealFirstCoefficientModule w) : + F.realFirstCoefficientHorizontalSection w (F.realFirstCoefficientHorizontal w x) = + basisCoordinateProjection (F.realFirstCoefficientBasis b ω hF w) {z | z.val.1 = 0} x := by + classical + apply (F.realFirstCoefficientBasis b ω hF w).repr.injective + ext z + rw [F.realFirstCoefficientHorizontal_projector_repr, basisCoordinateProjection_repr] + rfl + +theorem realFirstCoefficientHorizontal_eq_zero_iff + (x : F.RealFirstCoefficientModule w) : + F.realFirstCoefficientHorizontal w x = 0 ↔ + ∀ z : FirstCoefficientIndex w ω, z.val.1 = 0 → + (F.realFirstCoefficientBasis b ω hF w).repr x z = 0 := by + classical + constructor + · intro hx z hz + have h := F.realFirstCoefficientHorizontal_projector_repr b ω hF w x z + simpa only [hx, map_zero, Finsupp.zero_apply, hz, ite_true] using h.symm + · intro hx + have hp : F.realFirstCoefficientHorizontalSection w (F.realFirstCoefficientHorizontal w x) = 0 := by + apply (F.realFirstCoefficientBasis b ω hF w).repr.injective + ext z + rw [F.realFirstCoefficientHorizontal_projector_repr, map_zero, Finsupp.zero_apply] + split_ifs with hz + · exact hx z hz + · rfl + have h := congrArg (F.realFirstCoefficientHorizontal w) hp + simpa only [F.realFirstCoefficientHorizontal_section, map_zero] using h + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct + +variable {σ ι L : Type*} [DecidableEq σ] [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (w : σ → ℕ) (hw : ∀ i, 0 < w i) + (U : Submodule ℚ (F.squareFiltration.quotientTop.PolynomialSymbol w)) + (b : Basis (Fin d) ℝ (F.RealFirstCoefficientModule w ⧸ + F.realFirstCoefficientFastSubmodule w hw U)) + (rows : Fin d → FirstCoefficientIndex w ω) + (hblock : ∀ i j, (rows j).val.1 ≠ i.val.1 → + b.repr ((F.realFirstCoefficientFastSubmodule w hw U).mkQ + (F.realFirstCoefficientBasis e ω hF w i)) j = 0) + +include hblock + +theorem realFastCoefficientHorizontal_projector + (x : F.RealFirstCoefficientModule w ⧸ F.realFirstCoefficientFastSubmodule w hw U) : + F.realFastCoefficientHorizontalSection w hw U (F.realFastCoefficientHorizontal w hw U x) = + basisCoordinateProjection b {j | (rows j).val.1 = 0} x := by + classical + obtain ⟨x, rfl⟩ := (F.realFirstCoefficientFastSubmodule w hw U).mkQ_surjective x + change (F.realFirstCoefficientFastSubmodule w hw U).mkQ + (F.realFirstCoefficientHorizontalSection w (F.realFirstCoefficientHorizontal w x)) = _ + rw [F.realFirstCoefficientHorizontal_projector e ω hF w] + exact basisBlockMap_commutes (F.realFirstCoefficientBasis e ω hF w) b + (fun i => i.val.1) (fun j => (rows j).val.1) + (F.realFirstCoefficientFastSubmodule w hw U).mkQ hblock 0 x + +theorem realFastCoefficientHorizontal_projector_repr + (x : F.RealFirstCoefficientModule w ⧸ F.realFirstCoefficientFastSubmodule w hw U) + (j : Fin d) : + b.repr (F.realFastCoefficientHorizontalSection w hw U + (F.realFastCoefficientHorizontal w hw U x)) j = + if (rows j).val.1 = 0 then b.repr x j else 0 := by + rw [F.realFastCoefficientHorizontal_projector e ω hF w hw U b rows hblock] + exact basisCoordinateProjection_repr b {j | (rows j).val.1 = 0} x j + +noncomputable def realFastCoefficientHorizontalEquiv {a : ℕ} (ha : a ≤ d) + (hprefix : ∀ j, j.val < a ↔ (rows j).val.1 = 0) : + (Fin a → ℝ) ≃ₗ[ℝ] (ℝ ⊗[ℚ] (L ⧸ F.layer 2)) := + initialHorizontalEquiv ha b (F.realFastCoefficientHorizontal w hw U) + (F.realFastCoefficientHorizontalSection w hw U) + (F.realFastCoefficientHorizontal_section w hw U) (fun x j => by + change b.repr (F.realFastCoefficientHorizontalSection w hw U + (F.realFastCoefficientHorizontal w hw U x)) j = _ + rw [F.realFastCoefficientHorizontal_projector_repr e ω hF w hw U b rows hblock] + simp only [← hprefix j, Basis.equivFun_apply]) + +theorem realFastCoefficientHorizontalEquiv_projection {a : ℕ} (ha : a ≤ d) + (hprefix : ∀ j, j.val < a ↔ (rows j).val.1 = 0) + (x : F.RealFirstCoefficientModule w ⧸ F.realFirstCoefficientFastSubmodule w hw U) : + F.realFastCoefficientHorizontalEquiv e ω hF w hw U b rows hblock ha hprefix + (fun i => b.equivFun x (Fin.castLE ha i)) = F.realFastCoefficientHorizontal w hw U x := + initialHorizontalEquiv_projection ha b (F.realFastCoefficientHorizontal w hw U) + (F.realFastCoefficientHorizontalSection w hw U) + (F.realFastCoefficientHorizontal_section w hw U) _ x + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module +open scoped TensorProduct Matrix + +section Ambient + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) (w : σ → ℕ) + +theorem firstCoefficientRealEquiv_basis (i : FirstCoefficientIndex w ω) : + F.firstCoefficientRealEquiv w ((F.firstCoefficientBasis e ω hF w).baseChange ℝ i) = + F.realFirstCoefficientBasis e ω hF w i := by + apply (F.realFirstCoefficientBasis e ω hF w).repr.injective + ext j + rw [F.firstCoefficientRealEquiv_coordinates] + simp only [Basis.repr_self] + +end Ambient + +variable {σ ι κ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (w : σ → ℕ) (hw : ∀ i, 0 < w i) + (U : Submodule ℚ (F.squareFiltration.quotientTop.PolynomialSymbol w)) + +noncomputable def fastCoefficientRealEquiv : + (ℝ ⊗[ℚ] (F.FirstCoefficientModule w ⧸ F.firstCoefficientFastSubmodule w hw U)) ≃ₗ[ℝ] + (F.RealFirstCoefficientModule w ⧸ F.realFirstCoefficientFastSubmodule w hw U) := + realTransportedQuotientEquiv (F.firstCoefficientFastSubmodule w hw U) + (F.firstCoefficientRealEquiv w) + +theorem fastCoefficientRealEquiv_mk (x : ℝ ⊗[ℚ] F.FirstCoefficientModule w) : + F.fastCoefficientRealEquiv w hw U + ((F.firstCoefficientFastSubmodule w hw U).mkQ.baseChange ℝ x) = + (F.realFirstCoefficientFastSubmodule w hw U).mkQ (F.firstCoefficientRealEquiv w x) := + realTransportedQuotientEquiv_mk _ _ x + +noncomputable def realFastCoefficientBasis + (b : Basis κ ℚ (F.FirstCoefficientModule w ⧸ F.firstCoefficientFastSubmodule w hw U)) : + Basis κ ℝ (F.RealFirstCoefficientModule w ⧸ F.realFirstCoefficientFastSubmodule w hw U) := + realTransportedQuotientBasis (F.firstCoefficientFastSubmodule w hw U) + (F.firstCoefficientRealEquiv w) b + +theorem realFastCoefficientBasis_repr_basis + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + (b : Basis κ ℚ (F.FirstCoefficientModule w ⧸ F.firstCoefficientFastSubmodule w hw U)) + (i : FirstCoefficientIndex w ω) (j : κ) : + (F.realFastCoefficientBasis w hw U b).repr + ((F.realFirstCoefficientFastSubmodule w hw U).mkQ + (F.realFirstCoefficientBasis e ω hF w i)) j = + (b.repr ((F.firstCoefficientFastSubmodule w hw U).mkQ + (F.firstCoefficientBasis e ω hF w i)) j : ℝ) := by + rw [← F.firstCoefficientRealEquiv_basis e ω hF w i] + exact realTransportedQuotientBasis_repr_basis _ _ _ b i j + +theorem realFastCoefficientBasis_matrix + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + [Fintype (FirstCoefficientIndex w ω)] [DecidableEq (FirstCoefficientIndex w ω)] + [Fintype κ] [DecidableEq κ] + (b : Basis κ ℚ (F.FirstCoefficientModule w ⧸ F.firstCoefficientFastSubmodule w hw U)) : + LinearMap.toMatrix (F.realFirstCoefficientBasis e ω hF w) + (F.realFastCoefficientBasis w hw U b) (F.realFirstCoefficientFastSubmodule w hw U).mkQ = + (LinearMap.toMatrix (F.firstCoefficientBasis e ω hF w) b + (F.firstCoefficientFastSubmodule w hw U).mkQ).map (Rat.castHom ℝ) := by + ext j i + simp only [Matrix.map_apply, LinearMap.toMatrix_apply] + exact F.realFastCoefficientBasis_repr_basis w hw U e ω hF b i j + +theorem realFastCoefficientBasis_symm + (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) + [Fintype (FirstCoefficientIndex w ω)] [DecidableEq (FirstCoefficientIndex w ω)] + [Fintype κ] [DecidableEq κ] + (b : Basis κ ℚ (F.FirstCoefficientModule w ⧸ F.firstCoefficientFastSubmodule w hw U)) + (D : Matrix κ (FirstCoefficientIndex w ω) ℚ) + (S : Matrix (FirstCoefficientIndex w ω) κ ℚ) + (hD : LinearMap.toMatrix (F.firstCoefficientBasis e ω hF w) b + (F.firstCoefficientFastSubmodule w hw U).mkQ = D) + (hDS : D * S = 1) (y : κ → ℝ) : + (F.realFastCoefficientBasis w hw U b).equivFun.symm y = + (F.realFirstCoefficientFastSubmodule w hw U).mkQ + ((F.realFirstCoefficientBasis e ω hF w).equivFun.symm + (S.map (Rat.castHom ℝ) *ᵥ y)) := by + apply quotient_basis_representative (F.realFirstCoefficientBasis e ω hF w) + (F.realFastCoefficientBasis w hw U b) _ (D.map (Rat.castHom ℝ)) _ ?_ + (real_matrix_right_inverse D S hDS) y + rw [F.realFastCoefficientBasis_matrix, hD] + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealOrderedChartPatch.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealOrderedChartPatch.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e233e9f2b04e24f83750af866efdad4f90e3c6a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealOrderedChartPatch.lean @@ -0,0 +1,58 @@ +import OAI.Combinatorics.Progressions.Estimates.RealOrderedSlots +import OAI.Combinatorics.Progressions.Lattices.ChartLatticePeriodization + +namespace OAI + +section + +namespace Erdos3.IsCentralLieBasis + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {d s : ℕ} + {e : Basis (Fin d) ℚ L} (he : IsCentralLieBasis e) + (hnil : LieModule.lowerCentralSeries ℚ L L s = ⊥) + (Λ : Subgroup (NilpotentLieBCHGroup L s hnil)) + [MetricSpace (NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s + (realification_lowerCentralSeries_eq_bot hnil) ⧸ Λ.map realificationHom)] + +include he + +theorem realOrderedSlots_patchValue (B : ℕ) (hB : 0 < B) + (hgrid : bchSubgroupCoordinates e Λ = scaledIntegerGrid B) + (z g : NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s (realification_lowerCentralSeries_eq_bot hnil)) + (phi : OpenPartialHomeomorph (Fin d → ℝ) + (NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s + (realification_lowerCentralSeries_eq_bot hnil) ⧸ Λ.map realificationHom)) + (hphi : ∀ v, phi v = QuotientGroup.mk + (z * (⟨(e.baseChange ℝ).equivFun.symm v⟩ : NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s + (realification_lowerCentralSeries_eq_bot hnil)))) + (F : (NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s + (realification_lowerCentralSeries_eq_bot hnil) ⧸ Λ.map realificationHom) → ℝ) + (hF : Function.support F ⊆ phi.target) (Phi : PatchKernel d) + (hPhi : ∀ v, Phi.value v = chartCoordinateKernel phi F ((B : ℝ) • v)) : + (realOrderedSlots (e.baseChange ℝ) (realification_lowerCentralSeries_eq_bot hnil) + (B : ℝ) (z⁻¹ * g)).patchValue Phi = F (QuotientGroup.mk g) := by + let q : NilpotentLieBCHGroup (ℝ ⊗[ℚ] L) s (realification_lowerCentralSeries_eq_bot hnil) ≃ + (Fin d → ℝ) := + { toFun := fun a => (e.baseChange ℝ).equivFun a.coord + invFun := fun v => ⟨(e.baseChange ℝ).equivFun.symm v⟩ + left_inv := fun a => NilpotentLieBCHGroup.ext + ((e.baseChange ℝ).equivFun.symm_apply_apply a.coord) + right_inv := fun v => (e.baseChange ℝ).equivFun.apply_symm_apply v } + apply triangular_patchValue_eq_chartObservable (Λ.map realificationHom) + q (realIntegralOrderedBasisProduct e hnil B) + (realIntegralOrderedBasisProduct_mem e hnil Λ B hgrid) + (he.exists_realIntegralOrderedBasisProduct hnil Λ B hgrid) z g phi hphi F hF + _ Phi (B : ℝ) hPhi + intro b + exact he.real_baseChange.smul_realOrderedSlots_residual + (realification_lowerCentralSeries_eq_bot hnil) (B : ℝ) + (by exact_mod_cast hB.ne') (z⁻¹ * g) b + +end Erdos3.IsCentralLieBasis + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealPolarizedCoefficientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealPolarizedCoefficientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cb31c4c3867c0eabb7b4f198bf38e8fb50b3d6d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealPolarizedCoefficientCoordinates.lean @@ -0,0 +1,53 @@ +import OAI.Combinatorics.Progressions.Polynomial.RealPolarizedPolynomialOrbit + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open VectorPolynomial +open scoped TensorProduct + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +theorem realPolarizedCoefficient_self (p : F.realification.adaptedLieSubalgebra) + (a : SquarefreeIndex ι) (ha : a.val ≠ 0) : + realSquarefreePolynomialEquiv (F.realSquarefreeInclusion π (F.realPolarizedCoefficient π p a)) a = + (multidegreeFactorial (blockDegree π a.val) : ℚ) • + coefficients p.val (blockExponent π a.val) := by + rw [F.realPolarizedCoefficient_inclusion π p a ha, map_rat_smul, Pi.smul_apply, + realSquarefreeMonomial_self] + +theorem realPolarizedCoefficient_ne (p : F.realification.adaptedLieSubalgebra) + (a c : SquarefreeIndex ι) (hac : a ≠ c) : + realSquarefreePolynomialEquiv (F.realSquarefreeInclusion π (F.realPolarizedCoefficient π p a)) c = 0 := by + by_cases ha : a.val = 0 + · rw [F.realPolarizedCoefficient_zero π p a ha, map_zero, map_zero, Pi.zero_apply] + · rw [F.realPolarizedCoefficient_inclusion π p a ha, map_rat_smul, Pi.smul_apply, + realSquarefreeMonomial_ne a c hac, smul_zero] + +theorem realPolarizedLog_eval_coefficient (p : F.realification.adaptedLieSubalgebra) + (x : ι → ℚ) (c : SquarefreeIndex ι) : + realSquarefreePolynomialEquiv (F.realSquarefreeInclusion π (eval x (F.realPolarizedLog π p))) c = + (c.val.prod fun i n => x i ^ n) • + realSquarefreePolynomialEquiv (F.realSquarefreeInclusion π (F.realPolarizedCoefficient π p c)) c := by + classical + let C : (ℝ ⊗[ℚ] F.SquarefreeAlgebra π) →ₗ[ℝ] (ℝ ⊗[ℚ] L) := (LinearMap.proj c).comp + (realSquarefreePolynomialEquiv.toLinearMap.comp (F.realSquarefreeInclusion π)) + change C (eval x (F.realPolarizedLog π p)) = _ + rw [F.realPolarizedLog_eval, map_sum] + simp only [LinearMap.map_smul_of_tower] + rw [Finset.sum_eq_single c] + · rfl + · intro a _ hac + have hz : C (F.realPolarizedCoefficient π p a) = 0 := F.realPolarizedCoefficient_ne π p a c hac + rw [hz, smul_zero] + · simp + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealSquarefreeCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealSquarefreeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a85781934a0a77bfa89aabfebc475442e2587b2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealSquarefreeCoordinates.lean @@ -0,0 +1,44 @@ +import Mathlib.LinearAlgebra.TensorProduct.Pi +import OAI.Combinatorics.Progressions.Estimates.RealifiedMultidegree + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + +noncomputable def realSquarefreePolynomialEquiv : + (ℝ ⊗[ℚ] SquarefreePolynomial ι L) ≃ₗ[ℝ] (SquarefreeIndex ι → ℝ ⊗[ℚ] L) := by + classical + exact ((squarefreePolynomialEquiv (ι := ι) (L := L)).baseChange ℚ ℝ _ _).trans + (TensorProduct.piRight ℚ ℝ ℝ (fun _ : SquarefreeIndex ι => L)) + +theorem realSquarefreePolynomialEquiv_tmul (r : ℝ) (x : SquarefreePolynomial ι L) + (c : SquarefreeIndex ι) : + realSquarefreePolynomialEquiv (r ⊗ₜ[ℚ] x) c = r ⊗ₜ[ℚ] squarefreePolynomialEquiv x c := rfl + +theorem realSquarefreeMonomial_self (a : SquarefreeIndex ι) (x : ℝ ⊗[ℚ] L) : + realSquarefreePolynomialEquiv ((squarefreeMonomial a).baseChange ℝ x) a = x := by + induction x using TensorProduct.inductionOn with + | tmul r x => + rw [LinearMap.baseChange_tmul, realSquarefreePolynomialEquiv_tmul, + squarefreePolynomialEquiv_monomial_self] + | add x y hx hy => simp only [map_add, Pi.add_apply, hx, hy] + +theorem realSquarefreeMonomial_ne (a c : SquarefreeIndex ι) (hac : a ≠ c) (x : ℝ ⊗[ℚ] L) : + realSquarefreePolynomialEquiv ((squarefreeMonomial a).baseChange ℝ x) c = 0 := by + induction x using TensorProduct.inductionOn with + | tmul r x => + rw [LinearMap.baseChange_tmul, realSquarefreePolynomialEquiv_tmul, + squarefreePolynomialEquiv_monomial_ne a c hac, TensorProduct.tmul_zero] + | add x y hx hy => simp only [map_add, Pi.add_apply, hx, hy, add_zero] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealSubspaceCoordinateRetraction.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealSubspaceCoordinateRetraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..b49e678466f8b75271aa32ca34887b23f5d57e94 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealSubspaceCoordinateRetraction.lean @@ -0,0 +1,497 @@ +import Mathlib.Data.Matrix.Mul +import Mathlib.LinearAlgebra.Isomorphisms +import Mathlib.LinearAlgebra.TensorProduct.Basis +import OAI.Combinatorics.Progressions.Linear.QuotientActionMatrix +import OAI.Combinatorics.Progressions.Linear.RationalTaggedSpanProjection +import OAI.Combinatorics.Progressions.Polynomial.SubspacePolynomialCoordinates + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +theorem real_matrix_right_inverse {ι κ : Type*} [Fintype ι] [DecidableEq κ] + (D : Matrix κ ι ℚ) (S : Matrix ι κ ℚ) (hDS : D * S = 1) : + D.map (Rat.castHom ℝ) * S.map (Rat.castHom ℝ) = 1 := by + rw [← Matrix.map_mul, hDS] + exact Matrix.map_one _ (map_zero (Rat.castHom ℝ)) (map_one (Rat.castHom ℝ)) + +variable {V W : Type*} [AddCommGroup V] [Module ℚ V] [AddCommGroup W] [Module ℝ W] + (U : Submodule ℚ V) + +theorem realification_mkQ_ker : LinearMap.ker (U.mkQ.baseChange ℝ) = U.baseChange ℝ := by + rw [← realification_ker, Submodule.ker_mkQ] + +theorem realification_mkQ_surjective : Function.Surjective (U.mkQ.baseChange ℝ) := + LinearMap.lTensor_surjective ℝ U.mkQ_surjective + +noncomputable def realQuotientEquiv : + (ℝ ⊗[ℚ] (V ⧸ U)) ≃ₗ[ℝ] ((ℝ ⊗[ℚ] V) ⧸ U.baseChange ℝ) := + (U.mkQ.baseChange ℝ).quotKerEquivOfSurjective + (realification_mkQ_surjective U) |>.symm |>.trans + (Submodule.quotEquivOfEq _ _ (realification_mkQ_ker U)) + +theorem realQuotientEquiv_mk (x : ℝ ⊗[ℚ] V) : + realQuotientEquiv U (U.mkQ.baseChange ℝ x) = (U.baseChange ℝ).mkQ x := by + dsimp only [realQuotientEquiv, LinearEquiv.trans_apply] + rw [LinearMap.quotKerEquivOfSurjective_symm_apply] + rfl + +noncomputable def realTransportedQuotientEquiv (E : (ℝ ⊗[ℚ] V) ≃ₗ[ℝ] W) : + (ℝ ⊗[ℚ] (V ⧸ U)) ≃ₗ[ℝ] (W ⧸ (U.baseChange ℝ).map E.toLinearMap) := + (realQuotientEquiv U).trans (Submodule.Quotient.equiv _ _ E rfl) + +theorem realTransportedQuotientEquiv_mk (E : (ℝ ⊗[ℚ] V) ≃ₗ[ℝ] W) (x : ℝ ⊗[ℚ] V) : + realTransportedQuotientEquiv U E (U.mkQ.baseChange ℝ x) = + ((U.baseChange ℝ).map E.toLinearMap).mkQ (E x) := by + change Submodule.Quotient.equiv _ _ E rfl (realQuotientEquiv U (U.mkQ.baseChange ℝ x)) = _ + rw [realQuotientEquiv_mk] + rfl + +noncomputable def realTransportedQuotientBasis {κ : Type*} + (E : (ℝ ⊗[ℚ] V) ≃ₗ[ℝ] W) (b : Basis κ ℚ (V ⧸ U)) : + Basis κ ℝ (W ⧸ (U.baseChange ℝ).map E.toLinearMap) := + (b.baseChange ℝ).map (realTransportedQuotientEquiv U E) + +theorem realTransportedQuotientBasis_repr_mk {κ : Type*} + (E : (ℝ ⊗[ℚ] V) ≃ₗ[ℝ] W) (b : Basis κ ℚ (V ⧸ U)) (x : ℝ ⊗[ℚ] V) (i : κ) : + (realTransportedQuotientBasis U E b).repr + (((U.baseChange ℝ).map E.toLinearMap).mkQ (E x)) i = + (b.baseChange ℝ).repr (U.mkQ.baseChange ℝ x) i := by + rw [← realTransportedQuotientEquiv_mk] + simp only [realTransportedQuotientBasis, Basis.map_repr, LinearEquiv.trans_apply, + LinearEquiv.symm_apply_apply] + +theorem realTransportedQuotientBasis_repr_basis {ι κ : Type*} + (E : (ℝ ⊗[ℚ] V) ≃ₗ[ℝ] W) (e : Basis ι ℚ V) (b : Basis κ ℚ (V ⧸ U)) (i : ι) (j : κ) : + (realTransportedQuotientBasis U E b).repr + (((U.baseChange ℝ).map E.toLinearMap).mkQ (E ((e.baseChange ℝ) i))) j = + (b.repr (U.mkQ (e i)) j : ℝ) := by + rw [realTransportedQuotientBasis_repr_mk] + simp only [Basis.baseChange_apply, LinearMap.baseChange_tmul, Basis.baseChange_repr_tmul] + simp [Algebra.smul_def] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped Matrix NNReal + +variable {ι κ δ V W : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] + [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] + (e : Basis ι ℝ V) (f : Basis κ ℝ W) (q : V →ₗ[ℝ] W) + (D : Matrix κ ι ℚ) (hD : LinearMap.toMatrix e f q = D.map (Rat.castHom ℝ)) + +include hD + +theorem rational_coordinate_map (x : V) : + f.equivFun (q x) = D.map (Rat.castHom ℝ) *ᵥ e.equivFun x := by + have h := LinearMap.toMatrix_mulVec_repr e f q x + rw [hD] at h + exact h.symm + +theorem rational_coordinate_map_grid (l : ℕ) (x : V) + (hx : e.equivFun x ∈ realDenominatorGrid l) : + f.equivFun (q x) ∈ realDenominatorGrid (matrixDenominator D * l) := by + rw [rational_coordinate_map e f q D hD] + exact real_matrix_denominator_grid D l _ hx + +theorem rational_coordinate_map_weighted (c : ι → δ) (r : κ → δ) + (hblock : ∀ i j, r i ≠ c j → D i j = 0) + (H : ℝ≥0) (hH : ∀ i j, ((D i j).num.natAbs : ℝ) ≤ H) + (scale : δ → ℝ) (hscale : ∀ d, 0 < scale d) {M : ℝ} (hM : 0 ≤ M) + (x : V) (hx : ∀ j, |e.equivFun x j| ≤ M / scale (c j)) (i : κ) : + |f.equivFun (q x) i| ≤ + ((Fintype.card ι : ℝ) + 1) * (H + 1) * M / scale (r i) := by + rw [rational_coordinate_map e f q D hD] + exact weighted_matrix_mulVec_bound r c (D.map (Rat.castHom ℝ)) + (fun i j h => by change (D i j : ℝ) = 0; rw [hblock i j h, Rat.cast_zero]) + H (fun i j => (rational_abs_real_le_numerator (D i j)).trans (hH i j)) + scale hscale hM (e.equivFun x) hx i + +theorem rational_coordinate_map_weighted_exp (c : ι → δ) (r : κ → δ) + (hblock : ∀ i j, r i ≠ c j → D i j = 0) {p : ℝ} (hp : 0 ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) (a : ℕ) (ha : 1 ≤ a) + (hH : ∀ i j, ((D i j).num.natAbs : ℝ) ≤ Real.exp ((p + 2) ^ a)) + (scale : δ → ℝ) (hscale : ∀ d, 0 < scale d) {M : ℝ} (hM : 0 ≤ M) + (x : V) (hx : ∀ j, |e.equivFun x j| ≤ M / scale (c j)) (i : κ) : + |f.equivFun (q x) i| ≤ Real.exp ((p + 2) ^ (a + 2)) * M / scale (r i) := by + have h := rational_coordinate_map_weighted e f q D hD c r hblock + ⟨Real.exp ((p + 2) ^ a), Real.exp_nonneg _⟩ hH scale hscale hM x hx i + exact h.trans (div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_right (matrix_weighted_factor_le_exp_power _ hp hι a ha) hM) + (hscale _).le) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped Matrix + +variable {ι κ δ V : Type*} [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℝ V] (e : Basis ι ℝ V) (S : Matrix ι κ ℚ) + +noncomputable def rationalCoordinateSection : (κ → ℝ) →ₗ[ℝ] V := + e.equivFun.symm.toLinearMap.comp (S.map (Rat.castHom ℝ)).mulVecLin + +theorem rationalCoordinateSection_coordinates (y : κ → ℝ) : + e.equivFun (rationalCoordinateSection e S y) = S.map (Rat.castHom ℝ) *ᵥ y := + e.equivFun.apply_symm_apply _ + +theorem rationalCoordinateSection_grid (l : ℕ) (y : κ → ℝ) + (hy : y ∈ realDenominatorGrid l) : + e.equivFun (rationalCoordinateSection e S y) ∈ + realDenominatorGrid (matrixDenominator S * l) := by + rw [rationalCoordinateSection_coordinates] + exact real_matrix_denominator_grid S l y hy + +theorem rationalCoordinateSection_weighted (c : ι → δ) (r : κ → δ) + (hblock : ∀ i j, c i ≠ r j → S i j = 0) {p : ℝ} (hp : 0 ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) (a : ℕ) (ha : 1 ≤ a) + (hH : ∀ i j, ((S i j).num.natAbs : ℝ) ≤ Real.exp ((p + 2) ^ a)) + (scale : δ → ℝ) (hscale : ∀ d, 0 < scale d) {M : ℝ} (hM : 0 ≤ M) + (y : κ → ℝ) (hy : ∀ j, |y j| ≤ M / scale (r j)) (i : ι) : + |e.equivFun (rationalCoordinateSection e S y) i| ≤ + Real.exp ((p + 2) ^ (a + 2)) * M / scale (c i) := by + rw [rationalCoordinateSection_coordinates] + have h := weighted_matrix_mulVec_bound c r (S.map (Rat.castHom ℝ)) + (fun i j h => by change (S i j : ℝ) = 0; rw [hblock i j h, Rat.cast_zero]) + ⟨Real.exp ((p + 2) ^ a), Real.exp_nonneg _⟩ + (fun i j => (rational_abs_real_le_numerator (S i j)).trans (hH i j)) + scale hscale hM y hy i + exact h.trans (div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_right (matrix_weighted_factor_le_exp_power _ hp hκ a ha) hM) + (hscale _).le) + +theorem rationalCoordinateSection_rightInverse [DecidableEq ι] [DecidableEq κ] + {W : Type*} [AddCommGroup W] [Module ℝ W] (f : Basis κ ℝ W) + (q : V →ₗ[ℝ] W) (D : Matrix κ ι ℚ) + (hD : LinearMap.toMatrix e f q = D.map (Rat.castHom ℝ)) + (hDS : D * S = 1) (y : κ → ℝ) : + q (rationalCoordinateSection e S y) = f.equivFun.symm y := + (quotient_basis_representative e f q (D.map (Rat.castHom ℝ)) (S.map (Rat.castHom ℝ)) + hD (real_matrix_right_inverse D S hDS) y).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +variable {ι κ V W E : Type*} [AddCommGroup V] [Module ℚ V] + [AddCommGroup W] [Module ℚ W] [AddCommGroup E] [Module ℝ E] + +theorem scalarExtension_basis_coordinates (e : Basis ι ℚ V) (f : Basis κ ℚ W) + (q : V →ₗ[ℚ] W) (i : κ) (j : ι) : + (f.baseChange ℝ).repr (q.baseChange ℝ ((e.baseChange ℝ) j)) i = + (f.repr (q (e j)) i : ℝ) := by + simp only [Basis.baseChange_apply, LinearMap.baseChange_tmul, Basis.baseChange_repr_tmul] + simp [Algebra.smul_def] + +theorem scalarExtension_equiv_matrix [Fintype ι] [DecidableEq ι] [Fintype κ] + (e : Basis ι ℚ V) (f : Basis κ ℚ W) (b : Basis κ ℝ E) + (q : V →ₗ[ℚ] W) (u : (ℝ ⊗[ℚ] W) ≃ₗ[ℝ] E) + (hu : ∀ x i, b.repr (u x) i = (f.baseChange ℝ).repr x i) : + LinearMap.toMatrix (e.baseChange ℝ) b (u.toLinearMap.comp (q.baseChange ℝ)) = + (LinearMap.toMatrix e f q).map (Rat.castHom ℝ) := by + ext i j + simp only [LinearMap.toMatrix_apply, LinearMap.comp_apply, LinearEquiv.coe_coe, + hu, scalarExtension_basis_coordinates, Matrix.map_apply, Rat.coe_castHom] + +theorem scalarExtension_grid_of_height_one [Fintype ι] [Fintype κ] + (e : Basis ι ℚ V) (f : Basis κ ℚ W) (q : V →ₗ[ℚ] W) + (hq : ∀ i j, RationalHeightLE (f.repr (q (e j)) i) 1) + (l : ℕ) (x : ℝ ⊗[ℚ] V) + (hx : (fun i => (e.baseChange ℝ).repr x i) ∈ realDenominatorGrid l) : + (fun i => (f.baseChange ℝ).repr (q.baseChange ℝ x) i) ∈ realDenominatorGrid l := by + classical + let D := LinearMap.toMatrix e f q + have hD : LinearMap.toMatrix (e.baseChange ℝ) (f.baseChange ℝ) (q.baseChange ℝ) = + D.map (Rat.castHom ℝ) := by + ext i j + simp only [D, LinearMap.toMatrix_apply, Matrix.map_apply, + scalarExtension_basis_coordinates, Rat.coe_castHom] + have hden : matrixDenominator D = 1 := by + apply Nat.le_antisymm + · have hb : ∀ i j, RationalHeightLE (D i j) 1 := by + simpa only [D, LinearMap.toMatrix_apply] using hq + simpa using matrixDenominator_le D hb + · exact matrixDenominator_pos D + have h := rational_coordinate_map_grid (e.baseChange ℝ) (f.baseChange ℝ) + (q.baseChange ℝ) D hD l x hx + simpa only [hden, one_mul, Basis.equivFun_apply] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped Matrix + +theorem controlled_weighted_quotient_coordinates + {ι κ δ V W : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] + (e : Basis ι ℝ V) (f : Basis κ ℝ W) (q : V →ₗ[ℝ] W) + (c : ι → δ) (r : κ → δ) (D : Matrix κ ι ℚ) (S : Matrix ι κ ℚ) + (hD : LinearMap.toMatrix e f q = D.map (Rat.castHom ℝ)) (hDS : D * S = 1) + (hDb : ∀ i j, r i ≠ c j → D i j = 0) (hSb : ∀ i j, c i ≠ r j → S i j = 0) + {p : ℝ} (hp : 0 ≤ p) (hι : (Fintype.card ι : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) (a : ℕ) (ha : 1 ≤ a) + (hDh : ∀ i j, ((D i j).num.natAbs : ℝ) ≤ Real.exp ((p + 2) ^ a) ∧ + ((D i j).den : ℝ) ≤ Real.exp ((p + 2) ^ a)) + (hSh : ∀ i j, ((S i j).num.natAbs : ℝ) ≤ Real.exp ((p + 2) ^ a) ∧ + ((S i j).den : ℝ) ≤ Real.exp ((p + 2) ^ a)) + (l : ℕ) (hl : 0 < l) (hlp : (l : ℝ) ≤ Real.exp p) : + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + 2) ^ (a + 4)) ∧ l ∣ m ∧ + (∀ x : V, e.equivFun x ∈ realDenominatorGrid l → + f.equivFun (q x) ∈ realDenominatorGrid m) ∧ + (∀ y : κ → ℝ, y ∈ realDenominatorGrid l → + e.equivFun (rationalCoordinateSection e S y) ∈ realDenominatorGrid m) ∧ + (∀ y : κ → ℝ, q (rationalCoordinateSection e S y) = f.equivFun.symm y) ∧ + ∀ (scale : δ → ℝ), (∀ d, 0 < scale d) → ∀ M : ℝ, 0 ≤ M → + (∀ x : V, (∀ j, |e.equivFun x j| ≤ M / scale (c j)) → + ∀ i, |f.equivFun (q x) i| ≤ Real.exp ((p + 2) ^ (a + 4)) * M / scale (r i)) ∧ + (∀ y : κ → ℝ, (∀ j, |y j| ≤ M / scale (r j)) → + ∀ i, |e.equivFun (rationalCoordinateSection e S y) i| ≤ + Real.exp ((p + 2) ^ (a + 4)) * M / scale (c i)) := by + let m := matrixDenominator D * matrixDenominator S * l + have hm : 0 < m := Nat.mul_pos (Nat.mul_pos (matrixDenominator_pos D) (matrixDenominator_pos S)) hl + have hmD : matrixDenominator D * l ∣ m := ⟨matrixDenominator S, by dsimp [m]; ring⟩ + have hmS : matrixDenominator S * l ∣ m := ⟨matrixDenominator D, by dsimp [m]; ring⟩ + refine ⟨m, hm, matrix_pair_denominator_le_exp_power D S l hp a ha hι hκ + (fun i j => (hDh i j).2) (fun i j => (hSh i j).2) hlp, + ⟨matrixDenominator D * matrixDenominator S, by dsimp [m]; ring⟩, ?_, ?_, ?_, ?_⟩ + · intro x hx + exact realDenominatorGrid_subset_of_dvd (Nat.mul_pos (matrixDenominator_pos D) hl) hmD + (rational_coordinate_map_grid e f q D hD l x hx) + · intro y hy + exact realDenominatorGrid_subset_of_dvd (Nat.mul_pos (matrixDenominator_pos S) hl) hmS + (rationalCoordinateSection_grid e S l y hy) + · exact rationalCoordinateSection_rightInverse e S f q D hD hDS + · intro scale hscale M hM + have hbudget : Real.exp ((p + 2) ^ (a + 2)) ≤ Real.exp ((p + 2) ^ (a + 4)) := + Real.exp_le_exp.mpr (pow_le_pow_right₀ (by linarith) (by omega)) + constructor + · intro x hx i + have h := rational_coordinate_map_weighted_exp e f q D hD c r hDb hp hι a ha + (fun i j => (hDh i j).1) scale hscale hM x hx i + exact h.trans (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right hbudget hM) (hscale _).le) + · intro y hy i + have h := rationalCoordinateSection_weighted e S c r hSb hp hκ a ha + (fun i j => (hSh i j).1) scale hscale hM y hy i + exact h.trans (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right hbudget hM) (hscale _).le) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct NNReal + +theorem linearMap_coordinate_norm_le {ι κ V W : Type*} [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] + (e : Basis ι ℝ V) (f : Basis κ ℝ W) (q : V →ₗ[ℝ] W) (A : ℝ≥0) + (hentries : ∀ i j, |f.repr (q (e j)) i| ≤ A) (x : V) : + ‖f.equivFun (q x)‖ ≤ (Fintype.card ι : ℝ) * A * ‖e.equivFun x‖ := by + apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr + intro i + have h := abs_linearMap_le_basis_bound e ((f.coord i).comp q) A (hentries i) x + simpa only [LinearMap.comp_apply, Basis.coord_apply, Basis.equivFun_apply, Real.norm_eq_abs] using h + +theorem linearMap_coordinate_dist_le {ι κ V W : Type*} [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] + (e : Basis ι ℝ V) (f : Basis κ ℝ W) (q : V →ₗ[ℝ] W) (A : ℝ≥0) + (hentries : ∀ i j, |f.repr (q (e j)) i| ≤ A) (x y : V) : + dist (f.equivFun (q x)) (f.equivFun (q y)) ≤ + (Fintype.card ι : ℝ) * A * dist (e.equivFun x) (e.equivFun y) := by + simpa only [map_sub, ← dist_eq_norm] using linearMap_coordinate_norm_le e f q A hentries (x - y) + +theorem scalarExtension_coordinate_norm_le {ι κ V W : Type*} [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℚ V] [AddCommGroup W] [Module ℚ W] + (e : Basis ι ℚ V) (f : Basis κ ℚ W) (q : V →ₗ[ℚ] W) {p : ℝ} + (hd : (Fintype.card ι : ℝ) ≤ p) + (hentries : ∀ i j, rationalLogHeight (f.repr (q (e j)) i) ≤ p) (x : ℝ ⊗[ℚ] V) : + ‖(f.baseChange ℝ).equivFun (q.baseChange ℝ x)‖ ≤ + Real.exp (2 * p) * ‖(e.baseChange ℝ).equivFun x‖ := by + have h := linearMap_coordinate_norm_le (e.baseChange ℝ) (f.baseChange ℝ) (q.baseChange ℝ) + ⟨Real.exp p, Real.exp_nonneg p⟩ (fun i j => by + rw [scalarExtension_basis_coordinates] + exact (rational_abs_real_le_numerator _).trans ((rationalLogHeight_le_iff _ _).mp (hentries i j)).1) x + apply h.trans + apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) + calc + (Fintype.card ι : ℝ) * Real.exp p ≤ Real.exp p * Real.exp p := + mul_le_mul_of_nonneg_right (hd.trans (by linarith [Real.add_one_le_exp p])) (Real.exp_nonneg _) + _ = Real.exp (2 * p) := by rw [← Real.exp_add]; congr 1; ring + +theorem scalarExtension_coordinate_dist_le {ι κ V W : Type*} [Fintype ι] [Fintype κ] + [AddCommGroup V] [Module ℚ V] [AddCommGroup W] [Module ℚ W] + (e : Basis ι ℚ V) (f : Basis κ ℚ W) (q : V →ₗ[ℚ] W) {p : ℝ} + (hd : (Fintype.card ι : ℝ) ≤ p) + (hentries : ∀ i j, rationalLogHeight (f.repr (q (e j)) i) ≤ p) (x y : ℝ ⊗[ℚ] V) : + dist ((f.baseChange ℝ).equivFun (q.baseChange ℝ x)) + ((f.baseChange ℝ).equivFun (q.baseChange ℝ y)) ≤ + Real.exp (2 * p) * dist ((e.baseChange ℝ).equivFun x) ((e.baseChange ℝ).equivFun y) := by + simpa only [map_sub, ← dist_eq_norm] using scalarExtension_coordinate_norm_le e f q hd hentries (x - y) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped Matrix TensorProduct NNReal + +variable {ι κ L M : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] + [AddCommGroup L] [Module ℚ L] [AddCommGroup M] [Module ℚ M] + +theorem realified_linear_coordinate_matrix (b : Basis ι ℚ L) (c : Basis κ ℚ M) + (φ : L →ₗ[ℚ] M) : + LinearMap.toMatrix (b.baseChange ℝ) (c.baseChange ℝ) (φ.baseChange ℝ) = + (LinearMap.toMatrix b c φ).map (Rat.castHom ℝ) := by + ext i j + simp only [LinearMap.toMatrix_apply, Matrix.map_apply, + scalarExtension_basis_coordinates, Rat.coe_castHom] + +theorem realified_linear_coordinate_norm (b : Basis ι ℚ L) (c : Basis κ ℚ M) + (φ : L →ₗ[ℚ] M) {H : ℕ} + (hφ : ∀ i j, RationalHeightLE (LinearMap.toMatrix b c φ i j) H) + (x : ℝ ⊗[ℚ] L) : + ‖(c.baseChange ℝ).equivFun (φ.baseChange ℝ x)‖ ≤ + ((Fintype.card ι : ℝ) + 1) * (H + 1) * ‖(b.baseChange ℝ).equivFun x‖ := by + rw [rational_coordinate_map (b.baseChange ℝ) (c.baseChange ℝ) (φ.baseChange ℝ) + (LinearMap.toMatrix b c φ) (realified_linear_coordinate_matrix b c φ)] + exact norm_matrix_mulVec_le _ (H : ℝ≥0) (fun i j => (hφ i j).abs_real_le) _ + +theorem realified_linear_coordinate_grid (b : Basis ι ℚ L) (c : Basis κ ℚ M) + (φ : L →ₗ[ℚ] M) (l : ℕ) (x : ℝ ⊗[ℚ] L) + (hx : (b.baseChange ℝ).equivFun x ∈ realDenominatorGrid l) : + (c.baseChange ℝ).equivFun (φ.baseChange ℝ x) ∈ + realDenominatorGrid (matrixDenominator (LinearMap.toMatrix b c φ) * l) := by + exact rational_coordinate_map_grid (b.baseChange ℝ) (c.baseChange ℝ) (φ.baseChange ℝ) + (LinearMap.toMatrix b c φ) (realified_linear_coordinate_matrix b c φ) l x hx + +theorem realified_section_correction_coordinate_norm [DecidableEq κ] + (b : Basis ι ℚ L) (c : Basis κ ℚ M) (φ : L →ₗ[ℚ] M) (S : M →ₗ[ℚ] L) + {H K : ℕ} + (hφ : ∀ i j, RationalHeightLE (LinearMap.toMatrix b c φ i j) H) + (hS : ∀ i j, RationalHeightLE (LinearMap.toMatrix c b S i j) K) + (x : ℝ ⊗[ℚ] L) (y : ℝ ⊗[ℚ] M) : + ‖(b.baseChange ℝ).equivFun (x - S.baseChange ℝ (φ.baseChange ℝ x - y))‖ ≤ + ‖(b.baseChange ℝ).equivFun x‖ + + (((Fintype.card κ : ℝ) + 1) * (K + 1)) * + ((((Fintype.card ι : ℝ) + 1) * (H + 1)) * + ‖(b.baseChange ℝ).equivFun x‖ + ‖(c.baseChange ℝ).equivFun y‖) := by + have hp := realified_linear_coordinate_norm b c φ hφ x + have hs := realified_linear_coordinate_norm c b S hS (φ.baseChange ℝ x - y) + have ht := norm_sub_le ((c.baseChange ℝ).equivFun (φ.baseChange ℝ x)) + ((c.baseChange ℝ).equivFun y) + have hc := norm_sub_le ((b.baseChange ℝ).equivFun x) + ((b.baseChange ℝ).equivFun (S.baseChange ℝ (φ.baseChange ℝ x - y))) + rw [← map_sub] at ht hc + have hdiff := ht.trans (add_le_add hp (le_refl ‖(c.baseChange ℝ).equivFun y‖)) + have hcorrect := hs.trans (mul_le_mul_of_nonneg_left hdiff + (by positivity : 0 ≤ ((Fintype.card κ : ℝ) + 1) * (K + 1))) + exact hc.trans (add_le_add (le_refl ‖(b.baseChange ℝ).equivFun x‖) hcorrect) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped Matrix TensorProduct NNReal + +variable {L μ κ : Type*} [LieRing L] [LieAlgebra ℚ L] + [Fintype μ] [Fintype κ] {E : Submodule ℚ L} + +theorem exists_bracketLiftMatrix_leftInverse [DecidableEq κ] (b : Basis μ ℚ L) (e : Basis κ ℚ E) + {H : ℕ} (hH : 1 ≤ H) (he : ∀ i j, RationalHeightLE (b.repr (e j : L) i) H) : + ∃ Q : Matrix κ μ ℚ, Q * bracketLiftMatrix b e = 1 ∧ + ∀ i j, RationalHeightLE (Q i j) (rationalSolveHeight (Fintype.card κ) H) := by + classical + let f : E →ₗ[ℚ] (μ → ℚ) := b.equivFun.toLinearMap.comp E.subtype + have hf : Function.Injective f := by + intro x y h + exact Subtype.ext (b.equivFun.injective h) + have hli : LinearIndependent ℚ (bracketLiftMatrix b e).col := + e.linearIndependent.map' f (LinearMap.ker_eq_bot.mpr hf) + exact exists_bounded_rational_left_inverse (bracketLiftMatrix b e) hli hH he + +noncomputable def realSubspaceCoordinateMap (b : Basis μ ℚ L) (Q : Matrix κ μ ℚ) : + (ℝ ⊗[ℚ] L) →ₗ[ℝ] (κ → ℝ) := + (Matrix.mulVecLin (fun i j => (Q i j : ℝ))).comp (b.baseChange ℝ).equivFun.toLinearMap + +omit [Fintype κ] in +@[simp] theorem realSubspaceCoordinateMap_apply (b : Basis μ ℚ L) (Q : Matrix κ μ ℚ) + (x : ℝ ⊗[ℚ] L) : + realSubspaceCoordinateMap b Q x = + (fun i j => (Q i j : ℝ)) *ᵥ (b.baseChange ℝ).equivFun x := rfl + +theorem realSubspaceCoordinateMap_lift [DecidableEq κ] (b : Basis μ ℚ L) (e : Basis κ ℚ E) + (Q : Matrix κ μ ℚ) (hQ : Q * bracketLiftMatrix b e = 1) (x : κ → ℝ) : + realSubspaceCoordinateMap b Q (bracketSystemLift e x) = x := by + classical + rw [realSubspaceCoordinateMap_apply, bracketSystemLift_coordinates] + change Q.map (Rat.castHom ℝ) *ᵥ ((bracketLiftMatrix b e).map (Rat.castHom ℝ) *ᵥ x) = x + rw [Matrix.mulVec_mulVec, real_matrix_right_inverse Q (bracketLiftMatrix b e) hQ, + Matrix.one_mulVec] + +theorem lift_realSubspaceCoordinateMap [DecidableEq κ] (b : Basis μ ℚ L) (e : Basis κ ℚ E) + (Q : Matrix κ μ ℚ) (hQ : Q * bracketLiftMatrix b e = 1) + (x : ℝ ⊗[ℚ] L) (hx : x ∈ E.baseChange ℝ) : + bracketSystemLift e (realSubspaceCoordinateMap b Q x) = x := by + obtain ⟨v, rfl⟩ := exists_subspace_basis_coordinates e x hx + rw [realSubspaceCoordinateMap_lift b e Q hQ] + +theorem realSubspaceCoordinateMap_norm (b : Basis μ ℚ L) (Q : Matrix κ μ ℚ) + {H : ℕ} (hQ : ∀ i j, RationalHeightLE (Q i j) H) (x : ℝ ⊗[ℚ] L) : + ‖realSubspaceCoordinateMap b Q x‖ ≤ + ((Fintype.card μ : ℝ) + 1) * (H + 1) * ‖(b.baseChange ℝ).equivFun x‖ := by + rw [realSubspaceCoordinateMap_apply] + exact norm_matrix_mulVec_le _ (H : ℝ≥0) (fun i j => (hQ i j).abs_real_le) _ + +theorem realSubspaceCoordinateMap_grid (b : Basis μ ℚ L) (Q : Matrix κ μ ℚ) + (l : ℕ) (x : ℝ ⊗[ℚ] L) (hx : (b.baseChange ℝ).equivFun x ∈ realDenominatorGrid l) : + realSubspaceCoordinateMap b Q x ∈ realDenominatorGrid (matrixDenominator Q * l) := by + rw [realSubspaceCoordinateMap_apply] + exact real_matrix_denominator_grid Q l _ hx + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealSupportedQuotientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealSupportedQuotientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..d247e2d137b915a25e26ad9eff1122d1876c5d69 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealSupportedQuotientCoordinates.lean @@ -0,0 +1,30 @@ +import OAI.Combinatorics.Progressions.Estimates.RealifiedMultidegree +import OAI.Combinatorics.Progressions.Linear.BasisGradedCoordinateBasis + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +variable {V ι : Type*} [AddCommGroup V] [Module ℚ V] + (b : Basis ι ℚ V) (P : Submodule ℚ V) (S : Set ι) + (hP : P = Submodule.span ℚ (b '' S)) + +theorem realSupportedQuotientBasis_repr_mk (x : ℝ ⊗[ℚ] V) (i : {i // i ∉ S}) : + ((supportedQuotientBasis b P S hP).baseChange ℝ).repr (P.mkQ.baseChange ℝ x) i = + (b.baseChange ℝ).repr x i := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy] + | tmul r x => + rw [LinearMap.baseChange_tmul, Basis.baseChange_repr_tmul, + Basis.baseChange_repr_tmul, supportedQuotientBasis_repr_mk] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedPairCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedPairCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb8b9b2a331073bfd97544305802b52774813dfd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedPairCoordinates.lean @@ -0,0 +1,45 @@ +import OAI.Combinatorics.Progressions.Nilpotent.BCHQuotientLocalIsometry + +namespace OAI + +section + +namespace Erdos3 + +open scoped TensorProduct + +variable {L : Type*} [AddCommGroup L] [Module ℚ L] + +noncomputable def realPairEquiv : + (ℝ ⊗[ℚ] (L × L)) ≃ₗ[ℝ] ((ℝ ⊗[ℚ] L) × (ℝ ⊗[ℚ] L)) := + TensorProduct.prodRight ℚ ℝ ℝ L L + +@[simp] theorem realPairEquiv_tmul (r : ℝ) (x : L × L) : + realPairEquiv (r ⊗ₜ[ℚ] x) = (r ⊗ₜ[ℚ] x.1, r ⊗ₜ[ℚ] x.2) := rfl + +theorem realPairEquiv_first (x : ℝ ⊗[ℚ] (L × L)) : + (realPairEquiv x).1 = (LinearMap.fst ℚ L L).baseChange ℝ x := by + induction x using TensorProduct.inductionOn with + | tmul r x => rfl + | add x y hx hy => simp only [map_add, Prod.fst_add, hx, hy] + +theorem realPairEquiv_second (x : ℝ ⊗[ℚ] (L × L)) : + (realPairEquiv x).2 = (LinearMap.snd ℚ L L).baseChange ℝ x := by + induction x using TensorProduct.inductionOn with + | tmul r x => rfl + | add x y hx hy => simp only [map_add, Prod.snd_add, hx, hy] + +theorem realPairEquiv_difference (q : ℚ) (x : ℝ ⊗[ℚ] (L × L)) : + scaledPairDifference q (realPairEquiv x) = + (scaledPairDifference (L := L) q).baseChange ℝ x := by + induction x using TensorProduct.inductionOn with + | tmul r x => + simp only [realPairEquiv_tmul, LinearMap.baseChange_tmul, scaledPairDifference_apply, + TensorProduct.tmul_sub, TensorProduct.tmul_smul] + | add x y hx hy => simp only [map_add, hx, hy] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedSquareCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedSquareCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fc686e4425f90de72fe33f077695932ebe49d2e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedSquareCoordinates.lean @@ -0,0 +1,67 @@ +import Mathlib.LinearAlgebra.TensorProduct.Prod +import OAI.Combinatorics.Progressions.Linear.SquareBasisGeometry + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) + +noncomputable def realifiedSquareEquiv : + (ℝ ⊗[ℚ] F.squareLieSubalgebra) ≃ₗ[ℚ] F.realification.squareLieSubalgebra := + let e := ((F.squareCoordinates.baseChange ℚ ℝ _ _).trans + (TensorProduct.prodRight ℚ ℝ ℝ L (F.layer 2))).trans + ((LinearEquiv.refl ℝ (ℝ ⊗[ℚ] L)).prodCongr (realificationSubmoduleEquiv (F.layer 2))) + (e.restrictScalars ℚ).trans F.realification.squareCoordinates.symm + +theorem realifiedSquareEquiv_tmul (r : ℝ) (x : F.squareLieSubalgebra) : + (F.realifiedSquareEquiv (r ⊗ₜ[ℚ] x)).val = + (r ⊗ₜ[ℚ] x.val.1, r ⊗ₜ[ℚ] x.val.2) := by + apply Prod.ext + · change r ⊗ₜ[ℚ] x.val.2 + r ⊗ₜ[ℚ] (x.val.1 - x.val.2) = r ⊗ₜ[ℚ] x.val.1 + rw [← TensorProduct.tmul_add] + congr 1 + abel + · rfl + +theorem realifiedSquareEquiv_fst (x : ℝ ⊗[ℚ] F.squareLieSubalgebra) : + F.realification.squareFst (F.realifiedSquareEquiv x) = realificationLieHom F.squareFst x := by + induction x using TensorProduct.inductionOn with + | tmul r x => exact congrArg Prod.fst (F.realifiedSquareEquiv_tmul r x) + | add x y hx hy => simp only [map_add, hx, hy] + +theorem realifiedSquareEquiv_snd (x : ℝ ⊗[ℚ] F.squareLieSubalgebra) : + F.realification.squareSnd (F.realifiedSquareEquiv x) = realificationLieHom F.squareSnd x := by + induction x using TensorProduct.inductionOn with + | tmul r x => exact congrArg Prod.snd (F.realifiedSquareEquiv_tmul r x) + | add x y hx hy => simp only [map_add, hx, hy] + +noncomputable def realifiedSquareLieEquiv : + (ℝ ⊗[ℚ] F.squareLieSubalgebra) ≃ₗ⁅ℚ⁆ F.realification.squareLieSubalgebra where + toFun := F.realifiedSquareEquiv + invFun := F.realifiedSquareEquiv.symm + left_inv := F.realifiedSquareEquiv.left_inv + right_inv := F.realifiedSquareEquiv.right_inv + map_add' := F.realifiedSquareEquiv.map_add + map_smul' := F.realifiedSquareEquiv.map_smul + map_lie' := by + intro x y + apply Subtype.ext + apply Prod.ext + · change F.realification.squareFst (F.realifiedSquareEquiv ⁅x, y⁆) = + F.realification.squareFst ⁅F.realifiedSquareEquiv x, F.realifiedSquareEquiv y⁆ + simp only [realifiedSquareEquiv_fst, LieHom.map_lie] + · change F.realification.squareSnd (F.realifiedSquareEquiv ⁅x, y⁆) = + F.realification.squareSnd ⁅F.realifiedSquareEquiv x, F.realifiedSquareEquiv y⁆ + simp only [realifiedSquareEquiv_snd, LieHom.map_lie] + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedSquareMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedSquareMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b8dda39acc4c1ae1a9b6f999149bef7656446c2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedSquareMetric.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Estimates.BoundedRealifiedSquareOrbit + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +variable {L ι κ : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype ι] [Fintype κ] {s : ℕ} + (F : NilpotentLieFiltration L s) + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] F.squareLieSubalgebra)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] F.squareLieSubalgebra)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] F.squareLieSubalgebra)] + [T2Space (ℝ ⊗[ℚ] F.squareLieSubalgebra)] + +theorem realSquareObservable_lipschitz (e : Basis ι ℚ L) (b : Basis κ ℚ F.squareLieSubalgebra) + (Γ : Subgroup F.Group) (l m H : ℕ) (hl : 0 < l) (hm : 0 < m) + (hΓ : bchSubgroupCoordinates e Γ ⊆ denominatorGrid l) + (hSq : bchSubgroupCoordinates b (F.squareLattice Γ) ⊆ denominatorGrid m) + (hfst : ∀ k i, RationalHeightLE (e.repr (F.squareFst (b i)) k) H) + (hsnd : ∀ k i, RationalHeightLE (e.repr (F.squareSnd (b i)) k) H) + (ε : F.realification.Group) (u : F.realification.Group ⧸ Γ.map realificationHom → ℂ) + (A K B : ℝ≥0) + (hε : letI := realificationQuotientMetricSpace e Γ l hl hΓ + LipschitzWith A (fun x : F.realification.Group ⧸ Γ.map realificationHom => ε • x)) + (hu : letI := realificationQuotientMetricSpace e Γ l hl hΓ; LipschitzWith K u) + (hb : ∀ x, ‖u x‖ ≤ B) : + let P := coordinateLipschitzBound (Fintype.card ι) (Fintype.card κ) H + letI := realificationQuotientMetricSpace b (F.squareLattice Γ) m hm hSq + LipschitzWith (B * (K * P) + B * (K * (A * P))) (F.realSquareObservable Γ ε u) := by + let := realificationQuotientMetricSpace e Γ l hl hΓ + let := realificationQuotientMetricSpace b (F.squareLattice Γ) m hm hSq + have hf := lipschitz_realificationMap_quotient b e F.squareFst (F.squareLattice Γ) Γ + (F.squareLattice_le_fst Γ) m l hm hl hSq hΓ H hfst + have hg := lipschitz_realificationMap_quotient b e F.squareSnd (F.squareLattice Γ) Γ + (F.squareLattice_le_snd Γ) m l hm hl hSq hΓ H hsnd + exact lipschitz_mul_star_of_bounds _ _ (hu.comp (hε.comp hf)) (hu.comp hg) + (fun x => hb _) (fun x => hb _) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedTripleCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedTripleCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c4da12b0e5cf3c3ba19d05b6c8c66adb709b992 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RealifiedTripleCoordinates.lean @@ -0,0 +1,146 @@ +import Mathlib.Algebra.Lie.Prod +import OAI.Combinatorics.Progressions.Nilpotent.BCHQuotientLocalIsometry + +namespace OAI + +section + +namespace Erdos3 + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] + +def tripleNeutral : (L × L × L) →ₗ[ℚ] L where + toFun x := x.2.1 + x.2.2 - x.1 + map_add' x y := by dsimp; abel + map_smul' r x := by simp [smul_add, smul_sub] + +def tripleLeft : (L × L × L) →ₗ[ℚ] L where + toFun x := x.1 - x.2.2 + map_add' x y := by dsimp; abel + map_smul' r x := by simp [smul_sub] + +def tripleRight : (L × L × L) →ₗ[ℚ] L where + toFun x := x.1 - x.2.1 + map_add' x y := by dsimp; abel + map_smul' r x := by simp [smul_sub] + +def tripleAssemble (a b c : L) : L × L × L := (a + b + c, a + b, a + c) + +@[simp] theorem tripleNeutral_assemble (a b c : L) : tripleNeutral (tripleAssemble a b c) = a := by + change a + b + (a + c) - (a + b + c) = a + abel + +@[simp] theorem tripleLeft_assemble (a b c : L) : tripleLeft (tripleAssemble a b c) = b := by + change a + b + c - (a + c) = b + abel + +@[simp] theorem tripleRight_assemble (a b c : L) : tripleRight (tripleAssemble a b c) = c := by + change a + b + c - (a + b) = c + abel + +theorem tripleAssemble_decompose (x : L × L × L) : + tripleAssemble (tripleNeutral x) (tripleLeft x) (tripleRight x) = x := by + apply Prod.ext + · change (x.2.1 + x.2.2 - x.1) + (x.1 - x.2.2) + (x.1 - x.2.1) = x.1 + abel + · apply Prod.ext + · change (x.2.1 + x.2.2 - x.1) + (x.1 - x.2.2) = x.2.1 + abel + · change (x.2.1 + x.2.2 - x.1) + (x.1 - x.2.1) = x.2.2 + abel + +omit [LieAlgebra ℚ L] in +theorem tripleAssemble_lie (a b c a' b' c' : L) + (hbb : ⁅b, b'⁆ = 0) (hbc : ⁅b, c'⁆ = 0) + (hcb : ⁅c, b'⁆ = 0) (hcc : ⁅c, c'⁆ = 0) : + ⁅tripleAssemble a b c, tripleAssemble a' b' c'⁆ = + tripleAssemble ⁅a, a'⁆ (⁅a, b'⁆ + ⁅b, a'⁆) (⁅a, c'⁆ + ⁅c, a'⁆) := by + apply Prod.ext + · change ⁅a + b + c, a' + b' + c'⁆ = _ + simp only [LieRing.add_lie, LieRing.lie_add, hbb, hbc, hcb, hcc, add_zero] + change _ = ⁅a, a'⁆ + (⁅a, b'⁆ + ⁅b, a'⁆) + (⁅a, c'⁆ + ⁅c, a'⁆) + abel + · apply Prod.ext + · change ⁅a + b, a' + b'⁆ = ⁅a, a'⁆ + (⁅a, b'⁆ + ⁅b, a'⁆) + simp only [LieRing.add_lie, LieRing.lie_add, hbb, add_zero] + abel + · change ⁅a + c, a' + c'⁆ = ⁅a, a'⁆ + (⁅a, c'⁆ + ⁅c, a'⁆) + simp only [LieRing.add_lie, LieRing.lie_add, hcc, add_zero] + abel + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped TensorProduct + +variable {L : Type*} [LieRing L] [LieAlgebra ℚ L] + +noncomputable def realTripleEquiv : + (ℝ ⊗[ℚ] (L × L × L)) ≃ₗ[ℝ] ((ℝ ⊗[ℚ] L) × (ℝ ⊗[ℚ] L) × (ℝ ⊗[ℚ] L)) := + (TensorProduct.prodRight ℚ ℝ ℝ L (L × L)).trans + ((LinearEquiv.refl ℝ (ℝ ⊗[ℚ] L)).prodCongr (TensorProduct.prodRight ℚ ℝ ℝ L L)) + +@[simp] theorem realTripleEquiv_tmul (r : ℝ) (x : L × L × L) : + realTripleEquiv (r ⊗ₜ[ℚ] x) = (r ⊗ₜ[ℚ] x.1, r ⊗ₜ[ℚ] x.2.1, r ⊗ₜ[ℚ] x.2.2) := rfl + +theorem realTripleEquiv_neutral (x : ℝ ⊗[ℚ] (L × L × L)) : + tripleNeutral (realTripleEquiv x) = + (tripleNeutral : (L × L × L) →ₗ[ℚ] L).baseChange ℝ x := by + induction x using TensorProduct.inductionOn with + | tmul r x => + simp only [realTripleEquiv_tmul, LinearMap.baseChange_tmul] + change r ⊗ₜ[ℚ] x.2.1 + r ⊗ₜ[ℚ] x.2.2 - r ⊗ₜ[ℚ] x.1 = + r ⊗ₜ[ℚ] (x.2.1 + x.2.2 - x.1) + rw [TensorProduct.tmul_sub, TensorProduct.tmul_add] + | add x y hx hy => simp only [map_add, hx, hy] + +theorem realTripleEquiv_left (x : ℝ ⊗[ℚ] (L × L × L)) : + tripleLeft (realTripleEquiv x) = + (tripleLeft : (L × L × L) →ₗ[ℚ] L).baseChange ℝ x := by + induction x using TensorProduct.inductionOn with + | tmul r x => + simp only [realTripleEquiv_tmul, LinearMap.baseChange_tmul] + change r ⊗ₜ[ℚ] x.1 - r ⊗ₜ[ℚ] x.2.2 = r ⊗ₜ[ℚ] (x.1 - x.2.2) + rw [TensorProduct.tmul_sub] + | add x y hx hy => simp only [map_add, hx, hy] + +theorem realTripleEquiv_right (x : ℝ ⊗[ℚ] (L × L × L)) : + tripleRight (realTripleEquiv x) = + (tripleRight : (L × L × L) →ₗ[ℚ] L).baseChange ℝ x := by + induction x using TensorProduct.inductionOn with + | tmul r x => + simp only [realTripleEquiv_tmul, LinearMap.baseChange_tmul] + change r ⊗ₜ[ℚ] x.1 - r ⊗ₜ[ℚ] x.2.1 = r ⊗ₜ[ℚ] (x.1 - x.2.1) + rw [TensorProduct.tmul_sub] + | add x y hx hy => simp only [map_add, hx, hy] + +theorem realTripleEquiv_first (x : ℝ ⊗[ℚ] (L × L × L)) : + (realTripleEquiv x).1 = realificationLieHom (LieHom.fst ℚ L (L × L)) x := by + induction x using TensorProduct.inductionOn with + | tmul r x => rfl + | add x y hx hy => simp only [map_add, Prod.fst_add, hx, hy] + +theorem realTripleEquiv_second (x : ℝ ⊗[ℚ] (L × L × L)) : + (realTripleEquiv x).2.1 = realificationLieHom + ((LieHom.fst ℚ L L).comp (LieHom.snd ℚ L (L × L))) x := by + induction x using TensorProduct.inductionOn with + | tmul r x => rfl + | add x y hx hy => simp only [map_add, Prod.fst_add, Prod.snd_add, hx, hy] + +theorem realTripleEquiv_third (x : ℝ ⊗[ℚ] (L × L × L)) : + (realTripleEquiv x).2.2 = realificationLieHom + ((LieHom.snd ℚ L L).comp (LieHom.snd ℚ L (L × L))) x := by + induction x using TensorProduct.inductionOn with + | tmul r x => rfl + | add x y hx hy => simp only [map_add, Prod.snd_add, hx, hy] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ReducedSquareCoefficientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ReducedSquareCoefficientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..8254222deeae9fc12b8407e05ad8049e11249c62 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ReducedSquareCoefficientCoordinates.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Estimates.FastCoefficientImage + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (e : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (e '' {i | j ≤ ω i})) (w : σ → ℕ) + +theorem reducedSquareDifference_basis_height (a : ReducedSquareBasisIndex s ω) (i : ι) : + RationalHeightLE (e.repr (F.reducedSquareDifference (F.reducedSquareBasis e ω hF a)) i) 1 := by + dsimp only [reducedSquareBasis] + rw [F.squareFiltration.quotientTopBasis_apply, F.reducedSquareDifference_mk] + rcases a with ⟨a, ha⟩ + cases a with + | inl j => + rw [F.adaptedSquareBasis_inl, sub_self, map_zero, Finsupp.zero_apply] + exact rationalHeightLE_zero le_rfl + | inr j => + rw [F.adaptedSquareBasis_inr, sub_zero] + exact basis_repr_height_one e j.val i + +theorem reducedSquareCoefficientMap_repr_symbol + (p : F.squareFiltration.quotientTop.adaptedLieSubalgebra w) (i : FirstCoefficientIndex w ω) : + (F.firstCoefficientBasis e ω hF w).repr + (F.reducedSquareCoefficientMap w (F.squareFiltration.quotientTop.polynomialSymbolMap w p)) i = + e.repr (F.reducedSquareDifference (coefficients p.val i.val.1)) i.val.2 := by + rw [F.reducedSquareCoefficientMap_symbol] + change (F.firstCoefficientBasis e ω hF w).repr + (F.firstCoefficientMap w ⟨(F.reducedSquareDifferenceRelative w p).val, _⟩) i = _ + rw [F.firstCoefficientBasis_repr_map, F.reducedSquareDifferenceRelative_coefficient] + +theorem reducedSquareCoefficientMap_basis_repr [DecidableEq σ] + (a : ReducedSquareSymbolIndex s w ω) (i : FirstCoefficientIndex w ω) : + (F.firstCoefficientBasis e ω hF w).repr + (F.reducedSquareCoefficientMap w (F.reducedSquareSymbolBasis e ω hF w a)) i = + if a.val.1 = i.val.1 then + e.repr (F.reducedSquareDifference (F.reducedSquareBasis e ω hF a.val.2)) i.val.2 else 0 := by + change (F.firstCoefficientBasis e ω hF w).repr + (F.reducedSquareCoefficientMap w + (F.squareFiltration.quotientTop.polynomialSymbolBasis (F.reducedSquareBasis e ω hF) + (fun j => squareBasisWeight ω j.val) (F.reducedSquareBasis_layers e ω hF) w a)) i = _ + rw [F.squareFiltration.quotientTop.polynomialSymbolBasis_apply, + F.reducedSquareCoefficientMap_repr_symbol, F.squareFiltration.quotientTop.adaptedMonomialBasis_coe, + coefficients_monomial] + by_cases hai : a.val.1 = i.val.1 + · simp only [hai, Finsupp.single_eq_same, ite_true] + · rw [Finsupp.single_eq_of_ne (Ne.symm hai), map_zero, map_zero, + Finsupp.zero_apply, ite_eq_right hai] + +theorem reducedSquareCoefficientMap_basis_height + (a : ReducedSquareSymbolIndex s w ω) (i : FirstCoefficientIndex w ω) : + RationalHeightLE ((F.firstCoefficientBasis e ω hF w).repr + (F.reducedSquareCoefficientMap w (F.reducedSquareSymbolBasis e ω hF w a)) i) 1 := by + classical + rw [F.reducedSquareCoefficientMap_basis_repr] + split_ifs + · exact F.reducedSquareDifference_basis_height e ω hF a.val.2 i.val.2 + · exact rationalHeightLE_zero le_rfl + +theorem reducedSquareCoefficientMap_monomial_blocks + (a : ReducedSquareSymbolIndex s w ω) (i : FirstCoefficientIndex w ω) (hai : i.val.1 ≠ a.val.1) : + (F.firstCoefficientBasis e ω hF w).repr + (F.reducedSquareCoefficientMap w (F.reducedSquareSymbolBasis e ω hF w a)) i = 0 := by + classical + rw [F.reducedSquareCoefficientMap_basis_repr, ite_eq_right (Ne.symm hai)] + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchBoxRestriction.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchBoxRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0b7ea585b1776016f8b394082d955e0734af2a6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchBoxRestriction.lean @@ -0,0 +1,85 @@ +import OAI.Combinatorics.Progressions.Estimates.RelativePatchAmplification + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical + +noncomputable def relativeBoxInput {X : Type*} [Fintype X] + (N : X → ℕ) (f : (X → ℤ) → ℝ) (x : X → ℤ) : ℝ := + if x ∈ integerBox N then f x else 0 + +@[simp] theorem relativeBoxInput_eq {X : Type*} [Fintype X] + (N : X → ℕ) (f : (X → ℤ) → ℝ) {x : X → ℤ} (hx : x ∈ integerBox N) : + relativeBoxInput N f x = f x := by + simp only [relativeBoxInput, ite_eq_left hx] + +theorem relativeBoxInput_unitInterval {X : Type*} [Fintype X] + (N : X → ℕ) (f : (X → ℤ) → ℝ) + (hf : ∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) : + ∀ x, relativeBoxInput N f x ∈ Set.Icc (0 : ℝ) 1 := by + intro x + by_cases hx : x ∈ integerBox N + · simpa only [relativeBoxInput_eq N f hx] using hf x hx + · simp only [relativeBoxInput, ite_eq_right hx, Set.mem_Icc] + constructor <;> norm_num + +theorem relativeBoxInput_signed_norm {X : Type*} [Fintype X] + (N : X → ℕ) (f : (X → ℤ) → ℝ) + (hf : ∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) + {lam : ℝ} (hlam : lam ∈ Set.Icc (0 : ℝ) 1) (x : X → ℤ) : + ‖((relativeBoxInput N f x - lam : ℝ) : ℂ)‖ ≤ 1 := by + rw [Complex.norm_real, Real.norm_eq_abs, abs_le] + have hx := relativeBoxInput_unitInterval N f hf x + constructor <;> linarith only [hx.1, hx.2, hlam.1, hlam.2] + +theorem relativeBoxInput_progressionFree {X : Type*} [Fintype X] + (N : X → ℕ) (f : (X → ℤ) → ℝ) {k : ℕ} + (hfree : IntegerVectorAPFree {x | x ∈ integerBox N ∧ f x ≠ 0} k) : + IntegerVectorAPFree {x | x ∈ integerBox N ∧ relativeBoxInput N f x ≠ 0} k := by + convert hfree using 1 + ext x + constructor + · rintro ⟨hx, h⟩ + exact ⟨hx, by simpa only [relativeBoxInput_eq N f hx] using h⟩ + · rintro ⟨hx, h⟩ + exact ⟨hx, by simpa only [relativeBoxInput_eq N f hx] using h⟩ + +theorem relativePatchBoxScore_congr_input {X : Type*} [Fintype X] [DecidableEq X] + {s d : ℕ} (N : X → ℕ) {f g : (X → ℤ) → ℝ} + (hfg : ∀ x ∈ integerBox N, f x = g x) (target : ℝ) (A : PolynomialPatch X s d) : + relativePatchBoxScore N f target A = relativePatchBoxScore N g target A := by + apply Finset.expect_congr rfl + intro x hx + rw [hfg x hx] + +theorem relativePatchSliceScore_congr_input {X : Type*} [Fintype X] + {s d q : ℕ} {N : X → ℕ} (S : ResidueBoxSlice N q) + {f g : (X → ℤ) → ℝ} (hfg : ∀ x ∈ integerBox N, f x = g x) + (target : ℝ) (A : PolynomialPatch X s d) : + relativePatchSliceScore S f target A = relativePatchSliceScore S g target A := by + apply Finset.expect_congr rfl + intro x _ + have hx : (fun i => ((S.point x i).val : ℤ)) ∈ integerBox N := by + rw [mem_integerBox] + intro i + exact ⟨by positivity, by exact_mod_cast (S.point x i).isLt⟩ + rw [hfg _ hx] + +theorem RelativePatchSliceConclusion.congr_input {X : Type*} [Fintype X] + {s : ℕ} {N : X → ℕ} {f g : (X → ℤ) → ℝ} + {target cost : ℝ} {rankBound : ℕ} + (h : RelativePatchSliceConclusion s N f target rankBound cost) + (hfg : ∀ x ∈ integerBox N, f x = g x) : + RelativePatchSliceConclusion s N g target rankBound cost := by + obtain ⟨q, hq, S, d, A, hlength, hrank, hcost, hscore⟩ := h + refine ⟨q, hq, S, d, A, hlength, hrank, hcost, ?_⟩ + rwa [relativePatchSliceScore_congr_input S hfg target A] at hscore + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchFiniteCoordinateReduction.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchFiniteCoordinateReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba199b0219fff9495c20195432b4043e9cd67b69 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchFiniteCoordinateReduction.lean @@ -0,0 +1,153 @@ +import OAI.Combinatorics.Progressions.Lattices.IntegerBoxCoordinateEquiv + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +namespace PolynomialPatch + +variable {X Y : Type*} {s d : ℕ} + +noncomputable def coordinateEquiv (A : PolynomialPatch X s d) (e : X ≃ Y) : + PolynomialPatch Y s d := + A.reparam (fun i => MvPolynomial.X (e i)) (fun i => weightedSupportLE_X _ (e i)) + +@[simp] theorem coordinateEquiv_kernel (A : PolynomialPatch X s d) (e : X ≃ Y) : + (A.coordinateEquiv e).kernel = A.kernel := rfl + +@[simp] theorem coordinateEquiv_weight (A : PolynomialPatch X s d) (e : X ≃ Y) : + (A.coordinateEquiv e).weight = A.weight := rfl + +@[simp] theorem coordinateEquiv_complexity (A : PolynomialPatch X s d) (e : X ≃ Y) : + relativePatchComplexity (A.coordinateEquiv e) = relativePatchComplexity A := rfl + +@[simp] theorem coordinateEquiv_distinctWeights (A : PolynomialPatch X s d) (e : X ≃ Y) : + relativePatchDistinctWeights (A.coordinateEquiv e) = relativePatchDistinctWeights A := rfl + +theorem coordinateEquiv_value (A : PolynomialPatch X s d) (e : X ≃ Y) (y : Y → ℝ) : + (A.coordinateEquiv e).value y = A.value (fun i => y (e i)) := by + rw [coordinateEquiv, reparam_value] + simp only [MvPolynomial.aeval_X] + +end PolynomialPatch + +theorem relativePatchBoxScore_coordinateEquiv + {X Y : Type*} [Fintype X] [DecidableEq X] [Fintype Y] [DecidableEq Y] + {s d : ℕ} (e : X ≃ Y) (N : X → ℕ) (f : (X → ℤ) → ℝ) + (target : ℝ) (A : PolynomialPatch X s d) : + relativePatchBoxScore (coordinateReindexedSides e N) (coordinateReindexedFunction e f) + target (A.coordinateEquiv e) = relativePatchBoxScore N f target A := by + unfold relativePatchBoxScore + simp only [PolynomialPatch.coordinateEquiv_value] + exact coordinateReindexedFunction_expect e N + (fun x => (f x - target) * A.value (fun i => (x i : ℝ))) + +namespace ResidueBoxSlice + +variable {X Y : Type*} {N : X → ℕ} {q : ℕ} + +def coordinateReturn (e : X ≃ Y) (S : ResidueBoxSlice (coordinateReindexedSides e N) q) : + ResidueBoxSlice N q where + start i := S.start (e i) + length i := S.length (e i) + inside i j hj := by + simpa only [coordinateReindexedSides, Equiv.symm_apply_apply] using S.inside (e i) j hj + +theorem coordinateReturn_score [Fintype X] [DecidableEq X] [Fintype Y] [DecidableEq Y] + {s d : ℕ} (e : X ≃ Y) (S : ResidueBoxSlice (coordinateReindexedSides e N) q) + (f : (X → ℤ) → ℝ) (target : ℝ) (A : PolynomialPatch Y s d) : + relativePatchSliceScore (S.coordinateReturn e) f target (A.coordinateEquiv e.symm) = + relativePatchSliceScore S (coordinateReindexedFunction e f) target A := by + rw [← relativePatchBoxScore_pullback, ← relativePatchBoxScore_pullback] + have h := relativePatchBoxScore_coordinateEquiv e.symm S.length + (S.integerPullback (coordinateReindexedFunction e f)) target A + convert h using 1 + congr 1 + funext x + simp only [coordinateReindexedFunction, integerPullback, integerAffine, + coordinateReturn, Equiv.symm_apply_apply] + rfl + +end ResidueBoxSlice + +theorem RelativePatchSliceConclusion.coordinateReturn + {X Y : Type*} [Fintype X] [DecidableEq X] [Fintype Y] [DecidableEq Y] + {s rankBound : ℕ} {N : X → ℕ} {f : (X → ℤ) → ℝ} {target cost : ℝ} + (e : X ≃ Y) + (h : RelativePatchSliceConclusion s (coordinateReindexedSides e N) + (coordinateReindexedFunction e f) target rankBound cost) : + RelativePatchSliceConclusion s N f target rankBound cost := by + obtain ⟨q, hq, S, d, A, hlength, hd, hcomplexity, hscore⟩ := h + refine ⟨q, hq, S.coordinateReturn e, d, A.coordinateEquiv e.symm, ?_, + hd, hcomplexity, ?_⟩ + · intro i + simpa only [coordinateReindexedSides, ResidueBoxSlice.coordinateReturn, + Equiv.symm_apply_apply] using hlength (e i) + · rwa [ResidueBoxSlice.coordinateReturn_score] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def RelativePatchFinInductionRule (s n₀ stage : ℕ) (τ : ℝ) + (cutoff cost : ℝ → ℝ) : Prop := + ∀ (p a Λ : ℝ) (d₀ : ℕ), 2 ≤ p → Real.exp (-p) ≤ a → a ≤ Λ → Λ ≤ 1 → + RelativePatchAbsoluteRule s n₀ p a Λ d₀ → + ∀ (n : ℕ), 0 < n → (n : ℝ) ≤ p → + ∀ (N : Fin n → ℕ), (∀ i, Real.exp (cutoff p) ≤ (N i : ℝ)) → + ∀ (f : (Fin n → ℤ) → ℝ), + (∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) → + IntegerVectorAPFree {x | x ∈ integerBox N ∧ f x ≠ 0} (s + 2) → + ∀ (d : ℕ) (A : PolynomialPatch (Fin n) s d), + relativePatchComplexity A ≤ p → relativePatchDistinctWeights A ≤ stage → + Real.exp (-p) ≤ relativePatchBoxScore N f a A → + RelativePatchSliceConclusion s N f ((1 - τ) ^ (stage + 1) * Λ) + (d₀ + s * d) (cost p) + +theorem RelativePatchFinInductionRule.to_general + {s n₀ stage : ℕ} {τ : ℝ} {cutoff cost : ℝ → ℝ} + (hfin : RelativePatchFinInductionRule s n₀ stage τ cutoff cost) : + RelativePatchInductionRule s n₀ stage τ cutoff cost := by + intro p a Λ d₀ hp ha haΛ hΛ habsolute X _ _ _ hX N hN f hf hfree d A hA hstage hscore + let e : X ≃ Fin (Fintype.card X) := Fintype.equivFin X + have hN' : ∀ i, Real.exp (cutoff p) ≤ (coordinateReindexedSides e N i : ℝ) := + fun i => hN (e.symm i) + have hscore' : Real.exp (-p) ≤ relativePatchBoxScore (coordinateReindexedSides e N) + (coordinateReindexedFunction e f) a (A.coordinateEquiv e) := by + rwa [relativePatchBoxScore_coordinateEquiv] + exact (hfin p a Λ d₀ hp ha haΛ hΛ habsolute (Fintype.card X) Fintype.card_pos hX + (coordinateReindexedSides e N) hN' (coordinateReindexedFunction e f) + (coordinateReindexedFunction_bounds e N f hf) + (coordinateReindexedFunction_apFree e N f hfree) + d (A.coordinateEquiv e) hA hstage hscore').coordinateReturn e + +theorem RelativePatchInductionRule.to_fin + {s n₀ stage : ℕ} {τ : ℝ} {cutoff cost : ℝ → ℝ} + (h : RelativePatchInductionRule s n₀ stage τ cutoff cost) : + RelativePatchFinInductionRule s n₀ stage τ cutoff cost := by + intro p a Λ d₀ hp ha haΛ hΛ habsolute n hn hnp N hN f hf hfree d A hA hstage hscore + let : NeZero n := ⟨Nat.ne_of_gt hn⟩ + exact h p a Λ d₀ hp ha haΛ hΛ habsolute (Fin n) (by simpa using hnp) + N hN f hf hfree d A hA hstage hscore + +theorem relativePatchInductionRule_iff_fin + (s n₀ stage : ℕ) (τ : ℝ) (cutoff cost : ℝ → ℝ) : + RelativePatchInductionRule s n₀ stage τ cutoff cost ↔ + RelativePatchFinInductionRule s n₀ stage τ cutoff cost := + ⟨RelativePatchInductionRule.to_fin, RelativePatchFinInductionRule.to_general⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchStageTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchStageTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce3cb24405081bf9acd63578c15dcdd6b5601890 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchStageTransport.lean @@ -0,0 +1,88 @@ +import OAI.Combinatorics.Progressions.Estimates.RelativePatchAmplification + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem relativePatchSliceScore_antitone {X : Type*} [Fintype X] {s d q : ℕ} + {N : X → ℕ} (S : ResidueBoxSlice N q) (f : (X → ℤ) → ℝ) + (A : PolynomialPatch X s d) {target target' : ℝ} (h : target' ≤ target) : + relativePatchSliceScore S f target A ≤ relativePatchSliceScore S f target' A := by + apply Finset.expect_le_expect + intro x _ + exact mul_le_mul_of_nonneg_right (sub_le_sub_left h _) + (A.value_mem_Icc (fun i => ((x i).val : ℝ))).1 + +theorem RelativePatchSliceConclusion.target_mono {X : Type*} [Fintype X] + {s : ℕ} {N : X → ℕ} {f : (X → ℤ) → ℝ} {target target' cost : ℝ} {D : ℕ} + (h : RelativePatchSliceConclusion s N f target D cost) (htarget : target' ≤ target) : + RelativePatchSliceConclusion s N f target' D cost := by + obtain ⟨q, hq, S, d, A, hlength, hd, hcomplexity, hscore⟩ := h + exact ⟨q, hq, S, d, A, hlength, hd, hcomplexity, + hscore.trans (relativePatchSliceScore_antitone S f A htarget)⟩ + +theorem RelativePatchSliceConclusion.later_stage_target {X : Type*} [Fintype X] + {s stage stage' D : ℕ} {N : X → ℕ} {f : (X → ℤ) → ℝ} {τ Λ cost : ℝ} + (h : RelativePatchSliceConclusion s N f ((1 - τ) ^ (stage + 1) * Λ) D cost) + (hτ : τ ∈ Set.Icc (0 : ℝ) 1) (hΛ : 0 ≤ Λ) (hstage : stage ≤ stage') : + RelativePatchSliceConclusion s N f ((1 - τ) ^ (stage' + 1) * Λ) D cost := by + apply h.target_mono + exact mul_le_mul_of_nonneg_right + (pow_le_pow_of_le_one (sub_nonneg.mpr hτ.2) (by linarith [hτ.1]) + (Nat.add_le_add_right hstage 1)) hΛ + +theorem RelativePatchSliceConclusion.prescribed_discount {X : Type*} [Fintype X] + {s stage D : ℕ} {N : X → ℕ} {f : (X → ℤ) → ℝ} {τ ε Λ cost : ℝ} + (h : RelativePatchSliceConclusion s N f ((1 - τ) ^ (stage + 1) * Λ) D cost) + (hτ : τ ∈ Set.Icc (0 : ℝ) 1) (hΛ : 0 ≤ Λ) (hstage : stage ≤ s) + (hbudget : ((s + 1 : ℕ) : ℝ) * τ ≤ ε) : + RelativePatchSliceConclusion s N f ((1 - ε) * Λ) D cost := + h.target_mono (recursive_density_discount_scaled hΛ hτ + (Nat.add_le_add_right hstage 1) hbudget) + +theorem RelativePatchInductionRule.apply_later_discount + {s n₀ stage stage' : ℕ} {τ : ℝ} {cutoff cost : ℝ → ℝ} + (h : RelativePatchInductionRule s n₀ stage τ cutoff cost) + (hτ : τ ∈ Set.Icc (0 : ℝ) 1) (hstages : stage ≤ stage') + (p a Λ : ℝ) (d₀ : ℕ) (hp : 2 ≤ p) (ha : Real.exp (-p) ≤ a) + (haΛ : a ≤ Λ) (hΛ : Λ ≤ 1) (habsolute : RelativePatchAbsoluteRule s n₀ p a Λ d₀) + (X : Type) [Fintype X] [DecidableEq X] [Nonempty X] + (hX : (Fintype.card X : ℝ) ≤ p) (N : X → ℕ) + (hN : ∀ i, Real.exp (cutoff p) ≤ (N i : ℝ)) + (f : (X → ℤ) → ℝ) (hf : ∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) + (hfree : IntegerVectorAPFree {x | x ∈ integerBox N ∧ f x ≠ 0} (s + 2)) + (d : ℕ) (A : PolynomialPatch X s d) (hA : relativePatchComplexity A ≤ p) + (hstage : relativePatchDistinctWeights A ≤ stage) + (hscore : Real.exp (-p) ≤ relativePatchBoxScore N f a A) : + RelativePatchSliceConclusion s N f ((1 - τ) ^ (stage' + 1) * Λ) + (d₀ + s * d) (cost p) := + (h p a Λ d₀ hp ha haΛ hΛ habsolute X hX N hN f hf hfree d A hA hstage hscore).later_stage_target + hτ (((Real.exp_pos (-p)).le.trans ha).trans haΛ) hstages + +theorem RelativePatchInductionRule.apply_all_weights_discount + {s n₀ : ℕ} {τ ε : ℝ} {cutoff cost : ℝ → ℝ} + (h : RelativePatchInductionRule s n₀ s τ cutoff cost) + (hτ : τ ∈ Set.Icc (0 : ℝ) 1) (hbudget : ((s + 1 : ℕ) : ℝ) * τ ≤ ε) + (p a Λ : ℝ) (d₀ : ℕ) (hp : 2 ≤ p) (ha : Real.exp (-p) ≤ a) + (haΛ : a ≤ Λ) (hΛ : Λ ≤ 1) (habsolute : RelativePatchAbsoluteRule s n₀ p a Λ d₀) + (X : Type) [Fintype X] [DecidableEq X] [Nonempty X] + (hX : (Fintype.card X : ℝ) ≤ p) (N : X → ℕ) + (hN : ∀ i, Real.exp (cutoff p) ≤ (N i : ℝ)) + (f : (X → ℤ) → ℝ) (hf : ∀ x ∈ integerBox N, f x ∈ Set.Icc (0 : ℝ) 1) + (hfree : IntegerVectorAPFree {x | x ∈ integerBox N ∧ f x ≠ 0} (s + 2)) + (d : ℕ) (A : PolynomialPatch X s d) (hA : relativePatchComplexity A ≤ p) + (hscore : Real.exp (-p) ≤ relativePatchBoxScore N f a A) : + RelativePatchSliceConclusion s N f ((1 - ε) * Λ) (d₀ + s * d) (cost p) := + (h p a Λ d₀ hp ha haΛ hΛ habsolute X hX N hN f hf hfree d A hA + (relativePatchDistinctWeights_le_degree A) hscore).prescribed_discount + hτ (((Real.exp_pos (-p)).le.trans ha).trans haΛ) (le_refl s) hbudget + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchWholeBoxConclusion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchWholeBoxConclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c4fb0fa83ede6910c13deac693f55b1bb11fd6c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RelativePatchWholeBoxConclusion.lean @@ -0,0 +1,119 @@ +import OAI.Combinatorics.Progressions.Lattices.ResidueBoxSliceCoordinateDisintegration + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +namespace ResidueBoxSlice + +abbrev wholeBox {X : Type*} (N : X → ℕ) : ResidueBoxSlice N 1 where + start _ := 0 + length := N + inside _ _ hj := by simpa using hj + +@[simp] theorem wholeBox_point {X : Type*} (N : X → ℕ) + (x : ∀ i, Fin (N i)) : (wholeBox N).point x = x := by + funext i + apply Fin.ext + simp [wholeBox, point] + +@[simp] theorem wholeBox_integerPoint {X : Type*} (N : X → ℕ) + (x : ∀ i, Fin (N i)) : + (wholeBox N).integerPoint x = fun i => ((x i).val : ℤ) := by + funext i + change ((0 + 1 * (x i).val : ℕ) : ℤ) = ((x i).val : ℤ) + simp + +@[simp] theorem wholeBox_integerPoints {X : Type*} [Fintype X] [DecidableEq X] + (N : X → ℕ) : (wholeBox N).integerPoints = integerBox N := by + classical + ext x + constructor + · intro hx + obtain ⟨j, _, rfl⟩ := Finset.mem_image.mp hx + rw [wholeBox_integerPoint, mem_integerBox] + intro i + exact ⟨by positivity, by exact_mod_cast (j i).isLt⟩ + · intro hx + have hx' := (mem_integerBox N x).mp hx + let j : ∀ i, Fin (N i) := fun i => ⟨(x i).toNat, by + have hi := hx' i + omega⟩ + refine Finset.mem_image.mpr ⟨j, Finset.mem_univ _, ?_⟩ + rw [wholeBox_integerPoint] + funext i + exact Int.toNat_of_nonneg (hx' i).1 + +end ResidueBoxSlice + +@[simp] theorem relativePatchSliceScore_wholeBox {X : Type*} + [Fintype X] [DecidableEq X] {s d : ℕ} + (N : X → ℕ) (f : (X → ℤ) → ℝ) (target : ℝ) + (A : PolynomialPatch X s d) : + relativePatchSliceScore (ResidueBoxSlice.wholeBox N) f target A = + relativePatchBoxScore N f target A := by + have h := (ResidueBoxSlice.wholeBox N).expect_integerPoints (by decide : 0 < 1) + (fun x => (f x - target) * A.value (fun i => (x i : ℝ))) + rw [ResidueBoxSlice.wholeBox_integerPoints] at h + simp only [ResidueBoxSlice.wholeBox_integerPoint, Int.cast_natCast] at h + simp only [relativePatchSliceScore, relativePatchBoxScore, + ResidueBoxSlice.wholeBox_point] + convert h.symm using 1 + apply Finset.expect_congr + · ext x + simp + · intro x _ + rfl + +theorem relativePatchSliceConclusion_of_boxScore {X : Type*} + [Fintype X] [DecidableEq X] {s d : ℕ} + (N : X → ℕ) (f : (X → ℤ) → ℝ) (target cost : ℝ) + (A : PolynomialPatch X s d) (hcost : 0 ≤ cost) + (hcomplexity : relativePatchComplexity A ≤ cost) + (hscore : Real.exp (-cost) ≤ relativePatchBoxScore N f target A) : + RelativePatchSliceConclusion s N f target d cost := by + refine ⟨1, by decide, ResidueBoxSlice.wholeBox N, d, A, ?_, le_rfl, + hcomplexity, ?_⟩ + · intro i + change Real.exp (-cost) * (N i : ℝ) ≤ (N i : ℝ) + exact mul_le_of_le_one_left (Nat.cast_nonneg _) (Real.exp_le_one_iff.mpr (by linarith)) + · simpa only [relativePatchSliceScore_wholeBox] using hscore + +theorem relativePatchBoxScore_eq_subtype {X : Type*} + [Fintype X] [DecidableEq X] {s d : ℕ} + (N : X → ℕ) (f : (X → ℤ) → ℝ) (target : ℝ) + (A : PolynomialPatch X s d) : + relativePatchBoxScore N f target A = + (𝔼 x : ↥(integerBox N), (f x.val - target) * A.value (fun i => (x.val i : ℝ))) := by + classical + symm + apply Finset.expect_nbij (fun x : ↥(integerBox N) => x.val) + · intro x _ + exact x.property + · intro x _ + rfl + · intro x _ y _ h + exact Subtype.ext h + · intro x hx + exact ⟨⟨x, hx⟩, Finset.mem_univ _, rfl⟩ + +theorem relativePatchSliceConclusion_of_subtypeScore {X : Type*} + [Fintype X] [DecidableEq X] {s d : ℕ} + (N : X → ℕ) (f : (X → ℤ) → ℝ) (target cost : ℝ) + (A : PolynomialPatch X s d) (hcost : 0 ≤ cost) + (hcomplexity : relativePatchComplexity A ≤ cost) + (hscore : Real.exp (-cost) ≤ + (𝔼 x : ↥(integerBox N), (f x.val - target) * A.value (fun i => (x.val i : ℝ)))) : + RelativePatchSliceConclusion s N f target d cost := by + apply relativePatchSliceConclusion_of_boxScore N f target cost A hcost hcomplexity + simpa only [relativePatchBoxScore_eq_subtype] using hscore + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RepresentativeWindowTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RepresentativeWindowTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..80f3de1c025c2c9d741908ae6ec9de9dc769b252 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RepresentativeWindowTransport.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Estimates.RepresentativeWindowPatch +import OAI.Combinatorics.Progressions.Lattices.CRTIntegerRepresentative +import OAI.Combinatorics.Progressions.Lattices.IntegerRepresentativeFraction + +namespace OAI + +section + +namespace Erdos3.RepresentativeWindow + +open MvPolynomial +open scoped BigOperators + +theorem patch_weighted_value {σ : Type*} {N : ℕ} [NeZero N] + (w : RepresentativeWindow) (s : ℕ) (hs : 1 ≤ s) + (P : MvPolynomial σ ℝ) (hP : P ∈ weightedSupportLE (fun _ => 1) 1) + (t : σ → ℝ) (a : ℤ) (he : aeval t P = (a : ℝ) / N) (F : ℤ → ℝ) : + (∑' b : Fin 1 → ℤ, (w.patch s hs P hP).kernel.value + (((w.patch s hs P hP).form.slots t).residual b) * F (a - (N : ℤ) * b 0)) = + w.value (((a : ZMod N).val : ℝ) / N) * F ((a : ZMod N).val) := by + have hterm (b : Fin 1 → ℤ) : + (w.patch s hs P hP).kernel.value (((w.patch s hs P hP).form.slots t).residual b) * + F (a - (N : ℤ) * b 0) = + (w.patch s hs P hP).kernel.value (((w.patch s hs P hP).form.slots t).residual b) * + F ((a : ZMod N).val) := by + by_cases hb : (w.patch s hs P hP).kernel.value + (((w.patch s hs P hP).form.slots t).residual b) = 0 + · simp only [hb, zero_mul] + · rw [w.patch_contributing_lift s hs P hP t b hb, he, integer_sub_floor_eq_zmod_val] + simp_rw [hterm] + rw [tsum_mul_right] + change (w.patch s hs P hP).value t * F ((a : ZMod N).val) = _ + rw [w.patch_value s hs P hP t, he, integer_fraction_eq_zmod_val] + +variable {J : Type*} [Fintype J] [DecidableEq J] (N : J → ℕ) + [NeZero (∏ j, N j)] (hN : Pairwise (fun i j => Nat.Coprime (N i) (N j))) + +noncomputable def crtPatch (w : RepresentativeWindow) (s : ℕ) (hs : 1 ≤ s) : + PolynomialPatch J s 1 := + w.patch s hs (crtRepresentativePolynomial N hN) (crtRepresentativePolynomial_degree N hN) + +theorem crtPatch_value (w : RepresentativeWindow) (s : ℕ) (hs : 1 ≤ s) (u : J → ℤ) : + (w.crtPatch N hN s hs).value (fun j => (u j : ℝ)) = + w.value ((((ZMod.prodEquivPi N hN).symm (fun j => (u j : ZMod (N j)))).val : ℝ) / + (∏ j, N j : ℕ)) := by + rw [crtPatch, w.patch_value, crtRepresentativePolynomial_eval, + integer_fraction_eq_zmod_val, crtIntegerRepresentative_cast] + +theorem crtPatch_value_residues [∀ j, NeZero (N j)] (w : RepresentativeWindow) + (s : ℕ) (hs : 1 ≤ s) (u : (j : J) → ZMod (N j)) : + (w.crtPatch N hN s hs).value (fun j => ((u j).val : ℝ)) = + w.value ((((ZMod.prodEquivPi N hN).symm u).val : ℝ) / (∏ j, N j : ℕ)) := by + have h := w.crtPatch_value N hN s hs (fun j => ((u j).val : ℤ)) + simpa only [Int.cast_natCast, ZMod.natCast_zmod_val] using h + +theorem crtPatch_weighted_value (w : RepresentativeWindow) (s : ℕ) (hs : 1 ≤ s) + (u : J → ℤ) (F : ℤ → ℝ) : + (∑' b : Fin 1 → ℤ, (w.crtPatch N hN s hs).kernel.value + (((w.crtPatch N hN s hs).form.slots (fun j => (u j : ℝ))).residual b) * + F (crtIntegerRepresentative N hN u - (∏ j, N j : ℕ) * b 0)) = + w.value ((((ZMod.prodEquivPi N hN).symm (fun j => (u j : ZMod (N j)))).val : ℝ) / + (∏ j, N j : ℕ)) * + F (((ZMod.prodEquivPi N hN).symm (fun j => (u j : ZMod (N j)))).val) := by + have h := w.patch_weighted_value s hs (crtRepresentativePolynomial N hN) + (crtRepresentativePolynomial_degree N hN) (fun j => (u j : ℝ)) + (crtIntegerRepresentative N hN u) (crtRepresentativePolynomial_eval N hN u) F + simpa only [crtIntegerRepresentative_cast, crtPatch] using h + +omit [NeZero (∏ j, N j)] in +@[simp] theorem crtPatch_lip (w : RepresentativeWindow) (s : ℕ) (hs : 1 ≤ s) : + (w.crtPatch N hN s hs).kernel.lip = w.lip := rfl + +end Erdos3.RepresentativeWindow + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedChartPrefixControl.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedChartPrefixControl.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ecf4b78fdb02bddc759a728d2c667e7b715ad84 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedChartPrefixControl.lean @@ -0,0 +1,575 @@ +import OAI.Combinatorics.Progressions.Dynamics.RestrictedSymbolGradeIteration +import OAI.Combinatorics.Progressions.Polynomial.MajorPhaseCoordinateDenominator + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped TensorProduct + +theorem substitute_weightedHomogeneousPart + {σ τ R V : Type*} [CommRing R] [AddCommGroup V] [Module R V] + (w : σ → ℕ) (v : τ → ℕ) (f : σ → MvPolynomial τ R) + (hf : ∀ i, (f i).IsWeightedHomogeneous v (w i)) + (d : ℕ) (p : VectorPolynomial σ R V) : + substitute f (weightedHomogeneousPart w d p) = + weightedHomogeneousPart v d (substitute f p) := by + induction p using TensorProduct.inductionOn with + | tmul P x => + rw [weightedHomogeneousPart_tmul, substitute_tmul, substitute_tmul, + weightedHomogeneousPart_tmul, aeval_weightedHomogeneousComponent w v f hf] + | add p q hp hq => simp only [map_add, hp, hq] + +variable {σ τ V : Type*} [AddCommGroup V] [Module ℚ V] [Module ℝ V] + [IsScalarTower ℚ ℝ V] + +theorem realChartSubstitute_map + {W : Type*} [AddCommGroup W] [Module ℚ W] [Module ℝ W] [IsScalarTower ℚ ℝ W] + (f : σ → MvPolynomial τ ℝ) (S : V →ₗ[ℝ] W) (p : VectorPolynomial σ ℚ V) : + realChartSubstitute f (map (S.restrictScalars ℚ) p) = + map (S.restrictScalars ℚ) (realChartSubstitute f p) := by + have hmap : realCoefficientEquiv (map (S.restrictScalars ℚ) p) = + map S (realCoefficientEquiv p) := by + apply coefficients.injective + ext α + simp only [coefficients_realCoefficientEquiv, coefficients_map, + LinearMap.restrictScalars_apply] + have hsymm (q : VectorPolynomial τ ℝ V) : + realCoefficientEquiv.symm (map S q) = + map (S.restrictScalars ℚ) (realCoefficientEquiv.symm q) := by + apply coefficients.injective + ext α + simp only [coefficients_realCoefficientEquiv_symm, coefficients_map, + LinearMap.restrictScalars_apply] + simp only [realChartSubstitute, LinearMap.comp_apply, LinearEquiv.coe_coe, + LinearMap.restrictScalars_apply, hmap, ← map_substitute, hsymm] + +theorem realCoefficientEquiv_weightedHomogeneousPart (w : σ → ℕ) (d : ℕ) + (p : VectorPolynomial σ ℚ V) : + realCoefficientEquiv (weightedHomogeneousPart w d p) = + weightedHomogeneousPart w d (realCoefficientEquiv p) := by + apply coefficients.injective + ext α + simp only [coefficients_realCoefficientEquiv, coefficients_weightedHomogeneousPart] + +theorem realCoefficientEquiv_symm_weightedHomogeneousPart (w : σ → ℕ) (d : ℕ) + (p : VectorPolynomial σ ℝ V) : + realCoefficientEquiv.symm (weightedHomogeneousPart w d p) = + weightedHomogeneousPart w d (realCoefficientEquiv.symm p) := by + apply coefficients.injective + ext α + simp only [coefficients_realCoefficientEquiv_symm, coefficients_weightedHomogeneousPart] + +theorem realChartSubstitute_weightedHomogeneousPart (w : σ → ℕ) (v : τ → ℕ) + (f : σ → MvPolynomial τ ℝ) + (hf : ∀ i, (f i).IsWeightedHomogeneous v (w i)) + (d : ℕ) (p : VectorPolynomial σ ℚ V) : + realChartSubstitute f (weightedHomogeneousPart w d p) = + weightedHomogeneousPart v d (realChartSubstitute f p) := by + simp only [realChartSubstitute, LinearMap.comp_apply, LinearEquiv.coe_coe, + LinearMap.restrictScalars_apply, realCoefficientEquiv_weightedHomogeneousPart, + substitute_weightedHomogeneousPart w v f hf, + realCoefficientEquiv_symm_weightedHomogeneousPart] + +theorem realChartSubstitute_homogeneous (w : σ → ℕ) (v : τ → ℕ) + (f : σ → MvPolynomial τ ℝ) + (hf : ∀ i, (f i).IsWeightedHomogeneous v (w i)) + (d : ℕ) (p : VectorPolynomial σ ℚ V) + (hp : ∀ α, Finsupp.weight w α ≠ d → coefficients p α = 0) : + ∀ α, Finsupp.weight v α ≠ d → coefficients (realChartSubstitute f p) α = 0 := by + have he : weightedHomogeneousPart v d (realChartSubstitute f p) = + realChartSubstitute f p := by + rw [← realChartSubstitute_weightedHomogeneousPart w v f hf, + weightedHomogeneousPart_eq_self hp] + intro α hα + rw [← he] + exact weightedHomogeneousPart_homogeneous v d _ α hα + +end Erdos3.VectorPolynomial + +namespace Erdos3 + +open MvPolynomial VectorPolynomial + +variable {U B : Type*} + +theorem normalizedRealPolynomialChart_isWeightedHomogeneous + (wU : U → ℕ) (wB : B → ℕ) (H : U → ℝ) (A : B → MvPolynomial U ℝ) + (hA : ∀ j, (A j).IsWeightedHomogeneous wU (wB j)) (i : U ⊕ B) : + (normalizedRealPolynomialChart H A i).IsWeightedHomogeneous + (Sum.elim wU wB) (Sum.elim wU wB i) := by + cases i with + | inl i => + exact (isWeightedHomogeneous_X (R := ℝ) (Sum.elim wU wB) (Sum.inl i)).C_mul _ + | inr j => + apply (isWeightedHomogeneous_X (R := ℝ) (Sum.elim wU wB) (Sum.inr j)).sub + rw [rename_eq_aeval] + exact aeval_isWeightedHomogeneous wU (Sum.elim wU wB) (X ∘ Sum.inl) + (fun i => isWeightedHomogeneous_X (R := ℝ) (Sum.elim wU wB) (Sum.inl i)) (hA j) + +theorem normalizedRealPolynomialChart_weightedHomogeneousComponent + (wU : U → ℕ) (wB : B → ℕ) (H : U → ℝ) (A : B → MvPolynomial U ℝ) + (hA : ∀ j, (A j).IsWeightedHomogeneous wU (wB j)) + (d : ℕ) (p : MvPolynomial (U ⊕ B) ℝ) : + aeval (normalizedRealPolynomialChart H A) + (weightedHomogeneousComponent (Sum.elim wU wB) d p) = + weightedHomogeneousComponent (Sum.elim wU wB) d + (aeval (normalizedRealPolynomialChart H A) p) := + aeval_weightedHomogeneousComponent _ _ _ + (normalizedRealPolynomialChart_isWeightedHomogeneous wU wB H A hA) d p + +theorem normalizedRealPolynomialChart_weightedHomogeneousPart + {V : Type*} [AddCommGroup V] [Module ℚ V] [Module ℝ V] [IsScalarTower ℚ ℝ V] + (wU : U → ℕ) (wB : B → ℕ) (H : U → ℝ) (A : B → MvPolynomial U ℝ) + (hA : ∀ j, (A j).IsWeightedHomogeneous wU (wB j)) + (d : ℕ) (p : VectorPolynomial (U ⊕ B) ℚ V) : + realChartSubstitute (normalizedRealPolynomialChart H A) + (weightedHomogeneousPart (Sum.elim wU wB) d p) = + weightedHomogeneousPart (Sum.elim wU wB) d + (realChartSubstitute (normalizedRealPolynomialChart H A) p) := by + simp only [realChartSubstitute, LinearMap.comp_apply, LinearEquiv.coe_coe, + LinearMap.restrictScalars_apply, realCoefficientEquiv_weightedHomogeneousPart, + substitute_weightedHomogeneousPart (Sum.elim wU wB) (Sum.elim wU wB) + (normalizedRealPolynomialChart H A) + (normalizedRealPolynomialChart_isWeightedHomogeneous wU wB H A hA), + realCoefficientEquiv_symm_weightedHomogeneousPart] + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +attribute [local irreducible] realChartSubstitute realPolynomialChartSubstitution + +variable {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + +noncomputable def polynomialChartOuterIteration (F : NilpotentLieFiltration L s) + (f : σ → MvPolynomial σ ℝ) + (a r : ℕ → PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) : + ℕ → PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot × + PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot + | 0 => (1, 1) + | n + 1 => + let previous := polynomialChartOuterIteration F f a r n + (previous.1 * realPolynomialChartSubstitution F.realification.lowerCentralSeries_eq_bot f (a n), + r n * previous.2) + +theorem polynomialChartOuterIteration_eq_products (F : NilpotentLieFiltration L s) + (f : σ → MvPolynomial σ ℝ) + (a r : ℕ → PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) (n : ℕ) : + F.polynomialChartOuterIteration f a r n = + (realPolynomialChartSubstitution F.realification.lowerCentralSeries_eq_bot f + ((List.range n).map a).prod, ((List.range n).map r).reverse.prod) := by + induction n with + | zero => simp only [polynomialChartOuterIteration, List.range_zero, List.map_nil, + List.prod_nil, List.reverse_nil, map_one] + | succ n ih => + simp only [polynomialChartOuterIteration, ih, List.range_succ, List.map_append, + List.map_singleton, List.prod_append, List.prod_singleton, List.reverse_append, + List.reverse_singleton, map_mul] + +theorem exists_polynomial_chart_outer_iteration_bounds (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι L : Type*} [Fintype σ] [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (_hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE (b.repr ⁅b i, b j⁆ z) H) → + ∀ l : ℕ, 0 < l → (l : ℝ) ≤ Real.exp p → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ l ∣ m ∧ + ∀ (f : σ → MvPolynomial σ ℝ) + (q r : ℕ → PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot), + (∀ j < s, (q j).coord ∈ F.realification.adaptedLieSubalgebra (fun _ => 1)) → + (∀ j < s, (r j).coord ∈ F.realification.adaptedLieSubalgebra (fun _ => 1)) → + (∀ j < s, CoefficientBound (b.baseChange ℝ) (fun _ => 1) + (Real.exp ((p + 2) ^ a)) (q j).coord) → + (∀ j < s, CoefficientGrid (b.baseChange ℝ) l (r j).coord) → + ∀ n ≤ s, ∃ Echart : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot, + (F.polynomialChartOuterIteration f q r n).1 = + realPolynomialChartSubstitution F.realification.lowerCentralSeries_eq_bot f Echart ∧ + CoefficientBound (b.baseChange ℝ) (fun _ => 1) + (Real.exp ((p + C) ^ C)) Echart.coord ∧ + CoefficientGrid (b.baseChange ℝ) m (F.polynomialChartOuterIteration f q r n).2.coord := by + obtain ⟨C, hC, hproducts⟩ := exists_outer_polynomial_product_bounds s a s + refine ⟨C, hC, ?_⟩ + intro σ ι L _ _ _ _ F b ω hF H p hH hp hι hσ hHp hstructure l hl hlp + obtain ⟨m, hm, hmp, hlm, hprod⟩ := hproducts F b ω hF H p hH hp hι hσ hHp hstructure l hl hlp + refine ⟨m, hm, hmp, hlm, ?_⟩ + intro f q r hqa hra hqb hrb n hn + have hmem (v : ℕ → PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (g : PolynomialGroup σ F.realification.lowerCentralSeries_eq_bot) + (hg : g ∈ (List.range n).map v) : + ∃ j, j < s ∧ v j = g := by + obtain ⟨j, hj, heq⟩ := List.mem_map.mp hg + exact ⟨j, lt_of_lt_of_le (List.mem_range.mp hj) hn, heq⟩ + obtain ⟨hs, hr⟩ := hprod ((List.range n).map q) ((List.range n).map r) + (by simpa using hn) (by simpa using hn) + (fun g hg => by obtain ⟨j, hj, rfl⟩ := hmem q g hg; exact hqa j hj) + (fun g hg => by obtain ⟨j, hj, rfl⟩ := hmem r g hg; exact hra j hj) + (fun g hg => by obtain ⟨j, hj, rfl⟩ := hmem q g hg; exact hqb j hj) + (fun g hg => by obtain ⟨j, hj, rfl⟩ := hmem r g hg; exact hrb j hj) + refine ⟨((List.range n).map q).prod, ?_, hs, ?_⟩ + · rw [F.polynomialChartOuterIteration_eq_products] + · rw [F.polynomialChartOuterIteration_eq_products] + exact hr + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +attribute [local irreducible] realChartSubstitute realPolynomialChartSubstitution + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (w : σ → ℕ) + (U : Submodule ℚ F.AssociatedGraded) + (S : (F.AssociatedGraded ⧸ U) →ₗ[ℚ] F.AssociatedGraded) + +noncomputable def restrictedMajorChartCorrection (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) : + PolynomialGroup σ F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot := + ⟨F.homogeneousQuotientGradedPolynomial b ω hF k (S.baseChange ℝ) + (weightedHomogeneousPart w k p)⟩ + +@[simp] theorem restrictedMajorChartCorrection_coord (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) : + (F.restrictedMajorChartCorrection b ω hF w U S k p).coord = + F.homogeneousQuotientGradedPolynomial b ω hF k (S.baseChange ℝ) + (weightedHomogeneousPart w k p) := rfl + +theorem restrictedMajorChartCorrection_graded (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) : + (F.restrictedMajorChartCorrection b ω hF w U S k p).coord ∈ + gradedPolynomialSubmodule ((F.associatedGradedBasis b ω hF).baseChange ℝ) ω w := by + rw [F.restrictedMajorChartCorrection_coord] + apply F.homogeneousQuotientGradedPolynomial_graded + exact weightedHomogeneousPart_homogeneous w k p + +theorem restrictedMajorChartCorrection_adapted (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) : + (F.restrictedMajorChartCorrection b ω hF w U S k p).coord ∈ + F.associatedGradedFiltration.realification.adaptedLieSubalgebra w := + F.associatedGradedFiltration.gradedPolynomial_mem_adapted + (F.associatedGradedBasis b ω hF) ω (F.associatedGradedFiltration_layer b ω hF) w _ + (F.restrictedMajorChartCorrection_graded b ω hF w U S k p) + +theorem restrictedMajorChartCorrection_adapted_one (hw : ∀ i, 0 < w i) (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) : + (F.restrictedMajorChartCorrection b ω hF w U S k p).coord ∈ + F.associatedGradedFiltration.realification.adaptedLieSubalgebra (fun _ => 1) := by + have ha := F.restrictedMajorChartCorrection_adapted b ω hF w U S k p + intro α + apply F.associatedGradedFiltration.realification.antitone + (show Finsupp.weight (fun _ : σ => 1) α ≤ Finsupp.weight w α from ?_) (ha α) + simp only [Finsupp.weight_apply, Finsupp.sum, nsmul_eq_mul, mul_one] + exact Finset.sum_le_sum (fun i _ => Nat.le_mul_of_pos_right (α i) (hw i)) + +theorem realGradedSymbolPolynomialHom_restrictedMajorCorrection (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) : + F.realGradedSymbolPolynomialHom b ω hF w + (F.restrictedMajorCorrection b ω hF w U S k p) = + F.restrictedMajorChartCorrection b ω hF w U S k p := by + apply NilpotentLieBCHGroup.ext + exact F.realGradedSymbolPolynomial_homogeneousQuotientSymbolLift b ω hF w k + (S.baseChange ℝ) _ (weightedHomogeneousPart_homogeneous w k p) + +theorem restrictedMajorChartCorrection_substitute + (f : σ → MvPolynomial σ ℝ) + (hf : ∀ i, (f i).IsWeightedHomogeneous w (w i)) (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) : + F.restrictedMajorChartCorrection b ω hF w U S k (realChartSubstitute f p) = + realPolynomialChartSubstitution + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot f + (F.restrictedMajorChartCorrection b ω hF w U S k p) := by + apply NilpotentLieBCHGroup.ext + rw [F.restrictedMajorChartCorrection_coord, realPolynomialChartSubstitution_coord, + F.restrictedMajorChartCorrection_coord] + rw [← realChartSubstitute_weightedHomogeneousPart w w f hf] + simp only [homogeneousQuotientGradedPolynomial, realChartSubstitute_map] + +theorem realGradedSymbolPolynomialHom_restrictedMajorCorrection_chart + (f : σ → MvPolynomial σ ℝ) + (hf : ∀ i, (f i).IsWeightedHomogeneous w (w i)) (k : ℕ) + (p : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) : + F.realGradedSymbolPolynomialHom b ω hF w + (F.restrictedMajorCorrection b ω hF w U S k (realChartSubstitute f p)) = + realPolynomialChartSubstitution + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot f + (F.restrictedMajorChartCorrection b ω hF w U S k p) := by + rw [F.realGradedSymbolPolynomialHom_restrictedMajorCorrection, + F.restrictedMajorChartCorrection_substitute b ω hF w U S f hf] + +theorem restrictedMajorOuterFactors_chart_representation + (f : σ → MvPolynomial σ ℝ) + (hf : ∀ i, (f i).IsWeightedHomogeneous w (w i)) + (qS pR : ℕ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) (n : ℕ) : + let outer := F.restrictedMajorOuterFactors b ω hF w U S + (fun j => realChartSubstitute f (qS j)) pR n + (F.realGradedSymbolPolynomialHom b ω hF w outer.1, + F.realGradedSymbolPolynomialHom b ω hF w outer.2) = + F.associatedGradedFiltration.polynomialChartOuterIteration f + (fun j => F.restrictedMajorChartCorrection b ω hF w U S (j + 1) (qS j)) + (fun j => F.restrictedMajorChartCorrection b ω hF w U S (j + 1) (pR j)) n := by + induction n with + | zero => simp only [restrictedMajorOuterFactors, polynomialChartOuterIteration, map_one] + | succ n ih => + have hleft := congrArg Prod.fst ih + have hright := congrArg Prod.snd ih + dsimp only at hleft hright ⊢ + simp only [restrictedMajorOuterFactors, polynomialChartOuterIteration, map_mul, + F.realGradedSymbolPolynomialHom_restrictedMajorCorrection_chart b ω hF w U S f hf, + F.realGradedSymbolPolynomialHom_restrictedMajorCorrection, hleft, hright] + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +theorem exists_restricted_chart_iteration_bounds (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr + ⁅F.associatedGradedBasis b ω hF i, F.associatedGradedBasis b ω hF j⁆ z) H) → + ∀ (U : Submodule ℚ F.AssociatedGraded) + (S : (F.AssociatedGraded ⧸ U) →ₗ[ℚ] F.AssociatedGraded) + (eQ : Basis κ ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) (B M : ℝ) + (qS qP : ℕ), 0 ≤ M → 0 < qS * qP → ((qS * qP : ℕ) : ℝ) ≤ Real.exp p → + (Fintype.card κ : ℝ) * B * M ≤ Real.exp ((p + 2) ^ a) → + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (S.baseChange ℝ (eQ j)) i| ≤ B) → + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (S.baseChange ℝ (eQ j)) i) ∈ realDenominatorGrid qS) → + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ qS * qP ∣ m ∧ + ∀ (f : σ → MvPolynomial σ ℝ), + (∀ i, (f i).IsWeightedHomogeneous w (w i)) → + ∀ pS pR : ℕ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U)), + (∀ j < s, ∀ α i, |eQ.repr (coefficients (pS j) α) i| ≤ M) → + (∀ j < s, ∀ α, (fun i => eQ.repr (coefficients (pR j) α) i) ∈ realDenominatorGrid qP) → + ∀ n ≤ s, + let outer := F.restrictedMajorOuterFactors b ω hF w U S + (fun j => realChartSubstitute f (pS j)) pR n + ∃ Echart : PolynomialGroup σ F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot, + F.realGradedSymbolPolynomialHom b ω hF w outer.1 = + realPolynomialChartSubstitution + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot f Echart ∧ + CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) (fun _ => 1) + (Real.exp ((p + C) ^ C)) Echart.coord ∧ + CoefficientGrid ((F.associatedGradedBasis b ω hF).baseChange ℝ) m + (F.realGradedSymbolPolynomialHom b ω hF w outer.2).coord := by + obtain ⟨C, hC, hiteration⟩ := exists_polynomial_chart_outer_iteration_bounds s a + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F b ω hF w hw H p hH hp hι hσ hHp hstructure + U S eQ B M qS qP hM hqpos hqp hcost hSbound hSgrid + obtain ⟨m, hm, hmp, hqm, hbound⟩ := hiteration F.associatedGradedFiltration + (F.associatedGradedBasis b ω hF) ω (F.associatedGradedFiltration_layer b ω hF) + H p hH hp hι hσ hHp hstructure (qS * qP) hqpos hqp + refine ⟨m, hm, hmp, hqm, ?_⟩ + intro f hf pS pR hpS hpR n hn + let q := fun j => F.restrictedMajorChartCorrection b ω hF w U S (j + 1) (pS j) + let r := fun j => F.restrictedMajorChartCorrection b ω hF w U S (j + 1) (pR j) + have hslow : ∀ j < s, CoefficientBound + ((F.associatedGradedBasis b ω hF).baseChange ℝ) (fun _ => 1) + (Real.exp ((p + 2) ^ a)) (q j).coord := by + intro j hj + dsimp only [q] + rw [F.restrictedMajorChartCorrection_coord] + have hpbase : ∀ α i, |eQ.repr (coefficients (pS j) α) i| ≤ + M / monomialScale (fun _ => 1) α := by + simpa [monomialScale] using hpS j hj + have hc := F.homogeneousQuotientGradedPolynomial_coefficientBound b ω hF eQ + (j + 1) (S.baseChange ℝ) (weightedHomogeneousPart w (j + 1) (pS j)) + (fun _ => 1) (fun _ => zero_lt_one) hM hSbound + (weightedHomogeneousPart_coordinateBound eQ (fun _ => 1) (fun _ => zero_lt_one) + hM (pS j) hpbase w (j + 1)) + intro α i + exact (hc α i).trans (div_le_div_of_nonneg_right hcost + (monomialScale_pos (fun _ => 1) (fun _ => zero_lt_one) α).le) + have hgrid : ∀ j < s, CoefficientGrid + ((F.associatedGradedBasis b ω hF).baseChange ℝ) (qS * qP) (r j).coord := by + intro j hj + dsimp only [r] + rw [F.restrictedMajorChartCorrection_coord] + apply F.homogeneousQuotientGradedPolynomial_coefficientGrid b ω hF eQ (j + 1) + (S.baseChange ℝ) (weightedHomogeneousPart w (j + 1) (pR j)) qS qP hSgrid + exact weightedHomogeneousPart_coordinateGrid eQ (pR j) qP (hpR j hj) w (j + 1) + obtain ⟨Echart, hE, hEb, hRg⟩ := hbound f q r + (fun j _ => F.restrictedMajorChartCorrection_adapted_one b ω hF w U S hw (j + 1) (pS j)) + (fun j _ => F.restrictedMajorChartCorrection_adapted_one b ω hF w U S hw (j + 1) (pR j)) + hslow hgrid n hn + have hrep := F.restrictedMajorOuterFactors_chart_representation b ω hF w U S f hf pS pR n + have hleft := congrArg Prod.fst hrep + have hright := congrArg Prod.snd hrep + dsimp only at hleft hright ⊢ + refine ⟨Echart, hleft.trans hE, hEb, ?_⟩ + rw [hright] + exact hRg + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct BigOperators + +section PrefixCongruence + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (U : Submodule ℚ F.AssociatedGraded) + (S : (F.AssociatedGraded ⧸ U) →ₗ[ℚ] F.AssociatedGraded) + +theorem restrictedMajorOuterFactors_congr + (pS pR qS qR : ℕ → VectorPolynomial σ ℚ + (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) + (n : ℕ) (hleft : ∀ j < n, pS j = qS j) (hright : ∀ j < n, pR j = qR j) : + F.restrictedMajorOuterFactors b ω hF w U S pS pR n = + F.restrictedMajorOuterFactors b ω hF w U S qS qR n := by + revert hleft hright + induction n with + | zero => intro _ _; rfl + | succ n ih => + intro hleft hright + have hprev := ih + (fun j hj => hleft j (Nat.lt_succ_of_lt hj)) + (fun j hj => hright j (Nat.lt_succ_of_lt hj)) + simp only [restrictedMajorOuterFactors, hprev, + hleft n (Nat.lt_succ_self n), hright n (Nat.lt_succ_self n)] + +end PrefixCongruence + +theorem exists_restricted_chart_prefix_control (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {σ ι κ L : Type*} [Fintype σ] [Fintype ι] [Fintype κ] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ), (∀ i, 0 < w i) → + ∀ (H : ℕ) (p : ℝ), 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card σ : ℝ) ≤ p → (H : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr + ⁅F.associatedGradedBasis b ω hF i, F.associatedGradedBasis b ω hF j⁆ z) H) → + ∀ (U : Submodule ℚ F.AssociatedGraded) + (S : (F.AssociatedGraded ⧸ U) →ₗ[ℚ] F.AssociatedGraded) + (eQ : Basis κ ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) + (B Bphase : ℝ) (qS : ℕ), 0 ≤ Bphase → 0 < qS → + (qS : ℝ) * Real.exp ((s : ℝ) * (Fintype.card κ : ℝ) * Bphase) ≤ Real.exp p → + (Fintype.card κ : ℝ) * B * Real.exp Bphase ≤ Real.exp ((p + 2) ^ a) → + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (S.baseChange ℝ (eQ j)) i| ≤ B) → + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (S.baseChange ℝ (eQ j)) i) ∈ realDenominatorGrid qS) → + ∀ (f : σ → MvPolynomial σ ℝ), + (∀ i, (f i).IsWeightedHomogeneous w (w i)) → + ∀ (pS pR : ℕ → VectorPolynomial σ ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) + (q : ℕ → ℕ) (n : ℕ), n ≤ s → + (∀ j < n, 0 < q j) → + (∀ j < n, (q j : ℝ) ≤ Real.exp ((Fintype.card κ : ℝ) * Bphase)) → + (∀ j < n, ∀ α i, |eQ.repr (coefficients (pS j) α) i| ≤ Real.exp Bphase) → + (∀ j < n, ∀ α, (fun i => eQ.repr (coefficients (pR j) α) i) ∈ + realDenominatorGrid (q j)) → + let outer := F.restrictedMajorOuterFactors b ω hF w U S + (fun j => realChartSubstitute f (pS j)) pR n + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + C) ^ C) ∧ + qS * (∏ j : Fin n, q j.val) ∣ m ∧ + ∃ Echart : PolynomialGroup σ F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot, + F.realGradedSymbolPolynomialHom b ω hF w outer.1 = + realPolynomialChartSubstitution + F.associatedGradedFiltration.realification.lowerCentralSeries_eq_bot f Echart ∧ + CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) (fun _ => 1) + (Real.exp ((p + C) ^ C)) Echart.coord ∧ + CoefficientGrid ((F.associatedGradedBasis b ω hF).baseChange ℝ) m + (F.realGradedSymbolPolynomialHom b ω hF w outer.2).coord := by + obtain ⟨C, hC, hiteration⟩ := exists_restricted_chart_iteration_bounds s a + refine ⟨C, hC, ?_⟩ + intro σ ι κ L _ _ _ _ _ F b ω hF w hw H p hH hp hι hσ hHp hstructure + U S eQ B Bphase qS hBphase hqS hdenbudget hcost hSbound hSgrid f hf + pS pR q n hn hqpos hqbound hpS hpR + classical + let Q : ℕ := ∏ j : Fin n, q j.val + have hQpos : 0 < Q := majorPhaseCoordinateDenominator_pos + (fun j : Fin n => q j.val) (fun j => hqpos j.val j.isLt) + have hQbound : (Q : ℝ) ≤ Real.exp ((s : ℝ) * (Fintype.card κ : ℝ) * Bphase) := by + have hbase : (Q : ℝ) ≤ Real.exp ((n : ℝ) * (Fintype.card κ : ℝ) * Bphase) := by + simpa only [Fintype.card_fin, mul_assoc] using + majorPhaseCoordinateDenominator_le_exp (fun j : Fin n => q j.val) + ((Fintype.card κ : ℝ) * Bphase) (fun j => hqbound j.val j.isLt) + apply hbase.trans (Real.exp_le_exp.mpr ?_) + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hn) (Nat.cast_nonneg _)) hBphase + have hqQ (j : ℕ) (hj : j < n) : q j ∣ Q := + Finset.dvd_prod_of_mem (fun j : Fin n => q j.val) (Finset.mem_univ (⟨j, hj⟩ : Fin n)) + have htotal : ((qS * Q : ℕ) : ℝ) ≤ Real.exp p := by + rw [Nat.cast_mul] + exact (mul_le_mul_of_nonneg_left hQbound (Nat.cast_nonneg qS)).trans hdenbudget + obtain ⟨m, hm, hmp, hdiv, hbound⟩ := hiteration F b ω hF w hw H p hH hp hι hσ hHp + hstructure U S eQ B (Real.exp Bphase) qS Q (Real.exp_nonneg _) + (Nat.mul_pos hqS hQpos) htotal hcost hSbound hSgrid + let pS' := fun j => if j < n then pS j else 0 + let pR' := fun j => if j < n then pR j else 0 + have hpS' : ∀ j < s, ∀ α i, |eQ.repr (coefficients (pS' j) α) i| ≤ Real.exp Bphase := by + intro j _ α i + by_cases hj : j < n + · simpa only [pS', ite_eq_left hj] using hpS j hj α i + · simpa only [pS', ite_eq_right hj, map_zero, Finsupp.zero_apply, abs_zero] using + Real.exp_nonneg Bphase + have hpR' : ∀ j < s, ∀ α, + (fun i => eQ.repr (coefficients (pR' j) α) i) ∈ realDenominatorGrid Q := by + intro j _ α + by_cases hj : j < n + · simpa only [pR', ite_eq_left hj] using + realDenominatorGrid_subset_of_dvd (hqpos j hj) (hqQ j hj) (hpR j hj α) + · refine ⟨0, ?_⟩ + funext i + simp [pR', hj] + have hprefix : F.restrictedMajorOuterFactors b ω hF w U S + (fun j => realChartSubstitute f (pS' j)) pR' n = + F.restrictedMajorOuterFactors b ω hF w U S + (fun j => realChartSubstitute f (pS j)) pR n := by + apply F.restrictedMajorOuterFactors_congr + · intro j hj + simp only [pS', ite_eq_left hj] + · intro j hj + simp only [pR', ite_eq_left hj] + have hout := hbound f hf pS' pR' hpS' hpR' n hn + dsimp only at hout ⊢ + rw [hprefix] at hout + exact ⟨m, hm, hmp, hdiv, hout⟩ + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedChartReindex.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedChartReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..01549f18b8496a6d4c2b387f4e82bb7118e274d6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedChartReindex.lean @@ -0,0 +1,32 @@ +import OAI.Combinatorics.Progressions.Probability.RestrictedComplexChartDensityComparison + +namespace OAI + +section + +namespace Erdos3 +open Set + +theorem restrictedChartDensity_reindex {X X' Y Y' : Type*} + (e : X ≃ X') (E : Y ≃ Y') (q : X → Y) (q' : X' → Y') + (S : Set X) (S' : Set X') (c : ℝ) (f : X → ℝ) (f' : X' → ℝ) + (hq : Set.InjOn q S) (hq' : Set.InjOn q' S') + (hcomm : ∀ x, q' (e x) = E (q x)) (hS : ∀ x, e x ∈ S' ↔ x ∈ S) + (hf : ∀ x, f' (e x) = f x) (y : Y) : + restrictedChartDensity q' S' c f' (E y) = restrictedChartDensity q S c f y := by + by_cases hy : y ∈ q '' S + · obtain ⟨x, hx, rfl⟩ := hy + rw [← hcomm, restrictedChartDensity_apply q' S' c f' hq' ((hS x).mpr hx), + restrictedChartDensity_apply q S c f hq hx, hf] + · rw [restrictedChartDensity_zero q S c f hy] + apply restrictedChartDensity_zero + rintro ⟨x', hx', he⟩ + obtain ⟨x, rfl⟩ := e.surjective x' + apply hy + exact ⟨x, (hS x).mp hx', E.injective ((hcomm x).symm.trans he)⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedComplexChartSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedComplexChartSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..2909435609deeaf99f6fcf41dd50d0008748b4ab --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedComplexChartSupport.lean @@ -0,0 +1,53 @@ +import Mathlib.MeasureTheory.Constructions.BorelSpace.Complex +import OAI.Combinatorics.Progressions.Probability.RestrictedComplexChartDensityComparison + +namespace OAI + +section + +namespace Erdos3 + +variable {X Y : Type*} + +theorem restrictedComplexChartDensity_norm_le (q : X → Y) (S : Set X) + (hinj : Set.InjOn q S) (f : X → ℂ) {C : ℝ} (hC : 0 ≤ C) + (hf : ∀ x, ‖f x‖ ≤ C) (y : Y) : ‖restrictedComplexChartDensity q S 1 f y‖ ≤ C := by + by_cases hy : y ∈ q '' S + · obtain ⟨x, hx, rfl⟩ := hy + rw [restrictedComplexChartDensity_apply q S 1 f hinj hx, Complex.ofReal_one, one_mul] + exact hf x + · rw [restrictedComplexChartDensity_zero q S 1 f hy, norm_zero] + exact hC + +theorem restrictedComplexChartDensity_enlarge (q : X → Y) (S T : Set X) + (hST : S ⊆ T) (hinj : Set.InjOn q T) (c : ℝ) (f : X → ℂ) + (hsupport : Function.support f ⊆ S) : + restrictedComplexChartDensity q S c f = restrictedComplexChartDensity q T c f := by + funext y + by_cases hy : y ∈ q '' T + · obtain ⟨x, hx, rfl⟩ := hy + rw [restrictedComplexChartDensity_apply q T c f hinj hx] + by_cases hxs : x ∈ S + · exact restrictedComplexChartDensity_apply q S c f (hinj.mono hST) hxs + · have hzero : f x = 0 := by + by_contra hf + exact hxs (hsupport hf) + have hout : q x ∉ q '' S := by + rintro ⟨z, hz, he⟩ + exact hxs ((hinj (hST hz) hx he) ▸ hz) + rw [restrictedComplexChartDensity_zero q S c f hout, hzero, mul_zero] + · have hs : y ∉ q '' S := fun h => hy (Set.image_mono hST h) + rw [restrictedComplexChartDensity_zero q S c f hs, + restrictedComplexChartDensity_zero q T c f hy] + +theorem restrictedComplexChartDensity_measurable [MeasurableSpace X] [MeasurableSpace Y] + (q : X → Y) (S : Set X) (he : MeasurableEmbedding (fun x : S => q x.val)) + (c : ℝ) (f : X → ℂ) (hf : Measurable f) : + Measurable (restrictedComplexChartDensity q S c f) := + measurable_const.mul (he.measurable_extend (hf.comp measurable_subtype_coe) measurable_const) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedGradeScalarCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedGradeScalarCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..1460bd73c70ea6d5c57c7a567792f3e882d0ddfe --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RestrictedGradeScalarCoordinates.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Estimates.RealSymbolGradeQuotientSplitting + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial MvPolynomial +open scoped TensorProduct + +variable {σ ι L J : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (w : σ → ℕ) (U : Submodule ℚ F.AssociatedGraded) + (eQ : Basis J ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ U))) + (k : ℕ) (x : F.RealPolynomialSymbol w) (j : J) + +theorem realSymbolGradeQuotientPolynomial_coordinate_homogeneous : + (coordinate (eQ.coord j).toAddMonoidHom + (F.realSymbolGradeQuotientPolynomial b ω hF w U k x)).IsWeightedHomogeneous w k := by + intro α hα + by_contra hweight + apply hα + rw [coeff_coordinate, + F.realSymbolGradeQuotientPolynomial_homogeneous b ω hF w U k x α hweight, + map_zero] + +theorem realSymbolGradeQuotientPolynomial_coordinate_component : + weightedHomogeneousComponent w k + (coordinate (eQ.coord j).toAddMonoidHom + (F.realSymbolGradeQuotientPolynomial b ω hF w U k x)) = + coordinate (eQ.coord j).toAddMonoidHom + (F.realSymbolGradeQuotientPolynomial b ω hF w U k x) := + weightedHomogeneousComponent_eq_self + (F.realSymbolGradeQuotientPolynomial_coordinate_homogeneous b ω hF w U eQ k x j) + +theorem realSymbolGradeQuotientPolynomial_coordinate_weightedSupportLE : + coordinate (eQ.coord j).toAddMonoidHom + (F.realSymbolGradeQuotientPolynomial b ω hF w U k x) ∈ weightedSupportLE w k := by + intro α hα + exact (F.realSymbolGradeQuotientPolynomial_coordinate_homogeneous b ω hF w U eQ k x j + (mem_support_iff.mp hα)).le + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RiemannianLocalCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RiemannianLocalCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..11c8e324ab6b7ef7e655e0ccf187a61e18c33d5c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RiemannianLocalCoordinates.lean @@ -0,0 +1,124 @@ +import OAI.Combinatorics.Progressions.Estimates.RiemannianLipschitz +import OAI.Combinatorics.Progressions.Estimates.TangentModelVector + +namespace OAI + +section + +namespace Erdos3 + +open Manifold MeasureTheory Set +open scoped Manifold ContDiff ENNReal NNReal Bundle Topology + +variable {E F H M : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [TopologicalSpace H] + {I : ModelWithCorners ℝ E H} [TopologicalSpace M] [ChartedSpace H M] + [∀ x : M, ENorm (TangentSpace I x)] + +theorem coordinate_edist_le_mul_pathELength {f : M → F} {C : ℝ≥0} + (hf : ContMDiff I 𝓘(ℝ, F) 1 f) {γ : ℝ → M} (hγ : ContMDiff 𝓘(ℝ) I 1 γ) + {a b : ℝ} (hab : a ≤ b) + (hbound : ∀ t ∈ Icc a b, ∀ v : TangentSpace I (γ t), + ‖tangentModelVector (mfderiv I 𝓘(ℝ, F) f (γ t) v)‖ₑ ≤ C * ‖v‖ₑ) : + edist (f (γ a)) (f (γ b)) ≤ C * pathELength I γ a b := by + have hsmooth : ContDiff ℝ 1 (f ∘ γ) := (hf.comp hγ).contDiff + calc + _ = ‖(f ∘ γ) b - (f ∘ γ) a‖ₑ := by rw [edist_comm, edist_eq_enorm_sub]; rfl + _ ≤ ∫⁻ t in Icc a b, ‖deriv (f ∘ γ) t‖ₑ := + enorm_sub_le_lintegral_deriv_of_contDiffOn_Icc hsmooth.contDiffOn hab + _ ≤ ∫⁻ t in Icc a b, C * ‖mfderiv 𝓘(ℝ) I γ t 1‖ₑ := by + apply setLIntegral_mono' measurableSet_Icc + intro t ht + have hchain := mfderiv_comp_apply t (hf.mdifferentiableAt one_ne_zero) + (hγ.mdifferentiableAt one_ne_zero) 1 + rw [mfderiv_eq_fderiv] at hchain + change deriv (f ∘ γ) t = tangentModelVector + (mfderiv I 𝓘(ℝ, F) f (γ t) (mfderiv 𝓘(ℝ) I γ t 1)) at hchain + rw [hchain] + exact hbound t ht _ + _ = C * pathELength I γ a b := by + rw [lintegral_const_mul' _ _ ENNReal.coe_ne_top, pathELength_eq_lintegral_mfderiv_Icc] + +theorem coordinate_path_stays_in_closedBall {f : M → F} {C r : ℝ≥0} + (hf : ContMDiff I 𝓘(ℝ, F) 1 f) {γ : ℝ → M} (hγ : ContMDiff 𝓘(ℝ) I 1 γ) + (hbound : ∀ x, f x ∈ Metric.closedBall (f (γ 0)) r → ∀ v : TangentSpace I x, + ‖tangentModelVector (mfderiv I 𝓘(ℝ, F) f x v)‖ₑ ≤ C * ‖v‖ₑ) + (hshort : (C : ℝ≥0∞) * pathELength I γ 0 1 < r) : + ∀ t ∈ Icc (0 : ℝ) 1, f (γ t) ∈ Metric.closedBall (f (γ 0)) r := by + let A := {t : ℝ | f (γ t) ∈ Metric.closedBall (f (γ 0)) r} + have hA : IsClosed (A ∩ Icc 0 1) := + ((Metric.isClosed_closedBall).preimage (hf.continuous.comp hγ.continuous)).inter isClosed_Icc + have hzero : (0 : ℝ) ∈ A := Metric.mem_closedBall_self r.coe_nonneg + apply hA.Icc_subset_of_forall_mem_nhdsGT_of_Icc_subset hzero + intro t ht hAt + have hvariation := coordinate_edist_le_mul_pathELength hf hγ ht.1 + (fun u hu => hbound (γ u) (hAt hu)) + have hlength : (C : ℝ≥0∞) * pathELength I γ 0 t ≤ C * pathELength I γ 0 1 := by + gcongr + exact ht.2.le + have hlt : edist (f (γ 0)) (f (γ t)) < r := hvariation.trans_lt + (hlength.trans_lt hshort) + have hball : f (γ t) ∈ Metric.ball (f (γ 0)) r := by + rw [← Metric.eball_coe, Metric.mem_eball, edist_comm] + exact hlt + have hnhds : {u | f (γ u) ∈ Metric.ball (f (γ 0)) r} ∈ 𝓝 t := + (Metric.isOpen_ball.preimage (hf.continuous.comp hγ.continuous)).mem_nhds hball + exact Filter.mem_of_superset (nhdsWithin_le_nhds hnhds) + (fun u hu => Metric.ball_subset_closedBall hu) + +theorem coordinate_edist_le_of_short_path {f : M → F} {C r : ℝ≥0} + (hf : ContMDiff I 𝓘(ℝ, F) 1 f) {γ : ℝ → M} (hγ : ContMDiff 𝓘(ℝ) I 1 γ) + (hbound : ∀ x, f x ∈ Metric.closedBall (f (γ 0)) r → ∀ v : TangentSpace I x, + ‖tangentModelVector (mfderiv I 𝓘(ℝ, F) f x v)‖ₑ ≤ C * ‖v‖ₑ) + (hshort : (C : ℝ≥0∞) * pathELength I γ 0 1 < r) : + edist (f (γ 0)) (f (γ 1)) ≤ C * pathELength I γ 0 1 := + coordinate_edist_le_mul_pathELength hf hγ zero_le_one + (fun t ht => hbound (γ t) (coordinate_path_stays_in_closedBall hf hγ hbound hshort t ht)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Manifold MeasureTheory Set +open scoped Manifold ContDiff ENNReal NNReal Bundle Topology + +variable {E F H M : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [TopologicalSpace H] + {I : ModelWithCorners ℝ E H} [TopologicalSpace M] [ChartedSpace H M] + [∀ x : M, ENorm (TangentSpace I x)] [∀ x : M, ENormSMulClass ℝ (TangentSpace I x)] + +theorem coordinate_edist_le_of_riemannianEDist_lt {f : M → F} {C r : ℝ≥0} + (hC : 0 < C) (hf : ContMDiff I 𝓘(ℝ, F) 1 f) (x y : M) + (hbound : ∀ z, f z ∈ Metric.closedBall (f x) r → ∀ v : TangentSpace I z, + ‖tangentModelVector (mfderiv I 𝓘(ℝ, F) f z v)‖ₑ ≤ C * ‖v‖ₑ) + (hnear : (C : ℝ≥0∞) * riemannianEDist I x y < r) : + edist (f x) (f y) ≤ C * riemannianEDist I x y := by + have hC0 : (C : ℝ≥0∞) ≠ 0 := by exact_mod_cast hC.ne' + have hCt : (C : ℝ≥0∞) ≠ ⊤ := ENNReal.coe_ne_top + apply le_of_forall_gt + intro q hq + have hmin : (C : ℝ≥0∞) * riemannianEDist I x y < min q r := lt_min hq hnear + have hinput : riemannianEDist I x y < min q r / C := by + apply (ENNReal.lt_div_iff_mul_lt (.inl hC0) (.inl hCt)).mpr + simpa only [mul_comm] using hmin + obtain ⟨γ, hγ0, hγ1, hγ, hlen, _⟩ := + exists_lt_locally_constant_of_riemannianEDist_lt hinput zero_lt_one + have hmul : (C : ℝ≥0∞) * pathELength I γ 0 1 < min q r := by + simpa only [mul_comm] using + (ENNReal.lt_div_iff_mul_lt (.inl hC0) (.inl hCt)).mp hlen + have hb : ∀ z, f z ∈ Metric.closedBall (f (γ 0)) r → ∀ v : TangentSpace I z, + ‖tangentModelVector (mfderiv I 𝓘(ℝ, F) f z v)‖ₑ ≤ C * ‖v‖ₑ := by + simpa only [hγ0] using hbound + have hv := coordinate_edist_le_of_short_path hf hγ hb (hmul.trans_le (min_le_right q r)) + rw [hγ0, hγ1] at hv + exact hv.trans_lt (hmul.trans_le (min_le_left q r)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RightCosetMetricMap.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RightCosetMetricMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..f282cb98f4caa08bee98be54068a577417f255b4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RightCosetMetricMap.lean @@ -0,0 +1,180 @@ +import OAI.Combinatorics.Progressions.Estimates.RightCosetEDistance + +namespace OAI + +section + +namespace Erdos3 + +open Set +open scoped ENNReal Topology + +variable {G : Type*} [Group G] [PseudoEMetricSpace G] [IsIsometricSMul Gᵐᵒᵖ G] + +theorem quotientRightEDist_image_eball (Γ : Subgroup G) (x : G) (r : ℝ≥0∞) : + (QuotientGroup.mk : G → G ⧸ Γ) '' Metric.eball x r = + {y | quotientRightEDist Γ (QuotientGroup.mk x) y < r} := by + ext y + induction y using Quotient.inductionOn with + | h y => + constructor + · rintro ⟨w, hw, hwq⟩ + change (QuotientGroup.mk w : G ⧸ Γ) = QuotientGroup.mk y at hwq + change quotientRightEDist Γ (QuotientGroup.mk x) (QuotientGroup.mk y) < r + rw [← hwq] + apply (quotientRightEDist_mk_le Γ x w).trans_lt + simpa only [Metric.mem_eball, edist_comm] using hw + · intro hy + change (⨅ γ : Γ, edist x (y * γ)) < r at hy + obtain ⟨γ, hγ⟩ := iInf_lt_iff.mp hy + refine ⟨y * γ, ?_, quotient_mk_mul_mem Γ y γ⟩ + simpa only [Metric.mem_eball, edist_comm] using hγ + +variable [IsTopologicalGroup G] + +theorem quotientRightEDist_nhds_basis (Γ : Subgroup G) (x : G ⧸ Γ) : + (𝓝 x).HasBasis (fun r : ℝ≥0∞ => 0 < r) (fun r => {y | quotientRightEDist Γ x y < r}) := by + induction x using Quotient.inductionOn with + | h x => + rw [QuotientGroup.nhds_eq] + simpa only [quotientRightEDist_image_eball] using + (Metric.nhds_basis_eball (x := x)).map (QuotientGroup.mk : G → G ⧸ Γ) + +@[instance_reducible] +noncomputable def rightCosetPseudoEMetricSpace (Γ : Subgroup G) : PseudoEMetricSpace (G ⧸ Γ) := + PseudoEMetricSpace.ofEDistOfTopology (quotientRightEDist Γ) + (quotientRightEDist_self Γ) (quotientRightEDist_comm Γ) (quotientRightEDist_triangle Γ) + (quotientRightEDist_nhds_basis Γ) + +theorem rightCosetPseudoEMetricSpace_topology (Γ : Subgroup G) : + (rightCosetPseudoEMetricSpace Γ).toUniformSpace.toTopologicalSpace = + (inferInstance : TopologicalSpace (G ⧸ Γ)) := rfl + +@[instance_reducible] +noncomputable def rightCosetEMetricSpace (Γ : Subgroup G) (hΓ : IsClosed (Γ : Set G)) : + EMetricSpace (G ⧸ Γ) := by + letI := rightCosetPseudoEMetricSpace Γ + letI := hΓ + exact EMetricSpace.ofT0PseudoEMetricSpace (G ⧸ Γ) + +theorem rightCosetEMetricSpace_topology (Γ : Subgroup G) (hΓ : IsClosed (Γ : Set G)) : + (rightCosetEMetricSpace Γ hΓ).toUniformSpace.toTopologicalSpace = + (inferInstance : TopologicalSpace (G ⧸ Γ)) := rfl + +end Erdos3 + +namespace Erdos3 + +open Set + +variable {G : Type*} [Group G] [MetricSpace G] [IsIsometricSMul Gᵐᵒᵖ G] [IsTopologicalGroup G] + +@[instance_reducible] +noncomputable def rightCosetMetricSpace (Γ : Subgroup G) (hΓ : IsClosed (Γ : Set G)) : + MetricSpace (G ⧸ Γ) := by + letI := rightCosetEMetricSpace Γ hΓ + apply EMetricSpace.toMetricSpace + intro x y + induction x using Quotient.inductionOn with + | h x => + induction y using Quotient.inductionOn with + | h y => + exact ne_top_of_le_ne_top (edist_ne_top x y) (quotientRightEDist_mk_le Γ x y) + +theorem rightCosetMetricSpace_topology (Γ : Subgroup G) (hΓ : IsClosed (Γ : Set G)) : + (rightCosetMetricSpace Γ hΓ).toUniformSpace.toTopologicalSpace = + (inferInstance : TopologicalSpace (G ⧸ Γ)) := rfl + +theorem rightCosetMetricSpace_edist_mk (Γ : Subgroup G) (hΓ : IsClosed (Γ : Set G)) (x y : G) : + letI := rightCosetMetricSpace Γ hΓ + edist (QuotientGroup.mk x : G ⧸ Γ) (QuotientGroup.mk y) = ⨅ γ : Γ, edist x (y * γ) := rfl + +theorem rightCosetMetricSpace_lipschitz_mk (Γ : Subgroup G) (hΓ : IsClosed (Γ : Set G)) : + letI := rightCosetMetricSpace Γ hΓ + LipschitzWith 1 (QuotientGroup.mk : G → G ⧸ Γ) := by + let := rightCosetMetricSpace Γ hΓ + intro x y + change quotientRightEDist Γ (QuotientGroup.mk x) (QuotientGroup.mk y) ≤ 1 * edist x y + simpa only [one_mul] using quotientRightEDist_mk_le Γ x y + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal ENNReal + +variable {G H : Type*} [Group G] [Group H] + +def cosetMap (Γ : Subgroup G) (Λ : Subgroup H) (φ : G →* H) (hφ : Γ ≤ Λ.comap φ) : + (G ⧸ Γ) → (H ⧸ Λ) := + Quotient.map φ (fun {a b} h => by + apply QuotientGroup.leftRel_apply.mpr + have hm := hφ (QuotientGroup.leftRel_apply.mp h) + simpa only [Subgroup.mem_comap, map_mul, map_inv] using hm) + +@[simp] theorem cosetMap_mk (Γ : Subgroup G) (Λ : Subgroup H) (φ : G →* H) + (hφ : Γ ≤ Λ.comap φ) (x : G) : + cosetMap Γ Λ φ hφ (QuotientGroup.mk x) = QuotientGroup.mk (φ x) := rfl + +theorem cosetMap_surjective (Γ : Subgroup G) (Λ : Subgroup H) (φ : G →* H) + (hφ : Γ ≤ Λ.comap φ) (hsurj : Function.Surjective φ) : + Function.Surjective (cosetMap Γ Λ φ hφ) := by + intro y + induction y using Quotient.inductionOn with + | h y => + obtain ⟨x, rfl⟩ := hsurj y + exact ⟨QuotientGroup.mk x, rfl⟩ + +variable [PseudoEMetricSpace G] [PseudoEMetricSpace H] + +theorem rightCosetEDist_map_le (Γ : Subgroup G) (Λ : Subgroup H) (φ : G →* H) + (hφ : Γ ≤ Λ.comap φ) {C : ℝ≥0} (hLip : LipschitzWith C φ) (x y : G) : + rightCosetEDist Λ (φ x) (φ y) ≤ C * rightCosetEDist Γ x y := by + unfold rightCosetEDist + rw [ENNReal.mul_iInf (by simp)] + apply le_iInf + intro γ + let δ : Λ := ⟨φ γ, hφ γ.property⟩ + calc + (⨅ a : Λ, edist (φ x) (φ y * a)) ≤ edist (φ x) (φ y * δ) := iInf_le _ δ + _ = edist (φ x) (φ (y * γ)) := by simp only [δ, map_mul] + _ ≤ C * edist x (y * γ) := hLip x (y * γ) + +variable [IsIsometricSMul Gᵐᵒᵖ G] [IsIsometricSMul Hᵐᵒᵖ H] + +theorem quotientRightEDist_map_le (Γ : Subgroup G) (Λ : Subgroup H) (φ : G →* H) + (hφ : Γ ≤ Λ.comap φ) {C : ℝ≥0} (hLip : LipschitzWith C φ) (x y : G ⧸ Γ) : + quotientRightEDist Λ (cosetMap Γ Λ φ hφ x) (cosetMap Γ Λ φ hφ y) ≤ + C * quotientRightEDist Γ x y := + Quotient.inductionOn₂ x y (rightCosetEDist_map_le Γ Λ φ hφ hLip) + +end Erdos3 + +namespace Erdos3 + +open scoped NNReal + +variable {G H : Type*} [Group G] [Group H] [MetricSpace G] [MetricSpace H] + [IsIsometricSMul Gᵐᵒᵖ G] [IsIsometricSMul Hᵐᵒᵖ H] + [IsTopologicalGroup G] [IsTopologicalGroup H] + +theorem lipschitz_cosetMap (Γ : Subgroup G) (Λ : Subgroup H) + (hΓ : IsClosed (Γ : Set G)) (hΛ : IsClosed (Λ : Set H)) + (φ : G →* H) (hφ : Γ ≤ Λ.comap φ) {C : ℝ≥0} (hLip : LipschitzWith C φ) : + letI := rightCosetMetricSpace Γ hΓ + letI := rightCosetMetricSpace Λ hΛ + LipschitzWith C (cosetMap Γ Λ φ hφ) := by + let := rightCosetMetricSpace Γ hΓ + let := rightCosetMetricSpace Λ hΛ + intro x y + exact quotientRightEDist_map_le Γ Λ φ hφ hLip x y + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/RoundedGraphCyclicCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/RoundedGraphCyclicCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd16a50135bf8e666d1207c6dc2b0e4a4ac85078 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/RoundedGraphCyclicCoordinates.lean @@ -0,0 +1,32 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3.FreimanModel + +def roundedGraphModuli {I : Type*} (N M : ℕ) : Option I → ℕ + | none => N + | some _ => M + +def roundedGraphCoordinateEquiv {I : Type*} (N M : ℕ) : + (ZMod N × (I → ZMod M)) ≃+ (∀ i : Option I, ZMod (roundedGraphModuli N M i)) where + toFun x i := match i with + | none => x.1 + | some j => x.2 j + invFun x := (x none, fun i => x (some i)) + left_inv x := rfl + right_inv x := by funext i; cases i <;> rfl + map_add' x y := by funext i; cases i <;> rfl + +theorem roundedGraphModuli_neZero {I : Type*} (N M : ℕ) [NeZero N] [NeZero M] : + ∀ i : Option I, NeZero (roundedGraphModuli N M i) := by + intro i + cases i <;> dsimp [roundedGraphModuli] <;> infer_instance + +end Erdos3.FreimanModel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SampledCommonBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SampledCommonBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb4a446ee1a7f30eeb8164f21d5db8549f00bfa1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SampledCommonBox.lean @@ -0,0 +1,324 @@ +import OAI.Combinatorics.Progressions.Dynamics.ProductCutoffExponentialBudget +import OAI.Combinatorics.Progressions.Estimates.CommonStrideGowersTransfer +import OAI.Combinatorics.Progressions.Estimates.FiniteCommonStrideFamily +import OAI.Combinatorics.Progressions.Estimates.SampledCommonSlice +import OAI.Combinatorics.Progressions.Lattices.IntegerBoxCoordinateEquiv + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem commonStrideCount_exp_bound {p : ℝ} (hp : 0 ≤ p) : + (⌈2 / Real.exp (-p)⌉₊ : ℝ) ≤ Real.exp (p + 2) := by + rw [Real.exp_neg, div_inv_eq_mul] + have hceil := (Nat.ceil_lt_add_one (show 0 ≤ 2 * Real.exp p by positivity)).le + have h1 := Real.one_le_exp hp + have h3 : (3 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + calc + _ ≤ 3 * Real.exp p := by linarith + _ ≤ Real.exp 2 * Real.exp p := mul_le_mul_of_nonneg_right h3 (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add, add_comm] + +theorem exists_dense_box_inner_family {I : Type*} [Fintype I] [DecidableEq I] + {p : ℝ} (hp : 0 ≤ p) (N : I → ℕ) : + ∃ D : Finset (Finset (I → ℤ)), + (D.card : ℝ) ≤ Real.exp ((5 * p + 20) * Fintype.card I + p + 2) ∧ + (∀ A ∈ D, ∃ (c : I → ℤ) (m : ℕ) (H : I → ℕ), + 0 < m ∧ m ≤ ⌈2 / Real.exp (-p)⌉₊ ∧ A = commonStrideBox c m H) ∧ + ∀ (c : I → ℤ) (m : ℕ) (H : I → ℕ), 0 < m → (∀ i, 0 < H i) → + (∀ i, integerProgressionSupport (c i) m (H i) ⊆ Finset.Ico (0 : ℤ) (N i)) → + (∀ i, Real.exp (-p) * N i ≤ (H i : ℝ)) → + ∃ A ∈ D, A.Nonempty ∧ A ⊆ commonStrideBox c m H ∧ + 2 * (1 - (A.card : ℝ) / (commonStrideBox c m H).card) ≤ + Fintype.card I * Real.exp (-p) := by + classical + choose C hcount hshape hcover using fun i => exists_finite_inner_interval_family hp (N i) + let M := ⌈2 / Real.exp (-p)⌉₊ + let D := finiteCommonStrideFamily M C + have hprod : (∏ i, ((C i).card : ℝ)) ≤ Real.exp ((4 * p + 18) * Fintype.card I) := by + calc + _ ≤ ∏ _i : I, Real.exp (4 * p + 18) := + Finset.prod_le_prod₀ (fun _ _ => Nat.cast_nonneg _) (fun i _ => hcount i) + _ = _ := by + rw [Finset.prod_const, Finset.card_univ, ← Real.exp_nat_mul] + congr 1 + ring + refine ⟨D, ?_, fun A hA => finiteCommonStrideFamily_shape M C hshape hA, ?_⟩ + · calc + (D.card : ℝ) ≤ (M : ℝ) ^ (Fintype.card I + 1) * ∏ i, ((C i).card : ℝ) := by + exact_mod_cast finiteCommonStrideFamily_card M C + _ ≤ Real.exp (p + 2) ^ (Fintype.card I + 1) * + Real.exp ((4 * p + 18) * Fintype.card I) := + mul_le_mul (pow_le_pow_left₀ (Nat.cast_nonneg _) (commonStrideCount_exp_bound hp) _) + hprod (Finset.prod_nonneg (fun _ _ => Nat.cast_nonneg _)) (by positivity) + _ = _ := by + rw [← Real.exp_nat_mul, ← Real.exp_add] + congr 1 + push_cast + ring + · intro c m H hm hH hsub hdense + obtain ⟨d, r, a, hd, hdM, hcoord⟩ := exists_bounded_common_stride_reindex N H c hm hH + (Real.exp_pos _) (Real.exp_le_one_iff.mpr (by linarith)) hsub hdense + choose S hSC hSn hSsub hShalf hSerr using fun i => + hcover i (a i) (H i) (hcoord i).2.1 (hH i) (hdense i) + let Aaxis (i : I) := (S i).image (fun x => (r i : ℤ) + d * x) + let A := Fintype.piFinset Aaxis + have hg (i : I) : Function.Injective (fun x : ℤ => (r i : ℤ) + d * x) := by + intro x y he + exact mul_left_cancel₀ (by exact_mod_cast hd.ne' : (d : ℤ) ≠ 0) (add_left_cancel he) + have hAsub (i : I) : Aaxis i ⊆ integerProgressionSupport (c i) m (H i) := by + rw [(hcoord i).2.2] + exact Finset.image_subset_image (hSsub i) + have hB (i : I) : (integerProgressionSupport (c i) m (H i)).Nonempty := by + apply Finset.card_pos.mp + simpa only [card_integerProgressionSupport _ _ _ hm] using hH i + refine ⟨A, mem_finiteCommonStrideFamily M C hd hdM r (fun i => (hcoord i).1) S hSC, + Fintype.piFinset_nonempty.mpr (fun i => (hSn i).image _), + Fintype.piFinset_subset _ _ hAsub, ?_⟩ + have hloss := piFinset_inner_normalized_loss Aaxis + (fun i => integerProgressionSupport (c i) m (H i)) hB hAsub + (fun _ => Real.exp (-p)) (fun i => by + simpa only [Aaxis, Finset.card_image_of_injective _ (hg i), + card_integerProgressionSupport _ _ _ hm] using hSerr i) + simpa only [A, commonStrideBox, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] using hloss + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +def IsDenseCommonStrideBox {I : Type*} [Fintype I] [DecidableEq I] + (N : I → ℕ) (p : ℝ) (A : Finset (I → ℤ)) : Prop := + ∃ (c : I → ℤ) (m : ℕ) (H : I → ℕ), 0 < m ∧ (∀ i, 0 < H i) ∧ + (∀ i, integerProgressionSupport (c i) m (H i) ⊆ Finset.Ico (0 : ℤ) (N i)) ∧ + (∀ i, Real.exp (-p) * N i ≤ (H i : ℝ)) ∧ A = commonStrideBox c m H + +theorem IsDenseCommonStrideBox.nonempty {I : Type*} [Fintype I] [DecidableEq I] + {N : I → ℕ} {p : ℝ} {A : Finset (I → ℤ)} (h : IsDenseCommonStrideBox N p A) : + A.Nonempty := by + obtain ⟨c, m, H, hm, hH, _, _, rfl⟩ := h + exact commonStrideBox_nonempty c hm H hH + +theorem exists_finite_site_box_inner_family {I T : Type*} [Fintype I] [DecidableEq I] + [Fintype T] (e : T → I → ℤ) (he : Function.Injective e) {p : ℝ} (hp : 0 ≤ p) (N : I → ℕ) : + ∃ C : Finset (Finset T), + (C.card : ℝ) ≤ Real.exp ((5 * p + 20) * Fintype.card I + p + 2) ∧ + (∀ A ∈ C, A.Nonempty → ∃ (c : I → ℤ) (m : ℕ) (H : I → ℕ), + 0 < m ∧ (∀ i, 0 < H i) ∧ A.image e = commonStrideBox c m H) ∧ + ∀ S : Finset T, IsDenseCommonStrideBox N p (S.image e) → + ∃ A ∈ C, A.Nonempty ∧ A ⊆ S ∧ + 2 * (1 - (A.card : ℝ) / S.card) ≤ Fintype.card I * Real.exp (-p) := by + obtain ⟨D, hD, hshape, hcover⟩ := exists_dense_box_inner_family hp N + refine ⟨finiteSiteInnerFamily e D, ?_, ?_, ?_⟩ + · exact (show ((finiteSiteInnerFamily e D).card : ℝ) ≤ D.card by + exact_mod_cast finiteSiteInnerFamily_card e D).trans hD + · intro A hA hAn + obtain ⟨c, m, H, hm, _, heq⟩ := hshape (A.image e) (finiteSiteInnerFamily_image_mem e D hA) + have hBn : (commonStrideBox c m H).Nonempty := heq ▸ hAn.image e + have haxis := Fintype.piFinset_nonempty.mp hBn + refine ⟨c, m, H, hm, ?_, heq⟩ + intro i + have hcard := (haxis i).card_pos + simpa only [card_integerProgressionSupport _ _ _ hm] using hcard + · intro S hS + obtain ⟨c, m, H, hm, hH, hsub, hdense, heq⟩ := hS + obtain ⟨A, hAD, hAn, hAS, hloss⟩ := hcover c m H hm hH hsub hdense + have hAS' : A ⊆ S.image e := by rw [heq]; exact hAS + have hAall : A ⊆ Finset.univ.image e := hAS'.trans (Finset.image_subset_image (Finset.subset_univ S)) + have hcard := finiteSitePreimage_card e he A hAall + refine ⟨finiteSitePreimage e A, mem_finiteSiteInnerFamily e D hAD hAall, + Finset.card_pos.mp (by rw [hcard]; exact hAn.card_pos), + finiteSitePreimage_subset e he A S hAS', ?_⟩ + rw [← heq, Finset.card_image_of_injective _ he] at hloss + simpa only [hcard] using hloss + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem commonStridePoint_coordinateEquiv {X Y : Type*} (e : X ≃ Y) + (c : X → ℤ) (m : ℕ) (x : X → ℤ) : + integerPointCoordinateEquiv e (commonStridePoint c m x) = + commonStridePoint (integerPointCoordinateEquiv e c) m + (integerPointCoordinateEquiv e x) := rfl + +theorem commonStrideIndex_coordinateEquiv {X Y : Type*} (e : X ≃ Y) + (c : X → ℤ) (m : ℕ) (x : X → ℤ) : + integerPointCoordinateEquiv e (commonStrideIndex c m x) = + commonStrideIndex (integerPointCoordinateEquiv e c) m + (integerPointCoordinateEquiv e x) := rfl + +theorem commonStrideBox_map_coordinateEquiv {X Y : Type*} + [Fintype X] [DecidableEq X] [Fintype Y] [DecidableEq Y] + (e : X ≃ Y) (c : X → ℤ) (m : ℕ) (H : X → ℕ) : + (commonStrideBox c m H).map (integerPointCoordinateEquiv e).toEmbedding = + commonStrideBox (integerPointCoordinateEquiv e c) m + (coordinateReindexedSides e H) := by + classical + ext y + rw [Finset.mem_map_equiv] + simp only [commonStrideBox, Fintype.mem_piFinset] + change (∀ i, y (e i) ∈ integerProgressionSupport (c i) m (H i)) ↔ + ∀ j, y j ∈ integerProgressionSupport (c (e.symm j)) m (H (e.symm j)) + constructor + · intro h j + simpa only [Equiv.apply_symm_apply] using h (e.symm j) + · intro h i + simpa only [Equiv.symm_apply_apply] using h (e i) + +theorem commonStrideBox_image_coordinateEquiv {X Y : Type*} + [Fintype X] [DecidableEq X] [Fintype Y] [DecidableEq Y] + (e : X ≃ Y) (c : X → ℤ) (m : ℕ) (H : X → ℕ) : + (commonStrideBox c m H).image (integerPointCoordinateEquiv e) = + commonStrideBox (integerPointCoordinateEquiv e c) m + (coordinateReindexedSides e H) := by + simpa only [Finset.map_eq_image, Equiv.coe_toEmbedding] using + commonStrideBox_map_coordinateEquiv e c m H + +theorem IsDenseCommonStrideBox.coordinateEquiv {X Y : Type*} + [Fintype X] [DecidableEq X] [Fintype Y] [DecidableEq Y] + (e : X ≃ Y) {N : X → ℕ} {p : ℝ} {A : Finset (X → ℤ)} + (h : IsDenseCommonStrideBox N p A) : + IsDenseCommonStrideBox (coordinateReindexedSides e N) p + (A.image (integerPointCoordinateEquiv e)) := by + obtain ⟨c, m, H, hm, hH, hsub, hdense, rfl⟩ := h + refine ⟨integerPointCoordinateEquiv e c, m, coordinateReindexedSides e H, + hm, fun j => hH (e.symm j), fun j => hsub (e.symm j), + fun j => hdense (e.symm j), commonStrideBox_image_coordinateEquiv e c m H⟩ + +theorem IsDenseCommonStrideBox.coordinateEquiv_map {X Y : Type*} + [Fintype X] [DecidableEq X] [Fintype Y] [DecidableEq Y] + (e : X ≃ Y) {N : X → ℕ} {p : ℝ} {A : Finset (X → ℤ)} + (h : IsDenseCommonStrideBox N p A) : + IsDenseCommonStrideBox (coordinateReindexedSides e N) p + (A.map (integerPointCoordinateEquiv e).toEmbedding) := by + simpa only [Finset.map_eq_image, Equiv.coe_toEmbedding] using h.coordinateEquiv e + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def denseBoxGowersTransferCost (j n : ℕ) (p q : ℝ) : ℝ := + (q + (2 * p + 6) * n + 1) * (2 ^ (j + 2) * n + 1 : ℕ) + ((n + 3) * n : ℕ) + +theorem denseBox_gowers_transfer (j : ℕ) {I : Type*} [Fintype I] [DecidableEq I] + (N : I → ℕ) [∀ i, NeZero (N i)] {A : Finset (I → ℤ)} {p q : ℝ} + (hp : 0 ≤ p) (hq : 0 ≤ q) (hA : IsDenseCommonStrideBox N p A) + (f : (I → ℤ) → ℂ) (hf : ∀ x ∈ integerBox N, ‖f x‖ ≤ 1) + (hnorm : Real.exp (-q) ≤ finiteSupportGowersNorm (j + 2) A f) : + Real.exp (-denseBoxGowersTransferCost j (Fintype.card I) p q) ≤ + finiteSupportGowersNorm (j + 2) (integerBox N) f := by + obtain ⟨c, m, H, hm, hH, hsub, hdense, rfl⟩ := hA + obtain ⟨d, r, a, hd, hdmax, hrepr⟩ := exists_bounded_common_stride_reindex N H c hm hH + (Real.exp_pos (-p)) (Real.exp_le_one_iff.mpr (by linarith)) hsub hdense + let b : I → ℤ := fun i => (r i : ℤ) + (d : ℤ) * a i + have hsame (i) : integerProgressionSupport (c i) m (H i) = + integerProgressionSupport (b i) d (H i) := by + exact (hrepr i).2.2.trans (integerProgressionSupport_reindex (r i) d (a i) (H i)).symm + have hsameBox : commonStrideBox c m H = commonStrideBox b d H := by + unfold commonStrideBox + exact congrArg Fintype.piFinset (funext hsame) + have hdexp : (d : ℝ) ≤ Real.exp (p + 2) := + (Nat.cast_le.mpr hdmax).trans (commonStrideCount_exp_bound hp) + have hsub' (i) : integerProgressionSupport (b i) d (H i) ⊆ Finset.Ico (0 : ℤ) (N i) := by + rw [← hsame i] + exact hsub i + have hdense' (i) : Real.exp (-(p + 2)) * N i ≤ (H i : ℝ) := + (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (by linarith)) (Nat.cast_nonneg _)).trans + (hdense i) + have hratio := product_box_volume_ratio_exp N H (fun i => NeZero.pos _) hd + (show 0 ≤ p + 2 by linarith) hdexp hdense' + have hlocal : Real.exp (-q) ≤ finiteSupportGowersNorm (j + 2) (integerBox H) + (fun x => f (commonStridePoint b d x)) := by + rw [← finiteSupportGowersNorm_commonStride (j + 2) b hd H f, ← hsameBox] + exact hnorm + let Q := q + (2 * (p + 2) + 2) * Fintype.card I + have hQ : 0 ≤ Q := by dsimp only [Q]; positivity + have hlarge : Real.exp (-Q) ≤ ((∏ i, H i : ℕ) : ℝ) / + ((∏ i, 4 * (d * N i) : ℕ) : ℝ) * + finiteSupportGowersNorm (j + 2) (integerBox H) + (fun x => f (commonStridePoint b d x)) := by + calc + _ = Real.exp (-((2 * (p + 2) + 2) * Fintype.card I)) * Real.exp (-q) := by + rw [← Real.exp_add] + congr 1 + dsimp only [Q] + ring + _ ≤ _ := mul_le_mul hratio hlocal (Real.exp_nonneg _) (by positivity) + have htransfer := commonStride_gowers_transfer j N H b hd hH hsub' f hf + (Real.exp_pos (-Q)) (Real.exp_le_one_iff.mpr (neg_nonpos.mpr hQ)) hlarge + have hbudget := (productCutoff_transfer_exp j (Fintype.card I) hQ).trans htransfer + have hcost : (Q + 1) * ((2 ^ (j + 2) * Fintype.card I + 1 : ℕ) : ℝ) + + (((Fintype.card I + 3) * Fintype.card I : ℕ) : ℝ) = + denseBoxGowersTransferCost j (Fintype.card I) p q := by + dsimp only [denseBoxGowersTransferCost, Q] + ring + rwa [hcost] at hbudget + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem exists_common_sampled_box {Ω T X I : Type*} + [Fintype Ω] [Nonempty Ω] [Fintype T] [Nonempty T] [Fintype I] [DecidableEq I] + {J : Ω → Type*} [∀ z, Nonempty (J z)] + (μ : FiniteProbabilityWeights Ω) (F : Ω → T → X) + (S : ∀ z, J z → Finset T) (w : ∀ z, J z → T → ℂ) + (e : T → I → ℤ) (he : Function.Injective e) {p : ℝ} (hp : 0 ≤ p) (N : I → ℕ) + (hslice : ∀ z j, IsDenseCommonStrideBox N p ((S z j).image e)) + (hw : ∀ z j t, ‖w z j t‖ ≤ 1) (v : X → ℂ) (hv : ∀ x, ‖v x‖ ≤ 1) + {α ε ρ : ℝ} (hε : 0 < ε) (hρ : 0 ≤ ρ) + (hlarge : ε + Fintype.card I * Real.exp (-p) + ρ < α) + (hmean : α ≤ sampledSliceSeminorm μ F S w v) : + ∃ A : Finset T, A.Nonempty ∧ + (∃ (c : I → ℤ) (m : ℕ) (H : I → ℕ), + 0 < m ∧ (∀ i, 0 < H i) ∧ A.image e = commonStrideBox c m H) ∧ + ∃ G : Finset Ω, ∃ j : ∀ z, J z, + Real.exp (-((5 * p + 20) * Fintype.card I + p + 2)) * + (α - ε - Fintype.card I * Real.exp (-p) - ρ) ≤ μ.mass G ∧ + ∀ z ∈ G, A ⊆ S z (j z) ∧ + 2 * (1 - (A.card : ℝ) / (S z (j z)).card) ≤ Fintype.card I * Real.exp (-p) ∧ + ρ ≤ ‖𝔼 t ∈ A, v (F z t) * w z (j z) t‖ := by + obtain ⟨C, hcount, hshape, hcover⟩ := exists_finite_site_box_inner_family e he hp N + have hS (z) (j) : (S z j).Nonempty := Finset.image_nonempty.mp (hslice z j).nonempty + have hsize (z) (j) : (Fintype.card T : ℝ) / (S z j).card ≤ Fintype.card T := + div_le_self (Nat.cast_nonneg _) (by exact_mod_cast (hS z j).card_pos) + obtain ⟨A, hAC, hAn, G, j, hmass, hlocal⟩ := exists_common_inner_sampled_slice μ F S w + hS hsize hw v hv C hε hρ hlarge (fun z j => hcover (S z j) (hslice z j)) hmean + refine ⟨A, hAn, hshape A hAC hAn, G, j, ?_, hlocal⟩ + have hcard : (0 : ℝ) < C.card := by exact_mod_cast C.card_pos.mpr ⟨A, hAC⟩ + have hfrac := div_le_div_of_nonneg_left + (show 0 ≤ α - ε - Fintype.card I * Real.exp (-p) - ρ by linarith) hcard hcount + have h := hfrac.trans hmass + simpa only [div_eq_mul_inv, ← Real.exp_neg, mul_comm] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SampledDenseCommonBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SampledDenseCommonBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1f83f8e373e1e7f234ee9c1e72a93b379c1c4d5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SampledDenseCommonBox.lean @@ -0,0 +1,70 @@ +import OAI.Combinatorics.Progressions.Estimates.DenseSubboxCost + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem exists_dense_common_sampled_box {Ω T X I : Type*} + [Fintype Ω] [Nonempty Ω] [Fintype T] [Nonempty T] [Fintype I] [DecidableEq I] + {J : Ω → Type*} [∀ z, Nonempty (J z)] + (μ : FiniteProbabilityWeights Ω) (F : Ω → T → X) + (S : ∀ z, J z → Finset T) (w : ∀ z, J z → T → ℂ) + (e : T → I → ℤ) (he : Function.Injective e) {p : ℝ} (hp : 0 ≤ p) (N : I → ℕ) + (hslice : ∀ z j, IsDenseCommonStrideBox N p ((S z j).image e)) + (hw : ∀ z j t, ‖w z j t‖ ≤ 1) (v : X → ℂ) (hv : ∀ x, ‖v x‖ ≤ 1) + {α ε ρ : ℝ} (hε : 0 < ε) (hρ : 0 ≤ ρ) + (hlarge : ε + Fintype.card I * Real.exp (-p) + ρ < α) + (hsmall : Fintype.card I * Real.exp (-p) ≤ 1) + (hmean : α ≤ sampledSliceSeminorm μ F S w v) : + ∃ A : Finset T, A.Nonempty ∧ IsDenseCommonStrideBox N (p + 1) (A.image e) ∧ + ∃ G : Finset Ω, ∃ j : ∀ z, J z, + Real.exp (-((5 * p + 20) * Fintype.card I + p + 2)) * + (α - ε - Fintype.card I * Real.exp (-p) - ρ) ≤ μ.mass G ∧ + ∀ z ∈ G, A ⊆ S z (j z) ∧ + 2 * (1 - (A.card : ℝ) / (S z (j z)).card) ≤ Fintype.card I * Real.exp (-p) ∧ + ρ ≤ ‖𝔼 t ∈ A, v (F z t) * w z (j z) t‖ := by + obtain ⟨A, hAn, hshape, G, j, hmass, hlocal⟩ := exists_common_sampled_box μ F S w e he hp N + hslice hw v hv hε hρ hlarge hmean + have hpos : 0 < μ.mass G := lt_of_lt_of_le (mul_pos (Real.exp_pos _) (by linarith)) hmass + have hGn : G.Nonempty := by + by_contra h + have hz : G = ∅ := Finset.not_nonempty_iff_eq_empty.mp h + simp only [hz, FiniteProbabilityWeights.mass, Finset.sum_empty] at hpos + exact lt_irrefl _ hpos + obtain ⟨z, hz⟩ := hGn + refine ⟨A, hAn, ?_, G, j, hmass, hlocal⟩ + apply (hslice z (j z)).of_large_subbox hshape (Finset.image_subset_image (hlocal z hz).1) + simpa only [Finset.card_image_of_injective _ he] using ((hlocal z hz).2.1.trans hsmall) + +theorem exists_dense_common_sampled_box_of_seminorm {Ω T X I : Type*} + [Fintype Ω] [Nonempty Ω] [Fintype T] [Nonempty T] [Fintype I] [DecidableEq I] + {J : Ω → Type*} [∀ z, Nonempty (J z)] + (μ : FiniteProbabilityWeights Ω) (F : Ω → T → X) + (S : ∀ z, J z → Finset T) (w : ∀ z, J z → T → ℂ) + (e : T → I → ℤ) (he : Function.Injective e) {p : ℝ} (hp : 0 ≤ p) (N : I → ℕ) + (hslice : ∀ z j, IsDenseCommonStrideBox N p ((S z j).image e)) + (hw : ∀ z j t, ‖w z j t‖ ≤ 1) (v : X → ℂ) (hv : ∀ x, ‖v x‖ ≤ 1) + {α : ℝ} (hα : 0 < α) (hαone : α ≤ 1) + (hmesh : Fintype.card I * Real.exp (-p) ≤ α / 8) + (hmean : α ≤ sampledSliceSeminorm μ F S w v) : + ∃ A : Finset T, A.Nonempty ∧ IsDenseCommonStrideBox N (p + 1) (A.image e) ∧ + ∃ G : Finset Ω, ∃ j : ∀ z, J z, + Real.exp (-((5 * p + 20) * Fintype.card I + p + 2)) * (α / 2) ≤ μ.mass G ∧ + ∀ z ∈ G, A ⊆ S z (j z) ∧ α / 4 ≤ ‖𝔼 t ∈ A, v (F z t) * w z (j z) t‖ := by + obtain ⟨A, hAn, hAdense, G, j, hmass, hlocal⟩ := exists_dense_common_sampled_box μ F S w + e he hp N hslice hw v hv (show 0 < α / 8 by positivity) (show 0 ≤ α / 4 by positivity) + (show α / 8 + Fintype.card I * Real.exp (-p) + α / 4 < α by linarith) + (show Fintype.card I * Real.exp (-p) ≤ 1 by linarith) hmean + refine ⟨A, hAn, hAdense, G, j, ?_, fun z hz => ⟨(hlocal z hz).1, (hlocal z hz).2.2⟩⟩ + exact (mul_le_mul_of_nonneg_left (by linarith : α / 2 ≤ + α - α / 8 - Fintype.card I * Real.exp (-p) - α / 4) (Real.exp_nonneg _)).trans hmass + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ScalarBoxGeometry.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarBoxGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..24c06fa4b4ff0f7832521d2a5028b9b6be82d5df --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarBoxGeometry.lean @@ -0,0 +1,74 @@ +import OAI.Combinatorics.Progressions.Lattices.ConcreteAffineMeshBoundary + +namespace OAI + +section + +namespace Erdos3 + +open scoped Classical + +theorem scalarTransfer_parameter_geometry {J : Type*} [Fintype J] + (D : ℕ) (hD : 0 < D) (anchor lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) + {p L : ℝ} (hp : 2 ≤ p) (hL : 1 ≤ L) (hDlog : (D : ℝ) ≤ Real.exp p) + (hpoint : ∀ j t, t ∈ Finset.Ico (lo j) (hi j) → + |((anchor j + (D : ℤ) * t : ℤ) : ℝ)| ≤ Real.exp p * L) : + ∃ R : ℕ, (∀ j, hi j - lo j ≤ (R : ℤ)) ∧ + (R : ℝ) ≤ Real.exp (5 * p) * (L * Real.exp (-(2 * p))) ∧ + (∀ j, |((anchor j + (D : ℤ) * lo j : ℤ) : ℝ) / L| ≤ Real.exp (2 * p)) ∧ + (∀ j, |((anchor j + (D : ℤ) * hi j : ℤ) : ℝ) / L| ≤ Real.exp (2 * p)) := by + have hLpos : 0 < L := by linarith + have hep : 2 ≤ Real.exp p := by linarith [Real.add_one_le_exp p] + have hDF : (D : ℝ) ≤ Real.exp p * L := hDlog.trans (le_mul_of_one_le_right (Real.exp_pos p).le hL) + have he2 : Real.exp (2 * p) = Real.exp p * Real.exp p := by rw [← Real.exp_add]; congr 1; ring + have hdouble : 2 * (Real.exp p * L) ≤ Real.exp (2 * p) * L := by + rw [he2] + nlinarith [mul_le_mul_of_nonneg_right hep (mul_nonneg (Real.exp_pos p).le hLpos.le)] + have hend j := affineIntegerInterval_endpoint_abs D (anchor j) (lo j) (hi j) (hlen j) hDF (hpoint j) + have hlo j : |((anchor j + (D : ℤ) * lo j : ℤ) : ℝ)| ≤ Real.exp (2 * p) * L := by + have hf : 0 ≤ Real.exp p * L := mul_nonneg (Real.exp_pos p).le hLpos.le + exact (hend j).1.trans ((by linarith : Real.exp p * L ≤ 2 * (Real.exp p * L)).trans hdouble) + have hhi j : |((anchor j + (D : ℤ) * hi j : ℤ) : ℝ)| ≤ Real.exp (2 * p) * L := (hend j).2.trans hdouble + obtain ⟨R, hR, hRbound⟩ := exists_integerBox_width_bound lo hi hlen + (by positivity : 0 ≤ 2 * (Real.exp (2 * p) * L)) + (fun j => affineIntegerInterval_width_le D hD (anchor j) (lo j) (hi j) (hlen j) (hlo j) (hhi j)) + refine ⟨R, hR, ?_, ?_, ?_⟩ + · have hmul : Real.exp (5 * p) * (L * Real.exp (-(2 * p))) = Real.exp (3 * p) * L := by + calc + _ = (Real.exp (5 * p) * Real.exp (-(2 * p))) * L := by ring + _ = _ := by rw [← Real.exp_add, show 5 * p + -(2 * p) = 3 * p by ring] + rw [hmul] + have hthree : Real.exp (3 * p) = Real.exp (2 * p) * Real.exp p := by + rw [← Real.exp_add]; congr 1; ring + apply hRbound.trans + rw [hthree] + have hm := mul_le_mul_of_nonneg_right hep (mul_nonneg (Real.exp_pos (2 * p)).le hLpos.le) + nlinarith + · intro j + rw [abs_div, abs_of_pos hLpos] + exact (div_le_iff₀ hLpos).mpr (hlo j) + · intro j + rw [abs_div, abs_of_pos hLpos] + exact (div_le_iff₀ hLpos).mpr (hhi j) + +theorem scalarTransfer_source_endpoints (a b : ℤ) (hab : a < b) + {p q S : ℝ} (hp : 2 ≤ p) (hq : 0 ≤ q) (hS : 1 ≤ S) + (hpoint : ∀ t ∈ Finset.Ico a b, |(t : ℝ)| ≤ Real.exp q * S) : + |(a : ℝ)| ≤ Real.exp (q + p) * S ∧ |(b : ℝ)| ≤ Real.exp (q + p) * S := by + have heq : 1 ≤ Real.exp q := by simpa only [Real.exp_zero] using Real.exp_le_exp.mpr hq + have hep : 2 ≤ Real.exp p := by linarith [Real.add_one_le_exp p] + have hF : (1 : ℝ) ≤ Real.exp q * S := by + simpa only [one_mul] using mul_le_mul heq hS zero_le_one (Real.exp_pos q).le + have hend := affineIntegerInterval_endpoint_abs 1 0 a b hab (by simpa only [Nat.cast_one] using hF) (by simpa only [Nat.cast_one, Int.cast_zero, one_mul, zero_add] using hpoint) + simp only [Nat.cast_one, one_mul, zero_add] at hend + have htwo : 2 * (Real.exp q * S) ≤ Real.exp (q + p) * S := by + rw [Real.exp_add] + have hm := mul_le_mul_of_nonneg_right hep (by positivity : 0 ≤ Real.exp q * S) + nlinarith + exact ⟨hend.1.trans ((by linarith : Real.exp q * S ≤ 2 * (Real.exp q * S)).trans htwo), hend.2.trans htwo⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ScalarCubeCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarCubeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..b34ed8a5256c8d4f4382ec8b381fded2e210ea84 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarCubeCoordinates.lean @@ -0,0 +1,44 @@ +import OAI.Combinatorics.Progressions.Probability.ScalarCubeDomainDensity + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +noncomputable def scalarCubeJoin {α : Type*} (z : (α → ℝ) × ℝ) : Option α → ℝ := + (MeasurableEquiv.piOptionEquivProd (fun _ : Option α => ℝ)).symm z + +theorem scalarCubeJoin_none {α : Type*} (z : (α → ℝ) × ℝ) : scalarCubeJoin z none = z.2 := rfl + +theorem scalarCubeJoin_some {α : Type*} (z : (α → ℝ) × ℝ) (i : α) : + scalarCubeJoin z (some i) = z.1 i := rfl + +theorem scalarCubeJoin_measurable (α : Type*) : Measurable (@scalarCubeJoin α) := + (MeasurableEquiv.piOptionEquivProd (fun _ : Option α => ℝ)).symm.measurable + +theorem scalarCubeJoin_measurePreserving (α : Type*) [Fintype α] : + MeasurePreserving (@scalarCubeJoin α) volume volume := by + refine ⟨scalarCubeJoin_measurable α, ?_⟩ + exact Measure.pi_map_piOptionEquivProd (fun _ : Option α => (volume : Measure ℝ)) + +theorem scalarCubeJoin_value {α : Type*} [Fintype α] [DecidableEq α] + (z : (α → ℝ) × ℝ) (t : Finset α) : + scalarCubeValue (scalarCubeJoin z) t = z.2 + ∑ i ∈ t, z.1 i := by + simp [scalarCubeValue, Fintype.sum_option, booleanFeature, scalarCubeJoin_none, + scalarCubeJoin_some, ite_mul] + +theorem scalarCubeJoin_face {α : Type*} [Fintype α] [DecidableEq α] + (z : (α → ℝ) × ℝ) (i : Bool × Finset α) : + scalarCubeFace i (scalarCubeJoin z) = + if i.1 then 1 - (z.2 + ∑ k ∈ i.2, z.1 k) else z.2 + ∑ k ∈ i.2, z.1 k := by + simp only [scalarCubeFace, scalarCubeJoin_value] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ScalarCubeProductSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarCubeProductSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..861cde9acf4c5c3d778b603362f35ae6b2c52f32 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarCubeProductSupport.lean @@ -0,0 +1,130 @@ +import OAI.Combinatorics.Progressions.Lattices.CubeResidueSupport +import OAI.Combinatorics.Progressions.Probability.SlicedRemainderDensityFamily + +namespace OAI + + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +noncomputable def principalTupleFlatten {D : Type*} [Fintype D] + (B : D → Type*) [∀ d, Fintype (B d)] (h : D → ℕ) (α : Type*) [Fintype α] : + (PrincipalTupleIndex B h → Option α → ℝ) ≃L[ℝ] (JointBlockParameter B h α → ℝ) where + toLinearEquiv := + { toFun := fun x z => x ⟨z.1, z.2.1, z.2.2.1⟩ z.2.2.2 + invFun := fun a j r => a ⟨j.1, j.2.1, j.2.2, r⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl } + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop + +theorem principalTupleFlatten_apply {D : Type*} [Fintype D] + (B : D → Type*) [∀ d, Fintype (B d)] (h : D → ℕ) (α : Type*) [Fintype α] + (x : PrincipalTupleIndex B h → Option α → ℝ) (z : JointBlockParameter B h α) : + principalTupleFlatten B h α x z = x ⟨z.1, z.2.1, z.2.2.1⟩ z.2.2.2 := rfl + +theorem principalTupleFlatten_norm_apply_le {D : Type*} [Fintype D] + (B : D → Type*) [∀ d, Fintype (B d)] (h : D → ℕ) (α : Type*) [Fintype α] + (x : PrincipalTupleIndex B h → Option α → ℝ) : ‖principalTupleFlatten B h α x‖ ≤ ‖x‖ := by + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro z + exact (norm_le_pi_norm (x ⟨z.1, z.2.1, z.2.2.1⟩) z.2.2.2).trans + (norm_le_pi_norm x ⟨z.1, z.2.1, z.2.2.1⟩) + +theorem principalTupleFlatten_lipschitz {D : Type*} [Fintype D] + (B : D → Type*) [∀ d, Fintype (B d)] (h : D → ℕ) (α : Type*) [Fintype α] : + LipschitzWith 1 (principalTupleFlatten B h α) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [NNReal.coe_one, one_mul, dist_eq_norm, dist_eq_norm, ← map_sub] + exact principalTupleFlatten_norm_apply_le B h α (x-y) + +theorem jointBooleanSource_eq_principalTuple_map {D α : Type*} [Fintype D] [Fintype α] + [DecidableEq α] (B : D → Type*) [∀ d, Fintype (B d)] (h : D → ℕ) : + jointBooleanSource (B := B) (α := α) h = + (scalarCubeProductMeasure (PrincipalTupleIndex B h) α).map (principalTupleFlatten B h α) := by + let F : (∀ d, (B d × Fin (h d)) → Option α → ℝ) → (PrincipalTupleIndex B h → Option α → ℝ) := + fun x j => x j.1 j.2 + have hF : Measurable F := + Measurable.of_eval (fun j => (measurable_pi_apply j.2).comp (measurable_pi_apply j.1)) + have ht : (Measure.pi (fun d => scalarCubeProductMeasure (B d × Fin (h d)) α)).map F = + scalarCubeProductMeasure (PrincipalTupleIndex B h) α := + sigmaProductMeasure_flatten (fun _ => scalarCubeMeasure α) + have hblock : Measurable (fun (x : ∀ d, (B d × Fin (h d)) → Option α → ℝ) d => + blockCubeFlatten (B d) (Fin (h d)) α (x d)) := + Measurable.of_eval (fun d => (blockCubeFlatten (B d) (Fin (h d)) α).continuous.measurable.comp + (measurable_pi_apply d)) + rw [jointBooleanSource, sigmaAxisMeasure] + simp_rw [blockCubeMeasure] + rw [← Measure.pi_map_pi (fun d => (blockCubeFlatten (B d) (Fin (h d)) α).continuous.measurable.aemeasurable)] + rw [Measure.map_map (sigmaAxisCoordinates (fun d => BlockParameter (B d) (Fin (h d)) α)).symm.continuous.measurable + hblock] + rw [← ht, Measure.map_map (principalTupleFlatten B h α).continuous.measurable hF] + rfl + +theorem jointBooleanSource_principalTuple_integral {D α : Type*} [Fintype D] [Fintype α] + [DecidableEq α] (B : D → Type*) [∀ d, Fintype (B d)] (h : D → ℕ) + (φ : (JointBlockParameter B h α → ℝ) → ℝ) : + (∫ x, φ x ∂jointBooleanSource h) = + ∫ x, φ (principalTupleFlatten B h α x) ∂scalarCubeProductMeasure (PrincipalTupleIndex B h) α := by + rw [jointBooleanSource_eq_principalTuple_map] + exact (principalTupleFlatten B h α).toHomeomorph.toMeasurableEquiv.measurableEmbedding.integral_map φ + +end Erdos3 + + +namespace Erdos3 + +open MeasureTheory + +theorem integerScalarCubeBox_normalized_norm_le {I : Type*} [Fintype I] {L : ℕ} + (hL : 0 < L) (z : IntegerScalarCubeBox I L) : ‖fun i => (z i : ℝ) / L‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro i + have hz := Finset.mem_Ico.mp (z i).property + have hbound : |(z i : ℝ)| ≤ L := abs_le.mpr + ⟨by exact_mod_cast hz.1, by exact_mod_cast hz.2.le⟩ + rw [Real.norm_eq_abs, abs_div, abs_of_pos (by exact_mod_cast hL : (0 : ℝ) < L)] + exact (div_le_one (by exact_mod_cast hL)).mpr hbound + +theorem integerScalarCubeTuple_normalized_norm_le {J I : Type*} [Fintype J] [Fintype I] + {L : J → ℕ} (hL : ∀ j, 0 < L j) (z : ∀ j, IntegerScalarCubeBox I (L j)) : + ‖fun j i => (z j i : ℝ) / L j‖ ≤ 1 := by + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro j + exact integerScalarCubeBox_normalized_norm_le (hL j) (z j) + +theorem scalarCubeProductMeasure_ae_closedBall (J I : Type*) [Fintype J] [Fintype I] + [DecidableEq I] : ∀ᵐ x ∂scalarCubeProductMeasure J I, x ∈ Metric.closedBall 0 1 := by + filter_upwards [scalarCubeProductMeasure_ae_domain J I] with x hx + rw [Metric.mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro j + apply (pi_norm_le_iff_of_nonneg zero_le_one).mpr + intro i + exact (scalarCubeDomain_coordinate_abs_lt_one (hx j (Set.mem_univ _)) i).le + +theorem principalTuple_normalized_norm_le {D α : Type*} [Fintype D] [Fintype α] + (B : D → Type*) [∀ d, Fintype (B d)] (h : D → ℕ) {L : PrincipalTupleIndex B h → ℕ} + (hL : ∀ j, 0 < L j) (z : ∀ j, IntegerScalarCubeBox α (L j)) : + ‖fun s : JointBlockParameter B h α => + (z ⟨s.1, s.2.1, s.2.2.1⟩ s.2.2.2 : ℝ) / L ⟨s.1, s.2.1, s.2.2.1⟩‖ ≤ 1 := + (principalTupleFlatten_norm_apply_le B h α (fun j i => (z j i : ℝ) / L j)).trans + (integerScalarCubeTuple_normalized_norm_le hL z) + +theorem jointBooleanSource_ae_closedBall {D α : Type*} [Fintype D] [Fintype α] + [DecidableEq α] (B : D → Type*) [∀ d, Fintype (B d)] (h : D → ℕ) : + ∀ᵐ x ∂jointBooleanSource (B := B) (α := α) h, x ∈ Metric.closedBall 0 1 := by + rw [jointBooleanSource_eq_principalTuple_map] + apply (principalTupleFlatten B h α).toHomeomorph.toMeasurableEquiv.measurableEmbedding.ae_map_iff.mpr + filter_upwards [scalarCubeProductMeasure_ae_closedBall (PrincipalTupleIndex B h) α] with x hx + rw [Metric.mem_closedBall, dist_zero_right] at hx ⊢ + exact (principalTupleFlatten_norm_apply_le B h α x).trans hx + +end Erdos3 + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ScalarReferenceNativeDetectionCoordinateEquiv.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarReferenceNativeDetectionCoordinateEquiv.lean new file mode 100644 index 0000000000000000000000000000000000000000..76c1947edefef5faf588e706ace7b3c430b7d3d9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarReferenceNativeDetectionCoordinateEquiv.lean @@ -0,0 +1,503 @@ +import Mathlib.Logic.Equiv.Option +import OAI.Combinatorics.Progressions.Estimates.AllocatedZeroLayerFixedCenterExcess +import OAI.Combinatorics.Progressions.Estimates.SampledNativeDetectionEmptyTags +import OAI.Combinatorics.Progressions.Lattices.SelectedResidueScalarReindex + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical + +private theorem normalizedSliceTest_equiv + {T T' : Type*} [Fintype T] [Fintype T'] + (e : T ≃ T') (S : Finset T) (w : T → ℂ) (t : T) : + normalizedSliceTest (S.map e.toEmbedding) (fun u => w (e.symm u)) (e t) = + normalizedSliceTest S w t := by + simp [normalizedSliceTest, Fintype.card_congr e] + +private theorem sampledSingleSliceSeminorm_equiv + {T T' X : Type*} [Fintype T] [Fintype T'] + (e : T ≃ T') (F : T → X) (S : Finset T) (w : T → ℂ) : + sampledSingleTestSeminorm (fun u => F (e.symm u)) + (normalizedSliceTest (S.map e.toEmbedding) (fun u => w (e.symm u))) = + sampledSingleTestSeminorm F (normalizedSliceTest S w) := by + ext v + change ‖𝔼 u : T', v (F (e.symm u)) * + normalizedSliceTest (S.map e.toEmbedding) (fun t => w (e.symm t)) u‖ = + ‖𝔼 t : T, v (F t) * normalizedSliceTest S w t‖ + congr 1 + symm + apply Fintype.expect_equiv e + intro t + rw [e.symm_apply_apply, normalizedSliceTest_equiv] + +theorem sampledSliceSeminorm_coordinateEquiv + {Ω Ω' T T' X : Type*} [Fintype Ω] [Fintype Ω'] [Fintype T] [Fintype T'] + (e : Ω ≃ Ω') (d : T ≃ T') + (p : FiniteProbabilityWeights Ω) (p' : FiniteProbabilityWeights Ω') + (hweight : ∀ z, p'.weight (e z) = p.weight z) + {Tests : Ω → Type*} (F : Ω → T → X) + (S : ∀ z, Tests z → Finset T) (w : ∀ z, Tests z → T → ℂ) : + sampledSliceSeminorm p' (fun z t => F (e.symm z) (d.symm t)) + (fun z (j : Tests (e.symm z)) => (S (e.symm z) j).map d.toEmbedding) + (fun z j t => w (e.symm z) j (d.symm t)) = + sampledSliceSeminorm p F S w := by + ext v + change p'.mean (fun z => + (⨆ j : Tests (e.symm z), sampledSingleTestSeminorm + (fun t => F (e.symm z) (d.symm t)) + (normalizedSliceTest ((S (e.symm z) j).map d.toEmbedding) + (fun t => w (e.symm z) j (d.symm t)))) v) = + p.mean (fun z => (⨆ j : Tests z, sampledSingleTestSeminorm (F z) + (normalizedSliceTest (S z j) (w z j))) v) + simp_rw [sampledSingleSliceSeminorm_equiv] + unfold FiniteProbabilityWeights.mean + symm + apply Fintype.sum_equiv e + intro z + rw [hweight] + exact congrArg (fun z' => p.weight z * + (⨆ j : Tests z', sampledSingleTestSeminorm (F z') + (normalizedSliceTest (S z' j) (w z' j))) v) (e.symm_apply_apply z).symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {K K' X : Type*} + +def scalarNoiseIndexEquiv (e : K ≃ K') : Option K × X ≃ Option K' × X := + (Equiv.optionCongr e).prodCongr (Equiv.refl X) + +@[simp] theorem scalarNoiseIndexEquiv_none (e : K ≃ K') (x : X) : + scalarNoiseIndexEquiv e (none, x) = (none, x) := rfl + +@[simp] theorem scalarNoiseIndexEquiv_some (e : K ≃ K') (k : K) (x : X) : + scalarNoiseIndexEquiv e (some k, x) = (some (e k), x) := rfl + +@[simp] theorem scalarNoiseIndexEquiv_symm (e : K ≃ K') : + (scalarNoiseIndexEquiv (X := X) e).symm = scalarNoiseIndexEquiv e.symm := rfl + +@[simp] theorem trimmedSpatialWidths_scalarNoiseIndexEquiv + (e : K ≃ K') (B τ : ℝ) (N : X → ℕ) (i : Option K × X) : + trimmedSpatialWidths B τ N (scalarNoiseIndexEquiv e i) = + trimmedSpatialWidths B τ N i := by + rcases i with ⟨k, x⟩ + cases k <;> rfl + +variable [Fintype K] [Fintype K'] [Fintype X] + +noncomputable def scalarNoiseSupportEquiv (e : K ≃ K') (B τ : ℝ) (N : X → ℕ) : + rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1 ≃ + rectangularWeightIndices 0 (trimmedSpatialWidths (K := K') B τ N) 1 where + toFun z := ⟨fun j => z.val ((scalarNoiseIndexEquiv e).symm j), by + apply (mem_rectangularWeightIndices_zero_iff _ _).mpr + intro j + simpa only [scalarNoiseIndexEquiv_symm, + trimmedSpatialWidths_scalarNoiseIndexEquiv] using + (mem_rectangularWeightIndices_zero_iff _ _).mp z.property + ((scalarNoiseIndexEquiv e).symm j)⟩ + invFun z := ⟨fun i => z.val (scalarNoiseIndexEquiv e i), by + apply (mem_rectangularWeightIndices_zero_iff _ _).mpr + intro i + simpa only [trimmedSpatialWidths_scalarNoiseIndexEquiv] using + (mem_rectangularWeightIndices_zero_iff _ _).mp z.property + (scalarNoiseIndexEquiv e i)⟩ + left_inv z := by + apply Subtype.ext + funext i + exact congrArg z.val ((scalarNoiseIndexEquiv e).symm_apply_apply i) + right_inv z := by + apply Subtype.ext + funext j + exact congrArg z.val ((scalarNoiseIndexEquiv e).apply_symm_apply j) + +@[simp] theorem scalarNoiseSupportEquiv_val (e : K ≃ K') (B τ : ℝ) + (N : X → ℕ) + (z : rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1) : + (scalarNoiseSupportEquiv e B τ N z).val = + fun j => z.val ((scalarNoiseIndexEquiv e).symm j) := rfl + +@[simp] theorem scalarNoiseSupportEquiv_symm_val (e : K ≃ K') (B τ : ℝ) + (N : X → ℕ) + (z : rectangularWeightIndices 0 (trimmedSpatialWidths (K := K') B τ N) 1) : + ((scalarNoiseSupportEquiv e B τ N).symm z).val = + fun i => z.val (scalarNoiseIndexEquiv e i) := rfl + +noncomputable def scalarJointPathEquiv (e : K ≃ K') (B τ : ℝ) (N : X → ℕ) + (A : Type*) : + A × rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1 ≃ + A × rectangularWeightIndices 0 (trimmedSpatialWidths (K := K') B τ N) 1 := + (Equiv.refl A).prodCongr (scalarNoiseSupportEquiv e B τ N) + +@[simp] theorem scalarJointPathEquiv_fst (e : K ≃ K') (B τ : ℝ) (N : X → ℕ) + (A : Type*) + (z : A × rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1) : + (scalarJointPathEquiv e B τ N A z).1 = z.1 := rfl + +@[simp] theorem scalarJointPathEquiv_snd_val (e : K ≃ K') (B τ : ℝ) (N : X → ℕ) + (A : Type*) + (z : A × rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1) : + (scalarJointPathEquiv e B τ N A z).2.val = + fun j => z.2.val ((scalarNoiseIndexEquiv e).symm j) := rfl + +namespace BooleanCubeKernel + +omit [Fintype X] in + +theorem jointIntegerPhysicalSite_scalarNoiseIndexEquiv (e : K ≃ K') + (root : K → ℤ) (a : X → ℤ) (z : Option K × X → ℤ) : + jointIntegerPhysicalSite (fun k' => root (e.symm k')) + (a, fun j => z ((scalarNoiseIndexEquiv e).symm j)) = + jointIntegerPhysicalSite root (a, z) := by + funext x + simp only [jointIntegerPhysicalSite, Pi.add_apply, integerPhysicalSite, + scalarNoiseIndexEquiv_symm, scalarNoiseIndexEquiv_none, scalarNoiseIndexEquiv_some] + congr 2 + exact e.symm.sum_comp (fun k => root k * z (some k, x)) + +theorem jointIntegerPhysicalSite_scalarNoiseSupportEquiv (e : K ≃ K') + (B τ : ℝ) (N : X → ℕ) (root : K → ℤ) (a : X → ℤ) + (z : rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1) : + jointIntegerPhysicalSite (fun k' => root (e.symm k')) + (a, (scalarNoiseSupportEquiv e B τ N z).val) = + jointIntegerPhysicalSite root (a, z.val) := + jointIntegerPhysicalSite_scalarNoiseIndexEquiv e root a z.val + +theorem jointIntegerPhysicalSite_scalarJointPathEquiv (e : K ≃ K') + (B τ : ℝ) (N : X → ℕ) (A : Finset (X → ℤ)) (root : K → ℤ) + (z : A × rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1) : + jointIntegerPhysicalSite (fun k' => root (e.symm k')) + ((scalarJointPathEquiv e B τ N A z).1.val, + (scalarJointPathEquiv e B τ N A z).2.val) = + jointIntegerPhysicalSite root (z.1.val, z.2.val) := + jointIntegerPhysicalSite_scalarNoiseIndexEquiv e root z.1.val z.2.val + +end BooleanCubeKernel +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {K K' X : Type*} [Fintype K] [Fintype K'] [Fintype X] + (e : K ≃ K') (B τ : ℝ) (N : X → ℕ) + +local notation "W" => trimmedSpatialWidths (K := K) B τ N +local notation "W'" => trimmedSpatialWidths (K := K') B τ N + +include e in +theorem selectedResidueSmoothMass_scalarCoordinateEquiv : + (∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} W' z) = + ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} W z := + selectedResidueSmoothMass_one_reindex (scalarNoiseIndexEquiv e) W W' + (trimmedSpatialWidths_scalarNoiseIndexEquiv e B τ N) + +variable (hW : ∀ i : Option K × X, 0 < trimmedSpatialWidths B τ N i) + (hW' : ∀ i : Option K' × X, 0 < trimmedSpatialWidths B τ N i) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} + (trimmedSpatialWidths (K := K) B τ N) z) + (hZ' : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} + (trimmedSpatialWidths (K := K') B τ N) z) + +include hW hW' hZ hZ' + +theorem selectedResidueFiniteLaw_scalarCoordinateEquiv_weight + (z : rectangularWeightIndices 0 W 1) : + (selectedResidueFiniteLaw (fun _ : X => 1) {0} W' hW' hZ').weight + (scalarNoiseSupportEquiv e B τ N z) = + (selectedResidueFiniteLaw (fun _ : X => 1) {0} W hW hZ).weight z := by + change selectedResidueSmoothWeight (fun _ : X => 1) {0} W' + (scalarNoiseSupportEquiv e B τ N z).val / + (∑' y, selectedResidueSmoothWeight (fun _ : X => 1) {0} W' y) = + selectedResidueSmoothWeight (fun _ : X => 1) {0} W z.val / + (∑' y, selectedResidueSmoothWeight (fun _ : X => 1) {0} W y) + exact congrArg₂ (fun a b : ℝ => a / b) + (selectedResidueSmoothWeight_one_reindex (scalarNoiseIndexEquiv e) W W' + (trimmedSpatialWidths_scalarNoiseIndexEquiv e B τ N) z.val) + (selectedResidueSmoothMass_scalarCoordinateEquiv e B τ N) + +variable {Y : Type*} (A : Finset Y) (hA : A.Nonempty) + +theorem selectedJointReference_scalarCoordinateEquiv_weight + (z : A × rectangularWeightIndices 0 W 1) : + (selectedJointReference A hA (fun _ : X => 1) {0} W' hW' hZ').weight + (scalarJointPathEquiv e B τ N A z) = + (selectedJointReference A hA (fun _ : X => 1) {0} W hW hZ).weight z := by + change (FiniteProbabilityWeights.uniformFinset A hA).weight z.1 * + (selectedResidueFiniteLaw (fun _ : X => 1) {0} W' hW' hZ').weight + (scalarNoiseSupportEquiv e B τ N z.2) = + (FiniteProbabilityWeights.uniformFinset A hA).weight z.1 * + (selectedResidueFiniteLaw (fun _ : X => 1) {0} W hW hZ).weight z.2 + rw [selectedResidueFiniteLaw_scalarCoordinateEquiv_weight e B τ N hW hW' hZ hZ'] + +theorem selectedJointReference_scalarCoordinateEquiv_mean + (f : A × rectangularWeightIndices 0 W' 1 → ℝ) : + (selectedJointReference A hA (fun _ : X => 1) {0} W hW hZ).mean + (fun z => f (scalarJointPathEquiv e B τ N A z)) = + (selectedJointReference A hA (fun _ : X => 1) {0} W' hW' hZ').mean f := by + unfold FiniteProbabilityWeights.mean + apply Fintype.sum_equiv (scalarJointPathEquiv e B τ N A) + intro z + rw [selectedJointReference_scalarCoordinateEquiv_weight e B τ N hW hW' hZ hZ' A hA] + +theorem selectedJointReference_scalarCoordinateEquiv_complexMean + (f : A × rectangularWeightIndices 0 W' 1 → ℂ) : + (selectedJointReference A hA (fun _ : X => 1) {0} W hW hZ).complexMean + (fun z => f (scalarJointPathEquiv e B τ N A z)) = + (selectedJointReference A hA (fun _ : X => 1) {0} W' hW' hZ').complexMean f := by + unfold FiniteProbabilityWeights.complexMean + apply Fintype.sum_equiv (scalarJointPathEquiv e B τ N A) + intro z + rw [selectedJointReference_scalarCoordinateEquiv_weight e B τ N hW hW' hZ hZ' A hA] + +theorem selectedJointReference_scalarCoordinateEquiv_mass + (retained : Finset (A × rectangularWeightIndices 0 W 1)) : + (selectedJointReference A hA (fun _ : X => 1) {0} W' hW' hZ').mass + (retained.image (scalarJointPathEquiv e B τ N A)) = + (selectedJointReference A hA (fun _ : X => 1) {0} W hW hZ).mass retained := by + classical + unfold FiniteProbabilityWeights.mass + rw [Finset.sum_image (scalarJointPathEquiv e B τ N A).injective.injOn] + apply Finset.sum_congr rfl + intro z _ + exact selectedJointReference_scalarCoordinateEquiv_weight e B τ N hW hW' hZ hZ' A hA z + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +def OrdinarySliceNativeDetection + {m degree : ℕ} {X K Ω : Type} [Fintype X] [DecidableEq X] [Fintype K] [DecidableEq K] [Fintype Ω] + (J : Fin m → Type) [∀ j, Fintype (J j)] + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (sides : K → ℕ) (law : FiniteProbabilityWeights Ω) + (physical : Ω → integerBox sides → X → ℤ) (pSlice pTest pNative α : ℝ) : Prop := + ∀ {Tests : Ω → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] + [∀ z j, LieAlgebra ℚ (Ldetect z j)] {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) degree (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : K => 1)) + (slices : ∀ z, Tests z → Finset (integerBox sides)) + (origin : ∀ z, Tests z → K → ℤ) (step : ∀ z, Tests z → ℕ) + (length : ∀ z, Tests z → K → ℕ), + (∀ z j, 0 < step z j) → + (∀ z j, (slices z j).image Subtype.val = commonStrideBox (origin z j) (step z j) (length z j)) → + (∀ z j, IsDenseCommonStrideBox sides pSlice ((slices z j).image Subtype.val)) → + (∀ z j, (Vdetect z j).ComplexityLE pTest) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + SampledSliceNativeDetection J N hbox poly law physical slices + (fun z j t => star ((Vdetect z j).eval (commonStrideIndex (origin z j) (step z j) t.val))) + degree pNative α + +private theorem niltestSliceSeminorm_coordinateEquiv + {degree : ℕ} {X K K' Ω Ω' : Type} + [Fintype K] [DecidableEq K] [Fintype K'] [DecidableEq K'] + [Fintype Ω] [Fintype Ω'] + (e : K ≃ K') (ep : Ω ≃ Ω') (sides : K → ℕ) + (law : FiniteProbabilityWeights Ω) (law' : FiniteProbabilityWeights Ω') + (hweight : ∀ z, law'.weight (ep z) = law.weight z) + (physical : Ω → integerBox sides → X) + {Tests : Ω → Type} + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] + [∀ z j, LieAlgebra ℚ (Ldetect z j)] {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (D : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) degree (dims z j)) + (V : ∀ z j, (D z j).Niltest (fun _ : K => 1)) + (slices : ∀ z, Tests z → Finset (integerBox sides)) + (origin : ∀ z, Tests z → K → ℤ) (step : ∀ z, Tests z → ℕ) : + sampledSliceSeminorm law' + (fun z t => physical (ep.symm z) ((integerBoxCoordinateEquiv e sides).symm t)) + (fun z (j : Tests (ep.symm z)) => + (slices (ep.symm z) j).map (integerBoxCoordinateEquiv e sides).toEmbedding) + (fun z j t => star (((V (ep.symm z) j).coordinateEquiv e).eval + (commonStrideIndex (integerPointCoordinateEquiv e (origin (ep.symm z) j)) + (step (ep.symm z) j) t.val))) = + sampledSliceSeminorm law physical slices + (fun z j t => star ((V z j).eval (commonStrideIndex (origin z j) (step z j) t.val))) := by + have hcoord (z : Ω') (j : Tests (ep.symm z)) + (t : integerBox (coordinateReindexedSides e sides)) : + ((V (ep.symm z) j).coordinateEquiv e).eval + (commonStrideIndex (integerPointCoordinateEquiv e (origin (ep.symm z) j)) + (step (ep.symm z) j) t.val) = + (V (ep.symm z) j).eval + (commonStrideIndex (origin (ep.symm z) j) (step (ep.symm z) j) + ((integerBoxCoordinateEquiv e sides).symm t).val) := by + rw [RationalFilteredNilmanifold.Niltest.eval_coordinateEquiv] + congr 1 + funext k + simp only [commonStrideIndex, integerPointCoordinateEquiv_apply, + Equiv.symm_apply_apply, integerBoxCoordinateEquiv_symm_val, + integerPointCoordinateEquiv_symm_apply] + simp_rw [hcoord] + exact sampledSliceSeminorm_coordinateEquiv ep (integerBoxCoordinateEquiv e sides) + law law' hweight physical slices + (fun z j t => star ((V z j).eval (commonStrideIndex (origin z j) (step z j) t.val))) + +theorem OrdinarySliceNativeDetection.coordinateReturn + {m degree : ℕ} {X K K' Ω Ω' : Type} + [Fintype X] [DecidableEq X] [Fintype K] [DecidableEq K] + [Fintype K'] [DecidableEq K'] [Fintype Ω] [Fintype Ω'] + (J : Fin m → Type) [∀ j, Fintype (J j)] + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (e : K ≃ K') (ep : Ω ≃ Ω') (sides : K → ℕ) + (law : FiniteProbabilityWeights Ω) (law' : FiniteProbabilityWeights Ω') + (hweight : ∀ z, law'.weight (ep z) = law.weight z) + (physical : Ω → integerBox sides → X → ℤ) + (physical' : Ω' → integerBox (coordinateReindexedSides e sides) → X → ℤ) + (hphysical : ∀ z t, physical' (ep z) (integerBoxCoordinateEquiv e sides t) = physical z t) + (pSlice pTest pNative α : ℝ) + (h : OrdinarySliceNativeDetection (degree := degree) J N hbox poly + (coordinateReindexedSides e sides) law' physical' pSlice pTest pNative α) : + OrdinarySliceNativeDetection (degree := degree) J N hbox poly + sides law physical pSlice pTest pNative α := by + have hphys : physical' = fun z t => + physical (ep.symm z) ((integerBoxCoordinateEquiv e sides).symm t) := by + funext z t + simpa only [Equiv.apply_symm_apply] using + hphysical (ep.symm z) ((integerBoxCoordinateEquiv e sides).symm t) + subst physical' + intro Tests _ Ldetect _ _ dims _ _ _ _ D V slices origin step length + hstep hshape hdense hcomplex hnorm + let es := integerBoxCoordinateEquiv e sides + let slices' := fun z (j : Tests (ep.symm z)) => (slices (ep.symm z) j).map es.toEmbedding + have himage (z : Ω') (j : Tests (ep.symm z)) : + (slices' z j).image Subtype.val = + ((slices (ep.symm z) j).image Subtype.val).image (integerPointCoordinateEquiv e) := by + simp only [slices', Finset.map_eq_image, Equiv.coe_toEmbedding, Finset.image_image] + rfl + have hshape' (z : Ω') (j : Tests (ep.symm z)) : + (slices' z j).image Subtype.val = + commonStrideBox (integerPointCoordinateEquiv e (origin (ep.symm z) j)) + (step (ep.symm z) j) (coordinateReindexedSides e (length (ep.symm z) j)) := by + rw [himage, hshape, commonStrideBox_image_coordinateEquiv] + have hdense' (z : Ω') (j : Tests (ep.symm z)) : + IsDenseCommonStrideBox (coordinateReindexedSides e sides) pSlice + ((slices' z j).image Subtype.val) := by + rw [himage] + exact (hdense (ep.symm z) j).coordinateEquiv e + have hdet := h (fun z j => D (ep.symm z) j) + (fun z j => (V (ep.symm z) j).coordinateEquiv e) slices' + (fun z j => integerPointCoordinateEquiv e (origin (ep.symm z) j)) + (fun z j => step (ep.symm z) j) + (fun z j => coordinateReindexedSides e (length (ep.symm z) j)) + (fun z j => hstep (ep.symm z) j) hshape' hdense' + (fun z j => hcomplex (ep.symm z) j) (fun z j => hnorm (ep.symm z) j) + have hseminorm := niltestSliceSeminorm_coordinateEquiv e ep sides law law' hweight + physical D V slices origin step + + intro signal hsignal hsupp hlarge + exact hdet signal hsignal hsupp (by rw [hseminorm]; exact hlarge) + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +def ScalarReferenceNativeDetection + {m degree : ℕ} {X K : Type} [Fintype X] [DecidableEq X] + [Fintype K] [DecidableEq K] + (J : Fin m → Type) [∀ j, Fintype (J j)] + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (S : ℕ) (W τ : ℝ) + (hbase : (trimmedIntegerBox N (spatialTrimMargin τ N)).Nonempty) + (hW : ∀ z : Option K × X, 0 < trimmedSpatialWidths W τ N z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} + (trimmedSpatialWidths (K := K) W τ N) z) + (pSlice pTest pNative α : ℝ) : Prop := + OrdinarySliceNativeDetection (degree := degree) J N hbox poly (fun _ : K => S) + (selectedJointReference _ hbase (fun _ : X => 1) {0} + (trimmedSpatialWidths W τ N) hW hZ) + (fun z t => jointIntegerPhysicalSite t.val (z.1.val, z.2.val)) + pSlice pTest pNative α + +theorem ScalarReferenceNativeDetection.coordinateReturn + {m degree : ℕ} {X K K' : Type} + [Fintype X] [DecidableEq X] [Fintype K] [DecidableEq K] + [Fintype K'] [DecidableEq K'] + (J : Fin m → Type) [∀ j, Fintype (J j)] + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (e : K ≃ K') (S : ℕ) (W τ : ℝ) + (hbase : (trimmedIntegerBox N (spatialTrimMargin τ N)).Nonempty) + (hW : ∀ z : Option K × X, 0 < trimmedSpatialWidths W τ N z) + (hW' : ∀ z : Option K' × X, 0 < trimmedSpatialWidths W τ N z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} + (trimmedSpatialWidths (K := K) W τ N) z) + (hZ' : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} + (trimmedSpatialWidths (K := K') W τ N) z) + (pSlice pTest pNative α : ℝ) + (h : ScalarReferenceNativeDetection (degree := degree) J N hbox poly S W τ + hbase hW' hZ' pSlice pTest pNative α) : + ScalarReferenceNativeDetection (degree := degree) J N hbox poly S W τ + hbase hW hZ pSlice pTest pNative α := by + exact OrdinarySliceNativeDetection.coordinateReturn J N hbox poly e + (scalarJointPathEquiv e W τ N _) (fun _ : K => S) + (selectedJointReference _ hbase _ _ _ hW hZ) + (selectedJointReference _ hbase _ _ _ hW' hZ') + (selectedJointReference_scalarCoordinateEquiv_weight e W τ N hW hW' hZ hZ' _ hbase) + (fun z t => jointIntegerPhysicalSite t.val (z.1.val, z.2.val)) + (fun z t => jointIntegerPhysicalSite t.val (z.1.val, z.2.val)) + (fun z t => jointIntegerPhysicalSite_scalarJointPathEquiv e W τ N _ t.val z) + pSlice pTest pNative α h + +theorem ScalarReferenceNativeDetection.retag_of_isEmpty + {m m' degree : ℕ} {X K : Type} [Fintype X] [DecidableEq X] + [Fintype K] [DecidableEq K] + (J : Fin m → Type) [∀ j, Fintype (J j)] [IsEmpty (Σ j, J j)] + (J' : Fin m' → Type) [∀ j, Fintype (J' j)] + (N : X → ℕ) (hbox : (integerBox N).Nonempty) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (poly' : ∀ j, VectorPolynomial X ℝ (J' j → ℝ)) + (S : ℕ) (W τ : ℝ) + (hbase : (trimmedIntegerBox N (spatialTrimMargin τ N)).Nonempty) + (hW : ∀ z : Option K × X, 0 < trimmedSpatialWidths W τ N z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight (fun _ : X => 1) {0} + (trimmedSpatialWidths (K := K) W τ N) z) + (pSlice pTest pNative α : ℝ) + (h : ScalarReferenceNativeDetection (degree := degree) J N hbox poly S W τ + hbase hW hZ pSlice pTest pNative α) : + ScalarReferenceNativeDetection (degree := degree) J' N hbox poly' S W τ + hbase hW hZ pSlice pTest pNative α := by + intro Tests _ Ldetect _ _ dims _ _ _ _ D V slices origin step length + hstep hshape hdense hcomplex hnorm + exact (h D V slices origin step length hstep hshape hdense hcomplex hnorm).retag_of_isEmpty + J J' N hbox poly poly' _ _ _ _ degree pNative α + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ScalarSpatialScaleBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarSpatialScaleBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..0df02ae37f3f23248e457606ff5b6018b3709852 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarSpatialScaleBounds.lean @@ -0,0 +1,185 @@ +import OAI.Combinatorics.Progressions.Estimates.RootDifferencePeriod +import OAI.Combinatorics.Progressions.Lattices.SmoothAffinePairLaw + +namespace OAI + + +namespace Erdos3 + +theorem integerColumnEquiv_range {I J K : Type*} [Fintype J] [Fintype K] + (A : Matrix I J ℤ) (e : K ≃ J) : (A.submatrix id e).mulVecLin.range = A.mulVecLin.range := by + rw [Matrix.range_mulVecLin, Matrix.range_mulVecLin] + change Submodule.span ℤ (Set.range (fun k => fun i => A i (e k))) = + Submodule.span ℤ (Set.range (fun j => fun i => A i j)) + congr 1 + ext v + constructor + · rintro ⟨k, hk⟩ + exact ⟨e k, hk⟩ + · rintro ⟨j, hj⟩ + exact ⟨e.symm j, by simpa only [e.apply_symm_apply] using hj⟩ + +theorem selectedSpatial_full_image {I J : Type*} [Fintype I] [Fintype J] + (root : J → ℤ) (D : Matrix I J ℤ) (s : I ↪ J) : + pivotFullImage (selectedSpatialPivot root D s) (selectedSpatialFreeColumns root D s) = + (rootDifferenceMatrix root D).mulVecLin.range := by + rw [pivotFullImage_eq_range, selectedSpatial_fromCols] + exact integerColumnEquiv_range _ _ + +theorem selectedSpatial_extended_period {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] + (root : J → ℤ) (D : Matrix I J ℤ) (s : I ↪ J) (C : Matrix (Unit ⊕ I) N ℤ) + {B : ℕ} (hperiod : HasBoundedScalarPeriod D.mulVecLin.range B) : + HasBoundedScalarPeriod + (pivotFullImage (selectedSpatialPivot root D s) (Matrix.fromCols (selectedSpatialFreeColumns root D s) C)) B := by + obtain ⟨a, ha, haB, hp⟩ := rootDifferenceMatrix_bounded_period root D hperiod + refine ⟨a, ha, haB, ?_⟩ + rw [pivotFullImage_split, selectedSpatial_full_image] + exact hp.trans le_sup_left + +theorem selectedSpatial_extended_index {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] + (root : J → ℤ) (D : Matrix I J ℤ) (s : I ↪ J) (C : Matrix (Unit ⊕ I) N ℤ) + {B : ℕ} (hperiod : HasBoundedScalarPeriod D.mulVecLin.range B) : + (pivotFullImage (selectedSpatialPivot root D s) + (Matrix.fromCols (selectedSpatialFreeColumns root D s) C)).toAddSubgroup.index ≤ + B^(Fintype.card I + 1) := by + simpa only [Fintype.card_sum, Fintype.card_unit, Nat.add_comm] using + hasBoundedScalarPeriod_index_le _ B (selectedSpatial_extended_period root D s C hperiod) + + +theorem goodScalarKernelTuple_spatial_det_ne_zero {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] {L B : ℕ} {κ : ℝ} + (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) + (hκ : 0 < κ) (hx : GoodScalarKernelTuple s κ B x) : + (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s).det ≠ 0 := by + rw [selectedSpatialPivot, rootDifferenceMatrix_det] + intro hz + have h := hx.1 + rw [normalizedScalarCubeMinor, hz, Int.cast_zero, zero_div, abs_zero] at h + exact (not_lt_of_ge hκ.le) h + +theorem scalarSpatialPivot_normalized {I J : Type*} + [Fintype I] [DecidableEq I] {L : ℕ} {H : ℝ} + (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) + (hH : H ≠ 0) (hL : 0 < L) : + normalizedIntegerPivot (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (spatialPivotScale I H L) (fun _ => H) = + rootDifferenceMatrix (fun i => (root (s i) : ℝ) / L) (normalizedScalarCubePivot s x) := by + exact normalized_selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s hH (by exact_mod_cast hL.ne') + +theorem scalarSpatialPivot_coeff_bound {I J : Type*} {L : ℕ} + (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) + (hL : 0 < L) (hroot : ∀ j, |root j| ≤ (L : ℤ)) : + ∀ i j, |(selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s i j : ℤ)| ≤ L := by + rintro (i | i) (j | j) + · cases i; cases j + simpa [selectedSpatialPivot, rootDifferenceMatrix, Matrix.fromBlocks] using + (show (1 : ℤ) ≤ L by exact_mod_cast hL) + · exact hroot (s j) + · change |(0 : ℤ)| ≤ L + simp + · change |(x (s j) (some i) : ℤ)| ≤ L + have hi := Finset.mem_Ico.mp (x (s j) (some i)).property + exact abs_le.mpr ⟨hi.1, hi.2.le⟩ + +theorem scalarSpatialPivot_inverse_bound {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] {L B : ℕ} {κ H : ℝ} + (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) + (hκ : 0 < κ) (hx : GoodScalarKernelTuple s κ B x) (hH : 0 < H) (hL : 0 < L) + (hroot : ∀ j, |root j| ≤ (L : ℤ)) : + ‖(normalizedPivotEquiv (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (goodScalarKernelTuple_spatial_det_ne_zero s x root hκ hx) + (spatialPivotScale I H L) (fun _ => H) (spatialPivotScale_pos I hH (by exact_mod_cast hL)) + (fun _ => hH)).symm.toContinuousLinearMap‖ ≤ + (Fintype.card I + 1 : ℝ) * ((Fintype.card I + 1).factorial : ℝ) / κ := by + have hL' : (0 : ℝ) < L := by exact_mod_cast hL + have hr : ∀ i, |(root (s i) : ℝ) / L| ≤ 1 := by + intro i + rw [abs_div, abs_of_pos hL'] + apply (div_le_one hL').mpr + exact_mod_cast hroot (s i) + let A := normalizedIntegerPivot (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (spatialPivotScale I H L) (fun _ => H) + have ha : ∀ i j, |A i j| ≤ 1 := by + rw [show A = rootDifferenceMatrix (fun i => (root (s i) : ℝ) / L) (normalizedScalarCubePivot s x) from + scalarSpatialPivot_normalized s x root hH.ne' hL] + exact rootDifferenceMatrix_real_bound _ _ le_rfl hr (normalizedScalarCubePivot_entry_bound hL s x) + have hd : κ ≤ |A.det| := by + rw [show A = rootDifferenceMatrix (fun i => (root (s i) : ℝ) / L) (normalizedScalarCubePivot s x) from + scalarSpatialPivot_normalized s x root hH.ne' hL, + rootDifferenceMatrix_det, normalizedScalarCubePivot_det] + exact hx.1.le + have hi := (matrixSupCLM_inverse_norm_le A zero_le_one ha hκ hd).2 + rw [normalizedPivotEquiv_inverse_eq] + simpa only [A, Fintype.card_sum, Fintype.card_unit, Nat.add_comm, Nat.cast_add, Nat.cast_one, + one_pow, mul_one, mul_div_assoc] using hi + + +theorem scalarSpatialFree_scaled_bound {I J : Type*} {L : ℕ} {H : ℝ} + (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) + (hL : 0 < L) (hH : 0 < H) (hroot : ∀ j, |root j| ≤ (L : ℤ)) : + ∀ i j, |(selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s i j : ℝ)| * + (H / L) ≤ H := by + have hL' : (0 : ℝ) < L := by exact_mod_cast hL + intro i j + have hc : |(selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s i j : ℝ)| ≤ L := by + cases i with + | inl i => exact_mod_cast hroot j.val + | inr i => + have hi := Finset.mem_Ico.mp (x j.val (some i)).property + have hb := abs_le.mpr ⟨hi.1, hi.2.le⟩ + exact_mod_cast hb + have h := mul_le_mul_of_nonneg_right hc (div_nonneg hH.le hL'.le) + simpa only [mul_div_cancel₀ _ hL'.ne'] using h + +theorem scalarSpatial_free_norm_bound {I J N : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] [Fintype N] [DecidableEq N] + {L : ℕ} {H ξ : ℝ} (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) + (C : Matrix (Unit ⊕ I) N ℤ) (Q : N → ℝ) + (hL : 0 < L) (hH : 0 < H) (hξ : ξ ≤ 1) (hQ : ∀ j, 0 ≤ Q j) + (hroot : ∀ j, |root j| ≤ (L : ℤ)) (hC : ∀ i j, |(C i j : ℝ)| * Q j ≤ ξ * H) : + ‖matrixSupCLM (normalizedIntegerColumns + (Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s) C) + (Sum.elim (fun _ : UnselectedColumn s => H / L) Q) (fun _ => H))‖ ≤ + Fintype.card (UnselectedColumn s ⊕ N) := by + have hscale : ∀ j, 0 ≤ Sum.elim (fun _ : UnselectedColumn s => H / L) Q j := by + intro j + cases j with + | inl j => exact div_nonneg hH.le (Nat.cast_nonneg _) + | inr j => exact hQ j + have hcolumns : ∀ i j, + |((Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s) C) i j : ℝ)| * + Sum.elim (fun _ : UnselectedColumn s => H / L) Q j ≤ 1 * H := by + intro i j + cases j with + | inl j => + change |(selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s i j : ℝ)| * (H / L) ≤ 1 * H + simpa only [one_mul] using scalarSpatialFree_scaled_bound s x root hL hH hroot i j + | inr j => exact (hC i j).trans (mul_le_mul_of_nonneg_right hξ hH.le) + simpa only [mul_one] using normalizedIntegerColumns_norm_bound _ _ hH zero_le_one hscale hcolumns + + +theorem scalarSpatialPivot_det_bound {I J : Type*} [Fintype I] [DecidableEq I] {L : ℕ} + (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) : + (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s).det.natAbs ≤ + (Fintype.card I).factorial * L^Fintype.card I := by + rw [selectedSpatialPivot, rootDifferenceMatrix_det] + apply integerColumnMinor_det_bound (scalarCubeDifferenceMatrix x) s L + intro i j + have hi := Finset.mem_Ico.mp (x j (some i)).property + have hb := abs_le.mpr ⟨hi.1, hi.2.le⟩ + have hn : (((x j (some i) : ℤ).natAbs : ℕ) : ℤ) ≤ L := by + simpa only [Int.natCast_natAbs] using hb + exact_mod_cast hn + +theorem spatialPivotScale_lower (I : Type*) {H ρ : ℝ} {L : ℕ} + (hH : 0 ≤ H) (hL : 0 < L) (hρ : ρ ≤ H / L) : + ∀ i, ρ ≤ spatialPivotScale I H L i := by + intro i + cases i with + | inl i => + exact hρ.trans (div_le_self hH (by exact_mod_cast hL)) + | inr i => exact hρ + +end Erdos3 + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ScalarSupportTranslationL1.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarSupportTranslationL1.lean new file mode 100644 index 0000000000000000000000000000000000000000..628fbcd4c77d4fe7927f1926afbbb297ebe18298 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ScalarSupportTranslationL1.lean @@ -0,0 +1,66 @@ +import OAI.Combinatorics.Progressions.Lattices.AffineCoefficientLaw + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +theorem scalar_translation_l1_of_support (f : ℝ → ℝ) (c a b : ℝ) {w D : ℝ} + (hw : 0 ≤ w) (hD : 0 ≤ D) (hs : ∀ x, w < |x - c| → f x = 0) + (he : ∀ x, |f (x + a) - f (x + b)| ≤ D) : + (∫ x, |f (x + a) - f (x + b)|) ≤ 4 * w * D := by + let u := fun z => (Metric.closedBall (c - z) w).indicator (fun _ : ℝ => D) + have hi (z : ℝ) : Integrable (u z) := + (integrableOn_const (isCompact_closedBall (c - z) w).measure_lt_top.ne).integrable_indicator + measurableSet_closedBall + have hz (z x : ℝ) (hx : x ∉ Metric.closedBall (c - z) w) : f (x + z) = 0 := by + apply hs + have hd : w < |x - (c - z)| := by + simpa only [Metric.mem_closedBall, Real.dist_eq, not_le] using hx + have harg : x + z - c = x - (c - z) := by ring + rwa [harg] + have hb (x : ℝ) : |f (x + a) - f (x + b)| ≤ u a x + u b x := by + by_cases ha : x ∈ Metric.closedBall (c - a) w <;> + by_cases hb : x ∈ Metric.closedBall (c - b) w + · simp only [u, Set.indicator_of_mem ha, Set.indicator_of_mem hb] + linarith [he x] + · simpa only [u, Set.indicator_of_mem ha, Set.indicator_of_notMem hb, add_zero] using he x + · simpa only [u, Set.indicator_of_notMem ha, Set.indicator_of_mem hb, zero_add] using he x + · simp only [u, Set.indicator_of_notMem ha, Set.indicator_of_notMem hb, + hz a x ha, hz b x hb, sub_self, abs_zero, add_zero, le_refl] + calc + _ ≤ ∫ x, u a x + u b x := integral_mono_of_nonneg + (Filter.Eventually.of_forall (fun x => abs_nonneg _)) ((hi a).add (hi b)) + (Filter.Eventually.of_forall hb) + _ = _ := by + rw [integral_add (hi a) (hi b)] + simp only [u, integral_indicator_const D measurableSet_closedBall, + Real.volume_real_closedBall hw, smul_eq_mul] + ring + +theorem affineProbabilityProfile_translation_l1 (c a b : ℝ) {w : ℝ} (hw : 0 < w) : + (∫ x, |affineProbabilityProfile c w (x + a) - affineProbabilityProfile c w (x + b)|) ≤ + (4 * (probabilityProfileLipschitz : ℝ) / w) * |a - b| := by + let D := w⁻¹ * (probabilityProfileLipschitz : ℝ) * (|a - b| / w) + have he (x : ℝ) : |affineProbabilityProfile c w (x + a) - + affineProbabilityProfile c w (x + b)| ≤ D := by + rw [affineProbabilityProfile, affineProbabilityProfile, ← mul_sub, abs_mul, + abs_of_pos (inv_pos.mpr hw)] + have h := smoothProbabilityProfile_lipschitz.norm_sub_le ((x + a - c) / w) ((x + b - c) / w) + have hd : (x + a - c) / w - (x + b - c) / w = (a - b) / w := by ring + rw [Real.norm_eq_abs, Real.norm_eq_abs, hd, abs_div, abs_of_pos hw] at h + exact (mul_le_mul_of_nonneg_left h (inv_nonneg.mpr hw.le)).trans_eq (by dsimp [D]; ring) + have h := scalar_translation_l1_of_support (affineProbabilityProfile c w) c a b hw.le + (show 0 ≤ D by dsimp [D]; positivity) (affineProbabilityProfile_zero c hw) he + refine h.trans_eq ?_ + dsimp [D] + field_simp [hw.ne'] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SelectedCenteredJointSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SelectedCenteredJointSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff261d72f94376603ac8c1a49436d0d6170a5894 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SelectedCenteredJointSupport.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Probability.PositiveDensityNormalization + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem selectedJointFiniteLaw_support {B K I : Type*} [Fintype K] [Fintype I] + (A : Finset B) (hA : A.Nonempty) + (modulus : I → ℕ) (T : Finset (ColumnResiduePattern K I modulus)) + (W : K × I → ℝ) (hW : ∀ z, 0 < W z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z) + (D : B → (K × I → ℤ) → ℝ) (hD0 : ∀ a z, 0 ≤ D a z) + (hD : 0 < selectedJointDensityMass A modulus T W D) + (z : A × rectangularWeightIndices 0 W 1) + (hz : 0 < (selectedJointFiniteLaw A hA modulus T W hW hZ D hD0 hD).weight z) : + columnResiduePattern modulus z.2.val ∈ T ∧ 0 < D z.1.val z.2.val := by + rw [selectedJointFiniteLaw_weight] at hz + constructor + · by_contra h + rw [selectedResidueSmoothPMF_toReal, selectedResidueSmoothWeight, ite_eq_right h] at hz + simp only [zero_div, mul_zero, zero_mul] at hz + exact (lt_irrefl 0) hz + · apply lt_of_le_of_ne (hD0 _ _) + intro he + rw [← he] at hz + simp only [mul_zero, zero_div] at hz + exact (lt_irrefl 0) hz + +end Erdos3 + +end + +section + +namespace Erdos3 +open MeasureTheory +open scoped Classical + +theorem selectedCenteredJointFiniteLaw_ae_support + {C B K I : Type*} [MeasurableSpace C] [Fintype K] [Fintype I] + (μ : Measure C) (A : Finset B) (hA : A.Nonempty) + (modulus : I → ℕ) (cells : Finset (ColumnResiduePattern K I modulus)) + (W : K × I → ℝ) (hW : ∀ z, 0 < W z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus cells W z) + (D : C → B → (K × I → ℤ) → ℝ) + (hD0 : ∀ c a z, 0 ≤ D c a z) + (hD : ∀ c, 0 < selectedJointDensityMass A modulus cells W (D c)) + [MeasurableSpace (A × rectangularWeightIndices 0 W 1)] + [MeasurableSingletonClass (A × rectangularWeightIndices 0 W 1)] + (hweight : ∀ z, Measurable (fun c => + (selectedJointFiniteLaw A hA modulus cells W hW hZ (D c) (hD0 c) (hD c)).weight z)) : + ∀ᵐ z ∂centeredFiniteProbabilityMeasure μ + (fun c => selectedJointFiniteLaw A hA modulus cells W hW hZ (D c) (hD0 c) (hD c)), + columnResiduePattern modulus z.2.2.val ∈ cells ∧ + 0 < D z.1 z.2.1.val z.2.2.val := by + apply (centeredFiniteProbabilityMeasure_ae_positive_weight μ + (fun c => selectedJointFiniteLaw A hA modulus cells W hW hZ (D c) (hD0 c) (hD c)) + hweight).mono + intro z hz + exact selectedJointFiniteLaw_support A hA modulus cells W hW hZ + (D z.1) (hD0 z.1) (hD z.1) z.2 hz + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SelectedJointSpatialCutoff.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SelectedJointSpatialCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..26f590c9efe55f9a54d753df99f37dab13faa86c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SelectedJointSpatialCutoff.lean @@ -0,0 +1,63 @@ +import OAI.Combinatorics.Progressions.Estimates.SelectedJointWeightedReferenceComparison +import OAI.Combinatorics.Progressions.Lattices.SelectedResidueCutoffDomination + +namespace OAI + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem selectedJointFiniteLaw_spatial_cutoff_bound + {B K I : Type*} [Fintype K] [Fintype I] + (bases : Finset B) (hbases : bases.Nonempty) + (q : I → ℕ) (T : Finset (ColumnResiduePattern K I q)) + (V : K × I → ℝ) (hV : ∀ t, 0 < V t) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight q T V z) + (D : B → (K × I → ℤ) → ℝ) (hD0 : ∀ a z, 0 ≤ D a z) + (hD : 0 < selectedJointDensityMass bases q T V D) + (F : (K × I → ℝ) → ℝ) (hF : ∀ x, F x ∈ Set.Icc (0 : ℝ) 1) + (small large : (K × I → ℤ) → Prop) + (hcut : ∀ z, ‖fun t => (z t : ℝ) / V t‖ ≤ 1 → + (if small z then (1 : ℝ) else 0) ≤ F (fun t => (z t : ℝ) / V t) ∧ + F (fun t => (z t : ℝ) / V t) ≤ if large z then 1 else 0) + {ε η δ : ℝ} + (hprior : (((selectedResidueSmoothPMF q T V hV hZ).map + (fun z => decide (large z))) true).toReal ≤ δ) + (hmass : ∀ a, |selectedResidueDensityMass q T V (D a) - 1| ≤ η) + (htest : ∀ a, + |(∑' z, (selectedResidueSmoothPMF q T V hV hZ z).toReal * + (F (fun t => (z t : ℝ) / V t) * D a z)) - + ∑' z, (selectedResidueSmoothPMF q T V hV hZ z).toReal * + F (fun t => (z t : ℝ) / V t)| ≤ ε) : + (selectedJointFiniteLaw bases hbases q T V hV hZ D hD0 hD).mean + (fun z => if small z.2.val then (1 : ℝ) else 0) ≤ δ + (η + ε) := by + have hdom := FiniteProbabilityWeights.mean_mono_positive_support + (selectedJointFiniteLaw bases hbases q T V hV hZ D hD0 hD) + (f := fun z => if small z.2.val then (1 : ℝ) else 0) + (g := fun z => F (fun t => (z.2.val t : ℝ) / V t)) + (fun z hz => (hcut z.2.val + (selectedJointFiniteLaw_normalized_norm_le q T V bases hbases hV hZ D hD0 hD z hz)).1) + have hcmp := selectedJointFiniteLaw_weighted_reference_real_comparison + bases hbases q T V hV hZ D hD0 hD + (fun _ z => F (fun t => (z t : ℝ) / V t)) + (fun _ z => by rw [abs_of_nonneg (hF _).1]; exact (hF _).2) hmass htest + have href : (selectedJointReference bases hbases q T V hV hZ).mean + (fun z => F (fun t => (z.2.val t : ℝ) / V t)) = + (selectedResidueFiniteLaw q T V hV hZ).mean + (fun z => F (fun t => (z.val t : ℝ) / V t)) := by + change ((FiniteProbabilityWeights.uniformFinset bases hbases).prod + (selectedResidueFiniteLaw q T V hV hZ)).mean _ = _ + rw [FiniteProbabilityWeights.mean_prod] + dsimp only + rw [FiniteProbabilityWeights.mean_const] + rw [href] at hcmp + have hp := (selectedResidueFiniteLaw_cutoff_le_event q T V hV hZ F large + (fun z hz => (hcut z hz).2)).trans hprior + linarith [(abs_le.mp hcmp).2] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SeparatedChartExtension.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SeparatedChartExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1aea3fb8ab11c15a6a19482c20341c4a836c97a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SeparatedChartExtension.lean @@ -0,0 +1,87 @@ +import OAI.Combinatorics.Progressions.Estimates.LipschitzExtensionAlongMap + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem exists_complex_extension_of_distance_bound + {A Y : Type*} [PseudoMetricSpace Y] (embed : A → Y) (f : A → ℂ) (L B : ℝ≥0) + (hf : ∀ a b, dist (f a) (f b) ≤ L * dist (embed a) (embed b)) + (hb : ∀ a, ‖f a‖ ≤ B) : + ∃ g : Y → ℂ, LipschitzWith (2 * L) g ∧ (∀ a, g (embed a) = f a) ∧ + ∀ y, ‖g y‖ ≤ 2 * B := by + classical + let S := Set.range embed + let pre (y : S) : A := Classical.choose y.property + have hpre (y : S) : embed (pre y) = y.val := Classical.choose_spec y.property + have hF : LipschitzWith L (fun y : S => f (pre y)) := by + apply LipschitzWith.of_dist_le_mul + intro y z + have h := hf (pre y) (pre z) + rw [hpre y, hpre z] at h + exact h + obtain ⟨g, hg, heq, hgb⟩ := exists_complex_extension_from_subset S + (fun y => f (pre y)) L B hF (fun y => hb (pre y)) + refine ⟨g, hg, ?_, hgb⟩ + intro a + let y : S := ⟨embed a, ⟨a, rfl⟩⟩ + have hzero : dist (f (pre y)) (f a) ≤ 0 := by + have h := hf (pre y) a + rw [hpre y] at h + simpa only [y, dist_self, mul_zero] using h + exact (heq y).trans (dist_le_zero.mp hzero) + +theorem exists_bounded_extension_on_separated_charts + {A X Y : Type*} [PseudoMetricSpace X] [PseudoMetricSpace Y] + (chart : A → X → Y) (S : Set X) (K D L B : ℝ≥0) + (hwithin : ∀ a x, x ∈ S → ∀ y, y ∈ S → dist x y ≤ K * dist (chart a x) (chart a y)) + (hsep : ∀ a b, a ≠ b → ∀ x, x ∈ S → ∀ y, y ∈ S → + (1 : ℝ) ≤ D * dist (chart a x) (chart b y)) + (f : A → X → ℂ) (hf : ∀ a, LipschitzOnWith L (f a) S) + (hb : ∀ a x, x ∈ S → ‖f a x‖ ≤ B) : + ∃ g : Y → ℂ, LipschitzWith (2 * max (L * K) (2 * B * D)) g ∧ + (∀ a x, x ∈ S → g (chart a x) = f a x) ∧ ∀ y, ‖g y‖ ≤ 2 * B := by + let P := {p : A × X // p.2 ∈ S} + let embed : P → Y := fun p => chart p.val.1 p.val.2 + let F : P → ℂ := fun p => f p.val.1 p.val.2 + let C := max (L * K) (2 * B * D) + have hLC : ((L * K : ℝ≥0) : ℝ) ≤ C := by exact_mod_cast le_max_left (L * K) (2 * B * D) + have hDC : ((2 * B * D : ℝ≥0) : ℝ) ≤ C := by exact_mod_cast le_max_right (L * K) (2 * B * D) + have hF (p q : P) : dist (F p) (F q) ≤ C * dist (embed p) (embed q) := by + rcases p with ⟨⟨a, x⟩, hx⟩ + rcases q with ⟨⟨b, y⟩, hy⟩ + change dist (f a x) (f b y) ≤ C * dist (chart a x) (chart b y) + by_cases hab : a = b + · subst b + calc + _ ≤ (L : ℝ) * dist x y := (hf a).dist_le_mul x hx y hy + _ ≤ (L : ℝ) * (K * dist (chart a x) (chart a y)) := + mul_le_mul_of_nonneg_left (hwithin a x hx y hy) L.coe_nonneg + _ = ((L * K : ℝ≥0) : ℝ) * dist (chart a x) (chart a y) := by + rw [NNReal.coe_mul, mul_assoc] + _ ≤ _ := mul_le_mul_of_nonneg_right hLC dist_nonneg + · have hs := hsep a b hab x hx y hy + have hn : dist (f a x) (f b y) ≤ 2 * (B : ℝ) := by + rw [dist_eq_norm] + exact (norm_sub_le _ _).trans (by linarith [hb a x hx, hb b y hy]) + calc + _ ≤ 2 * (B : ℝ) := hn + _ ≤ (2 * (B : ℝ)) * (D * dist (chart a x) (chart b y)) := by + simpa only [mul_one] using mul_le_mul_of_nonneg_left hs (by positivity : 0 ≤ 2 * (B : ℝ)) + _ = ((2 * B * D : ℝ≥0) : ℝ) * dist (chart a x) (chart b y) := by + simp only [NNReal.coe_mul, NNReal.coe_ofNat] + ring + _ ≤ _ := mul_le_mul_of_nonneg_right hDC dist_nonneg + obtain ⟨g, hg, heq, hgb⟩ := exists_complex_extension_of_distance_bound embed F C B hF + (fun p => hb p.val.1 p.val.2 p.property) + exact ⟨g, hg, fun a x hx => heq ⟨(a, x), hx⟩, hgb⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthAllocatedCanonicalSpatialNativeSource.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthAllocatedCanonicalSpatialNativeSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f399f96850b0170ccde36b55bde8ca45c270691 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthAllocatedCanonicalSpatialNativeSource.lean @@ -0,0 +1,769 @@ +import OAI.Combinatorics.Progressions.Geometry.AllocatedDetectedSpatialNativeSource + +namespace OAI + +section + +namespace Erdos3 + +open BooleanCubeKernel VectorPolynomial +open scoped NNReal + +theorem sharedWidthCanonicalSlicedSpatialChoices {G N X : Type*} + [Fintype G] [Fintype N] [Fintype X] {q m M : ℕ} (selection : Fin q ↪ G) + (hM : 0 < M) {p target : ℝ} (hp : 0 ≤ p) (htarget : 0 ≤ target) + (hm : ((m + 1 : ℕ) : ℝ) ≤ p) (hq : ((q + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hMp : (M : ℝ) ≤ Real.exp p) + {ξ : ℝ} (hξ : 0 < ξ) + (hξle : ξ ≤ normalizedTupleNarrowWidth X N selection M p target) : + ξ ≤ 1 ∧ + ∀ {C₀ W L Cg Centry growth earlyMesh : ℝ}, + 0 ≤ C₀ → 0 ≤ W → 1 ≤ L → 0 ≤ Cg → 0 ≤ Centry → + growth ≤ Real.exp p → W ≤ growth * L → 0 < earlyMesh → + let δ := normalizedTupleRadius X selection M p target W + let ρ := normalizedTupleResolution X N selection M p target C₀ W Cg Centry + let mesh := min (δ / 4) earlyMesh + 0 < δ ∧ δ ≤ 1 ∧ 0 < ρ ∧ 0 < mesh ∧ + mesh ≤ earlyMesh ∧ mesh ≤ δ / 4 ∧ + anisotropicSpatialMeshThreshold selection N C₀ ≤ ρ ∧ + 8 * probabilityProfileLipschitz ≤ ρ ∧ + 2 * Fintype.card (Option (G ⊕ N)) * (2 * Centry) ≤ ρ ∧ + Fintype.card N * (2 * Centry) ≤ δ * ρ ∧ + Cg * (24 * probabilityProfileLipschitz * Fintype.card (Option (G ⊕ N) × X) / ρ) ≤ + normalizedSpatialShare target / 2 ∧ + ∀ (period : ℕ), period ≤ M ^ (m + 1) → + allocatedTupleSpatialError (Fintype.card X) selection N M period C₀ ρ ξ W δ mesh * + coarseReferenceMassConstant q X W L ≤ normalizedSpatialShare target / 2 := by + obtain ⟨hξ1, hchoices⟩ := + sharedWidthNormalizedTupleSpatialChoices (N := N) (X := X) (m := m) selection hM hp htarget + hm hq hG hX hMp hξ hξle + refine ⟨hξ1, ?_⟩ + intro C₀ W L Cg Centry growth earlyMesh hC₀ hW hL hCg hCentry hgrowth hWscale hearlyMesh + δ ρ mesh + obtain ⟨hδ, hδ1, hmesh₀, hρ, hthreshold, hρ8, hshift, hmove, hboundary, hsite⟩ := + hchoices hC₀ hW hL hCg hCentry hgrowth hWscale + have hfine : mesh ≤ δ / 4 := min_le_left _ _ + refine ⟨hδ, hδ1, hρ, lt_min hmesh₀ hearlyMesh, min_le_right _ _, hfine, + hthreshold, hρ8, hshift, hmove, hboundary, ?_⟩ + intro period hperiod + have hmass : 0 ≤ coarseReferenceMassConstant q X W L := by + have hprofile := smoothProbabilityProfile_pos_zero + unfold coarseReferenceMassConstant + positivity + exact (mul_le_mul_of_nonneg_right + (allocatedTupleSpatialError_mono_mesh (Fintype.card X) selection N M period + hC₀ hρ.le hξ.le hW hδ.le hfine) hmass).trans (hsite period hperiod) + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped NNReal + +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)] (U : ∀ j, Submodule ℝ (J j → ℝ)) +variable (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (C V : Fin m → ℝ≥0) + +theorem AllocatedSourceNumerics.shared_width_canonical_spatial_size + {P : ℝ} (hnum : AllocatedSourceNumerics B U b S C V P) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + {X : Type*} [Fintype X] {dim M : ℕ} (selection : Fin dim ↪ G) + {p target Ecap Qstride Etau ξ Bξ : ℝ} + (hp : 0 ≤ p) (htarget : 0 ≤ target) + (hEcap : 0 ≤ Ecap) (hQstride : 0 ≤ Qstride) (hEtau : 0 ≤ Etau) + (hM : 0 < M) (hm : ((m + 1 : ℕ) : ℝ) ≤ p) + (hdim : ((dim + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hMp : (M : ℝ) ≤ Real.exp p) + (hξ : 0 < ξ) (hξB : ξ⁻¹ ≤ Real.exp Bξ) + (stride N : X → ℕ) (hstride : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + {τ : ℝ} (hτ : 0 < τ) (hτinv : τ⁻¹ ≤ Real.exp Etau) + (hside : ∀ i, Real.exp (sharedWidthNormalizedTupleSideLog X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection p target + (allocatedSpatialLateLog (G := G) B P P + Ecap + Qstride + Etau) Bξ) ≤ (N i : ℝ)) : + let W := allocatedPhysicalRootBudget B U b S (fun _ => 0) + let C₀ := 1 + (S.value : ℝ) + W + let Centry := allocatedPhysicalEntryBudget B U b S (fun _ => 0) + ∀ i, 8 * (1 + W) * (stride i : ℝ) * normalizedTupleResolution X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection M p target + C₀ W (Real.exp Ecap) Centry ≤ + (ξ * τ) * (N i : ℝ) := by + intro W C₀ Centry i + obtain ⟨hW, hl₀, _, hC₀, _, _, hC₀l, _, hCentryl, hWl, hprofile⟩ := + hnum.late_bounds B U b S C V hR hσ + let l := allocatedSpatialLateLog (G := G) B P P + Ecap + Qstride + Etau + have hl : 0 ≤ l := by dsimp [l]; linarith only [hl₀, hEcap, hQstride, hEtau] + have hl₀l : allocatedSpatialLateLog (G := G) B P P ≤ l := by + dsimp [l]; linarith only [hEcap, hQstride, hEtau] + have hEcapl : Ecap ≤ l := by dsimp [l]; linarith only [hl₀, hQstride, hEtau] + have hQstridel : Qstride ≤ l := by dsimp [l]; linarith only [hl₀, hEcap, hEtau] + have hEtaul : Etau ≤ l := by dsimp [l]; linarith only [hl₀, hEcap, hQstride] + exact sharedWidthNormalizedTupleSpatialSize X (PrincipalTupleIndex B (layerSamplerDegree I n)) + (m := m) selection hp htarget hl hM hm hdim hG hX hMp + (zero_le_one.trans hC₀) hW (Real.exp_pos _).le + (zero_le_one.trans (allocatedPhysicalEntryBudget_one_le B U b S (fun _ => 0))) + (hC₀l.trans (Real.exp_le_exp.mpr hl₀l)) (hWl.trans (Real.exp_le_exp.mpr hl₀l)) + (Real.exp_le_exp.mpr hEcapl) (hCentryl.trans (Real.exp_le_exp.mpr hl₀l)) + (hprofile.trans (Real.exp_le_exp.mpr hl₀l)) (Nat.cast_nonneg _) + ((hstride i).trans (Real.exp_le_exp.mpr hQstridel)) hτ + (hτinv.trans (Real.exp_le_exp.mpr hEtaul)) hξ hξB (hside i) + +theorem AllocatedSourceNumerics.shared_width_canonical_spatial_choices + {P : ℝ} (hnum : AllocatedSourceNumerics B U b S C V P) + (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) + {X : Type*} [Fintype X] {dim M : ℕ} (selection : Fin dim ↪ G) + {p target Ecap Qstride Etau earlyMesh ξ Bξ : ℝ} + (hp : 0 ≤ p) (htarget : 0 ≤ target) + (hEcap : 0 ≤ Ecap) (hQstride : 0 ≤ Qstride) (hEtau : 0 ≤ Etau) + (hM : 0 < M) (hm : ((m + 1 : ℕ) : ℝ) ≤ p) + (hdim : ((dim + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hMp : (M : ℝ) ≤ Real.exp p) + (hξ : 0 < ξ) + (hξle : ξ ≤ normalizedTupleNarrowWidth X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection M p target) + (hξB : ξ⁻¹ ≤ Real.exp Bξ) + (hvars : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp p) + (hearlyMesh : 0 < earlyMesh) + (stride N : X → ℕ) (hstridepos : ∀ i, 0 < stride i) + (hstride : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + {τ : ℝ} (hτ : 0 < τ) (hτinv : τ⁻¹ ≤ Real.exp Etau) + (hside : ∀ i, Real.exp (sharedWidthNormalizedTupleSideLog X + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection p target + (allocatedSpatialLateLog (G := G) B P P + Ecap + Qstride + Etau) Bξ) ≤ (N i : ℝ)) : + let W := allocatedPhysicalRootBudget B U b S (fun _ => 0) + let C₀ := 1 + (S.value : ℝ) + W + let Centry := allocatedPhysicalEntryBudget B U b S (fun _ => 0) + let δ := normalizedTupleRadius X selection M p target W + let ρ := normalizedTupleResolution X (PrincipalTupleIndex B (layerSamplerDegree I n)) + selection M p target C₀ W (Real.exp Ecap) Centry + let mesh := min (δ / 4) earlyMesh + 0 ≤ W ∧ 1 ≤ C₀ ∧ (S.value : ℝ) ≤ C₀ ∧ W ≤ C₀ ∧ + W ≤ Fintype.card (LayerSamplerVariables G I n B) * (S.value : ℝ) ∧ + 0 < ξ ∧ ξ ≤ 1 ∧ 0 < δ ∧ δ ≤ 1 ∧ 0 < ρ ∧ + 0 < mesh ∧ mesh ≤ earlyMesh ∧ mesh ≤ δ / 4 ∧ + (∀ i, 8 * (1 + W) * (stride i : ℝ) * ρ ≤ (ξ * τ) * (N i : ℝ)) ∧ + anisotropicSpatialMeshThreshold selection (PrincipalTupleIndex B (layerSamplerDegree I n)) C₀ ≤ ρ ∧ + 8 * probabilityProfileLipschitz ≤ ρ ∧ + 2 * (Fintype.card (Option (LayerSamplerVariables G I n B)) * (2 * Centry)) ≤ ρ ∧ + Fintype.card (PrincipalTupleIndex B (layerSamplerDegree I n)) * (2 * Centry) ≤ δ * ρ ∧ + Real.exp Ecap * (24 * probabilityProfileLipschitz * + Fintype.card (Option (LayerSamplerVariables G I n B) × X) / ρ) ≤ normalizedSpatialShare target / 2 ∧ + (∀ period : ℕ, period ≤ M ^ (m + 1) → + allocatedTupleSpatialError (Fintype.card X) selection + (PrincipalTupleIndex B (layerSamplerDegree I n)) M period C₀ ρ ξ W δ mesh * + coarseReferenceMassConstant dim X W S.value ≤ normalizedSpatialShare target / 2) ∧ + let widths := narrowTrimmedSpatialWidths (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξ N + (∀ i, 0 < N i) ∧ (∀ z, 0 < widths z) ∧ + ∀ cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) X stride), + cells.Nonempty → 0 < ∑' z, selectedResidueSmoothWeight stride cells widths z := by + intro W C₀ Centry δ ρ mesh + obtain ⟨hW, _, _, hC₀, hLC, hWC, _⟩ := hnum.late_bounds B U b S C V hR hσ + have hWscale : W ≤ Fintype.card (LayerSamplerVariables G I n B) * (S.value : ℝ) := by + simp only [W, allocatedPhysicalRootBudget, Int.cast_zero, abs_zero, Finset.sum_const_zero, + zero_add, le_refl] + have hL : (1 : ℝ) ≤ S.value := by exact_mod_cast S.positive + obtain ⟨hξ1, hchoices⟩ := sharedWidthCanonicalSlicedSpatialChoices + (N := PrincipalTupleIndex B (layerSamplerDegree I n)) (X := X) (m := m) + selection hM hp htarget hm hdim hG hX hMp hξ hξle + obtain ⟨hδ, hδ1, hρ, hmesh, hmeshEarly, hmeshFine, hthreshold, hρ8, + hshift, hmove, hboundary, hsite⟩ := + hchoices (C₀ := C₀) (W := W) (L := S.value) (Cg := Real.exp Ecap) + (Centry := Centry) (growth := Fintype.card (LayerSamplerVariables G I n B)) + (zero_le_one.trans hC₀) hW hL (Real.exp_pos _).le + (zero_le_one.trans (allocatedPhysicalEntryBudget_one_le B U b S (fun _ => 0))) + hvars hWscale hearlyMesh + have hphysical := hnum.shared_width_canonical_spatial_size B U b S C V hR hσ selection hp htarget + hEcap hQstride hEtau hM hm hdim hG hX hMp hξ hξB stride N hstride hτ hτinv hside + have hN (i) : 0 < N i := by + exact_mod_cast (Real.exp_pos _).trans_le (hside i) + have hwidth := narrowTrimmedSpatialWidths_pos (G := G) + (J := PrincipalTupleIndex B (layerSamplerDegree I n)) hW hτ hξ N hN + refine ⟨hW, hC₀, hLC, hWC, hWscale, hξ, hξ1, hδ, hδ1, hρ, + hmesh, hmeshEarly, hmeshFine, hphysical, hthreshold, hρ8, ?_, hmove, hboundary, hsite, + hN, hwidth, ?_⟩ + · simpa only [mul_assoc] using hshift + · intro cells hcells + exact (exists_selectedResidue_physical_cap (fun _ : LayerSamplerVariables G I n B => 0) + stride hstridepos cells hcells _ hwidth (fun z => hρ8.trans + (narrowTrimmedSpatial_residue_width_lower hW hτ hξ1 hρ.le N stride hN hstridepos + hphysical z))).choose + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +universe uG uI uB uJ uQ +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal +attribute [local irreducible] residueRefinedPeriod + +variable {m : ℕ} {G : Type uG} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type uI} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type uB) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type uJ} [∀ j, Fintype (J j)] (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 {s nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (x : G → IntegerScalarCubeBox (Fin (s + 1)) S.value) +variable {Mk : ℕ} (hMk : 0 < Mk) +variable (selection : Fin (s + 1) ↪ G) +variable (hgood : GoodScalarKernelTuple selection (1 / (Mk : ℝ)) Mk x) +variable (period : ℕ) [NeZero period] (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (hperiodCanonical : period = kernelPeriodCandidate (m + 1) (goodKernelUniformCandidate selection x hgood m)) +variable (modulus : ℕ) +variable (hmodulusRefined : modulus = residueRefinedPeriod period stride) +variable {P : ℝ} (hP : 0 ≤ P) (hMkP : (Mk : ℝ) ≤ Real.exp P) +variable (hRP : ∀ j, R j ≤ Real.exp P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) +variable (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) +variable (hcount : ∀ j : Fin m, (Fintype.card + (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) + 1 ≤ Real.exp P) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type uQ) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable (H₀ step₀ : PrincipalTupleIndex B (layerSamplerDegree I n) → ℕ) +variable (c₀ : PrincipalTupleIndex B (layerSamplerDegree I n) → ℤ) (hH₀ : ∀ t, 0 < H₀ t) +variable (hsubset₀ : ∀ t, integerProgressionSupport (c₀ t) (step₀ t : ℤ) (H₀ t) ⊆ + Finset.Ico (0 : ℤ) (allocatedPrincipalSides B U basis S t : ℤ)) +variable (r₀ : PrincipalTupleIndex B (layerSamplerDegree I n) → Option (Fin (s + 1)) → ZMod modulus) +variable (hcell : 0 < (principalTupleWeights (α := (Fin (s + 1))) B (layerSamplerDegree I n) H₀ hH₀).mass + (Finset.univ.filter (fun y => principalResidueLabel modulus y = r₀))) +local notation "embed" => (fun j : Tuple => (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j) : PrincipalTupleIndex B (layerSamplerDegree I n))) +local notation "H" => (fun j : Tuple => H₀ (embed j)) +local notation "step" => (fun j : Tuple => step₀ (embed j)) +local notation "c" => (fun j : Tuple => c₀ (embed j)) +local notation "hsubset" => (fun j : Tuple => hsubset₀ (embed j)) +local notation "residue" => (fun j : Tuple => r₀ (embed j)) +local notation "GridTuples" => PrincipalAxisTuples (α := (Fin (s + 1))) grid (allocatedPrincipalSides B U basis S) +local notation "wholeLaw" => containedSupportedProgressionLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H₀ step₀ c₀ (allocatedPrincipalSides_pos B U basis S) hH₀ hsubset₀ modulus r₀ hcell +local notation "gridLaw" => containedSupportedProgressionAxisLaw B (layerSamplerDegree I n) + (allocatedPrincipalSides B U basis S) H₀ step₀ c₀ (allocatedPrincipalSides_pos B U basis S) hH₀ hsubset₀ modulus r₀ hcell grid +local notation "wholeRoot" y => allocatedPhysicalCubeRoot B U basis S (fun _ => 0) x y +local notation "wholeDirs" y => allocatedPhysicalCubeDirections B U basis S x y + +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +include hb o bW hperiodCanonical hmodulusRefined μ ν μrows hR hσ hMk hgood hP hMkP hRP hRi hσi hcount in + +theorem exists_allocatedCanonicalSlice_spatial_native_source_sharedWidth + {D target Pk Prho F Qstride : ℝ} + (hdimensions : AllocatedComparisonDimensions (G := G) B (Fin (s + 1)) selectedRows D) + (hPk : 0 ≤ Pk) + (hMkPk : (Mk : ℝ) ≤ Real.exp Pk) + (hPrho : 0 ≤ Prho) + (htarget : 0 ≤ target) + (hF : 0 ≤ F) + (hQstride : 0 ≤ Qstride) + (hstride : ∀ i, 0 < stride i) + (hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (hlength : Real.exp (allocatedAffineLengthLog m D P Prho Pk target F (((m + 1 : ℕ) : ℝ) * Pk + Fintype.card (Fin nX) * Qstride)) ≤ S.value) + {δ η : ℝ} + (ρ : (LayerSamplerAxis I n → Prop) → ℝ≥0) + (t : ℝ) + (htone : t ≤ 1) + (hs : AllocatedAffineCoveredComparison.{uJ, uQ, _, _, _, _, _} (G := G) B rows δ η ρ t htone) + (hρ : 0 < ρ grid) + (hρ1 : ρ grid ≤ 1) + (hσsmall : ∀ j, σ j ≤ t) + (hstep : ∀ j : Tuple, 0 < step j) + (hδ : 0 < δ) + (hδF : δ⁻¹ ≤ Real.exp F) + (hdense : ∀ j : Tuple, δ * L j ≤ ((integerProgressionSupport (c j) (step j : ℤ) (H j)).card : ℝ)) + (hq : Fintype.card (Fin (s + 1)) ≤ m + 1) + (y₀ : PrincipalIntegerTuples B (layerSamplerDegree I n) (Fin (s + 1)) (allocatedPrincipalSides B U basis S)) + (hy₀ : 0 < (wholeLaw).weight y₀) + (T : Fin m → ℝ) + (hT : ∀ j, partitionedIdealRadius (Fin (s + 1)) m + 1 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (s + 1)) * ((Fintype.card (Fin (s + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (C : Fin m → ℝ) + (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) + (hρlog : (ρ grid : ℝ)⁻¹ ≤ Real.exp Prho) + (hη0 : 0 ≤ η) + (hηsmall : η ≤ Real.exp (-(target + 1 + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 4))) + (siteRadius : ℝ≥0) + (hrone : 1 ≤ siteRadius) + (hsitebudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (s + 1))) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4) + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) + (hK : ∀ j, (R j)⁻¹ ≤ K) + (hradius : ∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) + {Pbox Vlog Nlog Mlog baseAmbient : ℝ} + (hPbox : 0 ≤ Pbox) + (hVlog : 0 ≤ Vlog) + (hNlog : 0 ≤ Nlog) + (hMlog : 0 ≤ Mlog) + (hbox : 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp Pbox) + (hvolume : allocatedFullGridNaturalVolume B U basis S rowSets ≤ Real.exp Vlog) + (hnormalizer : ‖((allocatedProductIdealNormalizer B U basis S rowSets : ℝ) : ℂ)⁻¹‖ ≤ Real.exp Nlog) + (hmask : (layerKernelIndexBound m Mk : ℝ) ^ Fintype.card (LayerSamplerAxis I n) * + coefficientDeckPeriodCap selectedRows Q period ≤ Real.exp Mlog) + (hbaseAmbient : 0 ≤ baseAmbient) + (hvbase : Vlog ≤ baseAmbient) + (hnbase : Nlog ≤ baseAmbient) + (hmbase : Mlog ≤ baseAmbient) + (hsites : (Fintype.card (Finset (Fin (s + 1))) : ℝ) ≤ baseAmbient) + (haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ baseAmbient) + (hlabels : (Fintype.card ((∀ j, Fin (n j) → ZMod period) × (∀ j, Q j → ZMod period)) : ℝ) ≤ Real.exp baseAmbient) + (hKbase : (K : ℝ) ≤ Real.exp baseAmbient) + (hcoords : ((∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp baseAmbient) + (hpbase : (period : ℝ) ≤ Real.exp baseAmbient) + (hrowsAmbient : ((∑ j : Fin m, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (houtputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ baseAmbient) + (hheight : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ Real.exp baseAmbient) + (Qgrid : ℝ≥0) + (hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U basis S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U basis S a).1 (allocatedGridIntegerAxis B U basis S a).2) : ℝ) + 1) ≤ Qgrid) + {δg : ℝ} + (hδg : 0 < δg) + (hdenseg : ∀ tg, δg * allocatedPrincipalSides B U basis S tg ≤ (H₀ tg : ℝ)) + (Tg : ℕ) + (hQTg : (((Fintype.card (Fin (s + 1)) + 1) * modulus : ℕ) : ℝ) / δg ≤ Tg) + (hstepAll : ∀ tg, 0 < step₀ tg) + (Ag : ℝ≥0) + (hAg : LipschitzWith Ag Real.smoothTransition) + (Pg : ℝ) + (hPg : 1 ≤ Pg) + (hcP : scalarCubePrimitiveEnvelope Empty Ag 16 (128 * probabilityProfileLipschitz) 1 ≤ Pg) + (hsP : scalarCubePrimitiveEnvelope (Fin (s + 1)) Ag 1 0 modulus ≤ Pg) + (hstrideGrid : ∀ tg, ((step₀ tg * modulus : ℕ) : ℝ) ≤ Pg) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg tg pg : ℝ} + (hDg : 0 ≤ Dg) + (hvg : 0 ≤ vg) + (hwg : 0 ≤ wg) + (htg : 0 ≤ tg) + (hpg : 0 ≤ pg) + (hcube : (Fintype.card (Fin (s + 1)) : ℝ) ≤ Dg) + (hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (hrowsD : ∀ j : Fin m, ((boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card : ℝ) ≤ Dg) + (htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (hRv : ∀ j, R j ≤ Real.exp vg) + (hRiGrid : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (hδw : δg⁻¹ ≤ Real.exp wg) + (hTg : (Tg : ℝ) ≤ Real.exp tg) + (hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (hPp₀ : Pg ≤ Real.exp pg) + (haxesGrid : (Fintype.card {a // grid a} : ℝ) ≤ Dg) + (hfullAxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ Dg) + (hfullOutputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ Dg) + (hambientCount : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ Dg) + (hprofileBudget : (probabilityProfileLipschitz : ℝ) ≤ Dg) + {Banalytic : ℝ} + (hBanalytic : 0 ≤ Banalytic) + (hDanalytic : Dg ≤ Banalytic) + (hcutoffAnalytic : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Banalytic) + (hcoordAnalytic : ((K * ∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp Banalytic) + (hgridAnalytic : (Qgrid : ℝ) ≤ Real.exp Banalytic) + {Pnum : ℝ} + (hPnum : 0 ≤ Pnum) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) + (hn : ∀ j, (n j : ℝ) ≤ Pnum) + (hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Real.exp Pnum) + {gain Pproj coarseTarget Ecoarse pGain : ℝ} + : + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (s + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn), + ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection Mk Pphysical coarseTarget → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + (signal : ((Fin nX) → ℤ) → ℂ), + (∀ u ∈ integerBox N, ‖signal u‖ ≤ 1) → + (∀ u, u ∉ integerBox N → signal u = 0) → + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (s + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,uJ,0} m (s + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (hPhysicalNonneg : 0 ≤ Pphysical) → (hMkPhysicalBound : (Mk : ℝ) ≤ Real.exp Pphysical) → + (hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (hCoarseNonneg : 0 ≤ coarseTarget) → + (hDimPhysicalBound : (((s + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (s + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (s + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (s + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ gain → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj Vproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,uG,uI,uB,uJ} m (s + 1)) + let coverLog := (Pproj + ((s + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (s + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vproj j) → + (∀ j, σ j ≤ 1) → + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (s + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,uJ,0,max uG uI uB} m (s + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vproj j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,uG,uI,uB,uJ} m (s + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,0} m) + Pproj) ≤ (N i : ℝ)) → + cells.Nonempty → ∀ (bases : Finset (Fin nX → ℤ)), bases.Nonempty → + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + gain ≤ ((wholeLaw).complexMean (fun y => allocatedSlicedTupleValue B U basis hb o hR hσ S + (Fin nX) poly hmem N (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW + hτSpatial hξn stride cells hmass bases x y signal)).re → + let C := Classical.choose (exists_canonicalSlicedNative_input_budget m (s + 1) Amass Aanalytic) + let Bbudget := (Pnative + C) ^ C + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{uG,uI,uB,uJ,0,uJ} m (s + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun u : integerBox N => u.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) (integerBox_nonempty N)).correlation + (fun u => signal u.val) (fun u => star (twistData.eval N poly u.val) * Fnative u)‖ := by + subst modulus + intro ambientQ ambientBudget τ Pphysical W ξn hξn hξnLe hW cells poly hp hmem signal hsignal hzero + lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual hσ1 hsmall hXmass hframeMass hstrideMass hτMass + AmassWindow hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj Aproj hSizeProj hRankProj + Pside hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hmass hdetected + Cbudget Bbudget Anorm Anative Abudget budget + have hPproj0 : 0 ≤ Pproj := zero_le_one.trans hPproj + have hPmass : 0 ≤ Pmass := by positivity + have hPside0 : 0 ≤ Pside := hPproj0.trans hProjSide + have hexp := Real.exp_le_exp.mpr hProjSide + have hnumSide : AllocatedSourceNumerics B U basis S Cproj Vproj Pside := + ⟨hPside0, hmProj.trans hProjSide, hKproj.trans hProjSide, hLproj.trans hexp, + fun j => (hRproj j).trans hexp, fun j => (hσproj j).trans hexp, + fun j => (hcountProj j).trans hProjSide, fun j => (hIproj j).trans hProjSide, + fun j => (hnProj j).trans hProjSide, fun j => (hJproj j).trans hProjSide, + hProfileProj.trans hexp, fun j => (hCproj j).trans hexp, fun j => (hVproj j).trans hexp, + hWproj.trans hexp⟩ + have hperiod : period ≤ Mk ^ (m + 1) := by + rw [hperiodCanonical] + exact kernelPeriodCandidate_le _ _ + have hearly := (allocatedEarlyRecenteredMesh_partition_budget m (Fin nX) selection + hPphysical hEcoarseNative.1 hGPhysical hXPhysical hMk hMkPhysical hperiod).1 + have hsideCutoff := (Classical.choose_spec (exists_allocatedCanonicalSpatial_cutoff.{uG,uI,uB,0} m)).2 + (X := Fin nX) B selection hPside0 ⟨hPphysical, hpSide⟩ ⟨hcoarseTarget0, htargetSide⟩ ⟨hPmass, hCapSide⟩ + ⟨hPproj0, hProjSide⟩ ⟨hPproj0, hProjSide⟩ (hDimPhysical.trans hpSide) + (hKproj.trans hProjSide) (hXPhysical.trans hpSide) + have hwidthLog : 0 ≤ normalizedTupleWidthLog + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection Pphysical coarseTarget := by + have hQ := (anisotropicTupleEarlyBudget_bounds + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection hPphysical + (by linarith only [hcoarseTarget0] : 0 ≤ coarseTarget + 3)).1 + have hT := spatialTupleToleranceLog_nonneg hQ + dsimp only [normalizedTupleWidthLog] + linarith only [hQ, hT] + have hactualSide (i) : Real.exp (sharedWidthNormalizedTupleSideLog (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection Pphysical coarseTarget + (allocatedSpatialLateLog (G := G) B Pside Pside + Pmass + Pproj + Pproj) Pproj) + ≤ (N i : ℝ) := by + apply (Real.exp_le_exp.mpr ?_).trans (hside i) + refine le_trans ?_ (add_le_add hsideCutoff (le_refl Pproj)) + dsimp only [sharedWidthNormalizedTupleSideLog, normalizedTupleSideLog] + linarith only [hwidthLog] + obtain ⟨hW', hC₀, hLC, hWC, hWscale, hξ', hξ1, hδpos, hδ1, hρphysical, hfineMesh, + hmeshCoarse, hmeshFine, hsizePhysical, hmeshThreshold, hρ8, hρshift, hρmove, hboundary, hsite, + hN', hwidths, hselectedMass⟩ := + hnumSide.shared_width_canonical_spatial_choices B U basis S Cproj Vproj hR hσ selection + hPphysical hcoarseTarget0 hPmass hPproj0 hPproj0 hMk hmGeometry hDimPhysical hGPhysical hXPhysical + hMkPhysical hξn hξnLe hξProj hvars hearly stride N hstridepos hStrideProj hτ hτProj hactualSide + have hmass' := hselectedMass cells hCells + have hPeriodPhysical : (period : ℝ) ≤ Real.exp (Pphysical ^ 2) := + coefficientErrorPeriod_exp_sq hPphysical hmGeometry hMkPhysical hperiod + have hnative := exists_allocatedCanonicalSlice_projected_native_source + (B := B) (U := U) (basis := basis) (S := S) (hb := hb) (o := o) (bW := bW) + (hR := hR) (hσ := hσ) (Q := Q) (ν := ν) (μ := μ) (μrows := μrows) + (x := x) (hMk := hMk) (selection := selection) (hgood := hgood) + (period := period) (stride := stride) (N := N) (hperiodCanonical := hperiodCanonical) + (modulus := residueRefinedPeriod period stride) (hmodulusRefined := rfl) + (hP := hP) (hMkP := hMkP) (hRP := hRP) (hRi := hRi) (hσi := hσi) (hcount := hcount) + (H₀ := H₀) (step₀ := step₀) (c₀ := c₀) (hH₀ := hH₀) (hsubset₀ := hsubset₀) + (r₀ := r₀) (hcell := hcell) + (hdimensions := hdimensions) + (hPk := hPk) + (hMkPk := hMkPk) + (hPrho := hPrho) + (htarget := htarget) + (hF := hF) + (hQstride := hQstride) + (hstride := hstride) + (hstrideBound := hstrideBound) + (hlength := hlength) + (ρ := ρ) + (t := t) + (htone := htone) + (hs := hs) + (hρ := hρ) + (hρ1 := hρ1) + (hσsmall := hσsmall) + (hstep := hstep) + (hδ := hδ) + (hδF := hδF) + (hdense := hdense) + (hq := hq) + (y₀ := y₀) + (hy₀ := hy₀) + (T := T) + (hT := hT) + (hsource := hsource) + (C := C) + (hC := hC) + (hchart := hchart) + (hbudget := hbudget) + (hρlog := hρlog) + (hη0 := hη0) + (hηsmall := hηsmall) + (siteRadius := siteRadius) + (hrone := hrone) + (hsitebudget := hsitebudget) + (Cforward := Cforward) + (hforward := hforward) + (K := K) + (hK := hK) + (hradius := hradius) + (hPbox := hPbox) + (hVlog := hVlog) + (hNlog := hNlog) + (hMlog := hMlog) + (hbox := hbox) + (hvolume := hvolume) + (hnormalizer := hnormalizer) + (hmask := hmask) + (hbaseAmbient := hbaseAmbient) + (hvbase := hvbase) + (hnbase := hnbase) + (hmbase := hmbase) + (hsites := hsites) + (haxes := haxes) + (hlabels := hlabels) + (hKbase := hKbase) + (hcoords := hcoords) + (hcutoff := hcutoff) + (hpbase := hpbase) + (hrowsAmbient := hrowsAmbient) + (houtputs := houtputs) + (hheight := hheight) + (Qgrid := Qgrid) + (hQgrid := hQgrid) + (hδg := hδg) + (hdenseg := hdenseg) + (Tg := Tg) + (hQTg := hQTg) + (hstepAll := hstepAll) + (Ag := Ag) + (hAg := hAg) + (Pg := Pg) + (hPg := hPg) + (hcP := hcP) + (hsP := hsP) + (hstrideGrid := hstrideGrid) + (hBa := hBa) + (hBi := hBi) + (hDg := hDg) + (hvg := hvg) + (hwg := hwg) + (htg := htg) + (hpg := hpg) + (hcube := hcube) + (hdegree := hdegree) + (hrowsD := hrowsD) + (htail := htail) + (hblocks := hblocks) + (hRv := hRv) + (hRiGrid := hRiGrid) + (hδw := hδw) + (hTg := hTg) + (hcoeff := hcoeff) + (hPp₀ := hPp₀) + (haxesGrid := haxesGrid) + (hfullAxes := hfullAxes) + (hfullOutputs := hfullOutputs) + (hambientCount := hambientCount) + (hprofileBudget := hprofileBudget) + (hBanalytic := hBanalytic) + (hDanalytic := hDanalytic) + (hcutoffAnalytic := hcutoffAnalytic) + (hcoordAnalytic := hcoordAnalytic) + (hgridAnalytic := hgridAnalytic) + (hPnum := hPnum) + (hI := hI) + (hn := hn) + (hcoeffEarly := hcoeffEarly) + (hRiEarly := hRiEarly) + (hVEarly := hVEarly) + (gain := gain) (Pproj := Pproj) (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + (W := W) (τ := τ) (ξn := ξn) + have hnative := hnative hW cells poly hp hmem signal hsignal hzero + (lossTarget := lossTarget) (Pphysical := Pphysical) + (Dphysical := (Fintype.card (LayerSamplerVariables G I n B) : ℝ)) + (Psample := Psample) (Rrank := Rrank) (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ le_rfl hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + have hnative := hnative hwidths hmass' + hξ1 hsizePhysical hρ8 hρshift + hPphysical hMkPhysical hPeriodPhysical hDimPhysical hGPhysical hXPhysical hvars hWscale + hprecision hηprecision hεprecision + hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hξ' hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + have hnative := hnative Cproj Vproj hcoverAmbient hcoverSample hmassSample + hCactual hVactual hσ1 hsmall hXmass hframeMass hstrideMass hτMass + hsizeMass hRrankMass hambMass hjetMass + hρphysical hC₀ hLC hWC hmeshThreshold hδpos.le hρmove hfineMesh + hboundary (hsite period hperiod) hvars hWscale hmeshCoarse + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj hSizeProj hRankProj hCells bases hbases hdetected + exact hnative + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthAllocatedDetectedSpatialNativeSourceGeneral.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthAllocatedDetectedSpatialNativeSourceGeneral.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5fec30e4fdb2d36dc4a20b6867be78b579021e2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthAllocatedDetectedSpatialNativeSourceGeneral.lean @@ -0,0 +1,886 @@ +import OAI.Combinatorics.Progressions.Geometry.SharedWidthAllocatedCanonicalSpatialNativeSource + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +noncomputable abbrev allocatedDetectedGain (s variableCount : ℕ) + (Pdetect : Polynomial ℕ) (p q α : ℝ) : ℝ := + (Real.exp (-((5 * p + 20) * variableCount + p + 2)) * (α / 2)) * + Real.exp (-((q + sampledSupportedSlicedDetectionConstant s Pdetect) ^ + sampledSupportedSlicedDetectionConstant s Pdetect)) ^ (2 ^ (s + 1)) + +noncomputable abbrev allocatedDetectedKernelCutoff (s : ℕ) (G : Type) [Fintype G] + (variableCount : ℕ) (Pdetect : Polynomial ℕ) (p q α : ℝ) : ℕ := + scalarKernelCutoff (Fin (s + 1)) G 1 ⌈Real.exp (p + 1)⌉₊ + (allocatedDetectedGain s variableCount Pdetect p q α / 2) + +variable {m : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {s nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (Pdetect : Polynomial ℕ) (pDetect qDetect α : ℝ) +variable {P : ℝ} (hP : 0 ≤ P) (hMkP : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp P) +variable (hRP : ∀ j, R j ≤ Real.exp P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) +variable (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) +variable (hcount : ∀ j : Fin m, (Fintype.card + (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) + 1 ≤ Real.exp P) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +include hb o bW μ ν μrows hR hσ hP hMkP hRP hRi hσi hcount in + +theorem exists_allocatedDetected_spatial_native_source + (hsm : s ≤ m) + {D target Pk Prho Qstride : ℝ} + (hdimensions : AllocatedComparisonDimensions (G := G) B (Fin (s + 1)) selectedRows D) + (hPk : 0 ≤ Pk) + (hMkPk : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pk) + (hPrho : 0 ≤ Prho) + (htarget : 0 ≤ target) + (hQstride : 0 ≤ Qstride) + (hstride : ∀ i, 0 < stride i) + (hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (hlength : Real.exp (allocatedAffineLengthLog m D P Prho Pk target (pDetect + 1) (((m + 1 : ℕ) : ℝ) * Pk + Fintype.card (Fin nX) * Qstride)) ≤ S.value) + {η : ℝ} + (ρ : (LayerSamplerAxis I n → Prop) → ℝ≥0) + (t : ℝ) + (htone : t ≤ 1) + (hs : AllocatedAffineCoveredComparison.{0, 0, _, _, _, _, _} (G := G) B rows (Real.exp (-(pDetect + 1))) η ρ t htone) + (hρ : 0 < ρ grid) + (hρ1 : ρ grid ≤ 1) + (hσsmall : ∀ j, σ j ≤ t) + (T : Fin m → ℝ) + (hT : ∀ j, partitionedIdealRadius (Fin (s + 1)) m + 1 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (s + 1)) * ((Fintype.card (Fin (s + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (C : Fin m → ℝ) + (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) + (hρlog : (ρ grid : ℝ)⁻¹ ≤ Real.exp Prho) + (hη0 : 0 ≤ η) + (hηsmall : η ≤ Real.exp (-(target + 1 + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 4))) + (siteRadius : ℝ≥0) + (hrone : 1 ≤ siteRadius) + (hsitebudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (s + 1))) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4) + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) + (hK : ∀ j, (R j)⁻¹ ≤ K) + (hradius : ∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) + {Pbox Vlog Nlog Mlog baseAmbient : ℝ} + (hPbox : 0 ≤ Pbox) + (hVlog : 0 ≤ Vlog) + (hNlog : 0 ≤ Nlog) + (hMlog : 0 ≤ Mlog) + (hbox : 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp Pbox) + (hvolume : allocatedFullGridNaturalVolume B U basis S rowSets ≤ Real.exp Vlog) + (hnormalizer : ‖((allocatedProductIdealNormalizer B U basis S rowSets : ℝ) : ℂ)⁻¹‖ ≤ Real.exp Nlog) + (hmaskLog : (Fintype.card (LayerSamplerAxis I n) : ℝ) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * (((m + 1 : ℕ) : ℝ) * Pk)) ≤ Mlog) + (hbaseAmbient : 0 ≤ baseAmbient) + (hvbase : Vlog ≤ baseAmbient) + (hnbase : Nlog ≤ baseAmbient) + (hmbase : Mlog ≤ baseAmbient) + (hsites : (Fintype.card (Finset (Fin (s + 1))) : ℝ) ≤ baseAmbient) + (haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ baseAmbient) + (hlabelLog : (∑ j, (n j : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk)) + + ∑ j, (Fintype.card (Q j) : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk) ≤ baseAmbient) + (hKbase : (K : ℝ) ≤ Real.exp baseAmbient) + (hcoords : ((∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp baseAmbient) + (hperiodLog : ((m + 1 : ℕ) : ℝ) * Pk ≤ baseAmbient) + (hrowsAmbient : ((∑ j : Fin m, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (houtputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ baseAmbient) + (hheight : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ Real.exp baseAmbient) + (Qgrid : ℝ≥0) + (hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U basis S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U basis S a).1 (allocatedGridIntegerAxis B U basis S a).2) : ℝ) + 1) ≤ Qgrid) + (Ag : ℝ≥0) (hAg : LipschitzWith Ag Real.smoothTransition) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg : ℝ} + (hDg : 0 ≤ Dg) + (hvg : 0 ≤ vg) + (hwg : 0 ≤ wg) + (hcube : (Fintype.card (Fin (s + 1)) : ℝ) ≤ Dg) + (hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (hrowsD : ∀ j : Fin m, ((boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card : ℝ) ≤ Dg) + (htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (hRv : ∀ j, R j ≤ Real.exp vg) + (hRiGrid : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (hδw : pDetect + 1 ≤ wg) + (hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (haxesGrid : (Fintype.card {a // grid a} : ℝ) ≤ Dg) + (hfullAxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ Dg) + (hfullOutputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ Dg) + (hambientCount : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ Dg) + (hprofileBudget : (probabilityProfileLipschitz : ℝ) ≤ Dg) + {Banalytic : ℝ} + (hBanalytic : 0 ≤ Banalytic) + (hDanalytic : Dg ≤ Banalytic) + (hcutoffAnalytic : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Banalytic) + (hcoordAnalytic : ((K * ∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp Banalytic) + (hgridAnalytic : (Qgrid : ℝ) ≤ Real.exp Banalytic) + {Pnum : ℝ} + (hPnum : 0 ≤ Pnum) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) + (hn : ∀ j, (n j : ℝ) ≤ Pnum) + (hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Real.exp Pnum) + {Pproj coarseTarget Ecoarse pGain : ℝ} + : + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (s + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + let ξn := normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + (signal : ((Fin nX) → ℤ) → ℂ), + (∀ u ∈ integerBox N, ‖signal u‖ ≤ 1) → + (∀ u, u ∉ integerBox N → signal u = 0) → + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (s + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,0,0} m (s + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (hPhysicalNonneg : 0 ≤ Pphysical) → (hMkPhysicalBound : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pphysical) → + (hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (hCoarseNonneg : 0 ≤ coarseTarget) → + (hDimPhysicalBound : (((s + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (s + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (s + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (s + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let Cgrid := Classical.choose (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (s + 1) Ag) + let Qlog := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let tg := ((s + 1 : ℕ) : ℝ) + Qlog + (pDetect + 1) + 1 + let pg := (Cgrid : ℝ) + (((s + 1) + 1 : ℕ) : ℝ) * Qlog + (pDetect + 1) + 4 + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ (allocatedDetectedGain s (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2 → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj Vproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1)) + let coverLog := (Pproj + ((s + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (s + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vproj j) → + (∀ j, σ j ≤ 1) → + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (s + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,0,0,max 0 0 0} m (s + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vproj j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ≤ (N i : ℝ)) → + cells.Nonempty → ∀ (bases : Finset (Fin nX → ℤ)), (hbases : bases.Nonempty) → + let hξn := normalizedTupleNarrowWidth_pos (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + (htotal : 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem)) → + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW hτSpatial hξn stride cells hmass bases hbases htotal + ∀ {Tdetect : Type} [Fintype Tdetect] [Nonempty Tdetect] + (e : Tdetect → LayerSamplerVariables G I n B → ℤ), Function.Injective e → + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Tdetect) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + 0 ≤ pDetect → 0 ≤ qDetect → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pDetect ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + 0 < α → α ≤ 1 → + Fintype.card (LayerSamplerVariables G I n B) * Real.exp (-pDetect) ≤ α / 8 → + Real.exp (-qDetect) ≤ α / 4 → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + (s + 1) * (s + 3) ≤ Fintype.card G → (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) ≤ S.value → + let C := Classical.choose (exists_canonicalSlicedNative_input_budget m (s + 1) Amass Aanalytic) + let Bbudget := (Pnative + C) ^ C + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{0,0,0,0,0,0} m (s + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun u : integerBox N => u.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) (integerBox_nonempty N)).correlation + (fun u => signal u.val) (fun u => star (twistData.eval N poly u.val) * Fnative u)‖ := by + intro ambientQ ambientBudget τ Pphysical W ξn hW cells poly hp hmem signal hsignal hzero + lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel Cgrid Qlog tg pg p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual hσ1 hsmall hXmass hframeMass hstrideMass hτMass + AmassWindow hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj Aproj hSizeProj hRankProj + Pside hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hξn hmass htotal Path pathLaw + Tdetect _ _ e he Tests _ Ldetect _ _ dims _ _ _ _ Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hpDetect hqDetect hdenseDetect hdimensionDetect hcomplexity hcap + hα hαone hmeshDetect hthreshold hdetected hGdetect hkernel + Cbudget Bbudget Anorm Anative Abudget budget + have hsignalAll (u) : ‖signal u‖ ≤ 1 := by + by_cases hu : u ∈ integerBox N + · exact hsignal u hu + · simp only [hzero u hu, norm_zero, zero_le_one] + have hF : 0 ≤ pDetect + 1 := by positivity + obtain ⟨hδ, _hδ1, hδF, htg, hpg, Tg, hTg, hgrid⟩ := + (Classical.choose_spec (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (s + 1) Ag)).2 + (nX := nX) hPk hQstride hpDetect + have hδw' : (Real.exp (-(pDetect + 1)))⁻¹ ≤ Real.exp wg := + hδF.trans (Real.exp_le_exp.mpr hδw) + have hfound := allocatedOriginalPathLaw_canonical_period_source (s := s) + B U basis hb o hR hσ S (Fin nX) poly hmem N hN hW hτ hξn + stride cells hmass bases hbases htotal Pdetect e he Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices pDetect qDetect hpDetect hqDetect hdenseDetect hdimensionDetect hcomplexity hcap + signal hsignalAll α hα hαone hmeshDetect hthreshold hdetected selection hGdetect hkernel hstridepos + obtain ⟨c₀, step₀, H₀, hstep₀, hH₀, hsubsetAll, hdenseAll, hstepBound, + x, hgood, hMk, hperiodPos, hperiodBound, r₀, hcell, hsubset, hdetectedTuple, + y₀, hy₀, _hyCube, _hyAxis, _hselected⟩ := hfound + let period := kernelPeriodCandidate (m + 1) (goodKernelUniformCandidate selection x hgood m) + have : NeZero period := ⟨hperiodPos.ne'⟩ + let modulus := residueRefinedPeriod period stride + let Hnative := fun j : PrincipalTupleIndex B (layerSamplerDegree I n) => H₀ (Sum.inr j) + let stepnative := fun _ : PrincipalTupleIndex B (layerSamplerDegree I n) => step₀ + let cnative := fun j : PrincipalTupleIndex B (layerSamplerDegree I n) => c₀ (Sum.inr j) + have hHnative (j) : 0 < Hnative j := hH₀ (Sum.inr j) + have hdenseNative (j : Tuple) : + Real.exp (-(pDetect + 1)) * L j ≤ + ((integerProgressionSupport + (c₀ (Sum.inr (Sigma.mk j.1.val j.2))) (step₀ : ℤ) + (H₀ (Sum.inr (Sigma.mk j.1.val j.2)))).card : ℝ) := by + rw [card_integerProgressionSupport _ _ _ hstep₀] + exact hdenseAll (Sum.inr (Sigma.mk j.1.val j.2)) + have hperiodBounds := canonicalPeriod_primitive_bounds + (LayerSamplerAxis I n) n selectedRows Q hMkPk hperiodBound + have hmask := hperiodBounds.2.1.trans (Real.exp_le_exp.mpr hmaskLog) + have hlabels := hperiodBounds.2.2.trans (Real.exp_le_exp.mpr hlabelLog) + have hpbase := hperiodBounds.1.trans (Real.exp_le_exp.mpr hperiodLog) + obtain ⟨hQTg, hPg, hcP, hsP, hstrideGrid⟩ := + hgrid stride hMkPk hperiodPos hperiodBound hstridepos hstrideBound + have hstrideGrid' (j : PrincipalTupleIndex B (layerSamplerDegree I n)) : + ((stepnative j * modulus : ℕ) : ℝ) ≤ Real.exp pg := by + exact hstrideGrid (Y := PrincipalTupleIndex B (layerSamplerDegree I n)) + stepnative (fun _ => hstepBound) j + have hnative := exists_allocatedCanonicalSlice_spatial_native_source + (s := s) (nX := nX) (τ := τ) (Pphysical := Pphysical) (gain := (allocatedDetectedGain s (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2) (Pproj := Pproj) + (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + B U basis hR hσ S x hMk selection hgood period stride N rfl modulus rfl + hP hMkP hRP hRi hσi hcount Q hb o bW Hnative stepnative cnative hHnative hsubset r₀ hcell ν μ μrows + hdimensions hPk hMkPk hPrho htarget hF hQstride hstride hstrideBound hlength + ρ t htone hs hρ hρ1 hσsmall (fun _ => hstep₀) hδ hδF hdenseNative + (by simp only [Fintype.card_fin]; omega) y₀ hy₀ + T hT hsource C hC hchart hbudget hρlog hη0 hηsmall + siteRadius hrone hsitebudget Cforward hforward K hK hradius + hPbox hVlog hNlog hMlog hbox hvolume hnormalizer hmask hbaseAmbient hvbase hnbase hmbase + hsites haxes hlabels hKbase hcoords hcutoff hpbase hrowsAmbient houtputs hheight + Qgrid hQgrid hδ (fun j => hdenseAll (Sum.inr j)) Tg + (by simpa only [Fintype.card_fin] using hQTg) (fun _ => hstep₀) + Ag hAg (Real.exp pg) hPg hcP hsP hstrideGrid' + hBa hBi hDg hvg hwg htg hpg hcube hdegree hrowsD htail hblocks hRv hRiGrid hδw' hTg hcoeff + le_rfl haxesGrid hfullAxes hfullOutputs hambientCount hprofileBudget + hBanalytic hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic + hPnum hI hn hcoeffEarly hRiEarly hVEarly + have hnative := hnative (Pnative := Pnative) cells poly hp hmem signal hsignal hzero + (lossTarget := lossTarget) (Psample := Psample) (Rrank := Rrank) + (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision + have hnative := hnative (Pside := Pside) hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj hcoverAmbient hcoverSample hmassSample hCactual hVactual hσ1 hsmall + hXmass hframeMass hstrideMass hτMass hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj + hProfileProj hCproj hVproj hXproj hFrameProj hStrideProj hτProj hξProj hSizeProj hRankProj + exact hnative hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hmass hdetectedTuple + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +variable {m : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {s nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) [∀ i, NeZero (N i)] +variable (Pdetect : Polynomial ℕ) (pDetect qDetect α : ℝ) +variable {P : ℝ} (hP : 0 ≤ P) (hMkP : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp P) +variable (hRP : ∀ j, R j ≤ Real.exp P) (hRi : ∀ j, (R j)⁻¹ ≤ Real.exp P) +variable (hσi : ∀ j, (σ j)⁻¹ ≤ Real.exp P) +variable (hcount : ∀ j : Fin m, (Fintype.card + (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) + 1 ≤ Real.exp P) + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [CompactSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [MeasurableSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable [BorelSpace (CoefficientTorus (K := Fin (s + 1)) U)] +variable (μrows : Measure (CoefficientTorus (K := Fin (s + 1)) U)) +variable [μrows.IsAddLeftInvariant] [IsProbabilityMeasure μrows] + +variable [MeasurableSpace (SiteTorus (Finset (Fin (s + 1))) U)] +variable [BorelSpace (SiteTorus (Finset (Fin (s + 1))) U)] + +include hb o bW μ ν μrows hR hσ hP hMkP hRP hRi hσi hcount in + +theorem exists_allocatedDetected_spatial_native_source_sharedWidth + (hsm : s ≤ m) + {D target Pk Prho Qstride : ℝ} + (hdimensions : AllocatedComparisonDimensions (G := G) B (Fin (s + 1)) selectedRows D) + (hPk : 0 ≤ Pk) + (hMkPk : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pk) + (hPrho : 0 ≤ Prho) + (htarget : 0 ≤ target) + (hQstride : 0 ≤ Qstride) + (hstride : ∀ i, 0 < stride i) + (hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (hlength : Real.exp (allocatedAffineLengthLog m D P Prho Pk target (pDetect + 1) (((m + 1 : ℕ) : ℝ) * Pk + Fintype.card (Fin nX) * Qstride)) ≤ S.value) + {η : ℝ} + (ρ : (LayerSamplerAxis I n → Prop) → ℝ≥0) + (t : ℝ) + (htone : t ≤ 1) + (hs : AllocatedAffineCoveredComparison.{0, 0, _, _, _, _, _} (G := G) B rows (Real.exp (-(pDetect + 1))) η ρ t htone) + (hρ : 0 < ρ grid) + (hρ1 : ρ grid ≤ 1) + (hσsmall : ∀ j, σ j ≤ t) + (T : Fin m → ℝ) + (hT : ∀ j, partitionedIdealRadius (Fin (s + 1)) m + 1 ≤ T j) + (hsource : ∀ j, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) * + ((2 : ℝ) ^ Fintype.card (Fin (s + 1)) * ((Fintype.card (Fin (s + 1)) : ℝ) + 1) ^ (j.val + 1)) ≤ T j) + (C : Fin m → ℝ) + (hC : ∀ j, 0 ≤ C j) + (hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (hbudget : ∀ j, C j * (((Fintype.card (I j) : ℝ) + 1) * (T j * R j)) ≤ 1 / 4) + (hρlog : (ρ grid : ℝ)⁻¹ ≤ Real.exp Prho) + (hη0 : 0 ≤ η) + (hηsmall : η ≤ Real.exp (-(target + 1 + D * ((m * 2 ^ (m + 1) : ℕ) * Pk) + 4))) + (siteRadius : ℝ≥0) + (hrone : 1 ≤ siteRadius) + (hsitebudget : ∀ j, ((rowSets j).card + 1 : ℝ) * (Fintype.card (Finset (Fin (s + 1))) * + (C j * (((Fintype.card (I j) : ℝ) + 1) * (2 * (siteRadius : ℝ) * R j)))) ≤ 1 / 4) + (Cforward : Fin m → ℝ≥0) + (hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (K : ℝ≥0) + (hK : ∀ j, (R j)⁻¹ ≤ K) + (hradius : ∀ j, (rowSets j).card * T j ≤ (siteRadius : ℝ)) + {Pbox Vlog Nlog Mlog baseAmbient : ℝ} + (hPbox : 0 ≤ Pbox) + (hVlog : 0 ≤ Vlog) + (hNlog : 0 ≤ Nlog) + (hMlog : 0 ≤ Mlog) + (hbox : 2 * (allocatedRowSlicedSiteRadius rowSets : ℝ) ≤ Real.exp Pbox) + (hvolume : allocatedFullGridNaturalVolume B U basis S rowSets ≤ Real.exp Vlog) + (hnormalizer : ‖((allocatedProductIdealNormalizer B U basis S rowSets : ℝ) : ℂ)⁻¹‖ ≤ Real.exp Nlog) + (hmaskLog : (Fintype.card (LayerSamplerAxis I n) : ℝ) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * (((m + 1 : ℕ) : ℝ) * Pk)) ≤ Mlog) + (hbaseAmbient : 0 ≤ baseAmbient) + (hvbase : Vlog ≤ baseAmbient) + (hnbase : Nlog ≤ baseAmbient) + (hmbase : Mlog ≤ baseAmbient) + (hsites : (Fintype.card (Finset (Fin (s + 1))) : ℝ) ≤ baseAmbient) + (haxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ baseAmbient) + (hlabelLog : (∑ j, (n j : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk)) + + ∑ j, (Fintype.card (Q j) : ℝ) * (((m + 1 : ℕ) : ℝ) * Pk) ≤ baseAmbient) + (hKbase : (K : ℝ) ≤ Real.exp baseAmbient) + (hcoords : ((∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp baseAmbient) + (hperiodLog : ((m + 1 : ℕ) : ℝ) * Pk ≤ baseAmbient) + (hrowsAmbient : ((∑ j : Fin m, ((rowSets j).card : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp baseAmbient) + (houtputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ baseAmbient) + (hheight : (S.value : ℝ) ^ (layerTailDegree m + 1) ≤ Real.exp baseAmbient) + (Qgrid : ℝ≥0) + (hQgrid : ∀ a : {a // allocatedGridAxis (I := I) U basis S.value a}, + 8 * ((Finset.card (layerIntegerPrincipalSlots (G := G) B + (allocatedGridIntegerAxis B U basis S a).1 (allocatedGridIntegerAxis B U basis S a).2) : ℝ) + 1) ≤ Qgrid) + (Ag : ℝ≥0) (hAg : LipschitzWith Ag Real.smoothTransition) + (hBa : ∀ j i, positiveModerateSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((layerTailDegree m + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + (hBi : ∀ j i, uniformSpectrumBlockCount j.val (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card + ((j.val + 1) * (boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card) ≤ Fintype.card (B ⟨j,Sum.inr i⟩)) + {Dg vg wg : ℝ} + (hDg : 0 ≤ Dg) + (hvg : 0 ≤ vg) + (hwg : 0 ≤ wg) + (hcube : (Fintype.card (Fin (s + 1)) : ℝ) ≤ Dg) + (hdegree : ∀ j : Fin m, ((j.val + 1 : ℕ) : ℝ) ≤ Dg) + (hrowsD : ∀ j : Fin m, ((boundedBooleanJetRows (Fin (s + 1)) (j.val + 1)).card : ℝ) ≤ Dg) + (htail : ((layerTailDegree m + 1 : ℕ) : ℝ) ≤ Dg) + (hblocks : ∀ j i, (Fintype.card (B ⟨j, Sum.inr i⟩) : ℝ) ≤ Dg) + (hRv : ∀ j, R j ≤ Real.exp vg) + (hRiGrid : ∀ j, (R j)⁻¹ ≤ Real.exp vg) + (hδw : pDetect + 1 ≤ wg) + (hcoeff : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Real.exp vg) + (haxesGrid : (Fintype.card {a // grid a} : ℝ) ≤ Dg) + (hfullAxes : (Fintype.card (LayerSamplerAxis I n) : ℝ) ≤ Dg) + (hfullOutputs : (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1) : ℝ) ≤ Dg) + (hambientCount : ((∑ j, Fintype.card (J j) : ℕ) : ℝ) ≤ Dg) + (hprofileBudget : (probabilityProfileLipschitz : ℝ) ≤ Dg) + {Banalytic : ℝ} + (hBanalytic : 0 ≤ Banalytic) + (hDanalytic : Dg ≤ Banalytic) + (hcutoffAnalytic : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Banalytic) + (hcoordAnalytic : ((K * ∑ j, Cforward j * Fintype.card (J j) : ℝ≥0) : ℝ) ≤ Real.exp Banalytic) + (hgridAnalytic : (Qgrid : ℝ) ≤ Real.exp Banalytic) + {Pnum : ℝ} + (hPnum : 0 ≤ Pnum) + (hI : ∀ j, (Fintype.card (I j) : ℝ) ≤ Pnum) + (hn : ∀ j, (n j : ℝ) ≤ Pnum) + (hcoeffEarly : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent + (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pnum) + (hRiEarly : ∀ j, (R j)⁻¹ ≤ Real.exp Pnum) + (hVEarly : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Real.exp Pnum) + {Pproj coarseTarget Ecoarse pGain : ℝ} + : + let ambientQ := idealSiteLogBudget (Fintype.card (Σ a : LayerSamplerAxis I n, selectedRows a.1)) (Fintype.card (Fin (s + 1))) + (Pbox + Prho + Vlog + Nlog + Mlog + target) + let ambientBudget := affineAmbientPrimitiveBudget baseAmbient ambientQ + ∀ {τ Pphysical : ℝ}, + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn), ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) Pphysical coarseTarget → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + (signal : ((Fin nX) → ℤ) → ℂ), + (∀ u ∈ integerBox N, ‖signal u‖ ≤ 1) → + (∀ u, u ∉ integerBox N → signal u = 0) → + ∀ {lossTarget Psample Rrank Sstride εsample ηsample : ℝ}, + (∀ i, 0 < stride i) → (∀ i, 0 < N i) → (hτSpatial : 0 < τ) → + 0 ≤ Psample → (Fintype.card (Fin nX) : ℝ) ≤ Psample → + (Fintype.card (Option (Fin (s + 1)) × (Fin nX)) : ℝ) ≤ Psample → + 0 ≤ Sstride → Sstride ≤ Real.exp Psample → 0 < εsample → + 1 / τ ≤ Real.exp Psample → 1 / εsample ≤ Real.exp Psample → + (∀ i, (stride i : ℝ) ≤ Sstride) → + let A := Classical.choose (exists_translated_physical_jet_l1_perturbation.{0,0,0} m (s + 1)) + (∀ i, Real.exp ((Psample + A) ^ A) ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp ((Psample + A) ^ A) ≤ Rrank → + 0 < ηsample → (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Psample → + ambientBudget ≤ Psample → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Psample → + ηsample⁻¹ ≤ Real.exp Psample → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + (hPhysicalNonneg : 0 ≤ Pphysical) → (hMkPhysicalBound : ((allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) : ℝ) ≤ Real.exp Pphysical) → + (hmPhysicalBound : ((m + 1 : ℕ) : ℝ) ≤ Pphysical) → (hCoarseNonneg : 0 ≤ coarseTarget) → + (hDimPhysicalBound : (((s + 1) + 1 : ℕ) : ℝ) ≤ Pphysical) → + (hGPhysicalBound : (Fintype.card G : ℝ) ≤ Pphysical) → + (hXPhysicalBound : (Fintype.card (Fin nX) : ℝ) ≤ Pphysical) → + lossTarget + coefficientErrorSpatialLog Pphysical + 8 ≤ target → + ηsample ≤ Real.exp (-target) → εsample ≤ Real.exp (-target) → + let Amass := Classical.choose (exists_allocatedAffineModelMass_budget m (s + 1)) + let Aanalytic := Classical.choose (exists_allocatedAffineAnalytic_budget m (s + 1)) + let Fmodel := (m * (2 : ℝ) ^ Fintype.card (Fin (s + 1))) * (Pnum + 8) * (1 + 4 * Pnum) + + Fintype.card (LayerSamplerAxis I n) * ((m * 2 ^ (m + 1) : ℕ) * Pk) + + ∑ j, (Fintype.card (Q j) : ℝ) * (Fintype.card (selectedRows j) * ((m + 1 : ℕ) * Pk)) + let Cgrid := Classical.choose (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (s + 1) Ag) + let Qlog := ((m + 1 : ℕ) : ℝ) * Pk + nX * Qstride + let tg := ((s + 1 : ℕ) : ℝ) + Qlog + (pDetect + 1) + 1 + let pg := (Cgrid : ℝ) + (((s + 1) + 1 : ℕ) : ℝ) * Qlog + (pDetect + 1) + 4 + let p := slicedGridGeometryLog Dg vg wg tg + pg + ∀ {Pnative : ℝ}, 0 ≤ Pnative → + Dg ∈ Set.Icc 0 Pnative → p ∈ Set.Icc 0 Pnative → vg ∈ Set.Icc 0 Pnative → + Fmodel ∈ Set.Icc 0 Pnative → Prho ∈ Set.Icc 0 Pnative → Pk ∈ Set.Icc 0 Pnative → + target ∈ Set.Icc 0 Pnative → Banalytic ∈ Set.Icc 0 Pnative → + Pphysical ∈ Set.Icc 0 Pnative → Ecoarse ∈ Set.Icc 0 Pnative → pGain ∈ Set.Icc 0 Pnative → + (∀ i, (stride i : ℝ) ≤ Real.exp Pphysical) → + 1 / τ ≤ Real.exp Pphysical → + Real.exp (-pGain) / 2 ≤ (allocatedDetectedGain s (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2 → + pGain + 32 ≤ Pproj → pGain + 32 ≤ coarseTarget → + pGain + 32 ≤ Ecoarse → pGain + 32 ≤ lossTarget → + ∀ (Cproj Vproj : Fin m → ℝ≥0), + let Acover := Classical.choose (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1)) + let coverLog := (Pproj + ((s + 1) + 2 : ℕ) + Acover) ^ Acover + let Asample := Classical.choose (exists_allocatedCanonicalProjection_composed_budget m (s + 1) Acover) + let Pmass := (Pproj + Asample) ^ Asample + coverLog ≤ baseAmbient → coverLog ≤ Psample → Pmass ≤ Psample → + (∀ j z, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) z‖ ≤ Cproj j * ‖z‖) → + (∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vproj j) → + (∀ j, σ j ≤ 1) → + (∀ j, C j * ((Fintype.card (I j) : ℝ) + 1) * R j ≤ 1 / 4) → + (Fintype.card (Fin nX) : ℝ) ≤ Pmass → + (Fintype.card (Option (Fin (s + 1)) × Fin nX) : ℝ) ≤ Pmass → + (∀ i, (stride i : ℝ) ≤ Real.exp Pmass) → 1 / τ ≤ Real.exp Pmass → + let AmassWindow := Classical.choose (exists_translated_physical_jet_density_window_mass.{0,0,0,max 0 0 0} m (s + 1)) + (∀ i, Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ (N i : ℝ)) → + Real.exp ((Pmass + AmassWindow) ^ AmassWindow) ≤ Rrank → + (Fintype.card (CoefficientAmbientIndex (Fin (s + 1)) J) : ℝ) ≤ Pmass → + ((∑ j : Fin m, (Fintype.card (BoundedCoefficientExponent (Fin (s + 1)) (j.val + 1)) : ℝ≥0) : ℝ≥0) : ℝ) ≤ Real.exp Pmass → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Real.exp Pphysical → + 1 ≤ Pproj → (m : ℝ) ≤ Pproj → + (Fintype.card G : ℝ) ≤ Pproj → (S.value : ℝ) ≤ Real.exp Pproj → + ((m + 1 : ℕ) : ℝ) * Pk ≤ Pproj → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pproj → W ≤ Real.exp Pproj → + (∀ j, (R j)⁻¹ ≤ Real.exp Pproj) → (∀ j, (σ j)⁻¹ ≤ Real.exp Pproj) → + (∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1)) : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (I j) : ℝ) ≤ Pproj) → (∀ j, (n j : ℝ) ≤ Pproj) → + (∀ j, (Fintype.card (J j) : ℝ) ≤ Pproj) → + (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pproj → + (∀ j, (Cproj j : ℝ) ≤ Real.exp Pproj) → (∀ j, (Vproj j : ℝ) ≤ Real.exp Pproj) → + (Fintype.card (Fin nX) : ℝ) ≤ Pproj → + (Fintype.card (Option (LayerSamplerVariables G I n B) × Fin nX) : ℝ) ≤ Pproj → + (∀ i, (stride i : ℝ) ≤ Real.exp Pproj) → τ⁻¹ ≤ Real.exp Pproj → ξn⁻¹ ≤ Real.exp Pproj → + let Aproj := Classical.choose (Classical.choose_spec + (exists_allocated_canonical_constructed_projection.{0,0,0,0,0} m (s + 1))) + (∀ i, Real.exp ((Pproj + Aproj) ^ Aproj) ≤ (N i : ℝ)) → + Real.exp ((Pproj + Aproj) ^ Aproj) ≤ Rrank → + ∀ {Pside : ℝ}, Pproj ≤ Pside → Pmass ≤ Pside → + Pphysical ≤ Pside → coarseTarget ≤ Pside → + (∀ i, Real.exp ((Pside + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m)) ^ + Classical.choose (exists_allocatedCanonicalSpatial_cutoff.{0,0,0,0} m) + Pproj) ≤ (N i : ℝ)) → + cells.Nonempty → ∀ (bases : Finset (Fin nX → ℤ)), (hbases : bases.Nonempty) → + ∀ (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z), + (htotal : 0 < selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem)) → + let Path := bases × rectangularWeightIndices 0 V 1 + let pathLaw := allocatedOriginalPathLaw B U basis hb o hR hσ S (Fin nX) poly hmem N + (fun i => Nat.pos_of_ne_zero (NeZero.ne (N i))) hW hτSpatial hξn stride cells hmass bases hbases htotal + ∀ {Tdetect : Type} [Fintype Tdetect] [Nonempty Tdetect] + (e : Tdetect → LayerSamplerVariables G I n B → ℤ), Function.Injective e → + ∀ {Tests : Path → Type} [∀ z, Nonempty (Tests z)] + {Ldetect : ∀ z, Tests z → Type} [∀ z j, LieRing (Ldetect z j)] [∀ z j, LieAlgebra ℚ (Ldetect z j)] + {dims : ∀ z, Tests z → ℕ} + [∀ z j, TopologicalSpace (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, IsTopologicalAddGroup (ℝ ⊗[ℚ] Ldetect z j)] + [∀ z j, ContinuousSMul ℝ (ℝ ⊗[ℚ] Ldetect z j)] [∀ z j, T2Space (ℝ ⊗[ℚ] Ldetect z j)] + (Ddetect : ∀ z j, RationalFilteredNilmanifold (Ldetect z j) s (dims z j)) + (Vdetect : ∀ z j, (Ddetect z j).Niltest (fun _ : LayerSamplerVariables G I n B => 1)) + (slices : ∀ z, Tests z → Finset Tdetect) + (cdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℤ) + (stepdetect : ∀ z, Tests z → ℕ) + (Hdetect : ∀ z, Tests z → LayerSamplerVariables G I n B → ℕ), + (∀ z j, 0 < stepdetect z j) → + (∀ z j, (slices z j).image e = commonStrideBox (cdetect z j) (stepdetect z j) (Hdetect z j)) → + 0 ≤ pDetect → 0 ≤ qDetect → + (∀ z j, IsDenseCommonStrideBox + (Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S)) pDetect ((slices z j).image e)) → + (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect → + (∀ z j, (Vdetect z j).ComplexityLE (Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect)) → + (∀ z j, ((Vdetect z j).normBound : ℝ) ≤ 1) → + 0 < α → α ≤ 1 → + Fintype.card (LayerSamplerVariables G I n B) * Real.exp (-pDetect) ≤ α / 8 → + Real.exp (-qDetect) ≤ α / 4 → + α ≤ sampledSliceSeminorm pathLaw + (fun z t => jointIntegerPhysicalSite (e t) (z.1.val, z.2.val)) slices + (fun z j t => star ((Vdetect z j).eval (commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))) signal → + (s + 1) * (s + 3) ≤ Fintype.card G → (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) ≤ S.value → + let C := Classical.choose (exists_canonicalSlicedNative_input_budget m (s + 1) Amass Aanalytic) + let Bbudget := (Pnative + C) ^ C + let Anorm := Classical.choose (exists_allocatedRecenteredFactor_normalization.{0,0,0,0,0,0} m (s + 1)) + let Anative := Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s) + let A := Classical.choose (exists_normalizedNative_uniform_budget m Anorm Anative) + let budget := (Bbudget + A) ^ A + ∃ twistData : NormalizedPolynomialTwist (Fin nX) (Σ j, J j) + (Real.exp budget) (Real.exp budget) ⟨Real.exp budget, Real.exp_nonneg _⟩, + ∃ Fnative : integerBox N → ℂ, + Nonempty (NativeSampleModel (fun _ : Fin nX => 1) s budget + (fun u : integerBox N => u.val) Fnative) ∧ + Real.exp (-budget) ≤ + ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) (integerBox_nonempty N)).correlation + (fun u => signal u.val) (fun u => star (twistData.eval N poly u.val) * Fnative u)‖ := by + intro ambientQ ambientBudget τ Pphysical W ξn hξn hξnLe hW cells poly hp hmem signal hsignal hzero + lossTarget Psample Rrank Sstride εsample ηsample + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + A hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP V + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision Amass Aanalytic Fmodel Cgrid Qlog tg pg p + Pnative hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj Acover coverLog Asample Pmass hcoverAmbient hcoverSample hmassSample + hCactual hVactual hσ1 hsmall hXmass hframeMass hstrideMass hτMass + AmassWindow hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP + hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj hProfileProj hCproj hVproj + hXproj hFrameProj hStrideProj hτProj hξProj Aproj hSizeProj hRankProj + Pside hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hmass htotal Path pathLaw + Tdetect _ _ e he Tests _ Ldetect _ _ dims _ _ _ _ Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices hpDetect hqDetect hdenseDetect hdimensionDetect hcomplexity hcap + hα hαone hmeshDetect hthreshold hdetected hGdetect hkernel + Cbudget Bbudget Anorm Anative Abudget budget + have hsignalAll (u) : ‖signal u‖ ≤ 1 := by + by_cases hu : u ∈ integerBox N + · exact hsignal u hu + · simp only [hzero u hu, norm_zero, zero_le_one] + have hF : 0 ≤ pDetect + 1 := by positivity + obtain ⟨hδ, _hδ1, hδF, htg, hpg, Tg, hTg, hgrid⟩ := + (Classical.choose_spec (exists_preparedModularCanonicalDetector_grid_parameters.{0} m (s + 1) Ag)).2 + (nX := nX) hPk hQstride hpDetect + have hδw' : (Real.exp (-(pDetect + 1)))⁻¹ ≤ Real.exp wg := + hδF.trans (Real.exp_le_exp.mpr hδw) + have hfound := allocatedOriginalPathLaw_canonical_period_source (s := s) + B U basis hb o hR hσ S (Fin nX) poly hmem N hN hW hτ hξn + stride cells hmass bases hbases htotal Pdetect e he Ddetect Vdetect slices cdetect stepdetect Hdetect + hstepdetect hslices pDetect qDetect hpDetect hqDetect hdenseDetect hdimensionDetect hcomplexity hcap + signal hsignalAll α hα hαone hmeshDetect hthreshold hdetected selection hGdetect hkernel hstridepos + obtain ⟨c₀, step₀, H₀, hstep₀, hH₀, hsubsetAll, hdenseAll, hstepBound, + x, hgood, hMk, hperiodPos, hperiodBound, r₀, hcell, hsubset, hdetectedTuple, + y₀, hy₀, _hyCube, _hyAxis, _hselected⟩ := hfound + let period := kernelPeriodCandidate (m + 1) (goodKernelUniformCandidate selection x hgood m) + have : NeZero period := ⟨hperiodPos.ne'⟩ + let modulus := residueRefinedPeriod period stride + let Hnative := fun j : PrincipalTupleIndex B (layerSamplerDegree I n) => H₀ (Sum.inr j) + let stepnative := fun _ : PrincipalTupleIndex B (layerSamplerDegree I n) => step₀ + let cnative := fun j : PrincipalTupleIndex B (layerSamplerDegree I n) => c₀ (Sum.inr j) + have hHnative (j) : 0 < Hnative j := hH₀ (Sum.inr j) + have hdenseNative (j : Tuple) : + Real.exp (-(pDetect + 1)) * L j ≤ + ((integerProgressionSupport + (c₀ (Sum.inr (Sigma.mk j.1.val j.2))) (step₀ : ℤ) + (H₀ (Sum.inr (Sigma.mk j.1.val j.2)))).card : ℝ) := by + rw [card_integerProgressionSupport _ _ _ hstep₀] + exact hdenseAll (Sum.inr (Sigma.mk j.1.val j.2)) + have hperiodBounds := canonicalPeriod_primitive_bounds + (LayerSamplerAxis I n) n selectedRows Q hMkPk hperiodBound + have hmask := hperiodBounds.2.1.trans (Real.exp_le_exp.mpr hmaskLog) + have hlabels := hperiodBounds.2.2.trans (Real.exp_le_exp.mpr hlabelLog) + have hpbase := hperiodBounds.1.trans (Real.exp_le_exp.mpr hperiodLog) + obtain ⟨hQTg, hPg, hcP, hsP, hstrideGrid⟩ := + hgrid stride hMkPk hperiodPos hperiodBound hstridepos hstrideBound + have hstrideGrid' (j : PrincipalTupleIndex B (layerSamplerDegree I n)) : + ((stepnative j * modulus : ℕ) : ℝ) ≤ Real.exp pg := by + exact hstrideGrid (Y := PrincipalTupleIndex B (layerSamplerDegree I n)) + stepnative (fun _ => hstepBound) j + have hnative := exists_allocatedCanonicalSlice_spatial_native_source_sharedWidth + (s := s) (nX := nX) (ξn := ξn) (τ := τ) (Pphysical := Pphysical) (gain := (allocatedDetectedGain s (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect α) / 2) (Pproj := Pproj) + (coarseTarget := coarseTarget) (Ecoarse := Ecoarse) (pGain := pGain) + B U basis hR hσ S x hMk selection hgood period stride N rfl modulus rfl + hP hMkP hRP hRi hσi hcount Q hb o bW Hnative stepnative cnative hHnative hsubset r₀ hcell ν μ μrows + hdimensions hPk hMkPk hPrho htarget hF hQstride hstride hstrideBound hlength + ρ t htone hs hρ hρ1 hσsmall (fun _ => hstep₀) hδ hδF hdenseNative + (by simp only [Fintype.card_fin]; omega) y₀ hy₀ + T hT hsource C hC hchart hbudget hρlog hη0 hηsmall + siteRadius hrone hsitebudget Cforward hforward K hK hradius + hPbox hVlog hNlog hMlog hbox hvolume hnormalizer hmask hbaseAmbient hvbase hnbase hmbase + hsites haxes hlabels hKbase hcoords hcutoff hpbase hrowsAmbient houtputs hheight + Qgrid hQgrid hδ (fun j => hdenseAll (Sum.inr j)) Tg + (by simpa only [Fintype.card_fin] using hQTg) (fun _ => hstep₀) + Ag hAg (Real.exp pg) hPg hcP hsP hstrideGrid' + hBa hBi hDg hvg hwg htg hpg hcube hdegree hrowsD htail hblocks hRv hRiGrid hδw' hTg hcoeff + le_rfl haxesGrid hfullAxes hfullOutputs hambientCount hprofileBudget + hBanalytic hDanalytic hcutoffAnalytic hcoordAnalytic hgridAnalytic + hPnum hI hn hcoeffEarly hRiEarly hVEarly + have hnative := hnative (Pnative := Pnative) hξn hξnLe cells poly hp hmem signal hsignal hzero + (lossTarget := lossTarget) (Psample := Psample) (Rrank := Rrank) + (Sstride := Sstride) (εsample := εsample) (ηsample := ηsample) + hstridepos hN hτ hPs hX hframe hSstride hSstrideP hεsample hτP hεsampleP hstrideBoundSample + hsize hrank hRrank hηsample hamb hAmbientP hjet hηsampleP + hPphysical hMkPhysical hmGeometry hcoarseTarget0 hDimPhysical hGPhysical hXPhysical + hprecision hηprecision hεprecision + have hnative := hnative (Pside := Pside) hPnative hDnative hpNative hvNative hFnative hPrhoNative hPkNative htargetNative + hBanalyticNative hphysicalNative hEcoarseNative hpGainNative hstrideGeometry hτGeometry + hgain hPprojGain hcoarseTarget hEcoarseGain hlossTarget + Cproj Vproj hcoverAmbient hcoverSample hmassSample hCactual hVactual hσ1 hsmall + hXmass hframeMass hstrideMass hτMass hsizeMass hRrankMass hambMass hjetMass hvars + hPproj hmProj hGproj hLproj hperiodP hKproj hWproj hRproj hσproj hcountProj hIproj hnProj hJproj + hProfileProj hCproj hVproj hXproj hFrameProj hStrideProj hτProj hξProj hSizeProj hRankProj + exact hnative hProjSide hCapSide hpSide htargetSide hside hCells bases hbases hmass hdetectedTuple + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthPreparedFullChartNativeDetection.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthPreparedFullChartNativeDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..e42ab468e4e55e34e3605ff2358c670010bdb848 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SharedWidthPreparedFullChartNativeDetection.lean @@ -0,0 +1,191 @@ +import OAI.Combinatorics.Progressions.Estimates.SharedWidthPreparedLateToleranceFreeTrimSource +import OAI.Combinatorics.Progressions.Geometry.PreparedFullChartNativeDetection + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open MeasureTheory Module Submodule BooleanCubeKernel +open scoped Classical BigOperators NNReal TensorProduct + +section Consumer + +variable {m s : ℕ} {G : Type} [Fintype G] [DecidableEq G] +variable {I : Fin m → Type} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type) +variable [∀ a, Fintype (B a)] +variable {J : Fin m → Type} [∀ j, Fintype (J j)] (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 {nX : ℕ} +local notation "rowSets" => (fun j : Fin m => boundedBooleanJetRows (Fin (s + 1)) (Fin.val j + 1)) +attribute [local instance 2000] fullBooleanRowSetFintype +attribute [local instance] ScalarSiteExpansion.termFinite +local notation "selectedRows" => (fun j : Fin m => (rowSets j : Type)) +local notation "rows" => (fun j => (Subtype.val : rowSets j → Finset (Fin (s + 1)))) +variable (selection : Fin (s + 1) ↪ G) (stride N : Fin nX → ℕ) +variable (Pdetect : Polynomial ℕ) (u pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0) +local notation "pDetect" => allocatedModelTestLog u pModel +local notation "qDetect" => allocatedModelTestLog u pModel +local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (I j)) (n j) (R j) (Vtail j)) +local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables G I n B)) +variable (α τ : ℝ) +variable {P : ℝ} + +local notation "grid" => allocatedGridAxis (I := I) U basis S.value +local notation "degree" => layerSamplerDegree I n +local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => B (Subtype.val a)) (fun a => degree (Subtype.val a)) +local notation "jetRows" => selectedRows +local notation "activeB" => (fun a : {a // ¬grid a} => B (Subtype.val a)) +local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a)) +local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides B U basis S) +local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos B U basis S + (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j))) + +variable (Q : Fin m → Type) [∀ j, Fintype (Q j)] +variable (hb : ∀ j, span ℤ (Set.range (basis j)) = projectedIntegerLattice (euclideanSubspace (U j))) +variable (o : ∀ j, OrthonormalBasis (I j) ℝ (euclideanSubspace (U j))) +variable (bW : ∀ j, Basis (Q j) ℤ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))) + +local notation "source" => allocatedCoefficientSource B U basis hR hσ S +local notation "frozenSource" => allocatedFrozenCoefficientSource B U basis hR hσ S +local notation "reference" => allocatedLongJetReference B U basis S jetRows +variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j)))] +variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ + (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) +variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] + +variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)] +variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U)) +variable [IsProbabilityMeasure μ] +local notation "jetHaar" => Measure.pi (fun j => + @Measure.pi (selectedRows j) _ (fullBooleanRowSetFintype (s + 1) (Fin.val j + 1)) _ + (fun _ : selectedRows j => ν j)) +local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S + +variable [TopologicalSpace (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight s)] +variable [IsTopologicalAddGroup (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight s)] +variable [ContinuousSMul ℝ (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight s)] +variable [T2Space (ℝ ⊗[ℚ] PolynomialTranslationLie.weightedSubalgebra + OrdinaryPolynomialPhase.weight s)] + +include μ hR hσ hb o in + +theorem preparedFullChartNativeDetection_sharedWidth + (Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ) + (hDirect : PreparedModularGeneralDirectDetectionFreeTrimPreparedSharedWidthInterface + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α / 2) (τ := τ) (hb := hb) (o := o) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget) + (hα : 0 < α) + (hcount : (Fintype.card (LayerSamplerVariables G I n B) : ℝ) ≤ + Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect) + (hbudget : OrdinaryPolynomialPhase.budget s ≤ + Pdetect.eval₂ (Nat.castRingHom ℝ) qDetect) : + ∀ (_hstride : ∀ i, 0 < stride i) (_hstrideBound : ∀ i, (stride i : ℝ) ≤ Real.exp Qstride) + (C : Fin m → ℝ) (_hC : ∀ j, 0 ≤ C j) (_hCbound : ∀ j, C j ≤ Real.exp Pchart) + (_hchart : ∀ j v, ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j)).symm v‖ ≤ C j * ‖v‖) + (Cforward : Fin m → ℝ≥0) + (_hforward : ∀ j v, ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (basis j) v‖ ≤ Cforward j * ‖v‖) + (_hForward : ∀ j, (Cforward j : ℝ) ≤ Real.exp Pchart) + (_hVtail : ∀ j, (Vtail j : ℝ) ≤ Real.exp Pchart) + (_hVactual : ∀ j, 0 ≤ mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ∧ + mixedDensityCovolumeRatio (euclideanSubspace (U j)) (basis j) ≤ Vtail j) + (_hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp Pchart) + (_hcutoff : (normalizedSiteCutoffBound : ℝ) ≤ Real.exp Pchart), + ∀ (hτSpatial : 0 < τ), τ⁻¹ ≤ Real.exp Pphysical → + τ ≤ 1 / 2 → (nX : ℝ) * τ ≤ 1 / 2 → + let r := preparedModularGeneralDetectorResources (preparedModularGeneralDetectorConstants m s) (s + 1) Pmaster Plate + let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0) + ∀ {ξn : ℝ} (hξn : 0 < ξn), + ξn ≤ normalizedTupleNarrowWidth (Fin nX) + (PrincipalTupleIndex B (layerSamplerDegree I n)) selection + (allocatedDetectedKernelCutoff s G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2)) + Pphysical coarseTarget → ξn⁻¹ ≤ Real.exp Plate → + let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0) + ∀ (cells : Finset (ColumnResiduePattern (Option (LayerSamplerVariables G I n B)) (Fin nX) stride)) + (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)) + (_hp : ∀ j, DegreeLE (1 : (Fin nX) → ℕ) (j.val + 1) (poly j)) + (hmem : ∀ j ex, coefficients (poly j) ex ∈ U j) + {Rrank : ℝ}, + (∀ i, Real.exp r.required ≤ (N i : ℝ)) → + (∀ j, HasLayerSamplingRank (j.val + 1) (fun i => (N i : ℝ)) Rrank (U j) (poly j)) → + Real.exp r.required ≤ Rrank → + let V := narrowTrimmedSpatialWidths (G := G) (J := PrincipalTupleIndex B (layerSamplerDegree I n)) W τ ξn N + cells.Nonempty → + let bases := trimmedIntegerBox N (spatialTrimMargin τ N) + let Z := selectedJointDensityMass bases stride cells V + (allocatedJointBaseDensity B U basis hb o hR hσ S (Fin nX) poly hmem) + ∃ (hN : ∀ i, 0 < N i) (hbases : bases.Nonempty) (hbox : (integerBox N).Nonempty) + (hmass : 0 < ∑' z, selectedResidueSmoothWeight stride cells V z) + (_hnormalizer : |Z - 1| ≤ Real.exp (-r.E) ∧ Z ∈ Set.Icc (1 / 2 : ℝ) (3 / 2) ∧ 0 < Z ∧ Z⁻¹ ≤ 2) + (_hmargin : ∀ i, 2 * spatialTrimMargin τ N i ≤ N i), + let Path := bases × rectangularWeightIndices 0 V 1 + ∃ hcenter : ∀ center : CoefficientTorus (K := LayerSamplerVariables G I n B) U, + 0 < selectedJointDensityMass bases stride cells V + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center), + let centeredLaw := fun center => selectedJointFiniteLaw bases hbases stride cells V + (narrowTrimmedSpatialWidths_pos hW hτSpatial hξn N hN) hmass + (allocatedCenteredJointDensity B U basis hb o hR hσ S poly hmem center) + (allocatedCenteredJointDensity_nonneg B U basis hb o hR hσ S poly hmem center) (hcenter center) + ∃ hweight : ∀ z, Measurable (fun center => (centeredLaw center).weight z), + let pathLaw := centeredFiniteMarginal μ centeredLaw hweight + let sides := Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U basis S) + let Sites := integerBox sides + ∀ {η : Type}, + ∀ chosen : Path → Option η → LocalMajorSliceTest + (OrdinaryPolynomialPhase.nilmanifold s) sides pSlice + (OrdinaryPolynomialPhase.budget s), + SampledSliceNativeDetection J N hbox poly pathLaw + (fun z (x : Sites) => jointIntegerPhysicalSite x.val (z.1.val, z.2.val)) + (fun z a => (chosen z a).slice.subtypeSites) + (fun z a (x : Sites) => (chosen z a).weight x.val) s r.nativeBudget α := by + intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff hτSpatial hτInv hτHalf hτDim + r W ξn hξn hξn_le hξLate hW cells poly hp hmem Rrank hsize hrank hRank V hCells bases Z + have hcentered := preparedModularGeneralCenteredDetectionFreeTrimSharedWidth_of_direct + (B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ) + (selection := selection) (stride := stride) (N := N) + (Pdetect := Pdetect) (u := u) (pModel := pModel) (pSlice := pSlice) + (Vtail := Vtail) (α := α) (τ := τ) (hb := hb) (o := o) (μ := μ) + Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget hDirect + obtain ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, htail⟩ := + hcentered hstride hstrideBound C hC hCbound hchart Cforward hforward hForward + hVtail hVactual hprofile hcutoff hτSpatial hτInv hτHalf hτDim + hξn hξn_le hξLate cells poly hp hmem hsize hrank hRank hCells + refine ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩ + intro Path + obtain ⟨hcenter, hweight, hdetect⟩ := htail + refine ⟨hcenter, hweight, ?_⟩ + intro pathLaw sides Sites η chosen + have hfamily := hdetect (fun _ _ => OrdinaryPolynomialPhase.nilmanifold s) + (fun z a => (chosen z a).test) + (fun z a => (chosen z a).slice.subtypeSites) + (fun z a i => ((chosen z a).slice.start i : ℤ)) + (fun z a => (chosen z a).stride) + (fun z a => (chosen z a).slice.length) + (fun z a => (chosen z a).stride_pos) + (fun z a => ((chosen z a).slice.subtypeSites_image_val).trans + (chosen z a).slice.integerPoints_eq_commonStrideBox) + (fun z a => (chosen z a).slice.subtypeSites_dense (chosen z a).dense) + hcount + (fun z a => (chosen z a).complexity.mono hbudget) + (fun z a => (chosen z a).norm) + intro signal hsignal hsupp hlarge + exact hfamily signal hα hsignal hsupp hlarge + +end Consumer +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/ShiftedBoxSites.lean b/lean/OAI/Combinatorics/Progressions/Geometry/ShiftedBoxSites.lean new file mode 100644 index 0000000000000000000000000000000000000000..883d2f202e7724aa93d3ca1dbe7b62139d96935c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/ShiftedBoxSites.lean @@ -0,0 +1,51 @@ +import OAI.Combinatorics.Progressions.Polynomial.SitePhaseCauchySchwarz + +namespace OAI + +section + +namespace Erdos3 + +open CircleFourier +open scoped BigOperators Classical + +noncomputable def shiftedBoxSite {h : ℕ} {X V : Type*} [AddCommGroup V] + (base : V) (coefficient : Fin h → ℤ) (shift : X → V) (x : Fin h → X) : V := + base + ∑ i, coefficient i • shift (x i) + +theorem shiftedBoxSite_update {h : ℕ} {X V : Type*} [AddCommGroup V] + (base : V) (coefficient : Fin h → ℤ) (shift : X → V) {i : Fin h} + (hi : coefficient i = 0) (x : Fin h → X) (a : X) : + shiftedBoxSite base coefficient shift (Function.update x i a) = + shiftedBoxSite base coefficient shift x := by + unfold shiftedBoxSite + congr 1 + apply Finset.sum_congr rfl + intro j _ + by_cases hj : j = i + · subst j + simp only [hi, zero_smul] + · simp only [Function.update_of_ne hj] + +theorem shifted_site_phase_cauchySchwarz {h : ℕ} {S X V : Type*} + [Fintype S] [Fintype X] [Nonempty X] [AddCommGroup V] (hh : 0 < h) + (base : S → V) (coefficient : S → Fin h → ℤ) (shift : X → V) + (hzero : ∀ s, ∃ i, coefficient s i = 0) (P : (Fin h → X) → ℝ) + (test : S → V → ℂ) (htest : ∀ s v, ‖test s v‖ ≤ 1) : + ‖𝔼 x, character (P x : CircleFourier.Circle) * + ∏ s, test s (shiftedBoxSite (base s) (coefficient s) shift x)‖ ^ (2 ^ h) ≤ + ‖𝔼 u, 𝔼 v, character + ((additiveBoxDifference h (fun x (_ : Unit) => P x) u v () : ℝ) : CircleFourier.Circle)‖ := by + let assignment : S → Fin h := fun s => (hzero s).choose + apply assigned_phase_cauchySchwarz hh P assignment + (fun s x => test s (shiftedBoxSite (base s) (coefficient s) shift x)) + (fun s x => htest s _) + intro s x a + exact congrArg (test s) + (shiftedBoxSite_update (base s) (coefficient s) shift (hzero s).choose_spec x a) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SigmaAxisCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SigmaAxisCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..210330ac388390d0075a6c67cd91c8e940cd2c7c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SigmaAxisCoordinates.lean @@ -0,0 +1,87 @@ +import Mathlib.Analysis.Calculus.ContDiff.Operations +import Mathlib.MeasureTheory.Integral.Pi + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +variable {D : Type*} [Fintype D] (I : D → Type*) [∀ d, Fintype (I d)] + +noncomputable def sigmaAxisCoordinates : ((Σ d, I d) → ℝ) ≃L[ℝ] (∀ d, I d → ℝ) where + toLinearEquiv := + { toFun := fun x d i => x ⟨d, i⟩ + invFun := fun x s => x s.1 s.2 + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl } + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop + +noncomputable def sigmaAxisProjection (d : D) : ((Σ d, I d) → ℝ) →L[ℝ] (I d → ℝ) := + ContinuousLinearMap.pi (fun i => ContinuousLinearMap.proj ⟨d, i⟩) + +omit [Fintype D] [∀ d, Fintype (I d)] in +theorem sigmaAxisProjection_apply (d : D) (x : (Σ d, I d) → ℝ) (i : I d) : + sigmaAxisProjection I d x i = x ⟨d, i⟩ := rfl + +theorem sigmaAxisProjection_norm_apply_le (d : D) (x : (Σ d, I d) → ℝ) : + ‖sigmaAxisProjection I d x‖ ≤ ‖x‖ := by + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro i + exact norm_le_pi_norm x ⟨d, i⟩ + +theorem sigmaAxisProjection_norm_le_one (d : D) : ‖sigmaAxisProjection I d‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro x + simpa only [one_mul] using sigmaAxisProjection_norm_apply_le I d x + +theorem sigmaAxisCoordinates_norm_le_one : ‖(sigmaAxisCoordinates I).toContinuousLinearMap‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro x + rw [one_mul] + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro d + exact sigmaAxisProjection_norm_apply_le I d x + +theorem sigmaAxisCoordinates_symm_norm_le_one : + ‖(sigmaAxisCoordinates I).symm.toContinuousLinearMap‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro x + rw [one_mul] + apply (pi_norm_le_iff_of_nonneg (norm_nonneg x)).mpr + intro s + exact (norm_le_pi_norm (x s.1) s.2).trans (norm_le_pi_norm x s.1) + +theorem sigmaAxisCoordinates_symm_measurePreserving : + MeasurePreserving (sigmaAxisCoordinates I).symm volume volume := by + refine ⟨(sigmaAxisCoordinates I).symm.continuous.measurable, ?_⟩ + symm + apply Measure.pi_eq + intro s hs + rw [Measure.map_apply (sigmaAxisCoordinates I).symm.continuous.measurable (MeasurableSet.univ_pi hs)] + have he : (sigmaAxisCoordinates I).symm ⁻¹' Set.univ.pi s = + Set.univ.pi (fun d => Set.univ.pi (fun i : I d => s ⟨d, i⟩)) := by + ext x + constructor + · intro hx d _ i _ + exact hx ⟨d, i⟩ (Set.mem_univ _) + · intro hx t _ + exact hx t.1 (Set.mem_univ _) t.2 (Set.mem_univ _) + rw [he, volume_pi_pi] + simp only [volume_pi_pi, Fintype.prod_sigma] + +theorem sigmaAxisCoordinates_measurePreserving : + MeasurePreserving (sigmaAxisCoordinates I) volume volume := + (sigmaAxisCoordinates_symm_measurePreserving I).symm + (sigmaAxisCoordinates I).symm.toHomeomorph.toMeasurableEquiv + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SignedSplitCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SignedSplitCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e25e09d041ad161ddae58254ae37cd2e62adbfd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SignedSplitCoordinates.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Linear.SplitSurjectionBasis + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {R E F I J : Type*} [Ring R] [AddCommGroup E] [Module R E] + [AddCommGroup F] [Module R F] [Fintype I] [Fintype J] + +noncomputable def signedSplitCoordinates (q : E →ₗ[R] F) (s : F →ₗ[R] E) + (hs : ∀ x, q (s x) = x) (bK : Basis I R (LinearMap.ker q)) (bI : Basis J R F) : + E ≃ₗ[R] (J → R) × (I → R) := + (splitSurjectionEquiv q s hs).symm.trans + ((bK.equivFun.prodCongr bI.equivFun).trans + ((LinearEquiv.prodComm R (I → R) (J → R)).trans + ((LinearEquiv.neg R : (J → R) ≃ₗ[R] (J → R)).prodCongr + (LinearEquiv.refl R (I → R))))) + +theorem signedSplitCoordinates_fst (q : E →ₗ[R] F) (s : F →ₗ[R] E) + (hs : ∀ x, q (s x) = x) (bK : Basis I R (LinearMap.ker q)) (bI : Basis J R F) (x : E) : + (signedSplitCoordinates q s hs bK bI x).1 = -(bI.equivFun (q x)) := rfl + +theorem signedSplitCoordinates_symm_apply (q : E →ₗ[R] F) (s : F →ₗ[R] E) + (hs : ∀ x, q (s x) = x) (bK : Basis I R (LinearMap.ker q)) (bI : Basis J R F) + (z : J → R) (w : I → R) : + (signedSplitCoordinates q s hs bK bI).symm (z, w) = + (bK.equivFun.symm w).val - s (bI.equivFun.symm z) := by + change (bK.equivFun.symm w).val + s (bI.equivFun.symm (-z)) = _ + rw [map_neg, map_neg, sub_eq_add_neg] + +theorem signedSplitCoordinates_reconstruction (q : E →ₗ[R] F) (s : F →ₗ[R] E) + (hs : ∀ x, q (s x) = x) (bK : Basis I R (LinearMap.ker q)) (bI : Basis J R F) (x : E) : + x + s (bI.equivFun.symm (signedSplitCoordinates q s hs bK bI x).1) = + (bK.equivFun.symm (signedSplitCoordinates q s hs bK bI x).2).val := by + have h := signedSplitCoordinates_symm_apply q s hs bK bI + (signedSplitCoordinates q s hs bK bI x).1 (signedSplitCoordinates q s hs bK bI x).2 + change (signedSplitCoordinates q s hs bK bI).symm + (signedSplitCoordinates q s hs bK bI x) = _ at h + rw [LinearEquiv.symm_apply_apply] at h + exact eq_sub_iff_add_eq.mp h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SmallBoxCutoff.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SmallBoxCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3d60d5c6be5a0e70db9fb10498a7ad76fe89990 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SmallBoxCutoff.lean @@ -0,0 +1,60 @@ +import OAI.Combinatorics.Progressions.Estimates.BufferedSiteExpansion + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +variable {D : Type*} [Fintype D] + +noncomputable def smallBoxCutoff (x : D → ℝ) : ℝ := + max 0 (min 1 (3 - 8 * ‖x‖)) + +theorem smallBoxCutoff_range (x : D → ℝ) : + 0 ≤ smallBoxCutoff x ∧ smallBoxCutoff x ≤ 1 := + ⟨le_max_left _ _, max_le (by norm_num) (min_le_left _ _)⟩ + +theorem smallBoxCutoff_one (x : D → ℝ) (hx : ∀ i, |x i| ≤ 1/4) : + smallBoxCutoff x = 1 := by + have hn : ‖x‖ ≤ 1/4 := (pi_norm_le_iff_of_nonneg (by norm_num)).mpr + (by simpa only [Real.norm_eq_abs] using hx) + rw [smallBoxCutoff, min_eq_left (by linarith), max_eq_right (by norm_num)] + +theorem smallBoxCutoff_zero (x : D → ℝ) (hx : 3/8 ≤ ‖x‖) : + smallBoxCutoff x = 0 := by + exact max_eq_left ((min_le_right _ _).trans (by linarith)) + +theorem smallBoxCutoff_support (x : D → ℝ) (hx : smallBoxCutoff x ≠ 0) : + ∀ i, |x i| < 1/2 := by + have hn : ‖x‖ < 3/8 := lt_of_not_ge (fun h => hx (smallBoxCutoff_zero x h)) + intro i + have hi : |x i| ≤ ‖x‖ := by simpa only [Real.norm_eq_abs] using norm_le_pi_norm x i + linarith + +theorem smallBoxCutoff_lipschitz : LipschitzWith 8 (smallBoxCutoff (D := D)) := by + have h : LipschitzWith 8 (fun x : D → ℝ => 3 - 8 * ‖x‖) := by + apply LipschitzWith.of_dist_le_mul + intro x y + rw [Real.dist_eq] + have he : (3 - 8 * ‖x‖) - (3 - 8 * ‖y‖) = -8 * (‖x‖ - ‖y‖) := by ring + rw [he, abs_mul] + norm_num only [abs_neg, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 8), NNReal.coe_ofNat] + exact mul_le_mul_of_nonneg_left (by simpa only [dist_eq_norm] using abs_norm_sub_norm_le x y) + (by norm_num) + exact (h.const_min 1).const_max 0 + +theorem smallBoxCutoff_mul_lipschitz (f : (D → ℝ) → ℝ) {L B : ℝ≥0} + (hf : LipschitzWith L f) (hb : ∀ x, |f x| ≤ B) : + LipschitzWith (L + B * 8) (fun x => smallBoxCutoff x * f x) := by + simpa only [one_mul] using lipschitz_real_mul_of_bounds (Bf := 1) (Bg := B) smallBoxCutoff f + smallBoxCutoff_lipschitz hf + (fun x => by rw [abs_of_nonneg (smallBoxCutoff_range x).1]; exact (smallBoxCutoff_range x).2) hb + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SmallDifferenceGraphCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SmallDifferenceGraphCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..66774352ba99011c7bb9fea1b74c10708fe3a5b6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SmallDifferenceGraphCoordinates.lean @@ -0,0 +1,182 @@ +import OAI.Combinatorics.Progressions.Lattices.NativeProperAffineRecovery + +namespace OAI + +section + +namespace Erdos3 + +open scoped Pointwise BigOperators +open CyclicCrootSisask + +theorem exists_small_difference_graph_coordinates {I : Type*} [Fintype I] + (N : ℕ) (M : I → ℕ) [NeZero N] [∀ i, NeZero (M i)] + (H : Finset (ZMod N)) (hH : H.Nonempty) (b : ZMod N → ∀ i, ZMod (M i)) + {p : ℝ} (hp : 0 ≤ p) + (hsmall : ((additiveGraph H b - additiveGraph H b).card : ℝ) ≤ Real.exp p * H.card) : + let K := (2 ^ 14 : ℝ) * (Real.exp (p + 13 * Fintype.card I)) ^ 6 + let z := roundedModelLogBudget p (Fintype.card I) + let δ := Real.exp (-(quarticBogolyubovProgressionConstant * (z + 1) ^ 8)) + ∃ J ⊆ H, J.Nonempty ∧ δ * H.card ≤ 16 ^ (Fintype.card I + 2) * (J.card : ℝ) ∧ + ∃ (r : ℕ) (R : Fin r → ℕ) (Φ : (Fin r → ℤ) →+ (Option I → ℤ)) + (base : Option I → ℤ), + (r : ℝ) ≤ 2 + quarticBogolyubovConstant * (z + 1) ^ 4 ∧ + ((∏ i, (2 * R i + 1) : ℕ) : ℝ) ≤ + 2 * (K * 16 ^ (Fintype.card I + 1)) ^ 16 * H.card ∧ + Set.InjOn Φ {x | ∀ i, |x i| ≤ (R i : ℤ)} ∧ + ∀ h ∈ J, ∃ x : Fin r → ℤ, (∀ i, |x i| ≤ (R i : ℤ)) ∧ + FreimanModel.variableIntegerGraphLift N M (h, b h) = base + Φ x := by + intro K z δ + classical + let A := additiveGraph H b + have hK : Real.exp p ≤ K := by + calc + _ ≤ Real.exp (6 * (p + 13 * Fintype.card I)) := by + apply Real.exp_le_exp.mpr + nlinarith [Nat.cast_nonneg (α := ℝ) (Fintype.card I)] + _ = Real.exp (p + 13 * Fintype.card I) ^ 6 := by + rw [← Real.exp_nat_mul] + norm_num + _ ≤ K := le_mul_of_one_le_left (by positivity) (by norm_num) + have hAsmall : ((A - A).card : ℝ) ≤ K * A.card := by + rw [show A.card = H.card from additiveGraph_card H b] + exact hsmall.trans (mul_le_mul_of_nonneg_right hK (Nat.cast_nonneg _)) + obtain ⟨Q, S, B, f, hQ, hS, hSA, hASsize, hB, _, _, hf, hQsize, hdensity⟩ := + FreimanModel.exists_variableIntegerGraph_cyclic_model N M A (hH.image _) (by positivity) hAsmall + let _ : NeZero Q := ⟨hQ.ne'⟩ + have hdensity' : Real.exp (-z) * Q ≤ (B.card : ℝ) := by + apply (le_div_iff₀ (by exact_mod_cast hQ : (0 : ℝ) < Q)).mp + exact (exp_neg_roundedModelLogBudget_le_density p (Fintype.card I)).trans hdensity + obtain ⟨F, hFS, hF, hFsize, r, R, Φ, base, hrank, hbox, hinj, hrepr⟩ := + FreimanModel.exists_bounded_affine_box_of_cyclic_model S hS B hB f hf + (roundedModelLogBudget_nonneg p (Fintype.card I)) hdensity' + have hboxSize : ((∏ i, (2 * R i + 1) : ℕ) : ℝ) ≤ + 2 * (K * 16 ^ (Fintype.card I + 1)) ^ 16 * H.card := by + have hcast : ((∏ i, (2 * R i + 1) : ℕ) : ℝ) ≤ Q := by exact_mod_cast hbox + exact hcast.trans (by simpa only [A, additiveGraph_card] using hQsize) + have hFA : F ⊆ A.image (FreimanModel.variableIntegerGraphLift N M) := hFS.trans hSA + let π : (Option I → ℤ) → ZMod N := fun v => (v none : ZMod N) + have hback (v : Option I → ℤ) (hv : v ∈ F) : + π v ∈ H ∧ FreimanModel.variableIntegerGraphLift N M (π v, b (π v)) = v := by + obtain ⟨y, hy, rfl⟩ := Finset.mem_image.mp (hFA hv) + obtain ⟨hyH, hyb⟩ := (mem_additiveGraph_iff H b y).mp hy + have hπ : π (FreimanModel.variableIntegerGraphLift N M y) = y.1 := by simp [π] + rw [hπ] + exact ⟨hyH, congrArg (FreimanModel.variableIntegerGraphLift N M) (Prod.ext rfl hyb.symm)⟩ + let J := F.image π + have hπinj : Set.InjOn π (F : Set _) := by + intro x hx y hy hxy + calc + x = FreimanModel.variableIntegerGraphLift N M (π x, b (π x)) := (hback x hx).2.symm + _ = FreimanModel.variableIntegerGraphLift N M (π y, b (π y)) := by rw [hxy] + _ = y := (hback y hy).2 + have hFcard : F.card = J.card := (Finset.card_image_of_injOn hπinj).symm + have hJ : J ⊆ H := by + intro h hh + obtain ⟨v, hv, rfl⟩ := Finset.mem_image.mp hh + exact (hback v hv).1 + have hHS : (H.card : ℝ) ≤ 16 ^ (Fintype.card I + 2) * (S.card : ℝ) := by + exact_mod_cast (show H.card ≤ 16 ^ (Fintype.card I + 2) * S.card by + simpa only [A, additiveGraph_card] using hASsize) + have hretain : δ * (S.card : ℝ) ≤ (J.card : ℝ) := by + simpa only [hFcard] using hFsize + refine ⟨J, hJ, hF.image _, ?_, r, R, Φ, base, hrank, hboxSize, hinj, ?_⟩ + · calc + δ * (H.card : ℝ) ≤ δ * (16 ^ (Fintype.card I + 2) * (S.card : ℝ)) := + mul_le_mul_of_nonneg_left hHS (Real.exp_nonneg _) + _ = 16 ^ (Fintype.card I + 2) * (δ * S.card) := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left hretain (by positivity) + · intro h hh + obtain ⟨v, hv, rfl⟩ := Finset.mem_image.mp hh + rw [(hback v hv).2] + exact hrepr v hv + +theorem exists_small_difference_graph_proper_coordinates {I : Type*} [Fintype I] + (N : ℕ) (M : I → ℕ) [NeZero N] [∀ i, NeZero (M i)] + (H : Finset (ZMod N)) (hH : H.Nonempty) (b : ZMod N → ∀ i, ZMod (M i)) + {p : ℝ} (hp : 0 ≤ p) + (hsmall : ((additiveGraph H b - additiveGraph H b).card : ℝ) ≤ Real.exp p * H.card) : + let K := (2 ^ 14 : ℝ) * (Real.exp (p + 13 * Fintype.card I)) ^ 6 + let z := roundedModelLogBudget p (Fintype.card I) + let δ := Real.exp (-(quarticBogolyubovProgressionConstant * (z + 1) ^ 8)) + ∃ J₀ ⊆ H, J₀.Nonempty ∧ δ * H.card ≤ 16 ^ (Fintype.card I + 2) * (J₀.card : ℝ) ∧ + ∃ (r : ℕ) (R : Fin r → ℕ) (Φ : (Fin r → ℤ) →+ (Option I → ℤ)), + (r : ℝ) ≤ 2 + quarticBogolyubovConstant * (z + 1) ^ 4 ∧ + ((∏ i, (2 * R i + 1) : ℕ) : ℝ) ≤ + 2 * (K * 16 ^ (Fintype.card I + 1)) ^ 16 * H.card ∧ + (let k := (2 ^ r * ∏ i, (2 * R i + 1)) / J₀.card + 1 + let reduce := FreimanModel.variableIntegerGraphReduction N M + let η := (AddMonoidHom.fst (ZMod N) (∀ i, ZMod (M i))).comp (reduce.comp Φ) + ∃ J ⊆ J₀, J.Nonempty ∧ J₀.card ≤ (4 * k) ^ r * J.card ∧ + ∃ base : Option I → ℤ, + Set.InjOn η (centeredIntegerBox (fun i => R i / (2 * k)) : Set _) ∧ + ∀ h ∈ J, ∃ x : Fin r → ℤ, (∀ i, |x i| ≤ (R i / (2 * k) : ℕ)) ∧ + FreimanModel.variableIntegerGraphLift N M (h, b h) = base + Φ x) := by + intro K z δ + classical + obtain ⟨J₀, hJ₀H, hJ₀, hsize, r, R, Φ, base, hrank, hvolume, _, hrepr⟩ := + exists_small_difference_graph_coordinates N M H hH b hp hsmall + let reduce := FreimanModel.variableIntegerGraphReduction N M + let η := (AddMonoidHom.fst (ZMod N) (∀ i, ZMod (M i))).comp (reduce.comp Φ) + have hall (h : {h // h ∈ J₀}) : ∃ x : Fin r → ℤ, (∀ i, |x i| ≤ (R i : ℤ)) ∧ + FreimanModel.variableIntegerGraphLift N M (h.val, b h.val) = base + Φ x := + hrepr h.val h.property + choose x hx hgraph using hall + have hspace (h : {h // h ∈ J₀}) : h.val = (reduce base).1 + η (x h) := by + change h.val = (reduce base).1 + (reduce (Φ (x h))).1 + have hh := congrArg (fun v => (reduce v).1) (hgraph h) + simpa only [reduce, FreimanModel.variableIntegerGraphReduction_lift, map_add, + Prod.fst_add] using hh + obtain ⟨J, hJJ₀, hJ, hretain, t, hproper, hsmallBox⟩ := + exists_dense_proper_coordinate_restriction J₀ hJ₀ R η (reduce base).1 x hx hspace + refine ⟨J₀, hJ₀H, hJ₀, hsize, r, R, Φ, hrank, hvolume, J, hJJ₀, + hJ, hretain, base + Φ t, hproper, ?_⟩ + intro h hh + let h₀ : {h // h ∈ J₀} := ⟨h, hJJ₀ hh⟩ + refine ⟨x h₀ - t, hsmallBox ⟨h, hh⟩, ?_⟩ + rw [hgraph h₀, map_sub] + abel + +theorem exists_small_difference_graph_affine_coordinates {I : Type*} [Fintype I] + (N : ℕ) (M : I → ℕ) [NeZero N] [∀ i, NeZero (M i)] + (H : Finset (ZMod N)) (hH : H.Nonempty) (b : ZMod N → ∀ i, ZMod (M i)) + {p : ℝ} (hp : 0 ≤ p) + (hsmall : ((additiveGraph H b - additiveGraph H b).card : ℝ) ≤ Real.exp p * H.card) : + ∃ J ⊆ H, J.Nonempty ∧ + Real.exp (-properAffineRecoveryLogLoss p (Fintype.card I)) * H.card ≤ (J.card : ℝ) ∧ + ∃ (r : ℕ) (R : Fin r → ℕ) (Φ : (Fin r → ℤ) →+ (Option I → ℤ)) + (base : Option I → ℤ), + (r : ℝ) ≤ properAffineRankBound p (Fintype.card I) ∧ + (let reduce := FreimanModel.variableIntegerGraphReduction N M + let η := (AddMonoidHom.fst (ZMod N) (∀ i, ZMod (M i))).comp (reduce.comp Φ) + Set.InjOn η (centeredIntegerBox R : Set _)) ∧ + ∀ h ∈ J, ∃ x : Fin r → ℤ, (∀ i, |x i| ≤ (R i : ℤ)) ∧ + FreimanModel.variableIntegerGraphLift N M (h, b h) = base + Φ x := by + classical + obtain ⟨J₀, hJ₀H, hJ₀, hsize, r, R, Φ, hrank, hvolume, + J, hJJ₀, hJ, hretain, base, hproper, hrepr⟩ := + exists_small_difference_graph_proper_coordinates N M H hH b hp hsmall + have hfactor : ((2 : ℝ) ^ 4)⁻¹ * (Real.exp (p + 13 * Fintype.card I))⁻¹ ≤ 1 := by + calc + _ ≤ (Real.exp (p + 13 * Fintype.card I))⁻¹ := + mul_le_of_le_one_left (by positivity) (by norm_num) + _ ≤ 1 := inv_le_one_of_one_le₀ (Real.one_le_exp_iff.mpr (by positivity)) + have hweaker : Real.exp (-(quarticBogolyubovProgressionConstant * + (roundedModelLogBudget p (Fintype.card I) + 1) ^ 8)) * + ((2 ^ 4 : ℝ)⁻¹ * (Real.exp (p + 13 * Fintype.card I))⁻¹ * H.card) ≤ + 16 ^ (Fintype.card I + 2) * (J₀.card : ℝ) := by + apply le_trans _ hsize + apply mul_le_mul_of_nonneg_left _ (Real.exp_nonneg _) + exact mul_le_of_le_one_left (Nat.cast_nonneg _) hfactor + have hdense₀ := exp_neg_affineRecoveryLogLoss_card_le p (Fintype.card I) H.card J₀.card hweaker + have hcost := properAffineSelection_bounds hp (Fintype.card I) r + (∏ i, (2 * R i + 1)) H.card J₀.card J.card hJ₀.card_pos hrank hvolume hdense₀ hretain + exact ⟨J, hJJ₀.trans hJ₀H, hJ, hcost.2, r, + (fun i => R i / (2 * ((2 ^ r * ∏ j, (2 * R j + 1)) / J₀.card + 1))), + Φ, base, hrank, hproper, hrepr⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SmoothSpatialCostBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SmoothSpatialCostBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..03c09732b326a56839e6c7426491d23522c3af9c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SmoothSpatialCostBudget.lean @@ -0,0 +1,342 @@ +import OAI.Combinatorics.Progressions.Dynamics.JointPivotProfileBudget +import OAI.Combinatorics.Progressions.Probability.SmoothSpatialProbability + +namespace OAI + +section + +namespace Erdos3 + +theorem selectedColumn_card {I J : Type*} [Fintype I] [Fintype J] (s : I ↪ J) : + Fintype.card I + Fintype.card (UnselectedColumn s) = Fintype.card J := by + simpa only [Fintype.card_sum] using Fintype.card_congr (selectedColumnEquiv s) + +theorem selectedSpatial_dimension {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] (s : I ↪ J) : + Fintype.card (Unit ⊕ I) + Fintype.card (UnselectedColumn s ⊕ N) = + 1 + Fintype.card J + Fintype.card N := by + have h := selectedColumn_card s + simp only [Fintype.card_sum, Fintype.card_unit] + omega + +theorem scalarSpatialIndexAllowance_le_exp (I : Type*) [Fintype I] {B : ℕ} {R : ℝ} + (hB : (B : ℝ) ≤ Real.exp R) : + scalarSpatialIndexAllowance I B ≤ Real.exp ((Fintype.card I + 1 : ℝ) * R) := by + unfold scalarSpatialIndexAllowance + calc + _ ≤ (Real.exp R)^(Fintype.card I + 1) := pow_le_pow_left₀ (Nat.cast_nonneg _) hB _ + _ = _ := by rw [← Real.exp_nat_mul]; push_cast; rfl + +theorem scalarSpatialInverseAllowance_le_exp (I : Type*) [Fintype I] {B : ℕ} {R : ℝ} + (hB : (B : ℝ) ≤ Real.exp R) : + scalarSpatialInverseAllowance I B ≤ + Real.exp ((Fintype.card I + 1 : ℝ) + (Fintype.card I + 1 : ℝ)^2 + R) := by + have hn : (Fintype.card I + 1 : ℝ) ≤ Real.exp (Fintype.card I + 1 : ℝ) := by + linarith [Real.add_one_le_exp (Fintype.card I + 1 : ℝ)] + have hf : ((Fintype.card I + 1).factorial : ℝ) ≤ Real.exp ((Fintype.card I + 1 : ℝ)^2) := by + simpa only [Nat.cast_add, Nat.cast_one] using factorial_le_exp_sq (Fintype.card I + 1) + unfold scalarSpatialInverseAllowance + calc + _ ≤ Real.exp (Fintype.card I + 1 : ℝ) * Real.exp ((Fintype.card I + 1 : ℝ)^2) * Real.exp R := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add] + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def smoothSpatialMeshThreshold (I J N : Type*) + [Fintype I] [Fintype J] [Fintype N] (L : ℕ) : ℝ := + 2 * 4 ^ (1 + Fintype.card J + Fintype.card N) * + (1 + Fintype.card J + Fintype.card N : ℝ) * probabilityProfileLipschitz * + (((Fintype.card I).factorial : ℝ) * (L : ℝ)^Fintype.card I) + +theorem smoothSpatial_profile_dimensions {I J N : Type*} + [Fintype I] [Fintype J] [Fintype N] (s : I ↪ J) : + Fintype.card (UnselectedColumn s) + Fintype.card (Unit ⊕ I) = 1 + Fintype.card J ∧ + Fintype.card (UnselectedColumn s ⊕ N) + Fintype.card (Unit ⊕ I) = + 1 + Fintype.card J + Fintype.card N := by + have h := selectedColumn_card s + simp only [Fintype.card_sum, Fintype.card_unit] + omega + +theorem smoothSpatial_mesh_conditions {I J N : Type*} + [Fintype I] [Fintype J] [Fintype N] (s : I ↪ J) {L : ℕ} {ρ : ℝ} + (hρ : 0 < ρ) (hlarge : smoothSpatialMeshThreshold I J N L ≤ ρ) : + ((Fintype.card I).factorial : ℝ) * (L : ℝ)^Fintype.card I ≤ ρ ∧ + 4 ^ (Fintype.card (Unit ⊕ I) + Fintype.card (UnselectedColumn s ⊕ N)) * + (((Fintype.card (UnselectedColumn s ⊕ N) + Fintype.card (Unit ⊕ I)) : ℝ) * + probabilityProfileLipschitz) * + ((((Fintype.card I).factorial : ℝ) * (L : ℝ)^Fintype.card I) / ρ) ≤ 1 / 2 := by + let d := 1 + Fintype.card J + Fintype.card N + let D : ℝ := ((Fintype.card I).factorial : ℝ) * (L : ℝ)^Fintype.card I + have hD : 0 ≤ D := by dsimp [D]; positivity + have hd : (1 : ℝ) ≤ d := by exact_mod_cast (show 1 ≤ d by dsimp [d]; omega) + have hA : (1 : ℝ) ≤ probabilityProfileLipschitz := probabilityProfileLipschitz_one_le + have hpow : (1 : ℝ) ≤ 4 ^ d := one_le_pow₀ (by norm_num) + have hfactor : 1 ≤ 2 * (4 : ℝ) ^ d * d * probabilityProfileLipschitz := by + have hprod : (1 : ℝ) ≤ 4 ^ d * d * probabilityProfileLipschitz := by + calc + 1 = 1 * 1 * 1 := by norm_num + _ ≤ 4 ^ d * d * probabilityProfileLipschitz := + mul_le_mul (mul_le_mul hpow hd zero_le_one (by positivity)) hA + (by norm_num) (by positivity) + nlinarith + have hl : 2 * (4 : ℝ)^d * d * probabilityProfileLipschitz * D ≤ ρ := by + simpa only [smoothSpatialMeshThreshold, d, D, Nat.cast_add, Nat.cast_one] using hlarge + refine ⟨(le_mul_of_one_le_left hD hfactor).trans hl, ?_⟩ + have hc : (Fintype.card (UnselectedColumn s ⊕ N) : ℝ) + Fintype.card (Unit ⊕ I) = d := by + exact_mod_cast (smoothSpatial_profile_dimensions (N := N) s).2 + rw [selectedSpatial_dimension s, hc] + change (4 : ℝ)^d * ((d : ℝ) * probabilityProfileLipschitz) * (D / ρ) ≤ 1 / 2 + apply (le_div_iff₀ (by norm_num : (0 : ℝ) < 2)).mpr + have he : (4 : ℝ)^d * ((d : ℝ) * probabilityProfileLipschitz) * (D / ρ) * 2 = + (2 * 4^d * d * probabilityProfileLipschitz * D) / ρ := by ring + rw [he] + exact (div_le_one hρ).mpr hl + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +noncomputable def smoothSpatialDiscretizationCost {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) (M L : ℕ) : ℝ := + (normalizedFiberErrorConstant (Fintype.card (Unit ⊕ I)) (Fintype.card (UnselectedColumn s ⊕ N)) + (scalarSpatialIndexAllowance I M) (scalarSpatialInverseAllowance I M) + (Fintype.card (UnselectedColumn s ⊕ N)) 1 1 + ((Fintype.card (UnselectedColumn s ⊕ N)+Fintype.card (Unit ⊕ I))*probabilityProfileLipschitz) * + (Fintype.card (Unit ⊕ I)).factorial) * (L : ℝ)^Fintype.card (Unit ⊕ I) + +noncomputable def smoothSpatialDisplacementCost {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) (M : ℕ) : ℝ := + scalarSpatialIndexAllowance I M * + spatialKernelErrorConstant (Fintype.card (Unit ⊕ I)) (Fintype.card (UnselectedColumn s)) + (scalarSpatialInverseAllowance I M) 1 + ((Fintype.card (UnselectedColumn s)+Fintype.card (Unit ⊕ I))*probabilityProfileLipschitz) * + Fintype.card N + +theorem smoothSpatialError_decomposition {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) (M L : ℕ) (ρ ξ : ℝ) : + smoothSpatialError N s M L ρ ξ = + smoothSpatialDiscretizationCost N s M L/ρ+smoothSpatialDisplacementCost N s M*ξ := by + unfold smoothSpatialError smoothSpatialDiscretizationCost smoothSpatialDisplacementCost + ring + +theorem smoothSpatialDiscretizationCost_nonneg {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) (M L : ℕ) : + 0 ≤ smoothSpatialDiscretizationCost N s M L := by + unfold smoothSpatialDiscretizationCost normalizedFiberErrorConstant integerFiberErrorConstant + scalarSpatialIndexAllowance scalarSpatialInverseAllowance + positivity + +theorem smoothSpatialDisplacementCost_nonneg {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) (M : ℕ) : + 0 ≤ smoothSpatialDisplacementCost N s M := by + unfold smoothSpatialDisplacementCost spatialKernelErrorConstant + scalarSpatialIndexAllowance scalarSpatialInverseAllowance + positivity + +theorem smoothSpatial_error_choices {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) (M L : ℕ) {ε : ℝ} (hε : 0 < ε) : + let ρ := twoTermErrorResolution (smoothSpatialMeshThreshold I J N L) + (smoothSpatialDiscretizationCost N s M L) ε + let ξ := twoTermErrorWidth (smoothSpatialDisplacementCost N s M) ε + 0 < ρ ∧ smoothSpatialMeshThreshold I J N L ≤ ρ ∧ + 0 < ξ ∧ ξ ≤ 1 ∧ smoothSpatialError N s M L ρ ξ ≤ ε := by + dsimp only + rw [smoothSpatialError_decomposition] + exact twoTermErrorChoices_spec (by unfold smoothSpatialMeshThreshold; positivity) + (smoothSpatialDiscretizationCost_nonneg N s M L) (smoothSpatialDisplacementCost_nonneg N s M) hε + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +noncomputable def spatialProfileLog (j d : ℕ) (p : ℝ) : ℝ := + (j+1)*p+(j : ℝ)^2+2*j+d+probabilityProfileLipschitz+1 + +theorem spatialProfileLog_nonneg (j d : ℕ) {p : ℝ} (hp : 0 ≤ p) : + 0 ≤ spatialProfileLog j d p := by unfold spatialProfileLog; positivity + +theorem spatialProfileLog_bounds {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) {M : ℕ} {p : ℝ} + (hp : 0 ≤ p) (hM : (M : ℝ) ≤ Real.exp p) : + let j := Fintype.card (Unit ⊕ I) + let d := Fintype.card (UnselectedColumn s ⊕ N) + let P := spatialProfileLog j d p + scalarSpatialIndexAllowance I M ≤ Real.exp P ∧ + scalarSpatialInverseAllowance I M ≤ Real.exp P ∧ + (d : ℝ) ≤ Real.exp P ∧ + ((d+j : ℝ)*probabilityProfileLipschitz) ≤ Real.exp P := by + dsimp only + let j := Fintype.card (Unit ⊕ I) + let d := Fintype.card (UnselectedColumn s ⊕ N) + have hj : (Fintype.card I+1 : ℝ) = j := by + simp only [j, Fintype.card_sum, Fintype.card_unit, Nat.cast_add, Nat.cast_one] + ring + have hj0 : (0 : ℝ) ≤ j := Nat.cast_nonneg _ + have hd0 : (0 : ℝ) ≤ d := Nat.cast_nonneg _ + have hκ : (0 : ℝ) ≤ probabilityProfileLipschitz := NNReal.coe_nonneg _ + have hG := scalarSpatialIndexAllowance_le_exp I hM + have hU := scalarSpatialInverseAllowance_le_exp I hM + rw [hj] at hG hU + have hn : (d+j : ℝ) ≤ Real.exp (d+j : ℝ) := by + linarith [Real.add_one_le_exp (d+j : ℝ)] + have hk : (probabilityProfileLipschitz : ℝ) ≤ Real.exp probabilityProfileLipschitz := by + linarith [Real.add_one_le_exp (probabilityProfileLipschitz : ℝ)] + refine ⟨hG.trans (Real.exp_le_exp.mpr ?_), hU.trans (Real.exp_le_exp.mpr ?_), ?_, ?_⟩ + · change (j : ℝ)*p ≤ spatialProfileLog j d p + unfold spatialProfileLog + nlinarith + · change (j : ℝ)+j^2+p ≤ spatialProfileLog j d p + unfold spatialProfileLog + nlinarith + · calc + (d : ℝ) ≤ Real.exp d := by linarith [Real.add_one_le_exp (d : ℝ)] + _ ≤ Real.exp (spatialProfileLog j d p) := by + apply Real.exp_le_exp.mpr + unfold spatialProfileLog + nlinarith + · calc + (d+j : ℝ)*probabilityProfileLipschitz ≤ + Real.exp (d+j : ℝ)*Real.exp probabilityProfileLipschitz := + mul_le_mul hn hk hκ (Real.exp_pos _).le + _ = Real.exp ((d+j : ℝ)+probabilityProfileLipschitz) := (Real.exp_add _ _).symm + _ ≤ Real.exp (spatialProfileLog j d p) := by + apply Real.exp_le_exp.mpr + unfold spatialProfileLog + nlinarith + +noncomputable def spatialDiscretizationLog (j d : ℕ) (p l : ℝ) : ℝ := + let P := spatialProfileLog j d p + 2*(j : ℝ)^2+(2*j+4)*P+(j+2*d)*(P+4)+4+j*l + +theorem smoothSpatialDiscretizationCost_le_exp {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) {M L : ℕ} {p l : ℝ} + (hp : 0 ≤ p) (hM : (M : ℝ) ≤ Real.exp p) (hL : (L : ℝ) ≤ Real.exp l) : + smoothSpatialDiscretizationCost N s M L ≤ + Real.exp (spatialDiscretizationLog (Fintype.card (Unit ⊕ I)) + (Fintype.card (UnselectedColumn s ⊕ N)) p l) := by + let j := Fintype.card (Unit ⊕ I) + let d := Fintype.card (UnselectedColumn s ⊕ N) + let P := spatialProfileLog j d p + obtain ⟨hG, hU, hV, hK⟩ := spatialProfileLog_bounds N s hp hM + have hP : 0 ≤ P := spatialProfileLog_nonneg j d hp + have hone : (1 : ℝ) ≤ Real.exp P := Real.one_le_exp_iff.mpr hP + have hc := coefficientComparisonConstant_le_exp j d + ((d+j)*probabilityProfileLipschitz) hP + (by unfold scalarSpatialIndexAllowance; positivity) + (by unfold scalarSpatialInverseAllowance; positivity) + (Nat.cast_nonneg d) zero_le_one zero_le_one zero_le_one + hG hU hV hone hone (by simpa only [NNReal.coe_mul, NNReal.coe_add, NNReal.coe_natCast] using hK) hone + simp only [one_pow, mul_one] at hc + unfold smoothSpatialDiscretizationCost + calc + _ ≤ Real.exp (2*(j : ℝ)^2+(2*j+4)*P+(j+2*d)*(P+4)+4) * (Real.exp l)^j := + mul_le_mul hc (pow_le_pow_left₀ (Nat.cast_nonneg _) hL j) (by positivity) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_nat_mul, ← Real.exp_add]; rfl + +theorem spatialKernelErrorConstant_le_exp (j e : ℕ) {U P : ℝ} (K : ℝ≥0) + (hU0 : 0 ≤ U) (hU : U ≤ Real.exp P) (hK : (K : ℝ) ≤ Real.exp P) : + spatialKernelErrorConstant j e U 1 K ≤ + Real.exp ((j : ℝ)^2+(j+2)*P+2*e) := by + have htwo : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + unfold spatialKernelErrorConstant + norm_num only [mul_one] + calc + _ ≤ (Real.exp ((j : ℝ)^2)*(Real.exp P)^j)*(Real.exp 2)^e*Real.exp P*Real.exp P := by + gcongr + exact factorial_le_exp_sq j + _ = _ := by + rw [← Real.exp_nat_mul, ← Real.exp_nat_mul] + simp only [← Real.exp_add] + congr 1 + ring + +noncomputable def spatialDisplacementLog (j d e n : ℕ) (p : ℝ) : ℝ := + (j : ℝ)^2+(j+3)*spatialProfileLog j d p+2*e+n + +theorem smoothSpatialDisplacementCost_le_exp {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) {M : ℕ} {p : ℝ} + (hp : 0 ≤ p) (hM : (M : ℝ) ≤ Real.exp p) : + smoothSpatialDisplacementCost N s M ≤ + Real.exp (spatialDisplacementLog (Fintype.card (Unit ⊕ I)) + (Fintype.card (UnselectedColumn s ⊕ N)) (Fintype.card (UnselectedColumn s)) + (Fintype.card N) p) := by + let j := Fintype.card (Unit ⊕ I) + let d := Fintype.card (UnselectedColumn s ⊕ N) + let e := Fintype.card (UnselectedColumn s) + let P := spatialProfileLog j d p + obtain ⟨hG, hU, _, hK⟩ := spatialProfileLog_bounds N s hp hM + have he : (e : ℝ) ≤ d := by + simp only [d, e, Fintype.card_sum, Nat.cast_add] + exact le_add_of_nonneg_right (Nat.cast_nonneg _) + have hsmall : ((e+j : ℝ)*probabilityProfileLipschitz) ≤ Real.exp P := by + apply le_trans _ hK + gcongr + have hc := spatialKernelErrorConstant_le_exp j e ((e+j)*probabilityProfileLipschitz) + (by unfold scalarSpatialInverseAllowance; positivity) hU + (by simpa only [NNReal.coe_mul, NNReal.coe_add, NNReal.coe_natCast] using hsmall) + have hn : (Fintype.card N : ℝ) ≤ Real.exp (Fintype.card N : ℝ) := by + linarith [Real.add_one_le_exp (Fintype.card N : ℝ)] + unfold smoothSpatialDisplacementCost + calc + _ ≤ Real.exp P * Real.exp ((j : ℝ)^2+(j+2)*P+2*e) * Real.exp (Fintype.card N : ℝ) := by + apply mul_le_mul _ hn (Nat.cast_nonneg _) (by positivity) + exact mul_le_mul hG hc (by unfold spatialKernelErrorConstant scalarSpatialInverseAllowance; positivity) + (Real.exp_pos _).le + _ = _ := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + dsimp [spatialDisplacementLog, P] + ring + +noncomputable def spatialMeshLog (a b n : ℕ) (l : ℝ) : ℝ := + 2+5*(1+b+n)+probabilityProfileLipschitz+(a : ℝ)^2+a*l + +theorem smoothSpatialMeshThreshold_le_exp (I J N : Type*) + [Fintype I] [Fintype J] [Fintype N] {L : ℕ} {l : ℝ} + (hL : (L : ℝ) ≤ Real.exp l) : + smoothSpatialMeshThreshold I J N L ≤ + Real.exp (spatialMeshLog (Fintype.card I) (Fintype.card J) (Fintype.card N) l) := by + have htwo : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have hfour : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + have hd : (1+Fintype.card J+Fintype.card N : ℝ) ≤ + Real.exp (1+Fintype.card J+Fintype.card N : ℝ) := by + linarith [Real.add_one_le_exp (1+Fintype.card J+Fintype.card N : ℝ)] + have hk : (probabilityProfileLipschitz : ℝ) ≤ Real.exp probabilityProfileLipschitz := by + linarith [Real.add_one_le_exp (probabilityProfileLipschitz : ℝ)] + unfold smoothSpatialMeshThreshold + calc + _ ≤ Real.exp 2 * (Real.exp 4)^(1+Fintype.card J+Fintype.card N) * + Real.exp (1+Fintype.card J+Fintype.card N : ℝ) * Real.exp probabilityProfileLipschitz * + (Real.exp ((Fintype.card I : ℝ)^2)*(Real.exp l)^Fintype.card I) := by + gcongr + exact factorial_le_exp_sq _ + _ = _ := by + rw [← Real.exp_nat_mul, ← Real.exp_nat_mul] + simp only [← Real.exp_add] + congr 1 + dsimp [spatialMeshLog] + push_cast + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SmoothSpatialSiteExpansion.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SmoothSpatialSiteExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..50ad07a10d2bf2c6bf8b560ac02fea869ea291c4 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SmoothSpatialSiteExpansion.lean @@ -0,0 +1,65 @@ +import OAI.Combinatorics.Progressions.Dynamics.VectorSiteBudget +import OAI.Combinatorics.Progressions.Linear.SmoothSpatialKernelRegularity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem goodScalarKernelTuple_site_expansion {I J N : Type*} + [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] [Fintype N] + {L B : ℕ} {H : ℝ} (s : I ↪ J) (x : J → IntegerScalarCubeBox I L) (root : J → ℤ) + (hB : 0 < B) (hL : 0 < L) (hH : 0 < H) + (hx : GoodScalarKernelTuple s (1 / (B : ℝ)) B x) (hroot : ∀ j, |root j| ≤ (L : ℤ)) : + let A := selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s + let A' := selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s + let hA := goodScalarKernelTuple_spatial_det_ne_zero s x root + (one_div_pos.mpr (by exact_mod_cast hB)) hx + let f := smoothSpatialKernelDensity s root (scalarCubeDifferenceMatrix x) hA H L hH (by exact_mod_cast hL) + let G := scalarSpatialIndexAllowance I B + let K := smoothSpatialDensityLip s B + ∃ (m : ℕ) (hm : 0 < m), m ≤ B ∧ + letI : NeZero m := ⟨hm.ne'⟩ + ∀ (C : Matrix (Unit ⊕ I) N ℤ) (ε : ℝ), 0 < ε → + let r := spatialSiteRadius G K ε + 0 < r ∧ + ((∑ a : (Unit ⊕ I) → ZMod m, ∑ k : (Unit ⊕ I) → Fin (intervalSiteCount 1 r), + ‖latticeStarMask (pivotFullImage A (Matrix.fromCols A' C)) m a * + spatialStarDensity f (fun i => intervalSiteCenter 1 r (k i))‖) ≤ + (m : ℝ)^Fintype.card (Unit ⊕ I) * (intervalSiteCount 1 r : ℝ)^Fintype.card (Unit ⊕ I) * + (G * smoothSpatialDensityCap s B)) ∧ + ∀ v : (Unit ⊕ I) → ℤ, (∀ i, |((spatialStar v i : ℤ) : ℝ) / H| ≤ 1) → + ‖(maskedIntegerImageDensity A (Matrix.fromCols A' C) (fun _ => H) f v : ℂ) - + spatialSiteApprox A (Matrix.fromCols A' C) m f H 1 r v‖ ≤ ε := by + obtain ⟨hcap, hlip⟩ := smoothSpatialKernelDensity_bounds s x root hB hL hH hx hroot + obtain ⟨m, hm, hmB, hp⟩ := goodScalarKernelTuple_selected_period s x root hx + refine ⟨m, hm, hmB, ?_⟩ + let : NeZero m := ⟨hm.ne'⟩ + intro C ε hε + have hG : 0 ≤ scalarSpatialIndexAllowance I B := by unfold scalarSpatialIndexAllowance; positivity + have hK := smoothSpatialDensityLip_nonneg s B + have hr := spatialSiteRadius_pos hG hK hε + have hindex : ((pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s) C)).toAddSubgroup.index : ℝ) ≤ + scalarSpatialIndexAllowance I B := by + unfold scalarSpatialIndexAllowance + exact_mod_cast selectedSpatial_extended_index root (scalarCubeDifferenceMatrix x) s C hx.2 + have hpfull : integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) s) + (Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) s) C) := by + rw [pivotFullImage_split] + exact hp.trans le_sup_left + refine ⟨hr, spatialSiteApprox_coefficient_sum _ _ m _ 1 _ hindex hcap, ?_⟩ + intro v hv + have he := spatialSiteApprox_error _ _ m hpfull _ hlip hindex zero_lt_one hr H v hv + rw [Real.coe_toNNReal _ hK] at he + exact he.trans (spatialSiteRadius_error hG hK hε.le) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SortedLayerCoordinateEnumeration.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SortedLayerCoordinateEnumeration.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4e67fb74b2e64025895e735c53040cc5bfb8c67 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SortedLayerCoordinateEnumeration.lean @@ -0,0 +1,57 @@ +import OAI.Combinatorics.Progressions.Estimates.SortedPositiveWeights +import OAI.Combinatorics.Progressions.Polynomial.PolynomialPatchProductBudget + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {m : ℕ} (E : Fin m → Type) [∀ j, Fintype (E j)] + +noncomputable def sortedLayerCoordinateEquiv : + Fin (Fintype.card (Σ j, E j)) ≃ (Σ j, E j) := + (Tuple.sort (fun i : Fin (Fintype.card (Σ j, E j)) => + ((Fintype.equivFin (Σ j, E j)).symm i).1.val + 1)).trans + (Fintype.equivFin (Σ j, E j)).symm + +noncomputable def sortedLayerCoordinateWeight (i : Fin (Fintype.card (Σ j, E j))) : ℕ := + (sortedLayerCoordinateEquiv E i).1.val + 1 + +theorem sortedLayerCoordinateWeight_pos (i : Fin (Fintype.card (Σ j, E j))) : + 1 ≤ sortedLayerCoordinateWeight E i := Nat.succ_le_succ (Nat.zero_le _) + +theorem sortedLayerCoordinateWeight_le (i : Fin (Fintype.card (Σ j, E j))) : + sortedLayerCoordinateWeight E i ≤ m := + Nat.succ_le_of_lt (sortedLayerCoordinateEquiv E i).1.isLt + +theorem sortedLayerCoordinateWeight_mono : Monotone (sortedLayerCoordinateWeight E) := + Tuple.monotone_sort (fun i : Fin (Fintype.card (Σ j, E j)) => + ((Fintype.equivFin (Σ j, E j)).symm i).1.val + 1) + +theorem sum_sortedLayerCoordinateEquiv {A : Type*} [AddCommMonoid A] + (f : (Σ j, E j) → A) : + (∑ i, f (sortedLayerCoordinateEquiv E i)) = ∑ a, f a := by + apply Fintype.sum_equiv (sortedLayerCoordinateEquiv E) + intro _ + rfl + +noncomputable def sortedLayerCoordinatePatch {X : Type} {s : ℕ} + (hm : m ≤ s) (P : (j : Fin m) → E j → MvPolynomial X ℝ) + (hP : ∀ j i, P j i ∈ weightedSupportLE (fun _ : X => 1) (j.val + 1)) + (Φ : PatchKernel (Fintype.card (Σ j, E j))) : + PolynomialPatch X s (Fintype.card (Σ j, E j)) := + PolynomialPatch.ofCoordinates (sortedLayerCoordinateWeight E) + (sortedLayerCoordinateWeight_pos E) + (fun i => (sortedLayerCoordinateWeight_le E i).trans hm) + (sortedLayerCoordinateWeight_mono E) + (fun i => P (sortedLayerCoordinateEquiv E i).1 (sortedLayerCoordinateEquiv E i).2) + (fun i => hP (sortedLayerCoordinateEquiv E i).1 (sortedLayerCoordinateEquiv E i).2) Φ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SparseCoordinateCorrections.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SparseCoordinateCorrections.lean new file mode 100644 index 0000000000000000000000000000000000000000..2028ec767ea182ef62fad82363f9ac50cedb2a28 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SparseCoordinateCorrections.lean @@ -0,0 +1,62 @@ +import OAI.Combinatorics.Progressions.Estimates.SelectedImageCorrections +import OAI.Combinatorics.Progressions.Linear.RealSparseFourProjection + +namespace OAI + +section + +namespace Erdos3 + +open scoped Matrix + +theorem exists_sparse_coordinate_corrections + {ι κ σ : Type*} [Fintype ι] [Fintype κ] + (J : Submodule ℚ (Fin 4 → ι → ℚ)) (K : Finset (Fin 4)) + (v : κ → Fin 4 → ι → ℚ) (hv : Submodule.span ℚ (Set.range v) = J) + {H l : ℕ} (hH : 1 ≤ H) (hl : 0 < l) + (hvH : ∀ a k i, RationalHeightLE (v a k i) H) + {p : ℝ} (hp : 0 ≤ p) + (hι : (Fintype.card (Σ _ : Fin 4, ι) : ℝ) ≤ p) + (hK : (Fintype.card (Σ _ : K, ι) : ℝ) ≤ p) + (hκ : (Fintype.card κ : ℝ) ≤ p) + (hHp : (H : ℝ) ≤ Real.exp p) (hlp : (l : ℝ) ≤ Real.exp p) + (T : σ → ℝ) (hT : ∀ i, Real.exp (separationBudget p) ≤ T i) : + ∃ m : ℕ, 0 < m ∧ (m : ℝ) ≤ Real.exp ((p + 2) ^ 3 + (p + 2) ^ 36) ∧ + ∀ (α : σ →₀ ℕ), α ≠ 0 → + ∀ (a b : (Σ _ : K, ι) → ℝ) (x : (Σ _ : Fin 4, ι) → ℝ), + x ∈ realFourCoordinateSpan J → + ‖a‖ ≤ Real.exp p / monomialScale T α → b ∈ realDenominatorGrid l → + (∀ j : Σ _ : K, ι, x ⟨j.1, j.2⟩ = a j + b j) → + ∃ e q : (Σ _ : Fin 4, ι) → ℝ, + e ∈ realFourCoordinateSpan J ∧ q ∈ realFourCoordinateSpan J ∧ + (∀ j : Σ _ : K, ι, e ⟨j.1, j.2⟩ = a j) ∧ + (∀ j : Σ _ : K, ι, q ⟨j.1, j.2⟩ = b j) ∧ + ‖e‖ ≤ Real.exp ((p + 2) ^ 3 + (p + 2) ^ 18 + p) / monomialScale T α ∧ + q ∈ realDenominatorGrid m ∧ + x - e - q ∈ realFourCoordinateSpan J ∧ + (fun i => (x - e - q) ⟨0, i⟩) ∈ + realRationalCoordinateSpan (fourSparseFirstProjection J K) := by + let A : Matrix (Σ _ : Fin 4, ι) κ ℚ := fun j a => v a j.1 j.2 + let ρ : (Σ _ : K, ι) → (Σ _ : Fin 4, ι) := fun j => ⟨j.1, j.2⟩ + have hspan : realFourCoordinateSpan J = + LinearMap.range (Matrix.mulVecLin (fun i j => (A i j : ℝ))) := by + ext x + rw [← hv, realFourCoordinateSpan_span] + exact real_column_span_mem_iff A x + obtain ⟨S, m, hm, hmp, hsolve⟩ := exists_selected_image_corrections A ρ hH hl + (fun i a => hvH a i.1 i.2) hp hι hK hκ hHp hlp T hT + refine ⟨m, hm, hmp, ?_⟩ + intro α hα a b x hx ha hb hselect + obtain ⟨he, hq, heq, hqq, hslow, hgrid, hrem, hzero⟩ := + hsolve α hα a b x (hspan ▸ hx) ha hb hselect + refine ⟨_, _, hspan.symm ▸ he, hspan.symm ▸ hq, heq, hqq, hslow, hgrid, + hspan.symm ▸ hrem, ?_⟩ + apply mem_realSparseFirstProjection_of_zero J K _ (hspan.symm ▸ hrem) + intro k hk i + exact hzero ⟨⟨k, hk⟩, i⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialChoiceEnvelope.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialChoiceEnvelope.lean new file mode 100644 index 0000000000000000000000000000000000000000..931ac70f48438f27b0e229e0a936190ef2ef8976 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialChoiceEnvelope.lean @@ -0,0 +1,742 @@ +import OAI.Combinatorics.Progressions.Lattices.PrincipalJoinedResidues +import OAI.Combinatorics.Progressions.Sampling.JointFrozenSamplerLaw +import OAI.Combinatorics.Progressions.Sampling.SpatialGridVolume + +namespace OAI + +section + +namespace Erdos3 + +theorem smoothSpatialDensityCap_le_exp {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) (B : ℕ) {R : ℝ} (hU : scalarSpatialInverseAllowance I B ≤ Real.exp R) : + smoothSpatialDensityCap s B ≤ Real.exp + ((Fintype.card (Unit ⊕ I) : ℝ)^2 + Fintype.card (Unit ⊕ I) * R + + 2 * Fintype.card (UnselectedColumn s)) := by + have hU0 : 0 ≤ scalarSpatialInverseAllowance I B := by unfold scalarSpatialInverseAllowance; positivity + have hfact := factorial_le_exp_sq (Fintype.card (Unit ⊕ I)) + have htwo : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + unfold smoothSpatialDensityCap + calc + _ ≤ Real.exp ((Fintype.card (Unit ⊕ I) : ℝ)^2) * + (Real.exp R)^Fintype.card (Unit ⊕ I) * (Real.exp 2)^Fintype.card (UnselectedColumn s) := by gcongr + _ = _ := by + rw [← Real.exp_nat_mul, ← Real.exp_nat_mul, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + +theorem smoothSpatialDensityLip_le_exp {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) (B : ℕ) {R : ℝ} (hU : scalarSpatialInverseAllowance I B ≤ Real.exp R) : + smoothSpatialDensityLip s B ≤ Real.exp + ((Fintype.card (Unit ⊕ I) : ℝ)^2 + (Fintype.card (Unit ⊕ I) + 1) * R + + 3 * Fintype.card (UnselectedColumn s) + Fintype.card (Unit ⊕ I) + probabilityProfileLipschitz) := by + have hcap := smoothSpatialDensityCap_le_exp s B hU + have hn : (Fintype.card (UnselectedColumn s) + Fintype.card (Unit ⊕ I) : ℝ) ≤ + Real.exp (Fintype.card (UnselectedColumn s) + Fintype.card (Unit ⊕ I) : ℝ) := by + linarith [Real.add_one_le_exp (Fintype.card (UnselectedColumn s) + Fintype.card (Unit ⊕ I) : ℝ)] + have hA : (probabilityProfileLipschitz : ℝ) ≤ Real.exp (probabilityProfileLipschitz : ℝ) := by + linarith [Real.add_one_le_exp (probabilityProfileLipschitz : ℝ)] + have hcap0 := smoothSpatialDensityCap_nonneg s B + have hU0 : 0 ≤ scalarSpatialInverseAllowance I B := by unfold scalarSpatialInverseAllowance; positivity + unfold smoothSpatialDensityLip + calc + _ ≤ Real.exp ((Fintype.card (Unit ⊕ I) : ℝ)^2 + Fintype.card (Unit ⊕ I) * R + + 2 * Fintype.card (UnselectedColumn s)) * + (Real.exp (Fintype.card (UnselectedColumn s) + Fintype.card (Unit ⊕ I) : ℝ) * + Real.exp (probabilityProfileLipschitz : ℝ)) * Real.exp R := by gcongr + _ = _ := by + rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def spatialGridAccuracy (n j : ℕ) (τ : ℝ) : ℝ := τ/(4*5^(n*j)) + +theorem spatialGridAccuracy_pos (n j : ℕ) {τ : ℝ} (hτ : 0 < τ) : + 0 < spatialGridAccuracy n j τ := by unfold spatialGridAccuracy; positivity + +theorem spatialGridAccuracy_le (n j : ℕ) {τ : ℝ} (hτ : 0 ≤ τ) : + spatialGridAccuracy n j τ ≤ τ/4 := by + have hpow : (1 : ℝ) ≤ 5^(n*j) := one_le_pow₀ (by norm_num) + unfold spatialGridAccuracy + apply (div_le_iff₀ (by positivity : (0 : ℝ) < 4*5^(n*j))).mpr + nlinarith + +noncomputable def smoothSpatialPointAccuracy {I J : Type*} [Fintype I] [Fintype J] + (n : ℕ) (s : I ↪ J) (M smax : ℕ) (τ : ℝ) : ℝ := + vectorSpatialAccuracy n + (2+((M^smax : ℕ) : ℝ)^Fintype.card (Unit ⊕ I)*smoothSpatialDensityCap s M) + (spatialGridAccuracy n (Fintype.card (Unit ⊕ I)) τ) + +theorem smoothSpatialPointAccuracy_pos {I J : Type*} [Fintype I] [Fintype J] + (n : ℕ) (s : I ↪ J) (M smax : ℕ) {τ : ℝ} (hτ : 0 < τ) : + 0 < smoothSpatialPointAccuracy n s M smax τ := by + have hC := smoothSpatialDensityCap_nonneg s M + exact vectorSpatialAccuracy_pos n (by positivity) (spatialGridAccuracy_pos _ _ hτ) + +noncomputable def smoothJointResolution {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (n : ℕ) (s : I ↪ J) (M L smax : ℕ) (τ : ℝ) : ℝ := + twoTermErrorResolution (smoothSpatialMeshThreshold I J N L) + (smoothSpatialDiscretizationCost N s M L) (smoothSpatialPointAccuracy n s M smax τ) + +noncomputable def smoothJointWidth {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (n : ℕ) (s : I ↪ J) (M smax : ℕ) (τ : ℝ) : ℝ := + twoTermErrorWidth (smoothSpatialDisplacementCost N s M) (smoothSpatialPointAccuracy n s M smax τ) + +noncomputable def smoothJointRadius {I J : Type*} [Fintype I] [Fintype J] + (n : ℕ) (s : I ↪ J) (M smax : ℕ) (τ : ℝ) : ℝ := + spatialSiteRadius (((M^smax : ℕ) : ℝ)^Fintype.card (Unit ⊕ I)) + (smoothSpatialDensityLip s M) (smoothSpatialPointAccuracy n s M smax τ) + +theorem smoothSpatial_output_choices {A I J N U : Type*} + [Fintype A] [Fintype I] [Fintype J] [Fintype N] + (s : I ↪ J) (M smax : ℕ) {ℓ : ℕ} (hℓ : 0 < ℓ) {τ : ℝ} (hτ : 0 < τ) + (L : U → ℕ) (c : A → N → ℤ) (index : A → N → U) : + let ρ := smoothJointResolution N (Fintype.card A) s M ℓ smax τ + let ξ := smoothJointWidth N (Fintype.card A) s M smax τ + let W := fun a n => ((|c a n| : ℤ)+(L (index a n) : ℤ) : ℝ) + let H := fun a => spatialOutputScale ℓ ρ ξ (W a) + let Q := fun (_ : A) (_ : N) => ρ + (∀ a, 0 < H a) ∧ (∀ a, 1 ≤ H a) ∧ (∀ a, ρ ≤ H a/ℓ) ∧ + (∀ a n, 0 < Q a n) ∧ (∀ a n, ρ ≤ Q a n) ∧ + ∀ a n, W a n*Q a n ≤ ξ*H a := by + have hp := smoothSpatialPointAccuracy_pos (Fintype.card A) s M smax hτ + obtain ⟨hρ, _, hξ, _, _⟩ := smoothSpatial_error_choices N s M ℓ hp + let W := fun a n => ((|c a n| : ℤ)+(L (index a n) : ℤ) : ℝ) + have hW (a) (n) : 0 ≤ W a n := by dsimp only [W]; positivity + have hs (a) := spatialOutputScale_spec hℓ hρ hξ (W a) (hW a) + exact ⟨fun a => (hs a).1, fun a => (hs a).2.1, fun a => (hs a).2.2.1, + fun _ _ => hρ, fun _ _ => le_rfl, fun a n => (hs a).2.2.2 n⟩ + +theorem smoothSpatial_grid_tolerance {A I J N : Type*} + [Fintype A] [Fintype I] [Fintype J] [Fintype N] + (s : I ↪ J) (M L smax : ℕ) {τ : ℝ} (hτ : 0 < τ) (hτ1 : τ ≤ 1) + {m : ℕ} (hm : m ≤ M^smax) + (H : A → ℝ) (hH : ∀ a, 1 ≤ H a) + (grid : Finset (A → (Unit ⊕ I) → ℤ)) + (hbox : ∀ v ∈ grid, ∀ a i, |((spatialStar (v a) i : ℤ) : ℝ)/H a| ≤ 1) : + let ρ := smoothJointResolution N (Fintype.card A) s M L smax τ + let ξ := smoothJointWidth N (Fintype.card A) s M smax τ + let r := smoothJointRadius (Fintype.card A) s M smax τ + let E := smoothSpatialError N s M L ρ ξ + let G := (m : ℝ)^Fintype.card (Unit ⊕ I) + let S := Fintype.card A*(E+4*G*smoothSpatialDensityLip s M*r)* + (1+G*smoothSpatialDensityCap s M+E)^Fintype.card A + let Δ := S/(∏ a, ∏ _i : Unit ⊕ I, H a)*grid.card + 0 < ρ ∧ smoothSpatialMeshThreshold I J N L ≤ ρ ∧ + 0 < ξ ∧ ξ ≤ 1 ∧ 0 < r ∧ Δ ≤ τ/4 ∧ Δ+(1+Δ)*(τ/4) ≤ τ := by + let ε := spatialGridAccuracy (Fintype.card A) (Fintype.card (Unit ⊕ I)) τ + let δ := smoothSpatialPointAccuracy (Fintype.card A) s M smax τ + let ρ := smoothJointResolution N (Fintype.card A) s M L smax τ + let ξ := smoothJointWidth N (Fintype.card A) s M smax τ + let r := smoothJointRadius (Fintype.card A) s M smax τ + let E := smoothSpatialError N s M L ρ ξ + let G := (m : ℝ)^Fintype.card (Unit ⊕ I) + let G₀ := ((M^smax : ℕ) : ℝ)^Fintype.card (Unit ⊕ I) + have hC := smoothSpatialDensityCap_nonneg s M + have hK := smoothSpatialDensityLip_nonneg s M + have hε : 0 < ε := spatialGridAccuracy_pos _ _ hτ + have hε1 : ε ≤ 1 := (spatialGridAccuracy_le _ _ hτ.le).trans (by linarith) + have hδ : 0 < δ := smoothSpatialPointAccuracy_pos _ s M smax hτ + obtain ⟨hρ, hmesh, hξ, hξ1, hE⟩ := smoothSpatial_error_choices N s M L hδ + have hG : 0 ≤ G := by positivity + have hG₀ : 0 ≤ G₀ := by positivity + have hGG : G ≤ G₀ := pow_le_pow_left₀ (Nat.cast_nonneg _) (by exact_mod_cast hm) _ + have hr : 0 < r := spatialSiteRadius_pos hG₀ hK hδ + have hE0 : 0 ≤ E := smoothSpatialError_nonneg N s M L hρ.le hξ.le + have hS : Fintype.card A*(E+4*G*smoothSpatialDensityLip s M*r)* + (1+G*smoothSpatialDensityCap s M+E)^Fintype.card A ≤ ε := by + calc + _ ≤ Fintype.card A*(E+4*G₀*smoothSpatialDensityLip s M*r)* + (1+G₀*smoothSpatialDensityCap s M+E)^Fintype.card A := by gcongr + _ ≤ ε := vectorSpatialSiteError_le _ hG₀ hC hK hE0 hε hε1 hE + have hΔ : (Fintype.card A*(E+4*G*smoothSpatialDensityLip s M*r)* + (1+G*smoothSpatialDensityCap s M+E)^Fintype.card A)/ + (∏ a, ∏ _i : Unit ⊕ I, H a)*grid.card ≤ τ/4 := by + calc + _ ≤ 5^(Fintype.card A*Fintype.card (Unit ⊕ I))* + (Fintype.card A*(E+4*G*smoothSpatialDensityLip s M*r)* + (1+G*smoothSpatialDensityCap s M+E)^Fintype.card A) := + spatialGrid_error_le H hH grid hbox (by positivity) + _ ≤ 5^(Fintype.card A*Fintype.card (Unit ⊕ I))*ε := + mul_le_mul_of_nonneg_left hS (by positivity) + _ = τ/4 := by + dsimp only [ε, spatialGridAccuracy] + have hp : (5 : ℝ)^(Fintype.card A*Fintype.card (Unit ⊕ I)) ≠ 0 := by positivity + field_simp + refine ⟨hρ, hmesh, hξ, hξ1, hr, hΔ, ?_⟩ + have hδ1 : (Fintype.card A*(E+4*G*smoothSpatialDensityLip s M*r)* + (1+G*smoothSpatialDensityCap s M+E)^Fintype.card A)/ + (∏ a, ∏ _i : Unit ⊕ I, H a)*grid.card ≤ 1 := by linarith + have hh := mul_le_mul_of_nonneg_right (add_le_add (le_refl (1 : ℝ)) hδ1) + (show 0 ≤ τ/4 by positivity) + linarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def spatialDensityCapLog (j e : ℕ) (p : ℝ) : ℝ := + (j : ℝ)^2+j*(j+(j : ℝ)^2+p)+2*e + +noncomputable def spatialDensityLipLog (j e : ℕ) (p : ℝ) : ℝ := + (j : ℝ)^2+(j+1)*(j+(j : ℝ)^2+p)+3*e+j+probabilityProfileLipschitz + +theorem smoothSpatialDensity_log_bounds {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) {M : ℕ} {p : ℝ} (hM : (M : ℝ) ≤ Real.exp p) : + smoothSpatialDensityCap s M ≤ Real.exp + (spatialDensityCapLog (Fintype.card (Unit ⊕ I)) (Fintype.card (UnselectedColumn s)) p) ∧ + smoothSpatialDensityLip s M ≤ Real.exp + (spatialDensityLipLog (Fintype.card (Unit ⊕ I)) (Fintype.card (UnselectedColumn s)) p) := by + have hU := scalarSpatialInverseAllowance_le_exp I hM + have hj : (Fintype.card I+1 : ℝ) = Fintype.card (Unit ⊕ I) := by + simp only [Fintype.card_sum, Fintype.card_unit, Nat.cast_add, Nat.cast_one] + ring + rw [hj] at hU + exact ⟨smoothSpatialDensityCap_le_exp s M hU, smoothSpatialDensityLip_le_exp s M hU⟩ + +theorem spatialModulusPower_le_exp (j s : ℕ) {M : ℕ} {p : ℝ} + (hM : (M : ℝ) ≤ Real.exp p) : + (((M^s : ℕ) : ℝ)^j) ≤ Real.exp ((j : ℝ)*s*p) := by + push_cast + calc + _ ≤ ((Real.exp p)^s)^j := by gcongr + _ = _ := by + rw [← Real.exp_nat_mul, ← Real.exp_nat_mul] + congr 1 + ring + +theorem spatialGridAccuracy_inverse_le_exp (n j : ℕ) {τ u : ℝ} + (hτ : 0 < τ) (hτu : τ⁻¹ ≤ Real.exp u) : + (spatialGridAccuracy n j τ)⁻¹ ≤ Real.exp (4+5*((n : ℝ)*j)+u) := by + have h4 : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + have h5 : (5 : ℝ) ≤ Real.exp 5 := by linarith [Real.add_one_le_exp (5 : ℝ)] + rw [spatialGridAccuracy, inv_div, div_eq_mul_inv] + calc + _ ≤ Real.exp 4*(Real.exp 5)^(n*j)*Real.exp u := by gcongr + _ = _ := by + rw [← Real.exp_nat_mul, ← Real.exp_add, ← Real.exp_add] + push_cast + congr 1 + ring + +noncomputable def spatialPointLog (n j e s : ℕ) (p u : ℝ) : ℝ := + (n+1)*((j : ℝ)*s*p+spatialDensityCapLog j e p+7+5*((n : ℝ)*j)+u)+n+1 + +theorem smoothSpatialPointAccuracy_inverse_le_exp {I J : Type*} [Fintype I] [Fintype J] + (n : ℕ) (s : I ↪ J) (smax : ℕ) {M : ℕ} {p u τ : ℝ} + (hp : 0 ≤ p) (hu : 0 ≤ u) (hM : (M : ℝ) ≤ Real.exp p) + (hτ : 0 < τ) (hτu : τ⁻¹ ≤ Real.exp u) : + (smoothSpatialPointAccuracy n s M smax τ)⁻¹ ≤ + Real.exp (spatialPointLog n (Fintype.card (Unit ⊕ I)) + (Fintype.card (UnselectedColumn s)) smax p u) := by + let j := Fintype.card (Unit ⊕ I) + let e := Fintype.card (UnselectedColumn s) + let G : ℝ := ((M^smax : ℕ) : ℝ)^j + let g : ℝ := j*smax*p + let c := spatialDensityCapLog j e p + let P := g+c+7+5*((n : ℝ)*j)+u + have hg : 0 ≤ g := by dsimp [g]; positivity + have hc : 0 ≤ c := by dsimp [c, spatialDensityCapLog]; positivity + have hG : G ≤ Real.exp g := spatialModulusPower_le_exp j smax hM + have hC := (smoothSpatialDensity_log_bounds s hM).1 + have hC0 := smoothSpatialDensityCap_nonneg s M + have hm : G*smoothSpatialDensityCap s M ≤ Real.exp (g+c) := by + rw [Real.exp_add] + exact mul_le_mul hG hC hC0 (Real.exp_pos _).le + have hbase : 2+G*smoothSpatialDensityCap s M ≤ Real.exp P := by + have hone : 1 ≤ Real.exp (g+c) := Real.one_le_exp_iff.mpr (by positivity) + have hthree : (3 : ℝ) ≤ Real.exp 3 := by linarith [Real.add_one_le_exp (3 : ℝ)] + calc + _ ≤ 3*Real.exp (g+c) := by linarith + _ ≤ Real.exp 3*Real.exp (g+c) := mul_le_mul_of_nonneg_right hthree (Real.exp_pos _).le + _ = Real.exp (g+c+3) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ Real.exp P := by + apply Real.exp_le_exp.mpr + dsimp [P] + have hn : 0 ≤ 5*((n : ℝ)*j) := by positivity + linarith + have hε : (spatialGridAccuracy n j τ)⁻¹ ≤ Real.exp P := by + apply (spatialGridAccuracy_inverse_le_exp n j hτ hτu).trans + apply Real.exp_le_exp.mpr + dsimp [P] + linarith + exact vectorSpatialAccuracy_inverse_le_exp n (by positivity) + (spatialGridAccuracy_pos n j hτ) hbase hε + +noncomputable def spatialChoiceLog (a b n v e s : ℕ) (p l u : ℝ) : ℝ := + spatialMeshLog a b n l+spatialDiscretizationLog (a+1) (e+n) p l+ + spatialDisplacementLog (a+1) (e+n) e n p+spatialPointLog v (a+1) e s p u + +theorem spatialChoiceLog_nonneg (a b n v e s : ℕ) {p l u : ℝ} + (hp : 0 ≤ p) (hl : 0 ≤ l) (hu : 0 ≤ u) : + 0 ≤ spatialChoiceLog a b n v e s p l u := by + unfold spatialChoiceLog spatialMeshLog spatialDiscretizationLog spatialDisplacementLog + spatialPointLog spatialDensityCapLog spatialProfileLog + positivity + +theorem smoothJointResolution_width_le_exp {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (n : ℕ) (s : I ↪ J) (smax : ℕ) + {M L : ℕ} {p l u τ : ℝ} (hp : 0 ≤ p) (hl : 0 ≤ l) (hu : 0 ≤ u) + (hM : (M : ℝ) ≤ Real.exp p) (hL : (L : ℝ) ≤ Real.exp l) + (hτ : 0 < τ) (hτu : τ⁻¹ ≤ Real.exp u) : + let P := spatialChoiceLog (Fintype.card I) (Fintype.card J) (Fintype.card N) + n (Fintype.card (UnselectedColumn s)) smax p l u + smoothJointResolution N n s M L smax τ ≤ Real.exp (2*P+4) ∧ + (smoothJointWidth N n s M smax τ)⁻¹ ≤ Real.exp (2*P+4) := by + let T := spatialMeshLog (Fintype.card I) (Fintype.card J) (Fintype.card N) l + let A := spatialDiscretizationLog (Fintype.card (Unit ⊕ I)) + (Fintype.card (UnselectedColumn s ⊕ N)) p l + let B := spatialDisplacementLog (Fintype.card (Unit ⊕ I)) + (Fintype.card (UnselectedColumn s ⊕ N)) (Fintype.card (UnselectedColumn s)) (Fintype.card N) p + let D := spatialPointLog n (Fintype.card (Unit ⊕ I)) + (Fintype.card (UnselectedColumn s)) smax p u + have hT : 0 ≤ T := by dsimp [T, spatialMeshLog]; positivity + have hA : 0 ≤ A := by dsimp [A, spatialDiscretizationLog, spatialProfileLog]; positivity + have hB : 0 ≤ B := by dsimp [B, spatialDisplacementLog, spatialProfileLog]; positivity + have hD : 0 ≤ D := by dsimp [D, spatialPointLog, spatialDensityCapLog]; positivity + have hP : 0 ≤ T+A+B+D := by positivity + have ht : smoothSpatialMeshThreshold I J N L ≤ Real.exp (T+A+B+D) := by + apply (smoothSpatialMeshThreshold_le_exp I J N hL).trans + exact Real.exp_le_exp.mpr (by change T ≤ T+A+B+D; linarith) + have ha : smoothSpatialDiscretizationCost N s M L ≤ Real.exp (T+A+B+D) := by + apply (smoothSpatialDiscretizationCost_le_exp N s hp hM hL).trans + exact Real.exp_le_exp.mpr (by change A ≤ T+A+B+D; linarith) + have hb : smoothSpatialDisplacementCost N s M ≤ Real.exp (T+A+B+D) := by + apply (smoothSpatialDisplacementCost_le_exp N s hp hM).trans + exact Real.exp_le_exp.mpr (by change B ≤ T+A+B+D; linarith) + have hd : (smoothSpatialPointAccuracy n s M smax τ)⁻¹ ≤ Real.exp (T+A+B+D) := by + apply (smoothSpatialPointAccuracy_inverse_le_exp n s smax hp hu hM hτ hτu).trans + exact Real.exp_le_exp.mpr (by change D ≤ T+A+B+D; linarith) + have hh := twoTermErrorChoices_log_bounds (smoothSpatialDiscretizationCost_nonneg N s M L) + (smoothSpatialDisplacementCost_nonneg N s M) (smoothSpatialPointAccuracy_pos n s M smax hτ) + hP ht ha hb hd + simpa only [smoothJointResolution, smoothJointWidth, spatialChoiceLog, T, A, B, D, + Fintype.card_sum, Fintype.card_unit, Nat.add_comm 1] using hh + +theorem smoothJointRadius_inverse_le_exp {I J : Type*} [Fintype I] [Fintype J] + (n : ℕ) (s : I ↪ J) (smax : ℕ) {M : ℕ} {p u τ : ℝ} + (hp : 0 ≤ p) (hu : 0 ≤ u) (hM : (M : ℝ) ≤ Real.exp p) + (hτ : 0 < τ) (hτu : τ⁻¹ ≤ Real.exp u) : + let j := Fintype.card (Unit ⊕ I) + let e := Fintype.card (UnselectedColumn s) + let P := (j : ℝ)*smax*p+spatialDensityLipLog j e p+spatialPointLog n j e smax p u + (smoothJointRadius n s M smax τ)⁻¹ ≤ Real.exp (3*P+16) := by + dsimp only + let j := Fintype.card (Unit ⊕ I) + let e := Fintype.card (UnselectedColumn s) + let g : ℝ := j*smax*p + let k := spatialDensityLipLog j e p + let d := spatialPointLog n j e smax p u + have hg : 0 ≤ g := by dsimp [g]; positivity + have hk : 0 ≤ k := by dsimp [k, spatialDensityLipLog]; positivity + have hd : 0 ≤ d := by dsimp [d, spatialPointLog, spatialDensityCapLog]; positivity + have hG : (((M^smax : ℕ) : ℝ)^j) ≤ Real.exp (g+k+d) := by + apply (spatialModulusPower_le_exp j smax hM).trans + exact Real.exp_le_exp.mpr (by change g ≤ g+k+d; linarith) + have hK : smoothSpatialDensityLip s M ≤ Real.exp (g+k+d) := by + apply (smoothSpatialDensity_log_bounds s hM).2.trans + exact Real.exp_le_exp.mpr (by change k ≤ g+k+d; linarith) + have hD : 1/smoothSpatialPointAccuracy n s M smax τ ≤ Real.exp (g+k+d) := by + rw [one_div] + apply (smoothSpatialPointAccuracy_inverse_le_exp n s smax hp hu hM hτ hτu).trans + exact Real.exp_le_exp.mpr (by change d ≤ g+k+d; linarith) + simpa only [one_div, smoothJointRadius, g, k, d, j, e] using spatialSiteRadius_inverse_le_exp + (by positivity : (0 : ℝ) ≤ ((M^smax : ℕ) : ℝ)^j) (smoothSpatialDensityLip_nonneg s M) + (smoothSpatialPointAccuracy_pos n s M smax hτ) (by positivity : 0 ≤ g+k+d) hG hK hD + +theorem smoothSpatialOutputScale_le_exp {I J N : Type*} + [Fintype I] [Fintype J] [Fintype N] (n : ℕ) (s : I ↪ J) (smax : ℕ) + {M L : ℕ} {p l u w τ : ℝ} (hp : 0 ≤ p) (hl : 0 ≤ l) (hu : 0 ≤ u) (hw : 0 ≤ w) + (hM : (M : ℝ) ≤ Real.exp p) (hL : (L : ℝ) ≤ Real.exp l) + (hτ : 0 < τ) (hτu : τ⁻¹ ≤ Real.exp u) + (W : N → ℝ) (hW0 : ∀ i, 0 ≤ W i) (hW : ∀ i, W i ≤ Real.exp w) : + let P := spatialChoiceLog (Fintype.card I) (Fintype.card J) (Fintype.card N) + n (Fintype.card (UnselectedColumn s)) smax p l u + spatialOutputScale L (smoothJointResolution N n s M L smax τ) + (smoothJointWidth N n s M smax τ) W ≤ + Real.exp (Fintype.card N+3*(l+2*P+4+w)+3) := by + let P := spatialChoiceLog (Fintype.card I) (Fintype.card J) (Fintype.card N) + n (Fintype.card (UnselectedColumn s)) smax p l u + have hP : 0 ≤ P := spatialChoiceLog_nonneg _ _ _ _ _ _ hp hl hu + obtain ⟨hρ, hξ⟩ := smoothJointResolution_width_le_exp N n s smax hp hl hu hM hL hτ hτu + obtain ⟨hρ0, _, hξ0, _, _⟩ := smoothSpatial_error_choices N s M L + (smoothSpatialPointAccuracy_pos n s M smax hτ) + apply spatialOutputScale_log_bound L hρ0.le hξ0 (by positivity : 0 ≤ l+2*P+4+w) W hW0 + · intro i + exact (hW i).trans (Real.exp_le_exp.mpr (by linarith)) + · exact hL.trans (Real.exp_le_exp.mpr (by linarith)) + · exact hρ.trans (Real.exp_le_exp.mpr (by change 2*P+4 ≤ l+2*P+4+w; linarith)) + · exact hξ.trans (Real.exp_le_exp.mpr (by change 2*P+4 ≤ l+2*P+4+w; linarith)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def smoothVectorSpatialError {α G : Type*} [Fintype α] [Fintype G] + (D N : Type*) [Fintype D] [Fintype N] (selection : α ↪ G) + (M L modulus : ℕ) (ρ ξ r : ℝ) : ℝ := + Fintype.card D * (smoothSpatialError N selection M L ρ ξ+ + 4*(modulus : ℝ)^Fintype.card (Unit ⊕ α)*smoothSpatialDensityLip selection M*r) * + (1+(modulus : ℝ)^Fintype.card (Unit ⊕ α)*smoothSpatialDensityCap selection M+ + smoothSpatialError N selection M L ρ ξ)^Fintype.card D + +theorem smoothVectorSpatialError_nonneg {α G : Type*} [Fintype α] [Fintype G] + (D N : Type*) [Fintype D] [Fintype N] (selection : α ↪ G) + (M L modulus : ℕ) {ρ ξ r : ℝ} (hρ : 0 ≤ ρ) (hξ : 0 ≤ ξ) (hr : 0 ≤ r) : + 0 ≤ smoothVectorSpatialError D N selection M L modulus ρ ξ r := by + have hE := smoothSpatialError_nonneg N selection M L hρ hξ + have hC := smoothSpatialDensityCap_nonneg selection M + have hK := smoothSpatialDensityLip_nonneg selection M + unfold smoothVectorSpatialError + positivity + +namespace VectorPolynomial + +open scoped BigOperators Matrix + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) +variable {α : Type*} [Fintype α] [DecidableEq α] +variable (u : PrincipalAxisTuples (α := α) (allocatedGridAxis (I := I) U basis S.value) + (allocatedPrincipalSides B U basis S)) +variable {D N : Type*} [Fintype D] [Fintype N] +variable (c : D → N → ℤ) (index : D → N → PrincipalTupleIndex B (layerSamplerDegree I n)) + +local notation "grid" => allocatedGridAxis (I := I) U basis (LayerSamplerScale.value S) +local notation "sides" => allocatedPrincipalSides B U basis S + +noncomputable def allocatedSpatialColumns + (v : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) : D → Matrix (Unit ⊕ α) N ℤ := + fun d => principalSpatialColumns (c d) (index d) (principalAxisJoin grid u v) + +noncomputable def allocatedSpatialResidueColumns (modulus : ℕ) + (r : PrincipalTupleIndex (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option α → ZMod modulus) : + D → Matrix (Unit ⊕ α) N (ZMod modulus) := + fun d => principalSpatialResidueColumns modulus (c d) (index d) + (principalAxisResidueJoin grid u modulus r) + +omit [Fintype α] [DecidableEq α] [Fintype D] [Fintype N] in +theorem allocatedSpatialColumns_residue (modulus : ℕ) + (v : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) (d : D) : + integerResidueMatrix (allocatedSpatialColumns B U basis S u c index v d) modulus = + allocatedSpatialResidueColumns B U basis S u c index modulus (principalResidueLabel modulus v) d := + principalSpatialColumns_join_residue grid u v modulus (c d) (index d) + +omit [Fintype α] [DecidableEq α] [Fintype D] [Fintype N] in +theorem allocatedSpatialColumns_scaled_bound (H : D → ℝ) (Q : D → N → ℝ) + (hQ : ∀ d j, 0 ≤ Q d j) {ξ : ℝ} + (hwidth : ∀ d j, ((|c d j| : ℤ)+(sides (index d j) : ℤ) : ℝ)*Q d j ≤ ξ*H d) + (v : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) (d : D) (i : Unit ⊕ α) (j : N) : + |(allocatedSpatialColumns B U basis S u c index v d i j : ℝ)| * Q d j ≤ ξ*H d := + principalSpatialColumns_scaled_bound (c d) (index d) (Q d) (hQ d) (hwidth d) + (principalAxisJoin grid u v) i j + +variable (x : G → IntegerScalarCubeBox α S.value) (root : G → ℤ) +variable (selection : α ↪ G) +variable (hP : (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection).det ≠ 0) +variable (H : D → ℝ) (Q : D → N → ℝ) (hH : ∀ d, 0 < H d) (hQ : ∀ d j, 0 < Q d j) + +noncomputable def allocatedSpatialOutputLaw + (v : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) : PMF (D → (Unit ⊕ α) → ℤ) := + smoothVectorSpatialOutputLaw root (scalarCubeDifferenceMatrix x) + (allocatedSpatialColumns B U basis S u c index v) H S.value Q hH + (Nat.cast_pos.mpr S.positive) hQ + +variable [DecidableEq G] + +noncomputable def allocatedSpatialProxy (modulus : ℕ) [NeZero modulus] + (r : PrincipalTupleIndex (fun a : {a // ¬grid a} => B a.val) + (fun a => layerSamplerDegree I n a.val) → Option α → ZMod modulus) + (mesh : ℝ) (v : D → (Unit ⊕ α) → ℤ) : ℂ := + ∏ d, spatialSiteApprox + (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (Matrix.fromCols (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection) + (liftResidueMatrix (allocatedSpatialResidueColumns B U basis S u c index modulus r d))) + modulus (smoothSpatialKernelDensity selection root (scalarCubeDifferenceMatrix x) hP + (H d) S.value (hH d) (Nat.cast_pos.mpr S.positive)) (H d) 1 mesh (v d) + +variable [DecidableEq N] + +theorem allocatedSpatial_site_error {M : ℕ} (hM : 0 < M) + (hx : GoodScalarKernelTuple selection (1/(M : ℝ)) M x) + (hroot : ∀ j, |root j| ≤ (S.value : ℤ)) (modulus : ℕ) [NeZero modulus] + (hp : integerScalarLattice (Unit ⊕ α) (modulus : ℤ) ≤ + pivotFullImage (selectedSpatialPivot root (scalarCubeDifferenceMatrix x) selection) + (selectedSpatialFreeColumns root (scalarCubeDifferenceMatrix x) selection)) + {ρ ξ mesh : ℝ} (hξ0 : 0 ≤ ξ) (hξ1 : ξ ≤ 1) + (hwidth : ∀ d j, ((|c d j| : ℤ)+(sides (index d j) : ℤ) : ℝ)*Q d j ≤ ξ*H d) + (hρ : 0 < ρ) (hscale : ∀ d, ρ ≤ H d/S.value) (hscaleQ : ∀ d j, ρ ≤ Q d j) + (hlarge : smoothSpatialMeshThreshold α G N S.value ≤ ρ) (hmesh : 0 < mesh) + (y : PrincipalAxisTuples (α := α) (fun a => ¬grid a) sides) + (v : D → (Unit ⊕ α) → ℤ) + (hv : ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ)/H d| ≤ 1) : + ‖(((∏ d, ∏ _i : Unit ⊕ α, H d)* + (allocatedSpatialOutputLaw B U basis S u c index x root H Q hH hQ y v).toReal : ℝ) : ℂ)- + allocatedSpatialProxy B U basis S u c index x root selection hP H hH modulus + (principalResidueLabel modulus y) mesh v‖ ≤ + smoothVectorSpatialError D N selection M S.value modulus ρ ξ mesh := by + have he := smoothVectorSpatial_site_error selection x root hM S.positive hx hroot modulus hp + (allocatedSpatialColumns B U basis S u c index y) H Q hH hQ hξ0 hξ1 + (allocatedSpatialColumns_scaled_bound B U basis S u c index H Q (fun d j => (hQ d j).le) hwidth y) + hρ hscale hscaleQ hlarge hmesh v hv + simpa only [allocatedSpatialOutputLaw, allocatedSpatialProxy, allocatedSpatialColumns_residue, + smoothVectorSpatialError] using he + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem smoothJointParameters_spec {α G : Type*} [Fintype α] [Fintype G] + (D N : Type*) [Fintype D] [Fintype N] (selection : α ↪ G) + (M L smax : ℕ) {τ : ℝ} (hτ : 0 < τ) : + 0 < smoothJointResolution N (Fintype.card D) selection M L smax τ ∧ + smoothSpatialMeshThreshold α G N L ≤ smoothJointResolution N (Fintype.card D) selection M L smax τ ∧ + 0 < smoothJointWidth N (Fintype.card D) selection M smax τ ∧ + smoothJointWidth N (Fintype.card D) selection M smax τ ≤ 1 ∧ + 0 < smoothJointRadius (Fintype.card D) selection M smax τ := by + have hδ := smoothSpatialPointAccuracy_pos (Fintype.card D) selection M smax hτ + obtain ⟨hρ, ht, hξ, hξ1, _⟩ := smoothSpatial_error_choices N selection M L hδ + exact ⟨hρ, ht, hξ, hξ1, spatialSiteRadius_pos (by positivity) + (smoothSpatialDensityLip_nonneg selection M) hδ⟩ + +noncomputable def spatialChosenHeightLog {α G : Type*} [Fintype α] [Fintype G] + (D N : Type*) [Fintype D] [Fintype N] (selection : α ↪ G) + (smax : ℕ) (P L E : ℝ) : ℝ := + Fintype.card N+3*(L+2*spatialChoiceLog (Fintype.card α) (Fintype.card G) + (Fintype.card N) (Fintype.card D) (Fintype.card (UnselectedColumn selection)) + smax P L E+4+(P+L+1))+3 + +namespace VectorPolynomial + +variable {m : ℕ} {G : Type*} [Fintype G] {I : Fin m → Type*} [∀ j, Fintype (I j)] +variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)] +variable {J : Fin m → Type*} [∀ j, Fintype (J j)] (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 σ) + +theorem allocatedPrincipalSides_le_scale (j : PrincipalTupleIndex B (layerSamplerDegree I n)) : + allocatedPrincipalSides B U basis S j ≤ S.value := + layerSamplerSides_le (G := G) B U basis R S.positive (.inr j) + +variable {D N : Type*} [Fintype D] [Fintype N] +variable (c : D → N → ℤ) (index : D → N → PrincipalTupleIndex B (layerSamplerDegree I n)) + +noncomputable def allocatedSpatialColumnWidth (d : D) (j : N) : ℝ := + ((|c d j| : ℤ)+(allocatedPrincipalSides B U basis S (index d j) : ℤ) : ℝ) + +omit [Fintype D] [Fintype N] in +theorem allocatedSpatialColumnWidth_nonneg (d : D) (j : N) : + 0 ≤ allocatedSpatialColumnWidth B U basis S c index d j := by + unfold allocatedSpatialColumnWidth + positivity + +omit [Fintype D] [Fintype N] in +theorem allocatedSpatialColumnWidth_le_exp {P L : ℝ} (hP : 0 ≤ P) (hL : 0 ≤ L) + (hS : (S.value : ℝ) ≤ Real.exp L) (hc : ∀ d j, |(c d j : ℝ)| ≤ Real.exp P) + (d : D) (j : N) : + allocatedSpatialColumnWidth B U basis S c index d j ≤ Real.exp (P+L+1) := by + have hs : (allocatedPrincipalSides B U basis S (index d j) : ℝ) ≤ Real.exp L := + (Nat.cast_le.mpr (allocatedPrincipalSides_le_scale B U basis S (index d j))).trans hS + have hp' : Real.exp P ≤ Real.exp (P+L) := Real.exp_le_exp.mpr (by linarith) + have hl' : Real.exp L ≤ Real.exp (P+L) := Real.exp_le_exp.mpr (by linarith) + have h2 : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] + unfold allocatedSpatialColumnWidth + push_cast + calc + _ ≤ Real.exp P+Real.exp L := add_le_add (hc d j) hs + _ ≤ 2*Real.exp (P+L) := by linarith + _ ≤ Real.exp 1*Real.exp (P+L) := mul_le_mul_of_nonneg_right h2 (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +variable {α : Type*} [Fintype α] (selection : α ↪ G) (M : ℕ) (τ : ℝ) + +noncomputable def allocatedSpatialHeight (d : D) : ℝ := + spatialOutputScale S.value + (smoothJointResolution N (Fintype.card D) selection M S.value (m+1) τ) + (smoothJointWidth N (Fintype.card D) selection M (m+1) τ) + (allocatedSpatialColumnWidth B U basis S c index d) + +local notation "H" => allocatedSpatialHeight B U basis S c index selection M τ +local notation "ρ" => smoothJointResolution N (Fintype.card D) selection M (LayerSamplerScale.value S) (m+1) τ +local notation "ξ" => smoothJointWidth N (Fintype.card D) selection M (m+1) τ + +theorem allocatedSpatialHeight_spec (hτ : 0 < τ) : + (∀ d, 0 < H d) ∧ (∀ d, 1 ≤ H d) ∧ (∀ d, ρ ≤ H d/S.value) ∧ + ∀ d j, allocatedSpatialColumnWidth B U basis S c index d j*ρ ≤ ξ*H d := by + obtain ⟨h0, h1, hr, _, _, hw⟩ := smoothSpatial_output_choices selection M (m+1) S.positive hτ + (allocatedPrincipalSides B U basis S) c index + exact ⟨h0, h1, hr, hw⟩ + +theorem allocatedSpatialHeight_pos (hτ : 0 < τ) (d : D) : 0 < H d := + (allocatedSpatialHeight_spec B U basis S c index selection M τ hτ).1 d + +theorem allocatedSpatialHeight_one_le (hτ : 0 < τ) (d : D) : 1 ≤ H d := + (allocatedSpatialHeight_spec B U basis S c index selection M τ hτ).2.1 d + +theorem allocatedSpatialHeight_le_exp {P L E : ℝ} (hP : 0 ≤ P) (hL : 0 ≤ L) (hE : 0 ≤ E) + (hM : (M : ℝ) ≤ Real.exp P) (hS : (S.value : ℝ) ≤ Real.exp L) + (hτ : 0 < τ) (hτE : τ⁻¹ ≤ Real.exp E) (hc : ∀ d j, |(c d j : ℝ)| ≤ Real.exp P) + (d : D) : H d ≤ Real.exp (spatialChosenHeightLog D N selection (m+1) P L E) := by + exact smoothSpatialOutputScale_le_exp (Fintype.card D) selection (m+1) hP hL hE (by positivity) + hM hS hτ hτE (allocatedSpatialColumnWidth B U basis S c index d) + (allocatedSpatialColumnWidth_nonneg B U basis S c index d) + (allocatedSpatialColumnWidth_le_exp B U basis S c index hP hL hS hc d) + +end VectorPolynomial +end Erdos3 + +end + +section + +namespace Erdos3 + +def spatialProfileEnvelope {A : Type*} [Semiring A] (Z : A) : A := + (Z+1+1)*Z+(Z+1)^2+2*(Z+1)+(Z+Z)+Z+1 + +def spatialCapEnvelope {A : Type*} [Semiring A] (Z : A) : A := + (Z+1)^2+(Z+1)*((Z+1)+(Z+1)^2+Z)+2*Z + +def spatialLipEnvelope {A : Type*} [Semiring A] (Z : A) : A := + (Z+1)^2+(Z+1+1)*((Z+1)+(Z+1)^2+Z)+3*Z+(Z+1)+Z + +def spatialPointEnvelope {A : Type*} [Semiring A] (Z : A) : A := + (Z+1)*((Z+1)*Z*Z+spatialCapEnvelope Z+7+5*(Z*(Z+1))+Z)+Z+1 + +def spatialChoiceEnvelope {A : Type*} [Semiring A] (Z : A) : A := + (2+5*(1+Z+Z)+Z+Z^2+Z*Z)+ + (2*(Z+1)^2+(2*(Z+1)+4)*spatialProfileEnvelope Z+ + ((Z+1)+2*(Z+Z))*(spatialProfileEnvelope Z+4)+4+(Z+1)*Z)+ + ((Z+1)^2+(Z+1+3)*spatialProfileEnvelope Z+2*Z+Z)+spatialPointEnvelope Z + +def spatialHeightEnvelope {A : Type*} [Semiring A] (Z : A) : A := + Z+3*(Z+2*spatialChoiceEnvelope Z+4+(Z+Z+1))+3 + +def spatialRadiusEnvelope {A : Type*} [Semiring A] (Z : A) : A := + 3*((Z+1)*Z*Z+spatialLipEnvelope Z+spatialPointEnvelope Z)+16 + +def spatialParameterEnvelope {A : Type*} [Semiring A] (Z : A) : A := + spatialHeightEnvelope Z+(2*spatialChoiceEnvelope Z+4)+spatialRadiusEnvelope Z + +theorem spatialEnvelopes_nonneg {Z : ℝ} (hZ : 0 ≤ Z) : + 0 ≤ spatialProfileEnvelope Z ∧ 0 ≤ spatialCapEnvelope Z ∧ + 0 ≤ spatialLipEnvelope Z ∧ 0 ≤ spatialPointEnvelope Z ∧ + 0 ≤ spatialChoiceEnvelope Z ∧ 0 ≤ spatialHeightEnvelope Z ∧ + 0 ≤ spatialRadiusEnvelope Z := by + simp only [spatialProfileEnvelope, spatialCapEnvelope, spatialLipEnvelope, + spatialPointEnvelope, spatialChoiceEnvelope, spatialHeightEnvelope, spatialRadiusEnvelope] + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> positivity + +theorem spatialProfileLog_le_envelope {a e n : ℕ} {p Z : ℝ} + (hp : 0 ≤ p) (hZ : 0 ≤ Z) (ha : (a : ℝ) ≤ Z) (he : (e : ℝ) ≤ Z) + (hn : (n : ℝ) ≤ Z) (hpZ : p ≤ Z) (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Z) : + spatialProfileLog (a+1) (e+n) p ≤ spatialProfileEnvelope Z := by + unfold spatialProfileLog spatialProfileEnvelope + push_cast + gcongr + +theorem spatialCapLog_le_envelope {a e : ℕ} {p Z : ℝ} + (hp : 0 ≤ p) (hZ : 0 ≤ Z) (ha : (a : ℝ) ≤ Z) (he : (e : ℝ) ≤ Z) (hpZ : p ≤ Z) : + spatialDensityCapLog (a+1) e p ≤ spatialCapEnvelope Z := by + unfold spatialDensityCapLog spatialCapEnvelope + push_cast + gcongr + +theorem spatialLipLog_le_envelope {a e : ℕ} {p Z : ℝ} + (hp : 0 ≤ p) (hZ : 0 ≤ Z) (ha : (a : ℝ) ≤ Z) (he : (e : ℝ) ≤ Z) + (hpZ : p ≤ Z) (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Z) : + spatialDensityLipLog (a+1) e p ≤ spatialLipEnvelope Z := by + unfold spatialDensityLipLog spatialLipEnvelope + push_cast + gcongr + +theorem spatialPointLog_le_envelope {v a e s : ℕ} {p u Z : ℝ} + (hp : 0 ≤ p) (hu : 0 ≤ u) (hZ : 0 ≤ Z) + (hv : (v : ℝ) ≤ Z) (ha : (a : ℝ) ≤ Z) (he : (e : ℝ) ≤ Z) (hs : (s : ℝ) ≤ Z) + (hpZ : p ≤ Z) (huZ : u ≤ Z) : + spatialPointLog v (a+1) e s p u ≤ spatialPointEnvelope Z := by + have hcap := spatialCapLog_le_envelope hp hZ ha he hpZ + have hc0 : 0 ≤ spatialDensityCapLog (a+1) e p := by unfold spatialDensityCapLog; positivity + have he0 := (spatialEnvelopes_nonneg hZ).2.1 + unfold spatialPointLog spatialPointEnvelope + push_cast + gcongr + +theorem spatialChoiceLog_le_envelope {a b n v e s : ℕ} {p l u Z : ℝ} + (hp : 0 ≤ p) (hl : 0 ≤ l) (hu : 0 ≤ u) (hZ : 0 ≤ Z) + (ha : (a : ℝ) ≤ Z) (hb : (b : ℝ) ≤ Z) (hn : (n : ℝ) ≤ Z) + (hv : (v : ℝ) ≤ Z) (he : (e : ℝ) ≤ Z) (hs : (s : ℝ) ≤ Z) + (hpZ : p ≤ Z) (hlZ : l ≤ Z) (huZ : u ≤ Z) + (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Z) : + spatialChoiceLog a b n v e s p l u ≤ spatialChoiceEnvelope Z := by + have hf := spatialProfileLog_le_envelope hp hZ ha he hn hpZ hprofile + have hf0 := spatialProfileLog_nonneg (a+1) (e+n) hp + have he0 := (spatialEnvelopes_nonneg hZ).1 + have ht := spatialPointLog_le_envelope hp hu hZ hv ha he hs hpZ huZ + unfold spatialChoiceLog spatialChoiceEnvelope spatialMeshLog + spatialDiscretizationLog spatialDisplacementLog + push_cast + gcongr + +theorem spatialChosenHeightLog_le_envelope {α G D N : Type*} + [Fintype α] [Fintype G] [Fintype D] [Fintype N] (selection : α ↪ G) + {s : ℕ} {p l u Z : ℝ} (hp : 0 ≤ p) (hl : 0 ≤ l) (hu : 0 ≤ u) (hZ : 0 ≤ Z) + (ha : (Fintype.card α : ℝ) ≤ Z) (hg : (Fintype.card G : ℝ) ≤ Z) + (hn : (Fintype.card N : ℝ) ≤ Z) (hd : (Fintype.card D : ℝ) ≤ Z) + (he : (Fintype.card (UnselectedColumn selection) : ℝ) ≤ Z) (hs : (s : ℝ) ≤ Z) + (hpZ : p ≤ Z) (hlZ : l ≤ Z) (huZ : u ≤ Z) + (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Z) : + spatialChosenHeightLog D N selection s p l u ≤ spatialHeightEnvelope Z := by + have hc := spatialChoiceLog_le_envelope hp hl hu hZ ha hg hn hd he hs hpZ hlZ huZ hprofile + have hc0 := spatialChoiceLog_nonneg (Fintype.card α) (Fintype.card G) (Fintype.card N) + (Fintype.card D) (Fintype.card (UnselectedColumn selection)) s hp hl hu + have he0 := (spatialEnvelopes_nonneg hZ).2.2.2.2.1 + unfold spatialChosenHeightLog spatialHeightEnvelope + gcongr + +theorem spatialRadiusLog_le_envelope {v a e s : ℕ} {p u Z : ℝ} + (hp : 0 ≤ p) (hu : 0 ≤ u) (hZ : 0 ≤ Z) + (hv : (v : ℝ) ≤ Z) (ha : (a : ℝ) ≤ Z) (he : (e : ℝ) ≤ Z) (hs : (s : ℝ) ≤ Z) + (hpZ : p ≤ Z) (huZ : u ≤ Z) (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Z) : + 3*((a+1 : ℕ)*s*p+spatialDensityLipLog (a+1) e p+spatialPointLog v (a+1) e s p u)+16 ≤ + spatialRadiusEnvelope Z := by + have hL := spatialLipLog_le_envelope hp hZ ha he hpZ hprofile + have hT := spatialPointLog_le_envelope hp hu hZ hv ha he hs hpZ huZ + unfold spatialRadiusEnvelope + push_cast + gcongr + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialNumericEnvelopeFunctoriality.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialNumericEnvelopeFunctoriality.lean new file mode 100644 index 0000000000000000000000000000000000000000..19760d72dcf1ad5df467a8746d1f83a9d2bd9ed7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialNumericEnvelopeFunctoriality.lean @@ -0,0 +1,733 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedCenteredJointSource +import OAI.Combinatorics.Progressions.Estimates.BoundedAnisotropicTupleChoices + +namespace OAI + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped NNReal + +noncomputable def anisotropicSpatialMeshLog (j d : ℕ) (p l : ℝ) : ℝ := + (j : ℝ) ^ 2 + j * l + 4 * (j + d) + spatialProfileLog j d p + 3 + +theorem anisotropicSpatialMeshThreshold_le_exp {I J : Type*} [Fintype I] [Fintype J] + (N : Type*) [Fintype N] (s : I ↪ J) {C p l : ℝ} + (hp : 0 ≤ p) (hC : 0 ≤ C) (hCl : C ≤ Real.exp l) : + anisotropicSpatialMeshThreshold s N C ≤ + Real.exp (anisotropicSpatialMeshLog (Fintype.card (Unit ⊕ I)) + (Fintype.card (UnselectedColumn s ⊕ N)) p l) := by + let j := Fintype.card (Unit ⊕ I) + let d := Fintype.card (UnselectedColumn s ⊕ N) + let P := spatialProfileLog j d p + let Q := ((j + d : ℕ) : ℝ) * 4 + P + have hP : 0 ≤ P := spatialProfileLog_nonneg j d hp + have hQ : 0 ≤ Q := by dsimp [Q]; positivity + have hK : ((d + j : ℝ) * probabilityProfileLipschitz) ≤ Real.exp P := + (spatialProfileLog_bounds N s (M := 0) hp (by simpa using Real.exp_nonneg p)).2.2.2 + have hfour : (4 : ℝ) ^ (j + d) ≤ Real.exp (((j + d : ℕ) : ℝ) * 4) := + pow_le_exp_mul_of_le_exp (by norm_num) (by linarith [Real.add_one_le_exp (4 : ℝ)]) + (by norm_num) (j + d) le_rfl + have hprod : 4 ^ (j + d) * ((d + j : ℝ) * probabilityProfileLipschitz) ≤ Real.exp Q := by + calc + _ ≤ Real.exp (((j + d : ℕ) : ℝ) * 4) * Real.exp P := by gcongr + _ = _ := (Real.exp_add _ _).symm + have hsum := one_add_le_exp_succ hQ hprod + have hdet : (j.factorial : ℝ) * C ^ j ≤ Real.exp ((j : ℝ) ^ 2 + j * l) := by + calc + _ ≤ Real.exp ((j : ℝ) ^ 2) * (Real.exp l) ^ j := by + gcongr + exact factorial_le_exp_sq j + _ = _ := by rw [← Real.exp_nat_mul, ← Real.exp_add] + change 2 * (1 + 4 ^ (j + d) * ((d + j : ℝ) * probabilityProfileLipschitz)) * + (j.factorial * C ^ j) ≤ _ + calc + _ ≤ Real.exp 2 * Real.exp (Q + 1) * Real.exp ((j : ℝ) ^ 2 + j * l) := by + gcongr + linarith [Real.add_one_le_exp (2 : ℝ)] + _ = _ := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + dsimp [anisotropicSpatialMeshLog, Q, P] + push_cast + ring + +theorem anisotropicSpatialDensityLip_le_exp {I J : Type*} [Fintype I] [Fintype J] + (s : I ↪ J) {M : ℕ} {p : ℝ} (hp : 0 ≤ p) (hM : 0 < M) + (hMp : (M : ℝ) ≤ Real.exp p) + (hI : (Fintype.card (Unit ⊕ I) : ℝ) ≤ p) (hJ : (Fintype.card J : ℝ) ≤ p) : + anisotropicSpatialDensityLip s (1 / (M : ℝ)) ≤ + Real.exp (anisotropicSpatialCapLog p + + 2 * spatialProfileLog (Fintype.card (Unit ⊕ I)) (Fintype.card (UnselectedColumn s)) p) := by + let P := spatialProfileLog (Fintype.card (Unit ⊕ I)) (Fintype.card (UnselectedColumn s)) p + have hdata := spatialProfileLog_bounds Empty s hp hMp + have hinv : physicalSpatialInverseBound I (1 / (M : ℝ)) ≤ Real.exp P := by + rw [physicalSpatialInverseBound_eq_scalar] + simpa only [P, Fintype.card_sum, Fintype.card_empty, add_zero] using hdata.2.1 + have hK : ((Fintype.card (UnselectedColumn s) + Fintype.card (Unit ⊕ I) : ℝ) * + probabilityProfileLipschitz) ≤ Real.exp P := by + simpa only [P, Fintype.card_sum, Fintype.card_empty, add_zero] using hdata.2.2.2 + have hcap := anisotropicSpatialDensityCap_exp_bound s hp hM hMp hI hJ + have hcap0 := anisotropicSpatialDensityCap_nonneg s + (show 0 ≤ 1 / (M : ℝ) by positivity) + have hinv0 : 0 ≤ physicalSpatialInverseBound I (1 / (M : ℝ)) := by + unfold physicalSpatialInverseBound + positivity + unfold anisotropicSpatialDensityLip + calc + _ ≤ Real.exp (anisotropicSpatialCapLog p) * Real.exp P * Real.exp P := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped NNReal + +theorem probabilityProfileLipschitz_le_comparisonProfileBound : + (probabilityProfileLipschitz : ℝ) ≤ VectorPolynomial.comparisonProfileBound := + (Nat.le_ceil _).trans (by unfold VectorPolynomial.comparisonProfileBound; push_cast; linarith) + +noncomputable def spatialFixedProfileEnvelope {A : Type*} [Semiring A] (p : A) : A := + (p + 1) * p + p ^ 2 + 4 * p + (VectorPolynomial.comparisonProfileBound : ℕ) + 1 + +noncomputable def spatialDisplacementEnvelope {A : Type*} [Semiring A] (p : A) : A := + p ^ 2 + (p + 3) * spatialFixedProfileEnvelope p + 2 * p + p + +noncomputable def spatialDiscretizationEnvelope {A : Type*} [Semiring A] (p l : A) : A := + 2 * p ^ 2 + (2 * p + 4) * spatialFixedProfileEnvelope p + + (p + 2 * (2 * p)) * (spatialFixedProfileEnvelope p + 4) + 4 + p * l + +noncomputable def spatialMeshEnvelope {A : Type*} [Semiring A] (p l : A) : A := + p ^ 2 + p * l + 4 * (p + 2 * p) + spatialFixedProfileEnvelope p + 3 + +noncomputable def spatialLipschitzEnvelope {A : Type*} [Semiring A] (p : A) : A := + anisotropicSpatialCapLog p + 2 * spatialFixedProfileEnvelope p + +theorem spatialCostEnvelopes_nonneg {p l : ℝ} (hp : 0 ≤ p) (hl : 0 ≤ l) : + 0 ≤ spatialFixedProfileEnvelope p ∧ 0 ≤ spatialDisplacementEnvelope p ∧ + 0 ≤ spatialDiscretizationEnvelope p l ∧ 0 ≤ spatialMeshEnvelope p l ∧ + 0 ≤ spatialLipschitzEnvelope p := by + dsimp only [spatialDisplacementEnvelope, spatialDiscretizationEnvelope, + spatialMeshEnvelope, spatialLipschitzEnvelope, spatialFixedProfileEnvelope, anisotropicSpatialCapLog] + refine ⟨?_, ?_, ?_, ?_, ?_⟩ <;> positivity + +theorem spatialProfileLog_le_fixedEnvelope (j d : ℕ) {p : ℝ} (hp : 0 ≤ p) + (hj : (j : ℝ) ≤ p) (hd : (d : ℝ) ≤ 2 * p) : + spatialProfileLog j d p ≤ spatialFixedProfileEnvelope p := by + have hprofile := probabilityProfileLipschitz_le_comparisonProfileBound + calc + _ ≤ (p + 1) * p + p ^ 2 + 2 * p + 2 * p + + (VectorPolynomial.comparisonProfileBound : ℝ) + 1 := by + unfold spatialProfileLog + gcongr + _ = _ := by unfold spatialFixedProfileEnvelope; ring + +theorem spatialDisplacementLog_le_envelope (j d e n : ℕ) {p : ℝ} (hp : 0 ≤ p) + (hj : (j : ℝ) ≤ p) (hd : (d : ℝ) ≤ 2 * p) + (he : (e : ℝ) ≤ p) (hn : (n : ℝ) ≤ p) : + spatialDisplacementLog j d e n p ≤ spatialDisplacementEnvelope p := by + have hprofile := spatialProfileLog_le_fixedEnvelope j d hp hj hd + have hprofile0 := spatialProfileLog_nonneg j d hp + unfold spatialDisplacementLog spatialDisplacementEnvelope + gcongr + +theorem spatialDiscretizationLog_le_envelope (j d : ℕ) {p l : ℝ} + (hp : 0 ≤ p) (hl : 0 ≤ l) (hj : (j : ℝ) ≤ p) (hd : (d : ℝ) ≤ 2 * p) : + spatialDiscretizationLog j d p l ≤ spatialDiscretizationEnvelope p l := by + have hprofile := spatialProfileLog_le_fixedEnvelope j d hp hj hd + have hprofile0 := spatialProfileLog_nonneg j d hp + dsimp only [spatialDiscretizationLog, spatialDiscretizationEnvelope] + gcongr + +theorem anisotropicSpatialMeshLog_le_envelope (j d : ℕ) {p l : ℝ} + (hp : 0 ≤ p) (hl : 0 ≤ l) (hj : (j : ℝ) ≤ p) (hd : (d : ℝ) ≤ 2 * p) : + anisotropicSpatialMeshLog j d p l ≤ spatialMeshEnvelope p l := by + have hprofile := spatialProfileLog_le_fixedEnvelope j d hp hj hd + unfold anisotropicSpatialMeshLog spatialMeshEnvelope + gcongr + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel +open scoped NNReal + +noncomputable def spatialLipschitzCostEnvelope {A : Type*} [Semiring A] (p l : A) : A := + p ^ 3 + spatialLipschitzEnvelope p + l + 1 + +noncomputable def spatialThresholdEnvelope {A : Type*} [Semiring A] (p l : A) : A := + spatialMeshEnvelope p l + (VectorPolynomial.comparisonProfileBound : ℕ) + 2 * p + l + 16 + +noncomputable def spatialBoundaryEnvelope {A : Type*} [Semiring A] (p l : A) : A := + l + (VectorPolynomial.comparisonProfileBound : ℕ) + 3 * p + 25 + +def spatialMovementEnvelope {A : Type*} [Semiring A] (p l : A) : A := p + l + 2 + +theorem spatialAuxiliaryDimensions {I G N : Type*} [Fintype I] [Fintype G] [Fintype N] + (s : I ↪ G) {p : ℝ} (hG : (Fintype.card G : ℝ) ≤ p) (hN : (Fintype.card N : ℝ) ≤ p) : + (Fintype.card (UnselectedColumn s) : ℝ) ≤ p ∧ + (Fintype.card (UnselectedColumn s ⊕ N) : ℝ) ≤ 2 * p ∧ + (Fintype.card (Option (G ⊕ N)) : ℝ) ≤ 1 + 2 * p := by + have he : (Fintype.card (UnselectedColumn s) : ℝ) ≤ p := + (Nat.cast_le.mpr (Fintype.card_subtype_le _)).trans hG + refine ⟨he, ?_, ?_⟩ + · simp only [Fintype.card_sum, Nat.cast_add] + linarith + · simp only [Fintype.card_option, Fintype.card_sum, Nat.cast_add, Nat.cast_one] + linarith + +theorem spatialPrimitiveCost_bounds {I G N X : Type*} + [Fintype I] [Fintype G] [Fintype N] [Fintype X] (s : I ↪ G) + {M : ℕ} {p l C₀ W Cg Centry : ℝ} (hp : 0 ≤ p) (hl : 0 ≤ l) + (hM : 0 < M) (hMp : (M : ℝ) ≤ Real.exp p) + (hI : (Fintype.card (Unit ⊕ I) : ℝ) ≤ p) (hG : (Fintype.card G : ℝ) ≤ p) + (hN : (Fintype.card N : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hC₀ : 0 ≤ C₀) (hC₀l : C₀ ≤ Real.exp l) (hW : 0 ≤ W) (hWl : W ≤ Real.exp l) + (_hCg : 0 ≤ Cg) (hCgl : Cg ≤ Real.exp l) + (hCentry : 0 ≤ Centry) (hCentryl : Centry ≤ Real.exp l) : + anisotropicSpatialDiscretizationCost N s M C₀ ≤ Real.exp (spatialDiscretizationEnvelope p l) ∧ + Real.exp (p ^ 3) * (anisotropicSpatialDensityLip s (1 / (M : ℝ)) * (1 + W)) ≤ + Real.exp (spatialLipschitzCostEnvelope p l) ∧ + anisotropicSpatialMeshThreshold s N C₀ + 8 * probabilityProfileLipschitz + + 2 * Fintype.card (Option (G ⊕ N)) * (2 * Centry) ≤ Real.exp (spatialThresholdEnvelope p l) ∧ + Cg * (24 * probabilityProfileLipschitz * Fintype.card (Option (G ⊕ N) × X)) ≤ + Real.exp (spatialBoundaryEnvelope p l) ∧ + Fintype.card N * (2 * Centry) ≤ Real.exp (spatialMovementEnvelope p l) ∧ + smoothSpatialDisplacementCost N s M ≤ Real.exp (spatialDisplacementEnvelope p) := by + obtain ⟨he, hd, hcoords⟩ := spatialAuxiliaryDimensions (N := N) s hG hN + have hprofile := spatialProfileLog_le_fixedEnvelope (Fintype.card (Unit ⊕ I)) + (Fintype.card (UnselectedColumn s)) hp hI (by linarith) + have hA := (anisotropicSpatialDiscretizationCost_le_exp N s hp hMp hC₀ hC₀l).trans + (Real.exp_le_exp.mpr (spatialDiscretizationLog_le_envelope _ _ hp hl hI hd)) + have hB := (smoothSpatialDisplacementCost_le_exp N s hp hMp).trans + (Real.exp_le_exp.mpr (spatialDisplacementLog_le_envelope _ _ _ _ hp hI hd he hN)) + have hLip : anisotropicSpatialDensityLip s (1 / (M : ℝ)) ≤ + Real.exp (spatialLipschitzEnvelope p) := + (anisotropicSpatialDensityLip_le_exp s hp hM hMp hI hG).trans + (Real.exp_le_exp.mpr (by unfold spatialLipschitzEnvelope; linarith)) + have hLip0 := anisotropicSpatialDensityLip_nonneg s + (show 0 ≤ 1 / (M : ℝ) by positivity) + have hK : Real.exp (p ^ 3) * (anisotropicSpatialDensityLip s (1 / (M : ℝ)) * (1 + W)) ≤ + Real.exp (spatialLipschitzCostEnvelope p l) := by + have hW1 := one_add_le_exp_succ hl hWl + calc + _ ≤ Real.exp (p ^ 3) * (Real.exp (spatialLipschitzEnvelope p) * Real.exp (l + 1)) := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; unfold spatialLipschitzCostEnvelope; ring + have hmesh := (anisotropicSpatialMeshThreshold_le_exp N s hp hC₀ hC₀l).trans + (Real.exp_le_exp.mpr (anisotropicSpatialMeshLog_le_envelope _ _ hp hl hI hd)) + have hP0 : (0 : ℝ) ≤ VectorPolynomial.comparisonProfileBound := Nat.cast_nonneg _ + have hLP : (probabilityProfileLipschitz : ℝ) ≤ Real.exp VectorPolynomial.comparisonProfileBound := + probabilityProfileLipschitz_le_comparisonProfileBound.trans + (by linarith [Real.add_one_le_exp (VectorPolynomial.comparisonProfileBound : ℝ)]) + have hprofileCost : 8 * (probabilityProfileLipschitz : ℝ) ≤ + Real.exp ((VectorPolynomial.comparisonProfileBound : ℝ) + 8) := by + calc + _ ≤ Real.exp 8 * Real.exp VectorPolynomial.comparisonProfileBound := + mul_le_mul (by linarith [Real.add_one_le_exp (8 : ℝ)]) hLP (NNReal.coe_nonneg _) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, add_comm] + have hcoordsExp : (Fintype.card (Option (G ⊕ N)) : ℝ) ≤ Real.exp (1 + 2 * p) := + hcoords.trans (by linarith [Real.add_one_le_exp (1 + 2 * p)]) + have hXexp : (Fintype.card X : ℝ) ≤ Real.exp p := hX.trans (by linarith [Real.add_one_le_exp p]) + have hNexp : (Fintype.card N : ℝ) ≤ Real.exp p := hN.trans (by linarith [Real.add_one_le_exp p]) + have hshift : 2 * (Fintype.card (Option (G ⊕ N)) : ℝ) * (2 * Centry) ≤ + Real.exp (2 * p + l + 5) := by + calc + _ = 4 * Fintype.card (Option (G ⊕ N)) * Centry := by ring + _ ≤ Real.exp 4 * Real.exp (1 + 2 * p) * Real.exp l := by + gcongr + linarith [Real.add_one_le_exp (4 : ℝ)] + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + have hT : anisotropicSpatialMeshThreshold s N C₀ + 8 * probabilityProfileLipschitz + + 2 * Fintype.card (Option (G ⊕ N)) * (2 * Centry) ≤ Real.exp (spatialThresholdEnvelope p l) := by + let R := spatialMeshEnvelope p l + (VectorPolynomial.comparisonProfileBound : ℝ) + 2 * p + l + 13 + have hm0 := (spatialCostEnvelopes_nonneg hp hl).2.2.2.1 + have h1 := hmesh.trans (Real.exp_le_exp.mpr (show spatialMeshEnvelope p l ≤ R by dsimp [R]; linarith)) + have h2 := hprofileCost.trans (Real.exp_le_exp.mpr + (show (VectorPolynomial.comparisonProfileBound : ℝ) + 8 ≤ R by dsimp [R]; linarith)) + have h3 := hshift.trans (Real.exp_le_exp.mpr (show 2 * p + l + 5 ≤ R by dsimp [R]; linarith)) + calc + _ ≤ 3 * Real.exp R := by linarith + _ ≤ Real.exp 3 * Real.exp R := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (3 : ℝ)]) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; unfold spatialThresholdEnvelope; dsimp [R]; ring + have hQ : Cg * (24 * probabilityProfileLipschitz * Fintype.card (Option (G ⊕ N) × X)) ≤ + Real.exp (spatialBoundaryEnvelope p l) := by + simp only [Fintype.card_prod, Nat.cast_mul] + calc + _ ≤ Real.exp l * (Real.exp 24 * Real.exp VectorPolynomial.comparisonProfileBound * + (Real.exp (1 + 2 * p) * Real.exp p)) := by + gcongr + linarith [Real.add_one_le_exp (24 : ℝ)] + _ = _ := by simp only [← Real.exp_add]; congr 1; unfold spatialBoundaryEnvelope; ring + have hD : (Fintype.card N : ℝ) * (2 * Centry) ≤ Real.exp (spatialMovementEnvelope p l) := by + calc + _ ≤ Real.exp p * (Real.exp 2 * Real.exp l) := by + gcongr + linarith [Real.add_one_le_exp (2 : ℝ)] + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; unfold spatialMovementEnvelope; ring + exact ⟨hA, hK, hT, hQ, hD, hB⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel VectorPolynomial +open scoped NNReal + +noncomputable def normalizedTupleTolerance (X : Type*) [Fintype X] (p E : ℝ) : ℝ := + spatialTupleTolerance (Fintype.card X) (Real.exp (p ^ 3 + anisotropicSpatialCapLog p)) + (Real.exp (coefficientErrorVolumeLog p + 4)) (normalizedSpatialShare E / 2) + +noncomputable def normalizedTupleNarrowWidth (X N : Type*) [Fintype X] [Fintype N] + {G : Type*} [Fintype G] {q : ℕ} (s : Fin q ↪ G) (M : ℕ) (p E : ℝ) : ℝ := + twoTermErrorWidth (smoothSpatialDisplacementCost N s M) (normalizedTupleTolerance X p E) + +noncomputable def normalizedTupleRadius (X : Type*) [Fintype X] + {G : Type*} [Fintype G] {q : ℕ} (s : Fin q ↪ G) (M : ℕ) (p E W : ℝ) : ℝ := + twoTermErrorWidth (Real.exp (p ^ 3) * (anisotropicSpatialDensityLip s (1 / (M : ℝ)) * (1 + W))) + (normalizedTupleTolerance X p E) + +noncomputable def normalizedTupleResolution (X N : Type*) [Fintype X] [Fintype N] + {G : Type*} [Fintype G] {q : ℕ} (s : Fin q ↪ G) (M : ℕ) + (p E C₀ W Cg Centry : ℝ) : ℝ := + twoTermErrorResolution + (anisotropicSpatialMeshThreshold s N C₀ + 8 * probabilityProfileLipschitz + + 2 * Fintype.card (Option (G ⊕ N)) * (2 * Centry)) + (anisotropicSpatialDiscretizationCost N s M C₀) (normalizedTupleTolerance X p E) + + (Cg * (24 * probabilityProfileLipschitz * Fintype.card (Option (G ⊕ N) × X))) / + (normalizedSpatialShare E / 2) + + (Fintype.card N * (2 * Centry)) / normalizedTupleRadius X s M p E W + +theorem normalizedTupleNarrowWidth_pos (X N : Type*) [Fintype X] [Fintype N] + {G : Type*} [Fintype G] {q : ℕ} (s : Fin q ↪ G) (M : ℕ) (p E : ℝ) : + 0 < normalizedTupleNarrowWidth X N s M p E := by + have ht : 0 < normalizedTupleTolerance X p E := (spatialTupleTolerance_spec (Fintype.card X) (Real.exp_nonneg _) + (Real.exp_nonneg _) (half_pos (Real.exp_pos (-(E + 2))))).1 + exact (twoTermErrorWidth_spec (smoothSpatialDisplacementCost_nonneg N s M) ht).1 + +theorem normalizedTupleSpatialChoices {G N X : Type*} + [Fintype G] [Fintype N] [Fintype X] {q m M : ℕ} (s : Fin q ↪ G) + (hM : 0 < M) {p E : ℝ} (hp : 0 ≤ p) (hE : 0 ≤ E) + (hm : ((m + 1 : ℕ) : ℝ) ≤ p) (hq : ((q + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hMp : (M : ℝ) ≤ Real.exp p) : + let ξ := normalizedTupleNarrowWidth X N s M p E + let Qearly := anisotropicTupleEarlyBudget N s p (E + 3) + 0 < ξ ∧ ξ ≤ 1 ∧ ξ⁻¹ ≤ Real.exp (2 * (Qearly + spatialTupleToleranceLog Qearly) + 4) ∧ + ∀ {C₀ W L Cg Centry growth : ℝ}, 0 ≤ C₀ → 0 ≤ W → 1 ≤ L → + 0 ≤ Cg → 0 ≤ Centry → growth ≤ Real.exp p → W ≤ growth * L → + let δ := normalizedTupleRadius X s M p E W + let mesh := δ / 4 + let ρ := normalizedTupleResolution X N s M p E C₀ W Cg Centry + 0 < δ ∧ δ ≤ 1 ∧ 0 < mesh ∧ 0 < ρ ∧ + anisotropicSpatialMeshThreshold s N C₀ ≤ ρ ∧ + 8 * probabilityProfileLipschitz ≤ ρ ∧ + 2 * Fintype.card (Option (G ⊕ N)) * (2 * Centry) ≤ ρ ∧ + Fintype.card N * (2 * Centry) ≤ δ * ρ ∧ + Cg * (24 * probabilityProfileLipschitz * Fintype.card (Option (G ⊕ N) × X) / ρ) ≤ + normalizedSpatialShare E / 2 ∧ + ∀ (period : ℕ), period ≤ M ^ (m + 1) → + allocatedTupleSpatialError (Fintype.card X) s N M period C₀ ρ ξ W δ mesh * + coarseReferenceMassConstant q X W L ≤ normalizedSpatialShare E / 2 := by + have hε : 0 < normalizedSpatialShare E / 2 := half_pos (Real.exp_pos _) + have hεE : (normalizedSpatialShare E / 2)⁻¹ ≤ Real.exp (E + 3) := by + unfold normalizedSpatialShare + rw [inv_div, div_eq_mul_inv, ← Real.exp_neg, neg_neg] + calc + _ ≤ Real.exp 1 * Real.exp (E + 2) := mul_le_mul_of_nonneg_right + (by linarith [Real.add_one_le_exp (1 : ℝ)]) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have h := boundedAnisotropicSpatialTuple_error_choices (N := N) (X := X) q s hM hp + (by linarith : 0 ≤ E + 3) hm hq hG hX hMp hε hεE + simpa only [normalizedTupleNarrowWidth, normalizedTupleTolerance, normalizedTupleRadius, + normalizedTupleResolution, allocatedTupleSpatialError, mul_assoc] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel VectorPolynomial +open scoped NNReal + +theorem canonicalSlicedSpatialChoices {G N X : Type*} + [Fintype G] [Fintype N] [Fintype X] {q m M : ℕ} (selection : Fin q ↪ G) + (hM : 0 < M) {p target : ℝ} (hp : 0 ≤ p) (htarget : 0 ≤ target) + (hm : ((m + 1 : ℕ) : ℝ) ≤ p) (hq : ((q + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hMp : (M : ℝ) ≤ Real.exp p) : + let ξ := normalizedTupleNarrowWidth X N selection M p target + let Qearly := anisotropicTupleEarlyBudget N selection p (target + 3) + 0 < ξ ∧ ξ ≤ 1 ∧ ξ⁻¹ ≤ Real.exp (2 * (Qearly + spatialTupleToleranceLog Qearly) + 4) ∧ + ∀ {C₀ W L Cg Centry growth earlyMesh : ℝ}, + 0 ≤ C₀ → 0 ≤ W → 1 ≤ L → 0 ≤ Cg → 0 ≤ Centry → + growth ≤ Real.exp p → W ≤ growth * L → 0 < earlyMesh → + let δ := normalizedTupleRadius X selection M p target W + let ρ := normalizedTupleResolution X N selection M p target C₀ W Cg Centry + let mesh := min (δ / 4) earlyMesh + 0 < δ ∧ δ ≤ 1 ∧ 0 < ρ ∧ 0 < mesh ∧ + mesh ≤ earlyMesh ∧ mesh ≤ δ / 4 ∧ + anisotropicSpatialMeshThreshold selection N C₀ ≤ ρ ∧ + 8 * probabilityProfileLipschitz ≤ ρ ∧ + 2 * Fintype.card (Option (G ⊕ N)) * (2 * Centry) ≤ ρ ∧ + Fintype.card N * (2 * Centry) ≤ δ * ρ ∧ + Cg * (24 * probabilityProfileLipschitz * Fintype.card (Option (G ⊕ N) × X) / ρ) ≤ + normalizedSpatialShare target / 2 ∧ + ∀ (period : ℕ), period ≤ M ^ (m + 1) → + allocatedTupleSpatialError (Fintype.card X) selection N M period C₀ ρ ξ W δ mesh * + coarseReferenceMassConstant q X W L ≤ normalizedSpatialShare target / 2 := by + intro ξ Qearly + obtain ⟨hξ, hξ1, hξlog, hchoices⟩ := + normalizedTupleSpatialChoices (N := N) (X := X) (m := m) selection hM hp htarget + hm hq hG hX hMp + refine ⟨hξ, hξ1, hξlog, ?_⟩ + intro C₀ W L Cg Centry growth earlyMesh hC₀ hW hL hCg hCentry hgrowth hWscale hearlyMesh + δ ρ mesh + obtain ⟨hδ, hδ1, hmesh₀, hρ, hthreshold, hρ8, hshift, hmove, hboundary, hsite⟩ := + hchoices hC₀ hW hL hCg hCentry hgrowth hWscale + have hfine : mesh ≤ δ / 4 := min_le_left _ _ + refine ⟨hδ, hδ1, hρ, lt_min hmesh₀ hearlyMesh, min_le_right _ _, hfine, + hthreshold, hρ8, hshift, hmove, hboundary, ?_⟩ + intro period hperiod + have hmass : 0 ≤ coarseReferenceMassConstant q X W L := by + have hprofile := smoothProbabilityProfile_pos_zero + unfold coarseReferenceMassConstant + positivity + exact (mul_le_mul_of_nonneg_right + (allocatedTupleSpatialError_mono_mesh (Fintype.card X) selection N M period + hC₀ hρ.le hξ.le hW hδ.le hfine) hmass).trans (hsite period hperiod) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open BooleanCubeKernel VectorPolynomial + +noncomputable def spatialTupleCoarseMesh (n : ℕ) (G V K ε : ℝ) : ℝ := + twoTermErrorWidth K (spatialTupleTolerance n G V ε) / 4 + +theorem spatialTupleCoarseMesh_spec (n : ℕ) {G V K ε : ℝ} + (hG : 0 ≤ G) (hV : 0 ≤ V) (hK : 0 ≤ K) (hε : 0 < ε) : + 0 < spatialTupleCoarseMesh n G V K ε ∧ spatialTupleCoarseMesh n G V K ε ≤ 1 / 4 ∧ + ∀ {g k v : ℝ}, 0 ≤ g → g ≤ G → 0 ≤ k → k ≤ K → 0 ≤ v → v ≤ V → + n * (8 * k * spatialTupleCoarseMesh n G V K ε) * (1 + g)^n * v ≤ ε := by + let t := spatialTupleTolerance n G V ε + let δ := twoTermErrorWidth K t + have ht := spatialTupleTolerance_spec n hG hV hε + have hδ := twoTermErrorWidth_spec hK ht.1 + have ht0 : 0 < t := ht.1 + have hδ0 : 0 < δ := hδ.1 + have hr : 0 < spatialTupleCoarseMesh n G V K ε := div_pos hδ.1 (by norm_num) + refine ⟨hr, div_le_div_of_nonneg_right hδ.2.1 (by norm_num), ?_⟩ + intro g k v hg hgG hk hkK hv hvV + have hinner : 8 * k * spatialTupleCoarseMesh n G V K ε ≤ t := by + have hkδ : k * δ ≤ K * δ := mul_le_mul_of_nonneg_right hkK hδ0.le + change 8 * k * (δ / 4) ≤ t + linarith [hδ.2.2] + have hp : (1 + g)^n ≤ (2 + G)^n := + pow_le_pow_left₀ (by positivity) (by linarith) n + calc + _ ≤ n * t * (2 + G)^n * V := by gcongr + _ = t * (2 + G)^n * (n * V) := by ring + _ ≤ t * (2 + G)^n * (2 * (n + 1) * (1 + V)) := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + nlinarith [Nat.cast_nonneg (α := ℝ) n] + _ = t * (2 * (n + 1) * (2 + G)^n * (1 + V)) := by ring + _ ≤ ε := ht.2.2 + +theorem twoTermErrorWidth_budget_antitone {B C ε : ℝ} + (hB : 0 ≤ B) (hε : 0 ≤ ε) (hBC : B ≤ C) : + twoTermErrorWidth C ε ≤ twoTermErrorWidth B ε := by + unfold twoTermErrorWidth + apply min_le_min_left + exact div_le_div_of_nonneg_left hε (by positivity) (by linarith) + +theorem normalizedTupleRadius_le_coarse (X : Type*) [Fintype X] + {G : Type*} [Fintype G] {q : ℕ} (s : Fin q ↪ G) (M : ℕ) (p E : ℝ) + {growth W : ℝ} (hgrowth : 0 ≤ growth) (hW : growth ≤ W) : + normalizedTupleRadius X s M p E W / 4 ≤ normalizedTupleRadius X s M p E growth / 4 := by + apply div_le_div_of_nonneg_right _ (by norm_num) + unfold normalizedTupleRadius + have hlip := anisotropicSpatialDensityLip_nonneg s (show 0 ≤ 1 / (M : ℝ) by positivity) + apply twoTermErrorWidth_budget_antitone (by positivity) + · exact (spatialTupleTolerance_spec (Fintype.card X) (Real.exp_nonneg _) + (Real.exp_nonneg _) (half_pos (Real.exp_pos _))).1.le + · gcongr + +theorem normalizedTupleCoarseMesh_budget (X : Type*) [Fintype X] + {G : Type*} [Fintype G] {q : ℕ} (s : Fin q ↪ G) (M : ℕ) (p E : ℝ) + {growth : ℝ} (hgrowth : 0 ≤ growth) : + let coarse := normalizedTupleRadius X s M p E growth / 4 + 0 < coarse ∧ coarse ≤ 1 / 4 ∧ + ∀ {g k v : ℝ}, 0 ≤ g → g ≤ Real.exp (p^3 + anisotropicSpatialCapLog p) → + 0 ≤ k → k ≤ Real.exp (p^3) * (anisotropicSpatialDensityLip s (1 / (M : ℝ)) * (1 + growth)) → + 0 ≤ v → v ≤ Real.exp (coefficientErrorVolumeLog p + 4) → + Fintype.card X * (8 * k * coarse) * (1 + g)^Fintype.card X * v ≤ normalizedSpatialShare E / 2 := by + have hlip := anisotropicSpatialDensityLip_nonneg s (show 0 ≤ 1 / (M : ℝ) by positivity) + exact spatialTupleCoarseMesh_spec (Fintype.card X) (Real.exp_nonneg _) + (Real.exp_nonneg _) (by positivity) (half_pos (Real.exp_pos _)) + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial + +open BooleanCubeKernel +open scoped NNReal + +theorem allocatedTupleSpatialError_mono_width {I J : Type*} [Fintype I] [Fintype J] + (n : ℕ) (selection : I ↪ J) (N : Type*) [Fintype N] (M period : ℕ) + {Czero rho xi small W delta mesh : ℝ} + (hC : 0 ≤ Czero) (hρ : 0 ≤ rho) (hsmall : 0 ≤ small) + (hwidth : small ≤ xi) (hW : 0 ≤ W) (hδ : 0 ≤ delta) (hmesh : 0 ≤ mesh) : + allocatedTupleSpatialError n selection N M period Czero rho small W delta mesh ≤ + allocatedTupleSpatialError n selection N M period Czero rho xi W delta mesh := by + have hκ : 0 ≤ 1 / (M : ℝ) := by positivity + have hE := anisotropicSpatialError_nonneg selection N M hκ hC hρ hsmall + have hcap := anisotropicSpatialDensityCap_nonneg selection hκ + have hlip := anisotropicSpatialDensityLip_nonneg selection hκ + have hmono : anisotropicSpatialError selection N M (1 / (M : ℝ)) Czero rho small ≤ + anisotropicSpatialError selection N M (1 / (M : ℝ)) Czero rho xi := by + rw [anisotropicSpatialError_decomposition, anisotropicSpatialError_decomposition] + exact add_le_add le_rfl + (mul_le_mul_of_nonneg_left hwidth (smoothSpatialDisplacementCost_nonneg N selection M)) + have hE' := hE.trans hmono + unfold allocatedTupleSpatialError + dsimp only + gcongr + +end Erdos3.VectorPolynomial + +namespace Erdos3 + +open BooleanCubeKernel VectorPolynomial +open scoped NNReal + +theorem sharedWidthNormalizedTupleSpatialChoices {G N X : Type*} + [Fintype G] [Fintype N] [Fintype X] {q m M : ℕ} (s : Fin q ↪ G) + (hM : 0 < M) {p E : ℝ} (hp : 0 ≤ p) (hE : 0 ≤ E) + (hm : ((m + 1 : ℕ) : ℝ) ≤ p) (hq : ((q + 1 : ℕ) : ℝ) ≤ p) + (hG : (Fintype.card G : ℝ) ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hMp : (M : ℝ) ≤ Real.exp p) {ξ : ℝ} + (hξ : 0 < ξ) (hξle : ξ ≤ normalizedTupleNarrowWidth X N s M p E) : + ξ ≤ 1 ∧ + ∀ {C₀ W L Cg Centry growth : ℝ}, 0 ≤ C₀ → 0 ≤ W → 1 ≤ L → + 0 ≤ Cg → 0 ≤ Centry → growth ≤ Real.exp p → W ≤ growth * L → + let δ := normalizedTupleRadius X s M p E W + let mesh := δ / 4 + let ρ := normalizedTupleResolution X N s M p E C₀ W Cg Centry + 0 < δ ∧ δ ≤ 1 ∧ 0 < mesh ∧ 0 < ρ ∧ + anisotropicSpatialMeshThreshold s N C₀ ≤ ρ ∧ + 8 * probabilityProfileLipschitz ≤ ρ ∧ + 2 * Fintype.card (Option (G ⊕ N)) * (2 * Centry) ≤ ρ ∧ + Fintype.card N * (2 * Centry) ≤ δ * ρ ∧ + Cg * (24 * probabilityProfileLipschitz * Fintype.card (Option (G ⊕ N) × X) / ρ) ≤ + normalizedSpatialShare E / 2 ∧ + ∀ (period : ℕ), period ≤ M ^ (m + 1) → + allocatedTupleSpatialError (Fintype.card X) s N M period C₀ ρ ξ W δ mesh * + coarseReferenceMassConstant q X W L ≤ normalizedSpatialShare E / 2 := by + obtain ⟨_, hcanonical, _, hchoices⟩ := normalizedTupleSpatialChoices + (N := N) (X := X) (m := m) s hM hp hE hm hq hG hX hMp + refine ⟨hξle.trans hcanonical, ?_⟩ + intro C₀ W L Cg Centry growth hC₀ hW hL hCg hCentry hgrowth hWscale δ mesh ρ + obtain ⟨hδ, hδ1, hmesh, hρ, hthreshold, hprofile, hshift, hmove, hboundary, hsite⟩ := + hchoices hC₀ hW hL hCg hCentry hgrowth hWscale + refine ⟨hδ, hδ1, hmesh, hρ, hthreshold, hprofile, hshift, hmove, hboundary, ?_⟩ + intro period hperiod + have hmass : 0 ≤ coarseReferenceMassConstant q X W L := by + have hprofile0 := smoothProbabilityProfile_pos_zero + unfold coarseReferenceMassConstant + positivity + exact (mul_le_mul_of_nonneg_right + (allocatedTupleSpatialError_mono_width (Fintype.card X) s N M period hC₀ hρ.le + hξ.le hξle hW hδ.le hmesh.le) hmass).trans (hsite period hperiod) + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def spatialPrimitiveEnvelope {A : Type*} [Semiring A] (p E l : A) : A := + p + E + l + 3 + (p ^ 3 + anisotropicSpatialCapLog p) + + (coefficientErrorVolumeLog p + 4) + spatialDisplacementEnvelope p + + spatialDiscretizationEnvelope p l + spatialLipschitzCostEnvelope p l + + spatialThresholdEnvelope p l + spatialBoundaryEnvelope p l + spatialMovementEnvelope p l + +noncomputable def spatialParameterBudget {A : Type*} [Semiring A] (p E l : A) : A := + let R := spatialPrimitiveEnvelope p E l + 3 * (2 * (R + spatialTupleToleranceLog R) + 4) + 8 + +theorem spatialPrimitiveEnvelope_bounds {p E l : ℝ} + (hp : 0 ≤ p) (hE : 0 ≤ E) (hl : 0 ≤ l) : + let R := spatialPrimitiveEnvelope p E l + 0 ≤ R ∧ p ≤ R ∧ E + 3 ≤ R ∧ p ^ 3 + anisotropicSpatialCapLog p ≤ R ∧ + coefficientErrorVolumeLog p + 4 ≤ R ∧ spatialDisplacementEnvelope p ≤ R ∧ + spatialDiscretizationEnvelope p l ≤ R ∧ spatialLipschitzCostEnvelope p l ≤ R ∧ + spatialThresholdEnvelope p l ≤ R ∧ spatialBoundaryEnvelope p l ≤ R ∧ + spatialMovementEnvelope p l ≤ R := by + obtain ⟨_, hd, ha, hm, hk⟩ := spatialCostEnvelopes_nonneg hp hl + have hcap : 0 ≤ p ^ 3 + anisotropicSpatialCapLog p := by + have := anisotropicSpatialCapLog_nonneg hp + positivity + have hvol : 0 ≤ coefficientErrorVolumeLog p + 4 := by + unfold coefficientErrorVolumeLog + positivity + have hK : 0 ≤ spatialLipschitzCostEnvelope p l := by + unfold spatialLipschitzCostEnvelope + positivity + have hT : 0 ≤ spatialThresholdEnvelope p l := by + unfold spatialThresholdEnvelope + positivity + have hQ : 0 ≤ spatialBoundaryEnvelope p l := by + unfold spatialBoundaryEnvelope + positivity + have hD : 0 ≤ spatialMovementEnvelope p l := by + unfold spatialMovementEnvelope + positivity + dsimp only [spatialPrimitiveEnvelope] + repeat' constructor + all_goals linarith + +theorem spatialParameterBudget_bounds {p E l : ℝ} + (hp : 0 ≤ p) (hE : 0 ≤ E) (hl : 0 ≤ l) : + let R := spatialPrimitiveEnvelope p E l + let B := 2 * (R + spatialTupleToleranceLog R) + 4 + 0 ≤ spatialParameterBudget p E l ∧ B ≤ spatialParameterBudget p E l ∧ + R ≤ B ∧ spatialTupleToleranceLog R ≤ B := by + have hR := (spatialPrimitiveEnvelope_bounds hp hE hl).1 + have ht := spatialTupleToleranceLog_nonneg hR + dsimp only [spatialParameterBudget] + exact ⟨by linarith, by linarith, by linarith, by linarith⟩ + +theorem exists_spatialParameterBudget_bound : + ∃ a : ℕ, 2 ≤ a ∧ ∀ {p E l : ℝ}, 0 ≤ p → 0 ≤ E → 0 ≤ l → + spatialParameterBudget p E l ≤ (p + E + l + a) ^ a := by + let poly : Polynomial ℕ := spatialParameterBudget Polynomial.X Polynomial.X Polynomial.X + obtain ⟨a, ha, hbound⟩ := exists_natPolynomial_eval_budget poly + refine ⟨a, ha, ?_⟩ + intro p E l hp hE hl + have hpq : p ≤ p + E + l := by linarith + have hEq : E ≤ p + E + l := by linarith + have hlq : l ≤ p + E + l := by linarith + have hmono : spatialParameterBudget p E l ≤ + spatialParameterBudget (p + E + l) (p + E + l) (p + E + l) := by + dsimp only [spatialParameterBudget, spatialPrimitiveEnvelope, spatialTupleToleranceLog, + spatialDisplacementEnvelope, spatialDiscretizationEnvelope, spatialLipschitzCostEnvelope, + spatialThresholdEnvelope, spatialBoundaryEnvelope, spatialMovementEnvelope, + spatialMeshEnvelope, spatialLipschitzEnvelope, spatialFixedProfileEnvelope, + coefficientErrorVolumeLog, anisotropicSpatialCapLog] + gcongr + apply hmono.trans + simpa [poly, spatialParameterBudget, spatialPrimitiveEnvelope, spatialTupleToleranceLog, + spatialDisplacementEnvelope, spatialDiscretizationEnvelope, spatialLipschitzCostEnvelope, + spatialThresholdEnvelope, spatialBoundaryEnvelope, spatialMovementEnvelope, + spatialMeshEnvelope, spatialLipschitzEnvelope, spatialFixedProfileEnvelope, + coefficientErrorVolumeLog, anisotropicSpatialCapLog, Polynomial.eval₂_pow] + using hbound (p + E + l) (by positivity) + +end Erdos3 + +end + +section + +namespace Erdos3 + +section Maps + +variable {α β : Type*} [Semiring α] [Semiring β] (f : α →+* β) + +@[simp] theorem map_coefficientErrorSpatialLog (p : α) : + f (coefficientErrorSpatialLog p) = coefficientErrorSpatialLog (f p) := by + simp [coefficientErrorSpatialLog, coefficientErrorVolumeLog, anisotropicSpatialCapLog, + map_ofNat] + +@[simp] theorem map_spatialPrimitiveEnvelope (p E l : α) : + f (spatialPrimitiveEnvelope p E l) = spatialPrimitiveEnvelope (f p) (f E) (f l) := by + simp [spatialPrimitiveEnvelope, spatialDisplacementEnvelope, + spatialDiscretizationEnvelope, spatialLipschitzCostEnvelope, + spatialThresholdEnvelope, spatialBoundaryEnvelope, spatialMovementEnvelope, + spatialMeshEnvelope, spatialLipschitzEnvelope, spatialFixedProfileEnvelope, + coefficientErrorVolumeLog, anisotropicSpatialCapLog, map_ofNat] + +@[simp] theorem map_spatialTupleToleranceLog (p : α) : + f (spatialTupleToleranceLog p) = spatialTupleToleranceLog (f p) := by + simp [spatialTupleToleranceLog, map_ofNat] + +@[simp] theorem map_spatialParameterBudget (p E l : α) : + f (spatialParameterBudget p E l) = spatialParameterBudget (f p) (f E) (f l) := by + simp only [spatialParameterBudget, map_add, map_mul, map_ofNat, + map_spatialPrimitiveEnvelope, map_spatialTupleToleranceLog] + +end Maps + +theorem coefficientErrorSpatialLog_mono {p p' : ℝ} + (hp : 0 ≤ p) (hpp : p ≤ p') : + coefficientErrorSpatialLog p ≤ coefficientErrorSpatialLog p' := by + have hp' : 0 ≤ p' := hp.trans hpp + dsimp only [coefficientErrorSpatialLog, coefficientErrorVolumeLog, + anisotropicSpatialCapLog] + gcongr + +theorem spatialPrimitiveEnvelope_mono {p E l p' E' l' : ℝ} + (hp : 0 ≤ p) (_hE : 0 ≤ E) (hl : 0 ≤ l) + (hpp : p ≤ p') (hEE : E ≤ E') (hll : l ≤ l') : + spatialPrimitiveEnvelope p E l ≤ spatialPrimitiveEnvelope p' E' l' := by + have hp' : 0 ≤ p' := hp.trans hpp + dsimp only [spatialPrimitiveEnvelope, spatialDisplacementEnvelope, + spatialDiscretizationEnvelope, spatialLipschitzCostEnvelope, + spatialThresholdEnvelope, spatialBoundaryEnvelope, spatialMovementEnvelope, + spatialMeshEnvelope, spatialLipschitzEnvelope, spatialFixedProfileEnvelope, + coefficientErrorVolumeLog, anisotropicSpatialCapLog] + gcongr + +theorem spatialTupleToleranceLog_mono {p p' : ℝ} + (hp : 0 ≤ p) (hpp : p ≤ p') : + spatialTupleToleranceLog p ≤ spatialTupleToleranceLog p' := by + dsimp only [spatialTupleToleranceLog] + gcongr + +theorem spatialParameterBudget_mono {p E l p' E' l' : ℝ} + (hp : 0 ≤ p) (hE : 0 ≤ E) (hl : 0 ≤ l) + (hpp : p ≤ p') (hEE : E ≤ E') (hll : l ≤ l') : + spatialParameterBudget p E l ≤ spatialParameterBudget p' E' l' := by + have hR := (spatialPrimitiveEnvelope_bounds hp hE hl).1 + have hRR := spatialPrimitiveEnvelope_mono hp hE hl hpp hEE hll + have hT := spatialTupleToleranceLog_mono hR hRR + dsimp only [spatialParameterBudget] + linarith + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialOutputChoice.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialOutputChoice.lean new file mode 100644 index 0000000000000000000000000000000000000000..1833756c6b708fbdb9cc9dbfabea134942397996 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialOutputChoice.lean @@ -0,0 +1,77 @@ +import OAI.Combinatorics.Progressions.Estimates.ResidualErrorAllocation + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def spatialOutputScale {N : Type*} [Fintype N] + (L : ℕ) (ρ ξ : ℝ) (W : N → ℝ) : ℝ := 1+(L : ℝ)*ρ+(∑ n, W n)*ρ/ξ + +theorem spatialOutputScale_spec {N : Type*} [Fintype N] + {L : ℕ} (hL : 0 < L) {ρ ξ : ℝ} (hρ : 0 < ρ) (hξ : 0 < ξ) + (W : N → ℝ) (hW : ∀ n, 0 ≤ W n) : + 0 < spatialOutputScale L ρ ξ W ∧ 1 ≤ spatialOutputScale L ρ ξ W ∧ + ρ ≤ spatialOutputScale L ρ ξ W/L ∧ + ∀ n, W n*ρ ≤ ξ*spatialOutputScale L ρ ξ W := by + have hs : 0 ≤ ∑ n, W n := Finset.sum_nonneg (fun n _ => hW n) + have h1 : 1 ≤ spatialOutputScale L ρ ξ W := by + unfold spatialOutputScale + have ha : 0 ≤ (L : ℝ)*ρ := by positivity + have hb : 0 ≤ (∑ n, W n)*ρ/ξ := by positivity + linarith + have hpart : (L : ℝ)*ρ ≤ spatialOutputScale L ρ ξ W := by + unfold spatialOutputScale + have hh : 0 ≤ (∑ n, W n)*ρ/ξ := by positivity + linarith + refine ⟨lt_of_lt_of_le zero_lt_one h1, h1, ?_, ?_⟩ + · apply (le_div_iff₀ (by exact_mod_cast hL : (0 : ℝ) < L)).mpr + nlinarith + · intro n + have hsum : W n ≤ ∑ j, W j := Finset.single_le_sum (fun j _ => hW j) (Finset.mem_univ n) + have hrest : (∑ j, W j)*ρ/ξ ≤ spatialOutputScale L ρ ξ W := by + unfold spatialOutputScale + have hh : 0 ≤ (L : ℝ)*ρ := by positivity + linarith + have hh := (div_le_iff₀ hξ).mp hrest + nlinarith [mul_le_mul_of_nonneg_right hsum hρ.le] + +theorem spatialOutputScale_log_bound {N : Type*} [Fintype N] + (L : ℕ) {ρ ξ P : ℝ} (hρ : 0 ≤ ρ) (hξ : 0 < ξ) (hP : 0 ≤ P) + (W : N → ℝ) (hW0 : ∀ n, 0 ≤ W n) (hW : ∀ n, W n ≤ Real.exp P) + (hL : (L : ℝ) ≤ Real.exp P) (hρP : ρ ≤ Real.exp P) (hξP : ξ⁻¹ ≤ Real.exp P) : + spatialOutputScale L ρ ξ W ≤ Real.exp (Fintype.card N+3*P+3) := by + have hs0 : 0 ≤ ∑ n, W n := Finset.sum_nonneg (fun n _ => hW0 n) + have hs : (∑ n, W n) ≤ Real.exp (Fintype.card N+P) := by + calc + _ ≤ ∑ _n : N, Real.exp P := Finset.sum_le_sum (fun n _ => hW n) + _ = (Fintype.card N : ℝ)*Real.exp P := by simp + _ ≤ Real.exp (Fintype.card N : ℝ)*Real.exp P := by + apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le + linarith [Real.add_one_le_exp (Fintype.card N : ℝ)] + _ = _ := (Real.exp_add _ _).symm + have ht : (∑ n, W n)*ρ/ξ ≤ Real.exp (Fintype.card N+3*P) := by + rw [div_eq_mul_inv] + calc + _ ≤ Real.exp (Fintype.card N+P)*Real.exp P*Real.exp P := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + have hl : (L : ℝ)*ρ ≤ Real.exp (Fintype.card N+3*P) := by + calc + _ ≤ Real.exp P*Real.exp P := mul_le_mul hL hρP hρ (Real.exp_pos _).le + _ = Real.exp (2*P) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by linarith [Nat.cast_nonneg (α := ℝ) (Fintype.card N)]) + have hone : 1 ≤ Real.exp (Fintype.card N+3*P) := Real.one_le_exp_iff.mpr (by positivity) + have h3 : (3 : ℝ) ≤ Real.exp 3 := by linarith [Real.add_one_le_exp (3 : ℝ)] + calc + _ ≤ 3*Real.exp (Fintype.card N+3*P) := by unfold spatialOutputScale; linarith + _ ≤ Real.exp 3*Real.exp (Fintype.card N+3*P) := mul_le_mul_of_nonneg_right h3 (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add, add_comm] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialPivotNormalization.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialPivotNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..cec450860375657b462cf57a9f829889b6878c52 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialPivotNormalization.lean @@ -0,0 +1,123 @@ +import Mathlib.Data.Matrix.ColumnRowPartitioned +import Mathlib.Logic.Equiv.Set +import OAI.Combinatorics.Progressions.Lattices.IntegerFiberUniformBound +import OAI.Combinatorics.Progressions.Linear.RootDifferenceMatrix + +namespace OAI + +section + +namespace Erdos3 + +open scoped Matrix + +abbrev UnselectedColumn {I J : Type*} (s : I ↪ J) := {j : J // j ∉ Set.range s} + +noncomputable instance unselectedColumnFintype {I J : Type*} [Fintype J] (s : I ↪ J) : + Fintype (UnselectedColumn s) := Fintype.ofFinite _ + +noncomputable def selectedColumnEquiv {I J : Type*} [Fintype I] (s : I ↪ J) : I ⊕ UnselectedColumn s ≃ J := by + classical + exact (Equiv.sumCongr s.toEquivRange (Equiv.refl (UnselectedColumn s))).trans + (Equiv.sumCompl (fun j => j ∈ Set.range s)) + +noncomputable def selectedSpatialColumnEquiv {I J : Type*} [Fintype I] (s : I ↪ J) : + (Unit ⊕ I) ⊕ UnselectedColumn s ≃ Unit ⊕ J := + (Equiv.sumAssoc Unit I (UnselectedColumn s)).trans + (Equiv.sumCongr (Equiv.refl Unit) (selectedColumnEquiv s)) + +def selectedSpatialPivot {I J R : Type*} [CommRing R] + (root : J → R) (D : Matrix I J R) (s : I ↪ J) : Matrix (Unit ⊕ I) (Unit ⊕ I) R := + rootDifferenceMatrix (fun i => root (s i)) (D.submatrix id s) + +def selectedSpatialFreeColumns {I J R : Type*} [CommRing R] + (root : J → R) (D : Matrix I J R) (s : I ↪ J) : Matrix (Unit ⊕ I) (UnselectedColumn s) R := + Matrix.of (fun i j => Sum.elim (fun _ : Unit => root j.val) (fun i => D i j.val) i) + +theorem selectedSpatial_fromCols {I J R : Type*} [Fintype I] [CommRing R] + (root : J → R) (D : Matrix I J R) (s : I ↪ J) : + Matrix.fromCols (selectedSpatialPivot root D s) (selectedSpatialFreeColumns root D s) = + (rootDifferenceMatrix root D).submatrix id (selectedSpatialColumnEquiv s) := by + ext i j + cases j with + | inl j => cases j <;> cases i <;> rfl + | inr j => cases i <;> rfl + +theorem selectedSpatial_mulVec {I J R : Type*} [Fintype I] [Fintype J] [CommRing R] + (root : J → R) (D : Matrix I J R) (s : I ↪ J) + (v : (Unit ⊕ I) ⊕ UnselectedColumn s → R) : + rootDifferenceMatrix root D *ᵥ (v ∘ (selectedSpatialColumnEquiv s).symm) = + selectedSpatialPivot root D s *ᵥ (v ∘ Sum.inl) + + selectedSpatialFreeColumns root D s *ᵥ (v ∘ Sum.inr) := by + have h := Matrix.submatrix_mulVec_equiv (rootDifferenceMatrix root D) v id (selectedSpatialColumnEquiv s) + rw [← selectedSpatial_fromCols, Matrix.fromCols_mulVec] at h + exact h.symm + +end Erdos3 + +end + +section + +namespace Erdos3 + +noncomputable def spatialPivotScale (I : Type*) (H L : ℝ) : Unit ⊕ I → ℝ := + Sum.elim (fun _ : Unit => H) (fun _ : I => H / L) + +theorem spatialPivotScale_pos (I : Type*) {H L : ℝ} (hH : 0 < H) (hL : 0 < L) : + ∀ i, 0 < spatialPivotScale I H L i := by + intro i + cases i + · exact hH + · exact div_pos hH hL + +theorem normalized_selectedSpatialPivot {I J : Type*} [Fintype I] [DecidableEq I] + (root : J → ℤ) (D : Matrix I J ℤ) (s : I ↪ J) {H L : ℝ} (hH : H ≠ 0) (hL : L ≠ 0) : + normalizedIntegerPivot (selectedSpatialPivot root D s) (spatialPivotScale I H L) (fun _ => H) = + rootDifferenceMatrix (fun i => (root (s i) : ℝ) / L) + (Matrix.of (fun i j => (D i (s j) : ℝ) / L)) := by + ext i j + rw [normalizedIntegerPivot_entry] + cases i with + | inl i => + cases i + cases j with + | inl j => + cases j + simp [selectedSpatialPivot, rootDifferenceMatrix, spatialPivotScale, Matrix.fromBlocks, hH] + | inr j => + simp only [selectedSpatialPivot, rootDifferenceMatrix, spatialPivotScale, Matrix.fromBlocks, + Matrix.of_apply, Sum.elim_inr, Sum.elim_inl] + field_simp + | inr i => + cases j with + | inl j => simp [selectedSpatialPivot, rootDifferenceMatrix, spatialPivotScale, Matrix.fromBlocks] + | inr j => + simp only [selectedSpatialPivot, rootDifferenceMatrix, spatialPivotScale, Matrix.fromBlocks, + Matrix.of_apply, Sum.elim_inr, Matrix.submatrix_apply, id_eq] + field_simp + +theorem rootDifferenceMatrix_real_bound {I J : Type*} + (root : J → ℝ) (D : Matrix I J ℝ) {C : ℝ} (hC : 1 ≤ C) + (hr : ∀ j, |root j| ≤ C) (hD : ∀ i j, |D i j| ≤ C) : + ∀ i j, |rootDifferenceMatrix root D i j| ≤ C := by + rintro (i | i) (j | j) + · cases i; cases j + simpa [rootDifferenceMatrix, Matrix.fromBlocks] using hC + · exact hr j + · change |(0 : ℝ)| ≤ C + simpa using (zero_le_one.trans hC) + · exact hD i j + +theorem normalizedPivotEquiv_inverse_eq {I : Type*} [Fintype I] [DecidableEq I] + (A : Matrix I I ℤ) (hA : A.det ≠ 0) (S P : I → ℝ) + (hS : ∀ i, 0 < S i) (hP : ∀ i, 0 < P i) : + (normalizedPivotEquiv A hA S P hS hP).symm.toContinuousLinearMap = + (matrixSupCLM (normalizedIntegerPivot A S P)).inverse := by + rw [← normalizedPivotEquiv_coe A hA S P hS hP, ContinuousLinearMap.inverse_equiv] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialShiftedWindowError.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialShiftedWindowError.lean new file mode 100644 index 0000000000000000000000000000000000000000..c67fb757c23adc62aee14ce5fe0f0c983f38bb9c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialShiftedWindowError.lean @@ -0,0 +1,358 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteWindowWeightError +import OAI.Combinatorics.Progressions.Estimates.PhysicalAmbientVolumeRatio + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators + +theorem mem_rectangular_zero_radius_iff {I : Type*} [Fintype I] + (H : I → ℝ) (R : ℝ) (v : I → ℤ) : + v ∈ rectangularWeightIndices 0 H R ↔ ∀ i, |(v i : ℝ)| ≤ H i * R := by + classical + constructor + · intro hv i + have h := sampledWeightIndices_mem_bound (Fintype.mem_piFinset.mp hv i) + simpa only [Pi.zero_apply, sub_zero] using h + · intro hv + apply Fintype.mem_piFinset.mpr + intro i + change v i ∈ sampledWeightIndices 0 (H i) R + simp only [sampledWeightIndices, zero_sub, zero_add, Finset.mem_Icc] + exact ⟨Int.ceil_le.mpr (abs_le.mp (hv i)).1, Int.le_floor.mpr (abs_le.mp (hv i)).2⟩ + +noncomputable def commonSpatialWindow {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) : Finset (X → (Unit ⊕ α) → ℤ) := by + classical + exact (Fintype.piFinset (fun d => rectangularWeightIndices 0 (fun _ : Unit ⊕ α => H d) 3)).image + (fun w d => spatialUnstar (w d)) + +theorem mem_commonSpatialWindow_iff {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) (v : X → (Unit ⊕ α) → ℤ) : + v ∈ commonSpatialWindow H ↔ ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ)| ≤ H d * 3 := by + classical + constructor + · intro hv + obtain ⟨w, hw, rfl⟩ := Finset.mem_image.mp hv + intro d i + have h := (mem_rectangular_zero_radius_iff (fun _ : Unit ⊕ α => H d) 3 (w d)).mp + (Fintype.mem_piFinset.mp hw d) i + simpa only [spatialStar_unstar] using h + · intro hv + apply Finset.mem_image.mpr + refine ⟨fun d => spatialStar (v d), ?_, ?_⟩ + · apply Fintype.mem_piFinset.mpr + intro d + exact (mem_rectangular_zero_radius_iff (fun _ : Unit ⊕ α => H d) 3 _).mpr (hv d) + · funext d + exact spatialUnstar_star (v d) + +theorem mem_commonSpatialWindow_scaled_iff {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) (hH : ∀ d, 0 < H d) (v : X → (Unit ⊕ α) → ℤ) : + v ∈ commonSpatialWindow H ↔ ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ) / H d| ≤ 3 := by + rw [mem_commonSpatialWindow_iff] + simp only [abs_div, abs_of_pos (hH _), div_le_iff₀ (hH _), mul_comm] + +theorem commonSpatialWindow_card {X α : Type*} [Fintype X] [Fintype α] + (H T : X → ℝ) {W L : ℝ} (hH : ∀ d, 1 ≤ H d) + (hL : L ≠ 0) (hscale : ∀ d, H d = (1 + W) * T d) : + ((commonSpatialWindow (α := α) H).card : ℝ) ≤ + (7 ^ Fintype.card (X × (Unit ⊕ α)) * (((1 + W) / L) ^ Fintype.card α) ^ Fintype.card X) * + ∏ d, ∏ i, physicalSpatialOutputScale α (H d) (T d) L i := by + apply spatialStarWindow_card_anisotropic _ H T hH hL hscale + intro v hv + exact (mem_commonSpatialWindow_scaled_iff H (fun d => zero_lt_one.trans_le (hH d)) v).mp hv + +theorem centeredPhysicalCubeWindow_subset_common {K X α : Type*} + [Fintype K] [Fintype X] [Fintype α] + (root : K → ℤ) (D : Matrix α K ℤ) (Q : Option K × X → ℝ) (H T : X → ℝ) + {W : ℝ} (hW : 0 ≤ W) (hH : ∀ d, 0 < H d) (hT : ∀ d, 0 ≤ T d) + (hscale : ∀ d, H d = (1 + W) * T d) + (hQ : ∀ d, (fun k => Q (k, d)) = physicalSpatialInputScale K (H d) (T d)) + (hroot : (∑ k, |(root k : ℝ)|) ≤ W) + (hD : ∀ i, (∑ k, |(D i k : ℝ)|) ≤ W) : + centeredPhysicalCubeWindow root D Q ⊆ commonSpatialWindow H := by + intro v hv + exact (mem_commonSpatialWindow_scaled_iff H hH v).mpr + (centeredPhysicalCubeWindow_star_bound root D Q H T hW hH hT hscale hQ hroot hD v hv) + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3 + +theorem spatialStar_add {I R : Type*} [AddCommMonoid R] + (v w : (Unit ⊕ I) → R) : spatialStar (v + w) = spatialStar v + spatialStar w := by + funext i + cases i with + | inl i => rfl + | inr i => simp only [spatialStar, Sum.elim_inr, Pi.add_apply]; abel + +namespace BooleanCubeKernel + +open scoped BigOperators + +noncomputable def spatialWindow {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) (b : ℝ) : Finset (X → (Unit ⊕ α) → ℤ) := by + classical + exact (Fintype.piFinset (fun d => rectangularWeightIndices 0 (fun _ : Unit ⊕ α => H d) b)).image + (fun w d => spatialUnstar (w d)) + +theorem spatialWindow_three {X α : Type*} [Fintype X] [Fintype α] (H : X → ℝ) : + spatialWindow (α := α) H 3 = commonSpatialWindow H := rfl + +theorem mem_spatialWindow_iff {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) (b : ℝ) (v : X → (Unit ⊕ α) → ℤ) : + v ∈ spatialWindow H b ↔ ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ)| ≤ H d * b := by + classical + constructor + · intro hv + obtain ⟨w, hw, rfl⟩ := Finset.mem_image.mp hv + intro d i + have h := (mem_rectangular_zero_radius_iff (fun _ : Unit ⊕ α => H d) b (w d)).mp + (Fintype.mem_piFinset.mp hw d) i + simpa only [spatialStar_unstar] using h + · intro hv + apply Finset.mem_image.mpr + refine ⟨fun d => spatialStar (v d), ?_, ?_⟩ + · apply Fintype.mem_piFinset.mpr + intro d + exact (mem_rectangular_zero_radius_iff (fun _ : Unit ⊕ α => H d) b _).mpr (hv d) + · funext d + exact spatialUnstar_star (v d) + +theorem mem_spatialWindow_scaled_iff {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) (hH : ∀ d, 0 < H d) (b : ℝ) (v : X → (Unit ⊕ α) → ℤ) : + v ∈ spatialWindow H b ↔ ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ) / H d| ≤ b := by + rw [mem_spatialWindow_iff] + simp only [abs_div, abs_of_pos (hH _), div_le_iff₀ (hH _), mul_comm] + +theorem spatialWindow_add {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) {a b : ℝ} {v s : X → (Unit ⊕ α) → ℤ} + (hv : v ∈ spatialWindow H a) (hs : s ∈ spatialWindow H b) : + v + s ∈ spatialWindow H (a + b) := by + apply (mem_spatialWindow_iff H (a+b) _).mpr + intro d i + change |((spatialStar (v d + s d) i : ℤ) : ℝ)| ≤ _ + rw [spatialStar_add, Pi.add_apply, Int.cast_add] + calc + _ ≤ |((spatialStar (v d) i : ℤ) : ℝ)| + |((spatialStar (s d) i : ℤ) : ℝ)| := abs_add_le _ _ + _ ≤ H d * a + H d * b := add_le_add + ((mem_spatialWindow_iff H a v).mp hv d i) ((mem_spatialWindow_iff H b s).mp hs d i) + _ = _ := (mul_add _ _ _).symm + +theorem spatialWindow_of_coordinate_bound {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) (hH : ∀ d, 0 ≤ H d) {t : ℝ} (ht : 0 ≤ t) + (s : X → (Unit ⊕ α) → ℤ) (hs : ∀ d i, |(s d i : ℝ)| ≤ H d * t) : + s ∈ spatialWindow H (2*t) := by + apply (mem_spatialWindow_iff H (2*t) s).mpr + intro d i + cases i with + | inl i => + change |(s d (.inl ()) : ℝ)| ≤ _ + nlinarith [hs d (.inl ()), mul_nonneg (hH d) ht] + | inr i => + change |((s d (.inl ()) + s d (.inr i) : ℤ) : ℝ)| ≤ _ + rw [Int.cast_add] + exact (abs_add_le _ _).trans (by nlinarith [hs d (.inl ()), hs d (.inr i)]) + +theorem spatialWindow_card {X α : Type*} [Fintype X] [Fintype α] + (H : X → ℝ) (hH : ∀ d, 1 ≤ H d) {b : ℝ} (hb : 0 ≤ b) : + ((spatialWindow (α := α) H b).card : ℝ) ≤ + (2*b+1) ^ Fintype.card (X × (Unit ⊕ α)) * (∏ d, ∏ _i : Unit ⊕ α, H d) := by + classical + let F : (X → (Unit ⊕ α) → ℤ) → (X × (Unit ⊕ α) → ℤ) := + fun v z => spatialStar (v z.1) z.2 + have hinj : Function.Injective F := by + intro v w h + funext d + have he : spatialStar (v d) = spatialStar (w d) := funext (fun i => congrFun h (d, i)) + have hu := congrArg spatialUnstar he + simpa only [spatialUnstar_star] using hu + have hinto : (spatialWindow H b).image F ⊆ + rectangularWeightIndices 0 (fun z : X × (Unit ⊕ α) => H z.1) b := by + intro w hw + obtain ⟨v, hv, rfl⟩ := Finset.mem_image.mp hw + apply (mem_rectangular_zero_radius_iff _ b _).mpr + intro z + exact (mem_spatialWindow_iff H b v).mp hv z.1 z.2 + have hc : (spatialWindow (α := α) H b).card ≤ + (rectangularWeightIndices 0 (fun z : X × (Unit ⊕ α) => H z.1) b).card := by + rw [← Finset.card_image_of_injective _ hinj] + exact Finset.card_le_card hinto + apply (Nat.cast_le.mpr hc).trans + simpa only [Fintype.prod_prod_type] using + rectangularWeightIndices_card_le (0 : X × (Unit ⊕ α) → ℝ) + (fun z => H z.1) (fun z => hH z.1) hb + +theorem spatialWindow_card_anisotropic {X α : Type*} [Fintype X] [Fintype α] + (H T : X → ℝ) {W L b : ℝ} (hH : ∀ d, 1 ≤ H d) (hb : 0 ≤ b) + (hL : L ≠ 0) (hscale : ∀ d, H d = (1 + W) * T d) : + ((spatialWindow (α := α) H b).card : ℝ) ≤ + ((2*b+1) ^ Fintype.card (X × (Unit ⊕ α)) * + (((1+W)/L) ^ Fintype.card α) ^ Fintype.card X) * + ∏ d, ∏ i, physicalSpatialOutputScale α (H d) (T d) L i := by + have h := spatialWindow_card (α := α) H hH hb + rw [physicalSpatial_uniform_volume H T hL hscale, ← mul_assoc] at h + exact h + +end BooleanCubeKernel +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem spatialStar_neg {I R : Type*} [AddCommGroup R] (v : (Unit ⊕ I) → R) : + spatialStar (-v) = -spatialStar v := by + funext i + cases i with + | inl i => rfl + | inr i => simp only [spatialStar, Sum.elim_inr, Pi.neg_apply, neg_add] + +namespace BooleanCubeKernel + +variable {X I : Type*} [Fintype X] [Fintype I] + +theorem spatialWindow_radius_mono (H : X → ℝ) (hH : ∀ x, 0 ≤ H x) {a b : ℝ} (hab : a ≤ b) : + spatialWindow (α := I) H a ⊆ spatialWindow H b := by + intro v hv + apply (mem_spatialWindow_iff H b v).2 + intro x i + exact ((mem_spatialWindow_iff H a v).1 hv x i).trans (mul_le_mul_of_nonneg_left hab (hH x)) + +theorem spatialWindow_neg (H : X → ℝ) (a : ℝ) (v : X → (Unit ⊕ I) → ℤ) + (hv : v ∈ spatialWindow H a) : -v ∈ spatialWindow H a := by + apply (mem_spatialWindow_iff H a (-v)).2 + intro x i + change |((spatialStar (-(v x)) i : ℤ) : ℝ)| ≤ _ + rw [spatialStar_neg, Pi.neg_apply, Int.cast_neg, abs_neg] + exact (mem_spatialWindow_iff H a v).1 hv x i + +theorem spatialWeight_shift_global (H : X → ℝ) (hH : ∀ x, 0 ≤ H x) + (f : (X → (Unit ⊕ I) → ℤ) → ℂ) {a b e E : ℝ} (he : 0 ≤ e) (hE : 0 ≤ E) + (hab : a + e ≤ b) + (hf : ∀ v, v ∉ spatialWindow H a → f v = 0) + (s : X → (Unit ⊕ I) → ℤ) (hs : s ∈ spatialWindow H e) + (hoverlap : ∀ v, v ∈ spatialWindow H b → v + s ∈ spatialWindow H b → ‖f (v + s) - f v‖ ≤ E) : + ∀ v, ‖f (v + s) - f v‖ ≤ E := by + have hab' : a ≤ b := le_trans (le_add_of_nonneg_right he) hab + have hsmall := spatialWindow_radius_mono (I := I) H hH hab' + have hlarge := spatialWindow_radius_mono (I := I) H hH hab + intro v + by_cases hv : v ∈ spatialWindow H b + · by_cases hvs : v + s ∈ spatialWindow H b + · exact hoverlap v hv hvs + · have hzero₁ : f (v + s) = 0 := hf _ (fun h => hvs (hsmall h)) + have hzero₀ : f v = 0 := hf _ (fun h => hvs (hlarge (spatialWindow_add H h hs))) + rw [hzero₁, hzero₀, sub_self, norm_zero] + exact hE + · have hzero₀ : f v = 0 := hf _ (fun h => hv (hsmall h)) + have hzero₁ : f (v + s) = 0 := by + apply hf + intro h + have hback := hlarge (spatialWindow_add H h (spatialWindow_neg H e s hs)) + have hid : v + s + -s = v := by abel + rw [hid] at hback + exact hv hback + rw [hzero₁, hzero₀, sub_self, norm_zero] + exact hE + +end BooleanCubeKernel +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem finite_window_sum_eq_of_support {V : Type*} (s t : Finset V) (f : V → ℂ) + (hs : ∀ v ∈ s, v ∉ t → f v = 0) (ht : ∀ v ∈ t, v ∉ s → f v = 0) : + (∑ v ∈ s, f v) = ∑ v ∈ t, f v := by + have hleft : (∑ v ∈ s ∩ t, f v) = ∑ v ∈ s, f v := + Finset.sum_subset Finset.inter_subset_left (fun v hv hn => hs v hv + (fun h => hn (Finset.mem_inter.mpr ⟨hv, h⟩))) + have hright : (∑ v ∈ s ∩ t, f v) = ∑ v ∈ t, f v := + Finset.sum_subset Finset.inter_subset_right (fun v hv hn => ht v hv + (fun h => hn (Finset.mem_inter.mpr ⟨h, hv⟩))) + exact hleft.symm.trans hright + +namespace BooleanCubeKernel + +variable {X I : Type*} [Fintype X] [Fintype I] + +theorem spatialWeight_shifted_window_eq (H : X → ℝ) (hH : ∀ x, 0 ≤ H x) + (f φ : (X → (Unit ⊕ I) → ℤ) → ℂ) {a b e : ℝ} (he : 0 ≤ e) (hab : a + e ≤ b) + (hf : ∀ v, v ∉ spatialWindow H a → f v = 0) + (s : X → (Unit ⊕ I) → ℤ) (hs : s ∈ spatialWindow H e) : + (∑ v ∈ (spatialWindow H b).image (fun w => w + s), f (v - s) * φ v) = + ∑ v ∈ spatialWindow H b, f (v - s) * φ v := by + have hsmall := spatialWindow_radius_mono (I := I) H hH + (le_trans (le_add_of_nonneg_right he) hab) + have hlarge := spatialWindow_radius_mono (I := I) H hH hab + apply finite_window_sum_eq_of_support + · intro v _ hn + have hz : f (v - s) = 0 := by + apply hf + intro h + have hmem := hlarge (spatialWindow_add H h hs) + rw [sub_add_cancel] at hmem + exact hn hmem + rw [hz, zero_mul] + · intro v _ hn + have hz : f (v - s) = 0 := by + apply hf + intro h + exact hn (Finset.mem_image.mpr ⟨v - s, hsmall h, sub_add_cancel v s⟩) + rw [hz, zero_mul] + +theorem spatialWeight_shifted_window_error (H : X → ℝ) (hH : ∀ x, 0 ≤ H x) + (f φ : (X → (Unit ⊕ I) → ℤ) → ℂ) {a b e E : ℝ} (he : 0 ≤ e) (hab : a + e ≤ b) + (hf : ∀ v, v ∉ spatialWindow H a → f v = 0) + (s : X → (Unit ⊕ I) → ℤ) (hs : s ∈ spatialWindow H e) + (hshift : ∀ v, ‖f (v + s) - f v‖ ≤ E) : + ‖(∑ v ∈ (spatialWindow H b).image (fun w => w + s), f (v - s) * φ v) - + ∑ v ∈ spatialWindow H b, f v * φ v‖ ≤ E * ∑ v ∈ spatialWindow H b, ‖φ v‖ := by + rw [spatialWeight_shifted_window_eq H hH f φ he hab hf s hs, ← Finset.sum_sub_distrib, Finset.mul_sum] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro v _ + rw [← sub_mul, norm_mul] + apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) + simpa only [sub_add_cancel, norm_sub_rev] using hshift (v - s) + +theorem spatialWeight_mean_shifted_window_error {Ω : Type*} [Fintype Ω] + (p : FiniteProbabilityWeights Ω) (H : X → ℝ) (hH : ∀ x, 0 ≤ H x) + (f φ : Ω → (X → (Unit ⊕ I) → ℤ) → ℂ) {a b e E Z : ℝ} + (he : 0 ≤ e) (hab : a + e ≤ b) (hZ : 0 < Z) + (hf : ∀ y, p.weight y ≠ 0 → ∀ v, v ∉ spatialWindow H a → f y v = 0) + (s : Ω → X → (Unit ⊕ I) → ℤ) + (hs : ∀ y, p.weight y ≠ 0 → s y ∈ spatialWindow H e) + (hshift : ∀ y, p.weight y ≠ 0 → ∀ v, ‖f y (v + s y) - f y v‖ ≤ E) : + ‖p.complexMean (fun y => ∑ v ∈ (spatialWindow H b).image (fun w => w + s y), + f y (v - s y) * φ y v) / (Z : ℂ) - + p.complexMean (fun y => ∑ v ∈ spatialWindow H b, f y v * φ y v) / (Z : ℂ)‖ ≤ + E * p.mean (fun y => ∑ v ∈ spatialWindow H b, ‖φ y v‖) / Z := by + rw [← sub_div, norm_div, Complex.norm_real, Real.norm_of_nonneg hZ.le] + apply div_le_div_of_nonneg_right _ hZ.le + have h := p.norm_complexMean_sub_le _ _ _ (fun y hy => + spatialWeight_shifted_window_error H hH (f y) (φ y) he hab (hf y hy) (s y) (hs y hy) (hshift y hy)) + simpa only [FiniteProbabilityWeights.mean_const_mul] using h + +end BooleanCubeKernel +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialSiteNativePartner.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialSiteNativePartner.lean new file mode 100644 index 0000000000000000000000000000000000000000..1149c41ff3d2326bfcead359c7eb6594884a903a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialSiteNativePartner.lean @@ -0,0 +1,146 @@ +import OAI.Combinatorics.Progressions.Estimates.ReconstructedCubeNativePartner + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel +open scoped BigOperators Classical + +variable {K X : Type*} [Fintype K] [Fintype X] [DecidableEq X] {dim : ℕ} +variable (root : K → ℤ) (D : Matrix (Fin dim) K ℤ) (base : X → ℤ) +variable (residue : Option K × X → ℤ) (q N : X → ℕ) (H : X → ℝ) (radius mesh : ℝ) +variable {modulus : ℕ} (t : X → SpatialSiteLabel (Fin dim) modulus radius mesh) +variable (input : (X → ℤ) → ℂ) (analytic : Finset (Fin dim) → (X → ℤ) → ℂ) +local notation "spatial" => physicalResidueSpatialSiteFactor root D base residue q radius mesh H t + +theorem physicalSpatialProduct_support + (hinput : ∀ u, u ∉ integerBox N → input u = 0) + (u : X → (Unit ⊕ Fin dim) → ℤ) + (hproduct : (∏ site, conjugationPower site.card (input (physicalCubeVertexValue u site)) * + (spatial site (physicalCubeVertexValue u site) * analytic site (physicalCubeVertexValue u site))) ≠ 0) : + (∀ site, physicalCubeVertexValue u site ∈ integerBox N) ∧ + u ∈ Set.range (physicalResidueReconstruction root D base residue q) := by + have hsite (site : Finset (Fin dim)) := (Finset.prod_ne_zero_iff.mp hproduct) site (Finset.mem_univ site) + constructor + · intro site + by_contra hnot + apply hsite site + simp only [hinput _ hnot, map_zero, zero_mul] + · apply physicalResidueSpatialSiteFactor_prod_nonzero_mem_range root D base residue q radius mesh H t u + apply Finset.prod_ne_zero_iff.mpr + intro site _ + exact (mul_ne_zero_iff.mp (mul_ne_zero_iff.mp (hsite site)).2).1 + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3 +open BooleanCubeKernel +open scoped BigOperators Classical +attribute [local instance] NativeSampleCorrelation.lie NativeSampleCorrelation.algebra + NativeSampleCorrelation.topology NativeSampleCorrelation.topologicalAdd + NativeSampleCorrelation.continuousSMul NativeSampleCorrelation.hausdorff + +variable {s n : ℕ} {K : Type*} [Fintype K] +variable (root : K → ℤ) (D : Matrix (Fin (s + 1)) K ℤ) (base : Fin n → ℤ) +variable (residue : Option K × Fin n → ℤ) (stride N : Fin n → ℕ) +variable [∀ i, NeZero (N i)] (H : Fin n → ℝ) (radius mesh : ℝ) +variable {modulus : ℕ} (t : Fin n → SpatialSiteLabel (Fin (s + 1)) modulus radius mesh) +variable (f : (Fin n → ℤ) → ℂ) (analytic : Finset (Fin (s + 1)) → (Fin n → ℤ) → ℂ) +local notation "spatial" => physicalResidueSpatialSiteFactor root D base residue stride radius mesh H t +local notation "twist" => (fun site u => spatial site u * analytic site u) +local notation "mask" => physicalResidueWindowSiteMask root D base residue stride H radius + +theorem native_partner_of_spatial_site_source + (hstride : ∀ i, 0 < stride i) (hmesh : 0 < mesh) + (hf : ∀ x ∈ integerBox N, ‖f x‖ ≤ 1) + (hzero : ∀ x, x ∉ integerBox N → f x = 0) + (ha : ∀ site x, x ∈ integerBox N → ‖analytic site x‖ ≤ 1) + {p q volume : ℝ} (hp : 0 ≤ p) (hq : 0 ≤ q) (hn : (n : ℝ) ≤ p + q) + (hvolume : 0 < volume) (hratio : (integerBoxCubeCount N (s + 1) : ℝ) / volume ≤ Real.exp q) + (hsource : Real.exp (-p) ≤ ‖(∑ v ∈ spatialWindow H radius, + let u := physicalResidueReconstruction root D base residue stride v + ∏ site, conjugationPower site.card (f (physicalCubeVertexValue u site)) * + (spatial site (physicalCubeVertexValue u site) * analytic site (physicalCubeVertexValue u site))) / + (volume : ℂ)‖) : + ∃ V : NativeSampleCorrelation (fun _ : Fin n => 1) s + ((p + q + 2) ^ Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s)) + (integerBox N) id (fun x => f x * (mask ∅ x * (spatial ∅ x * analytic ∅ x))), + V.test.normBound ≤ 1 ∧ + Real.exp (-((p + q + 2) ^ Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s))) ≤ + ‖𝔼 x ∈ integerBox N, f x * star (star (mask ∅ x * (spatial ∅ x * analytic ∅ x)) * V.test.eval x)‖ := by + have ht : ∀ site x, x ∈ integerBox N → ‖twist site x‖ ≤ 1 := by + intro site x hx + rw [norm_mul] + exact (mul_le_mul (physicalResidueSpatialSiteFactor_bound root D base residue stride radius hmesh H t site x) + (ha site x hx) (norm_nonneg _) zero_le_one).trans_eq (one_mul _) + have hsupport := physicalSpatialProduct_support root D base residue stride N H radius mesh t f analytic hzero + exact native_partner_of_reconstructed_cube_norm root D base residue stride N hstride H radius f twist hf ht + (fun u hu => (hsupport u hu).1) (fun u hu => (hsupport u hu).2) hp hq hn hvolume hratio hsource + +theorem native_partner_of_supported_spatial_site_source + (hstride : ∀ i, 0 < stride i) (hmesh : 0 < mesh) + (hf : ∀ x ∈ integerBox N, ‖f x‖ ≤ 1) + (hzero : ∀ x, x ∉ integerBox N → f x = 0) + (ha : ∀ site x, x ∈ integerBox N → ‖analytic site x‖ ≤ 1) + (hwindow : ∀ v, v ∉ spatialWindow H radius → + (∏ site, spatial site (physicalCubeVertexValue + (physicalResidueReconstruction root D base residue stride v) site)) = 0) + {p q volume : ℝ} (hp : 0 ≤ p) (hq : 0 ≤ q) (hn : (n : ℝ) ≤ p + q) + (hvolume : 0 < volume) (hratio : (integerBoxCubeCount N (s + 1) : ℝ) / volume ≤ Real.exp q) + (hsource : Real.exp (-p) ≤ ‖(∑ v ∈ spatialWindow H radius, + let u := physicalResidueReconstruction root D base residue stride v + ∏ site, conjugationPower site.card (f (physicalCubeVertexValue u site)) * + (spatial site (physicalCubeVertexValue u site) * analytic site (physicalCubeVertexValue u site))) / + (volume : ℂ)‖) : + ∃ V : NativeSampleCorrelation (fun _ : Fin n => 1) s + ((p + q + 2) ^ Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s)) + (integerBox N) id (fun x => f x * (spatial ∅ x * analytic ∅ x)), + V.test.normBound ≤ 1 ∧ + Real.exp (-((p + q + 2) ^ Classical.choose (exists_native_partner_of_physical_cube_mixture_all_degrees.{0} s))) ≤ + ‖𝔼 x ∈ integerBox N, f x * star (star (spatial ∅ x * analytic ∅ x) * V.test.eval x)‖ := by + let φ := fun u => ∏ site, conjugationPower site.card (f (physicalCubeVertexValue u site)) * + (spatial site (physicalCubeVertexValue u site) * analytic site (physicalCubeVertexValue u site)) + have hsupport := physicalSpatialProduct_support root D base residue stride N H radius mesh t f analytic hzero + have hwindow' (v) (hv : v ∉ spatialWindow H radius) : + φ (physicalResidueReconstruction root D base residue stride v) = 0 := by + dsimp only [φ] + simp only [Finset.prod_mul_distrib] + rw [hwindow v hv, zero_mul, mul_zero] + have he := physicalResidueWindow_sum_eq_count_mul_mean root D base residue stride N hstride + (spatialWindow H radius) φ (fun v _ hv => (hsupport _ hv).1) hwindow' + (fun u hu => (hsupport u hu).2) + let z : ℂ := 𝔼 cube : SupportedCube (s + 1) (integerBox N : Set (Fin n → ℤ)), + φ ((physicalCubeParametersEquiv (Fin n) (s + 1)).symm cube.val) + have hbound : Real.exp (-p) ≤ Real.exp q * ‖z‖ := by + change Real.exp (-p) ≤ ‖(∑ v ∈ spatialWindow H radius, + φ (physicalResidueReconstruction root D base residue stride v)) / (volume : ℂ)‖ at hsource + rw [he, norm_div, norm_mul] at hsource + have hc : 0 ≤ (integerBoxCubeCount N (s + 1) : ℝ) := Nat.cast_nonneg _ + simp only [Complex.norm_natCast, Complex.norm_real, Real.norm_of_nonneg hvolume.le] at hsource + calc + _ ≤ (integerBoxCubeCount N (s + 1) : ℝ) / volume * ‖z‖ := by + simpa only [z, div_mul_eq_mul_div] using hsource + _ ≤ _ := mul_le_mul_of_nonneg_right hratio (norm_nonneg _) + have hnorm : Real.exp (-(p + q)) ≤ ‖z‖ := by + have hexp : Real.exp (-(p + q)) = Real.exp (-p) / Real.exp q := by + rw [← Real.exp_sub] + congr 1 + ring + rw [hexp] + exact (div_le_iff₀ (Real.exp_pos q)).mpr (by simpa only [mul_comm] using hbound) + apply native_partner_of_physical_cube_norm N (p + q) (add_nonneg hp hq) hn f twist hf ?_ hnorm + intro site u hu + rw [norm_mul] + exact (mul_le_mul (physicalResidueSpatialSiteFactor_bound root D base residue stride radius hmesh H t site u) + (ha site u hu) (norm_nonneg _) zero_le_one).trans_eq (one_mul _) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialSiteShift.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialSiteShift.lean new file mode 100644 index 0000000000000000000000000000000000000000..eacfee8bd87139a5feedbe347654de6ded2ca4fb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialSiteShift.lean @@ -0,0 +1,571 @@ +import OAI.Combinatorics.Progressions.Estimates.GroupedSiteTensor +import OAI.Combinatorics.Progressions.Estimates.MaskedIntervalApproximation +import OAI.Combinatorics.Progressions.Probability.MaskedDensityTranslation + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal BigOperators + +noncomputable def spatialStarDensity {I : Type*} (f : ((Unit ⊕ I) → ℝ) → ℝ) + (y : (Unit ⊕ I) → ℝ) : ℂ := f (spatialUnstar y) + +theorem spatialStarDensity_lipschitz {I : Type*} [Fintype I] + {f : ((Unit ⊕ I) → ℝ) → ℝ} {K : ℝ≥0} (hf : LipschitzWith K f) : + LipschitzWith (2 * K) (spatialStarDensity f) := by + unfold spatialStarDensity + have h := Complex.isometry_ofReal.lipschitzWith.comp (hf.comp (spatialUnstar_lipschitz I)) + simpa only [one_mul, mul_comm K 2, Function.comp_def] using h + +theorem spatialStarDensity_bound {I : Type*} (f : ((Unit ⊕ I) → ℝ) → ℝ) {C : ℝ} + (hf : ∀ y, |f y| ≤ C) (y : (Unit ⊕ I) → ℝ) : ‖spatialStarDensity f y‖ ≤ C := by + simpa only [spatialStarDensity, Complex.norm_real, Real.norm_eq_abs] using hf (spatialUnstar y) + +noncomputable def spatialSiteApprox {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] (f : ((Unit ⊕ I) → ℝ) → ℝ) (H b r : ℝ) + (v : (Unit ⊕ I) → ℤ) : ℂ := + maskedIntervalApprox b r H m (spatialStarDensity f) (latticeStarMask (pivotFullImage A B) m) + (spatialStar v) + +theorem spatialSiteApprox_error {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] + (hperiod : integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ pivotFullImage A B) + (f : ((Unit ⊕ I) → ℝ) → ℝ) {K : ℝ≥0} (hf : LipschitzWith K f) + {G b r : ℝ} (hindex : ((pivotFullImage A B).toAddSubgroup.index : ℝ) ≤ G) + (hb : 0 < b) (hr : 0 < r) (H : ℝ) (v : (Unit ⊕ I) → ℤ) + (hv : ∀ i, |((spatialStar v i : ℤ) : ℝ) / H| ≤ b) : + ‖(maskedIntegerImageDensity A B (fun _ => H) f v : ℂ) - spatialSiteApprox A B m f H b r v‖ ≤ + 4 * G * K * r := by + rw [maskedIntegerImageDensity_star A B m hperiod H f v] + have hG : 0 ≤ G := (Nat.cast_nonneg _).trans hindex + have h := maskedIntervalApprox_error hb hr H m (spatialStarDensity f) + (latticeStarMask (pivotFullImage A B) m) (spatialStarDensity_lipschitz hf) hG + (latticeStarMask_bound _ _ hindex) (spatialStar v) hv + exact h.trans_eq (by push_cast; ring) + +theorem spatialSiteApprox_coefficient_sum {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] (f : ((Unit ⊕ I) → ℝ) → ℝ) (b r : ℝ) {G C : ℝ} + (hindex : ((pivotFullImage A B).toAddSubgroup.index : ℝ) ≤ G) (hf : ∀ y, |f y| ≤ C) : + (∑ a : (Unit ⊕ I) → ZMod m, ∑ k : (Unit ⊕ I) → Fin (intervalSiteCount b r), + ‖latticeStarMask (pivotFullImage A B) m a * + spatialStarDensity f (fun i => intervalSiteCenter b r (k i))‖) ≤ + (m : ℝ)^Fintype.card (Unit ⊕ I) * (intervalSiteCount b r : ℝ)^Fintype.card (Unit ⊕ I) * (G * C) := + maskedIntervalApprox_coefficient_sum b r m (spatialStarDensity f) + (latticeStarMask (pivotFullImage A B) m) ((Nat.cast_nonneg _).trans hindex) + (latticeStarMask_bound _ _ hindex) (spatialStarDensity_bound f hf) + +noncomputable def spatialSiteRadius (G K ε : ℝ) : ℝ := ε / (4 * (1 + G) * (1 + K)) + +theorem spatialSiteRadius_pos {G K ε : ℝ} (hG : 0 ≤ G) (hK : 0 ≤ K) (hε : 0 < ε) : + 0 < spatialSiteRadius G K ε := by unfold spatialSiteRadius; positivity + +theorem spatialSiteRadius_error {G K ε : ℝ} (hG : 0 ≤ G) (hK : 0 ≤ K) (hε : 0 ≤ ε) : + 4 * G * K * spatialSiteRadius G K ε ≤ ε := by + have hd : 0 < 4 * (1 + G) * (1 + K) := by positivity + unfold spatialSiteRadius + rw [← mul_div_assoc] + apply (div_le_iff₀ hd).mpr + nlinarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem intervalTensorApprox_zero_outside {S : Type*} [Fintype S] [DecidableEq S] + (B r : ℝ) (hr : 0 < r) (F : (S → ℝ) → ℂ) (a : ℝ) + (hsupport : ∀ x, (∃ i, a < |x i|) → F x = 0) + (x : S → ℝ) (hx : ∃ i, a + 2 * r < |x i|) : + intervalTensorApprox B r F x = 0 := by + unfold intervalTensorApprox + apply Finset.sum_eq_zero + intro k _ + by_cases hw : intervalTensorWeight B r k x = 0 + · simp only [hw, Complex.ofReal_zero, zero_mul] + · have hp : 0 < intervalTensorWeight B r k x := + lt_of_le_of_ne (intervalTensorWeight_nonneg B hr k x) (Ne.symm hw) + have hn := intervalTensorWeight_near hr k x hp + obtain ⟨i, hi⟩ := hx + have hdist := (dist_le_pi_dist x (fun i => intervalSiteCenter B r (k i)) i).trans hn + have hcenter : a < |intervalSiteCenter B r (k i)| := by + rw [Real.dist_eq] at hdist + have ht : |x i| ≤ |x i - intervalSiteCenter B r (k i)| + |intervalSiteCenter B r (k i)| := by + simpa only [sub_add_cancel] using abs_add_le (x i - intervalSiteCenter B r (k i)) (intervalSiteCenter B r (k i)) + linarith + rw [hsupport _ ⟨i, hcenter⟩, mul_zero] + +theorem spatialSiteApprox_zero_outside {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] (f : ((Unit ⊕ I) → ℝ) → ℝ) (H b r a : ℝ) (hr : 0 < r) + (hsupport : ∀ v, (∃ i, a < |spatialStar v i|) → f v = 0) + (v : (Unit ⊕ I) → ℤ) + (hv : ∃ i, a + 2 * r < |((spatialStar v i : ℤ) : ℝ) / H|) : + spatialSiteApprox A B m f H b r v = 0 := by + unfold spatialSiteApprox + rw [maskedIntervalApprox_eq] + have hzero := intervalTensorApprox_zero_outside b r hr (spatialStarDensity f) a + (fun x hx => by + unfold spatialStarDensity + rw [hsupport _ (by simpa only [spatialStar_unstar] using hx), Complex.ofReal_zero]) + (fun i => ((spatialStar v i : ℤ) : ℝ) / H) hv + rw [hzero, mul_zero] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem intervalTensorApprox_norm_le {S : Type*} [Fintype S] [DecidableEq S] + {B r C : ℝ} (hB : 0 < B) (hr : 0 < r) (F : (S → ℝ) → ℂ) + (hF : ∀ y, ‖F y‖ ≤ C) (x : S → ℝ) (hx : ∀ i, |x i| ≤ B) : + ‖intervalTensorApprox B r F x‖ ≤ C := by + unfold intervalTensorApprox + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ k : S → Fin (intervalSiteCount B r), intervalTensorWeight B r k x * C := by + apply Finset.sum_le_sum + intro k _ + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (intervalTensorWeight_nonneg B hr k x)] + exact mul_le_mul_of_nonneg_left (hF _) (intervalTensorWeight_nonneg B hr k x) + _ = C := by rw [← Finset.sum_mul, intervalTensorWeight_sum hB hr x hx, one_mul] + +theorem maskedIntegerImageDensity_abs_le {I J : Type*} [Fintype I] [Fintype J] + (A : Matrix I I ℤ) (B : Matrix I J ℤ) (P : I → ℝ) (f : (I → ℝ) → ℝ) + {G C : ℝ} (hC : 0 ≤ C) + (hindex : ((pivotFullImage A B).toAddSubgroup.index : ℝ) ≤ G) + (hf : ∀ y, |f y| ≤ C) (v : I → ℤ) : + |maskedIntegerImageDensity A B P f v| ≤ G * C := by + unfold maskedIntegerImageDensity + split_ifs + · rw [abs_mul, abs_of_nonneg (Nat.cast_nonneg _)] + exact mul_le_mul hindex (hf _) (abs_nonneg _) ((Nat.cast_nonneg _).trans hindex) + · simpa using mul_nonneg ((Nat.cast_nonneg _).trans hindex) hC + +theorem spatialSiteApprox_norm_le {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] (f : ((Unit ⊕ I) → ℝ) → ℝ) (H : ℝ) + {b r G C : ℝ} (hb : 0 < b) (hr : 0 < r) + (hindex : ((pivotFullImage A B).toAddSubgroup.index : ℝ) ≤ G) + (hf : ∀ y, |f y| ≤ C) (v : (Unit ⊕ I) → ℤ) + (hv : ∀ i, |((spatialStar v i : ℤ) : ℝ) / H| ≤ b) : + ‖spatialSiteApprox A B m f H b r v‖ ≤ G * C := by + rw [spatialSiteApprox, maskedIntervalApprox_eq, norm_mul] + exact mul_le_mul (latticeStarMask_bound _ _ hindex _) + (intervalTensorApprox_norm_le hb hr _ (spatialStarDensity_bound f hf) _ hv) + (norm_nonneg _) ((Nat.cast_nonneg _).trans hindex) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem norm_weighted_complex_mean_sub_le {V : Type*} (t : Finset V) + (D : V → ℝ) (a b φ : V → ℂ) {ε : ℝ} + (hD : ∀ v ∈ t, 0 ≤ D v) (hφ : ∀ v ∈ t, ‖φ v‖ ≤ 1) + (he : ∀ v ∈ t, ‖a v - b v‖ ≤ ε) : + ‖(𝔼 v ∈ t, (D v : ℂ) * a v * φ v) - (𝔼 v ∈ t, (D v : ℂ) * b v * φ v)‖ ≤ + ε * (𝔼 v ∈ t, D v) := by + rw [← Finset.expect_sub_distrib] + apply (RCLike.norm_expect_le (K := ℂ)).trans + calc + _ ≤ 𝔼 v ∈ t, ε * D v := by + apply Finset.expect_le_expect + intro v hv + have hid : (D v : ℂ) * a v * φ v - (D v : ℂ) * b v * φ v = + (D v : ℂ) * (a v - b v) * φ v := by ring + rw [hid, norm_mul, norm_mul, Complex.norm_real, Real.norm_of_nonneg (hD v hv)] + calc + _ ≤ D v * ‖a v - b v‖ * 1 := + mul_le_mul_of_nonneg_left (hφ v hv) (mul_nonneg (hD v hv) (norm_nonneg _)) + _ ≤ ε * D v := by rw [mul_one, mul_comm ε]; exact mul_le_mul_of_nonneg_left (he v hv) (hD v hv) + _ = _ := (Finset.mul_expect _ _ _).symm + +theorem norm_site_family_replacement {R V : Type*} [Fintype R] (t : Finset V) + (D : R → V → ℝ) (a b : R → V → ℂ) (φ : V → ℂ) {ε : ℝ} + (hD : ∀ r v, v ∈ t → 0 ≤ D r v) (hφ : ∀ v ∈ t, ‖φ v‖ ≤ 1) + (he : ∀ r v, v ∈ t → ‖a r v - b r v‖ ≤ ε) : + ‖(∑ r, 𝔼 v ∈ t, (D r v : ℂ) * a r v * φ v) - + (∑ r, 𝔼 v ∈ t, (D r v : ℂ) * b r v * φ v)‖ ≤ + ε * (∑ r, 𝔼 v ∈ t, D r v) := by + rw [← Finset.sum_sub_distrib] + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ r, ε * (𝔼 v ∈ t, D r v) := Finset.sum_le_sum (fun r _ => + norm_weighted_complex_mean_sub_le t (D r) (a r) (b r) φ (hD r) hφ (he r)) + _ = _ := (Finset.mul_sum _ _ _).symm + +theorem norm_fiber_site_replacement {X R V : Type*} [Fintype X] [Fintype R] + (p : FiniteProbabilityWeights X) (F : X → R) (t : Finset V) + (D : X → V → ℝ) (a b : R → V → ℂ) (φ : V → ℂ) {ε : ℝ} + (hD : ∀ x v, 0 ≤ D x v) (hφ : ∀ v ∈ t, ‖φ v‖ ≤ 1) + (he : ∀ r v, v ∈ t → ‖a r v - b r v‖ ≤ ε) : + ‖(∑ r, 𝔼 v ∈ t, (p.fiberMean F r (fun x => D x v) : ℂ) * a r v * φ v) - + (∑ r, 𝔼 v ∈ t, (p.fiberMean F r (fun x => D x v) : ℂ) * b r v * φ v)‖ ≤ + ε * p.mean (fun x => 𝔼 v ∈ t, D x v) := by + have hmass : (∑ r, 𝔼 v ∈ t, p.fiberMean F r (fun x => D x v)) = + p.mean (fun x => 𝔼 v ∈ t, D x v) := by + rw [← Finset.expect_sum_comm] + simp_rw [p.sum_fiberMean] + unfold FiniteProbabilityWeights.mean + simp_rw [Finset.mul_expect] + exact Finset.expect_sum_comm _ _ _ + have h := norm_site_family_replacement t (fun r v => p.fiberMean F r (fun x => D x v)) + a b φ (fun r v _ => p.fiberMean_nonneg F r _ (fun x => hD x v)) hφ he + rwa [hmass] at h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +abbrev SpatialSiteLabel (I : Type*) (m : ℕ) (b r : ℝ) := + ((Unit ⊕ I) → ZMod m) × ((Unit ⊕ I) → Fin (intervalSiteCount b r)) + +noncomputable def spatialSiteCoefficient {I J : Type*} [Fintype I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) (f : ((Unit ⊕ I) → ℝ) → ℝ) (b r : ℝ) (t : SpatialSiteLabel I m b r) : ℂ := + latticeStarMask (pivotFullImage A B) m t.1 * + spatialStarDensity f (fun i => intervalSiteCenter b r (t.2 i)) + +theorem spatialSiteApprox_sum {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] (f : ((Unit ⊕ I) → ℝ) → ℝ) (H b r : ℝ) (v : (Unit ⊕ I) → ℤ) : + spatialSiteApprox A B m f H b r v = + ∑ t : SpatialSiteLabel I m b r, spatialSiteCoefficient A B m f b r t * + ∏ i, (residueIntervalSiteWeight b r H (t.1 i) (t.2 i) (spatialStar v i) : ℂ) := by + simp only [spatialSiteApprox, maskedIntervalApprox, Fintype.sum_prod_type, + spatialSiteCoefficient, Complex.ofReal_prod] + +theorem spatialSiteCoefficient_sum_bound {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] (f : ((Unit ⊕ I) → ℝ) → ℝ) (b r : ℝ) {G C : ℝ} + (hindex : ((pivotFullImage A B).toAddSubgroup.index : ℝ) ≤ G) (hf : ∀ y, |f y| ≤ C) : + (∑ t : SpatialSiteLabel I m b r, ‖spatialSiteCoefficient A B m f b r t‖) ≤ + (m : ℝ)^Fintype.card (Unit ⊕ I) * (intervalSiteCount b r : ℝ)^Fintype.card (Unit ⊕ I) * (G*C) := by + simpa only [Fintype.sum_prod_type, spatialSiteCoefficient] using + spatialSiteApprox_coefficient_sum A B m f b r hindex hf + +theorem vectorSpatialSiteExpansion {D I J : Type*} + [Fintype D] [DecidableEq D] [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : D → Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] (f : D → ((Unit ⊕ I) → ℝ) → ℝ) (H : D → ℝ) + (b r : ℝ) (v : D → (Unit ⊕ I) → ℤ) : + (∏ d, spatialSiteApprox A (B d) m (f d) (H d) b r (v d)) = + ∑ t : D → SpatialSiteLabel I m b r, + (∏ d, spatialSiteCoefficient A (B d) m (f d) b r (t d)) * + ∏ i, vectorResidueSiteWeight b r H (fun d => (t d).1 i) (fun d => (t d).2 i) + (fun d => spatialStar (v d) i) := by + simp_rw [spatialSiteApprox_sum] + exact siteFactorTensor_identity _ _ _ + +theorem vectorSpatialSiteCoefficient_sum_bound {D I J : Type*} + [Fintype D] [DecidableEq D] [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : D → Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] (f : D → ((Unit ⊕ I) → ℝ) → ℝ) (b r : ℝ) {G C : ℝ} + (hindex : ∀ d, ((pivotFullImage A (B d)).toAddSubgroup.index : ℝ) ≤ G) + (hf : ∀ d y, |f d y| ≤ C) : + (∑ t : D → SpatialSiteLabel I m b r, + ‖∏ d, spatialSiteCoefficient A (B d) m (f d) b r (t d)‖) ≤ + ((m : ℝ)^Fintype.card (Unit ⊕ I) * (intervalSiteCount b r : ℝ)^Fintype.card (Unit ⊕ I) * + (G*C))^Fintype.card D := by + have h := siteFactorTensor_coefficient_bound + (fun d => spatialSiteCoefficient A (B d) m (f d) b r) _ + (fun d => spatialSiteCoefficient_sum_bound A (B d) m (f d) b r (hindex d) (hf d)) + simpa only [Finset.prod_const, Finset.card_univ] using h + +theorem vectorSpatialSiteLabel_card {D I : Type*} [Fintype D] [DecidableEq D] [Fintype I] [DecidableEq I] + (m : ℕ) [NeZero m] (b r : ℝ) : + Fintype.card (D → SpatialSiteLabel I m b r) = + (m^Fintype.card (Unit ⊕ I) * (intervalSiteCount b r)^Fintype.card (Unit ⊕ I))^Fintype.card D := by + classical + simp only [SpatialSiteLabel, Fintype.card_fun, Fintype.card_prod, ZMod.card, Fintype.card_fin] + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators Classical + +theorem spatialSiteTerm_zero_outside {I J : Type*} [Fintype I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) (f : ((Unit ⊕ I) → ℝ) → ℝ) (H b r a : ℝ) (hr : 0 < r) + (hsupport : ∀ v, (∃ i, a < |spatialStar v i|) → f v = 0) + (t : SpatialSiteLabel I m b r) (v : (Unit ⊕ I) → ℤ) + (hv : ∃ i, a + 2 * r < |((spatialStar v i : ℤ) : ℝ) / H|) : + spatialSiteCoefficient A B m f b r t * + (∏ i, (residueIntervalSiteWeight b r H (t.1 i) (t.2 i) (spatialStar v i) : ℂ)) = 0 := by + by_cases hc : spatialSiteCoefficient A B m f b r t = 0 + · rw [hc, zero_mul] + by_cases hw : (∏ i, (residueIntervalSiteWeight b r H (t.1 i) (t.2 i) (spatialStar v i) : ℂ)) = 0 + · rw [hw, mul_zero] + obtain ⟨i, hi⟩ := hv + have hwi := (Finset.prod_ne_zero_iff.mp hw) i (Finset.mem_univ i) + have hreal : residueIntervalSiteWeight b r H (t.1 i) (t.2 i) (spatialStar v i) ≠ 0 := by + exact_mod_cast hwi + have hweight : intervalSiteWeight b r (t.2 i) ((spatialStar v i : ℤ) / H) ≠ 0 := + (mul_ne_zero_iff.mp hreal).2 + have hnear := intervalSiteWeight_near b r (t.2 i) ((spatialStar v i : ℤ) / H) + (lt_of_le_of_ne (intervalSiteWeight_range b hr _ _).1 hweight.symm) + have hcenter : a < |intervalSiteCenter b r (t.2 i)| := by + rw [Real.dist_eq] at hnear + have ht := abs_add_le (((spatialStar v i : ℤ) : ℝ) / H - intervalSiteCenter b r (t.2 i)) + (intervalSiteCenter b r (t.2 i)) + rw [sub_add_cancel] at ht + linarith only [hi, hnear, ht] + have hz : spatialStarDensity f (fun j => intervalSiteCenter b r (t.2 j)) = 0 := by + unfold spatialStarDensity + rw [hsupport _ (by simpa only [spatialStar_unstar] using (show ∃ j, a < |intervalSiteCenter b r (t.2 j)| from ⟨i, hcenter⟩))] + rfl + exact (hc (by simp only [spatialSiteCoefficient, hz, mul_zero])).elim + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem vectorSpatialSiteApprox_error {D I J : Type*} + [Fintype D] [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : D → Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] + (hp : ∀ d, integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ pivotFullImage A (B d)) + (f : D → ((Unit ⊕ I) → ℝ) → ℝ) {K : ℝ≥0} (hf : ∀ d, LipschitzWith K (f d)) + (H : D → ℝ) (mass : D → ((Unit ⊕ I) → ℤ) → ℝ) + {G C E b r : ℝ} (hG : 0 ≤ G) (hC : 0 ≤ C) (hE : 0 ≤ E) (hb : 0 < b) (hr : 0 < r) + (hi : ∀ d, ((pivotFullImage A (B d)).toAddSubgroup.index : ℝ) ≤ G) + (hcap : ∀ d y, |f d y| ≤ C) + (hmass : ∀ d v, |mass d v - maskedIntegerImageDensity A (B d) (fun _ => H d) (f d) v| ≤ E) + (v : D → (Unit ⊕ I) → ℤ) + (hv : ∀ d i, |((spatialStar (v d) i : ℤ) : ℝ) / H d| ≤ b) : + ‖((∏ d, mass d (v d) : ℝ) : ℂ) - + ∏ d, spatialSiteApprox A (B d) m (f d) (H d) b r (v d)‖ ≤ + Fintype.card D * (E + 4*G*K*r) * (1 + G*C + E)^Fintype.card D := by + have hGC := mul_nonneg hG hC + have hcapmass (d : D) : ‖(mass d (v d) : ℂ)‖ ≤ 1 + G*C + E := by + rw [Complex.norm_real, Real.norm_eq_abs] + have hw := maskedIntegerImageDensity_abs_le A (B d) (fun _ => H d) (f d) hC (hi d) (hcap d) (v d) + have ht := abs_add_le + (mass d (v d) - maskedIntegerImageDensity A (B d) (fun _ => H d) (f d) (v d)) + (maskedIntegerImageDensity A (B d) (fun _ => H d) (f d) (v d)) + rw [sub_add_cancel] at ht + linarith [hmass d (v d)] + have hdiff (d : D) : ‖(mass d (v d) : ℂ) - + spatialSiteApprox A (B d) m (f d) (H d) b r (v d)‖ ≤ E + 4*G*K*r := by + have h₁ : ‖(mass d (v d) : ℂ) - + (maskedIntegerImageDensity A (B d) (fun _ => H d) (f d) (v d) : ℂ)‖ ≤ E := by + simpa only [← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using hmass d (v d) + have h₂ := spatialSiteApprox_error A (B d) m (hp d) (f d) (hf d) (hi d) hb hr (H d) (v d) (hv d) + apply le_trans _ (add_le_add h₁ h₂) + simp only [← dist_eq_norm] + exact dist_triangle _ _ _ + have h := norm_finset_prod_sub_prod_le Finset.univ + (fun d => (mass d (v d) : ℂ)) + (fun d => spatialSiteApprox A (B d) m (f d) (H d) b r (v d)) + (show 1 ≤ 1 + G*C + E by linarith) (show 0 ≤ E + 4*G*K*r by positivity) + (fun d _ => hcapmass d) + (fun d _ => (spatialSiteApprox_norm_le A (B d) m (f d) (H d) hb hr + (hi d) (hcap d) (v d) (hv d)).trans (by linarith)) (fun d _ => hdiff d) + simpa only [Complex.ofReal_prod, Finset.card_univ] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem spatialSiteApprox_remesh {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] + (hp : integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ pivotFullImage A B) + (f : ((Unit ⊕ I) → ℝ) → ℝ) {K : ℝ≥0} (hf : LipschitzWith K f) + (H : ℝ) {G b r r' : ℝ} + (hi : ((pivotFullImage A B).toAddSubgroup.index : ℝ) ≤ G) + (hb : 0 < b) (hr : 0 < r) (hr' : 0 < r') + (v : (Unit ⊕ I) → ℤ) (hv : ∀ i, |((spatialStar v i : ℤ) : ℝ) / H| ≤ b) : + ‖spatialSiteApprox A B m f H b r v - spatialSiteApprox A B m f H b r' v‖ ≤ + 4 * G * K * (r + r') := by + have he := spatialSiteApprox_error A B m hp f hf hi hb hr H v hv + have he' := spatialSiteApprox_error A B m hp f hf hi hb hr' H v hv + calc + _ ≤ ‖spatialSiteApprox A B m f H b r v - + (maskedIntegerImageDensity A B (fun _ => H) f v : ℂ)‖ + + ‖(maskedIntegerImageDensity A B (fun _ => H) f v : ℂ) - + spatialSiteApprox A B m f H b r' v‖ := by + simp only [← dist_eq_norm] + exact dist_triangle _ _ _ + _ ≤ 4 * G * K * r + 4 * G * K * r' := by + rw [norm_sub_rev (spatialSiteApprox A B m f H b r v)] + exact add_le_add he he' + _ = _ := by ring + +theorem vectorSpatialSiteApprox_remesh {X I J : Type*} + [Fintype X] [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : X → Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] + (hp : ∀ x, integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ pivotFullImage A (B x)) + (f : X → ((Unit ⊕ I) → ℝ) → ℝ) {K : ℝ≥0} (hf : ∀ x, LipschitzWith K (f x)) + (H : X → ℝ) {G C b r r' : ℝ} (hG : 0 ≤ G) (hC : 0 ≤ C) + (hi : ∀ x, ((pivotFullImage A (B x)).toAddSubgroup.index : ℝ) ≤ G) + (hcap : ∀ x y, |f x y| ≤ C) (hb : 0 < b) (hr : 0 < r) (hr' : 0 < r') + (v : X → (Unit ⊕ I) → ℤ) + (hv : ∀ x i, |((spatialStar (v x) i : ℤ) : ℝ) / H x| ≤ b) : + ‖(∏ x, spatialSiteApprox A (B x) m (f x) (H x) b r (v x)) - + ∏ x, spatialSiteApprox A (B x) m (f x) (H x) b r' (v x)‖ ≤ + Fintype.card X * (4 * G * K * (r + r')) * (1 + G * C)^Fintype.card X := by + have hGC := mul_nonneg hG hC + have h := norm_finset_prod_sub_prod_le Finset.univ + (fun x => spatialSiteApprox A (B x) m (f x) (H x) b r (v x)) + (fun x => spatialSiteApprox A (B x) m (f x) (H x) b r' (v x)) + (show 1 ≤ 1 + G * C by linarith) + (show 0 ≤ 4 * G * K * (r + r') by positivity) + (fun x _ => (spatialSiteApprox_norm_le A (B x) m (f x) (H x) hb hr + (hi x) (hcap x) (v x) (hv x)).trans (by linarith)) + (fun x _ => (spatialSiteApprox_norm_le A (B x) m (f x) (H x) hb hr' + (hi x) (hcap x) (v x) (hv x)).trans (by linarith)) + (fun x _ => spatialSiteApprox_remesh A (B x) m (hp x) (f x) (hf x) (H x) + (hi x) hb hr hr' (v x) (hv x)) + simpa only [Finset.card_univ] using h + +theorem weightedSpatialSiteApprox_remesh {X I J : Type*} + [Fintype X] [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : X → Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] + (hp : ∀ x, integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ pivotFullImage A (B x)) + (f : X → ((Unit ⊕ I) → ℝ) → ℝ) {K : ℝ≥0} (hf : ∀ x, LipschitzWith K (f x)) + (H : X → ℝ) {G C b r r' : ℝ} (hG : 0 ≤ G) (hC : 0 ≤ C) + (hi : ∀ x, ((pivotFullImage A (B x)).toAddSubgroup.index : ℝ) ≤ G) + (hcap : ∀ x y, |f x y| ≤ C) (hb : 0 < b) (hr : 0 < r) (hr' : 0 < r') + (window : Finset (X → (Unit ⊕ I) → ℤ)) + (weight : (X → (Unit ⊕ I) → ℤ) → ℝ) + (test : (X → (Unit ⊕ I) → ℤ) → ℂ) + (hweight : ∀ v ∈ window, 0 ≤ weight v) (htest : ∀ v ∈ window, ‖test v‖ ≤ 1) + (hwindow : ∀ v ∈ window, ∀ x i, |((spatialStar (v x) i : ℤ) : ℝ) / H x| ≤ b) : + ‖(𝔼 v ∈ window, (weight v : ℂ) * + (∏ x, spatialSiteApprox A (B x) m (f x) (H x) b r (v x)) * test v) - + (𝔼 v ∈ window, (weight v : ℂ) * + (∏ x, spatialSiteApprox A (B x) m (f x) (H x) b r' (v x)) * test v)‖ ≤ + (Fintype.card X * (4 * G * K * (r + r')) * (1 + G * C)^Fintype.card X) * + (𝔼 v ∈ window, weight v) := by + apply norm_weighted_complex_mean_sub_le window weight _ _ test hweight htest + intro v hv + exact vectorSpatialSiteApprox_remesh A B m hp f hf H hG hC hi hcap hb hr hr' v (hwindow v hv) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem spatialSiteApprox_shift {I J : Type*} + [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] + (hp : integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ pivotFullImage A B) + (f : ((Unit ⊕ I) → ℝ) → ℝ) {K : ℝ≥0} (hf : LipschitzWith K f) + (H : ℝ) {G b r ε : ℝ} + (hi : ((pivotFullImage A B).toAddSubgroup.index : ℝ) ≤ G) + (hb : 0 < b) (hr : 0 < r) + (v s : (Unit ⊕ I) → ℤ) (hs : s ∈ pivotFullImage A B) + (hsize : ‖fun i => (s i : ℝ) / H‖ ≤ ε) + (hv : ∀ i, |((spatialStar v i : ℤ) : ℝ) / H| ≤ b) + (hvs : ∀ i, |((spatialStar (v + s) i : ℤ) : ℝ) / H| ≤ b) : + ‖spatialSiteApprox A B m f H b r (v + s) - spatialSiteApprox A B m f H b r v‖ ≤ + G * K * (8 * r + ε) := by + have hG : 0 ≤ G := (Nat.cast_nonneg _).trans hi + have hleft := spatialSiteApprox_error A B m hp f hf hi hb hr H (v + s) hvs + have hright := spatialSiteApprox_error A B m hp f hf hi hb hr H v hv + have hmove := (maskedIntegerImageDensity_shift_error A B (fun _ => H) f hf s hs hi v).trans + (mul_le_mul_of_nonneg_left hsize (mul_nonneg hG K.coe_nonneg)) + let density := fun w => (maskedIntegerImageDensity A B (fun _ => H) f w : ℂ) + have hmiddle : ‖density (v + s) - density v‖ ≤ G * K * ε := by + simpa only [density, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using hmove + calc + _ ≤ ‖spatialSiteApprox A B m f H b r (v + s) - density (v + s)‖ + + ‖density (v + s) - spatialSiteApprox A B m f H b r v‖ := + norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ 4 * G * K * r + (G * K * ε + 4 * G * K * r) := by + apply add_le_add + · rw [norm_sub_rev] + exact hleft + · exact (norm_sub_le_norm_sub_add_norm_sub _ (density v) _).trans + (add_le_add hmiddle hright) + _ = _ := by ring + +theorem vectorSpatialSiteApprox_shift {X I J : Type*} + [Fintype X] [Fintype I] [DecidableEq I] [Fintype J] + (A : Matrix (Unit ⊕ I) (Unit ⊕ I) ℤ) (B : X → Matrix (Unit ⊕ I) J ℤ) + (m : ℕ) [NeZero m] + (hp : ∀ x, integerScalarLattice (Unit ⊕ I) (m : ℤ) ≤ pivotFullImage A (B x)) + (f : X → ((Unit ⊕ I) → ℝ) → ℝ) {K : ℝ≥0} (hf : ∀ x, LipschitzWith K (f x)) + (H : X → ℝ) {G C b r ε : ℝ} (hG : 0 ≤ G) (hC : 0 ≤ C) (hε : 0 ≤ ε) + (hi : ∀ x, ((pivotFullImage A (B x)).toAddSubgroup.index : ℝ) ≤ G) + (hcap : ∀ x y, |f x y| ≤ C) (hb : 0 < b) (hr : 0 < r) + (v s : X → (Unit ⊕ I) → ℤ) + (hs : ∀ x, s x ∈ pivotFullImage A (B x)) + (hsize : ∀ x, ‖fun i => (s x i : ℝ) / H x‖ ≤ ε) + (hv : ∀ x i, |((spatialStar (v x) i : ℤ) : ℝ) / H x| ≤ b) + (hvs : ∀ x i, |((spatialStar (v x + s x) i : ℤ) : ℝ) / H x| ≤ b) : + ‖(∏ x, spatialSiteApprox A (B x) m (f x) (H x) b r (v x + s x)) - + ∏ x, spatialSiteApprox A (B x) m (f x) (H x) b r (v x)‖ ≤ + Fintype.card X * (G * K * (8 * r + ε)) * (1 + G * C)^Fintype.card X := by + have hGC := mul_nonneg hG hC + have h := norm_finset_prod_sub_prod_le Finset.univ + (fun x => spatialSiteApprox A (B x) m (f x) (H x) b r (v x + s x)) + (fun x => spatialSiteApprox A (B x) m (f x) (H x) b r (v x)) + (show 1 ≤ 1 + G * C by linarith) + (show 0 ≤ G * K * (8 * r + ε) by positivity) + (fun x _ => (spatialSiteApprox_norm_le A (B x) m (f x) (H x) hb hr + (hi x) (hcap x) (v x + s x) (hvs x)).trans (by linarith)) + (fun x _ => (spatialSiteApprox_norm_le A (B x) m (f x) (H x) hb hr + (hi x) (hcap x) (v x) (hv x)).trans (by linarith)) + (fun x _ => spatialSiteApprox_shift A (B x) m (hp x) (f x) (hf x) (H x) + (hi x) hb hr (v x) (s x) (hs x) (hsize x) (hv x) (hvs x)) + simpa only [Finset.card_univ] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialStarCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialStarCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..a596010decea083b883a2ad9eb878a84249aa06e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialStarCoordinates.lean @@ -0,0 +1,78 @@ +import Mathlib.Analysis.Normed.Group.Constructions +import Mathlib.Topology.MetricSpace.Lipschitz +import OAI.Combinatorics.Progressions.Lattices.ResidueRefinedPeriod + +namespace OAI + +section + +namespace Erdos3 + +def spatialStar {I R : Type*} [Add R] (v : (Unit ⊕ I) → R) : (Unit ⊕ I) → R := + Sum.elim (fun _ => v (.inl ())) (fun i => v (.inl ()) + v (.inr i)) + +def spatialUnstar {I R : Type*} [Sub R] (v : (Unit ⊕ I) → R) : (Unit ⊕ I) → R := + Sum.elim (fun _ => v (.inl ())) (fun i => v (.inr i) - v (.inl ())) + +theorem spatialUnstar_star {I R : Type*} [AddCommGroup R] (v : (Unit ⊕ I) → R) : + spatialUnstar (spatialStar v) = v := by + funext i + cases i with + | inl i => cases i; rfl + | inr i => simp [spatialUnstar, spatialStar] + +theorem spatialStar_unstar {I R : Type*} [AddCommGroup R] (v : (Unit ⊕ I) → R) : + spatialStar (spatialUnstar v) = v := by + funext i + cases i with + | inl i => cases i; rfl + | inr i => simp [spatialUnstar, spatialStar] + +theorem spatialUnstar_lipschitz (I : Type*) [Fintype I] : + LipschitzWith 2 (spatialUnstar (I := I) (R := ℝ)) := by + apply LipschitzWith.of_dist_le_mul + intro v w + apply (dist_pi_le_iff (by positivity)).mpr + intro i + cases i with + | inl i => + have h := dist_le_pi_dist v w (.inl ()) + change dist (v (.inl ())) (w (.inl ())) ≤ _ + norm_num only [NNReal.coe_ofNat] + linarith [dist_nonneg (x := v) (y := w)] + | inr i => + have h := dist_sub_sub_le (v (.inr i)) (v (.inl ())) (w (.inr i)) (w (.inl ())) + have h1 := dist_le_pi_dist v w (.inr i) + have h0 := dist_le_pi_dist v w (.inl ()) + change dist (v (.inr i) - v (.inl ())) (w (.inr i) - w (.inl ())) ≤ _ + norm_num only [NNReal.coe_ofNat] + linarith + +theorem spatialUnstar_scaled_star {I : Type*} (v : (Unit ⊕ I) → ℤ) (H : ℝ) : + spatialUnstar (fun i => ((spatialStar v i : ℤ) : ℝ) / H) = fun i => (v i : ℝ) / H := by + funext i + cases i with + | inl i => cases i; rfl + | inr i => simp [spatialUnstar, spatialStar, Int.cast_add, add_div] + +theorem spatialUnstar_residue_star {I : Type*} (v : (Unit ⊕ I) → ℤ) (m : ℕ) : + spatialUnstar (fun i => ((spatialStar v i : ℤ) : ZMod m)) = integerResidueMap (Unit ⊕ I) m v := by + funext i + cases i with + | inl i => cases i; rfl + | inr i => simp [spatialUnstar, spatialStar, integerResidueMap] + +def spatialStarVertex {I : Type*} : (Unit ⊕ I) → Finset I := + Sum.elim (fun _ => ∅) (fun i => {i}) + +theorem spatialStar_vertex {I R : Type*} [AddCommMonoid R] (v : (Unit ⊕ I) → R) (i : Unit ⊕ I) : + spatialStar v i = v (.inl ()) + ∑ j ∈ spatialStarVertex i, v (.inr j) := by + cases i with + | inl i => cases i; simp [spatialStar, spatialStarVertex] + | inr i => simp [spatialStar, spatialStarVertex] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialTupleErrorBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialTupleErrorBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..7462db7873eccc3ad998a337d9d2a5dc637a8f93 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialTupleErrorBudget.lean @@ -0,0 +1,205 @@ +import OAI.Combinatorics.Progressions.Estimates.InactiveShortLogBounds + +namespace OAI + +section + +namespace Erdos3 + +theorem twoTermErrorWidth_spec {B ε : ℝ} (hB : 0 ≤ B) (hε : 0 < ε) : + 0 < twoTermErrorWidth B ε ∧ twoTermErrorWidth B ε ≤ 1 ∧ + B * twoTermErrorWidth B ε ≤ ε / 2 := by + have hden : 0 < 2 * (1 + B) := by positivity + refine ⟨lt_min zero_lt_one (div_pos hε hden), min_le_left _ _, ?_⟩ + calc + _ ≤ B * (ε / (2 * (1 + B))) := mul_le_mul_of_nonneg_left (min_le_right _ _) hB + _ ≤ ε / 2 := by + rw [← mul_div_assoc] + apply (div_le_iff₀ hden).mpr + nlinarith + +noncomputable def spatialTupleTolerance (n : ℕ) (G V ε : ℝ) : ℝ := + min (1 / 4) (ε / (2 * (n + 1) * (2 + G) ^ n * (1 + V))) + +theorem spatialTupleTolerance_spec (n : ℕ) {G V ε : ℝ} + (hG : 0 ≤ G) (hV : 0 ≤ V) (hε : 0 < ε) : + 0 < spatialTupleTolerance n G V ε ∧ spatialTupleTolerance n G V ε ≤ 1 / 4 ∧ + spatialTupleTolerance n G V ε * (2 * (n + 1) * (2 + G) ^ n * (1 + V)) ≤ ε := by + have hden : 0 < 2 * (n + 1 : ℝ) * (2 + G) ^ n * (1 + V) := by positivity + refine ⟨lt_min (by norm_num) (div_pos hε hden), min_le_left _ _, ?_⟩ + exact (le_div_iff₀ hden).mp (min_le_right _ _) + +theorem spatialTupleErrorChoices (n : ℕ) {G V B ε : ℝ} + (hG : 0 ≤ G) (hV : 0 ≤ V) (hB : 0 ≤ B) (hε : 0 < ε) : + let t := spatialTupleTolerance n G V ε + let ξ := twoTermErrorWidth B t + 0 < ξ ∧ ξ ≤ 1 ∧ + ∀ {A K T Q D : ℝ}, 0 ≤ A → 0 ≤ K → 0 ≤ T → 0 ≤ Q → 0 ≤ D → + let δ := twoTermErrorWidth K t + let mesh := δ / 4 + let ρ := twoTermErrorResolution T A t + Q / ε + D / δ + 0 < δ ∧ δ ≤ 1 ∧ 0 < mesh ∧ 0 < ρ ∧ T ≤ ρ ∧ D ≤ δ * ρ ∧ Q / ρ ≤ ε ∧ + ∀ {g v : ℝ}, 0 ≤ g → g ≤ G → 0 ≤ v → v ≤ V → + let e := A / ρ + B * ξ + K * δ + n * (e + 4 * K * mesh) * (1 + g + e) ^ n * v ≤ ε := by + intro t ξ + have ht := spatialTupleTolerance_spec n hG hV hε + have ht0 : 0 < t := ht.1 + have hξ := twoTermErrorWidth_spec hB ht.1 + have hξ0 : 0 < ξ := hξ.1 + refine ⟨hξ.1, hξ.2.1, ?_⟩ + intro A K T Q D hA hK hT hQ hD δ mesh ρ + have hδ := twoTermErrorWidth_spec hK ht.1 + have hδ0 : 0 < δ := hδ.1 + have hmesh0 : 0 < mesh := div_pos hδ0 (by norm_num) + have hbase := twoTermErrorChoices_spec hT hA hB ht.1 + have hQε : 0 ≤ Q / ε := div_nonneg hQ hε.le + have hDδ : 0 ≤ D / δ := div_nonneg hD hδ.1.le + have hρbase : twoTermErrorResolution T A t ≤ ρ := by + dsimp [ρ] + linarith + have hρ : 0 < ρ := hbase.1.trans_le hρbase + have hmove : D ≤ δ * ρ := by + have hdiv : D / δ ≤ ρ := by dsimp [ρ]; linarith [hbase.1] + have h := (div_le_iff₀ hδ.1).mp hdiv + nlinarith + have hquad : Q / ρ ≤ ε := by + have hdiv : Q / ε ≤ ρ := by dsimp [ρ]; linarith [hbase.1] + have h := (div_le_iff₀ hε).mp hdiv + apply (div_le_iff₀ hρ).mpr + nlinarith + refine ⟨hδ.1, hδ.2.1, div_pos hδ.1 (by norm_num), hρ, + hbase.2.1.trans hρbase, hmove, hquad, ?_⟩ + intro g v hg hgG hv hvV e + have hpair : A / ρ + B * ξ ≤ t := + (add_le_add (div_le_div_of_nonneg_left hA hbase.1 hρbase) le_rfl).trans hbase.2.2.2.2 + have he0 : 0 ≤ e := by dsimp [e]; positivity + have he1 : e ≤ 1 := by dsimp [e]; linarith [hδ.2.2, ht.2.1] + have hinner : e + 4 * K * mesh ≤ 2 * t := by + dsimp [e, mesh] + linarith [hδ.2.2] + have hpower : (1 + g + e) ^ n ≤ (2 + G) ^ n := + pow_le_pow_left₀ (by positivity) (by linarith) n + calc + _ ≤ n * (2 * t) * (2 + G) ^ n * V := by gcongr + _ = 2 * t * (2 + G) ^ n * (n * V) := by ring + _ ≤ 2 * t * (2 + G) ^ n * ((n + 1) * (1 + V)) := + mul_le_mul_of_nonneg_left (by nlinarith [Nat.cast_nonneg (α := ℝ) n]) (by positivity) + _ = t * (2 * (n + 1) * (2 + G) ^ n * (1 + V)) := by ring + _ ≤ ε := ht.2.2 + +end Erdos3 + +end + +section + +namespace Erdos3 + +def spatialTupleToleranceLog {A : Type*} [Semiring A] (P : A) : A := P ^ 2 + 5 * P + 6 + +theorem spatialTupleToleranceLog_nonneg {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ spatialTupleToleranceLog P := by unfold spatialTupleToleranceLog; positivity + +theorem spatialTupleTolerance_inv_bound (n : ℕ) {G V ε P : ℝ} + (hG : 0 ≤ G) (hV : 0 ≤ V) (hε : 0 < ε) (hP : 0 ≤ P) + (hn : (n : ℝ) ≤ P) (hGP : G ≤ Real.exp P) (hVP : V ≤ Real.exp P) + (hεP : ε⁻¹ ≤ Real.exp P) : + (spatialTupleTolerance n G V ε)⁻¹ ≤ Real.exp (spatialTupleToleranceLog P) := by + have hone : 1 ≤ Real.exp P := Real.one_le_exp hP + have hthree : (3 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have hbase : 2 + G ≤ Real.exp (P + 2) := by + calc + _ ≤ 3 * Real.exp P := by linarith + _ ≤ Real.exp P * Real.exp 2 := by nlinarith [Real.exp_pos P] + _ = _ := (Real.exp_add _ _).symm + have hpower := pow_le_exp_mul_of_le_exp (by positivity : 0 ≤ 2 + G) hbase + (by positivity : 0 ≤ P + 2) n hn + have hn1 : (n : ℝ) + 1 ≤ Real.exp P := by linarith [Real.add_one_le_exp P] + have hV1 : 1 + V ≤ Real.exp (P + 1) := one_add_le_exp_succ hP hVP + have hden : 2 * (n + 1 : ℝ) * (2 + G) ^ n * (1 + V) ≤ + Real.exp (P ^ 2 + 4 * P + 3) := by + calc + _ ≤ Real.exp 2 * Real.exp P * Real.exp (P * (P + 2)) * Real.exp (P + 1) := by + gcongr + linarith + _ = _ := by simp only [← Real.exp_add]; congr 1; ring + unfold spatialTupleTolerance + apply inv_min_le_of_inv_le + · norm_num only [one_div, inv_inv] + have h := Real.add_one_le_exp (spatialTupleToleranceLog P) + unfold spatialTupleToleranceLog at * + nlinarith + · rw [inv_div, div_eq_mul_inv] + calc + _ ≤ Real.exp (P ^ 2 + 4 * P + 3) * Real.exp P := by gcongr + _ = Real.exp (P ^ 2 + 5 * P + 3) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by unfold spatialTupleToleranceLog; linarith) + +theorem spatialTupleEarlyWidth_inv_bound (n : ℕ) {G V B ε P : ℝ} + (hG : 0 ≤ G) (hV : 0 ≤ V) (hB : 0 ≤ B) (hε : 0 < ε) (hP : 0 ≤ P) + (hn : (n : ℝ) ≤ P) (hGP : G ≤ Real.exp P) (hVP : V ≤ Real.exp P) + (hBP : B ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) : + (twoTermErrorWidth B (spatialTupleTolerance n G V ε))⁻¹ ≤ + Real.exp (2 * (P + spatialTupleToleranceLog P) + 4) := by + let R := P + spatialTupleToleranceLog P + have hT := spatialTupleToleranceLog_nonneg hP + have hR : 0 ≤ R := add_nonneg hP hT + have hPR : P ≤ R := le_add_of_nonneg_right hT + have hTR : spatialTupleToleranceLog P ≤ R := le_add_of_nonneg_left hP + have ht := (spatialTupleTolerance_spec n hG hV hε).1 + have hit := (spatialTupleTolerance_inv_bound n hG hV hε hP hn hGP hVP hεP).trans + (Real.exp_le_exp.mpr hTR) + exact (twoTermErrorChoices_log_bounds (A := 0) (T := 0) (by norm_num) hB ht hR + (Real.exp_nonneg R) (Real.exp_nonneg R) (hBP.trans (Real.exp_le_exp.mpr hPR)) hit).2 + +theorem spatialTupleLateParameters_bound {A K T Q D t ε P : ℝ} + (hA : 0 ≤ A) (hK : 0 ≤ K) (ht : 0 < t) (hε : 0 < ε) (hP : 0 ≤ P) + (hAP : A ≤ Real.exp P) (hKP : K ≤ Real.exp P) (hTP : T ≤ Real.exp P) + (hQP : Q ≤ Real.exp P) (hDP : D ≤ Real.exp P) + (htP : t⁻¹ ≤ Real.exp P) (hεP : ε⁻¹ ≤ Real.exp P) : + let δ := twoTermErrorWidth K t + let mesh := δ / 4 + let ρ := twoTermErrorResolution T A t + Q / ε + D / δ + δ⁻¹ ≤ Real.exp (3 * P + 8) ∧ mesh⁻¹ ≤ Real.exp (3 * P + 8) ∧ + ρ ≤ Real.exp (3 * P + 8) := by + intro δ mesh ρ + obtain ⟨hres, hδ⟩ := twoTermErrorChoices_log_bounds hA hK ht hP hTP hAP hKP htP + have hδ0 := (twoTermErrorWidth_spec hK ht).1 + have hmesh : mesh⁻¹ ≤ Real.exp (2 * P + 8) := by + dsimp [mesh] + rw [inv_div, div_eq_mul_inv] + calc + _ ≤ Real.exp 4 * Real.exp (2 * P + 4) := by + apply mul_le_mul + · linarith [Real.add_one_le_exp (4 : ℝ)] + · exact hδ + · exact inv_nonneg.mpr hδ0.le + · exact (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hquad : Q / ε ≤ Real.exp (2 * P) := by + rw [div_eq_mul_inv] + calc + _ ≤ Real.exp P * Real.exp P := mul_le_mul hQP hεP (inv_nonneg.mpr hε.le) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hmove : D / δ ≤ Real.exp (3 * P + 4) := by + rw [div_eq_mul_inv] + calc + _ ≤ Real.exp P * Real.exp (2 * P + 4) := + mul_le_mul hDP hδ (inv_nonneg.mpr hδ0.le) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + refine ⟨hδ.trans (Real.exp_le_exp.mpr (by linarith)), + hmesh.trans (Real.exp_le_exp.mpr (by linarith)), ?_⟩ + have hres' := hres.trans (Real.exp_le_exp.mpr (show 2 * P + 4 ≤ 3 * P + 4 by linarith)) + have hquad' := hquad.trans (Real.exp_le_exp.mpr (show 2 * P ≤ 3 * P + 4 by linarith)) + calc + ρ ≤ 3 * Real.exp (3 * P + 4) := by dsimp [ρ]; linarith + _ ≤ Real.exp 4 * Real.exp (3 * P + 4) := + mul_le_mul_of_nonneg_right (by linarith [Real.add_one_le_exp (4 : ℝ)]) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SpatialTwoBlockEquiv.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialTwoBlockEquiv.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2368d6a13b4f20e0fb377585af1545e664a3eb3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SpatialTwoBlockEquiv.lean @@ -0,0 +1,52 @@ +import OAI.Combinatorics.Progressions.Linear.ContainedKernelPhysicalDisplacement +import OAI.Combinatorics.Progressions.Linear.PreparedSpatialKernelBlocks + +namespace OAI + +section + +namespace Erdos3 +open scoped Classical + +def twoKernelCopies (X : Type*) : X ⊕ X ≃ Fin 2 × X where + toFun := Sum.elim (fun x => (0, x)) (fun x => (1, x)) + invFun z := if z.1 = 0 then Sum.inl z.2 else Sum.inr z.2 + left_inv := by intro z; cases z <;> simp + right_inv := by rintro ⟨i, x⟩; fin_cases i <;> simp + +def twoKernelEmbedding {X G : Type*} (blocks : Fin 2 × X ↪ G) : X ⊕ X ↪ G := + (twoKernelCopies X).toEmbedding.trans blocks + +abbrev SpatialKernelRemainder {X G : Type*} (blocks : Fin 2 × X ↪ G) := + {g : G // g ∉ Set.range (twoKernelEmbedding blocks)} + +noncomputable def spatialTwoBlockEquiv {X G : Type*} (blocks : Fin 2 × X ↪ G) : + G ≃ X ⊕ (X ⊕ SpatialKernelRemainder blocks) := + ((Equiv.sumCongr (Equiv.ofInjective (twoKernelEmbedding blocks) + (twoKernelEmbedding blocks).injective) (Equiv.refl _)).trans + (Equiv.Set.sumCompl (Set.range (twoKernelEmbedding blocks)))).symm.trans + (Equiv.sumAssoc X X (SpatialKernelRemainder blocks)) + +@[simp] theorem spatialTwoBlockEquiv_symm_first {X G : Type*} + (blocks : Fin 2 × X ↪ G) (x : X) : + (spatialTwoBlockEquiv blocks).symm (Sum.inl x) = blocks (0, x) := rfl + +@[simp] theorem spatialTwoBlockEquiv_symm_second {X G : Type*} + (blocks : Fin 2 × X ↪ G) (x : X) : + (spatialTwoBlockEquiv blocks).symm (Sum.inr (Sum.inl x)) = blocks (1, x) := rfl + +theorem fixedSpatialKernelBlock_first {X G : Type*} [Fintype X] [Fintype G] + (blocks : Fin 2 × X ↪ G) (W L : ℝ) (z : Option G × X → ℝ) (x i : X) : + fixedSpatialKernelBlock (spatialTwoBlockEquiv blocks) W L z false x i = + (L / (1 + W)) * z (some (blocks (0, i)), x) := rfl + +theorem fixedSpatialKernelBlock_second {X G : Type*} [Fintype X] [Fintype G] + (blocks : Fin 2 × X ↪ G) (W L : ℝ) (z : Option G × X → ℝ) (x i : X) : + fixedSpatialKernelBlock (spatialTwoBlockEquiv blocks) W L z true x i = + (L / (1 + W)) * z (some (blocks (1, i)), x) := rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SplitFreeCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SplitFreeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..68778c367ff3684e10083aafad83c6bb8aa430c9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SplitFreeCoordinates.lean @@ -0,0 +1,55 @@ +import OAI.Combinatorics.Progressions.Probability.DensityMixtureAELaw +import OAI.Combinatorics.Progressions.Probability.NormalizedJetDensitySupport + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +noncomputable def splitFreeCoordinates (I J N : Type*) [Fintype I] [Fintype J] [Fintype N] : + ((J ⊕ N → ℝ) × (I → ℝ)) ≃ᵐ (((J → ℝ) × (I → ℝ)) × (N → ℝ)) := + ((MeasurableEquiv.sumPiEquivProdPi (fun _ : J ⊕ N => ℝ)).prodCongr + (MeasurableEquiv.refl (I → ℝ))).trans + (MeasurableEquiv.prodAssoc.trans + (((MeasurableEquiv.refl (J → ℝ)).prodCongr MeasurableEquiv.prodComm).trans + MeasurableEquiv.prodAssoc.symm)) + +theorem splitFreeCoordinates_apply {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] + (p : (J ⊕ N → ℝ) × (I → ℝ)) : + splitFreeCoordinates I J N p = (((fun j => p.1 (.inl j)), p.2), fun n => p.1 (.inr n)) := rfl + +theorem splitFreeCoordinates_symm_apply {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] + (p : ((J → ℝ) × (I → ℝ)) × (N → ℝ)) : + (splitFreeCoordinates I J N).symm p = (Sum.elim p.1.1 p.2, p.1.2) := rfl + +theorem splitFreeCoordinates_preserving (I J N : Type*) [Fintype I] [Fintype J] [Fintype N] : + MeasurePreserving (splitFreeCoordinates I J N) volume volume := by + have h₁ := (volume_measurePreserving_sumPiEquivProdPi (fun _ : J ⊕ N => ℝ)).prod + (MeasurePreserving.id (volume : Measure (I → ℝ))) + have h₂ : MeasurePreserving + (MeasurableEquiv.prodAssoc : ((J → ℝ) × (N → ℝ)) × (I → ℝ) ≃ᵐ _) + volume volume := volume_preserving_prodAssoc + have h₃ := (MeasurePreserving.id (volume : Measure (J → ℝ))).prod + (Measure.measurePreserving_swap (μ := (volume : Measure (N → ℝ))) (ν := (volume : Measure (I → ℝ)))) + have h₄ : MeasurePreserving + (MeasurableEquiv.prodAssoc.symm : (J → ℝ) × ((I → ℝ) × (N → ℝ)) ≃ᵐ _) + volume volume := volume_preserving_prodAssoc.symm MeasurableEquiv.prodAssoc + exact h₄.comp (h₃.comp (h₂.comp h₁)) + +theorem splitFreeProfile_measure {I J N : Type*} [Fintype I] [Fintype J] [Fintype N] + (f : (J → ℝ) × (I → ℝ) → ℝ) (g : (N → ℝ) → ℝ) + (hf : Measurable f) (hg : Measurable g) (hf0 : ∀ p, 0 ≤ f p) : + (realDensityMeasure volume (splitFreeProfile f g)).map (splitFreeCoordinates I J N) = + (realDensityMeasure volume f).prod (realDensityMeasure volume g) := by + rw [realDensityMeasure_map_equiv, (splitFreeCoordinates_preserving I J N).map_eq, + binaryDensity_measure volume volume f g hf hg hf0] + rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SquareQuotientHeightTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SquareQuotientHeightTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e4eae9b9fa58e9089811907e413856cebdda432 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SquareQuotientHeightTransport.lean @@ -0,0 +1,116 @@ +import OAI.Combinatorics.Progressions.Estimates.CommonNativeSquareFactors +import OAI.Combinatorics.Progressions.Estimates.ReindexSymbolFactorization +import OAI.Combinatorics.Progressions.Linear.BasisFamilyLogHeight +import OAI.Combinatorics.Progressions.Linear.ReindexQuotientBasis + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +variable {σ ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (Γ : Subgroup F.squareFiltration.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates (F.squareFinBasis b ω (hF 2)) Γ) + (hout : bchSubgroupCoordinates (F.squareFinBasis b ω (hF 2)) Γ ⊆ denominatorGrid N) + +local notation "Q" => F.squareFiltration.topQuotientModel (F.squareFinBasis b ω (hF 2)) + (squareFinWeight ω) (F.squareFinBasis_layers b ω hF) Γ N hN hin hout +local notation "hQ" => F.squareFiltration.topQuotientModel_basis_layers + (F.squareFinBasis b ω (hF 2)) (squareFinWeight ω) (F.squareFinBasis_layers b ω hF) Γ N hN hin hout +local notation "bq" => F.reducedSquareBasis b ω hF +local notation "ωq" => (fun i : ReducedSquareBasisIndex s ω => squareBasisWeight ω (Subtype.val i)) +local notation "hq" => F.reducedSquareBasis_layers b ω hF + +theorem squareTopQuotientModel_factorization_iff (T : σ → ℝ) + (X : F.squareFiltration.quotientTop.RealPolynomialSymbolGroup (fun _ : σ => 1)) + (p : ℝ) (l : ℕ) (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) : + (Q).filtration.SymbolFactorizationIn (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ T X p l W ↔ + F.squareFiltration.quotientTop.SymbolFactorizationIn bq ωq hq T X p l W := by + exact F.squareFiltration.quotientTop.symbolFactorizationIn_iff_of_basis_reindex bq ωq hq + (reducedSquareFinIndexEquiv s ω) (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ + (F.squareTopQuotientModel_basis_reindex b ω hF Γ N hN hin hout) rfl T X p l W + +theorem squareTopQuotientModel_graded_iff + (U : Submodule ℚ F.squareFiltration.quotientTop.AssociatedGraded) : + BasisGradedSubmodule ((Q).filtration.associatedGradedBasis (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ) + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) U ↔ + BasisGradedSubmodule (F.squareFiltration.quotientTop.associatedGradedBasis bq ωq hq) ωq U := by + exact F.squareFiltration.quotientTop.graded_submodule_iff_of_basis_reindex bq ωq hq + (reducedSquareFinIndexEquiv s ω) (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ + (F.squareTopQuotientModel_basis_reindex b ω hF Γ N hN hin hout) rfl U + +theorem squareTopQuotientModel_graded_repr (x : F.squareFiltration.quotientTop.AssociatedGraded) + (i : ReducedSquareBasisIndex s ω) : + ((Q).filtration.associatedGradedBasis (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ).repr x + (reducedSquareFinIndexEquiv s ω i) = + (F.squareFiltration.quotientTop.associatedGradedBasis bq ωq hq).repr x i := by + exact F.squareFiltration.quotientTop.associatedGradedBasis_repr_of_basis_reindex bq ωq hq + (reducedSquareFinIndexEquiv s ω) (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ + (F.squareTopQuotientModel_basis_reindex b ω hF Γ N hN hin hout) rfl x i + +theorem squareTopQuotientModel_top_annihilation_iff + (ξ : (F.squareLieSubalgebra ⧸ F.squareFiltration.layerIdeal (s + 1)) →ₗ[ℚ] ℚ) + (W : LieSubalgebra ℚ F.squareFiltration.quotientTop.AssociatedGraded) : + (∀ x ∈ W, basisGradeProjection ((Q).filtration.associatedGradedBasis (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ) + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) s x = x → + (Q).filtration.gradedFrequency (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ ξ x = 0) ↔ + (∀ x ∈ W, basisGradeProjection (F.squareFiltration.quotientTop.associatedGradedBasis bq ωq hq) + ωq s x = x → F.squareFiltration.quotientTop.gradedFrequency bq ωq hq ξ x = 0) := by + exact F.squareFiltration.quotientTop.graded_top_annihilation_iff_of_basis_reindex bq ωq hq + (reducedSquareFinIndexEquiv s ω) (Q).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) hQ + (F.squareTopQuotientModel_basis_reindex b ω hF Γ N hN hin hout) rfl ξ W + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem squareTopQuotientModel_graded_logHeight + {ι κ L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L (s + 1)) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (Γ : Subgroup F.squareFiltration.Group) (N : ℕ) (hN : 0 < N) + (hin : scaledIntegerGrid N ⊆ bchSubgroupCoordinates (F.squareFinBasis b ω (hF 2)) Γ) + (hout : bchSubgroupCoordinates (F.squareFinBasis b ω (hF 2)) Γ ⊆ denominatorGrid N) + (v : κ → F.squareFiltration.quotientTop.AssociatedGraded) {p : ℝ} + (hheight : BasisFamilyLogHeight + ((F.squareFiltration.topQuotientModel (F.squareFinBasis b ω (hF 2)) + (squareFinWeight ω) (F.squareFinBasis_layers b ω hF) Γ N hN hin hout).filtration.associatedGradedBasis + (F.squareFiltration.topQuotientModel (F.squareFinBasis b ω (hF 2)) + (squareFinWeight ω) (F.squareFinBasis_layers b ω hF) Γ N hN hin hout).basis + (quotientFinWeight (squareFinWeight ω) {i | s + 1 ≤ squareFinWeight ω i}) + (F.squareFiltration.topQuotientModel_basis_layers (F.squareFinBasis b ω (hF 2)) + (squareFinWeight ω) (F.squareFinBasis_layers b ω hF) Γ N hN hin hout)) v p) : + BasisFamilyLogHeight + (F.squareFiltration.quotientTop.associatedGradedBasis + (F.reducedSquareBasis b ω hF) (fun i => squareBasisWeight ω i.val) + (F.reducedSquareBasis_layers b ω hF)) v p := by + intro i j + have heq := F.squareTopQuotientModel_graded_repr b ω hF Γ N hN hin hout (v i) j + exact (congrArg rationalLogHeight heq).symm.le.trans + (hheight i (reducedSquareFinIndexEquiv s ω j)) + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SquareRecoveryCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SquareRecoveryCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..50101363845aceba6195959de1da5a8fdb7739d2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SquareRecoveryCoordinates.lean @@ -0,0 +1,104 @@ +import OAI.Combinatorics.Progressions.Linear.NativeRankQuotientOrbit + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {L : ι → Type*} + [∀ i, LieRing (L i)] [∀ i, LieAlgebra ℚ (L i)] {s : ℕ} {d : ι → ℕ} + (D : ∀ i, RationalFilteredNilmanifold (L i) s (d i)) + +omit [DecidableEq ι] in +theorem realProductFinBasis_repr (x : ℝ ⊗[ℚ] (∀ i, L i)) + (k : Fin (Fintype.card (Σ i, Fin (d i)))) : + let z := (Fintype.equivFin (Σ i, Fin (d i))).symm k + ((pi D).basis.baseChange ℝ).repr x k = + ((D z.1).basis.baseChange ℝ).repr (realificationLieHom (liePiEval z.1) x) z.2 := by + dsimp only + induction x using TensorProduct.inductionOn with + | tmul r x => + simp only [Basis.baseChange_repr_tmul, realificationLieHom_tmul, + productFinBasis_repr D, liePiEval_apply] + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy] + +@[simp] theorem productProjectionHom_pi_symm (g : ∀ i, (D i).RealGroup) (i : ι) : + productProjectionHom D i ((realBCHPiEquiv (fun j => (D j).filtration)).symm g) = g i := + congrFun ((realBCHPiEquiv (fun j => (D j).filtration)).apply_symm_apply g) i + +theorem realProductFinBasis_pi_symm_bound (g : ∀ i, (D i).RealGroup) {R : ℝ} + (hg : ∀ i j, |((D i).basis.baseChange ℝ).repr (g i).coord j| ≤ R) + (k : Fin (Fintype.card (Σ i, Fin (d i)))) : + |((pi D).basis.baseChange ℝ).repr + ((realBCHPiEquiv (fun i => (D i).filtration)).symm g).coord k| ≤ R := by + rw [realProductFinBasis_repr D] + let z := (Fintype.equivFin (Σ i, Fin (d i))).symm k + change |((D z.1).basis.baseChange ℝ).repr + (productProjectionHom D z.1 ((realBCHPiEquiv (fun i => (D i).filtration)).symm g)).coord z.2| ≤ R + rw [productProjectionHom_pi_symm] + exact hg z.1 z.2 + +theorem pi_symm_mem_realLattice (g : ∀ i, (D i).RealGroup) + (hg : ∀ i, g i ∈ (D i).realLattice) : + (realBCHPiEquiv (fun i => (D i).filtration)).symm g ∈ (pi D).realLattice := by + apply (realBCHPiEquiv_mem_lattice (fun i => (D i).filtration) + (fun i => (D i).lattice) _).mpr + intro i + rw [MulEquiv.apply_symm_apply] + change g i ∈ (D i).realLattice + exact hg i + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +variable {L κ : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype κ] {s d : ℕ} + (D : RationalFilteredNilmanifold L s d) + +theorem squarePairMap_matrix_logHeight (b : Basis κ ℚ L) (w : κ → ℕ) + (h : D.filtration.layer 2 = Submodule.span ℚ (b '' {i | 2 ≤ w i})) + {p : ℝ} (hp : 0 ≤ p) (hb : ∀ i j, rationalLogHeight (D.basis.repr (b j) i) ≤ p) + (i : Fin (Fintype.card (Σ _ : Bool, Fin d))) + (j : Fin (Fintype.card (κ ⊕ {i // 2 ≤ w i}))) : + rationalLogHeight ((pi (fun _ : Bool => D)).basis.repr + (D.filtration.squarePairMap (D.filtration.squareFinBasis b w h j)) i) ≤ p + 1 := by + rw [productFinBasis_repr] + let z := (Fintype.equivFin (Σ _ : Bool, Fin d)).symm i + have H := D.filtration.squareFinBasis_projection_height D.basis b w h + (one_le_ceil_exp p) (fun i j => rationalHeightLE_ceil_exp (hb i j)) j z.2 + apply rationalLogHeight_le_of_height _ (ceil_exp_le_exp_add_one hp) + change RationalHeightLE (D.basis.repr + (D.filtration.squarePairMap (D.filtration.squareFinBasis b w h j) z.1) z.2) _ + cases hz : z.1 + · exact H.2 + · exact H.1 + +omit [Fintype κ] in +theorem squareNormalizer_coordinate_bound (ε : D.RealGroup) {R : ℝ} (hR : 0 ≤ R) + (hε : ∀ i, |(D.basis.baseChange ℝ).repr ε.coord i| ≤ R) + (j : Fin (Fintype.card (Σ _ : Bool, Fin d))) : + |((pi (fun _ : Bool => D)).basis.baseChange ℝ).repr + ((realBCHPiEquiv (fun _ : Bool => D.filtration)).symm + (fun flag => cond flag ε⁻¹ 1)).coord j| ≤ R := by + apply realProductFinBasis_pi_symm_bound + intro flag i + cases flag + · simpa only [Bool.cond_false, coord_one, map_zero, Finsupp.zero_apply, abs_zero] using hR + · simpa only [Bool.cond_true, coord_inv, map_neg, Finsupp.neg_apply, abs_neg] using hε i + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeActionMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeActionMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..1800e9c42ac071499a8f325172bfac54e495481e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeActionMetric.lean @@ -0,0 +1,115 @@ +import OAI.Combinatorics.Progressions.Estimates.SquarefreeQuotientAction + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +theorem nativeMap_dist_le + {L M : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + [TopologicalSpace (ℝ ⊗[ℚ] M)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] M)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M)] [T2Space (ℝ ⊗[ℚ] M)] {s t d e : ℕ} + (D : RationalFilteredNilmanifold L s d) (E : RationalFilteredNilmanifold M t e) + (φ : L →ₗ⁅ℚ⁆ M) + (hlattice : D.lattice ≤ E.lattice.comap (mapOfSteps + (hL := D.filtration.lowerCentralSeries_eq_bot) (hM := E.filtration.lowerCentralSeries_eq_bot) φ)) + {p : ℝ} (hp : 0 ≤ p) (hD : D.GeometryComplexityLE p) (hE : E.GeometryComplexityLE p) + (hφ : ∀ i j, rationalLogHeight (E.basis.repr (φ (D.basis j)) i) ≤ p) + (u v : D.RealGroup) : + letI := D.metricSpace + letI := E.metricSpace + dist (QuotientGroup.mk (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ u) : E.Space) + (QuotientGroup.mk (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ v)) ≤ + Real.exp ((p + 3) ^ 2) * dist (QuotientGroup.mk u : D.Space) (QuotientGroup.mk v) := by + let := D.metricSpace + let := E.metricSpace + let := realificationQuotientMetricSpace D.basis D.lattice D.grid D.grid_pos D.outer_grid + let := realificationQuotientMetricSpace E.basis E.lattice E.grid E.grid_pos E.outer_grid + obtain ⟨K, _, hK, hLip⟩ := exists_realificationMap_quotient_lipschitz_exp_bound + D.basis E.basis φ D.lattice E.lattice hlattice + D.grid E.grid D.grid_pos E.grid_pos D.outer_grid E.outer_grid ⌈Real.exp p⌉₊ + (by linarith : 0 ≤ p + 1) + (by simpa only [Fintype.card_fin] using hD.1.trans (by linarith : p ≤ p + 1)) + (by simpa only [Fintype.card_fin] using hE.1.trans (by linarith : p ≤ p + 1)) + (ceil_exp_le_exp_add_one hp) (fun i j => rationalHeightLE_ceil_exp (hφ i j)) + have hd := hLip.dist_le_mul (QuotientGroup.mk u) (QuotientGroup.mk v) + change dist (QuotientGroup.mk (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ u) : E.Space) + (QuotientGroup.mk (realificationMap (hnil := D.filtration.lowerCentralSeries_eq_bot) + (hM := E.filtration.lowerCentralSeries_eq_bot) φ v)) ≤ + (K : ℝ) * dist (QuotientGroup.mk u : D.Space) (QuotientGroup.mk v) at hd + apply hd.trans + apply mul_le_mul_of_nonneg_right _ dist_nonneg + simpa only [show p + 1 + 2 = p + 3 by ring] using hK + +end Erdos3.RationalFilteredNilmanifold + +end + +section + +namespace Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +open Module NilpotentLieBCHGroup +open scoped TensorProduct NNReal + +variable {σ L : Type*} [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s d : ℕ} {D : RationalFilteredNilmanifold L s d} {bound : σ → ℕ} + (M : D.MultidegreeStructure bound) + +theorem squarefreeFinBasis_permute (p : ℝ) (e : ReplicatedPermutation bound) + (j : Fin (Fintype.card M.SquarefreeBasisIndex)) : + ∃ k, M.filtration.replicatedLiePermute e (M.squarefreeFinBasis p j) = M.squarefreeFinBasis p k := by + obtain ⟨k, hk⟩ := M.squarefreeBasis_permute p (replicatedPermutation bound e) + (replicatedPermutation_block bound e) ((Fintype.equivFin M.SquarefreeBasisIndex).symm j) + refine ⟨Fintype.equivFin M.SquarefreeBasisIndex k, ?_⟩ + simpa only [squarefreeFinBasis, Basis.reindex_apply, Equiv.symm_apply_apply, + MultidegreeLieFiltration.replicatedLiePermute] using hk + +theorem squarefreePermute_coordinate_height (p : ℝ) (e : ReplicatedPermutation bound) + {q : ℝ} (hq : 0 ≤ q) (i j : Fin (Fintype.card M.SquarefreeBasisIndex)) : + rationalLogHeight ((M.squarefreeFinBasis p).repr + (M.filtration.replicatedLiePermute e (M.squarefreeFinBasis p j)) i) ≤ q := by + obtain ⟨k, hk⟩ := M.squarefreeFinBasis_permute p e j + rw [hk] + simp only [Basis.repr_self, Finsupp.single_apply] + split_ifs <;> simpa [rationalLogHeight] using hq + +variable (p : ℝ) (B : ℕ) (hB : 0 < B) (hstable : M.SquarefreeGridStable p B) + [TopologicalSpace (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + [T2Space (ℝ ⊗[ℚ] M.filtration.SquarefreeAlgebra (fun j : ReplicatedIndex bound => j.1))] + +theorem squarefreeSpacePermute_lipschitz {q : ℝ} (hq : 0 ≤ q) + (hE : (M.squarefreeModel p B hB hstable).GeometryComplexityLE q) + (e : ReplicatedPermutation bound) : + letI := (M.squarefreeModel p B hB hstable).metricSpace + LipschitzWith ⟨Real.exp ((q + 3) ^ 2), (Real.exp_pos _).le⟩ + (M.squarefreeSpacePermute p B hB hstable e) := by + let := (M.squarefreeModel p B hB hstable).metricSpace + apply LipschitzWith.of_dist_le_mul + intro x y + induction x using Quotient.inductionOn with + | h x => + induction y using Quotient.inductionOn with + | h y => + exact nativeMap_dist_le (M.squarefreeModel p B hB hstable) (M.squarefreeModel p B hB hstable) + (M.filtration.replicatedLiePermute e).toLieHom + (fun g hg => (M.squarefreeLattice_permute p B hstable (replicatedPermutation bound e) + (replicatedPermutation_block bound e) g).mpr hg) + hq hE hE (M.squarefreePermute_coordinate_height p e hq) x y + +end Erdos3.RationalFilteredNilmanifold.MultidegreeStructure + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeAlgebraCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeAlgebraCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..75ec97125ad55aca48d219e66265f1c30d1b0c0b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeAlgebraCoordinates.lean @@ -0,0 +1,74 @@ +import Mathlib.LinearAlgebra.Dimension.Constructions +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import OAI.Combinatorics.Progressions.Estimates.SquarefreeAdaptedLieAlgebra + +namespace OAI + +section + +namespace Erdos3.MultidegreeLieFiltration + +open scoped BigOperators + +variable {ι σ L : Type*} [Fintype ι] [Fintype σ] [LieRing L] [LieAlgebra ℚ L] + {s : ℕ} {bound : σ → ℕ} (F : MultidegreeLieFiltration σ L s bound) (π : ι → σ) + +noncomputable def squarefreeCoefficientLayer (a : SquarefreeIndex ι) : Submodule ℚ L := by + classical + exact if a.val = 0 then ⊥ else F.layer (blockDegree π a.val) + +theorem mem_squarefreeCoefficientLayer (a : SquarefreeIndex ι) (v : L) : + v ∈ F.squarefreeCoefficientLayer π a ↔ + v ∈ F.layer (blockDegree π a.val) ∧ (a.val = 0 → v = 0) := by + classical + by_cases ha : a.val = 0 <;> simp [squarefreeCoefficientLayer, ha, F.zero_eq_top] + +noncomputable def squarefreeAlgebraEquiv : + F.SquarefreeAlgebra π ≃ₗ[ℚ] ((a : SquarefreeIndex ι) → F.squarefreeCoefficientLayer π a) where + toFun x a := ⟨squarefreePolynomialEquiv x.val a, + (F.mem_squarefreeCoefficientLayer π a _).mpr (x.property a)⟩ + invFun f := ⟨squarefreePolynomialEquiv.symm (fun a => (f a).val), by + intro a + simpa only [LinearEquiv.apply_symm_apply] using + (F.mem_squarefreeCoefficientLayer π a _).mp (f a).property⟩ + left_inv x := by + apply Subtype.ext + exact squarefreePolynomialEquiv.symm_apply_apply x.val + right_inv f := by + ext a + exact congrFun (squarefreePolynomialEquiv.apply_symm_apply (fun b => (f b).val)) a + map_add' x y := by + ext a + exact congrFun (map_add squarefreePolynomialEquiv x.val y.val) a + map_smul' r x := by + ext a + exact congrFun (map_smul squarefreePolynomialEquiv r x.val) a + +theorem squarefreeAlgebraEquiv_apply (x : F.SquarefreeAlgebra π) (a : SquarefreeIndex ι) : + (F.squarefreeAlgebraEquiv π x a).val = squarefreePolynomialEquiv x.val a := rfl + +instance squarefreeAlgebraFiniteDimensional [FiniteDimensional ℚ L] : + FiniteDimensional ℚ (F.SquarefreeAlgebra π) := + FiniteDimensional.of_injective (F.squarefreeAlgebraEquiv π).toLinearMap + (F.squarefreeAlgebraEquiv π).injective + +theorem squarefreeAlgebra_finrank [FiniteDimensional ℚ L] : + Module.finrank ℚ (F.SquarefreeAlgebra π) = + ∑ a : SquarefreeIndex ι, Module.finrank ℚ (F.squarefreeCoefficientLayer π a) := by + rw [(F.squarefreeAlgebraEquiv π).finrank_eq, Module.finrank_pi_fintype] + +theorem squarefreeAlgebra_finrank_le [FiniteDimensional ℚ L] : + Module.finrank ℚ (F.SquarefreeAlgebra π) ≤ + 2 ^ Fintype.card ι * Module.finrank ℚ L := by + rw [F.squarefreeAlgebra_finrank π] + calc + _ ≤ ∑ _a : SquarefreeIndex ι, Module.finrank ℚ L := + Finset.sum_le_sum fun a _ => (F.squarefreeCoefficientLayer π a).finrank_le + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, card_squarefreeIndex, Nat.cast_id] + +end Erdos3.MultidegreeLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeSupportPermutation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeSupportPermutation.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fae2b1c6693e8621f8d6ee120ee021e57fce821 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SquarefreeSupportPermutation.lean @@ -0,0 +1,97 @@ +import OAI.Combinatorics.Progressions.Polynomial.SquarefreePolynomialPermutation + +namespace OAI + +section + +namespace Erdos3 + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] + +noncomputable def squarefreeSupportModule (P : SquarefreeIndex ι → Prop) : + Submodule ℚ (SquarefreePolynomial ι L) where + carrier := {x | ∀ a, ¬P a → squarefreePolynomialEquiv x a = 0} + zero_mem' := by + intro a _ + exact congrFun (map_zero squarefreePolynomialEquiv) a + add_mem' := by + intro x y hx hy a ha + rw [map_add, Pi.add_apply, hx a ha, hy a ha, add_zero] + smul_mem' := by + intro r x hx a ha + rw [map_smul, Pi.smul_apply, hx a ha, smul_zero] + +theorem mem_squarefreeSupportModule (P : SquarefreeIndex ι → Prop) + (x : SquarefreePolynomial ι L) : + x ∈ squarefreeSupportModule P ↔ ∀ a, ¬P a → squarefreePolynomialEquiv x a = 0 := Iff.rfl + +theorem squarefreeSupportModule_mono {P Q : SquarefreeIndex ι → Prop} + (h : ∀ a, P a → Q a) : + squarefreeSupportModule (L := L) P ≤ squarefreeSupportModule Q := by + intro x hx a ha + exact hx a (fun hp => ha (h a hp)) + +theorem squarefreeSupportModule_eq_top {P : SquarefreeIndex ι → Prop} + (h : ∀ a, P a) : squarefreeSupportModule (L := L) P = ⊤ := by + apply top_unique + intro x _ a ha + exact False.elim (ha (h a)) + +theorem squarefreeSupportModule_eq_bot {P : SquarefreeIndex ι → Prop} + (h : ∀ a, ¬P a) : squarefreeSupportModule (L := L) P = ⊥ := by + apply bot_unique + intro x hx + change x = 0 + apply squarefreePolynomialEquiv.injective + ext a + exact hx a (h a) + +theorem squarefreeMonomial_mem_support {P : SquarefreeIndex ι → Prop} + (a : SquarefreeIndex ι) (ha : P a) (v : L) : + squarefreeMonomial a v ∈ squarefreeSupportModule P := by + intro b hb + exact squarefreePolynomialEquiv_monomial_ne a b + (fun he => hb (he ▸ ha)) v + +end Erdos3 + +end + +section + +namespace Erdos3 + +variable {ι κ L : Type*} [Fintype ι] [Fintype κ] [LieRing L] [LieAlgebra ℚ L] + +theorem squarefreePermute_mem_support_iff (e : ι ≃ κ) + (P : SquarefreeIndex ι → Prop) (Q : SquarefreeIndex κ → Prop) + (hPQ : ∀ a, Q (SquarefreeIndex.permute e a) ↔ P a) (x : SquarefreePolynomial ι L) : + squarefreePermute e x ∈ squarefreeSupportModule Q ↔ x ∈ squarefreeSupportModule P := by + constructor + · intro hx a ha + have hq : ¬Q (SquarefreeIndex.permute e a) := fun h => ha ((hPQ a).mp h) + have hz := hx (SquarefreeIndex.permute e a) hq + simpa only [squarefreePermute_coefficient, Equiv.symm_apply_apply] using hz + · intro hx b hb + rw [squarefreePermute_coefficient] + apply hx + intro hp + apply hb + have hq := (hPQ ((SquarefreeIndex.permute e).symm b)).mpr hp + simpa only [Equiv.apply_symm_apply] using hq + +omit [Fintype ι] [Fintype κ] in +theorem SquarefreeIndex.permutedBound_le_iff (e : ι ≃ κ) (c : ι → ℕ) (a : SquarefreeIndex ι) : + (fun j => c (e.symm j)) ≤ (fun j => (permute e a).val j) ↔ + c ≤ (fun i => a.val i) := by + constructor + · intro h i + simpa only [permute_apply, Equiv.symm_apply_apply] using h (e i) + · intro h j + exact h (e.symm j) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/StepOneCoordinateMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/StepOneCoordinateMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..3852e54c6264a1c76cf52295741185ddf8f7ad4d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/StepOneCoordinateMetric.lean @@ -0,0 +1,76 @@ +import OAI.Combinatorics.Progressions.Polynomial.ScaledPolynomialDualBounds + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module Manifold NilpotentLieBCHGroup +open scoped Manifold ContDiff Bundle NNReal ENNReal + +variable {ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] [LieAlgebra ℝ L] + [IsScalarTower ℚ ℝ L] [TopologicalSpace L] [IsTopologicalAddGroup L] + [ContinuousSMul ℝ L] [T2Space L] + (F : NilpotentLieFiltration L 1) (e : Basis ι ℝ L) + +omit [IsScalarTower ℚ ℝ L] in +theorem stepOne_rightTranslate (g : F.Group) (x : ι → ℝ) : + rightTranslate e g x = x + e.equivFun g.coord := by + simp only [rightTranslate, basisHomeomorph_apply, F.stepOne_coord_mul, map_add] + rw [← basisHomeomorph_apply, Homeomorph.apply_symm_apply] + +omit [IsScalarTower ℚ ℝ L] in +theorem stepOne_rightVelocity (g : F.Group) : + rightVelocity e g = ContinuousLinearMap.id ℝ (ι → ℝ) := by + unfold rightVelocity + have heq : rightTranslate e g⁻¹ = fun x => x + e.equivFun (g⁻¹).coord := + funext (F.stepOne_rightTranslate e g⁻¹) + rw [heq] + simp + +theorem stepOne_norm_mfderiv_coordinates_le (g : F.Group) : + letI := basisChartedSpace (hnil := F.lowerCentralSeries_eq_bot) e + letI := rightRiemannianBundle (hnil := F.lowerCentralSeries_eq_bot) e + ∀ v : TangentSpace 𝓘(ℝ, ι → ℝ) g, + ‖tangentModelVector (mfderiv 𝓘(ℝ, ι → ℝ) 𝓘(ℝ, ι → ℝ) (basisHomeomorph e) g v)‖ ≤ ‖v‖ := by + let := basisChartedSpace (hnil := F.lowerCentralSeries_eq_bot) e + let := rightRiemannianBundle (hnil := F.lowerCentralSeries_eq_bot) e + intro v + calc + _ = ‖tangentModelVector v‖ := congrArg (fun w => ‖tangentModelVector w‖) + (mfderiv_basisHomeomorph_coordinates e g v) + _ ≤ coordinateL2Norm v := norm_le_coordinateL2Norm _ + _ = ‖v‖ := by + rw [norm_tangent_eq_coordinateL2Norm, F.stepOne_rightVelocity] + rfl + +theorem stepOne_coordinates_lipschitz : + letI := rightMetricSpace (hnil := F.lowerCentralSeries_eq_bot) e + LipschitzWith 1 (basisHomeomorph (hnil := F.lowerCentralSeries_eq_bot) e) := by + let := basisChartedSpace (hnil := F.lowerCentralSeries_eq_bot) e + let := rightRiemannianBundle (hnil := F.lowerCentralSeries_eq_bot) e + let := rightMetricSpace (hnil := F.lowerCentralSeries_eq_bot) e + intro x y + let r : ℝ≥0 := ⟨dist x y + 1, by positivity⟩ + have hnear : (1 : ℝ≥0∞) * riemannianEDist 𝓘(ℝ, ι → ℝ) x y < r := by + change (1 : ℝ≥0∞) * edist x y < r + rw [one_mul, edist_dist] + rw [← ENNReal.ofReal_coe_nnreal] + change ENNReal.ofReal (dist x y) < ENNReal.ofReal (dist x y + 1) + exact (ENNReal.ofReal_lt_ofReal_iff (by positivity)).mpr (by linarith) + have hbound : ∀ z : F.Group, basisHomeomorph e z ∈ Metric.closedBall (basisHomeomorph e x) r → + ∀ v : TangentSpace 𝓘(ℝ, ι → ℝ) z, + ‖tangentModelVector (mfderiv 𝓘(ℝ, ι → ℝ) 𝓘(ℝ, ι → ℝ) (basisHomeomorph e) z v)‖ₑ ≤ + (1 : ℝ≥0∞) * ‖v‖ₑ := by + intro z _ v + simpa only [one_mul, ofReal_norm] using + ENNReal.ofReal_le_ofReal (F.stepOne_norm_mfderiv_coordinates_le e z v) + exact coordinate_edist_le_of_riemannianEDist_lt (C := 1) (r := r) (by norm_num) + (contMDiff_basisHomeomorph e 1) x y hbound hnear + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SublatticeOrbitMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SublatticeOrbitMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..91f62c84ae486f6b4380b77f6bbe4bbf9516064c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SublatticeOrbitMetric.lean @@ -0,0 +1,40 @@ +import OAI.Combinatorics.Progressions.Linear.SplitCoverProjection + +namespace OAI + +section + +namespace Erdos3.RationalFilteredNilmanifold + +open scoped TensorProduct + +theorem largerLattice_cyclicOrbitPoint_dist_le + {σ L : Type*} [LieRing L] [LieAlgebra ℚ L] {s d : ℕ} + [TopologicalSpace (ℝ ⊗[ℚ] L)] [IsTopologicalAddGroup (ℝ ⊗[ℚ] L)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] L)] [T2Space (ℝ ⊗[ℚ] L)] + (D : RationalFilteredNilmanifold L s d) (Γ : Subgroup D.filtration.Group) + (m : ℕ) (hm : 0 < m) + (hin : scaledIntegerGrid m ⊆ bchSubgroupCoordinates D.basis Γ) + (hout : bchSubgroupCoordinates D.basis Γ ⊆ denominatorGrid m) + (hΓ : D.lattice ≤ Γ) {w : σ → ℕ} + (g : D.filtration.realification.PolynomialOrbit w) (N : ℕ) [NeZero N] + (x y : σ → ZMod N) : + let E := D.withLattice Γ m hm hin hout + letI := D.metricSpace + letI := E.metricSpace + dist (E.cyclicOrbitPoint g N x) (E.cyclicOrbitPoint g N y) ≤ + dist (D.cyclicOrbitPoint g N x) (D.cyclicOrbitPoint g N y) := by + let E := D.withLattice Γ m hm hin hout + let := D.metricSpace + let := E.metricSpace + have h := (sublatticeProjection_lipschitz E D hΓ rfl).dist_le_mul + (D.cyclicOrbitPoint g N x) (D.cyclicOrbitPoint g N y) + change dist (E.cyclicOrbitPoint g N x) (E.cyclicOrbitPoint g N y) ≤ + (1 : ℝ) * dist (D.cyclicOrbitPoint g N x) (D.cyclicOrbitPoint g N y) at h + simpa only [one_mul] using h + +end Erdos3.RationalFilteredNilmanifold + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SubmoduleCoordinateHeight.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SubmoduleCoordinateHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..28c6e4d4fcb1c0d0620949833081d88174d63fdd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SubmoduleCoordinateHeight.lean @@ -0,0 +1,49 @@ +import Mathlib.LinearAlgebra.Matrix.ToLin +import OAI.Combinatorics.Progressions.Sampling.RationalSpanGrid + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped Matrix + +theorem submodule_basis_coordinate_height {ν κ L : Type*} [Fintype ν] [Fintype κ] + [AddCommGroup L] [Module ℚ L] (U : Submodule ℚ L) + (b : Basis κ ℚ U) (e : Basis ν ℚ L) {H : ℕ} (hH : 1 ≤ H) + (hB : ∀ i j, RationalHeightLE (e.repr (b j).val i) H) + (x : U) {K : ℕ} (hx : ∀ i, RationalHeightLE (e.repr x.val i) K) (j : κ) : + RationalHeightLE (b.repr x j) + ((Fintype.card ν + 1) * (rationalSolveHeight (Fintype.card κ) H * K) ^ Fintype.card ν) := by + classical + let B := LinearMap.toMatrix b e U.subtype + have hBmul (w : κ → ℚ) : B *ᵥ w = e.equivFun (b.equivFun.symm w).val := by + have h := LinearMap.toMatrix_mulVec_repr b e U.subtype (b.equivFun.symm w) + simp only [← b.equivFun_apply, LinearEquiv.apply_symm_apply, ← e.equivFun_apply] at h + exact h + have hBi : Function.Injective B.mulVec := by + intro u v huv + rw [hBmul, hBmul] at huv + exact b.equivFun.symm.injective (Subtype.ext (e.equivFun.injective huv)) + obtain ⟨P, hPB, hP⟩ := exists_bounded_rational_left_inverse B + (Matrix.mulVec_injective_iff.mp hBi) hH + (by + intro i j + dsimp only [B] + rw [LinearMap.toMatrix_apply] + exact hB i j) + have hretract : P *ᵥ e.repr x.val = b.repr x := by + have hrepr : B *ᵥ b.repr x = e.repr x.val := + LinearMap.toMatrix_mulVec_repr b e U.subtype x + rw [← hrepr, Matrix.mulVec_mulVec, hPB, Matrix.one_mulVec] + rw [← congrFun hretract j] + exact rationalHeightLE_sum (fun i => P j i * e.repr x.val i) + (fun i => (hP j i).mul (hx i)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SubmoduleQuotientCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SubmoduleQuotientCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f43b0e161464968c3c6c3473780ba2970cfe534 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SubmoduleQuotientCoordinates.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Linear.QuotientProjectionCoordinates + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped Matrix + +variable {ι κ V : Type*} [AddCommGroup V] [Module ℚ V] [Fintype ι] [Fintype κ] + (b : Basis ι ℚ V) (U : Submodule ℚ V) (D : Matrix κ ι ℚ) + (hker : LinearMap.ker D.mulVecLin = U.map b.equivFun.toLinearMap) + (hsurj : Function.Surjective D.mulVec) + +noncomputable def submoduleQuotientCoordinateEquiv : (V ⧸ U) ≃ₗ[ℚ] (κ → ℚ) := + (Submodule.Quotient.equiv U (U.map b.equivFun.toLinearMap) b.equivFun rfl).trans + (rationalQuotientEquiv D _ hker hsurj) + +omit [Fintype κ] in +theorem submoduleQuotientCoordinateEquiv_mk (x : V) : + submoduleQuotientCoordinateEquiv b U D hker hsurj (U.mkQ x) = D *ᵥ b.equivFun x := + rationalQuotientEquiv_apply_mk D _ hker hsurj _ + +noncomputable def submoduleQuotientCoordinateBasis : Basis κ ℚ (V ⧸ U) := + Basis.ofEquivFun (submoduleQuotientCoordinateEquiv b U D hker hsurj) + +theorem submoduleQuotientCoordinateBasis_matrix [DecidableEq ι] [DecidableEq κ] : + LinearMap.toMatrix b (submoduleQuotientCoordinateBasis b U D hker hsurj) U.mkQ = D := by + classical + ext i j + rw [LinearMap.toMatrix_apply, submoduleQuotientCoordinateBasis, Basis.ofEquivFun_repr_apply] + change (submoduleQuotientCoordinateEquiv b U D hker hsurj (U.mkQ (b j))) i = _ + rw [submoduleQuotientCoordinateEquiv_mk] + simp [Basis.equivFun_self, Matrix.mulVec, dotProduct] + +theorem submoduleQuotientCoordinateEquiv_symm [DecidableEq κ] + (S : Matrix ι κ ℚ) (hS : D * S = 1) (y : κ → ℚ) : + (submoduleQuotientCoordinateEquiv b U D hker hsurj).symm y = U.mkQ (b.equivFun.symm (S *ᵥ y)) := by + apply (submoduleQuotientCoordinateEquiv b U D hker hsurj).injective + rw [LinearEquiv.apply_symm_apply, submoduleQuotientCoordinateEquiv_mk, + LinearEquiv.apply_symm_apply, Matrix.mulVec_mulVec, hS, Matrix.one_mulVec] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportCutoffSplit.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportCutoffSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..75fc2124e5e746c61bc514acfa326eae223d8872 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportCutoffSplit.lean @@ -0,0 +1,57 @@ +import OAI.Combinatorics.Progressions.Estimates.DisjointPowersetSum +import OAI.Combinatorics.Progressions.Polynomial.RestrictedDegreeSupports + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem sum_support_cutoff_split (I : Finset ι) (b : ℕ) (F : Finset ι → ℝ) : + (∑ S ∈ lowDegreeCoordinateSets ι b, F S) = + ∑ A ∈ I.powerset, ∑ B ∈ Iᶜ.powerset, if A.card + B.card ≤ b then F (A ∪ B) else 0 := by + have he : lowDegreeCoordinateSets ι b = Finset.univ.powerset.filter (fun S => S.card ≤ b) := by + ext S + simp only [mem_lowDegreeCoordinateSets, Finset.mem_filter, Finset.mem_powerset, + Finset.subset_univ, true_and] + rw [he, Finset.sum_filter] + have hu : (Finset.univ : Finset ι) = I ∪ Iᶜ := (Finset.union_compl I).symm + rw [hu, disjoint_powerset_sum I Iᶜ disjoint_compl_right] + apply Finset.sum_congr rfl + intro A hA + apply Finset.sum_congr rfl + intro B hB + have hd : Disjoint A B := disjoint_compl_right.mono + (Finset.mem_powerset.mp hA) (Finset.mem_powerset.mp hB) + rw [Finset.card_union_of_disjoint hd] + +theorem sum_cutoff_core_shell (I : Finset ι) (b : ℕ) (hIb : I.card ≤ b) + (a v : Finset ι → ℝ) : + (∑ A ∈ I.powerset, ∑ B ∈ Iᶜ.powerset, if A.card + B.card ≤ b then a A * v B else 0) = + (∑ A ∈ I.powerset, a A) * (∑ B ∈ Iᶜ.powerset, if B.card ≤ b - I.card then v B else 0) + + ∑ A ∈ I.powerset, a A * + (∑ B ∈ Iᶜ.powerset, if b - I.card < B.card ∧ A.card + B.card ≤ b then v B else 0) := by + rw [Finset.sum_mul, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro A hA + rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro B _ + have hAcard := Finset.card_le_card (Finset.mem_powerset.mp hA) + by_cases hc : B.card ≤ b - I.card + · have hab : A.card + B.card ≤ b := by omega + have hn : ¬ b - I.card < B.card := by omega + simp only [hc, hab, hn, false_and, ite_true, ite_false, mul_zero, add_zero] + · have hgt : b - I.card < B.card := by omega + by_cases hab : A.card + B.card ≤ b <;> + simp only [hc, hgt, hab, true_and, ite_true, ite_false, mul_zero, zero_add] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportMaskComplexMean.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportMaskComplexMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c7430399f7495af756f85b862a38313d2e88bc9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportMaskComplexMean.lean @@ -0,0 +1,50 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteFiberTest + +namespace OAI + +section + +namespace Erdos3 + +variable {A R : Type*} [Fintype A] [Fintype R] + +theorem supportMask_complexMean_difference + (p : FiniteProbabilityWeights A) (q : FiniteProbabilityWeights R) + (source : A → ℂ) (target : R → ℂ) (c : ℂ) + (hfix : ∀ a, c * source a = source a) : + p.complexMean source - q.complexMean (fun r => c * target r) = + c * (p.complexMean source - q.complexMean target) := by + have hsource : c * p.complexMean source = p.complexMean source := by + rw [← p.complexMean_mul_left] + congr 1 + funext a + exact hfix a + rw [q.complexMean_mul_left, mul_sub, hsource] + +theorem supportMask_complexMean_difference_norm + (p : FiniteProbabilityWeights A) (q : FiniteProbabilityWeights R) + (source : A → ℂ) (target : R → ℂ) (c : ℂ) + (hfix : ∀ a, c * source a = source a) (hc : ‖c‖ ≤ 1) : + ‖p.complexMean source - q.complexMean (fun r => c * target r)‖ ≤ + ‖p.complexMean source - q.complexMean target‖ := by + rw [supportMask_complexMean_difference p q source target c hfix, norm_mul] + exact (mul_le_mul_of_nonneg_right hc (norm_nonneg _)).trans_eq (one_mul _) + +theorem supportMask_weighted_complexMean_difference + (p : FiniteProbabilityWeights A) (q : FiniteProbabilityWeights R) + (label : A → R) (weight : R → ℂ) (source : A → ℂ) (target : R → ℂ) (c : ℂ) + (hfix : ∀ a, c * source a = source a) : + p.complexMean (fun a => weight (label a) * source a) - + q.complexMean (fun r => weight r * (c * target r)) = + c * (p.complexMean (fun a => weight (label a) * source a) - + q.complexMean (fun r => weight r * target r)) := by + have hs (a : A) : c * (weight (label a) * source a) = weight (label a) * source a := by + rw [mul_left_comm, hfix a] + simpa only [mul_left_comm c] using supportMask_complexMean_difference p q + (fun a => weight (label a) * source a) (fun r => weight r * target r) c hs + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportPairingAggregation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportPairingAggregation.lean new file mode 100644 index 0000000000000000000000000000000000000000..5500aa8207b0bed09eddb8ddbe6ee28b025cc79c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportPairingAggregation.lean @@ -0,0 +1,55 @@ +import OAI.Combinatorics.Progressions.Linear.KernelSupportContraction + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + {X Y : ι → Type*} [∀ i, Fintype (X i)] [∀ i, Fintype (Y i)] + +theorem productCouplingPairing_truncation_abs_le + (μ : ∀ i, FiniteProbabilityWeights (X i)) (ν : ∀ i, FiniteProbabilityWeights (Y i)) + (K : ∀ i, X i → FiniteProbabilityWeights (Y i)) (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) + (hbound : ∀ i (f : Y i → ℝ), (ν i).mean f = 0 → + (μ i).mean (fun x => (K i x).mean f ^ 2) ≤ C i * (ν i).mean (fun y => f y ^ 2)) + (hK : ∀ i (f : Y i → ℝ), (μ i).mean (fun x => (K i x).mean f) = (ν i).mean f) + (D : Finset (Finset ι)) {ρ : ℝ} (hρ : 0 ≤ ρ) + (hprod : ∀ S ∈ D, (∏ i ∈ S, C i) ≤ ρ ^ 2) + (w : (∀ i, X i) → ℝ) (f : (∀ i, Y i) → ℝ) : + |productCouplingPairing (fun i => FiniteProbabilityCoupling.ofKernel (μ i) (ν i) (K i) (hK i)) + (productANOVATruncation μ D w) (productANOVATruncation ν D f)| ≤ + ρ * Real.sqrt (productANOVAEnergy μ D w) * Real.sqrt (productANOVAEnergy ν D f) := by + let c := fun i => FiniteProbabilityCoupling.ofKernel (μ i) (ν i) (K i) (hK i) + have ha (S : Finset ι) : 0 ≤ (FiniteProbabilityWeights.pi μ).mean (fun x => productANOVA μ S w x ^ 2) := + FiniteProbabilityWeights.mean_nonneg _ (fun x => sq_nonneg (productANOVA μ S w x)) + have hb (S : Finset ι) : 0 ≤ (FiniteProbabilityWeights.pi ν).mean (fun x => productANOVA ν S f x ^ 2) := + FiniteProbabilityWeights.mean_nonneg _ (fun x => sq_nonneg (productANOVA ν S f x)) + have hpoint (S : Finset ι) (hS : S ∈ D) : + productCouplingPairing c (productANOVA μ S w) (productANOVA ν S f) ^ 2 ≤ + (ρ ^ 2 * (FiniteProbabilityWeights.pi μ).mean (fun x => productANOVA μ S w x ^ 2)) * + (FiniteProbabilityWeights.pi ν).mean (fun x => productANOVA ν S f x ^ 2) := + (productCouplingPairing_support_sq_le μ ν K C hC hbound hK S w f).trans + (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (hprod S hS) (ha S)) (hb S)) + have hs := Finset.sum_sq_le_sum_mul_sum_of_sq_le_mul D + (fun S _ => mul_nonneg (sq_nonneg ρ) (ha S)) (fun S _ => hb S) hpoint + rw [← Finset.mul_sum] at hs + change (∑ S ∈ D, productCouplingPairing c (productANOVA μ S w) (productANOVA ν S f)) ^ 2 ≤ + ρ ^ 2 * productANOVAEnergy μ D w * productANOVAEnergy ν D f at hs + rw [productCouplingPairing_truncation] + calc + _ = Real.sqrt ((∑ S ∈ D, productCouplingPairing c (productANOVA μ S w) (productANOVA ν S f)) ^ 2) := + (Real.sqrt_sq_eq_abs _).symm + _ ≤ Real.sqrt (ρ ^ 2 * productANOVAEnergy μ D w * productANOVAEnergy ν D f) := Real.sqrt_le_sqrt hs + _ = _ := by + rw [Real.sqrt_mul (mul_nonneg (sq_nonneg ρ) (productANOVAEnergy_nonneg μ D w)), + Real.sqrt_mul (sq_nonneg ρ), Real.sqrt_sq hρ] + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedBoxLipschitz.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedBoxLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8bae2030761014a47ec6cf75250cc431b54c975 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedBoxLipschitz.lean @@ -0,0 +1,56 @@ +import Mathlib.Analysis.Normed.Group.Constructions +import Mathlib.Tactic +import Mathlib.Topology.MetricSpace.Lipschitz + +namespace OAI + +section + +namespace Erdos3 + +open scoped NNReal + +theorem lipschitzWith_of_unit_range_support_box {I : Type*} [Fintype I] + (f : (I → ℝ) → ℝ) (R L : ℝ≥0) + (hzero : ∀ x, 0 ≤ f x) (hone : ∀ x, f x ≤ 1) + (hsupport : ∀ x, f x ≠ 0 → ∀ i, |x i| ≤ R) + (hlip : LipschitzOnWith L f {x | ∀ i, |x i| ≤ (R : ℝ) + 1}) : + LipschitzWith (max 1 L) f := by + have hL : (L : ℝ) ≤ (max 1 L : ℝ≥0) := by exact_mod_cast (le_max_right 1 L) + have hnear (x y : I → ℝ) (hx : f x ≠ 0) (hxy : dist x y < 1) : + dist (f x) (f y) ≤ L * dist x y := by + have hxR : ∀ i, |x i| ≤ (R : ℝ) + 1 := fun i => (hsupport x hx i).trans (by linarith) + have hyR : ∀ i, |y i| ≤ (R : ℝ) + 1 := by + intro i + have hi : |y i - x i| ≤ dist x y := by + calc + |y i - x i| ≤ dist y x := by simpa only [Real.dist_eq] using dist_le_pi_dist y x i + _ = dist x y := dist_comm y x + calc + |y i| = |(y i - x i) + x i| := by ring_nf + _ ≤ |y i - x i| + |x i| := abs_add_le _ _ + _ ≤ (R : ℝ) + 1 := by linarith [hsupport x hx i] + exact hlip.dist_le_mul x hxR y hyR + apply LipschitzWith.of_dist_le_mul + intro x y + by_cases hxy : dist x y < 1 + · by_cases hx : f x = 0 + · by_cases hy : f y = 0 + · rw [hx, hy, dist_self] + positivity + · have h := hnear y x hy (by simpa only [dist_comm] using hxy) + rw [dist_comm (f y) (f x), dist_comm y x] at h + exact h.trans (mul_le_mul_of_nonneg_right hL dist_nonneg) + · exact (hnear x y hx hxy).trans (mul_le_mul_of_nonneg_right hL dist_nonneg) + · have hdist : dist (f x) (f y) ≤ 1 := by + rw [Real.dist_eq, abs_le] + constructor <;> linarith [hzero x, hzero y, hone x, hone y] + have hlarge : (1 : ℝ) ≤ dist x y := le_of_not_gt hxy + have hmax : (1 : ℝ) ≤ (max 1 L : ℝ≥0) := by exact_mod_cast (le_max_left 1 L) + exact hdist.trans (hlarge.trans (by nlinarith [dist_nonneg (x := x) (y := y)])) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedComplexSelection.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedComplexSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..730710fa9ea018540ceee5f0cc043df252112a17 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedComplexSelection.lean @@ -0,0 +1,62 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteGoodPartTransfer +import OAI.Combinatorics.Progressions.Probability.WeightedSupportedComplexMixture + +namespace OAI + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped Classical + +variable {X R : Type*} [Fintype X] [DecidableEq X] [Fintype R] [DecidableEq R] + +theorem complexMean_disintegrate_supported (p : FiniteProbabilityWeights X) + (F : X → R) (f : X → ℂ) : + p.complexMean f = (p.fiberLaw F).complexMean (fun r => + if hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r)) then + (p.condition _ hr).complexMean f else 0) := by + apply sub_eq_zero.mp + apply norm_eq_zero.mp + apply le_antisymm _ (norm_nonneg _) + apply p.complexMean_supported_fiber_error F + intro r hr + simp only [dite_eq_left hr, sub_self, norm_zero, le_refl] + +theorem exists_positive_fiber_ge_complexMean_re (p : FiniteProbabilityWeights X) + (F : X → R) (f : X → ℂ) : + ∃ (r : R) (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))), + (p.complexMean f).re ≤ ((p.condition _ hr).complexMean f).re := by + rw [p.complexMean_disintegrate_supported F f] + obtain ⟨r, hr, hv⟩ := (p.fiberLaw F).exists_positive_weight_ge_complexMean_re + (fun r => if hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r)) then + (p.condition _ hr).complexMean f else 0) + rw [p.fiberLaw_weight_eq_mass] at hr + exact ⟨r, hr, by simpa only [dite_eq_left hr] using hv⟩ + +omit [DecidableEq X] in +theorem exists_good_ge_complexMean_re_sub_bad [DecidableEq X] (p : FiniteProbabilityWeights X) + (Good : X → Prop) (f : X → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) + {δ η : ℝ} (hδ : 0 < δ) (hbad : p.eventProbability (fun x => ¬Good x) ≤ η) + (hlarge : δ + η ≤ (p.complexMean f).re) : + ∃ x, 0 < p.weight x ∧ Good x ∧ δ ≤ (f x).re := by + have herr := p.complexMean_goodPart_comparison Good f (fun x _ => f x) + (show (0 : ℝ) ≤ 0 from le_rfl) hf (fun _ _ => by simp) + rw [zero_add] at herr + have hre := (Complex.re_le_norm _).trans (herr.trans hbad) + rw [Complex.sub_re] at hre + have hgood : δ ≤ (p.complexMean (fun x => if _ : Good x then f x else 0)).re := by + linarith only [hre, hlarge] + obtain ⟨x, hx, hv⟩ := p.exists_positive_weight_ge_complexMean_re + (fun x => if _ : Good x then f x else 0) + have hselected := hgood.trans hv + by_cases hg : Good x + · exact ⟨x, hx, hg, by simpa only [dite_eq_left hg] using hselected⟩ + · simp only [dite_eq_right hg, Complex.zero_re] at hselected + exact (not_le_of_gt hδ hselected).elim + +end Erdos3.FiniteProbabilityWeights + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCorrelationPairs.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCorrelationPairs.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba473d3cdd9ec2c83bbf580d7a94d317bcad09c1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCorrelationPairs.lean @@ -0,0 +1,80 @@ +import OAI.Combinatorics.Progressions.Estimates.DenseCorrelationPairs +import OAI.Combinatorics.Progressions.Estimates.RealFiniteZeroExtension + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_supported_correlation_pairs {I X : Type*} [Fintype I] [Nonempty I] [DecidableEq X] + (A : Finset X) (hA : A.Nonempty) (S : I → Finset X) (hSA : ∀ i, S i ⊆ A) + (B : X → ℂ) (v : I → X → ℂ) {α δ : ℝ} (hα : 0 < α) (hδ : 0 < δ) + (hB : ∀ x ∈ A, ‖B x‖ ≤ 1) (hv : ∀ i x, x ∈ S i → ‖v i x‖ ≤ 1) + (hsize : ∀ i, α ≤ (S i).card / (A.card : ℝ)) + (hcorr : ∀ i, δ ≤ ‖𝔼 x ∈ S i, B x * v i x‖) : + ∃ P : Finset (I × I), P.Nonempty ∧ + (α * δ) ^ 2 / 2 * (Fintype.card I : ℝ) ^ 2 ≤ (P.card : ℝ) ∧ + ∀ t ∈ P, (S t.1 ∩ S t.2).Nonempty ∧ + (α * δ) ^ 2 / 2 ≤ ‖𝔼 x ∈ S t.1 ∩ S t.2, v t.1 x * star (v t.2 x)‖ ∧ + (α * δ) ^ 2 / 2 ≤ (S t.1 ∩ S t.2).card / (A.card : ℝ) := by + classical + obtain ⟨x₀, hx₀⟩ := hA + have hA : A.Nonempty := ⟨x₀, hx₀⟩ + let : Nonempty A := ⟨⟨x₀, hx₀⟩⟩ + let u (i : I) (x : A) := zeroExtendFinset (S i) (v i) x.val + have huc (i : I) : α * δ ≤ ‖𝔼 x : A, B x.val * u i x‖ := by + have heq : ‖𝔼 x : A, B x.val * u i x‖ = + ((S i).card / (A.card : ℝ)) * ‖𝔼 x ∈ S i, B x * v i x‖ := by + change ‖𝔼 x : A, B x.val * zeroExtendFinset (S i) (v i) x.val‖ = _ + rw [expect_finset_subtype A (fun x => B x * zeroExtendFinset (S i) (v i) x)] + simp_rw [zeroExtendFinset_mul_left] + exact norm_expect_zeroExtendFinset A (S i) (hSA i) _ + rw [heq] + exact mul_le_mul (hsize i) (hcorr i) hδ.le (by positivity) + obtain ⟨P, hP, hPsize, hPcor⟩ := exists_dense_correlation_pairs + (fun x : A => B x.val) u (mul_pos hα hδ) (fun x => hB x.val x.property) + (fun i x => zeroExtendFinset_norm_le_one (S i) (v i) (hv i) x.val) huc + refine ⟨P, hP, hPsize, ?_⟩ + intro t ht + have hJA : S t.1 ∩ S t.2 ⊆ A := Finset.Subset.trans Finset.inter_subset_left (hSA t.1) + have heq : ‖𝔼 x : A, u t.1 x * star (u t.2 x)‖ = + ((S t.1 ∩ S t.2).card / (A.card : ℝ)) * + ‖𝔼 x ∈ S t.1 ∩ S t.2, v t.1 x * star (v t.2 x)‖ := by + change ‖𝔼 x : A, zeroExtendFinset (S t.1) (v t.1) x.val * + star (zeroExtendFinset (S t.2) (v t.2) x.val)‖ = _ + rw [expect_finset_subtype A (fun x => zeroExtendFinset (S t.1) (v t.1) x * + star (zeroExtendFinset (S t.2) (v t.2) x))] + simp_rw [zeroExtendFinset_mul_star] + exact norm_expect_zeroExtendFinset A (S t.1 ∩ S t.2) hJA _ + have hp := hPcor t ht + rw [heq] at hp + have hpos : 0 < (α * δ) ^ 2 / 2 := by positivity + have hJ : (S t.1 ∩ S t.2).Nonempty := by + by_contra hempty + have he : S t.1 ∩ S t.2 = ∅ := Finset.not_nonempty_iff_eq_empty.mp hempty + simp only [he, Finset.card_empty, Nat.cast_zero, zero_div, zero_mul] at hp + exact (not_le_of_gt hpos) hp + have hnorm : ‖𝔼 x ∈ S t.1 ∩ S t.2, v t.1 x * star (v t.2 x)‖ ≤ 1 := by + apply (RCLike.norm_expect_le (K := ℂ)).trans + apply (Finset.expect_le_expect _).trans_eq (Finset.expect_const hJ 1) + intro x hx + obtain ⟨hx₁, hx₂⟩ := Finset.mem_inter.mp hx + rw [norm_mul, norm_star] + exact (mul_le_of_le_one_left (norm_nonneg _) (hv t.1 x hx₁)).trans (hv t.2 x hx₂) + have hApos : (0 : ℝ) < A.card := by exact_mod_cast hA.card_pos + have hratio : ((S t.1 ∩ S t.2).card / (A.card : ℝ)) ≤ 1 := by + apply (div_le_iff₀ hApos).mpr + simpa only [one_mul] using (Nat.cast_le.mpr (Finset.card_le_card hJA) : + ((S t.1 ∩ S t.2).card : ℝ) ≤ A.card) + refine ⟨hJ, ?_, ?_⟩ + · exact hp.trans ((mul_le_mul_of_nonneg_right hratio (norm_nonneg _)).trans_eq (one_mul _)) + · exact hp.trans ((mul_le_mul_of_nonneg_left hnorm (by positivity)).trans_eq (mul_one _)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCubeEquivTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCubeEquivTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..16c075d4941101a023c11437e1f3c5487f7407a9 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCubeEquivTransport.lean @@ -0,0 +1,700 @@ +import OAI.Combinatorics.Progressions.Estimates.GowersWeightedDerivative + +namespace OAI + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A B : Type*} [AddCommGroup A] [AddCommGroup B] + +@[simp] theorem cubeShift_false {j : ℕ} (hs : Fin j → A) : + cubeShift hs (fun _ ↦ false) = 0 := by simp [cubeShift] + +def cubeAxis {j : ℕ} (i : Fin j) : Fin j → Bool := fun k ↦ decide (k = i) + +@[simp] theorem cubeShift_axis {j : ℕ} (hs : Fin j → A) (i : Fin j) : + cubeShift hs (cubeAxis i) = hs i := by simp [cubeShift, cubeAxis] + +theorem map_cubeShift (φ : A →+ B) {j : ℕ} (hs : Fin j → A) (ω : Fin j → Bool) : + φ (cubeShift hs ω) = cubeShift (fun i ↦ φ (hs i)) ω := by + simp only [cubeShift, map_sum] + apply Finset.sum_congr rfl + intro i hi + split_ifs <;> simp + +def ReflectsPairSums (φ : A →+ B) (Q : Set A) : Prop := + ∀ a ∈ Q, ∀ b ∈ Q, ∀ c ∈ Q, ∀ d ∈ Q, + φ a + φ b = φ c + φ d → a + b = c + d + +theorem ReflectsPairSums.injOn {φ : A →+ B} {Q : Set A} + (hφ : ReflectsPairSums φ Q) : Set.InjOn φ Q := by + intro a ha b hb he + exact add_right_cancel (hφ a ha a ha b hb a ha (by rw [he])) + +abbrev SupportedCube (j : ℕ) (Q : Set A) := + {p : (Fin j → A) × A // ∀ ω : Fin j → Bool, p.2 + cubeShift p.1 ω ∈ Q} + +theorem SupportedCube.base_mem {j : ℕ} {Q : Set A} (p : SupportedCube j Q) : p.val.2 ∈ Q := by + simpa using p.property (fun _ ↦ false) + +theorem SupportedCube.axis_mem {j : ℕ} {Q : Set A} (p : SupportedCube j Q) (i : Fin j) : + p.val.2 + p.val.1 i ∈ Q := by + simpa using p.property (cubeAxis i) + +def SupportedCube.map (φ : A →+ B) {j : ℕ} {Q : Set A} (p : SupportedCube j Q) : + SupportedCube j (φ '' Q) := + ⟨(fun i ↦ φ (p.val.1 i), φ p.val.2), fun ω ↦ + ⟨p.val.2 + cubeShift p.val.1 ω, p.property ω, by rw [map_add, map_cubeShift]⟩⟩ + +theorem SupportedCube.map_injective {φ : A →+ B} {Q : Set A} + (hφ : Set.InjOn φ Q) (j : ℕ) : + Function.Injective (SupportedCube.map φ : SupportedCube j Q → _) := by + intro p q he + have hb : φ p.val.2 = φ q.val.2 := congrArg (fun r ↦ r.val.2) he + have hx : p.val.2 = q.val.2 := hφ p.base_mem q.base_mem hb + have hh (i : Fin j) : φ (p.val.1 i) = φ (q.val.1 i) := + congrArg (fun r ↦ r.val.1 i) he + have hi (i : Fin j) : p.val.1 i = q.val.1 i := by + have hv := hφ (p.axis_mem i) (q.axis_mem i) (by simp only [map_add, hb, hh]) + rw [hx] at hv + exact add_left_cancel hv + apply Subtype.ext + exact Prod.ext (funext hi) hx + +theorem exists_lift_cube {φ : A →+ B} {Q : Set A} (hφ : ReflectsPairSums φ Q) + (j : ℕ) (x : B) (hs : Fin j → B) + (hQ : ∀ ω : Fin j → Bool, x + cubeShift hs ω ∈ φ '' Q) : + ∃ a : A, ∃ ds : Fin j → A, + (∀ ω : Fin j → Bool, a + cubeShift ds ω ∈ Q) ∧ φ a = x ∧ ∀ i, φ (ds i) = hs i := by + induction j generalizing x with + | zero => + obtain ⟨a, ha, he⟩ := hQ (fun _ ↦ false) + refine ⟨a, (fun i ↦ Fin.elim0 i), ?_, ?_, fun i ↦ Fin.elim0 i⟩ + · intro ω + simpa [cubeShift] using ha + · simpa using he + | succ j ih => + have hface : ∀ ω : Fin j → Bool, x + cubeShift (Fin.tail hs) ω ∈ φ '' Q := by + intro ω + have hv := hQ (Fin.cons false ω) + rw [← Fin.cons_self_tail hs, cubeShift_cons_false] at hv + exact hv + obtain ⟨a, ds, hds, ha, hmap⟩ := ih x (Fin.tail hs) hface + obtain ⟨b, hb, hbmap⟩ := hQ (Fin.cons true (fun _ ↦ false)) + rw [← Fin.cons_self_tail hs, cubeShift_cons_true, cubeShift_false, add_zero] at hbmap + have hamem : a ∈ Q := by simpa using hds (fun _ ↦ false) + have hdmap : φ (b - a) = hs 0 := by rw [map_sub, hbmap, ha]; abel + refine ⟨a, Fin.cons (b - a) ds, ?_, ha, ?_⟩ + · intro ω + rw [← Fin.cons_self_tail ω] + cases hω : ω 0 with + | false => simpa only [cubeShift_cons_false] using hds (Fin.tail ω) + | true => + rw [cubeShift_cons_true] + obtain ⟨c, hc, hcmap⟩ := hQ (Fin.cons true (Fin.tail ω)) + rw [← Fin.cons_self_tail hs, cubeShift_cons_true] at hcmap + have hpair : (a + cubeShift ds (Fin.tail ω)) + b = c + a := by + apply hφ _ (hds (Fin.tail ω)) b hb c hc a hamem + simp only [map_add, map_cubeShift, hmap, hbmap, hcmap, ha] + abel + have he : a + (b - a + cubeShift ds (Fin.tail ω)) = c := by + apply add_right_cancel (b := a) + calc + (a + (b - a + cubeShift ds (Fin.tail ω))) + a = + (a + cubeShift ds (Fin.tail ω)) + b := by abel + _ = c + a := hpair + rwa [he] + · intro i + refine Fin.cases ?_ (fun k ↦ ?_) i + · exact hdmap + · exact hmap k + +theorem SupportedCube.map_surjective {φ : A →+ B} {Q : Set A} + (hφ : ReflectsPairSums φ Q) (j : ℕ) : + Function.Surjective (SupportedCube.map φ : SupportedCube j Q → _) := by + intro p + obtain ⟨a, ds, hds, ha, hmap⟩ := exists_lift_cube hφ j p.val.2 p.val.1 p.property + refine ⟨⟨(ds, a), hds⟩, ?_⟩ + apply Subtype.ext + exact Prod.ext (funext hmap) ha + +noncomputable def supportedCubeEquiv {φ : A →+ B} {Q : Set A} + (hφ : ReflectsPairSums φ Q) (j : ℕ) : SupportedCube j Q ≃ SupportedCube j (φ '' Q) := + Equiv.ofBijective (SupportedCube.map φ) ⟨SupportedCube.map_injective hφ.injOn j, + SupportedCube.map_surjective hφ j⟩ + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A : Type*} [AddCommGroup A] + +def SupportedCube.points {j : ℕ} {Q : Set A} (p : SupportedCube j Q) : Q × (Fin j → Q) := + (⟨p.val.2, p.base_mem⟩, fun i ↦ ⟨p.val.2 + p.val.1 i, p.axis_mem i⟩) + +theorem SupportedCube.points_injective (j : ℕ) (Q : Set A) : + Function.Injective (SupportedCube.points : SupportedCube j Q → _) := by + intro p q he + have hx : p.val.2 = q.val.2 := congrArg (fun r ↦ r.1.val) he + have hd (i : Fin j) : p.val.1 i = q.val.1 i := by + have hi : p.val.2 + p.val.1 i = q.val.2 + q.val.1 i := + congrArg (fun r ↦ (r.2 i).val) he + rw [hx] at hi + exact add_left_cancel hi + apply Subtype.ext + exact Prod.ext (funext hd) hx + +instance supportedCubeFinite (j : ℕ) (Q : Set A) [Finite Q] : Finite (SupportedCube j Q) := + Finite.of_injective SupportedCube.points (SupportedCube.points_injective j Q) + +noncomputable instance supportedCubeFintype (j : ℕ) (Q : Set A) [Finite Q] : + Fintype (SupportedCube j Q) := Fintype.ofFinite _ + +noncomputable def supportedCubeSum (j : ℕ) (Q : Set A) [Finite Q] + (F : (Fin j → Bool) → A → ℂ) : ℂ := + ∑ p : SupportedCube j Q, mixedCubeProduct F p.val.1 p.val.2 + +section FiniteAmbient + +variable [Fintype A] [DecidableEq A] + +noncomputable def supportedCubeFinsetEquiv (j : ℕ) (Q : Finset A) : + SupportedCube j (Q : Set A) ≃ (groupCubeSet j Q) := + Equiv.subtypeEquivRight (fun p ↦ by simp [groupCubeSet]) + +theorem card_supportedCube (j : ℕ) (Q : Finset A) : + Nat.card (SupportedCube j (Q : Set A)) = groupCubeCount j Q := by + rw [Nat.card_congr (supportedCubeFinsetEquiv j Q), Nat.card_eq_fintype_card] + exact Fintype.card_coe _ + +theorem supportedCubeSum_eq_sum (j : ℕ) (Q : Finset A) (F : (Fin j → Bool) → A → ℂ) : + supportedCubeSum j (Q : Set A) F = + ∑ p ∈ groupCubeSet j Q, mixedCubeProduct F p.1 p.2 := by + exact (Finset.sum_subtype (groupCubeSet j Q) (fun p ↦ by simp [groupCubeSet]) + (fun p ↦ mixedCubeProduct F p.1 p.2)).symm + +omit [Fintype A] in +theorem mixedCubeProduct_restrictTo {j : ℕ} (Q : Finset A) + (F : (Fin j → Bool) → A → ℂ) (hs : Fin j → A) (x : A) : + mixedCubeProduct (fun ω ↦ restrictTo Q (F ω)) hs x = + if ∀ ω : Fin j → Bool, x + cubeShift hs ω ∈ Q then mixedCubeProduct F hs x else 0 := by + classical + by_cases hall : ∀ ω : Fin j → Bool, x + cubeShift hs ω ∈ Q + · rw [ite_eq_left hall] + unfold mixedCubeProduct + apply Finset.prod_congr rfl + intro ω hω + simp only [restrictTo, ite_eq_left (hall ω)] + · rw [ite_eq_right hall] + obtain ⟨ω, hω⟩ := not_forall.mp hall + unfold mixedCubeProduct + apply Finset.prod_eq_zero (Finset.mem_univ ω) + simp only [restrictTo, ite_eq_right hω, map_zero] + +theorem mixedGowersMoment_restrict_eq_supportedCubeSum (j : ℕ) (Q : Finset A) + (F : (Fin j → Bool) → A → ℂ) : + mixedGowersMoment j (fun ω ↦ restrictTo Q (F ω)) = + supportedCubeSum j (Q : Set A) F / (Fintype.card A : ℂ) ^ (j + 1) := by + classical + rw [mixedGowersMoment_eq_expect_cube] + simp_rw [mixedCubeProduct_restrictTo] + rw [← Finset.expect_product', Finset.univ_product_univ, + Fintype.expect_eq_sum_div_card, supportedCubeSum_eq_sum] + have hc : (Fintype.card ((Fin j → A) × A) : ℂ) = (Fintype.card A : ℂ) ^ (j + 1) := by + simp [pow_succ] + rw [hc] + congr 1 + simp [groupCubeSet, Finset.sum_filter] + +end FiniteAmbient + +variable [DecidableEq A] + +theorem supportedCubeSum_eq_tsum (j : ℕ) (Q : Finset A) (F : (Fin j → Bool) → A → ℂ) : + supportedCubeSum j (Q : Set A) F = + ∑' p : (Fin j → A) × A, mixedCubeProduct (fun ω ↦ restrictTo Q (F ω)) p.1 p.2 := by + classical + unfold supportedCubeSum + rw [← tsum_fintype (L := SummationFilter.unconditional _)] + change (∑' b : {p : (Fin j → A) × A // ∀ ω : Fin j → Bool, p.2 + cubeShift p.1 ω ∈ Q}, + mixedCubeProduct F b.val.1 b.val.2) = _ + calc + _ = ∑' p : (Fin j → A) × A, + if ∀ ω : Fin j → Bool, p.2 + cubeShift p.1 ω ∈ Q then + mixedCubeProduct F p.1 p.2 else 0 := by + convert! (tsum_subtype + {p : (Fin j → A) × A | ∀ ω : Fin j → Bool, p.2 + cubeShift p.1 ω ∈ Q} + (fun p ↦ mixedCubeProduct F p.1 p.2)) using 1 + simp only [Set.indicator_apply, Set.mem_ofPred_eq] + _ = _ := tsum_congr (fun p ↦ (mixedCubeProduct_restrictTo Q F p.1 p.2).symm) + +omit [DecidableEq A] in +theorem card_supportedCube_le (j : ℕ) (Q : Finset A) : + Nat.card (SupportedCube j (Q : Set A)) ≤ Q.card ^ (j + 1) := by + have h := Nat.card_le_card_of_injective SupportedCube.points + (SupportedCube.points_injective j (Q : Set A)) + simpa [Nat.card_eq_fintype_card, pow_succ, mul_comm] using h + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A B : Type*} [AddCommGroup A] [AddCommGroup B] + +noncomputable def imageExtension (φ : A →+ B) (Q : Finset A) (f : A → ℂ) : B → ℂ := by + classical + exact fun y ↦ ∑ a ∈ Q, if φ a = y then f a else 0 + +theorem imageExtension_apply {φ : A →+ B} {Q : Finset A} (hi : Set.InjOn φ (Q : Set A)) + (f : A → ℂ) {a : A} (ha : a ∈ Q) : imageExtension φ Q f (φ a) = f a := by + classical + unfold imageExtension + rw [Finset.sum_eq_single a] + · simp + · intro b hb hba + exact ite_eq_right (fun he ↦ hba (hi hb ha he)) + · intro hna + exact (hna ha).elim + +theorem imageExtension_eq_zero {φ : A →+ B} {Q : Finset A} (f : A → ℂ) {y : B} + (hy : y ∉ φ '' (Q : Set A)) : imageExtension φ Q f y = 0 := by + classical + apply Finset.sum_eq_zero + intro a ha + exact ite_eq_right (fun he ↦ hy ⟨a, ha, he⟩) + +theorem mixedCubeProduct_imageExtension {φ : A →+ B} {Q : Finset A} + (hi : Set.InjOn φ (Q : Set A)) {j : ℕ} (F : (Fin j → Bool) → A → ℂ) + (p : SupportedCube j (Q : Set A)) : + mixedCubeProduct (fun ω ↦ imageExtension φ Q (F ω)) + (fun i ↦ φ (p.val.1 i)) (φ p.val.2) = mixedCubeProduct F p.val.1 p.val.2 := by + unfold mixedCubeProduct + apply Finset.prod_congr rfl + intro ω hω + rw [← map_cubeShift, ← map_add] + exact congrArg (conjugationPower (booleanWeight ω)) + (imageExtension_apply hi (F ω) (p.property ω)) + +variable [Fintype B] [DecidableEq B] + +omit [Fintype B] in +theorem restrictTo_imageExtension (φ : A →+ B) (Q : Finset A) (f : A → ℂ) : + restrictTo (Q.image φ) (imageExtension φ Q f) = imageExtension φ Q f := by + classical + funext y + by_cases hy : y ∈ Q.image φ + · simp only [restrictTo, ite_eq_left hy] + · rw [restrictTo, ite_eq_right hy] + exact (imageExtension_eq_zero f (by + rintro ⟨a, ha, he⟩ + exact hy (Finset.mem_image.mpr ⟨a, ha, he⟩))).symm + +omit [Fintype B] [DecidableEq B] in +theorem supportedCubeSum_imageExtension {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (F : (Fin j → Bool) → A → ℂ) : + supportedCubeSum j (φ '' (Q : Set A)) (fun ω ↦ imageExtension φ Q (F ω)) = + supportedCubeSum j (Q : Set A) F := by + classical + symm + apply Fintype.sum_equiv (supportedCubeEquiv hφ j) + intro p + exact (mixedCubeProduct_imageExtension hφ.injOn F p).symm + +theorem mixedGowersMoment_imageExtension {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (F : (Fin j → Bool) → A → ℂ) : + mixedGowersMoment j (fun ω ↦ imageExtension φ Q (F ω)) = + supportedCubeSum j (Q : Set A) F / (Fintype.card B : ℂ) ^ (j + 1) := by + classical + have hr : (fun ω ↦ imageExtension φ Q (F ω)) = + (fun ω ↦ restrictTo (Q.image φ) (imageExtension φ Q (F ω))) := by + funext ω + exact (restrictTo_imageExtension φ Q (F ω)).symm + rw [hr, mixedGowersMoment_restrict_eq_supportedCubeSum] + simp only [Finset.coe_image, supportedCubeSum_imageExtension hφ] + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A : Type*} [AddCommGroup A] [DecidableEq A] + +def cubeDifferenceSupport (Q : Finset A) : Finset A := + (Q ×ˢ Q).image (fun p ↦ p.2 - p.1) + +theorem mem_cubeDifferenceSupport (Q : Finset A) (h : A) : + h ∈ cubeDifferenceSupport Q ↔ (derivativeSupport Q h).Nonempty := by + constructor + · intro hh + obtain ⟨⟨x, y⟩, hp, rfl⟩ := Finset.mem_image.mp hh + obtain ⟨hx, hy⟩ := Finset.mem_product.mp hp + refine ⟨x, Finset.mem_filter.mpr ⟨hx, ?_⟩⟩ + simpa using hy + · rintro ⟨x, hx⟩ + obtain ⟨hx, hxh⟩ := Finset.mem_filter.mp hx + exact Finset.mem_image.mpr ⟨(x, x + h), Finset.mem_product.mpr ⟨hx, hxh⟩, by simp⟩ + +theorem SupportedCube.first_mem_difference {j : ℕ} {Q : Finset A} + (p : SupportedCube (j + 1) (Q : Set A)) : p.val.1 0 ∈ cubeDifferenceSupport Q := + Finset.mem_image.mpr ⟨(p.val.2, p.val.2 + p.val.1 0), + Finset.mem_product.mpr ⟨p.base_mem, p.axis_mem 0⟩, by simp⟩ + +def SupportedCube.tail {j : ℕ} {Q : Finset A} (p : SupportedCube (j + 1) (Q : Set A)) : + SupportedCube j (derivativeSupport Q (p.val.1 0) : Set A) := by + refine ⟨(Fin.tail p.val.1, p.val.2), ?_⟩ + intro ω + apply Finset.mem_filter.mpr + have hfalse := p.property (Fin.cons false ω) + have htrue := p.property (Fin.cons true ω) + rw [← Fin.cons_self_tail p.val.1, cubeShift_cons_false] at hfalse + rw [← Fin.cons_self_tail p.val.1, cubeShift_cons_true] at htrue + exact ⟨hfalse, by simpa only [Finset.mem_coe, add_assoc, add_left_comm, add_comm] using htrue⟩ + +def SupportedCube.cons {j : ℕ} {Q : Finset A} (h : A) + (p : SupportedCube j (derivativeSupport Q h : Set A)) : SupportedCube (j + 1) (Q : Set A) := by + refine ⟨(Fin.cons h p.val.1, p.val.2), ?_⟩ + intro ω + obtain ⟨hfalse, htrue⟩ := Finset.mem_filter.mp (p.property (Fin.tail ω)) + rw [← Fin.cons_self_tail ω] + cases ω 0 with + | false => simpa only [Finset.mem_coe, cubeShift_cons_false] using hfalse + | true => simpa only [Finset.mem_coe, cubeShift_cons_true, add_assoc, add_left_comm, add_comm] using htrue + +def supportedCubeDerivativeEquiv (j : ℕ) (Q : Finset A) : + SupportedCube (j + 1) (Q : Set A) ≃ + Σ h : cubeDifferenceSupport Q, SupportedCube j (derivativeSupport Q h.val : Set A) where + toFun p := ⟨⟨p.val.1 0, p.first_mem_difference⟩, p.tail⟩ + invFun p := p.2.cons p.1.val + left_inv p := by + apply Subtype.ext + change (Fin.cons (p.val.1 0) (Fin.tail p.val.1), p.val.2) = p.val + rw [Fin.cons_self_tail] + right_inv p := by + rcases p with ⟨h, p⟩ + rfl + +theorem card_supportedCube_succ (j : ℕ) (Q : Finset A) : + Nat.card (SupportedCube (j + 1) (Q : Set A)) = + ∑ h ∈ cubeDifferenceSupport Q, Nat.card (SupportedCube j (derivativeSupport Q h : Set A)) := by + rw [Nat.card_congr (supportedCubeDerivativeEquiv j Q)] + simp only [Nat.card_eq_fintype_card, Fintype.card_sigma] + exact Finset.sum_coe_sort (cubeDifferenceSupport Q) + (fun h ↦ Fintype.card (SupportedCube j (derivativeSupport Q h : Set A))) + +theorem supportedCubeSum_derivative (j : ℕ) (Q : Finset A) + (F : (Fin (j + 1) → Bool) → A → ℂ) : + supportedCubeSum (j + 1) (Q : Set A) F = + ∑ h ∈ cubeDifferenceSupport Q, supportedCubeSum j (derivativeSupport Q h : Set A) + (fun ω ↦ crossDerivative (F (Fin.cons false ω)) (F (Fin.cons true ω)) h) := by + let he := (supportedCubeDerivativeEquiv j Q).symm + calc + _ = ∑ p : Σ h : cubeDifferenceSupport Q, + SupportedCube j (derivativeSupport Q h.val : Set A), + mixedCubeProduct F (Fin.cons p.1.val p.2.val.1) p.2.val.2 := by + symm + apply Fintype.sum_equiv he + intro p + rfl + _ = _ := by + simp only [Fintype.sum_sigma, mixedCubeProduct_cons, + ← mixedCubeProduct_crossDerivative, supportedCubeSum] + exact Finset.sum_coe_sort (cubeDifferenceSupport Q) + (fun h ↦ supportedCubeSum j (derivativeSupport Q h : Set A) + (fun ω ↦ crossDerivative (F (Fin.cons false ω)) (F (Fin.cons true ω)) h)) + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A B : Type*} [AddCommGroup A] [AddCommGroup B] + +noncomputable def finiteSupportGowersNorm (j : ℕ) (Q : Finset A) (f : A → ℂ) : ℝ := + ((supportedCubeSum j (Q : Set A) (fun _ ↦ f)).re / + Nat.card (SupportedCube j (Q : Set A))) ^ (((2 ^ j : ℕ) : ℝ)⁻¹) + +theorem supportedCubeSum_one (j : ℕ) (Q : Finset A) : + supportedCubeSum j (Q : Set A) (fun _ _ ↦ 1) = + (Nat.card (SupportedCube j (Q : Set A)) : ℂ) := by + classical + simp [supportedCubeSum, mixedCubeProduct, Nat.card_eq_fintype_card] + +theorem finiteSupportGowersNorm_one (j : ℕ) {Q : Finset A} (hQ : Q.Nonempty) : + finiteSupportGowersNorm j Q (fun _ ↦ 1) = 1 := by + classical + obtain ⟨a, ha⟩ := hQ + let : Nonempty (SupportedCube j (Q : Set A)) := + ⟨⟨((fun _ ↦ 0), a), fun ω ↦ by simpa [cubeShift] using ha⟩⟩ + have hcard : (Nat.card (SupportedCube j (Q : Set A)) : ℝ) ≠ 0 := by + exact_mod_cast Nat.card_pos.ne' + simp only [finiteSupportGowersNorm, supportedCubeSum_one, Complex.natCast_re, + div_self hcard, Real.one_rpow] + +theorem imageExtension_add (φ : A →+ B) (Q : Finset A) (f g : A → ℂ) : + imageExtension φ Q (fun x ↦ f x + g x) = + (fun y ↦ imageExtension φ Q f y + imageExtension φ Q g y) := by + classical + funext y + simp only [imageExtension, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro x hx + split_ifs <;> simp + +variable [Fintype B] [DecidableEq B] + +theorem card_supportedCube_image {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) : + Nat.card (SupportedCube j (Q : Set A)) = groupCubeCount j (Q.image φ) := by + classical + rw [Nat.card_congr (supportedCubeEquiv hφ j)] + simpa only [Finset.coe_image] using card_supportedCube j (Q.image φ) + +theorem gowersMoment_imageExtension_re {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (f : A → ℂ) : + (gowersMoment j (imageExtension φ Q f)).re = + (supportedCubeSum j (Q : Set A) (fun _ ↦ f)).re / + (Fintype.card B : ℝ) ^ (j + 1) := by + have hm := congrArg Complex.re (mixedGowersMoment_imageExtension hφ j (fun _ ↦ f)) + simpa only [mixedGowersMoment_const, ← Nat.cast_pow, Complex.div_natCast_re] using hm + +theorem restrictedGowersNorm_imageExtension_pow {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (f : A → ℂ) : + restrictedGowersNorm (j + 1) (Q.image φ) (imageExtension φ Q f) ^ (2 ^ (j + 1)) = + (supportedCubeSum (j + 1) (Q : Set A) (fun _ ↦ f)).re / + Nat.card (SupportedCube (j + 1) (Q : Set A)) := by + simp only [restrictedGowersNorm, div_pow, gowersNorm_pow, + restrictTo_imageExtension, gowersMoment_imageExtension_re hφ, gowersMoment_indicator_re] + rw [← card_supportedCube_image hφ] + exact div_div_div_cancel_right₀ + (pow_ne_zero _ (by exact_mod_cast Fintype.card_ne_zero : (Fintype.card B : ℝ) ≠ 0)) _ _ + +theorem finiteSupportGowersNorm_eq_restricted {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (f : A → ℂ) : + finiteSupportGowersNorm (j + 1) Q f = + restrictedGowersNorm (j + 1) (Q.image φ) (imageExtension φ Q f) := by + unfold finiteSupportGowersNorm + rw [← restrictedGowersNorm_imageExtension_pow hφ] + exact Real.pow_rpow_inv_natCast (restrictedGowersNorm_nonneg j _ _) + (pow_ne_zero _ (by norm_num : (2 : ℕ) ≠ 0)) + +theorem finiteSupportGowersNorm_add_of_embedding {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (f g : A → ℂ) : + finiteSupportGowersNorm (j + 1) Q (fun x ↦ f x + g x) ≤ + finiteSupportGowersNorm (j + 1) Q f + finiteSupportGowersNorm (j + 1) Q g := by + simp only [finiteSupportGowersNorm_eq_restricted hφ, imageExtension_add] + exact restrictedGowersNorm_add j _ _ _ + +theorem norm_supportedCubeSum_le_of_embedding {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (F : (Fin (j + 1) → Bool) → A → ℂ) : + ‖supportedCubeSum (j + 1) (Q : Set A) F‖ / + Nat.card (SupportedCube (j + 1) (Q : Set A)) ≤ + ∏ ω, finiteSupportGowersNorm (j + 1) Q (F ω) := by + have h := norm_mixedGowersMoment_restrict_le j (Q.image φ) + (fun ω ↦ imageExtension φ Q (F ω)) + simp only [restrictTo_imageExtension, mixedGowersMoment_imageExtension hφ, + norm_div, norm_pow, Complex.norm_natCast, gowersMoment_indicator_re, + ← card_supportedCube_image hφ, ← finiteSupportGowersNorm_eq_restricted hφ] at h + rwa [div_div_div_cancel_right₀ + (pow_ne_zero _ (by exact_mod_cast Fintype.card_ne_zero : (Fintype.card B : ℝ) ≠ 0))] at h + +theorem finiteSupportGowersNorm_ambient_comparison {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (f : A → ℂ) : + gowersNorm (j + 1) (imageExtension φ Q f) ^ (2 ^ (j + 1)) = + ((Nat.card (SupportedCube (j + 1) (Q : Set A)) : ℝ) / + (Fintype.card B : ℝ) ^ (j + 2)) * finiteSupportGowersNorm (j + 1) Q f ^ (2 ^ (j + 1)) := by + have h := gowersNorm_restrict_cubeCount j (Q.image φ) (imageExtension φ Q f) + simpa only [restrictTo_imageExtension, ← card_supportedCube_image hφ, + ← finiteSupportGowersNorm_eq_restricted hφ] using h + +theorem finiteSupportGowersNorm_degree_one_of_embedding {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (hQ : Q.Nonempty) (f : A → ℂ) : + finiteSupportGowersNorm 1 Q f = ‖𝔼 x ∈ Q, f x‖ := by + classical + rw [finiteSupportGowersNorm_eq_restricted hφ 0, + restrictedGowersNorm_degree_one (hQ.image φ)] + simp only [Finset.expect_eq_sum_div_card] + rw [Finset.card_image_of_injOn hφ.injOn, Finset.sum_image] + · congr 2 + apply Finset.sum_congr rfl + intro x hx + exact imageExtension_apply hφ.injOn f hx + · exact hφ.injOn + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A B : Type*} [AddCommGroup A] [AddCommGroup B] + +theorem ReflectsPairSums.mono {φ : A →+ B} {Q R : Set A} + (hφ : ReflectsPairSums φ Q) (hRQ : R ⊆ Q) : ReflectsPairSums φ R := by + intro a ha b hb c hc d hd he + exact hφ a (hRQ ha) b (hRQ hb) c (hRQ hc) d (hRQ hd) he + +theorem card_supportedCube_pos (j : ℕ) {Q : Finset A} (hQ : Q.Nonempty) : + 0 < Nat.card (SupportedCube j (Q : Set A)) := by + obtain ⟨a, ha⟩ := hQ + let : Nonempty (SupportedCube j (Q : Set A)) := + ⟨⟨((fun _ ↦ 0), a), fun ω ↦ by simpa [cubeShift] using ha⟩⟩ + exact Nat.card_pos + +variable [DecidableEq A] + +theorem sum_supportedCube_weights (j : ℕ) {Q : Finset A} (hQ : Q.Nonempty) : + (∑ h ∈ cubeDifferenceSupport Q, + (Nat.card (SupportedCube j (derivativeSupport Q h : Set A)) : ℝ) / + Nat.card (SupportedCube (j + 1) (Q : Set A))) = 1 := by + rw [← Finset.sum_div, ← Nat.cast_sum, ← card_supportedCube_succ] + exact div_self (by exact_mod_cast (card_supportedCube_pos (j + 1) hQ).ne') + +variable [Fintype B] [DecidableEq B] + +omit [DecidableEq A] in +theorem finiteSupportGowersNorm_pow_mul_count {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (hQ : Q.Nonempty) (j : ℕ) (f : A → ℂ) : + (Nat.card (SupportedCube (j + 1) (Q : Set A)) : ℝ) * + finiteSupportGowersNorm (j + 1) Q f ^ (2 ^ (j + 1)) = + (supportedCubeSum (j + 1) (Q : Set A) (fun _ ↦ f)).re := by + rw [finiteSupportGowersNorm_eq_restricted hφ, restrictedGowersNorm_imageExtension_pow hφ] + have hC : (Nat.card (SupportedCube (j + 1) (Q : Set A)) : ℝ) ≠ 0 := by + exact_mod_cast (card_supportedCube_pos (j + 1) hQ).ne' + field_simp + +theorem finiteSupportGowersNorm_derivative_mul_count {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (hQ : Q.Nonempty) (j : ℕ) (f : A → ℂ) : + (Nat.card (SupportedCube (j + 2) (Q : Set A)) : ℝ) * + finiteSupportGowersNorm (j + 2) Q f ^ (2 ^ (j + 2)) = + ∑ h ∈ cubeDifferenceSupport Q, + (Nat.card (SupportedCube (j + 1) (derivativeSupport Q h : Set A)) : ℝ) * + finiteSupportGowersNorm (j + 1) (derivativeSupport Q h) + (multiplicativeDerivative f h) ^ (2 ^ (j + 1)) := by + rw [finiteSupportGowersNorm_pow_mul_count hφ hQ] + have he := congrArg Complex.re (supportedCubeSum_derivative (j + 1) Q (fun _ ↦ f)) + simp only [crossDerivative_self, Complex.re_sum] at he + rw [he] + apply Finset.sum_congr rfl + intro h hh + have hφh : ReflectsPairSums φ (derivativeSupport Q h : Set A) := + hφ.mono (fun _ hx ↦ (Finset.mem_filter.mp hx).1) + exact (finiteSupportGowersNorm_pow_mul_count hφh + ((mem_cubeDifferenceSupport Q h).mp hh) j (multiplicativeDerivative f h)).symm + +theorem finiteSupportGowersNorm_derivative {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (hQ : Q.Nonempty) (j : ℕ) (f : A → ℂ) : + finiteSupportGowersNorm (j + 2) Q f ^ (2 ^ (j + 2)) = + ∑ h ∈ cubeDifferenceSupport Q, + ((Nat.card (SupportedCube (j + 1) (derivativeSupport Q h : Set A)) : ℝ) / + Nat.card (SupportedCube (j + 2) (Q : Set A))) * + finiteSupportGowersNorm (j + 1) (derivativeSupport Q h) + (multiplicativeDerivative f h) ^ (2 ^ (j + 1)) := by + have hC : (Nat.card (SupportedCube (j + 2) (Q : Set A)) : ℝ) ≠ 0 := by + exact_mod_cast (card_supportedCube_pos (j + 2) hQ).ne' + calc + _ = ((Nat.card (SupportedCube (j + 2) (Q : Set A)) : ℝ) * + finiteSupportGowersNorm (j + 2) Q f ^ (2 ^ (j + 2))) / + Nat.card (SupportedCube (j + 2) (Q : Set A)) := by field_simp + _ = _ := by + rw [finiteSupportGowersNorm_derivative_mul_count hφ hQ, Finset.sum_div] + simp only [div_mul_eq_mul_div] + +end Erdos3 + +end + +section + +open scoped BigOperators + +namespace Erdos3 + +variable {A B : Type*} [AddCommGroup A] [AddCommGroup B] + +theorem supportedCubeSum_congr_on (j : ℕ) (Q : Finset A) + (F G : (Fin j → Bool) → A → ℂ) (h : ∀ ω x, x ∈ Q → F ω x = G ω x) : + supportedCubeSum j (Q : Set A) F = supportedCubeSum j (Q : Set A) G := by + unfold supportedCubeSum + apply Finset.sum_congr rfl + intro p _ + unfold mixedCubeProduct + apply Finset.prod_congr rfl + intro ω _ + rw [h ω _ (p.property ω)] + +theorem finiteSupportGowersNorm_congr_on (j : ℕ) (Q : Finset A) (f g : A → ℂ) + (h : ∀ x ∈ Q, f x = g x) : finiteSupportGowersNorm j Q f = finiteSupportGowersNorm j Q g := by + unfold finiteSupportGowersNorm + rw [supportedCubeSum_congr_on j Q (fun _ => f) (fun _ => g) (fun _ => h)] + +theorem reflectsPairSums_of_addEquiv (e : A ≃+ B) (Q : Set A) : + ReflectsPairSums e.toAddMonoidHom Q := by + intro a ha b hb c hc d hd he + change e a + e b = e c + e d at he + apply e.injective + exact (map_add e a b).trans (he.trans (map_add e c d).symm) + +theorem card_supportedCube_image_eq [DecidableEq B] {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) : + Nat.card (SupportedCube j (Q.image φ : Set B)) = Nat.card (SupportedCube j (Q : Set A)) := by + simpa only [Finset.coe_image] using (Nat.card_congr (supportedCubeEquiv hφ j)).symm + +theorem finiteSupportGowersNorm_imageExtension [DecidableEq B] {φ : A →+ B} {Q : Finset A} + (hφ : ReflectsPairSums φ (Q : Set A)) (j : ℕ) (f : A → ℂ) : + finiteSupportGowersNorm j (Q.image φ) (imageExtension φ Q f) = finiteSupportGowersNorm j Q f := by + unfold finiteSupportGowersNorm + rw [card_supportedCube_image_eq hφ] + simp only [Finset.coe_image, supportedCubeSum_imageExtension hφ] + +theorem finiteSupportGowersNorm_addEquiv [DecidableEq B] (e : A ≃+ B) + (j : ℕ) (Q : Finset A) (f : B → ℂ) : + finiteSupportGowersNorm j (Q.image e) f = finiteSupportGowersNorm j Q (fun x => f (e x)) := by + have hφ := reflectsPairSums_of_addEquiv e (Q : Set A) + calc + _ = finiteSupportGowersNorm j (Q.image e) (imageExtension e.toAddMonoidHom Q (fun x => f (e x))) := by + apply finiteSupportGowersNorm_congr_on + intro y hy + obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp hy + exact (imageExtension_apply hφ.injOn (fun x => f (e x)) hx).symm + _ = _ := finiteSupportGowersNorm_imageExtension hφ j _ + +theorem finiteCorrelation_addEquiv [DecidableEq B] (e : A ≃+ B) + (Q : Finset A) (f g : B → ℂ) : + finiteCorrelation (Q.image e) f g = finiteCorrelation Q (fun x => f (e x)) (fun x => g (e x)) := by + unfold finiteCorrelation + exact Finset.expect_image e.injective.injOn + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCubeUnitBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCubeUnitBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc00e05de2d2e6738b15c6cb5b2e76bf1f0bfa07 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedCubeUnitBounds.lean @@ -0,0 +1,67 @@ +import OAI.Combinatorics.Progressions.Estimates.SampledCommonSlice + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem normalizedSupportedCubeSum_norm_le_one {A : Type*} [AddCommGroup A] + (j : ℕ) (Q : Finset A) (F : (Fin j → Bool) → A → ℂ) + (hF : ∀ ω x, x ∈ Q → ‖F ω x‖ ≤ 1) : + ‖normalizedSupportedCubeSum j Q F‖ ≤ 1 := by + have hprod (c : SupportedCube j (Q : Set A)) : + ‖mixedCubeProduct F c.val.1 c.val.2‖ ≤ 1 := by + simp only [mixedCubeProduct, norm_prod, conjugationPower_norm] + exact Finset.prod_le_one₀ (fun _ _ => norm_nonneg _) (fun ω _ => hF ω _ (c.property ω)) + have hsum : ‖supportedCubeSum j (Q : Set A) F‖ ≤ + (Nat.card (SupportedCube j (Q : Set A)) : ℝ) := by + apply (norm_sum_le _ _).trans + simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one, + Nat.card_eq_fintype_card] using Finset.sum_le_sum (fun c (_ : c ∈ Finset.univ) => hprod c) + rw [normalizedSupportedCubeSum, norm_div, Complex.norm_natCast] + by_cases hc : Nat.card (SupportedCube j (Q : Set A)) = 0 + · simp only [hc, Nat.cast_zero, div_zero, zero_le_one] + · have hpos : (0 : ℝ) < Nat.card (SupportedCube j (Q : Set A)) := by + exact_mod_cast Nat.pos_of_ne_zero hc + exact (div_le_iff₀ hpos).mpr (by simpa only [one_mul] using hsum) + +theorem finiteSupportGowersNorm_le_one_of_embedding + {A B : Type*} [AddCommGroup A] [AddCommGroup B] [Fintype B] [DecidableEq B] + {φ : A →+ B} {Q : Finset A} (hφ : ReflectsPairSums φ (Q : Set A)) + (j : ℕ) (f : A → ℂ) (hf : ∀ x ∈ Q, ‖f x‖ ≤ 1) : + finiteSupportGowersNorm (j + 1) Q f ≤ 1 := by + apply le_of_pow_le_pow_left₀ (pow_ne_zero _ (by norm_num : (2 : ℕ) ≠ 0)) zero_le_one + rw [one_pow, ← normalizedSupportedCubeSum_self_re hφ] + exact (Complex.re_le_norm _).trans + (normalizedSupportedCubeSum_norm_le_one (j + 1) Q (fun _ => f) (fun _ => hf)) + +theorem normalizedSupportedCubeSum_le_vertex + {A B : Type*} [AddCommGroup A] [AddCommGroup B] [Fintype B] [DecidableEq B] + {φ : A →+ B} {Q : Finset A} (hφ : ReflectsPairSums φ (Q : Set A)) + (j : ℕ) (F : (Fin (j + 1) → Bool) → A → ℂ) + (hF : ∀ ω x, x ∈ Q → ‖F ω x‖ ≤ 1) (ω₀ : Fin (j + 1) → Bool) : + ‖normalizedSupportedCubeSum (j + 1) Q F‖ ≤ finiteSupportGowersNorm (j + 1) Q (F ω₀) := by + have hnonneg (ω) : 0 ≤ finiteSupportGowersNorm (j + 1) Q (F ω) := by + rw [finiteSupportGowersNorm_eq_restricted hφ] + exact restrictedGowersNorm_nonneg _ _ _ + have hprod : (∏ ω, finiteSupportGowersNorm (j + 1) Q (F ω)) ≤ + ∏ ω, if ω = ω₀ then finiteSupportGowersNorm (j + 1) Q (F ω₀) else 1 := by + apply Finset.prod_le_prod₀ (fun ω _ => hnonneg ω) + intro ω _ + split_ifs with h + · subst ω; exact le_rfl + · exact finiteSupportGowersNorm_le_one_of_embedding hφ j (F ω) (hF ω) + have hcs : ‖normalizedSupportedCubeSum (j + 1) Q F‖ ≤ + ∏ ω, finiteSupportGowersNorm (j + 1) Q (F ω) := by + simpa only [normalizedSupportedCubeSum, norm_div, Complex.norm_natCast] using + norm_supportedCubeSum_le_of_embedding hφ j F + exact hcs.trans (by simpa using hprod) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiberApproximation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiberApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c45f0011d04fa09b28db2c5316b463eabf49d2e2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiberApproximation.lean @@ -0,0 +1,170 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteGoodPartTransfer +import OAI.Combinatorics.Progressions.Probability.WeightedSupportedComplexMixture + +namespace OAI + +section + +namespace Erdos3.FiniteProbabilityWeights + +open MeasureTheory +open scoped BigOperators + +variable {X Y : Type*} [Fintype X] [MeasurableSpace Y] + +theorem complexMean_integrable_of_support (p : FiniteProbabilityWeights X) + (μ : Measure Y) (f : Y → X → ℂ) + (hf : ∀ x, p.weight x ≠ 0 → Integrable (fun y => f y x) μ) : + Integrable (fun y => p.complexMean (f y)) μ := by + apply integrable_finsetSum + intro x _ + by_cases hx : p.weight x = 0 + · simp only [hx, Complex.ofReal_zero, zero_mul, integrable_fun_zero] + · exact (hf x hx).const_mul (p.weight x : ℂ) + +theorem integral_complexMean_of_support (p : FiniteProbabilityWeights X) + (μ : Measure Y) (f : Y → X → ℂ) + (hf : ∀ x, p.weight x ≠ 0 → Integrable (fun y => f y x) μ) : + (∫ y, p.complexMean (f y) ∂μ) = p.complexMean (fun x => ∫ y, f y x ∂μ) := by + have hi (x : X) : Integrable (fun y => (p.weight x : ℂ) * f y x) μ := by + by_cases hx : p.weight x = 0 + · simp only [hx, Complex.ofReal_zero, zero_mul, integrable_fun_zero] + · exact (hf x hx).const_mul (p.weight x : ℂ) + unfold complexMean + rw [integral_finsetSum _ (fun x _ => hi x)] + simp only [integral_const_mul] + +end Erdos3.FiniteProbabilityWeights + +end + +section + +namespace Erdos3.FiniteProbabilityWeights + +open MeasureTheory +open scoped BigOperators Classical + +variable {X R Y : Type*} [Fintype X] [DecidableEq X] [Fintype R] [DecidableEq R] +variable [MeasurableSpace Y] + +theorem complexMean_supported_fiber_l1_error (p : FiniteProbabilityWeights X) (F : X → R) + (μ : Measure Y) (f : X → Y → ℂ) (target : R → Y → ℂ) (ε : R → ℝ) + (he : ∀ r (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))), + Integrable (fun y => (p.condition _ hr).complexMean (fun x => f x y) - target r y) μ ∧ + (∫ y, ‖(p.condition _ hr).complexMean (fun x => f x y) - target r y‖ ∂μ) ≤ ε r) : + Integrable (fun y => p.complexMean (fun x => f x y) - (p.fiberLaw F).complexMean (fun r => target r y)) μ ∧ + (∫ y, ‖p.complexMean (fun x => f x y) - (p.fiberLaw F).complexMean (fun r => target r y)‖ ∂μ) ≤ + (p.fiberLaw F).mean ε := by + let w := p.fiberLaw F + let D (r : R) (y : Y) : ℂ := p.fiberComplexMean F r (fun x => f x y) - (w.weight r : ℂ) * target r y + have hD (r : R) : Integrable (D r) μ ∧ (∫ y, ‖D r y‖ ∂μ) ≤ w.weight r * ε r := by + by_cases hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r)) + · have hw : w.weight r = p.mass (Finset.univ.filter (fun x => F x = r)) := + p.fiberLaw_weight_eq_mass F r + have hEq : D r = fun y => (w.weight r : ℂ) * + ((p.condition _ hr).complexMean (fun x => f x y) - target r y) := by + funext y + dsimp only [D] + rw [p.fiberComplexMean_eq_condition F r _ hr, ← hw, mul_sub] + rw [hEq] + refine ⟨(he r hr).1.const_mul (w.weight r : ℂ), ?_⟩ + simp_rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (w.nonneg r)] + rw [integral_const_mul] + exact mul_le_mul_of_nonneg_left (he r hr).2 (w.nonneg r) + · have hz : w.weight r = 0 := by + rw [p.fiberLaw_weight_eq_mass] + exact le_antisymm (le_of_not_gt hr) (p.mass_nonneg _) + have hEq : D r = fun _ => 0 := by + funext y + dsimp only [D] + rw [p.fiberComplexMean_zero F r hz, hz, Complex.ofReal_zero, zero_mul, sub_zero] + rw [hEq] + constructor + · exact integrable_fun_zero Y ℂ μ + · simp only [norm_zero, integral_zero, hz, zero_mul, le_refl] + have hEq : (fun y => p.complexMean (fun x => f x y) - w.complexMean (fun r => target r y)) = + (fun y => ∑ r, D r y) := by + funext y + have hs : p.complexMean (fun x => f x y) = ∑ r, p.fiberComplexMean F r (fun x => f x y) := by + simpa only [Finset.mem_univ, ite_true] using + (p.sum_fiberComplexMean_on F Finset.univ (fun x => f x y)).symm + rw [hs] + change (∑ r, p.fiberComplexMean F r (fun x => f x y)) - + (∑ r, (w.weight r : ℂ) * target r y) = ∑ r, D r y + rw [← Finset.sum_sub_distrib] + change Integrable (fun y => p.complexMean (fun x => f x y) - w.complexMean (fun r => target r y)) μ ∧ + (∫ y, ‖p.complexMean (fun x => f x y) - w.complexMean (fun r => target r y)‖ ∂μ) ≤ w.mean ε + have hpoint (y : Y) := congrFun hEq y + simp_rw [hpoint] + have hi : Integrable (fun y => ∑ r, D r y) μ := integrable_finsetSum _ (fun r _ => (hD r).1) + have hn : Integrable (fun y => ∑ r, ‖D r y‖) μ := integrable_finsetSum _ (fun r _ => (hD r).1.norm) + refine ⟨hi, ?_⟩ + calc + (∫ y, ‖∑ r, D r y‖ ∂μ) ≤ ∫ y, ∑ r, ‖D r y‖ ∂μ := + integral_mono hi.norm hn (fun y => norm_sum_le _ _) + _ = ∑ r, ∫ y, ‖D r y‖ ∂μ := integral_finsetSum _ (fun r _ => (hD r).1.norm) + _ ≤ ∑ r, w.weight r * ε r := Finset.sum_le_sum (fun r _ => (hD r).2) + _ = w.mean ε := rfl + +theorem complexMean_supported_fiber_l1_error_uniform (p : FiniteProbabilityWeights X) (F : X → R) + (μ : Measure Y) (f : X → Y → ℂ) (target : R → Y → ℂ) {ε : ℝ} + (he : ∀ r (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))), + Integrable (fun y => (p.condition _ hr).complexMean (fun x => f x y) - target r y) μ ∧ + (∫ y, ‖(p.condition _ hr).complexMean (fun x => f x y) - target r y‖ ∂μ) ≤ ε) : + Integrable (fun y => p.complexMean (fun x => f x y) - (p.fiberLaw F).complexMean (fun r => target r y)) μ ∧ + (∫ y, ‖p.complexMean (fun x => f x y) - (p.fiberLaw F).complexMean (fun r => target r y)‖ ∂μ) ≤ ε := by + simpa only [(p.fiberLaw F).mean_const] using p.complexMean_supported_fiber_l1_error F μ f target (fun _ => ε) he + +end Erdos3.FiniteProbabilityWeights + +end + +section + +namespace Erdos3.FiniteProbabilityWeights + +open MeasureTheory +open scoped Classical + +variable {X R Y : Type*} [Fintype X] [DecidableEq X] [Fintype R] [DecidableEq R] +variable [MeasurableSpace Y] + +omit [Fintype R] [MeasurableSpace Y] in +theorem exists_mem_positive_fiber (p : FiniteProbabilityWeights X) (F : X → R) (r : R) + (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))) : ∃ x, F x = r := by + obtain ⟨x, hx⟩ := (p.condition _ hr).exists_weight_pos + exact ⟨x, (Finset.mem_filter.mp (condition_weight_support p _ hr x hx.ne').1).2⟩ + +theorem exists_supported_fiber_l1_approximation + (p : FiniteProbabilityWeights X) (F : X → R) (μ : Measure Y) + (f : X → Y → ℂ) (ε : R → ℝ) (Spec : R → (Y → ℂ) → Prop) + (hlocal : ∀ r (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))), + ∃ g : Y → ℂ, Spec r g ∧ Measurable g ∧ + Integrable (fun y => (p.condition _ hr).complexMean (fun x => f x y) - g y) μ ∧ + (∫ y, ‖(p.condition _ hr).complexMean (fun x => f x y) - g y‖ ∂μ) ≤ ε r) : + ∃ target : R → Y → ℂ, + (∀ r, Measurable (target r)) ∧ + (∀ r, 0 < p.mass (Finset.univ.filter (fun x => F x = r)) → Spec r (target r)) ∧ + Integrable (fun y => p.complexMean (fun x => f x y) - (p.fiberLaw F).complexMean (fun r => target r y)) μ ∧ + (∫ y, ‖p.complexMean (fun x => f x y) - (p.fiberLaw F).complexMean (fun r => target r y)‖ ∂μ) ≤ + (p.fiberLaw F).mean ε := by + let target (r : R) : Y → ℂ := if hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r)) + then Classical.choose (hlocal r hr) else fun _ => 0 + have ht (r : R) (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))) : + Spec r (target r) ∧ Measurable (target r) ∧ + Integrable (fun y => (p.condition _ hr).complexMean (fun x => f x y) - target r y) μ ∧ + (∫ y, ‖(p.condition _ hr).complexMean (fun x => f x y) - target r y‖ ∂μ) ≤ ε r := by + simpa only [target, dite_eq_left hr] using Classical.choose_spec (hlocal r hr) + refine ⟨target, ?_, fun r hr => (ht r hr).1, ?_⟩ + · intro r + by_cases hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r)) + · exact (ht r hr).2.1 + · simpa only [target, dite_eq_right hr] using (measurable_const : Measurable (fun _ : Y => (0 : ℂ))) + · exact p.complexMean_supported_fiber_l1_error F μ f target ε (fun r hr => (ht r hr).2.2) + +end Erdos3.FiniteProbabilityWeights + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiberFiniteMeanError.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiberFiniteMeanError.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e8d1ada481bc72d41e2ead201ed8f1b5019409d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiberFiniteMeanError.lean @@ -0,0 +1,86 @@ +import OAI.Combinatorics.Progressions.Probability.WeightedSupportedComplexMixture + +namespace OAI + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped BigOperators Classical + +variable {X R Y : Type*} [Fintype X] [DecidableEq X] +variable [Fintype R] [DecidableEq R] [Fintype Y] + +theorem mean_norm_supported_fiber_error + (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) (F : X → R) + (f : X → Y → ℂ) (target : R → Y → ℂ) (ε : R → ℝ) + (he : ∀ r (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))), + q.mean (fun y => ‖(p.condition _ hr).complexMean (fun x => f x y) - target r y‖) ≤ ε r) : + q.mean (fun y => ‖p.complexMean (fun x => f x y) - + (p.fiberLaw F).complexMean (fun r => target r y)‖) ≤ (p.fiberLaw F).mean ε := by + let D : R → Y → ℂ := fun r y => p.fiberComplexMean F r (fun x => f x y) - + ((p.fiberLaw F).weight r : ℂ) * target r y + have hsplit (y : Y) : p.complexMean (fun x => f x y) - + (p.fiberLaw F).complexMean (fun r => target r y) = ∑ r, D r y := by + have h := p.sum_fiberComplexMean_on F Finset.univ (fun x => f x y) + simp only [Finset.mem_univ, ite_true] at h + rw [← h, complexMean, ← Finset.sum_sub_distrib] + have hcell (r : R) : q.mean (fun y => ‖D r y‖) ≤ (p.fiberLaw F).weight r * ε r := by + by_cases hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r)) + · have hfactor (y : Y) : ‖D r y‖ = p.mass (Finset.univ.filter (fun x => F x = r)) * + ‖(p.condition _ hr).complexMean (fun x => f x y) - target r y‖ := by + dsimp only [D] + rw [p.fiberComplexMean_eq_condition F r _ hr, p.fiberLaw_weight_eq_mass, + ← mul_sub, norm_mul, Complex.norm_real, Real.norm_of_nonneg (p.mass_nonneg _)] + simp_rw [hfactor] + rw [p.fiberLaw_weight_eq_mass] + calc + _ = p.mass (Finset.univ.filter (fun x => F x = r)) * + q.mean (fun y => ‖(p.condition _ hr).complexMean (fun x => f x y) - target r y‖) := by + simp only [mean, Finset.mul_sum] + apply Finset.sum_congr rfl + intro y _ + ring + _ ≤ _ := mul_le_mul_of_nonneg_left (he r hr) (p.mass_nonneg _) + · have hz : (p.fiberLaw F).weight r = 0 := by + rw [p.fiberLaw_weight_eq_mass] + exact le_antisymm (le_of_not_gt hr) (p.mass_nonneg _) + simp only [D, p.fiberComplexMean_zero F r hz, hz, Complex.ofReal_zero, + zero_mul, sub_self, norm_zero, q.mean_const, le_refl] + calc + _ = q.mean (fun y => ‖∑ r, D r y‖) := by simp only [hsplit] + _ ≤ q.mean (fun y => ∑ r, ‖D r y‖) := q.mean_mono (fun y => norm_sum_le _ _) + _ = ∑ r, q.mean (fun y => ‖D r y‖) := by + simp only [mean, Finset.mul_sum] + rw [Finset.sum_comm] + _ ≤ ∑ r, (p.fiberLaw F).weight r * ε r := Finset.sum_le_sum (fun r _ => hcell r) + _ = _ := rfl + +theorem mean_norm_supported_fiber_error_uniform + (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) (F : X → R) + (f : X → Y → ℂ) (target : R → Y → ℂ) {ε : ℝ} + (he : ∀ r (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))), + q.mean (fun y => ‖(p.condition _ hr).complexMean (fun x => f x y) - target r y‖) ≤ ε) : + q.mean (fun y => ‖p.complexMean (fun x => f x y) - + (p.fiberLaw F).complexMean (fun r => target r y)‖) ≤ ε := by + simpa only [mean_const] using p.mean_norm_supported_fiber_error q F f target (fun _ => ε) he + +theorem complexMean_supported_fiber_test_error + (p : FiniteProbabilityWeights X) (q : FiniteProbabilityWeights Y) (F : X → R) + (f : X → Y → ℂ) (target : R → Y → ℂ) (ε : R → ℝ) + (he : ∀ r (hr : 0 < p.mass (Finset.univ.filter (fun x => F x = r))), + q.mean (fun y => ‖(p.condition _ hr).complexMean (fun x => f x y) - target r y‖) ≤ ε r) + (φ : Y → ℂ) (hφ : ∀ y, ‖φ y‖ ≤ 1) : + ‖q.complexMean (fun y => + (p.complexMean (fun x => f x y) - (p.fiberLaw F).complexMean (fun r => target r y)) * φ y)‖ ≤ + (p.fiberLaw F).mean ε := by + apply (q.norm_complexMean_le_mean_norm _).trans + apply le_trans (q.mean_mono (fun y => ?_)) (p.mean_norm_supported_fiber_error q F f target ε he) + rw [norm_mul] + exact mul_le_of_le_one_right (norm_nonneg _) (hφ y) + +end Erdos3.FiniteProbabilityWeights + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiniteComparison.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiniteComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..961f40f2a0dca399474b20cf1a5625ea05105ffd --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedFiniteComparison.lean @@ -0,0 +1,56 @@ +import OAI.Combinatorics.Progressions.Estimates.MaskedFiniteComparison + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem finiteProbability_exists_nonzero_weight {Ω : Type*} [Fintype Ω] + (p : FiniteProbabilityWeights Ω) : ∃ x, p.weight x ≠ 0 := by + by_contra! h + have he := p.total + simp only [h, Finset.sum_const_zero] at he + norm_num at he + +theorem finiteMean_abs_sub_le_of_support {Ω : Type*} [Fintype Ω] + (p : FiniteProbabilityWeights Ω) (f g : Ω → ℝ) {ε : ℝ} + (h : ∀ x, p.weight x ≠ 0 → |f x-g x| ≤ ε) : |p.mean f-p.mean g| ≤ ε := by + rw [FiniteProbabilityWeights.mean, FiniteProbabilityWeights.mean, ← Finset.sum_sub_distrib] + calc + _ ≤ ∑ x, |p.weight x*f x-p.weight x*g x| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ x, p.weight x*ε := by + apply Finset.sum_le_sum + intro x _ + by_cases hx : p.weight x = 0 + · simp [hx] + · rw [← mul_sub, abs_mul, abs_of_nonneg (p.nonneg x)] + exact mul_le_mul_of_nonneg_left (h x hx) (p.nonneg x) + _ = ε := p.mean_const ε + +theorem finiteMean_masked_comparison_of_support {Ω : Type*} [Fintype Ω] + (p : FiniteProbabilityWeights Ω) (mass density : Ω → ℝ) {mask G ε η target : ℝ} + (hm : 0 ≤ mask) (hG : mask ≤ G) (hη : 0 ≤ η) + (hcoeff : ∀ x, p.weight x ≠ 0 → |mass x-mask*density x| ≤ ε) + (hquad : |p.mean density-target| ≤ η) : + |p.mean mass-mask*target| ≤ ε+G*η := by + have hmean : p.mean (fun x => mask*density x) = mask*p.mean density := by + unfold FiniteProbabilityWeights.mean + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + ring + have h₁ := finiteMean_abs_sub_le_of_support p mass (fun x => mask*density x) hcoeff + rw [hmean] at h₁ + have h₂ : |mask*p.mean density-mask*target| ≤ G*η := by + rw [← mul_sub, abs_mul, abs_of_nonneg hm] + exact (mul_le_mul_of_nonneg_left hquad hm).trans (mul_le_mul_of_nonneg_right hG hη) + exact (abs_sub_le _ _ _).trans (add_le_add h₁ h₂) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedLieQuotient.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedLieQuotient.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe7c735a1ded1ce6abc9beef9ba11807f113cf2e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedLieQuotient.lean @@ -0,0 +1,55 @@ +import OAI.Combinatorics.Progressions.Estimates.ImageRepresentatives +import OAI.Combinatorics.Progressions.Estimates.QuotientInducedMark + +namespace OAI + +section + +namespace Erdos3 + +open Module + +variable {L ι : Type*} [LieRing L] [LieAlgebra ℚ L] + +theorem supportedQuotientBasis_lieStructure (b : Basis ι ℚ L) (I : LieIdeal ℚ L) + (S : Set ι) (hI : I.toSubmodule = Submodule.span ℚ (b '' S)) + (i j k : {i // i ∉ S}) : + lieStructureConstants (L := L ⧸ I) (supportedQuotientBasis b I.toSubmodule S hI) i j k = + lieStructureConstants b i j k := by + unfold lieStructureConstants + rw [supportedQuotientBasis_apply, supportedQuotientBasis_apply] + change (supportedQuotientBasis b I.toSubmodule S hI).repr + (I.toSubmodule.mkQ ⁅b i, b j⁆) k = _ + exact supportedQuotientBasis_repr_mk b I.toSubmodule S hI _ k + +theorem supportedQuotientBasis_projection_height (b : Basis ι ℚ L) (I : LieIdeal ℚ L) + (S : Set ι) (hI : I.toSubmodule = Submodule.span ℚ (b '' S)) + (i : ι) (j : {i // i ∉ S}) : + RationalHeightLE ((supportedQuotientBasis b I.toSubmodule S hI).repr + (lieQuotientMap I (b i)) j) 1 := by + change RationalHeightLE ((supportedQuotientBasis b I.toSubmodule S hI).repr + (I.toSubmodule.mkQ (b i)) j) 1 + rw [supportedQuotientBasis_repr_mk] + exact basis_repr_height_one b i j + +namespace NilpotentLieFiltration + +variable {s t : ℕ} (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (w : ι → ℕ) + (hlayers : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ w i})) + (I : LieIdeal ℚ L) (hI : F.layer (t + 1) ≤ I.toSubmodule) + (S : Set ι) (hspan : I.toSubmodule = Submodule.span ℚ (b '' S)) + +include hlayers in +theorem supportedQuotientBasis_layers (j : ℕ) : + (F.quotientLie I hI).layer j = Submodule.span ℚ + (supportedQuotientBasis b I.toSubmodule S hspan '' {i | j ≤ w i}) := by + change (F.layer j).map I.toSubmodule.mkQ = _ + rw [hlayers j] + exact supportedQuotientBasis_map_span b I.toSubmodule S hspan {i | j ≤ w i} + +end NilpotentLieFiltration +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedMeanBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedMeanBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ccbd6b0881576f18441b50d17fe399927ae9ab7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedMeanBounds.lean @@ -0,0 +1,31 @@ +import OAI.Combinatorics.Progressions.Estimates.FiniteFiberTest + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem finite_expect_le_of_nonneg_bound {X : Type*} (s : Finset X) (f : X → ℝ) + {C : ℝ} (hC : 0 ≤ C) (hf : ∀ x ∈ s, f x ≤ C) : (𝔼 x ∈ s, f x) ≤ C := by + rcases s.eq_empty_or_nonempty with rfl | hs + · simpa using hC + · exact (Finset.expect_le_expect hf).trans_eq (Finset.expect_const hs C) + +theorem finiteMean_le_of_support {X : Type*} [Fintype X] + (p : FiniteProbabilityWeights X) (f : X → ℝ) {C : ℝ} + (hf : ∀ x, p.weight x ≠ 0 → f x ≤ C) : p.mean f ≤ C := by + rw [← p.mean_const C] + apply Finset.sum_le_sum + intro x _ + by_cases hx : p.weight x = 0 + · simp only [hx, zero_mul, le_refl] + · exact mul_le_mul_of_nonneg_left (hf x hx) (p.nonneg x) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedQuotientFamilyFaithful.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedQuotientFamilyFaithful.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d0d1e25191f2d98367a549ade15065105297128 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedQuotientFamilyFaithful.lean @@ -0,0 +1,56 @@ +import OAI.Combinatorics.Progressions.Lattices.SupportedQuotientLatticeFaithful + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module NilpotentLieBCHGroup +open scoped TensorProduct + +variable {α ι L : Type*} [Fintype ι] [LieRing L] [LieAlgebra ℚ L] {s t : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) + +theorem realQuotientFamily_lattice_detect + (I : α → LieIdeal ℚ L) (hI : ∀ a, F.layer (t + 1) ≤ (I a).toSubmodule) + (S : α → Set ι) (hspan : ∀ a, (I a).toSubmodule = Submodule.span ℚ (b '' S a)) + (hcover : ∀ i, ∃ a, i ∉ S a) + (Γ : Subgroup F.Group) (N : ℕ) (hgrid : bchSubgroupCoordinates b Γ = scaledIntegerGrid N) + (g : F.realification.Group) + (hg : ∀ a, F.realQuotientStepHom (I a) (hI a) g ∈ + (Γ.map (F.quotientStepHom (I a) (hI a))).map realificationHom) : + g ∈ Γ.map realificationHom := by + classical + have hcoords (a : α) := F.realQuotientStep_integral_coordinates b (I a) (hI a) + (S a) (hspan a) Γ N hgrid g (hg a) + choose z hz using hcoords + choose a ha using hcover + apply (mem_realification_integral_lattice_iff b Γ N hgrid g).mpr + exact ⟨fun i => z (a i) ⟨i, ha i⟩, fun i => hz (a i) ⟨i, ha i⟩⟩ + +omit [Fintype ι] in +theorem realQuotientFamily_joint_injective + (I : α → LieIdeal ℚ L) (hI : ∀ a, F.layer (t + 1) ≤ (I a).toSubmodule) + (S : α → Set ι) (hspan : ∀ a, (I a).toSubmodule = Submodule.span ℚ (b '' S a)) + (hcover : ∀ i, ∃ a, i ∉ S a) : + Function.Injective (fun g : F.realification.Group => fun a => F.realQuotientStepHom (I a) (hI a) g) := by + intro g h heq + apply NilpotentLieBCHGroup.ext + apply (b.baseChange ℝ).repr.injective + ext i + obtain ⟨a, ha⟩ := hcover i + have hc := congrArg (fun v : (F.quotientLie (I a) (hI a)).realification.Group => + ((supportedQuotientBasis b (I a).toSubmodule (S a) (hspan a)).baseChange ℝ).repr + v.coord ⟨i, ha⟩) (congrFun heq a) + change ((supportedQuotientBasis b (I a).toSubmodule (S a) (hspan a)).baseChange ℝ).repr + ((I a).toSubmodule.mkQ.baseChange ℝ g.coord) ⟨i, ha⟩ = + ((supportedQuotientBasis b (I a).toSubmodule (S a) (hspan a)).baseChange ℝ).repr + ((I a).toSubmodule.mkQ.baseChange ℝ h.coord) ⟨i, ha⟩ at hc + simpa only [realSupportedQuotientBasis_repr_mk] using hc + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedQuotientSection.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedQuotientSection.lean new file mode 100644 index 0000000000000000000000000000000000000000..02547cd29041c0e38408fac694299628e70f7539 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedQuotientSection.lean @@ -0,0 +1,129 @@ +import OAI.Combinatorics.Progressions.Linear.BaseChangeCoordinateProjection +import OAI.Combinatorics.Progressions.Linear.BasisGradedCoordinateBasis +import OAI.Combinatorics.Progressions.Linear.SortedBasisTriangular + +namespace OAI + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +section Algebra + +variable {K V ι : Type*} [Field K] [AddCommGroup V] [Module K V] + (b : Basis ι K V) (P : Submodule K V) (S : Set ι) + (hP : P = Submodule.span K (b '' S)) + +noncomputable def supportedQuotientSection : (V ⧸ P) →ₗ[K] V := + (supportedQuotientBasis b P S hP).constr K (fun i => b i.val) + +@[simp] theorem supportedQuotientSection_basis (i : {i // i ∉ S}) : + supportedQuotientSection b P S hP (supportedQuotientBasis b P S hP i) = b i.val := + Basis.constr_basis _ _ _ i + +theorem supportedQuotientSection_rightInverse (x : V ⧸ P) : + P.mkQ (supportedQuotientSection b P S hP x) = x := by + have he : P.mkQ.comp (supportedQuotientSection b P S hP) = LinearMap.id := by + apply (supportedQuotientBasis b P S hP).ext + intro i + change P.mkQ (supportedQuotientSection b P S hP + (supportedQuotientBasis b P S hP i)) = supportedQuotientBasis b P S hP i + rw [supportedQuotientSection_basis, supportedQuotientBasis_apply] + exact DFunLike.congr_fun he x + +theorem supportedQuotientSection_coordinate (x : V ⧸ P) (i : {i // i ∉ S}) : + b.repr (supportedQuotientSection b P S hP x) i = + (supportedQuotientBasis b P S hP).repr x i := by + rw [← supportedQuotientBasis_repr_mk b P S hP, supportedQuotientSection_rightInverse] + +theorem supportedQuotientSection_coordinate_zero (x : V ⧸ P) (i : ι) (hi : i ∈ S) : + b.repr (supportedQuotientSection b P S hP x) i = 0 := by + have he : (b.coord i).comp (supportedQuotientSection b P S hP) = 0 := by + apply (supportedQuotientBasis b P S hP).ext + intro j + change b.repr (supportedQuotientSection b P S hP + (supportedQuotientBasis b P S hP j)) i = 0 + rw [supportedQuotientSection_basis, b.repr_self] + apply Finsupp.single_eq_of_ne + exact fun hij => j.property (hij ▸ hi) + exact DFunLike.congr_fun he x + +end Algebra + +variable {V ι : Type*} [AddCommGroup V] [Module ℚ V] + (b : Basis ι ℚ V) (P : Submodule ℚ V) (S : Set ι) + (hP : P = Submodule.span ℚ (b '' S)) + +theorem realSupportedQuotientSection_rightInverse (x : ℝ ⊗[ℚ] (V ⧸ P)) : + P.mkQ.baseChange ℝ ((supportedQuotientSection b P S hP).baseChange ℝ x) = x := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul r x => + rw [LinearMap.baseChange_tmul, LinearMap.baseChange_tmul, + supportedQuotientSection_rightInverse] + +theorem realSupportedQuotientSection_coordinate + (x : ℝ ⊗[ℚ] (V ⧸ P)) (i : {i // i ∉ S}) : + (b.baseChange ℝ).repr ((supportedQuotientSection b P S hP).baseChange ℝ x) i = + ((supportedQuotientBasis b P S hP).baseChange ℝ).repr x i := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy] + | tmul r x => + rw [LinearMap.baseChange_tmul, Basis.baseChange_repr_tmul, + Basis.baseChange_repr_tmul, supportedQuotientSection_coordinate] + +theorem realSupportedQuotientSection_coordinate_zero + (x : ℝ ⊗[ℚ] (V ⧸ P)) (i : ι) (hi : i ∈ S) : + (b.baseChange ℝ).repr ((supportedQuotientSection b P S hP).baseChange ℝ x) i = 0 := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy, add_zero] + | tmul r x => + rw [LinearMap.baseChange_tmul, Basis.baseChange_repr_tmul, + supportedQuotientSection_coordinate_zero b P S hP x i hi] + exact zero_smul ℚ r + +theorem realSupportedQuotientSection_norm [Fintype ι] [DecidablePred (· ∈ S)] + (x : ℝ ⊗[ℚ] (V ⧸ P)) : + ‖(b.baseChange ℝ).equivFun ((supportedQuotientSection b P S hP).baseChange ℝ x)‖ = + ‖((supportedQuotientBasis b P S hP).baseChange ℝ).equivFun x‖ := by + apply le_antisymm + · apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr + intro i + by_cases hi : i ∈ S + · rw [Basis.equivFun_apply, realSupportedQuotientSection_coordinate_zero b P S hP x i hi, + norm_zero] + exact norm_nonneg _ + · rw [Basis.equivFun_apply, + realSupportedQuotientSection_coordinate b P S hP x ⟨i, hi⟩] + exact norm_le_pi_norm (((supportedQuotientBasis b P S hP).baseChange ℝ).equivFun x) ⟨i, hi⟩ + · apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr + intro i + rw [Basis.equivFun_apply, ← realSupportedQuotientSection_coordinate b P S hP x i] + exact norm_le_pi_norm ((b.baseChange ℝ).equivFun + ((supportedQuotientSection b P S hP).baseChange ℝ x)) i.val + +theorem realSupportedQuotientSection_grid [Fintype ι] [DecidablePred (· ∈ S)] + (l : ℕ) (x : ℝ ⊗[ℚ] (V ⧸ P)) + (hx : ((supportedQuotientBasis b P S hP).baseChange ℝ).equivFun x ∈ realDenominatorGrid l) : + (b.baseChange ℝ).equivFun ((supportedQuotientSection b P S hP).baseChange ℝ x) ∈ + realDenominatorGrid l := by + classical + obtain ⟨v, hv⟩ := hx + refine ⟨fun i => if hi : i ∈ S then 0 else v ⟨i, hi⟩, ?_⟩ + funext i + change ((if hi : i ∈ S then 0 else v ⟨i, hi⟩ : ℤ) : ℝ) = + (l : ℝ) * (b.baseChange ℝ).repr ((supportedQuotientSection b P S hP).baseChange ℝ x) i + by_cases hi : i ∈ S + · rw [dite_eq_left hi, realSupportedQuotientSection_coordinate_zero b P S hP x i hi] + simp only [Int.cast_zero, mul_zero] + · rw [dite_eq_right hi, realSupportedQuotientSection_coordinate b P S hP x ⟨i, hi⟩] + exact congrFun hv ⟨i, hi⟩ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedSubquotient.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedSubquotient.lean new file mode 100644 index 0000000000000000000000000000000000000000..9dbb594ccdb44ac88482103c9a79522bde745d5d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedSubquotient.lean @@ -0,0 +1,33 @@ +import OAI.Combinatorics.Progressions.Linear.BasisGradedCoordinateBasis + +namespace OAI + +section + +namespace Erdos3 + +open Module + +theorem supportedSubmoduleBasis_comap_span {K V ι : Type*} [Field K] [AddCommGroup V] [Module K V] + (b : Basis ι K V) (P Q : Submodule K V) (S T : Set ι) + (hP : P = Submodule.span K (b '' S)) (hQ : Q = Submodule.span K (b '' T)) : + Q.comap P.subtype = Submodule.span K + (supportedSubmoduleBasis b P S hP '' {i : S | i.val ∈ T}) := by + ext x + change x.val ∈ Q ↔ _ + rw [hQ, basis_mem_span_image_iff, basis_mem_span_image_iff] + constructor + · intro h i hi + rw [supportedSubmoduleBasis_repr] + exact h i.val hi + · intro h i hi + by_cases hs : i ∈ S + · have hh := h ⟨i, hs⟩ hi + simpa only [supportedSubmoduleBasis_repr] using hh + · exact (basis_mem_span_image_iff b S x.val).mp (hP.le x.property) i hs + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SupportedTriangularSum.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedTriangularSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..7911579568804d825e3a2f4778d61affa52c41cb --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SupportedTriangularSum.lean @@ -0,0 +1,52 @@ +import OAI.Combinatorics.Progressions.Estimates.DependentPatchValue + +namespace OAI + +section + +namespace Erdos3.TriangularSlots + +open scoped BigOperators + +variable {d : ℕ} (A : TriangularSlots d) + +theorem tsum_eq_at_of_residual_bound (f : (Fin d → ℝ) → ℝ) {R : ℝ} + (hgap : R + R < 1) (hsupport : ∀ x, f x ≠ 0 → ∀ i, |x i| ≤ R) + (b : Fin d → ℤ) (hb : ∀ i, |A.residual b i| ≤ R) : + (∑' z, f (A.residual z)) = f (A.residual b) := by + apply tsum_eq_single b + intro z hzb + by_contra hz + exact hzb (A.integer_unique hgap (hsupport _ hz) hb) + +theorem tsum_approx_finite_family {I : Type*} [Fintype I] + (f : (Fin d → ℝ) → ℝ) (g : I → (Fin d → ℝ) → ℝ) (c : I → ℝ) + {R ε : ℝ} (hgap : R + R < 1) (hε : 0 ≤ ε) + (hf : ∀ x, f x ≠ 0 → ∀ j, |x j| ≤ R) + (hg : ∀ i x, g i x ≠ 0 → ∀ j, |x j| ≤ R) + (happrox : ∀ x, |f x - ∑ i, c i * g i x| ≤ ε) : + |(∑' z, f (A.residual z)) - ∑ i, c i * ∑' z, g i (A.residual z)| ≤ ε := by + classical + by_cases h : ∃ z : Fin d → ℤ, f (A.residual z) ≠ 0 ∨ ∃ i, g i (A.residual z) ≠ 0 + · obtain ⟨z, hz⟩ := h + have hb : ∀ j, |A.residual z j| ≤ R := by + rcases hz with hz | ⟨i, hi⟩ + · exact hf _ hz + · exact hg i _ hi + rw [A.tsum_eq_at_of_residual_bound f hgap hf z hb] + simp_rw [A.tsum_eq_at_of_residual_bound _ hgap (hg _) z hb] + exact happrox _ + · have hfzero (z : Fin d → ℤ) : f (A.residual z) = 0 := by + by_contra hz + exact h ⟨z, Or.inl hz⟩ + have hgzero (i : I) (z : Fin d → ℤ) : g i (A.residual z) = 0 := by + by_contra hz + exact h ⟨z, Or.inr ⟨i, hz⟩⟩ + simp only [hfzero, hgzero, tsum_zero, mul_zero, Finset.sum_const_zero, sub_self, abs_zero] + exact hε + +end Erdos3.TriangularSlots + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SymbolCoordinateFreezeBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SymbolCoordinateFreezeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae54abed385e28d6aebccd27637f8d4f521a187a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SymbolCoordinateFreezeBounds.lean @@ -0,0 +1,117 @@ +import Mathlib.Algebra.MvPolynomial.Rename +import OAI.Combinatorics.Progressions.Estimates.RealSymbolGradedCoefficientBound +import OAI.Combinatorics.Progressions.Lattices.IntegerFrozenChart + +namespace OAI + +section + +namespace Erdos3 +open _root_.MvPolynomial _root_.OAI.MvPolynomial + +variable {I R : Type*} [CommRing R] + +theorem freezePolynomial_zero_eq_killCompl (keep : I → Prop) : + freezePolynomial keep (0 : {i // ¬keep i} → R) = + MvPolynomial.killCompl (f := (Subtype.val : {i // keep i} → I)) Subtype.val_injective := by + classical + apply MvPolynomial.algHom_ext + intro i + simp only [freezePolynomial, MvPolynomial.killCompl, aeval_X] + by_cases hi : keep i + · have hr : i ∈ Set.range (Subtype.val : {i // keep i} → I) := ⟨⟨i, hi⟩, rfl⟩ + simp only [frozenCoordinate, dite_eq_left hi, dite_eq_left hr] + congr 1 + exact (Equiv.ofInjective_symm_apply Subtype.val_injective ⟨i, hi⟩).symm + · have hr : i ∉ Set.range (Subtype.val : {i // keep i} → I) := by + rintro ⟨⟨j, hj⟩, rfl⟩ + exact hi hj + simp only [frozenCoordinate, dite_eq_right hi, dite_eq_right hr, Pi.zero_apply, map_zero] + +theorem coeff_freezePolynomial_zero (keep : I → Prop) (P : MvPolynomial I R) + (α : {i // keep i} →₀ ℕ) : + (freezePolynomial keep (0 : {i // ¬keep i} → R) P).coeff α = + P.coeff (α.mapDomain Subtype.val) := by + rw [freezePolynomial_zero_eq_killCompl] + exact MvPolynomial.coeff_killCompl Subtype.val_injective + +theorem coeff_aeval_frozenCoordinate_zero (keep : I → Prop) (P : MvPolynomial I R) + (α : {i // keep i} →₀ ℕ) : + (aeval (frozenCoordinate keep (0 : {i // ¬keep i} → R)) P).coeff α = + P.coeff (α.mapDomain Subtype.val) := + coeff_freezePolynomial_zero keep P α + +end Erdos3 + +end + +section + +namespace Erdos3 +open Module +open scoped Classical + +namespace VectorPolynomial + +variable {I ι V : Type*} [LieRing V] [LieAlgebra ℚ V] [LieAlgebra ℝ V] + [IsScalarTower ℚ ℝ V] + +theorem coordinate_coeff_realChartSubstitute_freeze_zero + (keep : I → Prop) (b : Basis ι ℝ V) (P : VectorPolynomial I ℚ V) + (α : {i // keep i} →₀ ℕ) (i : ι) : + b.repr (coefficients (realChartSubstitute (frozenCoordinate keep 0) P) α) i = + b.repr (coefficients P (α.mapDomain Subtype.val)) i := by + have h := congrArg (fun Q : MvPolynomial {i // keep i} ℝ => Q.coeff α) + (coordinate_realChartSubstitute_for_grid (frozenCoordinate keep 0) (b.coord i) P) + rw [coeff_aeval_frozenCoordinate_zero] at h + simpa only [coeff_coordinate, LinearMap.toAddMonoidHom_coe, Basis.coord_apply] using h + +theorem CoefficientBound.freeze_zero + (keep : I → Prop) (b : Basis ι ℝ V) (T : I → ℝ) {M : ℝ} + {P : VectorPolynomial I ℚ V} (hP : CoefficientBound b T M P) : + CoefficientBound b (fun i : {i // keep i} => T i.val) M + (Erdos3.VectorPolynomial.realChartSubstitute (frozenCoordinate keep 0) P) := by + intro α i + rw [coordinate_coeff_realChartSubstitute_freeze_zero] + have hscale : monomialScale T (α.mapDomain Subtype.val) = + monomialScale (fun i : {i // keep i} => T i.val) α := + Finsupp.prod_mapDomain_index_inj Subtype.val_injective + simpa only [hscale] using hP (α.mapDomain Subtype.val) i + +end VectorPolynomial + +namespace NilpotentLieFiltration +open VectorPolynomial + +attribute [local irreducible] realChartSubstitute realGradedSymbolPolynomial + realSymbolHomogeneousPullback realGradedSymbolPolynomialHom + +variable {I ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem symbolSlowBound_freeze_zero + (keep : I → Prop) (T : I → ℝ) (hT : ∀ i, 0 < T i) + {M : ℝ} (hM : 0 ≤ M) (E : F.RealPolynomialSymbolGroup (fun _ : I => 1)) + (hE : F.SymbolSlowBound b ω hF (fun _ : I => 1) T M E) : + F.SymbolSlowBound b ω hF (fun _ : {i // keep i} => 1) + (fun i => T i.val) M + (F.realSymbolHomogeneousPullbackHom b ω hF (fun _ : I => 1) + (fun _ : {i // keep i} => 1) (frozenCoordinate keep 0) + (frozenCoordinate_zero_homogeneous keep) E) := by + have hbound : CoefficientBound ((F.associatedGradedBasis b ω hF).baseChange ℝ) T M + (F.realGradedSymbolPolynomialHom b ω hF (fun _ : I => 1) E).coord := + (F.symbolSlowBound_iff_gradedCoefficientBound b ω hF (fun _ : I => 1) + T hT hM E).mp hE + have hfrozen := CoefficientBound.freeze_zero keep + ((F.associatedGradedBasis b ω hF).baseChange ℝ) T hbound + exact F.symbolSlowBound_homogeneousPullback_of_coefficientBound b ω hF + (fun _ : I => 1) (fun _ : {i // keep i} => 1) (frozenCoordinate keep 0) + (frozenCoordinate_zero_homogeneous keep) E (fun i => T i.val) M hfrozen + +end NilpotentLieFiltration +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SymbolFactorizationTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SymbolFactorizationTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..94909fb696c1db27dc3dab52ae78e5523a9426f3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SymbolFactorizationTransport.lean @@ -0,0 +1,76 @@ +import OAI.Combinatorics.Progressions.Lattices.RealSymbolAffine + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +variable {σ V : Type*} [AddCommGroup V] [Module ℚ V] + +theorem eval_rational_affine (w : σ → ℕ) (r : ℚ) (h x : σ → ℚ) + (p : VectorPolynomial σ ℚ V) : + eval x (weightedDilation w r (translate h p)) = + eval (fun i => r ^ w i * x i + h i) p := by + rw [eval_weightedDilation, eval_translate] + +end Erdos3.VectorPolynomial + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +variable {σ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + +theorem SymbolFactorizationIn.dilate_ratio + {S T : σ → ℝ} {X : F.RealPolynomialSymbolGroup (fun _ : σ => 1)} + {p q : ℝ} {D : ℕ} {U : LieSubalgebra ℚ F.AssociatedGraded} + (h : F.SymbolFactorizationIn b ω hF S X p D U) + (a : ℤ) (d : ℕ) (ha : a ≠ 0) (hd : 0 < d) + (hS : ∀ i, 0 < S i) (hT : ∀ i, 0 < T i) (hq : 0 ≤ q) + (hphysical : ∀ i, Real.exp (-q) * (|(((a : ℚ) / d : ℚ) : ℝ)| * T i) ≤ S i) : + F.SymbolFactorizationIn b ω hF T + (F.realPolynomialSymbolDilationHom (fun _ => 1) ((a : ℚ) / d) X) + (p + (s : ℝ) * q) (D * d ^ s) U := by + have hr : (a : ℚ) / d ≠ 0 := div_ne_zero (by exact_mod_cast ha) (by exact_mod_cast hd.ne') + let φ := F.realPolynomialSymbolDilationHom (fun _ : σ => 1) ((a : ℚ) / d) + obtain ⟨E, P, R, hprod, hE, hR, hP⟩ := h + refine ⟨φ E, φ P, φ R, ?_, ?_, ?_, ?_⟩ + · simpa only [map_mul] using congrArg φ hprod + · exact F.symbolSlowBound_dilation_physical b ω hF S T hS hT p q hq _ hr hphysical E hE + · exact F.symbolRationalGrid_dilation_ratio b ω hF (fun _ => 1) D d a hd R hR + · exact F.realSymbolDilation_mem_pointwise b ω hF (fun _ => 1) U _ P.coord hP + +theorem symbolFactorizationIn_affine_transport + {S T : σ → ℝ} {p q : ℝ} {D : ℕ} {U : LieSubalgebra ℚ F.AssociatedGraded} + (f : VectorPolynomial σ ℚ (ℝ ⊗[ℚ] L)) (hf : F.realification.Adapted (fun _ => 1) f) + (h : F.SymbolFactorizationIn b ω hF S + ⟨F.realSymbolOfPolynomial b ω hF (fun _ => 1) f⟩ p D U) + (a : ℤ) (d : ℕ) (ha : a ≠ 0) (hd : 0 < d) (shift : σ → ℚ) + (hS : ∀ i, 0 < S i) (hT : ∀ i, 0 < T i) (hq : 0 ≤ q) + (hphysical : ∀ i, Real.exp (-q) * (|(((a : ℚ) / d : ℚ) : ℝ)| * T i) ≤ S i) : + F.SymbolFactorizationIn b ω hF T + ⟨F.realSymbolOfPolynomial b ω hF (fun _ => 1) + (weightedDilation (fun _ => 1) ((a : ℚ) / d) (translate shift f))⟩ + (p + (s : ℝ) * q) (D * d ^ s) U := by + have hsymbol : (⟨F.realSymbolOfPolynomial b ω hF (fun _ => 1) + (weightedDilation (fun _ => 1) ((a : ℚ) / d) (translate shift f))⟩ : + F.RealPolynomialSymbolGroup (fun _ : σ => 1)) = + F.realPolynomialSymbolDilationHom (fun _ => 1) ((a : ℚ) / d) + ⟨F.realSymbolOfPolynomial b ω hF (fun _ => 1) f⟩ := by + apply NilpotentLieBCHGroup.ext + simp only [F.realPolynomialSymbolDilationHom_coord] + apply realSymbolOfPolynomial_affine + · exact fun _ => Nat.zero_lt_one + · exact hf + rw [hsymbol] + exact SymbolFactorizationIn.dilate_ratio F b ω hF h a d ha hd hS hT hq hphysical + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SymbolRepresentativeTransport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SymbolRepresentativeTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0dae1d44c0497eab0171098079506b1e8beb52c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SymbolRepresentativeTransport.lean @@ -0,0 +1,71 @@ +import OAI.Combinatorics.Progressions.Linear.RationalTaggedSpanProjection + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +variable {σ ι κ M : Type*} [Fintype ι] [Fintype κ] [LieRing M] [LieAlgebra ℚ M] {s : ℕ} + (F : NilpotentLieFiltration M s) (b : Basis ι ℚ M) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) (e : Basis κ ℚ M) + +omit [Fintype κ] in +theorem realSymbolRepresentative_slow_original_coordinates (w : σ → ℕ) + (T : σ → ℝ) (hT : ∀ j, 0 < T j) {p : ℝ} (hp : 0 ≤ p) + (hdim : (Fintype.card ι : ℝ) ≤ p) + (hentries : ∀ j i, rationalLogHeight (e.repr (b j) i) ≤ p) + (E : F.RealPolynomialSymbolGroup w) (hE : F.SymbolSlowBound b ω hF w T (Real.exp p) E) + (α : σ →₀ ℕ) (i : κ) : + |(e.baseChange ℝ).repr (coefficients (F.realSymbolRepresentative b ω hF w E.coord) α) i| ≤ + Real.exp ((p + 3) ^ 2) / monomialScale T α := by + have hH : (⌈Real.exp p⌉₊ : ℝ) ≤ Real.exp (p + 1) := ceil_exp_le_exp_add_one hp + have hdim' : (Fintype.card ι : ℝ) ≤ Real.exp p := + hdim.trans (by linarith [Real.add_one_le_exp p]) + have hbound : (Fintype.card ι : ℝ) * ⌈Real.exp p⌉₊ * Real.exp p ≤ Real.exp ((p + 3) ^ 2) := by + calc + _ ≤ Real.exp p * Real.exp (p + 1) * Real.exp p := by gcongr + _ = Real.exp (3 * p + 1) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [sq_nonneg p]) + calc + _ ≤ (Fintype.card ι : ℝ) * ⌈Real.exp p⌉₊ * (Real.exp p / monomialScale T α) := + real_basis_coordinates_bound b e (fun i j => rationalHeightLE_ceil_exp (hentries j i)) _ + (fun j => F.realSymbolRepresentative_slow_coefficients b ω hF w T hT + (Real.exp_pos p).le E hE α j) i + _ = ((Fintype.card ι : ℝ) * ⌈Real.exp p⌉₊ * Real.exp p) / monomialScale T α := by ring + _ ≤ _ := div_le_div_of_nonneg_right hbound (monomialScale_pos T hT α).le + +theorem realSymbolRepresentative_original_grid (w : σ → ℕ) (l : ℕ) + (R : F.RealPolynomialSymbolGroup w) (hR : F.SymbolRationalGrid b ω hF w l R) + (α : σ →₀ ℕ) : + (fun i => (e.baseChange ℝ).repr (coefficients (F.realSymbolRepresentative b ω hF w R.coord) α) i) + ∈ realDenominatorGrid (matrixDenominator (fun i j => e.repr (b j) i) * l) := by + obtain ⟨z, hz⟩ := F.realSymbolRepresentative_rational_coefficients b ω hF w l R hR + apply real_basis_coordinates_grid b e l + exact ⟨fun j => z (α, j), funext (fun j => congrFun hz (α, j))⟩ + +theorem original_coordinate_denominator_bound {p : ℝ} (hp : 0 ≤ p) + (hι : (Fintype.card ι : ℝ) ≤ p) (hκ : (Fintype.card κ : ℝ) ≤ p) + (hentries : ∀ j i, rationalLogHeight (e.repr (b j) i) ≤ p) + (l : ℕ) (hl : (l : ℝ) ≤ Real.exp p) : + ((matrixDenominator (fun i j => e.repr (b j) i) * l : ℕ) : ℝ) ≤ + Real.exp ((p + 2) ^ 3 + p) := by + have hD : (matrixDenominator (fun i j => e.repr (b j) i) : ℝ) ≤ Real.exp ((p + 2) ^ 3) := by + apply matrixDenominator_le_exp_power (fun i j => e.repr (b j) i) hp 1 hκ hι + intro i j + exact ((rationalLogHeight_le_iff _ _).mp (hentries j i)).2.trans + (Real.exp_le_exp.mpr (by simp)) + rw [Nat.cast_mul] + exact (mul_le_mul hD hl (Nat.cast_nonneg _) (Real.exp_pos _).le).trans_eq (Real.exp_add _ _).symm + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/SymmetricEvaluationMetric.lean b/lean/OAI/Combinatorics/Progressions/Geometry/SymmetricEvaluationMetric.lean new file mode 100644 index 0000000000000000000000000000000000000000..64c1515c274b9497c6a1889bf5988cf30f391876 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/SymmetricEvaluationMetric.lean @@ -0,0 +1,35 @@ +import OAI.Combinatorics.Progressions.Estimates.MomentEvaluationBounds +import OAI.Combinatorics.Progressions.Estimates.SymmetricEvaluationLowerBound + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +def symmetricEvaluationLip (m : ℕ) (K : ℝ≥0) : ℝ≥0 := + m * ((momentWeightBound m : ℝ≥0) * K) * (momentWeightBound m : ℝ≥0) ^ m + +theorem symmetricEvaluation_metric {m : ℕ} {I X : Type*} [PseudoMetricSpace X] + (f : Fin m → I → X → ℂ) {K : ℝ≥0} + (hf : ∀ i j, LipschitzWith K (f i j)) (hn : ∀ i j x, ‖f i j x‖ ≤ 1) + (k : SymmetricEvaluationIndex m I) : + (∀ x, ‖symmetricEvaluation (fun i j => f i j x) k‖ ≤ (momentWeightBound m : ℝ) ^ m) ∧ + LipschitzWith (symmetricEvaluationLip m K) + (fun x => symmetricEvaluation (fun i j => f i j x) k) := by + have hB : (1 : ℝ≥0) ≤ momentWeightBound m := by exact_mod_cast momentWeightBound_pos m + have h := bounded_lipschitz_fintype_prod + (fun i x => momentLinear (fun j => f i (k.1 j) x) k.2) hB + (fun i => momentLinear_lipschitz _ (fun j => hf i (k.1 j)) k.2) + (fun i x => by simpa only [mul_one, NNReal.coe_natCast] using + norm_momentLinear_le (fun j => f i (k.1 j) x) k.2 zero_le_one (fun j => hn i (k.1 j) x)) + simpa only [Fintype.card_fin, symmetricEvaluationLip, NNReal.coe_natCast, + symmetricEvaluation, momentProduct, momentLinear] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TerminalChartSlowEvaluation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TerminalChartSlowEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe846f9310f8acf792a1922fcd7eb16bb4665214 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TerminalChartSlowEvaluation.lean @@ -0,0 +1,1055 @@ +import Mathlib.RingTheory.MvPolynomial.Tower +import OAI.Combinatorics.Progressions.Estimates.VectorSubspaceCorrectionRepresentatives +import OAI.Combinatorics.Progressions.Geometry.BoundedCertifiedFullChartMajorIteration +import OAI.Combinatorics.Progressions.Geometry.GlobalMarkedChartwiseNormalization +import OAI.Combinatorics.Progressions.Linear.CertifiedChartBasisBudget +import OAI.Combinatorics.Progressions.Polynomial.FullChartPrescribedPolynomialLifts + +namespace OAI + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct + +variable {m : ℕ} {X : Type} +variable {ι L η : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (budget : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "quotientReal" => ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast) +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +def FullChartAdmissibleStageCorrection + (q : ℕ) (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal) : Prop := + (∀ α, Finsupp.weight wt α ≠ k → coefficients pair.1 α = 0) ∧ + (∀ α, Finsupp.weight wt α ≠ k → coefficients pair.2 α = 0) ∧ + (∀ i, (coordinate (basis.coord i).toAddMonoidHom pair.1).totalDegree ≤ k) ∧ + (∀ i, (coordinate (basis.coord i).toAddMonoidHom pair.2).totalDegree ≤ k) ∧ + 0 < q ∧ (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * budget) ∧ + K' ⊆ K₀ ∧ + (∀ t ∈ K', ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ K') ∧ + (∀ t ∈ K₀, (∀ j, (fun a => t (Sum.inr ⟨j, a⟩)) ∈ Utag j) → t ∈ K') ∧ + (∀ α i, |basis.coord i (coefficients pair.1 α)| ≤ Real.exp budget) ∧ + (∀ α, (fun i => basis.coord i (coefficients pair.2 α)) ∈ realDenominatorGrid q) ∧ + (∀ t ∈ K', ∀ j ≤ k, + F.realSymbolGradeEvaluation b ω hF wt j t + ((left * F.restrictedMajorCorrection b ω hF wt fast lift k + (realChartSubstitute chart pair.1))⁻¹ * Z * + (F.restrictedMajorCorrection b ω hF wt fast lift k pair.2 * right)⁻¹).coord ∈ + fast.baseChange ℝ) ∧ + (∃ (detectedfast : η → LieSubalgebra ℚ (weightedSubalgebra (lowTaggedWeight J k) k)) + (slow rat : VectorPolynomial (X ⊕ Fin (Fintype.card (LowTaggedIndex J k))) ℚ quotientReal), + pair.1 = lowTaggedVectorExtend J k slow ∧ pair.2 = lowTaggedVectorExtend J k rat ∧ + K' = fullTaggedGradedBaseIntersection J k K₀ + (fun i => majorPhaseDetectedRealBase J k (detectedfast i))) ∧ + RationalTaggedConstraintCertificate J K₀ K' budget (Fintype.card η * m) ∧ + ∀ t ∈ K', eval₂ t + (F.realSymbolGradeQuotientPolynomial b ω hF wt fast k (left⁻¹ * Z * right⁻¹).coord) = + eval₂ t (realChartSubstitute chart pair.1) + eval₂ t pair.2 + +theorem CertifiedFullChartDetectedDecomposition.exists_admissible_stage + (h : CertifiedFullChartDetectedDecomposition F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget) : + ∃ (q : ℕ) (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal), + FullChartAdmissibleStageCorrection F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget q K' pair := by + obtain ⟨pS, pR, q, K', hpair⟩ := CertifiedFullChartDetectedDecomposition.exists_homogeneous + (F := F) (b := b) (ω := ω) (hF := hF) (fast := fast) (lift := lift) + (J := J) (k := k) (basis := basis) (Z := Z) (left := left) (right := right) + (K₀ := K₀) (Utag := Utag) (poly := poly) (N := N) (budget := budget) h + refine ⟨q, K', (pS, pR), ?_⟩ + unfold FullChartAdmissibleStageCorrection + with_reducible exact hpair + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] realSymbolGradeEvaluation restrictedMajorCorrection + realSymbolGradeQuotientPolynomial outer + +variable {m : ℕ} {X : Type} {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (Bphase : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase + +variable {F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase} + +theorem exists_append_admissible {n : ℕ} (H : State n) + (budget : ℝ) (hbudget : budget ≤ Bphase) (q : ℕ) + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) : + ∃ Hnext : State (n + 1), + Hnext.slow = Function.update H.slow n pair.1 ∧ + Hnext.rat = Function.update H.rat n pair.2 ∧ + Hnext.q = Function.update H.q n q ∧ Hnext.K = K' := by + let pS := pair.1 + let pR := pair.2 + have hq := hpair.2.2.2.2.1 + have hqB := hpair.2.2.2.2.2.1 + have hsub := hpair.2.2.2.2.2.2.1 + have hdilate := hpair.2.2.2.2.2.2.2.1 + have hretain := hpair.2.2.2.2.2.2.2.2.1 + have hcap := hpair.2.2.2.2.2.2.2.2.2.1 + have hgrid := hpair.2.2.2.2.2.2.2.2.2.2.1 + have hnext := hpair.2.2.2.2.2.2.2.2.2.2.2.1 + have hcert := hpair.2.2.2.2.2.2.2.2.2.2.2.2.2.1 + let slow' := Function.update H.slow n pS + let rat' := Function.update H.rat n pR + let q' := Function.update H.q n q + have hslow (j : ℕ) (hj : j < n) : slow' j = H.slow j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hrat (j : ℕ) (hj : j < n) : rat' j = H.rat j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hqold (j : ℕ) (hj : j < n) : q' j = H.q j := + Function.update_of_ne (Nat.ne_of_lt hj) _ _ + have hprefix : F.restrictedMajorOuterFactors b ω hF wt fast lift + (fun j => realChartSubstitute chart (slow' j)) rat' n = H.outer := by + unfold outer + apply F.restrictedMajorOuterFactors_congr + · intro j hj + rw [hslow j hj] + · exact hrat + have houter : F.restrictedMajorOuterFactors b ω hF wt fast lift + (fun j => realChartSubstitute chart (slow' j)) rat' (n + 1) = + (H.outer.1 * F.restrictedMajorCorrection b ω hF wt fast lift (n + 1) + (realChartSubstitute chart pS), + F.restrictedMajorCorrection b ω hF wt fast lift (n + 1) pR * H.outer.2) := by + rw [restrictedMajorOuterFactors, hprefix] + simp only [slow', rat', Function.update_self] + have hcapB : ∀ α i, |basis.coord i (coefficients pS α)| ≤ Real.exp Bphase := + fun α i => (hcap α i).trans (Real.exp_le_exp.mpr hbudget) + have hqBB : (q : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * Bphase) := + hqB.trans (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hbudget (Nat.cast_nonneg _))) + let Hnext : State (n + 1) := { + slow := slow' + rat := rat' + q := q' + K := K' + certificate := by + simpa only [Nat.succ_mul] using H.certificate.trans (hcert.monoB hbudget) + subset := fun t ht => H.subset (hsub ht) + dilation := hdilate + retained := fun t ht hU => hretain t (H.retained t ht hU) hU + slow_bound := by + intro j hj α i + by_cases hjn : j = n + · subst j + simpa only [slow', Function.update_self] using hcapB α i + · rw [hslow j (by omega)] + exact H.slow_bound j (by omega) α i + q_pos := by + intro j hj + by_cases hjn : j = n + · subst j + simpa only [q', Function.update_self] using hq + · rw [hqold j (by omega)] + exact H.q_pos j (by omega) + q_bound := by + intro j hj + by_cases hjn : j = n + · subst j + simpa only [q', Function.update_self] using hqBB + · rw [hqold j (by omega)] + exact H.q_bound j (by omega) + rat_grid := by + intro j hj α + by_cases hjn : j = n + · subst j + simpa only [rat', q', Function.update_self] using hgrid α + · rw [hrat j (by omega), hqold j (by omega)] + exact H.rat_grid j (by omega) α + invariant := by + dsimp only + rw [houter] + with_reducible exact hnext } + exact ⟨Hnext, rfl, rfl, rfl, rfl⟩ + +noncomputable def append_admissible {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) (q : ℕ) + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) : State (n + 1) := + Classical.choose (exists_append_admissible H budget hbudget q K' pair hpair) + +@[simp] theorem append_admissible_slow + {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) (q : ℕ) + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) : + (H.append_admissible budget hbudget q K' pair hpair).slow = + Function.update H.slow n pair.1 := + (Classical.choose_spec (exists_append_admissible H budget hbudget q K' pair hpair)).1 + +@[simp] theorem append_admissible_rat + {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) (q : ℕ) + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) : + (H.append_admissible budget hbudget q K' pair hpair).rat = + Function.update H.rat n pair.2 := + (Classical.choose_spec (exists_append_admissible H budget hbudget q K' pair hpair)).2.1 + +@[simp] theorem append_admissible_q + {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) (q : ℕ) + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) : + (H.append_admissible budget hbudget q K' pair hpair).q = + Function.update H.q n q := + (Classical.choose_spec (exists_append_admissible H budget hbudget q K' pair hpair)).2.2.1 + +theorem append_admissible_K + {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) (q : ℕ) + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) : + (H.append_admissible budget hbudget q K' pair hpair).K = K' := + (Classical.choose_spec (exists_append_admissible H budget hbudget q K' pair hpair)).2.2.2 + +theorem append_admissible_prefix + {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) (q : ℕ) + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) (j : ℕ) (hj : j < n) : + (H.append_admissible budget hbudget q K' pair hpair).slow j = H.slow j ∧ + (H.append_admissible budget hbudget q K' pair hpair).rat j = H.rat j ∧ + (H.append_admissible budget hbudget q K' pair hpair).q j = H.q j := by + simp only [CertifiedFullChartFiniteHistory.append_admissible_slow, + CertifiedFullChartFiniteHistory.append_admissible_rat, CertifiedFullChartFiniteHistory.append_admissible_q, + Function.update_of_ne (Nat.ne_of_lt hj), and_self] + +@[simp] theorem append_admissible_entry + {n : ℕ} (H : State n) (budget : ℝ) (hbudget : budget ≤ Bphase) (q : ℕ) + (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N budget q K' pair) : + (H.append_admissible budget hbudget q K' pair hpair).slow n = pair.1 ∧ + (H.append_admissible budget hbudget q K' pair hpair).rat n = pair.2 ∧ + (H.append_admissible budget hbudget q K' pair hpair).q n = q := by + simp only [CertifiedFullChartFiniteHistory.append_admissible_slow, + CertifiedFullChartFiniteHistory.append_admissible_rat, CertifiedFullChartFiniteHistory.append_admissible_q, + Function.update_self, and_self] + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct + +variable {m : ℕ} {X : Type} {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) (budget : ℝ) + +theorem exists_fullChart_admissible_stage_branches + {past p : ℝ} {blocks : ℕ} + (hprevious : RationalTaggedConstraintCertificate J Set.univ K₀ past blocks) + (hp : 0 ≤ p) (hpast : past ≤ p) (hbudget : budget ≤ p) + (hm : (m : ℝ) ≤ p) (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hblocks : ((blocks + Fintype.card η * m : ℕ) : ℝ) ≤ p) : + ∃ n : ℕ, (n : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * budget + (p + 8) ^ 8) ∧ + ∃ branches : Fin n → ℕ × Set ((X ⊕ (Σ j, J j)) → ℝ), + (∀ i, 0 < (branches i).1 ∧ + (branches i).1 ≤ ⌊Real.exp ((Fintype.card η : ℝ) * budget)⌋₊ ∧ + RationalTaggedConstraintCertificate J Set.univ (branches i).2 p + (blocks + Fintype.card η * m)) ∧ + ∀ q K' pair, FullChartAdmissibleStageCorrection F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget q K' pair → + ∃ i, branches i = (q, K') := by + obtain ⟨n, hn, branches, hvalid, hcover⟩ := + exists_finite_rational_stage_branches Set.univ p ((Fintype.card η : ℝ) * budget) + hp (blocks + Fintype.card η * m) hm hJ hblocks + refine ⟨n, hn, branches, hvalid, ?_⟩ + intro q K' pair hpair + rcases hpair with ⟨_, _, _, _, hq, hqB, _, _, _, _, _, _, _, hcertificate, _⟩ + exact hcover q K' hq hqB + ((hprevious.monoB hpast).trans (hcertificate.monoB hbudget)) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial +open scoped TensorProduct + +theorem FullChartAdmissibleStageCorrection.mono_budget + {m : ℕ} {X : Type} {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {J : Fin m → Type} [∀ j, Fintype (J j)] {k : ℕ} + {fast : Submodule ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))} + {lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded} + {Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {K₀ : Set (X ⊕ (Σ j, J j) → ℝ)} + {Utag : ∀ j, Submodule ℝ (J j → ℝ)} + {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} {N : X → ℕ} + {budget budget' : ℝ} {q : ℕ} {K' : Set (X ⊕ (Σ j, J j) → ℝ)} + {pair : VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast)) × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))} + (h : FullChartAdmissibleStageCorrection F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget q K' pair) + (hle : budget ≤ budget') : + FullChartAdmissibleStageCorrection F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget' q K' pair := by + obtain ⟨hShom, hRhom, hSdeg, hRdeg, hq, hqbound, hsub, hdilation, hretain, + hslow, hgrid, hnext, horigin, hcertificate, hidentity⟩ := h + refine ⟨hShom, hRhom, hSdeg, hRdeg, hq, ?_, hsub, hdilation, hretain, + ?_, hgrid, hnext, horigin, hcertificate.monoB hle, hidentity⟩ + · exact hqbound.trans (Real.exp_le_exp.mpr + (mul_le_mul_of_nonneg_left hle (Nat.cast_nonneg (Fintype.card η)))) + · exact fun α i => (hslow α i).trans (Real.exp_le_exp.mpr hle) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial PolynomialTranslationLie RationalFilteredNilmanifold +open scoped TensorProduct Classical + +attribute [local irreducible] FullChartAdmissibleStageCorrection + realSymbolGradeQuotientPolynomial realSymbolGradeEvaluation restrictedMajorCorrection + +variable {m : ℕ} {X : Type} +variable {ι L η : Type*} [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] (k : ℕ) +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z left right : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (K₀ : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (budget : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "quotientReal" => ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast) +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) + +noncomputable def fullChartStageCountConstant (k a : ℕ) : ℕ := + Classical.choose (exists_finite_primitive_correction_budget k a) + +theorem fullChartStageCountConstant_ge_two (k a : ℕ) : + 2 ≤ fullChartStageCountConstant k a := + (Classical.choose_spec (exists_finite_primitive_correction_budget k a)).1 + +private theorem certified_basis_envelope {p : ℝ} (hp : 0 ≤ p) {a : ℕ} (ha : 254 ≤ a) : + Real.exp (((p + 2) ^ 2 + 2) ^ 63) ≤ Real.exp ((p + a) ^ a) ∧ + Real.exp ((p + 2) ^ 254) ≤ Real.exp ((p + a) ^ a) := by + have hbase : 1 ≤ p + 2 := by linarith + have hshift : p + 2 ≤ p + a := by + have : (2 : ℝ) ≤ (a : ℝ) := by exact_mod_cast (show 2 ≤ a by omega) + linarith + have hpow (n : ℕ) (hn : n ≤ a) : (p + 2) ^ n ≤ (p + a) ^ a := + (pow_le_pow_right₀ hbase hn).trans (pow_le_pow_left₀ (by positivity) hshift a) + refine ⟨Real.exp_le_exp.mpr ?_, Real.exp_le_exp.mpr (hpow 254 ha)⟩ + exact (show ((p + 2) ^ 2 + 2) ^ 63 ≤ (p + 2) ^ 252 by + simpa using shifted_power_budget_le hp 2 63).trans (hpow 252 (by omega)) + +private theorem vector_correction_cover_on_set + {A B V α : Type*} [AddCommGroup V] [Module ℚ V] [Module ℝ V] [IsScalarTower ℚ ℝ V] + (Kbase : Submodule ℝ (B → ℝ)) (K : Set (A ⊕ B → ℝ)) + (hset : K = {t | (fun z => t (Sum.inr z)) ∈ Kbase}) + (f₁ f₂ f₃ : α → VectorPolynomial (A ⊕ B) ℚ V) + (admissible : α → Prop) {count : ℕ} (candidate : Fin count → α) + (hcover : ∀ a, admissible a → ∃ j, ∀ (u : A → ℝ) (v : B → ℝ), v ∈ Kbase → + eval₂ (Sum.elim u v) (f₁ (candidate j)) = eval₂ (Sum.elim u v) (f₁ a) ∧ + eval₂ (Sum.elim u v) (f₂ (candidate j)) = eval₂ (Sum.elim u v) (f₂ a) ∧ + eval₂ (Sum.elim u v) (f₃ (candidate j)) = eval₂ (Sum.elim u v) (f₃ a)) : + ∀ a, admissible a → ∃ j, ∀ t ∈ K, + eval₂ t (f₁ (candidate j)) = eval₂ t (f₁ a) ∧ + eval₂ t (f₂ (candidate j)) = eval₂ t (f₂ a) ∧ + eval₂ t (f₃ (candidate j)) = eval₂ t (f₃ a) := by + intro a ha + obtain ⟨j, hj⟩ := hcover a ha + refine ⟨j, ?_⟩ + intro t ht + have ht' : (fun z => t (Sum.inr z)) ∈ Kbase := by + rw [hset] at ht + exact ht + have h := hj (fun i => t (Sum.inl i)) (fun z => t (Sum.inr z)) ht' + have heq : Sum.elim (fun i => t (Sum.inl i)) (fun z => t (Sum.inr z)) = t := by + funext i + cases i <;> rfl + simpa only [heq] using h + +theorem exists_full_chart_finite_stage_representatives [Fintype X] + (q : ℕ) (K' : Set (X ⊕ (Σ j, J j) → ℝ)) + (p : ℝ) (blocks a : ℕ) (ha : 254 ≤ a) + (hcert : RationalTaggedConstraintCertificate J Set.univ K' p blocks) + (hp : 0 ≤ p) (hX : (Fintype.card X : ℝ) ≤ p) + (hJ : (Fintype.card (Σ j, J j) : ℝ) ≤ p) + (hη : (Fintype.card η : ℝ) ≤ p) (hblocks : (blocks : ℝ) ≤ p) + (hretained : ∀ point, (∀ j, (fun i => point (Sum.inr ⟨j, i⟩)) ∈ Utag j) → point ∈ K') + (hpoly : ∀ j ex, ex ≠ 0 → coefficients (poly j) ex ∈ Utag j) + (hN : ∀ i, 1 ≤ N i) (hq : 0 < q) + (hqcap : (q : ℝ) ≤ Real.exp ((p + a) ^ a)) + (hbudget : budget ≤ (p + a) ^ a) : + ∃ count : ℕ, (count : ℝ) ≤ + Real.exp ((p + fullChartStageCountConstant k a) ^ fullChartStageCountConstant k a) ∧ + ∃ candidate : Fin count → + (VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal × + VectorPolynomial (X ⊕ (Σ j, J j)) ℚ quotientReal), + (∀ j, FullChartAdmissibleStageCorrection F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget q K' (candidate j)) ∧ + ∀ pair, FullChartAdmissibleStageCorrection F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget q K' pair → + ∃ j, ∀ t ∈ K', + eval₂ t (candidate j).1 = eval₂ t pair.1 ∧ + eval₂ t (candidate j).2 = eval₂ t pair.2 ∧ + eval₂ t (realChartSubstitute chart (candidate j).1) = + eval₂ t (realChartSubstitute chart pair.1) := by + obtain ⟨n, Kbase, e, matrix, d, _, hdim, _, _, _, _, he, _, hd, hdCap, hegrid, hset, hret⟩ := + hcert.exists_certified_chart_basis_budget hp hJ hblocks + let L := Real.exp (((p + 2) ^ 2 + 2) ^ 63) + let M := Real.exp budget + let admissible := FullChartAdmissibleStageCorrection F b ω hF J k fast basis lift + Z left right K₀ Utag poly N budget q K' + have hA := fullTaggedMajorTopCoordinates_coefficients_mem J poly Utag hpoly Kbase + (hret Utag hretained) + have hdegree : ∀ pair, admissible pair → ∀ i, + (coordinate (basis.coord i).toAddMonoidHom pair.1).totalDegree ≤ k ∧ + (coordinate (basis.coord i).toAddMonoidHom pair.2).totalDegree ≤ k := by + intro pair h i + unfold admissible FullChartAdmissibleStageCorrection at h + exact ⟨h.2.2.1 i, h.2.2.2.1 i⟩ + have hcap : ∀ pair, admissible pair → ∀ i ex, + |basis.coord i (coefficients pair.1 ex)| ≤ M := by + intro pair h i ex + unfold admissible FullChartAdmissibleStageCorrection at h + exact h.2.2.2.2.2.2.2.2.2.1 ex i + have hgrid : ∀ pair, admissible pair → ∀ ex, + (fun i => basis.coord i (coefficients pair.2 ex)) ∈ realDenominatorGrid q := by + intro pair h ex + unfold admissible FullChartAdmissibleStageCorrection at h + exact h.2.2.2.2.2.2.2.2.2.2.1 ex + have hidentity : ∀ pair, admissible pair → ∀ (u : X → ℝ) (v : (Σ j, J j) → ℝ), + v ∈ Kbase → eval₂ (Sum.elim u v) + (F.realSymbolGradeQuotientPolynomial b ω hF wt fast k (left⁻¹ * Z * right⁻¹).coord) = + eval₂ (Sum.elim u v) (realChartSubstitute chart pair.1) + eval₂ (Sum.elim u v) pair.2 := by + intro pair h u v hv + unfold admissible FullChartAdmissibleStageCorrection at h + have ht : Sum.elim u v ∈ K' := by + rw [hset] + exact hv + with_reducible exact h.2.2.2.2.2.2.2.2.2.2.2.2.2.2 (Sum.elim u v) ht + obtain ⟨count, hcount, candidate, hvalid, hcover⟩ := exists_finite_vector_correction_representatives + Kbase e basis (fun i => (N i : ℝ)) (fun i => by exact_mod_cast hN i) + (fullTaggedMajorTopCoordinates J poly) hA + (F.realSymbolGradeQuotientPolynomial b ω hF wt fast k (left⁻¹ * Z * right⁻¹).coord) + k q d hq hd L M (Real.exp_nonneg budget) he hegrid + Prod.fst Prod.snd admissible hdegree hcap hgrid hidentity + refine ⟨count, ?_, candidate, hvalid, ?_⟩ + · have hI : (Fintype.card (Σ j, Fin (n j)) : ℝ) ≤ p := + (Nat.cast_le.mpr hdim).trans hJ + have henvelope := certified_basis_envelope hp ha + have hcountbudget := + (Classical.choose_spec (exists_finite_primitive_correction_budget k a)).2 + (Fintype.card X) (Fintype.card (Σ j, J j)) (Fintype.card (Σ j, Fin (n j))) + (Fintype.card η) q d p L M hp hX hJ hI hη hqcap + (hdCap.trans henvelope.2) henvelope.1 (Real.exp_nonneg budget) + (Real.exp_le_exp.mpr hbudget) + apply (Nat.cast_le.mpr hcount).trans + simpa only [Fintype.card_sum, fullChartStageCountConstant] using hcountbudget + · with_reducible + exact vector_correction_cover_on_set (V := quotientReal) Kbase K' hset Prod.fst Prod.snd + (fun pair => realChartSubstitute chart pair.1) admissible candidate hcover + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +open Module VectorPolynomial +open scoped TensorProduct Classical + +attribute [local irreducible] realSymbolGradeEvaluation restrictedMajorCorrection + realSymbolGradeQuotientPolynomial outer realChartSubstitute + +variable {m : ℕ} {X : Type} {ι L η : Type*} + [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s : ℕ} + +variable (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) +variable (J : Fin m → Type) [∀ j, Fintype (J j)] +variable (fast : Submodule ℚ F.AssociatedGraded) +variable (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) +variable (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) +variable (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) +variable (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) +variable (Utag : ∀ j, Submodule ℝ (J j → ℝ)) +variable (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) +variable (N : X → ℕ) (Bphase : ℝ) + +local notation "wt" => fullTaggedVariableWeight (X := X) J +local notation "chart" => normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) +local notation "State" => CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase + +variable {F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase} + +structure StageBounds (cap cumulative : ℕ → ℝ) {n : ℕ} (H : State n) : Prop where + certificate : RationalTaggedConstraintCertificate J Kinitial H.K (cumulative n) + (n * (Fintype.card η * m)) + slow_bound : ∀ j < n, ∀ α i, + |basis.coord i (coefficients (H.slow j) α)| ≤ Real.exp (cap j) + q_bound : ∀ j < n, (H.q j : ℝ) ≤ Real.exp ((Fintype.card η : ℝ) * cap j) + +theorem StageBounds.initial (cap cumulative : ℕ → ℝ) + (hK : ∀ t ∈ Kinitial, ∀ r : ℚ, (fun i => (r : ℝ) ^ wt i * t i) ∈ Kinitial) : + StageBounds cap cumulative + (initial F b ω hF J fast basis lift Z Kinitial Utag poly N Bphase hK) where + certificate := by + unfold CertifiedFullChartFiniteHistory.initial + simpa only [Nat.zero_mul] using + RationalTaggedConstraintCertificate.empty (J := J) Kinitial (cumulative 0) + slow_bound := fun j hj => (Nat.not_lt_zero j hj).elim + q_bound := fun j hj => (Nat.not_lt_zero j hj).elim + +theorem StageBounds.of_admissible_child {n : ℕ} + {cap cumulative : ℕ → ℝ} {H : State n} (hH : StageBounds cap cumulative H) + (Hnext : State (n + 1)) + (hprefix : ∀ j < n, Hnext.slow j = H.slow j ∧ Hnext.rat j = H.rat j ∧ Hnext.q j = H.q j) + (hpair : FullChartAdmissibleStageCorrection F b ω hF J (n + 1) fast basis lift + Z H.outer.1 H.outer.2 H.K Utag poly N (cap n) (Hnext.q n) Hnext.K + (Hnext.slow n, Hnext.rat n)) + (hmono : cumulative n ≤ cumulative (n + 1)) (hcap : cap n ≤ cumulative (n + 1)) : + StageBounds cap cumulative Hnext := by + have hcoeff := hpair.2.2.2.2.2.2.2.2.2.1 + have hq := hpair.2.2.2.2.2.1 + have hcert := hpair.2.2.2.2.2.2.2.2.2.2.2.2.2.1 + refine ⟨?_, ?_, ?_⟩ + · simpa only [Nat.succ_mul] using + (hH.certificate.monoB hmono).trans (hcert.monoB hcap) + · intro j hj α i + by_cases h : j = n + · subst j + exact hcoeff α i + · rw [(hprefix j (by omega)).1] + exact hH.slow_bound j (by omega) α i + · intro j hj + by_cases h : j = n + · subst j + exact hq + · rw [(hprefix j (by omega)).2.2] + exact hH.q_bound j (by omega) + +noncomputable def StageBounds.to_budget {n : ℕ} + {cap cumulative : ℕ → ℝ} {H : State n} (hH : StageBounds cap cumulative H) + (hcap : ∀ j < n, cap j ≤ cumulative n) : + CertifiedFullChartFiniteHistory F b ω hF J fast basis lift Z Kinitial Utag poly N + (cumulative n) n where + slow := H.slow + rat := H.rat + q := H.q + K := H.K + certificate := hH.certificate + subset := H.subset + dilation := H.dilation + retained := H.retained + slow_bound := fun j hj α i => (hH.slow_bound j hj α i).trans (Real.exp_le_exp.mpr (hcap j hj)) + q_pos := H.q_pos + q_bound := fun j hj => (hH.q_bound j hj).trans + (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left (hcap j hj) (Nat.cast_nonneg _))) + rat_grid := H.rat_grid + invariant := H.invariant + +theorem StageBounds.to_budget_K {n : ℕ} + {cap cumulative : ℕ → ℝ} {H : State n} (hH : StageBounds cap cumulative H) + (hcap : ∀ j < n, cap j ≤ cumulative n) : (hH.to_budget hcap).K = H.K := rfl + +theorem StageBounds.to_budget_outer {n : ℕ} + {cap cumulative : ℕ → ℝ} {H : State n} (hH : StageBounds cap cumulative H) + (hcap : ∀ j < n, cap j ≤ cumulative n) : + outer F b ω hF J fast basis lift Z Kinitial Utag poly N (cumulative n) + (hH.to_budget hcap) = H.outer := by + unfold outer + apply F.restrictedMajorOuterFactors_congr + · intro j hj + unfold StageBounds.to_budget + rfl + · intro j hj + unfold StageBounds.to_budget + rfl + +end Erdos3.NilpotentLieFiltration.CertifiedFullChartFiniteHistory + +end + +section + +namespace Erdos3.NilpotentLieFiltration +open Module VectorPolynomial +open scoped TensorProduct + +attribute [local irreducible] realSymbolGradeEvaluation restrictedMajorCorrection + realSymbolGradeQuotientPolynomial CertifiedFullChartFiniteHistory.outer + FullChartControlledFactors + +theorem exists_certified_full_chart_history_control (s a : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ + ∀ {X ι η L : Type} [Fintype X] [Fintype ι] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] {m : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (fast : Submodule ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))) + (lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (Bphase B p : ℝ) (H qS : ℕ) (n : ℕ), + 1 ≤ H → 0 ≤ p → 0 ≤ Bphase → 0 < qS → n ≤ s → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → + (∀ i j z, RationalHeightLE ((F.associatedGradedBasis b ω hF).repr + ⁅F.associatedGradedBasis b ω hF i, F.associatedGradedBasis b ω hF j⁆ z) H) → + (qS : ℝ) * Real.exp ((s : ℝ) * (Fintype.card η : ℝ) * Bphase) ≤ Real.exp p → + (Fintype.card η : ℝ) * B * Real.exp Bphase ≤ Real.exp ((p + 2) ^ a) → + (∀ i j, |((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ (basis j)) i| ≤ B) → + (∀ j, (fun i => ((F.associatedGradedBasis b ω hF).baseChange ℝ).repr + (lift.baseChange ℝ (basis j)) i) ∈ realDenominatorGrid qS) → + ∀ history : CertifiedFullChartFiniteHistory F b ω hF J fast basis lift + Z Kinitial Utag poly N Bphase n, + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 + ((p + C) ^ C) := by + obtain ⟨C, hC, hprefix⟩ := exists_restricted_chart_prefix_control s a + refine ⟨C, hC, ?_⟩ + intro X ι η L _ _ _ _ _ m F b ω hF J _ fast basis lift Z Kinitial Utag poly N + Bphase B p H qS n hH hp hBphase hqS hn hι hσ hHp hstructure hden hcost hentry hgrid history + obtain ⟨q, hq, hqbound, _, Echart, hE, hEbound, hRgrid⟩ := + hprefix F b ω hF (fullTaggedVariableWeight J) (fullTaggedVariableWeight_pos J) + H p hH hp hι hσ hHp hstructure fast lift basis B Bphase qS hBphase hqS + hden hcost hentry hgrid + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) (fullTaggedMajorTopCoordinates J poly)) + (fullTaggedMajorChart_homogeneous J poly (fun i => (N i : ℝ))) + history.slow history.rat history.q n hn history.q_pos history.q_bound + history.slow_bound history.rat_grid + unfold FullChartControlledFactors CertifiedFullChartFiniteHistory.outer + with_reducible exact ⟨q, hq, hqbound, Echart, hE, hEbound, hRgrid⟩ + +namespace CertifiedFullChartFiniteHistory +variable {X ι η L : Type} [LieRing L] [LieAlgebra ℚ L] [Fintype η] {s m : ℕ} + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + + {J : Fin m → Type} [∀ j, Fintype (J j)] + {fast : Submodule ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ fast))} + {lift : (F.AssociatedGraded ⧸ fast) →ₗ[ℚ] F.AssociatedGraded} + {Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)} + {Utag : ∀ j, Submodule ℝ (J j → ℝ)} + {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} {N : X → ℕ} {Bphase : ℝ} + +theorem terminal_mem_fast + (history : CertifiedFullChartFiniteHistory F b ω hF J fast basis lift + Z Kinitial Utag poly N Bphase s) + (hfast : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω fast) : + ∀ t ∈ history.K, + eval₂ t (F.realGradedSymbolPolynomial b ω hF (fullTaggedVariableWeight J) + (history.outer.1⁻¹ * Z * history.outer.2⁻¹).coord) ∈ fast.baseChange ℝ := by + intro t ht + apply (F.restricted_symbol_grade_terminal b ω hF (fullTaggedVariableWeight J) + fast hfast _ t).mpr + with_reducible exact history.invariant_outer t ht + +end CertifiedFullChartFiniteHistory +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped TensorProduct + +attribute [local irreducible] weightedAdaptedRealChartHom realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom + +namespace CertifiedFullChartFiniteHistory + +variable {m s : ℕ} {X ι η L : Type} [Fintype η] [LieRing L] [LieAlgebra ℚ L] + {F : NilpotentLieFiltration L s} {b : Basis ι ℚ L} {ω : ι → ℕ} + {hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})} + {J : Fin m → Type} [∀ j, Fintype (J j)] + {W : LieSubalgebra ℚ F.AssociatedGraded} + {basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ W.toSubmodule))} + {lift : (F.AssociatedGraded ⧸ W.toSubmodule) →ₗ[ℚ] F.AssociatedGraded} + {Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)} + {Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)} + {Utag : ∀ j, Submodule ℝ (J j → ℝ)} + {poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)} {N : X → ℕ} {Bphase : ℝ} + +local notation "wt" => fullTaggedVariableWeight (X := X) J + +theorem globalRestriction_terminal_mem_pointwise + (history : CertifiedFullChartFiniteHistory F b ω hF J W.toSubmodule basis lift + Z Kinitial Utag poly N Bphase s) + (hW : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule) + (β : (X ⊕ (Σ j, J j)) → MvPolynomial (X ⊕ (Σ j, J j)) ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE wt (wt i)) + (g : (F.realification.adaptedPolynomialFiltration wt).Group) + (hZ : F.realPolynomialSymbolHom b ω hF wt g = Z) + (htop : ∀ t : X ⊕ (Σ j, J j) → ℝ, + (fun i => MvPolynomial.eval t (weightedHomogeneousComponent wt (wt i) (β i))) ∈ history.K) : + let pull := F.realSymbolHomogeneousPullbackHom b ω hF wt wt + (fun i => weightedHomogeneousComponent wt (wt i) (β i)) + (fun _i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) + ((pull history.outer.1)⁻¹ * + F.realPolynomialSymbolHom b ω hF wt (F.weightedAdaptedRealChartHom wt wt β hβ g) * + (pull history.outer.2)⁻¹).coord ∈ + realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF wt W) := by + intro pull + rw [F.realPolynomialSymbolHom_weightedAdaptedRealChart b ω hF wt wt β hβ g, hZ] + change ((pull history.outer.1)⁻¹ * pull Z * (pull history.outer.2)⁻¹).coord ∈ _ + rw [← map_inv, ← map_inv, ← map_mul, ← map_mul] + exact F.realSymbolHomogeneousPullback_mem_of_range b ω hF wt wt _ _ W history.K _ + (history.terminal_mem_fast hW) htop + +theorem nonempty_globalMarkedNativeFactors [Fintype ι] + (history : CertifiedFullChartFiniteHistory F b ω hF J W.toSubmodule basis lift + Z Kinitial Utag poly N Bphase s) + (hW : BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule) + (β : (X ⊕ (Σ j, J j)) → MvPolynomial (X ⊕ (Σ j, J j)) ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE wt (wt i)) + (g : (F.realification.adaptedPolynomialFiltration wt).Group) + (hZ : F.realPolynomialSymbolHom b ω hF wt g = Z) + (htop : ∀ t : X ⊕ (Σ j, J j) → ℝ, + (fun i => MvPolynomial.eval t (weightedHomogeneousComponent wt (wt i) (β i))) ∈ history.K) : + let pull := F.realSymbolHomogeneousPullbackHom b ω hF wt wt + (fun i => weightedHomogeneousComponent wt (wt i) (β i)) + (fun _i => weightedHomogeneousComponent_isWeightedHomogeneous _ _) + Nonempty (GlobalMarkedNativeFactors F b ω hF wt W + (F.weightedAdaptedRealChartHom wt wt β hβ g) + (pull history.outer.1) (pull history.outer.2)) := by + intro pull + exact F.nonempty_globalMarkedNativeFactors b ω hF wt W _ _ _ + (fullTaggedVariableWeight_pos J) + (history.globalRestriction_terminal_mem_pointwise hW β hβ g hZ htop) + +end CertifiedFullChartFiniteHistory +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module VectorPolynomial _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped TensorProduct + +attribute [local irreducible] realPolynomialSymbolLift realPolynomialSymbolHom + realSymbolHomogeneousPullbackHom weightedAdaptedRealChartHom realChartSubstitute + symbolPointwiseSubalgebra realificationLieSubalgebra + PolynomialRationalGrid PolynomialSlowBound + +theorem exists_controlled_terminal_globalMarkedNativeFactors (s a : ℕ) : + ∃ Ce Cr : ℕ, 2 ≤ Ce ∧ 2 ≤ Cr ∧ + ∀ {m : ℕ} {X ι η L : Type} [Fintype X] [Fintype ι] [Fintype η] + [LieRing L] [LieAlgebra ℚ L] + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) (ω : ι → ℕ) + (hF : ∀ j, F.layer j = Submodule.span ℚ (b '' {i | j ≤ ω i})) + (J : Fin m → Type) [∀ j, Fintype (J j)] + (W : LieSubalgebra ℚ F.AssociatedGraded) + (basis : Basis η ℝ (ℝ ⊗[ℚ] (F.AssociatedGraded ⧸ W.toSubmodule))) + (lift : (F.AssociatedGraded ⧸ W.toSubmodule) →ₗ[ℚ] F.AssociatedGraded) + (Z : F.RealPolynomialSymbolGroup (fullTaggedVariableWeight (X := X) J)) + (Kinitial : Set (X ⊕ (Σ j, J j) → ℝ)) + (Utag : ∀ j, Submodule ℝ (J j → ℝ)) + (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) (N : X → ℕ) + (Bphase budget : ℝ) + (history : CertifiedFullChartFiniteHistory F b ω hF J W.toSubmodule basis lift + Z Kinitial Utag poly N Bphase s), + BasisGradedSubmodule (F.associatedGradedBasis b ω hF) ω W.toSubmodule → + FullChartControlledFactors F b ω hF J poly N history.outer.1 history.outer.2 budget → + ∀ (β δ : (X ⊕ (Σ j, J j)) → MvPolynomial (X ⊕ (Σ j, J j)) ℝ) + (hβ : ∀ i, β i ∈ weightedSupportLE + (fullTaggedVariableWeight (X := X) J) (fullTaggedVariableWeight (X := X) J i)) + (_hδ : ∀ i, δ i ∈ weightedSupportLE + (fullTaggedVariableWeight (X := X) J) (fullTaggedVariableWeight (X := X) J i)), + (∀ i, weightedHomogeneousComponent (fullTaggedVariableWeight (X := X) J) + (fullTaggedVariableWeight (X := X) J i) (δ i) = + MvPolynomial.aeval + (fun j => weightedHomogeneousComponent (fullTaggedVariableWeight (X := X) J) + (fullTaggedVariableWeight (X := X) J j) (β j)) + (normalizedRealPolynomialChart (fun i => (N i : ℝ)) + (fullTaggedMajorTopCoordinates J poly) i)) → + (∀ t : X ⊕ (Σ j, J j) → ℝ, + (fun i => MvPolynomial.eval t + (weightedHomogeneousComponent (fullTaggedVariableWeight (X := X) J) + (fullTaggedVariableWeight (X := X) J i) (β i))) ∈ history.K) → + ∀ (D H : ℕ) (p : ℝ), 0 < D → 1 ≤ H → 0 ≤ p → + (Fintype.card ι : ℝ) ≤ p → (Fintype.card (X ⊕ (Σ j, J j)) : ℝ) ≤ p → + (H : ℝ) ≤ Real.exp p → Real.exp budget * (D : ℝ) ^ s ≤ Real.exp p → + (∀ i j k, RationalHeightLE (b.repr ⁅b i, b j⁆ k) H) → + (∀ i, realPolynomialCoefficientGrid D + (weightedHomogeneousComponent (fullTaggedVariableWeight (X := X) J) + (fullTaggedVariableWeight (X := X) J i) (β i))) → + ∃ q n : ℕ, 0 < q ∧ (q : ℝ) ≤ Real.exp budget ∧ + 0 < n ∧ (n : ℝ) ≤ Real.exp ((p + Cr) ^ Cr) ∧ q * D ^ s ∣ n ∧ + ∀ g : (F.realification.adaptedPolynomialFiltration + (fullTaggedVariableWeight (X := X) J)).Group, + F.realPolynomialSymbolHom b ω hF (fullTaggedVariableWeight (X := X) J) g = Z → + let pull := F.realSymbolHomogeneousPullbackHom b ω hF + (fullTaggedVariableWeight (X := X) J) (fullTaggedVariableWeight (X := X) J) + (fun i => weightedHomogeneousComponent (fullTaggedVariableWeight (X := X) J) + (fullTaggedVariableWeight (X := X) J i) (β i)) + (fun _ => weightedHomogeneousComponent_isWeightedHomogeneous _ _) + ∃ A : GlobalMarkedNativeFactors F b ω hF (fullTaggedVariableWeight (X := X) J) W + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight (X := X) J) + (fullTaggedVariableWeight (X := X) J) β hβ g) + (pull history.outer.1) (pull history.outer.2), + F.PolynomialRationalGrid b (fullTaggedVariableWeight (X := X) J) n A.right ∧ + ∀ {τ : Type*} [Fintype τ] (v : τ → ℕ), (∀ i, 0 < v i) → + (Fintype.card τ : ℝ) ≤ p → + ∀ (γ : (X ⊕ (Σ j, J j)) → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (fullTaggedVariableWeight (X := X) J i)) + (T : τ → ℝ), (∀ i, 0 < T i) → + ∀ B : ℝ, 1 ≤ B → + (∀ i, realPolynomialMass (scaleMvPolynomialAxes T (MvPolynomial.aeval γ (δ i))) ≤ B) → + (((Fintype.card (X ⊕ (Σ j, J j)) : ℝ) + 1) ^ s * + Real.exp budget * B ^ s ≤ Real.exp ((p + 2) ^ a)) → + F.PolynomialSlowBound b v T (Real.exp ((p + Ce) ^ Ce)) + (F.weightedAdaptedRealChartHom (fullTaggedVariableWeight (X := X) J) + v γ hγ A.left) := by + obtain ⟨Ce, Cr, hCe, hCr, hnormalize⟩ := + exists_chartwise_controlled_globalMarkedNativeFactors s a + refine ⟨Ce, Cr, hCe, hCr, ?_⟩ + intro m X ι η L _ _ _ _ _ F b ω hF J _ W basis lift Z Kinitial Utag poly N + Bphase budget history hW hcontrol β δ hβ hδ hδtop htop D H p hD hH hp + hι hσ hHp hden hbracket hgrid + let w := fullTaggedVariableWeight (X := X) J + let βtop := fun i => weightedHomogeneousComponent w (w i) (β i) + have hβtop : ∀ i, (βtop i).IsWeightedHomogeneous w (w i) := + fun _ => weightedHomogeneousComponent_isWeightedHomogeneous _ _ + let pull := F.realSymbolHomogeneousPullbackHom b ω hF w w βtop hβtop + obtain ⟨q, hq, hqB, e₀, r₀, he₀, hr₀, hrGrid, hl, heSlow⟩ := + FullChartControlledFactors.exists_prescribed_full_lifts F b ω hF J poly N + history.outer.1 history.outer.2 hcontrol w βtop δ hβtop hδ hδtop D hD hgrid + have hlp : ((q * D ^ s : ℕ) : ℝ) ≤ Real.exp p := by + calc + ((q * D ^ s : ℕ) : ℝ) = (q : ℝ) * (D : ℝ) ^ s := by simp only [Nat.cast_mul, Nat.cast_pow] + _ ≤ Real.exp budget * (D : ℝ) ^ s := + mul_le_mul_of_nonneg_right hqB (pow_nonneg (Nat.cast_nonneg _) _) + _ ≤ Real.exp p := hden + obtain ⟨n, hn, hnp, hln, hfactor⟩ := hnormalize F b ω hF w + (fullTaggedVariableWeight_pos J) H (q * D ^ s) p hH hl hp hι hσ hHp hlp hbracket + refine ⟨q, n, hq, hqB, hn, hnp, hln, ?_⟩ + intro g hZ + change ∃ A : GlobalMarkedNativeFactors F b ω hF w W + (F.weightedAdaptedRealChartHom w w β hβ g) + (pull history.outer.1) (pull history.outer.2), _ + have hfast := history.globalRestriction_terminal_mem_pointwise hW β hβ g hZ htop + change ((pull history.outer.1)⁻¹ * + F.realPolynomialSymbolHom b ω hF w (F.weightedAdaptedRealChartHom w w β hβ g) * + (pull history.outer.2)⁻¹).coord ∈ + realificationLieSubalgebra (F.symbolPointwiseSubalgebra b ω hF w W) at hfast + have hresult := hfactor W + (F.weightedAdaptedRealChartHom w w β hβ g) e₀ r₀ + (pull history.outer.1) (pull history.outer.2) he₀ hr₀ hfast hrGrid + apply Exists.elim hresult + intro A hA + refine ⟨A, hA.1, ?_⟩ + intro τ _ v hv hτ γ hγ T hT B hB hmass hbudget + apply hA.2 v hv hτ γ hγ T hT + exact F.polynomialSlowBound_mono b v T hT hbudget _ + (heSlow v γ hγ T hT B hB hmass) + +end Erdos3.NilpotentLieFiltration + +end + +section + +namespace Erdos3 + +open _root_.MvPolynomial _root_.OAI.MvPolynomial + +theorem realPolynomialMass_constant_specialization {σ τ : Type*} + (T : τ → ℝ) (x : σ → ℝ) (P : MvPolynomial σ ℝ) : + realPolynomialMass (scaleMvPolynomialAxes T + (MvPolynomial.aeval (fun i => (MvPolynomial.C (x i) : MvPolynomial τ ℝ)) P)) = + |MvPolynomial.eval x P| := by + have hC : MvPolynomial.aeval (fun i => (MvPolynomial.C (x i) : MvPolynomial τ ℝ)) P = + MvPolynomial.C (MvPolynomial.eval x P) := by + simpa only [Function.comp_def, MvPolynomial.aeval_eq_eval] using + (MvPolynomial.aeval_C_comp_left (R := ℝ) x P : + MvPolynomial.aeval (MvPolynomial.C (σ := τ) ∘ x) P = + MvPolynomial.C (MvPolynomial.aeval x P)) + rw [hC] + have hscale : scaleMvPolynomialAxes T (MvPolynomial.C (MvPolynomial.eval x P)) = + MvPolynomial.C (MvPolynomial.eval x P) := by + apply MvPolynomial.funext + intro y + rw [scaleMvPolynomialAxes_eval, MvPolynomial.eval_C, MvPolynomial.eval_C] + rw [hscale, realPolynomialMass_C] + +namespace NilpotentLieFiltration + +open Module VectorPolynomial NilpotentLieBCHGroup +open scoped TensorProduct + +attribute [local irreducible] weightedAdaptedRealChartHom realChartSubstitute + +variable {σ τ ι L : Type*} [LieRing L] [LieAlgebra ℚ L] {s : ℕ} + (F : NilpotentLieFiltration L s) (b : Basis ι ℚ L) + (w : σ → ℕ) + +theorem weightedAdaptedRealChartHom_constantChart + (v : τ → ℕ) (x : σ → ℝ) + (g : (F.realification.adaptedPolynomialFiltration w).Group) : + F.weightedAdaptedRealChartHom w v + (fun i => (MvPolynomial.C (x i) : MvPolynomial τ ℝ)) + (fun i => weightedSupportLE_C v (w i) (x i)) g = + F.realification.adaptedConstantGroupHom v + (F.adaptedPolynomialRealValueHom w x g) := by + apply NilpotentLieBCHGroup.ext + apply Subtype.ext + rw [F.weightedAdaptedRealChartHom_coord, F.realification.adaptedConstantGroupHom_log] + apply sub_eq_zero.mp + apply eq_zero_of_eval₂_zero (K := ℝ) + intro t + simp only [map_sub, eval₂_realChartSubstitute, MvPolynomial.eval_C, + VectorPolynomial.eval₂_monomial, Finsupp.prod_zero_index, one_smul, + F.adaptedPolynomialRealValueHom_coord, sub_self] + +theorem polynomialSlowBound_constantChart_value + (v : τ → ℕ) (T : τ → ℝ) (bound : ℝ) (x : σ → ℝ) + (g : (F.realification.adaptedPolynomialFiltration w).Group) + (hslow : F.PolynomialSlowBound b v T bound + (F.weightedAdaptedRealChartHom w v + (fun i => (MvPolynomial.C (x i) : MvPolynomial τ ℝ)) + (fun i => weightedSupportLE_C v (w i) (x i)) g)) (i : ι) : + |(b.baseChange ℝ).repr (F.adaptedPolynomialRealValueHom w x g).coord i| ≤ bound := by + rw [F.weightedAdaptedRealChartHom_constantChart] at hslow + simpa only [F.realification.adaptedConstantGroupHom_log, coefficients_monomial, + Finsupp.single_eq_same, monomialScale_zero, div_one] using hslow 0 i + +theorem value_bound_of_terminal_chart_control [Fintype σ] + (δ : σ → MvPolynomial σ ℝ) (p budget : ℝ) (a Ce : ℕ) (hp : 0 ≤ p) + (g : (F.realification.adaptedPolynomialFiltration w).Group) + (hcharts : ∀ {τ : Type*} [Fintype τ] (v : τ → ℕ), (∀ i, 0 < v i) → + (Fintype.card τ : ℝ) ≤ p → + ∀ (γ : σ → MvPolynomial τ ℝ) + (hγ : ∀ i, γ i ∈ weightedSupportLE v (w i)) + (T : τ → ℝ), (∀ i, 0 < T i) → + ∀ mass : ℝ, 1 ≤ mass → + (∀ i, realPolynomialMass (scaleMvPolynomialAxes T + (MvPolynomial.aeval γ (δ i))) ≤ mass) → + (((Fintype.card σ : ℝ) + 1) ^ s * Real.exp budget * mass ^ s ≤ + Real.exp ((p + 2) ^ a)) → + F.PolynomialSlowBound b v T (Real.exp ((p + Ce) ^ Ce)) + (F.weightedAdaptedRealChartHom w v γ hγ g)) + (x : σ → ℝ) (mass : ℝ) (hmass : 1 ≤ mass) + (hpoint : ∀ i, |MvPolynomial.eval x (δ i)| ≤ mass) + (hbudget : ((Fintype.card σ : ℝ) + 1) ^ s * Real.exp budget * mass ^ s ≤ + Real.exp ((p + 2) ^ a)) (i : ι) : + |(b.baseChange ℝ).repr (F.adaptedPolynomialRealValueHom w x g).coord i| ≤ + Real.exp ((p + Ce) ^ Ce) := by + apply F.polynomialSlowBound_constantChart_value b w (fun _ : PEmpty => 1) + (fun _ => 1) _ x g + apply hcharts (fun _ : PEmpty => 1) (fun i => PEmpty.elim i) + (by simpa only [Fintype.card_pempty, Nat.cast_zero] using hp) + (fun i => MvPolynomial.C (x i)) + (fun i => weightedSupportLE_C (fun _ : PEmpty => 1) (w i) (x i)) + (fun _ => 1) (fun i => PEmpty.elim i) mass hmass + (fun i => ?_) hbudget + simpa only [realPolynomialMass_constant_specialization] using hpoint i + +end NilpotentLieFiltration +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TopSupportSubstitution.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TopSupportSubstitution.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c329ce5f7e271dc590598f1b975322874c6b845 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TopSupportSubstitution.lean @@ -0,0 +1,63 @@ +import Mathlib.RingTheory.MvPolynomial.Homogeneous +import OAI.Combinatorics.Progressions.Estimates.SquarefreeSplitCount + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators Classical + +theorem mem_weightedSupportLE_one_iff {σ R : Type*} [CommRing R] + (P : MvPolynomial σ R) (d : ℕ) : + P ∈ weightedSupportLE (1 : σ → ℕ) d ↔ P.totalDegree ≤ d := by + simpa only [weightedTotalDegree_one] using mem_weightedSupportLE_iff (1 : σ → ℕ) d P + +theorem weightedSupportLT_aeval {σ τ R : Type*} [CommRing R] + (w : σ → ℕ) (v : τ → ℕ) (f : σ → MvPolynomial τ R) + (hf : ∀ i, f i ∈ weightedSupportLE v (w i)) + {P : MvPolynomial σ R} {d : ℕ} (hP : P ∈ weightedSupportLT w d) : + aeval f P ∈ weightedSupportLT v d := by + rw [← P.support_sum_monomial_coeff, map_sum] + apply (weightedSupportLT v d).sum_mem + intro a ha b hb + have hap : Finsupp.weight w a < d := hP ha + exact (weightedSupportLE_aeval_monomial w v f hf a _ hb).trans_lt hap + +theorem polynomialTranslate_sub_mem_weightedSupportLT {σ R : Type*} [CommRing R] + (base : σ → R) (w : σ → ℕ) (hw : ∀ i, 0 < w i) + {P : MvPolynomial σ R} {d : ℕ} (hP : P ∈ weightedSupportLE w d) : + polynomialTranslate base P - P ∈ weightedSupportLT w d := by + have hexp : P = ∑ a ∈ P.support, P.coeff a • monomial a (1 : R) := by + simpa only [smul_monomial, smul_eq_mul, mul_one] using P.as_sum + have he := congrArg (fun Q => polynomialTranslate base Q - Q) hexp + simp only [map_sum, map_smul, ← Finset.sum_sub_distrib, ← smul_sub] at he + rw [he] + apply (weightedSupportLT w d).sum_mem + intro a ha + apply (weightedSupportLT w d).smul_mem + intro b hb + have hap : Finsupp.weight w a ≤ d := hP ha + exact ((polynomialTranslate_monomial_bounds base w hw a).2 hb).trans_le hap + +theorem fullShiftExponent_weight (n : ℕ) : + Finsupp.weight (1 : Fin n → ℕ) (fullShiftExponent n) = n := by + simpa only [Finsupp.weight_apply, Finsupp.sum, Pi.one_apply, smul_eq_mul, mul_one] using + fullShiftExponent_sum n + +theorem full_coefficient_zero_of_lower_support {R : Type*} [CommRing R] {n : ℕ} + {P : MvPolynomial (Fin n) R} (hP : P ∈ weightedSupportLT (1 : Fin n → ℕ) n) : + P.coeff (fullShiftExponent n) = 0 := by + by_contra hn + have hlt : Finsupp.weight (1 : Fin n → ℕ) (fullShiftExponent n) < n := + hP (mem_support_iff.mpr hn) + rw [fullShiftExponent_weight] at hlt + exact (lt_irrefl n) hlt + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TranslationCoordinateBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationCoordinateBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..8916468d02ea8485349b2a8e32582fe036584d18 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationCoordinateBudget.lean @@ -0,0 +1,76 @@ +import OAI.Combinatorics.Progressions.Estimates.ResidualErrorAllocation +import OAI.Combinatorics.Progressions.Polynomial.PolynomialDensityBudget + +namespace OAI + +section + +namespace Erdos3 + +theorem exists_translationCoordinate_budget (d : ℕ) : + ∃ C : ℕ, 2 ≤ C ∧ ∀ (n t q : ℕ) (p M B : ℝ), + 0 ≤ p → (n : ℝ) ≤ p → (t : ℝ) ≤ Real.exp p → + 0 ≤ M → M ≤ Real.exp p → 0 ≤ B → B ≤ Real.exp p → + (q : ℝ) ≤ Real.exp p → + ((d : ℝ) + 1) * ((t : ℝ) * M * B) * + (1 + (n : ℝ) * d * ((t : ℝ) * M * B)) ^ d ≤ + Real.exp ((p + C) ^ C) ∧ + (d.factorial * q ^ (d + 1) : ℕ) ≤ Real.exp ((p + C) ^ C) := by + let Q : Polynomial ℕ := + Polynomial.C (5 * d + 4) * Polynomial.X + + Polynomial.C (d ^ 2 + 2 * d + 1 + d.factorial) + obtain ⟨C, hC, hbudget⟩ := exists_natPolynomial_eval_budget Q + refine ⟨C, hC, ?_⟩ + intro n t q p M B hp hn ht hM hMp hB hBp hq + have htotal : (5 * (d : ℝ) + 4) * p + + ((d : ℝ) ^ 2 + 2 * d + 1 + d.factorial) ≤ (p + C) ^ C := by + simpa [Q, Polynomial.eval₂_pow, Nat.cast_add, Nat.cast_mul, Nat.cast_pow] using hbudget p hp + have hmasscost : (4 * (d : ℝ) + 3) * p + d ^ 2 + 2 * d + 1 ≤ + (p + C) ^ C := by + have h := mul_nonneg ((show (0 : ℝ) ≤ d + 1 by positivity)) hp + have hf : (0 : ℝ) ≤ d.factorial := Nat.cast_nonneg _ + nlinarith + have hdenomcost : (d.factorial : ℝ) + ((d : ℝ) + 1) * p ≤ (p + C) ^ C := by + have h := mul_nonneg ((show (0 : ℝ) ≤ 4 * d + 3 by positivity)) hp + have hd : (0 : ℝ) ≤ d := Nat.cast_nonneg _ + nlinarith [sq_nonneg (d : ℝ)] + have hnp : (n : ℝ) ≤ Real.exp p := hn.trans (by linarith [Real.add_one_le_exp p]) + have hdp : (d : ℝ) ≤ Real.exp d := by linarith [Real.add_one_le_exp (d : ℝ)] + have ha : (t : ℝ) * M * B ≤ Real.exp (3 * p) := by + calc + _ ≤ Real.exp p * Real.exp p * Real.exp p := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + have hprod : (n : ℝ) * d * ((t : ℝ) * M * B) ≤ Real.exp (4 * p + d) := by + calc + _ ≤ Real.exp p * Real.exp d * Real.exp (3 * p) := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + have hplus : 1 + (n : ℝ) * d * ((t : ℝ) * M * B) ≤ + Real.exp (4 * p + d + 1) := one_add_le_exp_succ (by positivity) hprod + have hfactor : (d : ℝ) + 1 ≤ Real.exp ((d : ℝ) + 1) := by + linarith [Real.add_one_le_exp ((d : ℝ) + 1)] + constructor + · calc + _ ≤ Real.exp ((d : ℝ) + 1) * Real.exp (3 * p) * + Real.exp (4 * p + d + 1) ^ d := by gcongr + _ = Real.exp ((4 * (d : ℝ) + 3) * p + d ^ 2 + 2 * d + 1) := by + rw [← Real.exp_nat_mul, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + _ ≤ _ := Real.exp_le_exp.mpr hmasscost + · have hf : (d.factorial : ℝ) ≤ Real.exp d.factorial := by + linarith [Real.add_one_le_exp (d.factorial : ℝ)] + push_cast + calc + (d.factorial : ℝ) * (q : ℝ) ^ (d + 1) ≤ + Real.exp d.factorial * (Real.exp p) ^ (d + 1) := by gcongr + _ = Real.exp ((d.factorial : ℝ) + ((d : ℝ) + 1) * p) := by + rw [← Real.exp_nat_mul, ← Real.exp_add] + push_cast + rfl + _ ≤ _ := Real.exp_le_exp.mpr hdenomcost + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateHomogeneous.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateHomogeneous.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2a7b68b82dd947e472106da2db5bfb440e4de63 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateHomogeneous.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Polynomial.TranslationLogCoordinateWeightedDegree + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial +open scoped BigOperators + +variable {U B : Type*} [Fintype B] + +theorem translationLogBasePolynomial_weightedBasis_isWeightedHomogeneous + (v : U → ℕ) (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + [Fintype (WeightedBasisIndex w d)] + (f : WeightedBasisIndex w d → MvPolynomial U ℝ) + (hf : ∀ k, (f k).IsWeightedHomogeneous v (weightedBasisGrade w d k)) (i : B) : + (translationLogBasePolynomial w d (weightedBasis w d hw) f i).IsWeightedHomogeneous + v (w i) := by + rw [translationLogBasePolynomial_weightedBasis] + exact hf (Sum.inl i) + +theorem pack_translationLogPhasePolynomial_weightedBasis_isWeightedHomogeneous + (v : U → ℕ) (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + [Fintype (WeightedBasisIndex w d)] + (f : WeightedBasisIndex w d → MvPolynomial U ℝ) + (hf : ∀ k, (f k).IsWeightedHomogeneous v (weightedBasisGrade w d k)) : + (packTranslationPolynomial (translationLogPhasePolynomial w d (weightedBasis w d hw) f)).IsWeightedHomogeneous + (Sum.elim v w) d := by + classical + rw [pack_translationLogPhasePolynomial] + apply (weightedHomogeneousSubmodule ℝ (Sum.elim v w) d).sum_mem + intro k _ + cases k with + | inl i => + simp only [weightedBasis_inl_polynomial, map_zero, mul_zero] + exact isWeightedHomogeneous_zero ℝ _ _ + | inr a => + simp only [weightedBasis_inr_polynomial, map_monomial, map_one] + have hleft : (rename Sum.inl (f (Sum.inr a))).IsWeightedHomogeneous (Sum.elim v w) + (d - Finsupp.weight w a.val) := by + rw [rename_eq_aeval] + exact aeval_isWeightedHomogeneous v (Sum.elim v w) _ + (fun i => isWeightedHomogeneous_X ℝ (Sum.elim v w) (Sum.inl i)) (hf (Sum.inr a)) + have hright : (rename Sum.inr (monomial a.val (1 : ℝ))).IsWeightedHomogeneous + (Sum.elim v w) (Finsupp.weight w a.val) := by + rw [rename_eq_aeval] + exact aeval_isWeightedHomogeneous w (Sum.elim v w) _ + (fun i => isWeightedHomogeneous_X ℝ (Sum.elim v w) (Sum.inr i)) + (isWeightedHomogeneous_monomial w a.val 1 rfl) + simpa only [mem_weightedHomogeneousSubmodule, Nat.sub_add_cancel a.property.le] + using hleft.mul hright + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateInputBounds.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateInputBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..1814d77e26b1c6e70a3351af9a49bb41f2a128c3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateInputBounds.lean @@ -0,0 +1,123 @@ +import OAI.Combinatorics.Progressions.Polynomial.TranslationLogCoordinatePolynomials + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial +open scoped BigOperators + +theorem packTranslationPolynomial_map_C {U B R : Type*} [CommSemiring R] + (P : MvPolynomial B R) : + packTranslationPolynomial (U := U) (MvPolynomial.map C P) = rename Sum.inr P := by + induction P using MvPolynomial.induction_on with + | C c => simp + | add P Q hP hQ => simp only [map_add, hP, hQ] + | mul_X P i hP => simp only [map_mul, map_X, packTranslationPolynomial_X, rename_X, hP] + +namespace PolynomialTranslationLie + +variable {U B κ : Type*} [Fintype B] [Fintype κ] + +theorem pack_translationLogPhasePolynomial (w : B → ℕ) (d : ℕ) + (x : κ → weightedSubalgebra w d) (f : κ → MvPolynomial U ℝ) : + packTranslationPolynomial (translationLogPhasePolynomial w d x f) = + ∑ k, rename Sum.inl (f k) * + rename Sum.inr (MvPolynomial.map (algebraMap ℚ ℝ) (x k).val.polynomial) := by + classical + unfold translationLogPhasePolynomial + simp only [map_sum, map_mul, packTranslationPolynomial_C] + apply Finset.sum_congr rfl + intro k _ + congr 1 + rw [← MvPolynomial.map_map, packTranslationPolynomial_map_C] + +theorem realPolynomialMass_translationLogBasePolynomial (w : B → ℕ) (d : ℕ) + (x : κ → weightedSubalgebra w d) (f : κ → MvPolynomial U ℝ) + {M B₀ : ℝ} (hM : 0 ≤ M) (hf : ∀ k, realPolynomialMass (f k) ≤ M) + (hx : ∀ k i, |((x k).val.base i : ℝ)| ≤ B₀) (i : B) : + realPolynomialMass (translationLogBasePolynomial w d x f i) ≤ + (Fintype.card κ : ℝ) * M * B₀ := by + classical + unfold translationLogBasePolynomial + apply (realPolynomialMass_sum_le _ _).trans + calc + _ ≤ ∑ _k : κ, M * B₀ := by + apply Finset.sum_le_sum + intro k _ + apply (realPolynomialMass_mul_le _ _).trans + rw [realPolynomialMass_C] + exact mul_le_mul (hf k) (hx k i) (abs_nonneg _) hM + _ = _ := by simp; ring + +theorem realPolynomialMass_pack_translationLogPhasePolynomial (w : B → ℕ) (d : ℕ) + (x : κ → weightedSubalgebra w d) (f : κ → MvPolynomial U ℝ) + {M B₀ : ℝ} (hM : 0 ≤ M) (hf : ∀ k, realPolynomialMass (f k) ≤ M) + (hx : ∀ k, realPolynomialMass + (MvPolynomial.map (algebraMap ℚ ℝ) (x k).val.polynomial) ≤ B₀) : + realPolynomialMass (packTranslationPolynomial (translationLogPhasePolynomial w d x f)) ≤ + (Fintype.card κ : ℝ) * M * B₀ := by + classical + rw [pack_translationLogPhasePolynomial] + apply (realPolynomialMass_sum_le _ _).trans + calc + _ ≤ ∑ _k : κ, M * B₀ := by + apply Finset.sum_le_sum + intro k _ + exact (realPolynomialMass_mul_le _ _).trans + (mul_le_mul ((realPolynomialMass_rename_le _ _).trans (hf k)) + ((realPolynomialMass_rename_le _ _).trans (hx k)) (realPolynomialMass_nonneg _) hM) + _ = _ := by simp; ring + +theorem weightedSubalgebra_realPolynomial_degreeOf_le (w : B → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (x : weightedSubalgebra w d) (i : B) : + (MvPolynomial.map (algebraMap ℚ ℝ) x.val.polynomial).degreeOf i ≤ d := by + classical + rw [degreeOf_eq_sup] + apply Finset.sup_le + intro α hα + have hs := MvPolynomial.support_map_subset (algebraMap ℚ ℝ) x.val.polynomial hα + have hx := x.property.2 hs + change Finsupp.weight w α + 1 ≤ d at hx + have hαi := Finsupp.le_weight w (hw i).ne' α + exact hαi.trans (by omega) + +theorem degreeOf_pack_translationLogPhasePolynomial (w : B → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (x : κ → weightedSubalgebra w d) + (f : κ → MvPolynomial U ℝ) (i : B) : + (packTranslationPolynomial (translationLogPhasePolynomial w d x f)).degreeOf + (Sum.inr i) ≤ d := by + classical + rw [pack_translationLogPhasePolynomial] + apply (degreeOf_sum_le _ _ _).trans + apply Finset.sup_le + intro k _ + apply (degreeOf_mul_le _ _ _).trans + rw [degreeOf_rename_inl_inr, zero_add, + degreeOf_rename_of_injective Sum.inr_injective i] + exact weightedSubalgebra_realPolynomial_degreeOf_le w d hw (x k) i + +theorem realPolynomialMass_translationLogDirectionalSeries (w : B → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (x : κ → weightedSubalgebra w d) + (f : κ → MvPolynomial U ℝ) {M B₀ : ℝ} (hM : 0 ≤ M) (hB₀ : 0 ≤ B₀) + (hf : ∀ k, realPolynomialMass (f k) ≤ M) + (hbase : ∀ k i, |((x k).val.base i : ℝ)| ≤ B₀) + (hphase : ∀ k, realPolynomialMass + (MvPolynomial.map (algebraMap ℚ ℝ) (x k).val.polynomial) ≤ B₀) : + realPolynomialMass (translationDirectionalSeries d (translationLogBasePolynomial w d x f) + (packTranslationPolynomial (translationLogPhasePolynomial w d x f))) ≤ + ((d : ℝ) + 1) * ((Fintype.card κ : ℝ) * M * B₀) * + (1 + (Fintype.card B : ℝ) * d * ((Fintype.card κ : ℝ) * M * B₀)) ^ d := by + exact realPolynomialMass_translationDirectionalSeries d _ _ + (degreeOf_pack_translationLogPhasePolynomial w d hw x f) (by positivity) + (realPolynomialMass_translationLogBasePolynomial w d x f hM hf hbase) + (realPolynomialMass_pack_translationLogPhasePolynomial w d x f hM hf hphase) + +end PolynomialTranslationLie +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateScaling.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b52e1893f8605e047dd3a43baa4fc015b691f4a --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationLogCoordinateScaling.lean @@ -0,0 +1,130 @@ +import OAI.Combinatorics.Progressions.Polynomial.TranslationPolynomialPackingDerivative +import OAI.Combinatorics.Progressions.Sampling.TranslationLogCoordinateInputGrid + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie +open MvPolynomial +open scoped BigOperators +variable {U B κ : Type*} [Fintype B] [Fintype κ] + +theorem translationLogMixedGroupPolynomial_eq_series (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (x : κ → weightedSubalgebra w d) + (f : κ → MvPolynomial U ℝ) : + translationLogMixedGroupPolynomial w d x f = + translationDirectionalSeries d (translationLogBasePolynomial w d x f) + (packTranslationPolynomial (translationLogPhasePolynomial w d x f)) := by + have hweights : ∀ i, shearWeight w d i ≤ d := by + intro i + cases i with + | inl i => exact hwd i + | inr i => exact le_rfl + unfold translationLogMixedGroupPolynomial translationLogGroupPolynomial + rw [translationShearCoordinates_polynomial_series (shearWeight w d) d hweights] + simp only [shearWeight, translationDirectionalSeries, map_sum] + apply Finset.sum_congr rfl + intro k _ + rw [map_rat_smul, packTranslationPolynomial_baseDerivative_pow] + rw [← algebraMap_smul ℝ ((-1 : ℚ) ^ k / ((k + 1).factorial : ℚ))] + congr 1 + simp only [map_div₀, map_pow, map_neg, map_one, map_natCast] + +theorem realPolynomialMass_translationLogMixedGroupPolynomial (w : B → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (x : κ → weightedSubalgebra w d) (f : κ → MvPolynomial U ℝ) + {M B₀ : ℝ} (hM : 0 ≤ M) (hB₀ : 0 ≤ B₀) + (hf : ∀ k, realPolynomialMass (f k) ≤ M) + (hbase : ∀ k i, |((x k).val.base i : ℝ)| ≤ B₀) + (hphase : ∀ k, realPolynomialMass + (MvPolynomial.map (algebraMap ℚ ℝ) (x k).val.polynomial) ≤ B₀) : + realPolynomialMass (translationLogMixedGroupPolynomial w d x f) ≤ + ((d : ℝ) + 1) * ((Fintype.card κ : ℝ) * M * B₀) * + (1 + (Fintype.card B : ℝ) * d * ((Fintype.card κ : ℝ) * M * B₀)) ^ d := by + rw [translationLogMixedGroupPolynomial_eq_series w d hwd] + exact realPolynomialMass_translationLogDirectionalSeries w d hw x f hM hB₀ hf hbase hphase + +theorem translationLogMixedGroupPolynomial_coefficientGrid (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (x : κ → weightedSubalgebra w d) + (f : κ → MvPolynomial U ℝ) {q : ℕ} + (hb : ∀ i, realPolynomialCoefficientGrid q (translationLogBasePolynomial w d x f i)) + (hP : realPolynomialCoefficientGrid q + (packTranslationPolynomial (translationLogPhasePolynomial w d x f))) : + realPolynomialCoefficientGrid (d.factorial * q ^ (d + 1)) + (translationLogMixedGroupPolynomial w d x f) := by + rw [translationLogMixedGroupPolynomial_eq_series w d hwd] + exact translationDirectionalSeries_coefficientGrid d _ _ hb hP + +theorem translationLogMixedGroupPolynomial_coefficientGrid_of_inputs + (w : B → ℕ) (d : ℕ) (hwd : ∀ i, w i ≤ d) + (x : κ → weightedSubalgebra w d) (f : κ → MvPolynomial U ℝ) + {q l : ℕ} (hf : ∀ k, realPolynomialCoefficientGrid q (f k)) + (hbase : ∀ k i, ∃ z : ℤ, (z : ℝ) = (l : ℝ) * ((x k).val.base i : ℝ)) + (hphase : ∀ k, realPolynomialCoefficientGrid l + (MvPolynomial.map (algebraMap ℚ ℝ) (x k).val.polynomial)) : + realPolynomialCoefficientGrid (d.factorial * (q * l) ^ (d + 1)) + (translationLogMixedGroupPolynomial w d x f) := by + rw [translationLogMixedGroupPolynomial_eq_series w d hwd] + exact translationLogDirectionalSeries_coefficientGrid w d x f hf hbase hphase + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie +open MvPolynomial +open scoped BigOperators +variable {U B κ : Type*} [Fintype B] [Fintype κ] + +theorem translationLogBasePolynomial_scale (w : B → ℕ) (d : ℕ) + (x : κ → weightedSubalgebra w d) (f : κ → MvPolynomial U ℝ) + (H : U → ℝ) (i : B) : + scaleMvPolynomialAxes H (translationLogBasePolynomial w d x f i) = + translationLogBasePolynomial w d x (fun k => scaleMvPolynomialAxes H (f k)) i := by + simp only [translationLogBasePolynomial, scaleMvPolynomialAxes_eq_aeval, map_sum, + map_mul, aeval_C, algebraMap_eq] + +theorem translationLogMixedGroupPolynomial_scale (w : B → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (x : κ → weightedSubalgebra w d) + (f : κ → MvPolynomial U ℝ) (H : U → ℝ) : + scaleMvPolynomialAxes (Sum.elim H (fun _ : B => 1)) + (translationLogMixedGroupPolynomial w d x f) = + translationLogMixedGroupPolynomial w d x (fun k => scaleMvPolynomialAxes H (f k)) := by + apply MvPolynomial.funext + intro z + let u : U → ℝ := fun i => z (Sum.inl i) + let a : B → ℝ := fun i => z (Sum.inr i) + have hz : z = Sum.elim u a := by funext i; cases i <;> rfl + rw [hz, scaleMvPolynomialAxes_eval] + have he : (fun i => Sum.elim H (fun _ : B => (1 : ℝ)) i * Sum.elim u a i) = + Sum.elim (fun i => H i * u i) a := by + funext i + cases i <;> simp + rw [he, translationLogMixedGroupPolynomial_eval w d hwd, + translationLogMixedGroupPolynomial_eval w d hwd] + simp only [scaleMvPolynomialAxes_eval] + +theorem realPolynomialMass_translationLogMixedGroupPolynomial_scale + (w : B → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hwd : ∀ i, w i ≤ d) + (x : κ → weightedSubalgebra w d) (f : κ → MvPolynomial U ℝ) + (H : U → ℝ) {M B₀ : ℝ} (hM : 0 ≤ M) (hB₀ : 0 ≤ B₀) + (hf : ∀ k, realPolynomialMass (scaleMvPolynomialAxes H (f k)) ≤ M) + (hbase : ∀ k i, |((x k).val.base i : ℝ)| ≤ B₀) + (hphase : ∀ k, realPolynomialMass + (MvPolynomial.map (algebraMap ℚ ℝ) (x k).val.polynomial) ≤ B₀) : + realPolynomialMass (scaleMvPolynomialAxes (Sum.elim H (fun _ : B => 1)) + (translationLogMixedGroupPolynomial w d x f)) ≤ + ((d : ℝ) + 1) * ((Fintype.card κ : ℝ) * M * B₀) * + (1 + (Fintype.card B : ℝ) * d * ((Fintype.card κ : ℝ) * M * B₀)) ^ d := by + rw [translationLogMixedGroupPolynomial_scale w d hwd] + exact realPolynomialMass_translationLogMixedGroupPolynomial w d hw hwd x _ + hM hB₀ hf hbase hphase + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TranslationShearCoordinateSeries.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationShearCoordinateSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..eea2d40efdc5df9e30ef6e130d186fc69fcc46ea --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TranslationShearCoordinateSeries.lean @@ -0,0 +1,248 @@ +import OAI.Combinatorics.Progressions.Estimates.TranslationShearExponentialOver +import OAI.Combinatorics.Progressions.Estimates.WeightedTranslationShearExponential + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial + +variable {σ R S : Type*} [CommRing R] [CommRing S] + [Algebra ℚ R] [Algebra ℚ S] {w : σ ⊕ Unit → ℕ} + +noncomputable def translationShearCoordinates + (D : PolynomialShearLieAlgebra w R) (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + PolynomialTranslationGroupOver R σ := + (existsUnique_translation_of_shear_exp D b P hb hP).exists.choose + +theorem translationShearCoordinates_action + (D : PolynomialShearLieAlgebra w R) (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + PolynomialTranslationGroupOver.actionMonoidHom (translationShearCoordinates D b P hb hP) = + (polynomialShearExpAut D).val := + (existsUnique_translation_of_shear_exp D b P hb hP).exists.choose_spec + +theorem translationShearCoordinates_base + (D : PolynomialShearLieAlgebra w R) (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + (translationShearCoordinates D b P hb hP).base = b := by + funext i + have he := congrArg + (fun f : MvPolynomial (σ ⊕ Unit) R ≃ₐ[R] MvPolynomial (σ ⊕ Unit) R => + f (X (Sum.inl i))) (translationShearCoordinates_action D b P hb hP) + change PolynomialTranslationGroupOver.actionHom _ (X (Sum.inl i)) = + polynomialShearExp D (X (Sum.inl i)) at he + rw [PolynomialTranslationGroupOver.actionHom_X_inl, + polynomialShearExp_X_of_derivation_eq_C D (Sum.inl i) (b i) (hb i)] at he + exact MvPolynomial.C_injective (σ ⊕ Unit) R (add_left_cancel he) + +theorem translationShearCoordinates_map_action + (f : R →+* S) (D : PolynomialShearLieAlgebra w R) + (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + PolynomialTranslationGroupOver.actionMonoidHom + (PolynomialTranslationGroupOver.map f (translationShearCoordinates D b P hb hP)) = + (polynomialShearExpAut (polynomialShearMap f D)).val := by + apply AlgEquiv.coe_toAlgHom_injective + apply MvPolynomial.algHom_ext + intro i + have he := congrArg + (fun a : MvPolynomial (σ ⊕ Unit) R ≃ₐ[R] MvPolynomial (σ ⊕ Unit) R => a (X i)) + (translationShearCoordinates_action D b P hb hP) + change PolynomialTranslationGroupOver.actionHom _ (X i) = polynomialShearExp D (X i) at he + have hm := PolynomialTranslationGroupOver.map_actionHom f + (translationShearCoordinates D b P hb hP) (X i) + rw [he, polynomialShearExp_map, map_X] at hm + exact hm.symm + +omit [Algebra ℚ R] [Algebra ℚ S] in +theorem polynomialShearMap_translation_base + (f : R →+* S) (D : PolynomialShearLieAlgebra w R) (b : σ → R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) (i : σ) : + (polynomialShearMap f D).val (X (Sum.inl i)) = C (f (b i)) := by + rw [polynomialShearMap_X, hb, map_C] + +omit [Algebra ℚ R] [Algebra ℚ S] in +theorem polynomialShearMap_translation_polynomial + (f : R →+* S) (D : PolynomialShearLieAlgebra w R) (P : MvPolynomial σ R) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + (polynomialShearMap f D).val (X (Sum.inr ())) = rename Sum.inl (MvPolynomial.map f P) := by + rw [polynomialShearMap_X, hP, MvPolynomial.map_rename] + +theorem translationShearCoordinates_map + (f : R →+* S) (D : PolynomialShearLieAlgebra w R) + (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + PolynomialTranslationGroupOver.map f (translationShearCoordinates D b P hb hP) = + translationShearCoordinates (polynomialShearMap f D) (fun i => f (b i)) + (MvPolynomial.map f P) (polynomialShearMap_translation_base f D b hb) + (polynomialShearMap_translation_polynomial f D P hP) := by + apply PolynomialTranslationGroupOver.actionMonoidHom_injective + rw [translationShearCoordinates_map_action, translationShearCoordinates_action] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] [Algebra ℚ R] + +omit [Algebra ℚ R] in +theorem PolynomialTranslationGroupOver.action_inverse_X_inr + (g : PolynomialTranslationGroupOver R σ) : + (actionMonoidHom g).symm (X (Sum.inr ())) = + X (Sum.inr ()) - rename Sum.inl g.polynomial := by + have he : (actionMonoidHom g).symm = actionMonoidHom g⁻¹ := + (map_inv actionMonoidHom g).symm + rw [he] + change actionHom g⁻¹ (X (Sum.inr ())) = _ + rw [actionHom_X_inr] + simp only [base_inv, polynomial_inv, map_neg, polynomialTranslate_comp_ring, + neg_add_cancel, polynomialTranslate_zero_ring, sub_eq_add_neg] + +theorem polynomialShearExpAut_neg_over {ι : Type*} + (w : ι → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) + (D : PolynomialShearLieAlgebra w R) : + polynomialShearExpAut (-D) = (polynomialShearExpAut D)⁻¹ := by + exact (polynomialShearBCHEquivOver w d hw).map_inv + (⟨D⟩ : (polynomialShearRatFiltration (R := R) w d hw).Group) + +theorem translationShearCoordinates_inverse_exp + (w : σ ⊕ Unit → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) + (D : PolynomialShearLieAlgebra w R) (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + polynomialShearExp (-D) (X (Sum.inr ())) = + X (Sum.inr ()) - rename Sum.inl (translationShearCoordinates D b P hb hP).polynomial := by + rw [← polynomialShearExpAut_apply, polynomialShearExpAut_neg_over w d hw] + have he := translationShearCoordinates_action D b P hb hP + change ((polynomialShearExpAut D).val).symm (X (Sum.inr ())) = _ + rw [← he] + exact PolynomialTranslationGroupOver.action_inverse_X_inr _ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] + +noncomputable def translationBaseDerivative (b : σ → R) : + Derivation R (MvPolynomial σ R) (MvPolynomial σ R) := + mkDerivation R (fun i => C (b i)) + +@[simp] theorem translationBaseDerivative_C (b : σ → R) (r : R) : + translationBaseDerivative b (C r) = 0 := MvPolynomial.derivation_C _ _ + +@[simp] theorem translationBaseDerivative_X (b : σ → R) (i : σ) : + translationBaseDerivative b (X i) = C (b i) := mkDerivation_X _ _ _ + +theorem translationBaseDerivative_apply [Fintype σ] (b : σ → R) + (P : MvPolynomial σ R) : + translationBaseDerivative b P = ∑ i, b i • pderiv i P := by + classical + have h : translationBaseDerivative b = ∑ i, b i • pderiv i := by + apply MvPolynomial.derivation_ext + intro j + rw [translationBaseDerivative_X] + change _ = (Derivation.coeFnAddMonoidHom (∑ i, b i • pderiv i)) (X j) + rw [map_sum] + simp [Finset.sum_apply, Derivation.coeFnAddMonoidHom_apply, + MvPolynomial.pderiv_X, Pi.single_apply, + MvPolynomial.C_eq_smul_one] + rw [h] + change (Derivation.coeFnAddMonoidHom (∑ i, b i • pderiv i)) P = _ + rw [map_sum] + simp only [Finset.sum_apply, Derivation.coeFnAddMonoidHom_apply, Derivation.smul_apply] + +theorem translationShear_derivation_rename_eq {w : σ ⊕ Unit → ℕ} + (D : PolynomialShearLieAlgebra w R) (b : σ → R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) (P : MvPolynomial σ R) : + D.val (rename Sum.inl P) = rename Sum.inl (translationBaseDerivative b P) := by + induction P using MvPolynomial.induction_on with + | C c => simp + | add P Q hP hQ => simp only [map_add, hP, hQ] + | mul_X P i hP => + simp only [map_mul, rename_X, Derivation.leibniz, smul_eq_mul, + hb, translationBaseDerivative_X, map_add, rename_C, hP] + +theorem translationShear_derivation_pow_extra {w : σ ⊕ Unit → ℕ} + (D : PolynomialShearLieAlgebra w R) (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) (k : ℕ) : + (D.val.toLinearMap ^ (k + 1)) (X (Sum.inr ())) = + rename Sum.inl (((translationBaseDerivative b).toLinearMap ^ k) P) := by + induction k with + | zero => simpa using hP + | succ k ih => + rw [pow_succ', Module.End.mul_apply, ih, pow_succ', Module.End.mul_apply] + exact translationShear_derivation_rename_eq D b hb _ + +variable [Algebra ℚ R] + +theorem polynomialShear_neg_pow_apply {ι : Type*} {w : ι → ℕ} + (D : PolynomialShearLieAlgebra w R) (k : ℕ) (Q : MvPolynomial ι R) : + ((-D).val.toLinearMap ^ k) Q = + (-1 : ℚ) ^ k • (D.val.toLinearMap ^ k) Q := by + have h : (-D).val.toLinearMap = (-1 : ℚ) • D.val.toLinearMap := by + change -D.val.toLinearMap = (-1 : ℚ) • D.val.toLinearMap + exact (neg_one_smul ℚ D.val.toLinearMap).symm + rw [h, smul_pow, LinearMap.smul_apply] + +theorem translationShearCoordinates_polynomial_series + (w : σ ⊕ Unit → ℕ) (d : ℕ) (hw : ∀ i, w i ≤ d) + (D : PolynomialShearLieAlgebra w R) (b : σ → R) (P : MvPolynomial σ R) + (hb : ∀ i, D.val (X (Sum.inl i)) = C (b i)) + (hP : D.val (X (Sum.inr ())) = rename Sum.inl P) : + (translationShearCoordinates D b P hb hP).polynomial = + ∑ k ∈ Finset.range (w (Sum.inr ())), + ((-1 : ℚ) ^ k / ((k + 1).factorial : ℚ)) • + ((translationBaseDerivative b).toLinearMap ^ k) P := by + have he := translationShearCoordinates_inverse_exp w d hw D b P hb hP + rw [polynomialShearExp_eq_sum (-D) (weightedSupportLE_X w (Sum.inr ())), + Finset.sum_range_succ'] at he + simp only [Nat.factorial_zero, Nat.cast_one, inv_one, pow_zero, + Module.End.one_apply, one_smul] at he + have hs : (∑ k ∈ Finset.range (w (Sum.inr ())), + (((k + 1).factorial : ℚ)⁻¹) • + ((-D).val.toLinearMap ^ (k + 1)) (X (Sum.inr ()))) = + -rename Sum.inl (∑ k ∈ Finset.range (w (Sum.inr ())), + ((-1 : ℚ) ^ k / ((k + 1).factorial : ℚ)) • + ((translationBaseDerivative b).toLinearMap ^ k) P) := by + rw [map_sum, ← Finset.sum_neg_distrib] + apply Finset.sum_congr rfl + intro k hk + rw [polynomialShear_neg_pow_apply, translationShear_derivation_pow_extra D b P hb hP] + rw [AlgHom.map_smul_of_tower, smul_smul, ← neg_smul] + congr 1 + rw [pow_succ] + ring + rw [hs] at he + apply MvPolynomial.rename_injective Sum.inl Sum.inl_injective + apply neg_injective + apply add_left_cancel (a := X (Sum.inr ())) + simpa only [sub_eq_add_neg] using he.symm.trans (add_comm _ _) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TripleBoxAnchorApproximation.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TripleBoxAnchorApproximation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b33e4247ef3f189e2c7b19c4e7b3c173a6d9c594 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TripleBoxAnchorApproximation.lean @@ -0,0 +1,134 @@ +import OAI.Combinatorics.Progressions.Geometry.BoxDifferenceHom + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def tripleBoxSlice {X : Type*} (a z : Fin 3 → X) : Fin 6 → X := + ![z 0, a 0, z 1, a 1, z 2, a 2] + +def tripleBoxSliceEquiv (X : Type*) : ((Fin 3 → X) × (Fin 3 → X)) ≃ (Fin 6 → X) where + toFun p := tripleBoxSlice p.1 p.2 + invFun x := (![x 1, x 3, x 5], ![x 0, x 2, x 4]) + left_inv p := by + apply Prod.ext <;> funext i <;> fin_cases i <;> rfl + right_inv x := by + funext i + fin_cases i <;> rfl + +theorem expect_tripleBoxSlice {X M : Type*} [Fintype X] [AddCommMonoid M] [Module ℚ≥0 M] + (F : (Fin 6 → X) → M) : + (𝔼 x, F x) = 𝔼 a : Fin 3 → X, 𝔼 z : Fin 3 → X, F (tripleBoxSlice a z) := by + calc + _ = 𝔼 p : (Fin 3 → X) × (Fin 3 → X), F (tripleBoxSlice p.1 p.2) := + (Fintype.expect_equiv (tripleBoxSliceEquiv X) _ F (fun _ => rfl)).symm + _ = _ := by + simpa using (Finset.expect_product' Finset.univ Finset.univ + (fun a z => F (tripleBoxSlice a z))) + +noncomputable def tripleBoxKernel {X : Type*} (K : X → X → X → ℂ) (x : Fin 6 → X) : ℂ := + let G := fun h y => K (x 0) h y * star (K (x 1) h y) + G (x 2) (x 4) * star (G (x 3) (x 4)) * star (G (x 2) (x 5)) * G (x 3) (x 5) + +noncomputable def tripleBoxAnchorFactor {X : Type*} (K : X → X → X → ℂ) + (a z : Fin 3 → X) : ℂ := + ((star (K (a 0) (z 1) (z 2)) * star (K (z 0) (a 1) (z 2))) * + (K (a 0) (a 1) (z 2) * star (K (z 0) (z 1) (a 2)))) * + ((K (a 0) (z 1) (a 2) * K (z 0) (a 1) (a 2)) * star (K (a 0) (a 1) (a 2))) + +theorem tripleBoxKernel_slice {X : Type*} (K : X → X → X → ℂ) (a z : Fin 3 → X) : + tripleBoxKernel K (tripleBoxSlice a z) = K (z 0) (z 1) (z 2) * tripleBoxAnchorFactor K a z := by + have hlast : (![z 0, a 0, z 1, a 1, z 2, a 2] : Fin 6 → X) 5 = a 2 := rfl + simp only [tripleBoxKernel, tripleBoxSlice, tripleBoxAnchorFactor, star_mul, star_star, + Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.cons_val_three, + Matrix.cons_val_four, Matrix.head_cons, Matrix.tail_cons, hlast] + ring + +theorem tripleBoxKernel_mean {X : Type*} [Fintype X] (K : X → X → X → ℂ) : + (𝔼 x : Fin 6 → X, tripleBoxKernel K x) = finiteTripleBoxCorrelation K := by + simp_rw [expect_fin_cons] + unfold finiteTripleBoxCorrelation finiteBoxCorrelation + apply Finset.expect_congr rfl + intro k _ + apply Finset.expect_congr rfl + intro k' _ + apply Finset.expect_congr rfl + intro h _ + apply Finset.expect_congr rfl + intro h' _ + apply Finset.expect_congr rfl + intro y _ + apply Finset.expect_congr rfl + intro y' _ + change (𝔼 _ : Fin 0 → X, (K k h y * star (K k' h y)) * + star (K k h' y * star (K k' h' y)) * star (K k h y' * star (K k' h y')) * + (K k h' y' * star (K k' h' y'))) = _ + rw [Fintype.expect_const] + +theorem tripleBoxAnchorFactor_norm_le_one {X : Type*} (K : X → X → X → ℂ) + (hK : ∀ k h y, ‖K k h y‖ ≤ 1) (a z : Fin 3 → X) : ‖tripleBoxAnchorFactor K a z‖ ≤ 1 := by + simp only [tripleBoxAnchorFactor, norm_mul, norm_star] + calc + _ ≤ (((1 : ℝ) * 1) * (1 * 1)) * ((1 * 1) * 1) := by gcongr <;> apply hK + _ = 1 := by norm_num + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_triple_box_anchor_approximation {X : Type*} [Fintype X] [Nonempty X] + (K : X → X → X → ℂ) (hK : ∀ k x y, ‖K k x y‖ ≤ 1) (F : (Fin 6 → X) → ℂ) + {δ ε : ℝ} (hδ : 0 < δ) (hε : 0 < ε) + (hbias : δ ≤ (finiteTripleBoxCorrelation K).re) + (herr : (𝔼 x : Fin 6 → X, ‖tripleBoxKernel K x - F x‖) ≤ ε) : + ∃ a : Fin 3 → X, + δ ^ 2 / 2 ≤ (𝔼 z : Fin 3 → X, ‖tripleBoxAnchorFactor K a z‖ ^ 2) ∧ + δ ^ 2 / 2 ≤ (𝔼 z : Fin 3 → X, ‖K (z 0) (z 1) (z 2) * tripleBoxAnchorFactor K a z‖ ^ 2) ∧ + (𝔼 z : Fin 3 → X, + ‖K (z 0) (z 1) (z 2) * tripleBoxAnchorFactor K a z - F (tripleBoxSlice a z)‖) ≤ 2 * ε / δ ^ 2 := by + let A := fun a : Fin 3 → X => + 𝔼 z : Fin 3 → X, ‖K (z 0) (z 1) (z 2) * tripleBoxAnchorFactor K a z‖ ^ 2 + let B := fun a : Fin 3 → X => 𝔼 z : Fin 3 → X, ‖tripleBoxKernel K (tripleBoxSlice a z) - F (tripleBoxSlice a z)‖ + have hA : ∀ a, A a ≤ 1 := by + intro a + have hnorm (z : Fin 3 → X) : ‖K (z 0) (z 1) (z 2) * tripleBoxAnchorFactor K a z‖ ≤ 1 := by + rw [norm_mul] + exact (mul_le_of_le_one_left (norm_nonneg _) (hK _ _ _)).trans + (tripleBoxAnchorFactor_norm_le_one K hK a z) + exact (Finset.expect_le_expect (fun z _ => + pow_le_pow_left₀ (norm_nonneg _) (hnorm z) 2)).trans_eq (by simp) + have hB : ∀ a, 0 ≤ B a := fun a => Finset.expect_nonneg (fun z _ => norm_nonneg _) + have hmass : δ ^ 2 ≤ 𝔼 a, A a := by + calc + _ ≤ ‖finiteTripleBoxCorrelation K‖ ^ 2 := + pow_le_pow_left₀ hδ.le (hbias.trans (Complex.re_le_norm _)) 2 + _ ≤ 𝔼 x : Fin 6 → X, ‖tripleBoxKernel K x‖ ^ 2 := by + rw [← tripleBoxKernel_mean] + exact norm_expect_sq_le_expect_norm_sq _ + _ = _ := by simpa only [A, tripleBoxKernel_slice] using expect_tripleBoxSlice (fun x => ‖tripleBoxKernel K x‖ ^ 2) + have herror : (𝔼 a, B a) ≤ ε := by + rw [expect_tripleBoxSlice] at herr + exact herr + obtain ⟨a, ha, he⟩ := exists_mass_error_point A B (sq_pos_of_pos hδ) hε hA hB hmass herror + refine ⟨a, ha.trans ?_, ha, by simpa only [B, tripleBoxKernel_slice] using he⟩ + apply Finset.expect_le_expect + intro z _ + apply pow_le_pow_left₀ (norm_nonneg _) + rw [norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (hK _ _ _) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/TwoBoxSmoothingComplex.lean b/lean/OAI/Combinatorics/Progressions/Geometry/TwoBoxSmoothingComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..50d1dbeae5123656aab62eb4dd214bbff0489dc0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/TwoBoxSmoothingComplex.lean @@ -0,0 +1,197 @@ +import OAI.Combinatorics.Progressions.Probability.DiagonalDensityTransport + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +variable {ι : Type*} [Fintype ι] + +noncomputable def twoBoxDifferenceDensity (ℓ r : ι → ℝ) + (A B : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) : (ι → ℝ) → ℝ := + affineBoxAverage ℓ A.toContinuousLinearMap (linearBoxDensity r B) + +theorem twoBoxDifferenceDensity_mem_Icc (ℓ r : ι → ℝ) + (hℓ : ∀ i, 0 < ℓ i) (hr : ∀ i, 0 < r i) + (A B : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) (x : ι → ℝ) : + twoBoxDifferenceDensity ℓ r A B x ∈ Set.Icc (0 : ℝ) (linearBoxDensityCap r hr B) := + affineBoxAverage_mem_Icc ℓ hℓ A _ (linearBoxDensity_measurable r B) + (linearBoxDensity_mem_Icc r hr B) x + +theorem twoBoxDifferenceDensity_lipschitz [DecidableEq ι] (ℓ r : ι → ℝ) + (hℓ : ∀ i, 0 < ℓ i) (hr : ∀ i, 0 < r i) + (A B : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) : + LipschitzWith ((linearBoxDensityCap r hr B * boxWindowTranslationBound ℓ hℓ) * + ‖A.symm.toContinuousLinearMap‖₊) (twoBoxDifferenceDensity ℓ r A B) := by + apply affineBoxAverage_lipschitz ℓ hℓ A _ _ (linearBoxDensity_measurable r B) + intro x + rw [Real.norm_eq_abs, abs_of_nonneg (linearBoxDensity_mem_Icc r hr B x).1] + exact (linearBoxDensity_mem_Icc r hr B x).2 + +theorem twoBoxDifferenceDensity_integrable (ℓ r : ι → ℝ) + (A B : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) : Integrable (twoBoxDifferenceDensity ℓ r A B) := + affineBoxAverage_integrable ℓ A.toContinuousLinearMap _ + (linearBoxDensity_measurable r B) (linearBoxDensity_integrable r B) + +theorem twoBoxDifferenceDensity_mass (ℓ r : ι → ℝ) + (hℓ : ∀ i, 0 < ℓ i) (hr : ∀ i, 0 < r i) + (A B : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) : (∫ x, twoBoxDifferenceDensity ℓ r A B x) = 1 := by + unfold twoBoxDifferenceDensity + rw [affineBoxAverage_mass ℓ hℓ _ _ (linearBoxDensity_measurable r B) + (linearBoxDensity_integrable r B), linearBoxDensity_mass r hr] + +theorem twoBoxDifferenceDensity_test_integral (ℓ r : ι → ℝ) + (A B : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) (φ : (ι → ℝ) → ℝ) + (hφ : Measurable φ) {C : ℝ} (hφC : ∀ x, ‖φ x‖ ≤ C) : + (∫ x, twoBoxDifferenceDensity ℓ r A B x * φ x) = + ∫ u, boxProbabilityWindow ℓ 0 u * + ∫ v, boxProbabilityWindow r 0 v * φ (B v - A u) := by + unfold twoBoxDifferenceDensity + rw [affineBoxAverage_test_integral ℓ _ _ φ + (linearBoxDensity_measurable r B) (linearBoxDensity_integrable r B) hφ hφC] + apply integral_congr_ae + filter_upwards [] with u + congr 1 + exact linearDensityPullback_test_integral B _ (fun y => φ (y - A u)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +variable {ι : Type*} [Fintype ι] + +theorem affineBoxAverage_preserves_lipschitz (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) (g : (ι → ℝ) → ℝ) (L : ℝ≥0) + (hg : LipschitzWith L g) {C : ℝ} (hbound : ∀ x, ‖g x‖ ≤ C) : + LipschitzWith L (affineBoxAverage ℓ A g) := by + apply fixedKernelMixture_lipschitz volume (boxProbabilityWindow ℓ 0) + (fun x u => g (x + A u)) L (boxProbabilityWindow_integrable ℓ 0) + (boxProbabilityWindow_nonneg ℓ hℓ 0) (boxProbabilityWindow_mass ℓ hℓ 0) + · intro x + exact (boxProbabilityWindow_integrable ℓ 0).mul_bdd + (hg.continuous.comp (continuous_const.add A.continuous)).aestronglyMeasurable + (Filter.Eventually.of_forall (fun u => hbound (x + A u))) + · intro u + apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [dist_add_right] using hg.dist_le_mul (x + A u) (y + A u) + +theorem affineBoxAverage_preserves_cap (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) (g : (ι → ℝ) → ℝ) + (hg : Measurable g) {C : ℝ} (hbound : ∀ x, g x ∈ Set.Icc (0 : ℝ) C) + (x : ι → ℝ) : affineBoxAverage ℓ A g x ∈ Set.Icc (0 : ℝ) C := by + have hnorm (u) : ‖g (x + A u)‖ ≤ C := by + rw [Real.norm_of_nonneg (hbound _).1] + exact (hbound _).2 + have hint : Integrable (fun u => boxProbabilityWindow ℓ 0 u * g (x + A u)) := + (boxProbabilityWindow_integrable ℓ 0).mul_bdd + (hg.comp (measurable_const.add A.continuous.measurable)).aestronglyMeasurable + (Filter.Eventually.of_forall hnorm) + refine ⟨affineBoxAverage_nonneg ℓ hℓ A g (fun y => (hbound y).1) x, ?_⟩ + have h := integral_mono hint ((boxProbabilityWindow_integrable ℓ 0).mul_const C) + (fun u => mul_le_mul_of_nonneg_left (hbound _).2 (boxProbabilityWindow_nonneg ℓ hℓ 0 u)) + simpa only [affineBoxAverage, integral_mul_const, boxProbabilityWindow_mass ℓ hℓ 0, one_mul] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory + +variable {ι : Type*} [Fintype ι] + +theorem integral_comp_inverse_linear_complex + (A : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) (f : (ι → ℝ) → ℂ) : + (∫ x, f (A.symm x)) = (((inverseJacobian A)⁻¹ : ℝ) : ℂ) * ∫ x, f x := by + have h := A.symm.toHomeomorph.measurableEmbedding.integral_map (μ := volume) f + simp only [ContinuousLinearEquiv.coe_toHomeomorph] at h + rw [inverse_map_volume, integral_smul_measure, + ENNReal.toReal_ofReal (inv_nonneg.mpr (inverseJacobian_pos A).le)] at h + simpa only [Complex.real_smul] using h.symm + +theorem linearDensityPullback_complex_test_integral + (A : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) (f : (ι → ℝ) → ℝ) (φ : (ι → ℝ) → ℂ) : + (∫ x, (linearDensityPullback A f x : ℂ) * φ x) = + ∫ u, (f u : ℂ) * φ (A u) := by + have he (x : ι → ℝ) : (linearDensityPullback A f x : ℂ) * φ x = + (inverseJacobian A : ℂ) * + ((f (A.symm x) : ℂ) * φ (A (A.symm x))) := by + simp only [linearDensityPullback, Complex.ofReal_mul, A.apply_symm_apply, mul_assoc] + simp_rw [he] + rw [integral_const_mul, + integral_comp_inverse_linear_complex A (fun u => (f u : ℂ) * φ (A u)), + ← mul_assoc, ← Complex.ofReal_mul, mul_inv_cancel₀ (inverseJacobian_pos A).ne', + Complex.ofReal_one, one_mul] + +theorem affineBoxAverage_complex_test_integral (ℓ : ι → ℝ) + (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) (g : (ι → ℝ) → ℝ) (φ : (ι → ℝ) → ℂ) + (hg : Measurable g) (hgi : Integrable g) (hφ : Measurable φ) + {C : ℝ} (hφC : ∀ x, ‖φ x‖ ≤ C) : + (∫ x, (affineBoxAverage ℓ A g x : ℂ) * φ x) = + ∫ u, (boxProbabilityWindow ℓ 0 u : ℂ) * ∫ y, (g y : ℂ) * φ (y - A u) := by + have hi : Integrable (Function.uncurry + (fun x u => ((boxProbabilityWindow ℓ 0 u * g (x + A u) : ℝ) : ℂ) * φ x)) + (volume.prod volume) := + (affineBoxIntegrand_integrable ℓ A g hg hgi).ofReal.mul_bdd + (hφ.comp measurable_fst).aestronglyMeasurable + (Filter.Eventually.of_forall (fun p => hφC p.1)) + calc + (∫ x, (affineBoxAverage ℓ A g x : ℂ) * φ x) = + ∫ x, ∫ u, ((boxProbabilityWindow ℓ 0 u * g (x + A u) : ℝ) : ℂ) * φ x := by + apply integral_congr_ae + filter_upwards [] with x + rw [integral_mul_const, + integral_complex_ofReal (f := fun a => boxProbabilityWindow ℓ 0 a * g (x + A a))] + rfl + _ = ∫ u, ∫ x, ((boxProbabilityWindow ℓ 0 u * g (x + A u) : ℝ) : ℂ) * φ x := + integral_integral_swap hi + _ = ∫ u, (boxProbabilityWindow ℓ 0 u : ℂ) * ∫ y, (g y : ℂ) * φ (y - A u) := by + apply integral_congr_ae + filter_upwards [] with u + simp only [Complex.ofReal_mul, mul_assoc, integral_const_mul] + congr 1 + have h := integral_add_right_eq_self (μ := volume) + (fun y => (g y : ℂ) * φ (y - A u)) (A u) + simpa only [add_sub_cancel_right] using h + +theorem twoBoxDifferenceDensity_complex_test_integrable (ℓ r : ι → ℝ) + (A B : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) (φ : (ι → ℝ) → ℂ) + (hφ : Measurable φ) {C : ℝ} (hφC : ∀ x, ‖φ x‖ ≤ C) : + Integrable (fun x => (twoBoxDifferenceDensity ℓ r A B x : ℂ) * φ x) := + (twoBoxDifferenceDensity_integrable ℓ r A B).ofReal.mul_bdd + hφ.aestronglyMeasurable (Filter.Eventually.of_forall hφC) + +theorem twoBoxDifferenceDensity_complex_test_integral (ℓ r : ι → ℝ) + (A B : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) (φ : (ι → ℝ) → ℂ) + (hφ : Measurable φ) {C : ℝ} (hφC : ∀ x, ‖φ x‖ ≤ C) : + (∫ x, (twoBoxDifferenceDensity ℓ r A B x : ℂ) * φ x) = + ∫ u, (boxProbabilityWindow ℓ 0 u : ℂ) * + ∫ v, (boxProbabilityWindow r 0 v : ℂ) * φ (B v - A u) := by + unfold twoBoxDifferenceDensity + rw [affineBoxAverage_complex_test_integral ℓ _ _ φ + (linearBoxDensity_measurable r B) (linearBoxDensity_integrable r B) hφ hφC] + apply integral_congr_ae + filter_upwards [] with u + congr 1 + exact linearDensityPullback_complex_test_integral B _ (fun y => φ (y - A u)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedCommonSideSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedCommonSideSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..819d5c454ba817633e261ce5e9a420242d773e66 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedCommonSideSupport.lean @@ -0,0 +1,59 @@ +import OAI.Combinatorics.Progressions.Estimates.CanonicalEmptyLayerGeometry + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem unconditionedResidueSiteBound_le_commonSide + {K J : Type*} [Fintype K] [Fintype J] + (P : J → ℕ) (e : K ≃ J) (S : ℕ) (hP : ∀ j, P j ≤ S) : + unconditionedResidueSiteBound P ≤ (Fintype.card K : ℝ) * S := by + calc + unconditionedResidueSiteBound P ≤ ∑ _j : J, (S : ℝ) := by + apply Finset.sum_le_sum + intro j _ + exact_mod_cast hP j + _ = (Fintype.card K : ℝ) * S := by + simp [Fintype.card_congr e] + +theorem integerBox_commonSide_sum_abs_le + {K : Type*} [Fintype K] [DecidableEq K] + (S : ℕ) (x : K → ℤ) (hx : x ∈ integerBox (fun _ : K => S)) : + (∑ k, |(x k : ℝ)|) ≤ (Fintype.card K : ℝ) * S := by + calc + (∑ k, |(x k : ℝ)|) ≤ ∑ _k : K, (S : ℝ) := by + apply Finset.sum_le_sum + intro k _ + have hk := (mem_integerBox (fun _ : K => S) x).mp hx k + rw [abs_of_nonneg (by exact_mod_cast hk.1 : (0 : ℝ) ≤ x k)] + exact_mod_cast hk.2.le + _ = (Fintype.card K : ℝ) * S := by simp + +namespace BooleanCubeKernel + +theorem unconditionedCommonSide_site_mem + {K X : Type*} [Fintype K] [DecidableEq K] [Fintype X] [DecidableEq X] + (S : ℕ) {τ : ℝ} (hτ : 0 ≤ τ) (N : X → ℕ) + (hR : ∀ i, 2 * spatialTrimMargin τ N i < N i) + (z : trimmedIntegerBox N (spatialTrimMargin τ N) × + rectangularWeightIndices 0 + (trimmedSpatialWidths (K := K) ((Fintype.card K : ℝ) * S) τ N) 1) + (x : K → ℤ) (hx : x ∈ integerBox (fun _ : K => S)) : + jointIntegerPhysicalSite x (z.1.val, z.2.val) ∈ integerBox N := by + apply jointIntegerPhysicalSite_mem_box x N (spatialTrimMargin τ N) + (fun i => (hR i).le) + (trimmedSpatialWidths (K := K) ((Fintype.card K : ℝ) * S) τ N) _ z + intro i + exact spatialTrimMargin_fits (by positivity) hτ x + (integerBox_commonSide_sum_abs_le S x hx) N i + +end BooleanCubeKernel +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedJointReferenceSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedJointReferenceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8369e11ae41c792cc28dd3f8dfe4e0bb32dac46 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedJointReferenceSupport.lean @@ -0,0 +1,49 @@ +import OAI.Combinatorics.Progressions.Probability.PositiveDensityNormalization + +namespace OAI + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators + +variable {K I : Type*} [Fintype K] [Fintype I] [DecidableEq I] + +theorem selectedJointReference_trimmed_site_mem + (root : K → ℤ) (N margin : I → ℕ) (hmargin : ∀ i, 2 * margin i < N i) + (W : Option K × I → ℝ) + (hwidth : ∀ i, physicalSiteWidth root W i ≤ (margin i : ℝ)) + (z : trimmedIntegerBox N margin × rectangularWeightIndices 0 W 1) : + jointIntegerPhysicalSite root (z.1.val, z.2.val) ∈ integerBox N := + jointIntegerPhysicalSite_mem_box root N margin (fun i => (hmargin i).le) W hwidth z + +theorem selectedJointReference_trimmed_domination + (root : K → ℤ) (N margin : I → ℕ) (hmargin : ∀ i, 2 * margin i < N i) + (hloss : (∑ i, 2 * (margin i : ℝ) / N i) ≤ 1 / 2) + (modulus : I → ℕ) (T : Finset (ColumnResiduePattern (Option K) I modulus)) + (W : Option K × I → ℝ) (hW : ∀ z, 0 < W z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z) + (hwidth : ∀ i, physicalSiteWidth root W i ≤ (margin i : ℝ)) + (f : (I → ℤ) → ℝ) (hf : ∀ x ∈ integerBox N, 0 ≤ f x) : + (selectedJointReference (trimmedIntegerBox N margin) + (trimmedIntegerBox_nonempty N margin hmargin) modulus T W hW hZ).mean + (fun z => f (jointIntegerPhysicalSite root (z.1.val, z.2.val))) ≤ + 2 * (𝔼 x ∈ integerBox N, f x) := by + rw [selectedJointReference, FiniteProbabilityWeights.mean_prod] + simp only [jointIntegerPhysicalSite] + have he (a : I → ℤ) := selectedResidueFiniteLaw_mean modulus T W hW hZ + (fun z => f (a + integerPhysicalSite root z)) + simp_rw [he] + rw [FiniteProbabilityWeights.uniformFinset_mean (trimmedIntegerBox N margin) + (trimmedIntegerBox_nonempty N margin hmargin) + (fun a => ∑' z, (selectedResidueSmoothPMF modulus T W hW hZ z).toReal * + f (a + integerPhysicalSite root z))] + exact selectedResidue_trimmed_reference_le root N margin hmargin hloss + modulus T W hW hZ hwidth f hf + +end Erdos3.BooleanCubeKernel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedSpatialWidthBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedSpatialWidthBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7219cad9618840731a130ad6ca69b1425ec83a0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UnconditionedSpatialWidthBudget.lean @@ -0,0 +1,755 @@ +import OAI.Combinatorics.Progressions.Estimates.CenteredReferenceCap +import OAI.Combinatorics.Progressions.Estimates.SelectedPhysicalReferenceCap + +namespace OAI + +section + +namespace Erdos3 + +theorem rectangularWeightIndices_zero_bound {I : Type*} [Fintype I] + (W : I → ℝ) {z : I → ℤ} (hz : z ∈ rectangularWeightIndices 0 W 1) (i : I) : + |(z i : ℝ)| ≤ W i := by + classical + have hi := Fintype.mem_piFinset.mp hz i + change z i ∈ sampledWeightIndices 0 (W i) 1 at hi + simp only [sampledWeightIndices, mul_one, zero_sub, zero_add, Finset.mem_Icc] at hi + exact abs_le.mpr ⟨Int.ceil_le.mp hi.1, Int.le_floor.mp hi.2⟩ + +theorem integer_center_quarter_mem (N : ℕ) (hN : 4 ≤ N) (x : ℤ) (hx : 4*|x| ≤ (N : ℤ)) : + 0 ≤ (N / 2 : ℕ) + x ∧ (N / 2 : ℕ) + x < (N : ℤ) := by + have hleft : -(N : ℤ) ≤ 4*x := by linarith [neg_abs_le x] + have hright : 4*x ≤ (N : ℤ) := by linarith [le_abs_self x] + omega + +namespace BooleanCubeKernel + +theorem centeredIntegerPhysicalSite_mem_box {K I : Type*} [Fintype K] [Fintype I] [DecidableEq I] + (root : K → ℤ) (N : I → ℕ) (hN : ∀ i, 4 ≤ N i) (W : Option K × I → ℝ) + (hwidth : ∀ i, 4 * physicalSiteWidth root W i ≤ (N i : ℝ)) + {z : Option K × I → ℤ} (hz : z ∈ rectangularWeightIndices 0 W 1) : + centeredIntegerPhysicalSite root N z ∈ integerBox N := by + apply (mem_integerBox N _).mpr + intro i + have hb := integerPhysicalSite_abs_bound root W z (rectangularWeightIndices_zero_bound W hz) i + have hr : 4 * |(integerPhysicalSite root z i : ℝ)| ≤ (N i : ℝ) := by linarith [hwidth i] + have hi : 4 * |integerPhysicalSite root z i| ≤ (N i : ℤ) := by exact_mod_cast hr + exact integer_center_quarter_mem (N i) (hN i) (integerPhysicalSite root z i) hi + +end BooleanCubeKernel +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem mem_rectangularWeightIndices_zero_iff {I : Type*} [Fintype I] + (W : I → ℝ) (z : I → ℤ) : + z ∈ rectangularWeightIndices 0 W 1 ↔ ∀ i, |(z i : ℝ)| ≤ W i := by + classical + constructor + · exact fun hz => rectangularWeightIndices_zero_bound W hz + · intro hz + apply Fintype.mem_piFinset.mpr + intro i + change z i ∈ sampledWeightIndices 0 (W i) 1 + simp only [sampledWeightIndices, mul_one, zero_sub, zero_add, Finset.mem_Icc] + exact ⟨Int.ceil_le.mpr (abs_le.mp (hz i)).1, Int.le_floor.mpr (abs_le.mp (hz i)).2⟩ + +theorem rectangularWeightIndices_zero_mono {I : Type*} [Fintype I] + {V W : I → ℝ} (hVW : ∀ i, V i ≤ W i) : + rectangularWeightIndices 0 V 1 ⊆ rectangularWeightIndices 0 W 1 := by + intro z hz + apply (mem_rectangularWeightIndices_zero_iff W z).mpr + exact fun i => (rectangularWeightIndices_zero_bound V hz i).trans (hVW i) + +end Erdos3 + +end + +section + +namespace Erdos3.BooleanCubeKernel + +theorem selectedResidueDensityPMF_centered_mem_box {K X : Type*} + [Fintype K] [Fintype X] [DecidableEq X] + (root : K → ℤ) (N : X → ℕ) (hN : ∀ i, 4 ≤ N i) + (modulus : X → ℕ) (T : Finset (ColumnResiduePattern (Option K) X modulus)) + (W : Option K × X → ℝ) (hW : ∀ z, 0 < W z) + (hfit : ∀ i, 4*physicalSiteWidth root W i ≤ (N i : ℝ)) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z) + (D : (Option K × X → ℤ) → ℝ) (hD0 : ∀ z, 0 ≤ D z) + (hD : 0 < selectedResidueDensityMass modulus T W D) + (z : Option K × X → ℤ) + (hz : 0 < (selectedResidueDensityPMF modulus T W hW hZ D hD0 hD z).toReal) : + centeredIntegerPhysicalSite root N z ∈ integerBox N := by + apply centeredIntegerPhysicalSite_mem_box root N hN W hfit + by_contra h + exact (ne_of_gt hz) (selectedResidueDensityPMF_zero_off modulus T W hW hZ D hD0 hD z h) + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators + +theorem selectedResidue_trimmed_reference_compare {K I : Type*} + [Fintype K] [Fintype I] [DecidableEq I] + (root : K → ℤ) (N R : I → ℕ) (hR : ∀ i, 2 * R i < N i) + (modulus : I → ℕ) (T : Finset (ColumnResiduePattern (Option K) I modulus)) + (W : Option K × I → ℝ) (hW : ∀ z, 0 < W z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z) + (hwidth : ∀ i, physicalSiteWidth root W i ≤ (R i : ℝ)) + (f : (I → ℤ) → ℂ) (hf : ∀ x ∈ integerBox N, ‖f x‖ ≤ 1) : + ‖(𝔼 a ∈ trimmedIntegerBox N R, + ∑' z, ((selectedResidueSmoothPMF modulus T W hW hZ z).toReal : ℂ) * + f (a + integerPhysicalSite root z)) - 𝔼 x ∈ integerBox N, f x‖ ≤ + 2 * ∑ i, 2 * (R i : ℝ) / N i := by + let p := selectedResidueFiniteLaw modulus T W hW hZ + have hnoise (z : rectangularWeightIndices 0 W 1) (i : I) : + |integerPhysicalSite root z.val i| ≤ (R i : ℤ) := by + have h := (integerPhysicalSite_abs_bound root W z.val + (rectangularWeightIndices_zero_bound W z.property) i).trans (hwidth i) + exact_mod_cast h + have h := p.translated_subset_mixture_compare (trimmedIntegerBox N R) (integerBox N) + (trimmedIntegerBox_nonempty N R hR) (fun z a => a + integerPhysicalSite root z.val) + (fun _ _ _ _ _ he => add_right_cancel he) + (fun z _ ha => trimmedIntegerBox_add_mem N R (fun i => (hR i).le) ha _ (hnoise z)) f hf + have hdef := trimmedIntegerBox_card_deficit N R + (fun i => lt_of_le_of_lt (Nat.zero_le _) (hR i)) (fun i => (hR i).le) + have hbound := h.trans (mul_le_mul_of_nonneg_left hdef (by norm_num : (0 : ℝ) ≤ 2)) + dsimp only [p] at hbound + have he (a : I → ℤ) := selectedResidueFiniteLaw_complexMean modulus T W hW hZ + (fun z => f (a + integerPhysicalSite root z)) + simpa only [he] using hbound + +theorem selectedResidue_trimmed_comparison_transfer {K I : Type*} + [Fintype K] [Fintype I] [DecidableEq I] + (root : K → ℤ) (N R : I → ℕ) (hR : ∀ i, 2 * R i < N i) + (modulus : I → ℕ) (T : Finset (ColumnResiduePattern (Option K) I modulus)) + (W : Option K × I → ℝ) (hW : ∀ z, 0 < W z) + (hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z) + (hwidth : ∀ i, physicalSiteWidth root W i ≤ (R i : ℝ)) + (f : (I → ℤ) → ℂ) (hf : ∀ x ∈ integerBox N, ‖f x‖ ≤ 1) + (L : (I → ℤ) → ℂ) {ε : ℝ} + (hL : ∀ a ∈ trimmedIntegerBox N R, + ‖L a - ∑' z, ((selectedResidueSmoothPMF modulus T W hW hZ z).toReal : ℂ) * + f (a + integerPhysicalSite root z)‖ ≤ ε) : + ‖(𝔼 a ∈ trimmedIntegerBox N R, L a) - 𝔼 x ∈ integerBox N, f x‖ ≤ + ε + 2 * ∑ i, 2 * (R i : ℝ) / N i := by + have hlocal : ‖(𝔼 a ∈ trimmedIntegerBox N R, L a) - + (𝔼 a ∈ trimmedIntegerBox N R, + ∑' z, ((selectedResidueSmoothPMF modulus T W hW hZ z).toReal : ℂ) * + f (a + integerPhysicalSite root z))‖ ≤ ε := by + rw [← Finset.expect_sub_distrib] + exact (RCLike.norm_expect_le (K := ℂ)).trans + (Finset.expect_le (trimmedIntegerBox_nonempty N R hR) hL) + exact (norm_sub_le_norm_sub_add_norm_sub _ _ _).trans + (add_le_add hlocal (selectedResidue_trimmed_reference_compare + root N R hR modulus T W hW hZ hwidth f hf)) + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem shiftedSmoothProductMass_pos_of_scales {I : Type*} [Fintype I] + (a S : I → ℝ) (hS : ∀ i, 8*(probabilityProfileLipschitz : ℝ) ≤ S i) : + 0 < shiftedSmoothProductMass a S := by + rw [shiftedSmoothProductMass_eq_prod a S (fun i => smoothSamplingScale_pos (hS i))] + exact Finset.prod_pos (fun i _ => shiftedSmoothSampleSum_pos (a i) (hS i)) + +namespace BooleanCubeKernel + +theorem exists_selectedResidue_physical_cap {K I : Type*} [Fintype K] [Fintype I] + (root : K → ℤ) (modulus : I → ℕ) (hmodulus : ∀ i, 0 < modulus i) + (T : Finset (ColumnResiduePattern (Option K) I modulus)) (hT : T.Nonempty) + (W : Option K × I → ℝ) (hW : ∀ z, 0 < W z) + (hscale : ∀ z, 8*(probabilityProfileLipschitz : ℝ) ≤ residueProfileWidth modulus W z) : + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z, + ∀ y, ((selectedResidueSmoothPMF modulus T W hW hZ).map (physicalAffineSite root) y).toReal ≤ + ∏ i, 2*(modulus i : ℝ)/W (none,i) := by + have hc (r : T) : 0 < shiftedSmoothProductMass + (residueProfileCenter (columnResidueRepresentative modulus r.val) modulus) (residueProfileWidth modulus W) := + shiftedSmoothProductMass_pos_of_scales _ _ hscale + have hZ := selectedResidueSmoothWeight_mass_pos modulus T hT W hW (fun r => by + rw [← residueSmoothWeight_mass _ modulus hmodulus W hW] + exact hc r) + exact ⟨hZ, selectedResidueSmoothPMF_physical_cap root modulus hmodulus T hT W hW hZ hc + (fun i => hscale (none,i))⟩ + +end BooleanCubeKernel + +theorem spatialBaseCap_exp_bound {I : Type*} [Fintype I] + (modulus : I → ℕ) (W H : I → ℝ) (hW : ∀ i, 0 < W i) (hH : ∀ i, 0 ≤ H i) + {P ρ : ℝ} (hP : 0 ≤ P) (hρ : 0 < ρ) (hρP : ρ⁻¹ ≤ Real.exp P) + (hI : (Fintype.card I : ℝ) ≤ P) (hmodulus : ∀ i, (modulus i : ℝ) ≤ Real.exp P) + (hwidth : ∀ i, ρ*H i ≤ W i) : + (∏ i, H i) * (∏ i, 2*(modulus i : ℝ)/W i) ≤ Real.exp (2*P^2+2*P) := by + have h2 : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have hc : 2*Real.exp P/ρ ≤ Real.exp (2*P+2) := by + rw [div_eq_mul_inv] + calc + _ ≤ Real.exp 2 * Real.exp P * Real.exp P := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + have hp := pow_le_exp_mul_of_le_exp (by positivity) hc (by positivity) (Fintype.card I) hI + exact (spatialBaseCap_volume_bound modulus W H hW hH hρ (Real.exp_nonneg P) hmodulus hwidth).trans + (hp.trans_eq (by congr 1; ring)) + +end Erdos3 + +end + +section + +namespace Erdos3.BooleanCubeKernel + +open scoped BigOperators Classical + +theorem exists_selected_reference_box_domination {K I : Type*} [Fintype K] [Fintype I] [DecidableEq I] + (root : K → ℤ) (modulus : I → ℕ) (hmodulus : ∀ i, 0 < modulus i) + (T : Finset (ColumnResiduePattern (Option K) I modulus)) (hT : T.Nonempty) + (W : Option K × I → ℝ) (hW : ∀ z, 0 < W z) + (hscale : ∀ z, 8*(probabilityProfileLipschitz : ℝ) ≤ residueProfileWidth modulus W z) + (N : I → ℕ) (hN : ∀ i, 4 ≤ N i) + (hfit : ∀ i, 4*physicalSiteWidth root W i ≤ (N i : ℝ)) + {S ρ : ℝ} (hS : 0 ≤ S) (hρ : 0 < ρ) (hmodulusS : ∀ i, (modulus i : ℝ) ≤ S) + (hbase : ∀ i, ρ*(N i : ℝ) ≤ W (none,i)) : + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z, + ∀ φ : (I → ℝ) → ℝ, (∀ x ∈ integerBox N, 0 ≤ φ (fun i => (x i : ℝ))) → + (∑' z, (selectedResidueSmoothPMF modulus T W hW hZ z).toReal * + φ ((fun i => (integerBoxCenter N i : ℝ)) + physicalAffineSite root z)) ≤ + (2*S/ρ)^Fintype.card I * (𝔼 x ∈ integerBox N, φ (fun i => (x i : ℝ))) := by + obtain ⟨hZ, hp⟩ := exists_selectedResidue_physical_cap root modulus hmodulus T hT W hW hscale + refine ⟨hZ, ?_⟩ + intro φ hφ + let p := selectedResidueFiniteLaw modulus T W hW hZ + let F : rectangularWeightIndices 0 W 1 → (I → ℤ) := + fun z => centeredIntegerPhysicalSite root N z.val + let B := ∏ i, 2*(modulus i : ℝ)/W (none,i) + have hB : 0 ≤ B := Finset.prod_nonneg (fun i _ => + div_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) (hW _).le) + have hF (z : rectangularWeightIndices 0 W 1) : F z ∈ integerBox N := + centeredIntegerPhysicalSite_mem_box root N hN W hfit z.property + have hpoint (y : I → ℤ) : p.mean (fun z => if F z = y then 1 else 0) ≤ B := by + exact (selectedResidueFiniteLaw_mean modulus T W hW hZ + (fun z => if centeredIntegerPhysicalSite root N z = y then 1 else 0)).trans_le + ((pmf_map_toReal_indicator (selectedResidueSmoothPMF modulus T W hW hZ) + (centeredIntegerPhysicalSite root N) y).symm.trans_le + (pmf_centeredPhysicalSite_cap _ root N hB hp y)) + have hf := p.image_mean_le_uniform F (integerBox N) hF hpoint + (fun x => φ (fun i => (x i : ℝ))) hφ + dsimp only [p, F] at hf + rw [selectedResidueFiniteLaw_mean modulus T W hW hZ + (fun z => φ (fun i => (centeredIntegerPhysicalSite root N z i : ℝ)))] at hf + simp only [centeredIntegerPhysicalSite_cast] at hf + have hcap : B*((integerBox N).card : ℝ) ≤ (2*S/ρ)^Fintype.card I := by + calc + _ = (∏ i, (N i : ℝ))*B := by rw [card_integerBox, Nat.cast_prod]; ring + _ ≤ _ := spatialBaseCap_volume_bound modulus (fun i => W (none,i)) (fun i => (N i : ℝ)) + (fun i => hW _) (fun i => Nat.cast_nonneg _) hρ hS hmodulusS hbase + exact hf.trans (mul_le_mul_of_nonneg_right hcap (Finset.expect_nonneg hφ)) + +end Erdos3.BooleanCubeKernel + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def centeredSpatialWidths {K I : Type*} (B σ : ℝ) (N : I → ℕ) : Option K × I → ℝ := + fun z => match z.1 with + | none => (N z.2 : ℝ)/8 + | some _ => σ*(N z.2 : ℝ)/(8*(1+B)) + +theorem centeredSpatialWidths_pos {K I : Type*} {B σ : ℝ} (hB : 0 ≤ B) (hσ : 0 < σ) + (N : I → ℕ) (hN : ∀ i, 0 < N i) (z : Option K × I) : + 0 < centeredSpatialWidths B σ N z := by + have hn : (0 : ℝ) < N z.2 := by exact_mod_cast hN z.2 + rcases z with ⟨k,i⟩ + cases k <;> dsimp only [centeredSpatialWidths] <;> positivity + +theorem centeredSpatialWidths_scale {K I : Type*} {B σ : ℝ} (hB : 0 ≤ B) (hσ1 : σ ≤ 1) + (modulus : I → ℕ) (hmodulus : ∀ i, 0 < modulus i) (N : I → ℕ) + (hsize : ∀ i, 64*(probabilityProfileLipschitz : ℝ)*(modulus i : ℝ)*(1+B) ≤ σ*(N i : ℝ)) + (z : Option K × I) : + 8*(probabilityProfileLipschitz : ℝ) ≤ + residueProfileWidth modulus (centeredSpatialWidths B σ N) z := by + rcases z with ⟨k,i⟩ + have hm : (0 : ℝ) < modulus i := by exact_mod_cast hmodulus i + change 8*(probabilityProfileLipschitz : ℝ) ≤ centeredSpatialWidths B σ N (k,i)/(modulus i : ℝ) + apply (le_div_iff₀ hm).mpr + cases k with + | none => + change _ ≤ (N i : ℝ)/8 + apply (le_div_iff₀ (by norm_num : (0 : ℝ)<8)).mpr + have hl : 64*(probabilityProfileLipschitz : ℝ)*(modulus i : ℝ) ≤ + 64*(probabilityProfileLipschitz : ℝ)*(modulus i : ℝ)*(1+B) := by + apply le_mul_of_one_le_right (by positivity) + linarith + have hn := mul_le_mul_of_nonneg_right hσ1 (Nat.cast_nonneg (α := ℝ) (N i)) + nlinarith [hsize i] + | some k => + change _ ≤ σ*(N i : ℝ)/(8*(1+B)) + apply (le_div_iff₀ (by positivity : (0 : ℝ)<8*(1+B))).mpr + nlinarith [hsize i] + +namespace BooleanCubeKernel + +theorem centeredSpatialWidths_fit {K I : Type*} [Fintype K] {B σ : ℝ} + (hB : 0 ≤ B) (hσ : 0 ≤ σ) (hσ1 : σ ≤ 1) (root : K → ℤ) + (hroot : (∑ k, |(root k : ℝ)|) ≤ B) (N : I → ℕ) (i : I) : + 4 * physicalSiteWidth root (centeredSpatialWidths B σ N) i ≤ (N i : ℝ) := by + have hn := Nat.cast_nonneg (α := ℝ) (N i) + have hb : 1+B ≠ 0 := ne_of_gt (by linarith) + have hv : 0 ≤ σ*(N i : ℝ)/(8*(1+B)) := by positivity + have ht : B*(σ*(N i : ℝ)/(8*(1+B))) ≤ (N i : ℝ)/8 := by + calc + _ ≤ (1+B)*(σ*(N i : ℝ)/(8*(1+B))) := + mul_le_mul_of_nonneg_right (by linarith) hv + _ = σ*(N i : ℝ)/8 := by field_simp + _ ≤ (N i : ℝ)/8 := by + exact div_le_div_of_nonneg_right (by nlinarith) (by norm_num) + simp only [physicalSiteWidth, centeredSpatialWidths, ← Finset.sum_mul] + have hs := mul_le_mul_of_nonneg_right hroot hv + nlinarith + +theorem exists_centered_reference_box_domination {K I : Type*} + [Fintype K] [Fintype I] [DecidableEq I] {B σ S : ℝ} + (hB : 0 ≤ B) (hσ : 0 < σ) (hσ1 : σ ≤ 1) (hS : 0 ≤ S) + (root : K → ℤ) (hroot : (∑ k, |(root k : ℝ)|) ≤ B) + (modulus : I → ℕ) (hmodulus : ∀ i, 0 < modulus i) + (hmodulusS : ∀ i, (modulus i : ℝ) ≤ S) + (T : Finset (ColumnResiduePattern (Option K) I modulus)) (hT : T.Nonempty) + (N : I → ℕ) (hN : ∀ i, 4 ≤ N i) + (hsize : ∀ i, 64*(probabilityProfileLipschitz : ℝ)*(modulus i : ℝ)*(1+B) ≤ σ*(N i : ℝ)) : + let W := centeredSpatialWidths (K := K) B σ N + ∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight modulus T W z, + ∀ φ : (I → ℝ) → ℝ, (∀ x ∈ integerBox N, 0 ≤ φ (fun i => (x i : ℝ))) → + (∑' z, (selectedResidueSmoothPMF modulus T W + (centeredSpatialWidths_pos hB hσ N (fun i => by have := hN i; omega)) hZ z).toReal * + φ ((fun i => (integerBoxCenter N i : ℝ)) + physicalAffineSite root z)) ≤ + (16*S)^Fintype.card I * (𝔼 x ∈ integerBox N, φ (fun i => (x i : ℝ))) := by + have hW := centeredSpatialWidths_pos (K := K) hB hσ N (fun i => by have := hN i; omega) + obtain ⟨hZ, he⟩ := exists_selected_reference_box_domination root modulus hmodulus T hT + (centeredSpatialWidths B σ N) hW (centeredSpatialWidths_scale hB hσ1 modulus hmodulus N hsize) + N hN (centeredSpatialWidths_fit hB hσ.le hσ1 root hroot N) hS (ρ := 1/8) (by norm_num) + hmodulusS (fun i => by dsimp only [centeredSpatialWidths]; linarith) + refine ⟨hZ, ?_⟩ + intro φ hφ + simpa only [show 2*S/(1/8 : ℝ) = 16*S by ring] using he φ hφ + +end BooleanCubeKernel +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def spatialSamplingBudget (P : ℝ) : ℝ := 4*P+128 + +theorem le_spatialSamplingBudget {P : ℝ} (hP : 0 ≤ P) : P ≤ spatialSamplingBudget P := by + unfold spatialSamplingBudget + linarith + +noncomputable def spatialWidthFraction (P τ : ℝ) : ℝ := τ/(8*(1+Real.exp (2*P))) + +theorem spatialWidthFraction_pos (P : ℝ) {τ : ℝ} (hτ : 0 < τ) : + 0 < spatialWidthFraction P τ := by + unfold spatialWidthFraction + positivity + +theorem spatialWidthFraction_inv_le {P τ : ℝ} (hP : 0 ≤ P) (hτ : 0 < τ) + (hτP : τ⁻¹ ≤ Real.exp P) : 1/spatialWidthFraction P τ ≤ Real.exp (spatialSamplingBudget P) := by + have h1 : 1 ≤ Real.exp (2*P) := Real.one_le_exp_iff.mpr (by positivity) + have h16 : (16 : ℝ) ≤ Real.exp 128 := by linarith [Real.add_one_le_exp (128 : ℝ)] + calc + _ = (8*(1+Real.exp (2*P)))*τ⁻¹ := by unfold spatialWidthFraction; field_simp + _ ≤ (16*Real.exp (2*P))*Real.exp P := + mul_le_mul (by nlinarith) hτP (inv_nonneg.mpr hτ.le) (by positivity) + _ = 16*Real.exp (3*P) := by rw [mul_assoc, ← Real.exp_add]; congr 2; ring + _ ≤ Real.exp 128 * Real.exp (3*P) := mul_le_mul_of_nonneg_right h16 (by positivity) + _ = Real.exp (128+3*P) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (by unfold spatialSamplingBudget; linarith) + +theorem spatialWidthFraction_mul_le_width {K X : Type*} (P : ℝ) {τ : ℝ} + (hτ1 : τ ≤ 1) (N : X → ℕ) (z : Option K × X) : + spatialWidthFraction P τ * (N z.2 : ℝ) ≤ + centeredSpatialWidths (Real.exp (2*P)) τ N z := by + have hfrac : spatialWidthFraction P τ ≤ 1/8 := by + unfold spatialWidthFraction + apply (div_le_iff₀ (by positivity : (0 : ℝ) < 8*(1+Real.exp (2*P)))).mpr + nlinarith [Real.exp_pos (2*P)] + rcases z with ⟨k,i⟩ + cases k with + | none => + change spatialWidthFraction P τ * (N i : ℝ) ≤ (N i : ℝ)/8 + exact (mul_le_mul_of_nonneg_right hfrac (Nat.cast_nonneg _)).trans_eq (by ring) + | some k => + dsimp only [spatialWidthFraction, centeredSpatialWidths] + apply le_of_eq + ring + +theorem root_sum_le_spatial_budget {K : Type*} [Fintype K] {P : ℝ} + (hK : (Fintype.card K : ℝ) ≤ P) (root : K → ℤ) + (hroot : ∀ k, |(root k : ℝ)| ≤ Real.exp P) : + (∑ k, |(root k : ℝ)|) ≤ Real.exp (2*P) := by + have hPe : P ≤ Real.exp P := by linarith [Real.add_one_le_exp P] + calc + _ ≤ ∑ _k : K, Real.exp P := Finset.sum_le_sum (fun k _ => hroot k) + _ = (Fintype.card K : ℝ)*Real.exp P := by simp + _ ≤ P*Real.exp P := mul_le_mul_of_nonneg_right hK (by positivity) + _ ≤ Real.exp P * Real.exp P := mul_le_mul_of_nonneg_right hPe (by positivity) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +theorem spatial_scale_of_exp_size {P τ H q : ℝ} (hP : 0 ≤ P) (hτ : 0 < τ) + (hτP : τ⁻¹ ≤ Real.exp P) (hq0 : 0 ≤ q) (hq : q ≤ Real.exp P) + (hprofile : (probabilityProfileLipschitz : ℝ) ≤ Real.exp P) + (hH : Real.exp (5*P+128) ≤ H) : + 64*(probabilityProfileLipschitz : ℝ)*q*(1+Real.exp (2*P)) ≤ τ*H := by + have h1 : 1+Real.exp (2*P) ≤ 2*Real.exp (2*P) := by + have := Real.one_le_exp_iff.mpr (show 0 ≤ 2*P by positivity) + linarith + have h128 : (128 : ℝ) ≤ Real.exp 128 := by linarith [Real.add_one_le_exp (128 : ℝ)] + have hexp : Real.exp P*Real.exp P*Real.exp (2*P)*Real.exp P = Real.exp (5*P) := by + rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + rw [mul_comm τ H] + apply (div_le_iff₀ hτ).mp + calc + _ = 64*(probabilityProfileLipschitz : ℝ)*q*(1+Real.exp (2*P))*τ⁻¹ := div_eq_mul_inv _ _ + _ ≤ 64*Real.exp P*Real.exp P*(2*Real.exp (2*P))*Real.exp P := by + gcongr + _ = 128*Real.exp (5*P) := by rw [show + 64*Real.exp P*Real.exp P*(2*Real.exp (2*P))*Real.exp P = + 128*(Real.exp P*Real.exp P*Real.exp (2*P)*Real.exp P) by ring, hexp] + _ ≤ Real.exp 128*Real.exp (5*P) := mul_le_mul_of_nonneg_right h128 (by positivity) + _ = Real.exp (5*P+128) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ H := hH + +theorem spatial_threshold_dominates {P : ℝ} (hP : 0 ≤ P) {a A : ℕ} + (hA : 256 ≤ A) (ha : 2*a ≤ A) : + Real.exp ((spatialSamplingBudget P+a)^a) ≤ Real.exp ((P+A)^A) := by + have hAr : (256 : ℝ) ≤ A := by exact_mod_cast hA + have har : (2 : ℝ)*(a : ℝ) ≤ A := by exact_mod_cast ha + have hbase : spatialSamplingBudget P+a ≤ (P+A)^2 := by + unfold spatialSamplingBudget + nlinarith [sq_nonneg (P+(A : ℝ)-2)] + apply Real.exp_le_exp.mpr + calc + _ ≤ ((P+(A : ℝ))^2)^a := pow_le_pow_left₀ (by unfold spatialSamplingBudget; positivity) hbase a + _ = (P+(A : ℝ))^(2*a) := (pow_mul _ _ _).symm + _ ≤ _ := pow_le_pow_right₀ (by linarith) ha + +theorem spatial_threshold_large {P : ℝ} (hP : 0 ≤ P) {A : ℕ} (hA : 256 ≤ A) : + Real.exp (5*P+128) ≤ Real.exp ((P+A)^A) := by + have hAr : (256 : ℝ) ≤ A := by exact_mod_cast hA + apply Real.exp_le_exp.mpr + calc + _ ≤ (P+(A : ℝ))^2 := by nlinarith [sq_nonneg (P+(A : ℝ)-3)] + _ ≤ _ := pow_le_pow_right₀ (by linarith) (by omega) + +theorem four_le_of_spatial_threshold {P : ℝ} (hP : 0 ≤ P) {A : ℕ} + (hA : 256 ≤ A) (N : ℕ) (hN : Real.exp ((P+A)^A) ≤ (N : ℝ)) : 4 ≤ N := by + have he := (spatial_threshold_large hP hA).trans hN + have hn : (4 : ℝ) ≤ N := by linarith [Real.add_one_le_exp (5*P+128)] + exact_mod_cast hn + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def trimmedSpatialWidths {K I : Type*} (B τ : ℝ) (N : I → ℕ) : Option K × I → ℝ := + fun z => τ * centeredSpatialWidths B 1 N z + +theorem trimmedSpatialWidths_pos {K I : Type*} {B τ : ℝ} (hB : 0 ≤ B) (hτ : 0 < τ) + (N : I → ℕ) (hN : ∀ i, 0 < N i) (z : Option K × I) : + 0 < trimmedSpatialWidths B τ N z := + mul_pos hτ (centeredSpatialWidths_pos hB (by norm_num) N hN z) + +theorem spatialWidthFraction_le_trimmed_width {K I : Type*} (P : ℝ) {τ : ℝ} (hτ : 0 ≤ τ) + (N : I → ℕ) (z : Option K × I) : + spatialWidthFraction P τ * (N z.2 : ℝ) ≤ trimmedSpatialWidths (Real.exp (2*P)) τ N z := by + have h := mul_le_mul_of_nonneg_left + (spatialWidthFraction_mul_le_width (K := K) P (by norm_num : (1 : ℝ) ≤ 1) N z) hτ + have he : spatialWidthFraction P τ = τ * spatialWidthFraction P 1 := by + unfold spatialWidthFraction + ring + rw [he, mul_assoc] + exact h + +namespace BooleanCubeKernel + +theorem trimmedSpatialWidths_fit {K I : Type*} [Fintype K] {B τ : ℝ} + (hB : 0 ≤ B) (hτ : 0 ≤ τ) (root : K → ℤ) + (hroot : (∑ k, |(root k : ℝ)|) ≤ B) (N : I → ℕ) (i : I) : + physicalSiteWidth root (trimmedSpatialWidths B τ N) i ≤ τ * (N i : ℝ) / 4 := by + have h := mul_le_mul_of_nonneg_left + (centeredSpatialWidths_fit hB (by norm_num : (0 : ℝ) ≤ 1) (by norm_num : (1 : ℝ) ≤ 1) + root hroot N i) hτ + have he : physicalSiteWidth root (trimmedSpatialWidths B τ N) i = + τ * physicalSiteWidth root (centeredSpatialWidths B 1 N) i := by + simp only [physicalSiteWidth, trimmedSpatialWidths, mul_add, Finset.mul_sum] + congr 1 + apply Finset.sum_congr rfl + intro k _ + ring + rw [he] + nlinarith + +end BooleanCubeKernel + +noncomputable def spatialTrimMargin {I : Type*} (τ : ℝ) (N : I → ℕ) : I → ℕ := + fun i => ⌈τ * (N i : ℝ) / 4⌉₊ + +theorem spatialTrimMargin_fits {K I : Type*} [Fintype K] {B τ : ℝ} + (hB : 0 ≤ B) (hτ : 0 ≤ τ) (root : K → ℤ) + (hroot : (∑ k, |(root k : ℝ)|) ≤ B) (N : I → ℕ) (i : I) : + BooleanCubeKernel.physicalSiteWidth root (trimmedSpatialWidths B τ N) i ≤ + (spatialTrimMargin τ N i : ℝ) := + (BooleanCubeKernel.trimmedSpatialWidths_fit hB hτ root hroot N i).trans (Nat.le_ceil _) + +theorem spatialTrimMargin_bound {I : Type*} {τ : ℝ} (N : I → ℕ) + (hsize : ∀ i, 4 ≤ τ * (N i : ℝ)) (i : I) : + (spatialTrimMargin τ N i : ℝ) ≤ τ * (N i : ℝ) / 2 := by + have h := Nat.ceil_lt_add_one (show 0 ≤ τ * (N i : ℝ) / 4 by linarith [hsize i]) + dsimp only [spatialTrimMargin] + linarith [hsize i] + +theorem spatialTrimMargin_proper {I : Type*} {τ : ℝ} (hτ : τ ≤ 1/2) + (N : I → ℕ) (hN : ∀ i, 0 < N i) (hsize : ∀ i, 4 ≤ τ * (N i : ℝ)) (i : I) : + 2 * spatialTrimMargin τ N i < N i := by + have hn : (0 : ℝ) < N i := by exact_mod_cast hN i + have h := spatialTrimMargin_bound N hsize i + have hi : (2 : ℝ) * (spatialTrimMargin τ N i : ℝ) < N i := by nlinarith + exact_mod_cast hi + +theorem spatialTrimMargin_error_bound {I : Type*} [Fintype I] {τ : ℝ} + (N : I → ℕ) (hN : ∀ i, 0 < N i) (hsize : ∀ i, 4 ≤ τ * (N i : ℝ)) : + 2 * (∑ i, 2 * (spatialTrimMargin τ N i : ℝ) / N i) ≤ 2 * (Fintype.card I : ℝ) * τ := by + have hi (i : I) : 2 * (spatialTrimMargin τ N i : ℝ) / N i ≤ τ := by + apply (div_le_iff₀ (show (0 : ℝ) < N i by exact_mod_cast hN i)).mpr + linarith [spatialTrimMargin_bound N hsize i] + calc + _ ≤ 2 * ∑ _i : I, τ := mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun i _ => hi i)) (by norm_num) + _ = _ := by simp [mul_assoc] + +theorem spatialTrimMargin_size_of_exp_size {P τ H : ℝ} (hP : 0 ≤ P) (hτ : 0 < τ) + (hτP : τ⁻¹ ≤ Real.exp P) (hH : Real.exp (5*P+128) ≤ H) : 4 ≤ τ*H := by + have h4 : (4 : ℝ) ≤ Real.exp 128 := by linarith [Real.add_one_le_exp (128 : ℝ)] + have h : 4/τ ≤ H := calc + _ = 4*τ⁻¹ := div_eq_mul_inv _ _ + _ ≤ 4*Real.exp P := mul_le_mul_of_nonneg_left hτP (by norm_num) + _ ≤ Real.exp 128 * Real.exp P := mul_le_mul_of_nonneg_right h4 (by positivity) + _ = Real.exp (128+P) := (Real.exp_add _ _).symm + _ ≤ Real.exp (5*P+128) := Real.exp_le_exp.mpr (by linarith) + _ ≤ H := hH + simpa only [mul_comm H τ] using (div_le_iff₀ hτ).mp h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem trimmedSpatial_normalized_parameter_slope + {K I : Type*} [Fintype K] [Fintype I] + (P : K → ℕ) (N : I → ℕ) (hN : ∀ i, 0 < N i) + {B τ : ℝ} (hB : 0 ≤ B) (_hτ : 0 ≤ τ) + (z : rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1) + (k : K) (i : I) : + |(z.val (some k, i) : ℝ) / (N i : ℝ)| * (P k : ℝ) ≤ + τ * (P k : ℝ) / (8 * (1 + B)) := by + have hn : (0 : ℝ) < N i := by exact_mod_cast hN i + have hb : 0 < 8 * (1 + B) := by positivity + have hz := rectangularWeightIndices_zero_bound + (trimmedSpatialWidths (K := K) B τ N) z.property (some k, i) + change |(z.val (some k, i) : ℝ)| ≤ τ * (1 * (N i : ℝ) / (8 * (1 + B))) at hz + rw [one_mul] at hz + calc + _ = (|(z.val (some k, i) : ℝ)| / (N i : ℝ)) * (P k : ℝ) := by + rw [abs_div, abs_of_nonneg hn.le] + _ ≤ (τ * ((N i : ℝ) / (8 * (1 + B))) / (N i : ℝ)) * (P k : ℝ) := + mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right hz hn.le) (Nat.cast_nonneg _) + _ = _ := by field_simp + +theorem trimmedSpatial_normalized_parameter_slope_sum + {K I : Type*} [Fintype K] [Fintype I] + (P : K → ℕ) (N : I → ℕ) (hN : ∀ i, 0 < N i) + {B τ : ℝ} (hB : 0 ≤ B) (hτ : 0 ≤ τ) + (hP : (∑ k, (P k : ℝ)) ≤ B) + (z : rectangularWeightIndices 0 (trimmedSpatialWidths (K := K) B τ N) 1) + (i : I) : + (∑ k, |(z.val (some k, i) : ℝ) / (N i : ℝ)| * (P k : ℝ)) ≤ τ / 8 := by + have hb : 0 < 8 * (1 + B) := by positivity + calc + _ ≤ ∑ k, τ * (P k : ℝ) / (8 * (1 + B)) := + Finset.sum_le_sum (fun k _ => trimmedSpatial_normalized_parameter_slope P N hN hB hτ z k i) + _ = τ * (∑ k, (P k : ℝ)) / (8 * (1 + B)) := by + rw [← Finset.sum_div, Finset.mul_sum] + _ ≤ τ * B / (8 * (1 + B)) := + div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hP hτ) hb.le + _ ≤ τ / 8 := by + apply (div_le_iff₀ hb).mpr + nlinarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem trimmedSpatialWidths_scale {K I : Type*} {B τ : ℝ} (hB : 0 ≤ B) + (modulus : I → ℕ) (hmodulus : ∀ i, 0 < modulus i) (N : I → ℕ) + (hsize : ∀ i, 64*(probabilityProfileLipschitz : ℝ)*(modulus i : ℝ)*(1+B) ≤ τ*(N i : ℝ)) + (z : Option K × I) : + 8*(probabilityProfileLipschitz : ℝ) ≤ + residueProfileWidth modulus (trimmedSpatialWidths B τ N) z := by + rcases z with ⟨k,i⟩ + have hm : (0 : ℝ) < modulus i := by exact_mod_cast hmodulus i + change 8*(probabilityProfileLipschitz : ℝ) ≤ trimmedSpatialWidths B τ N (k,i)/(modulus i : ℝ) + apply (le_div_iff₀ hm).mpr + cases k with + | none => + change _ ≤ τ*((N i : ℝ)/8) + have hl : 64*(probabilityProfileLipschitz : ℝ)*(modulus i : ℝ) ≤ + 64*(probabilityProfileLipschitz : ℝ)*(modulus i : ℝ)*(1+B) := by + apply le_mul_of_one_le_right (by positivity) + linarith + nlinarith [hsize i] + | some k => + change _ ≤ τ*(1*(N i : ℝ)/(8*(1+B))) + rw [one_mul, ← mul_div_assoc] + apply (le_div_iff₀ (by positivity : (0 : ℝ)<8*(1+B))).mpr + nlinarith [hsize i] + +end Erdos3 + +end + +section + +namespace Erdos3 +open scoped BigOperators + +noncomputable def unconditionedSpatialTrimFraction (d : ℕ) (σ : ℝ) : ℝ := + σ / (32 * (d + 1)) + +noncomputable def unconditionedSpatialWidthCutoff (B τ L : ℝ) : ℝ := + max (4 / τ) (8 * (1 + B) * max (8 * (probabilityProfileLipschitz : ℝ)) L / τ) + +theorem unconditionedSpatialTrimFraction_bounds (d : ℕ) {σ : ℝ} + (hσ : 0 < σ) (hσ1 : σ ≤ 1) : + 0 < unconditionedSpatialTrimFraction d σ ∧ + unconditionedSpatialTrimFraction d σ ≤ 1/2 ∧ + 2 * (d : ℝ) * unconditionedSpatialTrimFraction d σ ≤ σ / 8 := by + have hd : 0 ≤ (d : ℝ) := Nat.cast_nonneg d + have hden : 0 < 32 * ((d : ℝ) + 1) := by positivity + unfold unconditionedSpatialTrimFraction + refine ⟨div_pos hσ hden, ?_, ?_⟩ + · apply (div_le_iff₀ hden).mpr + nlinarith + · rw [← mul_div_assoc] + apply (div_le_iff₀ hden).mpr + nlinarith + +theorem unconditionedSpatialWidthCutoff_bounds {K X : Type*} [Fintype X] + {B τ L σ : ℝ} (hB : 0 ≤ B) (hτ : 0 < τ) (hτhalf : τ ≤ 1/2) + (hbudget : 2 * (Fintype.card X : ℝ) * τ ≤ σ / 8) + (N : X → ℕ) (hN : ∀ i, unconditionedSpatialWidthCutoff B τ L ≤ (N i : ℝ)) : + (∀ i, 0 < N i) ∧ + (∀ i, 4 ≤ τ * (N i : ℝ)) ∧ + (∀ z : Option K × X, 0 < trimmedSpatialWidths B τ N z) ∧ + (∀ z : Option K × X, 8 * (probabilityProfileLipschitz : ℝ) ≤ + residueProfileWidth (fun _ : X => 1) (trimmedSpatialWidths B τ N) z) ∧ + (∀ z : Option K × X, L ≤ trimmedSpatialWidths B τ N z) ∧ + (∀ i, 2 * spatialTrimMargin τ N i < N i) ∧ + 2 * (∑ i, 2 * (spatialTrimMargin τ N i : ℝ) / N i) ≤ σ / 8 := by + have hsize (i : X) : 4 ≤ τ * (N i : ℝ) := by + have hh := (le_max_left _ _).trans (hN i) + have hh' := (div_le_iff₀ hτ).mp hh + linarith + have hpos (i : X) : 0 < N i := by + have hh : 0 < (N i : ℝ) := by nlinarith [hsize i] + exact_mod_cast hh + let M : ℝ := max (8 * (probabilityProfileLipschitz : ℝ)) L + have hM : 0 ≤ M := (by positivity : (0 : ℝ) ≤ 8 * (probabilityProfileLipschitz : ℝ)).trans + (le_max_left _ _) + have hwide (i : X) : 8 * (1 + B) * M ≤ τ * (N i : ℝ) := by + have hh := (le_max_right _ _).trans (hN i) + have hh' := (div_le_iff₀ hτ).mp hh + linarith + have hwidth (z : Option K × X) : M ≤ trimmedSpatialWidths B τ N z := by + rcases z with ⟨k, i⟩ + cases k with + | none => + change M ≤ τ * ((N i : ℝ) / 8) + have hh : 8 * M ≤ 8 * (1 + B) * M := by nlinarith + nlinarith [hwide i] + | some k => + change M ≤ τ * (1 * (N i : ℝ) / (8 * (1 + B))) + rw [one_mul, ← mul_div_assoc] + apply (le_div_iff₀ (by positivity : (0 : ℝ) < 8 * (1 + B))).mpr + nlinarith [hwide i] + refine ⟨hpos, hsize, trimmedSpatialWidths_pos hB hτ N hpos, ?_, ?_, + spatialTrimMargin_proper hτhalf N hpos hsize, + (spatialTrimMargin_error_bound N hpos hsize).trans hbudget⟩ + · intro z + change 8 * (probabilityProfileLipschitz : ℝ) ≤ trimmedSpatialWidths B τ N z / (1 : ℕ) + simpa only [Nat.cast_one, div_one] using (le_max_left _ _).trans (hwidth z) + · intro z + exact (le_max_right _ _).trans (hwidth z) + +theorem unconditionedSpatialWidthBudget {K X : Type*} [Fintype X] + {B L σ : ℝ} (hB : 0 ≤ B) (hσ : 0 < σ) (hσ1 : σ ≤ 1) + (N : X → ℕ) + (hN : ∀ i, unconditionedSpatialWidthCutoff B + (unconditionedSpatialTrimFraction (Fintype.card X) σ) L ≤ (N i : ℝ)) : + let τ := unconditionedSpatialTrimFraction (Fintype.card X) σ + (∀ i, 0 < N i) ∧ + (∀ i, 4 ≤ τ * (N i : ℝ)) ∧ + (∀ z : Option K × X, 0 < trimmedSpatialWidths B τ N z) ∧ + (∀ z : Option K × X, 8 * (probabilityProfileLipschitz : ℝ) ≤ + residueProfileWidth (fun _ : X => 1) (trimmedSpatialWidths B τ N) z) ∧ + (∀ z : Option K × X, L ≤ trimmedSpatialWidths B τ N z) ∧ + (∀ i, 2 * spatialTrimMargin τ N i < N i) ∧ + 2 * (∑ i, 2 * (spatialTrimMargin τ N i : ℝ) / N i) ≤ σ / 8 := by + obtain ⟨hτ, hτhalf, hbudget⟩ := unconditionedSpatialTrimFraction_bounds (Fintype.card X) hσ hσ1 + exact unconditionedSpatialWidthCutoff_bounds hB hτ hτhalf hbudget N hN + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UniformCoordinatePartition.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UniformCoordinatePartition.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae6c46cd523038b7d9495c8afd907e91acac477e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UniformCoordinatePartition.lean @@ -0,0 +1,44 @@ +import OAI.Combinatorics.Progressions.Polynomial.PolynomialCoordinatePartition + +namespace OAI + +section + +namespace Erdos3 + +universe u + +theorem PolynomialCoordinatePartitionBound.mono {h p p' : ℕ} {K K' : ℝ} + (hpartition : PolynomialCoordinatePartitionBound.{u} h K p) + (hK : K ≤ K') (hp : p ≤ p') : PolynomialCoordinatePartitionBound.{u} h K' p' := by + intro ι _ P hP N H hH hscale hsize + apply hpartition ι P hP N H hH + · exact (mul_le_mul_of_nonneg_right hK (by positivity)).trans hscale + · exact (Nat.pow_le_pow_right hH (Nat.mul_le_mul_right _ hp)).trans hsize + +theorem exists_uniform_coordinate_partition_bound (s : ℕ) : + ∃ (K : ℝ) (p : ℕ), 1 ≤ K ∧ 0 < p ∧ + ∀ h ≤ s, PolynomialCoordinatePartitionBound.{u} h K p := by + induction s with + | zero => + refine ⟨1, 1, le_rfl, by omega, ?_⟩ + intro h hh + have heq : h = 0 := by omega + subst h + exact polynomialCoordinatePartitionBound_zero + | succ s ih => + obtain ⟨K, p, hK, hp, hpart⟩ := ih + obtain ⟨K', p', hK', hp', hpart'⟩ := exists_polynomial_coordinate_partition_bound.{u} (s + 1) + refine ⟨max K K', p + p', hK.trans (le_max_left _ _), by omega, ?_⟩ + intro h hh + by_cases hs : h ≤ s + · exact (hpart h hs).mono (le_max_left _ _) (by omega) + · have heq : h = s + 1 := by omega + subst h + exact hpart'.mono (le_max_right _ _) (by omega) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UniformDependentSubtypeCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UniformDependentSubtypeCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..e208a957557276610943adc87e6f7b228138b9c6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UniformDependentSubtypeCoordinates.lean @@ -0,0 +1,62 @@ +import OAI.Combinatorics.Progressions.Probability.FiniteConditionedMass + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem uniformDependentSubtype_expect + {P : Type*} [Fintype P] [DecidableEq P] + (active : P → Prop) [DecidablePred active] + (A : P → Type*) [∀ p, Fintype (A p)] (f : (∀ p, A p) → ℂ) : + (𝔼 u : ∀ p, A p, f u) = + 𝔼 a : ∀ i : {p // active p}, A i.val, + 𝔼 s : ∀ i : {p // ¬active p}, A i.val, + f ((Equiv.piEquivPiSubtypeProd active A).symm (a, s)) := by + calc + _ = 𝔼 pair : (∀ i : {p // active p}, A i.val) × + (∀ i : {p // ¬active p}, A i.val), + f ((Equiv.piEquivPiSubtypeProd active A).symm pair) := by + apply Fintype.expect_equiv (Equiv.piEquivPiSubtypeProd active A) + intro u + rw [Equiv.symm_apply_apply] + _ = _ := by + simpa only [Finset.univ_product_univ] using + Finset.expect_product' + (Finset.univ : Finset (∀ i : {p // active p}, A i.val)) + (Finset.univ : Finset (∀ i : {p // ¬active p}, A i.val)) + (fun a s => f ((Equiv.piEquivPiSubtypeProd active A).symm (a, s))) + +theorem uniformDependentFinSubtype_expect + {P : Type*} [Fintype P] [DecidableEq P] + (active : P → Prop) [DecidablePred active] + (L : P → ℕ) (f : (∀ p, Fin (L p)) → ℂ) : + (𝔼 u : ∀ p, Fin (L p), f u) = + 𝔼 a : ∀ i : {p // active p}, Fin (L i.val), + 𝔼 s : ∀ i : {p // ¬active p}, Fin (L i.val), + f ((Equiv.piEquivPiSubtypeProd active (fun p => Fin (L p))).symm (a, s)) := + uniformDependentSubtype_expect active (fun p => Fin (L p)) f + +namespace FiniteProbabilityWeights + +theorem uniform_complexMean_dependent_subtype + {P : Type*} [Fintype P] [DecidableEq P] + (active : P → Prop) [DecidablePred active] + (A : P → Type*) [∀ p, Fintype (A p)] [∀ p, Nonempty (A p)] + (f : (∀ p, A p) → ℂ) : + (uniform (∀ p, A p)).complexMean f = + (uniform (∀ i : {p // active p}, A i.val)).complexMean (fun a => + (uniform (∀ i : {p // ¬active p}, A i.val)).complexMean (fun s => + f ((Equiv.piEquivPiSubtypeProd active A).symm (a, s)))) := by + simp only [uniform_complexMean] + exact uniformDependentSubtype_expect active A f + +end FiniteProbabilityWeights +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UniformDependentSumCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UniformDependentSumCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..65d6127deae04d4c3f8bdc0eec3c1934ac3a2d7b --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UniformDependentSumCoordinates.lean @@ -0,0 +1,61 @@ +import OAI.Combinatorics.Progressions.Probability.FiniteConditionedMass + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem uniformDependentSum_expect + {G P : Type*} [Fintype G] [Fintype P] [DecidableEq G] [DecidableEq P] + (A : G ⊕ P → Type*) [∀ k, Fintype (A k)] (f : (∀ k, A k) → ℂ) : + (𝔼 u : ∀ k, A k, f u) = + 𝔼 g : ∀ i, A (Sum.inl i), 𝔼 p : ∀ j, A (Sum.inr j), f (Sum.rec g p) := by + calc + _ = 𝔼 gp : (∀ i, A (Sum.inl i)) × (∀ j, A (Sum.inr j)), f (Sum.rec gp.1 gp.2) := by + apply Fintype.expect_equiv (Equiv.sumPiEquivProdPi A) + intro u + congr 1 + funext k + cases k <;> rfl + _ = _ := by + simpa only [Finset.univ_product_univ] using + Finset.expect_product' (Finset.univ : Finset (∀ i, A (Sum.inl i))) + (Finset.univ : Finset (∀ j, A (Sum.inr j))) + (fun g p => f (Sum.rec g p)) + +theorem uniformDependentFin_expect + {G P : Type*} [Fintype G] [Fintype P] [DecidableEq G] [DecidableEq P] + (L : G ⊕ P → ℕ) (f : (∀ k, Fin (L k)) → ℂ) : + (𝔼 u : ∀ k, Fin (L k), f u) = + 𝔼 g : ∀ i, Fin (L (Sum.inl i)), 𝔼 p : ∀ j, Fin (L (Sum.inr j)), f (Sum.rec g p) := + uniformDependentSum_expect (fun k => Fin (L k)) f + +namespace FiniteProbabilityWeights + +theorem uniform_complexMean_dependent_sum + {G P : Type*} [Fintype G] [Fintype P] [DecidableEq G] [DecidableEq P] + (A : G ⊕ P → Type*) [∀ k, Fintype (A k)] [∀ k, Nonempty (A k)] + (f : (∀ k, A k) → ℂ) : + (uniform (∀ k, A k)).complexMean f = + (uniform (∀ i, A (Sum.inl i))).complexMean (fun g => + (uniform (∀ j, A (Sum.inr j))).complexMean (fun p => f (Sum.rec g p))) := by + simp only [uniform_complexMean] + exact uniformDependentSum_expect A f + +theorem uniform_complexMean_dependent_fin_sum + {G P : Type*} [Fintype G] [Fintype P] [DecidableEq G] [DecidableEq P] + (L : G ⊕ P → ℕ) [∀ k, NeZero (L k)] (f : (∀ k, Fin (L k)) → ℂ) : + (uniform (∀ k, Fin (L k))).complexMean f = + (uniform (∀ i, Fin (L (Sum.inl i)))).complexMean (fun g => + (uniform (∀ j, Fin (L (Sum.inr j)))).complexMean (fun p => f (Sum.rec g p))) := + uniform_complexMean_dependent_sum (fun k => Fin (L k)) f + +end FiniteProbabilityWeights +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UniformSumCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UniformSumCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e0ee2c350a8c9ac609c5181f542ca56fc6b68ef --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UniformSumCoordinates.lean @@ -0,0 +1,78 @@ +import OAI.Combinatorics.Progressions.Probability.FiniteConditionedMass + +namespace OAI + +section + +namespace Erdos3.FiniteProbabilityWeights + +open scoped BigOperators Classical + +theorem uniform_complexMean_sum_elim + {A B R : Type*} [Fintype A] [Fintype B] [Fintype R] [Nonempty R] + (f : ((A ⊕ B) → R) → ℂ) : + (uniform (A → R)).complexMean (fun a => + (uniform (B → R)).complexMean (fun b => f (Sum.elim a b))) = + (uniform ((A ⊕ B) → R)).complexMean f := by + simp only [uniform_complexMean] + calc + _ = 𝔼 p : (A → R) × (B → R), f (Sum.elim p.1 p.2) := by + simpa only [Finset.univ_product_univ] using + (Finset.expect_product' (Finset.univ : Finset (A → R)) + (Finset.univ : Finset (B → R)) (fun a b => f (Sum.elim a b))).symm + _ = _ := by + apply Fintype.expect_equiv (Equiv.sumPiEquivProdPi (fun _ : A ⊕ B => R)).symm + intro p + rfl + +theorem uniform_complexMean_sum_elim_retained + {A B R Ω : Type*} [Fintype A] [Fintype B] [Fintype R] [Nonempty R] [Fintype Ω] + (p : FiniteProbabilityWeights Ω) (f : Ω → ((A ⊕ B) → R) → ℂ) : + (uniform (A → R)).complexMean (fun a => p.complexMean (fun ω => + (uniform (B → R)).complexMean (fun b => f ω (Sum.elim a b)))) = + p.complexMean (fun ω => (uniform ((A ⊕ B) → R)).complexMean (f ω)) := by + calc + _ = p.complexMean (fun ω => (uniform (A → R)).complexMean (fun a => + (uniform (B → R)).complexMean (fun b => f ω (Sum.elim a b)))) := by + simp only [uniform_complexMean] + exact (p.complexMean_average (fun a ω => 𝔼 b : B → R, f ω (Sum.elim a b))).symm + _ = _ := by + congr 1 + funext ω + exact uniform_complexMean_sum_elim (f ω) + +theorem uniform_complexMean_sum_elim_flip + {A B R : Type*} [Fintype A] [Fintype B] [Fintype R] [Nonempty R] + (f : ((A ⊕ B) → R) → ℂ) : + (uniform (B → R)).complexMean (fun b => + (uniform (A → R)).complexMean (fun a => f (Sum.elim a b))) = + (uniform ((A ⊕ B) → R)).complexMean f := by + calc + _ = (uniform (A → R)).complexMean (fun a => + (uniform (B → R)).complexMean (fun b => f (Sum.elim a b))) := by + simp only [uniform_complexMean] + exact Finset.expect_comm _ _ _ + _ = _ := uniform_complexMean_sum_elim f + +theorem uniform_complexMean_sum_elim_retained_flip + {A B R Ω : Type*} [Fintype A] [Fintype B] [Fintype R] [Nonempty R] [Fintype Ω] + (p : FiniteProbabilityWeights Ω) (f : Ω → ((A ⊕ B) → R) → ℂ) : + (uniform (B → R)).complexMean (fun b => + (uniform (A → R)).complexMean (fun a => p.complexMean (fun ω => + f ω (Sum.elim a b)))) = + p.complexMean (fun ω => (uniform ((A ⊕ B) → R)).complexMean (f ω)) := by + calc + _ = p.complexMean (fun ω => (uniform (B → R)).complexMean (fun b => + (uniform (A → R)).complexMean (fun a => f ω (Sum.elim a b)))) := by + simp only [uniform_complexMean] + simp_rw [← p.complexMean_average] + _ = _ := by + congr 1 + funext ω + exact uniform_complexMean_sum_elim_flip (f ω) + +end Erdos3.FiniteProbabilityWeights + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UnitBoxAmplitude.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UnitBoxAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..e551757cbcd5cbb32890eea5404dd611631e6875 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UnitBoxAmplitude.lean @@ -0,0 +1,105 @@ +import OAI.Combinatorics.Progressions.Estimates.InverseSqrtMoment + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] + +def positiveUnitBox (ι : Type*) := Set.univ.pi (fun _ : ι => Set.Ioc (0 : ℝ) 1) + +theorem positiveUnitBox_measurable : MeasurableSet (positiveUnitBox ι) := + MeasurableSet.univ_pi (fun _ => measurableSet_Ioc) + +noncomputable def unitBoxMeasure (ι : Type*) [Fintype ι] : Measure (ι → ℝ) := + volume.restrict (positiveUnitBox ι) + +instance unitBoxMeasure_probability : IsProbabilityMeasure (unitBoxMeasure ι) := by + constructor + simp only [unitBoxMeasure, Measure.restrict_apply_univ, positiveUnitBox, Real.volume_pi_Ioc, + sub_zero, ENNReal.ofReal_one, Finset.prod_const_one] + +theorem unitBoxMeasure_ae : ∀ᵐ x ∂unitBoxMeasure ι, ∀ i, x i ∈ Set.Ioc (0 : ℝ) 1 := by + filter_upwards [ae_restrict_mem (μ := volume) (positiveUnitBox_measurable (ι := ι))] with x hx + exact fun i => hx i (Set.mem_univ i) + +theorem unitBoxInverseSqrt_indicator : unitBoxInverseSqrt (ι := ι) = + (positiveUnitBox ι).indicator (fun x => (Real.sqrt (∏ i, x i))⁻¹) := by + funext x + by_cases hx : x ∈ positiveUnitBox ι + · rw [Set.indicator_of_mem hx] + exact unitBoxInverseSqrt_eq x (fun i => hx i (Set.mem_univ i)) + · rw [Set.indicator_of_notMem hx] + have h : ¬ ∀ i, x i ∈ Set.Ioc (0 : ℝ) 1 := by + intro hall + exact hx (fun i _ => hall i) + push Not at h + obtain ⟨i, hi⟩ := h + apply Finset.prod_eq_zero (Finset.mem_univ i) + exact Set.indicator_of_notMem hi _ + +theorem unitBox_inverse_sqrt_integrable : + Integrable (fun x : ι → ℝ => (Real.sqrt (∏ i, x i))⁻¹) (unitBoxMeasure ι) := by + apply (integrable_indicator_iff positiveUnitBox_measurable).mp + rw [← unitBoxInverseSqrt_indicator] + exact unitBoxInverseSqrt_integrable + +theorem unitBox_inverse_sqrt_mass : + (∫ x : ι → ℝ, (Real.sqrt (∏ i, x i))⁻¹ ∂unitBoxMeasure ι) = 2 ^ Fintype.card ι := by + rw [unitBoxMeasure, ← integral_indicator positiveUnitBox_measurable, + ← unitBoxInverseSqrt_indicator] + exact unitBoxInverseSqrt_mass + +noncomputable def pairedAmplitude (p : (ι → ℝ) × (ι → ℝ)) : ℝ := + max (∏ i, p.1 i) (∏ i, p.2 i) + +theorem pairedAmplitude_continuous : Continuous (pairedAmplitude (ι := ι)) := by + unfold pairedAmplitude + fun_prop + +theorem pairedAmplitude_pos_ae : + ∀ᵐ p ∂(unitBoxMeasure ι).prod (unitBoxMeasure ι), 0 < pairedAmplitude p := by + filter_upwards [Measure.quasiMeasurePreserving_fst.ae (unitBoxMeasure_ae (ι := ι))] with p hp + exact lt_max_of_lt_left (Finset.prod_pos (fun i _ => (hp i).1)) + +theorem pairedAmplitude_inverse_bound : + ∀ᵐ p ∂(unitBoxMeasure ι).prod (unitBoxMeasure ι), + (pairedAmplitude p)⁻¹ ≤ (Real.sqrt (∏ i, p.1 i))⁻¹ * (Real.sqrt (∏ i, p.2 i))⁻¹ := by + filter_upwards [Measure.quasiMeasurePreserving_fst.ae (unitBoxMeasure_ae (ι := ι)), + Measure.quasiMeasurePreserving_snd.ae (unitBoxMeasure_ae (ι := ι))] with p hp hq + exact inverse_max_le_inverse_sqrt_product (Finset.prod_pos (fun i _ => (hp i).1)) + (Finset.prod_pos (fun i _ => (hq i).1)) + +theorem pairedAmplitude_inverse_integrable : + Integrable (fun p : (ι → ℝ) × (ι → ℝ) => (pairedAmplitude p)⁻¹) + ((unitBoxMeasure ι).prod (unitBoxMeasure ι)) := by + have hi := (unitBox_inverse_sqrt_integrable (ι := ι)).mul_prod + (unitBox_inverse_sqrt_integrable (ι := ι)) + apply hi.mono' pairedAmplitude_continuous.measurable.inv.aestronglyMeasurable + filter_upwards [pairedAmplitude_inverse_bound (ι := ι), pairedAmplitude_pos_ae (ι := ι)] with p hp hpos + change ‖(pairedAmplitude p)⁻¹‖ ≤ _ + rw [Real.norm_of_nonneg (inv_nonneg.mpr hpos.le)] + exact hp + +theorem pairedAmplitude_inverse_integral_le : + (∫ p : (ι → ℝ) × (ι → ℝ), (pairedAmplitude p)⁻¹ + ∂(unitBoxMeasure ι).prod (unitBoxMeasure ι)) ≤ 4 ^ Fintype.card ι := by + have hi := (unitBox_inverse_sqrt_integrable (ι := ι)).mul_prod + (unitBox_inverse_sqrt_integrable (ι := ι)) + have h := integral_mono_ae (pairedAmplitude_inverse_integrable (ι := ι)) hi + (pairedAmplitude_inverse_bound (ι := ι)) + rw [integral_prod_mul (fun x : ι → ℝ => (Real.sqrt (∏ i, x i))⁻¹) + (fun x : ι → ℝ => (Real.sqrt (∏ i, x i))⁻¹), unitBox_inverse_sqrt_mass, ← mul_pow] at h + norm_num only [show (2 : ℝ) * 2 = 4 by norm_num] at h + exact h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UnitBoxInteriorCutoff.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UnitBoxInteriorCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d54171d86af93d34ebdbe36f25221d6a7ce009c --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UnitBoxInteriorCutoff.lean @@ -0,0 +1,231 @@ +import OAI.Combinatorics.Progressions.Probability.FiniteArrayMeasure +import OAI.Combinatorics.Progressions.Probability.RestrictedComplexChartDensityComparison +import OAI.Combinatorics.Progressions.Probability.ScaledCubeProductMeasure + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory + +theorem unitBoxMeasure_reindex {I J : Type*} [Fintype I] [Fintype J] (e : I ≃ J) : + MeasurePreserving (MeasurableEquiv.piCongrLeft (fun _ : J => ℝ) e) + (unitBoxMeasure I) (unitBoxMeasure J) := by + simpa only [unitBoxMeasure_eq_pi] using + measurePreserving_piCongrLeft (fun _ : J => unitScalarMeasure) e + +theorem unitBoxMeasure_curry (I J : Type*) [Fintype I] [Fintype J] : + MeasurePreserving (MeasurableEquiv.curry I J ℝ) (unitBoxMeasure (I × J)) + (Measure.pi (fun _ : I => unitBoxMeasure J)) := by + simpa only [unitBoxMeasure_eq_pi, MeasurableEquiv.symm_symm] using + (finiteArray_uncurry_measurePreserving (fun (_ : I) (_ : J) => unitScalarMeasure)).symm + (MeasurableEquiv.curry I J ℝ).symm + +theorem unitBoxMeasure_option (I : Type*) [Fintype I] : + MeasurePreserving (MeasurableEquiv.piOptionEquivProd (fun _ : Option I => ℝ)) + (unitBoxMeasure (Option I)) ((unitBoxMeasure I).prod unitScalarMeasure) := by + have h : MeasurePreserving + (MeasurableEquiv.piOptionEquivProd (fun _ : Option I => ℝ)).symm + ((Measure.pi (fun _ : I => unitScalarMeasure)).prod unitScalarMeasure) + (Measure.pi (fun _ : Option I => unitScalarMeasure)) := + ⟨(MeasurableEquiv.piOptionEquivProd (fun _ : Option I => ℝ)).symm.measurable, + Measure.pi_map_piOptionEquivProd (fun _ : Option I => unitScalarMeasure)⟩ + simpa only [unitBoxMeasure_eq_pi, MeasurableEquiv.symm_symm] using + h.symm (MeasurableEquiv.piOptionEquivProd (fun _ : Option I => ℝ)).symm + +theorem unitBoxMeasure_sum (I J : Type*) [Fintype I] [Fintype J] : + MeasurePreserving (MeasurableEquiv.sumPiEquivProdPi (fun _ : I ⊕ J => ℝ)) + (unitBoxMeasure (I ⊕ J)) ((unitBoxMeasure I).prod (unitBoxMeasure J)) := by + simpa only [unitBoxMeasure_eq_pi] using + measurePreserving_sumPiEquivProdPi (fun _ : I ⊕ J => unitScalarMeasure) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped BigOperators ContDiff NNReal + +variable {ι : Type*} [Fintype ι] + +def unitBoxFace (j : Bool × ι) (x : ι → ℝ) : ℝ := + if j.1 then 1 - x j.2 else x j.2 + +theorem unitBoxFace_contDiff (j : Bool × ι) : ContDiff ℝ ∞ (unitBoxFace j) := by + rcases j with ⟨b, i⟩ + cases b + · change ContDiff ℝ ∞ (fun x : ι → ℝ => x i) + fun_prop + · change ContDiff ℝ ∞ (fun x : ι → ℝ => 1 - x i) + fun_prop + +theorem unitBoxFace_lipschitz (j : Bool × ι) : LipschitzWith 1 (unitBoxFace j) := by + rcases j with ⟨b, i⟩ + cases b + · exact LipschitzWith.eval i + · apply LipschitzWith.of_dist_le_mul + intro x y + simpa only [unitBoxFace, ↓reduceIte, NNReal.coe_one, one_mul, dist_sub_left] using + dist_le_pi_dist x y i + +noncomputable def unitBoxInteriorCutoff (r : ℝ) : (ι → ℝ) → ℝ := + inequalityBoundaryCutoff (fun _ : Bool × ι => r) unitBoxFace + +theorem unitBoxInteriorCutoff_range (r : ℝ) (x : ι → ℝ) : + unitBoxInteriorCutoff r x ∈ Set.Icc (0 : ℝ) 1 := + inequalityBoundaryCutoff_range _ _ _ + +theorem unitBoxInteriorCutoff_contDiff (r : ℝ) : ContDiff ℝ ∞ (unitBoxInteriorCutoff (ι := ι) r) := + inequalityBoundaryCutoff_smooth _ _ unitBoxFace_contDiff + +theorem unitBoxInteriorCutoff_tsupport {r : ℝ} (hr : 0 < r) + {x : ι → ℝ} (hx : x ∈ tsupport (unitBoxInteriorCutoff r)) : + ∀ i, r ≤ x i ∧ x i ≤ 1 - r := by + have h := inequalityBoundaryCutoff_tsupport_subset (fun _ : Bool × ι => r) + (fun _ => hr) unitBoxFace (fun j => (unitBoxFace_contDiff j).continuous) hx + intro i + have h0 : r ≤ x i := h (false, i) + have h1 : r ≤ 1 - x i := h (true, i) + exact ⟨h0, by linarith⟩ + +theorem unitBoxInteriorCutoff_support_box {r : ℝ} (hr : 0 < r) : + tsupport (unitBoxInteriorCutoff (ι := ι) r) ⊆ positiveUnitBox ι := by + intro x hx i _ + have hi := unitBoxInteriorCutoff_tsupport hr hx i + exact ⟨hr.trans_le hi.1, hi.2.trans (by linarith)⟩ + +theorem unitBoxInteriorCutoff_compact {r : ℝ} (hr : 0 < r) : + HasCompactSupport (unitBoxInteriorCutoff (ι := ι) r) := by + apply (isCompact_Icc : IsCompact (Set.Icc (fun _ : ι => r) (fun _ : ι => 1 - r))).of_isClosed_subset + (isClosed_tsupport _) + intro x hx + exact ⟨fun i => (unitBoxInteriorCutoff_tsupport hr hx i).1, + fun i => (unitBoxInteriorCutoff_tsupport hr hx i).2⟩ + +theorem unitBoxFace_strip {r : ℝ} (hr : 0 ≤ r) (j : Bool × ι) : + (unitBoxMeasure ι).real {x | unitBoxFace j x < r} ≤ r := by + rcases j with ⟨b, i⟩ + have he : (unitBoxMeasure ι).map (Function.eval i) = unitScalarMeasure := by + rw [unitBoxMeasure_eq_pi] + exact (measurePreserving_eval (fun _ : ι => unitScalarMeasure) i).map_eq + cases b + · change (unitBoxMeasure ι).real ((Function.eval i) ⁻¹' Set.Iio r) ≤ r + rw [← map_measureReal_apply (measurable_pi_apply i) measurableSet_Iio, he, + unitScalarMeasure, measureReal_restrict_apply measurableSet_Iio] + calc + _ ≤ volume.real (Set.Ioc (0 : ℝ) r) := measureReal_mono (by + intro t ht + exact ⟨ht.2.1, ht.1.le⟩) (by simp) + _ = r := by rw [Real.volume_real_Ioc_of_le hr]; ring + · let s := {t : ℝ | 1 - t < r} + have hs : MeasurableSet s := measurableSet_lt (measurable_const.sub measurable_id) measurable_const + change (unitBoxMeasure ι).real ((Function.eval i) ⁻¹' s) ≤ r + rw [← map_measureReal_apply (measurable_pi_apply i) hs, he, + unitScalarMeasure, measureReal_restrict_apply hs] + calc + _ ≤ volume.real (Set.Ioc (1 - r) 1) := measureReal_mono (by + intro t ht + have h : 1 - t < r := ht.1 + exact ⟨by linarith, ht.2.2⟩) (by simp) + _ = r := by rw [Real.volume_real_Ioc_of_le (by linarith : 1 - r ≤ 1)]; ring + +theorem unitBoxInteriorCutoff_loss {r : ℝ} (hr : 0 < r) : + (∫ x, 1 - unitBoxInteriorCutoff r x ∂unitBoxMeasure ι) ≤ 4 * Fintype.card ι * r := by + have h := inequalityBoundaryCutoff_integral_loss_le (unitBoxMeasure ι) + (fun _ : Bool × ι => r) (fun _ => hr) unitBoxFace + (fun j => (unitBoxFace_contDiff j).continuous.measurable) + apply h.trans + calc + _ ≤ ∑ _j : Bool × ι, 2 * r := Finset.sum_le_sum (fun j _ => unitBoxFace_strip (by positivity) j) + _ = _ := by simp [Fintype.card_prod]; ring + +theorem unitBoxInteriorCutoff_integral {r : ℝ} (hr : 0 < r) : + (∫ x : ι → ℝ, unitBoxInteriorCutoff r x) = + ∫ x, unitBoxInteriorCutoff r x ∂unitBoxMeasure ι := by + symm + apply setIntegral_eq_integral_of_forall_compl_eq_zero + intro x hx + exact image_eq_zero_of_notMem_tsupport (fun h => hx (unitBoxInteriorCutoff_support_box hr h)) + +theorem unitBoxInteriorCutoff_mass {r : ℝ} (hr : 0 < r) : + 1 - 4 * Fintype.card ι * r ≤ ∫ x : ι → ℝ, unitBoxInteriorCutoff r x := by + have hi := cutoff_integrable (unitBoxMeasure ι) (unitBoxInteriorCutoff r) + (unitBoxInteriorCutoff_contDiff r).continuous.measurable (unitBoxInteriorCutoff_range r) + have h := unitBoxInteriorCutoff_loss (ι := ι) hr + rw [integral_sub (integrable_const (1 : ℝ)) hi] at h + simp only [integral_const, probReal_univ, one_smul] at h + rw [unitBoxInteriorCutoff_integral hr] + linarith + +theorem unitBoxInteriorCutoff_density {r : ℝ} (hr : 0 < r) : + realDensityMeasure volume (unitBoxInteriorCutoff (ι := ι) r) = + realDensityMeasure (unitBoxMeasure ι) (unitBoxInteriorCutoff r) := by + have hi : (positiveUnitBox ι).indicator (unitBoxInteriorCutoff r) = unitBoxInteriorCutoff r := by + apply Set.indicator_eq_self.2 + intro x hx + exact unitBoxInteriorCutoff_support_box hr (subset_tsupport _ hx) + have h := realDensityMeasure_indicator volume (unitBoxInteriorCutoff r) + (positiveUnitBox_measurable (ι := ι)) + rw [hi] at h + exact h.trans (restrict_withDensity (positiveUnitBox_measurable (ι := ι)) _) + +theorem unitBoxInteriorCutoff_fderiv_bound (A : ℝ≥0) + (hA : LipschitzWith A Real.smoothTransition) {r : ℝ} (hr : 0 < r) (x : ι → ℝ) : + ‖fderiv ℝ (unitBoxInteriorCutoff r) x‖ ≤ 2 * Fintype.card ι * A / r := by + have h := inequalityBoundaryCutoff_fderiv_norm_le A hA + (fun _ : Bool × ι => r) (fun _ => hr) unitBoxFace unitBoxFace_contDiff x + apply h.trans + calc + _ ≤ ∑ _j : Bool × ι, (A : ℝ) / r := Finset.sum_le_sum (fun j _ => + mul_le_of_le_one_right (div_nonneg A.coe_nonneg hr.le) + (norm_fderiv_le_of_lipschitz ℝ (unitBoxFace_lipschitz j))) + _ = _ := by simp [Fintype.card_prod]; ring + +theorem unitBoxInteriorCutoff_directional_integral (A : ℝ≥0) + (hA : LipschitzWith A Real.smoothTransition) {r : ℝ} (hr : 0 < r) (v : ι → ℝ) : + (∫ x, |fderiv ℝ (unitBoxInteriorCutoff r) x v|) ≤ + (2 * Fintype.card ι * A / r) * ‖v‖ := by + let L : ℝ := 2 * Fintype.card ι * A / r + have hL : 0 ≤ L := by dsimp [L]; positivity + have hb (x : ι → ℝ) : |fderiv ℝ (unitBoxInteriorCutoff r) x v| ≤ L * ‖v‖ := by + exact ((fderiv ℝ (unitBoxInteriorCutoff r) x).le_opNorm v).trans + (mul_le_mul_of_nonneg_right (unitBoxInteriorCutoff_fderiv_bound A hA hr x) (norm_nonneg v)) + have hm : Measurable (fun x : ι → ℝ => |fderiv ℝ (unitBoxInteriorCutoff r) x v|) := + (((unitBoxInteriorCutoff_contDiff r).continuous_fderiv (by norm_num)).clm_apply + continuous_const).abs.measurable + have hi : Integrable (fun x : ι → ℝ => |fderiv ℝ (unitBoxInteriorCutoff r) x v|) + (unitBoxMeasure ι) := + (integrable_const (L * ‖v‖)).mono' hm.aestronglyMeasurable + (Filter.Eventually.of_forall (fun x => by simpa only [Real.norm_eq_abs, abs_abs] using hb x)) + have he : (∫ x, |fderiv ℝ (unitBoxInteriorCutoff r) x v|) = + ∫ x, |fderiv ℝ (unitBoxInteriorCutoff r) x v| ∂unitBoxMeasure ι := by + symm + apply setIntegral_eq_integral_of_forall_compl_eq_zero + intro x hx + rw [fderiv_of_notMem_tsupport ℝ (fun h => hx (unitBoxInteriorCutoff_support_box hr h))] + simp + rw [he] + have h := integral_mono hi (integrable_const (L * ‖v‖)) hb + simpa only [integral_const, probReal_univ, one_smul] using h + +theorem unitBoxInteriorCutoff_derivative_budget [DecidableEq ι] (A : ℝ≥0) + (hA : LipschitzWith A Real.smoothTransition) {r : ℝ} (hr : 0 < r) : + (∑ j : ι, ∫ x, |fderiv ℝ (unitBoxInteriorCutoff r) x (Pi.single j 1)|) ≤ + 2 * (Fintype.card ι : ℝ) ^ 2 * A / r := by + calc + _ ≤ ∑ _j : ι, 2 * Fintype.card ι * A / r := Finset.sum_le_sum (fun j _ => by + simpa only [Pi.norm_single, norm_one, mul_one] using + unitBoxInteriorCutoff_directional_integral A hA hr (Pi.single j 1)) + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/UnitIntervalBox.lean b/lean/OAI/Combinatorics/Progressions/Geometry/UnitIntervalBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..603a40f20a355b71a03c69ceb63349240cb452c8 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/UnitIntervalBox.lean @@ -0,0 +1,41 @@ +import OAI.Combinatorics.Progressions.Lattices.PhysicalSubboxResidueSlice + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +def scalarUnitEquiv (A : Type*) : A ≃ (Unit → A) where + toFun a _ := a + invFun f := f () + left_inv _ := rfl + right_inv f := by + funext u + cases u + rfl + +theorem unitIntervalBox_eq_image (a : ℤ) (len : ℕ) : + translatedIntegerBox (fun _ : Unit => a) (fun _ => len) = + (Finset.Ico a (a + len)).image (scalarUnitEquiv ℤ) := by + ext x + rw [mem_translatedIntegerBox, Finset.mem_image] + constructor + · intro hx + exact ⟨x (), Finset.mem_Ico.mpr (hx ()), (scalarUnitEquiv ℤ).apply_symm_apply x⟩ + · rintro ⟨n, hn, rfl⟩ u + exact Finset.mem_Ico.mp hn + +theorem unitIntervalBox_expect (a : ℤ) (len : ℕ) (f : (Unit → ℤ) → ℂ) : + (𝔼 x ∈ translatedIntegerBox (fun _ : Unit => a) (fun _ => len), f x) = + 𝔼 n ∈ Finset.Ico a (a + len), f (fun _ => n) := by + rw [unitIntervalBox_eq_image] + exact Finset.expect_image (scalarUnitEquiv ℤ).injective.injOn + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/VariableRoundedGraphCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/VariableRoundedGraphCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..01e0a975f33fc37a030b2d4fc27ebde3c8fdc214 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/VariableRoundedGraphCoordinates.lean @@ -0,0 +1,32 @@ +import Mathlib + +namespace OAI + +section + +namespace Erdos3.FreimanModel + +def variableRoundedGraphModuli {I : Type*} (N : ℕ) (M : I → ℕ) : Option I → ℕ + | none => N + | some i => M i + +def variableRoundedGraphCoordinateEquiv {I : Type*} (N : ℕ) (M : I → ℕ) : + (ZMod N × (∀ i, ZMod (M i))) ≃+ (∀ i : Option I, ZMod (variableRoundedGraphModuli N M i)) where + toFun x i := match i with + | none => x.1 + | some j => x.2 j + invFun x := (x none, fun i => x (some i)) + left_inv x := rfl + right_inv x := by funext i; cases i <;> rfl + map_add' x y := by funext i; cases i <;> rfl + +theorem variableRoundedGraphModuli_neZero {I : Type*} (N : ℕ) (M : I → ℕ) [NeZero N] [∀ i, NeZero (M i)] : + ∀ i : Option I, NeZero (variableRoundedGraphModuli N M i) := by + intro i + cases i <;> dsimp [variableRoundedGraphModuli] <;> infer_instance + +end Erdos3.FreimanModel + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/VectorSpatialPartitionBudget.lean b/lean/OAI/Combinatorics/Progressions/Geometry/VectorSpatialPartitionBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7818a8d5b1ed24cb77e167ee88ee3ced7b6ad97 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/VectorSpatialPartitionBudget.lean @@ -0,0 +1,69 @@ +import OAI.Combinatorics.Progressions.Dynamics.VectorSiteBudget + +namespace OAI + +section + +namespace Erdos3 + +theorem vectorSpatial_radius_inverse_budget (d : ℕ) {G C K ε P : ℝ} + (hG0 : 0 ≤ G) (hC0 : 0 ≤ C) (hK0 : 0 ≤ K) (hε : 0 < ε) (hP : 0 ≤ P) + (hG : G ≤ Real.exp P) (hC : C ≤ Real.exp P) (hK : K ≤ Real.exp P) + (hεi : ε⁻¹ ≤ Real.exp P) : + let S := (d + 1) * (2*P + 4) + d + 1 + 1 / spatialSiteRadius G K (vectorSpatialAccuracy d (2 + G*C) ε) ≤ Real.exp (3*S + 16) := by + have hGC : G*C ≤ Real.exp (2*P) := by + calc + _ ≤ Real.exp P * Real.exp P := mul_le_mul hG hC hC0 (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have he : 1 ≤ Real.exp (2*P) := Real.one_le_exp_iff.mpr (by positivity) + have hA : 2 + G*C ≤ Real.exp (2*P + 4) := by + calc + _ ≤ 3 * Real.exp (2*P) := by linarith + _ ≤ Real.exp 4 * Real.exp (2*P) := by + apply mul_le_mul_of_nonneg_right _ (Real.exp_nonneg _) + linarith [Real.add_one_le_exp (4 : ℝ)] + _ = _ := by rw [← Real.exp_add, add_comm] + have hP' : P ≤ 2*P + 4 := by linarith + have hδ := vectorSpatialAccuracy_inverse_le_exp d (by positivity) hε hA + (hεi.trans (Real.exp_le_exp.mpr hP')) + have hS : P ≤ (d + 1 : ℝ) * (2*P + 4) + d + 1 := by + nlinarith [Nat.cast_nonneg (α := ℝ) d] + have hS0 : 0 ≤ (d + 1 : ℝ) * (2*P + 4) + d + 1 := by positivity + exact spatialSiteRadius_inverse_le_exp hG0 hK0 + (vectorSpatialAccuracy_pos d (by positivity) hε) hS0 + (hG.trans (Real.exp_le_exp.mpr hS)) (hK.trans (Real.exp_le_exp.mpr hS)) + (by simpa only [one_div] using hδ) + +theorem vectorSpatial_partition_budget (d n : ℕ) {m G C K ε P : ℝ} + (hm0 : 0 ≤ m) (hG0 : 0 ≤ G) (hC0 : 0 ≤ C) (hK0 : 0 ≤ K) + (hε : 0 < ε) (hP : 0 ≤ P) (hm : m ≤ Real.exp P) (hG : G ≤ Real.exp P) + (hC : C ≤ Real.exp P) (hK : K ≤ Real.exp P) (hεi : ε⁻¹ ≤ Real.exp P) : + let R := 3*((d + 1)*(2*P + 4) + d + 1) + 16 + let r := spatialSiteRadius G K (vectorSpatialAccuracy d (2 + G*C) ε) + (intervalSiteCount 1 r : ℝ) ≤ Real.exp (2*R + 4) ∧ + d * ((2*(intervalSiteCount 1 r : ℝ) + 1) / r) ≤ Real.exp (3*R + 6 + d) ∧ + (m^n * (intervalSiteCount 1 r : ℝ)^n * (G*C))^d ≤ + Real.exp (d * ((3*R + 4)*n + 2*R)) := by + dsimp only + let R := 3*((d + 1 : ℝ)*(2*P + 4) + d + 1) + 16 + let r := spatialSiteRadius G K (vectorSpatialAccuracy d (2 + G*C) ε) + have hR : 0 ≤ R := by dsimp [R]; positivity + have hPR : P ≤ R := by dsimp [R]; nlinarith [Nat.cast_nonneg (α := ℝ) d] + have hr : 0 < r := spatialSiteRadius_pos hG0 hK0 + (vectorSpatialAccuracy_pos d (by positivity) hε) + have hri : 1 / r ≤ Real.exp R := vectorSpatial_radius_inverse_budget d hG0 hC0 hK0 hε hP hG hC hK hεi + have hone : 1 ≤ Real.exp R := Real.one_le_exp_iff.mpr hR + have hM := intervalSiteCount_le_exp zero_le_one hr hR hone hri + have hLip := intervalSiteLipschitz_le_exp zero_le_one hr hR hone hri + refine ⟨hM, vectorSiteLipschitz_le_exp d (by positivity) hLip, ?_⟩ + apply vectorSiteAllowance_le_exp d (by positivity) + exact siteCoefficientAllowance_le_exp n hm0 (Nat.cast_nonneg _) hG0 hC0 + (hm.trans (Real.exp_le_exp.mpr hPR)) hM + (hG.trans (Real.exp_le_exp.mpr hPR)) (hC.trans (Real.exp_le_exp.mpr hPR)) + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/WeightedBlockSupportScale.lean b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedBlockSupportScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..1dcc8e5980d8b6ff92a6cd2b8b34ac563a5acbf6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedBlockSupportScale.lean @@ -0,0 +1,78 @@ +import OAI.Combinatorics.Progressions.Fourier.IntegerSupportTorus +import OAI.Combinatorics.Progressions.Lattices.WeightedModerateIntegerSupport + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +noncomputable def blockJetScaleBound (q h b : ℕ) (A : ℝ) : ℝ := + b * 2 ^ h * ((q + 1 : ℕ) : ℝ) ^ h * A + +theorem blockJetScaleBound_nonneg (q h b : ℕ) {A : ℝ} (hA : 0 ≤ A) : + 0 ≤ blockJetScaleBound q h b A := by unfold blockJetScaleBound; positivity + +theorem weightedCubeJetBound_le_scale {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + {A K : ℝ} (hA : 0 ≤ A) (hK : 0 ≤ K) + (hvol : ∀ b, (∏ j, ((s b j).length : ℝ)) ≤ A * K) + (S : Finset I) (hS : S.card ≤ n + 1) : + (weightedCubeJetBound s S : ℝ) ≤ blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) A * K := by + classical + simp only [weightedCubeJetBound, Int.cast_sum, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, + Int.cast_prod, Int.cast_natCast, Finset.prod_mul_distrib, Finset.prod_const, + Finset.card_univ, Fintype.card_fin] + calc + _ ≤ ∑ _b : B, (2 : ℝ) ^ (n + 1) * ((Fintype.card I + 1 : ℕ) : ℝ) ^ (n + 1) * (A * K) := by + apply Finset.sum_le_sum + intro b _ + calc + _ ≤ (2 : ℝ) ^ S.card * (((Fintype.card I + 1 : ℕ) : ℝ) ^ (n + 1) * (A * K)) := by + gcongr + exact hvol b + _ ≤ _ := by + have hp := pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) hS + have hh := mul_le_mul_of_nonneg_right hp + (show 0 ≤ ((Fintype.card I + 1 : ℕ) : ℝ) ^ (n + 1) * (A * K) by positivity) + nlinarith only [hh] + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, blockJetScaleBound]; ring + +theorem weightedModerateJetBound_le_scale {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) + (s : B → Fin n → NormalizedScalarCubeSource I) (offset : B → ℤ) + {A K : ℝ} (hA : 0 ≤ A) (hK : 0 ≤ K) + (hvol : ∀ b, (|(offset b : ℝ)| + (c b).length) * (∏ j, ((s b j).length : ℝ)) ≤ A * K) + (S : Finset I) (hS : S.card ≤ n) : + (weightedModerateJetBound c s offset S : ℝ) ≤ + blockJetScaleBound (Fintype.card I) n (Fintype.card B) A * K := by + classical + simp only [weightedModerateJetBound, Int.cast_sum, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, + Int.cast_prod, Int.cast_natCast, Int.cast_add, Int.cast_abs, Finset.prod_mul_distrib, + Finset.prod_const, Finset.card_univ, Fintype.card_fin] + calc + _ = ∑ b : B, (2 : ℝ) ^ S.card * ((Fintype.card I + 1 : ℕ) : ℝ) ^ n * + ((|(offset b : ℝ)| + (c b).length) * (∏ j, ((s b j).length : ℝ))) := 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 _ + calc + _ ≤ (2 : ℝ) ^ S.card * ((Fintype.card I + 1 : ℕ) : ℝ) ^ n * (A * K) := by + exact mul_le_mul_of_nonneg_left (hvol b) (by positivity) + _ ≤ _ := by + have hp := pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) hS + have hh := mul_le_mul_of_nonneg_right hp + (show 0 ≤ ((Fintype.card I + 1 : ℕ) : ℝ) ^ n * (A * K) by positivity) + nlinarith only [hh] + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, blockJetScaleBound]; ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/WeightedCoordinateExtraction.lean b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedCoordinateExtraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cb23830b43767fa9d59c6c0b9b85b3fc83a45b6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedCoordinateExtraction.lean @@ -0,0 +1,296 @@ +import Mathlib.Algebra.Module.Submodule.Map +import OAI.Combinatorics.Progressions.Estimates.ReindexedDerivativePoints +import OAI.Combinatorics.Progressions.Lattices.FirstCoefficientLatticeCoordinates +import OAI.Combinatorics.Progressions.Lattices.UniformDerivativeLatticeExtraction + +namespace OAI + +section + +namespace Erdos3 + +structure CoordinateDerivativeSystem {σ : Type*} [Fintype σ] [DecidableEq σ] {m a : ℕ} + (ha : a ≤ m) + (T : σ → ℝ) (Y : (σ → ℝ) →ₗ[ℝ] (Fin m → ℝ)) + (A : (Fin m → ℝ) ≃ₗ[ℝ] (Fin m → ℝ)) (scale : Fin m → ℝ) (bound : ℝ) where + K : Submodule ℝ (Fin a → ℝ) + k : ℕ + heightBound : ℕ + height_le : (heightBound : ℝ) ≤ bound + basisMatrix : Matrix (Fin a) (Fin k) ℚ + basis_height : ∀ i j, RationalHeightLE (basisMatrix i j) heightBound + independent_rat : LinearIndependent ℚ basisMatrix.col + independent_real : LinearIndependent ℝ (basisMatrix.map (Rat.castHom ℝ)).col + span_eq : K = Submodule.span ℝ (Set.range (basisMatrix.map (Rat.castHom ℝ)).col) + rationalLift : K →ₗ[ℝ] (Fin m → ℝ) + geometricLift : K →ₗ[ℝ] (Fin m → ℝ) + factorization : geometricLift = A.toLinearMap.comp rationalLift + rational_horizontal : ∀ x i, rationalLift x (Fin.castLE ha i) = x.val i + geometric_horizontal : ∀ x i, geometricLift x (Fin.castLE ha i) = x.val i + norm_scaled : ∀ x, + ‖(EuclideanSpace.equiv (Fin m) ℝ).symm (fun j => scale j * geometricLift x j)‖ ≤ bound * ‖x‖ + liftDenominator : ℕ + liftDenominator_pos : 0 < liftDenominator + liftDenominator_le : (liftDenominator : ℝ) ≤ bound + rational_on_basis : ∀ j, ∃ x : K, + x.val = (basisMatrix.map (Rat.castHom ℝ)).col j ∧ rationalLift x ∈ realDenominatorGrid liftDenominator + derivativeDenominator : ℕ + derivativeDenominator_pos : 0 < derivativeDenominator + derivativeDenominator_le : (derivativeDenominator : ℝ) ≤ bound + slow : σ → Fin m → ℝ + rational : σ → Fin m → ℝ + horizontal : σ → K + derivative_eq : ∀ i, Y (Pi.basisFun ℝ σ i) = slow i + A (rational i) + geometricLift (horizontal i) + derivative_grid : ∀ i, rational i ∈ realDenominatorGrid derivativeDenominator + slow_bound : ∀ i, + ‖(EuclideanSpace.equiv (Fin m) ℝ).symm (fun j => scale j * slow i j)‖ ≤ bound / T i + +theorem coordinateDerivativeSystem_of_lifts + {σ E : Type*} [Fintype σ] [DecidableEq σ] [AddCommGroup E] [Module ℝ E] + {m a k H : ℕ} (T : σ → ℝ) (Y : (σ → ℝ) →ₗ[ℝ] (Fin m → ℝ)) + (A : (Fin m → ℝ) ≃ₗ[ℝ] (Fin m → ℝ)) (scale : Fin m → ℝ) + (P : E →ₗ[ℝ] (Fin a → ℝ)) (ha : a ≤ m) (N bound : ℝ) + (lifts : RationalHorizontalLift k P ha A scale N H) + (hN : N ≤ bound) (hH : (H : ℝ) ≤ bound) + (D : ℕ) (hD : 0 < D) (hDb : (D : ℝ) ≤ bound) + (hderiv : ∀ i, ∃ (s r : Fin m → ℝ) (q : LinearMap.range P), + Y (Pi.basisFun ℝ σ i) = s + A r + lifts.geometricLift q ∧ + r ∈ realDenominatorGrid D ∧ + ‖(EuclideanSpace.equiv (Fin m) ℝ).symm (fun j => scale j * s j)‖ ≤ bound / T i) : + Nonempty (CoordinateDerivativeSystem ha T Y A scale bound) := by + choose s r q heq hgrid hsmall using hderiv + exact ⟨{ + K := LinearMap.range P + k := k + heightBound := H + height_le := hH + basisMatrix := lifts.basisMatrix + basis_height := lifts.basis_height + independent_rat := lifts.independent_rat + independent_real := lifts.independent_real + span_eq := lifts.span_eq + rationalLift := lifts.rationalLift + geometricLift := lifts.geometricLift + factorization := lifts.factorization + rational_horizontal := lifts.rational_horizontal + geometric_horizontal := lifts.geometric_horizontal + norm_scaled := fun x => (lifts.norm_scaled x).trans (mul_le_mul_of_nonneg_right hN (norm_nonneg x)) + liftDenominator := lifts.denominator + liftDenominator_pos := lifts.denominator_pos + liftDenominator_le := (Nat.cast_le.mpr lifts.denominator_le).trans hH + rational_on_basis := lifts.rational_on_basis + derivativeDenominator := D + derivativeDenominator_pos := hD + derivativeDenominator_le := hDb + slow := s + rational := r + horizontal := q + derivative_eq := heq + derivative_grid := hgrid + slow_bound := hsmall + }⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module + +theorem transport_coordinate_derivative_system + {σ E H : Type*} [Fintype σ] [DecidableEq σ] + [AddCommGroup E] [Module ℝ E] [AddCommGroup H] [Module ℝ H] + {a d : ℕ} (ha : a ≤ d) (b : Basis (Fin d) ℝ E) + (η : (Fin a → ℝ) ≃ₗ[ℝ] H) (P : E →ₗ[ℝ] H) + (hP : ∀ x, η (fun i => b.equivFun x (Fin.castLE ha i)) = P x) + (T : σ → ℝ) (Y : (σ → ℝ) →ₗ[ℝ] E) (f : E ≃ₗ[ℝ] E) + (scale : Fin d → ℝ) (bound : ℝ) + (D : CoordinateDerivativeSystem ha T (b.equivFun.toLinearMap.comp Y) + (b.equivFun.symm.trans (f.trans b.equivFun)) scale bound) : + let K := D.K.map η.toLinearMap + K = Submodule.span ℝ (Set.range (fun j => η ((D.basisMatrix.map (Rat.castHom ℝ)).col j))) ∧ + ∃ R S : K →ₗ[ℝ] E, + S = f.toLinearMap.comp R ∧ + (∀ x, P (R x) = x.val) ∧ (∀ x, P (S x) = x.val) ∧ + (∀ x, ‖(EuclideanSpace.equiv (Fin d) ℝ).symm + (fun j => scale j * b.equivFun (S x) j)‖ ≤ bound * ‖η.symm x.val‖) ∧ + (∀ j, ∃ x : K, x.val = η ((D.basisMatrix.map (Rat.castHom ℝ)).col j) ∧ + b.equivFun (R x) ∈ realDenominatorGrid D.liftDenominator) ∧ + ∀ i, ∃ (s r : E) (k : K), + Y (Pi.basisFun ℝ σ i) = s + f r + S k ∧ + b.equivFun r ∈ realDenominatorGrid D.derivativeDenominator ∧ + ‖(EuclideanSpace.equiv (Fin d) ℝ).symm + (fun j => scale j * b.equivFun s j)‖ ≤ bound / T i := by + let K := D.K.map η.toLinearMap + let eK : D.K ≃ₗ[ℝ] K := η.submoduleMap D.K + let R : K →ₗ[ℝ] E := b.equivFun.symm.toLinearMap.comp + (D.rationalLift.comp eK.symm.toLinearMap) + let S : K →ₗ[ℝ] E := b.equivFun.symm.toLinearMap.comp + (D.geometricLift.comp eK.symm.toLinearMap) + have hR (x : K) : b.equivFun (R x) = D.rationalLift (eK.symm x) := + b.equivFun.apply_symm_apply _ + have hS (x : K) : b.equivFun (S x) = D.geometricLift (eK.symm x) := + b.equivFun.apply_symm_apply _ + have heK (x : K) : (eK.symm x).val = η.symm x.val := rfl + constructor + · rw [D.span_eq, Submodule.map_span] + congr 1 + ext x + constructor + · rintro ⟨_, ⟨j, rfl⟩, rfl⟩ + exact ⟨j, rfl⟩ + · rintro ⟨j, rfl⟩ + exact ⟨_, ⟨j, rfl⟩, rfl⟩ + refine ⟨R, S, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · apply LinearMap.ext + intro x + apply b.equivFun.injective + rw [hS, D.factorization] + change b.equivFun (f (b.equivFun.symm (D.rationalLift (eK.symm x)))) = + b.equivFun (f (R x)) + rfl + · intro x + rw [← hP, hR] + have h : (fun i => D.rationalLift (eK.symm x) (Fin.castLE ha i)) = + (eK.symm x).val := funext (D.rational_horizontal (eK.symm x)) + rw [h, heK, LinearEquiv.apply_symm_apply] + · intro x + rw [← hP, hS] + have h : (fun i => D.geometricLift (eK.symm x) (Fin.castLE ha i)) = + (eK.symm x).val := funext (D.geometric_horizontal (eK.symm x)) + rw [h, heK, LinearEquiv.apply_symm_apply] + · intro x + simp only [hS] + exact D.norm_scaled (eK.symm x) + · intro j + obtain ⟨x, hx, hgrid⟩ := D.rational_on_basis j + refine ⟨eK x, ?_, ?_⟩ + · change η x.val = _ + rw [hx] + · rw [hR, LinearEquiv.symm_apply_apply] + exact hgrid + · intro i + refine ⟨b.equivFun.symm (D.slow i), b.equivFun.symm (D.rational i), + eK (D.horizontal i), ?_, ?_, ?_⟩ + · apply b.equivFun.injective + simp only [map_add, LinearEquiv.apply_symm_apply, hS, LinearEquiv.symm_apply_apply] + exact D.derivative_eq i + · simpa only [LinearEquiv.apply_symm_apply] using D.derivative_grid i + · simpa only [LinearEquiv.apply_symm_apply] using D.slow_bound i + +end Erdos3 + +end + +section + +namespace Erdos3 + +theorem exists_uniform_coordinate_derivative_system + {σ : Type*} [Fintype σ] [DecidableEq σ] {m : ℕ} + (T : σ → ℝ) (hT : ∀ i, 1 ≤ T i) + (scale : Fin m → ℝ) (hscale : ∀ j, 1 ≤ scale j) + (Y : (σ → ℝ) →ₗ[ℝ] (Fin m → ℝ)) + (A : (Fin m → ℝ) ≃ₗ[ℝ] (Fin m → ℝ)) + (hA : ∀ i j, i < j → (LinearMap.toMatrix' A.toLinearMap) i j = 0) + (hdiag : ∀ i, (LinearMap.toMatrix' A.toLinearMap) i i = 1) + (l : ℕ) (hl : 0 < l) (R δ : ℝ) (hR : 1 ≤ R) (hδ : 0 < δ) + (H : Finset (σ → ℤ)) (r : (σ → ℤ) → Fin m → ℝ) + (hr : ∀ h ∈ H, r h ∈ realDenominatorGrid l) + (hnorm : ∀ h ∈ H, + ‖derivativeGridPoint T scale Y (LinearMap.toMatrix' A.toLinearMap) h (r h)‖ ≤ R) + (hdense : δ * ∏ i, T i ≤ (H.card : ℝ)) + (a : ℕ) (ha : a ≤ m) (Tmin : ℝ) + (hscalehor : ∀ j, j.val < a → scale j = 1) + (hblock : ∀ i j, i.val < a → j.val < a → + (LinearMap.toMatrix' A.toLinearMap) i j = (1 : Matrix (Fin m) (Fin m) ℝ) i j) + (hfar : ∀ i, a ≤ i.val → Tmin ≤ scale i) + (p : ℝ) (hp : 0 ≤ p) + (hdim : ((Fintype.card σ + Fintype.card (Fin m) : ℕ) : ℝ) ≤ p) + (hlcap : (l : ℝ) ≤ Real.exp p) (hRcap : R ≤ Real.exp p) + (hδcap : δ⁻¹ ≤ Real.exp p) + (hmin : Real.exp ((p + 2) ^ 3) < Tmin) (hside : ∀ i, Tmin ≤ T i) : + Nonempty (CoordinateDerivativeSystem ha T Y A scale (Real.exp ((p + 2) ^ 3))) := by + obtain ⟨lifts, hN, hheight, I, hI, hIcap, hdecomp⟩ := + euclideanDerivative_uniform_lattice_extraction T hT scale hscale Y A hA hdiag + l hl R δ hR hδ H r hr hnorm hdense a ha Tmin hscalehor hblock hfar + p hp hdim hlcap hRcap hδcap hmin hside + exact coordinateDerivativeSystem_of_lifts T Y A scale _ ha _ _ lifts hN hheight + (l * I) (Nat.mul_pos hl hI) hIcap hdecomp + +end Erdos3 + +end + +section + +namespace Erdos3.NilpotentLieFiltration + +open Module + +theorem firstCoefficient_coordinate_system + {σ ι E : Type*} [Fintype σ] [DecidableEq σ] [AddCommGroup E] [Module ℝ E] {d : ℕ} + (ω : ι → ℕ) (rows : Fin d → FirstCoefficientIndex (fun _ : σ => 1) ω) + (b : Basis (Fin d) ℝ E) (Y : (σ → ℝ) →ₗ[ℝ] E) (f : E ≃ₗ[ℝ] E) + (hf : ∀ i j, ω (rows i).val.2 ≤ ω (rows j).val.2 → + LinearMap.toMatrix b b f.toLinearMap i j = (1 : Matrix (Fin d) (Fin d) ℝ) i j) + (T : σ → ℝ) (hT : ∀ i, 1 ≤ T i) (l : ℕ) (hl : 0 < l) + (R δ : ℝ) (hR : 1 ≤ R) (hδ : 0 < δ) (H : Finset (σ → ℤ)) + (r : (σ → ℤ) → Fin d → ℝ) (hr : ∀ h ∈ H, r h ∈ realDenominatorGrid l) + (hnorm : ∀ h ∈ H, + ‖derivativeGridPoint T (fun i => monomialScale T (rows i).val.1) + (b.equivFun.toLinearMap.comp Y) (LinearMap.toMatrix b b f.toLinearMap) h (r h)‖ ≤ R) + (hdense : δ * ∏ i, T i ≤ (H.card : ℝ)) + (p : ℝ) (hp : 0 ≤ p) + (hdim : ((Fintype.card σ + Fintype.card (Fin d) : ℕ) : ℝ) ≤ p) + (hlcap : (l : ℝ) ≤ Real.exp p) (hRcap : R ≤ Real.exp p) (hδcap : δ⁻¹ ≤ Real.exp p) + (Tmin : ℝ) (hmin : Real.exp ((p + 2) ^ 3) < Tmin) (hside : ∀ i, Tmin ≤ T i) : + ∃ (e : Equiv.Perm (Fin d)) (a : ℕ) (ha : a ≤ d), + (∀ i, i.val < a ↔ (rows (e i)).val.1 = 0) ∧ + let b' := b.reindex e.symm + let Y' := b'.equivFun.toLinearMap.comp Y + let A' := b'.equivFun.symm.trans (f.trans b'.equivFun) + Nonempty (CoordinateDerivativeSystem ha T Y' A' + (fun i => monomialScale T (rows (e i)).val.1) (Real.exp ((p + 2) ^ 3))) := by + obtain ⟨e, a, ha, hzero, haction⟩ := exists_lattice_ready_firstCoefficient_basis ω rows b + obtain ⟨htri, hdiag, hblock⟩ := haction f hf + let b' := b.reindex e.symm + let Y' := b'.equivFun.toLinearMap.comp Y + let A' := b'.equivFun.symm.trans (f.trans b'.equivFun) + let scale := fun i => monomialScale T (rows (e i)).val.1 + let r' := fun h => r h ∘ e + have hY : Y' = (LinearMap.funLeft ℝ ℝ e).comp (b.equivFun.toLinearMap.comp Y) := by + apply LinearMap.ext + intro x + funext i + exact congrFun (basis_reindex_equivFun b e (Y x)) i + have hA : LinearMap.toMatrix' A'.toLinearMap = + (LinearMap.toMatrix b b f.toLinearMap).submatrix e e := by + rw [basis_coordinate_linearEquiv_matrix] + ext i j + exact basis_reindex_toMatrix b e f.toLinearMap i j + have hscale : ∀ i, 1 ≤ scale i := fun i => one_le_monomialScale T hT _ + have hTmin : 1 ≤ Tmin := (Real.one_le_exp (by positivity)).trans hmin.le + obtain ⟨hhor, hfar⟩ := sorted_firstCoefficient_scale_bounds ω (rows ∘ e) hzero T Tmin hTmin hside + have hr' : ∀ h ∈ H, r' h ∈ realDenominatorGrid l := + fun h hh => realDenominatorGrid_comp l (r h) (hr h hh) e + have hnorm' : ∀ h ∈ H, ‖derivativeGridPoint T scale Y' (LinearMap.toMatrix' A'.toLinearMap) + h (r' h)‖ ≤ R := by + intro h hh + rw [hY, hA] + exact (derivativeGridPoint_reindex_norm T (fun i => monomialScale T (rows i).val.1) + (b.equivFun.toLinearMap.comp Y) (LinearMap.toMatrix b b f.toLinearMap) e h (r h)).le.trans + (hnorm h hh) + refine ⟨e, a, ha, hzero, ?_⟩ + exact exists_uniform_coordinate_derivative_system T hT scale hscale Y' A' htri hdiag + l hl R δ hR hδ H r' hr' hnorm' hdense a ha Tmin hhor hblock hfar + p hp hdim hlcap hRcap hδcap hmin hside + +end Erdos3.NilpotentLieFiltration + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/WeightedSubstitutionSupport.lean b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedSubstitutionSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0492df534a769d754d2a27d43be3a8f6834e157 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedSubstitutionSupport.lean @@ -0,0 +1,21 @@ +import OAI.Combinatorics.Progressions.Polynomial.MixedWeightedPolynomialRename + +namespace OAI + +section + +namespace Erdos3 + +theorem aeval_monomial_weightedSupport {σ τ R : Type*} [CommRing R] + (f : σ → MvPolynomial τ R) (w : σ → ℕ) (v : τ → ℕ) + (hf : ∀ i, f i ∈ weightedSupportLE v (w i)) (α : σ →₀ ℕ) + {β : τ →₀ ℕ} + (hβ : β ∈ (MvPolynomial.aeval (R := R) f (MvPolynomial.monomial α 1)).support) : + Finsupp.weight v β ≤ Finsupp.weight w α := + weightedSupportLE_aeval_monomial w v f hf α 1 hβ + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/WeightedSupportDropRename.lean b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedSupportDropRename.lean new file mode 100644 index 0000000000000000000000000000000000000000..3dd785873913bb90a32cd8bf92bbfa5aee64c4b2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedSupportDropRename.lean @@ -0,0 +1,107 @@ +import Mathlib.Algebra.MvPolynomial.Rename +import OAI.Combinatorics.Progressions.Estimates.WeightedLoweringGroup + +namespace OAI + + +namespace Erdos3 + +open MvPolynomial + +variable {σ R : Type*} [CommRing R] + +noncomputable def weightedSupportDrop (w : σ → ℕ) (n r : ℕ) : Submodule R (MvPolynomial σ R) := + MvPolynomial.restrictSupport R {a | Finsupp.weight w a + r ≤ n} + +theorem mem_weightedSupportDrop_iff (w : σ → ℕ) (n r : ℕ) (P : MvPolynomial σ R) : + P ∈ weightedSupportDrop w n r ↔ ∀ a ∈ P.support, Finsupp.weight w a + r ≤ n := Iff.rfl + +theorem weightedSupportDrop_zero (w : σ → ℕ) (n : ℕ) : + weightedSupportDrop (R := R) w n 0 = weightedSupportLE w n := by + ext P + simp only [mem_weightedSupportDrop_iff, Nat.add_zero] + rfl + +theorem weightedSupportDrop_one (w : σ → ℕ) (n : ℕ) : + weightedSupportDrop (R := R) w n 1 = weightedSupportLT w n := by + ext P + simp only [mem_weightedSupportDrop_iff, Nat.add_one_le_iff] + rfl + +theorem weightedSupportDrop_mono {w : σ → ℕ} {n m r : ℕ} {P : MvPolynomial σ R} + (hnm : n ≤ m) (hP : P ∈ weightedSupportDrop w n r) : P ∈ weightedSupportDrop w m r := + fun _ ha => (hP ha).trans hnm + +theorem weightedSupportDrop_antitone {w : σ → ℕ} {n r s : ℕ} {P : MvPolynomial σ R} + (hrs : r ≤ s) (hP : P ∈ weightedSupportDrop w n s) : P ∈ weightedSupportDrop w n r := by + intro a ha + change Finsupp.weight w a + r ≤ n + exact (Nat.add_le_add_left hrs _).trans (hP ha) + +theorem weightedSupportDrop_le {w : σ → ℕ} {n r : ℕ} {P : MvPolynomial σ R} + (hP : P ∈ weightedSupportDrop w n r) : P ∈ weightedSupportLE w n := by + rw [← weightedSupportDrop_zero] + exact weightedSupportDrop_antitone (Nat.zero_le _) hP + +theorem weightedSupportDrop_eq_zero {w : σ → ℕ} {n r : ℕ} {P : MvPolynomial σ R} + (hnr : n < r) (hP : P ∈ weightedSupportDrop w n r) : P = 0 := by + apply MvPolynomial.eq_zero_iff.mpr + intro a + by_contra ha + have h : Finsupp.weight w a + r ≤ n := hP (MvPolynomial.mem_support_iff.mpr ha) + omega + +theorem weightedSupportDrop_mul {w : σ → ℕ} {d e r s : ℕ} {P Q : MvPolynomial σ R} + (hP : P ∈ weightedSupportDrop w d r) (hQ : Q ∈ weightedSupportDrop w e s) : + P * Q ∈ weightedSupportDrop w (d + e) (r + s) := by + classical + intro a ha + obtain ⟨b, hb, c, hc, rfl⟩ := Finset.mem_add.mp (MvPolynomial.support_mul P Q ha) + have h1 : Finsupp.weight w b + r ≤ d := hP hb + have h2 : Finsupp.weight w c + s ≤ e := hQ hc + change Finsupp.weight w (b + c) + (r + s) ≤ d + e + rw [map_add] + omega + +theorem weightedSupportDrop_mul_LE {w : σ → ℕ} {d e r : ℕ} {P Q : MvPolynomial σ R} + (hP : P ∈ weightedSupportDrop w d r) (hQ : Q ∈ weightedSupportLE w e) : + P * Q ∈ weightedSupportDrop w (d + e) r := by + rw [← weightedSupportDrop_zero] at hQ + simpa only [Nat.add_zero] using weightedSupportDrop_mul hP hQ + +theorem weightedSupportLE_mul_drop {w : σ → ℕ} {d e r : ℕ} {P Q : MvPolynomial σ R} + (hP : P ∈ weightedSupportLE w d) (hQ : Q ∈ weightedSupportDrop w e r) : + P * Q ∈ weightedSupportDrop w (d + e) r := by + rw [mul_comm, Nat.add_comm d e] + exact weightedSupportDrop_mul_LE hQ hP + +end Erdos3 + + +namespace Erdos3 + +open MvPolynomial + +variable {σ τ R : Type*} [CommRing R] + +theorem weightedSupportDrop_rename {w : σ → ℕ} {v : τ → ℕ} + (f : σ → τ) (hf : ∀ i, v (f i) = w i) + {n r : ℕ} {P : MvPolynomial σ R} + (hP : P ∈ weightedSupportDrop w n r) : + rename f P ∈ weightedSupportDrop v n r := by + classical + intro a ha + obtain ⟨b, hb, rfl⟩ := Finset.mem_image.mp (Finsupp.mapDomain_support ha) + have hweight : Finsupp.weight v (Finsupp.mapDomain f b) = Finsupp.weight w b := by + change Finsupp.linearCombination ℕ v (Finsupp.mapDomain f b) = + Finsupp.linearCombination ℕ w b + rw [Finsupp.linearCombination_mapDomain] + congr 2 + exact funext hf + change Finsupp.weight v (Finsupp.mapDomain f b) + r ≤ n + rw [hweight] + exact hP hb + +end Erdos3 + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/WeightedTranslationBufferedCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedTranslationBufferedCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..d89aedf06793b5571fe6b5ecc0a03e4a1b1fee37 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedTranslationBufferedCoordinates.lean @@ -0,0 +1,372 @@ +import OAI.Combinatorics.Progressions.Estimates.BufferedTranslationIncrement + +namespace OAI + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial + +variable {σ : Type*} [Fintype σ] + +theorem weightedShearEmbedding_coordinate_row (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (a : PolynomialShearIndex (shearWeight w d)) : + (∀ x, (polynomialShearBasis (R := ℚ) (shearWeight w d)).repr + (weightedShearEmbedding w d x) a = 0) ∨ + ∃ i : WeightedBasisIndex w d, ∀ x, + (polynomialShearBasis (R := ℚ) (shearWeight w d)).repr + (weightedShearEmbedding w d x) a = (weightedBasis w d hw).repr x i := by + classical + rcases a with ⟨i, a, ha⟩ + cases i with + | inl i => + by_cases ha0 : a = 0 + · right + refine ⟨Sum.inl i, fun x => ?_⟩ + rw [polynomialShearBasis_repr, weightedBasis_repr_inl] + change (shearDerivation x.val (X (Sum.inl i))).coeff a = _ + rw [shearDerivation_X_inl, ha0] + simp + · left + intro x + rw [polynomialShearBasis_repr] + change (shearDerivation x.val (X (Sum.inl i))).coeff a = 0 + rw [shearDerivation_X_inl] + simp [MvPolynomial.coeff_C, Ne.symm ha0] + | inr u => + by_cases hb : ∃ b : σ →₀ ℕ, b.mapDomain Sum.inl = a + · obtain ⟨b, rfl⟩ := hb + have hweight : Finsupp.weight (shearWeight w d) (b.mapDomain Sum.inl) = + Finsupp.weight w b := by + change Finsupp.linearCombination ℕ (shearWeight w d) (b.mapDomain Sum.inl) = + Finsupp.linearCombination ℕ w b + rw [Finsupp.linearCombination_mapDomain] + rfl + have hb : Finsupp.weight w b < d := by + change Finsupp.weight (shearWeight w d) (b.mapDomain Sum.inl) + 1 ≤ d at ha + rw [hweight] at ha + omega + right + refine ⟨Sum.inr ⟨b, hb⟩, fun x => ?_⟩ + rw [polynomialShearBasis_repr, weightedBasis_repr_inr] + change (shearDerivation x.val (X (Sum.inr u))).coeff (b.mapDomain Sum.inl) = _ + rw [shearDerivation_X_inr, coeff_rename_mapDomain Sum.inl Sum.inl_injective] + · left + intro x + rw [polynomialShearBasis_repr] + change (shearDerivation x.val (X (Sum.inr u))).coeff a = 0 + rw [shearDerivation_X_inr] + apply coeff_rename_eq_zero + intro b hba + exact (hb ⟨b, hba⟩).elim + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +variable {ι κ L M : Type*} [LieRing L] [LieAlgebra ℚ L] [LieRing M] [LieAlgebra ℚ M] + +theorem realificationLieHom_repr_zero (e : Basis κ ℚ M) (φ : L →ₗ⁅ℚ⁆ M) + (k : κ) (h : ∀ x, e.repr (φ x) k = 0) (x : ℝ ⊗[ℚ] L) : + (e.baseChange ℝ).repr (realificationLieHom φ x) k = 0 := by + induction x using TensorProduct.inductionOn with + | tmul r x => simp only [realificationLieHom_tmul, Basis.baseChange_repr_tmul, h, zero_smul] + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy, add_zero] + +theorem realificationLieHom_repr_coordinate (e : Basis ι ℚ L) (f : Basis κ ℚ M) + (φ : L →ₗ⁅ℚ⁆ M) (k : κ) (i : ι) + (h : ∀ x, f.repr (φ x) k = e.repr x i) (x : ℝ ⊗[ℚ] L) : + (f.baseChange ℝ).repr (realificationLieHom φ x) k = (e.baseChange ℝ).repr x i := by + induction x using TensorProduct.inductionOn with + | tmul r x => simp only [realificationLieHom_tmul, Basis.baseChange_repr_tmul, h] + | add x y hx hy => simp only [map_add, Finsupp.add_apply, hx, hy] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open Module +open scoped TensorProduct + +namespace PolynomialTranslationLie + +variable {σ : Type*} [Fintype σ] + +theorem realShearEmbedding_repr (w : σ → ℕ) (d : ℕ) + (x : ℝ ⊗[ℚ] weightedSubalgebra w d) (a : PolynomialShearIndex (shearWeight w d)) : + (polynomialShearBasis (R := ℝ) (shearWeight w d)).repr (realShearEmbedding w d x) a = + ((polynomialShearBasis (R := ℚ) (shearWeight w d)).baseChange ℝ).repr + (realificationLieHom (weightedShearEmbedding w d) x) a := by + exact congrArg (fun c => c a) (polynomialShearRealificationEquiv_repr (shearWeight w d) + (realificationLieHom (weightedShearEmbedding w d) x)) + +theorem realShearEmbedding_coordinate_row (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (a : PolynomialShearIndex (shearWeight w d)) : + (∀ x, (polynomialShearBasis (R := ℝ) (shearWeight w d)).repr + (realShearEmbedding w d x) a = 0) ∨ + ∃ i : WeightedBasisIndex w d, ∀ x, + (polynomialShearBasis (R := ℝ) (shearWeight w d)).repr + (realShearEmbedding w d x) a = ((weightedBasis w d hw).baseChange ℝ).repr x i := by + rcases weightedShearEmbedding_coordinate_row w d hw a with hzero | ⟨i, hi⟩ + · left + intro x + rw [realShearEmbedding_repr] + exact realificationLieHom_repr_zero (polynomialShearBasis (shearWeight w d)) + (weightedShearEmbedding w d) a hzero x + · right + refine ⟨i, fun x => ?_⟩ + rw [realShearEmbedding_repr] + exact realificationLieHom_repr_coordinate (weightedBasis w d hw) + (polynomialShearBasis (shearWeight w d)) (weightedShearEmbedding w d) a i hi x + +theorem realShearEmbedding_coordinate_abs_le (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (x : ℝ ⊗[ℚ] weightedSubalgebra w d) + {δ : ℝ} (hδ : 0 ≤ δ) + (hx : ∀ i, |((weightedBasis w d hw).baseChange ℝ).repr x i| ≤ δ) + (a : PolynomialShearIndex (shearWeight w d)) : + |(polynomialShearBasis (R := ℝ) (shearWeight w d)).repr (realShearEmbedding w d x) a| ≤ + δ := by + rcases realShearEmbedding_coordinate_row w d hw a with hzero | ⟨i, hi⟩ + · simpa only [hzero x, abs_zero] using hδ + · rw [hi x] + exact hx i + +theorem realShearEmbedding_coefficient_abs_le (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (x : ℝ ⊗[ℚ] weightedSubalgebra w d) + {δ : ℝ} (hδ : 0 ≤ δ) + (hx : ∀ i, |((weightedBasis w d hw).baseChange ℝ).repr x i| ≤ δ) + (i : σ ⊕ Unit) (a : (σ ⊕ Unit) →₀ ℕ) : + |((realShearEmbedding w d x).val (MvPolynomial.X i)).coeff a| ≤ δ := by + by_cases ha : Finsupp.weight (shearWeight w d) a + 1 ≤ shearWeight w d i + · exact realShearEmbedding_coordinate_abs_le w d hw x hδ hx ⟨i, a, ha⟩ + · have hz : ((realShearEmbedding w d x).val (MvPolynomial.X i)).coeff a = 0 := by + by_contra hne + exact ha ((realShearEmbedding w d x).property i (MvPolynomial.mem_support_iff.mpr hne)) + simpa only [hz, abs_zero] using hδ + +end PolynomialTranslationLie +end Erdos3 + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module NilpotentLieBCHGroup +open scoped NNReal TensorProduct + +variable {σ : Type*} [Fintype σ] + +theorem bchRealTranslation_inverse_action_X (w : σ → ℕ) (d : ℕ) + (hwd : ∀ i, w i ≤ d) (g : (weightedFiltration w d hwd).realification.Group) + (i : σ ⊕ Unit) : + (PolynomialTranslationGroupOver.actionMonoidHom (bchRealTranslationHom w d hwd g)).symm (X i) = + polynomialShearExp (-(realShearEmbedding w d g.coord)) (X i) := by + calc + _ = PolynomialTranslationGroupOver.actionMonoidHom + (bchRealTranslationHom w d hwd g⁻¹) (X i) := by + rw [map_inv, map_inv] + rfl + _ = (weightedShearRealGroupHom w d hwd g⁻¹).val (X i) := by + rw [bchRealTranslationHom_action] + _ = _ := by + change polynomialShearExp (realShearEmbedding w d g⁻¹.coord) (X i) = _ + rw [coord_inv, map_neg] + +theorem bchRealTranslation_bounds_of_shear_coordinates (w : σ → ℕ) (d : ℕ) + (hw : ∀ i, 0 < w i) (hd : 0 < d) (hwd : ∀ i, w i ≤ d) + (g : (weightedFiltration w d hwd).realification.Group) + {δ : ℝ} (hδ : 0 ≤ δ) (hδone : δ ≤ 1) + (hg : ∀ a, |(polynomialShearBasis (R := ℝ) (shearWeight w d)).repr + (realShearEmbedding w d g.coord) a| ≤ δ) : + let K := polynomialShearDisplacementBound d (Fintype.card (σ ⊕ Unit)) 1 + (∀ i, |(bchRealTranslationHom w d hwd g).base i| ≤ (K : ℝ) * δ) ∧ + ∀ x : σ → ℝ, (∀ i, |x i| ≤ 1) → + |eval x (bchRealTranslationHom w d hwd g).polynomial| ≤ (K : ℝ) * δ := by + let K := polynomialShearDisplacementBound d (Fintype.card (σ ⊕ Unit)) 1 + have hpos : ∀ i, 1 ≤ shearWeight w d i := by + intro i; cases i with + | inl i => exact hw i + | inr _ => exact hd + have hgn (a) : |(polynomialShearBasis (R := ℝ) (shearWeight w d)).repr + (-(realShearEmbedding w d g.coord)) a| ≤ δ := by + simpa only [map_neg, Finsupp.neg_apply, abs_neg] using hg a + have hpoint (x : σ → ℝ) (hx : ∀ i, |x i| ≤ 1) (i : σ ⊕ Unit) : + |eval (Sum.elim x (fun _ : Unit => (0 : ℝ))) + ((PolynomialTranslationGroupOver.actionMonoidHom + (bchRealTranslationHom w d hwd g)).symm (X i)) - + Sum.elim x (fun _ : Unit => (0 : ℝ)) i| ≤ (K : ℝ) * δ := by + rw [bchRealTranslation_inverse_action_X] + have hh := polynomialShearExp_X_displacement (-(realShearEmbedding w d g.coord)) + hpos (shearWeight_le w d hwd) hδ hδone le_rfl hgn + (Sum.elim x (fun _ : Unit => (0 : ℝ))) (by + intro j; cases j with + | inl j => exact hx j + | inr _ => simp) i + convert hh using 1 + · simp only [aeval_eq_eval] + · simp [K, polynomialShearDisplacementBound, mul_assoc, mul_left_comm, mul_comm] + constructor + · intro i + have hh := hpoint 0 (by simp) (Sum.inl i) + rw [PolynomialTranslationGroupOver.action_inverse_X_inl_eval] at hh + simpa [K] using hh + · intro x hx + have hh := hpoint x hx (Sum.inr ()) + rw [PolynomialTranslationGroupOver.action_inverse_X_inr_eval] at hh + simpa [K] using hh + +section Metric + +variable (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + [Fintype (WeightedBasisIndex w d)] + [TopologicalSpace (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [IsTopologicalAddGroup (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [ContinuousSMul ℝ (ℝ ⊗[ℚ] weightedSubalgebra w d)] + [T2Space (ℝ ⊗[ℚ] weightedSubalgebra w d)] + +theorem weightedBasis_real_log_coordinates_bound (hwd : ∀ i, w i ≤ d) + (g : (weightedFiltration w d hwd).realification.Group) : + letI := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + let C := bchLogMetricConstant d (Fintype.card (WeightedBasisIndex w d)) (2*d+1) 1 + (C : ℝ) * dist 1 g < 1 → + ∀ a, |((weightedBasis w d hw).baseChange ℝ).repr g.coord a| ≤ (C : ℝ) * dist 1 g := by + let := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + let C := bchLogMetricConstant d (Fintype.card (WeightedBasisIndex w d)) (2*d+1) 1 + dsimp only + intro hnear a + have hlog : ‖basisHomeomorph ((weightedOrderedBasis w d hw).baseChange ℝ) g‖ ≤ + (C : ℝ) * dist 1 g := by + have hh := norm_coordinates_le_of_near_one + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + (lieStructureConstants (weightedOrderedBasis w d hw)) + (fun i j k => (realLieBasis_structure (weightedOrderedBasis w d hw) i j k).symm) + (weightedOrderedBasis_structure_height w d hw) 1 le_rfl g + simp only [Fintype.card_fin, NNReal.coe_one] at hh + exact hh hnear + have hh := (norm_le_pi_norm + (basisHomeomorph ((weightedOrderedBasis w d hw).baseChange ℝ) g) + (weightedIndexOrder w d a)).trans hlog + have he : (weightedOrderedBasis w d hw).baseChange ℝ = + ((weightedBasis w d hw).baseChange ℝ).reindex (weightedIndexOrder w d) := by + ext j + simp only [weightedOrderedBasis, Basis.baseChange_apply, Basis.reindex_apply] + simpa only [basisHomeomorph_apply, Basis.equivFun_apply, Real.norm_eq_abs, + he, Basis.repr_reindex_apply, Equiv.symm_apply_apply] using hh + +noncomputable def weightedTranslationDisplacementConstant (d n m : ℕ) : ℝ := + 2 * ((polynomialShearDisplacementBound d (n+1) 1 : ℝ) + 1) * + ((bchLogMetricConstant d m (2*d+1) 1 : ℝ) + 1) + +theorem weightedTranslationDisplacementConstant_pos (d n m : ℕ) : + 0 < weightedTranslationDisplacementConstant d n m := by + unfold weightedTranslationDisplacementConstant + positivity + +theorem bchRealTranslation_bounds_near_one (hd : 0 < d) (hwd : ∀ i, w i ≤ d) + (g : (weightedFiltration w d hwd).realification.Group) : + letI := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + let C := weightedTranslationDisplacementConstant d (Fintype.card σ) + (Fintype.card (WeightedBasisIndex w d)) + dist 1 g ≤ 1 / C → + (∀ i, |(bchRealTranslationHom w d hwd g).base i| ≤ C * dist 1 g) ∧ + ∀ x : σ → ℝ, (∀ i, |x i| ≤ 1) → + |eval x (bchRealTranslationHom w d hwd g).polynomial| ≤ C * dist 1 g := by + let := rightMetricSpace + (hnil := (weightedFiltration w d hwd).realification.lowerCentralSeries_eq_bot) + ((weightedOrderedBasis w d hw).baseChange ℝ) + let K : ℝ := polynomialShearDisplacementBound d (Fintype.card σ + 1) 1 + let L : ℝ := bchLogMetricConstant d (Fintype.card (WeightedBasisIndex w d)) (2*d+1) 1 + let C := weightedTranslationDisplacementConstant d (Fintype.card σ) + (Fintype.card (WeightedBasisIndex w d)) + have hK : 0 ≤ K := NNReal.coe_nonneg _ + have hL : 0 ≤ L := NNReal.coe_nonneg _ + have hC : 0 < C := weightedTranslationDisplacementConstant_pos _ _ _ + have hCeq : C = 2 * (K+1) * (L+1) := rfl + have hLC : 2 * L ≤ C := by nlinarith [mul_nonneg hK hL] + have hKC : K * L ≤ C := by nlinarith [mul_nonneg hK hL] + dsimp only + intro hnear + have hdist : 0 ≤ dist 1 g := dist_nonneg + have hCd : C * dist 1 g ≤ 1 := by + have hh := (le_div_iff₀ hC).mp hnear + simpa only [mul_comm] using hh + have hlognear : L * dist 1 g < 1 := by + have hh := mul_le_mul_of_nonneg_right hLC hdist + nlinarith + have hcoords := weightedBasis_real_log_coordinates_bound w d hw hwd g hlognear + have hshear := realShearEmbedding_coordinate_abs_le w d hw g.coord + (mul_nonneg hL hdist) hcoords + have hbounds := bchRealTranslation_bounds_of_shear_coordinates w d hw hd hwd g + (mul_nonneg hL hdist) hlognear.le hshear + have hprod : K * (L * dist 1 g) ≤ C * dist 1 g := by + simpa only [mul_assoc] using mul_le_mul_of_nonneg_right hKC hdist + constructor + · intro i + apply le_trans ?_ hprod + simpa [K] using hbounds.1 i + · intro x hx + apply le_trans ?_ hprod + simpa [K] using hbounds.2 x hx + +end Metric + +end Erdos3.PolynomialTranslationLie + +end + +section + +namespace Erdos3.PolynomialTranslationLie + +open MvPolynomial Module +open scoped NNReal TensorProduct + +variable {m : ℕ} + +theorem buffered_translation_term_of_shear_coordinates + (w : Fin m → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) (hd : 0 < d) + (hwd : ∀ i, w i ≤ d) (Ψ : PatchKernel m) (D₀ : MvPolynomial (Fin m) ℝ) + {M : ℝ} (hdegree : D₀.totalDegree ≤ d) (hD : realPolynomialMass D₀ ≤ M) + (z g : (weightedFiltration w d hwd).realification.Group) + (β : Fin m → ℤ) {δ : ℝ} (hδ : 0 ≤ δ) (hδone : δ ≤ 1) + (hz : ∀ a, |(polynomialShearBasis (R := ℝ) (shearWeight w d)).repr + (realShearEmbedding w d z.coord) a| ≤ δ) + (hsmall : (polynomialShearDisplacementBound d (Fintype.card (Fin m ⊕ Unit)) 1 : ℝ) * δ ≤ 1 / 4) : + ‖bufferedTranslationTerm Ψ D₀ (bchRealTranslationHom w d hwd (z * g)) β - + bufferedTranslationTerm Ψ D₀ (bchRealTranslationHom w d hwd g) β‖ ≤ + (Ψ.lip + (2 * Real.pi) * (1 + M * m * d)) * + (polynomialShearDisplacementBound d (Fintype.card (Fin m ⊕ Unit)) 1 : ℝ) * δ := by + obtain ⟨hbase, heval⟩ := bchRealTranslation_bounds_of_shear_coordinates w d hw hd hwd + z hδ hδone hz + rw [map_mul] + have h := bufferedTranslationTerm_increment_bound Ψ D₀ + (bchRealTranslationHom w d hwd z) (bchRealTranslationHom w d hwd g) β + (mul_nonneg (NNReal.coe_nonneg _) hδ) hsmall hdegree hD hbase heval + exact h.trans_eq (by ring) + +end Erdos3.PolynomialTranslationLie + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Geometry/WeightedTranslationIntegralCoordinates.lean b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedTranslationIntegralCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ce57fc5c7c069638464b4950249d1f9d451772d --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Geometry/WeightedTranslationIntegralCoordinates.lean @@ -0,0 +1,134 @@ +import OAI.Combinatorics.Progressions.Linear.WeightedTranslationBasisHeight + +namespace OAI + +section + +namespace Erdos3 + +open MvPolynomial Module + +private theorem integral_C_iff {τ : Type*} (c : ℚ) : + (C c : MvPolynomial τ ℚ) ∈ integerCoefficientPolynomials τ ↔ + ∃ z : ℤ, c = (z : ℚ) := by + classical + constructor + · intro h + simpa [MvPolynomial.coeff_C] using + (mem_integerCoefficientPolynomials_iff _).mp h 0 + · rintro ⟨z, rfl⟩ + exact integerCoefficientPolynomials_C z + +private theorem integral_rename_iff {σ τ : Type*} (f : σ → τ) + (hf : Function.Injective f) (P : MvPolynomial σ ℚ) : + rename f P ∈ integerCoefficientPolynomials τ ↔ + P ∈ integerCoefficientPolynomials σ := by + constructor + · intro h + apply (mem_integerCoefficientPolynomials_iff _).mpr + intro a + simpa only [coeff_rename_mapDomain f hf] using + (mem_integerCoefficientPolynomials_iff _).mp h (a.mapDomain f) + · intro h + obtain ⟨Q, hQ⟩ := (mem_integerCoefficientPolynomials P).mp h + apply (mem_integerCoefficientPolynomials _).mpr + refine ⟨rename f Q, ?_⟩ + rw [MvPolynomial.map_rename, hQ] + +namespace PolynomialTranslationLie + +variable {σ : Type*} [Fintype σ] +variable (w : σ → ℕ) (d : ℕ) (hw : ∀ i, 0 < w i) + +theorem weightedShearEmbedding_integral_iff (x : weightedSubalgebra w d) : + (∀ i, (weightedShearEmbedding w d x).val (X i) ∈ + integerCoefficientPolynomials (σ ⊕ Unit)) ↔ + (∀ i, ∃ z : ℤ, x.val.base i = (z : ℚ)) ∧ + x.val.polynomial ∈ integerCoefficientPolynomials σ := by + have hgen (i : σ ⊕ Unit) : (weightedShearEmbedding w d x).val (X i) = + shearDerivation x.val (X i) := rfl + simp only [hgen] + constructor + · intro h + constructor + · intro i + exact (integral_C_iff (τ := σ ⊕ Unit) _).mp (by simpa only [shearDerivation_X_inl] using h (Sum.inl i)) + · exact (integral_rename_iff (Sum.inl : σ → σ ⊕ Unit) Sum.inl_injective _).mp (by + simpa only [shearDerivation_X_inr] using h (Sum.inr ())) + · rintro ⟨hb, hp⟩ i + cases i with + | inl i => + rw [shearDerivation_X_inl] + exact (integral_C_iff _).mpr (hb i) + | inr u => + rw [shearDerivation_X_inr] + exact (integral_rename_iff Sum.inl Sum.inl_injective _).mpr hp + +theorem weightedBasis_integral_iff (x : weightedSubalgebra w d) : + (∀ i, (weightedShearEmbedding w d x).val (X i) ∈ + integerCoefficientPolynomials (σ ⊕ Unit)) ↔ + ∀ a, ∃ z : ℤ, (weightedBasis w d hw).repr x a = (z : ℚ) := by + rw [weightedShearEmbedding_integral_iff] + constructor + · rintro ⟨hb, hp⟩ a + cases a with + | inl i => simpa only [weightedBasis_repr_inl] using hb i + | inr a => exact (mem_integerCoefficientPolynomials_iff _).mp hp a.val + · intro h + constructor + · intro i + simpa only [weightedBasis_repr_inl] using h (Sum.inl i) + · apply (mem_integerCoefficientPolynomials_iff _).mpr + intro a + by_cases ha : Finsupp.weight w a < d + · exact h (Sum.inr ⟨a, ha⟩) + · refine ⟨0, ?_⟩ + apply not_ne_iff.mp + intro hc + have hs := x.property.2 (MvPolynomial.mem_support_iff.mpr hc) + change Finsupp.weight w a + 1 ≤ d at hs + omega + +variable [Finite (WeightedBasisIndex w d)] + +theorem weightedBasis_integralVector_iff (x : weightedSubalgebra w d) : + (∀ i, (weightedShearEmbedding w d x).val (X i) ∈ + integerCoefficientPolynomials (σ ⊕ Unit)) ↔ + IntegralVector ((weightedBasis w d hw).equivFun x) := by + rw [weightedBasis_integral_iff w d hw] + constructor + · intro h + choose z hz using h + exact ⟨z, hz⟩ + · rintro ⟨z, hz⟩ a + exact ⟨z a, hz a⟩ + +theorem weightedBasis_denominatorGrid_iff (B : ℕ) (x : weightedSubalgebra w d) : + (weightedBasis w d hw).equivFun x ∈ denominatorGrid B ↔ + ∀ i, ((B : ℚ) • weightedShearEmbedding w d x).val (X i) ∈ + integerCoefficientPolynomials (σ ⊕ Unit) := by + change IntegralVector ((B : ℚ) • (weightedBasis w d hw).equivFun x) ↔ _ + rw [← map_smul] + simpa only [map_smul] using (weightedBasis_integralVector_iff w d hw ((B : ℚ) • x)).symm + +theorem weightedBasis_scaledGrid_normalize (B : ℕ) (hB : 0 < B) + (x : weightedSubalgebra w d) + (hx : (weightedBasis w d hw).equivFun x ∈ scaledIntegerGrid B) : + ∀ i, ((B : ℚ)⁻¹ • weightedShearEmbedding w d x).val (X i) ∈ + integerCoefficientPolynomials (σ ⊕ Unit) := by + obtain ⟨z, hz⟩ := hx + have hBq : (B : ℚ) ≠ 0 := Nat.cast_ne_zero.mpr hB.ne' + have hi : IntegralVector ((weightedBasis w d hw).equivFun ((B : ℚ)⁻¹ • x)) := by + refine ⟨z, ?_⟩ + have hv : (weightedBasis w d hw).equivFun ((B : ℚ)⁻¹ • x) = + fun i => (z i : ℚ) := by + rw [map_smul, hz, smul_smul, inv_mul_cancel₀ hBq, one_smul] + exact congrFun hv + simpa only [map_smul] using (weightedBasis_integralVector_iff w d hw _).mpr hi + +end PolynomialTranslationLie +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AbsoluteCRTWindow.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AbsoluteCRTWindow.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fb025590b105e81106ddfe59d7bc664be3a9cf7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AbsoluteCRTWindow.lean @@ -0,0 +1,315 @@ +import OAI.Combinatorics.Progressions.Dynamics.AbsoluteIncrementBudgets +import OAI.Combinatorics.Progressions.Dynamics.RepresentativeWindowBudget +import OAI.Combinatorics.Progressions.Estimates.PositiveWeightContradiction +import OAI.Combinatorics.Progressions.Fourier.FourierWeightedCounting +import OAI.Combinatorics.Progressions.Probability.DensityNormalization +import OAI.Combinatorics.Progressions.Sampling.PositiveScoreComparison + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem distinct_prime_moduli_coprime {J : Type*} (N : J → ℕ) + (hprime : ∀ j, (N j).Prime) (hinj : Function.Injective N) : + Pairwise (fun i j => Nat.Coprime (N i) (N j)) := by + intro i j hij + exact (Nat.coprime_primes (hprime i) (hprime j)).mpr (fun h => hij (hinj h)) + +theorem prime_product_unit_of_lt {J : Type*} [Fintype J] (N : J → ℕ) + (hprime : ∀ j, (N j).Prime) {a : ℕ} (ha : 0 < a) (hlt : ∀ j, a < N j) : + IsUnit (a : ZMod (∏ j, N j)) := by + apply (ZMod.isUnit_iff_coprime a _).mpr + apply Nat.coprime_fintype_prod_right_iff.mpr + intro j + exact ((hprime j).coprime_iff_not_dvd.mpr (Nat.not_dvd_of_pos_of_lt ha (hlt j))).symm + +theorem modulus_le_product {J : Type*} [Fintype J] (N : J → ℕ) + (hpos : ∀ j, 0 < N j) (j : J) : N j ≤ ∏ i, N i := + Finset.single_le_prod (fun i _ => hpos i) (Finset.mem_univ j) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_crt_counting_contradiction {J : Type*} [Fintype J] [Nonempty J] + (k : ℕ) (hk : 3 ≤ k) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ (N : J → ℕ) [∀ j, NeZero (N j)] [NeZero (∏ j, N j)] + (hN : Pairwise (fun i j => Nat.Coprime (N i) (N j))) {p : ℝ}, + 2 ≤ p → Odd (∏ j, N j) → Real.exp ((p + 2) ^ C) ≤ (∏ j, N j) → + (∀ j, 64 * k ≤ N j) → + (∀ m : ℕ, 1 ≤ m → m < k → IsUnit (m : ZMod (∏ j, N j))) → + ∀ f : ((j : J) → ZMod (N j)) → ℝ, + (∀ u, 0 ≤ f u ∧ f u ≤ Real.exp p) → + (𝔼 x : ZMod (∏ j, N j), f (ZMod.prodEquivPi N hN x)) = 1 → + IntegerVectorAPFree (residueBoxIntegerPoint N '' Function.support f) k → + ¬ CyclicNiltestUpperComparison.{0} (k - 2) (∏ j, N j) ((p + 2) ^ C) + (Real.exp (-((p + 2) ^ C))) (fun x => f (ZMod.prodEquivPi N hN x)) (fun _ => 1 + xi) := by + classical + let beta : ℝ := min 1 (1 / (2 * (128 * (k : ℝ)) ^ (Fintype.card J * 2))) + have hkR : (0 : ℝ) < k := by exact_mod_cast (show 0 < k by omega) + have hbeta : 0 < beta := lt_min (by norm_num) (by positivity) + have hbeta1 : beta ≤ 1 := min_le_left _ _ + let eta := beta / 8 + have heta : 0 < eta := by dsimp [eta]; positivity + obtain ⟨F, inst, frequency, c, happ⟩ := exists_crtProgressionWeight_fourier (J := J) k heta + let _ := inst + let L : ℝ := ∑ a, ‖c a‖ + have hL : 0 ≤ L := Finset.sum_nonneg (fun a _ => norm_nonneg _) + let epsilon := beta / (8 * (L + 1)) + have hepsilon : 0 < epsilon := by dsimp [epsilon]; positivity + have hL1 : L + 1 ≠ 0 := by linarith + have heq : (L + 1) * epsilon = beta / 8 := by dsimp [epsilon]; field_simp [hL1] + have hepsilon1 : epsilon ≤ 1 := by nlinarith [mul_nonneg hL hepsilon.le] + have hsmall : L * epsilon + eta * ((2 : ℝ) + 1) < beta := by dsimp [eta]; nlinarith + obtain ⟨C, hC, xi, hxi, hcount⟩ := exists_fourier_weighted_counting (k - 2) (by omega) hepsilon + refine ⟨C, hC, xi, hxi, ?_⟩ + intro N _ _ hN p hp hodd hlarge hsize hunit f hf hmean hfree hcompare + let mu : ZMod (∏ j, N j) → ℝ := fun x => f (ZMod.prodEquivPi N hN x) + let slopes : Fin k → ZMod (∏ j, N j) := fun i => i.val + have hsep (i j : Fin k) (hij : i ≠ j) : IsUnit (slopes i - slopes j) := + consecutive_slopes_unit hunit i j hij + have hcard : (Finset.univ : Finset (Fin k)).card ≤ k - 2 + 2 := by simp; omega + let G : (ZMod (∏ j, N j) × ZMod (∏ j, N j)) → ℝ := + fun z => ∏ i : Fin k, mu (z.1 + slopes i * z.2) + have hG0 (z) : 0 ≤ G z := Finset.prod_nonneg (fun i _ => (hf _).1) + have hconst := hcount hp hodd hlarge mu (fun x => hf _) hmean hcompare + slopes hsep Finset.univ hcard (fun _ : Unit => (1 : ℂ)) (fun _ => 1) + have hGclose : ‖(𝔼 z, (G z : ℂ)) - 1‖ ≤ epsilon := by + simpa [configurationFourierWeight, expect_prod_split, G, Complex.ofReal_prod] using hconst + have hGmean : (𝔼 z, G z) ≤ 2 := + (real_mean_le_of_complex_mean_close G hGclose).trans (by linarith) + let Psi : F → AddChar (ZMod (∏ j, N j) × ZMod (∏ j, N j)) ℂ := + fun a => crtConfigurationCharacter N hN (frequency a) + let H := configurationFourierWeight c Psi + have hH : ‖(𝔼 z, H z * (G z : ℂ)) - (𝔼 z, H z)‖ ≤ L * epsilon := by + have h := hcount hp hodd hlarge mu (fun x => hf _) hmean hcompare + slopes hsep Finset.univ hcard c Psi + simpa only [expect_prod_split, G, Complex.ofReal_prod, H, L] using h + apply positive_weight_counting_contradiction (crtProgressionWeight N hN k) G H hbeta + ((min_le_right _ _).trans (crtProgressionWeight_mean N hN (by omega) hsize)) + hG0 hGmean _ heta.le (happ N hN) hH hsmall + intro z + exact crtProgressionWeight_mul_prod_eq_zero N hN (by omega) f hfree z.1 z.2 + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_absolute_crt_score {J : Type*} [Fintype J] [DecidableEq J] [Nonempty J] + (k : ℕ) (hk : 3 ≤ k) : + ∃ Csc : ℕ, 2 ≤ Csc ∧ ∃ C : ℕ, 2 ≤ C ∧ Csc < C ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ (N : J → ℕ) [∀ j, NeZero (N j)] [NeZero (∏ j, N j)] + (hprime : ∀ j, (N j).Prime) (hinj : Function.Injective N) + (f : ((j : J) → ZMod (N j)) → ℝ) {alpha p : ℝ}, + 0 < alpha → 2 ≤ p → Real.log (1 / alpha) ≤ p → + (∀ j, Real.exp ((p + 2) ^ C) ≤ N j) → + (∀ u, 0 ≤ f u ∧ f u ≤ 1) → (𝔼 u, f u) = alpha → + IntegerVectorAPFree (residueBoxIntegerPoint N '' Function.support f) k → + let hN := distinct_prime_moduli_coprime N hprime hinj + ∃ T : ZMod (∏ j, N j) → ℝ, + PositiveCyclicNiltest.{0} (k - 2) (∏ j, N j) ((p + 2) ^ Csc) T ∧ + Real.exp (-((p + 2) ^ Csc)) ≤ + (𝔼 x, (f (ZMod.prodEquivPi N hN x) - (1 + xi) * alpha) * T x) ∧ + ((∏ j, N j : ℕ) : ℝ)⁻¹ ≤ + (𝔼 x, (f (ZMod.prodEquivPi N hN x) - (1 + xi) * alpha) * T x) / + (100 * (1 + xi)) := by + classical + obtain ⟨C0, hC0, xi, hxi, hcontra⟩ := exists_crt_counting_contradiction (J := J) k hk + let Csc := C0 + 1 + obtain ⟨C, hC, hstrict, hbudget⟩ := exists_absolute_side_budget Csc k (by omega) hxi + refine ⟨Csc, by dsimp [Csc]; omega, C, hC, hstrict, xi, hxi, ?_⟩ + intro N _ _ hprime hinj f alpha p halpha hp hlog hsize hf hmean hfree + let hN := distinct_prime_moduli_coprime N hprime hinj + let original : ZMod (∏ j, N j) → ℝ := fun x => f (ZMod.prodEquivPi N hN x) + let normalized : ((j : J) → ZMod (N j)) → ℝ := fun u => f u / alpha + have hlower := density_lower_bound_of_log_inverse halpha hlog + have hnumb := absolute_normalization_budget C0 hp halpha hlower + have hb := hbudget p hp + have hside (j) : 64 * k ≤ N j := by exact_mod_cast hb.2.1.trans (hsize j) + let j0 : J := Classical.choice inferInstance + have hprod : (N j0 : ℝ) ≤ (∏ j, N j : ℕ) := by + exact_mod_cast modulus_le_product N (fun j => (hprime j).pos) j0 + have hlarge : Real.exp ((p + 2) ^ C0) ≤ (∏ j, N j : ℕ) := + (Real.exp_le_exp.mpr (hnumb.1.trans hb.1)).trans ((hsize j0).trans hprod) + have hunit (a : ℕ) (ha : 1 ≤ a) (hak : a < k) : IsUnit (a : ZMod (∏ j, N j)) := by + apply prime_product_unit_of_lt N hprime ha + intro j + have hj := hside j + omega + have hodd : Odd (∏ j, N j) := Nat.coprime_two_left.mp + ((ZMod.isUnit_iff_coprime 2 _).mp (hunit 2 (by omega) (by omega))) + have horiginal : (𝔼 x, original x) = alpha := by + calc + _ = 𝔼 u, f u := Fintype.expect_equiv (ZMod.prodEquivPi N hN).toEquiv _ _ (fun _ => rfl) + _ = alpha := hmean + have hnormalized : (𝔼 x : ZMod (∏ j, N j), normalized (ZMod.prodEquivPi N hN x)) = 1 := + normalized_density_mean original halpha horiginal + have hnormfree : IntegerVectorAPFree (residueBoxIntegerPoint N '' Function.support normalized) k := by + dsimp only [normalized] + rw [support_normalized_density f halpha.ne'] + exact hfree + have hnot := hcontra N hN hp hodd hlarge hside hunit normalized + (normalized_density_bounds f halpha hlower hf) hnormalized hnormfree + have hnotScore : ¬ CyclicNiltestUpperComparison.{0} (k - 2) (∏ j, N j) + ((p + 2) ^ Csc) (Real.exp (-((p + 2) ^ Csc))) original (fun _ => (1 + xi) * alpha) := by + intro hcomp + have hn : CyclicNiltestUpperComparison.{0} (k - 2) (∏ j, N j) + ((p + 2) ^ Csc) (Real.exp (-((p + 2) ^ Csc)) / alpha) + (fun x => original x / alpha) (fun _ => 1 + xi) := + CyclicNiltestUpperComparison.normalize hcomp halpha + exact hnot (CyclicNiltestUpperComparison.mono_budget hn hnumb.1 hnumb.2) + obtain ⟨T, hT, hscore⟩ := exists_positive_score_of_not_upperComparison hnotScore + refine ⟨T, hT, hscore.le, ?_⟩ + have hbig : 100 * (1 + xi) * Real.exp ((p + 2) ^ Csc) ≤ (∏ j, N j : ℕ) := + hb.2.2.trans ((hsize j0).trans hprod) + have hM : 0 < 100 * (1 + xi) := by positivity + calc + _ = 1 / ((∏ j, N j : ℕ) : ℝ) := (one_div _).symm + _ ≤ 1 / (100 * (1 + xi) * Real.exp ((p + 2) ^ Csc)) := + one_div_le_one_div_of_le (mul_pos hM (Real.exp_pos _)) hbig + _ = Real.exp (-((p + 2) ^ Csc)) / (100 * (1 + xi)) := by + simp [Real.exp_neg, div_eq_mul_inv, mul_comm] + _ ≤ _ := div_le_div_of_nonneg_right hscore.le hM.le + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_absolute_crt_increment {J : Type*} [Fintype J] [DecidableEq J] [Nonempty J] + (k : ℕ) (hk : 3 ≤ k) : + ∃ C : ℕ, 2 ≤ C ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ (N : J → ℕ) [∀ j, NeZero (N j)] [NeZero (∏ j, N j)] + (hprime : ∀ j, (N j).Prime) (hinj : Function.Injective N) + (f : ((j : J) → ZMod (N j)) → ℝ) {alpha : ℝ}, + 0 < alpha → (∀ u, 0 ≤ f u ∧ f u ≤ 1) → (𝔼 u, f u) = alpha → + IntegerVectorAPFree (residueBoxIntegerPoint N '' Function.support f) k → + let p := max 2 (Real.log (1 / alpha)) + (∀ j, Real.exp ((p + 2) ^ C) ≤ N j) → + let hN := distinct_prime_moduli_coprime N hprime hinj + ∃ T : ZMod (∏ j, N j) → ℝ, + PositiveCyclicNiltest.{0} (k - 2) (∏ j, N j) ((p + 2) ^ C) T ∧ + (∀ x, 0 ≤ T x ∧ T x ≤ 1) ∧ + Real.exp (-((p + 2) ^ C)) ≤ + 𝔼 x, (f (ZMod.prodEquivPi N hN x) - (1 + xi) * alpha) * T x := by + obtain ⟨Csc, _, C, hC, hstrict, xi, hxi, hscore⟩ := exists_absolute_crt_score (J := J) k hk + refine ⟨C, hC, xi, hxi, ?_⟩ + intro N _ _ hprime hinj f alpha halpha hf hmean hfree p hsize + have hp : 2 ≤ p := le_max_left _ _ + have hlog : Real.log (1 / alpha) ≤ p := le_max_right _ _ + obtain ⟨T, hT, hs, _⟩ := hscore N hprime hinj f halpha hp hlog hsize hf hmean hfree + have hcost : (p + 2) ^ Csc ≤ (p + 2) ^ C := + pow_le_pow_right₀ (by linarith : 1 ≤ p + 2) hstrict.le + exact ⟨T, hT.mono le_rfl hcost, hT.unit_interval, + (Real.exp_le_exp.mpr (neg_le_neg hcost)).trans hs⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal + +theorem density_test_score_abs_le {f T alpha xi : ℝ} + (hf : 0 ≤ f ∧ f ≤ 1) (hT : 0 ≤ T ∧ T ≤ 1) + (halpha : 0 ≤ alpha ∧ alpha ≤ 1) (hxi : 0 ≤ xi) : + |(f - (1 + xi) * alpha) * T| ≤ 1 + xi := by + have hM : 0 ≤ 1 + xi := by positivity + have hc0 := mul_nonneg hM halpha.1 + have hc1 : (1 + xi) * alpha ≤ 1 + xi := + mul_le_of_le_one_right hM halpha.2 + have hdiff : |f - (1 + xi) * alpha| ≤ 1 + xi := abs_le.mpr ⟨by linarith, by linarith⟩ + rw [abs_mul, abs_of_nonneg hT.1] + exact (mul_le_mul_of_nonneg_right hdiff hT.1).trans (mul_le_of_le_one_right hM hT.2) + +theorem exists_absolute_crt_window {J : Type*} [Fintype J] [DecidableEq J] [Nonempty J] + (k : ℕ) (hk : 3 ≤ k) : + ∃ Csc : ℕ, 2 ≤ Csc ∧ ∃ C : ℕ, 2 ≤ C ∧ Csc < C ∧ + ∃ Cwindow : ℕ, 2 ≤ Cwindow ∧ ∃ xi : ℝ, 0 < xi ∧ + ∀ (N : J → ℕ) [∀ j, NeZero (N j)] [NeZero (∏ j, N j)] + (hprime : ∀ j, (N j).Prime) (hinj : Function.Injective N) + (f : ((j : J) → ZMod (N j)) → ℝ) {alpha p : ℝ}, + 0 < alpha → 2 ≤ p → Real.log (1 / alpha) ≤ p → + (∀ j, Real.exp ((p + 2) ^ C) ≤ N j) → + (∀ u, 0 ≤ f u ∧ f u ≤ 1) → (𝔼 u, f u) = alpha → + IntegerVectorAPFree (residueBoxIntegerPoint N '' Function.support f) k → + let hN := distinct_prime_moduli_coprime N hprime hinj + ∃ (T : ZMod (∏ j, N j) → ℝ) (w : RepresentativeWindow), + PositiveCyclicNiltest.{0} (k - 2) (∏ j, N j) ((p + 2) ^ Csc) T ∧ + Real.log (2 + (w.lip : ℝ)) ≤ (p + 2) ^ Cwindow ∧ + Real.exp (-((p + 2) ^ Cwindow)) ≤ + 𝔼 u : (j : J) → ZMod (N j), + ((f u - (1 + xi) * alpha) * T ((ZMod.prodEquivPi N hN).symm u)) * + (w.crtPatch N hN (k - 2) (by omega)).value (fun j => ((u j).val : ℝ)) := by + obtain ⟨Csc, hCsc, C, hC, hstrict, xi, hxi, habsolute⟩ := + exists_absolute_crt_score (J := J) k hk + obtain ⟨D, hD, hwindow⟩ := exists_polynomial_scored_crt_representative_patch + obtain ⟨a, ha⟩ := exists_nat_ge (Real.log (1 + xi)) + obtain ⟨Cwindow, hCwindow, hbudget⟩ := exists_natPolynomial_fixed_power_budget + (((Polynomial.X + 2) ^ Csc + Polynomial.C a + 2) ^ D) + refine ⟨Csc, hCsc, C, hC, hstrict, Cwindow, hCwindow, xi, hxi, ?_⟩ + intro N _ _ hprime hinj f alpha p halpha hp hlog hsize hf hmean hfree + let hN := distinct_prime_moduli_coprime N hprime hinj + obtain ⟨T, hT, hscore, hmod⟩ := habsolute N hprime hinj f halpha hp hlog hsize hf hmean hfree + let F : ZMod (∏ j, N j) → ℝ := + fun x => (f (ZMod.prodEquivPi N hN x) - (1 + xi) * alpha) * T x + let sigma : ℝ := 𝔼 x, F x + let q : ℝ := (p + 2) ^ Csc + a + have hp0 : 0 ≤ p := by linarith + have hpow0 : 0 ≤ (p + 2) ^ Csc := by positivity + have ha0 : (0 : ℝ) ≤ a := Nat.cast_nonneg _ + have hq : 0 ≤ q := add_nonneg hpow0 ha0 + have hM : 0 < 1 + xi := by positivity + have hMexp : 1 + xi ≤ Real.exp q := by + apply (Real.log_le_iff_le_exp hM).mp + exact ha.trans (by dsimp only [q]; linarith) + have hsig : Real.exp (-q) ≤ sigma := + (Real.exp_le_exp.mpr (show -q ≤ -((p + 2) ^ Csc) by dsimp only [q]; linarith)).trans hscore + have halpha1 : alpha ≤ 1 := by + rw [← hmean] + exact (Finset.expect_le_expect (fun u _ => (hf u).2)).trans_eq (Fintype.expect_const 1) + have hcap (x : ZMod (∏ j, N j)) : |F x| ≤ 1 + xi := + density_test_score_abs_le (hf _) (hT.unit_interval x) ⟨halpha.le, halpha1⟩ hxi.le + obtain ⟨w, hw, hws⟩ := hwindow N hN (k - 2) (by omega) F hq hM hMexp hsig + hcap le_rfl (by simpa only [one_div] using hmod) + have hb : (q + 2) ^ D ≤ (p + 2) ^ Cwindow := by + simpa [Polynomial.eval₂_pow, q] using hbudget p hp0 + refine ⟨T, w, hT, hw.trans hb, ?_⟩ + have hs := (Real.exp_le_exp.mpr (neg_le_neg hb)).trans hws + have he (u : (j : J) → ZMod (N j)) : + F ((ZMod.prodEquivPi N hN).symm u) = + (f u - (1 + xi) * alpha) * T ((ZMod.prodEquivPi N hN).symm u) := by + dsimp only [F] + rw [RingEquiv.apply_symm_apply] + simpa only [he] using hs + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialGoodPrimeDeletion.lean b/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialGoodPrimeDeletion.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d37cbdd5f2eab55c6d15829cacec333eee920d2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialGoodPrimeDeletion.lean @@ -0,0 +1,461 @@ +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import OAI.Combinatorics.Progressions.Lattices.InjectiveSmallPrimeProduct +import OAI.Combinatorics.Progressions.Probability.ActualFixedSpatialUnchargedDensity + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem retainedPrimeProduct_le_chargedProduct_mul_smallProduct + {L : Type*} [Fintype L] (p b e : L → ℕ) (cutoff : ℕ) + (hp : ∀ l, 1 ≤ p l) (retained : Finset L) + (hretained : ∀ l ∈ retained, b l ≠ 0 ∨ e l ≠ 0 ∨ p l ≤ cutoff) : + (∏ l ∈ retained, p l) ≤ + ((∏ l, p l ^ b l) * (∏ l, p l ^ e l)) * + ∏ l ∈ Finset.univ.filter (fun l => p l ≤ cutoff), p l := by + let w (l : L) := (p l ^ b l * p l ^ e l) * (if p l ≤ cutoff then p l else 1) + have hw (l : L) : 1 ≤ w l := by + dsimp only [w] + apply one_le_mul + · exact one_le_mul (one_le_pow₀ (hp l)) (one_le_pow₀ (hp l)) + · split_ifs + · exact hp l + · exact le_rfl + have hpoint (l : L) (hl : l ∈ retained) : p l ≤ w l := by + have hb1 : 1 ≤ p l ^ b l := one_le_pow₀ (hp l) + have he1 : 1 ≤ p l ^ e l := one_le_pow₀ (hp l) + dsimp only [w] + by_cases hsmall : p l ≤ cutoff + · simp only [hsmall, ite_true] + exact le_mul_of_one_le_left' (one_le_mul hb1 he1) + · simp only [hsmall, ite_false, mul_one] + rcases hretained l hl with hb | he | hs + · exact (le_self_pow (hp l) hb).trans (le_mul_of_one_le_right' he1) + · exact (le_self_pow (hp l) he).trans (le_mul_of_one_le_left' hb1) + · exact (hsmall hs).elim + calc + (∏ l ∈ retained, p l) ≤ ∏ l ∈ retained, w l := + Finset.prod_le_prod hpoint + _ ≤ ∏ l, w l := Finset.prod_le_prod_of_subset_of_one_le + (Finset.subset_univ _) (fun l _ _ => hw l) + _ = ((∏ l, p l ^ b l) * (∏ l, p l ^ e l)) * + ∏ l ∈ Finset.univ.filter (fun l => p l ≤ cutoff), p l := by + simp only [w, Finset.prod_mul_distrib, Finset.prod_filter] + +theorem retainedPrimePowerModulus_le_power_of_primeProduct + {L : Type*} [Fintype L] (p A : L → ℕ) (retained : Finset L) + (depth : ℕ) (hp : ∀ l, 1 ≤ p l) (hA : ∀ l ∈ retained, A l ≤ depth) : + (∏ l ∈ retained, p l ^ A l) ≤ (∏ l ∈ retained, p l) ^ depth := by + calc + (∏ l ∈ retained, p l ^ A l) ≤ ∏ l ∈ retained, p l ^ depth := + Finset.prod_le_prod (fun l hl => pow_le_pow_right' (hp l) (hA l hl)) + _ = (∏ l ∈ retained, p l) ^ depth := Finset.prod_pow _ _ _ + +theorem retainedPrimePowerModulus_le_charged_cutoff + {L : Type*} [Fintype L] (p A b e : L → ℕ) (cutoff depth : ℕ) + (hp : ∀ l, 1 ≤ p l) (hinj : Function.Injective p) + (retained : Finset L) + (hretained : ∀ l ∈ retained, b l ≠ 0 ∨ e l ≠ 0 ∨ p l ≤ cutoff) + (hA : ∀ l ∈ retained, A l ≤ depth) : + (∏ l ∈ retained, p l ^ A l) ≤ + ((∏ l, p l ^ b l) * (∏ l, p l ^ e l) * + (cutoff + 1) ^ (cutoff + 1)) ^ depth := by + have hprime : (∏ l ∈ retained, p l) ≤ + (∏ l, p l ^ b l) * (∏ l, p l ^ e l) * (cutoff + 1) ^ (cutoff + 1) := + (retainedPrimeProduct_le_chargedProduct_mul_smallProduct + p b e cutoff hp retained hretained).trans + (Nat.mul_le_mul_left _ (prod_filter_le_cutoff_pow_of_injective p hinj cutoff)) + exact (retainedPrimePowerModulus_le_power_of_primeProduct + p A retained depth hp hA).trans (pow_le_pow_left' hprime depth) + +theorem retainedPrimePowerModulus_filter_le_charged_cutoff + {L : Type*} [Fintype L] (p A b e : L → ℕ) (cutoff depth : ℕ) + (hp : ∀ l, 1 ≤ p l) (hinj : Function.Injective p) + (hA : ∀ l, A l ≤ depth) : + (∏ l ∈ Finset.univ.filter (fun l => b l ≠ 0 ∨ e l ≠ 0 ∨ p l ≤ cutoff), + p l ^ A l) ≤ + ((∏ l, p l ^ b l) * (∏ l, p l ^ e l) * + (cutoff + 1) ^ (cutoff + 1)) ^ depth := by + apply retainedPrimePowerModulus_le_charged_cutoff p A b e cutoff depth hp hinj + · intro l hl + exact (Finset.mem_filter.mp hl).2 + · intro l _ + exact hA l + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem retainedPrimePowerModulus_le_exp_charged_cutoff + {L : Type*} [Fintype L] (p A b e : L → ℕ) (cutoff depth : ℕ) + (hp : ∀ l, 1 ≤ p l) (hinj : Function.Injective p) + (retained : Finset L) + (hretained : ∀ l ∈ retained, b l ≠ 0 ∨ e l ≠ 0 ∨ p l ≤ cutoff) + (hA : ∀ l ∈ retained, A l ≤ depth) (Pbad Ppres : ℝ) + (hbad : ((∏ l, p l ^ b l : ℕ) : ℝ) ≤ Real.exp Pbad) + (hpres : ((∏ l, p l ^ e l : ℕ) : ℝ) ≤ Real.exp Ppres) : + ((∏ l ∈ retained, p l ^ A l : ℕ) : ℝ) ≤ + Real.exp ((depth : ℝ) * + (Pbad + Ppres + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1))) := by + have hcharged : + (((∏ l, p l ^ b l) * (∏ l, p l ^ e l) * + (cutoff + 1) ^ (cutoff + 1) : ℕ) : ℝ) ≤ + Real.exp (Pbad + Ppres + + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1)) := by + calc + _ = ((∏ l, p l ^ b l : ℕ) : ℝ) * ((∏ l, p l ^ e l : ℕ) : ℝ) * + ((cutoff + 1 : ℕ) : ℝ) ^ (cutoff + 1) := by norm_cast + _ ≤ Real.exp Pbad * Real.exp Ppres * + ((cutoff + 1 : ℕ) : ℝ) ^ (cutoff + 1) := + mul_le_mul_of_nonneg_right + (mul_le_mul hbad hpres (Nat.cast_nonneg _) (Real.exp_nonneg _)) + (by positivity) + _ = _ := by + rw [Real.exp_add, Real.exp_add, Real.exp_nat_mul, + Real.exp_log (by positivity)] + simp only [Nat.cast_add, Nat.cast_one] + have hnat := retainedPrimePowerModulus_le_charged_cutoff + p A b e cutoff depth hp hinj retained hretained hA + calc + _ ≤ (((∏ l, p l ^ b l) * (∏ l, p l ^ e l) * + (cutoff + 1) ^ (cutoff + 1) : ℕ) : ℝ) ^ depth := by + exact_mod_cast hnat + _ ≤ Real.exp (Pbad + Ppres + + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1)) ^ depth := + pow_le_pow_left₀ (Nat.cast_nonneg _) hcharged depth + _ = _ := (Real.exp_nat_mul _ depth).symm + +theorem retainedPrimePowerModulus_filter_le_exp_charged_cutoff + {L : Type*} [Fintype L] (p A b e : L → ℕ) (cutoff depth : ℕ) + (hp : ∀ l, 1 ≤ p l) (hinj : Function.Injective p) + (hA : ∀ l, A l ≤ depth) (Pbad Ppres : ℝ) + (hbad : ((∏ l, p l ^ b l : ℕ) : ℝ) ≤ Real.exp Pbad) + (hpres : ((∏ l, p l ^ e l : ℕ) : ℝ) ≤ Real.exp Ppres) : + ((∏ l ∈ Finset.univ.filter (fun l => b l ≠ 0 ∨ e l ≠ 0 ∨ p l ≤ cutoff), + p l ^ A l : ℕ) : ℝ) ≤ + Real.exp ((depth : ℝ) * + (Pbad + Ppres + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1))) := by + apply retainedPrimePowerModulus_le_exp_charged_cutoff + p A b e cutoff depth hp hinj _ _ _ Pbad Ppres hbad hpres + · intro l hl + exact (Finset.mem_filter.mp hl).2 + · intro l _ + exact hA l + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +theorem primePowerProduct_expBudget_nonneg + {L : Type*} [Fintype L] (p b : L → ℕ) (hp : ∀ l, 1 ≤ p l) + (P : ℝ) (hP : ((∏ l, p l ^ b l : ℕ) : ℝ) ≤ Real.exp P) : 0 ≤ P := by + have hnat : 1 ≤ ∏ l, p l ^ b l := + Finset.one_le_prod (fun l _ => one_le_pow₀ (hp l)) + have hreal : (1 : ℝ) ≤ ((∏ l, p l ^ b l : ℕ) : ℝ) := by exact_mod_cast hnat + exact Real.one_le_exp_iff.mp (hreal.trans hP) + +theorem retainedPrimePower_cutoff_logCost_nonneg (cutoff : ℕ) : + 0 ≤ ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1) := by + apply mul_nonneg (Nat.cast_nonneg _) + apply Real.log_nonneg + have hc : (0 : ℝ) ≤ cutoff := Nat.cast_nonneg cutoff + linarith + +theorem retainedPrimePowerModulus_le_exp_depthBudget + {L : Type*} [Fintype L] (p A b e : L → ℕ) (cutoff depth : ℕ) + (hp : ∀ l, 1 ≤ p l) (hinj : Function.Injective p) + (retained : Finset L) + (hretained : ∀ l ∈ retained, b l ≠ 0 ∨ e l ≠ 0 ∨ p l ≤ cutoff) + (hA : ∀ l ∈ retained, A l ≤ depth) (Pbad Ppres Pdepth : ℝ) + (hbad : ((∏ l, p l ^ b l : ℕ) : ℝ) ≤ Real.exp Pbad) + (hpres : ((∏ l, p l ^ e l : ℕ) : ℝ) ≤ Real.exp Ppres) + (hdepth : (depth : ℝ) ≤ Pdepth) : + ((∏ l ∈ retained, p l ^ A l : ℕ) : ℝ) ≤ + Real.exp (Pdepth * + (Pbad + Ppres + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1))) := by + have hcost : 0 ≤ Pbad + Ppres + + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1) := + add_nonneg (add_nonneg (primePowerProduct_expBudget_nonneg p b hp Pbad hbad) + (primePowerProduct_expBudget_nonneg p e hp Ppres hpres)) + (retainedPrimePower_cutoff_logCost_nonneg cutoff) + exact (retainedPrimePowerModulus_le_exp_charged_cutoff + p A b e cutoff depth hp hinj retained hretained hA Pbad Ppres hbad hpres).trans + (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right hdepth hcost)) + +theorem log_retainedPrimePowerModulus_le_depthBudget + {L : Type*} [Fintype L] (p A b e : L → ℕ) (cutoff depth : ℕ) + (hp : ∀ l, 1 ≤ p l) (hinj : Function.Injective p) + (retained : Finset L) + (hretained : ∀ l ∈ retained, b l ≠ 0 ∨ e l ≠ 0 ∨ p l ≤ cutoff) + (hA : ∀ l ∈ retained, A l ≤ depth) (Pbad Ppres Pdepth : ℝ) + (hbad : ((∏ l, p l ^ b l : ℕ) : ℝ) ≤ Real.exp Pbad) + (hpres : ((∏ l, p l ^ e l : ℕ) : ℝ) ≤ Real.exp Ppres) + (hdepth : (depth : ℝ) ≤ Pdepth) : + Real.log ((∏ l ∈ retained, p l ^ A l : ℕ) : ℝ) ≤ + Pdepth * (Pbad + Ppres + + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1)) := by + have hnat : 1 ≤ ∏ l ∈ retained, p l ^ A l := + Finset.one_le_prod (fun l _ => one_le_pow₀ (hp l)) + have hreal : (1 : ℝ) ≤ ((∏ l ∈ retained, p l ^ A l : ℕ) : ℝ) := by + exact_mod_cast hnat + apply (Real.log_le_iff_le_exp (zero_lt_one.trans_le hreal)).mpr + exact retainedPrimePowerModulus_le_exp_depthBudget + p A b e cutoff depth hp hinj retained hretained hA Pbad Ppres Pdepth hbad hpres hdepth + +theorem log_retainedPrimePowerModulus_filter_le_depthBudget + {L : Type*} [Fintype L] (p A b e : L → ℕ) (cutoff depth : ℕ) + (hp : ∀ l, 1 ≤ p l) (hinj : Function.Injective p) + (hA : ∀ l, A l ≤ depth) (Pbad Ppres Pdepth : ℝ) + (hbad : ((∏ l, p l ^ b l : ℕ) : ℝ) ≤ Real.exp Pbad) + (hpres : ((∏ l, p l ^ e l : ℕ) : ℝ) ≤ Real.exp Ppres) + (hdepth : (depth : ℝ) ≤ Pdepth) : + Real.log ((∏ l ∈ Finset.univ.filter + (fun l => b l ≠ 0 ∨ e l ≠ 0 ∨ p l ≤ cutoff), p l ^ A l : ℕ) : ℝ) ≤ + Pdepth * (Pbad + Ppres + + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1)) := by + apply log_retainedPrimePowerModulus_le_depthBudget + p A b e cutoff depth hp hinj _ _ _ Pbad Ppres Pdepth hbad hpres hdepth + · intro l hl + exact (Finset.mem_filter.mp hl).2 + · intro l _ + exact hA l + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial +open _root_.MvPolynomial _root_.OAI.MvPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice P Pbad Ppres : ℝ} + +namespace ActualFixedSpatialForecastPath + +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +local instance retainedReferencePrimeNeZero : ∀ p : path.primes, NeZero p.val := + path.primeNeZero + +local instance retainedReferenceModulusNeZero : NeZero path.referenceModulus := + ⟨path.referenceModulus_pos.ne'⟩ + +noncomputable def referenceRetainedPrimes (cutoff : ℕ) : Finset path.primes := + Finset.univ.filter (fun p => path.referenceBadDepth p.val ≠ 0 ∨ + path.prescribed p.val ≠ 0 ∨ p.val ≤ cutoff) + +omit [Fintype Tsp] in +theorem referenceRetainedPrimes_omitted (cutoff : ℕ) (p : path.primes) + (hp : p ∉ path.referenceRetainedPrimes cutoff) : + cutoff < p.val ∧ path.referenceBadDepth p.val = 0 ∧ path.prescribed p.val = 0 := by + simp only [referenceRetainedPrimes, Finset.mem_filter, Finset.mem_univ, true_and, + not_or, not_not] at hp + exact ⟨Nat.lt_of_not_ge hp.2.2, hp.1, hp.2.1⟩ + +noncomputable def referenceLocalDensity + (raw : PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) + (p : path.primes) : ℝ := + rationalOutputDensity + (FiniteProbabilityWeights.uniform + (LayerSamplerLongVariables (allocatedShortAxis (I := I) U b S.value) G B → + ZMod (p.val ^ path.exponent p.val))) + (localPrimePowerIntegerPolynomialOutput p.val (path.exponent p.val) (path.prescribed p.val) + (path.localReferencePolynomial raw) (path.origin p)) (p.val ^ path.exponent p.val) + (fun j => ZMod.castHom (Finset.dvd_prod_of_mem + (fun p : path.primes => p.val ^ path.exponent p.val) (Finset.mem_univ p)) + (ZMod (p.val ^ path.exponent p.val)) (β j)) + +omit [Fintype Tsp] in +theorem referenceLocalDensity_nonneg + (raw : PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) + (p : path.primes) : 0 ≤ path.referenceLocalDensity raw β p := + rationalOutputDensity_nonneg _ _ _ _ + +omit [Fintype Tsp] in + +theorem reference_rational_density_product + (raw : PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : + rationalOutputDensity path.referenceInputLaw + (integerLongPolynomialOutput path.referencePolynomial raw path.referenceModulus) + path.referenceModulus β = ∏ p : path.primes, path.referenceLocalDensity raw β p := by + dsimp only [referenceInputLaw, referenceLocalDensity, referencePolynomial, + localReferencePolynomial, referenceModulus] + have h := allocatedForecastPolynomial_rational_density_product + (allocatedShortAxis (I := I) U b S.value) path.noise (allocatedReadDeck path.read) + (fun j a => allocatedReadProjection path.read ⟨j, a.val⟩) + path.primes path.exponent path.prescribed path.prime path.base path.origin raw β + simp only [rationalOutputDensity, ← Nat.card_eq_fintype_card] at h ⊢ + exact h + +noncomputable def retainedReferenceForecast {Ω Z : Type*} [Fintype Ω] + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (cutoff : ℕ) (gridVolume : ℝ) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : ℝ := + gridVolume * inactive.fiberMean gridPoint z (fun i => + ∏ p ∈ path.referenceRetainedPrimes cutoff, path.referenceLocalDensity (raw i) β p) + +omit [Fintype Tsp] in +theorem reference_inactive_density_product {Ω Z : Type*} [Fintype Ω] + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (gridVolume : ℝ) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : + rationalInactiveForecast inactive (fun _ => path.referenceInputLaw) gridPoint + (fun i => integerLongPolynomialOutput path.referencePolynomial (raw i) path.referenceModulus) + path.referenceModulus gridVolume z β = + gridVolume * inactive.fiberMean gridPoint z + (fun i => ∏ p : path.primes, path.referenceLocalDensity (raw i) β p) := by + unfold rationalInactiveForecast + simp_rw [path.reference_rational_density_product] + +omit [Fintype Tsp] in + +theorem reference_inactive_goodPrimeDeletion {Ω Z : Type*} [Fintype Ω] + (hm : 0 < m) + (hD : Fintype.card X + ∑ j : Fin m, (Fintype.card (Eout j) + n j) ≤ Dmod) + (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) + (raw : Ω → PrincipalTupleIndex B (layerSamplerDegree I n) × Option Empty → ℤ) + (cutoff : ℕ) (hcutoff : 0 < cutoff) (hsmall : 2 / (cutoff : ℝ) ≤ 1 / 2) + {δ : ℝ} (hδ : 0 ≤ δ) (haccuracy : 4 / (cutoff : ℝ) ≤ δ) + (gridVolume : ℝ) (hvolume : 0 ≤ gridVolume) (z : Z) + (β : Sigma (AllocatedCongruenceRankOutput X Eout + (allocatedShortAxis (I := I) U b S.value)) → ZMod path.referenceModulus) : + let full := rationalInactiveForecast inactive (fun _ => path.referenceInputLaw) gridPoint + (fun i => integerLongPolynomialOutput path.referencePolynomial (raw i) path.referenceModulus) + path.referenceModulus gridVolume z β + let truncated := path.retainedReferenceForecast inactive gridPoint raw cutoff gridVolume z β + (1 - δ) * truncated ≤ full ∧ full ≤ (1 + δ) * truncated := by + dsimp only + rw [path.reference_inactive_density_product] + unfold retainedReferenceForecast + apply inactive.fiberMean_prod_bounds_of_omitted_prod_sub_one_le gridPoint z + gridVolume δ hvolume hδ (path.referenceRetainedPrimes cutoff) + (fun i p => path.referenceLocalDensity (raw i) β p) + (fun i p => path.referenceLocalDensity_nonneg (raw i) β p) + intro i + apply (indexed_good_prime_product_tail (fun p : path.primes => p.val) Subtype.val_injective + (Finset.univ \ path.referenceRetainedPrimes cutoff) + (fun p => path.referenceLocalDensity (raw i) β p) cutoff hcutoff hsmall ?_ + (fun p _ => path.referenceLocalDensity_nonneg (raw i) β p) ?_).trans haccuracy + · intro p hp + exact (path.referenceRetainedPrimes_omitted cutoff p (Finset.mem_sdiff.mp hp).2).1 + · intro p hp + obtain ⟨_, hbad, hpres⟩ := + path.referenceRetainedPrimes_omitted cutoff p (Finset.mem_sdiff.mp hp).2 + exact (path.localReference_uncharged_density hm hD (raw i) p hbad hpres _).1 + +noncomputable def referenceRetainedModulus (cutoff : ℕ) : ℕ := + ∏ p ∈ path.referenceRetainedPrimes cutoff, p.val ^ path.exponent p.val + +omit [Fintype Tsp] in +theorem referenceRetainedModulus_le (cutoff depth : ℕ) + (hdepth : ∀ p : path.primes, path.exponent p.val ≤ depth) : + path.referenceRetainedModulus cutoff ≤ + (path.Rbad * (∏ p : path.primes, p.val ^ path.prescribed p.val) * + (cutoff + 1) ^ (cutoff + 1)) ^ depth := by + have h := retainedPrimePowerModulus_filter_le_charged_cutoff + (fun p : path.primes => p.val) (fun p : path.primes => path.exponent p.val) + (fun p : path.primes => path.referenceBadDepth p.val) + (fun p : path.primes => path.prescribed p.val) cutoff depth + (fun p => (path.prime p.val p.property).one_le) Subtype.val_injective hdepth + apply h.trans + exact pow_le_pow_left' (Nat.mul_le_mul_right _ + (Nat.mul_le_mul_right _ path.referenceBadDepth_product_le)) depth + +omit [Fintype Tsp] in + +theorem referenceRetainedModulus_le_exp (cutoff depth : ℕ) + (hdepth : ∀ p : path.primes, path.exponent p.val ≤ depth) : + (path.referenceRetainedModulus cutoff : ℝ) ≤ + Real.exp ((depth : ℝ) * + (Pbad + Ppres + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1))) := by + apply retainedPrimePowerModulus_filter_le_exp_charged_cutoff + (fun p : path.primes => p.val) (fun p : path.primes => path.exponent p.val) + (fun p : path.primes => path.referenceBadDepth p.val) + (fun p : path.primes => path.prescribed p.val) cutoff depth + (fun p => (path.prime p.val p.property).one_le) Subtype.val_injective hdepth + Pbad Ppres + · exact (Nat.cast_le.mpr path.referenceBadDepth_product_le).trans path.RbadBound + · exact path.presBound + +omit [Fintype Tsp] in +theorem referenceRetainedModulus_pos (cutoff : ℕ) : + 0 < path.referenceRetainedModulus cutoff := by + apply Finset.prod_pos + intro p _ + exact pow_pos (path.prime p.val p.property).pos _ + +omit [Fintype Tsp] in +theorem referenceRetainedModulus_dvd (cutoff : ℕ) : + path.referenceRetainedModulus cutoff ∣ path.referenceModulus := + Finset.prod_dvd_prod_of_subset (path.referenceRetainedPrimes cutoff) Finset.univ + (fun p : path.primes => p.val ^ path.exponent p.val) (Finset.subset_univ _) + +omit [Fintype Tsp] in + +theorem referenceRetainedModulus_log_le (cutoff depth : ℕ) + (hdepth : ∀ p : path.primes, path.exponent p.val ≤ depth) + (Pdepth : ℝ) (hPdepth : (depth : ℝ) ≤ Pdepth) : + Real.log (path.referenceRetainedModulus cutoff : ℝ) ≤ + Pdepth * (Pbad + Ppres + ((cutoff + 1 : ℕ) : ℝ) * Real.log (cutoff + 1)) := by + apply log_retainedPrimePowerModulus_filter_le_depthBudget + (fun p : path.primes => p.val) (fun p : path.primes => path.exponent p.val) + (fun p : path.primes => path.referenceBadDepth p.val) + (fun p : path.primes => path.prescribed p.val) cutoff depth + (fun p => (path.prime p.val p.property).one_le) Subtype.val_injective hdepth + Pbad Ppres Pdepth + · exact (Nat.cast_le.mpr path.referenceBadDepth_product_le).trans path.RbadBound + · exact path.presBound + · exact hPdepth + +end ActualFixedSpatialForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialSlicedCRTIdentification.lean b/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialSlicedCRTIdentification.lean new file mode 100644 index 0000000000000000000000000000000000000000..82d05f70d92be44ed924eeb5049084b255745478 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialSlicedCRTIdentification.lean @@ -0,0 +1,79 @@ +import OAI.Combinatorics.Progressions.Geometry.ActualFixedSpatialSlicedTargetReal + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 (b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ) +variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U b R σ) +variable (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable (Dmod : ℕ) {Lrank : ℕ} +variable (spatial : Fin Lrank ↪ G) +variable (kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G) +variable (block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩) +variable {Tsp : Type} [Fintype Tsp] +variable (spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)) (Wsp Lsp : ℝ) +variable (physicalN : X → ℕ) (τ δslice P Pbad Ppres : ℝ) + +namespace ActualFixedSpatialSlicedForecastPath +variable {B U b S hR hσ Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres} +variable (slice : ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +local instance slicedReferenceModulusNeZero : NeZero slice.path.referenceModulus := + ⟨slice.path.referenceModulus_pos.ne'⟩ + +noncomputable def stepInputLaw : FiniteProbabilityWeights + (LayerSamplerLongVariables (allocatedShortAxis (I := I) U b S.value) G B → + ZMod slice.path.referenceModulus) := by + letI := slice.path.primeNeZero + exact crtPolynomialInputLaw (fun p : slice.path.primes => p.val) + (fun p : slice.path.primes => slice.path.exponent p.val) + (fun p : slice.path.primes => padicValNat p.val slice.step) + (primePower_crt_coprime (fun p : slice.path.primes => p.val) + (fun p : slice.path.primes => slice.path.exponent p.val) + (fun p => slice.path.prime p.val p.property) Subtype.val_injective) + (fun p v => ((Sum.elim slice.kernelStart + (fun a => slice.principalStart ⟨a.1.val,a.2⟩) v : ℤ) : + ZMod (p.val ^ slice.path.exponent p.val))) + +omit [Fintype Tsp] in +theorem referenceInputLaw_eq_step : slice.path.referenceInputLaw = slice.stepInputLaw := by + have hp : (fun p : slice.path.primes => slice.path.prescribed p.val) = + (fun p : slice.path.primes => padicValNat p.val slice.step) := + funext fun p => slice.prescribed_eq p.val + have ho : slice.path.origin = (fun (p : slice.path.primes) + (v : LayerSamplerLongVariables (allocatedShortAxis (I := I) U b S.value) G B) => ((Sum.elim slice.kernelStart + (fun a => slice.principalStart ⟨a.1.val,a.2⟩) v : ℤ) : + ZMod (p.val ^ slice.path.exponent p.val))) := + funext fun p => funext fun v => slice.origin_eq p v + simp only [ActualFixedSpatialForecastPath.referenceInputLaw, stepInputLaw, hp, ho] + congr 1 + +omit [Fintype Tsp] in +theorem referencePolynomial_eq_sample : slice.path.referencePolynomial = + allocatedForecastPolynomial (allocatedShortAxis (I := I) U b S.value) + slice.path.base slice.path.noise (allocatedReadDeck slice.path.read) + (allocatedOriginalSampleCongruenceProjection B U b S slice.path.sample) := by + have h := allocatedRecoveredForecastPolynomial_eq B U b S slice.path.base slice.path.noise + slice.path.read slice.path.readNoise slice.path.sample slice.path.readProjection + rw [slice.path.readNoise] at h + exact h.symm + +end ActualFixedSpatialSlicedForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialSlicedForecastFromResidueBox.lean b/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialSlicedForecastFromResidueBox.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc1db9108257b39c8bc9f778b8899a0b751b21e3 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/ActualFixedSpatialSlicedForecastFromResidueBox.lean @@ -0,0 +1,136 @@ +import OAI.Combinatorics.Progressions.Linear.KernelPrincipalFiberSliceLaw +import OAI.Combinatorics.Progressions.Sampling.ActualFixedSpatialSlicedForecastSourceLaw + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped BigOperators Classical NNReal Matrix + +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 {b : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ} +variable {R σ : Fin m → ℝ} {S : LayerSamplerScale (G := G) B U b R σ} +variable {hR : ∀ j, 0 < R j} {hσ : ∀ j, 0 < σ j} +variable {X : Type} [Fintype X] [DecidableEq X] +variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)] +variable {Dmod : ℕ} {Lrank : ℕ} +variable {spatial : Fin Lrank ↪ G} +variable {kernel : ∀ j : Fin m, Fin Lrank × Fin (j.val + 1) ↪ G} +variable {block : ∀ j, ∀ a : AllocatedDegreeActiveAxis + (allocatedShortAxis (I := I) U b S.value) j, Fin Lrank ↪ B ⟨j,a.val⟩} +variable {Tsp : Type} [Fintype Tsp] +variable {spatialEquiv : G ≃ X ⊕ (X ⊕ Tsp)} {Wsp Lsp : ℝ} +variable {physicalN : X → ℕ} {τ δslice P Pbad Ppres : ℝ} + +namespace ActualFixedSpatialForecastPath + +variable (path : ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres) + +noncomputable def reparameterize + (δslice' Ppres' : ℝ) + (commonTuple : G → IntegerScalarCubeBox Empty S.value) + (prescribed : ℕ → ℕ) + (origin : ∀ p : path.primes, LayerSamplerLongVariables + (allocatedShortAxis (I := I) U b S.value) G B → ZMod (p.val ^ path.exponent p.val)) + (hpres : ((∏ p : path.primes, p.val ^ prescribed p.val : ℕ) : ℝ) ≤ Real.exp Ppres') + (lower width : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + B a.val × Fin (layerSamplerDegree I n a.val) → ℝ) + (hwidth : ∀ a p, δslice' ≤ width a p) + (hlower : ∀ a p, 0 ≤ lower a p) + (hcontained : ∀ a p, |lower a p| + |width a p| ≤ 1) : + ActualFixedSpatialForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice' P Pbad Ppres' where + base := path.base + noise := path.noise + sample := path.sample + hs := path.hs + read := path.read + readNoise := path.readNoise + readProjection := path.readProjection + center := path.center + commonTuple := commonTuple + primes := path.primes + prime := path.prime + exponent := path.exponent + prescribed := prescribed + origin := origin + Rbad := path.Rbad + hbad := path.hbad + RbadBound := path.RbadBound + presBound := hpres + lower := lower + width := width + hwidth := hwidth + hlower := hlower + hcontained := hcontained + detFalse := path.detFalse + detTrue := path.detTrue + hjac := path.hjac + hinverse := path.hinverse + +variable {keep : G ⊕ PrincipalTupleIndex B (layerSamplerDegree I n) → Prop} [DecidablePred keep] +variable {step : ℕ} +variable (box : ResidueBoxSlice + (fun k : {k // keep k} => Sum.elim (fun _ : G => S.value) + (allocatedPrincipalSides B U b S) k.val) step) +variable (hlen : ∀ k, 0 < box.length k) +variable (fixed : {k // ¬keep k} → ℤ) +variable (hfixed : ∀ k, 0 ≤ fixed k ∧ fixed k < + ((Sum.elim (fun _ : G => S.value) (allocatedPrincipalSides B U b S) k.val : ℕ) : ℤ)) +variable (hkernel : ∀ g, keep (Sum.inl g)) +variable (hactive : ∀ a : {a : LayerSamplerAxis I n // ¬allocatedShortAxis U b S.value a}, + ∀ p : B a.val × Fin (layerSamplerDegree I n a.val), keep (Sum.inr ⟨a.val,p⟩)) +variable (hstep : 0 < step) +variable (hkernelLength : ∀ g, 2 ≤ box.length ⟨Sum.inl g, hkernel g⟩) +variable (hprescribed : ∀ p, path.prescribed p = padicValNat p step) +variable (horigin : ∀ (p : path.primes) (v : LayerSamplerLongVariables + (allocatedShortAxis (I := I) U b S.value) G B), + path.origin p v = ((Sum.elim + (fun g => (box.start ⟨Sum.inl g,hkernel g⟩ : ℤ)) + (fun a => box.fiberParameterStart fixed (Sum.inr ⟨a.1.val,a.2⟩)) v : ℤ) : + ZMod (p.val ^ path.exponent p.val))) +variable (hlower : ∀ a p, path.lower a p = + (box.fiberParameterStart fixed (Sum.inr ⟨a.val,p⟩) : ℝ) / + allocatedPrincipalSides B U b S ⟨a.val,p⟩) +variable (hwidth : ∀ a p, path.width a p = + (ResidueBoxSlice.fiberParameterStride (keep := keep) (q := step) (Sum.inr ⟨a.val,p⟩) : ℝ) * + (box.fiberParameterLength (Sum.inr ⟨a.val,p⟩) - 1 : ℕ) / + allocatedPrincipalSides B U b S ⟨a.val,p⟩) + +noncomputable def withResidueBoxSlice : + ActualFixedSpatialSlicedForecastPath (Eout := Eout) B U b S hR hσ + Dmod spatial kernel block spatialEquiv Wsp Lsp physicalN τ δslice P Pbad Ppres where + path := path + step := step + step_pos := hstep + kernelLength g := box.length ⟨Sum.inl g, hkernel g⟩ + kernelStart g := box.start ⟨Sum.inl g, hkernel g⟩ + kernelLength_two := hkernelLength + kernelInside g t := by + constructor + · positivity + · exact_mod_cast box.inside ⟨Sum.inl g, hkernel g⟩ t.val t.isLt + principalLength j := box.fiberParameterLength (Sum.inr j) + principalStep j := ResidueBoxSlice.fiberParameterStride (keep := keep) (q := step) (Sum.inr j) + principalStart j := box.fiberParameterStart fixed (Sum.inr j) + principalLength_pos j := box.fiberParameterLength_pos hlen (Sum.inr j) + principalInside := box.fiberPrincipalParameter_inside hlen fixed hfixed + principalStep_active a p := by + simp only [ResidueBoxSlice.fiberParameterStride, ite_eq_left (hactive a p)] + prescribed_eq := hprescribed + origin_eq := horigin + lower_eq := hlower + width_eq := hwidth + +end ActualFixedSpatialForecastPath +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/ActualResidueSpatialFreezing.lean b/lean/OAI/Combinatorics/Progressions/Lattices/ActualResidueSpatialFreezing.lean new file mode 100644 index 0000000000000000000000000000000000000000..420eb1c15891030f07872c2383c6203ee2f8889e --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/ActualResidueSpatialFreezing.lean @@ -0,0 +1,182 @@ +import OAI.Combinatorics.Progressions.Geometry.NormalizedTwistSpatialPartition + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_correlated_residue_progression_box {I : Type*} [Fintype I] + [DecidableEq I] (N : I → ℕ) (q : ℕ) (p : ℝ) + (hp : 0 ≤ p) (hq : 0 < q) (hqexp : (q : ℝ) ≤ Real.exp p) + (hN : ∀ i, Real.exp (3 * p + 16) ≤ (N i : ℝ)) (f : (I → ℕ) → ℂ) : + ∃ start length : I → ℕ, + (∀ i, 0 < length i) ∧ + (∀ i, (N i : ℝ) * Real.exp (-(3 * p + 16)) ≤ length i) ∧ + (∀ i (j : Fin (length i)), start i + q * j.val < N i) ∧ + (∀ i (j : Fin (length i)), (start i + q * j.val) % q = start i % q) ∧ + (∀ i (j : Fin (length i)), + |((start i + q * j.val : ℕ) : ℝ) / N i - (start i : ℝ) / N i| ≤ + Real.exp (-(2 * p)) / 4) ∧ + (∀ i (j k : Fin (length i)), + |((start i + q * j.val : ℕ) : ℝ) / N i - + ((start i + q * k.val : ℕ) : ℝ) / N i| ≤ Real.exp (-(2 * p)) / 4) ∧ + ‖𝔼 x : (∀ i, Fin (N i)), f (fun i => (x i).val)‖ ≤ + ‖𝔼 j : (∀ i, Fin (length i)), f (fun i => start i + q * (j i).val)‖ := by + classical + let H : I → ℕ := fun i => exponentialProgressionScale (N i) q p + have hscale (i : I) := exponentialProgressionScale_bounds (N i) q p hp hq hqexp (hN i) + let P : ∀ i, FiniteProgressionPartition (N i) := fun i => + FiniteProgressionPartition.comparableResidueProgressions (N i) q (H i) hq + (hscale i).1 (hscale i).2.1 + have hstep (i : I) (a : (P i).Label) : (P i).step a = q := + FiniteProgressionPartition.comparableResidueProgressions_step _ _ _ _ _ _ _ + have hlength (i : I) (a : (P i).Label) : + H i ≤ (P i).length a ∧ (P i).length a < 2 * H i := + FiniteProgressionPartition.comparableResidueProgressions_length_bounds _ _ _ _ _ _ _ + have hNpos (i : I) : 0 < N i := by + have : (0 : ℝ) < N i := (Real.exp_pos _).trans_le (hN i) + exact_mod_cast this + obtain ⟨a, hpositive, hmean⟩ := + BoxProgressionPartition.exists_positive_box_norm_mean_le P hNpos f + refine ⟨fun i => (P i).start (a i), fun i => (P i).length (a i), hpositive, + ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro i + exact (hscale i).2.2.1.trans (by exact_mod_cast (hlength i (a i)).1) + · intro i j + simpa only [hstep] using (P i).point_lt (a i) j.isLt + · intro i j + exact Nat.add_mul_mod_self_left _ _ _ + · intro i j + simpa only [FiniteProgressionPartition.point_val, hstep] using + (P i).normalized_point_sub_start_le_of_bound (a i) (hstep i (a i)) + (hlength i (a i)).2 (hNpos i) (hscale i).2.2.2 j + · intro i j k + simpa only [FiniteProgressionPartition.point_val, hstep] using + (P i).normalized_point_sub_point_le_of_bound (a i) (hstep i (a i)) + (hlength i (a i)).2 (hNpos i) (hscale i).2.2.2 j k + · simpa only [hstep] using hmean + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem exists_correlated_integer_residue_box {I : Type*} [Fintype I] + [DecidableEq I] (N : I → ℕ) (q : ℕ) (p : ℝ) + (hp : 0 ≤ p) (hq : 0 < q) (hqexp : (q : ℝ) ≤ Real.exp p) + (hN : ∀ i, Real.exp (3 * p + 16) ≤ (N i : ℝ)) (f : (I → ℤ) → ℂ) : + ∃ start length : I → ℕ, + (∀ i, 0 < length i) ∧ + (∀ i, (N i : ℝ) * Real.exp (-(3 * p + 16)) ≤ length i) ∧ + (∀ i, (N i : ℝ) ≤ Real.exp (3 * p + 16) * q * length i) ∧ + (∀ v ∈ integerBox length, + (fun i => (start i : ℤ) + (q : ℤ) * v i) ∈ integerBox N) ∧ + (∀ v ∈ integerBox length, ∀ i, + ((start i : ℤ) + (q : ℤ) * v i) % q = (start i : ℤ) % q) ∧ + (∀ v ∈ integerBox length, ∀ i, + |((start i : ℝ) + (q : ℝ) * v i) / N i - (start i : ℝ) / N i| ≤ + Real.exp (-(2 * p)) / 4) ∧ + (∀ v ∈ integerBox length, ∀ w ∈ integerBox length, ∀ i, + |((start i : ℝ) + (q : ℝ) * v i) / N i - + ((start i : ℝ) + (q : ℝ) * w i) / N i| ≤ Real.exp (-(2 * p)) / 4) ∧ + ‖𝔼 u ∈ integerBox N, f u‖ ≤ + ‖𝔼 v ∈ integerBox length, f (fun i => (start i : ℤ) + (q : ℤ) * v i)‖ := by + obtain ⟨start, length, hpos, hlength, hinside, _, hdiam, hpair, hmean⟩ := + exists_correlated_residue_progression_box N q p hp hq hqexp hN + (fun u => f (fun i => (u i : ℤ))) + have hrepr (v : I → ℤ) (hv : v ∈ integerBox length) : + ∃ j : ∀ i, Fin (length i), ∀ i, ((j i).val : ℤ) = v i := by + have hb := (mem_integerBox length v).mp hv + refine ⟨fun i => ⟨(v i).toNat, by have := hb i; omega⟩, ?_⟩ + exact fun i => Int.toNat_of_nonneg (hb i).1 + refine ⟨start, length, hpos, hlength, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro i + have hbase : (N i : ℝ) ≤ (length i : ℝ) * Real.exp (3 * p + 16) := by + apply (div_le_iff₀ (Real.exp_pos _)).mp + simpa only [Real.exp_neg, div_eq_mul_inv] using hlength i + have hqone : (1 : ℝ) ≤ q := by exact_mod_cast hq + calc + (N i : ℝ) ≤ Real.exp (3 * p + 16) * length i := by simpa only [mul_comm] using hbase + _ ≤ Real.exp (3 * p + 16) * q * length i := by + gcongr + exact le_mul_of_one_le_right (Real.exp_pos _).le hqone + · intro v hv + obtain ⟨j, hj⟩ := hrepr v hv + rw [mem_integerBox] + intro i + rw [← hj i] + constructor + · positivity + · exact_mod_cast hinside i (j i) + · intro v _ i + exact Int.add_mul_emod_self_left _ _ _ + · intro v hv i + obtain ⟨j, hj⟩ := hrepr v hv + have hjR : ((j i).val : ℝ) = v i := by exact_mod_cast hj i + simpa only [Nat.cast_add, Nat.cast_mul, hjR] using hdiam i (j i) + · intro v hv w hw i + obtain ⟨j, hj⟩ := hrepr v hv + obtain ⟨k, hk⟩ := hrepr w hw + have hjR : ((j i).val : ℝ) = v i := by exact_mod_cast hj i + have hkR : ((k i).val : ℝ) = w i := by exact_mod_cast hk i + simpa only [Nat.cast_add, Nat.cast_mul, hjR, hkR] using hpair i (j i) (k i) + · rw [integerBox_expect_eq_fin, integerBox_expect_eq_fin] + simpa only [Nat.cast_add, Nat.cast_mul] using hmean + +end Erdos3 + +end + +section + +namespace Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +open scoped NNReal BigOperators + +variable {X : Type*} [Fintype X] {m : ℕ} {J : Fin m → Type*} + [∀ j, Fintype (J j)] {periodCap coverCap : ℝ} {L : ℝ≥0} + +theorem eval_affine_sub_frozenTorus + (W : NormalizedPolynomialTwist X (Σ j, J j) periodCap coverCap L) + (N : X → ℕ) (poly : ∀ j, VectorPolynomial X ℝ (J j → ℝ)) + (r v : X → ℤ) (p : ℝ) (hL : (L : ℝ) ≤ Real.exp p) + (hspatial : ∀ i, + |((r i + W.modulus * v i : ℤ) : ℝ) / N i - (r i : ℝ) / N i| ≤ + Real.exp (-(2 * p)) / 4) : + ‖W.eval N poly (fun i => r i + W.modulus * v i) - + W.frozenTorus (fun i => (r i : ZMod W.modulus)) + (fun i => (r i : ℝ) / N i) + (physicalGridFactorInput W.cover poly + (fun i => ((r i + W.modulus * v i : ℤ) : ℝ)))‖ ≤ + Real.exp (-p) / 4 := by + have hresidue : (fun i => ((r i + W.modulus * v i : ℤ) : ZMod W.modulus)) = + (fun i => (r i : ZMod W.modulus)) := by + funext i + simp + have hdist : dist + (fun i => ((r i + W.modulus * v i : ℤ) : ℝ) / N i) + (fun i => (r i : ℝ) / N i) ≤ Real.exp (-(2 * p)) / 4 := + (dist_pi_le_iff (by positivity)).mpr (fun i => by + simpa only [Real.dist_eq] using hspatial i) + have herr := W.eval_sub_frozenSpatialEval N (fun i => (r i : ℝ) / N i) poly + (fun i => r i + W.modulus * v i) + simp only [frozenSpatialEval, hresidue] at herr + refine herr.trans ?_ + calc + (L : ℝ) * dist _ _ ≤ Real.exp p * (Real.exp (-(2 * p)) / 4) := + mul_le_mul hL hdist dist_nonneg (Real.exp_nonneg _) + _ = Real.exp (-p) / 4 := by rw [← mul_div_assoc, ← Real.exp_add]; congr 2; ring + +end Erdos3.VectorPolynomial.NormalizedPolynomialTwist + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AdaptiveResidueNormalization.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AdaptiveResidueNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..2781bc3e0980d6b29868e4747db7b12445d739a7 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AdaptiveResidueNormalization.lean @@ -0,0 +1,81 @@ +import OAI.Combinatorics.Progressions.Estimates.AdaptiveRatioNormalization + +namespace OAI + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +variable {ι σ τ : 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)] + (c : ∀ i, FiniteProbabilityCoupling (primeCoordinateReference (σ := σ) q i) + (primeCoordinateReference (σ := τ) q i)) + (tree : CoordinateDecisionTree ι (fun i => τ → ZMod (q i))) + (baseX : ∀ i, σ → ZMod (q i)) (baseY : ∀ i, τ → ZMod (q i)) + {Good : Finset ι → (∀ i, τ → ZMod (q i)) → Prop} {d A : ℕ} + (htree : CoordinateDecisionTree.Valid Good ∅ baseY tree d) (hA : d ≤ A) + +include htree hA hneX hneY + +theorem adaptive_residue_normalization_close {eta theta : ℝ} + (hsource : ProductMarginalsClose (primeCoordinateReference (σ := σ) q) + (residuePrimeCoordinateDensity loX NX MX aX hneX q (fun _ => 1)) eta A) + (hsite : ProductMarginalsClose (primeCoordinateReference (σ := τ) q) + (residuePrimeCoordinateDensity loY NY MY aY hneY q (fun _ => 1)) theta A) : + |(adaptiveLeafCouplingWeights c tree baseX baseY).mean (fun z => + residuePrimeCoordinateMassRatio loX NX MX aX q z.val.1.1 + (productSubtypePoint z.val.1.1 z.val.2 baseX) * + residuePrimeCoordinateMassRatio loY NY MY aY q z.val.1.1 (z.val.1.assignment baseY)) - 1| ≤ + eta + theta + eta * theta := by + have hA' : (∅ : Finset ι).card + d ≤ A := by simpa only [Finset.card_empty, zero_add] using hA + have hsize (z) (hz : z ∈ CoordinateDecisionTree.leafSourceAssignments + (fun i => σ → ZMod (q i)) tree ∅ baseY) : z.1.1.card ≤ A := + (htree.leaf_card_le z.1 ((CoordinateDecisionTree.mem_leafSourceAssignments (fun i => σ → ZMod (q i)) tree ∅ baseY z).mp hz)).trans hA' + apply adaptive_ratio_product_close c tree baseX baseY + (fun z => residuePrimeCoordinateMassRatio loX NX MX aX q z.1.1 + (productSubtypePoint z.1.1 z.2 baseX)) + (fun z => residuePrimeCoordinateMassRatio loY NY MY aY q z.1.1 (z.1.assignment baseY)) + · intro z hz + exact residuePrimeCoordinateMassRatio_close_of_marginals loX NX MX aX hneX q hsource + z.1.1 (hsize z hz) (productSubtypePoint z.1.1 z.2 baseX) + · intro z hz + exact residuePrimeCoordinateMassRatio_close_of_marginals loY NY MY aY hneY q hsite + z.1.1 (hsize z hz) (z.1.assignment baseY) + +theorem adaptive_residue_normalization_of_lengths {eta theta : ℝ} + (hMX : 0 < MX) (hMY : 0 < MY) + (hcopX : ∀ i, MX.Coprime (q i)) (hcopY : ∀ i, MY.Coprime (q i)) + (hpair : Pairwise (fun i j => (q i).Coprime (q j))) + (modLog dimX dimY accX accY : ℝ) (hmodLog : 0 ≤ modLog) + (heta : eta ≤ 1) (htheta : theta ≤ 1) + (haccX : Real.exp (-accX) ≤ eta) (haccY : Real.exp (-accY) ≤ theta) + (hmoduli : ∀ i, (q i : ℝ) ≤ Real.exp modLog) + (hdimX : (Fintype.card σ : ℝ) ≤ Real.exp dimX) (hdimY : (Fintype.card τ : ℝ) ≤ Real.exp dimY) + (hlengthX : ∀ k, Real.exp (modLog * A + accX + dimX + 1) ≤ + (residueIndexLength (loX k) (loX k + NX k) MX (aX k) : ℝ)) + (hlengthY : ∀ k, Real.exp (modLog * A + accY + dimY + 1) ≤ + (residueIndexLength (loY k) (loY k + NY k) MY (aY k) : ℝ)) : + |(adaptiveLeafCouplingWeights c tree baseX baseY).mean (fun z => + residuePrimeCoordinateMassRatio loX NX MX aX q z.val.1.1 + (productSubtypePoint z.val.1.1 z.val.2 baseX) * + residuePrimeCoordinateMassRatio loY NY MY aY q z.val.1.1 (z.val.1.assignment baseY)) - 1| ≤ + eta + theta + eta * theta := by + have hx := residuePrimeDensity_close_of_lengths loX NX MX aX hneX q hMX hcopX hpair + A modLog dimX accX eta hmodLog heta haccX hmoduli hdimX hlengthX + have hy := residuePrimeDensity_close_of_lengths loY NY MY aY hneY q hMY hcopY hpair + A modLog dimY accY theta hmodLog htheta haccY hmoduli hdimY hlengthY + exact adaptive_residue_normalization_close loX NX MX aX hneX loY NY MY aY hneY q c + tree baseX baseY htree hA hx hy + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineAmbientPrimitiveBudget.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineAmbientPrimitiveBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..45ce35fa104ec9773f579bf2e45066debe043464 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineAmbientPrimitiveBudget.lean @@ -0,0 +1,247 @@ +import OAI.Combinatorics.Progressions.Estimates.AllocatedAmbientLogBounds +import OAI.Combinatorics.Progressions.Sampling.AmbientL1SamplingBudget + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial +open scoped NNReal + +def affineAmbientMassLog {A : Type*} [Semiring A] (P : A) : A := + 4 * P ^ 3 + 9 * P ^ 2 + 5 * P + +theorem affineAmbientMassLog_nonneg {P : ℝ} (hP : 0 ≤ P) : + 0 ≤ affineAmbientMassLog P := by unfold affineAmbientMassLog; positivity + +theorem affineAmbientMass_le_exp {P Q inv mask : ℝ} {sites axes labels : ℕ} + (hP : 0 ≤ P) (hQ : 0 ≤ Q) (hQP : Q ≤ P) + (hsites : (sites : ℝ) ≤ P) (haxes : (axes : ℝ) ≤ P) + (hlabels : (labels : ℝ) ≤ Real.exp P) + (hinv0 : 0 ≤ inv) (hinv : inv ≤ Real.exp P) + (hmask0 : 0 ≤ mask) (hmask : mask ≤ Real.exp P) : + (Real.toNNReal ((2 : ℝ) ^ sites * inv * ((labels : ℝ) ^ sites * mask * + Real.exp ((sites * axes : ℕ) * (4 * Q + 8) + Q))) : ℝ) ≤ + Real.exp (affineAmbientMassLog P) := by + rw [Real.toNNReal_of_nonneg (by positivity)] + have htwo : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + have hpow : (2 : ℝ) ^ sites ≤ Real.exp (2 * P) := by + apply (pow_le_pow_left₀ (by norm_num : (0 : ℝ) ≤ 2) htwo sites).trans + rw [← Real.exp_nat_mul] + exact Real.exp_le_exp.mpr (by linarith) + have hl : (labels : ℝ) ^ sites ≤ Real.exp (P ^ 2) := by + apply (pow_le_pow_left₀ (Nat.cast_nonneg _) hlabels sites).trans + rw [← Real.exp_nat_mul] + exact Real.exp_le_exp.mpr (by nlinarith) + have hexp : Real.exp ((sites * axes : ℕ) * (4 * Q + 8) + Q) ≤ + Real.exp (P ^ 2 * (4 * P + 8) + P) := by + apply Real.exp_le_exp.mpr + push_cast + have hsa : (sites : ℝ) * axes ≤ P ^ 2 := by + simpa only [pow_two] using mul_le_mul hsites haxes (Nat.cast_nonneg _) hP + have hh := mul_le_mul hsa (show 4 * Q + 8 ≤ 4 * P + 8 by linarith) + (by linarith : 0 ≤ 4 * Q + 8) (sq_nonneg P) + linarith + calc + _ ≤ Real.exp (2 * P) * Real.exp P * + (Real.exp (P ^ 2) * Real.exp P * Real.exp (P ^ 2 * (4 * P + 8) + P)) := + mul_le_mul (mul_le_mul hpow hinv hinv0 (Real.exp_nonneg _)) + (mul_le_mul (mul_le_mul hl hmask hmask0 (Real.exp_nonneg _)) hexp + (Real.exp_nonneg _) (by positivity)) (by positivity) (by positivity) + _ = _ := by + rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + congr 1 + unfold affineAmbientMassLog + ring + +theorem affineAmbientLift_le_exp {P : ℝ} (hP : 0 ≤ P) + {N mass Lgrid d sites Lsite Lrows : ℝ≥0} + (hN : (N : ℝ) ≤ Real.exp P) (hmass : (mass : ℝ) ≤ Real.exp (affineAmbientMassLog P)) + (hg : (Lgrid : ℝ) ≤ Real.exp P) (hd : (d : ℝ) ≤ Real.exp P) + (hs : (sites : ℝ) ≤ Real.exp P) (hl : (Lsite : ℝ) ≤ Real.exp P) + (hr : (Lrows : ℝ) ≤ Real.exp P) : + ((N * mass : ℝ≥0) : ℝ) ≤ Real.exp (affineAmbientMassLog P + P) ∧ + ((N * (mass * (Lgrid * d) + mass * (sites * (Lsite * Lrows))) : ℝ≥0) : ℝ) ≤ + Real.exp (2 * affineAmbientMassLog P + 7 * P + 1) := by + have hM := affineAmbientMassLog_nonneg hP + constructor + · simp only [NNReal.coe_mul] + exact (mul_le_mul hN hmass mass.coe_nonneg (Real.exp_nonneg _)).trans_eq (by + rw [← Real.exp_add, add_comm]) + · simp only [NNReal.coe_mul, NNReal.coe_add] + rw [mul_add] + have hfirst : (N : ℝ) * (mass * (Lgrid * d)) ≤ Real.exp (affineAmbientMassLog P + 3 * P) := by + calc + _ ≤ Real.exp P * (Real.exp (affineAmbientMassLog P) * (Real.exp P * Real.exp P)) := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add]; congr 1; ring + have hsecond : (N : ℝ) * (mass * (sites * (Lsite * Lrows))) ≤ + Real.exp (affineAmbientMassLog P + 4 * P) := by + calc + _ ≤ Real.exp P * (Real.exp (affineAmbientMassLog P) * + (Real.exp P * (Real.exp P * Real.exp P))) := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add, ← Real.exp_add]; congr 1; ring + exact (add_le_exp_add_one (by positivity) (by positivity) hfirst hsecond).trans_eq + (congrArg Real.exp (by ring)) + +theorem affineAmbientSiteLip_le_exp {P : ℝ} (hP : 0 ≤ P) + {axes cutoff r coord L : ℝ≥0} {d period : ℕ} + (ha : (axes : ℝ) ≤ Real.exp P) (hc : (cutoff : ℝ) ≤ Real.exp P) + (hr : ((2 * r)⁻¹ : ℝ≥0) ≤ Real.exp P) (hcoord : (coord : ℝ) ≤ Real.exp P) + (hL : (L : ℝ) ≤ Real.exp P) (hd : (d : ℝ) ≤ Real.exp P) + (hperiod : (period : ℝ) ≤ Real.exp P) : + (((axes * cutoff / (2 * r)) * coord * d + + max (L * coord * period) (4 * period) * (d / period : ℕ) : ℝ≥0) : ℝ) ≤ + Real.exp (9 * P + 5) := by + have hfour : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] + have hfirst : (((axes * cutoff / (2 * r)) * coord * d : ℝ≥0) : ℝ) ≤ Real.exp (5 * P) := by + simp only [div_eq_mul_inv, NNReal.coe_mul, NNReal.coe_natCast] + calc + _ ≤ ((Real.exp P * Real.exp P * Real.exp P) * Real.exp P) * Real.exp P := by gcongr + _ = _ := by rw [← Real.exp_add, ← Real.exp_add, ← Real.exp_add, ← Real.exp_add]; congr 1; ring + have hmax : ((max (L * coord * period) (4 * period) : ℝ≥0) : ℝ) ≤ Real.exp (3 * P + 4) := by + simp only [NNReal.coe_max, NNReal.coe_mul, NNReal.coe_natCast, NNReal.coe_ofNat] + apply max_le + · calc + _ ≤ Real.exp P * Real.exp P * Real.exp P := by gcongr + _ = Real.exp (3 * P) := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + · calc + _ ≤ Real.exp 4 * Real.exp P := by gcongr + _ = Real.exp (4 + P) := (Real.exp_add _ _).symm + _ ≤ _ := Real.exp_le_exp.mpr (by linarith) + have hsecond : ((max (L * coord * period) (4 * period) * (d / period : ℕ) : ℝ≥0) : ℝ) ≤ + Real.exp (4 * P + 4) := by + simp only [NNReal.coe_mul, NNReal.coe_natCast] + calc + _ ≤ Real.exp (3 * P + 4) * Real.exp P := mul_le_mul hmax + ((Nat.cast_le.mpr (Nat.div_le_self d period)).trans hd) (Nat.cast_nonneg _) (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + rw [NNReal.coe_add] + exact (add_le_exp_add_one (by positivity) (by positivity) hfirst hsecond).trans_eq + (congrArg Real.exp (by ring)) + +theorem affineAmbientGridLip_le_exp {P : ℝ} (_hP : 0 ≤ P) + {axes outputs height coord : ℝ≥0} + (ha : (axes : ℝ) ≤ Real.exp P) (ho : (outputs : ℝ) ≤ Real.exp P) + (hh : (height : ℝ) ≤ Real.exp P) (hc : (coord : ℝ) ≤ Real.exp P) : + ((axes * (outputs * (2 * height ^ 2)) * coord : ℝ≥0) : ℝ) ≤ Real.exp (5 * P + 2) := by + have htwo : (2 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp (2 : ℝ)] + simp only [NNReal.coe_mul, NNReal.coe_pow, NNReal.coe_ofNat] + calc + _ ≤ Real.exp P * (Real.exp P * (Real.exp 2 * Real.exp P ^ 2)) * Real.exp P := by gcongr + _ = _ := by + rw [← Real.exp_nat_mul, ← Real.exp_add, ← Real.exp_add, ← Real.exp_add, ← Real.exp_add] + congr 1 + ring + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial +open scoped NNReal + +noncomputable def affineAmbientPrimitiveBudget {A : Type*} [Semiring A] (base Q : A) : A := + let P₂ := 9 * (9 * (base + Q) + 13) + 5 + 2 * affineAmbientMassLog P₂ + 7 * P₂ + 1 + +theorem affineAmbientPrimitive_bounds {base Q inv mask : ℝ} + {sites axes labels gridaxes outputs d period : ℕ} + {N K coords cutoff r radius Lrows height : ℝ≥0} + (hb : 0 ≤ base) (hQ : 0 ≤ Q) + (hsites : (sites : ℝ) ≤ base) (haxes : (axes : ℝ) ≤ base) + (hlabels : (labels : ℝ) ≤ Real.exp base) + (hinv0 : 0 ≤ inv) (hinv : inv ≤ Real.exp base) + (hmask0 : 0 ≤ mask) (hmask : mask ≤ Real.exp base) + (hN : (N : ℝ) ≤ Real.exp base) (hK : (K : ℝ) ≤ Real.exp base) + (hcoords : (coords : ℝ) ≤ Real.exp base) (hc : (cutoff : ℝ) ≤ Real.exp base) + (hr : 1 ≤ r) (hradius : 1 ≤ radius) + (hd : (d : ℝ) ≤ Real.exp base) (hperiod : (period : ℝ) ≤ Real.exp base) + (hrows : (Lrows : ℝ) ≤ Real.exp base) + (hgaxes : (gridaxes : ℝ) ≤ base) (houtputs : (outputs : ℝ) ≤ base) + (hheight : (height : ℝ) ≤ Real.exp base) : + let mass := Real.toNNReal ((2 : ℝ) ^ sites * inv * ((labels : ℝ) ^ sites * mask * + Real.exp ((sites * axes : ℕ) * (4 * Q + 8) + Q))) + let L : ℝ≥0 := ⟨Real.exp (axes + 6 * Q + 12), Real.exp_nonneg _⟩ + axes * cutoff / (2 * radius) + let coord := K * coords + let Lsite := (axes * cutoff / (2 * r)) * coord * d + + max (L * coord * period) (4 * period) * (d / period : ℕ) + let Lgrid := (gridaxes * (outputs * (2 * height ^ 2))) * coords + let T := affineAmbientPrimitiveBudget base Q + ((N * mass : ℝ≥0) : ℝ) ≤ Real.exp T ∧ + ((N * (mass * (Lgrid * d) + mass * (sites * (Lsite * Lrows))) : ℝ≥0) : ℝ) ≤ Real.exp T := by + intro mass L coord Lsite Lgrid T + let P := base + Q + let P₁ := 9 * P + 13 + let P₂ := 9 * P₁ + 5 + have hP : 0 ≤ P := add_nonneg hb hQ + have hbP : base ≤ P := le_add_of_nonneg_right hQ + have hQP : Q ≤ P := le_add_of_nonneg_left hb + have hP₁ : 0 ≤ P₁ := by dsimp [P₁]; positivity + have hP₂ : 0 ≤ P₂ := by dsimp [P₂]; positivity + have hPP₁ : P ≤ P₁ := by dsimp [P₁]; linarith + have hP₁P₂ : P₁ ≤ P₂ := by dsimp [P₂]; linarith + have hbP₂ := hbP.trans (hPP₁.trans hP₁P₂) + have hexp : Real.exp base ≤ Real.exp P₂ := Real.exp_le_exp.mpr hbP₂ + have hbaseE : base ≤ Real.exp base := by linarith [Real.add_one_le_exp base] + have hL : (L : ℝ) ≤ Real.exp P₁ := by + have hden : (1 : ℝ) ≤ 2 * (radius : ℝ) := by exact_mod_cast (by linarith : (1 : ℝ≥0) ≤ 2 * radius) + have hcut : ((axes * cutoff / (2 * radius) : ℝ≥0) : ℝ) ≤ Real.exp (2 * P) := by + simp only [NNReal.coe_div, NNReal.coe_mul, NNReal.coe_natCast, NNReal.coe_ofNat] + apply (div_le_self (by positivity) hden).trans + calc + _ ≤ Real.exp P * Real.exp P := mul_le_mul + ((haxes.trans hbaseE).trans (Real.exp_le_exp.mpr hbP)) + (hc.trans (Real.exp_le_exp.mpr hbP)) cutoff.coe_nonneg (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + have hraw : Real.exp (axes + 6 * Q + 12) ≤ Real.exp (7 * P + 12) := + Real.exp_le_exp.mpr (by linarith) + change Real.exp (axes + 6 * Q + 12) + _ ≤ _ + exact (add_le_exp_add_one (by positivity) (by positivity) hraw hcut).trans_eq + (congrArg Real.exp (by dsimp [P₁]; ring)) + have hcoord : (coord : ℝ) ≤ Real.exp P₁ := by + change (K : ℝ) * coords ≤ _ + calc + _ ≤ Real.exp base * Real.exp base := mul_le_mul hK hcoords coords.coe_nonneg (Real.exp_nonneg _) + _ = Real.exp (2 * base) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ _ := Real.exp_le_exp.mpr (by dsimp [P₁, P]; linarith) + have hrInv : (((2 * r)⁻¹ : ℝ≥0) : ℝ) ≤ Real.exp P₁ := by + have hden : (1 : ℝ≥0) ≤ 2 * r := by linarith + have hh : (2 * r)⁻¹ ≤ (1 : ℝ≥0) := inv_le_one_of_one_le₀ hden + exact (NNReal.coe_le_coe.mpr hh).trans (Real.one_le_exp hP₁) + have hbase₁ : Real.exp base ≤ Real.exp P₁ := Real.exp_le_exp.mpr (hbP.trans hPP₁) + have hsite : (Lsite : ℝ) ≤ Real.exp P₂ := + affineAmbientSiteLip_le_exp hP₁ ((haxes.trans hbaseE).trans hbase₁) + (hc.trans hbase₁) hrInv hcoord hL (hd.trans hbase₁) (hperiod.trans hbase₁) + have hgrid : (Lgrid : ℝ) ≤ Real.exp P₂ := by + apply (affineAmbientGridLip_le_exp (axes := (gridaxes : ℝ≥0)) (outputs := (outputs : ℝ≥0)) hb (hgaxes.trans hbaseE) (houtputs.trans hbaseE) hheight hcoords).trans + exact Real.exp_le_exp.mpr (by dsimp [P₂, P₁, P]; linarith) + have hm : (mass : ℝ) ≤ Real.exp (affineAmbientMassLog P₂) := + affineAmbientMass_le_exp hP₂ hQ (hQP.trans (hPP₁.trans hP₁P₂)) + (hsites.trans hbP₂) (haxes.trans hbP₂) (hlabels.trans hexp) + hinv0 (hinv.trans hexp) hmask0 (hmask.trans hexp) + have hbound := affineAmbientLift_le_exp (d := (d : ℝ≥0)) (sites := (sites : ℝ≥0)) hP₂ (hN.trans hexp) hm hgrid (hd.trans hexp) + ((hsites.trans hbaseE).trans hexp) hsite (hrows.trans hexp) + refine ⟨hbound.1.trans (Real.exp_le_exp.mpr ?_), hbound.2⟩ + change affineAmbientMassLog P₂ + P₂ ≤ 2 * affineAmbientMassLog P₂ + 7 * P₂ + 1 + linarith [affineAmbientMassLog_nonneg hP₂] + +theorem exists_affineAmbientPrimitiveSamplingThreshold_bound (K : ℕ) : + ∃ A : ℕ, 2 ≤ A ∧ ∀ base Q : ℝ, 0 ≤ base → 0 ≤ Q → + (ambientL1SamplingBudget (affineAmbientPrimitiveBudget base Q) + K) ^ K ≤ + (base + Q + A) ^ A := by + let poly : Polynomial ℕ := + (ambientL1SamplingBudget (affineAmbientPrimitiveBudget Polynomial.X 0) + Polynomial.C K) ^ K + obtain ⟨A, hA, hb⟩ := exists_natPolynomial_eval_budget poly + refine ⟨A, hA, ?_⟩ + intro base Q hbase hQ + simpa [poly, ambientL1SamplingBudget, ambientL1FourierInput, affineAmbientPrimitiveBudget, + affineAmbientMassLog, Polynomial.eval₂_pow] using hb (base + Q) (add_nonneg hbase hQ) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineAuxiliaryVariables.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineAuxiliaryVariables.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bf82e77c3a20dde0fd289fbd9f798718b7d39b5 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineAuxiliaryVariables.lean @@ -0,0 +1,112 @@ +import OAI.Combinatorics.Progressions.Estimates.UnitCoefficientSourceMarginal + +namespace OAI + +section + +namespace Erdos3 + +noncomputable def affineCoefficientAllowance (c w : ℝ) : ℝ := 1+|c|+|w| + +noncomputable def normalizedAffineParameter (c w r : ℝ) : ℝ := + (c+w*r)/affineCoefficientAllowance c w + +theorem affineCoefficientAllowance_pos (c w : ℝ) : 0 < affineCoefficientAllowance c w := by + unfold affineCoefficientAllowance + positivity + +theorem normalizedAffineParameter_identity (c w r : ℝ) : + affineCoefficientAllowance c w*normalizedAffineParameter c w r = c+w*r := by + unfold normalizedAffineParameter + field_simp [(affineCoefficientAllowance_pos c w).ne'] + +theorem normalizedAffineParameter_abs_le (c w r : ℝ) (hr : |r| ≤ 1) : + |normalizedAffineParameter c w r| ≤ 1 := by + rw [normalizedAffineParameter, abs_div, abs_of_pos (affineCoefficientAllowance_pos c w)] + apply (div_le_one (affineCoefficientAllowance_pos c w)).mpr + calc + |c+w*r| ≤ |c|+|w*r| := abs_add_le _ _ + _ = |c|+|w| * |r| := by rw [abs_mul] + _ ≤ |c|+|w| := by nlinarith [abs_nonneg w] + _ ≤ affineCoefficientAllowance c w := by unfold affineCoefficientAllowance; linarith + +theorem affineParameter_abs_upper (c w r : ℝ) (hr : |r| ≤ 1) : |c+w*r| ≤ |c|+|w| := by + calc + _ ≤ |c|+|w*r| := abs_add_le _ _ + _ = |c|+|w| * |r| := by rw [abs_mul] + _ ≤ _ := by nlinarith [abs_nonneg w] + +theorem affineParameter_abs_lower (c w r : ℝ) (hr : |r| ≤ 1) : |c|-|w| ≤ |c+w*r| := by + have h := abs_add_le (c+w*r) (-(w*r)) + have hb : |w*r| ≤ |w| := by rw [abs_mul]; nlinarith [abs_nonneg w] + simp only [add_neg_cancel_right, abs_neg] at h + linarith + +end Erdos3 + +end + +section + +namespace Erdos3 + +abbrev AffineAuxiliaryIndex (Z : Type*) {D : Type*} (C : D → Type*) := Z ⊕ (Σ d, C d) + +noncomputable def affineAuxiliaryVariables {Z D : Type*} {C : D → Type*} + (c w : ∀ d, C d → ℝ) (z : Z → ℝ) (r : ∀ d, C d → ℝ) : AffineAuxiliaryIndex Z C → ℝ := + Sum.elim z (fun j => normalizedAffineParameter (c j.1 j.2) (w j.1 j.2) (r j.1 j.2)) + +def affineAuxiliaryCoefficient {Z D : Type*} {C : D → Type*} (d : D) (j : C d) : + AffineAuxiliaryIndex Z C := Sum.inr ⟨d, j⟩ + +def affineAuxiliaryExtra {Z D G α : Type*} {C : D → Type*} + (extra : G → Option α → Z) (g : G) (a : Option α) : AffineAuxiliaryIndex Z C := + Sum.inl (extra g a) + +theorem affineAuxiliaryVariables_coefficient {Z D : Type*} {C : D → Type*} + (c w : ∀ d, C d → ℝ) (z : Z → ℝ) (r : ∀ d, C d → ℝ) (d : D) (j : C d) : + affineCoefficientAllowance (c d j) (w d j) * + affineAuxiliaryVariables c w z r (affineAuxiliaryCoefficient d j) = c d j+w d j*r d j := + normalizedAffineParameter_identity _ _ _ + +theorem affineAuxiliaryVariables_abs_le {Z D : Type*} {C : D → Type*} + (c w : ∀ d, C d → ℝ) (z : Z → ℝ) (r : ∀ d, C d → ℝ) + (hz : ∀ a, |z a| ≤ 1) (hr : ∀ d j, |r d j| ≤ 1) : + ∀ a, |affineAuxiliaryVariables c w z r a| ≤ 1 := by + intro a + cases a with + | inl a => exact hz a + | inr j => exact normalizedAffineParameter_abs_le _ _ _ (hr j.1 j.2) + +theorem affineAuxiliaryVariables_measurable {Ω Z D : Type*} [MeasurableSpace Ω] {C : D → Type*} + (c w : ∀ d, C d → ℝ) (z : Ω → Z → ℝ) (r : Ω → ∀ d, C d → ℝ) + (hz : ∀ a, Measurable (fun ω => z ω a)) (hr : ∀ d j, Measurable (fun ω => r ω d j)) : + ∀ a, Measurable (fun ω => affineAuxiliaryVariables c w (z ω) (r ω) a) := by + intro a + cases a with + | inl a => exact hz a + | inr j => + change Measurable (fun ω => (c j.1 j.2+w j.1 j.2*r ω j.1 j.2)/affineCoefficientAllowance (c j.1 j.2) (w j.1 j.2)) + fun_prop + +theorem normalizedCubeTuple_affineAuxiliary {Z D G α : Type*} [Fintype α] [DecidableEq α] + {B C : D → Type*} (h : D → ℕ) (extra : G → Option α → Z) + (c w : ∀ d, C d → ℝ) (z : Z → ℝ) (r : ∀ d, C d → ℝ) + (x : JointBlockParameter B h α → ℝ) (t : Finset α) (k : SamplerTupleIndex G B h) : + normalizedCubeTuple (canonicalTupleInput (affineAuxiliaryExtra (C := C) extra)) + (affineAuxiliaryVariables c w z r) x t k = normalizedCubeTuple (canonicalTupleInput extra) z x t k := by + cases k <;> rfl + +theorem rawCanonicalCubeTuple_affineAuxiliary {Z D G α : Type*} [Fintype α] [DecidableEq α] + {B C : D → Type*} (h : D → ℕ) (extra : G → Option α → Z) (T : SamplerTupleIndex G B h → ℝ) + (c w : ∀ d, C d → ℝ) (z : Z → ℝ) (r : ∀ d, C d → ℝ) (x : JointBlockParameter B h α → ℝ) : + rawCanonicalCubeTuple (affineAuxiliaryExtra (C := C) extra) T (affineAuxiliaryVariables c w z r) x = + rawCanonicalCubeTuple extra T z x := by + funext t k + cases k <;> rfl + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineBlockScale.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineBlockScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..28ad0d6b0116f53cf09685cbd590add5f3255276 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineBlockScale.lean @@ -0,0 +1,567 @@ +import OAI.Combinatorics.Progressions.Geometry.WeightedBlockSupportScale + +namespace OAI + +section + +namespace Erdos3 + +def centeredFundamentalBox {J : Type*} (Q K : ℕ) (center z : J → ℤ) : Prop := + ∀ j, center j - (Q : ℤ) * K ≤ z j ∧ z j < center j + ((Q : ℤ) + 1) * K + +theorem centeredFundamentalBox_of_support {J : Type*} {Q K : ℕ} (center y : J → ℤ) + {H : ℝ} (hK : 0 < K) (hH : H ≤ Q) + (hy : ∀ j, |(y j : ℝ) - center j| ≤ H * K) : centeredFundamentalBox Q K center y := by + intro j + have hbound : |y j - center j| ≤ (Q : ℤ) * K := by + have hh := (hy j).trans (mul_le_mul_of_nonneg_right hH (Nat.cast_nonneg K)) + exact_mod_cast hh + have hh := abs_le.mp hbound + have hK' : (0 : ℤ) < K := by exact_mod_cast hK + constructor <;> nlinarith only [hh.1, hh.2, hK'] + +theorem centeredFundamentalBox_iff {J : Type*} (Q K : ℕ) (center z : J → ℤ) : + centeredFundamentalBox Q K center z ↔ + ∀ j, center j - (Q : ℤ) * K ≤ z j ∧ + z j < (center j - (Q : ℤ) * K) + (((2 * Q + 1) * K : ℕ) : ℤ) := by + have he (j) : (center j - (Q : ℤ) * K) + (((2 * Q + 1) * K : ℕ) : ℤ) = + center j + ((Q : ℤ) + 1) * K := by push_cast; ring + simp only [centeredFundamentalBox, he] + +theorem integerGridMass_eq_imageMass_on_centered_box {X J : Type*} + [Fintype X] [Fintype J] [DecidableEq J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (center z : J → ℤ) + {Q K : ℕ} {H : ℝ} (hK : 0 < K) (hH : H ≤ Q) + (hY : ∀ x, p.weight x ≠ 0 → ∀ j, |(Y x j : ℝ) - center j| ≤ H * K) + (hz : centeredFundamentalBox Q K center z) : + integerGridMass p Y ((2 * Q + 1) * K) z = finiteImageMass p Y z := by + apply integerGridMass_eq_imageMass_on_box p Y _ (fun j => center j - (Q : ℤ) * K) z + · intro x hx + exact (centeredFundamentalBox_iff Q K center (Y x)).mp + (centeredFundamentalBox_of_support center (Y x) hK hH (hY x hx)) + · exact (centeredFundamentalBox_iff Q K center z).mp hz + +theorem integerGridDensity_eq_imageMass_on_centered_box {X J : Type*} + [Fintype X] [Fintype J] [DecidableEq J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (center z : J → ℤ) + {Q K : ℕ} {H : ℝ} (hK : 0 < K) (hH : H ≤ Q) + (hY : ∀ x, p.weight x ≠ 0 → ∀ j, |(Y x j : ℝ) - center j| ≤ H * K) + (hz : centeredFundamentalBox Q K center z) : + integerGridDensity p Y K ((2 * Q + 1) * K) z = + (K : ℝ) ^ Fintype.card J * finiteImageMass p Y z := by + unfold integerGridDensity + rw [integerGridMass_eq_imageMass_on_centered_box p Y center z hK hH hY hz] + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem finiteImageMass_total {X Z : Type*} [Fintype X] [Fintype Z] [DecidableEq Z] + (p : FiniteProbabilityWeights X) (Y : X → Z) : ∑ z, finiteImageMass p Y z = 1 := by + unfold finiteImageMass FiniteProbabilityWeights.mean + rw [Finset.sum_comm] + simp only [← Finset.mul_sum, Finset.sum_ite_eq, Finset.mem_univ, ite_true, mul_one] + exact p.total + +theorem integerGridMass_total {X J : Type*} [Fintype X] [Fintype J] [DecidableEq J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (M : ℕ) [NeZero M] (lower : J → ℤ) : + (∑ r : J → ZMod M, integerGridMass p Y M (rectangularGridRepresentative M lower r)) = 1 := by + simp only [integerGridMass_representative] + exact finiteImageMass_total p _ + +theorem integerImageMass_total_on_box {X J : Type*} [Fintype X] [Fintype J] [DecidableEq J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (M : ℕ) [NeZero M] (lower : J → ℤ) + (hY : ∀ x, p.weight x ≠ 0 → ∀ j, lower j ≤ Y x j ∧ Y x j < lower j + M) : + (∑ r : J → ZMod M, finiteImageMass p Y (rectangularGridRepresentative M lower r)) = 1 := by + have h (r : J → ZMod M) := integerGridMass_eq_imageMass_on_box p Y M lower + (rectangularGridRepresentative M lower r) hY + (rectangularGridRepresentative_bounds (Nat.pos_of_ne_zero (NeZero.ne M)) lower r) + simpa only [h] using integerGridMass_total p Y M lower + +theorem integerGridDensity_total {X J : Type*} [Fintype X] [Fintype J] [DecidableEq J] + (p : FiniteProbabilityWeights X) (Y : X → J → ℤ) (K M : ℕ) [NeZero M] (lower : J → ℤ) : + (∑ r : J → ZMod M, integerGridDensity p Y K M (rectangularGridRepresentative M lower r)) = + (K : ℝ) ^ Fintype.card J := by + simp only [integerGridDensity, ← Finset.mul_sum, integerGridMass_total, mul_one] + +def centeredGridRepresentative {J : Type*} (Q K : ℕ) (center : J → ℤ) + (r : J → ZMod ((2 * Q + 1) * K)) : J → ℤ := + rectangularGridRepresentative ((2 * Q + 1) * K) (fun j => center j - (Q : ℤ) * K) r + +theorem centeredGridRepresentative_mem {J : Type*} (Q K : ℕ) (hK : 0 < K) + (center : J → ℤ) (r : J → ZMod ((2 * Q + 1) * K)) : + centeredFundamentalBox Q K center (centeredGridRepresentative Q K center r) := by + apply (centeredFundamentalBox_iff Q K center _).mpr + exact rectangularGridRepresentative_bounds (Nat.mul_pos (by omega) hK) _ r + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators +open CircleFourier + +noncomputable def affineWeightedCubeGridCoefficient {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (u : Fin (n + 1) → Option I → ℝ) (v : Fin (n + 1) → Option I → ℕ) + (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : ℂ := + (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean (fun z => character + ((booleanBlockPhase (gridJetFrequency M J k) + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (z j i : ℝ))) : ℝ) : CircleFourier.Circle)) + +noncomputable def affineWeightedModerateGridCoefficient {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (shift : ℝ) (t : ℕ) (u : Fin n → Option I → ℝ) (v : Fin n → Option I → ℕ) + (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : ℂ := + c.source.complexMean (fun z => (FiniteProbabilityWeights.pi (fun j => (s j).source)).complexMean + (fun x => character (((shift + (t : ℝ) * (z none : ℝ)) * booleanBlockPhase (gridJetFrequency M J k) + (fun j => affineCubeCoordinates (u j) (v j) (fun i => (x j i : ℝ))) : ℝ) : CircleFourier.Circle))) + +theorem affineWeightedCubeGridCoefficient_norm_le_one {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (u : Fin (n + 1) → Option I → ℝ) (v : Fin (n + 1) → Option I → ℕ) + (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : + ‖affineWeightedCubeGridCoefficient s u v M J k‖ ≤ 1 := by + let p := FiniteProbabilityWeights.pi (fun j => (s j).source) + exact (p.norm_complexMean_le_mean_norm _).trans_eq (by simp only [norm_character, p.mean_const]) + +theorem affineWeightedModerateGridCoefficient_norm_le_one {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (shift : ℝ) (t : ℕ) (u : Fin n → Option I → ℝ) (v : Fin n → Option I → ℕ) + (M : ℕ) (J : Finset (Finset I)) (k : J → Fin M) : + ‖affineWeightedModerateGridCoefficient c s shift t u v M J k‖ ≤ 1 := by + let p := FiniteProbabilityWeights.pi (fun j => (s j).source) + apply (c.source.norm_complexMean_le_mean_norm _).trans + apply (c.source.mean_mono (fun z => ?_)).trans_eq (c.source.mean_const 1) + exact (p.norm_complexMean_le_mean_norm _).trans_eq (by simp only [norm_character, p.mean_const]) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators NNReal Classical + +theorem affineWeightedCubeGridCoefficient_mem_cover {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hlen : ∀ j, majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ (s j).length) + (u : Fin (n + 1) → Option I → ℝ) (v : Fin (n + 1) → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (hstride : ∀ j i, ((v j i * (s j).modulus i : ℕ) : ℝ) ≤ U) + {M : ℕ} (hM : 0 < M) (hscale : (M : ℝ) / ∏ j, ((s j).length : ℝ) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) + (k : J → Fin M) (hk : ζ ≤ ‖affineWeightedCubeGridCoefficient s u v M J k‖) : + k ∈ polynomialGridCover J M (majorArcCoverConstant n J.card U V) (majorArcCoverExponent n J.card) ζ := by + have hU := (h 0).one_le + obtain ⟨D, hD, hDb, a, ha⟩ := polynomial_affine_weightedCubeBlock_major_arc s A hA h hζ hζ1 + (fun j => (localizedMajorArcLengthBudget_le_power n hU hζ hζ1).trans (hlen j)) + u v hv hstride (gridJetFrequency M J k) J hJ hk + have hQ := (majorArc_denominator_le_cover n J.card hU hV hζ hζ1).trans (Nat.le_ceil _) + have hH := (majorArc_scaled_error_le_cover n J.card hU hV hζ hζ1 hscale).trans (Nat.le_ceil _) + apply mem_rationalGridMajorBox hM k hD (by exact_mod_cast hDb.trans hQ) a _ hH + intro S + simpa only [gridJetFrequency_apply] using ha S + +theorem affineWeightedModerateGridCoefficient_mem_cover {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) {U V ζ : ℝ} + (hc : ScalarCubePrimitiveBudget c A U) (h : ∀ j, ScalarCubePrimitiveBudget (s j) A U) + (hV : 0 ≤ V) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) + (hclen : majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ c.length) + (hlen : ∀ j, majorArcLengthConstant n U / ζ ^ majorArcLengthExponent n ≤ (s j).length) + (shift : ℝ) (t : ℕ) (ht : 0 < t) (u : Fin n → Option I → ℝ) (v : Fin n → Option I → ℕ) + (hv : ∀ j i, 0 < v j i) (hstride : ∀ j i, ((v j i * (s j).modulus i : ℕ) : ℝ) ≤ U) + (hcoeff : ((t * c.modulus none : ℕ) : ℝ) ≤ U) + {M : ℕ} (hM : 0 < M) + (hscale : (M : ℝ) / ((((t * c.modulus none : ℕ) : ℝ) * c.length) * ∏ j, ((s j).length : ℝ)) ≤ V) + (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) + (k : J → Fin M) (hk : ζ ≤ ‖affineWeightedModerateGridCoefficient c s shift t u v M J k‖) : + k ∈ polynomialGridCover J M (majorArcCoverConstant n J.card U V) (majorArcCoverExponent n J.card) ζ := by + have hU := hc.one_le + have hU0 : 0 ≤ U := le_trans (by norm_num) hU + obtain ⟨D, hD, hDb, a, ha⟩ := polynomial_affine_weightedModerateBlock_major_arc c s A hA hc h hζ hζ1 + ((localizedMajorArcLengthBudget_le_power n hU hζ hζ1).trans hclen) + (fun j => (localizedMajorArcLengthBudget_le_power n hU hζ hζ1).trans (hlen j)) + shift t ht u v hv hstride (gridJetFrequency M J k) J hJ hk + have hden : (localizedMajorArcBudget n U ζ * (((t * c.modulus none : ℕ) : ℝ) * U ^ n)) ^ J.card ≤ + (localizedMajorArcBudget n U ζ * U ^ (n + 1)) ^ J.card := by + apply pow_le_pow_left₀ (by positivity [localizedMajorArcBudget_pos n hU hζ]) + apply mul_le_mul_of_nonneg_left _ (localizedMajorArcBudget_pos n hU hζ).le + rw [pow_succ'] + exact mul_le_mul_of_nonneg_right hcoeff (pow_nonneg hU0 n) + have hQ := (hden.trans (majorArc_denominator_le_cover n J.card hU hV hζ hζ1)).trans (Nat.le_ceil _) + have hH := (majorArc_scaled_error_le_cover n J.card hU hV hζ hζ1 hscale).trans (Nat.le_ceil _) + apply mem_rationalGridMajorBox hM k hD (by exact_mod_cast hDb.trans hQ) a _ hH + intro S + simpa only [gridJetFrequency_apply] using ha S + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators Classical + +noncomputable def affineWeightedCubeIntegerBlock {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) (u : Fin (n + 1) → Option I → ℤ) + (v : Fin (n + 1) → Option I → ℕ) (J : Finset (Finset I)) + (x : ∀ j, IntegerScalarCubeBox I (s j).length) : J → ℤ := + fun S => integerBooleanBlockJet (fun j => affineIntegerCubeCoordinates (u j) (v j) (fun i => (x j i : ℤ))) S + +theorem affineWeightedCubeGridCoefficient_eq_image {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : Fin (n + 1) → NormalizedScalarCubeSource I) (u : Fin (n + 1) → Option I → ℤ) + (v : Fin (n + 1) → Option I → ℕ) (M : ℕ) [NeZero M] (J : Finset (Finset I)) (k : J → Fin M) : + integerGridCoefficient (FiniteProbabilityWeights.pi (fun j => (s j).source)) + (affineWeightedCubeIntegerBlock s u v J) M k = + affineWeightedCubeGridCoefficient s (fun j i => (u j i : ℝ)) v M J k := by + unfold integerGridCoefficient affineWeightedCubeGridCoefficient + congr 1 + funext x + rw [rectangularGridCharacter_eq] + unfold affineWeightedCubeIntegerBlock + rw [integerBooleanBlockJet_pairing] + unfold affineIntegerCubeCoordinates affineCubeCoordinates + simp only [Int.cast_add, Int.cast_mul, Int.cast_natCast] + +noncomputable def affineWeightedCubeIntegerSum {B : Type*} [Fintype B] {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (u : B → Fin (n + 1) → Option I → ℤ) (v : B → Fin (n + 1) → Option I → ℕ) + (J : Finset (Finset I)) (shift : J → ℤ) + (x : ∀ b j, IntegerScalarCubeBox I (s b j).length) : J → ℤ := + shift + ∑ b, affineWeightedCubeIntegerBlock (s b) (u b) (v b) J (x b) + +theorem affineWeightedCubeIntegerSum_coefficient {B : Type*} [Fintype B] [DecidableEq B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (u : B → Fin (n + 1) → Option I → ℤ) (v : B → Fin (n + 1) → Option I → ℕ) + (M : ℕ) [NeZero M] (J : Finset (Finset I)) (shift : J → ℤ) (k : J → Fin M) : + integerGridCoefficient (weightedCubeIntegerSource s) (affineWeightedCubeIntegerSum s u v J shift) M k = + rectangularGridCharacter M k shift * + ∏ b, affineWeightedCubeGridCoefficient (s b) (fun j i => (u b j i : ℝ)) (v b) M J k := by + have h := independent_integerGridCoefficient + (fun b => FiniteProbabilityWeights.pi (fun j => (s b j).source)) + (fun b => affineWeightedCubeIntegerBlock (s b) (u b) (v b) J) shift M k + unfold weightedCubeIntegerSource affineWeightedCubeIntegerSum + simpa only [affineWeightedCubeGridCoefficient_eq_image] using h + +noncomputable def affineWeightedModerateIntegerBlock {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (offset : ℤ) (stride : ℕ) (u : Fin n → Option I → ℤ) (v : Fin n → Option I → ℕ) + (J : Finset (Finset I)) + (x : IntegerScalarCubeBox Empty c.length × (∀ j, IntegerScalarCubeBox I (s j).length)) : J → ℤ := + fun S => (offset + (stride : ℤ) * (x.1 none : ℤ)) * + integerBooleanBlockJet (fun j => affineIntegerCubeCoordinates (u j) (v j) (fun i => (x.2 j i : ℤ))) S + +theorem affineWeightedModerateGridCoefficient_eq_image {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (offset : ℤ) (stride : ℕ) (u : Fin n → Option I → ℤ) (v : Fin n → Option I → ℕ) + (M : ℕ) [NeZero M] (J : Finset (Finset I)) (k : J → Fin M) : + integerGridCoefficient (weightedModerateIntegerSource c s) + (affineWeightedModerateIntegerBlock c s offset stride u v J) M k = + affineWeightedModerateGridCoefficient c s (offset : ℝ) stride (fun j i => (u j i : ℝ)) v 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] + unfold affineWeightedModerateIntegerBlock + rw [integerBooleanBlockJet_scaled_pairing] + unfold affineIntegerCubeCoordinates affineCubeCoordinates + simp only [Int.cast_add, Int.cast_mul, Int.cast_natCast] + +noncomputable def affineWeightedModerateIntegerSum {B : Type*} [Fintype B] {n : ℕ} {I : Type*} + [Fintype I] [DecidableEq I] (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 → ℕ) + (J : Finset (Finset I)) (shift : J → ℤ) + (x : ∀ b, IntegerScalarCubeBox Empty (c b).length × (∀ j, IntegerScalarCubeBox I (s b j).length)) : J → ℤ := + shift + ∑ b, affineWeightedModerateIntegerBlock (c b) (s b) (offset b) (stride b) (u b) (v b) J (x b) + +theorem affineWeightedModerateIntegerSum_coefficient {B : Type*} [Fintype B] [DecidableEq B] + {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] + (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 → ℕ) + (M : ℕ) [NeZero M] (J : Finset (Finset I)) (shift : J → ℤ) (k : J → Fin M) : + integerGridCoefficient (weightedModerateIntegerProductSource c s) + (affineWeightedModerateIntegerSum c s offset stride u v J shift) M k = + rectangularGridCharacter M k shift * ∏ b, affineWeightedModerateGridCoefficient (c b) (s b) + (offset b : ℝ) (stride b) (fun j i => (u b j i : ℝ)) (v b) M J k := by + have h := independent_integerGridCoefficient (fun b => weightedModerateIntegerSource (c b) (s b)) + (fun b => affineWeightedModerateIntegerBlock (c b) (s b) (offset b) (stride b) (u b) (v b) J) shift M k + unfold weightedModerateIntegerProductSource affineWeightedModerateIntegerSum + simpa only [affineWeightedModerateGridCoefficient_eq_image] using h + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +def affineCubeCoordinateRadius {I : Type*} [Fintype I] (L : ℕ) + (u : Option I → ℤ) (v : Option I → ℕ) : ℕ := + ∑ i, ((u i).natAbs + v i * L) + +theorem affineIntegerCubeCoordinates_bound {I : Type*} [Fintype I] {L : ℕ} + (u : Option I → ℤ) (v : Option I → ℕ) (x : IntegerScalarCubeBox I L) (i : Option I) : + |affineIntegerCubeCoordinates u v (fun r => (x r : ℤ)) i| ≤ + (affineCubeCoordinateRadius L u v : ℤ) := by + classical + have hi : (u i).natAbs + v i * L ≤ affineCubeCoordinateRadius L u v := + Finset.single_le_sum (fun j _ => Nat.zero_le ((u j).natAbs + v j * L)) (Finset.mem_univ i) + calc + _ ≤ |u i| + (v i : ℤ) * L := by + unfold affineIntegerCubeCoordinates + apply (abs_add_le _ _).trans + rw [abs_mul, abs_of_nonneg (show (0 : ℤ) ≤ (v i : ℤ) from Nat.cast_nonneg (v i))] + exact add_le_add le_rfl (mul_le_mul_of_nonneg_left + (integerScalarCubeBox_coordinate_abs x i) (Nat.cast_nonneg (v i))) + _ ≤ _ := by + have hic : ((u i).natAbs : ℤ) + (v i : ℤ) * L ≤ (affineCubeCoordinateRadius L u v : ℤ) := by + exact_mod_cast hi + simpa only [Int.natCast_natAbs] using hic + +def affineWeightedCubeJetBound {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 → ℕ) + (S : Finset I) : ℤ := + ∑ b, (2 : ℤ) ^ S.card * ∏ j, ((Fintype.card I + 1 : ℕ) : ℤ) * + affineCubeCoordinateRadius (s b j).length (u b j) (v b j) + +theorem affineWeightedCubeIntegerSum_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 → ℕ) + (J : Finset (Finset I)) (shift : J → ℤ) + (x : ∀ b j, IntegerScalarCubeBox I (s b j).length) (S : J) : + |affineWeightedCubeIntegerSum s u v J shift x S - shift S| ≤ affineWeightedCubeJetBound s u v S := by + classical + simp only [affineWeightedCubeIntegerSum, Pi.add_apply, Finset.sum_apply, add_sub_cancel_left] + apply (Finset.abs_sum_le_sum_abs _ _).trans + apply Finset.sum_le_sum + intro b _ + exact integerBooleanBlockJet_bound _ + (fun j => affineCubeCoordinateRadius (s b j).length (u b j) (v b j)) + (fun j i => affineIntegerCubeCoordinates_bound (u b j) (v b j) (x b j) i) S + +def affineWeightedModerateJetBound {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} + (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 → ℕ) (S : Finset I) : ℤ := + ∑ b, (|offset b| + (stride b : ℤ) * (c b).length) * + ((2 : ℤ) ^ S.card * ∏ j, ((Fintype.card I + 1 : ℕ) : ℤ) * + affineCubeCoordinateRadius (s b j).length (u b j) (v b j)) + +theorem affineWeightedModerateIntegerBlock_bound {I : Type*} [Fintype I] [DecidableEq I] + {n : ℕ} (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) + (offset : ℤ) (stride : ℕ) (u : Fin n → Option I → ℤ) (v : Fin n → Option I → ℕ) + (J : Finset (Finset I)) + (x : IntegerScalarCubeBox Empty c.length × (∀ j, IntegerScalarCubeBox I (s j).length)) (S : J) : + |affineWeightedModerateIntegerBlock c s offset stride u v J x S| ≤ + (|offset| + (stride : ℤ) * c.length) * ((2 : ℤ) ^ S.val.card * + ∏ j, ((Fintype.card I + 1 : ℕ) : ℤ) * affineCubeCoordinateRadius (s j).length (u j) (v j)) := by + have hc : |offset + (stride : ℤ) * (x.1 none : ℤ)| ≤ |offset| + (stride : ℤ) * c.length := by + apply (abs_add_le _ _).trans + rw [abs_mul, abs_of_nonneg (show (0 : ℤ) ≤ (stride : ℤ) from Nat.cast_nonneg stride)] + exact add_le_add le_rfl (mul_le_mul_of_nonneg_left + (integerScalarCubeBox_coordinate_abs x.1 none) (Nat.cast_nonneg stride)) + have hj := integerBooleanBlockJet_bound _ + (fun j => affineCubeCoordinateRadius (s j).length (u j) (v j)) + (fun j i => affineIntegerCubeCoordinates_bound (u j) (v j) (x.2 j) i) S.val + unfold affineWeightedModerateIntegerBlock + rw [abs_mul] + exact mul_le_mul hc hj (abs_nonneg _) (by positivity) + +theorem affineWeightedModerateIntegerSum_bound {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (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 → ℕ) (J : Finset (Finset I)) (shift : J → ℤ) + (x : ∀ b, IntegerScalarCubeBox Empty (c b).length × (∀ j, IntegerScalarCubeBox I (s b j).length)) (S : J) : + |affineWeightedModerateIntegerSum c s offset stride u v J shift x S - shift S| ≤ + affineWeightedModerateJetBound c s offset stride u v S := by + classical + simp only [affineWeightedModerateIntegerSum, 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 _ => + affineWeightedModerateIntegerBlock_bound (c b) (s b) (offset b) (stride b) (u b) (v b) J (x b) S) + +theorem affineWeightedCube_mass_on_fundamental_box {B I : Type*} + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] {n K Q : ℕ} + (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) + (u : B → Fin (n + 1) → Option I → ℤ) (v : B → Fin (n + 1) → Option I → ℕ) + (hK : 0 < K) (J : Finset (Finset I)) + (hQ : ∀ S : J, affineWeightedCubeJetBound s u v S ≤ (Q : ℤ) * K) + (center z : J → ℤ) (hz : centeredFundamentalBox Q K center z) : + integerGridMass (weightedCubeIntegerSource s) (affineWeightedCubeIntegerSum s u v J center) + ((2 * Q + 1) * K) z = + finiteImageMass (weightedCubeIntegerSource s) (affineWeightedCubeIntegerSum s u v J center) z := by + apply integerGridMass_eq_imageMass_on_centered_box _ _ center z hK (H := (Q : ℝ)) le_rfl _ hz + intro x _ S + exact_mod_cast (affineWeightedCubeIntegerSum_bound s u v J center x S).trans (hQ S) + +theorem affineWeightedModerate_mass_on_fundamental_box {B I : Type*} + [Fintype B] [DecidableEq B] [Fintype I] [DecidableEq I] {n K Q : ℕ} + (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 → ℕ) (hK : 0 < K) (J : Finset (Finset I)) + (hQ : ∀ S : J, affineWeightedModerateJetBound c s offset stride u v S ≤ (Q : ℤ) * K) + (center z : J → ℤ) (hz : centeredFundamentalBox Q K center z) : + integerGridMass (weightedModerateIntegerProductSource c s) + (affineWeightedModerateIntegerSum c s offset stride u v J center) ((2 * Q + 1) * K) z = + finiteImageMass (weightedModerateIntegerProductSource c s) + (affineWeightedModerateIntegerSum c s offset stride u v J center) z := by + apply integerGridMass_eq_imageMass_on_centered_box _ _ center z hK (H := (Q : ℝ)) le_rfl _ hz + intro x _ S + exact_mod_cast (affineWeightedModerateIntegerSum_bound c s offset stride u v J center x S).trans (hQ S) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped BigOperators + +theorem affineCubeCoordinateRadius_le {I : Type*} [Fintype I] + (L : ℕ) (u : Option I → ℤ) (v : Option I → ℕ) {C : ℝ} + (h : ∀ i, |(u i : ℝ)| + (v i : ℝ) * L ≤ C * L) : + (affineCubeCoordinateRadius L u v : ℝ) ≤ ((Fintype.card I + 1 : ℕ) : ℝ) * C * L := by + classical + simp only [affineCubeCoordinateRadius, Nat.cast_sum, Nat.cast_add, Nat.cast_mul, + Nat.cast_natAbs, Int.cast_abs] + calc + _ ≤ ∑ _i : Option I, C * L := Finset.sum_le_sum (fun i _ => h i) + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_option, nsmul_eq_mul] + push_cast + ring + +theorem affine_coordinate_relative_bound {L V : ℕ} {O : ℝ} (u : ℤ) (v : ℕ) + (hu : |(u : ℝ)| ≤ O * L) (hv : v ≤ V) : + |(u : ℝ)| + (v : ℝ) * L ≤ (O + V) * L := by + have hv' : (v : ℝ) ≤ V := by exact_mod_cast hv + have h := add_le_add hu (mul_le_mul_of_nonneg_right hv' (Nat.cast_nonneg L)) + simpa only [add_mul] using h + +noncomputable def affineBlockScaleBound (q g b : ℕ) (C V : ℝ) : ℝ := + blockJetScaleBound q g b ((((q + 1 : ℕ) : ℝ) * C) ^ g * V) + +theorem affineBlockScaleBound_nonneg (q g b : ℕ) {C V : ℝ} (hC : 0 ≤ C) (hV : 0 ≤ V) : + 0 ≤ affineBlockScaleBound q g b C V := + blockJetScaleBound_nonneg q g b (by positivity) + +theorem affineCube_radius_product_le {G I : Type*} [Fintype G] [Fintype I] + (L : G → ℕ) (u : G → Option I → ℤ) (v : G → Option I → ℕ) {C : ℝ} + (h : ∀ j i, |(u j i : ℝ)| + (v j i : ℝ) * L j ≤ C * L j) : + (∏ j, (affineCubeCoordinateRadius (L j) (u j) (v j) : ℝ)) ≤ + (((Fintype.card I + 1 : ℕ) : ℝ) * C) ^ Fintype.card G * ∏ j, (L j : ℝ) := by + classical + calc + _ ≤ ∏ j, (((Fintype.card I + 1 : ℕ) : ℝ) * C) * L j := by + exact Finset.prod_le_prod₀ (fun _ _ => Nat.cast_nonneg _) + (fun j _ => affineCubeCoordinateRadius_le (L j) (u j) (v j) (h j)) + _ = _ := by rw [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ] + +theorem affineWeightedCubeJetBound_le_scale {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 → ℕ) + {C V K : ℝ} (hC : 0 ≤ C) + (hcoord : ∀ b j i, |(u b j i : ℝ)| + (v b j i : ℝ) * (s b j).length ≤ C * (s b j).length) + (hvol : ∀ b, (∏ j, ((s b j).length : ℝ)) ≤ V * K) + (S : Finset I) (hS : S.card ≤ n + 1) : + (affineWeightedCubeJetBound s u v S : ℝ) ≤ + affineBlockScaleBound (Fintype.card I) (n + 1) (Fintype.card B) C V * K := by + classical + simp only [affineWeightedCubeJetBound, Int.cast_sum, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, + Int.cast_prod, Int.cast_natCast, Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ, + Fintype.card_fin] + calc + _ ≤ ∑ _b : B, (2 : ℝ) ^ (n + 1) * ((Fintype.card I + 1 : ℕ) : ℝ) ^ (n + 1) * + ((((Fintype.card I + 1 : ℕ) : ℝ) * C) ^ (n + 1) * (V * K)) := by + apply Finset.sum_le_sum + intro b _ + have hp := (affineCube_radius_product_le (fun j => (s b j).length) (u b) (v b) (hcoord b)).trans + (mul_le_mul_of_nonneg_left (hvol b) (by positivity)) + simp only [Fintype.card_fin] at hp + have htwo := pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) hS + have htwo' := mul_le_mul_of_nonneg_right htwo + (show 0 ≤ ((Fintype.card I + 1 : ℕ) : ℝ) ^ (n + 1) by positivity) + simpa only [mul_assoc] using mul_le_mul htwo' hp (by positivity) (by positivity) + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, affineBlockScaleBound, blockJetScaleBound] + ring + +theorem affineWeightedModerateJetBound_le_scale {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] + {n : ℕ} (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 → ℕ) + {C V K : ℝ} (hC : 0 ≤ C) + (hcoord : ∀ b j i, |(u b j i : ℝ)| + (v b j i : ℝ) * (s b j).length ≤ C * (s b j).length) + (hvol : ∀ b, (|(offset b : ℝ)| + (stride b : ℝ) * (c b).length) * + (∏ j, ((s b j).length : ℝ)) ≤ V * K) + (S : Finset I) (hS : S.card ≤ n) : + (affineWeightedModerateJetBound c s offset stride u v S : ℝ) ≤ + affineBlockScaleBound (Fintype.card I) n (Fintype.card B) C V * K := by + classical + simp only [affineWeightedModerateJetBound, Int.cast_sum, Int.cast_mul, Int.cast_pow, Int.cast_ofNat, + Int.cast_prod, Int.cast_natCast, Int.cast_add, Int.cast_abs, Finset.prod_mul_distrib, + Finset.prod_const, Finset.card_univ, Fintype.card_fin] + calc + _ = ∑ b : B, (2 : ℝ) ^ S.card * ((Fintype.card I + 1 : ℕ) : ℝ) ^ n * + ((|(offset b : ℝ)| + (stride b : ℝ) * (c b).length) * + ∏ j, (affineCubeCoordinateRadius (s b j).length (u b j) (v b j) : ℝ)) := by + apply Finset.sum_congr rfl + intro b _ + ring + _ ≤ ∑ _b : B, (2 : ℝ) ^ n * ((Fintype.card I + 1 : ℕ) : ℝ) ^ n * + ((((Fintype.card I + 1 : ℕ) : ℝ) * C) ^ n * (V * K)) := by + apply Finset.sum_le_sum + intro b _ + have hrad := affineCube_radius_product_le (fun j => (s b j).length) (u b) (v b) (hcoord b) + simp only [Fintype.card_fin] at hrad + have hp : (|(offset b : ℝ)| + (stride b : ℝ) * (c b).length) * + (∏ j, (affineCubeCoordinateRadius (s b j).length (u b j) (v b j) : ℝ)) ≤ + (((Fintype.card I + 1 : ℕ) : ℝ) * C) ^ n * (V * K) := by + calc + _ ≤ (|(offset b : ℝ)| + (stride b : ℝ) * (c b).length) * + ((((Fintype.card I + 1 : ℕ) : ℝ) * C) ^ n * ∏ j, ((s b j).length : ℝ)) := by + exact mul_le_mul_of_nonneg_left hrad (by positivity) + _ = (((Fintype.card I + 1 : ℕ) : ℝ) * C) ^ n * + ((|(offset b : ℝ)| + (stride b : ℝ) * (c b).length) * ∏ j, ((s b j).length : ℝ)) := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left (hvol b) (by positivity) + have htwo := pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) hS + have htwo' := mul_le_mul_of_nonneg_right htwo + (show 0 ≤ ((Fintype.card I + 1 : ℕ) : ℝ) ^ n by positivity) + exact mul_le_mul htwo' hp (by positivity) (by positivity) + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, affineBlockScaleBound, blockJetScaleBound] + ring + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineBooleanCubeComparison.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineBooleanCubeComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..276ce30316df384e62b3b65061f34788387c80da --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineBooleanCubeComparison.lean @@ -0,0 +1,359 @@ +import OAI.Combinatorics.Progressions.Estimates.JointBooleanStability +import OAI.Combinatorics.Progressions.Lattices.AffineCubeMinorGoodMass + +namespace OAI + +section + +namespace Erdos3 + +variable {I O : Type*} [Fintype I] [fintypeO : Fintype O] + +noncomputable def affineSelectedInjection (L : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (J : (O → ℝ) →L[ℝ] (I → ℝ)) (δ : ℝ) : (O → ℝ) →L[ℝ] (I → ℝ) := + δ • (L.symm.toContinuousLinearMap.comp J) + +theorem affineSelectedInjection_norm_le (L : (I → ℝ) ≃L[ℝ] (I → ℝ)) + (J : (O → ℝ) →L[ℝ] (I → ℝ)) {δ : ℝ} (hδ : 0 ≤ δ) + (hL : δ * ‖L.symm.toContinuousLinearMap‖ ≤ 1) (hJ : ‖J‖ ≤ 1) : + ‖affineSelectedInjection L J δ‖ ≤ 1 := by + unfold affineSelectedInjection + rw [norm_smul, Real.norm_of_nonneg hδ] + calc + _ ≤ δ * (‖L.symm.toContinuousLinearMap‖ * ‖J‖) := + mul_le_mul_of_nonneg_left (ContinuousLinearMap.opNorm_comp_le _ _) hδ + _ = (δ * ‖L.symm.toContinuousLinearMap‖) * ‖J‖ := by ring + _ ≤ 1 * 1 := mul_le_mul hL hJ (norm_nonneg _) zero_le_one + _ = 1 := one_mul _ + +theorem selectedDerivative_affine (U : (I → ℝ) → (O → ℝ)) + (L : (I → ℝ) ≃L[ℝ] (I → ℝ)) (b : I → ℝ) + (J : (O → ℝ) →L[ℝ] (I → ℝ)) (δ : ℝ) (x : I → ℝ) + (hU : DifferentiableAt ℝ U (b + L x)) : + selectedDerivative (fun y => U (b + L y)) (affineSelectedInjection L J δ) x = + δ • selectedDerivative U J (b + L x) := by + unfold selectedDerivative + change (fderiv ℝ (fun y => U (b + L.toContinuousLinearMap y)) x).comp _ = _ + rw [affineSlice_fderiv U b L.toContinuousLinearMap x hU] + ext y i + simp [affineSelectedInjection] + +omit fintypeO in +theorem invertible_smul_inverse [Fintype O] {A : (O → ℝ) →L[ℝ] (O → ℝ)} + (hA : A.IsInvertible) {δ : ℝ} (hδ : δ ≠ 0) : + (δ • A).IsInvertible ∧ (δ • A).inverse = δ⁻¹ • A.inverse := by + have hr : (δ • A).comp (δ⁻¹ • A.inverse) = ContinuousLinearMap.id ℝ (O → ℝ) := by + ext x i + simp [smul_smul, hA.self_apply_inverse, hδ] + have hl : (δ⁻¹ • A.inverse).comp (δ • A) = ContinuousLinearMap.id ℝ (O → ℝ) := by + ext x i + simp [smul_smul, hA.inverse_apply_self, hδ] + exact ⟨ContinuousLinearMap.IsInvertible.of_inverse hr hl, ContinuousLinearMap.inverse_eq hr hl⟩ + +theorem selectedDerivative_affine_inverse_bound (U : (I → ℝ) → (O → ℝ)) + (L : (I → ℝ) ≃L[ℝ] (I → ℝ)) (b : I → ℝ) + (J : (O → ℝ) →L[ℝ] (I → ℝ)) {δ K : ℝ} (hδ : 0 < δ) (x : I → ℝ) + (hU : DifferentiableAt ℝ U (b + L x)) + (hinv : (selectedDerivative U J (b + L x)).IsInvertible) + (hK : ‖(selectedDerivative U J (b + L x)).inverse‖ ≤ K) : + (selectedDerivative (fun y => U (b + L y)) (affineSelectedInjection L J δ) x).IsInvertible ∧ + ‖(selectedDerivative (fun y => U (b + L y)) + (affineSelectedInjection L J δ) x).inverse‖ ≤ δ⁻¹ * K := by + rw [selectedDerivative_affine U L b J δ x hU] + obtain ⟨hi, he⟩ := invertible_smul_inverse hinv hδ.ne' + refine ⟨hi, ?_⟩ + rw [he, norm_smul, Real.norm_of_nonneg (inv_nonneg.mpr hδ.le)] + exact mul_le_mul_of_nonneg_left hK (inv_nonneg.mpr hδ.le) + +theorem selectedDerivative_affine_derivative_bound (U : (I → ℝ) → (O → ℝ)) + (hU : ContDiff ℝ 2 U) (L : (I → ℝ) ≃L[ℝ] (I → ℝ)) (b : I → ℝ) + (J : (O → ℝ) →L[ℝ] (I → ℝ)) {δ H : ℝ} (hδ : 0 ≤ δ) (x : I → ℝ) + (hH : ‖fderiv ℝ (selectedDerivative U J) (b + L x)‖ ≤ H) : + ‖fderiv ℝ (selectedDerivative (fun y => U (b + L y)) + (affineSelectedInjection L J δ)) x‖ ≤ δ * H * ‖L.toContinuousLinearMap‖ := by + let : NormedSpace ℝ ((O → ℝ) →L[ℝ] (O → ℝ)) := ContinuousLinearMap.toNormedSpace + let : NormedSpace ℝ ((I → ℝ) →L[ℝ] ((O → ℝ) →L[ℝ] (O → ℝ))) := + ContinuousLinearMap.toNormedSpace + have hA : ContDiff ℝ 1 (selectedDerivative U J) := + (hU.fderiv_right (by norm_num)).clm_comp contDiff_const + have he : selectedDerivative (fun y => U (b + L y)) (affineSelectedInjection L J δ) = + fun y => δ • selectedDerivative U J (b + L y) := by + funext y + exact selectedDerivative_affine U L b J δ y (hU.differentiable (by norm_num) _) + rw [he] + have hd := ((hA.differentiable one_ne_zero (b + L x)).hasFDerivAt.comp x + (L.toContinuousLinearMap.hasFDerivAt.const_add b)).const_smul δ + change ‖fderiv ℝ (δ • selectedDerivative U J ∘ + (fun y => b + L.toContinuousLinearMap y)) x‖ ≤ _ + rw [hd.fderiv] + calc + _ ≤ δ * ‖(fderiv ℝ (selectedDerivative U J) (b + L x)).comp L.toContinuousLinearMap‖ := by + simpa only [Real.norm_of_nonneg hδ] using norm_smul_le δ + ((fderiv ℝ (selectedDerivative U J) (b + L x)).comp L.toContinuousLinearMap) + _ ≤ δ * (‖fderiv ℝ (selectedDerivative U J) (b + L x)‖ * ‖L.toContinuousLinearMap‖) := + mul_le_mul_of_nonneg_left (ContinuousLinearMap.opNorm_comp_le _ _) hδ + _ ≤ δ * (H * ‖L.toContinuousLinearMap‖) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hH (norm_nonneg _)) hδ + _ = _ := by ring + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped ContDiff + +variable {D α : Type*} [Fintype D] [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] + [decidableEqB : ∀ d, DecidableEq (B d)] [decidableEqO : ∀ d, DecidableEq (O d)] {h : D → ℕ} + +noncomputable def jointAffineBooleanSampler (c : ∀ d, B d → ℝ) (sets : ∀ d, O d → Finset α) + (L : ∀ d, (BlockParameter (B d) (Fin (h d)) α → ℝ) ≃L[ℝ] + (BlockParameter (B d) (Fin (h d)) α → ℝ)) + (b : ∀ d, BlockParameter (B d) (Fin (h d)) α → ℝ) : + (JointBlockParameter B h α → ℝ) → ((Σ d, O d) → ℝ) := + sigmaAxisSampler (fun d x => booleanSamplerMap (c d) (sets d) (b d + L d x)) + +noncomputable def jointAffineBooleanInjection + (block : ∀ d, O d → B d) (v : ∀ d, Fin (h d)) (sel : ∀ d, O d → Option α) + (L : ∀ d, (BlockParameter (B d) (Fin (h d)) α → ℝ) ≃L[ℝ] + (BlockParameter (B d) (Fin (h d)) α → ℝ)) (δ : D → ℝ) : + ((Σ d, O d) → ℝ) →L[ℝ] (JointBlockParameter B h α → ℝ) := + sigmaAxisOperator (fun d => affineSelectedInjection (L d) + (booleanSelectedInjection (block d) (v d) (sel d)) (δ d)) + +variable (c : ∀ d, B d → ℝ) (sets : ∀ d, O d → Finset α) + (block : ∀ d, O d → B d) (v : ∀ d, Fin (h d)) (sel : ∀ d, O d → Option α) + (L : ∀ d, (BlockParameter (B d) (Fin (h d)) α → ℝ) ≃L[ℝ] + (BlockParameter (B d) (Fin (h d)) α → ℝ)) + (b : ∀ d, BlockParameter (B d) (Fin (h d)) α → ℝ) (δ : D → ℝ) + +omit decidableEqB decidableEqO in +theorem jointAffineBooleanSampler_contDiff + [∀ d, DecidableEq (B d)] [∀ d, DecidableEq (O d)] : + ContDiff ℝ ∞ (jointAffineBooleanSampler c sets L b) := + sigmaAxisSampler_contDiff _ (fun d => + (booleanSamplerMap_contDiff (c d) (sets d)).comp (contDiff_const.add (L d).contDiff)) + +omit decidableEqO in +theorem jointAffineBooleanInjection_norm_le [∀ d, DecidableEq (O d)] + (hblock : ∀ d, Function.Injective (block d)) (hδ : ∀ d, 0 ≤ δ d) + (hL : ∀ d, δ d * ‖(L d).symm.toContinuousLinearMap‖ ≤ 1) : + ‖jointAffineBooleanInjection block v sel L δ‖ ≤ 1 := + sigmaAxisOperator_norm_le _ zero_le_one (fun d => affineSelectedInjection_norm_le + (L d) _ (hδ d) (hL d) (booleanSelectedInjection_norm_le (block d) (hblock d) (v d) (sel d))) + +theorem jointAffineBoolean_selected_inverse_bound + (hcard : ∀ d o, (sets d o).card ≤ h d) (x : JointBlockParameter B h α → ℝ) + (C κ : D → ℝ) (hC : ∀ d, 0 ≤ C d) (hκ : ∀ d, 0 < κ d) (hδ : ∀ d, 0 < δ d) + (hc : ∀ d o, |c d (block d o)| ≤ C d) + (hx : ∀ d z, |(b d + L d (fun i => x ⟨d, i⟩)) z| ≤ 1) + (hdet : ∀ d, κ d ≤ |booleanMinorDeterminant (c d) (sets d) (block d) (v d) (sel d) + (b d + L d (fun i => x ⟨d, i⟩))|) + {K : ℝ} (hK : 0 ≤ K) + (hcap : ∀ d, (δ d)⁻¹ * productMinorInverseBound (Fintype.card (O d)) (Fintype.card α) + (h d) (C d) 1 (κ d) ≤ K) : + (selectedDerivative (jointAffineBooleanSampler c sets L b) + (jointAffineBooleanInjection block v sel L δ) x).IsInvertible ∧ + ‖(selectedDerivative (jointAffineBooleanSampler c sets L b) + (jointAffineBooleanInjection block v sel L δ) x).inverse‖ ≤ K := by + have haxis (d) := boolean_selected_inverse_bound (c d) (sets d) (block d) (v d) (sel d) + (hcard d) (b d + L d (fun i => x ⟨d, i⟩)) (hC d) zero_le_one (hc d) (hx d) (hκ d) (hdet d) + have hi (d) := selectedDerivative_affine_inverse_bound (booleanSamplerMap (c d) (sets d)) + (L d) (b d) (booleanSelectedInjection (block d) (v d) (sel d)) (hδ d) (fun i => x ⟨d, i⟩) + ((booleanSamplerMap_contDiff (c d) (sets d)).differentiable (by norm_num) _) (haxis d).1 (haxis d).2 + exact sigmaAxisSampler_inverse_bound _ _ x + (fun d => ((booleanSamplerMap_contDiff (c d) (sets d)).comp + (contDiff_const.add (L d).contDiff)).differentiable (by norm_num) _) + (fun d => (hi d).1) hK (fun d => (hi d).2.trans (hcap d)) + +theorem jointAffineBoolean_selected_derivative_bound + (hcard : ∀ d o, (sets d o).card ≤ h d) (x : JointBlockParameter B h α → ℝ) + (C : D → ℝ) (hC : ∀ d, 0 ≤ C d) (hδ : ∀ d, 0 ≤ δ d) (hδone : ∀ d, δ d ≤ 1) + (hL : ∀ d, ‖(L d).toContinuousLinearMap‖ ≤ 1) + (hc : ∀ d o, |c d (block d o)| ≤ C d) + (hx : ∀ d z, |(b d + L d (fun i => x ⟨d, i⟩)) z| ≤ 1) + {H : ℝ} (hH : 0 ≤ H) + (hcap : ∀ d, productMinorDerivativeBound (Fintype.card (BlockParameter (B d) (Fin (h d)) α)) + (Fintype.card (O d)) (Fintype.card α) (h d) (C d) 1 ≤ H) : + ‖fderiv ℝ (selectedDerivative (jointAffineBooleanSampler c sets L b) + (jointAffineBooleanInjection block v sel L δ)) x‖ ≤ H := by + apply sigmaAxisSampler_selected_fderiv_norm_le _ + (fun d => ((booleanSamplerMap_contDiff (c d) (sets d)).comp + (contDiff_const.add (L d).contDiff)).of_le (by norm_num)) _ x hH + intro d + have hd := selectedDerivative_affine_derivative_bound (booleanSamplerMap (c d) (sets d)) + ((booleanSamplerMap_contDiff (c d) (sets d)).of_le (by norm_num)) (L d) (b d) + (booleanSelectedInjection (block d) (v d) (sel d)) (hδ d) (fun i => x ⟨d, i⟩) + ((boolean_selected_derivative_bound (c d) (sets d) (block d) (v d) (sel d) + (hcard d) (b d + L d (fun i => x ⟨d, i⟩)) (hC d) le_rfl (hc d) (hx d)).trans (hcap d)) + exact hd.trans ((mul_le_mul (mul_le_of_le_one_left hH (hδone d)) (hL d) + (norm_nonneg _) hH).trans_eq (mul_one _)) + +end Erdos3 + +end + +section + +namespace Erdos3 + +open scoped ContDiff + +variable {D α : Type*} [Fintype D] [Fintype α] [DecidableEq α] + {B O : D → Type*} [∀ d, Fintype (B d)] [∀ d, Fintype (O d)] + [decidableEqB : ∀ d, DecidableEq (B d)] [decidableEqO : ∀ d, DecidableEq (O d)] {h : D → ℕ} + +omit decidableEqB decidableEqO in +theorem jointAffineBoolean_c2_error_transport + [∀ d, DecidableEq (B d)] [∀ d, DecidableEq (O d)] + (c : ∀ d, B d → ℝ) (sets : ∀ d, O d → Finset α) + (L : ∀ d, (BlockParameter (B d) (Fin (h d)) α → ℝ) ≃L[ℝ] + (BlockParameter (B d) (Fin (h d)) α → ℝ)) + (b : ∀ d, BlockParameter (B d) (Fin (h d)) α → ℝ) + (hL : ∀ d, ‖(L d).toContinuousLinearMap‖ ≤ 1) + (hbox : ∀ d x, (∀ z, |x z| ≤ 1) → ∀ z, |(b d + L d x) z| ≤ 1) + (V : (JointBlockParameter B h α → ℝ) → ((Σ d, O d) → ℝ)) (hV : ContDiff ℝ 2 V) + {ε : ℝ} (herr : ∀ x, (∀ z, |x z| ≤ 1) → + ‖V x - jointBooleanSampler h c sets x‖ ≤ ε ∧ + ‖fderiv ℝ V x - fderiv ℝ (jointBooleanSampler h c sets) x‖ ≤ ε ∧ + ‖fderiv ℝ (fderiv ℝ V) x - fderiv ℝ (fderiv ℝ (jointBooleanSampler h c sets)) x‖ ≤ ε) : + let slice := fun x : JointBlockParameter B h α → ℝ => + (fun s => b s.1 s.2) + sigmaAxisOperator (fun d => (L d).toContinuousLinearMap) x + ∀ x, (∀ z, |x z| ≤ 1) → + ‖V (slice x) - jointAffineBooleanSampler c sets L b x‖ ≤ ε ∧ + ‖fderiv ℝ (V ∘ slice) x - fderiv ℝ (jointAffineBooleanSampler c sets L b) x‖ ≤ ε ∧ + ‖fderiv ℝ (fderiv ℝ (V ∘ slice)) x - + fderiv ℝ (fderiv ℝ (jointAffineBooleanSampler c sets L b)) x‖ ≤ ε := by + intro slice x hx + let b₀ : JointBlockParameter B h α → ℝ := fun s => b s.1 s.2 + let L₀ := sigmaAxisOperator (fun d => (L d).toContinuousLinearMap) + have hnorm : ‖L₀‖ ≤ 1 := sigmaAxisOperator_norm_le _ zero_le_one hL + have hbx (s : JointBlockParameter B h α) : |(b₀ + L₀ x) s| ≤ 1 := + hbox s.1 (fun i => x ⟨s.1, i⟩) (fun i => hx ⟨s.1, i⟩) s.2 + have ht := affineSlice_c2_difference_bound V (jointBooleanSampler h c sets) hV + ((jointBooleanSampler_contDiff h c sets).of_le (by norm_num)) b₀ L₀ hnorm x (herr _ hbx) + have he : (fun y => jointBooleanSampler h c sets (b₀ + L₀ y)) = + jointAffineBooleanSampler c sets L b := rfl + rw [he] at ht + exact ht + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory +open scoped ContDiff BigOperators NNReal + +variable {B O α : Type*} [Fintype B] [Fintype O] [Fintype α] + [DecidableEq B] [DecidableEq O] [DecidableEq α] {h : ℕ} + +theorem affineBooleanCube_comparison + (c : B → ℝ) (sets : O → Finset α) (block : O → B) + (hblock : Function.Injective block) (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.toContinuousLinearMap‖ ≤ 1) + (hbox : ∀ x : BlockParameter B (Fin h) α → ℝ, (∀ z, |x z| ≤ 1) → + ∀ z, |(b + L x) z| ≤ 1) + {δ C κ ε : ℝ} (hδ : 0 < δ) (hδone : δ ≤ 1) + (hLinv : δ * ‖L.symm.toContinuousLinearMap‖ ≤ 1) + (hC : 0 ≤ C) (hc : ∀ o, |c (block o)| ≤ C) (hκ : 0 < κ) + (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) + (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) + (A T : ℝ≥0) (hLip : LipschitzWith A ψ) (hTransition : LipschitzWith T Real.smoothTransition) + (r : B × Fin h → ℝ) (hr : ∀ i, 0 < r i) + (K H S : ℝ≥0) + (hK : δ⁻¹ * productMinorInverseBound (Fintype.card O) (Fintype.card α) h C 1 κ ≤ K) + (hH : productMinorDerivativeBound (Fintype.card (BlockParameter B (Fin h) α)) + (Fintype.card O) (Fintype.card α) h C 1 + 1 ≤ H) + (hS : (∑ i, ((2 * 2 ^ Fintype.card α : ℕ) : ℝ) * ((Fintype.card α : ℝ) + 1) ^ 2 * T / r i) + + (Fintype.card (B × Fin h) : ℝ) * ((Fintype.card α : ℝ) + 1) * + ((A : ℝ) / κ * productMinorDeterminantDerivativeBound + (Fintype.card (BlockParameter B (Fin h) α)) (Fintype.card O) (Fintype.card α) h C 1) ≤ S) + (V : (BlockParameter B (Fin h) α → ℝ) → (O → ℝ)) (hV : ContDiff ℝ 2 V) + (hε : 0 < ε) (hεone : ε ≤ 1) (hsmall : (K : ℝ) * ε ≤ 1 / 2) + (herr : ∀ x, (∀ z, |x z| ≤ 1) → + ‖V x - booleanSamplerMap c sets (b + L x)‖ ≤ ε ∧ + ‖fderiv ℝ V x - fderiv ℝ (fun y => booleanSamplerMap c sets (b + L y)) x‖ ≤ ε ∧ + ‖fderiv ℝ (fderiv ℝ V) x - + fderiv ℝ (fderiv ℝ (fun y => booleanSamplerMap c sets (b + L y))) x‖ ≤ ε) + (φ : (O → ℝ) → ℝ) (hφ : Measurable φ) (hbound : ∀ y, ‖φ y‖ ≤ 1) : + let η := scalarCubeBoundaryConstant α * ∑ i, r i + + (blockCubeMeasure B (Fin h) α).real + {x | |booleanMinorDeterminant c sets block v sel (b + L x)| < 2 * κ} + let Q := 1 + 2 * (K : ℝ) * S + + (Fintype.card (BlockParameter B (Fin h) α) : ℝ) * ((2 * (K : ℝ)) ^ 2 * H) + |mappedTest (blockCubeMeasure B (Fin h) α) (fun x => booleanSamplerMap c sets (b + L x)) φ - + mappedTest (blockCubeMeasure B (Fin h) α) V φ| ≤ + 2 * η + 4 * (Fintype.card O : ℝ) * Real.sqrt (Q * ε) := by + let U := booleanSamplerMap (F := Fin h) c sets + let Us := fun x => U (b + L x) + let J := booleanSelectedInjection block v sel + let Js := affineSelectedInjection L J δ + let w := affineBooleanCubeGoodWeight (fun _ : Unit => c) sets (fun _ => block) v + (fun _ => sel) L.toContinuousLinearMap b ψ r (fun _ => κ) + let χ := affineBooleanCubeCutoff (fun _ : Unit => c) sets (fun _ => block) v + (fun _ => sel) L.toContinuousLinearMap b ψ r (fun _ => κ) + let H₀ := productMinorDerivativeBound (Fintype.card (BlockParameter B (Fin h) α)) + (Fintype.card O) (Fintype.card α) h C 1 + have hH₀ : 0 ≤ H₀ := productMinorDerivativeBound_nonneg _ _ _ _ hC zero_le_one + have hU : ContDiff ℝ 2 U := (booleanSamplerMap_contDiff c sets).of_le (by norm_num) + have hUs : ContDiff ℝ 2 Us := hU.comp (contDiff_const.add L.contDiff) + have hJs : ‖Js‖ ≤ 1 := affineSelectedInjection_norm_le L J hδ.le hLinv + (booleanSelectedInjection_norm_le block hblock v sel) + have hw := affineBooleanCubeGoodWeight_spec (fun _ : Unit => c) sets (fun _ => block) v + (fun _ => sel) L.toContinuousLinearMap b ψ r (fun _ => κ) hψ hrange hzero hr (fun _ => hκ) + have hb (x) (hx : x ∈ tsupport w) : ∀ z, |x z| ≤ 1 := (hw.2.2.2.2 x hx).1 + have hi (x) (hx : x ∈ tsupport w) : + (selectedDerivative Us Js x).IsInvertible ∧ ‖(selectedDerivative Us Js x).inverse‖ ≤ K := by + have hi₀ := boolean_selected_inverse_bound c sets block v sel hcard (b + L x) + hC zero_le_one hc (hbox x (hb x hx)) hκ ((hw.2.2.2.2 x hx).2 ()) + have hi₁ := selectedDerivative_affine_inverse_bound U L b J hδ x + (hU.differentiable (by norm_num) _) hi₀.1 hi₀.2 + exact ⟨hi₁.1, hi₁.2.trans hK⟩ + have hHU₀ (x) (hx : x ∈ tsupport w) : ‖fderiv ℝ (selectedDerivative Us Js) x‖ ≤ H₀ := by + have hd := selectedDerivative_affine_derivative_bound U hU L b J hδ.le x + (boolean_selected_derivative_bound c sets block v sel hcard (b + L x) + hC le_rfl hc (hbox x (hb x hx))) + exact hd.trans ((mul_le_mul + (mul_le_of_le_one_left hH₀ hδone) hL (norm_nonneg _) hH₀).trans_eq (mul_one _)) + have hHU (x) (hx : x ∈ tsupport w) : ‖fderiv ℝ (selectedDerivative Us Js) x‖ ≤ H := + (hHU₀ x hx).trans ((le_add_of_nonneg_right zero_le_one).trans hH) + have hHV (x) (hx : x ∈ tsupport w) : ‖fderiv ℝ (selectedDerivative V Js) x‖ ≤ H := + (selectedDerivative_bound_of_second_error Us V hUs hV Js hJs x (hHU₀ x hx) + (herr x (hb x hx)).2.2).trans ((add_le_add le_rfl hεone).trans hH) + have hder : (∑ z, ∫ x, |fderiv ℝ w x (Pi.single z 1)|) ≤ S := by + have hd := affineBooleanCubeGoodWeight_derivative_budget (fun _ : Unit => c) sets (fun _ => block) + v (fun _ => sel) hcard L.toContinuousLinearMap b hL + (fun x hx => hbox _ (blockCubeFlatten_box hx)) (fun _ => C) (fun _ => hC) (fun _ => hc) + ψ hψ hrange A T hLip hTransition r hr (fun _ => κ) (fun _ => hκ) + simp only [Fintype.sum_unique] at hd + exact hd.trans hS + have hmass := affineBooleanCubeGoodWeight_mass_lower (fun _ : Unit => c) sets (fun _ => block) v + (fun _ => sel) L.toContinuousLinearMap b ψ r (fun _ => κ) hψ hrange hone hr (fun _ => hκ) + simp only [Fintype.sum_unique] at hmass + apply selected_cutoff_comparison_of_close_derivatives (blockCubeMeasure B (Fin h) α) χ w + (affineBooleanCubeCutoff_contDiff _ _ _ _ _ _ _ _ _ _ hψ).continuous.measurable + (affineBooleanCubeCutoff_range _ _ _ _ _ _ _ _ _ _ hrange) hw.1 hw.2.1 hw.2.2.1 + (affineBooleanCubeGoodWeight_measure _ _ _ _ _ _ _ _ _ _ hψ hrange hzero hr (fun _ => hκ)) + Us V hUs hV Js hJs K H S (fun x hx => (hi x hx).1) (fun x hx => (hi x hx).2) + (fun x hx => (mul_le_mul_of_nonneg_left (herr x (hb x hx)).2.1 K.coe_nonneg).trans hsmall) + hHU hHV hder hε _ _ φ hφ hbound + · simpa only [sub_add_eq_sub_sub, w, ContinuousLinearEquiv.coe_coe] using hmass + · intro x hx + rw [dist_comm, dist_eq_norm] + exact (herr x (hb x (subset_tsupport w hx))).1 + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineBoxTest.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineBoxTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..44df2a4e63b200cd68b0c7ed600cbf3cdacf4fc6 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineBoxTest.lean @@ -0,0 +1,183 @@ +import OAI.Combinatorics.Progressions.Geometry.BoxWindowAveraging + +namespace OAI + +section + +namespace Erdos3 + +open MeasureTheory +open scoped NNReal + +theorem normalizedIntervalWindow_translate (ℓ x t : ℝ) : + normalizedIntervalWindow ℓ x t = normalizedIntervalWindow ℓ 0 (t - x) := by + have hm : t ∈ Set.Ioc x (x + ℓ) ↔ t - x ∈ Set.Ioc 0 (0 + ℓ) := by + simp only [Set.mem_Ioc] + constructor <;> rintro ⟨h₁, h₂⟩ <;> constructor <;> linarith + simp only [normalizedIntervalWindow, intervalWindow, Set.indicator, hm] + +variable {ι : Type*} [Fintype ι] + +theorem boxProbabilityWindow_translate (ℓ x t : ι → ℝ) : + boxProbabilityWindow ℓ x t = boxProbabilityWindow ℓ 0 (t - x) := by + apply Finset.prod_congr rfl + intro i _ + exact normalizedIntervalWindow_translate _ _ _ + +theorem boxAverage_eq_translate (ℓ : ι → ℝ) (g : (ι → ℝ) → ℝ) (x : ι → ℝ) : + kernelAverage volume (boxProbabilityWindow ℓ) g x = + ∫ u, boxProbabilityWindow ℓ 0 u * g (u + x) := by + change (∫ t, boxProbabilityWindow ℓ x t * g t) = _ + rw [← integral_add_right_eq_self (fun t => boxProbabilityWindow ℓ x t * g t) x] + apply integral_congr_ae + filter_upwards [] with u + rw [boxProbabilityWindow_translate, add_sub_cancel_right] + +noncomputable def affineBoxAverage (ℓ : ι → ℝ) (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) + (g : (ι → ℝ) → ℝ) (x : ι → ℝ) : ℝ := + ∫ u, boxProbabilityWindow ℓ 0 u * g (x + A u) + +theorem affineBoxAverage_eq (ℓ : ι → ℝ) (A : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) + (g : (ι → ℝ) → ℝ) (x : ι → ℝ) : + affineBoxAverage ℓ A.toContinuousLinearMap g x = + kernelAverage volume (boxProbabilityWindow ℓ) (fun t => g (A t)) (A.symm x) := by + rw [boxAverage_eq_translate] + unfold affineBoxAverage + apply integral_congr_ae + filter_upwards [] with u + simp only [map_add, A.apply_symm_apply, ContinuousLinearEquiv.coe_coe, add_comm] + +theorem affineBoxAverage_lipschitz [DecidableEq ι] (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (A : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) (g : (ι → ℝ) → ℝ) (C : ℝ≥0) + (hg : Measurable g) (hbound : ∀ t, ‖g t‖ ≤ C) : + LipschitzWith ((C * boxWindowTranslationBound ℓ hℓ) * ‖A.symm.toContinuousLinearMap‖₊) + (affineBoxAverage ℓ A.toContinuousLinearMap g) := by + have h := (boxAverage_lipschitz ℓ hℓ (fun t => g (A t)) C + (hg.comp A.continuous.measurable).aestronglyMeasurable (fun t => hbound (A t))).comp + A.symm.toContinuousLinearMap.lipschitzWith + have heq : (fun x => kernelAverage volume (boxProbabilityWindow ℓ) + (fun t => g (A t)) (A.symm.toContinuousLinearMap x)) = + affineBoxAverage ℓ A.toContinuousLinearMap g := by + funext x + exact (affineBoxAverage_eq ℓ A g x).symm + change LipschitzWith _ (fun x => kernelAverage volume (boxProbabilityWindow ℓ) + (fun t => g (A t)) (A.symm.toContinuousLinearMap x)) at h + rw [heq] at h + exact h + +theorem affineBoxAverage_mem_Icc (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (A : (ι → ℝ) ≃L[ℝ] (ι → ℝ)) (g : (ι → ℝ) → ℝ) {C : ℝ} + (hg : Measurable g) (hbound : ∀ t, g t ∈ Set.Icc (0 : ℝ) C) (x : ι → ℝ) : + affineBoxAverage ℓ A.toContinuousLinearMap g x ∈ Set.Icc (0 : ℝ) C := by + rw [affineBoxAverage_eq] + exact boxAverage_mem_Icc ℓ hℓ _ (hg.comp A.continuous.measurable).aestronglyMeasurable + (fun t => hbound (A t)) _ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory + +variable {ι : Type*} [Fintype ι] + +noncomputable def affineBoxIntegrand (ℓ : ι → ℝ) (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) + (g : (ι → ℝ) → ℝ) (p : (ι → ℝ) × (ι → ℝ)) : ℝ := + boxProbabilityWindow ℓ 0 p.2 * g (p.1 + A p.2) + +theorem affineBoxIntegrand_integrable (ℓ : ι → ℝ) (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) + (g : (ι → ℝ) → ℝ) (hg : Measurable g) (hgi : Integrable g) : + Integrable (affineBoxIntegrand ℓ A g) (volume.prod volume) := by + have hm : Measurable (affineBoxIntegrand ℓ A g) := + ((boxProbabilityWindow_measurable ℓ 0).comp measurable_snd).mul + (hg.comp (measurable_fst.add (A.continuous.measurable.comp measurable_snd))) + apply (integrable_prod_iff' hm.aestronglyMeasurable).mpr + constructor + · filter_upwards [] with u + exact (hgi.comp_add_right (A u)).const_mul (boxProbabilityWindow ℓ 0 u) + · have heq (u : ι → ℝ) : (∫ x, ‖affineBoxIntegrand ℓ A g (x, u)‖) = + ‖boxProbabilityWindow ℓ 0 u‖ * ∫ x, ‖g x‖ := by + simp only [affineBoxIntegrand, norm_mul] + rw [integral_const_mul, integral_add_right_eq_self (fun x => ‖g x‖) (A u)] + simp_rw [heq] + exact (boxProbabilityWindow_integrable ℓ 0).norm.mul_const _ + +theorem affineBoxAverage_integrable (ℓ : ι → ℝ) (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) + (g : (ι → ℝ) → ℝ) (hg : Measurable g) (hgi : Integrable g) : + Integrable (affineBoxAverage ℓ A g) := + (affineBoxIntegrand_integrable ℓ A g hg hgi).integral_prod_left + +theorem affineBoxAverage_mass (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) (g : (ι → ℝ) → ℝ) + (hg : Measurable g) (hgi : Integrable g) : + (∫ x, affineBoxAverage ℓ A g x) = ∫ x, g x := by + have hi : Integrable (Function.uncurry + (fun x u => boxProbabilityWindow ℓ 0 u * g (x + A u))) (volume.prod volume) := + affineBoxIntegrand_integrable ℓ A g hg hgi + change (∫ x, ∫ u, boxProbabilityWindow ℓ 0 u * g (x + A u)) = _ + rw [integral_integral_swap hi] + simp_rw [integral_const_mul, integral_add_right_eq_self] + rw [integral_mul_const, boxProbabilityWindow_mass ℓ hℓ 0, one_mul] + +theorem affineBoxAverage_nonneg (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) (g : (ι → ℝ) → ℝ) + (hg : ∀ x, 0 ≤ g x) (x : ι → ℝ) : 0 ≤ affineBoxAverage ℓ A g x := + integral_nonneg (fun u => mul_nonneg (boxProbabilityWindow_nonneg ℓ hℓ 0 u) (hg _)) + +theorem affineBoxAverage_probability_density (ℓ : ι → ℝ) (hℓ : ∀ i, 0 < ℓ i) + (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) (g : (ι → ℝ) → ℝ) + (hg : Measurable g) (hgi : Integrable g) (hg0 : ∀ x, 0 ≤ g x) (hgmass : (∫ x, g x) = 1) : + (∀ x, 0 ≤ affineBoxAverage ℓ A g x) ∧ Integrable (affineBoxAverage ℓ A g) ∧ + (∫ x, affineBoxAverage ℓ A g x) = 1 := + ⟨affineBoxAverage_nonneg ℓ hℓ A g hg0, + affineBoxAverage_integrable ℓ A g hg hgi, (affineBoxAverage_mass ℓ hℓ A g hg hgi).trans hgmass⟩ + +end Erdos3 + +end + +section + +namespace Erdos3 + +open MeasureTheory + +variable {ι : Type*} [Fintype ι] + +theorem affineBoxAverage_test_integral (ℓ : ι → ℝ) + (A : (ι → ℝ) →L[ℝ] (ι → ℝ)) (g φ : (ι → ℝ) → ℝ) + (hg : Measurable g) (hgi : Integrable g) (hφ : Measurable φ) + {C : ℝ} (hφC : ∀ x, ‖φ x‖ ≤ C) : + (∫ x, affineBoxAverage ℓ A g x * φ x) = + ∫ u, boxProbabilityWindow ℓ 0 u * ∫ y, g y * φ (y - A u) := by + have hi : Integrable (Function.uncurry + (fun x u => (boxProbabilityWindow ℓ 0 u * g (x + A u)) * φ x)) + (volume.prod volume) := + (affineBoxIntegrand_integrable ℓ A g hg hgi).mul_bdd + (hφ.comp measurable_fst).aestronglyMeasurable + (Filter.Eventually.of_forall (fun p => hφC p.1)) + calc + (∫ x, affineBoxAverage ℓ A g x * φ x) = + ∫ x, ∫ u, (boxProbabilityWindow ℓ 0 u * g (x + A u)) * φ x := by + apply integral_congr_ae + filter_upwards [] with x + exact (integral_mul_const (φ x) _).symm + _ = ∫ u, ∫ x, (boxProbabilityWindow ℓ 0 u * g (x + A u)) * φ x := + integral_integral_swap hi + _ = ∫ u, boxProbabilityWindow ℓ 0 u * ∫ y, g y * φ (y - A u) := by + apply integral_congr_ae + filter_upwards [] with u + simp only [mul_assoc, integral_const_mul] + congr 1 + have h := integral_add_right_eq_self (μ := volume) (fun y => g y * φ (y - A u)) (A u) + simpa only [add_sub_cancel_right] using h + +end Erdos3 + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientAmplitudeCongruenceRemoval.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientAmplitudeCongruenceRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..94e5610897bc49766b05998e38e6b01a440314a1 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientAmplitudeCongruenceRemoval.lean @@ -0,0 +1,185 @@ +import OAI.Combinatorics.Progressions.Lattices.RetainedAffineCommonCover + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators NNReal + +theorem exists_affine_coefficient_amplitude_residue_uniform_removal (m : ℕ) : + ∃ 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 → ℝ)) + {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) + (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 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) + (residue : Option K × I → ℤ) + (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) + (_hwidth : ∀ z, ρ * H z.2 ≤ V z) + (F : (Option K × I → ℝ) → ℂ) (_hF : ∀ x, ‖F x‖ ≤ 1) + {Lip : ℝ≥0} (_hLip : LipschitzWith Lip F) (_hLipP : (Lip : ℝ) ≤ Real.exp P), + ∃ hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) + (residueProfileWidth stride V), + ‖∑' 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) : ℝ)))‖ ≤ ε := by + obtain ⟨A₀, _, hbudget⟩ := exists_mode_residue_threshold_exp_budget m + obtain ⟨A, hA, habsorb⟩ := exists_natPolynomial_eval_budget + ((2 * Polynomial.X + 2 + Polynomial.C A₀) ^ A₀) + refine ⟨A, hA, ?_⟩ + intro I K _ _ _ J _ P hP hn hd U C hC hCP frequency hbound hbad p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP + hstride H hsize hrank hR residue V hV hwidth F hF Lip hLip hLipP + let P' := 2 * P + 2 + have hPP : P ≤ P' := by dsimp [P']; linarith + have hP' : 0 ≤ P' := hP.trans hPP + have hExp := Real.exp_le_exp.mpr hPP + have hacc := modeAmplitudeAccuracy_pos Lip.coe_nonneg hε + have haccexp : 1 / modeAmplitudeAccuracy Lip ε ≤ Real.exp P' := + modeAmplitudeAccuracy_inv_le_exp hP Lip.coe_nonneg hLipP hε hεP + have hcut : (P' + A₀) ^ A₀ ≤ (P + A) ^ A := by + simpa [P', Polynomial.eval₂_pow] using habsorb P hP + obtain ⟨hside, hrankBudget⟩ := hbudget (Fintype.card I) (Fintype.card (Option K × I)) + P' C 1 S ρ (modeAmplitudeAccuracy Lip ε) hP' (hn.trans hPP) (hd.trans hPP) + hC (hCP.trans hExp) zero_le_one (Real.one_le_exp hP') hS (hSP.trans hExp) + hρ (hρP.trans hExp) hacc haccexp + exact affine_coefficient_amplitude_residue_removal_at_error U hC frequency hbound hbad + p hp hm stride hs hS hρ hε hstride F hF hLip H + (fun k => hside.trans ((Real.exp_le_exp.mpr hcut).trans (hsize k))) hrank + (hrankBudget.trans ((Real.exp_le_exp.mpr hcut).trans hR)) residue V hV hwidth + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators NNReal + +theorem exists_affine_coefficient_amplitude_ambient_residue_removal (m : ℕ) : + ∃ 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 → ℝ)) + {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) + (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 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) + (residue : Option K × I → ℤ) + (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) + (_hwidth : ∀ z, ρ * H z.2 ≤ V z) + (F : (Option K × I → ℝ) → ℂ) (_hF : ∀ x, ‖F x‖ ≤ 1) + {Lip : ℝ≥0} (_hLip : LipschitzWith Lip F) (_hLipP : (Lip : ℝ) ≤ Real.exp P), + ∃ hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) + (residueProfileWidth stride V), + ‖∑' z : Option K × I → ℤ, ((residueSmoothPMF residue stride _hs V hV hZ z).toReal : ℂ) * + (F (fun t => (z t : ℝ) / V t) * + layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) + p (fun k j => (z (k, j) : ℝ)))‖ ≤ ε := by + obtain ⟨A, hA, hremove⟩ := exists_affine_coefficient_amplitude_residue_uniform_removal m + refine ⟨A, hA, ?_⟩ + intro I K _ _ _ J _ P hP hn hd U C hC hCP frequency hbound hbad p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP + hstride H hsize hrank hR residue V hV hwidth F hF Lip hLip hLipP + obtain ⟨hZ, hrem⟩ := hremove hP hn hd U hC hCP frequency hbound hbad p hp hm stride hs hS hSP hρ hε hρP hεP + hstride H hsize hrank hR residue V hV hwidth F hF hLip hLipP + refine ⟨hZ, ?_⟩ + rw [residueSmoothPMF_expectation] + exact hrem + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators NNReal + +theorem exists_affine_coefficient_amplitude_congruence_removal (m : ℕ) : + ∃ 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 → ℝ)) + {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) + (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 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 : (Option K × I → ℝ) → ℂ) (_hF : ∀ x, ‖F x‖ ≤ 1) + {Lip : ℝ≥0} (_hLip : LipschitzWith Lip F) (_hLipP : (Lip : ℝ) ≤ Real.exp P), + ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, + ‖∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * + (F (fun t => (z t : ℝ) / V t) * + layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) + p (fun k j => (z (k, j) : ℝ)))‖ ≤ ε := by + obtain ⟨A, hA, hremove⟩ := exists_affine_coefficient_amplitude_ambient_residue_removal m + refine ⟨A, hA, ?_⟩ + intro I K _ _ _ J _ P hP hn hd U C hC hCP frequency hbound hbad 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 Lip hLip hLipP + have hh (r : G) := hremove hP hn hd U hC hCP frequency hbound hbad p hp hm stride hs hS hSP hρ hε hρP hεP + hstride H hsize hrank hR (columnResidueRepresentative stride r.val) V hV hwidth F hF hLip hLipP + choose hZ hrem using hh + exact selectedResidueSmoothPMF_bound_of_cells stride hs G hG V hV hZ _ hrem + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientAmplitudeDensityTest.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientAmplitudeDensityTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..98755bdad22b0759bfb952026bcd16744cc34789 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientAmplitudeDensityTest.lean @@ -0,0 +1,68 @@ +import OAI.Combinatorics.Progressions.Probability.WeightedCoefficientDensityApproximation + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open MeasureTheory +open scoped BigOperators Classical NNReal + +theorem exists_affine_coefficient_amplitude_density_test (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) + (amplitude : (Option K × I → ℝ) → ℂ) (_hamp : ∀ x, ‖amplitude x‖ ≤ 1) + {Lip : ℝ≥0} (_hLip : LipschitzWith Lip amplitude) (_hLipP : (Lip : ℝ) ≤ Real.exp P) + (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, + ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * + (amplitude (fun t => (z t : ℝ) / V t) * + (D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ))) : ℂ))) - + ∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * + amplitude (fun t => (z t : ℝ) / V t)‖ ≤ 2 * η + ε := by + obtain ⟨A, hA, hnormalization⟩ := exists_affine_coefficient_amplitude_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 + amplitude hamp Lip hLip hLipP D hD hDmass η hη happrox + obtain ⟨hZ, hfourier⟩ := 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 + amplitude hamp hLip hLipP + refine ⟨hZ, ?_⟩ + apply selectedResidueSmoothPMF_weighted_coefficient_density U μ frequency c stride G V hV hZ + (fun z => affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ))) + (fun z => amplitude (fun t => (z t : ℝ) / V t)) (fun z _ => hamp _) D hD hDmass hη happrox + simpa only [coefficientTorusFourierSum, coefficientTorusCharacter_sample U _ p hp hm] using hfourier + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientApproximatedMean.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientApproximatedMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..cea8ae03f4c1d69b465dd858cc4e833ffeeff5c2 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientApproximatedMean.lean @@ -0,0 +1,64 @@ +import OAI.Combinatorics.Progressions.Fourier.AnchoredCoefficientFourierNormalization + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators Classical + +theorem exists_affine_coefficient_approximated_mean (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 → ℝ)) + {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 : (Option K × I → ℤ) → ℂ) {η : ℝ} (_hη : 0 ≤ η) + (_hf : ∀ z ∈ rectangularWeightIndices 0 V 1, + ‖f z - ∑ a, c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ))‖ ≤ η), + ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, + ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * f z) - + (∑ a, if affineCoefficientModeTrivial U (frequency a) then c a else 0)‖ ≤ η + ε := 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 f η hη hf + 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, ?_⟩ + let g (z : Option K × I → ℤ) := ∑ a, c a * layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d t => (frequency a j d t : ℝ)))) + p (fun k j => (z (k, j) : ℝ)) + have ha := selectedResidueSmoothPMF_approximation stride G V hV hZ (fun _ => 1) f g hη + (by intro z hz; simp) hf + simp only [one_mul] at ha + exact (norm_sub_le_norm_sub_add_norm_sub _ + (∑' z, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * g z) _).trans + (add_le_add ha hnorm) + +end Erdos3.VectorPolynomial + +end + +end OAI diff --git a/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientCongruenceRemoval.lean b/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientCongruenceRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..55c9a4fa22454e02f47aefb5c54ec0042d60a1b0 --- /dev/null +++ b/lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientCongruenceRemoval.lean @@ -0,0 +1,236 @@ +import OAI.Combinatorics.Progressions.Lattices.RetainedAffineCommonCover + +namespace OAI + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +theorem affine_coefficient_residue_removal_at_error {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 S ρ ε : ℝ} (hS : 0 ≤ S) (hρ : 0 < ρ) (hε : 0 < ε) + (hstride : ∀ k, (stride k : ℝ) ≤ S) + (H : I → ℝ) + (hsize : ∀ k, modeResidueSideThreshold m (Fintype.card (Option K × I)) + 1 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 1 S ρ ε ≤ R) + (residue : Option K × I → ℤ) + (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) + (hwidth : ∀ z, ρ * H z.2 ≤ V z) : + ∃ hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) + (residueProfileWidth stride V), + ‖∑' 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) : ℝ))‖ ≤ ε := by + classical + let d := Fintype.card (Option K × I) + let D : ℝ := 1 + let T := modeRemovalShrink m d D ρ ε + let B := finiteLayerBiasBudget m (modeRemovalBias m ε) + have hD : 0 ≤ D := zero_le_one + 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 hsizeBase k : modeRemovalSideThreshold m d D S ρ ε ≤ H k := + (modeResidueSideThreshold_bounds m d hD hS hρ hε).1.trans (hsize k) + have hH k : 0 < H k := hside.1.trans_le (hsizeBase 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 (hsizeBase k) + have hv z : 1 ≤ residueProfileWidth stride V z ∧ + 1 / residueProfileWidth stride V z ≤ modeRemovalMesh d := + modeResidueWidth_mesh m d hD hS hρ hε (hs z.2) (hstride z.2) (hsize z.2) (hV z) (hwidth z) + have hmass := shiftedSmoothProductMass_lower (residueProfileCenter residue stride) + (residueProfileWidth stride V) (residueProfileWidth_pos stride V hs hV) + (modeRemovalMesh_pos d).le (modeRemovalMesh_le_one d) (fun z => (hv z).2) (modeRemovalMesh_small d) + have hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) + (residueProfileWidth stride V) := + (div_pos (Finset.prod_pos (fun z _ => residueProfileWidth_pos stride V hs hV z)) (by norm_num)).trans_le hmass + refine ⟨hZ, ?_⟩ + have hout := affine_coefficient_residue_removal_of_widths U hC frequency hbound hbad + p hp hm stride hs (modeRemovalBias_pos m hε) hT hS hstride H hH hsize' hrank hR + residue V hV hZ (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.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +theorem exists_affine_coefficient_residue_uniform_removal (m : ℕ) : + ∃ 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 → ℝ)) + {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) + (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 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) + (residue : Option K × I → ℤ) + (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) + (_hwidth : ∀ z, ρ * H z.2 ≤ V z), + ∃ hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) + (residueProfileWidth stride V), + ‖∑' 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) : ℝ))‖ ≤ ε := by + obtain ⟨A, hA, hbudget⟩ := exists_mode_residue_threshold_exp_budget m + refine ⟨A, hA, ?_⟩ + intro I K _ _ _ J _ P hP hn hd U C hC hCP frequency hbound hbad p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP + hstride H hsize hrank hR residue V hV hwidth + obtain ⟨hside, hrankBudget⟩ := hbudget (Fintype.card I) (Fintype.card (Option K × I)) + P C 1 S ρ ε hP hn hd hC hCP zero_le_one (Real.one_le_exp hP) hS hSP hρ hρP hε hεP + exact affine_coefficient_residue_removal_at_error U hC frequency hbound hbad + p hp hm stride hs hS hρ hε hstride H (fun k => hside.trans (hsize k)) hrank + (hrankBudget.trans hR) residue V hV hwidth + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +theorem exists_affine_coefficient_ambient_residue_removal (m : ℕ) : + ∃ 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 → ℝ)) + {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) + (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 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) + (residue : Option K × I → ℤ) + (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) + (_hwidth : ∀ z, ρ * H z.2 ≤ V z), + ∃ hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) + (residueProfileWidth stride V), + ‖∑' z : Option K × I → ℤ, ((residueSmoothPMF residue stride _hs V hV hZ z).toReal : ℂ) * + layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) + p (fun k j => (z (k, j) : ℝ))‖ ≤ ε := by + obtain ⟨A, hA, hremove⟩ := exists_affine_coefficient_residue_uniform_removal m + refine ⟨A, hA, ?_⟩ + intro I K _ _ _ J _ P hP hn hd U C hC hCP frequency hbound hbad p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP + hstride H hsize hrank hR residue V hV hwidth + obtain ⟨hZ, hrem⟩ := hremove hP hn hd U hC hCP frequency hbound hbad p hp hm stride hs hS hSP hρ hε hρP hεP + hstride H hsize hrank hR residue V hV hwidth + refine ⟨hZ, ?_⟩ + rw [residueSmoothPMF_expectation] + exact hrem + +end Erdos3.VectorPolynomial + +end + +section + +namespace Erdos3.VectorPolynomial + +open scoped BigOperators + +theorem exists_affine_coefficient_congruence_removal (m : ℕ) : + ∃ 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 → ℝ)) + {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) + (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 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 : ℂ) * + layeredCoefficientCharacter + (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) + p (fun k j => (z (k, j) : ℝ))‖ ≤ ε := by + obtain ⟨A, hA, hremove⟩ := exists_affine_coefficient_ambient_residue_removal m + refine ⟨A, hA, ?_⟩ + intro I K _ _ _ J _ P hP hn hd U C hC hCP frequency hbound hbad 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 + have hh (r : G) := hremove hP hn hd U hC hCP frequency hbound hbad p hp hm stride hs hS hSP hρ hε hρP hεP + hstride H hsize hrank hR (columnResidueRepresentative stride r.val) V hV hwidth + choose hZ hrem using hh + exact selectedResidueSmoothPMF_bound_of_cells stride hs G hG V hV hZ _ hrem + +end Erdos3.VectorPolynomial + +end + +end OAI